summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
commit8ab086b6cc054501bfbf7ef6fa509c393691e860 (patch)
tree324d51845d7f1a2f4e02a14db22fb5947137c822
parent411e68cc54ae97eebd79ae3a9cb2971b74cb2a9e (diff)
initial import
-rw-r--r--rsc/inc/rscall.h162
-rw-r--r--rsc/inc/rscarray.hxx187
-rw-r--r--rsc/inc/rscclass.hxx188
-rw-r--r--rsc/inc/rscclobj.hxx183
-rw-r--r--rsc/inc/rscconst.hxx146
-rw-r--r--rsc/inc/rsccont.hxx244
-rw-r--r--rsc/inc/rscdb.hxx406
-rw-r--r--rsc/inc/rscdef.hxx331
-rw-r--r--rsc/inc/rscerror.h205
-rw-r--r--rsc/inc/rscflag.hxx157
-rw-r--r--rsc/inc/rschash.hxx170
-rw-r--r--rsc/inc/rscinst.hxx310
-rw-r--r--rsc/inc/rsckey.hxx129
-rw-r--r--rsc/inc/rsclst.hxx103
-rw-r--r--rsc/inc/rscmgr.hxx169
-rw-r--r--rsc/inc/rscpar.hxx142
-rw-r--r--rsc/inc/rscrange.hxx260
-rw-r--r--rsc/inc/rscrsc.hxx158
-rw-r--r--rsc/inc/rscsfx.hxx104
-rw-r--r--rsc/inc/rscstr.hxx176
-rw-r--r--rsc/inc/rsctools.hxx246
-rw-r--r--rsc/inc/rsctop.hxx297
-rw-r--r--rsc/inc/rsctree.hxx176
-rw-r--r--rsc/prj/d.lst7
-rw-r--r--rsc/source/misc/makefile.mk82
-rw-r--r--rsc/source/misc/rscdbl.cxx162
-rw-r--r--rsc/source/misc/rsclst.cxx82
-rw-r--r--rsc/source/parser/erscerr.cxx512
-rw-r--r--rsc/source/parser/makefile.mk111
-rw-r--r--rsc/source/parser/parser.cxx91
-rw-r--r--rsc/source/parser/parser.hxx60
-rw-r--r--rsc/source/parser/rscdb.cxx1127
-rw-r--r--rsc/source/parser/rscibas.cxx736
-rw-r--r--rsc/source/parser/rscicpx.cxx2483
-rw-r--r--rsc/source/parser/rscinit.cxx1037
-rw-r--r--rsc/source/parser/rsckey.cxx297
-rw-r--r--rsc/source/parser/rsclex.cxx588
-rw-r--r--rsc/source/parser/rsclex.hxx217
-rw-r--r--rsc/source/parser/rscpar.cxx299
-rw-r--r--rsc/source/parser/rscyacc.cxx322
-rw-r--r--rsc/source/prj/gui.cxx172
-rw-r--r--rsc/source/prj/makefile.mk161
-rw-r--r--rsc/source/prj/start.cxx495
-rw-r--r--rsc/source/res/makefile.mk98
-rw-r--r--rsc/source/res/rscall.cxx125
-rw-r--r--rsc/source/res/rscarray.cxx766
-rw-r--r--rsc/source/res/rscclass.cxx1324
-rw-r--r--rsc/source/res/rscclobj.cxx303
-rw-r--r--rsc/source/res/rscconst.cxx451
-rw-r--r--rsc/source/res/rsccont.cxx1236
-rw-r--r--rsc/source/res/rscflag.cxx531
-rw-r--r--rsc/source/res/rscmgr.cxx778
-rw-r--r--rsc/source/res/rscrange.cxx904
-rw-r--r--rsc/source/res/rscstr.cxx516
-rw-r--r--rsc/source/res/rsctop.cxx1035
-rw-r--r--rsc/source/rsc/makefile.mk80
-rw-r--r--rsc/source/rsc/rsc.cxx999
-rw-r--r--rsc/source/tools/makefile.mk86
-rw-r--r--rsc/source/tools/rscchar.cxx411
-rw-r--r--rsc/source/tools/rscdef.cxx1456
-rw-r--r--rsc/source/tools/rschash.cxx440
-rw-r--r--rsc/source/tools/rsctools.cxx656
-rw-r--r--rsc/source/tools/rsctree.cxx604
-rw-r--r--sax/prj/d.lst2
-rw-r--r--sax/source/expatwrap/attrlistimpl.cxx233
-rw-r--r--sax/source/expatwrap/attrlistimpl.hxx94
-rw-r--r--sax/source/expatwrap/factory.hxx67
-rw-r--r--sax/source/expatwrap/makefile.mk92
-rw-r--r--sax/source/expatwrap/sax_expat.cxx1043
-rw-r--r--sax/source/expatwrap/saxwriter.cxx736
-rw-r--r--sax/source/expatwrap/xml2utf.cxx607
-rw-r--r--sax/test/makefile.mk101
-rw-r--r--sax/test/sax/exports.dxp3
-rw-r--r--sax/test/sax/factory.hxx122
-rw-r--r--sax/test/sax/makefile.mk99
-rw-r--r--sax/test/sax/testsax.cxx902
-rw-r--r--sax/test/sax/testwriter.cxx714
-rw-r--r--sax/test/saxdemo.cxx693
-rw-r--r--sax/test/testcomponent.cxx267
-rw-r--r--sax/util/makefile.mk93
-rw-r--r--sot/inc/absdev.hxx82
-rw-r--r--sot/inc/agg.hxx104
-rw-r--r--sot/inc/filelist.hxx111
-rw-r--r--sot/inc/stg.hxx180
-rw-r--r--sot/inc/storinfo.hxx100
-rw-r--r--sot/prj/d.lst31
-rw-r--r--sot/source/base/exchange.cxx295
-rw-r--r--sot/source/base/factory.cxx442
-rw-r--r--sot/source/base/filelist.cxx302
-rw-r--r--sot/source/base/formats.cxx1835
-rw-r--r--sot/source/base/makefile.mk109
-rw-r--r--sot/source/base/object.cxx510
-rw-r--r--sot/source/sdstor/makefile.mk114
-rw-r--r--sot/source/sdstor/sdintern.hdb22
-rw-r--r--sot/source/sdstor/stg.cxx925
-rw-r--r--sot/source/sdstor/stgavl.cxx451
-rw-r--r--sot/source/sdstor/stgavl.hxx113
-rw-r--r--sot/source/sdstor/stgcache.cxx535
-rw-r--r--sot/source/sdstor/stgcache.hxx164
-rw-r--r--sot/source/sdstor/stgdir.cxx1032
-rw-r--r--sot/source/sdstor/stgdir.hxx170
-rw-r--r--sot/source/sdstor/stgelem.cxx433
-rw-r--r--sot/source/sdstor/stgelem.hxx204
-rw-r--r--sot/source/sdstor/stgio.cxx416
-rw-r--r--sot/source/sdstor/stgio.hxx121
-rw-r--r--sot/source/sdstor/stgole.cxx255
-rw-r--r--sot/source/sdstor/stgole.hxx111
-rw-r--r--sot/source/sdstor/stgstrms.cxx1268
-rw-r--r--sot/source/sdstor/stgstrms.hxx201
-rw-r--r--sot/source/sdstor/storage.cxx948
-rw-r--r--sot/source/sdstor/storinfo.cxx143
-rw-r--r--sot/util/makefile.mk149
-rw-r--r--sot/util/makefile.pmk65
-rw-r--r--sot/workben/makefile.mk90
-rw-r--r--sot/workben/testsot.cxx86
-rw-r--r--svtools/bmpmaker/bmp.cxx903
-rw-r--r--svtools/bmpmaker/bmp.hrc78
-rw-r--r--svtools/bmpmaker/bmp.src150
-rw-r--r--svtools/bmpmaker/makefile.mk135
-rw-r--r--svtools/inc/adrparse.hxx144
-rw-r--r--svtools/inc/calendar.hxx521
-rw-r--r--svtools/inc/cntnrsrt.hxx210
-rw-r--r--svtools/inc/cntwids.hrc549
-rw-r--r--svtools/inc/ctrlbox.hxx524
-rw-r--r--svtools/inc/ctrltool.hxx257
-rw-r--r--svtools/inc/expander.hxx131
-rw-r--r--svtools/inc/filectrl.hrc68
-rw-r--r--svtools/inc/filectrl.hxx155
-rw-r--r--svtools/inc/filedlg.hxx142
-rw-r--r--svtools/inc/flbytes.hxx209
-rw-r--r--svtools/inc/fltdefs.hxx196
-rw-r--r--svtools/inc/gifread.hxx269
-rw-r--r--svtools/inc/gradwrap.hxx111
-rw-r--r--svtools/inc/htmlkywd.hxx716
-rw-r--r--svtools/inc/htmltokn.h749
-rw-r--r--svtools/inc/inetdef.hxx65
-rw-r--r--svtools/inc/inetmsg.hxx65
-rw-r--r--svtools/inc/inetstrm.hxx65
-rw-r--r--svtools/inc/iniadrtk.hxx94
-rw-r--r--svtools/inc/inidef.hxx177
-rw-r--r--svtools/inc/iniprop.hxx98
-rw-r--r--svtools/inc/instrm.hxx117
-rw-r--r--svtools/inc/itemdel.hxx72
-rw-r--r--svtools/inc/jpeg.hxx209
-rw-r--r--svtools/inc/memberid.hrc77
-rw-r--r--svtools/inc/msgrd.hxx71
-rw-r--r--svtools/inc/msgwr.hxx72
-rw-r--r--svtools/inc/numuno.hxx132
-rw-r--r--svtools/inc/outstrm.hxx103
-rw-r--r--svtools/inc/poolcach.hxx91
-rw-r--r--svtools/inc/prgsbar.hxx134
-rw-r--r--svtools/inc/privsplt.hxx119
-rw-r--r--svtools/inc/propctrl.hxx154
-rw-r--r--svtools/inc/property.hxx639
-rw-r--r--svtools/inc/reginfo.hxx98
-rw-r--r--svtools/inc/reqitem.hxx104
-rw-r--r--svtools/inc/ruler.hxx928
-rw-r--r--svtools/inc/scrwin.hxx145
-rw-r--r--svtools/inc/sectctr.hxx187
-rw-r--r--svtools/inc/sfxecode.hxx143
-rw-r--r--svtools/inc/sgfbram.hxx201
-rw-r--r--svtools/inc/sgffilt.hxx82
-rw-r--r--svtools/inc/sgvmain.hxx391
-rw-r--r--svtools/inc/sgvspln.hxx107
-rw-r--r--svtools/inc/stdmenu.hxx278
-rw-r--r--svtools/inc/strmadpt.hxx180
-rw-r--r--svtools/inc/svimpbox.hxx362
-rw-r--r--svtools/inc/svimpicn.hxx354
-rw-r--r--svtools/inc/svipcdef.h102
-rw-r--r--svtools/inc/svtool.h71
-rw-r--r--svtools/inc/sychconv.hxx85
-rw-r--r--svtools/inc/tabbar.hxx565
-rw-r--r--svtools/inc/taskbar.hxx537
-rw-r--r--svtools/inc/testtool.hxx112
-rw-r--r--svtools/inc/twain.hxx132
-rw-r--r--svtools/inc/txtattr.hxx241
-rw-r--r--svtools/inc/txtcmp.hxx236
-rw-r--r--svtools/inc/urihelper.hxx228
-rw-r--r--svtools/inc/urlbmk.hxx133
-rw-r--r--svtools/inc/wallitem.hxx230
-rw-r--r--svtools/inc/whiter.hxx91
-rw-r--r--svtools/inc/whmap.hxx92
-rw-r--r--svtools/inc/xbmread.hxx181
-rw-r--r--svtools/inc/xmlcnimp.hxx179
-rw-r--r--svtools/inc/xmlement.hxx77
-rw-r--r--svtools/inc/xpmread.hxx165
-rw-r--r--svtools/inc/zforfind.hxx261
-rw-r--r--svtools/prj/d.lst267
-rw-r--r--svtools/source/brwbox/brwbox1.cxx2396
-rw-r--r--svtools/source/brwbox/brwbox2.cxx2021
-rw-r--r--svtools/source/brwbox/brwhead.cxx144
-rw-r--r--svtools/source/brwbox/datwin.cxx694
-rw-r--r--svtools/source/brwbox/datwin.hxx269
-rw-r--r--svtools/source/brwbox/makefile.mk99
-rw-r--r--svtools/source/config/makefile.mk82
-rw-r--r--svtools/source/config/pathoptions.cxx409
-rw-r--r--svtools/source/config/useroptions.cxx325
-rw-r--r--svtools/source/contnr/cont_pch.cxx73
-rw-r--r--svtools/source/contnr/ctrdll.cxx113
-rw-r--r--svtools/source/contnr/makefile.mk134
-rw-r--r--svtools/source/contnr/svicnvw.cxx855
-rw-r--r--svtools/source/contnr/svimpbox.cxx3171
-rw-r--r--svtools/source/contnr/svimpicn.cxx4222
-rw-r--r--svtools/source/contnr/svlbitm.cxx449
-rw-r--r--svtools/source/contnr/svlbox.cxx1691
-rw-r--r--svtools/source/contnr/svtabbx.cxx639
-rw-r--r--svtools/source/contnr/svtreebx.cxx2355
-rw-r--r--svtools/source/contnr/treelist.cxx2146
-rw-r--r--svtools/source/control/calendar.cxx2963
-rw-r--r--svtools/source/control/calendar.src166
-rw-r--r--svtools/source/control/ctrlbox.cxx1227
-rw-r--r--svtools/source/control/ctrlbox.src85
-rw-r--r--svtools/source/control/ctrldll.cxx112
-rw-r--r--svtools/source/control/ctrltool.cxx865
-rw-r--r--svtools/source/control/ctrltool.src425
-rw-r--r--svtools/source/control/filectrl.cxx307
-rw-r--r--svtools/source/control/filectrl.src85
-rw-r--r--svtools/source/control/fmtfield.cxx1017
-rw-r--r--svtools/source/control/headbar.cxx1673
-rw-r--r--svtools/source/control/makefile.mk141
-rw-r--r--svtools/source/control/prgsbar.cxx270
-rw-r--r--svtools/source/control/reginfo.cxx785
-rw-r--r--svtools/source/control/ruler.cxx3064
-rw-r--r--svtools/source/control/scrwin.cxx603
-rw-r--r--svtools/source/control/stdctrl.cxx77
-rw-r--r--svtools/source/control/stdmenu.cxx446
-rw-r--r--svtools/source/control/tabbar.cxx2588
-rw-r--r--svtools/source/control/taskbar.cxx645
-rw-r--r--svtools/source/control/taskbox.cxx406
-rw-r--r--svtools/source/control/taskmisc.cxx416
-rw-r--r--svtools/source/control/taskstat.cxx769
-rw-r--r--svtools/source/control/valueset.cxx2461
-rw-r--r--svtools/source/dialogs/colctrl.cxx814
-rw-r--r--svtools/source/dialogs/colrdlg.cxx358
-rw-r--r--svtools/source/dialogs/colrdlg.hrc101
-rw-r--r--svtools/source/dialogs/colrdlg.src576
-rw-r--r--svtools/source/dialogs/filedlg.cxx185
-rw-r--r--svtools/source/dialogs/filedlg2.cxx1377
-rw-r--r--svtools/source/dialogs/filedlg2.hrc75
-rw-r--r--svtools/source/dialogs/filedlg2.hxx255
-rw-r--r--svtools/source/dialogs/filedlg2.src422
-rw-r--r--svtools/source/dialogs/makefile.mk93
-rw-r--r--svtools/source/dialogs/mcvmath.cxx336
-rw-r--r--svtools/source/dialogs/mcvmath.hxx264
-rw-r--r--svtools/source/dialogs/printdlg.cxx527
-rw-r--r--svtools/source/dialogs/printdlg.hrc95
-rw-r--r--svtools/source/dialogs/printdlg.src616
-rw-r--r--svtools/source/dialogs/prnsetup.cxx444
-rw-r--r--svtools/source/dialogs/prnsetup.hrc78
-rw-r--r--svtools/source/dialogs/prnsetup.src966
-rw-r--r--svtools/source/dialogs/propctrl.cxx534
-rw-r--r--svtools/source/dialogs/property.cxx1582
-rw-r--r--svtools/source/dialogs/wizdlg.cxx678
-rw-r--r--svtools/source/edit/makefile.mk135
-rw-r--r--svtools/source/edit/svmedit.cxx1396
-rw-r--r--svtools/source/edit/sychconv.cxx139
-rw-r--r--svtools/source/edit/textdat2.hxx338
-rw-r--r--svtools/source/edit/textdata.cxx329
-rw-r--r--svtools/source/edit/textdoc.cxx1073
-rw-r--r--svtools/source/edit/textdoc.hxx202
-rw-r--r--svtools/source/edit/texteng.cxx2691
-rw-r--r--svtools/source/edit/textund2.hxx182
-rw-r--r--svtools/source/edit/textundo.cxx374
-rw-r--r--svtools/source/edit/textundo.hxx118
-rw-r--r--svtools/source/edit/textview.cxx1760
-rw-r--r--svtools/source/edit/txtattr.cxx157
-rw-r--r--svtools/source/edit/xtextedt.cxx444
-rw-r--r--svtools/source/filerec/filerec.cxx1039
-rw-r--r--svtools/source/filerec/makefile.mk85
-rw-r--r--svtools/source/filter.vcl/filter/dlgejpg.cxx129
-rw-r--r--svtools/source/filter.vcl/filter/dlgejpg.hrc73
-rw-r--r--svtools/source/filter.vcl/filter/dlgejpg.hxx105
-rw-r--r--svtools/source/filter.vcl/filter/dlgejpg.src266
-rw-r--r--svtools/source/filter.vcl/filter/dlgexpor.cxx517
-rw-r--r--svtools/source/filter.vcl/filter/dlgexpor.hrc92
-rw-r--r--svtools/source/filter.vcl/filter/dlgexpor.hxx152
-rw-r--r--svtools/source/filter.vcl/filter/dlgexpor.src809
-rw-r--r--svtools/source/filter.vcl/filter/filter.cxx2735
-rw-r--r--svtools/source/filter.vcl/filter/filter2.cxx1427
-rw-r--r--svtools/source/filter.vcl/filter/fldll.cxx110
-rw-r--r--svtools/source/filter.vcl/filter/gradwrap.cxx619
-rw-r--r--svtools/source/filter.vcl/filter/makefile.mk137
-rw-r--r--svtools/source/filter.vcl/filter/sgf.ini118
-rw-r--r--svtools/source/filter.vcl/filter/sgfbram.cxx696
-rw-r--r--svtools/source/filter.vcl/filter/sgvmain.cxx1220
-rw-r--r--svtools/source/filter.vcl/filter/sgvspln.cxx1115
-rw-r--r--svtools/source/filter.vcl/filter/sgvtext.cxx1370
-rw-r--r--svtools/source/filter.vcl/filter/strings.hrc61
-rw-r--r--svtools/source/filter.vcl/filter/strings.src117
-rw-r--r--svtools/source/filter.vcl/igif/decode.cxx245
-rw-r--r--svtools/source/filter.vcl/igif/decode.hxx102
-rw-r--r--svtools/source/filter.vcl/igif/gifread.cxx890
-rw-r--r--svtools/source/filter.vcl/igif/makefile.mk96
-rw-r--r--svtools/source/filter.vcl/ixbm/makefile.mk95
-rw-r--r--svtools/source/filter.vcl/ixbm/xbmread.cxx429
-rw-r--r--svtools/source/filter.vcl/ixpm/makefile.mk95
-rw-r--r--svtools/source/filter.vcl/ixpm/rgbtable.hxx729
-rw-r--r--svtools/source/filter.vcl/ixpm/xpmread.cxx714
-rw-r--r--svtools/source/filter.vcl/jpeg/jpeg.cxx565
-rw-r--r--svtools/source/filter.vcl/jpeg/makefile.mk96
-rw-r--r--svtools/source/filter.vcl/wmf/emfwr.cxx1207
-rw-r--r--svtools/source/filter.vcl/wmf/emfwr.hxx129
-rw-r--r--svtools/source/filter.vcl/wmf/enhwmf.cxx1077
-rw-r--r--svtools/source/filter.vcl/wmf/makefile.mk97
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.cxx1262
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.hxx687
-rw-r--r--svtools/source/filter.vcl/wmf/winwmf.cxx886
-rw-r--r--svtools/source/filter.vcl/wmf/wmf.cxx147
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.cxx1787
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.hxx245
-rw-r--r--svtools/source/items/aeitem.cxx296
-rw-r--r--svtools/source/items/eitem.cxx81
-rw-r--r--svtools/source/items/flagitem.cxx205
-rw-r--r--svtools/source/items/intitem.cxx306
-rw-r--r--svtools/source/items/itemdel.cxx175
-rw-r--r--svtools/source/items/macitem.cxx395
-rw-r--r--svtools/source/items/makefile.mk176
-rw-r--r--svtools/source/items/poolcach.cxx186
-rw-r--r--svtools/source/items/ptitem.cxx204
-rw-r--r--svtools/source/items/rectitem.cxx211
-rw-r--r--svtools/source/items/rngitem.cxx383
-rw-r--r--svtools/source/items/stritem.cxx106
-rw-r--r--svtools/source/items/style.cxx1201
-rw-r--r--svtools/source/items/szitem.cxx214
-rw-r--r--svtools/source/items/wallitem.cxx694
-rw-r--r--svtools/source/memtools/makefile.mk118
-rw-r--r--svtools/source/memtools/svarray.cxx415
-rw-r--r--svtools/source/misc/config.src1005
-rw-r--r--svtools/source/misc/errtxt.src2778
-rw-r--r--svtools/source/misc/makefile.mk160
-rw-r--r--svtools/source/misc/urihelper.cxx683
-rw-r--r--svtools/source/misc/vcldata.cxx84
-rw-r--r--svtools/source/notify/brdcst.cxx281
-rw-r--r--svtools/source/notify/cancel.cxx221
-rw-r--r--svtools/source/notify/hint.cxx79
-rw-r--r--svtools/source/notify/isethint.cxx117
-rw-r--r--svtools/source/notify/lstner.cxx223
-rw-r--r--svtools/source/notify/makefile.mk123
-rw-r--r--svtools/source/notify/smplhint.cxx79
-rw-r--r--svtools/source/numbers/makefile.mk122
-rw-r--r--svtools/source/numbers/nbdll.cxx113
-rw-r--r--svtools/source/numbers/numfmuno.cxx1137
-rw-r--r--svtools/source/numbers/numfmuno.hxx364
-rw-r--r--svtools/source/numbers/numhead.cxx323
-rw-r--r--svtools/source/numbers/numhead.hxx142
-rw-r--r--svtools/source/numbers/numuno.cxx193
-rw-r--r--svtools/source/numbers/supservs.cxx264
-rw-r--r--svtools/source/numbers/supservs.hxx142
-rw-r--r--svtools/source/numbers/zforfind.cxx2316
-rw-r--r--svtools/source/numbers/zforlist.cxx3657
-rw-r--r--svtools/source/numbers/zformat.cxx3469
-rw-r--r--svtools/source/numbers/zforscan.cxx2406
-rw-r--r--svtools/source/numbers/zforscan.hxx254
-rw-r--r--svtools/source/plugapp/commtest.cxx303
-rw-r--r--svtools/source/plugapp/commtest.hrc68
-rw-r--r--svtools/source/plugapp/commtest.src94
-rw-r--r--svtools/source/plugapp/makefile.mk111
-rw-r--r--svtools/source/plugapp/testtool.hrc89
-rw-r--r--svtools/source/plugapp/testtool.src622
-rw-r--r--svtools/source/plugapp/ttprops.cxx119
-rw-r--r--svtools/source/svdde/ddecli.cxx509
-rw-r--r--svtools/source/svdde/ddedata.cxx253
-rw-r--r--svtools/source/svdde/ddedll.cxx96
-rw-r--r--svtools/source/svdde/ddeimp.hxx215
-rw-r--r--svtools/source/svdde/ddeinf.cxx212
-rw-r--r--svtools/source/svdde/ddeml1.cxx2689
-rw-r--r--svtools/source/svdde/ddeml2.cxx1157
-rw-r--r--svtools/source/svdde/ddemldeb.cxx311
-rw-r--r--svtools/source/svdde/ddemldeb.hxx100
-rw-r--r--svtools/source/svdde/ddemlimp.hxx467
-rw-r--r--svtools/source/svdde/ddemlos2.h411
-rw-r--r--svtools/source/svdde/ddestrg.cxx109
-rw-r--r--svtools/source/svdde/ddesvr.cxx1136
-rw-r--r--svtools/source/svdde/makefile.mk123
-rw-r--r--svtools/source/svhtml/htmlkey2.cxx700
-rw-r--r--svtools/source/svhtml/htmlkywd.cxx1099
-rw-r--r--svtools/source/svhtml/htmlout.cxx708
-rw-r--r--svtools/source/svhtml/htmlsupp.cxx205
-rw-r--r--svtools/source/svhtml/makefile.mk112
-rw-r--r--svtools/source/svhtml/parhtml.cxx2043
-rw-r--r--svtools/source/svrtf/makefile.mk105
-rw-r--r--svtools/source/svrtf/parrtf.cxx591
-rw-r--r--svtools/source/svrtf/rtfkey2.cxx1112
-rw-r--r--svtools/source/svrtf/rtfkeywd.cxx1198
-rw-r--r--svtools/source/svrtf/rtfkeywd.hxx1197
-rw-r--r--svtools/source/svrtf/rtfout.cxx224
-rw-r--r--svtools/source/svrtf/rtfout.hxx93
-rw-r--r--svtools/source/svrtf/rtftoken.h1304
-rw-r--r--svtools/source/svrtf/svparser.cxx692
-rw-r--r--svtools/source/svsql/converter.cxx75
-rw-r--r--svtools/source/svsql/converter.hxx76
-rw-r--r--svtools/source/svsql/makefile.mk124
-rw-r--r--svtools/source/undo/makefile.mk88
-rw-r--r--svtools/source/undo/undo.cxx988
-rw-r--r--svtools/source/uno/makefile.mk253
-rw-r--r--svtools/source/uno/registerservices.cxx187
-rw-r--r--svtools/source/uno/unoifac2.hrc86
-rw-r--r--svtools/source/uno/unoifac2.src223
-rw-r--r--svtools/source/uno/unoiface.cxx1756
-rw-r--r--svtools/source/urlobj/inetimg.cxx236
-rw-r--r--svtools/source/urlobj/makefile.mk89
-rw-r--r--svtools/unx/inc/convert.hxx97
-rw-r--r--svtools/unx/source/svdde/ddedummy.cxx367
-rw-r--r--svtools/unx/source/svdde/makefile.mk85
-rw-r--r--svtools/util/makefile.mk472
-rw-r--r--svtools/win/res/makefile.mk61
-rw-r--r--svtools/workben/browser.cxx882
-rw-r--r--svtools/workben/cui/loadlib.cxx121
-rw-r--r--svtools/workben/cui/makefile.mk106
-rw-r--r--svtools/workben/makefile.mk180
-rw-r--r--svtools/workben/stest.cxx239
-rw-r--r--svtools/workben/svdem.cxx1176
-rw-r--r--svtools/workben/urange.cxx251
-rw-r--r--toolkit/inc/toolkit/awt/vclxbitmap.hxx138
-rw-r--r--toolkit/inc/toolkit/awt/vclxcontainer.hxx124
-rw-r--r--toolkit/inc/toolkit/awt/vclxdevice.hxx160
-rw-r--r--toolkit/inc/toolkit/awt/vclxfont.hxx144
-rw-r--r--toolkit/inc/toolkit/awt/vclxgraphics.hxx186
-rw-r--r--toolkit/inc/toolkit/awt/vclxmenu.hxx194
-rw-r--r--toolkit/inc/toolkit/awt/vclxpointer.hxx131
-rw-r--r--toolkit/inc/toolkit/awt/vclxprinter.hxx278
-rw-r--r--toolkit/inc/toolkit/awt/vclxregion.hxx142
-rw-r--r--toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx111
-rw-r--r--toolkit/inc/toolkit/awt/vclxtoolkit.hxx133
-rw-r--r--toolkit/inc/toolkit/awt/vclxtopwindow.hxx118
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindow.hxx224
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx1093
-rw-r--r--toolkit/inc/toolkit/controls/stdtabcontroller.hxx137
-rw-r--r--toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx185
-rw-r--r--toolkit/inc/toolkit/controls/unocontrol.hxx243
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolbase.hxx103
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainer.hxx149
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx97
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolmodel.hxx193
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx1166
-rw-r--r--toolkit/inc/toolkit/helper/convert.hxx96
-rw-r--r--toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx98
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx301
-rw-r--r--toolkit/inc/toolkit/helper/macros.hxx199
-rw-r--r--toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx93
-rw-r--r--toolkit/inc/toolkit/helper/mutexhelper.hxx87
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx193
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx124
-rw-r--r--toolkit/inc/toolkit/helper/unomemorystream.hxx115
-rw-r--r--toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx95
-rw-r--r--toolkit/inc/toolkit/helper/unowrapper.hxx131
-rw-r--r--toolkit/inc/toolkit/helper/vclunohelper.hxx151
-rw-r--r--toolkit/prj/d.lst35
-rw-r--r--toolkit/source/awt/makefile.mk96
-rw-r--r--toolkit/source/awt/vclxbitmap.cxx124
-rw-r--r--toolkit/source/awt/vclxcontainer.cxx264
-rw-r--r--toolkit/source/awt/vclxdevice.cxx270
-rw-r--r--toolkit/source/awt/vclxfont.cxx263
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx518
-rw-r--r--toolkit/source/awt/vclxmenu.cxx348
-rw-r--r--toolkit/source/awt/vclxpointer.cxx111
-rw-r--r--toolkit/source/awt/vclxprinter.cxx474
-rw-r--r--toolkit/source/awt/vclxregion.cxx202
-rw-r--r--toolkit/source/awt/vclxsystemdependentwindow.cxx148
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx737
-rw-r--r--toolkit/source/awt/vclxtopwindow.cxx156
-rw-r--r--toolkit/source/awt/vclxwindow.cxx920
-rw-r--r--toolkit/source/awt/vclxwindows.cxx4078
-rw-r--r--toolkit/source/controls/makefile.mk90
-rw-r--r--toolkit/source/controls/stdtabcontroller.cxx440
-rw-r--r--toolkit/source/controls/stdtabcontrollermodel.cxx442
-rw-r--r--toolkit/source/controls/unocontrol.cxx916
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx266
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx417
-rw-r--r--toolkit/source/controls/unocontrolcontainermodel.cxx118
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx1110
-rw-r--r--toolkit/source/controls/unocontrols.cxx3090
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx215
-rw-r--r--toolkit/source/helper/makefile.mk90
-rw-r--r--toolkit/source/helper/property.cxx345
-rw-r--r--toolkit/source/helper/registerservices.cxx285
-rw-r--r--toolkit/source/helper/servicenames.cxx118
-rw-r--r--toolkit/source/helper/unomemorystream.cxx138
-rw-r--r--toolkit/source/helper/unopropertyarrayhelper.cxx182
-rw-r--r--toolkit/source/helper/unowrapper.cxx572
-rw-r--r--toolkit/source/helper/vclunohelper.cxx455
-rw-r--r--toolkit/util/makefile.mk248
-rw-r--r--toolkit/workben/controls.cxx485
-rw-r--r--toolkit/workben/makefile.mk175
-rw-r--r--tools/bootstrp/addexes/makefile.mk128
-rw-r--r--tools/bootstrp/addexes2/makefile.mk100
-rw-r--r--tools/bootstrp/addexes2/mkfilt.cxx271
-rw-r--r--tools/bootstrp/appdef.cxx192
-rw-r--r--tools/bootstrp/command.cxx716
-rw-r--r--tools/bootstrp/cppdep.cxx251
-rw-r--r--tools/bootstrp/cppdep.hxx96
-rw-r--r--tools/bootstrp/inimgr.cxx253
-rw-r--r--tools/bootstrp/iserver.cxx182
-rw-r--r--tools/bootstrp/makefile.mk205
-rw-r--r--tools/bootstrp/mkcreate.cxx1017
-rw-r--r--tools/bootstrp/prj.cxx1185
-rw-r--r--tools/bootstrp/rscdep.cxx371
-rw-r--r--tools/bootstrp/sstring.cxx319
-rw-r--r--tools/inc/impcont.hxx175
-rw-r--r--tools/inc/impstrg.hxx93
-rw-r--r--tools/inc/toolsin.hxx88
-rw-r--r--tools/os2/inc/dll.hxx72
-rw-r--r--tools/os2/source/dll/makefile.mk83
-rw-r--r--tools/os2/source/dll/toolsdll.cxx82
-rw-r--r--tools/prj/d.lst144
-rw-r--r--tools/source/communi/geninfo.cxx469
-rw-r--r--tools/source/communi/makefile.mk102
-rw-r--r--tools/source/communi/parser.cxx438
-rw-r--r--tools/source/datetime/datetime.cxx349
-rw-r--r--tools/source/datetime/makefile.mk88
-rw-r--r--tools/source/datetime/tdate.cxx540
-rw-r--r--tools/source/datetime/ttime.cxx531
-rw-r--r--tools/source/debug/debug.cxx1581
-rw-r--r--tools/source/debug/makefile.mk89
-rw-r--r--tools/source/debug/stcktree.cxx351
-rw-r--r--tools/source/fsys/comdep.cxx116
-rw-r--r--tools/source/fsys/comdep.hxx224
-rw-r--r--tools/source/fsys/dirent.cxx3521
-rw-r--r--tools/source/fsys/filecopy.cxx578
-rw-r--r--tools/source/fsys/fstat.cxx516
-rw-r--r--tools/source/fsys/makefile.mk98
-rw-r--r--tools/source/fsys/os2.cxx1153
-rw-r--r--tools/source/fsys/os2.hxx151
-rw-r--r--tools/source/fsys/tdir.cxx808
-rw-r--r--tools/source/fsys/tempfile.cxx337
-rw-r--r--tools/source/fsys/unx.cxx694
-rw-r--r--tools/source/fsys/unx.hxx139
-rw-r--r--tools/source/fsys/urlobj.cxx5021
-rw-r--r--tools/source/fsys/wldcrd.cxx177
-rw-r--r--tools/source/fsys/wntmsc.cxx1103
-rw-r--r--tools/source/fsys/wntmsc.hxx130
-rw-r--r--tools/source/generic/bigint.cxx1187
-rw-r--r--tools/source/generic/color.cxx403
-rw-r--r--tools/source/generic/fract.cxx720
-rw-r--r--tools/source/generic/gen.cxx699
-rw-r--r--tools/source/generic/link.cxx92
-rw-r--r--tools/source/generic/makefile.mk98
-rw-r--r--tools/source/generic/toolsin.cxx159
-rw-r--r--tools/source/inet/inetmime.cxx4630
-rw-r--r--tools/source/inet/inetmsg.cxx2945
-rw-r--r--tools/source/inet/inetstrm.cxx2059
-rw-r--r--tools/source/inet/makefile.mk83
-rw-r--r--tools/source/makefile.mk96
-rw-r--r--tools/source/memtools/contnr.cxx1754
-rw-r--r--tools/source/memtools/makefile.mk92
-rw-r--r--tools/source/memtools/mempool.cxx323
-rw-r--r--tools/source/memtools/multisel.cxx897
-rw-r--r--tools/source/memtools/table.cxx442
-rw-r--r--tools/source/memtools/unqidx.cxx643
-rw-r--r--tools/source/rc/makefile.mk89
-rw-r--r--tools/source/rc/rc.cxx311
-rw-r--r--tools/source/rc/resmgr.cxx1364
-rw-r--r--tools/source/ref/errinf.cxx443
-rw-r--r--tools/source/ref/globname.cxx441
-rw-r--r--tools/source/ref/makefile.mk90
-rw-r--r--tools/source/ref/pstm.cxx945
-rw-r--r--tools/source/ref/ref.cxx90
-rw-r--r--tools/source/solar/makefile.mk100
-rw-r--r--tools/source/solar/solar.c590
-rw-r--r--tools/source/stream/cachestr.cxx329
-rw-r--r--tools/source/stream/makefile.mk103
-rw-r--r--tools/source/stream/stream.cxx2905
-rw-r--r--tools/source/stream/strmos2.cxx870
-rw-r--r--tools/source/stream/strmsys.cxx74
-rw-r--r--tools/source/stream/strmunx.cxx897
-rw-r--r--tools/source/stream/strmwnt.cxx892
-rw-r--r--tools/source/stream/vcompat.cxx116
-rw-r--r--tools/source/string/makefile.mk88
-rw-r--r--tools/source/string/strascii.cxx773
-rw-r--r--tools/source/string/strcvt.cxx757
-rw-r--r--tools/source/string/strimp.cxx2306
-rw-r--r--tools/source/string/strucvt.cxx251
-rw-r--r--tools/source/string/tstring.cxx304
-rw-r--r--tools/source/string/tustring.cxx173
-rw-r--r--tools/source/zcodec/makefile.mk80
-rw-r--r--tools/source/zcodec/zcodec.cxx524
-rw-r--r--tools/unx/source/dll/makefile.mk88
-rw-r--r--tools/unx/source/dll/toolsdll.cxx81
-rw-r--r--tools/util/makefile.mk309
-rw-r--r--tools/util/tools.r17
-rw-r--r--tools/win/inc/dll.hxx103
-rw-r--r--tools/win/inc/parser.hxx78
-rw-r--r--tools/win/inc/shellex.h149
-rw-r--r--tools/win/inc/shutil.h245
-rw-r--r--tools/win/inc/toolsdll.hxx131
-rw-r--r--tools/win/inc/winshell.hxx417
-rw-r--r--tools/win/source/dll/makefile.mk112
-rw-r--r--tools/win/source/dll/toolsdll.cxx179
-rw-r--r--tools/win/source/fastfsys/makefile.mk108
-rw-r--r--tools/workben/fstest.cxx140
-rw-r--r--tools/workben/hashtbl.cxx544
-rw-r--r--tools/workben/hashtbl.hxx237
-rw-r--r--tools/workben/makefile.mk119
-rw-r--r--tools/workben/solar.c456
-rw-r--r--tools/workben/tldem.cxx113
-rw-r--r--transex3/prj/d.lst2
-rw-r--r--transex3/source/export.cxx2418
-rw-r--r--transex3/source/export2.cxx186
-rw-r--r--transex3/source/gsicheck.cxx475
-rw-r--r--transex3/source/gsiconv.cxx299
-rw-r--r--transex3/source/lngex.cxx209
-rw-r--r--transex3/source/lngmerge.cxx344
-rw-r--r--transex3/source/makefile.mk140
-rw-r--r--transex3/source/merge.cxx378
-rw-r--r--transex3/source/srclex.l283
-rw-r--r--transex3/source/tagtest.cxx749
-rw-r--r--transex3/source/utf8conv.cxx105
-rw-r--r--transex3/source/wrdtrans.cxx282
-rw-r--r--transex3/source/wtranode.cxx139
-rw-r--r--transex3/source/wtratree.cxx449
-rw-r--r--ucbhelper/inc/ucbhelper/commandenvironment.hxx142
-rw-r--r--ucbhelper/inc/ucbhelper/configureucb.hxx122
-rw-r--r--ucbhelper/inc/ucbhelper/content.hxx760
-rw-r--r--ucbhelper/inc/ucbhelper/contentbroker.hxx206
-rw-r--r--ucbhelper/inc/ucbhelper/contenthelper.hxx577
-rw-r--r--ucbhelper/inc/ucbhelper/contentidentifier.hxx142
-rw-r--r--ucbhelper/inc/ucbhelper/contentinfo.hxx215
-rw-r--r--ucbhelper/inc/ucbhelper/macros.hxx792
-rw-r--r--ucbhelper/inc/ucbhelper/propertyvalueset.hxx444
-rw-r--r--ucbhelper/inc/ucbhelper/providerhelper.hxx301
-rw-r--r--ucbhelper/inc/ucbhelper/resultset.hxx609
-rw-r--r--ucbhelper/inc/ucbhelper/resultsethelper.hxx274
-rw-r--r--ucbhelper/inc/ucbhelper/resultsetmetadata.hxx345
-rw-r--r--ucbhelper/prj/d.lst24
-rw-r--r--ucbhelper/source/client/commandenvironment.cxx191
-rw-r--r--ucbhelper/source/client/content.cxx1069
-rw-r--r--ucbhelper/source/client/contentbroker.cxx299
-rw-r--r--ucbhelper/source/client/makefile.mk91
-rw-r--r--ucbhelper/source/provider/configureucb.cxx167
-rw-r--r--ucbhelper/source/provider/contenthelper.cxx1250
-rw-r--r--ucbhelper/source/provider/contentidentifier.cxx262
-rw-r--r--ucbhelper/source/provider/contentinfo.cxx475
-rw-r--r--ucbhelper/source/provider/makefile.mk98
-rw-r--r--ucbhelper/source/provider/propertyvalueset.cxx925
-rw-r--r--ucbhelper/source/provider/providerhelper.cxx614
-rw-r--r--ucbhelper/source/provider/registerucb.cxx249
-rw-r--r--ucbhelper/source/provider/resultset.cxx1706
-rw-r--r--ucbhelper/source/provider/resultsethelper.cxx369
-rw-r--r--ucbhelper/source/provider/resultsetmetadata.cxx588
-rw-r--r--ucbhelper/util/makefile.mk127
-rw-r--r--ucbhelper/util/ucbhelper.flt13
-rw-r--r--ucbhelper/version.mk77
-rw-r--r--ucbhelper/workben/myucp/exports.map8
-rw-r--r--ucbhelper/workben/myucp/makefile.mk132
-rw-r--r--ucbhelper/workben/myucp/myucp_content.cxx805
-rw-r--r--ucbhelper/workben/myucp/myucp_content.hxx207
-rw-r--r--ucbhelper/workben/myucp/myucp_contentcaps.cxx253
-rw-r--r--ucbhelper/workben/myucp/myucp_datasupplier.cxx443
-rw-r--r--ucbhelper/workben/myucp/myucp_datasupplier.hxx111
-rw-r--r--ucbhelper/workben/myucp/myucp_provider.cxx211
-rw-r--r--ucbhelper/workben/myucp/myucp_provider.hxx131
-rw-r--r--ucbhelper/workben/myucp/myucp_resultset.cxx129
-rw-r--r--ucbhelper/workben/myucp/myucp_resultset.hxx99
-rw-r--r--ucbhelper/workben/myucp/myucp_services.cxx175
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/document.bmpbin0 -> 1318 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/fldclose.bmpbin0 -> 298 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/fldopen.bmpbin0 -> 322 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/link.bmpbin0 -> 1318 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/makefile.mk111
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.cxx1293
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.hrc99
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.src195
-rw-r--r--unotools/inc/unotools/charclass.hxx268
-rw-r--r--unotools/inc/unotools/configitem.hxx162
-rw-r--r--unotools/inc/unotools/configmgr.hxx113
-rw-r--r--unotools/inc/unotools/datetime.hxx117
-rw-r--r--unotools/inc/unotools/idhelper.hxx269
-rw-r--r--unotools/inc/unotools/processfactory.hxx93
-rw-r--r--unotools/inc/unotools/querydeep.hxx526
-rw-r--r--unotools/inc/unotools/regpathhelper.hxx107
-rw-r--r--unotools/inc/unotools/servicehelper.hxx139
-rw-r--r--unotools/inc/unotools/streamhelper.hxx163
-rw-r--r--unotools/inc/unotools/streamsection.hxx125
-rw-r--r--unotools/inc/unotools/streamwrap.hxx144
-rw-r--r--unotools/inc/unotools/unotunnelhelper.hxx240
-rw-r--r--unotools/prj/d.lst11
-rw-r--r--unotools/source/config/configitem.cxx623
-rw-r--r--unotools/source/config/configmgr.cxx268
-rw-r--r--unotools/source/config/makefile.mk103
-rw-r--r--unotools/source/i18n/charclass.cxx575
-rw-r--r--unotools/source/i18n/makefile.mk102
-rw-r--r--unotools/source/misc/datetime.cxx162
-rw-r--r--unotools/source/misc/makefile.mk112
-rw-r--r--unotools/source/processfactory/componentfactory.cxx224
-rw-r--r--unotools/source/processfactory/makefile.mk97
-rw-r--r--unotools/source/processfactory/processfactory.cxx110
-rw-r--r--unotools/source/property/makefile.mk103
-rw-r--r--unotools/source/streaming/makefile.mk106
-rw-r--r--unotools/source/streaming/streamhelper.cxx234
-rw-r--r--unotools/source/streaming/streamwrap.cxx231
-rw-r--r--unotools/util/makefile.mk149
-rw-r--r--vcl/aqua/inc/saldata.hxx362
-rw-r--r--vcl/aqua/inc/salframe.h118
-rw-r--r--vcl/aqua/inc/salgdi.h138
-rw-r--r--vcl/aqua/inc/salinst.h108
-rw-r--r--vcl/aqua/inc/salobj.h94
-rw-r--r--vcl/aqua/inc/salprn.h144
-rw-r--r--vcl/aqua/inc/salsys.h79
-rw-r--r--vcl/aqua/inc/salvd.h88
-rw-r--r--vcl/aqua/inc/svsys.h69
-rw-r--r--vcl/aqua/source/app/makefile.mk113
-rw-r--r--vcl/aqua/source/app/saldata.cxx262
-rw-r--r--vcl/aqua/source/app/salinst.cxx918
-rw-r--r--vcl/aqua/source/app/salsys.cxx202
-rw-r--r--vcl/aqua/source/app/saltimer.cxx156
-rw-r--r--vcl/aqua/source/gdi/makefile.mk113
-rw-r--r--vcl/aqua/source/gdi/salbmp.cxx686
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx1536
-rw-r--r--vcl/aqua/source/gdi/salogl.cxx351
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx1487
-rw-r--r--vcl/aqua/source/gdi/salvd.cxx234
-rw-r--r--vcl/aqua/source/window/makefile.mk104
-rw-r--r--vcl/aqua/source/window/salframe.cxx3991
-rw-r--r--vcl/aqua/source/window/salobj.cxx858
-rw-r--r--vcl/os2/inc/saldata.hxx278
-rw-r--r--vcl/os2/inc/salframe.h113
-rw-r--r--vcl/os2/inc/salgdi.h108
-rw-r--r--vcl/os2/inc/salids.hrc134
-rw-r--r--vcl/os2/inc/salinst.h109
-rw-r--r--vcl/os2/inc/sallang.hxx103
-rw-r--r--vcl/os2/inc/salobj.h91
-rw-r--r--vcl/os2/inc/salprn.h119
-rw-r--r--vcl/os2/inc/salsound.hxx125
-rw-r--r--vcl/os2/inc/salsys.h79
-rw-r--r--vcl/os2/inc/salvd.h91
-rw-r--r--vcl/os2/inc/svsys.h69
-rw-r--r--vcl/os2/source/app/makefile.mk96
-rw-r--r--vcl/os2/source/app/salinst.cxx754
-rw-r--r--vcl/os2/source/app/sallang.cxx406
-rw-r--r--vcl/os2/source/app/salshl.cxx84
-rw-r--r--vcl/os2/source/app/salsound.cxx421
-rw-r--r--vcl/os2/source/app/salsys.cxx287
-rw-r--r--vcl/os2/source/app/saltimer.cxx122
-rw-r--r--vcl/os2/source/gdi/makefile.mk94
-rw-r--r--vcl/os2/source/gdi/salbmp.cxx760
-rw-r--r--vcl/os2/source/gdi/salgdi.cxx852
-rw-r--r--vcl/os2/source/gdi/salgdi2.cxx786
-rw-r--r--vcl/os2/source/gdi/salgdi3.cxx780
-rw-r--r--vcl/os2/source/gdi/salogl.cxx263
-rw-r--r--vcl/os2/source/gdi/salprn.cxx1878
-rw-r--r--vcl/os2/source/gdi/salvd.cxx230
-rw-r--r--vcl/os2/source/src/makefile.mk147
-rw-r--r--vcl/os2/source/src/salsrc.rc134
-rw-r--r--vcl/os2/source/window/makefile40
-rw-r--r--vcl/os2/source/window/makefile.mk84
-rw-r--r--vcl/os2/source/window/salframe.cxx2762
-rw-r--r--vcl/os2/source/window/salobj.cxx605
-rw-r--r--vcl/prj/d.lst186
-rw-r--r--vcl/source/app/dbggui.cxx1884
-rw-r--r--vcl/source/app/help.cxx686
-rw-r--r--vcl/source/app/idlemgr.cxx191
-rw-r--r--vcl/source/app/makefile.mk123
-rw-r--r--vcl/source/app/settings.cxx1857
-rw-r--r--vcl/source/app/sound.cxx361
-rw-r--r--vcl/source/app/stdtext.cxx104
-rw-r--r--vcl/source/app/svapp.cxx1770
-rw-r--r--vcl/source/app/svdata.cxx237
-rw-r--r--vcl/source/app/svmain.cxx714
-rw-r--r--vcl/source/app/timer.cxx490
-rw-r--r--vcl/source/app/unohelp.cxx275
-rw-r--r--vcl/source/control/button.cxx3010
-rw-r--r--vcl/source/control/combobox.cxx1242
-rw-r--r--vcl/source/control/ctrl.cxx155
-rw-r--r--vcl/source/control/edit.cxx2200
-rw-r--r--vcl/source/control/field.cxx2330
-rw-r--r--vcl/source/control/field2.cxx3245
-rw-r--r--vcl/source/control/fixbrd.cxx255
-rw-r--r--vcl/source/control/fixed.cxx1051
-rw-r--r--vcl/source/control/group.cxx349
-rw-r--r--vcl/source/control/ilstbox.cxx2387
-rw-r--r--vcl/source/control/imgctrl.cxx95
-rw-r--r--vcl/source/control/longcurr.cxx873
-rw-r--r--vcl/source/control/lstbox.cxx1242
-rw-r--r--vcl/source/control/makefile.mk119
-rw-r--r--vcl/source/control/menubtn.cxx285
-rw-r--r--vcl/source/control/morebtn.cxx266
-rw-r--r--vcl/source/control/scrbar.cxx1245
-rw-r--r--vcl/source/control/slider.cxx1024
-rw-r--r--vcl/source/control/spinbtn.cxx313
-rw-r--r--vcl/source/control/spinfld.cxx791
-rw-r--r--vcl/source/control/tabctrl.cxx1772
-rw-r--r--vcl/source/gdi/alpha.cxx353
-rw-r--r--vcl/source/gdi/animate.cxx992
-rw-r--r--vcl/source/gdi/bitmap.cxx1980
-rw-r--r--vcl/source/gdi/bitmap2.cxx1269
-rw-r--r--vcl/source/gdi/bitmap3.cxx2248
-rw-r--r--vcl/source/gdi/bitmap4.cxx953
-rw-r--r--vcl/source/gdi/bitmapex.cxx690
-rw-r--r--vcl/source/gdi/bmpacc.cxx448
-rw-r--r--vcl/source/gdi/bmpacc2.cxx353
-rw-r--r--vcl/source/gdi/bmpacc3.cxx351
-rw-r--r--vcl/source/gdi/cvtgrf.cxx232
-rw-r--r--vcl/source/gdi/cvtsvm.cxx2106
-rw-r--r--vcl/source/gdi/font.cxx625
-rw-r--r--vcl/source/gdi/gdimtf.cxx1724
-rw-r--r--vcl/source/gdi/gfxlink.cxx450
-rw-r--r--vcl/source/gdi/gradient.cxx386
-rw-r--r--vcl/source/gdi/graph.cxx832
-rw-r--r--vcl/source/gdi/hatch.cxx262
-rw-r--r--vcl/source/gdi/image.cxx1521
-rw-r--r--vcl/source/gdi/imgcons.cxx593
-rw-r--r--vcl/source/gdi/impanmvw.cxx392
-rw-r--r--vcl/source/gdi/impanmvw.hxx130
-rw-r--r--vcl/source/gdi/impbmp.cxx309
-rw-r--r--vcl/source/gdi/impgraph.cxx1571
-rw-r--r--vcl/source/gdi/impimage.cxx744
-rw-r--r--vcl/source/gdi/implncvt.cxx605
-rw-r--r--vcl/source/gdi/implncvt.hxx113
-rw-r--r--vcl/source/gdi/impprn.cxx256
-rw-r--r--vcl/source/gdi/impvect.cxx1267
-rw-r--r--vcl/source/gdi/impvect.hxx101
-rw-r--r--vcl/source/gdi/jobset.cxx415
-rw-r--r--vcl/source/gdi/lineinfo.cxx300
-rw-r--r--vcl/source/gdi/makefile.mk156
-rw-r--r--vcl/source/gdi/mapmod.cxx356
-rw-r--r--vcl/source/gdi/metaact.cxx3434
-rw-r--r--vcl/source/gdi/metric.cxx142
-rw-r--r--vcl/source/gdi/octree.cxx419
-rw-r--r--vcl/source/gdi/opengl.cxx1714
-rw-r--r--vcl/source/gdi/outdev.cxx1927
-rw-r--r--vcl/source/gdi/outdev2.cxx1928
-rw-r--r--vcl/source/gdi/outdev3.cxx6326
-rw-r--r--vcl/source/gdi/outdev4.cxx1634
-rw-r--r--vcl/source/gdi/outdev5.cxx430
-rw-r--r--vcl/source/gdi/outdev6.cxx1043
-rw-r--r--vcl/source/gdi/outmap.cxx2106
-rw-r--r--vcl/source/gdi/polyscan.cxx389
-rw-r--r--vcl/source/gdi/print.cxx1979
-rw-r--r--vcl/source/gdi/print2.cxx543
-rw-r--r--vcl/source/gdi/regband.cxx785
-rw-r--r--vcl/source/gdi/region.cxx2458
-rw-r--r--vcl/source/gdi/salmisc.cxx497
-rw-r--r--vcl/source/gdi/svcompat.cxx117
-rw-r--r--vcl/source/gdi/virdev.cxx442
-rw-r--r--vcl/source/gdi/wall.cxx616
-rw-r--r--vcl/source/helper/evntpost.cxx96
-rw-r--r--vcl/source/helper/makefile.mk100
-rw-r--r--vcl/source/helper/threadex.cxx130
-rw-r--r--vcl/source/src/btntext.src290
-rw-r--r--vcl/source/src/helptext.src367
-rw-r--r--vcl/source/src/images.src167
-rw-r--r--vcl/source/src/makefile.mk106
-rw-r--r--vcl/source/src/menu.src284
-rw-r--r--vcl/source/src/stdtext.src91
-rw-r--r--vcl/source/window/accel.cxx775
-rw-r--r--vcl/source/window/accmgr.cxx318
-rw-r--r--vcl/source/window/brdwin.cxx3808
-rw-r--r--vcl/source/window/btndlg.cxx584
-rw-r--r--vcl/source/window/cursor.cxx449
-rw-r--r--vcl/source/window/decoview.cxx1297
-rw-r--r--vcl/source/window/dialog.cxx847
-rw-r--r--vcl/source/window/dlgctrl.cxx968
-rw-r--r--vcl/source/window/dockwin.cxx857
-rw-r--r--vcl/source/window/floatwin.cxx748
-rw-r--r--vcl/source/window/keycod.cxx276
-rw-r--r--vcl/source/window/makefile.mk139
-rw-r--r--vcl/source/window/menu.cxx3444
-rw-r--r--vcl/source/window/mnemonic.cxx260
-rw-r--r--vcl/source/window/msgbox.cxx548
-rw-r--r--vcl/source/window/scrwnd.cxx420
-rw-r--r--vcl/source/window/scrwnd.hxx124
-rw-r--r--vcl/source/window/seleng.cxx506
-rw-r--r--vcl/source/window/split.cxx365
-rw-r--r--vcl/source/window/splitwin.cxx3647
-rw-r--r--vcl/source/window/status.cxx1411
-rw-r--r--vcl/source/window/syschild.cxx221
-rw-r--r--vcl/source/window/syswin.cxx389
-rw-r--r--vcl/source/window/tabdlg.cxx315
-rw-r--r--vcl/source/window/tabpage.cxx182
-rw-r--r--vcl/source/window/toolbox.cxx4176
-rw-r--r--vcl/source/window/toolbox2.cxx1401
-rw-r--r--vcl/source/window/window.cxx6539
-rw-r--r--vcl/source/window/window2.cxx1384
-rw-r--r--vcl/source/window/winproc.cxx2151
-rw-r--r--vcl/source/window/wrkwin.cxx424
-rw-r--r--vcl/unx/inc/XIM.h171
-rw-r--r--vcl/unx/inc/cdeint.hxx166
-rw-r--r--vcl/unx/inc/dtint.hxx397
-rw-r--r--vcl/unx/inc/i18n_cb.hxx111
-rw-r--r--vcl/unx/inc/i18n_ic.hxx129
-rw-r--r--vcl/unx/inc/i18n_im.hxx99
-rw-r--r--vcl/unx/inc/i18n_xkb.hxx150
-rw-r--r--vcl/unx/inc/postx.h121
-rw-r--r--vcl/unx/inc/prex.h141
-rw-r--r--vcl/unx/inc/saldata.hxx180
-rw-r--r--vcl/unx/inc/saldisp.hxx589
-rw-r--r--vcl/unx/inc/salfont.h228
-rw-r--r--vcl/unx/inc/salframe.h247
-rw-r--r--vcl/unx/inc/salgdi.h320
-rw-r--r--vcl/unx/inc/salinst.h115
-rw-r--r--vcl/unx/inc/salobj.h135
-rw-r--r--vcl/unx/inc/salprn.h133
-rw-r--r--vcl/unx/inc/salstd.hxx127
-rw-r--r--vcl/unx/inc/salsys.h89
-rw-r--r--vcl/unx/inc/salunx.h190
-rw-r--r--vcl/unx/inc/salvd.h135
-rw-r--r--vcl/unx/inc/sm.hxx112
-rw-r--r--vcl/unx/inc/soicon.hxx74
-rw-r--r--vcl/unx/inc/strhelper.hxx77
-rw-r--r--vcl/unx/inc/svsys.h68
-rw-r--r--vcl/unx/inc/svunx.h83
-rw-r--r--vcl/unx/inc/xfont.hxx133
-rw-r--r--vcl/unx/inc/xsalprn.h223
-rw-r--r--vcl/unx/source/app/i18n_cb.cxx547
-rw-r--r--vcl/unx/source/app/i18n_ic.cxx686
-rw-r--r--vcl/unx/source/app/i18n_im.cxx332
-rw-r--r--vcl/unx/source/app/i18n_wrp.cxx293
-rw-r--r--vcl/unx/source/app/i18n_xkb.cxx195
-rw-r--r--vcl/unx/source/app/keysymnames.cxx545
-rw-r--r--vcl/unx/source/app/makefile.mk142
-rw-r--r--vcl/unx/source/app/saldata.cxx854
-rw-r--r--vcl/unx/source/app/saldisp.cxx3653
-rw-r--r--vcl/unx/source/app/salinst.cxx346
-rw-r--r--vcl/unx/source/app/salsys.cxx200
-rw-r--r--vcl/unx/source/app/saltimer.cxx129
-rw-r--r--vcl/unx/source/app/sm.cxx347
-rw-r--r--vcl/unx/source/app/soicon.cxx502
-rw-r--r--vcl/unx/source/gdi/cdeint.cxx572
-rw-r--r--vcl/unx/source/gdi/dtint.cxx1169
-rw-r--r--vcl/unx/source/gdi/makefile.mk124
-rw-r--r--vcl/unx/source/gdi/salbmp.cxx885
-rw-r--r--vcl/unx/source/gdi/salcvt.cxx434
-rw-r--r--vcl/unx/source/gdi/salcvt.hxx116
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx975
-rw-r--r--vcl/unx/source/gdi/salgdi2.cxx810
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx1074
-rw-r--r--vcl/unx/source/gdi/salogl.cxx393
-rw-r--r--vcl/unx/source/gdi/salvd.cxx239
-rw-r--r--vcl/unx/source/gdi/xfont.cxx559
-rw-r--r--vcl/unx/source/gdi/xlfd_attr.cxx655
-rw-r--r--vcl/unx/source/gdi/xlfd_attr.hxx266
-rw-r--r--vcl/unx/source/gdi/xlfd_extd.cxx699
-rw-r--r--vcl/unx/source/gdi/xlfd_extd.hxx251
-rw-r--r--vcl/unx/source/gdi/xlfd_smpl.cxx285
-rw-r--r--vcl/unx/source/gdi/xlfd_smpl.hxx132
-rw-r--r--vcl/unx/source/inc/airbrush_curs.h74
-rw-r--r--vcl/unx/source/inc/airbrush_mask.h74
-rw-r--r--vcl/unx/source/inc/ase_curs.h74
-rw-r--r--vcl/unx/source/inc/ase_mask.h74
-rw-r--r--vcl/unx/source/inc/asn_curs.h74
-rw-r--r--vcl/unx/source/inc/asn_mask.h74
-rw-r--r--vcl/unx/source/inc/asne_curs.h74
-rw-r--r--vcl/unx/source/inc/asne_mask.h74
-rw-r--r--vcl/unx/source/inc/asns_curs.h74
-rw-r--r--vcl/unx/source/inc/asns_mask.h74
-rw-r--r--vcl/unx/source/inc/asnswe_curs.h74
-rw-r--r--vcl/unx/source/inc/asnswe_mask.h74
-rw-r--r--vcl/unx/source/inc/asnw_curs.h74
-rw-r--r--vcl/unx/source/inc/asnw_mask.h74
-rw-r--r--vcl/unx/source/inc/ass_curs.h74
-rw-r--r--vcl/unx/source/inc/ass_mask.h74
-rw-r--r--vcl/unx/source/inc/asse_curs.h74
-rw-r--r--vcl/unx/source/inc/asse_mask.h74
-rw-r--r--vcl/unx/source/inc/assw_curs.h74
-rw-r--r--vcl/unx/source/inc/assw_mask.h74
-rw-r--r--vcl/unx/source/inc/asw_curs.h74
-rw-r--r--vcl/unx/source/inc/asw_mask.h74
-rw-r--r--vcl/unx/source/inc/aswe_curs.h74
-rw-r--r--vcl/unx/source/inc/aswe_mask.h74
-rw-r--r--vcl/unx/source/inc/chain_curs.h74
-rw-r--r--vcl/unx/source/inc/chain_mask.h72
-rw-r--r--vcl/unx/source/inc/chainnot_curs.h74
-rw-r--r--vcl/unx/source/inc/chainnot_mask.h72
-rw-r--r--vcl/unx/source/inc/chart_curs.h74
-rw-r--r--vcl/unx/source/inc/chart_mask.h74
-rw-r--r--vcl/unx/source/inc/copydata_curs.h76
-rw-r--r--vcl/unx/source/inc/copydata_mask.h76
-rw-r--r--vcl/unx/source/inc/copydlnk_curs.h76
-rw-r--r--vcl/unx/source/inc/copydlnk_mask.h76
-rw-r--r--vcl/unx/source/inc/copyfile_curs.h76
-rw-r--r--vcl/unx/source/inc/copyfile_mask.h76
-rw-r--r--vcl/unx/source/inc/copyfiles_curs.h76
-rw-r--r--vcl/unx/source/inc/copyfiles_mask.h76
-rw-r--r--vcl/unx/source/inc/copyflnk_curs.h76
-rw-r--r--vcl/unx/source/inc/copyflnk_mask.h76
-rw-r--r--vcl/unx/source/inc/crook_curs.h76
-rw-r--r--vcl/unx/source/inc/crook_mask.h74
-rw-r--r--vcl/unx/source/inc/crop_curs.h76
-rw-r--r--vcl/unx/source/inc/crop_mask.h74
-rw-r--r--vcl/unx/source/inc/detective_curs.h74
-rw-r--r--vcl/unx/source/inc/detective_mask.h74
-rw-r--r--vcl/unx/source/inc/drawarc_curs.h76
-rw-r--r--vcl/unx/source/inc/drawarc_mask.h74
-rw-r--r--vcl/unx/source/inc/drawbezier_curs.h76
-rw-r--r--vcl/unx/source/inc/drawbezier_mask.h74
-rw-r--r--vcl/unx/source/inc/drawcaption_curs.h76
-rw-r--r--vcl/unx/source/inc/drawcaption_mask.h74
-rw-r--r--vcl/unx/source/inc/drawcirclecut_curs.h76
-rw-r--r--vcl/unx/source/inc/drawcirclecut_mask.h74
-rw-r--r--vcl/unx/source/inc/drawconnect_curs.h76
-rw-r--r--vcl/unx/source/inc/drawconnect_mask.h74
-rw-r--r--vcl/unx/source/inc/drawcrook_curs.h76
-rw-r--r--vcl/unx/source/inc/drawcrook_mask.h74
-rw-r--r--vcl/unx/source/inc/drawcrop_curs.h76
-rw-r--r--vcl/unx/source/inc/drawcrop_mask.h74
-rw-r--r--vcl/unx/source/inc/drawellipse_curs.h76
-rw-r--r--vcl/unx/source/inc/drawellipse_mask.h74
-rw-r--r--vcl/unx/source/inc/drawfreehand_curs.h76
-rw-r--r--vcl/unx/source/inc/drawfreehand_mask.h74
-rw-r--r--vcl/unx/source/inc/drawline_curs.h76
-rw-r--r--vcl/unx/source/inc/drawline_mask.h74
-rw-r--r--vcl/unx/source/inc/drawmirror_curs.h76
-rw-r--r--vcl/unx/source/inc/drawmirror_mask.h74
-rw-r--r--vcl/unx/source/inc/drawpie_curs.h76
-rw-r--r--vcl/unx/source/inc/drawpie_mask.h74
-rw-r--r--vcl/unx/source/inc/drawpolygon_curs.h76
-rw-r--r--vcl/unx/source/inc/drawpolygon_mask.h74
-rw-r--r--vcl/unx/source/inc/drawrect_curs.h76
-rw-r--r--vcl/unx/source/inc/drawrect_mask.h74
-rw-r--r--vcl/unx/source/inc/drawtext_curs.h76
-rw-r--r--vcl/unx/source/inc/drawtext_mask.h74
-rw-r--r--vcl/unx/source/inc/fill_curs.h74
-rw-r--r--vcl/unx/source/inc/fill_mask.h74
-rw-r--r--vcl/unx/source/inc/hshear_curs.h76
-rw-r--r--vcl/unx/source/inc/hshear_mask.h74
-rw-r--r--vcl/unx/source/inc/invert50.h99
-rw-r--r--vcl/unx/source/inc/linkdata_curs.h76
-rw-r--r--vcl/unx/source/inc/linkdata_mask.h76
-rw-r--r--vcl/unx/source/inc/linkfile_curs.h76
-rw-r--r--vcl/unx/source/inc/linkfile_mask.h76
-rw-r--r--vcl/unx/source/inc/magnify_curs.h68
-rw-r--r--vcl/unx/source/inc/magnify_mask.h66
-rw-r--r--vcl/unx/source/inc/mirror_curs.h76
-rw-r--r--vcl/unx/source/inc/mirror_mask.h74
-rw-r--r--vcl/unx/source/inc/movebezierweight_curs.h76
-rw-r--r--vcl/unx/source/inc/movebezierweight_mask.h74
-rw-r--r--vcl/unx/source/inc/movedata_curs.h76
-rw-r--r--vcl/unx/source/inc/movedata_mask.h76
-rw-r--r--vcl/unx/source/inc/movedlnk_curs.h76
-rw-r--r--vcl/unx/source/inc/movedlnk_mask.h76
-rw-r--r--vcl/unx/source/inc/movefile_curs.h76
-rw-r--r--vcl/unx/source/inc/movefile_mask.h76
-rw-r--r--vcl/unx/source/inc/movefiles_curs.h76
-rw-r--r--vcl/unx/source/inc/movefiles_mask.h76
-rw-r--r--vcl/unx/source/inc/moveflnk_curs.h76
-rw-r--r--vcl/unx/source/inc/moveflnk_mask.h76
-rw-r--r--vcl/unx/source/inc/movepoint_curs.h76
-rw-r--r--vcl/unx/source/inc/movepoint_mask.h74
-rw-r--r--vcl/unx/source/inc/nodrop_curs.h76
-rw-r--r--vcl/unx/source/inc/nodrop_mask.h76
-rw-r--r--vcl/unx/source/inc/null_curs.h65
-rw-r--r--vcl/unx/source/inc/null_mask.h63
-rw-r--r--vcl/unx/source/inc/pivotcol_curs.h74
-rw-r--r--vcl/unx/source/inc/pivotcol_mask.h74
-rw-r--r--vcl/unx/source/inc/pivotfld_curs.h74
-rw-r--r--vcl/unx/source/inc/pivotfld_mask.h74
-rw-r--r--vcl/unx/source/inc/pivotrow_curs.h74
-rw-r--r--vcl/unx/source/inc/pivotrow_mask.h74
-rw-r--r--vcl/unx/source/inc/rotate_curs.h76
-rw-r--r--vcl/unx/source/inc/rotate_mask.h74
-rw-r--r--vcl/unx/source/inc/timemove_curs.h74
-rw-r--r--vcl/unx/source/inc/timemove_mask.h74
-rw-r--r--vcl/unx/source/inc/timesize_curs.h74
-rw-r--r--vcl/unx/source/inc/timesize_mask.h74
-rw-r--r--vcl/unx/source/inc/vshear_curs.h76
-rw-r--r--vcl/unx/source/inc/vshear_mask.h74
-rw-r--r--vcl/unx/source/window/FWS.cxx314
-rw-r--r--vcl/unx/source/window/FWS.hxx98
-rw-r--r--vcl/unx/source/window/makefile.mk97
-rw-r--r--vcl/unx/source/window/salframe.cxx2614
-rw-r--r--vcl/unx/source/window/salobj.cxx447
-rw-r--r--vcl/util/makefile.mk609
-rw-r--r--vcl/util/makefile.pmk68
-rw-r--r--vcl/util/target.pmk74
-rw-r--r--vcl/win/inc/saldata.hxx358
-rw-r--r--vcl/win/inc/salframe.h118
-rw-r--r--vcl/win/inc/salgdi.h136
-rw-r--r--vcl/win/inc/salids.hrc146
-rw-r--r--vcl/win/inc/salinst.h108
-rw-r--r--vcl/win/inc/salobj.h92
-rw-r--r--vcl/win/inc/salogl.hxx122
-rw-r--r--vcl/win/inc/salprn.h144
-rw-r--r--vcl/win/inc/salsys.h79
-rw-r--r--vcl/win/inc/salvd.h88
-rw-r--r--vcl/win/inc/svsys.h69
-rw-r--r--vcl/win/inc/wincomp.hxx453
-rw-r--r--vcl/win/source/app/MAKEFILE.MK40
-rw-r--r--vcl/win/source/app/saldata.cxx267
-rw-r--r--vcl/win/source/app/salinfo.cxx884
-rw-r--r--vcl/win/source/app/salinst.cxx897
-rw-r--r--vcl/win/source/app/salshl.cxx198
-rw-r--r--vcl/win/source/app/saltimer.cxx152
-rw-r--r--vcl/win/source/gdi/MAKEFILE.MK52
-rw-r--r--vcl/win/source/gdi/salbmp.cxx668
-rw-r--r--vcl/win/source/gdi/salgdi.cxx1449
-rw-r--r--vcl/win/source/gdi/salgdi2.cxx782
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx1531
-rw-r--r--vcl/win/source/gdi/salogl.cxx329
-rw-r--r--vcl/win/source/gdi/salprn.cxx1424
-rw-r--r--vcl/win/source/gdi/salvd.cxx226
-rw-r--r--vcl/win/source/gdi/wntgdi.cxx92
-rw-r--r--vcl/win/source/src/50.bmpbin0 -> 94 bytes
-rw-r--r--vcl/win/source/src/MAKEFILE.MK106
-rw-r--r--vcl/win/source/src/airbrush.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/ase.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/asn.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/asne.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/asns.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/asnswe.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/asnw.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/ass.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/asse.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/assw.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/asw.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/aswe.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/chain.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/chainnot.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/chart.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/copydata.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/copydlnk.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/copyf.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/copyf2.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/copyflnk.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/crook.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/crop.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/cross.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/darc.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dbezier.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dcapt.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dcirccut.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dconnect.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dellipse.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/detectiv.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dfree.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dline.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dpie.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dpolygon.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/drect.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/dtext.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/fill.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/hand.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/help.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/hshear.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/hsize.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/hsizebar.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/hsplit.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/linkdata.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/linkf.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/mirror.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/move.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/movebw.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/movedata.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/movedlnk.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/movef.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/movef2.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/moveflnk.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/movept.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/neswsize.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/notallow.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/nullptr.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/nwsesize.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/pen.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/refhand.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/rotate.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/salsrc.rc148
-rw-r--r--vcl/win/source/src/sd.icobin0 -> 3310 bytes
-rwxr-xr-xvcl/win/source/src/timemove.curbin0 -> 326 bytes
-rwxr-xr-xvcl/win/source/src/timesize.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/vshear.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/vsize.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/vsizebar.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/src/vsplit.curbin0 -> 326 bytes
-rw-r--r--vcl/win/source/window/MAKEFILE.MK38
-rw-r--r--vcl/win/source/window/salframe.cxx3901
-rw-r--r--vcl/win/source/window/salobj.cxx873
-rw-r--r--vcl/workben/makefile.mk151
-rw-r--r--vcl/workben/svdem.cxx157
1167 files changed, 527915 insertions, 0 deletions
diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h
new file mode 100644
index 000000000000..35528e750e9d
--- /dev/null
+++ b/rsc/inc/rscall.h
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscall.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscall.h,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCALL_H
+#define _RSCALL_H
+
+#ifndef _TOOLS_STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCDEF_HXX
+#include <rscdef.hxx>
+#endif
+
+/******************* T y p e s *******************************************/
+typedef char * CLASS_DATA; // Zeiger auf die Daten einer Klasse
+
+/******************* C l a s s e s F o r w a r d s *********************/
+class RscCompiler;
+class HashString;
+class RscTop;
+class RscTypCont;
+class RscIncList;
+
+/******************* G l o b a l V a r i a b l e s *********************/
+extern HashString* pHS;
+extern ByteString* pStdParType;
+extern ByteString* pStdPar1;
+extern ByteString* pStdPar2;
+extern ByteString* pWinParType;
+extern ByteString* pWinPar1;
+extern ByteString* pWinPar2;
+extern USHORT nRefDeep;
+extern USHORT nRsc_XYMAPMODEId;
+extern USHORT nRsc_WHMAPMODEId;
+extern USHORT nRsc_X;
+extern USHORT nRsc_Y;
+extern USHORT nRsc_WIDTH;
+extern USHORT nRsc_HEIGHT;
+extern USHORT nRsc_DELTALANG;
+extern USHORT nRsc_DELTASYSTEM;
+extern USHORT nRsc_EXTRADATA;
+
+/******************* D e f i n e s ***************************************/
+
+#define HELP_FLAG 0x0001 // Hilfe anzeigen
+#define NOPREPRO_FLAG 0x0002 // kein Preprozesor
+#define NOSYNTAX_FLAG 0x0004 // keine Syntaxanalyse
+#define NOLINK_FLAG 0x0008 // nicht linken
+#define NORESFILE_FLAG 0x0010 // keine .res-Datei erzeugen
+#define DEFINE_FLAG 0x0020 // es wurde Definitionen angegeben
+#define INCLUDE_FLAG 0x0040 // der Include-Pfad wurde erweitert
+#define MSCPREPRO_FLAG 0x0080 // spezial Preprozessor
+#define PRINTSYNTAX_FLAG 0x0100 // Syntax ausgeben
+#define PRELOAD_FLAG 0x0200 // Alle Ressourcen Preloaden
+#define SMART_FLAG 0x0400 // abgekuertze Name
+#define SRSDEFAULT_FLAG 0x1000 // immer der Default geschrieben
+#define NOSYSRESTEST_FLAG 0x2000 // ueberprueft nicht die Richtigkeit von (bmp, ico, cur)
+
+
+/******************* T y p e s *******************************************/
+enum RSCCLASS_TYPE { RSCCLASS_BOOL, RSCCLASS_STRING, RSCCLASS_NUMBER,
+ RSCCLASS_CONST, RSCCLASS_COMPLEX, RSCCLASS_ENUMARRAY };
+
+typedef void (* VarEnumCallbackProc)( void * pData, RSCCLASS_TYPE, HASHID );
+
+/******************* S t r u c t s ***************************************/
+struct RSCINST {
+ RscTop * pClass;
+ CLASS_DATA pData;
+
+ RSCINST(){ pClass = NULL; pData = NULL; }
+ RSCINST( RscTop * pCl, CLASS_DATA pClassData ){
+ pClass = pCl;
+ pData = pClassData;
+ }
+ BOOL IsInst() const { return( pData != NULL ); }
+};
+
+/********************** S U B I N F O S T R U C T ************************/
+struct SUBINFO_STRUCT {
+ SUBINFO_STRUCT(){ nPos = 0; pClass = NULL; };
+ RscId aId; // Identifier der Resource
+ USHORT nPos; // Position der Resource
+ RscTop * pClass; // Klasse des Eintrages
+};
+
+/******************* F u n c t i o n *************************************/
+// Legt Hashtabelle an, legt Strings zur Initialisierung an
+void InitRscCompiler();
+
+#endif // _RSCALL_H
diff --git a/rsc/inc/rscarray.hxx b/rsc/inc/rscarray.hxx
new file mode 100644
index 000000000000..420afdf54074
--- /dev/null
+++ b/rsc/inc/rscarray.hxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscarray.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscarray.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCARRAY_HXX
+#define _RSCARRAY_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+
+class RscEnum;
+
+/******************* R s c A r r a y ************************************/
+class RscInstNode : public IdNode
+{
+ USHORT nTypeId;
+public:
+ RSCINST aInst;
+ RscInstNode( USHORT nId );
+ ~RscInstNode();
+ virtual USHORT GetId() const;
+ RscInstNode * Left() const { return (RscInstNode *)pLeft ; };
+ RscInstNode * Right() const{ return (RscInstNode *)pRight ; };
+ RscInstNode * Search( USHORT nId ) const
+ {
+ return (RscInstNode *)IdNode::Search( nId );
+ }
+};
+
+struct RscArrayInst
+{
+ RscInstNode * pNode;
+};
+
+/* Der Baum wird ueber die Werte des Enums sortiert, nicht ueber
+ seine HashId.
+*/
+class RscArray : public RscTop
+{
+protected:
+ RscEnum * pTypeClass; // Typ der Eintraege
+ USHORT nSize; // Groesse der Instanzdaten dieser Klasse
+ // mit Superklassen
+ USHORT nOffInstData;// Offset auf eigen Instanzdaten
+ USHORT * pWriteTypeValue;// Was soll geschrieben werden
+ USHORT * pWriteDfltTypeValue; // fallback fuer WriteTypeValue
+ void WriteSrcArray( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+public:
+ RscArray( HASHID nId, USHORT nTypId,
+ RscTop * pSuper, RscEnum * pTypeClass,
+ USHORT * pTypeValue, USHORT * pFallBackType );
+ ~RscArray();
+ virtual RSCCLASS_TYPE GetClassType() const;
+
+ void SetTypeClass( RscEnum * pClass )
+ {
+ pTypeClass = pClass;
+ }
+ virtual RscTop * GetTypeClass() const;
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
+ void Destroy( const RSCINST & rInst );
+ virtual ERRTYPE GetValueEle( const RSCINST & rInst, long lValue,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst );
+ virtual ERRTYPE GetArrayEle( const RSCINST & rInst, HASHID nId,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst );
+
+ // Gibt die Groesse der Klasse in Bytes
+ USHORT Size(){ return( nSize ); };
+
+ BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList );
+ virtual void SetToDefault( const RSCINST & rInst );
+ BOOL IsDefault( const RSCINST & rInst );
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+
+ virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & aId, const char * );
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+};
+
+class RscClassArray : public RscArray
+{
+public:
+ RscClassArray( HASHID nId, USHORT nTypId,
+ RscTop * pSuper, RscEnum * pTypeClass,
+ USHORT * pTypeValue, USHORT * pFallBackType );
+ ~RscClassArray();
+ virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & aId, const char * );
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, const RscId & aId,
+ USHORT nDeep, BOOL bExtra );
+};
+
+
+class RscLangArray : public RscArray
+{
+public:
+ RscLangArray( HASHID nId, USHORT nTypId,
+ RscTop * pSuper, RscEnum * pTypeClass,
+ USHORT * pTypeValue, USHORT * pFallBackType );
+ virtual RSCCLASS_TYPE GetClassType() const;
+};
+
+#endif //_RSCARRAY
diff --git a/rsc/inc/rscclass.hxx b/rsc/inc/rscclass.hxx
new file mode 100644
index 000000000000..df5d5cb5c557
--- /dev/null
+++ b/rsc/inc/rscclass.hxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscclass.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscclass.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCCLASS_HXX
+#define _RSCCLASS_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+
+/******************* R s c C l a s s *************************************/
+class RscClass : public RscTop
+{
+protected:
+ struct RscClassInst{
+ ULONG nVarDflt;
+ };
+ struct VARTYPE_STRUCT {
+ HASHID nVarName; // Variablenname
+ RSCVAR nVarType; // Variablentyp
+ USHORT nMask; // Maskierungsbit
+ USHORT nOffset; // Beginn der Instanzdaten
+ RscTop * pClass; // Klasse
+ CLASS_DATA pDefault; // Zeiger auf DefaultDaten
+ HASHID nDataBaseName;//Name fuer Fremddatenbereich
+ };
+ USHORT nSuperSize; // Groesse der Instanzdaten der SuperKl.
+ USHORT nSize; // Groesse der Instanzdaten dieser Klasse
+ // mit Superklassen
+ USHORT nEntries; // Eintraege in pVarTypeList
+ VARTYPE_STRUCT * pVarTypeList; // Variablenliste
+ RSCINST GetInstData( CLASS_DATA pData, USHORT nEle,
+ BOOL bGetCopy = FALSE );
+ CLASS_DATA GetDfltData( USHORT nEle );
+ BOOL IsDflt( CLASS_DATA pData, USHORT nEle );
+ BOOL IsValueDflt( CLASS_DATA pData, USHORT nEle );
+ void SetVarDflt( CLASS_DATA pData, USHORT nEle,
+ BOOL bSet );
+ long GetCorrectValues( const RSCINST & rInst, USHORT nVarPos,
+ USHORT nTupelIdx, RscTypCont * pTC );
+public:
+ RscClass( HASHID nId, USHORT nTypId, RscTop * pSuperCl );
+ ~RscClass();
+
+ virtual RSCCLASS_TYPE GetClassType() const;
+
+ void Pre_dtor();
+ ERRTYPE SetVariable( HASHID nVarName, RscTop * pClass,
+ RSCINST * pDflt,
+ RSCVAR nVarType, USHORT nMask,
+ HASHID nDataBaseName );
+ virtual void EnumVariables( void * pData, VarEnumCallbackProc );
+ RSCINST GetVariable( const RSCINST & rInst, HASHID nVarName,
+ const RSCINST & rInitInst,
+ BOOL nInitDflt = FALSE,
+ RscTop * pCreateClass = NULL );
+ RSCINST GetCopyVar( const RSCINST & rInst, HASHID nVarName );
+
+ // Gibt die Groesse der Klasse in Bytes
+ USHORT Size(){ return( nSize ); };
+
+ BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList );
+ void SetToDefault( const RSCINST & rInst );
+ BOOL IsDefault( const RSCINST & rInst );
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+ void SetDefault( const RSCINST & rData, HASHID nVarId );
+ RSCINST GetDefault( HASHID nVarId );
+
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
+ void Destroy( const RSCINST & rInst );
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteInstRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ void WriteSyntax( FILE * fOutput, RscTypCont * pTC );
+
+ void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+ void WriteRcCtor( FILE * fOutput, RscTypCont * pTC );
+};
+
+class RscSysDepend : public RscClass
+{
+public:
+ RscSysDepend( HASHID nId, USHORT nTypId, RscTop * pSuper );
+ ERRTYPE WriteSysDependRc( const RSCINST &, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra,
+ BOOL bFirst = FALSE );
+ ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+};
+
+class RscFirstSysDepend : public RscSysDepend
+{
+public:
+ RscFirstSysDepend( HASHID nId, USHORT nTypId,
+ RscTop * pSuper );
+ ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+};
+
+class RscTupel : public RscClass
+{
+public:
+ RscTupel( HASHID nId, USHORT nTypId, RscTop * pSuper );
+ RSCINST GetTupelVar( const RSCINST & rInst, USHORT nPos,
+ const RSCINST & rInitInst );
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+};
+
+#endif //_RSCCLASS_HXX
diff --git a/rsc/inc/rscclobj.hxx b/rsc/inc/rscclobj.hxx
new file mode 100644
index 000000000000..334bb9c145f1
--- /dev/null
+++ b/rsc/inc/rscclobj.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscclobj.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscclobj.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.6 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.5 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.4 1997/08/27 18:18:12 MM
+ neue Headerstruktur
+
+
+ Rev 1.3 27 Aug 1997 18:18:12 MM
+ neue Headerstruktur
+
+ Rev 1.2 21 Nov 1995 19:49:10 TLX
+ Neuer Link
+
+ Rev 1.1 12 Jan 1994 15:18:10 mm
+ Alignementprobleme und Warnings fuer DEC-Alpha beseitigt
+
+ Rev 1.0 10 Aug 1992 07:14:38 MM
+ Initial revision.
+
+ Rev 1.2 23 Mar 1992 15:23:42 MM
+
+ Rev 1.1 10 Dec 1991 11:49:10 MM
+ ObjNode::DelObjNode
+
+ Rev 1.0 26 Nov 1991 08:57:04 MM
+ Initial revision.
+
+**************************************************************************/
+
+#ifndef _RSCCLOBJ_HXX
+#define _RSCCLOBJ_HXX
+
+#ifndef _RSCTREE_HXX
+#include <rsctree.hxx>
+#endif
+#ifndef _RSCDEF_HXX
+#include <rscdef.hxx>
+#endif
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+
+/****************** C L A S S E S ****************************************/
+class RscTypCont;
+
+/*********** R s c I n c o n s i s t e n t *******************************/
+class RscInconsistent {
+public:
+ RscId aFirstId; //Paar von inkonsistenten Id's
+ RscId aSecondId;
+ RscInconsistent( const RscId & rFirst, const RscId & rSecond ){
+ aFirstId = rFirst;
+ aSecondId = rSecond;
+ };
+};
+
+DECLARE_LIST( RscInconsList, RscInconsistent * )
+
+/******************* O b j N o d e ***************************************/
+class ObjNode : public IdNode{
+ RscId aRscId; // Id der Resource
+ CLASS_DATA pRscObj;// pointer to a resourceobject
+ ULONG lFileKey;// Dateischluessel
+public:
+ ObjNode( const RscId & rId, CLASS_DATA pData, ULONG lKey );
+ ObjNode * DelObjNode( RscTop * pClass, ULONG lFileKey );
+ USHORT GetId() const;
+ RscId GetRscId(){ return( aRscId ); }
+ ULONG GetFileKey(){ return lFileKey; };
+ ObjNode* Search( const RscId &rName ) const{
+ // search the index in the b-tree
+ return( (ObjNode *)IdNode::Search( rName ) );
+ }
+ BOOL Insert( ObjNode* pTN ){
+ // insert a new node in the b-tree
+ return( IdNode::Insert( (IdNode *)pTN ) );
+ }
+ CLASS_DATA GetRscObj(){
+ // get the Object from this Node
+ return( pRscObj );
+ }
+ BOOL IsConsistent( RscInconsList * pList = NULL );
+};
+
+/******************* R e f N o d e ***************************************/
+class RefNode : public IdNode{
+ HASHID nTypNameId; // index of a Name in a hashtabel
+public:
+ ObjNode* pObjBiTree; // Zeiger auf Objektbaum
+ RefNode( HASHID nTyp );
+ USHORT GetId() const;
+ RefNode* Search( HASHID typ ) const{
+ // search the index in the b-tree
+ return( (RefNode *)IdNode::Search( typ ) );
+ };
+ BOOL Insert( RefNode* pTN ){
+ // insert a new node in the b-tree
+ return( IdNode::Insert( (IdNode *)pTN ) );
+ };
+ BOOL PutObjNode( ObjNode * pPutObject );
+
+ // insert new node in b-tree pObjBiTree
+ ObjNode * GetObjNode( const RscId &rRscId );
+
+ ObjNode * GetObjNode(){
+ // hole pObjBiTree
+ return( pObjBiTree );
+ };
+};
+
+#endif // _RSCCLOBJ_HXX
diff --git a/rsc/inc/rscconst.hxx b/rsc/inc/rscconst.hxx
new file mode 100644
index 000000000000..580aac51a689
--- /dev/null
+++ b/rsc/inc/rscconst.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscconst.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscconst.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCCONST_HXX
+#define _RSCCONST_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+
+/******************* R s c C o n s t *************************************/
+class RscConst : public RscTop
+{
+protected:
+ struct VarEle {
+ HASHID nId; // Name der Konstante
+ INT32 lValue; // Wert der Konstante
+ };
+ VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten
+ USHORT nEntries; // Anzahle der Eintraege im Feld
+public:
+ RscConst( HASHID nId, USHORT nTypId );
+ ~RscConst();
+ virtual RSCCLASS_TYPE GetClassType() const;
+ USHORT GetEntryCount() const { return nEntries; }
+ // Die erlaubten Werte werden gesetzt
+ ERRTYPE SetConstant( HASHID nVarName, INT32 lValue );
+ HASHID GetConstant( USHORT nPos );
+ BOOL GetConstValue( HASHID nConstId, INT32 * pVal ) const;
+ BOOL GetValueConst( INT32 nValue, HASHID * pConstId ) const;
+ USHORT GetConstPos( HASHID nConstId );
+ virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC );
+ virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+};
+
+/******************* R s c E n u m ***************************************/
+class RscEnum : public RscConst {
+ struct RscEnumInst {
+ USHORT nValue; // Position der Konstanten im Array
+ BOOL bDflt; // Ist Default
+ };
+ USHORT nSize;
+ BOOL bUSHORT;
+public:
+ RscEnum( HASHID nId, USHORT nTypId, BOOL bUSHORT = TRUE );
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL );
+ USHORT Size(){ return nSize; }
+
+ virtual void SetToDefault( const RSCINST & rInst )
+ {
+ ((RscEnumInst*)rInst.pData)->bDflt = TRUE;
+ }
+ BOOL IsDefault( const RSCINST & rInst )
+ {
+ return( ((RscEnumInst*)rInst.pData)->bDflt );
+ };
+ // Als Default setzen
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+
+ ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId,
+ long nValue );
+ ERRTYPE SetNumber( const RSCINST & rInst, long nValue );
+ ERRTYPE GetConst( const RSCINST & rInst, HASHID * );
+ ERRTYPE GetNumber( const RSCINST & rInst, long * nValue );
+ void WriteSrc( const RSCINST &rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+};
+
+#endif // _RSCCONST_HXX
diff --git a/rsc/inc/rsccont.hxx b/rsc/inc/rsccont.hxx
new file mode 100644
index 000000000000..ad2877abdad4
--- /dev/null
+++ b/rsc/inc/rsccont.hxx
@@ -0,0 +1,244 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsccont.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsccont.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.11 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.10 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.9 1997/08/27 18:18:04 MM
+ neue Headerstruktur
+
+
+ Rev 1.8 27 Aug 1997 18:18:04 MM
+ neue Headerstruktur
+
+ Rev 1.7 12 Sep 1996 12:45:38 MM
+ Eigene Ressourcen definieren
+
+ Rev 1.6 21 Nov 1995 19:49:16 TLX
+ Neuer Link
+
+ Rev 1.5 25 Aug 1993 15:33:58 mm
+ Fehler und Warnings beseitigt
+
+ Rev 1.4 04 Feb 1993 17:38:58 mm
+ GetClassType Fehler verbessert und keine Inline -ctor.
+
+ Rev 1.3 03 Feb 1993 15:03:12 mm
+ GetClassType() implementiert
+
+ Rev 1.2 05 Jan 1993 10:50:30 mm
+ Neues Default verhalten
+
+ Rev 1.1 23 Dec 1992 14:02:24 mm
+ Sprachaenderung
+
+ Rev 1.0 10 Aug 1992 07:14:38 MM
+ Initial revision.
+
+ Rev 1.13 29 Jul 1992 15:45:18 MM
+ Aenderungen wg. MSC7.0
+
+**************************************************************************/
+
+#ifndef _RSCCONT_HXX
+#define _RSCCONT_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+
+/******************* R s c B a s e C o n t *******************************/
+struct ENTRY_STRUCT {
+ RscId aName;
+ RSCINST aInst;
+ void Create(){ aName.Create(); aInst = RSCINST(); }
+ void Destroy();
+};
+struct RscBaseContInst {
+ USHORT nEntries;
+ ENTRY_STRUCT * pEntries;
+ BOOL bDflt;
+};
+
+class RscBaseCont : public RscTop
+{
+protected:
+ RscTop * pTypeClass; // Typ der Eintraege
+ RscTop * pTypeClass1;// Zwei verschiedene Typen moeglich
+ BOOL bNoId; // Keine Identifier
+ USHORT nSize; // Groesse der Instanzdaten dieser Klasse
+ // mit Superklassen
+ USHORT nOffInstData;// Offset auf eigen Instanzdaten
+ void DestroyElements( RscBaseContInst * pClassData );
+ RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pClass, USHORT nPos );
+protected:
+ void ContWriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ void ContWriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char *, BOOL nWriteSize );
+public:
+ RscBaseCont( HASHID nId, USHORT nTypId,
+ RscTop * pSuper = NULL,
+ BOOL bNoId = TRUE );
+ ~RscBaseCont();
+ virtual RSCCLASS_TYPE GetClassType() const;
+ void SetTypeClass( RscTop * pClass, RscTop * pClass1 = NULL )
+ {
+ pTypeClass = pClass;
+ pTypeClass1 = pClass1;
+ };
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
+ void Destroy( const RSCINST & rInst );
+ ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pCreateClass, const RSCINST & rCreateInst,
+ RSCINST * pGetInst );
+ RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pClass );
+ USHORT GetCount( const RSCINST & rInst );
+ RSCINST GetPosEle( const RSCINST & rInst, USHORT nPos );
+ ERRTYPE MovePosEle( const RSCINST & rInst, USHORT nDestPos,
+ USHORT nSourcePos );
+ virtual ERRTYPE SetPosRscId( const RSCINST & rInst, USHORT nPos,
+ const RscId & rRscId);
+ SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, USHORT nPos );
+ ERRTYPE SetString( const RSCINST &, char * pStr );
+ ERRTYPE SetNumber( const RSCINST &, long lValue );
+ ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue );
+ ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId,
+ long nValue );
+ ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId );
+
+ // Gibt die Groesse der Klasse in Bytes
+ USHORT Size(){ return( nSize ); };
+
+ BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList );
+ void SetToDefault( const RSCINST & rInst );
+ BOOL IsDefault( const RSCINST & rInst );
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+
+ void Delete( const RSCINST & rInst, RscTop * pClass,
+ const RscId & rId );
+ void DeletePos( const RSCINST & rInst, USHORT nPos );
+
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT , BOOL bExtra);
+ ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId );
+ ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId &rId );
+};
+
+/******************* R s c C o n t W r i t e S r c ***********************/
+class RscContWriteSrc : public RscBaseCont
+{
+public:
+ RscContWriteSrc( HASHID nId, USHORT nTypId,
+ RscTop * pSuper = NULL,
+ BOOL bNoId = TRUE );
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+};
+
+/******************* R s c C o n t ***************************************/
+class RscCont : public RscContWriteSrc {
+public:
+ RscCont( HASHID nId, USHORT nTypId,
+ RscTop * pSuper = NULL,
+ BOOL bNoId = TRUE );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+};
+
+/******************* R s c C o n t E x t r a D a t a *********************/
+class RscContExtraData : public RscContWriteSrc {
+public:
+ RscContExtraData( HASHID nId, USHORT nTypId,
+ RscTop * pSuper = NULL,
+ BOOL bNoId = TRUE );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+};
+
+#endif //_RSCCONT_HXX
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx
new file mode 100644
index 000000000000..7f92d7e78e46
--- /dev/null
+++ b/rsc/inc/rscdb.hxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscdb.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RSCDB_HXX
+#define _RSCDB_HXX
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+
+#ifndef _LANG_HXX //autogen
+#include <tools/lang.hxx>
+#endif
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCKEY_HXX
+#include <rsckey.hxx>
+#endif
+#ifndef _RSCCONST_HXX
+#include <rscconst.hxx>
+#endif
+#ifndef _RSCFLAG_HXX
+#include <rscflag.hxx>
+#endif
+#ifndef _RSCRANGE_HXX
+#include <rscrange.hxx>
+#endif
+#ifndef _RSCSTR_HXX
+#include <rscstr.hxx>
+#endif
+#ifndef _RSCARRAY_HXX
+#include <rscarray.hxx>
+#endif
+#ifndef _RSCDEF_HXX
+#include <rscdef.hxx>
+#endif
+
+class RscError;
+class REResourceList;
+class RscTupel;
+class RscCont;
+
+/****************** R s c T y p C o n ************************************/
+// Liste die alle Basistypen enthaelt
+DECLARE_LIST( RscBaseList, RscTop * )
+
+// Tabelle fuer Systemabhaengige Resourcen
+struct RscSysEntry
+{
+ USHORT nKey;
+ USHORT nRscTyp;
+ ByteString aFileName;
+ USHORT nTyp;
+ USHORT nRefId;
+};
+DECLARE_LIST( RscSysList, RscSysEntry * )
+
+class RscTypCont
+{
+ CharSet nSourceCharSet;
+ USHORT nLangTypeId; // Globale Sprachtyp
+ USHORT nDfltLangTypeId; // fallback fuer globalen Sprachtyp
+ USHORT nMachineId; // Globaler Maschinentyp
+ RSCBYTEORDER_TYPE nByteOrder; // Intel oder
+ ByteString aSearchPath; // Suchen der Bitmap, Icon, Pointer
+ USHORT nUniqueId; // eindeutiger Id fuer Systemresourcen
+ ULONG nFilePos; // Position in der Datei ( MTF )
+ USHORT nPMId; // eindeutiger Id fuer PM-Rseourcefile
+ // muss groesser als RSC_VERSIONCONTROL_ID sein
+ RscTop * pRoot; // Zeiger auf die Wurzel vom Typenbaum
+ RSCINST aVersion; // Versionskontrollinstanz
+
+ RscBaseList aBaseLst; // Liste der einfachen Resourceklasse
+ RscSysList aSysLst; // Liste der Systemresourcen
+
+ HASHID nWinBitVarId; // Name der Winbitvariablen
+ HASHID nBorderId;
+ HASHID nHideId;
+ HASHID nClipChildrenId;
+ HASHID nSizeableId;
+ HASHID nMoveableId;
+ HASHID nMinimizeId;
+ HASHID nMaximizeId;
+ HASHID nCloseableId;
+ HASHID nAppId;
+ HASHID nTabstopId;
+ HASHID nGroupId;
+ HASHID nSysmodalId;
+ HASHID nLeftId;
+ HASHID nCenterId;
+ HASHID nRightId;
+ HASHID nHscrollId;
+ HASHID nVscrollId;
+ HASHID nSortId;
+ HASHID nDefaultId;
+ HASHID nSVLookId;
+ HASHID nRepeatId;
+ HASHID nDropDownId;
+ HASHID nPassWordId;
+ HASHID nReadOnlyId;
+ HASHID nAutoSizeId;
+ HASHID nSpinId;
+ HASHID nTabControlId;
+ HASHID nSimpleModeId;
+ HASHID nDragId;
+ HASHID nSaveAsId;
+ HASHID nOpenId;
+ HASHID nScrollId;
+ HASHID nZoomableId;
+ HASHID nHideWhenDeactivateId;
+ HASHID nAutoHScrollId;
+ HASHID nDDExtraWidthId;
+ HASHID nWordBreakId;
+ HASHID nLeftLabelId;
+ HASHID nHasLinesId;
+ HASHID nHasButtonsId;
+ HASHID nRectStyleId;
+ HASHID nLineSpacingId;
+ HASHID nSmallStyleId;
+ HASHID nEnableResizingId;
+ HASHID nDockableId;
+ HASHID nScaleId;
+ HASHID nIgnoreTabId;
+ HASHID nNoSplitDrawId;
+ HASHID nTopImageId;
+ HASHID nNoLabelId;
+
+ void Init(); // Initialisiert Klassen und Tabelle
+ void SETCONST( RscConst *, char *, UINT32 );
+ void SETCONST( RscConst *, HASHID, UINT32 );
+ RscEnum * InitLangType();
+ RscEnum * InitDateFormatType();
+ RscEnum * InitTimeFormatType();
+ RscEnum * InitWeekDayFormatType();
+ RscEnum * InitMonthFormatType();
+ RscEnum * InitFieldUnitsType();
+ RscEnum * InitDayOfWeekType();
+ RscEnum * InitTimeFieldFormat();
+ RscEnum * InitColor();
+ RscEnum * InitMapUnit();
+ RscEnum * InitKey();
+ RscEnum * InitTriState();
+ RscEnum * InitMessButtons();
+ RscEnum * InitMessDefButton();
+ RscTupel * InitGeometry();
+ RscArray * InitLangGeometry( RscTupel * pGeo );
+ RscArray * InitSystemGeometry( RscTupel * pGeo );
+ RscCont * InitStringList();
+ RscArray * InitLangStringList( RscCont * pStrLst );
+ RscTupel * InitStringTupel();
+ RscTupel * InitStringLongTupel();
+ RscCont * InitStringTupelList( RscTupel * pStringTupel );
+ RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel );
+ RscArray * InitLangStringTupelList( RscCont * pStrTupelLst );
+ RscArray * InitLangStringLongTupelList( RscCont * pStrLongTupelLst );
+
+ RscTop * InitClassMgr();
+ RscTop * InitClassString( RscTop * pSuper );
+ RscTop * InitClassBitmap( RscTop * pSuper );
+ RscTop * InitClassColor( RscTop * pSuper, RscEnum * pColor );
+ RscTop * InitClassImage( RscTop * pSuper, RscTop *pClassBitmap,
+ RscTop * pClassColor );
+ RscTop * InitClassImageList( RscTop * pSuper, RscTop *pClassBitmap,
+ RscTop * pClassColor );
+ RscTop * InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
+ RscArray * pLangGeo );
+ RscTop * InitClassSystemWindow( RscTop * pSuper );
+ RscTop * InitClassWorkWindow( RscTop * pSuper );
+ RscTop * InitClassModalDialog( RscTop * pSuper );
+ RscTop * InitClassModelessDialog( RscTop * pSuper );
+ RscTop * InitClassControl( RscTop * pSuper );
+ RscTop * InitClassPushButton( RscTop * pSuper );
+ RscTop * InitClassTriStateBox( RscTop * pSuper, RscEnum * pTriState );
+ RscTop * InitClassMenuButton( RscTop * pSuper, RscTop * pClasMenu );
+ RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage,
+ RscEnum * pTriState );
+ RscTop * InitClassEdit( RscTop * pSuper );
+ RscTop * InitClassMultiLineEdit( RscTop * pSuper );
+ RscTop * InitClassScrollBar( RscTop * pSuper );
+ RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst );
+ RscTop * InitClassMultiListBox( RscTop * pSuper );
+ RscTop * InitClassComboBox( RscTop * pSuper, RscArray * pStrLst );
+ RscTop * InitClassFixedText( RscTop * pSuper );
+ RscTop * InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap );
+ RscTop * InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage );
+ RscTop * InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage );
+ RscTop * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey );
+ RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode );
+ RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem );
+ RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap,
+ RscTop * pClassKeyCode );
+ RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem );
+ RscTop * InitClassMessBox( RscTop * pSuper,
+ RscEnum * pMessButtons,
+ RscEnum * pMessDefButton );
+ RscTop * InitClassSplitter( RscTop * pSuper );
+ RscTop * InitClassSplitWindow( RscTop * pSuper );
+ RscTop * InitClassTime( RscTop * pSuper );
+ RscTop * InitClassDate( RscTop * pSuper, RscEnum * pDayOfWeek );
+ RscTop * InitClassInt1( RscTop * pSuper,
+ RscEnum * pDateFormat,
+ RscEnum * pTimeFormat, RscEnum * pWeekDayFormat,
+ RscEnum * pMonthFormat );
+ RscTop * InitClassInternational( RscTop * pSuper,
+ RscEnum * pDateFormat,
+ RscEnum * pTimeFormat, RscEnum * pWeekDayFormat,
+ RscEnum * pMonthFormat );
+
+ RscTop * InitClassPatternFormatter( RscTop * pSuper );
+ RscTop * InitClassNumericFormatter( RscTop * pSuper,
+ RscTop * pClassI12 );
+ RscTop * InitClassMetricFormatter( RscTop * pSuper,
+ RscEnum * pFieldUnits );
+ RscTop * InitClassCurrencyFormatter( RscTop * pSuper,
+ RscEnum * pFieldUnits );
+ RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate,
+ RscTop * pClassI12 );
+ RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime,
+ RscTop * pClassI12,
+ RscEnum * pTimeFieldFormat );
+
+ RscTop * InitClassSpinField( RscTop * pSuper );
+ RscTop * InitClassPatternField( RscTop * pSuper );
+ RscTop * InitClassNumericField( RscTop * pSuper );
+ RscTop * InitClassMetricField( RscTop * pSuper );
+ RscTop * InitClassCurrencyField( const char * pClassName, USHORT nRT,
+ RscTop * pSuper );
+ RscTop * InitClassDateField( RscTop * pSuper, RscTop * pClassDate );
+ RscTop * InitClassTimeField( RscTop * pSuper, RscTop * pClassTime );
+ RscTop * InitClassPatternBox( RscTop * pSuper );
+ RscTop * InitClassNumericBox( RscTop * pSuper );
+ RscTop * InitClassMetricBox( RscTop * pSuper );
+ RscTop * InitClassCurrencyBox( const char * pClassName, USHORT nRT,
+ RscTop * pSuper );
+ RscTop * InitClassDateBox( RscTop * pSuper, RscTop * pClassDate );
+ RscTop * InitClassTimeBox( RscTop * pSuper, RscTop * pClassTime );
+
+ RscTop * InitClassDockingWindow( RscTop * pSuper,
+ RscEnum * pMapUnit );
+ RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
+ RscTop * pClassImage,
+ RscEnum * pTriState );
+ RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
+ RscTop * pClassImageList );
+ RscTop * InitClassStatusBar( RscTop * pSuper );
+ RscTop * InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit );
+ RscTop * InitClassFloatingWindow( RscTop * pSuper,
+ RscEnum * pMapUnit );
+ RscTop * InitClassTabControlItem( RscTop * pSuper,
+ RscTop * pClassTabPage );
+ RscTop * InitClassTabControl( RscTop * pSuper,
+ RscTop * pClassTabControlItem );
+ RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
+ RscTop * pClassBitmap,
+ RscTop * pClassImage,
+ RscArray * pStrLst );
+ RscTop * InitClassSfxTemplateDialog( RscTop * pSuper,
+ RscTop * pStyleFamily );
+ RscTop * InitClassSfxSlotInfo( RscTop * pSuper );
+
+ void InsWinBit( RscTop * pClass, const ByteString & rName,
+ HASHID nVal );
+ void WriteInc( FILE * fOutput, ULONG lKey );
+
+public:
+ RscBool aBool;
+ RscRange aShort;
+ RscRange aUShort;
+ RscLongRange aLong;
+ RscLongEnumRange aEnumLong;
+ RscIdRange aIdUShort;
+ RscIdRange aIdNoZeroUShort;
+ RscBreakRange aNoZeroShort;
+ RscRange a1to12Short;
+ RscRange a0to23Short;
+ RscRange a1to31Short;
+ RscRange a0to59Short;
+ RscRange a0to99Short;
+ RscRange a0to9999Short;
+ RscIdRange aIdLong;
+ RscString aString;
+ RscFlag aWinBits;
+ RscEnum aLangType;
+ RscLangArray aLangString;
+ RscLangArray aLangShort;
+
+ RscError* pEH; // Fehlerhandler
+ RscNameTable aNmTb; // Tabelle fuer Namen
+ RscFileTab aFileTab; // Tabelle der Dateinamen
+ USHORT nFlags;
+ Table aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu
+ //(unter PM), oder eine Dateiposition (MTF)
+
+ RscTypCont( RscError *, LanguageType,
+ RSCBYTEORDER_TYPE,
+ CharSet nSourceCharSet,
+ const ByteString & rSearchPath, USHORT nFlags );
+ ~RscTypCont();
+
+ BOOL IsPreload() const
+ { return (nFlags & PRELOAD_FLAG) ? TRUE : FALSE; }
+ BOOL IsSmart() const
+ { return (nFlags & SMART_FLAG) ? TRUE : FALSE; }
+ BOOL IsSysResTest() const
+ { return (nFlags & NOSYSRESTEST_FLAG) ? FALSE : TRUE; }
+ BOOL IsSrsDefault() const
+ { return (nFlags & SRSDEFAULT_FLAG) ? TRUE : FALSE; }
+ LanguageType ChangeLanguage( LanguageType eLang )
+ {
+ LanguageType nOldLang = (LanguageType)nLangTypeId;
+ nLangTypeId = eLang;
+ return nOldLang;
+ }
+ RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
+ CharSet GetSourceCharSet() const { return nSourceCharSet; }
+ void SetSearchPath( const ByteString & rStr) { aSearchPath = rStr; }
+ ByteString GetSearchPath() const { return aSearchPath; }
+ void InsertType( RscTop * pType )
+ {
+ aBaseLst.Insert( pType, LIST_APPEND );
+ }
+ RscTop * SearchType( HASHID nTypId );
+ RscTop * Search( HASHID typ );
+ CLASS_DATA Search( HASHID typ, const RscId & rId );
+ void Delete( HASHID typ, const RscId & rId );
+ // loescht alle Resourceobjekte diese Datei
+ void Delete( ULONG lFileKey );
+ RscTop * GetRoot() { return( pRoot ); };
+ USHORT PutSysName( USHORT nRscTyp, char * pName, USHORT nConst,
+ USHORT nId, BOOL bFirst );
+ ERRTYPE WriteRc( FILE * fOutput );
+ void WriteSrc( FILE * fOutput, ULONG nFileIndex,
+ CharSet nCharSet, BOOL bName = TRUE );
+ ERRTYPE WriteHxx( FILE * fOutput, ULONG nFileKey);
+ ERRTYPE WriteCxx( FILE * fOutput, ULONG nFileKey,
+ const ByteString & rHxxName );
+ void WriteSyntax( FILE * fOutput );
+ void WriteRcCtor( FILE * fOutput );
+ void FillNameIdList( REResourceList * pList, ULONG lFileKey );
+ BOOL MakeConsistent( RscInconsList * pList );
+ USHORT PutTranslatorKey( ULONG nKey );
+ void IncFilePos( ULONG nOffset ){ nFilePos += nOffset; }
+};
+
+#endif
+
diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx
new file mode 100644
index 000000000000..2935d4061e8e
--- /dev/null
+++ b/rsc/inc/rscdef.hxx
@@ -0,0 +1,331 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscdef.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscdef.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.10 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.9 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.8 2000/07/11 17:00:08 th
+ Unicode
+
+ Revision 1.7 1997/08/27 18:18:14 MM
+ neue Headerstruktur
+
+**************************************************************************/
+
+#ifndef _RSCDEF_HXX
+#define _RSCDEF_HXX
+
+#ifndef _TOOLS_UNQIDX_HXX
+#include <tools/unqidx.hxx>
+#endif
+#ifndef _RSCTREE_HXX
+#include <rsctree.hxx>
+#endif
+
+/****************** C L A S S E S ****************************************/
+class RscExpression;
+class RscFileTab;
+class RscDefine;
+
+/*********** R s c E x p r e s s i o n ***********************************/
+#define RSCEXP_LONG 0
+#define RSCEXP_EXP 1
+#define RSCEXP_DEF 2
+#define RSCEXP_NOTHING 3
+
+class RscExpType
+{
+public:
+ union {
+ RscExpression * pExp;
+ RscDefine * pDef;
+ struct {
+ short nHi;
+ USHORT nLo;
+ } aLong;
+ } aExp;
+ char cType;
+ char cUnused;
+ BOOL IsNumber() const { return( RSCEXP_LONG == cType ); }
+ BOOL IsExpression()const { return( RSCEXP_EXP == cType ); }
+ BOOL IsDefinition()const { return( RSCEXP_DEF == cType ); }
+ BOOL IsNothing() const { return( RSCEXP_NOTHING == cType ); }
+ void SetLong( long lValue ){
+ aExp.aLong.nHi = (short)(lValue >> 16);
+ aExp.aLong.nLo = (USHORT)lValue;
+ cType = RSCEXP_LONG;
+ }
+ long GetLong() const{
+ return aExp.aLong.nLo |
+ ((long)aExp.aLong.nHi << 16);
+ }
+ BOOL Evaluate( long * pValue ) const;
+ void GetMacro( ByteString & ) const;
+};
+
+/*********** R s c I d ***************************************************/
+class RscId
+{
+ static BOOL bNames;// FALSE, bei den Namenoperation nur Zahlen
+public:
+ RscExpType aExp; // Zahl, Define oder Ausdruck
+ long GetNumber() const;
+ void Create( const RscExpType & rExpType );
+ void Create(){ aExp.cType = RSCEXP_NOTHING; }
+
+ RscId() { Create(); }
+
+ RscId( RscDefine * pEle );
+ RscId( long lNumber )
+ { aExp.SetLong( lNumber ); }
+
+ RscId( const RscExpType & rExpType )
+ { Create( rExpType ); }
+
+ void Destroy();
+
+ ~RscId(){
+ Destroy();
+ }
+
+ RscId( const RscId& rRscId );
+
+ RscId& operator = ( const RscId& rRscId );
+
+ static BOOL IsSetNames();
+ static void SetNames( BOOL bSet = TRUE );
+ operator long() const; // Gibt Nummer zurueck
+ ByteString GetName() const; // Gibt den Namen des Defines zurueck
+ ByteString GetMacro() const; // Gibt das Macro zurueck
+ BOOL operator < ( const RscId& rRscId ) const;
+ BOOL operator > ( const RscId& rRscId ) const;
+ BOOL operator == ( const RscId& rRscId ) const;
+ BOOL operator <= ( const RscId& rRscId ) const
+ { return !(operator > ( rRscId )); }
+ BOOL operator >= ( const RscId& rRscId ) const
+ { return !(operator < ( rRscId )); }
+ BOOL IsId() const { return !aExp.IsNothing(); }
+};
+
+/*********** R s c D e f i n e *******************************************/
+class RscDefine : public StringNode
+{
+friend class RscFileTab;
+friend class RscDefineList;
+friend class RscDefTree;
+friend class RscExpression;
+friend class RscId;
+ ULONG lFileKey; // zu welcher Datei gehoert das Define
+ USHORT nRefCount; // Wieviele Referenzen auf dieses Objekt
+ long lId; // Identifier
+ RscExpression * pExp; // Ausdruck
+protected:
+
+ RscDefine( ULONG lFileKey, const ByteString & rDefName,
+ long lDefId );
+ RscDefine( ULONG lFileKey, const ByteString & rDefName,
+ RscExpression * pExpression );
+ ~RscDefine();
+ void IncRef(){ nRefCount++; }
+ USHORT GetRefCount() const { return nRefCount; }
+ void DecRef();
+ void DefineToNumber();
+ void SetName( const ByteString & rNewName ){ aName = rNewName; }
+ void ChangeMacro( RscExpression * pExpression );
+ void ChangeMacro( long lIdentifier );
+public:
+ RscDefine * Search( const char * );
+ ULONG GetFileKey() const { return lFileKey; }
+ BOOL Evaluate();
+ long GetNumber() const { return lId; }
+ ByteString GetMacro();
+};
+
+DECLARE_LIST( RscSubDefList, RscDefine * )
+
+class RscDefineList : public RscSubDefList {
+friend class RscFile;
+friend class RscFileTab;
+private:
+ // pExpression wird auf jedenfall Eigentum der Liste
+ RscDefine * New( ULONG lFileKey, const ByteString & rDefName,
+ long lDefId, ULONG lPos );
+ RscDefine * New( ULONG lFileKey, const ByteString & rDefName,
+ RscExpression * pExpression, ULONG lPos );
+ BOOL Befor( const RscDefine * pFree, const RscDefine * pDepend );
+ BOOL Remove( RscDefine * pDef );
+ BOOL Remove( ULONG nIndex );
+ BOOL Remove();
+public:
+ void WriteAll( FILE * fOutput );
+};
+
+/*********** R s c E x p r e s s i o n ***********************************/
+class RscExpression {
+friend class RscFileTab;
+ char cOperation;
+ RscExpType aLeftExp;
+ RscExpType aRightExp;
+public:
+ RscExpression( RscExpType aLE, char cOp,
+ RscExpType aRE );
+ ~RscExpression();
+ BOOL Evaluate( long * pValue );
+ ByteString GetMacro();
+};
+
+/********************** R S C F I L E ************************************/
+class RscDepend {
+ ULONG lKey;
+public:
+ RscDepend( ULONG lIncKey ){ lKey = lIncKey; };
+ ULONG GetFileKey(){ return lKey; }
+};
+DECLARE_LIST( RscDependList, RscDepend * )
+
+// Tabelle die alle Dateinamen enthaelt
+class RscFile : public RscDependList
+{
+friend class RscFileTab;
+ BOOL bIncFile; // Ist es eine Include-Datei
+public:
+ BOOL bLoaded; // Ist die Datei geladen
+ BOOL bScanned; // Wurde Datei nach Inclide abgesucht
+ BOOL bDirty; // Dirty-Flag
+ ByteString aFileName; // Name der Datei
+ ByteString aPathName; // Pfad und Name der Datei
+ RscDefineList aDefLst; // Liste der Defines
+
+ RscFile();
+ ~RscFile();
+ BOOL InsertDependFile( ULONG lDepFile, ULONG lPos );
+ void RemoveDependFile( ULONG lDepFile );
+ BOOL Depend( ULONG lDepend, ULONG lFree );
+ void SetIncFlag(){ bIncFile = TRUE; };
+ BOOL IsIncFile(){ return bIncFile; };
+};
+
+DECLARE_UNIQUEINDEX( RscSubFileTab, RscFile * )
+#define NOFILE_INDEX UNIQUEINDEX_ENTRY_NOTFOUND
+
+class RscDefTree {
+ RscDefine * pDefRoot;
+public:
+ static BOOL Evaluate( RscDefine * pDef );
+ RscDefTree(){ pDefRoot = NULL; }
+ ~RscDefTree();
+ void Remove();
+ BOOL Evaluate();
+ RscDefine * Search( const char * pName );
+ void Insert( RscDefine * pDef );
+ void Remove( RscDefine * pDef );
+};
+
+class RscFileTab : public RscSubFileTab {
+ RscDefTree aDefTree;
+ ULONG Find( const ByteString & rName );
+public:
+ RscFileTab();
+ ~RscFileTab();
+
+ RscDefine * FindDef( const char * );
+ RscDefine * FindDef( const ByteString& rStr ) { return FindDef( rStr.GetBuffer() ); }
+ RscDefine * FindDef( ULONG lKey, const ByteString & );
+
+ BOOL Depend( ULONG lDepend, ULONG lFree );
+ BOOL TestDef( ULONG lFileKey, ULONG lPos,
+ const RscDefine * pDefDec );
+ BOOL TestDef( ULONG lFileKey, ULONG lPos,
+ const RscExpression * pExpDec );
+
+ RscDefine * NewDef( ULONG lKey, const ByteString & rDefName,
+ long lId, ULONG lPos );
+ RscDefine * NewDef( ULONG lKey, const ByteString & rDefName,
+ RscExpression *, ULONG lPos );
+
+ BOOL ChangeDef( const ByteString & rDefName, long lId );
+ BOOL ChangeDef( const ByteString & rDefName, RscExpression * );
+
+ BOOL IsDefUsed( const ByteString & );
+ void DeleteDef( const ByteString & );
+ BOOL ChangeDefName( const ByteString & rDefName,
+ const ByteString & rNewName );
+
+ // Alle Defines die in dieser Datei Definiert sind loeschen
+ void DeleteFileContext( ULONG lKey );
+ void DeleteFile( ULONG lKey );
+ ULONG NewCodeFile( const ByteString & rName );
+ ULONG NewIncFile( const ByteString & rName, const ByteString & rPath );
+ RscFile * GetFile( ULONG lFileKey ){ return Get( lFileKey ); }
+};
+
+#endif // _RSCDEF_HXX
diff --git a/rsc/inc/rscerror.h b/rsc/inc/rscerror.h
new file mode 100644
index 000000000000..695326625b62
--- /dev/null
+++ b/rsc/inc/rscerror.h
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscerror.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscerror.h,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.14 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.13 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.12 2000/07/11 17:00:17 th
+ Unicode
+
+ Revision 1.11 1997/08/27 18:18:16 MM
+ neue Headerstruktur
+
+**************************************************************************/
+
+#ifndef _RSCERROR_H
+#define _RSCERROR_H
+
+#ifndef _TOOLS_SOLAR_H
+#include <tools/solar.h>
+#endif
+
+/****************** D E F I N I T I O N S ********************************/
+/******************* R e t u r n E r r o r s *******************/
+#define ERR_OK 0xFFFF
+
+#define ERR_ERROR 0x0100
+#define ERR_UNKNOWN_METHOD 0x0101 // Return
+#define ERR_OPENFILE 0x0102 // Return
+#define ERR_NOCHAR 0x0103 // Return
+#define ERR_NORSCINST 0x0104 // Return
+#define ERR_USAGE 0x0105 //
+#define ERR_NOINPUT 0x0106 // Return
+#define ERR_UNKNOWNSW 0x0107 //
+#define ERR_REFTODEEP 0x0108 // Return
+#define ERR_FILEFORMAT 0x0109 // Return
+#define ERR_FILESIZE 0x010A // Return
+
+#define ERR_RSCRANGE 0x0200 // Return
+#define ERR_RSCRANGE_OUTDEFSET (ERR_RSCRANGE +1 )
+
+#define ERR_RSCENUM 0x0210 // Return
+#define ERR_RSCFLAG 0x0220 // Return
+#define ERR_RSCCONT 0x0240 // Return
+#define ERR_CONT_INVALIDPOS (ERR_RSCCONT +1 ) // Return
+#define ERR_CONT_INVALIDTYPE (ERR_RSCCONT +2 ) // Return
+
+#define ERR_RSCCMPED 0x0250
+#define ERR_RSCINST 0x0260
+#define ERR_RSCINST_NOVARNAME (ERR_RSCINST +1 ) // Return
+#define ERR_RSCINST_RESERVEDNAME (ERR_RSCINST +2 ) // Return
+
+#define ERR_LEX 0x0270
+#define ERR_YACC 0x0280 //
+#define ERR_DOUBLEID (ERR_YACC +1 ) //
+#define ERR_FALSETYPE (ERR_YACC +2 ) //
+#define ERR_NOVARIABLENAME (ERR_YACC +3 ) //
+#define ERR_USHORTRANGE (ERR_YACC +4 ) //
+#define ERR_IDRANGE (ERR_YACC +5 ) //
+#define ERR_NOCOPYOBJ (ERR_YACC +6 ) //
+#define ERR_REFNOTALLOWED (ERR_YACC +7 ) // Return
+#define ERR_DOUBLEDEFINE (ERR_YACC +8 ) //
+#define ERR_COPYNOTALLOWED (ERR_YACC +9 ) //
+#define ERR_IDEXPECTED (ERR_YACC +10) //
+#define ERR_ZERODIVISION (ERR_YACC +11) //
+#define ERR_PRAGMA (ERR_YACC +12) //
+#define ERR_DECLAREDEFINE (ERR_YACC +13) //
+#define ERR_NOTUPELNAME (ERR_YACC +14) //
+#define ERR_NOTYPE (ERR_YACC +15) //
+
+#define ERR_RSCARRAY 0x02A0 // Return
+#define ERR_ARRAY_INVALIDINDEX (ERR_RSCARRAY +1 ) // Return
+
+#define ERR_ERROREND 0x1000
+
+#define ERR_WARNINGSTART 0x1001
+#define WRN_LOCALID (ERR_WARNINGSTART +1 )
+#define WRN_GLOBALID (ERR_WARNINGSTART +2 )
+#define WRN_SUBINMEMBER (ERR_WARNINGSTART +3 )
+#define WRN_CONT_NOID (ERR_WARNINGSTART +4 )
+#define WRN_STR_REFNOTFOUND (ERR_WARNINGSTART +5 )
+#define WRN_MGR_REFNOTFOUND (ERR_WARNINGSTART +6 )
+#define WRN_CONT_DOUBLEID (ERR_WARNINGSTART +7 )
+
+#define ERR_WARNINGEND 0x2000
+
+class ERRTYPE {
+ USHORT nError;
+public:
+ ERRTYPE() { nError = ERR_OK; }
+ ERRTYPE( USHORT nErr ) { nError = nErr; }
+ ERRTYPE( const ERRTYPE & rErr ) { nError = rErr.nError; };
+ ERRTYPE& operator = ( const ERRTYPE & rError );
+ operator USHORT() const { return( nError ); }
+ BOOL IsError() const { return( nError <= ERR_ERROREND ); }
+ BOOL IsOk() const { return( !IsError() ); }
+ BOOL IsWarning() const {
+ return( nError >= ERR_WARNINGSTART && nError <= ERR_WARNINGEND );
+ };
+ void Clear(){ nError = ERR_OK; }
+};
+
+/****************** R s c E r r o r **************************************/
+class RscId;
+class RscTop;
+
+class RscError
+{
+ FILE * fListing;
+
+ void WriteError( const ERRTYPE& rError, const char * pMessage );
+ void StdLstOut( const char * pStr );
+ void ErrorFormat( const ERRTYPE& rError, RscTop * pClass,
+ const RscId & aId );
+public:
+ USHORT nErrors;// Anzahl der Fehler
+ RscError(){
+ fListing = NULL;
+ nErrors = 0;
+ };
+ void SetListFile( FILE * fList ){
+ fListing = fList;
+ };
+ FILE * GetListFile(){
+ return fListing;
+ };
+ virtual void StdOut( const char * );
+ virtual void LstOut( const char * );
+ virtual void Error( const ERRTYPE& rError, RscTop* pClass, const RscId &aId,
+ const char * pMessage = NULL );
+ // Dieser Fehler sollte nur im Compilermodus auftreten,
+ // das Programm wird mit exit() verlassen
+ virtual void FatalError( const ERRTYPE& rError, const RscId &aId,
+ const char * pMessage = NULL );
+};
+
+#endif // _RSCERROR_H
diff --git a/rsc/inc/rscflag.hxx b/rsc/inc/rscflag.hxx
new file mode 100644
index 000000000000..6c6d36c34174
--- /dev/null
+++ b/rsc/inc/rscflag.hxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscflag.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscflag.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCFLAG_HXX
+#define _RSCFLAG_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCCONST_HXX
+#include <rscconst.hxx>
+#endif
+
+/******************* R s c F l a g ***************************************/
+class RscFlag : public RscConst {
+ struct RscFlagInst{
+ USHORT nFlags;
+ USHORT nDfltFlags;
+ };
+ BOOL bUSHORT;
+ RSCINST CreateBasic( RSCINST * pInst );
+public:
+ RscFlag( HASHID nId, USHORT nTypId, BOOL bUSHORT = TRUE );
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
+ RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass, HASHID nConsId );
+ USHORT Size();
+
+ virtual void SetToDefault( const RSCINST & rInst );
+ BOOL IsDefault( const RSCINST & rInst );
+ BOOL IsDefault( const RSCINST & rInst, HASHID nConstId );
+
+ // Ist das Flag gesetzt
+ BOOL IsSet( const RSCINST & rInst, HASHID nConstId );
+
+ // Als Default setzen
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef,
+ HASHID nConstId );
+
+ ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId,
+ long nValue );
+ ERRTYPE SetNotConst( const RSCINST & rInst, HASHID nConstId );
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+};
+
+/******************* R s c C l i e n t ***********************************/
+class RscClient : public RscTop
+{
+ RscFlag * pRefClass; //Klasse die als Server benutzt wird
+ HASHID nConstId; //Id des zu setzenden Wertes
+public:
+ RscClient( HASHID nId, USHORT nTypId, RscFlag * pClass,
+ HASHID nConstantId );
+ virtual RSCCLASS_TYPE GetClassType() const;
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
+ USHORT Size(){ return( pRefClass->Size() ); };
+
+ // Eine Zuweisung an eine Variable
+ BOOL IsDefault( const RSCINST & rInst ){
+ return( pRefClass->IsDefault( rInst, nConstId ) );
+ };
+ // Als Default setzen
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
+ return pRefClass->IsValueDefault( rInst,
+ pDef, nConstId );
+ }
+ ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue ){
+ if( bValue )
+ return( pRefClass->SetConst( rInst, nConstId, bValue ) );
+ else
+ return( pRefClass->
+ SetNotConst( rInst, nConstId ) );
+ };
+ ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB ){
+ *pB = pRefClass->IsSet( rInst, nConstId );
+ return( ERR_OK );
+ };
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+};
+
+#endif // _RSCFLAG_HXX
diff --git a/rsc/inc/rschash.hxx b/rsc/inc/rschash.hxx
new file mode 100644
index 000000000000..0ef00f7020a6
--- /dev/null
+++ b/rsc/inc/rschash.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * $RCSfile: rschash.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rschash.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.6 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.5 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.4 1997/08/27 18:18:10 MM
+ neue Headerstruktur
+
+
+ Rev 1.3 27 Aug 1997 18:18:10 MM
+ neue Headerstruktur
+
+ Rev 1.2 21 Nov 1995 19:49:20 TLX
+ Neuer Link
+
+ Rev 1.1 04 May 1995 10:17:20 mk
+ ^Z am Ende
+
+ Rev 1.0 10 Aug 1992 07:14:22 MM
+ Initial revision.
+
+ Rev 1.4 23 Mar 1992 15:23:50 MM
+
+ Rev 1.3 26 Nov 1991 08:56:06 MM
+
+ Rev 1.2 11 Sep 1991 12:20:10 MM
+
+ Rev 1.1 18 Jul 1991 12:53:26 MM
+ Unix Anpassung
+
+ Rev 1.0 17 Jun 1991 14:54:46 MM
+ Initial revision.
+
+ Rev 1.0 08 Feb 1991 13:42:52 MM
+ Initial revision.
+
+**************************************************************************/
+
+#ifndef _RSCHASH_HXX
+#define _RSCHASH_HXX
+
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+
+/****************** T Y P E S ********************************************/
+/****************** C L A S S E S ****************************************/
+/****************** S t r i n g - C o n **********************************/
+class StringCon{
+private:
+ USHORT nMax; // sizeof character field
+ USHORT nFill; // index after last entry
+ char * pField; // pointer to character field
+public:
+ StringCon( USHORT nMaxEntries ); // maximum numbers of characters
+ ~StringCon();
+ char *Put( const char * pStr ); // put string in field
+};
+
+/****************** H a s h - T a b e l **********************************/
+class HashTabel{
+private:
+ USHORT nMax; // size of hash-tabel
+ USHORT nFill; // elements in hash-tabel
+ ULONG lAsk; // Anzahl der Anfragen
+ ULONG lTry; // Anzahl der Versuche
+protected:
+ HASHID Test_Insert( const void *, BOOL bInsert );
+public:
+ HashTabel( USHORT nMaxEntries ); // max size of hash-tabel
+ ~HashTabel();
+ HASHID Test( const void * ); // test of insert
+ HASHID Insert( const void * pElement ); // insert in hashtabel
+ virtual USHORT HashFunc( const void * ){ return( 0 ); };
+ // get hash value from subclass
+ virtual BOOL IsEntry( HASHID ){ return( FALSE ); };
+ // is field
+ // nIndex = index in Field
+ virtual COMPARE Compare( const void * , HASHID )
+ { return( EQUAL ); }; // compare element with entry
+};
+
+/****************** H a s h - S t r i n g ********************************/
+class HashString : public HashTabel{
+private:
+ StringCon * paSC; // container of strings
+ char * * ppStr; // pointer to char * array
+public:
+ HashString( USHORT nMaxEntries ); // max size of hash-tabel
+ ~HashString();
+ USHORT HashFunc( const void * pElement ); // return hash value
+ BOOL IsEntry( HASHID nIndex );
+ COMPARE Compare( const void * pElement, HASHID nIndex );
+ HASHID Insert( const char * pStr ); // test of insert string
+ HASHID Test( const char * pStr ); // insert string
+ char * Get( HASHID nIndex ); // return pointer to string
+};
+
+#endif // _RSCHASH_HXX
+
diff --git a/rsc/inc/rscinst.hxx b/rsc/inc/rscinst.hxx
new file mode 100644
index 000000000000..f0a982c21217
--- /dev/null
+++ b/rsc/inc/rscinst.hxx
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscinst.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscinst.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.14 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.13 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.12 2000/07/11 17:00:28 th
+ Unicode
+
+ Revision 1.11 1999/09/07 13:30:02 mm
+ UniCode
+
+ Revision 1.10 1997/08/27 18:18:06 MM
+ neue Headerstruktur
+
+**************************************************************************/
+
+#ifndef _RSCINST_HXX
+#define _RSCINST_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+
+/******************* C l a s s e s F o r w a r d s *********************/
+class RscTypCont;
+class RscCmdLine;
+class REResourceList;
+class RscTop;
+class RscInstCopy;
+
+/******************* F u n c t i o n F o r w a r d s *******************/
+HASHID HashId( const char * ); // Gibt zu einem String eine HashId
+const char * GetHashString( HASHID ); // Gibt zu einer HASHID einen String
+ // NULL, wenn kein Eintrag vorhanden
+
+/******************* S t r u c t s ***************************************/
+
+/****************** C L A S S E S ****************************************/
+class RscInst
+{
+ void MakeCopy( RSCINST aCopyInst );
+ static RSCINST GetSysLangInst( RSCINST & rInst );
+public:
+ RSCINST aInst;
+
+ RscInst();
+ RscInst( const RscInst & rInst );
+ RscInst( RSCINST aTmpI );
+ RscInst& operator = ( const RscInst& rRscInst );
+ ~RscInst();
+ void OverWrite( RscInstCopy & rInst );
+ BOOL IsInst() const { return( aInst.IsInst() ); }
+
+ // Listen Methoden
+ ERRTYPE SetElement( const RscId & rName, RscInstCopy & rInst );
+ ERRTYPE SetPosEle( USHORT nPos, RscInstCopy & rInst );
+ ERRTYPE SetPosRscId( USHORT nPos, const RscId & rId );
+ SUBINFO_STRUCT GetInfoEle( USHORT nPos );
+ USHORT GetCount();
+ RscInst GetElement( RscTop * pClass, const RscId & rName );
+ RscInst GetPosEle( USHORT nPos );
+ ERRTYPE MovePosEle( USHORT nDestPos, USHORT nSourcePos );
+ ERRTYPE DeleteElement( RscTop * pClass, const RscId & rName );
+ ERRTYPE DeletePosEle( USHORT nPos );
+
+ ERRTYPE SetVar( HASHID nVarName, RscInstCopy & rInst );
+ ERRTYPE SetConst( HASHID nVarName, HASHID nConstId );
+ ERRTYPE SetBool( HASHID nVarName, BOOL );
+
+ // Hack fuer X, Y, Width, Height
+ static ERRTYPE SetCorrectValues( RSCINST & rInst, RSCINST & rVarInst,
+ long lValue, USHORT nTupelIdx );
+ ERRTYPE SetNumber( HASHID nVarName, long );
+
+ ERRTYPE SetString( HASHID nVarName, const char * );
+ ERRTYPE SetConst( HASHID nConstId );
+ ERRTYPE SetBool( BOOL );
+ ERRTYPE SetNumber( long );
+ ERRTYPE SetString( const char * );
+ ERRTYPE SetRef( const RscId & rRscId );
+ ERRTYPE SetDefault( HASHID nVarName );
+
+ RscInst GetVar( HASHID nVarName );
+ HASHID GetConst( HASHID nVarName = HASH_NONAME );
+ USHORT GetConstPos( HASHID nVarName = HASH_NONAME );
+ BOOL GetBool( HASHID nVarName = HASH_NONAME );
+
+ // Hack fuer X, Y, Width, Height
+ static long GetCorrectValues( RSCINST & rInst, RSCINST & rVarInst,
+ USHORT nTupelIdx );
+ long GetNumber( HASHID nVarName = HASH_NONAME );
+
+ const char *GetString( HASHID nVarName = HASH_NONAME );
+ RscId GetRef();
+ BOOL IsDefault( HASHID nVarName );
+ BOOL IsConsistent( RscInconsList * pList );
+
+ HASHID GetClassEnum( HASHID nVarName, USHORT nPos );
+ HASHID GetClassEnum( USHORT nPos );
+ RscTop * GetClassType(){ return aInst.pClass; };
+ HASHID GetClassName();
+ void EnumClassVariables( void * pData, VarEnumCallbackProc ) const;
+ ERRTYPE WriteRc( RscWriteRc & aMem );
+};
+
+class RscInstCopy : public RscInst {
+ void MakeCopy( RSCINST aCopyInst );
+public:
+ RscInstCopy();
+ RscInstCopy( const RscInstCopy & rInst );
+ RscInstCopy( const RscInst & rInst );
+ RscInstCopy( RSCINST aTmpI );
+ RscInstCopy( RscTop * pNewType, const RscInst & rInst );
+ RscInstCopy& operator = ( const RscInstCopy & rRscInst );
+ RscInstCopy& operator = ( const RscInst & rRscInst );
+ ~RscInstCopy();
+};
+
+class RscDataBase
+{
+friend class RscHrc;
+friend class RscSrc;
+friend class RscInst;
+
+ RscCmdLine * pCmdLine;
+ RscTypCont * pTC;
+ LanguageType nLangType;
+public:
+ RscDataBase( RscError * );
+ ~RscDataBase();
+
+// void SetLanguage( LanguageType nTyp ) { nLangType = nTyp; }
+ void SetLanguage( HASHID nId );
+ HASHID GetLanguage() const;
+
+ ByteString GetPath() const;
+ void SetPath( const ByteString & rPath );
+ // Konvertiert einen Namen in einen Typ
+ RscTop* GetClassType( HASHID nClassName );
+ // Instanz einer Klasse erzeugen
+ BOOL MakeConsistent( RscInconsList * pList );
+ // Array mit Dateinamen
+ RscFileTab* GetFileTab();
+ // Eine Dateinamen-Instanz holen
+ RscFile * GetFileStruct( ULONG lKey );
+
+ ULONG AddSrcFile( const ByteString & rFileName );
+ ULONG AddHrcFile( const ByteString & rFileName );
+ // Traegt die Include-Dateien in die Abhaengigkeitsliste
+ // von lFileKey ein
+ void ScanForIncFiles( ULONG lFileKey );
+ void RemoveFile( ULONG lKey );
+
+ // Suche ueber alle DEFINES
+ RscDefine * FindDef( const ByteString & rName );
+ ULONG GetFileKey( const ByteString & rFileName );
+};
+
+class RscHrc
+{
+protected:
+ ULONG lFileKey; // Index der Instanz
+ RscDataBase * pDataBase;// Datenbasis
+public:
+
+ // Kompilerinstanz erzeugen
+ RscHrc( RscDataBase * pDBase, ULONG lKey );
+ ~RscHrc();
+
+ // Daten von Datei uebernehmen
+ ERRTYPE ReadFile();
+
+ ULONG GetFileKey() const { return lFileKey; }
+
+ void SetDirty( BOOL bSet );
+ BOOL IsDirty();
+ void SetPathName( const ByteString & );
+ ByteString GetPathName();
+ void SetFileName( const ByteString & );
+ ByteString GetFileName();
+
+ //Depend-Datei anhaengen
+ void InsertDepend( ULONG lKey, ULONG lPos );
+
+ // DefineList holen
+ RscDefineList * GetDefineList();
+ // Suche ueber all DEFINES im Zugriff
+ RscDefine * FindDef( const ByteString & rName );
+ ERRTYPE NewDef( const ByteString & rMacroName, long lValue,
+ ULONG lPos );
+ ERRTYPE NewDef( const ByteString & rMacroName, const ByteString & rMacro,
+ ULONG lPos );
+ ERRTYPE ChangeDef( const ByteString & rMacroName, long lValue );
+ ERRTYPE ChangeDef( const ByteString & rMacroName,
+ const ByteString & rMacro );
+ BOOL IsDefUsed( const ByteString & );
+ void DeleteDef( const ByteString & rMacroName );
+ ERRTYPE ChangeDefName( const ByteString & rMacroName,
+ const ByteString & rNewName );
+
+ // Dateinamen-Instanz holen
+ RscFile * GetFileStruct();
+ //Abhaengigkeitsliste holen holen
+ RscDependList * GetDependList();
+
+ // Datei schreiben
+ ERRTYPE WriteFile();
+};
+
+class RscSrc : public RscHrc {
+public:
+ // Kompilerinstanz erzeugen
+ RscSrc( RscDataBase * pDBase, ULONG lKey );
+ ~RscSrc();
+
+
+ RscInstCopy CreateRscInst( RscTop * pClass );
+ // Instanz loeschen
+ ERRTYPE DeleteRscInst( RscTop * pClass, const RscId & rInstName );
+ // Datenbasis nach Define Veraenderung wiederherstellen
+ //Instanz global zur Verfuegung stellen
+ ERRTYPE SetRscInst( const RscId & rInstName, RscInstCopy & );
+ //Instanz holen
+ RscInst GetRscInst( RscTop* pClass, const RscId & rInstName );
+
+ // Namen und Identifier Liste fuellen
+ void FillNameIdList( REResourceList * pList );
+
+ // C++ Resourcekonstruktor schreiben
+ ERRTYPE WriteCxxFile( const ByteString &, const ByteString & rHxxName );
+ ERRTYPE WriteHxxFile( const ByteString & ); // C++ Klasskopf schreiben
+};
+
+#endif //_RSCINST_HXX
diff --git a/rsc/inc/rsckey.hxx b/rsc/inc/rsckey.hxx
new file mode 100644
index 000000000000..f4da97b39dd1
--- /dev/null
+++ b/rsc/inc/rsckey.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsckey.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsckey.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.6 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.5 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.4 1997/08/27 18:18:06 MM
+ neue Headerstruktur
+
+
+ Rev 1.3 27 Aug 1997 18:18:06 MM
+ neue Headerstruktur
+
+ Rev 1.2 21 Nov 1995 19:49:18 TLX
+ Neuer Link
+
+ Rev 1.1 16 Feb 1995 19:50:50 MM
+ char * -> const char *
+
+ Rev 1.0 10 Aug 1992 07:14:30 MM
+ Initial revision.
+**************************************************************************/
+
+#ifndef _RSCKEY_HXX
+#define _RSCKEY_HXX
+
+/****************** C l a s s F o r w a r d s **************************/
+class RscTop;
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+
+typedef struct {
+ HASHID nName;
+ USHORT nTyp;
+ long yylval;
+} KEY_STRUCT;
+
+class RscNameTable {
+ BOOL bSort; //soll bei jedem einfuegen sortiert werden?
+ USHORT nEntries; //Anzahl der Eintr„ge
+ KEY_STRUCT * pTable;
+public:
+ RscNameTable();
+ ~RscNameTable();
+ void SetSort( BOOL bSorted = TRUE );
+ HASHID Put( HASHID nName, USHORT nTyp, long nValue );
+ HASHID Put( HASHID nName, USHORT nTyp );
+ HASHID Put( const char * pName, USHORT nTyp, long nValue );
+ HASHID Put( const char * pName, USHORT nTyp );
+ HASHID Put( HASHID nName, USHORT nTyp, RscTop * pClass );
+ HASHID Put( const char * pName, USHORT nTyp, RscTop * pClass );
+
+ // TRUE, wurde gefunden
+ BOOL Get( HASHID nName, KEY_STRUCT * pEle );
+};
+
+
+#endif// _RSCKEY_HXX
diff --git a/rsc/inc/rsclst.hxx b/rsc/inc/rsclst.hxx
new file mode 100644
index 000000000000..2caf10123202
--- /dev/null
+++ b/rsc/inc/rsclst.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsclst.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RSCLST_HXX
+#define _RSCLST_HXX
+
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+
+class REResourceList;
+
+DECLARE_LIST( RESubResourceList, REResourceList * )
+
+class REResourceList : public RESubResourceList
+{
+protected:
+ REResourceList* pParent;
+ RscId aRscId; //Id und Name des Resourceobjektes
+ ByteString aClassName;
+ BOOL bVisible;
+
+public:
+ REResourceList();
+ REResourceList( REResourceList * pParentList,
+ ByteString& rClassName,
+ const RscId & rResourceID,
+ BOOL bVisible = FALSE );
+ ~REResourceList();
+
+ REResourceList* GetParent() { return pParent; }
+ ByteString GetObjName() { return aRscId.GetName(); }
+ ByteString GetClassName() { return aClassName; }
+ RscId GetRscId() { return aRscId; }
+ void SetRscId( const RscId & rId ){ aRscId = rId; }
+
+ void SetVisible( BOOL bVis )
+ { bVisible = bVis; }
+ BOOL IsVisible() { return bVisible; }
+};
+
+#endif // _RSCLST_HXX
diff --git a/rsc/inc/rscmgr.hxx b/rsc/inc/rscmgr.hxx
new file mode 100644
index 000000000000..815944357ab7
--- /dev/null
+++ b/rsc/inc/rscmgr.hxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscmgr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscmgr.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.10 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.9 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.8 1997/08/27 18:18:10 MM
+ neue Headerstruktur
+
+
+ Rev 1.7 27 Aug 1997 18:18:10 MM
+ neue Headerstruktur
+
+ Rev 1.6 21 Nov 1995 19:49:08 TLX
+ Neuer Link
+
+ Rev 1.5 12 Jan 1994 15:18:06 mm
+ Alignementprobleme und Warnings fuer DEC-Alpha beseitigt
+
+ Rev 1.4 28 Oct 1993 17:12:36 mm
+ Referenzeingabe wird besser geprueft
+
+ Rev 1.3 25 Aug 1993 15:34:18 mm
+ Fehler und Warnings beseitigt
+
+ Rev 1.2 05 Jan 1993 10:50:36 mm
+ Neues Default verhalten
+
+ Rev 1.1 23 Dec 1992 14:02:32 mm
+ Sprachaenderung
+
+ Rev 1.0 10 Aug 1992 07:14:20 MM
+ Initial revision.
+
+**************************************************************************/
+
+#ifndef _RSCMGR_HXX
+#define _RSCMGR_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+#ifndef _RSCCLASS_HXX
+#include <rscclass.hxx>
+#endif
+
+/******************* R s c M g r *****************************************/
+class RscMgr : public RscClass {
+ struct RscMgrInst {
+ RscId aRefId; // nRefId = Referenz Identifier
+ BOOL bDflt; // Ist Default
+ void Create(){ aRefId.Create(); bDflt = TRUE; }
+ void Destroy(){ aRefId.Destroy(); }
+ };
+ ERRTYPE IsToDeep( const RSCINST & rInst, USHORT nDeep = 0 );
+public:
+ RscMgr( HASHID nId, USHORT nTypId, RscTop * pSuperCl );
+
+ void SetToDefault( const RSCINST & rInst );
+ BOOL IsDefault( const RSCINST & rInst );
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
+ void Destroy( const RSCINST & rInst );
+ USHORT Size();
+ void WriteSrcHeader( const RSCINST & aInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & rId, const char * );
+
+ void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, const RscId & rId,
+ USHORT, BOOL bExtra );
+ ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ ERRTYPE WriteHxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId );
+ ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId );
+ ERRTYPE WriteCxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId );
+ ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId );
+ BOOL IsConsistent( const RSCINST & rInst,
+ RscInconsList * pList = NULL );
+ ERRTYPE GetRef( const RSCINST & rInst, RscId * );
+ ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId );
+};
+
+#endif //_RSCMGR_HXX
diff --git a/rsc/inc/rscpar.hxx b/rsc/inc/rscpar.hxx
new file mode 100644
index 000000000000..5fe35835cd37
--- /dev/null
+++ b/rsc/inc/rscpar.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscpar.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscpar.hxx,v 1.1.1.1 2000-09-18 16:42:54 hr Exp $
+
+**************************************************************************/
+#ifndef _RSCPAR_HXX
+#define _RSCPAR_HXX
+
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+
+/****************** C L A S S E S ****************************************/
+class RscTypCont;
+class RscExpression;
+/*********** R s c F i l e I n s t ***************************************/
+
+#define READBUFFER_MAX 256
+class RscFileInst
+{
+ ERRTYPE aFirstError;// Erster Fehler
+ USHORT nErrorLine; // Zeile des ersten Fehlers
+ USHORT nErrorPos; // Position des ersten Fehlers
+ rtl_TextEncoding nCharSet; // Zeichensatz der einzulesenden Datei
+ BOOL bIncLine; // Muss Zeilennummer incrementiert werden
+ USHORT nLineNo; // Zeile in der Eingabedatei
+ ULONG lFileIndex; // Index auf Eingabedatei
+ ULONG lSrcIndex; // Index auf Basisdatei
+ FILE * fInputFile; // Eingabedatei
+ char * pInput; // Lesepuffer
+ USHORT nInputBufLen; // Laenge des Lesepuffers
+ USHORT nInputPos; // Position im Lesepuffer
+ USHORT nInputEndPos;// Ende im Lesepuffer
+ char * pLine; // Zeile
+ USHORT nLineBufLen;//Lange des Zeilenpuffres
+ USHORT nScanPos; // Position in der Zeile
+ int cLastChar;
+ BOOL bEof;
+
+public:
+ RscTypCont * pTypCont;
+ void Init(); // ctor initialisieren
+ RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
+ ULONG lFileIndex, FILE * fFile,
+ rtl_TextEncoding nSourceCharSet );
+ RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
+ ULONG lFileIndex, const ByteString &,
+ rtl_TextEncoding nSourceCharSet );
+ ~RscFileInst();
+ BOOL IsEof() const { return bEof; }
+ void SetCharSet( rtl_TextEncoding nSet ) { nCharSet = nSet; }
+ UINT16 GetCharSet() const { return (UINT16)nCharSet; }
+ void SetFileIndex( ULONG lFIndex ) { lFileIndex = lFIndex; }
+ ULONG GetFileIndex() { return( lFileIndex ); }
+ ULONG GetSrcIndex() { return( lSrcIndex ); }
+ void SetLineNo( USHORT nLine ) { nLineNo = nLine; }
+ USHORT GetLineNo() { return( nLineNo ); }
+ USHORT GetScanPos() { return( nScanPos ); }
+ char * GetLine() { return( pLine ); }
+ int GetChar();
+ int GetFastChar() { return pLine[ nScanPos ] ?
+ pLine[ nScanPos++ ] : GetChar();
+ }
+ void GetNewLine();
+ // Fehlerbehandlung
+ void SetError( ERRTYPE aError );
+ ERRTYPE GetError() { return aFirstError; }
+ USHORT GetErrorLine() { return nErrorLine; }
+ USHORT GetErrorPos() { return nErrorPos; }
+};
+
+/******************* F u n c t i o n *************************************/
+void IncludeParser( RscFileInst * pFileInst );
+ERRTYPE parser( RscFileInst * pFileInst );
+RscExpression * MacroParser( RscFileInst & rFileInst );
+
+#endif // _RSCPAR_HXX
diff --git a/rsc/inc/rscrange.hxx b/rsc/inc/rscrange.hxx
new file mode 100644
index 000000000000..48a7a80c9ea6
--- /dev/null
+++ b/rsc/inc/rscrange.hxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscrange.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscrange.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCRANGE_HXX
+#define _RSCRANGE_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+
+/******************* R s c R a n g e *************************************/
+class RscRange : public RscTop
+{
+protected:
+ struct RscRangeInst {
+ USHORT nValue; // nValue = Ausgangswert - nMin
+ BOOL bDflt; // Ist Default
+ };
+ long nMin; // Minimum des Bereiches
+ long nMax; // Maximum des Bereiches
+ USHORT nSize;
+public:
+ RscRange( HASHID nId, USHORT nTypId );
+ virtual RSCCLASS_TYPE GetClassType() const;
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL );
+ // Der zulaessige Bereich wird gesetzt
+ ERRTYPE SetRange( long nMinimum, long nMaximum );
+ // Gibt die Groesse der Klasse in Bytes
+ USHORT Size(){ return nSize; }
+ // Eine Zuweisung an eine Variable
+ virtual void SetToDefault( const RSCINST & rInst )
+ {
+ ((RscRangeInst*)rInst.pData)->bDflt = TRUE;
+ }
+ BOOL IsDefault( const RSCINST & rInst)
+ {
+ return( ((RscRangeInst*)rInst.pData)->bDflt );
+ };
+ // Als Default setzen
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+ ERRTYPE SetNumber( const RSCINST &, long );
+ ERRTYPE GetNumber( const RSCINST &, long * );
+ void WriteSrc( const RSCINST &, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+};
+
+/******************* R s c L o n g R a n g e ******************************/
+class RscLongRange : public RscTop
+{
+protected:
+ struct RscLongRangeInst
+ {
+ long nValue; // nValue = Ausgangswert - nMin
+ BOOL bDflt; // Ist Default
+ };
+ long nMin; // Minimum des Bereiches
+ long nMax; // Maximum des Bereiches
+ USHORT nSize;
+public:
+ RscLongRange( HASHID nId, USHORT nTypId );
+ virtual RSCCLASS_TYPE GetClassType() const;
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL );
+ // Der zulaessige Bereich wird gesetzt
+ ERRTYPE SetRange( long nMinimum, long nMaximum );
+ // Gibt die Groesse der Klasse in Bytes
+ USHORT Size(){ return nSize; }
+ // Eine Zuweisung an eine Variable
+ virtual void SetToDefault( const RSCINST & rInst )
+ {
+ ((RscLongRangeInst*)rInst.pData)->bDflt = TRUE;
+ }
+ BOOL IsDefault( const RSCINST & rInst)
+ {
+ return( ((RscLongRangeInst*)rInst.pData)->bDflt );
+ };
+ // Als Default setzen
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+ ERRTYPE SetNumber( const RSCINST &, long );
+ ERRTYPE GetNumber( const RSCINST &, long * );
+ void WriteSrc( const RSCINST &, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+
+};
+
+/******************* R s c L o n g E n u m R a n g e ******************/
+class RscLongEnumRange : public RscLongRange
+{
+public:
+ RscLongEnumRange( HASHID nId, USHORT nTypId );
+
+ ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId,
+ long nValue );
+};
+
+/******************* R s c I d R a n g e ***********************************/
+class RscIdRange : public RscTop
+{
+ USHORT nSize;
+protected:
+ long nMin; // Minimum des Bereiches
+ long nMax; // Maximum des Bereiches
+ BOOL bRcLong;// Binaere Resource 4 Byte statt 2
+public:
+ RscIdRange( HASHID nId, USHORT nTypId, BOOL bRcL = FALSE );
+ virtual RSCCLASS_TYPE GetClassType() const;
+ // Der zulaessige Bereich wird gesetzt
+ ERRTYPE SetRange( long nMinimum, long nMaximum ){
+ nMin = nMinimum;
+ nMax = nMaximum;
+ return ERR_OK;
+ }
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL );
+ void Destroy( const RSCINST & rInst );
+ USHORT Size(){ return nSize; }
+ virtual void SetToDefault( const RSCINST & rInst )
+ {
+ ((RscId*)rInst.pData)->aExp.cUnused = TRUE;
+ }
+ BOOL IsDefault( const RSCINST & rInst)
+ {
+ //cUnused wird fuer Defaultkennung verwendet
+ return ((RscId*)rInst.pData)->aExp.cUnused
+ ? TRUE : FALSE;
+ }
+ // Als Default setzen
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+ ERRTYPE SetNumber( const RSCINST &, long );
+ ERRTYPE GetNumber( const RSCINST &, long * );
+ ERRTYPE SetRef( const RSCINST &, const RscId & rRscId );
+ ERRTYPE GetRef( const RSCINST & rInst, RscId * );
+ void WriteSrc( const RSCINST &, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ BOOL IsConsistent( const RSCINST & rInst, RscInconsList * pList );
+ void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+
+};
+
+/******************* R s c B o o l ***************************************/
+class RscBool : public RscRange
+{
+public:
+ RscBool( HASHID nId, USHORT nTypId );
+ virtual RSCCLASS_TYPE GetClassType() const;
+ // Der zulaessige Bereich wird gesetzt
+ ERRTYPE SetRange( long, long ){
+ return( ERR_UNKNOWN_METHOD );
+ };
+ ERRTYPE SetBool( const RSCINST & rInst, BOOL b ){
+ return( SetNumber( rInst, (long)b ) );
+ };
+ ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB){
+ long l;
+ GetNumber( rInst, &l );
+ *pB = (0 != l);
+ return( ERR_OK );
+ };
+ void WriteSrc( const RSCINST &, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+
+};
+
+class RscBreakRange : public RscRange {
+ long nOutRange;
+public:
+ RscBreakRange( HASHID nId, USHORT nTypId );
+ void SetOutRange( long nNumber ){
+ nOutRange = nNumber;
+ }
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL );
+ ERRTYPE SetNumber( const RSCINST &, long );
+};
+
+#endif // _RSCRANGE_HXX
diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx
new file mode 100644
index 000000000000..2a37bc48e698
--- /dev/null
+++ b/rsc/inc/rscrsc.hxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscrsc.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscrsc.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCRSC_HXX
+#define _RSCRSC_HXX
+
+#ifndef _LANG_HXX //autogen
+#include <tools/lang.hxx>
+#endif
+
+
+#ifndef RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+
+class RscTypCont;
+
+/****************** T Y P E S ********************************************/
+
+#define MAX_INPUTFILES 100
+#define MAX_SYMBOLS 10
+#define MAX_INCLUDES 10
+
+/****************** R s c C m d L i n e **********************************/
+class RscCmdLine
+{
+ void Init();
+
+public:
+ RscStrList aInputList; // Liste der Quelldateien
+ RscStrList aSymbolList; // Liste der Symbole
+ ByteString aPath; // Liste der Pfade
+ CharSet nSourceCharSet; // Welcher Quellzeichensatz
+ LanguageType nLangTypeId; // Globale Sprachtyp
+ RSCBYTEORDER_TYPE nByteOrder;
+ short nCommands; // Steuerbits
+ ByteString aOutputSrs; // Name der Srs-Ausgabedatei
+ ByteString aOutputRc; // Name der Rc-Ausgabedatei
+ ByteString aOutputLst; // Name der List-Ausgabedatei
+ ByteString aOutputSrc; // Name der Src-Ausgabedatei
+ ByteString aOutputRcCtor; // Name der Ctor-Ausgabedatei
+ ByteString aOutputCxx; // Name der Cxx-Ausgabedatei
+ ByteString aOutputHxx; // Name der Hxx-Ausgabedatei
+
+ RscCmdLine( short argc, char ** argv, RscError * pEH );
+ RscCmdLine();
+
+ void SetInputFile( const ByteString & rInputName );
+ ~RscCmdLine();
+};
+/****************** R s c ************************************************/
+class RscCompiler
+{
+private:
+ RscStrList aTmpFileList; // Liste der Tmp-Dateien
+ ByteString aTmpOutputRc; // Name der TempRc-Ausgabedatei
+ ByteString aTmpOutputHxx; // Name der TempHxx-Ausgabedatei
+ ByteString aTmpOutputCxx; // Name der TempCxx-Ausgabedatei
+ ByteString aTmpOutputRcCtor; // Name der Temp Ctor-Ausgabedatei
+ ByteString aTmpOutputSrc; // Name der TempSrc-Ausgabedatei
+
+ void CreateResFile( const char * pRc );
+
+ void Append( const ByteString& rOutputSrs, const ByteString& rTmpFile );
+ void OpenInput( const ByteString& rInput );
+
+public:
+ RscTypCont* pTC; // String und Id-Verwalter
+ RscCmdLine* pCL; // Kommandozeile
+ FILE * fListing; // Ausgabedatei fuer Listings
+ FILE * fExitFile; // bei Abbruch muss diese Datei geschlossen werden
+
+ RscCompiler( RscCmdLine *, RscTypCont * );
+ ~RscCompiler();
+
+ ERRTYPE Start();
+ ByteString GetTmpFileName(); // Die Dateien werden geloescht
+
+ // Include Statements lesen
+ ERRTYPE IncludeParser( ULONG lFileKey );
+ ERRTYPE ParseOneFile( ULONG lFileKey );
+ ERRTYPE CheckSyntax();
+ ERRTYPE Link();
+ void EndCompile();
+};
+
+#endif //_RSCRSC_HXX
diff --git a/rsc/inc/rscsfx.hxx b/rsc/inc/rscsfx.hxx
new file mode 100644
index 000000000000..57713e2cc740
--- /dev/null
+++ b/rsc/inc/rscsfx.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscsfx.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscsfx.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCSFX_HXX
+#define _RSCSFX_HXX
+
+// StarView (RSC_NOTYPE) bis (RSC_NOTYPE + 0x190)
+// Sfx (RSC_NOTYPE + 0x200) bis (RSC_NOTYPE + 0x20F)
+#define RSC_SFX_STYLE_FAMILIES (0x100 + 0x201)
+#define RSC_SFX_STYLE_FAMILY_ITEM (0x100 + 0x202)
+#define RSC_SFX_SLOT_INFO (0x100 + 0x203)
+// StarMoney (RSC_NOTYPE + 0x210) bis (RSC_NOTYPE + 0x22F)
+// Public (RSC_NOTYPE + 0x300) bis (RSC_NOTYPE + 0x3FF)
+
+//========== S F X =======================================
+enum SfxStyleFamily { SFX_STYLE_FAMILY_CHAR = 1,
+ SFX_STYLE_FAMILY_PARA = 2,
+ SFX_STYLE_FAMILY_FRAME = 4,
+ SFX_STYLE_FAMILY_PAGE = 8,
+ SFX_STYLE_FAMILY_PSEUDO = 16,
+ SFX_STYLE_FAMILY_ALL = 0x7fff
+ };
+
+
+// SfxTemplateDialog
+#define RSC_SFX_STYLE_ITEM_LIST 0x1
+#define RSC_SFX_STYLE_ITEM_BITMAP 0x2
+#define RSC_SFX_STYLE_ITEM_TEXT 0x4
+#define RSC_SFX_STYLE_ITEM_HELPTEXT 0x8
+#define RSC_SFX_STYLE_ITEM_STYLEFAMILY 0x10
+#define RSC_SFX_STYLE_ITEM_IMAGE 0x20
+
+
+// SfxSlotInfo
+#define RSC_SFX_SLOT_INFO_SLOTNAME 0x1
+#define RSC_SFX_SLOT_INFO_HELPTEXT 0x2
+
+
+#endif
diff --git a/rsc/inc/rscstr.hxx b/rsc/inc/rscstr.hxx
new file mode 100644
index 000000000000..72be37d459a3
--- /dev/null
+++ b/rsc/inc/rscstr.hxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscstr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rscstr.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.12 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.11 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.10 1997/08/27 18:18:12 MM
+ neue Headerstruktur
+
+
+ Rev 1.9 27 Aug 1997 18:18:12 MM
+ neue Headerstruktur
+
+ Rev 1.8 12 Sep 1996 12:44:56 MM
+ Eigene Ressourcen definieren
+
+ Rev 1.7 21 Nov 1995 19:49:08 TLX
+ Neuer Link
+
+ Rev 1.6 12 Jan 1994 15:18:22 mm
+ Alignementprobleme und Warnings fuer DEC-Alpha beseitigt
+
+ Rev 1.5 25 Aug 1993 15:34:30 mm
+ Fehler und Warnings beseitigt
+
+ Rev 1.4 04 Feb 1993 17:38:44 mm
+ GetClassType Fehler verbessert und keine Inline -ctor.
+
+ Rev 1.3 03 Feb 1993 15:03:08 mm
+ GetClassType() implementiert
+
+ Rev 1.2 05 Jan 1993 10:50:44 mm
+ Neues Default verhalten
+
+ Rev 1.1 23 Dec 1992 14:02:40 mm
+ Sprachaenderung
+
+ Rev 1.0 10 Aug 1992 07:14:14 MM
+ Initial revision.
+
+ Rev 1.11 23 Mar 1992 15:24:20 MM
+
+ Rev 1.10 16 Jan 1992 12:48:06 MM
+ IsVarDefault
+**************************************************************************/
+
+#ifndef _RSCSTR_HXX
+#define _RSCSTR_HXX
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+
+/******************* R s c S t r i n g ***********************************/
+class RscString : public RscTop
+{
+ RscTop * pRefClass;
+ struct RscStringInst {
+ char * pStr; // Zeiger auf String
+ BOOL bDflt; // Ist Default
+ RscId aRefId; // ReferenzName
+ };
+ USHORT nSize;
+public:
+ RscString( HASHID nId, USHORT nTypId );
+ virtual RSCCLASS_TYPE GetClassType() const;
+
+ void SetRefClass( RscTop * pClass )
+ {
+ pRefClass = pClass;
+ };
+ RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL );
+ // Der zulaessige Bereich wird gesetzt
+ void Destroy( const RSCINST & rInst );
+ USHORT Size(){ return nSize; }
+ void SetToDefault( const RSCINST & rInst )
+ {
+ ((RscStringInst*)rInst.pData)->bDflt = TRUE;
+ }
+ BOOL IsDefault( const RSCINST & rInst)
+ {
+ return( ((RscStringInst*)rInst.pData)->bDflt );
+ };
+ // Als Default setzen
+ BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+ ERRTYPE SetString( const RSCINST &, char * pStr );
+ ERRTYPE GetString( const RSCINST &, char ** ppStr );
+ ERRTYPE GetRef( const RSCINST & rInst, RscId * );
+ ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId );
+ void WriteSrc( const RSCINST &, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * );
+ ERRTYPE WriteRc( const RSCINST &, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT, BOOL bExtra );
+ virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+};
+
+#endif // _RSCSTR_HXX
diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx
new file mode 100644
index 000000000000..d5545699b017
--- /dev/null
+++ b/rsc/inc/rsctools.hxx
@@ -0,0 +1,246 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsctools.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsctools.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.16 2000/09/17 12:51:09 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.15 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.14 2000/07/11 16:59:41 th
+ Unicode
+
+ Revision 1.13 1999/09/20 17:25:29 pl
+ PutAt mit short
+
+ Revision 1.12 1999/09/08 11:47:39 mm
+ BigEndian/LittleEndian corrected
+
+**************************************************************************/
+struct RSHEADER_TYPE;
+class RscPtrPtr;
+
+#ifndef _RSCTOOLS_HXX
+#define _RSCTOOLS_HXX
+
+#ifdef UNX
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#ifndef _LIST_HXX //autogen
+#include <tools/list.hxx>
+#endif
+
+/******************* T y p e s *******************************************/
+#define HASH_NONAME 0xFFFF //not an entry in hashtabel
+typedef USHORT HASHID; // Definition von HASHID
+// Zeichensatz
+enum COMPARE { LESS = -1, EQUAL = 0, GREATER = 1 };
+
+enum RSCBYTEORDER_TYPE { RSC_BIGENDIAN, RSC_LITTLEENDIAN, RSC_SYSTEMENDIAN };
+
+/******************* M A K R O S *****************************************/
+#define ALIGNED_SIZE( nSize ) \
+ (nSize + sizeof( void * ) -1) / sizeof( void * ) * sizeof( void * )
+/******************* F u n c t i o n F o r w a r d s *******************/
+ByteString GetTmpFileName();
+BOOL Append( ByteString aDestFile, ByteString aSourceFile );
+BOOL Append( FILE * fDest, ByteString aSourceFile );
+ByteString InputFile ( char * pInput, char * pExt );
+ByteString OutputFile( ByteString aInput, char * ext );
+char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv,
+ USHORT nArgc );
+void RscExit( USHORT nExit );
+
+/********* A n s i - F u n c t i o n F o r w a r d s *******************/
+int rsc_strnicmp( const char *string1, const char *string2, size_t count );
+int rsc_stricmp( const char *string1, const char *string2 );
+
+/****************** C L A S S E S ****************************************/
+DECLARE_LIST( RscStrList, ByteString * )
+/*********** R s c C h a r ***********************************************/
+class RscChar
+{
+public:
+ static char * MakeUTF8( char * pStr, UINT16 nTextEncoding );
+ static char * MakeUTF8FromL( char * pStr );
+};
+
+/*********** R s c M e m *************************************************/
+class RscMem
+{
+public:
+ static void * Malloc( USHORT nSize );
+ static void * Realloc( void * pMem, USHORT nSize );
+ static char * Realloc( char * pMem, USHORT nSize ){
+ return (char *)Realloc( (void *)pMem, nSize );
+ }
+ static void Free( void * pMem );
+ static void Free( char * pMem ){
+ Free( (void *)pMem );
+ }
+ static char * Assignsw( const char *psw, short nExtraSpace );
+};
+
+/****************** R s c P t r P t r ************************************/
+class RscPtrPtr
+{
+ USHORT nCount;
+ void ** pMem;
+public:
+ RscPtrPtr();
+ ~RscPtrPtr();
+ void Reset();
+ USHORT Append( void * );
+ USHORT Append( char * pStr ){
+ return( Append( (void *)pStr ) );
+ };
+ USHORT GetCount(){ return( nCount ); };
+ void * GetEntry( USHORT nEle );
+ void ** GetBlock(){ return( pMem ); };
+};
+
+/****************** R s c W r i t e R c **********************************/
+class RscWriteRc
+{
+ USHORT nLen;
+ BOOL bSwap;
+ RSCBYTEORDER_TYPE nByteOrder;
+ char * pMem;
+ char * GetPointer( USHORT nSize );
+public:
+ RscWriteRc( RSCBYTEORDER_TYPE nOrder = RSC_SYSTEMENDIAN );
+ ~RscWriteRc();
+ USHORT IncSize( USHORT nSize );// gibt die vorherige Groesse
+ void * GetBuffer()
+ {
+ return GetPointer( 0 );
+ }
+ USHORT GetShort( USHORT nPos )
+ {
+ return bSwap ? SWAPSHORT( *(USHORT*)(GetPointer(nPos)) ) : *(USHORT*)(GetPointer(nPos));
+ }
+ char * GetUTF8( USHORT nPos )
+ {
+ return GetPointer( nPos );
+ }
+
+
+ RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
+ USHORT Size(){ return( nLen ); };
+ //void Put( void * pData, USHORT nSize );
+ void Put( INT32 lVal )
+ {
+ if( bSwap )
+ {
+ Put( *(((USHORT*)&lVal) +1) );
+ Put( *(USHORT*)&lVal );
+ }
+ else
+ {
+ Put( *(USHORT*)&lVal );
+ Put( *(((USHORT*)&lVal) +1) );
+ }
+ }
+ void Put( UINT32 nValue )
+ { Put( (INT32)nValue ); }
+ void Put( USHORT nValue );
+ void Put( short nValue )
+ { Put( (USHORT)nValue ); }
+ void PutUTF8( char * pData );
+
+ void PutAt( USHORT nPos, INT32 lVal )
+ {
+ if( bSwap )
+ {
+ PutAt( nPos, *(((USHORT*)&lVal) +1) );
+ PutAt( nPos + 2, *(USHORT*)&lVal );
+ }
+ else
+ {
+ PutAt( nPos, *(USHORT*)&lVal );
+ PutAt( nPos + 2, *(((USHORT*)&lVal) +1) );
+ }
+ }
+ void PutAt( USHORT nPos, short nVal )
+ {
+ PutAt( nPos, (USHORT)nVal );
+ }
+ void PutAt( USHORT nPos, USHORT nVal )
+ {
+ *(USHORT *)(GetPointer( nPos )) = bSwap ? SWAPSHORT( nVal ) : nVal;
+ }
+};
+
+#endif // _RSCTOOLS_HXX
diff --git a/rsc/inc/rsctop.hxx b/rsc/inc/rsctop.hxx
new file mode 100644
index 000000000000..4dd365c04bc2
--- /dev/null
+++ b/rsc/inc/rsctop.hxx
@@ -0,0 +1,297 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsctop.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsctop.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+**************************************************************************/
+
+#ifndef _RSCTOP_HXX
+#define _RSCTOP_HXX
+
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCCLOBJ_HXX
+#include <rscclobj.hxx>
+#endif
+
+/****************** T Y P E S ********************************************/
+typedef short RSCVAR;
+#define VAR_POINTER 0x0001
+#define VAR_HIDDEN 0x0002
+#define VAR_NODATAINST 0x0004
+#define VAR_NORC 0x0008
+#define VAR_SVDYNAMIC 0x0010
+#define VAR_NOENUM 0x0020
+#define VAR_EXTENDABLE 0x0040 /* Auch die Ableitung einer Klasse kann angegeben werden */
+
+/****************** C L A S S E S ****************************************/
+/******************* R s c C l a s s *************************************/
+class RscTop : public RefNode
+{
+ RscTop * pSuperClass;
+ RSCINST aDfltInst;
+ USHORT nTypId;
+ RscTop * pRefClass;
+
+protected:
+ RscTop( HASHID nId, USHORT nTypIdent,
+ RscTop * pSuperCl = NULL );
+
+public:
+ ByteString aCallPar1; // Klassenaufruf ohne Typen bis ResId
+ ByteString aCallPar2; // Klassenaufruf ohne Typen ab ResId
+ ByteString aCallParType; // Klassenaufruf mit Typen
+
+ void SetSuperClass( RscTop * pClass )
+ {
+ pSuperClass = pClass;
+ }
+ RscTop* GetSuperClass() const
+ { return pSuperClass; }
+ // Gibt den Typidentifier zurueck
+ USHORT GetTypId() const
+ { return nTypId; };
+ // Gibt die Oberklasse zurueck
+ BOOL InHierarchy( RscTop * pClass );
+ BOOL IsCodeWriteable() const
+ {
+ return( 0 != aCallParType.Len() );
+ }
+ void SetCallPar( const ByteString & rPar1, const ByteString & rPar2,
+ const ByteString & rParType );
+ void SetRefClass( RscTop * pRef ) { pRefClass = pRef; }
+ RscTop* GetRefClass() const { return pRefClass; }
+ virtual RSCCLASS_TYPE GetClassType() const = 0;
+ RSCINST GetDefault();
+
+ // Vorbereitung auf den dtor aufruf
+ // Da die Klassen gegenseitige Abhaengigkeiten
+ // aufweisen koennen, kann man im dtor nicht davon
+ // ausgehen, dass alle Klassenzeiger noch gueltig sind
+ virtual void Pre_dtor();
+
+ virtual HASHID GetConstant( USHORT );
+
+ virtual RscTop * GetTypeClass() const;
+
+ // Gibt die Groesse der Klasse in Bytes
+ virtual USHORT Size();
+
+ // Gibt die Referenz zurueck
+ virtual ERRTYPE GetRef( const RSCINST & rInst, RscId * );
+
+ // Gibt die Referenz zurueck
+ virtual ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId );
+
+ // Variable anlegen
+ virtual ERRTYPE SetVariable( HASHID nVarName, RscTop * pClass,
+ RSCINST * pDflt = NULL,
+ RSCVAR nVarType = 0, USHORT nMask = 0,
+ HASHID nDataBaseName = HASH_NONAME );
+
+ // Zaehlt alle Variablen auf
+ virtual void EnumVariables( void * pData, VarEnumCallbackProc );
+
+ // Liefert Instanz der Variablen zurueck
+ // pData, pClass im return koennen NULL sein
+ virtual RSCINST GetVariable( const RSCINST & rInst, HASHID nVarName,
+ const RSCINST & rInitInst,
+ BOOL nInitDflt = FALSE,
+ RscTop * pCreateClass = NULL );
+ virtual RSCINST GetCopyVar( const RSCINST & rInst, HASHID nVarName );
+
+ virtual RSCINST GetTupelVar( const RSCINST & rInst, USHORT nPos,
+ const RSCINST & rInitInst );
+
+ // Liefert Instanz aus einem Feld zurueck
+ // pGetInst im return kann NULL sein
+ virtual ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName,
+ RscTop *pCreateClass, const RSCINST & rCreateInst,
+ RSCINST * pGetInst );
+
+ // Liefert Instanz aus einem Feld zurueck
+ // pGetInst im return kann NULL sein
+ virtual ERRTYPE GetValueEle( const RSCINST & rInst, long lValue,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst );
+
+ // Liefert Instanz aus einem Feld zurueck
+ // pGetInst im return kann NULL sein
+ virtual ERRTYPE GetArrayEle( const RSCINST & rInst, HASHID nId,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst );
+
+ virtual RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pClass );
+
+ // Liefert Instanz an der Position zurueck
+ virtual RSCINST GetPosEle( const RSCINST & rInst, USHORT nPos );
+
+ // verschiebt eine Instanz
+ virtual ERRTYPE MovePosEle( const RSCINST & rInst, USHORT nDestPos,
+ USHORT nSourcePos );
+
+ // aendert RscId an Position
+ virtual ERRTYPE SetPosRscId( const RSCINST & rInst, USHORT nPos,
+ const RscId & rRscId);
+
+ // Liefert Information ueber Instanz
+ // an der Position zurueck
+ virtual SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, USHORT nPos );
+
+ // Anzahl der Eintraege
+ virtual USHORT GetCount( const RSCINST & rInst );
+
+ // Eine Zuweisung an eine Variable
+ virtual ERRTYPE SetNumber( const RSCINST & rInst, long lValue );
+
+ // Eine Zuweisung an eine Variable
+ virtual ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue );
+
+ // Eine Zuweisung an eine Variable
+ virtual ERRTYPE SetConst( const RSCINST & rInst, HASHID nValueId,
+ long nValue );
+
+ // Eine Zuweisung an eine Variable
+ virtual ERRTYPE SetNotConst( const RSCINST & rInst, HASHID nId );
+
+ virtual ERRTYPE SetString( const RSCINST & rInst, char * pStr );
+
+ virtual ERRTYPE GetNumber( const RSCINST & rInst, long * pN );
+
+ virtual ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB );
+
+ virtual ERRTYPE GetConst( const RSCINST & rInst, HASHID * pH );
+
+ virtual ERRTYPE GetString( const RSCINST & rInst, char ** ppStr );
+
+ virtual RSCINST Create( RSCINST * pInst,
+ const RSCINST & rDefInst, BOOL bOwnClass = FALSE );
+
+ // Instanz zerstoeren
+ virtual void Destroy( const RSCINST & rInst );
+
+ // prueft auf konsistenz
+ virtual BOOL IsConsistent( const RSCINST & rInst,
+ RscInconsList * pList = NULL );
+
+ // Alles auf Default setzen
+ virtual void SetToDefault( const RSCINST & rInst );
+
+ // Ist Eingabe = Default
+ virtual BOOL IsDefault( const RSCINST & rInst );
+
+ // Gleiche Werte auf Default setzen
+ virtual BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
+
+ // Instanz auf Default setzen
+ virtual void SetDefault( const RSCINST & rInst, HASHID nVarId );
+
+ // Default zu einer Variablen holen
+ virtual RSCINST GetDefault( HASHID nVarId );
+
+ virtual void Delete( const RSCINST & rInst, RscTop * pClass,
+ const RscId & rId );
+
+ virtual void DeletePos( const RSCINST & rInst, USHORT nPos );
+
+ // Schreibt den Kopf und das Ende einer Resource
+ // Script Datei
+ virtual void WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & aId, const char * );
+ virtual void WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,const char * );
+ virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, const RscId & aId,
+ USHORT nDeep, BOOL bExtra );
+ virtual ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra );
+
+ // Weiterleitung an Superklassen wird unterbunden
+ virtual ERRTYPE WriteHxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId );
+ virtual ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId &rId );
+ virtual ERRTYPE WriteCxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId &rId );
+ virtual ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId &rId );
+
+ void WriteSyntaxHeader( FILE * fOutput, RscTypCont * pTC );
+ virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC );
+
+ virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
+ const char * );
+ virtual void WriteRcCtor( FILE * fOutput, RscTypCont * pTC );
+};
+
+#endif //_RSCTOP_HXX
diff --git a/rsc/inc/rsctree.hxx b/rsc/inc/rsctree.hxx
new file mode 100644
index 000000000000..2fb07b9b4e6b
--- /dev/null
+++ b/rsc/inc/rsctree.hxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsctree.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/inc/rsctree.hxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.8 2000/09/17 12:51:10 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.7 2000/07/26 17:13:17 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.6 2000/07/11 17:01:09 th
+ Unicode
+
+ Revision 1.5 1997/08/27 18:18:02 MM
+ neue Headerstruktur
+
+**************************************************************************/
+
+#ifndef _RSCTREE_HXX
+#define _RSCTREE_HXX
+
+#ifndef _LINK_HXX
+#include <tools/link.hxx>
+#endif
+
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+
+/****************** C L A S S E S ****************************************/
+class BiNode
+{
+protected:
+ BiNode* pLeft; // left subtree
+ BiNode* pRight; // right subtree
+
+public:
+
+ // Wandelt eine doppelt verkettete Liste in
+ // einen binaeren Baum um
+ BiNode * ChangeDLListBTree( BiNode * pList );
+
+ BiNode();
+ virtual ~BiNode();
+
+
+ // Wandelt einen binaeren Baum in eine doppelt
+ // verkettete Liste um
+ BiNode* ChangeBTreeDLList();
+
+ BiNode * Left() const { return pLeft ; };
+ BiNode * Right() const{ return pRight ; };
+ void EnumNodes( Link aLink ) const;
+};
+
+/*************************************************************************/
+class NameNode : public BiNode
+{
+ void SubOrderTree( NameNode * pOrderNode );
+
+protected:
+ // pCmp ist Zeiger auf Namen
+ NameNode* Search( const void * pCmp ) const;
+
+public:
+ NameNode* Left() const { return (NameNode *)pLeft ; };
+ NameNode* Right() const{ return (NameNode *)pRight ; };
+ NameNode* Search( const NameNode * pName ) const;
+ // insert a new node in the b-tree
+ BOOL Insert( NameNode * pTN, USHORT * nDepth );
+ BOOL Insert( NameNode* pTN );
+ virtual COMPARE Compare( const NameNode * ) const;
+ virtual COMPARE Compare( const void * ) const;
+ NameNode* SearchParent( const NameNode * ) const;
+ // return ist neue Root
+ NameNode* Remove( NameNode * );
+ void OrderTree();
+ BOOL IsOrderTree() const;
+
+};
+
+/*************************************************************************/
+class IdNode : public NameNode
+{
+ virtual COMPARE Compare( const NameNode * ) const;
+ virtual COMPARE Compare( const void * ) const;
+
+public:
+
+ IdNode* Search( USHORT nTypName ) const;
+ virtual USHORT GetId() const;
+};
+
+/*************************************************************************/
+class StringNode : public NameNode
+{
+ virtual COMPARE Compare( const NameNode * ) const;
+ virtual COMPARE Compare( const void * ) const;
+
+protected:
+ ByteString aName;
+
+public:
+ StringNode(){};
+ StringNode( const ByteString & rStr ) { aName = rStr; }
+
+ StringNode* Search( const char * ) const;
+ ByteString GetName() const { return aName; }
+};
+
+#endif // _RSCTREE_HXX
diff --git a/rsc/prj/d.lst b/rsc/prj/d.lst
new file mode 100644
index 000000000000..0d6fb9eacab7
--- /dev/null
+++ b/rsc/prj/d.lst
@@ -0,0 +1,7 @@
+..\%__SRC%\bin\rsc.exe %_DEST%\bin%_EXT%\rsc.exe
+..\%__SRC%\bin\rsc2.exe %_DEST%\bin%_EXT%\rsc2.exe
+..\%__SRC%\bin\rsc %_DEST%\bin%_EXT%\rsc
+..\%__SRC%\bin\rsc2 %_DEST%\bin%_EXT%\rsc2
+
+mkdir: %_DEST%\inc%_EXT%\rsc
+hedabu: ..\inc\rscsfx.hxx %_DEST%\inc%_EXT%\rsc\rscsfx.hxx
diff --git a/rsc/source/misc/makefile.mk b/rsc/source/misc/makefile.mk
new file mode 100644
index 000000000000..3deeb7780924
--- /dev/null
+++ b/rsc/source/misc/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=rsc
+TARGET=rscmis
+
+# --- Settings ------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files ---------------------------------------------------------
+
+CXXFILES= rsclst.cxx \
+ rscdbl.cxx
+
+OBJFILES= $(OBJ)$/rsclst.obj \
+ $(OBJ)$/rscdbl.obj
+
+.INCLUDE : target.mk
diff --git a/rsc/source/misc/rscdbl.cxx b/rsc/source/misc/rscdbl.cxx
new file mode 100644
index 000000000000..ec47846ac826
--- /dev/null
+++ b/rsc/source/misc/rscdbl.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscdbl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCTREE_HXX
+#include <rsctree.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+#ifndef _RSCLST_HXX
+#include "rsclst.hxx"
+#endif
+
+/*************************************************************************
+|*
+|* RscTypCont::FillNameIdList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.05.91
+|* Letzte Aenderung MM 30.05.91
+|*
+*************************************************************************/
+REResourceList * InsertList( HASHID nClassName, const RscId& rId,
+ REResourceList * pList ){
+ REResourceList * pSubList;
+ char * pStrClass;
+ ByteString aStrClass;
+
+ pStrClass = pHS->Get( nClassName );
+ if( pStrClass )
+ aStrClass = pStrClass;
+ else
+ aStrClass = ByteString::CreateFromInt32( (long)nClassName );
+
+ pSubList = new REResourceList( pList, aStrClass, rId );
+
+ pList->Insert( pSubList, 0xFFFF );
+ return( pSubList );
+}
+
+void FillSubList( RSCINST & rInst, REResourceList * pList ){
+ USHORT nCount, i;
+ SUBINFO_STRUCT aInfo;
+ REResourceList* pSubList;
+ RSCINST aTmpI;
+
+ nCount = rInst.pClass->GetCount( rInst );
+ for( i = 0; i < nCount; i++ ){
+ aInfo = rInst.pClass->GetInfoEle( rInst, i );
+ aTmpI = rInst.pClass->GetPosEle( rInst, i );
+ pSubList = InsertList( aInfo.pClass->GetId(),
+ aInfo.aId, pList );
+ FillSubList( aTmpI, pSubList );
+ };
+}
+
+void FillListObj( ObjNode * pObjNode, RscTop * pRscTop,
+ REResourceList * pList, ULONG lFileKey )
+{
+ if( pObjNode ){
+ if( pObjNode->GetFileKey() == lFileKey ){
+ RSCINST aTmpI;
+ REResourceList* pSubList;
+
+ FillListObj( (ObjNode*)pObjNode->Left(), pRscTop,
+ pList, lFileKey );
+
+ pSubList = InsertList( pRscTop->GetId(),
+ pObjNode->GetRscId(), pList );
+
+ aTmpI.pClass = pRscTop;
+ aTmpI.pData = pObjNode->GetRscObj();
+ FillSubList( aTmpI, pSubList );
+
+ FillListObj( (ObjNode*)pObjNode->Right(), pRscTop,
+ pList, lFileKey );
+ }
+ };
+}
+
+void FillList( RscTop * pRscTop, REResourceList * pList, ULONG lFileKey ){
+ if( pRscTop ){
+ FillList( (RscTop*)pRscTop->Left(), pList, lFileKey );
+
+ FillListObj( pRscTop->GetObjNode(), pRscTop, pList, lFileKey );
+
+ FillList( (RscTop*)pRscTop->Right(), pList, lFileKey );
+ };
+}
+
+void RscTypCont::FillNameIdList( REResourceList * pList, ULONG lFileKey ){
+ FillList( pRoot, pList, lFileKey );
+}
diff --git a/rsc/source/misc/rsclst.cxx b/rsc/source/misc/rsclst.cxx
new file mode 100644
index 000000000000..a172097a031f
--- /dev/null
+++ b/rsc/source/misc/rsclst.cxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsclst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "rsclst.hxx"
+
+REResourceList :: REResourceList()
+{
+ bVisible = FALSE;
+ pParent = NULL;
+}
+
+REResourceList :: REResourceList( REResourceList* pParentList,
+ ByteString& rClassName,
+ const RscId & rResourceID, BOOL bVis )
+{
+ pParent = pParentList;
+ aClassName = rClassName;
+ aRscId = rResourceID;
+ bVisible = bVis;
+}
+
+REResourceList :: ~REResourceList()
+{
+}
diff --git a/rsc/source/parser/erscerr.cxx b/rsc/source/parser/erscerr.cxx
new file mode 100644
index 000000000000..1a0453dca865
--- /dev/null
+++ b/rsc/source/parser/erscerr.cxx
@@ -0,0 +1,512 @@
+/*************************************************************************
+ *
+ * $RCSfile: erscerr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/erscerr.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+************************************************************************/
+#pragma hdrstop
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <tools/rcid.h>
+
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCPAR_HXX
+#include <rscpar.hxx>
+#endif
+
+#include "rsclex.hxx"
+
+/*************************************************************************
+|*
+|* ERRTYPE::operator = ;
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.09.91
+|* Letzte Aenderung MM 25.09.91
+|*
+*************************************************************************/
+ERRTYPE& ERRTYPE::operator = ( const ERRTYPE & rError )
+{
+ if( !IsError() ){
+ if( rError.IsError() || !IsWarning() )
+ nError = rError.nError;
+ }
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* RscError::StdOut();
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.05.91
+|* Letzte Aenderung MM 06.05.91
+|*
+*************************************************************************/
+void RscError::StdOut( const char * pStr )
+{
+#ifndef WIN
+ if( pStr ){
+ printf( "%s", pStr );
+ fflush( stdout );
+ }
+#endif
+}
+
+/*************************************************************************
+|*
+|* RscError::LstOut();
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.05.91
+|* Letzte Aenderung MM 06.05.91
+|*
+*************************************************************************/
+void RscError::LstOut( const char * pStr ){
+ if( fListing && pStr )
+ fprintf( fListing, "%s", pStr );
+}
+
+/*************************************************************************
+|*
+|* RscError::StdLstOut();
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.05.91
+|* Letzte Aenderung MM 06.05.91
+|*
+*************************************************************************/
+void RscError::StdLstOut( const char * pStr ){
+ StdOut( pStr );
+ LstOut( pStr );
+}
+
+/*************************************************************************
+|*
+|* RscError::WriteError();
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.05.91
+|* Letzte Aenderung MM 06.05.91
+|*
+*************************************************************************/
+void RscError::WriteError( const ERRTYPE& rError, const char * pMessage )
+{
+ switch( rError )
+ {
+ case ERR_ERROR: {
+ StdLstOut( "!! " );
+ if( 1 == nErrors )
+ StdLstOut( ByteString::CreateFromInt32( nErrors ).GetBuffer() );
+ else
+ StdLstOut( ByteString::CreateFromInt32( (USHORT)(nErrors -1) ).GetBuffer() );
+ StdLstOut( " Error" );
+ StdLstOut( " found!!" );
+ }
+ break;
+
+ case ERR_UNKNOWN_METHOD:
+ StdLstOut( "The used type is not allowed." );
+ break;
+
+ case ERR_OPENFILE:
+ StdLstOut( "This file <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> cannot be opened." );
+ break;
+
+ case ERR_FILESIZE:
+ StdLstOut( "Wrong file <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> length." );
+ break;
+
+ case ERR_FILEFORMAT:
+ StdLstOut( "Wrong file type <" );
+ StdLstOut( pMessage );
+ StdLstOut( ">." );
+ break;
+
+ case ERR_NOCHAR:
+ StdLstOut( "Character: '\\xxx'; The value xxx is greater than 255.");
+ break;
+
+ case ERR_NORSCINST:
+ StdLstOut( "Internal error, instance invalid.");
+ break;
+
+
+ case ERR_NOINPUT:
+ StdLstOut( "Input file was not specified.\n");
+ case ERR_USAGE:
+ StdLstOut( "Copyright (C) 1990-92 STAR DIVISION GmbH\n" );
+ {
+ char buf[40];
+
+ StdLstOut( "DataVersion: " );
+ sprintf( buf, "%d.%d\n\n",
+ RSCVERSION_ID / 100, RSCVERSION_ID % 100 );
+ StdLstOut( buf );
+ };
+
+ StdLstOut( "Command line: rsc [Switches] <Source File(s)>\n" );
+ StdLstOut( "Command line: rsc @<Command File>\n" );
+ StdLstOut( "-h shows this help.\n" );
+ StdLstOut( "-p No Preprocessor.\n" );
+ StdLstOut( "-s Syntax analysis, creates .srs file\n");
+ StdLstOut( "-l Linker, links files created with rsc -s,\n" );
+ StdLstOut( " creates .rc file and .res file.\n" );
+ StdLstOut( "-r Prevents .res file.\n" );
+ StdLstOut( "-d Symbol definitions for the Preprocessor.\n" );
+ StdLstOut( "-i Include directives for the Preprocessor.\n" );
+ StdLstOut( "-presponse Use response file for Preprocessor.\n" );
+ StdLstOut( "-lg<language> Use a different language.\n" );
+ StdLstOut( "-pp<filename> Use a different Preprocessor.\n" );
+ StdLstOut( "-rc<filename> Use a different system resource compiler.\n" );
+ StdLstOut( "-fo<filename> Renaming of the .res file.\n" );
+ StdLstOut( "-fs<filename> Renaming of the .rc file.\n" );
+ StdLstOut( "-fp<filename> Renaming of the .srs file.\n" );
+ StdLstOut( "-fl<filename> Listing file.\n" );
+ StdLstOut( "-fh<filename> Header file.\n" );
+ StdLstOut( "-fc<filename> Code file.\n" );
+ StdLstOut( "-CHARSET_... Convert to this character set.\n" );
+ StdLstOut( "-BIGENDIAN Format of number values.\n" );
+ StdLstOut( "-LITTLEENDIAN Format of number values.\n" );
+ StdLstOut( "-SMART Generate smart names (cxx, hxx).\n" );
+ StdLstOut( "-SrsDefault Only write one language to srs file.\n" );
+ break;
+
+ case ERR_UNKNOWNSW:
+ StdLstOut( "Unknown switch <" );
+ StdLstOut( pMessage );
+ StdLstOut( ">." );
+ break;
+
+ case ERR_REFTODEEP:
+ StdLstOut( "Too many reference levels have been used (see Switch -RefDeep)." );
+ break;
+
+ case ERR_CONT_INVALIDPOS:
+ StdLstOut( "Internal error, Container class: invalid position." );
+ break;
+
+ case ERR_CONT_INVALIDTYPE:
+ StdLstOut( "Invalid type <" );
+ StdLstOut( pMessage );
+ StdLstOut( ">." );
+ break;
+
+ case ERR_ARRAY_INVALIDINDEX:
+ StdLstOut( "Internal error, Array class: invalid index." );
+ break;
+
+ case ERR_RSCINST_NOVARNAME:
+ StdLstOut( "Internal error, invalid name of variable." );
+ break;
+
+ case ERR_YACC:
+ StdLstOut( pMessage );
+ break;
+
+ case ERR_DOUBLEID:
+ StdLstOut( "Two global resources have the same identifier." );
+ break;
+
+ case ERR_FALSETYPE:
+ StdLstOut( "Wrong type <" );
+ StdLstOut( pMessage );
+ StdLstOut( ">." );
+ break;
+
+ case ERR_NOVARIABLENAME:
+ StdLstOut( "The variable <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> must not be used here." );
+ break;
+
+ case ERR_RSCRANGE_OUTDEFSET:
+ StdLstOut( "The used value is not in the expected domain." );
+ break;
+
+ case ERR_USHORTRANGE:
+ StdLstOut( "Value is <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> the allowed domain is from 0 up to 65535." );
+ break;
+
+ case ERR_IDRANGE:
+ StdLstOut( "Value is <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> the allowed domain is from 1 up to 32767." );
+ break;
+
+ case ERR_NOCOPYOBJ:
+ StdLstOut( "Default resource <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> not found." );
+ break;
+
+ case ERR_REFNOTALLOWED:
+ StdLstOut( "The use of a reference is not allowed." );
+ break;
+
+ case ERR_COPYNOTALLOWED:
+ StdLstOut( "The use of a default resource is not allowed." );
+ break;
+
+ case ERR_IDEXPECTED:
+ StdLstOut( "An identifier needs to be specified." );
+ break;
+
+ case ERR_DOUBLEDEFINE:
+ StdLstOut( "The symbol <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> is defined twice." );
+ break;
+
+ case ERR_RSCINST_RESERVEDNAME:
+ StdLstOut( "The symbol <" );
+ StdLstOut( pMessage );
+ StdLstOut( "> is a reserved name." );
+ break;
+
+ case ERR_ZERODIVISION:
+ StdLstOut( "Attempt to divide by zero." );
+ break;
+
+ case ERR_PRAGMA:
+ StdLstOut( "Error in a #pragma statement." );
+ break;
+
+ case ERR_DECLAREDEFINE:
+ StdLstOut( "Error in the declaration part of the macro." );
+ break;
+
+ case ERR_NOTYPE:
+ StdLstOut( "type expected." );
+ break;
+
+/****************** W A R N I N G S **************************************/
+ case WRN_LOCALID:
+ StdLstOut( "Sub resources should have an identifier < 256." );
+ break;
+
+ case WRN_GLOBALID:
+ StdLstOut( "Global resources should have an identifier >= 256." );
+ break;
+
+ case WRN_SUBINMEMBER:
+ StdLstOut( "Sub resources are ignored." );
+ break;
+
+ case WRN_CONT_NOID:
+ StdLstOut( "Resources without name are ignored." );
+ break;
+
+ case WRN_CONT_DOUBLEID:
+ StdLstOut( "Two local resources have the same identifier." );
+ break;
+
+ case WRN_STR_REFNOTFOUND:
+ StdLstOut( "String reference <" );
+ StdLstOut( pMessage );
+ StdLstOut( " > could not be resolved." );
+ break;
+
+ case WRN_MGR_REFNOTFOUND:
+ StdLstOut( "Reference <" );
+ StdLstOut( pMessage );
+ StdLstOut( " > could not be resolved." );
+ break;
+
+ default:
+ if( pMessage ){
+ StdLstOut( "\nMessage: " );
+ StdLstOut( pMessage );
+ };
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* RscErrorFormat()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.05.91
+|* Letzte Aenderung MM 06.05.91
+|*
+*************************************************************************/
+void RscError::ErrorFormat( const ERRTYPE& rError, RscTop * pClass,
+ const RscId & aId ){
+ char buf[ 10 ];
+ USHORT i;
+
+ if( pFI )
+ {
+ pFI->SetError( rError );
+ StdOut( "\n" );
+ StdOut( pFI->GetLine() );
+ StdOut( "\n" );
+ // Fehlerposition anzeigen
+ for( i = 0; (USHORT)(i +1) < pFI->GetScanPos(); i++ )
+ StdLstOut( " " );
+ LstOut( " ^" ); //Zeilennummern beachten
+ StdOut( "^" );
+ StdLstOut( "\n" );
+ }
+ StdLstOut( "f" );
+ sprintf( buf, "%u", (USHORT)rError );
+ StdLstOut( buf );
+
+ if( pFI && pTC ){
+ StdLstOut( ": \"" );
+ StdLstOut( pTC->aFileTab.Get( pFI->GetFileIndex() )->aFileName.GetBuffer() );
+ StdLstOut( "\", line " );
+ sprintf( buf, "%d", pFI->GetLineNo() );
+ StdLstOut( buf );
+ }
+
+ if( rError.IsError() )
+ StdLstOut( ": Error" );
+ else
+ StdLstOut( ": Warning" );
+
+ if( pClass || aId.IsId() )
+ {
+ StdLstOut( " in the object (" );
+ if( pClass )
+ {
+ StdLstOut( "Type: " );
+ StdLstOut( pHS->Get( pClass->GetId() ) );
+ if( aId.IsId() )
+ StdLstOut( ", " );
+ }
+ if( aId.IsId() )
+ StdLstOut( aId.GetName().GetBuffer() );
+ StdLstOut( "):\n" );
+ }
+ else
+ StdLstOut( ": " );
+}
+
+/*************************************************************************
+|*
+|* RscError::Error()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.05.91
+|* Letzte Aenderung MM 06.05.91
+|*
+*************************************************************************/
+void RscError::Error( const ERRTYPE& rError, RscTop * pClass,
+ const RscId & aId, const char * pMessage )
+{
+ if( WRN_LOCALID == (USHORT)rError ) // Keine Warning erzeugen
+ return;
+ if( rError.IsError() )
+ nErrors++;
+ if( rError.IsError() || rError.IsWarning() ){
+ ErrorFormat( rError, pClass, aId );
+ WriteError( rError, pMessage );
+ StdLstOut( "\n" );
+ };
+}
+
+/*************************************************************************
+|*
+|* RscError::FatalError();
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.05.91
+|* Letzte Aenderung MM 06.05.91
+|*
+*************************************************************************/
+void RscError::FatalError( const ERRTYPE& rError, const RscId &aId,
+ const char * pMessage )
+{
+ if( ERR_USAGE != (USHORT)rError ){
+ nErrors++;
+ ErrorFormat( rError, NULL, aId );
+ WriteError( rError, pMessage );
+ StdLstOut( "\nTerminating compiler\n" );
+ }
+ else
+ WriteError( rError, pMessage );
+
+ exit( 1 );
+}
+
diff --git a/rsc/source/parser/makefile.mk b/rsc/source/parser/makefile.mk
new file mode 100644
index 000000000000..a1563686ed64
--- /dev/null
+++ b/rsc/source/parser/makefile.mk
@@ -0,0 +1,111 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PROJECTPCH=parser
+PROJECTPCHSOURCE=parser
+PRJNAME=rsc
+TARGET=rscpar
+
+# --- Settings -----------------------------------------------------
+
+.IF "$(COM)"=="ICC"
+CFLAGS+= /O-
+.ENDIF
+
+#prjpch=T
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+YACCOUT=$(INCCOM)
+
+YACCTARGET= $(YACCOUT)$/rscyacc.yxx
+YACCFILES= rscyacc.y
+
+CXXFILES= rscpar.cxx \
+ rscyacc.cxx \
+ rsclex.cxx \
+ erscerr.cxx \
+ rsckey.cxx \
+ rscinit.cxx \
+ rscibas.cxx \
+ rscdb.cxx \
+ rscicpx.cxx \
+ parser.cxx
+
+OBJFILES= $(OBJ)$/rscpar.obj \
+ $(OBJ)$/rscyacc.obj \
+ $(OBJ)$/rsclex.obj \
+ $(OBJ)$/erscerr.obj \
+ $(OBJ)$/rsckey.obj \
+ $(OBJ)$/rscinit.obj \
+ $(OBJ)$/rscibas.obj \
+ $(OBJ)$/rscdb.obj \
+ $(OBJ)$/rscicpx.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/rsc/source/parser/parser.cxx b/rsc/source/parser/parser.cxx
new file mode 100644
index 000000000000..68da2c7d69b4
--- /dev/null
+++ b/rsc/source/parser/parser.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: parser.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#pragma hdrstop
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <tools/solar.h>
+#define RSC_COMPILER
+
+#include <rscall.h>
+#include <rsctools.hxx>
+#include <rschash.hxx>
+#include <rsckey.hxx>
+#include <rsctree.hxx>
+#include <rscerror.h>
+#include <rscdef.hxx>
+
+#include <rsctop.hxx>
+#include <rscmgr.hxx>
+#include <rscconst.hxx>
+#include <rscarray.hxx>
+#include <rscclass.hxx>
+#include <rsccont.hxx>
+#include <rscrange.hxx>
+#include <rscflag.hxx>
+#include <rscstr.hxx>
+
+#include <rscdb.hxx>
+#include <rscpar.hxx>
+
diff --git a/rsc/source/parser/parser.hxx b/rsc/source/parser/parser.hxx
new file mode 100644
index 000000000000..a70d723ca401
--- /dev/null
+++ b/rsc/source/parser/parser.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * $RCSfile: parser.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx
new file mode 100644
index 000000000000..bf92498609fb
--- /dev/null
+++ b/rsc/source/parser/rscdb.cxx
@@ -0,0 +1,1127 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscdb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/rscdb.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+*************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+#pragma hdrstop
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <tools/intn.hxx>
+#include <tools/fsys.hxx>
+#include <tools/rc.h>
+
+// Programmabhaengige Includes.
+#ifndef _RSCTREE_HXX
+#include <rsctree.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+#ifndef _RSCMGR_HXX
+#include <rscmgr.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+
+/*************************************************************************
+|*
+|* RscTypCont :: RscTypCont
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 22.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+RscTypCont :: RscTypCont( RscError * pErrHdl,
+ LanguageType nLangType,
+ RSCBYTEORDER_TYPE nOrder,
+ rtl_TextEncoding nSourceCharSet_,
+ const ByteString & rSearchPath,
+ USHORT nFlagsP )
+ : nLangTypeId( nLangType ),
+ nDfltLangTypeId( International::GetNeutralLanguage( nLangType ) ),
+ nByteOrder( nOrder ),
+ nSourceCharSet( nSourceCharSet_ ),
+ aSearchPath( rSearchPath ),
+ nFlags( nFlagsP ),
+ aBool( pHS->Insert( "BOOL" ), RSC_NOTYPE ),
+ aShort( pHS->Insert( "short" ), RSC_NOTYPE ),
+ aUShort( pHS->Insert( "USHORT" ), RSC_NOTYPE ),
+ aLong( pHS->Insert( "long" ), RSC_NOTYPE ),
+ aEnumLong( pHS->Insert( "enum_long" ), RSC_NOTYPE ),
+ aIdUShort( pHS->Insert( "IDUSHORT" ), RSC_NOTYPE ),
+ aIdNoZeroUShort( pHS->Insert( "IDUSHORT" ), RSC_NOTYPE ),
+ aNoZeroShort( pHS->Insert( "NoZeroShort" ), RSC_NOTYPE ),
+ a1to12Short( pHS->Insert( "MonthShort" ), RSC_NOTYPE ),
+ a0to23Short( pHS->Insert( "HourShort" ), RSC_NOTYPE ),
+ a1to31Short( pHS->Insert( "DayShort" ), RSC_NOTYPE ),
+ a0to59Short( pHS->Insert( "MinuteShort" ), RSC_NOTYPE ),
+ a0to99Short( pHS->Insert( "_0to59Short" ), RSC_NOTYPE ),
+ a0to9999Short( pHS->Insert( "YearShort" ), RSC_NOTYPE ),
+ aIdLong( pHS->Insert( "IDLONG" ), RSC_NOTYPE, TRUE ),
+ aString( pHS->Insert( "Chars" ), RSC_NOTYPE ),
+ aWinBits( pHS->Insert( "WinBits" ), RSC_NOTYPE, FALSE ),
+ aLangType( pHS->Insert( "LangEnum" ), RSC_NOTYPE ),
+ aLangString( pHS->Insert( "Lang_Chars" ), RSC_NOTYPE, &aString,
+ &aLangType, &nLangTypeId, &nDfltLangTypeId ),
+ aLangShort( pHS->Insert( "Lang_short" ), RSC_NOTYPE, &aShort,
+ &aLangType, &nLangTypeId, &nDfltLangTypeId )
+{
+ nUniqueId = 256;
+ nPMId = RSC_VERSIONCONTROL +1; //mindestens einen groesser
+ pEH = pErrHdl;
+ Init();
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: ~RscTypCont
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 22.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+void DestroyNode( RscTop * pRscTop, ObjNode * pObjNode ){
+ if( pObjNode ){
+ DestroyNode( pRscTop, (ObjNode*)pObjNode->Left() );
+ DestroyNode( pRscTop, (ObjNode*)pObjNode->Right() );
+
+ if( pObjNode->GetRscObj() ){
+ pRscTop->Destroy( RSCINST( pRscTop, pObjNode->GetRscObj() ) );
+ RscMem::Free( pObjNode->GetRscObj() );
+ }
+ delete pObjNode;
+ };
+}
+
+void DestroySubTrees( RscTop * pRscTop ){
+ if( pRscTop ){
+ DestroySubTrees( (RscTop*)pRscTop->Left() );
+
+ DestroyNode( pRscTop, pRscTop->GetObjNode() );
+
+ DestroySubTrees( (RscTop*)pRscTop->Right() );
+ };
+}
+
+void DestroyTree( RscTop * pRscTop ){
+ if( pRscTop ){
+ DestroyTree( (RscTop*)pRscTop->Left() );
+ DestroyTree( (RscTop*)pRscTop->Right() );
+
+ delete pRscTop;
+ };
+}
+
+void Pre_dtorTree( RscTop * pRscTop ){
+ if( pRscTop ){
+ Pre_dtorTree( (RscTop*)pRscTop->Left() );
+ Pre_dtorTree( (RscTop*)pRscTop->Right() );
+
+ pRscTop->Pre_dtor();
+ };
+}
+
+RscTypCont :: ~RscTypCont(){
+ RscTop * pRscTmp;
+ RscSysEntry * pSysEntry;
+
+ // Alle Unterbaeume loeschen
+ aVersion.pClass->Destroy( aVersion );
+ RscMem::Free( aVersion.pData );
+ DestroySubTrees( pRoot );
+
+ // Alle Klassen noch gueltig, jeweilige Instanzen freigeben
+ // BasisTypen
+ pRscTmp = aBaseLst.First();
+ while( pRscTmp ){
+ pRscTmp->Pre_dtor();
+ pRscTmp = aBaseLst.Next();
+ };
+ aBool.Pre_dtor();
+ aShort.Pre_dtor();
+ aUShort.Pre_dtor();
+ aIdUShort.Pre_dtor();
+ aIdNoZeroUShort.Pre_dtor();
+ aNoZeroShort.Pre_dtor();
+ aIdLong.Pre_dtor();
+ aString.Pre_dtor();
+ aWinBits.Pre_dtor();
+ aVersion.pClass->Pre_dtor();
+ // Zusammengesetzte Typen
+ Pre_dtorTree( pRoot );
+
+ // Klassen zerstoeren
+ delete aVersion.pClass;
+ DestroyTree( pRoot );
+
+ while( NULL != (pRscTmp = aBaseLst.Remove()) ){
+ delete pRscTmp;
+ };
+
+ while( NULL != (pSysEntry = aSysLst.Remove()) ){
+ delete pSysEntry;
+ };
+}
+
+//=======================================================================
+RscTop * RscTypCont::SearchType( HASHID nId )
+/* [Beschreibung]
+
+ Sucht eine Basistyp nId;
+*/
+{
+ if( nId == HASH_NONAME )
+ return NULL;
+
+#define ELSE_IF( a ) \
+ else if( a##.GetId() == nId ) \
+ return &a; \
+
+ if( aBool.GetId() == nId )
+ return &aBool;
+ ELSE_IF( aShort )
+ ELSE_IF( aUShort )
+ ELSE_IF( aLong )
+ ELSE_IF( aEnumLong )
+ ELSE_IF( aIdUShort )
+ ELSE_IF( aIdNoZeroUShort )
+ ELSE_IF( aNoZeroShort )
+ ELSE_IF( a1to12Short )
+ ELSE_IF( a0to23Short )
+ ELSE_IF( a1to31Short )
+ ELSE_IF( a0to59Short )
+ ELSE_IF( a0to99Short )
+ ELSE_IF( a0to9999Short )
+ ELSE_IF( aIdLong )
+ ELSE_IF( aString )
+ ELSE_IF( aWinBits )
+ ELSE_IF( aLangType )
+ ELSE_IF( aLangString )
+ ELSE_IF( aLangShort )
+
+ RscTop * pEle = aBaseLst.First();
+ while( pEle )
+ {
+ if( pEle->GetId() == nId )
+ return pEle;
+ pEle = aBaseLst.Next();
+ }
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: Search
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 22.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+RscTop * RscTypCont :: Search( HASHID nRT ){
+ return( (RscTop *)pRoot->Search( nRT ) );
+}
+
+CLASS_DATA RscTypCont :: Search( HASHID nRT, const RscId & rId ){
+ ObjNode *pObjNode;
+ RscTop *pRscTop;
+
+ if( NULL != (pRscTop = Search( nRT )) ){
+ if( NULL != (pObjNode = pRscTop->GetObjNode( rId )) ){
+ return( pObjNode->GetRscObj() );
+ }
+ }
+ return( (CLASS_DATA)0 );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: Delete()
+|*
+|* Beschreibung
+|* Ersterstellung MM 10.07.91
+|* Letzte Aenderung MM 10.07.91
+|*
+*************************************************************************/
+void RscTypCont :: Delete( HASHID nRT, const RscId & rId ){
+ ObjNode * pObjNode;
+ RscTop * pRscTop;
+
+ if( NULL != (pRscTop = Search( nRT )) ){
+ if( NULL != (pObjNode = pRscTop->GetObjNode()) ){
+ pObjNode = pObjNode->Search( rId );
+
+ if( pObjNode ){
+ //Objekt aus Baum entfernen
+ pRscTop->pObjBiTree =
+ (ObjNode *)pRscTop->pObjBiTree->Remove( pObjNode );
+
+ if( pObjNode->GetRscObj() ){
+ pRscTop->Destroy( RSCINST( pRscTop,
+ pObjNode->GetRscObj() ) );
+ RscMem::Free( pObjNode->GetRscObj() );
+ }
+ delete pObjNode;
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: PutSysName()
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 22.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+USHORT RscTypCont :: PutSysName( USHORT nRscTyp, char * pFileName,
+ USHORT nConst, USHORT nId, BOOL bFirst )
+{
+ RscSysEntry * pSysEntry;
+ BOOL bId1 = FALSE;
+
+ pSysEntry = aSysLst.First();
+ while( pSysEntry )
+ {
+ if( pSysEntry->nKey == 1 )
+ bId1 = TRUE;
+ if( !strcmp( pSysEntry->aFileName.GetBuffer(), pFileName ) )
+ if( pSysEntry->nRscTyp == nRscTyp
+ && pSysEntry->nTyp == nConst
+ && pSysEntry->nRefId == nId )
+ break;
+ pSysEntry = aSysLst.Next();
+ }
+
+ if ( !pSysEntry || (bFirst && !bId1) )
+ {
+ pSysEntry = new RscSysEntry;
+ pSysEntry->nKey = nUniqueId++;
+ pSysEntry->nRscTyp = nRscTyp;
+ pSysEntry->nTyp = nConst;
+ pSysEntry->nRefId = nId;
+ pSysEntry->aFileName = (const char*)pFileName;
+ if( bFirst && !bId1 )
+ {
+ pSysEntry->nKey = 1;
+ aSysLst.Insert( pSysEntry, (ULONG)0 );
+ }
+ else
+ aSysLst.Insert( pSysEntry, LIST_APPEND );
+ }
+
+ return pSysEntry->nKey;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: WriteInc
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 21.06.90
+|* Letzte Aenderung MM 21.06.90
+|*
+*************************************************************************/
+void RscTypCont :: WriteInc( FILE * fOutput, ULONG lFileKey )
+{
+ RscFile * pFName;
+
+ if( NOFILE_INDEX == lFileKey )
+ {
+ pFName = aFileTab.First();
+ while( pFName )
+ {
+ if( pFName && pFName->IsIncFile() )
+ {
+ fprintf( fOutput, "#include " );
+ fprintf( fOutput, "\"%s\"\n",
+ pFName->aFileName.GetBuffer() );
+ }
+ pFName = aFileTab.Next();
+ }
+ }
+ else
+ {
+ RscDepend * pDep;
+ RscFile * pFile;
+
+ pFName = aFileTab.Get( lFileKey );
+ if( pFName )
+ {
+ pDep = pFName->First();
+ while( pDep )
+ {
+ if( pDep->GetFileKey() != lFileKey )
+ {
+ pFile = aFileTab.GetFile( pDep->GetFileKey() );
+ if( pFile )
+ {
+ fprintf( fOutput, "#include " );
+ fprintf( fOutput, "\"%s\"\n",
+ pFile->aFileName.GetBuffer() );
+ }
+ }
+ pDep = pFName->Next();
+ };
+ };
+ };
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: Methoden die ueber all Knoten laufen
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 22.03.90
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+
+class RscEnumerateObj
+{
+friend class RscEnumerateRef;
+private:
+ ERRTYPE aError; // Enthaelt den ersten Fehler
+ RscTypCont* pTypCont;
+ FILE * fOutput; // AusgabeDatei
+ ULONG lFileKey; // Welche src-Datei
+ RscTop * pClass;
+
+ DECL_LINK( CallBackWriteRc, ObjNode * );
+ DECL_LINK( CallBackWriteSrc, ObjNode * );
+ DECL_LINK( CallBackWriteCxx, ObjNode * );
+ DECL_LINK( CallBackWriteHxx, ObjNode * );
+
+ ERRTYPE WriteRc( RscTop * pCl, ObjNode * pRoot )
+ {
+ pClass = pCl;
+ if( pRoot )
+ pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteRc ) );
+ return aError;
+ }
+ ERRTYPE WriteSrc( RscTop * pCl, ObjNode * pRoot ){
+ pClass = pCl;
+ if( pRoot )
+ pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteSrc ) );
+ return aError;
+ }
+ ERRTYPE WriteCxx( RscTop * pCl, ObjNode * pRoot ){
+ pClass = pCl;
+ if( pRoot )
+ pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteCxx ) );
+ return aError;
+ }
+ ERRTYPE WriteHxx( RscTop * pCl, ObjNode * pRoot ){
+ pClass = pCl;
+ if( pRoot )
+ pRoot->EnumNodes( LINK( this, RscEnumerateObj, CallBackWriteHxx ) );
+ return aError;
+ }
+public:
+ void WriteRcFile( RscWriteRc & rMem, FILE * fOutput );
+};
+
+/*************************************************************************
+|*
+|* RscEnumerateObj :: CallBackWriteRc
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+IMPL_LINK( RscEnumerateObj, CallBackWriteRc, ObjNode *, pObjNode )
+{
+ RscWriteRc aMem( pTypCont->GetByteOrder() );
+
+ aError = pClass->WriteRcHeader( RSCINST( pClass, pObjNode->GetRscObj() ),
+ aMem, pTypCont,
+ pObjNode->GetRscId(), 0, TRUE );
+ if( aError.IsError() || aError.IsWarning() )
+ pTypCont->pEH->Error( aError, pClass, pObjNode->GetRscId() );
+
+ WriteRcFile( aMem, fOutput );
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* RscEnumerateObj :: CallBackWriteSrc
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode )
+{
+ if( pObjNode->GetFileKey() == lFileKey ){
+ pClass->WriteSrcHeader( RSCINST( pClass, pObjNode->GetRscObj() ),
+ fOutput, pTypCont, 0,
+ pObjNode->GetRscId(), "" );
+ fprintf( fOutput, ";\n" );
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteSrc, ObjNode *, pObjNode )
+
+/*************************************************************************
+|*
+|* RscEnumerateObj :: CallBackWriteCxx
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteCxx, ObjNode *, pObjNode )
+{
+ if( pClass->IsCodeWriteable() && pObjNode->GetFileKey() == lFileKey )
+ aError = pClass->WriteCxxHeader(
+ RSCINST( pClass, pObjNode->GetRscObj() ),
+ fOutput, pTypCont, pObjNode->GetRscId() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteCxx, ObjNode *, pObjNode )
+
+/*************************************************************************
+|*
+|* RscEnumerateObj :: CallBackWriteHxx
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+IMPL_LINK_INLINE_START( RscEnumerateObj, CallBackWriteHxx, ObjNode *, pObjNode )
+{
+ if( pClass->IsCodeWriteable() && pObjNode->GetFileKey() == lFileKey )
+ aError = pClass->WriteHxxHeader(
+ RSCINST( pClass, pObjNode->GetRscObj() ),
+ fOutput, pTypCont, pObjNode->GetRscId() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateObj, CallBackWriteHxx, ObjNode *, pObjNode )
+
+/*************************************************************************
+|*
+|* RscEnumerateObj :: WriteRcFile
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+ULONG WritePMRes( FILE * fOutput, USHORT nType, USHORT nId, UINT32 nLen )
+{
+ fputc( (char)0xFF, fOutput );
+ fwrite( (const char *)&nType, sizeof( nType ), 1, fOutput );
+ fputc( (char)0xFF, fOutput );
+ fwrite( (const char *)&nId, sizeof( nId ), 1, fOutput );
+ USHORT fsOption = 0x0030; // Aus Resourcefile ermittelt
+ fwrite( (const char *)&fsOption, sizeof( fsOption ), 1, fOutput );
+ // !!! Achtung: Groesse der Resource NICHT dazuaddieren
+ // !!! nLen += 12; // groesse des Headers
+ ULONG nFilePos = ftell( fOutput );
+ fwrite( (const char *)&nLen, sizeof( nLen ), 1, fOutput );
+ return nFilePos;
+}
+
+void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut ){
+ // Definition der Struktur, aus denen die Resource aufgebaut ist
+ /*
+ struct RSHEADER_TYPE{
+ USHORT nId; // Identifier der Resource
+ USHORT nRT; // Resource Typ
+ USHORT nGlobOff; // Globaler Offset
+ USHORT nLocalOff; // Lokaler Offset
+ } aHeader;
+ */
+
+ USHORT nId = rMem.GetShort( 0 );
+ USHORT nRT = rMem.GetShort( 2 );
+
+ // Tabelle wird entsprechend gefuellt
+ pTypCont->PutTranslatorKey( ((INT32)nRT << 16) + nId );
+
+ if( nRT == RSC_VERSIONCONTROL )
+ { // kommt immmer als letztes
+ INT32 nCount = pTypCont->aIdTranslator.Count();
+ // groesse der Tabelle
+ UINT32 nSize = (nCount * 2 + 1) * sizeof( INT32 );
+
+ rMem.Put( nCount ); //Anzahl speichern
+ INT32 l = (INT32)pTypCont->aIdTranslator.First();
+ while( nCount )
+ {
+ // Schluessel schreiben
+ l = pTypCont->aIdTranslator.GetCurKey();
+ rMem.Put( l );
+ // Objekt Id oder Position schreiben
+ l = (INT32)pTypCont->aIdTranslator.GetCurObject();
+ rMem.Put( l );
+ l = (INT32)pTypCont->aIdTranslator.Next();
+ nCount--;
+ }
+ rMem.Put( nSize ); // Groesse hinten Speichern
+ }
+
+ //Dateioffset neu setzen
+ pTypCont->IncFilePos( rMem.Size() );
+
+
+ //Position wurde vorher in Tabelle geschrieben
+ fwrite( rMem.GetBuffer(), rMem.Size(), 1, fOut );
+
+};
+
+class RscEnumerateRef
+{
+private:
+ RscTop * pRoot;
+
+ DECL_LINK( CallBackWriteRc, RscTop * );
+ DECL_LINK( CallBackWriteSrc, RscTop * );
+ DECL_LINK( CallBackWriteCxx, RscTop * );
+ DECL_LINK( CallBackWriteHxx, RscTop * );
+ DECL_LINK( CallBackWriteSyntax, RscTop * );
+ DECL_LINK( CallBackWriteRcCtor, RscTop * );
+public:
+ RscEnumerateObj aEnumObj;
+
+ RscEnumerateRef( RscTypCont * pTC, RscTop * pR,
+ FILE * fOutput )
+ {
+ aEnumObj.pTypCont = pTC;
+ aEnumObj.fOutput = fOutput;
+ pRoot = pR;
+ }
+ ERRTYPE WriteRc()
+ {
+ aEnumObj.aError.Clear();
+ pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteRc ) );
+ return aEnumObj.aError;
+ };
+
+ ERRTYPE WriteSrc( ULONG lFileKey )
+ {
+ aEnumObj.lFileKey = lFileKey;
+
+ aEnumObj.aError.Clear();
+ pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteSrc ) );
+ return aEnumObj.aError;
+ }
+
+ ERRTYPE WriteCxx( ULONG lFileKey )
+ {
+ aEnumObj.lFileKey = lFileKey;
+
+ aEnumObj.aError.Clear();
+ pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteCxx ) );
+ return aEnumObj.aError;
+ }
+
+ ERRTYPE WriteHxx( ULONG lFileKey )
+ {
+ aEnumObj.lFileKey = lFileKey;
+
+ aEnumObj.aError.Clear();
+ pRoot->EnumNodes( LINK( this, RscEnumerateRef, CallBackWriteHxx ) );
+ return aEnumObj.aError;
+ }
+
+ void WriteSyntax()
+ {
+ pRoot->EnumNodes( LINK( this, RscEnumerateRef,
+ CallBackWriteSyntax ) );
+ }
+
+ void WriteRcCtor()
+ {
+ pRoot->EnumNodes( LINK( this, RscEnumerateRef,
+ CallBackWriteRcCtor ) );
+ }
+};
+
+/*************************************************************************
+|*
+|* RscRscEnumerateRef :: CallBack...
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef )
+{
+ aEnumObj.WriteRc( pRef, pRef->GetObjNode() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteRc, RscTop *, pRef )
+IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef )
+{
+ aEnumObj.WriteSrc( pRef, pRef->GetObjNode() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteSrc, RscTop *, pRef )
+IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteCxx, RscTop *, pRef )
+{
+ if( pRef->IsCodeWriteable() )
+ aEnumObj.WriteCxx( pRef, pRef->GetObjNode() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteCxx, RscTop *, pRef )
+IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteHxx, RscTop *, pRef )
+{
+ if( pRef->IsCodeWriteable() )
+ aEnumObj.WriteHxx( pRef, pRef->GetObjNode() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteHxx, RscTop *, pRef )
+IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteSyntax, RscTop *, pRef )
+{
+ pRef->WriteSyntaxHeader( aEnumObj.fOutput, aEnumObj.pTypCont );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteSyntax, RscTop *, pRef )
+IMPL_LINK_INLINE_START( RscEnumerateRef, CallBackWriteRcCtor, RscTop *, pRef )
+{
+ pRef->WriteRcCtor( aEnumObj.fOutput, aEnumObj.pTypCont );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscEnumerateRef, CallBackWriteRcCtor, RscTop *, pRef )
+
+/*************************************************************************
+|*
+|* RscTypCont :: WriteRc
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 22.03.90
+|* Letzte Aenderung MM 22.07.91
+|*
+*************************************************************************/
+ERRTYPE RscTypCont::WriteRc( FILE * fOutput )
+{
+ RscSysEntry * pSysEntry;
+ ERRTYPE aError;
+ RscEnumerateRef aEnumRef( this, pRoot, fOutput );
+
+ aIdTranslator.Clear();
+ nFilePos = 0;
+ nPMId = RSCVERSION_ID +1; //mindestens einen groesser
+
+ aError = aEnumRef.WriteRc();
+
+ if( aError.IsOk() )
+ {
+ // Systemabhaengige Resourcen schreiben
+ pSysEntry = aSysLst.First();
+ while( pSysEntry && aError.IsOk() )
+ {
+ UniString aUniFileName( pSysEntry->aFileName, RTL_TEXTENCODING_ASCII_US );
+ DirEntry aFullName( aUniFileName );
+ aFullName.Find( UniString( GetSearchPath(), RTL_TEXTENCODING_ASCII_US ) );
+ pSysEntry->aFileName = ByteString( aFullName.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ if( !::Append( fOutput, pSysEntry->aFileName.GetBuffer() ) )
+ {
+ pEH->FatalError( ERR_OPENFILE, RscId(), pSysEntry->aFileName.GetBuffer() );
+ break;
+ }
+ UniString aUniFileName2( pSysEntry->aFileName, RTL_TEXTENCODING_ASCII_US );
+ FileStat aFS( aUniFileName2 );
+ if( !aFS.IsKind( FSYS_KIND_FILE ) )
+ {
+ pEH->FatalError( ERR_OPENFILE, RscId(), pSysEntry->aFileName.GetBuffer() );
+ break;
+ }
+
+ // Tabelle wird entsprechend gefuellt
+ PutTranslatorKey( ((ULONG)RT_SYS_BITMAP << 16) + pSysEntry->nKey );
+ UINT32 nSize = aFS.GetSize();
+ IncFilePos( nSize );
+
+ // wegen Alignment
+ nSize = sizeof( int ) - nSize % sizeof( int );
+ nSize %= sizeof( int );
+ IncFilePos( nSize );
+ while( nSize-- )
+ fputc( 0, fOutput );
+
+ pSysEntry = aSysLst.Next();
+ }
+
+ // Versionskontrolle schreiben
+ RscWriteRc aMem( nByteOrder );
+ aVersion.pClass->WriteRcHeader( aVersion, aMem, this,
+ RscId( RSCVERSION_ID ), 0, TRUE );
+ aEnumRef.aEnumObj.WriteRcFile( aMem, fOutput );
+ }
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: WriteSrc
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 22.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+void RscTypCont :: WriteSrc( FILE * fOutput, ULONG nFileKey,
+ CharSet nCharSet, BOOL bName )
+{
+ RscFile * pFName;
+ RscEnumerateRef aEnumRef( this, pRoot, fOutput );
+
+ if( bName )
+ {
+ WriteInc( fOutput, nFileKey );
+
+ if( NOFILE_INDEX == nFileKey )
+ {
+ pFName = aFileTab.First();
+ while( pFName ){
+ if( !pFName->IsIncFile() )
+ pFName->aDefLst.WriteAll( fOutput );
+ aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) );
+ pFName = aFileTab.Next();
+ };
+ }
+ else
+ {
+ pFName = aFileTab.Get( nFileKey );
+ if( pFName ){
+ pFName->aDefLst.WriteAll( fOutput );
+ aEnumRef.WriteSrc( nFileKey );
+ }
+ }
+ }
+ else
+ {
+ RscId::SetNames( FALSE );
+ if( NOFILE_INDEX == nFileKey )
+ {
+ pFName = aFileTab.First();
+ while( pFName )
+ {
+ aEnumRef.WriteSrc( aFileTab.GetIndex( pFName ) );
+ pFName = aFileTab.Next();
+ };
+ }
+ else
+ aEnumRef.WriteSrc( nFileKey );
+ RscId::SetNames();
+ };
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: WriteHxx
+|*
+|* Beschreibung
+|* Ersterstellung MM 30.05.91
+|* Letzte Aenderung MM 30.05.91
+|*
+*************************************************************************/
+ERRTYPE RscTypCont :: WriteHxx( FILE * fOutput, ULONG nFileKey )
+{
+ fprintf( fOutput, "#include <tools/rc.hxx>\n" );
+ fprintf( fOutput, "#include <tools/resid.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/accel.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/bitmap.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/button.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/color.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/combobox.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/ctrl.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/dialog.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/edit.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/field.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/fixed.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/group.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/image.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/imagebtn.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/keycod.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/lstbox.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/mapmod.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/menu.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/menubtn.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/morebtn.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/msgbox.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/scrbar.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/spin.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/spinfld.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/splitwin.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/status.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/tabctrl.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/tabdlg.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/tabpage.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/toolbox.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/window.hxx>\n" );
+ fprintf( fOutput, "#include <vcl/wrkwin.hxx>\n" );
+ fprintf( fOutput, "#include <svtools/svmedit.hxx>\n" );
+
+ RscEnumerateRef aEnumRef( this, pRoot, fOutput );
+ ERRTYPE aError;
+
+ if( NOFILE_INDEX == nFileKey )
+ {
+ RscFile * pFName;
+
+ pFName = aFileTab.First();
+ while( pFName )
+ {
+ aError = aEnumRef.WriteHxx( aFileTab.GetIndex( pFName ) );
+ pFName = aFileTab.Next();
+ };
+ }
+ else
+ aError = aEnumRef.WriteHxx( nFileKey );
+
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: WriteCxx
+|*
+|* Beschreibung
+|* Ersterstellung MM 30.05.91
+|* Letzte Aenderung MM 30.05.91
+|*
+*************************************************************************/
+ERRTYPE RscTypCont::WriteCxx( FILE * fOutput, ULONG nFileKey,
+ const ByteString & rHxxName )
+{
+ RscEnumerateRef aEnumRef( this, pRoot, fOutput );
+ ERRTYPE aError;
+ fprintf( fOutput, "#include <string.h>\n" );
+ WriteInc( fOutput, nFileKey );
+ if( rHxxName.Len() )
+ fprintf( fOutput, "#include \"%s\"\n", rHxxName.GetBuffer() );
+ fprintf( fOutput, "\n\n" );
+
+ if( NOFILE_INDEX == nFileKey )
+ {
+ RscFile * pFName;
+
+ pFName = aFileTab.First();
+ while( pFName )
+ {
+ aError = aEnumRef.WriteCxx( aFileTab.GetIndex( pFName ) );
+ pFName = aFileTab.Next();
+ };
+ }
+ else
+ aError = aEnumRef.WriteCxx( nFileKey );
+
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: WriteSyntax
+|*
+|* Beschreibung
+|* Ersterstellung MM 30.05.91
+|* Letzte Aenderung MM 30.05.91
+|*
+*************************************************************************/
+void RscTypCont::WriteSyntax( FILE * fOutput )
+{
+ for( USHORT i = 0; i < aBaseLst.Count(); i++ )
+ aBaseLst.GetObject( i )->WriteSyntaxHeader( fOutput, this );
+ RscEnumerateRef aEnumRef( this, pRoot, fOutput );
+ aEnumRef.WriteSyntax();
+}
+
+//=======================================================================
+void RscTypCont::WriteRcCtor
+(
+ FILE * fOutput
+)
+{
+ RscEnumerateRef aEnumRef( this, pRoot, fOutput );
+ aEnumRef.WriteRcCtor();
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: Delete()
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+class RscDel
+{
+ ULONG lFileKey;
+ DECL_LINK( Delete, RscTop * );
+public:
+ RscDel( RscTop * pRoot, ULONG lKey );
+};
+
+
+inline RscDel::RscDel( RscTop * pRoot, ULONG lKey )
+{
+ lFileKey = lKey;
+ pRoot->EnumNodes( LINK( this, RscDel, Delete ) );
+}
+
+IMPL_LINK_INLINE_START( RscDel, Delete, RscTop *, pNode )
+{
+ if( pNode->GetObjNode() )
+ pNode->pObjBiTree = pNode->GetObjNode()->DelObjNode( pNode, lFileKey );
+ return 0;
+}
+IMPL_LINK_INLINE_END( RscDel, Delete, RscTop *, pNode )
+
+void RscTypCont :: Delete( ULONG lFileKey ){
+ // Resourceinstanzen loeschen
+ RscDel aDel( pRoot, lFileKey );
+ // Defines loeschen
+ aFileTab.DeleteFileContext( lFileKey );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont :: MakeConsistent()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.09.91
+|* Letzte Aenderung MM 23.09.91
+|*
+*************************************************************************/
+BOOL IsInstConsistent( ObjNode * pObjNode, RscTop * pRscTop,
+ RscInconsList * pList )
+{
+ BOOL bRet = TRUE;
+
+ if( pObjNode ){
+ RSCINST aTmpI;
+
+ if( ! IsInstConsistent( (ObjNode*)pObjNode->Left(), pRscTop, pList ) )
+ bRet = FALSE;
+
+ aTmpI.pClass = pRscTop;
+ aTmpI.pData = pObjNode->GetRscObj();
+ if( ! aTmpI.pClass->IsConsistent( aTmpI, pList ) )
+ bRet = FALSE;
+
+ if( ! IsInstConsistent( (ObjNode*)pObjNode->Right(), pRscTop, pList ) )
+ bRet = FALSE;
+ };
+
+ return( bRet );
+}
+
+BOOL MakeConsistent( RscTop * pRscTop, RscInconsList * pList )
+{
+ BOOL bRet = TRUE;
+
+ if( pRscTop ){
+ if( ! ::MakeConsistent( (RscTop*)pRscTop->Left(), pList ) )
+ bRet = FALSE;
+
+ if( pRscTop->GetObjNode() ){
+ if( ! pRscTop->GetObjNode()->IsConsistent() ){
+ pRscTop->GetObjNode()->OrderTree();
+ if( ! pRscTop->GetObjNode()->IsConsistent( pList ) )
+ bRet = FALSE;
+ }
+ if( ! IsInstConsistent( pRscTop->GetObjNode(), pRscTop, pList ) )
+ bRet = FALSE;
+ }
+
+ if( ! ::MakeConsistent( (RscTop*)pRscTop->Right(), pList ) )
+ bRet = FALSE;
+ };
+
+ return bRet;
+}
+
+BOOL RscTypCont :: MakeConsistent( RscInconsList * pList ){
+ return( ::MakeConsistent( pRoot, pList ) );
+}
+
+USHORT RscTypCont::PutTranslatorKey( ULONG nKey )
+{
+ aIdTranslator.Insert( nKey, (void*)nFilePos );
+ return nPMId++;
+}
+
diff --git a/rsc/source/parser/rscibas.cxx b/rsc/source/parser/rscibas.cxx
new file mode 100644
index 000000000000..0032cb78fb66
--- /dev/null
+++ b/rsc/source/parser/rscibas.cxx
@@ -0,0 +1,736 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscibas.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/****************** I N C L U D E S **************************************/
+#pragma hdrstop
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <tools/intn.hxx>
+#include <tools/rc.h>
+#include <tools/color.hxx>
+#include <tools/vclrsc.hxx>
+
+#ifndef _RSCCONST_HXX
+#include <rscconst.hxx>
+#endif
+#ifndef _RSCARRAY_HXX
+#include <rscarray.hxx>
+#endif
+#ifndef _RSCCLASS_HXX
+#include <rscclass.hxx>
+#endif
+#ifndef _RSCCONT_HXX
+#include <rsccont.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+
+
+#include "rsclex.hxx"
+#include <rscyacc.yxx.h>
+
+/****************** M A C R O S ******************************************/
+void RscTypCont::SETCONST( RscConst * pClass, char * szString, UINT32 nVal )
+{
+ pClass->SetConstant( aNmTb.Put( szString,
+ (USHORT)CONSTNAME, nVal ), nVal );
+}
+
+void RscTypCont::SETCONST( RscConst * pClass, HASHID nName, UINT32 nVal )
+{
+ pClass->SetConstant( aNmTb.Put( nName,
+ (USHORT)CONSTNAME, nVal ), nVal );
+}
+
+/****************** C O D E **********************************************/
+/*************************************************************************
+|* RscTypCont::InitLangType()
+|*
+|* Beschreibung
+*************************************************************************/
+#define LT(Name) \
+ SETCONST( &aLangType, #Name, LANGUAGE_##Name )
+
+RscEnum * RscTypCont::InitLangType()
+{
+ LT( SYSTEM );
+ LT( DONTKNOW );
+#include <rsclang.c>
+ SETCONST( &aLangType, "LANGUAGE_USER1", LANGUAGE_USER1 );
+ SETCONST( &aLangType, "LANGUAGE_USER2", LANGUAGE_USER2 );
+ SETCONST( &aLangType, "LANGUAGE_USER3", LANGUAGE_USER3 );
+ SETCONST( &aLangType, "LANGUAGE_USER4", LANGUAGE_USER4 );
+ SETCONST( &aLangType, "LANGUAGE_USER5", LANGUAGE_USER5 );
+ SETCONST( &aLangType, "LANGUAGE_USER6", LANGUAGE_USER6 );
+ SETCONST( &aLangType, "LANGUAGE_USER7", LANGUAGE_USER7 );
+ SETCONST( &aLangType, "LANGUAGE_USER8", LANGUAGE_USER8 );
+ SETCONST( &aLangType, "LANGUAGE_USER9", LANGUAGE_USER9 );
+
+ return( &aLangType );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitDateFormatType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitDateFormatType()
+{
+ RscEnum * pDate;
+ pDate = new RscEnum( pHS->Insert( "EnumDateFormat" ), RSC_NOTYPE );
+
+ SETCONST( pDate, "MDY", MDY );
+ SETCONST( pDate, "DMY", DMY );
+ SETCONST( pDate, "YMD", YMD );
+
+ return pDate;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitTimeType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitTimeFormatType()
+{
+ RscEnum * pTime;
+ pTime = new RscEnum( pHS->Insert( "EnumTimeFormat" ), RSC_NOTYPE );
+
+ SETCONST( pTime, "HOUR_12", HOUR_12 );
+ SETCONST( pTime, "HOUR_24", HOUR_24 );
+
+ return pTime;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitWeekDayFormatType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitWeekDayFormatType()
+{
+ RscEnum * pWeekDay;
+ pWeekDay = new RscEnum( pHS->Insert( "EnumWeekDayFormat" ), RSC_NOTYPE );
+
+ SETCONST( pWeekDay, "DAYOFWEEK_NONE", DAYOFWEEK_NONE );
+ SETCONST( pWeekDay, "DAYOFWEEK_SHORT", DAYOFWEEK_SHORT );
+ SETCONST( pWeekDay, "DAYOFWEEK_LONG", DAYOFWEEK_LONG );
+
+ return pWeekDay;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitMonthFormatType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitMonthFormatType()
+{
+ RscEnum * pMonth;
+ pMonth = new RscEnum( pHS->Insert( "EnumMonthFormat" ), RSC_NOTYPE );
+
+ SETCONST( pMonth, "MONTH_NORMAL", MONTH_NORMAL );
+ SETCONST( pMonth, "MONTH_ZERO", MONTH_ZERO );
+ SETCONST( pMonth, "MONTH_SHORT", MONTH_SHORT );
+ SETCONST( pMonth, "MONTH_LONG", MONTH_LONG );
+
+ return pMonth;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitFieldUnitsType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitFieldUnitsType()
+{
+ RscEnum * pFieldUnits;
+ pFieldUnits = new RscEnum( pHS->Insert( "EnumFieldUnit" ), RSC_NOTYPE );
+
+ SETCONST( pFieldUnits, "FUNIT_NONE", FUNIT_NONE );
+ SETCONST( pFieldUnits, "FUNIT_MM", FUNIT_MM );
+ SETCONST( pFieldUnits, "FUNIT_CM", FUNIT_CM );
+ SETCONST( pFieldUnits, "FUNIT_M", FUNIT_M );
+ SETCONST( pFieldUnits, "FUNIT_KM", FUNIT_KM );
+ SETCONST( pFieldUnits, "FUNIT_TWIP", FUNIT_TWIP );
+ SETCONST( pFieldUnits, "FUNIT_POINT", FUNIT_POINT );
+ SETCONST( pFieldUnits, "FUNIT_PICA", FUNIT_PICA );
+ SETCONST( pFieldUnits, "FUNIT_INCH", FUNIT_INCH );
+ SETCONST( pFieldUnits, "FUNIT_FOOT", FUNIT_FOOT );
+ SETCONST( pFieldUnits, "FUNIT_MILE", FUNIT_MILE );
+ SETCONST( pFieldUnits, "FUNIT_CUSTOM", FUNIT_CUSTOM );
+
+ return pFieldUnits;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitDayOfWeekType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitDayOfWeekType()
+{
+ RscEnum * pDayOfWeek;
+ pDayOfWeek = new RscEnum( pHS->Insert( "EnumDayOfWeek" ), RSC_NOTYPE );
+
+ SETCONST( pDayOfWeek, "MONDAY", MONDAY );
+ SETCONST( pDayOfWeek, "TUESDAY", TUESDAY );
+ SETCONST( pDayOfWeek, "WEDNESDAY", WEDNESDAY );
+ SETCONST( pDayOfWeek, "THURSDAY", THURSDAY );
+ SETCONST( pDayOfWeek, "FRIDAY", FRIDAY );
+ SETCONST( pDayOfWeek, "SATURDAY", SATURDAY );
+ SETCONST( pDayOfWeek, "SUNDAY", SUNDAY );
+
+ return pDayOfWeek;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitTimeFieldFormat()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitTimeFieldFormat()
+{
+ RscEnum * pTimeFieldFormat;
+ pTimeFieldFormat = new RscEnum( pHS->Insert( "EnumTimeFieldFormat" ),
+ RSC_NOTYPE );
+
+ SETCONST( pTimeFieldFormat, "TIMEF_NONE", TIMEF_NONE );
+ SETCONST( pTimeFieldFormat, "TIMEF_SEC", TIMEF_SEC );
+ SETCONST( pTimeFieldFormat, "TIMEF_100TH_SEC", TIMEF_100TH_SEC );
+
+ return pTimeFieldFormat;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitColor()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitColor(){
+ RscEnum * pColor;
+ pColor = new RscEnum( pHS->Insert( "EnumColor" ), RSC_NOTYPE );
+
+ SETCONST( pColor, "COL_BLACK", COL_BLACK );
+ SETCONST( pColor, "COL_BLUE", COL_BLUE );
+ SETCONST( pColor, "COL_GREEN", COL_GREEN );
+ SETCONST( pColor, "COL_CYAN", COL_CYAN );
+ SETCONST( pColor, "COL_RED", COL_RED );
+ SETCONST( pColor, "COL_MAGENTA", COL_MAGENTA );
+ SETCONST( pColor, "COL_BROWN", COL_BROWN );
+ SETCONST( pColor, "COL_GRAY", COL_GRAY );
+ SETCONST( pColor, "COL_LIGHTGRAY", COL_LIGHTGRAY );
+ SETCONST( pColor, "COL_LIGHTBLUE", COL_LIGHTBLUE );
+ SETCONST( pColor, "COL_LIGHTGREEN", COL_LIGHTGREEN );
+ SETCONST( pColor, "COL_LIGHTCYAN", COL_LIGHTCYAN );
+ SETCONST( pColor, "COL_LIGHTRED", COL_LIGHTRED );
+ SETCONST( pColor, "COL_LIGHTMAGENTA", COL_LIGHTMAGENTA );
+ SETCONST( pColor, "COL_YELLOW", COL_YELLOW );
+ SETCONST( pColor, "COL_WHITE", COL_WHITE );
+
+ return( pColor );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitMapUnit()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitMapUnit(){
+ RscEnum * pMapUnit;
+ pMapUnit = new RscEnum( pHS->Insert( "EnumMapUnit" ), RSC_NOTYPE );
+
+ SETCONST( pMapUnit, "MAP_PIXEL", MAP_PIXEL );
+ SETCONST( pMapUnit, "MAP_SYSFONT", MAP_SYSFONT );
+ SETCONST( pMapUnit, "MAP_100TH_MM", MAP_100TH_MM );
+ SETCONST( pMapUnit, "MAP_10TH_MM", MAP_10TH_MM );
+ SETCONST( pMapUnit, "MAP_MM", MAP_MM );
+ SETCONST( pMapUnit, "MAP_CM", MAP_CM );
+ SETCONST( pMapUnit, "MAP_1000TH_INCH", MAP_1000TH_INCH );
+ SETCONST( pMapUnit, "MAP_100TH_INCH", MAP_100TH_INCH );
+ SETCONST( pMapUnit, "MAP_10TH_INCH", MAP_10TH_INCH );
+ SETCONST( pMapUnit, "MAP_INCH", MAP_INCH );
+ SETCONST( pMapUnit, "MAP_POINT", MAP_POINT );
+ SETCONST( pMapUnit, "MAP_TWIP", MAP_TWIP );
+ SETCONST( pMapUnit, "MAP_APPFONT", MAP_APPFONT );
+ SETCONST( pMapUnit, "MAP_SV", RSC_EXTRAMAPUNIT );
+ return( pMapUnit );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitKey()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitKey(){
+ RscEnum * pKey;
+ pKey = new RscEnum( pHS->Insert( "EnumKey" ), RSC_NOTYPE );
+
+ SETCONST( pKey, "KEY_0", KEY_0 );
+ SETCONST( pKey, "KEY_1", KEY_1 );
+ SETCONST( pKey, "KEY_2", KEY_2 );
+ SETCONST( pKey, "KEY_3", KEY_3 );
+ SETCONST( pKey, "KEY_4", KEY_4 );
+ SETCONST( pKey, "KEY_5", KEY_5 );
+ SETCONST( pKey, "KEY_6", KEY_6 );
+ SETCONST( pKey, "KEY_7", KEY_7 );
+ SETCONST( pKey, "KEY_8", KEY_8 );
+ SETCONST( pKey, "KEY_9", KEY_9 );
+
+ SETCONST( pKey, "KEY_A", KEY_A );
+ SETCONST( pKey, "KEY_B", KEY_B );
+ SETCONST( pKey, "KEY_C", KEY_C );
+ SETCONST( pKey, "KEY_D", KEY_D );
+ SETCONST( pKey, "KEY_E", KEY_E );
+ SETCONST( pKey, "KEY_F", KEY_F );
+ SETCONST( pKey, "KEY_G", KEY_G );
+ SETCONST( pKey, "KEY_H", KEY_H );
+ SETCONST( pKey, "KEY_I", KEY_I );
+ SETCONST( pKey, "KEY_J", KEY_J );
+ SETCONST( pKey, "KEY_K", KEY_K );
+ SETCONST( pKey, "KEY_L", KEY_L );
+ SETCONST( pKey, "KEY_M", KEY_M );
+ SETCONST( pKey, "KEY_N", KEY_N );
+ SETCONST( pKey, "KEY_O", KEY_O );
+ SETCONST( pKey, "KEY_P", KEY_P );
+ SETCONST( pKey, "KEY_Q", KEY_Q );
+ SETCONST( pKey, "KEY_R", KEY_R );
+ SETCONST( pKey, "KEY_S", KEY_S );
+ SETCONST( pKey, "KEY_T", KEY_T );
+ SETCONST( pKey, "KEY_U", KEY_U );
+ SETCONST( pKey, "KEY_V", KEY_V );
+ SETCONST( pKey, "KEY_W", KEY_W );
+ SETCONST( pKey, "KEY_X", KEY_X );
+ SETCONST( pKey, "KEY_Y", KEY_Y );
+ SETCONST( pKey, "KEY_Z", KEY_Z );
+
+ SETCONST( pKey, "KEY_F1", KEY_F1 );
+ SETCONST( pKey, "KEY_F2", KEY_F2 );
+ SETCONST( pKey, "KEY_F3", KEY_F3 );
+ SETCONST( pKey, "KEY_F4", KEY_F4 );
+ SETCONST( pKey, "KEY_F5", KEY_F5 );
+ SETCONST( pKey, "KEY_F6", KEY_F6 );
+ SETCONST( pKey, "KEY_F7", KEY_F7 );
+ SETCONST( pKey, "KEY_F8", KEY_F8 );
+ SETCONST( pKey, "KEY_F9", KEY_F9 );
+ SETCONST( pKey, "KEY_F10", KEY_F10 );
+ SETCONST( pKey, "KEY_F11", KEY_F11 );
+ SETCONST( pKey, "KEY_F12", KEY_F12 );
+ SETCONST( pKey, "KEY_F13", KEY_F13 );
+ SETCONST( pKey, "KEY_F14", KEY_F14 );
+ SETCONST( pKey, "KEY_F15", KEY_F15 );
+ SETCONST( pKey, "KEY_F16", KEY_F16 );
+ SETCONST( pKey, "KEY_F17", KEY_F17 );
+ SETCONST( pKey, "KEY_F18", KEY_F18 );
+ SETCONST( pKey, "KEY_F19", KEY_F19 );
+ SETCONST( pKey, "KEY_F20", KEY_F20 );
+ SETCONST( pKey, "KEY_F21", KEY_F21 );
+ SETCONST( pKey, "KEY_F22", KEY_F22 );
+ SETCONST( pKey, "KEY_F23", KEY_F23 );
+ SETCONST( pKey, "KEY_F24", KEY_F24 );
+ SETCONST( pKey, "KEY_F25", KEY_F25 );
+ SETCONST( pKey, "KEY_F26", KEY_F26 );
+
+ SETCONST( pKey, "KEY_DOWN", KEY_DOWN );
+ SETCONST( pKey, "KEY_UP", KEY_UP );
+ SETCONST( pKey, "KEY_LEFT", KEY_LEFT );
+ SETCONST( pKey, "KEY_RIGHT", KEY_RIGHT );
+ SETCONST( pKey, "KEY_HOME", KEY_HOME );
+ SETCONST( pKey, "KEY_END", KEY_END );
+ SETCONST( pKey, "KEY_PAGEUP", KEY_PAGEUP );
+ SETCONST( pKey, "KEY_PAGEDOWN", KEY_PAGEDOWN );
+
+ SETCONST( pKey, "KEY_RETURN", KEY_RETURN );
+ SETCONST( pKey, "KEY_ESCAPE", KEY_ESCAPE );
+ SETCONST( pKey, "KEY_TAB", KEY_TAB );
+ SETCONST( pKey, "KEY_BACKSPACE", KEY_BACKSPACE );
+ SETCONST( pKey, "KEY_SPACE", KEY_SPACE );
+ SETCONST( pKey, "KEY_INSERT", KEY_INSERT );
+ SETCONST( pKey, "KEY_DELETE", KEY_DELETE );
+
+ SETCONST( pKey, "KEY_ADD", KEY_ADD );
+ SETCONST( pKey, "KEY_SUBTRACT", KEY_SUBTRACT );
+ SETCONST( pKey, "KEY_MULTIPLY", KEY_MULTIPLY );
+ SETCONST( pKey, "KEY_DIVIDE", KEY_DIVIDE );
+ SETCONST( pKey, "KEY_POINT", KEY_POINT );
+ SETCONST( pKey, "KEY_COMMA", KEY_COMMA );
+ SETCONST( pKey, "KEY_LESS", KEY_LESS );
+ SETCONST( pKey, "KEY_GREATER", KEY_GREATER );
+ SETCONST( pKey, "KEY_EQUAL", KEY_EQUAL );
+
+ SETCONST( pKey, "KEY_OPEN", KEY_OPEN );
+ SETCONST( pKey, "KEY_CUT", KEY_CUT );
+ SETCONST( pKey, "KEY_COPY", KEY_COPY );
+ SETCONST( pKey, "KEY_PASTE", KEY_PASTE );
+ SETCONST( pKey, "KEY_UNDO", KEY_UNDO );
+ SETCONST( pKey, "KEY_REPEAT", KEY_REPEAT );
+ SETCONST( pKey, "KEY_FIND", KEY_FIND );
+ SETCONST( pKey, "KEY_PROPERTIES", KEY_PROPERTIES );
+ SETCONST( pKey, "KEY_FRONT", KEY_FRONT );
+
+ return( pKey );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitTriState()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.11.91
+|* Letzte Aenderung MM 26.11.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitTriState(){
+ RscEnum * pTriState;
+ pTriState = new RscEnum( pHS->Insert( "EnumTriState" ), RSC_NOTYPE );
+
+ SETCONST( pTriState, "STATE_NOCHECK", STATE_NOCHECK );
+ SETCONST( pTriState, "STATE_CHECK", STATE_CHECK );
+ SETCONST( pTriState, "STATE_DONTKNOW", STATE_DONTKNOW );
+
+ return( pTriState );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitMessButtons()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitMessButtons(){
+ RscEnum * pMessButtons;
+ pMessButtons = new RscEnum( pHS->Insert( "EnumMessButtons" ), RSC_NOTYPE, FALSE );
+ SETCONST( pMessButtons, "WB_OK", WB_OK );
+ SETCONST( pMessButtons, "WB_OK_CANCEL", WB_OK_CANCEL );
+ SETCONST( pMessButtons, "WB_YES_NO", WB_YES_NO );
+ SETCONST( pMessButtons, "WB_YES_NO_CANCEL", WB_YES_NO_CANCEL );
+ SETCONST( pMessButtons, "WB_RETRY_CANCEL", WB_RETRY_CANCEL );
+ return( pMessButtons );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitMessDefButton()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscEnum * RscTypCont::InitMessDefButton(){
+ RscEnum * pMessDefButton;
+ pMessDefButton = new RscEnum( pHS->Insert( "EnumMessDefButton" ),
+ RSC_NOTYPE, FALSE );
+
+ SETCONST( pMessDefButton, "WB_DEF_OK", WB_DEF_OK );
+ SETCONST( pMessDefButton, "WB_DEF_CANCEL", WB_DEF_CANCEL );
+ SETCONST( pMessDefButton, "WB_DEF_RETRY", WB_DEF_RETRY );
+ SETCONST( pMessDefButton, "WB_DEF_YES", WB_DEF_YES );
+ SETCONST( pMessDefButton, "WB_DEF_NO", WB_DEF_NO );
+ return( pMessDefButton );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitGeometry()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscTupel * RscTypCont::InitGeometry()
+{
+ RscTop * pTupel;
+ HASHID nId;
+
+ // Clientvariablen einfuegen
+ pTupel = new RscTupel( pHS->Insert( "TupelDeltaSystem" ),
+ RSC_NOTYPE, NULL );
+ nId = aNmTb.Put( "X", VARNAME );
+ pTupel->SetVariable( nId, &aShort );
+ nId = aNmTb.Put( "Y", VARNAME );
+ pTupel->SetVariable( nId, &aShort );
+ nId = aNmTb.Put( "WIDTH", VARNAME );
+ pTupel->SetVariable( nId, &aShort );
+ nId = aNmTb.Put( "HEIGHT", VARNAME );
+ pTupel->SetVariable( nId, &aShort );
+
+ return (RscTupel *)pTupel;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitLangGeometry()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscArray * RscTypCont::InitLangGeometry( RscTupel * pGeo )
+{
+ return new RscArray( pHS->Insert( "Lang_TupelGeometry" ),
+ RSC_NOTYPE, pGeo, &aLangType,
+ &nLangTypeId, &nDfltLangTypeId );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitStringList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscCont * RscTypCont::InitStringList()
+{
+ RscCont * pCont;
+
+ pCont = new RscCont( pHS->Insert( "Chars[]" ), RSC_NOTYPE );
+ pCont->SetTypeClass( &aString );
+
+ return pCont;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitLangStringList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscArray * RscTypCont::InitLangStringList( RscCont * pStrLst )
+{
+ return new RscArray( pHS->Insert( "Lang_CharsList" ),
+ RSC_NOTYPE, pStrLst, &aLangType,
+ &nLangTypeId, &nDfltLangTypeId );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitStringTupel()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscTupel * RscTypCont::InitStringTupel()
+{
+ RscTop * pTupel;
+ HASHID nId;
+
+ // Clientvariablen einfuegen
+ pTupel = new RscTupel( pHS->Insert( "CharsTupel" ),
+ RSC_NOTYPE, NULL );
+ nId = aNmTb.Put( "FILTER", VARNAME );
+ pTupel->SetVariable( nId, &aString );
+ nId = aNmTb.Put( "MASK", VARNAME );
+ pTupel->SetVariable( nId, &aString );
+
+ return (RscTupel *)pTupel;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitStringLongTupel()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.07.94
+|*
+*************************************************************************/
+RscTupel * RscTypCont::InitStringLongTupel()
+{
+ RscTop * pTupel;
+ HASHID nId;
+
+ // Clientvariablen einfuegen
+ pTupel = new RscTupel( pHS->Insert( "CharsLongTupel" ), RSC_NOTYPE, NULL );
+ nId = aNmTb.Put( "ItemText", VARNAME );
+ pTupel->SetVariable( nId, &aString );
+ nId = aNmTb.Put( "ItemId", VARNAME );
+ pTupel->SetVariable( nId, &aEnumLong );
+
+ return (RscTupel *)pTupel;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitStringTupelList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscCont * RscTypCont::InitStringTupelList( RscTupel * pTupelString )
+{
+ RscCont * pCont;
+
+ pCont = new RscCont( pHS->Insert( "CharsCharsTupel[]" ), RSC_NOTYPE );
+ pCont->SetTypeClass( pTupelString );
+
+ return pCont;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitStringLongTupelList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscCont * RscTypCont::InitStringLongTupelList( RscTupel * pStringLong )
+{
+ RscCont * pCont;
+
+ pCont = new RscCont( pHS->Insert( "CharsLongTupel[]" ), RSC_NOTYPE );
+ pCont->SetTypeClass( pStringLong );
+
+ return pCont;
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitLangStringTupelList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscArray * RscTypCont::InitLangStringTupelList( RscCont * pStrTupelLst )
+{
+ return new RscArray( pHS->Insert( "Lang_CharsCharsTupel" ),
+ RSC_NOTYPE, pStrTupelLst, &aLangType,
+ &nLangTypeId, &nDfltLangTypeId );
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::InitLangStringLongTupelList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.05.91
+|* Letzte Aenderung MM 24.05.91
+|*
+*************************************************************************/
+RscArray * RscTypCont::InitLangStringLongTupelList( RscCont * pStrLongTupelLst )
+{
+ return new RscArray( pHS->Insert( "Lang_CharsLongTupelList" ),
+ RSC_NOTYPE, pStrLongTupelLst, &aLangType,
+ &nLangTypeId, &nDfltLangTypeId );
+}
+
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
new file mode 100644
index 000000000000..a632db4d8043
--- /dev/null
+++ b/rsc/source/parser/rscicpx.cxx
@@ -0,0 +1,2483 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscicpx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/****************** I N C L U D E S **************************************/
+#pragma hdrstop
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <tools/rc.h>
+#include <tools/vclrsc.hxx>
+
+#ifndef _RSCMGR_HXX
+#include <rscmgr.hxx>
+#endif
+#ifndef _RSCCLASS_HXX
+#include <rscclass.hxx>
+#endif
+#ifndef _RSCCONT_HXX
+#include <rsccont.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCSFX_HXX
+#include <rscsfx.hxx>
+#endif
+
+#include "rsclex.hxx"
+#include <rscyacc.yxx.h>
+
+/*************************************************************************
+|* RscTypCont::InsWinBit()
+*************************************************************************/
+void RscTypCont::InsWinBit( RscTop * pClass, const ByteString & rName,
+ HASHID nVal )
+{
+ RscClient * pClient;
+
+ // Clientvariablen einfuegen
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ &aWinBits, nVal ),
+ LIST_APPEND );
+ HASHID nId = aNmTb.Put( rName.GetBuffer(), VARNAME );
+ pClass->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nWinBitVarId );
+}
+
+#define INS_WINBIT( pClass, WinBit ) \
+ InsWinBit( pClass, #WinBit, n##WinBit##Id );
+
+/*************************************************************************
+|* RscTypCont::InitClassMgr()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMgr()
+{
+ RscTop * pClassMgr;
+ RscBaseCont * pClass;
+ HASHID nId;
+
+ aBaseLst.Insert( pClass =
+ new RscBaseCont( HASH_NONAME, RSC_NOTYPE, NULL, FALSE ),
+ LIST_APPEND );
+
+ nId = pHS->Insert( "Resource" );
+ pClassMgr = new RscMgr( nId, RSC_RESOURCE, pClass );
+ aNmTb.Put( nId, CLASSNAME, pClassMgr );
+ pClassMgr->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ {
+ RscContWriteSrc * pCont;
+
+ // Variablen anlegen
+ aBaseLst.Insert(
+ pCont = new RscContExtraData( pHS->Insert( "ContExtradata" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+ pCont->SetTypeClass( &aShort, &aString );
+ nRsc_EXTRADATA = nId = aNmTb.Put( "ExtraData", VARNAME );
+ pClassMgr->SetVariable( nId, pCont );
+ };
+ nId = aNmTb.Put( "Comment", VARNAME );
+ pClassMgr->SetVariable( nId, &aString, NULL, VAR_NORC );
+
+ pClass->SetTypeClass( pClassMgr );
+
+ return pClassMgr;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassString()
+*************************************************************************/
+RscTop * RscTypCont::InitClassString( RscTop * pSuper ){
+ HASHID nId;
+ RscTop * pClassString;
+
+ nId = pHS->Insert( "String" );
+ pClassString = new RscClass( nId, RSC_STRING, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassString );
+ pClassString->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Text", VARNAME );
+ pClassString->SetVariable( nId, &aLangString );
+ return( pClassString );
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassBitmap()
+*************************************************************************/
+RscTop * RscTypCont::InitClassBitmap( RscTop * pSuper ){
+ HASHID nId;
+ RscTop * pClassBitmap;
+
+ nId = pHS->Insert( "Bitmap" );
+ pClassBitmap = new RscSysDepend( nId, RSC_BITMAP, pSuper );
+ pClassBitmap->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassBitmap );
+
+ // Die Klasse RscSysDepend behandelt die Variablen
+ // "FILE" gesondert
+ nId = aNmTb.Put( "File", VARNAME );
+ pClassBitmap->SetVariable( nId, &aLangString, NULL, VAR_NORC );
+
+ return( pClassBitmap );
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassColor()
+*************************************************************************/
+RscTop * RscTypCont::InitClassColor( RscTop * pSuper, RscEnum * pColor ){
+ HASHID nId;
+ RscTop * pClassColor;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Color" );
+ pClassColor = new RscClass( nId, RSC_COLOR, pSuper );
+ pClassColor->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassColor );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Red", VARNAME );
+ pClassColor->SetVariable( nId, &aUShort );
+ nId = aNmTb.Put( "Green", VARNAME );
+ pClassColor->SetVariable( nId, &aUShort );
+ nId = aNmTb.Put( "Blue", VARNAME );
+ pClassColor->SetVariable( nId, &aUShort );
+ nId = aNmTb.Put( "Predefine", VARNAME );
+ pClassColor->SetVariable( nId, pColor );
+
+ return( pClassColor );
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassImage()
+*************************************************************************/
+RscTop * RscTypCont::InitClassImage( RscTop * pSuper, RscTop * pClassBitmap,
+ RscTop * pClassColor )
+{
+ HASHID nId;
+ RscTop * pClassImage;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Image" );
+ pClassImage = new RscClass( nId, RSC_IMAGE, pSuper );
+ pClassImage->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassImage );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "ImageBitmap", VARNAME );
+ pClassImage->SetVariable( nId, pClassBitmap, NULL, 0, RSC_IMAGE_IMAGEBITMAP );
+ nId = aNmTb.Put( "MaskBitmap", VARNAME );
+ pClassImage->SetVariable( nId, pClassBitmap, NULL, 0, RSC_IMAGE_MASKBITMAP );
+ nId = aNmTb.Put( "MaskColor", VARNAME );
+ pClassImage->SetVariable( nId, pClassColor, NULL,
+ VAR_SVDYNAMIC, RSC_IMAGE_MASKCOLOR );
+
+ return( pClassImage );
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassImageList()
+*************************************************************************/
+RscTop * RscTypCont::InitClassImageList( RscTop * pSuper, RscTop * pClassBitmap,
+ RscTop * pClassColor )
+{
+ HASHID nId;
+ RscTop * pClassImageList;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ImageList" );
+ pClassImageList = new RscClass( nId, RSC_IMAGELIST, pSuper );
+ pClassImageList->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassImageList );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "ImageBitmap", VARNAME );
+ pClassImageList->SetVariable( nId, pClassBitmap, NULL, 0,
+ RSC_IMAGELIST_IMAGEBITMAP );
+ nId = aNmTb.Put( "MaskBitmap", VARNAME );
+ pClassImageList->SetVariable( nId, pClassBitmap, NULL, 0,
+ RSC_IMAGELIST_MASKBITMAP );
+ nId = aNmTb.Put( "MaskColor", VARNAME );
+ pClassImageList->SetVariable( nId, pClassColor, NULL,
+ VAR_SVDYNAMIC, RSC_IMAGELIST_MASKCOLOR );
+ {
+ RscCont * pCont;
+
+ pCont = new RscCont( pHS->Insert( "USHORT *" ), RSC_NOTYPE );
+ pCont->SetTypeClass( &aIdUShort );
+ aBaseLst.Insert( pCont, LIST_APPEND );
+
+ nId = aNmTb.Put( "IdList", VARNAME );
+ pClassImageList->SetVariable( nId, pCont, NULL, 0,
+ RSC_IMAGELIST_IDLIST );
+ }
+ nId = aNmTb.Put( "IdCount", VARNAME );
+ pClassImageList->SetVariable( nId, &aUShort, NULL, 0,
+ RSC_IMAGELIST_IDCOUNT );
+ return( pClassImageList );
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassWindow()
+*************************************************************************/
+RscTop * RscTypCont::InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
+ RscArray * pLangGeo )
+{
+ HASHID nId;
+ RscTop * pClassWindow;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Window" );
+ pClassWindow = new RscClass( nId, RSC_WINDOW, pSuper );
+ pClassWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassWindow );
+
+ // Variablen anlegen
+ {
+ RscFlag * pFlag;
+ RscClient * pClient;
+ HASHID nVarId, nDisableId, nOutputSizeId;
+
+ aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagWndExtra" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+
+ // Konstanten in Tabelle stellen
+ nDisableId = pHS->Insert( "RSWND_DISABLE" );
+ SETCONST( pFlag, nDisableId, RSWND_DISABLED );
+ nOutputSizeId = pHS->Insert( "RSWND_OUTPUTSIZE" );
+ SETCONST( pFlag, nOutputSizeId, RSWND_CLIENTSIZE );
+
+ // Variable einfuegen
+ nVarId = aNmTb.Put( "_RscExtraFlags", VARNAME );
+ pClassWindow->SetVariable( nVarId, pFlag, NULL,
+ VAR_HIDDEN | VAR_NOENUM );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nDisableId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "Disable", VARNAME );
+ pClassWindow->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nOutputSizeId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "OutputSize", VARNAME );
+ pClassWindow->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+ }
+
+ pClassWindow->SetVariable( nWinBitVarId, &aWinBits, NULL,
+ VAR_HIDDEN | VAR_NOENUM );
+
+ INS_WINBIT(pClassWindow,Border)
+ INS_WINBIT(pClassWindow,Hide)
+ INS_WINBIT(pClassWindow,ClipChildren)
+ INS_WINBIT(pClassWindow,SVLook)
+ InsWinBit( pClassWindow, "DialogControl", nTabControlId );
+
+ nId = aNmTb.Put( "HelpID", VARNAME );
+ pClassWindow->SetVariable( nId, &aIdLong );
+
+
+ nRsc_XYMAPMODEId = nId = aNmTb.Put( "_XYMapMode", VARNAME );
+ pClassWindow->SetVariable( nId, pMapUnit, NULL, 0, WINDOW_XYMAPMODE );
+ nRsc_X = nId = aNmTb.Put( "_X", VARNAME );
+ pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_X );
+ nRsc_Y = nId = aNmTb.Put( "_Y", VARNAME );
+ pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_Y );
+
+ nRsc_WHMAPMODEId = nId = aNmTb.Put( "_WHMapMode", VARNAME );
+ pClassWindow->SetVariable( nId, pMapUnit, NULL, 0, WINDOW_WHMAPMODE );
+ nRsc_WIDTH = nId = aNmTb.Put( "_Width", VARNAME );
+ pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_WIDTH );
+ nRsc_HEIGHT = nId = aNmTb.Put( "_Height", VARNAME );
+ pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_HEIGHT );
+
+ nRsc_DELTALANG = nId = aNmTb.Put( "DeltaLang", VARNAME );
+ pClassWindow->SetVariable( nId, pLangGeo, NULL, VAR_NORC | VAR_NOENUM);
+ nId = aNmTb.Put( "Text", VARNAME );
+ pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_TEXT );
+ nId = aNmTb.Put( "HelpText", VARNAME );
+ pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_HELPTEXT );
+ nId = aNmTb.Put( "QuickHelpText", VARNAME );
+ pClassWindow->SetVariable( nId, &aLangString, NULL, 0, WINDOW_QUICKTEXT );
+ nId = aNmTb.Put( "ExtraLong", VARNAME );
+ pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_EXTRALONG );
+ nId = aNmTb.Put( "UniqueId", VARNAME );
+ pClassWindow->SetVariable( nId, &aLong, NULL, 0, WINDOW_UNIQUEID );
+
+ return( pClassWindow );
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassSystemWindow()
+*************************************************************************/
+RscTop * RscTypCont::InitClassSystemWindow( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassSystemWindow;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "SystemWindow" );
+ pClassSystemWindow = new RscClass( nId, RSC_SYSWINDOW, pSuper );
+ pClassSystemWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassSystemWindow );
+
+ INS_WINBIT(pClassSystemWindow,Sizeable)
+ INS_WINBIT(pClassSystemWindow,Moveable)
+ InsWinBit( pClassSystemWindow, "Minable", nMinimizeId );
+ InsWinBit( pClassSystemWindow, "Maxable", nMaximizeId );
+ INS_WINBIT(pClassSystemWindow,Closeable)
+ INS_WINBIT(pClassSystemWindow,App)
+
+ return pClassSystemWindow ;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassWorkWindow()
+*************************************************************************/
+RscTop * RscTypCont::InitClassWorkWindow( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassWorkWindow;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "WorkWindow" );
+ pClassWorkWindow = new RscClass( nId, RSC_WORKWIN, pSuper );
+ pClassWorkWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassWorkWindow );
+
+ // Variablen anlegen
+ {
+ HASHID nVarId;
+ RscEnum * pShow;
+
+ aBaseLst.Insert( pShow = new RscEnum( pHS->Insert( "EnumShowState" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+
+ SETCONST( pShow, "SHOW_NORMAL", WORKWIN_SHOWNORMAL );
+ SETCONST( pShow, "SHOW_MINIMIZED", WORKWIN_SHOWMINIMIZED );
+ SETCONST( pShow, "SHOW_MAXIMIZED", WORKWIN_SHOWMAXIMIZED );
+
+
+ // Variable einfuegen
+ nVarId = aNmTb.Put( "Show", VARNAME );
+ pClassWorkWindow->SetVariable( nVarId, pShow, NULL );
+ }
+
+ return pClassWorkWindow;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassDialogBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassModalDialog( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassDialog;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ModalDialog" );
+ pClassDialog = new RscClass( nId, RSC_MODALDIALOG, pSuper );
+ pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassDialog );
+
+ InsWinBit( pClassDialog, "SysModal", nSysmodalId );
+
+ return pClassDialog;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassModelessDialog()
+*************************************************************************/
+RscTop * RscTypCont::InitClassModelessDialog( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassDialog;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ModelessDialog" );
+ pClassDialog = new RscClass( nId, RSC_MODELESSDIALOG, pSuper );
+ pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassDialog );
+
+ return pClassDialog;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassControl()
+*************************************************************************/
+RscTop * RscTypCont::InitClassControl( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassControl;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Control" );
+ pClassControl = new RscClass( nId, RSC_CONTROL, pSuper );
+ pClassControl->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassControl );
+
+ InsWinBit( pClassControl, "TabStop", nTabstopId );
+ INS_WINBIT(pClassControl,Group)
+
+ return pClassControl;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassPushButton()
+*************************************************************************/
+RscTop * RscTypCont::InitClassPushButton( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassPushButton;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "PushButton" );
+ pClassPushButton = new RscClass( nId, RSC_PUSHBUTTON, pSuper );
+ pClassPushButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassPushButton );
+
+ InsWinBit( pClassPushButton, "DefButton", nDefaultId );
+
+ return pClassPushButton;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassTriStateBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassTriStateBox( RscTop * pSuper,
+ RscEnum * pTriState )
+{
+ HASHID nId;
+ RscTop * pClassTriStateBox;
+
+ nId = pHS->Insert( "TriStateBox" );
+ pClassTriStateBox = new RscClass( nId, RSC_TRISTATEBOX, pSuper );
+ pClassTriStateBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassTriStateBox );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "State", VARNAME );
+ pClassTriStateBox->SetVariable( nId, pTriState );
+ nId = aNmTb.Put( "TriStateDisable", VARNAME );
+ pClassTriStateBox->SetVariable( nId, &aBool );
+
+ return( pClassTriStateBox );
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMenuButton()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMenuButton( RscTop * pSuper,
+ RscTop * pClassMenu )
+{
+ HASHID nId;
+ RscTop * pClassMenuButton;
+
+ nId = pHS->Insert( "MenuButton" );
+ pClassMenuButton = new RscClass( nId, RSC_MENUBUTTON, pSuper );
+ pClassMenuButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassMenuButton );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "ButtonMenu", VARNAME );
+ pClassMenuButton->SetVariable( nId, pClassMenu, NULL, 0,
+ RSCMENUBUTTON_MENU );
+
+ return( pClassMenuButton );
+}
+
+
+/*************************************************************************
+|* RscTypCont::InitClassImageButton()
+*************************************************************************/
+RscTop * RscTypCont::InitClassImageButton( RscTop * pSuper,
+ RscTop * pClassImage,
+ RscEnum * pTriState )
+{
+ HASHID nId;
+ RscTop * pClassImageButton;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ImageButton" );
+ pClassImageButton = new RscClass( nId, RSC_IMAGEBUTTON, pSuper );
+ pClassImageButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassImageButton );
+
+ // Variablen anlegen
+ {
+ nId = aNmTb.Put( "ButtonImage", VARNAME );
+ pClassImageButton->SetVariable( nId, pClassImage, NULL, 0,
+ RSC_IMAGEBUTTON_IMAGE );
+ }
+ // Variablen anlegen
+ {
+ HASHID nVarId;
+ RscEnum * pSymbol;
+
+ aBaseLst.Insert( pSymbol = new RscEnum( pHS->Insert( "EnumSymbolButton" ),
+ RSC_NOTYPE ), LIST_APPEND );
+
+ SETCONST( pSymbol, "IMAGEBUTTON_DONTKNOW", SYMBOL_DONTKNOW );
+ SETCONST( pSymbol, "IMAGEBUTTON_IMAGE", SYMBOL_IMAGE );
+ SETCONST( pSymbol, "IMAGEBUTTON_ARROW_UP", SYMBOL_ARROW_UP );
+ SETCONST( pSymbol, "IMAGEBUTTON_ARROW_DOWN", SYMBOL_ARROW_DOWN );
+ SETCONST( pSymbol, "IMAGEBUTTON_ARROW_LEFT", SYMBOL_ARROW_LEFT );
+ SETCONST( pSymbol, "IMAGEBUTTON_ARROW_RIGHT", SYMBOL_ARROW_RIGHT );
+ SETCONST( pSymbol, "IMAGEBUTTON_SPIN_UP", SYMBOL_SPIN_UP );
+ SETCONST( pSymbol, "IMAGEBUTTON_SPIN_DOWN", SYMBOL_SPIN_DOWN );
+ SETCONST( pSymbol, "IMAGEBUTTON_SPIN_LEFT", SYMBOL_SPIN_LEFT );
+ SETCONST( pSymbol, "IMAGEBUTTON_SPIN_RIGHT", SYMBOL_SPIN_RIGHT );
+ SETCONST( pSymbol, "IMAGEBUTTON_FIRST", SYMBOL_FIRST );
+ SETCONST( pSymbol, "IMAGEBUTTON_LAST", SYMBOL_LAST );
+ SETCONST( pSymbol, "IMAGEBUTTON_PREV", SYMBOL_PREV );
+ SETCONST( pSymbol, "IMAGEBUTTON_NEXT", SYMBOL_NEXT );
+ SETCONST( pSymbol, "IMAGEBUTTON_PAGEUP", SYMBOL_PAGEUP );
+ SETCONST( pSymbol, "IMAGEBUTTON_PAGEDOWN", SYMBOL_PAGEDOWN );
+ SETCONST( pSymbol, "IMAGEBUTTON_PLAY", SYMBOL_PLAY );
+ SETCONST( pSymbol, "IMAGEBUTTON_REVERSEPLAY", SYMBOL_REVERSEPLAY );
+ SETCONST( pSymbol, "IMAGEBUTTON_STOP", SYMBOL_STOP );
+ SETCONST( pSymbol, "IMAGEBUTTON_PAUSE", SYMBOL_PAUSE );
+ SETCONST( pSymbol, "IMAGEBUTTON_WINDSTART", SYMBOL_WINDSTART );
+ SETCONST( pSymbol, "IMAGEBUTTON_WINDEND", SYMBOL_WINDEND );
+ SETCONST( pSymbol, "IMAGEBUTTON_WINDBACKWARD", SYMBOL_WINDBACKWARD );
+ SETCONST( pSymbol, "IMAGEBUTTON_WINDFORWARD", SYMBOL_WINDFORWARD );
+
+ // Variable einfuegen
+ nVarId = aNmTb.Put( "Symbol", VARNAME );
+ pClassImageButton->SetVariable( nVarId, pSymbol, NULL, 0,
+ RSC_IMAGEBUTTON_SYMBOL );
+ }
+ nId = aNmTb.Put( "State", VARNAME );
+ pClassImageButton->SetVariable( nId, pTriState, NULL, 0,
+ RSC_IMAGEBUTTON_STATE );
+
+ INS_WINBIT(pClassImageButton,Repeat)
+ INS_WINBIT(pClassImageButton,SmallStyle)
+ INS_WINBIT(pClassImageButton,RectStyle)
+
+ return pClassImageButton;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassEdit()
+*************************************************************************/
+RscTop * RscTypCont::InitClassEdit( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassEdit;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Edit" );
+ pClassEdit = new RscClass( nId, RSC_EDIT, pSuper );
+ pClassEdit->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassEdit );
+
+ INS_WINBIT(pClassEdit,Left)
+ INS_WINBIT(pClassEdit,Center)
+ INS_WINBIT(pClassEdit,Right)
+ INS_WINBIT(pClassEdit,PassWord)
+ INS_WINBIT(pClassEdit,ReadOnly)
+
+ nId = aNmTb.Put( "MaxTextLength", VARNAME );
+ pClassEdit->SetVariable( nId, &aUShort );
+
+ return pClassEdit;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMultiLineedit()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMultiLineEdit( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassMultiLineEdit;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MultiLineEdit" );
+ pClassMultiLineEdit = new RscClass( nId, RSC_MULTILINEEDIT, pSuper );
+ pClassMultiLineEdit->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassMultiLineEdit );
+
+ InsWinBit( pClassMultiLineEdit, "HScroll", nHscrollId );
+ InsWinBit( pClassMultiLineEdit, "VScroll", nVscrollId );
+ INS_WINBIT( pClassMultiLineEdit, IgnoreTab );
+
+ return pClassMultiLineEdit;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassScrollBar()
+*************************************************************************/
+RscTop * RscTypCont::InitClassScrollBar( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassScrollBar;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ScrollBar" );
+ pClassScrollBar = new RscClass( nId, RSC_SCROLLBAR, pSuper );
+ pClassScrollBar->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassScrollBar );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "MinPos", VARNAME );
+ pClassScrollBar->SetVariable( nId, &aShort );
+ {
+ RSCINST aDfltI;
+
+ aDfltI = aShort.Create( NULL, RSCINST(), FALSE );
+ aDfltI.pClass->SetNumber( aDfltI, 100 );
+// aDfltI.pClass->MakeDefault( aDfltI );
+
+ nId = aNmTb.Put( "MaxPos", VARNAME );
+ pClassScrollBar->SetVariable( nId, &aShort, &aDfltI );
+ }
+ nId = aNmTb.Put( "ThumbPos", VARNAME );
+ pClassScrollBar->SetVariable( nId, &aShort );
+ {
+ RSCINST aDfltI;
+
+ aDfltI = aShort.Create( NULL, RSCINST(), FALSE );
+ aDfltI.pClass->SetNumber( aDfltI, 1 );
+// aDfltI.pClass->MakeDefault( aDfltI );
+
+ nId = aNmTb.Put( "PageSize", VARNAME);
+ pClassScrollBar->SetVariable( nId, &aShort, &aDfltI );
+ }
+ {
+ RSCINST aDfltI;
+
+ aDfltI = aShort.Create( NULL, RSCINST(), FALSE );
+ aDfltI.pClass->SetNumber( aDfltI, 1 );
+// aDfltI.pClass->MakeDefault( aDfltI );
+ nId = aNmTb.Put( "LineSize", VARNAME );
+ pClassScrollBar->SetVariable( nId, &aShort, &aDfltI );
+ }
+ nId = aNmTb.Put( "VisibleSize", VARNAME );
+ pClassScrollBar->SetVariable( nId, &aShort );
+
+ InsWinBit( pClassScrollBar, "HScroll", nHscrollId );
+ InsWinBit( pClassScrollBar, "VScroll", nVscrollId );
+ INS_WINBIT(pClassScrollBar,Drag)
+
+ return pClassScrollBar;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassListBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassListBox( RscTop * pSuper, RscArray * pStrLst )
+{
+ HASHID nId;
+ RscTop * pClassListBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ListBox" );
+ pClassListBox = new RscClass( nId, RSC_LISTBOX, pSuper );
+ pClassListBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassListBox );
+
+ // Variablen anlegen
+ INS_WINBIT(pClassListBox,Sort)
+ INS_WINBIT(pClassListBox,DropDown)
+ InsWinBit( pClassListBox, "HScroll", nHscrollId );
+ InsWinBit( pClassListBox, "VScroll", nVscrollId );
+ INS_WINBIT(pClassListBox,AutoSize)
+ INS_WINBIT(pClassListBox,AutoHScroll)
+ INS_WINBIT(pClassListBox,DDExtraWidth)
+
+ {
+ RSCINST aDflt = aUShort.Create( NULL, RSCINST(), FALSE );
+ aDflt.pClass->SetNumber( aDflt, (USHORT)0xFFFF );
+ nId = aNmTb.Put( "CurPos", VARNAME );
+ pClassListBox->SetVariable( nId, &aUShort, &aDflt );
+ }
+ nId = aNmTb.Put( "StringList", VARNAME );
+ pClassListBox->SetVariable( nId, pStrLst );
+
+ return pClassListBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMultiListBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMultiListBox( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassMultiListBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MultiListBox" );
+ pClassMultiListBox = new RscClass( nId, RSC_MULTILISTBOX, pSuper );
+ pClassMultiListBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassMultiListBox );
+
+ INS_WINBIT(pClassMultiListBox,SimpleMode)
+
+ return pClassMultiListBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassComboBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassComboBox( RscTop * pSuper, RscArray * pStrLst )
+{
+ HASHID nId;
+ RscTop * pClassComboBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ComboBox" );
+ pClassComboBox = new RscClass( nId, RSC_COMBOBOX, pSuper );
+ pClassComboBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassComboBox );
+
+ // Variablen anlegen
+ INS_WINBIT(pClassComboBox,DropDown)
+ INS_WINBIT(pClassComboBox,Sort)
+ InsWinBit( pClassComboBox, "HScroll", nHscrollId );
+ InsWinBit( pClassComboBox, "VScroll", nVscrollId );
+ INS_WINBIT(pClassComboBox,AutoSize)
+ INS_WINBIT(pClassComboBox,AutoHScroll)
+ INS_WINBIT(pClassComboBox,DDExtraWidth)
+
+ nId = aNmTb.Put( "StringList", VARNAME );
+ pClassComboBox->SetVariable( nId, pStrLst );
+
+ return pClassComboBox;
+}
+
+#ifdef MAC
+#pragma segment rsctypcont
+#endif
+
+/*************************************************************************
+|* RscTypCont::InitClassFixedText()
+*************************************************************************/
+RscTop * RscTypCont::InitClassFixedText( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassFixedText;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "FixedText" );
+ pClassFixedText = new RscClass( nId, RSC_TEXT, pSuper );
+ pClassFixedText->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassFixedText );
+
+ // Variablen anlegen
+ INS_WINBIT(pClassFixedText,Left)
+ INS_WINBIT(pClassFixedText,Center)
+ INS_WINBIT(pClassFixedText,Right)
+ INS_WINBIT(pClassFixedText,WordBreak)
+ INS_WINBIT(pClassFixedText,LeftLabel)
+ INS_WINBIT(pClassFixedText,NoLabel)
+
+ return pClassFixedText;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassFixedBitmap()
+*************************************************************************/
+RscTop * RscTypCont::InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap )
+{
+ HASHID nId;
+ RscTop * pClassFixedBitmap;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "FixedBitmap" );
+ pClassFixedBitmap = new RscClass( nId, RSC_FIXEDBITMAP, pSuper );
+ pClassFixedBitmap->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassFixedBitmap );
+
+ INS_WINBIT(pClassFixedBitmap,Scale)
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Fixed", VARNAME );
+ pClassFixedBitmap->SetVariable( nId, pClassBitmap, 0, 0, RSC_FIXEDBITMAP_BITMAP );
+
+ return pClassFixedBitmap;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassFixedImage()
+*************************************************************************/
+RscTop * RscTypCont::InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage )
+{
+ HASHID nId;
+ RscTop * pClassFixedImage;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "FixedImage" );
+ pClassFixedImage = new RscClass( nId, RSC_FIXEDIMAGE, pSuper );
+ pClassFixedImage->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassFixedImage );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Fixed", VARNAME );
+ pClassFixedImage->SetVariable( nId, pClassImage, 0, 0, RSC_FIXEDIMAGE_IMAGE );
+
+ return pClassFixedImage;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassImageRadioButton()
+*************************************************************************/
+RscTop * RscTypCont::InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage )
+{
+ HASHID nId;
+ RscTop * pClassImageRadioButton;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ImageRadioButton" );
+ pClassImageRadioButton = new RscClass( nId, RSC_IMAGERADIOBUTTON, pSuper );
+ pClassImageRadioButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassImageRadioButton );
+
+ // Variablen anlegen
+ INS_WINBIT(pClassImageRadioButton,TopImage)
+ nId = aNmTb.Put( "RadioButtonImage", VARNAME );
+ pClassImageRadioButton->SetVariable( nId, pClassImage, 0, 0, RSC_IMAGERADIOBUTTON_IMAGE );
+
+ return pClassImageRadioButton;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassKeyCode()
+*************************************************************************/
+RscTop * RscTypCont::InitClassKeyCode( RscTop * pSuper, RscEnum * pKey )
+{
+ HASHID nId;
+ RscTop * pClassKeyCode;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "KeyCode" );
+ pClassKeyCode = new RscClass( nId, RSC_KEYCODE, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassKeyCode );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Code", VARNAME );
+ pClassKeyCode->SetVariable( nId, pKey );
+
+ {
+ RscFlag * pFlag;
+ RscClient * pClient;
+ HASHID nVarId, nShiftId, nMod1Id, nMod2Id;
+
+ aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagKeyModifier" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+
+ // Konstanten in Tabelle stellen
+ nShiftId = pHS->Insert( "KEY_SHIFT" );
+ SETCONST( pFlag, nShiftId, KEY_SHIFT );
+ nMod1Id = pHS->Insert( "KEY_MOD1" );
+ SETCONST( pFlag, nMod1Id, KEY_MOD1 );
+ nMod2Id = pHS->Insert( "KEY_MOD2" );
+ SETCONST( pFlag, nMod2Id, KEY_MOD2 );
+
+ // Variable einfuegen
+ nVarId = aNmTb.Put( "_ModifierFlags", VARNAME );
+ pClassKeyCode->SetVariable( nVarId, pFlag, NULL,
+ VAR_HIDDEN | VAR_NOENUM );
+
+ // Clientvariablen einfuegen
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nShiftId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "Shift", VARNAME );
+ pClassKeyCode->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nMod1Id ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "Modifier1", VARNAME );
+ pClassKeyCode->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nMod2Id ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "Modifier2", VARNAME );
+ pClassKeyCode->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+ }
+ {
+ HASHID nVarId;
+ RscEnum * pKeyFunc;
+
+ aBaseLst.Insert( pKeyFunc = new RscEnum( pHS->Insert( "EnumKeyFunc" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+
+ SETCONST( pKeyFunc, "KEYFUNC_DONTKNOW", KEYFUNC_DONTKNOW );
+ SETCONST( pKeyFunc, "KEYFUNC_NEW", KEYFUNC_NEW );
+ SETCONST( pKeyFunc, "KEYFUNC_OPEN", KEYFUNC_OPEN );
+ SETCONST( pKeyFunc, "KEYFUNC_SAVE", KEYFUNC_SAVE );
+ SETCONST( pKeyFunc, "KEYFUNC_SAVEAS", KEYFUNC_SAVEAS );
+ SETCONST( pKeyFunc, "KEYFUNC_PRINT", KEYFUNC_PRINT );
+ SETCONST( pKeyFunc, "KEYFUNC_CLOSE", KEYFUNC_CLOSE );
+ SETCONST( pKeyFunc, "KEYFUNC_QUIT", KEYFUNC_QUIT );
+ SETCONST( pKeyFunc, "KEYFUNC_CUT", KEYFUNC_CUT );
+ SETCONST( pKeyFunc, "KEYFUNC_COPY", KEYFUNC_COPY );
+ SETCONST( pKeyFunc, "KEYFUNC_PASTE", KEYFUNC_PASTE );
+ SETCONST( pKeyFunc, "KEYFUNC_UNDO", KEYFUNC_UNDO );
+ SETCONST( pKeyFunc, "KEYFUNC_REDO", KEYFUNC_REDO );
+ SETCONST( pKeyFunc, "KEYFUNC_DELETE", KEYFUNC_DELETE );
+ SETCONST( pKeyFunc, "KEYFUNC_REPEAT", KEYFUNC_REPEAT );
+ SETCONST( pKeyFunc, "KEYFUNC_FIND", KEYFUNC_FIND );
+ SETCONST( pKeyFunc, "KEYFUNC_PROPERTIES", KEYFUNC_PROPERTIES );
+ SETCONST( pKeyFunc, "KEYFUNC_FRONT", KEYFUNC_FRONT );
+ SETCONST( pKeyFunc, "KEYFUNC_FINDBACKWARD", KEYFUNC_FINDBACKWARD );
+ // Variable einfuegen
+ nVarId = aNmTb.Put( "Function", VARNAME );
+ pClassKeyCode->SetVariable( nVarId, pKeyFunc, NULL );
+ }
+
+ return pClassKeyCode;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassAccelItem()
+*************************************************************************/
+RscTop * RscTypCont::InitClassAccelItem( RscTop * pSuper,
+ RscTop * pClassKeyCode )
+{
+ HASHID nId;
+ RscTop * pClassAccelItem;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "AcceleratorItem" );
+ pClassAccelItem = new RscClass( nId, RSC_ACCELITEM, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassAccelItem );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Identifier", VARNAME );
+ pClassAccelItem->SetVariable( nId, &aIdNoZeroUShort );
+ nId = aNmTb.Put( "Disable", VARNAME );
+ pClassAccelItem->SetVariable( nId, &aBool );
+ nId = aNmTb.Put( "Key", VARNAME );
+ pClassAccelItem->SetVariable( nId, pClassKeyCode, NULL, 0,
+ ACCELITEM_KEY );
+
+ return pClassAccelItem;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassAccelm()
+*************************************************************************/
+RscTop * RscTypCont::InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem )
+{
+ HASHID nId;
+ RscTop * pClassAccel;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Accelerator" );
+ pClassAccel = new RscClass( nId, RSC_ACCEL, pSuper );
+ pClassAccel->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassAccel );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "HelpText", VARNAME );
+ pClassAccel->SetVariable( nId, &aLangString );
+ {
+ RscCont * pCont;
+
+ aBaseLst.Insert( pCont = new RscCont(
+ pHS->Insert( "ContAcceleratorKey" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+ pCont->SetTypeClass( pClassAccelItem );
+ nId = aNmTb.Put( "ItemList", VARNAME );
+ pClassAccel->SetVariable( nId, pCont );
+ }
+
+ return pClassAccel;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMenuItem()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMenuItem( RscTop * pSuper,
+ RscTop * pClassBitmap,
+ RscTop * pClassKeyCode )
+{
+ HASHID nId;
+ RscTop * pClassMenuItem;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MenuItem" );
+ pClassMenuItem = new RscClass( nId, RSC_MENUITEM, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassMenuItem );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Separator", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aBool, NULL, 0,
+ RSC_MENUITEM_SEPARATOR );
+ nId = aNmTb.Put( "Identifier", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0,
+ RSC_MENUITEM_ID );
+ {
+ RscFlag * pFlag;
+ RscClient * pClient;
+ HASHID nVarId, nAutoCheckId, nRadioCheckId;
+ HASHID nCheckableId, nAboutId, nHelpId;
+
+ aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagMenuState" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+
+ // Konstanten in Tabelle stellen
+ nCheckableId = pHS->Insert( "MIB_CHECKABLE" );
+ SETCONST( pFlag, nCheckableId, MIB_CHECKABLE );
+ nAutoCheckId = pHS->Insert( "MIB_AUTOCHECK" );
+ SETCONST( pFlag, nAutoCheckId, MIB_AUTOCHECK );
+ nRadioCheckId = pHS->Insert( "MIB_RADIOCHECK" );
+ SETCONST( pFlag, nRadioCheckId, MIB_RADIOCHECK );
+ nAboutId = pHS->Insert( "MIB_ABOUT" );
+ SETCONST( pFlag, nAboutId, MIB_ABOUT );
+ nHelpId = pHS->Insert( "MIB_HELP" );
+ SETCONST( pFlag, nHelpId, MIB_HELP );
+
+ // Variable einfuegen
+ nVarId = aNmTb.Put( "_MenuItemFlags", VARNAME );
+ pClassMenuItem->SetVariable( nVarId, pFlag, NULL,
+ VAR_HIDDEN | VAR_NOENUM,
+ RSC_MENUITEM_STATUS );
+
+ // Clientvariablen einfuegen
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nCheckableId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "Checkable", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nAutoCheckId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "AutoCheck", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nRadioCheckId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "RadioCheck", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nAboutId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "About", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nHelpId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "Help", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nVarId );
+
+ }
+ nId = aNmTb.Put( "Text", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_MENUITEM_TEXT );
+ nId = aNmTb.Put( "ItemBitmap", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClassBitmap, NULL, 0,
+ RSC_MENUITEM_BITMAP );
+ nId = aNmTb.Put( "HelpText", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_MENUITEM_HELPTEXT );
+ nId = aNmTb.Put( "HelpID", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aIdLong, NULL, 0,
+ RSC_MENUITEM_HELPID );
+ nId = aNmTb.Put( "AccelKey", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClassKeyCode, NULL, 0,
+ RSC_MENUITEM_KEYCODE );
+ nId = aNmTb.Put( "Check", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aBool, NULL, 0,
+ RSC_MENUITEM_CHECKED );
+ nId = aNmTb.Put( "Disable", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aBool, NULL, 0,
+ RSC_MENUITEM_DISABLE );
+ nId = aNmTb.Put( "Command", VARNAME );
+ pClassMenuItem->SetVariable( nId, &aString, NULL, 0,
+ RSC_MENUITEM_COMMAND );
+
+ return pClassMenuItem;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMenu()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMenu( RscTop * pSuper,
+ RscTop * pClassMenuItem )
+{
+ HASHID nId;
+ RscTop * pClassMenu;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Menu" );
+ pClassMenu = new RscClass( nId, RSC_MENU, pSuper );
+ pClassMenu->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassMenu );
+
+ // Variablen anlegen
+ {
+ RscCont * pCont;
+
+ aBaseLst.Insert( pCont = new RscCont( pHS->Insert( "ContMenuItem" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+ pCont->SetTypeClass( pClassMenuItem );
+ nId = aNmTb.Put( "ItemList", VARNAME );
+ pClassMenu->SetVariable( nId, pCont, NULL, 0, RSC_MENU_ITEMS );
+ }
+ nId = aNmTb.Put( "Text", VARNAME );
+ pClassMenu->SetVariable( nId, &aLangString, NULL, 0, RSC_MENU_TEXT );
+ nId = aNmTb.Put( "DefaultItemId", VARNAME );
+ pClassMenu->SetVariable( nId, &aIdUShort, NULL, 0,
+ RSC_MENU_DEFAULTITEMID );
+
+ return pClassMenu;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMessageBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMessBox( RscTop * pSuper,
+ RscEnum * pMessButtons,
+ RscEnum * pMessDefButton )
+{
+ HASHID nId;
+ RscTop * pClassMessBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MessBox" );
+ pClassMessBox = new RscClass( nId, RSC_MESSBOX, pSuper );
+ pClassMessBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassMessBox );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Buttons", VARNAME );
+ pClassMessBox->SetVariable( nId, pMessButtons );
+ nId = aNmTb.Put( "DefButton", VARNAME );
+ pClassMessBox->SetVariable( nId, pMessDefButton );
+ nId = aNmTb.Put( "HelpID", VARNAME );
+ pClassMessBox->SetVariable( nId, &aIdLong );
+ nId = aNmTb.Put( "SysModal", VARNAME );
+ pClassMessBox->SetVariable( nId, &aBool );
+ nId = aNmTb.Put( "Title", VARNAME );
+ pClassMessBox->SetVariable( nId, &aLangString );
+ nId = aNmTb.Put( "Message", VARNAME );
+ pClassMessBox->SetVariable( nId, &aLangString );
+ nId = aNmTb.Put( "HelpText", VARNAME );
+ pClassMessBox->SetVariable( nId, &aLangString );
+
+ return pClassMessBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassSplitter()
+*************************************************************************/
+RscTop * RscTypCont::InitClassSplitter( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassSplitter;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Splitter" );
+ pClassSplitter = new RscClass( nId, RSC_SPLITTER, pSuper );
+ pClassSplitter->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassSplitter );
+
+ InsWinBit( pClassSplitter, "HScroll", nHscrollId );
+ InsWinBit( pClassSplitter, "VScroll", nVscrollId );
+
+ return pClassSplitter;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassSplitWindow()
+*************************************************************************/
+RscTop * RscTypCont::InitClassSplitWindow( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassSplitWindow;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "SplitWindow" );
+ pClassSplitWindow = new RscClass( nId, RSC_SPLITWINDOW, pSuper );
+ pClassSplitWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassSplitWindow );
+
+ INS_WINBIT(pClassSplitWindow,Sizeable)
+ INS_WINBIT(pClassSplitWindow,NoSplitDraw)
+
+ return pClassSplitWindow;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassTime()
+*************************************************************************/
+RscTop * RscTypCont::InitClassTime( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassTime;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Time" );
+ pClassTime = new RscClass( nId, RSC_TIME, pSuper );
+ pClassTime->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassTime );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Hour", VARNAME );
+ pClassTime->SetVariable( nId, &a0to23Short, NULL, 0, TIME_HOUR );
+
+ nId = aNmTb.Put( "Minute", VARNAME );
+ pClassTime->SetVariable( nId, &a0to59Short, NULL, 0, TIME_MINUTE );
+
+ nId = aNmTb.Put( "Second", VARNAME );
+ pClassTime->SetVariable( nId, &a0to59Short, NULL, 0, TIME_SECOND );
+
+ nId = aNmTb.Put( "Sec100", VARNAME ); // weiss noch nich
+ pClassTime->SetVariable( nId, &a0to99Short, NULL, 0, TIME_SEC100 );
+
+ return pClassTime;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassDate()
+*************************************************************************/
+RscTop * RscTypCont::InitClassDate( RscTop * pSuper, RscEnum * /*pDayOfWeek*/ )
+{
+ HASHID nId;
+ RscTop * pClassDate;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "Date" );
+ pClassDate = new RscClass( nId, RSC_DATE, pSuper );
+ pClassDate->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassDate );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Year", VARNAME );
+ pClassDate->SetVariable( nId, &a0to9999Short, NULL, 0, DATE_YEAR );
+
+ nId = aNmTb.Put( "Month", VARNAME );
+ pClassDate->SetVariable( nId, &a1to12Short, NULL, 0, DATE_MONTH );
+
+ nId = aNmTb.Put( "Day", VARNAME );
+ pClassDate->SetVariable( nId, &a1to31Short, NULL, 0, DATE_DAY );
+
+ return pClassDate;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassInt1()
+*************************************************************************/
+RscTop * RscTypCont::InitClassInt1( RscTop * pSuper,
+ RscEnum * pDateFormat,
+ RscEnum * pTimeFormat, RscEnum * pDayOfWeekFormat,
+ RscEnum * pMonthFormat )
+{
+ HASHID nId;
+ RscTop * pClassInt;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "SubInternational" );
+ pClassInt = new RscClass( nId, RSC_NOTYPE, pSuper );
+ //pClassInt->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Language", VARNAME );
+ pClassInt->SetVariable( nId, &aLangType, NULL, 0, INT1_LANGUAGE );
+
+ nId = aNmTb.Put( "FormatLanguage", VARNAME );
+ pClassInt->SetVariable( nId, &aLangType, NULL, 0, INT1_FORMATLANGUAGE );
+
+ nId = aNmTb.Put( "DateFormat", VARNAME );
+ pClassInt->SetVariable( nId, pDateFormat, NULL, 0, INT1_DATEFORMAT );
+
+ nId = aNmTb.Put( "DateDayLeadingZero", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_DATEDAYLEADINDZERO );
+
+ nId = aNmTb.Put( "DateMonthLeadingZero", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_DATEMONTHLEADINDZERO );
+
+ nId = aNmTb.Put( "DateCentury", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_DATECENTURY );
+
+ nId = aNmTb.Put( "LongDateFormat", VARNAME );
+ pClassInt->SetVariable( nId, pDateFormat, NULL, 0, INT1_LONGDATEFORMAT );
+
+ nId = aNmTb.Put( "LongDateDayOfWeekFormat", VARNAME );
+ pClassInt->SetVariable( nId, pDayOfWeekFormat, NULL, 0,
+ INT1_LONGDATEDAYOFWEEKFORMAT );
+
+ nId = aNmTb.Put( "LongDateDayOfWeekSep", VARNAME );
+ pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEDAYOFWEEKSEP );
+
+ nId = aNmTb.Put( "LongDateDayLeadingZero", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0,
+ INT1_LONGDATEDAYLEADINGZERO );
+
+ nId = aNmTb.Put( "LongDateDaySep", VARNAME );
+ pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEDAYSEP );
+
+ nId = aNmTb.Put( "LongDateMonthFormat", VARNAME );
+ pClassInt->SetVariable( nId, pMonthFormat, NULL, 0,
+ INT1_LONGDATEMONTHFORMAT );
+
+ nId = aNmTb.Put( "LongDateMonthSep", VARNAME );
+ pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEMONTHSEP );
+
+ nId = aNmTb.Put( "LongDateCentury", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0, INT1_LONGDATECENTURY );
+
+ nId = aNmTb.Put( "LongDateYearSep", VARNAME );
+ pClassInt->SetVariable( nId, &aString, NULL, 0, INT1_LONGDATEYEARSEP );
+
+ nId = aNmTb.Put( "TimeFormat", VARNAME );
+ pClassInt->SetVariable( nId, pTimeFormat, NULL, 0, INT1_TIMEFORMAT );
+
+ // Maske voll zweite Struktur anfangen
+
+ return pClassInt;
+}
+
+
+/*************************************************************************
+|* RscTypCont::InitClassInternational()
+*************************************************************************/
+RscTop * RscTypCont::InitClassInternational( RscTop * pSuper,
+ RscEnum * /*pDateFormat*/,
+ RscEnum * /*pTimeFormat*/, RscEnum * /*pWeekDayFormat*/,
+ RscEnum * /*pMonthFormat*/ )
+{
+ HASHID nId;
+ RscTop * pClassInt;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "International" );
+ pClassInt = new RscClass( nId, RSC_INTERNATIONAL, pSuper );
+ pClassInt->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassInt );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "TimeLeadingZero", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0, INT2_TIMELEADINGZERO );
+
+ nId = aNmTb.Put( "TimeAM", VARNAME );
+ pClassInt->SetVariable( nId, &aString, NULL, 0, INT2_TIMEAM );
+
+ nId = aNmTb.Put( "TimePM", VARNAME );
+ pClassInt->SetVariable( nId, &aString, NULL, 0, INT2_TIMEPM );
+
+ nId = aNmTb.Put( "NumLeadingZero", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0, INT2_NUMLEADINGZERO );
+
+ nId = aNmTb.Put( "NumDigits", VARNAME );
+ pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_NUMDIGITS );
+
+ nId = aNmTb.Put( "CurrPositiveFormat", VARNAME );
+ pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_CURRPOSITIVEFORMAT );
+
+ nId = aNmTb.Put( "CurrNegativeFormat", VARNAME );
+ pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_CURRNEGATIVEFORMAT );
+
+ nId = aNmTb.Put( "CurrDigits", VARNAME );
+ pClassInt->SetVariable( nId, &aUShort, NULL, 0, INT2_CURRDIGITS );
+
+ nId = aNmTb.Put( "NumTrailingZeros", VARNAME );
+ pClassInt->SetVariable( nId, &aBool, NULL, 0, INT2_NUMTRAILINGZEROS );
+
+ return pClassInt;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassPatternFormatter()
+*************************************************************************/
+RscTop * RscTypCont::InitClassPatternFormatter( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassPattern;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "PatternFormatter" );
+ pClassPattern = new RscClass( nId, RSC_NOTYPE, pSuper );
+ pClassPattern->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "StrictFormat", VARNAME );
+ pClassPattern->SetVariable( nId, &aBool, NULL,
+ 0, PATTERNFORMATTER_STRICTFORMAT );
+ nId = aNmTb.Put( "EditMask", VARNAME );
+ pClassPattern->SetVariable( nId, &aLangString, NULL,
+ 0, PATTERNFORMATTER_EDITMASK );
+ nId = aNmTb.Put( "LiteralMask", VARNAME );
+ pClassPattern->SetVariable( nId, &aLangString, NULL,
+ 0, PATTERNFORMATTER_LITTERALMASK );
+
+ return pClassPattern;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassNumericFormatter()
+*************************************************************************/
+RscTop * RscTypCont::InitClassNumericFormatter( RscTop * pSuper,
+ RscTop * pClassI12 )
+{
+ HASHID nId;
+ RscTop * pClassNumeric;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "NumericFormatter" );
+ pClassNumeric = new RscClass( nId, RSC_NOTYPE, pSuper );
+ pClassNumeric->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Minimum", VARNAME );
+ pClassNumeric->SetVariable( nId, &aIdLong, NULL,
+ 0, NUMERICFORMATTER_MIN );
+ nId = aNmTb.Put( "Maximum", VARNAME );
+ pClassNumeric->SetVariable( nId, &aIdLong, NULL,
+ 0, NUMERICFORMATTER_MAX );
+ nId = aNmTb.Put( "StrictFormat", VARNAME );
+ pClassNumeric->SetVariable( nId, &aBool, NULL,
+ 0, NUMERICFORMATTER_STRICTFORMAT );
+ nId = aNmTb.Put( "Intnl", VARNAME );
+ pClassNumeric->SetVariable( nId, pClassI12, NULL,
+ 0, NUMERICFORMATTER_I12 );
+ nId = aNmTb.Put( "DecimalDigits", VARNAME );
+ pClassNumeric->SetVariable( nId, &aUShort, NULL,
+ 0, NUMERICFORMATTER_DECIMALDIGITS );
+ nId = aNmTb.Put( "Value", VARNAME );
+ pClassNumeric->SetVariable( nId, &aIdLong, NULL,
+ 0, NUMERICFORMATTER_VALUE );
+
+ return pClassNumeric;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMetricFormatter()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMetricFormatter( RscTop * pSuper,
+ RscEnum * pFieldUnits )
+{
+ HASHID nId;
+ RscTop * pClassMetric;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MetricFormatter" );
+ pClassMetric = new RscClass( nId, RSC_NOTYPE, pSuper );
+ pClassMetric->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Unit", VARNAME );
+ pClassMetric->SetVariable( nId, pFieldUnits, NULL,
+ 0, METRICFORMATTER_UNIT );
+ nId = aNmTb.Put( "CustomUnitText", VARNAME );
+ pClassMetric->SetVariable( nId, &aLangString, NULL,
+ 0, METRICFORMATTER_CUSTOMUNITTEXT );
+
+ return pClassMetric;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassCurrencyFormatter()
+*************************************************************************/
+RscTop * RscTypCont::InitClassCurrencyFormatter
+(
+ RscTop * pSuper,
+ RscEnum * /* pFieldUnits */)
+{
+ HASHID nId;
+ RscTop * pClassCurrency;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "CurrencyFormatter" );
+ pClassCurrency = new RscClass( nId, RSC_NOTYPE, pSuper );
+ pClassCurrency->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ return pClassCurrency;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassDateFormatter()
+*************************************************************************/
+RscTop * RscTypCont::InitClassDateFormatter( RscTop * pSuper,
+ RscTop * pClassDate, RscTop * pClassI12 )
+{
+ HASHID nId;
+ RscTop * pClassDateF;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "DateFormatter" );
+ pClassDateF = new RscClass( nId, RSC_NOTYPE, pSuper );
+ pClassDateF->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Minimum", VARNAME );
+ pClassDateF->SetVariable( nId, pClassDate, NULL,
+ 0, DATEFORMATTER_MIN );
+ nId = aNmTb.Put( "Maximum", VARNAME );
+ pClassDateF->SetVariable( nId, pClassDate, NULL,
+ 0, DATEFORMATTER_MAX );
+ nId = aNmTb.Put( "LongFormat", VARNAME );
+ pClassDateF->SetVariable( nId, &aBool, NULL,
+ 0, DATEFORMATTER_LONGFORMAT );
+ nId = aNmTb.Put( "StrictFormat", VARNAME );
+ pClassDateF->SetVariable( nId, &aBool, NULL,
+ 0, DATEFORMATTER_STRICTFORMAT );
+ nId = aNmTb.Put( "Intnl", VARNAME );
+ pClassDateF->SetVariable( nId, pClassI12, NULL,
+ 0, DATEFORMATTER_I12 );
+ nId = aNmTb.Put( "Value", VARNAME );
+ pClassDateF->SetVariable( nId, pClassDate, NULL,
+ 0, DATEFORMATTER_VALUE );
+
+ return pClassDateF;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassTimeFormatter()
+*************************************************************************/
+RscTop * RscTypCont::InitClassTimeFormatter( RscTop * pSuper,
+ RscTop * pClassTime, RscTop * pClassI12,
+ RscEnum * pTimeFieldFormat )
+{
+ HASHID nId;
+ RscTop * pClassTimeF;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "TimeFormatter" );
+ pClassTimeF = new RscClass( nId, RSC_NOTYPE, pSuper );
+ pClassTimeF->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Minimum", VARNAME );
+ pClassTimeF->SetVariable( nId, pClassTime, NULL,
+ 0, TIMEFORMATTER_MIN );
+ nId = aNmTb.Put( "Maximum", VARNAME );
+ pClassTimeF->SetVariable( nId, pClassTime, NULL,
+ 0, TIMEFORMATTER_MAX );
+ nId = aNmTb.Put( "Format", VARNAME );
+ pClassTimeF->SetVariable( nId, pTimeFieldFormat, NULL,
+ 0, TIMEFORMATTER_TIMEFIELDFORMAT );
+ nId = aNmTb.Put( "Duration", VARNAME );
+ pClassTimeF->SetVariable( nId, &aBool, NULL,
+ 0, TIMEFORMATTER_DURATION );
+ nId = aNmTb.Put( "StrictFormat", VARNAME );
+ pClassTimeF->SetVariable( nId, &aBool, NULL,
+ 0, TIMEFORMATTER_STRICTFORMAT );
+ nId = aNmTb.Put( "Intnl", VARNAME );
+ pClassTimeF->SetVariable( nId, pClassI12, NULL,
+ 0, TIMEFORMATTER_I12 );
+ nId = aNmTb.Put( "Value", VARNAME );
+ pClassTimeF->SetVariable( nId, pClassTime, NULL,
+ 0, TIMEFORMATTER_VALUE );
+
+ return pClassTimeF;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassSpinField()
+*************************************************************************/
+RscTop * RscTypCont::InitClassSpinField( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassSpinField;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "SpinField" );
+ pClassSpinField = new RscClass( nId, RSC_SPINFIELD, pSuper );
+ pClassSpinField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassSpinField );
+
+ INS_WINBIT(pClassSpinField,Repeat)
+ INS_WINBIT(pClassSpinField,Spin)
+
+ return pClassSpinField;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassPatternField()
+*************************************************************************/
+RscTop * RscTypCont::InitClassPatternField( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassPatternField;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "PatternField" );
+ pClassPatternField = new RscClass( nId, RSC_PATTERNFIELD, pSuper );
+ pClassPatternField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassPatternField );
+
+ return pClassPatternField;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassNumericField()
+*************************************************************************/
+RscTop * RscTypCont::InitClassNumericField( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassNumericField;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "NumericField" );
+ pClassNumericField = new RscClass( nId, RSC_NUMERICFIELD, pSuper );
+ pClassNumericField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassNumericField );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "First", VARNAME );
+ pClassNumericField->SetVariable( nId, &aIdLong, NULL,
+ 0, NUMERICFIELD_FIRST );
+ nId = aNmTb.Put( "Last", VARNAME );
+ pClassNumericField->SetVariable( nId, &aIdLong, NULL,
+ 0, NUMERICFIELD_LAST );
+ nId = aNmTb.Put( "SpinSize", VARNAME );
+ pClassNumericField->SetVariable( nId, &aIdLong, NULL,
+ 0, NUMERICFIELD_SPINSIZE );
+
+ return pClassNumericField;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMetricField()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMetricField( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassMetricField;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MetricField" );
+ pClassMetricField = new RscClass( nId, RSC_METRICFIELD, pSuper );
+ pClassMetricField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassMetricField );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "First", VARNAME );
+ pClassMetricField->SetVariable( nId, &aIdLong, NULL,
+ 0, METRICFIELD_FIRST );
+ nId = aNmTb.Put( "Last", VARNAME );
+ pClassMetricField->SetVariable( nId, &aIdLong, NULL,
+ 0, METRICFIELD_LAST );
+ nId = aNmTb.Put( "SpinSize", VARNAME );
+ pClassMetricField->SetVariable( nId, &aIdLong, NULL,
+ 0, METRICFIELD_SPINSIZE );
+
+ return pClassMetricField;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassCurrencyField()
+*************************************************************************/
+RscTop * RscTypCont::InitClassCurrencyField
+(
+ const char * pClassName,
+ USHORT nRT,
+ RscTop * pSuper
+)
+{
+ HASHID nId;
+ RscTop * pClassCurrencyField;
+
+ // Klasse anlegen
+ nId = pHS->Insert( pClassName );
+ pClassCurrencyField = new RscClass( nId, nRT, pSuper );
+ pClassCurrencyField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassCurrencyField );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "First", VARNAME );
+ pClassCurrencyField->SetVariable( nId, &aIdLong, NULL,
+ 0, CURRENCYFIELD_FIRST );
+ nId = aNmTb.Put( "Last", VARNAME );
+ pClassCurrencyField->SetVariable( nId, &aIdLong, NULL,
+ 0, CURRENCYFIELD_LAST );
+ nId = aNmTb.Put( "SpinSize", VARNAME );
+ pClassCurrencyField->SetVariable( nId, &aIdLong, NULL,
+ 0, CURRENCYFIELD_SPINSIZE );
+
+ return pClassCurrencyField;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassDateField()
+*************************************************************************/
+RscTop * RscTypCont::InitClassDateField( RscTop * pSuper, RscTop * pClassDate )
+{
+ HASHID nId;
+ RscTop * pClassDateField;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "DateField" );
+ pClassDateField = new RscClass( nId, RSC_DATEFIELD, pSuper );
+ pClassDateField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassDateField );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "First", VARNAME );
+ pClassDateField->SetVariable( nId, pClassDate, NULL, 0, DATEFIELD_FIRST );
+ nId = aNmTb.Put( "Last", VARNAME );
+ pClassDateField->SetVariable( nId, pClassDate, NULL, 0, DATEFIELD_LAST );
+
+ return pClassDateField;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassTimeField()
+*************************************************************************/
+RscTop * RscTypCont::InitClassTimeField( RscTop * pSuper, RscTop * pClassTime )
+{
+ HASHID nId;
+ RscTop * pClassTimeField;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "TimeField" );
+ pClassTimeField = new RscClass( nId, RSC_TIMEFIELD, pSuper );
+ pClassTimeField->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassTimeField );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "First", VARNAME );
+ pClassTimeField->SetVariable( nId, pClassTime, NULL, 0, TIMEFIELD_FIRST );
+ nId = aNmTb.Put( "Last", VARNAME );
+ pClassTimeField->SetVariable( nId, pClassTime, NULL, 0, TIMEFIELD_LAST );
+
+ return pClassTimeField;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassPatternBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassPatternBox( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassPatternBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "PatternBox" );
+ pClassPatternBox = new RscClass( nId, RSC_PATTERNBOX, pSuper );
+ pClassPatternBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassPatternBox );
+
+ return pClassPatternBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassNumericBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassNumericBox( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassNumericBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "NumericBox" );
+ pClassNumericBox = new RscClass( nId, RSC_NUMERICBOX, pSuper );
+ pClassNumericBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassNumericBox );
+
+ // Variablen anlegen
+
+ return pClassNumericBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMetricBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMetricBox( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassMetricBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MetricBox" );
+ pClassMetricBox = new RscClass( nId, RSC_METRICBOX, pSuper );
+ pClassMetricBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassMetricBox );
+
+ // Variablen anlegen
+
+ return pClassMetricBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassCurrencyBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassCurrencyBox
+(
+ const char * pClassName,
+ USHORT nRT,
+ RscTop * pSuper
+)
+{
+ HASHID nId;
+ RscTop * pClassCurrencyBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( pClassName );
+ pClassCurrencyBox = new RscClass( nId, nRT, pSuper );
+ pClassCurrencyBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassCurrencyBox );
+
+ // Variablen anlegen
+
+ return pClassCurrencyBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassDateBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassDateBox( RscTop * pSuper,
+ RscTop * /*pClassDate*/ )
+{
+ HASHID nId;
+ RscTop * pClassDateBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "DateBox" );
+ pClassDateBox = new RscClass( nId, RSC_DATEBOX, pSuper );
+ pClassDateBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassDateBox );
+
+ // Variablen anlegen
+
+ return pClassDateBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassTimeBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassTimeBox( RscTop * pSuper,
+ RscTop * /*pClassTime*/ )
+{
+ HASHID nId;
+ RscTop * pClassTimeBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "TimeBox" );
+ pClassTimeBox = new RscClass( nId, RSC_TIMEBOX, pSuper );
+ pClassTimeBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+
+ aNmTb.Put( nId, CLASSNAME, pClassTimeBox );
+
+ // Variablen anlegen
+
+ return pClassTimeBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassDockWindow()
+*************************************************************************/
+RscTop * RscTypCont::InitClassDockingWindow( RscTop * pSuper,
+ RscEnum * pMapUnit )
+{
+ HASHID nId;
+ RscTop * pClassDockWindow;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "DockingWindow" );
+ pClassDockWindow = new RscClass( nId, RSC_DOCKINGWINDOW, pSuper );
+ pClassDockWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassDockWindow );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "_FloatingPosMapMode", VARNAME );
+ pClassDockWindow->SetVariable( nId, pMapUnit, NULL, 0,
+ RSC_DOCKINGWINDOW_XYMAPMODE );
+ nId = aNmTb.Put( "_FloatingPosX", VARNAME );
+ pClassDockWindow->SetVariable( nId, &aShort, NULL, 0,
+ RSC_DOCKINGWINDOW_X );
+ nId = aNmTb.Put( "_FloatingPosY", VARNAME );
+ pClassDockWindow->SetVariable( nId, &aShort, NULL, 0,
+ RSC_DOCKINGWINDOW_Y );
+ nId = aNmTb.Put( "FloatingMode", VARNAME );
+ pClassDockWindow->SetVariable( nId, &aBool, NULL, 0,
+ RSC_DOCKINGWINDOW_FLOATING );
+
+ INS_WINBIT(pClassDockWindow,Moveable)
+ INS_WINBIT(pClassDockWindow,Sizeable)
+ INS_WINBIT(pClassDockWindow,EnableResizing)
+ INS_WINBIT(pClassDockWindow,Closeable)
+ INS_WINBIT(pClassDockWindow,HideWhenDeactivate);
+ INS_WINBIT(pClassDockWindow,Zoomable);
+ INS_WINBIT(pClassDockWindow,Dockable);
+
+ return pClassDockWindow;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassToolBoxItem()
+*************************************************************************/
+RscTop * RscTypCont::InitClassToolBoxItem( RscTop * pSuper,
+ RscTop * pClassBitmap,
+ RscTop * pClassImage,
+ RscEnum * pTriState )
+{
+ HASHID nId;
+ RscTop * pClassToolBoxItem;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ToolBoxItem" );
+ pClassToolBoxItem = new RscClass( nId, RSC_TOOLBOXITEM, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassToolBoxItem );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Identifier", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0,
+ RSC_TOOLBOXITEM_ID );
+ {
+ RscEnum * pEnum;
+
+ aBaseLst.Insert(
+ pEnum = new RscEnum( pHS->Insert( "EnumToolBoxItemType" ),
+ RSC_NOTYPE ), LIST_APPEND );
+ SETCONST( pEnum, "TOOLBOXITEM_BUTTON", TOOLBOXITEM_BUTTON );
+ SETCONST( pEnum, "TOOLBOXITEM_SPACE", TOOLBOXITEM_SPACE );
+ SETCONST( pEnum, "TOOLBOXITEM_SEPARATOR", TOOLBOXITEM_SEPARATOR );
+ SETCONST( pEnum, "TOOLBOXITEM_BREAK", TOOLBOXITEM_BREAK );
+
+ // Variable einfuegen
+ nId = aNmTb.Put( "Type", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pEnum, NULL, 0,
+ RSC_TOOLBOXITEM_TYPE );
+ }
+ {
+ RscFlag * pFlag;
+ RscClient * pClient;
+ HASHID nVarId, nAutoCheckId, nRadioCheckId, nCheckableId, nLeftId, nAutoSizeId, nDropDownId;
+
+ aBaseLst.Insert( pFlag = new RscFlag( pHS->Insert( "FlagToolBoxState" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+
+ // Konstanten in Tabelle stellen
+ nCheckableId = pHS->Insert( "TIB_CHECKABLE" );
+ SETCONST( pFlag, nCheckableId, TIB_CHECKABLE );
+ nAutoCheckId = pHS->Insert( "TIB_AUTOCHECK" );
+ SETCONST( pFlag, nAutoCheckId, TIB_AUTOCHECK );
+ nRadioCheckId = pHS->Insert( "TIB_RADIOCHECK" );
+ SETCONST( pFlag, nRadioCheckId, TIB_RADIOCHECK );
+ nLeftId = pHS->Insert( "TIB_LEFT" );
+ SETCONST( pFlag, nLeftId, TIB_LEFT );
+ nAutoSizeId = pHS->Insert( "TIB_AUTOSIZE" );
+ SETCONST( pFlag, nAutoSizeId, TIB_AUTOSIZE );
+ nDropDownId = pHS->Insert( "TIB_DROPDOWN" );
+ SETCONST( pFlag, nDropDownId, TIB_DROPDOWN );
+
+ // Variable einfuegen
+ nVarId = aNmTb.Put( "_ToolBoxItemFlags", VARNAME );
+ pClassToolBoxItem->SetVariable( nVarId, pFlag, NULL,
+ VAR_HIDDEN | VAR_NOENUM,
+ RSC_TOOLBOXITEM_STATUS );
+
+ // Clientvariablen einfuegen
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nCheckableId ), LIST_APPEND );
+ nId = aNmTb.Put( "Checkable", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nAutoCheckId ), LIST_APPEND );
+ nId = aNmTb.Put( "AutoCheck", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nRadioCheckId ), LIST_APPEND );
+ nId = aNmTb.Put( "RadioCheck", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nLeftId ), LIST_APPEND );
+ nId = aNmTb.Put( "Left", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nAutoSizeId ), LIST_APPEND );
+ nId = aNmTb.Put( "AutoSize", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId );
+
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ pFlag, nDropDownId ), LIST_APPEND );
+ nId = aNmTb.Put( "DropDown", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClient, NULL, VAR_NODATAINST, 0, nVarId );
+ }
+ nId = aNmTb.Put( "HelpID", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aIdLong, NULL, 0,
+ RSC_TOOLBOXITEM_HELPID );
+ nId = aNmTb.Put( "Text", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_TOOLBOXITEM_TEXT );
+ nId = aNmTb.Put( "HelpText", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_TOOLBOXITEM_HELPTEXT );
+ nId = aNmTb.Put( "ItemBitmap", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClassBitmap, NULL, 0,
+ RSC_TOOLBOXITEM_BITMAP );
+ nId = aNmTb.Put( "ItemImage", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pClassImage, NULL, 0,
+ RSC_TOOLBOXITEM_IMAGE );
+ nId = aNmTb.Put( "Disable", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0,
+ RSC_TOOLBOXITEM_DISABLE );
+
+ nId = aNmTb.Put( "State", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, pTriState, NULL, 0,
+ RSC_TOOLBOXITEM_STATE );
+ nId = aNmTb.Put( "Hide", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0,
+ RSC_TOOLBOXITEM_HIDE );
+ nId = aNmTb.Put( "Hide", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aBool, NULL, 0,
+ RSC_TOOLBOXITEM_HIDE );
+ nId = aNmTb.Put( "Command", VARNAME );
+ pClassToolBoxItem->SetVariable( nId, &aString, NULL, 0,
+ RSC_TOOLBOXITEM_COMMAND );
+
+ return pClassToolBoxItem;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassToolBox()
+*************************************************************************/
+RscTop * RscTypCont::InitClassToolBox( RscTop * pSuper,
+ RscTop * pClassToolBoxItem,
+ RscTop * pClassImageList )
+{
+ HASHID nId;
+ RscTop * pClassToolBox;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "ToolBox" );
+ pClassToolBox = new RscClass( nId, RSC_TOOLBOX, pSuper );
+ pClassToolBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassToolBox );
+
+ // Variablen anlegen
+ {
+ RscEnum * pEnum;
+
+ aBaseLst.Insert(
+ pEnum = new RscEnum( pHS->Insert( "EnumButtonType" ),
+ RSC_NOTYPE ), LIST_APPEND );
+ SETCONST( pEnum, "BUTTON_SYMBOL", BUTTON_SYMBOL );
+ SETCONST( pEnum, "BUTTON_TEXT", BUTTON_TEXT );
+ SETCONST( pEnum, "BUTTON_SYMBOLTEXT", BUTTON_SYMBOLTEXT );
+
+ // Variable einfuegen
+ nId = aNmTb.Put( "ButtonType", VARNAME );
+ pClassToolBox->SetVariable( nId, pEnum, NULL, 0,
+ RSC_TOOLBOX_BUTTONTYPE );
+ }
+ {
+ RscEnum * pEnum;
+
+ aBaseLst.Insert(
+ pEnum = new RscEnum( pHS->Insert( "EnumToolBoxAlign" ),
+ RSC_NOTYPE ), LIST_APPEND );
+ SETCONST( pEnum, "BOXALIGN_TOP", BOXALIGN_TOP );
+ SETCONST( pEnum, "BOXALIGN_LEFT", BOXALIGN_LEFT );
+ SETCONST( pEnum, "BOXALIGN_RIGHT", BOXALIGN_RIGHT );
+ SETCONST( pEnum, "BOXALIGN_BOTTOM", BOXALIGN_BOTTOM );
+
+ // Variable einfuegen
+ nId = aNmTb.Put( "Align", VARNAME );
+ pClassToolBox->SetVariable( nId, pEnum, NULL, 0,
+ RSC_TOOLBOX_ALIGN );
+ }
+ nId = aNmTb.Put( "LineCount", VARNAME );
+ pClassToolBox->SetVariable( nId, &aIdNoZeroUShort, NULL, 0,
+ RSC_TOOLBOX_LINECOUNT );
+ nId = aNmTb.Put( "FloatingLines", VARNAME );
+ pClassToolBox->SetVariable( nId, &aUShort, NULL, 0,
+ RSC_TOOLBOX_FLOATLINES );
+ nId = aNmTb.Put( "Customize", VARNAME );
+ pClassToolBox->SetVariable( nId, &aBool, NULL, 0,
+ RSC_TOOLBOX_CUSTOMIZE );
+ nId = aNmTb.Put( "MenuStrings", VARNAME );
+ pClassToolBox->SetVariable( nId, &aBool, NULL, 0,
+ RSC_TOOLBOX_MENUSTRINGS );
+ nId = aNmTb.Put( "ItemImageList", VARNAME );
+ pClassToolBox->SetVariable( nId, pClassImageList, NULL, 0,
+ RSC_TOOLBOX_ITEMIMAGELIST );
+ {
+ RscCont * pCont;
+
+ aBaseLst.Insert( pCont = new RscCont( pHS->Insert( "ContToolBoxItem" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+ pCont->SetTypeClass( pClassToolBoxItem );
+ nId = aNmTb.Put( "ItemList", VARNAME );
+ pClassToolBox->SetVariable( nId, pCont, NULL, 0,
+ RSC_TOOLBOX_ITEMLIST );
+ }
+ INS_WINBIT(pClassToolBox,Scroll)
+ INS_WINBIT(pClassToolBox,LineSpacing)
+ INS_WINBIT(pClassToolBox,RectStyle)
+
+ return pClassToolBox;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassStatusBar()
+*************************************************************************/
+RscTop * RscTypCont::InitClassStatusBar( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassStatusBar;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "StatusBar" );
+ pClassStatusBar = new RscClass( nId, RSC_STATUSBAR, pSuper );
+ pClassStatusBar->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassStatusBar );
+
+ // Variablen anlegen
+ INS_WINBIT(pClassStatusBar,Left)
+ INS_WINBIT(pClassStatusBar,Right)
+
+ return pClassStatusBar;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassMoreButton()
+*************************************************************************/
+RscTop * RscTypCont::InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit )
+{
+ HASHID nId;
+ RscTop * pClassMoreButton;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "MoreButton" );
+ pClassMoreButton = new RscClass( nId, RSC_MOREBUTTON, pSuper );
+ pClassMoreButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassMoreButton );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "State", VARNAME );
+ pClassMoreButton->SetVariable( nId, &aBool, NULL, 0,
+ RSC_MOREBUTTON_STATE );
+ nId = aNmTb.Put( "MapUnit", VARNAME );
+ pClassMoreButton->SetVariable( nId, pMapUnit, NULL, 0,
+ RSC_MOREBUTTON_MAPUNIT );
+ nId = aNmTb.Put( "Delta", VARNAME );
+ pClassMoreButton->SetVariable( nId, &aUShort, NULL, 0,
+ RSC_MOREBUTTON_DELTA );
+
+ return pClassMoreButton;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassFloatingWindow()
+*************************************************************************/
+RscTop * RscTypCont::InitClassFloatingWindow( RscTop * pSuper,
+ RscEnum * pMapUnit )
+{
+ HASHID nId;
+ RscTop * pClassFloatingWindow;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "FloatingWindow" );
+ pClassFloatingWindow = new RscClass( nId, RSC_FLOATINGWINDOW, pSuper );
+ pClassFloatingWindow->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassFloatingWindow );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "_ZoomInMapMode", VARNAME );
+ pClassFloatingWindow->SetVariable( nId, pMapUnit, NULL, 0,
+ RSC_FLOATINGWINDOW_WHMAPMODE );
+ nId = aNmTb.Put( "_ZoomInWidth", VARNAME );
+ pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0,
+ RSC_FLOATINGWINDOW_WIDTH );
+ nId = aNmTb.Put( "_ZoomInHeight", VARNAME );
+ pClassFloatingWindow->SetVariable( nId, &aShort, NULL, 0,
+ RSC_FLOATINGWINDOW_HEIGHT );
+ nId = aNmTb.Put( "ZoomIn", VARNAME );
+ pClassFloatingWindow->SetVariable( nId, &aBool, NULL, 0,
+ RSC_FLOATINGWINDOW_ZOOMIN );
+
+ INS_WINBIT(pClassFloatingWindow,Zoomable)
+ INS_WINBIT(pClassFloatingWindow,HideWhenDeactivate)
+ INS_WINBIT(pClassFloatingWindow,EnableResizing)
+
+ return pClassFloatingWindow;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassTabControlItem()
+*************************************************************************/
+RscTop * RscTypCont::InitClassTabControlItem( RscTop * pSuper,
+ RscTop * pClassTabPage )
+{
+ HASHID nId;
+ RscTop * pClassTabControlItem;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "PageItem" );
+ pClassTabControlItem = new RscClass( nId, RSC_TABCONTROLITEM, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassTabControlItem );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Identifier", VARNAME );
+ pClassTabControlItem->SetVariable( nId, &aIdNoZeroUShort, NULL, 0,
+ RSC_TABCONTROLITEM_ID );
+ nId = aNmTb.Put( "Text", VARNAME );
+ pClassTabControlItem->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_TABCONTROLITEM_TEXT );
+ nId = aNmTb.Put( "PageResID", VARNAME );
+ pClassTabControlItem->SetVariable( nId, &aIdUShort, NULL, 0,
+ RSC_TABCONTROLITEM_PAGERESID );
+
+ return pClassTabControlItem;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassTabControl()
+*************************************************************************/
+RscTop * RscTypCont::InitClassTabControl( RscTop * pSuper,
+ RscTop * pClassTabControlItem )
+{
+ HASHID nId;
+ RscTop * pClassTabControl;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "TabControl" );
+ pClassTabControl = new RscClass( nId, RSC_TABCONTROL, pSuper );
+ pClassTabControl->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassTabControl );
+
+ // Variablen anlegen
+ {
+ RscCont * pCont;
+
+ aBaseLst.Insert( pCont = new RscCont( pHS->Insert( "ContTabControlItem" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+ pCont->SetTypeClass( pClassTabControlItem );
+ nId = aNmTb.Put( "PageList", VARNAME );
+ pClassTabControl->SetVariable( nId, pCont, NULL, 0,
+ RSC_TABCONTROL_ITEMLIST );
+ }
+
+ return pClassTabControl;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassSfxFamilyStyleItem()
+*************************************************************************/
+RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop * pSuper,
+ RscTop * pClassBitmap,
+ RscTop * pClassImage,
+ RscArray * pStrLst )
+{
+ HASHID nId;
+ RscTop * pClassSfxFamilyStyleItem;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "SfxStyleFamilyItem" );
+ pClassSfxFamilyStyleItem = new RscClass( nId, RSC_SFX_STYLE_FAMILY_ITEM, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassSfxFamilyStyleItem );
+
+ nId = aNmTb.Put( "FilterList", VARNAME );
+ pClassSfxFamilyStyleItem->SetVariable( nId, pStrLst, NULL, 0,
+ RSC_SFX_STYLE_ITEM_LIST );
+ nId = aNmTb.Put( "StyleBitmap", VARNAME );
+ pClassSfxFamilyStyleItem->SetVariable( nId, pClassBitmap, NULL, 0,
+ RSC_SFX_STYLE_ITEM_BITMAP );
+ nId = aNmTb.Put( "Text", VARNAME );
+ pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_SFX_STYLE_ITEM_TEXT );
+ nId = aNmTb.Put( "HelpText", VARNAME );
+ pClassSfxFamilyStyleItem->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_SFX_STYLE_ITEM_HELPTEXT );
+ {
+ RscEnum * pSfxStyleFamily;
+ pSfxStyleFamily = new RscEnum( pHS->Insert( "StyleFamily" ),
+ RSC_NOTYPE );
+
+ SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PARA", SFX_STYLE_FAMILY_PARA );
+ SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_CHAR", SFX_STYLE_FAMILY_CHAR );
+ SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_FRAME",SFX_STYLE_FAMILY_FRAME);
+ SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PAGE", SFX_STYLE_FAMILY_PAGE );
+ SETCONST( pSfxStyleFamily, "SFX_STYLE_FAMILY_PSEUDO", SFX_STYLE_FAMILY_PSEUDO );
+ aBaseLst.Insert( pSfxStyleFamily );
+
+ nId = aNmTb.Put( "StyleFamily", VARNAME );
+ pClassSfxFamilyStyleItem->SetVariable( nId, pSfxStyleFamily, NULL, 0,
+ RSC_SFX_STYLE_ITEM_STYLEFAMILY );
+ }
+ nId = aNmTb.Put( "StyleImage", VARNAME );
+ pClassSfxFamilyStyleItem->SetVariable( nId, pClassImage, NULL, 0,
+ RSC_SFX_STYLE_ITEM_IMAGE );
+ return pClassSfxFamilyStyleItem;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassSfxTemplateDialogm()
+*************************************************************************/
+RscTop * RscTypCont::InitClassSfxTemplateDialog( RscTop * pSuper,
+ RscTop * pClassFamilyStyleItem )
+{
+ HASHID nId;
+ RscTop * pClassSfxTemplateDialog;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "SfxStyleFamilies" );
+ pClassSfxTemplateDialog = new RscClass( nId, RSC_SFX_STYLE_FAMILIES, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassSfxTemplateDialog );
+
+ // Variablen anlegen
+ {
+ RscCont * pCont;
+
+ aBaseLst.Insert( pCont = new RscCont(
+ pHS->Insert( "ContFamilyStyleItem" ),
+ RSC_NOTYPE ),
+ LIST_APPEND );
+ pCont->SetTypeClass( pClassFamilyStyleItem );
+ nId = aNmTb.Put( "StyleFamilyList", VARNAME );
+ pClassSfxTemplateDialog->SetVariable( nId, pCont );
+ }
+
+ return pClassSfxTemplateDialog;
+}
+
+/*************************************************************************
+|* RscTypCont::InitClassSfxSlotInfo()
+*************************************************************************/
+RscTop * RscTypCont::InitClassSfxSlotInfo( RscTop * pSuper )
+{
+ HASHID nId;
+ RscTop * pClassSfxSlotInfo;
+
+ // Klasse anlegen
+ nId = pHS->Insert( "SfxSlotInfo" );
+ pClassSfxSlotInfo = new RscClass( nId, RSC_SFX_SLOT_INFO, pSuper );
+ aNmTb.Put( nId, CLASSNAME, pClassSfxSlotInfo );
+
+ nId = aNmTb.Put( "SlotName", VARNAME );
+ pClassSfxSlotInfo->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_SFX_SLOT_INFO_SLOTNAME );
+ nId = aNmTb.Put( "HelpText", VARNAME );
+ pClassSfxSlotInfo->SetVariable( nId, &aLangString, NULL, 0,
+ RSC_SFX_SLOT_INFO_HELPTEXT );
+ return pClassSfxSlotInfo;
+}
+
+
diff --git a/rsc/source/parser/rscinit.cxx b/rsc/source/parser/rscinit.cxx
new file mode 100644
index 000000000000..cee22a6cbdca
--- /dev/null
+++ b/rsc/source/parser/rscinit.cxx
@@ -0,0 +1,1037 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscinit.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/****************** I N C L U D E S **************************************/
+#pragma hdrstop
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <tools/rc.h>
+#include <tools/vclrsc.hxx>
+
+// Programmabhaengige Includes.
+#ifndef _RSCTREE_HXX
+#include <rsctree.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+#ifndef _RSCRANGE_HXX
+#include <rscrange.hxx>
+#endif
+#ifndef _RSCCONST_HXX
+#include <rscconst.hxx>
+#endif
+#ifndef _RSCFLAG_HXX
+#include <rscflag.hxx>
+#endif
+#ifndef _RSCSTR_HXX
+#include <rscstr.hxx>
+#endif
+#ifndef _RSCCONT_HXX
+#include <rsccont.hxx>
+#endif
+#ifndef _RSCMGR_HXX
+#include <rscmgr.hxx>
+#endif
+#ifndef _RSCCLASS_HXX
+#include <rscclass.hxx>
+#endif
+#ifndef _RSCKEY_HXX
+#include <rsckey.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+
+#include "rsclex.hxx"
+#include <rscyacc.yxx.h>
+
+/****************** M a c r o s ******************************************/
+#define INS_WINBIT( pClass, WinBit ) \
+ InsWinBit( pClass, #WinBit, n##WinBit##Id );
+
+/****************** C O D E **********************************************/
+void NameToVerCtrl( RSCINST & aVersion, RscTop * pClass,
+ RscTop * pClassString )
+{
+ if( pClass )
+ {
+ NameToVerCtrl( aVersion, (RscTop *)pClass->Left(), pClassString );
+ {
+ RSCINST aVI;
+ RSCINST aStr;
+
+ // Namen in Versionskontrolle einsetzen
+ aVersion.pClass->
+ GetElement( aVersion, RscId( pClass->GetTypId() ),
+ pClassString, RSCINST(), &aVI );
+ aStr = aVI.pClass->GetVariable( aVI, pHS->Insert( "TEXT" ),
+ RSCINST() );
+ aStr.pClass->SetString( aStr, pHS->Get( pClass->GetId() ) );
+ }
+ NameToVerCtrl( aVersion, (RscTop *)pClass->Right(), pClassString );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscTypCont::Init()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.03.91
+|* Letzte Aenderung MM 27.06.91
+|*
+*************************************************************************/
+void RscTypCont::Init()
+{
+ RscEnum * pDateFormat;
+ RscEnum * pTimeFormat;
+ RscEnum * pWeekDayFormat;
+ RscEnum * pMonthFormat;
+ RscEnum * pFieldUnits;
+ RscEnum * pDayOfWeek;
+ RscEnum * pTimeFieldFormat;
+ RscEnum * pColor;
+ RscEnum * pMapUnit;
+ RscEnum * pKey;
+ RscEnum * pTriState;
+ RscEnum * pMessButtons;
+ RscEnum * pMessDefButton;
+ RscTupel * pGeometry;
+ RscArray * pLangGeometry;
+ RscCont * pStringList;
+ RscArray * pLangStringList;
+ RscTupel * pStringTupel;
+ RscTupel * pStringLongTupel;
+ RscCont * pStringTupelList;
+ RscCont * pStringLongTupelList;
+ RscArray * pLangStringTupelList;
+ RscArray * pLangStringLongTupelList;
+
+ RscTop * pClassMgr;
+ RscTop * pClassString;
+ RscTop * pClassStringArray;
+ RscTop * pClassBitmap;
+ RscTop * pClassColor;
+ RscTop * pClassImage;
+ RscTop * pClassImageList;
+ RscTop * pClassWindow;
+ RscTop * pClassSystemWindow;
+ RscTop * pClassWorkWindow;
+ RscTop * pClassDialog;
+ RscTop * pClassModalDialog;
+ RscTop * pClassModelessDialog;
+ RscTop * pClassControl;
+ RscTop * pClassButton;
+ RscTop * pClassCheckBox;
+ RscTop * pClassPushButton;
+ RscTop * pClassOKButton;
+ RscTop * pClassCancelButton;
+ RscTop * pClassHelpButton;
+ RscTop * pClassRadioButton;
+ RscTop * pClassImageRadioButton;
+ RscTop * pClassImageButton;
+ RscTop * pClassTriStateBox;
+ RscTop * pClassEdit;
+ RscTop * pClassMultiLineEdit;
+ RscTop * pClassScrollBar;
+ RscTop * pClassListBox;
+ RscTop * pClassMultiListBox;
+ RscTop * pClassComboBox;
+ RscTop * pClassFixedText;
+ RscTop * pClassFixedBitmap;
+ RscTop * pClassFixedImage;
+ RscTop * pClassGroupBox;
+ RscTop * pClassKeyCode;
+ RscTop * pLangClassKeyCode;
+ RscTop * pClassAccelItem;
+ RscTop * pClassAccel;
+ RscTop * pClassMenuItem;
+ RscTop * pClassMenu;
+ RscTop * pClassMenuButton;
+ RscTop * pClassMessBox;
+ RscTop * pClassInfoBox;
+ RscTop * pClassWarningBox;
+ RscTop * pClassErrorBox;
+ RscTop * pClassQueryBox;
+ RscTop * pClassSplitter;
+ RscTop * pClassSplitWindow;
+ RscTop * pClassSpinButton;
+ RscTop * pClassTime;
+ RscTop * pClassDate;
+ RscTop * pClassI12;
+ RscTop * pLangClassI12;
+ RscTop * pClassSpinField;
+ RscTop * pClassPatternField;
+ RscTop * pClassNumericField;
+ RscTop * pClassMetricField;
+ RscTop * pClassCurrencyField;
+ RscTop * pClassLongCurrencyField;
+ RscTop * pClassDateField;
+ RscTop * pClassTimeField;
+ RscTop * pClassPatternBox;
+ RscTop * pClassNumericBox;
+ RscTop * pClassMetricBox;
+ RscTop * pClassCurrencyBox;
+ RscTop * pClassLongCurrencyBox;
+ RscTop * pClassDateBox;
+ RscTop * pClassTimeBox;
+ RscTop * pClassDockingWindow;
+ RscTop * pClassToolBoxItem;
+ RscTop * pClassToolBox;
+ RscTop * pClassStatusBar;
+ RscTop * pClassMoreButton;
+ RscTop * pClassFloatingWindow;
+ RscTop * pClassTabPage;
+ RscTop * pClassTabDialog;
+ RscTop * pClassTabControlItem;
+ RscTop * pClassTabControl;
+ RscTop * pClassFixedLine;
+ RscTop * pClassScrollBarBox;
+ RscTop * pClassSfxStyleFamilyItem;
+ RscTop * pClassSfxTemplateDialog;
+ RscTop * pClassSfxSlotInfo;
+
+ HASHID nId;
+
+ aNmTb.SetSort( FALSE );
+{
+ /********** C O M P I L E R T Y P E N ******************************/
+ aNmTb.Put( "LINE", (USHORT)LINE, (long)0 );
+ aNmTb.Put( "NOT", (USHORT)NOT, (long)0 );
+ aNmTb.Put( "DEFINE", (USHORT)DEFINE, (long)0 );
+ aNmTb.Put( "INCLUDE", (USHORT)INCLUDE, (long)0 );
+ aNmTb.Put( "DEFAULT", (USHORT)DEFAULT, (long)0 );
+ aNmTb.Put( "class", (USHORT)CLASS, (long)0 );
+ aNmTb.Put( "extendable", (USHORT)EXTENDABLE, (long)0 );
+ aNmTb.Put( "writeifset", (USHORT)WRITEIFSET, (long)0 );
+
+/* Werte fuer Aufzaehlungstypen */
+ aNmTb.Put( "TRUE", (USHORT)BOOLEAN, (long)TRUE );
+ aNmTb.Put( "FALSE", (USHORT)BOOLEAN, (long)FALSE );
+
+/* Vordefinierte HilfeId's */
+ aNmTb.Put( "HELP_INDEX", (USHORT)NUMBER, HELP_INDEX );
+ aNmTb.Put( "HELP_HELPONHELP", (USHORT)NUMBER, HELP_HELPONHELP );
+
+ aNmTb.Put( "XSCALE", (USHORT)XSCALE , (long)0 );
+ aNmTb.Put( "YSCALE", (USHORT)YSCALE , (long)0 );
+ aNmTb.Put( "RGB", (USHORT)RGB , (long)0 );
+ aNmTb.Put( "POSSIZE", (USHORT)GEOMETRY, (long)0 );
+ aNmTb.Put( "POS", (USHORT)POSITION, (long)0 );
+ aNmTb.Put( "SIZE", (USHORT)DIMENSION, (long)0 );
+ aNmTb.Put( "ZoomInOutputSize", (USHORT)INZOOMOUTPUTSIZE,(long)0 );
+ aNmTb.Put( "FloatingPos", (USHORT)FLOATINGPOS, (long)0 );
+}
+ /********** B A S I S T Y P E N ************************************/
+{
+ /********** S H O R T ************************************************/
+ aShort.SetRange( -32768, 32767 );
+
+ /********** U S H O R T **********************************************/
+ aUShort.SetRange( 0, 0xFFFF );
+
+ /********** L O N G **************************************************/
+ aLong.SetRange( -0x80000000, 0x7FFFFFFF );
+ aEnumLong.SetRange( -0x80000000, 0x7FFFFFFF );
+
+ /********** I D U S H O R T ******************************************/
+ aIdUShort.SetRange( 0, 0xFFFF );
+
+ /********** I D N O Z E R O U S H O R T ******************************/
+ aIdNoZeroUShort.SetRange( 1, 0xFFFF );
+
+ /********** N O Z E R O S H O R T ************************************/
+ aNoZeroShort.SetRange( -32768, 32767 );
+ aNoZeroShort.SetOutRange( 0 );
+
+ /********** R A N G E S H O R T **************************************/
+ a1to12Short.SetRange( 1, 12 );
+ a0to23Short.SetRange( 0, 23 );
+ a1to31Short.SetRange( 1, 31 );
+ a0to59Short.SetRange( 0, 59 );
+ a0to99Short.SetRange( 0, 99 );
+ a0to9999Short.SetRange( 0, 9999 );
+
+ /********** I D R A N G E ********************************************/
+ aIdLong.SetRange( -0x80000000, 0x7FFFFFFF );
+}
+{
+ /********** W I N B I T S F L A G ************************************/
+ // Variablenname fuer WinBits
+ nWinBitVarId = aNmTb.Put( "_WinBits", VARNAME );
+
+ // Windows
+ nBorderId = pHS->Insert( "WB_BORDER" );
+ aWinBits.SetConstant( nBorderId, WB_BORDER );
+ nHideId = pHS->Insert( "WB_HIDE" );
+ aWinBits.SetConstant( nHideId, WB_HIDE );
+ nClipChildrenId = pHS->Insert( "WB_CLIPCHILDREN" );
+ aWinBits.SetConstant( nClipChildrenId, WB_CLIPCHILDREN );
+ nSizeableId = pHS->Insert( "WB_SIZEABLE" );
+ aWinBits.SetConstant( nSizeableId, WB_SIZEABLE );
+ nMoveableId = pHS->Insert( "WB_MOVEABLE" );
+ aWinBits.SetConstant( nMoveableId, WB_MOVEABLE );
+ nMinimizeId = pHS->Insert( "WB_MINABLE" );
+ aWinBits.SetConstant( nMinimizeId, WB_MINABLE );
+ nMaximizeId = pHS->Insert( "WB_MAXABLE" );
+ aWinBits.SetConstant( nMaximizeId, WB_MAXABLE );
+ nCloseableId = pHS->Insert( "WB_CLOSEABLE" );
+ aWinBits.SetConstant( nCloseableId, WB_CLOSEABLE );
+ nAppId = pHS->Insert( "WB_APP" );
+ aWinBits.SetConstant( nAppId, WB_APP );
+ nTabstopId = pHS->Insert( "WB_TABSTOP" );
+ aWinBits.SetConstant( nTabstopId, WB_TABSTOP );
+ nGroupId = pHS->Insert( "WB_GROUP" );
+ aWinBits.SetConstant( nGroupId, WB_GROUP );
+ nSysmodalId = pHS->Insert( "WB_SYSMODAL" );
+ aWinBits.SetConstant( nSysmodalId, WB_SYSMODAL );
+}
+{
+ nLeftId = pHS->Insert( "WB_LEFT" );
+ aWinBits.SetConstant( nLeftId, WB_LEFT );
+ nCenterId = pHS->Insert( "WB_CENTER" );
+ aWinBits.SetConstant( nCenterId, WB_CENTER );
+ nRightId = pHS->Insert( "WB_RIGHT" );
+ aWinBits.SetConstant( nRightId, WB_RIGHT );
+ nHscrollId = pHS->Insert( "WB_HSCROLL" );
+ aWinBits.SetConstant( nHscrollId, WB_HSCROLL );
+ nVscrollId = pHS->Insert( "WB_VSCROLL" );
+ aWinBits.SetConstant( nVscrollId, WB_VSCROLL );
+ nSortId = pHS->Insert( "WB_SORT" );
+ aWinBits.SetConstant( nSortId, WB_SORT );
+ nDefaultId = pHS->Insert( "WB_DEFBUTTON" );
+ aWinBits.SetConstant( nDefaultId, WB_DEFBUTTON );
+ nRepeatId = pHS->Insert( "WB_REPEAT" );
+ aWinBits.SetConstant( nRepeatId, WB_REPEAT );
+ nSVLookId = pHS->Insert( "WB_SVLOOK" );
+ aWinBits.SetConstant( nSVLookId, WB_SVLOOK );
+ nDropDownId = pHS->Insert( "WB_DROPDOWN" );
+ aWinBits.SetConstant( nDropDownId, WB_DROPDOWN );
+ nPassWordId = pHS->Insert( "WB_PASSWORD" );
+ aWinBits.SetConstant( nPassWordId, WB_PASSWORD );
+ nReadOnlyId = pHS->Insert( "WB_READONLY" );
+ aWinBits.SetConstant( nReadOnlyId, WB_READONLY );
+ nAutoSizeId = pHS->Insert( "WB_AUTOSIZE" );
+ aWinBits.SetConstant( nAutoSizeId, WB_AUTOSIZE );
+ nSpinId = pHS->Insert( "WB_SPIN" );
+ aWinBits.SetConstant( nSpinId, WB_SPIN );
+ nTabControlId = pHS->Insert( "WB_DIALOGCONTROL" );
+ aWinBits.SetConstant( nTabControlId, WB_DIALOGCONTROL );
+ nSimpleModeId = pHS->Insert( "WB_SIMPLEMODE" );
+ aWinBits.SetConstant( nSimpleModeId, WB_SIMPLEMODE );
+ nDragId = pHS->Insert( "WB_DRAG" );
+ aWinBits.SetConstant( nDragId, WB_DRAG );
+ nSaveAsId = pHS->Insert( "WB_SAVEAS" );
+ aWinBits.SetConstant( nSaveAsId, WB_SAVEAS );
+ nOpenId = pHS->Insert( "WB_OPEN" );
+ aWinBits.SetConstant( nOpenId, WB_OPEN );
+ nScrollId = pHS->Insert( "WB_SCROLL" );
+ aWinBits.SetConstant( nScrollId, WB_SCROLL );
+ nZoomableId = pHS->Insert( "WB_ZOOMABLE" );
+ aWinBits.SetConstant( nZoomableId, WB_ROLLABLE );
+ nHideWhenDeactivateId = pHS->Insert( "WB_HIDEWHENDEACTIVATE" );
+ aWinBits.SetConstant( nHideWhenDeactivateId, WB_HIDEWHENDEACTIVATE );
+ nAutoHScrollId = pHS->Insert( "WB_AUTOHSCROLL" );
+ aWinBits.SetConstant( nAutoHScrollId, WB_AUTOHSCROLL );
+ nDDExtraWidthId = pHS->Insert( "WB_DDEXTRAWIDTH" );
+ aWinBits.SetConstant( nDDExtraWidthId, WB_DDEXTRAWIDTH );
+ nWordBreakId = pHS->Insert( "WB_WORDBREAK" );
+ aWinBits.SetConstant( nWordBreakId, WB_WORDBREAK );
+ nLeftLabelId = pHS->Insert( "WB_LEFTLABEL" );
+ aWinBits.SetConstant( nLeftLabelId, WB_LEFTLABEL );
+ nHasLinesId = pHS->Insert( "WB_HASLINES" );
+ aWinBits.SetConstant( nHasLinesId, WB_HASLINES );
+ nHasButtonsId = pHS->Insert( "WB_HASBUTTONS" );
+ aWinBits.SetConstant( nHasButtonsId, WB_HASBUTTONS );
+ nRectStyleId = pHS->Insert( "WB_RECTSTYLE" );
+ aWinBits.SetConstant( nRectStyleId, WB_RECTSTYLE );
+ nLineSpacingId = pHS->Insert( "WB_LINESPACING" );
+ aWinBits.SetConstant( nLineSpacingId, WB_LINESPACING );
+ nSmallStyleId = pHS->Insert( "WB_SMALLSTYLE" );
+ aWinBits.SetConstant( nSmallStyleId, WB_SMALLSTYLE );
+ nEnableResizingId = pHS->Insert( "WB_ENABLERESIZING" );
+ aWinBits.SetConstant( nEnableResizingId, WB_ENABLERESIZING );
+ nDockableId = pHS->Insert( "WB_DOCKABLE" );
+ aWinBits.SetConstant( nDockableId, WB_DOCKABLE );
+ nScaleId = pHS->Insert( "WB_SCALE" );
+ aWinBits.SetConstant( nScaleId, WB_SCALE );
+ nIgnoreTabId = pHS->Insert( "WB_IGNORETAB" );
+ aWinBits.SetConstant( nIgnoreTabId, WB_IGNORETAB );
+ nNoSplitDrawId = pHS->Insert( "WB_NOSPLITDRAW" );
+ aWinBits.SetConstant( nNoSplitDrawId, WB_NOSPLITDRAW );
+ nTopImageId = pHS->Insert( "WB_TOPIMAGE" );
+ aWinBits.SetConstant( nTopImageId, WB_TOPIMAGE );
+ nNoLabelId = pHS->Insert( "WB_NOLABEL" );
+ aWinBits.SetConstant( nNoLabelId, WB_NOLABEL );
+}
+{
+ /********** I n i t B a s i c T y p e s **************************/
+ InitLangType();
+ aBaseLst.Insert( pDateFormat = InitDateFormatType(), LIST_APPEND );
+ aBaseLst.Insert( pTimeFormat = InitTimeFormatType(), LIST_APPEND );
+ aBaseLst.Insert( pWeekDayFormat = InitWeekDayFormatType(), LIST_APPEND );
+ aBaseLst.Insert( pMonthFormat = InitMonthFormatType(), LIST_APPEND );
+ aBaseLst.Insert( pFieldUnits = InitFieldUnitsType(), LIST_APPEND );
+ aBaseLst.Insert( pDayOfWeek = InitDayOfWeekType(), LIST_APPEND );
+ aBaseLst.Insert( pTimeFieldFormat = InitTimeFieldFormat(), LIST_APPEND );
+ aBaseLst.Insert( pColor = InitColor(), LIST_APPEND );
+ aBaseLst.Insert( pMapUnit = InitMapUnit(), LIST_APPEND );
+ aBaseLst.Insert( pKey = InitKey(), LIST_APPEND );
+ aBaseLst.Insert( pTriState = InitTriState(), LIST_APPEND );
+ aBaseLst.Insert( pMessButtons = InitMessButtons(), LIST_APPEND );
+ aBaseLst.Insert( pMessDefButton = InitMessDefButton(), LIST_APPEND );
+
+ aBaseLst.Insert( pGeometry = InitGeometry(), LIST_APPEND );
+ aBaseLst.Insert( pLangGeometry = InitLangGeometry( pGeometry ),
+ LIST_APPEND );
+ aBaseLst.Insert( pStringList = InitStringList(), LIST_APPEND );
+ aBaseLst.Insert( pLangStringList = InitLangStringList( pStringList ),
+ LIST_APPEND );
+ aBaseLst.Insert( pStringTupel = InitStringTupel(), LIST_APPEND );
+ aBaseLst.Insert( pStringTupelList = InitStringTupelList( pStringTupel ),
+ LIST_APPEND );
+ aBaseLst.Insert( pLangStringTupelList =
+ InitLangStringTupelList( pStringTupelList ), LIST_APPEND );
+ aBaseLst.Insert( pStringLongTupel = InitStringLongTupel(), LIST_APPEND );
+ aBaseLst.Insert( pStringLongTupelList = InitStringLongTupelList( pStringLongTupel ),
+ LIST_APPEND );
+ aBaseLst.Insert( pLangStringLongTupelList =
+ InitLangStringLongTupelList( pStringLongTupelList ), LIST_APPEND );
+}
+{
+ /********** R E S O U R C E T Y P E N ******************************/
+ /********** R S C M G R **********************************************/
+ pRoot = pClassMgr = InitClassMgr();
+
+ /********** V e r s i o n s k o n t r o l l e ************************/
+ aVersion.pClass = new RscClass( pHS->Insert( "VersionControl" ),
+ RSC_VERSIONCONTROL, pClassMgr );
+ aVersion = aVersion.pClass->Create( NULL, RSCINST() );
+
+ /********** S T R I N G **********************************************/
+ pClassString = InitClassString( pClassMgr );
+ pRoot->Insert( pClassString );
+
+ // String als Referenzklasse des Basisstrings einsetzen
+ aString.SetRefClass( pClassString );
+
+ /********** S T R I N G L I S T **************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "StringArray" );
+ pClassStringArray = new RscClass( nId, RSC_STRINGARRAY, pClassMgr );
+ pClassStringArray->SetCallPar( *pStdPar1, *pStdPar2, *pStdParType );
+ aNmTb.Put( nId, CLASSNAME, pClassStringArray );
+ pRoot->Insert( pClassStringArray );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "ItemList", VARNAME );
+ pClassStringArray->SetVariable( nId, pLangStringLongTupelList );
+
+ /********** B I T M A P **********************************************/
+ pClassBitmap = InitClassBitmap( pClassMgr );
+ pRoot->Insert( pClassBitmap );
+
+}
+{
+ /********** C O L O R ************************************************/
+ pClassColor = InitClassColor( pClassMgr, pColor );
+ pRoot->Insert( pClassColor );
+
+ /********** I M A G E ************************************************/
+ pClassImage = InitClassImage( pClassMgr, pClassBitmap, pClassColor );
+ pRoot->Insert( pClassImage );
+
+ /********** I M A G E L I S T ****************************************/
+ pClassImageList = InitClassImageList( pClassMgr, pClassBitmap, pClassColor );
+ pRoot->Insert( pClassImageList );
+
+ /********** W I N D O W **********************************************/
+ pClassWindow = InitClassWindow( pClassMgr, pMapUnit,
+ pLangGeometry );
+ pRoot->Insert( pClassWindow );
+}
+{
+
+ /********** S Y S T E M W I N D O W **********************************/
+ pClassSystemWindow = InitClassSystemWindow( pClassWindow );
+ //aBaseLst.Insert( pClassSystemWindow, LIST_APPEND );
+ pRoot->Insert( pClassSystemWindow );
+
+ /********** W O R K W I N D O W **************************************/
+ pClassWorkWindow = InitClassWorkWindow( pClassSystemWindow );
+ pRoot->Insert( pClassWorkWindow );
+
+ /********** D I A L O G **********************************************/
+ // Klasse anlegen
+ pClassDialog = new RscClass( pHS->Insert( "Dialog" ),
+ RSC_DIALOG, pClassSystemWindow );
+ pClassDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aBaseLst.Insert( pClassDialog, LIST_APPEND );
+
+ /********** M O D A L D I A L O G ***********************************/
+ // Klasse anlegen
+ pClassModalDialog = InitClassModalDialog( pClassDialog );
+ pRoot->Insert( pClassModalDialog );
+
+ /********** M O D E L E S S D I A L O G ******************************/
+ // Klasse anlegen
+ pClassModelessDialog = InitClassModelessDialog( pClassDialog );
+ pRoot->Insert( pClassModelessDialog );
+}
+{
+ /********** C O N T R O L ********************************************/
+ pClassControl = InitClassControl( pClassWindow );
+ pRoot->Insert( pClassControl );
+
+ /********** B U T T O N **********************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "Button" );
+ pClassButton = new RscClass( nId, RSC_BUTTON, pClassControl );
+ pClassButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassButton );
+ pRoot->Insert( pClassButton );
+
+ /********** C H E C K B O X ******************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "CheckBox" );
+ pClassCheckBox = new RscClass( nId, RSC_CHECKBOX, pClassButton );
+ pClassCheckBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassCheckBox );
+ pRoot->Insert( pClassCheckBox );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Check", VARNAME );
+ pClassCheckBox->SetVariable( nId, &aBool );
+
+ /********** P U S H B U T T O N **************************************/
+ // Klasse anlegen
+ pClassPushButton = InitClassPushButton( pClassButton );
+ pRoot->Insert( pClassPushButton );
+
+ /********** H E L P B U T T O N **************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "HelpButton" );
+ pClassHelpButton = new RscClass( nId, RSC_HELPBUTTON,
+ pClassPushButton );
+ pClassHelpButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassHelpButton );
+ pRoot->Insert( pClassHelpButton );
+
+ /********** O K B U T T O N ******************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "OKButton" );
+ pClassOKButton = new RscClass( nId, RSC_OKBUTTON,
+ pClassPushButton );
+ pClassOKButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassOKButton );
+ pRoot->Insert( pClassOKButton );
+
+ /********** C A N C E L B U T T O N **********************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "CancelButton" );
+ pClassCancelButton = new RscClass( nId, RSC_CANCELBUTTON,
+ pClassPushButton );
+ pClassCancelButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassCancelButton );
+ pRoot->Insert( pClassCancelButton );
+}
+{
+ /********** R A D I O B U T T O N ************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "RadioButton" );
+ pClassRadioButton = new RscClass( nId, RSC_RADIOBUTTON, pClassButton );
+ pClassRadioButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassRadioButton );
+ pRoot->Insert( pClassRadioButton );
+
+ // Variablen anlegen
+ nId = aNmTb.Put( "Check", VARNAME );
+ pClassRadioButton->SetVariable( nId, &aBool );
+
+ /********** I m a g e R a d i o B u t t o n **************************/
+ nId = pHS->Insert( "ImageRadioButton" );
+ pClassImageRadioButton = InitClassImageRadioButton( pClassRadioButton,
+ pClassImage );
+ pRoot->Insert( pClassImageRadioButton );
+
+ /********** T R I S T A T E B O X ************************************/
+ pClassTriStateBox = InitClassTriStateBox( pClassControl, pTriState );
+ pRoot->Insert( pClassTriStateBox );
+
+ /********** I M A G E B U T T O N ************************************/
+ pClassImageButton = InitClassImageButton( pClassPushButton,
+ pClassImage, pTriState );
+ pRoot->Insert( pClassImageButton );
+
+ /********** E D I T **************************************************/
+ pClassEdit = InitClassEdit( pClassControl );
+ pRoot->Insert( pClassEdit );
+
+ /********** M U L T I L I N E E D I T ********************************/
+ pClassMultiLineEdit = InitClassMultiLineEdit( pClassEdit );
+ pRoot->Insert( pClassMultiLineEdit );
+
+ /********** S C R O L L B A R ****************************************/
+ pClassScrollBar = InitClassScrollBar( pClassControl );
+ pRoot->Insert( pClassScrollBar );
+
+}
+{
+ /********** L I S T B O X ********************************************/
+ pClassListBox = InitClassListBox( pClassControl, pLangStringLongTupelList );
+ pRoot->Insert( pClassListBox );
+
+ /********** M U L T I L I S T B O X **********************************/
+ pClassMultiListBox = InitClassMultiListBox( pClassListBox);
+ pRoot->Insert( pClassMultiListBox );
+
+ /********** C O M B O B O X ******************************************/
+ pClassComboBox = InitClassComboBox( pClassEdit, pLangStringList );
+ pRoot->Insert( pClassComboBox );
+
+ /********** F I X E D T E X T ****************************************/
+ pClassFixedText = InitClassFixedText( pClassControl );
+ pRoot->Insert( pClassFixedText );
+
+ /********** F i x e d B i t m a p ************************************/
+ pClassFixedBitmap = InitClassFixedBitmap( pClassControl, pClassBitmap );
+ pRoot->Insert( pClassFixedBitmap );
+
+ /********** F i x e d I m a g e **************************************/
+ pClassFixedImage = InitClassFixedImage( pClassControl, pClassImage );
+ pRoot->Insert( pClassFixedImage );
+
+ /********** G R O U P B O X ******************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "GroupBox" );
+ pClassGroupBox = new RscClass( nId, RSC_GROUPBOX, pClassControl );
+ pClassGroupBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassGroupBox );
+ pRoot->Insert( pClassGroupBox );
+
+ /********** K E Y C O D E ********************************************/
+ pClassKeyCode = InitClassKeyCode( pClassMgr, pKey );
+ pRoot->Insert( pClassKeyCode );
+ {
+ pLangClassKeyCode = new RscClassArray( pHS->Insert( "LangKeyCode" ),
+ RSC_KEYCODE, pClassKeyCode, &aLangType,
+ &nLangTypeId, &nDfltLangTypeId );
+ aBaseLst.Insert( pLangClassKeyCode );
+ }
+
+ /********** A C C E L I T E M ***************************************/
+ pClassAccelItem = InitClassAccelItem( pClassMgr, pLangClassKeyCode );
+ pRoot->Insert( pClassAccelItem );
+}
+{
+ /********** A C C E L E R A T O R ************************************/
+ pClassAccel = InitClassAccel( pClassMgr, pClassAccelItem );
+ pRoot->Insert( pClassAccel );
+
+ /********** A C C E L I T E M ***************************************/
+ // pClassAccel ist erst hier definiert
+ nId = aNmTb.Put( "SubAccelerator", VARNAME );
+ pClassAccelItem->SetVariable( nId, pClassAccel, NULL, VAR_SVDYNAMIC,
+ ACCELITEM_ACCEL );
+
+ /********** M E N U I T E M ******************************************/
+ pClassMenuItem = InitClassMenuItem( pClassMgr, pClassBitmap,
+ pLangClassKeyCode );
+ pRoot->Insert( pClassMenuItem );
+
+ /********** M E N U **************************************************/
+ pClassMenu = InitClassMenu( pClassMgr, pClassMenuItem );
+ pRoot->Insert( pClassMenu );
+
+ /********** M E N U I T E M ******************************************/
+ // pClassMenu ist erst hier definiert
+ nId = aNmTb.Put( "SubMenu", VARNAME );
+ pClassMenuItem->SetVariable( nId, pClassMenu, NULL, VAR_SVDYNAMIC,
+ RSC_MENUITEM_MENU );
+
+ /********** M E N U B U T T O N **************************************/
+ pClassMenuButton = InitClassMenuButton( pClassControl, pClassMenu );
+ pRoot->Insert( pClassMenuButton );
+
+ /********** M E S S A G E B O X **************************************/
+ pClassMessBox = InitClassMessBox( pClassMgr, pMessButtons,
+ pMessDefButton );
+ pRoot->Insert( pClassMessBox );
+
+ /********** I N F O B O X ********************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "InfoBox" );
+ pClassInfoBox = new RscClass( nId, RSC_INFOBOX, pClassMessBox );
+ pClassInfoBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassInfoBox );
+ pRoot->Insert( pClassInfoBox );
+
+ /********** W A R N I N G B O X **************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "WarningBox" );
+ pClassWarningBox = new RscClass( nId, RSC_WARNINGBOX, pClassMessBox );
+ pClassWarningBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassWarningBox );
+ pRoot->Insert( pClassWarningBox );
+
+ /********** E R R O R B O X ******************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "ErrorBox" );
+ pClassErrorBox = new RscClass( nId, RSC_ERRORBOX, pClassMessBox );
+ pClassErrorBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassErrorBox );
+ pRoot->Insert( pClassErrorBox );
+
+ /********** Q U E R Y B O X ******************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "QueryBox" );
+ pClassQueryBox = new RscClass( nId, RSC_QUERYBOX, pClassMessBox );
+ pClassQueryBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassQueryBox );
+ pRoot->Insert( pClassQueryBox );
+}
+{
+ /********** S P L I T T E R ******************************************/
+ pClassSplitter = InitClassSplitter( pClassWindow );
+ pRoot->Insert( pClassSplitter );
+
+ /********** S P L I T W I N D O W ************************************/
+ pClassSplitWindow = InitClassSplitWindow( pClassWindow );
+ pRoot->Insert( pClassSplitWindow );
+
+ /********** S P I N B U T T O N **************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "SpinButton" );
+ pClassSpinButton = new RscClass( nId, RSC_SPINBUTTON, pClassControl );
+ pClassSpinButton->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassSpinButton );
+ {
+ RscClient * pClient;
+
+ // Clientvariablen einfuegen
+ // Sysmodal
+ aBaseLst.Insert(
+ pClient = new RscClient( pHS->Insert( "BOOL" ), RSC_NOTYPE,
+ &aWinBits, nRepeatId ),
+ LIST_APPEND );
+ nId = aNmTb.Put( "Repeat", VARNAME );
+ pClassSpinButton->SetVariable( nId, pClient, NULL,
+ VAR_NODATAINST, 0, nWinBitVarId );
+ }
+ pRoot->Insert( pClassSpinButton );
+}
+{
+ /********** T I M E **************************************************/
+ pClassTime = InitClassTime( pClassMgr );
+ pRoot->Insert( pClassTime );
+
+ /********** D A T E **************************************************/
+ pClassDate = InitClassDate( pClassMgr, pDayOfWeek );
+ pRoot->Insert( pClassDate );
+}
+{
+ /********** I N T E R N A T I O N A L ********************************/
+ {
+ RscTop * pClassInt1;
+
+ pClassInt1 = InitClassInt1( pClassMgr,
+ pDateFormat, pTimeFormat,
+ pWeekDayFormat, pMonthFormat );
+ aBaseLst.Insert( pClassInt1, LIST_APPEND );
+ pClassI12 = InitClassInternational( pClassInt1,
+ pDateFormat, pTimeFormat,
+ pWeekDayFormat, pMonthFormat );
+ pRoot->Insert( pClassI12 );
+ }
+ {
+ pLangClassI12 = new RscClassArray( pHS->Insert( "LangInternational" ),
+ RSC_INTERNATIONAL, pClassI12, &aLangType,
+ &nLangTypeId, &nDfltLangTypeId );
+ aBaseLst.Insert( pLangClassI12 );
+ }
+
+ /********** S P I N F I E L D ****************************************/
+ pClassSpinField = InitClassSpinField( pClassEdit );
+ pRoot->Insert( pClassSpinField );
+}
+{
+ /********** P A T T E R N F I E L D **********************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassPatternFormatter( pClassSpinField );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassPatternField = InitClassPatternField( pClassTmp );
+ pRoot->Insert( pClassPatternField );
+ }
+ /********** N U M E R I C F I E L D **********************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassNumericField = InitClassNumericField( pClassTmp );
+ pRoot->Insert( pClassNumericField );
+ }
+ /********** M E T R I C F I E L D ************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+ pClassTmp = InitClassMetricFormatter( pClassTmp, pFieldUnits );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassMetricField = InitClassMetricField( pClassTmp );
+ pRoot->Insert( pClassMetricField );
+ }
+ /********** C U R R E N C Y F I E L D ********************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassNumericFormatter( pClassSpinField,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+ pClassTmp = InitClassCurrencyFormatter( pClassTmp, pFieldUnits );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassCurrencyField = InitClassCurrencyField( "CurrencyField", RSC_CURRENCYFIELD, pClassTmp );
+ pRoot->Insert( pClassCurrencyField );
+
+ pClassLongCurrencyField = InitClassCurrencyField( "LongCurrencyField", RSC_LONGCURRENCYFIELD, pClassTmp );
+ pRoot->Insert( pClassLongCurrencyField );
+
+ }
+ /********** D A T E F I E L D ****************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassDateFormatter( pClassSpinField, pClassDate,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassDateField = InitClassDateField( pClassTmp, pClassDate );
+ pRoot->Insert( pClassDateField );
+ }
+ /********** T I M E F I E L D ****************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassTimeFormatter( pClassSpinField, pClassTime,
+ pClassI12, pTimeFieldFormat );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassTimeField = InitClassTimeField( pClassTmp, pClassTime );
+ pRoot->Insert( pClassTimeField );
+ }
+ /********** P A T T E R N B O X **************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassPatternFormatter( pClassComboBox );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassPatternBox = InitClassPatternBox( pClassTmp );
+ pRoot->Insert( pClassPatternBox );
+ }
+ /********** N U M E R I C B O X **************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassNumericBox = InitClassNumericBox( pClassTmp );
+ pRoot->Insert( pClassNumericBox );
+ }
+}
+{
+ /********** M E T R I C B O X ****************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+ pClassTmp = InitClassMetricFormatter( pClassTmp, pFieldUnits );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassMetricBox = InitClassMetricBox( pClassTmp );
+ pRoot->Insert( pClassMetricBox );
+ }
+ /********** C U R R E N C Y B O X ************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassNumericFormatter( pClassComboBox,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+ pClassTmp = InitClassCurrencyFormatter( pClassTmp, pFieldUnits );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassCurrencyBox = InitClassCurrencyBox( "CurrencyBox", RSC_CURRENCYBOX, pClassTmp );
+ pRoot->Insert( pClassCurrencyBox );
+
+ pClassLongCurrencyBox = InitClassCurrencyBox( "LongCurrencyBox", RSC_LONGCURRENCYBOX, pClassTmp );
+ pRoot->Insert( pClassLongCurrencyBox );
+ }
+ /********** D A T E B O X ********************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassDateFormatter( pClassComboBox, pClassDate,
+ pClassI12 );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassDateBox = InitClassDateBox( pClassTmp, pClassDate );
+ pRoot->Insert( pClassDateBox );
+ }
+ /********** T I M E B O X ********************************************/
+ { // Mehrfachvererbung von Hand
+ RscTop * pClassTmp = InitClassTimeFormatter( pClassComboBox, pClassTime,
+ pClassI12, pTimeFieldFormat );
+ aBaseLst.Insert( pClassTmp, LIST_APPEND );
+
+ pClassTimeBox = InitClassTimeBox( pClassTmp, pClassTime );
+ pRoot->Insert( pClassTimeBox );
+ }
+ /********** D O C K I N G W I N D O W ********************************/
+ pClassDockingWindow = InitClassDockingWindow( pClassWindow, pMapUnit );
+ pRoot->Insert( pClassDockingWindow );
+
+ /********** T O O L B O X I T E M ************************************/
+ pClassToolBoxItem = InitClassToolBoxItem( pClassMgr, pClassBitmap,
+ pClassImage, pTriState );
+ pRoot->Insert( pClassToolBoxItem );
+
+ /********** T O O L B O X ********************************************/
+ pClassToolBox = InitClassToolBox( pClassDockingWindow, pClassToolBoxItem,
+ pClassImageList );
+ pRoot->Insert( pClassToolBox );
+
+ /********** S T A T U S B A R ****************************************/
+ pClassStatusBar = InitClassStatusBar( pClassWindow );
+ pRoot->Insert( pClassStatusBar );
+
+ /********** M O R E B U T T O N **************************************/
+ pClassMoreButton = InitClassMoreButton( pClassPushButton, pMapUnit );
+ pRoot->Insert( pClassMoreButton );
+
+ /********** F L O A T W I N D O W ************************************/
+ pClassFloatingWindow = InitClassFloatingWindow( pClassSystemWindow,
+ pMapUnit );
+ pRoot->Insert( pClassFloatingWindow );
+
+ /********** T A B P A G E ********************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "TabPage" );
+ pClassTabPage =
+ new RscClass( nId, RSC_TABPAGE, pClassWindow );
+ pClassTabPage->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassTabPage );
+ pRoot->Insert( pClassTabPage );
+
+ /********** T A B D I A L O G ****************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "TabDialog" );
+ pClassTabDialog =
+ new RscClass( nId, RSC_TABDIALOG, pClassModalDialog );
+ pClassTabDialog->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassTabDialog );
+ pRoot->Insert( pClassTabDialog );
+
+ /********** T A B C O N T R O L I T E M *******************************/
+ pClassTabControlItem = InitClassTabControlItem( pClassMgr,
+ pClassTabPage );
+ pRoot->Insert( pClassTabControlItem );
+
+ /********** T A B C O N T R O L **************************************/
+ pClassTabControl = InitClassTabControl( pClassControl,
+ pClassTabControlItem );
+ pRoot->Insert( pClassTabControl );
+
+ /********** F I X E D L I N E ****************************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "FixedLine" );
+ pClassFixedLine =
+ new RscClass( nId, RSC_FIXEDLINE, pClassControl );
+ pClassFixedLine->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassFixedLine );
+ pRoot->Insert( pClassFixedLine );
+
+ /********** S C R O L L B A R B O X **********************************/
+ // Klasse anlegen
+ nId = pHS->Insert( "ScrollBarBox" );
+ pClassScrollBarBox =
+ new RscClass( nId, RSC_SCROLLBARBOX, pClassWindow );
+ pClassScrollBarBox->SetCallPar( *pWinPar1, *pWinPar2, *pWinParType );
+ aNmTb.Put( nId, CLASSNAME, pClassScrollBarBox );
+ pRoot->Insert( pClassScrollBarBox );
+ INS_WINBIT(pClassScrollBarBox,Sizeable)
+
+ /********** S F X S T Y L E F A M I L Y I T E M **********************/
+ pClassSfxStyleFamilyItem = InitClassSfxStyleFamilyItem( pClassMgr,
+ pClassBitmap,
+ pClassImage,
+ pLangStringLongTupelList );
+ pRoot->Insert( pClassSfxStyleFamilyItem );
+
+ /********** S F X T E M P L A T E D I A L O G ************************/
+ pClassSfxTemplateDialog = InitClassSfxTemplateDialog( pClassMgr,
+ pClassSfxStyleFamilyItem );
+ pRoot->Insert( pClassSfxTemplateDialog );
+
+ /********** S F X I N F O I T E M ************************************/
+ pClassSfxSlotInfo = InitClassSfxSlotInfo( pClassMgr );
+ pRoot->Insert( pClassSfxSlotInfo );
+}
+ NameToVerCtrl( aVersion, pRoot, pClassString );
+
+ aNmTb.SetSort();
+}
+
diff --git a/rsc/source/parser/rsckey.cxx b/rsc/source/parser/rsckey.cxx
new file mode 100644
index 000000000000..43a40e89ad66
--- /dev/null
+++ b/rsc/source/parser/rsckey.cxx
@@ -0,0 +1,297 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsckey.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/rsckey.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.13 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.12 2000/07/26 17:13:21 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.11 1999/10/25 11:48:18 mh
+ changes for VC6
+
+ Revision 1.10 1997/08/27 18:17:12 MM
+ neue Headerstruktur
+
+
+ Rev 1.9 27 Aug 1997 18:17:12 MM
+ neue Headerstruktur
+
+ Rev 1.8 03 Jan 1997 17:07:16 MH
+ Calling Convention
+
+ Rev 1.7 12 Jan 1996 17:23:40 TRI
+ WNTWTC Anpassung
+
+ Rev 1.6 21 Nov 1995 19:49:48 TLX
+ Neuer Link
+
+ Rev 1.5 27 Jul 1995 16:57:36 MM
+ LongEnumRange
+
+ Rev 1.4 16 Feb 1995 19:51:06 MM
+ char * -> const char *
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+#pragma hdrstop
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCKEY_HXX
+#include <rsckey.hxx>
+#endif
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
+#define _cdecl __cdecl
+#endif
+
+/****************** C o d e **********************************************/
+/****************** keyword sort function ********************************/
+extern "C" {
+#if defined( ZTC ) && defined( PM2 )
+ int __CLIB KeyCompare( const void * pFirst, const void * pSecond );
+#else
+#if defined( WNT ) && !defined( WTC ) && !defined (ICC)
+ int _cdecl KeyCompare( const void * pFirst, const void * pSecond );
+#else
+ int KeyCompare( const void * pFirst, const void * pSecond );
+#endif
+#endif
+}
+
+#if defined( WNT ) && !defined( WTC ) && !defined(ICC)
+int _cdecl KeyCompare( const void * pFirst, const void * pSecond ){
+#else
+int KeyCompare( const void * pFirst, const void * pSecond ){
+#endif
+ if( ((KEY_STRUCT *)pFirst)->nName > ((KEY_STRUCT *)pSecond)->nName )
+ return( 1 );
+ else if( ((KEY_STRUCT *)pFirst)->nName < ((KEY_STRUCT *)pSecond)->nName )
+ return( -1 );
+ else
+ return( 0 );
+}
+
+/*************************************************************************
+|*
+|* RscNameTable::RscNameTable()
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 28.02.91
+|* Letzte Aenderung MM 28.02.91
+|*
+*************************************************************************/
+RscNameTable::RscNameTable() {
+ bSort = TRUE;
+ nEntries = 0;
+ pTable = NULL;
+};
+
+/*************************************************************************
+|*
+|* RscNameTable::~RscNameTable()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+RscNameTable::~RscNameTable() {
+ if( pTable )
+ RscMem::Free( pTable );
+};
+
+
+/*************************************************************************
+|*
+|* RscNameTable::SetSort()
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 28.02.91
+|* Letzte Aenderung MM 28.02.91
+|*
+*************************************************************************/
+void RscNameTable::SetSort( BOOL bSorted ){
+ bSort = bSorted;
+ if( bSort && pTable){
+ // Schluesselwort Feld sortieren
+ qsort( (void *)pTable, nEntries,
+ sizeof( KEY_STRUCT ), KeyCompare );
+ };
+};
+
+/*************************************************************************
+|*
+|* RscNameTable::Put()
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 28.02.91
+|* Letzte Aenderung MM 28.02.91
+|*
+*************************************************************************/
+HASHID RscNameTable::Put( HASHID nName, USHORT nTyp, long nValue ){
+ if( pTable )
+ pTable = (KEY_STRUCT *)
+ RscMem::Realloc( (void *)pTable,
+ (USHORT)((nEntries +1) * sizeof( KEY_STRUCT )) );
+ else
+ pTable = (KEY_STRUCT *)
+ RscMem::Malloc( (USHORT)((nEntries +1)
+ * sizeof( KEY_STRUCT )) );
+ pTable[ nEntries ].nName = nName;
+ pTable[ nEntries ].nTyp = nTyp;
+ pTable[ nEntries ].yylval = nValue;
+ nEntries++;
+ if( bSort )
+ SetSort();
+ return( nName );
+};
+
+HASHID RscNameTable::Put( const char * pName, USHORT nTyp, long nValue )
+{
+ return( Put( pHS->Insert( pName ), nTyp, nValue ) );
+};
+
+HASHID RscNameTable::Put( HASHID nName, USHORT nTyp )
+{
+ return( Put( nName, nTyp, (long)nName ) );
+};
+
+HASHID RscNameTable::Put( const char * pName, USHORT nTyp )
+{
+ HASHID nId;
+
+ nId = pHS->Insert( pName );
+ return( Put( nId, nTyp, (long)nId ) );
+};
+
+HASHID RscNameTable::Put( HASHID nName, USHORT nTyp, RscTop * pClass )
+{
+ return( Put( nName, nTyp, (long)pClass ) );
+};
+
+HASHID RscNameTable::Put( const char * pName, USHORT nTyp, RscTop * pClass )
+{
+ return( Put( pHS->Insert( pName ), nTyp, (long)pClass ) );
+};
+
+/*************************************************************************
+|*
+|* RscNameTable::Get()
+|*
+|* Beschreibung RES.DOC
+|* Ersterstellung MM 28.02.91
+|* Letzte Aenderung MM 28.02.91
+|*
+*************************************************************************/
+BOOL RscNameTable::Get( HASHID nName, KEY_STRUCT * pEle ){
+ KEY_STRUCT * pKey = NULL;
+ KEY_STRUCT aSearchName;
+ USHORT i;
+
+ if( bSort ){
+ // Suche nach dem Schluesselwort
+ aSearchName.nName = nName;
+ pKey = (KEY_STRUCT *)bsearch(
+#ifdef UNX
+ (const char *) &aSearchName, (char *)pTable,
+#else
+ (const void *) &aSearchName, (const void *)pTable,
+#endif
+ nEntries, sizeof( KEY_STRUCT ), KeyCompare );
+ }
+ else{
+ i = 0;
+ while( i < nEntries && !pKey ){
+ if( pTable[ i ].nName == nName )
+ pKey = &pTable[ i ];
+ i++;
+ };
+ };
+
+ if( pKey ){ // Schluesselwort gefunden
+ *pEle = *pKey;
+ return( TRUE );
+ };
+ return( FALSE );
+};
+
diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx
new file mode 100644
index 000000000000..33a14d309d57
--- /dev/null
+++ b/rsc/source/parser/rsclex.cxx
@@ -0,0 +1,588 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsclex.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/rsclex.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+**************************************************************************/
+#pragma hdrstop
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+
+#ifdef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+#ifndef _RSCKEY_HXX
+#include <rsckey.hxx>
+#endif
+#ifndef _RSCPAR_HXX
+#include <rscpar.hxx>
+#endif
+#ifndef _RSCDEF_HXX
+#include <rscdef.hxx>
+#endif
+
+#include "rsclex.hxx"
+#include <rscyacc.yxx.h>
+
+#include <rtl/textcvt.h>
+#include <rtl/textenc.h>
+
+DECLARE_LIST( RscCharList, char * );
+/*************************************************************************/
+int c;
+BOOL bLastInclude;// War letztes Symbol INCLUDE
+RscFileInst* pFI;
+RscTypCont* pTC;
+RscCharStack * pCS;
+RscExpression * pExp;
+struct {
+ int nKeyWord;
+ YYSTYPE aYYSType;
+} aKeyVal[ 1 ];
+BOOL bTargetDefined;
+
+
+/****************** C O D E **********************************************/
+ULONG GetNumber(){
+ ULONG l = 0;
+ short nLog = 10;
+
+ if( '0' == c ){
+ c = pFI->GetFastChar();
+ if( 'x' == c ){
+ nLog = 16;
+ c = pFI->GetFastChar();
+ }
+ };
+
+ if( nLog == 16 ){
+ while( isxdigit( c ) ){
+ if( isdigit( c ) )
+ l = l * nLog + (c - '0');
+ else
+ l = l * nLog + (toupper( c ) - 'A' + 10 );
+ c = pFI->GetFastChar();
+ }
+ }
+ else{
+ while( isdigit( c ) || 'x' == c ){
+ l = l * nLog + (c - '0');
+ c = pFI->GetFastChar();
+ }
+ }
+
+ while( c=='U' || c=='u' || c=='l' || c=='L' ) //Wg. Unsigned Longs
+ c = pFI->GetFastChar();
+
+ if( l > LONG_MAX ) //Oberstes bit gegebenenfalls abschneiden;
+ l &= LONG_MAX;
+
+ return( l );
+}
+
+char * MallocString(){
+ char * pRet;
+
+ if( NULL == (pRet = pCS->Pop()) )
+ pRet = (char *)RscMem::Malloc( MINBUF );
+
+ *pRet = '\0';
+
+ return( pRet );
+}
+
+void PutStringBack( char * pStr ){
+ //pCS->Push( pStr );
+}
+
+int MakeToken( YYSTYPE * pTokenVal ){
+ int c1;
+ USHORT i;
+ char * pStr;
+
+ while( TRUE ){ // Kommentare und Leerzeichen ueberlesen
+ while( isspace( c ) )
+ c = pFI->GetFastChar();
+ if( '/' == c ){
+ c1 = c;
+ c = pFI->GetFastChar();
+ if( '/' == c ){
+ while( '\n' != c && !pFI->IsEof() )
+ c = pFI->GetFastChar();
+ c = pFI->GetFastChar();
+ }
+ else if( '*' == c ){
+ c = pFI->GetFastChar();
+ do {
+ while( '*' != c && !pFI->IsEof() )
+ c = pFI->GetFastChar();
+ c = pFI->GetFastChar();
+ } while( '/' != c && !pFI->IsEof() );
+ c = pFI->GetFastChar();
+ }
+ else
+ return( c1 );
+ }
+ else
+ break;
+ };
+
+ if( c == pFI->IsEof() ){
+ return( 0 );
+ }
+
+ if( bLastInclude ){
+ bLastInclude = FALSE; //Zuruecksetzten
+ if( '<' == c ){
+ USHORT nBufLen = MINBUF;
+ char * pBuf = MallocString();
+
+ i = 0;
+ c = pFI->GetFastChar();
+ while( '>' != c && !pFI->IsEof() )
+ {
+ if( nBufLen <= (USHORT)(i +1) )
+ {
+ nBufLen += MINBUF;
+ pBuf = (char *)RscMem::Realloc( pBuf, nBufLen );
+ }
+ pBuf[i++] = c;
+ c = pFI->GetFastChar();
+ };
+ c = pFI->GetFastChar();
+ pBuf[i] = '\0';
+ pTokenVal->string = pBuf;
+ return( INCLUDE_STRING );
+ };
+ }
+
+ if( c == '"' )
+ {
+ USHORT nBufLen = MINBUF;
+ char * pBuf = MallocString();
+
+ i = 0;
+ BOOL bDone = FALSE;
+ while( !bDone && !pFI->IsEof() && c )
+ {
+ if( nBufLen <= (USHORT)(i +2) )
+ {
+ nBufLen += MINBUF;
+ pBuf = (char *)RscMem::Realloc( pBuf, nBufLen );
+ }
+ c = pFI->GetFastChar();
+ if( c == '"' )
+ {
+ c = pFI->GetFastChar();
+ if( c == '"' )
+ {
+ pBuf[i++] = '"';
+ pBuf[i++] = '"';
+ }
+ else
+ bDone = TRUE;
+ }
+ else if( c == '\\' )
+ {
+ pBuf[i++] = '\\';
+ c = pFI->GetFastChar();
+ if( c )
+ {
+ pBuf[i++] = c;
+ }
+ }
+ else
+ pBuf[i++] = c;
+ }
+ pBuf[i++] = '\0';
+ //pStr = pTokenVal->string = RscChar::MakeUTF8( pBuf, pFI->GetCharSet() );
+ pStr = pTokenVal->string = pBuf;
+ //PutStringBack( pBuf );
+ return( STRING );
+ }
+ if (isdigit (c)){
+ pTokenVal->value = GetNumber();
+ return( NUMBER );
+ }
+
+ if( isalpha (c) || (c == '_') ){
+ HASHID nHashId;
+ USHORT nBufLen = MINBUF;
+ char * pBuf = MallocString();
+
+
+ i = 0;
+ while( isalnum (c) || (c == '_') )
+ {
+ if( nBufLen <= (USHORT)(i +1) )
+ {
+ nBufLen += MINBUF;
+ pBuf = (char *)RscMem::Realloc( pBuf, nBufLen );
+ }
+ pBuf[i++] = c;
+ c = pFI->GetFastChar();
+ }
+ /*
+ if( pBuf[0] == 'L' && i == 1 && c == '"' )
+ {
+ // it is an L string
+
+ i = 0;
+ BOOL bDone = FALSE;
+ while( !bDone && !pFI->IsEof() && c )
+ {
+ if( nBufLen <= (USHORT)(i +2) )
+ {
+ nBufLen += MINBUF;
+ pBuf = (char *)RscMem::Realloc( pBuf, nBufLen );
+ }
+ c = pFI->GetFastChar();
+ if( c == '"' )
+ {
+ c = pFI->GetFastChar();
+ if( c == '"' )
+ {
+ pBuf[i++] = '"';
+ pBuf[i++] = '"';
+ }
+ else
+ bDone = TRUE;
+ }
+ else if( c == '\\' )
+ {
+ pBuf[i++] = '\\';
+ c = pFI->GetFastChar();
+ if( c )
+ {
+ pBuf[i++] = c;
+ }
+ }
+ else
+ pBuf[i++] = c;
+ }
+ pBuf[i++] = '\0';
+ pStr = pTokenVal->string = RscChar::MakeUTF8FromL( pBuf );
+ PutStringBack( pBuf );
+ return( STRING );
+ }
+ else
+ */
+ {
+ pBuf[i++] = '\0';
+
+ nHashId = pHS->Test( pBuf );
+ if( HASH_NONAME != nHashId )
+ {
+ KEY_STRUCT aKey;
+
+ // Suche nach dem Schluesselwort
+ if( pTC->aNmTb.Get( nHashId, &aKey ) )
+ {
+
+ // Schluesselwort gefunden
+ switch( aKey.nTyp )
+ {
+ case CLASSNAME:
+ pTokenVal->pClass = (RscTop *)aKey.yylval;
+ break;
+ case VARNAME:
+ pTokenVal->varid = aKey.nName;
+ break;
+ case CONSTNAME:
+ pTokenVal->constname.hashid = aKey.nName;
+ pTokenVal->constname.nValue = aKey.yylval;
+ break;
+ case BOOLEAN:
+ pTokenVal->svbool = (BOOL)aKey.yylval;
+ break;
+ case INCLUDE:
+ bLastInclude = TRUE;
+ default:
+ pTokenVal->value = aKey.yylval;
+ };
+
+ // String zurueckgeben
+ PutStringBack( pBuf );
+ return( aKey.nTyp );
+ }
+ else{
+ pTokenVal->string = pBuf;
+ return( SYMBOL );
+ }
+ }
+ else{ // Symbol
+ RscDefine * pDef;
+
+ pDef = pTC->aFileTab.FindDef( pBuf );
+ if( pDef ){
+ pTokenVal->defineele = pDef;
+
+ // String zurueckgeben
+ PutStringBack( pBuf );
+ return( RSCDEFINE );
+ }
+
+ pTokenVal->string = pBuf;
+ return( SYMBOL );
+ }
+ }
+ }
+
+ if( c=='<' )
+ {
+ c = pFI->GetFastChar();
+ if( c=='<' )
+ {
+ c = pFI->GetFastChar();
+ return LEFTSHIFT;
+ }
+ else
+ return '<';
+ }
+
+ if( c=='>' )
+ {
+ c = pFI->GetFastChar();
+ if( c=='>' )
+ {
+ c = pFI->GetFastChar();
+ return RIGHTSHIFT;
+ }
+ else
+ return '>';
+ }
+
+ c1 = c;
+ c = pFI->GetFastChar();
+ return( c1 );
+}
+
+#if defined( RS6000 ) || defined( HP9000 ) || defined( SCO )
+extern "C" int yylex()
+#else
+int yylex()
+#endif
+{
+ if( bTargetDefined )
+ bTargetDefined = FALSE;
+ else
+ aKeyVal[ 0 ].nKeyWord =
+ MakeToken( &aKeyVal[ 0 ].aYYSType );
+
+ yylval = aKeyVal[ 0 ].aYYSType;
+ return( aKeyVal[ 0 ].nKeyWord );
+}
+
+/****************** yyerror **********************************************/
+#ifdef RS6000
+extern "C" void yyerror( char* pMessage )
+#elif defined HP9000 || defined SCO || defined IRIX || defined SOLARIS
+extern "C" void yyerror( const char* pMessage )
+#else
+void yyerror( char* pMessage )
+#endif
+{
+ pTC->pEH->Error( ERR_YACC, NULL, RscId(), pMessage );
+}
+
+/****************** parser start function ********************************/
+void InitParser( RscFileInst * pFileInst )
+{
+ pTC = pFileInst->pTypCont; // Datenkontainer setzten
+ pFI = pFileInst;
+ pCS = new RscCharStack(); //Puffer Vorrat
+ pExp = NULL; //fuer MacroParser
+ bTargetDefined = FALSE;
+
+ // Anfangszeichen initialisieren
+ bLastInclude = FALSE;
+ c = pFI->GetFastChar();
+}
+
+void EndParser(){
+ char * pStr;
+
+ // Stack abraeumen
+ while( ! S.IsEmpty() )
+ S.Pop();
+
+ // Speicher freigeben
+ while( NULL != (pStr = pCS->Pop()) )
+ RscMem::Free( pStr );
+ delete pCS;
+ if( pExp )
+ delete pExp;
+ pTC = NULL;
+ pFI = NULL;
+ pCS = NULL;
+ pExp = NULL;
+
+}
+
+void IncludeParser( RscFileInst * pFileInst )
+{
+ int nToken; // Wert des Tokens
+ YYSTYPE aYYSType; // Daten des Tokens
+ RscFile * pFName; // Filestruktur
+ ULONG lKey; // Fileschluessel
+ RscTypCont * pTypCon = pFileInst->pTypCont;
+
+ pFName = pTypCon->aFileTab.Get( pFileInst->GetFileIndex() );
+ InitParser( pFileInst );
+
+ nToken = MakeToken( &aYYSType );
+ while( 0 != nToken && CLASSNAME != nToken ){
+ if( '#' == nToken ){
+ if( INCLUDE == (nToken = MakeToken( &aYYSType )) ){
+ if( STRING == (nToken = MakeToken( &aYYSType )) ){
+ lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string,
+ aYYSType.string );
+ pFName->InsertDependFile( lKey, LIST_APPEND );
+ }
+ else if( INCLUDE_STRING == nToken ){
+ lKey = pTypCon->aFileTab.NewIncFile( aYYSType.string,
+ ByteString() );
+ pFName->InsertDependFile( lKey, LIST_APPEND );
+ };
+ };
+ };
+ switch( nToken ){
+ case STRING:
+ case INCLUDE_STRING:
+ case SYMBOL:
+ // String zurueckgeben
+ pCS->Push( aYYSType.string );
+ break;
+ };
+ nToken = MakeToken( &aYYSType );
+ };
+
+ EndParser();
+}
+
+ERRTYPE parser( RscFileInst * pFileInst )
+{
+ ERRTYPE aError;
+
+ InitParser( pFileInst );
+
+ aError = yyparse();
+
+ EndParser();
+
+ // yyparser gibt 0 zurueck, wenn erfolgreich
+ if( 0 == (USHORT)aError )
+ aError.Clear();
+ if( pFileInst->pTypCont->pEH->nErrors )
+ aError = ERR_ERROR;
+ pFileInst->SetError( aError );
+ return( aError );
+}
+
+RscExpression * MacroParser( RscFileInst & rFileInst )
+{
+ ERRTYPE aError;
+ RscExpression * pExpression;
+
+ InitParser( &rFileInst );
+
+ //Ziel auf macro_expression setzen
+ aKeyVal[ 0 ].nKeyWord = MACROTARGET;
+ bTargetDefined = TRUE;
+ aError = yyparse();
+
+ pExpression = pExp;
+ //EndParser() wuerde pExp loeschen
+ if( pExp )
+ pExp = NULL;
+
+ EndParser();
+
+ // yyparser gibt 0 zurueck, wenn erfolgreich
+ if( 0 == (USHORT)aError )
+ aError.Clear();
+ if( rFileInst.pTypCont->pEH->nErrors )
+ aError = ERR_ERROR;
+ rFileInst.SetError( aError );
+
+ //im Fehlerfall pExpression loeschen
+ if( aError.IsError() && pExpression ){
+ delete pExpression;
+ pExpression = NULL;
+ };
+ return( pExpression );
+}
+
diff --git a/rsc/source/parser/rsclex.hxx b/rsc/source/parser/rsclex.hxx
new file mode 100644
index 000000000000..e1b4704746ca
--- /dev/null
+++ b/rsc/source/parser/rsclex.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsclex.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.18 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.17 2000/07/26 17:13:21 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.16 1999/09/24 13:15:07 hr
+ forward decl.
+
+ Revision 1.15 1998/09/24 17:51:52 HR
+ GCC braucht richtige Vorwaertsdeklaration
+
+
+ Rev 1.14 24 Sep 1998 17:51:52 HR
+ GCC braucht richtige Vorwaertsdeklaration
+
+ Rev 1.13 27 Aug 1997 18:17:16 MM
+ neue Headerstruktur
+
+ Rev 1.12 18 Oct 1996 16:27:12 MM
+ dynamische Member
+
+ Rev 1.11 24 Jul 1996 12:49:02 mda
+ IRIX
+
+ Rev 1.10 18 Jun 1996 13:38:14 MM
+ Header Anpassungen
+
+ Rev 1.9 05 Jun 1996 19:22:40 PL
+ Deklarationen fuer SCO
+
+ Rev 1.8 21 Nov 1995 19:49:50 TLX
+ Neuer Link
+
+ Rev 1.7 10 Jan 1995 11:23:04 eg
+ HP9000 yyerror( const char* )
+
+ Rev 1.6 09 Sep 1994 12:08:06 MH
+ Watcom
+
+ Rev 1.5 25 Apr 1994 15:02:20 sv
+ HP9000 needs different declarations for yyerror and yylex (extern C)
+
+ Rev 1.4 12 Jan 1994 15:20:44 mm
+ Alignementprobleme und Warnings fuer DEC-Alpha beseitigt
+
+ Rev 1.3 21 Sep 1993 10:03:44 mm
+ RS6000 needs different prototyps (extern "C")
+
+ Rev 1.2 25 Aug 1993 15:25:02 mm
+ Fehler und Warnings beseitigt
+
+ Rev 1.1 23 Dec 1992 14:05:44 mm
+ Sprachaenderung
+
+ Rev 1.0 10 Aug 1992 07:22:46 MM
+ Initial revision.
+
+**************************************************************************/
+#include <tools/stack.hxx>
+
+#define MINBUF 256
+#define MAXBUF 256
+
+enum MODE_ENUM { MODE_MODELESS, MODE_APPLICATIONMODAL, MODE_SYSTEMMODAL };
+
+enum JUSTIFY_ENUM { JUST_CENTER, JUST_RIGHT, JUST_LEFT };
+
+enum SHOW_ENUM { SHOW_NORMAL, SHOW_MINIMIZED, SHOW_MAXIMIZED };
+
+enum ENUMHEADER { HEADER_NAME, HEADER_NUMBER };
+
+enum REF_ENUM { TYPE_NOTHING, TYPE_REF, TYPE_COPY };
+
+struct RSCHEADER {
+ RscTop * pClass;
+ RscExpType nName1;
+ REF_ENUM nTyp;
+ RscTop * pRefClass;
+ RscExpType nName2;
+};
+
+DECLARE_STACK( RscCharStack, char * )
+void PutStringBack( char * pStr );
+
+/************** O b j e c t s t a c k ************************************/
+struct Node {
+ Node* pPrev;
+ RSCINST aInst;
+ USHORT nTupelRec; // Rekursionstiefe fuer Tupel
+ Node() { pPrev = NULL; nTupelRec = 0; };
+};
+
+class ObjectStack {
+ private :
+ Node* pRoot;
+ public :
+
+ ObjectStack () { pRoot = NULL; }
+
+ const RSCINST & Top () { return pRoot->aInst; }
+ BOOL IsEmpty() { return( pRoot == NULL ); }
+ void IncTupelRec() { pRoot->nTupelRec++; }
+ void DecTupelRec() { pRoot->nTupelRec--; }
+ USHORT TupelRecCount() const { return pRoot->nTupelRec; }
+ void Push( RSCINST aInst )
+ {
+ Node* pTmp;
+
+ pTmp = pRoot;
+ pRoot = new Node;
+ pRoot->aInst = aInst;
+ pRoot->pPrev = pTmp;
+ }
+ void Pop()
+ {
+ Node* pTmp;
+
+ pTmp = pRoot;
+ pRoot = pTmp->pPrev;
+ delete pTmp;
+ }
+};
+
+/****************** F o r w a r d s **************************************/
+#if defined( RS6000 )
+extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion
+extern "C" void yyerror( char * );
+extern "C" int yylex( void );
+#elif defined( HP9000 ) || defined( SCO ) || defined ( IRIX ) || defined ( SOLARIS )
+extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion
+extern "C" void yyerror( const char * );
+extern "C" int yylex( void );
+#else
+#if defined ( WTC ) || defined ( GCC )
+int yyparse(); // forward Deklaration fuer erzeugte Funktion
+#else
+yyparse(); // forward Deklaration fuer erzeugte Funktion
+#endif
+void yyerror( char * );
+int yylex( void );
+#endif
+
+class RscTypCont;
+class RscFileInst;
+class RscCharStack;
+
+extern RscTypCont* pTC;
+extern RscFileInst * pFI;
+extern RscCharStack * pCS;
+extern RscExpression * pExp;
+extern ObjectStack S;
diff --git a/rsc/source/parser/rscpar.cxx b/rsc/source/parser/rscpar.cxx
new file mode 100644
index 000000000000..a0c3fd7d71a7
--- /dev/null
+++ b/rsc/source/parser/rscpar.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscpar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/rscpar.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.19 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.18 2000/07/26 17:13:21 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.17 2000/07/12 11:35:51 th
+ Unicode
+
+ Revision 1.16 1999/09/07 13:30:04 mm
+ UniCode
+
+ Revision 1.15 1997/08/27 18:17:18 MM
+ neue Headerstruktur
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+#pragma hdrstop
+
+// C and C++ Includes.
+#include <string.h>
+
+#ifndef _RSCPAR_HXX
+#include <rscpar.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+
+/****************** R s c F i l e I n s t ********************************/
+/****************** C O D E **********************************************/
+/*************************************************************************
+|*
+|* RscFileInst::Init()
+|*
+|* Beschreibung
+|* Ersterstellung MM 05.11.91
+|* Letzte Aenderung MM 17.02.93
+|*
+*************************************************************************/
+void RscFileInst::Init()
+{
+ SetCharSet( RTL_TEXTENCODING_MS_1252 );
+
+ nLineNo = 0;
+ nLineBufLen = 256;
+ pLine = (char *)RscMem::Malloc( nLineBufLen );
+ *pLine = '\0';
+ nScanPos = 0;
+ cLastChar = '\0';
+ bEof = FALSE;
+};
+
+/*************************************************************************
+|*
+|* RscFileInst::RscFileInst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.06.91
+|* Letzte Aenderung MM 06.06.91
+|*
+*************************************************************************/
+RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
+ ULONG lFIndex, FILE * fFile,
+ rtl_TextEncoding nSourceCharSet )
+{
+ pTypCont = pTC;
+ Init();
+
+ lFileIndex = lFIndex;
+ lSrcIndex = lIndexSrc;
+ fInputFile = fFile;
+
+ SetCharSet( nSourceCharSet );
+
+ //Status: Zeiger am Ende des Lesepuffers
+ nInputPos = nInputEndPos = nInputBufLen = READBUFFER_MAX;
+ pInput = (char *)RscMem::Malloc( nInputBufLen );
+}
+
+RscFileInst::RscFileInst( RscTypCont * pTC, ULONG lIndexSrc,
+ ULONG lFIndex, const ByteString& rBuf,
+ rtl_TextEncoding nSourceCharSet )
+{
+ pTypCont = pTC;
+ Init();
+ lFileIndex = lFIndex;
+ lSrcIndex = lIndexSrc;
+ fInputFile = NULL;
+ nInputPos = 0;
+ nInputEndPos = rBuf.Len();
+
+ SetCharSet( nSourceCharSet );
+
+ // Muss groesser sein wegen Eingabeende bei nInputBufLen < nInputEndPos
+ nInputBufLen = nInputEndPos +1;
+ pInput = (char *)RscMem::Malloc( nInputBufLen +100 );
+ memcpy( pInput, rBuf.GetBuffer(), nInputEndPos );
+}
+
+/*************************************************************************
+|*
+|* RscFileInst::~RscFileInst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.06.91
+|* Letzte Aenderung MM 06.06.91
+|*
+*************************************************************************/
+RscFileInst::~RscFileInst(){
+ if( pInput )
+ RscMem::Free( pInput );
+ if( pLine )
+ RscMem::Free( pLine );
+}
+
+/*************************************************************************
+|*
+|* RscFileInst::GetChar()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.06.91
+|* Letzte Aenderung MM 09.08.91
+|*
+*************************************************************************/
+int RscFileInst::GetChar()
+{
+ if( pLine[ nScanPos ] )
+ return( pLine[ nScanPos++ ] );
+ else if( nInputPos >= nInputEndPos && nInputEndPos != nInputBufLen )
+ {
+ // Dateiende
+ bEof = TRUE;
+ return 0;
+ }
+ else
+ {
+ GetNewLine();
+ return( '\n' );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscFileInst::GetNewLine()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.06.91
+|* Letzte Aenderung MM 06.06.91
+|*
+*************************************************************************/
+void RscFileInst::GetNewLine()
+{
+ nLineNo++;
+ nScanPos = 0;
+
+ //laeuft bis Dateiende
+ USHORT nLen = 0;
+ while( (nInputPos < nInputEndPos) || (nInputEndPos == nInputBufLen) )
+ {
+ if( (nInputPos >= nInputEndPos) && fInputFile )
+ {
+ nInputEndPos = fread( pInput, 1, nInputBufLen, fInputFile );
+ nInputPos = 0;
+ }
+
+ while( nInputPos < nInputEndPos )
+ {
+ //immer eine Zeile lesen
+ if( nLen >= nLineBufLen )
+ {
+ nLineBufLen += 256;
+ // einen dazu fuer '\0'
+ pLine = RscMem::Realloc( pLine, nLineBufLen +1 );
+ }
+
+ // cr lf, lf cr, lf oder cr wird '\0'
+ if( pInput[ nInputPos ] == '\n' ){
+ nInputPos++;
+ if( cLastChar != '\r' ){
+ cLastChar = '\n';
+ pLine[ nLen++ ] = '\0';
+ goto END;
+ }
+ }
+ else if( pInput[ nInputPos ] == '\r' ){
+ nInputPos++;
+ if( cLastChar != '\n' ){
+ cLastChar = '\r';
+ pLine[ nLen++ ] = '\0';
+ goto END;
+ }
+ }
+ else
+ pLine[ nLen++ ] = pInput[ nInputPos++ ];
+ };
+ };
+
+ // Abbruch ueber EOF
+ pLine[ nLen ] = '\0';
+
+END:
+ if( pTypCont->pEH->GetListFile() ){
+ char buf[ 10 ];
+
+ sprintf( buf, "%5d ", GetLineNo() );
+ pTypCont->pEH->LstOut( buf );
+ pTypCont->pEH->LstOut( GetLine() );
+ pTypCont->pEH->LstOut( "\n" );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscFileInst::SetError()
+|*
+|* Beschreibung
+|* Ersterstellung MM 05.11.91
+|* Letzte Aenderung MM 05.11.91
+|*
+*************************************************************************/
+void RscFileInst::SetError( ERRTYPE aError )
+{
+ if( aError.IsOk() )
+ {
+ aFirstError = aError;
+ nErrorLine = GetLineNo();
+ nErrorPos = GetScanPos() -1;
+ };
+};
diff --git a/rsc/source/parser/rscyacc.cxx b/rsc/source/parser/rscyacc.cxx
new file mode 100644
index 000000000000..50cc9cd034a7
--- /dev/null
+++ b/rsc/source/parser/rscyacc.cxx
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscyacc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/parser/rscyacc.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+*************************************************************************/
+#pragma hdrstop
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+
+#include <tools/rc.h>
+
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+#ifndef _RSCCLASS_HXX
+#include <rscclass.hxx>
+#endif
+#ifndef _RSCCONT_HXX
+#include <rsccont.hxx>
+#endif
+#ifndef _RSCTREE_HXX
+#include <rsctree.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCDEF_HXX
+#include <rscdef.hxx>
+#endif
+#ifndef _RSCPAR_HXX
+#include <rscpar.hxx>
+#endif
+
+#include "rsclex.hxx"
+
+/************** V a r i a b l e n ****************************************/
+ObjectStack S;
+RscTop * pCurClass;
+USHORT nCurMask;
+char szErrBuf[ 100 ];
+
+/************** H i l f s F u n k t i o n e n ****************************/
+RSCINST GetVarInst( const RSCINST & rInst, char * pVarName )
+{
+ RSCINST aInst;
+
+ aInst = rInst.pClass->GetVariable( rInst, pHS->Insert( pVarName ),
+ RSCINST() );
+
+ if( !aInst.pData )
+ pTC->pEH->Error( ERR_NOVARIABLENAME, rInst.pClass, RscId() );
+
+ return( aInst );
+}
+
+void SetNumber( const RSCINST & rInst, char * pVarName, long lValue )
+{
+ RSCINST aInst;
+
+ aInst = GetVarInst( rInst, pVarName );
+
+ if( aInst.pData ){
+ ERRTYPE aError;
+ aError = aInst.pClass->SetNumber( aInst, lValue );
+
+ if( aError.IsError() )
+ pTC->pEH->Error( aError, aInst.pClass, RscId() );
+ }
+}
+
+void SetConst( const RSCINST & rInst, char * pVarName,
+ HASHID nValueId, long nVal )
+{
+ RSCINST aInst;
+
+ aInst = GetVarInst( rInst, pVarName );
+ if( aInst.pData )
+ {
+ ERRTYPE aError;
+ aError = aInst.pClass->SetConst( aInst, nValueId, nVal );
+
+ if( aError.IsError() )
+ pTC->pEH->Error( aError, aInst.pClass, RscId() );
+ }
+}
+
+void SetString( const RSCINST & rInst, char * pVarName, char * pStr )
+{
+ RSCINST aInst;
+
+ aInst = GetVarInst( rInst, pVarName );
+ if( aInst.pData ){
+ ERRTYPE aError;
+ aError = aInst.pClass->SetString( aInst, pStr );
+
+ if( aError.IsError() )
+ pTC->pEH->Error( aError, aInst.pClass, RscId() );
+ }
+}
+
+RscId MakeRscId( RscExpType aExpType )
+{
+ if( !aExpType.IsNothing() ){
+ long lValue;
+
+ if( !aExpType.Evaluate( &lValue ) )
+ pTC->pEH->Error( ERR_ZERODIVISION, NULL, RscId() );
+ if( lValue < 1 || lValue > (long)0x7FFF )
+ {
+ pTC->pEH->Error( ERR_IDRANGE, NULL, RscId(),
+ ByteString::CreateFromInt32( lValue ).GetBuffer() );
+ }
+
+ if( aExpType.IsDefinition() )
+ return RscId( aExpType.aExp.pDef );
+ else
+ return RscId( lValue );
+ }
+ return RscId();
+}
+
+BOOL DoClassHeader( RSCHEADER * pHeader, BOOL bMember )
+{
+ RSCINST aCopyInst;
+ RscId aName1 = MakeRscId( pHeader->nName1 );
+ RscId aName2 = MakeRscId( pHeader->nName2 );
+
+ if( pHeader->pRefClass )
+ aCopyInst.pClass = pHeader->pRefClass;
+ else
+ aCopyInst.pClass = pHeader->pClass;
+
+ if( TYPE_COPY == pHeader->nTyp )
+ {
+ ObjNode * pCopyObj = aCopyInst.pClass->GetObjNode( aName2 );
+
+ if( !pCopyObj )
+ {
+ ByteString aMsg( pHS->Get( aCopyInst.pClass->GetId() ) );
+ aMsg += ' ';
+ aMsg += aName2.GetName();
+ pTC->pEH->Error( ERR_NOCOPYOBJ, pHeader->pClass, aName1,
+ aMsg.GetBuffer() );
+ }
+ else
+ aCopyInst.pData = pCopyObj->GetRscObj();
+ }
+
+ if( bMember )
+ {
+ // Angabe von Superklassen oder abgeleiteten Klassen ist jetzt erlaubt
+ if( S.Top().pClass->InHierarchy( pHeader->pClass )
+ || pHeader->pClass->InHierarchy( S.Top().pClass) )
+ {
+ if( aCopyInst.IsInst() )
+ {
+ RSCINST aTmpI( S.Top() );
+ aTmpI.pClass->Destroy( aTmpI );
+ aTmpI.pClass->Create( &aTmpI, aCopyInst );
+ };
+ }
+ else
+ pTC->pEH->Error( ERR_FALSETYPE, S.Top().pClass, aName1,
+ pHS->Get( pHeader->pClass->GetId() ) );
+ }
+ else
+ {
+ if( S.IsEmpty() )
+ {
+ if( (long)aName1 < 256 )
+ pTC->pEH->Error( WRN_GLOBALID, pHeader->pClass, aName1 );
+
+ if( aCopyInst.IsInst() )
+ S.Push( pHeader->pClass->Create( NULL, aCopyInst ) );
+ else
+ S.Push( pHeader->pClass->Create( NULL, RSCINST() ) );
+
+ ObjNode * pNode = new ObjNode( aName1, S.Top().pData,
+ pFI->GetFileIndex() );
+ pTC->pEH->StdOut( "." );
+
+ if( !aName1.IsId() )
+ pTC->pEH->Error( ERR_IDEXPECTED, pHeader->pClass, aName1 );
+ else if( !pHeader->pClass->PutObjNode( pNode ) )
+ pTC->pEH->Error( ERR_DOUBLEID, pHeader->pClass, aName1 );
+ }
+ else
+ {
+ RSCINST aTmpI;
+ ERRTYPE aError;
+
+ if( (long)aName1 >= 256 && aName1.IsId() )
+ pTC->pEH->Error( WRN_LOCALID, pHeader->pClass, aName1 );
+ aError = S.Top().pClass->GetElement( S.Top(), aName1,
+ pHeader->pClass, aCopyInst, &aTmpI );
+
+ if( aError.IsWarning() )
+ pTC->pEH->Error( aError, pHeader->pClass, aName1 );
+ else if( aError.IsError() )
+ {
+ if( ERR_CONT_INVALIDTYPE == (USHORT)aError )
+ pTC->pEH->Error( aError, S.Top().pClass, aName1,
+ pHS->Get( pHeader->pClass->GetId() ) );
+ else
+ pTC->pEH->Error( aError, S.Top().pClass, aName1 );
+ S.Top().pClass->GetElement( S.Top(), RscId(),
+ pHeader->pClass, RSCINST(), &aTmpI );
+
+ if( !aTmpI.IsInst() )
+ return( FALSE );
+ }
+ S.Push( aTmpI );
+ };
+ };
+ if( TYPE_REF == pHeader->nTyp )
+ {
+ ERRTYPE aError;
+
+ aError = S.Top().pClass->SetRef( S.Top(), aName2 );
+ pTC->pEH->Error( aError, S.Top().pClass, aName1 );
+ }
+
+ return( TRUE );
+}
+
+RSCINST GetFirstTupelEle( const RSCINST & rTop )
+{ // Aufwaertskompatible, Tupel probieren
+ RSCINST aInst;
+ ERRTYPE aErr;
+
+ aErr = rTop.pClass->GetElement( rTop, RscId(), NULL, RSCINST(), &aInst );
+ if( !aErr.IsError() )
+ aInst = aInst.pClass->GetTupelVar( aInst, 0, RSCINST() );
+ return aInst;
+}
+
+/************** Y a c c C o d e ****************************************/
+//#define YYDEBUG 1
+
+#define TYPE_HASHID 0
+#define TYPE_RESID 1
+
+#ifdef UNX
+#define YYMAXDEPTH 2000
+#else
+#ifdef W30
+#define YYMAXDEPTH 300
+#else
+#define YYMAXDEPTH 800
+#endif
+#endif
+
+#include "rscyacc.yxx"
+
diff --git a/rsc/source/prj/gui.cxx b/rsc/source/prj/gui.cxx
new file mode 100644
index 000000000000..235bebc54c0d
--- /dev/null
+++ b/rsc/source/prj/gui.cxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * $RCSfile: gui.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef MAC
+#include <cursorctl.h>
+#endif
+
+#ifndef _RSCRSC_HXX
+#include <rscrsc.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+
+/*************** G l o b a l e V a r i a b l e n **********************/
+static RscCompiler * pRscCompiler = NULL;
+/****************************************************************/
+/* */
+/* Function : ExitProgram() */
+/* */
+/* Description : Gibt die Temporaeren Dateien frei. */
+/****************************************************************/
+#if defined( UNX ) || ( defined( PM2 ) && ( defined( TCPP ) || defined ( GCC )) ) || defined( MAC ) || defined (WTC) || defined (MTW)
+ void ExitProgram( void ){
+#else
+#if defined( CSET )
+ void _Optlink ExitProgram( void ){
+#else
+ void cdecl ExitProgram( void ){
+#endif
+#endif
+ if( pRscCompiler )
+ delete pRscCompiler;
+}
+
+void PrimeNumber(){
+ USHORT i, n;
+ for( i = 801; i < 1000; i += 2 ){
+ for( n = 2; n < i && ((i % n) != 0); n++ );
+ if( n == i ){
+ printf( "\nPrimzahl: %d\n", i );
+ return;
+ }
+ }
+}
+
+
+#if defined( UNX ) || defined( MAC ) || ( defined( PM2 ) && ( defined( CSET ) || defined ( GCC ))) || defined (WTC) || defined(ICC)
+int main ( int argc, char ** argv) {
+#else
+#if defined( MTW )
+int main ( int argc, char const ** argv) {
+#else
+int cdecl main ( int argc, char ** argv) {
+#endif
+#endif
+#ifndef UNX
+#ifdef CSET
+ atexit( ExitProgram );
+#else
+ atexit( ExitProgram );
+#endif
+#endif
+#ifdef MAC
+ InitCursorCtl( 0 );
+#endif
+
+ ERRTYPE aError;
+
+ InitRscCompiler();
+ RscError* pErrHdl = new RscError();
+#ifdef MTW
+ RscCmdLine* pCmdLine = new RscCmdLine( argc, (char **)argv, pErrHdl );
+#else
+ RscCmdLine* pCmdLine = new RscCmdLine( argc, argv, pErrHdl );
+#endif
+ RscTypCont* pTypCont = new RscTypCont( pErrHdl,
+ pCmdLine->nLangTypeId,
+ pCmdLine->nByteOrder,
+ pCmdLine->nSourceCharSet,
+ pCmdLine->aPath,
+ pCmdLine->nCommands );
+
+ if( pErrHdl->nErrors )
+ aError = ERR_ERROR;
+ else{
+ RscCompiler* pCompiler = new RscCompiler( pCmdLine, pTypCont );
+
+ pRscCompiler = pCompiler;
+ aError = pCompiler->Start();
+ pRscCompiler = NULL;
+
+ delete pCompiler;
+ }
+
+ delete pTypCont;
+ delete pCmdLine;
+ delete pErrHdl;
+ delete pHS; // wird durch InitRscCompiler erzeugt
+
+ if( aError.IsOk() )
+ return( 0 );
+ else
+ return( 1 );
+}
+
+void RscExit( USHORT nExit )
+{
+ if( nExit )
+ printf( "Program exit is %d\n", nExit );
+ exit( nExit );
+}
diff --git a/rsc/source/prj/makefile.mk b/rsc/source/prj/makefile.mk
new file mode 100644
index 000000000000..dd1e69d70c11
--- /dev/null
+++ b/rsc/source/prj/makefile.mk
@@ -0,0 +1,161 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=rsc
+TARGETTYPE=CUI
+TARGET=rsc
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------------
+
+.IF "$(GUI)"!="WIN"
+CXXFILES= gui.cxx \
+ start.cxx
+
+OBJFILES= $(OBJ)$/gui.obj \
+ $(OBJ)$/start.obj
+
+.IF "$(GUI)$(COM)$(COMEX)" != "DOSSTCX"
+APP1TARGET= rsc
+APP1STDLIBS=$(TOOLSLIB) $(VOSLIB) $(SALLIB) # $(RTLLIB)
+APP1LIBS= $(LIBPRE) $(LB)$/rsctoo.lib
+APP1OBJS= $(OBJ)$/start.obj
+APP1STACK=64000
+.IF "$(GUI)" != "OS2"
+APP1STACK=32768
+.ENDIF
+.ENDIF
+
+.IF "$(GUI)$(COM)$(COMEX)" != "DOSSTC"
+APP2TARGET= rsc2
+.IF "$(GUI)" == "MAC"
+APP2STDLIBS=$(PRJ)$/..$/TOOLS$/$(INPATH)$/SLB$/tools.lib \
+ $(PRJ)$/..$/SAL$/$(INPATH)$/SLB$/cpposl.lib \
+ $(PRJ)$/..$/VOS$/$(INPATH)$/SLB$/cppvos.lib \
+ $(PRJ)$/..$/RTL$/$(INPATH)$/SLB$/cpprtl.lib \
+ $(MWPPCLibraries)PPCToolLibs.o \
+ $(STDSLOGUI)
+MACRES= $(SV_RES)MPWToolCfrg.r -d SVTOOLNAME="¶"SV TOOL¶""
+.ELSE
+.IF "$(OS)"=="SCO"
+# SCO hat Probleme mit fork/exec und einigen shared libraries.
+# rsc2 muss daher statisch gelinkt werden
+APP2STDLIBS=$(STATIC) -latools $(BPICONVLIB) $(VOSLIB) $(OSLLIB) $(RTLLIB) $(DYNAMIC)
+.ELSE
+APP2STDLIBS=$(TOOLSLIB) $(VOSLIB) $(SALLIB) #RTLLIB)
+.ENDIF
+.ENDIF
+APP2LIBS= $(LIBPRE) $(LB)$/rsctoo.lib \
+ $(LIBPRE) $(LB)$/rscres.lib \
+ $(LIBPRE) $(LB)$/rscpar.lib \
+ $(LIBPRE) $(LB)$/rscrsc.lib \
+ $(LIBPRE) $(LB)$/rscmis.lib
+APP2OBJS= $(OBJ)$/gui.obj
+APP2STACK=64000
+.IF "$(GUI)" != "OS2"
+APP2STACK=32768
+.ENDIF
+.ENDIF
+.ENDIF
+
+# --- Targets ------------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# -------------------------------------------------------------------
+# PM2
+# -------------------------------------------------------------------
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(APP1TARGET).def : makefile
+ echo NAME RSC WINDOWCOMPAT >$@
+ echo DESCRIPTION 'RSC-Compiler' >>$@
+.IF "$(COM)" != "BLC"
+ echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ echo DATA MULTIPLE >>$@
+ echo EXETYPE OS2 >>$@
+ echo PROTMODE >>$@
+ echo HEAPSIZE 16000 >>$@
+ echo STACKSIZE 48000 >>$@
+
+$(MISC)$/$(APP2TARGET).def : makefile
+ echo NAME RSC2 WINDOWCOMPAT >$@
+ echo DESCRIPTION 'RSC2-Compiler' >>$@
+.IF "$(COM)" != "BLC"
+ echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ echo DATA MULTIPLE >>$@
+ echo EXETYPE OS2 >>$@
+ echo PROTMODE >>$@
+ echo HEAPSIZE 16000 >>$@
+ echo STACKSIZE 48000 >>$@
+.ENDIF
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
new file mode 100644
index 000000000000..fda87c6a407a
--- /dev/null
+++ b/rsc/source/prj/start.cxx
@@ -0,0 +1,495 @@
+/*************************************************************************
+ *
+ * $RCSfile: start.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+#if defined (WNT) && defined (tcpp)
+#define _spawnvp spawnvp
+#define _P_WAIT P_WAIT
+#endif
+#ifdef UNX
+#include <unistd.h>
+#include <sys/wait.h>
+#else
+#ifndef MAC
+#include <io.h>
+#include <process.h>
+#if defined ( OS2 ) && !defined ( GCC )
+#include <direct.h>
+#endif
+#ifndef CSET
+#include <dos.h>
+#endif
+#endif
+#endif
+
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+#include <tools/fsys.hxx>
+
+/*************** C O D E ************************************************/
+/****************************************************************/
+/* */
+/* Function : fuer Ansi kompatibilitaet */
+/* */
+/****************************************************************/
+#ifdef UNX
+#define P_WAIT 0
+ int spawnvp( int, const char * cmdname, char *const* argv ){
+ int rc;
+ /*
+ union wait rc;
+ rc.w_status = 0;
+ */
+
+ switch( fork() ){
+ case -1:
+ return( -1 );
+ case 0:
+ if( execvp( cmdname, argv ) == -1 )
+ // an error occurs
+ return( -1 );
+ break;
+ default:
+ if( -1 == wait( &rc ) )
+ return( -1 );
+ }
+ return( WEXITSTATUS( rc ) );
+ }
+#endif
+
+/*************************************************************************
+|* CallPrePro()
+|*
+|* Beschreibung
+*************************************************************************/
+static BOOL CallPrePro( const ByteString& rPrePro,
+ const ByteString& rInput,
+ const ByteString& rOutput,
+ RscPtrPtr * pCmdLine,
+ BOOL bResponse )
+{
+ RscPtrPtr aNewCmdL; // Kommandozeile
+ RscPtrPtr aRespCmdL; // Kommandozeile
+ RscPtrPtr * pCmdL = &aNewCmdL;
+ short i, nExit;
+ FILE* fRspFile = NULL;
+ ByteString aRspFileName;
+
+ if( bResponse )
+ {
+ aRspFileName = ::GetTmpFileName();
+ fRspFile = fopen( aRspFileName.GetBuffer(), "w" );
+ }
+
+ if( !fRspFile )
+ aNewCmdL.Append( RscMem::Assignsw( rPrePro.GetBuffer(), 0 ) );
+ for( i = 1; i < (short)(pCmdLine->GetCount() -1); i++ ){
+ if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-u", 2 )
+ || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-i", 2 )
+ || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-d", 2 ) )
+ {
+ aNewCmdL.Append(
+ RscMem::Assignsw( (char *)pCmdLine->GetEntry( i ), 0 ) );
+ }
+ };
+ aNewCmdL.Append( RscMem::Assignsw( rInput.GetBuffer(), 0 ) );
+ aNewCmdL.Append( RscMem::Assignsw( rOutput.GetBuffer(), 0 ) );
+ aNewCmdL.Append( (void *)0 );
+
+ printf( "Preprocessor commandline: " );
+ for( i = 0; i < (short)(pCmdL->GetCount() -1); i++ )
+ {
+ printf( " " );
+ printf( "%s", (const char *)pCmdL->GetEntry( i ) );
+ }
+ printf( "\n" );
+
+ if( fRspFile )
+ {
+ aRespCmdL.Append( RscMem::Assignsw( rPrePro.GetBuffer(), 0 ) );
+ ByteString aTmpStr( '@' );
+ aTmpStr += aRspFileName;
+ aRespCmdL.Append( RscMem::Assignsw( aTmpStr.GetBuffer(), 0 ) );
+ aRespCmdL.Append( (void *)0 );
+
+ pCmdL = &aRespCmdL;
+ for( i = 0; i < (short)(aNewCmdL.GetCount() -1); i++ )
+ {
+ fprintf( fRspFile, "%s ", (const char *)aNewCmdL.GetEntry( i ) );
+ }
+ fclose( fRspFile );
+
+ printf( "Preprocessor startline: " );
+ for( i = 0; i < (short)(pCmdL->GetCount() -1); i++ )
+ {
+ printf( " " );
+ printf( "%s", (const char *)pCmdL->GetEntry( i ) );
+ }
+ printf( "\n" );
+ }
+
+#if ((defined PM2 || defined WNT) && (defined TCPP || defined tcpp)) || defined UNX
+ nExit = spawnvp( P_WAIT, rPrePro.GetBuffer(), (char* const*)pCmdL->GetBlock() );
+#elif defined CSET
+ nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), char **) (const char**)pCmdL->GetBlock() );
+#elif defined WTC
+ nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char* const*)pCmdL->GetBlock() );
+#elif defined MTW
+ nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (char**)pCmdL->GetBlock() );
+#else
+ nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char**)pCmdL->GetBlock() );
+#endif
+
+ if ( fRspFile )
+ unlink( aRspFileName.GetBuffer() );
+ if ( nExit )
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*************************************************************************
+|* CallRsc2
+|*
+|* Beschreibung
+*************************************************************************/
+static BOOL CallRsc2( ByteString aRsc2Name,
+ RscStrList * pInputList,
+ ByteString aSrsName,
+ ByteString aRcName,
+ RscPtrPtr * pCmdLine )
+{
+ RscPtrPtr aNewCmdL; // Kommandozeile
+ short i, nExit;
+ ByteString* pString;
+ ByteString aRspFileName; // Response-Datei
+ FILE * fRspFile; // Response-Datei
+
+ aRspFileName = ::GetTmpFileName();
+ fRspFile = fopen( aRspFileName.GetBuffer(), "w" );
+
+ printf( "Rsc2 commandline: " );
+ aNewCmdL.Append( RscMem::Assignsw( aRsc2Name.GetBuffer(), 0 ) );
+ printf( "%s", (const char *)aNewCmdL.GetEntry( aNewCmdL.GetCount() -1 ) );
+ printf( " " );
+ ByteString aTmpStr( '@' );
+ aTmpStr += aRspFileName;
+ aNewCmdL.Append( RscMem::Assignsw( aTmpStr.GetBuffer(), 0 ) );
+ printf( "%s", (const char *)aNewCmdL.GetEntry( aNewCmdL.GetCount() -1 ) );
+ aNewCmdL.Append( (void *)0 );
+ printf( "\n" );
+
+ if( fRspFile )
+ {
+ for( i = 1; i < (short)(pCmdLine->GetCount() -1); i++ )
+ {
+ if( !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fp", 3 )
+ || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fo", 3 )
+ || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-fs", 3 )
+ || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-pp", 3 )
+ || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-presponse", 9 )
+ || !rsc_strnicmp( (char *)pCmdLine->GetEntry( i ), "-rc", 3 )
+ || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-+" )
+ || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-br" )
+ || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-bz" )
+ || !rsc_stricmp( (char *)pCmdLine->GetEntry( i ), "-r" )
+ || ( '-' != *(char *)pCmdLine->GetEntry( i ) ) )
+ {
+ }
+ else
+ fprintf( fRspFile, "%s ",
+ (const char *)pCmdLine->GetEntry( i ) );
+ };
+
+ fprintf( fRspFile, "%s -fs%s",
+ aSrsName.GetBuffer(), aRcName.GetBuffer() );
+
+ pString = pInputList->First();
+ while( pString )
+ {
+ fprintf( fRspFile, " %s", pString->GetBuffer() );
+ pString = pInputList->Next();
+ };
+
+ fclose( fRspFile );
+ };
+
+#if ((defined PM2 || defined WNT) && (defined TCPP || defined tcpp)) || defined UNX
+ nExit = spawnvp( P_WAIT, aRsc2Name.GetBuffer(), (char* const*)aNewCmdL.GetBlock() );
+#elif defined CSET
+ nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (char **)(const char**)aNewCmdL.GetBlock() );
+#elif defined WTC
+ nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (const char* const*)aNewCmdL.GetBlock() );
+#elif defined MTW
+ nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (char**)aNewCmdL.GetBlock() );
+#else
+ nExit = spawnvp( P_WAIT, (char*)aRsc2Name.GetBuffer(), (const char**)aNewCmdL.GetBlock() );
+#endif
+
+ if( fRspFile )
+ unlink( aRspFileName.GetBuffer() );
+ if( nExit )
+ return( FALSE );
+ return( TRUE );
+}
+
+/*************************************************************************
+|* CallRes
+|*
+|* Beschreibung
+*************************************************************************/
+static BOOL CallRes( ByteString aRcName, ByteString aResName )
+{
+ short nExit;
+
+ unlink( aResName.GetBuffer() ); // Zieldatei loeschen
+ printf( "Copy %s to %s\n", aRcName.GetBuffer(), aResName.GetBuffer() );
+ if( !Append( aResName, aRcName ) )
+ {
+ printf( "Cannot open file <%s or %s>\n",
+ aResName.GetBuffer(), aRcName.GetBuffer() );
+ nExit = 1;
+ }
+ else
+ nExit = 0;
+ return( nExit == 0 );
+}
+
+/*************************************************************************
+|*
+|* main()
+|*
+|* Beschreibung
+|* Ersterstellung MM 05.09.91
+|* Letzte Aenderung MM 05.09.91
+|*
+*************************************************************************/
+#if defined UNX || (defined PM2 && (defined CSET || defined GCC )) || defined WTC || defined MTW || defined ICC
+int main ( int argc, char ** argv)
+{
+#else
+int cdecl main ( int argc, char ** argv)
+{
+#endif
+
+ BOOL bPrePro = TRUE;
+ BOOL bResFile = TRUE;
+ BOOL bHelp = FALSE;
+ BOOL bError = FALSE;
+ BOOL bResponse = FALSE;
+ ByteString aPrePro( "rscpp" );
+ ByteString aRsc2Name( "rsc2" );
+ ByteString aSrsName;
+ ByteString aRcName;
+ ByteString aResName;
+ RscStrList aInputList;
+ RscStrList aTmpList;
+ char * pStr;
+ char ** ppStr;
+ RscPtrPtr aCmdLine; // Kommandozeile
+ USHORT i;
+ ByteString* pString;
+
+ printf( "VCL Resource Compiler 3.0\n" );
+
+ pStr = ::ResponseFile( &aCmdLine, argv, argc );
+ if( pStr )
+ {
+ printf( "Cannot open response file <%s>\n", pStr );
+ return( 1 );
+ };
+
+ ppStr = (char **)aCmdLine.GetBlock();
+ ppStr++;
+ i = 1;
+ BOOL bSetSrs = FALSE;
+ while( ppStr && i < (USHORT)(aCmdLine.GetCount() -1) )
+ {
+ if( '-' == **ppStr )
+ {
+ if( !rsc_stricmp( (*ppStr) + 1, "p" )
+ || !rsc_stricmp( (*ppStr) + 1, "l" ) )
+ { // kein Preprozessor
+ bPrePro = FALSE;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "r" )
+ || !rsc_stricmp( (*ppStr) + 1, "s" ) )
+ { // erzeugt kein .res-file
+ bResFile = FALSE;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "h" ) )
+ { // Hilfe anzeigen
+ bHelp = TRUE;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "presponse", 9 ) )
+ { // anderer Name fuer den Preprozessor
+ bResponse = TRUE;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "pp", 2 ) )
+ { // anderer Name fuer den Preprozessor
+ aPrePro = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fo", 2 ) )
+ { // anderer Name fuer .res-file
+ aResName = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fs", 2 ) )
+ { // anderer Name fuer .rc-file
+ aRcName = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fp", 2 ) )
+ { // anderer Name fuer .srs-file
+ bSetSrs = TRUE;
+ aSrsName = (*ppStr);
+ }
+ }
+ else
+ {
+ // Eingabedatei
+ aInputList.Insert( new ByteString( *ppStr ), CONTAINER_APPEND );
+ }
+ ppStr++;
+ i++;
+ }
+
+ if( aInputList.Count() )
+ {
+ /* build the output file names */
+ if( ! aResName.Len() )
+ aResName = OutputFile( *aInputList.First(), "res" );
+ if( ! aRcName.Len() )
+ aRcName = OutputFile( *aInputList.First(), "rc" );
+ if( ! bSetSrs )
+ {
+ aSrsName = "-fp";
+ aSrsName += OutputFile( *aInputList.First(), "srs" );
+ }
+ };
+
+ if( bHelp )
+ {
+ bPrePro = FALSE;
+ bResFile = FALSE;
+ };
+ if( bPrePro && aInputList.Count() )
+ {
+ ByteString aTmpName;
+
+ pString = aInputList.First();
+ while( pString )
+ {
+ aTmpName = ::GetTmpFileName();
+ if( !CallPrePro( aPrePro, *pString, aTmpName, &aCmdLine, bResponse ) )
+ {
+ printf( "Error starting preprocessor\n" );
+ bError = TRUE;
+ break;
+ }
+ aTmpList.Insert( new ByteString( aTmpName ), CONTAINER_APPEND );
+ pString = aInputList.Next();
+ };
+ };
+
+ if( !bError )
+ {
+ if( !CallRsc2( aRsc2Name, bPrePro ? &aTmpList : &aInputList,
+ aSrsName, aRcName, &aCmdLine ) )
+ {
+ if( !bHelp )
+ {
+ printf( "Error starting rsc2 compiler\n" );
+ bError = TRUE;
+ }
+ };
+ };
+
+ pString = aTmpList.First();
+ while( pString )
+ {
+ unlink( pString->GetBuffer() );
+ pString = aTmpList.Next();
+ };
+
+ if( !bError && bResFile )
+ {
+ if( !CallRes( aRcName, aResName ) )
+ {
+ printf( "Error in system resource compiler\n" );
+ bError = TRUE;
+ }
+ else
+ unlink( aRcName.GetBuffer() );
+ };
+
+ return( bError );
+}
+
+void RscExit( USHORT nExit )
+{
+ if( nExit )
+ printf( "Program exit is %d\n", nExit );
+ exit( nExit );
+}
diff --git a/rsc/source/res/makefile.mk b/rsc/source/res/makefile.mk
new file mode 100644
index 000000000000..68f6d5096b63
--- /dev/null
+++ b/rsc/source/res/makefile.mk
@@ -0,0 +1,98 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=RSC
+TARGET=rscres
+
+# --- Settings ------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+OBJFILES= $(OBJ)$/rscclobj.obj \
+ $(OBJ)$/rsccont.obj \
+ $(OBJ)$/rsctop.obj \
+ $(OBJ)$/rscrange.obj \
+ $(OBJ)$/rscconst.obj \
+ $(OBJ)$/rscflag.obj \
+ $(OBJ)$/rscstr.obj \
+ $(OBJ)$/rscall.obj \
+ $(OBJ)$/rscmgr.obj \
+ $(OBJ)$/rscclass.obj \
+ $(OBJ)$/rscarray.obj
+
+CXXFILES= rscclobj.cxx \
+ rsctop.cxx \
+ rscrange.cxx \
+ rscconst.cxx \
+ rscflag.cxx \
+ rscstr.cxx \
+ rscall.cxx \
+ rsccont.cxx \
+ rscclass.cxx \
+ rscmgr.cxx \
+ rscarray.cxx
+
+.INCLUDE : target.mk
diff --git a/rsc/source/res/rscall.cxx b/rsc/source/res/rscall.cxx
new file mode 100644
index 000000000000..978514c8d4e4
--- /dev/null
+++ b/rsc/source/res/rscall.cxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscall.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscall.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.12 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.11 2000/07/26 17:13:22 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.10 2000/07/12 11:37:45 th
+ Unicode
+
+ Revision 1.9 1997/08/27 18:17:36 MM
+ neue Headerstruktur
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+
+// Programmabhaengige Includes.
+#ifndef _RSCALL_H
+#include <rscall.h>
+#endif
+#ifndef _RSCKEY_HXX
+#include <rsckey.hxx>
+#endif
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+
+USHORT nRsc_XYMAPMODEId;
+USHORT nRsc_WHMAPMODEId;
+USHORT nRsc_X;
+USHORT nRsc_Y;
+USHORT nRsc_WIDTH;
+USHORT nRsc_HEIGHT;
+USHORT nRsc_DELTALANG;
+USHORT nRsc_DELTASYSTEM;
+USHORT nRsc_EXTRADATA;
+
+void InitRscCompiler()
+{
+ pHS = new HashString( 3271 );
+
+ pStdParType = new ByteString( "( const ResId & rResId, BOOL" );
+ pStdPar1 = new ByteString( '(' );
+ pStdPar2 = new ByteString( '(' );
+
+ pWinParType = new ByteString( "( Window * pParent, const ResId & rResId, BOOL" );
+ pWinPar1 = new ByteString( "( pParent," );
+ pWinPar2 = new ByteString( "( this," );
+ nRefDeep = 10;
+ nRsc_XYMAPMODEId = HASH_NONAME;
+ nRsc_WHMAPMODEId = HASH_NONAME;
+};
+
diff --git a/rsc/source/res/rscarray.cxx b/rsc/source/res/rscarray.cxx
new file mode 100644
index 000000000000..64bf18bc38d5
--- /dev/null
+++ b/rsc/source/res/rscarray.cxx
@@ -0,0 +1,766 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscarray.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscarray.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Programmabhaengige Includes.
+#ifndef _RSCCONST_HXX
+#include <rscconst.hxx>
+#endif
+#ifndef _RSCSARRAY_HXX
+#include <rscarray.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+
+/****************** C O D E **********************************************/
+/****************** R s c I n s t N o d e ********************************/
+/*************************************************************************
+|*
+|* RscInstNode::RscInstNode()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.08.91
+|* Letzte Aenderung MM 06.08.91
+|*
+*************************************************************************/
+RscInstNode::RscInstNode( USHORT nId )
+{
+ nTypeId = nId;
+}
+
+/*************************************************************************
+|*
+|* RscInstNode::~RscInstNode()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.08.91
+|* Letzte Aenderung MM 06.08.91
+|*
+*************************************************************************/
+RscInstNode::~RscInstNode()
+{
+ if( aInst.IsInst() )
+ {
+ aInst.pClass->Destroy( aInst );
+ RscMem::Free( aInst.pData );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscInstNode::GetId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.08.91
+|* Letzte Aenderung MM 06.08.91
+|*
+*************************************************************************/
+USHORT RscInstNode::GetId() const
+{
+ return nTypeId;
+}
+
+/****************** R s c A r r a y *************************************/
+/*************************************************************************
+|*
+|* RscArray::RscArray()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscArray::RscArray( HASHID nId, USHORT nTypeId, RscTop * pSuper,
+ RscEnum * pTypeCl,
+ USHORT * pTypeValue, USHORT * pFallBackType )
+ : RscTop( nId, nTypeId, pSuper )
+{
+ pTypeClass = pTypeCl;
+ nOffInstData = RscTop::Size();
+ nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscArrayInst ) );
+ pWriteTypeValue = pTypeValue;
+ pWriteDfltTypeValue = pFallBackType;
+}
+
+/*************************************************************************
+|*
+|* RscArray::~RscArray()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscArray::~RscArray()
+{
+}
+
+/*************************************************************************
+|*
+|* RscArray::~RscArray()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscArray::GetClassType() const
+{
+ return RSCCLASS_ENUMARRAY;
+}
+
+/*************************************************************************
+|*
+|* RscArray::GetIndexType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.12.92
+|* Letzte Aenderung MM
+|*
+*************************************************************************/
+RscTop * RscArray::GetTypeClass() const
+{
+ return pTypeClass;
+}
+
+/*************************************************************************
+|*
+|* RscArray::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+static RscInstNode * Create( RscInstNode * pNode )
+{
+ RscInstNode * pRetNode = NULL;
+ RscInstNode * pTmpNode;
+
+ if( pNode )
+ {
+ pRetNode = new RscInstNode( pNode->GetId() );
+ pRetNode->aInst = pNode->aInst.pClass->Create( NULL, pNode->aInst );
+ if( (pTmpNode = Create( pNode->Left() )) != NULL )
+ pRetNode->Insert( pTmpNode );
+ if( (pTmpNode = Create( pNode->Right() )) != NULL )
+ pRetNode->Insert( pTmpNode );
+ }
+
+ return pRetNode;
+}
+
+RSCINST RscArray::Create( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass )
+{
+ RSCINST aInst;
+ RscArrayInst * pClassData;
+
+ if( !pInst )
+ {
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ RscTop::Create( &aInst, rDflt, bOwnClass );
+
+ pClassData = (RscArrayInst *)(aInst.pData + nOffInstData);
+ pClassData->pNode = NULL;
+ if( bOwnClass )
+ {
+ RscArrayInst * pDfltClassData;
+
+ pDfltClassData = (RscArrayInst *)(rDflt.pData + nOffInstData);
+
+ pClassData->pNode = ::Create( pDfltClassData->pNode );
+ }
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscArray::Destroy()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+static void Destroy( RscInstNode * pNode )
+{
+ if( pNode )
+ {
+ Destroy( pNode->Left() );
+ Destroy( pNode->Right() );
+ delete pNode;
+ }
+}
+
+void RscArray::Destroy( const RSCINST & rInst )
+{
+ RscArrayInst * pClassData;
+
+ RscTop::Destroy( rInst );
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ //Baum rekursiv loeschen
+ ::Destroy( pClassData->pNode );
+}
+
+/*************************************************************************
+|*
+|* RscArray::GetValueEle()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ERRTYPE RscArray::GetValueEle
+(
+ const RSCINST & rInst,
+ long lValue,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst
+)
+{
+ RscArrayInst * pClassData;
+ RscInstNode * pNode;
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ ERRTYPE aError;
+
+ HASHID nId;
+ if( (lValue < 0) || (lValue > 0xFFFF)
+ || !pTypeClass->GetValueConst( (USHORT)lValue, &nId ) )
+ { // nicht gefunden
+ return ERR_ARRAY_INVALIDINDEX;
+ }
+
+ if( pClassData->pNode )
+ pNode = pClassData->pNode->Search( (USHORT)lValue );
+ else
+ pNode = NULL;
+
+/*
+ if( pNode )
+ {
+ if( pNode->aInst.pClass->IsDefault( pNode->aInst ) )
+ {
+ GetSuperClass()->Destroy( pNode->aInst );
+ GetSuperClass()->Create( &pNode->aInst, rInst );
+ pNode->aInst.pClass->SetToDefault( pNode->aInst );
+ }
+ }
+ else
+*/
+ if( !pNode )
+ {
+ pNode = new RscInstNode( (USHORT)lValue );
+ if( pCreateClass && GetSuperClass()->InHierarchy( pCreateClass ) )
+ pNode->aInst = pCreateClass->Create( NULL, rInst );
+ else
+ pNode->aInst = GetSuperClass()->Create( NULL, rInst );
+ pNode->aInst.pClass->SetToDefault( pNode->aInst );
+ if( pClassData->pNode )
+ pClassData->pNode->Insert( pNode );
+ else
+ pClassData->pNode = pNode;
+ }
+
+ *pGetInst = pNode->aInst;
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscArray::GetArrayEle()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ERRTYPE RscArray::GetArrayEle
+(
+ const RSCINST & rInst,
+ HASHID nId,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst
+)
+{
+ INT32 lValue;
+ if( !pTypeClass->GetConstValue( nId, &lValue ) )
+ { // nicht gefunden
+ return ERR_ARRAY_INVALIDINDEX;
+ }
+
+ return GetValueEle( rInst, lValue, pCreateClass, pGetInst );
+}
+
+/*************************************************************************
+|*
+|* RscArray::IsConsistent()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.09.91
+|* Letzte Aenderung MM 23.09.91
+|*
+*************************************************************************/
+static BOOL IsConsistent( RscInstNode * pNode, RscInconsList * pList )
+{
+ BOOL bRet = TRUE;
+
+ if( pNode )
+ {
+ bRet = pNode->aInst.pClass->IsConsistent( pNode->aInst, pList );
+ if( !IsConsistent( pNode->Left(), pList ) )
+ bRet = FALSE;
+ if( !IsConsistent( pNode->Right(), pList ) )
+ bRet = FALSE;
+ }
+ return bRet;
+}
+
+BOOL RscArray::IsConsistent( const RSCINST & rInst, RscInconsList * pList )
+{
+ RscArrayInst * pClassData;
+ BOOL bRet;
+
+ bRet = RscTop::IsConsistent( rInst, pList );
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+ if( !::IsConsistent( pClassData->pNode, pList ) )
+ bRet = FALSE;
+
+ return( bRet );
+}
+
+/*************************************************************************
+|*
+|* RscArray::SetToDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+static void SetToDefault( RscInstNode * pNode )
+{
+ if( pNode )
+ {
+ pNode->aInst.pClass->SetToDefault( pNode->aInst );
+ SetToDefault( pNode->Left() );
+ SetToDefault( pNode->Right() );
+ }
+}
+
+void RscArray::SetToDefault( const RSCINST & rInst )
+{
+ RscArrayInst * pClassData;
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ ::SetToDefault( pClassData->pNode );
+
+ RscTop::SetToDefault( rInst );
+}
+
+/*************************************************************************
+|*
+|* RscArray::IsDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+static BOOL IsDefault( RscInstNode * pNode )
+{
+ BOOL bRet = TRUE;
+
+ if( pNode )
+ {
+ bRet = pNode->aInst.pClass->IsDefault( pNode->aInst );
+ if( bRet )
+ bRet = IsDefault( pNode->Left() );
+ if( bRet )
+ bRet = IsDefault( pNode->Right() );
+ }
+ return bRet;
+}
+
+BOOL RscArray::IsDefault( const RSCINST & rInst )
+{
+ RscArrayInst * pClassData;
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ BOOL bRet = ::IsDefault( pClassData->pNode );
+
+ if( bRet )
+ bRet = RscTop::IsDefault( rInst );
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* RscArray::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 15.01.92
+|*
+*************************************************************************/
+static BOOL IsValueDefault( RscInstNode * pNode, CLASS_DATA pDef )
+{
+ BOOL bRet = TRUE;
+
+ if( pNode )
+ {
+ bRet = pNode->aInst.pClass->IsValueDefault( pNode->aInst, pDef );
+ if( bRet )
+ bRet = IsValueDefault( pNode->Left(), pDef );
+ if( bRet )
+ bRet = IsValueDefault( pNode->Right(), pDef );
+ }
+ return bRet;
+}
+
+BOOL RscArray::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
+{
+ RscArrayInst * pClassData;
+ BOOL bRet;
+
+ bRet = RscTop::IsValueDefault( rInst, pDef );
+
+ if( bRet )
+ {
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ bRet = ::IsValueDefault( pClassData->pNode, pDef );
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|* RscArray::WriteSrcHeader()
+|*
+|* Beschreibung
+*************************************************************************/
+void RscArray::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & aId, const char * pVarName )
+{
+ RscArrayInst * pClassData;
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ if( pTC->IsSrsDefault() )
+ { // nur einen Wert schreiben
+ RscInstNode * pNode = NULL;
+ if( pClassData->pNode )
+ {
+ pNode = pClassData->pNode->Search( *pWriteTypeValue );
+ if( !pNode && *pWriteTypeValue != *pWriteDfltTypeValue )
+ pNode = pClassData->pNode->Search( *pWriteDfltTypeValue );
+ }
+
+ if( pNode )
+ {
+ if( pNode->aInst.pClass->IsDefault( pNode->aInst ) )
+ fprintf( fOutput, "Default" );
+ else
+ pNode->aInst.pClass->WriteSrcHeader(
+ pNode->aInst, fOutput,
+ pTC, nTab, aId, pVarName );
+ return;
+ }
+ }
+
+ if( IsDefault( rInst ) )
+ fprintf( fOutput, "Default" );
+ else
+ {
+ RSCINST aSuper( GetSuperClass(), rInst.pData );
+ aSuper.pClass->WriteSrcHeader( aSuper, fOutput, pTC,
+ nTab, aId, pVarName );
+ }
+ if( !pTC->IsSrsDefault() )
+ WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+}
+
+/*************************************************************************
+|* RscArray::WriteSrc()
+|*
+|* Beschreibung
+*************************************************************************/
+static void WriteSrc( RscInstNode * pNode, FILE * fOutput, RscTypCont * pTC,
+ USHORT nTab, const char * pVarName,
+ CLASS_DATA pDfltData, RscConst * pTypeClass )
+{
+ if( pNode )
+ {
+ WriteSrc( pNode->Left(), fOutput, pTC, nTab, pVarName,
+ pDfltData, pTypeClass );
+ if( !pNode->aInst.pClass->IsValueDefault( pNode->aInst, pDfltData ) )
+ {
+ fprintf( fOutput, ";\n" );
+ for( USHORT n = 0; n < nTab; n++ )
+ fputc( '\t', fOutput );
+
+ HASHID nIdxId;
+ pTypeClass->GetValueConst( pNode->GetId(), &nIdxId );
+ fprintf( fOutput, "%s[ %s ] = ", pVarName, pHS->Get( nIdxId ) );
+ pNode->aInst.pClass->WriteSrcHeader( pNode->aInst, fOutput, pTC,
+ nTab, RscId(), pVarName );
+ }
+ WriteSrc( pNode->Right(), fOutput, pTC, nTab, pVarName,
+ pDfltData, pTypeClass );
+ }
+}
+
+void RscArray::WriteSrcArray( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const char * pVarName )
+{
+ RscArrayInst * pClassData;
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ ::WriteSrc( pClassData->pNode, fOutput, pTC, nTab, pVarName,
+ rInst.pData, pTypeClass );
+};
+
+void RscArray::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const char * pVarName )
+{
+ WriteSrcArray( rInst, fOutput, pTC, nTab, pVarName );
+}
+
+/*************************************************************************
+|* RscArray::WriteRc()
+|*
+|* Beschreibung
+*************************************************************************/
+ERRTYPE RscArray::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ ERRTYPE aError;
+ RscArrayInst * pClassData;
+ RscInstNode * pNode = NULL;
+
+ pClassData = (RscArrayInst *)(rInst.pData + nOffInstData);
+
+ if( pClassData->pNode )
+ {
+ pNode = pClassData->pNode->Search( *pWriteTypeValue );
+ if( !pNode && *pWriteTypeValue != *pWriteDfltTypeValue )
+ pNode = pClassData->pNode->Search( *pWriteDfltTypeValue );
+ }
+
+ if( pNode )
+ aError = pNode->aInst.pClass->WriteRc( pNode->aInst, rMem, pTC,
+ nDeep, bExtra );
+ else
+ aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+
+ return aError;
+}
+
+//========================================================================
+void RscArray::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ GetSuperClass()->WriteRcAccess( fOutput, pTC, pName );
+}
+
+/*************************************************************************
+|*
+|* RscClassArray::RscClassArray()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscClassArray::RscClassArray( HASHID nId, USHORT nTypeId, RscTop * pSuper,
+ RscEnum * pTypeCl,
+ USHORT * pTypeValue, USHORT * pFallBackType )
+ : RscArray( nId, nTypeId, pSuper, pTypeCl, pTypeValue, pFallBackType )
+{
+}
+
+/*************************************************************************
+|*
+|* RscClassArray::~RscClassArray()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscClassArray::~RscClassArray()
+{
+}
+
+/*************************************************************************
+|*
+|* RscClassArray::WriteSrcHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+void RscClassArray::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & aId, const char * pName )
+{
+ RscArray::WriteSrcHeader( rInst, fOutput, pTC, nTab, aId, pName );
+}
+
+/*************************************************************************
+|*
+|* RscClassArray::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+void RscClassArray::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const char * pVarName )
+{
+ RscArray::WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+}
+
+/*************************************************************************
+|*
+|* RscClassArray::WriteRcHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+ERRTYPE RscClassArray::WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont * pTC, const RscId & aId,
+ USHORT nDeep, BOOL bExtra )
+{
+ // Eigenen Typ schreiben
+ return GetSuperClass()->WriteRcHeader( rInst, aMem, pTC, aId,
+ nDeep, bExtra );
+}
+
+/*************************************************************************
+|*
+|* RscLangArray::RscLangArray()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscLangArray::RscLangArray( HASHID nId, USHORT nTypeId, RscTop * pSuper,
+ RscEnum * pTypeCl,
+ USHORT * pTypeValue, USHORT * pFallBackType )
+ : RscArray( nId, nTypeId, pSuper, pTypeCl, pTypeValue, pFallBackType )
+{
+}
+
+/*************************************************************************
+|*
+|* RscLangArray::RscLangArray()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscLangArray::GetClassType() const
+{
+ if( GetSuperClass() )
+ return GetSuperClass()->GetClassType();
+ else
+ return RscArray::GetClassType();
+
+}
+
diff --git a/rsc/source/res/rscclass.cxx b/rsc/source/res/rscclass.cxx
new file mode 100644
index 000000000000..30de42d9a174
--- /dev/null
+++ b/rsc/source/res/rscclass.cxx
@@ -0,0 +1,1324 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscclass.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscclass.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.39 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.38 2000/07/26 17:13:22 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.37 2000/07/12 11:38:05 th
+ Unicode
+
+ Revision 1.36 1999/11/24 17:54:35 th
+ remove dependencies to vcl
+
+ Revision 1.35 1999/09/08 09:24:59 mm
+ BigEndian/LittleEndian komplett durchgezogen
+
+ Revision 1.34 1999/09/07 13:30:05 mm
+ UniCode
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Programmabhaengige Includes.
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCCLASS_HXX
+#include <rscclass.hxx>
+#endif
+
+#include <tools/fsys.hxx>
+#include <tools/rcid.h>
+#include <tools/rc.h>
+
+/****************** C O D E **********************************************/
+/****************** R s c C l a s s **************************************/
+/*************************************************************************
+|*
+|* RscClass::RscClass()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscClass::RscClass( HASHID nId, USHORT nTypeId, RscTop * pSuperCl )
+ : RscTop( nId, nTypeId, pSuperCl )
+{
+ nEntries = 0;
+ pVarTypeList = NULL;
+ nSuperSize = RscTop::Size();
+ nSize = nSuperSize + ALIGNED_SIZE( sizeof( RscClassInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscClass::Pre_dtor()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+void RscClass::Pre_dtor()
+{
+ USHORT i;
+
+ RscTop::Pre_dtor();
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ if( pVarTypeList[ i ].pDefault )
+ {
+ pVarTypeList[ i ].pClass->Destroy(
+ RSCINST( pVarTypeList[ i ].pClass,
+ pVarTypeList[ i ].pDefault ) );
+ RscMem::Free( pVarTypeList[ i ].pDefault );
+ pVarTypeList[ i ].pDefault = NULL;
+ };
+ };
+}
+
+/*************************************************************************
+|*
+|* RscClass::~RscClass()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscClass::~RscClass()
+{
+ if( pVarTypeList )
+ RscMem::Free( (void *)pVarTypeList );
+}
+
+/*************************************************************************
+|*
+|* RscClass::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscClass::GetClassType() const
+{
+ return RSCCLASS_COMPLEX;
+}
+
+/*************************************************************************
+|*
+|* RscClass::GetInstData()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+RSCINST RscClass::GetInstData
+(
+ CLASS_DATA pData,
+ USHORT nEle,
+ BOOL bGetCopy
+)
+{
+ RSCINST aInst;
+
+ aInst.pClass = pVarTypeList[ nEle ].pClass;
+ if( pData )
+ {
+ if( VAR_NODATAINST & pVarTypeList[ nEle ].nVarType )
+ {
+ RSCINST aTmpI;
+
+ aTmpI.pClass = this;
+ aTmpI.pData = pData;
+ if( bGetCopy )
+ aInst.pData = GetCopyVar(
+ aTmpI,
+ pVarTypeList[ nEle ].nDataBaseName
+ ).pData;
+ else
+ aInst.pData = GetVariable(
+ aTmpI,
+ pVarTypeList[ nEle ].nDataBaseName,
+ RSCINST()
+ ).pData;
+ }
+ else if( VAR_POINTER & pVarTypeList[ nEle ].nVarType )
+ {
+ if( VAR_EXTENDABLE & pVarTypeList[ nEle ].nVarType )
+ aInst = *(RSCINST *)
+ (pData + pVarTypeList[ nEle ].nOffset);
+ else
+ aInst.pData = *(CLASS_DATA *)
+ (pData + pVarTypeList[ nEle ].nOffset);
+ }
+ else
+ aInst.pData = pData + pVarTypeList[ nEle ].nOffset;
+ };
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscClass::GetInstDflt()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+CLASS_DATA RscClass::GetDfltData( USHORT nEle )
+{
+ if( pVarTypeList[ nEle ].pDefault )
+ return pVarTypeList[ nEle ].pDefault;
+
+ return pVarTypeList[ nEle ].pClass->GetDefault().pData;
+}
+
+/*************************************************************************
+|*
+|* RscClass::SetVarDflt()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.07.91
+|* Letzte Aenderung MM 22.07.91
+|*
+*************************************************************************/
+void RscClass::SetVarDflt( CLASS_DATA pData, USHORT nEle, BOOL bSet )
+{
+ RscClassInst * pClass;
+
+ pClass = (RscClassInst *)(pData + nSuperSize );
+ if( bSet )
+ pClass->nVarDflt |= ((ULONG)1 << nEle);
+ else
+ pClass->nVarDflt &= ~((ULONG)1 << nEle);
+}
+
+/*************************************************************************
+|*
+|* RscClass::IsDflt()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.07.91
+|* Letzte Aenderung MM 08.01.92
+|*
+*************************************************************************/
+BOOL RscClass::IsDflt( CLASS_DATA pData, USHORT nEle )
+{
+ RscClassInst * pClass;
+ BOOL bRet;
+
+ pClass = (RscClassInst *)(pData + nSuperSize );
+ if( pClass->nVarDflt & ((ULONG)1 << nEle) )
+ bRet = TRUE;
+ else
+ bRet = FALSE;
+/* {
+ //Variablenname ist Default
+ RSCINST aTmpI;
+
+ aTmpI = GetInstData( pData, nEle, TRUE );
+ if( aTmpI.IsInst() && !aTmpI.pClass->IsDefault( aTmpI ) )
+ bRet = FALSE;
+ }
+*/
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* RscClass::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RSCINST RscClass::Create
+(
+ RSCINST * pInst,
+ const RSCINST & rDflt,
+ BOOL bOwnClass
+)
+{
+ USHORT i;
+ CLASS_DATA * ppData;
+ RSCINST aInst;
+ RSCINST aMemInst, aDfltI;
+
+ if( !pInst )
+ {
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ RscTop::Create( &aInst, rDflt, bOwnClass );
+
+ if( bOwnClass )
+ ((RscClassInst *)(aInst.pData + nSuperSize))->nVarDflt =
+ ((RscClassInst *)(rDflt.pData + nSuperSize))->nVarDflt;
+ else
+ ((RscClassInst *)(aInst.pData + nSuperSize))->nVarDflt = 0xFFFFFFFF;
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ aDfltI = GetInstData( bOwnClass ? rDflt.pData : NULL, i, TRUE );
+
+ if( (VAR_POINTER & pVarTypeList[ i ].nVarType)
+ && !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ {
+ if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType )
+ {
+ RSCINST * pInst = (RSCINST *)
+ (aInst.pData + pVarTypeList[ i ].nOffset );
+ pInst->pClass = pVarTypeList[ i ].pClass;
+ ppData = &pInst->pData;
+ }
+ else
+ ppData = (CLASS_DATA* )
+ (aInst.pData + pVarTypeList[ i ].nOffset );
+ *ppData = NULL;
+ if( aDfltI.IsInst() )
+ {
+ aMemInst = pVarTypeList[ i ].pClass->Create( NULL, aDfltI );
+ *ppData = aMemInst.pData;
+ };
+ }
+ else
+ {
+ aMemInst = GetInstData( aInst.pData, i, TRUE );
+ aMemInst = aMemInst.pClass->Create( &aMemInst, aDfltI );
+ };
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscClass::Destroy()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void RscClass::Destroy( const RSCINST & rInst )
+{
+ USHORT i;
+
+ RscTop::Destroy( rInst );
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ if( !(pVarTypeList[ i ].nVarType & VAR_NODATAINST) )
+ {
+ RSCINST aTmpI;
+
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+ if( aTmpI.IsInst() )
+ {
+ // Objekt loeschen
+ aTmpI.pClass->Destroy( aTmpI );
+ if( pVarTypeList[ i ].nVarType & VAR_POINTER )
+ {
+ // Speicher freigeben
+ RscMem::Free( aTmpI.pData );
+ };
+ };
+ }
+ };
+}
+
+/*************************************************************************
+|*
+|* RscClass::SetVariable()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ERRTYPE RscClass::SetVariable
+(
+ HASHID nVarName,
+ RscTop * pClass,
+ RSCINST * pDflt,
+ RSCVAR nVarType,
+ USHORT nMask,
+ HASHID nDataBaseName
+)
+{
+ if( pVarTypeList )
+ pVarTypeList = (VARTYPE_STRUCT *)
+ RscMem::Realloc( (void *)pVarTypeList,
+ (USHORT)((nEntries +1) * sizeof( VARTYPE_STRUCT )) );
+ else
+ pVarTypeList = (VARTYPE_STRUCT *)
+ RscMem::Malloc( (USHORT)((nEntries +1)
+ * sizeof( VARTYPE_STRUCT )) );
+
+ pVarTypeList[ nEntries ].nVarName = nVarName;
+ pVarTypeList[ nEntries ].nMask = nMask;
+ pVarTypeList[ nEntries ].pClass = pClass;
+ pVarTypeList[ nEntries ].nOffset = nSize;
+ pVarTypeList[ nEntries ].nDataBaseName = nDataBaseName;
+ if( pDflt )
+ pVarTypeList[ nEntries ].pDefault = pDflt->pData;
+ else
+ pVarTypeList[ nEntries ].pDefault = NULL;
+
+ pVarTypeList[ nEntries ].nVarType = ~VAR_POINTER & nVarType;
+ if( pClass->Size() > 10 || (nVarType & VAR_EXTENDABLE) )
+ pVarTypeList[ nEntries ].nVarType |= VAR_POINTER;
+
+ if( !(pVarTypeList[ nEntries ].nVarType & VAR_NODATAINST) )
+ {
+ if( pVarTypeList[ nEntries ].nVarType & VAR_POINTER )
+ {
+ if( pVarTypeList[ nEntries ].nVarType & VAR_EXTENDABLE )
+ nSize += sizeof( RSCINST );
+ else
+ nSize += sizeof( CLASS_DATA );
+ }
+ else
+ nSize += pClass->Size();
+ }
+
+ nEntries++;
+ if( nEntries > (sizeof( ULONG ) * 8) )
+ {
+ // Bereich fuer Default zu klein
+ RscExit( 16 );
+ };
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscClass::EnumVariable()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void RscClass::EnumVariables( void * pData, VarEnumCallbackProc pProc )
+{
+ USHORT i;
+
+ RscTop::EnumVariables( pData, pProc );
+ for( i = 0; i < nEntries; i ++ )
+ {
+ if( !(pVarTypeList[ i ].nVarType & VAR_NOENUM) )
+ (*pProc)( pData, pVarTypeList[ i ].pClass->GetClassType(),
+ pVarTypeList[ i ].nVarName );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscClass::GetVariable()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+RSCINST RscClass::GetVariable
+(
+ const RSCINST & rInst,
+ HASHID nVarName,
+ const RSCINST & rInitInst,
+ BOOL bInitDflt,
+ RscTop * pCreateClass
+)
+{
+ USHORT i;
+ RSCINST aTmpI;
+
+ i = 0;
+ while( i < nEntries && pVarTypeList[ i ].nVarName != nVarName )
+ i++;
+ if( i < nEntries )
+ {
+ if( VAR_NODATAINST & pVarTypeList[ i ].nVarType )
+ {
+ aTmpI = GetVariable( rInst,
+ pVarTypeList[ i ].nDataBaseName,
+ RSCINST() );
+ aTmpI.pClass = pVarTypeList[ i ].pClass;
+ }
+ else
+ {
+ // Default Instanz generieren
+ RSCINST aDfltInst = rInitInst;
+ if( !aDfltInst.IsInst() && bInitDflt )
+ {
+ // mit dem Variablen-Default besetzen
+ aDfltInst.pData = pVarTypeList[ i ].pDefault;
+ aDfltInst.pClass = pVarTypeList[ i ].pClass;
+ }
+
+ aTmpI = GetInstData( rInst.pData, i );
+ if( aTmpI.IsInst() )
+ {
+ if( aDfltInst.IsInst() )
+ {
+ aTmpI.pClass->Destroy( aTmpI );
+ aTmpI.pClass->Create( &aTmpI, aDfltInst );
+ }
+ }
+ else
+ { // Wird ueber Zeiger angegeben
+ if( VAR_EXTENDABLE & pVarTypeList[ i ].nVarType )
+ {
+ RSCINST * pInst = (RSCINST *)
+ (rInst.pData + pVarTypeList[ i ].nOffset );
+ if( pCreateClass && pCreateClass->InHierarchy( aTmpI.pClass ) )
+ *pInst = pCreateClass->Create( NULL, aDfltInst );
+ else
+ *pInst = aTmpI.pClass->Create( NULL, aDfltInst );
+ aTmpI = *pInst;
+ }
+ else
+ {
+ CLASS_DATA * ppData
+ = (CLASS_DATA *)(rInst.pData + pVarTypeList[ i ].nOffset);
+ aTmpI = aTmpI.pClass->Create( NULL, aDfltInst );
+ *ppData = aTmpI.pData;
+ }
+ }
+ };
+ // auf nicht Default setzen
+ SetVarDflt( rInst.pData, i, FALSE );
+ return( aTmpI );
+ };
+
+ return( RscTop::GetVariable( rInst, nVarName, rInitInst,
+ bInitDflt, pCreateClass ) );
+}
+
+/*************************************************************************
+|*
+|* RscClass::GetCopyVar()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+RSCINST RscClass::GetCopyVar
+(
+ const RSCINST & rInst,
+ HASHID nVarName
+)
+{
+ USHORT i;
+ RSCINST aVarI;
+
+ i = 0;
+ while( i < nEntries && pVarTypeList[ i ].nVarName != nVarName )
+ i++;
+
+ if( i < nEntries )
+ {
+ if( VAR_NODATAINST & pVarTypeList[ i ].nVarType )
+ {
+ aVarI = GetCopyVar( rInst, pVarTypeList[ i ].nDataBaseName );
+ aVarI.pClass = pVarTypeList[ i ].pClass;
+ }
+ else
+ {
+ if( IsDflt( rInst.pData, i ) )
+ {
+ // mit Variablen Default initialiaieren
+ aVarI = GetVariable( rInst, nVarName, RSCINST(), TRUE );
+ SetVarDflt( rInst.pData, i, TRUE );
+ }
+ else
+ aVarI = GetInstData( rInst.pData, i, TRUE );
+
+ };
+ return aVarI ;
+ };
+
+ return RscTop::GetCopyVar( rInst, nVarName );
+}
+
+/*************************************************************************
+|*
+|* RscClass::IsConsistent()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL RscClass::IsConsistent( const RSCINST & rInst, RscInconsList * pList )
+{
+ USHORT i;
+ RSCINST aTmpI;
+ BOOL bRet;
+
+ bRet = RscTop::IsConsistent( rInst, pList );
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+
+ if( aTmpI.IsInst() )
+ if( ! aTmpI.pClass->IsConsistent( aTmpI, pList ) )
+ bRet = FALSE;
+ }
+ };
+
+ return( bRet );
+}
+
+/*************************************************************************
+|*
+|* RscClass::SetToDefault()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void RscClass::SetToDefault( const RSCINST & rInst )
+{
+ USHORT i;
+ RSCINST aTmpI;
+ RscClassInst * pClass;
+
+ pClass = (RscClassInst *)(rInst.pData + nSuperSize );
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ // Variablen ohne eigenen Speicher werden vom "Datenserver"
+ // auf Default gesetzt
+ if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+ if( aTmpI.IsInst() )
+ aTmpI.pClass->SetToDefault( aTmpI );
+ }
+ }
+ pClass->nVarDflt = 0xFFFFFFFF; // alles auf Default
+
+ RscTop::SetToDefault( rInst );
+}
+
+/*************************************************************************
+|*
+|* RscClass::IsDefault()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL RscClass::IsDefault( const RSCINST & rInst )
+{
+ USHORT i;
+ RSCINST aTmpI;
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ // Variablen ohne eigenen Speicher werden vom "Datenserver"
+ // auf Default untersucht
+ if( !(VAR_NODATAINST & pVarTypeList[ i ].nVarType) )
+ if( !IsDflt( rInst.pData, i ) )
+ return( FALSE );
+ };
+
+ return( RscTop::IsDefault( rInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscClass::GetDefault()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+RSCINST RscClass::GetDefault( HASHID nVarId )
+{
+ USHORT i;
+
+ i = 0;
+ while( i < nEntries && pVarTypeList[ i ].nVarName != nVarId )
+ i++;
+ if( i < nEntries )
+ {
+ RSCINST aTmpI;
+
+ aTmpI.pClass = pVarTypeList[ i ].pClass;
+ aTmpI.pData = GetDfltData( i );
+ return( aTmpI );
+ };
+
+ return( RscTop::GetDefault( nVarId ) );
+}
+
+/*************************************************************************
+|*
+|* RscClass::IsValueDflt()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL RscClass::IsValueDflt( CLASS_DATA pData, USHORT nEle )
+{
+ RSCINST aTmpI;
+
+ aTmpI = GetInstData( pData, nEle, TRUE );
+
+ if( aTmpI.IsInst() )
+ {
+ if( VAR_SVDYNAMIC & pVarTypeList[ nEle ].nVarType )
+ return FALSE;
+
+ if( aTmpI.pClass == pVarTypeList[ nEle ].pClass )
+ //sie haben auch die gleiche Klasse
+ return aTmpI.pClass->IsValueDefault( aTmpI, GetDfltData( nEle ) );
+ else
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscClass::IsValueDefault()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL RscClass::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
+{
+ USHORT i;
+ RSCINST aTmpI;
+ RSCINST aDfltI;
+
+ if( !RscTop::IsValueDefault( rInst, pDef ) )
+ return FALSE;
+
+ if( pDef )
+ {
+ for( i = 0; i < nEntries; i++ )
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+ if( aTmpI.IsInst() )
+ {
+ if( aTmpI.pClass != pVarTypeList[ i ].pClass )
+ //sie haben nicht die gleiche Klasse
+ return FALSE;
+
+ aDfltI = GetInstData( pDef, i, TRUE );
+ if( !aDfltI.IsInst() )
+ aDfltI.pData = GetDfltData( i );
+
+ if( !aTmpI.pClass->IsValueDefault( aTmpI, aDfltI.pData ) )
+ return FALSE;
+ }
+ }
+ }
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscClass::SetDefault()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void RscClass::SetDefault( const RSCINST & rInst, HASHID nVarName )
+{
+ USHORT i;
+ RSCINST aTmpI;
+
+ i = 0;
+ while( i < nEntries && pVarTypeList[ i ].nVarName != nVarName )
+ i++;
+
+ if( i < nEntries )
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+ if( aTmpI.IsInst() )
+ {
+ aTmpI.pClass->Destroy( aTmpI );
+ aTmpI.pClass->Create( &aTmpI, RSCINST() );
+ SetVarDflt( rInst.pData, i, TRUE );
+ }
+ }
+ else //In Superklasse nach Variable suchen
+ RscTop::SetDefault( rInst, nVarName );
+
+}
+
+
+/*************************************************************************
+|*
+|* RscClass::WriteSrc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void RscClass::WriteSrc
+(
+ const RSCINST & rInst,
+ FILE * fOutput,
+ RscTypCont * pTC,
+ USHORT nTab,
+ const char * pVarName
+)
+{
+ USHORT i, n;
+ RSCINST aTmpI;
+
+ RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ if( !(VAR_HIDDEN & pVarTypeList[ i ].nVarType) )
+ {
+ // Hack wegen Position und Dimensiuon
+ if( nRsc_XYMAPMODEId == pVarTypeList[ i ].nVarName
+ || nRsc_WHMAPMODEId == pVarTypeList[ i ].nVarName )
+ {
+ if( !IsDflt( rInst.pData, i ) //MapUnit
+ || !IsDflt( rInst.pData, i+1 ) //X, Width
+ || !IsDflt( rInst.pData, i+2 ) )//Y, Height
+ {// ein Wert ist nicht Default
+ for( n = 0; n < nTab; n++ )
+ fputc( '\t', fOutput );
+ if( nRsc_XYMAPMODEId == pVarTypeList[ i ].nVarName )
+ fprintf( fOutput, "Pos = " );
+ else
+ fprintf( fOutput, "Size = " );
+
+ if( !IsDflt( rInst.pData, i ) )
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+ aTmpI.pClass->WriteSrcHeader(
+ aTmpI, fOutput, pTC, nTab, RscId(), pVarName );
+ }
+
+ fprintf( fOutput, "( " );
+ aTmpI = GetInstData( rInst.pData, i+1, TRUE );
+ if( !aTmpI.IsInst() )
+ aTmpI.pData = GetDfltData( i+1 );
+ aTmpI.pClass->WriteSrcHeader(
+ aTmpI, fOutput, pTC, nTab, RscId(), pVarName );
+
+ fprintf( fOutput, ", " );
+ aTmpI = GetInstData( rInst.pData, i+2, TRUE );
+ if( !aTmpI.IsInst() )
+ aTmpI.pData = GetDfltData( i+2 );
+ aTmpI.pClass->WriteSrcHeader(
+ aTmpI, fOutput, pTC, nTab, RscId(), pVarName );
+ fprintf( fOutput, " );\n" );
+ }
+ i += 2; //_X, _Y oder _Widht, Height ueberlesen
+ }
+ else if( !IsDflt( rInst.pData, i )
+ && !IsValueDflt( rInst.pData, i ) )
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+
+ if( aTmpI.IsInst() )
+ {
+ char * pName = pHS->Get( pVarTypeList[ i ].nVarName );
+
+ for( n = 0; n < nTab; n++ )
+ fputc( '\t', fOutput );
+ fprintf( fOutput, "%s", pName );
+ fprintf( fOutput, " = " );
+ aTmpI.pClass->WriteSrcHeader(
+ aTmpI, fOutput, pTC, nTab, RscId(), pName );
+ fprintf( fOutput, ";\n" );
+ }
+ };
+ };
+ };
+
+ return;
+}
+
+/*************************************************************************
+|*
+|* RscClass::WriteInstRc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+long RscClass::GetCorrectValues
+(
+ const RSCINST & rInst,
+ USHORT nVarPos,
+ USHORT nTupelIdx,
+ RscTypCont * pTC
+)
+{
+ long nLang = 0;
+ long nBaseValue;
+
+ // Basiswert holen
+ RSCINST aTmpI = GetInstData( rInst.pData, nVarPos, TRUE );
+ aTmpI.pClass->GetNumber( aTmpI, &nBaseValue );
+
+ // Sprach Delta holen
+ aTmpI = rInst.pClass->GetVariable( rInst, nRsc_DELTALANG, RSCINST() );
+ if( aTmpI.IsInst() )
+ {
+ RscWriteRc aMem;
+ aTmpI.pClass->WriteRc( aTmpI, aMem, pTC, 0, FALSE );
+ nLang = (short)aMem.GetShort( nTupelIdx * sizeof( short ) );
+ }
+
+ return nLang + nBaseValue;
+}
+
+ERRTYPE RscClass::WriteInstRc
+(
+ const RSCINST & rInst,
+ RscWriteRc & rMem,
+ RscTypCont * pTC,
+ USHORT nDeep,
+ BOOL bExtra
+)
+{
+ USHORT i;
+ ERRTYPE aError;
+ RSCINST aTmpI;
+ USHORT nMaskOff;// Offset um Maskenfeld zu addressieren
+
+ // Wenn eine Variable Maskierung hat, dann Maskenfeld
+ for( i = 0; i < nEntries; i++ )
+ {
+ if( pVarTypeList[ i ].nMask )
+ {
+ nMaskOff = rMem.Size();
+ rMem.Put( (USHORT)0 );
+ break;
+ }
+ };
+
+ for( i = 0; i < nEntries && aError.IsOk(); i++ )
+ {
+ if( !((VAR_NODATAINST | VAR_NORC) & pVarTypeList[ i ].nVarType ))
+ {
+ if( pVarTypeList[ i ].nMask )
+ {
+ if( !IsDflt( rInst.pData, i ) )
+ {
+ if( nRsc_X == pVarTypeList[ i ].nVarName )
+ {
+ INT32 nVal = GetCorrectValues( rInst, i, 0, pTC );
+ rMem.Put( nVal );
+ }
+ else if( nRsc_Y == pVarTypeList[ i ].nVarName )
+ {
+ INT32 nVal = GetCorrectValues( rInst, i, 1, pTC );
+ rMem.Put( nVal );
+ }
+ else if( nRsc_WIDTH == pVarTypeList[ i ].nVarName )
+ {
+ INT32 nVal = GetCorrectValues( rInst, i, 2, pTC );
+ rMem.Put( nVal );
+ }
+ else if( nRsc_HEIGHT == pVarTypeList[ i ].nVarName )
+ {
+ INT32 nVal = GetCorrectValues( rInst, i, 3, pTC );
+ rMem.Put( nVal );
+ }
+ else
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+ // Nur an Variable Extradata bExtra nicht auf FALSE
+ // setzen
+ aError = aTmpI.pClass->
+ WriteRcHeader( aTmpI, rMem, pTC,
+ RscId(), nDeep,
+ (nRsc_EXTRADATA
+ == pVarTypeList[ i ].nVarName)
+ ? bExtra : FALSE );
+ }
+ USHORT nMask = rMem.GetShort( nMaskOff );
+ nMask |= pVarTypeList[ i ].nMask;
+ rMem.PutAt( nMaskOff, nMask );
+ }
+ }
+ else{
+ if( IsDflt( rInst.pData, i ) )
+ {
+ aTmpI.pClass = pVarTypeList[ i ].pClass;
+ aTmpI.pData = GetDfltData( i );
+ }
+ else
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+ // Nur an Variable Extradata bExtra nicht auf FALSE
+ // setzen
+ aError = aTmpI.pClass->
+ WriteRcHeader( aTmpI, rMem, pTC,
+ RscId(), nDeep,
+ (nRsc_EXTRADATA
+ == pVarTypeList[ i ].nVarName)
+ ? bExtra : FALSE );
+ }
+ }
+ }
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscClass::WriteRc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ERRTYPE RscClass::WriteRc
+(
+ const RSCINST & rInst,
+ RscWriteRc & rMem,
+ RscTypCont * pTC,
+ USHORT nDeep,
+ BOOL bExtra
+)
+{
+ ERRTYPE aError;
+
+ aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+ if( aError.IsOk() )
+ aError = WriteInstRc( rInst, rMem, pTC, nDeep, bExtra );
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscClass::WriteSyntax()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void RscClass::WriteSyntax( FILE * fOutput, RscTypCont * pTC )
+{
+ RscTop::WriteSyntax( fOutput, pTC );
+
+ USHORT i;
+ // Wenn eine Variable Maskierung hat, dann Maskenfeld
+ fprintf( fOutput, "\t//%s\n", pHS->Get( GetId() ) );
+ for( i = 0; i < nEntries; i++ )
+ {
+ fprintf( fOutput, "\t%s", pHS->Get( pVarTypeList[ i ].nVarName ) );
+ USHORT n = strlen( pHS->Get( pVarTypeList[ i ].nVarName ) );
+ while( n < 20 )
+ {
+ putc( ' ', fOutput );
+ n++;
+ }
+ fprintf( fOutput, " = %s;\n",
+ pHS->Get( pVarTypeList[ i ].pClass->GetId() ) );
+ };
+}
+
+//==================================================================
+void RscClass::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ fprintf( fOutput, "\t\tSet%s( %s ", pName, pHS->Get( GetId() ) );
+ fprintf( fOutput, "%s ", aCallPar2.GetBuffer() );
+ fprintf( fOutput, "ResId( (RSHEADER_TYPE*)(pResData+nOffset) ) ) );\n" );
+ fprintf( fOutput, "\t\tnOffset += GetObjSizeRes( (RSHEADER_TYPE*)(pResData+nOffset) );\n" );
+}
+
+//==================================================================
+void RscClass::WriteRcCtor( FILE * fOutput, RscTypCont * pTC )
+{
+ if( GetId() != HASH_NONAME )
+ {
+ // Konstruktor
+ fprintf( fOutput, "%s::%s%s bFreeResource )",
+ pHS->Get( GetId() ), pHS->Get( GetId() ),
+ aCallParType.GetBuffer() );
+ if( GetSuperClass() )
+ {
+ // Superaufruf
+ fprintf( fOutput, "\n\t: %s", pHS->Get( GetSuperClass()->GetId() ) );
+ fprintf( fOutput, "%s", GetSuperClass()->aCallPar1.GetBuffer() );
+ fprintf( fOutput, " rResId.SetRT2( 0x%x ) )", GetTypId() );
+ }
+ fprintf( fOutput, "\n{\n" );
+ fprintf( fOutput, "\tUSHORT\tnObjMask;\n" );
+ fprintf( fOutput, "\tUSHORT\tnOffset = 0;\n" );
+ fprintf( fOutput, "\tBYTE *\tpResData;\n\n" );
+ fprintf( fOutput, "\tpResData = (BYTE *)GetClassRes();\n\n" );
+ fprintf( fOutput, "\tnObjMask = *(USHORT*)pResData;\n" );
+ fprintf( fOutput, "\tnOffset += 2;\n\n" );
+
+ for( USHORT i = 0; i < nEntries; i++ )
+ {
+ if( !((VAR_NODATAINST | VAR_NORC) & pVarTypeList[ i ].nVarType ))
+ {
+ fprintf( fOutput, "\tif( nObjMask & 0x%x )\n\t{\n",
+ pVarTypeList[ i ].nMask );
+
+ pVarTypeList[ i ].pClass->WriteRcAccess( fOutput, pTC,
+ pHS->Get( pVarTypeList[ i ].nVarName ) );
+
+ fprintf( fOutput, "\t}\n" );
+ }
+ }
+ fprintf( fOutput, "\tIncrementRes( nOffset );\n" );
+ fprintf( fOutput, "\tif( bFreeResource )\n" );
+ fprintf( fOutput, "\t\tFreeResource();\n" );
+ fprintf( fOutput, "}\n\n" );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscSysDepend::RscSysDepend()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+RscSysDepend::RscSysDepend( HASHID nId, USHORT nTypeId, RscTop * pSuper )
+ : RscClass( nId, nTypeId, pSuper )
+{}
+
+/*************************************************************************
+|*
+|* RscSysDepend::WriteRc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ERRTYPE RscSysDepend::WriteSysDependRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra, BOOL bFirst )
+{
+ USHORT nId = 0xFFFF;
+ ERRTYPE aError;
+ RSCINST aFileName;
+
+ //Instanz mit dem Dateinamen "FILENAME" holen
+ aFileName = RscClass::GetCopyVar( rInst, pHS->Test( "FILE" ) );
+ if( aFileName.IsInst() )
+ {
+ RscWriteRc aTmpMem;
+ aError = aFileName.pClass->WriteRcHeader( aFileName, aTmpMem, pTC,
+ RscId(), nDeep, bExtra );
+ // Obsolete - need changes in VCL
+ rMem.Put( (USHORT)0 );
+
+ // Identifier schreiben
+ if( aTmpMem.Size() && pTC && (*aTmpMem.GetUTF8( 0 ) != '\0') )
+ {
+ nId = pTC->PutSysName( rInst.pClass->GetTypId(),
+ aTmpMem.GetUTF8( 0 ),
+ 0, (USHORT)0, bFirst );
+ }
+ rMem.Put( nId );
+ aError = aFileName.pClass->WriteRcHeader( aFileName, rMem, pTC,
+ RscId(), nDeep, bExtra );
+ }
+ else
+ aError = ERR_ERROR;
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscSysDepend::WriteRc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ERRTYPE RscSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ ERRTYPE aError = RscClass::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+
+ if( this == rInst.pClass )
+ // nur wenn es eigen Klasse ist
+ aError = WriteSysDependRc( rInst, rMem, pTC, nDeep, bExtra );
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscFirstSysDepend::RscFirstSysDepend()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+RscFirstSysDepend::RscFirstSysDepend( HASHID nId, USHORT nTypeId,
+ RscTop * pSuper )
+ : RscSysDepend( nId, nTypeId, pSuper )
+{}
+
+/*************************************************************************
+|*
+|* RscFirstSysDepend::WriteRc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ERRTYPE RscFirstSysDepend::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ ERRTYPE aError = RscClass::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+ aError = WriteSysDependRc( rInst, rMem, pTC, nDeep, bExtra, TRUE );
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscTupel::RscTupel()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+RscTupel::RscTupel( HASHID nId, USHORT nTypeId, RscTop * pSuper )
+ : RscClass( nId, nTypeId, pSuper )
+{}
+
+/*************************************************************************
+|*
+|* RscTupel::GetTupelVar()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+RSCINST RscTupel::GetTupelVar( const RSCINST & rInst, USHORT nPos,
+ const RSCINST & rInitInst )
+{
+ if( nPos >= nEntries )
+ {
+ return RSCINST();
+ }
+ else
+ return GetVariable( rInst, pVarTypeList[ nPos ].nVarName, rInitInst );
+}
+
+/*************************************************************************
+|*
+|* RscTupel::WriteSrc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void RscTupel::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const char * pVarName )
+{
+ USHORT i;
+ RSCINST aTmpI;
+
+ RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+
+ fprintf( fOutput, "< " );
+ for( i = 0; i < nEntries; i++ )
+ {
+ if( !(VAR_HIDDEN & pVarTypeList[ i ].nVarType) )
+ {
+ if( !IsDflt( rInst.pData, i )
+ && !IsValueDflt( rInst.pData, i ) )
+ {
+ aTmpI = GetInstData( rInst.pData, i, TRUE );
+
+ if( aTmpI.IsInst() )
+ aTmpI.pClass->WriteSrcHeader(
+ aTmpI, fOutput, pTC, nTab, RscId(), pVarName );
+ else
+ fprintf( fOutput, "Default" );
+ }
+ else
+ fprintf( fOutput, "Default" );
+ fprintf( fOutput, "; " );
+ };
+ };
+ fprintf( fOutput, ">" );
+
+ return;
+}
diff --git a/rsc/source/res/rscclobj.cxx b/rsc/source/res/rscclobj.cxx
new file mode 100644
index 000000000000..d2c778c37d15
--- /dev/null
+++ b/rsc/source/res/rscclobj.cxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscclobj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscclobj.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.9 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.8 2000/07/26 17:13:22 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.7 1998/01/08 13:20:44 MM
+ includes angepasst
+
+
+ Rev 1.6 08 Jan 1998 13:20:44 MM
+ includes angepasst
+
+ Rev 1.5 12 Sep 1996 12:44:06 MM
+ Eigene Ressourcen definieren
+
+ Rev 1.4 21 Nov 1995 19:50:20 TLX
+ Neuer Link
+
+ Rev 1.3 03 Mar 1994 12:03:28 mm
+ C40 Warnings beseitigt
+
+ Rev 1.2 12 Jan 1994 15:20:18 mm
+ Alignementprobleme und Warnings fuer DEC-Alpha beseitigt
+
+ Rev 1.1 25 Aug 1993 15:29:00 mm
+ Fehler und Warnings beseitigt
+
+ Rev 1.0 10 Aug 1992 07:20:50 MM
+ Initial revision.
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+
+// Solar Definitionen
+#include <tools/solar.h>
+
+// Programmabhaengige Includes.
+#ifndef _RSCCLOBJ_HXX
+#include <rscclobj.hxx>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+
+/****************** C O D E **********************************************/
+
+/****************** R e f N o d e ****************************************/
+/*************************************************************************
+|*
+|* RefNode::RefNode()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.05.91
+|* Letzte Aenderung MM 03.05.91
+|*
+*************************************************************************/
+RefNode::RefNode( HASHID nTyp ){
+ pObjBiTree = 0;
+ nTypNameId = nTyp;
+}
+
+/*************************************************************************
+|*
+|* RefNode::GetId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+USHORT RefNode::GetId() const
+{
+ return( nTypNameId );
+}
+
+/*************************************************************************
+|*
+|* RefNode::PutObjNode()
+|*
+|* Beschreibung NAME.DOC
+|* Ersterstellung MM 21.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+BOOL RefNode::PutObjNode( ObjNode * pPutObject ){
+// insert a node in the b-tree pObjBiTree
+// if the node with the same name is in pObjBiTree,
+// return FALSE and no insert,
+
+ if( pObjBiTree )
+ return( pObjBiTree->Insert( pPutObject ) );
+
+ pObjBiTree = pPutObject;
+ return( TRUE );
+}
+
+/****************** O b j N o d e ****************************************/
+/*************************************************************************
+|*
+|* RefNode::GetObjNode()
+|*
+|* Beschreibung NAME.DOC
+|* Ersterstellung MM 21.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+ObjNode * RefNode :: GetObjNode( const RscId & rRscId ){
+// insert a node in the b-tree pObjBiTree
+// if the node with the same name is in pObjBiTree,
+// return NULL and no insert,
+// if not return the pointer to the Object
+
+ if( pObjBiTree )
+ return( pObjBiTree->Search( rRscId ) );
+ return( NULL );
+}
+
+/*************************************************************************
+|*
+|* ObjNode::ObjNode()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+ObjNode::ObjNode( const RscId & rId, CLASS_DATA pData, ULONG lKey ){
+ pRscObj = pData;
+ aRscId = rId;
+ lFileKey = lKey;
+}
+
+/*************************************************************************
+|*
+|* ObjNode::DelObjNode()
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+ObjNode * ObjNode::DelObjNode( RscTop * pClass, ULONG nFileKey ){
+ ObjNode * pRetNode = this;
+
+ if( Right() )
+ pRight = ((ObjNode *)Right())->DelObjNode( pClass, nFileKey );
+ if( Left() )
+ pLeft = ((ObjNode *)Left())->DelObjNode( pClass, nFileKey );
+
+ if( GetFileKey() == nFileKey ){
+ if( GetRscObj() ){
+ pClass->Destroy( RSCINST( pClass, GetRscObj() ) );
+ RscMem::Free( GetRscObj() );
+ }
+ pRetNode = (ObjNode *)Right();
+ if( pRetNode ){
+ if( Left() )
+ pRetNode->Insert( (ObjNode *)Left() );
+ }
+ else
+ pRetNode = (ObjNode *)Left();
+ delete this;
+ }
+ return pRetNode;
+}
+
+/*************************************************************************
+|*
+|* ObjNode::GetId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+USHORT ObjNode::GetId() const
+{
+ return( (USHORT)(long)aRscId );
+}
+
+/*************************************************************************
+|*
+|* ObjNode::IsConsistent()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.09.91
+|* Letzte Aenderung MM 23.09.91
+|*
+*************************************************************************/
+BOOL ObjNode::IsConsistent( RscInconsList * pList )
+{
+ BOOL bRet = TRUE;
+
+ if( (long)aRscId > 0x7FFF || (long)aRscId < 1 )
+ {
+ bRet = FALSE;
+ if( pList )
+ pList->Insert( new RscInconsistent( aRscId, aRscId ) );
+ }
+ else
+ {
+ if( Left() )
+ {
+ if( !((ObjNode *)Left())->IsConsistent( pList ) )
+ bRet = FALSE;
+ if( ((ObjNode *)Left())->aRscId >= aRscId )
+ {
+ bRet = FALSE;
+ if( pList )
+ pList->Insert(
+ new RscInconsistent( ((ObjNode *)Left())->GetRscId(),
+ GetRscId() ) );
+ }
+ };
+ if( Right() )
+ {
+ if( ((ObjNode *)Right())->aRscId <= aRscId )
+ {
+ bRet = FALSE;
+ if( pList )
+ pList->Insert(
+ new RscInconsistent( GetRscId(),
+ ((ObjNode *)Right())->GetRscId() ) );
+ }
+ if( !((ObjNode *)Right())->IsConsistent( pList ) )
+ bRet = FALSE;
+ };
+ };
+
+ return( bRet );
+}
diff --git a/rsc/source/res/rscconst.cxx b/rsc/source/res/rscconst.cxx
new file mode 100644
index 000000000000..97c5ab81f668
--- /dev/null
+++ b/rsc/source/res/rscconst.cxx
@@ -0,0 +1,451 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscconst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscconst.cxx,v 1.1.1.1 2000-09-18 16:42:55 hr Exp $
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Solar Definitionen
+#include <tools/solar.h>
+
+// Programmabh„ngige Includes.
+#ifndef _RSCCONST_HXX
+#include <rscconst.hxx>
+#endif
+
+/****************** C O D E **********************************************/
+/****************** R s c C o n s t **************************************/
+/*************************************************************************
+|*
+|* RscConst::RscConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.05.91
+|* Letzte Aenderung MM 03.05.91
+|*
+*************************************************************************/
+RscConst::RscConst( HASHID nId, USHORT nTypeId )
+ : RscTop( nId, nTypeId )
+{
+ pVarArray = NULL;
+ nEntries = 0;
+}
+
+/*************************************************************************
+|*
+|* RscConst::~RscConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.05.91
+|* Letzte Aenderung MM 03.05.91
+|*
+*************************************************************************/
+RscConst::~RscConst()
+{
+ if( pVarArray )
+ RscMem::Free( (void *)pVarArray );
+}
+
+/*************************************************************************
+|*
+|* RscConst::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.05.91
+|* Letzte Aenderung MM 03.05.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscConst::GetClassType() const
+{
+ return RSCCLASS_CONST;
+}
+
+/*************************************************************************
+|*
+|* RscConst::SetConstance()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+ERRTYPE RscConst::SetConstant( HASHID nVarName, INT32 lValue ){
+ if( pVarArray )
+ pVarArray = (VarEle *)
+ RscMem::Realloc( (void *)pVarArray,
+ (USHORT)((nEntries +1) * sizeof( VarEle )) );
+ else
+ pVarArray = (VarEle *)
+ RscMem::Malloc( (USHORT)((nEntries +1) * sizeof( VarEle )) );
+ pVarArray[ nEntries ].nId = nVarName;
+ pVarArray[ nEntries ].lValue = lValue;
+ nEntries++;
+
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscConst::GetConstance()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+HASHID RscConst::GetConstant( USHORT nPos ){
+ if( nPos < nEntries )
+ return pVarArray[ nPos ].nId;
+ return( HASH_NONAME );
+}
+
+/*************************************************************************
+|*
+|* RscConst::GetConstValue()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+BOOL RscConst::GetConstValue( HASHID nConst, INT32 * pValue ) const
+{
+ USHORT i;
+
+ for( i = 0; i < nEntries; i++ )
+ if( pVarArray[ i ].nId == nConst )
+ {
+ *pValue = pVarArray[ i ].lValue;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscConst::GetValueConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+BOOL RscConst::GetValueConst( INT32 lValue, HASHID * pConst ) const
+{
+ USHORT i;
+
+ for( i = 0; i < nEntries; i++ )
+ if( pVarArray[ i ].lValue == lValue )
+ {
+ *pConst = pVarArray[ i ].nId;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscConst::GetConstPos()
+|*
+|* Beschreibung Sucht die Position der Konstanten
+|* Return = nEntries, nicht gefunden
+|* Return = Position im Feld
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+USHORT RscConst::GetConstPos( HASHID nConst )
+{
+ USHORT i;
+
+ for( i = 0; i < nEntries; i++ )
+ {
+ if( pVarArray[ i ].nId == nConst )
+ return( i );
+ }
+
+ return( nEntries );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::WriteSyntax()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+void RscConst::WriteSyntax( FILE * fOutput, RscTypCont * pTC )
+{
+ RscTop::WriteSyntax( fOutput, pTC );
+
+ USHORT i;
+ // Wenn eine Variable Maskierung hat, dann Maskenfeld
+ fprintf( fOutput, "\t" );
+ for( i = 0; i < nEntries; i++ )
+ {
+ fprintf( fOutput, "%s, ", pHS->Get( pVarArray[ i ].nId ) );
+ if( 3 == (i % 4) && i < (USHORT)(nEntries -1) )
+ fprintf( fOutput, "\n\t" );
+ };
+ fprintf( fOutput, "\n" );
+}
+
+//==================================================================
+void RscConst::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ fprintf( fOutput, "\t\tSet%s( %s( ", pName, pHS->Get( GetId() ) );
+ fprintf( fOutput, "*(short*)(pResData+nOffset) ) );\n" );
+ fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" );
+}
+
+/****************** R s c E n u m ****************************************/
+/*************************************************************************
+|*
+|* RscEnum::RscEnum()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RscEnum::RscEnum( HASHID nId, USHORT nTypeId, BOOL bUSHORT_ )
+ : RscConst( nId, nTypeId )
+ , bUSHORT( bUSHORT_ )
+{
+ nSize = ALIGNED_SIZE( sizeof( RscEnumInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::SetConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+ERRTYPE RscEnum::SetConst( const RSCINST & rInst, HASHID nConst, long nVal )
+{
+ USHORT i;
+
+ if( nEntries != (i = GetConstPos( nConst )) )
+ {
+ ((RscEnumInst *)rInst.pData)->nValue = i;
+ ((RscEnumInst *)rInst.pData)->bDflt = FALSE;
+ return( ERR_OK );
+ };
+
+ return( ERR_RSCENUM );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.91
+|* Letzte Aenderung MM 18.07.91
+|*
+*************************************************************************/
+ERRTYPE RscEnum::SetNumber( const RSCINST & rInst, INT32 lValue ){
+ USHORT i;
+
+ for( i = 0; i < nEntries; i++ ){
+ if( (long)pVarArray[ i ].lValue == lValue )
+ return( SetConst( rInst, pVarArray[ i ].nId, lValue ) );
+ };
+
+ return( ERR_RSCENUM );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::GetConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+ERRTYPE RscEnum::GetConst( const RSCINST & rInst, HASHID * pH ){
+ *pH = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::GetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.09.91
+|* Letzte Aenderung MM 16.09.91
+|*
+*************************************************************************/
+ERRTYPE RscEnum::GetNumber( const RSCINST & rInst, long * pNumber ){
+ *pNumber = pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RSCINST RscEnum::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){
+ RSCINST aInst;
+
+ if( !pInst ){
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA)
+ RscMem::Malloc( sizeof( RscEnumInst ) );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ if( bOwnClass )
+ memmove( aInst.pData, rDflt.pData, Size() );
+ else{
+ ((RscEnumInst *)aInst.pData)->nValue = 0;
+ ((RscEnumInst *)aInst.pData)->bDflt = TRUE;
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.01.92
+|* Letzte Aenderung MM 15.01.92
+|*
+*************************************************************************/
+BOOL RscEnum::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
+ if( pDef ){
+ if( ((RscEnumInst*)rInst.pData)->nValue ==
+ ((RscEnumInst*)pDef)->nValue )
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscEnum::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscEnum::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ fprintf( fOutput, "%s", pHS->Get(
+ pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].nId ) );
+}
+
+/*************************************************************************
+|*
+|* RscEnum::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+ERRTYPE RscEnum::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont *, USHORT, BOOL )
+{
+ if( bUSHORT )
+ aMem.Put( (USHORT)pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue );
+ else
+ aMem.Put( (INT32)pVarArray[ ((RscEnumInst *)rInst.pData)->nValue ].lValue );
+ return( ERR_OK );
+}
+
+
diff --git a/rsc/source/res/rsccont.cxx b/rsc/source/res/rsccont.cxx
new file mode 100644
index 000000000000..e3a16f37d8bb
--- /dev/null
+++ b/rsc/source/res/rsccont.cxx
@@ -0,0 +1,1236 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsccont.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rsccont.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.20 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.19 2000/07/26 17:13:22 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.18 2000/07/12 11:38:19 th
+ Unicode
+
+ Revision 1.17 1999/11/24 17:54:47 th
+ remove dependencies to vcl
+
+ Revision 1.16 1999/09/08 09:24:59 mm
+ BigEndian/LittleEndian komplett durchgezogen
+
+ Revision 1.15 1998/02/19 17:50:42 HJS
+ includes
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Programmabh„ngige Includes.
+#ifndef _RSCCONT_HXX
+#include <rsccont.hxx>
+#endif
+
+#include <tools/rcid.h>
+
+/****************** C O D E **********************************************/
+/****************** E N T R Y S T R U C T ********************************/
+/*************************************************************************
+|*
+|* ENTRYSTRUCT::Destroy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.08.91
+|* Letzte Aenderung MM 06.08.91
+|*
+*************************************************************************/
+void ENTRY_STRUCT::Destroy()
+{
+ aName.Destroy();
+ if( aInst.IsInst() ){
+ aInst.pClass->Destroy( aInst );
+ RscMem::Free( aInst.pData );
+ };
+}
+
+/****************** R s c B a s e C o n t ********************************/
+/*************************************************************************
+|*
+|* RscBaseCont::RscBaseCont()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscBaseCont::RscBaseCont( HASHID nId, USHORT nTypeId, RscTop * pSuper,
+ BOOL bNoIdent )
+ : RscTop( nId, nTypeId, pSuper )
+{
+ pTypeClass = NULL;
+ pTypeClass1 = NULL;
+ bNoId = bNoIdent;
+ nOffInstData = RscTop::Size();
+ nSize = nOffInstData + ALIGNED_SIZE( sizeof( RscBaseContInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::~RscBaseCont()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RscBaseCont::~RscBaseCont(){
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscBaseCont::GetClassType() const
+{
+ return RSCCLASS_COMPLEX;
+}
+
+/*************************************************************************
+|*
+|* DestroyElements()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+void RscBaseCont::DestroyElements( RscBaseContInst * pClassData ){
+ USHORT i;
+
+ if( pClassData->nEntries ){
+ for( i = 0; i < pClassData->nEntries; i++ ){
+ pClassData->pEntries[ i ].Destroy();
+ };
+ RscMem::Free( pClassData->pEntries );
+ pClassData->pEntries = NULL;
+ pClassData->nEntries = 0;
+ };
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+RSCINST RscBaseCont::Create( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass )
+{
+ USHORT i;
+ RSCINST aInst;
+ RscBaseContInst * pClassData;
+
+ if( !pInst ){
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ RscTop::Create( &aInst, rDflt, bOwnClass );
+
+ pClassData = (RscBaseContInst *)(aInst.pData + nOffInstData);
+ pClassData->nEntries = 0;
+ pClassData->pEntries = NULL;
+ pClassData->bDflt = TRUE;
+
+ if( bOwnClass ){
+ RscBaseContInst * pDfltClassData;
+ RSCINST aDfltI;
+
+ pDfltClassData = (RscBaseContInst *)(rDflt.pData + nOffInstData);
+
+ if( 0 != pDfltClassData->nEntries ){
+ *pClassData = *pDfltClassData;
+ pClassData->pEntries =
+ (ENTRY_STRUCT *)RscMem::Malloc( sizeof( ENTRY_STRUCT )
+ * pClassData->nEntries );
+ for( i = 0; i < pClassData->nEntries; i++ ){
+ pClassData->pEntries[ i ].Create();
+ pClassData->pEntries[ i ].aName =
+ pDfltClassData->pEntries[ i ].aName;
+ aDfltI = pDfltClassData->pEntries[ i ].aInst;
+ pClassData->pEntries[ i ].aInst =
+ aDfltI.pClass->Create( NULL, aDfltI );
+ };
+ };
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::Destroy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.05.91
+|* Letzte Aenderung MM 25.05.91
+|*
+*************************************************************************/
+void RscBaseCont::Destroy( const RSCINST & rInst ){
+ RscBaseContInst * pClassData;
+
+ RscTop::Destroy( rInst);
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+ DestroyElements( pClassData );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::SearchEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 17.05.91
+|* Letzte Aenderung MM 17.05.91
+|*
+*************************************************************************/
+RSCINST RscBaseCont::SearchElePos( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pClass, USHORT nPos )
+{
+ USHORT i;
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+ if( !pClass )
+ pClass = pTypeClass;
+
+ if( rEleName.IsId() ){
+ for( i = nPos; i < pClassData->nEntries; i++ ){
+ if( pClassData->pEntries[ i ].aName == rEleName
+ && pClassData->pEntries[ i ].aInst.pClass == pClass )
+ {
+ return( pClassData->pEntries[ i ].aInst );
+ };
+ };
+ };
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::SearchEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 17.05.91
+|* Letzte Aenderung MM 17.05.91
+|*
+*************************************************************************/
+RSCINST RscBaseCont::SearchEle( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pClass )
+{
+ return SearchElePos( rInst, rEleName, pClass, 0 );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::GetElement()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::GetElement( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pCreateClass,
+ const RSCINST & rCreateInst, RSCINST * pGetInst )
+{
+ RscBaseContInst * pClassData;
+ RSCINST aTmpI;
+ ERRTYPE aError;
+
+ if( !bNoId && !rEleName.IsId() )
+ aError = WRN_CONT_NOID;
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( pCreateClass ){
+ if( !pCreateClass->InHierarchy( pTypeClass ) ){
+ if( pTypeClass1 ){
+ if( !pCreateClass->InHierarchy( pTypeClass1 ) ){
+ // Falscher Typ
+ return ERR_CONT_INVALIDTYPE;
+ }
+ }
+ else{
+ // Falscher Typ
+ return ERR_CONT_INVALIDTYPE;
+ };
+ };
+ }
+ else
+ pCreateClass = pTypeClass;
+
+ pClassData->bDflt = FALSE;
+ if( !bNoId )
+ aTmpI = SearchEle( rInst, rEleName, pCreateClass );
+ // Eintrag gefunden
+ if( aTmpI.IsInst() ){
+ aError = WRN_CONT_DOUBLEID;
+ if( rCreateInst.IsInst() ){
+ aTmpI.pClass->Destroy( aTmpI );
+ aTmpI.pClass->Create( &aTmpI, rCreateInst );
+ };
+ }
+ else {
+ if( pClassData->pEntries ){
+ pClassData->pEntries =
+ (ENTRY_STRUCT *)RscMem::Realloc( pClassData->pEntries,
+ sizeof( ENTRY_STRUCT ) * (pClassData->nEntries +1) );
+ }
+ else {
+ pClassData->pEntries =
+ (ENTRY_STRUCT *)RscMem::Malloc( sizeof( ENTRY_STRUCT )
+ * (pClassData->nEntries +1) );
+ };
+
+ pClassData->pEntries[ pClassData->nEntries ].Create();
+ pClassData->pEntries[ pClassData->nEntries ].aName = rEleName;
+
+ if( rCreateInst.IsInst() ){
+ // Instanz mit CreateInst-Daten initialisieren
+ pClassData->pEntries[ pClassData->nEntries ].aInst =
+ pCreateClass->Create( NULL, rCreateInst );
+ }
+ else {
+ pClassData->pEntries[ pClassData->nEntries ].aInst =
+ pCreateClass->Create( NULL, RSCINST() );
+ };
+
+ pClassData->nEntries++;
+ aTmpI = pClassData->pEntries[ pClassData->nEntries -1 ].aInst;
+ }
+
+ *pGetInst = aTmpI;
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::GetCount()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+USHORT RscBaseCont::GetCount( const RSCINST & rInst ){
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+ return( pClassData->nEntries );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::GetPosEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+RSCINST RscBaseCont::GetPosEle( const RSCINST & rInst, USHORT nPos ){
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( nPos < pClassData->nEntries )
+ return( pClassData->pEntries[ nPos ].aInst );
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::MovePosEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.10.91
+|* Letzte Aenderung MM 23.10.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::MovePosEle( const RSCINST & rInst, USHORT nDestPos,
+ USHORT nSourcePos )
+{
+ ERRTYPE aError;
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( (nDestPos < pClassData->nEntries) && (nSourcePos < pClassData->nEntries) ){
+ ENTRY_STRUCT aEntry;
+ short nInc = 1;
+ USHORT i;
+
+ // Quelle Merken
+ aEntry = pClassData->pEntries[ nSourcePos ];
+ // Richtung der for-Schleife bestimmen
+ if( nDestPos < nSourcePos )
+ nInc = -1;
+
+ for( i = nSourcePos; i != nDestPos; i += nInc )
+ pClassData->pEntries[ i ] = pClassData->pEntries[ i + nInc ];
+
+ // Zuweisung Quelle auf Ziel
+ pClassData->pEntries[ nDestPos ] = aEntry;
+ }
+ else
+ aError = ERR_RSCCONT;
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::SetPosRscId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 30.09.91
+|* Letzte Aenderung MM 30.09.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::SetPosRscId( const RSCINST & rInst, USHORT nPos,
+ const RscId & rId ){
+ RscBaseContInst * pClassData;
+ RSCINST aTmpI;
+ ERRTYPE aError;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( nPos < pClassData->nEntries ){
+ if( ! (rId == pClassData->pEntries[ nPos ].aName) )
+ aTmpI = SearchEle( rInst, rId,
+ pClassData->pEntries[ nPos ].aInst.pClass );
+ if( !aTmpI.IsInst() )
+ pClassData->pEntries[ nPos ].aName = rId;
+ else
+ aError = ERR_RSCCONT;
+ }
+ else
+ aError = ERR_RSCCONT;
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::GetInfoEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+SUBINFO_STRUCT RscBaseCont::GetInfoEle( const RSCINST & rInst, USHORT nPos ){
+ RscBaseContInst * pClassData;
+ SUBINFO_STRUCT aInfo;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( nPos < pClassData->nEntries ){
+ aInfo.aId = pClassData->pEntries[ nPos ].aName;
+ aInfo.nPos = nPos;
+ aInfo.pClass = pClassData->pEntries[ nPos ].aInst.pClass;
+ }
+ return( aInfo );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::SetString()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.04.91
+|* Letzte Aenderung MM 29.04.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::SetString( const RSCINST & rInst, char * pStr ){
+ RscBaseContInst * pClassData;
+ RSCINST aTmpI;
+ ERRTYPE aError;
+ char *pTmpStr;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+//?B 040991
+//?W 040991 sonst Endlosrekursion moeglich
+if( RSC_NOTYPE == pTypeClass->GetTypId() ){
+ aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetString( aTmpI, &pTmpStr );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetString( aTmpI, pStr );
+ else {
+ aError.Clear();
+ DeletePos( rInst, pClassData->nEntries -1 );
+ aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetString( aTmpI, &pTmpStr );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetString( aTmpI, pStr );
+ }
+ if( aError.IsError() )
+ DeletePos( rInst, pClassData->nEntries -1 );
+}
+else
+ aError = ERR_UNKNOWN_METHOD;
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.06.91
+|* Letzte Aenderung MM 12.06.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::SetNumber( const RSCINST & rInst, long lValue ){
+ RscBaseContInst * pClassData;
+ RSCINST aTmpI;
+ ERRTYPE aError;
+ long lNumber;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+//?B 040991
+//?W 040991 sonst Endlosrekursion moeglich
+if( RSC_NOTYPE == pTypeClass->GetTypId() ){
+ aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetNumber( aTmpI, &lNumber );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetNumber( aTmpI, lValue );
+ else {
+ aError.Clear();
+ DeletePos( rInst, pClassData->nEntries -1 );
+ aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetNumber( aTmpI, &lNumber );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetNumber( aTmpI, lValue );
+ }
+ if( aError.IsError() )
+ DeletePos( rInst, pClassData->nEntries -1 );
+}
+else
+ aError = ERR_UNKNOWN_METHOD;
+
+ return( aError );
+}
+
+//==================================================================
+ERRTYPE RscBaseCont::SetBool
+(
+ const RSCINST & rInst,
+ BOOL bValue
+)
+{
+ RscBaseContInst * pClassData;
+ RSCINST aTmpI;
+ ERRTYPE aError;
+ BOOL bBool;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+//?B 040991
+//?W 040991 sonst Endlosrekursion moeglich
+if( RSC_NOTYPE == pTypeClass->GetTypId() )
+{
+ aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetBool( aTmpI, &bBool );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetBool( aTmpI, bValue );
+ else {
+ aError.Clear();
+ DeletePos( rInst, pClassData->nEntries -1 );
+ aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetBool( aTmpI, &bBool );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetBool( aTmpI, bValue );
+ }
+ if( aError.IsError() )
+ DeletePos( rInst, pClassData->nEntries -1 );
+}
+else
+ aError = ERR_UNKNOWN_METHOD;
+
+ return( aError );
+}
+
+//==================================================================
+ERRTYPE RscBaseCont::SetConst
+(
+ const RSCINST & rInst,
+ HASHID nValueId,
+ long lValue
+)
+{
+ RscBaseContInst * pClassData;
+ RSCINST aTmpI;
+ ERRTYPE aError;
+ HASHID nConst;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+//?B 040991
+//?W 040991 sonst Endlosrekursion moeglich
+if( RSC_NOTYPE == pTypeClass->GetTypId() ){
+ aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetConst( aTmpI, &nConst );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue );
+ else {
+ aError.Clear();
+ DeletePos( rInst, pClassData->nEntries -1 );
+ aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetConst( aTmpI, &nConst );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetConst( aTmpI, nValueId, lValue );
+ }
+ if( aError.IsError() )
+ DeletePos( rInst, pClassData->nEntries -1 );
+}
+else
+ aError = ERR_UNKNOWN_METHOD;
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::SetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 02.12.91
+|* Letzte Aenderung MM 02.12.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::SetRef( const RSCINST & rInst, const RscId & rRefId ){
+ RscBaseContInst * pClassData;
+ RSCINST aTmpI;
+ ERRTYPE aError;
+ RscId aId;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+//?B 040991
+//?W 040991 sonst Endlosrekursion moeglich
+if( RSC_NOTYPE == pTypeClass->GetTypId() ){
+ aError = GetElement( rInst, RscId(), pTypeClass, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetRef( aTmpI, &aId );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetRef( aTmpI, rRefId );
+ else {
+ aError.Clear();
+ DeletePos( rInst, pClassData->nEntries -1 );
+ aError = GetElement( rInst, RscId(), pTypeClass1, RSCINST(), &aTmpI );
+ aError = aTmpI.pClass->GetRef( aTmpI, &aId );
+ if( aError.IsOk() )
+ aError = aTmpI.pClass->SetNumber( aTmpI, rRefId );
+ }
+ if( aError.IsError() )
+ DeletePos( rInst, pClassData->nEntries -1 );
+}
+else
+ aError = ERR_UNKNOWN_METHOD;
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::IsConsistent()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.09.91
+|* Letzte Aenderung MM 23.09.91
+|*
+*************************************************************************/
+BOOL RscBaseCont::IsConsistent( const RSCINST & rInst, RscInconsList * pList ){
+ USHORT i;
+ RscBaseContInst * pClassData;
+ BOOL bRet;
+
+ bRet = RscTop::IsConsistent( rInst, pList );
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ // auf doppelten Id Testen und Reihenfolge beibehalten
+ // Komplexitaet = n^2 / 2
+ for( i = 0; i < pClassData->nEntries; i++ ){
+ if( !bNoId ){
+ if( (long)pClassData->pEntries[ i ].aName > 0x7FFF
+ || (long)pClassData->pEntries[ i ].aName < 1 ){
+ bRet = FALSE;
+ if( pList )
+ pList->Insert( new RscInconsistent(
+ pClassData->pEntries[ i ].aName,
+ pClassData->pEntries[ i ].aName ) );
+ }
+ else if( SearchElePos( rInst, pClassData->pEntries[ i ].aName,
+ pClassData->pEntries[ i ].aInst.pClass, i +1 ).IsInst() )
+ {
+ bRet = FALSE;
+ if( pList )
+ pList->Insert( new RscInconsistent(
+ pClassData->pEntries[ i ].aName,
+ pClassData->pEntries[ i +1 ].aName ) );
+ };
+ }
+ if( ! pClassData->pEntries[ i ].aInst.pClass->
+ IsConsistent( pClassData->pEntries[ i ].aInst, pList ) )
+ bRet = FALSE;
+ };
+
+ return( bRet );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::SetToDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+void RscBaseCont::SetToDefault( const RSCINST & rInst )
+{
+ USHORT i;
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ for( i = 0; i < pClassData->nEntries; i++ )
+ {
+ pClassData->pEntries[ i ].aInst.pClass->
+ SetToDefault( pClassData->pEntries[ i ].aInst );
+ };
+
+ RscTop::SetToDefault( rInst );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::IsDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+BOOL RscBaseCont::IsDefault( const RSCINST & rInst ){
+ USHORT i;
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( !pClassData->bDflt )
+ return FALSE;
+
+ for( i = 0; i < pClassData->nEntries; i++ ){
+ if( ! pClassData->pEntries[ i ].aInst.pClass->
+ IsDefault( pClassData->pEntries[ i ].aInst ) )
+ {
+ return( FALSE );
+ };
+ };
+
+ return( RscTop::IsDefault( rInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 15.01.92
+|*
+*************************************************************************/
+BOOL RscBaseCont::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
+{
+ RscBaseContInst * pClassData;
+
+ if( !RscTop::IsValueDefault( rInst, pDef ) )
+ return FALSE;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( pClassData->nEntries )
+ return FALSE;
+ else
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::Delete()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.06.91
+|* Letzte Aenderung MM 12.06.91
+|*
+*************************************************************************/
+void RscBaseCont::Delete( const RSCINST & rInst, RscTop * pClass,
+ const RscId & rId )
+{
+ USHORT i;
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+ if( !pClass )
+ pClass = pTypeClass;
+
+ for( i = 0; i < pClassData->nEntries; i++ ){
+ if( pClassData->pEntries[ i ].aName == rId )
+ if( pClassData->pEntries[ i ].aInst.pClass == pClass || !pClass ){
+ DeletePos( rInst, i );
+ return;
+ };
+ };
+
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::DeletePos()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.06.91
+|* Letzte Aenderung MM 12.06.91
+|*
+*************************************************************************/
+void RscBaseCont::DeletePos( const RSCINST & rInst, USHORT nPos ){
+ RscBaseContInst * pClassData;
+ USHORT i;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ if( nPos < pClassData->nEntries ){
+ if( 1 == pClassData->nEntries )
+ DestroyElements( pClassData );
+ else{
+ pClassData->pEntries[ nPos ].Destroy();
+ pClassData->nEntries--;
+ for( i = nPos; i < pClassData->nEntries; i++ )
+ pClassData->pEntries[ i ] = pClassData->pEntries[ i + 1 ];
+ };
+ };
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::ContWriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+void RscBaseCont::ContWriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const char * pVarName )
+{
+ USHORT i, t;
+ RscBaseContInst * pClassData;
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ for( i = 0; i < pClassData->nEntries; i++ )
+ {
+ for( t = 0; t < nTab; t++ )
+ fputc( '\t', fOutput );
+ pClassData->pEntries[ i ].aInst.pClass->
+ WriteSrcHeader( pClassData->pEntries[ i ].aInst,
+ fOutput, pTC, nTab,
+ pClassData->pEntries[ i ].aName, pVarName );
+ fprintf( fOutput, ";\n" );
+ };
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::ContWriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::ContWriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ USHORT i;
+ RscBaseContInst * pClassData;
+ ERRTYPE aError;
+
+ if( bExtra || bNoId )
+ { // Nur Subresourcen schreiben, wenn bExtra == TRUE
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ ){
+ aError = pClassData->pEntries[ i ].aInst.pClass->
+ WriteRcHeader( pClassData->pEntries[ i ].aInst,
+ rMem, pTC,
+ pClassData->pEntries[ i ].aName,
+ nDeep, bExtra );
+ }
+ }
+
+ return( aError );
+}
+
+//==================================================================
+void RscBaseCont::ContWriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName,
+ BOOL bWriteSize
+)
+{
+ if( (bNoId || bWriteSize) && !pTypeClass1 )
+ {
+ fprintf( fOutput, "\t\tUSHORT nItems = *(USHORT *)(pResData+nOffset) );\n" );
+ fprintf( fOutput, "\t\tnOffset += sizeof( USHORT );\n" );
+
+ fprintf( fOutput, "\t\t// Items hinzufuegen\n" );
+ fprintf( fOutput, "\t\tfor( USHORT i = 0; i < nItems; i++ )\n" );
+ fprintf( fOutput, "\t\t{\n" );
+ pTypeClass->WriteRcAccess( fOutput, pTC, "Item" );
+ fprintf( fOutput, "\t\t}\n" );
+ }
+ else
+ {
+ fprintf( fOutput, "\t\tSet%s( %s ", pName, pHS->Get( GetId() ) );
+ fprintf( fOutput, "%s ", aCallPar2.GetBuffer() );
+ fprintf( fOutput, "ResId( (RSHEADER_TYPE*)(pResData+nOffset) ) ) );\n" );
+ fprintf( fOutput, "\t\tnOffset += GetObjSizeRes( (RSHEADER_TYPE*)(pResData+nOffset) );\n" );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* RscBaseCont::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+void RscBaseCont::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const char * pVarName )
+{
+ RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+ ContWriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ ERRTYPE aError;
+
+ aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+ if( aError.IsOk() )
+ aError = ContWriteRc( rInst, rMem, pTC, nDeep, bExtra );
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::WriteHxx()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::WriteHxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rRscId )
+{
+ USHORT i;
+ RscBaseContInst * pClassData;
+ ERRTYPE aError;
+
+ aError = RscTop::WriteHxx( rInst, fOutput, pTC, rRscId );
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ )
+ {
+ if( pClassData->pEntries[ i ].aName.IsId()
+ && pClassData->pEntries[ i ].aInst.pClass->IsCodeWriteable() )
+ {
+ aError = pClassData->pEntries[ i ].aInst.pClass->
+ WriteHxx( pClassData->pEntries[ i ].aInst,
+ fOutput, pTC,
+ pClassData->pEntries[ i ].aName );
+ }
+ };
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscBaseCont::WriteCxx()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+ERRTYPE RscBaseCont::WriteCxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rRscId )
+{
+ USHORT i;
+ RscBaseContInst * pClassData;
+ ERRTYPE aError;
+
+ aError = RscTop::WriteCxx( rInst, fOutput, pTC, rRscId );
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ for( i = 0; i < pClassData->nEntries && aError.IsOk(); i++ )
+ {
+ if( pClassData->pEntries[ i ].aName.IsId()
+ && pClassData->pEntries[ i ].aInst.pClass->IsCodeWriteable() )
+ {
+ aError = pClassData->pEntries[ i ].aInst.pClass->
+ WriteCxx( pClassData->pEntries[ i ].aInst,
+ fOutput, pTC,
+ pClassData->pEntries[ i ].aName );
+ }
+ };
+
+ return( aError );
+}
+
+/*************** R s c C o n t W r i t e S r c ***************************/
+/*************************************************************************
+|*
+|* RscContWriteSrc::RscContWriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+RscContWriteSrc::RscContWriteSrc( HASHID nId, USHORT nTypeId,
+ RscTop * pSuper, BOOL bNoIdent )
+ : RscBaseCont( nId, nTypeId, pSuper, bNoIdent )
+{}
+
+/*************************************************************************
+|*
+|* RscContWriteSrc::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+void RscContWriteSrc::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const char * pVarName )
+{
+ USHORT i;
+
+ RscTop::WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+
+ fprintf( fOutput, "\n" );
+ for( i = 0; i < nTab; i++ )
+ fputc( '\t', fOutput );
+ fprintf( fOutput, "{\n" );
+
+ ContWriteSrc( rInst, fOutput, pTC, nTab +1, pVarName );
+
+ for( i = 0; i < nTab; i++ )
+ fputc( '\t', fOutput );
+ fprintf( fOutput, "}" );
+}
+
+/*************** R s c C o n t *******************************************/
+/*************************************************************************
+|*
+|* RscCont::RscCont()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+RscCont::RscCont( HASHID nId, USHORT nTypeId, RscTop * pSuper, BOOL bNoIdent )
+ : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent )
+{}
+
+/*************************************************************************
+|*
+|* RscCont::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+ERRTYPE RscCont::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ RscBaseContInst * pClassData;
+ ERRTYPE aError;
+
+ aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+
+ pClassData = (RscBaseContInst *)(rInst.pData + nOffInstData);
+
+ rMem.Put( pClassData->nEntries );
+
+ if( aError.IsOk() )
+ aError = ContWriteRc( rInst, rMem, pTC, nDeep, bExtra );
+
+ return aError;
+}
+
+//==================================================================
+void RscCont::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ ContWriteRcAccess( fOutput, pTC, pName, TRUE );
+}
+
+/*************************************************************************
+|*
+|* RscContExtraData::RscContExtraData()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+RscContExtraData::RscContExtraData( HASHID nId, USHORT nTypeId,
+ RscTop * pSuper, BOOL bNoIdent )
+ : RscContWriteSrc( nId, nTypeId, pSuper, bNoIdent )
+{}
+
+/*************************************************************************
+|*
+|* RscContExtraData::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.05.91
+|* Letzte Aenderung MM 08.05.91
+|*
+*************************************************************************/
+ERRTYPE RscContExtraData::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ ERRTYPE aError;
+
+ if( bExtra )
+ aError = RscContWriteSrc::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+ else
+ aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+
+ return aError;
+}
diff --git a/rsc/source/res/rscflag.cxx b/rsc/source/res/rscflag.cxx
new file mode 100644
index 000000000000..b246b5a46fd7
--- /dev/null
+++ b/rsc/source/res/rscflag.cxx
@@ -0,0 +1,531 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscflag.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscflag.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+*************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Programmabh„ngige Includes.
+#ifndef _RSCFLAG_HXX
+#include <rscflag.hxx>
+#endif
+
+/****************** C O D E **********************************************/
+/****************** R s c F l a g ****************************************/
+/*************************************************************************
+|*
+|* RscFlag::RscFlag()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RscFlag::RscFlag( HASHID nId, USHORT nTypeId, BOOL bUSHORT_ )
+ : RscConst( nId, nTypeId )
+ , bUSHORT( bUSHORT_ )
+{}
+
+/*************************************************************************
+|*
+|* RscFlag::Size()
+|*
+|* Beschreibung Die Groeáe der Instanzdaten richtet sich nach
+|* der Anzahl der Flags
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+USHORT RscFlag::Size()
+{
+ return( ALIGNED_SIZE( sizeof( RscFlagInst ) *
+ ( 1 + (nEntries -1) / (sizeof( USHORT ) * 8) ) ) );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::SetNotConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, HASHID nConst ){
+ USHORT i, nFlag;
+
+ if( nEntries != (i = GetConstPos( nConst )) ){
+ nFlag = 1 << (i % (sizeof( USHORT ) * 8) );
+ i = i / (sizeof( USHORT ) * 8);
+ ((RscFlagInst *)rInst.pData)[ i ].nFlags &= ~nFlag;
+ ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag;
+ return( ERR_OK );
+ };
+
+ return( ERR_RSCFLAG );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::SetConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+ERRTYPE RscFlag::SetConst( const RSCINST & rInst, HASHID nConst, long nVal )
+{
+ USHORT i, nFlag;
+
+ if( nEntries != (i = GetConstPos( nConst )) ){
+ nFlag = 1 << (i % (sizeof( USHORT ) * 8) );
+ i = i / (sizeof( USHORT ) * 8);
+ ((RscFlagInst *)rInst.pData)[ i ].nFlags |= nFlag;
+ ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag;
+ return( ERR_OK );
+ };
+
+ return( ERR_RSCFLAG );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::CreateBasic()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.01.92
+|* Letzte Aenderung MM 16.01.92
+|*
+*************************************************************************/
+RSCINST RscFlag::CreateBasic( RSCINST * pInst )
+{
+ RSCINST aInst;
+
+ if( !pInst ){
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() );
+ }
+ else
+ aInst = *pInst;
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 16.01.92
+|*
+*************************************************************************/
+RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){
+ RSCINST aInst = CreateBasic( pInst );
+ USHORT i;
+
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ if( bOwnClass )
+ memmove( aInst.pData, rDflt.pData, Size() );
+ else
+ {
+ for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
+ {
+ ((RscFlagInst *)aInst.pData)[ i ].nFlags = 0;
+ ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags = 0xFFFF;
+ }
+ };
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::CreateClient()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.01.92
+|* Letzte Aenderung MM 16.01.92
+|*
+*************************************************************************/
+RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI,
+ BOOL bOwnClass, HASHID nConstId )
+{
+ RSCINST aInst = CreateBasic( pInst );
+ USHORT i, nFlag;
+
+ if( !bOwnClass && rDfltI.IsInst() )
+ bOwnClass = rDfltI.pClass->InHierarchy( this );
+
+ if( nEntries != (i = GetConstPos( nConstId )) ){
+ nFlag = 1 << (i % (sizeof( USHORT ) * 8) );
+ i = i / (sizeof( USHORT ) * 8);
+ if( bOwnClass ){
+ ((RscFlagInst *)aInst.pData)[ i ].nFlags &=
+ ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nFlags;
+ ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags &=
+ ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nDfltFlags;
+ }
+ else{
+ ((RscFlagInst *)aInst.pData)[ i ].nFlags &= ~nFlag;
+ ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags |= nFlag;
+ }
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::SetToDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+void RscFlag::SetToDefault( const RSCINST & rInst )
+{
+ USHORT i;
+
+ for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
+ ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags = 0xFFFF;
+}
+
+/*************************************************************************
+|*
+|* RscFlag::IsDlft()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+BOOL RscFlag::IsDefault( const RSCINST & rInst )
+{
+ USHORT i;
+
+ for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
+ if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags != 0xFFFF )
+ return( FALSE );
+ return( TRUE );
+}
+
+BOOL RscFlag::IsDefault( const RSCINST & rInst, HASHID nConstId )
+{
+ USHORT i, nFlag;
+
+ if( nEntries != (i = GetConstPos( nConstId )) ){
+ nFlag = 1 << (i % (sizeof( USHORT ) * 8) );
+ i = i / (sizeof( USHORT ) * 8);
+ if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags & nFlag )
+ return( TRUE );
+ else
+ return( FALSE );
+ };
+ return( TRUE );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+BOOL RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef,
+ HASHID nConstId )
+{
+ USHORT i, nFlag;
+
+ if( nEntries != (i = GetConstPos( nConstId )) ){
+ nFlag = 1 << (i % (sizeof( USHORT ) * 8) );
+ i = i / (sizeof( USHORT ) * 8);
+
+ if( pDef ){
+ if( (((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag)
+ == (((RscFlagInst *)pDef)[ i ].nFlags & nFlag) )
+ {
+ return TRUE;
+ }
+ }
+ };
+
+ return FALSE;
+}
+
+BOOL RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
+ USHORT i;
+
+ if( pDef ){
+ USHORT Flag, nIndex;
+
+ Flag = 1;
+ for( i = 0; i < nEntries; i++ ){
+ nIndex = i / (sizeof( USHORT ) * 8);
+ if( (((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag)
+ != (((RscFlagInst *)pDef)[ nIndex ].nFlags & Flag) )
+ {
+ return FALSE;
+ }
+ Flag <<= 1;
+ if( !Flag )
+ Flag = 1;
+ };
+ }
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscFlag::IsSet()
+|*
+|* Beschreibung
+|* Ersterstellung MM 10.04.91
+|* Letzte Aenderung MM 10.04.91
+|*
+*************************************************************************/
+BOOL RscFlag::IsSet( const RSCINST & rInst, HASHID nConstId ){
+ USHORT i, nFlag;
+
+ if( nEntries != (i = GetConstPos( nConstId )) ){
+ nFlag = 1 << (i % (sizeof( USHORT ) * 8) );
+ i = i / (sizeof( USHORT ) * 8);
+ if( ((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag )
+ return( TRUE );
+ else
+ return( FALSE );
+ };
+ return( TRUE );
+}
+
+/*************************************************************************
+|*
+|* RscFlag::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscFlag::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ USHORT i, Flag, nIndex;
+ BOOL bComma = FALSE;
+
+ Flag = 1;
+ for( i = 0; i < nEntries; i++ ){
+ nIndex = i / (sizeof( USHORT ) * 8);
+ if( !( ((RscFlagInst *)rInst.pData)[ nIndex ].nDfltFlags & Flag) ){
+ if( bComma )
+ fprintf( fOutput, ", " );
+ if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag )
+ fprintf( fOutput, "%s", pHS->Get( pVarArray[ i ].nId ) );
+ else{
+ fprintf( fOutput, "not " );
+ fprintf( fOutput, "%s", pHS->Get( pVarArray[ i ].nId ) );
+ }
+ bComma = TRUE;
+ }
+ Flag <<= 1;
+ if( !Flag )
+ Flag = 1;
+ };
+}
+
+/*************************************************************************
+|*
+|* RscFlag::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont *, USHORT, BOOL )
+{
+ INT32 lVal = 0;
+ USHORT i, Flag, nIndex;
+
+ Flag = 1;
+ for( i = 0; i < nEntries; i++ ){
+ nIndex = i / (sizeof( USHORT ) * 8);
+ if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag )
+ lVal |= pVarArray[ i ].lValue;
+
+ Flag <<= 1;
+ if( !Flag )
+ Flag = 1;
+ };
+
+ if( bUSHORT )
+ aMem.Put( (USHORT)lVal );
+ else
+ aMem.Put( (INT32)lVal );
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscClient::RscClient()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+RscClient::RscClient( HASHID nId, USHORT nTypeId, RscFlag * pClass,
+ HASHID nConstantId )
+ : RscTop ( nId, nTypeId )
+{
+ pRefClass = pClass;
+ nConstId = nConstantId;
+}
+
+/*************************************************************************
+|*
+|* RscClient::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscClient::GetClassType() const
+{
+ return RSCCLASS_BOOL;
+}
+
+/*************************************************************************
+|*
+|* RscClient::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscClient::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ if( pRefClass->IsSet( rInst, nConstId ) )
+ fprintf( fOutput, "TRUE" );
+ else
+ fprintf( fOutput, "FALSE" );
+}
+
+/*************************************************************************
+|*
+|* RscClient::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+RSCINST RscClient::Create( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass )
+{
+ RSCINST aTmpI, aDfltI;
+
+ if( pInst ){
+ aTmpI.pClass = pRefClass;
+ aTmpI.pData = pInst->pData;
+ }
+
+ if( !bOwnClass && rDflt.IsInst() ){
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+ if( bOwnClass ){
+ aDfltI.pClass = pRefClass;
+ aDfltI.pData = rDflt.pData;
+ }
+ }
+
+ if( pInst )
+ aTmpI = pRefClass->CreateClient( &aTmpI, aDfltI,
+ bOwnClass, nConstId );
+ else
+ aTmpI = pRefClass->CreateClient( NULL, aDfltI,
+ bOwnClass, nConstId );
+ aTmpI.pClass = this;
+
+ return( aTmpI );
+}
+
diff --git a/rsc/source/res/rscmgr.cxx b/rsc/source/res/rscmgr.cxx
new file mode 100644
index 000000000000..4ad36873727f
--- /dev/null
+++ b/rsc/source/res/rscmgr.cxx
@@ -0,0 +1,778 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscmgr.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.21 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.20 2000/07/26 17:13:22 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.19 2000/07/12 11:38:32 th
+ Unicode
+
+ Revision 1.18 1999/09/20 17:26:04 pl
+ PutAt with short
+
+ Revision 1.17 1999/09/08 09:24:59 mm
+ BigEndian/LittleEndian komplett durchgezogen
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+// Programmabhaengige Includes.
+#ifndef _RSCMGR_HXX
+#include <rscmgr.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+
+/****************** C O D E **********************************************/
+/****************** R s c M g r ******************************************/
+/*************************************************************************
+|*
+|* RscMgr::RscMgr()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+RscMgr::RscMgr( HASHID nId, USHORT nTypeId, RscTop * pSuperCl )
+ : RscClass( nId, nTypeId, pSuperCl )
+{
+}
+
+/*************************************************************************
+|*
+|* RscMgr::Size()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+USHORT RscMgr::Size()
+{
+ return RscClass::Size() + ALIGNED_SIZE( sizeof( RscMgrInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscMgr::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RSCINST RscMgr::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){
+ RSCINST aInst;
+ RscMgrInst * pClassData;
+
+ if( !pInst ){
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA) RscMem::Malloc( Size() );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ RscClass::Create( &aInst, rDflt, bOwnClass );
+
+ pClassData = (RscMgrInst *)(aInst.pData + RscClass::Size() );
+ pClassData->Create();
+
+ if( bOwnClass ){
+ RscMgrInst * pDfltData = (RscMgrInst *)(rDflt.pData + RscClass::Size());
+ *pClassData = *pDfltData;
+ };
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscMgr::Destroy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 21.06.91
+|* Letzte Aenderung MM 21.06.91
+|*
+*************************************************************************/
+void RscMgr::Destroy( const RSCINST & rInst ){
+ RscMgrInst * pClassData;
+
+ RscClass::Destroy( rInst );
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+ pClassData->Destroy();
+}
+
+/*************************************************************************
+|*
+|* RscMgr::SetToDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.06.91
+|* Letzte Aenderung MM 12.06.91
+|*
+*************************************************************************/
+void RscMgr::SetToDefault( const RSCINST & rInst )
+{
+ RscMgrInst * pClassData;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+ pClassData->bDflt = TRUE;
+
+ RscClass::SetToDefault( rInst );
+}
+
+/*************************************************************************
+|*
+|* RscMgr::IsDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.06.91
+|* Letzte Aenderung MM 12.06.91
+|*
+*************************************************************************/
+BOOL RscMgr::IsDefault( const RSCINST & rInst ){
+ RscMgrInst * pClassData;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+ if( !pClassData->bDflt )
+ return( FALSE );
+
+ return( RscClass::IsDefault( rInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscMgr::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.06.91
+|* Letzte Aenderung MM 12.06.91
+|*
+*************************************************************************/
+BOOL RscMgr::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
+ RscMgrInst * pClassData;
+ RscMgrInst * pDfltData;
+
+ if( !RscClass::IsValueDefault( rInst, pDef ) )
+ return FALSE;
+
+ if( pDef ){
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+ pDfltData = (RscMgrInst *)(pDef + RscClass::Size());
+
+ if( !pClassData->aRefId.IsId() && !pDfltData->aRefId.IsId() ){
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+/*************************************************************************
+|*
+|* RscMgr::WriteSrcHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscMgr::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & rId, const char * pVarName )
+{
+ RscMgrInst * pClassData;
+ USHORT i;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+
+ fprintf( fOutput, "%s %s",
+ pHS->Get( rInst.pClass->GetId() ),
+ (rId.GetName()).GetBuffer() );
+ if( pClassData->aRefId.IsId() )
+ fprintf( fOutput, ",%s", pClassData->aRefId.GetName().GetBuffer() );
+ else
+ {
+ fprintf( fOutput, "\n" );
+ for( i = 0; i < nTab; i++ )
+ fputc( '\t', fOutput );
+ fprintf( fOutput, "{\n" );
+
+ rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab +1, pVarName );
+
+ RscClass::WriteSrc( rInst, fOutput, pTC, nTab +1, pVarName);
+
+ for( i = 0; i < nTab; i++ )
+ fputc( '\t', fOutput );
+ fprintf( fOutput, "}" );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscMgr::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscMgr::WriteSrc( const RSCINST &, FILE *, RscTypCont *, USHORT,
+ const char * )
+{
+}
+
+/*************************************************************************
+|*
+|* RscMgr::WriteRcHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, const RscId &rId,
+ USHORT nDeep, BOOL bExtra )
+{
+ RscMgrInst * pClassData;
+ ERRTYPE aError;
+ ObjNode * pObjNode = NULL;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+
+ if( pClassData->aRefId.IsId() )
+ {
+ //Erhoehen und abfragen um Endlosrekusion zu vermeiden
+ nDeep++;
+ if( nDeep > nRefDeep )
+ aError = ERR_REFTODEEP;
+ else
+ pObjNode = rInst.pClass->GetRefClass()->
+ GetObjNode( pClassData->aRefId );
+ if( !pObjNode && pTC )
+ {
+ ByteString aMsg( pHS->Get( rInst.pClass->GetId() ) );
+ aMsg += ' ';
+ aMsg += pClassData->aRefId.GetName();
+ aError = WRN_MGR_REFNOTFOUND;
+ pTC->pEH->Error( aError, rInst.pClass, rId, aMsg.GetBuffer() );
+ }
+ }
+
+ if( aError.IsOk() )
+ {
+ if( pObjNode )
+ {
+ RSCINST aRefI;
+ RscTop * pTmpRefClass = rInst.pClass->GetRefClass();
+
+ aRefI = RSCINST( rInst.pClass, pObjNode->GetRscObj() );
+ if( pTmpRefClass == rInst.pClass )
+ {
+ aError = aRefI.pClass->WriteRcHeader( aRefI, rMem, pTC,
+ rId, nDeep, bExtra );
+ }
+ else
+ {
+ RSCINST aRefInst = rInst.pClass->Create( NULL, aRefI );
+ aError = aRefI.pClass->WriteRcHeader( aRefInst, rMem, pTC,
+ rId, nDeep, bExtra );
+ pTmpRefClass->Destroy( aRefInst );
+ }
+ }
+ else
+ {
+ USHORT nOldSize;
+ USHORT nLocalSize;
+
+ nOldSize = rMem.IncSize( 8 /*sizeof( RSHEADER_TYPE )*/ );
+
+ aError = rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+ if( aError.IsOk() )
+ aError = WriteInstRc( rInst, rMem, pTC, nDeep, bExtra );
+ nLocalSize = rMem.Size();
+
+ if( aError.IsOk() )
+ {
+ // RscClass wird uebersprungen
+ aError = RscTop::WriteRc( rInst, rMem, pTC, nDeep, bExtra );
+ };
+
+ /*
+ // Definition der Struktur, aus denen die Resource aufgebaut ist
+ struct RSHEADER_TYPE{
+ RESOURCE_TYPE nRT; // Resource Typ
+ USHORT nRT; // Resource Typ
+ USHORT nGlobOff; // Globaler Offset
+ USHORT nLocalOff; // Lokaler Offset
+ };
+ */
+ USHORT nID = rId;
+ rMem.PutAt( nOldSize, nID );
+ rMem.PutAt( nOldSize +2, (USHORT)rInst.pClass->GetTypId() );
+ rMem.PutAt( nOldSize +4, (USHORT)(rMem.Size() - nOldSize) );
+ rMem.PutAt( nOldSize +6, (USHORT)(nLocalSize - nOldSize) );
+ };
+ };
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscMgr::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.04.91
+|* Letzte Aenderung MM 26.04.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::WriteRc( const RSCINST &, RscWriteRc &,
+ RscTypCont *, USHORT, BOOL )
+
+{
+ return( ERR_OK );
+}
+
+
+static ByteString MakeSmartName( const ByteString & rDefName )
+{
+ ByteString aSmartName;
+ if( rDefName.Len() )
+ {
+ char * pStr = (char *)rDefName.GetBuffer();
+ aSmartName = (char)toupper( *pStr );
+ while( *++pStr )
+ {
+ if( '_' == *pStr )
+ {
+ if( *++pStr )
+ aSmartName += (char)toupper( *pStr );
+ else
+ break;
+ }
+ else
+ aSmartName += (char)tolower( *pStr );
+ }
+ }
+ return aSmartName;
+}
+
+static ByteString MakeName( RscTypCont * pTypCon, RscTop * pClass,
+ const ByteString & rName )
+{
+ ByteString aRet;
+ if( !pTypCon->IsSmart() || isdigit( rName.GetChar(0) ) )
+ {
+ aRet += pHS->Get( pClass->GetId() );
+ aRet += rName;
+ }
+ else
+ aRet += MakeSmartName( rName );
+ return aRet;
+}
+
+/*************************************************************************
+|*
+|* RscMgr::WriteHxxHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::WriteHxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId &rId )
+{
+ RscMgrInst * pClassData;
+ ERRTYPE aError;
+ ObjNode * pObjNode = NULL;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+
+ if( pClassData->aRefId.IsId() )
+ {
+ pObjNode = rInst.pClass->GetObjNode( pClassData->aRefId );
+ if( !pObjNode && pTC )
+ {
+ ByteString aMsg( pHS->Get( rInst.pClass->GetId() ) );
+ aMsg += ' ';
+ aMsg += pClassData->aRefId.GetName();
+ aError = WRN_MGR_REFNOTFOUND;
+ pTC->pEH->Error( aError, rInst.pClass, rId, aMsg.GetBuffer() );
+ }
+ }
+
+ if( pObjNode )
+ {
+ RSCINST aRefI;
+
+ aRefI = RSCINST( rInst.pClass, pObjNode->GetRscObj() );
+ aError = aRefI.pClass->WriteHxxHeader( aRefI, fOutput, pTC,
+ rId );
+ }
+ else
+ {
+ fprintf( fOutput, "class %s",
+ MakeName( pTC, rInst.pClass,
+ rId.GetName() ).GetBuffer() );
+ fprintf( fOutput, " : public %s",
+ pHS->Get( rInst.pClass->GetId() ) );
+ fprintf( fOutput, "\n{\nprotected:\n" );
+
+ aError = RscClass::WriteHxx( rInst, fOutput, pTC, rId );
+
+ RSCINST aExtraInst = rInst.pClass->GetCopyVar( rInst, nRsc_EXTRADATA );
+ if( aExtraInst.IsInst() )
+ {
+ if( aExtraInst.pClass->GetCount( aExtraInst ) )
+ fprintf( fOutput, " char * pExtraData;\n" );
+ }
+ if( aError.IsOk() )
+ {
+ fprintf( fOutput, "public:\n " );
+ fprintf( fOutput, "%s%s bFreeRes = TRUE )",
+ MakeName( pTC, rInst.pClass,
+ rId.GetName() ).GetBuffer(),
+ (rInst.pClass->aCallParType).GetBuffer() );
+ fprintf( fOutput, ";\n};\n\n" );
+ }
+ };
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscMgr::WriteHxx()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::WriteHxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId )
+{
+ fprintf( fOutput, " %s", pHS->Get( rInst.pClass->GetId() ) );
+ fprintf( fOutput, " a%s;\n",
+ MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer() );
+
+ return ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* RscClass::WriteCxxHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::WriteCxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId )
+{
+ RscMgrInst * pClassData;
+ ERRTYPE aError;
+ ObjNode * pObjNode = NULL;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+
+ if( pClassData->aRefId.IsId() )
+ {
+ pObjNode = rInst.pClass->GetObjNode( pClassData->aRefId );
+ if( !pObjNode && pTC )
+ {
+ ByteString aMsg( pHS->Get( rInst.pClass->GetId() ) );
+ aMsg += ' ';
+ aMsg += pClassData->aRefId.GetName();
+ aError = WRN_MGR_REFNOTFOUND;
+ pTC->pEH->Error( aError, rInst.pClass, rId, aMsg.GetBuffer() );
+ }
+ }
+
+ if( pObjNode )
+ {
+ RSCINST aRefI;
+
+ aRefI = RSCINST( rInst.pClass, pObjNode->GetRscObj() );
+ aError = aRefI.pClass->WriteCxxHeader( aRefI, fOutput, pTC,
+ rId );
+ }
+ else
+ {
+ fprintf( fOutput, "%s::%s",
+ MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer(),
+ MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer() );
+ fprintf( fOutput, "%s", (rInst.pClass->aCallParType).GetBuffer() );
+ if( GetCount( rInst ) )
+ fprintf( fOutput, " bFreeRes" );
+ fprintf( fOutput, " )\n : %s", pHS->Get( rInst.pClass->GetId() ) );
+ fprintf( fOutput, "%s", (rInst.pClass->aCallPar1).GetBuffer() );
+ fprintf( fOutput, " rResId )" );
+
+ aError = RscClass::WriteCxx( rInst, fOutput, pTC, rId );
+
+ fprintf( fOutput, "\n{\n" );
+ RSCINST aExtraInst = rInst.pClass->GetCopyVar( rInst, nRsc_EXTRADATA );
+ if( aExtraInst.IsInst() )
+ {
+ if( aExtraInst.pClass->GetCount( aExtraInst ) )
+ {
+ fprintf( fOutput, " //read extra data\n" );
+ fprintf( fOutput, " pExtraData = new char "
+ "[ GetRemainSizeRes() ];\n" );
+ fprintf( fOutput, " memcpy( pExtraData, "
+ "GetClassRes(), GetRemainSizeRes() );\n" );
+ fprintf( fOutput, " IncrementRes( GetRemainSizeRes() );\n" );
+ }
+ }
+
+ if( GetCount( rInst ) )
+ { // Es gibt UnterResourcen
+ fprintf( fOutput, " if( bFreeRes ) FreeResource();\n" );
+ }
+ else
+ {
+ fprintf( fOutput,
+ " // No subresources, automatic free resource\n" );
+ }
+ fprintf( fOutput, "}\n\n" );
+ }
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscClass::WriteCxx()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::WriteCxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId )
+{
+ const char * pName = rId.GetName().GetBuffer();
+ fprintf( fOutput, ",\n a%s",
+ MakeName( pTC, rInst.pClass, rId.GetName() ).GetBuffer() );
+ fprintf( fOutput, "%s", (rInst.pClass->aCallPar2).GetBuffer() );
+ fprintf( fOutput, " ResId( %s ) )", (rId.GetName()).GetBuffer() );
+
+ return ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* RscArray::IsConsistent()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.09.91
+|* Letzte Aenderung MM 23.09.91
+|*
+*************************************************************************/
+BOOL RscMgr::IsConsistent( const RSCINST & rInst, RscInconsList * pList )
+{
+ BOOL bRet;
+ RscMgrInst * pClassData;
+
+ bRet = RscClass::IsConsistent( rInst, pList );
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+ if( pClassData->aRefId.IsId() &&
+ ((pClassData->aRefId.GetNumber() < 1)
+ || (pClassData->aRefId.GetNumber() > 0x7FFF)
+ || IsToDeep( rInst ).IsError()) )
+ {
+ if( pList )
+ pList->Insert(
+ new RscInconsistent( pClassData->aRefId,
+ pClassData->aRefId ) );
+ bRet = FALSE;
+ }
+
+ return( bRet );
+}
+
+/*************************************************************************
+|*
+|* RscMgr::GetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::GetRef( const RSCINST & rInst, RscId * pRscId ){
+ RscMgrInst * pClassData;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+ *pRscId = pClassData->aRefId;
+ return ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* RscMgr::IsToDeep()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::IsToDeep( const RSCINST & rInst, USHORT nDeep )
+{
+ RscMgrInst * pClassData;
+ RscId aOldId, aId;
+ ERRTYPE aError;
+ RSCINST aTmpI = rInst;
+ ObjNode * pObjNode;
+
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+
+ while( aTmpI.IsInst() && (nDeep < nRefDeep) && aError.IsOk() )
+ {
+ // Referenz holen
+ aTmpI.pClass->GetRef( aTmpI, &aId );
+ // Referenziertes Objekt holen
+ pObjNode = aTmpI.pClass->GetObjNode( aId );
+ // Referenzierte Objekt gefunden ?
+ if( pObjNode )
+ {
+ aTmpI.pData = pObjNode->GetRscObj();
+ nDeep++;
+ }
+ else //aTmpI.IsInst() wird FALSE, Schleife beenden
+ aTmpI.pData = NULL;
+ }
+
+ if( nDeep >= nRefDeep )
+ {
+ pClassData->aRefId = aOldId;
+ aError = ERR_REFTODEEP;
+ }
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscMgr::SetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+ERRTYPE RscMgr::SetRef( const RSCINST & rInst, const RscId & rRefId )
+{
+ RscMgrInst * pClassData;
+ RscId aOldId, aId;
+ ERRTYPE aError;
+ RSCINST aTmpI = rInst;
+
+ if( rRefId.IsId() &&
+ ((rRefId.GetNumber() < 1) || (rRefId.GetNumber() > 0x7FFF)) )
+ {
+ aError = ERR_IDRANGE;
+ }
+ else
+ {
+ pClassData = (RscMgrInst *)(rInst.pData + RscClass::Size());
+ aOldId = pClassData->aRefId;// Alten Wert merken
+ pClassData->aRefId = rRefId;// vorher eintragen,
+ // sonst Fehler bei rekursion
+
+
+ aError = IsToDeep( rInst );
+ if( aError.IsOk() )
+ pClassData->bDflt = FALSE;
+ else
+ pClassData->aRefId = aOldId;
+ }
+
+ return( aError );
+}
diff --git a/rsc/source/res/rscrange.cxx b/rsc/source/res/rscrange.cxx
new file mode 100644
index 000000000000..225754f5df1c
--- /dev/null
+++ b/rsc/source/res/rscrange.cxx
@@ -0,0 +1,904 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscrange.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscrange.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+*************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Solar Definitionen
+#include <tools/solar.h>
+
+// Programmabh„ngige Includes.
+#ifndef _RSCRANGE_HXX
+#include <rscrange.hxx>
+#endif
+
+/****************** D E F I N E S ****************************************/
+#define USHORTBITS (sizeof( USHORT ) * 8)
+/****************** C O D E **********************************************/
+/****************** R s c R a n g e **************************************/
+/*************************************************************************
+|*
+|* RscRange::RscRange()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RscRange::RscRange( HASHID nId, USHORT nTypeId )
+ : RscTop( nId, nTypeId )
+{
+ nMin = nMax = 0;
+ nSize = ALIGNED_SIZE( sizeof( RscRangeInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscRange::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscRange::GetClassType() const
+{
+ return RSCCLASS_NUMBER;
+}
+
+/*************************************************************************
+|*
+|* RscRange::SetRange()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+ERRTYPE RscRange::SetRange( long nMinimum, long nMaximum )
+{
+ if( nMinimum > nMaximum )
+ {
+ nMin = nMaximum;
+ nMax = nMinimum;
+ }
+ else
+ {
+ nMax = nMaximum;
+ nMin = nMinimum;
+ };
+
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscRange::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.02.92
+|* Letzte Aenderung MM 15.02.92
+|*
+*************************************************************************/
+BOOL RscRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
+{
+ if( pDef )
+ {
+ if( ((RscRangeInst*)rInst.pData)->nValue ==
+ ((RscRangeInst*)pDef)->nValue )
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscRange::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+ERRTYPE RscRange::SetNumber( const RSCINST & rInst, long nValue )
+{
+ if( nMax < nValue || nMin > nValue )
+ return( ERR_RSCRANGE_OUTDEFSET );
+ ((RscRangeInst *)rInst.pData)->nValue = (USHORT)( nValue - nMin );
+ ((RscRangeInst *)rInst.pData)->bDflt = FALSE;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscRange::GetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.04.91
+|* Letzte Aenderung MM 22.04.91
+|*
+*************************************************************************/
+ERRTYPE RscRange::GetNumber( const RSCINST & rInst, long * pN )
+{
+ *pN = ((RscRangeInst *)rInst.pData)->nValue + nMin;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscRange::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RSCINST RscRange::Create( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass )
+{
+ RSCINST aInst;
+
+ if( !pInst )
+ {
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA)
+ RscMem::Malloc( sizeof( RscRangeInst ) );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ if( bOwnClass )
+ memmove( aInst.pData, rDflt.pData, sizeof( RscRangeInst ) );
+ else
+ {
+ if( 0L >= nMin && 0L <= nMax )
+ ((RscRangeInst *)aInst.pData)->nValue = (USHORT)(0L - nMin);
+ else
+ ((RscRangeInst *)aInst.pData)->nValue = 0;
+ ((RscRangeInst *)aInst.pData)->bDflt = TRUE;
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscRange::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ fprintf( fOutput, "%ld", ((RscRangeInst *)rInst.pData)->nValue + nMin );
+}
+
+/*************************************************************************
+|*
+|* RscRange::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+ERRTYPE RscRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont *, USHORT, BOOL )
+{
+ if( nMin >= 0 )
+ {
+ USHORT n;
+ n = (USHORT)(((RscRangeInst *)rInst.pData)->nValue + nMin);
+ aMem.Put( n );
+ }
+ else
+ {
+ short n;
+ n = (short)(((RscRangeInst *)rInst.pData)->nValue + nMin);
+ aMem.Put( n );
+ }
+
+ return( ERR_OK );
+}
+
+//=======================================================================
+void RscRange::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ fprintf( fOutput, "\t\tSet%s( ", pName );
+ if( nMin >= 0 )
+ fprintf( fOutput, "*(USHORT *)(pResData+nOffset) );\n", pName );
+ else
+ fprintf( fOutput, "*(short *)(pResData+nOffset) );\n", pName );
+ fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" );
+}
+
+/****************** R s c L o n g R a n g e ******************************/
+/*************************************************************************
+|*
+|* RscLongRange::RscLongRange()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.07.94
+|*
+*************************************************************************/
+RscLongRange::RscLongRange( HASHID nId, USHORT nTypeId )
+ : RscTop( nId, nTypeId )
+{
+ nMin = nMax = 0;
+ nSize = ALIGNED_SIZE( sizeof( RscLongRangeInst ) );
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.07.94
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscLongRange::GetClassType() const
+{
+ return RSCCLASS_NUMBER;
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::SetRange()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.07.94
+|*
+*************************************************************************/
+ERRTYPE RscLongRange::SetRange( long nMinimum, long nMaximum )
+{
+ if( nMinimum > nMaximum )
+ {
+ nMin = nMaximum;
+ nMax = nMinimum;
+ }
+ else
+ {
+ nMax = nMaximum;
+ nMin = nMinimum;
+ };
+
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.02.92
+|* Letzte Aenderung MM 15.02.92
+|*
+*************************************************************************/
+BOOL RscLongRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
+{
+ if( pDef )
+ return 0 == memcmp( &((RscLongRangeInst*)rInst.pData)->nValue,
+ &((RscLongRangeInst*)pDef)->nValue,
+ sizeof( long ) );
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.07.94
+|*
+*************************************************************************/
+ERRTYPE RscLongRange::SetNumber( const RSCINST & rInst, long nValue )
+{
+ if( nMax < nValue || nMin > nValue )
+ return( ERR_RSCRANGE_OUTDEFSET );
+ void * pData = &((RscLongRangeInst*)rInst.pData)->nValue;
+ memmove( pData, &nValue, sizeof( long ) );
+ ((RscLongRangeInst *)rInst.pData)->bDflt = FALSE;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::GetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.04.91
+|* Letzte Aenderung MM 22.04.91
+|*
+*************************************************************************/
+ERRTYPE RscLongRange::GetNumber( const RSCINST & rInst, long * pN )
+{
+ memmove( pN, &((RscLongRangeInst*)rInst.pData)->nValue,
+ sizeof( long ) );
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.07.94
+|*
+*************************************************************************/
+RSCINST RscLongRange::Create( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass )
+{
+ RSCINST aInst;
+
+ if( !pInst )
+ {
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA)
+ RscMem::Malloc( sizeof( RscLongRangeInst ) );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ if( bOwnClass )
+ memmove( aInst.pData, rDflt.pData, sizeof( RscLongRangeInst ) );
+ else
+ {
+ long lDflt;
+ if( 0L >= nMin && 0L <= nMax )
+ lDflt = 0;
+ else
+ lDflt = nMin;
+ void * pData = &((RscLongRangeInst*)aInst.pData)->nValue;
+ memmove( pData, &lDflt, sizeof( long ) );
+ ((RscLongRangeInst *)aInst.pData)->bDflt = TRUE;
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.07.94
+|*
+*************************************************************************/
+void RscLongRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ long lVal;
+ GetNumber( rInst, &lVal );
+ fprintf( fOutput, "%ld", lVal );
+}
+
+/*************************************************************************
+|*
+|* RscLongRange::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.07.94
+|* Letzte Aenderung MM 18.04.94
+|*
+*************************************************************************/
+ERRTYPE RscLongRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont *, USHORT, BOOL )
+{
+ long lVal;
+
+ GetNumber( rInst, &lVal );
+ aMem.Put( (INT32)lVal );
+
+ return( ERR_OK );
+}
+
+//=======================================================================
+void RscLongRange::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ fprintf( fOutput, "\t\tSet%s( ", pName );
+ fprintf( fOutput, "GetLong( pResData+nOffset ) );\n", pName );
+ fprintf( fOutput, "\t\tnOffset += sizeof( INT32 );\n" );
+}
+
+/****************** R s c L o n g E n u m R a n g e *********************/
+/*************************************************************************
+|* RscLongEnumRange::RscLongEnumRange()
+|*
+|* Beschreibung
+*************************************************************************/
+RscLongEnumRange::RscLongEnumRange( HASHID nId, USHORT nTypeId )
+ : RscLongRange( nId, nTypeId )
+{
+}
+
+/*************************************************************************
+|* RscLongEnumRange::SetConst()
+|*
+|* Beschreibung
+*************************************************************************/
+ERRTYPE RscLongEnumRange::SetConst( const RSCINST & rInst, HASHID nConst,
+ long nValue )
+{
+ return SetNumber( rInst, nValue );
+}
+
+/****************** R s c I d R a n g e **********************************/
+/*************************************************************************
+|*
+|* RscIdRange::RscIdRange()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RscIdRange::RscIdRange( HASHID nId, USHORT nTypeId, BOOL bRcL )
+ : RscTop( nId, nTypeId )
+{
+ nSize = ALIGNED_SIZE( sizeof( RscId ) );
+ nMin = nMax = 0;
+ bRcLong = bRcL;
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::RscIdRange()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscIdRange::GetClassType() const
+{
+ return RSCCLASS_NUMBER;
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.04.91
+|* Letzte Aenderung MM 03.04.91
+|*
+*************************************************************************/
+RSCINST RscIdRange::Create( RSCINST * pInst, const RSCINST & rDflt, BOOL bOwnClass ){
+ RSCINST aInst;
+ RscId * pClassData;
+
+ if( !pInst ){
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA)RscMem::Malloc( sizeof( RscId ) );
+ }
+ else
+ aInst = *pInst;
+
+
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ pClassData = (RscId *)aInst.pData;
+
+ pClassData->Create();
+ if( bOwnClass )
+ *pClassData = *(RscId *)rDflt.pData;
+ else{
+ *pClassData = RscId();
+ if( 0L >= nMin && 0L <= nMax )
+ *pClassData = RscId( 0L );
+ else
+ *pClassData = RscId( nMin );
+ //cUnused wird fuer Defaultkennung verwendet
+ ((RscId *)aInst.pData)->aExp.cUnused = TRUE;
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::Destroy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.11.91
+|* Letzte Aenderung MM 22.11.91
+|*
+*************************************************************************/
+void RscIdRange :: Destroy( const RSCINST & rInst ){
+ ((RscId *)rInst.pData)->Destroy();
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.01.92
+|* Letzte Aenderung MM 15.01.92
+|*
+*************************************************************************/
+BOOL RscIdRange::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
+ if( pDef ){
+ if( ((RscId*)rInst.pData)->aExp.IsNumber()
+ && ((RscId*)pDef)->aExp.IsNumber() )
+ {
+ if( ((RscId*)rInst.pData)->GetNumber() ==
+ ((RscId*)pDef)->GetNumber() )
+ {
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.11.91
+|* Letzte Aenderung MM 25.11.91
+|*
+*************************************************************************/
+ERRTYPE RscIdRange::SetNumber( const RSCINST & rInst, long nValue )
+{
+ if( nMax < nValue || nMin > nValue )
+ return( ERR_RSCRANGE_OUTDEFSET );
+
+ *(RscId *)rInst.pData = RscId( nValue );
+ ((RscId *)rInst.pData)->aExp.cUnused = FALSE;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::GetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.11.91
+|* Letzte Aenderung MM 25.11.91
+|*
+*************************************************************************/
+ERRTYPE RscIdRange::GetNumber( const RSCINST & rInst, long * plValue ){
+ *plValue = ((RscId *)rInst.pData)->GetNumber();
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::SetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.11.91
+|* Letzte Aenderung MM 22.11.91
+|*
+*************************************************************************/
+ERRTYPE RscIdRange::SetRef( const RSCINST & rInst, const RscId & rRscId ){
+ ERRTYPE aError;
+ if( rRscId.IsId() ){
+ aError = SetNumber( rInst, rRscId );
+ if( aError.IsOk() ){
+ *(RscId *)rInst.pData = rRscId;
+ ((RscId *)rInst.pData)->aExp.cUnused = FALSE;
+ }
+ }
+ else
+ aError = ERR_RSCRANGE_OUTDEFSET;
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::GetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.11.91
+|* Letzte Aenderung MM 22.11.91
+|*
+*************************************************************************/
+ERRTYPE RscIdRange::GetRef( const RSCINST & rInst, RscId * pRscId ){
+ *pRscId = *(RscId *)rInst.pData;
+
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.11.91
+|* Letzte Aenderung MM 25.11.91
+|*
+*************************************************************************/
+void RscIdRange::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ fprintf( fOutput, "%s", ((RscId *)rInst.pData)->GetName().GetBuffer() );
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.11.91
+|* Letzte Aenderung MM 25.11.91
+|*
+*************************************************************************/
+ERRTYPE RscIdRange::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
+ RscTypCont *, USHORT, BOOL )
+{
+ long lVal = ((RscId*)rInst.pData)->GetNumber();
+
+ if( bRcLong )
+ //wenn long geschrieben werden soll
+ aMem.Put( (INT32)lVal );
+ else
+ aMem.Put( (USHORT)lVal );
+
+ return( ERR_OK );
+}
+
+//=======================================================================
+void RscIdRange::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ fprintf( fOutput, "\t\tSet%s( ", pName );
+ if( bRcLong )
+ {
+ fprintf( fOutput, "GetLong( pResData+nOffset ) );\n", pName );
+ fprintf( fOutput, "\t\tnOffset += sizeof( INT32 );\n" );
+ }
+ else
+ {
+ fprintf( fOutput, "*(USHORT *)(pResData+nOffset) );\n", pName );
+ fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscIdRange::IsConsistent()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.11.91
+|* Letzte Aenderung MM 22.11.91
+|*
+*************************************************************************/
+BOOL RscIdRange::IsConsistent( const RSCINST & rInst, RscInconsList * pList )
+{
+ long nValue = ((RscId *)rInst.pData)->GetNumber();
+ if( (nMax >= nValue) && (nMin <= nValue) )
+ return TRUE;
+ else {
+ if( pList )
+ pList->Insert( new RscInconsistent(
+ *(RscId *)rInst.pData, *(RscId *)rInst.pData ) );
+ return FALSE;
+ }
+}
+
+/****************** R s c B o o l ****************************************/
+/*************************************************************************
+|*
+|* RscBool::RscBool()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.04.91
+|* Letzte Aenderung MM 29.04.91
+|*
+*************************************************************************/
+RscBool::RscBool( HASHID nId, USHORT nTypeId )
+ : RscRange( nId, nTypeId )
+{
+ RscRange::SetRange( 0, 1 );
+}
+
+/*************************************************************************
+|*
+|* RscBool::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.04.91
+|* Letzte Aenderung MM 29.04.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscBool::GetClassType() const
+{
+ return RSCCLASS_BOOL;
+}
+
+/*************************************************************************
+|*
+|* RscBool::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.04.91
+|* Letzte Aenderung MM 29.04.91
+|*
+*************************************************************************/
+void RscBool::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ long l;
+
+ GetNumber( rInst, &l );
+ if( l )
+ fprintf( fOutput, "TRUE" );
+ else
+ fprintf( fOutput, "FALSE" );
+}
+
+//=======================================================================
+void RscBool::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ fprintf( fOutput, "\t\tSet%s( ", pName );
+ fprintf( fOutput, "(BOOL)*(short *)(pResData+nOffset) );\n", pName );
+ fprintf( fOutput, "\t\tnOffset += sizeof( short );\n" );
+}
+
+/****************** R s c B r e a k R a n g e ****************************/
+/*************************************************************************
+|*
+|* RscBreakRange::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.06.91
+|* Letzte Aenderung MM 24.06.91
+|*
+*************************************************************************/
+RscBreakRange :: RscBreakRange( HASHID nId, USHORT nTypeId )
+ : RscRange( nId, nTypeId )
+{
+ nOutRange = 0xFFFFFFFF;
+}
+
+/*************************************************************************
+|*
+|* RscBreakRange::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.06.91
+|* Letzte Aenderung MM 24.06.91
+|*
+*************************************************************************/
+ERRTYPE RscBreakRange::SetNumber( const RSCINST & rInst, long nValue ){
+ if( nValue == nOutRange )
+ return( ERR_RSCRANGE_OUTDEFSET );
+ else
+ return( RscRange::SetNumber( rInst, nValue ) );
+}
+
+/*************************************************************************
+|*
+|* RscBreakRange::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 24.06.91
+|* Letzte Aenderung MM 24.06.91
+|*
+*************************************************************************/
+RSCINST RscBreakRange::Create( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass )
+{
+ RSCINST aInst;
+ long l;
+
+ aInst = RscRange::Create( pInst, rDflt, bOwnClass );
+
+ GetNumber( aInst, &l );
+ if( l == nOutRange )
+ ((RscRangeInst *)aInst.pData)->nValue++;
+
+ return( aInst );
+}
+
diff --git a/rsc/source/res/rscstr.cxx b/rsc/source/res/rscstr.cxx
new file mode 100644
index 000000000000..bc64ac66acdb
--- /dev/null
+++ b/rsc/source/res/rscstr.cxx
@@ -0,0 +1,516 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscstr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rscstr.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.22 2000/09/17 12:51:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.21 2000/07/26 17:13:23 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.20 2000/07/12 11:38:42 th
+ Unicode
+
+ Revision 1.19 1999/10/12 08:45:03 mm
+ gpf corrected
+
+ Revision 1.18 1999/10/11 17:21:53 mm
+ no LString
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Programmabh„ngige Includes.
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCSTR_HXX
+#include <rscstr.hxx>
+#endif
+
+#include <rtl/textcvt.h>
+#include <rtl/textenc.h>
+
+/****************** C O D E **********************************************/
+/****************** R s c S t r i n g ************************************/
+/*************************************************************************
+|*
+|* RscString::RscString()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+RscString::RscString( HASHID nId, USHORT nTypeId )
+ : RscTop( nId, nTypeId )
+{
+ nSize = ALIGNED_SIZE( sizeof( RscStringInst ) );
+ pRefClass = NULL;
+}
+
+/*************************************************************************
+|*
+|* RscString::GetClassType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+RSCCLASS_TYPE RscString::GetClassType() const
+{
+ return RSCCLASS_STRING;
+}
+
+/*************************************************************************
+|*
+|* RscString::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+ERRTYPE RscString::SetString( const RSCINST & rInst, char * pStr ){
+ char * pTmp;
+ ERRTYPE aError;
+
+ if( aError.IsOk() ){
+ ((RscStringInst *)rInst.pData)->bDflt = FALSE;
+
+ pTmp = ((RscStringInst *)rInst.pData)->pStr;
+ if( pTmp ){
+ RscMem::Free( pTmp );
+ pTmp = NULL;
+ }
+
+ if( pStr ){
+ USHORT nLen = strlen( pStr ) +1;
+ pTmp = (char *)RscMem::Malloc( nLen );
+ memcpy( pTmp, pStr, nLen );
+ };
+
+ ((RscStringInst *)rInst.pData)->pStr = pTmp;
+ }
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscString::GetString()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+ERRTYPE RscString::GetString( const RSCINST & rInst, char ** ppStr ){
+ *ppStr = ((RscStringInst *)rInst.pData)->pStr;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscString::GetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.07.91
+|* Letzte Aenderung MM 22.07.91
+|*
+*************************************************************************/
+ERRTYPE RscString::GetRef( const RSCINST & rInst, RscId * pRscId ){
+ *pRscId = ((RscStringInst *)rInst.pData)->aRefId;
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscString::SetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+ERRTYPE RscString::SetRef( const RSCINST & rInst, const RscId & rRefId ){
+ if( pRefClass ){
+ ((RscStringInst *)rInst.pData)->aRefId = rRefId;
+ ((RscStringInst *)rInst.pData)->bDflt = FALSE;
+ }
+ else
+ return( ERR_REFNOTALLOWED );
+
+ return ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* RscString::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+RSCINST RscString::Create( RSCINST * pInst, const RSCINST & rDflt,
+ BOOL bOwnClass )
+{
+ RSCINST aInst;
+
+ if( !pInst ){
+ aInst.pClass = this;
+ aInst.pData = (CLASS_DATA)
+ RscMem::Malloc( sizeof( RscStringInst ) );
+ }
+ else
+ aInst = *pInst;
+ if( !bOwnClass && rDflt.IsInst() )
+ bOwnClass = rDflt.pClass->InHierarchy( this );
+
+ ((RscStringInst *)aInst.pData)->aRefId.Create();
+ ((RscStringInst *)aInst.pData)->pStr = NULL;
+ ((RscStringInst *)aInst.pData)->bDflt = TRUE;
+
+ if( bOwnClass ){
+ ((RscStringInst *)aInst.pData)->aRefId =
+ ((RscStringInst *)rDflt.pData)->aRefId;
+ SetString( aInst, ((RscStringInst *)rDflt.pData)->pStr );
+ ((RscStringInst *)aInst.pData)->bDflt =
+ ((RscStringInst *)rDflt.pData)->bDflt ;
+ }
+
+ return( aInst );
+}
+
+/*************************************************************************
+|*
+|* RscString::Destroy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+void RscString::Destroy( const RSCINST & rInst ){
+ if( ((RscStringInst *)rInst.pData)->pStr )
+ RscMem::Free( ((RscStringInst *)rInst.pData)->pStr );
+ ((RscStringInst *)rInst.pData)->aRefId.Destroy();
+}
+
+/*************************************************************************
+|*
+|* RscString::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.01.92
+|* Letzte Aenderung MM 15.01.92
+|*
+*************************************************************************/
+BOOL RscString::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
+ RscStringInst * pData = (RscStringInst*)rInst.pData;
+ RscStringInst * pDefData = (RscStringInst*)pDef;
+
+ if( pDef ){
+ if( pData->aRefId.IsId() || pDefData->aRefId.IsId() )
+ {
+ if( pData->aRefId.aExp.IsNumber()
+ && pDefData->aRefId.aExp.IsNumber() )
+ {
+ // Sind die Referenzidentifier gleich
+ if( pData->aRefId.GetNumber() == pDefData->aRefId.GetNumber() )
+ {
+ return TRUE;
+ }
+ }
+ }
+ else {
+ BOOL bStrEmpty = FALSE;
+ BOOL bDefStrEmpty = FALSE;
+
+ if( pData->pStr ){
+ bStrEmpty = ('\0' == *pData->pStr);
+ }
+ else
+ bStrEmpty = TRUE;
+
+ if( pDefData->pStr ){
+ bDefStrEmpty = ('\0' == *pDefData->pStr);
+ }
+ else
+ bDefStrEmpty = TRUE;
+
+ if( !bStrEmpty || !bDefStrEmpty ){
+ return FALSE;
+ }
+ else if( !(bStrEmpty || bDefStrEmpty) ){
+ if( strcmp( pData->pStr, pDefData->pStr ) )
+ return FALSE;
+ }
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscString::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 25.04.91
+|* Letzte Aenderung MM 25.04.91
+|*
+*************************************************************************/
+void RscString::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont *, USHORT, const char * )
+{
+ if ( ((RscStringInst *)rInst.pData)->aRefId.IsId() )
+ {
+ fprintf( fOutput, "%s",
+ ((RscStringInst *)rInst.pData)->aRefId.GetName().GetBuffer() );
+ }
+ else
+ {
+ RscStringInst * pStrI = ((RscStringInst *)rInst.pData);
+ if( pStrI->pStr ){
+ //char * pChangeTab = RscChar::GetChangeTab();
+ USHORT n = 0;
+ USHORT nPos, nSlashPos;
+
+ do {
+ fputc( '\"', fOutput );
+ nSlashPos = nPos = 0;
+ while( pStrI->pStr[ n ]
+ && (nPos < 72 || nPos - nSlashPos <= 3) )
+ { // nach \ mindesten 3 Zeichen wegeb \xa7
+ fputc( pStrI->pStr[ n ], fOutput );
+ if( pStrI->pStr[ n ] == '\\' )
+ nSlashPos = nPos;
+ n++;
+ nPos++;
+ }
+
+ fputc( '\"', fOutput );
+ if( pStrI->pStr[ n ] ) //nocht nicht zu ende
+ fputc( '\n', fOutput );
+ } while( pStrI->pStr[ n ] );
+ }
+ else
+ fprintf( fOutput, "\"\"" );
+ /*
+ if( pStrI->pStr )
+ {
+ UINT16 nStrLen = strlen( pStrI->pStr );
+ sal_Unicode * pUniCode = new sal_Unicode[ nStrLen +1 ];
+ rtl_TextToUnicodeConverter hConv = rtl_createTextToUnicodeConverter( RTL_TEXTENCODING_UTF8 );
+
+ sal_uInt32 nInfo;
+ sal_Size nSrcCvtBytes;
+ sal_Size nSize = rtl_convertTextToUnicode( hConv, 0,
+ pStrI->pStr, nStrLen,
+ pUniCode, nStrLen,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_FLUSH,
+ &nInfo,
+ &nSrcCvtBytes );
+ fputc( 'L', fOutput );
+ fputc( '\"', fOutput );
+ for( sal_Size i = 0; i < nSize; i++ )
+ {
+ if( pUniCode[i] >= 32 && pUniCode[i] < 128 )
+ {
+ if( pUniCode[i] == '\\' )
+ {
+ fputc( (char)pUniCode[i], fOutput );
+ fputc( (char)pUniCode[i], fOutput );
+ }
+ else if( pUniCode[i] == '\"' )
+ {
+ fputc( '\\', fOutput );
+ fputc( '"', fOutput );
+ }
+ else
+ fputc( (char)pUniCode[i], fOutput );
+ }
+ else
+ fprintf( fOutput, "\\x%4.4lX", (long)pUniCode[i] );
+ if( !((i +1) % 40) && i +1 != nSize )
+ fprintf( fOutput, "\"\n\t\t\tL\"" );
+ }
+ fputc( '\"', fOutput );
+
+ rtl_destroyTextToUnicodeConverter( hConv );
+ delete pUniCode;
+ }
+ else
+ fprintf( fOutput, "\"\"" );
+ */
+ };
+}
+
+/*************************************************************************
+|*
+|* RscString::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+ERRTYPE RscString::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ ERRTYPE aError;
+ ObjNode * pObjNode = NULL;
+
+
+ if( ((RscStringInst *)rInst.pData)->aRefId.IsId() ){
+ RscId aId( ((RscStringInst *)rInst.pData)->aRefId );
+ RSCINST aTmpI;
+
+ aTmpI.pClass = pRefClass;
+
+ while( aError.IsOk() && aId.IsId() ){
+ //Erhoehen und abfragen um Endlosrekusion zu vermeiden
+ nDeep++;
+ if( nDeep > nRefDeep )
+ aError = ERR_REFTODEEP;
+ else
+ {
+ pObjNode = pRefClass->GetObjNode( aId );
+ if( pObjNode )
+ {
+ aTmpI.pData = pObjNode->GetRscObj();
+ aError = pRefClass->GetRef( aTmpI, &aId );
+ }
+ else
+ {
+ if( pTC )
+ {
+ ByteString aMsg( pHS->Get( pRefClass->GetId() ) );
+ aMsg += ' ';
+ aMsg += aId.GetName();
+ aError = WRN_STR_REFNOTFOUND;
+ pTC->pEH->Error( aError, rInst.pClass,
+ RscId(), aMsg.GetBuffer() );
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ if( aError.IsOk() )
+ {
+ if( pObjNode )
+ {
+ RSCINST aRefI;
+
+ aRefI = RSCINST( pRefClass, pObjNode->GetRscObj() );
+ aError = aRefI.pClass->WriteRc( aRefI, rMem, pTC, nDeep, bExtra );
+ }
+ else
+ {
+ if( ((RscStringInst *)rInst.pData)->pStr )
+ {
+ char * pStr = RscChar::MakeUTF8( ((RscStringInst *)rInst.pData)->pStr,
+ pTC->GetSourceCharSet() );
+ rMem.PutUTF8( pStr );
+ RscMem::Free( pStr );
+ }
+ else
+ rMem.PutUTF8( ((RscStringInst *)rInst.pData)->pStr );
+ //rMem.PutUTF8( ((RscStringInst *)rInst.pData)->pStr );
+ };
+ };
+ return( aError );
+}
+
+//==================================================================
+void RscString::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ fprintf( fOutput, "\t\tString aStr( (const char*)(pResData+nOffset) );\n" );
+ fprintf( fOutput, "\t\tSet%s( aStr );\n", pName );
+ fprintf( fOutput, "\t\tnOffset += GetStringSizeRes( aStr );\n" );
+}
+
diff --git a/rsc/source/res/rsctop.cxx b/rsc/source/res/rsctop.cxx
new file mode 100644
index 000000000000..eac8604ca30e
--- /dev/null
+++ b/rsc/source/res/rsctop.cxx
@@ -0,0 +1,1035 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsctop.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/res/rsctop.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+*************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdio.h>
+#include <string.h>
+
+// Solar Definitionen
+#include <tools/solar.h>
+
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+/****************** C O D E **********************************************/
+/****************** R s c T o p ******************************************/
+/*************************************************************************
+|*
+|* RscTop::RscTop()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.06.91
+|* Letzte Aenderung MM 03.06.91
+|*
+*************************************************************************/
+RscTop::RscTop( HASHID nId, USHORT nTypIdent, RscTop * pSuperCl )
+ : RefNode( nId )
+ , nTypId( nTypIdent )
+ , pSuperClass( pSuperCl )
+{
+ pRefClass = this;
+ if( pSuperClass )
+ SetCallPar( pSuperClass->aCallPar1, pSuperClass->aCallPar2,
+ pSuperClass->aCallParType );
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetCallPar()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+void RscTop::SetCallPar( const ByteString & rPar1, const ByteString & rPar2,
+ const ByteString & rParType )
+{
+ aCallPar1 = rPar1;
+ aCallPar2 = rPar2;
+ aCallParType = rParType;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RSCINST RscTop::GetDefault()
+{
+ if( !aDfltInst.IsInst() )
+ aDfltInst = this->Create( NULL, RSCINST() );
+ return aDfltInst;
+}
+
+/*************************************************************************
+|*
+|* RscTop::Pre_dtor()
+|*
+|* Beschreibung
+|* Ersterstellung MM 19.06.91
+|* Letzte Aenderung MM 19.06.91
+|*
+*************************************************************************/
+void RscTop :: Pre_dtor(){
+ if( aDfltInst.IsInst() ){
+ aDfltInst.pClass->Destroy( aDfltInst );
+ RscMem::Free( aDfltInst.pData );
+ aDfltInst = RSCINST();
+ };
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetConstant()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+HASHID RscTop :: GetConstant( USHORT ){
+ return HASH_NONAME;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetIndexType()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RscTop * RscTop::GetTypeClass() const
+{
+ if( pSuperClass )
+ return pSuperClass->GetTypeClass();
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* RscTop::Size()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+USHORT RscTop :: Size()
+{
+ if( pSuperClass )
+ return pSuperClass->Size();
+ else
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop :: GetRef( const RSCINST & rInst, RscId * pRscId ){
+ if( pSuperClass )
+ return pSuperClass->GetRef( rInst, pRscId );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::InHierarchy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 17.05.91
+|* Letzte Aenderung MM 17.05.91
+|*
+*************************************************************************/
+BOOL RscTop::InHierarchy( RscTop * pClass ){
+ if( this == pClass )
+ return( TRUE );
+ if( pSuperClass )
+ return( pSuperClass->InHierarchy( pClass ) );
+ return( FALSE );
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetVariable()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetVariable( HASHID nVarName, RscTop * pClass,
+ RSCINST * pDflt, RSCVAR nVarType, USHORT nMask,
+ HASHID nDataBaseName )
+{
+ if( pSuperClass )
+ return pSuperClass->
+ SetVariable( nVarName, pClass, pDflt,
+ nVarType, nMask, nDataBaseName );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::EnumVariable()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.02.93
+|* Letzte Aenderung MM 03.02.93
+|*
+*************************************************************************/
+void RscTop::EnumVariables( void * pData, VarEnumCallbackProc pProc )
+{
+ if( pSuperClass )
+ pSuperClass->EnumVariables( pData, pProc );
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetVariable()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RSCINST RscTop::GetVariable
+(
+ const RSCINST & rInst,
+ HASHID nVarName,
+ const RSCINST & rInitInst,
+ BOOL bInitDflt,
+ RscTop * pCreateClass
+)
+{
+ if( pSuperClass )
+ return pSuperClass->
+ GetVariable( rInst, nVarName, rInitInst, bInitDflt, pCreateClass );
+ else
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetCopyVar()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RSCINST RscTop::GetCopyVar( const RSCINST & rInst, HASHID nVarName )
+{
+ if( pSuperClass )
+ return pSuperClass->
+ GetCopyVar( rInst, nVarName );
+ else
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetTupelVar()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RSCINST RscTop::GetTupelVar( const RSCINST & rInst, USHORT nPos,
+ const RSCINST & rInitInst )
+{
+ if( pSuperClass )
+ return pSuperClass->GetTupelVar( rInst, nPos, rInitInst );
+ else
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetElement()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::GetElement( const RSCINST & rInst, const RscId & rEleName,
+ RscTop *pCreateClass, const RSCINST & rCreateInst,
+ RSCINST * pGetInst )
+{
+ if( pSuperClass )
+ return pSuperClass->
+ GetElement( rInst, rEleName,
+ pCreateClass, rCreateInst,
+ pGetInst );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetArrayEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::GetArrayEle
+(
+ const RSCINST & rInst,
+ HASHID nId,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst
+)
+{
+ if( pSuperClass )
+ return pSuperClass->GetArrayEle( rInst, nId, pCreateClass, pGetInst );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetValueEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::GetValueEle
+(
+ const RSCINST & rInst,
+ long lValue,
+ RscTop * pCreateClass,
+ RSCINST * pGetInst
+)
+{
+ if( pSuperClass )
+ return pSuperClass->GetValueEle( rInst, lValue, pCreateClass, pGetInst );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SearchEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RSCINST RscTop::SearchEle( const RSCINST & rInst, const RscId & rEleName,
+ RscTop * pClass )
+{
+ if( pSuperClass )
+ return pSuperClass->
+ SearchEle( rInst, rEleName, pClass );
+ else
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetPosEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RSCINST RscTop::GetPosEle( const RSCINST & rInst, USHORT nPos ){
+ if( pSuperClass )
+ return pSuperClass->
+ GetPosEle( rInst, nPos );
+ else
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscTop::MovePosEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::MovePosEle( const RSCINST & rInst, USHORT nDestPos,
+ USHORT nSourcePos )
+{
+ if( pSuperClass )
+ return pSuperClass->
+ MovePosEle( rInst, nDestPos, nSourcePos );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetPosRscId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetPosRscId( const RSCINST & rInst, USHORT nPos,
+ const RscId & rRscId )
+{
+ if( pSuperClass )
+ return pSuperClass->
+ SetPosRscId( rInst, nPos, rRscId );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetInfoEle()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+SUBINFO_STRUCT RscTop::GetInfoEle( const RSCINST & rInst, USHORT nPos ){
+ if( pSuperClass )
+ return pSuperClass->
+ GetInfoEle( rInst, nPos );
+ else
+ return SUBINFO_STRUCT();
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetCount()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+USHORT RscTop::GetCount( const RSCINST & rInst ){
+ if( pSuperClass )
+ return pSuperClass->GetCount( rInst );
+ else
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetNumber( const RSCINST & rInst, long lValue ){
+ if( pSuperClass )
+ return pSuperClass->
+ SetNumber( rInst, lValue );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetBool()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetBool( const RSCINST & rInst, BOOL bValue ){
+ if( pSuperClass )
+ return pSuperClass->
+ SetBool( rInst, bValue );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetConst( const RSCINST & rInst, HASHID nId, long nVal )
+{
+ if( pSuperClass )
+ return pSuperClass->SetConst( rInst, nId, nVal );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetNotConst()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetNotConst( const RSCINST & rInst, HASHID nId ){
+ if( pSuperClass )
+ return pSuperClass->
+ SetNotConst( rInst, nId );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetString()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetString( const RSCINST & rInst, char * pStr ){
+ if( pSuperClass )
+ return pSuperClass->
+ SetString( rInst, pStr );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::GetNumber( const RSCINST & rInst, long * pN ){
+ if( pSuperClass )
+ return pSuperClass->
+ GetNumber( rInst, pN );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetBool()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::GetBool( const RSCINST & rInst, BOOL * pB ){
+ if( pSuperClass )
+ return pSuperClass->
+ GetBool( rInst, pB );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetCont()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::GetConst( const RSCINST & rInst, HASHID * pH ){
+ if( pSuperClass )
+ return pSuperClass->
+ GetConst( rInst, pH );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetString()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::GetString( const RSCINST & rInst, char ** ppStr ){
+ if( pSuperClass )
+ return pSuperClass->
+ GetString( rInst, ppStr );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 17.05.91
+|* Letzte Aenderung MM 17.07.91
+|*
+*************************************************************************/
+RSCINST RscTop::Create( RSCINST * pInst, const RSCINST & rDefInst, BOOL bOwnRange )
+{
+ if( pSuperClass )
+ return pSuperClass->
+ Create( pInst, rDefInst, bOwnRange );
+ else{
+ if( pInst )
+ return *pInst;
+ return RSCINST();
+ }
+}
+
+/*************************************************************************
+|*
+|* RscTop::Destroy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+void RscTop::Destroy( const RSCINST & rInst ){
+ if( pSuperClass )
+ pSuperClass->Destroy( rInst );
+}
+
+/*************************************************************************
+|*
+|* RscTop::IsConsistent()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+BOOL RscTop::IsConsistent( const RSCINST & rInst,
+ RscInconsList * pList )
+{
+ if( pSuperClass )
+ return pSuperClass->IsConsistent( rInst, pList );
+ else
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetToDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+void RscTop::SetToDefault( const RSCINST & rInst )
+{
+ if( pSuperClass )
+ pSuperClass->SetToDefault( rInst );
+}
+
+/*************************************************************************
+|*
+|* RscTop::IsDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+BOOL RscTop::IsDefault( const RSCINST & rInst ){
+ if( pSuperClass )
+ return pSuperClass->IsDefault( rInst );
+ else
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscTop::IsValueDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+BOOL RscTop::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
+ if( pSuperClass )
+ return pSuperClass->IsValueDefault( rInst, pDef );
+ else
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+void RscTop::SetDefault( const RSCINST & rInst, HASHID nVarId ){
+ if( pSuperClass )
+ pSuperClass->SetDefault( rInst, nVarId );
+}
+
+/*************************************************************************
+|*
+|* RscTop::GetDefault()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+RSCINST RscTop::GetDefault( HASHID nVarId ){
+ if( pSuperClass )
+ return pSuperClass->
+ GetDefault( nVarId );
+ else
+ return RSCINST();
+}
+
+/*************************************************************************
+|*
+|* RscTop::Delete()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+void RscTop::Delete( const RSCINST & rInst, RscTop * pClass,
+ const RscId & rId )
+{
+ if( pSuperClass )
+ pSuperClass->Delete( rInst, pClass, rId );
+}
+
+/*************************************************************************
+|*
+|* RscTop::DeletePos()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.10.91
+|* Letzte Aenderung MM 29.10.91
+|*
+*************************************************************************/
+void RscTop::DeletePos( const RSCINST & rInst, USHORT nPos )
+{
+ if( pSuperClass )
+ pSuperClass->DeletePos( rInst, nPos );
+}
+
+/*************************************************************************
+|*
+|* RscTop::SetRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.09.91
+|* Letzte Aenderung MM 18.09.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::SetRef( const RSCINST & rInst, const RscId & rRefId ){
+ if( pSuperClass )
+ return pSuperClass->SetRef( rInst, rRefId );
+ else
+ return ERR_UNKNOWN_METHOD;
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteHxxHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::WriteHxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId )
+{
+ if( pSuperClass )
+ return pSuperClass->WriteHxxHeader( rInst, fOutput, pTC, rId );
+ else
+ return rInst.pClass->WriteHxx( rInst, fOutput, pTC, rId );
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteHxx()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::WriteHxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId ){
+ if( pSuperClass )
+ return pSuperClass->WriteHxx( rInst, fOutput, pTC, rId );
+ else
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteCxxHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::WriteCxxHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId )
+{
+ if( pSuperClass )
+ return pSuperClass->WriteCxxHeader( rInst, fOutput, pTC, rId );
+ else
+ return rInst.pClass->WriteCxx( rInst, fOutput, pTC, rId );
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteCxx()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::WriteCxx( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, const RscId & rId ){
+ if( pSuperClass )
+ return pSuperClass->WriteCxx( rInst, fOutput, pTC, rId );
+ else
+ return ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteSrcHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscTop::WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab,
+ const RscId & rId, const char * pVarName )
+{
+ if( pSuperClass )
+ pSuperClass->WriteSrcHeader( rInst, fOutput, pTC, nTab, rId, pVarName );
+ else
+ rInst.pClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteSrc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+void RscTop::WriteSrc( const RSCINST & rInst, FILE * fOutput,
+ RscTypCont * pTC, USHORT nTab, const char * pVarName )
+{
+ if( pSuperClass )
+ pSuperClass->WriteSrc( rInst, fOutput, pTC, nTab, pVarName );
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteRcHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.04.91
+|* Letzte Aenderung MM 12.04.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::WriteRcHeader( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, const RscId & rId,
+ USHORT nDeep, BOOL bExtra )
+{
+ if( pSuperClass )
+ return( pSuperClass->
+ WriteRcHeader( rInst, rMem, pTC, rId, nDeep, bExtra ) );
+ else
+ return( rInst.pClass->WriteRc( rInst, rMem, pTC, nDeep, bExtra ) );
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.04.91
+|* Letzte Aenderung MM 08.04.91
+|*
+*************************************************************************/
+ERRTYPE RscTop::WriteRc( const RSCINST & rInst, RscWriteRc & rMem,
+ RscTypCont * pTC, USHORT nDeep, BOOL bExtra )
+{
+ if( pSuperClass )
+ return( pSuperClass->
+ WriteRc( rInst, rMem, pTC, nDeep, bExtra ) );
+ else
+ return( ERR_OK );
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteSyntaxHeader()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+void RscTop::WriteSyntaxHeader( FILE * fOutput, RscTypCont * pTC )
+{
+ if( GetId() != HASH_NONAME )
+ {
+ fprintf( fOutput, "class %s \n{\n", pHS->Get( GetId() ) );
+ WriteSyntax( fOutput, pTC );
+ fprintf( fOutput, "};\n\n" );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscTop::WriteSyntax()
+|*
+|* Beschreibung
+|* Ersterstellung MM 29.05.91
+|* Letzte Aenderung MM 29.05.91
+|*
+*************************************************************************/
+void RscTop::WriteSyntax( FILE * fOutput, RscTypCont * pTC )
+{
+ if( pSuperClass )
+ pSuperClass->WriteSyntax( fOutput, pTC );
+}
+
+//========================================================================
+void RscTop::WriteRcAccess
+(
+ FILE * fOutput,
+ RscTypCont * pTC,
+ const char * pName
+)
+{
+ if( GetId() != HASH_NONAME )
+ {
+ fprintf( fOutput, "\t\t//%s %s\n",
+ pHS->Get( GetId() ), pName );
+ }
+}
+
+//========================================================================
+void RscTop::WriteRcCtor( FILE * fOutput, RscTypCont * pTC )
+{
+ if( pSuperClass )
+ pSuperClass->WriteRcCtor( fOutput, pTC );
+}
+
+
diff --git a/rsc/source/rsc/makefile.mk b/rsc/source/rsc/makefile.mk
new file mode 100644
index 000000000000..95ae993e0b83
--- /dev/null
+++ b/rsc/source/rsc/makefile.mk
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=rsc
+TARGET=rscrsc
+
+# --- Settings -------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+OBJFILES= $(OBJ)$/rsc.obj \
+ $(OBJ)$/rscinst.obj
+
+CXXFILES= rsc.cxx \
+ rscinst.cxx
+
+.INCLUDE : target.mk
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
new file mode 100644
index 000000000000..257a7094ccfc
--- /dev/null
+++ b/rsc/source/rsc/rsc.cxx
@@ -0,0 +1,999 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/rsc/rsc.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+**************************************************************************/
+/****************************************************************/
+/* Include File */
+/****************************************************************/
+#ifdef MAC
+#include "mac_start.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#ifdef UNX
+#include <unistd.h>
+#include <sys/wait.h>
+#else
+#ifndef MAC
+#include <io.h>
+#include <process.h>
+#include <direct.h>
+#endif
+#endif
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#ifdef MAC
+#ifdef MAC_UNIVERSAL
+#ifndef _UNISTD
+ #include <unistd.h>
+#endif
+#endif
+#include "mac_end.h"
+#endif
+
+#if defined( PM2 ) && defined( ZTC )
+#include <svpm.h>
+#ifndef unlink
+#define unlink( p ) DosDelete( (PSZ)(const char*)p )
+#endif
+#endif
+
+#include <tools/fsys.hxx>
+
+#ifndef _RSCERROR_H
+#include <rscerror.h>
+#endif
+#ifndef _RSCTOP_HXX
+#include <rsctop.hxx>
+#endif
+#ifndef _RSCDB_HXX
+#include <rscdb.hxx>
+#endif
+#ifndef _RSCPAR_HXX
+#include <rscpar.hxx>
+#endif
+#ifndef _RSCRSC_HXX
+#include <rscrsc.hxx>
+#endif
+
+#include <rtl/tencinfo.h>
+#include <rtl/textenc.h>
+/*************** F o r w a r d s *****************************************/
+/*************** G l o b a l e V a r i a b l e n **********************/
+HashString* pHS = NULL;
+ByteString* pStdParType = NULL;
+ByteString* pStdPar1 = NULL;
+ByteString* pStdPar2 = NULL;
+ByteString* pWinParType = NULL;
+ByteString* pWinPar1 = NULL;
+ByteString* pWinPar2 = NULL;
+USHORT nRefDeep = 10;
+
+/*************** R s c C m d L i n e ************************************/
+/*************************************************************************
+|*
+|* RscCmdLine::Init()
+|*
+|* Beschreibung Kommandozeile interpretierten
+|* Ersterstellung MM 03.05.91
+|* Letzte Aenderung MM 03.05.91
+|*
+*************************************************************************/
+void RscCmdLine::Init()
+{
+ nSourceCharSet = RTL_TEXTENCODING_MS_1252;
+ nCommands = 0;
+ nLangTypeId = LANGUAGE_DONTKNOW;
+ nByteOrder = RSC_BIGENDIAN;
+
+ DirEntry aEntry;
+ aPath = ByteString( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); //Immer im Aktuellen Pfad suchen
+}
+
+/*************************************************************************
+|*
+|* RscCmdLine::RscCmdLine()
+|*
+|* Beschreibung Kommandozeile interpretierten
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+RscCmdLine::RscCmdLine()
+{
+ Init();
+}
+
+/*************************************************************************
+|*
+|* RscCmdLine::RscCmdLine()
+|*
+|* Beschreibung Kommandozeile interpretierten
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+RscCmdLine::RscCmdLine( short argc, char ** argv, RscError * pEH )
+{
+ char * pStr;
+ char ** ppStr;
+ RscPtrPtr aCmdLine; // Kommandozeile
+ ByteString aString;
+ USHORT i;
+ BOOL bOutputSrsIsSet = FALSE;
+
+ Init(); // Defaults setzen
+
+ pStr = ::ResponseFile( &aCmdLine, argv, argc );
+ if( pStr )
+ pEH->FatalError( ERR_OPENFILE, RscId(), pStr );
+
+ /* check the inputted switches */
+ ppStr = (char **)aCmdLine.GetBlock();
+ ppStr++;
+ i = 1;
+ while( ppStr && i < (USHORT)(aCmdLine.GetCount() -1) )
+ {
+ if( '-' == **ppStr )
+ {
+ if( !rsc_stricmp( (*ppStr) + 1, "h" )
+ || !strcmp( (*ppStr) + 1, "?" ) )
+ { // Hilfe
+ nCommands |= HELP_FLAG;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "syntax" ) )
+ { // Hilfe
+ nCommands |= PRINTSYNTAX_FLAG;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "RefDeep", 7 ) )
+ { // maximale Aufloesungtiefe fuer Referenzen
+ nRefDeep = (short)(ByteString( (*ppStr) +1 + strlen( "RefDeep" ) ).ToInt32());
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "p" ) )
+ { // kein Preprozessor
+ nCommands |= NOPREPRO_FLAG;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "s" ) )
+ { // nicht linken
+ nCommands |= NOLINK_FLAG;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "l" ) )
+ { // Linken, keine Syntax und kein Prepro
+ nCommands |= NOPREPRO_FLAG;
+ nCommands |= NOSYNTAX_FLAG;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "r" ) )
+ { // erzeugt kein .res-file
+ nCommands |= NORESFILE_FLAG;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "PreLoad" ) )
+ { // Alle Ressourcen mit Preload
+ nCommands |= PRELOAD_FLAG;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "LITTLEENDIAN" ) )
+ { // Byte Ordnung beim Schreiben
+ nByteOrder = RSC_LITTLEENDIAN;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "BIGENDIAN" ) )
+ { // Byte Ordnung beim Schreiben
+ nByteOrder = RSC_BIGENDIAN;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "SMART" ) )
+ { // Byte Ordnung beim Schreiben
+ nCommands |= SMART_FLAG;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "d", 1 ) )
+ { // Symbole definieren
+ nCommands |= DEFINE_FLAG;
+ aSymbolList.Insert( new ByteString( (*ppStr) + 2 ), 0xFFFF );
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "i", 1 ) )
+ { // Include-Pfade definieren
+ nCommands |= INCLUDE_FLAG;
+ if( aPath.Len() )
+ aPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
+ aPath += (*ppStr) + 2;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fs", 2 ) )
+ { // anderer Name fuer .rc-file
+ aOutputRc = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fp", 2 ) )
+ { // anderer Name fuer .srs-file
+ aOutputSrs = (*ppStr) + 3;
+ bOutputSrsIsSet = TRUE;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fl", 2 ) )
+ { // Name fuer listing-file
+ aOutputLst = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fh", 2 ) )
+ { // Name fuer .hxx-file
+ aOutputHxx = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fc", 2 ) )
+ { // Name fuer .cxx-file
+ aOutputCxx = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fr", 2 ) )
+ { // Name fuer .cxx-file der Ressource Konstruktoren
+ aOutputRcCtor = (*ppStr) + 3;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "fx", 2 ) )
+ { // Name fuer .src-file
+ aOutputSrc = (*ppStr) + 3;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "NoSysResTest" ) )
+ { // Bitmap, Pointers, Icons nicht ueberpruefen
+ nCommands |= NOSYSRESTEST_FLAG;
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "SrsDefault" ) )
+ { // Bitmap, Pointers, Icons nicht ueberpruefen
+ nCommands |= SRSDEFAULT_FLAG;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "CHARSET_", 8 ) )
+ {
+ if( !rsc_stricmp( (*ppStr) + 9, "ANSI" ) )
+ nSourceCharSet = RTL_TEXTENCODING_MS_1252;
+ else if( !rsc_stricmp( (*ppStr) + 9, "MAC" ) )
+ nSourceCharSet = RTL_TEXTENCODING_APPLE_ROMAN;
+ else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_437" ) )
+ nSourceCharSet = RTL_TEXTENCODING_IBM_437;
+ else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_850" ) )
+ nSourceCharSet = RTL_TEXTENCODING_IBM_850;
+ else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_860" ) )
+ nSourceCharSet = RTL_TEXTENCODING_IBM_860;
+ else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_861" ) )
+ nSourceCharSet = RTL_TEXTENCODING_IBM_861;
+ else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_863" ) )
+ nSourceCharSet = RTL_TEXTENCODING_IBM_863;
+ else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC_865" ) )
+ nSourceCharSet = RTL_TEXTENCODING_IBM_865;
+ else if( !rsc_stricmp( (*ppStr) + 9, "IBMPC" ) )
+ nSourceCharSet = RTL_TEXTENCODING_IBM_850;
+ else if( !rsc_stricmp( (*ppStr) + 9, "DONTKNOW" ) )
+ nSourceCharSet = RTL_TEXTENCODING_DONTKNOW;
+ else
+ {
+ nSourceCharSet = rtl_getTextEncodingFromUnixCharset( (*ppStr) + 9 );
+ if( nSourceCharSet == 0 )
+ {
+ nSourceCharSet = RTL_TEXTENCODING_MS_1252;
+ pEH->FatalError( ERR_UNKNOWNSW, RscId(), *ppStr );
+ break;
+ }
+ }
+ }
+ else if( !rsc_stricmp( (*ppStr) + 1, "lg" ) )
+ {
+ nLangTypeId = LANGUAGE_DONTKNOW;
+ }
+ else if( !rsc_strnicmp( (*ppStr) + 1, "lg", 2 ) )
+ {
+ nLangTypeId = LANGUAGE_DONTKNOW;
+#define LT(Name) \
+ if( !rsc_stricmp( (*ppStr) + 3, #Name ) ) \
+ nLangTypeId = LANGUAGE_##Name
+ LT( SYSTEM );
+#include <rsclang.c>
+ LT( USER1 );
+ LT( USER2 );
+ LT( USER3 );
+ LT( USER4 );
+ LT( USER5 );
+ LT( USER6 );
+ LT( USER7 );
+ LT( USER8 );
+ LT( USER9 );
+ if( nLangTypeId == LANGUAGE_DONTKNOW )
+ pEH->FatalError( ERR_UNKNOWNSW, RscId(), *ppStr );
+ }
+ else
+ pEH->FatalError( ERR_UNKNOWNSW, RscId(), *ppStr );
+ }
+ else
+ {
+ // Eingabedatei
+ aInputList.Insert( new ByteString( *ppStr ), 0xFFFF );
+ }
+ ppStr++;
+ i++;
+ }
+
+ if( nCommands & HELP_FLAG )
+ pEH->FatalError( ERR_USAGE, RscId() );
+ // was an inputted file specified
+ else if( aInputList.Count() )
+ {
+ if( ! aOutputRc.Len() )
+ aOutputRc = OutputFile( *aInputList.First(), "rc" );
+ if( ! bOutputSrsIsSet )
+ aOutputSrs = OutputFile( *aInputList.First(), "srs" );
+ }
+ else if( !(nCommands & PRINTSYNTAX_FLAG) )
+ pEH->FatalError( ERR_NOINPUT, RscId() );
+}
+
+/*************************************************************************
+|*
+|* RscCmdLine::SetInputFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.04.91
+|* Letzte Aenderung MM 22.04.91
+|*
+*************************************************************************/
+void RscCmdLine::SetInputFile( const ByteString & rInputName )
+{
+ ByteString * pString;
+
+ while( NULL != (pString = aInputList.Remove( (ULONG)0 )) )
+ delete pString;
+ aInputList.Insert( new ByteString( rInputName ) );
+}
+
+/*************************************************************************
+|*
+|* RscCmdLine::~RscCmdLine()
+|*
+|* Beschreibung dtor
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+RscCmdLine::~RscCmdLine()
+{
+ ByteString *pString;
+
+ while( NULL != (pString = aInputList.Remove( (ULONG)0 )) )
+ delete pString;
+ while( NULL != (pString = aSymbolList.Remove( (ULONG)0 )) )
+ delete pString;
+}
+
+/*************** R s c C o m p i l e r **********************************/
+/****************************************************************/
+/* */
+/* RscCompiler :: RscCompiler(int argc, char **argv) */
+/* */
+/* Parameters : argc - number of parameters on command line */
+/* argv - arry of pointers to input parameters */
+/* */
+/* Description : main calling routine. Calls functions to */
+/* check and assign the input parameters. It then builds the */
+/* command line to call the Glockenspiel preprocessor */
+/****************************************************************/
+
+RscCompiler::RscCompiler( RscCmdLine * pLine, RscTypCont * pTypCont )
+{
+ fListing = NULL;
+ fExitFile = NULL;
+
+ //Kommandozeile setzen, TypContainer setzen
+ pCL = pLine;
+ pTC = pTypCont;
+
+ if( pCL->aOutputLst.Len() )
+ {
+ if ( NULL == (fListing = fopen( pCL->aOutputLst.GetBuffer(), "w" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), pCL->aOutputLst.GetBuffer() );
+ pTC->pEH->SetListFile( fListing );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscCompiler :: RscCompiler()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.02.91
+|* Letzte Aenderung MM 07.02.91
+|*
+*************************************************************************/
+RscCompiler::~RscCompiler()
+{
+ ByteString* pString;
+
+ // Dateien loeschen
+ pString = aTmpFileList.First();
+ while( pString )
+ {
+ unlink( pString->GetBuffer() );
+ delete pString;
+ pString = aTmpFileList.Next();
+ }
+
+ pTC->pEH->SetListFile( NULL );
+
+ if( fListing )
+ fclose( fListing );
+
+ if( fExitFile )
+ fclose( fExitFile );
+ if( aTmpOutputRc.Len() )
+ unlink( aTmpOutputRc.GetBuffer() );
+ if( aTmpOutputHxx.Len() )
+ unlink( aTmpOutputHxx.GetBuffer() );
+ if( aTmpOutputCxx.Len() )
+ unlink( aTmpOutputCxx.GetBuffer() );
+ if( aTmpOutputRcCtor.Len() )
+ unlink( aTmpOutputRcCtor.GetBuffer() );
+ if( aTmpOutputSrc.Len() )
+ unlink( aTmpOutputSrc.GetBuffer() );
+}
+
+/*************************************************************************
+|*
+|* RscCompiler::Start()
+|*
+|* Beschreibung Datei in Kommandozeile aendern
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+ERRTYPE RscCompiler::Start()
+{
+ ERRTYPE aError;
+ ByteString* pString;
+ RscFile* pFName;
+
+ if( PRINTSYNTAX_FLAG & pCL->nCommands )
+ {
+#ifndef W30
+ pTC->WriteSyntax( stdout );
+printf( "khg\n" );
+#endif
+ return ERR_OK;
+ }
+
+ // Kein Parameter, dann Hilfe
+ pString = pCL->aInputList.First();
+ if( !pString )
+ pTC->pEH->FatalError( ERR_NOINPUT, RscId() );
+
+ while( pString )
+ {
+ pTC->aFileTab.NewCodeFile( *pString );
+ pString = pCL->aInputList.Next();
+ }
+
+ if( !(pCL->nCommands & NOSYNTAX_FLAG) )
+ {
+ if( pCL->nCommands & NOPREPRO_FLAG )
+ {
+
+ pTC->pEH->SetListFile( NULL );
+
+ pFName = pTC->aFileTab.First();
+ while( pFName && aError.IsOk() )
+ {
+ if( !pFName->bScanned && !pFName->IsIncFile() )
+ {
+ aError = IncludeParser(
+ pTC->aFileTab.GetIndex( pFName )
+ );
+ // Currentzeiger richtig setzen
+ pTC->aFileTab.Seek( pFName );
+ };
+ pFName = pTC->aFileTab.Next();
+ };
+
+ pTC->pEH->SetListFile( fListing );
+ }
+ };
+
+ pTC->pEH->StdOut( "Files: " );
+ pFName = pTC->aFileTab.First();
+ while( pFName )
+ {
+ pTC->pEH->StdOut( pFName->aFileName.GetBuffer() );
+ pTC->pEH->StdOut( " " );
+ pFName = pTC->aFileTab.Next();
+ };
+ pTC->pEH->StdOut( "\n" );
+
+ if( aError.IsOk() )
+ aError = CheckSyntax();
+
+ if( aError.IsOk() )
+ aError = Link();
+
+ if( aError.IsOk() )
+ EndCompile();
+
+ if( aError.IsError() )
+ pTC->pEH->Error( ERR_ERROR, NULL, RscId() );
+
+ return( aError );
+}
+/*************************************************************************
+|*
+|* RscCmdLine::EndCompile()
+|*
+|* Beschreibung Datei in Kommandozeile aendern
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+void RscCompiler::EndCompile()
+{
+ if( pCL->aOutputSrs.Len() && (pCL->nCommands & NOLINK_FLAG) )
+ {
+ pTC->pEH->StdOut( "Writing file " );
+ pTC->pEH->StdOut( pCL->aOutputSrs.GetBuffer() );
+ pTC->pEH->StdOut( ".\n" );
+
+ // kopiere von TMP auf richtigen Namen
+ unlink( pCL->aOutputSrs.GetBuffer() ); // Zieldatei loeschen
+ if( !(pCL->nCommands & NOSYNTAX_FLAG) )
+ {
+ FILE * foutput;
+ RscFile * pFN;
+
+ if( NULL == (foutput = fopen( pCL->aOutputSrs.GetBuffer(), "w" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), pCL->aOutputSrs.GetBuffer() );
+ else
+ {
+ // Schreibe Datei
+ pFN = pTC->aFileTab.First();
+ while( pFN )
+ {
+ if( !pFN->IsIncFile() )
+ {
+ pTC->WriteSrc( foutput, NOFILE_INDEX,
+ RTL_TEXTENCODING_UNICODE, FALSE );
+ break; // ?T 281091MM nur eine Src-Datei
+ }
+ };
+
+ fclose( foutput );
+ };
+ };
+ }
+
+ if ( aTmpOutputHxx.Len() )
+ {
+ pTC->pEH->StdOut( "Writing file " );
+ pTC->pEH->StdOut( pCL->aOutputHxx.GetBuffer() );
+ pTC->pEH->StdOut( ".\n" );
+
+ // kopiere von TMP auf richtigen Namen
+ unlink( pCL->aOutputHxx.GetBuffer() ); // Zieldatei loeschen
+ Append( pCL->aOutputHxx, aTmpOutputHxx );
+ unlink( aTmpOutputHxx.GetBuffer() );// TempDatei loeschen
+ aTmpOutputHxx = ByteString();
+ }
+
+ if( aTmpOutputCxx.Len() )
+ {
+ pTC->pEH->StdOut( "Writing file " );
+ pTC->pEH->StdOut( pCL->aOutputCxx.GetBuffer() );
+ pTC->pEH->StdOut( ".\n" );
+
+ // kopiere von TMP auf richtigen Namen
+ unlink( pCL->aOutputCxx.GetBuffer() ); // Zieldatei loeschen
+ Append( pCL->aOutputCxx, aTmpOutputCxx );
+ unlink( aTmpOutputCxx.GetBuffer() );// TempDatei loeschen
+ aTmpOutputCxx = ByteString();
+ }
+
+ if( aTmpOutputRcCtor.Len() )
+ {
+ pTC->pEH->StdOut( "Writing file " );
+ pTC->pEH->StdOut( pCL->aOutputRcCtor.GetBuffer() );
+ pTC->pEH->StdOut( ".\n" );
+
+ // kopiere von TMP auf richtigen Namen
+ unlink( pCL->aOutputRcCtor.GetBuffer() ); // Zieldatei loeschen
+ Append( pCL->aOutputRcCtor, aTmpOutputRcCtor );
+ unlink( aTmpOutputRcCtor.GetBuffer() );// TempDatei loeschen
+ aTmpOutputRcCtor = ByteString();
+ }
+
+ if( aTmpOutputSrc.Len() )
+ {
+ // kopiere von TMP auf richtigen Namen
+ unlink( pCL->aOutputSrc.GetBuffer() ); // Zieldatei loeschen
+ Append( pCL->aOutputSrc, aTmpOutputSrc );
+ unlink( aTmpOutputSrc.GetBuffer() );// TempDatei loeschen
+ aTmpOutputSrc = ByteString();
+ }
+
+ if( aTmpOutputRc.Len() )
+ {
+ // kopiere von TMP auf richtigen Namen
+ unlink( pCL->aOutputRc.GetBuffer() ); // Zieldatei loeschen
+ Append( pCL->aOutputRc, aTmpOutputRc );
+ unlink( aTmpOutputRc.GetBuffer() ); // TempDatei loeschen
+ aTmpOutputRc = ByteString();
+ }
+}
+
+/*************************************************************************
+|*
+|* RscCompiler::IncludeParser()
+|*
+|* Beschreibung
+|* Ersterstellung MM 21.06.91
+|* Letzte Aenderung MM 21.06.91
+|*
+*************************************************************************/
+ERRTYPE RscCompiler :: IncludeParser( ULONG lFileKey )
+{
+ FILE * finput;
+ RscFile * pFName;
+ ERRTYPE aError;
+
+ pFName = pTC->aFileTab.Get( lFileKey );
+ if( !pFName )
+ aError = ERR_ERROR;
+ else if( !pFName->bScanned )
+ {
+ finput = fopen( pFName->aPathName.GetBuffer(), "r" );
+ if( !finput )
+ {
+ aError = ERR_OPENFILE;
+ pTC->pEH->Error( aError, NULL, RscId(),
+ pFName->aPathName.GetBuffer() );
+ }
+ else
+ {
+ RscFile * pFNTmp;
+ ByteString aPathName;
+ RscDepend * pDep;
+ RscFileInst aFileInst( pTC, lFileKey, lFileKey,
+ finput, pCL->nSourceCharSet );
+
+ pFName->bScanned = TRUE;
+ ::IncludeParser( &aFileInst );
+ fclose( finput );
+
+ // Include-Pfad durchsuchen
+ pDep = pFName->First();
+ while( pDep )
+ {
+ pFNTmp = pTC->aFileTab.GetFile( pDep->GetFileKey() );
+ pDep = pFName->Next();
+ }
+
+ pDep = pFName->First();
+ while( pDep )
+ {
+ pFNTmp = pTC->aFileTab.GetFile( pDep->GetFileKey() );
+ // Kein Pfad und Include Datei
+ if( pFNTmp && !pFNTmp->bLoaded )
+ {
+ UniString aUniFileName( pFNTmp->aFileName, RTL_TEXTENCODING_ASCII_US );
+ DirEntry aFullName( aUniFileName );
+ if ( aFullName.Find( UniString( pCL->aPath, RTL_TEXTENCODING_ASCII_US ) ) )
+ pFNTmp->aPathName = ByteString( aFullName.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ else
+ aError = ERR_OPENFILE;
+ }
+ pDep = pFName->Next();
+ };
+ };
+ };
+
+ return aError;
+}
+
+/*************************************************************************
+|*
+|* RscCompiler :: ParseOneFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.06.91
+|* Letzte Aenderung MM 26.06.91
+|*
+*************************************************************************/
+ERRTYPE RscCompiler :: ParseOneFile( ULONG lFileKey )
+{
+ FILE * finput = NULL;
+ ERRTYPE aError;
+ RscFile * pFName;
+
+ pFName = pTC->aFileTab.Get( lFileKey );
+ if( !pFName )
+ aError = ERR_ERROR;
+ else if( !pFName->bLoaded )
+ {
+ RscDepend * pDep;
+
+ //Include-Dateien vorher lesen
+ pFName->bLoaded = TRUE; //Endlos Rekursion vermeiden
+ pDep = pFName->First();
+ while( pDep && aError.IsOk() )
+ {
+ aError = ParseOneFile( pDep->GetFileKey() );
+ pFName->Seek( pDep );
+ pDep = pFName->Next();
+ }
+
+ if( aError.IsError() )
+ pFName->bLoaded = FALSE; //bei Fehler nicht geladenen
+ else
+ {
+ finput = fopen( pFName->aPathName.GetBuffer(), "r" );
+ if( !finput )
+ {
+ pTC->pEH->Error( ERR_OPENFILE, NULL, RscId(),
+ pFName->aPathName.GetBuffer() );
+ aError = ERR_OPENFILE;
+ }
+ else
+ {
+ RscFileInst aFileInst( pTC, lFileKey, lFileKey, finput,
+ pCL->nSourceCharSet );
+ // Parser schreibt Punkte fuer jedes Objekt auf
+ // unterster Ebene nach stdout
+ pTC->pEH->StdOut( "reading file " );
+ pTC->pEH->StdOut( pFName->aPathName.GetBuffer() );
+ pTC->pEH->StdOut( " " );
+
+ aError = ::parser( &aFileInst );
+ if( aError.IsError() )
+ pTC->Delete( lFileKey );//Resourceobjekte loeschen
+ pTC->pEH->StdOut( "\n" );
+ fclose( finput );
+ };
+ };
+ };
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscCompiler :: CheckSyntax()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.02.91
+|* Letzte Aenderung MM 07.02.91
+|*
+*************************************************************************/
+ERRTYPE RscCompiler::CheckSyntax(){
+ ERRTYPE aError;
+ RscFile * pFName;
+
+ // Parser schreibt Punkte fuer jedes Objekt auf
+ // unterster Ebene nach stdout
+
+ //Eingabedateien liegen als Liste vor
+ pFName = pTC->aFileTab.First();
+ while( pFName && aError.IsOk() ){
+ if( !pFName->IsIncFile() ){
+ aError = ParseOneFile( pTC->aFileTab.GetIndex( pFName ) );
+ // Currentzeiger richtig setzen
+ pTC->aFileTab.Seek( pFName );
+ };
+ pFName = pTC->aFileTab.Next();
+ };
+
+ return( aError );
+}
+
+/*************************************************************************
+|*
+|* RscCompiler :: Link()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.02.91
+|* Letzte Aenderung MM 07.02.91
+|*
+*************************************************************************/
+ERRTYPE RscCompiler::Link()
+{
+ FILE * foutput;
+ ERRTYPE aError;
+
+ if( !(pCL->nCommands & NOLINK_FLAG) )
+ {
+ // rc-Datei schreiben
+ aTmpOutputRc = ::GetTmpFileName();
+ if ( NULL == (fExitFile = foutput = fopen( aTmpOutputRc.GetBuffer(), "wb" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputRc.GetBuffer() );
+
+ pTC->pEH->StdOut( "Generating .rc file\n" );
+
+ // Schreibe Datei
+ aError = pTC->WriteRc( foutput );
+
+ fclose( foutput );
+ fExitFile = NULL;
+ };
+
+ // hxx-Datei schreiben
+ if( pCL->aOutputHxx.Len() && aError.IsOk() )
+ {
+ aTmpOutputHxx = ::GetTmpFileName();
+ if ( NULL == (fExitFile = foutput = fopen( aTmpOutputHxx.GetBuffer(), "w" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputHxx.GetBuffer() );
+
+ pTC->pEH->StdOut( "Generating .hxx file\n" );
+
+ // Schreibe Datei
+ aError = pTC->WriteHxx( foutput, NOFILE_INDEX );
+
+ fclose( foutput );
+ fExitFile = NULL;
+ }
+
+ // cxx-Datei schreiben
+ if( pCL->aOutputCxx.Len() && aError.IsOk() )
+ {
+ aTmpOutputCxx = ::GetTmpFileName();
+ if ( NULL == (fExitFile = foutput = fopen( aTmpOutputCxx.GetBuffer(), "w" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputCxx.GetBuffer() );
+
+ pTC->pEH->StdOut( "Generating .cxx file\n" );
+
+ ByteString aHxx = pCL->aOutputHxx;
+ if( !aHxx.Len() )
+ {
+ UniString aUniOutputCxx( pCL->aOutputCxx, RTL_TEXTENCODING_ASCII_US );
+ aHxx = ByteString( DirEntry( aUniOutputCxx ).GetBase(), RTL_TEXTENCODING_ASCII_US );
+ aHxx += ".hxx";
+ }
+
+ // Schreibe Datei
+ aError = pTC->WriteCxx( foutput, NOFILE_INDEX, aHxx );
+
+ fclose( foutput );
+ fExitFile = NULL;
+ }
+
+ // RcCtor-Datei schreiben
+ if( pCL->aOutputRcCtor.Len() && aError.IsOk() )
+ {
+ aTmpOutputRcCtor = ::GetTmpFileName();
+ if ( NULL == (fExitFile = foutput = fopen( aTmpOutputRcCtor.GetBuffer(), "w" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputRcCtor.GetBuffer() );
+
+ pTC->pEH->StdOut( "Generating .cxx ressource constructor file\n" );
+
+ // Schreibe Datei
+ pTC->WriteRcCtor( foutput );
+
+ fclose( foutput );
+ fExitFile = NULL;
+ }
+
+ // src-Datei schreiben
+ if( pCL->aOutputSrc.Len() && aError.IsOk() )
+ {
+ aTmpOutputSrc = ::GetTmpFileName();
+ if ( NULL == (fExitFile = foutput = fopen( aTmpOutputSrc.GetBuffer(), "w" )) )
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTmpOutputSrc.GetBuffer() );
+
+ // Schreibe Datei
+ pTC->WriteSrc( foutput, NOFILE_INDEX, RTL_TEXTENCODING_UNICODE );
+
+ fclose( foutput );
+ fExitFile = NULL;
+ };
+
+ return( aError );
+}
+
+/********************************************************************/
+/* */
+/* Function : Append( ) */
+/* */
+/* Parameters : psw - pointer to a preprocessor switch */
+/* */
+/* Description : appends text files */
+/********************************************************************/
+void RscCompiler::Append( const ByteString& rOutputSrs,
+ const ByteString& rTmpFile )
+{
+ if( !::Append( rOutputSrs, rTmpFile ) )
+ {
+ ByteString aTemp = rOutputSrs;
+ aTemp += " or ";
+ aTemp += rTmpFile;
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), aTemp.GetBuffer() );
+ }
+}
+
+/********************************************************************/
+/* */
+/* Function : GetTmpFileName() */
+/* */
+/* Description : Packt einen Dateinamen in Tmp-Dateiliste. */
+/* */
+/********************************************************************/
+ByteString RscCompiler::GetTmpFileName()
+{
+ ByteString aFileName;
+
+ aFileName = ::GetTmpFileName();
+ aTmpFileList.Insert( new ByteString( aFileName ) );
+ return( aFileName );
+}
+
+/********************************************************************/
+/* */
+/* Function : BOOL openinput() */
+/* */
+/* Description : Check to see if the input file exists and can */
+/* be opened for reading. */
+/********************************************************************/
+
+void RscCompiler::OpenInput( const ByteString& rInput )
+{
+ FILE *fp;
+ /* try to open the input file */
+ if( NULL == (fp = fopen( rInput.GetBuffer(), "r")))
+ pTC->pEH->FatalError( ERR_OPENFILE, RscId(), rInput.GetBuffer() );
+
+ fclose( fp );
+}
+
diff --git a/rsc/source/tools/makefile.mk b/rsc/source/tools/makefile.mk
new file mode 100644
index 000000000000..3ac670ed2827
--- /dev/null
+++ b/rsc/source/tools/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=rsc
+TARGET=rsctoo
+
+# --- Settings ------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+OBJFILES= $(OBJ)$/rschash.obj \
+ $(OBJ)$/rsctree.obj \
+ $(OBJ)$/rsctools.obj \
+ $(OBJ)$/rscchar.obj \
+ $(OBJ)$/rscdef.obj
+
+CXXFILES= rschash.cxx \
+ rsctree.cxx \
+ rsctools.cxx \
+ rscchar.cxx \
+ rscdef.cxx
+
+.INCLUDE : target.mk
diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx
new file mode 100644
index 000000000000..2ab9badbcd74
--- /dev/null
+++ b/rsc/source/tools/rscchar.cxx
@@ -0,0 +1,411 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscchar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/tools/rscchar.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.14 2000/09/17 12:51:12 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.13 2000/07/26 17:13:23 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.12 1999/09/20 16:12:22 mm
+ \X is possible in the character converter
+
+ Revision 1.11 1999/09/09 13:10:53 mm
+ UTF8 corrected
+
+ Revision 1.10 1999/09/07 13:30:06 mm
+ UniCode
+
+ Revision 1.9 1998/01/08 13:20:56 MM
+ includes angepasst
+
+
+ Rev 1.8 08 Jan 1998 13:20:56 MM
+ includes angepasst
+
+ Rev 1.7 07 Aug 1997 15:47:20 TJ
+ include
+
+ Rev 1.6 21 Nov 1995 19:50:52 TLX
+ Neuer Link
+
+ Rev 1.5 25 Aug 1993 15:31:38 mm
+ Zeichensaetze aus den tools
+
+ Rev 1.4 06 Aug 1993 13:14:56 TH
+ Equal-Tablle zwischen 200-209 jetzt richtig
+
+ Rev 1.3 19 Jul 1993 19:21:42 mm
+ \ verbessert
+
+ Rev 1.2 19 Jul 1993 16:29:46 mm
+
+ Rev 1.1 20 Aug 1992 18:18:20 mm
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+
+// Solar Definitionen
+#include <tools/solar.h>
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+
+#include <rtl/textcvt.h>
+#include <rtl/textenc.h>
+
+/*************************************************************************
+|*
+|* RscChar::MakeChar()
+|*
+|* Beschreibung Der String wird nach C-Konvention umgesetzt
+|* Ersterstellung MM 20.03.91
+|* Letzte Aenderung MM 20.03.91
+|*
+*************************************************************************/
+char * RscChar::MakeUTF8( char * pStr, UINT16 nTextEncoding )
+{
+ sal_Size nMaxUniCodeBuf = strlen( pStr ) + 1;
+ char * pOrgStr = new char[ nMaxUniCodeBuf ];
+ USHORT nOrgLen = 0;
+
+ if( nMaxUniCodeBuf * 6 > 0xFFFF )
+ RscExit( 10 );
+
+ char cOld = '1';
+ while( cOld != 0 )
+ {
+ char c;
+
+ if( *pStr == '\\' )
+ {
+ ++pStr;
+ switch( *pStr )
+ {
+ case 'a':
+ c = '\a';
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case '\\':
+ c = '\\';
+ break;
+ case '?':
+ c = '\?';
+ break;
+ case '\'':
+ c = '\'';
+ break;
+ case '\"':
+ c = '\"';
+ break;
+ default:
+ {
+ if( '0' <= *pStr && '7' >= *pStr )
+ {
+ USHORT nChar = 0;
+ USHORT i = 0;
+ while( '0' <= *pStr && '7' >= *pStr && i != 3 )
+ {
+ nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0';
+ ++pStr;
+ i++;
+ }
+ if( nChar > 255 )
+ {
+ RscMem::Free( pOrgStr );
+
+ // Wert zu gross, oder kein 3 Ziffern
+ return( NULL );
+ }
+ c = (char)nChar;
+ pStr--;
+ }
+ else if( 'x' == *pStr )
+ {
+ USHORT nChar = 0;
+ USHORT i = 0;
+ ++pStr;
+ while( isxdigit( *pStr ) && i != 2 )
+ {
+ if( isdigit( *pStr ) )
+ nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'0';
+ else if( isupper( *pStr ) )
+ nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'A' +10;
+ else
+ nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'a' +10;
+ ++pStr;
+ i++;
+ }
+ c = (char)nChar;
+ pStr--;
+ }
+ else
+ c = *pStr;
+ };
+ }
+ }
+ else
+ c = *pStr;
+ pOrgStr[ nOrgLen++ ] = c;
+ cOld = *pStr;
+ pStr++;
+ }
+
+ sal_Unicode * pUniCode = new sal_Unicode[ nMaxUniCodeBuf ];
+ rtl_TextToUnicodeConverter hConv = rtl_createTextToUnicodeConverter( nTextEncoding );
+
+ sal_uInt32 nInfo;
+ sal_Size nSrcCvtBytes;
+ sal_Size nUniSize = rtl_convertTextToUnicode( hConv, 0,
+ pOrgStr, nOrgLen,
+ pUniCode, nMaxUniCodeBuf,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT
+ | RTL_TEXTTOUNICODE_FLAGS_FLUSH,
+ &nInfo,
+ &nSrcCvtBytes );
+
+ rtl_destroyTextToUnicodeConverter( hConv );
+
+ hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 );
+ // factor fo 6 is the maximum size of an UNICODE character as utf8
+ char * pUtf8 = (char *)RscMem::Malloc( (USHORT)(nMaxUniCodeBuf * 6) );
+ UINT16 nUtf8Len = 0;
+
+ rtl_convertUnicodeToText( hConv, 0,
+ pUniCode, nUniSize,
+ pUtf8, nMaxUniCodeBuf * 6,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT
+ | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT
+ | RTL_UNICODETOTEXT_FLAGS_FLUSH,
+ &nInfo,
+ &nSrcCvtBytes );
+
+ rtl_destroyTextToUnicodeConverter( hConv );
+
+ delete pUniCode;
+ delete pOrgStr;
+ return pUtf8;
+};
+
+/*************************************************************************
+|*
+|* RscChar::MakeChar()
+|*
+|* Beschreibung Der String wird nach C-Konvention umgesetzt
+|* Ersterstellung MM 20.03.91
+|* Letzte Aenderung MM 20.03.91
+|*
+*************************************************************************/
+char * RscChar::MakeUTF8FromL( char * pStr )
+{
+ sal_Size nUniPos = 0;
+ sal_Unicode * pUniCode = new sal_Unicode[ strlen( pStr ) + 1 ];
+
+ char cOld = '1';
+ while( cOld != 0 )
+ {
+ sal_Unicode c;
+ if( *pStr == '\\' )
+ {
+ ++pStr;
+ switch( *pStr )
+ {
+ case 'a':
+ c = '\a';
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case '\\':
+ c = '\\';
+ break;
+ case '?':
+ c = '\?';
+ break;
+ case '\'':
+ c = '\'';
+ break;
+ case '\"':
+ c = '\"';
+ break;
+ default:
+ {
+ if( '0' <= *pStr && '7' >= *pStr )
+ {
+ UINT32 nChar = 0;
+ USHORT i = 0;
+ while( '0' <= *pStr && '7' >= *pStr && i != 6 )
+ {
+ nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0';
+ ++pStr;
+ i++;
+ }
+ if( nChar > 0xFFFF )
+ // Wert zu gross, oder kein 3 Ziffern
+ return( FALSE );
+ c = (UINT16)nChar;
+ pStr--;
+ }
+ else if( 'x' == *pStr || 'X' == *pStr )
+ {
+ UINT32 nChar = 0;
+ USHORT i = 0;
+ ++pStr;
+ while( isxdigit( *pStr ) && i != 4 )
+ {
+ if( isdigit( *pStr ) )
+ nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'0';
+ else if( isupper( *pStr ) )
+ nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'A' +10;
+ else
+ nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'a' +10;
+ ++pStr;
+ i++;
+ }
+ c = (UINT16)nChar;
+ pStr--;
+ }
+ else
+ c = *pStr;
+ };
+ }
+ }
+ else
+ c = *pStr;
+
+ pUniCode[ nUniPos++ ] = c;
+ cOld = *pStr;
+ pStr++;
+ }
+
+ // factor fo 6 is the maximum size of an UNICODE character as utf8
+ sal_Size nMaxUtf8Len = nUniPos * 6;
+ if( nUniPos * 6 > 0xFFFF )
+ RscExit( 10 );
+ char * pUtf8 = (char *)RscMem::Malloc( (USHORT)nMaxUtf8Len );
+ rtl_TextToUnicodeConverter hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 );
+
+ sal_uInt32 nInfo;
+ sal_Size nSrcCvtBytes;
+ sal_Size nSize = rtl_convertUnicodeToText( hConv, 0,
+ pUniCode, nUniPos,
+ pUtf8, nMaxUtf8Len,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT
+ | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT
+ | RTL_UNICODETOTEXT_FLAGS_FLUSH,
+ &nInfo,
+ &nSrcCvtBytes );
+
+ rtl_destroyUnicodeToTextConverter( hConv );
+
+ delete pUniCode;
+ return pUtf8;
+};
+
diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx
new file mode 100644
index 000000000000..13b82098a823
--- /dev/null
+++ b/rsc/source/tools/rscdef.cxx
@@ -0,0 +1,1456 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscdef.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/tools/rscdef.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.13 2000/09/17 12:51:12 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.12 2000/07/26 17:13:24 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.11 2000/07/11 17:17:36 th
+ Unicode
+
+ Revision 1.10 1997/08/27 18:17:52 MM
+ neue Headerstruktur
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// Programmuebergreifende Includes.
+#ifndef _RSCDEF_HXX
+#include <rscdef.hxx>
+#endif
+
+/****************** C o d e **********************************************/
+/****************** R s c I d ********************************************/
+BOOL RscId::bNames = TRUE;
+
+/*************************************************************************
+|*
+|* static RscId::SetNames
+|* static RscId::SetNoNames
+|*
+|* Beschreibung
+|* Ersterstellung MM 26.06.91
+|* Letzte Aenderung MM 26.06.91
+|*
+*************************************************************************/
+void RscId::SetNames( BOOL bSet ) { bNames = bSet; }
+BOOL RscId::IsSetNames() { return bNames; }
+
+/*************************************************************************
+|*
+|* RscId::GetNumber
+|*
+|* Beschreibung
+|* Ersterstellung MM 17.05.91
+|* Letzte Aenderung MM 17.05.91
+|*
+*************************************************************************/
+long RscId::GetNumber() const{
+ long lVal;
+ aExp.Evaluate( &lVal );
+ return lVal;
+}
+
+/*************************************************************************
+|*
+|* RscId::Create()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+void RscId::Create( const RscExpType & rExpType )
+{
+ aExp = rExpType;
+ if( aExp.IsDefinition() )
+ aExp.aExp.pDef->IncRef();
+ else if( aExp.IsExpression() ){
+ long lValue;
+
+ aExp.Evaluate( &lValue );
+ aExp.SetLong( lValue );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscId::Destroy()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+void RscId::Destroy(){
+ if( aExp.IsDefinition() )
+ aExp.aExp.pDef->DecRef();
+ aExp.cType = RSCEXP_NOTHING;
+}
+
+/*************************************************************************
+|*
+|* RscId::RscId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscId::RscId( const RscId& rRscId ){
+ aExp = rRscId.aExp;
+ if( aExp.IsDefinition() )
+ aExp.aExp.pDef->IncRef();
+}
+
+/*************************************************************************
+|*
+|* RscId::RscId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 25.11.91
+|*
+*************************************************************************/
+RscId::RscId( RscDefine * pDef ){
+ RscExpType aExpType;
+
+ aExpType.aExp.pDef = pDef;
+ aExpType.cType = RSCEXP_DEF;
+ Create( aExpType );
+}
+
+/*************************************************************************
+|*
+|* RscId:: =
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscId& RscId::operator = ( const RscId& rRscId ){
+ if( rRscId.aExp.IsDefinition() )
+ rRscId.aExp.aExp.pDef->IncRef();
+ Destroy();
+ aExp = rRscId.aExp;
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* RscId::operator ==
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+BOOL RscId::operator == ( const RscId& rRscId ) const
+{
+ return( GetNumber() == rRscId.GetNumber() );
+}
+
+/*************************************************************************
+|*
+|* RscId::operator <
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+BOOL RscId::operator < ( const RscId& rRscId ) const
+{
+ return( GetNumber() < rRscId.GetNumber() );
+}
+
+/*************************************************************************
+|*
+|* RscId::operator >
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+BOOL RscId::operator > ( const RscId& rRscId ) const
+{
+ return( GetNumber() > rRscId.GetNumber() );
+}
+
+/*************************************************************************
+|*
+|* RscId::long()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+RscId::operator long() const
+{
+ return( GetNumber() );
+}
+
+/*************************************************************************
+|*
+|* RscId::GetNames()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 25.11.91
+|*
+*************************************************************************/
+ByteString RscId::GetName() const
+{
+ ByteString aStr;
+
+ if ( !aExp.IsNothing() )
+ {
+ if( bNames )
+ aExp.GetMacro( aStr );
+ else
+ aStr = ByteString::CreateFromInt32( GetNumber() );
+ }
+
+ return aStr;
+}
+
+/*************************************************************************
+|*
+|* RscId::GetMacro()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 25.11.91
+|*
+*************************************************************************/
+ByteString RscId::GetMacro() const
+{
+ ByteString aStr;
+
+ if ( aExp.IsDefinition() )
+ aStr = aExp.aExp.pDef->GetMacro();
+ else
+ aExp.GetMacro( aStr );
+
+ return aStr;
+}
+
+/****************** R s c D e f i n e ************************************/
+/*************************************************************************
+|*
+|* RscDefine::RscDefine()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscDefine::RscDefine( ULONG lKey, const ByteString & rDefName, long lDefId )
+ : StringNode( rDefName )
+{
+ nRefCount = 0;
+ lFileKey = lKey;
+ lId = lDefId;
+ pExp = NULL;
+}
+
+RscDefine::RscDefine( ULONG lKey, const ByteString & rDefName,
+ RscExpression * pExpression )
+ : StringNode( rDefName )
+{
+ nRefCount = 0;
+ lFileKey = lKey;
+ pExpression->Evaluate( &lId );
+ pExp = pExpression;
+}
+
+/*************************************************************************
+|*
+|* RscDefine::~RscDefine()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscDefine::~RscDefine(){
+ if( pExp )
+ delete pExp;
+ if( nRefCount )
+ RscExit( 14 );
+}
+
+/*************************************************************************
+|*
+|* RscDefine::DecRef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+void RscDefine::DecRef(){
+ nRefCount--;
+ if( 0 == nRefCount ){
+ delete this;
+ }
+}
+
+/*************************************************************************
+|*
+|* RscDefine::DefineToNumber()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.11.91
+|* Letzte Aenderung MM 07.11.91
+|*
+*************************************************************************/
+void RscDefine::DefineToNumber()
+{
+ if( pExp )
+ delete pExp;
+ pExp = NULL;
+ SetName( ByteString::CreateFromInt32( lId ) );
+}
+
+/*************************************************************************
+|*
+|* RscDefine::ChangeMacro()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+void RscDefine::ChangeMacro( RscExpression * pExpression ){
+ if( pExp )
+ delete pExp;
+ pExp = pExpression;
+ pExp->Evaluate( &lId );
+}
+
+void RscDefine::ChangeMacro( long lIdentifier ){
+ if( pExp ){
+ delete pExp;
+ pExp = NULL;
+ }
+ lId = lIdentifier;
+}
+
+/*************************************************************************
+|*
+|* RscDefine::Evaluate()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+BOOL RscDefine::Evaluate(){
+ BOOL bRet = TRUE;
+
+ if( pExp )
+ bRet = !pExp->Evaluate( &lId );
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* RscDefine::Search()
+|*
+|* Beschreibung
+|* Ersterstellung MM 11.11.91
+|* Letzte Aenderung MM 11.11.91
+|*
+*************************************************************************/
+RscDefine * RscDefine::Search( const char * pStr ){
+ return (RscDefine *)StringNode::Search( pStr );
+}
+
+/*************************************************************************
+|*
+|* RscDefine::GetMacro()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+ByteString RscDefine::GetMacro()
+{
+ if( pExp )
+ return pExp->GetMacro();
+ return ByteString::CreateFromInt32( lId );
+}
+
+/****************** R s c D e f i n e L i s t ****************************/
+/*************************************************************************
+|*
+|* RscDefineList::New()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+RscDefine * RscDefineList::New( ULONG lFileKey, const ByteString & rDefName,
+ long lDefId, ULONG lPos )
+{
+ RscDefine * pDef;
+
+ pDef = new RscDefine( lFileKey, rDefName, lDefId );
+ pDef->IncRef();
+ Insert( pDef, lPos );
+ return pDef;
+}
+
+RscDefine * RscDefineList::New( ULONG lFileKey, const ByteString & rDefName,
+ RscExpression * pExpression, ULONG lPos )
+{
+ RscDefine * pDef;
+
+ pDef = new RscDefine( lFileKey, rDefName, pExpression );
+ pDef->IncRef();
+ Insert( pDef, lPos );
+
+ return pDef;
+}
+
+/*************************************************************************
+|*
+|* RscDefineList::Remove()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+BOOL RscDefineList::Remove( RscDefine * pDef ){
+ pDef = RscSubDefList::Remove( pDef );
+ if( pDef ){
+ pDef->DefineToNumber();
+ pDef->DecRef();
+ }
+
+ return( NULL != pDef );
+}
+
+BOOL RscDefineList::Remove( ULONG lIndex ){
+ RscDefine * pDef = RscSubDefList::Remove( lIndex );
+ if( pDef ){
+ pDef->DefineToNumber();
+ pDef->DecRef();
+ }
+
+ return( NULL != pDef );
+}
+
+BOOL RscDefineList::Remove(){
+ RscDefine * pDef;
+
+ pDef = RscSubDefList::Remove( (ULONG)0 );
+
+ if( pDef ){
+ pDef->DefineToNumber();
+ pDef->DecRef();
+ }
+ return( NULL != pDef );
+}
+
+/*************************************************************************
+|*
+|* RscDefineList::Befor()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+BOOL RscDefineList::Befor( const RscDefine * pFree,
+ const RscDefine * pDepend )
+{
+ RscDefine * pDef;
+
+ pDef = First();
+ while( pDef ){
+ if( pDef == pFree ){
+ pDef = Next();
+ while( pDef ){
+ if( pDef == pDepend )
+ return TRUE;
+ pDef = Next();
+ }
+ }
+ pDef = Next();
+ };
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscDefineList::WriteAll()
+|*
+|* Beschreibung
+|* Ersterstellung MM 28.10.91
+|* Letzte Aenderung MM 28.10.91
+|*
+*************************************************************************/
+void RscDefineList::WriteAll( FILE * fOutput )
+{
+ RscDefine * pDefEle = First();
+
+ while( pDefEle )
+ {
+ fprintf( fOutput, "#define %s %s\n",
+ pDefEle->GetName().GetBuffer(),
+ pDefEle->GetMacro().GetBuffer() );
+ pDefEle = Next();
+ };
+}
+
+/****************** R s c E x p T y p e **********************************/
+/*************************************************************************
+|*
+|* RscExpType::Evaluate()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+BOOL RscExpType::Evaluate( long * plValue ) const{
+ if( IsDefinition() ){
+ aExp.pDef->Evaluate();
+ // Eventuellen Fehler ignorieren
+ *plValue = aExp.pDef->GetNumber();
+ }
+ else if( IsExpression() )
+ return( aExp.pExp->Evaluate( plValue ) );
+ else if( IsNothing() )
+ *plValue = 0;
+ else
+ *plValue = GetLong();
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscExpType::GetMacro()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+void RscExpType::GetMacro( ByteString & rStr ) const
+{
+ ByteString aStr;
+
+ if( IsDefinition() )
+ {
+ rStr += aExp.pDef->GetName();
+ }
+ else if( IsExpression() )
+ rStr += aExp.pExp->GetMacro();
+ else if( IsNumber() )
+ rStr += ByteString::CreateFromInt32( GetLong() );
+}
+
+
+/****************** R s c E x p r e s s i o n ****************************/
+/*************************************************************************
+|*
+|* RscExpression::RscExpression()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscExpression::RscExpression( RscExpType aLE, char cOp, RscExpType aRE )
+{
+ aLeftExp = aLE;
+ cOperation = cOp;
+ aRightExp = aRE;
+ if( aLeftExp.IsDefinition() )
+ aLeftExp.aExp.pDef->IncRef();
+ if( aRightExp.IsDefinition() )
+ aRightExp.aExp.pDef->IncRef();
+}
+
+/*************************************************************************
+|*
+|* RscExpression::~RscExpression()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscExpression::~RscExpression(){
+ if( aLeftExp.IsDefinition() )
+ aLeftExp.aExp.pDef->DecRef();
+ else if( aLeftExp.IsExpression() )
+ delete aLeftExp.aExp.pExp;
+
+ if( aRightExp.IsDefinition() )
+ aRightExp.aExp.pDef->DecRef();
+ else if( aRightExp.IsExpression() )
+ delete aRightExp.aExp.pExp;
+}
+
+/*************************************************************************
+|*
+|* RscExpression::Evaluate()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+BOOL RscExpression::Evaluate( long * plValue ){
+ long lLeft;
+ long lRight;
+
+ // linken und rechten Zweig auswerten
+ if( aLeftExp.Evaluate( &lLeft ) && aRightExp.Evaluate( &lRight ) ){
+ if( cOperation == '&' )
+ *plValue = lLeft & lRight;
+ else if( cOperation == '|' )
+ *plValue = lLeft | lRight;
+ else if( cOperation == '+' )
+ *plValue = lLeft + lRight;
+ else if( cOperation == '-' )
+ *plValue = lLeft - lRight;
+ else if( cOperation == '*' )
+ *plValue = lLeft * lRight;
+ else if( cOperation == 'r' )
+ *plValue = lLeft >> lRight;
+ else if( cOperation == 'l' )
+ *plValue = lLeft << lRight;
+ else{
+ if( 0L == lRight )
+ return FALSE;
+ *plValue = lLeft / lRight;
+ };
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscExpression::GetMacro()
+|*
+|* Beschreibung
+|* Ersterstellung MM 01.11.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+ByteString RscExpression::GetMacro()
+{
+ ByteString aLeft;
+
+ // Ausgabeoptimierung
+ if( aLeftExp.IsNothing() )
+ {
+ if ( '-' == cOperation )
+ {
+ aLeft += '(';
+ aLeft += '-';
+ }
+ aRightExp.GetMacro( aLeft );
+ if( '-' == cOperation )
+ aLeft += ')';
+ }
+ else if( aRightExp.IsNothing() )
+ aLeftExp.GetMacro( aLeft );
+ else{
+ aLeft += '(';
+ // linken Zweig auswerten
+ aLeftExp.GetMacro( aLeft );
+
+ aLeft += cOperation;
+
+ aLeft += '(';
+ // rechten Zweig auswerten
+ aRightExp.GetMacro( aLeft );
+ aLeft += ')';
+
+ aLeft += ')';
+ }
+
+ return aLeft;
+}
+
+/****************** R s c F i l e ****************************************/
+/*************************************************************************
+|*
+|* RscFile::RscFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+RscFile :: RscFile(){
+ bLoaded = FALSE;
+ bIncFile = FALSE;
+ bDirty = FALSE;
+ bScanned = FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscFile::~RscFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+RscFile :: ~RscFile(){
+ RscDepend * pDep = Remove( (ULONG)0 );
+
+ while( pDep ){
+ delete pDep;
+ pDep = Remove( (ULONG)0 );
+ }
+
+ //von hinten nach vorne ist besser wegen der Abhaengigkeiten
+ //Objekte zerstoeren sich, wenn Referenzzaehler NULL
+ aDefLst.Last();
+ while( aDefLst.Remove() );
+}
+
+/*************************************************************************
+|*
+|* RscFile::Depend()
+|*
+|* Beschreibung Diese Methode gibt TRUE zurueck, wenn lDepend
+|* existiert und hinter lFree steht, oder wenn
+|* lDepend nicht existiert.
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+BOOL RscFile::Depend( ULONG lDepend, ULONG lFree ){
+ RscDepend * pDep;
+
+ pDep = Last();
+ while( pDep ){
+ if( pDep->GetFileKey() == lDepend ){
+ while( pDep ){
+ if( pDep->GetFileKey() == lFree )
+ return TRUE;
+ pDep = Prev();
+ }
+ return FALSE;
+ }
+ pDep = Prev();
+ };
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscFile::InsertDependFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.01.92
+|* Letzte Aenderung MM 06.01.92
+|*
+*************************************************************************/
+BOOL RscFile :: InsertDependFile( ULONG lIncFile, ULONG lPos )
+{
+ RscDepend * pDep;
+
+ pDep = First();
+ while( pDep ){
+ if( pDep->GetFileKey() == lIncFile )
+ return TRUE;
+ pDep = Next();
+ }
+
+ // Current-Zeiger steht auf letztem Element
+ if( lPos >= Count() ){ //letztes Element muss immer letztes bleiben
+ // Abhaengigkeit vor der letzten Position eintragen
+ Insert( new RscDepend( lIncFile ) );
+ }
+ else
+ Insert( new RscDepend( lIncFile ), lPos );
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscFile::RemoveDependFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 18.11.91
+|* Letzte Aenderung MM 18.11.91
+|*
+*************************************************************************/
+void RscFile :: RemoveDependFile( ULONG lDepFile )
+{
+
+ RscDepend * pDep = Last();
+
+ while( pDep ){
+ if( pDep->GetFileKey() == lDepFile ){
+ Remove( pDep );
+ delete pDep;
+ }
+ pDep = Prev();
+ }
+}
+
+/****************** R s c D e f T r e e **********************************/
+/*************************************************************************
+|*
+|* RscDefTree::~RscDefTree()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+RscDefTree::~RscDefTree(){
+ Remove();
+}
+
+/*************************************************************************
+|*
+|* RscDefTree::Remove()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+void RscDefTree::Remove(){
+ RscDefine * pDef;
+ while( pDefRoot ){
+ pDef = pDefRoot;
+ pDefRoot = (RscDefine *)pDefRoot->Remove( pDefRoot );
+ pDef->DecRef();
+ }
+}
+
+/*************************************************************************
+|*
+|* RscDefTree::~Search()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+RscDefine * RscDefTree::Search( const char * pName ){
+ if( pDefRoot )
+ return pDefRoot->Search( pName );
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* RscDefTree::Insert()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+void RscDefTree::Insert( RscDefine * pDef ){
+ if( pDefRoot )
+ pDefRoot->Insert( pDef );
+ else
+ pDefRoot = pDef;
+ pDef->IncRef();
+}
+
+/*************************************************************************
+|*
+|* RscDefTree::Remove()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+void RscDefTree::Remove( RscDefine * pDef ){
+ if( pDefRoot ){
+ //falls pDef == pDefRoot
+ pDefRoot = (RscDefine *)pDefRoot->Remove( pDef );
+ }
+ pDef->DecRef();
+}
+
+/*************************************************************************
+|*
+|* RscDefTree::Evaluate()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.11.91
+|* Letzte Aenderung MM 12.11.91
+|*
+*************************************************************************/
+BOOL RscDefTree::Evaluate( RscDefine * pDef ){
+ if( pDef ){
+ if( !Evaluate( (RscDefine *)pDef->Left() ) )
+ return FALSE;
+ if( !Evaluate( (RscDefine *)pDef->Right() ) )
+ return FALSE;
+ };
+ return TRUE;
+}
+
+BOOL RscDefTree::Evaluate(){
+ return Evaluate( pDefRoot );
+}
+
+/****************** R s c F i l e T a b **********************************/
+/*************************************************************************
+|*
+|* RscFileTab::RscFileTab()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.11.91
+|* Letzte Aenderung MM 07.11.91
+|*
+*************************************************************************/
+RscFileTab::RscFileTab(){
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::~RscFileTab()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+RscFileTab :: ~RscFileTab(){
+ RscFile * pFile;
+
+ aDefTree.Remove();
+
+ pFile = Last();
+ while( pFile ){
+ Remove( GetIndex( pFile ) );
+ delete pFile;
+ pFile = Prev();
+ };
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::Find()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+ULONG RscFileTab :: Find( const ByteString & rName )
+{
+ RscFile * pFName;
+
+ pFName = First();
+ while( pFName && (pFName->aFileName != rName) )
+ pFName = Next();
+
+ if( pFName )
+ return( GetIndex( pFName ) );
+ else
+ return( NOFILE_INDEX );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::FindDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 30.10.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscDefine * RscFileTab::FindDef( const char * pName ){
+ return aDefTree.Search( pName );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::FindDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 30.10.91
+|* Letzte Aenderung MM 01.11.91
+|*
+*************************************************************************/
+RscDefine * RscFileTab::FindDef( ULONG lFileKey, const ByteString & rName )
+{
+ RscDefine * pDef = FindDef( rName );
+
+ if( pDef )
+ //befindet sich das DEFINE in einer Include-Datei in der
+ //Datei lFileKey
+ if( Depend( lFileKey, pDef->GetFileKey() ) )
+ return pDef;
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::Depend()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.11.91
+|* Letzte Aenderung MM 08.11.91
+|*
+*************************************************************************/
+BOOL RscFileTab::Depend( ULONG lDepend, ULONG lFree ){
+ if( lDepend == lFree )
+ return TRUE;
+
+ RscFile * pFile = First();
+ while( pFile ){
+ if( !pFile->IsIncFile() ){
+ if( !pFile->Depend( lDepend, lFree ) )
+ return FALSE;
+ };
+ pFile = Next();
+ };
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::TestDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 14.01.92
+|* Letzte Aenderung MM 14.01.92
+|*
+*************************************************************************/
+BOOL RscFileTab::TestDef( ULONG lFileKey, ULONG lPos,
+ const RscDefine * pDefDec )
+{
+ if( lFileKey == pDefDec->GetFileKey() ){
+ RscFile * pFile = GetFile( pDefDec->GetFileKey() );
+ if( pFile && (lPos <= pFile->aDefLst.GetPos( (RscDefine *)pDefDec ))
+ && (lPos != LIST_APPEND) )
+ return FALSE;
+ }
+ else if( !Depend( lFileKey, pDefDec->GetFileKey() ) )
+ return FALSE;
+
+ return TestDef( lFileKey, lPos, pDefDec->pExp );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::TestDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 14.01.92
+|* Letzte Aenderung MM 14.01.92
+|*
+*************************************************************************/
+BOOL RscFileTab::TestDef( ULONG lFileKey, ULONG lPos,
+ const RscExpression * pExpDec )
+{
+ if( !pExpDec )
+ return TRUE;
+
+ if( pExpDec->aLeftExp.IsExpression() )
+ if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pExp ) )
+ return FALSE;
+
+ if( pExpDec->aLeftExp.IsDefinition() )
+ if( !TestDef( lFileKey, lPos, pExpDec->aLeftExp.aExp.pDef ) )
+ return FALSE;
+
+ if( pExpDec->aRightExp.IsExpression() )
+ if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pExp ) )
+ return FALSE;
+
+ if( pExpDec->aRightExp.IsDefinition() )
+ if( !TestDef( lFileKey, lPos, pExpDec->aRightExp.aExp.pDef ) )
+ return FALSE;
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::NewDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+RscDefine * RscFileTab::NewDef( ULONG lFileKey, const ByteString & rDefName,
+ long lId, ULONG lPos )
+{
+ RscDefine * pDef = FindDef( rDefName );
+
+ if( !pDef ){
+ RscFile * pFile = GetFile( lFileKey );
+
+ if( pFile ){
+ pDef = pFile->aDefLst.New( lFileKey, rDefName, lId, lPos );
+ aDefTree.Insert( pDef );
+ }
+ }
+ else
+ pDef = NULL;
+
+ return( pDef );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::NewDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+RscDefine * RscFileTab::NewDef( ULONG lFileKey, const ByteString & rDefName,
+ RscExpression * pExp, ULONG lPos )
+{
+ RscDefine * pDef = FindDef( rDefName );
+
+ if( !pDef ){
+ //Macros in den Expressions sind definiert ?
+ if( TestDef( lFileKey, lPos, pExp ) ){
+ RscFile * pFile = GetFile( lFileKey );
+
+ if( pFile ){
+ pDef = pFile->aDefLst.New( lFileKey, rDefName, pExp, lPos );
+ aDefTree.Insert( pDef );
+ }
+ }
+ }
+ else
+ pDef = NULL;
+
+ if( !pDef ){
+ // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird
+ // geloescht werden
+ delete pExp;
+ }
+ return( pDef );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::IsDefUsed()
+|*
+|* Beschreibung
+|* Ersterstellung MM 22.11.91
+|* Letzte Aenderung MM 22.11.91
+|*
+*************************************************************************/
+BOOL RscFileTab::IsDefUsed( const ByteString & rDefName )
+{
+ RscDefine * pDef = FindDef( rDefName );
+
+ if( pDef )
+ return( pDef->GetRefCount() != 2 );
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::DeleteDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 11.11.91
+|* Letzte Aenderung MM 11.11.91
+|*
+*************************************************************************/
+void RscFileTab::DeleteDef( const ByteString & rDefName )
+{
+ RscDefine * pDef = FindDef( rDefName );
+ RscFile * pFile;
+
+ if( pDef ){
+ pFile = GetFile( pDef->GetFileKey() );
+ if( pFile ){
+ aDefTree.Remove( pDef );
+ pFile->aDefLst.Remove( pDef );
+ }
+ };
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::ChangeDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 11.11.91
+|*
+*************************************************************************/
+BOOL RscFileTab::ChangeDef( const ByteString & rDefName, long lId )
+{
+ RscDefine * pDef = FindDef( rDefName );
+
+ if( pDef ){
+ pDef->ChangeMacro( lId );
+ //alle Macros neu bewerten
+ return aDefTree.Evaluate();
+ };
+ return( FALSE );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::ChangeDef()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 11.11.91
+|*
+*************************************************************************/
+BOOL RscFileTab::ChangeDef( const ByteString & rDefName,
+ RscExpression * pExp )
+{
+ RscDefine * pDef = FindDef( rDefName );
+ RscFile * pFile;
+ ULONG lPos;
+
+ if( pDef ){
+ pFile = GetFile( pDef->GetFileKey() );
+ if( pFile )
+ lPos = pFile->aDefLst.GetPos( pDef );
+ //Macros in den Expressions sind definiert ?
+ if( TestDef( pDef->GetFileKey(), lPos, pExp ) ){
+ pDef->ChangeMacro( pExp );
+ //alle Macros neu bewerten
+ return aDefTree.Evaluate();
+ }
+ };
+
+ // pExp wird immer Eigentum und muss, wenn es nicht benoetigt wird
+ // geloescht werden
+ delete pExp;
+
+ return( FALSE );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::ChangeDefName()
+|*
+|* Beschreibung
+|* Ersterstellung MM 04.11.91
+|* Letzte Aenderung MM 04.11.91
+|*
+*************************************************************************/
+BOOL RscFileTab::ChangeDefName( const ByteString & rDefName,
+ const ByteString & rNewName )
+{
+ RscDefine * pDef = FindDef( rDefName );
+
+ //Name gefunden ?
+ if( pDef ){
+ // und neuer Name noch nicht bekannt ?
+ if( !FindDef( pDef->GetFileKey(), rNewName ) ){
+ aDefTree.Remove( pDef );
+ pDef->SetName( rNewName );
+ aDefTree.Insert( pDef );
+ return( TRUE );
+ }
+ };
+
+ return( FALSE );
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::DeleteFileContext()
+|*
+|* Beschreibung
+|* Ersterstellung MM 09.12.91
+|* Letzte Aenderung MM 09.12.91
+|*
+*************************************************************************/
+void RscFileTab :: DeleteFileContext( ULONG lFileKey ){
+ RscFile * pFName;
+
+ pFName = GetFile( lFileKey );
+ if( pFName ){
+ RscDefine * pDef;
+
+ pDef = pFName->aDefLst.First();
+ while( pDef ){
+ aDefTree.Remove( pDef );
+ pDef = pFName->aDefLst.Next();
+ };
+ while( pFName->aDefLst.Remove( (ULONG)0 ) );
+ }
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::DeleteFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+void RscFileTab :: DeleteFile( ULONG lFileKey ){
+ RscFile * pFName;
+
+ //Defines freigeben
+ DeleteFileContext( lFileKey );
+
+ //Schleife ueber alle Abhaengigkeiten
+ pFName = First();
+ while( pFName ){
+ pFName->RemoveDependFile( lFileKey );
+ pFName = Next();
+ };
+
+ pFName = Remove( lFileKey );
+ if( pFName )
+ delete pFName;
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::NewCodeFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+ULONG RscFileTab :: NewCodeFile( const ByteString & rName )
+{
+ ULONG lKey;
+ RscFile * pFName;
+
+ lKey = Find( rName );
+ if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey )
+ {
+ pFName = new RscFile();
+ pFName->aFileName = rName;
+ pFName->aPathName = rName;
+ lKey = Insert( pFName );
+ pFName->InsertDependFile( lKey, LIST_APPEND );
+ }
+ return lKey;
+}
+
+/*************************************************************************
+|*
+|* RscFileTab::NewIncFile()
+|*
+|* Beschreibung
+|* Ersterstellung MM 16.05.91
+|* Letzte Aenderung MM 16.05.91
+|*
+*************************************************************************/
+ULONG RscFileTab :: NewIncFile( const ByteString & rName,
+ const ByteString & rPath )
+{
+ ULONG lKey;
+ RscFile * pFName;
+
+ lKey = Find( rName );
+ if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey )
+ {
+ pFName = new RscFile();
+ pFName->aFileName = rName;
+ pFName->aPathName = rPath;
+ pFName->SetIncFlag();
+ lKey = Insert( pFName );
+ pFName->InsertDependFile( lKey, LIST_APPEND );
+ }
+ return lKey;
+}
diff --git a/rsc/source/tools/rschash.cxx b/rsc/source/tools/rschash.cxx
new file mode 100644
index 000000000000..c47b078db082
--- /dev/null
+++ b/rsc/source/tools/rschash.cxx
@@ -0,0 +1,440 @@
+/*************************************************************************
+ *
+ * $RCSfile: rschash.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/tools/rschash.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.7 2000/09/17 12:51:12 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.6 2000/07/26 17:13:24 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.5 1997/08/27 18:17:52 MM
+ neue Headerstruktur
+
+
+ Rev 1.4 27 Aug 1997 18:17:52 MM
+ neue Headerstruktur
+
+ Rev 1.3 21 Nov 1995 19:50:48 TLX
+ Neuer Link
+
+ Rev 1.2 25 Aug 1993 15:31:02 mm
+ Fehler und Warnings beseitigt
+
+ Rev 1.1 03 Jun 1993 15:45:48 mm
+ Fehler in Test_HashId verbessert
+
+ Rev 1.0 10 Aug 1992 07:18:56 MM
+ Initial revision.
+
+ Rev 1.6 23 Mar 1992 15:25:54 MM
+
+ Rev 1.5 26 Nov 1991 08:42:22 MM
+ Methode Test mit char* und void* Argument
+
+ Rev 1.4 11 Sep 1991 12:40:52 MM
+
+ Rev 1.3 31 Jul 1991 15:37:10 MM
+
+ Rev 1.2 24 Jul 1991 10:10:52 MM
+ Ausgabe auskommentiert
+
+ Rev 1.1 18 Jul 1991 12:55:24 MM
+ Fehler mit (BOOL) beseitigt
+
+ Rev 1.0 14 Jun 1991 16:20:56 MM
+ Initial revision.
+
+ Rev 1.2 22 Mar 1991 11:41:44 MM
+
+ Rev 1.1 25 Feb 1991 13:47:12 MM
+
+ Rev 1.0 08 Feb 1991 13:12:06 MM
+ Initial revision.
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+// Programmabh„ngige Includes.
+#ifndef _RSCHASH_HXX
+#include <rschash.hxx>
+#endif
+
+/****************** C O D E **********************************************/
+/*************************************************************************
+|*
+|* HashTabel::HashTabel()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+HashTabel :: HashTabel( USHORT nMaxEntries ){
+ nMax = nMaxEntries; // set max entries
+ nFill = 0; // no entries
+ lTry = 0;
+ lAsk = 0;
+}
+
+/*************************************************************************
+|*
+|* HashTabel::~HashTabel()
+|*
+|* Beschreibung
+|* Ersterstellung MM 17.07.91
+|* Letzte Aenderung MM 17.07.91
+|*
+*************************************************************************/
+HashTabel :: ~HashTabel(){
+#ifdef DOS
+/*
+ printf( "Maximum: %d, Fuellung: %d\n", nMax, nFill );
+ printf( "Anfragen: %ld, Versuche: %ld", lAsk, lTry );
+ if( lTry != 0 )
+ printf( ", V/E = %ld\n", lTry / lAsk );
+*/
+#endif
+}
+
+/*************************************************************************
+|*
+|* HashTabel::Test_Insert()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+HASHID HashTabel::Test_Insert( const void * pElement, BOOL bInsert )
+{
+ USHORT nHash;
+ USHORT nIndex;
+ USHORT nLoop;
+
+ lAsk++;
+ lTry++;
+
+ nHash = HashFunc( pElement );
+ nIndex = nHash % nMax;
+
+ nLoop = 0; // divide to range
+ while( (nMax != nLoop) && IsEntry( nIndex ) )
+ { // is place occupied
+ if( EQUAL == Compare( pElement, nIndex ) ) // is element in tabel
+ return( nIndex ); // place of Element
+ nLoop++;
+ lTry++;
+ nIndex = (USHORT)(nIndex + nHash + 7) % nMax;
+ }
+
+ if( bInsert )
+ {
+ if( nMax == nLoop ) // is tabel full
+ RscExit( 11 );
+ nFill++;
+ return( nIndex ); // return free place
+ }
+ return( HASH_NONAME );
+}
+
+/*************************************************************************
+|*
+|* HashTabel::Test()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 15.05.91
+|* Letzte Aenderung MM 15.05.91
+|*
+*************************************************************************/
+HASHID HashTabel::Test( const void * pElement ){
+ return( Test_Insert( pElement, FALSE ) );
+}
+
+/*************************************************************************
+|*
+|* HashTabel::Insert()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+HASHID HashTabel::Insert( const void * pElement ){
+// return free place in Tabel or the place, if Element is in the tabel
+ return( Test_Insert( pElement, TRUE ) );
+}
+
+/*************************************************************************
+|*
+|* HashString::HashString()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+HashString::HashString( USHORT nMaxEntries ) : HashTabel( nMaxEntries ){
+ if( (long)nMaxEntries * sizeof( char * ) >= 0x10000 ){
+ // can't allocate more then 64k - 1 Bytes
+ RscExit( 12 );
+ }
+ // allocate
+
+ ppStr = (char **)RscMem::Malloc( nMaxEntries * sizeof( char * ) );
+
+ memset( ppStr, 0, nMaxEntries * sizeof( char * ) );
+ paSC = new StringCon( (USHORT)40000 );
+}
+
+/*************************************************************************
+|*
+|* ~HashString::HashString()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 02.06.91
+|* Letzte Aenderung MM 02.06.91
+|*
+*************************************************************************/
+HashString::~HashString(){
+ delete paSC;
+ RscMem::Free( (void *)ppStr );
+}
+
+/*************************************************************************
+|*
+|* HashString::HashFunc()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+USHORT HashString :: HashFunc( const void * pElement ){
+ const char *pStr;
+ USHORT nHash = 0; // hash value
+
+ pStr = (const char *)pElement;
+ while( *pStr ){
+ nHash ^= toupper( *pStr ) - 'A';
+ if( *++pStr ){
+ nHash ^= (toupper( *pStr ) - 'A') << 4;
+ if( *++pStr )
+ nHash ^= (toupper( *pStr ) - 'A') << 8;
+ }
+ }
+ return( nHash );
+}
+
+/*************************************************************************
+|*
+|* HashString::IsEntry()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+BOOL HashString :: IsEntry( HASHID nIndex ){
+// return TRUE if place is occupied
+// return FALSE if place is FREE
+ // ppStr[ nIndex ] == pointer to stringtabel
+ return( NULL != ppStr[ nIndex ] );
+}
+
+/*************************************************************************
+|*
+|* HashString::Insert()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+HASHID HashString :: Insert( const char * pElement ){
+ HASHID nIndex;
+
+ nIndex = HashTabel::Insert( (const void *)pElement );
+ if( !IsEntry( nIndex ) )// is place not occupied ?
+ // put string in the string tabel
+ ppStr[ nIndex ] = paSC->Put( pElement );
+ return( nIndex );
+}
+
+/*************************************************************************
+|*
+|* HashString::Test()
+|*
+|* Beschreibung
+|* Ersterstellung MM 05.11.91
+|* Letzte Aenderung MM 05.11.91
+|*
+*************************************************************************/
+HASHID HashString :: Test( const char * pElement ){
+ return HashTabel::Test( (const void *)pElement );
+}
+
+/*************************************************************************
+|*
+|* HashString::Get()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+char * HashString :: Get( HASHID nIndex ){
+// return pointer to string
+ if( nIndex != HASH_NONAME )
+ return( ppStr[ nIndex ] );
+ else
+ return( NULL );
+}
+
+/*************************************************************************
+|*
+|* HashString::Get()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+COMPARE HashString :: Compare( const void * pElement, HASHID nIndex ){
+ short nCmp; // Vergleichsresultat
+
+ nCmp = rsc_stricmp( (const char *)pElement, ppStr[ nIndex ] );
+
+ if( 0 < nCmp )
+ return( GREATER );
+ else if( 0 == nCmp )
+ return( EQUAL );
+ else
+ return( LESS );
+}
+
+/*************************************************************************
+|*
+|* StringCon::StringCon()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+StringCon::StringCon( USHORT nMaxEntries ){
+ // allocate character field
+ pField = (char * )RscMem::Malloc( nMaxEntries );
+
+ nMax = nMaxEntries; // set maximum of characters
+ nFill = 0; // no character in tabel
+}
+
+/*************************************************************************
+|*
+|* StringCon::~StringCon()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 02.06.91
+|* Letzte Aenderung MM 02.06.91
+|*
+*************************************************************************/
+StringCon::~StringCon(){
+ // free character field
+ RscMem::Free( pField );
+}
+
+/*************************************************************************
+|*
+|* StringCon::Put()
+|*
+|* Beschreibung HASHTAB.DOC
+|* Ersterstellung MM 20.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+char * StringCon :: Put( const char * pStr )
+{
+// put string into the tabel
+ char * pReturn = pField + nFill; // set return value
+
+ while( nMax > (USHORT)(nFill +1) && *pStr ) // strcpy in tabel
+ pField[ nFill++ ] = *pStr++;
+ if( nMax == nFill +1 ){ // buffer overflow ?
+ RscExit( 13 );
+ }
+ else
+ pField[ nFill++ ] = '\0'; // terminate with zero.
+
+ return( pReturn ); // return pointer to string
+}
diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx
new file mode 100644
index 000000000000..dd8b545442df
--- /dev/null
+++ b/rsc/source/tools/rsctools.cxx
@@ -0,0 +1,656 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsctools.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/tools/rsctools.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.32 2000/09/17 12:51:12 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.31 2000/09/07 04:30:57 patrick.luby
+ Replaced tempnam() with tmpnam() as tempnam() keeps returning the same file name on Mac OS X.
+
+ Revision 1.30 2000/07/26 17:13:24 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.29 2000/07/11 17:17:46 th
+ Unicode
+
+ Revision 1.28 1999/12/08 15:33:51 mh
+ tmp file not in actual directory
+
+ Revision 1.27 1999/09/21 17:08:45 mm
+ Bigendian correct
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#if defined ( DOS ) || defined ( WIN ) || defined (WNT )
+#include <direct.h>
+#endif
+#if defined ( OS2 ) && !defined ( GCC )
+#include <direct.h>
+#endif
+#include <string.h>
+#include <ctype.h>
+#ifdef MAC
+#include <cursorctl.h>
+#endif
+
+#include <tools/fsys.hxx>
+
+// Include
+#ifndef _RSCDEF_HXX
+#include <rscdef.hxx>
+#endif
+#ifndef _RSCTOOLS_HXX
+#include <rsctools.hxx>
+#endif
+
+#if defined (WIN) || defined (MAC)
+#define ONLY_NEW
+#endif
+
+/****************** C o d e **********************************************/
+/*************************************************************************
+|*
+|* rsc_strnicmp()
+|*
+|* Beschreibung Vergleicht zwei Strings Case-Unabhaengig bis zu
+|* einer bestimmten Laenge
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+int rsc_strnicmp( const char *string1, const char *string2, size_t count )
+{
+ size_t i;
+
+ for( i = 0; ( i < count ) && string1[ i ] && string2[ i ] ; i++ )
+ {
+ if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
+ return( -1 );
+ else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
+ return( 1 );
+ }
+ if( i == count )
+ return( 0 );
+ else if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
+ return( -1 );
+ else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
+ return( 1 );
+ return( 0 );
+}
+
+/*************************************************************************
+|*
+|* rsc_strnicmp()
+|*
+|* Beschreibung Vergleicht zwei Strings Case-Unabhaengig
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+int rsc_stricmp( const char *string1, const char *string2 ){
+ int i;
+
+ for( i = 0; string1[ i ] && string2[ i ]; i++ ){
+ if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
+ return( -1 );
+ else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
+ return( 1 );
+ }
+ if( tolower( string1[ i ] ) < tolower( string2[ i ] ) )
+ return( -1 );
+ else if( tolower( string1[ i ] ) > tolower( string2[ i ] ) )
+ return( 1 );
+ return( 0 );
+}
+
+/*************************************************************************
+|*
+|* GetTmpFileName()
+|*
+|* Beschreibung Gibt einen String eines eindeutigen Dateinamens
+|* zurueck. Der Speicher fuer den String wird mit
+|* malloc allokiert
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MH 13.10.97
+|*
+*************************************************************************/
+ByteString GetTmpFileName()
+{
+ // Use tmpnam instead of tempnam as tempnam has some bugs in Mac OS X
+ return ByteString( tmpnam( NULL ) );
+}
+
+/********************************************************************/
+/* */
+/* Function : Append( ) */
+/* */
+/* Parameters : psw - pointer to a preprocessor switch */
+/* */
+/* Description : appends text files */
+/********************************************************************/
+BOOL Append( FILE * fDest, ByteString aTmpFile )
+{
+#define MAX_BUF 1000
+ char szBuf[ MAX_BUF ];
+ short nItems;
+ FILE *fSource;
+
+ fSource = fopen( aTmpFile.GetBuffer(), "rb" );
+ if( !fDest || !fSource ){
+ if( fSource )
+ fclose( fSource );
+ return FALSE;
+ }
+ else{
+ do{ // append
+ nItems = fread( szBuf, sizeof( char ), MAX_BUF, fSource );
+ fwrite( szBuf, sizeof( char ), nItems, fDest );
+ } while( MAX_BUF == nItems );
+
+ fclose( fSource );
+ };
+ return TRUE;
+}
+
+BOOL Append( ByteString aOutputSrs, ByteString aTmpFile )
+{
+ FILE * fDest = fopen( aOutputSrs.GetBuffer(), "ab" );
+
+ BOOL bRet = Append( fDest, aTmpFile );
+
+ if( fDest )
+ fclose( fDest );
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* InputFile
+|*
+|* Beschreibung Haengt Extension an, wenn keine da ist
+|* Parameter: pInput, der Input-Dateiname.
+|* pExt, die Extension des Ausgabenamens
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 28.06.91
+|*
+*************************************************************************/
+ByteString InputFile ( char * pInput, char * pExt )
+{
+ UniString aUniInput( pInput, RTL_TEXTENCODING_ASCII_US );
+ DirEntry aFileName( aUniInput );
+
+ if ( 0 == aFileName.GetExtension().Len() )
+ {
+ UniString aExt( pExt, RTL_TEXTENCODING_ASCII_US );
+ aFileName.SetExtension( aExt );
+ }
+
+ return ByteString( aFileName.GetFull(), RTL_TEXTENCODING_ASCII_US );
+}
+
+/*************************************************************************
+|*
+|* OutputFile
+|*
+|* Beschreibung Ersetzt Extension durch eine andere
+|* Parameter: input, der Input-Dateiname.
+|* pExt, die Extension des Ausgabenamens
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 28.06.91
+|*
+*************************************************************************/
+ByteString OutputFile ( ByteString aInput, char * pExt )
+{
+ UniString aUniInput( aInput, RTL_TEXTENCODING_ASCII_US );
+ DirEntry aFileName( aUniInput );
+
+ UniString aExt( pExt, RTL_TEXTENCODING_ASCII_US );
+ aFileName.SetExtension( aExt );
+
+ return ByteString( aFileName.GetFull(), RTL_TEXTENCODING_ASCII_US );
+}
+
+/*************************************************************************
+|*
+|* ::ResonseFile()
+|*
+|* Beschreibung Kommandozeile aufbereiten
+|* Ersterstellung MM 05.09.91
+|* Letzte Aenderung MM 05.09.91
+|*
+*************************************************************************/
+char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv,
+ USHORT nArgc )
+{
+ FILE *fFile;
+ int nItems;
+ char szBuffer[4096]; // file buffer
+ USHORT i;
+
+ // Programmname
+ ppCmd->Append( ((RscMem *)0)->Assignsw( *ppArgv, 0 ) );
+ for( i = 1; i < nArgc; i++ )
+ {
+ if( '@' == **(ppArgv +i) ){ // wenn @, dann Response-Datei
+ if( NULL == (fFile = fopen( (*(ppArgv +i)) +1, "r" )) )
+ return( (*(ppArgv +i)) );
+
+ nItems = fread( &szBuffer[ 0 ], 1, sizeof( char ), fFile );
+ while( nItems )
+ {
+ if( !isspace( szBuffer[ 0 ] ) )
+ {
+ USHORT n = 0;
+ while( nItems && !isspace( szBuffer[ n ] ) &&
+ n +1 < sizeof( szBuffer ) )
+ {
+ n++;
+ nItems = fread( &szBuffer[ n ], 1,
+ sizeof( char ), fFile );
+ }
+ szBuffer[ n ] = '\0';
+ ppCmd->Append( ((RscMem *)0)->Assignsw( szBuffer, 0 ) );
+ }
+ nItems = fread( &szBuffer[ 0 ], 1, sizeof( char ), fFile );
+ };
+
+ fclose( fFile );
+ }
+ else
+ ppCmd->Append( ((RscMem *)0)->Assignsw( *(ppArgv +i), 0 ) );
+ };
+ ppCmd->Append( (void *)0 );
+ return( NULL );
+}
+
+
+/*************** R s c M e m ********************************************/
+
+#ifdef DOS
+class RscCount {
+public:
+ long nCount;
+ RscCount(){ nCount = 0; }
+// ~RscCount(){ printf( "\nMalloczaehler: %ld\n", nCount ); }
+};
+RscCount aRscCount;
+#endif
+/*************************************************************************
+|*
+|* RscMem :: Malloc()
+|*
+|* Beschreibung Speicher allokieren
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+void * RscMem :: Malloc( USHORT nSize ){
+ char * pMem;
+
+#ifdef MAC
+ SpinCursor( 1 );
+#endif
+#ifdef DOS
+ aRscCount.nCount++;
+#endif
+#ifdef ONLY_NEW
+ pMem = new char[ nSize + sizeof( USHORT ) ];
+ *(USHORT *)pMem = nSize;
+ pMem += sizeof( USHORT );
+#else
+ if( NULL == (pMem = (char *)malloc( nSize )) )
+ RscExit( 10 );
+#endif
+ return( pMem );
+}
+
+/*************************************************************************
+|*
+|* RscMem :: Realloc()
+|*
+|* Beschreibung Speicher zusaetzlich allokieren
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+void * RscMem :: Realloc( void * pMem, USHORT nSize ){
+#ifdef MAC
+ SpinCursor( 1 );
+#endif
+#ifdef ONLY_NEW
+ char * pTmp = (char *)pMem;
+ USHORT nMin, nOldSize;
+
+ pMem = Malloc( nSize );
+ nOldSize = *(USHORT *)(pTmp - sizeof( USHORT ) );
+ nMin = (nSize < nOldSize) ? nSize : nOldSize;
+ memcpy( pMem, pTmp, nMin );
+ delete (pTmp - sizeof( USHORT ));
+#else
+#ifdef UNX
+ if( NULL == (pMem = realloc( (char*)pMem, nSize )) )
+#else
+ if( NULL == (pMem = realloc( pMem, nSize )) )
+#endif
+ RscExit( 10 );
+#endif
+ return( pMem );
+}
+
+/*************************************************************************
+|*
+|* RscMem :: Free()
+|*
+|* Beschreibung Speicher freigeben
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+void RscMem :: Free( void * pMem ){
+#ifdef DOS
+ aRscCount.nCount--;
+#endif
+#ifdef ONLY_NEW
+ delete ((char *)pMem - sizeof( USHORT ));
+#else
+#ifdef UNX
+ free( (char *)pMem );
+#else
+ free( pMem );
+#endif
+#endif
+}
+
+/*************************************************************************
+|*
+|* RscMem :: Assignsw
+|*
+|* Beschreibung Allokiert speicher fuer String und kopiert ihn
+|* Parameter: psw, der String.
+|* nExtraSpace, weiterer Speicher hinter dem String
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+char * RscMem :: Assignsw( const char *psw, short nExtraSpace )
+{
+ char * pTmp;
+
+ if( !psw )
+ psw = "";
+ /* allocate memory */
+ pTmp = (char *)Malloc( strlen( psw ) + 1 + nExtraSpace );
+ /* copy string into allocated memory*/
+ strcpy( pTmp, psw );
+ return( pTmp );
+}
+
+/*************** R s c P t r P t r **************************************/
+/*************************************************************************
+|*
+|* RscPtrPtr :: RscPtrPtr()
+|*
+|* Beschreibung Eine Tabelle mit Zeigern
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+RscPtrPtr :: RscPtrPtr(){
+ nCount = 0;
+ pMem = NULL;
+}
+
+/*************************************************************************
+|*
+|* RscPtrPtr :: ~RscPtrPtr()
+|*
+|* Beschreibung Zerst”rt eine Tabelle mit Zeigern, die Zeiger werde
+|* ebenfalls freigegebn
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+RscPtrPtr :: ~RscPtrPtr(){
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* RscPtrPtr :: Reset()
+|*
+|* Beschreibung
+|* Ersterstellung MM 03.05.91
+|* Letzte Aenderung MM 03.05.91
+|*
+*************************************************************************/
+void RscPtrPtr :: Reset(){
+ USHORT i;
+
+ if( pMem ){
+ for( i = 0; i < nCount; i++ ){
+ if( pMem[ i ] )
+ RscMem::Free( pMem[ i ] );
+ }
+ RscMem::Free( (void *)pMem );
+ };
+ nCount = 0;
+ pMem = NULL;
+}
+
+/*************************************************************************
+|*
+|* RscPtrPtr :: Append()
+|*
+|* Beschreibung Haengt einen Eintrag an.
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+USHORT RscPtrPtr :: Append( void * pBuffer ){
+ if( !pMem )
+ pMem = (void **)RscMem::Malloc( (nCount +1) * sizeof( void * ) );
+ else
+ pMem = (void **)RscMem::Realloc( (void *)pMem,
+ (USHORT)((nCount +1) * sizeof( void * )
+ ) );
+ pMem[ nCount ] = pBuffer;
+ return( nCount++ );
+}
+
+/*************************************************************************
+|*
+|* RscPtrPtr :: GetEntry()
+|*
+|* Beschreibung Liefert einen Eintrag, NULL wenn nicht vorhanden.
+|* Ersterstellung MM 13.02.91
+|* Letzte Aenderung MM 13.02.91
+|*
+*************************************************************************/
+void * RscPtrPtr :: GetEntry( USHORT nEntry ){
+ if( nEntry < nCount )
+ return( pMem[ nEntry ] );
+ return( NULL );
+}
+
+/****************** R S C W R I T E R C **********************************/
+/*************************************************************************
+|*
+|* RscWriteRc :: RscWriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+RscWriteRc::RscWriteRc( RSCBYTEORDER_TYPE nOrder )
+{
+ short nSwapTest = 1;
+ RSCBYTEORDER_TYPE nMachineOrder;
+
+ bSwap = FALSE;
+ if( nOrder != RSC_SYSTEMENDIAN )
+ {
+ if( (BYTE)*(BYTE *)&nSwapTest )
+ nMachineOrder = RSC_LITTLEENDIAN;
+ else
+ nMachineOrder = RSC_BIGENDIAN;
+ bSwap = nOrder != nMachineOrder;
+ }
+ nByteOrder = nOrder;
+ nLen = 0;
+ pMem = NULL;
+}
+
+/*************************************************************************
+|*
+|* RscWriteRc :: ~RscWriteRc()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+RscWriteRc :: ~RscWriteRc()
+{
+ if( pMem )
+ RscMem::Free( pMem );
+}
+
+/*************************************************************************
+|*
+|* RscWriteRc :: IncSize()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+USHORT RscWriteRc :: IncSize( USHORT nSize )
+{
+ nLen += nSize;
+ if( pMem )
+ pMem = RscMem::Realloc( pMem, nLen );
+ return( nLen - nSize );
+}
+
+/*************************************************************************
+|*
+|* RscWriteRc :: GetPointer()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+char * RscWriteRc :: GetPointer( USHORT nSize )
+{
+ if( !pMem )
+ pMem = (char *)RscMem::Malloc( nLen );
+ return( pMem + nSize );
+}
+
+
+/*************************************************************************
+|*
+|* RscWriteRc :: Put()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.04.91
+|* Letzte Aenderung MM 15.04.91
+|*
+*************************************************************************/
+void RscWriteRc :: Put( USHORT nVal )
+{
+ USHORT nOldLen;
+
+ nOldLen = IncSize( sizeof( nVal ) );
+ PutAt( nOldLen, nVal );
+}
+
+void RscWriteRc :: PutUTF8( char * pStr )
+{
+ USHORT nStrLen = 0;
+ if( pStr )
+ nStrLen = strlen( pStr );
+
+ USHORT n = nStrLen +1;
+ if( n % 2 )
+ // align to 2
+ n++;
+
+ USHORT nOldLen = IncSize( n );
+ memcpy( GetPointer( nOldLen ), pStr, nStrLen );
+ // 0 terminated
+ pMem[ nOldLen + nStrLen ] = '\0';
+}
diff --git a/rsc/source/tools/rsctree.cxx b/rsc/source/tools/rsctree.cxx
new file mode 100644
index 000000000000..bc7ea5194a3c
--- /dev/null
+++ b/rsc/source/tools/rsctree.cxx
@@ -0,0 +1,604 @@
+/*************************************************************************
+ *
+ * $RCSfile: rsctree.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:42:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/rsc/source/tools/rsctree.cxx,v 1.1.1.1 2000-09-18 16:42:56 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.11 2000/09/17 12:51:12 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.10 2000/07/26 17:13:24 willem.vandorp
+ Headers/footers replaced
+
+ Revision 1.9 2000/07/11 17:17:55 th
+ Unicode
+
+ Revision 1.8 1997/08/27 18:17:52 MM
+ neue Headerstruktur
+
+**************************************************************************/
+/****************** I N C L U D E S **************************************/
+
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+// Programmabh„ngige Includes.
+#ifndef _LINK_HXX //autogen
+#include <tools/link.hxx>
+#endif
+
+#ifndef _RSCTREE_HXX
+#include <rsctree.hxx>
+#endif
+
+/****************** C O D E **********************************************/
+
+/****************** B i N o d e ******************************************/
+/*************************************************************************
+|*
+|* BiNode::BiNode()
+|*
+|* Beschreibung NAME.DOC
+|* Ersterstellung MM 07.02.91
+|* Letzte Aenderung MM 07.02.91
+|*
+*************************************************************************/
+BiNode::BiNode(){
+ pLeft = pRight = NULL;
+}
+
+/*************************************************************************
+|*
+|* BiNode::~BiNode()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.02.91
+|* Letzte Aenderung MM 07.02.91
+|*
+*************************************************************************/
+BiNode::~BiNode(){
+}
+
+/*************************************************************************
+|*
+|* BiNode::EnumNodes()
+|*
+|* Beschreibung
+|* Ersterstellung MM 07.02.91
+|* Letzte Aenderung MM 07.02.91
+|*
+*************************************************************************/
+void BiNode::EnumNodes( Link aLink ) const{
+ if( Left() )
+ Left()->EnumNodes( aLink );
+ aLink.Call( (BiNode *)this );
+ if( Right() )
+ Right()->EnumNodes( aLink );
+}
+
+/*************************************************************************
+|*
+|* BiNode::ChangeDLListBTree()
+|*
+|* Beschreibung
+|* Ersterstellung MM 11.01.91
+|* Letzte Aenderung MM 11.01.91
+|*
+*************************************************************************/
+BiNode * BiNode::ChangeDLListBTree( BiNode * pList ){
+ BiNode * pRightNode;
+ BiNode * pMiddle;
+ BiNode * pTmp;
+ USHORT nEle, i;
+
+ if( pList ){
+ while( pList->Left() )
+ pList = pList->Left();
+ pTmp = pList;
+ for( nEle = 0; pTmp->Right(); nEle++ )
+ pTmp = pTmp->Right();
+ pMiddle = pList;
+ if( nEle / 2 )
+ for( i = 0; i < (USHORT)(nEle / 2); i++ )
+ pMiddle = pMiddle->Right();
+ else
+ pList = (BiNode *)0;
+
+ if( NULL != (pTmp = pMiddle->Left()) ) // rechten Zeiger auf Null
+ pTmp->pRight = (BiNode *)0;
+
+ // linken Zeiger auf Null
+ if( NULL != (pRightNode = pMiddle->Right()) )
+ pRightNode->pLeft = (BiNode *)0;
+
+ pMiddle->pLeft = ChangeDLListBTree( pList );
+ pMiddle->pRight = ChangeDLListBTree( pRightNode );
+
+ return( pMiddle );
+ }
+ return( pList );
+}
+
+/*************************************************************************
+|*
+|* BiNode::ChangeBTreeDLList()
+|*
+|* Beschreibung
+|* Ersterstellung MM 11.01.91
+|* Letzte Aenderung MM 11.01.91
+|*
+*************************************************************************/
+BiNode * BiNode::ChangeBTreeDLList(){
+ BiNode * pList;
+ BiNode * pLL_RN; // linke Liste rechter Knoten
+
+ if( Right() ){
+ pList = Right()->ChangeBTreeDLList();
+ pRight = pList;
+ pList->pLeft = this;
+ }
+ pList = this;
+ if( Left() ){
+ pLL_RN = pList = Left()->ChangeBTreeDLList();
+ while( pLL_RN->Right() )
+ pLL_RN = pLL_RN->Right();
+ pLeft = pLL_RN;
+ pLL_RN->pRight = this;
+ }
+ return( pList );
+}
+
+/****************** N a m e N o d e **************************************/
+/*************************************************************************
+|*
+|* NameNode::Remove()
+|*
+|* Beschreibung
+|* Ersterstellung MM 10.07.91
+|* Letzte Aenderung MM 10.07.91
+|*
+*************************************************************************/
+NameNode * NameNode::Remove( NameNode * pRemove ){
+ NameNode * pRoot = this;
+ NameNode * pParent = SearchParent( pRemove );
+
+ if( pParent ){
+ if( pParent->Left()
+ && (EQUAL == pRemove->Compare( pParent->Left() ) ) ){
+ pParent->pLeft = pRemove->Left();
+ if( pRemove->Right() )
+ pParent->Insert( pRemove->Right() );
+ }
+ else if( pParent->Right()
+ && (EQUAL == pRemove->Compare( pParent->Right() ) ) ){
+ pParent->pRight = pRemove->Right();
+ if( pRemove->Left() )
+ pParent->Insert( pRemove->Left() );
+ }
+ }
+ else if( EQUAL == this->Compare( pRemove ) ){
+ if( Right() ){
+ pRoot = Right();
+ if( Left() )
+ Right()->Insert( Left() );
+ }
+ else{
+ pRoot = Left();
+ }
+ }
+ pRemove->pLeft = pRemove->pRight = NULL;
+
+ return pRoot;
+}
+
+
+/*************************************************************************
+|*
+|* NameNode::Compare
+|*
+|* Beschreibung
+|* Ersterstellung MM 10.07.91
+|* Letzte Aenderung MM 13.07.91
+|*
+*************************************************************************/
+COMPARE NameNode::Compare( const NameNode * pCompare ) const{
+ if( (long)this < (long)pCompare )
+ return LESS;
+ else if( (long)this > (long)pCompare )
+ return GREATER;
+ else
+ return EQUAL;
+}
+
+COMPARE NameNode::Compare( const void * pCompare ) const{
+ if( (long)this < (long)pCompare )
+ return LESS;
+ else if( (long)this > (long)pCompare )
+ return GREATER;
+ else
+ return EQUAL;
+}
+
+/*************************************************************************
+|*
+|* NameNode::SearchParent
+|*
+|* Beschreibung
+|* Ersterstellung MM 10.07.91
+|* Letzte Aenderung MM 10.07.91
+|*
+*************************************************************************/
+NameNode* NameNode::SearchParent( const NameNode * pSearch ) const{
+// search for a parent node.
+// return a pointer to the parent node if found.
+// otherwise return 0.
+ short nCmp = Compare( pSearch );
+
+ if( nCmp == GREATER ){
+ if( Left() ){
+ if( ((NameNode *)Left())->Compare( pSearch ) == EQUAL )
+ return (NameNode *)this;
+ return ((NameNode *)Left())->SearchParent( pSearch );
+ };
+ }
+ else if( nCmp == LESS ){
+ if( Right() ){
+ if( ((NameNode *)Right())->Compare( pSearch ) == EQUAL )
+ return (NameNode *)this;
+ return ((NameNode *)Right())->SearchParent( pSearch );
+ }
+ };
+ return( (NameNode *)NULL );
+}
+
+/*************************************************************************
+|*
+|* NameNode::Search
+|*
+|* Beschreibung
+|* Ersterstellung MM 21.03.90
+|* Letzte Aenderung MM 27.06.90
+|*
+*************************************************************************/
+NameNode* NameNode::Search( const NameNode * pSearch ) const{
+// search for a node.
+// return a pointer to the node if found.
+// otherwise return 0.
+ short nCmp = Compare( pSearch );
+
+ if( nCmp == GREATER ){
+ if( Left() )
+ return ((NameNode *)Left())->Search( pSearch );
+ }
+ else if( nCmp == LESS ){
+ if( Right() )
+ return ((NameNode *)Right())->Search( pSearch );
+ }
+ else
+ return( (NameNode *)this );
+
+ return( NULL );
+}
+
+NameNode* NameNode::Search( const void * pSearch ) const{
+// search for a node.
+// return a pointer to the node if found.
+// otherwise return 0.
+ short nCmp = Compare( pSearch );
+
+ if( nCmp == GREATER ){
+ if( Left() )
+ return ((NameNode *)Left())->Search( pSearch );
+ }
+ else if( nCmp == LESS ){
+ if( Right() )
+ return ((NameNode *)Right())->Search( pSearch );
+ }
+ else
+ return( (NameNode *)this );
+
+ return( NULL );
+}
+
+/*************************************************************************
+|*
+|* NameNode::Insert()
+|*
+|* Beschreibung NAME.DOC
+|* Ersterstellung MM 11.01.91
+|* Letzte Aenderung MM 11.01.91
+|*
+*************************************************************************/
+BOOL NameNode::Insert( NameNode * pTN, USHORT * pnDepth ){
+// Ein Knoten wird in den Baum eingefuegt
+// Gibt es einen Knoten mit dem gleichen Namen, dann return FALSE
+// sonst return TRUE. Der Knoten wird auf jeden Fall eingefuegt.
+
+ BOOL bRet = TRUE;
+ short nCmp = Compare( pTN );
+
+ *pnDepth += 1;
+ if( nCmp == GREATER ){
+ if( Left() )
+ bRet = ((NameNode *)Left())->Insert( pTN, pnDepth );
+ else
+ pLeft = pTN;
+ }
+ else{
+ if( Right() )
+ bRet = ((NameNode *)Right())->Insert( pTN, pnDepth );
+ else
+ pRight = pTN;
+ if( nCmp == EQUAL )
+ bRet = FALSE;
+ };
+ return( bRet );
+}
+
+/*************************************************************************
+|*
+|* NameNode::Insert()
+|*
+|* Beschreibung NAME.DOC
+|* Ersterstellung MM 21.03.90
+|* Letzte Aenderung MM 11.01.91
+|*
+*************************************************************************/
+BOOL NameNode::Insert( NameNode * pTN ){
+// insert a node in the tree.
+// if the node with the same name is in, return FALSE and no insert.
+// if not return true.
+ USHORT nDepth = 0;
+ BOOL bRet;
+
+ bRet = Insert( pTN, &nDepth );
+ if( bRet ){
+ if( nDepth > 20 ){
+ if( Left() )
+ pLeft = ChangeDLListBTree( Left()->ChangeBTreeDLList() );
+ if( Right() )
+ pRight = ChangeDLListBTree( Right()->ChangeBTreeDLList() );
+ }
+ }
+
+ return( bRet );
+}
+
+/*************************************************************************
+|*
+|* NameNode::OrderTree()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.09.91
+|* Letzte Aenderung MM 23.09.91
+|*
+*************************************************************************/
+void NameNode::OrderTree(){
+ NameNode * pTmpLeft = (NameNode *)Left();
+ NameNode * pTmpRight = (NameNode *)Right();
+
+ pLeft = NULL;
+ pRight = NULL;
+ SubOrderTree( pTmpLeft );
+ SubOrderTree( pTmpRight );
+}
+
+void NameNode::SubOrderTree( NameNode * pOrderNode ){
+ if( pOrderNode ){
+ NameNode * pTmpLeft = (NameNode *)pOrderNode->Left();
+ NameNode * pTmpRight = (NameNode *)pOrderNode->Right();
+ pOrderNode->pLeft = NULL;
+ pOrderNode->pRight = NULL;
+ Insert( pOrderNode );
+ SubOrderTree( pTmpLeft );
+ SubOrderTree( pTmpRight );
+ }
+}
+
+/*************************************************************************
+|*
+|* NameNode::IdOrderTree()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.11.91
+|* Letzte Aenderung MM 15.11.91
+|*
+*************************************************************************/
+class OrderCtrl {
+ BOOL bOrder;
+ NameNode * pName;
+ DECL_LINK( CallBackFunc, NameNode * );
+public:
+ OrderCtrl() { bOrder = FALSE; pName = NULL; }
+ BOOL IsOrder( const NameNode * pRoot )
+ {
+ bOrder = TRUE;
+ pName = NULL;
+ pRoot->EnumNodes( LINK( this, OrderCtrl, CallBackFunc ) );
+ return bOrder;
+ };
+};
+IMPL_LINK_INLINE_START( OrderCtrl, CallBackFunc, NameNode *, pNext )
+{
+ if( pName && pName->Compare( pNext ) != LESS )
+ bOrder = FALSE;
+ pName = pNext;
+ return 0;
+}
+IMPL_LINK_INLINE_END( OrderCtrl, CallBackFunc, NameNode *, pNext )
+
+BOOL NameNode::IsOrderTree() const{
+ OrderCtrl aOrder;
+
+ return aOrder.IsOrder( this );
+}
+
+/****************** I d N o d e ******************************************/
+/*************************************************************************
+|*
+|* IdNode::Search()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.11.91
+|* Letzte Aenderung MM 06.11.91
+|*
+*************************************************************************/
+IdNode * IdNode::Search( USHORT nTypeName ) const{
+ return( (IdNode *)NameNode::Search( (const void *)&nTypeName ) );
+}
+
+/*************************************************************************
+|*
+|* IdNode::Compare()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.11.91
+|* Letzte Aenderung MM 06.11.91
+|*
+*************************************************************************/
+COMPARE IdNode::Compare( const NameNode * pSearch ) const
+{
+ if( GetId() < (USHORT)(((const IdNode *)pSearch)->GetId()) )
+ return LESS;
+ else if( GetId() > (USHORT)(((const IdNode *)pSearch)->GetId()) )
+ return GREATER;
+ else
+ return EQUAL;
+}
+
+COMPARE IdNode::Compare( const void * pSearch ) const{
+// pSearch ist ein Zeiger auf USHORT
+
+ if( GetId() < *((const USHORT *)pSearch) )
+ return LESS;
+ else if( GetId() > *((const USHORT *)pSearch) )
+ return GREATER;
+ else
+ return EQUAL;
+}
+
+/*************************************************************************
+|*
+|* IdNode::GetId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 23.09.91
+|* Letzte Aenderung MM 23.09.91
+|*
+*************************************************************************/
+USHORT IdNode::GetId() const
+{
+ return( 0xFFFF );
+}
+
+/*************************************************************************
+|*
+|* StringNode::Search()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.11.91
+|* Letzte Aenderung MM 06.11.91
+|*
+*************************************************************************/
+StringNode * StringNode::Search( const char * pSearch ) const{
+ return (StringNode *)NameNode::Search( (const void *)pSearch );
+}
+
+/*************************************************************************
+|*
+|* StringNode::Compare()
+|*
+|* Beschreibung
+|* Ersterstellung MM 06.11.91
+|* Letzte Aenderung MM 06.11.91
+|*
+*************************************************************************/
+COMPARE StringNode::Compare( const NameNode * pSearch ) const
+{
+ short nCmp = strcmp( aName.GetBuffer(),
+ ((const StringNode *)pSearch)->aName.GetBuffer() );
+ if( nCmp < 0 )
+ return LESS;
+ else if( nCmp > 0 )
+ return GREATER;
+ else
+ return EQUAL;
+}
+
+COMPARE StringNode::Compare( const void * pSearch ) const
+{
+// pSearch ist ein Zeiger auf const char *
+ short nCmp = strcmp( aName.GetBuffer(), (const char *)pSearch );
+
+ if( nCmp < 0 )
+ return LESS;
+ else if( nCmp > 0 )
+ return GREATER;
+ else
+ return EQUAL;
+}
diff --git a/sax/prj/d.lst b/sax/prj/d.lst
new file mode 100644
index 000000000000..a787c3a4c3c0
--- /dev/null
+++ b/sax/prj/d.lst
@@ -0,0 +1,2 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*
diff --git a/sax/source/expatwrap/attrlistimpl.cxx b/sax/source/expatwrap/attrlistimpl.cxx
new file mode 100644
index 000000000000..1d4a36c6f699
--- /dev/null
+++ b/sax/source/expatwrap/attrlistimpl.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * $RCSfile: attrlistimpl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <vector>
+
+#include <assert.h>
+
+#include <cppuhelper/weak.hxx>
+
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+
+using namespace ::std;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::xml::sax;
+
+#include "attrlistimpl.hxx"
+
+struct TagAttribute
+{
+ TagAttribute()
+ {}
+ TagAttribute( const OUString &sName, const OUString &sType , const OUString &sValue )
+ {
+ this->sName = sName;
+ this->sType = sType;
+ this->sValue = sValue;
+ }
+
+ OUString sName;
+ OUString sType;
+ OUString sValue;
+};
+
+struct AttributeListImpl_impl
+{
+ AttributeListImpl_impl()
+ {
+ // performance improvement during adding
+ vecAttribute.reserve(20);
+ }
+ vector<struct TagAttribute> vecAttribute;
+};
+
+
+
+sal_Int16 AttributeListImpl::getLength(void) throw (RuntimeException)
+{
+ return m_pImpl->vecAttribute.size();
+}
+
+
+AttributeListImpl::AttributeListImpl( const AttributeListImpl &r )
+{
+ m_pImpl = new AttributeListImpl_impl;
+ *m_pImpl = *(r.m_pImpl);
+}
+
+OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sName;
+ }
+ return OUString();
+}
+
+
+OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sType;
+ }
+ return OUString();
+}
+
+OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sValue;
+ }
+ return OUString();
+
+}
+
+OUString AttributeListImpl::getTypeByName( const OUString& sName ) throw (RuntimeException)
+{
+ 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)
+{
+ 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();
+}
+
+
+Reference< XCloneable > AttributeListImpl::createClone() throw (RuntimeException)
+{
+ AttributeListImpl *p = new AttributeListImpl( *this );
+ return Reference< XCloneable > ( (XCloneable * ) p );
+}
+
+
+
+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()
+{
+ m_pImpl->vecAttribute.clear();
+}
+
+void AttributeListImpl::removeAttribute( const OUString &sName )
+{
+ vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
+
+ for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) {
+ if( (*ii).sName == sName ) {
+ m_pImpl->vecAttribute.erase( ii );
+ break;
+ }
+ }
+}
+
+
+void AttributeListImpl::setAttributeList( const Reference< XAttributeList > &r )
+{
+ assert( r.is() );
+
+ sal_Int16 nMax = r->getLength();
+ clear();
+ m_pImpl->vecAttribute.reserve( nMax );
+
+ for( int i = 0 ; i < nMax ; i ++ ) {
+ m_pImpl->vecAttribute.push_back( TagAttribute( r->getNameByIndex( i ) ,
+ r->getTypeByIndex( i ) ,
+ r->getValueByIndex( i ) ) );
+ }
+
+ assert( nMax == getLength() );
+}
+
diff --git a/sax/source/expatwrap/attrlistimpl.hxx b/sax/source/expatwrap/attrlistimpl.hxx
new file mode 100644
index 000000000000..d618e5259719
--- /dev/null
+++ b/sax/source/expatwrap/attrlistimpl.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: attrlistimpl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <cppuhelper/implbase2.hxx>
+
+
+struct AttributeListImpl_impl;
+
+class AttributeListImpl :
+ public WeakImplHelper2< XAttributeList, XCloneable >
+{
+public:
+ AttributeListImpl();
+ AttributeListImpl( const AttributeListImpl & );
+ ~AttributeListImpl();
+
+public:
+ virtual sal_Int16 SAL_CALL getLength(void) throw(RuntimeException);
+ virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) throw(RuntimeException);
+ virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw(RuntimeException);
+ virtual OUString SAL_CALL getTypeByName(const OUString& aName) throw(RuntimeException);
+ virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) throw(RuntimeException);
+ virtual OUString SAL_CALL getValueByName(const OUString& aName) throw( RuntimeException);
+
+public:
+ virtual Reference< XCloneable > SAL_CALL createClone() throw(RuntimeException);
+
+public:
+ void addAttribute( const OUString &sName , const OUString &sType , const OUString &sValue );
+ void clear();
+ void removeAttribute( const OUString &sName );
+ void setAttributeList( const Reference< XAttributeList > & );
+
+private:
+ struct AttributeListImpl_impl *m_pImpl;
+};
+
diff --git a/sax/source/expatwrap/factory.hxx b/sax/source/expatwrap/factory.hxx
new file mode 100644
index 000000000000..57698321b574
--- /dev/null
+++ b/sax/source/expatwrap/factory.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * $RCSfile: factory.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+Reference< XInterface > SAL_CALL SaxWriter_CreateInstance(
+ const Reference< XMultiServiceFactory > & rSMgr ) throw (Exception);
+OUString SaxWriter_getServiceName();
+OUString SaxWriter_getImplementationName();
+Sequence< OUString > SaxWriter_getSupportedServiceNames(void) throw();
+
+
diff --git a/sax/source/expatwrap/makefile.mk b/sax/source/expatwrap/makefile.mk
new file mode 100644
index 000000000000..19119165b1a1
--- /dev/null
+++ b/sax/source/expatwrap/makefile.mk
@@ -0,0 +1,92 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=sax
+TARGET=expatwrap
+NO_BSYMBOLIC=TRUE
+ENABLE_EXCEPTIONS=TRUE
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+#-----------------------------------------------------------
+CFLAGS += -DXML_UNICODE
+
+SLOFILES =\
+ $(SLO)$/xml2utf.obj\
+ $(SLO)$/attrlistimpl.obj\
+ $(SLO)$/sax_expat.obj \
+ $(SLO)$/saxwriter.obj
+
+# NETBSD: somewhere we have to instantiate the static data members.
+# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work.
+# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX"
+SLOFILES+=$(SLO)$/staticmb.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
+
+
+
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
new file mode 100644
index 000000000000..8c9a6f170c31
--- /dev/null
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -0,0 +1,1043 @@
+/*************************************************************************
+ *
+ * $RCSfile: sax_expat.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <vector>
+
+#ifdef WIN32
+#include <malloc.h>
+#else
+#ifndef MACOSX
+#include <alloca.h>
+#endif
+#endif
+
+#include <osl/diagnose.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+#include <assert.h>
+
+#include "expat/xmlparse.h"
+
+using namespace ::rtl;
+using namespace ::std;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::io;
+
+#include "factory.hxx"
+#include "attrlistimpl.hxx"
+#include "xml2utf.hxx"
+
+OUString XmlNChar2OUString( const XML_Char *p , int nLen )
+{
+ if( p ) {
+ if( sizeof( sal_Unicode ) == sizeof( XML_Char ) )
+ {
+ return OUString( (sal_Unicode*)p,nLen);
+ }
+ else
+ {
+ sal_Unicode *pWchar = (sal_Unicode *)alloca( sizeof( sal_Unicode ) * nLen );
+ for( int n = 0 ; n < nLen ; n++ ) {
+ pWchar[n] = (sal_Unicode) p[n];
+ }
+ return OUString( pWchar , nLen );
+ }
+ }
+ else {
+ return OUString();
+ }
+}
+
+OUString XmlChar2OUString( const XML_Char *p )
+{
+ if( p ) {
+ for( int nLen = 0 ; p[nLen] ; nLen ++ );
+ return XmlNChar2OUString( p , nLen );
+ }
+ else return OUString();
+}
+
+
+// Useful macros for correct String conversion depending on the choosen expat-mode
+#ifdef XML_UNICODE
+#define XML_CHAR_TO_OUSTRING(x) XmlChar2OUString(x)
+#define XML_CHAR_N_TO_USTRING(x,n) XmlNChar2OUString(x,n)
+#else
+#define XML_CHAR_TO_OUSTRING(x) OStringToOUString(OString(x), RTL_TEXTENCODING_UTF8)
+#define XML_CHAR_N_TO_OUSTRING(x,n) OStringToOUString(OString(x,n), RTL_TEXTENCODING_UTF8 )
+#endif
+
+
+/*
+* The following macro encapsulates any call to an event handler.
+* It ensures, that exceptions thrown by the event handler are
+* treated properly.
+*/
+#define CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pThis,call) \
+ if( ! pThis->bExceptionWasThrown ) { \
+ try {\
+ pThis->call;\
+ }\
+ catch( SAXParseException &e ) {\
+ pThis->callErrorHandler( pThis , e );\
+ }\
+ catch( SAXException &e ) {\
+ pThis->callErrorHandler( pThis , SAXParseException(\
+ e.Message, \
+ e.Context, \
+ e.WrappedException,\
+ pThis->rDocumentLocator->getPublicId(),\
+ pThis->rDocumentLocator->getSystemId(),\
+ pThis->rDocumentLocator->getLineNumber(),\
+ pThis->rDocumentLocator->getColumnNumber()\
+ ) );\
+ }\
+ }\
+ ((void)0)
+
+#define IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.ParserExpat"
+#define SERVICE_NAME "com.sun.star.xml.sax.Parser"
+
+class SaxExpatParser_Impl;
+
+
+// This class implements the external Parser interface
+class SaxExpatParser :
+ public WeakImplHelper2<
+ XParser,
+ XServiceInfo
+ >
+{
+
+public:
+ SaxExpatParser();
+ ~SaxExpatParser();
+
+public:
+
+ // The implementation details
+ static Sequence< OUString > getSupportedServiceNames_Static(void) throw ();
+ static OUString getImplementationName_Static() throw ();
+
+public:
+ // The SAX-Parser-Interface
+ virtual void SAL_CALL parseStream( const InputSource& structSource)
+ throw ( SAXException,
+ IOException,
+ RuntimeException);
+ virtual void SAL_CALL setDocumentHandler(const Reference< XDocumentHandler > & xHandler)
+ throw (RuntimeException);
+
+ virtual void SAL_CALL setErrorHandler(const Reference< XErrorHandler > & xHandler)
+ throw (RuntimeException);
+ virtual void SAL_CALL setDTDHandler(const Reference < XDTDHandler > & xHandler)
+ throw (RuntimeException);
+ virtual void SAL_CALL setEntityResolver(const Reference< XEntityResolver >& xResolver)
+ throw (RuntimeException);
+
+ virtual void SAL_CALL setLocale( const Locale &locale ) throw (RuntimeException);
+
+public: // XServiceInfo
+ OUString SAL_CALL getImplementationName() throw ();
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw ();
+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw ();
+
+private:
+
+ SaxExpatParser_Impl *m_pImpl;
+
+};
+
+//--------------------------------------
+// the extern interface
+//---------------------------------------
+Reference< XInterface > SAL_CALL SaxExpatParser_CreateInstance(
+ const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception)
+{
+ SaxExpatParser *p = new SaxExpatParser;
+
+ return Reference< XInterface > ( (OWeakObject * ) p );
+}
+
+
+
+Sequence< OUString > SaxExpatParser::getSupportedServiceNames_Static(void) throw ()
+{
+ Sequence<OUString> aRet(1);
+ aRet.getArray()[0] = SaxExpatParser::getImplementationName_Static();
+ return aRet;
+}
+
+
+//---------------------------------------------
+// the implementation part
+//---------------------------------------------
+
+
+// Entity binds all information neede for a single file
+struct Entity
+{
+ InputSource structSource;
+ XML_Parser pParser;
+ XMLFile2UTFConverter converter;
+};
+
+
+class SaxExpatParser_Impl
+{
+public: // module scope
+ Mutex aMutex;
+
+ Reference< XDocumentHandler > rDocumentHandler;
+ Reference< XExtendedDocumentHandler > rExtendedDocumentHandler;
+
+ Reference< XErrorHandler > rErrorHandler;
+ Reference< XDTDHandler > rDTDHandler;
+ Reference< XEntityResolver > rEntityResolver;
+ Reference < XLocator > rDocumentLocator;
+
+
+ Reference < XAttributeList > rAttrList;
+ AttributeListImpl *pAttrList;
+
+ // External entity stack
+ vector<struct Entity> vecEntity;
+ void pushEntity( const struct Entity &entity )
+ { vecEntity.push_back( entity ); }
+ void popEntity()
+ { vecEntity.pop_back( ); }
+ struct Entity &getEntity()
+ { return vecEntity.back(); }
+
+
+ // Exception cannot be thrown through the C-XmlParser (possible resource leaks),
+ // therefor the exception must be saved somewhere.
+ SAXParseException exception;
+ sal_Bool bExceptionWasThrown;
+
+ Locale locale;
+
+public:
+ // the C-Callbacks for the expat parser
+ void static callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts);
+ void static callbackEndElement(void *userData, const XML_Char *name);
+ void static callbackCharacters( void *userData , const XML_Char *s , int nLen );
+ void static callbackProcessingInstruction( void *userData ,
+ const XML_Char *sTarget ,
+ const XML_Char *sData );
+
+ void static callbackUnparsedEntityDecl( void *userData ,
+ const XML_Char *entityName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId,
+ const XML_Char *notationName);
+
+ void static callbackNotationDecl( void *userData,
+ const XML_Char *notationName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId);
+
+ int static callbackExternalEntityRef( XML_Parser parser,
+ const XML_Char *openEntityNames,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId);
+
+ int static callbackUnknownEncoding(void *encodingHandlerData,
+ const XML_Char *name,
+ XML_Encoding *info);
+
+ void static callbackDefault( void *userData, const XML_Char *s, int len);
+
+ void static callbackStartCDATA( void *userData );
+ void static callbackEndCDATA( void *userData );
+ void static callbackComment( void *userData , const XML_Char *s );
+ void static callErrorHandler( SaxExpatParser_Impl *pImpl , const SAXParseException &e );
+
+public:
+ void parse();
+};
+
+
+//---------------------------------------------
+// LocatorImpl
+//---------------------------------------------
+class LocatorImpl :
+ public WeakImplHelper1< XLocator >
+{
+public:
+ LocatorImpl( SaxExpatParser_Impl *p )
+ {
+ m_pParser = p;
+ }
+
+public: //XLocator
+ virtual sal_Int32 SAL_CALL getColumnNumber(void) throw ()
+ {
+ return XML_GetCurrentColumnNumber( m_pParser->getEntity().pParser );
+ }
+ virtual sal_Int32 SAL_CALL getLineNumber(void) throw ()
+ {
+ return XML_GetCurrentLineNumber( m_pParser->getEntity().pParser );
+ }
+ virtual OUString SAL_CALL getPublicId(void) throw ()
+ {
+ return m_pParser->getEntity().structSource.sPublicId;
+ }
+ virtual OUString SAL_CALL getSystemId(void) throw ()
+ {
+ return m_pParser->getEntity().structSource.sSystemId;
+ }
+
+private:
+
+ SaxExpatParser_Impl *m_pParser;
+};
+
+
+
+
+SaxExpatParser::SaxExpatParser( )
+{
+ m_pImpl = new SaxExpatParser_Impl;
+
+ LocatorImpl *pLoc = new LocatorImpl( m_pImpl );
+ m_pImpl->rDocumentLocator = Reference< XLocator > ( pLoc );
+
+ // performance-Improvment. Reference is needed when calling the startTag callback.
+ // Handing out the same object with every call is allowed (see sax-specification)
+ m_pImpl->pAttrList = new AttributeListImpl;
+ m_pImpl->rAttrList = Reference< XAttributeList > ( m_pImpl->pAttrList );
+
+ m_pImpl->bExceptionWasThrown = sal_False;
+}
+
+SaxExpatParser::~SaxExpatParser()
+{
+ delete m_pImpl;
+}
+
+
+/***************
+*
+* parseStream does Parser-startup initializations. The SaxExpatParser_Impl::parse() method does
+* the file-specific initialization work. (During a parser run, external files may be opened)
+*
+****************/
+void SaxExpatParser::parseStream( const InputSource& structSource)
+ throw (SAXException,
+ IOException,
+ RuntimeException)
+{
+ // Only one text at one time
+ MutexGuard guard( m_pImpl->aMutex );
+
+
+ struct Entity entity;
+ entity.structSource = structSource;
+
+ if( ! entity.structSource.aInputStream.is() )
+ {
+ throw SAXException( OUString::createFromAscii( "No input source" ) ,
+ Reference< XInterface > () , Any() );
+ }
+
+ entity.converter.setInputStream( entity.structSource.aInputStream );
+ if( entity.structSource.sEncoding.len() )
+ {
+ entity.converter.setEncoding(
+ OUStringToOString( entity.structSource.sEncoding , RTL_TEXTENCODING_ASCII_US ) );
+ }
+
+ // create parser with proper encoding
+ entity.pParser = XML_ParserCreate( 0 );
+ if( ! entity.pParser )
+ {
+ throw SAXException( OUString::createFromAscii( "Couldn't create parser" ) ,
+ Reference< XInterface > (), Any() );
+ }
+
+ // set all necessary C-Callbacks
+ XML_SetUserData( entity.pParser , m_pImpl );
+ XML_SetElementHandler( entity.pParser ,
+ SaxExpatParser_Impl::callbackStartElement ,
+ SaxExpatParser_Impl::callbackEndElement );
+ XML_SetCharacterDataHandler( entity.pParser , SaxExpatParser_Impl::callbackCharacters );
+ XML_SetProcessingInstructionHandler(entity.pParser ,
+ SaxExpatParser_Impl::callbackProcessingInstruction );
+ XML_SetUnparsedEntityDeclHandler( entity.pParser,
+ SaxExpatParser_Impl::callbackUnparsedEntityDecl );
+ XML_SetNotationDeclHandler( entity.pParser, SaxExpatParser_Impl::callbackNotationDecl );
+ XML_SetExternalEntityRefHandler( entity.pParser,
+ SaxExpatParser_Impl::callbackExternalEntityRef);
+ XML_SetUnknownEncodingHandler( entity.pParser, SaxExpatParser_Impl::callbackUnknownEncoding ,0);
+
+ if( m_pImpl->rExtendedDocumentHandler.is() ) {
+
+ // These handlers just delegate calls to the ExtendedHandler. If no extended handler is
+ // given, these callbacks can be ignored
+ XML_SetDefaultHandlerExpand( entity.pParser, SaxExpatParser_Impl::callbackDefault );
+ XML_SetCommentHandler( entity.pParser, SaxExpatParser_Impl::callbackComment );
+ XML_SetCdataSectionHandler( entity.pParser ,
+ SaxExpatParser_Impl::callbackStartCDATA ,
+ SaxExpatParser_Impl::callbackEndCDATA );
+ }
+
+
+ m_pImpl->exception = SAXParseException();
+ m_pImpl->pushEntity( entity );
+ try
+ {
+ // start the document
+ if( m_pImpl->rDocumentHandler.is() ) {
+ m_pImpl->rDocumentHandler->setDocumentLocator( m_pImpl->rDocumentLocator );
+ m_pImpl->rDocumentHandler->startDocument();
+ }
+
+ m_pImpl->parse();
+
+ // finish document
+ if( m_pImpl->rDocumentHandler.is() ) {
+ m_pImpl->rDocumentHandler->endDocument();
+ }
+ }
+
+// catch( SAXParseException & )
+// {
+// m_pImpl->popEntity();
+// XML_ParserFree( entity.pParser );
+// throw;
+// }
+ catch( SAXException & )
+ {
+ m_pImpl->popEntity();
+ XML_ParserFree( entity.pParser );
+ throw;
+ }
+ catch( IOException & )
+ {
+ m_pImpl->popEntity();
+ XML_ParserFree( entity.pParser );
+ throw;
+ }
+ catch( RuntimeException & )
+ {
+ m_pImpl->popEntity();
+ XML_ParserFree( entity.pParser );
+ throw;
+ }
+
+ m_pImpl->popEntity();
+ XML_ParserFree( entity.pParser );
+}
+
+void SaxExpatParser::setDocumentHandler(const Reference< XDocumentHandler > & xHandler)
+ throw (RuntimeException)
+{
+ m_pImpl->rDocumentHandler = xHandler;
+ m_pImpl->rExtendedDocumentHandler =
+ Reference< XExtendedDocumentHandler >( xHandler , UNO_QUERY );
+}
+
+void SaxExpatParser::setErrorHandler(const Reference< XErrorHandler > & xHandler)
+ throw (RuntimeException)
+{
+ m_pImpl->rErrorHandler = xHandler;
+}
+
+void SaxExpatParser::setDTDHandler(const Reference< XDTDHandler > & xHandler)
+ throw (RuntimeException)
+{
+ m_pImpl->rDTDHandler = xHandler;
+}
+
+void SaxExpatParser::setEntityResolver(const Reference < XEntityResolver > & xResolver)
+ throw (RuntimeException)
+{
+ m_pImpl->rEntityResolver = xResolver;
+}
+
+
+void SaxExpatParser::setLocale( const Locale & locale ) throw (RuntimeException)
+{
+ m_pImpl->locale = locale;
+}
+
+OUString SaxExpatParser::getImplementationName_Static() throw ()
+{
+ return OUString::createFromAscii( IMPLEMENTATION_NAME );
+}
+
+// XServiceInfo
+OUString SaxExpatParser::getImplementationName() throw ()
+{
+ return OUString::createFromAscii( IMPLEMENTATION_NAME );
+}
+
+// XServiceInfo
+sal_Bool SaxExpatParser::supportsService(const OUString& ServiceName) throw ()
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+// XServiceInfo
+Sequence< OUString > SaxExpatParser::getSupportedServiceNames(void) throw ()
+{
+
+ Sequence<OUString> seq(1);
+ seq.getArray()[0] = OUString::createFromAscii( SERVICE_NAME );
+ return seq;
+}
+
+
+/*---------------------------------------
+*
+* Helper functions and classes
+*
+*
+*-------------------------------------------*/
+OUString getErrorMessage( XML_Error xmlE, OUString sSystemId , sal_Int32 nLine )
+{
+ OUString Message;
+ if( XML_ERROR_NONE == xmlE ) {
+ Message = OUString::createFromAscii( "No" );
+ }
+ else if( XML_ERROR_NO_MEMORY == xmlE ) {
+ Message = OUString::createFromAscii( "no memory" );
+ }
+ else if( XML_ERROR_SYNTAX == xmlE ) {
+ Message = OUString::createFromAscii( "syntax" );
+ }
+ else if( XML_ERROR_NO_ELEMENTS == xmlE ) {
+ Message = OUString::createFromAscii( "no elements" );
+ }
+ else if( XML_ERROR_INVALID_TOKEN == xmlE ) {
+ Message = OUString::createFromAscii( "invalid token" );
+ }
+ else if( XML_ERROR_UNCLOSED_TOKEN == xmlE ) {
+ Message = OUString::createFromAscii( "unclosed token" );
+ }
+ else if( XML_ERROR_PARTIAL_CHAR == xmlE ) {
+ Message = OUString::createFromAscii( "partial char" );
+ }
+ else if( XML_ERROR_TAG_MISMATCH == xmlE ) {
+ Message = OUString::createFromAscii( "tag mismatch" );
+ }
+ else if( XML_ERROR_DUPLICATE_ATTRIBUTE == xmlE ) {
+ Message = OUString::createFromAscii( "duplicate attribute" );
+ }
+ else if( XML_ERROR_JUNK_AFTER_DOC_ELEMENT == xmlE ) {
+ Message = OUString::createFromAscii( "junk after doc element" );
+ }
+ else if( XML_ERROR_PARAM_ENTITY_REF == xmlE ) {
+ Message = OUString::createFromAscii( "parameter entity reference" );
+ }
+ else if( XML_ERROR_UNDEFINED_ENTITY == xmlE ) {
+ Message = OUString::createFromAscii( "undefined entity" );
+ }
+ else if( XML_ERROR_RECURSIVE_ENTITY_REF == xmlE ) {
+ Message = OUString::createFromAscii( "recursive entity reference" );
+ }
+ else if( XML_ERROR_ASYNC_ENTITY == xmlE ) {
+ Message = OUString::createFromAscii( "async entity" );
+ }
+ else if( XML_ERROR_BAD_CHAR_REF == xmlE ) {
+ Message = OUString::createFromAscii( "bad char reference" );
+ }
+ else if( XML_ERROR_BINARY_ENTITY_REF == xmlE ) {
+ Message = OUString::createFromAscii( "binary entity reference" );
+ }
+ else if( XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF == xmlE ) {
+ Message = OUString::createFromAscii( "attribute external entity reference" );
+ }
+ else if( XML_ERROR_MISPLACED_XML_PI == xmlE ) {
+ Message = OUString::createFromAscii( "misplaced xml processing instruction" );
+ }
+ else if( XML_ERROR_UNKNOWN_ENCODING == xmlE ) {
+ Message = OUString::createFromAscii( "unknown encoding" );
+ }
+ else if( XML_ERROR_INCORRECT_ENCODING == xmlE ) {
+ Message = OUString::createFromAscii( "incorrect encoding" );
+ }
+ else if( XML_ERROR_UNCLOSED_CDATA_SECTION == xmlE ) {
+ Message = OUString::createFromAscii( "unclosed cdata section" );
+ }
+ else if( XML_ERROR_EXTERNAL_ENTITY_HANDLING == xmlE ) {
+ Message = OUString::createFromAscii( "external entity reference" );
+ }
+ else if( XML_ERROR_NOT_STANDALONE == xmlE ) {
+ Message = OUString::createFromAscii( "not standalone" );
+ }
+
+ OUString str = OUString::createFromAscii( "[" );
+ str += sSystemId;
+ str += OUString::createFromAscii( " line " );
+ str += OUString::valueOf( nLine );
+ str += OUString::createFromAscii( "]: " );
+ str += Message;
+ str += OUString::createFromAscii( "error" );
+
+ return str;
+}
+
+
+// starts parsing with actual parser !
+void SaxExpatParser_Impl::parse( )
+{
+ const int nBufSize = 16*1024;
+
+ int nRead = nBufSize;
+ Sequence< sal_Int8 > seqOut(nBufSize);
+
+ while( nRead ) {
+ nRead = getEntity().converter.readAndConvert( seqOut , nBufSize );
+
+ if( ! nRead ) {
+ XML_Parse( getEntity().pParser , ( const char * ) seqOut.getArray() , 0 , 1 );
+ break;
+ }
+
+ sal_Bool bContinue = XML_Parse( getEntity().pParser ,(const char *) seqOut.getArray(),nRead,0);
+
+ if( ! bContinue || this->bExceptionWasThrown ) {
+
+ // Error during parsing !
+ XML_Error xmlE = XML_GetErrorCode( getEntity().pParser );
+ OUString sSystemId = rDocumentLocator->getSystemId();
+ sal_Int32 nLine = rDocumentLocator->getLineNumber();
+
+ SAXParseException aExcept(
+ getErrorMessage(xmlE , sSystemId, nLine) ,
+ Reference< XInterface >(),
+ Any( &exception , getCppuType( &exception) ),
+ rDocumentLocator->getPublicId(),
+ rDocumentLocator->getSystemId(),
+ rDocumentLocator->getLineNumber(),
+ rDocumentLocator->getColumnNumber()
+ );
+
+ if( rErrorHandler.is() ) {
+
+ // error handler is set, so the handler may throw the exception
+ Any a;
+ a <<= aExcept;
+ rErrorHandler->fatalError( a );
+ }
+
+ // Error handler has not thrown an exception, but parsing cannot go on,
+ // so an exception MUST be thrown.
+ throw aExcept;
+ } // if( ! bContinue )
+ } // while
+}
+
+//------------------------------------------
+//
+// The C-Callbacks
+//
+//-----------------------------------------
+void SaxExpatParser_Impl::callbackStartElement( void *pvThis ,
+ const XML_Char *pwName ,
+ const XML_Char **awAttributes )
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+
+ if( pImpl->rDocumentHandler.is() ) {
+
+ int i = 0;
+ pImpl->pAttrList->clear();
+
+ while( awAttributes[i] ) {
+ assert( awAttributes[i+1] );
+ pImpl->pAttrList->addAttribute(
+ XML_CHAR_TO_OUSTRING( awAttributes[i] ) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CDATA") ) , // expat doesn't know types
+ XML_CHAR_TO_OUSTRING( awAttributes[i+1] ) );
+ i +=2;
+ }
+
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(
+ pImpl ,
+ rDocumentHandler->startElement( XML_CHAR_TO_OUSTRING( pwName ) ,
+ pImpl->rAttrList ) );
+ }
+}
+
+void SaxExpatParser_Impl::callbackEndElement( void *pvThis , const XML_Char *pwName )
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+
+ if( pImpl->rDocumentHandler.is() ) {
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl,
+ rDocumentHandler->endElement( XML_CHAR_TO_OUSTRING( pwName ) ) );
+ }
+}
+
+
+void SaxExpatParser_Impl::callbackCharacters( void *pvThis , const XML_Char *s , int nLen )
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+
+ if( pImpl->rDocumentHandler.is() ) {
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl ,
+ rDocumentHandler->characters( XML_CHAR_N_TO_USTRING(s,nLen) ) );
+ }
+}
+
+void SaxExpatParser_Impl::callbackProcessingInstruction( void *pvThis,
+ const XML_Char *sTarget ,
+ const XML_Char *sData )
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+ if( pImpl->rDocumentHandler.is() ) {
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl ,
+ rDocumentHandler->processingInstruction( XML_CHAR_TO_OUSTRING( sTarget ),
+ XML_CHAR_TO_OUSTRING( sData ) ) );
+ }
+}
+
+
+void SaxExpatParser_Impl::callbackUnparsedEntityDecl(void *pvThis ,
+ const XML_Char *entityName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId,
+ const XML_Char *notationName)
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+ if( pImpl->rDTDHandler.is() ) {
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(
+ pImpl ,
+ rDTDHandler->unparsedEntityDecl(
+ XML_CHAR_TO_OUSTRING( entityName ),
+ XML_CHAR_TO_OUSTRING( publicId ) ,
+ XML_CHAR_TO_OUSTRING( systemId ) ,
+ XML_CHAR_TO_OUSTRING( notationName ) ) );
+ }
+}
+
+void SaxExpatParser_Impl::callbackNotationDecl( void *pvThis,
+ const XML_Char *notationName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId)
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+ if( pImpl->rDTDHandler.is() ) {
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl,
+ rDTDHandler->notationDecl( XML_CHAR_TO_OUSTRING( notationName ) ,
+ XML_CHAR_TO_OUSTRING( publicId ) ,
+ XML_CHAR_TO_OUSTRING( systemId ) ) );
+ }
+
+}
+
+
+
+int SaxExpatParser_Impl::callbackExternalEntityRef( XML_Parser parser,
+ const XML_Char *context,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId)
+{
+ sal_Bool bOK = sal_True;
+ InputSource source;
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)XML_GetUserData( parser ));
+
+ struct Entity entity;
+
+ if( pImpl->rEntityResolver.is() ) {
+ try
+ {
+ entity.structSource = pImpl->rEntityResolver->resolveEntity(
+ XML_CHAR_TO_OUSTRING( publicId ) ,
+ XML_CHAR_TO_OUSTRING( systemId ) );
+ }
+ catch( SAXParseException & e )
+ {
+ pImpl->exception = e;
+ bOK = sal_False;
+ }
+ catch( SAXException & e )
+ {
+ pImpl->exception = SAXParseException(
+ e.Message , e.Context , e.WrappedException ,
+ pImpl->rDocumentLocator->getPublicId(),
+ pImpl->rDocumentLocator->getSystemId(),
+ pImpl->rDocumentLocator->getLineNumber(),
+ pImpl->rDocumentLocator->getColumnNumber() );
+ bOK = sal_False;
+ }
+ }
+
+ if( entity.structSource.aInputStream.is() ) {
+ entity.pParser = XML_ExternalEntityParserCreate( parser , context, 0 );
+ if( ! entity.pParser )
+ {
+ return sal_False;
+ }
+
+ entity.converter.setInputStream( entity.structSource.aInputStream );
+ pImpl->pushEntity( entity );
+ try
+ {
+ pImpl->parse();
+ }
+ catch( SAXParseException & e )
+ {
+ pImpl->exception = e;
+ bOK = sal_False;
+ }
+ catch( IOException &e )
+ {
+ pImpl->exception.WrappedException <<= e;
+ bOK = sal_False;
+ }
+ catch( RuntimeException &e )
+ {
+ pImpl->exception.WrappedException <<=e;
+ bOK = sal_False;
+ }
+
+ pImpl->popEntity();
+
+ XML_ParserFree( entity.pParser );
+ }
+
+ return bOK;
+}
+
+int SaxExpatParser_Impl::callbackUnknownEncoding(void *encodingHandlerData,
+ const XML_Char *name,
+ XML_Encoding *info)
+{
+ return 0;
+}
+
+void SaxExpatParser_Impl::callbackDefault( void *pvThis, const XML_Char *s, int len)
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl,
+ rExtendedDocumentHandler->unknown( XML_CHAR_N_TO_USTRING( s ,len) ) );
+}
+
+void SaxExpatParser_Impl::callbackComment( void *pvThis , const XML_Char *s )
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl,
+ rExtendedDocumentHandler->comment( XML_CHAR_TO_OUSTRING( s ) ) );
+}
+
+void SaxExpatParser_Impl::callbackStartCDATA( void *pvThis )
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS( pImpl, rExtendedDocumentHandler->startCDATA() );
+}
+
+
+void SaxExpatParser_Impl::callErrorHandler( SaxExpatParser_Impl *pImpl ,
+ const SAXParseException & e )
+{
+ try
+ {
+ if( pImpl->rErrorHandler.is() ) {
+ Any a;
+ a <<= e;
+ pImpl->rErrorHandler->error( a );
+ }
+ else {
+ pImpl->exception = e;
+ pImpl->bExceptionWasThrown = sal_True;
+ }
+ }
+ catch( SAXParseException & ex ) {
+ pImpl->exception = ex;
+ pImpl->bExceptionWasThrown = sal_True;
+ }
+ catch( SAXException & ex ) {
+ pImpl->exception = SAXParseException(
+ ex.Message,
+ ex.Context,
+ ex.WrappedException,
+ pImpl->rDocumentLocator->getPublicId(),
+ pImpl->rDocumentLocator->getSystemId(),
+ pImpl->rDocumentLocator->getLineNumber(),
+ pImpl->rDocumentLocator->getColumnNumber()
+ );
+ pImpl->bExceptionWasThrown = sal_True;
+ }
+}
+
+void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis )
+{
+ SaxExpatParser_Impl *pImpl = ((SaxExpatParser_Impl*)pvThis);
+
+ CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pImpl,rExtendedDocumentHandler->endCDATA() );
+}
+
+
+
+extern "C"
+{
+
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey ) );
+
+ Reference< XRegistryKey > xNewKey = xKey->createKey(
+ OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) );
+ xNewKey->createKey( OUString::createFromAscii( SERVICE_NAME ) );
+
+ xNewKey = xKey->createKey( OUString::createFromAscii("/") +
+ SaxWriter_getImplementationName()+
+ OUString::createFromAscii( "/UNO/SERVICES" ) );
+ xNewKey->createKey( SaxWriter_getServiceName() );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+
+
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pRet = 0;
+
+ if (pServiceManager )
+ {
+ Reference< XSingleServiceFactory > xRet;
+ Reference< XMultiServiceFactory > xSMgr =
+ reinterpret_cast< XMultiServiceFactory * > ( pServiceManager );
+
+ OUString aImplementationName = OUString::createFromAscii( pImplName );
+
+ if (aImplementationName ==
+ OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ) )
+ {
+ xRet = createSingleFactory( xSMgr, aImplementationName,
+ SaxExpatParser_CreateInstance,
+ SaxExpatParser::getSupportedServiceNames_Static() );
+ }
+ else if ( aImplementationName == SaxWriter_getImplementationName() )
+ {
+ xRet = createSingleFactory( xSMgr, aImplementationName,
+ SaxWriter_CreateInstance,
+ SaxWriter_getSupportedServiceNames() );
+ }
+
+ if (xRet.is())
+ {
+ xRet->acquire();
+ pRet = xRet.get();
+ }
+ }
+
+ return pRet;
+}
+
+
+}
+
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
new file mode 100644
index 000000000000..b4844d18c740
--- /dev/null
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -0,0 +1,736 @@
+/*************************************************************************
+ *
+ * $RCSfile: saxwriter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <string.h>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+
+#include <com/sun/star/io/XActiveDataSource.hpp>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+#include <rtl/strbuf.hxx>
+
+#include <assert.h>
+
+using namespace ::rtl;
+using namespace ::std;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::io;
+
+#include "factory.hxx"
+#include "xml2utf.hxx"
+
+#define LINEFEED 10
+
+/******
+*
+*
+* Character conversion functions
+*
+*
+*****/
+
+
+/*****
+*
+* Does special conversions (beside encoding) that is needed for xml. E.g. &<>"' plus some more are
+* special characters in XML that need to be transformed
+*
+* @param bConvertAll For Attributes it is necessary to convert every symbol (including line feed and tab)
+* Set this to true, if you want to perform this special conversion
+*
+****/
+sal_Int32 CalcXMLLen( const Sequence<sal_Int8> & seq , sal_Bool bConvertAll )
+{
+ sal_Int32 nLen = 0;
+ const sal_Int8 *pArray = seq.getConstArray();
+
+
+ for( int i = 0 ; i < seq.getLength() ; i ++ ) {
+
+ sal_Int8 c = pArray[i];
+ if( '&' == c ) { // resemble to &amp;
+ nLen += 5;
+ }
+ else if( '<' == c ) {
+ nLen += 4; // &lt;
+ }
+ else if( '>' == c ) {
+ nLen += 4; // &gt;
+ }
+ else if( 39 == c ) { // 39 == '''
+ nLen += 6; // &apos;
+ }
+ else if( '"' == c ) {
+ nLen += 6; // &quot;
+ }
+ else if( 13 == c ) {
+ nLen += 6; // &#x0d;
+ }
+ else if( bConvertAll && LINEFEED == c ) {
+ nLen += 6;
+ }
+ else if( bConvertAll && 9 == c ) {
+ nLen += 6;
+ }
+ else {
+ nLen ++;
+ }
+ }
+
+ return nLen;
+}
+
+
+inline sal_Int32 getFirstLineBreak( const Sequence<sal_Int8> & seq)
+{
+ const sal_Int8 *pSource = seq.getConstArray();
+
+ sal_Int32 nLen = seq.getLength();
+ for( int n = 0; n < nLen ; n ++ )
+ {
+ if( LINEFEED == pSource[n] ) {
+ return n;
+ }
+ }
+ return -1;
+}
+
+inline sal_Int32 getLastLineBreak( const Sequence<sal_Int8> & seq)
+{
+ const sal_Int8 *pSource = seq.getConstArray();
+ sal_Int32 nLen = seq.getLength();
+
+ for( int n = nLen-1; n >= 0 ; n -- )
+ {
+ if( LINEFEED == pSource[n] ) {
+ return n;
+ }
+ }
+ return -1;
+}
+
+
+class SAXWriter :
+ public WeakImplHelper3<
+ XActiveDataSource,
+ XExtendedDocumentHandler,
+ XServiceInfo >
+{
+public:
+ SAXWriter( ) :
+ m_nMaxColumn(72),
+ m_bForceLineBreak(sal_False),
+ m_bAllowLineBreak(sal_False),
+ m_unicode2utf8( RTL_TEXTENCODING_UTF8 )
+ {}
+
+public: // XActiveDataSource
+ virtual void SAL_CALL setOutputStream(const Reference< XOutputStream > & aStream)
+ throw (RuntimeException)
+ {
+ m_out = aStream;
+ m_bDocStarted = sal_False;
+ m_nLevel = 0;
+ m_bIsCDATA = sal_False;
+ m_nColumn = 0;
+ }
+ virtual Reference< XOutputStream > SAL_CALL getOutputStream(void)
+ throw(RuntimeException)
+ { return m_out; }
+
+public: // XDocumentHandler
+ virtual void SAL_CALL startDocument(void)
+ throw(SAXException, RuntimeException);
+
+ virtual void SAL_CALL endDocument(void)
+ throw(SAXException, RuntimeException);
+
+ virtual void SAL_CALL startElement(const OUString& aName,
+ const Reference< XAttributeList > & xAttribs)
+ throw (SAXException, RuntimeException);
+
+ virtual void SAL_CALL endElement(const OUString& aName)
+ throw(SAXException, RuntimeException);
+
+ virtual void SAL_CALL characters(const OUString& aChars)
+ throw(SAXException, RuntimeException);
+
+ virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces)
+ throw(SAXException, RuntimeException);
+ virtual void SAL_CALL processingInstruction(const OUString& aTarget,
+ const OUString& aData)
+ throw(SAXException, RuntimeException);
+ virtual void SAL_CALL setDocumentLocator(const Reference< XLocator > & xLocator)
+ throw(SAXException, RuntimeException);
+
+public: // XExtendedDocumentHandler
+ virtual void SAL_CALL startCDATA(void) throw(SAXException, RuntimeException);
+ virtual void SAL_CALL endCDATA(void) throw(RuntimeException);
+ virtual void SAL_CALL comment(const OUString& sComment)
+ throw(SAXException, RuntimeException);
+ virtual void SAL_CALL unknown(const OUString& sString)
+ throw(SAXException, RuntimeException);
+ virtual void SAL_CALL allowLineBreak(void)
+ throw(SAXException,RuntimeException);
+
+public: // XServiceInfo
+ OUString SAL_CALL getImplementationName() throw();
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
+ sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw();
+
+private:
+
+ void doIndent( Sequence<sal_Int8> &);
+ void writeSequence( const Sequence<sal_Int8> & seq );
+
+ inline void pushStartElement()
+ {
+ if( m_seqStartElement.getLength() )
+ {
+ writeSequence( m_seqStartElement );
+ m_seqStartElement = Sequence < sal_Int8 > ();
+ }
+ }
+
+ Sequence < sal_Int8 > ustring2UTF8( const OUString &sValue )
+ {
+ return m_unicode2utf8.convert( sValue );
+ }
+
+ Sequence < sal_Int8 > utf8ToXML( const Sequence< sal_Int8 > & , sal_Bool bConvertAll );
+
+ /****
+ * @param bConvertAll TRUE, when LINEFEED plus tab shall also be normalized
+ * sal_False otherwise
+ *
+ ****/
+ Sequence < sal_Int8 > ustring2XML( const OUString &sValue , sal_Bool bConvertAll )
+ {
+ return utf8ToXML( ustring2UTF8( sValue ) , bConvertAll );
+ }
+
+
+ Unicode2TextConverter m_unicode2utf8;
+ Reference< XOutputStream > m_out;
+ Sequence < sal_Int8 > m_seqStartElement;
+
+ // Status information
+ sal_Bool m_bDocStarted;
+ sal_Bool m_bIsCDATA;
+ sal_Bool m_bForceLineBreak;
+ sal_Bool m_bAllowLineBreak;
+ sal_Int32 m_nLevel;
+ sal_Int32 m_nColumn;
+ sal_Int32 m_nMaxColumn;
+};
+
+
+//--------------------------------------
+// the extern interface
+//---------------------------------------
+Reference < XInterface > SAL_CALL SaxWriter_CreateInstance(
+ const Reference < XMultiServiceFactory > & rSMgr )
+ throw (Exception)
+{
+ SAXWriter *p = new SAXWriter;
+ return Reference< XInterface > ( SAL_STATIC_CAST(OWeakObject *, p ) );
+}
+
+OUString SaxWriter_getServiceName()
+{
+ return OUString::createFromAscii( "com.sun.star.xml.sax.Writer" );
+}
+
+OUString SaxWriter_getImplementationName()
+{
+ return OUString::createFromAscii( "com.sun.star.extensions.xml.sax.Writer" );
+}
+
+Sequence< OUString > SaxWriter_getSupportedServiceNames(void) throw()
+{
+ Sequence<OUString> aRet(1);
+ aRet.getArray()[0] = SaxWriter_getImplementationName();
+ return aRet;
+}
+
+
+Sequence < sal_Int8 > SAXWriter::utf8ToXML( const Sequence<sal_Int8> & seqSource , sal_Bool bConvertAll )
+{
+ Sequence< sal_Int8 > seqTarget( CalcXMLLen( seqSource , bConvertAll ) );
+ sal_Int32 nMaxSource = seqSource.getLength();
+ const sal_Int8 *pSource = seqSource.getConstArray();
+ sal_Int8 *pTarget = seqTarget.getArray();
+ sal_Int32 nTarget = 0;
+
+ for( int nSource = 0 ; nSource < nMaxSource ; nSource ++ ) {
+ sal_Int8 c = pSource[nSource];
+ if( '&' == c ) { // resemble to &amp;
+ memcpy( &(pTarget[nTarget]) , "&amp;" , 5 );
+ nTarget += 5;
+ }
+ else if( '<' == c ) {
+ memcpy( &(pTarget[nTarget]) , "&lt;" , 4 );
+ nTarget += 4; // &lt;
+ }
+ else if( '>' == c ) {
+ memcpy( &(pTarget[nTarget]) , "&gt;" , 4 );
+ nTarget += 4; // &gt;
+ }
+ else if( 39 == c ) { // 39 == '''
+ memcpy( &(pTarget[nTarget]) , "&apos;" , 6 );
+ nTarget += 6; // &apos;
+ }
+ else if( '"' == c ) {
+ memcpy( &(pTarget[nTarget]) , "&quot;" , 6 );
+ nTarget += 6; // &quot;
+ }
+ else if( 13 == c ) {
+ memcpy( &(pTarget[nTarget]) , "&#x0d;" , 6 );
+ nTarget += 6;
+ }
+ else if( LINEFEED == c && bConvertAll ) {
+ memcpy( &(pTarget[nTarget]) , "&#x0a;" , 6 );
+ nTarget += 6;
+ }
+ else if( 9 == c && bConvertAll ) {
+ memcpy( &(pTarget[nTarget]) , "&#x09;" , 6 );
+ nTarget += 6;
+ }
+ else {
+ pTarget[nTarget] = c;
+ nTarget ++;
+ }
+ }
+ return seqTarget;
+}
+
+
+void SAXWriter::doIndent( Sequence<sal_Int8> &seq )
+{
+ sal_Int32 nLength = getFirstLineBreak( seq );
+ nLength = ( nLength >= 0 ) ? nLength : seq.getLength();
+ if( ( m_bForceLineBreak ) ||
+ ( m_bAllowLineBreak && nLength + m_nColumn > m_nMaxColumn )
+ ) {
+
+ // write the linebreaks !
+ Sequence<sal_Int8> seqIndent( m_nLevel + 1 );
+ seqIndent.getArray()[0] = 10;
+ memset( &(seqIndent.getArray()[1] ) , 32 , m_nLevel );
+ writeSequence( seqIndent );
+
+ // remove one leading space in the sequence
+ if( seq.getLength() && 32 == seq.getArray()[0] ) {
+ memmove( seq.getArray() , &(seq.getArray()[1]) , seq.getLength() -1 );
+ seq.realloc( seq.getLength()-1 );
+ }
+
+ }
+
+ m_bForceLineBreak = sal_False;
+ m_bAllowLineBreak = sal_False;
+}
+
+
+/********
+* write through to the output stream and counts columns
+*
+*****/
+void SAXWriter::writeSequence( const Sequence<sal_Int8> & seq )
+{
+
+ sal_Int32 nPos = getLastLineBreak( seq );
+ try
+ {
+ m_out->writeBytes( seq );
+ }
+ catch( IOException & e )
+ {
+ Any a;
+ a <<= e;
+ throw SAXException(
+ OUString::createFromAscii( "io exception during writing" ),
+ Reference< XInterface > (),
+ a );
+ }
+
+ if( nPos >= 0 ) {
+ m_nColumn = seq.getLength() - (nPos+1);
+ }
+ else {
+ m_nColumn += seq.getLength();
+ }
+}
+
+
+
+
+// XServiceInfo
+OUString SAXWriter::getImplementationName() throw()
+{
+ return SaxWriter_getImplementationName();
+}
+
+// XServiceInfo
+sal_Bool SAXWriter::supportsService(const OUString& ServiceName) throw()
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString * pArray = aSNL.getConstArray();
+
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+// XServiceInfo
+Sequence< OUString > SAXWriter::getSupportedServiceNames(void) throw ()
+{
+ Sequence<OUString> seq(1);
+ seq.getArray()[0] = SaxWriter_getServiceName();
+ return seq;
+}
+
+
+
+void SAXWriter::startDocument() throw(SAXException, RuntimeException )
+{
+ if( m_bDocStarted || ! m_out.is() ) {
+ throw SAXException();
+ }
+ m_bDocStarted = sal_True;
+ const char pc[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+ const int nLen = strlen( pc );
+ Sequence<sal_Int8> seqWrite( nLen+1 );
+ memcpy( seqWrite.getArray() , pc , nLen );
+ seqWrite.getArray()[nLen] = LINEFEED;
+ writeSequence( seqWrite );
+}
+
+
+void SAXWriter::endDocument(void) throw(SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted )
+ {
+ throw SAXException();
+ }
+ if( m_nLevel ) {
+ throw SAXException(
+ OUString::createFromAscii( "unexpected end of document" ),
+ Reference< XInterface >() , Any() );
+ }
+ m_out->closeOutput();
+}
+
+
+void SAXWriter::startElement(const OUString& aName, const Reference< XAttributeList >& xAttribs)
+ throw(SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted )
+ {
+ throw SAXException();
+ }
+ if( m_bIsCDATA )
+ {
+ throw SAXException();
+ }
+ pushStartElement();
+
+ sal_Int32 nAttribCount = xAttribs.is() ? xAttribs->getLength() : 0;
+
+ OStringBuffer str(64 *( nAttribCount+1) );
+ str.append( "<" );
+
+ // Tags may only contain ascii chars !
+ str.append( OUStringToOString( aName.getStr() , RTL_TEXTENCODING_UTF8 ) );
+
+ for( int n = 0 ; n < nAttribCount ; n ++ ) {
+ str.append( " " );
+ str.append( OUStringToOString( xAttribs->getNameByIndex( n ) , RTL_TEXTENCODING_UTF8 ) );
+ str.append( "=\"" );
+
+ Sequence<sal_Int8> seq = ustring2XML( xAttribs->getValueByIndex( n ) , sal_True );
+ str.append( ( const sal_Char * ) seq.getConstArray() , seq.getLength() );
+ str.append( "\"" );
+ }
+
+ // preparing for empty tag
+ str.append( ">" );
+
+ Sequence<sal_Int8> seqWrite( str.getLength() );
+ memcpy( seqWrite.getArray() , str.getStr() , str.getLength() );
+
+ doIndent( seqWrite );
+
+ m_seqStartElement = seqWrite;
+
+ m_nLevel ++;
+}
+
+void SAXWriter::endElement(const OUString& aName) throw (SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted ) {
+ throw SAXException ();
+ }
+ m_nLevel --;
+
+ if( m_nLevel < 0 ) {
+ throw SAXException();
+ }
+
+ if( m_seqStartElement.getLength() )
+ {
+ m_seqStartElement.realloc( m_seqStartElement.getLength() + 1 );
+
+ sal_Int8 *p = m_seqStartElement.getArray();
+ p[m_seqStartElement.getLength()-2] = '/';
+ p[m_seqStartElement.getLength()-1] = '>';
+ writeSequence( m_seqStartElement );
+ m_seqStartElement = Sequence< sal_Int8 > ();
+ }
+ else {
+ // only ascii chars allowed
+ sal_Int32 nLen = aName.getLength();
+ Sequence< sal_Int8 > seqWrite( nLen + 3 );
+
+ sal_Int8 *p = seqWrite.getArray();
+ sal_Unicode *pStr = (sal_Unicode * )aName.getStr();
+
+ p[0] = '<';
+ p[1] = '/';
+ for( sal_Int32 i = 0 ; i < nLen ; i ++ )
+ {
+ p[2+i] = (sal_Int8) pStr[i];
+ }
+ p[nLen+2] = '>';
+
+ doIndent( seqWrite );
+ writeSequence( seqWrite );
+ }
+}
+
+void SAXWriter::characters(const OUString& aChars) throw(SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted )
+ {
+ throw SAXException();
+ }
+ pushStartElement();
+
+ if( m_bIsCDATA ) {
+ Sequence<sal_Int8> seqWrite = ustring2UTF8( aChars);
+ writeSequence( seqWrite );
+ }
+ else {
+ Sequence<sal_Int8> seqWrite = ustring2XML( aChars , sal_False );
+ doIndent( seqWrite );
+ writeSequence( seqWrite );
+ }
+}
+
+
+void SAXWriter::ignorableWhitespace(const OUString& aWhitespaces) throw(SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted )
+ {
+ throw SAXException ();
+ }
+
+ m_bForceLineBreak = sal_True;
+}
+
+void SAXWriter::processingInstruction(const OUString& aTarget, const OUString& aData)
+ throw (SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted || m_bIsCDATA )
+ {
+ throw SAXException();
+ }
+
+ pushStartElement();
+
+ OStringBuffer str( 128 );
+ str.append( "<?" );
+ str.append( OUStringToOString( aTarget , RTL_TEXTENCODING_UTF8 ) );
+ str.append( " " );
+ str.append( OUStringToOString( aData , RTL_TEXTENCODING_UTF8 ) ); // only ascii chars allowed
+ str.append( "?>" );
+
+ Sequence<sal_Int8> seq( str.getLength() );
+ memcpy( seq.getArray() , str.getStr() , str.getLength() );
+
+ doIndent( seq );
+ writeSequence( seq );
+}
+
+
+void SAXWriter::setDocumentLocator(const Reference< XLocator >& xLocator)
+ throw (SAXException, RuntimeException)
+{
+
+}
+
+void SAXWriter::startCDATA(void) throw(SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted || m_bIsCDATA)
+ {
+ throw SAXException ();
+ }
+
+ pushStartElement();
+
+ Sequence < sal_Int8 > seq( ( sal_Int8 * ) "<![CDATA[" , 9 );
+
+ doIndent( seq );
+ writeSequence( seq );
+ m_bIsCDATA = sal_True;
+}
+
+void SAXWriter::endCDATA(void) throw (RuntimeException)
+{
+ if( ! m_bDocStarted | ! m_bIsCDATA)
+ {
+ throw SAXException();
+ }
+
+ pushStartElement();
+ Sequence<sal_Int8> seq( ( sal_Int8 * ) "]]>" , 3 );
+
+ doIndent( seq );
+ writeSequence( seq );
+ m_bIsCDATA = sal_False;
+}
+
+
+void SAXWriter::comment(const OUString& sComment) throw(SAXException, RuntimeException)
+{
+ if( ! m_bDocStarted || m_bIsCDATA )
+ {
+ throw SAXException();
+ }
+
+ pushStartElement();
+
+ Sequence<sal_Int8> seq = ustring2XML( sComment , sal_False );
+
+ Sequence<sal_Int8> seqWrite( seq.getLength() + 7 );
+ sal_Int8 *p = seqWrite.getArray();
+ p[0] = '<';
+ p[1] = '!';
+ p[2] = '-';
+ p[3] = '-';
+ memcpy( &(p[4]) , seq.getConstArray() , seq.getLength() );
+ p[4+seq.getLength()] = '-';
+ p[5+seq.getLength()] = '-';
+ p[6+seq.getLength()] = '>';
+
+ doIndent( seqWrite );
+ writeSequence( seqWrite );
+}
+
+
+void SAXWriter::allowLineBreak( ) throw ( SAXException , RuntimeException)
+{
+ if( ! m_bDocStarted || m_bAllowLineBreak ) {
+ throw SAXException();
+ }
+
+ m_bAllowLineBreak = sal_True;
+}
+
+void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeException)
+{
+
+ if( ! m_bDocStarted )
+ {
+ throw SAXException ();
+ }
+ if( m_bIsCDATA )
+ {
+ throw SAXException();
+ }
+
+ pushStartElement();
+
+ OString str = OUStringToOString( sString , RTL_TEXTENCODING_UTF8 );
+
+ Sequence<sal_Int8> seq( str.getLength() );
+ memcpy( seq.getArray() , str.getStr() , str.getLength() );
+
+ doIndent( seq );
+ writeSequence( seq );
+}
+
+
diff --git a/sax/source/expatwrap/xml2utf.cxx b/sax/source/expatwrap/xml2utf.cxx
new file mode 100644
index 000000000000..a87cefab493a
--- /dev/null
+++ b/sax/source/expatwrap/xml2utf.cxx
@@ -0,0 +1,607 @@
+/*************************************************************************
+ *
+ * $RCSfile: xml2utf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <string.h>
+#include <assert.h>
+
+#include <sal/types.h>
+
+#include <rtl/textenc.h>
+#include <rtl/tencinfo.h>
+
+
+#include <com/sun/star/io/XInputStream.hpp>
+
+using namespace rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+
+#include "xml2utf.hxx"
+
+
+sal_Int32 XMLFile2UTFConverter::readAndConvert( Sequence<sal_Int8> &seq , sal_Int32 nMaxToRead )
+ throw ( IOException, NotConnectedException , BufferSizeExceededException , RuntimeException )
+{
+
+ Sequence<sal_Int8> seqIn;
+
+ if( ! m_in.is() ) {
+ throw NotConnectedException();
+ }
+ if( ! m_bStarted ) {
+ nMaxToRead = Max( 512 , nMaxToRead ); // it should be possible to find the encoding attribute
+ // within the first 512 bytes == 128 chars in UCS-4
+ }
+
+ sal_Int32 nRead;
+ Sequence< sal_Int8 > seqStart;
+ while( sal_True )
+ {
+ nRead = m_in->readSomeBytes( seq , nMaxToRead );
+
+ if( nRead + seqStart.getLength())
+ {
+ // if nRead is 0, the file is already eof.
+ if( ! m_bStarted && nRead )
+ {
+ // ensure that enough data is available to parse encoding
+ if( seqStart.getLength() )
+ {
+ seq.realloc( seqStart.getLength() + seq.getLength() );
+ memcpy( (sal_Int8*)seq.getConstArray() + seqStart.getLength() ,
+ seq.getConstArray() ,
+ seq.getLength() );
+ memcpy( (sal_Int8*)seq.getConstArray() ,
+ seqStart.getConstArray(),
+ seqStart.getLength() );
+ }
+
+ // autodetection with the first bytes
+ if( ! isEncodingRecognizable( seq ) )
+ {
+ seqStart.realloc( seqStart.getLength() + seq.getLength() );
+ memcpy( (sal_Int8*)seqStart.getConstArray() + seqStart.getLength(),
+ seq.getConstArray(),
+ seq.getLength());
+ // read more !
+ continue;
+ }
+ if( scanForEncoding( seq ) || m_sEncoding.getLength() ) {
+ // initialize decoding
+ initializeDecoding();
+ }
+ nRead = seq.getLength();
+ seqStart = Sequence < sal_Int8 > ();
+ }
+
+ // do the encoding
+ if( m_pText2Unicode && m_pUnicode2Text &&
+ m_pText2Unicode->canContinue() && m_pUnicode2Text->canContinue() ) {
+
+ Sequence<sal_Unicode> seqUnicode = m_pText2Unicode->convert( seq );
+ seq = m_pUnicode2Text->convert( seqUnicode.getConstArray(), seqUnicode.getLength() );
+ }
+
+ if( ! m_bStarted )
+ {
+ // it must now be ensured, that no encoding attribute exist anymore
+ // ( otherwise the expat-Parser will crash )
+ // This must be done after decoding !
+ // ( e.g. Files decoded in ucs-4 cannot be read properly )
+ m_bStarted = sal_True;
+ removeEncoding( seq );
+ }
+ nRead = seq.getLength();
+ }
+
+ break;
+ }
+ return nRead;
+}
+
+
+XMLFile2UTFConverter::~XMLFile2UTFConverter()
+{
+ if( m_pText2Unicode )
+ delete m_pText2Unicode;
+ if( m_pUnicode2Text )
+ delete m_pUnicode2Text;
+}
+
+
+void XMLFile2UTFConverter::removeEncoding( Sequence<sal_Int8> &seq )
+{
+ const sal_Int8 *pSource = seq.getArray();
+ if( ! strncmp( (const char * ) pSource , "<?xml" , 4) )
+ {
+
+ // scan for encoding
+ OString str( (sal_Char * ) pSource , seq.getLength() );
+
+ // cut sequence to first line break
+ // find first line break;
+ int nMax = str.indexOf( 10 );
+ if( nMax >= 0 )
+ {
+ str = str.copy( 0 , nMax );
+ }
+
+ int nFound = str.indexOf( " encoding" );
+ if( nFound < str.getLength() ) {
+ int nStop;
+ int nStart = str.indexOf( "\"" , nFound );
+ if( nStart < 0 || str.indexOf( "'" , nFound ) < nStart )
+ {
+ nStart = str.indexOf( "'" , nFound );
+ nStop = str.indexOf( "'" , nStart +1 );
+ }
+ else
+ {
+ int nStop = str.indexOf( "\"" , nStart +1);
+ }
+
+ if( nStart >= 0 && nStop >= 0 && nStart+1 < nStop )
+ {
+ // remove encoding tag from file
+ memmove( &( seq.getArray()[nFound] ) ,
+ &( seq.getArray()[nStop+1]) ,
+ seq.getLength() - nStop -1);
+ seq.realloc( seq.getLength() - ( nStop+1 - nFound ) );
+// str = String( (char * ) seq.getArray() , seq.getLen() );
+ }
+ }
+ }
+}
+
+// Checks, if enough data has been accumulated to recognize the encoding
+sal_Bool XMLFile2UTFConverter::isEncodingRecognizable( const Sequence< sal_Int8 > &seq)
+{
+ const sal_Int8 *pSource = seq.getConstArray();
+ sal_Bool bCheckIfFirstClosingBracketExsists = sal_False;
+
+ if( seq.getLength() < 8 ) {
+ // no recognition possible, when less than 8 bytes are available
+ return sal_False;
+ }
+
+ if( ! strncmp( (const char * ) pSource , "<?xml" , 4 ) ) {
+ // scan if the <?xml tag finishes within this buffer
+ bCheckIfFirstClosingBracketExsists = sal_True;
+ }
+ else if( ('<' == pSource[0] || '<' == pSource[2] ) &&
+ ( ('?' == pSource[4] || '?' == pSource[6] ) ) )
+ {
+ // check for utf-16
+ bCheckIfFirstClosingBracketExsists = sal_True;
+ }
+ else if( ( '<' == pSource[1] || '<' == pSource[3] ) &&
+ ( '?' == pSource[5] || '?' == pSource[7] ) )
+ {
+ // check for
+ bCheckIfFirstClosingBracketExsists = sal_True;
+ }
+
+ if( bCheckIfFirstClosingBracketExsists )
+ {
+ for( sal_Int32 i = 0; i < seq.getLength() ; i ++ )
+ {
+ // whole <?xml tag is valid
+ if( '>' == pSource[ i ] )
+ {
+ return sal_True;
+ }
+ }
+ return sal_False;
+ }
+
+ // No <? tag in front, no need for a bigger buffer
+ return sal_True;
+}
+
+sal_Bool XMLFile2UTFConverter::scanForEncoding( Sequence< sal_Int8 > &seq )
+{
+ const sal_Int8 *pSource = seq.getConstArray();
+ sal_Bool bReturn = sal_True;
+
+ if( seq.getLength() < 4 ) {
+ // no recognition possible, when less than 4 bytes are available
+ return sal_False;
+ }
+
+ // first level : detect possible file formats
+ if( ! strncmp( (const char * ) pSource , "<?xml" , 4 ) ) {
+
+ // scan for encoding
+ OString str( (const sal_Char *) pSource , seq.getLength() );
+
+ // cut sequence to first line break
+ //find first line break;
+ int nMax = str.indexOf( 10 );
+ if( nMax >= 0 )
+ {
+ str = str.copy( 0 , nMax );
+ }
+
+ int nFound = str.indexOf( " encoding" );
+ if( nFound < str.getLength() ) {
+ int nStop;
+ int nStart = str.indexOf( "\"" , nFound );
+ if( nStart < 0 || str.indexOf( "'" , nFound ) < nStart )
+ {
+ nStart = str.indexOf( "'" , nFound );
+ nStop = str.indexOf( "'" , nStart +1 );
+ }
+ else
+ {
+ int nStop = str.indexOf( "\"" , nStart +1);
+ }
+ if( nStart >= 0 && nStop >= 0 && nStart+1 < nStop )
+ {
+ // encoding found finally
+ m_sEncoding = str.copy( nStart+1 , nStop - nStart - 1 );
+ }
+ }
+ }
+ else if( 0xFE == pSource[0] && 0xFF == pSource[1] ) {
+ // UTF-16 big endian
+ // conversion is done so that encoding information can be easily extracted
+ m_sEncoding = "utf-16";
+ }
+ else if( 0xFF == pSource[0] && 0xFE == pSource[1] ) {
+ // UTF-16 little endian
+ // conversion is done so that encoding information can be easily extracted
+ m_sEncoding = "utf-16";
+ }
+ else if( 0x00 == pSource[0] && 0x3c == pSource[1] && 0x00 == pSource[2] && 0x3f == pSource[3] ) {
+ // UTF-16 big endian without byte order mark (this is (strictly speaking) an error.)
+ // The byte order mark is simply added
+
+ // simply add the byte order mark !
+ seq.realloc( seq.getLength() + 2 );
+ memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() );
+ ((sal_uInt8*)seq.getArray())[0] = 0xFE;
+ ((sal_uInt8*)seq.getArray())[1] = 0xFF;
+
+ m_sEncoding = "utf-16";
+ }
+ else if( 0x3c == pSource[0] && 0x00 == pSource[1] && 0x3f == pSource[2] && 0x00 == pSource[3] ) {
+ // UTF-16 little endian without byte order mark (this is (strictly speaking) an error.)
+ // The byte order mark is simply added
+
+ seq.realloc( seq.getLength() + 2 );
+ memmove( &( seq.getArray()[2] ) , seq.getArray() , seq.getLength() );
+ ((sal_uInt8*)seq.getArray())[0] = 0xFF;
+ ((sal_uInt8*)seq.getArray())[1] = 0xFE;
+
+ m_sEncoding = "utf-16";
+ }
+ else if( 0x00 == pSource[0] && 0x00 == pSource[1] && 0x00 == pSource[2] && 0x3c == pSource[3] ) {
+ // UCS-4 big endian
+ m_sEncoding = "ucs-4";
+ }
+ else if( 0x3c == pSource[0] && 0x00 == pSource[1] && 0x00 == pSource[2] && 0x00 == pSource[3] ) {
+ // UCS-4 little endian
+ m_sEncoding = "ucs-4";
+ }
+ else if( 0x4c == pSource[0] && 0x6f == pSource[1] && 0xa7 == pSource[2] && 0x94 == pSource[3] ) {
+ // EBCDIC
+ bReturn = sal_False; // must be extended
+ }
+ else {
+ // other
+ // UTF8 is directly recognized by the parser.
+ bReturn = sal_False;
+ }
+
+ return bReturn;
+}
+
+void XMLFile2UTFConverter::initializeDecoding()
+{
+
+ if( m_sEncoding.getLength() )
+ {
+ rtl_TextEncoding encoding = rtl_getTextEncodingFromMimeCharset( m_sEncoding.getStr() );
+ if( encoding != RTL_TEXTENCODING_UTF8 )
+ {
+ m_pText2Unicode = new Text2UnicodeConverter( m_sEncoding );
+ m_pUnicode2Text = new Unicode2TextConverter( RTL_TEXTENCODING_UTF8 );
+ }
+ }
+}
+
+
+//----------------------------------------------
+//
+// Text2UnicodeConverter
+//
+//----------------------------------------------
+Text2UnicodeConverter::Text2UnicodeConverter( const OString &sEncoding )
+{
+ rtl_TextEncoding encoding = rtl_getTextEncodingFromMimeCharset( sEncoding.getStr() );
+ if( RTL_TEXTENCODING_DONTKNOW == encoding )
+ {
+ m_bCanContinue = sal_False;
+ m_bInitialized = sal_False;
+ }
+ else
+ {
+ init( encoding );
+ }
+}
+
+Text2UnicodeConverter::Text2UnicodeConverter( rtl_TextEncoding encoding )
+{
+ init( encoding );
+}
+
+
+Text2UnicodeConverter::~Text2UnicodeConverter()
+{
+ if( m_bInitialized )
+ {
+ rtl_destroyTextToUnicodeContext( m_convText2Unicode , m_contextText2Unicode );
+ rtl_destroyUnicodeToTextConverter( m_convText2Unicode );
+ }
+}
+
+void Text2UnicodeConverter::init( rtl_TextEncoding encoding )
+{
+ m_bCanContinue = sal_True;
+ m_bInitialized = sal_True;
+
+ m_convText2Unicode = rtl_createTextToUnicodeConverter(encoding);
+ m_contextText2Unicode = rtl_createTextToUnicodeContext( m_convText2Unicode );
+ m_rtlEncoding = encoding;
+}
+
+
+Sequence<sal_Unicode> Text2UnicodeConverter::convert( const Sequence<sal_Int8> &seqText )
+{
+ sal_uInt32 uiInfo;
+ sal_Size nSrcCvtBytes = 0;
+ sal_Size nTargetCount = 0;
+ sal_Size nSourceCount = 0;
+
+ // the whole source size
+ sal_Int32 nSourceSize = seqText.getLength() + m_seqSource.getLength();
+ Sequence<sal_Unicode> seqUnicode ( nSourceSize );
+
+ const sal_Int8 *pbSource = seqText.getConstArray();
+ sal_Int8 *pbTempMem = 0;
+
+ if( m_seqSource.getLength() ) {
+ // put old rest and new byte sequence into one array
+ pbTempMem = new sal_Int8[ nSourceSize ];
+ memcpy( pbTempMem , m_seqSource.getConstArray() , m_seqSource.getLength() );
+ memcpy( &(pbTempMem[ m_seqSource.getLength() ]) , seqText.getConstArray() , seqText.getLength() );
+ pbSource = pbTempMem;
+
+ // set to zero again
+ m_seqSource = Sequence< sal_Int8 >();
+ }
+
+ while( sal_True ) {
+
+ /* All invalid characters are transformed to the unicode undefined char */
+ nTargetCount += rtl_convertTextToUnicode(
+ m_convText2Unicode,
+ m_contextText2Unicode,
+ ( const sal_Char * ) &( pbSource[nSourceCount] ),
+ nSourceSize - nSourceCount ,
+ &( seqUnicode.getArray()[ nTargetCount ] ),
+ seqUnicode.getLength() - nTargetCount,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT,
+ &uiInfo,
+ &nSrcCvtBytes );
+ nSourceCount += nSrcCvtBytes;
+
+ if( uiInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL ) {
+ // save necessary bytes for next conversion
+ seqUnicode.realloc( seqUnicode.getLength() * 2 );
+ continue;
+ }
+ break;
+ }
+ if( uiInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL ) {
+ m_seqSource.realloc( nSourceSize - nSourceCount );
+ memcpy( m_seqSource.getArray() , &(pbSource[nSourceCount]) , nSourceSize-nSourceCount );
+ }
+
+
+ if( pbTempMem ) {
+ delete pbTempMem;
+ }
+
+ // set to correct unicode size
+ seqUnicode.realloc( nTargetCount );
+
+ return seqUnicode;
+}
+
+
+
+//----------------------------------------------
+//
+// Unicode2TextConverter
+//
+//----------------------------------------------
+Unicode2TextConverter::Unicode2TextConverter( const OString &sEncoding )
+{
+ rtl_TextEncoding encoding = rtl_getTextEncodingFromMimeCharset( sEncoding.getStr() );
+ if( RTL_TEXTENCODING_DONTKNOW == encoding ) {
+ m_bCanContinue = sal_False;
+ m_bInitialized = sal_False;
+ }
+ else {
+ init( encoding );
+ }
+
+}
+
+Unicode2TextConverter::Unicode2TextConverter( rtl_TextEncoding encoding )
+{
+ init( encoding );
+}
+
+
+Unicode2TextConverter::~Unicode2TextConverter()
+{
+ if( m_bInitialized ) {
+ rtl_destroyUnicodeToTextContext( m_convUnicode2Text , m_contextUnicode2Text );
+ rtl_destroyUnicodeToTextConverter( m_convUnicode2Text );
+ }
+}
+
+
+Sequence<sal_Int8> Unicode2TextConverter::convert(const sal_Unicode *puSource , sal_Int32 nSourceSize)
+{
+ sal_Unicode *puTempMem = 0;
+
+ if( m_seqSource.getLength() ) {
+ // For surrogates !
+ // put old rest and new byte sequence into one array
+ // In general when surrogates are used, they should be rarely
+ // cut off between two convert()-calls. So this code is used
+ // rarely and the extra copy is acceptable.
+ nSourceSize += m_seqSource.getLength();
+
+ puTempMem = new sal_Unicode[ nSourceSize ];
+ memcpy( puTempMem ,
+ m_seqSource.getConstArray() ,
+ m_seqSource.getLength() * sizeof( sal_Unicode ) );
+ memcpy(
+ &(puTempMem[ m_seqSource.getLength() ]) ,
+ puSource ,
+ nSourceSize*sizeof( sal_Unicode ) );
+ puSource = puTempMem;
+
+ m_seqSource = Sequence< sal_Unicode > ();
+ }
+
+
+ sal_Size nTargetCount = 0;
+ sal_Size nSourceCount = 0;
+
+ sal_uInt32 uiInfo;
+ sal_Size nSrcCvtChars;
+
+ // take nSourceSize * 3 as preference
+ // this is an upper boundary for converting to utf8,
+ // which most often used as the target.
+ sal_Int32 nSeqSize = nSourceSize * 3;
+
+ Sequence<sal_Int8> seqText( nSeqSize );
+ sal_Char *pTarget = (sal_Char *) seqText.getArray();
+ while( sal_True ) {
+
+ nTargetCount += rtl_convertUnicodeToText(
+ m_convUnicode2Text,
+ m_contextUnicode2Text,
+ &( puSource[nSourceCount] ),
+ nSourceSize - nSourceCount ,
+ &( pTarget[nTargetCount] ),
+ nSeqSize - nTargetCount,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT ,
+ &uiInfo,
+ &nSrcCvtChars);
+ nSourceCount += nSrcCvtChars;
+
+ if( uiInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL ) {
+ nSeqSize = nSeqSize *2;
+ seqText.realloc( nSeqSize ); // double array size
+ pTarget = ( sal_Char * ) seqText.getArray();
+ continue;
+ }
+ break;
+ }
+
+ // for surrogates
+ if( uiInfo & RTL_UNICODETOTEXT_INFO_SRCBUFFERTOSMALL ) {
+ m_seqSource.realloc( nSourceSize - nSourceCount );
+ memcpy( m_seqSource.getArray() ,
+ &(puSource[nSourceCount]),
+ (nSourceSize - nSourceCount) * sizeof( sal_Unicode ) );
+ }
+
+ if( puTempMem ) {
+ delete puTempMem;
+ }
+
+ // reduce the size of the buffer (fast, no copy necessary)
+ seqText.realloc( nTargetCount );
+
+ return seqText;
+}
+
+void Unicode2TextConverter::init( rtl_TextEncoding encoding )
+{
+ m_bCanContinue = sal_True;
+ m_bInitialized = sal_True;
+
+ m_convUnicode2Text = rtl_createUnicodeToTextConverter( encoding );
+ m_contextUnicode2Text = rtl_createUnicodeToTextContext( m_convUnicode2Text );
+ m_rtlEncoding = encoding;
+};
+
+
diff --git a/sax/test/makefile.mk b/sax/test/makefile.mk
new file mode 100644
index 000000000000..451e999f01ea
--- /dev/null
+++ b/sax/test/makefile.mk
@@ -0,0 +1,101 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=extensions
+TARGET=workben
+LIBTARGET=NO
+
+TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+# --- Files --------------------------------------------------------
+
+
+
+#
+# std testcomponent
+#
+APP1TARGET = testcomponent
+APP2TARGET = saxdemo
+
+APP1OBJS = $(OBJ)$/testcomponent.obj
+APP1STDLIBS = $(SALLIB) \
+ $(CPPULIB)\
+ $(CPPUHELPERLIB)
+
+
+APP2OBJS = $(OBJ)$/saxdemo.obj
+APP2STDLIBS = $(SALLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB)
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sax/test/sax/exports.dxp b/sax/test/sax/exports.dxp
new file mode 100644
index 000000000000..ce95ae0f8deb
--- /dev/null
+++ b/sax/test/sax/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_getFactory
+component_writeInfo \ No newline at end of file
diff --git a/sax/test/sax/factory.hxx b/sax/test/sax/factory.hxx
new file mode 100644
index 000000000000..a4fea3a5c20b
--- /dev/null
+++ b/sax/test/sax/factory.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: factory.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <rtl/strbuf.hxx>
+
+Reference< XInterface > SAL_CALL OSaxWriterTest_CreateInstance(
+ const Reference< XMultiServiceFactory > & rSMgr ) throw ( Exception );
+OUString OSaxWriterTest_getServiceName( ) throw();
+OUString OSaxWriterTest_getImplementationName( ) throw();
+Sequence<OUString> OSaxWriterTest_getSupportedServiceNames( ) throw();
+
+#define BUILD_ERROR(expr, Message)\
+ {\
+ m_seqErrors.realloc( m_seqErrors.getLength() + 1 ); \
+ m_seqExceptions.realloc( m_seqExceptions.getLength() + 1 ); \
+ OStringBuffer str(128); \
+ str.append( __FILE__ );\
+ str.append( " " ); \
+ str.append( "(" ); \
+ str.append( OString::valueOf( (sal_Int32)__LINE__) );\
+ str.append(")\n" );\
+ str.append( "[ " ); \
+ str.append( #expr ); \
+ str.append( " ] : " ); \
+ str.append( Message ); \
+ m_seqErrors.getArray()[ m_seqErrors.getLength()-1] =\
+ OStringToOUString( str.makeStringAndClear() , RTL_TEXTENCODING_ASCII_US ); \
+ }\
+ ((void)0)
+
+
+#define WARNING_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ m_seqWarnings.realloc( m_seqErrors.getLength() +1 ); \
+ OStringBuffer str(128);\
+ str.append( __FILE__);\
+ str.append( " "); \
+ str.append( "(" ); \
+ str.append(OString::valueOf( (sal_Int32)__LINE__)) ;\
+ str.append( ")\n");\
+ str.append( "[ " ); \
+ str.append( #expr ); \
+ str.append( " ] : ") ; \
+ str.append( Message); \
+ m_seqWarnings.getArray()[ m_seqWarnings.getLength()-1] =\
+ OStringToOUString( str.makeStringAndClear() , RTL_TEXTENCODING_ASCII_US ); \
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ BUILD_ERROR(expr, Message );\
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_EXCEPTION_ASSERT(expr, Message, Exception) \
+ if( !(expr)) { \
+ BUILD_ERROR(expr,Message);\
+ m_seqExceptions.getArray()[ m_seqExceptions.getLength()-1] = Any( Exception );\
+ return; \
+ } \
+ ((void)0)
+
diff --git a/sax/test/sax/makefile.mk b/sax/test/sax/makefile.mk
new file mode 100644
index 000000000000..062b3073243d
--- /dev/null
+++ b/sax/test/sax/makefile.mk
@@ -0,0 +1,99 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=testsax
+USE_DEFFILE=TRUE
+ENABLE_EXCEPTIONS=TRUE
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+
+SLOFILES = $(SLO)$/testsax.obj \
+ $(SLO)$/testwriter.obj
+
+
+SHL1TARGET= $(TARGET)
+SHL1IMPLIB= i$(TARGET)
+
+SHL1STDLIBS= \
+ $(SALLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB)
+
+
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEPN= makefile.mk $(SHL1LIBS)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx
new file mode 100644
index 000000000000..6de45e7acf38
--- /dev/null
+++ b/sax/test/sax/testsax.cxx
@@ -0,0 +1,902 @@
+/*************************************************************************
+ *
+ * $RCSfile: testsax.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <osl/time.h>
+#include <osl/diagnose.h>
+
+
+#include <com/sun/star/test/XSimpleTest.hpp>
+
+#include <com/sun/star/io/XOutputStream.hpp>
+
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::test;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::xml::sax;
+
+#include "factory.hxx"
+
+/****
+* test szenarios :
+*
+*
+*
+****/
+
+class OSaxParserTest : public WeakImplHelper1< XSimpleTest >
+{
+public:
+ OSaxParserTest( const Reference < XMultiServiceFactory > & rFactory ) : m_rFactory( rFactory )
+ {
+ }
+public:
+ virtual void SAL_CALL testInvariant(
+ const OUString& TestName,
+ const Reference < XInterface >& TestObject)
+ throw ( IllegalArgumentException, RuntimeException);
+
+ virtual sal_Int32 SAL_CALL test(
+ const OUString& TestName,
+ const Reference < XInterface >& TestObject,
+ sal_Int32 hTestHandle)
+ throw ( IllegalArgumentException,RuntimeException);
+
+ virtual sal_Bool SAL_CALL testPassed(void) throw ( RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getErrors(void) throw (RuntimeException);
+ virtual Sequence< Any > SAL_CALL getErrorExceptions(void) throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getWarnings(void) throw (RuntimeException);
+
+private:
+ void testSimple( const Reference < XParser > &r );
+ void testNamespaces( const Reference < XParser > &r );
+ void testFile( const Reference < XParser > &r );
+ void testEncoding( const Reference < XParser > &rParser );
+ void testPerformance( const Reference < XParser > &rParser );
+
+private:
+ Sequence<Any> m_seqExceptions;
+ Sequence<OUString> m_seqErrors;
+ Sequence<OUString> m_seqWarnings;
+ Reference < XMultiServiceFactory > m_rFactory;
+};
+
+
+
+/**
+* for external binding
+*
+*
+**/
+Reference < XInterface > SAL_CALL OSaxParserTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw(Exception)
+{
+ OSaxParserTest *p = new OSaxParserTest( rSMgr );
+ return Reference < XInterface > ( SAL_STATIC_CAST( OWeakObject * , p ) );
+}
+
+
+OUString OSaxParserTest_getServiceName( ) throw ()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.xml.sax.Parser" ));
+}
+
+OUString OSaxParserTest_getImplementationName( ) throw ()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("test.extensions.xml.sax.Parser"));
+}
+
+Sequence<OUString> OSaxParserTest_getSupportedServiceNames( ) throw ()
+{
+ Sequence<OUString> aRet(1);
+
+ aRet.getArray()[0] = OSaxParserTest_getImplementationName( );
+
+ return aRet;
+}
+
+
+
+
+void OSaxParserTest::testInvariant(
+ const OUString& TestName,
+ const Reference < XInterface >& TestObject )
+ throw ( IllegalArgumentException, RuntimeException)
+{
+ if( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) == TestName ) {
+ Reference < XParser > parser( TestObject , UNO_QUERY );
+
+ ERROR_ASSERT( parser.is() , "XDataInputStream cannot be queried" );
+ }
+}
+
+
+sal_Int32 OSaxParserTest::test(
+ const OUString& TestName,
+ const Reference < XInterface >& TestObject,
+ sal_Int32 hTestHandle)
+ throw ( IllegalArgumentException, RuntimeException)
+{
+ if( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")) == TestName ) {
+ try
+ {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else {
+
+ Reference < XParser > parser( TestObject , UNO_QUERY );
+
+ if( 1 == hTestHandle ) {
+ testSimple( parser );
+ }
+ else if( 2 == hTestHandle ) {
+ testNamespaces( parser );
+ }
+ else if( 3 == hTestHandle ) {
+ testEncoding( parser );
+ }
+ else if( 4 == hTestHandle ) {
+ testFile( parser );
+ }
+ else if( 5 == hTestHandle ) {
+ testPerformance( parser );
+ }
+ }
+ }
+ catch( Exception & e )
+ {
+ OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US);
+ BUILD_ERROR( 0 , o.getStr() );
+ }
+ catch( ... )
+ {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+
+ hTestHandle ++;
+
+ if( hTestHandle >= 6) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ BUILD_ERROR( 0 , "service not supported by test." );
+ }
+ return hTestHandle;
+}
+
+
+
+sal_Bool OSaxParserTest::testPassed(void) throw (RuntimeException)
+{
+ return m_seqErrors.getLength() == 0;
+}
+
+
+Sequence< OUString > OSaxParserTest::getErrors(void) throw (RuntimeException)
+{
+ return m_seqErrors;
+}
+
+
+Sequence< Any > OSaxParserTest::getErrorExceptions(void) throw (RuntimeException)
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< OUString > OSaxParserTest::getWarnings(void) throw (RuntimeException)
+{
+ return m_seqWarnings;
+}
+
+Reference < XInputStream > createStreamFromSequence(
+ const Sequence<sal_Int8> seqBytes ,
+ const Reference < XMultiServiceFactory > &xSMgr )
+{
+ Reference < XInterface > xOutStreamService =
+ xSMgr->createInstance( L"com.sun.star.io.Pipe" );
+ assert( xOutStreamService.is() );
+ Reference< XOutputStream > rOutStream( xOutStreamService , UNO_QUERY );
+ assert( rOutStream.is() );
+
+ Reference< XInputStream > rInStream( xOutStreamService , UNO_QUERY );
+ assert( rInStream.is() );
+
+ rOutStream->writeBytes( seqBytes );
+ rOutStream->flush();
+ rOutStream->closeOutput();
+
+ return rInStream;
+}
+
+Reference< XInputStream > createStreamFromFile(
+ const char *pcFile ,
+ const Reference < XMultiServiceFactory > &xSMgr )
+{
+ FILE *f = fopen( pcFile , "rb" );
+ Reference< XInputStream > r;
+
+ if( f ) {
+ fseek( f , 0 , SEEK_END );
+ int nLength = ftell( f );
+ fseek( f , 0 , SEEK_SET );
+
+ Sequence<sal_Int8> seqIn(nLength);
+ fread( seqIn.getArray() , nLength , 1 , f );
+
+ r = createStreamFromSequence( seqIn , xSMgr );
+ fclose( f );
+ }
+ return r;
+}
+
+
+
+
+
+
+
+
+
+// #define PCHAR_TO_OUSTRING(x) OStringToOUString(x,CHARSET_PC_1252)
+// #define USTRING_TO_PCHAR(x) UStringToString(x,CHARSET_PC_437).GetStr()
+
+
+
+class TestDocumentHandler :
+ public WeakImplHelper3< XExtendedDocumentHandler , XEntityResolver , XErrorHandler >
+{
+public:
+ TestDocumentHandler( const Reference < XMultiServiceFactory > &r , sal_Bool bPrint )
+ {
+ m_xSMgr = r;
+ m_bPrint = bPrint;
+ }
+
+public: // Error handler
+ virtual void SAL_CALL error(const Any& aSAXParseException) throw (SAXException, RuntimeException)
+ {
+ printf( "Error !\n" );
+ throw SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("error from error handler")) ,
+ Reference < XInterface >() ,
+ aSAXParseException );
+ }
+ virtual void SAL_CALL fatalError(const Any& aSAXParseException) throw (SAXException, RuntimeException)
+ {
+ printf( "Fatal Error !\n" );
+ }
+ virtual void SAL_CALL warning(const Any& aSAXParseException) throw (SAXException, RuntimeException)
+ {
+ printf( "Warning !\n" );
+ }
+
+
+public: // ExtendedDocumentHandler
+
+ virtual void SAL_CALL startDocument(void) throw (SAXException, RuntimeException)
+ {
+ m_iLevel = 0;
+ m_iElementCount = 0;
+ m_iAttributeCount = 0;
+ m_iWhitespaceCount =0;
+ m_iCharCount=0;
+ if( m_bPrint ) {
+ printf( "document started\n" );
+ }
+ }
+ virtual void SAL_CALL endDocument(void) throw (SAXException, RuntimeException)
+ {
+ if( m_bPrint ) {
+ printf( "document finished\n" );
+ printf( "(ElementCount %d),(AttributeCount %d),(WhitespaceCount %d),(CharCount %d)\n",
+ m_iElementCount, m_iAttributeCount, m_iWhitespaceCount , m_iCharCount );
+ }
+ }
+ virtual void SAL_CALL startElement(const OUString& aName,
+ const Reference< XAttributeList > & xAttribs)
+ throw (SAXException,RuntimeException)
+ {
+
+ if( m_rLocator.is() ) {
+ if( m_bPrint )
+ {
+ OString o = OUStringToOString( m_rLocator->getSystemId() , RTL_TEXTENCODING_UTF8 );
+ printf( "%s(%d):" , o.getStr() , m_rLocator->getLineNumber() );
+ }
+ }
+ if( m_bPrint ) {
+ int i;
+ for( i = 0; i < m_iLevel ; i ++ ) {
+ printf( " " );
+ }
+ OString o = OUStringToOString(aName , RTL_TEXTENCODING_UTF8 );
+ printf( "<%s> " , aName.getStr() );
+
+ for( i = 0 ; i < xAttribs->getLength() ; i ++ )
+ {
+ OString o1 = OUStringToOString(xAttribs->getNameByIndex( i ), RTL_TEXTENCODING_UTF8 );
+ OString o2 = OUStringToOString(xAttribs->getTypeByIndex( i ), RTL_TEXTENCODING_UTF8 );
+ OString o3 = OUStringToOString(xAttribs->getValueByIndex( i ) , RTL_TEXTENCODING_UTF8 );
+ printf( "(%s,%s,'%s')" , o1.getStr(), o2.getStr(), o3.getStr() );
+ }
+ printf( "\n" );
+ }
+ m_iLevel ++;
+ m_iElementCount ++;
+ m_iAttributeCount += xAttribs->getLength();
+ }
+
+ virtual void SAL_CALL endElement(const OUString& aName) throw (SAXException,RuntimeException)
+ {
+ assert( m_iLevel );
+ m_iLevel --;
+ if( m_bPrint ) {
+ int i;
+ for( i = 0; i < m_iLevel ; i ++ ) {
+ printf( " " );
+ }
+ OString o = OUStringToOString(aName , RTL_TEXTENCODING_UTF8 );
+ printf( "</%s>\n" , o.getStr() );
+ }
+ }
+
+ virtual void SAL_CALL characters(const OUString& aChars) throw (SAXException,RuntimeException)
+ {
+ if( m_bPrint ) {
+ int i;
+ for( i = 0; i < m_iLevel ; i ++ ) {
+ printf( " " );
+ }
+ OString o = OUStringToOString(aChars , RTL_TEXTENCODING_UTF8 );
+ printf( "%s\n" , o.getStr() );
+ }
+ m_iCharCount += aChars.len();
+ }
+ virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) throw (SAXException,RuntimeException)
+ {
+ m_iWhitespaceCount += aWhitespaces.len();
+ }
+
+ virtual void SAL_CALL processingInstruction(const OUString& aTarget, const OUString& aData) throw (SAXException,RuntimeException)
+ {
+ if( m_bPrint )
+ {
+ OString o1 = OUStringToOString(aTarget, RTL_TEXTENCODING_UTF8 );
+ OString o2 = OUStringToOString(aData, RTL_TEXTENCODING_UTF8 );
+ printf( "PI : %s,%s\n" , o1.getStr() , o2.getStr() );
+ }
+ }
+
+ virtual void SAL_CALL setDocumentLocator(const Reference< XLocator> & xLocator)
+ throw (SAXException,RuntimeException)
+ {
+ m_rLocator = xLocator;
+ }
+
+ virtual InputSource SAL_CALL resolveEntity(
+ const OUString& sPublicId,
+ const OUString& sSystemId)
+ throw (SAXException,RuntimeException)
+ {
+ InputSource source;
+ source.sSystemId = sSystemId;
+ source.sPublicId = sPublicId;
+
+ source.aInputStream = createStreamFromFile(
+ OUStringToOString( sSystemId , RTL_TEXTENCODING_ASCII_US) , m_xSMgr );
+
+ return source;
+ }
+
+ virtual void SAL_CALL startCDATA(void) throw (SAXException,RuntimeException)
+ {
+ if( m_bPrint ) {
+ printf( "CDataStart :\n" );
+ }
+ }
+ virtual void SAL_CALL endCDATA(void) throw (SAXException,RuntimeException)
+ {
+ if( m_bPrint ) {
+ printf( "CEndStart :\n" );
+ }
+ }
+ virtual void SAL_CALL comment(const OUString& sComment) throw (SAXException,RuntimeException)
+ {
+ if( m_bPrint ) {
+ OString o1 = OUStringToOString(sComment, RTL_TEXTENCODING_UTF8 );
+ printf( "<!--%s-->\n" , o1.getStr() );
+ }
+ }
+ virtual void SAL_CALL unknown(const OUString& sString) throw (SAXException,RuntimeException)
+ {
+ if( m_bPrint )
+ {
+ OString o1 = OUStringToOString(sString, RTL_TEXTENCODING_UTF8 );
+ printf( "UNKNOWN : {%s}\n" , o1.getStr() );
+ }
+ }
+
+ virtual void SAL_CALL allowLineBreak( void) throw (SAXException, RuntimeException )
+ {
+
+ }
+
+
+public:
+ int m_iLevel;
+ int m_iElementCount;
+ int m_iAttributeCount;
+ int m_iWhitespaceCount;
+ int m_iCharCount;
+ sal_Bool m_bPrint;
+
+ Reference < XMultiServiceFactory > m_xSMgr;
+ Reference < XLocator > m_rLocator;
+};
+
+
+void OSaxParserTest::testSimple( const Reference < XParser > &rParser )
+{
+
+ char TestString[] = "<!DOCTYPE personnel [\n"
+ "<!ENTITY testInternal \"internal Test!\">\n"
+ "<!ENTITY test SYSTEM \"external_entity.xml\">\n"
+ "]>\n"
+ "<personnel>\n"
+ "<person> fjklsfdklsdfkl\n"
+ "fjklsfdklsdfkl\n"
+ "<?testpi pidata?>\n"
+ "&testInternal;\n"
+ "<HUHU x='5' y='kjfd'> blahuhu\n"
+ "<HI> blahi\n"
+ " <![CDATA[<greeting>Hello, '+1+12world!</greeting>]]>\n"
+ " <!-- huhu <jdk> -->\n"
+ "<?testpi pidata?>\n"
+ "</HI>\n"
+ "aus XMLTest\n"
+ "</HUHU>\n"
+ "</person>\n"
+ "</personnel>\n\n\n";
+
+ Sequence< sal_Int8> seqBytes( strlen( TestString ) );
+ memcpy( seqBytes.getArray() , TestString , strlen( TestString ) );
+
+
+ Reference< XInputStream > rInStream;
+ OUString sInput;
+ rInStream = createStreamFromSequence( seqBytes , m_rFactory );
+ sInput = OUString( OUString( RTL_CONSTASCII_USTRINGPARAM("internal")) );
+
+ if( rParser.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , sal_False );
+ Reference < XDocumentHandler > rDocHandler( (XDocumentHandler *) pDocHandler , UNO_QUERY );
+ Reference< XEntityResolver >
+ rEntityResolver( (XEntityResolver *) pDocHandler , UNO_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+
+ try
+ {
+ rParser->parseStream( source );
+ ERROR_ASSERT( pDocHandler->m_iElementCount == 4 , "wrong element count" );
+ ERROR_ASSERT( pDocHandler->m_iAttributeCount == 2 , "wrong attribut count" );
+ ERROR_ASSERT( pDocHandler->m_iCharCount == 130 , "wrong char count" );
+ ERROR_ASSERT( pDocHandler->m_iWhitespaceCount == 0, "wrong whitespace count" );
+ }
+ catch( SAXParseException & e )
+ {
+ OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+ BUILD_ERROR( 1 , o1.getStr() );
+ }
+ catch( SAXException & e )
+ {
+ OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+ BUILD_ERROR( 1 , o1.getStr() );
+ }
+ catch( Exception & e )
+ {
+ OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+ BUILD_ERROR( 1 , o1.getStr() );
+ }
+ catch( ... )
+ {
+ BUILD_ERROR( 1 , "unknown exception" );
+ }
+ }
+}
+
+void OSaxParserTest::testNamespaces( const Reference < XParser > &rParser )
+{
+
+ char TestString[] =
+ "<?xml version='1.0'?>\n"
+ "<!-- all elements here are explicitly in the HTML namespace -->\n"
+ "<html:html xmlns:html='http://www.w3.org/TR/REC-html40'>\n"
+ "<html:head><html:title>Frobnostication</html:title></html:head>\n"
+ "<html:body><html:p>Moved to \n"
+ "<html:a href='http://frob.com'>here.</html:a></html:p></html:body>\n"
+ "</html:html>\n";
+
+ Sequence<sal_Int8> seqBytes( strlen( TestString ) );
+ memcpy( seqBytes.getArray() , TestString , strlen( TestString ) );
+
+
+ Reference< XInputStream > rInStream;
+ OUString sInput;
+
+ rInStream = createStreamFromSequence( seqBytes , m_rFactory );
+ sInput = OUString( RTL_CONSTASCII_USTRINGPARAM( "internal" ));
+
+ if( rParser.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , sal_False );
+ Reference < XDocumentHandler > rDocHandler( (XDocumentHandler *) pDocHandler , UNO_QUERY );
+ Reference< XEntityResolver > rEntityResolver(
+ (XEntityResolver *) pDocHandler , UNO_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+
+ try
+ {
+ rParser->parseStream( source );
+ ERROR_ASSERT( pDocHandler->m_iElementCount == 6 , "wrong element count" );
+ ERROR_ASSERT( pDocHandler->m_iAttributeCount == 2 , "wrong attribut count" );
+ ERROR_ASSERT( pDocHandler->m_iCharCount == 33, "wrong char count" );
+ ERROR_ASSERT( pDocHandler->m_iWhitespaceCount == 0 , "wrong whitespace count" );
+ }
+ catch( Exception & e ) {
+ OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+ BUILD_ERROR( 1 , o1.getStr() );
+ }
+ catch( ... )
+ {
+ BUILD_ERROR( 1 , "unknown exception" );
+ }
+ }
+}
+
+void OSaxParserTest::testEncoding( const Reference < XParser > &rParser )
+{
+ char TestString[] =
+ "<?xml version='1.0' encoding=\"iso-8859-1\"?>\n"
+ "<!-- all elements here are explicitly in the HTML namespace -->\n"
+ "<html:html xmlns:html='http://www.w3.org/TR/REC-html40'>\n"
+ "<html:head><html:title>Frobnostication</html:title></html:head>\n"
+ "<html:body><html:p>Moved to ß\n"
+ "<html:a href='http://frob.com'>here.</html:a></html:p></html:body>\n"
+ "</html:html>\n";
+
+ Sequence<sal_Int8> seqBytes( strlen( TestString ) );
+ memcpy( seqBytes.getArray() , TestString , strlen( TestString ) );
+
+
+ Reference< XInputStream > rInStream;
+ OUString sInput;
+
+ rInStream = createStreamFromSequence( seqBytes , m_rFactory );
+ sInput = OUString( RTL_CONSTASCII_USTRINGPARAM("internal") );
+
+ if( rParser.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , sal_False );
+ Reference < XDocumentHandler > rDocHandler( (XDocumentHandler *) pDocHandler , UNO_QUERY );
+ Reference< XEntityResolver > rEntityResolver( (XEntityResolver *) pDocHandler , UNO_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+ try
+ {
+ rParser->parseStream( source );
+ }
+ catch( Exception & e )
+ {
+ OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+ BUILD_ERROR( 1 , o1.getStr() );
+ }
+ catch ( ... )
+ {
+ BUILD_ERROR( 1 , "unknown exception" );
+ }
+ }
+}
+
+void OSaxParserTest::testFile( const Reference < XParser > & rParser )
+{
+
+ Reference< XInputStream > rInStream = createStreamFromFile( "testsax.xml" , m_rFactory );
+ OUString sInput = OUString( RTL_CONSTASCII_USTRINGPARAM( "testsax.xml" ) );
+
+
+ if( rParser.is() && rInStream.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , sal_True );
+ Reference < XDocumentHandler > rDocHandler( (XDocumentHandler *) pDocHandler , UNO_QUERY );
+ Reference < XEntityResolver > rEntityResolver( (XEntityResolver *) pDocHandler , UNO_QUERY );
+ Reference < XErrorHandler > rErrorHandler( ( XErrorHandler * )pDocHandler , UNO_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+ rParser->setErrorHandler( rErrorHandler );
+
+ try
+ {
+ rParser->parseStream( source );
+ }
+ catch( SAXParseException & e ) {
+ Any any;
+ any <<= e;
+
+ while(sal_True) {
+ SAXParseException *pEx;
+ if( any.getValueType() == getCppuType( &e ) ) {
+ pEx = ( SAXParseException * ) any.getValue();
+ OString o1 = OUStringToOString(pEx->Message, RTL_TEXTENCODING_UTF8 );
+ printf( "%s\n" , o1.getStr() );
+ any = pEx->WrappedException;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ catch( SAXException & e )
+ {
+ OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+ BUILD_ERROR( 1 , o1.getStr() );
+
+ }
+ catch( Exception & e ) {
+ printf( "normal exception ! %s\n", e.Message );
+ }
+ catch ( ... )
+ {
+ printf( "any exception !!!!\n" );
+ }
+ }
+}
+
+void OSaxParserTest::testPerformance( const Reference < XParser > & rParser )
+{
+
+ Reference < XInputStream > rInStream =
+ createStreamFromFile( "testPerformance.xml" , m_rFactory );
+ OUString sInput = OUString( RTL_CONSTASCII_USTRINGPARAM( "testperformance.xml") );
+
+ if( rParser.is() && rInStream.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , sal_False );
+ Reference < XDocumentHandler > rDocHandler( (XDocumentHandler *) pDocHandler , UNO_QUERY );
+ Reference < XEntityResolver > rEntityResolver( (XEntityResolver *) pDocHandler , UNO_QUERY );
+ Reference < XErrorHandler > rErrorHandler( ( XErrorHandler * )pDocHandler , UNO_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+ rParser->setErrorHandler( rErrorHandler );
+
+ try
+ {
+ TimeValue aStartTime, aEndTime;
+ osl_getSystemTime( &aStartTime );
+ rParser->parseStream( source );
+ osl_getSystemTime( &aEndTime );
+
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+
+ printf( "Performance reading : %g s\n" , fEnd - fStart );
+
+ }
+ catch( SAXParseException &e ) {
+ Any any;
+ any <<= e;
+ while(sal_True) {
+ if( any.getValueType() == getCppuType( &e ) ) {
+ SAXParseException ex;
+ any >>= ex;
+ OString o = OUStringToOString( ex.Message , RTL_TEXTENCODING_ASCII_US );
+ printf( "%s\n" , o.getStr() );
+ any <<= ex.WrappedException;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ catch( SAXException &e ) {
+ OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
+ printf( "%s\n" , o.getStr() );
+
+ }
+ catch( ... )
+ {
+ printf( "any exception !!!!\n" );
+ }
+ }
+}
+
+
+extern "C"
+{
+
+
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference< XRegistryKey > xKey(
+ reinterpret_cast< XRegistryKey * >( pRegistryKey ) );
+
+ OUString str =
+ OUString( L"/" ) +
+ OSaxParserTest_getImplementationName() +
+ OUString( L"/UNO/SERVICES" );
+ Reference< XRegistryKey > xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OSaxParserTest_getServiceName() );
+
+ str =
+ OUString( L"/" ) +
+ OSaxWriterTest_getImplementationName() +
+ OUString( L"/UNO/SERVICES" );
+
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OSaxWriterTest_getServiceName() );
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return sal_False;
+}
+
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pRet = 0;
+
+ if (pServiceManager )
+ {
+ Reference< XSingleServiceFactory > xRet;
+ Reference< XMultiServiceFactory > xSMgr =
+ reinterpret_cast< XMultiServiceFactory * > ( pServiceManager );
+
+ OUString aImplementationName = OUString::createFromAscii( pImplName );
+
+
+ if (aImplementationName == OSaxWriterTest_getImplementationName() )
+ {
+ xRet = createSingleFactory( xSMgr, aImplementationName,
+ OSaxWriterTest_CreateInstance,
+ OSaxWriterTest_getSupportedServiceNames() );
+ }
+ else if (aImplementationName == OSaxParserTest_getImplementationName() )
+ {
+ xRet = createSingleFactory( xSMgr, aImplementationName,
+ OSaxParserTest_CreateInstance,
+ OSaxParserTest_getSupportedServiceNames() );
+ }
+ if (xRet.is())
+ {
+ xRet->acquire();
+ pRet = xRet.get();
+ }
+ }
+
+ return pRet;
+}
+
+}
+
+
diff --git a/sax/test/sax/testwriter.cxx b/sax/test/sax/testwriter.cxx
new file mode 100644
index 000000000000..5f06cf602abe
--- /dev/null
+++ b/sax/test/sax/testwriter.cxx
@@ -0,0 +1,714 @@
+/*************************************************************************
+ *
+ * $RCSfile: testwriter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <vector>
+#include <stdio.h>
+#include <assert.h>
+
+#include <com/sun/star/test/XSimpleTest.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp> // for the multiservice-factories
+
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+
+#include <osl/time.h>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+
+using namespace ::std;
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::test;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::xml::sax;
+
+#include "factory.hxx"
+
+class OFileWriter :
+ public WeakImplHelper1< XOutputStream >
+{
+public:
+ OFileWriter( char *pcFile ) { strcpy( m_pcFile , pcFile ); m_f = 0; }
+
+
+public:
+ virtual void SAL_CALL writeBytes(const Sequence< sal_Int8 >& aData)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual void SAL_CALL flush(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual void SAL_CALL closeOutput(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException);
+private:
+ char m_pcFile[256];
+ FILE *m_f;
+};
+
+
+void OFileWriter::writeBytes(const Sequence< sal_Int8 >& aData)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ if( ! m_f ) {
+ m_f = fopen( m_pcFile , "w" );
+ }
+
+ fwrite( aData.getConstArray() , 1 , aData.getLength() , m_f );
+
+}
+
+
+void OFileWriter::flush(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ fflush( m_f );
+}
+
+void OFileWriter::closeOutput(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ fclose( m_f );
+ m_f = 0;
+}
+
+
+class OSaxWriterTest :
+ public WeakImplHelper1< XSimpleTest >
+{
+public:
+ OSaxWriterTest( const Reference < XMultiServiceFactory > & rFactory ) : m_rFactory( rFactory )
+ {
+
+ }
+ ~OSaxWriterTest() {}
+
+
+public:
+ virtual void SAL_CALL testInvariant(
+ const OUString& TestName,
+ const Reference < XInterface >& TestObject)
+ throw ( IllegalArgumentException,
+ RuntimeException);
+
+ virtual sal_Int32 SAL_CALL test(
+ const OUString& TestName,
+ const Reference < XInterface >& TestObject,
+ sal_Int32 hTestHandle)
+ throw ( IllegalArgumentException,RuntimeException);
+
+ virtual sal_Bool SAL_CALL testPassed(void)
+ throw ( RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getErrors(void) throw (RuntimeException);
+ virtual Sequence< Any > SAL_CALL getErrorExceptions(void) throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getWarnings(void) throw (RuntimeException);
+
+private:
+ void testSimple( const Reference< XExtendedDocumentHandler > &r );
+ void testExceptions( const Reference< XExtendedDocumentHandler > &r );
+ void testDTD( const Reference< XExtendedDocumentHandler > &r );
+ void testPerformance( const Reference< XExtendedDocumentHandler > &r );
+ void writeParagraph( const Reference< XExtendedDocumentHandler > &r , const OUString & s);
+
+private:
+ Sequence<Any> m_seqExceptions;
+ Sequence<OUString> m_seqErrors;
+ Sequence<OUString> m_seqWarnings;
+ Reference < XMultiServiceFactory > m_rFactory;
+
+};
+
+
+
+/*----------------------------------------
+*
+* Attributlist implementation
+*
+*----------------------------------------*/
+struct AttributeListImpl_impl;
+class AttributeListImpl : public WeakImplHelper1< XAttributeList >
+{
+public:
+ AttributeListImpl();
+ AttributeListImpl( const AttributeListImpl & );
+ ~AttributeListImpl();
+
+public:
+ virtual sal_Int16 SAL_CALL getLength(void) throw (RuntimeException);
+ virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) throw (RuntimeException);
+ virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw (RuntimeException);
+ virtual OUString SAL_CALL getTypeByName(const OUString& aName) throw (RuntimeException);
+ virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) throw (RuntimeException);
+ virtual OUString SAL_CALL getValueByName(const OUString& aName) throw (RuntimeException);
+
+public:
+ void addAttribute( const OUString &sName ,
+ const OUString &sType ,
+ const OUString &sValue );
+ void clear();
+
+private:
+ struct AttributeListImpl_impl *m_pImpl;
+};
+
+
+struct TagAttribute
+{
+ TagAttribute(){}
+ TagAttribute( const OUString &sName,
+ const OUString &sType ,
+ const OUString &sValue )
+ {
+ this->sName = sName;
+ this->sType = sType;
+ this->sValue = sValue;
+ }
+
+ OUString sName;
+ OUString sType;
+ OUString sValue;
+};
+
+struct AttributeListImpl_impl
+{
+ AttributeListImpl_impl()
+ {
+ // performance improvement during adding
+ vecAttribute.reserve(20);
+ }
+ vector<struct TagAttribute> vecAttribute;
+};
+
+
+
+sal_Int16 AttributeListImpl::getLength(void) throw (RuntimeException)
+{
+ return m_pImpl->vecAttribute.size();
+}
+
+
+AttributeListImpl::AttributeListImpl( const AttributeListImpl &r )
+{
+ m_pImpl = new AttributeListImpl_impl;
+ *m_pImpl = *(r.m_pImpl);
+}
+
+OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sName;
+ }
+ return OUString();
+}
+
+
+OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sType;
+ }
+ return OUString();
+}
+
+OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sValue;
+ }
+ return OUString();
+
+}
+
+OUString AttributeListImpl::getTypeByName( const OUString& sName ) throw (RuntimeException)
+{
+ 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)
+{
+ 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()
+{
+ m_pImpl->vecAttribute.clear();
+
+}
+
+
+
+
+
+
+
+
+
+
+
+/**
+* for external binding
+*
+*
+**/
+Reference < XInterface > SAL_CALL OSaxWriterTest_CreateInstance( const Reference < XMultiServiceFactory > & rSMgr ) throw (Exception)
+{
+ OSaxWriterTest *p = new OSaxWriterTest( rSMgr );
+ Reference < XInterface > xService = *p;
+ return xService;
+}
+
+OUString OSaxWriterTest_getServiceName( ) throw ()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("test.com.sun.star.xml.sax.Writer"));
+}
+
+OUString OSaxWriterTest_getImplementationName( ) throw ()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("test.extensions.xml.sax.Writer"));
+}
+
+Sequence<OUString> OSaxWriterTest_getSupportedServiceNames( ) throw ()
+{
+ Sequence<OUString> aRet(1);
+
+ aRet.getArray()[0] = OSaxWriterTest_getImplementationName( );
+
+ return aRet;
+}
+
+
+
+void OSaxWriterTest::testInvariant( const OUString& TestName,
+ const Reference < XInterface >& TestObject )
+ throw ( IllegalArgumentException, RuntimeException)
+{
+ if( L"com.sun.star.xml.sax.Writer" == TestName ) {
+ Reference< XDocumentHandler > doc( TestObject , UNO_QUERY );
+ Reference< XExtendedDocumentHandler > ext( TestObject , UNO_QUERY );
+ Reference< XActiveDataSource > source( TestObject , UNO_QUERY );
+
+ ERROR_ASSERT( doc.is() , "XDocumentHandler cannot be queried" );
+ ERROR_ASSERT( ext.is() , "XExtendedDocumentHandler cannot be queried" );
+ ERROR_ASSERT( source.is() , "XActiveDataSource cannot be queried" );
+ }
+ else {
+ BUILD_ERROR( 0 , "wrong test" );
+ }
+}
+
+
+sal_Int32 OSaxWriterTest::test(
+ const OUString& TestName,
+ const Reference < XInterface >& TestObject,
+ sal_Int32 hTestHandle)
+ throw ( IllegalArgumentException,RuntimeException)
+{
+ if( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")) == TestName )
+ {
+ try
+ {
+ if( 0 == hTestHandle )
+ {
+ testInvariant( TestName , TestObject );
+ }
+ else
+ {
+ Reference< XExtendedDocumentHandler > writer( TestObject , UNO_QUERY );
+
+ if( 1 == hTestHandle ) {
+ testSimple( writer );
+ }
+ else if( 2 == hTestHandle ) {
+ testExceptions( writer );
+ }
+ else if( 3 == hTestHandle ) {
+ testDTD( writer );
+ }
+ else if( 4 == hTestHandle ) {
+ testPerformance( writer );
+ }
+ }
+ }
+ catch( Exception & e ) {
+ OString o = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
+ BUILD_ERROR( 0 , o.getStr() );
+ }
+ catch( ... )
+ {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+
+ hTestHandle ++;
+
+ if( hTestHandle >= 5) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ BUILD_ERROR( 0 , "service not supported by test." );
+ }
+ return hTestHandle;
+}
+
+
+
+sal_Bool OSaxWriterTest::testPassed(void) throw (RuntimeException)
+{
+ return m_seqErrors.getLength() == 0;
+}
+
+
+Sequence< OUString > OSaxWriterTest::getErrors(void) throw (RuntimeException)
+{
+ return m_seqErrors;
+}
+
+
+Sequence< Any > OSaxWriterTest::getErrorExceptions(void) throw (RuntimeException)
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< OUString > OSaxWriterTest::getWarnings(void) throw (RuntimeException)
+{
+ return m_seqWarnings;
+}
+
+void OSaxWriterTest::writeParagraph(
+ const Reference< XExtendedDocumentHandler > &r ,
+ const OUString & s)
+{
+ int nMax = s.len();
+ int nStart = 0;
+
+ Sequence<sal_uInt16> seq( s.len() );
+ memcpy( seq.getArray() , s.getStr() , s.len() * sizeof( sal_uInt16 ) );
+
+ for( int n = 1 ; n < nMax ; n++ ){
+ if( 32 == seq.getArray()[n] ) {
+ r->allowLineBreak();
+ r->characters( s.copy( nStart , n - nStart ) );
+ nStart = n;
+ }
+ }
+ r->allowLineBreak();
+ r->characters( s.copy( nStart , n - nStart ) );
+}
+
+
+
+void OSaxWriterTest::testSimple( const Reference< XExtendedDocumentHandler > &r )
+{
+ OUString testParagraph = OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Dies ist ein bloeder Test um zu uberpruefen, ob der SAXWriter "
+ "wohl Zeilenumbrueche halbwegs richtig macht oder ob er die Zeile "
+ "bis zum bitteren Ende schreibt." ));
+
+ OFileWriter *pw = new OFileWriter("output.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ Reference< XAttributeList > rList( (XAttributeList *) pList , UNO_QUERY );
+ Reference< XOutputStream > ref( ( XOutputStream * ) pw , UNO_QUERY );
+
+ Reference< XActiveDataSource > source( r , UNO_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+ r->startDocument();
+
+ pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("Arg1" )),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CDATA")) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("bla\n u")) );
+ pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("Arg2")) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CDATA")) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("blub")) );
+
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("tag1")) , rList );
+ r->ignorableWhitespace( OUString() );
+
+ r->characters( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) );
+ r->ignorableWhitespace( OUString() );
+
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("hi")) , rList );
+ r->ignorableWhitespace( OUString() );
+
+ // the enpassant must be converted & -> &amp;
+ r->characters( OUString( RTL_CONSTASCII_USTRINGPARAM("&#252;")) );
+
+ // Test added for mib. Tests if errors during conversions occurs
+ r->ignorableWhitespace( OUString() );
+ sal_Char array[256];
+ for( sal_Int32 n = 32 ; n < 254 ; n ++ ) {
+ array[n-32] = n;
+ }
+ array[254-32] = 0;
+ r->characters(
+ OStringToOUString( array , RTL_TEXTENCODING_SYMBOL )
+ );
+ r->ignorableWhitespace( OUString() );
+
+ // '>' must not be converted
+ r->startCDATA();
+ r->characters( OUString( RTL_CONSTASCII_USTRINGPARAM(">fsfsdf<")) );
+ r->endCDATA();
+ r->ignorableWhitespace( OUString() );
+
+ writeParagraph( r , testParagraph );
+
+
+ r->ignorableWhitespace( OUString() );
+ r->comment( OUString( RTL_CONSTASCII_USTRINGPARAM("Dies ist ein Kommentar !")) );
+ r->ignorableWhitespace( OUString() );
+
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("emptytagtest")) , rList );
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("emptytagtest")) );
+
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("hi")) );
+ r->ignorableWhitespace( OUString() );
+
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("tag1")) );
+ r->endDocument();
+
+}
+
+void OSaxWriterTest::testExceptions( const Reference< XExtendedDocumentHandler > & r )
+{
+
+ OFileWriter *pw = new OFileWriter("output2.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ Reference< XAttributeList > rList( (XAttributeList *) pList , UNO_QUERY );
+ Reference< XOutputStream > ref( ( XOutputStream * ) pw , UNO_QUERY );
+
+ Reference< XActiveDataSource > source( r , UNO_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+ { // startDocument must be called before start element
+ sal_Bool bException = sal_True;
+ try
+ {
+ r->startElement( L"huhu" , rList );
+ bException = sal_False;
+ }
+ catch( SAXException &e )
+ {
+
+ }
+ ERROR_ASSERT( bException , "expected exception not thrown !" );
+ }
+
+ r->startDocument();
+
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) , rList );
+ r->startCDATA();
+
+ {
+ sal_Bool bException = sal_True;
+ try{
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) , rList );
+ bException = sal_False;
+ }
+ catch( SAXException &e ) {
+
+ }
+ ERROR_ASSERT( bException , "expected exception not thrown !" );
+ }
+
+ r->endCDATA();
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("hi")) );
+
+ r->endDocument();
+}
+
+
+void OSaxWriterTest::testDTD(const Reference< XExtendedDocumentHandler > &r )
+{
+ OFileWriter *pw = new OFileWriter("outputDTD.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ Reference< XAttributeList > rList( (XAttributeList *) pList , UNO_QUERY );
+ Reference< XOutputStream > ref( ( XOutputStream * ) pw , UNO_QUERY );
+
+ Reference< XActiveDataSource > source( r , UNO_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+
+ r->startDocument();
+ r->unknown( OUString( RTL_CONSTASCII_USTRINGPARAM("<!DOCTYPE iCalendar >\n")) );
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) , rList );
+
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) );
+ r->endDocument();
+}
+
+void OSaxWriterTest::testPerformance(const Reference< XExtendedDocumentHandler > &r )
+{
+ OFileWriter *pw = new OFileWriter("testPerformance.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ OUString testParagraph =
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Dies ist ein bloeder Test um zu uberpruefen, ob der SAXWriter "
+ "wohl Zeilenumbrueche halbwegs richtig macht oder ob er die Zeile "
+ "bis zum bitteren Ende schreibt." ));
+
+
+ Reference< XAttributeList > rList( (XAttributeList *) pList , UNO_QUERY );
+ Reference< XOutputStream > ref( ( XOutputStream * ) pw , UNO_QUERY );
+
+ Reference< XActiveDataSource > source( r , UNO_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+ TimeValue aStartTime, aEndTime;
+ osl_getSystemTime( &aStartTime );
+
+
+ r->startDocument();
+ // just write a bunch of xml tags !
+ // for performance testing
+ sal_Int32 i2;
+ for( i2 = 0 ; i2 < 15 ; i2 ++ )
+ {
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ) +
+ OUString::valueOf( i2 ), rList );
+ for( sal_Int32 i = 0 ; i < 450 ; i ++ )
+ {
+ r->ignorableWhitespace( OUString());
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) , rList );
+ r->characters( testParagraph );
+
+ r->ignorableWhitespace( OUString() );
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) );
+ }
+ }
+ for( i2 = 14 ; i2 >= 0 ; i2-- )
+ {
+ r->ignorableWhitespace( OUString() );
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("tag") ) + OUString::valueOf( i2 ) );
+ }
+
+ r->endDocument();
+
+ osl_getSystemTime( &aEndTime );
+
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+
+ printf( "Performance writing : %g s\n" , fEnd - fStart );
+}
diff --git a/sax/test/saxdemo.cxx b/sax/test/saxdemo.cxx
new file mode 100644
index 000000000000..f4c57425864c
--- /dev/null
+++ b/sax/test/saxdemo.cxx
@@ -0,0 +1,693 @@
+/*************************************************************************
+ *
+ * $RCSfile: saxdemo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//------------------------------------------------------
+// testcomponent - Loads a service and its testcomponent from dlls performs a test.
+// Expands the dll-names depending on the actual environment.
+// Example : testcomponent stardiv.uno.io.Pipe stm
+//
+// Therefor the testcode must exist in teststm and the testservice must be named test.stardiv.uno.io.Pipe
+//
+
+#include <stdio.h>
+#include <vector>
+
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+#include <vos/dynload.hxx>
+#include <vos/diagnose.hxx>
+
+#include <assert.h>
+
+
+using namespace ::rtl;
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::io;
+
+
+/************
+ * Sequence of bytes -> InputStream
+ ************/
+class OInputStream : public WeakImplHelper1 < XInputStream >
+{
+public:
+ OInputStream( const Sequence< sal_Int8 >&seq ) :
+ m_seq( seq ),
+ nPos( 0 )
+ {}
+
+public:
+ virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
+ throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ {
+ nBytesToRead = (nBytesToRead > m_seq.getLength() - nPos ) ?
+ m_seq.getLength() - nPos :
+ nBytesToRead;
+ aData = Sequence< sal_Int8 > ( &(m_seq.getConstArray()[nPos]) , nBytesToRead );
+ nPos += nBytesToRead;
+ return nBytesToRead;
+ }
+ virtual sal_Int32 SAL_CALL readSomeBytes(
+ ::com::sun::star::uno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nMaxBytesToRead )
+ throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ {
+ return readBytes( aData, nMaxBytesToRead );
+ }
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw(NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ {
+ // not implemented
+ }
+ virtual sal_Int32 SAL_CALL available( )
+ throw(NotConnectedException, IOException, RuntimeException)
+ {
+ return m_seq.getLength() - nPos;
+ }
+ virtual void SAL_CALL closeInput( )
+ throw(NotConnectedException, IOException, RuntimeException)
+ {
+ // not needed
+ }
+ sal_Int32 nPos;
+ Sequence< sal_Int8> m_seq;
+};
+
+//-------------------------------
+// Helper : create an input stream from a file
+//------------------------------
+Reference< XInputStream > createStreamFromFile(
+ const char *pcFile )
+{
+ FILE *f = fopen( pcFile , "rb" );
+ Reference< XInputStream > r;
+
+ if( f ) {
+ fseek( f , 0 , SEEK_END );
+ int nLength = ftell( f );
+ fseek( f , 0 , SEEK_SET );
+
+ Sequence<sal_Int8> seqIn(nLength);
+ fread( seqIn.getArray() , nLength , 1 , f );
+
+ r = Reference< XInputStream > ( new OInputStream( seqIn ) );
+ fclose( f );
+ }
+ return r;
+}
+
+//-----------------------------------------
+// The document handler, which is needed for the saxparser
+// The Documenthandler for reading sax
+//-----------------------------------------
+class TestDocumentHandler :
+ public WeakImplHelper3< XExtendedDocumentHandler , XEntityResolver , XErrorHandler >
+{
+public:
+ TestDocumentHandler( )
+ {
+ }
+
+public: // Error handler
+ virtual void SAL_CALL error(const Any& aSAXParseException) throw (SAXException, RuntimeException)
+ {
+ printf( "Error !\n" );
+ throw SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("error from error handler")) ,
+ Reference < XInterface >() ,
+ aSAXParseException );
+ }
+ virtual void SAL_CALL fatalError(const Any& aSAXParseException) throw (SAXException, RuntimeException)
+ {
+ printf( "Fatal Error !\n" );
+ }
+ virtual void SAL_CALL warning(const Any& aSAXParseException) throw (SAXException, RuntimeException)
+ {
+ printf( "Warning !\n" );
+ }
+
+
+public: // ExtendedDocumentHandler
+
+ virtual void SAL_CALL startDocument(void) throw (SAXException, RuntimeException)
+ {
+ m_iElementCount = 0;
+ m_iAttributeCount = 0;
+ m_iWhitespaceCount =0;
+ m_iCharCount=0;
+ printf( "document started\n" );
+ }
+ virtual void SAL_CALL endDocument(void) throw (SAXException, RuntimeException)
+ {
+ printf( "document finished\n" );
+ printf( "(ElementCount %d),(AttributeCount %d),(WhitespaceCount %d),(CharCount %d)\n",
+ m_iElementCount, m_iAttributeCount, m_iWhitespaceCount , m_iCharCount );
+
+ }
+ virtual void SAL_CALL startElement(const OUString& aName,
+ const Reference< XAttributeList > & xAttribs)
+ throw (SAXException,RuntimeException)
+ {
+ m_iElementCount ++;
+ m_iAttributeCount += xAttribs->getLength();
+ }
+
+ virtual void SAL_CALL endElement(const OUString& aName) throw (SAXException,RuntimeException)
+ {
+ // ignored
+ }
+
+ virtual void SAL_CALL characters(const OUString& aChars) throw (SAXException,RuntimeException)
+ {
+ m_iCharCount += aChars.len();
+ }
+ virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) throw (SAXException,RuntimeException)
+ {
+ m_iWhitespaceCount += aWhitespaces.len();
+ }
+
+ virtual void SAL_CALL processingInstruction(const OUString& aTarget, const OUString& aData) throw (SAXException,RuntimeException)
+ {
+ // ignored
+ }
+
+ virtual void SAL_CALL setDocumentLocator(const Reference< XLocator> & xLocator)
+ throw (SAXException,RuntimeException)
+ {
+ // ignored
+ }
+
+ virtual InputSource SAL_CALL resolveEntity(
+ const OUString& sPublicId,
+ const OUString& sSystemId)
+ throw (SAXException,RuntimeException)
+ {
+ InputSource source;
+ source.sSystemId = sSystemId;
+ source.sPublicId = sPublicId;
+
+ source.aInputStream = createStreamFromFile(
+ OUStringToOString( sSystemId , RTL_TEXTENCODING_ASCII_US) );
+
+ return source;
+ }
+
+ virtual void SAL_CALL startCDATA(void) throw (SAXException,RuntimeException)
+ {
+ }
+ virtual void SAL_CALL endCDATA(void) throw (SAXException,RuntimeException)
+ {
+ }
+ virtual void SAL_CALL comment(const OUString& sComment) throw (SAXException,RuntimeException)
+ {
+ }
+ virtual void SAL_CALL unknown(const OUString& sString) throw (SAXException,RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL allowLineBreak( void) throw (SAXException, RuntimeException )
+ {
+
+ }
+
+public:
+ int m_iElementCount;
+ int m_iAttributeCount;
+ int m_iWhitespaceCount;
+ int m_iCharCount;
+};
+
+//--------------------------------------
+// helper implementation for writing
+// implements an XAttributeList
+//-------------------------------------
+struct AttributeListImpl_impl;
+class AttributeListImpl : public WeakImplHelper1< XAttributeList >
+{
+public:
+ AttributeListImpl();
+ AttributeListImpl( const AttributeListImpl & );
+ ~AttributeListImpl();
+
+public:
+ virtual sal_Int16 SAL_CALL getLength(void) throw (RuntimeException);
+ virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) throw (RuntimeException);
+ virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw (RuntimeException);
+ virtual OUString SAL_CALL getTypeByName(const OUString& aName) throw (RuntimeException);
+ virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) throw (RuntimeException);
+ virtual OUString SAL_CALL getValueByName(const OUString& aName) throw (RuntimeException);
+
+public:
+ void addAttribute( const OUString &sName ,
+ const OUString &sType ,
+ const OUString &sValue );
+ void clear();
+
+private:
+ struct AttributeListImpl_impl *m_pImpl;
+};
+
+
+struct TagAttribute
+{
+ TagAttribute(){}
+ TagAttribute( const OUString &sName,
+ const OUString &sType ,
+ const OUString &sValue )
+ {
+ this->sName = sName;
+ this->sType = sType;
+ this->sValue = sValue;
+ }
+
+ OUString sName;
+ OUString sType;
+ OUString sValue;
+};
+
+struct AttributeListImpl_impl
+{
+ AttributeListImpl_impl()
+ {
+ // performance improvement during adding
+ vecAttribute.reserve(20);
+ }
+ vector<struct TagAttribute> vecAttribute;
+};
+
+
+
+sal_Int16 AttributeListImpl::getLength(void) throw (RuntimeException)
+{
+ return m_pImpl->vecAttribute.size();
+}
+
+
+AttributeListImpl::AttributeListImpl( const AttributeListImpl &r )
+{
+ m_pImpl = new AttributeListImpl_impl;
+ *m_pImpl = *(r.m_pImpl);
+}
+
+OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sName;
+ }
+ return OUString();
+}
+
+
+OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sType;
+ }
+ return OUString();
+}
+
+OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException)
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sValue;
+ }
+ return OUString();
+
+}
+
+OUString AttributeListImpl::getTypeByName( const OUString& sName ) throw (RuntimeException)
+{
+ 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)
+{
+ 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()
+{
+ m_pImpl->vecAttribute.clear();
+}
+
+
+//--------------------------------------
+// helper function for writing
+// ensures that linebreaks are inserted
+// when writing a long text.
+// Note: this implementation may be a bit slow,
+// but it shows, how the SAX-Writer handles the allowLineBreak calls.
+//--------------------------------------
+void writeParagraphHelper(
+ const Reference< XExtendedDocumentHandler > &r ,
+ const OUString & s)
+{
+ int nMax = s.len();
+ int nStart = 0;
+
+ Sequence<sal_uInt16> seq( s.len() );
+ memcpy( seq.getArray() , s.getStr() , s.len() * sizeof( sal_uInt16 ) );
+
+ for( int n = 1 ; n < nMax ; n++ ){
+ if( 32 == seq.getArray()[n] ) {
+ r->allowLineBreak();
+ r->characters( s.copy( nStart , n - nStart ) );
+ nStart = n;
+ }
+ }
+ r->allowLineBreak();
+ r->characters( s.copy( nStart , n - nStart ) );
+}
+
+
+//---------------------------------
+// helper implementation for SAX-Writer
+// writes data to a file
+//--------------------------------
+class OFileWriter :
+ public WeakImplHelper1< XOutputStream >
+{
+public:
+ OFileWriter( char *pcFile ) { strcpy( m_pcFile , pcFile ); m_f = 0; }
+
+
+public:
+ virtual void SAL_CALL writeBytes(const Sequence< sal_Int8 >& aData)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual void SAL_CALL flush(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException);
+ virtual void SAL_CALL closeOutput(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException);
+private:
+ char m_pcFile[256];
+ FILE *m_f;
+};
+
+
+void OFileWriter::writeBytes(const Sequence< sal_Int8 >& aData)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ if( ! m_f ) {
+ m_f = fopen( m_pcFile , "w" );
+ }
+
+ fwrite( aData.getConstArray() , 1 , aData.getLength() , m_f );
+}
+
+
+void OFileWriter::flush(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ fflush( m_f );
+}
+
+void OFileWriter::closeOutput(void)
+ throw (NotConnectedException, BufferSizeExceededException, RuntimeException)
+{
+ fclose( m_f );
+ m_f = 0;
+}
+
+
+
+// Needed to switch on solaris threads
+#ifdef SOLARIS
+extern "C" void ChangeGlobalInit();
+#endif
+int main (int argc, char **argv)
+{
+
+ if( argc < 3) {
+ printf( "usage : saxdemo inputfile outputfile\n" );
+ exit( 0 );
+ }
+#ifdef SOLARIS
+ // switch on threads in solaris
+ ChangeGlobalInit();
+#endif
+
+ // create service manager
+ Reference< XMultiServiceFactory > xSMgr = createRegistryServiceFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" )) );
+
+ Reference < XImplementationRegistration > xReg;
+ try
+ {
+ // Create registration service
+ Reference < XInterface > x = xSMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" ) );
+ xReg = Reference< XImplementationRegistration > ( x , UNO_QUERY );
+ }
+ catch( Exception & ) {
+ printf( "Couldn't create ImplementationRegistration service\n" );
+ exit(1);
+ }
+
+ OString sTestName;
+ try
+ {
+ // Load dll for the tested component
+#ifdef SAL_W32
+ OUString aDllName = OStringToOUString( "sax" , RTL_TEXTENCODING_ASCII_US );
+#else
+ OUString aDllName = OUString::createFromAscii( "lib" );
+ aDllName += OStringToOUString( argv[n] , RTL_TEXTENCODING_ASCII_US );
+ aDllName += OUString::createFromAscii( ".so" );
+#endif
+ xReg->registerImplementation(
+ OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
+ aDllName,
+ Reference< XSimpleRegistry > () );
+ }
+ catch( Exception &e ) {
+ printf( "Couldn't reach sax dll\n" );
+ printf( "%s\n" , OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).getStr() );
+
+ exit(1);
+ }
+
+
+ //--------------------------------
+ // parser demo
+ // read xml from a file and count elements
+ //--------------------------------
+ Reference< XInterface > x = xSMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ) );
+ if( x.is() )
+ {
+ Reference< XParser > rParser( x , UNO_QUERY );
+
+ // create and connect the document handler to the parser
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( );
+
+ Reference < XDocumentHandler > rDocHandler( (XDocumentHandler *) pDocHandler );
+ Reference< XEntityResolver > rEntityResolver( (XEntityResolver *) pDocHandler );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+
+ // create the input stream
+ InputSource source;
+ source.aInputStream = createStreamFromFile( argv[1] );
+ source.sSystemId = OUString::createFromAscii( argv[1] );
+
+ try
+ {
+ // start parsing
+ rParser->parseStream( source );
+ }
+
+ catch( Exception & e )
+ {
+ OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+ printf( "Exception during parsing : %s\n" , o1.getStr() );
+ }
+ }
+ else
+ {
+ printf( "couln't create sax-parser component\n" );
+ }
+
+
+ //----------------------
+ // The SAX-Writer demo
+ //----------------------
+ x= xSMgr->createInstance( OUString::createFromAscii( "com.sun.star.xml.sax.Writer" ) );
+ if( x.is() )
+ {
+ printf( "start writing to %s\n" , argv[2] );
+
+ OFileWriter *pw = new OFileWriter( argv[2] );
+ Reference< XActiveDataSource > source( x , UNO_QUERY );
+ source->setOutputStream( Reference< XOutputStream> ( (XOutputStream*) pw ) );
+
+ AttributeListImpl *pList = new AttributeListImpl;
+ Reference< XAttributeList > rList( (XAttributeList *) pList );
+
+ Reference< XExtendedDocumentHandler > r( x , UNO_QUERY );
+ r->startDocument();
+
+ pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("Arg1" )),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CDATA")) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("foo\n u")) );
+ pList->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("Arg2")) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("CDATA")) ,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("foo2")) );
+
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("tag1")) , rList );
+ // tells the writer to insert a linefeed
+ r->ignorableWhitespace( OUString() );
+
+ r->characters( OUString( RTL_CONSTASCII_USTRINGPARAM("huhu")) );
+ r->ignorableWhitespace( OUString() );
+
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("hi")) , rList );
+ r->ignorableWhitespace( OUString() );
+
+ // the enpassant must be converted & -> &amp;
+ r->characters( OUString( RTL_CONSTASCII_USTRINGPARAM("&#252;")) );
+ r->ignorableWhitespace( OUString() );
+
+ // '>' must not be converted
+ r->startCDATA();
+ r->characters( OUString( RTL_CONSTASCII_USTRINGPARAM(" > foo < ")) );
+ r->endCDATA();
+ r->ignorableWhitespace( OUString() );
+
+ OUString testParagraph = OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "This is only a test to check, if the writer inserts line feeds "
+ "if needed or if the writer puts the whole text into one line." ));
+ writeParagraphHelper( r , testParagraph );
+
+ r->ignorableWhitespace( OUString() );
+ r->comment( OUString( RTL_CONSTASCII_USTRINGPARAM("This is a comment !")) );
+ r->ignorableWhitespace( OUString() );
+
+ r->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM("emptytagtest")) , rList );
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("emptytagtest")) );
+ r->ignorableWhitespace( OUString() );
+
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("hi")) );
+ r->ignorableWhitespace( OUString() );
+
+ r->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM("tag1")) );
+ r->endDocument();
+
+ printf( "finished writing\n" );
+ }
+ else
+ {
+ printf( "couln't create sax-writer component\n" );
+ }
+}
diff --git a/sax/test/testcomponent.cxx b/sax/test/testcomponent.cxx
new file mode 100644
index 000000000000..582bf423bc48
--- /dev/null
+++ b/sax/test/testcomponent.cxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * $RCSfile: testcomponent.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//------------------------------------------------------
+// testcomponent - Loads a service and its testcomponent from dlls performs a test.
+// Expands the dll-names depending on the actual environment.
+// Example : testcomponent stardiv.uno.io.Pipe stm
+//
+// Therefor the testcode must exist in teststm and the testservice must be named test.stardiv.uno.io.Pipe
+//
+
+#include <stdio.h>
+#include <com/sun/star/registry/XImplementationRegistration.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/test/XSimpleTest.hpp>
+
+#include <cppuhelper/servicefactory.hxx>
+
+#include <vos/dynload.hxx>
+#include <vos/diagnose.hxx>
+
+#include <assert.h>
+
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::test;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+// Needed to switch on solaris threads
+#ifdef SOLARIS
+extern "C" void ChangeGlobalInit();
+#endif
+
+int main (int argc, char **argv)
+{
+
+ if( argc < 3) {
+ printf( "usage : testcomponent service dll [additional dlls]\n" );
+ exit( 0 );
+ }
+#ifdef SOLARIS
+ // switch on threads in solaris
+ ChangeGlobalInit();
+#endif
+
+ // create service manager
+ Reference< XMultiServiceFactory > xSMgr =
+ createRegistryServiceFactory( OUString( RTL_CONSTASCII_USTRINGPARAM("applicat.rdb")) );
+
+ Reference < XImplementationRegistration > xReg;
+ Reference < XSimpleRegistry > xSimpleReg;
+
+ try
+ {
+ // Create registration service
+ Reference < XInterface > x = xSMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" ) );
+ xReg = Reference< XImplementationRegistration > ( x , UNO_QUERY );
+ }
+ catch( Exception & ) {
+ printf( "Couldn't create ImplementationRegistration service\n" );
+ exit(1);
+ }
+
+ sal_Char szBuf[1024];
+ OString sTestName;
+
+ try
+ {
+ // Load dll for the tested component
+ for( int n = 2 ; n <argc ; n ++ ) {
+#ifdef SAL_W32
+ OUString aDllName = OStringToOUString( argv[n] , RTL_TEXTENCODING_ASCII_US );
+#else
+ OUString aDllName = L"lib";
+ aDllName += OStringToOUString( argv[n] , RTL_TEXTENCODING_ASCII_US );
+ aDllName += L".so";
+#endif
+ xReg->registerImplementation(
+ OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
+ aDllName,
+ xSimpleReg );
+ }
+ }
+ catch( Exception &e ) {
+ printf( "Couldn't reach dll %s\n" , szBuf );
+ printf( "%s\n" , OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).getStr() );
+
+ exit(1);
+ }
+
+
+ try
+ {
+ // Load dll for the test component
+ sTestName = "test";
+ sTestName += argv[2];
+
+#ifdef SAL_W32
+ OUString aDllName = OStringToOUString( sTestName , RTL_TEXTENCODING_ASCII_US );
+#else
+ OUString aDllName = L"lib";
+ aDllName += OStringToOUString( sTestName , RTL_TEXTENCODING_ASCII_US );
+ aDllName += L".so";
+#endif
+
+ xReg->registerImplementation(
+ OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ) ,
+ aDllName,
+ xSimpleReg );
+ }
+ catch( Exception & e )
+ {
+ printf( "Couldn't reach dll %s\n" , szBuf );
+ exit(1);
+ }
+
+
+ // Instantiate test service
+ sTestName = "test.";
+ sTestName += argv[1];
+
+ Reference < XInterface > xIntTest =
+ xSMgr->createInstance( OStringToOUString( sTestName , RTL_TEXTENCODING_ASCII_US ) );
+ Reference< XSimpleTest > xTest( xIntTest , UNO_QUERY );
+
+ if( ! xTest.is() ) {
+ printf( "Couldn't instantiate test service \n" );
+ exit( 1 );
+ }
+
+
+ sal_Int32 nHandle = 0;
+ sal_Int32 nNewHandle;
+ sal_Int32 nErrorCount = 0;
+ sal_Int32 nWarningCount = 0;
+
+ // loop until all test are performed
+ while( nHandle != -1 )
+ {
+ // Instantiate serivce
+ Reference< XInterface > x =
+ xSMgr->createInstance( OStringToOUString( argv[1] , RTL_TEXTENCODING_ASCII_US ) );
+ if( ! x.is() )
+ {
+ printf( "Couldn't instantiate service !\n" );
+ exit( 1 );
+ }
+
+ // do the test
+ try
+ {
+ nNewHandle = xTest->test(
+ OStringToOUString( argv[1] , RTL_TEXTENCODING_ASCII_US ) , x , nHandle );
+ }
+ catch( Exception & e ) {
+ OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US );
+ printf( "testcomponent : uncaught exception %s\n" , o.getStr() );
+ exit(1);
+ }
+ catch( ... )
+ {
+ printf( "testcomponent : uncaught unknown exception\n" );
+ exit(1);
+ }
+
+
+ // print errors and warning
+ Sequence<OUString> seqErrors = xTest->getErrors();
+ Sequence<OUString> seqWarnings = xTest->getWarnings();
+ if( seqWarnings.getLength() > nWarningCount )
+ {
+ printf( "Warnings during test %d!\n" , nHandle );
+ for( ; nWarningCount < seqWarnings.getLength() ; nWarningCount ++ )
+ {
+ OString o = OUStringToOString(
+ seqWarnings.getArray()[nWarningCount], RTL_TEXTENCODING_ASCII_US );
+ printf( "Warning\n%s\n---------\n" , o.getStr() );
+ }
+ }
+
+
+ if( seqErrors.getLength() > nErrorCount ) {
+ printf( "Errors during test %d!\n" , nHandle );
+ for( ; nErrorCount < seqErrors.getLength() ; nErrorCount ++ ) {
+ OString o = OUStringToOString(
+ seqErrors.getArray()[nErrorCount], RTL_TEXTENCODING_ASCII_US );
+ printf( "%s\n" , o.getStr() );
+ }
+ }
+
+ nHandle = nNewHandle;
+ }
+
+ if( xTest->testPassed() ) {
+ printf( "Test passed !\n" );
+ }
+ else {
+ printf( "Test failed !\n" );
+ }
+
+ Reference <XComponent > rComp( xSMgr , UNO_QUERY );
+ rComp->dispose();
+ return 0;
+}
diff --git a/sax/util/makefile.mk b/sax/util/makefile.mk
new file mode 100644
index 000000000000..bb4599c4ef86
--- /dev/null
+++ b/sax/util/makefile.mk
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:43:13 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=sax
+TARGET=sax
+NO_BSYMBOLIC=TRUE
+ENABLE_EXCEPTIONS=TRUE
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+#-----------------------------------------------------------
+
+
+SHL1TARGET= $(TARGET)
+SHL1IMPLIB= i$(TARGET)
+
+
+SHL1STDLIBS= \
+ $(SALLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB)\
+ $(EXPAT3RDLIB)
+
+SHL1LIBS= $(SLB)$/expatwrap.lib
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
diff --git a/sot/inc/absdev.hxx b/sot/inc/absdev.hxx
new file mode 100644
index 000000000000..b4a1cfdeec02
--- /dev/null
+++ b/sot/inc/absdev.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * $RCSfile: absdev.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SOT_ABSDEV_HXX
+#define _SOT_ABSDEV_HXX
+
+#ifndef _TOOLS_SOLAR_H
+#include <tools/solar.h>
+#endif
+
+class JobSetup;
+class AbstractDeviceData
+{
+protected:
+ JobSetup * pJobSetup;
+public:
+ virtual ~AbstractDeviceData() {}
+ virtual AbstractDeviceData * Copy() const = 0;
+ virtual BOOL Equals( const AbstractDeviceData & ) const = 0;
+
+ JobSetup * GetJobSetup() const { return pJobSetup; }
+};
+
+#endif // _SOT_ABSDEV_HXX
diff --git a/sot/inc/agg.hxx b/sot/inc/agg.hxx
new file mode 100644
index 000000000000..c51d1097bb96
--- /dev/null
+++ b/sot/inc/agg.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * $RCSfile: agg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SOT_AGG_HXX
+#define _SOT_AGG_HXX
+
+#ifndef _TOOLS_OWNLIST_HXX
+#include <tools/ownlist.hxx>
+#endif
+
+/************** class SvAggregate ***************************************/
+/************************************************************************/
+class SotFactory;
+class SotObject;
+struct SvAggregate
+{
+ union
+ {
+ SotFactory * pFact;
+ SotObject * pObj;
+ };
+ BOOL bFactory;
+ BOOL bMainObj; // TRUE, das Objekt, welches das casting steuert
+
+ SvAggregate()
+ : bFactory( FALSE )
+ , bMainObj( FALSE )
+ , pFact( NULL ) {}
+ SvAggregate( SotObject * pObjP, BOOL bMainP )
+ : bFactory( FALSE )
+ , bMainObj( bMainP )
+ , pObj( pObjP ) {}
+ SvAggregate( SotFactory * pFactP )
+ : bFactory( TRUE )
+ , bMainObj( FALSE )
+ , pFact( pFactP ) {}
+};
+
+/************** class SvAggregateMemberList *****************************/
+/************************************************************************/
+class SvAggregateMemberList
+{
+ PRV_SV_DECL_OWNER_LIST(SvAggregateMemberList,SvAggregate)
+};
+
+#endif // _AGG_HXX
diff --git a/sot/inc/filelist.hxx b/sot/inc/filelist.hxx
new file mode 100644
index 000000000000..2cdcba096f70
--- /dev/null
+++ b/sot/inc/filelist.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: filelist.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FILELIST_HXX
+#define _FILELIST_HXX
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+class FileStringList;
+
+class FileList : public SvDataCopyStream
+{
+ FileStringList* pStrList;
+
+protected:
+
+ // SvData-Methoden
+ virtual void Load( SvStream& );
+ virtual void Save( SvStream& );
+ virtual void Assign( const SvDataCopyStream& );
+
+ // Liste loeschen;
+ void ClearAll( void );
+
+public:
+
+ TYPEINFO();
+ FileList();
+ ~FileList();
+
+ // Zuweisungsoperator
+ FileList& operator=( const FileList& rFileList );
+
+
+ // Im-/Export
+ friend SvStream& operator<<( SvStream& rOStm, const FileList& rFileList );
+ friend SvStream& operator>>( SvStream& rIStm, FileList& rFileList );
+
+ // Clipboard, D&D usw.
+ static ULONG GetFormat();
+
+
+ // Liste fuellen/abfragen
+ void AppendFile( const String& rStr );
+ String GetFile( ULONG i ) const;
+ ULONG Count( void ) const;
+
+};
+
+#endif // _FILELIST_HXX
+
diff --git a/sot/inc/stg.hxx b/sot/inc/stg.hxx
new file mode 100644
index 000000000000..4e79a9d6e02f
--- /dev/null
+++ b/sot/inc/stg.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * $RCSfile: stg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STG_HXX
+#define _STG_HXX
+
+
+#ifndef _TOOLS_STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_GLOBNAME_HXX //autogen
+#include <tools/globname.hxx>
+#endif
+
+class Storage;
+class StorageStream;
+class StgIo;
+class StgDirEntry;
+class StgStrm;
+class SvGlobalName;
+
+class StorageBase // common helper class
+{
+protected:
+ StgIo* pIo; // I/O subsystem
+ StgDirEntry* pEntry; // the dir entry
+ ULONG nError; // error code
+ StreamMode nMode; // open mode
+ BOOL bAutoCommit;
+ StorageBase( StgIo*, StgDirEntry* );
+ ~StorageBase();
+ BOOL Validate( BOOL=FALSE ) const;
+ BOOL ValidateMode( StreamMode, StgDirEntry* ) const;
+public:
+ void ResetError() const;
+ void SetError( ULONG ) const;
+ ULONG GetError() const;
+ BOOL Good() const { return BOOL( nError == SVSTREAM_OK ); }
+ StreamMode GetMode() const { return nMode; }
+ const SvStream* GetSvStream() const;
+};
+
+class StorageStream : public StorageBase
+{
+ friend class Storage; // for the following ctor
+ ULONG nPos; // current position
+ StorageStream( StgIo*, StgDirEntry*, StreamMode );
+public:
+ ~StorageStream();
+ ULONG Read( void * pData, ULONG nSize );
+ ULONG Write( const void* pData, ULONG nSize );
+ ULONG Seek( ULONG nPos );
+ ULONG Tell() { return nPos; }
+ void Flush();
+ BOOL SetSize( ULONG nNewSize );
+ BOOL CopyTo( StorageStream * pDestStm );
+ BOOL Commit();
+ BOOL Revert();
+};
+
+class SvStorageInfoList;
+
+class Storage : public StorageBase
+{
+ String aName;
+ BOOL bIsRoot; // TRUE if root storage
+ void Init( BOOL bCreate );
+ Storage( StgIo*, StgDirEntry*, StreamMode );
+public:
+ Storage( const String &,
+ StreamMode = STREAM_STD_READWRITE,
+ BOOL bDirect = TRUE );
+ Storage( SvStream& rStrm,
+ BOOL bDirect = TRUE );
+ ~Storage();
+ static BOOL IsStorageFile( const String & rFileName );
+ const String& GetName() const;
+ BOOL IsRoot() const { return bIsRoot; }
+
+ // eigener Datenbereich
+ void SetClass( const SvGlobalName & rClass,
+ ULONG nOriginalClipFormat,
+ const String & rUserTypeName );
+ void SetConvertClass( const SvGlobalName & rConvertClass,
+ ULONG nOriginalClipFormat,
+ const String & rUserTypeName );
+ SvGlobalName GetClassName();// Typ der Daten im Storage
+ ULONG GetFormat();
+ String GetUserName();
+ BOOL ShouldConvert();
+
+ // Liste aller Elemente
+ void FillInfoList( SvStorageInfoList* ) const;
+ BOOL CopyTo( Storage* pDestStg ) const;
+ BOOL Commit();
+ BOOL Revert();
+ /* Element Methoden */
+ // Stream mit Verbindung zu Storage erzeugen,
+ // in etwa eine Parent-Child Beziehung
+ StorageStream* OpenStream( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ BOOL bDirect = TRUE );
+ Storage* OpenStorage( const String & rEleName,
+ StreamMode = STREAM_STD_READWRITE,
+ BOOL bDirect = FALSE );
+ // Abfrage auf Storage oder Stream
+ BOOL IsStream( const String& rEleName ) const;
+ BOOL IsStorage( const String& rEleName ) const;
+ BOOL IsContained( const String& rEleName ) const;
+ // Element loeschen
+ BOOL Remove( const String & rEleName );
+ // Elementnamen aendern
+ BOOL Rename( const String & rEleName,
+ const String & rNewName );
+ BOOL CopyTo( const String & rEleName, Storage * pDest,
+ const String & rNewName );
+ BOOL MoveTo( const String & rEleName, Storage * pDest,
+ const String & rNewName );
+ BOOL ValidateFAT();
+};
+
+#endif
diff --git a/sot/inc/storinfo.hxx b/sot/inc/storinfo.hxx
new file mode 100644
index 000000000000..c234fa8deef3
--- /dev/null
+++ b/sot/inc/storinfo.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * $RCSfile: storinfo.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SOT_STORINFO_HXX
+#define _SOT_STORINFO_HXX
+
+#include <tools/pstm.hxx>
+#include <tools/globname.hxx>
+#ifndef _TOOLS_OWNLIST_HXX
+#include <tools/ownlist.hxx>
+#endif
+
+class StgDirEntry;
+class SvStorageInfo
+{
+friend class SvStorage;
+ String aName;
+ SvGlobalName aClassName;
+ ULONG nSize;
+ BOOL bStream:1,
+ bStorage:1;
+ SvStorageInfo(){}; // Fuer SvStorage
+public:
+ SvStorageInfo( const StgDirEntry& );
+
+ const SvGlobalName & GetClassName() const { return aClassName; }
+ const String & GetName() const { return aName; }
+ BOOL IsStream() const { return bStream; }
+ BOOL IsStorage() const { return bStorage; }
+ ULONG GetSize() const { return nSize; }
+};
+
+class SvStorageInfoList
+{
+ PRV_SV_DECL_OWNER_LIST(SvStorageInfoList,SvStorageInfo)
+ const SvStorageInfo * Get( const String & rName );
+};
+
+ULONG ReadClipboardFormat( SvStream & rStm );
+void WriteClipboardFormat( SvStream & rStm, ULONG nFormat );
+
+#endif // _STORINFO_HXX
diff --git a/sot/prj/d.lst b/sot/prj/d.lst
new file mode 100644
index 000000000000..95c30129654f
--- /dev/null
+++ b/sot/prj/d.lst
@@ -0,0 +1,31 @@
+mkdir: %_DEST%\inc%_EXT%\sot
+hedabu: ..\inc\object.hxx %_DEST%\inc%_EXT%\sot\object.hxx
+hedabu: ..\inc\factory.hxx %_DEST%\inc%_EXT%\sot\factory.hxx
+hedabu: ..\inc\sotdata.hxx %_DEST%\inc%_EXT%\sot\sotdata.hxx
+hedabu: ..\inc\agg.hxx %_DEST%\inc%_EXT%\sot\agg.hxx
+hedabu: ..\inc\storage.hxx %_DEST%\inc%_EXT%\sot\storage.hxx
+hedabu: ..\inc\storinfo.hxx %_DEST%\inc%_EXT%\sot\storinfo.hxx
+hedabu: ..\inc\sotref.hxx %_DEST%\inc%_EXT%\sot\sotref.hxx
+hedabu: ..\inc\dtrans.hxx %_DEST%\inc%_EXT%\sot\dtrans.hxx
+hedabu: ..\inc\exchange.hxx %_DEST%\inc%_EXT%\sot\exchange.hxx
+hedabu: ..\inc\formats.hxx %_DEST%\inc%_EXT%\sot\formats.hxx
+hedabu: ..\inc\absdev.hxx %_DEST%\inc%_EXT%\sot\absdev.hxx
+hedabu: ..\inc\stg.hxx %_DEST%\inc%_EXT%\sot\stg.hxx
+hedabu: ..\inc\filelist.hxx %_DEST%\inc%_EXT%\sot\filelist.hxx
+hedabu: ..\source\sdstor\stgio.hxx %_DEST%\inc%_EXT%\sot\stgio.hxx
+hedabu: ..\source\sdstor\stgcache.hxx %_DEST%\inc%_EXT%\sot\stgcache.hxx
+hedabu: ..\source\sdstor\stgelem.hxx %_DEST%\inc%_EXT%\sot\stgelem.hxx
+hedabu: ..\source\sdstor\stgavl.hxx %_DEST%\inc%_EXT%\sot\stgavl.hxx
+hedabu: ..\source\sdstor\stgstrms.hxx %_DEST%\inc%_EXT%\sot\stgstrms.hxx
+hedabu: ..\source\sdstor\stgdir.hxx %_DEST%\inc%_EXT%\sot\stgdir.hxx
+
+..\%__SRC%\inc\sdintern.hxx %_DEST%\inc%_EXT%\sot\sdintern.hxx
+..\%__SRC%\lib\sot.lib %_DEST%\lib%_EXT%\sot.lib
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\lib\*.so.* %_DEST%\lib%_EXT%\*.so.*
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+..\%__SRC%\slb\sot.lib %_DEST%\lib%_EXT%\xsot.lib
+..\%__SRC%\bin\sot?????.dll %_DEST%\bin%_EXT%\sot?????.dll
+..\%__SRC%\bin\sot?????.sym %_DEST%\bin%_EXT%\sot?????.sym
+..\%__SRC%\misc\sot?????.map %_DEST%\bin%_EXT%\sot?????.map
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
new file mode 100644
index 000000000000..f7e450c33afe
--- /dev/null
+++ b/sot/source/base/exchange.cxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * $RCSfile: exchange.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define _SOT_EXCHANGE_CXX
+#define SOT_STRING_LIST
+#define _SOT_FORMATS_INCLUDE_SYSTEMFORMATS
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+#include <tools/string.hxx>
+#include <sotdata.hxx>
+#include <exchange.hxx>
+#include <formats.hxx>
+
+#pragma hdrstop
+
+/*
+ In dieser Tabelle stehen alle im Office verwendeten Format-Bezeichner.
+ Die Tabelle ist nach den Formatstring-Ids sortiert und jede Id
+ ist um genau 1 groesser als ihre Vorgaenger-Id, damit die Id als
+ Tabellenindex benutzt werden kann.
+*/
+
+static const sal_Char* aFormatArray_Impl[] =
+{
+/* 0 SOT_FORMAT_SYSTEM_START*/ "",
+/* 1 SOT_FORMAT_STRING*/ "Text",
+/* 2 SOT_FORMAT_BITMAP*/ "Bitmap",
+/* 3 SOT_FORMAT_GDIMETAFILE*/ "GDIMetaFile",
+/* 4 SOT_FORMAT_PRIVATE*/ "Private",
+/* 5 SOT_FORMAT_FILE*/ "FileName",
+/* 6 SOT_FORMAT_FILE_LIST*/ "FileList",
+/* 7 EMPTY*/ "",
+/* 8 EMPTY*/ "",
+/* 9 EMPTY*/ "",
+/* 10 SOT_FORMAT_RTF*/ "Rich Text Format",
+
+/* 11 SOT_FORMATSTR_ID_DRAWING*/ "StarOffice Drawing Format",
+/* 12 SOT_FORMATSTR_ID_SVXB*/ "SVXB (StarView Bitmap/Animation)",
+/* 13 SOT_FORMATSTR_ID_SVIM*/ "SVIM (StarView ImageMap)",
+/* 14 SOT_FORMATSTR_ID_XFA*/ "XFA (XOutDev FillAttr)",
+/* 15 SOT_FORMATSTR_ID_EDITENGINE*/ "EditEngineFormat",
+/* 16 SOT_FORMATSTR_ID_INTERNALLINK_STATE*/ "StatusInfo vom SvxInternalLink",
+/* 17 SOT_FORMATSTR_ID_SOLK*/ "SOLK (StarOffice Link)",
+/* 18 SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK*/ "Netscape Bookmark",
+/* 19 SOT_FORMATSTR_ID_TREELISTBOX*/ "SV_LBOX_DD_FORMAT",
+/* 20 SOT_FORMATSTR_ID_NATIVE*/ "Native",
+/* 21 SOT_FORMATSTR_ID_OWNERLINK*/ "OwnerLink",
+/* 22 SOT_FORMATSTR_ID_STARSERVER*/ "StarServerFormat",
+/* 23 SOT_FORMATSTR_ID_STAROBJECT*/ "StarObjectFormat",
+/* 24 SOT_FORMATSTR_ID_APPLETOBJECT*/ "Applet Object",
+/* 25 SOT_FORMATSTR_ID_PLUGIN_OBJECT*/ "PlugIn Object",
+/* 26 SOT_FORMATSTR_ID_STARWRITER_30*/ "StarWriter 3.0",
+/* 27 SOT_FORMATSTR_ID_STARWRITER_40*/ "StarWriter 4.0",
+/* 28 SOT_FORMATSTR_ID_STARWRITER_50*/ "StarWriter 5.0",
+/* 29 SOT_FORMATSTR_ID_STARWRITERWEB_40*/ "StarWriter/Web 4.0",
+/* 30 SOT_FORMATSTR_ID_STARWRITERWEB_50*/ "StarWriter/Web 5.0",
+/* 31 SOT_FORMATSTR_ID_STARWRITERGLOB_40*/ "StarWriter/Global 4.0",
+/* 32 SOT_FORMATSTR_ID_STARWRITERGLOB_50*/ "StarWriter/Global 5.0",
+/* 33 SOT_FORMATSTR_ID_STARDRAW*/ "StarDrawDocument",
+/* 34 SOT_FORMATSTR_ID_STARDRAW_40*/ "StarDrawDocument 4.0",
+/* 35 SOT_FORMATSTR_ID_STARIMPRESS_50*/ "StarImpress 5.0",
+/* 36 SOT_FORMATSTR_ID_STARDRAW_50*/ "StarDraw 5.0",
+/* 37 SOT_FORMATSTR_ID_STARCALC*/ "StarCalcDocument",
+/* 38 SOT_FORMATSTR_ID_STARCALC_40*/ "StarCalc 4.0",
+/* 39 SOT_FORMATSTR_ID_STARCALC_50*/ "StarCalc 5.0",
+/* 40 SOT_FORMATSTR_ID_STARCHART*/ "StarChartDocument",
+/* 41 SOT_FORMATSTR_ID_STARCHART_40*/ "StarChartDocument 4.0",
+/* 42 SOT_FORMATSTR_ID_STARCHART_50*/ "StarChart 5.0",
+/* 43 SOT_FORMATSTR_ID_STARIMAGE*/ "StarImageDocument",
+/* 44 SOT_FORMATSTR_ID_STARIMAGE_40*/ "StarImageDocument 4.0",
+/* 45 SOT_FORMATSTR_ID_STARIMAGE_50*/ "StarImage 5.0",
+/* 46 SOT_FORMATSTR_ID_STARMATH*/ "StarMath",
+/* 47 SOT_FORMATSTR_ID_STARMATH_40*/ "StarMathDocument 4.0",
+/* 48 SOT_FORMATSTR_ID_STARMATH_50*/ "StarMath 5.0",
+/* 49 SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC*/ "StarObjectPaintDocument",
+/* 50 SOT_FORMATSTR_ID_FILLED_AREA*/ "FilledArea",
+/* 51 SOT_FORMATSTR_ID_HTML*/ "HTML (HyperText Markup Language)",
+/* 52 SOT_FORMATSTR_ID_HTML_SIMPLE*/ "HTML Format",
+/* 53 SOT_FORMATSTR_ID_CHAOS*/ "FORMAT_CHAOS",
+/* 54 SOT_FORMATSTR_ID_CNT_MSGATTACHFILE*/ "CNT_MSGATTACHFILE_FORMAT",
+/* 55 SOT_FORMATSTR_ID_BIFF_5*/ "Biff5",
+/* 56 SOT_FORMATSTR_ID_BIFF__5*/ "Biff 5",
+/* 57 SOT_FORMATSTR_ID_SYLK*/ "Sylk",
+/* 58 SOT_FORMATSTR_ID_SYLK_BIGCAPS*/ "SYLK",
+/* 59 SOT_FORMATSTR_ID_LINK*/ "Link",
+/* 60 SOT_FORMATSTR_ID_DIF*/ "DIF",
+/* 61 SOT_FORMATSTR_ID_STARDRAW_TABBAR*/ "StarDraw TabBar",
+/* 62 SOT_FORMATSTR_ID_SONLK*/ "SONLK (StarOffice Navi Link)",
+/* 63 SOT_FORMATSTR_ID_MSWORD_DOC*/ "MSWordDoc",
+/* 64 SOT_FORMATSTR_ID_STAR_FRAMESET_DOC*/ "StarFrameSetDocument",
+/* 65 SOT_FORMATSTR_ID_OFFICE_DOC*/ "OfficeDocument",
+/* 66 SOT_FORMATSTR_ID_NOTES_DOCINFO*/ "NotesDocInfo",
+/* 67 SOT_FORMATSTR_ID_NOTES_HNOTE*/ "NoteshNote",
+/* 68 SOT_FORMATSTR_ID_NOTES_NATIVE*/ "Native",
+/* 69 SOT_FORMATSTR_ID_SFX_DOC*/ "SfxDocument",
+/* 70 SOT_FORMATSTR_ID_EVDF*/ "EVDF (Explorer View Dummy Format)",
+/* 71 SOT_FORMATSTR_ID_ESDF*/ "ESDF (Explorer Search Dummy Format)",
+/* 72 SOT_FORMATSTR_ID_IDF*/ "IDF (Iconview Dummy Format)",
+/* 73 SOT_FORMATSTR_ID_EFTP*/ "EFTP (Explorer Ftp File)",
+/* 74 SOT_FORMATSTR_ID_EFD*/ "EFD (Explorer Ftp Dir)",
+/* 75 SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH*/ "SvxFormFieldExch",
+/* 76 SOT_FORMATSTR_ID_EXTENDED_TABBAR*/ "ExtendedTabBar",
+/* 77 SOT_FORMATSTR_ID_SBA_DATAEXCHANGE*/ "SBA-DATAFORMAT",
+/* 78 SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE*/ "SBA-FIELDFORMAT",
+/* 79 SOT_FORMATSTR_ID_SBA_PRIVATE_URL*/ "SBA-PRIVATEURLFORMAT",
+/* 80 SOT_FORMATSTR_ID_SBA_TABED*/ "Tabed",
+/* 81 SOT_FORMATSTR_ID_SBA_TABID*/ "Tabid",
+/* 82 SOT_FORMATSTR_ID_SBA_JOIN*/ "SBA-JOINFORMAT",
+
+#ifdef MAC
+/* 83 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR*/ "Star OBJD",
+/* 84 SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR*/ "Star LKSD",
+/* 85 SOT_FORMATSTR_ID_EMBED_SOURCE*/ "Star EMBS",
+/* 86 SOT_FORMATSTR_ID_LINK_SOURCE*/ "Star LNKS",
+/* 87 SOT_FORMATSTR_ID_EMBEDDED_OBJ*/ "Star EMBO",
+#else
+/* 83 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR*/ "Star Object Descriptor",
+/* 84 SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR*/ "Star Link Source Descriptor",
+/* 85 SOT_FORMATSTR_ID_EMBED_SOURCE*/ "Star Embed Source",
+/* 86 SOT_FORMATSTR_ID_LINK_SOURCE*/ "Star Link Source",
+/* 87 SOT_FORMATSTR_ID_EMBEDDED_OBJ*/ "Star Embedded Object",
+#endif
+
+#ifdef WNT
+/* 88 SOT_FORMATSTR_ID_FILECONTENT*/ CFSTR_FILECONTENTS,
+/* 89 SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR*/ CFSTR_FILEDESCRIPTOR,
+/* 90 SOT_FORMATSTR_ID_FILENAME*/ CFSTR_FILENAME,
+#else
+/* 88 SOT_FORMATSTR_ID_FILECONTENT*/ "FileContents",
+/* 89 SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR*/ "FileGroupDescriptor",
+/* 90 SOT_FORMATSTR_ID_FILENAME*/ "FileName",
+#endif
+
+/* 91 SOT_FORMATSTR_ID_SD_OLE*/ "SD-OLE",
+/* 92 SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE*/ "Embedded Object",
+/* 93 SOT_FORMATSTR_ID_EMBED_SOURCE_OLE*/ "Embed Source",
+/* 94 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE*/ "Object Descriptor",
+/* 95 SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE*/ "Link Source Descriptor",
+/* 96 SOT_FORMATSTR_ID_LINK_SOURCE_OLE*/ "Link Source",
+
+/* 97 SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE*/ "SBA-CTRLFORMAT",
+/* 98 SOT_FORMATSTR_ID_OUTPLACE_OBJ*/ "OutPlace Object",
+/* 99 SOT_FORMATSTR_ID_CNT_OWN_CLIP*/ "CntOwnClipboard",
+/*100 SOT_FORMATSTR_ID_INET_IMAGE*/ "SO-INet-Image",
+/*101 SOT_FORMATSTR_ID_NETSCAPE_IMAGE*/ "Netscape Image Format",
+/*102 SOT_FORMATSTR_ID_SBA_FORMEXCHANGE*/ "SBA_FORMEXCHANGE",
+/*103 SOT_FORMATSTR_ID_SBA_REPORTEXCHANGE*/ "SBA_REPORTEXCHANGE",
+/*104 SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR*/ "UniformResourceLocator",
+
+/*105 SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50*/"StarChartDocument 5.0",
+/*106 SOT_FORMATSTR_ID_GRAPHOBJ*/ "Graphic Object",
+/*107 SOT_FORMATSTR_ID_DUMMY3*/ "SO_DUMMYFORMAT_3",
+/*108 SOT_FORMATSTR_ID_DUMMY4*/ "SO_DUMMYFORMAT_4"
+};
+
+
+//-----------------------------------------------------------------------
+//-----------------------------------------------------------------------
+static StringList & Init_Impl()
+{
+ SotData_Impl * pSotData = SOTDATA();
+ if( !pSotData->pAtomList )
+ StringList * pSL = pSotData->pAtomList = new StringList();
+ return *pSotData->pAtomList;
+}
+
+/*************************************************************************
+|*
+|* SotExchange::RegisterFormatName()
+|*
+|* Beschreibung CLIP.SDW
+*************************************************************************/
+ULONG SotExchange::RegisterFormatName( const String& rName )
+{
+ // teste zuerst die Standard - Name
+ ULONG i, nMax = SOT_FORMAT_FILE_LIST;
+ for( i = SOT_FORMAT_STRING; i <= nMax; ++i )
+ if( COMPARE_EQUAL == rName.CompareToAscii( *(aFormatArray_Impl + i ) ) )
+ return i;
+
+ nMax = SOT_FORMATSTR_ID_USER_END;
+ for( i = SOT_FORMAT_RTF; i <= nMax; ++i )
+ if( COMPARE_EQUAL == rName.CompareToAscii( *(aFormatArray_Impl + i ) ) )
+ return i;
+
+ // dann in der dynamischen Liste
+ StringList & rSL = Init_Impl();
+ nMax = rSL.Count();
+ for( i = 0; i < nMax; i++ )
+ {
+ String * pStr = rSL.GetObject( i );
+ if( pStr && *pStr == rName )
+ return i + SOT_FORMATSTR_ID_USER_END + 1;
+ }
+ // nMax ist der neue Platz
+ rSL.Insert( new String( rName ), LIST_APPEND );
+ return nMax + SOT_FORMATSTR_ID_USER_END + 1;
+}
+
+/*************************************************************************
+|*
+|* SotExchange::GetFormatName()
+|*
+|* Beschreibung CLIP.SDW
+*************************************************************************/
+String SotExchange::GetFormatName( ULONG nFormat )
+{
+ String sRet;
+ if( SOT_FORMATSTR_ID_USER_END >= nFormat )
+ sRet.AppendAscii( *( aFormatArray_Impl + nFormat ) );
+ else
+ {
+ nFormat -= SOT_FORMATSTR_ID_USER_END + 1;
+ StringList & rSL = Init_Impl();
+ String* pStr;
+ if( rSL.Count() > nFormat && (pStr = rSL.GetObject( nFormat )) )
+ sRet = *pStr;
+ }
+ return sRet;
+}
+
+/*************************************************************************
+|*
+|* SotExchange::GetMaxFormat()
+|*
+*************************************************************************/
+ULONG SotExchange::GetMaxFormat( void )
+{
+ StringList & rSL = Init_Impl();
+ return SOT_FORMATSTR_ID_USER_END + rSL.Count();
+}
+
diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx
new file mode 100644
index 000000000000..a1bf66d83e28
--- /dev/null
+++ b/sot/source/base/factory.cxx
@@ -0,0 +1,442 @@
+/*************************************************************************
+ *
+ * $RCSfile: factory.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SOT_FACTORY_CXX
+#define SOT_STRING_LIST
+
+#include <factory.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+#include <object.hxx>
+#include <dtrans.hxx>
+#include <sotdata.hxx>
+#pragma hdrstop
+
+/************** class SotData_Impl *********************************************/
+/*************************************************************************
+|* SotData_Impl::SotData_Impl
+|*
+|* Beschreibung
+*************************************************************************/
+SotData_Impl::SotData_Impl()
+ : nSvObjCount( 0 )
+ , pObjectList( NULL )
+ , pFactoryList( NULL )
+ , pSotObjectFactory( NULL )
+ , pSotStorageStreamFactory( NULL )
+ , pSotStorageFactory( NULL )
+ , pSotDataObjectFactory( NULL )
+ , pEmptyList( NULL )
+ , pSotDataMemberObjectFactory( NULL )
+ , pAtomList( NULL )
+{
+}
+
+/*************************************************************************
+|* SOTDATA()
+|*
+|* Beschreibung
+*************************************************************************/
+static SotData_Impl aData;
+SotData_Impl * SOTDATA()
+{
+ return &aData;
+}
+
+/*************************************************************************
+|* SotFactory::DeInit()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotFactory::DeInit()
+{
+ SotData_Impl * pSotData = SOTDATA();
+
+ if( pSotData->nSvObjCount )
+ {
+#ifdef DBG_UTIL
+ ByteString aStr( "Objects alive: " );
+ aStr.Append( ByteString::CreateFromInt32( pSotData->nSvObjCount ) );
+ DBG_WARNING( aStr.GetBuffer() )
+
+/*
+ SotObjectList *pObjList = pSotData->pObjectList;
+
+ if( pObjList )
+ {
+ SotObject * p = pObjList->First();
+ while( p )
+ {
+ String aStr( "Factory: " );
+ aStr += p->GetSvFactory()->GetClassName();
+ aStr += " Count: ";
+ aStr += p->GetRefCount();
+ DBG_TRACE( "\tReferences:" );
+ p->TestObjRef( FALSE );
+#ifdef TEST_INVARIANT
+ DBG_TRACE( "\tInvariant:" );
+ p->TestInvariant( TRUE );
+#endif
+ p = pObjList->Next();
+ }
+ }
+*/
+#endif
+ return;
+ }
+
+ // Muss von hinten nach vorne zerstoert werden. Das ist die umgekehrte
+ // Reihenfolge der Erzeugung
+ SotFactoryList* pFactoryList = pSotData->pFactoryList;
+ if( pFactoryList )
+ {
+ SotFactory * pFact = pFactoryList->Last();
+ while( NULL != (pFact = pFactoryList->Remove()) )
+ {
+ delete pFact;
+ pFact = pFactoryList->Last();
+ }
+ delete pFactoryList;
+ pSotData->pFactoryList = NULL;
+ }
+
+ delete pSotData->pObjectList;
+ pSotData->pObjectList = NULL;
+ delete pSotData->pEmptyList;
+ pSotData->pEmptyList = NULL;
+ if( pSotData->pAtomList )
+ {
+
+ ULONG nMax = pSotData->pAtomList->Count();
+ for( ULONG i = 0; i < nMax; i++ )
+ delete pSotData->pAtomList->GetObject( i );
+ delete pSotData->pAtomList;
+ pSotData->pAtomList = NULL;
+ }
+ //delete pSOTDATA();
+ //SOTDATA() = NULL;
+}
+
+
+/************** class SotFactory *****************************************/
+/*************************************************************************
+|* SotFactory::SotFactory()
+|*
+|* Beschreibung
+*************************************************************************/
+TYPEINIT0(SotFactory);
+
+SotFactory::SotFactory( const SvGlobalName & rName,
+ const String & rClassName,
+ CreateInstanceType pCreateFuncP )
+ : SvGlobalName ( rName )
+ , pCreateFunc ( pCreateFuncP )
+ , aClassName ( rClassName )
+ , nSuperCount ( 0 )
+ , pSuperClasses ( NULL )
+{
+#ifdef DBG_UTIL
+ SvGlobalName aEmptyName;
+ if( aEmptyName != *this )
+ { // wegen Sfx-BasicFactories
+ DBG_ASSERT( aEmptyName != *this, "create factory without SvGlobalName" )
+ if( Find( *this ) )
+ {
+ /*
+ String aStr( GetClassName() );
+ aStr += ", UniqueName: ";
+ aStr += GetHexName();
+ aStr += ", create factories with the same unique name";
+ DBG_ERROR( aStr );
+ */
+ DBG_ERROR( "create factories with the same unique name" );
+ }
+ }
+#endif
+ SotData_Impl * pSotData = SOTDATA();
+ if( !pSotData->pFactoryList )
+ pSotData->pFactoryList = new SotFactoryList();
+ // muss nach hinten, wegen Reihenfolge beim zerstoeren
+ pSotData->pFactoryList->Insert( this, LIST_APPEND );
+}
+
+
+//=========================================================================
+SotFactory::~SotFactory()
+{
+ delete (void*)pSuperClasses;
+}
+
+
+/*************************************************************************
+|* SotFactory::
+|*
+|* Beschreibung Zugriffsmethoden auf SotData_Impl-Daten
+*************************************************************************/
+UINT32 SotFactory::GetSvObjectCount()
+{
+ return SOTDATA()->nSvObjCount;
+}
+
+
+const SotFactoryList * SotFactory::GetFactoryList()
+{
+ return SOTDATA()->pFactoryList;
+}
+
+/*************************************************************************
+|* SotFactory::Find()
+|*
+|* Beschreibung
+*************************************************************************/
+const SotFactory * SotFactory::Find( const SvGlobalName & rFactName )
+{
+ SvGlobalName aEmpty;
+ SotData_Impl * pSotData = SOTDATA();
+ if( rFactName != aEmpty && pSotData->pFactoryList )
+ {
+ SotFactory * pFact = pSotData->pFactoryList->First();
+ while( pFact )
+ {
+ if( *pFact == rFactName )
+ return pFact;
+ pFact = pSotData->pFactoryList->Next();
+ }
+ }
+ return NULL;
+}
+
+/*************************************************************************
+|* SotFactory::PutSuperClass()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotFactory::PutSuperClass( const SotFactory * pFact )
+{
+ nSuperCount++;
+ if( !pSuperClasses )
+ pSuperClasses = new const SotFactory * [ nSuperCount ];
+ else
+ {
+ const SotFactory ** pTmp = new const SotFactory * [ nSuperCount ];
+ memcpy( (void *)pTmp, (void *)pSuperClasses,
+ sizeof( void * ) * (nSuperCount -1) );
+ delete (void *)pSuperClasses;
+ pSuperClasses = pTmp;
+ }
+ pSuperClasses[ nSuperCount -1 ] = pFact;
+}
+
+
+/*************************************************************************
+|* SotFactory::IncSvObjectCount()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotFactory::IncSvObjectCount( SotObject * pObj )
+{
+ SotData_Impl * pSotData = SOTDATA();
+ pSotData->nSvObjCount++;
+ if( !pSotData->pObjectList )
+ pSotData->pObjectList = new SotObjectList();
+ if( pObj )
+ pSotData->pObjectList->Insert( pObj );
+}
+
+
+/*************************************************************************
+|* SotFactory::DecSvObjectCount()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotFactory::DecSvObjectCount( SotObject * pObj )
+{
+ SotData_Impl * pSotData = SOTDATA();
+ pSotData->nSvObjCount--;
+ if( pObj )
+ pSotData->pObjectList->Remove( pObj );
+ if( !pSotData->nSvObjCount )
+ {
+ //keine internen und externen Referenzen mehr
+ }
+}
+
+
+/*************************************************************************
+|* SotFactory::TestInvariant()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotFactory::TestInvariant()
+{
+#ifdef TEST_INVARIANT
+ SotData_Impl * pSotData = SOTDATA();
+ if( pSotData->pObjectList )
+ {
+ ULONG nCount = pSotData->pObjectList->Count();
+ for( ULONG i = 0; i < nCount ; i++ )
+ {
+ pSotData->pObjectList->GetObject( i )->TestInvariant( FALSE );
+ }
+ }
+#endif
+}
+
+/*************************************************************************
+|* SotFactory::CreateInstance()
+|*
+|* Beschreibung
+*************************************************************************/
+void * SotFactory::CreateInstance( SotObject ** ppObj ) const
+{
+ DBG_ASSERT( pCreateFunc, "SotFactory::CreateInstance: pCreateFunc == 0" );
+ return pCreateFunc( ppObj );
+}
+
+//=========================================================================
+void * SotFactory::CastAndAddRef
+(
+ SotObject * pObj /* Das Objekt von dem der Typ gepr"uft wird. */
+) const
+/* [Beschreibung]
+
+ Ist eine Optimierung, damit die Ref-Klassen k"urzer implementiert
+ werden k"onnen. pObj wird auf den Typ der Factory gecastet.
+ In c++ (wenn es immer erlaubt w"are) w"urde der void * wie im
+ Beispiel gebildet.
+ Factory der Klasse SvPersist.
+ void * p = (void *)(SvPersist *)pObj;
+
+ [R"uckgabewert]
+
+ void *, NULL, pObj war NULL oder das Objekt war nicht vom Typ
+ der Factory.
+ Ansonsten wird pObj zuerst auf den Typ der Factory
+ gecastet und dann auf void *.
+
+ [Querverweise]
+
+ <SotObject::CastAndAddRef>
+*/
+{
+ return pObj ? pObj->CastAndAddRef( this ) : NULL;
+}
+
+//=========================================================================
+void * SotFactory::AggCastAndAddRef
+(
+ SotObject * pObj /* Das Objekt von dem der Typ gepr"uft wird. */
+) const
+/* [Beschreibung]
+
+ Ist eine Optimierung, damit die Ref-Klassen k"urzer implementiert
+ werden k"onnen. pObj wird auf den Typ der Factory gecastet.
+ In c++ (wenn es immer erlaubt w"are) w"urde der void * wie im
+ Beispiel gebildet.
+ Factory der Klasse SvPersist.
+ void * p = (void *)(SvPersist *)pObj;
+ Hinzu kommt noch, dass ein Objekt aus meheren c++ Objekten
+ zusammengesetzt sein kann. Diese Methode sucht nach einem
+ passenden Objekt.
+
+ [R"uckgabewert]
+
+ void *, NULL, pObj war NULL oder das Objekt war nicht vom Typ
+ der Factory.
+ Ansonsten wird pObj zuerst auf den Typ der Factory
+ gecastet und dann auf void *.
+
+ [Querverweise]
+
+ <SvObject::AggCast>
+*/
+{
+ void * pRet = NULL;
+ if( pObj )
+ {
+ pRet = pObj->AggCast( this );
+ if( pRet )
+ pObj->AddRef();
+ }
+ return pRet;
+}
+
+/*************************************************************************
+|* SotFactory::Is()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotFactory::Is( const SotFactory * pSuperCl ) const
+{
+ if( this == pSuperCl )
+ return TRUE;
+
+ for( USHORT i = 0; i < nSuperCount; i++ )
+ {
+ if( pSuperClasses[ i ]->Is( pSuperCl ) )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+
+
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
new file mode 100644
index 000000000000..50cf320bc05b
--- /dev/null
+++ b/sot/source/base/filelist.cxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * $RCSfile: filelist.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+
+#include<tools/list.hxx>
+#include<tools/stream.hxx>
+#include<tools/string.hxx>
+#include<tools/rtti.hxx>
+#include<exchange.hxx>
+#include<filelist.hxx>
+#pragma hdrstop
+
+TYPEINIT1_AUTOFACTORY( FileList, SvDataCopyStream );
+
+
+// String-Liste zum Speichern der Namen deklarieren
+DECLARE_LIST( FileStringList, String* );
+
+
+/*************************************************************************
+|*
+|* FileList - Ctor/Dtor
+|*
+\*************************************************************************/
+
+FileList::FileList()
+{
+ pStrList = new FileStringList();
+}
+
+FileList::~FileList()
+{
+ ClearAll();
+}
+
+void FileList::ClearAll( void )
+{
+ // Strings in der Liste loeschen
+ ULONG nCount = pStrList->Count();
+ for( ULONG i = 0 ; i < nCount ; i++ )
+ delete pStrList->GetObject( i );
+
+ // Liste loeschen
+ delete pStrList;
+}
+
+/*************************************************************************
+|*
+|* FileList - Zuweisungsoperator
+|*
+\*************************************************************************/
+
+FileList& FileList::operator=( const FileList& rFileList )
+{
+ // Liste duplizieren
+ *pStrList = *rFileList.pStrList;
+
+ // Strings in der Liste kopieren
+ ULONG nCount = pStrList->Count();
+ for( ULONG i = 0 ; i < nCount ; i++ )
+ pStrList->Replace( new String( *rFileList.pStrList->GetObject( i ) ), i );
+
+ return *this;
+}
+
+
+/*************************************************************************
+|*
+|* FileList::GetFormatName()
+|*
+\*************************************************************************/
+
+ULONG FileList::GetFormat()
+{
+ return FORMAT_FILE_LIST;
+}
+
+
+/******************************************************************************
+|*
+|* virtuelle SvData-Methoden
+|*
+\******************************************************************************/
+
+void FileList::Load( SvStream& rIStm )
+{
+ rIStm >> *this;
+}
+
+void FileList::Save( SvStream& rOStm )
+{
+ rOStm << *this;
+}
+
+void FileList::Assign( const SvDataCopyStream& rCopyStream )
+{
+ *this = (const FileList&)rCopyStream;
+}
+
+
+/******************************************************************************
+|*
+|* Stream-Operatoren
+|*
+\******************************************************************************/
+
+// Windows-Struktur nachdefinieren
+// Typen entsprechend der Groesse der Original-Typen gewaehlt
+// In den Kommentaren sind jeweils die Original-Typen angegeben.
+// Hier werden immer die 32-Bit-Varianten der Typen gewaehlt, um
+// eine einheitliche Struktur fuer alle Plattformen zu erhalten.
+// Diese Struktor ist zwar nicht Win16-kompatibel, dort kann aber
+// die Struktur auch nicht direkt per Drag&Drop uebertragen werden.
+struct Sv_DROPFILES
+{
+ /*DWORD = unsigned long*/ UINT32 pFiles; // offset of file list
+ /*POINT = { long, long }*/ INT32 pt_x; // drop point
+ INT32 pt_y;
+ /*BOOL = int*/ INT32 fNC;
+ /*BOOL = int*/ INT32 fWide; // wide character-flag
+
+ // Konstruktor
+ Sv_DROPFILES( void )
+ {
+ pFiles = 20; // 5 x 4 Bytes, sizeof gefaehrlich wegen alignment
+ pt_x = 0L;
+ pt_y = 0L;
+ fNC = FALSE;
+ fWide = FALSE; // NOTE: Unicode not allowed for Windows 95 !!
+ }
+
+};
+
+// Stream-Operatoren fuer Sv_DROPFILES
+SvStream& operator<<( SvStream& rOStm, const Sv_DROPFILES& r )
+{
+ rOStm << r.pFiles << r.pt_x << r.pt_y << r.fNC << r.fWide;
+ return rOStm;
+}
+SvStream& operator>>( SvStream& rIStm, Sv_DROPFILES& r )
+{
+ rIStm >> r.pFiles >> r.pt_x >> r.pt_y >> r.fNC >> r.fWide;
+ return rIStm;
+}
+
+/*
+ * NOTE: to correctly handle this Protocol with Unicode, native Win32 must be called:
+ * e.g. DropQueryFile
+ */
+
+SvStream& operator<<( SvStream& rOStm, const FileList& rFileList )
+{
+ // Windows-kompatible Struktur anlegen und streamen
+ Sv_DROPFILES aSv_DROPFILES;
+ rOStm << aSv_DROPFILES;
+
+ // String-Liste anhaengen
+ ULONG nCount = rFileList.pStrList->Count();
+ for( ULONG i = 0 ; i < nCount ; i++ )
+ {
+ String* pStr = rFileList.pStrList->GetObject( i );
+// rOStm << pStr->GetBuffer();
+ rOStm << "invalid.txt"; //
+
+ // Noch eine 0 anhaengen
+ rOStm << (char)0;
+ }
+ // Noch eine 0 anhaengen
+ rOStm << (char)0;
+
+ return rOStm;
+}
+
+SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
+{
+ // Windows-kompatible Struktur anlegen und aus Stream lesen
+ Sv_DROPFILES aSv_DROPFILES;
+ rIStm >> aSv_DROPFILES;
+
+ // Bestehende Liste loeschen und neue anlegen
+ rFileList.ClearAll();
+ rFileList.pStrList = new FileStringList();
+
+ // String-Liste aufbauen
+ ByteString aStr;
+ char c, cLast;
+
+ // 1. Zeichen lesen
+ rIStm >> c;
+ do
+ {
+ aStr = ByteString();
+
+ // String bis '\0' lesen
+ do
+ {
+ if( c )
+ aStr += c;
+ cLast = c; // Zeichen merken
+
+ // Bei Unicode eins mehr weg
+ if( aSv_DROPFILES.fWide )
+ rIStm >> c;
+
+ rIStm >> c;
+ }
+ while( cLast );
+
+ // String in die Liste stopfen
+ rFileList.AppendFile( String(aStr, RTL_TEXTENCODING_ASCII_US));
+ }
+ while( c ); // c == 0 && cLast == 0 -> Ende
+
+ return rIStm;
+}
+
+
+/******************************************************************************
+|*
+|* Liste fuellen/abfragen
+|*
+\******************************************************************************/
+
+void FileList::AppendFile( const String& rStr )
+{
+ pStrList->Insert( new String( rStr ) , pStrList->Count() );
+}
+
+String FileList::GetFile( ULONG i ) const
+{
+ String aStr;
+ if( i < pStrList->Count() )
+ aStr = *pStrList->GetObject( i );
+ return aStr;
+}
+
+ULONG FileList::Count( void ) const
+{
+ return pStrList->Count();
+}
+
+
+
diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
new file mode 100644
index 000000000000..ca610ef449e4
--- /dev/null
+++ b/sot/source/base/formats.cxx
@@ -0,0 +1,1835 @@
+/*************************************************************************
+ *
+ * $RCSfile: formats.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SOT_FORMATS_INCLUDE_SYSTEMFORMATS
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+#pragma hdrstop
+
+#include "exchange.hxx"
+#include "formats.hxx"
+#include "dtrans.hxx"
+#include "filelist.hxx"
+
+struct SotAction_Impl
+{
+ ULONG nFormatId; // Clipboard Id
+ USHORT nAction; // Action Id
+ BYTE nContextCheckId; // additional check of content in clipboard
+};
+
+
+// define a context check Id for every formatid
+#define FILEGRPDSC_ONLY_URL 1
+
+/*
+ Fuer jedes Ziel existiert in der Tabelle genau ein SotDestinationEntry_Impl.
+ Dieser Eintrag enthaelt u.a. fuer jedes vom Ziel auswertbare Format eine
+ Default-Action. Die Default-Aktionen verweisen fuer jedes Format auf
+ die auszuwertende Tabelle, d.h. sie enthalten nur EXCHG_IN_ACTION_MOVE,
+ EXCHG_IN_ACTION_COPY oder EXCHG_IN_ACTION_LINK. Entsprechend dieser Aktion
+ ist dann aMoveActions, aCopyActions oder aLinkActions auszuwerten.
+ Die Aktionen sind nach Prioritaet sortiert, d.h. je "wichtiger" das
+ Format ist, desto eher erscheint es in der Liste.
+*/
+
+struct SotDestinationEntry_Impl
+{
+ USHORT nDestination;
+ const SotAction_Impl* aDefaultActions;
+ const SotAction_Impl* aMoveActions;
+ const SotAction_Impl* aCopyActions;
+ const SotAction_Impl* aLinkActions;
+};
+
+
+
+/*
+ Ueber diese Tabelle erfolgt die Zuordnung von Destination, vorhandenen
+ Datenformaten sowie gewuenschter Aktion zu einer Aktion und dem in
+ ihr zu benutzenden Datenformat. Die Tabelle ist nach den Exchange-Zielen
+ (EXCHG_DEST_*) sortiert. Innerhalb des Zieleintrages befinden sich genau
+ vier Tabellen fuer Default-, Move-, Copy- und Linkaktionen. Ueber
+ die Default-Tabelle erfolgt das Mapping zwischen Default-Aktion
+ (DropEvent::IsDefaultAction()) und daraus resultierender wirklicher
+ Aktion. Diese Tabelle enthaelt deshalb nur die Aktionen
+ EXCHG_IN_ACTION_COPY, EXCHG_IN_ACTION_MOVE und EXCHG_IN_ACTION_LINK,
+ die auf die spezielle Tabelle verweisen. Die uebrigen Tabellen
+ koennen beliebige Aktionen enthalten. Jede Tabelle ist nach der
+ Format-Prioritaet sortiert. Eintrag Null hat die hoechste Prioritaet.
+*/
+
+#define EXCHG_EMPYT_ARRAY \
+static SotAction_Impl __READONLY_DATA aEmptyArr[] = \
+ { \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_FTP_BOX_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FTP_BOX_Def[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FTP_BOX_Copy[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_COPY_FILE, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_COPY_FILE, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FTP_BOX_Link[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_COPY_FILE, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_COPY_FILE, 0 },\
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_FTP_FLD_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FTP_FLD_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_CNT_MSGATTACHFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FTP_FLD_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_OUT_ACTION_MOVE_CHAOSOBJ, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_OUT_ACTION_MOVE_FILE, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_MOVE_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_MOVE_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_MOVE_FILE, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_MOVE_FILE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FTP_FLD_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_CNT_MSGATTACHFILE, EXCHG_OUT_ACTION_COPY_MSGATTACH, 0 },\
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_OUT_ACTION_COPY_CHAOSOBJ, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_COPY_FILE, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FTP_FLD_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_COPY_FILE, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_COPY_FILE, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_FSYS_FLD_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FSYS_FLD_Def[] = \
+ { \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_CNT_MSGATTACHFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FSYS_FLD_Move[] = \
+ { \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_MOVE_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_OUT_ACTION_MOVE_CHAOSOBJ, 0 }, \
+ { SOT_FORMATSTR_ID_CNT_MSGATTACHFILE, EXCHG_OUT_ACTION_COPY_MSGATTACH, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FSYS_FLD_Copy[] = \
+ { \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_OUT_ACTION_COPY_CHAOSOBJ, 0 }, \
+ { SOT_FORMATSTR_ID_CNT_MSGATTACHFILE, EXCHG_OUT_ACTION_COPY_MSGATTACH, 0 },\
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_FSYS_FLD_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILELINK, 0 }, \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ };
+
+#define EXCHG_DEST_IMAP_FLD_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_IMAP_FLD_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_IMAP_FLD_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_MOVE, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_IMAP_FLD_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+ static SotAction_Impl __READONLY_DATA aEXCHG_DEST_IMAP_FLD_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_SEARCH_BOX_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SEARCH_BOX_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK , 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SEARCH_BOX_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK , 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_SEARCH_LOC_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SEARCH_LOC_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK , 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SEARCH_LOC_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK , 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_TRASH_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_TRASH_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_MOVE , 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_TRASH_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_MOVE , 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_SEARCH_FLD_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SEARCH_FLD_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK , 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SEARCH_FLD_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK , 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_OLEOBJ_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_OLEOBJ_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_OLEOBJ_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_OLEOBJ_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 },\
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_CHARTDOC_OLEOBJ_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_CHARTDOC_OLEOBJ_Def[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_CHARTDOC_OLEOBJ_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_CHARTDOC_OLEOBJ_Link[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_INTERACTIVE, 0 },\
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_TEXTFRAME_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_SBA_DATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_DATAEXCHANGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+#define EXCHG_DEST_DOC_TEXTFRAME_WEB_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_WEB_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_INET_IMAGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_WEB_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_WEB_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_SBA_DATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_TEXTFRAME_WEB_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_GRAPHOBJ_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPHOBJ_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPHOBJ_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPHOBJ_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPHOBJ_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_LNKD_GRAPHOBJ_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Move[] =\
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Copy[] =\
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Link[] =\
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_GRAPH_W_IMAP_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPH_W_IMAP_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPH_W_IMAP_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB| EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP| EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPH_W_IMAP_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GRAPH_W_IMAP_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Def[] =\
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Move[] =\
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB| EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP| EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Copy[] =\
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Link[] =\
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_DOC_IMAPREGION_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_IMAPREGION_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_IMAPREGION_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_DOC_DRAWOBJ_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_DRAWOBJ_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_DRAWOBJ_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_DRAWOBJ_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_DRAWOBJ_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_DOC_URLBUTTON_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_URLBUTTON_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_URLBUTTON_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_URLBUTTON_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_DOC_URLFIELD_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_URLFIELD_Def[] = \
+ { \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_URLFIELD_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_URLFIELD_Link[] = \
+ { \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_HYPERLINK, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_GROUPOBJ_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GROUPOBJ_Def[] = \
+ { \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GROUPOBJ_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_REPLACE_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_KEEP_POSSIZE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GROUPOBJ_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP| EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_GRAPH | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_GROUPOBJ_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES| EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_GET_ATTRIBUTES | EXCHG_OUT_ACTION_FLAG_FILL | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_DOC_MAILATTACHFRAME_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_MAILATTACHFRAME_Def[] =\
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_MAILATTACHFRAME_Copy[] =\
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_OUT_ACTION_INSERT_FILE, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK, 0 },\
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_DOC_MAILADDRESSFIELD_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_MAILADDRESSFIELD_Def[] =\
+ { \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_DOC_MAILADDRESSFIELD_Copy[] =\
+ { \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_SWDOC_FREE_AREA_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_Def[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_SBA_DATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_DATAEXCHANGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+#define EXCHG_DEST_SWDOC_FREE_AREA_WEB_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Def[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Copy[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_RTF, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_SONLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_SCDOC_FREE_AREA_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SCDOC_FREE_AREA_Def[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SCDOC_FREE_AREA_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_BIFF_5, EXCHG_IN_ACTION_MOVE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_BIFF__5,EXCHG_IN_ACTION_MOVE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SCDOC_FREE_AREA_Copy[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_BIFF_5, EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_BIFF__5,EXCHG_IN_ACTION_COPY | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SCDOC_FREE_AREA_Link[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_SDDOC_FREE_AREA_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SDDOC_FREE_AREA_Def[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_COPY, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_STRING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMAT_BITMAP, EXCHG_IN_ACTION_COPY, 0 }, \
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_IN_ACTION_MOVE, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SDDOC_FREE_AREA_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SDDOC_FREE_AREA_Copy[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_COPY, 0 },\
+ { SOT_FORMAT_FILE, EXCHG_OUT_ACTION_INSERT_FILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SVXB, EXCHG_OUT_ACTION_INSERT_SVXB | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_HTML, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_STRING, EXCHG_OUT_ACTION_INSERT_STRING | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMAT_GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMAT_BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_SVIM, EXCHG_OUT_ACTION_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SDDOC_FREE_AREA_Link[] = \
+ { \
+ { SOT_FORMAT_FILE_LIST, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK | EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_HYPERLINK | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 },\
+ { SOT_FORMATSTR_ID_LINK, EXCHG_OUT_ACTION_INSERT_DDE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, EXCHG_OUT_ACTION_INSERT_OLE | EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL, 0 }, \
+ { 0xffff } \
+ };
+
+
+/* */
+#define EXCHG_DEST_SUBSCR_BOX_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SUBSCR_BOX_Def[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SUBSCR_BOX_Move[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SUBSCR_BOX_Copy[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 },\
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_SUBSCR_BOX_Link[] = \
+ { \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 },\
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, FILEGRPDSC_ONLY_URL },\
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_OUT_ACTION_INSERT_BOOKMARK, 0 },\
+ { 0xffff } \
+ };
+
+/* */
+#define EXCHG_DEST_GROUPVIEW_ARRAY \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_GROUPVIEW_Def[] = \
+ { \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_GROUPVIEW_Move[] = \
+ { \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_GROUPVIEW_Copy[] = \
+ { \
+ { 0xffff } \
+ }; \
+static SotAction_Impl __READONLY_DATA aEXCHG_DEST_GROUPVIEW_Link[] = \
+ { \
+ { SOT_FORMAT_FILE, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_CHAOS, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_SOLK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, EXCHG_IN_ACTION_LINK, 0 }, \
+ { SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, EXCHG_IN_ACTION_LINK, FILEGRPDSC_ONLY_URL }, \
+ { SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, EXCHG_IN_ACTION_LINK, 0 }, \
+ { 0xffff } \
+ };
+
+/* */
+
+#define IMPL_DATA_ARRAY_1 \
+EXCHG_EMPYT_ARRAY \
+EXCHG_DEST_FTP_BOX_ARRAY \
+EXCHG_DEST_FTP_FLD_ARRAY \
+EXCHG_DEST_FSYS_FLD_ARRAY \
+EXCHG_DEST_SEARCH_BOX_ARRAY \
+EXCHG_DEST_SEARCH_LOC_ARRAY \
+EXCHG_DEST_TRASH_ARRAY \
+EXCHG_DEST_SEARCH_FLD_ARRAY \
+EXCHG_DEST_DOC_OLEOBJ_ARRAY \
+EXCHG_DEST_CHARTDOC_OLEOBJ_ARRAY \
+EXCHG_DEST_DOC_TEXTFRAME_ARRAY \
+EXCHG_DEST_DOC_GRAPHOBJ_ARRAY \
+EXCHG_DEST_DOC_LNKD_GRAPHOBJ_ARRAY \
+EXCHG_DEST_IMAP_FLD_ARRAY \
+EXCHG_DEST_DOC_TEXTFRAME_WEB_ARRAY
+
+#define IMPL_DATA_ARRAY_2 \
+EXCHG_DEST_DOC_GRAPH_W_IMAP_ARRAY \
+EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_ARRAY \
+EXCHG_DEST_DOC_IMAPREGION_ARRAY \
+EXCHG_DEST_DOC_DRAWOBJ_ARRAY \
+EXCHG_DEST_DOC_URLBUTTON_ARRAY \
+EXCHG_DEST_DOC_URLFIELD_ARRAY \
+EXCHG_DEST_DOC_GROUPOBJ_ARRAY \
+EXCHG_DEST_DOC_MAILATTACHFRAME_ARRAY \
+EXCHG_DEST_DOC_MAILADDRESSFIELD_ARRAY \
+EXCHG_DEST_SWDOC_FREE_AREA_ARRAY \
+EXCHG_DEST_SCDOC_FREE_AREA_ARRAY \
+EXCHG_DEST_SDDOC_FREE_AREA_ARRAY \
+EXCHG_DEST_SUBSCR_BOX_ARRAY \
+EXCHG_DEST_SWDOC_FREE_AREA_WEB_ARRAY \
+EXCHG_DEST_GROUPVIEW_ARRAY
+
+#define IMPL_DATA_ARRAY_3 \
+static SotDestinationEntry_Impl __READONLY_DATA aDestinationArray[] = \
+{ \
+ { EXCHG_DEST_FTP_BOX, \
+ aEXCHG_DEST_FTP_BOX_Def, \
+ aEmptyArr, \
+ aEXCHG_DEST_FTP_BOX_Copy, \
+ aEXCHG_DEST_FTP_BOX_Link, \
+ }, \
+ { EXCHG_DEST_FTP_FLD, \
+ aEXCHG_DEST_FTP_FLD_Def, \
+ aEXCHG_DEST_FTP_FLD_Move, \
+ aEXCHG_DEST_FTP_FLD_Copy, \
+ aEXCHG_DEST_FTP_FLD_Link, \
+ }, \
+ { EXCHG_DEST_FSYS_BOX, \
+ aEmptyArr, \
+ aEmptyArr, \
+ aEmptyArr, \
+ aEmptyArr \
+ }, \
+ { EXCHG_DEST_FSYS_FLD, \
+ aEXCHG_DEST_FSYS_FLD_Def, \
+ aEXCHG_DEST_FSYS_FLD_Move, \
+ aEXCHG_DEST_FSYS_FLD_Copy, \
+ aEXCHG_DEST_FSYS_FLD_Link \
+ }, \
+ { EXCHG_DEST_IMAP_FLD, \
+ aEXCHG_DEST_IMAP_FLD_Def, \
+ aEXCHG_DEST_IMAP_FLD_Move, \
+ aEXCHG_DEST_IMAP_FLD_Copy, \
+ aEXCHG_DEST_IMAP_FLD_Link, \
+ }, \
+ { EXCHG_DEST_SEARCH_BOX, \
+ aEXCHG_DEST_SEARCH_BOX_Def, \
+ aEmptyArr, \
+ aEmptyArr, \
+ aEXCHG_DEST_SEARCH_BOX_Link \
+ }, \
+ { EXCHG_DEST_SEARCH_LOCATIONS, \
+ aEXCHG_DEST_SEARCH_LOC_Def, \
+ aEmptyArr, \
+ aEmptyArr, \
+ aEXCHG_DEST_SEARCH_LOC_Link \
+ }, \
+ { EXCHG_DEST_TRASH, \
+ aEXCHG_DEST_TRASH_Def, \
+ aEXCHG_DEST_TRASH_Move, \
+ aEmptyArr, \
+ aEmptyArr \
+ }, \
+ { EXCHG_DEST_SEARCH_FLD, \
+ aEXCHG_DEST_SEARCH_FLD_Def, \
+ aEmptyArr, \
+ aEmptyArr, \
+ aEXCHG_DEST_SEARCH_FLD_Link \
+ }, \
+ { EXCHG_DEST_DOC_OLEOBJ, \
+ aEXCHG_DEST_DOC_OLEOBJ_Def, \
+ aEXCHG_DEST_DOC_OLEOBJ_Move, \
+ aEmptyArr, \
+ aEXCHG_DEST_DOC_OLEOBJ_Link \
+ }, \
+ { EXCHG_DEST_CHARTDOC_OLEOBJ, \
+ aEXCHG_DEST_CHARTDOC_OLEOBJ_Def, \
+ aEXCHG_DEST_CHARTDOC_OLEOBJ_Move, \
+ aEmptyArr, \
+ aEXCHG_DEST_CHARTDOC_OLEOBJ_Link \
+ }, \
+ { EXCHG_DEST_DOC_TEXTFRAME, \
+ aEXCHG_DEST_DOC_TEXTFRAME_Def, \
+ aEXCHG_DEST_DOC_TEXTFRAME_Move, \
+ aEXCHG_DEST_DOC_TEXTFRAME_Copy, \
+ aEXCHG_DEST_DOC_TEXTFRAME_Link \
+ }, \
+ { EXCHG_DEST_DOC_GRAPHOBJ, \
+ aEXCHG_DEST_DOC_GRAPHOBJ_Def, \
+ aEXCHG_DEST_DOC_GRAPHOBJ_Move, \
+ aEXCHG_DEST_DOC_GRAPHOBJ_Copy, \
+ aEXCHG_DEST_DOC_GRAPHOBJ_Link \
+ }, \
+ { EXCHG_DEST_DOC_LNKD_GRAPHOBJ, \
+ aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Def, \
+ aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Move, \
+ aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Copy, \
+ aEXCHG_DEST_DOC_LNKD_GRAPHOBJ_Link \
+ }, \
+ { EXCHG_DEST_DOC_GRAPH_W_IMAP, \
+ aEXCHG_DEST_DOC_GRAPH_W_IMAP_Def, \
+ aEXCHG_DEST_DOC_GRAPH_W_IMAP_Move, \
+ aEXCHG_DEST_DOC_GRAPH_W_IMAP_Copy, \
+ aEXCHG_DEST_DOC_GRAPH_W_IMAP_Link \
+ }, \
+ { EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP, \
+ aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Def, \
+ aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Move, \
+ aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Copy, \
+ aEXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP_Link \
+ }, \
+ { EXCHG_DEST_DOC_IMAPREGION, \
+ aEXCHG_DEST_DOC_IMAPREGION_Def, \
+ aEXCHG_DEST_DOC_IMAPREGION_Copy, \
+ aEmptyArr, \
+ aEmptyArr \
+ }, \
+ { EXCHG_DEST_DOC_DRAWOBJ, \
+ aEXCHG_DEST_DOC_DRAWOBJ_Def, \
+ aEXCHG_DEST_DOC_DRAWOBJ_Copy, \
+ aEXCHG_DEST_DOC_DRAWOBJ_Move, \
+ aEXCHG_DEST_DOC_DRAWOBJ_Link \
+ }, \
+ { EXCHG_DEST_DOC_URLBUTTON, \
+ aEXCHG_DEST_DOC_URLBUTTON_Def, \
+ aEXCHG_DEST_DOC_URLBUTTON_Move, \
+ aEXCHG_DEST_DOC_URLBUTTON_Copy, \
+ aEmptyArr \
+ }, \
+ { EXCHG_DEST_DOC_URLFIELD, \
+ aEXCHG_DEST_DOC_URLFIELD_Def, \
+ aEmptyArr, \
+ aEXCHG_DEST_DOC_URLFIELD_Copy, \
+ aEXCHG_DEST_DOC_URLFIELD_Link \
+ }, \
+ { EXCHG_DEST_DOC_GROUPOBJ, \
+ aEXCHG_DEST_DOC_GROUPOBJ_Def, \
+ aEXCHG_DEST_DOC_GROUPOBJ_Move, \
+ aEXCHG_DEST_DOC_GROUPOBJ_Copy, \
+ aEXCHG_DEST_DOC_GROUPOBJ_Link \
+ }, \
+ { EXCHG_DEST_DOC_MAILATTACHFRAME, \
+ aEXCHG_DEST_DOC_MAILATTACHFRAME_Def, \
+ aEmptyArr, \
+ aEXCHG_DEST_DOC_MAILATTACHFRAME_Copy, \
+ aEmptyArr \
+ }, \
+ { EXCHG_DEST_DOC_MAILADDRESSFIELD, \
+ aEXCHG_DEST_DOC_MAILADDRESSFIELD_Def, \
+ aEmptyArr, \
+ aEXCHG_DEST_DOC_MAILADDRESSFIELD_Copy, \
+ aEmptyArr \
+ }, \
+ { EXCHG_DEST_SWDOC_FREE_AREA, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_Def, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_Move, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_Copy, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_Link \
+ }, \
+ { EXCHG_DEST_SCDOC_FREE_AREA, \
+ aEXCHG_DEST_SCDOC_FREE_AREA_Def, \
+ aEXCHG_DEST_SCDOC_FREE_AREA_Move, \
+ aEXCHG_DEST_SCDOC_FREE_AREA_Copy, \
+ aEXCHG_DEST_SCDOC_FREE_AREA_Link \
+ }, \
+ { EXCHG_DEST_SDDOC_FREE_AREA, \
+ aEXCHG_DEST_SDDOC_FREE_AREA_Def, \
+ aEXCHG_DEST_SDDOC_FREE_AREA_Move, \
+ aEXCHG_DEST_SDDOC_FREE_AREA_Copy, \
+ aEXCHG_DEST_SDDOC_FREE_AREA_Link \
+ }, \
+ { EXCHG_DEST_SUBSCR_BOX, \
+ aEXCHG_DEST_SUBSCR_BOX_Def, \
+ aEXCHG_DEST_SUBSCR_BOX_Move, \
+ aEXCHG_DEST_SUBSCR_BOX_Copy, \
+ aEXCHG_DEST_SUBSCR_BOX_Link \
+ }, \
+ { EXCHG_DEST_DOC_TEXTFRAME_WEB, \
+ aEXCHG_DEST_DOC_TEXTFRAME_WEB_Def, \
+ aEXCHG_DEST_DOC_TEXTFRAME_WEB_Move, \
+ aEXCHG_DEST_DOC_TEXTFRAME_WEB_Copy, \
+ aEXCHG_DEST_DOC_TEXTFRAME_WEB_Link \
+ }, \
+ { EXCHG_DEST_SWDOC_FREE_AREA_WEB, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Def, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Move, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Copy, \
+ aEXCHG_DEST_SWDOC_FREE_AREA_WEB_Link \
+ }, \
+ { EXCHG_DEST_SFX_GROUPVIEW, \
+ aEXCHG_DEST_GROUPVIEW_Def, \
+ aEXCHG_DEST_GROUPVIEW_Move, \
+ aEXCHG_DEST_GROUPVIEW_Copy, \
+ aEXCHG_DEST_GROUPVIEW_Link \
+ }, \
+ { \
+ 0xffff \
+ } \
+};
+
+static BOOL CheckContext_Impl( const SotDataObject& rData,
+ const SotAction_Impl& rEntry )
+{
+ BOOL bRet = TRUE;
+ switch( rEntry.nFormatId )
+ {
+ case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
+#ifdef WNT
+ switch( rEntry.nContextCheckId )
+ {
+ case FILEGRPDSC_ONLY_URL:
+ {
+ bRet = FALSE;
+ SvData aData( rEntry.nFormatId, MEDIUM_ALL );
+ if( rData.GetTypeList().Get( SOT_FORMATSTR_ID_FILECONTENT ) &&
+ ((SotDataObject&)rData).GetData( &aData ))
+ {
+ // dann als FileGroupDescriptor bereitstellen
+ void *pData;
+ aData.GetData( &pData, TRANSFER_REFERENCE );
+ FILEGROUPDESCRIPTOR* pFDesc = (FILEGROUPDESCRIPTOR*)pData;
+ // read only URL-Files
+ if( pFDesc->cItems )
+ {
+ ByteString sDesc( pFDesc->fgd[0].cFileName );
+ bRet = 4 < sDesc.Len() && sDesc.Copy( sDesc.Len()-4 ).
+ EqualsIgnoreCaseAscii( ".URL" );
+ }
+ }
+ }
+ break;
+ }
+#endif
+ break;
+ }
+ return bRet;
+}
+
+static USHORT GetAction_Impl(const SotDataObject& rData,const SotAction_Impl* pArray,
+ ULONG& rFormat )
+{
+ const SvDataTypeList& rTypeList = rData.GetTypeList();
+ const SotAction_Impl* pArrayStart = pArray;
+ ULONG nId = pArray->nFormatId;
+ while( nId != 0xffff )
+ {
+ rFormat = nId;
+ if( 0 != rTypeList.Get( SotExchange::RegisterSotFormatName( nId ) ) &&
+ ( !pArray->nContextCheckId ||
+ CheckContext_Impl( rData, *pArray ) ))
+ {
+ if( SOT_FORMAT_FILE_LIST == rFormat &&
+ 0 != rTypeList.Get( SotExchange::RegisterSotFormatName(
+ SOT_FORMAT_FILE ) ) )
+ {
+ SvData aData( SOT_FORMAT_FILE_LIST );
+ ((SotDataObject&)rData).GetData( &aData );
+ FileList aFileList;
+ FileList* pFileList = &aFileList;
+ aData.GetData( (SvDataCopyStream**)&pFileList, pFileList->Type() );
+ // FileList mit einem Eintrag matcht auf FORMAT_FILE!
+ if( aFileList.Count() == 1 )
+ {
+ // Eintrag fuer FORMAT_FILE suchen
+ const SotAction_Impl* pCur = pArrayStart;
+ while( pCur->nFormatId != 0xffff )
+ {
+ if( pCur->nFormatId == SOT_FORMAT_FILE )
+ {
+ rFormat = SOT_FORMAT_FILE;
+ return pCur->nAction;
+ }
+ pCur++;
+ }
+ }
+ }
+ return pArray->nAction;
+ }
+ pArray++;
+ nId = pArray->nFormatId;
+ }
+ return EXCHG_INOUT_ACTION_NONE;
+}
+
+USHORT SotExchange::GetExchangeAction(
+ const SotDataObject& rData, USHORT nDestination, USHORT nSourceOptions,
+ USHORT nUserAction, ULONG& rFormat, USHORT& rDefaultAction )
+{
+ // hier wird jetzt die oben definierte Tabelle "implementiert"
+ IMPL_DATA_ARRAY_1;
+ IMPL_DATA_ARRAY_2;
+ IMPL_DATA_ARRAY_3;
+
+ rFormat = SOT_FORMAT_STRING;
+
+ //Todo: Binaere Suche einbauen
+ const SotDestinationEntry_Impl* pEntry = aDestinationArray;
+ while( 0xffff != pEntry->nDestination )
+ {
+ if( pEntry->nDestination == nDestination )
+ break;
+ ++pEntry;
+ }
+
+ if( 0xffff == pEntry->nDestination )
+ {
+ return EXCHG_INOUT_ACTION_NONE;
+ }
+
+ nUserAction &= EXCHG_ACTION_MASK;
+ rFormat = 0;
+
+ /* Behandlung der Default-Action nach folgender Vorgehensweise:
+
+ - Das Ziel wird nach der Default-Action gefragt
+ - Unterstuetzt die Quelle diese Aktion so wird sie uebernommen
+ - Anderenfalls wird aus den von der Quelle zur Verfuegung gestellten
+ Aktionen eine ausgewaehlt, die zu einer moeglichst nicht leeren
+ Ergebnisaktion fuehrt. Hierbei wird in dieser Reihenfolge
+ vorgegangen: Copy -> Link -> Move
+ */
+ if( nUserAction == EXCHG_IN_ACTION_DEFAULT )
+ {
+ nUserAction = GetAction_Impl(rData, pEntry->aDefaultActions,rFormat);
+ // Unterstuetzt die Quelle die Aktion?
+ if( !(nUserAction & nSourceOptions ))
+ {
+ // Nein -> Alle Aktionen der Quelle checken
+ rDefaultAction = (EXCHG_IN_ACTION_COPY & nSourceOptions);
+ if( rDefaultAction && (nUserAction=GetAction_Impl(rData,pEntry->aCopyActions,rFormat)))
+ return nUserAction;
+ rDefaultAction = (EXCHG_IN_ACTION_LINK & nSourceOptions);
+ if( rDefaultAction && (nUserAction=GetAction_Impl(rData,pEntry->aLinkActions,rFormat)))
+ return nUserAction;
+ rDefaultAction = (EXCHG_IN_ACTION_MOVE & nSourceOptions);
+ if( rDefaultAction && (nUserAction=GetAction_Impl(rData,pEntry->aMoveActions,rFormat)))
+ return nUserAction;
+ rDefaultAction = 0;
+ return 0;
+ }
+ rDefaultAction = nUserAction;
+ }
+ else
+ rDefaultAction = nUserAction;
+
+ switch( nUserAction )
+ {
+ case EXCHG_IN_ACTION_MOVE:
+ nUserAction = GetAction_Impl(rData, pEntry->aMoveActions, rFormat);
+ break;
+
+ case EXCHG_IN_ACTION_COPY:
+ nUserAction = GetAction_Impl(rData, pEntry->aCopyActions, rFormat);
+ break;
+
+ case EXCHG_IN_ACTION_LINK:
+ nUserAction = GetAction_Impl(rData, pEntry->aLinkActions, rFormat);
+ break;
+
+ default:
+ nUserAction = EXCHG_INOUT_ACTION_NONE;
+ }
+ return nUserAction;
+}
+
+
+
+#if SUPD <= 397
+
+USHORT SotExchange::GetExchangeAction(
+ const SotDataObject& rData, USHORT nDestination, USHORT nSourceOptions,
+ USHORT nUserAction, ULONG& rFormat, USHORT& rDefaultAction )
+{
+ USHORT nFmt = 0,
+ nRet = GetExchangeAction( rData, nDestination, nSourceOptions,
+ nUserAction, nFmt , rDefaultAction );
+ rFormat = RegisterSotFormatName( nFmt );
+ return nRet;
+}
+
+#endif
+
diff --git a/sot/source/base/makefile.mk b/sot/source/base/makefile.mk
new file mode 100644
index 000000000000..21b3a55f75bb
--- /dev/null
+++ b/sot/source/base/makefile.mk
@@ -0,0 +1,109 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=sot
+TARGET=base
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(COM)"=="GCC"
+NOOPTFILES=\
+ $(SLO)$/dtrans.obj\
+ $(SLO)$/exchange.obj
+.ENDIF
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= factory.cxx \
+ object.cxx \
+ dtrans.cxx \
+ exchange.cxx \
+ filelist.cxx \
+ formats.cxx \
+ $(PROJECTPCHSOURCE).cxx
+
+SLOFILES= \
+ $(SLO)$/factory.obj \
+ $(SLO)$/object.obj \
+ $(SLO)$/dtrans.obj \
+ $(SLO)$/exchange.obj \
+ $(SLO)$/filelist.obj \
+ $(SLO)$/formats.obj
+
+.IF "$(OS)"=="NETBSD"
+SLOFILES += $(SLO)$/netbsd.obj
+.ENDIF
+
+
+# --- Targets -------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx
new file mode 100644
index 000000000000..aa757a6eb364
--- /dev/null
+++ b/sot/source/base/object.cxx
@@ -0,0 +1,510 @@
+/*************************************************************************
+ *
+ * $RCSfile: object.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SOT_OBJECT_CXX
+
+#include <tools/debug.hxx>
+#include <object.hxx>
+#include <factory.hxx>
+#include <agg.hxx>
+#pragma hdrstop
+
+/************** class SvAggregateMemberList *****************************/
+/************************************************************************/
+PRV_SV_IMPL_OWNER_LIST(SvAggregateMemberList,SvAggregate);
+
+/************** class SotObject ******************************************/
+class SotObjectFactory : public SotFactory
+{
+public:
+ TYPEINFO();
+ SotObjectFactory( const SvGlobalName & rName,
+ const String & rClassName,
+ CreateInstanceType pCreateFuncP )
+ : SotFactory( rName, rClassName, pCreateFuncP )
+ {}
+};
+TYPEINIT1(SotObjectFactory,SotFactory);
+
+
+SO2_IMPL_BASIC_CLASS_DLL(SotObject,SotObjectFactory,
+ SvGlobalName( 0xf44b7830, 0xf83c, 0x11d0,
+ 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
+SO2_IMPL_INVARIANT(SotObject)
+
+/*************************************************************************
+|* SotObject::TestMemberObjRef()
+|*
+|* Beschreibung:
+*************************************************************************/
+void SotObject::TestMemberObjRef( BOOL /*bFree*/ )
+{
+}
+
+/*************************************************************************
+|* SotObject::TestMemberObjRef()
+|*
+|* Beschreibung:
+*************************************************************************/
+#ifdef TEST_INVARIANT
+void SotObject::TestMemberInvariant( BOOL /*bPrint*/ )
+{
+}
+#endif
+
+/*************************************************************************
+|* SotObject::SotObject()
+|*
+|* Beschreibung
+*************************************************************************/
+SotObject::SotObject()
+ : nStrongLockCount( 0 )
+ , nOwnerLockCount( 0 )
+ , pAggList ( NULL )
+ , bOwner ( TRUE )
+ , bSVObject ( FALSE )
+ , bInClose ( FALSE )
+{
+ SotFactory::IncSvObjectCount( this );
+}
+
+/*************************************************************************
+|*
+|* SotObject::~SotObject()
+|*
+|* Beschreibung
+|* Ersterstellung MM 05.06.94
+|* Letzte Aenderung MM 05.06.94
+|*
+*************************************************************************/
+SotObject::~SotObject()
+{
+ SotFactory::DecSvObjectCount( this );
+}
+
+/*************************************************************************
+|* SotObject::GetInterface()
+|*
+|* Beschreibung: Um so3 zu helfen
+*************************************************************************/
+IUnknown * SotObject::GetInterface( const SvGlobalName & )
+{
+ return NULL;
+}
+
+/*************************************************************************
+|* SotObject::IsSvClass()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotObject::IsSvObject() const
+{
+ return Owner() || bSVObject;
+}
+
+/*************************************************************************
+|* SotObject::QueryDelete()
+|*
+|* Beschreibung: Bei allen aggregierten Objekte muss der RefCount auf
+|* 0 gehen, damit das Gesammt-Objekt zerstoert wird. Das
+|* zerst”ren von Teilen ist verboten. Da der Aggregator
+|* (oder Cast-Verwalter) den Zaehler der aggregierten
+|* Objekte um 1 erhoeht, muss dies bei der Berechnung
+|* des 0-RefCounts beruecksichtigt werden.
+*************************************************************************/
+BOOL SotObject::ShouldDelete()
+{
+ if( !pAggList )
+ return TRUE;
+
+ SvAggregate & rMO = pAggList->GetObject( 0 );
+ if( rMO.bMainObj )
+ {
+ AddRef();
+ pAggList->GetObject( 0 ).pObj->ReleaseRef();
+ return FALSE;
+ }
+
+ ULONG i;
+ for( i = 1; i < pAggList->Count(); i++ )
+ {
+ SvAggregate & rAgg = pAggList->GetObject( i );
+ // Groesser 1, wegen AddRef() bei AddInterface
+ if( !rAgg.bFactory && rAgg.pObj->GetRefCount() > 1 )
+ {
+ // den eigenen hochzaehelen
+ AddRef();
+ // einen Aggregierten runterzaehlen
+ rAgg.pObj->ReleaseRef();
+ return FALSE;
+ }
+ }
+ AddNextRef(); // rekursion stoppen
+ for( i = pAggList->Count() -1; i > 0; i-- )
+ {
+ // Referenzen aufloesen
+ SvAggregate & rEle = pAggList->GetObject( i );
+ DBG_ASSERT( !rEle.bMainObj, "main object reference is opened" )
+ RemoveInterface( i );
+ }
+ delete pAggList;
+ pAggList = NULL;
+ // und zerstoeren, dies ist unabhaengig vom RefCount
+ return TRUE;
+}
+
+/*************************************************************************
+|* SotObject::QueryDelete()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotObject::QueryDelete()
+{
+ if( ShouldDelete() )
+ SvRefBase::QueryDelete();
+}
+
+
+
+/*************************************************************************
+|* SotObject::GetAggList()
+|*
+|* Beschreibung
+*************************************************************************/
+SvAggregateMemberList & SotObject::GetAggList()
+{
+ if( !pAggList )
+ {
+ pAggList = new SvAggregateMemberList( 2, 1 );
+ pAggList->Append( SvAggregate() );
+ }
+ return *pAggList;
+}
+
+
+/*************************************************************************
+|* SotObject::RemoveInterface()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotObject::RemoveInterface( ULONG nPos )
+{
+ SvAggregate & rAgg = pAggList->GetObject( nPos );
+ if( !rAgg.bFactory )
+ {
+ DBG_ASSERT( rAgg.pObj->pAggList, "no aggregation list" )
+ DBG_ASSERT( rAgg.pObj->pAggList->GetObject( 0 ).pObj == this,
+ "not owner of aggregated object" )
+ // sich selbst als Cast-Verwalter austragen
+ rAgg.pObj->pAggList->GetObject( 0 ) = SvAggregate();
+ // Referenz aufloesen
+ rAgg.pObj->ReleaseRef();
+ // Aus der eigenen List austragen
+ pAggList->Remove( nPos );
+ }
+}
+
+/*************************************************************************
+|* SotObject::RemoveInterface()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotObject::RemoveInterface( SotObject * pObjP )
+{
+ DBG_ASSERT( pObjP, "null pointer" )
+ DBG_ASSERT( pAggList, "no aggregation list" )
+ for( ULONG i = 0; i < pAggList->Count(); i++ )
+ {
+ SvAggregate & rAgg = pAggList->GetObject( i );
+ if( !rAgg.bFactory && pObjP == rAgg.pObj )
+ RemoveInterface( i );
+ }
+ DBG_ASSERT( i < pAggList->Count(), "object not found" )
+}
+
+/*************************************************************************
+|* SotObject::AddInterface()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotObject::AddInterface( SotObject * pObjP )
+{
+ pObjP->AddRef(); // Objekt festhalten
+ GetAggList();
+ pAggList->Append( SvAggregate( pObjP, FALSE ) );
+
+ // sich selbst als Typecast-Verwalter eintragen
+ SvAggregateMemberList & rAList = pObjP->GetAggList();
+ DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" )
+ rAList[ 0 ] = SvAggregate( this, TRUE );
+}
+
+/*************************************************************************
+|* SotObject::AddInterface()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotObject::AddInterface( SotFactory * pFactP )
+{
+ GetAggList();
+ pAggList->Append( SvAggregate( pFactP ) );
+}
+
+/*************************************************************************
+|* SotObject::CreateAggObj()
+|*
+|* Beschreibung
+*************************************************************************/
+SotObjectRef SotObject::CreateAggObj( const SotFactory * )
+{
+ return SotObjectRef();
+}
+
+
+/*************************************************************************
+|* SotObject::DownAggCast()
+|*
+|* Beschreibung
+*************************************************************************/
+void * SotObject::DownAggCast( const SotFactory * pFact )
+{
+ void * pCast = NULL;
+ // geht den Pfad nur Richtung aggregierte Objekte
+ if( pAggList )
+ {
+ for( ULONG i = 1; !pCast || i < pAggList->Count(); i++ )
+ {
+ SvAggregate & rAgg = pAggList->GetObject( i );
+ if( rAgg.bFactory )
+ {
+ if( rAgg.pFact->Is( pFact ) )
+ {
+ // On-Demand erzeugen, wenn Typ gebraucht
+ SotObjectRef aObj( CreateAggObj( rAgg.pFact ) );
+ rAgg.bFactory = FALSE;
+ rAgg.pObj = aObj;
+ rAgg.pObj->AddRef();
+
+ // sich selbst als Typecast-Verwalter eintragen
+ SvAggregateMemberList & rAList = rAgg.pObj->GetAggList();
+ DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" )
+ rAList[ 0 ] = SvAggregate( this, TRUE );
+ }
+ }
+ if( !rAgg.bFactory )
+ {
+ // muss der (void *) auf Klasse pFact sein
+ pCast = rAgg.pObj->Cast( pFact );
+ if( !pCast )
+ pCast = rAgg.pObj->DownAggCast( pFact );
+ if( pCast )
+ break;
+ }
+ }
+ }
+ return pCast;
+}
+
+/*************************************************************************
+|* SotObject::AggCast()
+|*
+|* Beschreibung
+*************************************************************************/
+void * SotObject::AggCast( const SotFactory * pFact )
+{
+ void * pCast = NULL;
+ if( pAggList )
+ {
+ SvAggregate & rAgg = pAggList->GetObject( 0 );
+ if( rAgg.bMainObj )
+ return rAgg.pObj->AggCast( pFact );
+ pCast = Cast( pFact );
+ if( !pCast )
+ pCast = DownAggCast( pFact );
+ }
+ else
+ pCast = Cast( pFact );
+ return pCast;
+}
+
+/*************************************************************************
+|* SotObject::CastAndAddRef()
+|*
+|* Beschreibung
+*************************************************************************/
+void * SotObject::CastAndAddRef( const SotFactory * pFact )
+{
+ void * pCast = Cast( pFact );
+ if( pCast )
+ AddRef();
+ return pCast;
+}
+
+/*************************************************************************
+|* SotObject::GetMainObj()
+|*
+|* Beschreibung
+*************************************************************************/
+SotObject * SotObject::GetMainObj() const
+{
+ if( pAggList )
+ {
+ if( pAggList->GetObject( 0 ).bMainObj )
+ return pAggList->GetObject( 0 ).pObj->GetMainObj();
+ }
+ return (SotObject *)this;
+}
+
+//=========================================================================
+USHORT SotObject::FuzzyLock
+(
+ BOOL bLock, /* TRUE, lock. FALSE, unlock. */
+ BOOL bIntern, /* TRUE, es handelt sich um einen internen Lock.
+ FALSE, der Lock kam von aussen (Ole2, Ipc2) */
+ BOOL bClose /* TRUE, Close aufrufen wenn letzte Lock */
+)
+/* [Beschreibung]
+
+ Erlaubte Parameterkombinationen:
+ ( TRUE, TRUE, * ) -> interner Lock.
+ ( FALSE, TRUE, TRUE ) -> interner Unlock mit Close,
+ wenn LockCount() == 0
+ ( TRUE, FALSE, * ) -> externer Lock.
+ ( FALSE, FALSE, TRUE ) -> externer Unlock mit Close,
+ wenn LockCount() == 0
+ ( FALSE, FALSE, FALSE ) -> externer Unlock
+
+ F"ur !Owner() wird der Aufruf an das externe Objekt weitergeleitet.
+ F"ur diese muss das <IOleItemContainer>-Interface zur Vef"ugung stehen.
+ bIntern und bClose werden dann ignoriert.
+ Wenn der LockCount auf 0 wechselt, wird <SotObject::DoClose>
+ gerufen, wenn kein OwnerLock besteht.
+
+ [Anmerkung]
+
+*/
+{
+ SotObjectRef xHoldAlive( this );
+ USHORT nRet;
+ if( bLock )
+ {
+ AddRef();
+ nRet = ++nStrongLockCount;
+ }
+ else
+ {
+ nRet = --nStrongLockCount;
+ ReleaseRef();
+ }
+
+ if( !nRet && bClose && !nOwnerLockCount )
+ DoClose();
+ return nRet;
+}
+
+//=========================================================================
+void SotObject::OwnerLock
+(
+ BOOL bLock /* TRUE, lock. FALSE, unlock. */
+)
+/* [Beschreibung]
+
+ Wenn der OwnerLock auf Null dekrementiert, dann wird die Methode
+ DoClose gerufen. Dies geschieht unabh"angig vom Lock. bzw. RefCount.
+ Ist der OwnerLock-Z"ahler != Null, dann wird kein DoClose durch
+ <SotObject::FuzzyLock> gerufen.
+*/
+{
+ if( bLock )
+ {
+ nOwnerLockCount++;
+ AddRef();
+ }
+ else
+ {
+ if( 0 == --nOwnerLockCount )
+ DoClose();
+ ReleaseRef();
+ }
+}
+
+//=========================================================================
+BOOL SotObject::DoClose()
+{
+ BOOL bRet = FALSE;
+ if( !bInClose )
+ {
+ SotObjectRef xHoldAlive( this );
+ bInClose = TRUE;
+ bRet = Close();
+ bInClose = FALSE;
+ }
+ return bRet;
+}
+
+//=========================================================================
+BOOL SotObject::Close()
+{
+ return TRUE;
+}
+
+
+
diff --git a/sot/source/sdstor/makefile.mk b/sot/source/sdstor/makefile.mk
new file mode 100644
index 000000000000..47f2e4fa9815
--- /dev/null
+++ b/sot/source/sdstor/makefile.mk
@@ -0,0 +1,114 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=sot
+TARGET=sdstor
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ stg.cxx \
+ stgcache.cxx \
+ stgstrms.cxx \
+ stgelem.cxx \
+ stgio.cxx \
+ stgole.cxx \
+ stgdir.cxx \
+ stgavl.cxx \
+ storinfo.cxx \
+ storage.cxx \
+ $(PROJECTPCHSOURCE).cxx
+
+SLOFILES = \
+ $(SLO)$/stg.obj \
+ $(SLO)$/stgcache.obj \
+ $(SLO)$/stgstrms.obj \
+ $(SLO)$/stgelem.obj \
+ $(SLO)$/stgio.obj \
+ $(SLO)$/stgole.obj \
+ $(SLO)$/stgdir.obj \
+ $(SLO)$/stgavl.obj \
+ $(SLO)$/storinfo.obj \
+ $(SLO)$/storage.obj
+
+# NETBSD: somewhere we have to instantiate the static data members.
+# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work.
+# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX"
+SLOFILES+=$(SLO)$/staticmb.obj
+.ENDIF
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/sot/source/sdstor/sdintern.hdb b/sot/source/sdstor/sdintern.hdb
new file mode 100644
index 000000000000..4dfbc69be013
--- /dev/null
+++ b/sot/source/sdstor/sdintern.hdb
@@ -0,0 +1,22 @@
+write "/*************************************************************************"
+write "* SDINTERN.HXX"
+write "* __DATE__"
+write "* (c) 1992-1995 STAR DIVISION"
+write "*************************************************************************/"
+write "#ifndef _SDINTERN_HXX"
+write "#define _SDINTERN_HXX"
+write "#ifndef _SOLAR_H"
+write "#include <tools/solar.h>"
+write "#endif"
+write "#ifndef _STREAM_HXX"
+write "#include <tools/stream.hxx>"
+write "#endif"
+file stg.hxx
+file stgelem.hxx
+file stgcache.hxx
+file stgio.hxx
+file stgstrms.hxx
+file stgavl.hxx
+file stgdir.hxx
+write "#endif"
+
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
new file mode 100644
index 000000000000..4696b6a8c4d6
--- /dev/null
+++ b/sot/source/sdstor/stg.cxx
@@ -0,0 +1,925 @@
+/*************************************************************************
+ *
+ * $RCSfile: stg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <storinfo.hxx>
+#ifndef _TOOLS_OWNLIST_HXX
+#include <tools/ownlist.hxx>
+#endif
+#ifndef _TOOLS_STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _TOOLS_FSYS_HXX
+#include <tools/fsys.hxx>
+#endif
+#ifndef _TOOLS_STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#include <tools/pstm.hxx>
+#include <tools/debug.hxx>
+
+#include "stg.hxx"
+#include "stgelem.hxx"
+#include "stgcache.hxx"
+#include "stgstrms.hxx"
+#include "stgdir.hxx"
+#include "stgio.hxx"
+#include "stgole.hxx"
+#pragma hdrstop
+
+static long nTmpCount = 0;
+
+// The internal open mode is STREAM_READ | STREAM_TRUNC, which is silly
+// by itself. It inhibits the checking of sharing modes and is used
+// during CopyTo() and MoveTo() for opening a stream in read mode
+// although it may be open in DENYALL mode
+
+#define INTERNAL_MODE ( STREAM_READ | STREAM_TRUNC )
+
+///////////////////////// class StorageBase //////////////////////////////
+
+StorageBase::StorageBase( StgIo* p, StgDirEntry* pe )
+ : bAutoCommit( FALSE ), pIo( p ), pEntry( pe )
+{
+ nMode = STREAM_READ;
+ nError = SVSTREAM_OK;
+ p->IncRef();
+ if( pe )
+ pe->nRefCnt++;
+}
+
+StorageBase::~StorageBase()
+{
+ if( pEntry )
+ {
+ DBG_ASSERT( pEntry->nRefCnt, "RefCount unter 0" );
+ if( !--pEntry->nRefCnt )
+ {
+ if( pEntry->bZombie )
+ delete pEntry;
+ else
+ pEntry->Close();
+ }
+ }
+
+
+ if( !pIo->DecRef() )
+ delete pIo;
+}
+
+// Validate the instance for I/O
+
+BOOL StorageBase::Validate( BOOL bWrite ) const
+{
+ if( pEntry
+ && !pEntry->bInvalid
+ && ( !bWrite || !pEntry->bDirect || ( nMode & STREAM_WRITE ) ) )
+ return TRUE;
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+}
+
+// Check the given share flags against the current flags
+
+BOOL StorageBase::ValidateMode( StreamMode m, StgDirEntry* p ) const
+{
+ if( m == INTERNAL_MODE )
+ return TRUE;
+ USHORT nCurMode = ( p && p->nRefCnt ) ? p->nMode : 0xFFFF;
+ if( ( m & 3 ) == STREAM_READ )
+ {
+ // only SHARE_DENYWRITE or SHARE_DENYALL allowed
+ if( ( ( m & STREAM_SHARE_DENYWRITE )
+ && ( nCurMode & STREAM_SHARE_DENYWRITE ) )
+ || ( ( m & STREAM_SHARE_DENYALL )
+ && ( nCurMode & STREAM_SHARE_DENYALL ) ) )
+ return TRUE;
+ }
+ else
+ {
+ // only SHARE_DENYALL allowed
+ // storages open in r/o mode are OK, since only
+ // the commit may fail
+ if( ( m & STREAM_SHARE_DENYALL )
+ && ( nCurMode & STREAM_SHARE_DENYALL ) )
+ return TRUE;
+ }
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+}
+
+// The following three methods are declared as const, since they
+// may be called from within a const method.
+
+ULONG StorageBase::GetError() const
+{
+ ULONG n = nError;
+ ((StorageBase*) this)->nError = SVSTREAM_OK;
+ return n;
+}
+
+void StorageBase::SetError( ULONG n ) const
+{
+ if( !nError )
+ ((StorageBase*) this)->nError = n;
+}
+
+void StorageBase::ResetError() const
+{
+ ((StorageBase*) this)->nError = SVSTREAM_OK;
+}
+
+// Retrieve the underlying SvStream for info purposes
+
+const SvStream* StorageBase::GetSvStream() const
+{
+ return pIo ? pIo->GetStrm() : NULL;
+}
+
+//////////////////////// class StorageStream /////////////////////////////
+
+StorageStream::StorageStream( StgIo* p, StgDirEntry* q, StreamMode m )
+ : StorageBase( p, q ), nPos( 0L )
+{
+ // The dir entry may be 0; this means that the stream is invalid.
+ if( q )
+ {
+ if( q->nRefCnt == 1 )
+ {
+ q->nMode = m;
+ q->OpenStream( *p );
+ }
+ }
+ else
+ m &= ~STREAM_READWRITE;
+ nMode = m;
+}
+
+StorageStream::~StorageStream()
+{
+ // Do an auto-commit if the entry is open in direct mode
+ if( bAutoCommit )
+ Commit();
+ if( pEntry && pEntry->nRefCnt && pEntry->bDirect && (nMode & STREAM_WRITE) )
+ pEntry->Commit();
+}
+
+ULONG StorageStream::Read( void* pData, ULONG nSize )
+{
+ if( Validate() )
+ {
+ pEntry->Seek( nPos );
+ nSize = pEntry->Read( pData, (INT32) nSize );
+ pIo->MoveError( *this );
+ nPos += nSize;
+ }
+ else
+ nSize = 0L;
+ return nSize;
+}
+
+ULONG StorageStream::Write( const void* pData, ULONG nSize )
+{
+ if( Validate( TRUE ) )
+ {
+ pEntry->Seek( nPos );
+ nSize = pEntry->Write( pData, (INT32) nSize );
+ pIo->MoveError( *this );
+ nPos += nSize;
+ }
+ else
+ nSize = 0L;
+ return nSize;
+}
+
+ULONG StorageStream::Seek( ULONG n )
+{
+ if( Validate() )
+ return nPos = pEntry->Seek( n );
+ else
+ return n;
+}
+
+void StorageStream::Flush()
+{
+ // Flushing means committing, since streams are never transacted
+ Commit();
+}
+
+BOOL StorageStream::SetSize( ULONG nNewSize )
+{
+ if( Validate( TRUE ) )
+ {
+ BOOL b = pEntry->SetSize( (INT32) nNewSize );
+ pIo->MoveError( *this );
+ return b;
+ }
+ else
+ return FALSE;
+}
+
+BOOL StorageStream::Commit()
+{
+ if( !Validate() )
+ return FALSE;
+ if( !( nMode & STREAM_WRITE ) )
+ {
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+ }
+ else
+ {
+ pEntry->Commit();
+ pIo->MoveError( *this );
+ return Good();
+ }
+}
+
+BOOL StorageStream::Revert()
+{
+ pEntry->Revert();
+ pIo->MoveError( *this );
+ return Good();
+}
+
+BOOL StorageStream::CopyTo( StorageStream* pDest )
+{
+ if( !Validate() || !pDest->Validate( TRUE ) || pEntry == pDest->pEntry )
+ return FALSE;
+ pEntry->Copy( *pDest->pEntry );
+ pDest->Commit();
+ pIo->MoveError( *this );
+ SetError( pDest->GetError() );
+ return BOOL( Good() && pDest->Good() );
+}
+
+///////////////////////// class SvStorageInfo //////////////////////////////
+
+SvStorageInfo::SvStorageInfo( const StgDirEntry& rE )
+{
+ rE.aEntry.GetName( aName );
+ bStorage = BOOL( rE.aEntry.GetType() == STG_STORAGE );
+ bStream = BOOL( rE.aEntry.GetType() == STG_STREAM );
+ nSize = bStorage ? 0 : rE.aEntry.GetSize();
+}
+
+/////////////////////////// class Storage ////////////////////////////////
+
+BOOL Storage::IsStorageFile( const String & rFileName )
+{
+ StgIo aIo;
+ if( aIo.Open( rFileName, STREAM_STD_READ ) )
+ return aIo.Load();
+ return FALSE;
+}
+
+// Open the storage file. If writing is permitted and the file is not
+// a storage file, initialize it.
+
+Storage::Storage( const String& rFile, StreamMode m, BOOL bDirect )
+ : StorageBase( new StgIo, NULL ), aName( rFile ), bIsRoot( FALSE )
+{
+ BOOL bTemp = FALSE;
+ if( !aName.Len() )
+ {
+ // no name = temporary name!
+ DirEntry aEntry;
+ aName = aEntry.TempName().GetFull();
+ bTemp = TRUE;
+ }
+ // the root storage creates the I/O system
+ nMode = m;
+ if( pIo->Open( aName, m ) )
+ {
+ Init( BOOL( ( m & ( STREAM_TRUNC | STREAM_NOCREATE ) ) == STREAM_TRUNC ) );
+ if( pEntry )
+ {
+ pEntry->bDirect = bDirect;
+ pEntry->nMode = m;
+ pEntry->bTemp = bTemp;
+ }
+ }
+ else
+ {
+ pIo->MoveError( *this );
+ pEntry = NULL;
+ }
+}
+
+// Create a storage on a given stream.
+
+Storage::Storage( SvStream& r, BOOL bDirect )
+ : StorageBase( new StgIo, NULL ), bIsRoot( FALSE )
+{
+ nMode = STREAM_READ;
+ if( r.IsWritable() )
+ nMode = STREAM_READ | STREAM_WRITE;
+ if( r.GetError() == SVSTREAM_OK )
+ {
+ pIo->SetStrm( &r, FALSE );
+ ULONG nSize = r.Seek( STREAM_SEEK_TO_END );
+ r.Seek( 0L );
+ // Initializing is OK if the stream is empty
+ Init( BOOL( nSize == 0 ) );
+ if( pEntry )
+ {
+ pEntry->bDirect = bDirect;
+ pEntry->nMode = nMode;
+ }
+ pIo->MoveError( *this );
+ }
+ else
+ {
+ SetError( r.GetError() );
+ pEntry = NULL;
+ }
+}
+
+// Perform common code for both ctors above.
+
+void Storage::Init( BOOL bCreate )
+{
+ pEntry = NULL;
+ BOOL bHdrLoaded = FALSE;
+ bIsRoot = TRUE;
+ if( pIo->Good() )
+ {
+ ULONG nSize = pIo->GetStrm()->Seek( STREAM_SEEK_TO_END );
+ pIo->GetStrm()->Seek( 0L );
+ if( nSize )
+ {
+ bHdrLoaded = pIo->Load();
+ if( !bHdrLoaded && !bCreate )
+ {
+ // File is not a storage and not empty; do not destroy!
+ SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return;
+ }
+ }
+ }
+ // file is a storage, empty or should be overwritten
+ pIo->ResetError();
+ // we have to set up the data structures, since
+ // the file is empty
+ if( !bHdrLoaded )
+ pIo->Init();
+ if( pIo->Good() )
+ {
+ pEntry = pIo->pTOC->GetRoot();
+ pEntry->nRefCnt++;
+ }
+}
+
+// Internal ctor
+
+Storage::Storage( StgIo* p, StgDirEntry* q, StreamMode m )
+ : StorageBase( p, q ), bIsRoot( FALSE )
+{
+ if( q )
+ q->aEntry.GetName( aName );
+ else
+ m &= ~STREAM_READWRITE;
+ bIsRoot = FALSE;
+ nMode = m;
+ if( q && q->nRefCnt == 1 )
+ q->nMode = m;
+}
+
+Storage::~Storage()
+{
+ // Invalidate all open substorages
+ if( bAutoCommit )
+ Commit();
+ if( pEntry )
+ {
+ // Do an auto-commit if the entry is open in direct mode
+ if( pEntry->nRefCnt && pEntry->bDirect && (nMode & STREAM_WRITE) )
+ Commit();
+ if( pEntry->nRefCnt == 1 )
+ pEntry->Invalidate();
+ }
+ // close the stream is root storage
+ if( bIsRoot )
+ pIo->Close();
+ // remove the file if temporary root storage
+ if( bIsRoot && pEntry && pEntry->bTemp )
+ {
+ DirEntry aEntry( GetName() );
+ FSysError nErr = aEntry.Kill();
+ DBG_ASSERT( nErr == FSYS_ERR_OK, "cannot delete temp-file" )
+ }
+}
+
+const String& Storage::GetName() const
+{
+ if( !bIsRoot && Validate() )
+ pEntry->aEntry.GetName( ((Storage*) this)->aName );
+ return aName;
+}
+
+// Fill in the info list for this storage
+
+void Storage::FillInfoList( SvStorageInfoList* pList ) const
+{
+ if( Validate() )
+ {
+ StgIterator aIter( *pEntry );
+ StgDirEntry* p = aIter.First();
+ while( p )
+ {
+ if( !p->bInvalid )
+ {
+ SvStorageInfo aInfo( *p );
+ pList->Append( aInfo );
+ }
+ p = aIter.Next();
+ }
+ }
+}
+
+// Open or create a substorage
+
+Storage* Storage::OpenStorage( const String& rName, StreamMode m, BOOL bDirect )
+{
+ if( !Validate() || !ValidateMode( m, NULL ) )
+ return new Storage( pIo, NULL, m );
+ BOOL bSetAutoCommit = FALSE;
+ if( bDirect && !pEntry->bDirect )
+ {
+ bSetAutoCommit = TRUE;
+ bDirect = FALSE;
+ }
+
+ StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
+ if( !p )
+ {
+ if( !( m & STREAM_NOCREATE ) )
+ {
+ BOOL bTemp = FALSE;
+ // create a new storage
+ String aNewName = rName;
+ if( !aNewName.Len() )
+ {
+ aNewName.AssignAscii( "Temp Stg " );
+ aNewName.Append( String::CreateFromInt32( ++nTmpCount ) );
+ bTemp = TRUE;
+ }
+ p = pIo->pTOC->Create( *pEntry, aNewName, STG_STORAGE );
+ if( p )
+ p->bTemp = bTemp;
+ }
+ if( !p )
+ pIo->SetError( ( m & STREAM_WRITE )
+ ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND );
+ }
+ else if( !ValidateMode( m, p ) )
+ p = NULL;
+ if( p && p->aEntry.GetType() != STG_STORAGE )
+ {
+ pIo->SetError( SVSTREAM_FILE_NOT_FOUND );
+ p = NULL;
+ }
+ // Dont check direct conflict if opening readonly
+ if( p && (m & STREAM_WRITE ))
+ {
+ // Either direct or transacted mode is supported
+ if( pEntry->nRefCnt == 1 )
+ p->bDirect = bDirect;
+ if( p->bDirect != bDirect )
+ SetError( SVSTREAM_ACCESS_DENIED );
+ }
+ Storage* pStg = new Storage( pIo, p, m );
+ pIo->MoveError( *pStg );
+ if( m & STREAM_WRITE ) pStg->bAutoCommit = TRUE;
+ return pStg;
+}
+
+// Open a stream
+
+StorageStream* Storage::OpenStream( const String& rName, StreamMode m, BOOL )
+{
+ if( !Validate() || !ValidateMode( m, NULL ) )
+ return new StorageStream( pIo, NULL, m );
+ StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
+ BOOL bTemp = FALSE;
+ if( !p )
+ {
+ if( !( m & STREAM_NOCREATE ) )
+ {
+ // create a new stream
+ // make a name if the stream is temporary (has no name)
+ String aNewName( rName );
+ if( !aNewName.Len() )
+ {
+ aNewName.AssignAscii( "Temp Strm " );
+ aNewName.Append( String::CreateFromInt32( ++nTmpCount ) );
+ bTemp = TRUE;
+ }
+ p = pIo->pTOC->Create( *pEntry, aNewName, STG_STREAM );
+ }
+ if( !p )
+ pIo->SetError( ( m & STREAM_WRITE )
+ ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND );
+ }
+ else if( !ValidateMode( m, p ) )
+ p = NULL;
+ if( p && p->aEntry.GetType() != STG_STREAM )
+ {
+ pIo->SetError( SVSTREAM_FILE_NOT_FOUND );
+ p = NULL;
+ }
+ if( p )
+ {
+ p->bTemp = bTemp;
+ p->bDirect = pEntry->bDirect;
+ }
+ StorageStream* pStm = new StorageStream( pIo, p, m );
+ if( p && !p->bDirect )
+ pStm->bAutoCommit = TRUE;
+ pIo->MoveError( *pStm );
+ return pStm;
+}
+
+// Delete a stream or substorage by setting the temp bit.
+
+BOOL Storage::Remove( const String& rName )
+{
+ if( !Validate( TRUE ) )
+ return FALSE;
+ StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
+ if( p )
+ {
+ p->Invalidate( TRUE );
+ return TRUE;
+ }
+ else
+ {
+ SetError( SVSTREAM_FILE_NOT_FOUND );
+ return FALSE;
+ }
+}
+
+// Rename a storage element
+
+BOOL Storage::Rename( const String& rOld, const String& rNew )
+{
+ if( Validate( TRUE ) )
+ {
+ BOOL b = pIo->pTOC->Rename( *pEntry, rOld, rNew );
+ pIo->MoveError( *this );
+ return b;
+ }
+ else
+ return FALSE;
+}
+
+// Copy one element
+
+BOOL Storage::CopyTo( const String& rElem, Storage* pDest, const String& rNew )
+{
+ if( !Validate() || !pDest || !pDest->Validate( TRUE ) )
+ return FALSE;
+ StgDirEntry* pElem = pIo->pTOC->Find( *pEntry, rElem );
+ if( pElem )
+ {
+ /*
+ this lines are misterious !!! MM
+ if( !pElem->IsContained( pDest->pEntry ) )
+ {
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+ }
+ */
+ if( pElem->aEntry.GetType() == STG_STORAGE )
+ {
+ // copy the entire storage
+ Storage* p1 = OpenStorage( rElem, INTERNAL_MODE );
+ Storage* p2 = pDest->OpenStorage
+ ( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pEntry->bDirect );
+ p2->pEntry->aEntry.SetClassId( p1->pEntry->aEntry.GetClassId() );
+ p1->CopyTo( p2 );
+ SetError( p1->GetError() );
+ if( p2->GetError() )
+ pDest->SetError( p2->GetError() );
+ else
+ p2->Commit();
+ delete p1;
+ delete p2;
+ return BOOL( Good() && pDest->Good() );
+ }
+ else
+ {
+ // stream copy
+ StorageStream* p1 = OpenStream( rElem, INTERNAL_MODE );
+ StorageStream* p2 = pDest->OpenStream
+ ( rNew, STREAM_WRITE | STREAM_SHARE_DENYALL, pEntry->bDirect );
+ p1->CopyTo( p2 );
+ SetError( p1->GetError() );
+ if( p2->GetError() )
+ pDest->SetError( p2->GetError() );
+ else
+ p2->Commit();
+ delete p1;
+ delete p2;
+ return BOOL( Good() && pDest->Good() );
+ }
+ }
+ SetError( SVSTREAM_FILE_NOT_FOUND );
+ return FALSE;
+}
+
+BOOL Storage::CopyTo( Storage* pDest ) const
+{
+ if( !Validate() || !pDest || !pDest->Validate( TRUE )
+ || pDest->pEntry == pEntry )
+ {
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+ }
+ Storage* pThis = (Storage*) this;
+ /*
+ if( !pThis->pEntry->IsContained( pDest->pEntry ) )
+ {
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+ }
+ */
+ pDest->pEntry->aEntry.SetClassId( pEntry->aEntry.GetClassId() );
+ pDest->pEntry->SetDirty();
+ SvStorageInfoList aList;
+ FillInfoList( &aList );
+ BOOL bRes = TRUE;
+ for( USHORT i = 0; i < aList.Count() && bRes; i++ )
+ {
+ SvStorageInfo& rInfo = aList.GetObject( i );
+ bRes = pThis->CopyTo( rInfo.GetName(), pDest, rInfo.GetName() );
+ }
+ if( !bRes )
+ SetError( pDest->GetError() );
+ return BOOL( Good() && pDest->Good() );
+}
+
+// Move one element
+
+BOOL Storage::MoveTo( const String& rElem, Storage* pDest, const String& rNew )
+{
+ if( !Validate() || !pDest || !pDest->Validate( TRUE )
+ || pDest->pEntry == pEntry )
+ {
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+ }
+ StgDirEntry* pElem = pIo->pTOC->Find( *pEntry, rElem );
+ if( pElem )
+ {
+ // Simplest case: both storages share the same file
+ BOOL bRes;
+ if( pIo == pDest->pIo && rElem == rNew )
+ {
+ if( !pElem->IsContained( pDest->pEntry ) )
+ {
+ // cyclic move
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+ }
+ bRes = pIo->pTOC->Move( *pEntry, *pDest->pEntry, rNew );
+ if( !bRes )
+ {
+ pIo->MoveError( *this );
+ pDest->pIo->MoveError( *pDest );
+ ULONG nErr = GetError();
+ if( !nErr )
+ nErr = pDest->GetError();
+ SetError( nErr );
+ pDest->SetError( nErr );
+ }
+ }
+ else
+ {
+ bRes = CopyTo( rElem, pDest, rNew );
+ if( bRes )
+ bRes = Remove( rElem );
+ }
+ if( !bRes )
+ SetError( pIo->GetError() );
+ return bRes;
+ }
+ SetError( SVSTREAM_FILE_NOT_FOUND );
+ return FALSE;
+}
+
+BOOL Storage::IsStorage( const String& rName ) const
+{
+ if( Validate() )
+ {
+ StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
+ if( p )
+ return BOOL( p->aEntry.GetType() == STG_STORAGE );
+ }
+ return FALSE;
+}
+
+BOOL Storage::IsStream( const String& rName ) const
+{
+ if( Validate() )
+ {
+ StgDirEntry* p = pIo->pTOC->Find( *pEntry, rName );
+ if( p )
+ return BOOL( p->aEntry.GetType() == STG_STREAM );
+ }
+ return FALSE;
+}
+
+BOOL Storage::IsContained( const String& rName ) const
+{
+ if( Validate() )
+ return BOOL( pIo->pTOC->Find( *pEntry, rName ) != NULL );
+ else
+ return FALSE;
+}
+
+// Commit all sub-elements within this storage. If this is
+// the root, commit the FAT, the TOC and the header as well.
+
+BOOL Storage::Commit()
+{
+ BOOL bRes = TRUE;
+ if( !Validate() )
+ return FALSE;
+ if( !( nMode & STREAM_WRITE ) )
+ {
+ SetError( SVSTREAM_ACCESS_DENIED );
+ return FALSE;
+ }
+ else
+ {
+ // Also commit the sub-streams and Storages
+ StgIterator aIter( *pEntry );
+ for( StgDirEntry* p = aIter.First(); p && bRes; p = aIter.Next() )
+ bRes = p->Commit();
+ if( bRes && bIsRoot )
+ {
+ bRes = pEntry->Commit();
+ if( bRes )
+ bRes = pIo->CommitAll();
+ }
+ pIo->MoveError( *this );
+ }
+ return bRes;
+}
+
+BOOL Storage::Revert()
+{
+ return TRUE;
+}
+
+///////////////////////////// OLE Support ////////////////////////////////
+
+// Set the storage type
+
+void Storage::SetClass( const SvGlobalName & rClass,
+ ULONG nOriginalClipFormat,
+ const String & rUserTypeName )
+{
+ if( Validate( TRUE ) )
+ {
+ // set the class name in the root entry
+ pEntry->aEntry.SetClassId( (const ClsId&) rClass.GetCLSID() );
+ pEntry->SetDirty();
+ // then create the streams
+ StgCompObjStream aCompObj( *this, TRUE );
+ aCompObj.GetClsId() = (const ClsId&) rClass.GetCLSID();
+ aCompObj.GetCbFormat() = nOriginalClipFormat;
+ aCompObj.GetUserName() = rUserTypeName;
+ if( !aCompObj.Store() )
+ SetError( aCompObj.GetError() );
+ else
+ {
+ StgOleStream aOle( *this, STREAM_WRITE );
+ if( !aOle.Store() )
+ SetError( aOle.GetError() );
+ }
+ }
+ else
+ SetError( SVSTREAM_ACCESS_DENIED );
+}
+
+void Storage::SetConvertClass( const SvGlobalName & rConvertClass,
+ ULONG nOriginalClipFormat,
+ const String & rUserTypeName )
+{
+ if( Validate( TRUE ) )
+ {
+ SetClass( rConvertClass, nOriginalClipFormat, rUserTypeName );
+ // plus the convert flag:
+ StgOleStream aOle( *this, TRUE );
+ aOle.GetFlags() |= 4;
+ if( !aOle.Store() )
+ SetError( aOle.GetError() );
+ }
+}
+
+SvGlobalName Storage::GetClassName()
+{
+ StgCompObjStream aCompObj( *this, FALSE );
+ if( aCompObj.Load() )
+ return SvGlobalName( (const CLSID&) aCompObj.GetClsId() );
+ pIo->ResetError();
+ return SvGlobalName();
+}
+
+ULONG Storage::GetFormat()
+{
+ StgCompObjStream aCompObj( *this, FALSE );
+ if( aCompObj.Load() )
+ return aCompObj.GetCbFormat();
+ pIo->ResetError();
+ return 0;
+}
+
+String Storage::GetUserName()
+{
+ StgCompObjStream aCompObj( *this, FALSE );
+ if( aCompObj.Load() )
+ return aCompObj.GetUserName();
+ pIo->ResetError();
+ return String();
+}
+
+BOOL Storage::ShouldConvert()
+{
+ StgOleStream aOle( *this, FALSE );
+ if( aOle.Load() )
+ return BOOL( ( aOle.GetFlags() & 4 ) != 0 );
+ else
+ {
+ pIo->ResetError();
+ return FALSE;
+ }
+}
+
+BOOL Storage::ValidateFAT()
+{
+ Link aLink = StgIo::GetErrorLink();
+ ErrCode nErr = pIo->ValidateFATs();
+ StgIo::SetErrorLink( aLink );
+ return nErr == ERRCODE_NONE;
+}
+
diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx
new file mode 100644
index 000000000000..bd78852eb8e2
--- /dev/null
+++ b/sot/source/sdstor/stgavl.cxx
@@ -0,0 +1,451 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgavl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include "stgavl.hxx"
+#pragma hdrstop
+
+StgAvlNode::StgAvlNode()
+{
+ pLeft = pRight = NULL;
+ nBalance = nId = 0;
+}
+
+StgAvlNode::~StgAvlNode()
+{
+ delete pLeft;
+ delete pRight;
+}
+
+StgAvlNode* StgAvlNode::Find( StgAvlNode* pFind )
+{
+ StgAvlNode* p = this;
+ while( p )
+ {
+ short nRes = p->Compare( pFind );
+ if( !nRes )
+ return p;
+ else p = ( nRes < 0 ) ? p->pLeft : p->pRight;
+ }
+ return NULL;
+}
+
+// find point to add node to AVL tree and returns
+// +/0/- for >/=/< previous
+
+short StgAvlNode::Locate
+ ( StgAvlNode* pFind,
+ StgAvlNode** pPivot, StgAvlNode **pParent, StgAvlNode** pPrev )
+{
+ short nRes;
+ StgAvlNode* pCur = this;
+ *pParent = *pPrev = NULL;
+ *pPivot = this;
+
+ // search tree for insertion point
+
+ while( pCur != NULL )
+ {
+ // check for pPivot
+ if( pCur->nBalance != 0 )
+ *pPivot = pCur, *pParent = *pPrev;
+ // save pPrev location and see what direction to go
+ *pPrev = pCur;
+ nRes = pCur->Compare( pFind );
+ if( nRes == 0 )
+ break;
+ else pCur = ( nRes < 0 ) ? pCur->pLeft : pCur->pRight;
+ }
+ return( nRes );
+}
+
+// adjust balance factors in AVL tree from pivot down.
+// Returns delta balance.
+
+short StgAvlNode::Adjust( StgAvlNode** pHeavy, StgAvlNode* pNew )
+{
+ StgAvlNode* pCur = this;
+ short nDelta;
+ // no traversing
+ if( pCur == pNew )
+ return nBalance;
+ short nRes = Compare( pNew );
+ if( nRes > 0 )
+ {
+ *pHeavy = pCur = pRight;
+ nDelta = -1;
+ }
+ else
+ {
+ *pHeavy = pCur = pLeft;
+ nDelta = 1;
+ }
+ nBalance = 0;
+ while( pCur != pNew )
+ {
+ nRes = pCur->Compare( pNew );
+ if( nRes > 0 )
+ {
+ // height of right increases by 1
+ pCur->nBalance = -1;
+ pCur = pCur->pRight;
+ }
+ else
+ {
+ // height of left increases by 1
+ pCur->nBalance = 1;
+ pCur = pCur->pLeft;
+ }
+ }
+ nBalance += nDelta;
+ return nDelta;
+}
+
+// perform LL rotation and return new root
+
+StgAvlNode* StgAvlNode::RotLL()
+{
+ StgAvlNode *pHeavy = pLeft;
+ pLeft = pHeavy->pRight;
+ pHeavy->pRight = this;
+ pHeavy->nBalance = nBalance = 0;
+ return pHeavy;
+}
+
+// perform LR rotation and return new root
+
+StgAvlNode* StgAvlNode::RotLR()
+{
+
+ StgAvlNode* pHeavy = pLeft;
+ StgAvlNode* pNewRoot = pHeavy->pRight;
+
+ pHeavy->pRight = pNewRoot->pLeft;
+ pLeft = pNewRoot->pRight;
+ pNewRoot->pLeft = pHeavy;
+ pNewRoot->pRight = this;
+
+ switch( pNewRoot->nBalance )
+ {
+ case 1: // LR( b )
+ nBalance = -1;
+ pHeavy->nBalance = 0;
+ break;
+ case -1: // LR( c )
+ pHeavy->nBalance = 1;
+ nBalance = 0;
+ break;
+ case 0: // LR( a )
+ nBalance = 0;
+ pHeavy->nBalance = 0;
+ break;
+ }
+ pNewRoot->nBalance = 0;
+ return pNewRoot;
+}
+
+// perform RR rotation and return new root
+
+StgAvlNode* StgAvlNode::RotRR()
+{
+ StgAvlNode* pHeavy = pRight;
+ pRight = pHeavy->pLeft;
+ pHeavy->pLeft = this;
+ nBalance = pHeavy->nBalance = 0;
+ return pHeavy;
+}
+
+// perform the RL rotation and return the new root
+
+StgAvlNode* StgAvlNode::RotRL()
+{
+ StgAvlNode* pHeavy = pRight;
+ StgAvlNode* pNewRoot = pHeavy->pLeft;
+ pHeavy->pLeft = pNewRoot->pRight;
+ pRight = pNewRoot->pLeft;
+ pNewRoot->pRight = pHeavy;
+ pNewRoot->pLeft = this;
+ switch( pNewRoot->nBalance )
+ {
+ case -1: // RL( b )
+ nBalance = 1;
+ pHeavy->nBalance = 0;
+ break;
+ case 1: // RL( c )
+ pHeavy->nBalance = -1;
+ nBalance = 0;
+ break;
+ case 0: // RL( a )
+ nBalance = 0;
+ pHeavy->nBalance = 0;
+ break;
+ }
+ pNewRoot->nBalance = 0;
+ return pNewRoot;
+}
+
+// Remove a tree element. Return the removed element or NULL.
+
+StgAvlNode* StgAvlNode::Rem( StgAvlNode** p, StgAvlNode* pDel, BOOL bPtrs )
+{
+ if( *p )
+ {
+ StgAvlNode* pCur = *p;
+ short nRes = bPtrs ? ( pCur == pDel ) : pCur->Compare( pDel );
+ if( !nRes )
+ {
+ // Element found: remove
+ if( !pCur->pRight )
+ {
+ *p = pCur->pLeft; pCur->pLeft = NULL;
+ }
+ else if( !pCur->pLeft )
+ {
+ *p = pCur->pRight; pCur->pRight = NULL;
+ }
+ else
+ {
+ // The damn element has two leaves. Get the
+ // rightmost element of the left subtree (which
+ // is lexically before this element) and replace
+ // this element with the element found.
+ StgAvlNode* last = pCur;
+ StgAvlNode* l;
+ for( l = pCur->pLeft;
+ l->pRight; last = l, l = l->pRight ) {}
+ // remove the element from chain
+ if( l == last->pRight )
+ last->pRight = l->pLeft;
+ else
+ last->pLeft = l->pLeft;
+ // perform the replacement
+ l->pLeft = pCur->pLeft;
+ l->pRight = pCur->pRight;
+ *p = l;
+ // delete the element
+ pCur->pLeft = pCur->pRight = NULL;
+ }
+ return pCur;
+ }
+ else
+ {
+ if( nRes < 0 )
+ return Rem( &pCur->pLeft, pDel, bPtrs );
+ else
+ return Rem( &pCur->pRight, pDel, bPtrs );
+ }
+ }
+ return NULL;
+}
+
+// Enumerate the tree for later iteration
+
+void StgAvlNode::Enum( short& n )
+{
+ if( this )
+ {
+ if( pLeft )
+ pLeft->Enum( n );
+ nId = n++;
+ if( pRight )
+ pRight->Enum( n );
+ }
+}
+
+// Add node to AVL tree.
+// Return FALSE if the element already exists.
+
+BOOL StgAvlNode::Insert( StgAvlNode** pRoot, StgAvlNode* pIns )
+{
+ StgAvlNode* pPivot, *pHeavy, *pNewRoot, *pParent, *pPrev;
+ // special case - empty tree
+ if( *pRoot == NULL )
+ {
+ *pRoot = pIns;
+ return TRUE;
+ }
+ // find insertion point and return if already present
+ short nRes = (*pRoot)->Locate( pIns, &pPivot, &pParent, &pPrev );
+ if( !nRes )
+ return FALSE;
+ // add new node
+ if( nRes < 0 )
+ pPrev->pLeft = pIns;
+ else
+ pPrev->pRight = pIns;
+ // rebalance tree
+ short nDelta = pPivot->Adjust( &pHeavy, pIns );
+ if( pPivot->nBalance >= 2 || pPivot->nBalance <= -2 )
+ {
+ pHeavy = ( nDelta < 0 ) ? pPivot->pRight : pPivot->pLeft;
+ // left imbalance
+ if( nDelta > 0 )
+ if( pHeavy->nBalance == 1 )
+ pNewRoot = pPivot->RotLL();
+ else
+ pNewRoot = pPivot->RotLR();
+ // right imbalance
+ else if( pHeavy->nBalance == -1 )
+ pNewRoot = pPivot->RotRR();
+ else
+ pNewRoot = pPivot->RotRL();
+ // relink balanced subtree
+ if( pParent == NULL )
+ *pRoot = pNewRoot;
+ else if( pPivot == pParent->pLeft )
+ pParent->pLeft = pNewRoot;
+ else if( pPivot == pParent->pRight )
+ pParent->pRight = pNewRoot;
+ }
+ return TRUE;
+}
+
+// Remove node from tree. Returns TRUE is found and removed.
+// Actually delete if bDel
+
+BOOL StgAvlNode::Remove( StgAvlNode** pRoot, StgAvlNode* pDel, BOOL bDel )
+{
+ // special case - empty tree
+ if( *pRoot == NULL )
+ return FALSE;
+ // delete the element
+ pDel = Rem( pRoot, pDel, FALSE );
+ if( pDel )
+ {
+ if( bDel )
+ delete pDel;
+ // Rebalance the tree the hard way
+ // OS 22.09.95: Auf MD's Wunsch auskommentiert wg. Absturz
+/* StgAvlNode* pNew = NULL;
+ while( *pRoot )
+ {
+ StgAvlNode* p = Rem( pRoot, *pRoot, FALSE );
+ Insert( &pNew, p );
+ }
+ *pRoot = pNew;*/
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// Move node to a different tree. Returns TRUE is found and moved. This routine
+// may be called when the key has changed.
+
+BOOL StgAvlNode::Move
+ ( StgAvlNode** pRoot1, StgAvlNode** pRoot2, StgAvlNode* pMove )
+{
+ // special case - empty tree
+ if( *pRoot1 == NULL )
+ return FALSE;
+ pMove = Rem( pRoot1, pMove, FALSE );
+ if( pMove )
+ return Insert( pRoot2, pMove );
+ else
+ return FALSE;
+}
+
+////////////////////////// class AvlIterator /////////////////////////
+
+// The iterator walks through a tree one entry by one.
+
+StgAvlIterator::StgAvlIterator( StgAvlNode* p )
+{
+ pRoot = p;
+ nCount = 0;
+ if( p )
+ p->Enum( nCount );
+}
+
+StgAvlNode* StgAvlIterator::Find( short n )
+{
+ StgAvlNode* p = pRoot;
+ while( p )
+ {
+ if( n == p->nId )
+ break;
+ else p = ( n < p->nId ) ? p->pLeft : p->pRight;
+ }
+ return p;
+}
+
+StgAvlNode* StgAvlIterator::First()
+{
+ nCur = -1;
+ return Next();
+}
+
+StgAvlNode* StgAvlIterator::Last()
+{
+ nCur = nCount;
+ return Prev();
+}
+
+StgAvlNode* StgAvlIterator::Next()
+{
+ return Find( ++nCur );
+}
+
+StgAvlNode* StgAvlIterator::Prev()
+{
+ return Find( --nCur );
+}
+
diff --git a/sot/source/sdstor/stgavl.hxx b/sot/source/sdstor/stgavl.hxx
new file mode 100644
index 000000000000..e9ab60dcea4f
--- /dev/null
+++ b/sot/source/sdstor/stgavl.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgavl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STGAVL_HXX
+#define _STGAVL_HXX
+
+#ifndef _TOOLS_SOLAR_H
+#include <tools/solar.h>
+#endif
+
+// This class must be overloaded to define real, living nodes.
+// Especially, the compare function must be implemented.
+
+class StgAvlNode
+{
+ friend class StgAvlIterator;
+private:
+ short Locate( StgAvlNode*, StgAvlNode**, StgAvlNode**, StgAvlNode** );
+ short Adjust( StgAvlNode**, StgAvlNode* );
+ StgAvlNode* RotLL();
+ StgAvlNode* RotLR();
+ StgAvlNode* RotRR();
+ StgAvlNode* RotRL();
+ void Enum( short& );
+ static StgAvlNode* Rem( StgAvlNode**, StgAvlNode*, BOOL );
+protected:
+ short nId; // iterator ID
+ short nBalance; // indicates tree balance
+ StgAvlNode* pLeft, *pRight; // leaves
+ StgAvlNode();
+public:
+ virtual ~StgAvlNode();
+ StgAvlNode* Find( StgAvlNode* );
+ static BOOL Insert( StgAvlNode**, StgAvlNode* );
+ static BOOL Remove( StgAvlNode**, StgAvlNode*, BOOL bDel = TRUE );
+ static BOOL Move( StgAvlNode**, StgAvlNode**, StgAvlNode* );
+ virtual short Compare( const StgAvlNode* ) const = 0;
+};
+
+// The iterator class provides single stepping through an AVL tree.
+
+class StgAvlIterator {
+ StgAvlNode* pRoot; // root entry (parent)
+ short nCount; // tree size
+ short nCur; // current element
+ StgAvlNode* Find( short );
+public:
+ StgAvlIterator( StgAvlNode* );
+ StgAvlNode* First();
+ StgAvlNode* Last();
+ StgAvlNode* Next();
+ StgAvlNode* Prev();
+};
+
+#endif
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
new file mode 100644
index 000000000000..c5381f69a540
--- /dev/null
+++ b/sot/source/sdstor/stgcache.cxx
@@ -0,0 +1,535 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgcache.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if defined(_MSC_VER) && (_MSC_VER<1200)
+#include <tools/presys.h>
+#endif
+#if STLPORT_VERSION<321
+#include <hash_map.h>
+#else
+#include <hash_map>
+#endif
+#if defined(_MSC_VER) && (_MSC_VER<1200)
+#include <tools/postsys.h>
+#endif
+#include <vos/macros.hxx>
+
+#include <string.h>
+
+#ifndef _TOOLS_STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+#include "stg.hxx"
+#include "stgelem.hxx"
+#include "stgcache.hxx"
+#include "stgstrms.hxx"
+#include "stgdir.hxx"
+#include "stgio.hxx"
+#pragma hdrstop
+
+/*************************************************************************/
+//-----------------------------------------------------------------------------
+typedef NAMESPACE_STD(hash_map)
+//typedef hash_map
+<
+ INT32,
+ StgPage *,
+ NAMESPACE_STD(hash)< INT32 >,
+ NAMESPACE_STD(equal_to)< INT32 >
+> UsrStgPagePtr_Impl;
+#ifdef WNT
+#pragma warning( disable: 4786 )
+#endif
+
+//#define CHECK_DIRTY 1
+//#define READ_AFTER_WRITE 1
+
+////////////////////////////// class StgPage /////////////////////////////
+// This class implements buffer functionality. The cache will always return
+// a page buffer, even if a read fails. It is up to the caller to determine
+// the correctness of the I/O.
+
+StgPage::StgPage( StgCache* p, short n )
+{
+ pCache = p;
+ nData = n;
+ bDirty = FALSE;
+ nPage = 0;
+ pData = new BYTE[ nData ];
+ pNext1 =
+ pNext2 =
+ pLast1 =
+ pLast2 = NULL;
+ pOwner = NULL;
+}
+
+StgPage::~StgPage()
+{
+ delete pData;
+}
+
+void StgPage::SetPage( short nOff, INT32 nVal )
+{
+ if( ( nOff < (short) ( nData / sizeof( INT32 ) ) ) && nOff >= 0 )
+ {
+#ifdef __BIGENDIAN
+ nVal = SWAPLONG(nVal);
+#endif
+ ((INT32*) pData )[ nOff ] = nVal;
+ bDirty = TRUE;
+ }
+}
+
+//////////////////////////////// class StgCache ////////////////////////////
+
+// The disk cache holds the cached sectors. The sector type differ according
+// to their purpose.
+
+StgCache::StgCache()
+{
+ nRef = 0;
+ pStrm = NULL;
+ pCur = pElem1 = NULL;
+ nPageSize = 512;
+ nError = SVSTREAM_OK;
+ bMyStream = FALSE;
+ bFile = FALSE;
+ pLRUCache = NULL;
+}
+
+StgCache::~StgCache()
+{
+ Clear();
+ SetStrm( NULL, FALSE );
+ delete (UsrStgPagePtr_Impl*)pLRUCache;
+}
+
+void StgCache::SetPhysPageSize( short n )
+{
+ nPageSize = n;
+ ULONG nPos = pStrm->Tell();
+ ULONG nFileSize = pStrm->Seek( STREAM_SEEK_TO_END );
+ nPages = ( nFileSize >= 512 ) ? ( nFileSize - 512 ) / nPageSize : 0;
+ pStrm->Seek( nPos );
+}
+
+// Create a new cache element
+// pCur points to this element
+
+StgPage* StgCache::Create( INT32 nPg )
+{
+ StgPage* pElem = new StgPage( this, nPageSize );
+ pElem->nPage = nPg;
+ // For data security, clear the buffer contents
+ memset( pElem->pData, 0, pElem->nData );
+
+ // insert to LRU
+ if( pCur )
+ {
+ pElem->pNext1 = pCur;
+ pElem->pLast1 = pCur->pLast1;
+ pElem->pNext1->pLast1 =
+ pElem->pLast1->pNext1 = pElem;
+ }
+ else
+ pElem->pNext1 = pElem->pLast1 = pElem;
+ if( !pLRUCache )
+ pLRUCache = new UsrStgPagePtr_Impl();
+ (*(UsrStgPagePtr_Impl*)pLRUCache)[pElem->nPage] = pElem;
+ pCur = pElem;
+
+ // insert to Sorted
+ if( !pElem1 )
+ pElem1 = pElem->pNext2 = pElem->pLast2 = pElem;
+ else
+ {
+ StgPage* p = pElem1;
+ do
+ {
+ if( pElem->nPage < p->nPage )
+ break;
+ p = p->pNext2;
+ } while( p != pElem1 );
+ pElem->pNext2 = p;
+ pElem->pLast2 = p->pLast2;
+ pElem->pNext2->pLast2 =
+ pElem->pLast2->pNext2 = pElem;
+ if( p->nPage < pElem1->nPage )
+ pElem1 = pElem;
+ }
+ return pElem;
+}
+
+// Delete the given element
+
+void StgCache::Erase( StgPage* pElem )
+{
+ //remove from LRU
+ pElem->pNext1->pLast1 = pElem->pLast1;
+ pElem->pLast1->pNext1 = pElem->pNext1;
+ if( pCur == pElem )
+ pCur = ( pElem->pNext1 == pElem ) ? NULL : pElem->pNext1;
+ if( pLRUCache )
+ ((UsrStgPagePtr_Impl*)pLRUCache)->erase( pElem->nPage );
+ // remove from Sorted
+ pElem->pNext2->pLast2 = pElem->pLast2;
+ pElem->pLast2->pNext2 = pElem->pNext2;
+ if( pElem1 == pElem )
+ pElem1 = ( pElem->pNext2 == pElem ) ? NULL : pElem->pNext2;
+ delete pElem;
+}
+
+// remove all cache elements without flushing them
+
+void StgCache::Clear()
+{
+ StgPage* pElem = pCur;
+ if( pCur ) do
+ {
+ StgPage* pDelete = pElem;
+ pElem = pElem->pNext1;
+ delete pDelete;
+ }
+ while( pCur != pElem );
+ pCur = NULL;
+ pElem1 = NULL;
+ delete (UsrStgPagePtr_Impl*)pLRUCache;
+ pLRUCache = NULL;
+}
+
+// Look for a cached page
+
+StgPage* StgCache::Find( INT32 nPage )
+{
+ if( !pLRUCache )
+ return NULL;
+ UsrStgPagePtr_Impl::iterator aIt = ((UsrStgPagePtr_Impl*)pLRUCache)->find( nPage );
+ if( aIt != ((UsrStgPagePtr_Impl*)pLRUCache)->end() )
+ {
+ // page found
+ StgPage* pFound = (*aIt).second;
+
+ if( pFound != pCur )
+ {
+ // remove from LRU
+ pFound->pNext1->pLast1 = pFound->pLast1;
+ pFound->pLast1->pNext1 = pFound->pNext1;
+ // insert to LRU
+ pFound->pNext1 = pCur;
+ pFound->pLast1 = pCur->pLast1;
+ pFound->pNext1->pLast1 =
+ pFound->pLast1->pNext1 = pFound;
+ }
+ return pFound;
+ }
+ return NULL;
+}
+
+// Load a page into the cache
+
+StgPage* StgCache::Get( INT32 nPage, BOOL bForce )
+{
+ StgPage* p = Find( nPage );
+ if( !p )
+ {
+ p = Create( nPage );
+ if( !Read( nPage, p->pData, 1 ) && bForce )
+ {
+ Erase( p );
+ p = NULL;
+ SetError( SVSTREAM_READ_ERROR );
+ }
+ }
+ return p;
+}
+
+// Copy an existing page into a new page. Use this routine
+// to duplicate an existing stream or to create new entries.
+// The new page is initially marked dirty. No owner is copied.
+
+StgPage* StgCache::Copy( INT32 nNew, INT32 nOld )
+{
+ StgPage* p = Find( nNew );
+ if( !p )
+ p = Create( nNew );
+ if( nOld >= 0 )
+ {
+ // old page: we must have this data!
+ StgPage* q = Get( nOld, TRUE );
+ if( q )
+ memcpy( p->pData, q->pData, p->nData );
+ }
+ p->SetDirty();
+ return p;
+}
+
+// Flush the cache whose owner is given. NULL flushes all.
+
+BOOL StgCache::Commit( StgDirEntry* )
+{
+ StgPage* p = pElem1;
+ if( p ) do
+ {
+ if( p->bDirty )
+ {
+ BOOL b = Write( p->nPage, p->pData, 1 );
+ if( !b )
+ return FALSE;
+ p->bDirty = FALSE;
+ }
+ p = p->pNext2;
+ } while( p != pElem1 );
+ pStrm->Flush();
+ SetError( pStrm->GetError() );
+#ifdef CHECK_DIRTY
+ p = pElem1;
+ if( p ) do
+ {
+ if( p->bDirty )
+ {
+ ErrorBox( NULL, WB_OK, String("SO2: Dirty Block in Ordered List") ).Execute();
+ BOOL b = Write( p->nPage, p->pData, 1 );
+ if( !b )
+ return FALSE;
+ p->bDirty = FALSE;
+ }
+ p = p->pNext2;
+ } while( p != pElem1 );
+ p = pElem1;
+ if( p ) do
+ {
+ if( p->bDirty )
+ {
+ ErrorBox( NULL, WB_OK, String("SO2: Dirty Block in LRU List") ).Execute();
+ BOOL b = Write( p->nPage, p->pData, 1 );
+ if( !b )
+ return FALSE;
+ p->bDirty = FALSE;
+ }
+ p = p->pNext1;
+ } while( p != pElem1 );
+#endif
+ return TRUE;
+}
+
+void StgCache::Revert( StgDirEntry* )
+{}
+
+// Set a stream
+
+void StgCache::SetStrm( SvStream* p, BOOL bMy )
+{
+ if( bMyStream )
+ delete pStrm;
+ pStrm = p;
+ bMyStream = bMy;
+}
+
+// Open/close the disk file
+
+BOOL StgCache::Open( const String& rName, StreamMode nMode )
+{
+ // do not open in exclusive mode!
+ if( nMode & STREAM_SHARE_DENYALL )
+ nMode = ( ( nMode & ~STREAM_SHARE_DENYALL ) | STREAM_SHARE_DENYWRITE );
+ SvFileStream* pFileStrm = new SvFileStream( rName, nMode );
+ // SvStream "Feature" Write Open auch erfolgreich, wenns nicht klappt
+ BOOL bAccessDenied = FALSE;
+ if( ( nMode & STREAM_WRITE ) && !pFileStrm->IsWritable() )
+ {
+ pFileStrm->Close();
+ bAccessDenied = TRUE;
+ }
+ SetStrm( pFileStrm, TRUE );
+ if( pFileStrm->IsOpen() )
+ {
+ ULONG nFileSize = pStrm->Seek( STREAM_SEEK_TO_END );
+ nPages = ( nFileSize >= 512 ) ? ( nFileSize - 512 ) / nPageSize : 0;
+ pStrm->Seek( 0L );
+ }
+ else
+ nPages = 0;
+ bFile = TRUE;
+ SetError( bAccessDenied ? ERRCODE_IO_ACCESSDENIED : pStrm->GetError() );
+ return Good();
+}
+
+void StgCache::Close()
+{
+ if( bFile )
+ {
+ ((SvFileStream*) pStrm)->Close();
+ SetError( pStrm->GetError() );
+ }
+}
+
+// low level I/O
+
+BOOL StgCache::Read( INT32 nPage, void* pBuf, INT32 nPg )
+{
+ if( Good() )
+ {
+ ULONG nPos = Page2Pos( nPage );
+ ULONG nBytes = nPg * nPageSize;
+ // fixed address and size for the header
+ if( nPage == -1 )
+ nPos = 0L, nBytes = 512;
+ if( pStrm->Tell() != nPos )
+ {
+ ULONG nPhysPos = pStrm->Seek( nPos );
+#ifdef CHECK_DIRTY
+ if( nPhysPos != nPos )
+ ErrorBox( NULL, WB_OK, String("SO2: Seek failed") ).Execute();
+#endif
+ }
+ pStrm->Read( pBuf, nBytes );
+ SetError( pStrm->GetError() );
+ }
+ return Good();
+}
+
+BOOL StgCache::Write( INT32 nPage, void* pBuf, INT32 nPg )
+{
+ if( Good() )
+ {
+ ULONG nPos = Page2Pos( nPage );
+ ULONG nBytes = nPg * nPageSize;
+ // fixed address and size for the header
+ if( nPage == -1 )
+ nPos = 0L, nBytes = 512;
+ if( pStrm->Tell() != nPos )
+ {
+ ULONG nPhysPos = pStrm->Seek( nPos );
+#ifdef CHECK_DIRTY
+ if( nPhysPos != nPos )
+ ErrorBox( NULL, WB_OK, String("SO2: Seek failed") ).Execute();
+#endif
+ }
+ ULONG nRes = pStrm->Write( pBuf, nBytes );
+ if( nRes != nBytes )
+ SetError( SVSTREAM_WRITE_ERROR );
+ else
+ SetError( pStrm->GetError() );
+#ifdef READ_AFTER_WRITE
+ BYTE cBuf[ 512 ];
+ pStrm->Flush();
+ pStrm->Seek( nPos );
+ BOOL bRes = ( pStrm->Read( cBuf, 512 ) == 512 );
+ if( bRes )
+ bRes = !memcmp( cBuf, pBuf, 512 );
+ if( !bRes )
+ {
+ ErrorBox( NULL, WB_OK, String("SO2: Read after Write failed") ).Execute();
+ pStrm->SetError( SVSTREAM_WRITE_ERROR );
+ }
+#endif
+ }
+ return Good();
+}
+
+// set the file size in pages
+
+BOOL StgCache::SetSize( INT32 n )
+{
+ // Add the file header
+ INT32 nSize = n * nPageSize + 512;
+ pStrm->SetStreamSize( nSize );
+ SetError( pStrm->GetError() );
+ if( !nError )
+ nPages = n;
+ return Good();
+}
+
+void StgCache::SetError( ULONG n )
+{
+ if( n && !nError )
+ nError = n;
+}
+
+void StgCache::ResetError()
+{
+ nError = SVSTREAM_OK;
+ pStrm->ResetError();
+}
+
+void StgCache::MoveError( StorageBase& r )
+{
+ if( nError != SVSTREAM_OK )
+ {
+ r.SetError( nError );
+ ResetError();
+ }
+}
+
+// Utility functions
+
+INT32 StgCache::Page2Pos( INT32 nPage )
+{
+ if( nPage < 0 ) nPage = 0;
+ return( nPage * nPageSize ) + nPageSize;
+}
+
+INT32 StgCache::Pos2Page( INT32 nPos )
+{
+ return ( ( nPos + nPageSize - 1 ) / nPageSize ) * nPageSize - 1;
+}
+
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx
new file mode 100644
index 000000000000..c9a3bf032a3a
--- /dev/null
+++ b/sot/source/sdstor/stgcache.hxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgcache.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STGCACHE_HXX
+#define _STGCACHE_HXX
+
+#ifndef _TOOLS_SOLAR_H
+#include <tools/solar.h>
+#endif
+#ifndef _TOOLS_STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _STGELEM_HXX
+#include "stgelem.hxx"
+#endif
+
+
+class StgIo;
+class StgPage;
+class StgDirEntry;
+class StorageBase;
+
+class StgCache {
+ StgPage* pCur; // top of LRU list
+ StgPage* pElem1; // top of ordered list
+ ULONG nError; // error code
+ INT32 nPages; // size of data area in pages
+ USHORT nRef; // reference count
+ void * pLRUCache; // hash table of cached objects
+ short nPageSize; // page size of the file
+ void Erase( StgPage* ); // delete a cache element
+ void InsertToLRU( StgPage* ); // insert into LRU list
+ void InsertToOrdered( StgPage* ); // insert into ordered list
+ StgPage* Create( INT32 ); // create a cached page
+protected:
+ SvStream* pStrm; // physical stream
+ BOOL bMyStream; // TRUE: delete stream in dtor
+ BOOL bFile; // TRUE: file stream
+ INT32 Page2Pos( INT32 ); // page address --> file position
+ INT32 Pos2Page( INT32 ); // file position --> page address
+public:
+ StgCache();
+ ~StgCache();
+ void IncRef() { nRef++; }
+ USHORT DecRef() { return --nRef; }
+ void SetPhysPageSize( short );
+ INT32 GetPhysPages() { return nPages; }
+ short GetPhysPageSize() { return nPageSize; }
+ SvStream* GetStrm() { return pStrm; }
+ void SetStrm( SvStream*, BOOL );
+ BOOL IsWritable() { return pStrm->IsWritable(); }
+ BOOL Good() { return BOOL( nError == SVSTREAM_OK ); }
+ BOOL Bad() { return BOOL( nError != SVSTREAM_OK ); }
+ ULONG GetError() { return nError; }
+ void MoveError( StorageBase& );
+ void SetError( ULONG );
+ void ResetError();
+ BOOL Open( const String& rName, StreamMode );
+ void Close();
+ BOOL Read( INT32 nPage, void* pBuf, INT32 nPages );
+ BOOL Write( INT32 nPage, void* pBuf, INT32 nPages );
+ BOOL SetSize( INT32 nPages );
+ StgPage* Find( INT32 ); // find a cached page
+ StgPage* Get( INT32, BOOL ); // get a cached page
+ StgPage* Copy( INT32, INT32=STG_FREE ); // copy a page
+ BOOL Commit( StgDirEntry* = NULL ); // flush all pages
+ void Revert( StgDirEntry* = NULL ); // revert dirty pages
+ void Clear(); // clear the cache
+};
+
+class StgPage {
+ friend class StgCache;
+ StgCache* pCache; // the cache
+ StgPage *pNext1, *pLast1; // LRU chain
+ StgPage *pNext2, *pLast2; // ordered chain
+ StgDirEntry* pOwner; // owner
+ INT32 nPage; // page #
+ void* pData; // nPageSize characters
+ short nData; // size of this page
+ BOOL bDirty; // dirty flag
+ StgPage( StgCache*, short );
+ ~StgPage();
+public:
+ void SetDirty() { bDirty = TRUE; }
+ INT32 GetPage() { return nPage; }
+ void* GetData() { return pData; }
+ short GetSize() { return nData; }
+ void SetOwner( StgDirEntry* p ) { pOwner = p; }
+ // routines for accessing FAT pages
+ // Assume that the data is a FAT page and get/put FAT data.
+ INT32 GetPage( short nOff )
+ {
+ if( ( nOff >= (short) ( nData / sizeof( INT32 ) ) ) || nOff < 0 )
+ return -1;
+ INT32 n = ((INT32*) pData )[ nOff ];
+#ifdef __BIGENDIAN
+ return SWAPLONG(n);
+#else
+ return n;
+#endif
+ }
+ void SetPage( short, INT32 ); // put an element
+};
+
+#endif
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
new file mode 100644
index 000000000000..c5f4db205021
--- /dev/null
+++ b/sot/source/sdstor/stgdir.cxx
@@ -0,0 +1,1032 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgdir.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h> // memcpy()
+
+#include "stg.hxx"
+#include "stgelem.hxx"
+#include "stgcache.hxx"
+#include "stgstrms.hxx"
+#include "stgdir.hxx"
+#include "stgio.hxx"
+#pragma hdrstop
+
+//////////////////////////// class StgDirEntry /////////////////////////////
+
+// This class holds the dir entry data and maintains dirty flags for both
+// the entry and the data.
+
+// Transacted mode for streams: On the first write, a temp stream pTmpStrm
+// is created and operated on. A commit moves pTmpStrm to pCurStrm, which
+// is used for subsequent reads. A new write creates a new copy of pTmpStrm
+// based on pCurStrm. Reverting throws away pTmpStrm.
+// Transacted mode for storages: A copy of the dir ents is kept in aSave.
+// Committing means copying aEntry to aSave. Reverting means to copy aSave
+// to aEntry, delete newly created entries and to reactivate removed entries.
+
+// Problem der Implementation: Keine Hierarchischen commits. Daher nur
+// insgesamt transaktionsorientert oder direkt.
+
+StgDirEntry::StgDirEntry( const void* pFrom, BOOL * pbOk ) : StgAvlNode()
+{
+ *pbOk = aEntry.Load( pFrom );
+
+ InitMembers();
+}
+
+StgDirEntry::StgDirEntry( const StgEntry& r ) : StgAvlNode(), aEntry( r )
+{
+ InitMembers();
+}
+
+// Helper for all ctors
+
+void StgDirEntry::InitMembers()
+{
+ aSave = aEntry;
+ pUp =
+ pDown = NULL;
+ ppRoot = NULL;
+ pStgStrm = NULL;
+ pCurStrm =
+ pTmpStrm = NULL;
+ nPos =
+ nEntry =
+ nRefCnt = 0;
+ nMode = STREAM_READ;
+ bDirect = TRUE;
+ bInvalid =
+ bCreated =
+ bRenamed =
+ bRemoved =
+ bTemp =
+ bDirty =
+ bZombie = FALSE;
+}
+
+StgDirEntry::~StgDirEntry()
+{
+ Close();
+ delete pCurStrm;
+ delete pStgStrm;
+ delete pDown;
+}
+
+// Comparison function
+
+short StgDirEntry::Compare( const StgAvlNode* p ) const
+{
+ const StgDirEntry* pEntry = (const StgDirEntry*) p;
+ return aEntry.Compare( pEntry->aEntry );
+}
+
+// Enumerate the entry numbers.
+// n is incremented to show the total # of entries.
+// These number are later used as page numbers when storing
+// the TOC tree into the TOC stream. Remember that aSave is
+// stored, not aEntry.
+
+void StgDirEntry::Enum( INT32& n )
+{
+ INT32 nLeft = STG_FREE, nRight = STG_FREE, nDown = STG_FREE;
+ nEntry = n++;
+ if( pLeft )
+ {
+ ((StgDirEntry*) pLeft)->Enum( n ); nLeft = ((StgDirEntry*) pLeft)->nEntry;
+ }
+ if( pRight )
+ {
+ ((StgDirEntry*) pRight)->Enum( n ); nRight = ((StgDirEntry*) pRight)->nEntry;
+ }
+ if( pDown )
+ {
+ pDown->Enum( n ); nDown = pDown->nEntry;
+ }
+ aSave.SetLeaf( STG_LEFT, nLeft );
+ aSave.SetLeaf( STG_RIGHT, nRight );
+ aSave.SetLeaf( STG_CHILD, nDown );
+}
+
+// Delete all temporary entries before writing the TOC stream.
+// Until now Deltem is never called with bForce True
+
+void StgDirEntry::DelTemp( BOOL bForce )
+{
+ if( pLeft )
+ ((StgDirEntry*) pLeft)->DelTemp( FALSE );
+ if( pRight )
+ ((StgDirEntry*) pRight)->DelTemp( FALSE );
+ if( pDown )
+ {
+ // If the storage is dead, of course all elements are dead, too
+ if( bInvalid && aEntry.GetType() == STG_STORAGE )
+ bForce = TRUE;
+ pDown->DelTemp( bForce );
+ }
+ if( ( bForce || bInvalid )
+ && ( aEntry.GetType() != STG_ROOT ) /* && ( nRefCnt <= 1 ) */ )
+ {
+ Close();
+ if( pUp )
+ {
+ // this deletes the element if refcnt == 0!
+ BOOL bDel = nRefCnt == 0;
+ StgAvlNode::Remove( (StgAvlNode**) &pUp->pDown, this, bDel );
+ if( !bDel )
+ {
+ pLeft = pRight = pDown = 0;
+ bInvalid = bZombie = TRUE;
+ }
+ }
+ }
+}
+
+// Save the tree into the given dir stream
+
+BOOL StgDirEntry::Store( StgDirStrm& rStrm )
+{
+ void* pEntry = rStrm.GetEntry( nEntry, TRUE );
+ if( !pEntry )
+ return FALSE;
+ // Do not store the current (maybe not commited) entry
+ aSave.Store( pEntry );
+ if( pLeft )
+ if( !((StgDirEntry*) pLeft)->Store( rStrm ) )
+ return FALSE;
+ if( pRight )
+ if( !((StgDirEntry*) pRight)->Store( rStrm ) )
+ return FALSE;
+ if( pDown )
+ if( !pDown->Store( rStrm ) )
+ return FALSE;
+ return TRUE;
+}
+
+BOOL StgDirEntry::StoreStream( StgIo& rIo )
+{
+ if( aEntry.GetType() == STG_STREAM || aEntry.GetType() == STG_ROOT )
+ {
+ if( bInvalid )
+ {
+ // Delete the stream if needed
+ if( !pStgStrm )
+ {
+ OpenStream( rIo );
+ delete pStgStrm, pStgStrm = NULL;
+ }
+ else
+ pStgStrm->SetSize( 0 );
+ }
+ // or write the data stream
+ else if( !Tmp2Strm() )
+ return FALSE;
+ }
+ return TRUE;
+}
+
+// Save all dirty streams
+
+BOOL StgDirEntry::StoreStreams( StgIo& rIo )
+{
+ if( !StoreStream( rIo ) )
+ return FALSE;
+ if( pLeft )
+ if( !((StgDirEntry*) pLeft)->StoreStreams( rIo ) )
+ return FALSE;
+ if( pRight )
+ if( !((StgDirEntry*) pRight)->StoreStreams( rIo ) )
+ return FALSE;
+ if( pDown )
+ if( !pDown->StoreStreams( rIo ) )
+ return FALSE;
+ return TRUE;
+}
+
+// Revert all directory entries after failure to write the TOC stream
+
+void StgDirEntry::RevertAll()
+{
+ aEntry = aSave;
+ if( pLeft )
+ ((StgDirEntry*) pLeft)->RevertAll();
+ if( pRight )
+ ((StgDirEntry*) pRight)->RevertAll();
+ if( pDown )
+ pDown->RevertAll();
+}
+
+// Look if any element of the tree is dirty
+
+BOOL StgDirEntry::IsDirty()
+{
+ if( bDirty || bInvalid )
+ return TRUE;
+ if( pLeft && ((StgDirEntry*) pLeft)->IsDirty() )
+ return TRUE;
+ if( pRight && ((StgDirEntry*) pRight)->IsDirty() )
+ return TRUE;
+ if( pDown && pDown->IsDirty() )
+ return TRUE;
+ return FALSE;
+}
+
+// Set up a stream.
+
+void StgDirEntry::OpenStream( StgIo& rIo, BOOL bForceBig )
+{
+ short nThreshold = (USHORT) rIo.aHdr.GetThreshold();
+ delete pStgStrm;
+ if( !bForceBig && aEntry.GetSize() < (INT32) nThreshold )
+ pStgStrm = new StgSmallStrm( rIo, this );
+ else
+ pStgStrm = new StgDataStrm( rIo, this );
+ if( bInvalid && aEntry.GetSize() )
+ {
+ // This entry has invalid data, so delete that data
+ SetSize( 0L );
+// bRemoved = bInvalid = FALSE;
+ }
+ nPos = 0;
+}
+
+// Close the open stream without committing. If the entry is marked as
+// temporary, delete it.
+// Do not delete pCurStrm here!
+// (TLX:??? Zumindest pStgStrm muss deleted werden.)
+
+void StgDirEntry::Close()
+{
+ delete pTmpStrm;
+ pTmpStrm = NULL;
+// nRefCnt = 0;
+ bInvalid = bTemp;
+}
+
+// Get the current stream size
+
+INT32 StgDirEntry::GetSize()
+{
+ INT32 n;
+ if( pTmpStrm )
+ n = pTmpStrm->GetSize();
+ else if( pCurStrm )
+ n = pCurStrm->GetSize();
+ else n = aEntry.GetSize();
+ return n;
+}
+
+// Set the stream size. This means also creating a temp stream.
+
+BOOL StgDirEntry::SetSize( INT32 nNewSize )
+{
+ if( !bDirect && !pTmpStrm && !Strm2Tmp() )
+ return FALSE;
+ if( nNewSize < nPos )
+ nPos = nNewSize;
+ if( pTmpStrm )
+ {
+ pTmpStrm->SetSize( nNewSize );
+ pStgStrm->GetIo().SetError( pTmpStrm->GetError() );
+ return BOOL( pTmpStrm->GetError() == SVSTREAM_OK );
+ }
+ else
+ {
+ BOOL bRes = FALSE;
+ StgIo& rIo = pStgStrm->GetIo();
+ short nThreshold = (USHORT) rIo.aHdr.GetThreshold();
+ // ensure the correct storage stream!
+ StgStrm* pOld = NULL;
+ USHORT nOldSize = 0;
+ if( nNewSize > nThreshold && pStgStrm->IsSmallStrm() )
+ {
+ pOld = pStgStrm;
+ nOldSize = (USHORT) pOld->GetSize();
+ pStgStrm = new StgDataStrm( rIo, STG_EOF, 0 );
+ }
+ else if( nNewSize < nThreshold && !pStgStrm->IsSmallStrm() )
+ {
+ pOld = pStgStrm;
+ nOldSize = (USHORT) nNewSize;
+ pStgStrm = new StgSmallStrm( rIo, STG_EOF, 0 );
+ }
+ // now set the new size
+ if( pStgStrm->SetSize( nNewSize ) )
+ {
+ // did we create a new stream?
+ if( pOld )
+ {
+ // if so, we probably need to copy the old data
+ if( nOldSize )
+ {
+ void* pBuf = new BYTE[ nOldSize ];
+ pOld->Pos2Page( 0L );
+ pStgStrm->Pos2Page( 0L );
+ if( pOld->Read( pBuf, nOldSize )
+ && pStgStrm->Write( pBuf, nOldSize ) )
+ bRes = TRUE;
+ delete pBuf;
+ }
+ else
+ bRes = TRUE;
+ if( bRes )
+ {
+ pOld->SetSize( 0 );
+ delete pOld;
+ pStgStrm->Pos2Page( nPos );
+ pStgStrm->SetEntry( *this );
+ }
+ else
+ {
+ pStgStrm->SetSize( 0 );
+ delete pStgStrm;
+ pStgStrm = pOld;
+ }
+ }
+ else
+ {
+ pStgStrm->Pos2Page( nPos );
+ bRes = TRUE;
+ }
+ }
+ return bRes;
+ }
+}
+
+// Seek. On negative values, seek to EOF.
+
+INT32 StgDirEntry::Seek( INT32 nNew )
+{
+ if( pTmpStrm )
+ {
+ if( nNew < 0 )
+ nNew = pTmpStrm->GetSize();
+ nNew = pTmpStrm->Seek( nNew );
+ }
+ else if( pCurStrm )
+ {
+ if( nNew < 0 )
+ nNew = pCurStrm->GetSize();
+ nNew = pCurStrm->Seek( nNew );
+ }
+ else
+ {
+ INT32 nSize = aEntry.GetSize();
+ if( nNew < 0 )
+ nNew = nSize;
+ // enlarge?
+ if( nNew > nSize )
+ {
+ if( !SetSize( nNew ) )
+ return nPos;
+ else
+ return Seek( nNew );
+ }
+ pStgStrm->Pos2Page( nNew );
+ nNew = pStgStrm->GetPos();
+ }
+ return nPos = nNew;
+}
+
+// Read
+
+INT32 StgDirEntry::Read( void* p, INT32 nLen )
+{
+ if( nLen <= 0 )
+ return 0;
+ if( pTmpStrm )
+ nLen = pTmpStrm->Read( p, nLen );
+ else if( pCurStrm )
+ nLen = pCurStrm->Read( p, nLen );
+ else
+ nLen = pStgStrm->Read( p, nLen );
+ nPos += nLen;
+ return nLen;
+}
+
+// Write
+
+INT32 StgDirEntry::Write( const void* p, INT32 nLen )
+{
+ if( nLen <= 0 )
+ return 0;
+
+ // Was this stream committed internally and reopened in direct mode?
+ if( bDirect && ( pCurStrm || pTmpStrm ) && !Tmp2Strm() )
+ return 0;
+ // Is this stream opened in transacted mode? Do we have to make a copy?
+ if( !bDirect && !pTmpStrm && !Strm2Tmp() )
+ return 0;
+ if( pTmpStrm )
+ {
+ nLen = pTmpStrm->Write( p, nLen );
+ pStgStrm->GetIo().SetError( pTmpStrm->GetError() );
+ }
+ else
+ {
+ INT32 nNew = nPos + nLen;
+ if( nNew > pStgStrm->GetSize() )
+ {
+ if( !SetSize( nNew ) )
+ return 0L;
+ pStgStrm->Pos2Page( nPos );
+ }
+ nLen = pStgStrm->Write( p, nLen );
+ }
+ nPos += nLen;
+ return nLen;
+}
+
+// Copy the data of one entry into another entry.
+
+void StgDirEntry::Copy( StgDirEntry& rDest )
+{
+ INT32 n = GetSize();
+ if( rDest.SetSize( n ) && n )
+ {
+ void* p = new BYTE[ 4096 ];
+ Seek( 0L );
+ rDest.Seek( 0L );
+ while( n )
+ {
+ INT32 nn = n;
+ if( nn > 4096 )
+ nn = 4096;
+ if( Read( p, nn ) != nn )
+ break;
+ if( rDest.Write( p, nn ) != nn )
+ break;
+ n -= nn;
+ }
+ delete p;
+ }
+}
+
+// Commit this entry
+
+BOOL StgDirEntry::Commit()
+{
+ aSave = aEntry;
+ BOOL bRes = TRUE;
+ if( aEntry.GetType() == STG_STREAM )
+ {
+ if( pTmpStrm )
+ delete pCurStrm, pCurStrm = pTmpStrm, pTmpStrm = NULL;
+ if( bRemoved )
+ // Delete the stream if needed
+ if( pStgStrm )
+ pStgStrm->SetSize( 0 );
+ }
+ else if( aEntry.GetType() == STG_STORAGE && bDirect && bRes )
+ {
+ StgIterator aIter( *this );
+ for( StgDirEntry* p = aIter.First(); p && bRes; p = aIter.Next() )
+ bRes = p->Commit();
+ }
+ return bRes;
+}
+
+// Revert the entry
+
+BOOL StgDirEntry::Revert()
+{
+ aEntry = aSave;
+ switch( aEntry.GetType() )
+ {
+ case STG_STREAM:
+ if( pCurStrm )
+ delete pTmpStrm, pTmpStrm = pCurStrm, pCurStrm = NULL;
+ break;
+ case STG_STORAGE:
+ {
+ BOOL bSomeRenamed = FALSE;
+ StgIterator aIter( *this );
+ StgDirEntry* p = aIter.First();
+ while( p )
+ {
+ p->aEntry = p->aSave;
+ p->bDirty = FALSE;
+ bSomeRenamed = BOOL( bSomeRenamed | p->bRenamed );
+ // Remove any new entries
+ if( p->bCreated )
+ {
+ p->bCreated = FALSE;
+ p->Close();
+ p->bInvalid = TRUE;
+ }
+ // Reactivate any removed entries
+ else if( p->bRemoved )
+ p->bRemoved = p->bInvalid = p->bTemp = FALSE;
+ p = aIter.Next();
+ }
+ // Resort all renamed entries
+ if( bSomeRenamed )
+ {
+ StgIterator aIter( *this );
+ StgDirEntry* p = aIter.First();
+ while( p )
+ {
+ if( p->bRenamed )
+ {
+ StgAvlNode::Move
+ ( (StgAvlNode**) &p->pUp->pDown,
+ (StgAvlNode**) &p->pUp->pDown, p );
+ p->bRenamed = FALSE;
+ }
+ p = aIter.Next();
+ }
+ }
+ DelTemp( FALSE );
+ break;
+ }
+ }
+ return TRUE;
+}
+
+// Copy the stg stream to the temp stream
+
+BOOL StgDirEntry::Strm2Tmp()
+{
+ if( !pTmpStrm )
+ {
+ ULONG n = 0;
+ if( pCurStrm )
+ {
+ // It was already commited once
+ pTmpStrm = new StgTmpStrm;
+ if( pTmpStrm->GetError() == SVSTREAM_OK && pTmpStrm->Copy( *pCurStrm ) )
+ return TRUE;
+ n = 1; // indicates error
+ }
+ else
+ {
+ n = aEntry.GetSize();
+ pTmpStrm = new StgTmpStrm( n );
+ if( pTmpStrm->GetError() == SVSTREAM_OK )
+ {
+ if( n )
+ {
+ void* p = new BYTE[ 4096 ];
+ pStgStrm->Pos2Page( 0L );
+ while( n )
+ {
+ ULONG nn = n;
+ if( nn > 4096 )
+ nn = 4096;
+ if( (ULONG) pStgStrm->Read( p, nn ) != nn )
+ break;
+ if( pTmpStrm->Write( p, nn ) != nn )
+ break;
+ n -= nn;
+ }
+ delete p;
+ pStgStrm->Pos2Page( nPos );
+ pTmpStrm->Seek( nPos );
+ }
+ }
+ else
+ n = 1;
+ }
+ if( n )
+ {
+ pStgStrm->GetIo().SetError( pTmpStrm->GetError() );
+ delete pTmpStrm;
+ pTmpStrm = NULL;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+// Copy the temp stream to the stg stream during the final commit
+
+BOOL StgDirEntry::Tmp2Strm()
+{
+ // We did commit once, but have not written since then
+ if( !pTmpStrm )
+ pTmpStrm = pCurStrm, pCurStrm = NULL;
+ if( pTmpStrm )
+ {
+ ULONG n = pTmpStrm->GetSize();
+ StgStrm* pNewStrm;
+ StgIo& rIo = pStgStrm->GetIo();
+ ULONG nThreshold = (ULONG) rIo.aHdr.GetThreshold();
+ if( n < nThreshold )
+ pNewStrm = new StgSmallStrm( rIo, STG_EOF, 0 );
+ else
+ pNewStrm = new StgDataStrm( rIo, STG_EOF, 0 );
+ if( pNewStrm->SetSize( n ) )
+ {
+ void* p = new BYTE[ 4096 ];
+ pTmpStrm->Seek( 0L );
+ while( n )
+ {
+ ULONG nn = n;
+ if( nn > 4096 )
+ nn = 4096;
+ if( pTmpStrm->Read( p, nn ) != nn )
+ break;
+ if( (ULONG) pNewStrm->Write( p, nn ) != nn )
+ break;
+ n -= nn;
+ }
+ delete p;
+ if( n )
+ {
+ pTmpStrm->Seek( nPos );
+ pStgStrm->GetIo().SetError( pTmpStrm->GetError() );
+ delete pNewStrm;
+ return FALSE;
+ }
+ else
+ {
+ pStgStrm->SetSize( 0L );
+ delete pStgStrm;
+ pStgStrm = pNewStrm;
+ pNewStrm->SetEntry( *this );
+ pNewStrm->Pos2Page( nPos );
+ delete pTmpStrm;
+ delete pCurStrm;
+ pTmpStrm = pCurStrm = NULL;
+ aSave = aEntry;
+ }
+ }
+ }
+ return TRUE;
+}
+
+// Check if the given entry is contained in this entry
+
+BOOL StgDirEntry::IsContained( StgDirEntry* pStg )
+{
+ if( aEntry.GetType() == STG_STORAGE )
+ {
+ StgIterator aIter( *this );
+ StgDirEntry* p = aIter.First();
+ while( p )
+ {
+ if( !p->aEntry.Compare( pStg->aEntry ) )
+ return FALSE;
+ if( p->aEntry.GetType() == STG_STORAGE )
+ if( !p->IsContained( pStg ) )
+ return FALSE;
+ p = aIter.Next();
+ }
+ }
+ return TRUE;
+}
+
+// Invalidate all open entries by setting the RefCount to 0. If the bDel
+// flag is set, also set the invalid flag to indicate deletion during the
+// next dir stream flush.
+
+void StgDirEntry::Invalidate( BOOL bDel )
+{
+// nRefCnt = 0;
+ if( bDel )
+ bRemoved = bInvalid = TRUE;
+ switch( aEntry.GetType() )
+ {
+ case STG_STORAGE:
+ case STG_ROOT:
+ {
+ StgIterator aIter( *this );
+ for( StgDirEntry* p = aIter.First(); p; p = aIter.Next() )
+ p->Invalidate( bDel );
+ break;
+ }
+ }
+}
+
+///////////////////////////// class StgDirStrm ////////////////////////////
+
+// This specialized stream is the maintenance stream for the directory tree.
+
+StgDirStrm::StgDirStrm( StgIo& r )
+ : StgDataStrm( r, r.aHdr.GetTOCStart(), -1 )
+ , pRoot( NULL )
+ , nEntries( 0 )
+{
+ if( r.GetError() )
+ return;
+ nEntries = nPageSize / STGENTRY_SIZE;
+ if( nStart == STG_EOF )
+ {
+ StgEntry aRoot;
+ aRoot.Init();
+ aRoot.SetName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Root Entry" ) ) );
+ aRoot.SetType( STG_ROOT );
+ pRoot = new StgDirEntry( aRoot );
+ pRoot->SetDirty();
+ }
+ else
+ {
+ // temporarily use this instance as owner, so
+ // the TOC pages can be removed.
+ pEntry = (StgDirEntry*) this; // just for a bit pattern
+ SetupEntry( 0, pRoot );
+ rIo.Revert( pEntry );
+ pEntry = NULL;
+ }
+}
+
+StgDirStrm::~StgDirStrm()
+{
+ delete pRoot;
+}
+
+// Recursively parse the directory tree during reading the TOC stream
+
+void StgDirStrm::SetupEntry( INT32 n, StgDirEntry* pUpper )
+{
+ void* p = ( n == STG_FREE ) ? NULL : GetEntry( n );
+ if( p )
+ {
+ BOOL bOk;
+ StgDirEntry* pCur = new StgDirEntry( p, &bOk );
+ if( !bOk )
+ {
+ delete pCur;
+ rIo.SetError( SVSTREAM_GENERALERROR );
+ // an error occured
+ return;
+ }
+
+ // better it is
+ if( !pUpper )
+ pCur->aEntry.SetType( STG_ROOT );
+
+ INT32 nLeft = pCur->aEntry.GetLeaf( STG_LEFT );
+ INT32 nRight = pCur->aEntry.GetLeaf( STG_RIGHT );
+ // substorage?
+ INT32 nLeaf = STG_FREE;
+ if( pCur->aEntry.GetType() == STG_STORAGE
+ || pCur->aEntry.GetType() == STG_ROOT )
+ nLeaf = pCur->aEntry.GetLeaf( STG_CHILD );
+ if( nLeaf != 0 && nLeft != 0 && nRight != 0 )
+ {
+ if( StgAvlNode::Insert
+ ( (StgAvlNode**) ( pUpper ? &pUpper->pDown : &pRoot ), pCur ) )
+ {
+ pCur->pUp = pUpper;
+ pCur->ppRoot = &pRoot;
+ }
+ else
+ {
+ rIo.SetError( SVSTREAM_CANNOT_MAKE );
+ delete pCur; pCur = NULL;
+ return;
+ }
+ SetupEntry( nLeft, pUpper );
+ SetupEntry( nRight, pUpper );
+ SetupEntry( nLeaf, pCur );
+ }
+ }
+}
+
+// Extend or shrink the directory stream.
+
+BOOL StgDirStrm::SetSize( INT32 nBytes )
+{
+ // Always allocate full pages
+ nBytes = ( ( nBytes + nPageSize - 1 ) / nPageSize ) * nPageSize;
+ return StgStrm::SetSize( nBytes );
+}
+
+// Save the TOC stream into a new substream after saving all data streams
+
+BOOL StgDirStrm::Store()
+{
+ if( !pRoot->IsDirty() )
+ return TRUE;
+ if( !pRoot->StoreStreams( rIo ) )
+ return FALSE;
+ // After writing all streams, the data FAT stream has changed,
+ // so we have to commit the root again
+ pRoot->Commit();
+ // We want a completely new stream, so fake an empty stream
+ INT32 nOldStart = nStart; // save for later deletion
+ INT32 nOldSize = nSize;
+ nStart = nPage = STG_EOF;
+ nSize = nPos = 0;
+ nOffset = 0;
+ // Delete all temporary entries
+ pRoot->DelTemp( FALSE );
+ // set the entry numbers
+ INT32 n = 0;
+ pRoot->Enum( n );
+ if( !SetSize( n * STGENTRY_SIZE ) )
+ {
+ nStart = nOldStart; nSize = nOldSize;
+ pRoot->RevertAll();
+ return FALSE;
+ }
+ // set up the cache elements for the new stream
+ if( !Copy( STG_FREE, nSize ) )
+ {
+ pRoot->RevertAll();
+ return FALSE;
+ }
+ // Write the data to the new stream
+ if( !pRoot->Store( *this ) )
+ {
+ pRoot->RevertAll();
+ return FALSE;
+ }
+ // fill any remaining entries with empty data
+ INT32 ne = nSize / STGENTRY_SIZE;
+ StgEntry aEmpty;
+ aEmpty.Init();
+ while( n < ne )
+ {
+ void* p = GetEntry( n++, TRUE );
+ if( !p )
+ {
+ pRoot->RevertAll();
+ return FALSE;
+ }
+ aEmpty.Store( p );
+ }
+ // Now we can release the old stream
+ pFat->FreePages( nOldStart, TRUE );
+ rIo.aHdr.SetTOCStart( nStart );
+ return TRUE;
+}
+
+// Get a dir entry.
+
+void* StgDirStrm::GetEntry( INT32 n, BOOL bDirty )
+{
+ n *= STGENTRY_SIZE;
+ if( n >= nSize )
+ return NULL;
+ return GetPtr( n, TRUE, bDirty );
+}
+
+// Find a dir entry.
+
+StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const String& rName )
+{
+ if( rStg.pDown )
+ {
+ StgEntry aEntry;
+ aEntry.Init();
+ if( !aEntry.SetName( rName ) )
+ {
+ rIo.SetError( SVSTREAM_GENERALERROR );
+ return NULL;
+ }
+ // Look in the directory attached to the entry
+ StgDirEntry aTest( aEntry );
+ return (StgDirEntry*) rStg.pDown->Find( &aTest );
+ }
+ else
+ return NULL;
+}
+
+// Create a new entry.
+
+StgDirEntry* StgDirStrm::Create
+ ( StgDirEntry& rStg, const String& rName, StgEntryType eType )
+{
+ StgEntry aEntry;
+ aEntry.Init();
+ aEntry.SetType( eType );
+ if( !aEntry.SetName( rName ) )
+ {
+ rIo.SetError( SVSTREAM_GENERALERROR );
+ return NULL;
+ }
+ StgDirEntry* pRes = Find( rStg, rName );
+ if( pRes )
+ {
+ if( !pRes->bInvalid )
+ {
+ rIo.SetError( SVSTREAM_CANNOT_MAKE );
+ return NULL;
+ }
+ pRes->bInvalid =
+ pRes->bRemoved =
+ pRes->bTemp = FALSE;
+ pRes->bCreated =
+ pRes->bDirty = TRUE;
+ }
+ else
+ {
+ pRes = new StgDirEntry( aEntry );
+ if( StgAvlNode::Insert( (StgAvlNode**) &rStg.pDown, pRes ) )
+ {
+ pRes->pUp = &rStg;
+ pRes->ppRoot = &pRoot;
+ pRes->bCreated =
+ pRes->bDirty = TRUE;
+ }
+ else
+ {
+ rIo.SetError( SVSTREAM_CANNOT_MAKE );
+ delete pRes; pRes = NULL;
+ }
+ }
+ return pRes;
+}
+
+// Rename the given entry.
+
+BOOL StgDirStrm::Rename( StgDirEntry& rStg, const String& rOld, const String& rNew )
+{
+ StgDirEntry* p = Find( rStg, rOld );
+ if( p )
+ {
+
+ if( !StgAvlNode::Remove( (StgAvlNode**) &rStg.pDown, p, FALSE ) )
+ return FALSE;
+ p->aEntry.SetName( rNew );
+ if( !StgAvlNode::Insert( (StgAvlNode**) &rStg.pDown, p ) )
+ return FALSE;
+ p->bRenamed = p->bDirty = TRUE;
+ return TRUE;
+ }
+ else
+ {
+ rIo.SetError( SVSTREAM_FILE_NOT_FOUND );
+ return FALSE;
+ }
+}
+
+// Move the given entry to a different storage.
+
+BOOL StgDirStrm::Move( StgDirEntry& rStg1, StgDirEntry& rStg2, const String& rName )
+{
+ StgDirEntry* p = Find( rStg1, rName );
+ if( p )
+ {
+ if( !StgAvlNode::Move
+ ( (StgAvlNode**) &rStg1.pDown, (StgAvlNode**) &rStg2.pDown, p ) )
+ return FALSE;
+ p->bDirty = TRUE;
+ return TRUE;
+ }
+ else
+ {
+ rIo.SetError( SVSTREAM_FILE_NOT_FOUND );
+ return FALSE;
+ }
+}
+
diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx
new file mode 100644
index 000000000000..44b1614a590f
--- /dev/null
+++ b/sot/source/sdstor/stgdir.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgdir.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STGDIR_HXX
+#define _STGDIR_HXX
+
+#ifndef _STGAVL_HXX
+#include "stgavl.hxx"
+#endif
+#ifndef _STGELEM_HXX
+#include "stgelem.hxx"
+#endif
+#ifndef _STGSTRMS_HXX
+#include "stgstrms.hxx"
+#endif
+
+class StgIo;
+class StgEntry;
+class StgDirEntry;
+class StgDirStrm;
+
+class StgDirEntry : public StgAvlNode
+{
+ friend class StgIterator;
+ friend class StgDirStrm;
+ StgEntry aSave; // original dir entry
+ StgDirEntry* pUp; // parent directory
+ StgDirEntry* pDown; // child directory for storages
+ StgDirEntry** ppRoot; // root of TOC tree
+ StgStrm* pStgStrm; // storage stream
+ StgTmpStrm* pTmpStrm; // temporary stream
+ StgTmpStrm* pCurStrm; // temp stream after commit
+ INT32 nEntry; // entry # in TOC stream (temp)
+ INT32 nPos; // current position
+ BOOL bDirty; // dirty directory entry
+ BOOL bCreated; // newly created entry
+ BOOL bRemoved; // removed per Invalidate()
+ BOOL bRenamed; // renamed
+ void InitMembers(); // ctor helper
+ virtual short Compare( const StgAvlNode* ) const;
+ BOOL StoreStream( StgIo& ); // store the stream
+ BOOL StoreStreams( StgIo& ); // store all streams
+ void RevertAll(); // revert the whole tree
+ BOOL Strm2Tmp(); // copy stgstream to temp file
+ BOOL Tmp2Strm(); // copy temp file to stgstream
+public:
+ StgEntry aEntry; // entry data
+ INT32 nRefCnt; // reference count
+ StreamMode nMode; // open mode
+ BOOL bTemp; // TRUE: delete on dir flush
+ BOOL bDirect; // TRUE: direct mode
+ BOOL bZombie; // TRUE: Removed From StgIo
+ BOOL bInvalid; // TRUE: invalid entry
+ StgDirEntry( const void*, BOOL * pbOk );
+ StgDirEntry( const StgEntry& );
+ ~StgDirEntry();
+
+ void Invalidate( BOOL=FALSE ); // invalidate all open entries
+ void Enum( INT32& ); // enumerate entries for iteration
+ void DelTemp( BOOL ); // delete temporary entries
+ BOOL Store( StgDirStrm& ); // save entry into dir strm
+ BOOL IsContained( StgDirEntry* ); // check if subentry
+
+ void SetDirty() { bDirty = TRUE; }
+ BOOL IsDirty();
+ void ClearDirty();
+
+ BOOL Commit();
+ BOOL Revert();
+
+ void OpenStream( StgIo&, BOOL=FALSE ); // set up an approbiate stream
+ void Close();
+ INT32 GetSize();
+ BOOL SetSize( INT32 );
+ INT32 Seek( INT32 );
+ INT32 Tell() { return nPos; }
+ INT32 Read( void*, INT32 );
+ INT32 Write( const void*, INT32 );
+ void Copy( StgDirEntry& );
+};
+
+class StgDirStrm : public StgDataStrm
+{
+ friend class StgIterator;
+ StgDirEntry* pRoot; // root of dir tree
+ short nEntries; // entries per page
+ void SetupEntry( INT32, StgDirEntry* );
+public:
+ StgDirStrm( StgIo& );
+ ~StgDirStrm();
+ virtual BOOL SetSize( INT32 ); // change the size
+ BOOL Store();
+ void* GetEntry( INT32 n, BOOL=FALSE );// get an entry
+ StgDirEntry* GetRoot() { return pRoot; }
+ StgDirEntry* Find( StgDirEntry&, const String& );
+ StgDirEntry* Create( StgDirEntry&, const String&, StgEntryType );
+ BOOL Remove( StgDirEntry&, const String& );
+ BOOL Rename( StgDirEntry&, const String&, const String& );
+ BOOL Move( StgDirEntry&, StgDirEntry&, const String& );
+};
+
+class StgIterator : public StgAvlIterator
+{
+public:
+ StgIterator( StgDirEntry& rStg ) : StgAvlIterator( rStg.pDown ) {}
+ StgDirEntry* First() { return (StgDirEntry*) StgAvlIterator::First(); }
+ StgDirEntry* Next() { return (StgDirEntry*) StgAvlIterator::Next(); }
+ StgDirEntry* Last() { return (StgDirEntry*) StgAvlIterator::Last(); }
+ StgDirEntry* Prev() { return (StgDirEntry*) StgAvlIterator::Prev(); }
+};
+
+#endif
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
new file mode 100644
index 000000000000..ef568aca861f
--- /dev/null
+++ b/sot/source/sdstor/stgelem.cxx
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgelem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h> // memset(), memcpy()
+#include <tools/intn.hxx>
+#include "stg.hxx"
+#include "stgelem.hxx"
+#include "stgcache.hxx"
+#include "stgstrms.hxx"
+#include "stgdir.hxx"
+#include "stgio.hxx"
+
+#pragma hdrstop
+
+static BYTE cStgSignature[ 8 ] = { 0xD0,0xCF,0x11,0xE0,0xA1,0xB1,0x1A,0xE1 };
+
+////////////////////////////// struct ClsId /////////////////////////////
+
+SvStream& operator >>( SvStream& r, ClsId& rId )
+{
+ r >> rId.n1
+ >> rId.n2
+ >> rId.n3
+ >> rId.n4
+ >> rId.n5
+ >> rId.n6
+ >> rId.n7
+ >> rId.n8
+ >> rId.n9
+ >> rId.n10
+ >> rId.n11;
+ return r;
+}
+
+SvStream& operator <<( SvStream& r, const ClsId& rId )
+{
+ return
+ r << (INT32) rId.n1
+ << (INT16) rId.n2
+ << (INT16) rId.n3
+ << (UINT8) rId.n4
+ << (UINT8) rId.n5
+ << (UINT8) rId.n6
+ << (UINT8) rId.n7
+ << (UINT8) rId.n8
+ << (UINT8) rId.n9
+ << (UINT8) rId.n10
+ << (UINT8) rId.n11;
+}
+
+///////////////////////////// class StgHeader ////////////////////////////
+
+StgHeader::StgHeader()
+{
+ memset( this, 0, sizeof( StgHeader ) );
+}
+
+void StgHeader::Init()
+{
+ memset( this, 0, sizeof( StgHeader ) );
+ memcpy( cSignature, cStgSignature, 8 );
+ nVersion = 0x0003003B;
+ nByteOrder = 0xFFFE;
+ nPageSize = 9; // 512 bytes
+ nDataPageSize = 6; // 64 bytes
+ nThreshold = 4096;
+ nDataFATSize = 0;
+ nMasterChain = STG_EOF;
+ SetTOCStart( STG_EOF );
+ SetDataFATStart( STG_EOF );
+ for( short i = 0; i < 109; i++ )
+ SetFATPage( i, STG_FREE );
+}
+
+BOOL StgHeader::Load( StgIo& rIo )
+{
+ SvStream& r = *rIo.GetStrm();
+ r.Seek( 0L );
+ r.Read( cSignature, 8 );
+ r >> aClsId // 08 Class ID
+ >> nVersion // 1A version number
+ >> nByteOrder // 1C Unicode byte order indicator
+ >> nPageSize // 1E 1 << nPageSize = block size
+ >> nDataPageSize; // 20 1 << this size == data block size
+ r.SeekRel( 10 );
+ r >> nFATSize // 2C total number of FAT pages
+ >> nTOCstrm // 30 starting page for the TOC stream
+ >> nReserved // 34
+ >> nThreshold // 38 minimum file size for big data
+ >> nDataFAT // 3C page # of 1st data FAT block
+ >> nDataFATSize // 40 # of data FATpages
+ >> nMasterChain // 44 chain to the next master block
+ >> nMaster; // 48 # of additional master blocks
+ for( short i = 0; i < 109; i++ )
+ r >> nMasterFAT[ i ];
+ return rIo.Good();
+}
+
+BOOL StgHeader::Store( StgIo& rIo )
+{
+ if( !bDirty )
+ return TRUE;
+ SvStream& r = *rIo.GetStrm();
+ r.Seek( 0L );
+ r.Write( cSignature, 8 + 16 );
+ r << nVersion // 1A version number
+ << nByteOrder // 1C Unicode byte order indicator
+ << nPageSize // 1E 1 << nPageSize = block size
+ << nDataPageSize // 20 1 << this size == data block size
+ << (INT32) 0 << (INT32) 0 << (INT16) 0
+ << nFATSize // 2C total number of FAT pages
+ << nTOCstrm // 30 starting page for the TOC stream
+ << nReserved // 34
+ << nThreshold // 38 minimum file size for big data
+ << nDataFAT // 3C page # of 1st data FAT block
+ << nDataFATSize // 40 # of data FAT pages
+ << nMasterChain // 44 chain to the next master block
+ << nMaster; // 48 # of additional master blocks
+ for( short i = 0; i < 109; i++ )
+ r << nMasterFAT[ i ];
+ bDirty = !rIo.Good();
+ return BOOL( !bDirty );
+}
+
+// Perform thorough checks also on unknown variables
+
+BOOL StgHeader::Check()
+{
+ return BOOL( memcmp( cSignature, cStgSignature, 8 ) == 0
+ && (short) ( nVersion >> 16 ) == 3 );
+}
+
+INT32 StgHeader::GetFATPage( short n ) const
+{
+ if( n >= 0 && n < 109 )
+ return nMasterFAT[ n ];
+ else
+ return STG_EOF;
+}
+
+void StgHeader::SetFATPage( short n, INT32 nb )
+{
+ if( n >= 0 && n < 109 )
+ {
+ if( nMasterFAT[ n ] != nb )
+ bDirty = TRUE, nMasterFAT[ n ] = nb;
+ }
+}
+
+void StgHeader::SetClassId( const ClsId& r )
+{
+ if( memcmp( &aClsId, &r, sizeof( ClsId ) ) )
+ bDirty = TRUE, memcpy( &aClsId, &r, sizeof( ClsId ) );
+}
+
+void StgHeader::SetTOCStart( INT32 n )
+{
+ if( n != nTOCstrm ) bDirty = TRUE, nTOCstrm = n;
+}
+
+void StgHeader::SetDataFATStart( INT32 n )
+{
+ if( n != nDataFAT ) bDirty = TRUE, nDataFAT = n;
+}
+
+void StgHeader::SetDataFATSize( INT32 n )
+{
+ if( n != nDataFATSize ) bDirty = TRUE, nDataFATSize = n;
+}
+
+void StgHeader::SetFATSize( INT32 n )
+{
+ if( n != nFATSize ) bDirty = TRUE, nFATSize = n;
+}
+
+void StgHeader::SetFATChain( INT32 n )
+{
+ if( n != nMasterChain )
+ bDirty = TRUE, nMasterChain = n;
+}
+
+void StgHeader::SetMasters( INT32 n )
+{
+ if( n != nMaster ) bDirty = TRUE, nMaster = n;
+}
+
+///////////////////////////// class StgEntry /////////////////////////////
+
+// This class is only a wrapper around teh dir entry structure
+// which retrieves and sets data.
+
+// The name must be smaller than 32 chars. Conversion into Unicode
+// is easy, since the 1st 256 characters of the Windows ANSI set
+// equal the 1st 256 Unicode characters.
+/*
+void ToUnicode_Impl( String& rName )
+{
+ rName.Erase( 32 );
+ rName.Convert( ::GetSystemCharSet(), CHARSET_ANSI );
+ // brute force is OK
+ BYTE* p = (BYTE*) rName.GetCharStr();
+ for( USHORT i = 0; i < rName.Len(); i++, p++ )
+ {
+ // check each character and substitute blanks for illegal ones
+ BYTE cChar = *p;
+ if( cChar == '!' || cChar == ':' || cChar == '\\' || cChar == '/' )
+ *p = ' ';
+ }
+}
+*/
+/*
+static void FromUnicode( String& rName )
+{
+ rName.Convert( CHARSET_ANSI, ::GetSystemCharSet() );
+}
+*/
+BOOL StgEntry::Init()
+{
+ memset( this, 0, sizeof (StgEntry) - sizeof( String ) );
+ SetLeaf( STG_LEFT, STG_FREE );
+ SetLeaf( STG_RIGHT, STG_FREE );
+ SetLeaf( STG_CHILD, STG_FREE );
+ SetLeaf( STG_DATA, STG_EOF );
+ return TRUE;
+}
+
+static International* pInter = 0;
+
+inline International& GetInternational()
+{
+ return pInter ? *pInter : *(pInter = new International);
+}
+
+BOOL StgEntry::SetName( const String& rName )
+{
+ const International& aInter = GetInternational();
+ // make upper case character in current language
+ aName = rName;
+ aName.Erase( 31 );
+ aInter.ToUpper( aName );
+ //ToUnicode_Impl( aNameStr );
+
+ int i;
+ for( i = 0; i < aName.Len() && i < 32; i++ )
+ nName[ i ] = rName.GetChar( i );
+ while( i < 32 )
+ nName[ i++ ] = 0;
+ nNameLen = ( aName.Len() + 1 ) << 1;
+ return TRUE;
+}
+
+INT32 StgEntry::GetLeaf( StgEntryRef eRef ) const
+{
+ INT32 n = -1;
+ switch( eRef )
+ {
+ case STG_LEFT: n = nLeft; break;
+ case STG_RIGHT: n = nRight; break;
+ case STG_CHILD: n = nChild; break;
+ case STG_DATA: n = nPage1; break;
+ }
+ return n;
+}
+
+void StgEntry::SetLeaf( StgEntryRef eRef, INT32 nPage )
+{
+ switch( eRef )
+ {
+ case STG_LEFT: nLeft = nPage; break;
+ case STG_RIGHT: nRight = nPage; break;
+ case STG_CHILD: nChild = nPage; break;
+ case STG_DATA: nPage1 = nPage; break;
+ }
+}
+
+const INT32* StgEntry::GetTime( StgEntryTime eTime ) const
+{
+ return( eTime == STG_MODIFIED ) ? nMtime : nAtime;
+}
+
+void StgEntry::SetTime( StgEntryTime eTime, INT32* pTime )
+{
+ if( eTime == STG_MODIFIED )
+ nMtime[ 0 ] = *pTime++, nMtime[ 1 ] = *pTime;
+ else
+ nAtime[ 0 ] = *pTime++, nAtime[ 1 ] = *pTime;
+}
+
+void StgEntry::SetClassId( const ClsId& r )
+{
+ memcpy( &aClsId, &r, sizeof( ClsId ) );
+}
+
+void StgEntry::GetName( String& rName ) const
+{
+ UINT16 n = nNameLen;
+ if( n )
+ n = ( n >> 1 ) - 1;
+ rName = String( nName, n );
+}
+
+// Compare two entries. Do this case-insensitive.
+
+short StgEntry::Compare( const StgEntry& r ) const
+{
+ /*
+ short nRes = r.nNameLen - nNameLen;
+ if( !nRes ) return strcmp( r.aName, aName );
+ else return nRes;
+ */
+ sal_Int32 nRes = r.nNameLen - nNameLen;
+ if( !nRes )
+ nRes = r.aName.CompareTo( aName );
+ return (short)nRes;
+ //return aName.CompareTo( r.aName );
+}
+
+// These load/store operations are a bit more complicated,
+// since they have to copy their contents into a packed structure.
+
+BOOL StgEntry::Load( const void* pFrom )
+{
+ SvMemoryStream r( (sal_Char*) pFrom, 128, STREAM_READ );
+ for( short i = 0; i < 32; i++ )
+ r >> nName[ i ]; // 00 name as WCHAR
+ r >> nNameLen // 40 size of name in bytes including 00H
+ >> cType // 42 entry type
+ >> cFlags // 43 0 or 1 (tree balance?)
+ >> nLeft // 44 left node entry
+ >> nRight // 48 right node entry
+ >> nChild // 4C 1st child entry if storage
+ >> aClsId // 50 class ID (optional)
+ >> nFlags // 60 state flags(?)
+ >> nMtime[ 0 ] // 64 modification time
+ >> nMtime[ 1 ] // 64 modification time
+ >> nAtime[ 0 ] // 6C creation and access time
+ >> nAtime[ 1 ] // 6C creation and access time
+ >> nPage1 // 74 starting block (either direct or translated)
+ >> nSize // 78 file size
+ >> nUnknown; // 7C unknown
+
+ UINT16 n = nNameLen;
+ if( n )
+ n = ( n >> 1 ) - 1;
+ if( n > 31 )
+ return FALSE;
+
+ aName = String( nName, n );
+ const International& aInter = GetInternational();
+ aInter.ToUpper( aName );
+ return TRUE;
+}
+
+void StgEntry::Store( void* pTo )
+{
+ SvMemoryStream r( (sal_Char *)pTo, 128, STREAM_WRITE );
+ for( short i = 0; i < 32; i++ )
+ r << nName[ i ]; // 00 name as WCHAR
+ r << nNameLen // 40 size of name in bytes including 00H
+ << cType // 42 entry type
+ << cFlags // 43 0 or 1 (tree balance?)
+ << nLeft // 44 left node entry
+ << nRight // 48 right node entry
+ << nChild // 4C 1st child entry if storage;
+ << aClsId // 50 class ID (optional)
+ << nFlags // 60 state flags(?)
+ << nMtime[ 0 ] // 64 modification time
+ << nMtime[ 1 ] // 64 modification time
+ << nAtime[ 0 ] // 6C creation and access time
+ << nAtime[ 1 ] // 6C creation and access time
+ << nPage1 // 74 starting block (either direct or translated)
+ << nSize // 78 file size
+ << nUnknown; // 7C unknown
+}
+
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
new file mode 100644
index 000000000000..8273eb35b991
--- /dev/null
+++ b/sot/source/sdstor/stgelem.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgelem.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// This file reflects the structure of MS file elements.
+// It is very sensitive to alignment!
+
+#ifndef _STGELEM_HXX
+#define _STGELEM_HXX
+
+#ifndef _TOOLS_SOLAR_H
+#include <tools/solar.h>
+#endif
+
+class StgIo;
+class SvStream;
+class String;
+
+struct ClsId
+{
+ INT32 n1;
+ INT16 n2, n3;
+ UINT8 n4, n5, n6, n7, n8, n9, n10, n11;
+};
+
+SvStream& operator>>( SvStream&, ClsId& );
+SvStream& operator<<( SvStream&, const ClsId& );
+
+class StgHeader
+{
+ BYTE cSignature[ 8 ]; // 00 signature (see below)
+ ClsId aClsId; // 08 Class ID
+ INT32 nVersion; // 18 version number
+ UINT16 nByteOrder; // 1C Unicode byte order indicator
+ INT16 nPageSize; // 1E 1 << nPageSize = block size
+ INT16 nDataPageSize; // 20 1 << this size == data block size
+ BYTE bDirty; // 22 internal dirty flag
+ BYTE cReserved[ 9 ]; // 23
+ INT32 nFATSize; // 2C total number of FAT pages
+ INT32 nTOCstrm; // 30 starting page for the TOC stream
+ INT32 nReserved; // 34
+ INT32 nThreshold; // 38 minimum file size for big data
+ INT32 nDataFAT; // 3C page # of 1st data FAT block
+ INT32 nDataFATSize; // 40 # of data fat blocks
+ INT32 nMasterChain; // 44 chain to the next master block
+ INT32 nMaster; // 48 # of additional master blocks
+ INT32 nMasterFAT[ 109 ]; // 4C first 109 master FAT pages
+public:
+ StgHeader();
+ void Init(); // initialize the header
+ BOOL Load( StgIo& );
+ BOOL Store( StgIo& );
+ BOOL Check(); // check the signature and version
+ short GetByteOrder() const { return nByteOrder; }
+ INT32 GetTOCStart() const { return nTOCstrm; }
+ void SetTOCStart( INT32 n );
+ INT32 GetDataFATStart() const { return nDataFAT; }
+ void SetDataFATStart( INT32 n );
+ INT32 GetDataFATSize() const { return nDataFATSize; }
+ void SetDataFATSize( INT32 n );
+ INT32 GetThreshold() const { return nThreshold; }
+ short GetPageSize() const { return nPageSize; }
+ short GetDataPageSize() const { return nDataPageSize; }
+ INT32 GetFATSize() const { return nFATSize; }
+ void SetFATSize( INT32 n );
+ INT32 GetFATChain() const { return nMasterChain; }
+ void SetFATChain( INT32 n );
+ INT32 GetMasters() const { return nMaster; }
+ void SetMasters( INT32 n );
+ short GetFAT1Size() const { return 109; }
+ const ClsId& GetClassId() const { return aClsId; }
+ void SetClassId( const ClsId& );
+ INT32 GetFATPage( short ) const;
+ void SetFATPage( short, INT32 );
+};
+
+enum StgEntryType { // dir entry types:
+ STG_EMPTY = 0,
+ STG_STORAGE = 1,
+ STG_STREAM = 2,
+ STG_LOCKBYTES = 3,
+ STG_PROPERTY = 4,
+ STG_ROOT = 5
+};
+
+enum StgEntryRef { // reference blocks:
+ STG_LEFT = 0, // left
+ STG_RIGHT = 1, // right
+ STG_CHILD = 2, // child
+ STG_DATA = 3 // data start
+};
+
+enum StgEntryTime { // time codes:
+ STG_MODIFIED = 0, // last modification
+ STG_ACCESSED = 1 // last access
+};
+
+class StgStream;
+
+#define STGENTRY_SIZE 128
+
+class StgEntry { // directory enty
+ UINT16 nName[ 32 ]; // 00 name as WCHAR
+ INT16 nNameLen; // 40 size of name in bytes including 00H
+ BYTE cType; // 42 entry type
+ BYTE cFlags; // 43 0 or 1 (tree balance?)
+ INT32 nLeft; // 44 left node entry
+ INT32 nRight; // 48 right node entry
+ INT32 nChild; // 4C 1st child entry if storage
+ ClsId aClsId; // 50 class ID (optional)
+ INT32 nFlags; // 60 state flags(?)
+ INT32 nMtime[ 2 ]; // 64 modification time
+ INT32 nAtime[ 2 ]; // 6C creation and access time
+ INT32 nPage1; // 74 starting block (either direct or translated)
+ INT32 nSize; // 78 file size
+ INT32 nUnknown; // 7C unknown
+ String aName; // Name as Compare String (ascii, upper)
+public:
+ BOOL Init(); // initialize the data
+ BOOL SetName( const String& ); // store a name (ASCII, up to 32 chars)
+ void GetName( String& rName ) const;
+ // fill in the name
+ short Compare( const StgEntry& ) const; // compare two entries
+ BOOL Load( const void* );
+ void Store( void* );
+ StgEntryType GetType() const { return (StgEntryType) cType; }
+ INT32 GetStartPage() const { return nPage1; }
+ void SetType( StgEntryType t ) { cType = (BYTE) t; }
+ BYTE GetFlags() const { return cFlags; }
+ void SetFlags( BYTE c ) { cFlags = c; }
+ INT32 GetSize() const { return nSize; }
+ void SetSize( INT32 n ) { nSize = n; }
+ const ClsId& GetClassId() const { return aClsId; }
+ void SetClassId( const ClsId& );
+ INT32 GetLeaf( StgEntryRef ) const;
+ void SetLeaf( StgEntryRef, INT32 );
+ const INT32* GetTime( StgEntryTime ) const;
+ void SetTime( StgEntryTime, INT32* );
+};
+
+
+#define STG_FREE -1L // page is free
+#define STG_EOF -2L // page is last page in chain
+#define STG_FAT -3L // page is FAT page
+#define STG_MASTER -4L // page is master FAT page
+
+#endif
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
new file mode 100644
index 000000000000..6b5e3e47758a
--- /dev/null
+++ b/sot/source/sdstor/stgio.cxx
@@ -0,0 +1,416 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgio.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "stg.hxx"
+#include "stgelem.hxx"
+#include "stgcache.hxx"
+#include "stgstrms.hxx"
+#include "stgdir.hxx"
+#include "stgio.hxx"
+#pragma hdrstop
+
+///////////////////////////// class StgIo //////////////////////////////
+
+// This class holds the storage header and all internal streams.
+
+StgIo::StgIo() : StgCache()
+{
+ pTOC = NULL;
+ pDataFAT = NULL;
+ pDataStrm = NULL;
+ pFAT = NULL;
+ bCopied = FALSE;
+}
+
+StgIo::~StgIo()
+{
+ delete pTOC;
+ delete pDataFAT;
+ delete pDataStrm;
+ delete pFAT;
+}
+
+// Load the header. Do not set an error code if the header is invalid.
+
+BOOL StgIo::Load()
+{
+ if( pStrm )
+ {
+ if( aHdr.Load( *this ) )
+ if( aHdr.Check() )
+ SetupStreams();
+ else
+ return FALSE;
+ }
+ return Good();
+}
+
+// Set up an initial, empty storage
+
+BOOL StgIo::Init()
+{
+ aHdr.Init();
+ SetupStreams();
+ return CommitAll();
+}
+
+void StgIo::SetupStreams()
+{
+ delete pTOC;
+ delete pDataFAT;
+ delete pDataStrm;
+ delete pFAT;
+ pTOC = NULL;
+ pDataFAT = NULL;
+ pDataStrm = NULL;
+ pFAT = NULL;
+ ResetError();
+ SetPhysPageSize( 1 << aHdr.GetPageSize() );
+ pFAT = new StgFATStrm( *this );
+ pTOC = new StgDirStrm( *this );
+ if( !GetError() )
+ {
+ StgDirEntry* pRoot = pTOC->GetRoot();
+ if( pRoot )
+ {
+ pDataFAT = new StgDataStrm( *this, aHdr.GetDataFATStart(), -1 );
+ pDataStrm = new StgDataStrm( *this, pRoot );
+ pDataFAT->SetIncrement( 1 << aHdr.GetPageSize() );
+ pDataStrm->SetIncrement( GetDataPageSize() );
+ pDataStrm->SetEntry( *pRoot );
+ }
+ else
+ SetError( SVSTREAM_FILEFORMAT_ERROR );
+ }
+}
+
+// get the logical data page size
+
+short StgIo::GetDataPageSize()
+{
+ return 1 << aHdr.GetDataPageSize();
+}
+
+// Commit everything
+
+BOOL StgIo::CommitAll()
+{
+ // Store the data (all streams and the TOC)
+ if( pTOC->Store() )
+ {
+ if( Commit( NULL ) )
+ {
+ aHdr.SetDataFATStart( pDataFAT->GetStart() );
+ aHdr.SetDataFATSize( pDataFAT->GetPages() );
+ aHdr.SetTOCStart( pTOC->GetStart() );
+ if( aHdr.Store( *this ) )
+ {
+ pStrm->Flush();
+ ULONG n = pStrm->GetError();
+ SetError( n );
+#ifdef DBG_UTIL
+ if( n==0 ) ValidateFATs();
+#endif
+ return BOOL( n == 0 );
+ }
+ }
+ }
+ SetError( SVSTREAM_WRITE_ERROR );
+ return FALSE;
+}
+
+
+class EasyFat
+{
+ INT32 *pFat;
+ BOOL *pFree;
+ INT32 nPages;
+ INT32 nPageSize;
+
+public:
+ EasyFat( StgIo & rIo, StgStrm *pFatStream, INT32 nPSize );
+ ~EasyFat() { delete pFat; delete pFree; }
+ INT32 GetPageSize() { return nPageSize; }
+ INT32 Count() { return nPages; }
+ INT32 operator[]( INT32 nOffset ) { return pFat[ nOffset ]; }
+
+ ULONG Mark( INT32 nPage, INT32 nCount, INT32 nExpect );
+ BOOL HasUnrefChains();
+};
+
+EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, INT32 nPSize )
+{
+ nPages = pFatStream->GetSize() >> 2;
+ nPageSize = nPSize;
+ pFat = new INT32[ nPages ];
+ pFree = new BOOL[ nPages ];
+
+ StgPage *pPage;
+ INT32 nFatPageSize = 1 << rIo.aHdr.GetPageSize() - 2;
+
+ for( INT32 nPage = 0; nPage < nPages; nPage++ )
+ {
+ if( ! (nPage % nFatPageSize) )
+ {
+ pFatStream->Pos2Page( nPage << 2 );
+ INT32 nPhysPage = pFatStream->GetPage();
+ pPage = rIo.Get( nPhysPage, TRUE );
+ }
+
+ pFat[ nPage ] = pPage->GetPage( ( nPage % nFatPageSize ) );
+ pFree[ nPage ] = TRUE;
+ }
+}
+
+BOOL EasyFat::HasUnrefChains()
+{
+ for( INT32 nPage = 0; nPage < nPages; nPage++ )
+ {
+ if( pFree[ nPage ] && pFat[ nPage ] != -1 )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+ULONG EasyFat::Mark( INT32 nPage, INT32 nCount, INT32 nExpect )
+{
+ if( nCount > 0 )
+ --nCount /= GetPageSize(), nCount++;
+
+ INT32 nCurPage = nPage;
+ while( nCount != 0 )
+ {
+ pFree[ nCurPage ] = FALSE;
+ nCurPage = pFat[ nCurPage ];
+ //Stream zu lang
+ if( nCurPage != nExpect && nCount == 1 )
+ return FAT_WRONGLENGTH;
+ //Stream zu kurz
+ if( nCurPage == nExpect && nCount != 1 && nCount != -1 )
+ return FAT_WRONGLENGTH;
+ // letzter Block bei Stream ohne Laenge
+ if( nCurPage == nExpect && nCount == -1 )
+ nCount = 1;
+ if( nCount != -1 )
+ nCount--;
+ // Naechster Block nicht in der FAT
+ if( nCount && ( nCurPage < 0 || nCurPage >= nPages ) )
+ return FAT_OUTOFBOUNDS;
+ }
+ return FAT_OK;
+}
+
+class Validator
+{
+ ULONG nError;
+
+ EasyFat aSmallFat;
+ EasyFat aFat;
+
+ StgIo &rIo;
+
+ ULONG ValidateMasterFATs();
+ ULONG ValidateDirectoryEntries();
+ ULONG FindUnrefedChains();
+ ULONG MarkAll( StgDirEntry *pEntry );
+
+public:
+
+ Validator( StgIo &rIo );
+ BOOL IsError() { return nError != 0; }
+};
+
+Validator::Validator( StgIo &rIoP )
+ : aSmallFat( rIoP, rIoP.pDataFAT, 1 << rIoP.aHdr.GetDataPageSize() ),
+ aFat( rIoP, rIoP.pFAT, 1 << rIoP.aHdr.GetPageSize() ),
+ rIo( rIoP )
+{
+ ULONG nErr = nError = FAT_OK;
+
+ if( ( nErr = ValidateMasterFATs() ) != FAT_OK )
+ nError = nErr;
+ else if( ( nErr = ValidateDirectoryEntries() ) != FAT_OK )
+ nError = nErr;
+ else if( ( nErr = FindUnrefedChains()) != FAT_OK )
+ nError = nErr;
+}
+
+ULONG Validator::ValidateMasterFATs()
+{
+ INT32 nCount = rIo.aHdr.GetFATSize();
+ ULONG nErr;
+ for( INT32 i = 0; i < nCount; i++ )
+ {
+ if( ( nErr = aFat.Mark(
+ rIo.pFAT->GetPage( i, FALSE ), aFat.GetPageSize(), -3 ))
+ != FAT_OK )
+ return nErr;
+ }
+ if( rIo.aHdr.GetMasters() )
+ if( ( nErr = aFat.Mark(
+ rIo.aHdr.GetFATChain( ), aFat.GetPageSize(), -4 )) != FAT_OK )
+ return nErr;
+ return FAT_OK;
+}
+
+ULONG Validator::MarkAll( StgDirEntry *pEntry )
+{
+ StgIterator aIter( *pEntry );
+ ULONG nErr = FAT_OK;
+ for( StgDirEntry* p = aIter.First(); p ; p = aIter.Next() )
+ {
+ if( p->aEntry.GetType() == STG_STORAGE )
+ {
+ nErr = MarkAll( p );
+ if( nErr != FAT_OK )
+ return nErr;
+ }
+ else
+ {
+ INT32 nSize = p->aEntry.GetSize();
+ if( nSize < rIo.aHdr.GetThreshold() )
+ nErr = aSmallFat.Mark( p->aEntry.GetStartPage(),nSize, -2 );
+ else
+ nErr = aFat.Mark( p->aEntry.GetStartPage(),nSize, -2 );
+ if( nErr != FAT_OK )
+ return nErr;
+ }
+ }
+ return FAT_OK;
+}
+
+ULONG Validator::ValidateDirectoryEntries()
+{
+ // Normale DirEntries
+ ULONG nErr = MarkAll( rIo.pTOC->GetRoot() );
+ if( nErr != FAT_OK )
+ return nErr;
+ // Small Data
+ nErr = aFat.Mark( rIo.pTOC->GetRoot()->aEntry.GetStartPage(),
+ rIo.pTOC->GetRoot()->aEntry.GetSize(), -2 );
+ if( nErr != FAT_OK )
+ return nErr;
+ // Small Data FAT
+ nErr = aFat.Mark(
+ rIo.aHdr.GetDataFATStart(),
+ rIo.aHdr.GetDataFATSize() * aFat.GetPageSize(), -2 );
+ if( nErr != FAT_OK )
+ return nErr;
+ // TOC
+ nErr = aFat.Mark(
+ rIo.aHdr.GetTOCStart(), -1, -2 );
+ return nErr;
+}
+
+ULONG Validator::FindUnrefedChains()
+{
+ if( aSmallFat.HasUnrefChains() ||
+ aFat.HasUnrefChains() )
+ return FAT_UNREFCHAIN;
+ else
+ return FAT_OK;
+}
+
+Link StgIo::aErrorLink;
+
+void StgIo::SetErrorLink( const Link& rLink )
+{
+ aErrorLink = rLink;
+}
+
+ULONG StgIo::ValidateFATs()
+{
+ if( bFile )
+ {
+ Validator *pV = new Validator( *this );
+ BOOL bRet1 = !pV->IsError(), bRet2 = TRUE ;
+ delete pV;
+ SvFileStream *pFileStrm = ( SvFileStream *) GetStrm();
+ StgIo aIo;
+ if( aIo.Open( pFileStrm->GetFileName(),
+ STREAM_READ | STREAM_SHARE_DENYNONE) &&
+ aIo.Load() )
+ {
+ pV = new Validator( aIo );
+ bRet2 = !pV->IsError();
+ delete pV;
+ }
+
+ ULONG nErr;
+ if( bRet1 != bRet2 )
+ nErr = bRet1 ? FAT_ONFILEERROR : FAT_INMEMORYERROR;
+ else nErr = bRet1 ? FAT_OK : FAT_BOTHERROR;
+ if( nErr != FAT_OK && !bCopied )
+ {
+ StgLinkArg aArg;
+ aArg.aFile = pFileStrm->GetFileName();
+ aArg.nErr = nErr;
+ aErrorLink.Call( &aArg );
+ bCopied = TRUE;
+ }
+// DBG_ASSERT( nErr == FAT_OK ,"Storage kaputt");
+ return nErr;
+ }
+// DBG_ERROR("Validiere nicht (kein FileStorage)");
+ return FAT_OK;
+}
+
+
diff --git a/sot/source/sdstor/stgio.hxx b/sot/source/sdstor/stgio.hxx
new file mode 100644
index 000000000000..3418cd013415
--- /dev/null
+++ b/sot/source/sdstor/stgio.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgio.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STGIO_HXX
+#define _STGIO_HXX
+
+#ifndef _STGCACHE_HXX
+#include <stgcache.hxx>
+#endif
+#ifndef _STGELEM_HXX
+#include <stgelem.hxx>
+#endif
+#ifndef _TOOLS_STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+class StgFATStrm;
+class StgDataStrm;
+class StgDirStrm;
+class String;
+
+enum FAT_ERROR
+{
+ FAT_OK,
+ FAT_WRONGLENGTH,
+ FAT_UNREFCHAIN,
+ FAT_OVERWRITE,
+ FAT_OUTOFBOUNDS,
+
+ FAT_INMEMORYERROR,
+ FAT_ONFILEERROR,
+ FAT_BOTHERROR
+};
+
+struct StgLinkArg
+{
+ String aFile;
+ ULONG nErr;
+};
+
+class StgIo : public StgCache {
+ void SetupStreams(); // load all internal streams
+ BOOL bCopied;
+public:
+ StgIo();
+ ~StgIo();
+ StgHeader aHdr; // storage file header
+ StgFATStrm* pFAT; // FAT stream
+ StgDirStrm* pTOC; // TOC stream
+ StgDataStrm* pDataFAT; // small data FAT stream
+ StgDataStrm* pDataStrm; // small data stream
+ short GetDataPageSize(); // get the logical data page size
+ BOOL Load(); // load a storage file
+ BOOL Init(); // set up an empty file
+ BOOL CommitAll(); // commit everything (root commit)
+
+ static Link aErrorLink;
+ static void SetErrorLink( const Link& );
+ static const Link& GetErrorLink() { return aErrorLink; }
+ ULONG ValidateFATs( );
+};
+
+#endif
diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
new file mode 100644
index 000000000000..6551754d3c00
--- /dev/null
+++ b/sot/source/sdstor/stgole.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgole.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "rtl/string.h"
+#include "rtl/string.h"
+#include "stgole.hxx"
+#include "storinfo.hxx" // Read/WriteClipboardFormat()
+#pragma hdrstop
+
+///////////////////////// class StgInternalStream ////////////////////////
+
+StgInternalStream::StgInternalStream
+ ( Storage& rStg, const String& rName, BOOL bWr )
+{
+ bIsWritable = TRUE;
+ USHORT nMode = bWr
+ ? STREAM_WRITE | STREAM_SHARE_DENYALL
+ : STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE;
+ pStrm = rStg.OpenStream( rName, nMode );
+ // set the error code right here in the stream
+ SetError( rStg.GetError() );
+ SetBufferSize( 1024 );
+}
+
+StgInternalStream::~StgInternalStream()
+{
+ delete pStrm;
+}
+
+ULONG StgInternalStream::GetData( void* pData, ULONG nSize )
+{
+ if( pStrm )
+ {
+ nSize = pStrm->Read( pData, nSize );
+ SetError( pStrm->GetError() );
+ return nSize;
+ }
+ else
+ return 0;
+}
+
+ULONG StgInternalStream::PutData( const void* pData, ULONG nSize )
+{
+ if( pStrm )
+ {
+ nSize = pStrm->Write( pData, nSize );
+ SetError( pStrm->GetError() );
+ return nSize;
+ }
+ else
+ return 0;
+}
+
+ULONG StgInternalStream::SeekPos( ULONG nPos )
+{
+ return pStrm ? pStrm->Seek( nPos ) : 0;
+}
+
+void StgInternalStream::FlushData()
+{
+ if( pStrm )
+ {
+ pStrm->Flush();
+ SetError( pStrm->GetError() );
+ }
+}
+
+void StgInternalStream::Commit()
+{
+ Flush();
+ pStrm->Commit();
+}
+
+///////////////////////// class StgCompObjStream /////////////////////////
+
+StgCompObjStream::StgCompObjStream( Storage& rStg, BOOL bWr )
+ : StgInternalStream( rStg, String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\1CompObj" ) ), bWr )
+{
+ memset( &aClsId, 0, sizeof( ClsId ) );
+ nCbFormat = 0;
+}
+
+BOOL StgCompObjStream::Load()
+{
+ memset( &aClsId, 0, sizeof( ClsId ) );
+ nCbFormat = 0;
+ aUserName.Erase();
+ if( GetError() != SVSTREAM_OK )
+ return FALSE;
+ Seek( 8L ); // skip the first part
+ INT32 nMarker = 0;
+ *this >> nMarker;
+ if( nMarker == -1L )
+ {
+ *this >> aClsId;
+ INT32 nLen1 = 0;
+ *this >> nLen1;
+ sal_Char* p = new sal_Char[ (USHORT) nLen1 ];
+ if( Read( p, nLen1 ) == (ULONG) nLen1 )
+ {
+ aUserName = String( p, gsl_getSystemTextEncoding() );
+/* // Now we can read the CB format
+ INT32 nLen2 = 0;
+ *this >> nLen2;
+ if( nLen2 > 0 )
+ {
+ // get a string name
+ if( nLen2 > nLen1 )
+ delete p, p = new char[ nLen2 ];
+ if( Read( p, nLen2 ) == (ULONG) nLen2 )
+ nCbFormat = Exchange::RegisterFormatName( String( p ) );
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ }
+ else if( nLen2 == -1L )
+ // Windows clipboard format
+ *this >> nCbFormat;
+ else
+ // unknown identifier
+ SetError( SVSTREAM_GENERALERROR );
+*/
+ nCbFormat = ReadClipboardFormat( *this );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ delete p;
+ }
+ return BOOL( GetError() == SVSTREAM_OK );
+}
+
+BOOL StgCompObjStream::Store()
+{
+ if( GetError() != SVSTREAM_OK )
+ return FALSE;
+ Seek( 0L );
+ ByteString aAsciiUserName( aUserName, RTL_TEXTENCODING_ASCII_US );
+ *this << (INT16) 1 // Version?
+ << (INT16) 0xFFFE // Byte Order Indicator
+ << (INT32) 0x0A03 // Windows 3.10
+ << (INT32) -1L
+ << aClsId // Class ID
+ << (INT32) (aAsciiUserName.Len() + 1)
+ << (const char *)aAsciiUserName.GetBuffer()
+ << (UINT8) 0; // string terminator
+/* // determine the clipboard format string
+ String aCbFmt;
+ if( nCbFormat > FORMAT_GDIMETAFILE )
+ aCbFmt = Exchange::GetFormatName( nCbFormat );
+ if( aCbFmt.Len() )
+ *this << (INT32) aCbFmt.Len() + 1
+ << (const char*) aCbFmt
+ << (UINT8) 0;
+ else if( nCbFormat )
+ *this << (INT32) -1 // for Windows
+ << (INT32) nCbFormat;
+ else
+ *this << (INT32) 0; // no clipboard format
+*/
+ WriteClipboardFormat( *this, nCbFormat );
+ *this << (INT32) 0; // terminator
+ Commit();
+ return BOOL( GetError() == SVSTREAM_OK );
+}
+
+/////////////////////////// class StgOleStream ///////////////////////////
+
+StgOleStream::StgOleStream( Storage& rStg, BOOL bWr )
+ : StgInternalStream( rStg, String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\1Ole" ) ), bWr )
+{
+ nFlags = 0;
+}
+
+BOOL StgOleStream::Load()
+{
+ nFlags = 0;
+ if( GetError() != SVSTREAM_OK )
+ return FALSE;
+ INT32 nVersion = 0;
+ Seek( 0L );
+ *this >> nVersion >> nFlags;
+ return BOOL( GetError() == SVSTREAM_OK );
+}
+
+BOOL StgOleStream::Store()
+{
+ if( GetError() != SVSTREAM_OK )
+ return FALSE;
+ Seek( 0L );
+ *this << (INT32) 0x02000001 // OLE version, format
+ << (INT32) nFlags // Object flags
+ << (INT32) 0 // Update Options
+ << (INT32) 0 // reserved
+ << (INT32) 0; // Moniker 1
+ Commit();
+ return BOOL( GetError() == SVSTREAM_OK );
+}
+
diff --git a/sot/source/sdstor/stgole.hxx b/sot/source/sdstor/stgole.hxx
new file mode 100644
index 000000000000..7356bccff445
--- /dev/null
+++ b/sot/source/sdstor/stgole.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgole.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SDSTOR_STGOLE_HXX
+#define _SDSTOR_STGOLE_HXX
+
+#include <string.h> // memset()
+
+#include "stg.hxx"
+#include "stgelem.hxx"
+
+class StgInternalStream : public SvStream
+{
+ StorageStream* pStrm;
+ virtual ULONG GetData( void* pData, ULONG nSize );
+ virtual ULONG PutData( const void* pData, ULONG nSize );
+ virtual ULONG SeekPos( ULONG nPos );
+ virtual void FlushData();
+public:
+ StgInternalStream( Storage&, const String&, BOOL );
+ ~StgInternalStream();
+ void Commit();
+};
+
+// standard stream "\1CompObj"
+
+class StgCompObjStream : public StgInternalStream
+{
+ ClsId aClsId;
+ String aUserName;
+ ULONG nCbFormat;
+public:
+ StgCompObjStream( Storage&, BOOL );
+ ClsId& GetClsId() { return aClsId; }
+ String& GetUserName() { return aUserName; }
+ ULONG& GetCbFormat() { return nCbFormat; }
+ BOOL Load();
+ BOOL Store();
+};
+
+// standard stream "\1Ole"
+
+class StgOleStream : public StgInternalStream
+{
+ ULONG nFlags;
+public:
+ StgOleStream( Storage&, BOOL );
+ ULONG& GetFlags() { return nFlags; }
+ BOOL Load();
+ BOOL Store();
+};
+
+#endif
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
new file mode 100644
index 000000000000..e295edc92ac6
--- /dev/null
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -0,0 +1,1268 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgstrms.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h> // memcpy()
+
+#ifndef _TOOLS_FSYS_HXX
+#include <tools/fsys.hxx>
+#endif
+#include <tools/debug.hxx>
+
+#include "stg.hxx"
+#include "stgelem.hxx"
+#include "stgcache.hxx"
+#include "stgstrms.hxx"
+#include "stgdir.hxx"
+#include "stgio.hxx"
+#pragma hdrstop
+
+#if defined(W31)
+ #include <tools/svwin.h>
+ #define memcpy hmemcpy
+ #define __HUGE _huge
+#else
+ #define __HUGE
+#endif
+
+///////////////////////////// class StgFAT ///////////////////////////////
+
+// The FAT class performs FAT operations on an underlying storage stream.
+// This stream is either the master FAT stream (m == TRUE ) or a normal
+// storage stream, which then holds the FAT for small data allocations.
+
+StgFAT::StgFAT( StgStrm& r, BOOL m ) : rStrm( r )
+{
+ bPhys = m;
+ nPageSize = rStrm.GetIo().GetPhysPageSize();
+ nEntries = nPageSize >> 2;
+ nOffset = 0;
+ nMaxPage = 0;
+ nLimit = 0;
+}
+
+// Retrieve the physical page for a given byte offset.
+
+StgPage* StgFAT::GetPhysPage( INT32 nByteOff )
+{
+ StgPage* pPg = NULL;
+ // Position within the underlying stream
+ // use the Pos2Page() method of the stream
+ if( rStrm.Pos2Page( nByteOff ) )
+ {
+ nOffset = rStrm.GetOffset();
+ INT32 nPhysPage = rStrm.GetPage();
+ // get the physical page (must be present)
+ pPg = rStrm.GetIo().Get( nPhysPage, TRUE );
+ }
+ return pPg;
+}
+
+// Get the follow page for a certain FAT page.
+
+INT32 StgFAT::GetNextPage( INT32 nPg )
+{
+ if( nPg >= 0 )
+ {
+ StgPage* pPg = GetPhysPage( nPg << 2 );
+ nPg = pPg ? pPg->GetPage( nOffset >> 2 ) : STG_EOF;
+ }
+ return nPg;
+}
+
+// Find the best fit block for the given size. Return
+// the starting block and its size or STG_EOF and 0.
+// nLastPage is a stopper which tells the current
+// underlying stream size. It is treated as a recommendation
+// to abort the search to inhibit excessive file growth.
+
+INT32 StgFAT::FindBlock( INT32& nPgs )
+{
+ INT32 nMinStart = STG_EOF, nMinLen = 0;
+ INT32 nMaxStart = STG_EOF, nMaxLen = 0x7FFFFFFFL;
+ INT32 nTmpStart = STG_EOF, nTmpLen = 0;
+ INT32 nPages = rStrm.GetSize() >> 2;
+ BOOL bFound = FALSE;
+ StgPage* pPg;
+ short nEntry = 0;
+ for( INT32 i = 0; i < nPages; i++, nEntry++ )
+ {
+ if( !( nEntry % nEntries ) )
+ {
+ // load the next page for that stream
+ nEntry = 0;
+ pPg = GetPhysPage( i << 2 );
+ if( !pPg )
+ return STG_EOF;
+ }
+ INT32 nCur = pPg->GetPage( nEntry );
+ if( nCur == STG_FREE )
+ {
+ // count the size of this area
+ if( nTmpLen )
+ nTmpLen++;
+ else
+ nTmpStart = i,
+ nTmpLen = 1;
+ if( nTmpLen == nPgs
+ // If we already did find a block, stop when reaching the limit
+ || ( bFound && ( nEntry >= nLimit ) ) )
+ break;
+ }
+ else if( nTmpLen )
+ {
+ if( nTmpLen > nPgs && nTmpLen < nMaxLen )
+ // block > requested size
+ nMaxLen = nTmpLen, nMaxStart = nTmpStart, bFound = TRUE;
+ else if( nTmpLen >= nMinLen )
+ {
+ // block < requested size
+ nMinLen = nTmpLen, nMinStart = nTmpStart;
+ bFound = TRUE;
+ if( nTmpLen == nPgs )
+ break;
+ }
+ nTmpStart = STG_EOF;
+ nTmpLen = 0;
+ }
+ }
+ // Determine which block to use.
+ if( nTmpLen )
+ {
+ if( nTmpLen > nPgs && nTmpLen < nMaxLen )
+ // block > requested size
+ nMaxLen = nTmpLen, nMaxStart = nTmpStart;
+ else if( nTmpLen >= nMinLen )
+ // block < requested size
+ nMinLen = nTmpLen, nMinStart = nTmpStart;
+ }
+ if( nMinStart != STG_EOF && nMaxStart != STG_EOF )
+ {
+ // two areas found; return the best fit area
+ INT32 nMinDiff = nPgs - nMinLen;
+ INT32 nMaxDiff = nMaxLen - nPgs;
+ if( nMinDiff > nMaxDiff )
+ nMinStart = STG_EOF;
+ }
+ if( nMinStart != STG_EOF )
+ {
+ nPgs = nMinLen; return nMinStart;
+ }
+ else
+ {
+ return nMaxStart;
+ }
+}
+
+// Set up the consecutive chain for a given block.
+
+BOOL StgFAT::MakeChain( INT32 nStart, INT32 nPgs )
+{
+ INT32 nPos = nStart << 2;
+ StgPage* pPg = GetPhysPage( nPos );
+ if( !pPg || !nPgs )
+ return FALSE;
+ while( --nPgs )
+ {
+ if( nOffset >= nPageSize )
+ {
+ pPg = GetPhysPage( nPos );
+ if( !pPg )
+ return FALSE;
+ }
+ pPg->SetPage( nOffset >> 2, ++nStart );
+ nOffset += 4;
+ nPos += 4;
+ }
+ if( nOffset >= nPageSize )
+ {
+ pPg = GetPhysPage( nPos );
+ if( !pPg )
+ return FALSE;
+ }
+ pPg->SetPage( nOffset >> 2, STG_EOF );
+ return TRUE;
+}
+
+// Allocate a block of data from the given page number on.
+// It the page number is != STG_EOF, chain the block.
+
+INT32 StgFAT::AllocPages( INT32 nBgn, INT32 nPgs )
+{
+ INT32 nOrig = nBgn;
+ INT32 nLast = nBgn;
+ INT32 nBegin, nAlloc;
+ INT32 nPages = rStrm.GetSize() >> 2;
+ short nPasses = 0;
+ // allow for two passes
+ while( nPasses < 2 )
+ {
+ // try to satisfy the request from the pool of free pages
+ while( nPgs )
+ {
+ nAlloc = nPgs;
+ nBegin = FindBlock( nAlloc );
+ // no more blocks left in present alloc chain
+ if( nBegin == STG_EOF )
+ break;
+ if( ( nBegin + nAlloc ) > nMaxPage )
+ nMaxPage = nBegin + nAlloc;
+ if( !MakeChain( nBegin, nAlloc ) )
+ return STG_EOF;
+ if( nOrig == STG_EOF )
+ nOrig = nBegin;
+ else
+ {
+ // Patch the chain
+ StgPage* pPg = GetPhysPage( nLast << 2 );
+ if( !pPg )
+ return STG_EOF;
+ pPg->SetPage( nOffset >> 2, nBegin );
+ }
+ nLast = nBegin + nAlloc - 1;
+ nPgs -= nAlloc;
+ }
+ if( nPgs && !nPasses )
+ {
+ // we need new, fresh space, so allocate and retry
+ if( !rStrm.SetSize( ( nPages + nPgs ) << 2 ) )
+ return STG_EOF;
+ if( !bPhys && !InitNew( nPages ) )
+ return FALSE;
+ nPages = rStrm.GetSize() >> 2;
+ nPasses++;
+ }
+ else
+ break;
+ }
+ // now we should have a chain for the complete block
+ if( nBegin == STG_EOF || nPgs )
+ {
+ rStrm.GetIo().SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return STG_EOF; // bad structure
+ }
+ return nOrig;
+}
+
+// Initialize newly allocated pages for a standard FAT stream
+// It can be assumed that the stream size is always on
+// a page boundary
+
+BOOL StgFAT::InitNew( INT32 nPage1 )
+{
+ INT32 n = ( ( rStrm.GetSize() >> 2 ) - nPage1 ) / nEntries;
+ while( n-- )
+ {
+ StgPage* pPg = NULL;
+ // Position within the underlying stream
+ // use the Pos2Page() method of the stream
+ rStrm.Pos2Page( nPage1 << 2 );
+ // Initialize the page
+ pPg = rStrm.GetIo().Copy( rStrm.GetPage(), STG_FREE );
+ for( short i = 0; i < nEntries; i++ )
+ pPg->SetPage( i, STG_FREE );
+ nPage1++;
+ }
+ return TRUE;
+}
+
+// Release a chain
+
+BOOL StgFAT::FreePages( INT32 nStart, BOOL bAll )
+{
+ while( nStart >= 0 )
+ {
+ StgPage* pPg = GetPhysPage( nStart << 2 );
+ if( !pPg )
+ return FALSE;
+ nStart = pPg->GetPage( nOffset >> 2 );
+ // The first released page is either set to EOF or FREE
+ pPg->SetPage( nOffset >> 2, bAll ? STG_FREE : STG_EOF );
+ bAll = TRUE;
+ }
+ return TRUE;
+}
+
+///////////////////////////// class StgStrm ////////////////////////////////
+
+// The base stream class provides basic functionality for seeking
+// and accessing the data on a physical basis. It uses the built-in
+// FAT class for the page allocations.
+
+StgStrm::StgStrm( StgIo& r ) : rIo( r )
+{
+ pFat = NULL;
+ nStart = nPage = STG_EOF;
+ nOffset = 0;
+ pEntry = NULL;
+ nPos = nSize = 0;
+ nPageSize = rIo.GetPhysPageSize();
+}
+
+StgStrm::~StgStrm()
+{
+ delete pFat;
+}
+
+// Attach the stream to the given entry.
+
+void StgStrm::SetEntry( StgDirEntry& r )
+{
+ r.aEntry.SetLeaf( STG_DATA, nStart );
+ r.aEntry.SetSize( nSize );
+ pEntry = &r;
+ r.SetDirty();
+}
+
+// Compute page number and offset for the given byte position.
+// If the position is behind the size, set the stream right
+// behind the EOF.
+
+BOOL StgStrm::Pos2Page( INT32 nBytePos )
+{
+ INT32 nRel, nBgn;
+ // Values < 0 seek to the end
+ if( nBytePos < 0 || nBytePos >= nSize )
+ nBytePos = nSize;
+ // Adjust the position back to offset 0
+ nPos -= nOffset;
+ INT32 nMask = ~( nPageSize - 1 );
+ INT32 nOld = nPos & nMask;
+ INT32 nNew = nBytePos & nMask;
+ nOffset = (short) ( nBytePos & ~nMask );
+ nPos = nBytePos;
+ if( nOld == nNew )
+ return TRUE;
+ if( nNew > nOld )
+ {
+ // the new position is behind the current, so an incremental
+ // positioning is OK. Set the page relative position
+ nRel = nNew - nOld;
+ nBgn = nPage;
+ }
+ else
+ {
+ // the new position is before the current, so we have to scan
+ // the entire chain.
+ nRel = nNew;
+ nBgn = nStart;
+ }
+ // now, traverse the FAT chain.
+ nRel /= nPageSize;
+ INT32 nLast = STG_EOF;
+ while( nRel && nBgn >= 0 )
+ {
+ nLast = nBgn;
+ nBgn = pFat->GetNextPage( nBgn );
+ nRel--;
+ }
+ // special case: seek to 1st byte of new, unallocated page
+ // (in case the file size is a multiple of the page size)
+ if( nBytePos == nSize && nBgn == STG_EOF && !nRel && !nOffset )
+ nBgn = nLast, nOffset = nPageSize;
+ if( nBgn < 0 && nBgn != STG_EOF )
+ {
+ rIo.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ nBgn = STG_EOF;
+ nOffset = nPageSize;
+ }
+ nPage = nBgn;
+ return BOOL( nRel == 0 && nPage >= 0 );
+}
+
+// Retrieve the physical page for a given byte offset.
+
+StgPage* StgStrm::GetPhysPage( INT32 nBytePos, BOOL bForce )
+{
+ if( !Pos2Page( nBytePos ) )
+ return NULL;
+ return rIo.Get( nPage, bForce );
+}
+
+// Copy an entire stream. Both streams are allocated in the FAT.
+// The target stream is this stream.
+
+BOOL StgStrm::Copy( INT32 nFrom, INT32 nBytes )
+{
+ INT32 nTo = nStart;
+ INT32 nPgs = ( nBytes + nPageSize - 1 ) / nPageSize;
+ while( nPgs-- )
+ {
+ if( nTo < 0 )
+ {
+ rIo.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return FALSE;
+ }
+ rIo.Copy( nTo, nFrom );
+ if( nFrom >= 0 )
+ {
+ nFrom = pFat->GetNextPage( nFrom );
+ if( nFrom < 0 )
+ {
+ rIo.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return FALSE;
+ }
+ }
+ nTo = pFat->GetNextPage( nTo );
+ }
+ return TRUE;
+}
+
+BOOL StgStrm::SetSize( INT32 nBytes )
+{
+ // round up to page size
+ INT32 nOld = ( ( nSize + nPageSize - 1 ) / nPageSize ) * nPageSize;
+ INT32 nNew = ( ( nBytes + nPageSize - 1 ) / nPageSize ) * nPageSize;
+ if( nNew > nOld )
+ {
+ if( !Pos2Page( nSize ) )
+ return FALSE;
+ INT32 nBgn = pFat->AllocPages( nPage, ( nNew - nOld ) / nPageSize );
+ if( nBgn == STG_EOF )
+ return FALSE;
+ if( nStart == STG_EOF )
+ nStart = nPage = nBgn;
+ }
+ else if( nNew < nOld )
+ {
+ BOOL bAll = BOOL( nBytes == 0 );
+ if( !Pos2Page( nBytes ) || !pFat->FreePages( nPage, bAll ) )
+ return FALSE;
+ if( bAll )
+ nStart = nPage = STG_EOF;
+ }
+ if( pEntry )
+ {
+ // change the dir entry?
+ if( !nSize || !nBytes )
+ pEntry->aEntry.SetLeaf( STG_DATA, nStart );
+ pEntry->aEntry.SetSize( nBytes );
+ pEntry->SetDirty();
+ }
+ nSize = nBytes;
+ pFat->SetLimit( GetPages() );
+ return TRUE;
+}
+
+// Return the # of allocated pages
+
+INT32 StgStrm::GetPages()
+{
+ return ( nSize + nPageSize - 1 ) / nPageSize;
+}
+
+//////////////////////////// class StgFATStrm //////////////////////////////
+
+// The FAT stream class provides physical access to the master FAT.
+// Since this access is implemented as a StgStrm, we can use the
+// FAT allocator.
+
+StgFATStrm::StgFATStrm( StgIo& r ) : StgStrm( r )
+{
+ pFat = new StgFAT( *this, TRUE );
+ nSize = rIo.aHdr.GetFATSize() * nPageSize;
+}
+
+BOOL StgFATStrm::Pos2Page( INT32 nBytePos )
+{
+ // Values < 0 seek to the end
+ if( nBytePos < 0 || nBytePos >= nSize )
+ nBytePos = nSize ? nSize - 1 : 0;
+ nPage = nBytePos / nPageSize;
+ nOffset = (short) ( nBytePos % nPageSize );
+ nPos = nBytePos;
+ nPage = GetPage( (short) nPage, FALSE );
+ return BOOL( nPage >= 0 );
+}
+
+// Retrieve the physical page for a given byte offset.
+// Since Pos2Page() already has computed the physical offset,
+// use the byte offset directly.
+
+StgPage* StgFATStrm::GetPhysPage( INT32 nBytePos, BOOL bForce )
+{
+ return rIo.Get( nBytePos / ( nPageSize >> 2 ), bForce );
+}
+
+// Get the page number entry for the given page offset.
+
+INT32 StgFATStrm::GetPage( short nOff, BOOL bMake, USHORT *pnMasterAlloc )
+{
+ if( pnMasterAlloc ) *pnMasterAlloc = 0;
+ if( nOff < rIo.aHdr.GetFAT1Size() )
+ return rIo.aHdr.GetFATPage( nOff );
+ INT32 nMaxPage = nSize >> 2;
+ nOff -= rIo.aHdr.GetFAT1Size();
+ // Anzahl der Masterpages, durch die wir iterieren muessen
+ USHORT nMasterCount = ( nPageSize >> 2 ) - 1;
+ USHORT nBlocks = nOff / nMasterCount;
+ // Offset in letzter Masterpage
+ nOff = nOff % nMasterCount;
+
+ StgPage* pOldPage = 0;
+ StgPage* pMaster = 0;
+ INT32 nFAT = rIo.aHdr.GetFATChain();
+ for( USHORT nCount = 0; nCount <= nBlocks; nCount++ )
+ {
+ if( nFAT == STG_EOF || nFAT == STG_FREE )
+ {
+ if( bMake )
+ {
+ // create a new master page
+ nFAT = nMaxPage++;
+ pMaster = rIo.Copy( nFAT, STG_FREE );
+ for( short k = 0; k < ( nPageSize >> 2 ); k++ )
+ pMaster->SetPage( k, STG_FREE );
+ // Verkettung herstellen
+ if( !pOldPage )
+ rIo.aHdr.SetFATChain( nFAT );
+ else
+ pOldPage->SetPage( nMasterCount, nFAT );
+ if( nMaxPage >= rIo.GetPhysPages() )
+ if( !rIo.SetSize( nMaxPage ) )
+ return STG_EOF;
+ // mark the page as used
+ // Platz fuer Masterpage schaffen
+ if( !pnMasterAlloc ) // Selbst Platz schaffen
+ {
+ if( !Pos2Page( nFAT << 2 ) )
+ return STG_EOF;
+ StgPage* pPg = rIo.Get( nPage, TRUE );
+ if( !pPg )
+ return STG_EOF;
+ pPg->SetPage( nOffset >> 2, STG_MASTER );
+ }
+ else
+ (*pnMasterAlloc)++;
+ rIo.aHdr.SetMasters( nCount + 1 );
+ pOldPage = pMaster;
+ }
+ }
+ else
+ {
+ pMaster = rIo.Get( nFAT, TRUE );
+ nFAT = pMaster->GetPage( nMasterCount );
+ pOldPage = pMaster;
+ }
+ }
+ if( pMaster )
+ return pMaster->GetPage( nOff );
+ rIo.SetError( SVSTREAM_GENERALERROR );
+ return STG_EOF;
+}
+
+
+// Set the page number entry for the given page offset.
+
+BOOL StgFATStrm::SetPage( short nOff, INT32 nNewPage )
+{
+ BOOL bRes = TRUE;
+ if( nOff < rIo.aHdr.GetFAT1Size() )
+ rIo.aHdr.SetFATPage( nOff, nNewPage );
+ else
+ {
+ nOff -= rIo.aHdr.GetFAT1Size();
+ // Anzahl der Masterpages, durch die wir iterieren muessen
+ USHORT nMasterCount = ( nPageSize >> 2 ) - 1;
+ USHORT nBlocks = nOff / nMasterCount;
+ // Offset in letzter Masterpage
+ nOff = nOff % nMasterCount;
+
+ StgPage* pMaster = 0;
+ INT32 nFAT = rIo.aHdr.GetFATChain();
+ for( USHORT nCount = 0; nCount <= nBlocks; nCount++ )
+ {
+ if( nFAT == STG_EOF || nFAT == STG_FREE )
+ {
+ pMaster = 0;
+ break;
+ }
+ pMaster = rIo.Get( nFAT, TRUE );
+ nFAT = pMaster->GetPage( nMasterCount );
+ }
+ if( pMaster )
+ pMaster->SetPage( nOff, nNewPage );
+ else
+ {
+ rIo.SetError( SVSTREAM_GENERALERROR );
+ bRes = FALSE;
+ }
+ }
+
+ // lock the page against access
+ if( bRes )
+ {
+ Pos2Page( nNewPage << 2 );
+ StgPage* pPg = rIo.Get( nPage, TRUE );
+ if( pPg )
+ pPg->SetPage( nOffset >> 2, STG_FAT );
+ else
+ bRes = FALSE;
+ }
+ return bRes;
+}
+
+BOOL StgFATStrm::SetSize( INT32 nBytes )
+{
+ // Set the number of entries to a multiple of the page size
+ short nOld = (short) ( ( nSize + ( nPageSize - 1 ) ) / nPageSize );
+ short nNew = (short) (
+ ( nBytes + ( nPageSize - 1 ) ) / nPageSize ) ;
+ if( nNew < nOld )
+ {
+ // release master pages
+ for( short i = nNew; i < nOld; i++ )
+ SetPage( i, STG_FREE );
+ }
+ else
+ {
+ while( nOld < nNew )
+ {
+ // allocate master pages
+ // find a free master page slot
+ INT32 nPg = 0;
+ USHORT nMasterAlloc = 0;
+ nPg = GetPage( nOld, TRUE, &nMasterAlloc );
+ if( nPg == STG_EOF )
+ return FALSE;
+ // 4 Bytes have been used for Allocation of each MegaMasterPage
+ nBytes += nMasterAlloc << 2;
+
+ // find a free page using the FAT allocator
+ INT32 n = 1;
+ INT32 nNewPage = pFat->FindBlock( n );
+ if( nNewPage == STG_EOF )
+ {
+ // no free pages found; create a new page
+ // Since all pages are allocated, extend
+ // the file size for the next page!
+ nNewPage = nSize >> 2;
+ // if a MegaMasterPage was created avoid taking
+ // the same Page
+ nNewPage += nMasterAlloc;
+ // adjust the file size if necessary
+ if( nNewPage >= rIo.GetPhysPages() )
+ if( !rIo.SetSize( nNewPage + 1 ) )
+ return FALSE;
+ }
+ // Set up the page with empty entries
+ StgPage* pPg = rIo.Copy( nNewPage, STG_FREE );
+ for( short j = 0; j < ( nPageSize >> 2 ); j++ )
+ pPg->SetPage( j, STG_FREE );
+
+ // store the page number into the master FAT
+ // Set the size before so the correct FAT can be found
+ nSize = ( nOld + 1 ) * nPageSize;
+ SetPage( nOld, nNewPage );
+
+ // MegaMasterPages were created, mark it them as used
+
+ UINT32 nMax = rIo.aHdr.GetMasters( );
+ UINT32 nFAT = rIo.aHdr.GetFATChain();
+ if( nMasterAlloc )
+ for( USHORT nCount = 0; nCount < nMax; nCount++ )
+ {
+ if( !Pos2Page( nFAT << 2 ) )
+ return FALSE;
+ if( nMax - nCount <= nMasterAlloc )
+ {
+ StgPage* pPg = rIo.Get( nPage, TRUE );
+ if( !pPg )
+ return FALSE;
+ pPg->SetPage( nOffset >> 2, STG_MASTER );
+ }
+ StgPage* pPage = rIo.Get( nFAT, TRUE );
+ if( !pPage ) return FALSE;
+ nFAT = pPage->GetPage( (nPageSize >> 2 ) - 1 );
+ }
+
+ nOld++;
+ // We have used up 4 bytes for the STG_FAT entry
+ nBytes += 4;
+ nNew = (short) (
+ ( nBytes + ( nPageSize - 1 ) ) / nPageSize );
+ }
+ }
+ nSize = nNew * nPageSize;
+ rIo.aHdr.SetFATSize( nNew );
+ return TRUE;
+}
+
+/////////////////////////// class StgDataStrm //////////////////////////////
+
+// This class is a normal physical stream which can be initialized
+// either with an existing dir entry or an existing FAT chain.
+// The stream has a size increment which normally is 1, but which can be
+// set to any value is you want the size to be incremented by certain values.
+
+StgDataStrm::StgDataStrm( StgIo& r, INT32 nBgn, INT32 nLen ) : StgStrm( r )
+{
+ Init( nBgn, nLen );
+}
+
+StgDataStrm::StgDataStrm( StgIo& r, StgDirEntry* p ) : StgStrm( r )
+{
+ pEntry = p;
+ Init( p->aEntry.GetLeaf( STG_DATA ),
+ p->aEntry.GetSize() );
+}
+
+void StgDataStrm::Init( INT32 nBgn, INT32 nLen )
+{
+ pFat = new StgFAT( *rIo.pFAT, TRUE );
+ nStart = nPage = nBgn;
+ nSize = nLen;
+ nIncr = 1;
+ nOffset = 0;
+ if( nLen < 0 )
+ {
+ // determine the actual size of the stream by scanning
+ // the FAT chain and counting the # of pages allocated
+ nSize = 0;
+ INT32 nOldBgn = -1;
+ while( nBgn >= 0 && nBgn != nOldBgn )
+ {
+ nOldBgn = nBgn;
+ nBgn = pFat->GetNextPage( nBgn );
+ if( nBgn == nOldBgn )
+ rIo.SetError( ERRCODE_IO_WRONGFORMAT );
+ nSize += nPageSize;
+ }
+ }
+}
+
+// Set the size of a physical stream.
+
+BOOL StgDataStrm::SetSize( INT32 nBytes )
+{
+ nBytes = ( ( nBytes + nIncr - 1 ) / nIncr ) * nIncr;
+ INT32 nOldSz = nSize;
+ if( ( nOldSz != nBytes ) )
+ {
+ if( !StgStrm::SetSize( nBytes ) )
+ return FALSE;
+ INT32 nMaxPage = pFat->GetMaxPage();
+ if( nMaxPage > rIo.GetPhysPages() )
+ if( !rIo.SetSize( nMaxPage ) )
+ return FALSE;
+ // If we only allocated one page or less, create this
+ // page in the cache for faster throughput. The current
+ // position is the former EOF point.
+ if( ( nSize - 1 ) / nPageSize - ( nOldSz - 1 ) / nPageSize == 1 )
+ {
+ Pos2Page( nBytes );
+ if( nPage >= 0 )
+ rIo.Copy( nPage, STG_FREE );
+ }
+ }
+ return TRUE;
+}
+
+// Get the address of the data byte at a specified offset.
+// If bForce = TRUE, a read of non-existent data causes
+// a read fault.
+
+void* StgDataStrm::GetPtr( INT32 nPos, BOOL bForce, BOOL bDirty )
+{
+ if( Pos2Page( nPos ) )
+ {
+ StgPage* pPg = rIo.Get( nPage, bForce );
+ if( pPg )
+ {
+ pPg->SetOwner( pEntry );
+ if( bDirty )
+ pPg->SetDirty();
+ return ((BYTE *)pPg->GetData()) + nOffset;
+ }
+ }
+ return NULL;
+}
+
+// This could easily be adapted to a better algorithm by determining
+// the amount of consecutable blocks before doing a read. The result
+// is the number of bytes read. No error is generated on EOF.
+
+INT32 StgDataStrm::Read( void* pBuf, INT32 n )
+{
+ if( ( nPos + n ) > nSize )
+ n = nSize - nPos;
+ INT32 nDone = 0;
+ while( n )
+ {
+ short nBytes = nPageSize - nOffset;
+ short nRes;
+ StgPage* pPg;
+ if( (INT32) nBytes > n )
+ nBytes = (short) n;
+ if( nBytes )
+ {
+ void *p = (BYTE *) pBuf + nDone;
+ if( nBytes == nPageSize )
+ {
+ pPg = rIo.Find( nPage );
+ if( pPg )
+ {
+ // data is present, so use the cached data
+ pPg->SetOwner( pEntry );
+ memcpy( p, pPg->GetData(), nBytes );
+ nRes = nBytes;
+ }
+ else
+ // do a direct (unbuffered) read
+ nRes = (short) rIo.Read( nPage, p, 1 ) * nPageSize;
+ }
+ else
+ {
+ // partial block read thru the cache.
+ pPg = rIo.Get( nPage, FALSE );
+ if( !pPg )
+ break;
+ pPg->SetOwner( pEntry );
+ memcpy( p, (BYTE*)pPg->GetData() + nOffset, nBytes );
+ nRes = nBytes;
+ }
+ nDone += nRes;
+ nPos += nRes;
+ n -= nRes;
+ nOffset += nRes;
+ if( nRes != nBytes )
+ break; // read error or EOF
+ }
+ // Switch to next page if necessary
+ if( nOffset >= nPageSize && !Pos2Page( nPos ) )
+ break;
+ }
+ return nDone;
+}
+
+INT32 StgDataStrm::Write( const void* pBuf, INT32 n )
+{
+ INT32 nDone = 0;
+ if( ( nPos + n ) > nSize )
+ {
+ INT32 nOld = nPos;
+ if( !SetSize( nPos + n ) )
+ return FALSE;
+ Pos2Page( nOld );
+ }
+ while( n )
+ {
+ short nBytes = nPageSize - nOffset;
+ short nRes;
+ StgPage* pPg;
+ if( (INT32) nBytes > n )
+ nBytes = (short) n;
+ if( nBytes )
+ {
+ const void *p = (const BYTE *) pBuf + nDone;
+ if( nBytes == nPageSize )
+ {
+ pPg = rIo.Find( nPage );
+ if( pPg )
+ {
+ // data is present, so use the cached data
+ pPg->SetOwner( pEntry );
+ memcpy( pPg->GetData(), p, nBytes );
+ pPg->SetDirty();
+ nRes = nBytes;
+ }
+ else
+ // do a direct (unbuffered) write
+ nRes = (short) rIo.Write( nPage, (void*) p, 1 ) * nPageSize;
+ }
+ else
+ {
+ // partial block read thru the cache.
+ pPg = rIo.Get( nPage, FALSE );
+ if( !pPg )
+ break;
+ pPg->SetOwner( pEntry );
+ memcpy( (BYTE*)pPg->GetData() + nOffset, p, nBytes );
+ pPg->SetDirty();
+ nRes = nBytes;
+ }
+ nDone += nRes;
+ nPos += nRes;
+ n -= nRes;
+ nOffset += nRes;
+ if( nRes != nBytes )
+ break; // read error
+ }
+ // Switch to next page if necessary
+ if( nOffset >= nPageSize && !Pos2Page( nPos ) )
+ break;
+ }
+ return nDone;
+}
+
+//////////////////////////// class StgSmallStream ///////////////////////////
+
+// The small stream class provides access to streams with a size < 4096 bytes.
+// This stream is a StgStream containing small pages. The FAT for this stream
+// is also a StgStream. The start of the FAT is in the header at DataRootPage,
+// the stream itself is pointed to by the root entry (it holds start & size).
+
+StgSmallStrm::StgSmallStrm( StgIo& r, INT32 nBgn, INT32 nLen ) : StgStrm( r )
+{
+ Init( nBgn, nLen );
+}
+
+StgSmallStrm::StgSmallStrm( StgIo& r, StgDirEntry* p ) : StgStrm( r )
+{
+ pEntry = p;
+ Init( p->aEntry.GetLeaf( STG_DATA ),
+ p->aEntry.GetSize() );
+}
+
+void StgSmallStrm::Init( INT32 nBgn, INT32 nLen )
+{
+ pFat = new StgFAT( *rIo.pDataFAT, FALSE );
+ pData = rIo.pDataStrm;
+ nPageSize = rIo.GetDataPageSize();
+ nStart =
+ nPage = nBgn;
+ nSize = nLen;
+}
+
+// This could easily be adapted to a better algorithm by determining
+// the amount of consecutable blocks before doing a read. The result
+// is the number of bytes read. No error is generated on EOF.
+
+INT32 StgSmallStrm::Read( void* pBuf, INT32 n )
+{
+ // We can safely assume that reads are not huge, since the
+ // small stream is likely to be < 64 KBytes.
+ if( ( nPos + n ) > nSize )
+ n = nSize - nPos;
+ short nDone = 0;
+ while( n )
+ {
+ short nBytes = nPageSize - nOffset;
+ if( (INT32) nBytes > n )
+ nBytes = (short) n;
+ if( nBytes )
+ {
+ if( !pData->Pos2Page( nPage * nPageSize + nOffset ) )
+ break;
+ // all reading thru the stream
+ short nRes = (short) pData->Read( (BYTE*)pBuf + nDone, nBytes );
+ nDone += nRes;
+ nPos += nRes;
+ n -= nRes;
+ nOffset += nRes;
+ // read problem?
+ if( nRes != nBytes )
+ break;
+ }
+ // Switch to next page if necessary
+ if( nOffset >= nPageSize && !Pos2Page( nPos ) )
+ break;
+ }
+ return nDone;
+}
+
+INT32 StgSmallStrm::Write( const void* pBuf, INT32 n )
+{
+ // you can safely assume that reads are not huge, since the
+ // small stream is likely to be < 64 KBytes.
+ short nDone = 0;
+ if( ( nPos + n ) > nSize )
+ {
+ INT32 nOld = nPos;
+ if( !SetSize( nPos + n ) )
+ return FALSE;
+ Pos2Page( nOld );
+ }
+ while( n )
+ {
+ short nBytes = nPageSize - nOffset;
+ if( (INT32) nBytes > n )
+ nBytes = (short) n;
+ if( nBytes )
+ {
+ // all writing goes thru the stream
+ INT32 nDataPos = nPage * nPageSize + nOffset;
+ if( pData->GetSize() < ( nDataPos + nBytes ) )
+ if( !pData->SetSize( nDataPos + nBytes ) )
+ break;
+ if( !pData->Pos2Page( nDataPos ) )
+ break;
+ short nRes = (short) pData->Write( (BYTE*)pBuf + nDone, nBytes );
+ nDone += nRes;
+ nPos += nRes;
+ n -= nRes;
+ nOffset += nRes;
+ // write problem?
+ if( nRes != nBytes )
+ break;
+ }
+ // Switch to next page if necessary
+ if( nOffset >= nPageSize && !Pos2Page( nPos ) )
+ break;
+ }
+ return nDone;
+}
+
+/////////////////////////// class StgTmpStrm /////////////////////////////
+
+// The temporary stream uses a memory stream if < 32K, otherwise a
+// temporary file.
+
+#define THRESHOLD 32768L
+
+StgTmpStrm::StgTmpStrm( ULONG nInitSize )
+ : SvMemoryStream( nInitSize > THRESHOLD
+ ? 16
+ : ( nInitSize ? nInitSize : 16 ), 4096 )
+{
+ pStrm = NULL;
+ // this calls FlushData, so all members should be set by this time
+ SetBufferSize( 0 );
+ if( nInitSize > THRESHOLD )
+ SetSize( nInitSize );
+}
+
+BOOL StgTmpStrm::Copy( StgTmpStrm& rSrc )
+{
+ ULONG n = rSrc.GetSize();
+ ULONG nCur = rSrc.Tell();
+ SetSize( n );
+ if( GetError() == SVSTREAM_OK )
+ {
+ void* p = new BYTE[ 4096 ];
+ rSrc.Seek( 0L );
+ Seek( 0L );
+ while( n )
+ {
+ ULONG nn = n;
+ if( nn > 4096 )
+ nn = 4096;
+ if( rSrc.Read( p, nn ) != nn )
+ break;
+ if( Write( p, nn ) != nn )
+ break;
+ n -= nn;
+ }
+ delete p;
+ rSrc.Seek( nCur );
+ Seek( nCur );
+ return BOOL( n == 0 );
+ }
+ else
+ return FALSE;
+}
+
+StgTmpStrm::~StgTmpStrm()
+{
+ if( pStrm )
+ {
+ pStrm->Close();
+ DirEntry aEntry( aName );
+ aEntry.Kill();
+ delete pStrm;
+ }
+}
+
+ULONG StgTmpStrm::GetSize()
+{
+ ULONG n;
+ if( pStrm )
+ {
+ ULONG old = pStrm->Tell();
+ n = pStrm->Seek( STREAM_SEEK_TO_END );
+ pStrm->Seek( old );
+ }
+ else
+ n = nEndOfData;
+ return n;
+}
+
+void StgTmpStrm::SetSize( ULONG n )
+{
+ if( pStrm )
+ pStrm->SetStreamSize( n );
+ else
+ {
+ if( n > THRESHOLD )
+ {
+ DirEntry aEntry;
+ aEntry = aEntry.TempName();
+ aName = aEntry.GetFull();
+ SvFileStream* s = new SvFileStream( aName, STREAM_READWRITE );
+ ULONG nCur = Tell();
+ ULONG i = nEndOfData;
+ if( i )
+ {
+ void* p = new BYTE[ 4096 ];
+ Seek( 0L );
+ while( i )
+ {
+ ULONG nb = ( i > 4096 ) ? 4096 : i;
+ if( Read( p, nb ) == nb
+ && s->Write( p, nb ) == nb )
+ i -= nb;
+ else
+ break;
+ }
+ delete p;
+ }
+ if( !i && n > nEndOfData )
+ {
+ // We have to write one byte at the end of the file
+ // if the file is bigger than the memstream to see
+ // if it fits on disk
+ s->Seek( n - 1 );
+ s->Write( &i, 1 );
+ s->Flush();
+ if( s->GetError() != SVSTREAM_OK )
+ i = 1;
+ }
+ Seek( nCur );
+ s->Seek( nCur );
+ if( i )
+ {
+ SetError( s->GetError() );
+ delete s;
+ return;
+ }
+ pStrm = s;
+ // Shrink the memory to 16 bytes, which seems to be the minimum
+ ReAllocateMemory( - ( (long) nEndOfData - 16 ) );
+ }
+ else
+ {
+ if( n > nEndOfData )
+ {
+ ULONG nCur = Tell();
+ Seek( nEndOfData - 1 );
+ *this << (BYTE) 0;
+ Seek( nCur );
+ }
+ else
+ nEndOfData = n;
+ }
+ }
+}
+
+ULONG StgTmpStrm::GetData( void* pData, ULONG n )
+{
+ if( pStrm )
+ {
+ n = pStrm->Read( pData, n );
+ SetError( pStrm->GetError() );
+ return n;
+ }
+ else
+ return SvMemoryStream::GetData( (sal_Char *)pData, n );
+}
+
+ULONG StgTmpStrm::PutData( const void* pData, ULONG n )
+{
+ UINT32 nCur = Tell();
+ UINT32 nNew = nCur + n;
+ if( nNew > THRESHOLD && !pStrm )
+ {
+ SetSize( nNew );
+ if( GetError() != SVSTREAM_OK )
+ return 0;
+ }
+ if( pStrm )
+ {
+ nNew = pStrm->Write( pData, n );
+ SetError( pStrm->GetError() );
+ }
+ else
+ nNew = SvMemoryStream::PutData( (sal_Char*)pData, n );
+ return nNew;
+}
+
+ULONG StgTmpStrm::SeekPos( ULONG n )
+{
+ if( n == STREAM_SEEK_TO_END )
+ n = GetSize();
+ if( n && n > THRESHOLD && !pStrm )
+ {
+ SetSize( n );
+ if( GetError() != SVSTREAM_OK )
+ return Tell();
+ else
+ return n;
+ }
+ else if( pStrm )
+ {
+ n = pStrm->Seek( n );
+ SetError( pStrm->GetError() );
+ return n;
+ }
+ else
+ return SvMemoryStream::SeekPos( n );
+}
+
+void StgTmpStrm::FlushData()
+{
+ if( pStrm )
+ {
+ pStrm->Flush();
+ SetError( pStrm->GetError() );
+ }
+ else
+ SvMemoryStream::FlushData();
+}
+
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
new file mode 100644
index 000000000000..a63d664d6967
--- /dev/null
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * $RCSfile: stgstrms.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STGSTRMS_HXX
+#define _STGSTRMS_HXX
+
+#ifndef _TOOLS_STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+class StgIo;
+class StgStrm;
+class StgPage;
+class StgDirEntry;
+
+// The FAT class performs FAT operations on an underlying storage stream.
+// This stream is either the physical FAT stream (bPhys == TRUE ) or a normal
+// storage stream, which then holds the FAT for small data allocations.
+
+class StgFAT
+{ // FAT allocator
+ StgStrm& rStrm; // underlying stream
+ INT32 nMaxPage; // highest page allocated so far
+ short nPageSize; // physical page size
+ short nEntries; // FAT entries per page
+ short nOffset; // current offset within page
+ INT32 nLimit; // search limit recommendation
+ BOOL bPhys; // TRUE: physical FAT
+ StgPage* GetPhysPage( INT32 nPage );
+ BOOL MakeChain( INT32 nStart, INT32 nPages );
+ BOOL InitNew( INT32 nPage1 );
+public:
+ StgFAT( StgStrm& rStrm, BOOL bMark );
+ INT32 FindBlock( INT32& nPages );
+ INT32 GetNextPage( INT32 nPg );
+ INT32 AllocPages( INT32 nStart, INT32 nPages );
+ BOOL FreePages( INT32 nStart, BOOL bAll );
+ INT32 GetMaxPage() { return nMaxPage; }
+ void SetLimit( INT32 n ) { nLimit = n; }
+};
+
+// The base stream class provides basic functionality for seeking
+// and accessing the data on a physical basis. It uses the built-in
+// FAT class for the page allocations.
+
+class StgStrm { // base class for all streams
+protected:
+ StgIo& rIo; // I/O system
+ StgFAT* pFat; // FAT stream for allocations
+ StgDirEntry* pEntry; // dir entry (for ownership)
+ INT32 nStart; // 1st data page
+ INT32 nSize; // stream size in bytes
+ INT32 nPos; // current byte position
+ INT32 nPage; // current logical page
+ short nOffset; // offset into current page
+ short nPageSize; // logical page size
+ BOOL Copy( INT32 nFrom, INT32 nBytes );
+ StgStrm( StgIo& );
+public:
+ ~StgStrm();
+ StgIo& GetIo() { return rIo; }
+ INT32 GetPos() { return nPos; }
+ INT32 GetStart() { return nStart; }
+ INT32 GetSize() { return nSize; }
+ INT32 GetPage() { return nPage; }
+ short GetPageSize() { return nPageSize; }
+ INT32 GetPages();
+ short GetOffset() { return nOffset;}
+ void SetEntry( StgDirEntry& );
+ virtual BOOL SetSize( INT32 );
+ virtual BOOL Pos2Page( INT32 nBytePos );
+ virtual INT32 Read( void*, INT32 ) { return 0; }
+ virtual INT32 Write( const void*, INT32 ) { return 0; }
+ virtual StgPage* GetPhysPage( INT32 nBytePos, BOOL bForce = FALSE );
+ virtual BOOL IsSmallStrm() { return FALSE; }
+};
+
+// The FAT stream class provides physical access to the master FAT.
+// Since this access is implemented as a StgStrm, we can use the
+// FAT allocator.
+
+class StgFATStrm : public StgStrm { // the master FAT stream
+ virtual BOOL Pos2Page( INT32 nBytePos );
+ BOOL SetPage( short, INT32 );
+public:
+ StgFATStrm( StgIo& );
+ INT32 GetPage( short, BOOL, USHORT *pnMasterAlloc = 0);
+ virtual BOOL SetSize( INT32 );
+ virtual StgPage* GetPhysPage( INT32 nBytePos, BOOL bForce = FALSE );
+};
+
+// The stream has a size increment which normally is 1, but which can be
+// set to any value is you want the size to be incremented by certain values.
+
+class StgDataStrm : public StgStrm // a physical data stream
+{
+ short nIncr; // size adjust increment
+ void Init( INT32 nBgn, INT32 nLen );
+public:
+ StgDataStrm( StgIo&, INT32 nBgn, INT32 nLen=-1 );
+ StgDataStrm( StgIo&, StgDirEntry* );
+ void* GetPtr( INT32 nPos, BOOL bForce, BOOL bDirty );
+ void SetIncrement( short n ) { nIncr = n ; }
+ virtual BOOL SetSize( INT32 );
+ virtual INT32 Read( void*, INT32 );
+ virtual INT32 Write( const void*, INT32 );
+};
+
+// The small stream class provides access to streams with a size < 4096 bytes.
+// This stream is a StgStream containing small pages. The FAT for this stream
+// is also a StgStream. The start of the FAT is in the header at DataRootPage,
+// the stream itself is pointed to by the root entry (it holds start & size).
+
+class StgSmallStrm : public StgStrm // a logical data stream
+{
+ StgStrm* pData; // the data stream
+ void Init( INT32 nBgn, INT32 nLen );
+public:
+ StgSmallStrm( StgIo&, INT32 nBgn, INT32 nLen );
+ StgSmallStrm( StgIo&, StgDirEntry* );
+ virtual INT32 Read( void*, INT32 );
+ virtual INT32 Write( const void*, INT32 );
+ virtual BOOL IsSmallStrm() { return TRUE; }
+};
+
+class StgTmpStrm : public SvMemoryStream
+{
+ String aName;
+ SvFileStream* pStrm;
+ virtual ULONG GetData( void* pData, ULONG nSize );
+ virtual ULONG PutData( const void* pData, ULONG nSize );
+ virtual ULONG SeekPos( ULONG nPos );
+ virtual void FlushData();
+
+public:
+ StgTmpStrm( ULONG=16 );
+ ~StgTmpStrm();
+ BOOL Copy( StgTmpStrm& );
+ void SetSize( ULONG );
+ ULONG GetSize();
+};
+
+#endif
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
new file mode 100644
index 000000000000..c47f107b30ca
--- /dev/null
+++ b/sot/source/sdstor/storage.cxx
@@ -0,0 +1,948 @@
+/*************************************************************************
+ *
+ * $RCSfile: storage.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stg.hxx>
+#include <storinfo.hxx>
+#include <storage.hxx>
+
+#ifndef _TOOLS_FSYS_HXX
+#include <tools/fsys.hxx>
+#endif
+#ifndef _CACHESTR_HXX //autogen
+#include <tools/cachestr.hxx>
+#endif
+#include <tools/debug.hxx>
+#pragma hdrstop
+
+/************** class SotStorageStream ***********************************/
+class SotStorageStreamFactory : public SotFactory
+{
+public:
+ TYPEINFO();
+ SotStorageStreamFactory( const SvGlobalName & rName,
+ const String & rClassName,
+ CreateInstanceType pCreateFuncP )
+ : SotFactory( rName, rClassName, pCreateFuncP )
+ {}
+};
+TYPEINIT1(SotStorageStreamFactory,SotFactory);
+
+
+SO2_IMPL_BASIC_CLASS1_DLL(SotStorageStream,SotStorageStreamFactory,SotObject,
+ SvGlobalName( 0xd7deb420, 0xf902, 0x11d0,
+ 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
+SO2_IMPL_INVARIANT(SotStorageStream)
+
+
+void SotStorageStream::TestMemberObjRef( BOOL /*bFree*/ )
+{
+}
+
+#ifdef TEST_INVARIANT
+void SotStorageStream::TestMemberInvariant( BOOL /*bPrint*/ )
+{
+}
+#endif
+
+/************************************************************************
+|* SotStorageStream::SotStorageStream()
+|*
+|* Beschreibung
+*************************************************************************/
+SvLockBytesRef MakeLockBytes_Impl( const String & rName, StreamMode nMode )
+{
+ SvLockBytesRef xLB;
+ if( rName.Len() )
+ {
+ SvStream * pFileStm = new SvFileStream( rName, nMode );
+ xLB = new SvLockBytes( pFileStm, TRUE );
+ }
+ else
+ {
+ SvStream * pCacheStm = new SvCacheStream();
+ xLB = new SvLockBytes( pCacheStm, TRUE );
+ }
+ return xLB;
+}
+
+SotStorageStream::SotStorageStream( const String & rName, StreamMode nMode,
+ StorageMode nStorageMode)
+ : SvStream( MakeLockBytes_Impl( rName, nMode ) )
+ , pOwnStm( NULL )
+{
+ if( nMode & STREAM_WRITE )
+ bIsWritable = TRUE;
+ else
+ bIsWritable = FALSE;
+
+ DBG_ASSERT( !nStorageMode,"StorageModes ignored" )
+}
+
+SotStorageStream::SotStorageStream( StorageStream * pStm )
+{
+ if( STREAM_WRITE & pStm->GetMode() )
+ bIsWritable = TRUE;
+ else
+ bIsWritable = FALSE;
+
+ pOwnStm = pStm;
+ SetError( pStm->GetError() );
+ pStm->ResetError();
+}
+
+SotStorageStream::SotStorageStream()
+ : pOwnStm( NULL )
+{
+ // ??? wenn Init virtuell ist, entsprechen setzen
+ bIsWritable = TRUE;
+}
+
+/************************************************************************
+|* SotStorageStream::~SotStorageStream()
+|*
+|* Beschreibung
+*************************************************************************/
+SotStorageStream::~SotStorageStream()
+{
+
+ SetBufferSize( 0 );
+ // Hack, wegen Fehler in den SD-Storages
+ // Commit();
+ delete pOwnStm;
+}
+
+/*************************************************************************
+|* SotStorageStream::SyncSvStream()
+|*
+|* Beschreibung: Der SvStream wird auf den Zustand des Standard-Streams
+|* gesetzt. Der Puffer des SvStreams wird weggeworfen.
+*************************************************************************/
+void SotStorageStream::SyncSvStream()
+{
+ ULONG nPos = 0;
+ if( pOwnStm )
+ {
+ pOwnStm->Flush();
+ nPos = pOwnStm->Tell();
+ SetError( pOwnStm->GetError() );
+ SvStream::SyncSvStream( nPos );
+ }
+}
+
+/*************************************************************************
+|* SotStorageStream::ResetError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotStorageStream::ResetError()
+{
+ SvStream::ResetError();
+ if( pOwnStm )
+ pOwnStm->ResetError();
+}
+
+/*************************************************************************
+|* SotStorageStream::GetData()
+|*
+|* Beschreibung
+*************************************************************************/
+ULONG SotStorageStream::GetData( void* pData, ULONG nSize )
+{
+ ULONG nRet = 0;
+
+ if( pOwnStm )
+ {
+ nRet = pOwnStm->Read( pData, nSize );
+ SetError( pOwnStm->GetError() );
+ }
+ else
+ nRet = SvStream::GetData( (sal_Char *)pData, nSize );
+ return nRet;
+}
+
+/*************************************************************************
+|* SotStorageStream::PutData()
+|*
+|* Beschreibung
+*************************************************************************/
+ULONG SotStorageStream::PutData( const void* pData, ULONG nSize )
+{
+ ULONG nRet = 0;
+
+ if( pOwnStm )
+ {
+ nRet = pOwnStm->Write( pData, nSize );
+ SetError( pOwnStm->GetError() );
+ }
+ else
+ nRet = SvStream::PutData( (sal_Char *)pData, nSize );
+ return nRet;
+}
+
+/*************************************************************************
+|* SotStorageStream::SeekPos()
+|*
+|* Beschreibung
+*************************************************************************/
+ULONG SotStorageStream::SeekPos( ULONG nPos )
+{
+ ULONG nRet = 0;
+
+ if( pOwnStm )
+ {
+ nRet = pOwnStm->Seek( nPos );
+ SetError( pOwnStm->GetError() );
+ }
+ else
+ nRet = SvStream::SeekPos( nPos );
+ return nRet;
+}
+
+/*************************************************************************
+|* SotStorageStream::Flush()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotStorageStream::FlushData()
+{
+ if( pOwnStm )
+ {
+ pOwnStm->Flush();
+ SetError( pOwnStm->GetError() );
+ }
+ else
+ SvStream::FlushData();
+}
+
+/*************************************************************************
+|* SotStorageStream::SetSize()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotStorageStream::SetSize( ULONG nNewSize )
+{
+ ULONG nPos = Tell();
+ if( pOwnStm )
+ {
+ pOwnStm->SetSize( nNewSize );
+ SetError( pOwnStm->GetError() );
+ }
+ else
+ SvStream::SetSize( nNewSize );
+
+ if( nNewSize < nPos )
+ // ans Ende setzen
+ Seek( nNewSize );
+
+ //return GetError() == SVSTREAM_OK;
+}
+
+/*************************************************************************
+|*
+|* SotStorageStream::GetSize()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+UINT32 SotStorageStream::GetSize() const
+{
+ ULONG nPos = Tell();
+ ((SotStorageStream *)this)->Seek( STREAM_SEEK_TO_END );
+ ULONG nSize = Tell();
+ ((SotStorageStream *)this)->Seek( nPos );
+ return nSize;
+}
+
+/*************************************************************************
+|* SotStorageStream::CopyTo()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorageStream::CopyTo( SotStorageStream * pDestStm )
+{
+ Flush(); // alle Daten schreiben
+ pDestStm->ClearBuffer();
+ if( !pOwnStm || !pDestStm->pOwnStm )
+ { // Wenn Ole2 oder nicht nur eigene StorageStreams
+
+ ULONG nPos = Tell(); // Position merken
+ pDestStm->SetSize( 0 ); // Ziel-Stream leeren
+
+ void * pMem = new BYTE[ 8192 ];
+ ULONG nRead;
+ while( 0 != (nRead = Read( pMem, 8192 )) )
+ {
+ if( nRead != pDestStm->Write( pMem, nRead ) )
+ {
+ SetError( SVSTREAM_GENERALERROR );
+ break;
+ }
+ }
+ delete pMem;
+ // Position setzen
+ pDestStm->Seek( nPos );
+ Seek( nPos );
+ }
+ else
+ {
+ /*
+ // Kopieren
+ nErr = pObjI->CopyTo( pDestStm->pObjI, uSize, NULL, &uWrite );
+ if( SUCCEEDED( nErr ) )
+ {
+ // Ziel-Streamzeiger steht hinter den Daten
+ // SvSeek abgleichen
+ pDestStm->Seek( uWrite.LowPart );
+ }
+ else if( GetScode( nErr ) == E_NOTIMPL )
+ { // Eines Tages werden alle MS... ?!#
+ */
+ pOwnStm->CopyTo( pDestStm->pOwnStm );
+ SetError( pOwnStm->GetError() );
+ }
+ return GetError() == SVSTREAM_OK;
+}
+
+/*************************************************************************
+|* SotStorageStream::Commit()
+|* SotStorageStream::Revert()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorageStream::Commit()
+{
+ if( pOwnStm )
+ {
+ pOwnStm->Flush();
+ if( pOwnStm->GetError() == SVSTREAM_OK )
+ pOwnStm->Commit();
+ SetError( pOwnStm->GetError() );
+ }
+ return GetError() == SVSTREAM_OK;
+}
+
+BOOL SotStorageStream::Revert()
+{
+ if( !pOwnStm )
+ {
+ pOwnStm->Revert();
+ SetError( pOwnStm->GetError() );
+ }
+ return GetError() == SVSTREAM_OK;
+}
+
+/************** class SotStorage ******************************************
+*************************************************************************/
+class SotStorageFactory : public SotFactory
+{
+public:
+ TYPEINFO();
+ SotStorageFactory( const SvGlobalName & rName,
+ const String & rClassName,
+ CreateInstanceType pCreateFuncP )
+ : SotFactory( rName, rClassName, pCreateFuncP )
+ {}
+};
+TYPEINIT1(SotStorageFactory,SotFactory);
+
+
+SO2_IMPL_BASIC_CLASS1_DLL(SotStorage,SotStorageFactory,SotObject,
+ SvGlobalName( 0x980ce7e0, 0xf905, 0x11d0,
+ 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
+SO2_IMPL_INVARIANT(SotStorage)
+
+
+/************************************************************************
+|*
+|* SotStorage::Tes*()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotStorage::TestMemberObjRef( BOOL /*bFree*/ )
+{
+}
+
+#ifdef TEST_INVARIANT
+void SotStorage::TestMemberInvariant( BOOL bPrint )
+{
+}
+#endif
+
+/************************************************************************
+|*
+|* SotStorage::SotStorage()
+|*
+|* Beschreibung Es muss ein I... Objekt an SvObject uebergeben
+|* werden, da es sonst selbst ein IUnknown anlegt und
+|* festlegt, dass alle weiteren I... Objekte mit
+|* delete zerstoert werden (Owner() == TRUE).
+|* Es werden aber nur IStorage Objekte benutzt und nicht
+|* selbst implementiert, deshalb wird so getan, als ob
+|* das IStorage Objekt von aussen kam und es wird mit
+|* Release() freigegeben.
+|* Die CreateStorage Methoden werden benoetigt, um
+|* ein IStorage Objekt vor dem Aufruf von SvObject
+|* zu erzeugen (Own, !Own automatik).
+|* Hat CreateStorage ein Objekt erzeugt, dann wurde
+|* der RefCounter schon um 1 erhoet.
+|* Die Uebergabe erfolgt in pStorageCTor. Die Variable
+|* ist NULL, wenn es nicht geklappt hat.
+|* Ersterstellung MM 23.06.94
+|* Letzte Aenderung MM 23.06.94
+|*
+*************************************************************************/
+#define INIT_SotStorage() \
+ : nError( SVSTREAM_OK ) \
+ , bIsRoot( FALSE ) \
+ , bDelStm( FALSE ) \
+ , nVersion( SOFFICE_FILEFORMAT_NOW ) \
+ , pTmpStg( NULL ) \
+ , pOwnStg( NULL ) \
+ , pStorStm( NULL )
+
+SotStorage::SotStorage()
+ INIT_SotStorage()
+{
+}
+
+#define ERASEMASK ( STREAM_TRUNC | STREAM_WRITE | STREAM_SHARE_DENYALL )
+
+SotStorage::SotStorage( const String & rName, StreamMode nMode,
+ StorageMode nStorageMode )
+ INIT_SotStorage()
+{
+ aName = rName; // Namen merken
+ // Sicherheitshalber wird die Storage File geloescht, wenn
+ // sie neu erzeugt werden soll
+ if( aName.Len() && ( ( nMode & ERASEMASK ) == ERASEMASK ) )
+ {
+ DirEntry aFile( rName );
+ aFile.Kill();
+ }
+
+ pTmpStg = new Storage( aName, nMode,
+ (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE );
+ pOwnStg = pTmpStg;
+ if( !aName.Len() )
+ aName = pOwnStg->GetName();
+ ULONG nErr = pOwnStg->GetError();
+ SetError( nErr );
+}
+
+SotStorage::SotStorage( Storage * pStor )
+ INIT_SotStorage()
+{
+ aName = pStor->GetName(); // Namen merken
+ SignAsRoot( pStor->IsRoot() );
+ SetError( pStor->GetError() );
+ pOwnStg = pStor;
+ ULONG nErr = pOwnStg->GetError();
+ SetError( nErr );
+}
+
+SotStorage::SotStorage( SvStream & rStm )
+ INIT_SotStorage()
+{
+ SetError( rStm.GetError() );
+ pOwnStg = new Storage( rStm, FALSE );
+}
+
+SotStorage::SotStorage( SvStream * pStm, BOOL bDelete )
+ INIT_SotStorage()
+{
+ SetError( pStm->GetError() );
+ pOwnStg = new Storage( *pStm, FALSE );
+
+ ULONG nError = pOwnStg->GetError();
+ if ( nError != SVSTREAM_OK )
+ SetError( nError );
+
+ pStorStm = pStm;
+ bDelStm = bDelete;
+}
+
+/*************************************************************************
+|* SotStorage::~SotStorage()
+|*
+|* Beschreibung
+*************************************************************************/
+SotStorage::~SotStorage()
+{
+ delete pOwnStg;
+ if( bDelStm )
+ delete pStorStm;
+}
+
+
+/*************************************************************************
+|* SotStorage::CreateMemoryStream()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMemoryStream * SotStorage::CreateMemoryStream()
+{
+ SvMemoryStream * pStm = NULL;
+ pStm = new SvMemoryStream( 0x8000, 0x8000 );
+ SotStorageRef aStg = new SotStorage( *pStm );
+ if( CopyTo( aStg ) )
+ aStg->Commit();
+ else
+ {
+ aStg.Clear(); // Storage vorher freigeben
+ delete pStm;
+ }
+ return pStm;
+}
+
+/*************************************************************************
+|* SotStorage::GetStorage()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::IsStorageFile( const String & rFileName )
+{
+ return Storage::IsStorageFile( rFileName );
+}
+
+/*************************************************************************
+|* SotStorage::GetStorage()
+|*
+|* Beschreibung
+*************************************************************************/
+const String & SotStorage::GetName() const
+{
+ if( !aName.Len() )
+ {
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ ((SotStorage *)this)->aName = pOwnStg->GetName();
+ }
+ return aName;
+}
+
+void SotStorage::SetName( const String& rName )
+{
+ // This method is necessary because most storages will not be opened with a FileName, but an external stream instead
+ // This stream is a stream opened by a UCP and so aName is only used as a transport for all client code of the SotStorage
+ // class that depends on the fact that a root storage has a name
+ DBG_ASSERT( !GetName().Len(), "SetName() must not be called when the storage already has a name!" );
+ aName = rName;
+}
+
+/*************************************************************************
+|* SotStorage::ResetError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotStorage::ResetError()
+{
+ nError = SVSTREAM_OK;
+ if( pOwnStg )
+ pOwnStg->ResetError();
+}
+
+/*************************************************************************
+|* SotStorage::SetClass()
+|* SotStorage::SetConvertClass()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotStorage::SetClass( const SvGlobalName & rName,
+ ULONG nOriginalClipFormat,
+ const String & rUserTypeName )
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ pOwnStg->SetClass( rName, nOriginalClipFormat, rUserTypeName );
+ else
+ SetError( SVSTREAM_GENERALERROR );
+}
+
+void SotStorage::SetConvertClass( const SvGlobalName & rName,
+ ULONG nOriginalClipFormat,
+ const String & rUserTypeName )
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ pOwnStg->SetConvertClass( rName, nOriginalClipFormat, rUserTypeName );
+ else
+ SetError( SVSTREAM_GENERALERROR );
+}
+
+/*************************************************************************
+|* SotStorage::GetClassName()
+|* SotStorage::GetFormat()
+|* SotStorage::GetUserName()
+|* SotStorage::ShouldConvert()
+|*
+|* Beschreibung
+*************************************************************************/
+SvGlobalName SotStorage::GetClassName()
+{
+ SvGlobalName aGN;
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ aGN = pOwnStg->GetClassName();
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return aGN;
+}
+
+ULONG SotStorage::GetFormat()
+{
+ ULONG nFormat = 0;
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ nFormat = pOwnStg->GetFormat();
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return nFormat;
+}
+
+String SotStorage::GetUserName()
+{
+ String aName;
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ aName = pOwnStg->GetUserName();
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return aName;
+}
+
+BOOL SotStorage::ShouldConvert()
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ return pOwnStg->ShouldConvert();
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return FALSE;
+}
+
+/*************************************************************************
+|* SotStorage::FillInfoList()
+|*
+|* Beschreibung
+*************************************************************************/
+void SotStorage::FillInfoList( SvStorageInfoList * pFillList ) const
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ pOwnStg->FillInfoList( pFillList );
+}
+
+/*************************************************************************
+|* SotStorage::CopyTo()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::CopyTo( SotStorage * pDestStg )
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ DBG_ASSERT( pDestStg->Owner(), "must be owner" )
+ if( pOwnStg && pDestStg->pOwnStg )
+ {
+ pOwnStg->CopyTo( pDestStg->pOwnStg );
+ SetError( pOwnStg->GetError() );
+ pDestStg->aKey = aKey;
+ pDestStg->nVersion = nVersion;
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return SVSTREAM_OK == GetError();
+}
+
+/*************************************************************************
+|* SotStorage::Commit()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::Commit()
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ if( !pOwnStg->Commit() )
+ SetError( pOwnStg->GetError() );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return SVSTREAM_OK == GetError();
+}
+
+/*************************************************************************
+|* SotStorage::Revert()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::Revert()
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ if( !pOwnStg->Revert() )
+ SetError( pOwnStg->GetError() );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return SVSTREAM_OK == GetError();
+}
+
+/*************************************************************************
+|* SotStorage::OpenStream()
+|*
+|* Beschreibung
+*************************************************************************/
+SotStorageStream * SotStorage::OpenSotStream( const String & rEleName,
+ StreamMode nMode,
+ StorageMode nStorageMode )
+{
+ DBG_ASSERT( !nStorageMode, "StorageModes ignored" )
+
+ SotStorageStream * pStm = NULL;
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ // volle Ole-Patches einschalten
+ // egal was kommt, nur exclusiv gestattet
+ nMode |= STREAM_SHARE_DENYALL;
+ ErrCode nE = pOwnStg->GetError();
+ StorageStream * p = pOwnStg->OpenStream( rEleName, nMode,
+ (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE );
+ pStm = new SotStorageStream( p );
+ if( !nE )
+ pOwnStg->ResetError(); // kein Fehler setzen
+ if( nMode & STREAM_TRUNC )
+ pStm->SetSize( 0 );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return pStm;
+}
+
+/*************************************************************************
+|* SotStorage::OpenStorage()
+|*
+|* Beschreibung
+*************************************************************************/
+SotStorage * SotStorage::OpenSotStorage( const String & rEleName,
+ StreamMode nMode,
+ StorageMode nStorageMode )
+{
+ SotStorage * pStor = NULL;
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ nMode |= STREAM_SHARE_DENYALL;
+ ErrCode nE = pOwnStg->GetError();
+ Storage * p = pOwnStg->OpenStorage( rEleName, nMode,
+ (nStorageMode & STORAGE_TRANSACTED) ? FALSE : TRUE );
+ pStor = new SotStorage( p );
+ if( !nE )
+ pOwnStg->ResetError(); // kein Fehler setzen
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return pStor;
+}
+
+/*************************************************************************
+|* SotStorage::IsStream()
+|* SotStorage::IsStorage()
+|* SotStorage::IsContained()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::IsStorage( const String & rEleName ) const
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ // ein bisschen schneller
+ if( pOwnStg )
+ return pOwnStg->IsStorage( rEleName );
+ return FALSE;
+}
+
+BOOL SotStorage::IsStream( const String & rEleName ) const
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ // ein bisschen schneller
+ if( pOwnStg )
+ return pOwnStg->IsStream( rEleName );
+ return FALSE;
+}
+
+BOOL SotStorage::IsContained( const String & rEleName ) const
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ // ein bisschen schneller
+ if( pOwnStg )
+ return pOwnStg->IsContained( rEleName );
+ return FALSE;
+}
+
+/*************************************************************************
+|* SotStorage::Remove()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::Remove( const String & rEleName )
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ pOwnStg->Remove( rEleName );
+ SetError( pOwnStg->GetError() );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return SVSTREAM_OK == GetError();
+}
+
+/*************************************************************************
+|* SotStorage::Rename()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::Rename( const String & rEleName, const String & rNewName )
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ pOwnStg->Rename( rEleName, rNewName );
+ SetError( pOwnStg->GetError() );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return SVSTREAM_OK == GetError();
+}
+
+/*************************************************************************
+|* SotStorage::CopyTo()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::CopyTo( const String & rEleName,
+ SotStorage * pNewSt, const String & rNewName )
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ DBG_ASSERT( pNewSt->Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ pOwnStg->CopyTo( rEleName, pNewSt->pOwnStg, rNewName );
+ SetError( pOwnStg->GetError() );
+ SetError( pNewSt->GetError() );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return SVSTREAM_OK == GetError();
+}
+
+/*************************************************************************
+|* SotStorage::MoveTo()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SotStorage::MoveTo( const String & rEleName,
+ SotStorage * pNewSt, const String & rNewName )
+{
+ DBG_ASSERT( Owner(), "must be owner" )
+ DBG_ASSERT( pNewSt->Owner(), "must be owner" )
+ if( pOwnStg )
+ {
+ pOwnStg->MoveTo( rEleName, pNewSt->pOwnStg, rNewName );
+ SetError( pOwnStg->GetError() );
+ SetError( pNewSt->GetError() );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return SVSTREAM_OK == GetError();
+}
+
+const SvStream* SotStorage::GetSvStream()
+{
+ const SvStream* pResult = 0;
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ pResult = pOwnStg->GetSvStream();
+ return pResult;
+}
+
+SvStream* SotStorage::GetTargetSvStream() const
+{
+ SvStream* pResult = 0;
+ DBG_ASSERT( Owner(), "must be owner" )
+ if( pOwnStg )
+ pResult = (SvStream*)(pOwnStg->GetSvStream());
+ return pResult;
+}
+
+
+BOOL SotStorage::Validate()
+{
+ DBG_ASSERT( bIsRoot, "Validate nur an Rootstorage" );
+ if( pOwnStg )
+ return pOwnStg->ValidateFAT();
+ else
+ return TRUE;
+}
+
+
diff --git a/sot/source/sdstor/storinfo.cxx b/sot/source/sdstor/storinfo.cxx
new file mode 100644
index 000000000000..04aef46f9bab
--- /dev/null
+++ b/sot/source/sdstor/storinfo.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * $RCSfile: storinfo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stg.hxx>
+#include <storinfo.hxx>
+#include <exchange.hxx>
+#pragma hdrstop
+
+
+/************** class SvStorageInfoList **********************************
+*************************************************************************/
+PRV_SV_IMPL_OWNER_LIST(SvStorageInfoList,SvStorageInfo)
+
+const SvStorageInfo * SvStorageInfoList::Get( const String & rEleName )
+{
+ for( ULONG i = 0; i < Count(); i++ )
+ {
+ const SvStorageInfo & rType = GetObject( i );
+ if( rType.GetName() == rEleName )
+ return &rType;
+ }
+ return NULL;
+}
+
+/************** class SvStorageInfo **************************************
+*************************************************************************/
+ULONG ReadClipboardFormat( SvStream & rStm )
+{
+ ULONG nFormat = 0;
+ INT32 nLen = 0;
+ rStm >> nLen;
+ if( rStm.IsEof() )
+ rStm.SetError( SVSTREAM_GENERALERROR );
+ if( nLen > 0 )
+ {
+ // get a string name
+ sal_Char * p = new sal_Char[ nLen ];
+ if( rStm.Read( p, nLen ) == (ULONG) nLen )
+ {
+ nFormat = SotExchange::RegisterFormatName( String::CreateFromAscii( p, nLen -1 ) );
+ }
+ else
+ rStm.SetError( SVSTREAM_GENERALERROR );
+ delete p;
+ }
+ else if( nLen == -1L )
+ // Windows clipboard format
+ // SV und Win stimmen ueberein (bis einschl. FORMAT_GDIMETAFILE)
+ rStm >> nFormat;
+ else if( nLen == -2L )
+ {
+ rStm >> nFormat;
+ // Mac clipboard format
+ // ??? not implemented
+ rStm.SetError( SVSTREAM_GENERALERROR );
+ }
+ else if( nLen != 0 )
+ {
+ // unknown identifier
+ rStm.SetError( SVSTREAM_GENERALERROR );
+ }
+ return nFormat;
+}
+
+void WriteClipboardFormat( SvStream & rStm, ULONG nFormat )
+{
+ // determine the clipboard format string
+ String aCbFmt;
+ if( nFormat > FORMAT_GDIMETAFILE )
+ aCbFmt = SotExchange::GetFormatName( nFormat );
+ if( aCbFmt.Len() )
+ {
+ ByteString aAsciiCbFmt( aCbFmt, RTL_TEXTENCODING_ASCII_US );
+ rStm << (INT32) (aAsciiCbFmt.Len() + 1);
+ rStm << (const char *)aAsciiCbFmt.GetBuffer();
+ rStm << (UINT8) 0;
+ }
+ else if( nFormat )
+ rStm << (INT32) -1 // for Windows
+ << (INT32) nFormat;
+ else
+ rStm << (INT32) 0; // no clipboard format
+}
+
+
diff --git a/sot/util/makefile.mk b/sot/util/makefile.mk
new file mode 100644
index 000000000000..626dcced4761
--- /dev/null
+++ b/sot/util/makefile.mk
@@ -0,0 +1,149 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJPCH=
+
+PRJNAME=sot
+TARGET=sot
+
+# so2.hid generieren
+#GEN_HID=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1ARCHIV= $(LB)$/lib$(TARGET)$(UPD)$(DLLPOSTFIX).a
+LIB1FILES= $(SLB)$/base.lib \
+ $(SLB)$/sdstor.lib
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= $(TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+
+.IF "$(VCL)" != ""
+SHL1STDLIBS=$(TOOLSLIB) $(RTLLIB)
+.ELSE
+SHL1STDLIBS=$(SVLIB) $(TOOLSLIB)
+.ENDIF
+
+.IF "$(COM)"=="ICC" || "$(COM)"=="WTC"
+SHL1OBJS= $(SLO)$/object.obj
+.ENDIF
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+.IF "$(linkinc)" != ""
+SHL11FILE= $(MISC)$/base.slo
+SHL12FILE= $(MISC)$/sdstor.slo
+.ENDIF
+
+DEF1NAME =$(SHL1TARGET)
+DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt \
+ $(PRJ)$/inc$/absdev.hxx \
+ $(PRJ)$/inc$/agg.hxx \
+ $(PRJ)$/inc$/dtrans.hxx \
+ $(PRJ)$/inc$/exchange.hxx \
+ $(PRJ)$/inc$/factory.hxx \
+ $(PRJ)$/inc$/object.hxx \
+ $(PRJ)$/inc$/sotdata.hxx \
+ $(PRJ)$/inc$/sotref.hxx \
+ $(PRJ)$/inc$/stg.hxx \
+ $(PRJ)$/inc$/storage.hxx \
+ $(PRJ)$/inc$/storinfo.hxx
+DEFLIB1NAME =$(TARGET)
+DEF1DES =StarObjectsTools
+
+.ENDIF
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @+echo ------------------------------
+ @+echo Making: $@
+ @+echo WEP>$@
+ @+echo LIBMAIN>>$@
+ @+echo LibMain>>$@
+.IF "$(GUI)"!="UNX"
+ @+echo CT??_R0?AV>>$@
+ @+echo CTA2?AV>>$@
+.ENDIF
+.IF "$(GUI)"=="OS2"
+ @+echo __alloc>>$@
+ @+echo __malloc>>$@
+.ENDIF
+# @+echo AVbad>>$@
+# @+echo AVexception>>$@
+
+.INCLUDE : target.pmk
diff --git a/sot/util/makefile.pmk b/sot/util/makefile.pmk
new file mode 100644
index 000000000000..c1e0ff6c0ab3
--- /dev/null
+++ b/sot/util/makefile.pmk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=sotpch
+PROJECTPCHSOURCE=$(PRJ)$/util$/sotpch
+PDBTARGET=sot
diff --git a/sot/workben/makefile.mk b/sot/workben/makefile.mk
new file mode 100644
index 000000000000..13a62375c077
--- /dev/null
+++ b/sot/workben/makefile.mk
@@ -0,0 +1,90 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=sot
+TARGET=workben
+LIBTARGET=NO
+TARGETTYPE=CUI
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= \
+ $(OBJ)$/testsot.obj
+
+APP1TARGET= testsot
+APP1OBJS= $(OBJ)$/testsot.obj
+APP1STDLIBS=$(SOTLIB) \
+ $(TOOLSLIB)
+
+APP1DEF= $(MISC)$/$(APP1TARGET).def
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sot/workben/testsot.cxx b/sot/workben/testsot.cxx
new file mode 100644
index 000000000000..b3f7b28f9918
--- /dev/null
+++ b/sot/workben/testsot.cxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * $RCSfile: testsot.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:56:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <storage.hxx>
+
+/*
+ * main.
+ */
+int main (int argc, sal_Char **argv)
+{
+ SotStorageRef xStor = new SotStorage( "c:\\temp\\65254.ppt" );
+/*
+ SotStorageRef xStor = new SotStorage( "c:\\temp\\video.sdb" );
+ SotStorageRef xStor = new SotStorage( "c:\\temp\\video.sdb" );
+ SotStorageRef x2Stor = xStor->OpenSotStorage( "1117" );
+
+ SotStorageStreamRef xStm = x2Stor->OpenSotStream( "Genres", STREAM_STD_READWRITE | STREAM_TRUNC);
+ //BYTE szData[100];
+ //xStm->Write( szData, 100 );
+ UINT32 nSize = xStm->GetSize();
+ xStm->SetSize( 0 );
+ nSize = xStm->GetSize();
+ x2Stor->Commit();
+ xStor->Commit();
+*/
+ return 0;
+}
+
diff --git a/svtools/bmpmaker/bmp.cxx b/svtools/bmpmaker/bmp.cxx
new file mode 100644
index 000000000000..bd2fc1cf65bc
--- /dev/null
+++ b/svtools/bmpmaker/bmp.cxx
@@ -0,0 +1,903 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <tools/stream.hxx>
+#include <tools/fsys.hxx>
+#include <tools/new.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/config.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/group.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/bmpacc.hxx>
+#include <solar.hrc>
+#include <filedlg.hxx>
+#include "bmp.hrc"
+
+// -----------
+// - Defines -
+// -----------
+
+#define SOLAR_PATH "s:\\solenv\\res"
+#define LANG_ALL "Alle Sprachen"
+#define FILETEST(FileEntry) ((FileEntry).Exists())
+
+// --------------
+// - Exit codes -
+// --------------
+
+#define EXIT_NOERROR 0
+#define EXIT_MISSING_BITMAP 1
+#define EXIT_NOSRSFILE 2
+#define EXIT_NOIMGLIST 3
+#define EXIT_DIMENSIONERROR 4
+#define EXIT_IOERROR 5
+#define EXIT_COMMONERROR 6
+#define EXIT_MISSING_RESOURCE 7
+#define EXIT_COLORDEPTHERROR 8
+
+// -----------
+// - Globals -
+// -----------
+
+char LangDir[][ 9 ] = { "deut", "enus", "fren", "ital", "dtch", "span", "dan", "swed", "port", "japn", "chinsim", "chintrad", "russ", "pol", "arab", "greek", "korean" , "turk" };
+USHORT LangNum[] = { 49, 1, 33, 39, 31, 34, 45, 46, 03, 81, 86, 88, 07, 48, 96, 30, 82, 90};
+
+// ------------
+// - LangInfo -
+// ------------
+
+struct LangInfo
+{
+ String maLangDir;
+ USHORT mnLangNum;
+
+ LangInfo( const String& rLangDir, USHORT nLangNum ) : maLangDir( rLangDir ), mnLangNum( nLangNum ) {}
+};
+
+// ----------
+// - BmpApp -
+// ----------
+
+class BmpWin;
+
+class BmpApp : public Application
+{
+private:
+
+ BmpWin* pBmpWin;
+ String aOutputFileName;
+ BYTE cExitCode;
+
+ DECL_LINK( Select, Menu* pMenu );
+
+ BOOL GetCommandOption( const String& rSwitch, String& rSwitchParam );
+
+public:
+
+ void Main( );
+ void SetExitCode( BYTE cExit )
+ {
+ if( ( EXIT_NOERROR == cExitCode ) || ( cExit != EXIT_NOERROR ) )
+ cExitCode = cExit;
+ }
+};
+
+// -----------------------------------------------------------------------
+
+BmpApp aBmpApp;
+
+// ----------
+// - Pathes -
+// ----------
+
+class Pathes : public ModalDialog
+{
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+ GroupBox aGrpPath;
+ FixedText aFtSrs;
+ FixedText aFtRes;
+ FixedText aFtOut;
+ Edit aEdtSrs;
+ PushButton aBtnSrs;
+ Edit aEdtRes;
+ PushButton aBtnRes;
+ Edit aEdtOut;
+ PushButton aBtnOut;
+ GroupBox aGrpLang;
+ ListBox aLbLang;
+
+ DECL_LINK( ClickSrsHdl, void* );
+ DECL_LINK( ClickResHdl, void* );
+ DECL_LINK( ClickOutHdl, void* );
+
+
+public:
+
+ Pathes( Window* pParent,
+ const String& rSrsPath,
+ const String& rResPath,
+ const String& rOutPath,
+ const USHORT nLang );
+
+ String GetSrsPath() const { return aEdtSrs.GetText(); }
+ String GetResPath() const { return aEdtRes.GetText(); }
+ String GetOutPath() const { return aEdtOut.GetText(); }
+
+ USHORT GetLangNum() const { return aLbLang.GetSelectEntryPos(); }
+};
+
+// ----------
+// - BmpWin -
+// ----------
+
+class BmpWin : public WorkWindow
+{
+ VirtualDevice aDev;
+ ListBox aLB;
+ Bitmap aOutBmp;
+ Size aOneSize;
+ Size aTotSize;
+ Point aPos;
+ SvFileStream* pSRS;
+ ULONG nTotCount;
+ USHORT nPos;
+
+ void DoIt( SvStream& rStm, DirEntry&, DirEntry&, String&, String&, const LangInfo& rLang );
+
+public:
+
+ BmpWin( Window* pParent, WinBits nWinStyle );
+
+ void Resize();
+ void StartCreation( const String& rSRSName, const String& rInName,
+ const String& rOutName, const LangInfo& rLang );
+
+ void SetMode( BOOL bMode ) { aLB.SetUpdateMode( bMode ); }
+ void ClearInfo();
+ void WriteInfo( const String& rText, BYTE cExitCode = EXIT_NOERROR );
+};
+
+// ----------
+// - BmpApp -
+// ----------
+
+BOOL BmpApp::GetCommandOption( const String& rSwitch, String& rFollowingParam )
+{
+ BOOL bRet = FALSE;
+
+ for( long i = 0, nCount = GetCommandLineParamCount(); ( i < nCount ) && !bRet; i++ )
+ {
+ String aTestStr( '-' );
+
+ for( long n = 0; ( n < 2 ) && !bRet; n++ )
+ {
+ aTestStr += rSwitch;
+
+ if( aTestStr.CompareIgnoreCaseToAscii( GetCommandLineParam( i ) ) == COMPARE_EQUAL )
+ {
+ bRet = TRUE;
+
+ if( i < ( nCount - 1 ) )
+ rFollowingParam = GetCommandLineParam( i + 1 );
+ else
+ rFollowingParam = String();
+ }
+
+ if( 0 == n )
+ aTestStr = '/';
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void BmpApp::Main( )
+{
+ ResMgr* pAppResMgr = NULL;
+ String aLangDir;
+ String aOutName;
+ int nCmdCount = GetCommandLineParamCount();
+ USHORT nCurCmd = 0;
+
+ cExitCode = EXIT_NOERROR;
+
+ // Param1: filename of *.srs input file with image lists
+ // Param2: path to local bitmaps
+ // Param3: output directory
+ // Param4: Langugage dependent directory
+
+ if( nCmdCount >= 3 )
+ {
+ const String aSrsName( GetCommandLineParam( nCurCmd++ ) );
+ const String aInName( GetCommandLineParam( nCurCmd++ ) );
+ aOutName = GetCommandLineParam( nCurCmd++ );
+
+ pBmpWin = new BmpWin( NULL, WB_APP | WB_STDWORK );
+ pBmpWin->ClearInfo();
+
+ if( nCurCmd < nCmdCount )
+ {
+#if 0
+ GetCommandOption( 'l', aLangDir );
+#else
+ aLangDir = GetCommandLineParam( nCurCmd++ );
+#endif
+ GetCommandOption( 'f', aOutputFileName );
+
+ if( aLangDir.Len() && ( aLangDir.CompareIgnoreCaseToAscii( "all" ) == COMPARE_EQUAL ) )
+ {
+ for ( USHORT i = 0, nCount = ( sizeof( LangNum ) / sizeof( LangNum[ 0 ] ) ); i < nCount; i++ )
+ pBmpWin->StartCreation( aSrsName, aInName, aOutName, LangInfo( String( LangDir[ i ], RTL_TEXTENCODING_UTF8 ), LangNum[ i ] ) );
+ }
+ else
+ {
+ pBmpWin->StartCreation( aSrsName, aInName, aOutName, LangInfo( aLangDir, DirEntry( aOutName ).GetName().ToInt32() ) );
+ }
+ }
+ else
+ pBmpWin->StartCreation( aSrsName, aInName, aOutName, LangInfo( String( LangDir[ 0 ], RTL_TEXTENCODING_UTF8 ), LangNum[ 0 ] ) );
+ }
+ else
+ {
+ ResMgr* pAppResMgr = new ResMgr( String( RTL_CONSTASCII_USTRINGPARAM( "bmp.res" ) ), NULL, NULL );
+ MenuBar aMB;
+ PopupMenu aPB;
+
+ Resource::SetResManager( pAppResMgr );
+
+ aMB.InsertItem( 1, String( RTL_CONSTASCII_USTRINGPARAM( "~ImageList" ) ) );
+ aPB.InsertItem( 1, String( RTL_CONSTASCII_USTRINGPARAM( "~Erstellen..." ) ) );
+ aPB.InsertSeparator();
+ aPB.InsertItem( 2, String( RTL_CONSTASCII_USTRINGPARAM( "~Beenden" ) ) );
+
+ aMB.SetPopupMenu( 1, &aPB );
+ aMB.SetSelectHdl( LINK( this, BmpApp, Select ) );
+
+ pBmpWin = new BmpWin( NULL, WB_APP | WB_STDWORK );
+ pBmpWin->SetMenuBar( &aMB );
+ pBmpWin->Show();
+
+ Execute();
+ delete pBmpWin;
+ }
+
+ Resource::SetResManager( NULL );
+ delete pAppResMgr;
+
+ if( ( EXIT_NOERROR == cExitCode ) && aOutputFileName.Len() && aOutName.Len() )
+ {
+ SvFileStream aOStm( aOutputFileName, STREAM_WRITE | STREAM_TRUNC );
+ ByteString aStr( "Successfully generated ImageList(s) in: " );
+
+ aOStm.WriteLine( aStr.Append( ByteString( aOutName, RTL_TEXTENCODING_UTF8 ) ) );
+ aOStm.Close();
+ }
+
+ if ( EXIT_NOERROR != cExitCode )
+ raise( SIGABRT );
+ return;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( BmpApp, Select, Menu*, pMenu )
+{
+ if ( pMenu->GetCurItemId() == 1 )
+ {
+ Config aCfg;
+ aCfg.SetGroup( "Path-Entries" );
+
+ String aSrsPath( String::CreateFromAscii( aCfg.ReadKey( "SRS", ByteString() ).GetBuffer() ) );
+ String aResPath( String::CreateFromAscii( aCfg.ReadKey( "RES", ByteString() ).GetBuffer() ) );
+ String aOutPath( String::CreateFromAscii( aCfg.ReadKey( "OUT", ByteString() ).GetBuffer() ) );
+ USHORT nLanguage = (USHORT) aCfg.ReadKey( "LNG", '1' ).ToInt32();
+ Pathes aPathDlg( pBmpWin, aSrsPath, aResPath, aOutPath, nLanguage );
+
+ if ( aPathDlg.Execute() == RET_OK )
+ {
+ aCfg.WriteKey( "SRS", ByteString( aSrsPath = String( aPathDlg.GetSrsPath() ), RTL_TEXTENCODING_UTF8 ) );
+ aCfg.WriteKey( "RES", ByteString( aResPath = String( aPathDlg.GetResPath() ), RTL_TEXTENCODING_UTF8 ) );
+ aCfg.WriteKey( "OUT", ByteString( aOutPath = String( aPathDlg.GetOutPath() ), RTL_TEXTENCODING_UTF8 ) );
+ aCfg.WriteKey( "LNG", ByteString::CreateFromInt32( nLanguage = aPathDlg.GetLangNum() ) );
+
+ pBmpWin->ClearInfo();
+
+ if ( !nLanguage )
+ {
+ for ( USHORT i = 0, nCount = ( sizeof( LangNum ) / sizeof( LangNum[ 0 ] ) ); i < nCount; i++ )
+ pBmpWin->StartCreation( aSrsPath, aResPath, aOutPath, LangInfo( String( RTL_CONSTASCII_USTRINGPARAM( "deut" ) ), 49 ) );
+ }
+ else
+ pBmpWin->StartCreation( aSrsPath, aResPath, aOutPath, LangInfo( String( RTL_CONSTASCII_USTRINGPARAM( LangDir[ nLanguage - 1 ] ) ), LangNum[ nLanguage - 1 ] ) );
+
+ pBmpWin->WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "DONE!" ) ) );
+ }
+ }
+ else if( pMenu->GetCurItemId() == 2 )
+ Quit();
+
+ return 0;
+}
+
+// ----------
+// - Pathes -
+// ----------
+
+Pathes::Pathes( Window* pParent,
+ const String& rSrsPath,
+ const String& rResPath,
+ const String& rOutPath,
+ const USHORT nLang ) :
+ ModalDialog ( pParent, ResId( DLG_PATH ) ),
+ aGrpPath ( this, ResId( GRP_PATH ) ),
+ aFtSrs ( this, ResId( FT_SRS ) ),
+ aFtRes ( this, ResId( FT_RES ) ),
+ aFtOut ( this, ResId( FT_OUT ) ),
+ aEdtSrs ( this, ResId( EDT_SRS ) ),
+ aBtnSrs ( this, ResId( BTN_SRS ) ),
+ aEdtRes ( this, ResId( EDT_RES ) ),
+ aBtnRes ( this, ResId( BTN_RES ) ),
+ aEdtOut ( this, ResId( EDT_OUT ) ),
+ aBtnOut ( this, ResId( BTN_OUT ) ),
+ aGrpLang ( this, ResId( GRP_LANG ) ),
+ aLbLang ( this, ResId( LB_LANG ) ),
+ aBtnOk ( this, ResId( BTN_OK ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL ) )
+{
+ FreeResource();
+
+ aBtnSrs.SetClickHdl( LINK( this, Pathes, ClickSrsHdl ) );
+ aBtnRes.SetClickHdl( LINK( this, Pathes, ClickResHdl ) );
+ aBtnOut.SetClickHdl( LINK( this, Pathes, ClickOutHdl ) );
+
+ aEdtSrs.SetText( rSrsPath );
+ aEdtRes.SetText( rResPath );
+ aEdtOut.SetText( rOutPath );
+ aEdtSrs.GrabFocus();
+
+ aLbLang.InsertEntry( String( RTL_CONSTASCII_USTRINGPARAM( LANG_ALL ) ), 0 );
+ for( USHORT i = 1, nCount = ( sizeof( LangNum ) / sizeof( LangNum[ 0 ] ) ); i <= nCount; i++ )
+ aLbLang.InsertEntry( String::CreateFromInt32( LangNum[ i - 1 ] ), i );
+
+ aLbLang.SelectEntryPos( nLang );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( Pathes, ClickSrsHdl, void*, p )
+{
+ FileDialog aFileDlg( this, WB_OPEN | WB_3DLOOK );
+ DirEntry aPath( aEdtSrs.GetText() );
+
+ aFileDlg.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "SRS-Datei mit Imagelisten laden" ) ) );
+ aPath += DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "*.srs" ) ) );
+ aFileDlg.SetPath( aPath.GetFull() );
+ if ( aFileDlg.Execute() == RET_OK )
+ aEdtSrs.SetText( aFileDlg.GetPath() );
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( Pathes, ClickResHdl, void*, p )
+{
+ PathDialog aPathDlg( this, WB_OPEN | WB_3DLOOK );
+
+ aPathDlg.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Quellpfad BMP-Dateien" ) ) );
+ if ( aPathDlg.Execute() == RET_OK )
+ aEdtRes.SetText( aPathDlg.GetPath() );
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( Pathes, ClickOutHdl, void*, p )
+{
+ PathDialog aPathDlg( this, WB_OPEN | WB_3DLOOK );
+
+ aPathDlg.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "Zielpfad BMP-Dateien" ) ) );
+ if ( aPathDlg.Execute() == RET_OK )
+ aEdtOut.SetText( aPathDlg.GetPath() );
+
+ return 0L;
+}
+
+// ----------
+// - BmpWin -
+// ----------
+
+BmpWin::BmpWin(Window* pParent, WinBits aWinStyle) :
+ WorkWindow ( pParent, aWinStyle ),
+ aLB ( this, WB_HSCROLL | WB_VSCROLL ),
+ nPos ( 0 )
+{
+ SetText( String( RTL_CONSTASCII_USTRINGPARAM( "SVX - BmpMaker" ) ) );
+ aLB.SetUpdateMode( TRUE );
+ aLB.Show();
+}
+
+// -----------------------------------------------------------------------
+
+void BmpWin::StartCreation( const String& rSRSName, const String& rInName,
+ const String& rOutName, const LangInfo& rLang )
+{
+ DirEntry aFileName( rSRSName );
+ DirEntry aInDir( rInName );
+ DirEntry aOutDir( rOutName );
+ BOOL bDone = FALSE;
+
+ aFileName.ToAbs();
+ aInDir.ToAbs();
+ aOutDir.ToAbs();
+
+ pSRS = new SvFileStream ( aFileName.GetFull(), STREAM_STD_READ );
+
+ if( pSRS->GetError() )
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Kein SRS file!" ) ), EXIT_NOSRSFILE );
+ else
+ {
+ String aText;
+ ByteString aByteText;
+ BOOL bLangDep = FALSE;
+
+ do
+ {
+ do
+ {
+ if (!pSRS->ReadLine(aByteText))
+ break;
+ }
+ while ( aByteText.Search( "ImageList" ) == STRING_NOTFOUND );
+
+ do
+ {
+ if (!pSRS->ReadLine( aByteText ) )
+ break;
+ }
+ while ( aByteText.Search( "File" ) == STRING_NOTFOUND );
+ aText = String::CreateFromAscii( aByteText.GetBuffer() );
+
+ USHORT nStart = aText.Search('"') + 1;
+ USHORT nEnd = aText.Search( '"', nStart+1 );
+ String aName( aText, nStart, nEnd-nStart );
+ String aPrefix( aName, 0, 2 );
+
+ do
+ {
+ if( !bLangDep &&
+ aByteText.Search( "File" ) != STRING_NOTFOUND &&
+ aByteText.Search( '[' ) != STRING_NOTFOUND &&
+ aByteText.Search( ']' ) != STRING_NOTFOUND )
+ {
+ bLangDep = TRUE;
+ }
+
+ if (!pSRS->ReadLine(aByteText))
+ break;
+ }
+ while (aByteText.Search( "IdList" ) == STRING_NOTFOUND );
+ aText = String::CreateFromAscii( aByteText.GetBuffer() );
+
+ // if image list is not language dependent,
+ // don't do anything for languages except german
+ if( aText.Len() )
+ {
+ bDone = TRUE;
+ DoIt( *pSRS, aInDir, aOutDir, aPrefix, aName, rLang );
+ }
+ else if( ( rLang.mnLangNum != 49 ) && !bLangDep )
+ {
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "INFO: ImageList is not language dependent! Nothing to do for this language." ) ) );
+ bDone = TRUE;
+ }
+ }
+ while ( aText.Len() );
+ }
+
+ if( !bDone )
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: No ImageList found in SRS file!" ) ), EXIT_NOIMGLIST );
+
+ delete pSRS;
+}
+
+// -----------------------------------------------------------------------
+
+void BmpWin::DoIt( SvStream& rStm, DirEntry& rIn, DirEntry& rOut, String& rPrefix,
+ String& rName, const LangInfo& rLang )
+{
+ String aResPath;
+ const char* pResPath = getenv( "SOLARSRC" );
+
+ if( pResPath )
+ {
+ String aString( String::CreateFromAscii( ByteString( pResPath ).GetBuffer() ) );
+ aResPath = ( DirEntry( aString ) += DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "res" ) ) ) ).GetFull();
+ }
+ else
+ {
+ aResPath.Assign( String( RTL_CONSTASCII_USTRINGPARAM( "o:\\" ) ) );
+ aResPath.Append( String::CreateFromInt32( SOLARUPD ) );
+ aResPath.Append( String( RTL_CONSTASCII_USTRINGPARAM( "\\res" ) ) );
+ }
+
+ SvFileStream aOutStream;
+ Bitmap aTotalBmp;
+ Bitmap aBmp;
+ Size aSize;
+ String aText;
+ String aString;
+ String aName( rName );
+ String aFileName;
+ ULONG nSRSPos;
+ long nBmpPos = 0L;
+ USHORT nId;
+ USHORT nN = 1;
+ DirEntry aInPath( rIn + DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "x.bmp" ) ) ) );
+ DirEntry aOutFile( rOut );
+ DirEntry SolarPath1( aResPath );
+ DirEntry SolarPath2( aResPath );
+ String aDefaultName( rPrefix ); aDefaultName.Append( String( RTL_CONSTASCII_USTRINGPARAM( "00000.bmp" ) ) );
+ BOOL bInserted = FALSE;
+ BOOL bFirst = TRUE;
+
+ // Falls nicht deutsch, noch die Vorwahlnummer hintenran
+ if( rLang.mnLangNum != 49 )
+ {
+ String aNumStr( String::CreateFromInt32( rLang.mnLangNum ) );
+
+ if( aNumStr.Len() == 1 )
+ aNumStr.Insert( '0', 0 );
+
+ aName = DirEntry( aName ).GetBase();
+ aName += aNumStr;
+ aName += String( RTL_CONSTASCII_USTRINGPARAM( ".bmp" ) );
+ SolarPath1 += rLang.maLangDir;
+ }
+
+ aOutFile += DirEntry( aName );
+
+ // Die Namen werden spaeter ersetzt
+ SolarPath1 += DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "x.bmp" ) ) );
+ SolarPath2 += DirEntry( String( RTL_CONSTASCII_USTRINGPARAM( "x.bmp" ) ) );
+
+ // Anzahl der Bitmaps bestimmen
+ for ( nTotCount = 0UL, nSRSPos = pSRS->Tell(); aText.Search( '}' ) == STRING_NOTFOUND; )
+ {
+ ByteString aTmp;
+
+ if ( !pSRS->ReadLine( aTmp ) )
+ break;
+
+ aText.Assign( String::CreateFromAscii( aTmp.GetBuffer() ) );
+ aText.EraseLeadingChars( ' ' );
+ aText.EraseLeadingChars( '\t' );
+ aText.EraseAllChars( ';' );
+
+ if ( ByteString( aText, RTL_TEXTENCODING_UTF8 ).IsNumericAscii() )
+ nTotCount++;
+ }
+
+ if( !nTotCount )
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "WARNING: No imagelist resource found: " ) ).Append( aString ), EXIT_MISSING_RESOURCE );
+
+ // Wieder an Anfang und los gehts
+ aText = String();
+ pSRS->Seek( nSRSPos );
+
+ // write info
+ String aInfo( RTL_CONSTASCII_USTRINGPARAM( "CREATING ImageList for language: " ) );
+ aInfo += rLang.maLangDir;
+ aInfo += String( RTL_CONSTASCII_USTRINGPARAM( " [ " ) );
+ aInfo += aInPath.GetPath().GetFull();
+ aInfo += String( RTL_CONSTASCII_USTRINGPARAM( "; " ) );
+ aInfo += SolarPath1.GetPath().GetFull();
+ if( SolarPath2 != SolarPath1 )
+ {
+ aInfo += String( RTL_CONSTASCII_USTRINGPARAM( "; " ) );
+ aInfo += SolarPath2.GetPath().GetFull();
+ }
+ aInfo += String( RTL_CONSTASCII_USTRINGPARAM( " ]" ) );
+ WriteInfo( aInfo );
+
+ for ( ; aText.Search( '}' ) == STRING_NOTFOUND; )
+ {
+ ByteString aTmp;
+
+ if ( !pSRS->ReadLine( aTmp ) )
+ break;
+
+ aText.Assign( String::CreateFromAscii( aTmp.GetBuffer() ) );
+ aText.EraseLeadingChars( ' ' );
+ aText.EraseLeadingChars( '\t' );
+ aText.EraseAllChars( ';' );
+
+ aTmp = ByteString( aText, RTL_TEXTENCODING_UTF8 );
+
+ if( aTmp.IsNumericAscii() )
+ {
+ nId = atoi( aTmp.GetBuffer() );
+
+ if ( nId < 10000 )
+ {
+ const String aTmp( aText );
+
+ aText.Assign( String::CreateFromInt32( 0 ) );
+ aText.Append( aTmp );
+ }
+
+ aString.Assign( rPrefix );
+ aString.Append( aText );
+ aString.Append( String( RTL_CONSTASCII_USTRINGPARAM( ".bmp" ) ) );
+ aInPath.SetName( aString );
+ }
+ else
+ continue;
+
+ if( !FILETEST( aInPath ) )
+ {
+ // Falls nicht deutsch, suchen wir zuerst im jeweiligen Sprach-Unterverz.
+ if( rLang.mnLangNum != 49 )
+ {
+ SolarPath1.SetName( aString );
+
+ if ( !FILETEST( SolarPath1 ) )
+ {
+ SolarPath2.SetName( aString );
+
+ if( !FILETEST( SolarPath2 ) )
+ aBmp = Bitmap();
+ else
+ {
+ SvFileStream aIStm( aFileName = SolarPath2.GetFull(), STREAM_READ );
+ aIStm >> aBmp;
+ }
+ }
+ else
+ {
+ SvFileStream aIStm( aFileName = SolarPath1.GetFull(), STREAM_READ );
+ aIStm >> aBmp;
+ }
+ }
+ else
+ {
+ SolarPath2.SetName( aString );
+
+ if( !FILETEST( SolarPath2 ) )
+ aBmp = Bitmap();
+ else
+ {
+ SvFileStream aIStm( aFileName = SolarPath2.GetFull(), STREAM_READ );
+ aIStm >> aBmp;
+ }
+ }
+ }
+ else
+ {
+ SvFileStream aIStm( aFileName = aInPath.GetFull(), STREAM_READ );
+ aIStm >> aBmp;
+ }
+
+ aSize = aBmp.GetSizePixel();
+
+ // falls Bitmap defekt ist, malen wir ein rotes Kreuz
+ if( !aSize.Width() || !aSize.Height() )
+ {
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "WARNING: Bitmap is missing: " ) ).Append( aString ), EXIT_MISSING_BITMAP );
+
+ aSize = aOneSize;
+
+ if( aSize.Width() && aSize.Height() )
+ {
+ aBmp = Bitmap( aSize, !!aTotalBmp ? aTotalBmp.GetBitCount() : 4 );
+ aBmp.Erase( COL_WHITE );
+
+ BitmapWriteAccess* pAcc = aBmp.AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ Point aPoint;
+ const Rectangle aRect( aPoint, aOneSize );
+
+ pAcc->SetLineColor( Color( COL_LIGHTRED ) );
+ pAcc->DrawRect( aRect );
+ pAcc->DrawLine( aRect.TopLeft(), aRect.BottomRight() );
+ pAcc->DrawLine( aRect.TopRight(), aRect.BottomLeft() );
+ aBmp.ReleaseAccess( pAcc );
+ }
+ }
+ }
+
+ // Beim ersten Mal Zugriffs-Bitmap mit der
+ // richtigen Groesse, 4Bit und der Standardpalette anlegen
+ if( bFirst && aSize.Width() && aSize.Height() )
+ {
+ aTotSize = aOneSize = aSize;
+ aTotSize.Width() *= nTotCount;
+ aTotalBmp = Bitmap( aTotSize, 4 );
+ bFirst = FALSE;
+ }
+
+ if( ( aSize.Width() > aOneSize.Width() ) || ( aSize.Height() > aOneSize.Height() ) )
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Different dimensions in file: " ) ).Append( aString ), EXIT_DIMENSIONERROR );
+ else if( aBmp.GetBitCount() != aTotalBmp.GetBitCount() )
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Different color depth in file: ") ).Append( aString ), EXIT_COLORDEPTHERROR );
+ else
+ {
+ const Rectangle aDst( Point( nBmpPos * aOneSize.Width(), 0L ), aSize );
+ Point aPoint;
+ const Rectangle aSrc( aPoint, aSize );
+
+ if( !!aTotalBmp && !!aBmp && !aDst.IsEmpty() && !aSrc.IsEmpty() )
+ aTotalBmp.CopyPixel( aDst, aSrc, &aBmp );
+ }
+
+ nBmpPos++;
+
+ GetpApp()->Reschedule();
+ }
+
+ if ( !!aTotalBmp && aTotSize.Width() && aTotSize.Height() )
+ {
+ const String aFile( aOutFile.GetFull() );
+
+ aOutStream.Open( aFile, STREAM_WRITE | STREAM_TRUNC );
+
+ if( !aOutStream.IsOpen() )
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Could not open output file: " ) ).Append( aFile ), EXIT_IOERROR );
+ else
+ {
+ aOutStream << aTotalBmp;
+
+ if( aOutStream.GetError() )
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Could not write to output file: " ) ).Append( aFile ), EXIT_IOERROR );
+ else
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "Successfully generated ImageList " ) ).Append( aFile ) );
+
+ aOutStream.Close();
+ }
+ }
+ else
+ WriteInfo( String( RTL_CONSTASCII_USTRINGPARAM( "ERROR: Could not generate " ) ).Append( aOutFile.GetFull() ), EXIT_COMMONERROR );
+
+ WriteInfo( ' ' );
+}
+
+// -----------------------------------------------------------------------
+
+void BmpWin::Resize()
+{
+ aLB.SetPosSizePixel( Point(), GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void BmpWin::WriteInfo( const String& rText, BYTE cExitCode )
+{
+ aLB.InsertEntry( rText, nPos );
+ aLB.SelectEntryPos( nPos++ );
+
+ if( EXIT_NOERROR != cExitCode )
+ aBmpApp.SetExitCode( cExitCode );
+
+#ifdef UNX
+ ByteString aText( rText, RTL_TEXTENCODING_UTF8 );
+ aText.Append( "\r\n" );
+ fprintf( stderr, aText.GetBuffer() );
+#else
+ FILE* fp = fopen( "bmp.err", "a+" );
+
+ if( fp )
+ {
+ ByteString aText( rText, RTL_TEXTENCODING_UTF8 );
+ aText.Append( "\n" );
+ fprintf( fp, aText.GetBuffer() );
+ fclose(fp);
+ }
+#endif
+
+/*
+#ifdef WNT
+ if( AllocConsole() )
+ {
+ HANDLE hHdl = GetStdHandle( STD_OUTPUT_HANDLE );
+
+ if( hHdl )
+ {
+ CONSOLE_SCREEN_BUFFER_INFO aInfo;
+
+ if( GetConsoleScreenBufferInfo( hHdl, &aInfo ) )
+ {
+ long nTest = 0;
+ }
+ }
+ }
+#endif
+*/
+}
+
+// -----------------------------------------------------------------------
+
+void BmpWin::ClearInfo()
+{
+ aLB.Clear();
+ Invalidate();
+ nPos = 0;
+}
+
+
diff --git a/svtools/bmpmaker/bmp.hrc b/svtools/bmpmaker/bmp.hrc
new file mode 100644
index 000000000000..55dd3c35b43f
--- /dev/null
+++ b/svtools/bmpmaker/bmp.hrc
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmp.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define DLG_PATH 256
+
+#define GRP_PATH 1
+#define FT_SRS 1
+#define FT_RES 2
+#define FT_OUT 3
+#define EDT_SRS 1
+#define EDT_RES 2
+#define EDT_OUT 3
+#define BTN_SRS 1
+#define BTN_RES 2
+#define BTN_OUT 3
+#define BTN_OK 1
+#define BTN_CANCEL 1
+
+#define GRP_LANG 2
+#define LB_LANG 1
diff --git a/svtools/bmpmaker/bmp.src b/svtools/bmpmaker/bmp.src
new file mode 100644
index 000000000000..4763c3c6fe91
--- /dev/null
+++ b/svtools/bmpmaker/bmp.src
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmp.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "bmp.hrc"
+ModalDialog DLG_PATH {
+ OutputSize = TRUE;
+ SVLook = TRUE;
+ Size = MAP_APPFONT( 301, 104 );
+ Text = "Pfad-Einstellungen";
+ Moveable = TRUE;
+ Closeable = TRUE;
+ GroupBox GRP_PATH {
+ Pos = MAP_APPFONT( 6, 3 );
+ Size = MAP_APPFONT( 243, 59 );
+ Text = "Pfade";
+ };
+ FixedText FT_SRS {
+ Pos = MAP_APPFONT( 12, 16 );
+ Size = MAP_APPFONT( 50, 10 );
+ Text = "SRS-Datei (inkl.Pfad):";
+ };
+ FixedText FT_OUT {
+ Pos = MAP_APPFONT( 12, 46 );
+ Size = MAP_APPFONT( 50, 10 );
+ Text = "Ausgabe-Pfad:";
+ };
+ FixedText FT_RES {
+ Pos = MAP_APPFONT( 12, 31 );
+ Size = MAP_APPFONT( 50, 10 );
+ Text = "Bitmap-Pfad:";
+ };
+ Edit EDT_SRS {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 65, 14 );
+ Size = MAP_APPFONT( 160, 12 );
+ TabStop = TRUE;
+ };
+ Edit EDT_RES {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 65, 29 );
+ Size = MAP_APPFONT( 160, 12 );
+ TabStop = TRUE;
+ };
+ Edit EDT_OUT {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 65, 44 );
+ Size = MAP_APPFONT( 160, 12 );
+ TabStop = TRUE;
+ };
+ PushButton BTN_SRS {
+ Pos = MAP_APPFONT( 228, 14 );
+ Size = MAP_APPFONT( 15, 12 );
+ Text = "...";
+ TabStop = TRUE;
+ };
+ PushButton BTN_RES {
+ Pos = MAP_APPFONT( 228, 29 );
+ Size = MAP_APPFONT( 15, 12 );
+ Text = "...";
+ TabStop = TRUE;
+ };
+ PushButton BTN_OUT {
+ Pos = MAP_APPFONT( 228, 44 );
+ Size = MAP_APPFONT( 15, 12 );
+ Text = "...";
+ TabStop = TRUE;
+ };
+ OKButton BTN_OK {
+ Pos = MAP_APPFONT( 255, 6 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ DefButton = TRUE;
+ };
+ CancelButton BTN_CANCEL {
+ Pos = MAP_APPFONT( 255, 21 );
+ Size = MAP_APPFONT( 40, 12 );
+ TabStop = TRUE;
+ };
+ GroupBox GRP_LANG {
+ Pos = MAP_APPFONT( 6, 65 );
+ Size = MAP_APPFONT( 243, 33 );
+ Text = "Sprache";
+ };
+ ListBox LB_LANG {
+ Border = TRUE;
+ Pos = MAP_APPFONT( 12, 76 );
+ Size = MAP_APPFONT( 231, 70 );
+ TabStop = TRUE;
+ DropDown = TRUE;
+ VScroll = TRUE;
+ };
+};
diff --git a/svtools/bmpmaker/makefile.mk b/svtools/bmpmaker/makefile.mk
new file mode 100644
index 000000000000..68db191f561b
--- /dev/null
+++ b/svtools/bmpmaker/makefile.mk
@@ -0,0 +1,135 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:49 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=bmpmaker
+TARGET=bmp
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/bmp.obj
+
+SRC1FILES= bmp.src
+SRS1NAME=bmp
+RES1TARGET=bmp
+SRS1FILES=$(SRS)$/bmp.srs
+
+APP1TARGET= $(TARGET)
+
+.IF "$(GUI)" == "MAC"
+MACRES= $(SV_RES)MPWToolCfrg.r -d SVTOOLNAME="¶"SV TOOL¶""
+.ENDIF
+
+APP1STDLIBS = \
+ $(SVLIB) \
+ $(TOOLSLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+.IF "$(COM)"=="GCC" || "$(GUI)"=="WNT"
+APP1STDLIBS+=$(CPPULIB)
+.ENDIF
+
+APP1DEPN= $(L)$/itools.lib $(SVLIBDEPEND)
+APP1OBJS= $(OBJFILES)
+
+APP1BASE=0x10000000
+
+.IF "$(GUI)"!="UNX"
+APP1STDLIBS+= svtool.lib
+.ELSE
+APP1STDLIBS+= -lsvt$(UPD)$(DLLSUFFIX)
+APP1STDLIBS+= -lsvl$(UPD)$(DLLSUFFIX)
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# ------------------------------------------------------------------
+# OS2
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(TARGET).def:
+ echo NAME $(TARGET) WINDOWAPI >$@
+ echo DESCRIPTION 'BMP' >>$@
+.IF "$(COM)" != "BLC"
+ echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+ echo EXETYPE OS2 >>$@
+ echo PROTMODE >>$@
+ echo CODE PRELOAD >>$@
+ echo DATA PRELOAD MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
diff --git a/svtools/inc/adrparse.hxx b/svtools/inc/adrparse.hxx
new file mode 100644
index 000000000000..8417009b08c7
--- /dev/null
+++ b/svtools/inc/adrparse.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: adrparse.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ADRPARSE_HXX
+#define _ADRPARSE_HXX
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+//============================================================================
+struct SvAddressEntry_Impl
+{
+ UniString m_aAddrSpec;
+ UniString m_aRealName;
+
+ SvAddressEntry_Impl() {};
+ SvAddressEntry_Impl(UniString const & rTheAddrSpec,
+ UniString const & rTheRealName):
+ m_aAddrSpec(rTheAddrSpec), m_aRealName(rTheRealName) {}
+};
+
+//============================================================================
+DECLARE_LIST(SvAddressList_Impl, SvAddressEntry_Impl *);
+
+//============================================================================
+class SvAddressParser
+{
+ friend class SvAddressParser_Impl;
+
+ SvAddressEntry_Impl m_aFirst;
+ SvAddressList_Impl m_aRest;
+ bool m_bHasFirst;
+
+public:
+ SvAddressParser(UniString const & rInput);
+
+ ~SvAddressParser();
+
+ sal_Int32 Count() const { return m_bHasFirst ? m_aRest.Count() + 1 : 0; }
+
+ inline UniString const & GetEmailAddress(sal_Int32 nIndex) const;
+
+ inline UniString const &GetRealName(sal_Int32 nIndex) const;
+
+ /** Create an RFC 822 <mailbox> (i.e., 'e-mail address').
+
+ @param rPhrase Either an empty string (the <mailbox> will have no
+ <phrase> an will be of the form <addr-spec>), or some text that will
+ become the <phrase> part of a <phrase route-addr> form <mailbox>. Non
+ US-ASCII characters within the text are put into a <qouted-string>
+ verbatim, so the result may actually not be a valid RFC 822 <mailbox>,
+ but a more human-readable representation.
+
+ @param rAddrSpec A valid RFC 822 <addr-spec>. (An RFC 822 <mailbox>
+ including a <route> cannot be created by this method.)
+
+ @param rMailbox If this method returns true, this parameter returns
+ the created RFC 822 <mailbox> (rather, a more human-readable
+ representation thereof). Otherwise, this parameter is not modified.
+
+ @return True, if rAddrSpec is a valid RFC 822 <addr-spec>.
+ */
+ static bool createRFC822Mailbox(String const & rPhrase,
+ String const & rAddrSpec,
+ String & rMailbox);
+};
+
+inline UniString const & SvAddressParser::GetEmailAddress(sal_Int32 nIndex)
+ const
+{
+ return nIndex == 0 ? m_aFirst.m_aAddrSpec :
+ m_aRest.GetObject(nIndex - 1)->m_aAddrSpec;
+}
+
+inline UniString const & SvAddressParser::GetRealName(sal_Int32 nIndex) const
+{
+ return nIndex == 0 ? m_aFirst.m_aRealName :
+ m_aRest.GetObject(nIndex - 1)->m_aRealName;
+}
+
+#endif // _ADRPARSE_HXX
+
diff --git a/svtools/inc/calendar.hxx b/svtools/inc/calendar.hxx
new file mode 100644
index 000000000000..08fce282b501
--- /dev/null
+++ b/svtools/inc/calendar.hxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * $RCSfile: calendar.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CALENDAR_HXX
+#define _CALENDAR_HXX
+
+#ifndef _INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef _CTRL_HXX
+#include <vcl/ctrl.hxx>
+#endif
+#ifndef _TIMER_HXX
+#include <vcl/timer.hxx>
+#endif
+#ifndef _FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+
+class Table;
+class MouseEvent;
+class TrackingEvent;
+class KeyEvent;
+class HelpEvent;
+class DataChangedEvent;
+class FloatingWindow;
+class PushButton;
+struct ImplDateInfo;
+class ImplDateTable;
+class ImplCFieldFloatWin;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class Calendar
+
+Diese Klasse erlaubt die Auswahl eines Datum. Der Datumsbereich der
+angezeigt wird, ist der, der durch die Klasse Date vorgegeben ist.
+Es werden soviele Monate angezeigt, wie die Ausgabeflaeche des
+Controls vorgibt. Der Anwender kann zwischen den Monaten ueber ein
+ContextMenu (Bei Click auf den Monatstitel) oder durch 2 ScrollButtons
+zwischen den Monaten wechseln.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_BORDER Um das Fenster wird ein Border gezeichnet.
+WB_TABSTOP Tastatursteuerung ist moeglich. Der Focus wird
+ sich geholt, wenn mit der Maus in das
+ Control geklickt wird.
+WB_QUICKHELPSHOWSDATEINFO DateInfo auch bei QuickInfo als BalloonHelp zeigen
+WB_BOLDTEXT Formatiert wird nach fetten Texten und
+ DIB_BOLD wird bei AddDateInfo() ausgewertet
+WB_FRAMEINFO Formatiert wird so, das Frame-Info angezeigt
+ werden kann und die FrameColor bei AddDateInfo()
+ ausgewertet wird
+WB_RANGESELECT Es koennen mehrere Tage selektiert werden, die
+ jedoch alle zusammenhaengend sein muessen
+WB_MULTISELECT Es koennen mehrere Tage selektiert werden
+WB_WEEKNUMBER Es werden die Wochentage mit angezeigt
+
+--------------------------------------------------------------------------
+
+Mit SetCurDate() / GetCurDate() wird das ausgewaehlte Datum gesetzt und
+abgefragt. Wenn der Anwnder ein Datum selektiert hat, wird Select()
+gerufen. Bei einem Doppelklick auf ein Datum wird DoubleClick() gerufen.
+
+--------------------------------------------------------------------------
+
+Mit CalcWindowSizePixel() kann die Groesse des Fensters in Pixel fuer
+die Darstellung einer bestimmte Anzahl von Monaten berechnet werden.
+
+--------------------------------------------------------------------------
+
+Mit SetSaturdayColor() kann eine spezielle Farbe fuer Sonnabende gesetzt
+werden und mit SetSundayColor() eine fuer Sonntage. Mit AddDateInfo()
+koennen Tage speziell gekennzeichnet werden. Dabei kann man einem
+einzelnen Datum eine andere Farbe geben (zum Beispiel fuer Feiertage)
+oder diese Umranden (zum Beispiel fuer Termine). Wenn beim Datum
+kein Jahr angegeben wird, wird der Tag in jedem Jahr benutzt. Mit
+AddDateInfo() kann auch jedem Datum ein Text mitgegeben werden, der
+dann angezeigt wird, wenn Balloon-Hilfe an ist. Um nicht alle Jahre
+mit entsprechenden Daten zu versorgen, wird der RequestDateInfo()-
+Handler gerufen, wenn ein neues Jahr angezeigt wird. Es kann dann
+im Handler mit GetRequestYear() das Jahr abgefragt werden.
+
+--------------------------------------------------------------------------
+
+Um ein ContextMenu zu einem Datum anzuzeigen, muss man den Command-Handler
+ueberlagern. Mit GetDate() kann zur Mouse-Position das Datum ermittelt
+werden. Bei Tastaturausloesung sollte das aktuelle Datum genommen werden.
+Wenn ein ContextMenu angezeigt wird, darf der Handler der Basisklasse nicht
+gerufen werden.
+
+--------------------------------------------------------------------------
+
+Bei Mehrfachselektion WB_RANGESELECT oder WB_MULTISELECT kann mit
+SelectDate()/SelectDateRange() Datumsbereiche selektiert/deselektiert
+werden. SelectDateRange() gilt inkl. EndDatum. Mit SetNoSelection() kann
+alles deselektiert werden. SetCurDate() selektiert bei Mehrfachselektion
+jedoch nicht das Datum mit, sondern gibt nur das Focus-Rechteck vor.
+
+Den selektierten Bereich kann man mit GetSelectDateCount()/GetSelectDate()
+abgefragt werden oder der Status von einem Datum kann mit IsDateSelected()
+abgefragt werden.
+
+Waehrend der Anwender am selektieren ist, wird der SelectionChanging()-
+Handler gerufen. In diesem kann der selektierte Bereich angepasst werden,
+wenn man beispielsweise den Bereich eingrenzen oder erweitern will. Der
+Bereich wird mit SelectDate()/SelectDateRange() umgesetzt und mit
+GetSelectDateCount()/GetSelectDate() abgefragt. Wenn man wissen moechte,
+in welche Richtung selektiert wird, kann dies ueber IsSelectLeft()
+abgefragt werden. TRUE bedeutet eine Selektion nach links oder oben,
+FALSE eine Selektion nach rechts oder unten.
+
+--------------------------------------------------------------------------
+
+Wenn sich der Date-Range-Bereich anpasst und man dort die Selektion
+uebernehmen will, sollte dies nur gemacht werden, wenn
+IsScrollDateRangeChanged() TRUE zurueckliefert. Denn diese Methode liefert
+TRUE zurueck, wenn der Bereich durch Betaetigung von den Scroll-Buttons
+ausgeloest wurde. Bei FALSE wurde dies durch Resize(), Methoden-Aufrufen
+oder durch Beendigung einer Selektion ausgeloest.
+
+*************************************************************************/
+
+// ------------------
+// - Calendar-Types -
+// ------------------
+
+#define WB_QUICKHELPSHOWSDATEINFO ((WinBits)0x00004000)
+#define WB_BOLDTEXT ((WinBits)0x00008000)
+#define WB_FRAMEINFO ((WinBits)0x00010000)
+#define WB_WEEKNUMBER ((WinBits)0x00020000)
+// Muss mit den WinBits beim TabBar uebereinstimmen oder mal
+// nach \vcl\inc\wintypes.hxx verlagert werden
+#ifndef WB_RANGESELECT
+#define WB_RANGESELECT ((WinBits)0x00200000)
+#endif
+#ifndef WB_MULTISELECT
+#define WB_MULTISELECT ((WinBits)0x00400000)
+#endif
+
+#define DIB_BOLD ((USHORT)0x0001)
+
+// ------------
+// - Calendar -
+// ------------
+
+class Calendar : public Control
+{
+private:
+ ImplDateTable* mpDateTable;
+ Table* mpSelectTable;
+ Table* mpOldSelectTable;
+ Table* mpRestoreSelectTable;
+ XubString* mpDayText[31];
+ XubString maDayText;
+ XubString maWeekText;
+ International maIntn;
+ Rectangle maPrevRect;
+ Rectangle maNextRect;
+ String maDayOfWeekText;
+ long mnDayOfWeekAry[7];
+ Date maOldFormatFirstDate;
+ Date maOldFormatLastDate;
+ Date maFirstDate;
+ Date maOldFirstDate;
+ Date maCurDate;
+ Date maOldCurDate;
+ Date maAnchorDate;
+ Date maDropDate;
+ Color maSelColor;
+ Color maOtherColor;
+ Color* mpStandardColor;
+ Color* mpSaturdayColor;
+ Color* mpSundayColor;
+ ULONG mnDayCount;
+ long mnDaysOffX;
+ long mnWeekDayOffY;
+ long mnDaysOffY;
+ long mnMonthHeight;
+ long mnMonthWidth;
+ long mnMonthPerLine;
+ long mnLines;
+ long mnDayWidth;
+ long mnDayHeight;
+ long mnWeekWidth;
+ long mnDummy2;
+ long mnDummy3;
+ long mnDummy4;
+ WinBits mnWinStyle;
+ USHORT mnFirstYear;
+ USHORT mnLastYear;
+ USHORT mnRequestYear;
+ BOOL mbCalc:1,
+ mbFormat:1,
+ mbDrag:1,
+ mbSelection:1,
+ mbMultiSelection:1,
+ mbWeekSel:1,
+ mbUnSel:1,
+ mbMenuDown:1,
+ mbSpinDown:1,
+ mbPrevIn:1,
+ mbNextIn:1,
+ mbDirect:1,
+ mbInSelChange:1,
+ mbTravelSelect:1,
+ mbScrollDateRange:1,
+ mbSelLeft:1,
+ mbAllSel:1,
+ mbDropPos:1;
+ Link maSelectionChangingHdl;
+ Link maDateRangeChangedHdl;
+ Link maRequestDateInfoHdl;
+ Link maDoubleClickHdl;
+ Link maSelectHdl;
+ Timer maDragScrollTimer;
+ USHORT mnDragScrollHitTest;
+
+#ifdef _SV_CALENDAR_CXX
+ void ImplInit( WinBits nWinStyle );
+ void ImplInitSettings();
+ void ImplGetWeekFont( Font& rFont ) const;
+ void ImplFormat();
+ USHORT ImplHitTest( const Point& rPos, Date& rDate ) const;
+ void ImplDrawSpin( BOOL bDrawPrev = TRUE, BOOL bDrawNext = TRUE );
+ void ImplDrawDate( long nX, long nY,
+ USHORT nDay, USHORT nMonth, USHORT nYear,
+ DayOfWeek eDayOfWeek,
+ BOOL bBack = TRUE, BOOL bOther = FALSE,
+ ULONG nToday = 0 );
+ void ImplDraw( BOOL bPaint = FALSE );
+ void ImplUpdateDate( const Date& rDate );
+ void ImplUpdateSelection( Table* pOld );
+ void ImplMouseSelect( const Date& rDate, USHORT nHitTest,
+ BOOL bMove, BOOL bExpand, BOOL bExtended );
+ void ImplUpdate( BOOL bCalcNew = FALSE );
+ void ImplScroll( BOOL bPrev );
+ void ImplInvertDropPos();
+ void ImplShowMenu( const Point& rPos, const Date& rDate );
+ void ImplTracking( const Point& rPos, BOOL bRepeat );
+ void ImplEndTracking( const Point& rPos, BOOL bCancel );
+#endif
+
+protected:
+ BOOL ShowDropPos( const Point& rPos, Date& rDate );
+ void HideDropPos();
+
+ DECL_STATIC_LINK( Calendar, ScrollHdl, Timer *);
+
+public:
+ Calendar( Window* pParent, WinBits nWinStyle = 0 );
+ Calendar( Window* pParent, const ResId& rResId );
+ ~Calendar();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void GetFocus();
+ virtual void LoseFocus();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void SelectionChanging();
+ virtual void DateRangeChanged();
+ virtual void RequestDateInfo();
+ virtual void DoubleClick();
+ virtual void Select();
+
+ void SetInternational( const International& rIntn );
+ const International& GetInternational() const { return maIntn; }
+
+ void SelectDate( const Date& rDate, BOOL bSelect = TRUE );
+ void SelectDateRange( const Date& rStartDate, const Date& rEndDate,
+ BOOL bSelect = TRUE );
+ void SetNoSelection();
+ BOOL IsDateSelected( const Date& rDate ) const;
+ ULONG GetSelectDateCount() const;
+ Date GetSelectDate( ULONG nIndex = 0 ) const;
+ void EnableCallEverySelect( BOOL bEvery = TRUE ) { mbAllSel = bEvery; }
+ BOOL IsCallEverySelectEnabled() const { return mbAllSel; }
+
+ USHORT GetRequestYear() const { return mnRequestYear; }
+ void SetCurDate( const Date& rNewDate );
+ Date GetCurDate() const { return maCurDate; }
+ void SetFirstDate( const Date& rNewFirstDate );
+ Date GetFirstDate() const { return maFirstDate; }
+ Date GetLastDate() const { return maFirstDate+mnDayCount; }
+ ULONG GetDayCount() const { return mnDayCount; }
+ Date GetFirstMonth() const;
+ Date GetLastMonth() const;
+ USHORT GetMonthCount() const;
+ BOOL GetDate( const Point& rPos, Date& rDate ) const;
+ Rectangle GetDateRect( const Date& rDate ) const;
+ BOOL GetDropDate( Date& rDate ) const;
+
+ long GetCurMonthPerLine() const { return mnMonthPerLine; }
+ long GetCurLines() const { return mnLines; }
+
+ void SetStandardColor( const Color& rColor );
+ const Color& GetStandardColor() const;
+ void SetSaturdayColor( const Color& rColor );
+ const Color& GetSaturdayColor() const;
+ void SetSundayColor( const Color& rColor );
+ const Color& GetSundayColor() const;
+
+ void AddDateInfo( const Date& rDate, const XubString& rText,
+ const Color* pTextColor = NULL,
+ const Color* pFrameColor = NULL,
+ USHORT nFlags = 0 );
+ void RemoveDateInfo( const Date& rDate );
+ void ClearDateInfo();
+ XubString GetDateInfoText( const Date& rDate );
+
+ void StartSelection();
+ void EndSelection();
+
+ BOOL IsTravelSelect() const { return mbTravelSelect; }
+ BOOL IsScrollDateRangeChanged() const { return mbScrollDateRange; }
+ BOOL IsSelectLeft() const { return mbSelLeft; }
+
+ Size CalcWindowSizePixel( long nCalcMonthPerLine = 1,
+ long nCalcLines = 1 ) const;
+
+ void SetSelectionChangingHdl( const Link& rLink ) { maSelectionChangingHdl = rLink; }
+ const Link& GetSelectionChangingHdl() const { return maSelectionChangingHdl; }
+ void SetDateRangeChangedHdl( const Link& rLink ) { maDateRangeChangedHdl = rLink; }
+ const Link& GetDateRangeChangedHdl() const { return maDateRangeChangedHdl; }
+ void SetRequestDateInfoHdl( const Link& rLink ) { maRequestDateInfoHdl = rLink; }
+ const Link& GetRequestDateInfoHdl() const { return maRequestDateInfoHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+};
+
+inline const Color& Calendar::GetStandardColor() const
+{
+ if ( mpStandardColor )
+ return *mpStandardColor;
+ else
+ return GetFont().GetColor();
+}
+
+inline const Color& Calendar::GetSaturdayColor() const
+{
+ if ( mpSaturdayColor )
+ return *mpSaturdayColor;
+ else
+ return GetFont().GetColor();
+}
+
+inline const Color& Calendar::GetSundayColor() const
+{
+ if ( mpSundayColor )
+ return *mpSundayColor;
+ else
+ return GetFont().GetColor();
+}
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class CalendarField
+
+Bei dieser Klasse handelt es sich um ein DateField, wo ueber einen
+DropDown-Button ueber das Calendar-Control ein Datum ausgewaehlt werden
+kann.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+Siehe DateField
+
+Die Vorgaben fuer das CalendarControl koennen ueber SetCalendarStyle()
+gesetzt werden.
+
+--------------------------------------------------------------------------
+
+Mit EnableToday()/EnableNone() kann ein Today-Button und ein None-Button
+enabled werden.
+
+--------------------------------------------------------------------------
+
+Wenn mit SetCalendarStyle() WB_RANGESELECT gesetzt wird, koennen im
+Calendar auch mehrere Tage selektiert werden. Da immer nur das Start-Datum
+in das Feld uebernommen wird, sollte dann im Select-Handler mit
+GetCalendar() der Calendar abgefragt werden und an dem mit
+GetSelectDateCount()/GetSelectDate() der selektierte Bereich abgefragt
+werden, um beispielsweise diese dann in ein weiteres Feld zu uebernehmen.
+
+--------------------------------------------------------------------------
+
+Wenn ein abgeleiteter Calendar verwendet werden soll, kann am
+CalendarField die Methode CreateCalendar() ueberlagert werden und
+dort ein eigener Calendar erzeugt werden.
+
+*************************************************************************/
+
+// -----------------
+// - CalendarField -
+// -----------------
+
+class CalendarField : public DateField
+{
+private:
+ ImplCFieldFloatWin* mpFloatWin;
+ Calendar* mpCalendar;
+ WinBits mnCalendarStyle;
+ PushButton* mpTodayBtn;
+ PushButton* mpNoneBtn;
+ Date maDefaultDate;
+ BOOL mbToday;
+ BOOL mbNone;
+ Link maSelectHdl;
+
+#ifdef _SV_CALENDAR_CXX
+ DECL_LINK( ImplSelectHdl, Calendar* );
+ DECL_LINK( ImplClickHdl, PushButton* );
+ DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
+#endif
+
+public:
+ CalendarField( Window* pParent, WinBits nWinStyle );
+ CalendarField( Window* pParent, const ResId& rResId );
+ ~CalendarField();
+
+ virtual void Select();
+
+ virtual BOOL ShowDropDown( BOOL bShow );
+ virtual Calendar* CreateCalendar( Window* pParent );
+ Calendar* GetCalendar();
+
+ void SetDefaultDate( const Date& rDate ) { maDefaultDate = rDate; }
+ Date GetDefaultDate() const { return maDefaultDate; }
+
+ void EnableToday( BOOL bToday = TRUE ) { mbToday = bToday; }
+ BOOL IsTodayEnabled() const { return mbToday; }
+ void EnableNone( BOOL bNone = TRUE ) { mbNone = bNone; }
+ BOOL IsNoneEnabled() const { return mbNone; }
+
+ void SetCalendarStyle( WinBits nStyle ) { mnCalendarStyle = nStyle; }
+ WinBits GetCalendarStyle() const { return mnCalendarStyle; }
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+};
+
+#endif // _CALENDAR_HXX
diff --git a/svtools/inc/cntnrsrt.hxx b/svtools/inc/cntnrsrt.hxx
new file mode 100644
index 000000000000..d3cc20bc18dd
--- /dev/null
+++ b/svtools/inc/cntnrsrt.hxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * $RCSfile: cntnrsrt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CNTRSRT_HXX
+#define _CNTRSRT_HXX
+
+#if 0
+***********************************************************************
+*
+* Hier folgt die Beschreibung fuer die exportierten Makros:
+*
+* DECLARE_CONTAINER_SORT( ClassName, Type )
+* IMPL_CONTAINER_SORT( ClassName, Type, SortFunc )
+*
+* Definiert eine von Container abgeleitete Klasse "ClassName",
+* in der die Elemente des Typs "Type" sortiert enthalten sind.
+* Dazu muss einer Funktion "SortFunc" definiert sein, die als
+* Paramter zwei "const Type&" erwartet und 0 zurueckgibt, wenn
+* beide gleich sind, -1 wenn der erste Paramter kleiner ist als
+* der zweite und +1 wenn der erste Paramter groesser ist als
+* der zweite.
+*
+* Die Zugriffs-Methoden entsprechen in etwa denen der Container-
+* Klasse, mit Ausnahme von Insert, DeleteAndDestroy und Seek_Entry,
+* der den SV-Pointer-Arrays entsprechen.
+*
+* DECLARE_CONTAINER_SORT_DEL( ClassName, Type )
+* IMPL_CONTAINER_SORT( ClassName, Type, SortFunc )
+*
+* Wie DECLARE_CONTAINER_SORT, nur dass beim Aufruf des Destruktors
+* alle im Conatiner vorhandenen Objekte geloescht werden.
+*
+#endif
+
+#ifndef _CONTNR_HXX //autogen
+#include <tools/contnr.hxx>
+#endif
+
+#define DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \
+ ClassName( const ClassName& ); \
+ ClassName& operator =( const ClassName& ); \
+public: \
+ Container::Count; \
+ \
+ ClassName( USHORT nInitSize, USHORT nReSize ) : \
+ Container( CONTAINER_MAXBLOCKSIZE, nInitSize, nReSize ) {} \
+ \
+ BOOL Insert( Type* pObj ); \
+ \
+ Type *Remove( ULONG nPos ) \
+ { return (Type *)Container::Remove( nPos ); } \
+ \
+ Type *Remove( Type* pObj ); \
+ \
+ void DeleteAndDestroy( ULONG nPos ) \
+ { \
+ Type *pObj = Remove( nPos ); \
+ if( pObj ) \
+ delete pObj; \
+ } \
+ \
+ void DeleteAndDestroy() \
+ { while( Count() ) DeleteAndDestroy( 0 ); } \
+ \
+ Type* GetObject( ULONG nPos ) const \
+ { return (Type *)Container::GetObject( nPos ); } \
+ \
+ Type* operator[]( ULONG nPos ) const \
+ { return GetObject(nPos); } \
+ \
+ BOOL Seek_Entry( const Type *pObj, ULONG* pPos ) const; \
+ \
+ ULONG GetPos( const Type* pObj ) const; \
+
+
+#define DECLARE_CONTAINER_SORT( ClassName, Type ) \
+class ClassName : private Container \
+{ \
+ DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \
+ ~ClassName() {} \
+}; \
+
+
+#define DECLARE_CONTAINER_SORT_DEL( ClassName, Type ) \
+class ClassName : private Container \
+{ \
+ DECLARE_CONTAINER_SORT_COMMON( ClassName, Type ) \
+ ~ClassName() { DeleteAndDestroy(); } \
+}; \
+
+
+#define IMPL_CONTAINER_SORT( ClassName, Type, SortFunc ) \
+BOOL ClassName::Insert( Type *pObj ) \
+{ \
+ ULONG nPos; \
+ BOOL bExist; \
+ if( ! ( bExist = Seek_Entry( pObj, &nPos ) ) ) \
+ Container::Insert( pObj, nPos ); \
+ return !bExist; \
+} \
+ \
+Type *ClassName::Remove( Type* pObj ) \
+{ \
+ ULONG nPos; \
+ if( Seek_Entry( pObj, &nPos ) ) \
+ return Remove( nPos ); \
+ else \
+ return 0; \
+} \
+ \
+ULONG ClassName::GetPos( const Type* pObj ) const \
+{ \
+ ULONG nPos; \
+ if( Seek_Entry( pObj, &nPos ) ) \
+ return nPos; \
+ else \
+ return CONTAINER_ENTRY_NOTFOUND; \
+} \
+ \
+BOOL ClassName::Seek_Entry( const Type* pObj, ULONG* pPos ) const \
+{ \
+ register ULONG nO = Count(), \
+ nM, \
+ nU = 0; \
+ if( nO > 0 ) \
+ { \
+ nO--; \
+ while( nU <= nO ) \
+ { \
+ nM = nU + ( nO - nU ) / 2; \
+ int nCmp = SortFunc( *GetObject(nM), *pObj ); \
+ \
+ if( 0 == nCmp ) \
+ { \
+ if( pPos ) *pPos = nM; \
+ return TRUE; \
+ } \
+ else if( nCmp < 0 ) \
+ nU = nM + 1; \
+ else if( nM == 0 ) \
+ { \
+ if( pPos ) *pPos = nU; \
+ return FALSE; \
+ } \
+ else \
+ nO = nM - 1; \
+ } \
+ } \
+ if( pPos ) *pPos = nU; \
+ return FALSE; \
+} \
+
+#endif
diff --git a/svtools/inc/cntwids.hrc b/svtools/inc/cntwids.hrc
new file mode 100644
index 000000000000..652cc9304367
--- /dev/null
+++ b/svtools/inc/cntwids.hrc
@@ -0,0 +1,549 @@
+/*************************************************************************
+ *
+ * $RCSfile: cntwids.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//=========================================================================
+//
+// WID-definitions for CHAOS
+//
+// (C) 1997 StarDivision GmbH, Hamburg, Germany
+// $Author: hr $ $Date: 2000-09-18 16:58:50 $ $Revision: 1.1.1.1 $
+// $Logfile: T:/svtools/inc/cntwids.hrv $ $Workfile: CNTWIDS.HRC $
+//
+//=========================================================================
+
+#ifndef _CNTWIDS_HRC
+#define _CNTWIDS_HRC
+
+#ifndef OLD_CHAOS
+#define TF_NEW_TABPAGES
+#define CNT_COOL_ABO
+#endif
+
+//=========================================================================
+// ARGS, MSG, ALL, FOLDER, BOXALL, BOXEXT
+//=========================================================================
+
+#define WID_CHAOS_START 500
+
+//FUNC MSG
+#define WID_MARK_THREAD_MARKED (499)
+#define WID_MARK_THREAD_UNMARKED (498)
+
+// ARGS
+#define WID_DUMMY_ARG1 (WID_CHAOS_START + 0)
+#define WID_FACTORY_NO (WID_CHAOS_START + 1)
+#define WID_FACTORY_NAME (WID_CHAOS_START + 2)
+#define WID_NEWS_XREF (WID_CHAOS_START + 3)
+#define WID_CREATION_FLAGS (WID_CHAOS_START + 4)
+#define WID_FACTORY_HELP_ID (WID_CHAOS_START + 5)
+
+//FUNC MSG
+#define WID_MSG_START (WID_CHAOS_START + 6)
+#define WID_MAIL_REPLY (WID_CHAOS_START + 6)
+#define WID_POST_REPLY (WID_CHAOS_START + 7)
+#define WID_FORWARD (WID_CHAOS_START + 8)
+#define WID_MARK_THREAD_READ (WID_CHAOS_START + 9)
+#define WID_HIDE_THREAD (WID_CHAOS_START + 10)
+#define WID_HIDE_AUTHOR (WID_CHAOS_START + 11)
+#define WID_HIDE_SUBJECT (WID_CHAOS_START + 12)
+#define WID_RESEND_MSG (WID_CHAOS_START + 13)
+#define WID_MARK_THREAD_UNREAD (WID_CHAOS_START + 14)
+
+//PROP MSG
+#define WID_PRIORITY (WID_CHAOS_START + 15)
+#define WID_RULE_APPLIED (WID_CHAOS_START + 16)
+#define WID_MSG_LOCK (WID_CHAOS_START + 17)
+#define WID_SEEN_STATUS (WID_CHAOS_START + 18)
+#define WID_REPLY_TO (WID_CHAOS_START + 19)
+#define WID_IN_REPLY_TO (WID_CHAOS_START + 20)
+
+#define WID_MESSAGE_ID (WID_CHAOS_START + 21)
+#define WID_BCC (WID_CHAOS_START + 22)
+#define WID_CC (WID_CHAOS_START + 23)
+#define WID_TO (WID_CHAOS_START + 24)
+#define WID_FROM (WID_CHAOS_START + 25)
+#define WID_TITLE (WID_CHAOS_START + 26)
+#define WID_SUBJECT WID_TITLE // only here to prevent panic, should be removed
+#define WID_MESSAGEBODY (WID_CHAOS_START + 27)
+
+#define WID_REFERENCES (WID_CHAOS_START + 28)
+#define WID_NEWSGROUPS (WID_CHAOS_START + 29)
+#define WID_NEWS_XREFLIST (WID_CHAOS_START + 30)
+
+#define WID_OUTMSGINTERNALSTATE (WID_CHAOS_START + 31)
+#define WID_RECIPIENTLIST (WID_CHAOS_START + 32)
+#define WID_MSG_END (WID_CHAOS_START + 32)
+
+//FUNC ALL
+#define WID_ALL_START (WID_CHAOS_START + 33)
+#define WID_DEFAULT (WID_CHAOS_START + 33)
+#define WID_OPEN (WID_CHAOS_START + 34)
+#define WID_DELETE (WID_CHAOS_START + 35)
+#define WID_CUT (WID_CHAOS_START + 36)
+#define WID_COPY (WID_CHAOS_START + 37)
+#define WID_PASTE (WID_CHAOS_START + 38)
+#define WID_RENAME (WID_CHAOS_START + 39)
+
+#define WID_HAS_DATA (WID_CHAOS_START + 40)
+#define WID_GETDATA (WID_CHAOS_START + 41)
+#define WID_PUTDATA (WID_CHAOS_START + 42)
+
+//PROP ALL
+#define WID_INTERIM_URL (WID_CHAOS_START + 43)
+#define WID_CONTENT_TYPE (WID_CHAOS_START + 44)
+
+#define WID_OWN_URL (WID_CHAOS_START + 45)
+#define WID_REAL_URL (WID_CHAOS_START + 46)
+#define WID_OBSOLETE_TITLE (WID_CHAOS_START + 47)
+#define WID_FLAG_READONLY (WID_CHAOS_START + 48)
+
+#define WID_REFERED_URL (WID_CHAOS_START + 49)
+#define WID_REFERER_COUNT (WID_CHAOS_START + 50)
+#define WID_FLAG_IS_FOLDER (WID_CHAOS_START + 51)
+#define WID_FLAG_HAS_FOLDER (WID_CHAOS_START + 52)
+#define WID_FLAG_IS_MESSAGE (WID_CHAOS_START + 53)
+#define WID_FLAG_IS_DOCUMENT (WID_FLAG_IS_MESSAGE)
+#define WID_FLAG_HAS_MESSAGES (WID_CHAOS_START + 54)
+
+#define WID_DATE_CREATED (WID_CHAOS_START + 55)
+#define WID_DATE_MODIFIED (WID_CHAOS_START + 56)
+#define WID_VIEW_DESCRIPTION (WID_CHAOS_START + 57)
+#define WID_IS_READ (WID_CHAOS_START + 58)
+#define WID_IS_MARKED (WID_CHAOS_START + 59)
+#define WID_ALL_END (WID_CHAOS_START + 59)
+
+//FUNC FOLDER
+#define WID_FOLDER_START (WID_CHAOS_START + 60)
+#define WID_SYNCHRONIZE (WID_CHAOS_START + 60)
+#define WID_CREATE_NEW (WID_CHAOS_START + 61)
+#define WID_INSERT (WID_CHAOS_START + 62)
+#define WID_UPDATE (WID_CHAOS_START + 63)
+#define WID_IMPORT (WID_CHAOS_START + 64)
+
+//PROP FOLDER VIEW
+#define WID_DUMMY_PROPFOLDERVIEW1 (WID_CHAOS_START + 65)
+#define WID_THREADING (WID_CHAOS_START + 66)
+#define WID_MSG_COLUMN_INFO /* obsolete */ (WID_CHAOS_START + 67)
+#define WID_FLD_COLUMN_INFO /* obsolete */ (WID_CHAOS_START + 68)
+#define WID_FOLDERVIEW_MODE (WID_CHAOS_START + 69)
+#define WID_MESSAGEVIEW_MODE (WID_CHAOS_START + 70)
+#define WID_SENTMESSAGEVIEW_MODE (WID_CHAOS_START + 71)
+#define WID_SORTING (WID_CHAOS_START + 72)
+#define WID_THREADED (WID_CHAOS_START + 73)
+#define WID_FILTERED (WID_CHAOS_START + 74)
+#define WID_RULES (WID_CHAOS_START + 75)
+#define WID_SUBSCRNEWSGROUPCOUNT (WID_CHAOS_START + 76)
+#define WID_FLAG_SUBSCRIBED (WID_CHAOS_START + 77)
+#define WID_FLAG_SUPPORTMODE (WID_CHAOS_START + 78)
+
+//PROP FOLDER DIR
+#define WID_DUMMY_FOLDERDIR1 (WID_CHAOS_START + 79)
+#define WID_TOTALCONTENTCOUNT (WID_CHAOS_START + 80)
+#define WID_NEWSGROUPCOUNT /* ??? */ (WID_CHAOS_START + 81)
+#define WID_ARTICLECOUNT /* ??? */ (WID_CHAOS_START + 82)
+#define WID_KNOWN_RANGES (WID_CHAOS_START + 83)
+#define WID_IMAPFOLDERINFO (WID_CHAOS_START + 84)
+
+//PROP FOLDER USER
+#define WID_DUMMY_FOLDERUSER1 (WID_CHAOS_START + 85)
+#define WID_SEENCONTENTCOUNT (WID_CHAOS_START + 86)
+#define WID_UNREAD_ARTICLECOUNT (WID_SEENCONTENTCOUNT)
+#define WID_SENTCONTENTCOUNT (WID_SEENCONTENTCOUNT)
+#define WID_READ_RANGES (WID_CHAOS_START + 87)
+#define WID_MARK_RANGES (WID_CHAOS_START + 88)
+#define WID_FOLDER_END (WID_CHAOS_START + 88)
+
+//PROP BOXALL
+#define WID_BOXALL_START (WID_CHAOS_START + 89)
+// Used for d&d of View Storages...
+#define WID_PREPARE_MOVE (WID_CHAOS_START + 89)
+#define WID_OUTTRAY_WANTED (WID_CHAOS_START + 90)
+#define WID_USERNAME (WID_CHAOS_START + 91)
+#define WID_PASSWORD (WID_CHAOS_START + 92)
+#define WID_SERVERNAME (WID_CHAOS_START + 93)
+#define WID_SERVERPORT (WID_CHAOS_START + 94)
+// obsolete
+#define WID_MAILSEND_USERNAME (WID_CHAOS_START + 95)
+#define WID_MAILSEND_PASSWORD (WID_CHAOS_START + 96)
+#define WID_MAILSEND_SERVERNAME (WID_CHAOS_START + 97)
+#define WID_NEWSSEND_USERNAME (WID_CHAOS_START + 98)
+#define WID_NEWSSEND_PASSWORD (WID_CHAOS_START + 99)
+#define WID_NEWSSEND_SERVERNAME (WID_CHAOS_START + 100)
+// end obsolete
+#define WID_SERVERBASE (WID_CHAOS_START + 101)
+// not used
+#define WID_SMTP_GATEWAY (WID_CHAOS_START + 102)
+
+// -> ..._DEFAULT
+// obsolete
+#define WID_FROM_DEFAULT (WID_CHAOS_START + 103)
+// obsolete
+#define WID_REPLY_TO_DEFAULT (WID_CHAOS_START + 104)
+
+#define WID_AUTOUPDATE_INTERVAL (WID_CHAOS_START + 105)
+#define WID_UPDATE_ENABLED (WID_CHAOS_START + 106)
+#define WID_BOXALL_END (WID_CHAOS_START + 106)
+
+//PROP BOX RNMGR
+#define WID_BOXEXT_START (WID_CHAOS_START + 107)
+#define WID_CONNECTION_MODE (WID_CHAOS_START + 107)
+#define WID_NEWS_GROUPLIST (WID_CHAOS_START + 108)
+#ifdef OLD_CHAOS
+#define WID_BOX_CONNECTION_PROP (WID_CHAOS_START + 109)
+#else
+#define WID_MESSAGE_STOREMODE (WID_CHAOS_START + 109)
+#endif
+#define WID_DELETE_ON_SERVER (WID_CHAOS_START + 110)
+
+//PROP BOX USER
+
+//PROP BOX OUT DIR
+#define WID_OUTMSGEXTERNALSTATE (WID_CHAOS_START + 111)
+
+//PROP RNM
+#define WID_RNM_UPDATETIMER_LIST (WID_CHAOS_START + 112)
+#define WID_BOXEXT_END (WID_CHAOS_START + 112)
+
+//////////////////////////////////////////////////////////////////////////
+// MISC - Added after initial pool version
+//////////////////////////////////////////////////////////////////////////
+
+// PROP BOX
+#define WID_SERVER_RANGES (WID_CHAOS_START + 113)
+#define WID_LAST_UPDATE (WID_CHAOS_START + 114)
+#define WID_LAST_MSGID (WID_CHAOS_START + 115)
+#define WID_LAST_UID (WID_CHAOS_START + 116)
+
+// FUNC ALL
+#define WID_UNDELETE (WID_CHAOS_START + 117)
+#define WID_CLOSE (WID_CHAOS_START + 118)
+#define WID_REOPEN (WID_CHAOS_START + 119)
+
+// PROP RNM
+#define WID_RNM_FILECONVERSION_LIST (WID_CHAOS_START + 120)
+
+// PROP FOLDER
+#define WID_SHOW_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 121)
+#define WID_SHOW_MSGS_TIMELIMIT (WID_CHAOS_START + 122)
+#define WID_STORE_MSGS_HAS_TIMELIMIT (WID_CHAOS_START + 123)
+#define WID_STORE_MSGS_TIMELIMIT (WID_CHAOS_START + 124)
+
+// PROP BOX
+#define WID_MSG_COLUMN_WIDTHS /* obsolete */(WID_CHAOS_START + 125)
+
+#ifdef OLD_CHAOS
+
+#define WID_CHAOS_END (WID_CHAOS_START + 125)
+
+#else
+
+//////////////////////////////////////////////////////////////////////////
+// WID's added after SO 4.0 release ( SUPD > 364 )
+//////////////////////////////////////////////////////////////////////////
+
+// PROP ALL
+#define WID_PROPERTYLIST (WID_CHAOS_START + 126)
+
+// PROP BOXALL
+#define WID_BOXALL_START2 (WID_CHAOS_START + 127)
+#define WID_SEND_PUBLIC_PROT_ID (WID_CHAOS_START + 127)
+#define WID_SEND_PRIVATE_PROT_ID (WID_CHAOS_START + 128)
+#define WID_SEND_PUBLIC_OUTBOXPROPS (WID_CHAOS_START + 129)
+#define WID_SEND_PRIVATE_OUTBOXPROPS (WID_CHAOS_START + 130)
+#define WID_SEND_SERVERNAME (WID_CHAOS_START + 131)
+#define WID_SEND_USERNAME (WID_CHAOS_START + 132)
+#define WID_SEND_PASSWORD (WID_CHAOS_START + 133)
+#define WID_SEND_REPLY_TO_DEFAULT (WID_CHAOS_START + 134)
+#define WID_SEND_FROM_DEFAULT (WID_CHAOS_START + 135)
+#define WID_VIM_POPATH (WID_CHAOS_START + 136)
+#define WID_SEND_VIM_POPATH (WID_CHAOS_START + 137)
+#define WID_PURGE (WID_CHAOS_START + 138)
+#define WID_CLEAN_CACHE (WID_CHAOS_START + 139)
+#define WID_SEARCH (WID_CHAOS_START + 140)
+#define WID_JOURNAL (WID_CHAOS_START + 141)
+#define WID_LOCALBASE (WID_CHAOS_START + 142)
+#define WID_BOXALL_END2 (WID_CHAOS_START + 142)
+
+// PROP DOCUMENT
+#define WID_DOCUMENT_HEADER (WID_CHAOS_START + 143)
+#define WID_DOCUMENT_BODY (WID_CHAOS_START + 144)
+#define WID_DOCUMENT_SIZE (WID_CHAOS_START + 145)
+
+// PROP ALL
+#define WID_SIZE WID_DOCUMENT_SIZE
+
+// PROP PROJECT
+#define WID_PRJ_MEDIUM (WID_CHAOS_START + 146)
+#define WID_PRJ_FILENAMECONVENTION (WID_CHAOS_START + 147)
+
+// PROP FSYS
+#define WID_FSYS_DISKSPACE_LEFT (WID_CHAOS_START + 148)
+#define WID_TRANSFER (WID_CHAOS_START + 149)
+
+// PROP ALL
+#define WID_KEYWORDS (WID_CHAOS_START + 150)
+#define WID_IS_PROTECTED (WID_CHAOS_START + 151)
+
+// PROP SEARCH
+#define WID_SEARCH_CRITERIA (WID_CHAOS_START + 152)
+#define WID_SEARCH_LOCATIONS (WID_CHAOS_START + 153)
+#define WID_SEARCH_RECURSIVE (WID_CHAOS_START + 154)
+#define WID_SEARCH_FOLDER_VIEW (WID_CHAOS_START + 155)
+#define WID_SEARCH_DOCUMENT_VIEW (WID_CHAOS_START + 156)
+
+// PROP Channel
+#define WID_SCHEDULE_RANGE (WID_CHAOS_START + 157)
+#define WID_ALLOWED_SCHEDULE_RANGE (WID_CHAOS_START + 158)
+#define WID_TARGET_URL (WID_CHAOS_START + 159)
+#define WID_FREQUENCY (WID_CHAOS_START + 160)
+
+// PROP HTTP
+#define WID_HTTP_CONNECTION_LIMIT (WID_CHAOS_START + 161)
+#define WID_HTTP_COOKIE_MANAGER (WID_CHAOS_START + 162)
+
+// PROP Channel
+#define WID_COLUMN_NEXT_UPD (WID_CHAOS_START + 163)
+#define WID_CRAWL_STATUS (WID_CHAOS_START + 164)
+#define WID_CRAWL_LEVEL (WID_CHAOS_START + 165)
+#define WID_CRAWL_MODE (WID_CHAOS_START + 166)
+// WID_CRAWL_MAX_VOLUME shall be removed in the future!
+// --> WID_SIZE_LIMIT
+#define WID_CRAWL_MAX_VOLUME (WID_CHAOS_START + 167)
+#define WID_CRAWL_IMAGE (WID_CHAOS_START + 168)
+#define WID_CRAWL_LINK_OUT (WID_CHAOS_START + 169)
+#define WID_NOTIFICATION_MODE (WID_CHAOS_START + 170)
+#define WID_NOTIFICATION_ADDRESS (WID_CHAOS_START + 171)
+
+// PROP BOXALL
+#define WID_ACCOUNT (WID_CHAOS_START + 172)
+
+// PROP FSYS
+#define WID_FSYS_KIND (WID_CHAOS_START + 173)
+#define WID_FSYS_FLAGS (WID_CHAOS_START + 174)
+
+// PROP FOLDER
+#define WID_VIEWDATA /* obsolete */ (WID_CHAOS_START + 175)
+
+// PROP FSYS
+#define WID_WHO_IS_MASTER (WID_CHAOS_START + 176)
+
+// FUNC HTTP
+#define WID_HTTP_POST (WID_CHAOS_START + 177)
+
+// PROP ALL
+#define WID_SUPPORTED_FUNCS (WID_CHAOS_START + 178)
+#define WID_SIZE_LIMIT (WID_CHAOS_START + 179)
+
+// PROP FOLDER
+#define WID_MARKED_DOCUMENT_COUNT (WID_CHAOS_START + 180)
+#define WID_FOLDER_COUNT (WID_CHAOS_START + 181)
+
+// PROP FSYS
+#define WID_FSYS_SHOW_HIDDEN (WID_CHAOS_START + 182)
+
+// TRASHCAN
+#define WID_TRASHCAN_START (WID_CHAOS_START + 183)
+#define WID_TRASHCAN_EMPTY_TRASH (WID_CHAOS_START + 183)
+#define WID_TRASHCAN_FLAG_AUTODELETE (WID_CHAOS_START + 184)
+#define WID_TRASHCAN_FLAG_CONFIRMEMPTY (WID_CHAOS_START + 185)
+#define WID_TRASHCAN_DUMMY1 (WID_CHAOS_START + 186)
+#define WID_TRASHCAN_DUMMY2 (WID_CHAOS_START + 187)
+#define WID_TRASHCAN_END (WID_CHAOS_START + 187)
+
+// TRASH
+#define WID_TRASH_START (WID_CHAOS_START + 188)
+#define WID_TRASH_RESTORE (WID_CHAOS_START + 188)
+#define WID_TRASH_ORIGIN (WID_CHAOS_START + 189)
+#define WID_TRASH_DUMMY2 (WID_CHAOS_START + 190)
+#define WID_TRASH_END (WID_CHAOS_START + 190)
+
+// PROP ALL
+#define WID_TARGET_FRAMES (WID_CHAOS_START + 191)
+
+// FUNC FOLDER
+#define WID_EXPORT (WID_CHAOS_START + 192)
+
+// COMPONENT
+#define WID_COMPONENT_COMMAND (WID_CHAOS_START + 193)
+#define WID_COMPONENT_MENU (WID_CHAOS_START + 194)
+
+// PROP Channel
+#define WID_HREF (WID_CHAOS_START + 195)
+
+// PROP FOLDER (VIEW)
+#define WID_VIEW_START (WID_CHAOS_START + 196)
+#define WID_VIEW_COLS_BEAMER (WID_CHAOS_START + 196)
+#define WID_VIEW_COLS_FILEDLG (WID_CHAOS_START + 197)
+#define WID_VIEW_COLS_FLDWIN (WID_CHAOS_START + 198)
+#define WID_VIEW_MODE_FLDWIN (WID_CHAOS_START + 199)
+#define WID_VIEW_LAYOUT_FLDWIN (WID_CHAOS_START + 200)
+#define WID_VIEW_ICON_POS_FLDWIN (WID_CHAOS_START + 201)
+#define WID_VIEW_SORT_BEAMER (WID_CHAOS_START + 202)
+#define WID_VIEW_SORT_FILEDLG (WID_CHAOS_START + 203)
+#define WID_VIEW_SORT_FLDWIN_DETAILS (WID_CHAOS_START + 204)
+#define WID_VIEW_SORT_FLDWIN_ICON (WID_CHAOS_START + 205)
+#define WID_VIEW_WINDOW_POS_FLDWIN (WID_CHAOS_START + 206)
+#define WID_VIEW_END (WID_CHAOS_START + 206)
+
+// PROP ALL
+#define WID_IS_INVALID (WID_CHAOS_START + 207)
+
+// PROP Channel
+#define WID_VIEW_TIPHELP (WID_CHAOS_START + 208)
+#define WID_PUBLISHER_SCHEDULE (WID_CHAOS_START + 209)
+#define WID_GETMODE (WID_CHAOS_START + 210)
+#define WID_READ_OFFLINE (WID_CHAOS_START + 211)
+
+// PROP ALL
+#define WID_ALL_START2 (WID_CHAOS_START + 212)
+#define WID_REAL_NAME (WID_CHAOS_START + 212)
+#define WID_FLAG_UPDATE_ON_OPEN (WID_CHAOS_START + 213)
+#define WID_ACTION_LIST (WID_CHAOS_START + 214)
+#define WID_EDIT_STRING (WID_CHAOS_START + 215)
+#define WID_SET_AS_DEFAULT (WID_CHAOS_START + 216)
+#define WID_ALL_END2 (WID_CHAOS_START + 216)
+
+// PROP FOLDER (VIEW)
+#define WID_VIEW2_START (WID_CHAOS_START + 217)
+#define WID_VIEW2_FLD_PIC (WID_CHAOS_START + 217)
+#define WID_FLAG_EXPANDED (WID_CHAOS_START + 218)
+#define WID_CHILD_DEFAULTS (WID_CHAOS_START + 219)
+#define WID_VIEW2_END (WID_CHAOS_START + 219)
+
+// PROP HTTP
+#define WID_HTTP_KEEP_EXPIRED (WID_CHAOS_START + 220)
+#define WID_HTTP_VERIFY_MODE (WID_CHAOS_START + 221)
+#define WID_HTTP_NOCACHE_LIST (WID_CHAOS_START + 222)
+#define WID_HTTP_REFERER (WID_CHAOS_START + 223)
+
+// PROP FSYS
+#define WID_FSYS_START (WID_CHAOS_START + 224)
+#define WID_FSYS_VALUE_FOLDER (WID_CHAOS_START + 224)
+#define WID_FSYS_SHOW_EXTENSION (WID_CHAOS_START + 225)
+#define WID_VALUE_ADDED_MODE (WID_CHAOS_START + 226)
+#define WID_FSYS_DUMMY3 (WID_CHAOS_START + 227)
+#define WID_FSYS_DUMMY4 (WID_CHAOS_START + 228)
+#define WID_FSYS_END (WID_CHAOS_START + 228)
+
+// FUNC HTTP
+#define WID_HTTP_GET_COOKIE (WID_CHAOS_START + 229)
+#define WID_HTTP_SET_COOKIE (WID_CHAOS_START + 230)
+
+// PROP HTTP
+#define WID_HTTP_COOKIE (WID_CHAOS_START + 231)
+#define WID_HTTP_DUMMY_1 (WID_CHAOS_START + 232)
+
+//////////////////////////////////////////////////////////////////////////
+// WID's added after SO 5.0 release ( SUPD > 505 )
+//////////////////////////////////////////////////////////////////////////
+
+// PROP FOLDER
+#define WID_FOLDER_START2 (WID_CHAOS_START + 233)
+#define WID_USER_SORT_CRITERIUM (WID_CHAOS_START + 233)
+#define WID_HEADER_CONFIG (WID_CHAOS_START + 234)
+#define WID_GROUPVIEW_CONFIG (WID_CHAOS_START + 235)
+#define WID_FLD_WEBVIEW_TEMPLATE (WID_CHAOS_START + 236)
+// eigene Iconpositionen fuer den Explorer, da er noch
+// keinen eigenen View-Storage hat
+#define WID_VIEW_ICON_POS_GRPWIN (WID_CHAOS_START + 237)
+#define WID_FOLDER_END2 (WID_CHAOS_START + 237)
+
+// PROP ALL
+#define WID_SHOW_IN_EXPLORER (WID_CHAOS_START + 238)
+
+// PROP FOLDER (VIEW)
+#define WID_VIEW3_START (WID_CHAOS_START + 239)
+#define WID_FLD_FONT (WID_CHAOS_START + 239)
+#define WID_FLD_WEBVIEW_USE_GLOBAL (WID_CHAOS_START + 240)
+#define WID_VIEW3_DUMMY2 (WID_CHAOS_START + 241)
+#define WID_VIEW3_DUMMY3 (WID_CHAOS_START + 242)
+#define WID_VIEW3_END (WID_CHAOS_START + 242)
+
+// PROP FTP
+#define WID_FTP_ACCOUNT (WID_CHAOS_START + 243)
+
+// PROP FOLDER
+#define WID_STORE_MARKED (WID_CHAOS_START + 244)
+
+// REPLICATION ( Currently only here to have file compatibility between
+// SO51 Client and SO51 Server, for which the functionality
+// first shall be implemented ).
+#define WID_REPLICATION_1 (WID_CHAOS_START + 245)
+#define WID_REPLICATION_2 (WID_CHAOS_START + 246)
+#define WID_REPLICATION_3 (WID_CHAOS_START + 247)
+#define WID_REPLICATION_4 (WID_CHAOS_START + 248)
+#define WID_REPLICATION_5 (WID_CHAOS_START + 249)
+
+// PROP SEARCH
+#define WID_SEARCH_INDIRECTIONS (WID_CHAOS_START + 250)
+
+// PROP ALL
+#define WID_SEND_FORMATS (WID_CHAOS_START + 251)
+#define WID_SEND_COPY_TARGET (WID_CHAOS_START + 252)
+
+// FUNC ALL
+#define WID_TRANSFER_RESULT (WID_CHAOS_START + 253)
+
+// END
+#define WID_CHAOS_END (WID_CHAOS_START + 253)
+
+#endif /* OLD_CHAOS */
+
+#endif /* !_CNTWIDS_HRC */
diff --git a/svtools/inc/ctrlbox.hxx b/svtools/inc/ctrlbox.hxx
new file mode 100644
index 000000000000..81f469abd27c
--- /dev/null
+++ b/svtools/inc/ctrlbox.hxx
@@ -0,0 +1,524 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrlbox.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CTRLBOX_HXX
+#define _CTRLBOX_HXX
+
+#ifndef _INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef _LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _COMBOBOX_HXX
+#include <vcl/combobox.hxx>
+#endif
+#ifndef _IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+#ifndef _VIRDEV_HXX
+#include <vcl/virdev.hxx>
+#endif
+#ifndef _METRIC_HXX
+#include <vcl/metric.hxx>
+#endif
+#ifndef _FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+
+class ImplFontList;
+class ImpColorList;
+class ImpLineList;
+class FontList;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class ColorListBox
+
+Beschreibung
+
+Erlaubt die Auswahl von Farben.
+
+--------------------------------------------------------------------------
+
+class LineListBox
+
+Beschreibung
+
+Erlaubt die Auswahl von Linien-Styles und Groessen. Es ist darauf zu achten,
+das vor dem ersten Insert die Units und die Fesntergroesse gesetzt sein
+muessen. An Unit wird Point und mm unterstuetzt und als SourceUnit Point,
+mm und Twips. Alle Angaben muessen in 100teln der jeweiligen Einheit
+vorliegen.
+
+Line1 ist aeussere, Line2 die innere und Distance die Distanz zwischen
+den beiden Linien. Wenn Line2 = 0 ist, wird nur Line1 angezeigt. Als
+Default sind sowohl Source als auch Ziel-Unit FUNIT_POINT.
+
+Mit SetColor() kann die Linienfarbe eingestellt werden.
+
+Anmerkungen und Ausnahmen
+
+Gegenueber einer normalen ListBox, koennen keine User-Daten gesetzt
+werden. Ausserdem sollte wenn der UpdateMode ausgeschaltet ist, keine
+Daten abgefragt oder die Selektion gesetzt werden, da in diesem Zustand
+die Daten nicht definiert sind. Wenn der UpdateMode ausgeschaltet ist,
+sollte der Rueckgabewert bei Insert nicht ausgewertet werden, da er keine
+Bedeutung hat. Ausserdem darf nicht das WinBit WB_SORT gesetzt sein.
+
+--------------------------------------------------------------------------
+
+class FontNameBox
+
+Beschreibung
+
+Erlaubt die Auswahl von Fonts. Die ListBox wird mit Fill gefuellt, wo
+ein Pointer auf eine FontList uebergeben werden muss.
+
+Mit EnableWYSIWYG() kann man einstellen, das die Fontnamen in Ihrer Schrift
+angezeigt werden und mit EnableSymbols() kann eingestellt werden, das
+vor dem Namen ueber ein Symbol angezeigt wird, ob es sich um eine
+Drucker oder Bildschirmschrift handelt.
+
+Querverweise
+
+FontList; FontStyleBox; FontSizeBox; FontNameMenu
+
+--------------------------------------------------------------------------
+
+class FontStyleBox
+
+Beschreibung
+
+Erlaubt die Auswahl eines FontStyles. Mit Fill wird die ListBox mit
+den Styles zum uebergebenen Font gefuellt. Nachgebildete Styles werden
+immer mit eingefuegt (kann sich aber noch aendern, da vielleicht
+nicht alle Applikationen [StarDraw,Formel,FontWork] mit Syntetic-Fonts
+umgehen koennen). Bei Fill bleibt vorherige Name soweit wie moeglich
+erhalten.
+
+Fuer DontKnow sollte die FontStyleBox mit String() gefuellt werden.
+Dann enthaellt die Liste die Standardattribute. Der Style, der gerade
+angezeigt wird, muss gegebenenfalls noch vom Programm zurueckgesetzt werden.
+
+Querverweise
+
+FontList; FontNameBox; FontSizeBox; FontStyleMenu
+
+--------------------------------------------------------------------------
+
+class FontSizeBox
+
+Beschreibung
+
+Erlaubt die Auswahl von Fontgroessen. Werte werden ueber GetValue()
+abgefragt und ueber SetValue() gesetzt. Fill fuellt die ListBox mit den
+Groessen zum uebergebenen Font. Alle Groessen werden in 10tel Point
+angegeben. Die FontListe, die bei Fill uebergeben wird, muss bis zum
+naechsten Fill-Aufruf erhalten bleiben.
+
+Zusaetzlich erlaubt die FontSizeBox noch einen Relative-Mode. Dieser
+dient dazu, Prozent-Werte eingeben zu koennen. Dies kann zum Beispiel
+nuetzlich sein, wenn man die Box in einem Vorlagen-Dialog anbietet.
+Dieser Modus ist nur anschaltbar, jedoch nicht wieder abschaltbar.
+
+Fuer DontKnow sollte die FontSizeBox mit FontInfo() gefuellt werden.
+Dann enthaellt die Liste die Standardgroessen. Die Groesse, die gerade
+angezeigt wird, muss gegebenenfalls noch vom Programm zurueckgesetzt werden.
+
+Querverweise
+
+FontList; FontNameBox; FontStyleBox; FontSizeMenu
+
+*************************************************************************/
+
+// ----------------
+// - ColorListBox -
+// ----------------
+
+class ColorListBox : public ListBox
+{
+ ImpColorList* pColorList; // Separate Liste, falls UserDaten von aussen verwendet werden.
+ Size aImageSize;
+
+#ifdef _CTRLBOX_CXX
+ void ImplInit();
+ void ImplDestroyColorEntries();
+#endif
+
+public:
+ ColorListBox( Window* pParent,
+ WinBits nWinStyle = WB_BORDER );
+ ColorListBox( Window* pParent, const ResId& rResId );
+ virtual ~ColorListBox();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ USHORT InsertEntry( const XubString& rStr,
+ USHORT nPos = LISTBOX_APPEND );
+ USHORT InsertEntry( const Color& rColor, const XubString& rStr,
+ USHORT nPos = LISTBOX_APPEND );
+ void RemoveEntry( USHORT nPos );
+ void Clear();
+ void CopyEntries( const ColorListBox& rBox );
+
+ USHORT GetEntryPos( const XubString& rStr ) const
+ { return ListBox::GetEntryPos( rStr ); }
+
+ USHORT GetEntryPos( const Color& rColor ) const;
+ Color GetEntryColor( USHORT nPos ) const;
+ Size GetImageSize() const { return aImageSize; }
+
+ void SelectEntry( const XubString& rStr, BOOL bSelect = TRUE )
+ { ListBox::SelectEntry( rStr, bSelect ); }
+ void SelectEntry( const Color& rColor, BOOL bSelect = TRUE );
+ XubString GetSelectEntry( USHORT nSelIndex = 0 ) const
+ { return ListBox::GetSelectEntry( nSelIndex ); }
+ Color GetSelectEntryColor( USHORT nSelIndex = 0 ) const;
+ BOOL IsEntrySelected( const XubString& rStr ) const
+ { return ListBox::IsEntrySelected( rStr ); }
+
+ BOOL IsEntrySelected( const Color& rColor ) const;
+
+private:
+ // Wegen einigen Compilern hier nocheinmal private deklariert, da
+ // ansonsten die Compiler diese als Default-Funktionen implementieren
+ ColorListBox( const ColorListBox& );
+ ColorListBox& operator =( const ColorListBox& );
+ USHORT GetEntryPos( const void* pData ) const;
+ void SetEntryData( USHORT nPos, void* pNewData );
+ void* GetEntryData( USHORT nPos ) const;
+};
+
+inline void ColorListBox::SelectEntry( const Color& rColor, BOOL bSelect )
+{
+ USHORT nPos = GetEntryPos( rColor );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ ListBox::SelectEntryPos( nPos, bSelect );
+}
+
+inline BOOL ColorListBox::IsEntrySelected( const Color& rColor ) const
+{
+ USHORT nPos = GetEntryPos( rColor );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nPos );
+ else
+ return FALSE;
+}
+
+inline Color ColorListBox::GetSelectEntryColor( USHORT nSelIndex ) const
+{
+ USHORT nPos = GetSelectEntryPos( nSelIndex );
+ Color aColor;
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ aColor = GetEntryColor( nPos );
+ return aColor;
+}
+
+// ---------------
+// - LineListBox -
+// ---------------
+
+class LineListBox : public ListBox
+{
+ ImpLineList* pLineList;
+ VirtualDevice aVirDev;
+ International aIntn;
+ Size aTxtSize;
+ Color aColor;
+ FieldUnit eUnit;
+ FieldUnit eSourceUnit;
+
+#ifdef _CTRLBOX_CXX
+ void ImpGetLine( long nLine1, long nLine2, long nDistance,
+ Bitmap& rBmp, XubString& rStr );
+ void ImplInit();
+#endif
+
+public:
+ LineListBox( Window* pParent,
+ WinBits nWinStyle = WB_BORDER );
+ LineListBox( Window* pParent, const ResId& rResId );
+ virtual ~LineListBox();
+
+ USHORT InsertEntry( const XubString& rStr,
+ USHORT nPos = LISTBOX_APPEND );
+ USHORT InsertEntry( long nLine1, long nLine2 = 0,
+ long nDistance = 0,
+ USHORT nPos = LISTBOX_APPEND );
+ void RemoveEntry( USHORT nPos );
+ void Clear();
+
+ USHORT GetEntryPos( const XubString& rStr ) const
+ { return ListBox::GetEntryPos( rStr ); }
+ USHORT GetEntryPos( long nLine1, long nLine2 = 0,
+ long nDistance = 0 ) const;
+ long GetEntryLine1( USHORT nPos ) const;
+ long GetEntryLine2( USHORT nPos ) const;
+ long GetEntryDistance( USHORT nPos ) const;
+
+ void SelectEntry( const XubString& rStr, BOOL bSelect = TRUE )
+ { ListBox::SelectEntry( rStr, bSelect ); }
+ void SelectEntry( long nLine1, long nLine2 = 0,
+ long nDistance = 0, BOOL bSelect = TRUE );
+ long GetSelectEntryLine1( USHORT nSelIndex = 0 ) const;
+ long GetSelectEntryLine2( USHORT nSelIndex = 0 ) const;
+ long GetSelectEntryDistance( USHORT nSelIndex = 0 ) const;
+ BOOL IsEntrySelected( const XubString& rStr ) const
+ { return ListBox::IsEntrySelected( rStr ); }
+ BOOL IsEntrySelected( long nLine1, long nLine2 = 0,
+ long nDistance = 0 ) const;
+
+ void SetUnit( FieldUnit eNewUnit ) { eUnit = eNewUnit; }
+ FieldUnit GetUnit() const { return eUnit; }
+ void SetSourceUnit( FieldUnit eNewUnit ) { eSourceUnit = eNewUnit; }
+ FieldUnit GetSourceUnit() const { return eSourceUnit; }
+
+ void SetColor( const Color& rColor );
+ Color GetColor() const { return aColor; }
+
+private:
+ // Wegen einigen Compilern hier nocheinmal private deklariert, da
+ // ansonsten die Compiler diese als Default-Funktionen implementieren
+ LineListBox( const LineListBox& );
+ LineListBox& operator =( const LineListBox& );
+ USHORT GetEntryPos( const void* pData ) const;
+ void SetEntryData( USHORT nPos, void* pNewData );
+ void* GetEntryData( USHORT nPos ) const;
+};
+
+inline void LineListBox::SelectEntry( long nLine1, long nLine2,
+ long nDistance, BOOL bSelect )
+{
+ USHORT nPos = GetEntryPos( nLine1, nLine2, nDistance );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ ListBox::SelectEntryPos( nPos, bSelect );
+}
+
+inline long LineListBox::GetSelectEntryLine1( USHORT nSelIndex ) const
+{
+ USHORT nPos = GetSelectEntryPos( nSelIndex );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return GetEntryLine1( nPos );
+ else
+ return 0;
+}
+
+inline long LineListBox::GetSelectEntryLine2( USHORT nSelIndex ) const
+{
+ USHORT nPos = GetSelectEntryPos( nSelIndex );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return GetEntryLine2( nPos );
+ else
+ return 0;
+}
+
+inline long LineListBox::GetSelectEntryDistance( USHORT nSelIndex ) const
+{
+ USHORT nPos = GetSelectEntryPos( nSelIndex );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return GetEntryDistance( nPos );
+ else
+ return 0;
+}
+
+inline BOOL LineListBox::IsEntrySelected( long nLine1, long nLine2,
+ long nDistance ) const
+{
+ USHORT nPos = GetEntryPos( nLine1, nLine2, nDistance );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return IsEntryPosSelected( nPos );
+ else
+ return FALSE;
+}
+
+// ---------------
+// - FontNameBox -
+// ---------------
+
+class FontNameBox : public ComboBox
+{
+private:
+ ImplFontList* mpFontList;
+ Image maImagePrinterFont;
+ Image maImageBitmapFont;
+ Image maImageScalableFont;
+ BOOL mbWYSIWYG;
+ BOOL mbSymbols;
+
+#ifdef _CTRLBOX_CXX
+ void ImplCalcUserItemSize();
+ void ImplDestroyFontList();
+#endif
+
+public:
+ FontNameBox( Window* pParent,
+ WinBits nWinStyle = WB_SORT );
+ FontNameBox( Window* pParent, const ResId& rResId );
+ virtual ~FontNameBox();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void Fill( const FontList* pList );
+
+ void EnableWYSIWYG( BOOL bEnable = TRUE );
+ BOOL IsWYSIWYGEnabled() const { return mbWYSIWYG; }
+
+ void EnableSymbols( BOOL bEnable = TRUE );
+ BOOL IsSymbolsEnabled() const { return mbSymbols; }
+
+private:
+ // Wegen einigen Compilern hier nocheinmal private deklariert, da
+ // ansonsten die Compiler diese als Default-Funktionen implementieren
+ FontNameBox( const FontNameBox& );
+ FontNameBox& operator =( const FontNameBox& );
+};
+
+// ----------------
+// - FontStyleBox -
+// ----------------
+
+class FontStyleBox : public ComboBox
+{
+ XubString aLastStyle;
+
+public:
+ FontStyleBox( Window* pParent, WinBits nWinStyle = 0 );
+ FontStyleBox( Window* pParent, const ResId& rResId );
+ virtual ~FontStyleBox();
+
+ virtual void Select();
+ virtual void LoseFocus();
+ virtual void Modify();
+
+ void SetText( const XubString& rText );
+ void Fill( const XubString& rName, const FontList* pList );
+
+private:
+ // Wegen einigen Compilern hier nocheinmal private deklariert, da
+ // ansonsten die Compiler diese als Default-Funktionen implementieren
+ FontStyleBox( const FontStyleBox& );
+ FontStyleBox& operator =( const FontStyleBox& );
+};
+
+inline void FontStyleBox::SetText( const XubString& rText )
+{
+ aLastStyle = rText;
+ ComboBox::SetText( rText );
+}
+
+// ---------------
+// - FontSizeBox -
+// ---------------
+
+class FontSizeBox : public MetricBox
+{
+ FontInfo aFontInfo;
+ const FontList* pFontList;
+ USHORT nRelMin;
+ USHORT nRelMax;
+ USHORT nRelStep;
+ short nPtRelMin;
+ short nPtRelMax;
+ short nPtRelStep;
+ BOOL bRelativeMode:1,
+ bRelative:1,
+ bPtRelative:1,
+ bStdSize:1;
+
+#ifdef _CTRLBOX_CXX
+ void ImplInit();
+#endif
+
+protected:
+ virtual XubString CreateFieldText( long nValue ) const;
+
+public:
+ FontSizeBox( Window* pParent, WinBits nWinStyle = 0 );
+ FontSizeBox( Window* pParent, const ResId& rResId );
+ virtual ~FontSizeBox();
+
+ void Modify();
+
+ void Fill( const FontInfo& rInfo, const FontList* pList );
+
+ void EnableRelativeMode( USHORT nMin = 50, USHORT nMax = 150,
+ USHORT nStep = 5 );
+ void EnablePtRelativeMode( short nMin = -200, short nMax = 200,
+ short nStep = 10 );
+ BOOL IsRelativeMode() const { return bRelativeMode; }
+ void SetRelative( BOOL bRelative = FALSE );
+ BOOL IsRelative() const { return bRelative; }
+ BOOL IsPtRelative() const { return bPtRelative; }
+ void SetPtRelative( BOOL bPtRel = TRUE )
+ { bPtRelative = bPtRel; SetRelative( TRUE ); }
+
+private:
+ // Wegen einigen Compilern hier nocheinmal private deklariert, da
+ // ansonsten die Compiler diese als Default-Funktionen implementieren
+ FontSizeBox( const FontSizeBox& );
+ FontSizeBox& operator =( const FontSizeBox& );
+};
+
+#endif // _CTRLBOX_HXX
diff --git a/svtools/inc/ctrltool.hxx b/svtools/inc/ctrltool.hxx
new file mode 100644
index 000000000000..dbb6f1831577
--- /dev/null
+++ b/svtools/inc/ctrltool.hxx
@@ -0,0 +1,257 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrltool.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CTRLTOOL_HXX
+#define _CTRLTOOL_HXX
+
+#ifndef _SAL_TYPES_H
+#include <sal/types.h>
+#endif
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _METRIC_HXX
+#include <vcl/metric.hxx>
+#endif
+
+class ImplFontListNameInfo;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class FontList
+
+Diese Klasse verwaltet alle Fonts, die auf einem oder zwei Ausgabegeraeten
+dargestellt werden koennen. Zusaetzlich bietet die Klasse Methoden an, um
+aus Fett und Kursiv den StyleName zu generieren oder aus einem Stylename
+die fehlenden Attribute. Zusaetzlich kann diese Klasse syntetisch nachgebildete
+Fonts verarbeiten. Diese Klasse kann mit verschiedenen Standard-Controls und
+Standard-Menus zusammenarbeiten.
+
+Querverweise
+
+class FontNameBox, class FontStyleBox, class FontSizeBox,
+class FontNameMenu, class FontStyleMenu, class FontSizeMenu
+
+--------------------------------------------------------------------------
+
+FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2 = NULL,
+ BOOL bAll = TRUE );
+
+Konstruktor der Klasse FontList. Vom uebergebenen OutputDevice werden die
+entsprechenden Fonts abgefragt. Das OutputDevice muss solange existieren,
+wie auch die Klasse FontList existiert. Optional kann noch ein 2tes
+Ausgabedevice uebergeben werden, damit man zum Beispiel die Fonts von
+einem Drucker und dem Bildschirm zusammen in einer FontListe verwalten kann
+und somit auch den FontListen und FontMenus die Fonts von beiden OutputDevices
+zu uebergeben. Auch das pDevice2 muss solange existieren, wie die Klasse
+FontList existiert.
+
+Das OutputDevice, welches als erstes uebergeben wird, sollte das bevorzugte
+sein. Dies sollte im normalfall der Drucker sein. Denn wenn 2 verschiede
+Device-Schriften (eine fuer Drucker und eine fuer den Bildschirm) vorhanden
+sind, wird die vom uebergebenen Device "pDevice" bevorzugt.
+
+Mit dem dritten Parameter kann man angeben, ob nur skalierbare Schriften
+abgefragt werden sollen oder alle. Wenn TRUE uebergeben wird, werden auch
+Bitmap-Schriften mit abgefragt. Bei FALSE werden Vector-Schriften und
+scalierbare Schriften abgefragt.
+
+--------------------------------------------------------------------------
+
+String FontList::GetStyleName( const FontInfo& rInfo ) const;
+
+Diese Methode gibt den StyleName von einer FontInfo zurueck. Falls kein
+StyleName gesetzt ist, wird aus den gesetzten Attributen ein entsprechender
+Name generiert, der dem Anwender praesentiert werden kann.
+
+--------------------------------------------------------------------------
+
+XubString FontList::GetFontMapText( const FontInfo& rInfo ) const;
+
+Diese Methode gibt einen Matchstring zurueck, der dem Anwender
+anzeigen soll, welche Probleme es mit diesem Font geben kann.
+
+--------------------------------------------------------------------------
+
+FontInfo FontList::Get( const String& rName, const String& rStyleName ) const;
+
+Diese Methode sucht aus dem uebergebenen Namen und dem uebergebenen StyleName
+die entsprechende FontInfo-Struktur raus. Der Stylename kann in dieser
+Methode auch ein syntetischer sein. In diesem Fall werden die entsprechenden
+Werte in der FontInfo-Struktur entsprechend gesetzt. Wenn ein StyleName
+uebergeben wird, kann jedoch eine FontInfo-Struktur ohne Stylename
+zurueckgegeben werden. Um den StyleName dem Anwender zu repraesentieren,
+muss GetStyleName() mit dieser FontInfo-Struktur aufgerufen werden.
+
+Querverweise
+
+FontList::GetStyleName()
+
+--------------------------------------------------------------------------
+
+FontInfo FontList::Get( const String& rName, FontWeight eWeight,
+ FontItalic eItalic ) const;
+
+Diese Methode sucht aus dem uebergebenen Namen und den uebergebenen Styles
+die entsprechende FontInfo-Struktur raus. Diese Methode kann auch eine
+FontInfo-Struktur ohne Stylename zurueckgegeben. Um den StyleName dem
+Anwender zu repraesentieren, muss GetStyleName() mit dieser FontInfo-Struktur
+aufgerufen werden.
+
+Querverweise
+
+FontList::GetStyleName()
+
+--------------------------------------------------------------------------
+
+const long* FontList::GetSizeAry( const FontInfo& rInfo ) const;
+
+Diese Methode liefert zum uebergebenen Font die vorhandenen Groessen.
+Falls es sich dabei um einen skalierbaren Font handelt, werden Standard-
+Groessen zurueckgegeben. Das Array enthaelt die Hoehen des Fonts in 10tel
+Point. Der letzte Wert des Array ist 0. Das Array, was zurueckgegeben wird,
+wird von der FontList wieder zerstoert. Nach dem Aufruf der naechsten Methode
+von der FontList, sollte deshalb das Array nicht mehr referenziert werden.
+
+*************************************************************************/
+
+// ------------
+// - FontList -
+// ------------
+
+#define FONTLIST_FONTINFO_NOTFOUND ((USHORT)0xFFFF)
+
+#define FONTLIST_FONTNAMETYPE_PRINTER ((USHORT)0x0001)
+#define FONTLIST_FONTNAMETYPE_SCREEN ((USHORT)0x0002)
+#define FONTLIST_FONTNAMETYPE_SCALABLE ((USHORT)0x0004)
+
+class FontList : private List
+{
+private:
+ XubString maMapBoth;
+ XubString maMapPrinterOnly;
+ XubString maMapScreenOnly;
+ XubString maMapSizeNotAvailable;
+ XubString maMapStyleNotAvailable;
+ XubString maMapNotAvailable;
+ XubString maLight;
+ XubString maLightItalic;
+ XubString maNormal;
+ XubString maNormalItalic;
+ XubString maBold;
+ XubString maBoldItalic;
+ XubString maBlack;
+ XubString maBlackItalic;
+ long* mpSizeAry;
+ OutputDevice* mpDev;
+ OutputDevice* mpDev2;
+
+#ifdef CTRLTOOL_CXX
+ ImplFontListNameInfo* ImplFind( const XubString& rSearchName, ULONG* pIndex ) const;
+ ImplFontListNameInfo* ImplFindByName( const XubString& rStr ) const;
+ void ImplInsertFonts( OutputDevice* pDev, BOOL bAll,
+ BOOL bInsertData );
+#endif
+
+public:
+ FontList( OutputDevice* pDevice,
+ OutputDevice* pDevice2 = NULL,
+ BOOL bAll = TRUE );
+ ~FontList();
+
+ OutputDevice* GetDevice() const { return mpDev; }
+ OutputDevice* GetDevice2() const { return mpDev2; }
+ XubString GetFontMapText( const FontInfo& rInfo ) const;
+ USHORT GetFontNameType( const XubString& rFontName ) const;
+
+ const XubString& GetNormalStr() const { return maNormal; }
+ const XubString& GetItalicStr() const { return maNormalItalic; }
+ const XubString& GetBoldStr() const { return maBold; }
+ const XubString& GetBoldItalicStr() const { return maBoldItalic; }
+ XubString GetStyleName( const FontInfo& rInfo ) const;
+
+ FontInfo Get( const XubString& rName,
+ const XubString& rStyleName ) const;
+ FontInfo Get( const XubString& rName,
+ FontWeight eWeight,
+ FontItalic eItalic ) const;
+
+ BOOL IsAvailable( const XubString& rName ) const;
+ USHORT GetFontNameCount() const
+ { return (USHORT)List::Count(); }
+ const FontInfo& GetFontName( USHORT nFont ) const;
+ USHORT GetFontNameType( USHORT nFont ) const;
+ sal_Handle GetFirstFontInfo( const XubString& rName ) const;
+ sal_Handle GetNextFontInfo( sal_Handle hFontInfo ) const;
+ const FontInfo& GetFontInfo( sal_Handle hFontInfo ) const;
+
+ const long* GetSizeAry( const FontInfo& rInfo ) const;
+ static const long* GetStdSizeAry();
+
+private:
+ FontList( const FontList& );
+ FontList& operator =( const FontList& );
+};
+
+#endif // _CTRLTOOL_HXX
diff --git a/svtools/inc/expander.hxx b/svtools/inc/expander.hxx
new file mode 100644
index 000000000000..2b2ab15a320f
--- /dev/null
+++ b/svtools/inc/expander.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: expander.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_EXPANDER_HXX
+#define _SV_EXPANDER_HXX
+
+#ifndef _SV_CTRL_HXX
+#include <vcl/ctrl.hxx>
+#endif
+
+#ifndef _SV_IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+
+enum SvExpanderStateType
+{
+ EST_MIN=1,
+ EST_PLUS=2,
+ EST_MIN_DOWN=3,
+ EST_PLUS_DOWN=4,
+ EST_NONE=5,
+ EST_MIN_DIS=6,
+ EST_PLUS_DIS=7,
+ EST_MIN_DOWN_DIS=8,
+ EST_PLUS_DOWN_DIS=9
+};
+
+class SvExpander: public Control
+{
+private:
+ Point aImagePos;
+ Point aTextPos;
+ Image aActiveImage;
+ Rectangle maFocusRect;
+ ImageList maExpanderImages;
+ BOOL mbIsExpanded;
+ BOOL mbHasFocusRect;
+ BOOL mbIsInMouseDown;
+ Link maToggleHdl;
+ SvExpanderStateType eType;
+
+protected:
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+
+ virtual void Click();
+ virtual void Resize();
+
+public:
+ SvExpander( Window* pParent, WinBits nStyle = 0 );
+ SvExpander( Window* pParent, const ResId& rResId );
+
+ BOOL IsExpanded() {return mbIsExpanded;}
+
+ void SetToExpanded(BOOL bFlag=TRUE);
+
+ void SetExpanderImage( SvExpanderStateType eType);
+ Image GetExpanderImage(SvExpanderStateType eType);
+ Size GetMinSize() const;
+
+ void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
+ const Link& GetToggleHdl() const { return maToggleHdl; }
+};
+
+
+
+#endif
diff --git a/svtools/inc/filectrl.hrc b/svtools/inc/filectrl.hrc
new file mode 100644
index 000000000000..4b50d373bada
--- /dev/null
+++ b/svtools/inc/filectrl.hrc
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: filectrl.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_FILECTRL_HRC
+#define _SV_FILECTRL_HRC
+
+#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?!
+
+#endif
+
diff --git a/svtools/inc/filectrl.hxx b/svtools/inc/filectrl.hxx
new file mode 100644
index 000000000000..396d7d30b665
--- /dev/null
+++ b/svtools/inc/filectrl.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * $RCSfile: filectrl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_FILECTRL_HXX
+#define _SV_FILECTRL_HXX
+
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+#ifndef _SV_EDIT_HXX
+#include <vcl/edit.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+
+
+#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?!
+
+// Flags for FileControl
+typedef USHORT FileControlMode;
+#define FILECTRL_RESIZEBUTTONBYPATHLEN ((USHORT)0x0001)//if this is set, the button will become small as soon as the Text in the Edit Field is to long to be shown completely
+
+
+// Flags for internal use of FileControl
+typedef USHORT FileControlMode_Internal;
+#define FILECTRL_INRESIZE ((USHORT)0x0001)
+#define FILECTRL_ORIGINALBUTTONTEXT ((USHORT)0x0002)
+
+
+class VclFileDialog;
+class FileDialog;
+class FileControl : public Window
+{
+private:
+ Edit maEdit;
+ PushButton maButton;
+
+ String maButtonText;
+ BOOL mbOpenDlg;
+
+ VclFileDialog* mpVclDlg;
+ FileDialog* mpFDlg;
+
+ Link maDialogCreatedHdl;
+
+ FileControlMode mnFlags;
+ FileControlMode_Internal mnInternalFlags;
+
+protected:
+ void Resize();
+ void GetFocus();
+ void StateChanged( StateChangedType nType );
+ WinBits ImplInitStyle( WinBits nStyle );
+ DECL_LINK( ButtonHdl, PushButton* );
+
+public:
+ FileControl( Window* pParent, WinBits nStyle, FileControlMode = 0 );
+ ~FileControl();
+
+ Edit& GetEdit() { return maEdit; }
+ PushButton& GetButton() { return maButton; }
+
+ void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags );
+
+ void SetOpenDialog( BOOL bOpen ) { mbOpenDlg = bOpen; }
+ BOOL IsOpenDialog() const { return mbOpenDlg; }
+
+ void SetText( const XubString& rStr );
+ XubString GetText() const;
+ UniString GetSelectedText() const { return maEdit.GetSelected(); }
+
+ void SetSelection( const Selection& rSelection ) { maEdit.SetSelection( rSelection ); }
+ Selection GetSelection() const { return maEdit.GetSelection(); }
+
+ void SetReadOnly( BOOL bReadOnly = TRUE ) { maEdit.SetReadOnly( bReadOnly ); }
+ BOOL IsReadOnly() const { return maEdit.IsReadOnly(); }
+
+ //------
+ //manipulate the Button-Text:
+ XubString GetButtonText() const { return maButtonText; }
+ void SetButtonText( const XubString& rStr );
+ void ResetButtonText();
+
+ //------
+ //use this to manipulate the dialog bevore executing it:
+ void SetDialogCreatedHdl( const Link& rLink ) { maDialogCreatedHdl = rLink; }
+ const Link& GetDialogCreatedHdl() const { return maDialogCreatedHdl; }
+
+ //only use the next two methods in 'DialogCreatedHdl' and don't store the dialog-pointer
+ VclFileDialog* GetVclFileDialog() const { return mpVclDlg; }
+ FileDialog* GetFileDialog() const { return mpFDlg; }
+ //------
+};
+
+#endif
+
diff --git a/svtools/inc/filedlg.hxx b/svtools/inc/filedlg.hxx
new file mode 100644
index 000000000000..7e4fcbe758b8
--- /dev/null
+++ b/svtools/inc/filedlg.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: filedlg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVT_FILEDLG_HXX
+#define _SVT_FILEDLG_HXX
+
+#ifndef _DIALOG_HXX
+#include <vcl/dialog.hxx>
+#endif
+
+class Edit;
+class ImpSvFileDlg;
+
+// --------------
+// - SvPathDialog -
+// --------------
+
+class PathDialog : public ModalDialog
+{
+private:
+ friend class FileDialog; // Imp...
+
+ ImpSvFileDlg* pImpFileDlg; // Implementation
+ Link aOKHdlLink; // Link zum OK-Handler
+
+protected:
+ UniString aDfltExt; // Default - Extension
+
+public:
+ PathDialog( Window* pParent, WinBits nWinStyle = 0, BOOL bCreateDir = TRUE );
+ ~PathDialog();
+
+ virtual long OK();
+
+ void SetPath( const UniString& rNewPath );
+ void SetPath( const Edit& rEdit );
+ UniString GetPath() const;
+
+ void SetOKHdl( const Link& rLink ) { aOKHdlLink = rLink; }
+ const Link& GetOKHdl() const { return aOKHdlLink; }
+
+ virtual short Execute();
+};
+
+// --------------
+// - SvFileDialog -
+// --------------
+
+class FileDialog : public PathDialog
+{
+private:
+ Link aFileHdlLink; // Link zum FileSelect-Handler
+ Link aFilterHdlLink; // Link zum FilterSelect-Handler
+
+public:
+ FileDialog( Window* pParent, WinBits nWinStyle );
+ ~FileDialog();
+
+ virtual void FileSelect();
+ virtual void FilterSelect();
+
+ void SetDefaultExt( const UniString& rExt ) { aDfltExt = rExt; }
+ const UniString& GetDefaultExt() const { return aDfltExt; }
+ void AddFilter( const UniString& rFilter, const UniString& rType );
+ void AddFilter( const UniString& rFilter, const UniString& rType,
+ const UniString& rSysType );
+ void RemoveFilter( const UniString& rFilter );
+ void RemoveAllFilter();
+ void SetCurFilter( const UniString& rFilter );
+ UniString GetCurFilter() const;
+ USHORT GetFilterCount() const;
+ UniString GetFilterName( USHORT nPos ) const;
+ UniString GetFilterType( USHORT nPos ) const;
+
+ void SetFileSelectHdl( const Link& rLink ) { aFileHdlLink = rLink; }
+ const Link& GetFileSelectHdl() const { return aFileHdlLink; }
+ void SetFilterSelectHdl( const Link& rLink ) { aFilterHdlLink = rLink; }
+ const Link& GetFilterSelectHdl() const { return aFilterHdlLink; }
+
+ void SetOkButtonText( const UniString& rText );
+ void SetCancelButtonText( const UniString& rText );
+};
+
+#endif // _FILEDLG_HXX
diff --git a/svtools/inc/flbytes.hxx b/svtools/inc/flbytes.hxx
new file mode 100644
index 000000000000..001965c4a051
--- /dev/null
+++ b/svtools/inc/flbytes.hxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * $RCSfile: flbytes.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FLBYTES_HXX
+#define _FLBYTES_HXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+//============================================================================
+class SvFillLockBytes : public SvLockBytes
+{
+ SvLockBytesRef xLockBytes;
+ ULONG nFilledSize;
+ BOOL bTerminated;
+ BOOL bSync;
+public:
+ TYPEINFO();
+
+ SvFillLockBytes( SvLockBytes* pLockBytes );
+ virtual ErrCode ReadAt(
+ ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const;
+ virtual ErrCode WriteAt(
+ ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten );
+ virtual ErrCode Flush() const;
+ virtual ErrCode SetSize( ULONG nSize );
+ virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType );
+ virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType );
+ virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const;
+ ErrCode FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten );
+ ULONG Tell() const { return nFilledSize; }
+ void Seek( ULONG nPos ) { nFilledSize = nPos; }
+
+ void Terminate();
+};
+
+SV_DECL_IMPL_REF( SvFillLockBytes )
+
+//============================================================================
+class SvSyncLockBytes: public SvOpenLockBytes
+{
+ SvAsyncLockBytesRef m_xAsyncLockBytes;
+
+public:
+ TYPEINFO();
+
+ /// Create a synchronous wrapper around existing asynchronous lock bytes.
+ ///
+ /// @param pTheAsyncLockBytes Must not be null.
+ inline SvSyncLockBytes(SvAsyncLockBytes * pTheAsyncLockBytes);
+
+ /// Create a synchronous wrapper around an existing stream.
+ ///
+ /// @descr This is like first creating asynchronous lock bytes around the
+ /// stream and than creating a synchronous wrapper around the asynchronous
+ /// lock bytes.
+ ///
+ /// @param pStream Must not be null.
+ ///
+ /// @param bOwner True if these lock bytes own the stream (delete it on
+ /// destruction).
+ SvSyncLockBytes(SvStream * pStream, BOOL bOwner):
+ m_xAsyncLockBytes(new SvAsyncLockBytes(pStream, bOwner)) {}
+
+ virtual const SvStream * GetStream() const
+ { return m_xAsyncLockBytes->GetStream(); }
+
+ virtual void SetSynchronMode(BOOL bSync = TRUE)
+ { m_xAsyncLockBytes->SetSynchronMode(bSync); }
+
+ virtual BOOL IsSynchronMode() const
+ { return m_xAsyncLockBytes->IsSynchronMode(); }
+
+ virtual ErrCode ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
+ ULONG * pRead) const;
+
+ virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount,
+ ULONG * pWritten);
+
+ virtual ErrCode Flush() const { return m_xAsyncLockBytes->Flush(); }
+
+ virtual ErrCode SetSize(ULONG nSize)
+ { return m_xAsyncLockBytes->SetSize(nSize); }
+
+ virtual ErrCode LockRegion(ULONG nPos, ULONG nCount, LockType eType)
+ { return m_xAsyncLockBytes->LockRegion(nPos, nCount, eType); }
+
+ virtual ErrCode UnlockRegion(ULONG nPos, ULONG nCount, LockType eType)
+ { return m_xAsyncLockBytes->UnlockRegion(nPos, nCount, eType); }
+
+ virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag eFlag)
+ const
+ { return m_xAsyncLockBytes->Stat(pStat, eFlag); }
+
+ virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount,
+ ULONG * pWritten)
+ { return m_xAsyncLockBytes->FillAppend(pBuffer, nCount, pWritten); }
+
+ virtual ULONG Tell() const { return m_xAsyncLockBytes->Tell(); }
+
+ virtual ULONG Seek(ULONG nPos)
+ { return m_xAsyncLockBytes->Seek(nPos); }
+
+ virtual void Terminate() { m_xAsyncLockBytes->Terminate(); }
+};
+
+inline SvSyncLockBytes::SvSyncLockBytes(SvAsyncLockBytes *
+ pTheAsyncLockBytes):
+ m_xAsyncLockBytes(pTheAsyncLockBytes)
+{
+ DBG_ASSERT(m_xAsyncLockBytes.Is(),
+ "SvSyncLockBytes::SvSyncLockBytes(): Null");
+}
+
+SV_DECL_IMPL_REF(SvSyncLockBytes);
+
+//============================================================================
+struct SvCompositeLockBytes_Impl;
+class SvCompositeLockBytes : public SvLockBytes
+{
+ SvCompositeLockBytes_Impl* pImpl;
+public:
+ TYPEINFO();
+
+ SvCompositeLockBytes( );
+ ~SvCompositeLockBytes();
+
+ void Append( SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset );
+ ULONG RelativeOffset( ULONG nPos ) const;
+ void SetIsPending( BOOL bSet );
+ SvLockBytes* GetLastLockBytes() const;
+
+ virtual ErrCode ReadAt(
+ ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const;
+ virtual ErrCode WriteAt(
+ ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten );
+ virtual ErrCode Flush() const;
+ virtual ErrCode SetSize( ULONG nSize );
+ virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType );
+ virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType );
+ virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const;
+};
+
+SV_DECL_IMPL_REF( SvCompositeLockBytes )
+
+
+#endif
diff --git a/svtools/inc/fltdefs.hxx b/svtools/inc/fltdefs.hxx
new file mode 100644
index 000000000000..4cdf1b8f11f9
--- /dev/null
+++ b/svtools/inc/fltdefs.hxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * $RCSfile: fltdefs.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+#include <vcl/bitmap.hxx>
+
+#include <string.h>
+
+#ifndef _FLTDEFS_HXX
+#define _FLTDEFS_HXX
+
+
+#if defined ( WIN ) || defined ( WNT )
+
+#define RGBQUAD RGBQUADWIN
+
+typedef struct RGBQUAD
+{
+ BYTE rgbBlue;
+ BYTE rgbGreen;
+ BYTE rgbRed;
+ BYTE rgbReserved;
+
+ RGBQUAD( const BYTE cRed = 0, const BYTE cGreen = 0, const BYTE cBlue = 0 ) :
+ rgbBlue ( cBlue ),
+ rgbGreen ( cGreen ),
+ rgbRed ( cRed ),
+ rgbReserved ( 0 ) {};
+} RGBQUAD;
+
+
+#ifdef WIN
+typedef BYTE huge* PDIBBYTE;
+#define MEMCPY hmemcpy
+#define GLOBALALLOC(nSize) ((PDIBBYTE)GlobalLock(GlobalAlloc(GHND,(nSize))))
+#define GLOBALHANDLE(pPointer) ((HGLOBAL)GlobalHandle((*((size_t*)&(pPointer)+1))))
+#define GLOBALFREE(pPointer) (GlobalUnlock(GLOBALHANDLE((pPointer))))
+#define MEMSET( pDst, cByte, nCount ) \
+{ \
+ PDIBBYTE pTmp = (PDIBBYTE) pDst; \
+ for ( ULONG i = 0; i < nCount; i++ )\
+ *pTmp++ = cByte; \
+}
+
+#else
+
+typedef BYTE* PDIBBYTE;
+#define MEMCPY memcpy
+#define MEMSET memset
+#define GLOBALALLOC(nSize) ((PDIBBYTE)GlobalAlloc(GMEM_FIXED,(nSize)))
+#define GLOBALFREE(pPointer) (GlobalFree((HGLOBAL)pPointer))
+#define GLOBALHANDLE(pPointer) ((HGLOBAL)(pPointer))
+
+#endif
+#else
+
+typedef BYTE* PDIBBYTE;
+#define MEMCPY memcpy
+#define MEMSET memset
+#define GLOBALALLOC(nSize) ((PDIBBYTE)new BYTE[(nSize)])
+#define GLOBALFREE(pPointer) (delete[] (pPointer))
+
+#endif
+
+
+#if defined ( OS2 ) || defined ( UNX ) || defined ( MAC )
+void ReadBitmap( SvStream& rIStream, Bitmap& rBmp, USHORT nDefaultHeight = 0, ULONG nOffBits = 0 );
+void ReplaceInfoHeader( SvStream& rStm, BYTE* pBuffer );
+
+#ifdef OS2
+#define RGBQUAD RGBQUADOS2
+#define BITMAPFILEHEADER BITMAPFILEHEADEROS2
+#define PBITMAPFILEHEADER PBITMAPFILEHEADEROS2
+#define BITMAPINFOHEADER BITMAPINFOHEADEROS2
+#define PBITMAPINFOHEADER PBITMAPINFOHEADEROS2
+#define BITMAPINFO BITMAPINFOOS2
+#define PBITMAPINFO PBITMAPINFOOS2
+#endif
+
+#if defined(MAC) && (defined(powerc) || defined (__powerc))
+#pragma options align=mac68k
+#endif
+
+typedef struct RGBQUAD
+{
+ BYTE rgbBlue;
+ BYTE rgbGreen;
+ BYTE rgbRed;
+ BYTE rgbReserved;
+
+ RGBQUAD( const BYTE cRed = 0, const BYTE cGreen = 0, const BYTE cBlue = 0 ) :
+ rgbBlue ( cBlue ),
+ rgbGreen ( cGreen ),
+ rgbRed ( cRed ),
+ rgbReserved ( 0 ) {};
+} RGBQUAD;
+
+typedef struct BITMAPFILEHEADER
+{
+ UINT16 bfType;
+ UINT32 bfSize;
+ UINT16 bfReserved1;
+ UINT16 bfReserved2;
+ UINT32 bfOffBits;
+} BITMAPFILEHEADER;
+typedef BITMAPFILEHEADER* PBITMAPFILEHEADER;
+
+typedef struct BITMAPINFOHEADER
+{
+ UINT32 biSize;
+ UINT32 biWidth;
+ UINT32 biHeight;
+ UINT16 biPlanes;
+ UINT16 biBitCount;
+ UINT32 biCompression;
+ UINT32 biSizeImage;
+ UINT32 biXPelsPerMeter;
+ UINT32 biYPelsPerMeter;
+ UINT32 biClrUsed;
+ UINT32 biClrImportant;
+} BITMAPINFOHEADER;
+typedef BITMAPINFOHEADER* PBITMAPINFOHEADER;
+
+typedef struct BITMAPINFO
+{
+ BITMAPINFOHEADER bmiHeader;
+ RGBQUAD bmiColors[1];
+} BITMAPINFO;
+typedef BITMAPINFO* PBITMAPINFO;
+
+#if defined(MAC) && (defined(powerc) || defined (__powerc))
+#pragma options align=reset
+#endif
+
+#endif
+#endif
diff --git a/svtools/inc/gifread.hxx b/svtools/inc/gifread.hxx
new file mode 100644
index 000000000000..7ec231f890d1
--- /dev/null
+++ b/svtools/inc/gifread.hxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * $RCSfile: gifread.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _GIFREAD_HXX
+#define _GIFREAD_HXX
+
+#ifdef VCL
+
+#ifndef _GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#ifndef _BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+
+#else // VCL
+
+#ifndef _GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _FLTDEFS_HXX
+#include "fltdefs.hxx"
+#endif
+
+#endif // VCL
+
+#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;
+
+#ifdef VCL
+
+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;
+ ULONG nLogWidth100;
+ ULONG 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, void* pCallData );
+ virtual ~GIFReader();
+};
+
+#else // VCL
+
+class GIFReader : public GraphicReader
+{
+ Graphic aImGraphic;
+ Animation aAnimation;
+ SvStream& rIStm;
+ void* pCallerData;
+ ULONG* pGPalette; // Format: 0x00RRGGBB, Groesse des Feldes: immer 256
+ BYTE* pPalEntryFlag;
+ PDIBBYTE pDIB;
+ PDIBBYTE pDIBBytes;
+ PDIBBYTE pMonoDIB;
+ PDIBBYTE pMonoDIBBytes;
+ PDIBBYTE pSrcBuf;
+ PDIBBYTE pRow8;
+ PDIBBYTE pRow1;
+ PDIBBYTE pFile;
+ PDIBBYTE pMonoFile;
+ GIFLZWDecompressor* pDecomp;
+ long nLastPos;
+ long nWidthAl8;
+ long nWidthAl1;
+ long nTotal;
+ long nMonoTotal;
+ 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 nGPaletteSize; // Anzahl der belegten Eintraege in pPalette
+ USHORT nBlackIndex;
+ USHORT nLastInterCount;
+ USHORT nLoops;
+ GIFAction eActAction;
+ BOOL bStatic; // zeigt an, ob die GIF-Grafik animiert oder statisch ist
+ BOOL bStatus;
+ BOOL bDestTransparent;
+ BOOL bLocalDestTransparent;
+ BOOL bGCTransparent; // Ob das Bild Transparent ist, wenn ja:
+ BOOL bInterlaced;
+ BOOL bOverreadBlock;
+ BOOL bImGraphicReady;
+ BOOL bGlobalPalette;
+ BOOL bGIF89;
+ BYTE nBackgroundColor; // Hintergrundfarbe
+ BYTE nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig
+ BYTE nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku)
+
+ USHORT ReadPaletteEntries( ULONG* pPal, USHORT nNumEntries );
+ void ClearImageExtensions();
+ BOOL CreateBitmaps( long nWidth, long nHeight, ULONG* pDIBPal,
+ USHORT nPalCount, BOOL bWatchForBackgroundColor );
+ BOOL ReadGlobalHeader();
+ BOOL ReadExtension();
+ BOOL ReadLocalHeader();
+ USHORT ReadNextBlock();
+ void FillImages( PDIBBYTE pBytes, ULONG nCount );
+ void CreateNewBitmaps();
+ BOOL ProcessGIF();
+
+public:
+
+ ReadState ReadGIF( Graphic& rGraphic );
+ const Graphic& GetIntermediateGraphic();
+
+ GIFReader( SvStream& rStm, void* pCallData );
+ virtual ~GIFReader();
+};
+
+#endif // VCL
+#endif // _GIFPRIVATE
+
+// -------------
+// - ImportGIF -
+// -------------
+
+ BOOL ImportGIF( SvStream& rStream, Graphic& rGraphic, void* pCallerData );
+
+#endif // _GIFREAD_HXX
diff --git a/svtools/inc/gradwrap.hxx b/svtools/inc/gradwrap.hxx
new file mode 100644
index 000000000000..de8918c3afbb
--- /dev/null
+++ b/svtools/inc/gradwrap.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: gradwrap.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#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/inc/htmlkywd.hxx b/svtools/inc/htmlkywd.hxx
new file mode 100644
index 000000000000..c94a1978d584
--- /dev/null
+++ b/svtools/inc/htmlkywd.hxx
@@ -0,0 +1,716 @@
+/*************************************************************************
+ *
+ * $RCSfile: htmlkywd.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _HTMLKYWD_HXX
+#define _HTMLKYWD_HXX
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#ifndef SVTOOLS_CONSTASCII_DECL
+#define SVTOOLS_CONSTASCII_DECL( n, s ) n[sizeof(s)]
+#endif
+#ifndef SVTOOLS_CONSTASCII_DEF
+#define SVTOOLS_CONSTASCII_DEF( n, s ) n[sizeof(s)] = s
+#endif
+
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_doctype32,
+ "HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"" );
+
+
+// diese werden nur eingeschaltet
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_area, "AREA" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_base, "BASE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_comment, "!--" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_doctype, "!DOCTYPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_embed, "EMBED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_figureoverlay, "OVERLAY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_horzrule, "HR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_horztab, "TAB" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_image, "IMG" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_image2, "IMAGE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_input, "INPUT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_isindex, "ISINDEX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_linebreak, "BR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_li, "LI" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_link, "LINK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_meta, "META" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_nextid, "NEXTID" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_nobr, "NOBR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_of, "OF" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_option, "OPTION" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_param, "PARAM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_range, "RANGE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_spacer, "SPACER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_wbr, "WBR" );
+
+// diese werden wieder abgeschaltet
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_abbreviation, "ABBREV" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_above, "ABOVE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_acronym, "ACRONYM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_address, "ADDRESS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_anchor, "A" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_applet, "APPLET" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_array, "ARRAY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_author, "AU" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_banner, "BANNER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_bar, "BAR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_basefont, "BASEFONT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_below, "BELOW" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_bigprint, "BIG" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_blink, "BLINK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_blockquote, "BLOCKQUOTE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_blockquote30, "BQ" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_body, "BODY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_bold, "B" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_boldtext, "BT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_box, "BOX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_caption, "CAPTION" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_center, "CENTER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_citiation, "CITE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_code, "CODE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_col, "COL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_colgroup, "COLGROUP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_credit, "CREDIT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_dd, "DD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_deflist, "DL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_deletedtext, "DEL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_dirlist, "DIR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_division, "DIV" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_dot, "DOT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_doubledot, "DDOT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_dt, "DT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_emphasis, "EM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_figure, "FIG" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_font, "FONT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_footnote, "FN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_form, "FORM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_frame, "FRAME" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_frameset, "FRAMESET" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_hat, "HAT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_head1, "H1" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_head2, "H2" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_head3, "H3" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_head4, "H4" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_head5, "H5" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_head6, "H6" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_head, "HEAD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_html, "HTML" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_iframe, "IFRAME" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_ilayer, "ILAYER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_insertedtext, "INS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_italic, "I" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_item, "ITEM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_keyboard, "KBD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_language, "LANG" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_layer, "LAYER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_listheader, "LH" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_map, "MAP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_math, "MATH" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_menulist, "MENU" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_multicol, "MULTICOL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_noembed, "NOEMBED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_noframe, "NOFRAME" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_noframes, "NOFRAMES" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_noscript, "NOSCRIPT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_note, "NOTE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_orderlist, "OL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_parabreak, "P" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_person, "PERSON" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_plaintext, "T" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_preformtxt, "PRE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_root, "ROOT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_row, "ROW" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sample, "SAMP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_script, "SCRIPT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_select, "SELECT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_shortquote, "Q" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_smallprint, "SMALL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_span, "SPAN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_squareroot, "AQRT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_strikethrough, "S" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_strong, "STRONG" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_style, "STYLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_subscript, "SUB" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_superscript, "SUP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_table, "TABLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_tablerow, "TR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_tabledata, "TD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_tableheader, "TH" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_tbody, "TBODY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_teletype, "TT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_text, "TEXT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_textarea, "TEXTAREA" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_textflow, "TEXTFLOW" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_tfoot, "TFOOT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_thead, "THEAD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_tilde, "TILDE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_title, "TITLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_underline, "U" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_unorderlist, "UL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_variable, "VAR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_vector, "VEC" );
+
+// obsolete features
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_xmp, "XMP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_listing, "LISTING" );
+
+// proposed features
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_definstance, "DFN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_strike, "STRIKE" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_bgsound, "BGSOUND" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_comment2, "COMMENT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_marquee, "MARQUEE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_plaintext2, "PLAINTEXT" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sdfield, "SDFIELD" );
+
+// die Namen fuer alle Zeichen
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_lt, "lt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_gt, "gt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_amp, "amp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_quot, "quot" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Aacute, "Aacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Agrave, "Agrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Acirc, "Acirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Atilde, "Atilde" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Aring, "Aring" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Auml, "Auml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_AElig, "AElig" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ccedil, "Ccedil" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Eacute, "Eacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Egrave, "Egrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ecirc, "Ecirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Euml, "Euml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Iacute, "Iacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Igrave, "Igrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Icirc, "Icirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Iuml, "Iuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_ETH, "ETH" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ntilde, "Ntilde" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Oacute, "Oacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ograve, "Ograve" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ocirc, "Ocirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Otilde, "Otilde" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ouml, "Ouml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Oslash, "Oslash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Uacute, "Uacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ugrave, "Ugrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Ucirc, "Ucirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Uuml, "Uuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_Yacute, "Yacute" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_THORN, "THORN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_szlig, "szlig" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_aacute, "aacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_agrave, "agrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_acirc, "acirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_atilde, "atilde" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_aring, "aring" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_auml, "auml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_aelig, "aelig" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ccedil, "ccedil" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_eacute, "eacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_egrave, "egrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ecirc, "ecirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_euml, "euml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_iacute, "iacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_igrave, "igrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_icirc, "icirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_iuml, "iuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_eth, "eth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ntilde, "ntilde" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_oacute, "oacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ograve, "ograve" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ocirc, "ocirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_otilde, "otilde" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ouml, "ouml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_oslash, "oslash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_uacute, "uacute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ugrave, "ugrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ucirc, "ucirc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_uuml, "uuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_yacute, "yacute" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_thorn, "thorn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_yuml, "yuml" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_acute, "acute" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_brvbar, "brvbar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_cedil, "cedil" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_cent, "cent" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_copy, "copy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_curren, "curren" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_deg, "deg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_divide, "divide" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_frac12, "frac12" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_frac14, "frac14" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_frac34, "frac34" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_iexcl, "iexcl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_iquest, "iquest" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_laquo, "laquo" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_macr, "macr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_micro, "micro" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_middot, "middot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_nbsp, "nbsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_not, "not" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ordf, "ordf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_ordm, "ordm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_para, "para" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_plusmn, "plusmn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_pound, "pound" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_raquo, "raquo" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_reg, "reg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_sect, "sect" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_shy, "shy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_sup1, "sup1" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_sup2, "sup2" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_sup3, "sup3" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_times, "times" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_uml, "uml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_yen, "yen" );
+
+// Netscape kennt noch ein paar in Grossbuchstaben ...
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_LT, "LT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_GT, "GT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_AMP, "AMP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_C_QUOT, "QUOT" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_COPY, "COPY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_S_REG, "REG" );
+
+// HTML Attribut-Token (=Optionen)
+
+// Attribute ohne Wert
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_box, "BOX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_checked, "CHECKED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_compact, "COMPACT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_continue, "CONTINUE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_controls, "CONTROLS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_declare, "DECLARE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_disabled, "DISABLED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_folded, "FOLDED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_ismap, "ISMAP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_mayscript, "MAYSCRIPT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_multiple, "MULTIPLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_noflow, "NOFLOW" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_nohref, "NOHREF" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_noresize, "NORESIZE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_noshade, "NOSHADE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_nowrap, "NOWRAP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_plain, "PLAIN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_sdfixed, "SDFIXED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_selected, "SELECTED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_shapes, "SHAPES" );
+
+// Attribute mit einem String als Wert
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_above, "ABOVE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_accesskey, "ACCESSKEY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_accept, "ACCEPT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_add_date, "ADD_DATE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_alt, "ALT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_axes, "AXES" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_axis, "AXIS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_below, "BELOW" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_char, "CHAR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_class, "CLASS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_clip, "CLIP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_code, "CODE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_codetype, "CODETYPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_colspec, "COLSPEC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_content, "CONTENT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_coords, "COORDS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_dp, "DP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_enctype, "ENCTYPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_error, "ERROR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_face, "FACE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_frameborder, "FRAMEBORDER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_httpequiv, "HTTP-EQUIV" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_language, "LANGUAGE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_last_modified, "LAST_MODIFIED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_last_visit, "LAST_VISIT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_md, "MD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_n, "N" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_name, "NAME" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_notation, "NOTATION" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_prompt, "PROMPT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_shape, "SHAPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_standby, "STANDBY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_style, "STYLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_title, "TITLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_value, "VALUE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDval, "SDVAL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDnum, "SDNUM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_sdlibrary, "SDLIBRARY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_sdmodule, "SDMODULE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_sdevent, "SDEVENT-" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_sdaddparam, "SDADDPARAM-" );
+
+// Attribute mit einem SGML-Identifier als Wert
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_from, "FROM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_id, "ID" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_target, "TARGET" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_to, "TO" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_until, "UNTIL" );
+
+// Attribute mit einem URI als Wert
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_action, "ACTION" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_background, "BACKGROUND" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_classid, "CLASSID" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_codebase, "CODEBASE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_data, "DATA" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_dynsrc, "DYNSRC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_dynsync, "DYNSYNC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_imagemap, "IMAGEMAP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_href, "HREF" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_lowsrc, "LOWSRC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_script, "SCRIPT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_src, "SRC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_usemap, "USEMAP" );
+
+// Attribute mit Entity-Namen als Wert
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_dingbat, "DINGBAT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_sym, "SYM" );
+
+// Attribute mit einer Farbe als Wert (alle Netscape)
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_alink, "ALINK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_bgcolor, "BGCOLOR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_bordercolor, "BORDERCOLOR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_bordercolorlight, "BORDERCOLORLIGHT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_bordercolordark, "BORDERCOLORDARK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_color, "COLOR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_link, "LINK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_text, "TEXT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_vlink, "VLINK" );
+
+// Attribute mit einem numerischen Wert
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_border, "BORDER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_cellspacing, "CELLSPACING" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_cellpadding, "CELLPADDING" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_charoff, "CHAROFF" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_colspan, "COLSPAN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_framespacing, "FRAMESPACING" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_gutter, "GUTTER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_indent, "INDENT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_height, "HEIGHT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_hspace, "HSPACE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_left, "LEFT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_leftmargin, "LEFTMARGIN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_loop, "LOOP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_marginheight, "MARGINHEIGHT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_marginwidth, "MARGINWIDTH" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_max, "MAX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_maxlength, "MAXLENGTH" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_min, "MIN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_pagex, "PAGEX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_pagey, "PAGEY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_pointsize, "POINT-SIZE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_rowspan, "ROWSPAN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_scrollamount, "SCROLLAMOUNT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_scrolldelay, "SCROLLDELAY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_seqnum, "SEQNUM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_skip, "SKIP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_span, "SPAN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_tabindex, "TABINDEX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_top, "TOP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_topmargin, "TOPMARGIN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_vspace, "VSPACE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_weight, "WEIGHT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_width, "WIDTH" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_x, "X" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_y, "Y" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_zindex, "Z-INDEX" );
+
+// Attribute mit Enum-Werten
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_behavior, "BEHAVIOR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_bgproperties, "BGPROPERTIES" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_clear, "CLEAR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_dir, "DIR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_direction, "DIRECTION" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_format, "FORMAT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_frame, "FRAME" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_lang, "LANG" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_method, "METHOD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_palette, "PALETTE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_rel, "REL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_rev, "REV" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_rules, "RULES" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_scrolling, "SCROLLING" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_sdreadonly, "READONLY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_subtype, "SUBTYPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_type, "TYPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_valign, "VALIGN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_valuetype, "VALUETYPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_visibility, "VISIBILITY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_wrap, "WRAP" );
+
+// Attribute mit Script-Code als Wert
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onblur, "ONBLUR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onchange, "ONCHANGE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onclick, "ONCLICK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onfocus, "ONFOCUS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onload, "ONLOAD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onmouseover, "ONMOUSEOVER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onreset, "ONRESET" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onselect, "ONSELECT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onsubmit, "ONSUBMIT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onunload, "ONUNLOAD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onabort, "ONABORT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onerror, "ONERROR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_onmouseout, "ONMOUSEOUT" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonblur, "SDONBLUR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonchange, "SDONCHANGE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonclick, "SDONCLICK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonfocus, "SDONFOCUS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonload, "SDONLOAD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonmouseover, "SDONMOUSEOVER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonreset, "SDONRESET" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonselect, "SDONSELECT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonsubmit, "SDONSUBMIT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonunload, "SDONUNLOAD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonabort, "SDONABORT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonerror, "SDONERROR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_SDonmouseout, "SDONMOUSEOUT" );
+
+// Attribute mit Kontext-abhaengigen Werten
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_align, "ALIGN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_cols, "COLS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_rows, "ROWS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_start, "START" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_size, "SIZE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_O_units, "UNITS" );
+
+
+// Werte von <INPUT TYPE=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_text, "TEXT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_password, "PASSWORD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_checkbox, "CHECKBOX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_radio, "RADIO" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_range, "RANGE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_scribble, "SCRIBBLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_file, "FILE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_hidden, "HIDDEN" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_submit, "SUBMIT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_image, "IMAGE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_reset, "RESET" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_IT_button, "BUTTON" );
+
+// Werte von <TABLE FRAME=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_void, "VOID" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_above, "ABOVE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_below, "BELOW" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_hsides, "HSIDES" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_lhs, "LHS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_rhs, "RHS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_vsides, "VSIDES" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_box, "BOX" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TF_border, "BORDER" );
+
+// Werte von <TABLE RULES=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TR_none, "NONE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TR_groups, "GROUPS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TR_rows, "ROWS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TR_cols, "COLS" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_TR_all, "ALL" );
+
+// Werte von <P, H?, TR, TH, TD ALIGN=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_left, "LEFT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_center, "CENTER" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_middle, "MIDDLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_right, "RIGHT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_justify, "JUSTIFY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_char, "CHAR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_all, "ALL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_AL_none, "NONE" );
+
+// Werte von <TR VALIGN=...>, <IMG ALIGN=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_VA_top, "TOP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_VA_middle, "MIDDLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_VA_bottom, "BOTTOM" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_VA_baseline, "BASELINE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_VA_texttop, "TEXTTOP" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_VA_absmiddle, "ABSMIDDLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_VA_absbottom, "ABSBOTTOM" );
+
+// Werte von <AREA SHAPE=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SH_rect, "RECT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SH_rectangle, "RECTANGLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SH_circ, "CIRC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SH_circle, "CIRCLE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SH_poly, "POLY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SH_polygon, "POLYGON" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SH_default, "DEFAULT" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LG_starbasic, "STARBASIC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LG_javascript, "JAVASCRIPT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LG_javascript11, "JAVASCRIPT1.1" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LG_livescript, "LIVESCRIPT" );
+//extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LG_vbscript, "VBSCRIPT" );
+//extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LG_unused_javascript, "UNUSED JAVASCRIPT" );
+//extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LG_starone, "StarScript" );
+
+// ein par Werte fuer unser StarBASIC-Support
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SB_library, "$LIBRARY:" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SB_module, "$MODULE:" );
+
+
+// Werte von <FORM METHOD=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_METHOD_get, "GET" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_METHOD_post, "POST" );
+
+// Werte von <META CONTENT/HTTP-EQUIV=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_refresh, "REFRESH" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_generator, "GENERATOR" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_author, "AUTHOR" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_classification, "CLASSIFICATION" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_description, "DESCRIPTION" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_keywords, "KEYWORDS" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_changed, "CHANGED" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_changedby, "CHANGEDBY" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_created, "CREATED" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_content_type, "CONTENT-TYPE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_content_script_type, "CONTENT-SCRIPT-TYPE" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_sdendnote, "SDENDNOTE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_META_sdfootnote, "SDFOOTNOTE" );
+
+// Werte von <UL TYPE=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_ULTYPE_disc, "DISC" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_ULTYPE_square, "SQUARE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_ULTYPE_circle, "CIRCLE" );
+
+// Werte von <FRAMESET SCROLLING=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SCROLL_yes, "YES" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SCROLL_no, "NO" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SCROLL_auto, "AUTO" );
+
+// Werte von <MULTICOL TYPE=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_MCTYPE_horizontal, "HORIZONTAL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_MCTYPE_vertical, "VERTICAL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_MCTYPE_box, "BOX" );
+
+// Werte von <MARQUEE BEHAVIOUR=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_BEHAV_scroll, "SCROLL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_BEHAV_slide, "SLIDE" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_BEHAV_alternate, "ALTERNATE" );
+
+// Werte von <MARQUEE LOOP=...>
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_LOOP_infinite, "INFINITE" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SPTYPE_block, "BLOCK" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SPTYPE_horizontal, "HORIZONTAL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_SPTYPE_vertical, "VERTICAL" );
+
+
+// interne Grafik-Namen
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_private_image, "private:image/" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_internal_gopher, "internal-gopher-" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_internal_icon, "internal-icon-" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_binary, "binary" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_image, "image" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_index, "index" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_menu, "menu" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_movie, "movie" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_sound, "sound" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_telnet, "telnet" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_text, "text" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_GOPHER_unknown, "unknown" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_ICON_baddata, "baddata" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_ICON_delayed, "delayed" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_ICON_embed, "embed" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_ICON_insecure, "insecure" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_INT_ICON_notfound, "notfound" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sdendnote, "sdendnote" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sdendnote_anc, "sdendnoteanc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sdendnote_sym, "sdendnotesym" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sdfootnote, "sdfootnote" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sdfootnote_anc, "sdfootnoteanc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_sdfootnote_sym, "sdfootnotesym" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FTN_anchor, "anc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FTN_symbol, "sym" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_WW_off, "OFF" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_WW_hard, "HARD" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_WW_soft, "SOFT" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_WW_virtual, "VIRTUAL" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_WW_physical, "PHYSICAL" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_on, "on" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_ET_url, "application/x-www-form-urlencoded" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_ET_multipart, "multipart/form-data" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_ET_text, "text/plain" );
+
+
+#endif
diff --git a/svtools/inc/htmltokn.h b/svtools/inc/htmltokn.h
new file mode 100644
index 000000000000..9a46d8761989
--- /dev/null
+++ b/svtools/inc/htmltokn.h
@@ -0,0 +1,749 @@
+/*************************************************************************
+ *
+ * $RCSfile: htmltokn.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _HTMLTOKN_H
+#define _HTMLTOKN_H
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+#ifndef _SOLAR_h
+#include <tools/solar.h>
+#endif
+
+class String;
+
+// suche das Char zu dem CharNamen
+sal_Unicode GetHTMLCharName( const String& rName );
+
+// suche die TokenID zu dem Token
+int GetHTMLToken( const String& rName );
+
+// suche die TokenId zu einemm Attribut-Token
+int GetHTMLOption( const String& rName );
+
+// suche die 24-bit-Farbe zu einem Farbnamen (nicht gefunden = ULONG_MAX)
+ULONG GetHTMLColor( const String& rName );
+
+// beginnen immer ab 256, groesser als ein char
+const int HTML_TOKEN_START = 0x100;
+const int HTML_TOKEN_ONOFF = 0x200;
+const int HTML_TOKEN_MICROSOFT = 0x1000;
+
+enum HTML_TOKEN_IDS
+{
+ HTML_TEXTTOKEN = HTML_TOKEN_START,
+ HTML_SINGLECHAR,
+ HTML_NEWPARA,
+ HTML_TABCHAR,
+ HTML_RAWDATA,
+ HTML_LINEFEEDCHAR,
+
+ // diese werden nur eingeschaltet
+ HTML_AREA, // Netscape 2.0
+ HTML_BASE, // HTML 3.0
+ HTML_COMMENT,
+ HTML_DOCTYPE,
+ HTML_EMBED, // Netscape 2.0 </EMBED> ignorieren
+ HTML_FIGUREOVERLAY, // HTML 3.0
+ HTML_HORZRULE, // </HR> ignorieren
+ HTML_HORZTAB, // HTML 3.0
+ HTML_IMAGE, // </IMG> ignorieren
+ HTML_INPUT, // </INPUT> ignorieren
+ HTML_ISINDEX, // HTML 3.0
+ HTML_LINEBREAK, // </BR> -> <BR>
+ HTML_LINK, // HTML 3.0
+ HTML_META, // HTML 3.0 </META> ignorieren
+ HTML_NEXTID, // HTML 3.0
+ HTML_OF, // HTML 3.0
+ HTML_OPTION, // </OPTION> ignorieren
+ HTML_PARAM, // HotJava
+ HTML_RANGE, // HTML 3.0
+ HTML_SPACER, // Netscape 3.0b5 // </SPACER> ignorieren
+ HTML_WBR, // Netscape
+
+ // Tokens, die ueber HTML-Charakter erkannt werden
+ HTML_NONBREAKSPACE,
+ HTML_SOFTHYPH,
+
+ // diese werden wieder abgeschaltet,
+ // der off-Wert liegt immer dahinter (+1) !!
+ HTML_ABBREVIATION_ON = HTML_TOKEN_ONOFF, // HTML 3.0
+ HTML_ABBREVIATION_OFF, // HTML 3.0
+ HTML_ABOVE_ON, // HTML 3.0
+ HTML_ABOVE_OFF, // HTML 3.0
+ HTML_ACRONYM_ON, // HTML 3.0
+ HTML_ACRONYM_OFF, // HTML 3.0
+ HTML_ADDRESS_ON,
+ HTML_ADDRESS_OFF,
+ HTML_ANCHOR_ON,
+ HTML_ANCHOR_OFF,
+ HTML_APPLET_ON, // HotJava
+ HTML_APPLET_OFF, // HotJava
+ HTML_ARRAY_ON, // HTML 3.0
+ HTML_ARRAY_OFF, // HTML 3.0
+ HTML_AUTHOR_ON, // HTML 3.0
+ HTML_AUTHOR_OFF, // HTML 3.0
+ HTML_BANNER_ON, // HTML 3.0
+ HTML_BANNER_OFF, // HTML 3.0
+ HTML_BAR_ON, // HTML 3.0
+ HTML_BAR_OFF, // HTML 3.0
+ HTML_BASEFONT_ON, // Netscape
+ HTML_BASEFONT_OFF, // Netscape
+ HTML_BELOW_ON, // HTML 3.0
+ HTML_BELOW_OFF, // HTML 3.0
+ HTML_BIGPRINT_ON, // HTML 3.0
+ HTML_BIGPRINT_OFF, // HTML 3.0
+ HTML_BLINK_ON, // Netscape
+ HTML_BLINK_OFF, // Netscape
+ HTML_BLOCKQUOTE30_ON, // HTML 3.0
+ HTML_BLOCKQUOTE30_OFF, // HTML 3.0
+ HTML_BLOCKQUOTE_ON,
+ HTML_BLOCKQUOTE_OFF,
+ HTML_BODY_ON,
+ HTML_BODY_OFF,
+ HTML_BOLDTEXT_ON, // HTML 3.0
+ HTML_BOLDTEXT_OFF, // HTML 3.0
+ HTML_BOLD_ON,
+ HTML_BOLD_OFF,
+ HTML_BOX_ON, // HTML 3.0
+ HTML_BOX_OFF, // HTML 3.0
+ HTML_CAPTION_ON, // HTML 3.0
+ HTML_CAPTION_OFF, // HTML 3.0
+ HTML_CENTER_ON, // Netscape
+ HTML_CENTER_OFF, // Netscape
+ HTML_CITIATION_ON,
+ HTML_CITIATION_OFF,
+ HTML_CODE_ON,
+ HTML_CODE_OFF,
+ HTML_COL_ON, // HTML3 Table Model Draft
+ HTML_COL_OFF, // HTML3 Table Model Draft
+ HTML_COLGROUP_ON, // HTML3 Table Model Draft
+ HTML_COLGROUP_OFF, // HTML3 Table Model Draft
+ HTML_CREDIT_ON, // HTML 3.0
+ HTML_CREDIT_OFF, // HTML 3.0
+ HTML_DD_ON,
+ HTML_DD_OFF,
+ HTML_DEFLIST_ON,
+ HTML_DEFLIST_OFF,
+ HTML_DELETEDTEXT_ON, // HTML 3.0
+ HTML_DELETEDTEXT_OFF, // HTML 3.0
+ HTML_DIRLIST_ON,
+ HTML_DIRLIST_OFF,
+ HTML_DIVISION_ON, // HTML 3.0
+ HTML_DIVISION_OFF, // HTML 3.0
+ HTML_DOT_ON, // HTML 3.0
+ HTML_DOT_OFF, // HTML 3.0
+ HTML_DOUBLEDOT_ON, // HTML 3.0
+ HTML_DOUBLEDOT_OFF, // HTML 3.0
+ HTML_DT_ON,
+ HTML_DT_OFF,
+ HTML_EMPHASIS_ON,
+ HTML_EMPHASIS_OFF,
+ HTML_FIGURE_ON, // HTML 3.0
+ HTML_FIGURE_OFF, // HTML 3.0
+ HTML_FONT_ON, // Netscape
+ HTML_FONT_OFF, // Netscape
+ HTML_FOOTNOTE_ON, // HTML 3.0
+ HTML_FOOTNOTE_OFF, // HTML 3.0
+ HTML_FORM_ON,
+ HTML_FORM_OFF,
+ HTML_FRAME_ON, // Netscape 2.0
+ HTML_FRAME_OFF, // Netscape 2.0
+ HTML_FRAMESET_ON, // Netscape 2.0
+ HTML_FRAMESET_OFF, // Netscape 2.0
+ HTML_HAT_ON, // HTML 3.0
+ HTML_HAT_OFF, // HTML 3.0
+ HTML_HEAD1_ON,
+ HTML_HEAD1_OFF,
+ HTML_HEAD2_ON,
+ HTML_HEAD2_OFF,
+ HTML_HEAD3_ON,
+ HTML_HEAD3_OFF,
+ HTML_HEAD4_ON,
+ HTML_HEAD4_OFF,
+ HTML_HEAD5_ON,
+ HTML_HEAD5_OFF,
+ HTML_HEAD6_ON,
+ HTML_HEAD6_OFF,
+ HTML_HEAD_ON,
+ HTML_HEAD_OFF,
+ HTML_HTML_ON,
+ HTML_HTML_OFF,
+ HTML_IFRAME_ON, // IE 3.0b2
+ HTML_IFRAME_OFF, // IE 3.0b2
+ HTML_ILAYER_ON,
+ HTML_ILAYER_OFF,
+ HTML_INSERTEDTEXT_ON, // HTML 3.0
+ HTML_INSERTEDTEXT_OFF, // HTML 3.0
+ HTML_ITALIC_ON,
+ HTML_ITALIC_OFF,
+ HTML_ITEM_ON, // HTML 3.0
+ HTML_ITEM_OFF, // HTML 3.0
+ HTML_KEYBOARD_ON,
+ HTML_KEYBOARD_OFF,
+ HTML_LAYER_ON,
+ HTML_LAYER_OFF,
+ HTML_LANGUAGE_ON, // HTML 3.0
+ HTML_LANGUAGE_OFF, // HTML 3.0
+ HTML_LISTHEADER_ON, // HTML 3.0
+ HTML_LISTHEADER_OFF, // HTML 3.0
+ HTML_LI_ON,
+ HTML_LI_OFF,
+ HTML_MAP_ON, // Netscape 2.0
+ HTML_MAP_OFF, // Netscape 2.0
+ HTML_MATH_ON, // HTML 3.0
+ HTML_MATH_OFF, // HTML 3.0
+ HTML_MENULIST_ON,
+ HTML_MENULIST_OFF,
+ HTML_MULTICOL_ON, // Netscape 3.0b5
+ HTML_MULTICOL_OFF, // Netscape 3.0b5
+ HTML_NOBR_ON, // Netscape
+ HTML_NOBR_OFF, // Netscape
+ HTML_NOEMBED_ON, // Netscape 2.0
+ HTML_NOEMBED_OFF, // Netscape 2.0
+ HTML_NOFRAMES_ON, // Netscape 2.0
+ HTML_NOFRAMES_OFF, // Netscape 2.0
+ HTML_NOSCRIPT_ON, // Netscape 2.0
+ HTML_NOSCRIPT_OFF, // Netscape 3.0
+ HTML_NOTE_ON, // HTML 3.0
+ HTML_NOTE_OFF, // HTML 3.0
+ HTML_ORDERLIST_ON,
+ HTML_ORDERLIST_OFF,
+ HTML_PARABREAK_ON,
+ HTML_PARABREAK_OFF,
+ HTML_PERSON_ON, // HTML 3.0
+ HTML_PERSON_OFF, // HTML 3.0
+ HTML_PLAINTEXT_ON, // HTML 3.0
+ HTML_PLAINTEXT_OFF, // HTML 3.0
+ HTML_PREFORMTXT_ON,
+ HTML_PREFORMTXT_OFF,
+ HTML_ROOT_ON, // HTML 3.0
+ HTML_ROOT_OFF, // HTML 3.0
+ HTML_ROW_ON, // HTML 3.0
+ HTML_ROW_OFF, // HTML 3.0
+ HTML_SAMPLE_ON,
+ HTML_SAMPLE_OFF,
+ HTML_SCRIPT_ON, // HTML 3.2
+ HTML_SCRIPT_OFF, // HTML 3.2
+ HTML_SELECT_ON,
+ HTML_SELECT_OFF,
+ HTML_SHORTQUOTE_ON, // HTML 3.0
+ HTML_SHORTQUOTE_OFF, // HTML 3.0
+ HTML_SMALLPRINT_ON, // HTML 3.0
+ HTML_SMALLPRINT_OFF, // HTML 3.0
+ HTML_SPAN_ON, // Style Sheets
+ HTML_SPAN_OFF, // Style Sheets
+ HTML_SQUAREROOT_ON, // HTML 3.0
+ HTML_SQUAREROOT_OFF, // HTML 3.0
+ HTML_STRIKETHROUGH_ON, // HTML 3.0
+ HTML_STRIKETHROUGH_OFF, // HTML 3.0
+ HTML_STRONG_ON,
+ HTML_STRONG_OFF,
+ HTML_STYLE_ON, // HTML 3.0
+ HTML_STYLE_OFF, // HTML 3.0
+ HTML_SUBSCRIPT_ON, // HTML 3.0
+ HTML_SUBSCRIPT_OFF, // HTML 3.0
+ HTML_SUPERSCRIPT_ON, // HTML 3.0
+ HTML_SUPERSCRIPT_OFF, // HTML 3.0
+ HTML_TABLE_ON, // HTML 3.0
+ HTML_TABLE_OFF, // HTML 3.0
+ HTML_TABLEDATA_ON, // HTML 3.0
+ HTML_TABLEDATA_OFF, // HTML 3.0
+ HTML_TABLEHEADER_ON, // HTML 3.0
+ HTML_TABLEHEADER_OFF, // HTML 3.0
+ HTML_TABLEROW_ON, // HTML 3.0
+ HTML_TABLEROW_OFF, // HTML 3.0
+ HTML_TBODY_ON, // HTML3 Table Model Draft
+ HTML_TBODY_OFF, // HTML3 Table Model Draft
+ HTML_TELETYPE_ON,
+ HTML_TELETYPE_OFF,
+ HTML_TEXTAREA_ON,
+ HTML_TEXTAREA_OFF,
+ HTML_TEXTFLOW_ON, // HTML 3.2
+ HTML_TEXTFLOW_OFF, // HTML 3.2
+ HTML_TEXT_ON, // HTML 3.0
+ HTML_TEXT_OFF, // HTML 3.0
+ HTML_TFOOT_ON, // HTML3 Table Model Draft
+ HTML_TFOOT_OFF, // HTML3 Table Model Draft
+ HTML_THEAD_ON, // HTML3 Table Model Draft
+ HTML_THEAD_OFF, // HTML3 Table Model Draft
+ HTML_TILDE_ON, // HTML 3.0
+ HTML_TILDE_OFF, // HTML 3.0
+ HTML_TITLE_ON,
+ HTML_TITLE_OFF,
+ HTML_UNDERLINE_ON,
+ HTML_UNDERLINE_OFF,
+ HTML_UNORDERLIST_ON,
+ HTML_UNORDERLIST_OFF,
+ HTML_VARIABLE_ON,
+ HTML_VARIABLE_OFF,
+ HTML_VECTOR_ON, // HTML 3.0
+ HTML_VECTOR_OFF, // HTML 3.0
+
+ // obsolete features
+ HTML_XMP_ON,
+ HTML_XMP_OFF,
+ HTML_LISTING_ON,
+ HTML_LISTING_OFF,
+
+ // proposed features
+ HTML_DEFINSTANCE_ON,
+ HTML_DEFINSTANCE_OFF,
+ HTML_STRIKE_ON,
+ HTML_STRIKE_OFF,
+
+ HTML_UNKNOWNCONTROL_ON,
+ HTML_UNKNOWNCONTROL_OFF,
+
+ HTML_BGSOUND = HTML_TOKEN_MICROSOFT|HTML_TOKEN_START,
+
+ HTML_COMMENT2_ON = HTML_TOKEN_MICROSOFT|HTML_TOKEN_ONOFF, // HTML 2.0 ?
+ HTML_COMMENT2_OFF, // HTML 2.0 ?
+ HTML_MARQUEE_ON,
+ HTML_MARQUEE_OFF,
+ HTML_PLAINTEXT2_ON, // HTML 2.0 ?
+ HTML_PLAINTEXT2_OFF, // HTML 2.0 ?
+
+ HTML_SDFIELD_ON,
+ HTML_SDFIELD_OFF
+};
+
+// HTML Attribut-Token (=Optionen)
+
+// beginnen immer ab 256, groesser als ein char
+const int HTML_OPTION_START = 0x100;
+
+enum HTML_OPTION_IDS
+{
+HTML_OPTION_BOOL_START = HTML_OPTION_START,
+
+// Attribute ohne Wert
+ HTML_O_BOX = HTML_OPTION_BOOL_START,
+ HTML_O_CHECKED,
+ HTML_O_COMPACT,
+ HTML_O_CONTINUE,
+ HTML_O_CONTROLS, // IExplorer 2.0
+ HTML_O_DECLARE, // IExplorer 3.0b5
+ HTML_O_DISABLED,
+ HTML_O_FOLDED, // Netscape internal
+ HTML_O_ISMAP,
+ HTML_O_MAYSCRIPT, // Netcape 3.0
+ HTML_O_MULTIPLE,
+ HTML_O_NOFLOW,
+ HTML_O_NOHREF, // Netscape
+ HTML_O_NORESIZE, // Netscape 2.0
+ HTML_O_NOSHADE, // Netscape
+ HTML_O_NOWRAP,
+ HTML_O_PLAIN,
+ HTML_O_SDFIXED,
+ HTML_O_SELECTED,
+ HTML_O_SHAPES, // IExplorer 3.0b5
+HTML_OPTION_BOOL_END,
+
+// Attribute mit einem String als Wert
+HTML_OPTION_STRING_START = HTML_OPTION_BOOL_END,
+ HTML_O_ABOVE = HTML_OPTION_STRING_START,
+ HTML_O_ACCEPT,
+ HTML_O_ACCESSKEY,
+ HTML_O_ADD_DATE, // Netscape internal
+ HTML_O_ALT,
+ HTML_O_AXES,
+ HTML_O_AXIS,
+ HTML_O_BELOW,
+ HTML_O_CHAR, // HTML3 Table Model Draft
+ HTML_O_CLASS,
+ HTML_O_CLIP,
+ HTML_O_CODE, // HotJava
+ HTML_O_CODETYPE,
+ HTML_O_COLSPEC,
+ HTML_O_CONTENT,
+ HTML_O_COORDS, // Netscape 2.0
+ HTML_O_DP,
+ HTML_O_ENCTYPE,
+ HTML_O_ERROR,
+ HTML_O_FACE, // IExplorer 2.0
+ HTML_O_FRAMEBORDER, // IExplorer 3.0
+ HTML_O_HTTPEQUIV,
+ HTML_O_LANGUAGE, // JavaScript
+ HTML_O_LAST_MODIFIED, // Netscape internal
+ HTML_O_LAST_VISIT, // Netscape internal
+ HTML_O_MD,
+ HTML_O_N,
+ HTML_O_NAME,
+ HTML_O_NOTATION,
+ HTML_O_PROMPT,
+ HTML_O_SHAPE,
+ HTML_O_STANDBY,
+ HTML_O_STYLE, // Style Sheets
+ HTML_O_TITLE,
+ HTML_O_VALUE,
+ HTML_O_SDVAL, // StarDiv NumberValue
+ HTML_O_SDNUM, // StarDiv NumberFormat
+ HTML_O_SDLIBRARY,
+ HTML_O_SDMODULE,
+HTML_OPTION_STRING_END,
+
+// Attribute mit einem SGML-Identifier als Wert
+HTML_OPTION_SGMLID_START = HTML_OPTION_STRING_END,
+ HTML_O_FROM = HTML_OPTION_SGMLID_START,
+ HTML_O_ID,
+ HTML_O_TARGET, // Netscape 2.0
+ HTML_O_TO,
+ HTML_O_UNTIL,
+HTML_OPTION_SGMLID_END,
+
+// Attribute mit einem URI als Wert
+HTML_OPTION_URI_START = HTML_OPTION_SGMLID_END,
+ HTML_O_ACTION = HTML_OPTION_URI_START,
+ HTML_O_BACKGROUND,
+ HTML_O_CLASSID,
+ HTML_O_CODEBASE, // HotJava
+ HTML_O_DATA,
+ HTML_O_DYNSRC, // IExplorer 3.0
+ HTML_O_DYNSYNC, // IExplorer 2.0
+ HTML_O_IMAGEMAP,
+ HTML_O_HREF,
+ HTML_O_LOWSRC, // Netscape 3.0
+ HTML_O_SCRIPT,
+ HTML_O_SRC,
+ HTML_O_USEMAP, // Netscape 2.0
+HTML_OPTION_URI_END,
+
+// Attribute mit Entity-Namen als Wert
+HTML_OPTION_ENTITY_START = HTML_OPTION_URI_END,
+ HTML_O_DINGBAT = HTML_OPTION_ENTITY_START,
+ HTML_O_SYM,
+HTML_OPTION_ENTITY_END,
+
+// Attribute mit einer Farbe als Wert (alle Netscape)
+HTML_OPTION_COLOR_START = HTML_OPTION_ENTITY_END,
+ HTML_O_ALINK = HTML_OPTION_COLOR_START,
+ HTML_O_BGCOLOR,
+ HTML_O_BORDERCOLOR, // IExplorer 2.0
+ HTML_O_BORDERCOLORLIGHT, // IExplorer 2.0
+ HTML_O_BORDERCOLORDARK, // IExplorer 2.0
+ HTML_O_COLOR,
+ HTML_O_LINK,
+ HTML_O_TEXT,
+ HTML_O_VLINK,
+HTML_OPTION_COLOR_END,
+
+// Attribute mit einem numerischen Wert
+HTML_OPTION_NUMBER_START = HTML_OPTION_COLOR_END,
+ HTML_O_BORDER = HTML_OPTION_NUMBER_START,
+ HTML_O_CELLSPACING, // HTML3 Table Model Draft
+ HTML_O_CELLPADDING, // HTML3 Table Model Draft
+ HTML_O_CHAROFF, // HTML3 Table Model Draft
+ HTML_O_COLSPAN,
+ HTML_O_FRAMESPACING, // IExplorer 3.0
+ HTML_O_GUTTER, // Netscape 3.0b5
+ HTML_O_INDENT,
+ HTML_O_HEIGHT,
+ HTML_O_HSPACE, // Netscape
+ HTML_O_LEFT,
+ HTML_O_LEFTMARGIN, // IExplorer 2.0
+ HTML_O_LOOP, // IExplorer 2.0
+ HTML_O_MARGINWIDTH, // Netscape 2.0
+ HTML_O_MARGINHEIGHT, // Netscape 2.0
+ HTML_O_MAX,
+ HTML_O_MAXLENGTH,
+ HTML_O_MIN,
+ HTML_O_PAGEX,
+ HTML_O_PAGEY,
+ HTML_O_POINTSIZE,
+ HTML_O_ROWSPAN,
+ HTML_O_SCROLLAMOUNT, // IExplorer 2.0
+ HTML_O_SCROLLDELAY, // IExplorer 2.0
+ HTML_O_SEQNUM,
+ HTML_O_SKIP,
+ HTML_O_SPAN, // HTML3 Table Model Draft
+ HTML_O_TABINDEX,
+ HTML_O_TOP,
+ HTML_O_TOPMARGIN, // IExplorer 2.0
+ HTML_O_VSPACE, // Netscape
+ HTML_O_WEIGHT,
+ HTML_O_WIDTH,
+ HTML_O_X,
+ HTML_O_Y,
+ HTML_O_ZINDEX,
+HTML_OPTION_NUMBER_END,
+
+// Attribute mit Enum-Werten
+HTML_OPTION_ENUM_START = HTML_OPTION_NUMBER_END,
+ HTML_O_BEHAVIOR = HTML_OPTION_ENUM_START, // IExplorer 2.0
+ HTML_O_BGPROPERTIES, // IExplorer 2.0
+ HTML_O_CLEAR,
+ HTML_O_DIR,
+ HTML_O_DIRECTION, // IExplorer 2.0
+ HTML_O_FORMAT,
+ HTML_O_FRAME, // HTML3 Table Model Draft
+ HTML_O_LANG,
+ HTML_O_METHOD,
+ HTML_O_PALETTE,
+ HTML_O_REL,
+ HTML_O_REV,
+ HTML_O_RULES, // HTML3 Table Model Draft
+ HTML_O_SCROLLING, // Netscape 2.0
+ HTML_O_SDREADONLY,
+ HTML_O_SUBTYPE,
+ HTML_O_TYPE,
+ HTML_O_VALIGN,
+ HTML_O_VALUETYPE,
+ HTML_O_VISIBILITY,
+ HTML_O_WRAP,
+HTML_OPTION_ENUM_END,
+
+// Attribute mit Script-Code als Wert
+HTML_OPTION_SCRIPT_START = HTML_OPTION_ENUM_END,
+ HTML_O_ONABORT = HTML_OPTION_SCRIPT_START, // JavaScaript
+ HTML_O_ONBLUR, // JavaScript
+ HTML_O_ONCHANGE, // JavaScript
+ HTML_O_ONCLICK, // JavaScript
+ HTML_O_ONERROR, // JavaScript
+ HTML_O_ONFOCUS, // JavaScript
+ HTML_O_ONLOAD, // JavaScript
+ HTML_O_ONMOUSEOUT, // JavaScript
+ HTML_O_ONMOUSEOVER, // JavaScript
+ HTML_O_ONRESET, // JavaScript
+ HTML_O_ONSELECT, // JavaScript
+ HTML_O_ONSUBMIT, // JavaScript
+ HTML_O_ONUNLOAD, // JavaScript
+
+ HTML_O_SDONABORT, // StarBasic
+ HTML_O_SDONBLUR, // StarBasic
+ HTML_O_SDONCHANGE, // StarBasic
+ HTML_O_SDONCLICK, // StarBasic
+ HTML_O_SDONERROR, // StarBasic
+ HTML_O_SDONFOCUS, // StarBasic
+ HTML_O_SDONLOAD, // StarBasic
+ HTML_O_SDONMOUSEOUT, // StarBasic
+ HTML_O_SDONMOUSEOVER, // StarBasic
+ HTML_O_SDONRESET, // StarBasic
+ HTML_O_SDONSELECT, // StarBasic
+ HTML_O_SDONSUBMIT, // StarBasic
+ HTML_O_SDONUNLOAD, // StarBasic
+HTML_OPTION_SCRIPT_END,
+
+// Attribute mit Kontext-abhaengigen Werten
+HTML_OPTION_CONTEXT_START = HTML_OPTION_SCRIPT_END,
+ HTML_O_ALIGN = HTML_OPTION_CONTEXT_START,
+ HTML_O_COLS, // Netscape 2.0 vs HTML 2.0
+ HTML_O_ROWS, // Netscape 2.0 vs HTML 2.0
+ HTML_O_SIZE,
+ HTML_O_START,
+ HTML_O_UNITS,
+HTML_OPTION_CONTEXT_END,
+
+// eine unbekannte Option
+HTML_O_UNKNOWN = HTML_OPTION_CONTEXT_END,
+HTML_OPTION_END
+};
+
+/*************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/svtools/inc/htmltokn.h,v 1.1.1.1 2000-09-18 16:58:51 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.44 2000/09/18 14:13:11 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.43 2000/08/31 13:41:09 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.42 2000/03/20 14:19:38 mib
+ unicode
+
+ Revision 1.41 1999/09/24 07:36:05 mib
+ SUPD < 550 => SUPD < 552
+
+ Revision 1.40 1999/09/17 12:37:47 mib
+ support of multiple and non system text encodings
+
+ Revision 1.39 1998/12/17 10:23:12 MIB
+ #60137#: UTF-8-/UCS-2-Unterstuetzung fuer HTML
+
+
+ Rev 1.38 17 Dec 1998 11:23:12 MIB
+ #60137#: UTF-8-/UCS-2-Unterstuetzung fuer HTML
+
+ Rev 1.37 08 Jul 1998 16:05:40 MIB
+ StarScript
+
+ Rev 1.36 26 May 1998 18:05:52 MIB
+ TABINDEX/ACCESSKEY
+
+ Rev 1.35 02 Mar 1998 08:48:20 MIB
+ SDFIXED-Option
+
+ Rev 1.34 03 Jun 1997 15:33:40 MIB
+ NOEMBED
+
+ Rev 1.33 30 May 1997 14:19:30 MIB
+ <NOBR> nun On/Off-Token
+
+ Rev 1.32 21 May 1997 10:41:16 MIB
+ Netscape 4.0-Token
+
+ Rev 1.31 10 Apr 1997 12:34:26 TRI
+ Kommar bei letzten Enumelement entfernt
+
+ Rev 1.30 02 Apr 1997 12:34:30 MIB
+ MAYSCRIPT
+
+ Rev 1.29 10 Feb 1997 18:38:52 ER
+ TableData Options SDVAL= und SDNUM=
+
+ Rev 1.28 05 Feb 1997 12:59:40 MIB
+ Erweiterungen fuer SW-Felder
+
+ Rev 1.27 29 Jan 1997 12:47:00 MIB
+ SDONRESET
+
+ Rev 1.26 23 Jan 1997 09:11:56 MIB
+ nur Kommentare (zu fix #35163#)
+
+ Rev 1.25 22 Jan 1997 09:16:22 MIB
+ onReset-Option
+
+ Rev 1.24 15 Jan 1997 11:38:08 MIB
+ NOSCRIPT-Tag
+
+ Rev 1.23 28 Nov 1996 11:10:32 JP
+ Tokens StarBasicEvents
+
+ Rev 1.22 18 Nov 1996 12:42:42 JP
+ neue Events am Image/Link
+
+ Rev 1.21 06 Nov 1996 10:32:14 MIB
+ BEHAVIOUR -> BEHAVIOR
+
+ Rev 1.20 14 Oct 1996 16:04:30 RG
+ Kein letztes Komma in enums
+
+ Rev 1.19 17 Jul 1996 12:56:36 MIB
+ neue Tags und Optionen
+
+ Rev 1.18 12 Jun 1996 11:37:36 MIB
+ ein par neue Token und Optionen
+
+ Rev 1.17 05 Jun 1996 12:37:40 MIB
+ ein par neue Strings, <TEXTFLOW>
+
+ Rev 1.16 22 May 1996 10:01:28 MIB
+ Unterstuetzung von SCRIPT
+
+ Rev 1.15 10 May 1996 12:50:24 MIB
+ FRAMESPACING und FRAMEBORDER
+
+ Rev 1.14 25 Apr 1996 09:56:10 MIB
+ neue MS-IExplorer 2.0 Schluesselwoerter und Token
+
+ Rev 1.13 18 Apr 1996 13:27:54 MIB
+ eine par neue Schluesselwoerter (BLINK, Netscape internal, erste des Explorer
+
+ Rev 1.12 27 Mar 1996 10:08:40 MIB
+ zweiten Paramter von GetHTMLCharName() entfernt
+
+ Rev 1.11 21 Mar 1996 10:43:30 MIB
+ Netscape 2.0 Elemente, Font-Farben, Verbesserungen bei PRE
+
+ Rev 1.10 06 Mar 1996 12:45:16 MIB
+ End-Tags fuer DD und DT
+
+ Rev 1.9 29 Feb 1996 12:51:24 MIB
+ Unterstuetzung von Farb-Optionen und anderes
+
+ Rev 1.8 05 Feb 1996 13:55:52 MIB
+ neue Token des HTML3 Table Model Drafts vom 23.1.96
+
+ Rev 1.7 29 Jan 1996 18:58:32 MIB
+ TR, TH und TD sind nun ON/OFF-Token
+
+ Rev 1.6 19 Jan 1996 18:39:12 MIB
+ Optionen werden im HTMLParser geparst
+
+ Rev 1.5 17 Jan 1996 18:18:22 MIB
+ HTML 3.0 Element-Tokens
+
+ Rev 1.4 06 Jul 1995 20:55:24 JP
+ neue Tags: HR, ADDRESS, SoftHyp, HardBlank
+
+ Rev 1.3 05 May 1995 19:40:58 JP
+ neue Token fuer Netscape Unterstuetzung
+
+ Rev 1.2 07 Apr 1995 00:31:18 JP
+ neue Funktionalitaet
+
+ Rev 1.1 03 Apr 1995 12:43:12 JP
+ weitere Funktionalietaet implementiert
+
+ Rev 1.0 31 Mar 1995 16:33:32 JP
+ Initial revision.
+
+*************************************************************************/
+
+#endif
+ // _HTMLTOKN_H
diff --git a/svtools/inc/inetdef.hxx b/svtools/inc/inetdef.hxx
new file mode 100644
index 000000000000..cba42a0e5001
--- /dev/null
+++ b/svtools/inc/inetdef.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * $RCSfile: inetdef.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_INETDEF_HXX
+#include <tools/inetdef.hxx>
+#endif
+
diff --git a/svtools/inc/inetmsg.hxx b/svtools/inc/inetmsg.hxx
new file mode 100644
index 000000000000..3cd17c06f090
--- /dev/null
+++ b/svtools/inc/inetmsg.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * $RCSfile: inetmsg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_INETMSG_HXX
+#include <tools/inetmsg.hxx>
+#endif
+
diff --git a/svtools/inc/inetstrm.hxx b/svtools/inc/inetstrm.hxx
new file mode 100644
index 000000000000..92a76aba6e21
--- /dev/null
+++ b/svtools/inc/inetstrm.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * $RCSfile: inetstrm.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_INETSTRM_HXX
+#include <tools/inetstrm.hxx>
+#endif
+
diff --git a/svtools/inc/iniadrtk.hxx b/svtools/inc/iniadrtk.hxx
new file mode 100644
index 000000000000..8e4752502c03
--- /dev/null
+++ b/svtools/inc/iniadrtk.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: iniadrtk.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_INIADRTK_HXX
+#define SVTOOLS_INIADRTK_HXX
+
+class String;
+
+//============================================================================
+enum AddressToken
+{
+ ADDRESS_COMPANY,
+ ADDRESS_STREET,
+ ADDRESS_COUNTRY,
+ ADDRESS_PLZ,
+ ADDRESS_CITY,
+ ADDRESS_TITLE,
+ ADDRESS_POSITION,
+ ADDRESS_TEL_PRIVATE,
+ ADDRESS_TEL_COMPANY,
+ ADDRESS_FAX,
+ ADDRESS_EMAIL,
+ ADDRESS_STATE,
+ ADDRESS_FATHERSNAME,
+ ADDRESS_APARTMENT
+};
+
+//============================================================================
+class SfxIniManagerAddressEntry
+{
+public:
+ static String get(const String & rAddress, AddressToken eToken);
+};
+
+#endif // SVTOOLS_INIADRTK_HXX
+
diff --git a/svtools/inc/inidef.hxx b/svtools/inc/inidef.hxx
new file mode 100644
index 000000000000..a06bca91c126
--- /dev/null
+++ b/svtools/inc/inidef.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * $RCSfile: inidef.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SFXINIDEF_HXX
+#define _SFXINIDEF_HXX
+
+#ifndef _INIMGR_HXX
+#include <iniman.hxx>
+#endif
+
+class SfxIniEntry;
+class SfxIniDefaulterList;
+class SfxIniDefaultManager;
+
+#if __PRIVATE
+#include "svarray.hxx"
+
+class SfxIniDefaulter;
+SV_DECL_PTRARR( SfxIniDefaulterList, SfxIniDefaulter*, 0, 2 );
+#endif
+
+//========================================================================
+
+class SfxIniDefaulter
+
+/* [Beschreibung]
+
+ Instanzen dieser Klasse k"onnen (f"ur die Laufzeit eines Moduls, z.B.
+ einer DLL-Nutzung oder einer Applikation) angelegt werden, um Defaults
+ f"ur eine Anzahl von ini-Eintr"agen zu liefern. Diese Defaults werden
+ erfragt, wenn ein <SfxIniManager> einen Eintrag nicht in den ini-Files
+ finden kann.
+
+ Defaults verschiedener <SfxIniDefaulter>-Instanzen d"urfen sich nicht
+ unterscheiden, da die Reihenfolge der Abarbeitung nicht definiert ist.
+
+ Die Instanzen brauchen nicht zerst"ort zu werden, au\ser wenn der
+ dazugeh"orige Code entladen wird (load-on-demand DLLs). Sonst geschieht
+ dies automatisch beim Zerst"oren des <SfxIniDefaultManager>.
+*/
+
+{
+ SfxIniDefaultManager* _pManager;
+
+public:
+ SfxIniDefaulter( SfxIniDefaultManager *pManager );
+ ~SfxIniDefaulter();
+
+ virtual BOOL QueryDefault( String &aValue,
+ const SfxIniEntry &rEntry ) = 0;
+};
+
+//========================================================================
+
+class SfxIniDefaultManager
+
+/* [Beschreibung]
+
+ Genau eine Instanz dieser Klasse mu\s in jeder Application-Subklasse,
+ die diesen Mechanismus nutzen m"ochte, in deren Ctor angelegt werden
+ und sollte in deren Dtor zerst"ort werden.
+*/
+
+{
+ SfxIniDefaulterList* _pList;
+
+public:
+ SfxIniDefaultManager();
+ ~SfxIniDefaultManager();
+
+#if __PRIVATE
+ void Insert( SfxIniDefaulter *pDefaulter )
+ { _pList->C40_INSERT( SfxIniDefaulter, pDefaulter, _pList->Count() ); }
+ void Remove( SfxIniDefaulter *pDefaulter )
+ { _pList->Remove( _pList->C40_GETPOS( SfxIniDefaulter, pDefaulter ) ); }
+ BOOL QueryDefault( String &aValue,
+ const SfxIniEntry &rEntry );
+#endif
+};
+
+//========================================================================
+
+class SfxIniEntry
+
+/* [Beschreibung]
+
+ Instanzen dieser Klasse beschreiben einen Eintrag eines Ini-Files,
+ um mit der Klasse <SfxIniDefaulter> erfragt werden zu k"onnen, falls
+ der <SfxIniManager> einen Eintrag nicht in den Ini-Files auffindet.
+*/
+
+{
+friend class SfxIniManager;
+
+ const String& _aGroup;
+ const String& _aKey;
+ SfxIniGroup _eGroup;
+ SfxIniKey _eKey;
+ USHORT _nIndex;
+
+private:
+ SfxIniEntry( const String& aGroup,
+ const String& aKey,
+ SfxIniGroup eGroup,
+ SfxIniKey eKey,
+ USHORT nIndex );
+ SfxIniEntry( const SfxIniEntry & ); // n.i.
+ SfxIniEntry& operator=( const SfxIniEntry & ); // n.i.
+
+public:
+ const String& GetGroupName() const { return _aGroup; }
+ SfxIniGroup GetGroup() const { return _eGroup; }
+ const String& GetKeyName() const { return _aKey; }
+ SfxIniKey GetKey() const { return _eKey; }
+ USHORT GetIndex() const { return _nIndex; }
+};
+
+#endif
+
diff --git a/svtools/inc/iniprop.hxx b/svtools/inc/iniprop.hxx
new file mode 100644
index 000000000000..1b5ed8ccde46
--- /dev/null
+++ b/svtools/inc/iniprop.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * $RCSfile: iniprop.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SFXINIPROP_HXX
+#define _SFXINIPROP_HXX
+
+#include <limits.h>
+
+#ifndef _RTTI_HXX //autogen
+#include <tools/rtti.hxx>
+#endif
+#ifndef _APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+class SfxIniManager;
+
+//------------------------------------------------------------------------
+
+class SfxAppIniManagerProperty: public ApplicationProperty
+
+// fuer Application::Property(), um von ueberall an den AppIniManger zu kommen
+
+{
+ SfxIniManager* _pIniManager;
+
+public:
+ TYPEINFO();
+ SfxAppIniManagerProperty()
+ : _pIniManager(0)
+ {}
+ ~SfxAppIniManagerProperty();
+
+ SfxIniManager* GetIniManager() const { return _pIniManager; }
+ void SetIniManager( SfxIniManager *pIniManager )
+ { _pIniManager = pIniManager; }
+};
+
+
+#endif
+
diff --git a/svtools/inc/instrm.hxx b/svtools/inc/instrm.hxx
new file mode 100644
index 000000000000..ca07dcec0559
--- /dev/null
+++ b/svtools/inc/instrm.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: instrm.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_INSTRM_HXX
+#define SVTOOLS_INSTRM_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XInputStream;
+ class XSeekable;
+} } } }
+
+class SvDataPipe_Impl;
+
+//============================================================================
+class SvInputStream: public SvStream
+{
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ m_xStream;
+ com::sun::star::uno::Reference< com::sun::star::io::XSeekable >
+ m_xSeekable;
+ SvDataPipe_Impl * m_pPipe;
+ ULONG m_nSeekedFrom;
+
+ bool open();
+
+ virtual ULONG GetData(void * pData, ULONG nSize);
+
+ virtual ULONG PutData(void const *, ULONG);
+
+ virtual ULONG SeekPos(ULONG nPos);
+
+ virtual void FlushData();
+
+ virtual void SetSize(ULONG);
+
+public:
+ SvInputStream(
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ const &
+ rTheStream);
+
+ virtual ~SvInputStream();
+
+ virtual USHORT IsA() const;
+
+ virtual void AddMark(ULONG nPos);
+
+ virtual void RemoveMark(ULONG nPos);
+};
+
+#endif // SVTOOLS_INSTRM_HXX
+
diff --git a/svtools/inc/itemdel.hxx b/svtools/inc/itemdel.hxx
new file mode 100644
index 000000000000..30da849c60fa
--- /dev/null
+++ b/svtools/inc/itemdel.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: itemdel.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SVTOOLS_ITEMDEL_HXX
+#define _SVTOOLS_ITEMDEL_HXX
+
+class SfxPoolItem;
+
+SfxPoolItem* DeleteItemOnIdle( SfxPoolItem* pItem );
+void DeleteOnIdleItems();
+
+
+
+#endif
+
diff --git a/svtools/inc/jpeg.hxx b/svtools/inc/jpeg.hxx
new file mode 100644
index 000000000000..de89fdc3ccb6
--- /dev/null
+++ b/svtools/inc/jpeg.hxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * $RCSfile: jpeg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _JPEG_HXX
+#define _JPEG_HXX
+
+#ifdef VCL
+
+#ifndef _GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#ifndef _FLTCALL_HXX
+#include "fltcall.hxx"
+#endif
+
+class Config;
+
+#else // VCL
+
+#ifndef _GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _FLTCALL_HXX
+#include "fltcall.hxx"
+#endif
+#ifndef _FLTDEFS_HXX
+#include "fltdefs.hxx"
+#endif
+
+#endif // VCL
+
+#ifdef _JPEGPRIVATE
+
+// --------
+// - Enum -
+// --------
+
+enum ReadState
+{
+ JPEGREAD_OK,
+ JPEGREAD_ERROR,
+ JPEGREAD_NEED_MORE
+};
+
+// --------------
+// - JPEGReader -
+// --------------
+
+#ifdef VCL
+
+class JPEGReader : public GraphicReader
+{
+ SvStream& rIStm;
+ Bitmap aBmp;
+ Bitmap aBmp1;
+ BitmapWriteAccess* pAcc;
+ BitmapWriteAccess* pAcc1;
+ void* pBuffer;
+ long nLastPos;
+ long nFormerPos;
+ long nLastLines;
+
+ Graphic CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines );
+ void FillBitmap();
+
+public:
+
+ void* CreateBitmap( const Size& rSize, BOOL bGray, long& rAlignedWidth, long& rTopDown );
+
+public:
+
+
+
+ JPEGReader( SvStream& rStm, void* pCallData );
+ virtual ~JPEGReader();
+
+
+ ReadState Read( Graphic& rGraphic );
+};
+
+// --------------
+// - JPEGWriter -
+// --------------
+
+class JPEGWriter
+{
+ SvStream& rOStm;
+ Bitmap aBmp;
+ BitmapReadAccess* pAcc;
+ BYTE* pBuffer;
+ PFilterCallback pCallback;
+ void* pCallerData;
+ Config* pConfig;
+ BOOL bNative;
+
+public:
+
+ void* GetScanline( long nY );
+
+public:
+
+ JPEGWriter( SvStream& rOStm, PFilterCallback pCallback,
+ void* pCallData, Config* pOptionsConfig );
+ ~JPEGWriter() {};
+
+ BOOL Write( const Graphic& rGraphic );
+};
+
+#else // VCL
+
+class JPEGReader : public GraphicReader
+{
+ Graphic aImGraphic;
+ SvStream& rIStm;
+ PDIBBYTE pMonoDIB;
+ PDIBBYTE pRow1;
+ PDIBBYTE pMonoFile;
+ long nLastPos;
+ long nFormerPos;
+ long nLastLines;
+ long nWidthAl1;
+ long nTotal;
+ long nMonoTotal;
+
+ void CreateMonoDIB( const Size& rSize );
+ void CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines );
+
+
+public:
+
+ JPEGReader( SvStream& rStm, void* pCallData );
+ virtual ~JPEGReader();
+
+
+ ReadState ReadJpeg( Graphic& rGraphic );
+};
+
+#endif // VCL
+#endif // _JPEGPRIVATE
+
+// ---------------------
+// - Import/ExportJPEG -
+// ---------------------
+
+BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData );
+
+BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData,
+ Config* pOptionsConfig );
+
+#endif // _JPEG_HXX
diff --git a/svtools/inc/memberid.hrc b/svtools/inc/memberid.hrc
new file mode 100644
index 000000000000..7d5fca7b51ab
--- /dev/null
+++ b/svtools/inc/memberid.hrc
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: memberid.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _MEMBERID_HRC
+#define _MEMBERID_HRC
+
+#define SFX_MEMBERID(nUserData) ( ( (nUserData) >> 20 ) & 0xFF )
+#define SFX_SLOTID(nUserData) ( (nUserData) & 0xFFFF )
+
+#define MID_X 1
+#define MID_Y 2
+#define MID_LEFT 3
+#define MID_TOP 4
+#define MID_WIDTH 5
+#define MID_HEIGHT 6
+
+
+#endif
+
diff --git a/svtools/inc/msgrd.hxx b/svtools/inc/msgrd.hxx
new file mode 100644
index 000000000000..51733ecd0816
--- /dev/null
+++ b/svtools/inc/msgrd.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * $RCSfile: msgrd.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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/inc/msgwr.hxx b/svtools/inc/msgwr.hxx
new file mode 100644
index 000000000000..021044946ae0
--- /dev/null
+++ b/svtools/inc/msgwr.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: msgwr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _MSGWR_HXX
+#define _MSGWR_HXX
+
+
+BOOL ConvertGraphicToMSG(const Graphic & rGraphic, SvStream & rTargetStream,
+ BOOL(*pCallback)(void *, USHORT), void * pCallerData,
+ ULONG nMinPercent, ULONG nMaxPercent);
+
+
+#endif // _MSGWR_HXX
+
diff --git a/svtools/inc/numuno.hxx b/svtools/inc/numuno.hxx
new file mode 100644
index 000000000000..4600e248280b
--- /dev/null
+++ b/svtools/inc/numuno.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: numuno.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _NUMUNO_HXX
+#define _NUMUNO_HXX
+
+#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+class SvNumberFormatter;
+class SvNumFmtSuppl_Impl;
+
+//------------------------------------------------------------------
+
+// SvNumberFormatterServiceObj must be registered as service somewhere
+
+com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL
+ SvNumberFormatterServiceObj_NewInstance(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory>& rSMgr );
+
+//------------------------------------------------------------------
+
+// SvNumberFormatsSupplierObj: aggregate to document,
+// construct with SvNumberFormatter
+
+class SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2<
+ com::sun::star::util::XNumberFormatsSupplier,
+ com::sun::star::lang::XUnoTunnel>
+{
+private:
+ SvNumFmtSuppl_Impl* pImpl;
+
+public:
+ SvNumberFormatsSupplierObj();
+ SvNumberFormatsSupplierObj(SvNumberFormatter* pForm);
+ virtual ~SvNumberFormatsSupplierObj();
+
+ void SetNumberFormatter(SvNumberFormatter* pNew);
+ SvNumberFormatter* GetNumberFormatter() const;
+
+ // ueberladen, um Attribute im Dokument anzupassen
+ virtual void NumberFormatDeleted(sal_uInt32 nKey);
+ // ueberladen, um evtl. neu zu formatieren
+ virtual void SettingsChanged();
+
+ // 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);
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& aIdentifier )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
+ static SvNumberFormatsSupplierObj* getImplementation( const com::sun::star::uno::Reference<
+ com::sun::star::util::XNumberFormatsSupplier> xObj );
+};
+
+#endif // #ifndef _NUMUNO_HXX
+
+
diff --git a/svtools/inc/outstrm.hxx b/svtools/inc/outstrm.hxx
new file mode 100644
index 000000000000..85d0e25c5f13
--- /dev/null
+++ b/svtools/inc/outstrm.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * $RCSfile: outstrm.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_OUTSTRM_HXX
+#define SVTOOLS_OUTSTRM_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XOutputStream;
+} } } }
+
+//============================================================================
+class SvOutputStream: public SvStream
+{
+ com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
+ m_xStream;
+
+ virtual ULONG GetData(void *, ULONG);
+
+ virtual ULONG PutData(void const * pData, ULONG nSize);
+
+ virtual ULONG SeekPos(ULONG);
+
+ virtual void FlushData();
+
+ virtual void SetSize(ULONG);
+
+public:
+ SvOutputStream(com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > const &
+ rTheStream);
+
+ virtual ~SvOutputStream();
+
+ virtual USHORT IsA() const;
+};
+
+#endif // SVTOOLS_OUTSTRM_HXX
+
diff --git a/svtools/inc/poolcach.hxx b/svtools/inc/poolcach.hxx
new file mode 100644
index 000000000000..fb73ee0745c9
--- /dev/null
+++ b/svtools/inc/poolcach.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: poolcach.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SFXPOOLCACH_HXX
+#define _SFXPOOLCACH_HXX
+
+#include <tools/solar.h>
+
+class SfxItemModifyArr_Impl;
+class SfxItemPool;
+class SfxItemSet;
+class SfxPoolItem;
+class SfxSetItem;
+
+class SfxItemPoolCache
+{
+ SfxItemPool *pPool;
+ SfxItemModifyArr_Impl *pCache;
+ const SfxItemSet *pSetToPut;
+ const SfxPoolItem *pItemToPut;
+
+public:
+ SfxItemPoolCache( SfxItemPool *pPool,
+ const SfxPoolItem *pPutItem );
+ SfxItemPoolCache( SfxItemPool *pPool,
+ const SfxItemSet *pPutSet );
+ ~SfxItemPoolCache();
+
+ const SfxSetItem& ApplyTo( const SfxSetItem& rSetItem, BOOL bNew = FALSE );
+};
+
+
+#endif
+
diff --git a/svtools/inc/prgsbar.hxx b/svtools/inc/prgsbar.hxx
new file mode 100644
index 000000000000..f3de05087c2a
--- /dev/null
+++ b/svtools/inc/prgsbar.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * $RCSfile: prgsbar.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _PRGSBAR_HXX
+#define _PRGSBAR_HXX
+
+#ifndef _WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class ProgressBar
+
+Diese Klasse dient zur Anzeige einer Progress-Anzeige.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_BORDER Border um das Fenster
+WB_SVLOOK 3D-Darstellung
+
+--------------------------------------------------------------------------
+
+Methoden
+
+Mit SetValue() setzt man einen Prozent-Wert zwischen 0 und 100. Wenn Werte
+groesser 100 gesetzt werden, faengt das letzte Rechteck an zu blinken.
+
+*************************************************************************/
+
+// -----------
+// - WinBits -
+// -----------
+
+#define WB_STDPROGRESSBAR WB_BORDER
+
+// ---------------
+// - ProgressBar -
+// ---------------
+
+class ProgressBar : public Window
+{
+private:
+ Point maPos;
+ long mnPrgsWidth;
+ long mnPrgsHeight;
+ USHORT mnPercent;
+ USHORT mnPercentCount;
+ BOOL mbCalcNew;
+
+#ifdef _SV_PRGSBAR_CXX
+ void ImplInit();
+ void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground );
+ void ImplDrawProgress( USHORT nOldPerc, USHORT nNewPerc );
+#endif
+
+public:
+ ProgressBar( Window* pParent, WinBits nWinBits = WB_STDPROGRESSBAR );
+ ProgressBar( Window* pParent, const ResId& rResId );
+ ~ProgressBar();
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void SetValue( USHORT nNewPercent );
+ USHORT GetValue() const { return mnPercent; }
+};
+
+#endif // _PRGSBAR_HXX
diff --git a/svtools/inc/privsplt.hxx b/svtools/inc/privsplt.hxx
new file mode 100644
index 000000000000..f1f02c37e2a7
--- /dev/null
+++ b/svtools/inc/privsplt.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: privsplt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_PRIVSPLT_HXX
+#define _SV_PRIVSPLT_HXX
+
+#ifndef _SV_FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+
+enum PRIVSPLIT_DIRECTION {PRIVSPLIT_HORZ,PRIVSPLIT_VERT };
+
+class SvPrivatSplit : public FixedLine
+{
+ private:
+
+ Link aCtrModifiedLink;
+ BOOL aMovingFlag;
+ Pointer aWinPointer;
+ PRIVSPLIT_DIRECTION eAdrSplit;
+ short nOldX;
+ short nOldY;
+ short nNewX;
+ short nNewY;
+ short nMinPos;
+ short nMaxPos;
+ Range aXMovingRange;
+ Range aYMovingRange;
+ short nDeltaX;
+ short nDeltaY;
+ void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground );
+
+ protected:
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+
+ public:
+
+ SvPrivatSplit( Window* pWindow, const ResId& rResId,PRIVSPLIT_DIRECTION eAdrSplit);
+
+ SvPrivatSplit( Window* pParent,PRIVSPLIT_DIRECTION eAdrSplit, WinBits nStyle = 0);
+
+ virtual short GetDeltaX();
+ virtual short GetDeltaY();
+
+ virtual void CtrModified();
+
+ void SetXRange(Range cRgeX);
+ void SetYRange(Range cRgeY);
+
+ void MoveSplitTo(Point aPos);
+
+ virtual void StateChanged( StateChangedType nType );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void SetCtrModifiedHdl( const Link& rLink ) { aCtrModifiedLink = rLink; }
+ const Link& GetCtrModifiedHdl() const { return aCtrModifiedLink; }
+};
+
+
+#endif
diff --git a/svtools/inc/propctrl.hxx b/svtools/inc/propctrl.hxx
new file mode 100644
index 000000000000..ed028fe2e965
--- /dev/null
+++ b/svtools/inc/propctrl.hxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * $RCSfile: propctrl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#include <vcl/sound.hxx>
+#include "sbx.hxx"
+#include "sbxbase.hxx"
+#include "sbxres.hxx"
+
+#ifndef _SFXBRDCST_HXX //autogen
+#include <brdcst.hxx>
+#endif
+ */
+
+
+#ifndef __PROPED_HXX__
+#include <svtools/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/inc/property.hxx b/svtools/inc/property.hxx
new file mode 100644
index 000000000000..1ed05857b074
--- /dev/null
+++ b/svtools/inc/property.hxx
@@ -0,0 +1,639 @@
+/*************************************************************************
+ *
+ * $RCSfile: property.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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
+#ifndef _SV_COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+#ifndef _SV_FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _SVARRAY_HXX //autogen
+#include <svarray.hxx>
+#endif
+
+#define _SVSTDARR_USHORTS
+#include <svstdarr.hxx>
+
+#ifndef _SV_VIRDEV_HXX //autogen
+#include <vcl/virdev.hxx>
+#endif
+
+#ifndef _SV_SCRBAR_HXX //autogen
+#include <vcl/scrbar.hxx>
+#endif
+
+#ifndef _SVARRAY_HXX //autogen
+#include <svarray.hxx>
+#endif
+
+#ifndef _SVSTDARR_STRINGS
+#define _SVSTDARR_STRINGS
+#include <svstdarr.hxx>
+#endif
+
+#ifndef _SV_TABPAGE_HXX //autogen
+#include <vcl/tabpage.hxx>
+#endif
+
+#ifndef _SV_TABCTRL_HXX //autogen
+#include <vcl/tabctrl.hxx>
+#endif
+
+//------------------------------------------------------------------------
+
+//========================================================================
+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 IsLocked();
+
+ 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 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 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/inc/reginfo.hxx b/svtools/inc/reginfo.hxx
new file mode 100644
index 000000000000..342c151ef898
--- /dev/null
+++ b/svtools/inc/reginfo.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * $RCSfile: reginfo.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _REGINFO_HXX
+#define _REGINFO_HXX
+
+struct RegInfo_Impl;
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+class RegInfo
+{
+
+ public:
+
+ RegInfo();
+ ~RegInfo();
+
+ const String& GetGroup() const { return aCurrentGroup; }
+ void SetAppGroup( const String& rGroup );
+ void DeleteAppGroup( const String& rGroup );
+
+ String ReadKey( const String& rKey ) const;
+ String ReadKey( const String& rKey, const String& rDefault ) const;
+ void WriteKey( const String& rKey, const String& rValue );
+ void DeleteKey( const String& rKey );
+ String GetKeyName( USHORT nKey ) const;
+ String ReadKey( USHORT nKey ) const;
+ USHORT GetKeyCount() const;
+
+ private:
+
+ String aCurrentGroup;
+ RegInfo_Impl* pImp;
+
+};
+
+
+#endif
diff --git a/svtools/inc/reqitem.hxx b/svtools/inc/reqitem.hxx
new file mode 100644
index 000000000000..46b963fa327c
--- /dev/null
+++ b/svtools/inc/reqitem.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * $RCSfile: reqitem.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _REQITEM_HXX
+#define _REQITEM_HXX
+
+#ifndef _SOLAR_H
+#include <solar.h>
+#endif
+
+#ifndef _RTTI_HXX
+#include <rtti.hxx>
+#endif
+
+#if __PRIVATE
+#include "poolitem.hxx"
+#else
+#include <sfxipool.hxx>
+#endif
+
+// -----------------------------------------------------------------------
+
+class SfxRequestItem: public SfxSetItem
+
+/** [Description]
+
+ Represents a function call with optional arguments.
+*/
+
+{
+public:
+ TYPEINFO();
+ SfxRequestItem();
+ SfxRequestItem( USHORT nWhich, SvStream & );
+ SfxRequestItem( const SfxRequestItem& );
+ ~SfxRequestItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const;
+ virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const;
+};
+
+
+#endif
+
diff --git a/svtools/inc/ruler.hxx b/svtools/inc/ruler.hxx
new file mode 100644
index 000000000000..bd83f7ec60d9
--- /dev/null
+++ b/svtools/inc/ruler.hxx
@@ -0,0 +1,928 @@
+/*************************************************************************
+ *
+ * $RCSfile: ruler.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RULER_HXX
+#define _RULER_HXX
+
+#ifndef _LINK_HXX
+#include <tools/link.hxx>
+#endif
+
+#ifndef _WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+#ifndef _VIRDEV_HXX
+#include <vcl/virdev.hxx>
+#endif
+#ifndef _SV_FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+
+class MouseEvent;
+class TrackingEvent;
+class DataChangedEvent;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class Ruler
+
+Diese Klasse dient zur Anzeige eines Lineals. Dabei kann diese Klasse nicht
+nur als Anzeige-Control verwendet werden, sondern auch als aktives Control
+zum Setzen/Verschieben von Tabulatoren und Raendern.
+
+--------------------------------------------------------------------------
+
+WinBits
+
+WB_HORZ Lineal wird horizontal dargestellt
+WB_VERT Lineal wird vertikal dargestellt
+WB_3DLOOK 3D-Darstellung
+WB_BORDER Border am unteren/rechten Rand
+WB_EXTRAFIELD Feld in der linken/oberen Ecke zur Anzeige und
+ Auswahl von Tabs, Null-Punkt, ...
+
+--------------------------------------------------------------------------
+
+Beim Lineal werden alle Werte als Pixel-Werte eingestellt. Dadurch werden
+doppelte Umrechnungen und Rundungsfehler vermieden und die Raender werden
+im Lineal auch an der Position angezeigt, den Sie auch im Dokument haben.
+Dadurch kann die Applikation zum Beispiel bei Tabellendarstellung auch
+eigene Rundungen vornehmen und die Positionen im Lineal passen trotzdem noch
+zu denen im Dokument. Damit aber das Lineal weiss, wie das Dokument auf dem
+Bildschirm dargestellt wird, muessen noch ein paar zusaetzliche Werte
+eingestellt werden.
+
+Mit SetWinPos() wird der Offset des Edit-Fenster zum Lineal eingestellt.
+Dabei kann auch die Breite des Fensters eingestellt werden. Wenn bei den
+Werten 0 uebergeben wird, wird die Position/Breite vom Fenster automatisch
+so breit gesetzt, wie das Lineal breit ist.
+
+Mit SetPagePos() wird der Offset der Seite zum Edit-Fenster eingestellt und
+die Breite der Seite eingestellt. Wenn bei den Werten 0 uebergeben wird,
+wird die Position/Breite automatisch so gesetzt, als ob die Seite das ganze
+Editfenster ausfuellen wuerde.
+
+Mit SetBorderPos() kann der Offset eingestellt werden, ab dem der
+Border ausgegeben wird. Die Position bezieht sich auf die linke bzw. obere
+Fensterkante. Dies wird gebraucht, wenn ein horizontales und vertikales
+Lineal gleichzeitig sichtbar sind. Beispiel:
+ aHRuler.SetBorderPos( aVRuler.GetSizePixel().Width()-1 );
+
+Mit SetNullOffset() wird der Null-Punkt bezogen auf die Seite gesetzt.
+
+Alle anderen Werte (Raender, Einzug, Tabs, ...) beziehen sich auf den 0 Punkt,
+der mit SetNullOffset() eingestellt wird.
+
+Die Werte werden zum Beispiel folgendermassen berechnet:
+
+- WinPos (wenn beide Fenster den gleichen Parent haben)
+
+ Point aHRulerPos = aHRuler.GetPosPixel();
+ Point aEditWinPos = aEditWin.GetPosPixel();
+ aHRuler.SetWinPos( aEditWinPos().X() - aHRulerPos.X() );
+
+- PagePos
+
+ Point aPagePos = aEditWin.LogicToPixel( aEditWin.GetPagePos() );
+ aHRuler.SetPagePos( aPagePos().X() );
+
+- Alle anderen Werte
+
+ Die logischen Werte zusammenaddieren, als Position umrechnen und
+ die vorher gemerkten Pixel-Positionen (von PagePos und NullOffset)
+ entsprechend abziehen.
+
+--------------------------------------------------------------------------
+
+Mit SetUnit() und SetZoom() wird eingestellt, in welcher Einheit das Lineal
+die Werte anzeigt. Folgende Einheiten werden akzeptiert:
+
+ FUNIT_MM
+ FUNIT_CM (Default)
+ FUNIT_M
+ FUNIT_KM
+ FUNIT_INCH
+ FUNIT_FOOT
+ FUNIT_MILE
+ FUNIT_POINT
+ FUNIT_PICA
+
+--------------------------------------------------------------------------
+
+Mit SetMargin1() kann der linke/obere Rand und mit SetMargin2() kann
+der rechte/untere Rand gesetzt werden. Falls diese Methoden ohne Parameter
+aufgerufen werden, werden keine Raender angezeigt. Wenn SetMargin1() bzw.
+SetMargin2() mit Parametern aufgerufen werden, kann bei diesen
+folgendes angegeben werden:
+
+ long nPos - Offset zum NullPunkt in Pixel
+ USHORT nStyle - Bit-Style:
+ RULER_MARGIN_SIZEABLE
+ Rand kann in der Groesse veraendert werden.
+
+ Zu diesen Style's koennen folgende Style-
+ Bits dazugeodert werden:
+ RULER_STYLE_INVISIBLE (fuer nicht sichtbar)
+
+
+Mit SetBorders() kann ein Array von Raendern gesetzt werden. Dabei muss
+ein Array vom Typ RulerBorder uebergeben werden, wobei folgende Werte
+initialisiert werden muessen:
+
+ long nPos - Offset zum NullPunkt in Pixel
+ long nWidth - Breite des Spaltenabstands in Pixel (kann zum
+ Beispiel fuer Tabellenspalten auch 0 sein)
+ USHORT nStyle - Bit-Style:
+ RULER_BORDER_SIZEABLE
+ Spaltenabstand kann in der Groesse veraendert
+ werden. Dieses Flag sollte nur gesetzt werden,
+ wenn ein Abstand in der Groesse geaendert wird
+ und nicht die Groesse einer Zelle.
+ RULER_BORDER_MOVEABLE
+ Spaltenabstand/Begrenzung kann verschoben
+ werden. Wenn Tabellenbegrenzungen verschoben
+ werden, sollte dieses Flag gesetzt werden und
+ nicht Sizeable. Denn Sizeable gibt an, das
+ ein Abstand vergroessert werden kann und nicht
+ eine einzelne Zelle in der Groesse geaendert
+ werden kann.
+ RULER_BORDER_VARIABLE
+ Nicht alle Spaltenabstande sind gleich
+ RULER_BORDER_TABLE
+ Tabellenrahmen. Wenn dieser Style gesetzt
+ wird, muss die Spaltenbreite 0 sein.
+ RULER_BORDER_SNAP
+ Hilfslinie / Fanglinie. Wenn dieser Style
+ gesetzt wird, muss die Spaltenbreite 0 sein.
+
+ Zu diesen Style's koennen folgende Style-
+ Bits dazugeodert werden:
+ RULER_STYLE_INVISIBLE (fuer nicht sichtbar)
+
+Mit SetIndents() kann ein Array von Indents gesetzt werden. Diese Methode darf
+nur angewendet werden, wenn es sich um ein horizontales Lineal handelt. Als
+Parameter muss ein Array vom Typ RulerIndent uebergeben werden, wobei folgende
+Werte initialisiert werden muessen:
+
+ long nPos - Offset zum NullPunkt in Pixel
+ USHORT nStyle - Bit-Style:
+ RULER_INDENT_TOP (Erstzeileneinzug)
+ RULER_INDENT_BOTTOM (Linker/Rechter Einzug)
+ Zu diesen Style's koennen folgende Style-
+ Bits dazugeodert werden:
+ RULER_STYLE_DONTKNOW (fuer alte Position oder
+ fuer Uneindeutigkeit)
+ RULER_STYLE_INVISIBLE (fuer nicht sichtbar)
+
+Mit SetTabs() kann ein Array von Tabs gesetzt werden. Diese Methode darf nur
+angewendet werden, wenn es sich um ein horizontales Lineal handelt. Als
+Parameter muss ein Array vom Typ RulerTab uebergeben werden, wobei folgende
+Werte initialisiert werden muessen:
+
+ long nPos - Offset zum NullPunkt in Pixel
+ USHORT nStyle - Bit-Style:
+ RULER_TAB_DEFAULT (kann nicht selektiert werden)
+ RULER_TAB_LEFT
+ RULER_TAB_CENTER
+ RULER_TAB_RIGHT
+ RULER_TAB_DECIMAL
+ Zu diesen Style's koennen folgende Style-
+ Bits dazugeodert werden:
+ RULER_STYLE_DONTKNOW (fuer alte Position oder
+ fuer Uneindeutigkeit)
+ RULER_STYLE_INVISIBLE (fuer nicht sichtbar)
+
+Mit SetLines() koennen Positionslinien im Lineal angezeigt werden. Dabei
+muss ein Array vom Typ RulerLine uebergeben werden, wobei folgende Werte
+initialisiert werden muessen:
+
+ long nPos - Offset zum NullPunkt in Pixel
+ USHORT nStyle - Bit-Style (muss zur Zeit immer 0 sein)
+
+Mit SetArrows() koennen Bemassungspfeile im Lineal angezeigt werden. Wenn
+Bemassungspfeile gesetzt werden, werden im Lineal auch keine Unterteilungen
+mehr angezeigt. Deshalb sollten die Bemassungspfeile immer ueber die ganze
+Linealbreite gesetzt werden. Dabei muss ein Array vom Typ RulerArrow
+uebergeben werden, wobei folgende Werte initialisiert werden muessen:
+
+ long nPos - Offset zum NullPunkt in Pixel
+ long nWidth - Breite des Pfeils
+ long nLogWidth - Breite des Pfeils in logischer Einheit
+ USHORT nStyle - Bit-Style (muss zur Zeit immer 0 sein)
+
+Mit SetSourceUnit() wird die Einheit eingestellt, in welcher die logischen
+Werte vorliegen, die bei SetArrows() uebergeben werden. Dabei werden nur die
+Einheiten MAP_TWIP und MAP_100TH_MM (default) akzeptiert.
+
+--------------------------------------------------------------------------
+
+Wenn auch vom Benutzer die Raender, Tabs, Border, ... ueber das Lineal
+geaendert werden koennen, muss etwas mehr Aufwand getrieben werden. Dazu
+muessen die Methoden StartDrag(), Drag() und EndDrag() ueberlagert werden.
+Bei der Methode StartDrag() besteht die Moeglichkeit durch das zurueckgeben
+von FALSE das Draggen zu verhindern. Im Drag-Handler muss die Drag-Position
+abgefragt werden und die Werte muessen an die neue Position verschoben werden.
+Dazu ruft man einfach die einzelnen Set-Methoden auf. Solange man sich
+im Drag-Handler befindet, werden sich die Werte nur gemerkt und erst
+danach das Lineal neu ausgegeben. Alle Handler koennen auch als Links ueber
+entsprechende Set..Hdl()-Methoden gesetzt werden.
+
+ - StartDrag()
+ Wird gerufen, wenn das Draggen gestartet wird. Wenn FALSE
+ zurueckgegeben wird, wird das Draggen nicht ausgefuehrt. Bei TRUE
+ wird das Draggen zugelassen. Wenn der Handler nicht ueberlagert
+ wird, wird FALSE zurueckgegeben.
+
+ - EndDrag()
+ Wird gerufen, wenn das Draggen beendet wird.
+
+ - Drag()
+ Wird gerufen, wenn gedragt wird.
+
+ - Click()
+ Dieser Handler wird gerufen, wenn kein Element angeklickt wurde.
+ Die Position kann mit GetClickPos() abgefragt werden. Dadurch
+ kann man zum Beispiel Tabs in das Lineal setzen. Nach Aufruf des
+ Click-Handlers wird gegebenenfalls das Drag sofort ausgeloest. Dadurch
+ ist es moeglich, einen neuen Tab im Click-Handler zu setzen und
+ danach gleich zu verschieben.
+
+ - DoubleClick()
+ Dieser Handler wird gerufen, wenn ein DoubleClick ausserhalb des
+ Extrafeldes gemacht wurde. Was angeklickt wurde, kann mit
+ GetClickType(), GetClickAryPos() und GetClickPos() abgefragt werden.
+ Somit kann man zum Beispiel den Tab-Dialog anzeigen, wenn ein
+ Tab mit einem DoubleClick betaetigt wurde.
+
+Im Drag-Handler kann man abfragen, was und wohin gedragt wurde. Dazu gibt
+es folgende Abfrage-Methoden.
+
+ - GetDragType()
+ Liefert zurueck, was gedragt wird:
+ RULER_TYPE_MARGIN1
+ RULER_TYPE_MARGIN2
+ RULER_TYPE_BORDER
+ RULER_TYPE_INDENT
+ RULER_TYPE_TAB
+
+ - GetDragPos()
+ Liefert die Pixel-Position bezogen auf den eingestellten Null-Offset
+ zurueck, wohin der Anwender die Maus bewegt hat.
+
+ - GetDragAryPos()
+ Liefert den Index im Array zurueck, wenn ein Border, Indent oder ein
+ Tab gedragt wird. Achtung: Es wird die Array-Position waehrend des
+ gesammten Drag-Vorgangs von dem Item im Array was vor dem Drag gesetzt
+ war zurueckgeben. Dadurch ist es zum Beispiel auch moeglich, einen
+ Tab nicht mehr anzuzeigen, wenn die Maus nach unten/rechts aus dem
+ Lineal gezogen wird.
+
+ - GetDragSize()
+ Wenn Borders gedragt werden, kann hierueber abgefragt werden, ob
+ die Groesse bzw. welche Seite oder die Position geaendert werden soll.
+ RULER_DRAGSIZE_MOVE oder 0 - Move
+ RULER_DRAGSIZE_1 - Linke/obere Kante
+ RULER_DRAGSIZE_2 - Rechte/untere Kante
+
+ - IsDragDelete()
+ Mit dieser Methode kann abgefragt werden, ob beim Draggen die
+ Maus unten/rechts aus dem Fenster gezogen wurde. Damit kann
+ zum Beispiel festgestellt werden, ob der Benutzer einen Tab
+ loeschen will.
+
+ - IsDragCanceled()
+ Mit dieser Methode kann im EndDrag-Handler abgefragt werden,
+ ob die Aktion abgebrochen wurde, indem der Anwender die
+ Maus oben/links vom Fenster losgelassen hat oder ESC gedrueckt
+ hat. In diesem Fall werden die Werte nicht uebernommen. Wird
+ waehrend des Draggings die Maus oben/links aus dem Fenster
+ gezogen, werden automatisch die alten Werte dargestellt, ohne das
+ der Drag-Handler gerufen wird.
+ Falls der Benutzer jedoch den Wert auf die alte Position
+ zurueckgeschoben hat, liefert die Methode trotzdem FALSE. Falls
+ dies vermieden werden soll, muss sich die Applikation im StartDrag-
+ Handler den alten Wert merken und im EndDrag-Handler den Wert
+ vergleichen.
+
+ - GetDragScroll()
+ Mit dieser Methode kann abgefragt werden, ob gescrollt werden
+ soll. Es wird einer der folgenden Werte zurueckgegeben:
+ RULER_SCROLL_NO - Drag-Position befindet sich
+ an keinem Rand und somit
+ muss nicht gescrollt werden.
+ RULER_SCROLL_1 - Drag-Position befindet sich
+ am linken/oberen Rand und
+ somit sollte das Programm evt.
+ ein Srcoll ausloesen.
+ RULER_SCROLL_2 - Drag-Position befindet sich
+ am rechten/unteren Rand und
+ somit sollte das Programm evt.
+ ein Srcoll ausloesen.
+
+ - GetDragModifier()
+ Liefert die Modifier-Tasten zurueck, die beim Starten des Drag-
+ Vorgangs gedrueckt waren. Siehe MouseEvent.
+
+ - GetClickPos()
+ Liefert die Pixel-Position bezogen auf den eingestellten Null-Offset
+ zurueck, wo der Anwender die Maus gedrueckt hat.
+
+ - GetClickType()
+ Liefert zurueck, was per DoubleClick betaetigt wird:
+ RULER_TYPE_DONTKNOW (kein Element im Linealbereich)
+ RULER_TYPE_OUTSIDE (ausserhalb des Linealbereichs)
+ RULER_TYPE_MARGIN1 (nur Margin1-Kante)
+ RULER_TYPE_MARGIN2 (nur Margin2-Kante)
+ RULER_TYPE_BORDER (Border: GetClickAryPos())
+ RULER_TYPE_INDENT (Einzug: GetClickAryPos())
+ RULER_TYPE_TAB (Tab: GetClickAryPos())
+
+ - GetClickAryPos()
+ Liefert den Index im Array zurueck, wenn ein Border, Indent oder ein
+ Tab per DoubleClick betaetigt wird.
+
+ - GetType()
+ Mit dieser Methode kann man einen HitTest durchfuehren, um
+ gegebenenfalls ueber das Abfangen des MouseButtonDown-Handlers
+ auch ueber die rechte Maustaste etwas auf ein Item anzuwenden. Als
+ Paramter ueber gibt man die Fensterposition und gegebenenfalls
+ einen Pointer auf einen USHORT, um die Array-Position eines
+ Tabs, Indent oder Borders mitzubekommen. Als Type werden folgende
+ Werte zurueckgegeben:
+ RULER_TYPE_DONTKNOW (kein Element im Linealbereich)
+ RULER_TYPE_OUTSIDE (ausserhalb des Linealbereichs)
+ RULER_TYPE_MARGIN1 (nur Margin1-Kante)
+ RULER_TYPE_MARGIN2 (nur Margin2-Kante)
+ RULER_TYPE_BORDER (Border: GetClickAryPos())
+ RULER_TYPE_INDENT (Einzug: GetClickAryPos())
+ RULER_TYPE_TAB (Tab: GetClickAryPos())
+
+Wenn der Drag-Vorgang abgebrochen werden soll, kann der Drag-Vorgang
+mit CancelDrag() abgebrochen werden. Folgende Methoden gibt es fuer die
+Drag-Steuerung:
+
+ - IsDrag()
+ Liefert TRUE zurueck, wenn sich das Lineal im Drag-Vorgang befindet.
+
+ - CancelDrag()
+ Bricht den Drag-Vorgang ab, falls einer durchgefuehrt wird. Dabei
+ werden die alten Werte wieder hergestellt und der Drag und der
+ EndDrag-Handler gerufen.
+
+Um vom Dokument ein Drag auszuloesen, gibt es folgende Methoden:
+
+ - StartDocDrag()
+ Dieser Methode werden der MouseEvent vom Dokumentfenster und
+ was gedragt werden soll uebergeben. Wenn als DragType
+ RULER_TYPE_DONTKNOW uebergeben wird, bestimmt das Lineal, was
+ verschoben werden soll. Bei den anderen, wird der Drag nur dann
+ gestartet, wenn auch an der uebergebenen Position ein entsprechendes
+ Element gefunden wurde. Dies ist zun Beispiel dann notwendig, wenn
+ zum Beispiel Einzuege und Spalten an der gleichen X-Position liegen.
+ Der Rueckgabewert gibt an, ob der Drag ausgeloest wurde. Wenn ein
+ Drag ausgeloest wird, uebernimmt das Lineal die normale Drag-Steuerung
+ und verhaelt sich dann so, wie als wenn direkt in das Lineal geklickt
+ wurde. So captured das Lineal die Mouse und uebernimmt auch die
+ Steuerung des Cancel (ueber Tastatur, oder wenn die Mouse ueber
+ oder links vom Lineal ruasgeschoben wird). Auch alle Handler werden
+ gerufen (inkl. des StartDrag-Handlers). Wenn ein MouseEvent mit
+ Click-Count 2 uebergeben wird auch der DoubleClick-Handler
+ entsprechend gerufen.
+
+ - GetDocType()
+ Dieser Methode wird die Position vom Dokumentfenster uebergeben und
+ testet, was sich unter der Position befindet. Dabei kann wie bei
+ StartDocDrag() der entsprechende Test auf ein bestimmtes Element
+ eingeschraenkt werden. Im Gegensatz zu GetType() liefert diese
+ Methode immer DontKnow zurueck, falls kein Element getroffen wurde.
+ Falls man den HitTest selber durchfuehren moechte, kann man
+ folgende Defines fuer die Toleranz benutzen (Werte gelten fuer
+ eine Richtung):
+ RULER_MOUSE_TABLEWIDTH - fuer Tabellenspalten
+ RULER_MOUSE_MARGINWIDTH - fuer Margins
+
+--------------------------------------------------------------------------
+
+Fuer das Extra-Feld kann der Inhalt bestimmt werden und es gibt Handler,
+womit man bestimmte Aktionen abfangen kann.
+
+ - ExtraDown()
+ Dieser Handler wird gerufen, wenn im Extra-Feld die Maus
+ gedrueckt wird.
+
+ - SetExtraType()
+ Mit dieser Methode kann festgelegt werden, was im ExtraFeld
+ dargestellt werden soll.
+ - ExtraType Was im Extrafeld dargestellt werden soll
+ RULER_EXTRA_DONTKNOW (Nichts)
+ RULER_EXTRA_NULLOFFSET (Koordinaaten-Kreuz)
+ RULER_EXTRA_TAB (Tab)
+ - USHORT nStyle Bitfeld als Style:
+ RULER_STYLE_HIGHLIGHT (selektiert)
+ RULER_TAB_... (ein Tab-Style)
+
+ - GetExtraClick()
+ Liefert die Anzahl der Mausclicks zurueck. Dadurch ist es zum
+ Beispiel auch moeglich, auch durch einen DoubleClick im Extrafeld
+ eine Aktion auszuloesen.
+
+ - GetExtraModifier()
+ Liefert die Modifier-Tasten zurueck, die beim Klicken in das Extra-
+ Feld gedrueckt waren. Siehe MouseEvent.
+
+--------------------------------------------------------------------------
+
+Weitere Hilfsfunktionen:
+
+- static Ruler::DrawTab()
+ Mit dieser Methode kann ein Tab auf einem OutputDevice ausgegeben
+ werden. Dadurch ist es moeglich, auch in Dialogen die Tabs so
+ anzuzeigen, wie Sie im Lineal gemalt werden.
+
+ Diese Methode gibt den Tab zentriert an der uebergebenen Position
+ aus. Die Groesse der Tabs kann ueber die Defines RULER_TAB_WIDTH und
+ RULER_TAB_HEIGHT bestimmt werden.
+
+--------------------------------------------------------------------------
+
+Tips zur Benutzung des Lineals:
+
+- Bei dem Lineal muss weder im Drag-Modus noch sonst das Setzen der Werte
+ in SetUpdateMode() geklammert werden. Denn das Lineal sorgt von sich
+ aus dafuer, das wenn mehrere Werte gesetzt werden, diese automatisch
+ zusammengefast werden und flackerfrei ausgegeben werden.
+
+- Initial sollten beim Lineal zuerst die Groessen, Positionen und Werte
+ gesetzt werden, bevor es angezeigt wird. Dies ist deshalb wichtig, da
+ ansonsten viele Werte unnoetig berechnet werden.
+
+- Wenn das Dokumentfenster, in dem sich das Lineal befindet aktiv bzw.
+ deaktiv wird, sollten die Methoden Activate() und Deactivate() vom
+ Lineal gerufen werden. Denn je nach Einstellungen und System wird die
+ Anzeige entsprechend umgeschaltet.
+
+- Zum Beispiel sollte beim Drag von Tabs und Einzuegen nach Moeglichkeit die
+ alten Positionen noch mit angezeigt werden. Dazu sollte zusaetzlich beim
+ Setzen der Tabs und Einzuege als erstes im Array die alten Positionen
+ eingetragen werden und mit dem Style RULER_STYLE_DONTKNOW verknuepft
+ werden. Danach sollte im Array die restlichen Werte eingetragen werden.
+
+- Bei mehreren markierten Absaetzen und Tabellen-Zellen, sollten die Tabs
+ und Einzuege in grau von der ersten Zelle, bzw. vom ersten Absatz
+ angezeigt werden. Dies kann man auch ueber den Style RULER_STYLE_DONTKNOW
+ erreichen.
+
+- Die Bemassungspfeile sollten immer dann angezeigt, wenn beim Drag die
+ Alt-Taste (WW-Like) gedrueckt wird. Vielleicht sollte diese Einstellung
+ auch immer vornehmbar sein und vielleicht beim Drag immer die
+ Bemassungspfeile dargestellt werden. Bei allen Einstellung sollten die
+ Werte immer auf ein vielfaches eines Wertes gerundet werden, da die
+ Bildschirmausloesung sehr ungenau ist.
+
+- DoppelKlicks sollten folgendermassen behandelt werden (GetClickType()):
+ - RULER_TYPE_DONTKNOW
+ RULER_TYPE_MARGIN1
+ RULER_TYPE_MARGIN2
+ Wenn die Bedingunden GetClickPos() <= GetMargin1() oder
+ GetClickPos() >= GetMargin2() oder der Type gleich
+ RULER_TYPE_MARGIN1 oder RULER_TYPE_MARGIN2 ist, sollte
+ ein SeitenDialog angezeigt werden, wo der Focus auf dem
+ entsprechenden Rand steht
+ - RULER_TYPE_BORDER
+ Es sollte ein Spalten- oder Tabellen-Dialog angezeigt werden,
+ wo der Focus auf der entsprechenden Spalte steht, die mit
+ GetClickAryPos() abgefragt werden kann.
+ - RULER_TYPE_INDENT
+ Es sollte der Dialog angezeigt werden, wo die Einzuege eingestellt
+ werden koennen. Dabei sollte der Focus auf dem Einzug stehen, der
+ mit GetClickAryPos() ermittelt werden kann.
+ - RULER_TYPE_TAB
+ Es sollte ein TabDialog angezeigt werden, wo der Tab selektiert
+ sein sollte, der ueber GetClickAryPos() abgefragt werden kann.
+
+*************************************************************************/
+
+// -----------
+// - WinBits -
+// -----------
+
+#define WB_EXTRAFIELD ((WinBits)0x00004000)
+#define WB_STDRULER WB_HORZ
+
+// ---------------
+// - Ruler-Types -
+// ---------------
+
+struct ImplRulerHitTest;
+
+// --------------
+// - Ruler-Type -
+// --------------
+
+enum RulerType { RULER_TYPE_DONTKNOW, RULER_TYPE_OUTSIDE,
+ RULER_TYPE_MARGIN1, RULER_TYPE_MARGIN2,
+ RULER_TYPE_BORDER, RULER_TYPE_INDENT, RULER_TYPE_TAB };
+
+enum RulerExtra { RULER_EXTRA_DONTKNOW,
+ RULER_EXTRA_NULLOFFSET, RULER_EXTRA_TAB };
+
+#define RULER_STYLE_HIGHLIGHT ((USHORT)0x8000)
+#define RULER_STYLE_DONTKNOW ((USHORT)0x4000)
+#define RULER_STYLE_INVISIBLE ((USHORT)0x2000)
+
+#define RULER_DRAGSIZE_MOVE 0
+#define RULER_DRAGSIZE_1 1
+#define RULER_DRAGSIZE_2 2
+
+#define RULER_MOUSE_BORDERMOVE 5
+#define RULER_MOUSE_BORDERWIDTH 5
+#define RULER_MOUSE_TABLEWIDTH 1
+#define RULER_MOUSE_MARGINWIDTH 3
+
+#define RULER_SCROLL_NO 0
+#define RULER_SCROLL_1 1
+#define RULER_SCROLL_2 2
+
+// ---------------
+// - RulerMargin -
+// ---------------
+
+#define RULER_MARGIN_SIZEABLE ((USHORT)0x0001)
+
+// ---------------
+// - RulerBorder -
+// ---------------
+
+#define RULER_BORDER_SIZEABLE ((USHORT)0x0001)
+#define RULER_BORDER_MOVEABLE ((USHORT)0x0002)
+#define RULER_BORDER_VARIABLE ((USHORT)0x0004)
+#define RULER_BORDER_TABLE ((USHORT)0x0008)
+#define RULER_BORDER_SNAP ((USHORT)0x0010)
+
+struct RulerBorder
+{
+ long nPos;
+ long nWidth;
+ USHORT nStyle;
+};
+
+// ---------------
+// - RulerIndent -
+// ---------------
+
+#define RULER_INDENT_TOP ((USHORT)0x0000)
+#define RULER_INDENT_BOTTOM ((USHORT)0x0001)
+#define RULER_INDENT_STYLE ((USHORT)0x000F)
+
+struct RulerIndent
+{
+ long nPos;
+ USHORT nStyle;
+};
+
+// ------------
+// - RulerTab -
+// ------------
+
+#define RULER_TAB_LEFT ((USHORT)0x0000)
+#define RULER_TAB_RIGHT ((USHORT)0x0001)
+#define RULER_TAB_DECIMAL ((USHORT)0x0002)
+#define RULER_TAB_CENTER ((USHORT)0x0003)
+#define RULER_TAB_DEFAULT ((USHORT)0x0004)
+#define RULER_TAB_STYLE ((USHORT)0x000F)
+
+struct RulerTab
+{
+ long nPos;
+ USHORT nStyle;
+};
+
+#define RULER_TAB_WIDTH 7
+#define RULER_TAB_HEIGHT 6
+
+// -------------
+// - RulerLine -
+// -------------
+
+struct RulerLine
+{
+ long nPos;
+ USHORT nStyle;
+};
+
+// --------------
+// - RulerArrow -
+// --------------
+
+struct RulerArrow
+{
+ long nPos;
+ long nWidth;
+ long nLogWidth;
+ USHORT nStyle;
+};
+
+// -----------------
+// - ImplRulerData -
+// -----------------
+
+class ImplRulerData
+{
+ friend class Ruler;
+
+private:
+ RulerLine* pLines;
+ RulerArrow* pArrows;
+ RulerBorder* pBorders;
+ RulerIndent* pIndents;
+ RulerTab* pTabs;
+ long nNullVirOff;
+ long nRulVirOff;
+ long nRulWidth;
+ long nPageOff;
+ long nPageWidth;
+ long nNullOff;
+ long nMargin1;
+ long nMargin2;
+ USHORT nLines;
+ USHORT nArrows;
+ USHORT nBorders;
+ USHORT nIndents;
+ USHORT nTabs;
+ USHORT nMargin1Style;
+ USHORT nMargin2Style;
+ BOOL bAutoPageWidth;
+ BOOL bDummyAlign;
+
+#ifdef _SV_RULER_CXX
+public:
+ ImplRulerData();
+ ~ImplRulerData();
+ ImplRulerData& operator=( const ImplRulerData& rData );
+#endif
+};
+
+// ---------
+// - Ruler -
+// ---------
+
+class Ruler : public Window
+{
+private:
+ VirtualDevice maVirDev;
+ MapMode maMapMode;
+ long mnBorderOff;
+ long mnWinOff;
+ long mnWinWidth;
+ long mnWidth;
+ long mnHeight;
+ long mnVirOff;
+ long mnVirWidth;
+ long mnVirHeight;
+ long mnBorderWidth;
+ long mnStartDragPos;
+ long mnDragPos;
+ ULONG mnUpdateEvtId;
+ ImplRulerData* mpData;
+ ImplRulerData maData;
+ ImplRulerData maDragData;
+ Rectangle maExtraRect;
+ WinBits mnWinStyle;
+ USHORT mnUnitIndex;
+ USHORT mnDragAryPos;
+ USHORT mnDragSize;
+ USHORT mnDragScroll;
+ USHORT mnDragModifier;
+ USHORT mnExtraStyle;
+ USHORT mnExtraClicks;
+ USHORT mnExtraModifier;
+ RulerExtra meExtraType;
+ RulerType meDragType;
+ MapUnit meSourceUnit;
+ FieldUnit meUnit;
+ Fraction maZoom;
+ BOOL mbCalc;
+ BOOL mbFormat;
+ BOOL mbDrag;
+ BOOL mbDragDelete;
+ BOOL mbDragCanceled;
+ BOOL mbAutoWinWidth;
+ BOOL mbActive;
+ BYTE mnUpdateFlags;
+ Link maStartDragHdl;
+ Link maDragHdl;
+ Link maEndDragHdl;
+ Link maClickHdl;
+ Link maDoubleClickHdl;
+ Link maExtraDownHdl;
+
+#ifdef _SV_RULER_CXX
+ void ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 );
+ void ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 );
+ void ImplVDrawText( long nX, long nY, const String& rText );
+
+ void ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter );
+ void ImplDrawArrows( long nCenter );
+ void ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom );
+ void ImplDrawIndent( const Polygon& rPoly, USHORT nStyle );
+ void ImplDrawIndents( long nMin, long nMax, long nVirTop, long nVirBottom );
+ void ImplDrawTab( OutputDevice* pDevice, const Point& rPos, USHORT nStyle );
+ void ImplDrawTabs( long nMin, long nMax, long nVirBottom );
+ void ImplInit( WinBits nWinBits );
+ void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground );
+ void ImplCalc();
+ void ImplFormat();
+ void ImplInitExtraField( BOOL bUpdate );
+ void ImplInvertLines( BOOL bErase = FALSE );
+ void ImplDraw();
+ void ImplDrawExtra( BOOL bPaint = FALSE );
+ void ImplUpdate( BOOL bMustCalc = FALSE );
+ BOOL ImplHitTest( const Point& rPos, ImplRulerHitTest* pHitTest ) const;
+ BOOL ImplDocHitTest( const Point& rPos, RulerType eDragType, ImplRulerHitTest* pHitTest ) const;
+ BOOL ImplStartDrag( ImplRulerHitTest* pHitTest, USHORT nModifier );
+ void ImplDrag( const Point& rPos );
+ void ImplEndDrag();
+ DECL_LINK( ImplUpdateHdl, void* );
+#endif
+
+public:
+ Ruler( Window* pParent, WinBits nWinStyle = WB_STDRULER );
+ virtual ~Ruler();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual long StartDrag();
+ virtual void Drag();
+ virtual void EndDrag();
+ virtual void Click();
+ virtual void DoubleClick();
+ virtual void ExtraDown();
+
+ void Activate();
+ void Deactivate();
+ BOOL IsActive() const { return mbActive; }
+
+ void SetWinPos( long nOff = 0, long nWidth = 0 );
+ long GetWinOffset() const { return mnWinOff; }
+ long GetWinWidth() const { return mnWinWidth; }
+ void SetPagePos( long nOff = 0, long nWidth = 0 );
+ long GetPageOffset() const { return mpData->nPageOff; }
+ long GetPageWidth() const { return mpData->nPageWidth; }
+ void SetBorderPos( long nOff = 0 );
+ long GetBorderOffset() const { return mnBorderOff; }
+ Rectangle GetExtraRect() const { return maExtraRect; }
+
+ void SetUnit( FieldUnit eNewUnit );
+ FieldUnit GetUnit() const { return meUnit; }
+ void SetZoom( const Fraction& rNewZoom );
+ Fraction GetZoom() const { return maZoom; }
+
+ void SetSourceUnit( MapUnit eNewUnit ) { meSourceUnit = eNewUnit; }
+ MapUnit GetSourceUnit() const { return meSourceUnit; }
+
+ void SetExtraType( RulerExtra eNewExtraType, USHORT nStyle = 0 );
+ RulerExtra GetExtraType() const { return meExtraType; }
+ USHORT GetExtraStyle() const { return mnExtraStyle; }
+ USHORT GetExtraClicks() const { return mnExtraClicks; }
+ USHORT GetExtraModifier() const { return mnExtraModifier; }
+
+ BOOL StartDocDrag( const MouseEvent& rMEvt,
+ RulerType eDragType = RULER_TYPE_DONTKNOW );
+ RulerType GetDocType( const Point& rPos,
+ RulerType eDragType = RULER_TYPE_DONTKNOW,
+ USHORT* pAryPos = NULL ) const;
+ RulerType GetDragType() const { return meDragType; }
+ long GetDragPos() const { return mnDragPos; }
+ USHORT GetDragAryPos() const { return mnDragAryPos; }
+ USHORT GetDragSize() const { return mnDragSize; }
+ BOOL IsDragDelete() const { return mbDragDelete; }
+ BOOL IsDragCanceled() const { return mbDragCanceled; }
+ USHORT GetDragScroll() const { return mnDragScroll; }
+ USHORT GetDragModifier() const { return mnDragModifier; }
+ BOOL IsDrag() const { return mbDrag; }
+ void CancelDrag();
+ long GetClickPos() const { return mnDragPos; }
+ RulerType GetClickType() const { return meDragType; }
+ USHORT GetClickAryPos() const { return mnDragAryPos; }
+ RulerType GetType( const Point& rPos,
+ USHORT* pAryPos = NULL ) const;
+
+ void SetNullOffset( long nPos );
+ long GetNullOffset() const { return mpData->nNullOff; }
+ void SetMargin1() { SetMargin1( 0, RULER_STYLE_INVISIBLE ); }
+ void SetMargin1( long nPos, USHORT nMarginStyle = RULER_MARGIN_SIZEABLE );
+ long GetMargin1() const { return mpData->nMargin1; }
+ USHORT GetMargin1Style() const { return mpData->nMargin1Style; }
+ void SetMargin2() { SetMargin2( 0, RULER_STYLE_INVISIBLE ); }
+ void SetMargin2( long nPos, USHORT nMarginStyle = RULER_MARGIN_SIZEABLE );
+ long GetMargin2() const { return mpData->nMargin2; }
+ USHORT GetMargin2Style() const { return mpData->nMargin2Style; }
+
+ void SetLines( USHORT n = 0, const RulerLine* pLineAry = NULL );
+ USHORT GetLineCount() const { return mpData->nLines; }
+ const RulerLine* GetLines() const { return mpData->pLines; }
+
+ void SetArrows( USHORT n = 0, const RulerArrow* pArrowAry = NULL );
+ USHORT GetArrowCount() const { return mpData->nArrows; }
+ const RulerArrow* GetArrows() const { return mpData->pArrows; }
+
+ void SetBorders( USHORT n = 0, const RulerBorder* pBrdAry = NULL );
+ USHORT GetBorderCount() const { return mpData->nBorders; }
+ const RulerBorder* GetBorders() const { return mpData->pBorders; }
+
+ void SetIndents( USHORT n = 0, const RulerIndent* pIndentAry = NULL );
+ USHORT GetIndentCount() const { return mpData->nIndents; }
+ const RulerIndent* GetIndents() const { return mpData->pIndents; }
+
+ void SetTabs( USHORT n = 0, const RulerTab* pTabAry = NULL );
+ USHORT GetTabCount() const { return mpData->nTabs; }
+ const RulerTab* GetTabs() const { return mpData->pTabs; }
+
+ static void DrawTab( OutputDevice* pDevice,
+ const Point& rPos, USHORT nStyle );
+
+ void SetStyle( WinBits nStyle );
+ WinBits GetStyle() const { return mnWinStyle; }
+
+ void SetStartDragHdl( const Link& rLink ) { maStartDragHdl = rLink; }
+ const Link& GetStartDragHdl() const { return maStartDragHdl; }
+ void SetDragHdl( const Link& rLink ) { maDragHdl = rLink; }
+ const Link& GetDragHdl() const { return maDragHdl; }
+ void SetEndDragHdl( const Link& rLink ) { maEndDragHdl = rLink; }
+ const Link& GetEndDragHdl() const { return maEndDragHdl; }
+ void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
+ const Link& GetClickHdl() const { return maClickHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetExtraDownHdl( const Link& rLink ) { maExtraDownHdl = rLink; }
+ const Link& GetExtraDownHdl() const { return maExtraDownHdl; }
+};
+
+#endif // _RULER_HXX
diff --git a/svtools/inc/scrwin.hxx b/svtools/inc/scrwin.hxx
new file mode 100644
index 000000000000..71d81477c58b
--- /dev/null
+++ b/svtools/inc/scrwin.hxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * $RCSfile: scrwin.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SCRWIN_HXX
+#define _SCRWIN_HXX
+
+#ifndef _SCRBAR_HXX //autogen
+#include <vcl/scrbar.hxx>
+#endif
+
+class DataChangedEvent;
+
+// -------------------------
+// - ScrollableWindow-Type -
+// -------------------------
+
+typedef USHORT ScrollableWindowFlags;
+
+#define SCRWIN_THUMBDRAGGING 1
+#define SCRWIN_VCENTER 2
+#define SCRWIN_HCENTER 4
+#define SCRWIN_DEFAULT (SCRWIN_THUMBDRAGGING | SCRWIN_VCENTER | SCRWIN_HCENTER)
+
+// --------------------
+// - ScrollableWindow -
+// --------------------
+
+class ScrollableWindow: public Window
+{
+private:
+ Point aPixOffset; // offset to virtual window (pixel)
+ Size aTotPixSz; // total size of virtual window (pixel)
+ long nLinePixH; // size of a line/column (pixel)
+ long nColumnPixW;
+
+ ScrollBar aVScroll; // the scrollbars
+ ScrollBar aHScroll;
+ ScrollBarBox aCornerWin; // window in the bottom right corner
+ BOOL bScrolling:1, // user controlled scrolling
+ bHandleDragging:1, // scroll window while dragging
+ bHCenter:1,
+ bVCenter:1;
+
+#ifdef _SVT_SCRWIN_CXX
+ void ImpInitialize( ScrollableWindowFlags nFlags );
+ DECL_LINK( ScrollHdl, ScrollBar * );
+ DECL_LINK( EndScrollHdl, ScrollBar * );
+#endif
+
+public:
+ ScrollableWindow( Window* pParent, WinBits nBits = 0,
+ ScrollableWindowFlags = SCRWIN_DEFAULT );
+ ScrollableWindow( Window* pParent, const ResId& rId,
+ ScrollableWindowFlags = SCRWIN_DEFAULT );
+
+ virtual void Resize();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& rDEvt );
+
+ virtual void StartScroll();
+ virtual void EndScroll( long nDeltaX, long nDeltaY );
+
+ void SetMapMode( const MapMode& rNewMapMode );
+ MapMode GetMapMode() const;
+
+ void SetTotalSize( const Size& rNewSize );
+ Size GetTotalSize() { return PixelToLogic( aTotPixSz ); }
+
+ void SetVisibleSize( const Size& rNewSize );
+ BOOL MakeVisible( const Rectangle& rTarget, BOOL bSloppy = FALSE );
+ Rectangle GetVisibleArea() const;
+
+ void SetLineSize( ULONG nHorz, ULONG nVert );
+ void Scroll( long nDeltaX, long nDeltaY );
+ void Scroll( long nDeltaX, long nDeltaY,
+ const Rectangle& rRect );
+ void ScrollLines( long nLinesX, long nLinesY );
+ void ScrollPages( long nPagesX, ULONG nOverlapX,
+ long nPagesY, ULONG nOverlapY );
+
+private:
+ void SetOutputSizePixel( const Size& rSize );
+ Size GetOutputSizePixel() const;
+ Size GetOutputSize() const;
+};
+
+#endif
diff --git a/svtools/inc/sectctr.hxx b/svtools/inc/sectctr.hxx
new file mode 100644
index 000000000000..8fb4de3653c8
--- /dev/null
+++ b/svtools/inc/sectctr.hxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: sectctr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SECTCTR_HXX
+#define _SV_SECTCTR_HXX
+
+#ifndef _SV_SV_H
+#include <vcl/sv.h>
+#endif
+#ifndef _SV_CTRL_HXX
+#include <vcl/ctrl.hxx>
+#endif
+
+class ImplSplitWindow;
+class ScrollBar;
+class ScrollBarBox;
+class SvSection;
+
+#define SECTION_APPEND ((USHORT)0xFFFF)
+#define SECTION_NOTFOUND ((USHORT)0xFFFF)
+
+#define WB_SECTION_STYLE WB_VSCROLL | WB_HSCROLL | WB_TABSTOP
+
+class SvSectionControl : public Control
+{
+private:
+
+ Window aSplitWinContainer;
+ ImplSplitWindow* pSplitWin;
+ ScrollBar* pVScrollBar;
+ ScrollBar* pHScrollBar;
+ ScrollBarBox* pScrollBarBox;
+ DockingWindow* pDummy;
+ long nRealHeight;
+ long nMaxHeight;
+ long nMinWidth;
+ Wallpaper aWallpaper;
+
+ DECL_LINK( ScrollHdl, ScrollBar* );
+ DECL_LINK( EndScrollHdl, ScrollBar* );
+
+
+protected:
+
+ virtual void Resize();
+ virtual void Paint( const Rectangle& rRect );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual long Notify( NotifyEvent& rNEvt );
+ virtual long KeyEventNotify( const KeyEvent& rKEvt );
+ virtual void SetPosSizePixel( long nX, long nY,long nWidth, long nHeight,USHORT nFlags);
+
+
+
+ long CalcMaxHeight();
+ long CalcRealHeight();
+ long CalcSectionWidth();
+
+ void SetScrollBars(BOOL bVert,BOOL bHorz);
+ void ShowScrollBarBox();
+ void UpdateScrollBars();
+
+ BOOL VScrollResize(Size &aSize);
+ BOOL HScrollResize(Size &aSize);
+ void SetChildPos(long nPos, BOOL bScrolling = TRUE);
+
+public:
+ SvSectionControl( Window* pParent,WinBits nStyle = WB_SECTION_STYLE);
+ SvSectionControl( Window* pParent, const ResId& rResId );
+ ~SvSectionControl();
+
+
+ void InsertSection( USHORT nSectionId,SvSection* pSection,long nSize,USHORT nPos);
+ void InsertSection( USHORT nSectionId,SvSection* pSection,USHORT nPos);
+ void RemoveSection( USHORT nSectionId );
+ void Clear();
+
+ USHORT GetSectionCount() const;
+ USHORT GetSectionId( USHORT nPos ) const;
+ USHORT GetSectionPos( USHORT nSectionId ) const;
+ USHORT GetSectionId( const Point& rPos ) const;
+
+ void SetSectionSize( USHORT nId, long nNewSize );
+ long GetSectionSize( USHORT nId ) const;
+
+ /*
+ void SetCurSectionId( USHORT nSectionId );
+ USHORT GetCurSectionId() const;
+
+ void SetFirstSectionId( USHORT nSectionId );
+ USHORT GetFirstSectionId() const { return GetSectionId( mnFirstSectionPos ); }
+
+ void MakeVisible( USHORT nSectionId );
+ */
+
+ void SetSectionWidth( USHORT nSectionId, long nWidth);
+ long GetSectionWidth( USHORT nSectionId ) const;
+
+ void SetSection( USHORT nSectionId, SvSection* pPage );
+ SvSection* GetSection( USHORT nSectionId ) const;
+
+ void SetSectionText( USHORT nSectionId, const XubString& rText );
+ XubString GetSectionText( USHORT nSectionId ) const;
+
+ void SetHelpText( USHORT nSectionId, const XubString& rText );
+ const XubString& GetHelpText( USHORT nSectionId ) const;
+
+ void SetHelpId( USHORT nSectionId, ULONG nHelpId );
+ ULONG GetHelpId( USHORT nSectionId ) const;
+
+ void SetHelpText( const XubString& rText )
+ { Control::SetHelpText( rText ); }
+ const XubString& GetHelpText() const
+ { return Control::GetHelpText(); }
+
+ void SetHelpId( ULONG nId )
+ { Control::SetHelpId( nId ); }
+ ULONG GetHelpId() const
+ { return Control::GetHelpId(); }
+
+ void SetBackground( const Wallpaper& rBackground ){aWallpaper=rBackground; }
+ const Wallpaper& GetBackground() const { return aWallpaper; }
+
+};
+
+
+#endif
diff --git a/svtools/inc/sfxecode.hxx b/svtools/inc/sfxecode.hxx
new file mode 100644
index 000000000000..a5ce6d561ba4
--- /dev/null
+++ b/svtools/inc/sfxecode.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * $RCSfile: sfxecode.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SFXECODE_HXX
+#define _SFXECODE_HXX
+
+#include <tools/errcode.hxx>
+
+#define ERRCODE_SFX_NOSTDTEMPLATE (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|1)
+#define ERRCODE_SFX_NOTATEMPLATE (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|2)
+#define ERRCODE_SFX_GENERAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|3)
+#define ERRCODE_SFX_DOLOADFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|4)
+#define ERRCODE_SFX_DOSAVECOMPLETEDFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|5)
+#define ERRCODE_SFX_COMMITFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|6)
+#define ERRCODE_SFX_HANDSOFFFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|7)
+#define ERRCODE_SFX_DOINITNEWFAILED (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|8)
+#define ERRCODE_SFX_CANTREADDOCINFO (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|9)
+#define ERRCODE_SFX_ALREADYOPEN (ERRCODE_AREA_SFX|ERRCODE_CLASS_ALREADYEXISTS|10)
+#define ERRCODE_SFX_WRONGPASSWORD (ERRCODE_AREA_SFX|ERRCODE_CLASS_READ|11)
+#define ERRCODE_SFX_DOCUMENTREADONLY (ERRCODE_AREA_SFX|ERRCODE_CLASS_WRITE|12)
+#define ERRCODE_SFX_OLEGENERAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|14)
+#define ERRCODE_SFXMSG_STYLEREPLACE (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|13)
+#define ERRCODE_SFX_TEMPLATENOTFOUND (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|15)
+#define ERRCODE_SFX_ISRELATIVE (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|16)
+#define ERRCODE_SFX_FORCEDOCLOAD (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|17)
+
+#define ERRCODE_SFX_NOFILTER (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|45)
+#define ERRCODE_SFX_FORCEQUIET (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|47)
+#define ERRCODE_SFX_CONSULTUSER (ERRCODE_WARNING_MASK|ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|48)
+#define ERRCODE_SFX_NEVERCHECKCONTENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|49)
+
+#define ERRCODE_SFX_NODOCRELOAD (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|18)
+#define ERRCODE_SFX_CANTFINDORIGINAL (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|19)
+#define ERRCODE_SFX_RESTART (ERRCODE_AREA_SFX|ERRCODE_CLASS_GENERAL|20)
+#define ERRCODE_SFX_CANTCREATECONTENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|21)
+#define ERRCODE_SFX_CANTCREATELINK (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|22)
+#define ERRCODE_SFX_WRONGBMKFORMAT (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|23)
+#define ERRCODE_SFX_WRONGICONFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|24)
+#define ERRCODE_SFX_CANTDELICONFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|25)
+#define ERRCODE_SFX_CANTWRITEICONFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|26)
+#define ERRCODE_SFX_CANTRENAMECONTENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|27)
+#define ERRCODE_SFX_INVALIDBMKPATH (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|28)
+#define ERRCODE_SFX_CANTWRITEURLCFGFILE (ERRCODE_AREA_SFX|ERRCODE_CLASS_ACCESS|29)
+#define ERRCODE_SFX_WRONGURLCFGFORMAT (ERRCODE_AREA_SFX|ERRCODE_CLASS_FORMAT|30)
+#define ERRCODE_SFX_NODOCUMENT (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|31)
+#define ERRCODE_SFX_INVALIDLINK (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|32)
+#define ERRCODE_SFX_INVALIDTRASHPATH (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|33)
+#define ERRCODE_SFX_NOTRESTORABLE (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|34)
+#define ERRCODE_SFX_NOTRASH (ERRCODE_AREA_SFX|ERRCODE_CLASS_NOTEXISTS|35)
+#define ERRCODE_SFX_INVALIDSYNTAX (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|36)
+#define ERRCODE_SFX_CANTCREATEFOLDER (ERRCODE_AREA_SFX|ERRCODE_CLASS_CREATE|37)
+#define ERRCODE_SFX_CANTRENAMEFOLDER (ERRCODE_AREA_SFX|ERRCODE_CLASS_PATH|38)
+#define ERRCODE_SFX_WRONG_CDF_FORMAT (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 39)
+#define ERRCODE_SFX_EMPTY_SERVER (ERRCODE_AREA_SFX|ERRCODE_CLASS_NONE|40)
+#define ERRCODE_SFX_NO_ABOBOX (ERRCODE_AREA_SFX| ERRCODE_CLASS_READ | 41)
+
+//Dies und das
+#define ERRCTX_ERROR 21
+#define ERRCTX_WARNING 22
+
+//Documentkontexte
+#define ERRCTX_SFX_LOADTEMPLATE 1
+#define ERRCTX_SFX_SAVEDOC 2
+#define ERRCTX_SFX_SAVEASDOC 3
+#define ERRCTX_SFX_DOCINFO 4
+#define ERRCTX_SFX_DOCTEMPLATE 5
+#define ERRCTX_SFX_MOVEORCOPYCONTENTS 6
+
+//Appkontexte
+#define ERRCTX_SFX_DOCMANAGER 50
+#define ERRCTX_SFX_OPENDOC 51
+#define ERRCTX_SFX_NEWDOCDIRECT 52
+#define ERRCTX_SFX_NEWDOC 53
+
+//Organizerkontexte
+#define ERRCTX_SFX_CREATEOBJSH 70
+
+//BASIC-Kontexte
+#define ERRCTX_SFX_LOADBASIC 80
+
+//Addressbook contexts
+#define ERRCTX_SFX_SEARCHADDRESS 90
+
+#endif // #ifndef _SFXECODE_HXX
+
+
diff --git a/svtools/inc/sgfbram.hxx b/svtools/inc/sgfbram.hxx
new file mode 100644
index 000000000000..5738afad5657
--- /dev/null
+++ b/svtools/inc/sgfbram.hxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgfbram.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SGFBRAM_HXX
+#define _SGFBRAM_HXX
+
+// die folgenden Zeilen k”nnen raus, sobald das auch im WNT-Update verfgbar ist:
+#if defined(WNT)
+typedef void INT64;
+typedef void UINT64;
+typedef long INT32;
+typedef unsigned long UINT32;
+typedef short INT16;
+typedef unsigned short UINT16;
+typedef char INT8;
+typedef unsigned char UINT8;
+#endif
+
+#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 fr 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 fr Linien verwenden Ä¿ */
+#define SgfVectGray 5 /* Graustufen fr Linien verwenden ³ Nur fr */
+#define SgfVectWdth 6 /* Strichst„rken fr 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/inc/sgffilt.hxx b/svtools/inc/sgffilt.hxx
new file mode 100644
index 000000000000..d4bb173519d1
--- /dev/null
+++ b/svtools/inc/sgffilt.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgffilt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SGFFILT_HXX
+#define _SGFFILT_HXX
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+
+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, const INetURLObject& rFltPath, const INetURLObject& rCfgPath);
+
+// Konstanten fr 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/inc/sgvmain.hxx b/svtools/inc/sgvmain.hxx
new file mode 100644
index 000000000000..d9451f4c46a2
--- /dev/null
+++ b/svtools/inc/sgvmain.hxx
@@ -0,0 +1,391 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgvmain.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SGVMAIN_HXX
+#define _SGVMAIN_HXX
+
+#ifdef VCL
+#include <vcl/font.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+#else // VCL
+#include <svgen.hxx>
+#endif
+
+
+#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);
+};
+
+#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
+ INetURLObject aCfgPath; // Für GraphicFilter
+ friend SvStream& operator>>(SvStream& rIStream, BmapType& rBmap);
+ virtual void Draw(OutputDevice& rOut);
+ void SetPaths(const INetURLObject rFltPath, const INetURLObject rCfgPath);
+};
+
+
+#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/inc/sgvspln.hxx b/svtools/inc/sgvspln.hxx
new file mode 100644
index 000000000000..81282c0b008c
--- /dev/null
+++ b/svtools/inc/sgvspln.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgvspln.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SGVSPLN_HXX
+#define _SGVSPLN_HXX
+
+/*************************************************************************
+|*
+|* CalcSpline()
+|*
+|* Beschreibung Berechnet die Koeffizienten eines parametrischen
+|* natrlichen oder periodischen kubischen
+|* Polynomsplines. Die Eckpunkte des šbergebenen
+|* Polygons werden als Sttzstellen angenommen.
+|* n liefert die Anzahl der Teilpolynome.
+|* Ist die Berechnung fehlerfrei verlaufen, so
+|* liefert die Funktion TRUE. Nur in diesem Fall
+|* ist Speicher fr 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 (natrlich 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 Koordinatenberl„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/inc/stdmenu.hxx b/svtools/inc/stdmenu.hxx
new file mode 100644
index 000000000000..8ba0f7dd0669
--- /dev/null
+++ b/svtools/inc/stdmenu.hxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdmenu.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STDMENU_HXX
+#define _STDMENU_HXX
+
+#ifndef _LINK_HXX
+#include <tools/link.hxx>
+#endif
+#ifndef _INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef _MENU_HXX
+#include <vcl/menu.hxx>
+#endif
+
+class FontList;
+class FontInfo;
+
+/*************************************************************************
+
+Beschreibung
+============
+
+class FontNameMenu
+
+Beschreibung
+
+Erlaubt die Auswahl von Fonts. Das Menu wird ueber Fill mit den FontNamen
+gefuellt. Fill sortiert automatisch die FontNamen (inkl. aller Umlaute und
+sprachabhaengig). Mit SetCurName()/GetCurName() kann der aktuelle Fontname
+gesetzt/abgefragt werden. Wenn SetCurName() mit einem leeren String
+aufgerufen wird, wird kein Eintrag als aktueller angezeigt (fuer DontKnow).
+Vor dem Selectaufruf wird der ausgewaehlte Name automatisch als aktueller
+gesetzt und wuerde beim naechsten Aufruf auch als aktueller Name angezeigt
+werden. Deshalb sollte vor PopupMenu::Execute() gegebenenfalls mit
+SetCurName() der aktuelle Fontname gesetzt werden.
+
+Da die Id's und der interne Aufbau des Menus nicht bekannt ist, muss ein
+Select-Handler gesetzt werden, um die Auswahl eines Namens mitzubekommen.
+
+In dieses Menu koennen keine weiteren Items eingefuegt werden.
+
+Spaeter soll auch das Menu die gleichen Bitmaps anzeigen, wie die
+FontNameBox. Auf den Systemen, wo Menues nicht automatisch scrollen,
+wird spaeter wohl ein A-Z Menu ziwschengeschaltet. Da ein Menu bei vielen
+installierten Fonts bisher schon immer lange gebraucht hat, sollte dieses
+Menu schon jetzt nur einmal erzeugt werden (da sonst das Kontextmenu bis
+zu 10-Sekunden fuer die Erzeugung brauchen koennte).
+
+Querverweise
+
+FontList; FontStyleMenu; FontSizeMenu; FontNameBox
+
+--------------------------------------------------------------------------
+
+class FontStyleMenu
+
+Beschreibung
+
+Erlaubt die Auswahl eines FontStyles. Mit Fill wird das FontStyleMenu mit
+den Styles zum uebergebenen Font gefuellt. Nachgebildete Styles werden
+immer mit eingefuegt (kann sich aber noch aendern, da vielleicht
+nicht alle Applikationen [StarDraw,Formel,FontWork] mit Syntetic-Fonts
+umgehen koennen). Mit SetCurStyle()/GetCurStyle() kann der aktuelle Fontstyle
+gesetzt/abgefragt werden. Der Stylename muss mit FontList::GetStyleName()
+ermittelt werden. Wenn SetCurStyle() mit einem leeren String aufgerufen wird,
+wird kein Eintrag als aktueller angezeigt (fuer DontKnow). Vor dem Selectaufruf
+wird der ausgewaehlte Style automatisch als aktueller gesetzt und wuerde beim
+naechsten Aufruf auch als aktueller Style angezeigt werden. Deshalb sollte vor
+PopupMenu::Execute() gegebenenfalls mit SetCurStyle() der aktuelle Style
+gesetzt werden. Da die Styles vom ausgewaehlten Font abhaengen, sollte
+nach einer Aenderung des Fontnamen das Menu mit Fill mit den Styles des
+Fonts neu gefuellt werden.
+
+Mit GetCurStyle() kann der ausgewaehlte Style abgefragt
+werden. Mit Check wird der Style gecheckt/uncheckt, welcher aktiv
+ist. Der Stylename muss mit FontList::GetStyleName() ermittelt werden. Vor
+dem Selectaufruf wird der ausgewaehlte Style automatisch gecheckt. Mit
+UncheckAllStyles() koennen alle Fontstyles geuncheckt werden (zum Beispiel
+fuer DontKnow).
+
+Da die Id's und der interne Aufbau des Menus nicht bekannt ist, muss ein
+Select-Handler gesetzt werden, um die Auswahl eines Styles mitzubekommen.
+
+An dieses Menu kann ueber MENU_APPEND weitere Items eingefuegt werden.
+Bei Fill werden nur Items entfernt, die die Id zwischen FONTSTYLEMENU_FIRSTID
+und FONTSTYLEMENU_LASTID haben.
+
+Querverweise
+
+FontList; FontNameMenu; FontSizeMenu; FontStyleBox
+
+--------------------------------------------------------------------------
+
+class FontSizeMenu
+
+Beschreibung
+
+Erlaubt die Auswahl von Fontgroessen. Ueber Fill wird das FontSizeMenu
+gefuellt und ueber GetCurHeight() kann die ausgewaehlte Fontgroesse
+abgefragt werden. Mit SetCurHeight()/GetCurHeight() kann die aktuelle
+Fontgroesse gesetzt/abgefragt werden. Wenn SetCurHeight() mit 0 aufgerufen
+wird, wird kein Eintrag als aktueller angezeigt (fuer DontKnow). Vor dem
+Selectaufruf wird die ausgewaehlte Groesse automatisch als aktuelle gesetzt
+und wuerde beim naechsten Aufruf auch als aktuelle Groesse angezeigt werden.
+Deshalb sollte vor PopupMenu::Execute() gegebenenfalls mit SetCurHeight()
+die aktuelle Groesse gesetzt werden. Da die Groessen vom ausgewaehlten Font
+abhaengen, sollte nach einer Aenderung des Fontnamen das Menu mit Fill mit
+den Groessen des Fonts neu gefuellt werden.
+
+Da die Id's und der interne Aufbau des Menus nicht bekannt ist, muss ein
+Select-Handler gesetzt werden, um die Auswahl einer Groesse mitzubekommen.
+
+Alle Groessen werden in 10tel Point angegeben.
+
+In dieses Menu koennen keine weiteren Items eingefuegt werden.
+
+Spaeter soll das Menu je nach System die Groessen anders darstelllen. Zum
+Beispiel koennte der Mac spaeter vielleicht einmal die Groessen als Outline
+darstellen, die als Bitmap-Fonts vorhanden sind.
+
+Querverweise
+
+FontList; FontNameMenu; FontStyleMenu; FontSizeBox
+
+*************************************************************************/
+
+// ----------------
+// - FontNameMenu -
+// ----------------
+
+class FontNameMenu : public PopupMenu
+{
+private:
+ XubString maCurName;
+ Link maSelectHdl;
+ Link maHighlightHdl;
+
+public:
+ FontNameMenu();
+ virtual ~FontNameMenu();
+
+ virtual void Select();
+ virtual void Highlight();
+
+ void Fill( const FontList* pList );
+
+ void SetCurName( const XubString& rName );
+ const XubString& GetCurName() const { return maCurName; }
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
+ const Link& GetHighlightHdl() const { return maHighlightHdl; }
+};
+
+// -----------------
+// - FontStyleMenu -
+// -----------------
+
+#define FONTSTYLEMENU_FIRSTID 62000
+#define FONTSTYLEMENU_LASTID 62999
+
+class FontStyleMenu : public PopupMenu
+{
+private:
+ XubString maCurStyle;
+ Link maSelectHdl;
+ Link maHighlightHdl;
+
+public:
+ FontStyleMenu();
+ virtual ~FontStyleMenu();
+
+ virtual void Select();
+ virtual void Highlight();
+
+ void Fill( const XubString& rName, const FontList* pList );
+ void SetCurStyle( const XubString& rStyle );
+ const XubString& GetCurStyle() const { return maCurStyle; }
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
+ const Link& GetHighlightHdl() const { return maHighlightHdl; }
+};
+
+// ----------------
+// - FontSizeMenu -
+// ----------------
+
+class FontSizeMenu : public PopupMenu
+{
+private:
+ International maIntn;
+ long* mpHeightAry;
+ long mnCurHeight;
+ Link maSelectHdl;
+ Link maHighlightHdl;
+
+public:
+ FontSizeMenu();
+ ~FontSizeMenu();
+
+ virtual void Select();
+ virtual void Highlight();
+
+ void Fill( const FontInfo& rInfo, const FontList* pList );
+
+ void SetCurHeight( long nHeight );
+ long GetCurHeight() const { return mnCurHeight; }
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
+ const Link& GetHighlightHdl() const { return maHighlightHdl; }
+};
+
+#endif // _STDMENU_HXX
diff --git a/svtools/inc/strmadpt.hxx b/svtools/inc/strmadpt.hxx
new file mode 100644
index 000000000000..3e62e569a9f2
--- /dev/null
+++ b/svtools/inc/strmadpt.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * $RCSfile: strmadpt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_STRMADPT_HXX
+#define SVTOOLS_STRMADPT_HXX
+
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_
+#include <com/sun/star/io/XSeekable.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+//============================================================================
+class SvOutputStreamOpenLockBytes: public SvOpenLockBytes
+{
+ com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >
+ m_xOutputStream;
+ sal_uInt32 m_nPosition;
+
+public:
+ TYPEINFO();
+
+ SvOutputStreamOpenLockBytes(
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > &
+ rTheOutputStream):
+ m_xOutputStream(rTheOutputStream), m_nPosition(0) {}
+
+ virtual ErrCode ReadAt(ULONG, void *, ULONG, ULONG *) const;
+
+ virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount,
+ ULONG * pWritten);
+
+ virtual ErrCode Flush() const;
+
+ virtual ErrCode SetSize(ULONG);
+
+ virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const;
+
+ virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount,
+ ULONG * pWritten);
+
+ virtual ULONG Tell() const;
+
+ virtual ULONG Seek(ULONG);
+
+ virtual void Terminate();
+};
+
+//============================================================================
+class SvLockBytesInputStream: public cppu::OWeakObject,
+ public com::sun::star::io::XInputStream,
+ public com::sun::star::io::XSeekable
+{
+ SvLockBytesRef m_xLockBytes;
+ sal_Int64 m_nPosition;
+ bool m_bDone;
+
+public:
+ SvLockBytesInputStream(SvLockBytes * pTheLockBytes):
+ m_xLockBytes(pTheLockBytes), m_nPosition(0), m_bDone(false) {}
+
+ 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(com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL release()
+ throw(com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL
+ readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
+ sal_Int32 nBytesToRead)
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL
+ readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
+ sal_Int32 nMaxBytesToRead)
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL available()
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL closeInput()
+ throw (com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL seek(sal_Int64 nLocation)
+ 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);
+};
+
+#endif // SVTOOLS_STRMADPT_HXX
+
diff --git a/svtools/inc/svimpbox.hxx b/svtools/inc/svimpbox.hxx
new file mode 100644
index 000000000000..18fe97c07dc1
--- /dev/null
+++ b/svtools/inc/svimpbox.hxx
@@ -0,0 +1,362 @@
+/*************************************************************************
+ *
+ * $RCSfile: svimpbox.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVIMPLBOX_HXX
+#define _SVIMPLBOX_HXX
+
+#ifndef _SELENG_HXX
+#include <vcl/seleng.hxx>
+#endif
+
+#ifndef _SCRBAR_HXX
+#include <vcl/scrbar.hxx>
+#endif
+
+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 );
+ ~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;
+
+ // wg. kompat. hier
+ Image aDontKnowNodeBmp;
+ Image aExpNodeBmp, aCollNodeBmp;
+ 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;
+
+ WinBits nWinBits;
+ FASTBOOL bSimpleTravel; // ist TRUE bei SINGLE_SELECTION
+ BOOL bUpdateMode;
+ BOOL bInVScrollHdl;
+ BOOL bAsyncBeginDrag;
+
+//#if defined (MAC) || defined(OV_DEBUG)
+ Timer aEditTimer;
+ DECL_LINK( EditTimerCall, Timer * );
+//#endif
+
+ 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();
+
+public:
+ SvImpLBox( SvTreeListBox* pView, SvLBoxTreeList*, WinBits nWinStyle );
+ ~SvImpLBox();
+
+ void Clear();
+ void SetWindowBits( WinBits nWinStyle );
+ 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 bAdd ) { 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 GetEntryPos( SvLBoxEntry* ) const;
+ void MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop=FALSE );
+
+ void PaintDDCursor( SvLBoxEntry* );
+
+ void SetExpandedNodeBmp( const Image& );
+ void SetCollapsedNodeBmp( const Image& );
+ void SetDontKnowNodeBmp( const Image& rImg ) { aDontKnowNodeBmp = rImg; }
+ const Image& GetExpandedNodeBmp() const { return aExpNodeBmp; }
+ const Image& GetCollapsedNodeBmp() const { return aCollNodeBmp; }
+ const Image& GetDontKnowNodeBmp() const { return aDontKnowNodeBmp; }
+
+ 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 );
+};
+
+inline void SvImpLBox::SetExpandedNodeBmp( const Image& rBmp )
+{
+ aExpNodeBmp = rBmp;
+ SetNodeBmpYOffset( rBmp );
+}
+
+inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rBmp )
+{
+ aCollNodeBmp = rBmp;
+ SetNodeBmpYOffset( rBmp );
+}
+
+inline Point SvImpLBox::GetEntryPos( 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* pTree )
+{
+ EntryInserted( pTree );
+}
+
+
+#endif
+
+
diff --git a/svtools/inc/svimpicn.hxx b/svtools/inc/svimpicn.hxx
new file mode 100644
index 000000000000..6d1ba72ecad8
--- /dev/null
+++ b/svtools/inc/svimpicn.hxx
@@ -0,0 +1,354 @@
+/*************************************************************************
+ *
+ * $RCSfile: svimpicn.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#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( BOOL bVirtSizeGrowedOnly = FALSE);
+ 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 SetEntryPos( 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 );
+
+ 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 GetEntryPos( 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 bInUse, 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 Command( const CommandEvent& rCEvt );
+ 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 CommandEvent& );
+
+ void HideDDIcon();
+ void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
+ void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
+
+ // HACK(damits kompatibel bleibt)
+ SvLBoxEntry* pViewData;
+
+ 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/inc/svipcdef.h b/svtools/inc/svipcdef.h
new file mode 100644
index 000000000000..e12577598b6e
--- /dev/null
+++ b/svtools/inc/svipcdef.h
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * $RCSfile: svipcdef.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVIPCDEF_H
+#define _SVIPCDEF_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined (WNT) || defined (WIN)
+#define CDECL __cdecl
+#elif defined CSET
+#define CDECL _System
+#else
+#define CDECL
+#endif
+
+#if defined WIN
+#define _EXTLIBCALL_ _pascal
+#else
+#define _EXTLIBCALL_ CDECL
+#endif
+
+typedef void (CDECL *IPCCallbackFunc)(void*);
+
+extern void _EXTLIBCALL_ IPCFreeMemory(void*);
+extern short _EXTLIBCALL_ IPCGetStatus(void*);
+extern short _EXTLIBCALL_ IPCInit(void);
+extern void _EXTLIBCALL_ IPCDeInit(void);
+extern void* _EXTLIBCALL_ IPCConnectServer(const char*, IPCCallbackFunc);
+extern void _EXTLIBCALL_ IPCDisconnectServer(void *);
+#ifdef WIN
+extern long CDECL IPCCALLFUNCTION(void *,unsigned long,void *,
+ short,const char *, char, ...);
+#else
+extern long CDECL IPCCallFunction(void *,unsigned long,void *,
+ short,const char *, char, ...);
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/svtools/inc/svtool.h b/svtools/inc/svtool.h
new file mode 100644
index 000000000000..30bf10b7bd0c
--- /dev/null
+++ b/svtools/inc/svtool.h
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * $RCSfile: svtool.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOL_H
+#define _SVTOOL_H
+
+#if defined( W30 ) && defined( _MSC_VER )
+#define SVEXPORT _export
+#else
+#define SVEXPORT
+#endif
+
+#endif // _SVTOOL_H
diff --git a/svtools/inc/sychconv.hxx b/svtools/inc/sychconv.hxx
new file mode 100644
index 000000000000..bb11426ed7ba
--- /dev/null
+++ b/svtools/inc/sychconv.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * $RCSfile: sychconv.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SYCHCONV_HXX
+#define _SYCHCONV_HXX
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _SV_FONT_HXX
+#include <vcl/font.hxx>
+#endif
+
+// ----------------------
+// - CharacterConverter -
+// ----------------------
+
+class OutputDevice;
+
+class SymCharConverter
+{
+public:
+
+ static const BOOL Convert( Font& rFont, UniString& rString, OutputDevice* pDev = NULL );
+};
+
+#endif // _CHARCONV_HXX
diff --git a/svtools/inc/tabbar.hxx b/svtools/inc/tabbar.hxx
new file mode 100644
index 000000000000..a15f597bedd9
--- /dev/null
+++ b/svtools/inc/tabbar.hxx
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabbar.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TABBAR_HXX
+#define _TABBAR_HXX
+
+#ifndef _LINK_HXX
+#include <tools/link.hxx>
+#endif
+#ifndef _WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+
+class MouseEvent;
+class TrackingEvent;
+class DataChangedEvent;
+class ImplTabBarList;
+class ImplTabButton;
+class ImplTabSizer;
+class TabBarEdit;
+
+// -----------------
+// - Dokumentation -
+// -----------------
+
+/*
+
+Erlaubte StyleBits
+------------------
+
+WB_SCROLL - Die Tabs koennen ueber ein Extra-Feld gescrollt werden
+WB_MINSCROLL - Die Tabs koennen ueber 2 zusaetzliche Buttons gescrollt werden
+WB_RANGESELECT - Zusammenhaengende Bereiche koennen selektiert werden
+WB_MULTISELECT - Einzelne Tabs koennen selektiert werden
+WB_BORDER - Oben und unten wird ein Strich gezeichnet
+WB_TOPBORDER - Oben wird ein Border gezeichnet
+WB_3DTAB - Die Tabs und der Border werden in 3D gezeichnet
+WB_DRAG - Vom TabBar wird ein StartDrag-Handler gerufen, wenn
+ Drag and Drop gestartet werden soll. Es wird ausserdem
+ im TabBar mit EnableDrop() Drag and Drop eingeschaltet.
+WB_SIZEABLE - Vom TabBar wird ein Split-Handler gerufen, wenn der Anwender
+ den TabBar in der Breite aendern will
+WB_STDTABBAR - WB_BORDER
+
+Wenn man den TabBar zum Beispiel als Property-Bar benutzen moechte, sollten
+die WinBits WB_TOPBORDER und WB_3DTAB anstatt WB_BORDER gesetzt werden.
+
+
+Erlaubte PageBits
+-----------------
+
+TPB_SPECIAL - Andere Darstellung des TabTextes, zum Beispiel fuer
+ Szenario-Seiten.
+
+
+Handler
+-------
+
+Select - Wird gerufen, wenn eine Tab selektiert oder
+ deselektiert wird
+DoubleClick - Wird gerufen, wenn ein DoubleClick im TabBar ausgeloest
+ wurde. Innerhalb des Handlers liefert GetCurPageId() die
+ angeklickte Tab zurueck oder 0, wenn keine Tab angeklickt
+ wurde
+ActivatePage - Wird gerufen, wenn eine andere Seite aktiviert wird.
+ GetCurPageId() gibt die aktivierte Seite zurueck.
+DeactivatePage - Wird gerufen, wenn eine Seite deaktiviert wird. Wenn
+ eine andere Seite aktiviert werden darf, muss TRUE
+ zurueckgegeben werden, wenn eine andere Seite von
+ der Aktivierung ausgeschlossen werden soll, muss
+ FALSE zurueckgegeben werden. GetCurPageId() gibt die
+ zu deaktivierende Seite zurueck.
+
+
+
+Drag and Drop
+-------------
+
+Fuer Drag and Drop muss das WinBit WB_DRAG gesetzt werden. Ausserdem
+muss der Command-, QueryDrop-Handler und der Drop-Handler ueberlagert
+werden. Dabei muss in den Handlern folgendes implementiert werden:
+
+Command - Wenn in diesem Handler das Dragging gestartet werden
+ soll, muss StartDrag() gerufen werden. Diese Methode
+ selektiert dann den entsprechenden Eintrag oder gibt
+ FALSE zurueck, wenn das Dragging nicht durchgefuhert
+ werden kann.
+
+QueryDrop - Dieser Handler wird von StarView immer dann gerufen, wenn
+ bei einem Drag-Vorgang die Maus ueber das Fenster gezogen
+ wird (siehe dazu auch SV-Doku). In diesem Handler muss
+ festgestellt werden, ob ein Drop moeglich ist. Die
+ Drop-Position kann im TabBar mit ShowDropPos() angezeigt
+ werden. Beim Aufruf muss die Position vom Event uebergeben
+ werden. Wenn sich die Position am linken oder rechten
+ Rand befindet, wird automatisch im TabBar gescrollt.
+ Diese Methode gibt auch die entsprechende Drop-Position
+ zurueck, die auch fuer ein Drop gebraucht wird. Wenn das
+ Fenster beim Drag verlassen wird, kann mit HideDropPos()
+ die DropPosition wieder weggenommen werden. Es ist dadurch
+ auch moeglich, ein von ausserhalb des TabBars ausgeloestes
+ Drag zu verarbeiten.
+
+Drop - Im Drop-Handler muessen dann die Pages verschoben werden,
+ oder die neuen Pages eingefuegt werden. Die entsprechende
+ Drop-Postion kann mit ShowDropPos() ermittelt werden.
+
+Folgende Methoden werden fuer Drag and Drop gebraucht und muessen von
+den Handlern gerufen werden:
+
+StartDrag - Muss aus dem Commnad-Handler gerufen werden. Als Parameter
+ muss der CommandEvent uebergeben werden und eine Referenz
+ auf eine Region. Diese Region muss dann bei ExecuteDrag()
+ uebergeben werden, wenn der Rueckgabewert sagt, das
+ ExecuteDrag durchgefuehrt werden soll. Falls der Eintrag
+ nicht selektiert ist, wird er vorher als aktueller
+ Eintrag gesetzt. Es ist daher darauf zu achten, das aus
+ dieser Methode heraus der Select-Handler gerufen werden
+ kann.
+
+ShowDropPos - Diese Methode muss vom QueryDrop-Handler gerufen werden,
+ damit der TabBar anzeigt, wo die Tabs eingefuegt werden.
+ Diese Methode kann auch im Drop-Handler benutzt werden,
+ um die Position zu ermitteln wo die Tabs eingefuegt werden
+ sollen. In der Methode muss die Position vom Event
+ uebergeben werden. Diese Methode gibt die Position zurueck,
+ wo die Tabs eingefuegt werden sollen.
+
+HideDropPos - Diese Methode nimmt die vorher mit ShowDropPos() angezeigte
+ DropPosition wieder zurueck. Diese Methode sollte dann
+ gerufen werden, wenn bei QueryDrop() das Fenster verlassen
+ wird oder der Dragvorgang beendet wurde.
+
+Folgende Methoden koennen eingesetzt werden, wenn bei D&D die Seiten
+umgeschaltet werden sollen:
+
+SwitchPage - Diese Methode muss vom QueryDrop-Handler gerufen werden,
+ wenn die Seite ueber der sich der Mousepointer befindet,
+ umgeschaltet werden soll. Diese Methode sollte jedesmal
+ gerufen werden, wenn der QueryDrop-Handler gerufen wird.
+ Das umschalten der Seite passiert zeitverzoegert (500 ms)
+ und wird automatisch von dieser Methode verwaltet.
+ In der Methode muss die Position vom Event uebergeben
+ werden. Diese Methode gibt TRUE zurueck, wenn die Page
+ umgeschaltet wurde.
+
+EndSwitchPage - Diese Methode setzt die Daten fuer das umschalten der
+ Seiten zurueck. Diese Methode sollte dann gerufen werden,
+ wenn bei QueryDrop() das Fenster verlassen wird oder
+ der Dragvorgang beendet wurde.
+
+IsInSwitching - Mit dieser Methode kann im ActivatePage()/DeactivatePage()
+ abgefragt werden, ob dies durch SwitchPage() veranlasst
+ wurde. So kann dann beispielsweise in DeactivatePage()
+ das Umschalten ohne eine Fehlerbox verhindert werden.
+
+
+Fenster-Resize
+--------------
+
+Wenn das Fenster vom Anwender in der Breite geaendert werden kann, dann
+muss das WinBit WB_SIZEABLE gesetzt werden. In diesem Fall muss noch
+folgender Handler ueberlagert werden:
+
+Split - Wenn dieser Handler gerufen wird, sollte das Fenster
+ auf die Breite angepasst werden, die von GetSplitSize()
+ zurueckgegeben wird. Dabei wird keine minimale und
+ maximale Breite beruecksichtig. Eine minimale Breite
+ kann mit GetMinSize() abgefragt werden und die maximale
+ Breite muss von der Anwendung selber berechnet werden.
+ Da nur Online-Resize unterstuetzt wird, muss das Fenster
+ innerhalb dieses Handlers in der Breite geaendert
+ werden und eventuell abhaengige Fenster ebenfalls. Fuer
+ diesen Handler kann auch mit SetSplitHdl() ein
+ Link gesetzt werden.
+
+Folgende Methoden liefern beim Splitten weitere Informationen:
+
+GetSplitSize() - Liefert die Breite des TabBars zurueck, auf die der
+ Anwender das Fenster resizen will. Dabei wird keine
+ minimale oder maximale Breite beruecksichtigt. Es wird
+ jedoch nie eine Breite < 5 zurueckgeliefert. Diese Methode
+ liefert nur solange richtige Werte, wie Splitten aktiv
+ ist.
+
+GetMinSize() - Mit dieser Methode kann eine minimale Fensterbreite
+ abgefragt werden, so das min. etwas eines Tabs sichtbar
+ ist. Jedoch kann der TabBar immer noch schmaler gesetzt
+ werden, als die Breite, die diese Methode zurueckliefert.
+ Diese Methode kann auch aufgerufen werden, wenn kein
+ Splitten aktiv ist.
+
+
+Edit-Modus
+----------
+
+Der Tabbar bietet auch Moeglichkeiten, das der Anwender in den Tabreitern
+die Namen aendern kann.
+
+EnableEditMode - Damit kann eingestellt werden, das bei Alt+LeftClick
+ StartEditMode() automatisch vom TabBar gerufen wird.
+ Im StartRenaming()-Handler kann dann das Umbenennen
+ noch abgelehnt werden.
+StartEditMode - Mit dieser Methode wird der EditModus auf einem
+ Tab gestartet. FALSE wird zurueckgegeben, wenn
+ der Editmodus schon aktiv ist, mit StartRenaming()
+ der Modus abgelehnt wurde oder kein Platz zum
+ Editieren vorhanden ist.
+EndEditMode - Mit dieser Methode wird der EditModus beendet.
+SetEditText - Mit dieser Methode kann der Text im AllowRenaming()-
+ Handler noch durch einen anderen Text ersetzt werden.
+GetEditText - Mit dieser Methode kann im AllowRenaming()-Handler
+ der Text abgefragt werden, den der Anwender eingegeben
+ hat.
+IsInEditMode - Mit dieser Methode kann abgefragt werden, ob der
+ Editmodus aktiv ist.
+IsEditModeCanceled - Mit dieser Methode kann im EndRenaming()-
+ Handler abgefragt werden, ob die Umbenenung
+ abgebrochen wurde.
+GetEditPageId - Mit dieser Methode wird in den Renaming-Handlern
+ abgefragt, welcher Tab umbenannt wird/wurde.
+
+StartRenaming() - Dieser Handler wird gerufen, wenn ueber StartEditMode()
+ der Editmodus gestartet wurde. Mit GetEditPageId()
+ kann abgefragt werden, welcher Tab umbenannt werden
+ soll. FALSE sollte zurueckgegeben werden, wenn
+ der Editmodus nicht gestartet werden soll.
+AllowRenaming() - Dieser Handler wird gerufen, wenn der Editmodus
+ beendet wird (nicht bei Cancel). In diesem Handler
+ kann dann getestet werden, ob der Text OK ist.
+ Mit GetEditPageId() kann abgefragt werden, welcher Tab
+ umbenannt wurde.
+ Es sollte einer der folgenden Werte zurueckgegeben
+ werden:
+ TAB_RENAMING_YES
+ Der Tab wird umbenannt.
+ TAB_RENAMING_NO
+ Der Tab wird nicht umbenannt, der Editmodus bleibt
+ jedoch aktiv, so das der Anwender den Namen
+ entsprechent anpassen kann.
+ TAB_RENAMING_CANCEL
+ Der Editmodus wird abgebrochen und der alte
+ Text wieder hergestellt.
+EndRenaming() - Dieser Handler wird gerufen, wenn der Editmodus
+ beendet wurde. Mit GetEditPageId() kann abgefragt
+ werden, welcher Tab umbenannt wurde. Mit
+ IsEditModeCanceled() kann abgefragt werden, ob der
+ Modus abgebrochen wurde und der Name dadurch nicht
+ geaendert wurde.
+
+
+Maximale Pagebreite
+-------------------
+
+Die Pagebreite der Tabs kann begrenzt werden, damit ein einfacheres
+Navigieren ueber diese moeglich ist. Wenn der Text dann nicht komplett
+angezeigt werden kann, wird er mit ... abgekuerzt und in der Tip-
+oder der aktiven Hilfe (wenn kein Hilfetext gesetzt ist) wird dann der
+ganze Text angezeigt. Mit EnableAutoMaxPageWidth() kann eingestellt
+werden, ob die maximale Pagebreite sich nach der gerade sichtbaren
+Breite richten soll (ist der default). Ansonsten kann auch die
+maximale Pagebreite mit SetMaxPageWidth() (in Pixeln) gesetzt werden
+(die AutoMaxPageWidth wird dann ignoriert).
+
+
+KontextMenu
+-----------
+
+Wenn ein kontextsensitives PopupMenu anzeigt werden soll, muss der
+Command-Handler ueberlagert werden. Mit GetPageId() und bei
+Uebergabe der Mausposition kann ermittelt werden, ob der Mausclick
+ueber einem bzw. ueber welchem Item durchgefuehrt wurde.
+*/
+
+// -----------
+// - WinBits -
+// -----------
+
+#define WB_RANGESELECT ((WinBits)0x00200000)
+#define WB_MULTISELECT ((WinBits)0x00400000)
+#define WB_TOPBORDER ((WinBits)0x04000000)
+#define WB_3DTAB ((WinBits)0x08000000)
+#define WB_MINSCROLL ((WinBits)0x20000000)
+#define WB_STDTABBAR WB_BORDER
+
+// ------------------
+// - TabBarPageBits -
+// ------------------
+
+typedef USHORT TabBarPageBits;
+
+// -------------------------
+// - Bits fuer TabBarPages -
+// -------------------------
+
+#define TPB_SPECIAL ((TabBarPageBits)0x0001)
+
+// ----------------
+// - TabBar-Types -
+// ----------------
+
+#define TAB_APPEND ((USHORT)0xFFFF)
+#define TAB_PAGE_NOTFOUND ((USHORT)0xFFFF)
+
+#define TAB_RENAMING_YES ((long)TRUE)
+#define TAB_RENAMING_NO ((long)FALSE)
+#define TAB_RENAMING_CANCEL ((long)2)
+
+// ----------
+// - TabBar -
+// ----------
+
+class TabBar : public Window
+{
+ friend class ImplTabButton;
+ friend class ImplTabSizer;
+
+private:
+ ImplTabBarList* mpItemList;
+ ImplTabButton* mpFirstBtn;
+ ImplTabButton* mpPrevBtn;
+ ImplTabButton* mpNextBtn;
+ ImplTabButton* mpLastBtn;
+ ImplTabSizer* mpSizer;
+ TabBarEdit* mpEdit;
+ XubString maEditText;
+ Color maSelColor;
+ Color maSelTextColor;
+ Size maWinSize;
+ long mnMaxPageWidth;
+ long mnCurMaxWidth;
+ long mnOffX;
+ long mnOffY;
+ long mnOutWidth;
+ long mnSplitSize;
+ ULONG mnSwitchTime;
+ WinBits mnWinStyle;
+ USHORT mnCurPageId;
+ USHORT mnFirstPos;
+ USHORT mnDropPos;
+ USHORT mnSwitchId;
+ USHORT mnEditId;
+ BOOL mbFormat;
+ BOOL mbFirstFormat;
+ BOOL mbSizeFormat;
+ BOOL mbAutoMaxWidth;
+ BOOL mbInSwitching;
+ BOOL mbAutoEditMode;
+ BOOL mbEditCanceled;
+ BOOL mbDropPos;
+ BOOL mbInSelect;
+ BOOL mbSelColor;
+ BOOL mbSelTextColor;
+ Link maSelectHdl;
+ Link maDoubleClickHdl;
+ Link maSplitHdl;
+ Link maActivatePageHdl;
+ Link maDeactivatePageHdl;
+ Link maStartRenamingHdl;
+ Link maAllowRenamingHdl;
+ Link maEndRenamingHdl;
+
+#ifdef _SV_TABBAR_CXX
+ void ImplInit( WinBits nWinStyle );
+ void ImplInitSettings( BOOL bFont, BOOL bBackground );
+ void ImplGetColors( Color& rFaceColor, Color& rFaceTextColor,
+ Color& rSelectColor, Color& rSelectTextColor );
+ void ImplShowPage( USHORT nPos );
+ BOOL ImplCalcWidth();
+ void ImplFormat();
+ USHORT ImplGetLastFirstPos();
+ void ImplInitControls();
+ void ImplEnableControls();
+ DECL_LINK( ImplClickHdl, ImplTabButton* );
+#endif
+
+public:
+ TabBar( Window* pParent, WinBits nWinStyle = WB_STDTABBAR );
+ virtual ~TabBar();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void Split();
+ virtual void ActivatePage();
+ virtual long DeactivatePage();
+ virtual long StartRenaming();
+ virtual long AllowRenaming();
+ virtual void EndRenaming();
+
+ void InsertPage( USHORT nPageId, const XubString& rText,
+ TabBarPageBits nBits = 0,
+ USHORT nPos = TAB_APPEND );
+ void RemovePage( USHORT nPageId );
+ void MovePage( USHORT nPageId, USHORT nNewPos );
+ void Clear();
+
+ void EnablePage( USHORT nPageId, BOOL bEnable = TRUE );
+ BOOL IsPageEnabled( USHORT nPageId ) const;
+
+ void SetPageBits( USHORT nPageId, TabBarPageBits nBits = 0 );
+ TabBarPageBits GetPageBits( USHORT nPageId ) const;
+
+ USHORT GetPageCount() const;
+ USHORT GetPageId( USHORT nPos ) const;
+ USHORT GetPagePos( USHORT nPageId ) const;
+ USHORT GetPageId( const Point& rPos ) const;
+ Rectangle GetPageRect( USHORT nPageId ) const;
+
+ void SetCurPageId( USHORT nPageId );
+ USHORT GetCurPageId() const { return mnCurPageId; }
+
+ void SetFirstPageId( USHORT nPageId );
+ USHORT GetFirstPageId() const { return GetPageId( mnFirstPos ); }
+
+ void SelectPage( USHORT nPageId, BOOL bSelect = TRUE );
+ void SelectPageRange( BOOL bSelect = FALSE,
+ USHORT nStartPos = 0,
+ USHORT nEndPos = TAB_APPEND );
+ USHORT GetSelectPage( USHORT nSelIndex = 0 ) const;
+ USHORT GetSelectPageCount() const;
+ BOOL IsPageSelected( USHORT nPageId ) const;
+
+ void EnableAutoMaxPageWidth( BOOL bEnable = TRUE ) { mbAutoMaxWidth = bEnable; }
+ BOOL IsAutoMaxPageWidthEnabled() const { return mbAutoMaxWidth; }
+ void SetMaxPageWidth( long nMaxWidth );
+ long GetMaxPageWidth() const { return mnMaxPageWidth; }
+ void ResetMaxPageWidth() { SetMaxPageWidth( 0 ); }
+ BOOL IsMaxPageWidth() const { return mnMaxPageWidth != 0; }
+
+ void EnableEditMode( BOOL bEnable = TRUE ) { mbAutoEditMode = bEnable; }
+ BOOL IsEditModeEnabled() const { return mbAutoEditMode; }
+ BOOL StartEditMode( USHORT nPageId );
+ void EndEditMode( BOOL bCancel = FALSE );
+ void SetEditText( const XubString& rText ) { maEditText = rText; }
+ const XubString& GetEditText() const { return maEditText; }
+ BOOL IsInEditMode() const { return (mpEdit != NULL); }
+ BOOL IsEditModeCanceled() const { return mbEditCanceled; }
+ USHORT GetEditPageId() const { return mnEditId; }
+
+ BOOL StartDrag( const CommandEvent& rCEvt, Region& rRegion );
+ USHORT ShowDropPos( const Point& rPos );
+ void HideDropPos();
+ BOOL SwitchPage( const Point& rPos );
+ void EndSwitchPage();
+ BOOL IsInSwitching() { return mbInSwitching; }
+
+ void SetSelectColor();
+ void SetSelectColor( const Color& rColor );
+ const Color& GetSelectColor() const { return maSelColor; }
+ BOOL IsSelectColor() const { return mbSelColor; }
+ void SetSelectTextColor();
+ void SetSelectTextColor( const Color& rColor );
+ const Color& GetSelectTextColor() const { return maSelTextColor; }
+ BOOL IsSelectTextColor() const { return mbSelTextColor; }
+
+ void SetPageText( USHORT nPageId, const XubString& rText );
+ XubString GetPageText( USHORT nPageId ) const;
+ void SetHelpText( USHORT nPageId, const XubString& rText );
+ XubString GetHelpText( USHORT nPageId ) const;
+ void SetHelpId( USHORT nPageId, ULONG nHelpId );
+ ULONG GetHelpId( USHORT nPageId ) const;
+
+ long GetSplitSize() const { return mnSplitSize; }
+ long GetMinSize() const;
+
+ void SetHelpText( const XubString& rText )
+ { Window::SetHelpText( rText ); }
+ XubString GetHelpText() const
+ { return Window::GetHelpText(); };
+ void SetHelpId( ULONG nId )
+ { Window::SetHelpId( nId ); }
+ ULONG GetHelpId() const
+ { return Window::GetHelpId(); }
+
+ void SetStyle( WinBits nStyle );
+ WinBits GetStyle() const { return mnWinStyle; }
+
+ Size CalcWindowSizePixel() const;
+
+ void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return maSelectHdl; }
+ void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
+ const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
+ void SetSplitHdl( const Link& rLink ) { maSplitHdl = rLink; }
+ const Link& GetSplitHdl() const { return maSplitHdl; }
+ void SetActivatePageHdl( const Link& rLink ) { maActivatePageHdl = rLink; }
+ const Link& GetActivatePageHdl() const { return maActivatePageHdl; }
+ void SetDeactivatePageHdl( const Link& rLink ) { maDeactivatePageHdl = rLink; }
+ const Link& GetDeactivatePageHdl() const { return maDeactivatePageHdl; }
+ void SetStartRenamingHdl( const Link& rLink ) { maStartRenamingHdl = rLink; }
+ const Link& GetStartRenamingHdl() const { return maStartRenamingHdl; }
+ void SetAllowRenamingHdl( const Link& rLink ) { maAllowRenamingHdl = rLink; }
+ const Link& GetAllowRenamingHdl() const { return maAllowRenamingHdl; }
+ void SetEndRenamingHdl( const Link& rLink ) { maEndRenamingHdl = rLink; }
+ const Link& GetEndRenamingHdl() const { return maEndRenamingHdl; }
+};
+
+#endif // _TABBAR_HXX
diff --git a/svtools/inc/taskbar.hxx b/svtools/inc/taskbar.hxx
new file mode 100644
index 000000000000..4339c9451660
--- /dev/null
+++ b/svtools/inc/taskbar.hxx
@@ -0,0 +1,537 @@
+/*************************************************************************
+ *
+ * $RCSfile: taskbar.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TASKBAR_HXX
+#define _TASKBAR_HXX
+
+#ifndef _TOOLS_TIME_HXX
+#include <tools/time.hxx>
+#endif
+#ifndef _TOOLS_INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <vcl/timer.hxx>
+#endif
+#ifndef _SV_TOOLBOX_HXX
+#include <vcl/toolbox.hxx>
+#endif
+#ifndef _SV_STATUS_HXX
+#include <vcl/status.hxx>
+#endif
+
+class TaskBar;
+class TaskStatusFieldItem;
+class ImplTaskItemList;
+class ImplTaskSBItemList;
+class ImplTaskBarFloat;
+struct ImplTaskSBFldItem;
+
+// -----------------
+// - Dokumentation -
+// -----------------
+
+/*
+
+TaskToolBox
+===========
+
+StartUpdateTask()/UpdateTask()/EndUpdateTask()
+Diese muessen gerufen werden, wenn die Task upgedatet werden muessen.
+Dann muss StartUpdateTask() gerufen werden, dann UpdateTask() fuer alle
+Task's und danach EndUpdateTask() wo dann die TaskButtons entsprechend
+neu angeordnet werden.
+
+ActivateTask()
+Handler der gerufen wird, wenn ein Task aktiviert werden muss. Mit
+GetTaskItem() kann abgefragt werden, welcher Task aktiviert werden muss.
+
+ContextMenu()
+Dieser Handler wird gerufen, wenn ein ContextMenu angezeigt werden soll.
+Mit GetTaskMode() kann abgefragt werden, ob fuer einen Task oder ein
+Item.
+
+GetTaskItem()
+Diese Methode liefert das Item zurueck, welches bei UpdateTask an der
+entsprechenden Position eingefuegt wurde.
+
+GetContextMenuPos()
+Liefert die Position zurueck, wo das Contextmenu angezeigt werden soll.
+
+
+TaskStatusBar
+=============
+
+InsertStatusField()/RemoveStatusField()
+Fuegt ein Statusfeld ein, wo die aktuelle Uhrzeit angezeigt wird. In
+dieses Feld koennen dann mit AddStatusFielItem(), ModifyStatusFielItem()
+und RemoveStatusFielItem() Status-Items eingefuegt werden. Bei diesen
+muss man ein Image angeben, welches dann angezeigt wird. Ausserdem kann
+man bei diesen noch Hilfe-Texte angeben oder sagen, ob sie blinken
+sollen und ein Notify-Object, worueber man informiert wird, wenn ein
+Kontextmenu angezeigt wird oder das Item angeklickt wird. Am
+TaskStatusBar kann auch ein Notify-Object gesetzt werden, wenn man
+benachrichtigt werden will, wenn die Uhrzeit oder die TaskStatusBar
+angeklickt wird. Wenn der Notify fuer die Uhrzeit kommt, ist die
+Id TASKSTATUSBAR_CLOCKID, wenn er fuer die TaskStatusBar kommt, ist
+die Id 0. Mit SetFieldFlags() kann am TaskStatusBar auch die Flags
+hinterher umgesetzt werden, um zum Beispiel die Uhrzeit ein- und
+auszuschalten.
+
+
+TaskBar
+=======
+
+Erlaubte StyleBits
+------------------
+
+WB_BORDER - Border an der oberen Kante
+WB_SIZEABLE - Zwischen TaskToolBox und TaskStatusBar kann der Anwender
+ die Groesse aendern.
+
+Wenn WB_SIZEABLE gesetzt ist, kann die Breite des StatusBars gesetzt und
+abgefragt werden. Dazu kann man SetStatusSize()/GetStatusSize() aufrufen.
+0 steht dabei fuer optimale Groesse, was auch der Default ist. Bei einem
+Doppelklick auf den Trenner kann der Anwender auch wieder die optimale
+Groesse einstellen.
+
+Wichtige Methoden
+------------------
+
+virtual TaskToolBox* TaskBar::CreateButtonBar();
+virtual TaskToolBox* TaskBar::CreateTaskToolBox();
+virtual TaskStatusBar* TaskBar::CreateTaskStatusBar();
+
+Diese Methoden muesste man ueberladen, wenn man eine eigene Klasse anlegen
+will.
+
+void TaskBar::ShowStatusText( const String& rText );
+void TaskBar::HideStatusText();
+
+Blendet den ButtonBar und die TaskBar ein bzw. aus um den Hilfetexte in der
+gesammten Zeile anzuzeigen.
+*/
+
+// -----------------
+// - TaskButtonBar -
+// -----------------
+
+class TaskButtonBar : public ToolBox
+{
+ friend class TaskBar;
+
+private:
+ TaskBar* mpNotifyTaskBar;
+ void* mpDummy1;
+ void* mpDummy2;
+ void* mpDummy3;
+ void* mpDummy4;
+
+public:
+ TaskButtonBar( Window* pParent, WinBits nWinStyle = 0 );
+ ~TaskButtonBar();
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+ void InsertButton( USHORT nItemId,
+ const Image& rImage, const String& rText,
+ USHORT nPos = TOOLBOX_APPEND )
+ { InsertItem( nItemId, rImage, rText, TIB_LEFT | TIB_AUTOSIZE, nPos ); }
+ void RemoveButton( USHORT nItemId )
+ { RemoveItem( nItemId ); }
+};
+
+// ---------------------
+// - TaskToolBox-Types -
+// ---------------------
+
+#define TASKTOOLBOX_TASK_NOTFOUND ((USHORT)0xFFFF)
+
+// ---------------
+// - TaskToolBox -
+// ---------------
+
+class TaskToolBox : public ToolBox
+{
+ friend class TaskBar;
+
+private:
+ ImplTaskItemList* mpItemList;
+ TaskBar* mpNotifyTaskBar;
+ Point maContextMenuPos;
+ ULONG mnOldItemCount;
+ long mnMaxTextWidth;
+ long mnDummy1;
+ USHORT mnUpdatePos;
+ USHORT mnUpdateNewPos;
+ USHORT mnActiveItemId;
+ USHORT mnNewActivePos;
+ USHORT mnTaskItem;
+ USHORT mnSmallItem;
+ USHORT mnDummy2;
+ BOOL mbMinActivate;
+ BOOL mbDummy1;
+ Link maActivateTaskHdl;
+ Link maContextMenuHdl;
+
+#ifdef _TASKBAR_CXX
+ void ImplFormat();
+#endif
+
+public:
+ TaskToolBox( Window* pParent, WinBits nWinStyle = 0 );
+ ~TaskToolBox();
+
+ void ActivateTaskItem( USHORT nItemId,
+ BOOL bMinActivate = FALSE );
+ USHORT GetTaskItem( const Point& rPos ) const;
+
+ virtual void ActivateTask();
+ virtual void ContextMenu();
+
+ virtual void Select();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Resize();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual BOOL QueryDrop( DropEvent& rDEvt );
+
+ void StartUpdateTask();
+ void UpdateTask( const Image& rImage, const String& rText,
+ BOOL bActive = FALSE );
+ void EndUpdateTask();
+
+ const Point& GetContextMenuPos() const { return maContextMenuPos; }
+ USHORT GetTaskItem() const { return mnTaskItem; }
+ BOOL IsMinActivate() const { return mbMinActivate; }
+
+ void SetActivateTaskHdl( const Link& rLink ) { maActivateTaskHdl = rLink; }
+ const Link& GetActivateTaskHdl() const { return maActivateTaskHdl; }
+ void SetContextMenuHdl( const Link& rLink ) { maContextMenuHdl = rLink; }
+ const Link& GetContextMenuHdl() const { return maContextMenuHdl; }
+};
+
+inline USHORT TaskToolBox::GetTaskItem( const Point& rPos ) const
+{
+ USHORT nId = GetItemId( rPos );
+ if ( nId )
+ return nId-1;
+ else
+ return TASKTOOLBOX_TASK_NOTFOUND;
+}
+
+// ---------------------
+// - ITaskStatusNotify -
+// ---------------------
+
+class ITaskStatusNotify
+{
+public:
+ virtual BOOL MouseButtonDown( USHORT nItemd, const MouseEvent& rMEvt );
+ virtual BOOL MouseButtonUp( USHORT nItemd, const MouseEvent& rMEvt );
+ virtual BOOL MouseMove( USHORT nItemd, const MouseEvent& rMEvt );
+ virtual BOOL Command( USHORT nItemd, const CommandEvent& rCEvt );
+ virtual BOOL QueryDrop( USHORT nItemd, DropEvent& rDEvt, BOOL& bRet );
+ virtual BOOL Drop( USHORT nItemd, const DropEvent& rDEvt, BOOL& bRet );
+ virtual BOOL UpdateHelp( USHORT nItemd );
+};
+
+// -----------------------
+// - TaskStatusFieldItem -
+// -----------------------
+
+#define TASKSTATUSFIELDITEM_FLASH ((USHORT)0x0001)
+
+class TaskStatusFieldItem
+{
+private:
+ ITaskStatusNotify* mpNotify;
+ Image maImage;
+ XubString maQuickHelpText;
+ XubString maHelpText;
+ ULONG mnHelpId;
+ USHORT mnFlags;
+
+public:
+ TaskStatusFieldItem();
+ TaskStatusFieldItem( const TaskStatusFieldItem& rItem );
+ TaskStatusFieldItem( ITaskStatusNotify* pNotify,
+ const Image& rImage,
+ const XubString& rQuickHelpText,
+ const XubString& rHelpText,
+ USHORT nFlags );
+ ~TaskStatusFieldItem();
+
+ void SetNotifyObject( ITaskStatusNotify* pNotify ) { mpNotify = pNotify; }
+ ITaskStatusNotify* GetNotifyObject() const { return mpNotify; }
+ void SetImage( const Image& rImage ) { maImage = rImage; }
+ const Image& GetImage() const { return maImage; }
+ void SetQuickHelpText( const XubString& rStr ) { maQuickHelpText = rStr; }
+ const XubString& GetQuickHelpText() const { return maQuickHelpText; }
+ void SetHelpText( const XubString& rStr ) { maHelpText = rStr; }
+ const XubString& GetHelpText() const { return maHelpText; }
+ void SetHelpId( ULONG nHelpId ) { mnHelpId = nHelpId; }
+ ULONG GetHelpId() const { return mnHelpId; }
+ void SetFlags( USHORT nFlags ) { mnFlags = nFlags; }
+ USHORT GetFlags() const { return mnFlags; }
+
+ const TaskStatusFieldItem& operator=( const TaskStatusFieldItem& rItem );
+};
+
+// -----------------
+// - TaskStatusBar -
+// -----------------
+
+#define TASKSTATUSBAR_STATUSFIELDID ((USHORT)61000)
+
+#define TASKSTATUSBAR_CLOCKID ((USHORT)61000)
+#define TASKSTATUSFIELD_CLOCK ((USHORT)0x0001)
+
+class TaskStatusBar : public StatusBar
+{
+ friend class TaskBar;
+
+private:
+ ImplTaskSBItemList* mpFieldItemList;
+ TaskBar* mpNotifyTaskBar;
+ ITaskStatusNotify* mpNotify;
+ Time maTime;
+ XubString maTimeText;
+ AutoTimer maTimer;
+ International maIntn;
+ long mnClockWidth;
+ long mnItemWidth;
+ long mnFieldWidth;
+ USHORT mnFieldFlags;
+ USHORT mnDummy1;
+ BOOL mbFlashItems;
+ BOOL mbOutInterval;
+ BOOL mbDummy1;
+ BOOL mbDummy2;
+
+#ifdef _TASKBAR_CXX
+ ImplTaskSBFldItem* ImplGetFieldItem( USHORT nItemId ) const;
+ ImplTaskSBFldItem* ImplGetFieldItem( const Point& rPos, BOOL& rFieldRect ) const;
+ BOOL ImplUpdateClock();
+ BOOL ImplUpdateFlashItems();
+ void ImplUpdateField( BOOL bItems );
+ DECL_LINK( ImplTimerHdl, Timer* );
+#endif
+
+public:
+ TaskStatusBar( Window* pParent, WinBits nWinStyle = WB_LEFT );
+ ~TaskStatusBar();
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual BOOL QueryDrop( DropEvent& rDEvt );
+ virtual BOOL Drop( const DropEvent& rDEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+
+ void InsertStatusField( long nOffset = STATUSBAR_OFFSET,
+ USHORT nPos = STATUSBAR_APPEND,
+ USHORT nFlags = TASKSTATUSFIELD_CLOCK );
+ void RemoveStatusField()
+ { maTimer.Stop(); RemoveItem( TASKSTATUSBAR_STATUSFIELDID ); }
+ void SetFieldFlags( USHORT nFlags );
+ USHORT GetFieldFlags() const { return mnFieldFlags; }
+ void SetNotifyObject( ITaskStatusNotify* pNotify ) { mpNotify = pNotify; }
+ ITaskStatusNotify* GetNotifyObject() const { return mpNotify; }
+
+ void AddStatusFieldItem( USHORT nItemId, const TaskStatusFieldItem& rItem,
+ USHORT nPos = 0xFFFF );
+ void ModifyStatusFieldItem( USHORT nItemId, const TaskStatusFieldItem& rItem );
+ void RemoveStatusFieldItem( USHORT nItemId );
+ BOOL GetStatusFieldItem( USHORT nItemId, TaskStatusFieldItem& rItem ) const;
+};
+
+// -----------
+// - TaskBar -
+// -----------
+
+class TaskBar : public Window
+{
+private:
+ ImplTaskBarFloat* mpAutoHideBar;
+ TaskButtonBar* mpButtonBar;
+ TaskToolBox* mpTaskToolBox;
+ TaskStatusBar* mpStatusBar;
+ void* mpDummy1;
+ void* mpDummy2;
+ void* mpDummy3;
+ void* mpDummy4;
+ String maOldText;
+ long mnStatusWidth;
+ long mnMouseOff;
+ long mnOldStatusWidth;
+ long mnDummy1;
+ long mnDummy2;
+ long mnDummy3;
+ long mnDummy4;
+ WinBits mnWinBits;
+ USHORT mnLines;
+ BOOL mbStatusText;
+ BOOL mbShowItems;
+ BOOL mbAutoHide;
+ BOOL mbAlignDummy1;
+ BOOL mbDummy1;
+ BOOL mbDummy2;
+ BOOL mbDummy3;
+ BOOL mbDummy4;
+ Link maTaskResizeHdl;
+
+#ifdef _TASKBAR_CXX
+ void ImplInitSettings();
+ void ImplNewHeight( long nNewHeight );
+#endif
+
+public:
+ TaskBar( Window* pParent, WinBits nWinStyle = WB_BORDER | WB_SIZEABLE );
+ ~TaskBar();
+
+ virtual void TaskResize();
+
+ virtual TaskButtonBar* CreateButtonBar();
+ virtual TaskToolBox* CreateTaskToolBox();
+ virtual TaskStatusBar* CreateTaskStatusBar();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void StateChanged( StateChangedType nType );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void Format();
+
+ void SetLines( USHORT nLines );
+ USHORT GetLines() const { return mnLines; }
+ void EnableAutoHide( BOOL bAutoHide = TRUE );
+ BOOL IsAutoHideEnabled() const { return mbAutoHide; }
+
+ void ShowStatusText( const String& rText );
+ void HideStatusText();
+
+ void SetStatusSize( long nNewSize )
+ { mnStatusWidth=nNewSize; Resize(); }
+ long GetStatusSize() const { return mnStatusWidth; }
+
+ Size CalcWindowSizePixel() const;
+
+ TaskButtonBar* GetButtonBar() const;
+ TaskToolBox* GetTaskToolBox() const;
+ TaskStatusBar* GetStatusBar() const;
+
+ void SetTaskResizeHdl( const Link& rLink ) { maTaskResizeHdl = rLink; }
+ const Link& GetTaskResizeHdl() const { return maTaskResizeHdl; }
+};
+
+// -----------------------
+// - WindowArrange-Types -
+// -----------------------
+
+#define WINDOWARRANGE_TILE 1
+#define WINDOWARRANGE_HORZ 2
+#define WINDOWARRANGE_VERT 3
+#define WINDOWARRANGE_CASCADE 4
+
+class ImplWindowArrangeList;
+
+// -----------------------
+// - class WindowArrange -
+// -----------------------
+
+class WindowArrange
+{
+private:
+ List* mpWinList;
+ void* mpDummy;
+ ULONG mnDummy;
+
+#ifdef _TASKBAR_CXX
+ void ImplTile( const Rectangle& rRect );
+ void ImplHorz( const Rectangle& rRect );
+ void ImplVert( const Rectangle& rRect );
+ void ImplCascade( const Rectangle& rRect );
+#endif
+
+public:
+ WindowArrange();
+ ~WindowArrange();
+
+ void AddWindow( Window* pWindow, ULONG nPos = LIST_APPEND )
+ { mpWinList->Insert( (void*)pWindow, nPos ); }
+ void RemoveAllWindows()
+ { mpWinList->Clear(); }
+
+ void Arrange( USHORT nType, const Rectangle& rRect );
+};
+
+#endif // _TASKBAR_HXX
diff --git a/svtools/inc/testtool.hxx b/svtools/inc/testtool.hxx
new file mode 100644
index 000000000000..1bd95d67d387
--- /dev/null
+++ b/svtools/inc/testtool.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * $RCSfile: testtool.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef SVTOOLS_TESTTOOL_HXX
+#define SVTOOLS_TESTTOOL_HXX
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+#ifndef _LINK_HXX //autogen
+#include <tools/link.hxx>
+#endif
+
+class Application;
+class SvStream;
+
+class StatementFlow;
+class CommunicationManager;
+class CommunicationLink;
+#ifdef DEBUG
+class EditWindow;
+#endif
+class ImplRC;
+
+class RemoteControl
+{
+ friend class StatementFlow;
+
+ BOOL m_bIdleInserted;
+#ifdef DEBUG
+ EditWindow *m_pDbgWin;
+#endif
+ ImplRC* pImplRC;
+
+public:
+ RemoteControl();
+ ~RemoteControl();
+ BOOL QueCommands( ULONG nServiceId, SvStream *pIn );
+ SvStream* GetReturnStream();
+
+ DECL_LINK( IdleHdl, Application* );
+ DECL_LINK( CommandHdl, Application* );
+
+ DECL_LINK( QueCommandsEvent, CommunicationLink* );
+ ULONG nStoredServiceId;
+ SvStream *pStoredStream;
+
+ void ExecuteURL( String &aURL );
+
+protected:
+ CommunicationManager *pServiceMgr;
+ SvStream *pRetStream;
+};
+
+#endif // SVTOOLS_TESTTOOL_HXX
diff --git a/svtools/inc/twain.hxx b/svtools/inc/twain.hxx
new file mode 100644
index 000000000000..6c7e9351f7e2
--- /dev/null
+++ b/svtools/inc/twain.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: twain.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TWAIN_HXX
+#define _TWAIN_HXX
+
+// please add new platforms if TWAIN is available
+#if defined WIN || defined WNT || defined UNX
+#define TWAIN_AVAILABLE 1
+#else
+#undef TWAIN_AVAILABLE
+#endif
+
+// include following only, if define is not set
+#ifndef _TWAIN_HXX_CHECK
+
+#ifndef _SV_BITMAP_HXX //autogen
+#include <vcl/bitmap.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define TWAIN_ERR_NO_ERROR 0
+#define TWAIN_ERR_MODULE_NOT_LOADED 2
+#define TWAIN_ERR_DSMENTRY_NOT_FOUND 4
+#define TWAIN_ERR_SOURCE_MANAGER_NOT_OPENED 6
+#define TWAIN_ERR_SOURCE_SELECTION_DIALOG 8
+
+// ---------
+// - Twain -
+// ---------
+
+struct TwainImp;
+namespace com { namespace sun { namespace star { namespace lang { struct EventObject; } } } }
+
+class Twain
+{
+friend class TwainEventListener;
+
+private:
+
+ TwainImp* mpImp;
+
+ Bitmap maBitmap;
+ Link maUpdateLink;
+ USHORT mnErrorCode;
+ BOOL mbScanning;
+
+ Twain();
+ Twain( const Twain& rTwain );
+ const Twain& operator=( const Twain& rTwain ) { return *this; }
+
+protected:
+
+ void Disposing( const com::sun::star::lang::EventObject& rEventObject );
+
+public:
+
+ Twain( const Link& rUpdateLink );
+ ~Twain();
+
+ BOOL SelectSource();
+ BOOL PerformTransfer();
+
+ Bitmap GetBitmap();
+
+ BOOL IsScanning() const { return mbScanning; }
+ USHORT GetErrorCode() const { return mnErrorCode; }
+};
+
+#endif // _TWAIN_HXX_CHECK
+#endif // _TWAIN_HXX
diff --git a/svtools/inc/txtattr.hxx b/svtools/inc/txtattr.hxx
new file mode 100644
index 000000000000..80acb67563bc
--- /dev/null
+++ b/svtools/inc/txtattr.hxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * $RCSfile: txtattr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TXTATTR_HXX
+#define _TXTATTR_HXX
+
+#ifndef _SV_COLOR_HXX //autogen
+#include <vcl/color.hxx>
+#endif
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+class Font;
+
+#define TEXTATTR_INVALID 0
+#define TEXTATTR_FONTCOLOR 1
+#define TEXTATTR_HYPERLINK 2
+
+
+
+class TextAttrib
+{
+private:
+ USHORT mnWhich;
+
+protected:
+ TextAttrib( USHORT nWhich ) { mnWhich = nWhich; }
+ TextAttrib( const TextAttrib& rAttr ) { mnWhich = rAttr.mnWhich; }
+
+public:
+
+ virtual ~TextAttrib();
+
+ USHORT Which() const { return mnWhich; }
+
+ virtual void SetFont( Font& rFont ) const = 0;
+ virtual TextAttrib* Clone() const = 0;
+ virtual int operator==( const TextAttrib& rAttr ) const = 0;
+ int operator!=( const TextAttrib& rAttr ) const
+ { return !(*this == rAttr ); }
+};
+
+
+
+class TextAttribFontColor : public TextAttrib
+{
+private:
+ Color maColor;
+
+public:
+ TextAttribFontColor( const Color& rColor );
+ TextAttribFontColor( const TextAttribFontColor& rAttr );
+ ~TextAttribFontColor();
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+
+
+
+class TextAttribHyperLink : public TextAttrib
+{
+private:
+ XubString maURL;
+ XubString maDescription;
+ Color maColor;
+
+public:
+ TextAttribHyperLink( const XubString& rURL );
+ TextAttribHyperLink( const XubString& rURL, const XubString& rDescription );
+ TextAttribHyperLink( const TextAttribHyperLink& rAttr );
+ ~TextAttribHyperLink();
+
+ void SetURL( const XubString& rURL ) { maURL = rURL; }
+ const XubString& GetURL() const { return maURL; }
+
+ void SetDescription( const XubString& rDescr ) { maDescription = rDescr; }
+ const XubString& GetDescription() const { return maDescription; }
+
+ void SetColor( const Color& rColor ) { maColor = rColor; }
+ const Color& GetColor() const { return maColor; }
+
+ virtual void SetFont( Font& rFont ) const;
+ virtual TextAttrib* Clone() const;
+ virtual int operator==( const TextAttrib& rAttr ) const;
+};
+
+
+
+class TextCharAttrib
+{
+private:
+ TextAttrib* mpAttr;
+ USHORT mnStart;
+ USHORT mnEnd;
+
+protected:
+
+public:
+
+ TextCharAttrib( const TextAttrib& rAttr, USHORT nStart, USHORT nEnd );
+ TextCharAttrib( const TextCharAttrib& rTextCharAttrib );
+ ~TextCharAttrib();
+
+ const TextAttrib& GetAttr() const { return *mpAttr; }
+
+ USHORT Which() const { return mpAttr->Which(); }
+
+ USHORT GetStart() const { return mnStart; }
+ USHORT& GetStart() { return mnStart; }
+
+ USHORT GetEnd() const { return mnEnd; }
+ USHORT& GetEnd() { return mnEnd; }
+
+ inline USHORT GetLen() const;
+
+ inline void MoveForward( USHORT nDiff );
+ inline void MoveBackward( USHORT nDiff );
+
+ inline void Expand( USHORT nDiff );
+ inline void Collaps( USHORT nDiff );
+
+ inline BOOL IsIn( USHORT nIndex );
+ inline BOOL IsInside( USHORT nIndex );
+ inline BOOL IsEmpty();
+
+};
+
+inline USHORT TextCharAttrib::GetLen() const
+{
+ DBG_ASSERT( mnEnd >= mnStart, "TextCharAttrib: nEnd < nStart!" );
+ return mnEnd-mnStart;
+}
+
+inline void TextCharAttrib::MoveForward( USHORT nDiff )
+{
+ DBG_ASSERT( ((long)mnEnd + nDiff) <= 0xFFFF, "TextCharAttrib: MoveForward?!" );
+ mnStart += nDiff;
+ mnEnd += nDiff;
+}
+
+inline void TextCharAttrib::MoveBackward( USHORT nDiff )
+{
+ DBG_ASSERT( ((long)mnStart - nDiff) >= 0, "TextCharAttrib: MoveBackward?!" );
+ mnStart -= nDiff;
+ mnEnd -= nDiff;
+}
+
+inline void TextCharAttrib::Expand( USHORT nDiff )
+{
+ DBG_ASSERT( ( ((long)mnEnd + nDiff) <= (long)0xFFFF ), "TextCharAttrib: Expand?!" );
+ mnEnd += nDiff;
+}
+
+inline void TextCharAttrib::Collaps( USHORT nDiff )
+{
+ DBG_ASSERT( (long)mnEnd - nDiff >= (long)mnStart, "TextCharAttrib: Collaps?!" );
+ mnEnd -= nDiff;
+}
+
+inline BOOL TextCharAttrib::IsIn( USHORT nIndex )
+{
+ return ( ( mnStart <= nIndex ) && ( mnEnd >= nIndex ) );
+}
+
+inline BOOL TextCharAttrib::IsInside( USHORT nIndex )
+{
+ return ( ( mnStart < nIndex ) && ( mnEnd > nIndex ) );
+}
+
+inline BOOL TextCharAttrib::IsEmpty()
+{
+ return mnStart == mnEnd;
+}
+
+#endif // _TXTATTR_HXX
diff --git a/svtools/inc/txtcmp.hxx b/svtools/inc/txtcmp.hxx
new file mode 100644
index 000000000000..7c7375c9d469
--- /dev/null
+++ b/svtools/inc/txtcmp.hxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * $RCSfile: txtcmp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _TXTCMP_HXX
+#define _TXTCMP_HXX
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XTEXTSEARCH_HPP_
+#include <com/sun/star/util/XTextSearch.hpp>
+#endif
+
+// Forward-Deklaration
+class International;
+class CharClass;
+
+// SS - Klasse fuers Suchen
+class SearchParam
+{
+public:
+ enum SearchType{ SRCH_NORMAL, SRCH_REGEXP, SRCH_LEVDIST };
+
+private:
+ friend class SearchText;
+
+ String sSrchStr; // der Such-String
+ String sReplaceStr; // nur fuer SS - der Ersetzungs-String
+
+ SearchType eSrchType; // suche normal/regulaer/LevDist
+
+ int bWordOnly : 1; // nur bei normaler Suche
+ int bSrchInSel : 1; // Suche in vorgebener Grenze
+ int bCaseSense : 1; // Gross-/Klein-Schreibung beachten
+
+ // Werte fuer "Gewichtete Levenshtein-Distanz"
+ int bLEV_Relaxed : 1;
+ int nLEV_OtherX;
+ int nLEV_ShorterY;
+ int nLEV_LongerZ;
+
+public:
+ SearchParam( const String &rText,
+ SearchType eSrchType = SearchParam::SRCH_NORMAL,
+ BOOL bCaseSens = TRUE,
+ BOOL bWrdOnly = FALSE,
+ BOOL bSrchInSel = FALSE );
+ SearchParam( const SearchParam& );
+
+ const String& GetSrchStr() const { return sSrchStr; }
+ const String& GetReplaceStr() const { return sReplaceStr; }
+ SearchType GetSrchType() const { return eSrchType; }
+
+ int IsCaseSensitive() const { return bCaseSense; }
+ int IsSrchInSelection() const { return bSrchInSel; }
+ int IsSrchWordOnly() const { return bWordOnly; }
+
+
+ void SetSrchStr( const String& rStr ) { sSrchStr = rStr; }
+ void SetReplaceStr( const String& rStr ) { sReplaceStr = rStr; }
+ void SetSrchType( SearchType eType ) { eSrchType = eType; }
+
+ void SetCaseSensitive( int bFlag ) { bCaseSense = bFlag; }
+ void SetSrchInSelection( int bFlag ) { bSrchInSel = bFlag; }
+ void SetSrchWordOnly( int bFlag ) { bWordOnly = bFlag; }
+
+
+ // Methoden fuer "Gewichtete Levenshtein-Distanz"
+ int IsSrchRelaxed() const { return bLEV_Relaxed; }
+ int GetLEVOther() const { return nLEV_OtherX; }
+ int GetLEVShorter() const { return nLEV_ShorterY; }
+ int GetLEVLonger() const { return nLEV_LongerZ; }
+
+ void SetSrchRelaxed( int bFlag ) { bLEV_Relaxed = bFlag; }
+ void SetLEVOther( int nValue ) { nLEV_OtherX = nValue; }
+ void SetLEVShorter( int nValue ) { nLEV_ShorterY = nValue; }
+ void SetLEVLonger( int nValue ) { nLEV_LongerZ = nValue; }
+};
+
+// Klasse zum Suchen eines Strings in einem String.
+// Unterstuetzt werden folgende Verfahren:
+// - normalen Text (Bayer/Moore)
+// - regulaere Ausdruecke
+// - gewichtete Levenshtein Distanz
+//
+// Es kann Vorwaerts und Rueckwaerts gesucht werden!
+
+class SearchText
+{
+ com::sun::star::uno::Reference < com::sun::star::util::XTextSearch >
+ xTextSearch;
+ BOOL bSearchRegular;
+
+ void Init( const SearchParam & rParam,
+ const ::com::sun::star::lang::Locale& rLocale );
+
+public:
+ // rText ist der zusuchende String
+ SearchText(const SearchParam & rPara, const International & rTheIntnl);
+ SearchText(const SearchParam & rPara, const CharClass& rCClass );
+ ~SearchText();
+
+ /* Suche im Text den initialen String:
+ rScrTxt - der Text, worin geuscht wird.
+ pStart - Startposition im Text fuers Suchen
+ nEnde - Endposition im Text
+
+ RETURN Werte == TRUE: wenn gefunden gibt,
+ - pStart zeigt auf die Startposition im Text,
+ - pEnde zeigt auf die Endposition im Text
+
+ == FALSE: nicht gefunden, pStart,pEnde unveraendert.
+ */
+ int SearchFrwrd( const String &rStr, xub_StrLen* pStart, xub_StrLen* pEnde );
+ int SearchBkwrd( const String &rStr, xub_StrLen* pStart, xub_StrLen* pEnde );
+};
+
+/*************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/svtools/inc/txtcmp.hxx,v 1.1.1.1 2000-09-18 16:58:54 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.13 2000/09/18 14:13:18 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.12 2000/09/01 13:52:29 jp
+ move search into INT - DLL
+
+ Revision 1.11 2000/08/31 13:41:16 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.10 2000/08/28 11:55:35 jp
+ new: use CharClass instead of International
+
+ Revision 1.9 2000/03/31 10:48:39 jp
+ Changes for unicode
+
+ Revision 1.8 2000/02/09 16:16:19 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.7 1999/08/24 13:56:27 sb
+ #66082# Make use of International explicitly through ctor.
+
+ Revision 1.6 1997/07/30 08:36:52 MH
+ chg: header
+
+
+ Rev 1.5 30 Jul 1997 10:36:52 MH
+ chg: header
+
+ Rev 1.4 18 Jun 1996 14:56:14 WP
+ richtig includen
+
+ Rev 1.3 25 Mar 1996 09:54:06 MT
+ CLOOK-Vorbeugung
+
+ Rev 1.2 27 Nov 1995 18:27:46 AB
+ Unicode-Anpassung
+
+ Rev 1.1 23 Dec 1994 11:44:02 JP
+ endif ohne Kommentar
+
+ Rev 1.0 01 Dec 1994 16:35:46 MT
+ Initial revision.
+
+*************************************************************************/
+
+#endif
+ // _TXTCMP_HXX
diff --git a/svtools/inc/urihelper.hxx b/svtools/inc/urihelper.hxx
new file mode 100644
index 000000000000..6656b0d22c3c
--- /dev/null
+++ b/svtools/inc/urihelper.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * $RCSfile: urihelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_URIHELPER_HXX
+#define SVTOOLS_URIHELPER_HXX
+
+#ifndef _RTL_TEXTENC_H
+#include <rtl/textenc.h>
+#endif
+#ifndef _LINK_HXX
+#include <tools/link.hxx>
+#endif
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class RuntimeException;
+} } } }
+class ByteString;
+class CharClass;
+class UniString;
+
+//============================================================================
+namespace URIHelper {
+
+UniString
+SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
+ ByteString const & rTheRelURIRef,
+ Link const & rMaybeFileHdl = Link(),
+ bool bCheckFileExists = true,
+ bool bIgnoreFragment = false,
+ INetURLObject::EncodeMechanism eEncodeMechanism
+ = INetURLObject::WAS_ENCODED,
+ INetURLObject::DecodeMechanism eDecodeMechanism
+ = INetURLObject::DECODE_TO_IURI,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ bool bRelativeNonURIs = false,
+ INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT);
+
+UniString
+SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
+ UniString const & rTheRelURIRef,
+ Link const & rMaybeFileHdl = Link(),
+ bool bCheckFileExists = true,
+ bool bIgnoreFragment = false,
+ INetURLObject::EncodeMechanism eEncodeMechanism
+ = INetURLObject::WAS_ENCODED,
+ INetURLObject::DecodeMechanism eDecodeMechanism
+ = INetURLObject::DECODE_TO_IURI,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ bool bRelativeNonURIs = false,
+ INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT);
+
+//============================================================================
+void SetMaybeFileHdl(Link const & rTheMaybeFileHdl);
+
+//============================================================================
+Link GetMaybeFileHdl();
+
+//============================================================================
+inline UniString
+SmartRelToAbs(ByteString const & rTheRelURIRef,
+ bool bIgnoreFragment = false,
+ INetURLObject::EncodeMechanism eEncodeMechanism
+ = INetURLObject::WAS_ENCODED,
+ INetURLObject::DecodeMechanism eDecodeMechanism
+ = INetURLObject::DECODE_TO_IURI,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT)
+{
+ return SmartRel2Abs(INetURLObject(INetURLObject::GetBaseURL()),
+ rTheRelURIRef, GetMaybeFileHdl(), true,
+ bIgnoreFragment, eEncodeMechanism, eDecodeMechanism,
+ eCharset, false, eStyle);
+}
+
+inline UniString
+SmartRelToAbs(UniString const & rTheRelURIRef,
+ bool bIgnoreFragment = false,
+ INetURLObject::EncodeMechanism eEncodeMechanism
+ = INetURLObject::WAS_ENCODED,
+ INetURLObject::DecodeMechanism eDecodeMechanism
+ = INetURLObject::DECODE_TO_IURI,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT)
+{
+ return SmartRel2Abs(INetURLObject(INetURLObject::GetBaseURL()),
+ rTheRelURIRef, GetMaybeFileHdl(), true,
+ bIgnoreFragment, eEncodeMechanism, eDecodeMechanism,
+ eCharset, false, eStyle);
+}
+
+//============================================================================
+UniString
+FindFirstURLInText(UniString const & rText,
+ xub_StrLen & rBegin,
+ xub_StrLen & rEnd,
+ CharClass const & rCharClass,
+ INetURLObject::EncodeMechanism eMechanism
+ = INetURLObject::WAS_ENCODED,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
+ INetURLObject::FSysStyle eStyle
+ = INetURLObject::FSYS_DETECT);
+
+//============================================================================
+/** Remove any password component from both absolute and relative URLs.
+
+ @ATT The current implementation will not remove a password from a
+ relative URL that has an authority component (e.g., the password is not
+ removed from the relative ftp URL <//user:password@domain/path>). But
+ since our functions to translate between absolute and relative URLs never
+ produce relative URLs with authority components, this is no real problem.
+
+ @ATT For relative URLs (or anything not recognized as an absolute URI),
+ the current implementation will return the input unmodified, not applying
+ any translations implied by the encode/decode parameters.
+
+ @param rURI An absolute or relative URI reference.
+
+ @param eEncodeMechanism See the general discussion for INetURLObject set-
+ methods.
+
+ @param eDecodeMechanism See the general discussion for INetURLObject get-
+ methods.
+
+ @param eCharset See the general discussion for INetURLObject get- and
+ set-methods.
+
+ @return The input URI with any password component removed.
+ */
+UniString
+removePassword(UniString const & rURI,
+ INetURLObject::EncodeMechanism eEncodeMechanism
+ = INetURLObject::WAS_ENCODED,
+ INetURLObject::DecodeMechanism eDecodeMechanism
+ = INetURLObject::DECODE_TO_IURI,
+ rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
+
+//============================================================================
+/** Query the notational conventions used in the file system provided by some
+ file content provider.
+
+ @param rFileUrl This file URL determines which file content provider is
+ used to query the desired information. (The UCB's usual mapping from URLs
+ to content providers is used.)
+
+ @param bAddConvenienceStyles If true, the return value contains not only
+ the style bit corresponding to the queried content provider's conventions,
+ but may also contain additional style bits that make using this function
+ more convenient in certain situations. Currently, the effect is that
+ FSYS_UNX is extended with FSYS_VOS, and both FSYS_DOS and FSYS_MAC are
+ extended with FSYS_VOS and FSYS_UNX (i.e., the---unambiguous---detection
+ of VOS style and Unix style file system paths is always enabled); also, in
+ case the content provider's conventions cannot be determined, FSYS_DETECT
+ is returned instead of FSysStyle(0).
+
+ @return The style bit corresponding to the queried content provider's
+ conventions, or FSysStyle(0) if these cannot be determined.
+ */
+INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl,
+ bool bAddConvenienceStyles = true)
+ throw (com::sun::star::uno::RuntimeException);
+
+}
+
+#endif // SVTOOLS_URIHELPER_HXX
diff --git a/svtools/inc/urlbmk.hxx b/svtools/inc/urlbmk.hxx
new file mode 100644
index 000000000000..b01a662e5728
--- /dev/null
+++ b/svtools/inc/urlbmk.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * $RCSfile: urlbmk.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _URLBMK_HXX
+#define _URLBMK_HXX
+
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+class SvData;
+class SotDataObject;
+
+//=========================================================================
+
+class INetBookmark
+
+/* [Beschreibung]
+
+ Diese Klasse stellt ein Bookmark dar, welches aus einer URL und
+ einem dazuge"horigen Beschreibungstext besteht.
+
+ Es gibt ein eigenes Clipboardformat und Hilfsmethoden zum Kopieren
+ und Einf"ugen in und aus Clipboard und DragServer.
+*/
+
+{
+ String aUrl;
+ String aDescr;
+
+protected:
+ String CopyExchange() const;
+ void PasteExchange( String aString );
+
+ void SetURL( const String& rS ) { aUrl = rS; }
+ void SetDescription( const String& rS ) { aDescr = rS; }
+
+public:
+ INetBookmark( const String &rUrl, const String &rDescr )
+ : aUrl( rUrl ), aDescr( rDescr )
+ {}
+ INetBookmark()
+ {}
+
+ const String& GetURL() const { return aUrl; }
+ const String& GetDescription() const { return aDescr; }
+
+ static BOOL ClipboardHasFormat();
+ static BOOL DragServerHasFormat( USHORT nItem );
+
+ BOOL CopyClipboard() const;
+ BOOL CopyDragServer() const;
+ BOOL PasteClipboard();
+ BOOL PasteDragServer( USHORT nItem );
+
+ BOOL SetData( SvData& rData ) const;
+ static ULONG HasFormat( const SotDataObject& rObj );
+ BOOL Copy( SotDataObject& rObj ) const;
+ BOOL Paste( SotDataObject& rObj, ULONG nFormat );
+
+ BOOL _SetData( SvData& rData ) const
+ { return INetBookmark::SetData( rData ); }
+ static ULONG _HasFormat( const SotDataObject& rObj )
+ { return INetBookmark::HasFormat( rObj ); }
+ BOOL _Copy( SotDataObject& rObj ) const
+ { return INetBookmark::Copy( rObj ); }
+ BOOL _Paste( SotDataObject& rObj, ULONG nFormat )
+ { return INetBookmark::Paste( rObj, nFormat ); }
+
+};
+
+
+#endif
+
diff --git a/svtools/inc/wallitem.hxx b/svtools/inc/wallitem.hxx
new file mode 100644
index 000000000000..63e36b946cae
--- /dev/null
+++ b/svtools/inc/wallitem.hxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * $RCSfile: wallitem.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _WALLITEM_HXX
+#define _WALLITEM_HXX
+
+#ifndef SHL_HXX
+#include <tools/shl.hxx>
+#endif
+
+// -----------------------------------------------------------------------------------------
+// Hilfsklasse, um die Download-Funktionalitaet des SvxBrushItems unterhalb
+// des SVX zu benutzen. Der Link wird im Konstruktor von SvxDialogDll gesetzt.
+#ifndef _SFX_BRUSHITEMLINK_DECLARED
+#define _SFX_BRUSHITEMLINK_DECLARED
+#ifndef _SV_GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+
+#ifndef SHL_BRUSHITEM
+#define SHL_BRUSHITEM SHL_SHL1
+#endif
+
+class Window;
+class SfxItemSet;
+
+typedef void* (*CreateSvxBrushTabPage)(Window *pParent, const SfxItemSet &rAttrSet);
+typedef USHORT* (*GetSvxBrushTabPageRanges)();
+
+class Graphic;
+class String;
+class SfxBrushItemLink
+{
+public:
+ virtual Graphic GetGraphic( const String& rLink, const String& rFilter) = 0;
+ virtual CreateSvxBrushTabPage GetBackgroundTabpageCreateFunc() = 0;
+ virtual GetSvxBrushTabPageRanges GetBackgroundTabpageRanges() = 0;
+ static SfxBrushItemLink* Get() { return *(SfxBrushItemLink**)GetAppData(SHL_BRUSHITEM); }
+ static void Set( SfxBrushItemLink* pLink );
+};
+#endif // _SFX_BRUSHITEMLINK_DECLARED
+// -----------------------------------------------------------------------------------------
+
+#ifndef _SFX_BRUSHITEMLINK
+
+#ifndef _RTTI_HXX
+#include <tools/rtti.hxx>
+#endif
+#ifndef _SV_WALL_HXX
+#include <vcl/wall.hxx>
+#endif
+
+#include "poolitem.hxx"
+
+class SvStream;
+class Graphic;
+
+DBG_NAMEEX(SfxWallpaperItem);
+
+class SfxWallpaperItem : public SfxPoolItem
+{
+private:
+ Wallpaper _aWallpaper;
+ XubString _aURL;
+ XubString _aFilter;
+ USHORT _nFlags;
+ BOOL IsDownloaded() const;
+ void Download();
+public:
+ TYPEINFO();
+
+ SfxWallpaperItem( USHORT nWhich );
+ SfxWallpaperItem( USHORT nWhich, SvStream& rStream, USHORT nVersion );
+ SfxWallpaperItem( const SfxWallpaperItem& rCpy );
+ SfxWallpaperItem( USHORT nWhich, const Wallpaper& );
+ ~SfxWallpaperItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const;
+ virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+
+ virtual BOOL QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId = 0 ) const;
+ virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId = 0 );
+
+ void SetBitmapURL( const XubString& rURL, const XubString& rFilter );
+ void SetGraphic( const Graphic& rGraphic, BOOL bKeepLink=FALSE );
+ void SetColor( const Color& rColor ) { _aWallpaper.SetColor(rColor); }
+ void SetStyle( WallpaperStyle eStyle ) { _aWallpaper.SetStyle(eStyle); }
+
+ const Wallpaper& GetWallpaper( BOOL bNeedsBitmap = TRUE ) const;
+ const XubString& GetBitmapURL() const { return _aURL; }
+ const XubString& GetBitmapFilter() const { return _aFilter; }
+};
+
+class WallpaperLoader_Impl;
+class CntWallpaperItem;
+
+class WallpaperLoader : public SvRefBase
+{
+ WallpaperLoader_Impl *pImp;
+
+public:
+
+ WallpaperLoader( const CntWallpaperItem& rItem);
+ ~WallpaperLoader();
+
+ void RequestData( const Link& rLink );
+ const Wallpaper& GetWallpaper() const;
+ void Done();
+ void SetBitmap( SvStream* pStream );
+};
+
+SV_DECL_REF( WallpaperLoader );
+SV_IMPL_REF( WallpaperLoader );
+
+#endif // _SFX_BRUSHITEM_LINK
+
+
+////////////////////////////////////////////////////////////////////////////////
+/*
+ $Log: not supported by cvs2svn $
+ Revision 1.15 2000/09/18 14:13:18 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.14 2000/08/31 13:41:16 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.13 2000/03/22 11:47:48 kso
+ Removed: SmartUno leftovers.
+
+ Revision 1.12 2000/03/21 11:39:32 kso
+ Added: [Put|QueryValue( ... com::sun::star::uno::Any ... )
+
+ Revision 1.11 2000/02/09 16:16:37 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.10 1999/08/19 14:23:00 dv
+ no include cntwall.hxx needed
+
+ Revision 1.9 1999/08/18 23:33:43 hjs
+ includes
+
+ Revision 1.8 1999/08/18 09:17:45 dv
+ #66082# The WallpaperLoader is now constructed with a CntWallpaperItem
+
+ Revision 1.7 1999/06/25 09:02:25 dv
+ #63380# WallpaperLoader neu
+
+ Revision 1.6 1999/06/15 12:29:07 hjs
+ once again...
+
+ Revision 1.4 1998/08/13 15:17:28 DV
+ #52764# Put/Query Value neu
+
+ Rev 1.3 13 Aug 1998 17:17:28 DV
+ #52764# Put/Query Value neu
+
+ Rev 1.2 03 Jul 1998 09:42:08 OV
+ Impl.
+
+ Rev 1.1 01 Jul 1998 09:28:02 OV
+ Erweiterungen, Umstellungen
+
+ Rev 1.0 30 Jun 1998 10:50:56 OV
+ Neu: SfxWallpaperItem
+
+*/
+
+#endif // _WALLITEM_HXX
+
diff --git a/svtools/inc/whiter.hxx b/svtools/inc/whiter.hxx
new file mode 100644
index 000000000000..342a0e2fe0ee
--- /dev/null
+++ b/svtools/inc/whiter.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: whiter.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SFX_WHITER_HXX
+#define _SFX_WHITER_HXX
+
+#include <limits.h>
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+class SfxItemSet;
+
+
+// INCLUDE ---------------------------------------------------------------
+
+class SfxWhichIter
+{
+ const USHORT *pRanges, *pStart;
+ USHORT nOfst, nFrom, nTo;
+public:
+ SfxWhichIter( const SfxItemSet& rSet, USHORT nFrom = 0, USHORT nTo = USHRT_MAX );
+ ~SfxWhichIter();
+
+ USHORT GetCurWhich() const { return *pRanges + nOfst; }
+ USHORT NextWhich();
+ USHORT PrevWhich();
+
+ USHORT FirstWhich();
+ USHORT LastWhich();
+};
+
+#endif
diff --git a/svtools/inc/whmap.hxx b/svtools/inc/whmap.hxx
new file mode 100644
index 000000000000..c15f6b86112e
--- /dev/null
+++ b/svtools/inc/whmap.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * $RCSfile: whmap.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SFX_WHMAP_HXX
+#define _SFX_WHMAP_HXX
+
+#include <solar.h>
+
+struct SfxWhichMapEntry
+{
+ USHORT nWhichId;
+ USHORT nSlotId;
+};
+
+class SfxWhichMap
+{
+ const SfxWhichMapEntry *pMap;
+
+public:
+ inline SfxWhichMap( const SfxWhichMapEntry *pMappings = 0 );
+ virtual ~SfxWhichMap();
+
+ int IsNull() const
+ { return 0 == pMap; }
+ virtual USHORT GetWhich(USHORT nSlot) const;
+ virtual USHORT GetSlot(USHORT nWhich) const;
+ virtual SfxWhichMap*Clone() const;
+};
+
+inline SfxWhichMap::SfxWhichMap( const SfxWhichMapEntry *pMappings ):
+ pMap( pMappings )
+{
+}
+
+#endif
diff --git a/svtools/inc/xbmread.hxx b/svtools/inc/xbmread.hxx
new file mode 100644
index 000000000000..e501d7e9e180
--- /dev/null
+++ b/svtools/inc/xbmread.hxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * $RCSfile: xbmread.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XBMREAD_HXX
+#define _XBMREAD_HXX
+
+#ifdef VCL
+
+#ifndef _GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#ifndef _BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+
+#else // VCL
+
+#ifndef _GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _FLTDEFS_HXX
+#include "fltdefs.hxx"
+#endif
+
+#endif // VCL
+
+#ifdef _XBMPRIVATE
+
+// ---------
+// - Enums -
+// ---------
+
+enum XBMFormat
+{
+ XBM10,
+ XBM11
+};
+
+enum ReadState
+{
+ XBMREAD_OK,
+ XBMREAD_ERROR,
+ XBMREAD_NEED_MORE
+};
+
+// -------------
+// - XBMReader -
+// -------------
+
+#ifdef VCL
+
+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, void* pCallData );
+ virtual ~XBMReader();
+
+ ReadState ReadXBM( Graphic& rGraphic );
+};
+
+#else // VCL
+
+class XBMReader : public GraphicReader
+{
+ SvStream& rIStm;
+ PDIBBYTE pMonoDIB;
+ PDIBBYTE pMonoDIBBytes;
+ PDIBBYTE pRow1;
+ PDIBBYTE pMonoFile;
+ short pHexTable[ 256 ];
+ long nLastPos;
+ long nWidth;
+ long nHeight;
+ long nWidthAl1;
+ long nMonoTotal;
+ BOOL bStatus;
+
+ void InitTable();
+ void CreateMonoDIB( long nWidth, long nHeight );
+ void CreateGraphic( Graphic& rGraphic );
+ String FindTokenLine( SvStream* pInStm, const char* pTok1,
+ const char* pTok2 = NULL, const char* pTok3 = NULL );
+ long ParseDefine( const char* pDefine );
+ BOOL ParseData( SvStream* pInStm, const String& aLastLine, XBMFormat eFormat );
+
+
+public:
+
+ XBMReader( SvStream& rStm, void* pCallData );
+ virtual ~XBMReader();
+
+ ReadState ReadXBM( Graphic& rGraphic );
+};
+
+#endif // VCL
+#endif // _XBMPRIVATE
+
+// -------------
+// - ImportXBM -
+// -------------
+
+BOOL ImportXBM( SvStream& rStream, Graphic& rGraphic, void* pCallerData );
+
+#endif // _XBMREAD_HXX
diff --git a/svtools/inc/xmlcnimp.hxx b/svtools/inc/xmlcnimp.hxx
new file mode 100644
index 000000000000..073845bed911
--- /dev/null
+++ b/svtools/inc/xmlcnimp.hxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlcnimp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_XMLCNIMP_HXX
+#define _SVTOOLS_XMLCNIMP_HXX
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+
+#ifndef _SVARRAY_HXX
+#include "svarray.hxx"
+#endif
+
+#ifndef _SVTOOLS_NMSPMAP_HXX
+#include <xmloff/nmspmap.hxx>
+#endif
+
+namespace rtl { class OUString; }
+
+typedef ::rtl::OUString *OUStringPtr;
+SV_DECL_PTRARR_DEL( OUStringsDtor2_Impl, OUStringPtr, 5, 5 )
+
+class SvXMLAttrContainerItem_Impl
+{
+ SvXMLNamespaceMap aNamespaceMap;
+ SvUShorts aPrefixPoss;
+ OUStringsDtor2_Impl aLNames;
+ OUStringsDtor2_Impl aValues;
+
+ inline sal_uInt16 GetPrefixPos( sal_uInt16 i ) const;
+public:
+
+ SvXMLAttrContainerItem_Impl( const SvXMLAttrContainerItem_Impl& rImpl );
+ SvXMLAttrContainerItem_Impl();
+
+ int operator ==( const SvXMLAttrContainerItem_Impl& rCmp ) const;
+
+ BOOL AddAttr( const ::rtl::OUString& rLName, const NAMESPACE_RTL(OUString)& rValue );
+ BOOL AddAttr( const ::rtl::OUString& rPrefix, const NAMESPACE_RTL(OUString)& rNamespace,
+ const ::rtl::OUString& rLName, const NAMESPACE_RTL(OUString)& rValue );
+ BOOL AddAttr( const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rLName,
+ const ::rtl::OUString& rValue );
+
+ sal_uInt16 GetAttrCount() const { return aLNames.Count(); }
+ inline ::rtl::OUString GetAttrNamespace( sal_uInt16 i ) const;
+ inline ::rtl::OUString GetAttrPrefix( sal_uInt16 i ) const;
+ inline const ::rtl::OUString& GetAttrLName( sal_uInt16 i ) const;
+ inline const ::rtl::OUString& GetAttrValue( sal_uInt16 i ) const;
+
+ sal_uInt16 GetFirstNamespaceIndex() const { return aNamespaceMap.GetFirstIndex(); }
+ sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const { return aNamespaceMap.GetNextIndex( nIdx ); }
+ inline const ::rtl::OUString& GetNamespace( sal_uInt16 i ) const;
+ inline const ::rtl::OUString& GetPrefix( sal_uInt16 i ) const;
+
+ BOOL SetAt( sal_uInt16 i,
+ const ::rtl::OUString& rLName, const NAMESPACE_RTL(OUString)& rValue );
+ BOOL SetAt( sal_uInt16 i,
+ const ::rtl::OUString& rPrefix, const NAMESPACE_RTL(OUString)& rNamespace,
+ const ::rtl::OUString& rLName, const NAMESPACE_RTL(OUString)& rValue );
+ BOOL SetAt( sal_uInt16 i,
+ const ::rtl::OUString& rPrefix,
+ const ::rtl::OUString& rLName,
+ const ::rtl::OUString& rValue );
+
+ void Remove( sal_uInt16 i );
+};
+
+inline sal_uInt16 SvXMLAttrContainerItem_Impl::GetPrefixPos( sal_uInt16 i ) const
+{
+// DBG_ASSERT( i >= 0 && i < aPrefixPoss.Count(),
+// "SvXMLAttrContainerItem_Impl::GetPrefixPos: illegal index" );
+ return aPrefixPoss[i];
+}
+
+inline ::rtl::OUString SvXMLAttrContainerItem_Impl::GetAttrNamespace( sal_uInt16 i ) const
+{
+ ::rtl::OUString sRet;
+ sal_uInt16 nPos = GetPrefixPos( i );
+ if( USHRT_MAX != nPos )
+ sRet = aNamespaceMap.GetNameByIndex( nPos );
+ return sRet;
+}
+
+inline ::rtl::OUString SvXMLAttrContainerItem_Impl::GetAttrPrefix( sal_uInt16 i ) const
+{
+ ::rtl::OUString sRet;
+ sal_uInt16 nPos = GetPrefixPos( i );
+ if( USHRT_MAX != nPos )
+ sRet = aNamespaceMap.GetPrefixByIndex( nPos );
+ return sRet;
+}
+
+inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetAttrLName(sal_uInt16 i) const
+{
+ DBG_ASSERT( i >= 0 && i < aLNames.Count(),
+ "SvXMLAttrContainerItem_Impl::GetLName: illegal index" );
+ return *aLNames[i];
+}
+
+inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetAttrValue(sal_uInt16 i) const
+{
+ DBG_ASSERT( i >= 0 && i < aValues.Count(),
+ "SvXMLAttrContainerItem_Impl::GetValue: illegal index" );
+ return *aValues[i];
+}
+
+inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetNamespace(
+ sal_uInt16 i ) const
+{
+ return aNamespaceMap.GetNameByIndex( i );
+}
+
+inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetPrefix( sal_uInt16 i ) const
+{
+ return aNamespaceMap.GetPrefixByIndex( i );
+}
+
+#endif
+
diff --git a/svtools/inc/xmlement.hxx b/svtools/inc/xmlement.hxx
new file mode 100644
index 000000000000..bdbd19f4ed28
--- /dev/null
+++ b/svtools/inc/xmlement.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlement.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_XMLEMENT_HXX
+#define _SVTOOLS_XMLEMENT_HXX
+
+#ifndef _SAL_TYPES_H
+#include <sal/types.h>
+#endif
+
+struct SvXMLEnumMapEntry
+{
+ const sal_Char *pName;
+ sal_uInt16 nValue;
+};
+
+
+#endif // _SVTOOLS_XMLEMENT_HXX
+
diff --git a/svtools/inc/xpmread.hxx b/svtools/inc/xpmread.hxx
new file mode 100644
index 000000000000..e54fc13414b1
--- /dev/null
+++ b/svtools/inc/xpmread.hxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * $RCSfile: xpmread.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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, void* pCallData );
+ virtual ~XPMReader();
+
+ ReadState ReadXPM( Graphic& rGraphic );
+};
+
+#endif // _XPMPRIVATE
+
+// -------------
+// - ImportXPM -
+// -------------
+
+BOOL ImportXPM( SvStream& rStream, Graphic& rGraphic, void* pCallerData );
+
+#endif // _XPMREAD_HXX
diff --git a/svtools/inc/zforfind.hxx b/svtools/inc/zforfind.hxx
new file mode 100644
index 000000000000..60f9c590b6b3
--- /dev/null
+++ b/svtools/inc/zforfind.hxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * $RCSfile: zforfind.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _ZFORFIND_HXX
+#define _ZFORFIND_HXX
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+class International;
+class Date;
+class SvNumberformat;
+class SvNumberFormatter;
+
+// passiert in "string.hxx":
+//
+// #ifdef ENABLEUNICODE /* bei Unicode */
+// #define XubString UniString /* Wide-Strings */
+// #define xub_Unicode sal_Unicode /* Wide-Character */
+// #else /* sonst */
+// #define XubString String /* normale Strings */
+// #define xub_Unicode char /* normaler char */
+// #endif
+
+#define SV_MAX_ANZ_INPUT_STRINGS 20 // max. Anzahl der Sub-Strings
+
+class ImpSvNumberInputScan
+{
+public: // ---- oeffentlicher Teil
+ ImpSvNumberInputScan( SvNumberFormatter* pFormatter );
+ ~ImpSvNumberInputScan();
+
+/*!*/ void ChangeIntl(); // MUST be called if language changes
+
+ void ChangeNullDate( // Referenzdatum setzen
+ const USHORT nDay,
+ const USHORT nMonth,
+ const USHORT nYear );
+
+ BOOL IsNumberFormat( // Eingabe in Zahl umwandeln
+ const XubString& rString, // Eingabestring
+ short& F_Type, // Typus, Format (in + out)
+ double& fOutNumber, // ermittelter Wert
+ const SvNumberformat* pFormat = NULL ); // evtl. gesetztes Zahlenformat
+
+ // nach IsNumberFormat:
+ short GetDecPos() const { return nDecPos; }
+ USHORT GetAnzNums() const { return nAnzNums; }
+ void SetYear2000( USHORT nVal ) { nYear2000 = nVal; }
+ USHORT GetYear2000() const { return nYear2000; }
+
+private: // ---- privater Teil
+ SvNumberFormatter* pFormatter;
+ XubString aUpperMonthText[12]; // Die 12 Monate
+ XubString aUpperAbbrevMonthText[12]; // Die 12 Monate, abgekuerzt
+ XubString aUpperDayText[7]; // Die 7 Wochentage
+ XubString aUpperAbbrevDayText[7]; // Die 7 Wochentage, abgekuerzt
+ XubString aUpperCurrSymbol; // Das Waehrungssymbol
+ BOOL bTextInitialized; // Sind Monate und Wochentage initialisert?
+ Date* pNullDate; // "1.1.1900"
+ // Variablen für Zwischenergebnisse:
+ XubString sStrArray[SV_MAX_ANZ_INPUT_STRINGS]; // Array der Zahl- oder Str.-Symbole
+ BOOL IsNum[SV_MAX_ANZ_INPUT_STRINGS]; // Markiert die Zahl-Symb.
+ USHORT nNums[SV_MAX_ANZ_INPUT_STRINGS]; // Die Zahlen in Reihenfolge
+ USHORT nAnzStrings; // Gesamtzahl der Symbole
+ USHORT nAnzNums; // Anzahl der Zahlensymbole
+ BOOL bDecSepInDateSeps; // True <=> DecSep in {.,-,/,DateSep}
+
+ short nSign; // Vorzeichen der Zahl
+ short nMonth; // Monat(1..12), falls Datum
+ // negativ => Kurzformat
+ short nMonthPos; // 1 = vorn, 2 = Mitte
+ // 3 = hinten
+ USHORT nTimePos; // Index of first time separator (+1)
+ short nDecPos; // Index des Strings mit ", " (+1)
+ short nNegCheck; // '( )' fuer negativ
+ short nESign; // Vorzeichen Exp
+ short nAmPm; // +1 AM, -1 PM, sonst 0
+ short nLogical; // -1 => False, 1 => True
+ USHORT nThousand; // Anz. der Tausenderpkte.
+ USHORT nPosThousandString; // Position des zusammenge-
+ // fassten 000.000.000-Strings
+ short eScannedType; // Typ gemaess Scan
+ short eSetType; // Typ gemaess Zelle
+
+ USHORT nStringScanNumFor; // fixe Strings erkannt in
+ // pFormat->NumFor[nNumForStringScan]
+ short nStringScanSign; // Vorzeichen durch FixString
+ USHORT nYear2000; // Bis zu welcher Zahl zweistellige
+ // Jahresangaben als 20xx erkannt
+ // werden, default 18
+ // Zahl <= nYear2000 => 20xx
+ // Zahl > nYear2000 => 19xx
+
+#ifdef _ZFORFIND_CXX // ----- private Methoden -----
+ void Reset(); // Reset aller Variablen vor Analysestart
+
+ void InitText(); // Monate und Wochentage initialisieren
+
+ double StringToDouble( // String in double umwandlen
+ const XubString& rStr );
+
+ BOOL NextNumberStringSymbol( // Naechstes Zahl/String Symbol
+ const xub_Unicode*& pStr,
+ XubString& rSymbol );
+
+ BOOL SkipThousands( // Fasst .000.123 Bloecke in
+ const xub_Unicode*& pStr, // der Eingabe zusammen 000123
+ XubString& rSymbol );
+ void NumberStringDivision( // Zerlegen in Zahlen/Strings in obige Arrays und Var.
+ const XubString& rString ); // Leerzeichen am Anfang und hinter Zahlen fallen weg!
+
+ static BOOL StringContains( // if rString contains rWhat at nPos
+ const XubString& rWhat,
+ const XubString& rString,
+ xub_StrLen nPos );
+ static inline BOOL SkipChar( // spezielles Zeichen ueberspringen
+ xub_Unicode c,
+ const XubString& rString,
+ xub_StrLen& nPos );
+ static inline void SkipBlanks( // ueberspringe Leerzeichen
+ const XubString& rString,
+ xub_StrLen& nPos );
+ static inline BOOL SkipString( // jump over rWhat in rString at nPos
+ const XubString& rWhat,
+ const XubString& rString,
+ xub_StrLen& nPos );
+
+ inline BOOL GetThousandSep( // erkennt genau .111 als Tausenderpunkt
+ const XubString& rString,
+ xub_StrLen& nPos,
+ USHORT nStringPos );
+ short GetLogical( // logischen Wert holen
+ const XubString& rString );
+ short GetMonth( // Monat holen
+ const XubString& rString,
+ xub_StrLen& nPos );
+ short GetDayOfWeek( // Wochentag holen
+ const XubString& rString,
+ xub_StrLen& nPos );
+ BOOL GetCurrency( // Waehrungssysmbol holen
+ const XubString& rString,
+ xub_StrLen& nPos,
+ const SvNumberformat* pFormat = NULL ); // evtl. gesetztes Zahlenformat
+ BOOL GetTimeAmPm( // Symbol Am od. Pm holen
+ const XubString& rString,
+ xub_StrLen& nPos );
+ inline BOOL GetDecSep( // Dezimaltrenner holen
+ const XubString& rString,
+ xub_StrLen& nPos );
+ short GetSign( // Vorzeichen holen
+ const XubString& rString, // mit Sonderfall '('
+ xub_StrLen& nPos );
+ short GetESign( // Vorzeichen holen
+ const XubString& rString, // f. Exponent
+ xub_StrLen& nPos );
+
+ inline BOOL GetNextNumber( // Naechste Zahl holen
+ USHORT& i,
+ USHORT& j );
+ void GetTimeRef( // Umwandlung Zeit -> double (nur Nachkomma)
+ double& fOutNumber, // Ergebniss als double
+ USHORT nIndex, // Index der Stunde in der Eingabe,
+ USHORT nAnz ); // Anz der Zeitstrings in der Eingabe
+ USHORT ImplGetDay ( USHORT nIndex ); // Tag: Eingabe od. aktuell
+ USHORT ImplGetMonth( USHORT nIndex ); // Monat: Eingabe od. aktuell
+ USHORT ImplGetYear ( USHORT nIndex ); // Jahr: nix: aktuell, xx=19xx
+ BOOL GetDateRef( // Umwandlung Datum -> Date
+ Date& aDt,
+ USHORT& nCounter, // zaehlt Datumsstrings
+ const SvNumberformat* pFormat = NULL ); // evtl. gesetztes Zahlenformat
+
+ BOOL ScanStartString( // Analyse des Anfangs
+ const XubString& rString,
+ const SvNumberformat* pFormat = NULL );
+ BOOL ScanMidString( // Analyse der Mitte
+ const XubString& rString,
+ USHORT nStringPos );
+ BOOL ScanEndString( // Analyse des Endes
+ const XubString& rString,
+ const SvNumberformat* pFormat = NULL );
+
+ BOOL ScanStringNumFor(
+ const XubString& rString,
+ xub_StrLen nPos,
+ const SvNumberformat* pFormat,
+ USHORT nString );
+ // String mit TeilString nString aus Format vergleichen,
+ // nString == 0xFFFF => letzter
+
+ BOOL IsNumberFormatMain( // Verteilfunktion zur Analyse
+ const XubString& rString,
+ double& fOutNumber, // Rueckgabewert, falls als Zahl darstellbar
+ const SvNumberformat* pFormat = NULL ); // evtl. gesetztes Zahlenformat
+
+
+#endif // _ZFORFIND_CXX
+};
+
+
+
+#endif // _ZFORFIND_HXX
diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst
new file mode 100644
index 000000000000..60887b49439b
--- /dev/null
+++ b/svtools/prj/d.lst
@@ -0,0 +1,267 @@
+mkdir: %_DEST%\inc%_EXT%\svtools
+
+..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs
+..\%__SRC%\lib\_notify.lib %_DEST%\lib%_EXT%\_notify.lib
+..\%__SRC%\lib\_libcall.lib %_DEST%\lib%_EXT%\_libcall.lib
+..\%__SRC%\lib\_ctrl.lib %_DEST%\lib%_EXT%\_ctrl.lib
+..\%__SRC%\lib\ctrl.lib %_DEST%\lib%_EXT%\ctrl.lib
+..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib
+..\%__SRC%\lib\undo.lib %_DEST%\lib%_EXT%\undo.lib
+..\%__SRC%\lib\misc.lib %_DEST%\lib%_EXT%\misc.lib
+..\%__SRC%\lib\dialogs.lib %_DEST%\lib%_EXT%\dialogs.lib
+..\%__SRC%\lib\edit.lib %_DEST%\lib%_EXT%\edit.lib
+..\%__SRC%\lib\eaimp.lib %_DEST%\lib%_EXT%\eaimp.lib
+..\%__SRC%\lib\svcontnr.lib %_DEST%\lib%_EXT%\svcontnr.lib
+..\%__SRC%\lib\svmem.lib %_DEST%\lib%_EXT%\svmem.lib
+..\%__SRC%\lib\ssvmem.lib %_DEST%\lib%_EXT%\ssvmem.lib
+..\%__SRC%\lib\svdde.lib %_DEST%\lib%_EXT%\svdde.lib
+..\%__SRC%\lib\svtool.lib %_DEST%\lib%_EXT%\svtool.lib
+..\%__SRC%\slb\svt.lib %_DEST%\lib%_EXT%\xsvtool.lib
+..\%__SRC%\obj\wordsel2.obj %_DEST%\lib%_EXT%\xword2.obj
+..\%__SRC%\lib\filearch.lib %_DEST%\lib%_EXT%\filearch.lib
+..\%__SRC%\bin\dllver.exe %_DEST%\bin%_EXT%\dllver.exe
+..\%__SRC%\bin\dllver %_DEST%\bin%_EXT%\dllver
+..\%__SRC%\bin\svt%UPD%*.dll %_DEST%\bin%_EXT%\svt%UPD%*.dll
+..\%__SRC%\bin\svt%UPD%*.res %_DEST%\bin%_EXT%\svt%UPD%*.res
+..\%__SRC%\bin\svs%UPD%*.res %_DEST%\bin%_EXT%\svs%UPD%*.res
+..\%__SRC%\bin\bmp%UPD%*.res %_DEST%\bin%_EXT%\bmp%UPD%*.res
+..\%__SRC%\bin\san%UPD%*.res %_DEST%\bin%_EXT%\san%UPD%*.res
+..\%__SRC%\bin\svt%UPD%*.sym %_DEST%\bin%_EXT%\svt%UPD%*.sym
+..\%__SRC%\bin\svl%UPD%*.dll %_DEST%\bin%_EXT%\svl%UPD%*.dll
+..\%__SRC%\bin\bmp.* %_DEST%\bin%_EXT%\bmp.*
+..\%__SRC%\bin\bmp %_DEST%\bin%_EXT%\bmp
+..\%__SRC%\res\bmp.* %_DEST%\bin%_EXT%\bmp.*
+..\%__SRC%\misc\svt%UPD%*.map %_DEST%\bin%_EXT%\svt%UPD%*.map
+..\%__SRC%\lib\libsvt%UPD%* %_DEST%\lib%_EXT%\*
+..\%__SRC%\lib\libsvl%UPD%* %_DEST%\lib%_EXT%\*
+..\%__SRC%\misc\svtools.hid %_DEST%\bin%_EXT%\svtools.hid
+..\%__SRC%\inc\svtools\proped.hxx %_DEST%\inc%_EXT%\svtools\proped.hxx
+
+hedabu: ..\inc\testtool.hxx %_DEST%\inc%_EXT%\svtools\testtool.hxx
+hedabu: ..\inc\flbytes.hxx %_DEST%\inc%_EXT%\svtools\flbytes.hxx
+hedabu: ..\inc\args.hxx %_DEST%\inc%_EXT%\svtools\args.hxx
+hedabu: ..\inc\agprop.hxx %_DEST%\inc%_EXT%\svtools\agprop.hxx
+hedabu: ..\inc\aeitem.hxx %_DEST%\inc%_EXT%\svtools\aeitem.hxx
+hedabu: ..\inc\adrparse.hxx %_DEST%\inc%_EXT%\svtools\adrparse.hxx
+hedabu: ..\inc\brdcst.hxx %_DEST%\inc%_EXT%\svtools\brdcst.hxx
+hedabu: ..\inc\brooker.hxx %_DEST%\inc%_EXT%\svtools\brooker.hxx
+hedabu: ..\inc\brwbox.hxx %_DEST%\inc%_EXT%\svtools\brwbox.hxx
+hedabu: ..\inc\calendar.hxx %_DEST%\inc%_EXT%\svtools\calendar.hxx
+hedabu: ..\inc\cancel.hxx %_DEST%\inc%_EXT%\svtools\cancel.hxx
+hedabu: ..\inc\cntnrsrt.hxx %_DEST%\inc%_EXT%\svtools\cntnrsrt.hxx
+hedabu: ..\inc\colrdlg.hxx %_DEST%\inc%_EXT%\svtools\colrdlg.hxx
+hedabu: ..\inc\colctrl.hxx %_DEST%\inc%_EXT%\svtools\colctrl.hxx
+hedabu: ..\inc\compat.hxx %_DEST%\inc%_EXT%\svtools\compat.hxx
+hedabu: ..\inc\ctrlbox.hxx %_DEST%\inc%_EXT%\svtools\ctrlbox.hxx
+hedabu: ..\inc\ctrltool.hxx %_DEST%\inc%_EXT%\svtools\ctrltool.hxx
+hedabu: ..\inc\config.hxx %_DEST%\inc%_EXT%\svtools\config.hxx
+hedabu: ..\inc\confitem.hxx %_DEST%\inc%_EXT%\svtools\confitem.hxx
+hedabu: ..\inc\cntwids.hrc %_DEST%\inc%_EXT%\svtools\cntwids.hrc
+hedabu: ..\inc\dateitem.hxx %_DEST%\inc%_EXT%\svtools\dateitem.hxx
+hedabu: ..\inc\dtritem.hxx %_DEST%\inc%_EXT%\svtools\dtritem.hxx
+hedabu: ..\inc\frqitem.hxx %_DEST%\inc%_EXT%\svtools\frqitem.hxx
+hedabu: ..\inc\cstitem.hxx %_DEST%\inc%_EXT%\svtools\cstitem.hxx
+hedabu: ..\inc\tfrmitem.hxx %_DEST%\inc%_EXT%\svtools\tfrmitem.hxx
+hedabu: ..\inc\cntcmpmn.hxx %_DEST%\inc%_EXT%\svtools\cntcmpmn.hxx
+hedabu: ..\inc\cntwall.hxx %_DEST%\inc%_EXT%\svtools\cntwall.hxx
+hedabu: ..\inc\itemdel.hxx %_DEST%\inc%_EXT%\svtools\itemdel.hxx
+hedabu: ..\inc\wallitem.hxx %_DEST%\inc%_EXT%\svtools\wallitem.hxx
+hedabu: ..\inc\sfontitm.hxx %_DEST%\inc%_EXT%\svtools\sfontitm.hxx
+hedabu: ..\inc\bintitem.hxx %_DEST%\inc%_EXT%\svtools\bintitem.hxx
+hedabu: ..\source\misc\demo.hxx %_DEST%\inc%_EXT%\svtools\demo.hxx
+hedabu: ..\inc\pver.hxx %_DEST%\inc%_EXT%\svtools\pver.hxx
+hedabu: ..\inc\eitem.hxx %_DEST%\inc%_EXT%\svtools\eitem.hxx
+hedabu: ..\inc\filedlg.hxx %_DEST%\inc%_EXT%\svtools\filedlg.hxx
+hedabu: ..\inc\filerec.hxx %_DEST%\inc%_EXT%\svtools\filerec.hxx
+hedabu: ..\inc\flagitem.hxx %_DEST%\inc%_EXT%\svtools\flagitem.hxx
+hedabu: ..\inc\fltcall.hxx %_DEST%\inc%_EXT%\svtools\fltcall.hxx
+hedabu: ..\inc\wmf.hxx %_DEST%\inc%_EXT%\svtools\wmf.hxx
+hedabu: ..\inc\fltdefs.hxx %_DEST%\inc%_EXT%\svtools\fltdefs.hxx
+hedabu: ..\inc\filter.hxx %_DEST%\inc%_EXT%\svtools\filter.hxx
+hedabu: ..\inc\fmtfield.hxx %_DEST%\inc%_EXT%\svtools\fmtfield.hxx
+hedabu: ..\inc\fontdlg.hxx %_DEST%\inc%_EXT%\svtools\fontdlg.hxx
+hedabu: ..\inc\hint.hxx %_DEST%\inc%_EXT%\svtools\hint.hxx
+hedabu: ..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx
+hedabu: ..\inc\inethist.hxx %_DEST%\inc%_EXT%\svtools\inethist.hxx
+hedabu: ..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\svtools\inetmsg.hxx
+hedabu: ..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\svtools\inetstrm.hxx
+hedabu: ..\inc\inidef.hxx %_DEST%\inc%_EXT%\svtools\inidef.hxx
+hedabu: ..\inc\iniman.hxx %_DEST%\inc%_EXT%\svtools\iniman.hxx
+hedabu: ..\inc\iniadrtk.hxx %_DEST%\inc%_EXT%\svtools\iniadrtk.hxx
+hedabu: ..\inc\iniprop.hxx %_DEST%\inc%_EXT%\svtools\iniprop.hxx
+hedabu: ..\inc\intitem.hxx %_DEST%\inc%_EXT%\svtools\intitem.hxx
+hedabu: ..\inc\isethint.hxx %_DEST%\inc%_EXT%\svtools\isethint.hxx
+hedabu: ..\inc\itemiter.hxx %_DEST%\inc%_EXT%\svtools\itemiter.hxx
+hedabu: ..\inc\itempool.hxx %_DEST%\inc%_EXT%\svtools\itempool.hxx
+hedabu: ..\inc\itemset.hxx %_DEST%\inc%_EXT%\svtools\itemset.hxx
+hedabu: ..\inc\lckbitem.hxx %_DEST%\inc%_EXT%\svtools\lckbitem.hxx
+hedabu: ..\inc\libcall.hxx %_DEST%\inc%_EXT%\svtools\libcall.hxx
+hedabu: ..\inc\lstner.hxx %_DEST%\inc%_EXT%\svtools\lstner.hxx
+hedabu: ..\inc\macitem.hxx %_DEST%\inc%_EXT%\svtools\macitem.hxx
+hedabu: ..\inc\memberid.hrc %_DEST%\inc%_EXT%\svtools\memberid.hrc
+hedabu: ..\inc\nranges.hxx %_DEST%\inc%_EXT%\svtools\nranges.hxx
+hedabu: ..\inc\ownlist.hxx %_DEST%\inc%_EXT%\svtools\ownlist.hxx
+hedabu: ..\inc\prgsbar.hxx %_DEST%\inc%_EXT%\svtools\prgsbar.hxx
+hedabu: ..\inc\prnsetup.hxx %_DEST%\inc%_EXT%\svtools\prnsetup.hxx
+hedabu: ..\inc\poolcach.hxx %_DEST%\inc%_EXT%\svtools\poolcach.hxx
+hedabu: ..\inc\poolitem.hxx %_DEST%\inc%_EXT%\svtools\poolitem.hxx
+hedabu: ..\inc\printer.hxx %_DEST%\inc%_EXT%\svtools\printer.hxx
+hedabu: ..\inc\printdlg.hxx %_DEST%\inc%_EXT%\svtools\printdlg.hxx
+hedabu: ..\inc\ptitem.hxx %_DEST%\inc%_EXT%\svtools\ptitem.hxx
+hedabu: ..\inc\szitem.hxx %_DEST%\inc%_EXT%\svtools\szitem.hxx
+hedabu: ..\inc\rectitem.hxx %_DEST%\inc%_EXT%\svtools\rectitem.hxx
+hedabu: ..\inc\rngitem.hxx %_DEST%\inc%_EXT%\svtools\rngitem.hxx
+hedabu: ..\inc\ruler.hxx %_DEST%\inc%_EXT%\svtools\ruler.hxx
+hedabu: ..\inc\scrwin.hxx %_DEST%\inc%_EXT%\svtools\scrwin.hxx
+hedabu: ..\inc\slstitm.hxx %_DEST%\inc%_EXT%\svtools\slstitm.hxx
+hedabu: ..\inc\smplhint.hxx %_DEST%\inc%_EXT%\svtools\smplhint.hxx
+hedabu: ..\inc\cnclhint.hxx %_DEST%\inc%_EXT%\svtools\cnclhint.hxx
+hedabu: ..\inc\inettype.hxx %_DEST%\inc%_EXT%\svtools\inettype.hxx
+hedabu: ..\inc\brwhead.hxx %_DEST%\inc%_EXT%\svtools\brwhead.hxx
+hedabu: ..\inc\solar.hrc %_DEST%\inc%_EXT%\svtools\solar.hrc
+hedabu: ..\inc\stdctrl.hxx %_DEST%\inc%_EXT%\svtools\stdctrl.hxx
+hedabu: ..\inc\stritem.hxx %_DEST%\inc%_EXT%\svtools\stritem.hxx
+hedabu: ..\inc\style.hrc %_DEST%\inc%_EXT%\svtools\style.hrc
+hedabu: ..\inc\style.hxx %_DEST%\inc%_EXT%\svtools\style.hxx
+hedabu: ..\inc\svarray.hxx %_DEST%\inc%_EXT%\svtools\svarray.hxx
+hedabu: ..\inc\svdde.hxx %_DEST%\inc%_EXT%\svtools\svdde.hxx
+hedabu: ..\inc\svtdata.hxx %_DEST%\inc%_EXT%\svtools\svtdata.hxx
+hedabu: ..\inc\tabbar.hxx %_DEST%\inc%_EXT%\svtools\tabbar.hxx
+hedabu: ..\inc\taskbar.hxx %_DEST%\inc%_EXT%\svtools\taskbar.hxx
+hedabu: ..\inc\undo.hxx %_DEST%\inc%_EXT%\svtools\undo.hxx
+hedabu: ..\inc\whiter.hxx %_DEST%\inc%_EXT%\svtools\whiter.hxx
+hedabu: ..\inc\valueset.hxx %_DEST%\inc%_EXT%\svtools\valueset.hxx
+hedabu: ..\inc\stdmenu.hxx %_DEST%\inc%_EXT%\svtools\stdmenu.hxx
+hedabu: ..\inc\headbar.hxx %_DEST%\inc%_EXT%\svtools\headbar.hxx
+hedabu: ..\inc\svicnvw.hxx %_DEST%\inc%_EXT%\svtools\svicnvw.hxx
+hedabu: ..\inc\svlbitm.hxx %_DEST%\inc%_EXT%\svtools\svlbitm.hxx
+hedabu: ..\inc\svlbox.hxx %_DEST%\inc%_EXT%\svtools\svlbox.hxx
+hedabu: ..\inc\svtabbx.hxx %_DEST%\inc%_EXT%\svtools\svtabbx.hxx
+hedabu: ..\inc\svtreebx.hxx %_DEST%\inc%_EXT%\svtools\svtreebx.hxx
+hedabu: ..\inc\treelist.hxx %_DEST%\inc%_EXT%\svtools\treelist.hxx
+hedabu: ..\inc\xtextedt.hxx %_DEST%\inc%_EXT%\svtools\xtextedt.hxx
+hedabu: ..\inc\texteng.hxx %_DEST%\inc%_EXT%\svtools\texteng.hxx
+hedabu: ..\inc\textview.hxx %_DEST%\inc%_EXT%\svtools\textview.hxx
+hedabu: ..\inc\textdata.hxx %_DEST%\inc%_EXT%\svtools\textdata.hxx
+hedabu: ..\inc\txtattr.hxx %_DEST%\inc%_EXT%\svtools\txtattr.hxx
+hedabu: ..\inc\sychconv.hxx %_DEST%\inc%_EXT%\svtools\sychconv.hxx
+hedabu: ..\inc\rcontrol.hxx %_DEST%\inc%_EXT%\svtools\rcontrol.hxx
+hedabu: ..\inc\communi.hxx %_DEST%\inc%_EXT%\svtools\communi.hxx
+hedabu: ..\inc\ttprops.hxx %_DEST%\inc%_EXT%\svtools\ttprops.hxx
+hedabu: ..\inc\ttglobal.hrc %_DEST%\inc%_EXT%\svtools\ttglobal.hrc
+hedabu: ..\inc\svtmsg.hrc %_DEST%\inc%_EXT%\svtools\svtmsg.hrc
+hedabu: ..\source\memtools\hashtab.hxx %_DEST%\inc%_EXT%\svtools\hashtab.hxx
+hedabu: ..\source\memtools\hashcont.hxx %_DEST%\inc%_EXT%\svtools\hashcont.hxx
+hedabu: ..\inc\sbx.hxx %_DEST%\inc%_EXT%\svtools\sbx.hxx
+hedabu: ..\source\sbx\sbxbase.hxx %_DEST%\inc%_EXT%\svtools\sbxbase.hxx
+hedabu: ..\inc\sbxcore.hxx %_DEST%\inc%_EXT%\svtools\sbxcore.hxx
+hedabu: ..\inc\sbxdef.hxx %_DEST%\inc%_EXT%\svtools\sbxdef.hxx
+hedabu: ..\source\sbx\sbxfac.hxx %_DEST%\inc%_EXT%\svtools\sbxfac.hxx
+hedabu: ..\inc\sbxform.hxx %_DEST%\inc%_EXT%\svtools\sbxform.hxx
+hedabu: ..\inc\sbxmeth.hxx %_DEST%\inc%_EXT%\svtools\sbxmeth.hxx
+hedabu: ..\source\sbx\sbxmstrm.hxx %_DEST%\inc%_EXT%\svtools\sbxmstrm.hxx
+hedabu: ..\inc\sbxobj.hxx %_DEST%\inc%_EXT%\svtools\sbxobj.hxx
+hedabu: ..\inc\sbxprop.hxx %_DEST%\inc%_EXT%\svtools\sbxprop.hxx
+hedabu: ..\inc\sbxvar.hxx %_DEST%\inc%_EXT%\svtools\sbxvar.hxx
+hedabu: ..\source\search\levdis.hxx %_DEST%\inc%_EXT%\svtools\levdis.hxx
+hedabu: ..\source\search\wordsel.hxx %_DEST%\inc%_EXT%\svtools\wordsel.hxx
+hedabu: ..\inc\txtcmp.hxx %_DEST%\inc%_EXT%\svtools\txtcmp.hxx
+hedabu: ..\inc\urlbmk.hxx %_DEST%\inc%_EXT%\svtools\urlbmk.hxx
+hedabu: ..\source\urlobj\inetimg.hxx %_DEST%\inc%_EXT%\svtools\inetimg.hxx
+hedabu: ..\inc\svmedit.hxx %_DEST%\inc%_EXT%\svtools\svmedit.hxx
+hedabu: ..\inc\svstdarr.hxx %_DEST%\inc%_EXT%\svtools\svstdarr.hxx
+hedabu: ..\inc\extattr.hxx %_DEST%\inc%_EXT%\svtools\extattr.hxx
+hedabu: ..\inc\metitem.hxx %_DEST%\inc%_EXT%\svtools\metitem.hxx
+hedabu: ..\inc\nfversi.hxx %_DEST%\inc%_EXT%\svtools\nfversi.hxx
+hedabu: ..\inc\wizdlg.hxx %_DEST%\inc%_EXT%\svtools\wizdlg.hxx
+hedabu: ..\inc\zforlist.hxx %_DEST%\inc%_EXT%\svtools\zforlist.hxx
+hedabu: ..\inc\zformat.hxx %_DEST%\inc%_EXT%\svtools\zformat.hxx
+hedabu: ..\inc\numuno.hxx %_DEST%\inc%_EXT%\svtools\numuno.hxx
+hedabu: ..\source\misc\filearch.hxx %_DEST%\inc%_EXT%\svtools\filearch.hxx
+hedabu: ..\inc\loginerr.hxx %_DEST%\inc%_EXT%\svtools\loginerr.hxx
+hedabu: ..\inc\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx
+hedabu: ..\source\misc\demo.hxx %_DEST%\inc%_EXT%\svtools\svtdemo.hxx
+hedabu: ..\source\uno\unoiface.hxx %_DEST%\inc%_EXT%\svtools\unoiface.hxx
+hedabu: ..\source\uno\imgprod.hxx %_DEST%\inc%_EXT%\svtools\imgprod.hxx
+hedabu: ..\inc\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx
+hedabu: ..\inc\itempro3.hxx %_DEST%\inc%_EXT%\svtools\itempro3.hxx
+hedabu: ..\inc\strcrypt.hxx %_DEST%\inc%_EXT%\svtools\strcrypt.hxx
+
+hedabu: ..\inc\imap.hxx %_DEST%\inc%_EXT%\svtools\imap.hxx
+hedabu: ..\inc\imapobj.hxx %_DEST%\inc%_EXT%\svtools\imapobj.hxx
+hedabu: ..\inc\imaprect.hxx %_DEST%\inc%_EXT%\svtools\imaprect.hxx
+hedabu: ..\inc\imapcirc.hxx %_DEST%\inc%_EXT%\svtools\imapcirc.hxx
+hedabu: ..\inc\imappoly.hxx %_DEST%\inc%_EXT%\svtools\imappoly.hxx
+hedabu: ..\inc\svtuiks.hxx %_DEST%\inc%_EXT%\svtools\svtuiks.hxx
+
+hedabu: ..\inc\parhtml.hxx %_DEST%\inc%_EXT%\svtools\parhtml.hxx
+hedabu: ..\inc\htmltokn.h %_DEST%\inc%_EXT%\svtools\htmltokn.h
+hedabu: ..\inc\htmlkywd.hxx %_DEST%\inc%_EXT%\svtools\htmlkywd.hxx
+hedabu: ..\inc\svparser.hxx %_DEST%\inc%_EXT%\svtools\svparser.hxx
+hedabu: ..\source\svhtml\htmlout.hxx %_DEST%\inc%_EXT%\svtools\htmlout.hxx
+hedabu: ..\source\svrtf\rtfout.hxx %_DEST%\inc%_EXT%\svtools\rtfout.hxx
+hedabu: ..\source\svrtf\parrtf.hxx %_DEST%\inc%_EXT%\svtools\parrtf.hxx
+hedabu: ..\source\svrtf\rtftoken.h %_DEST%\inc%_EXT%\svtools\rtftoken.h
+hedabu: ..\source\svrtf\rtfkeywd.hxx %_DEST%\inc%_EXT%\svtools\rtfkeywd.hxx
+
+hedabu: ..\source\svxml\xmlerror.h %_DEST%\inc%_EXT%\svtools\xmlerror.h
+hedabu: ..\source\svxml\xmlattr.hxx %_DEST%\inc%_EXT%\svtools\xmlattr.hxx
+hedabu: ..\source\svxml\domdoc.hxx %_DEST%\inc%_EXT%\svtools\domdoc.hxx
+
+hedabu: ..\inc\ctypeitm.hxx %_DEST%\inc%_EXT%\svtools\ctypeitm.hxx
+hedabu: ..\inc\groupset.hxx %_DEST%\inc%_EXT%\svtools\groupset.hxx
+
+hedabu: ..\inc\fmtfield.hxx %_DEST%\inc%_EXT%\svtools\fmtfield.hxx
+hedabu: ..\inc\svtoxstr.hxx %_DEST%\inc%_EXT%\svtools\svtoxstr.hxx
+hedabu: ..\inc\strmadpt.hxx %_DEST%\inc%_EXT%\svtools\strmadpt.hxx
+hedabu: ..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx
+hedabu: ..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx
+
+hedabu: ..\inc\section.hxx %_DEST%\inc%_EXT%\svtools\section.hxx
+hedabu: ..\inc\sectctr.hxx %_DEST%\inc%_EXT%\svtools\sectctr.hxx
+hedabu: ..\inc\privsplt.hxx %_DEST%\inc%_EXT%\svtools\privsplt.hxx
+hedabu: ..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx
+hedabu: ..\source\svsql\sdbsql.hxx %_DEST%\inc%_EXT%\svtools\sdbsql.hxx
+hedabu: ..\source\svsql\sdbyacc.hxx %_DEST%\inc%_EXT%\svtools\sdbyacc.hxx
+hedabu: ..\source\svsql\sdbparse.hxx %_DEST%\inc%_EXT%\svtools\sdbparse.hxx
+hedabu: ..\%__SRC%\inc\svtools\sdbbison.hxx %_DEST%\inc%_EXT%\svtools\sdbbison.hxx
+hedabu: ..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx
+hedabu: ..\source\cmdparse\cmdparse.hxx %_DEST%\inc%_EXT%\svtools\cmdparse.hxx
+
+
+hedabu: ..\inc\filectrl.hxx %_DEST%\inc%_EXT%\svtools\filectrl.hxx
+hedabu: ..\inc\cenumitm.hxx %_DEST%\inc%_EXT%\svtools\cenumitm.hxx
+hedabu: ..\inc\cintitem.hxx %_DEST%\inc%_EXT%\svtools\cintitem.hxx
+hedabu: ..\inc\custritm.hxx %_DEST%\inc%_EXT%\svtools\custritm.hxx
+
+hedabu: ..\inc\sfxecode.hxx %_DEST%\inc%_EXT%\svtools\sfxecode.hxx
+hedabu: ..\inc\ehdl.hxx %_DEST%\inc%_EXT%\svtools\ehdl.hxx
+hedabu: ..\inc\svtools.hrc %_DEST%\inc%_EXT%\svtools\svtools.hrc
+
+hedabu: ..\source\xmlfilt\attrlist.hxx %_DEST%\inc%_EXT%\svtools\attrlist.hxx
+hedabu: ..\source\xmlfilt\i18nmap.hxx %_DEST%\inc%_EXT%\svtools\i18nmap.hxx
+hedabu: ..\inc\nmspmap.hxx %_DEST%\inc%_EXT%\svtools\nmspmap.hxx
+hedabu: ..\source\xmlfilt\xmltkmap.hxx %_DEST%\inc%_EXT%\svtools\xmltkmap.hxx
+hedabu: ..\source\xmlfilt\xmlkywd.hxx %_DEST%\inc%_EXT%\svtools\xmlkywd.hxx
+hedabu: ..\source\xmlfilt\xmlexp.hxx %_DEST%\inc%_EXT%\svtools\xmlexp.hxx
+hedabu: ..\source\xmlfilt\xmlehelp.hxx %_DEST%\inc%_EXT%\svtools\xmlehelp.hxx
+hedabu: ..\source\xmlfilt\xmlimp.hxx %_DEST%\inc%_EXT%\svtools\xmlimp.hxx
+hedabu: ..\source\xmlfilt\xmlictxt.hxx %_DEST%\inc%_EXT%\svtools\xmlictxt.hxx
+hedabu: ..\source\xmlfilt\xmlitem.hxx %_DEST%\inc%_EXT%\svtools\xmlitem.hxx
+hedabu: ..\source\xmlfilt\xmlstyle.hxx %_DEST%\inc%_EXT%\svtools\xmlstyle.hxx
+hedabu: ..\source\xmlfilt\xmlastpl.hxx %_DEST%\inc%_EXT%\svtools\xmlastpl.hxx
+hedabu: ..\source\xmlfilt\wstrhelp.hxx %_DEST%\inc%_EXT%\svtools\wstrhelp.hxx
+hedabu: ..\inc\xmluconv.hxx %_DEST%\inc%_EXT%\svtools\xmluconv.hxx
+hedabu: ..\source\xmlfilt\xmlitmpr.hxx %_DEST%\inc%_EXT%\svtools\xmlitmpr.hxx
+hedabu: ..\inc\xmlement.hxx %_DEST%\inc%_EXT%\svtools\xmlement.hxx
+hedabu: ..\source\xmlfilt\xmlnmspe.hxx %_DEST%\inc%_EXT%\svtools\xmlnmspe.hxx
+hedabu: ..\source\xmlfilt\xmlimpit.hxx %_DEST%\inc%_EXT%\svtools\xmlimpit.hxx
+hedabu: ..\source\xmlfilt\xmlexpit.hxx %_DEST%\inc%_EXT%\svtools\xmlexpit.hxx
+hedabu: ..\source\xmlfilt\xmlitmap.hxx %_DEST%\inc%_EXT%\svtools\xmlitmap.hxx
+hedabu: ..\source\xmlfilt\xmlnumfe.hxx %_DEST%\inc%_EXT%\svtools\xmlnumfe.hxx
+hedabu: ..\inc\xmlcnitm.hxx %_DEST%\inc%_EXT%\svtools\xmlcnitm.hxx
+hedabu: ..\inc\tresitem.hxx %_DEST%\inc%_EXT%\svtools\tresitem.hxx
+hedabu: ..\inc\urihelper.hxx %_DEST%\inc%_EXT%\svtools\urihelper.hxx
+hedabu: ..\inc\reginfo.hxx %_DEST%\inc%_EXT%\svtools\reginfo.hxx
+hedabu: ..\inc\pathoptions.hxx %_DEST%\inc%_EXT%\svtools\pathoptions.hxx
+hedabu: ..\inc\useroptions.hxx %_DEST%\inc%_EXT%\svtools\useroptions.hxx
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
new file mode 100644
index 000000000000..53c90ed1e64a
--- /dev/null
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -0,0 +1,2396 @@
+/*************************************************************************
+ *
+ * $RCSfile: brwbox1.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <brwbox.hxx>
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <vcl/sound.hxx>
+#include "brwhead.hxx"
+#include "datwin.hxx"
+
+#pragma hdrstop
+
+#ifndef _SV_MULTISEL_HXX
+#include <tools/multisel.hxx>
+#endif
+
+DBG_NAME(BrowseBox);
+
+extern const char* BrowseBoxCheckInvariants( const void* pVoid );
+
+DECLARE_LIST( BrowserColumns, BrowserColumn* );
+
+#ifdef VCL
+#define SCROLL_FLAGS (SCROLL_CLIP | SCROLL_NOCHILDREN)
+#else
+#define SCROLL_FLAGS TRUE
+#endif
+
+//-------------------------------------------------------------------
+
+#if DBG_MI
+void DoLog_Impl( const BrowseBox *pThis, const char *pWhat, const char *pWho )
+{
+ SvFileStream aLog( "d:\\cursor.log", STREAM_WRITE|STREAM_NOCREATE );
+ if ( aLog.IsOpen() )
+ {
+ aLog.Seek( STREAM_SEEK_TO_END );
+ String aEntry( (long) pThis );
+ aEntry += "(row=";
+ aEntry += pThis->GetCurRow();
+ aEntry += "): ";
+ aEntry += pWhat;
+ aEntry += " from ";
+ aEntry += pWho;
+ aEntry += " => ";
+ aEntry += pThis->GetCursorHideCount();
+ aLog.WriteLine( aEntry );
+ }
+}
+#endif
+
+//===================================================================
+
+void BrowseBox::Construct( BrowserMode nMode )
+{
+ DBG_TRACE1( "BrowseBox: %p->Construct", this );
+ bMultiSelection = FALSE;
+ pColSel = 0;
+ pDataWin = 0;
+ pVScroll = 0;
+
+ pDataWin = new BrowserDataWin( this );
+ pCols = new BrowserColumns;
+
+ aLineColor = Color( COL_LIGHTGRAY );
+ InitSettings_Impl( this );
+ InitSettings_Impl( pDataWin );
+
+ bBootstrapped = FALSE;
+ bHasBitmapHandle = FALSE;
+ nDataRowHeight = 0;
+ nTitleLines = 1;
+ nFirstCol = 0;
+ nTopRow = 0;
+ nCurRow = BROWSER_ENDOFSELECTION;
+ nCurColId = 0;
+ bResizing = FALSE;
+ bSelect = FALSE;
+ bSelecting = FALSE;
+ bScrolling = FALSE;
+ bSelectionIsVisible = FALSE;
+ bNotToggleSel = FALSE;
+ bDrag = FALSE;
+ bHit = FALSE;
+ bRubber = FALSE;
+ bHideSelect = FALSE;
+ bHideCursor = FALSE;
+ nRowCount = 0;
+ m_bFocusOnlyCursor = TRUE;
+ m_aCursorColor = COL_TRANSPARENT;
+ m_nCurrentMode = 0;
+
+ aHScroll.SetLineSize(1);
+ aHScroll.SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
+ aHScroll.SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
+ pDataWin->Show();
+
+ SetMode( nMode );
+ bSelectionIsVisible = bKeepHighlight;
+ bHasFocus = HasChildPathFocus();
+ ((BrowserDataWin*)pDataWin)->nCursorHidden =
+ ( bHasFocus ? 0 : 1 ) + ( GetUpdateMode() ? 0 : 1 );
+ LOG( this, "Construct", "*" );
+}
+
+//-------------------------------------------------------------------
+
+BrowseBox::BrowseBox( Window* pParent, WinBits nBits, BrowserMode nMode ) :
+ Control( pParent, nBits | WB_3DLOOK ),
+ aHScroll( this, WinBits( WB_HSCROLL ) )
+{
+ DBG_CTOR( BrowseBox, NULL );
+ Construct( nMode );
+}
+
+//-------------------------------------------------------------------
+
+BrowseBox::BrowseBox( Window* pParent, const ResId& rId, BrowserMode nMode ):
+ Control( pParent, rId ),
+ aHScroll( this, WinBits(WB_HSCROLL) )
+{
+ DBG_CTOR( BrowseBox, NULL );
+ Construct(nMode);
+}
+
+//-------------------------------------------------------------------
+
+BrowseBox::~BrowseBox()
+{
+ DBG_DTOR(BrowseBox,BrowseBoxCheckInvariants);
+ DBG_TRACE1( "BrowseBox: %p~", this );
+
+ Hide();
+ delete ((BrowserDataWin*)pDataWin)->pHeaderBar;
+ delete ((BrowserDataWin*)pDataWin)->pCornerWin;
+ delete pDataWin;
+ delete pVScroll;
+
+ // free columns-space
+ for ( USHORT n = 0; n < pCols->Count(); ++n )
+ delete pCols->GetObject(n);
+ delete pCols;
+ delete pColSel;
+ if ( bMultiSelection )
+ delete uRow.pSel;
+}
+
+//-------------------------------------------------------------------
+
+short BrowseBox::GetCursorHideCount() const
+{
+ return ((BrowserDataWin*)pDataWin)->nCursorHidden;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::DoShowCursor( const char *pWhoLogs )
+{
+ short nHiddenCount = --((BrowserDataWin*)pDataWin)->nCursorHidden;
+ if (PaintCursorIfHiddenOnce())
+ {
+ if (1 == nHiddenCount)
+ DrawCursor();
+ }
+ else
+ {
+ if (0 == nHiddenCount)
+ DrawCursor();
+ }
+ LOG( this, "DoShowCursor", pWhoLogs );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::DoHideCursor( const char *pWhoLogs )
+{
+ short nHiddenCount = ++((BrowserDataWin*)pDataWin)->nCursorHidden;
+ if (PaintCursorIfHiddenOnce())
+ {
+ if (2 == nHiddenCount)
+ DrawCursor();
+ }
+ else
+ {
+ if (1 == nHiddenCount)
+ DrawCursor();
+ }
+ LOG( this, "DoHideCursor", pWhoLogs );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetRealRowCount( const String &rRealRowCount )
+{
+ ((BrowserDataWin*)pDataWin)->aRealRowCount = rRealRowCount;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetMapMode( const MapMode& rNewMapMode )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ pDataWin->SetMapMode( rNewMapMode );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetFont( const Font& rNewFont )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ pDataWin->SetFont( rNewFont );
+ ImpGetDataRowHeight();
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::InsertHandleColumn( ULONG nWidth, BOOL bBitmap )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ pCols->Insert( new BrowserColumn( 0, Image(), String(), nWidth, GetZoom(), 0 ), (ULONG) 0 );
+ FreezeColumn( 0 );
+
+ // Headerbar anpassen
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ {
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetPosPixel(
+ Point(nWidth, 0));
+
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetSizePixel(
+ Size( GetOutputSizePixel().Width() - nWidth, GetTitleHeight() ) );
+ }
+
+ /*if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->InsertItem( USHRT_MAX - 1,
+ "", nWidth, HIB_FIXEDPOS|HIB_FIXED, 0 );*/
+ ColumnInserted( 0 );
+ bHasBitmapHandle = bBitmap;
+}
+
+//-------------------------------------------------------------------
+#if SUPD<380
+void BrowseBox::InsertDataColumn( USHORT nItemId, const String &rTitle,
+ ULONG nWidth, BrowserColumnMode nFlags, USHORT nPos )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ pCols->Insert( new BrowserColumn( nItemId, Image(), rTitle, nWidth, GetZoom(), nFlags ),
+ Min( nPos, (USHORT)(pCols->Count()) ) );
+ if ( nCurColId == 0 )
+ nCurColId = nItemId;
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->InsertItem(
+ nItemId, rTitle, nWidth, HIB_STDSTYLE, nPos );
+ ColumnInserted( nPos );
+}
+#else
+//-------------------------------------------------------------------
+
+void BrowseBox::InsertDataColumn( USHORT nItemId, const Image& rImage,
+ long nWidth, HeaderBarItemBits nBits, USHORT nPos )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ pCols->Insert( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ),
+ Min( nPos, (USHORT)(pCols->Count()) ) );
+ if ( nCurColId == 0 )
+ nCurColId = nItemId;
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ {
+ // Handlecolumn nicht in der Headerbar
+ USHORT nHeaderPos = nPos;
+ if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0))
+ nHeaderPos--;
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->InsertItem(
+ nItemId, rImage, nWidth, nBits, nHeaderPos );
+ }
+ ColumnInserted( nPos );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::InsertDataColumn( USHORT nItemId, const XubString& rText,
+ long nWidth, HeaderBarItemBits nBits, USHORT nPos )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ pCols->Insert( new BrowserColumn( nItemId, Image(), rText, nWidth, GetZoom(), nBits ),
+ Min( nPos, (USHORT)(pCols->Count()) ) );
+ if ( nCurColId == 0 )
+ nCurColId = nItemId;
+
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ {
+ // Handlecolumn nicht in der Headerbar
+ USHORT nHeaderPos = nPos;
+ if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0))
+ nHeaderPos--;
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->InsertItem(
+ nItemId, rText, nWidth, nBits, nHeaderPos );
+ }
+ ColumnInserted( nPos );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::InsertDataColumn( USHORT nItemId,
+ const Image& rImage, const XubString& rText,
+ long nWidth, HeaderBarItemBits nBits, USHORT nPos,
+ const String* pHelpText )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ pCols->Insert( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ),
+ Min( nPos, (USHORT)(pCols->Count()) ) );
+ if ( nCurColId == 0 )
+ nCurColId = nItemId;
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ {
+ // Handlecolumn nicht in der Headerbar
+ USHORT nHeaderPos = nPos;
+ if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0))
+ nHeaderPos--;
+
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->InsertItem(
+ nItemId, rImage, rText, nWidth, nBits, nHeaderPos );
+ if( pHelpText && !rText.Len() )
+ {
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetHelpText(
+ nItemId, *pHelpText );
+ }
+ }
+ ColumnInserted( nPos );
+}
+#endif
+//-------------------------------------------------------------------
+
+void BrowseBox::FreezeColumn( USHORT nItemId, BOOL bFreeze )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // never unfreeze the handle-column
+ if ( nItemId == 0 && !bFreeze )
+ return;
+
+ // get the position in the current array
+ USHORT nItemPos = GetColumnPos( nItemId );
+ if ( nItemPos >= pCols->Count() )
+ // not available!
+ return;
+
+ // doesn't the state change?
+ if ( pCols->GetObject(nItemPos)->IsFrozen() == bFreeze )
+ return;
+
+ // remark the column selection
+ USHORT nSelectedColId = USHRT_MAX;
+ if ( pColSel && pColSel->GetSelectCount() )
+ {
+ DoHideCursor( "FreezeColumn" );
+ ToggleSelection();
+ nSelectedColId = pCols->GetObject(pColSel->FirstSelected())->GetId();
+ pColSel->SelectAll(FALSE);
+ }
+
+ // freeze or unfreeze?
+ if ( bFreeze )
+ {
+ // to be moved?
+ if ( nItemPos != 0 && !pCols->GetObject(nItemPos-1)->IsFrozen() )
+ {
+ // move to the right of the last frozen column
+ USHORT nFirstScrollable = FrozenColCount();
+ BrowserColumn *pColumn = pCols->GetObject(nItemPos);
+ pCols->Remove( (ULONG) nItemPos );
+ nItemPos = nFirstScrollable;
+ pCols->Insert( pColumn, (ULONG) nItemPos );
+ }
+
+ // adjust the number of the first scrollable and visible column
+ if ( nFirstCol <= nItemPos )
+ nFirstCol = nItemPos + 1;
+ }
+ else
+ {
+ // to be moved?
+ if ( nItemPos != FrozenColCount()-1 )
+ {
+ // move to the leftmost scrollable colum
+ USHORT nFirstScrollable = FrozenColCount();
+ BrowserColumn *pColumn = pCols->GetObject(nItemPos);
+ pCols->Remove( (ULONG) nItemPos );
+ nItemPos = nFirstScrollable;
+ pCols->Insert( pColumn, (ULONG) nItemPos );
+ }
+
+ // adjust the number of the first scrollable and visible column
+ nFirstCol = nItemPos;
+ }
+
+ // toggle the freeze-state of the column
+ pCols->GetObject(nItemPos)->Freeze( bFreeze );
+
+ // align the scrollbar-range
+ UpdateScrollbars();
+
+ // repaint
+ Control::Invalidate();
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+
+ // remember the column selection
+ if ( pColSel && nSelectedColId != USHRT_MAX )
+ {
+ pColSel->Select( GetColumnPos( nSelectedColId ) );
+ ToggleSelection();
+ DBG_TRACE1( "BrowseBox: %p->ShowCursor", this );
+ DoShowCursor( "FreezeColumn" );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetColumnPos( USHORT nColumnId, USHORT nPos )
+{
+ // never set pos of the handle-column
+ if ( nColumnId == 0 )
+ return;
+
+ // do not move handle column
+ if (nPos == 0 && !pCols->GetObject(0)->GetId())
+ return;
+
+ // get the position in the current array
+ USHORT nOldPos = GetColumnPos( nColumnId );
+ if ( nOldPos >= pCols->Count() )
+ // not available!
+ return;
+
+ // does the state change?
+ BrowserColumn *pCol = pCols->GetObject(nOldPos);
+ if (nOldPos != nPos)
+ {
+ // determine old column area
+ Size aDataWinSize( pDataWin->GetSizePixel() );
+ Rectangle aFromRect( GetFieldRect( nColumnId) );
+
+ // move column internally
+ pCols->Insert( pCols->Remove( nOldPos ), nPos );
+
+ // determine new column area
+ Rectangle aToRect( GetFieldRect( nColumnId ) );
+
+ // do scroll, let redraw
+ Rectangle aForNewArea( Point( aToRect.Left(), 0 ),
+ Size( aDataWinSize.Width() - aToRect.Left(),
+ aDataWinSize.Height() ) );
+ Rectangle aForOldArea( Point( aFromRect.Right(), 0 ),
+ Size( aDataWinSize.Width() - aFromRect.Right(),
+ aDataWinSize.Height() ) );
+
+ if( pDataWin->GetBackground().IsScrollable() )
+ {
+ if ( nOldPos > nPos )
+ pDataWin->Scroll( -aFromRect.GetWidth()-4, 0, aForOldArea );
+ pDataWin->Scroll( aToRect.GetWidth()+4, 0, aForNewArea );
+ if ( nOldPos < nPos )
+ pDataWin->Scroll( -aFromRect.GetWidth()-4, 0, aForOldArea );
+ }
+ else
+ pDataWin->Window::Invalidate( INVALIDATE_NOCHILDREN );
+ }
+
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetColumnMode( USHORT nColumnId, BrowserColumnMode nFlags )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // never set mode of the handle-column
+ if ( nColumnId == 0 )
+ return;
+
+ // get the position in the current array
+ USHORT nColumnPos = GetColumnPos( nColumnId );
+ if ( nColumnPos >= pCols->Count() )
+ // not available!
+ return;
+
+ // does the state change?
+ BrowserColumn *pCol = pCols->GetObject(nColumnPos);
+ if ( pCol->Flags() != nFlags )
+ {
+ pCol->Flags() = nFlags;
+
+ // redraw visible colums
+ if ( GetUpdateMode() && ( pCol->IsFrozen() || nColumnPos > nFirstCol ) )
+ Invalidate( Rectangle( Point(0,0),
+ Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetColumnTitle( USHORT nItemId, const String& rTitle )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // never set title of the handle-column
+ if ( nItemId == 0 )
+ return;
+
+ // get the position in the current array
+ USHORT nItemPos = GetColumnPos( nItemId );
+ if ( nItemPos >= pCols->Count() )
+ // not available!
+ return;
+
+ // does the state change?
+ BrowserColumn *pCol = pCols->GetObject(nItemPos);
+ if ( pCol->Title() != rTitle )
+ {
+ pCol->Title() = rTitle;
+
+ // Headerbar-Column anpassen
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetItemText(
+ nItemId ? nItemId : USHRT_MAX - 1, rTitle );
+ else
+ {
+ // redraw visible colums
+ if ( GetUpdateMode() && ( pCol->IsFrozen() || nItemPos > nFirstCol ) )
+ Invalidate( Rectangle( Point(0,0),
+ Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) );
+ }
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetColumnWidth( USHORT nItemId, ULONG nWidth )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // get the position in the current array
+ USHORT nItemPos = GetColumnPos( nItemId );
+ if ( nItemPos >= pCols->Count() )
+ return;
+
+ // does the state change?
+ nWidth = QueryColumnResize( nItemId, nWidth );
+ if ( nWidth >= LONG_MAX || pCols->GetObject(nItemPos)->Width() != nWidth )
+ {
+ long nOldWidth = pCols->GetObject(nItemPos)->Width();
+
+ // ggf. letzte Spalte anpassen
+ if ( IsVisible() && nItemPos == pCols->Count() - 1 )
+ {
+ long nMaxWidth = pDataWin->GetSizePixel().Width();
+ nMaxWidth -= ((BrowserDataWin*)pDataWin)->bAutoSizeLastCol
+ ? GetFieldRect(nItemId).Left()
+ : GetFrozenWidth();
+ if ( ( (BrowserDataWin*)pDataWin )->bAutoSizeLastCol || nWidth > (ULONG)nMaxWidth )
+ {
+ nWidth = nMaxWidth > 16 ? nMaxWidth : nOldWidth;
+ nWidth = QueryColumnResize( nItemId, nWidth );
+ }
+ }
+
+ // OV
+ // In AutoSizeLastColumn() wird SetColumnWidth mit nWidth==0xffff
+ // gerufen. Deshalb muss hier nochmal geprueft werden, ob sich die
+ // Breite tatsaechlich geaendert hat.
+ if( (ULONG)nOldWidth == nWidth )
+ return;
+
+ // soll die Aenderung sofort dargestellt werden?
+ BOOL bUpdate = GetUpdateMode() &&
+ ( pCols->GetObject(nItemPos)->IsFrozen() || nItemPos >= nFirstCol );
+
+ if ( bUpdate )
+ {
+ // Selection hiden
+ DoHideCursor( "SetColumnWidth" );
+ ToggleSelection();
+ //!((BrowserDataWin*)pDataWin)->Update();
+ //!Control::Update();
+ }
+
+ // Breite setzen
+ pCols->GetObject(nItemPos)->SetWidth(nWidth, GetZoom());
+#if 0
+ if ( nItemPos != pCols->Count() - 1 )
+ {
+ long nLastColMaxWidth = pDataWin->GetSizePixel().Width() -
+ GetFieldRect(GetColumnId(pCols->Count()-1)).Left();
+ pCols->GetObject(pCols->Count()-1)->Width() = nLastColMaxWidth;
+ }
+#endif
+
+ // scroll and invalidate
+ if ( bUpdate )
+ {
+ // X-Pos der veraenderten Spalte ermitteln
+ long nX = 0;
+ for ( USHORT nCol = 0; nCol < nItemPos; ++nCol )
+ {
+ BrowserColumn *pCol = pCols->GetObject(nCol);
+ if ( pCol->IsFrozen() || nCol >= nFirstCol )
+ nX += pCol->Width();
+ }
+
+ // eigentliches scroll+invalidate
+ pDataWin->SetClipRegion();
+ BOOL bSelVis = bSelectionIsVisible;
+ bSelectionIsVisible = FALSE;
+ if( GetBackground().IsScrollable() )
+ {
+
+ Rectangle aScrRect( nX + min( (ULONG)nOldWidth, nWidth ), 0,
+ GetSizePixel().Width() , // the header is longer than the datawin
+ pDataWin->GetPosPixel().Y() - 1 );
+ Control::Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS );
+ aScrRect.Bottom() = pDataWin->GetSizePixel().Height();
+ ((BrowserDataWin*)pDataWin)->Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS );
+ Rectangle aInvRect( nX, 0, nX + max( nWidth, (ULONG)nOldWidth ), USHRT_MAX );
+ Control::Invalidate( aInvRect );
+ ( (BrowserDataWin*)pDataWin )->Invalidate( aInvRect );
+ }
+ else
+ {
+ Control::Invalidate( INVALIDATE_NOCHILDREN );
+ ((BrowserDataWin*)pDataWin)->Window::Invalidate( INVALIDATE_NOCHILDREN );
+ }
+
+
+ //!((BrowserDataWin*)pDataWin)->Update();
+ //!Control::Update();
+ bSelectionIsVisible = bSelVis;
+ ToggleSelection();
+ DoShowCursor( "SetColumnWidth" );
+ }
+ UpdateScrollbars();
+
+ // Headerbar-Column anpassen
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetItemSize(
+ nItemId ? nItemId : USHRT_MAX - 1, nWidth );
+
+ // adjust last column
+ if ( nItemPos != pCols->Count() - 1 )
+ AutoSizeLastColumn();
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::AutoSizeLastColumn()
+{
+ if ( ((BrowserDataWin*)pDataWin)->bAutoSizeLastCol &&
+ ((BrowserDataWin*)pDataWin)->GetUpdateMode() )
+ {
+ USHORT nId = GetColumnId( (USHORT)pCols->Count() - 1 );
+ SetColumnWidth( nId, LONG_MAX );
+ ColumnResized( nId );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::RemoveColumn( USHORT nItemId )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // Spaltenposition ermitteln
+ USHORT nPos = GetColumnPos(nItemId);
+ if ( nPos >= ColCount() )
+ // nicht vorhanden
+ return;
+
+ // Spaltenselektion korrigieren
+ if ( pColSel )
+ pColSel->Remove( nPos );
+
+ // Spaltencursor korrigieren
+ if ( nCurColId == nItemId )
+ nCurColId = 0;
+
+ if ( nFirstCol >= nPos && nFirstCol > 0 )
+ --nFirstCol;
+
+ // Spalte entfernen
+ delete( pCols->Remove( (ULONG) nPos ));
+
+ // Handlecolumn nicht in der Headerbar
+ if (nItemId)
+ {
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->RemoveItem( nItemId );
+ }
+ else
+ {
+ // Headerbar anpassen
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ {
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetPosPixel(
+ Point(0, 0));
+
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetSizePixel(
+ Size( GetOutputSizePixel().Width(), GetTitleHeight() ) );
+ }
+ }
+
+ // vertikalen Scrollbar korrigieren
+ UpdateScrollbars();
+
+ // ggf. Repaint ausl"osen
+ if ( GetUpdateMode() )
+ {
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+ Control::Invalidate();
+ if ( ((BrowserDataWin*)pDataWin)->bAutoSizeLastCol && nPos ==ColCount() )
+ SetColumnWidth( GetColumnId( nPos - 1 ), LONG_MAX );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::RemoveColumns()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // alle Spalten entfernen
+ while ( pCols->Count() )
+ delete ( pCols->Remove( (ULONG) 0 ));
+
+ // Spaltenselektion korrigieren
+ if ( pColSel )
+ {
+ pColSel->SelectAll(FALSE);
+ pColSel->SetTotalRange( Range( 0, 0 ) );
+ }
+
+ // Spaltencursor korrigieren
+ nCurColId = 0;
+ nFirstCol = 0;
+
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->Clear( );
+
+ // vertikalen Scrollbar korrigieren
+ UpdateScrollbars();
+
+ // ggf. Repaint ausl"osen
+ if ( GetUpdateMode() )
+ {
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+ Control::Invalidate();
+ }
+}
+
+//-------------------------------------------------------------------
+
+String BrowseBox::GetColumnTitle( USHORT nId ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ USHORT nItemPos = GetColumnPos( nId );
+ if ( nItemPos >= pCols->Count() )
+ return String();
+ return pCols->GetObject(nItemPos)->Title();
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::GetRowCount() const
+{
+ return nRowCount;
+}
+
+//-------------------------------------------------------------------
+
+USHORT BrowseBox::ColCount() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return (USHORT) pCols->Count();
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::ImpGetDataRowHeight() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ BrowseBox *pThis = (BrowseBox*)this;
+ pThis->nDataRowHeight = pThis->CalcReverseZoom(pDataWin->GetTextHeight() + 2);
+ pThis->Resize();
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+ return nDataRowHeight;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetDataRowHeight( long nPixel )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ nDataRowHeight = CalcReverseZoom(nPixel);
+ Resize();
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetTitleLines( USHORT nLines )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ nTitleLines = nLines;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ToTop()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ToBottom()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::ScrollColumns( long nCols )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( nFirstCol + nCols < 0 ||
+ nFirstCol + nCols >= (long)pCols->Count() )
+ //?MI: pCols->GetObject( nFirstCol + nCols )->IsFrozen() )
+ return 0;
+
+ // implicitly hides cursor while scrolling
+ StartScroll();
+ bScrolling = TRUE;
+ BOOL bScrollable = pDataWin->GetBackground().IsScrollable();
+ BOOL bInvalidateView = FALSE;
+
+ // eine Spalte nach links scrollen?
+ if ( nCols == 1 )
+ {
+ // update internal value and scrollbar
+ ++nFirstCol;
+ aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+
+ long nDelta = pCols->GetObject(nFirstCol-1)->Width();
+ long nFrozenWidth = GetFrozenWidth();
+
+ // scroll the title-line
+ Rectangle aScrollRect(
+ Point( nFrozenWidth + nDelta, 0 ),
+ Size( GetOutputSizePixel().Width() - nFrozenWidth - nDelta,
+ GetTitleHeight() - 1 ) );
+
+ // ggf. Headerbar mitscrollen
+ if ( !((BrowserDataWin*)pDataWin)->pHeaderBar && nTitleLines )
+ {
+ if( bScrollable )
+ Scroll( -nDelta, 0, aScrollRect );
+ else
+ bInvalidateView = TRUE;
+ }
+
+
+ long nSkippedWidth = GetOutputSizePixel().Width() -
+ 2 * aScrollRect.GetWidth() - nFrozenWidth;
+ if ( nSkippedWidth > 0 )
+ {
+ aScrollRect.Right() = aScrollRect.Left()-1;
+ aScrollRect.Left() -= nSkippedWidth;
+ Invalidate( aScrollRect );
+ }
+
+ // scroll the data-area
+ aScrollRect = Rectangle(
+ Point( nFrozenWidth + nDelta, 0 ),
+ Size( pDataWin->GetOutputSizePixel().Width() - nFrozenWidth -
+ nDelta, pDataWin->GetSizePixel().Height() ) );
+ if( bScrollable )
+ pDataWin->Scroll( -nDelta, 0, aScrollRect );
+ else
+ bInvalidateView = TRUE;
+ nSkippedWidth = pDataWin->GetOutputSizePixel().Width() -
+ 2 * aScrollRect.GetWidth() - nFrozenWidth;
+ if ( nSkippedWidth > 0 )
+ {
+ aScrollRect.Right() = aScrollRect.Left()-1;
+ aScrollRect.Left() -= nSkippedWidth;
+ ((BrowserDataWin*)pDataWin)->Invalidate( aScrollRect );
+ }
+ }
+
+ // eine Spalte nach rechts scrollen?
+ else if ( nCols == -1 )
+ {
+ --nFirstCol;
+ aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+
+ long nDelta = pCols->GetObject(nFirstCol)->Width();
+ long nFrozenWidth = GetFrozenWidth();
+
+ // ggf. Headerbar mitscrollen
+ if ( !((BrowserDataWin*)pDataWin)->pHeaderBar && nTitleLines )
+ {
+ if( bScrollable )
+ {
+ Scroll( nDelta, 0, Rectangle(
+ Point( nFrozenWidth, 0 ),
+ Size( GetOutputSizePixel().Width() - nFrozenWidth,
+ GetTitleHeight() - 1 ) ) );
+ }
+ else
+ bInvalidateView = TRUE;
+ }
+ if( bScrollable )
+ {
+ pDataWin->Scroll( nDelta, 0, Rectangle(
+ Point( nFrozenWidth, 0 ),
+ Size( pDataWin->GetSizePixel().Width() - nFrozenWidth,
+ pDataWin->GetSizePixel().Height() ) ) );
+ }
+ else
+ bInvalidateView = TRUE;
+
+ }
+ else
+ {
+ if ( GetUpdateMode() )
+ {
+ Invalidate( Rectangle(
+ Point( GetFrozenWidth(), 0 ),
+ Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) );
+ ((BrowserDataWin*)pDataWin)->Invalidate( Rectangle(
+ Point( GetFrozenWidth(), 0 ),
+ pDataWin->GetSizePixel() ) );
+ }
+
+ nFirstCol += (USHORT)nCols;
+ aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+ }
+
+ // ggf. externe Headerbar anpassen
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ {
+ long nWidth = 0;
+ for ( USHORT nCol = 0;
+ nCol < pCols->Count() && nCol < nFirstCol;
+ ++nCol )
+ {
+ // HandleColumn nicht
+ if ( pCols->GetObject(nCol)->GetId() )
+ nWidth += pCols->GetObject(nCol)->Width();
+ }
+
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetOffset( nWidth );
+ }
+
+ if( bInvalidateView )
+ {
+ Control::Invalidate( INVALIDATE_NOCHILDREN );
+ pDataWin->Window::Invalidate( INVALIDATE_NOCHILDREN );
+ }
+
+ // implicitly show cursor after scrolling
+ if ( nCols )
+ {
+ ((BrowserDataWin*)pDataWin)->Update();
+ Update();
+ }
+ bScrolling = FALSE;
+ EndScroll();
+
+ return nCols;
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::ScrollRows( long nRows )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // out of range?
+ if ( ((BrowserDataWin*)pDataWin)->bNoScrollBack && nRows < 0 )
+ return 0;
+
+ // compute new top row
+ long nTmpMin = Min( (long)(nTopRow + nRows), (long)(nRowCount - 1) );
+
+ long nNewTopRow = Max( (long)nTmpMin, (long)0 );
+
+ if ( nNewTopRow == nTopRow )
+ return 0;
+
+ USHORT nVisibleRows =
+ (USHORT)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1);
+
+ VisibleRowsChanged(nNewTopRow, nVisibleRows);
+
+ // compute new top row again (nTopRow might have changed!)
+ nTmpMin = Min( (long)(nTopRow + nRows), (long)(nRowCount - 1) );
+
+ nNewTopRow = Max( (long)nTmpMin, (long)0 );
+
+ StartScroll();
+
+ // scroll area on screen and/or repaint
+ long nDeltaY = GetDataRowHeight() * ( nNewTopRow - nTopRow );
+ long nOldTopRow = nTopRow;
+ nTopRow = nNewTopRow;
+
+ if ( GetUpdateMode() )
+ {
+ pVScroll->SetRange( Range( 0L, nRowCount ) );
+ pVScroll->SetThumbPos( nTopRow );
+
+ if( pDataWin->GetBackground().IsScrollable() &&
+ Abs( nDeltaY ) > 0 &&
+ Abs( nDeltaY ) < pDataWin->GetSizePixel().Height() )
+ {
+ pDataWin->Scroll( 0, (short)-nDeltaY );
+ }
+ else
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+
+ if ( nTopRow - nOldTopRow )
+ ((BrowserDataWin*)pDataWin)->Update();
+ }
+
+ EndScroll();
+
+ return nTopRow - nOldTopRow;
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::ScrollPages( long nPagesY )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return ScrollRows( pDataWin->GetSizePixel().Height() / GetDataRowHeight() );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::RowModified( long nRow, USHORT nColId )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( !GetUpdateMode() )
+ return;
+
+ Rectangle aRect;
+ if ( nColId == USHRT_MAX )
+ // invalidate the whole row
+ aRect = Rectangle( Point( 0, (nRow-nTopRow) * GetDataRowHeight() ),
+ Size( pDataWin->GetSizePixel().Width(), GetDataRowHeight() ) );
+ else
+ {
+ // invalidate the specific field
+ aRect = GetFieldRectPixel( nRow, nColId, FALSE );
+ }
+ ((BrowserDataWin*)pDataWin)->Invalidate( aRect );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::Clear()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // adjust the total number of rows
+ DoHideCursor( "Clear" );
+ nRowCount = 0;
+ nCurRow = BROWSER_ENDOFSELECTION;
+ nTopRow = 0;
+ nCurColId = 0;
+
+ // nFirstCol darf nicht zurueckgesetzt werden, da ansonsten das Scrollen
+ // total durcheinander kommt
+ // nFirstCol darf nur beim Hinzufuegen oder Loeschen von Spalten geaendert werden
+ // nFirstCol = 0; ->Falsch!!!!
+ aHScroll.SetThumbPos( 0 );
+ pVScroll->SetThumbPos( 0 );
+
+ Invalidate();
+ UpdateScrollbars();
+ SetNoSelection();
+ DoShowCursor( "Clear" );
+ CursorMoved();
+}
+
+//-------------------------------------------------------------------
+#if SUPD > 511
+
+#else
+
+void BrowseBox::RowInserted( long nRow, long nNumRows, BOOL bDoPaint )
+{
+ RowInserted( nRow, nNumRows, bDoPaint, FALSE );
+}
+
+#endif
+
+void BrowseBox::RowInserted( long nRow, long nNumRows, BOOL bDoPaint, BOOL bKeepSelection )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if (nRow < 0)
+ nRow = 0;
+ else if (nRow > nRowCount) // maximal = nRowCount
+ nRow = nRowCount;
+
+ if ( nNumRows <= 0 )
+ return;
+
+#if 0
+ // Zerlegung in einzelne RowInserted-Aufrufe:
+ if (nNumRows > 1)
+ {
+ for (long i = 0; i < nNumRows; i++)
+ RowInserted(nRow + i,1,bDoPaint);
+ return;
+ }
+#endif
+
+ // adjust total row count
+ BOOL bLastRow = nRow >= nRowCount;
+ nRowCount += nNumRows;
+
+ DoHideCursor( "RowInserted" );
+
+ // must we paint the new rows?
+ long nOldCurRow = nCurRow;
+ Size aSz = pDataWin->GetOutputSizePixel();
+ if ( bDoPaint && nRow >= nTopRow &&
+ nRow <= nTopRow + aSz.Height() / GetDataRowHeight() )
+ {
+ long nY = (nRow-nTopRow) * GetDataRowHeight();
+ if ( !bLastRow )
+ {
+ // scroll down the rows behind the new row
+ pDataWin->SetClipRegion();
+ if( pDataWin->GetBackground().IsScrollable() )
+ {
+ pDataWin->Scroll( 0, GetDataRowHeight() * nNumRows,
+ Rectangle( Point( 0, nY ),
+ Size( aSz.Width(), aSz.Height() - nY ) ),
+ SCROLL_CLIP );
+ }
+ else
+ pDataWin->Window::Invalidate( INVALIDATE_NOCHILDREN );
+ }
+ else
+ // scroll would cause a repaint, so we must explicitly invalidate
+ pDataWin->Invalidate( Rectangle( Point( 0, nY ),
+ Size( aSz.Width(), nNumRows * GetDataRowHeight() ) ) );
+ }
+
+ // ggf. Top-Row korrigieren
+ if ( nRow < nTopRow )
+ nTopRow += nNumRows;
+
+ // adjust the selection
+ if ( bMultiSelection )
+ uRow.pSel->Insert( nRow, nNumRows );
+ else if ( uRow.nSel != BROWSER_ENDOFSELECTION && nRow <= uRow.nSel )
+ uRow.nSel += nNumRows;
+
+ // adjust the cursor
+ if ( nCurRow == BROWSER_ENDOFSELECTION )
+ GoToRow( 0, FALSE, bKeepSelection );
+ else if ( nRow <= nCurRow )
+ GoToRow( nCurRow += nNumRows, FALSE, bKeepSelection );
+
+ // adjust the vertical scrollbar
+ if ( bDoPaint )
+ {
+ UpdateScrollbars();
+ AutoSizeLastColumn();
+ }
+
+ DoShowCursor( "RowInserted" );
+ if ( nCurRow != nOldCurRow )
+ CursorMoved();
+
+ DBG_ASSERT(nRowCount > 0,"BrowseBox: nRowCount <= 0");
+ DBG_ASSERT(nCurRow >= 0,"BrowseBox: nCurRow < 0");
+ DBG_ASSERT(nCurRow < nRowCount,"nCurRow >= nRowCount");
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::RowRemoved( long nRow, long nNumRows, BOOL bDoPaint )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( nRow < 0 )
+ nRow = 0;
+ else if ( nRow >= nRowCount )
+ nRow = nRowCount - 1;
+
+ if ( nNumRows <= 0 )
+ return;
+
+ if ( nRowCount <= 0 )
+ return;
+
+ if ( bDoPaint )
+ {
+ // hide cursor and selection
+ DBG_TRACE1( "BrowseBox: %p->HideCursor", this );
+ ToggleSelection();
+ DoHideCursor( "RowRemoved" );
+ }
+
+ // adjust total row count
+ nRowCount -= nNumRows;
+ if (nRowCount < 0) nRowCount = 0;
+ long nOldCurRow = nCurRow;
+
+ // adjust the selection
+ if ( bMultiSelection )
+ // uRow.pSel->Remove( nRow, nNumRows );
+ for ( long i = 0; i < nNumRows; i++ )
+ uRow.pSel->Remove( nRow );
+ else if ( nRow < uRow.nSel && uRow.nSel >= nNumRows )
+ uRow.nSel -= nNumRows;
+ else if ( nRow <= uRow.nSel )
+ uRow.nSel = BROWSER_ENDOFSELECTION;
+
+ // adjust the cursor
+ if ( nRowCount == 0 ) // don't compare nRowCount with nNumRows as nNumRows already was subtracted from nRowCount
+ nCurRow = BROWSER_ENDOFSELECTION;
+ else if ( nRow < nCurRow )
+ {
+ nCurRow -= Min( nCurRow - nRow, nNumRows );
+ // with the above nCurRow points a) to the first row after the removed block or b) to the same line
+ // as before, but moved up nNumRows
+ // case a) needs an additional correction if the last n lines were deleted, as 'the first row after the
+ // removed block' is an invalid position then
+ // FS - 09/28/99 - 68429
+ if (nCurRow == nRowCount)
+ --nCurRow;
+ }
+ else if( nRow == nCurRow && nCurRow == nRowCount )
+ nCurRow = nRowCount-1;
+
+ // is the deleted row visible?
+ Size aSz = pDataWin->GetOutputSizePixel();
+ if ( nRow >= nTopRow &&
+ nRow <= nTopRow + aSz.Height() / GetDataRowHeight() )
+ {
+ if ( bDoPaint )
+ {
+ // scroll up the rows behind the deleted row
+ // if there are Rows behind
+ if (nRow < nRowCount)
+ {
+ long nY = (nRow-nTopRow) * GetDataRowHeight();
+ pDataWin->SetClipRegion();
+ if( pDataWin->GetBackground().IsScrollable() )
+ {
+ pDataWin->Scroll( 0, - (short) GetDataRowHeight() * nNumRows,
+ Rectangle( Point( 0, nY ), Size( aSz.Width(),
+ aSz.Height() - nY + nNumRows*GetDataRowHeight() ) ),
+ SCROLL_CLIP );
+ }
+ else
+ pDataWin->Window::Invalidate( INVALIDATE_NOCHILDREN );
+ }
+ else
+ {
+ // Repaint the Rect of the deleted row
+ Rectangle aRect(
+ Point( 0, (nRow-nTopRow)*GetDataRowHeight() ),
+ Size( pDataWin->GetSizePixel().Width(),
+ nNumRows * GetDataRowHeight() ) );
+ pDataWin->Invalidate( aRect );
+ }
+ }
+ }
+ // is the deleted row above of the visible area?
+ else if ( nRow < nTopRow )
+ nTopRow = nTopRow >= nNumRows ? nTopRow-nNumRows : 0;
+
+ if ( bDoPaint )
+ {
+ // reshow cursor and selection
+ ToggleSelection();
+ DBG_TRACE1( "BrowseBox: %p->ShowCursor", this );
+ DoShowCursor( "RowRemoved" );
+
+ // adjust the vertical scrollbar
+ UpdateScrollbars();
+ AutoSizeLastColumn();
+ }
+
+ if ( nOldCurRow != nCurRow )
+ CursorMoved();
+
+ DBG_ASSERT(nRowCount >= 0,"BrowseBox: nRowCount < 0");
+ DBG_ASSERT(nCurRow >= 0 || nRowCount == 0,"BrowseBox: nCurRow < 0 && nRowCount != 0");
+ DBG_ASSERT(nCurRow < nRowCount,"nCurRow >= nRowCount");
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::GoToRow( long nRow)
+{
+ return GoToRow(nRow, FALSE, FALSE);
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::GoToRowAndDoNotModifySelection( long nRow )
+{
+ return GoToRow( nRow, FALSE, TRUE );
+}
+
+//-------------------------------------------------------------------
+
+#if SUPD > 511
+
+#else
+BOOL BrowseBox::GoToRow( long nRow, BOOL bRowColMove )
+{
+ return GoToRow( nRow, bRowColMove, FALSE );
+}
+#endif
+
+BOOL BrowseBox::GoToRow( long nRow, BOOL bRowColMove, BOOL bKeepSelection )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ long nOldCurRow = nCurRow;
+
+ // nothing to do?
+ if ( nRow == nCurRow && ( bMultiSelection || uRow.nSel == nRow ) )
+ return TRUE;
+
+ // out of range?
+ if ( nRow < 0 || nRow >= nRowCount )
+ return FALSE;
+
+ // nicht erlaubt?
+ if ( ( !bRowColMove && !IsCursorMoveAllowed( nRow, nCurColId ) ) )
+ return FALSE;
+
+ if ( ((BrowserDataWin*)pDataWin)->bNoScrollBack && nRow < nTopRow )
+ nRow = nTopRow;
+
+ // compute the last visible row
+ Size aSz( pDataWin->GetSizePixel() );
+ USHORT nVisibleRows = USHORT( aSz.Height() ) / GetDataRowHeight() - 1;
+ long nLastRow = nTopRow + nVisibleRows;
+
+ // suspend Updates
+ ((BrowserDataWin*)pDataWin)->EnterUpdateLock();
+
+ // ggf. altes Highlight weg
+ if ( !bMultiSelection && !bKeepSelection )
+ ToggleSelection();
+ DoHideCursor( "GoToRow" );
+
+ // must we scroll?
+ BOOL bWasVisible = bSelectionIsVisible;
+ if (! bMultiSelection)
+ {
+ if( !bKeepSelection )
+ bSelectionIsVisible = FALSE;
+ }
+ if ( nRow < nTopRow )
+ ScrollRows( nRow - nTopRow );
+ else if ( nRow > nLastRow )
+ ScrollRows( nRow - nLastRow );
+ bSelectionIsVisible = bWasVisible;
+
+ // adjust cursor (selection) and thumb
+ if ( GetUpdateMode() )
+ pVScroll->SetThumbPos( nTopRow );
+
+ // relative positioning (because nCurRow might have changed in the meantime)!
+ if (nCurRow != BROWSER_ENDOFSELECTION )
+ nCurRow = nCurRow + (nRow - nOldCurRow);
+
+ // make sure that the current position is valid
+ if (nCurRow == BROWSER_ENDOFSELECTION && nRowCount > 0)
+ nCurRow = 0;
+ else if ( nCurRow >= nRowCount )
+ nCurRow = nRowCount - 1;
+ aSelRange = Range( nCurRow, nCurRow );
+
+ // ggf. neues Highlight anzeigen
+ if ( !bMultiSelection && !bKeepSelection )
+ uRow.nSel = nRow;
+
+ // resume Updates
+ ((BrowserDataWin*)pDataWin)->LeaveUpdateLock();
+
+ // Cursor+Highlight
+ if ( !bMultiSelection && !bKeepSelection)
+ ToggleSelection();
+ DoShowCursor( "GoToRow" );
+ if ( !bRowColMove && nOldCurRow != nCurRow )
+ CursorMoved();
+
+ if ( !bMultiSelection && !bKeepSelection )
+ if ( !bSelecting )
+ Select();
+ else
+ bSelect = TRUE;
+ return TRUE;
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::GoToColumnId( USHORT nColId)
+{
+ return GoToColumnId(nColId,TRUE,FALSE);
+}
+
+
+BOOL BrowseBox::GoToColumnId( USHORT nColId, BOOL bMakeVisible, BOOL bRowColMove)
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if (!bColumnCursor)
+ return FALSE;
+
+ // erlaubt?
+ if (!bRowColMove && !IsCursorMoveAllowed( nCurRow, nColId ) )
+ return FALSE;
+
+ if ( nColId != nCurColId || bMakeVisible && !IsFieldVisible(nCurRow, nColId, TRUE))
+ {
+ DoHideCursor( "GoToColumnId" );
+ nCurColId = nColId;
+
+ USHORT nNewPos = GetColumnPos(nColId);
+ DBG_ASSERT( nNewPos != USHRT_MAX, "unknown column-id" );
+ USHORT nFirstPos = nFirstCol;
+ USHORT nWidth = (USHORT)pCols->GetObject( nNewPos )->Width();
+ USHORT nLastPos = GetColumnAtXPosPixel(
+ pDataWin->GetSizePixel().Width()-nWidth, FALSE );
+ USHORT nFrozen = FrozenColCount();
+ if ( bMakeVisible && nLastPos &&
+ nNewPos >= nFrozen && ( nNewPos < nFirstPos || nNewPos > nLastPos ) )
+ if ( nNewPos < nFirstPos )
+ ScrollColumns( nNewPos-nFirstPos );
+ else if ( nNewPos > nLastPos )
+ ScrollColumns( nNewPos-nLastPos );
+
+ DoShowCursor( "GoToColumnId" );
+ if (!bRowColMove)
+ CursorMoved();
+ return TRUE;
+ }
+ return TRUE;
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::GoToRowColumnId( long nRow, USHORT nColId )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ long nOldCurRow = nCurRow;
+
+ // out of range?
+ if ( nRow < 0 || nRow >= nRowCount )
+ return FALSE;
+
+ if (!bColumnCursor)
+ return FALSE;
+
+ // nothing to do ?
+ if ( nRow == nCurRow && ( bMultiSelection || uRow.nSel == nRow ) &&
+ nColId == nCurColId && IsFieldVisible(nCurRow, nColId, TRUE))
+ return TRUE;
+
+ // erlaubt?
+ if (!IsCursorMoveAllowed(nRow, nColId))
+ return FALSE;
+
+ DoHideCursor( "GoToRowColumnId" );
+ BOOL bMoved = GoToRow(nRow, TRUE) && GoToColumnId(nColId, TRUE, TRUE);
+ DoShowCursor( "GoToRowColumnId" );
+
+ if (bMoved)
+ CursorMoved();
+
+ return bMoved;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetNoSelection()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // is there no selection
+ if ( ( !pColSel || !pColSel->GetSelectCount() ) &&
+ ( ( !bMultiSelection && uRow.nSel == BROWSER_ENDOFSELECTION ) ||
+ ( bMultiSelection && !uRow.pSel->GetSelectCount() ) ) )
+ // nothing to do
+ return;
+
+ DBG_TRACE1( "BrowseBox: %p->HideCursor", this );
+ ToggleSelection();
+
+ // unselect all
+ if ( bMultiSelection )
+ uRow.pSel->SelectAll(FALSE);
+ else
+ uRow.nSel = BROWSER_ENDOFSELECTION;
+ if ( pColSel )
+ pColSel->SelectAll(FALSE);
+ if ( !bSelecting )
+ Select();
+ else
+ bSelect = TRUE;
+
+ // restore screen
+ DBG_TRACE1( "BrowseBox: %p->ShowCursor", this );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetSelection( const MultiSelection &rSel )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ DBG_ASSERT( bMultiSelection, "SetSelection only allowed with Multi-Selection-Mode" );
+
+ // prepare inverted areas
+ DBG_TRACE1( "BrowseBox: %p->HideCursor", this );
+ ToggleSelection();
+
+ // assign Selection
+ *uRow.pSel = rSel;
+
+ // only highlight painted areas
+ pDataWin->Update();
+
+ // notify derived class
+ if ( !bSelecting )
+ Select();
+ else
+ bSelect = TRUE;
+
+ // restore screen
+ ToggleSelection();
+ DBG_TRACE1( "BrowseBox: %p->ShowCursor", this );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SelectAll()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( !bMultiSelection )
+ return;
+
+ DBG_TRACE1( "BrowseBox: %p->HideCursor", this );
+ ToggleSelection();
+
+ // select all rows
+ if ( pColSel )
+ pColSel->SelectAll(FALSE);
+ uRow.pSel->SelectAll(TRUE);
+
+ // Handle-Column nicht highlighten
+ BrowserColumn *pFirstCol = pCols->GetObject(0);
+ long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width();
+
+ // highlight the row selection
+ if ( !bHideSelect )
+ {
+ Rectangle aHighlightRect;
+ USHORT nVisibleRows =
+ (USHORT)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1);
+ for ( long nRow = Max( nTopRow, uRow.pSel->FirstSelected() );
+ nRow != BROWSER_ENDOFSELECTION && nRow < nTopRow + nVisibleRows;
+ nRow = uRow.pSel->NextSelected() )
+ aHighlightRect.Union( Rectangle(
+ Point( nOfsX, (nRow-nTopRow)*GetDataRowHeight() ),
+ Size( pDataWin->GetSizePixel().Width(), GetDataRowHeight() ) ) );
+ pDataWin->Invalidate( aHighlightRect );
+ }
+
+ if ( !bSelecting )
+ Select();
+ else
+ bSelect = TRUE;
+
+ // restore screen
+ DBG_TRACE1( "BrowseBox: %p->ShowCursor", this );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SelectRow( long nRow, BOOL bSelect, BOOL bExpand )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( !bMultiSelection )
+ {
+ // deselecting is impossible, selecting via cursor
+ if ( bSelect )
+ GoToRow(nRow, FALSE);
+ return;
+ }
+
+ DBG_TRACE1( "BrowseBox: %p->HideCursor", this );
+
+ // remove old selection?
+ if ( !bExpand || !bMultiSelection )
+ {
+ ToggleSelection();
+ if ( bMultiSelection )
+ uRow.pSel->SelectAll(FALSE);
+ else
+ uRow.nSel = BROWSER_ENDOFSELECTION;
+ if ( pColSel )
+ pColSel->SelectAll(FALSE);
+ }
+
+ // set new selection
+ if ( !bHideSelect &&
+ ( (bMultiSelection && uRow.pSel->GetTotalRange().Max() >= nRow && uRow.pSel->Select(nRow,bSelect)) ||
+ (!bMultiSelection && ( uRow.nSel = nRow ) != BROWSER_ENDOFSELECTION ) ) )
+ {
+ // Handle-Column nicht highlighten
+ BrowserColumn *pFirstCol = pCols->GetObject(0);
+ long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width();
+
+ // highlight only newly selected part
+ Rectangle aRect(
+ Point( nOfsX, (nRow-nTopRow)*GetDataRowHeight() ),
+ Size( pDataWin->GetSizePixel().Width(), GetDataRowHeight() ) );
+ pDataWin->Invalidate( aRect );
+ }
+
+ if ( !bSelecting )
+ Select();
+ else
+ bSelect = TRUE;
+
+ // restore screen
+ DBG_TRACE1( "BrowseBox: %p->ShowCursor", this );
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::GetSelectRowCount() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return bMultiSelection ? uRow.pSel->GetSelectCount() :
+ uRow.nSel == BROWSER_ENDOFSELECTION ? 0 : 1;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SelectColumnPos( USHORT nNewColPos, BOOL bSelect, BOOL bMakeVisible )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( !bColumnCursor )
+ return;
+
+ if ( !bMultiSelection )
+ {
+ if ( bSelect )
+ GoToColumnId( pCols->GetObject(nNewColPos)->GetId(), bMakeVisible );
+ return;
+ }
+ else if (!GoToColumnId( pCols->GetObject(nNewColPos)->GetId(), bMakeVisible ))
+ return;
+
+ DBG_TRACE1( "BrowseBox: %p->HideCursor", this );
+ ToggleSelection();
+ if ( bMultiSelection )
+ uRow.pSel->SelectAll(FALSE);
+ else
+ uRow.nSel = BROWSER_ENDOFSELECTION;
+ pColSel->SelectAll(FALSE);
+
+ if ( pColSel->Select( nNewColPos ) )
+ {
+ // GoToColumnId( pCols->GetObject(nNewColPos)->GetId(), bMakeVisible );
+
+ // only highlight painted areas
+ pDataWin->Update();
+ Rectangle aFieldRectPix( GetFieldRectPixel( nCurRow, nCurColId, FALSE ) );
+ Rectangle aRect(
+ Point( aFieldRectPix.Left() - MIN_COLUMNWIDTH, 0 ),
+ Size( pCols->GetObject(nNewColPos)->Width(),
+ pDataWin->GetOutputSizePixel().Height() ) );
+ pDataWin->Invalidate( aRect );
+ if ( !bSelecting )
+ Select();
+ else
+ bSelect = TRUE;
+ }
+
+ // restore screen
+ DBG_TRACE1( "BrowseBox: %p->ShowCursor", this );
+}
+
+//-------------------------------------------------------------------
+
+USHORT BrowseBox::GetSelectColumnCount() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // while bAutoSelect (==!pColSel), 1 if any rows (yes rows!) else none
+ return pColSel ? (USHORT) pColSel->GetSelectCount() :
+ nCurRow >= 0 ? 1 : 0;
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::FirstSelectedRow( BOOL bInverse )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return bMultiSelection ? uRow.pSel->FirstSelected(bInverse) : uRow.nSel;
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::NextSelectedRow()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return bMultiSelection ? uRow.pSel->NextSelected() : BROWSER_ENDOFSELECTION;
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::PrevSelectedRow()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return bMultiSelection ? uRow.pSel->PrevSelected() : BROWSER_ENDOFSELECTION;
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::LastSelectedRow( BOOL bInverse )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return bMultiSelection ? uRow.pSel->LastSelected(bInverse) : uRow.nSel;
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::IsRowSelected( long nRow ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return bMultiSelection ? uRow.pSel->IsSelected(nRow) : nRow == uRow.nSel;
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::IsColumnSelected( USHORT nColumnId ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return pColSel ? pColSel->IsSelected( GetColumnPos(nColumnId) ) :
+ nCurColId == nColumnId;
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::MakeFieldVisible
+(
+ long nRow, // Zeilen-Nr des Feldes (beginnend mit 0)
+ USHORT nColId, // Spalten-Id des Feldes
+ BOOL bComplete // (== FALSE), TRUE => vollst"andig sichtbar machen
+)
+
+/* [Beschreibung]
+
+ Macht das durch 'nRow' und 'nColId' beschriebene Feld durch
+ entsprechendes scrollen sichtbar. Ist 'bComplete' gesetzt, dann wird
+ gefordert, da\s das Feld ganz sichtbar wird.
+
+ [R"uckgabewert]
+
+ BOOL TRUE
+ Das angegebene Feld wurde sichtbar gemacht, bzw. war
+ bereits sichtbar.
+
+ FALSE
+ Das angegebene Feld konnte nicht sichtbar bzw. bei
+ 'bComplete' nicht vollst"andig sichtbar gemacht werden.
+*/
+
+{
+ Size aTestSize = pDataWin->GetSizePixel();
+
+ if ( !bBootstrapped ||
+ ( aTestSize.Width() == 0 && aTestSize.Height() == 0 ) )
+ return FALSE;
+
+ // ist es schon sichtbar?
+ BOOL bVisible = IsFieldVisible( nRow, nColId, bComplete );
+ if ( bVisible )
+ return TRUE;
+
+ // Spaltenposition und Feld-Rechteck und Ausgabebereich berechnen
+ USHORT nColPos = GetColumnPos( nColId );
+ Rectangle aFieldRect = GetFieldRectPixel( nRow, nColId, FALSE );
+ Rectangle aDataRect = Rectangle( Point(0, 0), pDataWin->GetSizePixel() );
+
+ // links au\serhalb?
+ if ( nColPos >= FrozenColCount() && nColPos < nFirstCol )
+ // => nach rechts scrollen
+ ScrollColumns( nColPos - nFirstCol );
+
+ // solange rechts au\serhalb
+ while ( aDataRect.Right() < ( bComplete
+ ? aFieldRect.Right()
+ : aFieldRect.Left()+aFieldRect.GetWidth()/2 ) )
+ {
+ // => nach links scrollen
+ if ( ScrollColumns( 1 ) != 1 )
+ // nichts mehr zu scrollen
+ break;
+ aFieldRect = GetFieldRectPixel( nRow, nColId, FALSE );
+ }
+
+ // oben au\serhalb?
+ if ( nRow < nTopRow )
+ // nach unten scrollen
+ ScrollRows( nRow - nTopRow );
+
+ // unten au\serhalb?
+ long nBottomRow = nTopRow + GetVisibleRows();
+ // OV: damit nBottomRow die Nummer der letzten sichtbaren Zeile ist
+ // (Zaehlung ab Null!), muss sie dekrementiert werden.
+ // Beispiel: BrowseBox enthaelt genau einen Eintrag. nBottomRow := 0 + 1 - 1
+ if( nBottomRow )
+ nBottomRow--;
+
+ if ( nRow > nBottomRow )
+ // nach oben scrollen
+ ScrollRows( nRow - nBottomRow );
+
+ // jetzt kann es immer noch nicht passen, z.B. weil Window zu klein
+ return IsFieldVisible( nRow, nColId, bComplete );
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::IsFieldVisible( long nRow, USHORT nColumnId,
+ BOOL bCompletely ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // durch frozen-Column verdeckt?
+ USHORT nColPos = GetColumnPos( nColumnId );
+ if ( nColPos >= FrozenColCount() && nColPos < nFirstCol )
+ return FALSE;
+
+ Rectangle aRect( ImplFieldRectPixel( nRow, nColumnId ) );
+ if ( aRect.IsEmpty() )
+ return FALSE;
+
+ // get the visible area
+ Rectangle aOutRect( Point(0, 0), pDataWin->GetOutputSizePixel() );
+
+ if ( bCompletely )
+ // test if the field is completely visible
+ return aOutRect.IsInside( aRect );
+ else
+ // test if the field is partly of completely visible
+ return !aOutRect.Intersection( aRect ).IsEmpty();
+}
+
+//-------------------------------------------------------------------
+
+Rectangle BrowseBox::GetFieldRectPixel( long nRow, USHORT nColumnId,
+ BOOL bRelToBrowser ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // get the rectangle relative to DataWin
+ Rectangle aRect( ImplFieldRectPixel( nRow, nColumnId ) );
+ if ( aRect.IsEmpty() )
+ return aRect;
+
+ // adjust relative to BrowseBox's output area
+ Point aTopLeft( aRect.TopLeft() );
+ if ( bRelToBrowser )
+ {
+ aTopLeft = pDataWin->OutputToScreenPixel( aTopLeft );
+ aTopLeft = ScreenToOutputPixel( aTopLeft );
+ }
+
+ return Rectangle( aTopLeft, aRect.GetSize() );
+}
+
+//-------------------------------------------------------------------
+
+Rectangle BrowseBox::GetRowRectPixel( long nRow, BOOL bRelToBrowser ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // get the rectangle relative to DataWin
+ Rectangle aRect;
+ if ( nTopRow > nRow )
+ // row is above visible area
+ return aRect;
+ aRect = Rectangle(
+ Point( 0, GetDataRowHeight() * (nRow-nTopRow) ),
+ Size( pDataWin->GetOutputSizePixel().Width(), GetDataRowHeight() ) );
+ if ( aRect.TopLeft().Y() > pDataWin->GetOutputSizePixel().Height() )
+ // row is below visible area
+ return aRect;
+
+ // adjust relative to BrowseBox's output area
+ Point aTopLeft( aRect.TopLeft() );
+ if ( bRelToBrowser )
+ {
+ aTopLeft = pDataWin->OutputToScreenPixel( aTopLeft );
+ aTopLeft = ScreenToOutputPixel( aTopLeft );
+ }
+
+ return Rectangle( aTopLeft, aRect.GetSize() );
+}
+
+//-------------------------------------------------------------------
+
+Rectangle BrowseBox::ImplFieldRectPixel( long nRow, USHORT nColumnId ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // compute the X-coordinte realtiv to DataWin by accumulation
+ long nColX = 0;
+ USHORT nFrozenCols = FrozenColCount();
+ USHORT nCol;
+ for ( nCol = 0;
+ nCol < pCols->Count() && pCols->GetObject(nCol)->GetId() != nColumnId;
+ ++nCol )
+ if ( pCols->GetObject(nCol)->IsFrozen() || nCol >= nFirstCol )
+ nColX += pCols->GetObject(nCol)->Width();
+
+ if ( nCol >= pCols->Count() || ( nCol >= nFrozenCols && nCol < nFirstCol ) )
+ return Rectangle();
+
+ // compute the Y-coordinate relative to DataWin
+ long nRowY = ( nRow - nTopRow ) * GetDataRowHeight();
+
+ // assemble the Rectangle relative to DataWin
+ return Rectangle(
+ Point( nColX + MIN_COLUMNWIDTH, nRowY ),
+ Size( pCols->GetObject(nCol)->Width() - 2*MIN_COLUMNWIDTH,
+ GetDataRowHeight() - 1 ) );
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::GetRowAtYPosPixel( long nY, BOOL bRelToBrowser ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // compute the Y-coord
+ if ( bRelToBrowser )
+ {
+ Point aDataTopLeft = pDataWin->OutputToScreenPixel( Point(0, 0) );
+ Point aTopLeft = OutputToScreenPixel( Point(0, 0) );
+ nY -= aDataTopLeft.Y() - aTopLeft.Y();
+ }
+
+ // no row there (e.g. in the header)
+ if ( nY < 0 || nY >= pDataWin->GetOutputSizePixel().Height() )
+ return -1;
+
+ return nY / GetDataRowHeight() + nTopRow;
+}
+
+//-------------------------------------------------------------------
+
+Rectangle BrowseBox::GetFieldRect( USHORT nColumnId ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return GetFieldRectPixel( nCurRow, nColumnId );
+}
+
+//-------------------------------------------------------------------
+
+USHORT BrowseBox::GetColumnAtXPosPixel( long nX, BOOL ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // accumulate the withds of the visible columns
+ long nColX = 0;
+ USHORT nCol;
+ for ( nCol = 0; nCol < USHORT(pCols->Count()); ++nCol )
+ {
+ BrowserColumn *pCol = pCols->GetObject(nCol);
+ if ( pCol->IsFrozen() || nCol >= nFirstCol )
+ nColX += pCol->Width();
+
+ if ( nColX > nX )
+ return nCol;
+ }
+
+ return BROWSER_INVALIDID;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ReserveControlArea( USHORT nWidth )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( nWidth != nControlAreaWidth )
+ {
+ nControlAreaWidth = nWidth;
+ UpdateScrollbars();
+ }
+}
+
+//-------------------------------------------------------------------
+
+Rectangle BrowseBox::GetControlArea() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return Rectangle(
+ Point( 0, GetOutputSizePixel().Height() - aHScroll.GetSizePixel().Height() ),
+ Size( GetOutputSizePixel().Width() - aHScroll.GetSizePixel().Width(),
+ aHScroll.GetSizePixel().Height() ) );
+}
+
+#if SUPD<558
+//-------------------------------------------------------------------
+
+BrowserMode BrowseBox::GetMode( ) const
+{
+ return m_nCurrentMode;
+}
+#endif
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetMode( BrowserMode nMode )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+#ifdef DBG_MIx
+ Sound::Beep();
+ nMode =
+// BROWSER_COLUMNSELECTION |
+// BROWSER_MULTISELECTION |
+ BROWSER_THUMBDRAGGING |
+ BROWSER_KEEPHIGHLIGHT |
+ BROWSER_HLINES |
+ BROWSER_VLINES |
+// BROWSER_HIDECURSOR |
+// BROWSER_NO_HSCROLL |
+// BROWSER_NO_SCROLLBACK |
+ BROWSER_AUTO_VSCROLL |
+ BROWSER_AUTO_HSCROLL |
+ BROWSER_TRACKING_TIPS |
+// BROWSER_HIGHLIGHT_NONE |
+ BROWSER_HIGHLIGHT_AUTO |
+// BROWSER_HIGHLIGHT_MANU |
+ BROWSER_HEADERBAR_NEW |
+// BROWSER_AUTOSIZE_LASTCOL |
+ 0;
+#endif
+
+ ((BrowserDataWin*)pDataWin)->bAutoHScroll =
+ BROWSER_AUTO_HSCROLL == ( nMode & BROWSER_AUTO_HSCROLL);
+ ((BrowserDataWin*)pDataWin)->bAutoVScroll =
+ BROWSER_AUTO_VSCROLL == ( nMode & BROWSER_AUTO_VSCROLL);
+
+ ((BrowserDataWin*)pDataWin)->bNoHScroll =
+ BROWSER_NO_HSCROLL == ( nMode & BROWSER_NO_HSCROLL);
+ if ( ((BrowserDataWin*)pDataWin)->bNoHScroll )
+ {
+ aHScroll.Hide();
+ nControlAreaWidth = 0;
+ }
+ else
+ nControlAreaWidth = USHRT_MAX;
+
+ ((BrowserDataWin*)pDataWin)->bNoScrollBack =
+ BROWSER_NO_SCROLLBACK == ( nMode & BROWSER_NO_SCROLLBACK);
+
+ long nOldRowSel = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel;
+ MultiSelection *pOldRowSel = bMultiSelection ? uRow.pSel : 0;
+ MultiSelection *pOldColSel = pColSel;
+
+ delete pVScroll;
+
+ bThumbDragging = ( nMode & BROWSER_THUMBDRAGGING ) == BROWSER_THUMBDRAGGING;
+ bMultiSelection = ( nMode & BROWSER_MULTISELECTION ) == BROWSER_MULTISELECTION;
+ bColumnCursor = ( nMode & BROWSER_COLUMNSELECTION ) == BROWSER_COLUMNSELECTION;
+ bKeepHighlight = ( nMode & BROWSER_KEEPSELECTION ) == BROWSER_KEEPSELECTION;
+
+ bHideSelect = ((nMode & BROWSER_HIDESELECT) == BROWSER_HIDESELECT);
+ bHideCursor = ((nMode & BROWSER_HIDECURSOR) == BROWSER_HIDECURSOR);
+ m_bFocusOnlyCursor = ((nMode & BROWSER_CURSOR_WO_FOCUS) == 0);
+
+ bHLines = ( nMode & BROWSER_HLINESFULL ) == BROWSER_HLINESFULL;
+ bVLines = ( nMode & BROWSER_VLINESFULL ) == BROWSER_VLINESFULL;
+ bHDots = ( nMode & BROWSER_HLINESDOTS ) == BROWSER_HLINESDOTS;
+ bVDots = ( nMode & BROWSER_VLINESDOTS ) == BROWSER_VLINESDOTS;
+
+ WinBits nVScrollWinBits =
+ WB_VSCROLL | ( ( nMode & BROWSER_THUMBDRAGGING ) ? WB_DRAG : 0 );
+ pVScroll = ( nMode & BROWSER_TRACKING_TIPS ) == BROWSER_TRACKING_TIPS
+ ? new BrowserScrollBar( this, nVScrollWinBits,
+ (BrowserDataWin*) pDataWin )
+ : new ScrollBar( this, nVScrollWinBits );
+ pVScroll->SetLineSize( 1 );
+ pVScroll->SetPageSize(1);
+ pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
+ pVScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
+
+ ((BrowserDataWin*)pDataWin)->bHighlightAuto =
+ BROWSER_HIGHLIGHT_AUTO == ( nMode & BROWSER_HIGHLIGHT_AUTO ) ||
+ BROWSER_HIGHLIGHT_MANU != ( nMode & BROWSER_HIGHLIGHT_MANU );
+ ((BrowserDataWin*)pDataWin)->bAutoSizeLastCol =
+ BROWSER_AUTOSIZE_LASTCOL == ( nMode & BROWSER_AUTOSIZE_LASTCOL );
+ ((BrowserDataWin*)pDataWin)->bOwnDataChangedHdl =
+ BROWSER_OWN_DATACHANGED == ( nMode & BROWSER_OWN_DATACHANGED );
+
+ // Headerbar erzeugen, was passiert, wenn eine erzeugt werden muß und schon Spalten bestehen ?
+ if ( BROWSER_HEADERBAR_NEW == ( nMode & BROWSER_HEADERBAR_NEW ) )
+ {
+ if (!((BrowserDataWin*)pDataWin)->pHeaderBar)
+ ((BrowserDataWin*)pDataWin)->pHeaderBar = CreateHeaderBar( this );
+ }
+ else
+ {
+ DELETEZ(((BrowserDataWin*)pDataWin)->pHeaderBar);
+ }
+
+
+
+ if ( bColumnCursor )
+ {
+ pColSel = pOldColSel ? pOldColSel : new MultiSelection;
+ pColSel->SetTotalRange( Range( 0, pCols->Count()-1 ) );
+ }
+ else
+ {
+ pColSel = 0;
+ delete pColSel;
+ }
+
+ if ( bMultiSelection )
+ {
+ if ( pOldRowSel )
+ uRow.pSel = pOldRowSel;
+ else
+ uRow.pSel = new MultiSelection;
+ }
+ else
+ {
+ uRow.nSel = nOldRowSel;
+ delete pOldRowSel;
+ }
+
+ if ( bBootstrapped )
+ {
+ StateChanged( STATE_CHANGE_INITSHOW );
+ if ( bMultiSelection && !pOldRowSel &&
+ nOldRowSel != BROWSER_ENDOFSELECTION )
+ uRow.pSel->Select( nOldRowSel );
+ }
+
+ if ( pDataWin )
+ pDataWin->Invalidate();
+
+ // kein Cursor auf Handle-Column
+ if ( nCurColId == 0 )
+ nCurColId = GetColumnId( 1 );
+
+ m_nCurrentMode = nMode;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::VisibleRowsChanged( long nNewTopRow, USHORT nNumRows)
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // Das alte Verhalten: NumRows automatisch korrigieren:
+ if ( nRowCount < GetRowCount() )
+ {
+ RowInserted(nRowCount,GetRowCount() - nRowCount,FALSE);
+ }
+ else if ( nRowCount > GetRowCount() )
+ {
+ RowRemoved(nRowCount-(nRowCount - GetRowCount()),nRowCount - GetRowCount(),FALSE);
+ }
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::IsCursorMoveAllowed( long nNewRow, USHORT nNewColId ) const
+
+/* [Beschreibung]
+
+ Diese virtuelle Methode wird immer gerufen bevor der Cursor direkt
+ bewegt werden soll. Durch 'return FALSE' kann verhindert werden, da\s
+ dies geschieht, wenn z.B. ein Datensatz irgendwelchen Rules widerspricht.
+
+ Diese Methode wird nicht gerufen, wenn die Cursorbewegung durch
+ ein L"oschen oder Einf"ugen (einer Zeile/Spalte) ausgel"ost wird, also
+ genaugenommen nur eine Cursor-Korrektur vorliegt.
+
+ Die Basisimplementierung liefert derzeit immer TRUE.
+*/
+
+{
+ return TRUE;
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::GetDataRowHeight() const
+{
+ return CalcZoom(nDataRowHeight ? nDataRowHeight : ImpGetDataRowHeight());
+}
+
+//-------------------------------------------------------------------
+
+Window& BrowseBox::GetEventWindow() const
+{
+ return *((BrowserDataWin*)pDataWin)->pEventWin;
+}
+
+//-------------------------------------------------------------------
+
+#if SUPD >= 376
+
+BrowserHeader* BrowseBox::CreateHeaderBar( BrowseBox* pParent )
+{
+ BrowserHeader* pNewBar = new BrowserHeader( pParent );
+ pNewBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
+ return pNewBar;
+}
+
+void BrowseBox::SetHeaderBar( BrowserHeader* pHeaderBar )
+{
+ delete ( (BrowserDataWin*)pDataWin )->pHeaderBar;
+ ( (BrowserDataWin*)pDataWin )->pHeaderBar = pHeaderBar;
+ ( (BrowserDataWin*)pDataWin )->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
+}
+
+#endif
+
+//-------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+const char* BrowseBoxCheckInvariants( const void * pVoid )
+{
+ const BrowseBox * p = (const BrowseBox *)pVoid;
+
+ if (p->nRowCount < 0) return "BrowseBox: nRowCount < 0";
+ if (p->nTopRow < 0) return "BrowseBox: nTopRow < 0";
+ if (p->nTopRow >= p->nRowCount && p->nRowCount != 0) return "BrowseBox: nTopRow >= nRowCount && nRowCount != 0";
+ if (p->nCurRow < -1) return "BrowseBox: nCurRow < -1";
+ if (p->nCurRow > p->nRowCount) return "BrowseBox: nCurRow > nRowCount";
+
+ // Leider waehrend der Bearbeitung nicht immer der Fall:
+ //if (p->nCurRow < 0 && p->nRowCount != 0) return "nCurRow < 0 && nRowCount != 0";
+ //if (p->nCurRow >= p->nRowCount && p->nRowCount != 0) return "nCurRow >= nRowCount && nRowCount != 0";
+
+ return NULL;
+}
+#endif
+
+//-------------------------------------------------------------------
+long BrowseBox::GetTitleHeight() const
+{
+ long nHeight;
+ // ask the header bar for the text height (if possible), as the header bar's font is adjusted with
+ // our (and the header's) zoom factor
+ HeaderBar* pHeaderBar = ( (BrowserDataWin*)pDataWin )->pHeaderBar;
+ if ( pHeaderBar )
+ nHeight = pHeaderBar->GetTextHeight();
+ else
+ nHeight = GetTextHeight();
+
+ return nTitleLines ? nTitleLines * nHeight + 4 : 0;
+}
+
+//-------------------------------------------------------------------
+long BrowseBox::CalcReverseZoom(long nVal)
+{
+ if (IsZoom())
+ {
+ const Fraction& rZoom = GetZoom();
+ double n = (double)nVal;
+ n *= (double)rZoom.GetDenominator();
+ n /= (double)rZoom.GetNumerator();
+ nVal = n>0 ? (long)(n + 0.5) : -(long)(-n + 0.5);
+ }
+
+ return nVal;
+}
+
+//-------------------------------------------------------------------
+HeaderBar* BrowseBox::GetHeaderBar() const
+{
+ return ((BrowserDataWin*)pDataWin)->pHeaderBar;
+}
+
+
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
new file mode 100644
index 000000000000..916db78bc5c5
--- /dev/null
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -0,0 +1,2021 @@
+/*************************************************************************
+ *
+ * $RCSfile: brwbox2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/debug.hxx>
+#include <brwbox.hxx>
+#include "datwin.hxx"
+
+#ifndef _SV_SALGTYPE_HXX
+#include <vcl/salgtype.hxx>
+#endif
+
+#pragma hdrstop
+
+#ifndef _SV_MULTISEL_HXX
+#include <tools/multisel.hxx>
+#endif
+
+#if SUPD<558
+BOOL BrowseBox::m_bFocusOnlyCursor;
+Color BrowseBox::m_aCursorColor;
+BrowserMode BrowseBox::m_nCurrentMode;
+#endif
+
+
+//===================================================================
+
+DBG_NAMEEX(BrowseBox);
+
+//===================================================================
+
+extern const char* BrowseBoxCheckInvariants( const void * pVoid );
+
+DECLARE_LIST( BrowserColumns, BrowserColumn* );
+
+//===================================================================
+
+void BrowseBox::Command( const CommandEvent& rEvt )
+{
+ if ( !((BrowserDataWin*)pDataWin)->bInCommand )
+ Control::Command( rEvt );
+}
+
+//===================================================================
+
+BOOL BrowseBox::IsInCommandEvent() const
+{
+ return ((BrowserDataWin*)pDataWin)->bInCommand;
+}
+
+//===================================================================
+
+void BrowseBox::StateChanged( StateChangedType nStateChange )
+{
+ if ( STATE_CHANGE_INITSHOW == nStateChange )
+ {
+ bBootstrapped = TRUE; // muss zuerst gesetzt werden!
+
+ Resize();
+ if ( bMultiSelection )
+ uRow.pSel->SetTotalRange( Range( 0, nRowCount - 1 ) );
+ if ( nRowCount == 0 )
+ nCurRow = BROWSER_ENDOFSELECTION;
+ else if ( nCurRow == BROWSER_ENDOFSELECTION )
+ nCurRow = 0;
+
+
+ if ( HasFocus() )
+ {
+ bSelectionIsVisible = TRUE;
+ bHasFocus = TRUE;
+ }
+ UpdateScrollbars();
+ AutoSizeLastColumn();
+ CursorMoved();
+ }
+ else if (STATE_CHANGE_ZOOM == nStateChange)
+ {
+ pDataWin->SetZoom(GetZoom());
+ HeaderBar* pHeaderBar = ( (BrowserDataWin*)pDataWin )->pHeaderBar;
+ if (pHeaderBar)
+ pHeaderBar->SetZoom(GetZoom());
+
+ // let the cols calc their new widths and adjust the header bar
+ for ( USHORT nPos = 0; nPos < pCols->Count(); ++nPos )
+ {
+ pCols->GetObject(nPos)->ZoomChanged(GetZoom());
+ if ( pHeaderBar )
+ pHeaderBar->SetItemSize( pCols->GetObject(nPos)->GetId(), pCols->GetObject(nPos)->Width() );
+ }
+
+ // all our controls have to be repositioned
+ Resize();
+ }
+}
+
+//===================================================================
+
+void BrowseBox::Select()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::DoubleClick( const BrowserMouseEvent & )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::CursorMoved()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::QueryColumnResize( USHORT nId, long nWidth )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ return nWidth;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ColumnResized( USHORT nId )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ColumnMoved( USHORT nId )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::StartScroll()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ //((Control*)pDataWin)->HideFocus();
+ DoHideCursor( "StartScroll" );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::EndScroll()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ UpdateScrollbars();
+ AutoSizeLastColumn();
+ DoShowCursor( "EndScroll" );
+}
+
+//-------------------------------------------------------------------
+
+#pragma optimize( "", off )
+
+void BrowseBox::ToggleSelection( BOOL bForce )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // selection highlight-toggling allowed?
+ if ( bHideSelect )
+ return;
+ if ( !bForce &&
+ ( bNotToggleSel || !IsUpdateMode() || !bSelectionIsVisible ) )
+ return;
+//MI, 28.01.98
+// if ( !((BrowserDataWin*)pDataWin)->bHighlightToggle &&
+// !((BrowserDataWin*)pDataWin)->bHighlightAuto )
+// return;
+
+ // only highlight painted areas!
+ bNotToggleSel = TRUE;
+ if ( FALSE && !((BrowserDataWin*)pDataWin)->bInPaint )
+ pDataWin->Update();
+
+ // accumulate areas of rows to highlight
+ RectangleList aHighlightList;
+ long nLastRowInRect = 0; // fuer den CFront
+
+ // Handle-Column nicht highlighten
+ BrowserColumn *pFirstCol = pCols->GetObject(0);
+ long nOfsX = (!pFirstCol || pFirstCol->GetId()) ? 0 : pFirstCol->Width();
+
+ // accumulate old row selection
+ long nBottomRow = nTopRow +
+ pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight();
+ if ( nBottomRow > GetRowCount() && GetRowCount() )
+ nBottomRow = GetRowCount();
+ for ( long nRow = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel;
+ nRow != BROWSER_ENDOFSELECTION && nRow <= nBottomRow;
+ nRow = bMultiSelection ? uRow.pSel->NextSelected() : BROWSER_ENDOFSELECTION )
+ {
+ if ( nRow < nTopRow )
+ continue;
+
+ Rectangle aAddRect(
+ Point( nOfsX, (nRow-nTopRow)*GetDataRowHeight() ),
+ Size( pDataWin->GetSizePixel().Width(), GetDataRowHeight() ) );
+ if ( aHighlightList.Count() && nLastRowInRect == ( nRow - 1 ) )
+ aHighlightList.First()->Union( aAddRect );
+ else
+ aHighlightList.Insert( new Rectangle( aAddRect ), (ULONG) 0 );
+ nLastRowInRect = nRow;
+ }
+
+ // unhighlight the old selection (if any)
+ while ( aHighlightList.Count() )
+ {
+ Rectangle *pRect = aHighlightList.Remove( aHighlightList.Count() - 1 );
+ pDataWin->Invalidate( *pRect );
+ delete pRect;
+ }
+
+ // unhighlight old column selection (if any)
+ for ( long nColId = pColSel ? pColSel->FirstSelected() : BROWSER_ENDOFSELECTION;
+ nColId != BROWSER_ENDOFSELECTION;
+ nColId = pColSel->NextSelected() )
+ {
+ Rectangle aRect( GetFieldRectPixel(nCurRow,
+ pCols->GetObject(nColId)->GetId(),
+ FALSE ) );
+ aRect.Left() -= MIN_COLUMNWIDTH;
+ aRect.Right() += MIN_COLUMNWIDTH;
+ aRect.Top() = 0;
+ aRect.Bottom() = pDataWin->GetOutputSizePixel().Height();
+ pDataWin->Invalidate( aRect );
+ }
+
+ bNotToggleSel = FALSE;
+}
+
+#pragma optimize( "", on )
+
+//-------------------------------------------------------------------
+
+void BrowseBox::DrawCursor()
+{
+ short nCursorHideCount = GetCursorHideCount();
+ BOOL bHidden = bHideCursor || !bSelectionIsVisible ||
+ !IsUpdateMode() || bScrolling || nCurRow < 0;
+
+ if (PaintCursorIfHiddenOnce())
+ bHidden |= ( GetCursorHideCount() > 1 );
+ else
+ bHidden |= ( GetCursorHideCount() > 0 );
+// bHidden |= ( GetCursorHideCount() > 0 ) && !( ( !m_bFocusOnlyCursor && GetCursorHideCount() == 1 ) && !HasFocus() );
+ // hidden if the hide count non-zero
+ // exception : we hided the cursor exactly once in LoseFocus and we have to show the cursor
+
+ // keine Cursor auf Handle-Column
+ if ( nCurColId == 0 )
+ nCurColId = GetColumnId(1);
+
+ // Cursor-Rechteck berechnen
+ Rectangle aCursor;
+ if ( bColumnCursor )
+ {
+ aCursor = GetFieldRectPixel( nCurRow, nCurColId, FALSE );
+ //! --aCursor.Bottom();
+ aCursor.Left() -= MIN_COLUMNWIDTH;
+ aCursor.Right() += 1;
+ aCursor.Bottom() += 1;
+ }
+ else
+ aCursor = Rectangle(
+ Point( ( pCols->Count() && pCols->GetObject(0)->GetId() == 0 ) ?
+ pCols->GetObject(0)->Width() : 0,
+ (nCurRow - nTopRow) * GetDataRowHeight() + 1 ),
+ Size( pDataWin->GetOutputSizePixel().Width() + 1,
+ GetDataRowHeight() - 2 ) );
+ if ( bHLines )
+ {
+ if ( !bMultiSelection )
+ --aCursor.Top();
+ --aCursor.Bottom();
+ }
+
+ //!mi_mac pDataWin->Update();
+
+ if (m_aCursorColor == COL_TRANSPARENT)
+ {
+ // auf diesem Plattformen funktioniert der StarView-Focus richtig
+ if ( bHidden )
+ ((Control*)pDataWin)->HideFocus();
+ else
+ ((Control*)pDataWin)->ShowFocus( aCursor );
+ }
+ else
+ {
+ Color rCol = bHidden ? pDataWin->GetFillColor() : m_aCursorColor;
+ Color aOldFillColor = pDataWin->GetFillColor();
+ Color aOldLineColor = pDataWin->GetLineColor();
+ pDataWin->SetFillColor();
+ pDataWin->SetLineColor( rCol );
+ pDataWin->DrawRect( aCursor );
+ pDataWin->SetLineColor( aOldLineColor );
+ pDataWin->SetFillColor( aOldFillColor );
+ }
+}
+
+//-------------------------------------------------------------------
+
+ULONG BrowseBox::GetColumnWidth( USHORT nId ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ USHORT nItemPos = GetColumnPos( nId );
+ if ( nItemPos >= pCols->Count() )
+ return 0;
+ return pCols->GetObject(nItemPos)->Width();
+}
+
+//-------------------------------------------------------------------
+
+USHORT BrowseBox::GetColumnId( USHORT nPos ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( nPos >= pCols->Count() )
+ return 0;
+ return pCols->GetObject(nPos)->GetId();
+}
+
+//-------------------------------------------------------------------
+
+USHORT BrowseBox::GetColumnPos( USHORT nId ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ for ( USHORT nPos = 0; nPos < pCols->Count(); ++nPos )
+ if ( pCols->GetObject(nPos)->GetId() == nId )
+ return nPos;
+ return BROWSER_INVALIDID;
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::IsFrozen( USHORT nColumnId ) const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ for ( USHORT nPos = 0; nPos < pCols->Count(); ++nPos )
+ if ( pCols->GetObject(nPos)->GetId() == nColumnId )
+ return pCols->GetObject(nPos)->IsFrozen();
+ return FALSE;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ExpandRowSelection( const BrowserMouseEvent& rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ DoHideCursor( "ExpandRowSelection" );
+
+ // expand the last selection
+ if ( bMultiSelection )
+ {
+ Range aJustifiedRange( aSelRange );
+ aJustifiedRange.Justify();
+
+ BOOL bSelectThis =
+ ( bSelect && !aJustifiedRange.IsInside( rEvt.GetRow() ) ) ||
+ ( !bSelect && aJustifiedRange.IsInside( rEvt.GetRow() ) );
+
+ if ( aJustifiedRange.IsInside( rEvt.GetRow() ) )
+ {
+ // down and up
+ while ( rEvt.GetRow() < aSelRange.Max() )
+ { // ZTC/Mac bug - dont put these statemants together!
+ SelectRow( aSelRange.Max(), bSelectThis, TRUE );
+ --aSelRange.Max();
+ }
+ while ( rEvt.GetRow() > aSelRange.Max() )
+ { // ZTC/Mac bug - dont put these statemants together!
+ SelectRow( aSelRange.Max(), bSelectThis, TRUE );
+ ++aSelRange.Max();
+ }
+ }
+ else
+ {
+ // up and down
+ BOOL bOldSelecting = bSelecting;
+ bSelecting = TRUE;
+ while ( rEvt.GetRow() < aSelRange.Max() )
+ { // ZTC/Mac bug - dont put these statemants together!
+ --aSelRange.Max();
+ if ( !IsRowSelected( aSelRange.Max() ) )
+ {
+ SelectRow( aSelRange.Max(), bSelectThis, TRUE );
+ bSelect = TRUE;
+ }
+ }
+ while ( rEvt.GetRow() > aSelRange.Max() )
+ { // ZTC/Mac bug - dont put these statemants together!
+ ++aSelRange.Max();
+ if ( !IsRowSelected( aSelRange.Max() ) )
+ {
+ SelectRow( aSelRange.Max(), bSelectThis, TRUE );
+ bSelect = TRUE;
+ }
+ }
+ bSelecting = bOldSelecting;
+ if ( bSelect )
+ Select();
+ }
+ }
+ else
+ if ( !bMultiSelection || !IsRowSelected( rEvt.GetRow() ) )
+ SelectRow( rEvt.GetRow(), TRUE );
+
+ GoToRow( rEvt.GetRow(), FALSE );
+ DoShowCursor( "ExpandRowSelection" );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::Resize()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ if ( !bBootstrapped && IsReallyVisible() )
+ BrowseBox::StateChanged( STATE_CHANGE_INITSHOW );
+ if ( !pCols->Count() )
+ {
+ ((BrowserDataWin*)pDataWin)->bResizeOnPaint = TRUE;
+ return;
+ }
+ ((BrowserDataWin*)pDataWin)->bResizeOnPaint = FALSE;
+
+ // calc the size of the scrollbars
+ // (we can't ask the scrollbars for their widths cause if we're zoomed they still have to be
+ // resized - which is done in UpdateScrollbars)
+ ULONG nSBSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ if (IsZoom())
+ nSBSize = (ULONG)(nSBSize * (double)GetZoom());
+
+ long nSize = pDataWin->GetPosPixel().Y();
+ if( !((BrowserDataWin*)pDataWin)->bNoHScroll )
+ nSize += aHScroll.GetSizePixel().Height();
+ if ( GetOutputSizePixel().Height() < nSize ) return;
+
+ DoHideCursor( "Resize" );
+ USHORT nOldVisibleRows =
+ (USHORT)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1);
+
+ // did we need a horiz. scroll bar oder gibt es eine Control Area?
+ if ( !((BrowserDataWin*)pDataWin)->bNoHScroll &&
+ ( ( pCols->Count() - FrozenColCount() ) > 1 || nControlAreaWidth > 0 ) )
+ aHScroll.Show();
+ else
+ aHScroll.Hide();
+
+ // calculate the size of the data window
+ long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight();
+ if ( aHScroll.IsVisible() )
+ nDataHeight -= nSBSize;
+
+ long nDataWidth = GetOutputSizePixel().Width();
+ if ( pVScroll->IsVisible() )
+ nDataWidth -= nSBSize;
+
+ // adjust position and size of data window
+ pDataWin->SetPosSizePixel(
+ Point( 0, GetTitleHeight() ),
+ Size( nDataWidth, nDataHeight ) );
+
+ USHORT nVisibleRows =
+ (USHORT)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1);
+
+ // TopRow ist unveraendert, aber die Anzahl sichtbarer Zeilen hat sich
+ // geaendert
+ if ( nVisibleRows != nOldVisibleRows )
+ VisibleRowsChanged(nTopRow, nVisibleRows);
+
+ UpdateScrollbars();
+
+ // Control-Area
+ Rectangle aInvalidArea( GetControlArea() );
+ aInvalidArea.Right() = GetOutputSizePixel().Width();
+ aInvalidArea.Left() = 0;
+ Invalidate( aInvalidArea );
+
+ // external header-bar
+ HeaderBar* pHeaderBar = ( (BrowserDataWin*)pDataWin )->pHeaderBar;
+ if ( pHeaderBar )
+ {
+ // Handle-Column beruecksichtigen
+ BrowserColumn *pFirstCol = pCols->GetObject(0);
+ long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width();
+ pHeaderBar->SetPosPixel( Point( nOfsX, 0 ) );
+ pHeaderBar->SetSizePixel( Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) );
+ }
+
+ AutoSizeLastColumn(); // adjust last column width
+ DoShowCursor( "Resize" );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::Paint( const Rectangle& rRect )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // initializations
+ if ( !bBootstrapped && IsReallyVisible() )
+ BrowseBox::StateChanged( STATE_CHANGE_INITSHOW );
+ if ( !pCols->Count() )
+ return;
+
+ BrowserColumn *pFirstCol = pCols->GetObject(0);
+ BOOL bHandleCol = pFirstCol && pFirstCol->GetId() == 0;
+ BOOL bHeaderBar = ((BrowserDataWin*)pDataWin)->pHeaderBar != NULL;
+
+ // draw delimitational lines
+ if ( !((BrowserDataWin*)pDataWin)->bNoHScroll )
+ DrawLine( Point( 0, aHScroll.GetPosPixel().Y() ),
+ Point( GetOutputSizePixel().Width(),
+ aHScroll.GetPosPixel().Y() ) );
+
+ if ( nTitleLines )
+ {
+ if ( !bHeaderBar )
+ DrawLine( Point( 0, GetTitleHeight() - 1 ),
+ Point( GetOutputSizePixel().Width(),
+ GetTitleHeight() - 1 ) );
+ else if ( bHandleCol )
+ DrawLine( Point( 0, GetTitleHeight() - 1 ),
+ Point( pFirstCol->Width(), GetTitleHeight() - 1 ) );
+ }
+
+ // Title Bar
+ // Wenn es eine Handle Column gibt und die Headerbar verfuegbar ist, dann nur
+ // die HandleColumn
+ // Handle-Column beruecksichtigen
+ if ( nTitleLines && (!bHeaderBar || bHandleCol) )
+ {
+ // iterate through columns to redraw
+ long nX = 0;
+ USHORT nCol;
+ for ( nCol = 0;
+ nCol < pCols->Count() && nX < rRect.Right();
+ ++nCol )
+ {
+ // skip invisible colums between frozen and scrollable area
+ if ( nCol < nFirstCol && !pCols->GetObject(nCol)->IsFrozen() )
+ nCol = nFirstCol;
+
+ // nur die HandleCol ?
+ if (bHeaderBar && bHandleCol && nCol > 0)
+ break;
+
+ BrowserColumn *pCol = pCols->GetObject(nCol);
+
+ // draw the column and increment position
+ if ( pCol->Width() > 4 )
+ {
+ ButtonFrame aButtonFrame( Point( nX, 0 ),
+ Size( pCol->Width()-1, GetTitleHeight()-1 ),
+ pCol->Title(), FALSE, FALSE,
+ 0 != (BROWSER_COLUMN_TITLEABBREVATION&pCol->Flags()) );
+ aButtonFrame .Draw( *this );
+ DrawLine( Point( nX + pCol->Width() - 1, 0 ),
+ Point( nX + pCol->Width() - 1, GetTitleHeight()-1 ) );
+ }
+ else
+ {
+ Color aOldFillColor = GetFillColor();
+ SetFillColor( Color( COL_BLACK ) );
+ DrawRect( Rectangle( Point( nX, 0 ), Size( pCol->Width(), GetTitleHeight() - 1 ) ) );
+ SetFillColor( aOldFillColor );
+ }
+
+ // skip column
+ nX += pCol->Width();
+ }
+
+ // retouching
+ if ( !bHeaderBar && nCol == pCols->Count() )
+ {
+ const StyleSettings &rSettings = GetSettings().GetStyleSettings();
+ Color aColFace( rSettings.GetFaceColor() );
+ Color aOldFillColor = GetFillColor();
+ Color aOldLineColor = GetLineColor();
+ SetFillColor( aColFace );
+ SetLineColor( aColFace );
+ DrawRect( Rectangle(
+ Point( nX, 0 ),
+ Point( rRect.Right(), GetTitleHeight() - 2 ) ) );
+ SetFillColor( aOldLineColor );
+ SetLineColor( aOldFillColor );
+ }
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::PaintRow( OutputDevice &rDev, const Rectangle &rRect )
+{
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ BOOL bDrawSelection = (nFlags & WINDOW_DRAW_NOSELECTION) == 0;
+
+ // we need pixel coordinates
+ Size aRealSize = pDev->LogicToPixel(rSize);
+ Point aRealPos = pDev->LogicToPixel(rPos);
+
+ if ((rSize.Width() < 3) || (rSize.Height() < 3))
+ // we want to have two pixels frame ...
+ return;
+
+ Font aFont = GetDataWindow().GetDrawPixelFont( pDev );
+ // the 'normal' painting uses always the data window as device to output to, so we have to calc the new font
+ // relative to the data wins current settings
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+
+ // draw a frame
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ pDev->SetLineColor(rStyleSettings.GetDarkShadowColor());
+ pDev->DrawLine(Point(aRealPos.X(), aRealPos.Y()),
+ Point(aRealPos.X(), aRealPos.Y() + aRealSize.Height() - 1));
+ pDev->DrawLine(Point(aRealPos.X(), aRealPos.Y()),
+ Point(aRealPos.X() + aRealSize.Width() - 1, aRealPos.Y()));
+ pDev->SetLineColor(rStyleSettings.GetShadowColor());
+ pDev->DrawLine(Point(aRealPos.X() + aRealSize.Width() - 1, aRealPos.Y() + 1),
+ Point(aRealPos.X() + aRealSize.Width() - 1, aRealPos.Y() + aRealSize.Height() - 1));
+ pDev->DrawLine(Point(aRealPos.X() + aRealSize.Width() - 1, aRealPos.Y() + aRealSize.Height() - 1),
+ Point(aRealPos.X() + 1, aRealPos.Y() + aRealSize.Height() - 1));
+
+ HeaderBar* pBar = ((BrowserDataWin*)pDataWin)->pHeaderBar;
+
+ // we're drawing onto a foreign device, so we have to fake the DataRowHeight for the subsequent ImplPaintData
+ // (as it is based on the settings of our data window, not the foreign device)
+ if (!nDataRowHeight)
+ ImpGetDataRowHeight();
+ long nHeightLogic = PixelToLogic(Size(0, nDataRowHeight), MAP_10TH_MM).Height();
+ long nForeignHeightPixel = pDev->LogicToPixel(Size(0, nHeightLogic), MAP_10TH_MM).Height();
+
+ long nOriginalHeight = nDataRowHeight;
+ nDataRowHeight = nForeignHeightPixel;
+
+ // this counts for the column widths, too
+ USHORT nPos;
+ for ( nPos = 0; nPos < pCols->Count(); ++nPos )
+ {
+ BrowserColumn* pCurrent = pCols->GetObject(nPos);
+
+ long nWidthLogic = PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width();
+ long nForeignWidthPixel = pDev->LogicToPixel(Size(nWidthLogic, 0), MAP_10TH_MM).Width();
+
+ pCurrent->SetWidth(nForeignWidthPixel, GetZoom());
+ if ( pBar )
+ pBar->SetItemSize( pCurrent->GetId(), pCurrent->Width() );
+ }
+
+ // a smaller area for the content
+ ++aRealPos.X();
+ ++aRealPos.Y();
+ aRealSize.Width() -= 2;
+ aRealSize.Height() -= 2;
+
+ // let the header bar draw itself
+ if ( pBar )
+ {
+ // the title height with respect to the font set for the given device
+ long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MAP_10TH_MM).Height();
+ nTitleHeight = pDev->LogicToPixel(Size(0, nTitleHeight), MAP_10TH_MM).Height();
+
+ BrowserColumn* pFirstCol = pCols->Count() ? pCols->GetObject(0) : NULL;
+
+ Point aHeaderPos(pFirstCol && (pFirstCol->GetId() == 0) ? pFirstCol->Width() : 0, 0);
+ Size aHeaderSize(aRealSize.Width() - aHeaderPos.X(), nTitleHeight);
+
+ aHeaderPos += aRealPos;
+ // do this before converting to logics !
+
+ // the header's draw expects logic coordinates, again
+ aHeaderPos = pDev->PixelToLogic(aHeaderPos);
+ aHeaderSize = pDev->PixelToLogic(aHeaderSize);
+
+ pBar->Draw(pDev, aHeaderPos, aHeaderSize, nFlags);
+
+ // draw the "upper left cell" (the intersection between the header bar and the handle column)
+ if (( pFirstCol->GetId() == 0 ) && ( pFirstCol->Width() > 4 ))
+ {
+ ButtonFrame aButtonFrame( aRealPos,
+ Size( pFirstCol->Width()-1, nTitleHeight-1 ),
+ pFirstCol->Title(), FALSE, FALSE, FALSE);
+ aButtonFrame.Draw( *pDev );
+
+ Color aOldColor = pDev->GetLineColor();
+ pDev->SetLineColor( Color( COL_BLACK ) );
+
+ pDev->DrawLine( Point( aRealPos.X(), aRealPos.Y() + nTitleHeight-1 ),
+ Point( aRealPos.X() + pFirstCol->Width() - 1, aRealPos.Y() + nTitleHeight-1 ) );
+ pDev->DrawLine( Point( aRealPos.X() + pFirstCol->Width() - 1, aRealPos.Y() ),
+ Point( aRealPos.X() + pFirstCol->Width() - 1, aRealPos.Y() + nTitleHeight-1 ) );
+
+ pDev->SetLineColor( aOldColor );
+ }
+
+ aRealPos.Y() += aHeaderSize.Height();
+ aRealSize.Height() -= aHeaderSize.Height();
+ }
+
+ // draw our own content (with clipping)
+ Region aRegion(Rectangle(aRealPos, aRealSize));
+ pDev->SetClipRegion( pDev->PixelToLogic( aRegion ) );
+
+ // do we have to paint the background
+ BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && GetDataWindow().IsControlBackground();
+ if ( bBackground )
+ {
+ Rectangle aRect( aRealPos, aRealSize );
+ pDev->SetFillColor( GetDataWindow().GetControlBackground() );
+ pDev->DrawRect( aRect );
+ }
+
+ ImplPaintData( *pDev, Rectangle( aRealPos, aRealSize ), TRUE, bDrawSelection );
+
+ // restore the column widths/data row height
+ nDataRowHeight = nOriginalHeight;
+ for ( nPos = 0; nPos < pCols->Count(); ++nPos )
+ {
+ BrowserColumn* pCurrent = pCols->GetObject(nPos);
+
+ long nForeignWidthLogic = pDev->PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width();
+ long nWidthPixel = LogicToPixel(Size(nForeignWidthLogic, 0), MAP_10TH_MM).Width();
+
+ pCurrent->SetWidth(nWidthPixel, GetZoom());
+ if ( pBar )
+ pBar->SetItemSize( pCurrent->GetId(), pCurrent->Width() );
+ }
+
+ pDev->Pop();
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL _bForeignDevice, BOOL _bDrawSelections)
+{
+ Point aOverallAreaPos = _bForeignDevice ? _rRect.TopLeft() : Point(0,0);
+ Size aOverallAreaSize = _bForeignDevice ? _rRect.GetSize() : GetDataWindow().GetOutputSizePixel();
+ Point aOverallAreaBRPos = _bForeignDevice ? _rRect.BottomRight() : Point( aOverallAreaSize.Width(), aOverallAreaSize.Height() );
+
+ long nDataRowHeigt = GetDataRowHeight();
+
+ // compute relative rows to redraw
+ ULONG nRelTopRow = _bForeignDevice ? 0 : ((ULONG)_rRect.Top() / nDataRowHeigt);
+ ULONG nRelBottomRow = (ULONG)(_bForeignDevice ? aOverallAreaSize.Height() : _rRect.Bottom()) / nDataRowHeigt;
+
+ // cache frequently used values
+ Point aPos( aOverallAreaPos.X(), nRelTopRow * nDataRowHeigt + aOverallAreaPos.Y() );
+ _rOut.SetLineColor( Color( COL_WHITE ) );
+ const StyleSettings &rSettings = _rOut.GetSettings().GetStyleSettings();
+ const Color &rHighlightTextColor = rSettings.GetHighlightTextColor();
+ const Color &rHighlightFillColor = rSettings.GetHighlightColor();
+ Color aOldTextColor = _rOut.GetTextColor();
+ Color aOldFillColor = _rOut.GetFillColor();
+ Color aOldLineColor = _rOut.GetLineColor();
+ long nHLineX = 0 == pCols->GetObject(0)->GetId()
+ ? pCols->GetObject(0)->Width()
+ : 0;
+ nHLineX += aOverallAreaPos.X();
+
+ // redraw the invalid fields
+ BOOL bRetouching = FALSE;
+ for ( ULONG nRelRow = nRelTopRow;
+ nRelRow <= nRelBottomRow && (ULONG)nTopRow+nRelRow < (ULONG)nRowCount;
+ ++nRelRow, aPos.Y() += nDataRowHeigt )
+ {
+ // get row
+ // Zur Sicherheit auf zul"assigen Bereich abfragen:
+ DBG_ASSERT( (USHORT)(nTopRow+nRelRow) >= 0 && (USHORT)(nTopRow+nRelRow) < nRowCount,
+ "BrowseBox::ImplPaintData: invalid seek" );
+ if ( (nTopRow+nRelRow) < 0 || (USHORT)(nTopRow+nRelRow) >= nRowCount )
+ continue;
+
+ // prepare row
+ ULONG nCurRow = nTopRow+nRelRow;
+ if ( !SeekRow( nCurRow) )
+ DBG_ERROR("BrowseBox::ImplPaintData: SeekRow gescheitert");
+ _rOut.SetClipRegion();
+ aPos.X() = aOverallAreaPos.X();
+
+
+ // #73325# don't paint the row outside the painting rectangle (DG)
+ // prepare auto-highlight
+ Rectangle aRowRect( Point( _rRect.TopLeft().X(), aPos.Y() ),
+ Size( _rRect.GetSize().Width(), nDataRowHeigt ) );
+ PaintRow( _rOut, aRowRect );
+
+ BOOL bRowAutoHighlight = _bDrawSelections
+ && !bHideSelect
+ && ((BrowserDataWin&)GetDataWindow()).bHighlightAuto
+ && IsRowSelected( nCurRow );
+ if ( bRowAutoHighlight )
+ {
+ _rOut.SetTextColor( rHighlightTextColor );
+ _rOut.SetFillColor( rHighlightFillColor );
+ _rOut.SetLineColor();
+ _rOut.DrawRect( aRowRect );
+ }
+
+ // iterate through columns to redraw
+ USHORT nCol;
+ for ( nCol = 0; nCol < pCols->Count(); ++nCol )
+ {
+ // get column
+ BrowserColumn *pCol = pCols->GetObject(nCol);
+
+ // at end of invalid area
+ if ( aPos.X() >= _rRect.Right() )
+ break;
+
+ // skip invisible colums between frozen and scrollable area
+ if ( nCol < nFirstCol && !pCol->IsFrozen() )
+ {
+ nCol = nFirstCol;
+ pCol = pCols->GetObject(nCol);
+ if (!pCol)
+ { // FS - 21.05.99 - 66325
+ // ist zwar eigentlich woanders (an der richtigen Stelle) gefixt, aber sicher ist sicher ...
+ DBG_ERROR("BrowseBox::PaintData : nFirstCol is probably invalid !");
+ break;
+ }
+ }
+
+ // prepare Column-AutoHighlight
+ BOOL bColAutoHighlight = _bDrawSelections
+ && bColumnCursor
+ && IsColumnSelected( pCol->GetId() );
+ if ( bColAutoHighlight )
+ {
+ _rOut.SetClipRegion();
+ _rOut.SetTextColor( rHighlightTextColor );
+ _rOut.SetFillColor( rHighlightFillColor );
+ _rOut.SetLineColor();
+ Rectangle aFieldRect( aPos,
+ Size( pCol->Width(), nDataRowHeigt ) );
+ _rOut.DrawRect( aFieldRect );
+ }
+
+ if (!m_bFocusOnlyCursor && (pCol->GetId() == GetCurColumnId()) && (nCurRow == GetCurRow()))
+ DrawCursor();
+
+ // draw a single field
+ // #63864#, Sonst wird auch etwas gezeichnet, bsp Handle Column
+ if (pCol->Width())
+ {
+ // clip the column's output to the field area
+ if (_bForeignDevice)
+ { // (not neccessary if painting onto the data window)
+ Size aFieldSize(pCol->Width(), nDataRowHeigt);
+
+ if (aPos.X() + aFieldSize.Width() > aOverallAreaBRPos.X())
+ aFieldSize.Width() = aOverallAreaBRPos.X() - aPos.X();
+
+ if (aPos.Y() + aFieldSize.Height() > aOverallAreaBRPos.Y() + 1)
+ {
+ // for non-handle cols we don't clip vertically : we just don't draw the cell if the line isn't completely visible
+ if (pCol->GetId() != 0)
+ continue;
+ aFieldSize.Height() = aOverallAreaBRPos.Y() + 1 - aPos.Y();
+ }
+
+ Region aClipToField(Rectangle(aPos, aFieldSize));
+ _rOut.SetClipRegion(aClipToField);
+ }
+ pCol->Draw( *this, _rOut, aPos, FALSE );
+ if (_bForeignDevice)
+ _rOut.SetClipRegion();
+ }
+
+ // reset Column-auto-highlight
+ if ( bColAutoHighlight )
+ {
+ _rOut.SetTextColor( aOldTextColor );
+ _rOut.SetFillColor( aOldFillColor );
+ _rOut.SetLineColor( aOldLineColor );
+ }
+
+ // skip column
+ aPos.X() += pCol->Width();
+ }
+
+ if ( nCol == pCols->Count() )
+ bRetouching = TRUE;
+
+ // reset auto-highlight
+ if ( bRowAutoHighlight )
+ {
+ _rOut.SetTextColor( aOldTextColor );
+ _rOut.SetFillColor( aOldFillColor );
+ _rOut.SetLineColor( aOldLineColor );
+ }
+
+ if ( bHLines )
+ {
+ // draw horizontal delimitation lines
+ _rOut.SetClipRegion();
+ Color aOldColor = _rOut.GetLineColor();
+ _rOut.SetLineColor( aLineColor );
+ long nY = aPos.Y() + nDataRowHeigt - 1;
+ if (nY <= aOverallAreaBRPos.Y())
+ _rOut.DrawLine( Point( nHLineX, nY ),
+ Point( bVLines
+ ? min(long(long(aPos.X()) - 1), aOverallAreaBRPos.X())
+ : aOverallAreaBRPos.X(),
+ nY ) );
+ _rOut.SetLineColor( aOldColor );
+ }
+ }
+
+ if (aPos.Y() > aOverallAreaBRPos.Y() + 1)
+ aPos.Y() = aOverallAreaBRPos.Y() + 1;
+ // needed for some of the following drawing
+
+ // retouching
+ _rOut.SetClipRegion();
+ aOldLineColor = _rOut.GetLineColor();
+ aOldFillColor = _rOut.GetFillColor();
+ _rOut.SetFillColor( rSettings.GetFaceColor() );
+ if ( pCols->Count() && ( pCols->GetObject(0)->GetId() == 0 ) && ( aPos.Y() <= _rRect.Bottom() ) )
+ {
+ // fill rectangle gray below handle column
+ // DG: fill it only until the end of the drawing rect and not to the end, as this may overpaint handle columns
+ _rOut.SetLineColor( Color( COL_BLACK ) );
+ _rOut.DrawRect( Rectangle(
+ Point( aOverallAreaPos.X() - 1, aPos.Y() - 1 ),
+ Point( aOverallAreaPos.X() + pCols->GetObject(0)->Width() - 1,
+ _rRect.Bottom() + 1) ) );
+ }
+ _rOut.SetFillColor( aOldFillColor );
+
+ // draw vertical delimitational line between frozen and scrollable cols
+ _rOut.SetLineColor( COL_BLACK );
+ long nFrozenWidth = GetFrozenWidth()-1;
+ _rOut.DrawLine( Point( aOverallAreaPos.X() + nFrozenWidth, aPos.Y() ),
+ Point( aOverallAreaPos.X() + nFrozenWidth, bHLines
+ ? aPos.Y() - 1
+ : aOverallAreaBRPos.Y() ) );
+
+ // draw vertical delimitational lines?
+ if ( bVLines )
+ {
+ _rOut.SetLineColor( aLineColor );
+ Point aVertPos( aOverallAreaPos.X() - 1, aOverallAreaPos.Y() );
+ long nDeltaY = aOverallAreaBRPos.Y();
+ for ( USHORT nCol = 0; nCol < pCols->Count(); ++nCol )
+ {
+ // get column
+ BrowserColumn *pCol = pCols->GetObject(nCol);
+
+ // skip invisible colums between frozen and scrollable area
+ if ( nCol < nFirstCol && !pCol->IsFrozen() )
+ {
+ nCol = nFirstCol;
+ pCol = pCols->GetObject(nCol);
+ }
+
+ // skip column
+ aVertPos.X() += pCol->Width();
+
+ // at end of invalid area
+ // invalid area is first reached when X > Right
+ // and not >=
+ if ( aVertPos.X() > _rRect.Right() )
+ break;
+
+ // draw a single line
+ if ( pCol->GetId() != 0 )
+ _rOut.DrawLine( aVertPos, Point( aVertPos.X(),
+ bHLines
+ ? aPos.Y() - 1
+ : aPos.Y() + nDeltaY ) );
+ }
+ }
+
+ _rOut.SetLineColor( aOldLineColor );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::PaintData( Window& rWin, const Rectangle& rRect )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ if ( !bBootstrapped && IsReallyVisible() )
+ BrowseBox::StateChanged( STATE_CHANGE_INITSHOW );
+
+ // initializations
+ if ( !pCols || !pCols->Count() || !rWin.IsUpdateMode() )
+ return;
+ if ( ((BrowserDataWin*)pDataWin)->bResizeOnPaint )
+ Resize();
+ // MI: wer war das denn? Window::Update();
+
+ ImplPaintData(rWin, rRect, FALSE, TRUE);
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::UpdateScrollbars()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( !bBootstrapped || !IsUpdateMode() )
+ return;
+
+ // Rekursionsschutz
+ BrowserDataWin *pBDW = (BrowserDataWin*) pDataWin;
+ if ( pBDW->bInUpdateScrollbars )
+ {
+ pBDW->bHadRecursion = TRUE;
+ return;
+ }
+ pBDW->bInUpdateScrollbars = TRUE;
+
+ // the size of the corner window (and the width of the VSB/height of the HSB)
+ ULONG nCornerSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ if (IsZoom())
+ nCornerSize = (ULONG)(nCornerSize * (double)GetZoom());
+
+ // needs VScroll?
+ long nMaxRows = (pDataWin->GetSizePixel().Height()) / GetDataRowHeight();
+ BOOL bNeedsVScroll = ((BrowserDataWin*)pDataWin)->bAutoVScroll
+ ? nTopRow || nRowCount > nMaxRows
+ : TRUE;
+ Size aDataWinSize = pDataWin->GetSizePixel();
+ if ( !bNeedsVScroll )
+ {
+ if ( pVScroll->IsVisible() )
+ {
+ pVScroll->Hide();
+ Size aNewSize( aDataWinSize );
+ aNewSize.Width() = GetOutputSizePixel().Width();
+ aDataWinSize = aNewSize;
+ }
+ }
+ else if ( !pVScroll->IsVisible() )
+ {
+ Size aNewSize( aDataWinSize );
+ aNewSize.Width() = GetOutputSizePixel().Width() - nCornerSize;
+ aDataWinSize = aNewSize;
+ }
+
+ // needs HScroll?
+ ULONG nLastCol = GetColumnAtXPosPixel( aDataWinSize.Width() - 1 );
+
+ USHORT nFrozenCols = FrozenColCount();
+ BOOL bNeedsHScroll = ((BrowserDataWin*)pDataWin)->bAutoHScroll
+ ? nFirstCol > nFrozenCols || nLastCol <= pCols->Count()
+ : !((BrowserDataWin*)pDataWin)->bNoHScroll;
+ if ( !bNeedsHScroll )
+ {
+ if ( aHScroll.IsVisible() )
+ {
+ aHScroll.Hide();
+ Size aNewSize( aDataWinSize );
+ aNewSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight();
+ aDataWinSize = aNewSize;
+ }
+ }
+ else if ( !aHScroll.IsVisible() )
+ {
+ Size aNewSize( aDataWinSize );
+ aNewSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight() - nCornerSize;
+ aDataWinSize = aNewSize;
+ }
+
+ // adjust position and Width of horizontal scrollbar
+ ULONG nHScrX = nControlAreaWidth == USHRT_MAX
+ ? GetFrozenWidth() - 1
+ : nControlAreaWidth;
+
+ aHScroll.SetPosSizePixel(
+ Point( nHScrX, GetOutputSizePixel().Height() - nCornerSize ),
+ Size( aDataWinSize.Width() - nHScrX, nCornerSize ) );
+
+ // Scrollable Columns insgesamt
+ short nScrollCols = short(pCols->Count()) - (short)nFrozenCols;
+ /*short nVisibleHSize= max(nLastCol == BROWSER_INVALIDID
+ ? pCols->Count() - nFirstCol -1
+ : nLastCol - nFirstCol - 1, 0);
+
+ aHScroll.SetVisibleSize( nVisibleHSize );
+ aHScroll.SetRange( Range( 0, Max( min(nScrollCols, nVisibleHSize), (short)0 ) ) );
+ if ( bNeedsHScroll && !aHScroll.IsVisible() )
+ aHScroll.Show();*/
+
+ // Sichtbare Columns
+ short nVisibleHSize = nLastCol == BROWSER_INVALIDID
+ ? (short)( pCols->Count() - nFirstCol )
+ : (short)( nLastCol - nFirstCol );
+
+ short nRange = Max( nScrollCols, (short)0 );
+ aHScroll.SetVisibleSize( nVisibleHSize );
+ aHScroll.SetRange( Range( 0, nRange ));
+ if ( bNeedsHScroll && !aHScroll.IsVisible() )
+ aHScroll.Show();
+
+ // adjust position and height of vertical scrollbar
+ pVScroll->SetPageSize( nMaxRows );
+
+ if ( nTopRow > nRowCount )
+ {
+ nTopRow = nRowCount - 1;
+ DBG_ERROR("BrowseBox: nTopRow > nRowCount");
+ }
+
+ if ( pVScroll->GetThumbPos() != nTopRow )
+ pVScroll->SetThumbPos( nTopRow );
+ long nVisibleSize = Min( Min( nRowCount, nMaxRows ), long(nRowCount-nTopRow) );
+ pVScroll->SetVisibleSize( nVisibleSize ? nVisibleSize : 1 );
+ pVScroll->SetRange( Range( 0, nRowCount ) );
+ pVScroll->SetPosSizePixel(
+ Point( aDataWinSize.Width(), GetTitleHeight() ),
+ Size( nCornerSize, aDataWinSize.Height() ) );
+ if ( nRowCount <
+ long( aDataWinSize.Height() / GetDataRowHeight() ) )
+ ScrollRows( -nTopRow );
+ long nDelta = nCornerSize;
+ if ( bNeedsVScroll && !pVScroll->IsVisible() )
+ pVScroll->Show();
+
+ pDataWin->SetSizePixel( aDataWinSize );
+
+ // needs corner-window?
+ // (do that AFTER positioning BOTH scrollbars)
+ if ( aHScroll.IsVisible() && pVScroll && pVScroll->IsVisible() )
+ {
+ if ( !( (BrowserDataWin*)pDataWin )->pCornerWin )
+ ( (BrowserDataWin*)pDataWin )->pCornerWin = new ScrollBarBox( this, WB_3DLOOK );
+ ( (BrowserDataWin*)pDataWin )->pCornerWin->SetPosSizePixel(
+ Point( pVScroll->GetPosPixel().X(), aHScroll.GetPosPixel().Y() ),
+ Size( nCornerSize, nCornerSize ) );
+ ( (BrowserDataWin*)pDataWin )->pCornerWin->Show();
+ }
+ else
+ DELETEZ( ( (BrowserDataWin*)pDataWin )->pCornerWin );
+
+ // ggf. Headerbar mitscrollen
+ if ( ((BrowserDataWin*)pDataWin)->pHeaderBar )
+ {
+ long nWidth = 0;
+ for ( USHORT nCol = 0;
+ nCol < pCols->Count() && nCol < nFirstCol;
+ ++nCol )
+ {
+ // HandleColumn nicht
+ if ( pCols->GetObject(nCol)->GetId() )
+ nWidth += pCols->GetObject(nCol)->Width();
+ }
+
+ ((BrowserDataWin*)pDataWin)->pHeaderBar->SetOffset( nWidth );
+ }
+
+ pBDW->bInUpdateScrollbars = FALSE;
+ if ( pBDW->bHadRecursion )
+ {
+ pBDW->bHadRecursion = FALSE;
+ UpdateScrollbars();
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::Invalidate()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // readjust cursor and selection
+ if ( bMultiSelection )
+ uRow.pSel->SetTotalRange( Range( 0, nRowCount-1 ) );
+ else
+ uRow.nSel = Min( uRow.nSel, (long)(nRowCount-1) );
+ nCurRow = Min( nCurRow, (long)(nRowCount-1 ));
+
+ // BowseBox::Resize(); if Size not set, last Culumn will be cuttet ?!?
+ Control::Invalidate(INVALIDATE_NOCHILDREN /*OV*/ );
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetUpdateMode( BOOL bUpdate )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ BOOL bWasUpdate = IsUpdateMode();
+ if ( bWasUpdate == bUpdate )
+ return;
+
+ Control::SetUpdateMode( bUpdate );
+ // OV
+ // Wenn an der BrowseBox WB_CLIPCHILDREN gesetzt ist (wg. Flackerminimierung),
+ // wird das Datenfenster nicht von SetUpdateMode invalidiert.
+ if( bUpdate )
+ ((BrowserDataWin*)pDataWin)->Invalidate();
+ ((BrowserDataWin*)pDataWin)->SetUpdateMode( bUpdate );
+
+
+ if ( bUpdate )
+ {
+ if ( bBootstrapped )
+ {
+ UpdateScrollbars();
+ AutoSizeLastColumn();
+ }
+ DoShowCursor( "SetUpdateMode" );
+ }
+ else
+ DoHideCursor( "SetUpdateMode" );
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::GetUpdateMode() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return ((BrowserDataWin*)pDataWin)->IsUpdateMode();
+}
+
+//-------------------------------------------------------------------
+
+long BrowseBox::GetFrozenWidth() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ long nWidth = 0;
+ for ( USHORT nCol = 0;
+ nCol < pCols->Count() && pCols->GetObject(nCol)->IsFrozen();
+ ++nCol )
+ nWidth += pCols->GetObject(nCol)->Width();
+ return nWidth;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::ColumnInserted( USHORT nPos )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( pColSel )
+ pColSel->Insert( nPos );
+ UpdateScrollbars();
+}
+
+//-------------------------------------------------------------------
+
+USHORT BrowseBox::FrozenColCount() const
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ USHORT nCol;
+ for ( nCol = 0;
+ nCol < pCols->Count() && pCols->GetObject(nCol)->IsFrozen();
+ ++nCol )
+ /* empty loop */;
+ return nCol;
+}
+
+//-------------------------------------------------------------------
+
+IMPL_LINK(BrowseBox,ScrollHdl,ScrollBar*,pBar)
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( pBar->GetDelta() == 0 )
+ return 0;
+
+ if ( pBar->GetDelta() < 0 && ((BrowserDataWin*)pDataWin)->bNoScrollBack )
+ {
+ UpdateScrollbars();
+ return 0;
+ }
+
+ if ( pBar == &aHScroll )
+ ScrollColumns( aHScroll.GetDelta() );
+ if ( pBar == pVScroll )
+ ScrollRows( pVScroll->GetDelta() );
+
+ return 0;
+}
+
+//-------------------------------------------------------------------
+
+IMPL_LINK( BrowseBox,EndScrollHdl,ScrollBar*, pBar )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // kein Focus grabben!
+ /// GrabFocus();
+
+ if ( /*pBar->GetDelta() <= 0 &&*/ ((BrowserDataWin*)pDataWin)->bNoScrollBack )
+ {
+ // UpdateScrollbars();
+ EndScroll();
+ return 0;
+ }
+
+ return 0;
+}
+
+//-------------------------------------------------------------------
+
+IMPL_LINK( BrowseBox, StartDragHdl, HeaderBar*, pBar )
+{
+ pBar->SetDragSize( pDataWin->GetOutputSizePixel().Height() );
+ return 0;
+}
+
+//-------------------------------------------------------------------
+// MI: es wurde immer nur die 1. Spalte resized
+#pragma optimize("elg",off)
+
+void BrowseBox::MouseButtonDown( const MouseEvent& rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ GrabFocus();
+
+ // onl< mouse events in the title-line are supported
+ const Point &rEvtPos = rEvt.GetPosPixel();
+ if ( rEvtPos.Y() >= GetTitleHeight() )
+ return;
+
+ long nX = 0;
+ long nWidth = GetOutputSizePixel().Width();
+ for ( USHORT nCol = 0; nCol < pCols->Count() && nX < nWidth; ++nCol )
+ {
+ // is this column visible?
+ BrowserColumn *pCol = pCols->GetObject(nCol);
+ if ( pCol->IsFrozen() || nCol >= nFirstCol )
+ {
+ // compute right end of column
+ long nR = nX + pCol->Width() - 1;
+
+ // at the end of a column (and not handle column)?
+ if ( pCol->GetId() && Abs( nR - rEvtPos.X() ) < 2 )
+ {
+ // start resizing the column
+ bResizing = TRUE;
+ nResizeCol = nCol;
+ nDragX = nResizeX = rEvtPos.X();
+ SetPointer( Pointer( POINTER_HSPLIT ) );
+ CaptureMouse();
+ pDataWin->DrawLine( Point( nDragX, 0 ),
+ Point( nDragX, pDataWin->GetSizePixel().Height() ) );
+ nMinResizeX = nX + MIN_COLUMNWIDTH;
+ return;
+ }
+ else if ( nX < rEvtPos.X() && nR > rEvtPos.X() )
+ {
+ MouseButtonDown( BrowserMouseEvent(
+ this, rEvt, -1, nCol, pCol->GetId(), Rectangle() ) );
+ return;
+ }
+ nX = nR + 1;
+ }
+ }
+
+ // event occured out of data area
+ if ( rEvt.IsRight() )
+ pDataWin->Command(
+ CommandEvent( Point( 1, LONG_MAX ), COMMAND_CONTEXTMENU, TRUE ) );
+ else
+ SetNoSelection();
+}
+
+#pragma optimize("",on)
+
+//-------------------------------------------------------------------
+
+void BrowseBox::MouseMove( const MouseEvent& rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ Pointer aNewPointer;
+
+ USHORT nX = 0;
+ for ( USHORT nCol = 0;
+ nCol < USHORT(pCols->Count()) &&
+ ( nX + pCols->GetObject(nCol)->Width() ) < USHORT(GetOutputSizePixel().Width());
+ ++nCol )
+ // is this column visible?
+ if ( pCols->GetObject(nCol)->IsFrozen() || nCol >= nFirstCol )
+ {
+ // compute right end of column
+ BrowserColumn *pCol = pCols->GetObject(nCol);
+ USHORT nR = (USHORT)(nX + pCol->Width() - 1);
+
+ // show resize-pointer?
+ if ( bResizing || ( pCol->GetId() &&
+ Abs( ((long) nR ) - rEvt.GetPosPixel().X() ) < MIN_COLUMNWIDTH ) )
+ {
+ aNewPointer = Pointer( POINTER_HSPLIT );
+ if ( bResizing )
+ {
+ // alte Hilfslinie loeschen
+ pDataWin->HideTracking() ;
+
+ // erlaubte breite abholen und neues Delta
+ nDragX = Max( rEvt.GetPosPixel().X(), nMinResizeX );
+ long nDeltaX = nDragX - nResizeX;
+ USHORT nId = GetColumnId(nResizeCol);
+ ULONG nOldWidth = GetColumnWidth(nId);
+ nDragX = QueryColumnResize( GetColumnId(nResizeCol),
+ nOldWidth + nDeltaX )
+ + nResizeX - nOldWidth;
+
+ // neue Hilfslinie zeichnen
+ pDataWin->ShowTracking( Rectangle( Point( nDragX, 0 ),
+ Size( 1, pDataWin->GetSizePixel().Height() ) ),
+ SHOWTRACK_SPLIT|SHOWTRACK_WINDOW );
+ }
+
+ }
+
+ nX = nR + 1;
+ }
+
+ SetPointer( aNewPointer );
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::MouseButtonUp( const MouseEvent & rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ if ( bResizing )
+ {
+ // Hilfslinie loeschen
+ pDataWin->HideTracking();
+
+ // width changed?
+ nDragX = Max( rEvt.GetPosPixel().X(), nMinResizeX );
+ if ( (nDragX - nResizeX) != (long)pCols->GetObject(nResizeCol)->Width() )
+ {
+ // resize column
+ long nMaxX = pDataWin->GetSizePixel().Width();
+ nDragX = Min( nDragX, nMaxX );
+ long nDeltaX = nDragX - nResizeX;
+ USHORT nId = GetColumnId(nResizeCol);
+ SetColumnWidth( GetColumnId(nResizeCol), GetColumnWidth(nId) + nDeltaX );
+ ColumnResized( nId );
+ }
+
+ // end action
+ SetPointer( Pointer() );
+ ReleaseMouse();
+ bResizing = FALSE;
+ }
+ else
+ MouseButtonUp( BrowserMouseEvent( (BrowserDataWin*)pDataWin,
+ MouseEvent( Point( rEvt.GetPosPixel().X(),
+ rEvt.GetPosPixel().Y() - pDataWin->GetPosPixel().Y() ),
+ rEvt.GetClicks(), rEvt.GetMode(), rEvt.GetButtons(),
+ rEvt.GetModifier() ) ) );
+}
+
+//-------------------------------------------------------------------
+
+BOOL bExtendedMode = FALSE;
+BOOL bFieldMode = FALSE;
+
+void BrowseBox::MouseButtonDown( const BrowserMouseEvent& rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ GrabFocus();
+
+ // adjust selection while and after double-click
+ if ( rEvt.GetClicks() == 2 )
+ {
+ SetNoSelection();
+ if ( rEvt.GetRow() >= 0 )
+ {
+ GoToRow( rEvt.GetRow() );
+ SelectRow( rEvt.GetRow(), TRUE, FALSE );
+ }
+ else if ( bColumnCursor && rEvt.GetColumn() != 0 )
+ SelectColumnPos( rEvt.GetColumn(), TRUE, FALSE);
+ DoubleClick( rEvt );
+ }
+ // selections
+ else if ( ( rEvt.GetMode() & ( MOUSE_SELECT | MOUSE_SIMPLECLICK ) ) &&
+ ( bColumnCursor || rEvt.GetRow() >= 0 ) )
+ {
+ if ( rEvt.GetClicks() == 1 )
+ {
+ // initialise flags
+ bDrag = FALSE;
+ bHit = FALSE;
+ bRubber = FALSE;
+ a1stPoint =
+ a2ndPoint = PixelToLogic( rEvt.GetPosPixel() );
+
+ // selection out of range?
+ if ( rEvt.GetRow() >= nRowCount ||
+ rEvt.GetColumnId() == BROWSER_INVALIDID )
+ {
+ SetNoSelection();
+ return;
+ }
+
+ // while selecting, no cursor
+ bSelecting = TRUE;
+ DoHideCursor( "MouseButtonDown" );
+
+ // DataRow?
+ if ( rEvt.GetRow() >= 0 )
+ {
+ // Zeilenselektion?
+ if ( rEvt.GetColumnId() == 0 || !bColumnCursor )
+ {
+ if ( bMultiSelection )
+ {
+ // remove column-selection, if exists
+ if ( pColSel && pColSel->GetSelectCount() )
+ {
+ ToggleSelection();
+ if ( bMultiSelection )
+ uRow.pSel->SelectAll(FALSE);
+ else
+ uRow.nSel = BROWSER_ENDOFSELECTION;
+ if ( pColSel )
+ pColSel->SelectAll(FALSE);
+ bSelect = TRUE;
+ }
+
+ // expanding mode?
+ if ( rEvt.GetMode() & MOUSE_RANGESELECT )
+ {
+ // select the further touched rows too
+ bSelect = TRUE;
+ ExpandRowSelection( rEvt );
+ return;
+ }
+
+ // click in the selected area?
+ else if ( IsRowSelected( rEvt.GetRow() ) )
+ {
+ // auf Drag&Drop warten
+ bHit = TRUE;
+ bExtendedMode = MOUSE_MULTISELECT ==
+ ( rEvt.GetMode() & MOUSE_MULTISELECT );
+ return;
+ }
+
+ // extension mode?
+ else if ( rEvt.GetMode() & MOUSE_MULTISELECT )
+ {
+ // determine the new selection range
+ // and selection/deselection
+ aSelRange = Range( rEvt.GetRow(), rEvt.GetRow() );
+ SelectRow( rEvt.GetRow(),
+ !uRow.pSel->IsSelected( rEvt.GetRow() ) );
+ bSelect = TRUE;
+ return;
+ }
+ }
+
+ // select directly
+ SetNoSelection();
+ GoToRow( rEvt.GetRow() );
+ SelectRow( rEvt.GetRow(), TRUE );
+ aSelRange = Range( rEvt.GetRow(), rEvt.GetRow() );
+ bSelect = TRUE;
+ }
+ else // Column/Field-Selection
+ {
+ // click in selected column
+ if ( IsColumnSelected( rEvt.GetColumn() ) ||
+ IsRowSelected( rEvt.GetRow() ) )
+ {
+ bHit = TRUE;
+ bFieldMode = TRUE;
+ return;
+ }
+
+ SetNoSelection();
+ GoToRowColumnId( rEvt.GetRow(), rEvt.GetColumnId() );
+ bSelect = TRUE;
+ }
+ }
+ else
+ {
+ if ( bMultiSelection && rEvt.GetColumnId() == 0 )
+ {
+ // toggle all-selection
+ if ( uRow.pSel->GetSelectCount() > ( GetRowCount() / 2 ) )
+ SetNoSelection();
+ else
+ SelectAll();
+ }
+ else
+ SelectColumnId( rEvt.GetColumnId(), TRUE, FALSE );
+ }
+
+ // ggf. Cursor wieder an
+ bSelecting = FALSE;
+ DoShowCursor( "MouseButtonDown" );
+ if ( bSelect )
+ Select();
+ }
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::MouseMove( const BrowserMouseEvent &rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::MouseButtonUp( const BrowserMouseEvent &rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ // D&D was possible, but did not occur
+ if ( bHit )
+ {
+ aSelRange = Range( rEvt.GetRow(), rEvt.GetRow() );
+ if ( bExtendedMode )
+ SelectRow( rEvt.GetRow(), FALSE );
+ else
+ {
+ SetNoSelection();
+ if ( bFieldMode )
+ GoToRowColumnId( rEvt.GetRow(), rEvt.GetColumnId() );
+ else
+ {
+ GoToRow( rEvt.GetRow() );
+ SelectRow( rEvt.GetRow(), TRUE );
+ }
+ }
+ bSelect = TRUE;
+ bExtendedMode = FALSE;
+ bFieldMode = FALSE;
+ bHit = FALSE;
+ }
+
+ // activate cursor
+ if ( bSelecting )
+ {
+ bSelecting = FALSE;
+ DoShowCursor( "MouseButtonUp" );
+ if ( bSelect )
+ Select();
+ }
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::Drop( const BrowserDropEvent& )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return FALSE;
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::QueryDrop( const BrowserDropEvent& )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ return FALSE;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::KeyInput( const KeyEvent& rEvt )
+{
+ if ( !ProcessKey( rEvt ) )
+ Control::KeyInput( rEvt );
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowseBox::ProcessKey( const KeyEvent& rEvt )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ USHORT nCode = rEvt.GetKeyCode().GetCode();
+ BOOL bShift = rEvt.GetKeyCode().IsShift();
+ BOOL bCtrl = rEvt.GetKeyCode().IsMod1();
+ BOOL bAlt = rEvt.GetKeyCode().IsMod2();
+
+ USHORT nId = BROWSER_NONE;
+
+ if ( !bAlt && !bCtrl && !bShift )
+ {
+ switch ( nCode )
+ {
+ case KEY_DOWN: nId = BROWSER_CURSORDOWN; break;
+ case KEY_UP: nId = BROWSER_CURSORUP; break;
+ case KEY_HOME: nId = BROWSER_CURSORHOME; break;
+ case KEY_END: nId = BROWSER_CURSOREND; break;
+ case KEY_TAB:
+ if ( !bColumnCursor )
+ break;
+ case KEY_RIGHT: nId = BROWSER_CURSORRIGHT; break;
+ case KEY_LEFT: nId = BROWSER_CURSORLEFT; break;
+ case KEY_SPACE: nId = BROWSER_SELECT; break;
+ }
+ if ( BROWSER_NONE != nId )
+ SetNoSelection();
+
+ switch ( nCode )
+ {
+ case KEY_PAGEDOWN: nId = BROWSER_CURSORPAGEDOWN; break;
+ case KEY_PAGEUP: nId = BROWSER_CURSORPAGEUP; break;
+ }
+ }
+
+ if ( !bAlt && !bCtrl && bShift )
+ switch ( nCode )
+ {
+ case KEY_DOWN: nId = BROWSER_SELECTDOWN; break;
+ case KEY_UP: nId = BROWSER_SELECTUP; break;
+ case KEY_TAB:
+ if ( !bColumnCursor )
+ break;
+ nId = BROWSER_CURSORLEFT; break;
+ case KEY_HOME: nId = BROWSER_SELECTHOME; break;
+ case KEY_END: nId = BROWSER_SELECTEND; break;
+ }
+
+
+ if ( !bAlt && bCtrl && !bShift )
+ switch ( nCode )
+ {
+ case KEY_DOWN: nId = BROWSER_CURSORDOWN; break;
+ case KEY_UP: nId = BROWSER_CURSORUP; break;
+ case KEY_PAGEDOWN: nId = BROWSER_CURSORENDOFFILE; break;
+ case KEY_PAGEUP: nId = BROWSER_CURSORTOPOFFILE; break;
+ case KEY_HOME: nId = BROWSER_CURSORTOPOFSCREEN; break;
+ case KEY_END: nId = BROWSER_CURSORENDOFSCREEN; break;
+ case KEY_SPACE: nId = BROWSER_ENHANCESELECTION; break;
+ }
+
+ if ( nId != BROWSER_NONE )
+ Dispatch( nId );
+ return nId != BROWSER_NONE;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::Dispatch( USHORT nId )
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+
+ long nRowsOnPage = pDataWin->GetSizePixel().Height() / GetDataRowHeight();
+ BOOL bDone = FALSE;
+
+ switch ( nId )
+ {
+ case BROWSER_CURSORDOWN:
+ if ( ( GetCurRow() + 1 ) < nRowCount )
+ bDone = GoToRow( GetCurRow() + 1, FALSE );
+ break;
+ case BROWSER_CURSORUP:
+ if ( GetCurRow() > 0 )
+ bDone = GoToRow( GetCurRow() - 1, FALSE );
+ break;
+ case BROWSER_SELECTHOME:
+ {
+ DoHideCursor( "BROWSER_SELECTHOME" );
+ for ( long nRow = GetCurRow(); nRow >= 0; --nRow )
+ SelectRow( nRow );
+ GoToRow( 0, TRUE );
+ DoShowCursor( "BROWSER_SELECTHOME" );
+ break;
+ }
+ case BROWSER_SELECTEND:
+ {
+ DoHideCursor( "BROWSER_SELECTEND" );
+ long nRowCount = GetRowCount();
+ for ( long nRow = GetCurRow(); nRow < nRowCount; ++nRow )
+ SelectRow( nRow );
+ GoToRow( GetRowCount() - 1, TRUE );
+ DoShowCursor( "BROWSER_SELECTEND" );
+ break;
+ }
+ case BROWSER_SELECTDOWN:
+ {
+ if ( ( GetCurRow() + 1 ) < nRowCount )
+ {
+ // deselect the current row, if it isn't the first
+ // and there is no other selected row above
+ long nCurRow = GetCurRow();
+ BOOL bSelect = ( !IsRowSelected( nCurRow ) ||
+ GetSelectRowCount() == 1 || IsRowSelected( nCurRow - 1 ) );
+ SelectRow( nCurRow, bSelect, TRUE );
+ if ( bDone = GoToRow( GetCurRow() + 1 , FALSE ) )
+ SelectRow( GetCurRow(), TRUE, TRUE );
+ }
+ else
+ bDone = ScrollRows( 1 ) != 0;
+ break;
+ }
+ case BROWSER_SELECTUP:
+ {
+ // deselect the current row, if it isn't the first
+ // and there is no other selected row under
+ long nCurRow = GetCurRow();
+ BOOL bSelect = ( !IsRowSelected( nCurRow ) ||
+ GetSelectRowCount() == 1 || IsRowSelected( nCurRow + 1 ) );
+ SelectRow( nCurRow, bSelect, TRUE );
+ if ( bDone = GoToRow( nCurRow - 1 , FALSE ) )
+ SelectRow( GetCurRow(), TRUE, TRUE );
+ break;
+ }
+ case BROWSER_CURSORPAGEDOWN:
+ bDone = (BOOL)ScrollRows( nRowsOnPage );
+ break;
+ case BROWSER_CURSORPAGEUP:
+ bDone = (BOOL)ScrollRows( -nRowsOnPage );
+ break;
+ case BROWSER_CURSOREND:
+ if ( bColumnCursor )
+ {
+ USHORT nNewId = GetColumnId(ColCount() -1);
+ bDone = (nNewId != 0) && GoToColumnId( nNewId );
+ break;
+ }
+ case BROWSER_CURSORENDOFFILE:
+ bDone = GoToRow( nRowCount - 1, FALSE );
+ break;
+ case BROWSER_CURSORRIGHT:
+ if ( bColumnCursor )
+ {
+ USHORT nNewPos = GetColumnPos( GetCurColumnId() ) + 1;
+ USHORT nNewId = GetColumnId( nNewPos );
+ if (nNewId != 0) // Am Zeilenende ?
+ bDone = GoToColumnId( nNewId );
+ else
+ {
+ USHORT nColId = ( GetColumnId(0) == 0 ) ? GetColumnId(1) : GetColumnId(0);
+ bDone = ( nCurRow < GetRowCount() - 1 ) && GoToRowColumnId( nCurRow + 1, nColId );
+ }
+ }
+ else
+ bDone = ScrollColumns( 1 ) != 0;
+ break;
+ case BROWSER_CURSORHOME:
+ if ( bColumnCursor )
+ {
+ USHORT nNewId = GetColumnId(1);
+ bDone = (nNewId != 0) && GoToColumnId( nNewId );
+ break;
+ }
+ case BROWSER_CURSORTOPOFFILE:
+ bDone = GoToRow( 0, FALSE );
+ break;
+ case BROWSER_CURSORLEFT:
+ if ( bColumnCursor )
+ {
+ USHORT nNewPos = GetColumnPos( GetCurColumnId() ) - 1;
+ USHORT nNewId = GetColumnId( nNewPos );
+ if (nNewId != 0)
+ bDone = GoToColumnId( nNewId );
+ else
+ bDone = (nCurRow > 0) && GoToRowColumnId(nCurRow - 1, GetColumnId(ColCount() -1));
+ }
+ else
+ bDone = ScrollColumns( -1 ) != 0;
+ break;
+ case BROWSER_ENHANCESELECTION:
+ SelectRow( GetCurRow(), !IsRowSelected( GetCurRow() ), TRUE );
+ bDone = TRUE;
+ break;
+ case BROWSER_SELECT:
+ SelectRow( GetCurRow(), !IsRowSelected( GetCurRow() ), FALSE );
+ bDone = TRUE;
+ break;
+ }
+
+ //! return bDone;
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::LoseFocus()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ DBG_TRACE1( "BrowseBox: %p->LoseFocus", this );
+
+ if ( bHasFocus )
+ {
+ DBG_TRACE1( "BrowseBox: %p->HideCursor", this );
+ DoHideCursor( "LoseFocus" );
+
+ if ( !bKeepHighlight )
+ {
+ ToggleSelection();
+ bSelectionIsVisible = FALSE;
+ }
+
+ bHasFocus = FALSE;
+ }
+ Control::LoseFocus();
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::GetFocus()
+{
+ DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
+ DBG_TRACE1( "BrowseBox: %p->GetFocus", this );
+
+ if ( !bHasFocus )
+ {
+ if ( !bSelectionIsVisible )
+ {
+ bSelectionIsVisible = TRUE;
+ if ( bBootstrapped )
+ ToggleSelection();
+ }
+
+ bHasFocus = TRUE;
+ DoShowCursor( "GetFocus" );
+ }
+ Control::GetFocus();
+}
+
+//-------------------------------------------------------------------
+
+void BrowseBox::SetCursorColor(const Color& _rCol)
+{
+ if (_rCol == m_aCursorColor)
+ return;
+
+ // ensure the cursor is hidden
+ DoHideCursor("SetCursorColor");
+ if (!m_bFocusOnlyCursor)
+ DoHideCursor("SetCursorColor - force");
+
+ m_aCursorColor = _rCol;
+
+ if (!m_bFocusOnlyCursor)
+ DoShowCursor("SetCursorColor - force");
+ DoShowCursor("SetCursorColor");
+}
+
+
diff --git a/svtools/source/brwbox/brwhead.cxx b/svtools/source/brwbox/brwhead.cxx
new file mode 100644
index 000000000000..f38be0045746
--- /dev/null
+++ b/svtools/source/brwbox/brwhead.cxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: brwhead.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "brwhead.hxx"
+#include "brwbox.hxx"
+
+#pragma hdrstop
+
+//===================================================================
+
+BrowserHeader::BrowserHeader( BrowseBox* pParent, WinBits nWinBits )
+: HeaderBar( pParent, nWinBits ),
+ _pBrowseBox( pParent )
+{
+ long nHeight = pParent->IsZoom() ? pParent->CalcZoom(nHeight) : pParent->GetTitleHeight();
+
+ SetPosSizePixel( Point( 0, 0),
+ Size( pParent->GetOutputSizePixel().Width(),
+ nHeight ) );
+ Show();
+}
+
+//-------------------------------------------------------------------
+
+void BrowserHeader::Command( const CommandEvent& rCEvt )
+{
+ if ( !GetCurItemId() && COMMAND_CONTEXTMENU == rCEvt.GetCommand() )
+ {
+ Point aPos( rCEvt.GetMousePosPixel() );
+ _pBrowseBox->GetDataWindow().Command( CommandEvent(
+ Point( aPos.X(), aPos.Y() - GetSizePixel().Height() ),
+ COMMAND_CONTEXTMENU, rCEvt.IsMouseEvent() ) );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowserHeader::Select()
+{
+ HeaderBar::Select();
+}
+
+//-------------------------------------------------------------------
+
+void BrowserHeader::EndDrag()
+{
+ // call before other actions, it looks more nice in most cases
+ HeaderBar::EndDrag();
+ Update();
+
+ // not aborted?
+ USHORT nId = GetCurItemId();
+ if ( nId )
+ {
+ // Handle-Column?
+ if ( nId == USHRT_MAX-1 )
+ nId = 0;
+
+ if ( !IsItemMode() )
+ {
+ // column resize
+ _pBrowseBox->SetColumnWidth( nId, GetItemSize( nId ) );
+ _pBrowseBox->ColumnResized( nId );
+ SetItemSize( nId, _pBrowseBox->GetColumnWidth( nId ) );
+ }
+ else
+ {
+ // column drag
+ // Hat sich die Position eigentlich veraendert
+ // Handlecolumn beruecksichtigen
+ USHORT nOldPos = _pBrowseBox->GetColumnPos(nId),
+ nNewPos = GetItemPos( nId );
+
+ if (!_pBrowseBox->GetColumnId(0)) // Handle
+ nNewPos++;
+
+ if (nOldPos != nNewPos)
+ {
+ _pBrowseBox->SetColumnPos( nId, nNewPos );
+ _pBrowseBox->ColumnMoved( nId );
+ }
+ }
+ }
+}
+
+
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
new file mode 100644
index 000000000000..3bf03276acf7
--- /dev/null
+++ b/svtools/source/brwbox/datwin.cxx
@@ -0,0 +1,694 @@
+/*************************************************************************
+ *
+ * $RCSfile: datwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "datwin.hxx"
+
+#pragma hdrstop
+
+#ifndef _APP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _HELP_HXX
+#include <vcl/help.hxx>
+#endif
+#ifndef _IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+
+#include <tools/debug.hxx>
+
+DECLARE_LIST( BrowserColumns, BrowserColumn* );
+
+//===================================================================
+
+static String FitInWidth( OutputDevice& rWin, String aVal, ULONG nWidth, BOOL bAbbr )
+{
+ if ( nWidth < 8 )
+ return String();
+ ULONG nValWidth = rWin.GetTextWidth( aVal );
+ if ( nValWidth > nWidth )
+ {
+ String aDots( "...", RTL_TEXTENCODING_IBM_850 );
+ ULONG nDotsWidth = 2;
+ if ( bAbbr )
+ nDotsWidth = rWin.GetTextWidth( aDots );
+ if ( nDotsWidth > nWidth )
+ aVal.Erase();
+ else
+ {
+ aVal.Erase( aVal.Len() - 1 );
+ while ( aVal.Len() && rWin.GetTextWidth( aVal ) + nDotsWidth > nWidth )
+ aVal.Erase( aVal.Len() - 1 );
+ if ( bAbbr )
+ aVal += aDots;
+ }
+ }
+
+ return aVal;
+}
+
+//-------------------------------------------------------------------
+
+void ButtonFrame::Draw( OutputDevice& rDev )
+{
+ Color aOldFillColor = rDev.GetFillColor();
+ Color aOldLineColor = rDev.GetLineColor();
+
+ const StyleSettings &rSettings = rDev.GetSettings().GetStyleSettings();
+ Color aColLight( rSettings.GetLightColor() );
+ Color aColShadow( rSettings.GetShadowColor() );
+ Color aColFace( rSettings.GetFaceColor() );
+
+ rDev.SetLineColor( bPressed ? aColShadow : aColLight );
+ rDev.DrawLine( aRect.TopLeft(), Point( aRect.Right(), aRect.Top() ) );
+ rDev.DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom() - 1 ) );
+ rDev.SetLineColor( bPressed ? aColLight : aColShadow );
+ rDev.DrawLine( aRect.BottomRight(), Point( aRect.Right(), aRect.Top() ) );
+ rDev.DrawLine( aRect.BottomRight(), Point( aRect.Left(), aRect.Bottom() ) );
+
+ rDev.SetLineColor( aColFace );
+ rDev.SetFillColor( aColFace );
+ rDev.DrawRect( aInnerRect );
+
+ if ( aText.Len() )
+ {
+ String aVal( FitInWidth( rDev, aText, aInnerRect.GetWidth() - 2*MIN_COLUMNWIDTH, bAbbr ) );
+ Font aFont( rDev.GetFont() );
+ BOOL bOldTransp = aFont.IsTransparent();
+ if ( !bOldTransp )
+ {
+ aFont.SetTransparent( TRUE );
+ rDev.SetFont( aFont );
+ }
+
+ rDev.DrawText( Point(
+ ( aInnerRect.Left() + aInnerRect.Right() ) / 2 - ( rDev.GetTextWidth(aVal) / 2 ),
+ aInnerRect.Top() ), aVal );
+
+ if ( !bOldTransp )
+ {
+ aFont.SetTransparent(FALSE);
+ rDev.SetFont( aFont );
+ }
+ }
+
+ if ( bCurs )
+ {
+ rDev.SetLineColor( Color( COL_BLACK ) );
+ rDev.SetFillColor();
+ rDev.DrawRect( Rectangle(
+ Point( aRect.Left(), aRect.Top() ), Point( aRect.Right(), aRect.Bottom() ) ) );
+ }
+
+ rDev.SetLineColor( aOldLineColor );
+ rDev.SetFillColor( aOldFillColor );
+}
+
+//-------------------------------------------------------------------
+
+BrowserColumn::BrowserColumn( USHORT nItemId, const class Image &rImage,
+ const String& rTitle, ULONG nWidthPixel, const Fraction& rCurrentZoom,
+ HeaderBarItemBits nFlags )
+: _nId( nItemId ),
+ _nWidth( nWidthPixel ),
+ _aImage( rImage ),
+ _aTitle( rTitle ),
+ _bFrozen( FALSE ),
+ _nFlags( nFlags )
+{
+ double n = (double)_nWidth;
+ n *= (double)rCurrentZoom.GetDenominator();
+ n /= (double)rCurrentZoom.GetNumerator();
+ _nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5);
+}
+
+//-------------------------------------------------------------------
+
+void BrowserColumn::SetWidth(ULONG nNewWidthPixel, const Fraction& rCurrentZoom)
+{
+ _nWidth = nNewWidthPixel;
+ double n = (double)_nWidth;
+ n *= (double)rCurrentZoom.GetDenominator();
+ n /= (double)rCurrentZoom.GetNumerator();
+ _nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5);
+}
+
+//-------------------------------------------------------------------
+
+void BrowserColumn::Draw( BrowseBox& rBox, OutputDevice& rDev, const Point& rPos, BOOL bCurs )
+{
+ if ( _nId == 0 )
+ {
+ // paint handle column
+ ButtonFrame( rPos, Size( Width()-1, rBox.GetDataRowHeight()-1 ),
+ String(), FALSE, bCurs,
+ 0 != (BROWSER_COLUMN_TITLEABBREVATION&_nFlags) ).Draw( rDev );
+ Color aOldLineColor = rDev.GetLineColor();
+ rDev.SetLineColor( Color( COL_BLACK ) );
+ rDev.DrawLine(
+ Point( rPos.X(), rPos.Y()+rBox.GetDataRowHeight()-1 ),
+ Point( rPos.X() + Width() - 1, rPos.Y()+rBox.GetDataRowHeight()-1 ) );
+ rDev.DrawLine(
+ Point( rPos.X() + Width() - 1, rPos.Y() ),
+ Point( rPos.X() + Width() - 1, rPos.Y()+rBox.GetDataRowHeight()-1 ) );
+ rDev.SetLineColor( aOldLineColor );
+
+ if ( rBox.bHasBitmapHandle )
+ rBox.PaintField( rDev,
+ Rectangle(
+ Point( rPos.X() + 2, rPos.Y() + 2 ),
+ Size( Width()-1, rBox.GetDataRowHeight()-1 ) ),
+ GetId() );
+ }
+ else
+ {
+ // paint data column
+ long nWidth = Width() == LONG_MAX ? rBox.GetDataWindow().GetSizePixel().Width() : Width();
+
+ rBox.PaintField( rDev,
+ Rectangle(
+ Point( rPos.X() + MIN_COLUMNWIDTH, rPos.Y() ),
+ Size( nWidth-2*MIN_COLUMNWIDTH, rBox.GetDataRowHeight()-1 ) ),
+ GetId() );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void BrowserColumn::ZoomChanged(const Fraction& rNewZoom)
+{
+ double n = (double)_nOriginalWidth;
+ n *= (double)rNewZoom.GetNumerator();
+ n /= (double)rNewZoom.GetDenominator();
+
+ _nWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5);
+}
+
+//-------------------------------------------------------------------
+
+BrowserDataWin::BrowserDataWin( BrowseBox* pParent ) :
+ Control( pParent, WinBits(WB_CLIPCHILDREN) ),
+ pHeaderBar( 0 ),
+ pEventWin( pParent ),
+ pCornerWin( 0 ),
+ bInPaint( FALSE ),
+ bInCommand( FALSE ),
+ bNoScrollBack( FALSE ),
+ bUpdateMode( TRUE ),
+ bResizeOnPaint( FALSE ),
+ bUpdateOnUnlock( FALSE ),
+ bInUpdateScrollbars( FALSE ),
+ bHadRecursion( FALSE ),
+ bOwnDataChangedHdl( FALSE ),
+ nUpdateLock( 0 ),
+ nCursorHidden( 0 ),
+ pDtorNotify( 0 )
+{
+ aMouseTimer.SetTimeoutHdl( LINK( this, BrowserDataWin, RepeatedMouseMove ) );
+ aMouseTimer.SetTimeout( 100 );
+}
+
+//-------------------------------------------------------------------
+BrowserDataWin::~BrowserDataWin()
+{
+ if( pDtorNotify )
+ *pDtorNotify = TRUE;
+ if ( IsMouseCaptured() )
+ ReleaseMouse();
+}
+
+//-------------------------------------------------------------------
+void BrowserDataWin::LeaveUpdateLock()
+{
+ if ( !--nUpdateLock )
+ {
+ DoOutstandingInvalidations();
+ if (bUpdateOnUnlock )
+ {
+ Control::Update();
+ bUpdateOnUnlock = FALSE;
+ }
+ }
+}
+
+//-------------------------------------------------------------------
+void InitSettings_Impl( Window *pWin,
+ BOOL bFont, BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings =
+ pWin->GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetAppFont();
+ if ( pWin->IsControlFont() )
+ aFont.Merge( pWin->GetControlFont() );
+ pWin->SetPointFont( aFont );
+ }
+
+ if ( bFont || bForeground )
+ {
+ Color aTextColor = rStyleSettings.GetWindowTextColor();
+ if ( pWin->IsControlForeground() )
+ aTextColor = pWin->GetControlForeground();
+ pWin->SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if( pWin->IsControlBackground() )
+ pWin->SetBackground( pWin->GetControlBackground() );
+ else
+ pWin->SetBackground( rStyleSettings.GetWindowColor() );
+ }
+}
+
+//-------------------------------------------------------------------
+void BrowserDataWin::Update()
+{
+ if ( !nUpdateLock )
+ Control::Update();
+ else
+ bUpdateOnUnlock = TRUE;
+}
+
+//-------------------------------------------------------------------
+void BrowserDataWin::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ if( !bOwnDataChangedHdl )
+ {
+ InitSettings_Impl( this, TRUE, TRUE, TRUE );
+ Invalidate();
+ InitSettings_Impl( GetParent(), TRUE, TRUE, TRUE );
+ GetParent()->Invalidate();
+ }
+ }
+ else
+ Control::DataChanged( rDCEvt );
+}
+
+//-------------------------------------------------------------------
+void BrowserDataWin::Paint( const Rectangle& rRect )
+{
+ if ( !nUpdateLock && GetUpdateMode() )
+ {
+ bInPaint = TRUE;
+ ( (BrowseBox*) GetParent() )->PaintData( *this, rRect );
+ bInPaint = FALSE;
+ }
+ else
+ aInvalidRegion.Insert( new Rectangle( rRect ) );
+}
+
+//-------------------------------------------------------------------
+
+BrowseEvent BrowserDataWin::CreateBrowseEvent( const Point& rPosPixel )
+{
+ BrowseBox *pBox = GetParent();
+
+ // seek to row under mouse
+ short nRelRow = rPosPixel.Y() < 0
+ ? -1
+ : rPosPixel.Y() / pBox->GetDataRowHeight();
+ long nRow = nRelRow < 0 ? -1 : nRelRow + pBox->nTopRow;
+
+ // find column under mouse
+ long nMouseX = rPosPixel.X();
+ long nColX = 0;
+ USHORT nCol;
+ for ( nCol = 0;
+ nCol < pBox->pCols->Count() && nColX < GetSizePixel().Width();
+ ++nCol )
+ if ( pBox->pCols->GetObject(nCol)->IsFrozen() || nCol >= pBox->nFirstCol )
+ {
+ nColX += pBox->pCols->GetObject(nCol)->Width();
+ if ( nMouseX < nColX )
+ break;
+ }
+ USHORT nColId = BROWSER_INVALIDID;
+ if ( nCol < pBox->pCols->Count() )
+ nColId = pBox->pCols->GetObject(nCol)->GetId();
+
+ // compute the field rectangle and field relative MouseEvent
+ Rectangle aFieldRect;
+ MouseEvent aRelEvt;
+ if ( nCol < pBox->pCols->Count() )
+ {
+ nColX -= pBox->pCols->GetObject(nCol)->Width();
+ aFieldRect = Rectangle(
+ Point( nColX, nRelRow * pBox->GetDataRowHeight() ),
+ Size( pBox->pCols->GetObject(nCol)->Width(),
+ pBox->GetDataRowHeight() ) );
+ }
+
+ // assemble and return the BrowseEvent
+ return BrowseEvent( this, nRow, nCol, nColId, aFieldRect );
+}
+
+//-------------------------------------------------------------------
+void BrowserDataWin::Command( const CommandEvent& rEvt )
+{
+ // Scrollmaus-Event?
+ BrowseBox *pBox = GetParent();
+ if ( ( (rEvt.GetCommand() == COMMAND_WHEEL) ||
+ (rEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
+ (rEvt.GetCommand() == COMMAND_AUTOSCROLL) ) &&
+ ( HandleScrollCommand( rEvt, &pBox->aHScroll, pBox->pVScroll ) ) )
+ return;
+
+ Point aEventPos( rEvt.GetMousePosPixel() );
+ long nRow = pBox->GetRowAtYPosPixel( aEventPos.Y(), FALSE);
+ MouseEvent aMouseEvt( aEventPos, 1, MOUSE_SELECT, MOUSE_LEFT );
+ if ( COMMAND_CONTEXTMENU == rEvt.GetCommand() && rEvt.IsMouseEvent() &&
+ nRow < pBox->GetRowCount() && !pBox->IsRowSelected(nRow) )
+ {
+ BOOL bDeleted = FALSE;
+ pDtorNotify = &bDeleted;
+ bInCommand = TRUE;
+ MouseButtonDown( aMouseEvt );
+ if( bDeleted )
+ return;
+ MouseButtonUp( aMouseEvt );
+ if( bDeleted )
+ return;
+ pDtorNotify = 0;
+ bInCommand = FALSE;
+ }
+
+ aEventPos.Y() += GetParent()->GetTitleHeight();
+ CommandEvent aEvt( aEventPos, rEvt.GetCommand(),
+ rEvt.IsMouseEvent(), rEvt.GetData() );
+ bInCommand = TRUE;
+ BOOL bDeleted = FALSE;
+ pDtorNotify = &bDeleted;
+ GetParent()->Command( aEvt );
+ if( bDeleted )
+ return;
+ pDtorNotify = 0;
+ bInCommand = FALSE;
+
+ if ( COMMAND_STARTDRAG == rEvt.GetCommand() )
+ MouseButtonUp( aMouseEvt );
+
+ Control::Command( rEvt );
+}
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::MouseButtonDown( const MouseEvent& rEvt )
+{
+ aLastMousePos = OutputToScreenPixel( rEvt.GetPosPixel() );
+ CaptureMouse();
+ GetParent()->MouseButtonDown( BrowserMouseEvent( this, rEvt ) );
+}
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::MouseMove( const MouseEvent& rEvt )
+{
+ // Pseudo MouseMoves verhindern
+ Point aNewPos = OutputToScreenPixel( rEvt.GetPosPixel() );
+ if ( aNewPos == aLastMousePos )
+ return;
+ aLastMousePos = aNewPos;
+
+ // Paint-Probleme abfangen
+ if ( !IsMouseCaptured() )
+ return;
+
+ // transform to a BrowseEvent
+ GetParent()->MouseMove( BrowserMouseEvent( this, rEvt ) );
+
+ // dragging out of the visible area?
+ if ( rEvt.IsLeft() &&
+ ( rEvt.GetPosPixel().Y() > GetSizePixel().Height() ||
+ rEvt.GetPosPixel().Y() < 0 ) )
+ {
+ // repeat the event
+ aRepeatEvt = rEvt;
+ aMouseTimer.Start();
+ }
+ else
+ // killing old repeat-event
+ if ( aMouseTimer.IsActive() )
+ aMouseTimer.Stop();
+}
+
+//-------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( BrowserDataWin, RepeatedMouseMove, void *, pvoid )
+{
+ GetParent()->MouseMove( BrowserMouseEvent( this, aRepeatEvt ) );
+ return 0;
+}
+IMPL_LINK_INLINE_END( BrowserDataWin, RepeatedMouseMove, void *, pvoid )
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::MouseButtonUp( const MouseEvent& rEvt )
+{
+ // Pseudo MouseMoves verhindern
+ Point aNewPos = OutputToScreenPixel( rEvt.GetPosPixel() );
+ aLastMousePos = aNewPos;
+
+ // Paint-Probleme abfangen
+ if ( !IsMouseCaptured() )
+ return;
+
+ // Move an die aktuelle Position simulieren
+ MouseMove( rEvt );
+
+ // eigentliches Up-Handling
+ ReleaseMouse();
+ if ( aMouseTimer.IsActive() )
+ aMouseTimer.Stop();
+ GetParent()->MouseButtonUp( BrowserMouseEvent( this, rEvt ) );
+}
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::KeyInput( const KeyEvent& rEvt )
+{
+ // pass to parent window
+ if ( !GetParent()->ProcessKey( rEvt ) )
+ Control::KeyInput( rEvt );
+}
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::RequestHelp( const HelpEvent& rHEvt )
+{
+ pEventWin = this;
+ GetParent()->RequestHelp( rHEvt );
+ pEventWin = GetParent();
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowserDataWin::Drop( const DropEvent& rEvt )
+{
+ return GetParent()->Drop( BrowserDropEvent( this, rEvt ) );
+}
+
+//-------------------------------------------------------------------
+
+BOOL BrowserDataWin::QueryDrop( DropEvent& rEvt )
+{
+ BrowserDropEvent aBrwDEvt( this, rEvt );
+ BOOL bRet = GetParent()->QueryDrop( aBrwDEvt );
+ rEvt = aBrwDEvt;
+ return bRet;
+}
+
+//===================================================================
+
+BrowseEvent::BrowseEvent( Window* pWindow,
+ long nAbsRow, USHORT nColumn, USHORT nColumnId,
+ const Rectangle& rRect ):
+ pWin(pWindow),
+ nRow(nAbsRow),
+ nCol(nColumn),
+ nColId(nColumnId),
+ aRect(rRect)
+{
+}
+
+//===================================================================
+
+BrowserMouseEvent::BrowserMouseEvent( BrowserDataWin *pWin,
+ const MouseEvent& rEvt ):
+ MouseEvent(rEvt),
+ BrowseEvent( pWin->CreateBrowseEvent( rEvt.GetPosPixel() ) )
+{
+}
+
+//-------------------------------------------------------------------
+
+BrowserMouseEvent::BrowserMouseEvent( Window *pWin, const MouseEvent& rEvt,
+ long nAbsRow, USHORT nColumn, USHORT nColumnId,
+ const Rectangle& rRect ):
+ MouseEvent(rEvt),
+ BrowseEvent( pWin, nAbsRow, nColumn, nColumnId, rRect )
+{
+}
+
+//===================================================================
+
+BrowserDropEvent::BrowserDropEvent( BrowserDataWin *pWin, const DropEvent& rEvt ):
+ DropEvent(rEvt),
+ BrowseEvent( pWin->CreateBrowseEvent( rEvt.GetPosPixel() ) )
+{
+}
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::SetUpdateMode( BOOL bMode )
+{
+ DBG_ASSERT( !bUpdateMode || aInvalidRegion.Count() == 0,
+ "invalid region not empty" );
+ if ( bMode == bUpdateMode )
+ return;
+
+ bUpdateMode = bMode;
+ if ( bMode )
+ DoOutstandingInvalidations();
+}
+
+//-------------------------------------------------------------------
+void BrowserDataWin::DoOutstandingInvalidations()
+{
+ for ( Rectangle* pRect = aInvalidRegion.First();
+ pRect;
+ pRect = aInvalidRegion.Next() )
+ {
+ Window::Invalidate( *pRect, INVALIDATE_NOCHILDREN /*OV*/);
+ delete pRect;
+ }
+ aInvalidRegion.Clear();
+}
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::Invalidate()
+{
+ if ( !GetUpdateMode() )
+ {
+ for ( Rectangle* pRect = aInvalidRegion.First();
+ pRect;
+ pRect = aInvalidRegion.Next() )
+ delete pRect;
+ aInvalidRegion.Clear();
+ aInvalidRegion.Insert(
+ new Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
+ }
+ else
+ Window::Invalidate(INVALIDATE_NOCHILDREN /*OV*/ );
+}
+
+//-------------------------------------------------------------------
+
+void BrowserDataWin::Invalidate( const Rectangle& rRect )
+{
+ if ( !GetUpdateMode() )
+ aInvalidRegion.Insert( new Rectangle( rRect ) );
+ else
+ Window::Invalidate( rRect, INVALIDATE_NOCHILDREN /*OV*/ );
+}
+
+//===================================================================
+
+void BrowserScrollBar::Tracking( const TrackingEvent& rTEvt )
+{
+ ULONG nPos = GetThumbPos();
+ if ( nPos != _nLastPos )
+ {
+ if ( _nTip )
+ Help::HideTip( _nTip );
+
+ String aTip( String::CreateFromInt32(nPos) );
+ aTip += '/';
+ if ( _pDataWin->GetRealRowCount().Len() )
+ aTip += _pDataWin->GetRealRowCount();
+ else
+ aTip += String::CreateFromInt32(GetRangeMax());
+ Rectangle aRect( GetPointerPosPixel(), Size( GetTextHeight(), GetTextWidth( aTip ) ) );
+ _nTip = Help::ShowTip( this, aRect, aTip );
+ _nLastPos = nPos;
+ }
+
+ ScrollBar::Tracking( rTEvt );
+}
+
+//-------------------------------------------------------------------
+
+void BrowserScrollBar::EndScroll()
+{
+ if ( _nTip )
+ Help::HideTip( _nTip );
+ _nTip = 0;
+ ScrollBar::EndScroll();
+}
+
+
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
new file mode 100644
index 000000000000..3fcd002e392d
--- /dev/null
+++ b/svtools/source/brwbox/datwin.hxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * $RCSfile: datwin.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SFXDATWIN_HXX
+#define _SFXDATWIN_HXX
+
+#ifndef _BRWBOX_HXX
+#include <brwbox.hxx>
+#endif
+
+#ifndef _BRWHEAD_HXX
+#include <brwhead.hxx>
+#endif
+
+#ifndef _TIMER_HXX //autogen
+#include <vcl/timer.hxx>
+#endif
+#ifndef _IMAGE_HXX //autogen
+#include <vcl/image.hxx>
+#endif
+#ifndef _LIST_HXX //autogen
+#include <tools/list.hxx>
+#endif
+//===================================================================
+
+#define MIN_COLUMNWIDTH 2
+#define DRAG_CRITICAL 4
+
+DECLARE_LIST( RectangleList, Rectangle* );
+
+//===================================================================
+
+class ButtonFrame
+{
+ Rectangle aRect;
+ Rectangle aInnerRect;
+ String aText;
+ BOOL bPressed;
+ BOOL bCurs;
+ BOOL bAbbr;
+
+public:
+ ButtonFrame( const Point& rPt, const Size& rSz,
+ const String &rText,
+ BOOL bPress = FALSE, BOOL bCursor = FALSE,
+ BOOL bAbbreviate = TRUE ) :
+ aRect( rPt, rSz ),
+ aInnerRect( Point( aRect.Left()+1, aRect.Top()+1 ),
+ Size( aRect.GetWidth()-2, aRect.GetHeight()-2 ) ),
+ aText(rText),
+ bPressed(bPress),
+ bCurs(bCursor),
+ bAbbr(bAbbreviate)
+ {}
+
+ void Draw( OutputDevice& rDev );
+};
+
+//===================================================================
+
+class BrowserColumn
+{
+ USHORT _nId;
+ ULONG _nOriginalWidth;
+ ULONG _nWidth;
+ Image _aImage;
+ String _aTitle;
+ BOOL _bFrozen;
+ HeaderBarItemBits _nFlags;
+
+public:
+ BrowserColumn( USHORT nItemId, const Image &rImage,
+ const String& rTitle, ULONG nWidthPixel, const Fraction& rCurrentZoom,
+ HeaderBarItemBits nFlags );
+
+ USHORT GetId() const { return _nId; }
+
+ ULONG Width() { return _nWidth; }
+ Image& GetImage() { return _aImage; }
+ String& Title() { return _aTitle; }
+ HeaderBarItemBits& Flags() { return _nFlags; }
+
+ BOOL IsFrozen() const { return _bFrozen; }
+ void Freeze( BOOL bFreeze = TRUE ) { _bFrozen = bFreeze; }
+
+ virtual void Draw( BrowseBox& rBox, OutputDevice& rDev,
+ const Point& rPos, BOOL bCurs );
+
+ void SetWidth(ULONG nNewWidthPixel, const Fraction& rCurrentZoom);
+ void ZoomChanged(const Fraction& rNewZoom);
+};
+
+//===================================================================
+
+class BrowserDataWin: public Control
+{
+friend class BrowseBox;
+ BrowserHeader* pHeaderBar; // only for BROWSER_HEADERBAR_NEW
+ Window* pEventWin; // Window of forwarded events
+ ScrollBarBox* pCornerWin; // Window in the corner btw the ScrollBars
+ BOOL* pDtorNotify;
+ AutoTimer aMouseTimer; // recalls MouseMove on dragging out
+ MouseEvent aRepeatEvt; // a MouseEvent to repeat
+ Point aLastMousePos; // verhindert pseudo-MouseMoves
+
+ String aRealRowCount; // zur Anzeige im VScrollBar
+
+ RectangleList aInvalidRegion; // invalidated Rectangles during !UpdateMode
+ FASTBOOL bInPaint; // TRUE while in Paint
+ FASTBOOL bInCommand; // TRUE while in Command
+ FASTBOOL bNoScrollBack; // nur vorwaerts scrollen
+ FASTBOOL bNoHScroll; // kein horizontaler Scrollbar
+ FASTBOOL bAutoHScroll; // autohide horizontaler Scrollbar
+ FASTBOOL bAutoVScroll; // autohide horizontaler Scrollbar
+ FASTBOOL bUpdateMode; // nicht SV-UpdateMode wegen Invalidate()
+ FASTBOOL bAutoSizeLastCol;// last column always fills up window
+ FASTBOOL bHighlightAuto; // new auto-highlight by SetFont() etc.
+ FASTBOOL bResizeOnPaint; // outstanding resize-event
+ FASTBOOL bUpdateOnUnlock; // Update() while locked
+ FASTBOOL bInUpdateScrollbars; // Rekursionsschutz
+ FASTBOOL bHadRecursion; // Rekursion war aufgetreten
+ FASTBOOL bOwnDataChangedHdl; // dont change colors in DataChanged
+ USHORT nUpdateLock; // lock count, dont call Control::Update()!
+ short nCursorHidden; // new conuter for DoHide/ShowCursor
+
+public:
+ BrowserDataWin( BrowseBox* pParent );
+ ~BrowserDataWin();
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void Command( const CommandEvent& rEvt );
+ virtual void MouseButtonDown( const MouseEvent& rEvt );
+ virtual void MouseMove( const MouseEvent& rEvt );
+ DECL_LINK( RepeatedMouseMove, void * );
+
+ virtual void MouseButtonUp( const MouseEvent& rEvt );
+ virtual void KeyInput( const KeyEvent& rEvt );
+
+ virtual BOOL QueryDrop( DropEvent& rEvt );
+ virtual BOOL Drop( const DropEvent& rEvt );
+
+ BrowseEvent CreateBrowseEvent( const Point& rPosPixel );
+ void Repaint();
+ BrowseBox* GetParent() const
+ { return (BrowseBox*) Window::GetParent(); }
+ const String& GetRealRowCount() const { return aRealRowCount; }
+
+ void SetUpdateMode( BOOL bMode );
+ FASTBOOL GetUpdateMode() const { return bUpdateMode; }
+ void EnterUpdateLock() { ++nUpdateLock; }
+ void LeaveUpdateLock();
+ void Update();
+ void DoOutstandingInvalidations();
+ void Invalidate();
+ void Invalidate( const Rectangle& rRect );
+};
+
+//-------------------------------------------------------------------
+
+inline void BrowserDataWin::Repaint()
+{
+ if ( GetUpdateMode() )
+ Update();
+ Paint( Rectangle( Point(), GetOutputSizePixel() ) );
+}
+
+//===================================================================
+
+class BrowserScrollBar: public ScrollBar
+{
+ ULONG _nTip;
+ ULONG _nLastPos;
+ BrowserDataWin* _pDataWin;
+
+public:
+ BrowserScrollBar( Window* pParent, WinBits nStyle,
+ BrowserDataWin *pDataWin )
+ : ScrollBar( pParent, nStyle ),
+ _nTip( 0 ),
+ _nLastPos( ULONG_MAX ),
+ _pDataWin( pDataWin )
+ {}
+ //ScrollBar( Window* pParent, const ResId& rResId );
+
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void EndScroll();
+};
+
+//===================================================================
+
+void InitSettings_Impl( Window *pWin,
+ BOOL bFont = TRUE, BOOL bForeground = TRUE, BOOL bBackground = TRUE );
+
+//===================================================================
+
+#ifdef DBG_MI
+
+void DoLog_Impl( const BrowseBox *pThis, const char *pWhat, const char *pWho );
+#define LOG(pThis,what,who) DoLog_Impl(pThis,what,who)
+
+#else
+
+#define LOG(pThis,what,who)
+
+#endif
+
+
+#endif
+
diff --git a/svtools/source/brwbox/makefile.mk b/svtools/source/brwbox/makefile.mk
new file mode 100644
index 000000000000..2379c21e72c1
--- /dev/null
+++ b/svtools/source/brwbox/makefile.mk
@@ -0,0 +1,99 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=browse
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= \
+ brwbox1.cxx \
+ brwbox2.cxx \
+ brwhead.cxx \
+ datwin.cxx
+
+.IF "$(GUI)" == "WIN"
+CXXFILES+= \
+ brwdll.cxx
+.ENDIF
+
+SLOFILES= \
+ $(SLO)$/brwbox1.obj \
+ $(SLO)$/brwbox2.obj \
+ $(SLO)$/brwhead.obj \
+ $(SLO)$/datwin.obj
+
+.IF "$(GUI)" == "WIN"
+SLOFILES+= \
+ $(SLO)$/brwdll.obj
+.ENDIF
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk
new file mode 100644
index 000000000000..b5b01fbbd6db
--- /dev/null
+++ b/svtools/source/config/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=config
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/pathoptions.obj \
+ $(SLO)$/useroptions.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/source/config/pathoptions.cxx b/svtools/source/config/pathoptions.cxx
new file mode 100644
index 000000000000..4a659bed30d7
--- /dev/null
+++ b/svtools/source/config/pathoptions.cxx
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * $RCSfile: pathoptions.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "pathoptions.hxx"
+
+#ifndef _UTL_CONFIGMGR_HXX_
+#include <unotools/configmgr.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+
+// class SvtPathOptions --------------------------------------------------
+
+// initialize the static member
+SvtPathOptions* SvtPathOptions::m_pOptions = NULL;
+
+// -----------------------------------------------------------------------
+
+Sequence< OUString > SvtPathOptions::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Addin", // PATH_ADDIN
+ "AutoCorrect", // PATH_AUTOCORRECT
+ "AutoPilot", // PATH_AUTOPILOT
+ "Backup", // PATH_BACKUP
+ "Basic", // PATH_BASIC
+ "Bitmap", // PATH_BITMAP
+ "Config", // PATH_CONFIG
+ "Database", // PATH_DATABASE
+ "Dictionary", // PATH_DICTIONARY
+ "Favorite", // PATH_FAVORITES
+ "Filter", // PATH_FILTER
+ "Gallery", // PATH_GALLERY
+ "Glossary", // PATH_GLOSSARY
+ "Graphic", // PATH_GRAPHIC
+ "Help", // PATH_HELP
+ "Linguistic", // PATH_LINGUISTIC
+ "Module", // PATH_MODULE
+ "New", // PATH_NEWMENU
+ "Palette", // PATH_PALETTE
+ "Plugin", // PATH_PLUGIN
+ "Storage", // PATH_STORAGE
+ "SubIni", // PATH_SUBINI
+ "Temp", // PATH_TEMP
+ "Template", // PATH_TEMPLATE
+ "Trash", // PATH_TRASH
+ "UserConfig", // PATH_USERCONFIG
+ "UserDictionary", // PATH_USERDICTIONARY
+ "Work" // PATH_WORK
+ };
+
+ const int nCount = 28;
+ Sequence< OUString > aNames( nCount );
+ OUString* pNames = aNames.getArray();
+ for ( int i = 0; i < nCount; i++ )
+ pNames[i] = OUString::createFromAscii( aPropNames[i] );
+
+ return aNames;
+}
+
+// -----------------------------------------------------------------------
+
+const String& SvtPathOptions::GetPath( int nIndex )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( PATH_ADDIN == nIndex )
+ return m_aAddinPath;
+ else if ( PATH_AUTOCORRECT == nIndex )
+ return m_aAutoCorrectPath;
+ else if ( PATH_AUTOPILOT == nIndex )
+ return m_aAutoPilotPath;
+ else if ( PATH_BACKUP == nIndex )
+ return m_aBackupPath;
+ else if ( PATH_BASIC == nIndex )
+ return m_aBasicPath;
+ else if ( PATH_BITMAP == nIndex )
+ return m_aBitmapPath;
+ else if ( PATH_CONFIG == nIndex )
+ return m_aConfigPath;
+ else if ( PATH_DATABASE == nIndex )
+ return m_aDatabasePath;
+ else if ( PATH_DICTIONARY == nIndex )
+ return m_aDictionaryPath;
+ else if ( PATH_FAVORITES == nIndex )
+ return m_aFavoritesPath;
+ else if ( PATH_FILTER == nIndex )
+ return m_aFilterPath;
+ else if ( PATH_GALLERY == nIndex )
+ return m_aGalleryPath;
+ else if ( PATH_GLOSSARY == nIndex )
+ return m_aGlossaryPath;
+ else if ( PATH_GRAPHIC == nIndex )
+ return m_aGraphicPath;
+ else if ( PATH_HELP == nIndex )
+ return m_aHelpPath;
+ else if ( PATH_LINGUISTIC == nIndex )
+ return m_aLinguisticPath;
+ else if ( PATH_MODULE == nIndex )
+ return m_aModulePath;
+ else if ( PATH_NEWMENU == nIndex )
+ return m_aNewMenuPath;
+ else if ( PATH_PALETTE == nIndex )
+ return m_aPalettePath;
+ else if ( PATH_PLUGIN == nIndex )
+ return m_aPluginPath;
+ else if ( PATH_STORAGE == nIndex )
+ return m_aStoragePath;
+ else if ( PATH_SUBINI == nIndex )
+ return m_aSubIniPath;
+ else if ( PATH_TEMP == nIndex )
+ return m_aTempPath;
+ else if ( PATH_TEMPLATE == nIndex )
+ return m_aTemplatePath;
+ else if ( PATH_TRASH == nIndex )
+ return m_aTrashPath;
+ else if ( PATH_USERCONFIG == nIndex )
+ return m_aUserConfigPath;
+ else if ( PATH_USERDICTIONARY == nIndex )
+ return m_aUserDictionaryPath;
+ else if ( PATH_WORK == nIndex )
+ return m_aWorkPath;
+ else
+ {
+ DBG_ERRORFILE( "invalid index to get a path" );
+ return m_aEmptyString;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvtPathOptions::SetPath( int nIndex, const String& rNewPath )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( PATH_ADDIN == nIndex )
+ m_aAddinPath = rNewPath;
+ else if ( PATH_AUTOCORRECT == nIndex )
+ m_aAutoCorrectPath = rNewPath;
+ else if ( PATH_AUTOPILOT == nIndex )
+ m_aAutoPilotPath = rNewPath;
+ else if ( PATH_BACKUP == nIndex )
+ m_aBackupPath = rNewPath;
+ else if ( PATH_BASIC == nIndex )
+ m_aBasicPath = rNewPath;
+ else if ( PATH_BITMAP == nIndex )
+ m_aBitmapPath = rNewPath;
+ else if ( PATH_CONFIG == nIndex )
+ m_aConfigPath = rNewPath;
+ else if ( PATH_DATABASE == nIndex )
+ m_aDatabasePath = rNewPath;
+ else if ( PATH_DICTIONARY == nIndex )
+ m_aDictionaryPath = rNewPath;
+ else if ( PATH_FAVORITES == nIndex )
+ m_aFavoritesPath = rNewPath;
+ else if ( PATH_FILTER == nIndex )
+ m_aFilterPath = rNewPath;
+ else if ( PATH_GALLERY == nIndex )
+ m_aGalleryPath = rNewPath;
+ else if ( PATH_GLOSSARY == nIndex )
+ m_aGlossaryPath = rNewPath;
+ else if ( PATH_GRAPHIC == nIndex )
+ m_aGraphicPath = rNewPath;
+ else if ( PATH_HELP == nIndex )
+ m_aHelpPath = rNewPath;
+ else if ( PATH_LINGUISTIC == nIndex )
+ m_aLinguisticPath = rNewPath;
+ else if ( PATH_MODULE == nIndex )
+ m_aModulePath = rNewPath;
+ else if ( PATH_NEWMENU == nIndex )
+ m_aNewMenuPath = rNewPath;
+ else if ( PATH_PALETTE == nIndex )
+ m_aPalettePath = rNewPath;
+ else if ( PATH_PLUGIN == nIndex )
+ m_aPluginPath = rNewPath;
+ else if ( PATH_STORAGE == nIndex )
+ m_aStoragePath = rNewPath;
+ else if ( PATH_SUBINI == nIndex )
+ m_aSubIniPath = rNewPath;
+ else if ( PATH_TEMP == nIndex )
+ m_aTempPath = rNewPath;
+ else if ( PATH_TEMPLATE == nIndex )
+ m_aTemplatePath = rNewPath;
+ else if ( PATH_TRASH == nIndex )
+ m_aTrashPath = rNewPath;
+ else if ( PATH_USERCONFIG == nIndex )
+ m_aUserConfigPath = rNewPath;
+ else if ( PATH_USERDICTIONARY == nIndex )
+ m_aUserDictionaryPath = rNewPath;
+ else if ( PATH_WORK == nIndex )
+ m_aWorkPath = rNewPath;
+ else
+ DBG_ERRORFILE( "invalid index to set a path" );
+ SetModified();
+}
+
+// -----------------------------------------------------------------------
+
+SvtPathOptions::SvtPathOptions() : ConfigItem( OUString::createFromAscii("Office/Common/Path") )
+{
+ 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() )
+ {
+ OUString aTempStr;
+
+ for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+ {
+ DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
+ if ( pValues[nProp].hasValue() )
+ {
+ pValues[nProp] >>= aTempStr;
+ switch ( nProp )
+ {
+ case PATH_ADDIN: m_aAddinPath = String( aTempStr ); break;
+ case PATH_AUTOCORRECT: m_aAutoCorrectPath = String( aTempStr ); break;
+ case PATH_AUTOPILOT: m_aAutoPilotPath = String( aTempStr ); break;
+ case PATH_BACKUP: m_aBackupPath = String( aTempStr ); break;
+ case PATH_BASIC: m_aBasicPath = String( aTempStr ); break;
+ case PATH_BITMAP: m_aBitmapPath = String( aTempStr ); break;
+ case PATH_CONFIG: m_aConfigPath = String( aTempStr ); break;
+ case PATH_DATABASE: m_aDatabasePath = String( aTempStr ); break;
+ case PATH_DICTIONARY: m_aDictionaryPath = String( aTempStr ); break;
+ case PATH_FAVORITES: m_aFavoritesPath = String( aTempStr ); break;
+ case PATH_FILTER: m_aFilterPath = String( aTempStr ); break;
+ case PATH_GALLERY: m_aGalleryPath = String( aTempStr ); break;
+ case PATH_GLOSSARY: m_aGlossaryPath = String( aTempStr ); break;
+ case PATH_GRAPHIC: m_aGraphicPath = String( aTempStr ); break;
+ case PATH_HELP: m_aHelpPath = String( aTempStr ); break;
+ case PATH_LINGUISTIC: m_aLinguisticPath = String( aTempStr ); break;
+ case PATH_MODULE: m_aModulePath = String( aTempStr ); break;
+ case PATH_NEWMENU: m_aNewMenuPath = String( aTempStr ); break;
+ case PATH_PALETTE: m_aPalettePath = String( aTempStr ); break;
+ case PATH_PLUGIN: m_aPluginPath = String( aTempStr ); break;
+ case PATH_STORAGE: m_aStoragePath = String( aTempStr ); break;
+ case PATH_SUBINI: m_aSubIniPath = String( aTempStr ); break;
+ case PATH_TEMP: m_aTempPath = String( aTempStr ); break;
+ case PATH_TEMPLATE: m_aTemplatePath = String( aTempStr ); break;
+ case PATH_TRASH: m_aTrashPath = String( aTempStr ); break;
+ case PATH_USERCONFIG: m_aUserConfigPath = String( aTempStr ); break;
+ case PATH_USERDICTIONARY: m_aUserDictionaryPath = String( aTempStr ); break;
+ case PATH_WORK: m_aWorkPath = String( aTempStr ); break;
+
+ default:
+ DBG_ERRORFILE( "invalid index to load a path" );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvtPathOptions::~SvtPathOptions()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvtPathOptions* SvtPathOptions::GetPathOptions()
+{
+ if ( !m_pOptions )
+ m_pOptions = new SvtPathOptions;
+ return m_pOptions;
+}
+
+// -----------------------------------------------------------------------
+
+void SvtPathOptions::DestroyPathOptions()
+{
+ if ( m_pOptions )
+ DELETEZ( m_pOptions );
+}
+
+// -----------------------------------------------------------------------
+
+void SvtPathOptions::Commit()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Sequence< OUString > aNames = GetPropertyNames();
+ OUString* pNames = aNames.getArray();
+ Sequence< Any > aValues( aNames.getLength() );
+ Any* pValues = aValues.getArray();
+ const Type& rType = ::getBooleanCppuType();
+ OUString aTempStr;
+ for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+ {
+ switch ( nProp )
+ {
+ case PATH_ADDIN: aTempStr = OUString( m_aAddinPath ); break;
+ case PATH_AUTOCORRECT: aTempStr = OUString( m_aAutoCorrectPath ); break;
+ case PATH_AUTOPILOT: aTempStr = OUString( m_aAutoPilotPath ); break;
+ case PATH_BACKUP: aTempStr = OUString( m_aBackupPath ); break;
+ case PATH_BASIC: aTempStr = OUString( m_aBasicPath ); break;
+ case PATH_BITMAP: aTempStr = OUString( m_aBitmapPath ); break;
+ case PATH_CONFIG: aTempStr = OUString( m_aConfigPath ); break;
+ case PATH_DATABASE: aTempStr = OUString( m_aDatabasePath ); break;
+ case PATH_DICTIONARY: aTempStr = OUString( m_aDictionaryPath ); break;
+ case PATH_FAVORITES: aTempStr = OUString( m_aFavoritesPath ); break;
+ case PATH_FILTER: aTempStr = OUString( m_aFilterPath ); break;
+ case PATH_GALLERY: aTempStr = OUString( m_aGalleryPath ); break;
+ case PATH_GLOSSARY: aTempStr = OUString( m_aGlossaryPath ); break;
+ case PATH_GRAPHIC: aTempStr = OUString( m_aGraphicPath ); break;
+ case PATH_HELP: aTempStr = OUString( m_aHelpPath ); break;
+ case PATH_LINGUISTIC: aTempStr = OUString( m_aLinguisticPath ); break;
+ case PATH_MODULE: aTempStr = OUString( m_aModulePath ); break;
+ case PATH_NEWMENU: aTempStr = OUString( m_aNewMenuPath ); break;
+ case PATH_PALETTE: aTempStr = OUString( m_aPalettePath ); break;
+ case PATH_PLUGIN: aTempStr = OUString( m_aPluginPath ); break;
+ case PATH_STORAGE: aTempStr = OUString( m_aStoragePath ); break;
+ case PATH_SUBINI: aTempStr = OUString( m_aSubIniPath ); break;
+ case PATH_TEMP: aTempStr = OUString( m_aTempPath ); break;
+ case PATH_TEMPLATE: aTempStr = OUString( m_aTemplatePath ); break;
+ case PATH_TRASH: aTempStr = OUString( m_aTrashPath ); break;
+ case PATH_USERCONFIG: aTempStr = OUString( m_aUserConfigPath ); break;
+ case PATH_USERDICTIONARY: aTempStr = OUString( m_aUserDictionaryPath ); break;
+ case PATH_WORK: aTempStr = OUString( m_aWorkPath ); break;
+
+ default:
+ DBG_ERRORFILE( "invalid index to save a path" );
+ }
+ pValues[nProp] <<= aTempStr;
+ }
+ PutProperties( aNames, aValues );
+}
+
+// -----------------------------------------------------------------------
+
+void SvtPathOptions::Notify( const Sequence<rtl::OUString>& aPropertyNames )
+{
+ DBG_ERRORFILE( "properties have been changed" );
+}
+
diff --git a/svtools/source/config/useroptions.cxx b/svtools/source/config/useroptions.cxx
new file mode 100644
index 000000000000..578978f6f075
--- /dev/null
+++ b/svtools/source/config/useroptions.cxx
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * $RCSfile: useroptions.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "useroptions.hxx"
+
+#ifndef _UTL_CONFIGMGR_HXX_
+#include <unotools/configmgr.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+
+// class SvtUserOptions --------------------------------------------------
+
+// initialize the static member
+SvtUserOptions* SvtUserOptions::m_pOptions = NULL;
+
+// -----------------------------------------------------------------------
+
+Sequence< OUString > SvtUserOptions::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Company", // USER_COMPANY
+ "FirstName", // USER_FIRSTNAME
+ "LastName", // USER_LASTNAME
+ "UserID", // USER_ID
+ "Street", // USER_STREET
+ "City", // USER_CITY
+ "State", // USER_STATE
+ "Zip", // USER_ZIP
+ "Country", // USER_COUNTRY
+ "Position", // USER_POSITION
+ "Title", // USER_TITLE
+ "TelephoneHome", // USER_TELEPHONEHOME
+ "TelephoneWork", // USER_TELEPHONEWORK
+ "Fax", // USER_FAX
+ "EMail", // USER_EMAIL
+ "CustomerNumber" // USER_CUSTOMERNUMBER
+ };
+
+ const int nCount = 16;
+ Sequence< OUString > aNames( nCount );
+ OUString* pNames = aNames.getArray();
+ for ( int i = 0; i < nCount; i++ )
+ pNames[i] = OUString::createFromAscii( aPropNames[i] );
+
+ return aNames;
+}
+
+// -----------------------------------------------------------------------
+
+const String& SvtUserOptions::GetUserToken( int nIndex )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( USER_COMPANY == nIndex )
+ return m_aCompany;
+ else if ( USER_FIRSTNAME == nIndex )
+ return m_aFirstName;
+ else if ( USER_LASTNAME == nIndex )
+ return m_aLastName;
+ else if ( USER_ID == nIndex )
+ return m_aID;
+ else if ( USER_STREET == nIndex )
+ return m_aStreet;
+ else if ( USER_CITY == nIndex )
+ return m_aCity;
+ else if ( USER_STATE == nIndex )
+ return m_aState;
+ else if ( USER_ZIP == nIndex )
+ return m_aZip;
+ else if ( USER_COUNTRY == nIndex )
+ return m_aCountry;
+ else if ( USER_POSITION == nIndex )
+ return m_aPosition;
+ else if ( USER_TITLE == nIndex )
+ return m_aTitle;
+ else if ( USER_TELEPHONEHOME == nIndex )
+ return m_aTelephoneHome;
+ else if ( USER_TELEPHONEWORK == nIndex )
+ return m_aTelephoneWork;
+ else if ( USER_FAX == nIndex )
+ return m_aFax;
+ else if ( USER_EMAIL == nIndex )
+ return m_aEmail;
+ else if ( USER_CUSTOMERNUMBER == nIndex )
+ return m_aCustomerNumber;
+ else
+ {
+ DBG_ERRORFILE( "invalid index to get a user token" );
+ return m_aEmptyString;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvtUserOptions::SetUserToken( int nIndex, const String& rNewToken )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( USER_COMPANY == nIndex )
+ m_aCompany = rNewToken;
+ else if ( USER_FIRSTNAME == nIndex )
+ m_aFirstName = rNewToken;
+ else if ( USER_LASTNAME == nIndex )
+ m_aLastName = rNewToken;
+ else if ( USER_ID == nIndex )
+ m_aID = rNewToken;
+ else if ( USER_STREET == nIndex )
+ m_aStreet = rNewToken;
+ else if ( USER_CITY == nIndex )
+ m_aCity = rNewToken;
+ else if ( USER_STATE == nIndex )
+ m_aState = rNewToken;
+ else if ( USER_ZIP == nIndex )
+ m_aZip = rNewToken;
+ else if ( USER_COUNTRY == nIndex )
+ m_aCountry = rNewToken;
+ else if ( USER_POSITION == nIndex )
+ m_aPosition = rNewToken;
+ else if ( USER_TITLE == nIndex )
+ m_aTitle = rNewToken;
+ else if ( USER_TELEPHONEHOME == nIndex )
+ m_aTelephoneHome = rNewToken;
+ else if ( USER_TELEPHONEWORK == nIndex )
+ m_aTelephoneWork = rNewToken;
+ else if ( USER_FAX == nIndex )
+ m_aFax = rNewToken;
+ else if ( USER_EMAIL == nIndex )
+ m_aEmail = rNewToken;
+ else if ( USER_CUSTOMERNUMBER == nIndex )
+ m_aCustomerNumber = rNewToken;
+ else
+ DBG_ERRORFILE( "invalid index to set a user token" );
+ SetModified();
+}
+
+// -----------------------------------------------------------------------
+
+SvtUserOptions::SvtUserOptions() : ConfigItem( OUString::createFromAscii("UserProfile/Data") )
+{
+ 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() )
+ {
+ OUString aTempStr;
+
+ for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+ {
+ DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
+ if ( pValues[nProp].hasValue() )
+ {
+ pValues[nProp] >>= aTempStr;
+ switch ( nProp )
+ {
+ case USER_COMPANY: m_aCompany = String( aTempStr ); break;
+ case USER_FIRSTNAME: m_aFirstName = String( aTempStr ); break;
+ case USER_LASTNAME: m_aLastName = String( aTempStr ); break;
+ case USER_ID: m_aID = String( aTempStr ); break;
+ case USER_STREET: m_aStreet = String( aTempStr ); break;
+ case USER_CITY: m_aCity = String( aTempStr ); break;
+ case USER_STATE: m_aState = String( aTempStr ); break;
+ case USER_ZIP: m_aZip = String( aTempStr ); break;
+ case USER_COUNTRY: m_aCountry = String( aTempStr ); break;
+ case USER_POSITION: m_aPosition = String( aTempStr ); break;
+ case USER_TITLE: m_aTitle = String( aTempStr ); break;
+ case USER_TELEPHONEHOME: m_aTelephoneHome = String( aTempStr ); break;
+ case USER_TELEPHONEWORK: m_aTelephoneWork = String( aTempStr ); break;
+ case USER_FAX: m_aFax = String( aTempStr ); break;
+ case USER_EMAIL: m_aEmail = String( aTempStr ); break;
+ case USER_CUSTOMERNUMBER: m_aCustomerNumber = String( aTempStr ); break;
+
+ default:
+ DBG_ERRORFILE( "invalid index to load a user token" );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SvtUserOptions::~SvtUserOptions()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvtUserOptions* SvtUserOptions::GetUserOptions()
+{
+ if ( !m_pOptions )
+ m_pOptions = new SvtUserOptions;
+ return m_pOptions;
+}
+
+// -----------------------------------------------------------------------
+
+void SvtUserOptions::DestroyUserOptions()
+{
+ if ( m_pOptions )
+ DELETEZ( m_pOptions );
+}
+
+// -----------------------------------------------------------------------
+
+void SvtUserOptions::Commit()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Sequence< OUString > aNames = GetPropertyNames();
+ OUString* pNames = aNames.getArray();
+ Sequence< Any > aValues( aNames.getLength() );
+ Any* pValues = aValues.getArray();
+ const Type& rType = ::getBooleanCppuType();
+ OUString aTempStr;
+ for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+ {
+ switch ( nProp )
+ {
+ case USER_COMPANY: aTempStr = OUString( m_aCompany ); break;
+ case USER_FIRSTNAME: aTempStr = OUString( m_aFirstName ); break;
+ case USER_LASTNAME: aTempStr = OUString( m_aLastName ); break;
+ case USER_ID: aTempStr = OUString( m_aID ); break;
+ case USER_STREET: aTempStr = OUString( m_aStreet ); break;
+ case USER_CITY: aTempStr = OUString( m_aCity ); break;
+ case USER_STATE: aTempStr = OUString( m_aState ); break;
+ case USER_ZIP: aTempStr = OUString( m_aZip ); break;
+ case USER_COUNTRY: aTempStr = OUString( m_aCountry ); break;
+ case USER_POSITION: aTempStr = OUString( m_aPosition ); break;
+ case USER_TITLE: aTempStr = OUString( m_aTitle ); break;
+ case USER_TELEPHONEHOME: aTempStr = OUString( m_aTelephoneHome ); break;
+ case USER_TELEPHONEWORK: aTempStr = OUString( m_aTelephoneWork ); break;
+ case USER_FAX: aTempStr = OUString( m_aFax ); break;
+ case USER_EMAIL: aTempStr = OUString( m_aEmail ); break;
+ case USER_CUSTOMERNUMBER: aTempStr = OUString( m_aCustomerNumber ); break;
+
+ default:
+ DBG_ERRORFILE( "invalid index to save a user token" );
+ }
+ pValues[nProp] <<= aTempStr;
+ }
+ PutProperties( aNames, aValues );
+}
+
+// -----------------------------------------------------------------------
+
+void SvtUserOptions::Notify( const Sequence<rtl::OUString>& aPropertyNames )
+{
+ DBG_ERRORFILE( "properties have been changed" );
+}
+
diff --git a/svtools/source/contnr/cont_pch.cxx b/svtools/source/contnr/cont_pch.cxx
new file mode 100644
index 000000000000..4753a03158dc
--- /dev/null
+++ b/svtools/source/contnr/cont_pch.cxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: cont_pch.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <sv.hxx>
+#include "treelist.hxx"
+#include "svtabbx.hxx"
+#include "svtreebx.hxx"
+#include "svicnvw.hxx"
+#include "svimpbox.hxx"
+#include "svimpicn.hxx"
+#include "svlbox.hxx"
+#include "svlbitm.hxx"
+
+#pragma hdrstop
+
diff --git a/svtools/source/contnr/ctrdll.cxx b/svtools/source/contnr/ctrdll.cxx
new file mode 100644
index 000000000000..20729e743e5b
--- /dev/null
+++ b/svtools/source/contnr/ctrdll.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrdll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef WIN
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#endif
+
+#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/contnr/makefile.mk b/svtools/source/contnr/makefile.mk
new file mode 100644
index 000000000000..cddb84f1bc6c
--- /dev/null
+++ b/svtools/source/contnr/makefile.mk
@@ -0,0 +1,134 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=svcontnr
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=cont_pch
+PROJECTPCHSOURCE=cont_pch
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(COM)"=="WTC"
+CFLAGS=$(CFLAGS) -od -3r
+.ENDIF
+
+.IF "$(header)" == ""
+
+CXXFILES= svtabbx.cxx \
+ svicnvw.cxx \
+ svimpicn.cxx \
+ treelist.cxx \
+ svlbox.cxx \
+ svimpbox.cxx \
+ svlbitm.cxx \
+ svtreebx.cxx \
+ cont_pch.cxx \
+ ctrdll.cxx
+
+SLOFILES= $(SLO)$/svtabbx.obj \
+ $(SLO)$/svicnvw.obj \
+ $(SLO)$/svimpicn.obj \
+ $(SLO)$/treelist.obj \
+ $(SLO)$/svlbox.obj \
+ $(SLO)$/svimpbox.obj \
+ $(SLO)$/svlbitm.obj \
+ $(SLO)$/svtreebx.obj
+
+# Fuer das Setup bauen wir noch mal statisch
+.IF "$(VCSID)" != "OV"
+
+OBJFILES= $(OBJ)$/svtabbx.obj \
+ $(OBJ)$/svicnvw.obj \
+ $(OBJ)$/svimpicn.obj \
+ $(OBJ)$/treelist.obj \
+ $(OBJ)$/svlbox.obj \
+ $(OBJ)$/svimpbox.obj \
+ $(OBJ)$/svlbitm.obj \
+ $(OBJ)$/svtreebx.obj
+
+.ENDIF
+
+.ENDIF
+
+HXX1TARGET= svcontnr
+HXX1EXT= hxx
+HXX1FILES= $(PRJ)$/inc$/svlbox.hxx \
+ $(PRJ)$/inc$/svlbitm.hxx \
+ $(PRJ)$/inc$/svtreebx.hxx \
+ $(PRJ)$/inc$/svicnvw.hxx \
+ $(PRJ)$/inc$/svtabbx.hxx \
+ $(PRJ)$/inc$/treelist.hxx
+HXX1EXCL= -E:*include*
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx
new file mode 100644
index 000000000000..e2948c69e60a
--- /dev/null
+++ b/svtools/source/contnr/svicnvw.cxx
@@ -0,0 +1,855 @@
+/*************************************************************************
+ *
+ * $RCSfile: svicnvw.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <svlbox.hxx>
+#include <svicnvw.hxx>
+#include <svimpicn.hxx>
+#include <svlbitm.hxx>
+
+#pragma hdrstop
+
+#define ICNVW_BLOCK_ENTRYINS 0x0001
+
+SvIcnVwDataEntry::SvIcnVwDataEntry()
+ : nIcnVwFlags(0),eTextMode(ShowTextDontKnow)
+{
+}
+
+SvIcnVwDataEntry::~SvIcnVwDataEntry()
+{
+}
+
+SvIconView::SvIconView( Window* pParent, WinBits nWinStyle ) :
+ SvLBox( pParent, nWinStyle | WB_BORDER )
+{
+ nWinBits = nWinStyle;
+ nIcnVwFlags = 0;
+ pImp = new SvImpIconView( this, GetModel(), nWinStyle | WB_ICON );
+ pImp->pViewData = 0;
+ SetSelectionMode( SINGLE_SELECTION );
+ SetLineColor();
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
+ SetDefaultFont();
+}
+
+SvIconView::SvIconView( Window* pParent , const ResId& rResId ) :
+ SvLBox( pParent, rResId )
+{
+ pImp = new SvImpIconView( this, GetModel(), WB_BORDER | WB_ICON );
+ nIcnVwFlags = 0;
+ pImp->pViewData = 0;
+ SetLineColor();
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
+ SetDefaultFont();
+ pImp->SetSelectionMode( GetSelectionMode() );
+ pImp->SetWindowBits( nWindowStyle );
+ nWinBits = nWindowStyle;
+}
+
+SvIconView::~SvIconView()
+{
+ delete pImp;
+}
+
+void SvIconView::SetDefaultFont()
+{
+ SetFont( GetFont() );
+}
+
+SvLBoxEntry* SvIconView::CreateEntry( const XubString& rStr,
+ const Image& rCollEntryBmp, const Image& rExpEntryBmp )
+{
+ SvLBoxEntry* pEntry = new SvLBoxEntry;
+
+ SvLBoxContextBmp* pContextBmp =
+ new SvLBoxContextBmp( pEntry,0, rCollEntryBmp,rExpEntryBmp, 0xffff );
+ pEntry->AddItem( pContextBmp );
+
+ SvLBoxString* pString = new SvLBoxString( pEntry, 0, rStr );
+ pEntry->AddItem( pString );
+
+ return pEntry;
+}
+
+void SvIconView::DisconnectFromModel()
+{
+ SvLBox::DisconnectFromModel();
+ pImp->SetModel( GetModel(), 0 );
+}
+
+
+SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText,
+ SvLBoxEntry* pParent, BOOL bChildsOnDemand, ULONG nPos )
+{
+ SvLBoxEntry* pEntry = CreateEntry(
+ rText, aCollapsedEntryBmp, aExpandedEntryBmp );
+ pEntry->EnableChildsOnDemand( bChildsOnDemand );
+
+ if ( !pParent )
+ SvLBox::Insert( pEntry, nPos );
+ else
+ SvLBox::Insert( pEntry, pParent, nPos );
+ return pEntry;
+}
+
+SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText,
+ const Image& rExpEntryBmp,
+ const Image& rCollEntryBmp,
+ SvLBoxEntry* pParent, BOOL bChildsOnDemand, ULONG nPos)
+{
+ SvLBoxEntry* pEntry = CreateEntry(
+ rText, rCollEntryBmp, rExpEntryBmp );
+
+ pEntry->EnableChildsOnDemand( bChildsOnDemand );
+ if ( !pParent )
+ SvLBox::Insert( pEntry, nPos );
+ else
+ SvLBox::Insert( pEntry, pParent, nPos );
+ return pEntry;
+}
+
+
+void SvIconView::SetEntryText(SvLBoxEntry* pEntry, const XubString& rStr)
+{
+ SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if ( pItem )
+ {
+ pItem->SetText( pEntry, rStr );
+ GetModel()->InvalidateEntry( pEntry );
+ }
+}
+
+void SvIconView::SetExpandedEntryBmp(SvLBoxEntry* pEntry, const Image& rBmp)
+{
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if ( pItem )
+ {
+ pItem->SetBitmap2( pEntry, rBmp );
+ GetModel()->InvalidateEntry( pEntry );
+ }
+}
+
+void SvIconView::SetCollapsedEntryBmp(SvLBoxEntry* pEntry,
+ const Image& rBmp )
+{
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if ( pItem )
+ {
+ pItem->SetBitmap1( pEntry, rBmp );
+ GetModel()->InvalidateEntry( pEntry );
+ }
+}
+
+XubString SvIconView::GetEntryText(SvLBoxEntry* pEntry ) const
+{
+ XubString aStr;
+ SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if ( pItem )
+ aStr = pItem->GetText();
+ return aStr;
+}
+
+Image SvIconView::GetExpandedEntryBmp(SvLBoxEntry* pEntry) const
+{
+ Image aBmp;
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if ( pItem )
+ aBmp = pItem->GetBitmap2();
+ return aBmp;
+}
+
+Image SvIconView::GetCollapsedEntryBmp(SvLBoxEntry* pEntry) const
+{
+ Image aBmp;
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if ( pItem )
+ aBmp = pItem->GetBitmap1();
+ return aBmp;
+}
+
+
+SvLBoxEntry* SvIconView::CloneEntry( SvLBoxEntry* pSource )
+{
+ XubString aStr;
+ Image aCollEntryBmp;
+ Image aExpEntryBmp;
+
+ SvLBoxString* pStringItem = (SvLBoxString*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if ( pStringItem )
+ aStr = pStringItem->GetText();
+ SvLBoxContextBmp* pBmpItem =(SvLBoxContextBmp*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if ( pBmpItem )
+ {
+ aCollEntryBmp = pBmpItem->GetBitmap1();
+ aExpEntryBmp = pBmpItem->GetBitmap2();
+ }
+ SvLBoxEntry* pEntry = CreateEntry( aStr, aCollEntryBmp, aExpEntryBmp );
+ pEntry->SvListEntry::Clone( pSource );
+ pEntry->EnableChildsOnDemand( pSource->HasChildsOnDemand() );
+ pEntry->SetUserData( pSource->GetUserData() );
+ return pEntry;
+}
+
+
+USHORT SvIconView::IsA()
+{
+ return SV_LISTBOX_ID_ICONVIEW;
+}
+
+void SvIconView::RequestingChilds( SvLBoxEntry* pParent )
+{
+ if ( !pParent->HasChilds() )
+ InsertEntry( String::CreateFromAscii("<dummy>"), pParent, FALSE, LIST_APPEND );
+}
+
+void __EXPORT SvIconView::Paint( const Rectangle& rRect )
+{
+ pImp->Paint( rRect );
+}
+
+void __EXPORT SvIconView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ pImp->MouseButtonDown( rMEvt );
+}
+
+void __EXPORT SvIconView::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ pImp->MouseButtonUp( rMEvt );
+}
+
+void __EXPORT SvIconView::MouseMove( const MouseEvent& rMEvt )
+{
+ pImp->MouseMove( rMEvt );
+}
+
+void __EXPORT SvIconView::KeyInput( const KeyEvent& rKEvt )
+{
+ // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down
+ if( IsEditingActive() )
+ return;
+
+ nImpFlags |= SVLBOX_IS_TRAVELSELECT;
+ BOOL bKeyUsed = pImp->KeyInput( rKEvt );
+ if ( !bKeyUsed )
+ SvLBox::KeyInput( rKEvt );
+ nImpFlags &= ~SVLBOX_IS_TRAVELSELECT;
+}
+
+void __EXPORT SvIconView::Resize()
+{
+ pImp->Resize();
+ SvLBox::Resize();
+}
+
+void __EXPORT SvIconView::GetFocus()
+{
+ pImp->GetFocus();
+ SvLBox::GetFocus();
+}
+
+void __EXPORT SvIconView::LoseFocus()
+{
+ pImp->LoseFocus();
+ SvLBox::LoseFocus();
+}
+
+void SvIconView::SetUpdateMode( BOOL bUpdate )
+{
+ Control::SetUpdateMode( bUpdate );
+ if ( bUpdate )
+ pImp->UpdateAll();
+}
+
+void SvIconView::SetModel( SvLBoxTreeList* pNewModel )
+{
+}
+
+void SvIconView::SetModel( SvLBoxTreeList* pNewModel, SvLBoxEntry* pParent )
+{
+ nIcnVwFlags |= ICNVW_BLOCK_ENTRYINS;
+ SvLBox::SetModel( pNewModel );
+ nIcnVwFlags &= (~ICNVW_BLOCK_ENTRYINS);
+ if ( pParent && pParent->HasChildsOnDemand() )
+ RequestingChilds( pParent );
+ pImp->SetModel( pNewModel, pParent );
+}
+
+void __EXPORT SvIconView::ModelHasCleared()
+{
+ SvLBox::ModelHasCleared();
+ pImp->Clear();
+}
+
+void __EXPORT SvIconView::ModelHasInserted( SvListEntry* pEntry )
+{
+ if( !(nIcnVwFlags & ICNVW_BLOCK_ENTRYINS ) )
+ pImp->EntryInserted( (SvLBoxEntry*)pEntry );
+}
+
+void __EXPORT SvIconView::ModelHasInsertedTree( SvListEntry* pEntry )
+{
+ pImp->TreeInserted( (SvLBoxEntry*)pEntry );
+}
+
+void __EXPORT SvIconView::ModelIsMoving(SvListEntry* pSource,
+ SvListEntry* /* pTargetParent */ , ULONG /* nChildPos */ )
+{
+ pImp->MovingEntry( (SvLBoxEntry*)pSource );
+}
+
+void __EXPORT SvIconView::ModelHasMoved(SvListEntry* pSource )
+{
+ pImp->EntryMoved( (SvLBoxEntry*)pSource );
+}
+
+void __EXPORT SvIconView::ModelIsRemoving( SvListEntry* pEntry )
+{
+ pImp->RemovingEntry( (SvLBoxEntry*)pEntry );
+ NotifyRemoving( (SvLBoxEntry*)pEntry );
+}
+
+void __EXPORT SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ )
+{
+ pImp->EntryRemoved();
+}
+
+void __EXPORT SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry )
+{
+ // die einzelnen Items des Entries reinitialisieren
+ SvLBox::ModelHasEntryInvalidated( pEntry );
+ // painten
+ pImp->ModelHasEntryInvalidated( pEntry );
+}
+
+void SvIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, BOOL bShow )
+{
+ pImp->ShowTargetEmphasis( pEntry, bShow );
+}
+
+Point SvIconView::GetEntryPos( SvLBoxEntry* pEntry ) const
+{
+ return ((SvIconView*)this)->pImp->GetEntryPos( pEntry );
+}
+
+void SvIconView::SetEntryPos( SvLBoxEntry* pEntry, const Point& rPos)
+{
+ pImp->SetEntryPos( pEntry, rPos, FALSE, TRUE );
+}
+
+void SvIconView::SetEntryPos( SvLBoxEntry* pEntry, const Point& rPos, BOOL bAdjustAtGrid )
+{
+ pImp->SetEntryPos( pEntry, rPos, bAdjustAtGrid );
+}
+
+void SvIconView::SetFont( const Font& rFont )
+{
+ Font aTempFont( rFont );
+ aTempFont.SetTransparent( TRUE );
+ SvLBox::SetFont( aTempFont );
+ RecalcViewData();
+ pImp->ChangedFont();
+}
+
+void SvIconView::ViewDataInitialized( SvLBoxEntry* pEntry )
+{
+ pImp->ViewDataInitialized( pEntry );
+}
+
+SvLBoxEntry* SvIconView::GetCurEntry() const
+{
+ return pImp->GetCurEntry();
+}
+
+SvLBoxEntry* SvIconView::GetDropTarget( const Point& rPos )
+{
+ return pImp->GetDropTarget( rPos );
+}
+
+SvLBoxEntry* SvIconView::GetEntry( const Point& rPixPos, BOOL ) const
+{
+ Point aPos( rPixPos );
+ aPos -= GetMapMode().GetOrigin();
+ return ((SvIconView*)this)->pImp->GetEntry( aPos );
+}
+
+SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const
+{
+ return ((SvIconView*)this)->pImp->GetEntry( rDocPos );
+}
+
+
+void SvIconView::SetWindowBits( WinBits nWinStyle )
+{
+ nWinBits = nWinStyle;
+ pImp->SetWindowBits( nWinStyle );
+}
+
+void SvIconView::PaintEntry( SvLBoxEntry* pEntry )
+{
+ pImp->PaintEntry( pEntry );
+}
+
+
+void SvIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos )
+{
+ pImp->PaintEntry( pEntry, rPos );
+}
+
+Rectangle SvIconView::GetFocusRect( SvLBoxEntry* pEntry )
+{
+ return pImp->CalcFocusRect( pEntry );
+}
+
+void SvIconView::InvalidateEntry( SvLBoxEntry* pEntry )
+{
+ pImp->InvalidateEntry( pEntry );
+}
+
+void SvIconView::SetDragDropMode( DragDropMode nDDMode )
+{
+ SvLBox::SetDragDropMode( nDDMode );
+ pImp->SetDragDropMode( nDDMode );
+}
+
+void SvIconView::SetSelectionMode( SelectionMode eSelMode )
+{
+ SvLBox::SetSelectionMode( eSelMode );
+ pImp->SetSelectionMode( eSelMode );
+}
+
+BOOL SvIconView::Select( SvLBoxEntry* pEntry, BOOL bSelect )
+{
+ EndEditing();
+ BOOL bRetVal = SvListView::Select( pEntry, bSelect );
+ if( bRetVal )
+ {
+ pImp->EntrySelected( pEntry, bSelect );
+ pHdlEntry = pEntry;
+ SelectHdl();
+ }
+ return bRetVal;
+}
+
+void SvIconView::SelectAll( BOOL bSelect, BOOL bPaint )
+{
+ SvLBoxEntry* pEntry = pImp->GetCurParent();
+ pEntry = FirstChild( pEntry );
+ while( pEntry )
+ {
+ Select( pEntry, bSelect );
+ pEntry = NextSibling( pEntry );
+ }
+}
+
+void SvIconView::Arrange()
+{
+#ifdef DBG_UTIL
+ USHORT n=1;
+ if( n == 1 && n-1 == 0 )
+ {
+ pImp->Arrange();
+ }
+ else
+ {
+ pImp->AdjustAtGrid();
+ }
+#else
+ pImp->Arrange();
+#endif
+}
+
+
+void SvIconView::SetSpaceBetweenEntries( long nX, long nY )
+{
+ pImp->SetSpaceBetweenEntries( nX, nY );
+}
+
+BOOL SvIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos )
+{
+ return pImp->NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos);
+}
+
+BOOL SvIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos )
+{
+ return pImp->NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos);
+}
+
+
+void SvIconView::EnableInplaceEditing( BOOL bEnable )
+{
+ SvLBox::EnableInplaceEditing( bEnable );
+}
+
+void SvIconView::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
+ const Point& )
+{
+ if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
+ {
+ Selection aSel( SELECTION_MIN, SELECTION_MAX );
+ if ( EditingEntry( pEntry, aSel ) )
+ {
+ SelectAll( FALSE );
+ EditItemText( pEntry, (SvLBoxString*)pItem, aSel );
+ }
+ }
+}
+
+
+void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
+ const Selection& rSel )
+{
+ DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?")
+ pCurEdEntry = pEntry;
+ pCurEdItem = pItem;
+ Rectangle aRect( pImp->CalcTextRect( pEntry, (SvLBoxString*)pItem,0,TRUE ));
+
+ aRect.Bottom() += 4;
+ pImp->MakeVisible( aRect ); // vor der Umrechnung in Pixel-Koord. rufen!
+ aRect.Bottom() -= 4;
+
+ Point aPos( aRect.TopLeft() );
+ aPos += GetMapMode().GetOrigin(); // Dok-Koord. -> Window-Koord.
+ aRect.SetPos( aPos );
+
+ aRect.Bottom() += 2; // sieht huebscher aus
+
+#ifdef WIN
+ aRect.Bottom() += 4;
+#endif
+#ifdef OS2
+
+#if OS2_SINGLE_LINE_EDIT
+ aRect.Left() -= 3;
+ aRect.Right() += 3;
+ aRect.Top() -= 3;
+ aRect.Bottom() += 3;
+#else
+ aRect.Left() -= 10;
+ aRect.Right() += 10;
+ aRect.Top() -= 5;
+ aRect.Bottom() += 5;
+#endif
+
+#endif // OS2
+ EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, TRUE );
+}
+
+void SvIconView::EditEntry( SvLBoxEntry* pEntry )
+{
+ if( !pEntry )
+ pEntry = pImp->GetCurEntry();
+ if( pEntry )
+ {
+ SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if( pItem )
+ {
+ Selection aSel( SELECTION_MIN, SELECTION_MAX );
+ if( EditingEntry( pEntry, aSel ) )
+ {
+ SelectAll( FALSE );
+ EditItemText( pEntry, pItem, aSel );
+ }
+ }
+ }
+}
+
+void SvIconView::EditedText( const XubString& rStr )
+{
+ XubString aRefStr( ((SvLBoxString*)pCurEdItem)->GetText() );
+ if ( EditedEntry( pCurEdEntry, rStr ) )
+ {
+ ((SvLBoxString*)pCurEdItem)->SetText( pCurEdEntry, rStr );
+ pModel->InvalidateEntry( pCurEdEntry );
+ }
+ if( GetSelectionMode()==SINGLE_SELECTION && !GetSelectionCount())
+ Select( pCurEdEntry );
+}
+
+
+BOOL SvIconView::EditingEntry( SvLBoxEntry*, Selection& )
+{
+ return TRUE;
+}
+
+BOOL SvIconView::EditedEntry( SvLBoxEntry*, const XubString& )
+{
+ return TRUE;
+}
+
+
+void SvIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo)
+{
+ pImp->WriteDragServerInfo( rPos, pInfo );
+}
+
+void SvIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo )
+{
+ pImp->ReadDragServerInfo( rPos, pInfo );
+}
+
+void SvIconView::Command( const CommandEvent& rCEvt )
+{
+ pImp->Command( rCEvt );
+}
+
+void SvIconView::SetCurParent( SvLBoxEntry* pNewParent )
+{
+ if ( pNewParent && pNewParent->HasChildsOnDemand() )
+ RequestingChilds( pNewParent );
+ pImp->SetCurParent( pNewParent );
+}
+
+SvLBoxEntry* SvIconView::GetCurParent() const
+{
+ return pImp->GetCurParent();
+}
+
+SvViewData* SvIconView::CreateViewData( SvListEntry* pEntry )
+{
+ SvIcnVwDataEntry* pEntryData = new SvIcnVwDataEntry;
+ return (SvViewData*)pEntryData;
+}
+
+void SvIconView::InitViewData( SvViewData* pData, SvListEntry* pEntry )
+{
+ SvLBox::InitViewData( pData, pEntry );
+ pImp->InvalidateBoundingRect( ((SvIcnVwDataEntry*)pData)->aRect );
+}
+
+Region SvIconView::GetDragRegion() const
+{
+ Rectangle aRect;
+ SvLBoxEntry* pEntry = GetCurEntry();
+ if( pEntry )
+ aRect = pImp->GetBoundingRect( pEntry );
+ Region aRegion( aRect );
+ return aRegion;
+}
+
+ULONG SvIconView::GetSelectionCount() const
+{
+ return (ULONG)(pImp->GetSelectionCount());
+}
+
+void SvIconView::SetGrid( long nDX, long nDY )
+{
+ pImp->SetGrid( nDX, nDY );
+}
+
+void SvIconView::ModelNotification( USHORT nActionId, SvListEntry* pEntry1,
+ SvListEntry* pEntry2, ULONG nPos )
+{
+ SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
+ switch( nActionId )
+ {
+ case LISTACTION_RESORTING:
+ SetUpdateMode( FALSE );
+ break;
+
+ case LISTACTION_RESORTED:
+ SetUpdateMode( TRUE );
+ Arrange();
+ break;
+
+ case LISTACTION_CLEARED:
+ if( IsUpdateMode() )
+ Update();
+ break;
+ }
+}
+
+
+void SvIconView::Scroll( long nDeltaX, long nDeltaY )
+{
+ pImp->Scroll( nDeltaX, nDeltaY, FALSE );
+}
+
+void SvIconView::PrepareCommandEvent( const CommandEvent& rCEvt )
+{
+ pImp->PrepareCommandEvent( rCEvt );
+}
+
+void SvIconView::BeginDrag( const Point& rPos )
+{
+ SvLBoxEntry* pEntry = GetEntry( rPos, TRUE );
+ pImp->pViewData = pEntry;
+ SvLBox::BeginDrag( rPos );
+}
+
+BOOL __EXPORT SvIconView::QueryDrop( DropEvent& rDEvt )
+{
+ if( pImp->pViewData )
+ {
+ pImp->HideDDIcon();
+ }
+ BOOL bResult = SvLBox::QueryDrop( rDEvt );
+ if( bResult )
+ {
+ pImp->ShowDDIcon( pImp->pViewData, rDEvt.GetPosPixel() );
+ }
+ return bResult;
+}
+
+BOOL SvIconView::Drop( const DropEvent& rDEvt )
+{
+ if( pImp->pViewData )
+ {
+ pImp->HideDDIcon();
+ pImp->pViewData = 0;
+ }
+ return SvLBox::Drop( rDEvt );
+}
+
+void SvIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos )
+{
+ pImp->ShowDDIcon( pRefEntry, rPos );
+}
+
+void SvIconView::HideDDIcon()
+{
+ pImp->HideDDIcon();
+}
+
+void SvIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos )
+{
+ pImp->HideShowDDIcon( pRefEntry, rPos );
+}
+
+void SvIconView::SelectRect( const Rectangle& rRect, BOOL bAdd,
+ SvPtrarr* pRects, short nOffs )
+{
+ pImp->SelectRect( rRect, bAdd, pRects, nOffs );
+}
+
+void SvIconView::CalcScrollOffsets( const Point& rRefPosPixel, long& rX, long& rY,
+ BOOL b, USHORT nBorderWidth )
+{
+ pImp->CalcScrollOffsets( rRefPosPixel, rX, rY, b, nBorderWidth );
+}
+
+void SvIconView::EndTracking()
+{
+ pImp->EndTracking();
+}
+
+void SvIconView::MakeVisible( SvLBoxEntry* pEntry )
+{
+ pImp->MakeVisible( pEntry );
+}
+
+void SvIconView::PreparePaint( SvLBoxEntry* )
+{
+}
+
+void SvIconView::AdjustAtGrid( SvLBoxEntry* pEntry )
+{
+ pImp->AdjustAtGrid( pEntry );
+}
+
+void SvIconView::LockEntryPos( SvLBoxEntry* pEntry, BOOL bLock )
+{
+ SvIcnVwDataEntry* pViewData = (SvIcnVwDataEntry*)GetViewData( pEntry );
+ if( bLock )
+ pViewData->SetVwFlags( ICNVW_FLAG_POS_LOCKED );
+ else
+ pViewData->ClearVwFlags( ICNVW_FLAG_POS_LOCKED );
+}
+
+BOOL SvIconView::IsEntryPosLocked( const SvLBoxEntry* pEntry ) const
+{
+ const SvIcnVwDataEntry* pViewData = (const SvIcnVwDataEntry*)GetViewData( (SvListEntry*)pEntry );
+ return pViewData->IsEntryPosLocked();
+}
+
+void SvIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry )
+{
+ pImp->SetTextMode( eMode, pEntry );
+}
+
+SvIconViewTextMode SvIconView::GetTextMode( const SvLBoxEntry* pEntry ) const
+{
+ return pImp->GetTextMode( pEntry );
+}
+
+SvLBoxEntry* SvIconView::GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, BOOL ) const
+{
+ Point aPos( rPixPos );
+ aPos -= GetMapMode().GetOrigin();
+ return ((SvIconView*)this)->pImp->GetNextEntry( aPos, pCurEntry );
+}
+
+SvLBoxEntry* SvIconView::GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, BOOL ) const
+{
+ Point aPos( rPixPos );
+ aPos -= GetMapMode().GetOrigin();
+ return ((SvIconView*)this)->pImp->GetPrevEntry( aPos, pCurEntry );
+}
+
+void SvIconView::ShowFocusRect( const SvLBoxEntry* pEntry )
+{
+ pImp->ShowFocusRect( pEntry );
+}
+
+
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
new file mode 100644
index 000000000000..ebdc765651cf
--- /dev/null
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -0,0 +1,3171 @@
+/*************************************************************************
+ *
+ * $RCSfile: svimpbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _HELP_HXX
+#include <vcl/help.hxx>
+#endif
+#ifndef _TABBAR_HXX
+#include <tabbar.hxx>
+#endif
+
+#pragma hdrstop
+
+#define _SVTREEBX_CXX
+#include <svtreebx.hxx>
+#ifndef _SVLBOX_HXX
+#include <svlbox.hxx>
+#endif
+#include <svimpbox.hxx>
+
+
+#define NODE_BMP_TABDIST_NOTVALID -2000000
+
+SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvLBoxTreeList* pLBTree, WinBits nWinStyle) :
+ aVerSBar( pLBView, WB_DRAG | WB_VSCROLL ),
+ aHorSBar( pLBView, WB_DRAG | WB_HSCROLL ),
+ aScrBarBox( pLBView ),
+ aOutputSize( 0,0 ),
+ aSelEng( pLBView, (FunctionSet*)0 ),
+ aFctSet( this, &aSelEng, pLBView ),
+ pTabBar(0)
+{
+ pView = pLBView;
+ pTree = pLBTree;
+ aSelEng.SetFunctionSet( (FunctionSet*)&aFctSet );
+ aSelEng.ExpandSelectionOnMouseMove( FALSE );
+ SetWindowBits( nWinStyle );
+ SetSelectionMode( SINGLE_SELECTION );
+ SetDragDropMode( 0 );
+
+ aVerSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) );
+ aHorSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) );
+ aHorSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+ aVerSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+#if SUPD > 358
+ aVerSBar.SetRange( Range(0,0) );
+ aVerSBar.Hide();
+#endif
+ aHorSBar.SetRange( Range(0,0) );
+ aHorSBar.SetPageSize( 24 ); // Pixel
+ aHorSBar.SetLineSize( 8 ); // Pixel
+
+ nHorSBarHeight = (short)aHorSBar.GetSizePixel().Height();
+ nVerSBarWidth = (short)aVerSBar.GetSizePixel().Width();
+
+ pStartEntry = 0;
+ pCursor = 0;
+ pAnchor = 0;
+ nVisibleCount = 0; // Anzahl Daten-Zeilen im Control
+ nNodeBmpTabDistance = NODE_BMP_TABDIST_NOTVALID;
+ nYoffsNodeBmp = 0;
+ nNodeBmpWidth = 0;
+
+ bAsyncBeginDrag = FALSE;
+ aAsyncBeginDragTimer.SetTimeout( 0 );
+ aAsyncBeginDragTimer.SetTimeoutHdl( LINK(this,SvImpLBox,BeginDragHdl));
+ // Button-Animation in Listbox
+ pActiveButton = 0;
+ pActiveEntry = 0;
+ pActiveTab = 0;
+
+ nFlags = 0;
+
+ aEditTimer.SetTimeout( 800 );
+ aEditTimer.SetTimeoutHdl( LINK(this,SvImpLBox,EditTimerCall) );
+
+ nMostRight = -1;
+ pMostRightEntry = 0;
+ nCurUserEvent = 0xffffffff;
+
+ bUpdateMode = TRUE;
+ bInVScrollHdl = FALSE;
+ nFlags |= F_FILLING;
+}
+
+SvImpLBox::~SvImpLBox()
+{
+ aEditTimer.Stop();
+ StopUserEvent();
+}
+
+void SvImpLBox::SetWindowBits( WinBits nWinStyle )
+{
+ nWinBits = nWinStyle;
+ if((nWinStyle & WB_SIMPLEMODE) && aSelEng.GetSelectionMode()==MULTIPLE_SELECTION)
+ aSelEng.AddAlways( TRUE );
+}
+
+// Das Model darf hier nicht mehr angefasst werden
+void SvImpLBox::Clear()
+{
+ StopUserEvent();
+ pStartEntry = 0;
+ pAnchor = 0;
+
+ pActiveButton = 0;
+ pActiveEntry = 0;
+ pActiveTab = 0;
+
+ nMostRight = -1;
+ pMostRightEntry = 0;
+
+ // Der Cursor darf hier nicht mehr angefasst werden!
+ if( pCursor )
+ {
+ if( pView->HasFocus() )
+ pView->HideFocus();
+ pCursor = 0;
+ }
+ aVerSBar.Hide();
+ aVerSBar.SetThumbPos( 0 );
+ Range aRange( 0, 0 );
+ aVerSBar.SetRange( aRange );
+ aOutputSize = pView->Control::GetOutputSizePixel();
+ nFlags &= ~(F_VER_SBARSIZE_WITH_HBAR | F_HOR_SBARSIZE_WITH_VBAR );
+ if( pTabBar )
+ {
+ aOutputSize.Height() -= nHorSBarHeight;
+ nFlags |= F_VER_SBARSIZE_WITH_HBAR;
+ }
+ if( !pTabBar )
+ aHorSBar.Hide();
+ aHorSBar.SetThumbPos( 0 );
+ MapMode aMapMode( pView->GetMapMode());
+ aMapMode.SetOrigin( Point(0,0) );
+ pView->Control::SetMapMode( aMapMode );
+ aHorSBar.SetRange( aRange );
+ aHorSBar.SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight));
+ pView->SetClipRegion();
+ if( GetUpdateMode() )
+ pView->Invalidate( GetVisibleArea() );
+ nFlags |= F_FILLING;
+ if( !aHorSBar.IsVisible() && !aVerSBar.IsVisible() )
+ aScrBarBox.Hide();
+}
+
+// *********************************************************************
+// Painten, Navigieren, Scrollen
+// *********************************************************************
+
+IMPL_LINK_INLINE_START( SvImpLBox, EndScrollHdl, ScrollBar *, pScrollBar )
+{
+ if( nFlags & F_ENDSCROLL_SET_VIS_SIZE )
+ {
+ aVerSBar.SetVisibleSize( nNextVerVisSize );
+ nFlags &= ~F_ENDSCROLL_SET_VIS_SIZE;
+ }
+ EndScroll();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvImpLBox, EndScrollHdl, ScrollBar *, pScrollBar )
+
+
+// Handler vertikale ScrollBar
+
+IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar )
+{
+ DBG_ASSERT(!bInVScrollHdl,"Scroll-Handler ueberholt sich!");
+ long nDelta = pScrollBar->GetDelta();
+ if( !nDelta )
+ return 0;
+
+ nFlags &= (~F_FILLING);
+
+ bInVScrollHdl = TRUE;
+
+ if( pView->IsEditingActive() )
+ {
+ pView->EndEditing( TRUE ); // Cancel
+ pView->Update();
+ }
+ BeginScroll();
+
+ if( nDelta > 0 )
+ {
+ if( nDelta == 1 )
+ CursorDown();
+ else
+ PageDown( (USHORT) nDelta );
+ }
+ else
+ {
+ nDelta *= (-1);
+ if( nDelta == 1 )
+ CursorUp();
+ else
+ PageUp( (USHORT) nDelta );
+ }
+ bInVScrollHdl = FALSE;
+ return 0;
+}
+
+
+void SvImpLBox::CursorDown()
+{
+ SvLBoxEntry* pNextFirstToDraw = (SvLBoxEntry*)(pView->NextVisible( pStartEntry));
+ if( pNextFirstToDraw )
+ {
+ nFlags &= (~F_FILLING);
+ pView->NotifyScrolling( -1 );
+ ShowCursor( FALSE );
+ pView->Update();
+ pStartEntry = pNextFirstToDraw;
+ Rectangle aArea( GetVisibleArea() );
+ pView->Scroll( 0, -(pView->GetEntryHeight()), aArea, SCROLL_NOCHILDREN );
+ pView->Update();
+ ShowCursor( TRUE );
+ pView->NotifyScrolled();
+ }
+}
+
+void SvImpLBox::CursorUp()
+{
+ SvLBoxEntry* pPrevFirstToDraw = (SvLBoxEntry*)(pView->PrevVisible( pStartEntry));
+ if( pPrevFirstToDraw )
+ {
+ nFlags &= (~F_FILLING);
+ long nEntryHeight = pView->GetEntryHeight();
+ pView->NotifyScrolling( 1 );
+ ShowCursor( FALSE );
+ pView->Update();
+ pStartEntry = pPrevFirstToDraw;
+ Rectangle aArea( GetVisibleArea() );
+ aArea.Bottom() -= nEntryHeight;
+ pView->Scroll( 0, nEntryHeight, aArea, SCROLL_NOCHILDREN );
+ pView->Update();
+ ShowCursor( TRUE );
+ pView->NotifyScrolled();
+ }
+}
+
+void SvImpLBox::PageDown( USHORT nDelta )
+{
+ USHORT nRealDelta = nDelta;
+
+ if( !nDelta )
+ return;
+
+ SvLBoxEntry* pNext;
+ pNext = (SvLBoxEntry*)(pView->NextVisible( pStartEntry, nRealDelta ));
+ if( (ULONG)pNext == (ULONG)pStartEntry )
+ return;
+
+ ShowCursor( FALSE );
+
+ nFlags &= (~F_FILLING);
+ pView->Update();
+ pStartEntry = pNext;
+
+ if( nRealDelta >= nVisibleCount )
+ {
+ pView->Invalidate( GetVisibleArea() );
+ pView->Update();
+ }
+ else
+ {
+ long nScroll = nRealDelta * (-1);
+ pView->NotifyScrolling( nScroll );
+ Rectangle aArea( GetVisibleArea() );
+ nScroll = pView->GetEntryHeight()*nRealDelta;
+ nScroll = -nScroll;
+ pView->Update();
+ pView->Scroll( 0, nScroll, aArea, SCROLL_NOCHILDREN );
+ pView->Update();
+ pView->NotifyScrolled();
+ }
+
+ ShowCursor( TRUE );
+}
+
+void SvImpLBox::PageUp( USHORT nDelta )
+{
+ USHORT nRealDelta = nDelta;
+ if( !nDelta )
+ return;
+
+ SvLBoxEntry* pPrev = (SvLBoxEntry*)(pView->PrevVisible( pStartEntry, nRealDelta ));
+ if( (ULONG)pPrev == (ULONG)pStartEntry )
+ return;
+
+ nFlags &= (~F_FILLING);
+ ShowCursor( FALSE );
+
+ pView->Update();
+ pStartEntry = pPrev;
+ if( nRealDelta >= nVisibleCount )
+ {
+ pView->Invalidate( GetVisibleArea() );
+ pView->Update();
+ }
+ else
+ {
+ long nEntryHeight = pView->GetEntryHeight();
+ pView->NotifyScrolling( (long)nRealDelta );
+ Rectangle aArea( GetVisibleArea() );
+ pView->Update();
+ pView->Scroll( 0, nEntryHeight*nRealDelta, aArea, SCROLL_NOCHILDREN );
+ pView->Update();
+ pView->NotifyScrolled();
+ }
+
+ ShowCursor( TRUE );
+}
+
+void SvImpLBox::KeyUp( BOOL bPageUp, BOOL bNotifyScroll )
+{
+ if( !aVerSBar.IsVisible() )
+ return;
+
+ long nDelta;
+ if( bPageUp )
+ nDelta = aVerSBar.GetPageSize();
+ else
+ nDelta = 1;
+
+ long nThumbPos = aVerSBar.GetThumbPos();
+
+ if( nThumbPos < nDelta )
+ nDelta = nThumbPos;
+
+ if( nDelta <= 0 )
+ return;
+
+ nFlags &= (~F_FILLING);
+ if( bNotifyScroll )
+ BeginScroll();
+
+ aVerSBar.SetThumbPos( nThumbPos - nDelta );
+ if( bPageUp )
+ PageUp( (short)nDelta );
+ else
+ CursorUp();
+
+ if( bNotifyScroll )
+ EndScroll();
+}
+
+
+void SvImpLBox::KeyDown( BOOL bPageDown, BOOL bNotifyScroll )
+{
+ if( !aVerSBar.IsVisible() )
+ return;
+
+ long nDelta;
+ if( bPageDown )
+ nDelta = aVerSBar.GetPageSize();
+ else
+ nDelta = 1;
+
+ long nThumbPos = aVerSBar.GetThumbPos();
+ long nVisibleSize = aVerSBar.GetVisibleSize();
+ long nRange = aVerSBar.GetRange().Len();
+
+ long nTmp = nThumbPos+nVisibleSize;
+ while( (nDelta > 0) && (nTmp+nDelta) >= nRange )
+ nDelta--;
+
+ if( nDelta <= 0 )
+ return;
+
+ nFlags &= (~F_FILLING);
+ if( bNotifyScroll )
+ BeginScroll();
+
+ aVerSBar.SetThumbPos( nThumbPos+nDelta );
+ if( bPageDown )
+ PageDown( (short)nDelta );
+ else
+ CursorDown();
+
+ if( bNotifyScroll )
+ EndScroll();
+}
+
+
+
+void SvImpLBox::InvalidateEntriesFrom( long nY ) const
+{
+ if( !(nFlags & F_IN_PAINT ))
+ {
+ Rectangle aRect( GetVisibleArea() );
+ aRect.Top() = nY;
+ pView->Invalidate( aRect );
+ }
+}
+
+void SvImpLBox::InvalidateEntry( long nY ) const
+{
+ if( !(nFlags & F_IN_PAINT ))
+ {
+ Rectangle aRect( GetVisibleArea() );
+ long nMaxBottom = aRect.Bottom();
+ aRect.Top() = nY;
+ aRect.Bottom() = nY; aRect.Bottom() += pView->GetEntryHeight();
+ if( aRect.Top() > nMaxBottom )
+ return;
+ if( aRect.Bottom() > nMaxBottom )
+ aRect.Bottom() = nMaxBottom;
+ pView->Invalidate( aRect );
+ }
+}
+
+void SvImpLBox::InvalidateEntry( SvLBoxEntry* pEntry )
+{
+ if( GetUpdateMode() )
+ {
+ long nPrev = nMostRight;
+ SetMostRight( pEntry );
+ if( nPrev < nMostRight )
+ ShowVerSBar();
+ }
+ if( !(nFlags & F_IN_PAINT ))
+ {
+ BOOL bHasFocusRect = FALSE;
+ if( pEntry==pCursor && pView->HasFocus() )
+ {
+ bHasFocusRect = TRUE;
+ ShowCursor( FALSE );
+ }
+ InvalidateEntry( GetEntryLine( pEntry ) );
+ if( bHasFocusRect )
+ ShowCursor( TRUE );
+ }
+}
+
+
+void SvImpLBox::RecalcFocusRect()
+{
+ if( pView->HasFocus() && pCursor )
+ {
+ pView->HideFocus();
+ long nY = GetEntryLine( pCursor );
+ Rectangle aRect = pView->GetFocusRect( pCursor, nY );
+ Region aOldClip( pView->GetClipRegion());
+ Region aClipRegion( GetClipRegionRect() );
+ pView->SetClipRegion( aClipRegion );
+ pView->ShowFocus( aRect );
+ pView->SetClipRegion( aOldClip );
+ }
+}
+
+//
+// Setzt Cursor. Passt bei SingleSelection die Selektion an
+//
+
+void SvImpLBox::SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect )
+{
+ SvViewDataEntry* pViewDataNewCur = 0;
+ if( pEntry )
+ pViewDataNewCur= pView->GetViewDataEntry(pEntry);
+ if( pEntry &&
+ pEntry == pCursor &&
+ pViewDataNewCur->HasFocus() &&
+ pViewDataNewCur->IsSelected())
+ {
+ return;
+ }
+ SvLBoxEntry* pOldCursor = pCursor;
+ if( pCursor && pEntry != pCursor )
+ {
+ pView->SetEntryFocus( pCursor, FALSE );
+ if( bSimpleTravel )
+ pView->Select( pCursor, FALSE );
+ pView->HideFocus();
+ }
+ pCursor = pEntry;
+ if( pCursor )
+ {
+ pViewDataNewCur->SetFocus( TRUE );
+ if(!bForceNoSelect && bSimpleTravel && !(nFlags & F_DESEL_ALL) && GetUpdateMode())
+ {
+ pView->Select( pCursor, TRUE );
+ }
+ // Mehrfachselektion: Im Cursor-Move selektieren, wenn
+ // nicht im Add-Mode (Ctrl-F8)
+ else if( GetUpdateMode() &&
+ pView->GetSelectionMode() == MULTIPLE_SELECTION &&
+ !(nFlags & F_DESEL_ALL) && !aSelEng.IsAddMode() &&
+ !bForceNoSelect )
+ {
+ pView->Select( pCursor, TRUE );
+ }
+ else
+ {
+ ShowCursor( TRUE );
+ }
+
+ if( pAnchor )
+ {
+ DBG_ASSERT(aSelEng.GetSelectionMode() != SINGLE_SELECTION,"Mode?")
+ SetAnchorSelection( pOldCursor, pCursor );
+ }
+ }
+ nFlags &= (~F_DESEL_ALL);
+}
+
+void SvImpLBox::ShowCursor( BOOL bShow )
+{
+ if( !bShow || !pCursor || !pView->HasFocus() )
+ pView->HideFocus();
+ else
+ {
+ long nY = GetEntryLine( pCursor );
+ Rectangle aRect = pView->GetFocusRect( pCursor, nY );
+ Region aOldClip( pView->GetClipRegion());
+ Region aClipRegion( GetClipRegionRect() );
+ pView->SetClipRegion( aClipRegion );
+ pView->ShowFocus( aRect );
+ pView->SetClipRegion( aOldClip );
+ }
+}
+
+
+
+void SvImpLBox::UpdateAll( BOOL bInvalidateCompleteView,
+ BOOL bUpdateVerScrollBar )
+{
+ if( bUpdateVerScrollBar )
+ FindMostRight(0);
+ aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ SyncVerThumb();
+ FillView();
+ ShowVerSBar();
+ if( bSimpleTravel && pCursor && pView->HasFocus() )
+ pView->Select( pCursor, TRUE );
+ ShowCursor( TRUE );
+ if( bInvalidateCompleteView )
+ pView->Invalidate();
+ else
+ pView->Invalidate( GetVisibleArea() );
+}
+
+IMPL_LINK_INLINE_START( SvImpLBox, ScrollLeftRightHdl, ScrollBar *, pScrollBar )
+{
+ long nDelta = pScrollBar->GetDelta();
+ if( nDelta )
+ {
+ if( pView->IsEditingActive() )
+ {
+ pView->EndEditing( TRUE ); // Cancel
+ pView->Update();
+ }
+ pView->nFocusWidth = -1;
+ KeyLeftRight( nDelta );
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvImpLBox, ScrollLeftRightHdl, ScrollBar *, pScrollBar )
+
+void SvImpLBox::KeyLeftRight( long nDelta )
+{
+ if( !(nFlags & F_IN_RESIZE) )
+ pView->Update();
+ BeginScroll();
+ nFlags &= (~F_FILLING);
+ pView->NotifyScrolling( 0 ); // 0 == horizontales Scrolling
+ ShowCursor( FALSE );
+
+ // neuen Origin berechnen
+ long nPos = aHorSBar.GetThumbPos();
+ Point aOrigin( -nPos, 0 );
+
+ MapMode aMapMode( pView->GetMapMode() );
+ aMapMode.SetOrigin( aOrigin );
+ pView->SetMapMode( aMapMode );
+
+ if( !(nFlags & F_IN_RESIZE) )
+ {
+ Rectangle aRect( GetVisibleArea() );
+ pView->Scroll( -nDelta, 0, aRect, SCROLL_NOCHILDREN );
+ }
+ else
+ pView->Invalidate();
+ RecalcFocusRect();
+ ShowCursor( TRUE );
+ pView->NotifyScrolled();
+}
+
+
+// gibt letzten Eintrag zurueck, wenn Position unter
+// dem letzten Eintrag ist
+SvLBoxEntry* SvImpLBox::GetClickedEntry( const Point& rPoint ) const
+{
+ if( pView->GetEntryCount() == 0 || !pStartEntry)
+ return 0;
+
+ USHORT nClickedEntry = (USHORT)(rPoint.Y() / pView->GetEntryHeight() );
+ USHORT nTemp = nClickedEntry;
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pView->NextVisible( pStartEntry, nTemp ));
+ return pEntry;
+}
+
+//
+// prueft, ob der Eintrag "richtig" getroffen wurde
+// (Focusrect+ ContextBitmap bei TreeListBox)
+//
+BOOL SvImpLBox::EntryReallyHit(SvLBoxEntry* pEntry,const Point& rPosPixel,long nLine)
+{
+ BOOL bRet;
+ // bei "besonderen" Entries (mit CheckButtons usw.) sind wir
+ // nicht so pingelig
+ if( pEntry->ItemCount() >= 3 )
+ return TRUE;
+
+ Rectangle aRect( pView->GetFocusRect( pEntry, nLine ));
+ if( pView->IsA() == SV_LISTBOX_ID_TREEBOX )
+ {
+ SvLBoxContextBmp* pBmp = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ aRect.Left() -= pBmp->GetSize(pView,pEntry).Width();
+ aRect.Left() -= 4; // etwas Speilraum lassen
+ }
+ Point aPos( rPosPixel );
+ aPos -= pView->GetMapMode().GetOrigin();
+ if( aRect.IsInside( aPos ) )
+ bRet = TRUE;
+ else
+ bRet = FALSE;
+ return bRet;
+}
+
+
+// gibt 0 zurueck, wenn Position unter dem letzten Eintrag ist
+SvLBoxEntry* SvImpLBox::GetEntry( const Point& rPoint ) const
+{
+ if( (pView->GetEntryCount() == 0) || !pStartEntry ||
+ (rPoint.Y() > aOutputSize.Height()) )
+ return 0;
+
+ USHORT nClickedEntry = (USHORT)(rPoint.Y() / pView->GetEntryHeight() );
+ USHORT nTemp = nClickedEntry;
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pView->NextVisible( pStartEntry, nTemp ));
+ if( nTemp != nClickedEntry )
+ pEntry = 0;
+ return pEntry;
+}
+
+
+SvLBoxEntry* SvImpLBox::MakePointVisible(const Point& rPoint,BOOL bNotifyScroll)
+{
+ if( !pCursor )
+ return 0;
+ long nY = rPoint.Y();
+ SvLBoxEntry* pEntry = 0;
+ long nMax = aOutputSize.Height();
+ if( nY < 0 || nY >= nMax ) // aOutputSize.Height() )
+ {
+ if( nY < 0 )
+ pEntry = (SvLBoxEntry*)(pView->PrevVisible( pCursor ));
+ else
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pCursor ));
+
+ if( pEntry && pEntry != pCursor )
+ pView->SetEntryFocus( pCursor, FALSE );
+
+ if( nY < 0 )
+ KeyUp( FALSE, bNotifyScroll );
+ else
+ KeyDown( FALSE, bNotifyScroll );
+ }
+ else
+ {
+ pEntry = GetClickedEntry( rPoint );
+ if( !pEntry )
+ {
+ USHORT nSteps = 0xFFFF;
+ // LastVisible ist noch nicht implementiert!
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pStartEntry, nSteps ));
+ }
+ if( pEntry )
+ {
+ if( pEntry != pCursor &&
+ aSelEng.GetSelectionMode() == SINGLE_SELECTION
+ )
+ pView->Select( pCursor, FALSE );
+ }
+ }
+ return pEntry;
+}
+
+Rectangle SvImpLBox::GetClipRegionRect() const
+{
+ Point aOrigin( pView->GetMapMode().GetOrigin() );
+ aOrigin.X() *= -1; // Umrechnung Dokumentkoord.
+ Rectangle aClipRect( aOrigin, aOutputSize );
+ aClipRect.Bottom()++;
+ return aClipRect;
+}
+
+
+void SvImpLBox::Paint( const Rectangle& rRect )
+{
+ if( !pView->GetVisibleCount() )
+ return;
+
+ nFlags |= F_IN_PAINT;
+
+//#if SUPD > 364
+ if( nFlags & F_FILLING )
+ {
+ SvLBoxEntry* pFirst = pView->First();
+ if( pFirst != pStartEntry )
+ {
+ ShowCursor( FALSE );
+ pStartEntry = pView->First();
+ aVerSBar.SetThumbPos( 0 );
+ StopUserEvent();
+ ShowCursor( TRUE );
+ nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpLBox,MyUserEvent),(void*)1);
+ return;
+ }
+ }
+//#endif
+
+ if( !pStartEntry )
+ {
+ pStartEntry = pView->First();
+ }
+
+#ifdef XX_OV
+ ULONG nXAbsPos = (USHORT)pTree->GetAbsPos( pStartEntry );
+ ULONG nXVisPos = pView->GetVisiblePos( pStartEntry );
+ SvLBoxString* pXStr = (SvLBoxString*)pStartEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING);
+#endif
+
+
+
+ if( nNodeBmpTabDistance == NODE_BMP_TABDIST_NOTVALID )
+ SetNodeBmpTabDistance();
+
+ long nRectHeight = rRect.GetHeight();
+ long nEntryHeight = pView->GetEntryHeight();
+
+ int bHorSBar;
+ if( (pView->nWindowStyle) & WB_HSCROLL )
+ bHorSBar = TRUE;
+ else
+ bHorSBar = FALSE;
+
+ // Bereich der zu zeichnenden Entries berechnen
+ USHORT nStartLine = (USHORT)( rRect.Top() / nEntryHeight );
+ USHORT nCount = (USHORT)( nRectHeight / nEntryHeight );
+ nCount += 2; // keine Zeile vergessen
+
+ long nY = nStartLine * nEntryHeight;
+ SvLBoxEntry* pEntry = pStartEntry;
+ while( nStartLine && pEntry )
+ {
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ nStartLine--;
+ }
+
+ Region aClipRegion( GetClipRegionRect() );
+
+ // erst die Linien Zeichnen, dann clippen!
+ pView->SetClipRegion();
+ if( nWinBits & ( WB_HASLINES | WB_HASLINESATROOT ) )
+ DrawNet();
+
+ pView->SetClipRegion( aClipRegion );
+
+ for( USHORT n=0; n< nCount && pEntry; n++ )
+ {
+ /*long nMaxRight=*/
+ pView->PaintEntry1( pEntry, nY, 0xffff, TRUE );
+ nY += nEntryHeight;
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+
+ if( !pCursor )
+ {
+ if( aSelEng.GetSelectionMode()==SINGLE_SELECTION )
+ {
+ if( nWinBits & WB_NOINITIALSELECTION )
+ {
+ // nicht selektieren
+ SetCursor( pStartEntry, TRUE );
+ }
+ else
+ SetCursor( pStartEntry );
+ }
+ else
+ // nicht selektieren
+ SetCursor( pStartEntry, TRUE );
+ //OV, 16.7.97, warum HideFocus?? (siehe Bugid 41404)
+ //pView->HideFocus();
+ }
+ nFlags &= (~F_DESEL_ALL);
+
+ pView->SetClipRegion();
+ Rectangle aRect;
+ if( !(nFlags & F_PAINTED) )
+ {
+ nFlags |= F_PAINTED;
+ RepaintScrollBars();
+ }
+ nFlags &= (~F_IN_PAINT);
+}
+
+void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop )
+{
+ if( !pEntry )
+ return;
+
+ BOOL bInView = IsEntryInView( pEntry );
+
+ if( bInView && (!bMoveToTop || pStartEntry == pEntry) )
+ return; // ist schon sichtbar
+
+ if( pStartEntry || (nWinBits & WB_FORCE_MAKEVISIBLE) )
+ nFlags &= (~F_FILLING);
+ if( !bInView )
+ {
+ if( !pView->IsEntryVisible(pEntry) ) // Parent(s) zugeklappt ?
+ {
+ SvLBoxEntry* pParent = pView->GetParent( pEntry );
+ while( pParent )
+ {
+ if( !pView->IsExpanded( pParent ) )
+ {
+ BOOL bRet = pView->Expand( pParent );
+ DBG_ASSERT(bRet,"Not expanded!");
+ }
+ pParent = pView->GetParent( pParent );
+ }
+ // Passen Childs der Parents in View oder muessen wir scrollen ?
+ if( IsEntryInView( pEntry ) && !bMoveToTop )
+ return; // Scrollen nicht noetig -> tschuess
+ }
+ }
+
+ pStartEntry = pEntry;
+ ShowCursor( FALSE );
+ FillView();
+ aVerSBar.SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) );
+ ShowCursor( TRUE );
+ pView->Invalidate();
+}
+
+
+void SvImpLBox::RepaintSelectionItems()
+{
+ if( !pView->GetVisibleCount() )
+ return;
+
+ if( !pStartEntry )
+ pStartEntry = pView->First();
+
+ if( nNodeBmpTabDistance == NODE_BMP_TABDIST_NOTVALID )
+ SetNodeBmpTabDistance();
+
+ ShowCursor( FALSE );
+
+ long nEntryHeight = pView->GetEntryHeight();
+
+ USHORT nCount = nVisibleCount;
+ long nY = 0;
+ SvLBoxEntry* pEntry = pStartEntry;
+ for( USHORT n=0; n< nCount && pEntry; n++ )
+ {
+ pView->PaintEntry1( pEntry, nY, 0xffff ); //wg. ItemsetBrowser SV_LBOXTAB_SHOW_SELECTION );
+ nY += nEntryHeight;
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+
+ ShowCursor( TRUE );
+}
+
+
+void SvImpLBox::DrawNet()
+{
+ if( pView->GetVisibleCount() < 2 && !pStartEntry->HasChildsOnDemand() &&
+ !pStartEntry->HasChilds() )
+ return;
+ long nEntryHeight = pView->GetEntryHeight();
+ long nEntryHeightDIV2 = nEntryHeight / 2;
+ if( nEntryHeightDIV2 && !(nEntryHeight & 0x0001))
+ nEntryHeightDIV2--;
+
+ SvLBoxEntry* pChild;
+ SvLBoxEntry* pEntry = pStartEntry;
+
+ SvLBoxTab* pFirstDynamicTab = pView->GetFirstDynamicTab();
+ while( pTree->GetDepth( pEntry ) > 0 )
+ pEntry = pView->GetParent( pEntry );
+ USHORT nOffs = (USHORT)(pView->GetVisiblePos( pStartEntry ) -
+ pView->GetVisiblePos( pEntry ));
+ long nY = 0;
+ nY -= ( nOffs * nEntryHeight );
+
+ DBG_ASSERT(pFirstDynamicTab,"No Tree!")
+
+ Color aOldLineColor = pView->GetLineColor();
+ const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings();
+ Color aCol= rStyleSettings.GetFaceColor();
+
+ if( aCol.IsRGBEqual( pView->GetBackground().GetColor()) )
+ aCol = rStyleSettings.GetShadowColor();
+ pView->SetLineColor( aCol );
+ Point aPos1, aPos2;
+ USHORT nDistance;
+ USHORT nMax = nVisibleCount + nOffs + 1;
+ for( USHORT n=0; n< nMax && pEntry; n++ )
+ {
+ if( pView->IsExpanded(pEntry) )
+ {
+ aPos1.X() = pView->GetTabPos(pEntry, pFirstDynamicTab);
+ // wenn keine ContextBitmap, dann etwas nach rechts
+ // unter den ersten Text (Node.Bmp ebenfalls
+ if( !pView->nContextBmpWidthMax )
+ aPos1.X() += aExpNodeBmp.GetSizePixel().Width() / 2;
+
+ aPos1.Y() = nY;
+ aPos1.Y() += nEntryHeightDIV2;
+
+ pChild = pView->FirstChild( pEntry );
+ DBG_ASSERT(pChild,"Child?")
+ pChild = pTree->LastSibling( pChild );
+ nDistance = (USHORT)(pView->GetVisiblePos(pChild) -
+ pView->GetVisiblePos(pEntry));
+ aPos2 = aPos1;
+ aPos2.Y() += nDistance * nEntryHeight;
+ pView->DrawLine( aPos1, aPos2 );
+ }
+ // Sichtbar im Control ?
+ if( n>= nOffs && ((nWinBits & WB_HASLINESATROOT) || !pTree->IsAtRootDepth(pEntry)))
+ {
+ // kann aPos1 recyclet werden ?
+ if( !pView->IsExpanded(pEntry) )
+ {
+ // njet
+ aPos1.X() = pView->GetTabPos(pEntry, pFirstDynamicTab);
+ // wenn keine ContextBitmap, dann etwas nach rechts
+ // unter den ersten Text (Node.Bmp ebenfalls
+ if( !pView->nContextBmpWidthMax )
+ aPos1.X() += aExpNodeBmp.GetSizePixel().Width() / 2;
+ aPos1.Y() = nY;
+ aPos1.Y() += nEntryHeightDIV2;
+ aPos2.X() = aPos1.X();
+ }
+ aPos2.Y() = aPos1.Y();
+ aPos2.X() -= pView->GetIndent();
+ pView->DrawLine( aPos1, aPos2 );
+ }
+ nY += nEntryHeight;
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( nWinBits & WB_HASLINESATROOT )
+ {
+ pEntry = pView->First();
+ aPos1.X() = pView->GetTabPos( pEntry, pFirstDynamicTab);
+ // wenn keine ContextBitmap, dann etwas nach rechts
+ // unter den ersten Text (Node.Bmp ebenfalls
+ if( !pView->nContextBmpWidthMax )
+ aPos1.X() += aExpNodeBmp.GetSizePixel().Width() / 2;
+ aPos1.X() -= pView->GetIndent();
+ aPos1.Y() = GetEntryLine( pEntry );
+ aPos1.Y() += nEntryHeightDIV2;
+ pChild = pTree->LastSibling( pEntry );
+ aPos2.X() = aPos1.X();
+ aPos2.Y() = GetEntryLine( pChild );
+ aPos2.Y() += nEntryHeightDIV2;
+ pView->DrawLine( aPos1, aPos2 );
+ }
+ pView->SetLineColor( aOldLineColor );
+}
+
+
+static long GetOptSize( TabBar* pTabBar )
+{
+#if SUPD > 373
+ return pTabBar->CalcWindowSizePixel().Width();
+#else
+ long nWidth = 0;
+ USHORT nCount = pTabBar->GetPageCount();
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ USHORT nId = pTabBar->GetPageId( nCur );
+ nWidth+= pTabBar->GetTextSize(pTabBar->GetPageText(nId)).Width();
+ nWidth += 18;
+ }
+ return nWidth;
+#endif
+}
+
+void SvImpLBox::PositionScrollBars( Size& rSize, USHORT nMask )
+{
+ long nOverlap = 0;
+
+ Size aVerSize( nVerSBarWidth, rSize.Height() );
+ Size aHorSize( rSize.Width(), nHorSBarHeight );
+ long nTabBarWidth = 0;
+ if( pTabBar )
+ {
+ nTabBarWidth = GetOptSize( pTabBar );
+ long nMaxWidth = (rSize.Width() * 700) / 1000;
+ if( nTabBarWidth > nMaxWidth )
+ {
+ nTabBarWidth = nMaxWidth;
+ pTabBar->SetStyle( pTabBar->GetStyle() | WB_MINSCROLL );
+ }
+ else
+ {
+ WinBits nStyle = pTabBar->GetStyle();
+ nStyle &= ~(WB_MINSCROLL);
+ pTabBar->SetStyle( nStyle );
+ }
+ aHorSize.Width() -= nTabBarWidth;
+ Size aTabSize( pTabBar->GetSizePixel() );
+ aTabSize.Width() = nTabBarWidth;
+ pTabBar->SetSizePixel( aTabSize );
+ }
+ if( nMask & 0x0001 )
+ aHorSize.Width() -= nVerSBarWidth;
+ if( nMask & 0x0002 )
+ aVerSize.Height() -= nHorSBarHeight;
+
+ aVerSize.Height() += 2 * nOverlap;
+ Point aVerPos( rSize.Width() - aVerSize.Width() + nOverlap, -nOverlap );
+ aVerSBar.SetPosSizePixel( aVerPos, aVerSize );
+
+ aHorSize.Width() += 2 * nOverlap;
+ Point aHorPos( -nOverlap, rSize.Height() - aHorSize.Height() + nOverlap );
+ if( pTabBar )
+ pTabBar->SetPosPixel( aHorPos );
+ aHorPos.X() += nTabBarWidth;
+ aHorSBar.SetPosSizePixel( aHorPos, aHorSize );
+
+ if( nMask & 0x0001 )
+ rSize.Width() = aVerPos.X();
+ if( nMask & 0x0002 )
+ rSize.Height() = aHorPos.Y();
+ if( pTabBar )
+ pTabBar->Show();
+
+ if( (nMask & (0x0001|0x0002)) == (0x0001|0x0002) )
+ aScrBarBox.Show();
+ else
+ aScrBarBox.Hide();
+
+}
+
+// nResult: Bit0 == VerSBar Bit1 == HorSBar
+USHORT SvImpLBox::AdjustScrollBars( Size& rSize )
+{
+ long nEntryHeight = pView->GetEntryHeight();
+ if( !nEntryHeight )
+ return 0;
+
+ USHORT nResult = 0;
+
+ Size aOSize( pView->Control::GetOutputSizePixel() );
+
+ int bVerSBar = pView->nWindowStyle & WB_VSCROLL;
+ int bHorBar = 0;
+ long nMaxRight = aOSize.Width(); //GetOutputSize().Width();
+ Point aOrigin( pView->GetMapMode().GetOrigin() );
+ aOrigin.X() *= -1;
+ nMaxRight += aOrigin.X() - 1;
+ long nVis = nMostRight - aOrigin.X();
+ if( pTabBar || (
+ (pView->nWindowStyle & WB_HSCROLL) &&
+ (nVis < nMostRight || nMaxRight < nMostRight) ))
+ bHorBar = 1;
+
+ // Anzahl aller nicht eingeklappten Eintraege
+ ULONG nTotalCount = pView->GetVisibleCount();
+
+ // Anzahl in der View sichtbarer Eintraege
+ nVisibleCount = aOSize.Height() / nEntryHeight;
+
+ // muessen wir eine vertikale Scrollbar einblenden?
+ if( bVerSBar || nTotalCount > nVisibleCount - 1 )
+ {
+ nResult = 1;
+ nFlags |= F_HOR_SBARSIZE_WITH_VBAR;
+ nMaxRight -= nVerSBarWidth;
+ if( !bHorBar )
+ {
+ if( (pView->nWindowStyle & WB_HSCROLL) &&
+ (nVis < nMostRight || nMaxRight < nMostRight) )
+ bHorBar = 1;
+ }
+ }
+
+ // muessen wir eine horizontale Scrollbar einblenden?
+ if( bHorBar )
+ {
+ nResult |= 0x0002;
+ // die Anzahl der in der View sichtbaren Eintraege
+ // muss neu berechnet werden, da die horizontale
+ // ScrollBar eingeblendet wird
+ nVisibleCount = (aOSize.Height() - nHorSBarHeight) / nEntryHeight;
+ // eventuell brauchen wir jetzt doch eine vertikale ScrollBar
+ if( !(nResult & 0x0001) &&
+ ((nTotalCount > nVisibleCount - 1) || bVerSBar) )
+ {
+ nResult = 3;
+ nFlags |= F_VER_SBARSIZE_WITH_HBAR;
+ }
+ }
+
+ PositionScrollBars( aOSize, nResult );
+
+ // Range, VisibleRange usw. anpassen
+
+ // Output-Size aktualisieren, falls wir scrollen muessen
+ Rectangle aRect;
+ aRect.SetSize( aOSize );
+ aSelEng.SetVisibleArea( aRect );
+
+ // Vertikale ScrollBar
+ long nTemp = (long)nVisibleCount;
+ nTemp--;
+ if( nTemp != aVerSBar.GetVisibleSize() )
+ {
+ if( !bInVScrollHdl )
+ {
+ aVerSBar.SetPageSize( nTemp - 1 );
+ aVerSBar.SetVisibleSize( nTemp );
+ }
+ else
+ {
+ nFlags |= F_ENDSCROLL_SET_VIS_SIZE;
+ nNextVerVisSize = nTemp;
+ }
+ }
+
+ // Horizontale ScrollBar
+ nTemp = aHorSBar.GetThumbPos();
+ aHorSBar.SetVisibleSize( aOSize.Width() );
+ long nNewThumbPos = aHorSBar.GetThumbPos();
+ Range aRange( aHorSBar.GetRange() );
+ if( aRange.Max() < nMostRight+25 )
+ {
+ aRange.Max() = nMostRight+25;
+ aHorSBar.SetRange( aRange );
+ }
+
+ if( nTemp != nNewThumbPos )
+ {
+ nTemp = nNewThumbPos - nTemp;
+ if( pView->IsEditingActive() )
+ {
+ pView->EndEditing( TRUE ); // Cancel
+ pView->Update();
+ }
+ pView->nFocusWidth = -1;
+ KeyLeftRight( nTemp );
+ }
+
+ if( nResult & 0x0001 )
+ aVerSBar.Show();
+ else
+ aVerSBar.Hide();
+
+ if( nResult & 0x0002 )
+ aHorSBar.Show();
+ else
+ {
+ if( !pTabBar )
+ aHorSBar.Hide();
+ }
+ rSize = aOSize;
+ return nResult;
+}
+
+void SvImpLBox::InitScrollBarBox()
+{
+ aScrBarBox.SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) );
+ Size aSize( pView->Control::GetOutputSizePixel() );
+ aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight));
+}
+
+void SvImpLBox::Resize()
+{
+ Size aSize( pView->Control::GetOutputSizePixel());
+ if( aSize.Width() <= 0 || aSize.Height() <= 0 )
+ return;
+ nFlags |= F_IN_RESIZE;
+ InitScrollBarBox();
+
+ if( pView->GetEntryHeight())
+ {
+ AdjustScrollBars( aOutputSize );
+ FillView();
+ }
+ // !!!HACK, da in Floating- & Docking-Windows nach Resizes
+ // die Scrollbars nicht richtig, bzw. ueberhaupt nicht gezeichnet werden
+ if( aHorSBar.IsVisible())
+ aHorSBar.Invalidate();
+ if( aVerSBar.IsVisible())
+ aVerSBar.Invalidate();
+ nFlags &= (~(F_IN_RESIZE | F_PAINTED));
+}
+
+void SvImpLBox::FillView()
+{
+ if( !pStartEntry )
+ {
+ USHORT nVisibleCount = (USHORT)(pView->GetVisibleCount());
+ USHORT nTempThumb = (USHORT)aVerSBar.GetThumbPos();
+ if( nTempThumb >= nVisibleCount )
+ nTempThumb = nVisibleCount - 1;
+ pStartEntry = (SvLBoxEntry*)(pView->GetEntryAtVisPos(nTempThumb));
+ }
+ if( pStartEntry )
+ {
+ USHORT nLast = (USHORT)(pView->GetVisiblePos( (SvLBoxEntry*)(pView->LastVisible())));
+ USHORT nThumb = (USHORT)(pView->GetVisiblePos( pStartEntry ));
+ USHORT nCurDispEntries = nLast-nThumb+1;
+ if( nCurDispEntries < nVisibleCount )
+ {
+ ShowCursor( FALSE );
+ // Fenster fuellen, indem der Thumb schrittweise
+ // nach oben bewegt wird
+ BOOL bFound = FALSE;
+ SvLBoxEntry* pTemp = pStartEntry;
+ while( nCurDispEntries < nVisibleCount && pTemp )
+ {
+ pTemp = (SvLBoxEntry*)(pView->PrevVisible(pStartEntry));
+ if( pTemp )
+ {
+ nThumb--;
+ pStartEntry = pTemp;
+ nCurDispEntries++;
+ bFound = TRUE;
+ }
+ }
+ if( bFound )
+ {
+ aVerSBar.SetThumbPos( nThumb );
+ ShowCursor( TRUE ); // Focusrect neu berechnen
+ pView->Invalidate();
+ }
+ }
+ }
+}
+
+
+
+
+void SvImpLBox::ShowVerSBar()
+{
+ USHORT bVerBar = pView->nWindowStyle & WB_VSCROLL;
+ ULONG nVis;
+ if( !bVerBar )
+ nVis = pView->GetVisibleCount();
+ if( bVerBar || (nVisibleCount && nVis > (ULONG)(nVisibleCount-1)) )
+ {
+ if( !aVerSBar.IsVisible() )
+ {
+ pView->nFocusWidth = -1;
+ AdjustScrollBars( aOutputSize );
+ if( GetUpdateMode() )
+ aVerSBar.Update();
+ }
+ }
+ else
+ {
+ if( aVerSBar.IsVisible() )
+ {
+ pView->nFocusWidth = -1;
+ AdjustScrollBars( aOutputSize );
+ }
+ }
+
+ long nMaxRight = GetOutputSize().Width();
+ Point aPos( pView->GetMapMode().GetOrigin() );
+ aPos.X() *= -1; // Umrechnung Dokumentkoord.
+ nMaxRight = nMaxRight + aPos.X() - 1;
+ if( nMaxRight < nMostRight )
+ {
+ if( !aHorSBar.IsVisible() )
+ {
+ pView->nFocusWidth = -1;
+ AdjustScrollBars( aOutputSize );
+ if( GetUpdateMode() )
+ aHorSBar.Update();
+ }
+ else
+ {
+ Range aRange( aHorSBar.GetRange() );
+ if( aRange.Max() < nMostRight+25 )
+ {
+ aRange.Max() = nMostRight+25;
+ aHorSBar.SetRange( aRange );
+ }
+ else
+ {
+ pView->nFocusWidth = -1;
+ AdjustScrollBars( aOutputSize );
+ }
+ }
+ }
+ else
+ {
+ if( aHorSBar.IsVisible() )
+ {
+ pView->nFocusWidth = -1;
+ AdjustScrollBars( aOutputSize );
+ }
+ }
+}
+
+
+void SvImpLBox::SyncVerThumb()
+{
+ if( pStartEntry )
+ {
+ long nEntryPos = pView->GetVisiblePos( pStartEntry );
+ aVerSBar.SetThumbPos( nEntryPos );
+ }
+ else
+ aVerSBar.SetThumbPos( 0 );
+}
+
+BOOL SvImpLBox::IsEntryInView( SvLBoxEntry* pEntry ) const
+{
+ // Parent eingeklappt
+ if( !pView->IsEntryVisible(pEntry) )
+ return FALSE;
+ long nY = GetEntryLine( pEntry );
+ if( nY < 0 )
+ return FALSE;
+ long nMax = nVisibleCount * pView->GetEntryHeight();
+ if( nY >= nMax )
+ return FALSE;
+ return TRUE;
+}
+
+
+long SvImpLBox::GetEntryLine( SvLBoxEntry* pEntry ) const
+{
+ if(!pStartEntry )
+ return -1; // unsichtbare Position
+
+ long nFirstVisPos = pView->GetVisiblePos( pStartEntry );
+ long nEntryVisPos = pView->GetVisiblePos( pEntry );
+ nFirstVisPos = nEntryVisPos - nFirstVisPos;
+ nFirstVisPos *= pView->GetEntryHeight();
+ return nFirstVisPos;
+}
+
+void SvImpLBox::SetEntryHeight( short /* nHeight */ )
+{
+ SetNodeBmpYOffset( aExpNodeBmp );
+ SetNodeBmpYOffset( aCollNodeBmp );
+ if(!pView->HasViewData()) // stehen wir im Clear?
+ {
+ Size aSize = pView->Control::GetOutputSizePixel();
+ AdjustScrollBars( aSize );
+ }
+ else
+ {
+ Resize();
+ if( GetUpdateMode() )
+ pView->Invalidate();
+ }
+}
+
+
+
+// ***********************************************************************
+// Callback-Functions
+// ***********************************************************************
+
+void SvImpLBox::IndentChanged( short /* nIndentPixel */ ) {}
+
+void SvImpLBox::EntryExpanded( SvLBoxEntry* pEntry )
+{
+ // SelAllDestrAnch( FALSE, TRUE ); //DeselectAll();
+ if( GetUpdateMode() )
+ {
+ ShowCursor( FALSE );
+ long nY = GetEntryLine( pEntry );
+ if( IsLineVisible(nY) )
+ {
+ InvalidateEntriesFrom( nY );
+ FindMostRight( pEntry, 0 );
+ }
+ aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ // falls vor dem Thumb expandiert wurde, muss
+ // die Thumb-Position korrigiert werden.
+ SyncVerThumb();
+ ShowVerSBar();
+ ShowCursor( TRUE );
+ }
+}
+
+void SvImpLBox::EntryCollapsed( SvLBoxEntry* pEntry )
+{
+ if( !pView->IsEntryVisible( pEntry ) )
+ return;
+
+ ShowCursor( FALSE );
+
+ if( !pMostRightEntry || pTree->IsChild( pEntry,pMostRightEntry ) )
+ {
+ FindMostRight(0);
+ }
+
+ if( pStartEntry )
+ {
+ long nOldThumbPos = aVerSBar.GetThumbPos();
+ ULONG nVisList = pView->GetVisibleCount();
+ aVerSBar.SetRange( Range(0, nVisList-1) );
+ long nNewThumbPos = aVerSBar.GetThumbPos();
+ if( nNewThumbPos != nOldThumbPos )
+ {
+ pStartEntry = pView->First();
+ USHORT nDistance = (USHORT)nNewThumbPos;
+ if( nDistance )
+ pStartEntry = (SvLBoxEntry*)(pView->NextVisible( pStartEntry,
+ nDistance));
+ if( GetUpdateMode() )
+ pView->Invalidate();
+ }
+ else
+ SyncVerThumb();
+ ShowVerSBar();
+ }
+ // wurde Cursor eingeklappt ?
+ if( pTree->IsChild( pEntry, pCursor ) )
+ SetCursor( pEntry );
+ if( GetUpdateMode() )
+ ShowVerSBar();
+ ShowCursor( TRUE );
+ if( GetUpdateMode() )
+ pView->Select( pCursor, TRUE );
+}
+
+void SvImpLBox::CollapsingEntry( SvLBoxEntry* pEntry )
+{
+ if( !pView->IsEntryVisible( pEntry ) || !pStartEntry )
+ return;
+
+ SelAllDestrAnch( FALSE, TRUE ); // deselectall
+
+ // ist der eingeklappte Parent sichtbar ?
+ long nY = GetEntryLine( pEntry );
+ if( IsLineVisible(nY) )
+ {
+ if( GetUpdateMode() )
+ InvalidateEntriesFrom( nY );
+ }
+ else
+ {
+ if( pTree->IsChild(pEntry, pStartEntry) )
+ {
+ pStartEntry = pEntry;
+ if( GetUpdateMode() )
+ pView->Invalidate();
+ }
+ }
+}
+
+
+void SvImpLBox::SetNodeBmpYOffset( const Image& rBmp )
+{
+ Size aSize;
+ nYoffsNodeBmp = pView->GetHeightOffset( rBmp, aSize );
+ nNodeBmpWidth = aSize.Width();
+}
+
+void SvImpLBox::SetNodeBmpTabDistance()
+{
+ nNodeBmpTabDistance = -pView->GetIndent();
+ if( pView->nContextBmpWidthMax )
+ {
+ // nur, wenn der erste dynamische Tab zentriert ist
+ // (setze ich momentan voraus)
+ Size aSize = aExpNodeBmp.GetSizePixel();
+ nNodeBmpTabDistance -= aSize.Width() / 2;
+ }
+}
+
+//
+// korrigiert bei SingleSelection den Cursor
+//
+void SvImpLBox::EntrySelected( SvLBoxEntry* pEntry, BOOL bSelect )
+{
+ if( nFlags & F_IGNORE_SELECT )
+ return;
+
+ /*
+ if( (nWinBits & WB_HIDESELECTION) && pEntry && !pView->HasFocus() )
+ {
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ pViewData->SetCursored( bSelect );
+ }
+ */
+
+ nFlags &= (~F_DESEL_ALL);
+ if( bSelect &&
+ aSelEng.GetSelectionMode() == SINGLE_SELECTION &&
+ pEntry != pCursor )
+ {
+ SetCursor( pEntry );
+ DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?")
+ }
+
+ if( GetUpdateMode() && pView->IsEntryVisible(pEntry) )
+ {
+ long nY = GetEntryLine( pEntry );
+ if( IsLineVisible( nY ) )
+ {
+ ShowCursor( FALSE );
+ pView->PaintEntry1( pEntry, nY, 0xffff ); // wg. ItemsetBrowser SV_LBOXTAB_SHOW_SELECTION );
+ ShowCursor( TRUE );
+ }
+ }
+}
+
+
+void SvImpLBox::RemovingEntry( SvLBoxEntry* pEntry )
+{
+ DestroyAnchor();
+
+ if( !pView->IsEntryVisible( pEntry ) )
+ {
+ // wenn Parent eingeklappt, dann tschuess
+ nFlags |= F_REMOVED_ENTRY_INVISIBLE;
+ return;
+ }
+
+ if( pEntry == pMostRightEntry || (
+ pEntry->HasChilds() && pView->IsExpanded(pEntry) &&
+ pTree->IsChild(pEntry, pMostRightEntry)))
+ {
+ nFlags |= F_REMOVED_RECALC_MOST_RIGHT;
+ }
+
+ SvLBoxEntry* pOldStartEntry = pStartEntry;
+
+ SvLBoxEntry* pParent = (SvLBoxEntry*)(pView->GetModel()->GetParent(pEntry));
+
+ if( pParent && pView->GetModel()->GetChildList(pParent)->Count() == 1 )
+ {
+ DBG_ASSERT( pView->IsExpanded( pParent ), "Parent not expanded");
+ pParent->SetFlags( pParent->GetFlags() | SV_ENTRYFLAG_NO_NODEBMP);
+ InvalidateEntry( pParent );
+ }
+
+ if( pCursor && pTree->IsChild( pEntry, pCursor) )
+ pCursor = pEntry;
+ if( pStartEntry && pTree->IsChild(pEntry,pStartEntry) )
+ pStartEntry = pEntry;
+
+ SvLBoxEntry* pTemp;
+ if( pCursor && pCursor == pEntry )
+ {
+ if( bSimpleTravel )
+ pView->Select( pCursor, FALSE );
+ ShowCursor( FALSE ); // Focus-Rect weg
+ // NextSibling, weil auch Childs des Cursors geloescht werden
+ pTemp = pView->NextSibling( pCursor );
+ if( !pTemp )
+ pTemp = (SvLBoxEntry*)(pView->PrevVisible( pCursor ));
+
+ SetCursor( pTemp, TRUE );
+ }
+ if( pStartEntry && pStartEntry == pEntry )
+ {
+ pTemp = pView->NextSibling( pStartEntry );
+ if( !pTemp )
+ pTemp = (SvLBoxEntry*)(pView->PrevVisible( pStartEntry ));
+ pStartEntry = pTemp;
+ }
+ if( GetUpdateMode())
+ {
+ // wenns der letzte ist, muss invalidiert werden, damit die Linien
+ // richtig gezeichnet (in diesem Fall geloescht) werden.
+ if( pStartEntry && (pStartEntry != pOldStartEntry || pEntry == (SvLBoxEntry*)pView->GetModel()->Last()) )
+ {
+ aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry ));
+ pView->Invalidate( GetVisibleArea() );
+ }
+ else
+ InvalidateEntriesFrom( GetEntryLine( pEntry ) );
+ }
+}
+
+void SvImpLBox::EntryRemoved()
+{
+ if( nFlags & F_REMOVED_ENTRY_INVISIBLE )
+ {
+ nFlags &= (~F_REMOVED_ENTRY_INVISIBLE);
+ return;
+ }
+ if( !pStartEntry )
+ pStartEntry = pTree->First();
+ if( !pCursor )
+ SetCursor( pStartEntry, TRUE );
+
+ if( pCursor && (bSimpleTravel || !pView->GetSelectionCount() ))
+ pView->Select( pCursor, TRUE );
+
+ if( GetUpdateMode())
+ {
+ if( nFlags & F_REMOVED_RECALC_MOST_RIGHT )
+ FindMostRight(0);
+ aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+ FillView();
+ if( pStartEntry )
+ // falls ueber dem Thumb geloescht wurde
+ aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry) );
+
+ ShowVerSBar();
+ if( pCursor && pView->HasFocus() && !pView->IsSelected(pCursor) )
+ {
+ if( pView->GetSelectionCount() )
+ {
+ // ist ein benachbarter Eintrag selektiert?
+ SvLBoxEntry* pNextCursor = (SvLBoxEntry*)pView->PrevVisible( pCursor );
+ if( !pNextCursor || !pView->IsSelected( pNextCursor ))
+ pNextCursor = (SvLBoxEntry*)pView->NextVisible( pCursor );
+ if( !pNextCursor || !pView->IsSelected( pNextCursor ))
+ // kein Nachbar selektiert: Ersten selektierten nehmen
+ pNextCursor = pView->FirstSelected();
+ SetCursor( pNextCursor );
+ MakeVisible( pCursor );
+ }
+ else
+ pView->Select( pCursor, TRUE );
+ }
+ ShowCursor( TRUE );
+ }
+ nFlags &= (~F_REMOVED_RECALC_MOST_RIGHT);
+}
+
+
+void SvImpLBox::MovingEntry( SvLBoxEntry* pEntry )
+{
+ int bDeselAll = nFlags & F_DESEL_ALL;
+ SelAllDestrAnch( FALSE, TRUE ); // DeselectAll();
+ if( !bDeselAll )
+ nFlags &= (~F_DESEL_ALL);
+
+ if( pEntry == pCursor )
+ ShowCursor( FALSE );
+ if( IsEntryInView( pEntry ) )
+ pView->Invalidate();
+ if( pEntry == pStartEntry )
+ {
+ SvLBoxEntry* pNew = 0;
+ if( !pEntry->HasChilds() )
+ {
+ pNew = (SvLBoxEntry*)(pView->NextVisible( pStartEntry ));
+ if( !pNew )
+ pNew = (SvLBoxEntry*)(pView->PrevVisible( pStartEntry ));
+ }
+ else
+ {
+ pNew = pTree->NextSibling( pEntry );
+ if( !pNew )
+ pNew = pTree->PrevSibling( pEntry );
+ }
+ pStartEntry = pNew;
+ }
+}
+
+void SvImpLBox::EntryMoved( SvLBoxEntry* pEntry )
+{
+ aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+ USHORT nFirstPos = (USHORT)pTree->GetAbsPos( pStartEntry );
+ USHORT nNewPos = (USHORT)pTree->GetAbsPos( pEntry );
+ FindMostRight(0);
+ if( nNewPos < nFirstPos )
+ {
+ //!!!Notloesung
+ pStartEntry = pEntry;
+ SyncVerThumb();
+ }
+ if( pEntry == pCursor )
+ {
+ if( pView->IsEntryVisible( pCursor ) )
+ ShowCursor( TRUE );
+ else
+ {
+ SvLBoxEntry* pParent = pEntry;
+ do {
+ pParent = pTree->GetParent( pParent );
+ }
+ while( !pView->IsEntryVisible( pParent ) );
+ SetCursor( pParent );
+ }
+ }
+ if( IsEntryInView( pEntry ) )
+ pView->Invalidate();
+}
+
+
+
+void SvImpLBox::EntryInserted( SvLBoxEntry* pEntry )
+{
+ if( GetUpdateMode() )
+ {
+ SvLBoxEntry* pParent = (SvLBoxEntry*)pTree->GetParent(pEntry);
+ if( pParent && pTree->GetChildList(pParent)->Count() == 1 )
+ // Pluszeichen zeichnen
+ pTree->InvalidateEntry( pParent );
+
+ if( !pView->IsEntryVisible( pEntry ) )
+ return;
+ int bDeselAll = nFlags & F_DESEL_ALL;
+ if( bDeselAll )
+ SelAllDestrAnch( FALSE, TRUE );
+ else
+ DestroyAnchor();
+ // nFlags &= (~F_DESEL_ALL);
+// ShowCursor( FALSE ); // falls sich Cursor nach unten verschiebt
+ long nY = GetEntryLine( pEntry );
+ BOOL bEntryVisible = IsLineVisible( nY );
+ BOOL bPrevEntryVisible = IsLineVisible(nY-pView->GetEntryHeight());
+ if( bEntryVisible )
+ {
+ ShowCursor( FALSE ); // falls sich Cursor nach unten verschiebt
+ nY -= pView->GetEntryHeight(); // wg. Linien
+ InvalidateEntriesFrom( nY );
+ }
+ else if( pStartEntry && nY < GetEntryLine(pStartEntry) )
+ {
+ // pruefen, ob die View komplett gefuellt ist. Wenn
+ // nicht, dann pStartEntry und den Cursor anpassen
+ // (automatisches scrollen)
+ USHORT nLast = (USHORT)(pView->GetVisiblePos( (SvLBoxEntry*)(pView->LastVisible())));
+ USHORT nThumb = (USHORT)(pView->GetVisiblePos( pStartEntry ));
+ USHORT nCurDispEntries = nLast-nThumb+1;
+ if( nCurDispEntries < nVisibleCount )
+ {
+ // beim naechsten Paint-Event setzen
+ pStartEntry = 0;
+ SetCursor( 0 );
+ pView->Invalidate();
+ }
+ }
+ else if( !pStartEntry )
+ pView->Invalidate();
+
+ // die Linien invalidieren
+ /*
+ if( (bEntryVisible || bPrevEntryVisible) &&
+ (nWinBits & ( WB_HASLINES | WB_HASLINESATROOT )) )
+ {
+ SvLBoxTab* pTab = pView->GetFirstDynamicTab();
+ if( pTab )
+ {
+ long nDX = pView->GetTabPos( pEntry, pTab );
+ Point aTmpPoint;
+ Size aSize( nDX, nY );
+ Rectangle aRect( aTmpPoint, aSize );
+ pView->Invalidate( aRect );
+ }
+ }
+ */
+
+ SetMostRight( pEntry );
+ aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+ SyncVerThumb(); // falls vor Thumb eingefuegt wurde
+ ShowVerSBar();
+ ShowCursor( TRUE );
+//#if SUPD > 364
+ if( pStartEntry != pView->First() && (nFlags & F_FILLING) )
+ pView->Update();
+//#endif
+ }
+}
+
+
+
+// ********************************************************************
+// Eventhandler
+// ********************************************************************
+
+
+// ****** Steuerung der Controlanimation
+
+BOOL SvImpLBox::ButtonDownCheckCtrl(const MouseEvent& rMEvt, SvLBoxEntry* pEntry,
+ long nY )
+{
+ SvLBoxItem* pItem = pView->GetItem(pEntry,rMEvt.GetPosPixel().X(),&pActiveTab);
+ if( pItem && (pItem->IsA()==SV_ITEM_ID_LBOXBUTTON))
+ {
+ pActiveButton = (SvLBoxButton*)pItem;
+ pActiveEntry = pEntry;
+ if( pCursor == pActiveEntry )
+ pView->HideFocus();
+ pView->CaptureMouse();
+ pActiveButton->SetStateHilighted( TRUE );
+ pView->PaintEntry1( pActiveEntry, nY,
+ SV_LBOXTAB_PUSHABLE | SV_LBOXTAB_ADJUST_CENTER |
+ SV_LBOXTAB_ADJUST_RIGHT );
+ return TRUE;
+ }
+ else
+ pActiveButton = 0;
+ return FALSE;
+}
+
+BOOL SvImpLBox::MouseMoveCheckCtrl( const MouseEvent& rMEvt, SvLBoxEntry* pEntry)
+{
+ if( pActiveButton )
+ {
+ long nY;
+ long nMouseX = rMEvt.GetPosPixel().X();
+ if( pEntry == pActiveEntry &&
+ pView->GetItem(pActiveEntry, nMouseX) == pActiveButton )
+ {
+ if( !pActiveButton->IsStateHilighted() )
+ {
+ pActiveButton->SetStateHilighted(TRUE );
+ nY = GetEntryLine( pActiveEntry );
+ pView->PaintEntry1( pActiveEntry, nY,
+ SV_LBOXTAB_PUSHABLE | SV_LBOXTAB_ADJUST_CENTER |
+ SV_LBOXTAB_ADJUST_RIGHT );
+ }
+ }
+ else
+ {
+ if( pActiveButton->IsStateHilighted() )
+ {
+ pActiveButton->SetStateHilighted(FALSE );
+ nY = GetEntryLine( pActiveEntry );
+ pView->PaintEntry1( pActiveEntry, nY, SV_LBOXTAB_PUSHABLE );
+ }
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL SvImpLBox::ButtonUpCheckCtrl( const MouseEvent& rMEvt )
+{
+ if( pActiveButton )
+ {
+ pView->ReleaseMouse();
+ SvLBoxEntry* pEntry = GetClickedEntry( rMEvt.GetPosPixel() );
+ long nY = GetEntryLine( pActiveEntry );
+ pActiveButton->SetStateHilighted( FALSE );
+ long nMouseX = rMEvt.GetPosPixel().X();
+ if( pEntry == pActiveEntry &&
+ pView->GetItem( pActiveEntry, nMouseX ) == pActiveButton )
+ pActiveButton->ClickHdl( pView, pActiveEntry );
+ pView->PaintEntry1( pActiveEntry, nY,
+ SV_LBOXTAB_PUSHABLE | SV_LBOXTAB_ADJUST_CENTER |
+ SV_LBOXTAB_ADJUST_RIGHT );
+ if( pCursor == pActiveEntry )
+ ShowCursor( TRUE );
+ pActiveButton = 0;
+ pActiveEntry = 0;
+ pActiveTab = 0;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+// ******* Steuerung Plus/Minus-Button zum Expandieren/Kollabieren
+
+// FALSE == kein Expand/Collapse-Button getroffen
+BOOL SvImpLBox::IsNodeButton( const Point& rPosPixel, SvLBoxEntry* pEntry ) const
+{
+ if( !pEntry->HasChilds() && !pEntry->HasChildsOnDemand() )
+ return FALSE;
+
+ SvLBoxTab* pFirstDynamicTab = pView->GetFirstDynamicTab();
+ if( !pFirstDynamicTab )
+ return FALSE;
+
+ long nMouseX = rPosPixel.X();
+ // in Doc-Koords umrechnen
+ Point aOrigin( pView->GetMapMode().GetOrigin() );
+ nMouseX -= aOrigin.X();
+
+ long nX = pView->GetTabPos( pEntry, pFirstDynamicTab);
+ nX += nNodeBmpTabDistance;
+ if( nMouseX < nX )
+ return FALSE;
+ nX += nNodeBmpWidth;
+ if( nMouseX > nX )
+ return FALSE;
+ return TRUE;
+}
+
+// FALSE == kein Expand/Collapse-Button getroffen
+BOOL SvImpLBox::ButtonDownCheckExpand( const MouseEvent& rMEvt,
+ SvLBoxEntry* pEntry, long /* nY */ )
+{
+ // beim Inplace-Ed. gunnix machen
+ if( pView->IsEditingActive() && pEntry == pView->pEdEntry )
+ return TRUE;
+
+ if( IsNodeButton( rMEvt.GetPosPixel(), pEntry ) )
+ {
+ if( rMEvt.GetClicks() == 1 )
+ {
+ if( pView->IsExpanded(pEntry) )
+ {
+ pView->EndEditing( TRUE );
+ pView->Collapse( pEntry );
+ }
+ else
+ {
+ //einen Entry, der editiert wird, darf man aufklappen
+ pView->Expand( pEntry );
+ }
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( !rMEvt.IsLeft() && !rMEvt.IsRight())
+ return;
+
+#ifdef OS2
+ // unter OS/2 kommt zwischen MouseButtonDown und
+ // MouseButtonUp ein MouseMove
+ nFlags |= F_IGNORE_NEXT_MOUSEMOVE;
+#endif
+ aEditTimer.Stop();
+ Point aPos( rMEvt.GetPosPixel());
+
+ if( aPos.X() > aOutputSize.Width() || aPos.Y() > aOutputSize.Height() )
+ return;
+
+ nFlags &= (~F_FILLING);
+ pView->GrabFocus();
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ if( !pEntry )
+ return;
+
+ long nY = GetEntryLine( pEntry );
+ // Node-Button?
+ if( ButtonDownCheckExpand( rMEvt, pEntry, nY ) )
+ return;
+
+ if( !EntryReallyHit(pEntry,aPos,nY))
+ return;
+
+//#if defined(MAC) || defined(OV_DEBUG)
+ SvLBoxItem* pXItem = pView->GetItem( pEntry, aPos.X() );
+ if( pXItem )
+ {
+ SvLBoxTab* pXTab = pView->GetTab( pEntry, pXItem );
+ if( !rMEvt.IsMod1() && !rMEvt.IsMod2() &&pXTab->IsEditable() )
+ nFlags |= F_START_EDITTIMER;
+#ifndef MAC
+ if( !pView->IsSelected( pEntry ))
+ nFlags &= ~F_START_EDITTIMER;
+#endif
+ }
+//#endif
+
+
+ if( (rMEvt.GetClicks() % 2) == 0 )
+ {
+//#ifdef MAC
+ nFlags &= (~F_START_EDITTIMER);
+//#endif
+ pView->pHdlEntry = pEntry;
+ if( pView->DoubleClickHdl() )
+ {
+ // falls im Handler der Eintrag geloescht wurde
+ pEntry = GetClickedEntry( aPos );
+ if( !pEntry )
+ return;
+ if( pEntry != pView->pHdlEntry )
+ {
+ // neu selektieren & tschuess
+ if( !bSimpleTravel && !aSelEng.IsAlwaysAdding())
+ SelAllDestrAnch( FALSE, TRUE ); // DeselectAll();
+ SetCursor( pEntry );
+ return;
+ }
+ if( pEntry->HasChilds() || pEntry->HasChildsOnDemand() )
+ {
+ if( pView->IsExpanded(pEntry) )
+ pView->Collapse( pEntry );
+ else
+ pView->Expand( pEntry );
+ if( pEntry == pCursor ) // nur wenn Entryitem angeklickt wurde
+ // (Nodebutton ist kein Entryitem!)
+ pView->Select( pCursor, TRUE );
+ return;
+ }
+ }
+ }
+ else
+ {
+ // CheckButton? (TreeListBox: Check + Info)
+ if( ButtonDownCheckCtrl(rMEvt, pEntry, nY) == TRUE)
+ return;
+ // Inplace-Editing?
+//#ifndef MAC
+#if 0
+ if( rMEvt.IsMod2() && pView->IsInplaceEditingEnabled() )
+ {
+ SvLBoxItem* pItem = pView->GetItem( pEntry, aPos.X() );
+ if( pItem )
+ pView->EditingRequest( pEntry, pItem, aPos );
+ return;
+ }
+#endif
+ }
+ aSelEng.SelMouseButtonDown( rMEvt );
+}
+
+void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt)
+{
+#ifdef OS2
+ nFlags &= (~F_IGNORE_NEXT_MOUSEMOVE);
+#endif
+ if(!ButtonUpCheckCtrl( rMEvt ) )
+ aSelEng.SelMouseButtonUp( rMEvt );
+ EndScroll();
+//#if defined(MAC) || defined(OV_DEBUG)
+ if( nFlags & F_START_EDITTIMER )
+ {
+ nFlags &= (~F_START_EDITTIMER);
+ aEditTimer.Start();
+ }
+//#endif
+
+ return;
+}
+
+void SvImpLBox::MouseMove( const MouseEvent& rMEvt)
+{
+#ifdef OS2
+ if( nFlags & F_IGNORE_NEXT_MOUSEMOVE )
+ {
+ nFlags &= (~F_IGNORE_NEXT_MOUSEMOVE);
+ return;
+ }
+#endif
+ SvLBoxEntry* pEntry = GetClickedEntry( rMEvt.GetPosPixel() );
+ if(!MouseMoveCheckCtrl( rMEvt, pEntry ) )
+ aSelEng.SelMouseMove( rMEvt );
+ return;
+}
+
+BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt)
+{
+//#if defined(MAC) || defined(OV_DEBUG)
+ aEditTimer.Stop();
+//#endif
+
+ if( rKEvt.GetKeyCode().IsMod2() )
+ return FALSE; // Alt-Taste nicht auswerten
+
+ nFlags &= (~F_FILLING);
+
+ if( !pCursor )
+ pCursor = pStartEntry;
+ if( !pCursor )
+ return FALSE;
+
+ BOOL bKeyUsed = TRUE;
+
+ USHORT nDelta = (USHORT)aVerSBar.GetPageSize();
+ USHORT aCode = rKEvt.GetKeyCode().GetCode();
+
+ BOOL bShift = rKEvt.GetKeyCode().IsShift();
+ BOOL bMod1 = rKEvt.GetKeyCode().IsMod1();
+
+ SvLBoxEntry* pNewCursor;
+ long nThumb;
+
+ switch( aCode )
+ {
+ case KEY_UP:
+ if( !IsEntryInView( pCursor ) )
+ MakeVisible( pCursor );
+ pNewCursor = (SvLBoxEntry*)(pView->PrevVisible( pCursor ));
+ if( pNewCursor )
+ {
+ aSelEng.CursorPosChanging( bShift, bMod1 );
+ if( IsEntryInView( pNewCursor ) )
+ SetCursor( pNewCursor );
+ else
+ {
+ SetCursor( pNewCursor );
+ KeyUp( FALSE );
+ }
+ }
+ break;
+
+ case KEY_DOWN:
+ if( !IsEntryInView( pCursor ) )
+ MakeVisible( pCursor );
+ pNewCursor = (SvLBoxEntry*)(pView->NextVisible( pCursor ));
+ if( pNewCursor )
+ {
+ aSelEng.CursorPosChanging( bShift, bMod1 );
+ if( IsEntryInView( pNewCursor ) )
+ SetCursor( pNewCursor );
+ else
+ {
+ if( pCursor )
+ pView->Select( pCursor, FALSE );
+ KeyDown( FALSE );
+ SetCursor( pNewCursor );
+ }
+ }
+ else
+ KeyDown( FALSE ); // weil ScrollBar-Range evtl. noch
+ // scrollen erlaubt
+ break;
+
+ case KEY_RIGHT:
+ if( pView->nWindowStyle & WB_HSCROLL )
+ {
+ nThumb = aHorSBar.GetThumbPos();
+ nThumb += aHorSBar.GetLineSize();
+ long nOldThumb = aHorSBar.GetThumbPos();
+ aHorSBar.SetThumbPos( nThumb );
+ nThumb = nOldThumb;
+ nThumb -= aHorSBar.GetThumbPos();
+ nThumb *= -1;
+ if( nThumb )
+ {
+ KeyLeftRight( nThumb );
+ EndScroll();
+ }
+ }
+ else
+ bKeyUsed = FALSE;
+ break;
+
+ case KEY_LEFT:
+ if( pView->nWindowStyle & WB_HSCROLL )
+ {
+ nThumb = aHorSBar.GetThumbPos();
+ nThumb -= aHorSBar.GetLineSize();
+ long nOldThumb = aHorSBar.GetThumbPos();
+ aHorSBar.SetThumbPos( nThumb );
+ nThumb = nOldThumb;
+ nThumb -= aHorSBar.GetThumbPos();
+ if( nThumb )
+ {
+ KeyLeftRight( -nThumb );
+ EndScroll();
+ }
+ }
+ else
+ bKeyUsed = FALSE;
+ break;
+
+ case KEY_PAGEUP:
+ if( !bMod1 )
+ {
+ pNewCursor = (SvLBoxEntry*)(pView->PrevVisible( pCursor, nDelta ));
+ if( nDelta )
+ {
+ DBG_ASSERT(pNewCursor&&(ULONG)pNewCursor!=(ULONG)pCursor,"Cursor?")
+ aSelEng.CursorPosChanging( bShift, bMod1 );
+ if( IsEntryInView( pNewCursor ) )
+ SetCursor( pNewCursor );
+ else
+ {
+ SetCursor( pNewCursor );
+ KeyUp( TRUE );
+ }
+ }
+ }
+ else
+ bKeyUsed = FALSE;
+ break;
+
+ case KEY_PAGEDOWN:
+ if( !bMod1 )
+ {
+ pNewCursor= (SvLBoxEntry*)(pView->NextVisible( pCursor, nDelta ));
+ if( nDelta )
+ {
+ DBG_ASSERT(pNewCursor&&(ULONG)pNewCursor!=(ULONG)pCursor,"Cursor?")
+ aSelEng.CursorPosChanging( bShift, bMod1 );
+ if( IsEntryInView( pNewCursor ) )
+ SetCursor( pNewCursor );
+ else
+ {
+ SetCursor( pNewCursor );
+ KeyDown( TRUE );
+ }
+ }
+ else
+ KeyDown( FALSE ); // siehe KEY_DOWN
+ }
+ else
+ bKeyUsed = FALSE;
+ break;
+
+ case KEY_SPACE:
+ if( pView->GetSelectionMode() >= MULTIPLE_SELECTION )
+ {
+ if( !bShift && !bMod1 )
+ {
+ if( aSelEng.IsAddMode() )
+ {
+ // toggle selection
+ BOOL bSel = TRUE;
+ if( pView->IsSelected( pCursor ))
+ bSel = FALSE;
+ pView->Select( pCursor, bSel );
+ }
+ else
+ {
+ SelAllDestrAnch( FALSE );
+ pView->Select( pCursor, TRUE );
+ }
+ }
+ }
+ break;
+
+#if 0
+ // Probleme mit Default-OK-Button!
+ case KEY_RETURN:
+ if( pCursor->HasChilds() || pCursor->HasChildsOnDemand() )
+ {
+ if( pView->IsExpanded(pCursor) )
+ pView->Collapse( pCursor );
+ else
+ pView->Expand( pCursor );
+ }
+#endif
+
+ case KEY_F2:
+ if( !bShift && !bMod1 )
+ EditTimerCall( 0 );
+ break;
+
+ case KEY_F8:
+ if( bShift && pView->GetSelectionMode()==MULTIPLE_SELECTION &&
+ !(nWinBits & WB_SIMPLEMODE))
+ {
+ if( aSelEng.IsAlwaysAdding() )
+ aSelEng.AddAlways( FALSE );
+ else
+ aSelEng.AddAlways( TRUE );
+ }
+ break;
+
+
+#ifdef OV_DEBUG
+ case KEY_F9:
+ MakeVisible( pCursor );
+ break;
+ case KEY_F10:
+ pView->RemoveSelection();
+ break;
+ case KEY_DELETE:
+ pView->RemoveEntry( pCursor );
+ break;
+#endif
+
+ case KEY_ADD:
+ if( pCursor )
+ {
+ if( !pView->IsExpanded(pCursor))
+ pView->Expand( pCursor );
+ if( bMod1 )
+ {
+ USHORT nRefDepth = pTree->GetDepth( pCursor );
+ SvLBoxEntry* pCur = pTree->Next( pCursor );
+ while( pCur && pTree->GetDepth(pCur) > nRefDepth )
+ {
+ if( pCur->HasChilds() && !pView->IsExpanded(pCur))
+ pView->Expand( pCur );
+ pCur = pTree->Next( pCur );
+ }
+ }
+ }
+ break;
+
+ case KEY_A:
+ if( bMod1 )
+ SelAllDestrAnch( TRUE );
+ break;
+
+ case KEY_SUBTRACT:
+ if( pCursor )
+ {
+ if( pView->IsExpanded(pCursor))
+ pView->Collapse( pCursor );
+ if( bMod1 )
+ {
+ // bis zur Root alle Parents einklappen
+ SvLBoxEntry* pParentToCollapse = (SvLBoxEntry*)pTree->GetRootLevelParent(pCursor);
+ if( pParentToCollapse )
+ {
+ USHORT nRefDepth;
+ // Sonderbehandlung Explorer: Befindet sich auf der
+ // Root nur ein Eintrag,dann den Root-Entry nicht
+ // einklappen
+ if( pTree->GetChildList(0)->Count() < 2 )
+ {
+ nRefDepth = 1;
+ pParentToCollapse = pCursor;
+ while( pTree->GetParent(pParentToCollapse) &&
+ pTree->GetDepth( pTree->GetParent(pParentToCollapse)) > 0)
+ {
+ pParentToCollapse = pTree->GetParent(pParentToCollapse);
+ }
+ }
+ else
+ nRefDepth = 0;
+
+ if( pView->IsExpanded(pParentToCollapse) )
+ pView->Collapse( pParentToCollapse );
+ SvLBoxEntry* pCur = pTree->Next( pParentToCollapse );
+ while( pCur && pTree->GetDepth(pCur) > nRefDepth )
+ {
+ if( pCur->HasChilds() && pView->IsExpanded(pCur) )
+ pView->Collapse( pCur );
+ pCur = pTree->Next( pCur );
+ }
+ }
+ }
+ }
+ break;
+
+ case KEY_DIVIDE :
+ if( bMod1 )
+ SelAllDestrAnch( TRUE );
+ break;
+
+ case KEY_COMMA :
+ if( bMod1 )
+ SelAllDestrAnch( FALSE );
+ break;
+
+ case KEY_HOME :
+ pNewCursor = pView->GetModel()->First();
+ if( pNewCursor && pNewCursor != pCursor )
+ {
+// SelAllDestrAnch( FALSE );
+ aSelEng.CursorPosChanging( bShift, bMod1 );
+ SetCursor( pNewCursor );
+ if( !IsEntryInView( pNewCursor ) )
+ MakeVisible( pNewCursor );
+ }
+ break;
+
+ case KEY_END :
+ pNewCursor = pView->GetModel()->Last();
+ if( pNewCursor && pNewCursor != pCursor)
+ {
+// SelAllDestrAnch( FALSE );
+ aSelEng.CursorPosChanging( bShift, bMod1 );
+ SetCursor( pNewCursor );
+ if( !IsEntryInView( pNewCursor ) )
+ MakeVisible( pNewCursor );
+ }
+ break;
+
+
+
+ default:
+ bKeyUsed = FALSE;
+ }
+ return bKeyUsed;
+}
+
+void __EXPORT SvImpLBox::GetFocus()
+{
+ if( pCursor )
+ {
+ pView->SetEntryFocus( pCursor, TRUE );
+ ShowCursor( TRUE );
+// auskommentiert wg. deselectall
+// if( bSimpleTravel && !pView->IsSelected(pCursor) )
+// pView->Select( pCursor, TRUE );
+ }
+ if( nWinBits & WB_HIDESELECTION )
+ {
+ SvLBoxEntry* pEntry = pView->FirstSelected();
+ while( pEntry )
+ {
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ InvalidateEntry( pEntry );
+ pEntry = pView->NextSelected( pEntry );
+ }
+ /*
+ SvLBoxEntry* pEntry = pView->GetModel()->First();
+ while( pEntry )
+ {
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ if( pViewData->IsCursored() )
+ {
+ pViewData->SetCursored( FALSE );
+ InvalidateEntry( pEntry );
+ }
+ pEntry = pView->GetModel()->Next( pEntry );
+ }
+ */
+
+
+ }
+}
+
+void __EXPORT SvImpLBox::LoseFocus()
+{
+//#if defined(MAC) || defined(OV_DEBUG)
+ aEditTimer.Stop();
+//#endif
+ if( pCursor )
+ pView->SetEntryFocus( pCursor,FALSE );
+ ShowCursor( FALSE );
+
+ if( nWinBits & WB_HIDESELECTION )
+ {
+ SvLBoxEntry* pEntry = pView->FirstSelected();
+ while( pEntry )
+ {
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ //pViewData->SetCursored( TRUE );
+ InvalidateEntry( pEntry );
+ pEntry = pView->NextSelected( pEntry );
+ }
+ }
+}
+
+
+// ********************************************************************
+// SelectionEngine
+// ********************************************************************
+
+inline void SvImpLBox::SelectEntry( SvLBoxEntry* pEntry, BOOL bSelect )
+{
+ pView->Select( pEntry, bSelect );
+}
+
+__EXPORT ImpLBSelEng::ImpLBSelEng( SvImpLBox* pImpl, SelectionEngine* pSEng,
+ SvTreeListBox* pV )
+{
+ pImp = pImpl;
+ pSelEng = pSEng;
+ pView = pV;
+}
+
+__EXPORT ImpLBSelEng::~ImpLBSelEng()
+{
+}
+
+void __EXPORT ImpLBSelEng::BeginDrag()
+{
+ pImp->BeginDrag();
+}
+
+/*
+void __EXPORT ImpLBSelEng::EndDrag( const Point& )
+{
+}
+*/
+
+void __EXPORT ImpLBSelEng::CreateAnchor()
+{
+ pImp->pAnchor = pImp->pCursor;
+}
+
+void __EXPORT ImpLBSelEng::DestroyAnchor()
+{
+ pImp->pAnchor = 0;
+}
+
+/*
+void __EXPORT ImpLBSelEng::CreateCursor()
+{
+ pImp->pAnchor = 0;
+}
+*/
+
+
+BOOL __EXPORT ImpLBSelEng::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor)
+{
+ SvLBoxEntry* pNewCursor = pImp->MakePointVisible( rPoint );
+ if( pNewCursor != pImp->pCursor )
+ pImp->BeginScroll();
+
+ if( pNewCursor )
+ {
+ // bei SimpleTravel wird in SetCursor selektiert und
+ // der Select-Handler gerufen
+ //if( !bDontSelectAtCursor && !pImp->bSimpleTravel )
+ // pImp->SelectEntry( pNewCursor, TRUE );
+ pImp->SetCursor( pNewCursor, bDontSelectAtCursor );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL __EXPORT ImpLBSelEng::IsSelectionAtPoint( const Point& rPoint )
+{
+ SvLBoxEntry* pEntry = pImp->MakePointVisible( rPoint );
+ if( pEntry )
+ return pView->IsSelected(pEntry);
+ return FALSE;
+}
+
+void __EXPORT ImpLBSelEng::DeselectAtPoint( const Point& rPoint )
+{
+ SvLBoxEntry* pEntry = pImp->MakePointVisible( rPoint );
+ if( !pEntry )
+ return;
+ pImp->SelectEntry( pEntry, FALSE );
+}
+
+/*
+void __EXPORT ImpLBSelEng::SelectAtPoint( const Point& rPoint )
+{
+ SvLBoxEntry* pEntry = pImp->MakePointVisible( rPoint );
+ if( !pEntry )
+ return;
+ pImp->SelectEntry( pEntry, TRUE );
+}
+*/
+
+void __EXPORT ImpLBSelEng::DeselectAll()
+{
+ pImp->SelAllDestrAnch( FALSE, FALSE ); // SelectionEngine nicht resetten!
+ pImp->nFlags &= (~F_DESEL_ALL);
+}
+
+// ***********************************************************************
+// Selektion
+// ***********************************************************************
+
+void SvImpLBox::SetAnchorSelection(SvLBoxEntry* pOldCursor,SvLBoxEntry* pNewCursor)
+{
+ SvLBoxEntry* pEntry;
+ ULONG nAnchorVisPos = pView->GetVisiblePos( pAnchor );
+ ULONG nOldVisPos = pView->GetVisiblePos( pOldCursor );
+ ULONG nNewVisPos = pView->GetVisiblePos( pNewCursor );
+
+ if( nOldVisPos > nAnchorVisPos ||
+ ( nAnchorVisPos==nOldVisPos && nNewVisPos > nAnchorVisPos) )
+ {
+ if( nNewVisPos > nOldVisPos )
+ {
+ pEntry = pOldCursor;
+ while( pEntry && pEntry != pNewCursor )
+ {
+ pView->Select( pEntry, TRUE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( pEntry )
+ pView->Select( pEntry, TRUE );
+ return;
+ }
+
+ if( nNewVisPos < nAnchorVisPos )
+ {
+ pEntry = pAnchor;
+ while( pEntry && pEntry != pOldCursor )
+ {
+ pView->Select( pEntry, FALSE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( pEntry )
+ pView->Select( pEntry, FALSE );
+
+ pEntry = pNewCursor;
+ while( pEntry && pEntry != pAnchor )
+ {
+ pView->Select( pEntry, TRUE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( pEntry )
+ pView->Select( pEntry, TRUE );
+ return;
+ }
+
+ if( nNewVisPos < nOldVisPos )
+ {
+ pEntry = pNewCursor;
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ while( pEntry && pEntry != pOldCursor )
+ {
+ pView->Select( pEntry, FALSE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( pEntry )
+ pView->Select( pEntry, FALSE );
+ return;
+ }
+ }
+ else
+ {
+ if( nNewVisPos < nOldVisPos ) // Vergroessern der Selektion
+ {
+ pEntry = pNewCursor;
+ while( pEntry && pEntry != pOldCursor )
+ {
+ pView->Select( pEntry, TRUE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( pEntry )
+ pView->Select( pEntry, TRUE );
+ return;
+ }
+
+ if( nNewVisPos > nAnchorVisPos )
+ {
+ pEntry = pOldCursor;
+ while( pEntry && pEntry != pAnchor )
+ {
+ pView->Select( pEntry, FALSE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( pEntry )
+ pView->Select( pEntry, FALSE );
+ pEntry = pAnchor;
+ while( pEntry && pEntry != pNewCursor )
+ {
+ pView->Select( pEntry, TRUE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ if( pEntry )
+ pView->Select( pEntry, TRUE );
+ return;
+ }
+
+ if( nNewVisPos > nOldVisPos )
+ {
+ pEntry = pOldCursor;
+ while( pEntry && pEntry != pNewCursor )
+ {
+ pView->Select( pEntry, FALSE );
+ pEntry = (SvLBoxEntry*)(pView->NextVisible( pEntry ));
+ }
+ return;
+ }
+ }
+}
+
+void SvImpLBox::SelAllDestrAnch( BOOL bSelect, BOOL bDestroyAnchor,
+ BOOL bSingleSelToo )
+{
+ SvLBoxEntry* pEntry;
+ nFlags &= (~F_DESEL_ALL);
+ if( bSelect && bSimpleTravel )
+ {
+ if( pCursor && !pView->IsSelected( pCursor ))
+ {
+ pView->Select( pCursor, TRUE );
+ }
+ return;
+ }
+ if( !bSelect && pView->GetSelectionCount() == 0 )
+ {
+ if( bSimpleTravel && ( !GetUpdateMode() || !pCursor) )
+ nFlags |= F_DESEL_ALL;
+ return;
+ }
+ if( bSelect && pView->GetSelectionCount() == pView->GetEntryCount())
+ return;
+ if( !bSingleSelToo && bSimpleTravel )
+ return;
+
+ if( !bSelect && pView->GetSelectionCount()==1 && pCursor &&
+ pView->IsSelected( pCursor ))
+ {
+ pView->Select( pCursor, FALSE );
+ if( bDestroyAnchor )
+ DestroyAnchor(); // Anker loeschen & SelectionEngine zuruecksetzen
+ else
+ pAnchor = 0; // internen Anker immer loeschen
+ return;
+ }
+
+ if( bSimpleTravel && !pCursor && !GetUpdateMode() )
+ nFlags |= F_DESEL_ALL;
+
+ ShowCursor( FALSE );
+ BOOL bUpdate = GetUpdateMode();
+
+ nFlags |= F_IGNORE_SELECT; // EntryInserted soll nix tun
+ pEntry = pTree->First();
+ while( pEntry )
+ {
+ if( pView->Select( pEntry, bSelect ) )
+ {
+ if( bUpdate && pView->IsEntryVisible(pEntry) )
+ {
+ long nY = GetEntryLine( pEntry );
+ if( IsLineVisible( nY ) )
+ pView->PaintEntry1( pEntry, nY, 0xffff ); // wg. ItemsetBrowser SV_LBOXTAB_SHOW_SELECTION );
+ }
+ }
+ pEntry = pTree->Next( pEntry );
+ }
+ nFlags &= ~F_IGNORE_SELECT;
+
+ if( bDestroyAnchor )
+ DestroyAnchor(); // Anker loeschen & SelectionEngine zuruecksetzen
+ else
+ pAnchor = 0; // internen Anker immer loeschen
+ ShowCursor( TRUE );
+}
+
+void SvImpLBox::SetSelectionMode( SelectionMode eSelMode )
+{
+ aSelEng.SetSelectionMode( eSelMode);
+ if( eSelMode == SINGLE_SELECTION )
+ bSimpleTravel = TRUE;
+ else
+ bSimpleTravel = FALSE;
+ if( (nWinBits & WB_SIMPLEMODE) && (eSelMode == MULTIPLE_SELECTION) )
+ aSelEng.AddAlways( TRUE );
+}
+
+// ***********************************************************************
+// Drag & Drop
+// ***********************************************************************
+
+void SvImpLBox::SetDragDropMode( DragDropMode eDDMode )
+{
+ if( eDDMode && eDDMode != SV_DRAGDROP_APP_DROP )
+ {
+ aSelEng.ExpandSelectionOnMouseMove( FALSE );
+ aSelEng.EnableDrag( TRUE );
+ }
+ else
+ {
+ aSelEng.ExpandSelectionOnMouseMove( TRUE );
+ aSelEng.EnableDrag( FALSE );
+ }
+}
+
+void SvImpLBox::BeginDrag()
+{
+ nFlags &= (~F_FILLING);
+ if( !bAsyncBeginDrag )
+ {
+ BeginScroll();
+ pView->BeginDrag( aSelEng.GetMousePosPixel() );
+ EndScroll();
+ }
+ else
+ {
+ aAsyncBeginDragPos = aSelEng.GetMousePosPixel();
+ aAsyncBeginDragTimer.Start();
+ }
+}
+
+IMPL_LINK( SvImpLBox, BeginDragHdl, void*, EMPTYARG )
+{
+ pView->BeginDrag( aAsyncBeginDragPos );
+ return 0;
+}
+
+void SvImpLBox::PaintDDCursor( SvLBoxEntry* pInsertionPos )
+{
+ long nY;
+ if( pInsertionPos )
+ {
+ nY = GetEntryLine( pInsertionPos );
+ nY += pView->GetEntryHeight();
+ }
+ else
+ nY = 1;
+ RasterOp eOldOp = pView->GetRasterOp();
+ pView->SetRasterOp( ROP_INVERT );
+ Color aOldLineColor = pView->GetLineColor();
+ pView->SetLineColor( Color( COL_BLACK ) );
+ pView->DrawLine( Point( 0, nY ), Point( aOutputSize.Width(), nY ) );
+ pView->SetLineColor( aOldLineColor );
+ pView->SetRasterOp( eOldOp );
+}
+
+void SvImpLBox::Command( const CommandEvent& rCEvt )
+{
+ // Rollmaus-Event?
+ if( (rCEvt.GetCommand() == COMMAND_WHEEL) ||
+ (rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
+ (rCEvt.GetCommand() == COMMAND_AUTOSCROLL) )
+ {
+ if( pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) )
+ return;
+ }
+#ifndef NOCOMMAND
+ const Point& rPos = rCEvt.GetMousePosPixel();
+ if( rPos.X() < aOutputSize.Width() && rPos.Y() < aOutputSize.Height() )
+ aSelEng.Command( rCEvt );
+#endif
+}
+
+void SvImpLBox::BeginScroll()
+{
+ if( !(nFlags & F_IN_SCROLLING))
+ {
+ pView->NotifyBeginScroll();
+ nFlags |= F_IN_SCROLLING;
+ }
+}
+
+void SvImpLBox::EndScroll()
+{
+ if( nFlags & F_IN_SCROLLING)
+ {
+ pView->NotifyEndScroll();
+ nFlags &= (~F_IN_SCROLLING);
+ }
+}
+
+
+Rectangle SvImpLBox::GetVisibleArea() const
+{
+ Point aPos( pView->GetMapMode().GetOrigin() );
+ aPos.X() *= -1;
+ Rectangle aRect( aPos, aOutputSize );
+ return aRect;
+}
+
+void SvImpLBox::Invalidate()
+{
+ pView->SetClipRegion();
+}
+
+void SvImpLBox::SetCurEntry( SvLBoxEntry* pEntry )
+{
+ if( aSelEng.GetSelectionMode() != SINGLE_SELECTION )
+ SelAllDestrAnch( FALSE, TRUE, FALSE );
+ MakeVisible( pEntry );
+ SetCursor( pEntry );
+// if( bSimpleTravel )
+ pView->Select( pEntry, TRUE );
+}
+
+//#if defined(MAC) || defined(OV_DEBUG)
+IMPL_LINK( SvImpLBox, EditTimerCall, Timer *, pTimer )
+{
+ if( pView->IsInplaceEditingEnabled() )
+ {
+ SvLBoxEntry* pEntry = GetCurEntry();
+ if( pEntry )
+ {
+ ShowCursor( FALSE );
+ pView->EditEntry( pEntry );
+ ShowCursor( TRUE );
+ }
+ }
+ return 0;
+}
+//#endif
+
+
+BOOL SvImpLBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ if( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ Point aPos( pView->ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ if( !GetVisibleArea().IsInside( aPos ))
+ return FALSE;
+
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ if( pEntry )
+ {
+ // Rechteck des Textes berechnen
+ SvLBoxTab* pTab;
+ SvLBoxString* pItem = (SvLBoxString*)(pView->GetItem( pEntry, aPos.X(), &pTab ));
+ if( !pItem || pItem->IsA() != SV_ITEM_ID_LBOXSTRING )
+ return FALSE;
+
+ aPos = GetEntryPos( pEntry );
+ aPos.X() = pView->GetTabPos( pEntry, pTab ); //pTab->GetPos();
+ Size aSize( pItem->GetSize( pView, pEntry ) );
+ SvLBoxTab* pNextTab = NextTab( pTab );
+ BOOL bItemClipped = FALSE;
+ // wurde das Item von seinem rechten Nachbarn abgeschnitten?
+ if( pNextTab && pView->GetTabPos(pEntry,pNextTab) < aPos.X()+aSize.Width() )
+ {
+ aSize.Width() = pNextTab->GetPos() - pTab->GetPos();
+ bItemClipped = TRUE;
+ }
+ Rectangle aItemRect( aPos, aSize );
+
+ Rectangle aViewRect( GetVisibleArea() );
+
+ if( bItemClipped || !aViewRect.IsInside( aItemRect ) )
+ {
+ // rechten Item-Rand am View-Rand clippen
+ //if( aItemRect.Right() > aViewRect.Right() )
+ // aItemRect.Right() = aViewRect.Right();
+
+ Point aPt = pView->OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = pView->OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+
+ Help::ShowQuickHelp( pView, aItemRect,
+ pItem->GetText(), QUICKHELP_LEFT | QUICKHELP_VCENTER );
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+SvLBoxTab* SvImpLBox::NextTab( SvLBoxTab* pTab )
+{
+ USHORT nTabCount = pView->TabCount();
+ if( nTabCount <= 1 )
+ return 0;
+ for( USHORT nTab=0; nTab < (nTabCount-1); nTab++)
+ {
+ if( pView->aTabs[nTab]==pTab )
+ return (SvLBoxTab*)(pView->aTabs[nTab+1]);
+ }
+ return 0;
+}
+
+void SvImpLBox::EndSelection()
+{
+ DestroyAnchor();
+ nFlags &= ~F_START_EDITTIMER;
+}
+
+void SvImpLBox::RepaintScrollBars()
+{
+#ifndef VCL
+ aHorSBar.Invalidate();
+ aHorSBar.Update();
+ aVerSBar.Invalidate();
+ aVerSBar.Update();
+#endif
+}
+
+void SvImpLBox::SetUpdateMode( BOOL bMode )
+{
+ if( bUpdateMode != bMode )
+ {
+ bUpdateMode = bMode;
+ if( bUpdateMode )
+ UpdateAll( FALSE );
+ }
+}
+
+void SvImpLBox::SetUpdateModeFast( BOOL bMode )
+{
+ if( bUpdateMode != bMode )
+ {
+ bUpdateMode = bMode;
+ if( bUpdateMode )
+ UpdateAll( FALSE, FALSE );
+ }
+}
+
+
+BOOL SvImpLBox::SetMostRight( SvLBoxEntry* pEntry )
+{
+ if( pView->nTreeFlags & TREEFLAG_RECALCTABS )
+ {
+ nFlags |= F_IGNORE_CHANGED_TABS;
+ pView->SetTabs();
+ nFlags &= ~F_IGNORE_CHANGED_TABS;
+ }
+
+ USHORT nLastTab = pView->aTabs.Count() - 1;
+ USHORT nLastItem = pEntry->ItemCount() - 1;
+ if( nLastTab != USHRT_MAX && nLastItem != USHRT_MAX )
+ {
+ if( nLastItem < nLastTab )
+ nLastTab = nLastItem;
+
+ SvLBoxTab* pTab = (SvLBoxTab*)pView->aTabs[ nLastTab ];
+ SvLBoxItem* pItem = pEntry->GetItem( nLastTab );
+
+ long nTabPos = pView->GetTabPos( pEntry, pTab );
+
+ long nMaxRight = GetOutputSize().Width();
+ Point aPos( pView->GetMapMode().GetOrigin() );
+ aPos.X() *= -1; // Umrechnung Dokumentkoord.
+ nMaxRight = nMaxRight + aPos.X() - 1;
+
+ long nNextTab = nTabPos < nMaxRight ? nMaxRight : nMaxRight + 50;
+ long nTabWidth = nNextTab - nTabPos + 1;
+ long nItemSize = pItem->GetSize(pView,pEntry).Width();
+ long nOffset = pTab->CalcOffset( nItemSize, nTabWidth );
+
+ long nRight = nTabPos + nOffset + nItemSize;
+ if( nRight > nMostRight )
+ {
+ nMostRight = nRight;
+ pMostRightEntry = pEntry;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+void SvImpLBox::FindMostRight( SvLBoxEntry* pEntryToIgnore )
+{
+ nMostRight = -1;
+ pMostRightEntry = 0;
+ if( !pView->GetModel() )
+ return;
+
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pView->FirstVisible();
+ while( pEntry )
+ {
+ if( pEntry != pEntryToIgnore )
+ SetMostRight( pEntry );
+ pEntry = (SvLBoxEntry*)pView->NextVisible( pEntry );
+ }
+}
+
+void SvImpLBox::FindMostRight( SvLBoxEntry* pParent, SvLBoxEntry* pEntryToIgnore )
+{
+ if( !pParent )
+ FindMostRight( pEntryToIgnore );
+ else
+ FindMostRight_Impl( pParent, pEntryToIgnore );
+}
+
+void SvImpLBox::FindMostRight_Impl( SvLBoxEntry* pParent, SvLBoxEntry* pEntryToIgnore )
+{
+ SvTreeEntryList* pList = pTree->GetChildList( pParent );
+
+ if( !pList )
+ return;
+
+ ULONG nCount = pList->Count();
+ for( ULONG nCur = 0; nCur < nCount; nCur++ )
+ {
+ SvLBoxEntry* pChild = (SvLBoxEntry*)pList->GetObject( nCur );
+ if( pChild != pEntryToIgnore )
+ {
+ SetMostRight( pChild );
+ if( pChild->HasChilds() && pView->IsExpanded( pChild ))
+ FindMostRight_Impl( pChild, pEntryToIgnore );
+ }
+ }
+}
+
+void SvImpLBox::NotifyTabsChanged()
+{
+ if( GetUpdateMode() && !(nFlags & F_IGNORE_CHANGED_TABS ) &&
+ nCurUserEvent == 0xffffffff )
+ {
+ nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpLBox,MyUserEvent),(void*)0);
+ }
+}
+
+IMPL_LINK(SvImpLBox,MyUserEvent,void*, pArg )
+{
+ nCurUserEvent = 0xffffffff;
+ if( !pArg )
+ {
+ pView->Invalidate();
+ pView->Update();
+ }
+ else
+ {
+ FindMostRight( 0 );
+ ShowVerSBar();
+ pView->Invalidate( GetVisibleArea() );
+ }
+ return 0;
+}
+
+
+void SvImpLBox::StopUserEvent()
+{
+ if( nCurUserEvent != 0xffffffff )
+ {
+ Application::RemoveUserEvent( nCurUserEvent );
+ nCurUserEvent = 0xffffffff;
+ }
+}
+
+void SvImpLBox::ShowFocusRect( const SvLBoxEntry* pEntry )
+{
+ if( pEntry )
+ {
+ long nY = GetEntryLine( (SvLBoxEntry*)pEntry );
+ Rectangle aRect = pView->GetFocusRect( (SvLBoxEntry*)pEntry, nY );
+ Region aOldClip( pView->GetClipRegion());
+ Region aClipRegion( GetClipRegionRect() );
+ pView->SetClipRegion( aClipRegion );
+ pView->ShowFocus( aRect );
+ pView->SetClipRegion( aOldClip );
+
+ }
+ else
+ {
+ pView->HideFocus();
+ }
+}
+
+void SvImpLBox::SetTabBar( TabBar* _pTabBar )
+{
+ pTabBar = _pTabBar;
+}
+
+
diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx
new file mode 100644
index 000000000000..5d0f83c01d78
--- /dev/null
+++ b/svtools/source/contnr/svimpicn.cxx
@@ -0,0 +1,4222 @@
+/*************************************************************************
+ *
+ * $RCSfile: svimpicn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <limits.h>
+#ifndef _METRIC_HXX
+#include <vcl/metric.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifdef DBG_UTIL
+#include <vcl/sound.hxx>
+#endif
+
+#pragma hdrstop
+
+#include <svlbox.hxx>
+#include <svicnvw.hxx>
+#ifndef _SVIMPICN_HXX
+#include <svimpicn.hxx>
+#endif
+#ifndef _SVLBITM_HXX
+#include <svlbitm.hxx>
+#endif
+#ifndef _SVARRAY_HXX
+#include "svarray.hxx"
+#endif
+
+
+
+#define VIEWMODE_ICON 0x0001 // Text unter Bitmap
+#define VIEWMODE_NAME 0x0002 // Text rechts neben Bitmap
+#define VIEWMODE_TEXT 0x0004 // Text ohne Bitmap
+
+#define DD_SCROLL_PIXEL 10
+
+// alle Angaben in Pixel
+
+#define ICONVIEW_OFFS_BMP_STRING 3
+
+// fuer das Bounding-Rectangle
+#define LROFFS_BOUND 2
+#define TBOFFS_BOUND 2
+
+// fuer das Focus-Rectangle um Icons
+#define LROFFS_ICON 2
+#define TBOFFS_ICON 2
+
+#define NAMEVIEW_OFFS_BMP_STRING 3
+
+// Abstaende von Fensterraendern
+#define LROFFS_WINBORDER 4
+#define TBOFFS_WINBORDER 4
+
+// Breitenoffset Highlight-Rect bei Text
+#define LROFFS_TEXT 2
+
+
+#define ICNVIEWDATA(xPtr) (SvIcnVwDataEntry*)(pView->GetViewDataEntry(xPtr))
+#define ICNVIEWDATA2(xPtr) (SvIcnVwDataEntry*)(pView->pView->GetViewDataEntry(xPtr))
+
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+// -------------------------------------------------------------------------
+// Hilfsfunktionen von Thomas Hosemann zur mehrzeiligen Ausgabe von
+// Strings. Die Funktionen werden spaeter in StarView integriert.
+// -------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+
+// keine doppelten Defines
+#ifdef TEXT_DRAW_CLIP
+#undef TEXT_DRAW_CLIP
+#endif
+#ifdef TEXT_DRAW_MULTILINE
+#undef TEXT_DRAW_MULTILINE
+#endif
+#ifdef TEXT_DRAW_WORDBREAK
+#undef TEXT_DRAW_WORDBREAK
+#endif
+
+// #define TEXT_DRAW_DISABLE ((USHORT)0x0001)
+// #define TEXT_DRAW_3DLOOK ((USHORT)0x0002)
+// #define TEXT_DRAW_MNEMONIC ((USHORT)0x0004)
+#define TEXT_DRAW_LEFT ((USHORT)0x0010)
+#define TEXT_DRAW_CENTER ((USHORT)0x0020)
+#define TEXT_DRAW_RIGHT ((USHORT)0x0040)
+#define TEXT_DRAW_TOP ((USHORT)0x0080)
+#define TEXT_DRAW_VCENTER ((USHORT)0x0100)
+#define TEXT_DRAW_BOTTOM ((USHORT)0x0200)
+#define TEXT_DRAW_ENDELLIPSIS ((USHORT)0x0400)
+#define TEXT_DRAW_PATHELLIPSIS ((USHORT)0x0800)
+#define TEXT_DRAW_CLIP ((USHORT)0x1000)
+#define TEXT_DRAW_MULTILINE ((USHORT)0x2000)
+#define TEXT_DRAW_WORDBREAK ((USHORT)0x4000)
+
+XubString GetEllipsisString( OutputDevice* pDev,
+ const XubString& rStr, long nMaxWidth,
+ USHORT nStyle = TEXT_DRAW_ENDELLIPSIS )
+{
+ XubString aStr = rStr;
+
+ if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
+ {
+ USHORT nIndex = pDev->GetTextBreak( rStr, nMaxWidth );
+ if ( nIndex != STRING_LEN )
+ {
+ aStr.Erase( nIndex );
+ if ( nIndex > 1 )
+ {
+ aStr.AppendAscii("...");
+ while ( aStr.Len() &&
+ (pDev->GetTextWidth( aStr ) > nMaxWidth) )
+ {
+ if ( (nIndex > 1) || (nIndex == aStr.Len()) )
+ nIndex--;
+ aStr.Erase( nIndex, 1 );
+ }
+ }
+
+ if ( !aStr.Len() && (nStyle & TEXT_DRAW_CLIP) )
+ aStr += rStr.GetChar( 0 );
+ }
+ }
+
+ return aStr;
+}
+
+class TextLineInfo
+{
+private:
+ long mnWidth;
+ USHORT mnIndex;
+ USHORT mnLen;
+
+public:
+ TextLineInfo( long nWidth, USHORT nIndex, USHORT nLen )
+ {
+ mnWidth = nWidth;
+ mnIndex = nIndex;
+ mnLen = nLen;
+ }
+
+ long GetWidth() const { return mnWidth; }
+ USHORT GetIndex() const { return mnIndex; }
+ USHORT GetLen() const { return mnLen; }
+};
+
+#define MULTITEXTLINEINFO_RESIZE 16
+typedef TextLineInfo* PTextLineInfo;
+
+class MultiTextLineInfo
+{
+private:
+ PTextLineInfo* mpLines;
+ USHORT mnLines;
+ USHORT mnSize;
+
+public:
+ MultiTextLineInfo();
+ ~MultiTextLineInfo();
+
+ void AddLine( TextLineInfo* pLine );
+ void Clear();
+
+ TextLineInfo* GetLine( USHORT nLine ) const
+ { return mpLines[nLine]; }
+ USHORT Count() const { return mnLines; }
+
+private:
+ MultiTextLineInfo( const MultiTextLineInfo& );
+ MultiTextLineInfo& operator=( const MultiTextLineInfo& );
+};
+
+MultiTextLineInfo::MultiTextLineInfo()
+{
+ mpLines = new PTextLineInfo[MULTITEXTLINEINFO_RESIZE];
+ mnLines = 0;
+ mnSize = MULTITEXTLINEINFO_RESIZE;
+}
+
+MultiTextLineInfo::~MultiTextLineInfo()
+{
+ for ( USHORT i = 0; i < mnLines; i++ )
+ delete mpLines[i];
+ delete mpLines;
+}
+
+void MultiTextLineInfo::AddLine( TextLineInfo* pLine )
+{
+ if ( mnSize == mnLines )
+ {
+ mnSize += MULTITEXTLINEINFO_RESIZE;
+ PTextLineInfo* pNewLines = new PTextLineInfo[mnSize];
+ memcpy( pNewLines, mpLines, mnLines*sizeof(PTextLineInfo) );
+ mpLines = pNewLines;
+ }
+
+ mpLines[mnLines] = pLine;
+ mnLines++;
+}
+
+void MultiTextLineInfo::Clear()
+{
+ for ( USHORT i = 0; i < mnLines; i++ )
+ delete mpLines[i];
+ mnLines = 0;
+}
+
+// -----------------------------------------------------------------------
+
+long GetTextLines( OutputDevice* pDev, MultiTextLineInfo& rLineInfo,
+ long nWidth, const XubString& rStr,
+ USHORT nStyle = TEXT_DRAW_WORDBREAK )
+{
+ rLineInfo.Clear();
+ if ( !rStr.Len() )
+ return 0;
+ if ( nWidth <= 0 )
+ nWidth = 1;
+
+ USHORT nStartPos = 0; // Start-Position der Zeile
+ USHORT nLastLineLen = 0; // Zeilenlaenge bis zum vorherigen Wort
+ USHORT nLastWordPos = 0; // Position des letzten Wortanfangs
+ USHORT i = 0;
+ USHORT nPos; // StartPositon der Zeile (nur Temp)
+ USHORT nLen; // Laenge der Zeile (nur Temp)
+ USHORT nStrLen = rStr.Len();
+ long nMaxLineWidth = 0; // Maximale Zeilenlaenge
+ long nLineWidth; // Aktuelle Zeilenlaenge
+ long nLastLineWidth = 0; // Zeilenlaenge der letzten Zeile
+ xub_Unicode c;
+ xub_Unicode c2;
+ const xub_Unicode* pStr = rStr.GetBuffer();
+ BOOL bHardBreak = FALSE;
+
+ do
+ {
+ c = pStr[i];
+
+ // Auf Zeilenende ermitteln
+ if ( (c == _CR) || (c == _LF) )
+ bHardBreak = TRUE;
+ else
+ bHardBreak = FALSE;
+
+ // Testen, ob ein Wortende erreicht ist
+ if ( bHardBreak || (i == nStrLen) ||
+ (((c == ' ') || (c == '-')) && (nStyle & TEXT_DRAW_WORDBREAK)) )
+ {
+ nLen = i-nStartPos;
+ if ( c == '-' )
+ nLen++;
+ nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen );
+
+ // Findet ein Zeilenumbruch statt
+ if ( bHardBreak || (i == nStrLen) ||
+ ((nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK)) )
+ {
+ nPos = nStartPos;
+
+ if ( (nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK) )
+ {
+ nLineWidth = nLastLineWidth;
+ nLen = nLastLineLen;
+ nStartPos = nLastWordPos;
+ nLastLineLen = i-nStartPos;
+ nLastWordPos = nStartPos+nLastLineLen+1;
+ if ( c == '-' )
+ nLastLineLen++;
+ else if ( bHardBreak && (i > nStartPos) )
+ i--;
+ }
+ else
+ {
+ nStartPos = i;
+ // Zeilenende-Zeichen und '-' beruecksichtigen
+ if ( bHardBreak )
+ {
+ nStartPos++;
+ c2 = pStr[i+1];
+ if ( (c != c2) && ((c2 == _CR) || (c2 == _LF)) )
+ {
+ nStartPos++;
+ i++;
+ }
+ }
+ else if ( c != '-' )
+ nStartPos++;
+ nLastWordPos = nStartPos;
+ nLastLineLen = 0;
+ }
+
+ if ( nLineWidth > nMaxLineWidth )
+ nMaxLineWidth = nLineWidth;
+
+ if ( nLen || bHardBreak )
+ rLineInfo.AddLine( new TextLineInfo( nLineWidth, nPos, nLen ) );
+
+ // Testen, ob aktuelles Wort noch auf die Zeile passt,
+ // denn ansonsten mueessen wir es auftrennen
+ if ( nLastLineLen )
+ {
+ nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen );
+ if ( nLineWidth > nWidth )
+ {
+ // Wenn ein Wortumbruch in einem Wort stattfindet,
+ // ist die maximale Zeilenlaenge die Laenge
+ // des laengsten Wortes
+ if ( nLineWidth > nMaxLineWidth )
+ nMaxLineWidth = nLineWidth;
+
+ // Solange Wort auftrennen, bis es auf eine Zeile passt
+ do
+ {
+ nPos = pDev->GetTextBreak( rStr, nWidth, nStartPos, nLastLineLen );
+ nLen = nPos-nStartPos;
+ if ( !nLen )
+ {
+ nPos++;
+ nLen++;
+ }
+ nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen );
+ rLineInfo.AddLine( new TextLineInfo( nLineWidth, nStartPos, nLen ) );
+ nStartPos = nPos;
+ nLastLineLen -= nLen;
+ nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen );
+ }
+ while ( nLineWidth > nWidth );
+ }
+ nLastLineWidth = nLineWidth;
+
+ // Bei Stringende muessen wir die letzte Zeile auch noch
+ // dranhaengen
+ if ( (i == nStrLen) && nLastLineLen )
+ rLineInfo.AddLine( new TextLineInfo( nLastLineWidth, nStartPos, nLastLineLen ) );
+ }
+ else
+ nLastLineWidth = 0;
+ }
+ else
+ {
+ nLastLineWidth = nLineWidth;
+ nLastLineLen = nLen;
+ nLastWordPos = nStartPos+nLastLineLen;
+ if ( c != '-' )
+ nLastWordPos++;
+ }
+ }
+
+ i++;
+ }
+ while ( i <= nStrLen );
+
+ return nMaxLineWidth;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT GetTextLines( OutputDevice* pDev, const Rectangle& rRect,
+ const XubString& rStr,
+ USHORT nStyle = TEXT_DRAW_WORDBREAK,
+ long* pMaxWidth = NULL )
+{
+ MultiTextLineInfo aMultiLineInfo;
+ long nMaxWidth = GetTextLines( pDev, aMultiLineInfo,
+ rRect.GetWidth(), rStr, nStyle );
+ if ( pMaxWidth )
+ *pMaxWidth = nMaxWidth;
+ return aMultiLineInfo.Count();
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle GetTextRect( OutputDevice* pDev, const Rectangle& rRect,
+ const XubString& rStr,
+ USHORT nStyle = TEXT_DRAW_WORDBREAK )
+{
+ Rectangle aRect = rRect;
+ USHORT nLines;
+ long nWidth = rRect.GetWidth();
+ long nMaxWidth;
+ long nTextHeight;
+
+ if ( nStyle & TEXT_DRAW_MULTILINE )
+ {
+ MultiTextLineInfo aMultiLineInfo;
+ TextLineInfo* pLineInfo;
+ USHORT nFormatLines;
+
+ nMaxWidth = 0;
+ GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle );
+ nFormatLines = aMultiLineInfo.Count();
+ nTextHeight = pDev->GetTextHeight();
+ nLines = (USHORT)(aRect.GetHeight()/nTextHeight);
+ if ( nFormatLines <= nLines )
+ nLines = nFormatLines;
+ else
+ {
+ if ( !(nStyle & TEXT_DRAW_ENDELLIPSIS) )
+ nLines = nFormatLines;
+ else
+ nMaxWidth = nWidth;
+ }
+ for ( USHORT i = 0; i < nLines; i++ )
+ {
+ pLineInfo = aMultiLineInfo.GetLine( i );
+ if ( pLineInfo->GetWidth() > nMaxWidth )
+ nMaxWidth = pLineInfo->GetWidth();
+ }
+ }
+ else
+ {
+ nLines = 1;
+ nMaxWidth = pDev->GetTextWidth( rStr );
+ nTextHeight = pDev->GetTextHeight();
+ if ( (nMaxWidth > nWidth) && (nStyle & TEXT_DRAW_ENDELLIPSIS) )
+ nMaxWidth = nWidth;
+ }
+
+ if ( nStyle & TEXT_DRAW_RIGHT )
+ aRect.Left() = aRect.Right()-nMaxWidth+1;
+ else if ( nStyle & TEXT_DRAW_CENTER )
+ {
+ aRect.Left() += (nWidth-nMaxWidth)/2;
+ aRect.Right() = aRect.Left()+nMaxWidth-1;
+ }
+ else
+ aRect.Right() = aRect.Left()+nMaxWidth-1;
+
+ if ( nStyle & TEXT_DRAW_BOTTOM )
+ aRect.Top() = aRect.Bottom()-(nTextHeight*nLines)+1;
+ else if ( nStyle & TEXT_DRAW_VCENTER )
+ {
+ aRect.Top() += (aRect.GetHeight()-(nTextHeight*nLines))/2;
+ aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
+ }
+ else
+ aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
+
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+void DrawText( OutputDevice* pDev, const Rectangle& rRect,
+ const XubString& rStr, USHORT nStyle = 0 )
+{
+ if ( !rStr.Len() || rRect.IsEmpty() )
+ return;
+
+ Point aPos = rRect.TopLeft();
+ long nWidth = rRect.GetWidth();
+ long nHeight = rRect.GetHeight();
+ FontAlign eAlign = pDev->GetFont().GetAlign();
+
+ if ( ((nWidth <= 0) || (nHeight <= 0)) && (nStyle & TEXT_DRAW_CLIP) )
+ return;
+
+ // Mehrzeiligen Text behandeln wir anders
+ if ( nStyle & TEXT_DRAW_MULTILINE )
+ {
+ String aLastLine;
+ Region aOldRegion;
+ MultiTextLineInfo aMultiLineInfo;
+ TextLineInfo* pLineInfo;
+ long nTextHeight = pDev->GetTextHeight();
+ long nMaxTextWidth;
+ USHORT i;
+ USHORT nLines = (USHORT)(nHeight/nTextHeight);
+ USHORT nFormatLines;
+ BOOL bIsClipRegion;
+ nMaxTextWidth = GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle );
+
+ nFormatLines = aMultiLineInfo.Count();
+ if ( nFormatLines > nLines )
+ {
+ if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
+ {
+ // Letzte Zeile zusammenbauen und kuerzen
+ nFormatLines = nLines-1;
+ pLineInfo = aMultiLineInfo.GetLine( nFormatLines );
+ aLastLine = rStr.Copy( pLineInfo->GetIndex() );
+ aLastLine.ConvertLineEnd( LINEEND_LF );
+ aLastLine.SearchAndReplace( _LF, ' ' );
+ aLastLine = GetEllipsisString( pDev, aLastLine, nWidth, nStyle );
+ nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM);
+ nStyle |= TEXT_DRAW_TOP;
+ }
+ }
+ else
+ {
+ if ( nMaxTextWidth <= nWidth )
+ nStyle &= ~TEXT_DRAW_CLIP;
+ }
+
+ // Clipping setzen
+ if ( nStyle & TEXT_DRAW_CLIP )
+ {
+ bIsClipRegion = pDev->IsClipRegion();
+ if ( bIsClipRegion )
+ {
+ aOldRegion = pDev->GetClipRegion();
+ pDev->IntersectClipRegion( rRect );
+ }
+ else
+ {
+ Region aRegion( rRect );
+ pDev->SetClipRegion( aRegion );
+ }
+ }
+
+ // Vertikales Alignment
+ if ( nStyle & TEXT_DRAW_BOTTOM )
+ aPos.Y() += nHeight-(nFormatLines*nTextHeight);
+ else if ( nStyle & TEXT_DRAW_VCENTER )
+ aPos.Y() += (nHeight-(nFormatLines*nTextHeight))/2;
+
+ // Font Alignment
+ if ( eAlign == ALIGN_BOTTOM )
+ aPos.Y() += nTextHeight;
+ else if ( eAlign == ALIGN_BASELINE )
+ aPos.Y() += pDev->GetFontMetric().GetAscent();
+
+ // Alle Zeilen ausgeben, bis auf die letzte
+ for ( i = 0; i < nFormatLines; i++ )
+ {
+ pLineInfo = aMultiLineInfo.GetLine( i );
+ if ( nStyle & TEXT_DRAW_RIGHT )
+ aPos.X() += nWidth-pLineInfo->GetWidth();
+ else if ( nStyle & TEXT_DRAW_CENTER )
+ aPos.X() += (nWidth-pLineInfo->GetWidth())/2;
+ pDev->DrawText( aPos, rStr, pLineInfo->GetIndex(), pLineInfo->GetLen() );
+ aPos.Y() += nTextHeight;
+ aPos.X() = rRect.Left();
+ }
+
+ // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben,
+ // da die Zeile gekuerzt wurde
+ if ( aLastLine.Len() )
+ pDev->DrawText( aPos, aLastLine );
+
+ // Clipping zuruecksetzen
+ if ( nStyle & TEXT_DRAW_CLIP )
+ {
+ if ( bIsClipRegion )
+ pDev->SetClipRegion( aOldRegion );
+ else
+ pDev->SetClipRegion();
+ }
+ }
+ else
+ {
+ XubString aStr = rStr;
+ Size aTextSize(pDev->GetTextWidth( aStr ), pDev->GetTextHeight());
+
+ // Evt. Text kuerzen
+ if ( aTextSize.Width() > nWidth )
+ {
+ if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
+ {
+ aStr = GetEllipsisString( pDev, rStr, nWidth, nStyle );
+ nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT);
+ nStyle |= TEXT_DRAW_LEFT;
+ aTextSize.Width() = pDev->GetTextWidth(aStr);
+ }
+ }
+ else
+ {
+ if ( aTextSize.Height() <= nHeight )
+ nStyle &= ~TEXT_DRAW_CLIP;
+ }
+
+ // Vertikales Alignment
+ if ( nStyle & TEXT_DRAW_RIGHT )
+ aPos.X() += nWidth-aTextSize.Width();
+ else if ( nStyle & TEXT_DRAW_CENTER )
+ aPos.X() += (nWidth-aTextSize.Width())/2;
+
+ // Font Alignment
+ if ( eAlign == ALIGN_BOTTOM )
+ aPos.Y() += aTextSize.Height();
+ else if ( eAlign == ALIGN_BASELINE )
+ aPos.Y() += pDev->GetFontMetric().GetAscent();
+
+ if ( nStyle & TEXT_DRAW_BOTTOM )
+ aPos.Y() += nHeight-aTextSize.Height();
+ else if ( nStyle & TEXT_DRAW_VCENTER )
+ aPos.Y() += (nHeight-aTextSize.Height())/2;
+
+ if ( nStyle & TEXT_DRAW_CLIP )
+ {
+ BOOL bIsClipRegion = pDev->IsClipRegion();
+ if ( bIsClipRegion )
+ {
+ Region aOldRegion = pDev->GetClipRegion();
+ pDev->IntersectClipRegion( rRect );
+ pDev->DrawText( aPos, aStr );
+ pDev->SetClipRegion( aOldRegion );
+ }
+ else
+ {
+ Region aRegion( rRect );
+ pDev->SetClipRegion( aRegion );
+ pDev->DrawText( aPos, aStr );
+ pDev->SetClipRegion();
+ }
+ }
+ else
+ pDev->DrawText( aPos, aStr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+
+
+#define DRAWTEXT_FLAGS (TEXT_DRAW_CENTER|TEXT_DRAW_TOP|TEXT_DRAW_ENDELLIPSIS|\
+ TEXT_DRAW_CLIP|TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK)
+
+
+class ImpIcnCursor
+{
+ SvImpIconView* pView;
+ SvPtrarr* pColumns;
+ SvPtrarr* pRows;
+ BOOL* pGridMap;
+ long nGridDX, nGridDY;
+ long nGridCols, nGridRows;
+ long nCols;
+ long nRows;
+ short nDeltaWidth;
+ short nDeltaHeight;
+ SvLBoxEntry* pCurEntry;
+ void SetDeltas();
+ void ImplCreate();
+ void Create() { if( !pColumns ) ImplCreate(); }
+
+ USHORT GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
+ SvLBoxEntry* SearchCol(USHORT nCol,USHORT nTop,USHORT nBottom,USHORT nPref,
+ BOOL bDown, BOOL bSimple );
+ SvLBoxEntry* SearchRow(USHORT nRow,USHORT nRight,USHORT nLeft,USHORT nPref,
+ BOOL bRight, BOOL bSimple );
+
+ void ExpandGrid();
+ void CreateGridMap();
+ // Rueckgabe FALSE: Eintrag liegt nicht in der GridMap. rGridx,y werden
+ // dann an nGridCols, nGridRows geclippt
+ BOOL GetGrid( const Point& rDocPos, USHORT& rGridX, USHORT& rGridY ) const;
+ void SetGridUsed( USHORT nDX, USHORT nDY, BOOL bUsed )
+ {
+ pGridMap[ (nDY * nGridCols) + nDX ] = bUsed;
+ }
+ BOOL IsGridUsed( USHORT nDX, USHORT nDY )
+ {
+ return pGridMap[ (nDY * nGridCols) + nDX ];
+ }
+public:
+ ImpIcnCursor( SvImpIconView* pOwner );
+ ~ImpIcnCursor();
+ void Clear( BOOL bGridToo = TRUE );
+
+ // fuer Cursortravelling usw.
+ SvLBoxEntry* GoLeftRight( SvLBoxEntry*, BOOL bRight );
+ SvLBoxEntry* GoUpDown( SvLBoxEntry*, BOOL bDown );
+
+ // Rueckgaebe: FALSE == Das leere Rect steht hinter dem letzten
+ // Eintrag; d.h. beim naechsten Einfuegen ergibt sich das naechste
+ // leere Rechteck durch Addition. Hinweis: Das Rechteck kann dann
+ // ausserhalb des View-Space liegen
+ BOOL FindEmptyGridRect( Rectangle& rRect );
+
+ // Erzeugt fuer jede Zeile (Hoehe=nGridDY) eine nach BoundRect.Left()
+ // sortierte Liste der Eintraege, die in ihr stehen. Eine Liste kann
+ // leer sein. Die Listen gehen in das Eigentum des Rufenden ueber und
+ // muessen mit DestroyGridAdjustData geloescht werden
+ void CreateGridAjustData( SvPtrarr& pLists, SvLBoxEntry* pRow=0);
+ static void DestroyGridAdjustData( SvPtrarr& rLists );
+ void SetGridUsed( const Rectangle&, BOOL bUsed = TRUE );
+};
+
+
+
+
+SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree,
+ WinBits nWinStyle ) :
+ aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
+ aHorSBar( pCurView, WB_DRAG | WB_HSCROLL )
+{
+ pView = pCurView;
+ pModel = pTree;
+ pCurParent = 0;
+ pZOrderList = new SvPtrarr;
+ SetWindowBits( nWinStyle );
+ nHorDist = 0;
+ nVerDist = 0;
+ nFlags = 0;
+ nCurUserEvent = 0;
+ nMaxVirtWidth = 200;
+ pDDRefEntry = 0;
+ pDDDev = 0;
+ pDDBufDev = 0;
+ pDDTempDev = 0;
+ eTextMode = ShowTextShort;
+ pImpCursor = new ImpIcnCursor( this );
+
+ aVerSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollUpDownHdl ) );
+ aHorSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollLeftRightHdl ) );
+ nHorSBarHeight = aHorSBar.GetSizePixel().Height();
+ nVerSBarWidth = aVerSBar.GetSizePixel().Width();
+
+ aMouseMoveTimer.SetTimeout( 20 );
+ aMouseMoveTimer.SetTimeoutHdl(LINK(this,SvImpIconView,MouseMoveTimeoutHdl));
+
+ aEditTimer.SetTimeout( 800 );
+ aEditTimer.SetTimeoutHdl(LINK(this,SvImpIconView,EditTimeoutHdl));
+
+ Clear( TRUE );
+}
+
+SvImpIconView::~SvImpIconView()
+{
+ StopEditTimer();
+ CancelUserEvent();
+ delete pZOrderList;
+ delete pImpCursor;
+ delete pDDDev;
+ delete pDDBufDev;
+ delete pDDTempDev;
+ ClearSelectedRectList();
+}
+
+void SvImpIconView::Clear( BOOL bInCtor )
+{
+ StopEditTimer();
+ CancelUserEvent();
+ nMaxBmpWidth = 0;
+ nMaxBmpHeight = 0;
+ nMaxTextWidth = 0;
+ bMustRecalcBoundingRects = FALSE;
+ nMaxBoundHeight = 0;
+
+ //XXX
+ nFlags |= F_GRID_INSERT;
+ nFlags &= ~F_PAINTED;
+ SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) );
+ pCursor = 0;
+ if( !bInCtor )
+ {
+ pImpCursor->Clear();
+ aVirtOutputSize.Width() = 0;
+ aVirtOutputSize.Height() = 0;
+ pZOrderList->Remove(0,pZOrderList->Count());
+ MapMode aMapMode( pView->GetMapMode());
+ aMapMode.SetOrigin( Point() );
+ pView->SetMapMode( aMapMode );
+ if( pView->IsUpdateMode() )
+ pView->Invalidate();
+ }
+ AdjustScrollBars();
+}
+
+void SvImpIconView::SetWindowBits( WinBits nWinStyle )
+{
+ nWinBits = nWinStyle;
+ nViewMode = VIEWMODE_TEXT;
+ if( nWinStyle & WB_NAME )
+ nViewMode = VIEWMODE_NAME;
+ if( nWinStyle & WB_ICON )
+ nViewMode = VIEWMODE_ICON;
+}
+
+
+IMPL_LINK( SvImpIconView, ScrollUpDownHdl, ScrollBar *, pScrollBar )
+{
+ pView->EndEditing( TRUE );
+ // Pfeil hoch: delta=-1; Pfeil runter: delta=+1
+ Scroll( 0, pScrollBar->GetDelta(), TRUE );
+ return 0;
+}
+
+IMPL_LINK( SvImpIconView, ScrollLeftRightHdl, ScrollBar *, pScrollBar )
+{
+ pView->EndEditing( TRUE );
+ // Pfeil links: delta=-1; Pfeil rechts: delta=+1
+ Scroll( pScrollBar->GetDelta(), 0, TRUE );
+ return 0;
+}
+
+void SvImpIconView::ChangedFont()
+{
+ StopEditTimer();
+ ImpArrange();
+}
+
+
+void SvImpIconView::CheckAllSizes()
+{
+ nMaxTextWidth = 0;
+ nMaxBmpWidth = 0;
+ nMaxBmpHeight = 0;
+ SvLBoxEntry* pEntry = pModel->First();
+ while( pEntry )
+ {
+ CheckSizes( pEntry );
+ pEntry = pModel->Next( pEntry );
+ }
+}
+
+void SvImpIconView::CheckSizes( SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData )
+{
+ Size aSize;
+
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+
+ SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if( pStringItem )
+ {
+ aSize = GetItemSize( pView, pEntry, pStringItem, pViewData );
+ if( aSize.Width() > nMaxTextWidth )
+ {
+ nMaxTextWidth = aSize.Width();
+ if( !(nFlags & F_GRIDMODE ) )
+ bMustRecalcBoundingRects = TRUE;
+ }
+ }
+ SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if( pBmpItem )
+ {
+ aSize = GetItemSize( pView, pEntry, pBmpItem, pViewData );
+ if( aSize.Width() > nMaxBmpWidth )
+ {
+ nMaxBmpWidth = aSize.Width();
+ nMaxBmpWidth += (2*LROFFS_ICON);
+ if( !(nFlags & F_GRIDMODE ) )
+ bMustRecalcBoundingRects = TRUE;
+ }
+ if( aSize.Height() > nMaxBmpHeight )
+ {
+ nMaxBmpHeight = aSize.Height();
+ nMaxBmpHeight += (2*TBOFFS_ICON);;
+ if( !(nFlags & F_GRIDMODE ) )
+ bMustRecalcBoundingRects = TRUE;
+ }
+ }
+}
+
+void SvImpIconView::EntryInserted( SvLBoxEntry* pEntry )
+{
+ if( pModel->GetParent(pEntry) == pCurParent )
+ {
+ StopEditTimer();
+ DBG_ASSERT(pZOrderList->GetPos(pEntry)==0xffff,"EntryInserted:ZOrder?");
+ pZOrderList->Insert( pEntry, pZOrderList->Count() );
+ if( nFlags & F_GRIDMODE )
+ pImpCursor->Clear( FALSE );
+ else
+ pImpCursor->Clear( TRUE );
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ CheckSizes( pEntry, pViewData );
+ if( pView->IsUpdateMode() )
+ {
+ FindBoundingRect( pEntry, pViewData );
+ PaintEntry( pEntry, pViewData );
+ }
+ else
+ InvalidateBoundingRect( pViewData->aRect );
+ }
+}
+
+void SvImpIconView::RemovingEntry( SvLBoxEntry* pEntry )
+{
+ if( pModel->GetParent(pEntry) == pCurParent)
+ {
+ StopEditTimer();
+ DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"RemovingEntry:ZOrder?");
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( IsBoundingRectValid( pViewData->aRect ) )
+ {
+ // bei gueltigem Bounding-Rect muss in EntryRemoved eine
+ // Sonderbehandlung erfolgen
+ nFlags |= F_ENTRY_REMOVED;
+ pView->Invalidate( pViewData->aRect );
+ }
+ if( pEntry == pCursor )
+ {
+ SvLBoxEntry* pNewCursor = GetNewCursor();
+ ShowCursor( FALSE );
+ pCursor = 0; // damit er nicht deselektiert wird
+ SetCursor( pNewCursor );
+ }
+ USHORT nPos = pZOrderList->GetPos( (void*)pEntry );
+ pZOrderList->Remove( nPos, 1 );
+ pImpCursor->Clear();
+ }
+}
+
+void SvImpIconView::EntryRemoved()
+{
+ if( (nFlags & (F_ENTRY_REMOVED | F_PAINTED)) == (F_ENTRY_REMOVED | F_PAINTED))
+ {
+ // Ein Eintrag mit gueltigem BoundRect wurde geloescht und wir
+ // haben schon mal gepaintet. In diesem Fall muessen wir die
+ // Position des naechsten Eintrags, der eingefuegt wird oder noch
+ // kein gueltiges BoundRect hat, "suchen" d.h. ein "Loch" in
+ // der View auffuellen.
+ nFlags &= ~( F_ENTRY_REMOVED | F_GRID_INSERT );
+ }
+}
+
+
+void SvImpIconView::MovingEntry( SvLBoxEntry* pEntry )
+{
+ DBG_ASSERT(pEntry,"MovingEntry: 0!");
+ pNextCursor = 0;
+ StopEditTimer();
+ if( pModel->GetParent(pEntry) == pCurParent )
+ {
+ DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"MovingEntry:ZOrder?");
+ nFlags |= F_MOVING_SIBLING;
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( IsBoundingRectValid( pViewData->aRect ) )
+ pView->Invalidate( pViewData->aRect );
+ // falls Eintrag seinen Parent wechselt vorsichtshalber
+ // die neue Cursorposition berechnen
+ if( pEntry == pCursor )
+ pNextCursor = GetNewCursor();
+ pImpCursor->Clear();
+ }
+}
+
+
+void SvImpIconView::EntryMoved( SvLBoxEntry* pEntry )
+{
+ ShowCursor( FALSE );
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( pModel->GetParent(pEntry)==pCurParent )
+ {
+ if( nFlags & F_MOVING_SIBLING )
+ {
+ // die Neu-Positionierung eines Eintrags bei D&D innerhalb
+ // einer IconView findet bereits in NotifyMoving statt
+ // (MovingEntry/EntryMoved wird dann nicht mehr gerufen)
+ ToTop( pEntry );
+ }
+ else
+ {
+ pImpCursor->Clear();
+ pZOrderList->Insert( pEntry, pZOrderList->Count() );
+ DBG_ASSERT(pZOrderList->Count()==pModel->GetChildCount(pCurParent),"EntryMoved:Bad zorder count");
+ FindBoundingRect( pEntry, pViewData );
+ }
+ PaintEntry( pEntry, pViewData );
+ }
+ else
+ {
+ if( pEntry == pCursor )
+ {
+ DBG_ASSERT(pNextCursor,"EntryMoved: Next cursor bad");
+ SetCursor( pNextCursor );
+ }
+ pImpCursor->Clear();
+ USHORT nPos = pZOrderList->GetPos( (void*)pEntry );
+ pZOrderList->Remove( nPos, 1 );
+ pView->Select( pEntry, FALSE );
+ // wenn er nochmal in dieser View auftaucht, muss sein
+ // Bounding-Rect neu berechnet werden
+ InvalidateBoundingRect( pViewData->aRect );
+ }
+ nFlags &= (~F_MOVING_SIBLING);
+}
+
+void SvImpIconView::TreeInserted( SvLBoxEntry* pEntry )
+{
+ EntryMoved( pEntry ); // vorlaeufig
+}
+
+void SvImpIconView::EntryExpanded( SvLBoxEntry* )
+{
+}
+
+void SvImpIconView::EntryCollapsed( SvLBoxEntry*)
+{
+}
+
+void SvImpIconView::CollapsingEntry( SvLBoxEntry* )
+{
+}
+
+void SvImpIconView::EntrySelected( SvLBoxEntry* pEntry, BOOL bSelect )
+{
+ if( pModel->GetParent(pEntry) != pCurParent )
+ return;
+
+ // bei SingleSelection dafuer sorgen, dass der Cursor immer
+ // auf dem (einzigen) selektierten Eintrag steht
+ if( bSelect && pCursor &&
+ pView->GetSelectionMode() == SINGLE_SELECTION &&
+ pEntry != pCursor )
+ {
+ SetCursor( pEntry );
+ DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?")
+ }
+ // bei Gummibandselektion ist uns das zu teuer
+ if( !(nFlags & F_RUBBERING ))
+ ToTop( pEntry );
+ if( pView->IsUpdateMode() )
+ {
+ if( pEntry == pCursor )
+ ShowCursor( FALSE );
+ if( nFlags & F_RUBBERING )
+ PaintEntry( pEntry );
+ else
+ pView->Invalidate( GetBoundingRect( pEntry ) );
+ if( pEntry == pCursor )
+ ShowCursor( TRUE );
+ }
+}
+
+void SvImpIconView::SetNextEntryPos(const Point& rPos)
+{
+ aPrevBoundRect.SetPos( rPos );
+ aPrevBoundRect.Right() = LONG_MAX; // dont know
+}
+
+Point SvImpIconView::FindNextEntryPos( const Size& rBoundSize )
+{
+ if( nFlags & F_GRIDMODE )
+ {
+ if( nFlags & F_GRID_INSERT )
+ {
+ if( aPrevBoundRect.Right() != LONG_MAX )
+ {
+ // passt der naechste Entry noch in die Zeile ?
+ long nNextWidth = aPrevBoundRect.Right() + nGridDX + LROFFS_WINBORDER;
+ if( nNextWidth > aVirtOutputSize.Width() )
+ {
+ // darf aVirtOutputSize verbreitert werden ?
+ if( nNextWidth < nMaxVirtWidth )
+ {
+ // verbreitern & in Zeile aufnehmen
+ aPrevBoundRect.Left() += nGridDX;
+ }
+ else
+ {
+ // erhoehen & neue Zeile beginnen
+ aPrevBoundRect.Top() += nGridDY;
+ aPrevBoundRect.Left() = LROFFS_WINBORDER;
+ }
+ }
+ else
+ {
+ // in die Zeile aufnehmen
+ aPrevBoundRect.Left() += nGridDX;
+ }
+ }
+ aPrevBoundRect.SetSize( Size( nGridDX, nGridDY ) );
+ }
+ else
+ {
+ if( !pImpCursor->FindEmptyGridRect( aPrevBoundRect ) )
+ {
+ // mitten in den Entries gibts keine Loecher mehr,
+ // wir koennen also wieder ins "Fast Insert" springen
+ nFlags |= F_GRID_INSERT;
+ }
+ }
+ }
+ else
+ {
+ if( aPrevBoundRect.Right() != LONG_MAX )
+ {
+ // passt der naechste Entry noch in die Zeile ?
+ long nNextWidth=aPrevBoundRect.Right()+rBoundSize.Width()+LROFFS_BOUND+nHorDist;
+ if( nNextWidth > aVirtOutputSize.Width() )
+ {
+ // darf aVirtOutputSize verbreitert werden ?
+ if( nNextWidth < nMaxVirtWidth )
+ {
+ // verbreitern & in Zeile aufnehmen
+ aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() );
+ aPrevBoundRect.Left() += nHorDist;
+ }
+ else
+ {
+ // erhoehen & neue Zeile beginnen
+ aPrevBoundRect.Top() += nMaxBoundHeight + nVerDist + TBOFFS_BOUND;
+ aPrevBoundRect.Left() = LROFFS_WINBORDER;
+ }
+ }
+ else
+ {
+ // in die Zeile aufnehmen
+ aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() );
+ aPrevBoundRect.Left() += nHorDist;
+ }
+ }
+ aPrevBoundRect.SetSize( rBoundSize );
+ }
+ return aPrevBoundRect.TopLeft();
+}
+
+void SvImpIconView::ResetVirtSize()
+{
+ StopEditTimer();
+ aVirtOutputSize.Width() = 0;
+ aVirtOutputSize.Height() = 0;
+ BOOL bLockedEntryFound = FALSE;
+ nFlags &= (~F_GRID_INSERT);
+ SvLBoxEntry* pCur = pModel->FirstChild( pCurParent );
+ while( pCur )
+ {
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur);
+ if( pViewData->IsEntryPosLocked() )
+ {
+ // VirtSize u.a. anpassen
+ if( !IsBoundingRectValid( pViewData->aRect ) )
+ FindBoundingRect( pCur, pViewData );
+ else
+ AdjustVirtSize( pViewData->aRect );
+ bLockedEntryFound = TRUE;
+ }
+ else
+ InvalidateBoundingRect( pViewData->aRect );
+
+ pCur = pModel->NextSibling( pCur );
+ }
+ if( !bLockedEntryFound )
+ {
+ //XXX
+ nFlags |= F_GRID_INSERT;
+ }
+
+ SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) );
+ pImpCursor->Clear();
+}
+
+
+void SvImpIconView::AdjustVirtSize( const Rectangle& rRect )
+{
+ long nHeightOffs = 0;
+ long nWidthOffs = 0;
+
+ if( aVirtOutputSize.Width() < (rRect.Right()+LROFFS_WINBORDER) )
+ nWidthOffs = (rRect.Right()+LROFFS_WINBORDER) - aVirtOutputSize.Width();
+
+ if( aVirtOutputSize.Height() < (rRect.Bottom()+TBOFFS_WINBORDER) )
+ nHeightOffs = (rRect.Bottom()+TBOFFS_WINBORDER) - aVirtOutputSize.Height();
+
+ if( nWidthOffs || nHeightOffs )
+ {
+ Range aRange;
+ aVirtOutputSize.Width() += nWidthOffs;
+ aRange.Max() = aVirtOutputSize.Width();
+ aHorSBar.SetRange( aRange );
+
+ aVirtOutputSize.Height() += nHeightOffs;
+ aRange.Max() = aVirtOutputSize.Height();
+ aVerSBar.SetRange( aRange );
+
+ pImpCursor->Clear();
+ AdjustScrollBars();
+ }
+}
+
+void SvImpIconView::Arrange()
+{
+ nMaxVirtWidth = aOutputSize.Width();
+ ImpArrange();
+}
+
+void SvImpIconView::ImpArrange()
+{
+ StopEditTimer();
+ ShowCursor( FALSE );
+ ResetVirtSize();
+ bMustRecalcBoundingRects = FALSE;
+ MapMode aMapMode( pView->GetMapMode());
+ aMapMode.SetOrigin( Point() );
+ pView->SetMapMode( aMapMode );
+ CheckAllSizes();
+ RecalcAllBoundingRectsSmart();
+ pView->Invalidate();
+ ShowCursor( TRUE );
+}
+
+void SvImpIconView::Paint( const Rectangle& rRect )
+{
+ if( !pView->IsUpdateMode() )
+ return;
+
+#if defined(DBG_UTIL) && defined(OV_DRAWGRID)
+ if( nFlags & F_GRIDMODE )
+ {
+ Color aOldColor = pView->GetLineColor();
+ Color aNewColor( COL_BLACK );
+ pView->SetLineColor( aNewColor );
+ Point aOffs( pView->GetMapMode().GetOrigin());
+ Size aXSize( pView->GetOutputSizePixel() );
+ for( long nDX = nGridDX; nDX <= aXSize.Width(); nDX += nGridDX )
+ {
+ Point aStart( nDX+LROFFS_BOUND, 0 );
+ Point aEnd( nDX+LROFFS_BOUND, aXSize.Height());
+ aStart -= aOffs;
+ aEnd -= aOffs;
+ pView->DrawLine( aStart, aEnd );
+ }
+ for( long nDY = nGridDY; nDY <= aXSize.Height(); nDY += nGridDY )
+ {
+ Point aStart( 0, nDY+TBOFFS_BOUND );
+ Point aEnd( aXSize.Width(), nDY+TBOFFS_BOUND );
+ aStart -= aOffs;
+ aEnd -= aOffs;
+ pView->DrawLine( aStart, aEnd );
+ }
+ pView->SetLineColor( aOldColor );
+ }
+#endif
+ nFlags |= F_PAINTED;
+
+ if( !(pModel->HasChilds( pCurParent ) ))
+ return;
+ if( !pCursor )
+ pCursor = pModel->FirstChild( pCurParent );
+
+ USHORT nCount = pZOrderList->Count();
+ if( !nCount )
+ return;
+
+ SvPtrarr* pNewZOrderList = new SvPtrarr;
+ SvPtrarr* pPaintedEntries = new SvPtrarr;
+
+ USHORT nPos = 0;
+ while( nCount )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos ));
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ const Rectangle& rBoundRect = GetBoundingRect( pEntry, pViewData );
+ if( rRect.IsOver( rBoundRect ) )
+ {
+ PaintEntry( pEntry, rBoundRect.TopLeft(), pViewData );
+ // Eintraege, die neu gezeichnet werden, auf Top setzen
+ pPaintedEntries->Insert( pEntry, pPaintedEntries->Count() );
+ }
+ else
+ pNewZOrderList->Insert( pEntry, pNewZOrderList->Count() );
+
+ nCount--;
+ nPos++;
+ }
+ delete pZOrderList;
+ pZOrderList = pNewZOrderList;
+ nCount = pPaintedEntries->Count();
+ if( nCount )
+ {
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ pZOrderList->Insert( pPaintedEntries->GetObject( nCur ),pZOrderList->Count());
+ }
+ delete pPaintedEntries;
+
+ Rectangle aRect;
+ if( GetResizeRect( aRect ))
+ PaintResizeRect( aRect );
+}
+
+BOOL SvImpIconView::GetResizeRect( Rectangle& rRect )
+{
+ if( aHorSBar.IsVisible() && aVerSBar.IsVisible() )
+ {
+ const MapMode& rMapMode = pView->GetMapMode();
+ Point aOrigin( rMapMode.GetOrigin());
+ aOrigin *= -1;
+ aOrigin.X() += aOutputSize.Width();
+ aOrigin.Y() += aOutputSize.Height();
+ rRect.SetPos( aOrigin );
+ rRect.SetSize( Size( nVerSBarWidth, nHorSBarHeight));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void SvImpIconView::PaintResizeRect( const Rectangle& rRect )
+{
+ const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings();
+ Color aNewColor = rStyleSettings.GetFaceColor();
+ Color aOldColor = pView->GetFillColor();
+ pView->SetFillColor( aNewColor );
+ pView->DrawRect( rRect );
+ pView->SetFillColor( aOldColor );
+}
+
+void SvImpIconView::RepaintSelectionItems()
+{
+ DBG_ERROR("RepaintSelectionItems");
+ pView->Invalidate(); // vorlaeufig
+}
+
+SvLBoxItem* SvImpIconView::GetItem( SvLBoxEntry* pEntry,
+ const Point& rAbsPos )
+{
+ Rectangle aRect;
+ SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if( pStringItem )
+ {
+ aRect = CalcTextRect( pEntry, pStringItem );
+ if( aRect.IsInside( rAbsPos ) )
+ return pStringItem;
+ }
+ SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if( pBmpItem )
+ {
+ aRect = CalcBmpRect( pEntry );
+ if( aRect.IsInside( rAbsPos ) )
+ return pBmpItem;
+ }
+ return 0;
+}
+
+void SvImpIconView::CalcDocPos( Point& aMaeuschenPos )
+{
+ aMaeuschenPos -= pView->GetMapMode().GetOrigin();
+}
+
+void SvImpIconView::MouseButtonDown( const MouseEvent& rMEvt)
+{
+ StopEditTimer();
+ pView->GrabFocus();
+ Point aDocPos( rMEvt.GetPosPixel() );
+ if(aDocPos.X()>=aOutputSize.Width() || aDocPos.Y()>=aOutputSize.Height())
+ return;
+ CalcDocPos( aDocPos );
+ SvLBoxEntry* pEntry = GetEntry( aDocPos );
+ if( !pEntry )
+ {
+ if( pView->GetSelectionMode() != SINGLE_SELECTION )
+ {
+ if( !rMEvt.IsMod1() ) // Ctrl
+ {
+ pView->SelectAll( FALSE );
+ ClearSelectedRectList();
+ }
+ else
+ nFlags |= F_ADD_MODE;
+ nFlags |= F_RUBBERING;
+ aCurSelectionRect.SetPos( aDocPos );
+ pView->CaptureMouse();
+ }
+ return;
+ }
+
+ BOOL bSelected = pView->IsSelected( pEntry );
+ BOOL bEditingEnabled = pView->IsInplaceEditingEnabled();
+
+ if( rMEvt.GetClicks() == 2 )
+ {
+ DeselectAllBut( pEntry );
+ pView->pHdlEntry = pEntry;
+ pView->DoubleClickHdl();
+ }
+ else
+ {
+ // Inplace-Editing ?
+ if( rMEvt.IsMod2() ) // Alt?
+ {
+ if( bEditingEnabled )
+ {
+ SvLBoxItem* pItem = GetItem(pEntry,aDocPos);
+ if( pItem )
+ pView->EditingRequest( pEntry, pItem, aDocPos);
+ }
+ }
+ else if( pView->GetSelectionMode() == SINGLE_SELECTION )
+ {
+ DeselectAllBut( pEntry );
+ SetCursor( pEntry );
+ pView->Select( pEntry, TRUE );
+ if( bEditingEnabled && bSelected && !rMEvt.GetModifier() &&
+ rMEvt.IsLeft() && IsTextHit( pEntry, aDocPos ) )
+ {
+ nFlags |= F_START_EDITTIMER_IN_MOUSEUP;
+ }
+ }
+ else
+ {
+ if( !rMEvt.GetModifier() )
+ {
+ if( !bSelected )
+ {
+ DeselectAllBut( pEntry );
+ SetCursor( pEntry );
+ pView->Select( pEntry, TRUE );
+ }
+ else
+ {
+ // erst im Up deselektieren, falls Move per D&D!
+ nFlags |= F_DOWN_DESELECT;
+ if( bEditingEnabled && IsTextHit( pEntry, aDocPos ) &&
+ rMEvt.IsLeft())
+ {
+ nFlags |= F_START_EDITTIMER_IN_MOUSEUP;
+ }
+ }
+ }
+ else if( rMEvt.IsMod1() )
+ nFlags |= F_DOWN_CTRL;
+ }
+ }
+}
+
+void SvImpIconView::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ aMouseMoveTimer.Stop();
+ pView->ReleaseMouse();
+ // HACK, da Einar noch nicht PrepareCommandEvent aufruft
+ if( rMEvt.IsRight() && (nFlags & (F_DOWN_CTRL | F_DOWN_DESELECT) ))
+ nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
+
+ if( nFlags & F_RUBBERING )
+ {
+ aMouseMoveTimer.Stop();
+ AddSelectedRect( aCurSelectionRect );
+ HideSelectionRect();
+ nFlags &= ~(F_RUBBERING | F_ADD_MODE);
+ }
+
+ SvLBoxEntry* pEntry = pView->GetEntry( rMEvt.GetPosPixel(), TRUE );
+ if( pEntry )
+ {
+ if( nFlags & F_DOWN_CTRL )
+ {
+ // Ctrl & MultiSelection
+ ToggleSelection( pEntry );
+ SetCursor( pEntry );
+ }
+ else if( nFlags & F_DOWN_DESELECT )
+ {
+ DeselectAllBut( pEntry );
+ SetCursor( pEntry );
+ pView->Select( pEntry, TRUE );
+ }
+ }
+
+ nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
+ if( nFlags & F_START_EDITTIMER_IN_MOUSEUP )
+ {
+ StartEditTimer();
+ nFlags &= ~F_START_EDITTIMER_IN_MOUSEUP;
+ }
+}
+
+void SvImpIconView::MouseMove( const MouseEvent& rMEvt )
+{
+ if( nFlags & F_RUBBERING )
+ {
+ const Point& rPosPixel = rMEvt.GetPosPixel();
+ if( !aMouseMoveTimer.IsActive() )
+ {
+ aMouseMoveEvent = rMEvt;
+ aMouseMoveTimer.Start();
+ // ausserhalb des Fensters liegende Move-Events muessen
+ // vom Timer kommen, damit die Scrollgeschwindigkeit
+ // unabhaengig von Mausbewegungen ist.
+ if( rPosPixel.X() < 0 || rPosPixel.Y() < 0 )
+ return;
+ const Size& rSize = pView->GetOutputSizePixel();
+ if( rPosPixel.X() > rSize.Width() || rPosPixel.Y() > rSize.Height())
+ return;
+ }
+
+ if( &rMEvt != &aMouseMoveEvent )
+ aMouseMoveEvent = rMEvt;
+
+ long nScrollDX, nScrollDY;
+
+ CalcScrollOffsets(rMEvt.GetPosPixel(),nScrollDX,nScrollDY,FALSE );
+ BOOL bSelRectHidden = FALSE;
+ if( nScrollDX || nScrollDY )
+ {
+ HideSelectionRect();
+ bSelRectHidden = TRUE;
+ pView->Scroll( nScrollDX, nScrollDY );
+ }
+ Point aDocPos( rMEvt.GetPosPixel() );
+ aDocPos = pView->PixelToLogic( aDocPos );
+ Rectangle aRect( aCurSelectionRect.TopLeft(), aDocPos );
+ if( aRect != aCurSelectionRect )
+ {
+ HideSelectionRect();
+ bSelRectHidden = TRUE;
+ BOOL bAdd = (nFlags & F_ADD_MODE) ? TRUE : FALSE;
+ SelectRect( aRect, bAdd, &aSelectedRectList );
+ }
+ if( bSelRectHidden )
+ DrawSelectionRect( aRect );
+ }
+}
+
+BOOL SvImpIconView::KeyInput( const KeyEvent& rKEvt )
+{
+ StopEditTimer();
+ BOOL bKeyUsed = TRUE;
+ BOOL bMod1 = rKEvt.GetKeyCode().IsMod1();
+ BOOL bInAddMode = (BOOL)((nFlags & F_ADD_MODE) != 0);
+ int bDeselAll = (pView->GetSelectionMode() != SINGLE_SELECTION) &&
+ !bInAddMode;
+ SvLBoxEntry* pNewCursor;
+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
+ switch( nCode )
+ {
+ case KEY_UP:
+ if( pCursor )
+ {
+ MakeVisible( pCursor );
+ pNewCursor = pImpCursor->GoUpDown(pCursor,FALSE);
+ if( pNewCursor )
+ {
+ if( bDeselAll )
+ pView->SelectAll( FALSE );
+ ShowCursor( FALSE );
+ MakeVisible( pNewCursor );
+ SetCursor( pNewCursor );
+ if( !bInAddMode )
+ pView->Select( pCursor, TRUE );
+ }
+ else
+ {
+ Rectangle aRect( GetBoundingRect( pCursor ) );
+ if( aRect.Top())
+ {
+ aRect.Bottom() -= aRect.Top();
+ aRect.Top() = 0;
+ MakeVisible( aRect );
+ }
+ }
+ }
+ break;
+
+ case KEY_DOWN:
+ if( pCursor )
+ {
+ pNewCursor=pImpCursor->GoUpDown( pCursor,TRUE );
+ if( pNewCursor )
+ {
+ MakeVisible( pCursor );
+ if( bDeselAll )
+ pView->SelectAll( FALSE );
+ ShowCursor( FALSE );
+ MakeVisible( pNewCursor );
+ SetCursor( pNewCursor );
+ if( !bInAddMode )
+ pView->Select( pCursor, TRUE );
+ }
+ }
+ break;
+
+ case KEY_RIGHT:
+ if( pCursor )
+ {
+ pNewCursor=pImpCursor->GoLeftRight(pCursor,TRUE );
+ if( pNewCursor )
+ {
+ MakeVisible( pCursor );
+ if( bDeselAll )
+ pView->SelectAll( FALSE );
+ ShowCursor( FALSE );
+ MakeVisible( pNewCursor );
+ SetCursor( pNewCursor );
+ if( !bInAddMode )
+ pView->Select( pCursor, TRUE );
+ }
+ }
+ break;
+
+ case KEY_LEFT:
+ if( pCursor )
+ {
+ MakeVisible( pCursor );
+ pNewCursor = pImpCursor->GoLeftRight(pCursor,FALSE );
+ if( pNewCursor )
+ {
+ if( bDeselAll )
+ pView->SelectAll( FALSE );
+ ShowCursor( FALSE );
+ MakeVisible( pNewCursor );
+ SetCursor( pNewCursor );
+ if( !bInAddMode )
+ pView->Select( pCursor, TRUE );
+ }
+ else
+ {
+ Rectangle aRect( GetBoundingRect(pCursor));
+ if( aRect.Left() )
+ {
+ aRect.Right() -= aRect.Left();
+ aRect.Left() = 0;
+ MakeVisible( aRect );
+ }
+ }
+ }
+ break;
+
+ case KEY_ESCAPE:
+ if( nFlags & F_RUBBERING )
+ {
+ HideSelectionRect();
+ pView->SelectAll( FALSE );
+ nFlags &= ~F_RUBBERING;
+ }
+ break;
+
+ case KEY_F8:
+ if( rKEvt.GetKeyCode().IsShift() )
+ {
+ if( nFlags & F_ADD_MODE )
+ nFlags &= (~F_ADD_MODE);
+ else
+ nFlags |= F_ADD_MODE;
+ }
+ break;
+
+#ifdef OS2
+ case KEY_F9:
+ if( rKEvt.GetKeyCode().IsShift() )
+ {
+ if( pCursor && pView->IsInplaceEditingEnabled() )
+ pView->EditEntry( pCursor );
+ }
+ break;
+#endif
+
+ case KEY_SPACE:
+ if( pCursor )
+ {
+ ToggleSelection( pCursor );
+ }
+ break;
+
+
+ case KEY_PAGEDOWN:
+ break;
+ case KEY_PAGEUP:
+ break;
+
+ case KEY_ADD:
+ case KEY_DIVIDE :
+ if( bMod1 )
+ pView->SelectAll( TRUE );
+ break;
+
+ case KEY_SUBTRACT:
+ case KEY_COMMA :
+ if( bMod1 )
+ pView->SelectAll( FALSE );
+ break;
+
+ case KEY_RETURN:
+ if( bMod1 )
+ {
+ if( pCursor && pView->IsInplaceEditingEnabled() )
+ pView->EditEntry( pCursor );
+ }
+ break;
+
+ default:
+ bKeyUsed = FALSE;
+
+ }
+ return bKeyUsed;
+}
+
+
+void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight )
+{
+ // hor scrollbar
+ Point aPos( 0, nRealHeight );
+ aPos.Y() -= nHorSBarHeight;
+
+#ifdef WIN
+ // vom linken und unteren Rand ein Pixel abschneiden
+ aPos.Y()++;
+ aPos.X()--;
+#endif
+#ifdef OS2
+ aPos.Y()++;
+#endif
+ if( aHorSBar.GetPosPixel() != aPos )
+ aHorSBar.SetPosPixel( aPos );
+
+ // ver scrollbar
+ aPos.X() = nRealWidth; aPos.Y() = 0;
+ aPos.X() -= nVerSBarWidth;
+
+#if defined(WIN) || defined(WNT)
+ aPos.X()++;
+ aPos.Y()--;
+#endif
+
+#ifdef OS2
+ aPos.Y()--;
+ aPos.X()++;
+#endif
+
+#ifdef MAC
+ aPos.Y()--;
+ aPos.X()++;
+#endif
+ if( aVerSBar.GetPosPixel() != aPos )
+ aVerSBar.SetPosPixel( aPos );
+}
+
+
+
+void SvImpIconView::AdjustScrollBars( BOOL bVirtSizeGrowedOnly )
+{
+ long nVirtHeight = aVirtOutputSize.Height();
+ long nVirtWidth = aVirtOutputSize.Width();
+
+ Size aOSize( pView->Control::GetOutputSizePixel() );
+ long nRealHeight = aOSize.Height();
+ long nRealWidth = aOSize.Width();
+
+ PositionScrollBars( nRealWidth, nRealHeight );
+
+ const MapMode& rMapMode = pView->GetMapMode();
+ Point aOrigin( rMapMode.GetOrigin() );
+
+ long nVisibleWidth;
+ if( nRealWidth > nVirtWidth )
+ nVisibleWidth = nVirtWidth + aOrigin.X();
+ else
+ nVisibleWidth = nRealWidth;
+
+ long nVisibleHeight;
+ if( nRealHeight > nVirtHeight )
+ nVisibleHeight = nVirtHeight + aOrigin.Y();
+ else
+ nVisibleHeight = nRealHeight;
+
+ int bVerSBar = pView->nWindowStyle & WB_VSCROLL;
+ int bHorSBar = pView->nWindowStyle & WB_HSCROLL;
+
+ USHORT nResult = 0;
+ if( nVirtHeight )
+ {
+ // activate ver scrollbar ?
+ if( bVerSBar || ( nVirtHeight > nVisibleHeight) )
+ {
+ nResult = 0x0001;
+ nRealWidth -= nVerSBarWidth;
+
+ if( nRealWidth > nVirtWidth )
+ nVisibleWidth = nVirtWidth + aOrigin.X();
+ else
+ nVisibleWidth = nRealWidth;
+
+ nFlags |= F_HOR_SBARSIZE_WITH_VBAR;
+ }
+ // activate hor scrollbar ?
+ if( bHorSBar || (nVirtWidth > nVisibleWidth) )
+ {
+ nResult |= 0x0002;
+ nRealHeight -= nHorSBarHeight;
+
+ if( nRealHeight > nVirtHeight )
+ nVisibleHeight = nVirtHeight + aOrigin.Y();
+ else
+ nVisibleHeight = nRealHeight;
+
+ // brauchen wir jetzt doch eine senkrechte Scrollbar ?
+ if( !(nResult & 0x0001) && // nur wenn nicht schon da
+ ( (nVirtHeight > nVisibleHeight) || bVerSBar) )
+ {
+ nResult = 3; // both are active
+ nRealWidth -= nVerSBarWidth;
+
+ if( nRealWidth > nVirtWidth )
+ nVisibleWidth = nVirtWidth + aOrigin.X();
+ else
+ nVisibleWidth = nRealWidth;
+
+ nFlags |= F_VER_SBARSIZE_WITH_HBAR;
+ }
+ }
+ }
+
+ // size ver scrollbar
+ long nThumb = aVerSBar.GetThumbPos();
+ Size aSize( nVerSBarWidth, nRealHeight );
+#if defined(WIN) || defined(WNT)
+ aSize.Height() += 2;
+#endif
+#ifdef OS2
+ aSize.Height() += 3;
+#endif
+#ifdef MAC
+ aSize.Height() += 2;
+#endif
+ if( aSize != aVerSBar.GetSizePixel() )
+ aVerSBar.SetSizePixel( aSize );
+ aVerSBar.SetVisibleSize( nVisibleHeight );
+ aVerSBar.SetPageSize( (nVisibleHeight*75)/100 );
+ if( nResult & 0x0001 )
+ {
+ aVerSBar.SetThumbPos( nThumb );
+ aVerSBar.Show();
+ }
+ else
+ {
+ aVerSBar.SetThumbPos( 0 );
+ aVerSBar.Hide();
+ }
+
+ // size hor scrollbar
+ nThumb = aHorSBar.GetThumbPos();
+ aSize.Width() = nRealWidth;
+ aSize.Height() = nHorSBarHeight;
+#if defined(WIN) || defined(WNT)
+ aSize.Width()++;
+#endif
+#ifdef OS2
+ aSize.Width() += 3;
+ if( nResult & 0x0001 ) // vertikale Scrollbar ?
+ aSize.Width()--;
+#endif
+#if defined(WIN) || defined(WNT)
+ if( nResult & 0x0001 ) // vertikale Scrollbar ?
+ {
+ aSize.Width()++;
+ nRealWidth++;
+ }
+#endif
+ if( aSize != aHorSBar.GetSizePixel() )
+ aHorSBar.SetSizePixel( aSize );
+ aHorSBar.SetVisibleSize( nVisibleWidth ); //nRealWidth );
+ aHorSBar.SetPageSize( (nVisibleWidth*75)/100 );
+ if( nResult & 0x0002 )
+ {
+ aHorSBar.SetThumbPos( nThumb );
+ aHorSBar.Show();
+ }
+ else
+ {
+ aHorSBar.SetThumbPos( 0 );
+ aHorSBar.Hide();
+ }
+
+#ifdef OS2
+ nRealWidth++;
+#endif
+ aOutputSize.Width() = nRealWidth;
+#if defined(WIN) || defined(WNT)
+ if( nResult & 0x0002 ) // hor scrollbar ?
+ nRealHeight++; // weil unterer Rand geclippt wird
+#endif
+#ifdef OS2
+ if( nResult & 0x0002 ) // hor scrollbar ?
+ nRealHeight++;
+#endif
+ aOutputSize.Height() = nRealHeight;
+}
+
+void __EXPORT SvImpIconView::Resize()
+{
+ StopEditTimer();
+ Rectangle aRect;
+ if( GetResizeRect(aRect) )
+ pView->Invalidate( aRect );
+ aOutputSize = pView->GetOutputSizePixel();
+ pImpCursor->Clear();
+
+#if 1
+ const Size& rSize = pView->Control::GetOutputSizePixel();
+ PositionScrollBars( rSize.Width(), rSize.Height() );
+ // Die ScrollBars werden asynchron ein/ausgeblendet, damit abgeleitete
+ // Klassen im Resize ein Arrange durchfuehren koennen, ohne dass
+ // die ScrollBars aufblitzen (SfxExplorerIconView!)
+ nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpIconView,UserEventHdl),0);
+#else
+ AdjustScrollBars();
+ if( GetResizeRect(aRect) )
+ PaintResizeRect( aRect );
+#endif
+}
+
+BOOL SvImpIconView::CheckHorScrollBar()
+{
+ if( !pZOrderList || !aHorSBar.IsVisible() )
+ return FALSE;
+ const MapMode& rMapMode = pView->GetMapMode();
+ Point aOrigin( rMapMode.GetOrigin() );
+ if(!(pView->nWindowStyle & WB_HSCROLL) && !aOrigin.X() )
+ {
+ long nWidth = aOutputSize.Width();
+ USHORT nCount = pZOrderList->Count();
+ long nMostRight = 0;
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur);
+ long nRight = GetBoundingRect(pEntry).Right();
+ if( nRight > nWidth )
+ return FALSE;
+ if( nRight > nMostRight )
+ nMostRight = nRight;
+ }
+ aHorSBar.Hide();
+ aOutputSize.Height() += nHorSBarHeight;
+ aVirtOutputSize.Width() = nMostRight;
+ aHorSBar.SetThumbPos( 0 );
+ Range aRange;
+ aRange.Max() = nMostRight - 1;
+ aHorSBar.SetRange( aRange );
+ if( aVerSBar.IsVisible() )
+ {
+ Size aSize( aVerSBar.GetSizePixel());
+ aSize.Height() += nHorSBarHeight;
+ aVerSBar.SetSizePixel( aSize );
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL SvImpIconView::CheckVerScrollBar()
+{
+ if( !pZOrderList || !aVerSBar.IsVisible() )
+ return FALSE;
+ const MapMode& rMapMode = pView->GetMapMode();
+ Point aOrigin( rMapMode.GetOrigin() );
+ if(!(pView->nWindowStyle & WB_VSCROLL) && !aOrigin.Y() )
+ {
+ long nDeepest = 0;
+ long nHeight = aOutputSize.Height();
+ USHORT nCount = pZOrderList->Count();
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur);
+ long nBottom = GetBoundingRect(pEntry).Bottom();
+ if( nBottom > nHeight )
+ return FALSE;
+ if( nBottom > nDeepest )
+ nDeepest = nBottom;
+ }
+ aVerSBar.Hide();
+ aOutputSize.Width() += nVerSBarWidth;
+ aVirtOutputSize.Height() = nDeepest;
+ aVerSBar.SetThumbPos( 0 );
+ Range aRange;
+ aRange.Max() = nDeepest - 1;
+ aVerSBar.SetRange( aRange );
+ if( aHorSBar.IsVisible() )
+ {
+ Size aSize( aHorSBar.GetSizePixel());
+ aSize.Width() += nVerSBarWidth;
+ aHorSBar.SetSizePixel( aSize );
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+// blendet Scrollbars aus, wenn sie nicht mehr benoetigt werden
+void SvImpIconView::CheckScrollBars()
+{
+ CheckVerScrollBar();
+ if( CheckHorScrollBar() )
+ CheckVerScrollBar();
+}
+
+
+void __EXPORT SvImpIconView::GetFocus()
+{
+ if( pCursor )
+ {
+ pView->SetEntryFocus( pCursor, TRUE );
+ ShowCursor( TRUE );
+ }
+}
+
+void __EXPORT SvImpIconView::LoseFocus()
+{
+ StopEditTimer();
+ if( pCursor )
+ pView->SetEntryFocus( pCursor,FALSE );
+ ShowCursor( FALSE );
+}
+
+void SvImpIconView::UpdateAll()
+{
+ AdjustScrollBars();
+ pImpCursor->Clear();
+ pView->Invalidate();
+}
+
+void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData )
+{
+ Point aPos( GetEntryPos( pEntry ) );
+ PaintEntry( pEntry, aPos, pViewData );
+}
+
+void SvImpIconView::PaintEmphasis( const Rectangle& rRect, BOOL bSelected,
+ BOOL bInUse, BOOL bCursored,
+ OutputDevice* pOut )
+{
+ // HACK fuer D&D
+ if( nFlags & F_NO_EMPHASIS )
+ return;
+
+ if( !pOut )
+ pOut = pView;
+
+ // Selektion painten
+ Color aOldFillColor = pOut->GetFillColor();
+ Color aOldLineColor = pOut->GetLineColor();
+ Color aNewColor;
+ const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings();
+ if( bSelected )
+ {
+ aNewColor = rStyleSettings.GetHighlightColor();
+ }
+ else
+ {
+#ifndef OS2
+ aNewColor =rStyleSettings.GetFieldColor();
+#else
+ aNewColor = pOut->GetBackground().GetColor();
+#endif
+ }
+
+ if( bCursored )
+ {
+ pOut->SetLineColor( Color( COL_BLACK ) );
+ }
+ pOut->SetFillColor( aNewColor );
+ pOut->DrawRect( rRect );
+ pOut->SetFillColor( aOldFillColor );
+ pOut->SetLineColor( aOldLineColor );
+}
+
+void SvImpIconView::PaintItem( const Rectangle& rRect,
+ SvLBoxItem* pItem, SvLBoxEntry* pEntry, USHORT nPaintFlags,
+ OutputDevice* pOut )
+{
+ if( nViewMode == VIEWMODE_ICON && pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
+ {
+ const String& rStr = ((SvLBoxString*)pItem)->GetText();
+ DrawText( pOut, rRect, rStr, DRAWTEXT_FLAGS );
+ }
+ else
+ {
+ Point aPos( rRect.TopLeft() );
+ const Size& rSize = GetItemSize( pView, pEntry, pItem );
+ if( nPaintFlags & PAINTFLAG_HOR_CENTERED )
+ aPos.X() += (rRect.GetWidth() - rSize.Width() ) / 2;
+ if( nPaintFlags & PAINTFLAG_VER_CENTERED )
+ aPos.Y() += (rRect.GetHeight() - rSize.Height() ) / 2;
+ pItem->Paint( aPos, *(SvLBox*)pOut, 0, pEntry );
+ }
+}
+
+void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos,
+ SvIcnVwDataEntry* pViewData, OutputDevice* pOut )
+{
+ if( !pView->IsUpdateMode() )
+ return;
+
+ if( !pOut )
+ pOut = pView;
+
+ SvLBoxContextBmp* pBmpItem;
+
+ pView->PreparePaint( pEntry );
+
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+
+ SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+
+ BOOL bSelected = pViewData->IsSelected();
+ BOOL bCursored = pViewData->IsCursored();
+ BOOL bInUse = pEntry->HasInUseEmphasis();
+
+ Font aTempFont( pOut->GetFont() );
+ // waehrend D&D nicht die Fontfarbe wechseln, da sonst auch die
+ // Emphasis gezeichnet werden muss! (weisser Adler auf weissem Grund)
+ if( bSelected && !(nFlags & F_NO_EMPHASIS) )
+ {
+ const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings();
+ Font aNewFont( aTempFont );
+ aNewFont.SetColor( rStyleSettings.GetHighlightTextColor() );
+ pOut->SetFont( aNewFont );
+ }
+ Rectangle aTextRect( CalcTextRect(pEntry,pStringItem,&rPos,FALSE,pViewData));
+ Rectangle aBmpRect( CalcBmpRect(pEntry, &rPos, pViewData ) );
+
+ switch( nViewMode )
+ {
+ case VIEWMODE_ICON:
+ pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ PaintEmphasis( aBmpRect, bSelected, bInUse, bCursored, pOut );
+ PaintItem( aBmpRect, pBmpItem, pEntry,
+ PAINTFLAG_HOR_CENTERED | PAINTFLAG_VER_CENTERED, pOut );
+ PaintEmphasis( aTextRect, bSelected, FALSE, FALSE, pOut );
+ PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_HOR_CENTERED, pOut );
+ break;
+
+ case VIEWMODE_NAME:
+ pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ PaintEmphasis( aBmpRect, bSelected, bInUse, bCursored, pOut );
+ PaintItem( aBmpRect, pBmpItem, pEntry, PAINTFLAG_VER_CENTERED, pOut );
+ PaintEmphasis( aTextRect, bSelected, FALSE, FALSE, pOut );
+ PaintItem( aTextRect, pStringItem, pEntry,PAINTFLAG_VER_CENTERED, pOut );
+ break;
+
+ case VIEWMODE_TEXT:
+ PaintEmphasis( aTextRect, bSelected, FALSE, bCursored, pOut );
+ PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_VER_CENTERED, pOut );
+ break;
+ }
+ pOut->SetFont( aTempFont );
+}
+
+void SvImpIconView::SetEntryPos( SvLBoxEntry* pEntry, const Point& rPos,
+ BOOL bAdjustAtGrid, BOOL bCheckScrollBars )
+{
+ if( pModel->GetParent(pEntry) == pCurParent )
+ {
+ ShowCursor( FALSE );
+ long nVirtHeightOffs = 0;
+ long nVirtWidthOffs = 0;
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ Rectangle aBoundRect( GetBoundingRect( pEntry, pViewData ));
+ pView->Invalidate( aBoundRect );
+ ToTop( pEntry );
+ if( rPos != aBoundRect.TopLeft() )
+ {
+ Point aGridOffs = pViewData->aGridRect.TopLeft() -
+ pViewData->aRect.TopLeft();
+ pImpCursor->Clear();
+ nFlags &= ~F_GRID_INSERT;
+ aBoundRect.SetPos( rPos );
+ pViewData->aRect = aBoundRect;
+ pViewData->aGridRect.SetPos( rPos + aGridOffs );
+ AdjustVirtSize( aBoundRect );
+ }
+ //HACK(Billigloesung, die noch verbessert werden muss)
+ if( bAdjustAtGrid )
+ {
+ AdjustAtGrid( pEntry );
+ ToTop( pEntry );
+ }
+ if( bCheckScrollBars && pView->IsUpdateMode() )
+ CheckScrollBars();
+
+ PaintEntry( pEntry, pViewData );
+ ShowCursor( TRUE );
+ }
+}
+
+void SvImpIconView::ViewDataInitialized( SvLBoxEntry*)
+{
+}
+
+void SvImpIconView::ModelHasEntryInvalidated( SvListEntry* pEntry )
+{
+ if( pEntry == pCursor )
+ ShowCursor( FALSE );
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ pView->Invalidate( pViewData->aRect );
+
+ if( nFlags & F_GRIDMODE )
+ Center( (SvLBoxEntry*)pEntry, pViewData );
+ else
+ pViewData->aRect.SetSize( CalcBoundingSize(
+ (SvLBoxEntry*)pEntry, pViewData ) );
+
+ ViewDataInitialized( (SvLBoxEntry*)pEntry );
+ pView->Invalidate( pViewData->aRect );
+ if( pEntry == pCursor )
+ ShowCursor( TRUE );
+}
+
+
+void SvImpIconView::InvalidateEntry( SvLBoxEntry* pEntry )
+{
+ const Rectangle& rRect = GetBoundingRect( pEntry );
+ pView->Invalidate( rRect );
+}
+
+void SvImpIconView::SetNoSelection()
+{
+}
+
+void SvImpIconView::SetDragDropMode( DragDropMode )
+{
+}
+
+void SvImpIconView::SetSelectionMode( SelectionMode )
+{
+}
+
+BOOL SvImpIconView::IsEntryInView( SvLBoxEntry* )
+{
+ return FALSE;
+}
+
+SvLBoxEntry* SvImpIconView::GetDropTarget( const Point& rPos )
+{
+ Point aDocPos( rPos );
+ CalcDocPos( aDocPos );
+ SvLBoxEntry* pTarget = GetEntry( aDocPos );
+ if( !pTarget || !pTarget->HasChilds() )
+ pTarget = pCurParent;
+ return pTarget;
+}
+
+SvLBoxEntry* SvImpIconView::GetEntry( const Point& rDocPos )
+{
+ CheckBoundingRects();
+ SvLBoxEntry* pTarget = 0;
+ // Z-Order-Liste vom Ende her absuchen
+ USHORT nCount = pZOrderList->Count();
+ while( nCount )
+ {
+ nCount--;
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCount));
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( pViewData->aRect.IsInside( rDocPos ) )
+ {
+ pTarget = pEntry;
+ break;
+ }
+ }
+ return pTarget;
+}
+
+SvLBoxEntry* SvImpIconView::GetNextEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry )
+{
+ CheckBoundingRects();
+ SvLBoxEntry* pTarget = 0;
+ USHORT nStartPos = pZOrderList->GetPos( (void*)pCurEntry );
+ if( nStartPos != USHRT_MAX )
+ {
+ USHORT nCount = pZOrderList->Count();
+ for( USHORT nCur = nStartPos+1; nCur < nCount; nCur++ )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCur));
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( pViewData->aRect.IsInside( rDocPos ) )
+ {
+ pTarget = pEntry;
+ break;
+ }
+ }
+ }
+ return pTarget;
+}
+
+SvLBoxEntry* SvImpIconView::GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry )
+{
+ CheckBoundingRects();
+ SvLBoxEntry* pTarget = 0;
+ USHORT nStartPos = pZOrderList->GetPos( (void*)pCurEntry );
+ if( nStartPos != USHRT_MAX && nStartPos != 0 )
+ {
+ nStartPos--;
+ do
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nStartPos));
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( pViewData->aRect.IsInside( rDocPos ) )
+ {
+ pTarget = pEntry;
+ break;
+ }
+ } while( nStartPos > 0 );
+ }
+ return pTarget;
+}
+
+
+Point SvImpIconView::GetEntryPos( SvLBoxEntry* pEntry )
+{
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ DBG_ASSERT(pViewData,"Entry not in model")
+ return pViewData->aRect.TopLeft();
+}
+
+const Rectangle& SvImpIconView::GetBoundingRect( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData )
+{
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+ DBG_ASSERT(pViewData,"Entry not in model")
+ if( !IsBoundingRectValid( pViewData->aRect ))
+ FindBoundingRect( pEntry, pViewData );
+ return pViewData->aRect;
+}
+
+void SvImpIconView::SetSpaceBetweenEntries( long nHor, long nVer )
+{
+ nHorDist = nHor;
+ nVerDist = nVer;
+}
+
+Rectangle SvImpIconView::CalcBmpRect( SvLBoxEntry* pEntry, const Point* pPos,
+ SvIcnVwDataEntry* pViewData )
+{
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+
+ Rectangle aBound = GetBoundingRect( pEntry, pViewData );
+ if( pPos )
+ aBound.SetPos( *pPos );
+ Point aPos( aBound.TopLeft() );
+
+ switch( nViewMode )
+ {
+ case VIEWMODE_ICON:
+ {
+ aPos.X() += ( aBound.GetWidth() - nMaxBmpWidth ) / 2;
+ Size aSize( nMaxBmpWidth, nMaxBmpHeight );
+ // das Bitmap-Rechteck soll nicht das TextRect beruehren
+ aSize.Height() -= 3;
+ return Rectangle( aPos, aSize );
+ }
+
+ case VIEWMODE_NAME:
+ return Rectangle( aPos,
+ Size( nMaxBmpWidth, aBound.GetHeight() ));
+
+ case VIEWMODE_TEXT:
+ return Rectangle( aPos, aBound.GetSize() );
+
+ default:
+ {
+ Rectangle aRect;
+ return aRect;
+ }
+ }
+}
+
+Rectangle SvImpIconView::CalcTextRect( SvLBoxEntry* pEntry,
+ SvLBoxString* pItem, const Point* pPos, BOOL bForInplaceEdit,
+ SvIcnVwDataEntry* pViewData )
+{
+ long nBmpHeight, nBmpWidth;
+
+ if( !pItem )
+ pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+
+ Size aTextSize( GetItemSize( pView, pEntry, pItem, pViewData ));
+ aTextSize.Width() += 2*LROFFS_TEXT;
+
+ Size aContextBmpSize(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry));
+ Rectangle aBound = GetBoundingRect( pEntry, pViewData );
+ if( pPos )
+ aBound.SetPos( *pPos );
+ Point aPos( aBound.TopLeft() );
+
+ switch( nViewMode )
+ {
+ case VIEWMODE_ICON:
+ nBmpHeight = aContextBmpSize.Height();
+ if( nBmpHeight < nMaxBmpHeight )
+ nBmpHeight = nMaxBmpHeight;
+ aPos.Y() += nBmpHeight;
+
+ // beim Inplace-Editieren, spendieren wir ein bisschen mehr Platz
+ if( bForInplaceEdit )
+ {
+ // 20% rauf
+ long nMinWidth = (( (aContextBmpSize.Width()*10) / 100 ) * 2 ) +
+ aContextBmpSize.Width();
+ if( nMinWidth > aBound.GetWidth() )
+ nMinWidth = aBound.GetWidth();
+
+ if( aTextSize.Width() < nMinWidth )
+ aTextSize.Width() = nMinWidth;
+
+ // beim Inplace-Ed. darfs auch untere Eintraege ueberlappen
+ Rectangle aMaxGridTextRect = CalcMaxTextRect(pEntry, pViewData);
+#ifndef VCL
+ aMaxGridTextRect.Bottom() = LONG_MAX - 1;
+ aMaxGridTextRect = GetTextRect( pView, aMaxGridTextRect,pItem->GetText(), DRAWTEXT_FLAGS );
+#endif
+ Size aOptSize = aMaxGridTextRect.GetSize();
+ if( aOptSize.Height() > aTextSize.Height() )
+ aTextSize.Height() = aOptSize.Height();
+ }
+
+
+ aPos.X() += ( aBound.GetWidth() - aTextSize.Width() ) / 2;
+ break;
+
+ case VIEWMODE_NAME:
+ nBmpWidth = aContextBmpSize.Width();
+ if( nBmpWidth < nMaxBmpWidth )
+ nBmpWidth = nMaxBmpWidth;
+ aPos.X() += nBmpWidth;
+ // vertikal ausrichten
+ aPos.Y() += ( nBmpWidth - aTextSize.Height() ) / 2;
+ break;
+ }
+
+ Rectangle aRect( aPos, aTextSize );
+// KNALLT BEIM D&D, WENN GECLIPPT WIRD (In DrawText von Thomas)
+// ClipAtVirtOutRect( aRect );
+ return aRect;
+}
+
+
+long SvImpIconView::CalcBoundingWidth( SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData ) const
+{
+ DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps")
+ DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text")
+ long nStringWidth = GetItemSize( pView, pEntry, pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Width();
+ nStringWidth += 2*LROFFS_TEXT;
+ long nBmpWidth = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Width();
+ long nWidth = 0;
+
+ switch( nViewMode )
+ {
+ case VIEWMODE_ICON:
+ nWidth = Max( nStringWidth, nBmpWidth );
+ nWidth = Max( nWidth, nMaxBmpWidth );
+ break;
+
+ case VIEWMODE_NAME:
+ nWidth = Max( nBmpWidth, nMaxBmpWidth );
+ nWidth += NAMEVIEW_OFFS_BMP_STRING; // Abstand Bitmap String
+ nWidth += nStringWidth;
+ break;
+
+ case VIEWMODE_TEXT:
+ nWidth = nStringWidth;
+ break;
+ }
+ return nWidth;
+}
+
+long SvImpIconView::CalcBoundingHeight( SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData ) const
+{
+ DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps")
+ DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text")
+ long nStringHeight = GetItemSize(pView,pEntry,pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Height();
+ long nBmpHeight = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Height();
+ long nHeight = 0;
+
+ switch( nViewMode )
+ {
+ case VIEWMODE_ICON:
+ nHeight = Max( nBmpHeight, nMaxBmpHeight );
+ nHeight += ICONVIEW_OFFS_BMP_STRING; // Abstand Bitmap String
+ nHeight += nStringHeight;
+ break;
+
+ case VIEWMODE_NAME:
+ nHeight = Max( nBmpHeight, nMaxBmpHeight );
+ nHeight = Max( nHeight, nStringHeight );
+ break;
+
+ case VIEWMODE_TEXT:
+ nHeight = nStringHeight;
+ break;
+ }
+ if( nHeight > nMaxBoundHeight )
+ {
+ ((SvImpIconView*)this)->nMaxBoundHeight = nHeight;
+ ((SvImpIconView*)this)->aHorSBar.SetLineSize( nHeight / 2 );
+ ((SvImpIconView*)this)->aVerSBar.SetLineSize( nHeight / 2 );
+ }
+ return nHeight;
+}
+
+Size SvImpIconView::CalcBoundingSize( SvLBoxEntry* pEntry,
+ SvIcnVwDataEntry* pViewData ) const
+{
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+ return Size( CalcBoundingWidth(pEntry,pViewData),
+ CalcBoundingHeight(pEntry,pViewData) );
+}
+
+void SvImpIconView::RecalcAllBoundingRects()
+{
+ nMaxBoundHeight = 0;
+ pZOrderList->Remove(0, pZOrderList->Count() );
+ SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
+ while( pEntry )
+ {
+ FindBoundingRect( pEntry );
+ pZOrderList->Insert( pEntry, pZOrderList->Count() );
+ pEntry = pModel->NextSibling( pEntry );
+ }
+ bMustRecalcBoundingRects = FALSE;
+ AdjustScrollBars();
+}
+
+void SvImpIconView::RecalcAllBoundingRectsSmart()
+{
+ nMaxBoundHeight = 0;
+ pZOrderList->Remove(0, pZOrderList->Count() );
+ SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
+ while( pEntry )
+ {
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( IsBoundingRectValid( pViewData->aRect ))
+ {
+ Size aBoundSize( pViewData->aRect.GetSize() );
+ if( aBoundSize.Height() > nMaxBoundHeight )
+ nMaxBoundHeight = aBoundSize.Height();
+ pZOrderList->Insert( pEntry, pZOrderList->Count() );
+ }
+ else
+ {
+ FindBoundingRect( pEntry, pViewData );
+ }
+ pZOrderList->Insert( pEntry, pZOrderList->Count() );
+ pEntry = pModel->NextSibling( pEntry );
+ }
+ AdjustScrollBars();
+}
+
+void SvImpIconView::UpdateBoundingRects()
+{
+ SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
+ while( pEntry )
+ {
+ GetBoundingRect( pEntry );
+ pEntry = pModel->NextSibling( pEntry );
+ }
+}
+
+void SvImpIconView::FindBoundingRect( SvLBoxEntry* pEntry,
+ SvIcnVwDataEntry* pViewData )
+{
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+
+ Size aSize( CalcBoundingSize( pEntry, pViewData ) );
+ Point aPos;
+
+ DBG_ASSERT(!pViewData->IsEntryPosLocked(),"Locked entry pos in FindBoundingRect");
+ // damits in der IconView nicht drunter & drueber geht
+ if( pViewData->IsEntryPosLocked() && IsBoundingRectValid(pViewData->aRect) )
+ {
+ AdjustVirtSize( pViewData->aRect );
+ return;
+ }
+
+ aPos = FindNextEntryPos( aSize );
+
+ if( nFlags & F_GRIDMODE )
+ {
+ Rectangle aGridRect( aPos, Size(nGridDX, nGridDY) );
+ pViewData->aGridRect = aGridRect;
+ Center( pEntry, pViewData );
+ AdjustVirtSize( pViewData->aRect );
+ pImpCursor->SetGridUsed( pViewData->aRect );
+ }
+ else
+ {
+ pViewData->aRect = Rectangle( aPos, aSize );
+ AdjustVirtSize( pViewData->aRect );
+ }
+}
+
+
+void SvImpIconView::SetCursor( SvLBoxEntry* pEntry )
+{
+ if( pEntry == pCursor )
+ return;
+
+ ShowCursor( FALSE );
+ if( pCursor )
+ {
+ pView->SetEntryFocus( pCursor, FALSE );
+ if( pView->GetSelectionMode() == SINGLE_SELECTION )
+ pView->Select( pCursor, FALSE );
+ }
+ pCursor = pEntry;
+ ToTop( pCursor );
+ if( pCursor )
+ {
+ pView->SetEntryFocus(pCursor, TRUE );
+ if( pView->GetSelectionMode() == SINGLE_SELECTION )
+ pView->Select( pCursor, TRUE );
+ ShowCursor( TRUE );
+ }
+}
+
+
+void SvImpIconView::ShowCursor( BOOL bShow )
+{
+ if( !pCursor || !bShow || !pView->HasFocus() )
+ {
+ pView->HideFocus();
+ return;
+ }
+ Rectangle aRect ( CalcFocusRect( pCursor ) );
+ pView->ShowFocus( aRect );
+}
+
+
+void SvImpIconView::HideDDIcon()
+{
+ pView->Update();
+ ImpHideDDIcon();
+ pDDBufDev = pDDDev;
+ pDDDev = 0;
+}
+
+void SvImpIconView::ImpHideDDIcon()
+{
+ if( pDDDev )
+ {
+ Size aSize( pDDDev->GetOutputSizePixel() );
+ // pView restaurieren
+ pView->DrawOutDev( aDDLastRectPos, aSize, Point(), aSize, *pDDDev );
+ }
+}
+
+
+void SvImpIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix )
+{
+ pView->Update();
+ if( pRefEntry != pDDRefEntry )
+ {
+ DELETEZ(pDDDev);
+ DELETEZ(pDDBufDev);
+ }
+ BOOL bSelected = pView->SvListView::Select( pRefEntry, FALSE );
+ if( !pDDDev )
+ {
+ if( pDDBufDev )
+ {
+ // nicht bei jedem Move ein Device anlegen, da dies besonders
+ // auf Remote-Clients zu langsam ist
+ pDDDev = pDDBufDev;
+ pDDBufDev = 0;
+ }
+ else
+ {
+ pDDDev = new VirtualDevice( *pView );
+ pDDDev->SetFont( pView->GetFont() );
+ }
+ }
+ else
+ {
+ ImpHideDDIcon();
+ }
+ const Rectangle& rRect = GetBoundingRect( pRefEntry );
+ pDDDev->SetOutputSizePixel( rRect.GetSize() );
+
+ Point aPos( rPosPix );
+ CalcDocPos( aPos );
+
+ Size aSize( pDDDev->GetOutputSizePixel() );
+ pDDRefEntry = pRefEntry;
+ aDDLastEntryPos = aPos;
+ aDDLastRectPos = aPos;
+
+ // Hintergrund sichern
+ pDDDev->DrawOutDev( Point(), aSize, aPos, aSize, *pView );
+ // Icon in pView malen
+ nFlags |= F_NO_EMPHASIS;
+ PaintEntry( pRefEntry, aPos );
+ nFlags &= ~F_NO_EMPHASIS;
+ if( bSelected )
+ pView->SvListView::Select( pRefEntry, TRUE );
+}
+
+void SvImpIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix )
+{
+/* In Notfaellen folgenden flackernden Code aktivieren:
+
+ HideDDIcon();
+ ShowDDIcon( pRefEntry, rPosPix );
+ return;
+*/
+ if( !pDDDev )
+ {
+ ShowDDIcon( pRefEntry, rPosPix );
+ return;
+ }
+
+ if( pRefEntry != pDDRefEntry )
+ {
+ HideDDIcon();
+ ShowDDIcon( pRefEntry, rPosPix );
+ return;
+ }
+
+ Point aEmptyPoint;
+
+ Point aCurEntryPos( rPosPix );
+ CalcDocPos( aCurEntryPos );
+
+ const Rectangle& rRect = GetBoundingRect( pRefEntry );
+ Size aEntrySize( rRect.GetSize() );
+ Rectangle aPrevEntryRect( aDDLastEntryPos, aEntrySize );
+ Rectangle aCurEntryRect( aCurEntryPos, aEntrySize );
+
+ if( !aPrevEntryRect.IsOver( aCurEntryRect ) )
+ {
+ HideDDIcon();
+ ShowDDIcon( pRefEntry, rPosPix );
+ return;
+ }
+
+ // Ueberlappung des neuen und alten D&D-Pointers!
+
+ Rectangle aFullRect( aPrevEntryRect.Union( aCurEntryRect ) );
+ if( !pDDTempDev )
+ {
+ pDDTempDev = new VirtualDevice( *pView );
+ pDDTempDev->SetFont( pView->GetFont() );
+ }
+
+ Size aFullSize( aFullRect.GetSize() );
+ Point aFullPos( aFullRect.TopLeft() );
+
+ pDDTempDev->SetOutputSizePixel( aFullSize );
+
+ // Hintergrund (mit dem alten D&D-Pointer!) sichern
+ pDDTempDev->DrawOutDev( aEmptyPoint, aFullSize, aFullPos, aFullSize, *pView );
+ // den alten Buffer in den neuen Buffer pasten
+ aDDLastRectPos = aDDLastRectPos - aFullPos;
+
+ pDDTempDev->DrawOutDev(
+ aDDLastRectPos,
+ pDDDev->GetOutputSizePixel(),
+ aEmptyPoint,
+ pDDDev->GetOutputSizePixel(),
+ *pDDDev );
+
+ // Swap
+ VirtualDevice* pTemp = pDDDev;
+ pDDDev = pDDTempDev;
+ pDDTempDev = pTemp;
+
+ // in den restaurierten Hintergrund den neuen D&D-Pointer zeichnen
+ pDDTempDev->SetOutputSizePixel( pDDDev->GetOutputSizePixel() );
+ pDDTempDev->DrawOutDev(
+ aEmptyPoint, aFullSize, aEmptyPoint, aFullSize, *pDDDev );
+ Point aRelPos = aCurEntryPos - aFullPos;
+ nFlags |= F_NO_EMPHASIS;
+ PaintEntry( pRefEntry, aRelPos, 0, pDDTempDev );
+ nFlags &= ~F_NO_EMPHASIS;
+
+ aDDLastRectPos = aFullPos;
+ aDDLastEntryPos = aCurEntryPos;
+
+ pView->DrawOutDev(
+ aDDLastRectPos,
+ pDDDev->GetOutputSizePixel(),
+ aEmptyPoint,
+ pDDDev->GetOutputSizePixel(),
+ *pDDTempDev );
+
+ BOOL bSelected = pView->SvListView::Select( pRefEntry, FALSE );
+ if( bSelected )
+ pView->SvListView::Select( pRefEntry, TRUE );
+}
+
+void SvImpIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, BOOL bShow )
+{
+ CheckBoundingRects();
+ Rectangle aRect;
+ if( pEntry != pCurParent &&
+ (pEntry->HasChilds() || pEntry->HasChildsOnDemand()) )
+ aRect = CalcBmpRect( pEntry );
+ else
+ {
+ aRect.SetSize( aOutputSize );
+ const MapMode& rMapMode = pView->GetMapMode();
+ Point aOrigin( rMapMode.GetOrigin());
+ aOrigin *= -1; // in Doc-Koord wandeln
+ aRect.SetPos( aOrigin );
+ aRect.Left()++; aRect.Top()++;
+ aRect.Right()--; aRect.Bottom()--;
+ }
+ ImpDrawXORRect( aRect );
+}
+
+BOOL SvImpIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewPar, ULONG& rNewChildPos )
+{
+ if( pTarget == pCurParent && pModel->GetParent(pEntry) == pCurParent )
+ {
+ // D&D innerhalb einer Childlist
+ StopEditTimer();
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ Size aSize( pViewData->aRect.GetSize() );
+ Point aNewPos = FindNextEntryPos( aSize );
+ AdjustVirtSize( Rectangle( aNewPos, aSize ) );
+ SetEntryPos( pEntry, aNewPos, FALSE, TRUE );
+ return FALSE;
+ }
+ return pView->SvLBox::NotifyMoving(pTarget,pEntry,rpNewPar,rNewChildPos);
+}
+
+BOOL SvImpIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos )
+{
+ return pView->SvLBox::NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos);
+}
+
+void SvImpIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo)
+{
+ SvLBoxEntry* pCurEntry = GetCurEntry();
+ Point aEntryPos;
+ if( pCurEntry )
+ {
+ aEntryPos = rPos;
+ aEntryPos -= GetEntryPos( pCurEntry );
+ }
+ pInfo->nMouseRelX = aEntryPos.X();
+ pInfo->nMouseRelY = aEntryPos.Y();
+}
+
+void SvImpIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo )
+{
+ Point aDropPos( rPos );
+ aDropPos.X() -= pInfo->nMouseRelX;
+ aDropPos.Y() -= pInfo->nMouseRelY;
+ SetNextEntryPos( aDropPos );
+}
+
+void SvImpIconView::InvalidateBoundingRect( SvLBoxEntry* pEntry )
+{
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ InvalidateBoundingRect( pViewData->aRect );
+}
+
+void SvImpIconView::PrepareCommandEvent( const CommandEvent& rCEvt )
+{
+ aMouseMoveTimer.Stop();
+ StopEditTimer();
+ nFlags |= F_CMD_ARRIVED;
+ SvLBoxEntry* pEntry = pView->GetEntry( rCEvt.GetMousePosPixel(), TRUE );
+ if( (nFlags & F_DOWN_CTRL) && pEntry && !pView->IsSelected(pEntry) )
+ pView->Select( pEntry, TRUE );
+ nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
+}
+
+void SvImpIconView::Command( const CommandEvent& rCEvt )
+{
+ PrepareCommandEvent( rCEvt );
+ if( rCEvt.GetCommand() == COMMAND_STARTDRAG )
+ {
+ nFlags |= F_DRAG_SOURCE;
+ if( GetSelectionCount() )
+ {
+ ShowCursor( FALSE );
+ pView->BeginDrag( rCEvt.GetMousePosPixel() );
+ ShowCursor( TRUE );
+ }
+ nFlags &= (~F_DRAG_SOURCE);
+ }
+}
+
+void SvImpIconView::ToTop( SvLBoxEntry* pEntry )
+{
+ DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"ToTop:ZOrder?");
+ if( pZOrderList->GetObject( pZOrderList->Count() -1 ) != pEntry )
+ {
+ USHORT nPos = pZOrderList->GetPos( (void*)pEntry );
+ pZOrderList->Remove( nPos, 1 );
+ pZOrderList->Insert( pEntry, pZOrderList->Count() );
+ }
+}
+
+void SvImpIconView::SetCurParent( SvLBoxEntry* pNewParent )
+{
+ Clear();
+ pCurParent = pNewParent;
+ ImpArrange();
+}
+
+void SvImpIconView::ClipAtVirtOutRect( Rectangle& rRect ) const
+{
+ if( rRect.Bottom() >= aVirtOutputSize.Height() )
+ rRect.Bottom() = aVirtOutputSize.Height() - 1;
+ if( rRect.Right() >= aVirtOutputSize.Width() )
+ rRect.Right() = aVirtOutputSize.Width() - 1;
+ if( rRect.Top() < 0 )
+ rRect.Top() = 0;
+ if( rRect.Left() < 0 )
+ rRect.Left() = 0;
+}
+
+// rRect: Bereich des Dokumentes (in Dokumentkoordinaten), der
+// sichtbar gemacht werden soll.
+// bScrBar == TRUE: Das Rect wurde aufgrund eines ScrollBar-Events berechnet
+
+void SvImpIconView::MakeVisible( const Rectangle& rRect, BOOL bScrBar )
+{
+ Rectangle aRect( rRect );
+ ClipAtVirtOutRect( aRect );
+ MapMode aMapMode( pView->GetMapMode() );
+ Point aOrigin( aMapMode.GetOrigin() );
+ // in Dokumentkoordinate umwandeln
+ aOrigin *= -1;
+
+ Rectangle aOutputArea( aOrigin, aOutputSize );
+ if( aOutputArea.IsInside( aRect ) )
+ return; // ist schon sichtbar
+
+ long nDy;
+ if( aRect.Top() < aOutputArea.Top() )
+ {
+ // nach oben scrollen (nDy < 0)
+ nDy = aRect.Top() - aOutputArea.Top();
+ }
+ else if( aRect.Bottom() > aOutputArea.Bottom() )
+ {
+ // nach unten scrollen (nDy > 0)
+ nDy = aRect.Bottom() - aOutputArea.Bottom();
+ }
+ else
+ nDy = 0;
+
+ long nDx;
+ if( aRect.Left() < aOutputArea.Left() )
+ {
+ // nach links scrollen (nDx < 0)
+ nDx = aRect.Left() - aOutputArea.Left();
+ }
+ else if( aRect.Right() > aOutputArea.Right() )
+ {
+ // nach rechts scrollen (nDx > 0)
+ nDx = aRect.Right() - aOutputArea.Right();
+ }
+ else
+ nDx = 0;
+
+ aOrigin.X() += nDx;
+ aOrigin.Y() += nDy;
+ aOutputArea.SetPos( aOrigin );
+
+ pView->Update();
+
+ // Origin fuer SV invertieren (damit wir in
+ // Dokumentkoordinaten scrollen/painten koennen)
+ aOrigin *= -1;
+ aMapMode.SetOrigin( aOrigin );
+ pView->SetMapMode( aMapMode );
+
+ // in umgekehrte Richtung scrollen!
+ pView->Control::Scroll( -nDx, -nDy, aOutputArea, TRUE );
+ if( aHorSBar.IsVisible() || aVerSBar.IsVisible() )
+ {
+ if( !bScrBar )
+ {
+ aOrigin *= -1;
+ // Thumbs korrigieren
+ if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X())
+ aHorSBar.SetThumbPos( aOrigin.X() );
+ if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y())
+ aVerSBar.SetThumbPos( aOrigin.Y() );
+ }
+ }
+ // pruefen, ob ScrollBars noch benoetigt werden
+ CheckScrollBars();
+ pView->Update();
+}
+
+
+SvLBoxEntry* SvImpIconView::GetNewCursor()
+{
+ SvLBoxEntry* pNewCursor;
+ if( pCursor )
+ {
+ pNewCursor = pImpCursor->GoLeftRight( pCursor, FALSE );
+ if( !pNewCursor )
+ {
+ pNewCursor = pImpCursor->GoLeftRight( pCursor, TRUE );
+ if( !pNewCursor )
+ {
+ pNewCursor = pImpCursor->GoUpDown( pCursor, FALSE );
+ if( !pNewCursor )
+ pNewCursor = pImpCursor->GoUpDown( pCursor, TRUE );
+ }
+ }
+ }
+ else
+ pNewCursor = pModel->FirstChild( pCurParent );
+ DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"GetNewCursor failed");
+ return pNewCursor;
+}
+
+
+USHORT SvImpIconView:: GetSelectionCount() const
+{
+ USHORT nSelected = 0;
+ SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent);
+ while( pEntry )
+ {
+ if( pView->IsSelected( pEntry ) )
+ nSelected++;
+ pEntry = pModel->NextSibling( pEntry );
+ }
+ return nSelected;
+}
+
+
+void SvImpIconView::ToggleSelection( SvLBoxEntry* pEntry )
+{
+ BOOL bSel;
+ if( pView->IsSelected( pEntry ) )
+ bSel = FALSE;
+ else
+ bSel = TRUE;
+ pView->Select( pEntry, bSel );
+}
+
+void SvImpIconView::DeselectAllBut( SvLBoxEntry* pThisEntryNot )
+{
+ ClearSelectedRectList();
+ SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
+ while( pEntry )
+ {
+ if( pEntry != pThisEntryNot && pView->IsSelected( pEntry ))
+ pView->Select( pEntry, FALSE );
+ pEntry = pModel->NextSibling( pEntry );
+ }
+}
+
+#define ICN_ROWS 50
+#define ICN_COLS 30
+
+ImpIcnCursor::ImpIcnCursor( SvImpIconView* pOwner )
+{
+ pView = pOwner;
+ pColumns = 0;
+ pRows = 0;
+ pCurEntry = 0;
+ nDeltaWidth = 0;
+ nDeltaHeight= 0;
+ nCols = 0;
+ nRows = 0;
+ nGridCols = 0;
+ nGridRows = 0;
+ pGridMap = 0;
+}
+
+ImpIcnCursor::~ImpIcnCursor()
+{
+ delete[] pColumns;
+ delete[] pRows;
+ delete pGridMap;
+}
+
+USHORT ImpIcnCursor::GetSortListPos( SvPtrarr* pList, long nValue,
+ int bVertical )
+{
+ USHORT nCount = (USHORT)pList->Count();
+ if( !nCount )
+ return 0;
+
+ USHORT nCurPos = 0;
+ long nPrevValue = LONG_MIN;
+ while( nCount )
+ {
+ const Rectangle& rRect=
+ pView->GetBoundingRect((SvLBoxEntry*)(pList->GetObject(nCurPos)));
+ long nCurValue;
+ if( bVertical )
+ nCurValue = rRect.Top();
+ else
+ nCurValue = rRect.Left();
+ if( nValue >= nPrevValue && nValue <= nCurValue )
+ return (USHORT)nCurPos;
+ nPrevValue = nCurValue;
+ nCount--;
+ nCurPos++;
+ }
+ return pList->Count();
+}
+
+void ImpIcnCursor::ImplCreate()
+{
+ pView->CheckBoundingRects();
+ DBG_ASSERT(pColumns==0&&pRows==0,"ImplCreate: Not cleared");
+
+ SetDeltas();
+
+ pColumns = new SvPtrarr[ nCols ];
+ pRows = new SvPtrarr[ nRows ];
+
+ DELETEZ(pGridMap);
+
+ SvLBoxTreeList* pModel = pView->pModel;
+ SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent );
+ while( pEntry )
+ {
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
+ // const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ Rectangle rRect( pView->CalcBmpRect( pEntry,0,pViewData ) );
+ short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight );
+ short nX = (short)( ((rRect.Left()+rRect.Right())/2) / nDeltaWidth );
+
+ // Rundungsfehler abfangen
+ if( nY >= nRows )
+ nY = nRows - 1;
+ if( nX >= nCols )
+ nX = nCols - 1;
+
+ USHORT nIns = GetSortListPos( &pColumns[nX], rRect.Top(), TRUE );
+ pColumns[ nX ].Insert( pEntry, nIns );
+
+ nIns = GetSortListPos( &pRows[nY], rRect.Left(), FALSE );
+ pRows[ nY ].Insert( pEntry, nIns );
+
+ pViewData->nX = nX;
+ pViewData->nY = nY;
+
+ pEntry = pModel->NextSibling( pEntry );
+ }
+}
+
+void ImpIcnCursor::CreateGridMap()
+{
+ if( pGridMap )
+ return;
+
+ const Size& rSize = pView->aVirtOutputSize;
+ long nWidth = rSize.Width();
+ if( nWidth < pView->nMaxVirtWidth )
+ nWidth = pView->nMaxVirtWidth;
+ nWidth -= 2*LROFFS_WINBORDER;
+ if( nWidth <= 0 )
+ nWidth = 1;
+
+ nGridDX = pView->nGridDX;
+ nGridDY = pView->nGridDY;
+
+ // Hinweis: Wegen der Abrundung bei Berechnung von nGridCols
+ // ist es moeglich, dass Eintrage nicht im Grid liegen. Diese
+ // wurden typischerweise manuell verschoben und gelockt
+ nGridCols = nWidth / nGridDX;
+ if( !nGridCols ) nGridCols = 1;
+
+ nGridRows = rSize.Height() / nGridDY;
+ // nRows nicht abrunden, da zur Vermeidung von Ueberlappungen
+ // das gesamte BoundingRect des Eintrags zur Markierung im Grid
+ // herangezogen wird.
+ if( (nGridRows * nGridDY) < rSize.Height() )
+ nGridRows++;
+ else if( !nGridRows )
+ nGridRows = 1;
+
+ //XXX
+ //nGridRows += 50; // in fuenfziger-Schritten
+
+ pGridMap = new BOOL[ nGridRows*nGridCols];
+ memset( (void*)pGridMap, 0, nGridRows*nGridCols );
+
+ SvLBoxTreeList* pModel = pView->pModel;
+ SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent );
+ while( pEntry )
+ {
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
+ const Rectangle& rRect = pViewData->aRect;
+ // nur, wenn der Entry schon plaziert ist
+ if( pView->IsBoundingRectValid( rRect ))
+ {
+ // Alle vom Eintrag beruehrten Grids kennzeichnen
+ SetGridUsed( pView->GetBoundingRect( pEntry, pViewData ) );
+ }
+ pEntry = pModel->NextSibling( pEntry );
+ }
+}
+
+BOOL ImpIcnCursor::GetGrid( const Point& rDocPos, USHORT& rGridX, USHORT& rGridY ) const
+{
+ Point aPos( rDocPos );
+ aPos.X() -= LROFFS_WINBORDER;
+ aPos.Y() -= TBOFFS_WINBORDER;
+ rGridX = (USHORT)(aPos.X() / nGridDX);
+ rGridY = (USHORT)(aPos.Y() / nGridDY);
+ BOOL bInGrid = TRUE;
+ if( rGridX >= nGridCols )
+ {
+ rGridX = nGridCols - 1;
+ bInGrid = FALSE;
+ }
+ if( rGridY >= nGridRows )
+ {
+ rGridY = nGridRows - 1;
+ if( !bInGrid )
+ return FALSE; // beide Koordinaten nicht im Grid
+ }
+ return TRUE;
+}
+
+void ImpIcnCursor::SetGridUsed( const Rectangle& rRect, BOOL bUsed )
+{
+ CreateGridMap();
+ USHORT nTLX, nTLY, nBRX, nBRY;
+
+ BOOL bTLInGrid = GetGrid( rRect.TopLeft(), nTLX, nTLY );
+ BOOL bBRInGrid = GetGrid( rRect.BottomRight(), nBRX, nBRY );
+
+ if( !bTLInGrid && !bBRInGrid )
+ return;
+
+ for( USHORT nCurY = nTLY; nCurY <= nBRY; nCurY++ )
+ {
+ for( USHORT nCurX = nTLX; nCurX <= nBRX; nCurX++ )
+ {
+ SetGridUsed( nCurX, nCurY, bUsed );
+ }
+ }
+}
+
+void ImpIcnCursor::Clear( BOOL bGridToo )
+{
+ if( pColumns )
+ {
+ delete[] pColumns;
+ delete[] pRows;
+ pColumns = 0;
+ pRows = 0;
+ pCurEntry = 0;
+ nDeltaWidth = 0;
+ nDeltaHeight = 0;
+ }
+ if( bGridToo && pGridMap )
+ {
+ DELETEZ(pGridMap);
+ nGridRows = 0;
+ nGridCols = 0;
+ }
+}
+
+SvLBoxEntry* ImpIcnCursor::SearchCol(USHORT nCol,USHORT nTop,USHORT nBottom,
+ USHORT nPref, BOOL bDown, BOOL bSimple )
+{
+ DBG_ASSERT(pCurEntry,"SearchCol: No reference entry");
+ SvPtrarr* pList = &(pColumns[ nCol ]);
+ USHORT nCount = pList->Count();
+ if( !nCount )
+ return 0;
+
+ const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry);
+
+ if( bSimple )
+ {
+ USHORT nListPos = pList->GetPos( pCurEntry );
+ DBG_ASSERT(nListPos!=0xffff,"Entry not in Col-List");
+ if( bDown )
+ {
+ while( nListPos < nCount-1 )
+ {
+ nListPos++;
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
+ const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ if( rRect.Top() > rRefRect.Top() )
+ return pEntry;
+ }
+ return 0;
+ }
+ else
+ {
+ while( nListPos )
+ {
+ nListPos--;
+ if( nListPos < nCount )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
+ const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ if( rRect.Top() < rRefRect.Top() )
+ return pEntry;
+ }
+ }
+ return 0;
+ }
+ }
+
+ if( nTop > nBottom )
+ {
+ USHORT nTemp = nTop;
+ nTop = nBottom;
+ nBottom = nTemp;
+ }
+ long nMinDistance = LONG_MAX;
+ SvLBoxEntry* pResult = 0;
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur ));
+ if( pEntry != pCurEntry )
+ {
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
+ USHORT nY = pViewData->nY;
+ if( nY >= nTop && nY <= nBottom )
+ {
+ const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ long nDistance = rRect.Top() - rRefRect.Top();
+ if( nDistance < 0 )
+ nDistance *= -1;
+ if( nDistance && nDistance < nMinDistance )
+ {
+ nMinDistance = nDistance;
+ pResult = pEntry;
+ }
+ }
+ }
+ }
+ return pResult;
+}
+
+SvLBoxEntry* ImpIcnCursor::SearchRow(USHORT nRow,USHORT nLeft,USHORT nRight,
+ USHORT nPref, BOOL bRight, BOOL bSimple )
+{
+ DBG_ASSERT(pCurEntry,"SearchRow: No reference entry");
+ SvPtrarr* pList = &(pRows[ nRow ]);
+ USHORT nCount = pList->Count();
+ if( !nCount )
+ return 0;
+
+ const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry);
+
+ if( bSimple )
+ {
+ USHORT nListPos = pList->GetPos( pCurEntry );
+ DBG_ASSERT(nListPos!=0xffff,"Entry not in Row-List");
+ if( bRight )
+ {
+ while( nListPos < nCount-1 )
+ {
+ nListPos++;
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
+ const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ if( rRect.Left() > rRefRect.Left() )
+ return pEntry;
+ }
+ return 0;
+ }
+ else
+ {
+ while( nListPos )
+ {
+ nListPos--;
+ if( nListPos < nCount )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
+ const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ if( rRect.Left() < rRefRect.Left() )
+ return pEntry;
+ }
+ }
+ return 0;
+ }
+
+ }
+ if( nRight < nLeft )
+ {
+ USHORT nTemp = nRight;
+ nRight = nLeft;
+ nLeft = nTemp;
+ }
+ long nMinDistance = LONG_MAX;
+ SvLBoxEntry* pResult = 0;
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur ));
+ if( pEntry != pCurEntry )
+ {
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
+ USHORT nX = pViewData->nX;
+ if( nX >= nLeft && nX <= nRight )
+ {
+ const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ long nDistance = rRect.Left() - rRefRect.Left();
+ if( nDistance < 0 )
+ nDistance *= -1;
+ if( nDistance && nDistance < nMinDistance )
+ {
+ nMinDistance = nDistance;
+ pResult = pEntry;
+ }
+ }
+ }
+ }
+ return pResult;
+}
+
+
+
+/*
+ Sucht ab dem uebergebenen Eintrag den naechsten rechts- bzw.
+ linksstehenden. Suchverfahren am Beispiel bRight = TRUE:
+
+ c
+ b c
+ a b c
+ S 1 1 1 ====> Suchrichtung
+ a b c
+ b c
+ c
+
+ S : Startposition
+ 1 : erstes Suchrechteck
+ a,b,c : 2., 3., 4. Suchrechteck
+*/
+
+SvLBoxEntry* ImpIcnCursor::GoLeftRight( SvLBoxEntry* pEntry, BOOL bRight )
+{
+ SvLBoxEntry* pResult;
+ pCurEntry = pEntry;
+ Create();
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
+ USHORT nY = pViewData->nY;
+ USHORT nX = pViewData->nX;
+ DBG_ASSERT(nY< nRows,"GoLeftRight:Bad column");
+ DBG_ASSERT(nX< nCols,"GoLeftRight:Bad row");
+ // Nachbar auf gleicher Zeile ?
+ if( bRight )
+ pResult = SearchRow( nY, nX ,nCols-1, nX, TRUE, TRUE );
+ else
+ pResult = SearchRow( nY, nX ,0, nX, FALSE, TRUE );
+ if( pResult )
+ return pResult;
+
+ long nCurCol = nX;
+
+ long nColOffs, nLastCol;
+ if( bRight )
+ {
+ nColOffs = 1;
+ nLastCol = nCols;
+ }
+ else
+ {
+ nColOffs = -1;
+ nLastCol = -1; // 0-1
+ }
+
+ USHORT nRowMin = nY;
+ USHORT nRowMax = nY;
+ do
+ {
+ SvLBoxEntry* pEntry = SearchCol((USHORT)nCurCol,nRowMin,nRowMax,nY,TRUE, FALSE);
+ if( pEntry )
+ return pEntry;
+ if( nRowMin )
+ nRowMin--;
+ if( nRowMax < (nRows-1))
+ nRowMax++;
+ nCurCol += nColOffs;
+ } while( nCurCol != nLastCol );
+ return 0;
+}
+
+SvLBoxEntry* ImpIcnCursor::GoUpDown( SvLBoxEntry* pEntry, BOOL bDown)
+{
+ SvLBoxEntry* pResult;
+ pCurEntry = pEntry;
+ Create();
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
+ USHORT nY = pViewData->nY;
+ USHORT nX = pViewData->nX;
+ DBG_ASSERT(nY<nRows,"GoUpDown:Bad column");
+ DBG_ASSERT(nX<nCols,"GoUpDown:Bad row");
+
+ // Nachbar in gleicher Spalte ?
+ if( bDown )
+ pResult = SearchCol( nX, nY ,nRows-1, nY, TRUE, TRUE );
+ else
+ pResult = SearchCol( nX, nY ,0, nY, FALSE, TRUE );
+ if( pResult )
+ return pResult;
+
+ long nCurRow = nY;
+
+ long nRowOffs, nLastRow;
+ if( bDown )
+ {
+ nRowOffs = 1;
+ nLastRow = nRows;
+ }
+ else
+ {
+ nRowOffs = -1;
+ nLastRow = -1; // 0-1
+ }
+
+ USHORT nColMin = nX;
+ USHORT nColMax = nX;
+ do
+ {
+ SvLBoxEntry* pEntry = SearchRow((USHORT)nCurRow,nColMin,nColMax,nX,TRUE, FALSE);
+ if( pEntry )
+ return pEntry;
+ if( nColMin )
+ nColMin--;
+ if( nColMax < (nCols-1))
+ nColMax++;
+ nCurRow += nRowOffs;
+ } while( nCurRow != nLastRow );
+ return 0;
+}
+
+void ImpIcnCursor::SetDeltas()
+{
+ const Size& rSize = pView->aVirtOutputSize;
+ if( pView->nFlags & F_GRIDMODE )
+ {
+ nGridDX = pView->nGridDX;
+ nGridDY = pView->nGridDY;
+ }
+ else
+ {
+ nGridDX = 20;
+ nGridDY = 20;
+ }
+ nCols = rSize.Width() / nGridDX;
+ if( !nCols )
+ nCols = 1;
+ nRows = rSize.Height() / nGridDY;
+ if( (nRows * nGridDY) < rSize.Height() )
+ nRows++;
+ if( !nRows )
+ nRows = 1;
+
+ nDeltaWidth = (short)(rSize.Width() / nCols);
+ nDeltaHeight = (short)(rSize.Height() / nRows);
+ if( !nDeltaHeight )
+ {
+ nDeltaHeight = 1;
+ DBG_WARNING("SetDeltas:Bad height");
+ }
+ if( !nDeltaWidth )
+ {
+ nDeltaWidth = 1;
+ DBG_WARNING("SetDeltas:Bad width");
+ }
+}
+
+
+void ImpIcnCursor::ExpandGrid()
+{
+ if( pGridMap )
+ {
+ long nNewGridRows = nGridRows + 20;
+ unsigned char* pTempMap = new unsigned char[ nNewGridRows * nGridCols ];
+ memset( pTempMap, nNewGridRows * nGridCols, 0 );
+ memcpy( pTempMap, pGridMap, nGridRows * nGridCols );
+ delete pGridMap;
+ pGridMap = pTempMap;
+ nGridRows = nNewGridRows;
+ }
+}
+
+BOOL ImpIcnCursor::FindEmptyGridRect( Rectangle& rRect )
+{
+ CreateGridMap();
+ USHORT nCount = (USHORT)(nGridCols * nGridRows);
+ if( !nCount )
+ return FALSE;
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ if( !pGridMap[ nCur ] )
+ {
+ USHORT nCol = (USHORT)(nCur % nGridCols);
+ USHORT nRow = (USHORT)(nCur / nGridCols);
+ rRect.Top() = nRow * nGridDY + TBOFFS_WINBORDER;
+ rRect.Bottom() = rRect.Top() + nGridDY;
+ rRect.Left() = nCol * nGridDX+ LROFFS_WINBORDER;
+ rRect.Right() = rRect.Left() + nGridDX;
+ SetGridUsed( nCol, nRow, TRUE );
+
+ //XXX
+ //if( nRow + 5 > nGridRows )
+ // ExpandGrid();
+ DBG_ASSERT(pGridMap[nCur],"SetGridUsed failed");
+ return TRUE;
+ }
+ }
+ // Gridmap ist voll: Um eine Zeile erweitern
+ rRect.Top() = nGridRows * nGridDY + TBOFFS_WINBORDER;
+ rRect.Bottom() = rRect.Top() + nGridDY;
+ rRect.Left() = LROFFS_WINBORDER;
+ rRect.Right() = rRect.Left() + nGridDX;
+ return FALSE;
+ //XXX
+ //ExpandGrid();
+ //return TRUE;
+}
+
+void ImpIcnCursor::CreateGridAjustData( SvPtrarr& rLists, SvLBoxEntry* pRefEntry)
+{
+ if( !pRefEntry )
+ {
+ USHORT nRows = (USHORT)(pView->aVirtOutputSize.Height() / pView->nGridDY);
+ nRows++; // wg. Abrundung!
+
+ if( !nRows )
+ return;
+ for( USHORT nCurList = 0; nCurList < nRows; nCurList++ )
+ {
+ SvPtrarr* pRow = new SvPtrarr;
+ rLists.Insert( (void*)pRow, nCurList );
+ }
+ SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent );
+ while( pEntry )
+ {
+ const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
+ USHORT nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),FALSE);
+ ((SvPtrarr*)rLists[ nY ])->Insert( pEntry, nIns );
+ pEntry = pView->pModel->NextSibling( pEntry );
+ }
+ }
+ else
+ {
+ // Aufbau eines hor. "Schlauchs" auf der RefEntry-Zeile
+
+ // UEBERLEGEN: BoundingRect nehmen wg. Ueberlappungen???
+
+ Rectangle rRefRect( pView->CalcBmpRect( pRefEntry ) );
+ //const Rectangle& rRefRect = pView->GetBoundingRect( pRefEntry );
+ short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY );
+ SvPtrarr* pRow = new SvPtrarr;
+ rLists.Insert( (void*)pRow, 0 );
+ SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent );
+ while( pEntry )
+ {
+ Rectangle rRect( pView->CalcBmpRect(pEntry) );
+ //const Rectangle& rRect = pView->GetBoundingRect( pEntry );
+ short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
+ if( nY == nRefRow )
+ {
+ USHORT nIns = GetSortListPos( pRow, rRect.Left(), FALSE );
+ pRow->Insert( pEntry, nIns );
+ }
+ pEntry = pView->pModel->NextSibling( pEntry );
+ }
+ }
+}
+
+//static
+void ImpIcnCursor::DestroyGridAdjustData( SvPtrarr& rLists )
+{
+ USHORT nCount = rLists.Count();
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ SvPtrarr* pArr = (SvPtrarr*)rLists[ nCur ];
+ delete pArr;
+ }
+ rLists.Remove( 0, rLists.Count() );
+}
+
+void SvImpIconView::SetGrid( long nDX, long nDY )
+{
+ nGridDX = nDX;
+ nGridDY = nDY;
+ nFlags |= F_GRIDMODE;
+}
+
+Rectangle SvImpIconView::CalcMaxTextRect( const SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData ) const
+{
+ Rectangle aRect = pViewData->aGridRect;
+ long nBmpHeight = ((SvLBoxEntry*)pEntry)->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,(SvLBoxEntry*)pEntry).Height();
+ aRect.Top() += nBmpHeight;
+ aRect.Top() += ICONVIEW_OFFS_BMP_STRING;
+ if( aRect.Top() > aRect.Bottom())
+ aRect.Top() = aRect.Bottom();
+ aRect.Left() += LROFFS_BOUND;
+ aRect.Left()++;
+ aRect.Right() -= LROFFS_BOUND;
+ aRect.Right()--;
+ if( aRect.Left() > aRect.Right())
+ aRect.Left() = aRect.Right();
+ if( GetTextMode( pEntry, pViewData ) == ShowTextFull )
+ aRect.Bottom() = LONG_MAX;
+ return aRect;
+}
+
+void SvImpIconView::Center( SvLBoxEntry* pEntry,
+ SvIcnVwDataEntry* pViewData ) const
+{
+ SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ const String& rEntryText = pStringItem->GetText();
+
+ Rectangle aTextRect = CalcMaxTextRect(pEntry,pViewData);
+ aTextRect = GetTextRect( pView, aTextRect, rEntryText, DRAWTEXT_FLAGS );
+ pViewData->aTextSize = aTextRect.GetSize();
+
+ pViewData->aRect = pViewData->aGridRect;
+ Size aSize( CalcBoundingSize( pEntry, pViewData ) );
+ long nBorder = pViewData->aGridRect.GetWidth() - aSize.Width();
+ pViewData->aRect.Left() += nBorder / 2;
+ pViewData->aRect.Right() -= nBorder / 2;
+ pViewData->aRect.Bottom() = pViewData->aRect.Top() + aSize.Height();
+}
+
+
+// Die Deltas entsprechen Offsets, um die die View auf dem Doc verschoben wird
+// links, hoch: Offsets < 0
+// rechts, runter: Offsets > 0
+void SvImpIconView::Scroll( long nDeltaX, long nDeltaY, BOOL bScrollBar )
+{
+ const MapMode& rMapMode = pView->GetMapMode();
+ Point aOrigin( rMapMode.GetOrigin() );
+ // in Dokumentkoordinate umwandeln
+ aOrigin *= -1;
+ aOrigin.Y() += nDeltaY;
+ aOrigin.X() += nDeltaX;
+ Rectangle aRect( aOrigin, aOutputSize );
+ MakeVisible( aRect, bScrollBar );
+}
+
+
+const Size& SvImpIconView::GetItemSize( SvIconView* pView,
+ SvLBoxEntry* pEntry, SvLBoxItem* pItem, const SvIcnVwDataEntry* pViewData) const
+{
+ if( (nFlags & F_GRIDMODE) && pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
+ {
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(pEntry);
+ return pViewData->aTextSize;
+ }
+ else
+ return pItem->GetSize( pView, pEntry );
+}
+
+Rectangle SvImpIconView::CalcFocusRect( SvLBoxEntry* pEntry )
+{
+#if !defined(OS2)
+ SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ DBG_ASSERT(pStringItem,"Text not set");
+ return CalcTextRect( pEntry, pStringItem );
+#else
+ return CalcBmpRect( pEntry );
+#endif
+}
+
+
+void SvImpIconView::SelectRect( const Rectangle& rRect, BOOL bAdd,
+ SvPtrarr* pOtherRects, short nBorderOffs )
+{
+ if( !pZOrderList || !pZOrderList->Count() )
+ return;
+
+ CheckBoundingRects();
+ pView->Update();
+ USHORT nCount = pZOrderList->Count();
+
+ Rectangle aRect( rRect );
+ aRect.Justify();
+ if( nBorderOffs )
+ {
+ aRect.Left() -= nBorderOffs;
+ aRect.Right() += nBorderOffs;
+ aRect.Top() -= nBorderOffs;
+ aRect.Bottom() += nBorderOffs;
+ }
+ BOOL bCalcOverlap = (bAdd && pOtherRects && pOtherRects->Count()) ? TRUE : FALSE;
+
+ for( USHORT nPos = 0; nPos < nCount; nPos++ )
+ {
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos ));
+
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ DBG_ASSERT(pViewData,"Entry not in model")
+ if( !IsBoundingRectValid( pViewData->aRect ))
+ FindBoundingRect( pEntry, pViewData );
+ const Rectangle& rBoundRect = pViewData->aRect;
+ BOOL bSelected = pViewData->IsSelected();
+
+ BOOL bOverlaps;
+ if( bCalcOverlap )
+ bOverlaps = IsOver( pOtherRects, rBoundRect );
+ else
+ bOverlaps = FALSE;
+ BOOL bOver = aRect.IsOver( rBoundRect );
+
+ if( bOver && !bOverlaps )
+ {
+ // Ist im neuen Selektionsrechteck und in keinem alten
+ // => selektieren
+ if( !bSelected )
+ pView->Select( pEntry, TRUE );
+ }
+ else if( !bAdd )
+ {
+ // ist ausserhalb des Selektionsrechtecks
+ // => Selektion entfernen
+ if( bSelected )
+ pView->Select( pEntry, FALSE );
+ }
+ else if( bAdd && bOverlaps )
+ {
+ // Der Eintrag befindet sich in einem alten (=>Aufspannen
+ // mehrerer Rechtecke mit Ctrl!) Selektionsrechteck
+
+ // Hier ist noch ein Bug! Der Selektionsstatus eines Eintrags
+ // in einem vorherigen Rechteck, muss restauriert werden, wenn
+ // er vom aktuellen Selektionsrechteck beruehrt wurde, jetzt aber
+ // nicht mehr in ihm liegt. Ich gehe hier der Einfachheit halber
+ // pauschal davon aus, dass die Eintraege in den alten Rechtecken
+ // alle selektiert sind. Ebenso ist es falsch, die Schnittmenge
+ // nur zu deselektieren.
+ // Loesungsmoeglichkeit: Snapshot der Selektion vor dem Auf-
+ // spannen des Rechtecks merken
+ if( rBoundRect.IsOver( rRect))
+ {
+ // Schnittmenge zwischen alten Rects & aktuellem Rect desel.
+ if( bSelected )
+ pView->Select( pEntry, FALSE );
+ }
+ else
+ {
+ // Eintrag eines alten Rects selektieren
+ if( !bSelected )
+ pView->Select( pEntry, TRUE );
+ }
+ }
+ else if( !bOver && bSelected )
+ {
+ // Der Eintrag liegt voellig ausserhalb und wird deshalb desel.
+ pView->Select( pEntry, FALSE );
+ }
+ }
+ pView->Update();
+}
+
+BOOL SvImpIconView::IsOver( SvPtrarr* pRectList, const Rectangle& rBoundRect ) const
+{
+ USHORT nCount = pRectList->Count();
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ Rectangle* pRect = (Rectangle*)pRectList->GetObject( nCur );
+ if( rBoundRect.IsOver( *pRect ))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void SvImpIconView::AddSelectedRect( const Rectangle& rRect, short nBorderOffs )
+{
+ Rectangle* pRect = new Rectangle( rRect );
+ pRect->Justify();
+ if( nBorderOffs )
+ {
+ pRect->Left() -= nBorderOffs;
+ pRect->Right() += nBorderOffs;
+ pRect->Top() -= nBorderOffs;
+ pRect->Bottom() += nBorderOffs;
+ }
+ aSelectedRectList.Insert( (void*)pRect, aSelectedRectList.Count() );
+}
+
+void SvImpIconView::ClearSelectedRectList()
+{
+ USHORT nCount = aSelectedRectList.Count();
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ Rectangle* pRect = (Rectangle*)aSelectedRectList.GetObject( nCur );
+ delete pRect;
+ }
+ aSelectedRectList.Remove( 0, aSelectedRectList.Count() );
+}
+
+
+void SvImpIconView::DrawSelectionRect( const Rectangle& rRect )
+{
+ pView->HideTracking();
+ nFlags |= F_SELRECT_VISIBLE;
+ pView->ShowTracking( rRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW );
+ aCurSelectionRect = rRect;
+}
+
+void SvImpIconView::HideSelectionRect()
+{
+ if( nFlags & F_SELRECT_VISIBLE )
+ {
+ pView->HideTracking();
+ nFlags &= ~F_SELRECT_VISIBLE;
+ }
+}
+
+void SvImpIconView::ImpDrawXORRect( const Rectangle& rRect )
+{
+ RasterOp eOldOp = pView->GetRasterOp();
+ pView->SetRasterOp( ROP_XOR );
+ Color aOldColor = pView->GetFillColor();
+ pView->SetFillColor();
+ pView->DrawRect( rRect );
+ pView->SetFillColor( aOldColor );
+ pView->SetRasterOp( eOldOp );
+}
+
+void SvImpIconView::CalcScrollOffsets( const Point& rPosPixel,
+ long& rX, long& rY, BOOL bInDragDrop, USHORT nBorderWidth)
+{
+ // Scrolling der View, falls sich der Mauszeiger im Grenzbereich des
+ // Fensters befindet
+ long nPixelToScrollX = 0;
+ long nPixelToScrollY = 0;
+ Size aWndSize = aOutputSize;
+
+ nBorderWidth = (USHORT)(Min( (long)(aWndSize.Height()-1), (long)nBorderWidth ));
+ nBorderWidth = (USHORT)(Min( (long)(aWndSize.Width()-1), (long)nBorderWidth ));
+
+ if ( rPosPixel.X() < nBorderWidth )
+ {
+ if( bInDragDrop )
+ nPixelToScrollX = -DD_SCROLL_PIXEL;
+ else
+ nPixelToScrollX = rPosPixel.X()- nBorderWidth;
+ }
+ else if ( rPosPixel.X() > aWndSize.Width() - nBorderWidth )
+ {
+ if( bInDragDrop )
+ nPixelToScrollX = DD_SCROLL_PIXEL;
+ else
+ nPixelToScrollX = rPosPixel.X() - (aWndSize.Width() - nBorderWidth);
+ }
+ if ( rPosPixel.Y() < nBorderWidth )
+ {
+ if( bInDragDrop )
+ nPixelToScrollY = -DD_SCROLL_PIXEL;
+ else
+ nPixelToScrollY = rPosPixel.Y() - nBorderWidth;
+ }
+ else if ( rPosPixel.Y() > aWndSize.Height() - nBorderWidth )
+ {
+ if( bInDragDrop )
+ nPixelToScrollY = DD_SCROLL_PIXEL;
+ else
+ nPixelToScrollY = rPosPixel.Y() - (aWndSize.Height() - nBorderWidth);
+ }
+
+ rX = nPixelToScrollX;
+ rY = nPixelToScrollY;
+}
+
+IMPL_LINK(SvImpIconView, MouseMoveTimeoutHdl, Timer*, pTimer )
+{
+ pTimer->Start();
+ MouseMove( aMouseMoveEvent );
+ return 0;
+}
+
+void SvImpIconView::EndTracking()
+{
+ pView->ReleaseMouse();
+ if( nFlags & F_RUBBERING )
+ {
+ aMouseMoveTimer.Stop();
+ nFlags &= ~(F_RUBBERING | F_ADD_MODE);
+ }
+}
+
+BOOL SvImpIconView::IsTextHit( SvLBoxEntry* pEntry, const Point& rDocPos )
+{
+ SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if( pItem )
+ {
+ Rectangle aRect( CalcTextRect( pEntry, pItem ));
+ if( aRect.IsInside( rDocPos ) )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+IMPL_LINK(SvImpIconView, EditTimeoutHdl, Timer*, pTimer )
+{
+ SvLBoxEntry* pEntry = GetCurEntry();
+ if( pView->IsInplaceEditingEnabled() && pEntry &&
+ pView->IsSelected( pEntry ))
+ {
+ pView->EditEntry( pEntry );
+ }
+ return 0;
+}
+
+
+//
+// Funktionen zum Ausrichten der Eintraege am Grid
+//
+
+// pStart == 0: Alle Eintraege werden ausgerichtet
+// sonst: Alle Eintraege der Zeile ab einschliesslich pStart werden ausgerichtet
+void SvImpIconView::AdjustAtGrid( SvLBoxEntry* pStart )
+{
+ SvPtrarr aLists;
+ pImpCursor->CreateGridAjustData( aLists, pStart );
+ USHORT nCount = aLists.Count();
+ for( USHORT nCur = 0; nCur < nCount; nCur++ )
+ {
+ AdjustAtGrid( *(SvPtrarr*)aLists[ nCur ], pStart );
+ }
+ ImpIcnCursor::DestroyGridAdjustData( aLists );
+ CheckScrollBars();
+}
+
+// Richtet eine Zeile aus, erweitert ggf. die Breite; Bricht die Zeile nicht um
+void SvImpIconView::AdjustAtGrid( const SvPtrarr& rRow, SvLBoxEntry* pStart )
+{
+ if( !rRow.Count() )
+ return;
+
+ BOOL bGo;
+ if( !pStart )
+ bGo = TRUE;
+ else
+ bGo = FALSE;
+
+ long nCurRight = 0;
+ for( USHORT nCur = 0; nCur < rRow.Count(); nCur++ )
+ {
+ SvLBoxEntry* pCur = (SvLBoxEntry*)rRow[ nCur ];
+ if( !bGo && pCur == pStart )
+ bGo = TRUE;
+
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur);
+ // Massgebend (fuer das menschliche Auge) ist die Bitmap, da sonst
+ // durch lange Texte der Eintrag stark springen kann
+ const Rectangle& rBoundRect = GetBoundingRect( pCur, pViewData );
+ Rectangle aCenterRect( CalcBmpRect( pCur, 0, pViewData ));
+ if( bGo && !pViewData->IsEntryPosLocked() )
+ {
+ long nWidth = aCenterRect.GetSize().Width();
+ Point aNewPos( AdjustAtGrid( aCenterRect, rBoundRect ) );
+ while( aNewPos.X() < nCurRight )
+ aNewPos.X() += nGridDX;
+ if( aNewPos != rBoundRect.TopLeft() )
+ SetEntryPos( pCur, aNewPos );
+ nCurRight = aNewPos.X() + nWidth;
+ }
+ else
+ {
+ nCurRight = rBoundRect.Right();
+ }
+ }
+}
+
+// Richtet Rect am Grid aus, garantiert jedoch nicht, dass die
+// neue Pos. frei ist. Die Pos. kann fuer SetEntryPos verwendet werden.
+// Das CenterRect beschreibt den Teil des BoundRects, der fuer
+// die Berechnung des Ziel-Rechtecks verwendet wird.
+Point SvImpIconView::AdjustAtGrid( const Rectangle& rCenterRect,
+ const Rectangle& rBoundRect ) const
+{
+ Point aPos( rCenterRect.TopLeft() );
+ Size aSize( rCenterRect.GetSize() );
+
+ aPos.X() -= LROFFS_WINBORDER;
+ aPos.Y() -= TBOFFS_WINBORDER;
+
+ // align (ref ist mitte des rects)
+ short nGridX = (short)((aPos.X()+(aSize.Width()/2)) / nGridDX);
+ short nGridY = (short)((aPos.Y()+(aSize.Height()/2)) / nGridDY);
+ aPos.X() = nGridX * nGridDX;
+ aPos.Y() = nGridY * nGridDY;
+ // hor. center
+ aPos.X() += (nGridDX - rBoundRect.GetSize().Width() ) / 2;
+
+ aPos.X() += LROFFS_WINBORDER;
+ aPos.Y() += TBOFFS_WINBORDER;
+
+ return aPos;
+}
+
+
+void SvImpIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry )
+{
+ if( !pEntry )
+ {
+ if( eTextMode != eMode )
+ {
+ if( eTextMode == ShowTextDontKnow )
+ eTextMode = ShowTextShort;
+ eTextMode = eMode;
+ pView->Arrange();
+ }
+ }
+ else
+ {
+ SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
+ if( pViewData->eTextMode != eMode )
+ {
+ pViewData->eTextMode = eMode;
+ pModel->InvalidateEntry( pEntry );
+ AdjustVirtSize( pViewData->aRect );
+ }
+ }
+}
+
+SvIconViewTextMode SvImpIconView::GetTextMode( const SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData ) const
+{
+ if( !pEntry )
+ return eTextMode;
+ else
+ {
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry));
+ return pViewData->GetTextMode();
+ }
+}
+
+SvIconViewTextMode SvImpIconView::GetEntryTextModeSmart( const SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData ) const
+{
+ DBG_ASSERT(pEntry,"GetEntryTextModeSmart: Entry not set");
+ if( !pViewData )
+ pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry));
+ SvIconViewTextMode eMode = pViewData->GetTextMode();
+ if( eMode == ShowTextDontKnow )
+ return eTextMode;
+ return eMode;
+}
+
+void SvImpIconView::ShowFocusRect( const SvLBoxEntry* pEntry )
+{
+ if( !pEntry )
+ pView->HideFocus();
+ else
+ {
+ Rectangle aRect ( CalcFocusRect( (SvLBoxEntry*)pEntry ) );
+ pView->ShowFocus( aRect );
+ }
+}
+
+IMPL_LINK(SvImpIconView, UserEventHdl, void*, EMPTYARG )
+{
+ nCurUserEvent = 0;
+ AdjustScrollBars();
+ Rectangle aRect;
+ if( GetResizeRect(aRect) )
+ PaintResizeRect( aRect );
+ return 0;
+}
+
+void SvImpIconView::CancelUserEvent()
+{
+ if( nCurUserEvent )
+ {
+ Application::RemoveUserEvent( nCurUserEvent );
+ nCurUserEvent = 0;
+ }
+}
+
+
diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
new file mode 100644
index 000000000000..fc6cd0c85cf8
--- /dev/null
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -0,0 +1,449 @@
+/*************************************************************************
+ *
+ * $RCSfile: svlbitm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <svlbox.hxx>
+#include <svlbitm.hxx>
+
+#pragma hdrstop
+
+#define TABOFFS_NOT_VALID -2000000
+
+DBG_NAME(SvLBoxButtonData);
+
+SvLBoxButtonData::SvLBoxButtonData()
+{
+ DBG_CTOR(SvLBoxButtonData,0);
+ bDataOk = FALSE;
+ pEntry = 0;
+ eState = SV_BUTTON_UNCHECKED;
+}
+
+SvLBoxButtonData::~SvLBoxButtonData()
+{
+ DBG_DTOR(SvLBoxButtonData,0);
+}
+
+
+void SvLBoxButtonData::CallLink()
+{
+ DBG_CHKTHIS(SvLBoxButtonData,0);
+ aLink.Call( this );
+}
+
+
+USHORT SvLBoxButtonData::GetIndex( USHORT nItemState )
+{
+ DBG_CHKTHIS(SvLBoxButtonData,0);
+ nItemState &= 0x000F;
+ USHORT nIdx;
+ switch( nItemState )
+ {
+ case SV_ITEMSTATE_UNCHECKED:
+ nIdx = SV_BMP_UNCHECKED; break;
+ case SV_ITEMSTATE_CHECKED:
+ nIdx = SV_BMP_CHECKED; break;
+ case SV_ITEMSTATE_TRISTATE:
+ nIdx = SV_BMP_TRISTATE; break;
+ case SV_ITEMSTATE_UNCHECKED | SV_ITEMSTATE_HILIGHTED:
+ nIdx = SV_BMP_HIUNCHECKED; break;
+ case SV_ITEMSTATE_CHECKED | SV_ITEMSTATE_HILIGHTED:
+ nIdx = SV_BMP_HICHECKED; break;
+ case SV_ITEMSTATE_TRISTATE | SV_ITEMSTATE_HILIGHTED:
+ nIdx = SV_BMP_HITRISTATE; break;
+ default:
+ nIdx = SV_BMP_UNCHECKED;
+ }
+ return nIdx;
+}
+
+void SvLBoxButtonData::SetWidthAndHeight()
+{
+ DBG_CHKTHIS(SvLBoxButtonData,0);
+ Size aSize = aBmps[0].GetSizePixel();
+ nWidth = aSize.Width();
+ nHeight = aSize.Height();
+ bDataOk = TRUE;
+}
+
+
+void SvLBoxButtonData::StoreButtonState( SvLBoxEntry* pActEntry, USHORT nItemFlags )
+{
+ DBG_CHKTHIS(SvLBoxButtonData,0);
+ pEntry = pActEntry;
+ eState = ConvertToButtonState( nItemFlags );
+}
+
+SvButtonState SvLBoxButtonData::ConvertToButtonState( USHORT nItemFlags ) const
+{
+ DBG_CHKTHIS(SvLBoxButtonData,0);
+ nItemFlags &= (SV_ITEMSTATE_UNCHECKED |
+ SV_ITEMSTATE_CHECKED |
+ SV_ITEMSTATE_TRISTATE);
+ switch( nItemFlags )
+ {
+ case SV_ITEMSTATE_UNCHECKED:
+ return SV_BUTTON_UNCHECKED;
+
+ case SV_ITEMSTATE_CHECKED:
+ return SV_BUTTON_CHECKED;
+
+ case SV_ITEMSTATE_TRISTATE:
+ return SV_BUTTON_TRISTATE;
+ default:
+ return SV_BUTTON_UNCHECKED;
+ }
+}
+
+
+// ***************************************************************
+// class SvLBoxString
+// ***************************************************************
+
+DBG_NAME(SvLBoxString);
+
+SvLBoxString::SvLBoxString( SvLBoxEntry* pEntry,USHORT nFlags,const XubString& rStr) :
+ SvLBoxItem( pEntry, nFlags )
+{
+ DBG_CTOR(SvLBoxString,0);
+ SetText( pEntry, rStr );
+}
+
+SvLBoxString::SvLBoxString() : SvLBoxItem()
+{
+ DBG_CTOR(SvLBoxString,0);
+}
+
+SvLBoxString::~SvLBoxString()
+{
+ DBG_DTOR(SvLBoxString,0);
+}
+
+USHORT SvLBoxString::IsA()
+{
+ DBG_CHKTHIS(SvLBoxString,0);
+ return SV_ITEM_ID_LBOXSTRING;
+}
+
+void SvLBoxString::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */,
+ SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBoxString,0);
+ rDev.DrawText( rPos, aStr );
+}
+
+SvLBoxItem* SvLBoxString::Create() const
+{
+ DBG_CHKTHIS(SvLBoxString,0);
+ return new SvLBoxString;
+}
+
+void SvLBoxString::Clone( SvLBoxItem* pSource )
+{
+ DBG_CHKTHIS(SvLBoxString,0);
+ aStr = ((SvLBoxString*)pSource)->aStr;
+}
+
+void SvLBoxString::SetText( SvLBoxEntry*, const XubString& rStr )
+{
+ DBG_CHKTHIS(SvLBoxString,0);
+ aStr = rStr;
+}
+
+void SvLBoxString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry,
+ SvViewDataItem* pViewData)
+{
+ DBG_CHKTHIS(SvLBoxString,0);
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+ pViewData->aSize = Size(pView->GetTextWidth( aStr ), pView->GetTextHeight());
+}
+
+// ***************************************************************
+// class SvLBoxBmp
+// ***************************************************************
+
+DBG_NAME(SvLBoxBmp);
+
+SvLBoxBmp::SvLBoxBmp( SvLBoxEntry* pEntry, USHORT nFlags, Image aBitmap ) :
+ SvLBoxItem( pEntry, nFlags )
+{
+ DBG_CTOR(SvLBoxBmp,0);
+ SetBitmap( pEntry, aBitmap);
+}
+
+SvLBoxBmp::SvLBoxBmp() : SvLBoxItem()
+{
+ DBG_CTOR(SvLBoxBmp,0);
+}
+
+SvLBoxBmp::~SvLBoxBmp()
+{
+ DBG_DTOR(SvLBoxBmp,0);
+}
+
+USHORT SvLBoxBmp::IsA()
+{
+ DBG_CHKTHIS(SvLBoxBmp,0);
+ return SV_ITEM_ID_LBOXBMP;
+}
+
+void SvLBoxBmp::SetBitmap( SvLBoxEntry*, Image aBitmap)
+{
+ DBG_CHKTHIS(SvLBoxBmp,0);
+ aBmp = aBitmap;
+}
+
+void SvLBoxBmp::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry,
+ SvViewDataItem* pViewData)
+{
+ DBG_CHKTHIS(SvLBoxBmp,0);
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+ pViewData->aSize = aBmp.GetSizePixel();
+}
+
+void SvLBoxBmp::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */,
+ SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBoxBmp,0);
+ rDev.DrawImage( rPos, aBmp );
+}
+
+SvLBoxItem* SvLBoxBmp::Create() const
+{
+ DBG_CHKTHIS(SvLBoxBmp,0);
+ return new SvLBoxBmp;
+}
+
+void SvLBoxBmp::Clone( SvLBoxItem* pSource )
+{
+ DBG_CHKTHIS(SvLBoxBmp,0);
+ aBmp = ((SvLBoxBmp*)pSource)->aBmp;
+}
+
+// ***************************************************************
+// class SvLBoxButton
+// ***************************************************************
+
+DBG_NAME(SvLBoxButton);
+
+SvLBoxButton::SvLBoxButton( SvLBoxEntry* pEntry,USHORT nFlags,SvLBoxButtonData* pBData)
+ : SvLBoxItem( pEntry, nFlags )
+{
+ DBG_CTOR(SvLBoxButton,0);
+ nBaseOffs = 0;
+ nItemFlags = 0;
+ SetStateUnchecked();
+ pData = pBData;
+}
+
+SvLBoxButton::SvLBoxButton() : SvLBoxItem()
+{
+ DBG_CTOR(SvLBoxButton,0);
+ nItemFlags = 0;
+ SetStateUnchecked();
+}
+
+SvLBoxButton::~SvLBoxButton()
+{
+ DBG_DTOR(SvLBoxButton,0);
+}
+
+USHORT SvLBoxButton::IsA()
+{
+ DBG_CHKTHIS(SvLBoxButton,0);
+ return SV_ITEM_ID_LBOXBUTTON;
+}
+
+void SvLBoxButton::Check(SvLBox*, SvLBoxEntry*, BOOL bOn)
+{
+ DBG_CHKTHIS(SvLBoxButton,0);
+ if ( bOn != IsStateChecked() )
+ {
+ if ( bOn )
+ SetStateChecked();
+ else
+ SetStateUnchecked();
+ }
+}
+
+BOOL SvLBoxButton::ClickHdl( SvLBox*, SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvLBoxButton,0);
+ if ( IsStateChecked() )
+ SetStateUnchecked();
+ else
+ SetStateChecked();
+ pData->StoreButtonState( pEntry, nItemFlags );
+ pData->CallLink();
+ return FALSE;
+}
+
+void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, USHORT /* nFlags */,
+ SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBoxButton,0);
+ USHORT nIndex = pData->GetIndex( nItemFlags );
+ rDev.DrawImage( rPos, pData->aBmps[nIndex + nBaseOffs] );
+}
+
+SvLBoxItem* SvLBoxButton::Create() const
+{
+ DBG_CHKTHIS(SvLBoxButton,0);
+ return new SvLBoxButton;
+}
+
+void SvLBoxButton::Clone( SvLBoxItem* pSource )
+{
+ DBG_CHKTHIS(SvLBoxButton,0);
+ pData = ((SvLBoxButton*)pSource)->pData;
+}
+
+void SvLBoxButton::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry,
+ SvViewDataItem* pViewData )
+{
+ DBG_CHKTHIS(SvLBoxButton,0);
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+ pViewData->aSize = Size( pData->Width(), pData->Height() );
+}
+
+
+
+// ***************************************************************
+// class SvLBoxContextBmp
+// ***************************************************************
+
+DBG_NAME(SvLBoxContextBmp);
+
+SvLBoxContextBmp::SvLBoxContextBmp( SvLBoxEntry* pEntry, USHORT nItemFlags,
+ Image aBmp1, Image aBmp2, USHORT nEntryFlags )
+ : SvLBoxItem( pEntry, nItemFlags )
+{
+ DBG_CTOR(SvLBoxContextBmp,0);
+ nEntryFlagsBmp1 = nEntryFlags;
+ SetBitmap1( pEntry, aBmp1 );
+ SetBitmap2( pEntry, aBmp2 );
+}
+
+SvLBoxContextBmp::SvLBoxContextBmp()
+{
+ DBG_CTOR(SvLBoxContextBmp,0);
+}
+
+SvLBoxContextBmp::~SvLBoxContextBmp()
+{
+ DBG_DTOR(SvLBoxContextBmp,0);
+}
+
+USHORT SvLBoxContextBmp::IsA()
+{
+ DBG_CHKTHIS(SvLBoxContextBmp,0);
+ return SV_ITEM_ID_LBOXCONTEXTBMP;
+}
+
+void SvLBoxContextBmp::SetBitmap1( SvLBoxEntry*, Image aBmp )
+{
+ DBG_CHKTHIS(SvLBoxContextBmp,0);
+ aBmp1 = aBmp;
+}
+
+void SvLBoxContextBmp::SetBitmap2( SvLBoxEntry*, Image aBmp)
+{
+ DBG_CHKTHIS(SvLBoxContextBmp,0);
+ aBmp2 = aBmp;
+}
+
+void SvLBoxContextBmp::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry,
+ SvViewDataItem* pViewData)
+{
+ DBG_CHKTHIS(SvLBoxContextBmp,0);
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+ pViewData->aSize = aBmp1.GetSizePixel();
+}
+
+void SvLBoxContextBmp::Paint( const Point& rPos, SvLBox& rDev,
+ USHORT nViewDataEntryFlags, SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvLBoxContextBmp,0);
+ Image* pBmp = &aBmp1;
+ if( nViewDataEntryFlags & nEntryFlagsBmp1 )
+ pBmp = &aBmp2;
+ rDev.DrawImage( rPos, *pBmp);
+}
+
+SvLBoxItem* SvLBoxContextBmp::Create() const
+{
+ DBG_CHKTHIS(SvLBoxContextBmp,0);
+ return new SvLBoxContextBmp;
+}
+
+void SvLBoxContextBmp::Clone( SvLBoxItem* pSource )
+{
+ DBG_CHKTHIS(SvLBoxContextBmp,0);
+ aBmp1 = ((SvLBoxContextBmp*)pSource)->aBmp1;
+ aBmp2 = ((SvLBoxContextBmp*)pSource)->aBmp2;
+ nEntryFlagsBmp1 = ((SvLBoxContextBmp*)pSource)->nEntryFlagsBmp1;
+}
+
+
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx
new file mode 100644
index 000000000000..2d7b9b333e99
--- /dev/null
+++ b/svtools/source/contnr/svlbox.cxx
@@ -0,0 +1,1691 @@
+/*************************************************************************
+ *
+ * $RCSfile: svlbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*
+ Todo:
+ - Anker loeschen in SelectionEngine bei manuellem Selektieren
+ - SelectAll( FALSE ), nur die deselektierten Entries repainten
+*/
+
+
+#include <string.h>
+#ifndef _SVEDI_HXX
+#include <svmedit.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_ACCEL_HXX
+#include <vcl/accel.hxx>
+#endif
+#ifndef _SV_DRAG_HXX
+#include <vcl/drag.hxx>
+#endif
+#ifndef _SOT_FORMATS_HXX
+#include <sot/formats.hxx>
+#endif
+
+#pragma hdrstop
+
+#include <svlbox.hxx>
+#include <svlbitm.hxx>
+
+// fuer Drag&Drop
+static SvLBox* pDDSource = 0;
+static SvLBox* pDDTarget = 0;
+
+DBG_NAME(SvInplaceEdit);
+DBG_NAME(SvInplaceEdit2);
+
+#define SVLBOX_ACC_RETURN 1
+#define SVLBOX_ACC_ESCAPE 2
+
+SvInplaceEdit::SvInplaceEdit( Window* pParent, const Point& rPos,
+ const Size& rSize, const XubString& rData, const Link& rNotifyEditEnd,
+ const Selection& rSelection) :
+#ifndef OS2
+ Edit( pParent, WB_LEFT ),
+#else
+ Edit( pParent, WB_LEFT | WB_BORDER ),
+#endif
+ aCallBackHdl( rNotifyEditEnd ),
+ bCanceled( FALSE ),
+ bAlreadyInCallBack( FALSE )
+{
+ DBG_CTOR(SvInplaceEdit,0);
+ Font aFont( pParent->GetFont() );
+ aFont.SetTransparent( FALSE );
+ Color aColor( pParent->GetBackground().GetColor() );
+ aFont.SetFillColor(aColor );
+ SetFont( aFont );
+ SetBackground( pParent->GetBackground() );
+ SetPosPixel( rPos );
+ SetSizePixel( rSize );
+ SetText( rData );
+ SetSelection( rSelection );
+ SaveValue();
+
+ aAccReturn.InsertItem( SVLBOX_ACC_RETURN, KeyCode(KEY_RETURN) );
+ aAccEscape.InsertItem( SVLBOX_ACC_ESCAPE, KeyCode(KEY_ESCAPE) );
+
+ aAccReturn.SetActivateHdl( LINK( this, SvInplaceEdit, ReturnHdl_Impl) );
+ aAccEscape.SetActivateHdl( LINK( this, SvInplaceEdit, EscapeHdl_Impl) );
+ GetpApp()->InsertAccel( &aAccReturn );
+ GetpApp()->InsertAccel( &aAccEscape );
+
+ Show();
+ GrabFocus();
+}
+
+__EXPORT SvInplaceEdit::~SvInplaceEdit()
+{
+ DBG_DTOR(SvInplaceEdit,0);
+ if( !bAlreadyInCallBack )
+ {
+ GetpApp()->RemoveAccel( &aAccReturn );
+ GetpApp()->RemoveAccel( &aAccEscape );
+ }
+}
+
+
+
+IMPL_LINK_INLINE_START( SvInplaceEdit, ReturnHdl_Impl, Accelerator *, pAccelerator )
+{
+ DBG_CHKTHIS(SvInplaceEdit,0);
+ bCanceled = FALSE;
+ CallCallBackHdl_Impl();
+ return 1;
+}
+IMPL_LINK_INLINE_END( SvInplaceEdit, ReturnHdl_Impl, Accelerator *, pAccelerator )
+
+IMPL_LINK_INLINE_START( SvInplaceEdit, EscapeHdl_Impl, Accelerator *, pAccelerator )
+{
+ DBG_CHKTHIS(SvInplaceEdit,0);
+ bCanceled = TRUE;
+ CallCallBackHdl_Impl();
+ return 1;
+}
+IMPL_LINK_INLINE_END( SvInplaceEdit, EscapeHdl_Impl, Accelerator *, pAccelerator )
+
+
+void __EXPORT SvInplaceEdit::KeyInput( const KeyEvent& rKEvt )
+{
+ DBG_CHKTHIS(SvInplaceEdit,0);
+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
+ switch ( nCode )
+ {
+ case KEY_ESCAPE:
+ bCanceled = TRUE;
+ CallCallBackHdl_Impl();
+ break;
+
+ case KEY_RETURN:
+ bCanceled = FALSE;
+ CallCallBackHdl_Impl();
+ break;
+
+ default:
+ Edit::KeyInput( rKEvt );
+ }
+}
+
+void SvInplaceEdit::StopEditing( BOOL bCancel )
+{
+ DBG_CHKTHIS(SvInplaceEdit,0);
+ if ( !bAlreadyInCallBack )
+ {
+ bCanceled = bCancel;
+ CallCallBackHdl_Impl();
+ }
+}
+
+void __EXPORT SvInplaceEdit::LoseFocus()
+{
+ DBG_CHKTHIS(SvInplaceEdit,0);
+ if ( !bAlreadyInCallBack )
+ {
+ bCanceled = FALSE;
+ aTimer.SetTimeout(10);
+ aTimer.SetTimeoutHdl(LINK(this,SvInplaceEdit,Timeout_Impl));
+ aTimer.Start();
+ }
+}
+
+IMPL_LINK_INLINE_START( SvInplaceEdit, Timeout_Impl, Timer *, pTimer )
+{
+ DBG_CHKTHIS(SvInplaceEdit,0);
+ CallCallBackHdl_Impl();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvInplaceEdit, Timeout_Impl, Timer *, pTimer )
+
+void SvInplaceEdit::CallCallBackHdl_Impl()
+{
+ DBG_CHKTHIS(SvInplaceEdit,0);
+ aTimer.Stop();
+ if ( !bAlreadyInCallBack )
+ {
+ bAlreadyInCallBack = TRUE;
+ GetpApp()->RemoveAccel( &aAccReturn );
+ GetpApp()->RemoveAccel( &aAccEscape );
+ Hide();
+ aCallBackHdl.Call( this );
+ // bAlreadyInCallBack = FALSE;
+ }
+}
+
+
+// ***************************************************************
+
+class MyEdit_Impl : public Edit
+{
+ SvInplaceEdit2* pOwner;
+public:
+ MyEdit_Impl( Window* pParent, SvInplaceEdit2* pOwner );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void LoseFocus();
+};
+
+class MyMultiEdit_Impl : public MultiLineEdit
+{
+ SvInplaceEdit2* pOwner;
+public:
+ MyMultiEdit_Impl( Window* pParent, SvInplaceEdit2* pOwner );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void LoseFocus();
+};
+
+MyEdit_Impl::MyEdit_Impl( Window* pParent, SvInplaceEdit2* _pOwner )
+ :
+#ifndef OS2
+ Edit( pParent, WB_LEFT ),
+#else
+ Edit( pParent, WB_LEFT | WB_BORDER ),
+#endif
+ pOwner(_pOwner)
+{
+}
+
+void MyEdit_Impl::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !pOwner->KeyInput( rKEvt ))
+ Edit::KeyInput( rKEvt );
+}
+
+void MyEdit_Impl::LoseFocus()
+{
+ pOwner->LoseFocus();
+}
+
+MyMultiEdit_Impl::MyMultiEdit_Impl( Window* pParent, SvInplaceEdit2* _pOwner )
+ : MultiLineEdit( pParent,
+#if !defined(VCL)
+#if defined(WIN) || defined(WNT)
+ WB_CENTER
+#else
+ WB_LEFT
+#endif
+#else
+ WB_CENTER
+#endif
+ ), pOwner(_pOwner)
+{
+}
+
+void MyMultiEdit_Impl::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !pOwner->KeyInput( rKEvt ))
+ MultiLineEdit::KeyInput( rKEvt );
+}
+
+void MyMultiEdit_Impl::LoseFocus()
+{
+ pOwner->LoseFocus();
+}
+
+
+SvInplaceEdit2::SvInplaceEdit2( Window* pParent, const Point& rPos,
+ const Size& rSize, const XubString& rData, const Link& rNotifyEditEnd,
+ const Selection& rSelection, BOOL bMulti) :
+ aCallBackHdl( rNotifyEditEnd ),
+ bCanceled( FALSE ),
+ bAlreadyInCallBack( FALSE ),
+ bMultiLine( bMulti )
+{
+ DBG_CTOR(SvInplaceEdit2,0);
+ if( bMulti )
+ pEdit = new MyMultiEdit_Impl( pParent, this );
+ else
+ pEdit = new MyEdit_Impl( pParent, this );
+
+ Font aFont( pParent->GetFont() );
+ aFont.SetTransparent( FALSE );
+ Color aColor( pParent->GetBackground().GetColor() );
+ aFont.SetFillColor(aColor );
+ pEdit->SetFont( aFont );
+ pEdit->SetBackground( pParent->GetBackground() );
+ pEdit->SetPosPixel( rPos );
+ pEdit->SetSizePixel( rSize );
+ pEdit->SetText( rData );
+#ifndef OS2
+ pEdit->SetSelection( rSelection );
+#else
+ if( !bMulti )
+ pEdit->SetSelection( rSelection );
+#endif
+ pEdit->SaveValue();
+
+ aAccReturn.InsertItem( SVLBOX_ACC_RETURN, KeyCode(KEY_RETURN) );
+ aAccEscape.InsertItem( SVLBOX_ACC_ESCAPE, KeyCode(KEY_ESCAPE) );
+
+ aAccReturn.SetActivateHdl( LINK( this, SvInplaceEdit2, ReturnHdl_Impl) );
+ aAccEscape.SetActivateHdl( LINK( this, SvInplaceEdit2, EscapeHdl_Impl) );
+ GetpApp()->InsertAccel( &aAccReturn );
+ GetpApp()->InsertAccel( &aAccEscape );
+
+ pEdit->Show();
+ pEdit->GrabFocus();
+}
+
+SvInplaceEdit2::~SvInplaceEdit2()
+{
+ DBG_DTOR(SvInplaceEdit2,0);
+ if( !bAlreadyInCallBack )
+ {
+ GetpApp()->RemoveAccel( &aAccReturn );
+ GetpApp()->RemoveAccel( &aAccEscape );
+ }
+ delete pEdit;
+}
+
+XubString SvInplaceEdit2::GetSavedValue() const
+{
+ return pEdit->GetSavedValue();
+}
+
+void SvInplaceEdit2::Hide()
+{
+ pEdit->Hide();
+}
+
+
+IMPL_LINK_INLINE_START( SvInplaceEdit2, ReturnHdl_Impl, Accelerator *, pAccelerator )
+{
+ DBG_CHKTHIS(SvInplaceEdit2,0);
+ bCanceled = FALSE;
+ CallCallBackHdl_Impl();
+ return 1;
+}
+IMPL_LINK_INLINE_END( SvInplaceEdit2, ReturnHdl_Impl, Accelerator *, pAccelerator )
+
+IMPL_LINK_INLINE_START( SvInplaceEdit2, EscapeHdl_Impl, Accelerator *, pAccelerator )
+{
+ DBG_CHKTHIS(SvInplaceEdit2,0);
+ bCanceled = TRUE;
+ CallCallBackHdl_Impl();
+ return 1;
+}
+IMPL_LINK_INLINE_END( SvInplaceEdit2, EscapeHdl_Impl, Accelerator *, pAccelerator )
+
+
+BOOL SvInplaceEdit2::KeyInput( const KeyEvent& rKEvt )
+{
+ DBG_CHKTHIS(SvInplaceEdit2,0);
+ KeyCode aCode = rKEvt.GetKeyCode();
+ USHORT nCode = aCode.GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_ESCAPE:
+ bCanceled = TRUE;
+ CallCallBackHdl_Impl();
+ return TRUE;
+
+ case KEY_RETURN:
+// if( !aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ bCanceled = FALSE;
+ CallCallBackHdl_Impl();
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+}
+
+void SvInplaceEdit2::StopEditing( BOOL bCancel )
+{
+ DBG_CHKTHIS(SvInplaceEdit2,0);
+ if ( !bAlreadyInCallBack )
+ {
+ bCanceled = bCancel;
+ CallCallBackHdl_Impl();
+ }
+}
+
+void SvInplaceEdit2::LoseFocus()
+{
+ DBG_CHKTHIS(SvInplaceEdit2,0);
+ if ( !bAlreadyInCallBack
+#ifdef VCL
+ && ((!Application::GetFocusWindow()) || !pEdit->IsChild( Application::GetFocusWindow()) )
+#endif
+ )
+ {
+ bCanceled = FALSE;
+ aTimer.SetTimeout(10);
+ aTimer.SetTimeoutHdl(LINK(this,SvInplaceEdit2,Timeout_Impl));
+ aTimer.Start();
+ }
+}
+
+IMPL_LINK_INLINE_START( SvInplaceEdit2, Timeout_Impl, Timer *, pTimer )
+{
+ DBG_CHKTHIS(SvInplaceEdit2,0);
+ CallCallBackHdl_Impl();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvInplaceEdit2, Timeout_Impl, Timer *, pTimer )
+
+void SvInplaceEdit2::CallCallBackHdl_Impl()
+{
+ DBG_CHKTHIS(SvInplaceEdit2,0);
+ aTimer.Stop();
+ if ( !bAlreadyInCallBack )
+ {
+ bAlreadyInCallBack = TRUE;
+ GetpApp()->RemoveAccel( &aAccReturn );
+ GetpApp()->RemoveAccel( &aAccEscape );
+ pEdit->Hide();
+ aCallBackHdl.Call( this );
+ }
+}
+
+XubString SvInplaceEdit2::GetText() const
+{
+ return pEdit->GetText();
+}
+
+// ***************************************************************
+// class SvLBoxTab
+// ***************************************************************
+
+DBG_NAME(SvLBoxTab);
+
+SvLBoxTab::SvLBoxTab()
+{
+ DBG_CTOR(SvLBoxTab,0);
+ nPos = 0;
+ pUserData = 0;
+ nFlags = 0;
+}
+
+SvLBoxTab::SvLBoxTab( long nPosition, USHORT nTabFlags )
+{
+ DBG_CTOR(SvLBoxTab,0);
+ nPos = nPosition;
+ pUserData = 0;
+ nFlags = nTabFlags;
+}
+
+SvLBoxTab::SvLBoxTab( const SvLBoxTab& rTab )
+{
+ DBG_CTOR(SvLBoxTab,0);
+ nPos = rTab.nPos;
+ pUserData = rTab.pUserData;
+ nFlags = rTab.nFlags;
+}
+
+SvLBoxTab::~SvLBoxTab()
+{
+ DBG_DTOR(SvLBoxTab,0);
+}
+
+
+long SvLBoxTab::CalcOffset( long nItemWidth, long nTabWidth )
+{
+ DBG_CHKTHIS(SvLBoxTab,0);
+ long nOffset = 0;
+ if ( nFlags & SV_LBOXTAB_ADJUST_RIGHT )
+ {
+ nOffset = nTabWidth - nItemWidth;
+ if( nOffset < 0 )
+ nOffset = 0;
+ }
+ else if ( nFlags & SV_LBOXTAB_ADJUST_CENTER )
+ {
+ if( nFlags & SV_LBOXTAB_FORCE )
+ {
+ //richtige Implementierung der Zentrierung
+ nOffset = ( nTabWidth - nItemWidth ) / 2;
+ if( nOffset < 0 )
+ nOffset = 0;
+ }
+ else
+ {
+ // historisch gewachsene falsche Berechnung des Tabs, auf die sich
+ // Abo-Tabbox, Extras/Optionen/Anpassen etc. verlassen
+ nItemWidth++;
+ nOffset = -( nItemWidth / 2 );
+ }
+ }
+ return nOffset;
+}
+
+/*
+long SvLBoxTab::CalcOffset( const XubString& rStr, const OutputDevice& rOutDev )
+{
+ DBG_CHKTHIS(SvLBoxTab,0);
+ long nWidth;
+ if ( nFlags & SV_LBOXTAB_ADJUST_NUMERIC )
+ {
+ USHORT nPos = rStr.Search( '.' );
+ if ( nPos == STRING_NOTFOUND )
+ nPos = rStr.Search( ',' );
+ if ( nPos == STRING_NOTFOUND )
+ nPos = STRING_LEN;
+
+ nWidth = rOutDev.GetTextSize( rStr, 0, nPos ).Width();
+ nWidth *= -1;
+ }
+ else
+ {
+ nWidth = rOutDev.GetTextSize( rStr ).Width();
+ nWidth = CalcOffset( nWidth );
+ }
+ return nWidth;
+}
+*/
+
+// ***************************************************************
+// class SvLBoxItem
+// ***************************************************************
+
+DBG_NAME(SvLBoxItem);
+
+SvLBoxItem::SvLBoxItem( SvLBoxEntry*, USHORT )
+{
+ DBG_CTOR(SvLBoxItem,0);
+}
+
+SvLBoxItem::SvLBoxItem()
+{
+ DBG_CTOR(SvLBoxItem,0);
+}
+
+SvLBoxItem::~SvLBoxItem()
+{
+ DBG_DTOR(SvLBoxItem,0);
+}
+
+const Size& SvLBoxItem::GetSize( SvLBox* pView,SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvLBoxItem,0);
+ SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
+ return pViewData->aSize;
+}
+
+const Size& SvLBoxItem::GetSize( SvLBoxEntry* pEntry, SvViewDataEntry* pViewData)
+{
+ DBG_CHKTHIS(SvLBoxItem,0);
+ USHORT nItemPos = pEntry->GetPos( this );
+ SvViewDataItem* pItemData = pViewData->pItemData+nItemPos;
+ return pItemData->aSize;
+}
+
+DBG_NAME(SvViewDataItem);
+
+SvViewDataItem::SvViewDataItem()
+{
+ DBG_CTOR(SvViewDataItem,0);
+}
+
+SvViewDataItem::~SvViewDataItem()
+{
+ DBG_DTOR(SvViewDataItem,0);
+}
+
+
+
+// ***************************************************************
+// class SvLBoxEntry
+// ***************************************************************
+
+DBG_NAME(SvLBoxEntry);
+
+SvLBoxEntry::SvLBoxEntry() : aItems()
+{
+ DBG_CTOR(SvLBoxEntry,0);
+ nEntryFlags = 0;
+ pUserData = 0;
+}
+
+SvLBoxEntry::~SvLBoxEntry()
+{
+ DBG_DTOR(SvLBoxEntry,0);
+ DeleteItems_Impl();
+}
+
+void SvLBoxEntry::DeleteItems_Impl()
+{
+ DBG_CHKTHIS(SvLBoxEntry,0);
+ USHORT nCount = aItems.Count();
+ while( nCount )
+ {
+ nCount--;
+ SvLBoxItem* pItem = (SvLBoxItem*)aItems.GetObject( nCount );
+ delete pItem;
+ }
+ aItems.Remove(0, aItems.Count() );
+}
+
+
+void SvLBoxEntry::AddItem( SvLBoxItem* pItem )
+{
+ DBG_CHKTHIS(SvLBoxEntry,0);
+ aItems.Insert( pItem, aItems.Count() );
+}
+
+void SvLBoxEntry::Clone( SvListEntry* pSource )
+{
+ DBG_CHKTHIS(SvLBoxEntry,0);
+ SvListEntry::Clone( pSource );
+ SvLBoxItem* pNewItem;
+ DeleteItems_Impl();
+ USHORT nCount = ((SvLBoxEntry*)pSource)->ItemCount();
+ USHORT nCurPos = 0;
+ while( nCurPos < nCount )
+ {
+ SvLBoxItem* pItem = ((SvLBoxEntry*)pSource)->GetItem( nCurPos );
+ pNewItem = pItem->Create();
+ pNewItem->Clone( pItem );
+ AddItem( pNewItem );
+ nCurPos++;
+ }
+ pUserData = ((SvLBoxEntry*)pSource)->GetUserData();
+ nEntryFlags = ((SvLBoxEntry*)pSource)->nEntryFlags;
+}
+
+void SvLBoxEntry::EnableChildsOnDemand( BOOL bEnable )
+{
+ DBG_CHKTHIS(SvLBoxEntry,0);
+ if ( bEnable )
+ nEntryFlags |= SV_ENTRYFLAG_CHILDS_ON_DEMAND;
+ else
+ nEntryFlags &= (~SV_ENTRYFLAG_CHILDS_ON_DEMAND);
+}
+
+void SvLBoxEntry::ReplaceItem( SvLBoxItem* pNewItem, USHORT nPos )
+{
+ DBG_CHKTHIS(SvLBoxEntry,0);
+ DBG_ASSERT(pNewItem,"ReplaceItem:No Item")
+ SvLBoxItem* pOld = GetItem( nPos );
+ if ( pOld )
+ {
+ aItems.Remove( nPos );
+ aItems.Insert( pNewItem, nPos );
+ delete pOld;
+ }
+}
+
+SvLBoxItem* SvLBoxEntry::GetFirstItem( USHORT nId )
+{
+ USHORT nCount = aItems.Count();
+ USHORT nCur = 0;
+ SvLBoxItem* pItem;
+ while( nCur < nCount )
+ {
+ pItem = GetItem( nCur );
+ if( pItem->IsA() == nId )
+ return pItem;
+ nCur++;
+ }
+ return 0;
+}
+
+// ***************************************************************
+// class SvLBoxViewData
+// ***************************************************************
+
+DBG_NAME(SvViewDataEntry);
+
+SvViewDataEntry::SvViewDataEntry()
+ : SvViewData()
+{
+ DBG_CTOR(SvViewDataEntry,0);
+ pItemData = 0;
+}
+
+SvViewDataEntry::~SvViewDataEntry()
+{
+ DBG_DTOR(SvViewDataEntry,0);
+ __DELETE(nItmCnt) pItemData;
+}
+
+// ***************************************************************
+// class SvLBox
+// ***************************************************************
+
+DBG_NAME(SvLBox);
+
+
+__EXPORT SvLBox::SvLBox( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle | WB_CLIPCHILDREN )
+{
+ DBG_CTOR(SvLBox,0);
+ nWindowStyle = nWinStyle;
+ nDragOptions = DRAG_ALL;
+ nImpFlags = 0;
+ pTargetEntry = 0;
+ nDragDropMode = 0;
+ pReserved = 0;
+ nReserved = 0;
+ SvLBoxTreeList* pTempModel = new SvLBoxTreeList;
+ pTempModel->SetRefCount( 0 );
+ SetModel( pTempModel );
+ pModel->SetCloneLink( LINK(this, SvLBox, CloneHdl_Impl ));
+ pModel->InsertView( this );
+ pHdlEntry = 0;
+ pEdCtrl = 0;
+ aMovePtr = Pointer( POINTER_MOVEDATA );
+ aCopyPtr = Pointer( POINTER_COPYDATA );
+ SetSelectionMode( SINGLE_SELECTION ); // pruefen ob TreeListBox gecallt wird
+ SetDragDropMode( SV_DRAGDROP_NONE );
+#ifdef MAC
+ Font aFont( "Geneva", Size( 0, 10 ) );
+ SetFont( aFont );
+#endif
+}
+
+__EXPORT SvLBox::SvLBox( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId )
+{
+ DBG_CTOR(SvLBox,0);
+ pTargetEntry = 0;
+ nImpFlags = 0;
+ nWindowStyle = 0;
+ pReserved = 0;
+ nReserved = 0;
+ nDragOptions = DRAG_ALL;
+ nDragDropMode = 0;
+ SvLBoxTreeList* pTempModel = new SvLBoxTreeList;
+ pTempModel->SetRefCount( 0 );
+ SetModel( pTempModel );
+ pModel->InsertView( this );
+ pHdlEntry = 0;
+ pEdCtrl = 0;
+ pModel->SetCloneLink( LINK(this, SvLBox, CloneHdl_Impl ));
+ aMovePtr = Pointer( POINTER_MOVEDATA );
+ aCopyPtr = Pointer( POINTER_COPYDATA );
+#ifdef MAC
+ Font aFont( "Geneva", Size( 0, 10 ) );
+ SetFont( aFont );
+#endif
+}
+
+
+__EXPORT SvLBox::~SvLBox()
+{
+ DBG_DTOR(SvLBox,0);
+ delete pEdCtrl;
+ pEdCtrl = 0;
+ pModel->RemoveView( this );
+ if ( pModel->GetRefCount() == 0 )
+ {
+ pModel->Clear();
+ delete pModel;
+ }
+ if( nReserved )
+ {
+ *((BOOL*)nReserved) = TRUE;
+ }
+}
+
+void SvLBox::SetModel( SvLBoxTreeList* pNewModel )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ // erledigt das ganz CleanUp
+ SvListView::SetModel( pNewModel );
+ pModel->SetCloneLink( LINK(this, SvLBox, CloneHdl_Impl ));
+ SvLBoxEntry* pEntry = First();
+ while( pEntry )
+ {
+ ModelHasInserted( pEntry );
+ pEntry = Next( pEntry );
+ }
+}
+
+void SvLBox::DisconnectFromModel()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ SvLBoxTreeList* pNewModel = new SvLBoxTreeList;
+ SvListView::SetModel( pNewModel );
+}
+
+void SvLBox::Clear()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ pModel->Clear(); // Model ruft SvLBox::ModelHasCleared() auf
+}
+
+
+USHORT SvLBox::IsA()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return SVLISTBOX_ID_LBOX;
+}
+
+IMPL_LINK_INLINE_START( SvLBox, CloneHdl_Impl, SvListEntry*, pEntry )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return (long)(CloneEntry((SvLBoxEntry*)pEntry));
+}
+IMPL_LINK_INLINE_END( SvLBox, CloneHdl_Impl, SvListEntry*, pEntry )
+
+ULONG SvLBox::Insert( SvLBoxEntry* pEntry, SvLBoxEntry* pParent, ULONG nPos )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ ULONG nInsPos = pModel->Insert( pEntry, pParent, nPos );
+ return nInsPos;
+}
+
+ULONG SvLBox::Insert( SvLBoxEntry* pEntry,ULONG nRootPos )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ ULONG nInsPos = pModel->Insert( pEntry, nRootPos );
+ return nInsPos;
+}
+
+long SvLBox::ExpandingHdl()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return aExpandingHdl.IsSet() ? aExpandingHdl.Call( this ) : 1;
+}
+
+void SvLBox::ExpandedHdl()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ aExpandedHdl.Call( this );
+}
+
+void SvLBox::SelectHdl()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ aSelectHdl.Call( this );
+}
+
+void SvLBox::DeselectHdl()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ aDeselectHdl.Call( this );
+}
+
+BOOL SvLBox::DoubleClickHdl()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ aDoubleClickHdl.Call( this );
+ return TRUE;
+}
+
+void __EXPORT SvLBox::BeginDrag( const Point& rPos )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ BOOL bDeleted = FALSE;
+
+ ReleaseMouse();
+ SvLBoxDDInfo aDDInfo;
+ SvLBoxEntry* pEntry = GetEntry( rPos ); // GetDropTarget( rPos );
+ if ( !pEntry )
+ {
+ EndDrag();
+ return;
+ }
+
+ DragServer::Clear();
+
+ DragDropMode nTemp = GetDragDropMode();
+ nDragDropMode = NotifyBeginDrag(pEntry);
+ if( !nDragDropMode || GetSelectionCount() == 0 )
+ {
+ nDragDropMode = nTemp;
+ EndDrag();
+ return;
+ }
+
+ ULONG nDDFormatId = SOT_FORMATSTR_ID_TREELISTBOX;
+ memset(&aDDInfo,0,sizeof(SvLBoxDDInfo));
+ aDDInfo.pApp = GetpApp();
+ aDDInfo.pSource = this;
+ aDDInfo.pDDStartEntry = pEntry;
+ // abgeleitete Views zum Zuge kommen lassen
+ WriteDragServerInfo( rPos, &aDDInfo );
+ DragServer::CopyData( &aDDInfo, sizeof(SvLBoxDDInfo), nDDFormatId );
+ pDDSource = this;
+ pDDTarget = 0;
+ DropAction eAction;
+
+ BOOL bOldUpdateMode = Control::IsUpdateMode();
+ Control::SetUpdateMode( TRUE );
+ Update();
+ Control::SetUpdateMode( bOldUpdateMode );
+
+ // Selektion & deren Childs im Model als DropTargets sperren
+ // Wichtig: Wenn im DropHandler die Selektion der
+ // SourceListBox veraendert wird, muessen vorher die Eintraege
+ // als DropTargets wieder freigeschaltet werden:
+ // (GetSourceListBox()->EnableSelectionAsDropTarget( TRUE, TRUE );)
+ EnableSelectionAsDropTarget( FALSE, TRUE /* with Childs */ );
+
+ Region aRegion( GetDragRegion() ); // fuer die Mac-Leute
+ nReserved = (ULONG)&bDeleted;
+ eAction = ExecuteDrag( aMovePtr, aCopyPtr, nDragOptions, &aRegion );
+ nReserved = 0;
+ if( bDeleted )
+ {
+ EndDrag();
+ return;
+ }
+
+ EnableSelectionAsDropTarget( TRUE, TRUE );
+
+ if( (eAction == DROP_MOVE) &&
+ (
+ (pDDTarget && ((ULONG)(pDDTarget->GetModel())!=(ULONG)(this->GetModel()))) ||
+ !pDDTarget ))
+ {
+ RemoveSelection();
+ }
+
+ ImplShowTargetEmphasis( pTargetEntry, FALSE );
+ EndDrag();
+ nDragDropMode = nTemp;
+}
+
+
+void SvLBox::EndDrag()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ pDDSource = 0;
+ pDDTarget = 0;
+ pTargetEntry = 0;
+}
+
+BOOL SvLBox::CheckDragAndDropMode( SvLBox* pSource, DropAction eAction )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ if ( pSource == this )
+ {
+ if ( !(nDragDropMode & (SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY) ) )
+ return FALSE; // D&D innerhalb der Liste gesperrt
+ if ( eAction == DROP_MOVE )
+ {
+ if ( !(nDragDropMode & SV_DRAGDROP_CTRL_MOVE) )
+ return FALSE; // kein lokales Move
+ }
+ else
+ {
+ if ( !(nDragDropMode & SV_DRAGDROP_CTRL_COPY))
+ return FALSE; // kein lokales Copy
+ }
+ }
+ else
+ {
+ if ( !(nDragDropMode & SV_DRAGDROP_APP_DROP ) )
+ return FALSE; // kein Drop
+ if ( eAction == DROP_MOVE )
+ {
+ if ( !(nDragDropMode & SV_DRAGDROP_APP_MOVE) )
+ return FALSE; // kein globales Move
+ }
+ else
+ {
+ if ( !(nDragDropMode & SV_DRAGDROP_APP_COPY))
+ return FALSE; // kein globales Copy
+ }
+ }
+ return TRUE;
+}
+
+
+BOOL __EXPORT SvLBox::QueryDrop( DropEvent& rDEvt )
+{
+ DBG_CHKTHIS(SvLBox,0);
+
+ if ( rDEvt.IsLeaveWindow() || !CheckDragAndDropMode( pDDSource, rDEvt.GetAction() ) )
+ {
+ ImplShowTargetEmphasis( pTargetEntry, FALSE );
+ return FALSE;
+ }
+
+ if ( !nDragDropMode )
+ {
+ DBG_ERRORFILE( "SvLBox::QueryDrop(): no target" );
+ return FALSE;
+ }
+
+ BOOL bAllowDrop = TRUE;
+
+ ULONG nDDFormatId = SOT_FORMATSTR_ID_TREELISTBOX;
+ if ( !DragServer::HasFormat( 0, nDDFormatId ) )
+ {
+ DBG_ERRORFILE( "SvLBox::QueryDrop(): no format" );
+ bAllowDrop = FALSE;
+ }
+
+ SvLBoxEntry* pEntry = GetDropTarget( rDEvt.GetPosPixel() );
+
+ if ( bAllowDrop )
+ {
+ DBG_ASSERT( pDDSource, "SvLBox::QueryDrop(): SourceBox == 0 (__EXPORT?)" );
+ if ( pEntry && pDDSource->GetModel() == this->GetModel()
+ && rDEvt.GetAction()==DROP_MOVE
+ && ( pEntry->nEntryFlags & SV_ENTRYFLAG_DISABLE_DROP ) )
+ {
+ bAllowDrop = FALSE; // nicht auf sich selbst moven
+ }
+ }
+ if ( bAllowDrop )
+ bAllowDrop = NotifyQueryDrop( pEntry );
+
+
+ // **** Emphasis zeichnen ****
+
+ if ( bAllowDrop )
+ {
+ if ( pEntry != pTargetEntry || !(nImpFlags & SVLBOX_TARGEMPH_VIS) )
+ {
+ ImplShowTargetEmphasis( pTargetEntry, FALSE );
+ pTargetEntry = pEntry;
+ ImplShowTargetEmphasis( pTargetEntry, TRUE );
+ }
+ }
+ else
+ ImplShowTargetEmphasis( pTargetEntry, FALSE );
+
+ return bAllowDrop;
+}
+
+BOOL __EXPORT SvLBox::Drop( const DropEvent& rDEvt )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ GetSourceView()->EnableSelectionAsDropTarget( TRUE, TRUE );
+
+ ImplShowTargetEmphasis( pTargetEntry, FALSE );
+ pDDTarget = this;
+ ULONG nDDFormatId = SOT_FORMATSTR_ID_TREELISTBOX;
+
+ SvLBoxDDInfo aDDInfo;
+ if( !DragServer::PasteData(0, &aDDInfo, sizeof(SvLBoxDDInfo),nDDFormatId ))
+ return FALSE;
+ ReadDragServerInfo( rDEvt.GetPosPixel(), &aDDInfo );
+
+ SvLBoxEntry* pTarget = pTargetEntry; // !!! kann 0 sein !!!
+ BOOL bDataAccepted;
+ if ( rDEvt.GetAction() == DROP_COPY )
+ bDataAccepted = CopySelection( aDDInfo.pSource, pTarget );
+ else
+ bDataAccepted = MoveSelection( aDDInfo.pSource, pTarget );
+ return bDataAccepted;
+}
+
+DragDropMode SvLBox::NotifyBeginDrag( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return (DragDropMode)0xffff;
+}
+
+BOOL SvLBox::NotifyQueryDrop( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return TRUE;
+}
+
+void SvLBox::NotifyRemoving( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+/*
+ NotifyMoving/Copying
+ ====================
+
+ Standard-Verhalten:
+
+ 1. Target hat keine Childs
+ - Entry wird Sibling des Targets. Entry steht hinter dem
+ Target (->Fenster: Unter dem Target)
+ 2. Target ist ein aufgeklappter Parent
+ - Entry wird an den Anfang der Target-Childlist gehaengt
+ 3. Target ist ein zugeklappter Parent
+ - Entry wird an das Ende der Target-Childlist gehaengt
+*/
+
+BOOL SvLBox::NotifyMoving(
+ SvLBoxEntry* pTarget, // D&D-Drop-Position in this->GetModel()
+ SvLBoxEntry* pEntry, // Zu verschiebender Entry aus
+ // GetSourceListBox()->GetModel()
+ SvLBoxEntry*& rpNewParent, // Neuer Target-Parent
+ ULONG& rNewChildPos) // Position in Childlist des Target-Parents
+{
+ DBG_CHKTHIS(SvLBox,0);
+ DBG_ASSERT(pEntry,"NotifyMoving:SoureEntry?")
+ if( !pTarget )
+ {
+ rpNewParent = 0;
+ rNewChildPos = 0;
+ return TRUE;
+ }
+ if ( !pTarget->HasChilds() && !pTarget->HasChildsOnDemand() )
+ {
+ // Fall 1
+ rpNewParent = GetParent( pTarget );
+ rNewChildPos = pModel->GetRelPos( pTarget ) + 1;
+ rNewChildPos += nCurEntrySelPos;
+ nCurEntrySelPos++;
+ }
+ else
+ {
+ // Faelle 2 & 3
+ rpNewParent = pTarget;
+ if( IsExpanded(pTarget))
+ rNewChildPos = 0;
+ else
+ rNewChildPos = LIST_APPEND;
+ }
+ return TRUE;
+}
+
+BOOL SvLBox::NotifyCopying(
+ SvLBoxEntry* pTarget, // D&D-Drop-Position in this->GetModel()
+ SvLBoxEntry* pEntry, // Zu kopierender Entry aus
+ // GetSourceListBox()->GetModel()
+ SvLBoxEntry*& rpNewParent, // Neuer Target-Parent
+ ULONG& rNewChildPos) // Position in Childlist des Target-Parents
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos);
+ /*
+ DBG_ASSERT(pEntry,"NotifyCopying:SourceEntry?")
+ if( !pTarget )
+ {
+ rpNewParent = 0;
+ rNewChildPos = 0;
+ return TRUE;
+ }
+ if ( !pTarget->HasChilds() && !pTarget->HasChildsOnDemand() )
+ {
+ // Fall 1
+ rpNewParent = GetParent( pTarget );
+ rNewChildPos = GetRelPos( pTarget ) + 1;
+ }
+ else
+ {
+ // Faelle 2 & 3
+ rpNewParent = pTarget;
+ if( IsExpanded(pTarget))
+ rNewChildPos = 0;
+ else
+ rNewChildPos = LIST_APPEND;
+ }
+ return TRUE;
+ */
+}
+
+SvLBoxEntry* __EXPORT SvLBox::CloneEntry( SvLBoxEntry* pSource )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)CreateEntry(); // new SvLBoxEntry;
+ pEntry->Clone( (SvListEntry*)pSource );
+ return pEntry;
+}
+
+
+// Rueckgabe: Alle Entries wurden kopiert
+BOOL SvLBox::CopySelection( SvLBox* pSource, SvLBoxEntry* pTarget )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ nCurEntrySelPos = 0; // Selektionszaehler fuer NotifyMoving/Copying
+ BOOL bSuccess = TRUE;
+ SvTreeEntryList aList;
+ BOOL bClone = (BOOL)( (ULONG)(pSource->GetModel()) != (ULONG)GetModel() );
+ Link aCloneLink( pModel->GetCloneLink() );
+ pModel->SetCloneLink( LINK(this, SvLBox, CloneHdl_Impl ));
+
+ // Selektion zwischenspeichern, um bei D&D-Austausch
+ // innerhalb der gleichen Listbox das Iterieren ueber
+ // die Selektion zu vereinfachen
+ SvLBoxEntry* pSourceEntry = pSource->FirstSelected();
+ while ( pSourceEntry )
+ {
+ // Childs werden automatisch mitkopiert
+ pSource->SelectChilds( pSourceEntry, FALSE );
+ aList.Insert( pSourceEntry, LIST_APPEND );
+ pSourceEntry = pSource->NextSelected( pSourceEntry );
+ }
+
+ pSourceEntry = (SvLBoxEntry*)aList.First();
+ while ( pSourceEntry )
+ {
+ SvLBoxEntry* pNewParent = 0;
+ ULONG nInsertionPos = LIST_APPEND;
+ BOOL bOk=NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos);
+ if ( bOk )
+ {
+ if ( bClone )
+ {
+ ULONG nCloneCount = 0;
+ pSourceEntry = (SvLBoxEntry*)
+ pModel->Clone( (SvListEntry*)pSourceEntry, nCloneCount );
+ pModel->InsertTree( (SvListEntry*)pSourceEntry,
+ (SvListEntry*)pNewParent, nInsertionPos );
+ }
+ else
+ {
+ ULONG nListPos = pModel->Copy( (SvListEntry*)pSourceEntry,
+ (SvListEntry*)pNewParent, nInsertionPos );
+ pSourceEntry = GetEntry( pNewParent, nListPos );
+ }
+ }
+ else
+ bSuccess = FALSE;
+
+ if( bOk == (BOOL)2 ) // !!!HACK verschobenen Entry sichtbar machen?
+ MakeVisible( pSourceEntry );
+
+ pSourceEntry = (SvLBoxEntry*)aList.Next();
+ }
+ pModel->SetCloneLink( aCloneLink );
+ return bSuccess;
+}
+
+// Rueckgabe: Alle Entries wurden verschoben
+BOOL SvLBox::MoveSelection( SvLBox* pSource, SvLBoxEntry* pTarget )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ nCurEntrySelPos = 0; // Selektionszaehler fuer NotifyMoving/Copying
+ BOOL bSuccess = TRUE;
+ SvTreeEntryList aList;
+ BOOL bClone = (BOOL)( (ULONG)(pSource->GetModel()) != (ULONG)GetModel() );
+ Link aCloneLink( pModel->GetCloneLink() );
+ if ( bClone )
+ pModel->SetCloneLink( LINK(this, SvLBox, CloneHdl_Impl ));
+
+ SvLBoxEntry* pSourceEntry = pSource->FirstSelected();
+ while ( pSourceEntry )
+ {
+ // Childs werden automatisch mitbewegt
+ pSource->SelectChilds( pSourceEntry, FALSE );
+ aList.Insert( pSourceEntry, LIST_APPEND );
+ pSourceEntry = pSource->NextSelected( pSourceEntry );
+ }
+
+ pSourceEntry = (SvLBoxEntry*)aList.First();
+ while ( pSourceEntry )
+ {
+ SvLBoxEntry* pNewParent = 0;
+ ULONG nInsertionPos = LIST_APPEND;
+ BOOL bOk= NotifyMoving(pTarget,pSourceEntry,pNewParent,nInsertionPos);
+ if ( bOk )
+ {
+ if ( bClone )
+ {
+ ULONG nCloneCount = 0;
+ pSourceEntry = (SvLBoxEntry*)
+ pModel->Clone( (SvListEntry*)pSourceEntry, nCloneCount );
+ pModel->InsertTree( (SvListEntry*)pSourceEntry,
+ (SvListEntry*)pNewParent, nInsertionPos );
+ }
+ else
+ pModel->Move( (SvListEntry*)pSourceEntry,
+ (SvListEntry*)pNewParent, nInsertionPos );
+ }
+ else
+ bSuccess = FALSE;
+
+ if( bOk == (BOOL)2 ) // !!!HACK verschobenen Entry sichtbar machen?
+ MakeVisible( pSourceEntry );
+
+ pSourceEntry = (SvLBoxEntry*)aList.Next();
+ }
+ pModel->SetCloneLink( aCloneLink );
+ return bSuccess;
+}
+
+void SvLBox::RemoveSelection()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ SvTreeEntryList aList;
+ // Selektion zwischenspeichern, da die Impl bei
+ // dem ersten Remove alles deselektiert!
+ SvLBoxEntry* pEntry = FirstSelected();
+ while ( pEntry )
+ {
+ aList.Insert( pEntry );
+ if ( pEntry->HasChilds() )
+ // Remove loescht Childs automatisch
+ SelectChilds( pEntry, FALSE );
+ pEntry = NextSelected( pEntry );
+ }
+ pEntry = (SvLBoxEntry*)aList.First();
+ while ( pEntry )
+ {
+ pModel->Remove( pEntry );
+ pEntry = (SvLBoxEntry*)aList.Next();
+ }
+}
+
+
+SvLBox* __EXPORT SvLBox::GetSourceView() const
+ { return pDDSource; }
+
+SvLBox* __EXPORT SvLBox::GetTargetView() const
+ { return pDDTarget; }
+
+void SvLBox::RequestingChilds( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ DBG_ERROR("Child-Request-Hdl not implemented!")
+}
+
+void SvLBox::RecalcViewData()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ SvLBoxEntry* pEntry = First();
+ while( pEntry )
+ {
+ USHORT nCount = pEntry->ItemCount();
+ USHORT nCurPos = 0;
+ while ( nCurPos < nCount )
+ {
+ SvLBoxItem* pItem = pEntry->GetItem( nCurPos );
+ pItem->InitViewData( this, pEntry );
+ nCurPos++;
+ }
+ ViewDataInitialized( pEntry );
+ pEntry = Next( pEntry );
+ }
+}
+
+void SvLBox::ViewDataInitialized( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+
+void SvLBox::ImplShowTargetEmphasis( SvLBoxEntry* pEntry, BOOL bShow)
+{
+ DBG_CHKTHIS(SvLBox,0);
+ if ( bShow && (nImpFlags & SVLBOX_TARGEMPH_VIS) )
+ return;
+ if ( !bShow && !(nImpFlags & SVLBOX_TARGEMPH_VIS) )
+ return;
+ ShowTargetEmphasis( pEntry, bShow );
+ if( bShow )
+ nImpFlags |= SVLBOX_TARGEMPH_VIS;
+ else
+ nImpFlags &= ~SVLBOX_TARGEMPH_VIS;
+}
+
+void SvLBox::ShowTargetEmphasis( SvLBoxEntry*, BOOL /* bShow */ )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+
+BOOL SvLBox::Expand( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return TRUE;
+}
+
+BOOL SvLBox::Collapse( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return TRUE;
+}
+
+BOOL SvLBox::Select( SvLBoxEntry*, BOOL )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return FALSE;
+}
+
+ULONG SvLBox::SelectChilds( SvLBoxEntry* , BOOL )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return 0;
+}
+
+void SvLBox::SelectAll( BOOL /* bSelect */ , BOOL /* bPaint */ )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+void SvLBox::SetSelectionMode( SelectionMode eSelectMode )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ eSelMode = eSelectMode;
+}
+
+void SvLBox::SetDragDropMode( DragDropMode nDDMode )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ if( nDDMode && !nDragDropMode )
+ EnableDrop();
+ nDragDropMode = nDDMode;
+}
+
+SvViewData* SvLBox::CreateViewData( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ SvViewDataEntry* pEntryData = new SvViewDataEntry;
+ return (SvViewData*)pEntryData;
+}
+
+void SvLBox::InitViewData( SvViewData* pData, SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ SvLBoxEntry* pInhEntry = (SvLBoxEntry*)pEntry;
+ SvViewDataEntry* pEntryData = (SvViewDataEntry*)pData;
+
+ pEntryData->pItemData = new SvViewDataItem[ pInhEntry->ItemCount() ];
+ SvViewDataItem* pItemData = pEntryData->pItemData;
+ pEntryData->nItmCnt = pInhEntry->ItemCount(); // Anzahl Items fuer delete
+ USHORT nCount = pInhEntry->ItemCount();
+ USHORT nCurPos = 0;
+ while( nCurPos < nCount )
+ {
+ SvLBoxItem* pItem = pInhEntry->GetItem( nCurPos );
+ pItem->InitViewData( this, pInhEntry, pItemData );
+ pItemData++;
+ nCurPos++;
+ }
+}
+
+
+
+void SvLBox::EnableSelectionAsDropTarget( BOOL bEnable, BOOL bWithChilds )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ USHORT nRefDepth;
+ SvLBoxEntry* pTemp;
+
+ SvLBoxEntry* pSelEntry = FirstSelected();
+ while( pSelEntry )
+ {
+ if ( !bEnable )
+ {
+ pSelEntry->nEntryFlags |= SV_ENTRYFLAG_DISABLE_DROP;
+ if ( bWithChilds )
+ {
+ nRefDepth = pModel->GetDepth( pSelEntry );
+ pTemp = Next( pSelEntry );
+ while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth )
+ {
+ pTemp->nEntryFlags |= SV_ENTRYFLAG_DISABLE_DROP;
+ pTemp = Next( pTemp );
+ }
+ }
+ }
+ else
+ {
+ pSelEntry->nEntryFlags &= (~SV_ENTRYFLAG_DISABLE_DROP);
+ if ( bWithChilds )
+ {
+ nRefDepth = pModel->GetDepth( pSelEntry );
+ pTemp = Next( pSelEntry );
+ while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth )
+ {
+ pTemp->nEntryFlags &= (~SV_ENTRYFLAG_DISABLE_DROP);
+ pTemp = Next( pTemp );
+ }
+ }
+ }
+ pSelEntry = NextSelected( pSelEntry );
+ }
+}
+
+SvLBoxEntry* SvLBox::GetDropTarget( const Point& )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return 0;
+}
+
+// ******************************************************************
+// InplaceEditing
+// ******************************************************************
+
+void SvLBox::EditText( const XubString& rStr, const Rectangle& rRect,
+ const Selection& rSel )
+{
+ EditText( rStr, rRect, rSel, FALSE );
+}
+
+void SvLBox::EditText( const XubString& rStr, const Rectangle& rRect,
+ const Selection& rSel, BOOL bMulti )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ if( pEdCtrl )
+ delete pEdCtrl;
+ nImpFlags |= SVLBOX_IN_EDT;
+ nImpFlags &= ~SVLBOX_EDTEND_CALLED;
+ HideFocus();
+ pEdCtrl = new SvInplaceEdit2(
+ this, rRect.TopLeft(), rRect.GetSize(), rStr,
+ LINK( this, SvLBox, TextEditEndedHdl_Impl ),
+ rSel, bMulti );
+}
+
+IMPL_LINK( SvLBox, TextEditEndedHdl_Impl, SvInplaceEdit2 *, pSvInplaceEdit )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ if ( nImpFlags & SVLBOX_EDTEND_CALLED ) // Nesting verhindern
+ return 0;
+ nImpFlags |= SVLBOX_EDTEND_CALLED;
+ XubString aStr;
+ if ( !pEdCtrl->EditingCanceled() )
+ aStr = pEdCtrl->GetText();
+ else
+ aStr = pEdCtrl->GetSavedValue();
+ EditedText( aStr );
+ // Hide darf erst gerufen werden, nachdem der neue Text in den
+ // Entry gesetzt wurde, damit im GetFocus der ListBox nicht
+ // der Selecthandler mit dem alten EntryText gerufen wird.
+ pEdCtrl->Hide();
+ // delete pEdCtrl;
+ // pEdCtrl = 0;
+ nImpFlags &= (~SVLBOX_IN_EDT);
+// GrabFocus();
+ return 0;
+}
+
+void SvLBox::CancelTextEditing()
+{
+ DBG_CHKTHIS(SvLBox,0);
+ if ( pEdCtrl )
+ pEdCtrl->StopEditing( TRUE );
+ nImpFlags &= (~SVLBOX_IN_EDT);
+}
+
+void SvLBox::EndEditing( BOOL bCancel )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ if( pEdCtrl )
+ pEdCtrl->StopEditing( bCancel );
+ nImpFlags &= (~SVLBOX_IN_EDT);
+}
+
+
+void SvLBox::EditedText( const XubString& )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+void SvLBox::EditingRequest( SvLBoxEntry*, SvLBoxItem*,const Point& )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+
+SvLBoxEntry* SvLBox::CreateEntry() const
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return new SvLBoxEntry;
+}
+
+void SvLBox::MakeVisible( SvLBoxEntry* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+Region SvLBox::GetDragRegion() const
+{
+ DBG_CHKTHIS(SvLBox,0);
+ Region aRegion;
+ return aRegion;
+}
+
+void SvLBox::Command( const CommandEvent& )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+SvLBoxEntry* SvLBox::GetEntry( const Point& rPos, BOOL ) const
+{
+ DBG_CHKTHIS(SvLBox,0);
+ return 0;
+}
+
+void __EXPORT SvLBox::ModelHasEntryInvalidated( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ USHORT nCount = ((SvLBoxEntry*)pEntry)->ItemCount();
+ for( USHORT nIdx = 0; nIdx < nCount; nIdx++ )
+ {
+ SvLBoxItem* pItem = ((SvLBoxEntry*)pEntry)->GetItem( nIdx );
+ pItem->InitViewData( this, (SvLBoxEntry*)pEntry, 0 );
+ }
+}
+
+void SvLBox::SetInUseEmphasis( SvLBoxEntry* pEntry, BOOL bInUse )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ DBG_ASSERT(pEntry,"SetInUseEmphasis:No Entry");
+ if( bInUse )
+ {
+ if( !pEntry->HasInUseEmphasis() )
+ {
+ pEntry->nEntryFlags |= SV_ENTRYFLAG_IN_USE;
+ pModel->InvalidateEntry( pEntry );
+ }
+ }
+ else
+ {
+ if( pEntry->HasInUseEmphasis() )
+ {
+ pEntry->nEntryFlags &= (~SV_ENTRYFLAG_IN_USE);
+ pModel->InvalidateEntry( pEntry );
+ }
+ }
+}
+
+void SvLBox::SetCursorEmphasis( SvLBoxEntry* pEntry, BOOL bCursored )
+{
+ DBG_CHKTHIS(SvLBox,0);
+ DBG_ASSERT(pEntry,"SetInUseEmphasis:No Entry");
+ SvViewDataEntry* pViewData = GetViewDataEntry( pEntry );
+ if( pViewData && (bCursored != pViewData->IsCursored()) )
+ {
+ pViewData->SetCursored( bCursored );
+ // paintet in allen Views
+ // pModel->InvalidateEntry( pEntry );
+ // invalidiert nur in dieser View
+ ModelHasEntryInvalidated( pEntry );
+ }
+}
+
+BOOL SvLBox::HasCursorEmphasis( SvLBoxEntry* pEntry ) const
+{
+ DBG_CHKTHIS(SvLBox,0);
+ DBG_ASSERT(pEntry,"SetInUseEmphasis:No Entry");
+ SvViewDataEntry* pViewData = GetViewDataEntry( pEntry );
+ DBG_ASSERT(pViewData,"Entry not in View");
+ return pViewData->IsCursored();
+}
+
+void SvLBox::WriteDragServerInfo( const Point&, SvLBoxDDInfo* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+void SvLBox::ReadDragServerInfo(const Point&, SvLBoxDDInfo* )
+{
+ DBG_CHKTHIS(SvLBox,0);
+}
+
+BOOL SvLBox::EditingCanceled() const
+{
+ if( pEdCtrl && pEdCtrl->EditingCanceled() )
+ return TRUE;
+ return FALSE;
+}
+
+
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
new file mode 100644
index 000000000000..2ab576bc2d54
--- /dev/null
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -0,0 +1,639 @@
+/*************************************************************************
+ *
+ * $RCSfile: svtabbx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*
+ Todo
+ - Tokenparsing optimieren
+ - Optimierungsfehler Microsoft/Win3.1 Funktion suchen
+*/
+
+// !!!HACK
+#ifdef _MSC_VER
+#pragma optimize( "", off )
+#endif
+#pragma hdrstop
+
+#include "svtabbx.hxx"
+#include "headbar.hxx"
+
+#define MYTABMASK (SV_LBOXTAB_ADJUST_RIGHT | SV_LBOXTAB_ADJUST_LEFT |\
+ SV_LBOXTAB_ADJUST_CENTER | SV_LBOXTAB_ADJUST_NUMERIC)
+
+// SvTreeListBox-Callback
+
+void SvTabListBox::SetTabs()
+{
+ SvTreeListBox::SetTabs();
+ if( nTabCount )
+ {
+ DBG_ASSERT(pTabList,"TabList ?");
+
+ // die TreeListBox hat jetzt ihre Tabulatoren in die Liste eingefuegt.
+ // jetzt plustern wir die Liste mit zusaetzlichen Tabulatoren auf,
+ // und passen den ganz rechten Tab der Treelistbox an.
+
+ // den ganz rechten Tab nehmen
+ // HACK fuer den Explorer! Wenn der ViewParent != 0 ist, dann wird
+ // der erste Tab der TreeListBox von der TreelistBox berechnet!
+ // Dies wird fuer ButtonsOnRoot benoetigt, da der Explorer nicht
+ // weiss, welchen zusaetzlichen Offset er in diesem Modus auf
+ // den Tabulator addieren muss. Die TreeListBox weiss es!
+ /*
+ if( !pViewParent )
+ {
+ SvLBoxTab* pFirstTab = (SvLBoxTab*)aTabs.GetObject( aTabs.Count()-1 );
+ pFirstTab->SetPos( pTabList[0].GetPos() );
+ pFirstTab->nFlags &= ~MYTABMASK;
+ pFirstTab->nFlags |= pTabList[0].nFlags;
+ }
+ */
+
+ // alle anderen Tabs an Liste haengen
+ for( USHORT nCurTab = 1; nCurTab < nTabCount; nCurTab++ )
+ {
+ SvLBoxTab* pTab = pTabList+nCurTab;
+ AddTab( pTab->GetPos(), pTab->nFlags );
+ }
+ }
+}
+
+void SvTabListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rStr,
+ const Image& rColl, const Image& rExp )
+{
+ SvTreeListBox::InitEntry( pEntry, rStr, rColl, rExp);
+ XubString aToken;
+
+ const xub_Unicode* pCurToken = aCurEntry.GetBuffer();
+ USHORT nCurTokenLen;
+ const xub_Unicode* pNextToken = GetToken( pCurToken, nCurTokenLen );
+ USHORT nCount = nTabCount; nCount--;
+ for( USHORT nToken = 0; nToken < nCount; nToken++ )
+ {
+ if( pCurToken && nCurTokenLen )
+ // aToken.Assign( pCurToken, nCurTokenLen );
+ aToken = XubString( pCurToken, nCurTokenLen );
+ else
+ aToken.Erase();
+ SvLBoxString* pStr = new SvLBoxString( pEntry, 0, aToken );
+ pEntry->AddItem( pStr );
+ pCurToken = pNextToken;
+ if( pCurToken )
+ pNextToken = GetToken( pCurToken, nCurTokenLen );
+ else
+ nCurTokenLen = 0;
+ }
+}
+
+
+SvTabListBox::SvTabListBox( Window* pParent, WinBits nBits )
+ : SvTreeListBox( pParent, nBits )
+{
+ pTabList = 0;
+ nTabCount = 0;
+ pViewParent = 0;
+ SetHighlightRange(); // ueber volle Breite selektieren
+}
+
+SvTabListBox::SvTabListBox( Window* pParent, const ResId& rResId )
+ : SvTreeListBox( pParent, rResId )
+{
+ pTabList = 0;
+ nTabCount = 0;
+ pViewParent = 0;
+ SvTabListBox::Resize();
+ SetHighlightRange();
+}
+
+SvTabListBox::~SvTabListBox()
+{
+ // array-delete
+ __DELETE(nTabCount) pTabList;
+#ifdef DBG_UTIL
+ pTabList = 0;
+ nTabCount = 0;
+#endif
+}
+
+void SvTabListBox::SetTabs( long* pTabs, MapUnit eMapUnit )
+{
+ DBG_ASSERT(pTabs,"SetTabs:NULL-Ptr");
+ if( !pTabs )
+ return;
+
+ __DELETE(nTabCount) pTabList;
+ USHORT nCount = (USHORT)(*pTabs);
+ pTabList = new SvLBoxTab[ nCount ];
+ nTabCount = nCount;
+
+ MapMode aMMSource( eMapUnit );
+ MapMode aMMDest( MAP_PIXEL );
+
+ pTabs++;
+ for( USHORT nIdx = 0; nIdx < nCount; nIdx++, pTabs++ )
+ {
+ Size aSize( *pTabs, 0 );
+ aSize = LogicToLogic( aSize, &aMMSource, &aMMDest );
+ long nNewTab = aSize.Width();
+ pTabList[nIdx].SetPos( nNewTab );
+ pTabList[nIdx].nFlags=(SV_LBOXTAB_ADJUST_LEFT| SV_LBOXTAB_INV_ALWAYS);
+ }
+ SvTreeListBox::nTreeFlags |= TREEFLAG_RECALCTABS;
+ if( IsUpdateMode() )
+ Invalidate();
+}
+
+void SvTabListBox::SetTab( USHORT nTab,long nValue,MapUnit eMapUnit )
+{
+ DBG_ASSERT(nTab<nTabCount,"Invalid Tab-Pos");
+ if( nTab < nTabCount )
+ {
+ DBG_ASSERT(pTabList,"TabList?");
+ MapMode aMMSource( eMapUnit );
+ MapMode aMMDest( MAP_PIXEL );
+ Size aSize( nValue, 0 );
+ aSize = LogicToLogic( aSize, &aMMSource, &aMMDest );
+ nValue = aSize.Width();
+ pTabList[ nTab ].SetPos( nValue );
+ SvTreeListBox::nTreeFlags |= TREEFLAG_RECALCTABS;
+ if( IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+#if SUPD < 375
+
+SvLBoxEntry* SvTabListBox::InsertEntry(const XubString& rStr,SvLBoxEntry* pParent,ULONG nPos,USHORT nCol )
+{
+ XubString aStr;
+ if( nCol != 0xffff )
+ {
+ while( nCol )
+ {
+ aStr += '\t';
+ nCol--;
+ }
+ }
+ aStr += rStr;
+ XubString aFirstStr( aStr );
+ USHORT nEnd = aFirstStr.Search( '\t' );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Cut( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+ return SvTreeListBox::InsertEntry( aFirstStr, pParent, FALSE, nPos );
+}
+
+SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rStr,
+ const Image& rExpandedEntryBmp, const Image& rCollapsedEntryBmp,
+ SvLBoxEntry* pParent,ULONG nPos,USHORT nCol )
+{
+ XubString aStr;
+ if( nCol != 0xffff )
+ {
+ while( nCol )
+ {
+ aStr += '\t';
+ nCol--;
+ }
+ }
+ aStr += rStr;
+ XubString aFirstStr( aStr );
+ USHORT nEnd = aFirstStr.Search( '\t' );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Cut( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+
+ return SvTreeListBox::InsertEntry(
+ aFirstStr,
+ rExpandedEntryBmp, rCollapsedEntryBmp,
+ pParent, FALSE, nPos );
+}
+
+
+SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rStr, ULONG nPos,
+ USHORT nCol )
+{
+ return InsertEntry( rStr,0,nPos, nCol );
+}
+
+SvLBoxEntry* SvTabListBox::InsertEntry(const XubString& rStr,SvLBoxEntry* pParent,ULONG nPos,USHORT nCol,
+ void* pUser )
+{
+ XubString aStr;
+ if( nCol != 0xffff )
+ {
+ while( nCol )
+ {
+ aStr += '\t';
+ nCol--;
+ }
+ }
+ aStr += rStr;
+ XubString aFirstStr( aStr );
+ USHORT nEnd = aFirstStr.Search( '\t' );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Cut( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+ return SvTreeListBox::InsertEntry( aFirstStr, pParent, FALSE, nPos, pUser );
+}
+
+SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rStr,
+ const Image& rExpandedEntryBmp, const Image& rCollapsedEntryBmp,
+ SvLBoxEntry* pParent,ULONG nPos,USHORT nCol, void* pUser )
+{
+ XubString aStr;
+ if( nCol != 0xffff )
+ {
+ while( nCol )
+ {
+ aStr += '\t';
+ nCol--;
+ }
+ }
+ aStr += rStr;
+ XubString aFirstStr( aStr );
+ USHORT nEnd = aFirstStr.Search( '\t' );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Cut( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+
+ return SvTreeListBox::InsertEntry(
+ aFirstStr,
+ rExpandedEntryBmp, rCollapsedEntryBmp,
+ pParent, FALSE, nPos, pUser );
+}
+
+
+SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rStr, ULONG nPos,
+ USHORT nCol, void* pUser )
+{
+ return InsertEntry( rStr,0,nPos, nCol, pUser );
+}
+
+#else
+
+SvLBoxEntry* SvTabListBox::InsertEntry(const XubString& rStr,SvLBoxEntry* pParent,ULONG nPos,USHORT nCol,
+ void* pUser )
+{
+ XubString aStr;
+ if( nCol != 0xffff )
+ {
+ while( nCol )
+ {
+ aStr += '\t';
+ nCol--;
+ }
+ }
+ aStr += rStr;
+ XubString aFirstStr( aStr );
+ USHORT nEnd = aFirstStr.Search( '\t' );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Erase( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+ return SvTreeListBox::InsertEntry( aFirstStr, pParent, FALSE, nPos, pUser );
+}
+
+SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rStr,
+ const Image& rExpandedEntryBmp, const Image& rCollapsedEntryBmp,
+ SvLBoxEntry* pParent,ULONG nPos,USHORT nCol, void* pUser )
+{
+ XubString aStr;
+ if( nCol != 0xffff )
+ {
+ while( nCol )
+ {
+ aStr += '\t';
+ nCol--;
+ }
+ }
+ aStr += rStr;
+ XubString aFirstStr( aStr );
+ USHORT nEnd = aFirstStr.Search( '\t' );
+ if( nEnd != STRING_NOTFOUND )
+ {
+ aFirstStr.Erase( nEnd );
+ aCurEntry = aStr;
+ aCurEntry.Erase( 0, ++nEnd );
+ }
+ else
+ aCurEntry.Erase();
+
+ return SvTreeListBox::InsertEntry(
+ aFirstStr,
+ rExpandedEntryBmp, rCollapsedEntryBmp,
+ pParent, FALSE, nPos, pUser );
+}
+
+
+SvLBoxEntry* SvTabListBox::InsertEntry( const XubString& rStr, ULONG nPos,
+ USHORT nCol, void* pUser )
+{
+ return InsertEntry( rStr,0,nPos, nCol, pUser );
+}
+
+#endif
+
+XubString SvTabListBox::GetEntryText( ULONG nPos, USHORT nCol ) const
+{
+ SvLBoxEntry* pEntry = SvTreeListBox::GetEntry( nPos );
+ return GetEntryText( pEntry, nCol );
+}
+
+XubString SvTabListBox::GetEntryText( SvLBoxEntry* pEntry, USHORT nCol ) const
+{
+ DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry");
+ XubString aResult;
+ if( pEntry )
+ {
+ USHORT nCount = pEntry->ItemCount();
+ USHORT nCur = 0;
+ while( nCur < nCount )
+ {
+ SvLBoxItem* pStr = pEntry->GetItem( nCur );
+ if( pStr->IsA() == SV_ITEM_ID_LBOXSTRING )
+ {
+ if( nCol == 0xffff )
+ {
+ if( aResult.Len() )
+ aResult += '\t';
+ aResult += ((SvLBoxString*)pStr)->GetText();
+ }
+ else
+ {
+ if( nCol == 0 )
+ return ((SvLBoxString*)pStr)->GetText();
+ nCol--;
+ }
+ }
+ nCur++;
+ }
+ }
+ return aResult;
+}
+
+void SvTabListBox::SetEntryText( const XubString& rStr, ULONG nPos,
+ USHORT nCol )
+{
+ SvLBoxEntry* pEntry = SvTreeListBox::GetEntry( nPos );
+ SetEntryText( rStr, pEntry, nCol );
+}
+
+void SvTabListBox::SetEntryText( const XubString& rStr, SvLBoxEntry* pEntry,
+ USHORT nCol )
+{
+ DBG_ASSERT(pEntry,"SetEntryText:Invalid Entry");
+ if( !pEntry )
+ return;
+
+ const xub_Unicode* pCurToken = rStr.GetBuffer();
+ USHORT nCurTokenLen;
+ const xub_Unicode* pNextToken = GetToken( pCurToken, nCurTokenLen );
+
+ XubString aTemp;
+ USHORT nCount = pEntry->ItemCount();
+ USHORT nCur = 0;
+ while( nCur < nCount )
+ {
+ SvLBoxItem* pStr = pEntry->GetItem( nCur );
+ if( pStr && pStr->IsA() == SV_ITEM_ID_LBOXSTRING )
+ {
+ if( nCol == 0xffff )
+ {
+ if( pCurToken )
+ aTemp = XubString( pCurToken, nCurTokenLen );
+ else
+ aTemp.Erase(); // alle Spalten ohne Token loeschen
+ ((SvLBoxString*)pStr)->SetText( pEntry, aTemp );
+ pCurToken = pNextToken;
+ pNextToken = GetToken( pCurToken, nCurTokenLen );
+ }
+ else
+ {
+ if( !nCol )
+ {
+ aTemp = XubString( pCurToken, nCurTokenLen );
+ ((SvLBoxString*)pStr)->SetText( pEntry, aTemp );
+ if( !pNextToken )
+ break;
+ pCurToken = pNextToken;
+ pNextToken = GetToken( pCurToken, nCurTokenLen );
+ }
+ else
+ nCol--;
+ }
+ }
+ nCur++;
+ }
+ GetModel()->InvalidateEntry( pEntry );
+}
+
+
+
+ULONG SvTabListBox::GetEntryPos( const XubString& rStr, USHORT nCol )
+{
+ ULONG nPos = 0;
+ SvLBoxEntry* pEntry = First();
+ while( pEntry )
+ {
+ XubString aStr( GetEntryText( pEntry, nCol ));
+ if( aStr == rStr )
+ return nPos;
+ pEntry = Next( pEntry );
+ nPos++;
+ }
+ return 0xffffffff;
+}
+
+void __EXPORT SvTabListBox::Resize()
+{
+ SvTreeListBox::Resize();
+}
+
+// static
+const xub_Unicode* SvTabListBox::GetToken( const xub_Unicode* pPtr, USHORT& rLen )
+{
+ if( !pPtr || *pPtr == 0 )
+ {
+ rLen = 0;
+ return 0;
+ }
+ xub_Unicode c = *pPtr;
+ USHORT nLen = 0;
+ while( c != '\t' && c != 0 )
+ {
+ pPtr++;
+ nLen++;
+ c = *pPtr;
+ }
+ if( c )
+ pPtr++; // Tab ueberspringen
+ else
+ pPtr = 0;
+ rLen = nLen;
+ return pPtr;
+}
+
+
+void SvTabListBox::SetTabJustify( USHORT nTab, SvTabJustify eJustify)
+{
+ if( nTab >= nTabCount )
+ return;
+ SvLBoxTab* pTab = &(pTabList[ nTab ]);
+ USHORT nFlags = pTab->nFlags;
+ nFlags &= (~MYTABMASK);
+ nFlags |= (USHORT)eJustify;
+ pTab->nFlags = nFlags;
+ SvTreeListBox::nTreeFlags |= TREEFLAG_RECALCTABS;
+ if( IsUpdateMode() )
+ Invalidate();
+}
+
+SvTabJustify SvTabListBox::GetTabJustify( USHORT nTab ) const
+{
+ SvTabJustify eResult = AdjustLeft;
+ if( nTab >= nTabCount )
+ return eResult;
+ SvLBoxTab* pTab = &(pTabList[ nTab ]);
+ USHORT nFlags = pTab->nFlags;
+ nFlags &= MYTABMASK;
+ eResult = (SvTabJustify)nFlags;
+ return eResult;
+}
+
+long SvTabListBox::GetLogicTab( USHORT nTab )
+{
+ if( SvTreeListBox::nTreeFlags & TREEFLAG_RECALCTABS )
+ ((SvTabListBox*)this)->SetTabs();
+
+ DBG_ASSERT(nTab<nTabCount,"GetTabPos:Invalid Tab");
+ return ((SvLBoxTab*)aTabs.GetObject( nTab ))->GetPos();
+}
+
+// class SvHeaderTabListBox ----------------------------------------------
+
+SvHeaderTabListBox::SvHeaderTabListBox( Window* pParent, WinBits nWinStyle ) :
+
+ SvTabListBox( pParent, nWinStyle ),
+
+ mbFirstPaint( TRUE )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+SvHeaderTabListBox::~SvHeaderTabListBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SvHeaderTabListBox::Paint( const Rectangle& rRect )
+{
+ if ( mbFirstPaint )
+ {
+ mbFirstPaint = FALSE;
+ RepaintScrollBars();
+ }
+ SvTabListBox::Paint( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void SvHeaderTabListBox::InitHeaderBar( HeaderBar* pHeaderBar )
+{
+ mpHeaderBar = pHeaderBar;
+ SetScrolledHdl( LINK( this, SvHeaderTabListBox, ScrollHdl_Impl ) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvHeaderTabListBox, ScrollHdl_Impl, SvTabListBox*, pList )
+{
+ mpHeaderBar->SetOffset( -GetXOffset() );
+ return 0;
+}
+
+
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
new file mode 100644
index 000000000000..bc7f6de0ab05
--- /dev/null
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -0,0 +1,2355 @@
+/*************************************************************************
+ *
+ * $RCSfile: svtreebx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SVTREEBX_CXX
+
+#ifndef _SV_SVAPP_HXX //autogen wg. Application
+#include <vcl/svapp.hxx>
+#endif
+#pragma hdrstop
+
+class TabBar;
+
+#include <svlbox.hxx>
+#include <svlbitm.hxx>
+#include <svtreebx.hxx>
+#ifndef _SVIMPLBOX_HXX
+#include <svimpbox.hxx>
+#endif
+
+/*
+ Bugs/ToDo
+
+ - Berechnung Rectangle beim Inplace-Editing (Bug bei manchen Fonts)
+ - SetSpaceBetweenEntries: Offset wird in SetEntryHeight nicht
+ beruecksichtigt
+*/
+
+#define TREEFLAG_FIXEDHEIGHT 0x0010
+
+
+DBG_NAME(SvTreeListBox);
+
+#define SV_LBOX_DEFAULT_INDENT_PIXEL 20
+
+__EXPORT SvTreeListBox::SvTreeListBox( Window* pParent, WinBits nWinStyle )
+ : SvLBox(pParent,nWinStyle )
+{
+ DBG_CTOR(SvTreeListBox,0);
+ InitTreeView( nWinStyle );
+}
+
+__EXPORT SvTreeListBox::SvTreeListBox( Window* pParent , const ResId& rResId )
+ : SvLBox( pParent,rResId )
+{
+ DBG_CTOR(SvTreeListBox,0);
+ InitTreeView( 0 );
+ Resize();
+}
+
+void SvTreeListBox::InitTreeView( WinBits nWinStyle )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pCheckButtonData = 0;
+ nEntryHeight = 0;
+ pEdCtrl = 0;
+ nFirstSelTab = 0;
+ nLastSelTab = 0;
+ nFocusWidth = -1;
+
+ Link* pLink = new Link( LINK(this,SvTreeListBox, DefaultCompare) );
+ pReserved = pLink;
+
+ nTreeFlags = TREEFLAG_RECALCTABS;
+ nIndent = SV_LBOX_DEFAULT_INDENT_PIXEL;
+ nEntryHeightOffs = SV_ENTRYHEIGHTOFFS_PIXEL;
+ pImp = new SvImpLBox( this, GetModel(), nWinStyle );
+
+ aContextBmpMode = SVLISTENTRYFLAG_EXPANDED;
+ nContextBmpWidthMax = 0;
+ SetFont( GetFont() );
+ SetSpaceBetweenEntries( 0 );
+ SetLineColor();
+ InitSettings( TRUE, TRUE, TRUE );
+ SetWindowBits( nWinStyle );
+ SetTabs();
+ InitAcc();
+}
+
+
+__EXPORT SvTreeListBox::~SvTreeListBox()
+{
+ DBG_DTOR(SvTreeListBox,0);
+ if( IsInplaceEditingEnabled() )
+ Application::RemoveAccel( &aInpEditAcc );
+ delete pImp;
+ delete (Link*)pReserved;
+ ClearTabList();
+}
+
+void SvTreeListBox::SetModel( SvLBoxTreeList* pNewModel )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->SetModel( pNewModel );
+ SvLBox::SetModel( pNewModel );
+}
+
+void SvTreeListBox::DisconnectFromModel()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBox::DisconnectFromModel();
+ pImp->SetModel( GetModel() );
+}
+
+
+USHORT SvTreeListBox::IsA()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ return SV_LISTBOX_ID_TREEBOX;
+}
+
+void SvTreeListBox::InitAcc()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+#ifdef OS2
+ aInpEditAcc.InsertItem( 1, KeyCode(KEY_F9,KEY_SHIFT) );
+#else
+ aInpEditAcc.InsertItem( 1, KeyCode(KEY_RETURN,KEY_MOD2) );
+#endif
+ aInpEditAcc.SetActivateHdl( LINK( this, SvTreeListBox, InpEdActivateHdl) );
+}
+
+IMPL_LINK_INLINE_START( SvTreeListBox, InpEdActivateHdl, Accelerator *, pAccelerator )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ EditEntry();
+ return 1;
+}
+IMPL_LINK_INLINE_END( SvTreeListBox, InpEdActivateHdl, Accelerator *, pAccelerator )
+
+
+void __EXPORT SvTreeListBox::Resize()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( IsEditingActive() )
+ EndEditing( TRUE );
+ SvLBox::Resize();
+ pImp->Resize();
+ nFocusWidth = -1;
+ pImp->ShowCursor( FALSE );
+ pImp->ShowCursor( TRUE );
+}
+
+/* Faelle:
+
+ A) Entries haben Bitmaps
+ 0. Keine Buttons
+ 1. Node-Buttons (optional auch an Root-Items)
+ 2. Node-Buttons (optional auch an Root-Items) + CheckButton
+ 3. CheckButton
+ B) Entries haben keine Bitmaps (->ueber WindowBits wg. D&D !!!!!!)
+ 0. Keine Buttons
+ 1. Node-Buttons (optional auch an Root-Items)
+ 2. Node-Buttons (optional auch an Root-Items) + CheckButton
+ 3. CheckButton
+*/
+
+#define NO_BUTTONS 0
+#define NODE_BUTTONS 1
+#define NODE_AND_CHECK_BUTTONS 2
+#define CHECK_BUTTONS 3
+
+#define TABFLAGS_TEXT (SV_LBOXTAB_DYNAMIC | \
+ SV_LBOXTAB_ADJUST_LEFT | \
+ SV_LBOXTAB_EDITABLE | \
+ SV_LBOXTAB_SHOW_SELECTION)
+
+#define TABFLAGS_CONTEXTBMP (SV_LBOXTAB_DYNAMIC | SV_LBOXTAB_ADJUST_CENTER)
+
+#define TABFLAGS_CHECKBTN (SV_LBOXTAB_DYNAMIC | \
+ SV_LBOXTAB_ADJUST_CENTER | \
+ SV_LBOXTAB_PUSHABLE)
+
+#define TAB_STARTPOS 2
+
+// bei Aenderungen GetTextOffset beruecksichtigen
+void SvTreeListBox::SetTabs()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( IsEditingActive() )
+ EndEditing( TRUE );
+ nTreeFlags &= (~TREEFLAG_RECALCTABS);
+ nFocusWidth = -1;
+ BOOL bHasButtons = (nWindowStyle & WB_HASBUTTONS)!=0;
+ BOOL bHasButtonsAtRoot = (nWindowStyle & (WB_HASLINESATROOT |
+ WB_HASBUTTONSATROOT))!=0;
+ long nStartPos = TAB_STARTPOS;
+ long nNodeWidthPixel = GetExpandedNodeBmp().GetSizePixel().Width();
+
+ long nCheckWidth = 0;
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ nCheckWidth = pCheckButtonData->aBmps[0].GetSizePixel().Width();
+ long nCheckWidthDIV2 = nCheckWidth / 2;
+
+ long nContextWidth = nContextBmpWidthMax;
+ long nContextWidthDIV2 = nContextWidth / 2;
+
+ ClearTabList();
+
+ int nCase = NO_BUTTONS;
+ if( !(nTreeFlags & TREEFLAG_CHKBTN) )
+ {
+ if( bHasButtons )
+ nCase = NODE_BUTTONS;
+ }
+ else
+ {
+ if( bHasButtons )
+ nCase = NODE_AND_CHECK_BUTTONS;
+ else
+ nCase = CHECK_BUTTONS;
+ }
+
+ switch( nCase )
+ {
+ case NO_BUTTONS :
+ nStartPos += nContextWidthDIV2; // wg. Zentrierung
+ AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ // Abstand setzen nur wenn Bitmaps da
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ AddTab( nStartPos, TABFLAGS_TEXT );
+ break;
+
+ case NODE_BUTTONS :
+ if( bHasButtonsAtRoot )
+ nStartPos += ( nIndent + (nNodeWidthPixel/2) );
+ else
+ nStartPos += nContextWidthDIV2;
+ AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ // Abstand setzen nur wenn Bitmaps da
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ AddTab( nStartPos, TABFLAGS_TEXT );
+ break;
+
+ case NODE_AND_CHECK_BUTTONS :
+ if( bHasButtonsAtRoot )
+ nStartPos += ( nIndent + nNodeWidthPixel );
+ else
+ nStartPos += nCheckWidthDIV2;
+ AddTab( nStartPos, TABFLAGS_CHECKBTN );
+ nStartPos += nCheckWidthDIV2; // rechter Rand des CheckButtons
+ nStartPos += 3; // Abstand CheckButton Context-Bmp
+ nStartPos += nContextWidthDIV2; // Mitte der Context-Bmp
+ AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ // Abstand setzen nur wenn Bitmaps da
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ AddTab( nStartPos, TABFLAGS_TEXT );
+ break;
+
+ case CHECK_BUTTONS :
+ nStartPos += nCheckWidthDIV2;
+ AddTab( nStartPos, TABFLAGS_CHECKBTN );
+ nStartPos += nCheckWidthDIV2; // rechter Rand CheckButton
+ nStartPos += 3; // Abstand CheckButton Context-Bmp
+ nStartPos += nContextWidthDIV2; // Mitte der Context-Bmp
+ AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ // Abstand setzen nur wenn Bitmaps da
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ AddTab( nStartPos, TABFLAGS_TEXT );
+ break;
+ }
+ pImp->NotifyTabsChanged();
+}
+
+void SvTreeListBox::InitEntry( SvLBoxEntry* pEntry,
+ const XubString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBoxButton* pButton;
+ SvLBoxString* pString;
+ SvLBoxContextBmp* pContextBmp;
+
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ {
+ pButton= new SvLBoxButton( pEntry,0,pCheckButtonData );
+ pEntry->AddItem( pButton );
+ }
+
+ pContextBmp= new SvLBoxContextBmp( pEntry,0, aCollEntryBmp,aExpEntryBmp,
+ aContextBmpMode );
+ pEntry->AddItem( pContextBmp );
+
+ pString = new SvLBoxString( pEntry, 0, aStr );
+ pEntry->AddItem( pString );
+}
+
+XubString SvTreeListBox::GetEntryText(SvLBoxEntry* pEntry) const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pEntry,"Entry?")
+ SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ DBG_ASSERT(pItem,"GetEntryText:Item not found")
+ return pItem->GetText();
+}
+
+const Image& SvTreeListBox::GetExpandedEntryBmp(SvLBoxEntry* pEntry) const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pEntry,"Entry?")
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ DBG_ASSERT(pItem,"GetContextBmp:Item not found")
+ return pItem->GetBitmap2();
+}
+
+const Image& SvTreeListBox::GetCollapsedEntryBmp(SvLBoxEntry* pEntry ) const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pEntry,"Entry?")
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ DBG_ASSERT(pItem,"GetContextBmp:Item not found")
+ return pItem->GetBitmap1();
+}
+
+IMPL_LINK_INLINE_START( SvTreeListBox, CheckButtonClick, SvLBoxButtonData *, pData )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pHdlEntry = pData->GetActEntry();
+ CheckButtonHdl();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SvTreeListBox, CheckButtonClick, SvLBoxButtonData *, pData )
+
+SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pParent,
+ BOOL bChildsOnDemand, ULONG nPos, void* pUser )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ nTreeFlags |= TREEFLAG_MANINS;
+
+ aCurInsertedExpBmp = aExpandedEntryBmp;
+ aCurInsertedColBmp = aCollapsedEntryBmp;
+
+ SvLBoxEntry* pEntry = CreateEntry();
+ pEntry->SetUserData( pUser );
+ InitEntry( pEntry, aText, aCollapsedEntryBmp, aExpandedEntryBmp );
+ pEntry->EnableChildsOnDemand( bChildsOnDemand );
+
+ if( !pParent )
+ SvLBox::Insert( pEntry, nPos );
+ else
+ SvLBox::Insert( pEntry, pParent, nPos );
+
+ aPrevInsertedExpBmp = aExpandedEntryBmp;
+ aPrevInsertedColBmp = aCollapsedEntryBmp;
+
+ nTreeFlags &= (~TREEFLAG_MANINS);
+
+ return pEntry;
+}
+
+SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,
+ const Image& aExpEntryBmp, const Image& aCollEntryBmp,
+ SvLBoxEntry* pParent, BOOL bChildsOnDemand, ULONG nPos, void* pUser )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ nTreeFlags |= TREEFLAG_MANINS;
+
+ aCurInsertedExpBmp = aExpEntryBmp;
+ aCurInsertedColBmp = aCollEntryBmp;
+
+ short nExpWidth = (short)aExpEntryBmp.GetSizePixel().Width();
+ short nColWidth = (short)aCollEntryBmp.GetSizePixel().Width();
+ short nMax = Max(nExpWidth, nColWidth);
+ if( nMax > nContextBmpWidthMax )
+ {
+ nContextBmpWidthMax = nMax;
+ SetTabs();
+ }
+
+ SvLBoxEntry* pEntry = CreateEntry();
+ pEntry->SetUserData( pUser );
+ InitEntry( pEntry, aText, aCollEntryBmp, aExpEntryBmp );
+
+ pEntry->EnableChildsOnDemand( bChildsOnDemand );
+
+ if( !pParent )
+ SvLBox::Insert( pEntry, nPos );
+ else
+ SvLBox::Insert( pEntry, pParent, nPos );
+
+ aPrevInsertedExpBmp = aExpEntryBmp;
+ aPrevInsertedColBmp = aCollEntryBmp;
+
+ nTreeFlags &= (~TREEFLAG_MANINS);
+
+ return pEntry;
+}
+
+void SvTreeListBox::SetEntryText( SvLBoxEntry* pEntry, const XubString& aStr)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ DBG_ASSERT(pItem,"SetText:Item not found")
+ pItem->SetText( pEntry, aStr );
+ pItem->InitViewData( this, pEntry, 0 );
+ GetModel()->InvalidateEntry( pEntry );
+}
+
+void SvTreeListBox::SetExpandedEntryBmp(SvLBoxEntry* pEntry, const Image& aBmp)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ DBG_ASSERT(pItem,"SetExpBmp:Item not found")
+ pItem->SetBitmap2( pEntry, aBmp );
+ GetModel()->InvalidateEntry( pEntry );
+ SetEntryHeight( pEntry );
+ Size aSize = aBmp.GetSizePixel();
+ if( aSize.Width() > nContextBmpWidthMax )
+ {
+ nContextBmpWidthMax = (short)aSize.Width();
+ SetTabs();
+ }
+}
+
+void SvTreeListBox::SetCollapsedEntryBmp(SvLBoxEntry* pEntry,const Image& aBmp )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ DBG_ASSERT(pItem,"SetExpBmp:Item not found")
+ pItem->SetBitmap1( pEntry, aBmp );
+ GetModel()->InvalidateEntry( pEntry );
+ SetEntryHeight( pEntry );
+ Size aSize = aBmp.GetSizePixel();
+ if( aSize.Width() > nContextBmpWidthMax )
+ {
+ nContextBmpWidthMax = (short)aSize.Width();
+ SetTabs();
+ }
+}
+
+void SvTreeListBox::ImpEntryInserted( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+
+ SvLBoxEntry* pParent = (SvLBoxEntry*)pModel->GetParent( pEntry );
+ if( pParent )
+ {
+ USHORT nFlags = pParent->GetFlags();
+ nFlags &= ~SV_ENTRYFLAG_NO_NODEBMP;
+ pParent->SetFlags( nFlags );
+ }
+
+ if(!((nTreeFlags & TREEFLAG_MANINS) &&
+ (aPrevInsertedExpBmp == aCurInsertedExpBmp) &&
+ (aPrevInsertedColBmp == aCurInsertedColBmp) ))
+ {
+ Size aSize = GetCollapsedEntryBmp( pEntry ).GetSizePixel();
+ if( aSize.Width() > nContextBmpWidthMax )
+ {
+ nContextBmpWidthMax = (short)aSize.Width();
+ nTreeFlags |= TREEFLAG_RECALCTABS;
+ }
+ aSize = GetExpandedEntryBmp( pEntry ).GetSizePixel();
+ if( aSize.Width() > nContextBmpWidthMax )
+ {
+ nContextBmpWidthMax = (short)aSize.Width();
+ nTreeFlags |= TREEFLAG_RECALCTABS;
+ }
+ }
+ SetEntryHeight( (SvLBoxEntry*)pEntry );
+}
+
+
+
+void SvTreeListBox::SetCheckButtonState( SvLBoxEntry* pEntry, SvButtonState eState)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ {
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON));
+ DBG_ASSERT(pItem,"SetCheckButton:Item not found")
+ switch( eState )
+ {
+ case SV_BUTTON_CHECKED:
+ pItem->SetStateChecked();
+ break;
+
+ case SV_BUTTON_UNCHECKED:
+ pItem->SetStateUnchecked();
+ break;
+
+ case SV_BUTTON_TRISTATE:
+ pItem->SetStateTristate();
+ break;
+ }
+ InvalidateEntry( pEntry );
+ }
+}
+
+SvButtonState SvTreeListBox::GetCheckButtonState( SvLBoxEntry* pEntry ) const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvButtonState eState = SV_BUTTON_UNCHECKED;
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ {
+ SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON));
+ DBG_ASSERT(pItem,"GetChButnState:Item not found")
+ USHORT nButtonFlags = pItem->GetButtonFlags();
+ eState = pCheckButtonData->ConvertToButtonState( nButtonFlags );
+ }
+ return eState;
+}
+
+
+void __EXPORT SvTreeListBox::CheckButtonHdl()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ aCheckButtonHdl.Call( this );
+}
+
+BOOL __EXPORT SvTreeListBox::QueryDrop( DropEvent& rDEvt )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ return SvLBox::QueryDrop( rDEvt ); // Basisklasse rufen
+}
+
+
+
+// *********************************************************************
+// *********************************************************************
+
+//
+// TODO: Momentan werden die Daten so geklont, dass sie dem
+// Standard-TreeView-Format entsprechen. Hier sollte eigentlich
+// das Model als Referenz dienen. Dies fuehrt dazu, dass
+// SvLBoxEntry::Clone _nicht_ gerufen wird, sondern nur dessen
+// Basisklasse SvListEntry
+//
+
+SvLBoxEntry* __EXPORT SvTreeListBox::CloneEntry( SvLBoxEntry* pSource )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ XubString aStr;
+ Image aCollEntryBmp;
+ Image aExpEntryBmp;
+
+ SvLBoxString* pStringItem = (SvLBoxString*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
+ if( pStringItem )
+ aStr = pStringItem->GetText();
+ SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
+ if( pBmpItem )
+ {
+ aCollEntryBmp = pBmpItem->GetBitmap1();
+ aExpEntryBmp = pBmpItem->GetBitmap2();
+ }
+ SvLBoxEntry* pEntry = CreateEntry();
+ InitEntry( pEntry, aStr, aCollEntryBmp, aExpEntryBmp );
+ pEntry->SvListEntry::Clone( pSource );
+ pEntry->EnableChildsOnDemand( pSource->HasChildsOnDemand() );
+ pEntry->SetUserData( pSource->GetUserData() );
+ return pEntry;
+}
+
+// *********************************************************************
+// *********************************************************************
+
+
+void SvTreeListBox::ShowExpandBitmapOnCursor( BOOL bYes )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( bYes )
+ aContextBmpMode = SVLISTENTRYFLAG_FOCUSED;
+ else
+ aContextBmpMode = SVLISTENTRYFLAG_EXPANDED;
+}
+
+void SvTreeListBox::SetIndent( short nNewIndent )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ nIndent = nNewIndent;
+ SetTabs();
+ if( IsUpdateMode() )
+ Invalidate();
+}
+
+void SvTreeListBox::SetDefaultExpandedEntryBmp( const Image& aBmp)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Size aSize = aBmp.GetSizePixel();
+ if( aSize.Width() > nContextBmpWidthMax )
+ nContextBmpWidthMax = (short)aSize.Width();
+ SetTabs();
+ aExpandedEntryBmp = aBmp;
+}
+
+void SvTreeListBox::SetDefaultCollapsedEntryBmp( const Image& aBmp)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Size aSize = aBmp.GetSizePixel();
+ if( aSize.Width() > nContextBmpWidthMax )
+ nContextBmpWidthMax = (short)aSize.Width();
+ SetTabs();
+ aCollapsedEntryBmp = aBmp;
+}
+
+void SvTreeListBox::EnableCheckButton( SvLBoxButtonData* pData )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(!GetEntryCount(),"EnableCheckButton: Entry count != 0");
+ if( !pData )
+ nTreeFlags &= (~TREEFLAG_CHKBTN);
+ else
+ {
+ pCheckButtonData = pData;
+ nTreeFlags |= TREEFLAG_CHKBTN;
+ pData->SetLink( LINK(this, SvTreeListBox, CheckButtonClick));
+ }
+
+ SetTabs();
+ if( IsUpdateMode() )
+ Invalidate();
+}
+
+void SvTreeListBox::SetNodeBitmaps( const Image& rCollapsedNodeBmp,
+ const Image& rExpandedNodeBmp)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SetExpandedNodeBmp( rExpandedNodeBmp );
+ SetCollapsedNodeBmp( rCollapsedNodeBmp );
+ SetTabs();
+}
+
+BOOL SvTreeListBox::EditingEntry( SvLBoxEntry*, Selection& )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ return TRUE;
+}
+
+BOOL SvTreeListBox::EditedEntry( SvLBoxEntry* /*pEntry*/,const XubString& /*rNewText*/)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ return TRUE;
+}
+
+void SvTreeListBox::EnableInplaceEditing( BOOL bOn )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBox::EnableInplaceEditing( bOn );
+ if( Control::HasFocus() )
+ Application::InsertAccel( &aInpEditAcc );
+}
+
+void __EXPORT SvTreeListBox::KeyInput( const KeyEvent& rKEvt )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down
+ if( IsEditingActive() )
+ return;
+
+ nImpFlags |= SVLBOX_IS_TRAVELSELECT;
+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
+
+#ifdef OVDEBUG
+ switch ( nCode )
+ {
+ case KEY_F1:
+ {
+ SvLBoxEntry* pEntry = First();
+ pEntry = NextVisible( pEntry );
+ SetEntryText( pEntry, "SetEntryText" );
+ Sound::Beep();
+ }
+ break;
+ }
+#endif
+
+ if( IsInplaceEditingEnabled() &&
+ nCode == KEY_RETURN &&
+ rKEvt.GetKeyCode().IsMod2() )
+ {
+ SvLBoxEntry* pEntry = GetCurEntry();
+ if( pEntry )
+ EditEntry( pEntry );
+ nImpFlags &= ~SVLBOX_IS_TRAVELSELECT;
+ }
+ else
+ {
+ BOOL bKeyUsed = pImp->KeyInput( rKEvt );
+ nImpFlags &= ~SVLBOX_IS_TRAVELSELECT;
+ if( !bKeyUsed )
+ SvLBox::KeyInput( rKEvt );
+ }
+}
+
+void SvTreeListBox::RequestingChilds( SvLBoxEntry* pParent )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( !pParent->HasChilds() )
+ InsertEntry( String::CreateFromAscii("<dummy>"), pParent, FALSE, LIST_APPEND );
+}
+
+void __EXPORT SvTreeListBox::GetFocus()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( IsInplaceEditingEnabled() )
+ Application::InsertAccel( &aInpEditAcc );
+ pImp->GetFocus();
+ SvLBox::GetFocus();
+}
+
+void __EXPORT SvTreeListBox::LoseFocus()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( IsInplaceEditingEnabled() )
+ Application::RemoveAccel( &aInpEditAcc );
+ pImp->LoseFocus();
+ SvLBox::LoseFocus();
+}
+
+void __EXPORT SvTreeListBox::ModelHasCleared()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->pCursor = 0; //sonst Absturz beim Inplace-Editieren im GetFocus
+ delete pEdCtrl;
+ pEdCtrl = 0;
+ pImp->Clear();
+ nFocusWidth = -1;
+
+ nContextBmpWidthMax = 0;
+ SetDefaultExpandedEntryBmp( GetDefaultExpandedEntryBmp() );
+ SetDefaultCollapsedEntryBmp( GetDefaultCollapsedEntryBmp() );
+
+ if( !(nTreeFlags & TREEFLAG_FIXEDHEIGHT ))
+ nEntryHeight = 0;
+ AdjustEntryHeight( GetFont() );
+ AdjustEntryHeight( GetDefaultExpandedEntryBmp() );
+ AdjustEntryHeight( GetDefaultCollapsedEntryBmp() );
+
+ SvLBox::ModelHasCleared();
+// if( IsUpdateMode() )
+// Invalidate();
+}
+
+void SvTreeListBox::ShowTargetEmphasis( SvLBoxEntry* pEntry, BOOL /* bShow */ )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->PaintDDCursor( pEntry );
+}
+
+void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( !nDeltaEntries || !pImp->aVerSBar.IsVisible() )
+ return;
+
+ long nThumb = pImp->aVerSBar.GetThumbPos();
+ long nMax = pImp->aVerSBar.GetRange().Max();
+
+ NotifyBeginScroll();
+ if( nDeltaEntries < 0 )
+ {
+ // das Fenster nach oben verschieben
+ nDeltaEntries *= -1;
+ long nVis = pImp->aVerSBar.GetVisibleSize();
+ long nTemp = nThumb + nVis;
+ if( nDeltaEntries > (nMax - nTemp) )
+ nDeltaEntries = (short)(nMax - nTemp);
+ pImp->PageDown( (USHORT)nDeltaEntries );
+ }
+ else
+ {
+ if( nDeltaEntries > nThumb )
+ nDeltaEntries = (short)nThumb;
+ pImp->PageUp( (USHORT)nDeltaEntries );
+ }
+ pImp->SyncVerThumb();
+ NotifyEndScroll();
+}
+
+void SvTreeListBox::SetSelectionMode( SelectionMode eSelectMode )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBox::SetSelectionMode( eSelectMode );
+ pImp->SetSelectionMode( eSelectMode );
+}
+
+void SvTreeListBox::SetDragDropMode( DragDropMode nDDMode )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBox::SetDragDropMode( nDDMode );
+ pImp->SetDragDropMode( nDDMode );
+}
+
+short SvTreeListBox::GetHeightOffset(const Image& rBmp, Size& aSizeLogic )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ short nOffset = 0;
+ aSizeLogic = rBmp.GetSizePixel();
+ if( GetEntryHeight() > aSizeLogic.Height() )
+ nOffset = ( GetEntryHeight() - (short)aSizeLogic.Height()) / 2;
+ return nOffset;
+}
+
+short SvTreeListBox::GetHeightOffset(const Font& /* rFont */, Size& aSizeLogic )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ short nOffset = 0;
+ aSizeLogic = Size(GetTextWidth('X'), GetTextHeight());
+ if( GetEntryHeight() > aSizeLogic.Height() )
+ nOffset = ( GetEntryHeight() - (short)aSizeLogic.Height()) / 2;
+ return nOffset;
+}
+
+void SvTreeListBox::SetEntryHeight( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ short nHeight, nHeightMax=0;
+ USHORT nCount = pEntry->ItemCount();
+ USHORT nCur = 0;
+ SvViewDataEntry* pViewData = GetViewDataEntry( pEntry );
+ while( nCur < nCount )
+ {
+ SvLBoxItem* pItem = pEntry->GetItem( nCur );
+ nHeight = (short)(pItem->GetSize( pViewData, nCur ).Height());
+ if( nHeight > nHeightMax )
+ nHeightMax = nHeight;
+ nCur++;
+ }
+
+ if( nHeightMax > nEntryHeight )
+ {
+ nEntryHeight = nHeightMax;
+ SvLBox::SetFont( GetFont() );
+ pImp->SetEntryHeight( nHeightMax );
+ }
+}
+
+void SvTreeListBox::SetEntryHeight( short nHeight, BOOL bAlways )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+
+ if( bAlways || nHeight > nEntryHeight )
+ {
+ nEntryHeight = nHeight;
+ if( nEntryHeight )
+ nTreeFlags |= TREEFLAG_FIXEDHEIGHT;
+ else
+ nTreeFlags &= ~TREEFLAG_FIXEDHEIGHT;
+ SvLBox::SetFont( GetFont() );
+ pImp->SetEntryHeight( nHeight );
+ }
+}
+
+
+void SvTreeListBox::AdjustEntryHeight( const Image& rBmp )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Size aSize;
+ GetHeightOffset( rBmp, aSize );
+ if( aSize.Height() > nEntryHeight )
+ {
+ nEntryHeight = (short)aSize.Height() + nEntryHeightOffs;
+ pImp->SetEntryHeight( nEntryHeight );
+ }
+}
+
+void SvTreeListBox::AdjustEntryHeight( const Font& rFont )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Size aSize;
+ GetHeightOffset( rFont, aSize );
+ if( aSize.Height() > nEntryHeight )
+ {
+ nEntryHeight = (short)aSize.Height() + nEntryHeightOffs;
+ pImp->SetEntryHeight( nEntryHeight );
+ }
+}
+
+BOOL SvTreeListBox::Expand( SvLBoxEntry* pParent )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pHdlEntry = pParent;
+ BOOL bExpanded = FALSE;
+ USHORT nFlags;
+
+ if( pParent->HasChildsOnDemand() )
+ RequestingChilds( pParent );
+ if( pParent->HasChilds() )
+ {
+ nImpFlags |= SVLBOX_IS_EXPANDING;
+ if( ExpandingHdl() )
+ {
+ bExpanded = TRUE;
+ SvListView::Expand( pParent );
+ pImp->EntryExpanded( pParent );
+ ExpandedHdl();
+ }
+ nFlags = pParent->GetFlags();
+ nFlags &= ~SV_ENTRYFLAG_NO_NODEBMP;
+ nFlags |= SV_ENTRYFLAG_HAD_CHILDREN;
+ pParent->SetFlags( nFlags );
+ }
+ else
+ {
+ nFlags = pParent->GetFlags();
+ nFlags |= SV_ENTRYFLAG_NO_NODEBMP;
+ pParent->SetFlags( nFlags );
+ GetModel()->InvalidateEntry( pParent ); // neu zeichnen
+ }
+ return bExpanded;
+}
+
+BOOL SvTreeListBox::Collapse( SvLBoxEntry* pParent )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ nImpFlags &= ~SVLBOX_IS_EXPANDING;
+ pHdlEntry = pParent;
+ BOOL bCollapsed = FALSE;
+
+ if( ExpandingHdl() )
+ {
+ bCollapsed = TRUE;
+ pImp->CollapsingEntry( pParent );
+ SvListView::Collapse( pParent );
+ pImp->EntryCollapsed( pParent );
+ ExpandedHdl();
+ }
+ return bCollapsed;
+}
+
+BOOL SvTreeListBox::Select( SvLBoxEntry* pEntry, BOOL bSelect )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pEntry,"Select: Null-Ptr")
+ BOOL bRetVal = SvListView::Select( pEntry, bSelect );
+ DBG_ASSERT(IsSelected(pEntry)==bSelect,"Select failed");
+ if( bRetVal )
+ {
+ pImp->EntrySelected( pEntry, bSelect );
+ pHdlEntry = pEntry;
+ if( bSelect )
+ SelectHdl();
+ else
+ DeselectHdl();
+ }
+ return bRetVal;
+}
+
+ULONG SvTreeListBox::SelectChilds( SvLBoxEntry* pParent, BOOL bSelect )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->DestroyAnchor();
+ ULONG nRet = 0;
+ if( !pParent->HasChilds() )
+ return 0;
+ USHORT nRefDepth = pModel->GetDepth( pParent );
+ SvLBoxEntry* pChild = FirstChild( pParent );
+ do {
+ nRet++;
+ Select( pChild, bSelect );
+ pChild = Next( pChild );
+ } while( pChild && pModel->GetDepth( pChild ) > nRefDepth );
+ return nRet;
+}
+
+void SvTreeListBox::SelectAll( BOOL bSelect, BOOL bPaint )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->SelAllDestrAnch(
+ bSelect,
+ TRUE, // Anker loeschen,
+ TRUE ); // auch bei SINGLE_SELECTION den Cursor deselektieren
+}
+
+void __EXPORT SvTreeListBox::ModelHasInsertedTree( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ USHORT nRefDepth = pModel->GetDepth( (SvLBoxEntry*)pEntry );
+ SvLBoxEntry* pTmp = (SvLBoxEntry*)pEntry;
+ do
+ {
+ ImpEntryInserted( pTmp );
+ pTmp = Next( pTmp );
+ } while( pTmp && nRefDepth < pModel->GetDepth( pTmp ) );
+ pImp->TreeInserted( (SvLBoxEntry*)pEntry );
+}
+
+void __EXPORT SvTreeListBox::ModelHasInserted( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ ImpEntryInserted( (SvLBoxEntry*)pEntry );
+ pImp->EntryInserted( (SvLBoxEntry*)pEntry );
+}
+
+void __EXPORT SvTreeListBox::ModelIsMoving(SvListEntry* pSource,
+ SvListEntry* /* pTargetParent */,
+ ULONG /* nChildPos */ )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->MovingEntry( (SvLBoxEntry*)pSource );
+}
+
+void __EXPORT SvTreeListBox::ModelHasMoved( SvListEntry* pSource )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->EntryMoved( (SvLBoxEntry*)pSource );
+}
+
+void __EXPORT SvTreeListBox::ModelIsRemoving( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->RemovingEntry( (SvLBoxEntry*)pEntry );
+ NotifyRemoving( (SvLBoxEntry*)pEntry );
+}
+
+void __EXPORT SvTreeListBox::ModelHasRemoved( SvListEntry* /* pEntry */ )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->EntryRemoved();
+}
+
+void SvTreeListBox::SetCollapsedNodeBmp( const Image& rBmp)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ AdjustEntryHeight( rBmp );
+ pImp->SetCollapsedNodeBmp( rBmp );
+}
+
+void SvTreeListBox::SetExpandedNodeBmp( const Image& rBmp)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ AdjustEntryHeight( rBmp );
+ pImp->SetExpandedNodeBmp( rBmp );
+}
+
+
+void SvTreeListBox::SetFont( const Font& rFont )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Font aTempFont( rFont );
+ aTempFont.SetTransparent( TRUE );
+#ifndef VCL
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ aTempFont.SetColor( rStyleSettings.GetFieldTextColor() );
+#endif
+ Control::SetFont( aTempFont );
+ AdjustEntryHeight( aTempFont );
+ // immer Invalidieren, sonst fallen wir
+ // bei SetEntryHeight auf die Nase
+ RecalcViewData();
+}
+
+
+void __EXPORT SvTreeListBox::Paint( const Rectangle& rRect )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBox::Paint( rRect );
+ if( nTreeFlags & TREEFLAG_RECALCTABS )
+ SetTabs();
+ pImp->Paint( rRect );
+}
+
+void __EXPORT SvTreeListBox::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->MouseButtonDown( rMEvt );
+}
+
+void __EXPORT SvTreeListBox::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->MouseButtonUp( rMEvt );
+}
+
+void __EXPORT SvTreeListBox::MouseMove( const MouseEvent& rMEvt )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->MouseMove( rMEvt );
+}
+
+
+void __EXPORT SvTreeListBox::SetUpdateMode( BOOL bUpdate )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->SetUpdateMode( bUpdate );
+}
+
+void SvTreeListBox::SetUpdateModeFast( BOOL bUpdate )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->SetUpdateModeFast( bUpdate );
+}
+
+void SvTreeListBox::SetSpaceBetweenEntries( short nOffsLogic )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( nOffsLogic != nEntryHeightOffs )
+ {
+ nEntryHeight -= nEntryHeightOffs;
+ nEntryHeightOffs = (short)nOffsLogic;
+ nEntryHeight += nOffsLogic;
+ AdjustEntryHeight( GetFont() );
+ RecalcViewData();
+ pImp->SetEntryHeight( nEntryHeight );
+ }
+}
+
+void SvTreeListBox::SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect )
+{
+ pImp->SetCursor(pEntry, bForceNoSelect);
+}
+
+void SvTreeListBox::SetCurEntry( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( pEntry )
+ pImp->SetCurEntry( pEntry );
+}
+
+Image SvTreeListBox::GetCollapsedNodeBmp() const
+{
+ return pImp->GetCollapsedNodeBmp();
+}
+
+Image SvTreeListBox::GetExpandedNodeBmp() const
+{
+ return pImp->GetExpandedNodeBmp();
+}
+
+Point SvTreeListBox::GetEntryPos( SvLBoxEntry* pEntry ) const
+{
+ return pImp->GetEntryPos( pEntry );
+}
+
+void SvTreeListBox::ShowEntry( SvLBoxEntry* pEntry )
+{
+ MakeVisible( pEntry );
+}
+
+void SvTreeListBox::MakeVisible( SvLBoxEntry* pEntry )
+{
+ pImp->MakeVisible(pEntry);
+}
+
+void SvTreeListBox::MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop )
+{
+ pImp->MakeVisible( pEntry, bMoveToTop );
+}
+
+void __EXPORT SvTreeListBox::ModelHasEntryInvalidated( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ // die einzelnen Items des Entries reinitialisieren
+ SvLBox::ModelHasEntryInvalidated( pEntry );
+ // repainten
+ pImp->InvalidateEntry( (SvLBoxEntry*)pEntry );
+}
+
+void SvTreeListBox::EditItemText( SvLBoxEntry* pEntry, SvLBoxString* pItem,
+ const Selection& rSelection )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pEntry&&pItem,"EditItemText: Bad params");
+ if( IsSelected( pEntry ))
+ {
+ pImp->ShowCursor( FALSE );
+ SvListView::Select( pEntry, FALSE );
+ PaintEntry( pEntry );
+ SvListView::Select( pEntry, TRUE );
+ pImp->ShowCursor( TRUE );
+ }
+ pEdEntry = pEntry;
+ pEdItem = pItem;
+ SvLBoxTab* pTab = GetTab( pEntry, pItem );
+ DBG_ASSERT(pTab,"EditItemText:Tab not found");
+
+ Size aItemSize( pItem->GetSize(this, pEntry) );
+ Point aPos = GetEntryPos( pEntry );
+ aPos.Y() += ( nEntryHeight - aItemSize.Height() ) / 2;
+ aPos.X() = GetTabPos( pEntry, pTab );
+ long nOutputWidth = pImp->GetOutputSize().Width();
+ Size aSize( nOutputWidth - aPos.X(), aItemSize.Height() );
+ USHORT nPos = aTabs.GetPos( pTab );
+ if( nPos+1 < aTabs.Count() )
+ {
+ SvLBoxTab* pRightTab = (SvLBoxTab*)aTabs.GetObject( nPos + 1 );
+ long nRight = GetTabPos( pEntry, pRightTab );
+ if( nRight <= nOutputWidth )
+ aSize.Width() = nRight - aPos.X();
+ }
+ Point aOrigin( GetMapMode().GetOrigin() );
+ aPos += aOrigin; // in Win-Koord umrechnen
+ aSize.Width() -= aOrigin.X();
+ Rectangle aRect( aPos, aSize );
+#ifdef OS2
+ // Platz lassen fuer WB_BORDER
+ aRect.Left() -= 2;
+ aRect.Top() -= 3;
+ aRect.Bottom() += 3;
+#endif
+ EditText( pItem->GetText(), aRect, rSelection );
+}
+
+void SvTreeListBox::CancelEditing()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBox::CancelTextEditing();
+}
+
+void SvTreeListBox::EditEntry( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( IsEditingActive() )
+ EndEditing();
+ if( !pEntry )
+ pEntry = GetCurEntry();
+ if( pEntry )
+ {
+ SvLBoxString* pItem = (SvLBoxString* )pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING);
+ Selection aSel( SELECTION_MIN, SELECTION_MAX );
+ if( pItem && EditingEntry( pEntry, aSel ) )
+ {
+ SelectAll( FALSE );
+ MakeVisible( pEntry );
+ EditItemText( pEntry, pItem, aSel );
+ }
+ }
+}
+
+void SvTreeListBox::EditedText( const XubString& rStr )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Point aPos = GetEntryPos( pEdEntry );
+ if( EditedEntry( pEdEntry, rStr ) )
+ {
+ ((SvLBoxString*)pEdItem)->SetText( pEdEntry, rStr );
+ pModel->InvalidateEntry( pEdEntry );
+ }
+ //if( GetSelectionMode() == SINGLE_SELECTION )
+ //{
+ if( GetSelectionCount() == 0 )
+ Select( pEdEntry );
+ if( GetSelectionMode() == MULTIPLE_SELECTION && !GetCurEntry() )
+ SetCurEntry( pEdEntry );
+ //}
+}
+
+void SvTreeListBox::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
+ const Point& )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( IsEditingActive() )
+ EndEditing();
+ if( pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
+ {
+ Selection aSel( SELECTION_MIN, SELECTION_MAX );
+ if( EditingEntry( pEntry, aSel ) )
+ {
+ SelectAll( FALSE );
+ EditItemText( pEntry, (SvLBoxString*)pItem, aSel );
+ }
+ }
+}
+
+
+
+SvLBoxEntry* SvTreeListBox::GetDropTarget( const Point& rPos )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ // Scrollen
+ if( rPos.Y() < 12 )
+ {
+ SvLBox::ImplShowTargetEmphasis( SvLBox::pTargetEntry, FALSE );
+ ScrollOutputArea( +1 );
+ }
+ else
+ {
+ Size aSize( pImp->GetOutputSize() );
+ if( rPos.Y() > aSize.Height() - 12 )
+ {
+ SvLBox::ImplShowTargetEmphasis( SvLBox::pTargetEntry, FALSE );
+ ScrollOutputArea( -1 );
+ }
+ }
+
+ SvLBoxEntry* pTarget = pImp->GetEntry( rPos );
+ // bei Droppen in leere Flaeche -> den letzten Eintrag nehmen
+ if( !pTarget )
+ return (SvLBoxEntry*)LastVisible();
+ else if( (GetDragDropMode() & SV_DRAGDROP_ENABLE_TOP) &&
+ pTarget == First() && rPos.Y() < 6 )
+ return 0;
+
+ return pTarget;
+}
+
+
+SvLBoxEntry* SvTreeListBox::GetEntry( const Point& rPos, BOOL bHit ) const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBoxEntry* pEntry = pImp->GetEntry( rPos );
+ if( pEntry && bHit )
+ {
+ long nLine = pImp->GetEntryLine( pEntry );
+ if( !(pImp->EntryReallyHit( pEntry, rPos, nLine)) )
+ return 0;
+ }
+ return pEntry;
+}
+
+SvLBoxEntry* SvTreeListBox::GetCurEntry() const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ return pImp->GetCurEntry();
+}
+
+void SvTreeListBox::SetWindowBits( WinBits nWinStyle )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ nWindowStyle = nWinStyle;
+ nTreeFlags |= TREEFLAG_RECALCTABS;
+ if( nWinStyle & WB_SORT )
+ {
+ GetModel()->SetSortMode( SortAscending );
+ GetModel()->SetCompareHdl( LINK(this,SvTreeListBox,DefaultCompare));
+ }
+ else
+ {
+ GetModel()->SetSortMode( SortNone );
+ GetModel()->SetCompareHdl( Link() );
+ }
+#ifdef OS2
+ nWinStyle |= WB_VSCROLL;
+#endif
+ pImp->SetWindowBits( nWinStyle );
+ pImp->Resize();
+ Invalidate();
+}
+
+void SvTreeListBox::PaintEntry( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pEntry,"PaintEntry:No Entry")
+ if( pEntry )
+ pImp->PaintEntry( pEntry );
+}
+
+void SvTreeListBox::InvalidateEntry( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pEntry,"InvalidateEntry:No Entry")
+ if( pEntry )
+ {
+ GetModel()->InvalidateEntry( pEntry );
+ // pImp->InvalidateEntry( pEntry );
+ }
+}
+
+
+long SvTreeListBox::PaintEntry(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags)
+{
+ return PaintEntry1(pEntry,nLine,nTabFlags);
+}
+
+#define SV_TAB_BORDER 8
+
+long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags,
+ BOOL bHasClipRegion )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+
+ Rectangle aRect; // multi purpose
+
+ BOOL bHorSBar = pImp->HasHorScrollBar();
+ PreparePaint( pEntry );
+
+ if( nTreeFlags & TREEFLAG_RECALCTABS )
+ SetTabs();
+
+ short nTempEntryHeight = GetEntryHeight();
+ long nWidth = pImp->GetOutputSize().Width();
+
+ // wurde innerhalb des PreparePaints die horizontale ScrollBar
+ // angeschaltet? Wenn ja, muss die ClipRegion neu gesetzt werden
+ if( !bHorSBar && pImp->HasHorScrollBar() )
+ SetClipRegion( Region(pImp->GetClipRegionRect()) );
+
+ Point aPos( GetMapMode().GetOrigin() );
+ aPos.X() *= -1; // Umrechnung Dokumentkoord.
+ long nMaxRight = nWidth + aPos.X() - 1;
+
+ Font aBackupFont( GetFont() );
+ Color aBackupColor = GetFillColor();
+
+ int bCurFontIsSel = FALSE;
+ BOOL bInUse = pEntry->HasInUseEmphasis();
+ // wenn eine ClipRegion von aussen gesetzt wird, dann
+ // diese nicht zuruecksetzen
+ BOOL bResetClipRegion = !bHasClipRegion;
+ BOOL bHideSelection = ((nWindowStyle & WB_HIDESELECTION) && !HasFocus())!=0;
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ Font aHiliteFont( GetFont() );
+ aHiliteFont.SetColor( rSettings.GetHighlightTextColor() );
+
+ Size aRectSize( 0, nTempEntryHeight );
+
+ if( !bHasClipRegion && nWindowStyle & WB_HSCROLL )
+ {
+ SetClipRegion( Region(pImp->GetClipRegionRect()) );
+ bHasClipRegion = TRUE;
+ }
+
+ SvViewDataEntry* pViewDataEntry = GetViewDataEntry( pEntry );
+
+ USHORT nTabCount = aTabs.Count();
+ USHORT nItemCount = pEntry->ItemCount();
+ USHORT nCurTab = 0;
+ USHORT nCurItem = 0;
+
+ while( nCurTab < nTabCount && nCurItem < nItemCount )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject( nCurTab );
+ USHORT nNextTab = nCurTab + 1;
+ SvLBoxTab* pNextTab = nNextTab < nTabCount ? (SvLBoxTab*)aTabs.GetObject(nNextTab) : 0;
+ SvLBoxItem* pItem = nCurItem < nItemCount ? pEntry->GetItem(nCurItem) : 0;
+
+ USHORT nFlags = pTab->nFlags;
+ Size aSize( pItem->GetSize( pViewDataEntry, nCurItem ));
+ long nTabPos = GetTabPos( pEntry, pTab );
+
+ long nNextTabPos;
+ if( pNextTab )
+ nNextTabPos = GetTabPos( pEntry, pNextTab );
+ else
+ {
+ nNextTabPos = nMaxRight;
+ if( nTabPos > nMaxRight )
+ nNextTabPos += 50;
+ }
+
+ long nX;
+ if( pTab->nFlags & SV_LBOXTAB_ADJUST_RIGHT )
+ //verhindern, das rechter Rand von der Tabtrennung abgeschnitten wird
+ nX = nTabPos + pTab->CalcOffset(aSize.Width(), (nNextTabPos-SV_TAB_BORDER-1) -nTabPos);
+ else
+ nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos-nTabPos);
+
+ if( nFlags & nTabFlags )
+ {
+ if( !bHasClipRegion && nX + aSize.Width() >= nMaxRight )
+ {
+ SetClipRegion( Region(pImp->GetClipRegionRect()) );
+ bHasClipRegion = TRUE;
+ }
+ aPos.X() = nX;
+ aPos.Y() = nLine;
+
+ // Hintergrund-Muster & Farbe bestimmen
+
+ Wallpaper aWallpaper = GetBackground();
+
+ int bSelTab = nFlags & SV_LBOXTAB_SHOW_SELECTION;
+ USHORT nItemType = pItem->IsA();
+
+ if( pViewDataEntry->IsSelected() && bSelTab &&
+ !pViewDataEntry->IsCursored() )
+ {
+ if( !bInUse || nItemType != SV_ITEM_ID_LBOXCONTEXTBMP )
+ {
+ if( bHideSelection )
+ aWallpaper.SetColor( rSettings.GetDeactiveColor() );
+ else
+ aWallpaper.SetColor( rSettings.GetHighlightColor() );
+ // Font auf Hilite-Farbe setzen ?
+ if( !bCurFontIsSel && nItemType == SV_ITEM_ID_LBOXSTRING )
+ {
+ Control::SetFont( aHiliteFont );
+ bCurFontIsSel = TRUE;
+ }
+ }
+ else // ContextBitmap + InUse-Emphasis + Selektiert
+ aWallpaper.SetColor( rSettings.GetHighlightColor() );
+ }
+ else // keine Selektion
+ {
+ if( bInUse && nItemType == SV_ITEM_ID_LBOXCONTEXTBMP )
+ aWallpaper.SetColor( rSettings.GetFieldColor() );
+ else if( bCurFontIsSel && nItemType == SV_ITEM_ID_LBOXSTRING )
+ {
+ bCurFontIsSel = FALSE;
+ Control::SetFont( aBackupFont );
+ }
+ }
+
+ // Hintergrund zeichnen
+ if( !(nTreeFlags & TREEFLAG_USESEL))
+ {
+ // nur den Bereich zeichnen, den das Item einnimmt
+ aRectSize.Width() = aSize.Width();
+ aRect.SetPos( aPos );
+ aRect.SetSize( aRectSize );
+ }
+ else
+ {
+ // vom aktuellen bis zum naechsten Tab zeichnen
+ if( nCurTab != 0 )
+ aRect.Left() = nTabPos;
+ else
+ // beim nullten Tab immer ab Spalte 0 zeichnen
+ // (sonst Probleme bei Tabs mit Zentrierung)
+ aRect.Left() = 0;
+ aRect.Top() = nLine;
+ aRect.Bottom() = nLine + nTempEntryHeight - 1;
+ if( pNextTab )
+ {
+ long nRight;
+ nRight = GetTabPos(pEntry,pNextTab)-1;
+ if( nRight > nMaxRight )
+ nRight = nMaxRight;
+ aRect.Right() = nRight;
+ }
+ else
+ aRect.Right() = nMaxRight;
+ }
+ // bei anwenderdefinierter Selektion, die bei einer Tabposition
+ // groesser 0 beginnt den Hintergrund des 0.ten Items nicht
+ // fuellen, da sonst z.B. TablistBoxen mit Linien nicht
+ // realisiert werden koennen.
+ if( !(nCurTab==0 && (nTreeFlags & TREEFLAG_USESEL) && nFirstSelTab) )
+ {
+ SetFillColor( aWallpaper.GetColor() );
+ // Bei kleinen hor. Resizes tritt dieser Fall auf
+ if( aRect.Left() < aRect.Right() )
+ DrawRect( aRect );
+ }
+ // Item zeichnen
+ // vertikal zentrieren
+ aPos.Y() += ( nTempEntryHeight - aSize.Height() ) / 2;
+ pItem->Paint( aPos, *this, pViewDataEntry->GetFlags(), pEntry );
+
+ // Trennungslinie zwischen Tabs
+ if( pNextTab && pItem->IsA() == SV_ITEM_ID_LBOXSTRING &&
+ // nicht am rechten Fensterrand!
+ aRect.Right() < nMaxRight )
+ {
+ aRect.Left() = aRect.Right() - SV_TAB_BORDER;
+ DrawRect( aRect );
+ }
+
+ SetFillColor( aBackupColor );
+ }
+ nCurItem++;
+ nCurTab++;
+ }
+ if( pViewDataEntry->IsCursored() && !HasFocus() )
+ {
+ // Cursor-Emphasis
+ SetFillColor();
+ Color aOldLineColor = GetLineColor();
+ SetLineColor( Color( COL_BLACK ) );
+ aRect = GetFocusRect( pEntry, nLine );
+ aRect.Top()++;
+ aRect.Bottom()--;
+ DrawRect( aRect );
+ SetLineColor( aOldLineColor );
+ SetFillColor( aBackupColor );
+ }
+
+ if( bCurFontIsSel )
+ Control::SetFont( aBackupFont );
+
+ USHORT nFirstDynTabPos;
+ SvLBoxTab* pFirstDynamicTab = GetFirstDynamicTab( nFirstDynTabPos );
+ long nDynTabPos = GetTabPos( pEntry, pFirstDynamicTab );
+ nDynTabPos += pImp->nNodeBmpTabDistance;
+ nDynTabPos += pImp->nNodeBmpWidth / 2;
+ nDynTabPos += 4; // 4 Pixel Reserve, damit die Node-Bitmap
+ // nicht zu nah am naechsten Tab steht
+
+ if( (!(pEntry->GetFlags() & SV_ENTRYFLAG_NO_NODEBMP)) &&
+ (nWindowStyle & WB_HASBUTTONS) && pFirstDynamicTab &&
+ ( pEntry->HasChilds() || pEntry->HasChildsOnDemand() ) )
+ {
+ // ersten festen Tab suchen, und pruefen ob die Node-Bitmap
+ // in ihn hineinragt
+ USHORT nNextTab = nFirstDynTabPos;
+ SvLBoxTab* pNextTab;
+ do
+ {
+ nNextTab++;
+ pNextTab = nNextTab < nTabCount ? (SvLBoxTab*)aTabs.GetObject(nNextTab) : 0;
+ } while( pNextTab && pNextTab->IsDynamic() );
+
+ if( !pNextTab || (GetTabPos( pEntry, pNextTab ) > nDynTabPos) )
+ {
+ if((nWindowStyle & WB_HASBUTTONSATROOT) || pModel->GetDepth(pEntry) > 0)
+ {
+ Point aPos( GetTabPos(pEntry,pFirstDynamicTab), nLine );
+ aPos.X() += pImp->nNodeBmpTabDistance;
+ const Image* pImg = 0;
+ if( IsExpanded(pEntry) )
+ pImg = &pImp->GetExpandedNodeBmp();
+ else
+ {
+ if( (!pEntry->HasChilds()) && pEntry->HasChildsOnDemand() &&
+ (!(pEntry->GetFlags() & SV_ENTRYFLAG_HAD_CHILDREN)) &&
+ pImp->GetDontKnowNodeBmp().GetSizePixel().Width() )
+ pImg = &pImp->GetDontKnowNodeBmp();
+ else
+ pImg = &pImp->GetCollapsedNodeBmp();
+ }
+ aPos.Y() += (nTempEntryHeight - pImg->GetSizePixel().Height()) / 2;
+ DrawImage( aPos, *pImg );
+ }
+ }
+ }
+
+
+ if( bHasClipRegion && bResetClipRegion )
+ SetClipRegion();
+ return 0; // nRowLen;
+}
+
+void SvTreeListBox::PreparePaint( SvLBoxEntry* )
+{
+}
+
+Rectangle SvTreeListBox::GetFocusRect( SvLBoxEntry* pEntry, long nLine )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Size aSize;
+ Rectangle aRect;
+ aRect.Top() = nLine;
+ aSize.Height() = GetEntryHeight();
+
+ long nRealWidth = pImp->GetOutputSize().Width();
+ nRealWidth -= GetMapMode().GetOrigin().X();
+
+ USHORT nCurTab;
+ SvLBoxTab* pTab = GetFirstTab( SV_LBOXTAB_SHOW_SELECTION, nCurTab );
+ long nTabPos = 0;
+ if( pTab )
+ nTabPos = GetTabPos( pEntry, pTab );
+ long nNextTabPos;
+ if( pTab && nCurTab < aTabs.Count() - 1 )
+ {
+ SvLBoxTab* pNextTab = (SvLBoxTab*)aTabs.GetObject( nCurTab + 1 );
+ nNextTabPos = GetTabPos( pEntry, pNextTab );
+ }
+ else
+ {
+ nNextTabPos = nRealWidth;
+ if( nTabPos > nRealWidth )
+ nNextTabPos += 50;
+ }
+
+ BOOL bUserSelection = (BOOL)( nTreeFlags & TREEFLAG_USESEL ) != 0;
+ if( !bUserSelection )
+ {
+ if( pTab && nCurTab < pEntry->ItemCount() )
+ {
+ SvLBoxItem* pItem = pEntry->GetItem( nCurTab );
+ aSize.Width() = pItem->GetSize( this, pEntry ).Width();
+ if( !aSize.Width() )
+ aSize.Width() = 15;
+ long nX = nTabPos; //GetTabPos( pEntry, pTab );
+ // Ausrichtung
+ nX += pTab->CalcOffset( aSize.Width(), nNextTabPos - nTabPos );
+ aRect.Left() = nX;
+ // damit erster & letzter Buchstabe nicht angeknabbert werden
+ aRect.SetSize( aSize );
+ if( aRect.Left() > 0 )
+ aRect.Left()--;
+ aRect.Right()++;
+ }
+ }
+ else
+ {
+ // wenn erster SelTab != 0, dann muessen wir auch rechnen
+ if( nFocusWidth == -1 || nFirstSelTab )
+ {
+ USHORT nLastTab;
+ SvLBoxTab* pLastTab = GetLastTab(SV_LBOXTAB_SHOW_SELECTION,nLastTab);
+ nLastTab++;
+ if( nLastTab < aTabs.Count() ) // gibts noch einen ?
+ pLastTab = (SvLBoxTab*)aTabs.GetObject( nLastTab );
+ else
+ pLastTab = 0; // ueber gesamte Breite selektieren
+ aSize.Width() = pLastTab ? pLastTab->GetPos() : 0x0fffffff;
+ nFocusWidth = (short)aSize.Width();
+ if( pTab )
+ nFocusWidth -= (short)nTabPos; //pTab->GetPos();
+ }
+ else
+ {
+ aSize.Width() = nFocusWidth;
+ if( pTab )
+ {
+ if( nCurTab )
+ aSize.Width() += nTabPos;
+ else
+ aSize.Width() += pTab->GetPos(); // Tab0 immer ab ganz links
+ }
+ }
+ // wenn Sel. beim nullten Tab anfaengt, dann ab Spalte 0 sel. zeichnen
+ if( nCurTab != 0 )
+ {
+ aRect.Left() = nTabPos;
+ aSize.Width() -= nTabPos;
+ }
+ aRect.SetSize( aSize );
+ }
+ // rechten Rand anpassen wg. Clipping
+ if( aRect.Right() >= nRealWidth )
+ {
+ aRect.Right() = nRealWidth-1;
+ nFocusWidth = (short)aRect.GetWidth();
+ }
+ return aRect;
+}
+
+
+long SvTreeListBox::GetTabPos( SvLBoxEntry* pEntry, SvLBoxTab* pTab)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pTab,"No Tab")
+ long nPos = pTab->GetPos();
+ if( pTab->IsDynamic() )
+ {
+ USHORT nDepth = pModel->GetDepth( pEntry );
+ nDepth *= (USHORT)nIndent;
+ nPos += (long)nDepth;
+ }
+ return nPos;
+}
+
+SvLBoxItem* SvTreeListBox::GetItem_Impl( SvLBoxEntry* pEntry, long nX,
+ SvLBoxTab** ppTab, USHORT nEmptyWidth )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBoxItem* pItemClicked = 0;
+ USHORT nTabCount = aTabs.Count();
+ USHORT nItemCount = pEntry->ItemCount();
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(0);
+ SvLBoxItem* pItem = pEntry->GetItem(0);
+ USHORT nNextItem = 1;
+ nX -= GetMapMode().GetOrigin().X();
+ long nRealWidth = pImp->GetOutputSize().Width();
+ nRealWidth -= GetMapMode().GetOrigin().X();
+
+ while( 1 )
+ {
+ SvLBoxTab* pNextTab=nNextItem<nTabCount ? (SvLBoxTab*)aTabs.GetObject(nNextItem) : 0;
+ long nStart = GetTabPos( pEntry, pTab );
+
+ long nNextTabPos;
+ if( pNextTab )
+ nNextTabPos = GetTabPos( pEntry, pNextTab );
+ else
+ {
+ nNextTabPos = nRealWidth;
+ if( nStart > nRealWidth )
+ nNextTabPos += 50;
+ }
+
+ Size aItemSize( pItem->GetSize(this, pEntry));
+ nStart += pTab->CalcOffset( aItemSize.Width(), nNextTabPos - nStart );
+ long nLen = aItemSize.Width();
+ if( pNextTab )
+ {
+ long nTabWidth = GetTabPos( pEntry, pNextTab ) - nStart;
+ if( nTabWidth < nLen )
+ nLen = nTabWidth;
+ }
+
+ if( !nLen )
+ nLen = nEmptyWidth;
+
+ if( nX >= nStart && nX < (nStart+nLen ) )
+ {
+ pItemClicked = pItem;
+ if( ppTab )
+ {
+ *ppTab = pTab;
+ break;
+ }
+ }
+ if( nNextItem >= nItemCount || nNextItem >= nTabCount)
+ break;
+ pTab = (SvLBoxTab*)aTabs.GetObject( nNextItem );
+ pItem = pEntry->GetItem( nNextItem );
+ nNextItem++;
+ }
+ return pItemClicked;
+}
+
+SvLBoxItem* SvTreeListBox::GetItem(SvLBoxEntry* pEntry,long nX,SvLBoxTab** ppTab)
+{
+ return GetItem_Impl( pEntry, nX, ppTab, 0 );
+}
+
+SvLBoxItem* SvTreeListBox::GetItem(SvLBoxEntry* pEntry,long nX )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ SvLBoxTab* pDummyTab;
+ return GetItem_Impl( pEntry, nX, &pDummyTab, 0 );
+}
+
+SvLBoxItem* SvTreeListBox::GetFirstDynamicItem( SvLBoxEntry* pEntry )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(0);
+ SvLBoxItem* pItem = pEntry->GetItem(0);
+ USHORT nTabCount = aTabs.Count();
+
+ USHORT nNext = 1;
+ while ( !pTab->IsDynamic() && nNext < nTabCount )
+ {
+ pItem = pEntry->GetItem( nNext );
+ pTab = (SvLBoxTab*)aTabs.GetObject( nNext );
+ nNext++;
+ }
+ return pItem;
+}
+
+void SvTreeListBox::AddTab(long nPos,USHORT nFlags,void* pUserData )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ nFocusWidth = -1;
+ SvLBoxTab* pTab = new SvLBoxTab( nPos, nFlags );
+ pTab->SetUserData( pUserData );
+ aTabs.Insert( pTab, aTabs.Count() );
+ if( nTreeFlags & TREEFLAG_USESEL )
+ {
+ USHORT nPos = aTabs.Count() - 1;
+ if( nPos >= nFirstSelTab && nPos <= nLastSelTab )
+ pTab->nFlags |= SV_LBOXTAB_SHOW_SELECTION;
+ else
+ // String-Items werden normalerweise immer selektiert
+ // deshalb explizit ausschalten
+ pTab->nFlags &= ~SV_LBOXTAB_SHOW_SELECTION;
+ }
+}
+
+
+
+SvLBoxTab* SvTreeListBox::GetFirstDynamicTab( USHORT& rPos ) const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ USHORT nCurTab = 0;
+ USHORT nTabCount = aTabs.Count();
+ while( nCurTab < nTabCount )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(nCurTab);
+ if( pTab->nFlags & SV_LBOXTAB_DYNAMIC )
+ {
+ rPos = nCurTab;
+ return pTab;
+ }
+ nCurTab++;
+ }
+ return 0;
+}
+
+SvLBoxTab* SvTreeListBox::GetFirstDynamicTab() const
+{
+ USHORT nDummy;
+ return GetFirstDynamicTab( nDummy );
+}
+
+SvLBoxTab* SvTreeListBox::GetTab( SvLBoxEntry* pEntry, SvLBoxItem* pItem) const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ USHORT nPos = pEntry->GetPos( pItem );
+ return (SvLBoxTab*)aTabs.GetObject( nPos );
+}
+
+void SvTreeListBox::ClearTabList()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ USHORT nTabCount = aTabs.Count();
+ while( nTabCount )
+ {
+ nTabCount--;
+ SvLBoxTab* pDelTab = (SvLBoxTab*)aTabs.GetObject( nTabCount );
+ delete pDelTab;
+ }
+ aTabs.Remove(0,aTabs.Count());
+}
+
+
+Size SvTreeListBox::GetOutputSizePixel() const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Size aSize = pImp->GetOutputSize();
+ return aSize;
+}
+
+void SvTreeListBox::NotifyBeginScroll()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+}
+
+void SvTreeListBox::NotifyEndScroll()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+}
+
+void SvTreeListBox::NotifyScrolling( long nCount )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+}
+
+void SvTreeListBox::NotifyScrolled()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ aScrolledHdl.Call( this );
+}
+
+void SvTreeListBox::NotifyInvalidating()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+}
+
+void SvTreeListBox::Invalidate()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( nFocusWidth == -1 )
+ // damit Control nicht nach dem Paint ein falsches FocusRect anzeigt
+ pImp->RecalcFocusRect();
+ NotifyInvalidating();
+ SvLBox::Invalidate();
+ pImp->Invalidate();
+}
+
+void SvTreeListBox::Invalidate( const Rectangle& rRect )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ if( nFocusWidth == -1 )
+ // damit Control nicht nach dem Paint ein falsches FocusRect anzeigt
+ pImp->RecalcFocusRect();
+ NotifyInvalidating();
+ SvLBox::Invalidate( rRect );
+}
+
+
+void SvTreeListBox::SetHighlightRange( USHORT nStart, USHORT nEnd)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+
+ USHORT nTemp;
+ nTreeFlags |= TREEFLAG_USESEL;
+ if( nStart > nEnd )
+ {
+ nTemp = nStart;
+ nStart = nEnd;
+ nEnd = nTemp;
+ }
+ // alle Tabs markieren, die im Bereich liegen
+ nTreeFlags |= TREEFLAG_RECALCTABS;
+ nFirstSelTab = nStart;
+ nLastSelTab = nEnd;
+ pImp->RecalcFocusRect();
+}
+
+void SvTreeListBox::RemoveHighlightRange()
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ nTreeFlags &= (~TREEFLAG_USESEL);
+ if( IsUpdateMode() )
+ Invalidate();
+}
+
+ULONG SvTreeListBox::GetAscInsertionPos(SvLBoxEntry* pEntry,SvLBoxEntry* pParent)
+{
+ return LIST_APPEND;
+}
+
+ULONG SvTreeListBox::GetDescInsertionPos(SvLBoxEntry* pEntry,SvLBoxEntry* pParent)
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ return LIST_APPEND;
+}
+
+Region SvTreeListBox::GetDragRegion() const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ Rectangle aRect;
+ SvLBoxEntry* pEntry = GetCurEntry();
+ if( pEntry )
+ {
+ Point aPos = GetEntryPos( pEntry );
+ aRect = ((SvTreeListBox*)this)->GetFocusRect( pEntry, aPos.Y() );
+ }
+ Region aRegion( aRect );
+ return aRegion;
+}
+
+
+void SvTreeListBox::Command( const CommandEvent& rCEvt )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ pImp->Command( rCEvt );
+}
+
+
+void SvTreeListBox::RemoveParentKeepChilds( SvLBoxEntry* pParent )
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ DBG_ASSERT(pParent,"RemoveParentKeepChilds:No Parent");
+ SvLBoxEntry* pNewParent = GetParent( pParent );
+ if( pParent->HasChilds())
+ {
+ SvLBoxEntry* pChild = FirstChild( pParent );
+ while( pChild )
+ {
+ pModel->Move( pChild, pNewParent, LIST_APPEND );
+ pChild = FirstChild( pParent );
+ }
+ }
+ pModel->Remove( pParent );
+}
+
+SvLBoxTab* SvTreeListBox::GetFirstTab( USHORT nFlagMask, USHORT& rPos )
+{
+ USHORT nTabCount = aTabs.Count();
+ for( USHORT nPos = 0; nPos < nTabCount; nPos++ )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject( nPos );
+ if( (pTab->nFlags & nFlagMask) )
+ {
+ rPos = nPos;
+ return pTab;
+ }
+ }
+ rPos = 0xffff;
+ return 0;
+}
+
+SvLBoxTab* SvTreeListBox::GetLastTab( USHORT nFlagMask, USHORT& rTabPos )
+{
+ short nTabCount = (short)aTabs.Count();
+ if( nTabCount )
+ {
+ for( short nPos = nTabCount-1; nPos >= 0; nPos-- )
+ {
+ SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject( (USHORT)nPos );
+ if( (pTab->nFlags & nFlagMask) )
+ {
+ rTabPos = (USHORT)nPos;
+ return pTab;
+ }
+ }
+ }
+ rTabPos = 0xffff;
+ return 0;
+}
+
+void SvTreeListBox::SetAddMode( BOOL bAdd )
+{
+ pImp->SetAddMode( bAdd );
+}
+
+BOOL SvTreeListBox::IsAddMode() const
+{
+ return pImp->IsAddMode();
+}
+
+void SvTreeListBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ if( !pImp->RequestHelp( rHEvt ) )
+ SvLBox::RequestHelp( rHEvt );
+}
+
+void SvTreeListBox::CursorMoved( SvLBoxEntry* )
+{
+}
+
+IMPL_LINK( SvTreeListBox, DefaultCompare, SvSortData*, pData )
+{
+ SvLBoxEntry* pLeft = (SvLBoxEntry*)(pData->pLeft );
+ SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight );
+ String aLeft( ((SvLBoxString*)(pLeft->GetFirstItem(SV_ITEM_ID_LBOXSTRING)))->GetText());
+ String aRight( ((SvLBoxString*)(pRight->GetFirstItem(SV_ITEM_ID_LBOXSTRING)))->GetText());
+ // Intntl: Compare(a,b) ==> b.Compare(a) ==> strcmp(a,b)
+ const International& rInter = Application::GetAppInternational();
+ StringCompare eCompare = rInter.Compare( aLeft, aRight );
+ return (long)eCompare;
+}
+
+void SvTreeListBox::ModelNotification( USHORT nActionId, SvListEntry* pEntry1,
+ SvListEntry* pEntry2, ULONG nPos )
+{
+ if( nActionId == LISTACTION_CLEARING )
+ CancelTextEditing();
+
+ SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
+ switch( nActionId )
+ {
+ case LISTACTION_RESORTING:
+ SetUpdateMode( FALSE );
+ break;
+
+ case LISTACTION_RESORTED:
+ // nach Sortierung den ersten Eintrag anzeigen, dabei die
+ // Selektion erhalten.
+ MakeVisible( (SvLBoxEntry*)pModel->First(), TRUE );
+ SetUpdateMode( TRUE );
+ break;
+
+ case LISTACTION_CLEARED:
+ if( IsUpdateMode() )
+ Update();
+ break;
+ }
+}
+
+// bei Aenderungen SetTabs beruecksichtigen
+long SvTreeListBox::GetTextOffset() const
+{
+ DBG_CHKTHIS(SvTreeListBox,0);
+ BOOL bHasButtons = (nWindowStyle & WB_HASBUTTONS)!=0;
+ BOOL bHasButtonsAtRoot = (nWindowStyle & (WB_HASLINESATROOT |
+ WB_HASBUTTONSATROOT))!=0;
+ long nStartPos = TAB_STARTPOS;
+ long nNodeWidthPixel = GetExpandedNodeBmp().GetSizePixel().Width();
+
+ long nCheckWidth = 0;
+ if( nTreeFlags & TREEFLAG_CHKBTN )
+ nCheckWidth = pCheckButtonData->aBmps[0].GetSizePixel().Width();
+ long nCheckWidthDIV2 = nCheckWidth / 2;
+
+ long nContextWidth = nContextBmpWidthMax;
+ long nContextWidthDIV2 = nContextWidth / 2;
+
+ int nCase = NO_BUTTONS;
+ if( !(nTreeFlags & TREEFLAG_CHKBTN) )
+ {
+ if( bHasButtons )
+ nCase = NODE_BUTTONS;
+ }
+ else
+ {
+ if( bHasButtons )
+ nCase = NODE_AND_CHECK_BUTTONS;
+ else
+ nCase = CHECK_BUTTONS;
+ }
+
+ switch( nCase )
+ {
+ case NO_BUTTONS :
+ nStartPos += nContextWidthDIV2; // wg. Zentrierung
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ break;
+
+ case NODE_BUTTONS :
+ if( bHasButtonsAtRoot )
+ nStartPos += ( nIndent + (nNodeWidthPixel/2) );
+ else
+ nStartPos += nContextWidthDIV2;
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ break;
+
+ case NODE_AND_CHECK_BUTTONS :
+ if( bHasButtonsAtRoot )
+ nStartPos += ( nIndent + nNodeWidthPixel );
+ else
+ nStartPos += nCheckWidthDIV2;
+ nStartPos += nCheckWidthDIV2; // rechter Rand des CheckButtons
+ nStartPos += 3; // Abstand CheckButton Context-Bmp
+ nStartPos += nContextWidthDIV2; // Mitte der Context-Bmp
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ // Abstand setzen nur wenn Bitmaps da
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ break;
+
+ case CHECK_BUTTONS :
+ nStartPos += nCheckWidthDIV2;
+ nStartPos += nCheckWidthDIV2; // rechter Rand CheckButton
+ nStartPos += 3; // Abstand CheckButton Context-Bmp
+ nStartPos += nContextWidthDIV2; // Mitte der Context-Bmp
+ nStartPos += nContextWidthDIV2; // rechter Rand der Context-Bmp
+ if( nContextBmpWidthMax )
+ nStartPos += 5; // Abstand Context-Bmp - Text
+ break;
+ }
+ return nStartPos;
+}
+
+void SvTreeListBox::EndSelection()
+{
+ pImp->EndSelection();
+}
+
+BOOL SvTreeListBox::IsNodeButton( const Point& rPos ) const
+{
+ SvLBoxEntry* pEntry = GetEntry( rPos );
+ if( pEntry )
+ return pImp->IsNodeButton( rPos, pEntry );
+ return FALSE;
+}
+
+void SvTreeListBox::RepaintScrollBars() const
+{
+ ((SvTreeListBox*)this)->pImp->RepaintScrollBars();
+}
+
+ScrollBar *SvTreeListBox::GetVScroll()
+{
+ return &((SvTreeListBox*)this)->pImp->aVerSBar;
+}
+
+ScrollBar *SvTreeListBox::GetHScroll()
+{
+ return &((SvTreeListBox*)this)->pImp->aHorSBar;
+}
+
+void SvTreeListBox::EnableAsyncDrag( BOOL b )
+{
+ pImp->EnableAsyncDrag( b );
+}
+
+void SvTreeListBox::SetDontKnowNodeBitmap( const Image& rCollapsedNodeBmp )
+{
+ pImp->SetDontKnowNodeBmp( rCollapsedNodeBmp );
+}
+
+SvLBoxEntry* SvTreeListBox::GetFirstEntryInView() const
+{
+ Point aPos;
+ return GetEntry( aPos );
+}
+
+SvLBoxEntry* SvTreeListBox::GetNextEntryInView(SvLBoxEntry* pEntry ) const
+{
+ SvLBoxEntry* pNext = (SvLBoxEntry*)NextVisible( pEntry );
+ if( pNext )
+ {
+ Point aPos( GetEntryPos(pNext) );
+ const Size& rSize = pImp->GetOutputSize();
+ if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() )
+ return 0;
+ }
+ return pNext;
+}
+
+void SvTreeListBox::ShowFocusRect( const SvLBoxEntry* pEntry )
+{
+ pImp->ShowFocusRect( pEntry );
+}
+
+void SvTreeListBox::SetTabBar( TabBar* pTabBar )
+{
+ pImp->SetTabBar( pTabBar );
+}
+
+void SvTreeListBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if( (rDCEvt.GetType()==DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ InitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+ else
+ Control::DataChanged( rDCEvt );
+}
+
+void SvTreeListBox::InitSettings(BOOL bFont,BOOL bForeground,BOOL bBackground)
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if( bFont )
+ {
+ Font aFont;
+ aFont = rStyleSettings.GetFieldFont();
+ SetPointFont( aFont );
+ }
+
+ if( bForeground || bFont )
+ {
+ SetTextColor( rStyleSettings.GetFieldTextColor() );
+ SetTextFillColor();
+ }
+
+ if( bBackground )
+ SetBackground( rStyleSettings.GetFieldColor() );
+}
+
+void SvTreeListBox::InitStartEntry()
+{
+ if( !pImp->pStartEntry )
+ pImp->pStartEntry = GetModel()->First();
+}
+
+
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
new file mode 100644
index 000000000000..04255804df22
--- /dev/null
+++ b/svtools/source/contnr/treelist.cxx
@@ -0,0 +1,2146 @@
+/*************************************************************************
+ *
+ * $RCSfile: treelist.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TREELIST_CXX
+
+#pragma hdrstop
+
+#include <treelist.hxx>
+
+#ifndef PRODUCT
+// Prueft Integritaet der Liste nach jeder Operation
+//#define CHECK_INTEGRITY
+#endif
+
+
+DBG_NAME(SvListEntry);
+
+SvListEntry::SvListEntry()
+{
+ DBG_CTOR(SvListEntry,0);
+ pChilds = 0;
+ pParent = 0;
+ nListPos = 0;
+ nAbsPos = 0;
+}
+
+SvListEntry::SvListEntry( const SvListEntry& rEntry )
+{
+ DBG_CTOR(SvListEntry,0);
+ pChilds = 0;
+ pParent = 0;
+ nListPos &= 0x80000000;
+ nListPos |= ( rEntry.nListPos & 0x7fffffff);
+ nAbsPos = rEntry.nAbsPos;
+}
+
+SvListEntry::~SvListEntry()
+{
+ DBG_DTOR(SvListEntry,0);
+ if ( pChilds )
+ {
+ pChilds->DestroyAll();
+ delete pChilds;
+ }
+#ifdef DBG_UTIL
+ pChilds = 0;
+ pParent = 0;
+#endif
+}
+
+void SvListEntry::Clone( SvListEntry* pSource)
+{
+ DBG_CHKTHIS(SvListEntry,0);
+ nListPos &= 0x80000000;
+ nListPos |= ( pSource->nListPos & 0x7fffffff);
+ nAbsPos = pSource->nAbsPos;
+}
+
+void SvListEntry::SetListPositions()
+{
+ if( pChilds )
+ {
+ SvListEntry *pEntry = (SvListEntry*)pChilds->First();
+ ULONG nCur = 0;
+ while ( pEntry )
+ {
+ pEntry->nListPos &= 0x80000000;
+ pEntry->nListPos |= nCur;
+ nCur++;
+ pEntry = (SvListEntry*)pChilds->Next();
+ }
+ }
+ nListPos &= (~0x80000000);
+}
+
+
+DBG_NAME(SvViewData);
+
+SvViewData::SvViewData()
+{
+ DBG_CTOR(SvViewData,0);
+ nFlags = 0;
+ nVisPos = 0;
+}
+
+SvViewData::SvViewData( const SvViewData& rData )
+{
+ DBG_CTOR(SvViewData,0);
+ nFlags = rData.nFlags;
+ nFlags &= ~( SVLISTENTRYFLAG_SELECTED | SVLISTENTRYFLAG_FOCUSED );
+ nVisPos = rData.nVisPos;
+}
+
+SvViewData::~SvViewData()
+{
+ DBG_DTOR(SvViewData,0);
+#ifdef DBG_UTIL
+ nVisPos = 0x12345678;
+ nFlags = 0x1234;
+#endif
+}
+
+void SvTreeEntryList::DestroyAll()
+{
+ SvListEntry* pPtr = (SvListEntry*)First();
+ while( pPtr )
+ {
+ delete pPtr;
+ pPtr = (SvListEntry*)Next();
+ }
+}
+
+
+
+
+#if defined (WIN) && defined (MSC)
+// siehe BugId 42896: Die Funktionen Prev, PrevVisible, Next, NextVisible
+// (andere?) funktionieren nicht mit Optimierung.
+#pragma optimize ("", off)
+#endif
+
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvTreeList::SvTreeList()
+{
+ nEntryCount = 0;
+ bAbsPositionsValid = FALSE;
+ nRefCount = 1;
+ pRootItem = new SvListEntry;
+ eSortMode = SortNone;
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::~SvTreeList
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvTreeList::~SvTreeList()
+{
+ Clear();
+ delete pRootItem;
+#ifdef DBG_UTIL
+ pRootItem = 0;
+#endif
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::Broadcast
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+void SvTreeList::Broadcast( USHORT nActionId, SvListEntry* pEntry1,
+ SvListEntry* pEntry2, ULONG nPos )
+{
+ ULONG nViewCount = aViewList.Count();
+ for( ULONG nCurView = 0; nCurView < nViewCount; nCurView++ )
+ {
+ SvListView* pView = (SvListView*)aViewList.GetObject( nCurView );
+ if( pView )
+ pView->ModelNotification( nActionId, pEntry1, pEntry2, nPos );
+ }
+}
+
+void SvTreeList::InsertView( SvListView* pView)
+{
+ ULONG nPos = aViewList.GetPos( pView );
+ if ( nPos == LIST_ENTRY_NOTFOUND )
+ {
+ aViewList.Insert( pView, LIST_APPEND );
+ nRefCount++;
+ }
+}
+
+void SvTreeList::RemoveView( SvListView* pView )
+{
+ ULONG nPos = aViewList.GetPos( pView );
+ if ( nPos != LIST_ENTRY_NOTFOUND )
+ {
+ aViewList.Remove( pView );
+ nRefCount--;
+ }
+}
+
+
+// Ein Entry ist sichtbar, wenn alle Parents expandiert sind
+BOOL SvTreeList::IsEntryVisible( const SvListView* pView, SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pView&&pEntry,"IsVisible:Invalid Params")
+ BOOL bRetVal=FALSE;
+ do
+ {
+ if ( pEntry == pRootItem )
+ {
+ bRetVal=TRUE;
+ break;
+ }
+ pEntry = pEntry->pParent;
+ } while( pView->IsExpanded( pEntry ) );
+ return bRetVal;
+}
+
+USHORT SvTreeList::GetDepth( SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry&&pEntry!=pRootItem,"GetDepth:Bad Entry")
+ USHORT nDepth = 0;
+ while( pEntry->pParent != pRootItem )
+ {
+ nDepth++;
+ pEntry = pEntry->pParent;
+ }
+ return nDepth;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+void SvTreeList::Clear()
+{
+ Broadcast( LISTACTION_CLEARING );
+ SvTreeEntryList* pRootList = pRootItem->pChilds;
+ if ( pRootList )
+ {
+ SvListEntry* pEntry = (SvListEntry*)(pRootList->First());
+ while( pEntry )
+ {
+ delete pEntry;
+ pEntry = (SvListEntry*)(pRootList->Next());
+ }
+ delete pRootItem->pChilds;
+ pRootItem->pChilds = 0;
+ }
+ nEntryCount = 0;
+ Broadcast( LISTACTION_CLEARED );
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+BOOL SvTreeList::IsChild( SvListEntry* pParent, SvListEntry* pChild ) const
+{
+ if ( !pParent )
+ pParent = pRootItem;
+
+ BOOL bIsChild = FALSE;
+ SvTreeEntryList* pList = pParent->pChilds;
+ if ( !pList )
+ return FALSE;
+ SvListEntry* pActualChild = (SvListEntry*)(pList->First());
+ while( !bIsChild && pActualChild )
+ {
+ if ( pActualChild == pChild )
+ bIsChild = TRUE;
+ else
+ {
+ if ( pActualChild->pChilds )
+ bIsChild = IsChild( pActualChild, pChild );
+ pActualChild = (SvListEntry*)(pList->Next());
+ }
+ }
+ return bIsChild;
+}
+
+ULONG SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,ULONG nListPos)
+{
+ // pDest darf Null sein!
+ DBG_ASSERT(pSrcEntry,"Entry?")
+ if ( !pTargetParent )
+ pTargetParent = pRootItem;
+ DBG_ASSERT(pSrcEntry!=pTargetParent,"Move:Source=Target")
+
+ Broadcast( LISTACTION_MOVING, pSrcEntry, pTargetParent, nListPos );
+
+ if ( !pTargetParent->pChilds )
+ pTargetParent->pChilds = new SvTreeEntryList;
+ if ( pSrcEntry == pTargetParent )
+ return pSrcEntry->GetChildListPos();
+
+ bAbsPositionsValid = FALSE;
+
+ SvTreeEntryList* pDstList = pTargetParent->pChilds;
+ SvTreeEntryList* pSrcList = pSrcEntry->pParent->pChilds;
+
+ // Dummy-Ptr einfuegen, weil nListPos durch das
+ // folgende Remove ungueltig werden koennte
+ SvListEntry* pDummy = 0; pDstList->Insert( pDummy, nListPos );
+
+ // loeschen
+ pSrcList->Remove( pSrcEntry );
+ // Hat Parent noch Childs ?
+ if ( pSrcList->Count() == 0 )
+ {
+ // Keine Childs, deshalb Child-List loeschen
+ SvListEntry* pParent = pSrcEntry->pParent;
+ pParent->pChilds = 0;
+ delete pSrcList;
+ pSrcList = 0;
+ }
+
+ // Parent umsetzen (erst hier, weil wir zum Loeschen
+ // der ChildList den alten Parent noch benoetigen!)
+ pSrcEntry->pParent = pTargetParent;
+
+ pDstList->Replace( pSrcEntry, pDummy );
+
+ // Listenpositionen in Zielliste korrigieren
+ SetListPositions( pDstList );
+ if ( pSrcList && (ULONG)pSrcList != (ULONG)pDstList )
+ SetListPositions( pSrcList );
+
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+
+ ULONG nRetVal = pDstList->GetPos( pSrcEntry );
+ DBG_ASSERT(nRetVal==pSrcEntry->GetChildListPos(),"ListPos not valid")
+ Broadcast( LISTACTION_MOVED,pSrcEntry,pTargetParent,nRetVal);
+ return nRetVal;
+}
+
+ULONG SvTreeList::Copy(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,ULONG nListPos)
+{
+ // pDest darf Null sein!
+ DBG_ASSERT(pSrcEntry,"Entry?")
+ if ( !pTargetParent )
+ pTargetParent = pRootItem;
+ if ( !pTargetParent->pChilds )
+ pTargetParent->pChilds = new SvTreeEntryList;
+
+ bAbsPositionsValid = FALSE;
+
+ ULONG nCloneCount = 0;
+ SvListEntry* pClonedEntry = Clone( pSrcEntry, nCloneCount );
+ nEntryCount += nCloneCount;
+
+ SvTreeEntryList* pDstList = pTargetParent->pChilds;
+ pClonedEntry->pParent = pTargetParent; // Parent umsetzen
+ pDstList->Insert( pClonedEntry, nListPos ); // Einfuegen
+ SetListPositions( pDstList ); // Listenpositionen in Zielliste korrigieren
+
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+ Broadcast( LISTACTION_INSERTED_TREE, pClonedEntry );
+ ULONG nRetVal = pDstList->GetPos( pClonedEntry );
+ return nRetVal;
+}
+
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+void SvTreeList::Move( SvListEntry* pSrcEntry, SvListEntry* pDstEntry )
+{
+ SvListEntry* pParent;
+ ULONG nPos;
+
+ if ( !pDstEntry )
+ {
+ pParent = pRootItem;
+ nPos = 0UL;
+ }
+ else
+ {
+ pParent = pDstEntry->pParent;
+ nPos = pDstEntry->GetChildListPos();
+ nPos++; // UNTER (Bildschirm) pDstEntry einfuegen
+ }
+ Move( pSrcEntry, pParent, nPos );
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+void SvTreeList::Copy( SvListEntry* pSrcEntry, SvListEntry* pDstEntry )
+{
+ SvListEntry* pParent;
+ ULONG nPos;
+
+ if ( !pDstEntry )
+ {
+ pParent = pRootItem;
+ nPos = 0UL;
+ }
+ else
+ {
+ pParent = pDstEntry->pParent;
+ nPos = pDstEntry->GetChildListPos()+1;
+ }
+ Copy( pSrcEntry, pParent, nPos );
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+void SvTreeList::InsertTree( SvListEntry* pSrcEntry, SvListEntry* pDstEntry)
+{
+ SvListEntry* pParent;
+ ULONG nPos;
+
+ if ( !pDstEntry )
+ {
+ pParent = pRootItem;
+ nPos = 0UL;
+ }
+ else
+ {
+ pParent = pDstEntry->pParent;
+ nPos = pDstEntry->GetChildListPos()+1;
+ }
+ InsertTree( pSrcEntry, pParent, nPos );
+}
+
+
+void SvTreeList::InsertTree(SvListEntry* pSrcEntry,
+ SvListEntry* pTargetParent,ULONG nListPos)
+{
+ DBG_ASSERT(pSrcEntry,"InsertTree:Entry?")
+ if ( !pSrcEntry )
+ return;
+
+ if ( !pTargetParent )
+ pTargetParent = pRootItem;
+ if ( !pTargetParent->pChilds )
+ pTargetParent->pChilds = new SvTreeEntryList;
+
+ // Sortierung beruecksichtigen
+ GetInsertionPos( pSrcEntry, pTargetParent, nListPos );
+
+ bAbsPositionsValid = FALSE;
+
+ pSrcEntry->pParent = pTargetParent; // Parent umsetzen
+ SvTreeEntryList* pDstList = pTargetParent->pChilds;
+ pDstList->Insert( pSrcEntry, nListPos ); // einfuegen
+ SetListPositions(pDstList); // Listenpositionen in Zielliste korrigieren
+ nEntryCount += GetChildCount( pSrcEntry );
+ nEntryCount++; // der Parent ist ja auch neu
+
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+ Broadcast(LISTACTION_INSERTED_TREE, pSrcEntry );
+}
+
+SvListEntry* SvTreeList::CloneEntry( SvListEntry* pSource ) const
+{
+ if( aCloneLink.IsSet() )
+ return (SvListEntry*)aCloneLink.Call( pSource );
+ SvListEntry* pEntry = CreateEntry();
+ pSource->Clone( pEntry );
+ return pSource;
+}
+
+SvListEntry* SvTreeList::CreateEntry() const
+{
+ return new SvListEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::Clone( SvListEntry* pEntry, ULONG& nCloneCount ) const
+{
+ SvListEntry* pClonedEntry = CloneEntry( pEntry );
+ nCloneCount = 1;
+ SvTreeEntryList* pChilds = pEntry->pChilds;
+ if ( pChilds )
+ pClonedEntry->pChilds=CloneChilds(pChilds,pClonedEntry,nCloneCount);
+ return pClonedEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds,
+ SvListEntry* pNewParent,
+ ULONG& nCloneCount ) const
+{
+ DBG_ASSERT(pChilds->Count(),"Childs?")
+ SvTreeEntryList* pClonedChilds = new SvTreeEntryList;
+ SvListEntry* pChild = (SvListEntry*)pChilds->First();
+ while ( pChild )
+ {
+ SvListEntry* pNewChild = CloneEntry( pChild );
+ nCloneCount++;
+ pNewChild->pParent = pNewParent;
+ SvTreeEntryList* pSubChilds = pChild->pChilds;
+ if ( pSubChilds )
+ {
+ pSubChilds = CloneChilds( pSubChilds, pNewChild, nCloneCount );
+ pNewChild->pChilds = pSubChilds;
+ }
+
+ pClonedChilds->Insert( pNewChild, LIST_APPEND );
+ pChild = (SvListEntry*)pChilds->Next();
+ }
+ return pClonedChilds;
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::GetChildCount
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+ULONG SvTreeList::GetChildCount( SvListEntry* pParent ) const
+{
+ if ( !pParent )
+ return GetEntryCount();
+
+ if ( !pParent || !pParent->pChilds)
+ return 0;
+ ULONG nCount = 0;
+ USHORT nRefDepth = GetDepth( pParent );
+ USHORT nActDepth = nRefDepth;
+ do
+ {
+ pParent = Next( pParent, &nActDepth );
+ nCount++;
+ } while( pParent && nRefDepth < nActDepth );
+ nCount--;
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+ULONG SvTreeList::GetVisibleChildCount(const SvListView* pView, SvListEntry* pParent) const
+{
+ DBG_ASSERT(pView,"GetVisChildCount:No View")
+ if ( !pParent )
+ pParent = pRootItem;
+ if ( !pParent || !pView->IsExpanded(pParent) || !pParent->pChilds )
+ return 0;
+ ULONG nCount = 0;
+ USHORT nRefDepth = GetDepth( pParent );
+ USHORT nActDepth = nRefDepth;
+ do
+ {
+ pParent = NextVisible( pView, pParent, &nActDepth );
+ nCount++;
+ } while( pParent && nRefDepth < nActDepth );
+ nCount--;
+ return nCount;
+}
+
+ULONG SvTreeList::GetChildSelectionCount(const SvListView* pView,SvListEntry* pParent) const
+{
+ DBG_ASSERT(pView,"GetChildSelCount:No View")
+ if ( !pParent )
+ pParent = pRootItem;
+ if ( !pParent || !pParent->pChilds)
+ return 0;
+ ULONG nCount = 0;
+ USHORT nRefDepth = GetDepth( pParent );
+ USHORT nActDepth = nRefDepth;
+ do
+ {
+ pParent = Next( pParent, &nActDepth );
+ if( pParent && pView->IsSelected( pParent ) && nRefDepth < nActDepth)
+ nCount++;
+ } while( pParent && nRefDepth < nActDepth );
+// nCount--;
+ return nCount;
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::First() const
+{
+ if ( nEntryCount )
+ return (SvListEntry*)(pRootItem->pChilds->GetObject(0));
+ else
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::Next
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, USHORT* pDepth ) const
+{
+ DBG_ASSERT(pActEntry,"Entry?")
+ USHORT nDepth = 0;
+ int bWithDepth = FALSE;
+ if ( pDepth )
+ {
+ nDepth = *pDepth;
+ bWithDepth = TRUE;
+ }
+
+ SvTreeEntryList* pActualList = pActEntry->pParent->pChilds;
+ ULONG nActualPos = pActEntry->GetChildListPos();
+
+ if ( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ )
+ {
+ nDepth++;
+ pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0));
+ if ( bWithDepth )
+ *pDepth = nDepth;
+ return pActEntry;
+ }
+
+ if ( pActualList->Count() > ( nActualPos + 1 ) )
+ {
+ pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 ));
+ if ( bWithDepth )
+ *pDepth = nDepth;
+ return pActEntry;
+ }
+
+ SvListEntry* pParent = pActEntry->pParent;
+ nDepth--;
+ while( pParent != pRootItem && pParent != 0 )
+ {
+ DBG_ASSERT(pParent!=0,"TreeData corrupt!");
+ pActualList = pParent->pParent->pChilds;
+ DBG_ASSERT(pActualList,"TreeData corrupt!")
+ nActualPos = pParent->GetChildListPos();
+ if ( pActualList->Count() > ( nActualPos + 1 ) )
+ {
+ pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 ));
+ if ( bWithDepth )
+ *pDepth = nDepth;
+ return pActEntry;
+ }
+ pParent = pParent->pParent;
+ nDepth--;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::Prev
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, USHORT* pDepth ) const
+{
+ DBG_ASSERT(pActEntry!=0,"Entry?")
+
+ USHORT nDepth = 0;
+ int bWithDepth = FALSE;
+ if ( pDepth )
+ {
+ nDepth = *pDepth;
+ bWithDepth = TRUE;
+ }
+
+ SvTreeEntryList* pActualList = pActEntry->pParent->pChilds;
+ ULONG nActualPos = pActEntry->GetChildListPos();
+
+ if ( nActualPos > 0 )
+ {
+ pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 ));
+ while( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ )
+ {
+ pActualList = pActEntry->pChilds;
+ nDepth++;
+ pActEntry = (SvListEntry*)(pActualList->Last());
+ }
+ if ( bWithDepth )
+ *pDepth = nDepth;
+ return pActEntry;
+ }
+ if ( pActEntry->pParent == pRootItem )
+ return 0;
+
+ pActEntry = pActEntry->pParent;
+
+ if ( pActEntry )
+ {
+ nDepth--;
+ if ( bWithDepth )
+ *pDepth = nDepth;
+ return pActEntry;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::Last( USHORT* /* nDepth */ ) const
+{
+ SvTreeEntryList* pActList = pRootItem->pChilds;
+// if ( pActList->Count() == 0 )
+// return 0;
+ SvListEntry* pEntry = 0;
+ while( pActList )
+ {
+ pEntry = (SvListEntry*)(pActList->Last());
+ pActList = pEntry->pChilds;
+// if ( pActList->Count() == 0 )
+// pActList = 0;
+ }
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+ULONG SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pView&&pEntry,"View/Entry?")
+
+ if ( !pView->bVisPositionsValid )
+ {
+ // damit GetVisibleCount die Positionen aktualisiert
+ ((SvListView*)pView)->nVisibleCount = 0;
+ GetVisibleCount( pView );
+ }
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ return pViewData->nVisPos;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+ULONG SvTreeList::GetVisibleCount( const SvListView* pView ) const
+{
+ DBG_ASSERT(pView,"GetVisCount:No View")
+ if( !pView->HasViewData() )
+ return 0;
+ if ( pView->nVisibleCount )
+ return pView->nVisibleCount;
+
+ ULONG nPos = 0;
+ SvListEntry* pEntry = First(); // erster Eintrag immer sichtbar
+ while ( pEntry )
+ {
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ pViewData->nVisPos = nPos;
+ nPos++;
+ pEntry = NextVisible( pView, pEntry );
+ }
+#ifdef DBG_UTIL
+ if( nPos > 10000000 )
+ {
+ DBG_ERROR("nVisibleCount bad");
+ }
+#endif
+ ((SvListView*)pView)->nVisibleCount = nPos;
+ ((SvListView*)pView)->bVisPositionsValid = TRUE;
+ return nPos;
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+// Funktion geht aus Geschwindigkeitsgruenden davon aus,
+// das der uebergebene Eintrag bereits sichtbar ist
+
+SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEntry,USHORT* pActDepth) const
+{
+ DBG_ASSERT(pView,"NextVisible:No View")
+ if ( !pActEntry )
+ return 0;
+
+ USHORT nDepth = 0;
+ int bWithDepth = FALSE;
+ if ( pActDepth )
+ {
+ nDepth = *pActDepth;
+ bWithDepth = TRUE;
+ }
+
+ SvTreeEntryList* pActualList = pActEntry->pParent->pChilds;
+ ULONG nActualPos = pActEntry->GetChildListPos();
+
+ if ( pView->IsExpanded(pActEntry) )
+ {
+ DBG_ASSERT(pActEntry->pChilds,"Childs?")
+ nDepth++;
+ pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0));
+ if ( bWithDepth )
+ *pActDepth = nDepth;
+ return pActEntry;
+ }
+
+ nActualPos++;
+ if ( pActualList->Count() > nActualPos )
+ {
+ pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos ));
+ if ( bWithDepth )
+ *pActDepth = nDepth;
+ return pActEntry;
+ }
+
+ SvListEntry* pParent = pActEntry->pParent;
+ nDepth--;
+ while( pParent != pRootItem )
+ {
+ pActualList = pParent->pParent->pChilds;
+ nActualPos = pParent->GetChildListPos();
+ nActualPos++;
+ if ( pActualList->Count() > nActualPos )
+ {
+ pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos ));
+ if ( bWithDepth )
+ *pActDepth = nDepth;
+ return pActEntry;
+ }
+ pParent = pParent->pParent;
+ nDepth--;
+ }
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+// Funktion geht aus Geschwindigkeitsgruenden davon aus,
+// das der uebergebene Eintrag bereits sichtbar ist
+
+SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActEntry, USHORT* pActDepth) const
+{
+ DBG_ASSERT(pView&&pActEntry,"PrevVis:View/Entry?")
+
+ USHORT nDepth = 0;
+ int bWithDepth = FALSE;
+ if ( pActDepth )
+ {
+ nDepth = *pActDepth;
+ bWithDepth = TRUE;
+ }
+
+ SvTreeEntryList* pActualList = pActEntry->pParent->pChilds;
+ ULONG nActualPos = pActEntry->GetChildListPos();
+
+ if ( nActualPos > 0 )
+ {
+ pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 ));
+ while( pView->IsExpanded(pActEntry) )
+ {
+ pActualList = pActEntry->pChilds;
+ nDepth++;
+ pActEntry = (SvListEntry*)(pActualList->Last());
+ }
+ if ( bWithDepth )
+ *pActDepth = nDepth;
+ return pActEntry;
+ }
+
+ if ( pActEntry->pParent == pRootItem )
+ return 0;
+
+ pActEntry = pActEntry->pParent;
+ if ( pActEntry )
+ {
+ nDepth--;
+ if ( bWithDepth )
+ *pActDepth = nDepth;
+ return pActEntry;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::LastVisible( const SvListView* pView, USHORT* pDepth) const
+{
+ DBG_ASSERT(pView,"LastVis:No View")
+ SvListEntry* pEntry = Last();
+ while( pEntry && !IsEntryVisible( pView, pEntry ) )
+ pEntry = PrevVisible( pView, pEntry );
+ if ( pEntry && pDepth )
+ *pDepth = GetDepth( pEntry );
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry,USHORT& nDelta) const
+{
+ DBG_ASSERT(pView&&pEntry&&IsEntryVisible(pView,pEntry),"NextVis:Wrong Prms/!Vis")
+
+ ULONG nVisPos = GetVisiblePos( pView, pEntry );
+ // nDelta Eintraege vorhanden ?
+ // Beispiel: 0,1,2,3,4,5,6,7,8,9 nVisPos=5 nDelta=7
+ // nNewDelta = 10-nVisPos-1 == 4
+ if ( nVisPos+nDelta >= pView->nVisibleCount )
+ {
+ nDelta = (USHORT)(pView->nVisibleCount-nVisPos);
+ nDelta--;
+ }
+ USHORT nDeltaTmp = nDelta;
+ while( nDeltaTmp )
+ {
+ pEntry = NextVisible( pView, pEntry );
+ nDeltaTmp--;
+ DBG_ASSERT(pEntry,"Entry?")
+ }
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEntry, USHORT& nDelta ) const
+{
+ DBG_ASSERT(pView&&pEntry&&IsEntryVisible(pView,pEntry),"PrevVis:Parms/!Vis")
+
+ ULONG nVisPos = GetVisiblePos( pView, pEntry );
+ // nDelta Eintraege vorhanden ?
+ // Beispiel: 0,1,2,3,4,5,6,7,8,9 nVisPos=8 nDelta=20
+ // nNewDelta = nNewVisPos
+ if ( nDelta > nVisPos )
+ nDelta = (USHORT)nVisPos;
+ USHORT nDeltaTmp = nDelta;
+ while( nDeltaTmp )
+ {
+ pEntry = PrevVisible( pView, pEntry );
+ nDeltaTmp--;
+ DBG_ASSERT(pEntry,"Entry?")
+ }
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::FirstSelected( const SvListView* pView) const
+{
+ DBG_ASSERT(pView,"FirstSel:No View")
+ if( !pView )
+ return 0;
+ SvListEntry* pActSelEntry = First();
+ while( pActSelEntry && !pView->IsSelected(pActSelEntry) )
+ pActSelEntry = NextVisible( pView, pActSelEntry );
+ return pActSelEntry;
+}
+
+
+SvListEntry* SvTreeList::FirstChild( SvListEntry* pParent ) const
+{
+ if ( !pParent )
+ pParent = pRootItem;
+ SvListEntry* pResult;
+ if ( pParent->pChilds )
+ pResult = (SvListEntry*)(pParent->pChilds->GetObject( 0 ));
+ else
+ pResult = 0;
+ return pResult;
+}
+
+SvListEntry* SvTreeList::NextSibling( SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry,"Entry?")
+ if( !pEntry )
+ return 0;
+ SvTreeEntryList* pList = pEntry->pParent->pChilds;
+// ULONG nPos = pList->GetPos( pEntry );
+ ULONG nPos = pEntry->GetChildListPos();
+ nPos++;
+ pEntry = (SvListEntry*)(pList->GetObject( nPos ));
+ return pEntry;
+}
+
+SvListEntry* SvTreeList::PrevSibling( SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry,"Entry?")
+ if( !pEntry )
+ return 0;
+
+ SvTreeEntryList* pList = pEntry->pParent->pChilds;
+ // ULONG nPos = pList->GetPos( pEntry );
+ ULONG nPos = pEntry->GetChildListPos();
+ if ( nPos == 0 )
+ return 0;
+ nPos--;
+ pEntry = (SvListEntry*)(pList->GetObject( nPos ));
+ return pEntry;
+}
+
+
+SvListEntry* SvTreeList::LastSibling( SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry,"LastSibling:Entry?");
+ if( !pEntry )
+ return 0;
+ SvListEntry* pSib = 0;
+ SvTreeEntryList* pSibs = pEntry->pParent->pChilds;
+ if ( pSibs )
+ pSib = (SvListEntry*)(pSibs->Last());
+ return pSib;
+}
+
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::NextSelected( const SvListView* pView, SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pView&&pEntry,"NextSel:View/Entry?")
+ pEntry = Next( pEntry );
+ while( pEntry && !pView->IsSelected(pEntry) )
+ pEntry = Next( pEntry );
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::PrevSelected( const SvListView* pView, SvListEntry* pEntry) const
+{
+ DBG_ASSERT(pView&&pEntry,"PrevSel:View/Entry?")
+ pEntry = Prev( pEntry );
+ while( pEntry && !pView->IsSelected(pEntry) )
+ pEntry = Prev( pEntry );
+
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+SvListEntry* SvTreeList::LastSelected( const SvListView* pView ) const
+{
+ DBG_ASSERT(pView,"LastSel:No View")
+ SvListEntry* pEntry = Last();
+ while( pEntry && !pView->IsSelected(pEntry) )
+ pEntry = Prev( pEntry );
+ return pEntry;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::Insert
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+ULONG SvTreeList::Insert( SvListEntry* pEntry,SvListEntry* pParent,ULONG nPos )
+{
+ DBG_ASSERT( pEntry,"Entry?")
+
+ if ( !pParent )
+ pParent = pRootItem;
+
+
+ SvTreeEntryList* pList = pParent->pChilds;
+ if ( !pList )
+ {
+ // Parent bekommt zum erstenmal ein Kind
+ pList = new SvTreeEntryList;
+ pParent->pChilds = pList;
+ }
+
+ // Sortierung beruecksichtigen
+ GetInsertionPos( pEntry, pParent, nPos );
+
+ bAbsPositionsValid = FALSE;
+ pEntry->pParent = pParent;
+
+ pList->Insert( pEntry, nPos );
+ nEntryCount++;
+ if( nPos != LIST_APPEND && (nPos != (pList->Count()-1)) )
+ SetListPositions( pList );
+ else
+ pEntry->nListPos = pList->Count()-1;
+
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+ Broadcast( LISTACTION_INSERTED, pEntry );
+ return nPos; // pEntry->nListPos;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+ULONG SvTreeList::GetAbsPos( SvListEntry* pEntry) const
+{
+ if ( !bAbsPositionsValid )
+ ((SvTreeList*)this)->SetAbsolutePositions();
+ return pEntry->nAbsPos;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+void SvTreeList::SetAbsolutePositions()
+{
+ ULONG nPos = 0;
+ SvListEntry* pEntry = First();
+ while ( pEntry )
+ {
+ pEntry->nAbsPos = nPos;
+ nPos++;
+ pEntry = Next( pEntry );
+ }
+ bAbsPositionsValid = TRUE;
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::Expand
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+void SvTreeList::Expand( SvListView* pView, SvListEntry* pEntry )
+{
+ DBG_ASSERT(pEntry&&pView,"Expand:View/Entry?")
+ if ( pView->IsExpanded(pEntry) )
+ return;
+
+ DBG_ASSERT(pEntry->pChilds,"Expand:No Childs!")
+
+ SvViewData* pViewData = pView->GetViewData(pEntry);
+ pViewData->nFlags |= SVLISTENTRYFLAG_EXPANDED;
+ SvListEntry* pParent = pEntry->pParent;
+ // wenn Parent sichtbar dann Statusdaten invalidieren
+ if ( pView->IsExpanded( pParent ) )
+ {
+ pView->bVisPositionsValid = FALSE;
+ pView->nVisibleCount = 0;
+ }
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::Collapse
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+void SvTreeList::Collapse( SvListView* pView, SvListEntry* pEntry )
+{
+ DBG_ASSERT(pView&&pEntry,"Collapse:View/Entry?")
+ if ( !pView->IsExpanded(pEntry) )
+ return;
+
+ DBG_ASSERT(pEntry->pChilds,"Collapse:No Childs!")
+
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ pViewData->nFlags &=(~SVLISTENTRYFLAG_EXPANDED);
+
+ SvListEntry* pParent = pEntry->pParent;
+ if ( pView->IsExpanded(pParent) )
+ {
+ pView->nVisibleCount = 0;
+ pView->bVisPositionsValid = FALSE;
+ }
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+}
+
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+BOOL SvTreeList::Select( SvListView* pView, SvListEntry* pEntry, BOOL bSelect )
+{
+ DBG_ASSERT(pView&&pEntry,"Select:View/Entry?")
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ if ( bSelect )
+ {
+ if ( pViewData->IsSelected() )
+ return FALSE;
+ else
+ {
+ pViewData->nFlags |= SVLISTENTRYFLAG_SELECTED;
+ pView->nSelectionCount++;
+ }
+ }
+ else
+ {
+ if ( !pViewData->IsSelected() )
+ return FALSE;
+ else
+ {
+ pViewData->nFlags &= ~( SVLISTENTRYFLAG_SELECTED );
+ pView->nSelectionCount--;
+ }
+ }
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::Remove
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 24.06.97
+|*
+*************************************************************************/
+BOOL SvTreeList::Remove( SvListEntry* pEntry )
+{
+ DBG_ASSERT(pEntry,"Cannot remove root, use clear")
+
+ if( !pEntry->pParent )
+ {
+ DBG_ERROR("Removing entry not in model!");
+ // unter gewissen Umstaenden (welche?) loescht der
+ // Explorer aus der View Eintraege, die er nicht in die View
+ // eingefuegt hat. Da sich der Kunde fuer ein platzendes
+ // Office nichts kaufen kann, fange ich diesen Fall ab.
+ return FALSE;
+ }
+
+ Broadcast( LISTACTION_REMOVING, pEntry );
+ ULONG nRemoved = 1 + GetChildCount(pEntry);
+ bAbsPositionsValid = FALSE;
+
+ SvListEntry* pParent = pEntry->pParent;
+ SvTreeEntryList* pList = pParent->pChilds;
+ DBG_ASSERT(pList,"Remove:No Childlist")
+ BOOL bLastEntry = FALSE;
+
+ if ( pEntry->HasChildListPos() )
+ {
+ ULONG nListPos = pEntry->GetChildListPos();
+ bLastEntry = (nListPos == (pList->Count()-1) ) ? TRUE : FALSE;
+ pList->Remove( nListPos );
+ }
+ else
+ {
+ pList->Remove( (void*) pEntry );
+ }
+
+ delete pEntry; // loescht auch alle Childs
+
+ if ( pList->Count() == 0 )
+ {
+ pParent->pChilds = 0;
+ delete pList;
+ }
+ else
+ {
+ if( !bLastEntry )
+ SetListPositions( pList );
+ }
+ nEntryCount -= nRemoved;
+
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+ Broadcast( LISTACTION_REMOVED, pEntry );
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvTreeList::
+|*
+|* Beschreibung
+|* Ersterstellung 17.08.94
+|* Letzte Aenderung 17.08.94
+|*
+*************************************************************************/
+
+ULONG SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,BOOL bSelect )
+{
+ DBG_ASSERT(pView&&pParent,"SelChilds:View/Parent?")
+ if ( !pParent->pChilds )
+ return 0;
+ if ( pParent->pChilds->Count() == 0 )
+ return 0;
+
+ USHORT nRefDepth = GetDepth( pParent );
+ USHORT nDepth = nRefDepth;
+ ULONG nCount = 0;
+ pParent = Next( pParent );
+ do
+ {
+ if ( Select( pView, pParent, bSelect ) )
+ nCount++; // nur die tatsaechlichen Selektierungen zaehlen
+ pParent = Next( pParent, &nDepth );
+ }
+ while( pParent && nDepth > nRefDepth );
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+ return nCount;
+}
+
+void SvTreeList::SelectAll( SvListView* pView, BOOL bSelect )
+{
+ DBG_ASSERT(pView,"SelectAll:NoView")
+ SvListEntry* pEntry = First();
+ while ( pEntry )
+ {
+ SvViewData* pViewData = pView->GetViewData( pEntry );
+ if ( bSelect )
+ pViewData->nFlags |= SVLISTENTRYFLAG_SELECTED;
+ else
+ pViewData->nFlags &= (~SVLISTENTRYFLAG_SELECTED);
+
+ pEntry = Next( pEntry );
+ }
+ if ( bSelect )
+ pView->nSelectionCount = nEntryCount;
+ else
+ pView->nSelectionCount = 0;
+#ifdef CHECK_INTEGRITY
+CheckIntegrity();
+#endif
+}
+
+
+SvListEntry* SvTreeList::GetEntryAtAbsPos( ULONG nAbsPos ) const
+{
+ SvListEntry* pEntry = First();
+ while ( nAbsPos && pEntry )
+ {
+ pEntry = Next( pEntry );
+ nAbsPos--;
+ }
+ return pEntry;
+}
+
+SvListEntry* SvTreeList::GetEntryAtVisPos( const SvListView* pView, ULONG nVisPos ) const
+{
+ DBG_ASSERT(pView,"GetEntryAtVisPos:No View")
+ SvListEntry* pEntry = First();
+ while ( nVisPos && pEntry )
+ {
+ pEntry = NextVisible( pView, pEntry );
+ nVisPos--;
+ }
+ return pEntry;
+}
+
+void SvTreeList::SetListPositions( SvTreeEntryList* pList )
+{
+ if( pList->Count() )
+ {
+ SvListEntry* pEntry = (SvListEntry*)(pList->GetObject(0));
+ if( pEntry->pParent )
+ pEntry->pParent->InvalidateChildrensListPositions();
+ }
+ /*
+ ULONG nListPos = 0;
+ SvListEntry* pEntry = (SvListEntry*)(pList->First());
+ while( pEntry )
+ {
+ pEntry->nListPos = nListPos;
+ nListPos++;
+ pEntry = (SvListEntry*)(pList->Next());
+ }
+ */
+}
+
+
+void SvTreeList::InvalidateEntry( SvListEntry* pEntry )
+{
+ Broadcast( LISTACTION_INVALIDATE_ENTRY, pEntry );
+}
+
+BOOL SvTreeList::IsInChildList( SvListEntry* pParent, SvListEntry* pChild) const
+{
+ if ( !pParent )
+ pParent = pRootItem;
+ BOOL bIsChild = FALSE;
+ if ( pParent->pChilds )
+ bIsChild = (BOOL)(pParent->pChilds->GetPos(pChild) != LIST_ENTRY_NOTFOUND);
+ return bIsChild;
+}
+
+
+void lcl_CheckList( SvTreeEntryList* pList )
+{
+ SvListEntry* pEntry = (SvListEntry*)(pList->First());
+ ULONG nPos = 0;
+ while ( pEntry )
+ {
+ DBG_ASSERT(pEntry->GetChildListPos()==nPos,"Wrong ListPos")
+ pEntry = (SvListEntry*)(pList->Next());
+ nPos++;
+ }
+}
+
+void SvTreeList::CheckIntegrity() const
+{
+ ULONG nMyEntryCount = 0;
+ if ( pRootItem->pChilds )
+ {
+ lcl_CheckList( pRootItem->pChilds );
+ SvListEntry* pEntry = First();
+ while( pEntry )
+ {
+ nMyEntryCount++;
+ if ( pEntry->pChilds )
+ lcl_CheckList( pEntry->pChilds );
+ pEntry = Next( pEntry );
+ }
+ }
+ DBG_ASSERT(nMyEntryCount==GetEntryCount(),"Entry count invalid")
+}
+
+SvListEntry* SvTreeList::GetRootLevelParent( SvListEntry* pEntry ) const
+{
+ DBG_ASSERT(pEntry,"GetRootLevelParent:No Entry")
+ SvListEntry* pCurParent = 0;
+ if ( pEntry )
+ {
+ pCurParent = pEntry->pParent;
+ if ( pCurParent == pRootItem )
+ return pEntry; // ist sein eigener Parent
+ while( pCurParent->pParent != pRootItem )
+ pCurParent = pCurParent->pParent;
+ }
+ return pCurParent;
+}
+
+
+
+
+//*************************************************************************
+//*************************************************************************
+//*************************************************************************
+//*************************************************************************
+//*************************************************************************
+//*************************************************************************
+//*************************************************************************
+//*************************************************************************
+
+DBG_NAME(SvListView);
+
+SvListView::SvListView( SvTreeList* pModell )
+{
+ DBG_CTOR(SvListView,0);
+ pModel = 0;
+ nSelectionCount = 0;
+ nVisibleCount = 0;
+ bVisPositionsValid = FALSE;
+ SetModel( pModell );
+}
+
+SvListView::SvListView()
+{
+ DBG_CTOR(SvListView,0);
+ pModel = 0;
+ nSelectionCount = 0;
+ nVisibleCount = 0;
+ bVisPositionsValid = FALSE;
+}
+
+
+SvListView::~SvListView()
+{
+ DBG_DTOR(SvListView,0);
+ ClearTable();
+}
+
+void SvListView::InitTable()
+{
+ DBG_CHKTHIS(SvListView,0);
+ DBG_ASSERT(pModel,"InitTable:No Model")
+ DBG_ASSERT(!nSelectionCount&&!nVisibleCount&&!bVisPositionsValid,"InitTable: Not cleared!");
+
+ if( aDataTable.Count() )
+ {
+ DBG_ASSERT(aDataTable.Count()==1,"InitTable: TableCount != 1");
+ // die im Clear fuer die Root allozierten View-Daten loeschen
+ // Achtung: Das zu dem RootEntry (und damit auch der Entry)
+ // gehoerende Model kann bereits geloescht sein!
+ SvViewData* pViewData = (SvViewData*)aDataTable.GetObject( 0 );
+ delete pViewData;
+ aDataTable.Clear();
+ }
+
+ SvListEntry* pEntry;
+ SvViewData* pViewData;
+
+ // RootEntry einfuegen
+ pEntry = pModel->pRootItem;
+ pViewData = new SvViewData;
+ pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED;
+ aDataTable.Insert( (ULONG)pEntry, pViewData );
+ // Jetzt alle anderen Entries
+ pEntry = pModel->First();
+ while( pEntry )
+ {
+ pViewData = CreateViewData( pEntry );
+ DBG_ASSERT(pViewData,"InitTable:No ViewData")
+ InitViewData( pViewData, pEntry );
+ aDataTable.Insert( (ULONG)pEntry, pViewData );
+ pEntry = pModel->Next( pEntry );
+ }
+}
+
+SvViewData* SvListView::CreateViewData( SvListEntry* )
+{
+ DBG_CHKTHIS(SvListView,0);
+ return new SvViewData;
+}
+
+void SvListView::ClearTable()
+{
+ DBG_CHKTHIS(SvListView,0);
+ SvViewData* pViewData = (SvViewData*)aDataTable.First();
+ while( pViewData )
+ {
+ delete pViewData;
+ pViewData = (SvViewData*)aDataTable.Next();
+ }
+ aDataTable.Clear();
+}
+
+void SvListView::Clear()
+{
+ ClearTable();
+ nSelectionCount = 0;
+ nVisibleCount = 0;
+ bVisPositionsValid = FALSE;
+ if( pModel )
+ {
+ // RootEntry einfuegen
+ SvListEntry* pEntry = pModel->pRootItem;
+ SvViewData* pViewData = new SvViewData;
+ pViewData->nFlags = SVLISTENTRYFLAG_EXPANDED;
+ aDataTable.Insert( (ULONG)pEntry, pViewData );
+ }
+}
+
+void SvListView::SetModel( SvTreeList* pNewModel )
+{
+ DBG_CHKTHIS(SvListView,0);
+ BOOL bBroadcastCleared = FALSE;
+ if ( pModel )
+ {
+ pModel->RemoveView( this );
+ bBroadcastCleared = TRUE;
+ ModelNotification( LISTACTION_CLEARING,0,0,0 );
+ if ( pModel->GetRefCount() == 0 )
+ delete pModel;
+ }
+ pModel = pNewModel;
+ InitTable();
+ pNewModel->InsertView( this );
+ if( bBroadcastCleared )
+ ModelNotification( LISTACTION_CLEARED,0,0,0 );
+}
+
+
+void SvListView::ModelHasCleared()
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ModelHasInserted( SvListEntry* )
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ModelHasInsertedTree( SvListEntry* )
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ModelIsMoving( SvListEntry* /* pSource */ ,
+ SvListEntry* /* pTargetParent */ , ULONG /* nPos */ )
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+
+void SvListView::ModelHasMoved( SvListEntry* )
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ModelIsRemoving( SvListEntry* )
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ModelHasRemoved( SvListEntry* )
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ModelHasEntryInvalidated( SvListEntry*)
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ActionMoving( SvListEntry* pEntry,SvListEntry* pTargetPrnt,ULONG nChildPos)
+{
+ DBG_CHKTHIS(SvListView,0);
+ SvListEntry* pParent = pEntry->pParent;
+ DBG_ASSERT(pParent,"Model not consistent")
+ if( pParent != pModel->pRootItem && pParent->pChilds->Count() == 1 )
+ {
+ SvViewData* pViewData = (SvViewData*)aDataTable.Get( (ULONG)pParent );
+ pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
+ }
+ // vorlaeufig
+ nVisibleCount = 0;
+ bVisPositionsValid = FALSE;
+}
+
+void SvListView::ActionMoved( SvListEntry* /* pEntry */ ,
+ SvListEntry* /* pTargetPrnt */ ,
+ ULONG /* nChildPos */ )
+{
+ DBG_CHKTHIS(SvListView,0);
+ nVisibleCount = 0;
+ bVisPositionsValid = FALSE;
+}
+
+void SvListView::ActionInserted( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvListView,0);
+ DBG_ASSERT(pEntry,"Insert:No Entry")
+ SvViewData* pData = CreateViewData( pEntry );
+ InitViewData( pData, pEntry );
+ BOOL bSuccess = aDataTable.Insert( (ULONG)pEntry, pData );
+ DBG_ASSERT(bSuccess,"Entry already in View")
+ if ( nVisibleCount && pModel->IsEntryVisible( this, pEntry ))
+ {
+ nVisibleCount = 0;
+ bVisPositionsValid = FALSE;
+ }
+}
+
+void SvListView::ActionInsertedTree( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvListView,0);
+ if ( pModel->IsEntryVisible( this, pEntry ))
+ {
+ nVisibleCount = 0;
+ bVisPositionsValid = FALSE;
+ }
+ // ueber Entry und seine Childs iterieren
+ SvListEntry* pCurEntry = pEntry;
+ USHORT nRefDepth = pModel->GetDepth( pCurEntry );
+ while( pCurEntry )
+ {
+ DBG_ASSERT(aDataTable.Get((ULONG)pCurEntry)==0,"Entry already in Table")
+ SvViewData* pViewData = CreateViewData( pCurEntry );
+ DBG_ASSERT(pViewData,"No ViewData")
+ InitViewData( pViewData, pEntry );
+ aDataTable.Insert( (ULONG)pCurEntry, pViewData );
+ pCurEntry = pModel->Next( pCurEntry );
+ if ( pCurEntry && pModel->GetDepth(pCurEntry) <= nRefDepth)
+ pCurEntry = 0;
+ }
+}
+
+void SvListView::RemoveViewData( SvListEntry* pParent )
+{
+ SvTreeEntryList* pChilds = pParent->pChilds;
+ if( pChilds )
+ {
+ SvListEntry* pCur = (SvListEntry*)pChilds->First();
+ while( pCur )
+ {
+ SvViewData* pViewData = (SvViewData*)aDataTable.Get((ULONG)pCur);
+ delete pViewData;
+ aDataTable.Remove( (ULONG)pCur );
+ if( pCur->HasChilds())
+ RemoveViewData( pCur );
+ pCur = (SvListEntry*)pChilds->Next();
+ }
+ }
+}
+
+
+
+void SvListView::ActionRemoving( SvListEntry* pEntry )
+{
+ DBG_CHKTHIS(SvListView,0);
+ DBG_ASSERT(pEntry,"Remove:No Entry")
+
+ SvViewData* pViewData = (SvViewData*)aDataTable.Get( (ULONG)pEntry );
+ ULONG nSelRemoved = 0;
+ if ( pViewData->IsSelected() )
+ nSelRemoved = 1 + pModel->GetChildSelectionCount( this, pEntry );
+ nSelectionCount -= nSelRemoved;
+ ULONG nVisibleRemoved = 0;
+ if ( pModel->IsEntryVisible( this, pEntry ) )
+ nVisibleRemoved = 1 + pModel->GetVisibleChildCount( this, pEntry );
+ if( nVisibleCount )
+ {
+#ifdef DBG_UTIL
+ if( nVisibleCount < nVisibleRemoved )
+ {
+ DBG_ERROR("nVisibleRemoved bad");
+ }
+#endif
+ nVisibleCount -= nVisibleRemoved;
+ }
+ bVisPositionsValid = FALSE;
+
+ pViewData = (SvViewData*)aDataTable.Get((ULONG)pEntry);
+ delete pViewData;
+ aDataTable.Remove( (ULONG)pEntry );
+ RemoveViewData( pEntry );
+
+ SvListEntry* pCurEntry = pEntry->pParent;
+ if ( pCurEntry && pCurEntry != pModel->pRootItem &&
+ pCurEntry->pChilds->Count() == 1 )
+ {
+ pViewData = (SvViewData*)aDataTable.Get((ULONG)pCurEntry);
+ pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED);
+ }
+}
+
+void SvListView::ActionRemoved( SvListEntry* /* pEntry */ )
+{
+ DBG_CHKTHIS(SvListView,0);
+}
+
+void SvListView::ActionClear()
+{
+ DBG_CHKTHIS(SvListView,0);
+ Clear();
+}
+
+void SvListView::ModelNotification( USHORT nActionId, SvListEntry* pEntry1,
+ SvListEntry* pEntry2, ULONG nPos )
+{
+ DBG_CHKTHIS(SvListView,0);
+ switch( nActionId )
+ {
+ case LISTACTION_INSERTED:
+ ActionInserted( pEntry1 );
+ ModelHasInserted( pEntry1 );
+ break;
+ case LISTACTION_INSERTED_TREE:
+ ActionInsertedTree( pEntry1 );
+ ModelHasInsertedTree( pEntry1 );
+ break;
+ case LISTACTION_REMOVING:
+ ModelIsRemoving( pEntry1 );
+ ActionRemoving( pEntry1 );
+ break;
+ case LISTACTION_REMOVED:
+ ActionRemoved( pEntry1 );
+ ModelHasRemoved( pEntry1 );
+ break;
+ case LISTACTION_MOVING:
+ ModelIsMoving( pEntry1, pEntry2, nPos );
+ ActionMoving( pEntry1, pEntry2, nPos );
+ break;
+ case LISTACTION_MOVED:
+ ActionMoved( pEntry1, pEntry2, nPos );
+ ModelHasMoved( pEntry1 );
+ break;
+ case LISTACTION_CLEARING:
+ ActionClear();
+ ModelHasCleared(); //sic! wg. Kompatibilitaet!
+ break;
+ case LISTACTION_CLEARED:
+ break;
+ case LISTACTION_INVALIDATE_ENTRY:
+ // keine Action fuer die Basisklasse
+ ModelHasEntryInvalidated( pEntry1 );
+ break;
+ case LISTACTION_RESORTED:
+ bVisPositionsValid = FALSE;
+ break;
+ case LISTACTION_RESORTING:
+ break;
+ default:
+ DBG_ERROR("unknown ActionId");
+ }
+}
+
+void SvListView::InitViewData( SvViewData*, SvListEntry* )
+{
+}
+
+StringCompare SvTreeList::Compare( SvListEntry* pLeft, SvListEntry* pRight) const
+{
+ if( aCompareLink.IsSet())
+ {
+ SvSortData aSortData;
+ aSortData.pLeft = pLeft;
+ aSortData.pRight = pRight;
+ return (StringCompare)aCompareLink.Call( &aSortData );
+ }
+ return COMPARE_EQUAL;
+}
+
+void SvTreeList::Resort()
+{
+ Broadcast( LISTACTION_RESORTING );
+ bAbsPositionsValid = FALSE;
+ ResortChilds( pRootItem );
+ Broadcast( LISTACTION_RESORTED );
+}
+
+void SvTreeList::ResortChilds( SvListEntry* pParent )
+{
+ DBG_ASSERT(pParent,"Parent not set");
+ List* pChildList = pParent->pChilds;
+ if( !pChildList )
+ return;
+ List aList( *pChildList );
+ pChildList->Clear();
+
+ ULONG nCount = aList.Count();
+ for( ULONG nCur = 0; nCur < nCount; nCur++ )
+ {
+ SvListEntry* pCurEntry = (SvListEntry*)aList.GetObject( nCur );
+ ULONG nListPos = LIST_APPEND;
+ GetInsertionPos( pCurEntry, pParent, nListPos );
+ pChildList->Insert( pCurEntry, nListPos );
+ if( pCurEntry->pChilds )
+ ResortChilds( pCurEntry );
+ }
+ SetListPositions( (SvTreeEntryList*)pChildList );
+}
+
+void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent,
+ ULONG& rPos )
+{
+ DBG_ASSERT(pEntry,"No Entry")
+
+ if( eSortMode == SortNone )
+ return;
+
+ rPos = LIST_APPEND;
+ SvTreeEntryList* pChildList = GetChildList( pParent );
+
+ if( pChildList && pChildList->Count() )
+ {
+ long i = 0;
+ long j = pChildList->Count()-1;
+ long k;
+ StringCompare eCompare = COMPARE_GREATER;
+
+ do
+ {
+ k = (i+j)/2;
+ SvListEntry* pTempEntry = (SvListEntry*)(pChildList->GetObject(k));
+ eCompare = Compare( pEntry, pTempEntry );
+ if( eSortMode == SortDescending && eCompare != COMPARE_EQUAL )
+ {
+ if( eCompare == COMPARE_LESS )
+ eCompare = COMPARE_GREATER;
+ else
+ eCompare = COMPARE_LESS;
+ }
+ if( eCompare == COMPARE_GREATER )
+ i = k + 1;
+ else
+ j = k - 1;
+ } while( (eCompare != COMPARE_EQUAL) && (i <= j) );
+
+ if( eCompare != COMPARE_EQUAL )
+ {
+ if(i > ((long)pChildList->Count() - 1)) // nicht gefunden, Ende der Liste
+ rPos = LIST_APPEND;
+ else
+ rPos = i; // nicht gefunden, Mitte
+ }
+ else
+ rPos = k;
+ }
+}
+
+
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
new file mode 100644
index 000000000000..bc85863fb7b3
--- /dev/null
+++ b/svtools/source/control/calendar.cxx
@@ -0,0 +1,2963 @@
+/*************************************************************************
+ *
+ * $RCSfile: calendar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _TABLE_HXX
+#include <tools/table.hxx>
+#endif
+#ifndef _HELP_HXX
+#include <vcl/help.hxx>
+#endif
+#ifndef _MENU_HXX
+#include <vcl/menu.hxx>
+#endif
+#ifndef _DECOVIEW_HXX
+#include <vcl/decoview.hxx>
+#endif
+#ifndef _FLOATWIN_HXX
+#include <vcl/floatwin.hxx>
+#endif
+#ifndef _BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+
+#define _SV_CALENDAR_CXX
+#include <svtools.hrc>
+#include <svtdata.hxx>
+#include <calendar.hxx>
+
+// =======================================================================
+
+#define DAY_OFFX 4
+#define DAY_OFFY 2
+#define MONTH_BORDERX 4
+#define MONTH_OFFY 3
+#define WEEKNUMBER_OFFX 4
+#define WEEKDAY_OFFY 3
+#define TITLE_OFFY 3
+#define TITLE_BORDERY 2
+#define SPIN_OFFX 4
+#define SPIN_OFFY TITLE_BORDERY
+
+#define WEEKNUMBER_HEIGHT 85
+
+#define CALENDAR_HITTEST_DAY ((USHORT)0x0001)
+#define CALENDAR_HITTEST_WEEK ((USHORT)0x0002)
+#define CALENDAR_HITTEST_MONTHTITLE ((USHORT)0x0004)
+#define CALENDAR_HITTEST_PREV ((USHORT)0x0008)
+#define CALENDAR_HITTEST_NEXT ((USHORT)0x0010)
+#define CALENDAR_HITTEST_OUTSIDE ((USHORT)0x1000)
+
+#define MENU_YEAR_COUNT 3
+
+#define TABLE_DATE_SELECTED ((void*)0x00000001)
+
+// =======================================================================
+
+struct ImplDateInfo
+{
+ XubString maText;
+ Color* mpTextColor;
+ Color* mpFrameColor;
+ USHORT mnFlags;
+
+ ImplDateInfo( const XubString& rText ) :
+ maText( rText )
+ { mpTextColor = mpFrameColor = NULL; mnFlags = 0; }
+ ~ImplDateInfo() { delete mpTextColor; delete mpFrameColor; }
+};
+
+DECLARE_TABLE( ImplDateTable, ImplDateInfo* );
+
+// =======================================================================
+
+static void ImplCalendarSelectDate( Table* pTable, const Date& rDate, BOOL bSelect )
+{
+ if ( bSelect )
+ pTable->Insert( rDate.GetDate(), TABLE_DATE_SELECTED );
+ else
+ pTable->Remove( rDate.GetDate() );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalendarSelectDateRange( Table* pTable,
+ const Date& rStartDate,
+ const Date& rEndDate,
+ BOOL bSelect )
+{
+ Date aStartDate = rStartDate;
+ Date aEndDate = rEndDate;
+ if ( aStartDate > aEndDate )
+ {
+ Date aTempDate = aStartDate;
+ aStartDate = aEndDate;
+ aEndDate = aTempDate;
+ }
+
+ if ( bSelect )
+ {
+ while ( aStartDate <= aEndDate )
+ {
+ pTable->Insert( aStartDate.GetDate(), TABLE_DATE_SELECTED );
+ aStartDate++;
+ }
+ }
+ else
+ {
+ void* p = pTable->First();
+ while ( p )
+ {
+ Date aDate( pTable->GetCurKey() );
+ if ( aDate > aEndDate )
+ break;
+
+ if ( aDate >= aStartDate )
+ pTable->Remove( aDate.GetDate() );
+ else
+ p = pTable->Next();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalendarUnSelectDateRange( Table* pTable,
+ Table* pOldTable,
+ const Date& rStartDate,
+ const Date& rEndDate )
+{
+ Date aStartDate = rStartDate;
+ Date aEndDate = rEndDate;
+ if ( aStartDate > aEndDate )
+ {
+ Date aTempDate = aStartDate;
+ aStartDate = aEndDate;
+ aEndDate = aTempDate;
+ }
+
+ void* p = pTable->First();
+ while ( p )
+ {
+ Date aDate( pTable->GetCurKey() );
+ if ( aDate > aEndDate )
+ break;
+
+ if ( aDate >= aStartDate )
+ pTable->Remove( aDate.GetDate() );
+ else
+ p = pTable->Next();
+ }
+
+ p = pOldTable->First();
+ while ( p )
+ {
+ Date aDate( pOldTable->GetCurKey() );
+ if ( aDate > aEndDate )
+ break;
+ if ( aDate >= aStartDate )
+ pTable->Insert( aDate.GetDate(), TABLE_DATE_SELECTED );
+
+ p = pOldTable->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplCalendarClearSelectDate( Table* pTable )
+{
+ pTable->Clear();
+}
+
+// =======================================================================
+
+void Calendar::ImplInit( WinBits nWinStyle )
+{
+ mpDateTable = NULL;
+ mpSelectTable = new Table;
+ mpOldSelectTable = NULL;
+ mpRestoreSelectTable = NULL;
+ mpStandardColor = NULL;
+ mpSaturdayColor = NULL;
+ mpSundayColor = NULL;
+ mnDayCount = 0;
+ mnWinStyle = nWinStyle;
+ mnFirstYear = 0;
+ mnLastYear = 0;
+ mnRequestYear = 0;
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+ mbDrag = FALSE;
+ mbSelection = FALSE;
+ mbMultiSelection = FALSE;
+ mbWeekSel = FALSE;
+ mbUnSel = FALSE;
+ mbMenuDown = FALSE;
+ mbSpinDown = FALSE;
+ mbPrevIn = FALSE;
+ mbNextIn = FALSE;
+ mbDirect = FALSE;
+ mbInSelChange = FALSE;
+ mbTravelSelect = FALSE;
+ mbScrollDateRange = FALSE;
+ mbSelLeft = FALSE;
+ mbAllSel = FALSE;
+ mbDropPos = FALSE;
+ SetFirstDate( maCurDate );
+ ImplCalendarSelectDate( mpSelectTable, maCurDate, TRUE );
+
+ // Sonstige Strings erzeugen
+ maDayText = XubString( SvtResId( STR_SVT_CALENDAR_DAY ) );
+ maWeekText = XubString( SvtResId( STR_SVT_CALENDAR_WEEK ) );
+
+ // Tagestexte anlegen
+ for ( USHORT i = 0; i < 31; i++ )
+ mpDayText[i] = new UniString( UniString::CreateFromInt32( i+1 ) );
+
+ maDragScrollTimer.SetTimeoutHdl( STATIC_LINK( this, Calendar, ScrollHdl ) );
+ maDragScrollTimer.SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
+ mnDragScrollHitTest = 0;
+
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplInitSettings()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ maSelColor = rStyleSettings.GetHighlightTextColor();
+ SetPointFont( rStyleSettings.GetToolFont() );
+ SetTextColor( rStyleSettings.GetFieldTextColor() );
+ SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
+}
+
+// -----------------------------------------------------------------------
+
+Calendar::Calendar( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle & (WB_TABSTOP | WB_GROUP | WB_BORDER | WB_3DLOOK | WB_RANGESELECT | WB_MULTISELECT) ),
+ maIntn( Application::GetAppInternational() ),
+ maOldFormatFirstDate( 0, 0, 1900 ),
+ maOldFormatLastDate( 0, 0, 1900 ),
+ maFirstDate( 0, 0, 1900 ),
+ maOldFirstDate( 0, 0, 1900 ),
+ maOldCurDate( 0, 0, 1900 ),
+ maAnchorDate( maCurDate ),
+ maDropDate( 0, 0, 1900 )
+{
+ ImplInit( nWinStyle );
+}
+
+// -----------------------------------------------------------------------
+
+Calendar::Calendar( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId ),
+ maIntn( Application::GetAppInternational() ),
+ maOldFormatFirstDate( 0, 0, 1900 ),
+ maOldFormatLastDate( 0, 0, 1900 ),
+ maFirstDate( 0, 0, 1900 ),
+ maOldFirstDate( 0, 0, 1900 ),
+ maOldCurDate( 0, 0, 1900 ),
+ maAnchorDate( maCurDate ),
+ maDropDate( 0, 0, 1900 )
+{
+ ImplInit( rResId.aWinBits );
+}
+
+// -----------------------------------------------------------------------
+
+Calendar::~Calendar()
+{
+ delete mpStandardColor;
+ delete mpSaturdayColor;
+ delete mpSundayColor;
+
+ if ( mpDateTable )
+ {
+ ImplDateInfo* pDateInfo = mpDateTable->First();
+ while ( pDateInfo )
+ {
+ delete pDateInfo;
+ pDateInfo = mpDateTable->Next();
+ }
+
+ delete mpDateTable;
+ }
+
+ delete mpSelectTable;
+ if ( mpOldSelectTable )
+ delete mpOldSelectTable;
+ if ( mpRestoreSelectTable )
+ delete mpRestoreSelectTable;
+
+ for ( USHORT i = 0; i < 31; i++ )
+ delete mpDayText[i];
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplGetWeekFont( Font& rFont ) const
+{
+ // Wochennummer geben wir in WEEKNUMBER_HEIGHT%-Fonthoehe aus
+ Size aFontSize = rFont.GetSize();
+ aFontSize.Height() *= WEEKNUMBER_HEIGHT;
+ aFontSize.Height() /= 100;
+ rFont.SetSize( aFontSize );
+ rFont.SetWeight( WEIGHT_NORMAL );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplFormat()
+{
+ if ( !mbFormat )
+ return;
+
+ DayOfWeek eStartDay = maIntn.GetWeekStart();
+
+ if ( mbCalc )
+ {
+ Size aOutSize = GetOutputSizePixel();
+
+ if ( (aOutSize.Width() <= 1) || (aOutSize.Height() <= 1) )
+ return;
+
+ XubString a99Text( XubString( RTL_CONSTASCII_USTRINGPARAM( "99" ) ) );
+
+ Font aOldFont = GetFont();
+
+ // Wochenanzeige beruecksichtigen
+ if ( mnWinStyle & WB_WEEKNUMBER )
+ {
+ Font aTempFont = aOldFont;
+ ImplGetWeekFont( aTempFont );
+ SetFont( aTempFont );
+ mnWeekWidth = GetTextWidth( a99Text )+WEEKNUMBER_OFFX;
+ SetFont( aOldFont );
+ }
+ else
+ mnWeekWidth = 0;
+
+ if ( mnWinStyle & WB_BOLDTEXT )
+ {
+ Font aFont = aOldFont;
+ if ( aFont.GetWeight() < WEIGHT_BOLD )
+ aFont.SetWeight( WEIGHT_BOLD );
+ else
+ aFont.SetWeight( WEIGHT_NORMAL );
+ SetFont( aFont );
+ }
+
+ long n99TextWidth = GetTextWidth( a99Text );
+ long nTextHeight = GetTextHeight();
+
+ // Breiten und X-Positionen berechnen
+ mnDayWidth = n99TextWidth+DAY_OFFX;
+ mnMonthWidth = mnDayWidth*7;
+ mnMonthWidth += mnWeekWidth;
+ mnMonthWidth += MONTH_BORDERX*2;
+ mnMonthPerLine = aOutSize.Width() / mnMonthWidth;
+ if ( !mnMonthPerLine )
+ mnMonthPerLine = 1;
+ long nOver = ((aOutSize.Width()-(mnMonthPerLine*mnMonthWidth)) / mnMonthPerLine);
+ mnMonthWidth += nOver;
+ mnDaysOffX = MONTH_BORDERX;
+ mnDaysOffX += nOver/2;
+ mnDaysOffX += mnWeekWidth;
+
+ // Hoehen und Y-Positionen berechnen
+ mnDayHeight = nTextHeight + DAY_OFFY;
+ mnWeekDayOffY = nTextHeight + TITLE_OFFY + (TITLE_BORDERY*2);
+ mnDaysOffY = mnWeekDayOffY + nTextHeight + WEEKDAY_OFFY;
+ mnMonthHeight = (mnDayHeight*6) + mnDaysOffY;
+ mnMonthHeight += MONTH_OFFY;
+ mnLines = aOutSize.Height() / mnMonthHeight;
+ if ( !mnLines )
+ mnLines = 1;
+ mnMonthHeight += (aOutSize.Height()-(mnLines*mnMonthHeight)) / mnLines;
+
+ // Spinfelder berechnen
+ long nSpinSize = nTextHeight+TITLE_BORDERY-SPIN_OFFY;
+ maPrevRect.Left() = SPIN_OFFX;
+ maPrevRect.Top() = SPIN_OFFY;
+ maPrevRect.Right() = maPrevRect.Left()+nSpinSize;
+ maPrevRect.Bottom() = maPrevRect.Top()+nSpinSize;
+ maNextRect.Left() = aOutSize.Width()-SPIN_OFFX-nSpinSize-1;
+ maNextRect.Top() = SPIN_OFFY;
+ maNextRect.Right() = maNextRect.Left()+nSpinSize;
+ maNextRect.Bottom() = maNextRect.Top()+nSpinSize;
+
+ if ( mnWinStyle & WB_BOLDTEXT )
+ SetFont( aOldFont );
+
+ // DayOffWeekText berechnen (werden im schmalen Font ausgegeben)
+ maDayOfWeekText.Erase();
+ long nStartOffX = 0;
+ USHORT eDay = (USHORT)eStartDay;
+ for ( USHORT nDayOfWeek = 0; nDayOfWeek < 7; nDayOfWeek++ )
+ {
+ String aDayOfWeek( maIntn.GetAbbrevDayText( (DayOfWeek)eDay ).GetChar( 0 ) );
+ long nOffX = (mnDayWidth-GetTextWidth( aDayOfWeek ))/2;
+ if ( mnWinStyle & WB_BOLDTEXT )
+ nOffX++;
+ if ( !nDayOfWeek )
+ nStartOffX = nOffX;
+ else
+ nOffX -= nStartOffX;
+ nOffX += nDayOfWeek * mnDayWidth;
+ mnDayOfWeekAry[nDayOfWeek] = nOffX;
+ maDayOfWeekText += aDayOfWeek;
+ eDay++;
+ eDay %= 7;
+ }
+
+ mbCalc = FALSE;
+ }
+
+ // Anzahl Tage berechnen
+ USHORT nWeekDay;
+ Date aTempDate = GetFirstMonth();
+ maFirstDate = aTempDate;
+ nWeekDay = (USHORT)aTempDate.GetDayOfWeek();
+ nWeekDay = (nWeekDay+(7-(USHORT)eStartDay)) % 7;
+ maFirstDate -= (ULONG)nWeekDay;
+ mnDayCount = nWeekDay;
+ USHORT nDaysInMonth;
+ USHORT nMonthCount = (USHORT)(mnMonthPerLine*mnLines);
+ for ( USHORT i = 0; i < nMonthCount; i++ )
+ {
+ nDaysInMonth = aTempDate.GetDaysInMonth();
+ mnDayCount += nDaysInMonth;
+ aTempDate += nDaysInMonth;
+ }
+ Date aTempDate2 = aTempDate;
+ aTempDate2--;
+ nDaysInMonth = aTempDate2.GetDaysInMonth();
+ aTempDate2 -= nDaysInMonth-1;
+ nWeekDay = (USHORT)aTempDate2.GetDayOfWeek();
+ nWeekDay = (nWeekDay+(7-(USHORT)eStartDay)) % 7;
+ mnDayCount += 42-nDaysInMonth-nWeekDay;
+
+ // Farben festlegen
+ maOtherColor = Color( COL_LIGHTGRAY );
+ if ( maOtherColor.IsRGBEqual( GetBackground().GetColor() ) )
+ maOtherColor.SetColor( COL_GRAY );
+
+ Date aLastDate = GetLastDate();
+ if ( (maOldFormatLastDate != aLastDate) ||
+ (maOldFormatFirstDate != maFirstDate) )
+ {
+ maOldFormatFirstDate = maFirstDate;
+ maOldFormatLastDate = aLastDate;
+ DateRangeChanged();
+ }
+
+ // DateInfo besorgen
+ USHORT nNewFirstYear = maFirstDate.GetYear();
+ USHORT nNewLastYear = GetLastDate().GetYear();
+ if ( mnFirstYear )
+ {
+ if ( nNewFirstYear < mnFirstYear )
+ {
+ for ( mnRequestYear = nNewFirstYear; mnRequestYear < mnFirstYear; mnRequestYear++ )
+ RequestDateInfo();
+ mnFirstYear = nNewFirstYear;
+ }
+ if ( nNewLastYear > mnLastYear )
+ {
+ for ( mnRequestYear = mnLastYear; mnRequestYear < nNewLastYear; mnRequestYear++ )
+ RequestDateInfo();
+ mnLastYear = nNewLastYear;
+ }
+ }
+ else
+ {
+ for ( mnRequestYear = nNewFirstYear; mnRequestYear < nNewLastYear; mnRequestYear++ )
+ RequestDateInfo();
+ mnFirstYear = nNewFirstYear;
+ mnLastYear = nNewLastYear;
+ }
+ mnRequestYear = 0;
+
+ mbFormat = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Calendar::ImplHitTest( const Point& rPos, Date& rDate ) const
+{
+ if ( mbFormat )
+ return 0;
+
+ if ( maPrevRect.IsInside( rPos ) )
+ return CALENDAR_HITTEST_PREV;
+ else if ( maNextRect.IsInside( rPos ) )
+ return CALENDAR_HITTEST_NEXT;
+
+ long nX;
+ long nY;
+ long nOffX;
+ long nYMonth;
+ USHORT nDay;
+ DayOfWeek eStartDay = maIntn.GetWeekStart();
+
+ rDate = GetFirstMonth();
+ nY = 0;
+ for ( long i = 0; i < mnLines; i++ )
+ {
+ if ( rPos.Y() < nY )
+ return 0;
+
+ nX = 0;
+ nYMonth = nY+mnMonthHeight;
+ for ( long j = 0; j < mnMonthPerLine; j++ )
+ {
+ if ( (rPos.X() < nX) && (rPos.Y() < nYMonth) )
+ return 0;
+
+ USHORT nDaysInMonth = rDate.GetDaysInMonth();
+
+ // Entsprechender Monat gefunden
+ if ( (rPos.X() > nX) && (rPos.Y() < nYMonth) &&
+ (rPos.X() < nX+mnMonthWidth) )
+ {
+ if ( rPos.Y() < (nY+(TITLE_BORDERY*2)+mnDayHeight))
+ return CALENDAR_HITTEST_MONTHTITLE;
+ else
+ {
+ long nDayX = nX+mnDaysOffX;
+ long nDayY = nY+mnDaysOffY;
+ if ( rPos.Y() < nDayY )
+ return 0;
+ USHORT nDayIndex = (USHORT)rDate.GetDayOfWeek();
+ nDayIndex = (nDayIndex+(7-(USHORT)eStartDay)) % 7;
+ if ( (i == 0) && (j == 0) )
+ {
+ Date aTempDate = rDate;
+ aTempDate -= nDayIndex;
+ for ( nDay = 0; nDay < nDayIndex; nDay++ )
+ {
+ nOffX = nDayX + (nDay*mnDayWidth);
+ if ( (rPos.Y() >= nDayY) && (rPos.Y() < nDayY+mnDayHeight) &&
+ (rPos.X() >= nOffX) && (rPos.X() < nOffX+mnDayWidth) )
+ {
+ rDate = aTempDate;
+ rDate += nDay;
+ return CALENDAR_HITTEST_DAY;
+ }
+ }
+ }
+ for ( nDay = 1; nDay <= nDaysInMonth; nDay++ )
+ {
+ if ( rPos.Y() < nDayY )
+ {
+ rDate += nDayIndex;
+ return 0;
+ }
+ nOffX = nDayX + (nDayIndex*mnDayWidth);
+ if ( (rPos.Y() >= nDayY) && (rPos.Y() < nDayY+mnDayHeight) &&
+ (rPos.X() >= nOffX) && (rPos.X() < nOffX+mnDayWidth) )
+ {
+ rDate += nDay-1;
+ return CALENDAR_HITTEST_DAY;
+ }
+ if ( nDayIndex == 6 )
+ {
+ nDayIndex = 0;
+ nDayY += mnDayHeight;
+ }
+ else
+ nDayIndex++;
+ }
+ if ( (i == mnLines-1) && (j == mnMonthPerLine-1) )
+ {
+ USHORT nWeekDay = (USHORT)rDate.GetDayOfWeek();
+ nWeekDay = (nWeekDay+(7-(USHORT)eStartDay)) % 7;
+ USHORT nDayCount = 42-nDaysInMonth-nWeekDay;
+ Date aTempDate = rDate;
+ aTempDate += nDaysInMonth;
+ for ( nDay = 1; nDay <= nDayCount; nDay++ )
+ {
+ if ( rPos.Y() < nDayY )
+ {
+ rDate += nDayIndex;
+ return 0;
+ }
+ nOffX = nDayX + (nDayIndex*mnDayWidth);
+ if ( (rPos.Y() >= nDayY) && (rPos.Y() < nDayY+mnDayHeight) &&
+ (rPos.X() >= nOffX) && (rPos.X() < nOffX+mnDayWidth) )
+ {
+ rDate = aTempDate;
+ rDate += nDay-1;
+ return CALENDAR_HITTEST_DAY;
+ }
+ if ( nDayIndex == 6 )
+ {
+ nDayIndex = 0;
+ nDayY += mnDayHeight;
+ }
+ else
+ nDayIndex++;
+ }
+ }
+ }
+ }
+
+ rDate += nDaysInMonth;
+ nX += mnMonthWidth;
+ }
+
+ nY += mnMonthHeight;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawSpinArrow( OutputDevice* pDev, const Rectangle& rRect,
+ BOOL bPrev )
+{
+ long i;
+ long n;
+ long nLines;
+ long nHeight = rRect.GetHeight();
+ long nWidth = rRect.GetWidth();
+ if ( nWidth < nHeight )
+ n = nWidth;
+ else
+ n = nHeight;
+ if ( !(n & 0x01) )
+ n--;
+ nLines = n/2;
+
+ Rectangle aRect( Point( rRect.Left()+(nWidth/2)-(nLines/2),
+ rRect.Top()+(nHeight/2) ),
+ Size( 1, 1 ) );
+ if ( !bPrev )
+ {
+ aRect.Left() += nLines;
+ aRect.Right() += nLines;
+ }
+
+ pDev->DrawRect( aRect );
+ for ( i = 0; i < nLines; i++ )
+ {
+ if ( bPrev )
+ {
+ aRect.Left()++;
+ aRect.Right()++;
+ }
+ else
+ {
+ aRect.Left()--;
+ aRect.Right()--;
+ }
+ aRect.Top()--;
+ aRect.Bottom()++;
+ pDev->DrawRect( aRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplDrawSpin( BOOL bDrawPrev, BOOL bDrawNext )
+{
+ if ( !bDrawPrev && !bDrawNext )
+ return;
+
+ SetLineColor();
+ SetFillColor( GetSettings().GetStyleSettings().GetButtonTextColor() );
+ if ( bDrawPrev )
+ {
+ Rectangle aOutRect = maPrevRect;
+ aOutRect.Left() += 3;
+ aOutRect.Top() += 3;
+ aOutRect.Right() -= 3;
+ aOutRect.Bottom() -= 3;
+ ImplDrawSpinArrow( this, aOutRect, TRUE );
+ }
+ if ( bDrawNext )
+ {
+ Rectangle aOutRect = maNextRect;
+ aOutRect.Left() += 3;
+ aOutRect.Top() += 3;
+ aOutRect.Right() -= 3;
+ aOutRect.Bottom() -= 3;
+ ImplDrawSpinArrow( this, aOutRect, FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplDrawDate( long nX, long nY,
+ USHORT nDay, USHORT nMonth, USHORT nYear,
+ DayOfWeek eDayOfWeek,
+ BOOL bBack, BOOL bOther, ULONG nToday )
+{
+ ImplDateInfo* pDateInfo;
+ Color* pTextColor = NULL;
+ const String& rDay = *(mpDayText[nDay-1]);
+ Rectangle aDateRect( nX, nY, nX+mnDayWidth-1, nY+mnDayHeight-1 );
+
+ BOOL bSel = FALSE;
+ BOOL bFocus = FALSE;
+ // Aktueller Tag
+ if ( (nDay == maCurDate.GetDay()) &&
+ (nMonth == maCurDate.GetMonth()) &&
+ (nYear == maCurDate.GetYear()) )
+ bFocus = TRUE;
+ if ( mpSelectTable )
+ {
+ if ( mpSelectTable->IsKeyValid( Date( nDay, nMonth, nYear ).GetDate() ) )
+ bSel = TRUE;
+ }
+
+ // Dateinfo ermitteln
+ if ( mpDateTable )
+ {
+ pDateInfo = mpDateTable->Get( Date( nDay, nMonth, nYear ).GetDate() );
+ if ( !pDateInfo )
+ pDateInfo = mpDateTable->Get( Date( nDay, nMonth, 0 ).GetDate() );
+ }
+ else
+ pDateInfo = NULL;
+
+ // Textfarbe ermitteln
+ if ( bSel )
+ pTextColor = &maSelColor;
+ else if ( bOther )
+ pTextColor = &maOtherColor;
+ else
+ {
+ if ( pDateInfo && pDateInfo->mpTextColor )
+ pTextColor = pDateInfo->mpTextColor;
+ else
+ {
+ if ( eDayOfWeek == SATURDAY )
+ pTextColor = mpSaturdayColor;
+ else if ( eDayOfWeek == SUNDAY )
+ pTextColor = mpSundayColor;
+ if ( !pTextColor )
+ pTextColor = mpStandardColor;
+ }
+ }
+
+ if ( bFocus )
+ HideFocus();
+
+ // Font ermitteln
+ Font aOldFont = GetFont();
+ BOOL bBoldFont = FALSE;
+ if ( (mnWinStyle & WB_BOLDTEXT) &&
+ pDateInfo && (pDateInfo->mnFlags & DIB_BOLD) )
+ {
+ bBoldFont = TRUE;
+ Font aFont = aOldFont;
+ if ( aFont.GetWeight() < WEIGHT_BOLD )
+ aFont.SetWeight( WEIGHT_BOLD );
+ else
+ aFont.SetWeight( WEIGHT_NORMAL );
+ SetFont( aFont );
+ }
+
+ // Hintergrund ausgeben
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( bSel || bBack )
+ {
+ if ( bSel )
+ {
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( aDateRect );
+ }
+ else
+ Erase( aDateRect );
+ }
+
+ // Text ausgeben
+ long nTextX = nX+(mnDayWidth-GetTextWidth( rDay ))-(DAY_OFFX/2);
+ long nTextY = nY+(mnDayHeight-GetTextHeight())/2;
+ if ( pTextColor )
+ {
+ Color aOldColor = GetTextColor();
+ SetTextColor( *pTextColor );
+ DrawText( Point( nTextX, nTextY ), rDay );
+ SetTextColor( aOldColor );
+ }
+ else
+ DrawText( Point( nTextX, nTextY ), rDay );
+
+ // Heute
+ Date aTodayDate( maCurDate );
+ if ( nToday )
+ aTodayDate.SetDate( nToday );
+ else
+ aTodayDate = Date();
+ if ( (nDay == aTodayDate.GetDay()) &&
+ (nMonth == aTodayDate.GetMonth()) &&
+ (nYear == aTodayDate.GetYear()) )
+ {
+ SetLineColor( rStyleSettings.GetWindowTextColor() );
+ SetFillColor();
+ DrawRect( aDateRect );
+ }
+
+ // Evt. DateInfo ausgeben
+ if ( (mnWinStyle & WB_FRAMEINFO) && pDateInfo && pDateInfo->mpFrameColor )
+ {
+ SetLineColor( *(pDateInfo->mpFrameColor) );
+ SetFillColor();
+ Rectangle aFrameRect( aDateRect );
+ aFrameRect.Left()++;
+ aFrameRect.Top()++;
+ long nFrameWidth = aFrameRect.GetWidth();
+ long nFrameHeight = aFrameRect.GetHeight();
+ long nFrameOff;
+ if ( nFrameWidth < nFrameHeight )
+ {
+ nFrameOff = nFrameHeight-nFrameWidth;
+ aFrameRect.Top() += nFrameOff/2;
+ nFrameOff %= 2;
+ aFrameRect.Bottom() -= nFrameOff;
+ }
+ else if ( nFrameWidth > nFrameHeight )
+ {
+ nFrameOff = nFrameWidth-nFrameHeight;
+ aFrameRect.Left() += nFrameOff/2;
+ nFrameOff %= 2;
+ aFrameRect.Right() -= nFrameOff;
+ }
+ DrawEllipse( aFrameRect );
+ }
+
+ // Evt. noch FocusRect
+ if ( bFocus && HasFocus() )
+ ShowFocus( aDateRect );
+
+ if( mbDropPos && maDropDate == Date( nDay, nMonth, nYear ) )
+ ImplInvertDropPos();
+
+ if ( bBoldFont )
+ SetFont( aOldFont );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplDraw( BOOL bPaint )
+{
+ ImplFormat();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Size aOutSize = GetOutputSizePixel();
+ long i;
+ long j;
+ long nX;
+ long nY;
+ long nOffX;
+ long nOffY;
+ long nDayX;
+ long nDayY;
+ ULONG nToday = Date().GetDate();
+ USHORT nDay;
+ USHORT nMonth;
+ USHORT nYear;
+ Date aDate = GetFirstMonth();
+ DayOfWeek eStartDay = maIntn.GetWeekStart();
+
+ HideFocus();
+
+ nY = 0;
+ for ( i = 0; i < mnLines; i++ )
+ {
+ // Titleleiste ausgeben
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetFaceColor() );
+ Rectangle aTitleRect( 0, nY, aOutSize.Width()-1, nY+mnDayHeight-DAY_OFFY+TITLE_BORDERY*2 );
+ if ( !bPaint )
+ {
+ Rectangle aTempRect( 1, aTitleRect.Top()+TITLE_BORDERY,
+ aOutSize.Width()-2,
+ aTitleRect.Bottom()-TITLE_BORDERY );
+ if ( !i )
+ {
+ aTempRect.Left() = maPrevRect.Right()+1;
+ aTempRect.Right() = maNextRect.Left()-1;
+ }
+ DrawRect( aTempRect );
+ }
+ else
+ {
+ DrawRect( aTitleRect );
+ Point aTopLeft1( aTitleRect.Left(), aTitleRect.Top() );
+ Point aTopLeft2( aTitleRect.Left(), aTitleRect.Top()+1 );
+ Point aBottomRight1( aTitleRect.Right(), aTitleRect.Bottom() );
+ Point aBottomRight2( aTitleRect.Right(), aTitleRect.Bottom()-1 );
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ DrawLine( aTopLeft1, Point( aBottomRight1.X(), aTopLeft1.Y() ) );
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( aTopLeft2, Point( aBottomRight2.X(), aTopLeft2.Y() ) );
+ DrawLine( aTopLeft2, Point( aTopLeft2.X(), aBottomRight2.Y() ) );
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( aTopLeft2.X(), aBottomRight2.Y() ), aBottomRight2 );
+ DrawLine( Point( aBottomRight2.X(), aTopLeft2.Y() ), aBottomRight2 );
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ DrawLine( Point( aTopLeft1.X(), aBottomRight1.Y() ), aBottomRight1 );
+ }
+ Point aSepPos1( 0, aTitleRect.Top()+TITLE_BORDERY );
+ Point aSepPos2( 0, aTitleRect.Bottom()-TITLE_BORDERY );
+ for ( j = 0; j < mnMonthPerLine-1; j++ )
+ {
+ aSepPos1.X() += mnMonthWidth-1;
+ aSepPos2.X() = aSepPos1.X();
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( aSepPos1, aSepPos2 );
+ aSepPos1.X()++;
+ aSepPos2.X() = aSepPos1.X();
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( aSepPos1, aSepPos2 );
+ }
+
+ nX = 0;
+ for ( j = 0; j < mnMonthPerLine; j++ )
+ {
+ nMonth = aDate.GetMonth();
+ nYear = aDate.GetYear();
+
+ // Monat in der Titleleiste ausgeben
+ nOffX = nX;
+ nOffY = nY+TITLE_BORDERY;
+ String aMonthText( maIntn.GetMonthText( nMonth ) );
+ aMonthText += ' ';
+ aMonthText += nYear;
+ long nMonthTextWidth = GetTextWidth( aMonthText );
+ long nMonthOffX1 = 0;
+ long nMonthOffX2 = 0;
+ if ( i == 0 )
+ {
+ if ( j == 0 )
+ nMonthOffX1 = maPrevRect.Right()+1;
+ if ( j == mnMonthPerLine-1 )
+ nMonthOffX2 = aOutSize.Width()-maNextRect.Left()+1;
+ }
+ long nMaxMonthWidth = mnMonthWidth-nMonthOffX1-nMonthOffX2-4;
+ if ( nMonthTextWidth > nMaxMonthWidth )
+ {
+ aMonthText = maIntn.GetAbbrevMonthText( nMonth );
+ aMonthText += ' ';
+ aMonthText += nYear;
+ nMonthTextWidth = GetTextWidth( aMonthText );
+ }
+ long nTempOff = (mnMonthWidth-nMonthTextWidth+1)/2;
+ if ( nTempOff < nMonthOffX1 )
+ nOffX += nMonthOffX1+1;
+ else
+ {
+ if ( nTempOff+nMonthTextWidth > mnMonthWidth-nMonthOffX2 )
+ nOffX += mnMonthWidth-nMonthOffX2-nMonthTextWidth;
+ else
+ nOffX += nTempOff;
+ }
+ SetTextColor( rStyleSettings.GetButtonTextColor() );
+ DrawText( Point( nOffX, nOffY ), aMonthText );
+ SetTextColor( rStyleSettings.GetWindowTextColor() );
+
+ // Weekleiste ausgeben
+ if ( bPaint )
+ {
+ nDayX = nX+mnDaysOffX;
+ nDayY = nY+mnWeekDayOffY;
+ nOffY = nDayY + mnDayHeight;
+ SetLineColor( rStyleSettings.GetWindowTextColor() );
+ Point aStartPos( nDayX, nOffY );
+ if ( mnWinStyle & WB_WEEKNUMBER )
+ aStartPos.X() -= WEEKNUMBER_OFFX-2;
+ DrawLine( aStartPos, Point( nDayX+(7*mnDayWidth), nOffY ) );
+ DrawTextArray( Point( nDayX+mnDayOfWeekAry[0], nDayY ), maDayOfWeekText, &(mnDayOfWeekAry[1]) );
+ }
+
+ // Week-Numbers ausgeben
+ if ( mnWinStyle & WB_WEEKNUMBER )
+ {
+ nDayX = nX+mnDaysOffX;
+ nDayY = nY+mnWeekDayOffY;
+ nOffY = nDayY + mnDayHeight;
+ long nMonthHeight = mnDayHeight*6;
+ if ( bPaint )
+ DrawLine( Point( nDayX-WEEKNUMBER_OFFX+2, nOffY ), Point( nDayX-WEEKNUMBER_OFFX+2, nOffY+nMonthHeight ) );
+ else
+ Erase( Rectangle( nDayX-mnWeekWidth-WEEKNUMBER_OFFX, nOffY, nDayX-WEEKNUMBER_OFFX-1, nOffY+nMonthHeight ) );
+
+ Font aOldFont = GetFont();
+ Font aTempFont = aOldFont;
+ ImplGetWeekFont( aTempFont );
+ SetFont( aTempFont );
+ nDayX -= mnWeekWidth;
+ nDayY = nY+mnDaysOffY;
+ Date aTempDate = aDate;
+ for ( USHORT nWeekCount = 0; nWeekCount < 6; nWeekCount++ )
+ {
+ String aWeekText( aTempDate.GetWeekOfYear( eStartDay, maIntn.GetWeekCountStart() ) );
+ long nOffX = (mnWeekWidth-WEEKNUMBER_OFFX)-GetTextWidth( aWeekText );
+ long nOffY = (mnDayHeight-GetTextHeight())/2;
+ DrawText( Point( nDayX+nOffX, nDayY+nOffY ), aWeekText );
+ nDayY += mnDayHeight;
+ aTempDate += 7;
+ }
+ SetFont( aOldFont );
+ }
+
+ // Tage ausgeben
+ USHORT nDaysInMonth = aDate.GetDaysInMonth();
+ nDayX = nX+mnDaysOffX;
+ nDayY = nY+mnDaysOffY;
+ if ( !bPaint )
+ {
+ Rectangle aClearRect( nDayX, nDayY,
+ nDayX+(7*mnDayWidth)-1, nDayY+(6*mnDayHeight)-1 );
+ Erase( aClearRect );
+ }
+ USHORT nDayIndex = (USHORT)aDate.GetDayOfWeek();
+ nDayIndex = (nDayIndex+(7-(USHORT)eStartDay)) % 7;
+ if ( (i == 0) && (j == 0) )
+ {
+ Date aTempDate = aDate;
+ aTempDate -= nDayIndex;
+ for ( nDay = 0; nDay < nDayIndex; nDay++ )
+ {
+ nOffX = nDayX + (nDay*mnDayWidth);
+ ImplDrawDate( nOffX, nDayY, nDay+aTempDate.GetDay(),
+ aTempDate.GetMonth(), aTempDate.GetYear(),
+ (DayOfWeek)((nDay+(USHORT)eStartDay)%7), FALSE, TRUE, nToday );
+ }
+ }
+ for ( nDay = 1; nDay <= nDaysInMonth; nDay++ )
+ {
+ nOffX = nDayX + (nDayIndex*mnDayWidth);
+ ImplDrawDate( nOffX, nDayY, nDay, nMonth, nYear,
+ (DayOfWeek)((nDayIndex+(USHORT)eStartDay)%7),
+ FALSE, FALSE, nToday );
+ if ( nDayIndex == 6 )
+ {
+ nDayIndex = 0;
+ nDayY += mnDayHeight;
+ }
+ else
+ nDayIndex++;
+ }
+ if ( (i == mnLines-1) && (j == mnMonthPerLine-1) )
+ {
+ USHORT nWeekDay = (USHORT)aDate.GetDayOfWeek();
+ nWeekDay = (nWeekDay+(7-(USHORT)eStartDay)) % 7;
+ USHORT nDayCount = 42-nDaysInMonth-nWeekDay;
+ Date aTempDate = aDate;
+ aTempDate += nDaysInMonth;
+ for ( nDay = 1; nDay <= nDayCount; nDay++ )
+ {
+ nOffX = nDayX + (nDayIndex*mnDayWidth);
+ ImplDrawDate( nOffX, nDayY, nDay,
+ aTempDate.GetMonth(), aTempDate.GetYear(),
+ (DayOfWeek)((nDayIndex+(USHORT)eStartDay)%7),
+ FALSE, TRUE, nToday );
+ if ( nDayIndex == 6 )
+ {
+ nDayIndex = 0;
+ nDayY += mnDayHeight;
+ }
+ else
+ nDayIndex++;
+ }
+ }
+
+ aDate += nDaysInMonth;
+ nX += mnMonthWidth;
+ }
+
+ nY += mnMonthHeight;
+ }
+
+ // Spin-Buttons zeichnen
+ if ( bPaint )
+ ImplDrawSpin();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplUpdateDate( const Date& rDate )
+{
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ Rectangle aDateRect( GetDateRect( rDate ) );
+ if ( !aDateRect.IsEmpty() )
+ {
+ BOOL bOther = (rDate < GetFirstMonth()) || (rDate > GetLastMonth());
+ ImplDrawDate( aDateRect.Left(), aDateRect.Top(),
+ rDate.GetDay(), rDate.GetMonth(), rDate.GetYear(),
+ rDate.GetDayOfWeek(), TRUE, bOther );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplUpdateSelection( Table* pOld )
+{
+ Table* pNew = mpSelectTable;
+ void* p;
+ ULONG nKey;
+
+ p = pOld->First();
+ while ( p )
+ {
+ nKey = pOld->GetCurKey();
+ if ( !pNew->Get( nKey ) )
+ {
+ Date aTempDate( nKey );
+ ImplUpdateDate( aTempDate );
+ }
+
+ p = pOld->Next();
+ }
+
+ p = pNew->First();
+ while ( p )
+ {
+ nKey = pNew->GetCurKey();
+ if ( !pOld->Get( nKey ) )
+ {
+ Date aTempDate( nKey );
+ ImplUpdateDate( aTempDate );
+ }
+
+ p = pNew->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplMouseSelect( const Date& rDate, USHORT nHitTest,
+ BOOL bMove, BOOL bExpand, BOOL bExtended )
+{
+ Table* pOldSel = new Table( *mpSelectTable );
+ Date aOldDate = maCurDate;
+ Date aTempDate = rDate;
+
+ if ( !(nHitTest & CALENDAR_HITTEST_DAY) )
+ aTempDate--;
+
+ if ( mbMultiSelection )
+ {
+ maCurDate = aTempDate;
+ mbSelLeft = aTempDate < maAnchorDate;
+
+ if ( bMove )
+ {
+ if ( mbSelLeft )
+ {
+ ImplCalendarUnSelectDateRange( mpSelectTable, mpRestoreSelectTable, Date( 1, 1, 0 ), aTempDate );
+ ImplCalendarUnSelectDateRange( mpSelectTable, mpRestoreSelectTable, maAnchorDate, Date( 31, 12, 9999 ) );
+ }
+ else
+ {
+ ImplCalendarUnSelectDateRange( mpSelectTable, mpRestoreSelectTable, Date( 1, 1, 0 ), maAnchorDate );
+ ImplCalendarUnSelectDateRange( mpSelectTable, mpRestoreSelectTable, aTempDate, Date( 31, 12, 9999 ) );
+ }
+ ImplCalendarSelectDateRange( mpSelectTable, aTempDate, maAnchorDate, !mbUnSel );
+ }
+ else
+ {
+ if ( bExpand )
+ {
+ if ( !bExtended )
+ {
+ if ( mbSelLeft )
+ {
+ ImplCalendarSelectDateRange( mpSelectTable, Date( 1, 1, 0 ), aTempDate, FALSE );
+ ImplCalendarSelectDateRange( mpSelectTable, maAnchorDate, Date( 31, 12, 9999 ), FALSE );
+ }
+ else
+ {
+ ImplCalendarSelectDateRange( mpSelectTable, Date( 1, 1, 0 ), maAnchorDate, FALSE );
+ ImplCalendarSelectDateRange( mpSelectTable, aTempDate, Date( 31, 12, 9999 ), FALSE );
+ }
+ }
+ ImplCalendarSelectDateRange( mpSelectTable, aTempDate, maAnchorDate, TRUE );
+ }
+ else if ( bExtended && !(mnWinStyle & WB_RANGESELECT) )
+ {
+ maAnchorDate = aTempDate;
+ if ( IsDateSelected( aTempDate ) )
+ {
+ mbUnSel = TRUE;
+ ImplCalendarSelectDate( mpSelectTable, aTempDate, FALSE );
+ }
+ else
+ {
+ ImplCalendarSelectDate( mpSelectTable, aTempDate, TRUE );
+ }
+ }
+ else
+ {
+ maAnchorDate = aTempDate;
+ ImplCalendarClearSelectDate( mpSelectTable );
+ ImplCalendarSelectDate( mpSelectTable, aTempDate, TRUE );
+ }
+
+ mpRestoreSelectTable = new Table( *mpSelectTable );
+ }
+ }
+ else
+ {
+ if ( aTempDate < maCurDate )
+ mbSelLeft = TRUE;
+ else
+ mbSelLeft = FALSE;
+ if ( !(nHitTest & CALENDAR_HITTEST_DAY) )
+ aTempDate = maOldCurDate;
+ if ( !bMove )
+ maAnchorDate = aTempDate;
+ if ( aTempDate != maCurDate )
+ {
+ maCurDate = aTempDate;
+ ImplCalendarSelectDate( mpSelectTable, aOldDate, FALSE );
+ ImplCalendarSelectDate( mpSelectTable, maCurDate, TRUE );
+ }
+ }
+
+ BOOL bNewSel = *pOldSel != *mpSelectTable;
+ if ( (maCurDate != aOldDate) || bNewSel )
+ {
+ if ( bNewSel )
+ {
+ mbInSelChange = TRUE;
+ SelectionChanging();
+ mbInSelChange = FALSE;
+ }
+ HideFocus();
+ if ( bNewSel )
+ ImplUpdateSelection( pOldSel );
+ if ( !bNewSel || !pOldSel->Get( aOldDate.GetDate() ) )
+ ImplUpdateDate( aOldDate );
+ // Damit Focus-Rechteck auch wieder neu ausgegeben wird
+ if ( HasFocus() || !bNewSel || !mpSelectTable->Get( maCurDate.GetDate() ) )
+ ImplUpdateDate( maCurDate );
+ }
+ delete pOldSel;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplUpdate( BOOL bCalcNew )
+{
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( bCalcNew && !mbCalc )
+ Invalidate();
+ else if ( !mbFormat && !mbCalc )
+ {
+ if ( mbDirect )
+ {
+ mbFormat = TRUE;
+ ImplDraw( FALSE );
+ return;
+ }
+ else
+ Invalidate();
+ }
+ }
+
+ if ( bCalcNew )
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplInvertDropPos()
+{
+ Rectangle aRect = GetDateRect( maDropDate );//this is one Pixel to width and one to heigh
+ aRect.Bottom() = aRect.Top()+mnDayHeight-1;
+ aRect.Right() = aRect.Left()+mnDayWidth-1;
+ Invert( aRect );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplScroll( BOOL bPrev )
+{
+ Date aNewFirstMonth = GetFirstMonth();
+ if ( bPrev )
+ {
+ aNewFirstMonth--;
+ aNewFirstMonth -= aNewFirstMonth.GetDaysInMonth()-1;
+ }
+ else
+ aNewFirstMonth += aNewFirstMonth.GetDaysInMonth();
+ mbDirect = TRUE;
+ SetFirstDate( aNewFirstMonth );
+ mbDirect = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplShowMenu( const Point& rPos, const Date& rDate )
+{
+ EndSelection();
+
+ Date aOldFirstDate = GetFirstMonth();
+ PopupMenu aPopupMenu;
+ PopupMenu* pYearPopupMenus[MENU_YEAR_COUNT];
+ USHORT nMonthOff;
+ USHORT nCurItemId;
+ USHORT nYear = rDate.GetYear()-1;
+ USHORT i;
+ USHORT j;
+ USHORT nYearIdCount = 1000;
+
+ nMonthOff = (rDate.GetYear()-aOldFirstDate.GetYear())*12;
+ if ( aOldFirstDate.GetMonth() < rDate.GetMonth() )
+ nMonthOff += rDate.GetMonth()-aOldFirstDate.GetMonth();
+ else
+ nMonthOff -= aOldFirstDate.GetMonth()-rDate.GetMonth();
+
+ // Menu aufbauen (Jahre mit verschiedenen Monaten aufnehmen)
+ for ( i = 0; i < MENU_YEAR_COUNT; i++ )
+ {
+ pYearPopupMenus[i] = new PopupMenu;
+ for ( j = 1; j <= 12; j++ )
+ pYearPopupMenus[i]->InsertItem( nYearIdCount+j, maIntn.GetMonthText( j ) );
+ aPopupMenu.InsertItem( 10+i, UniString::CreateFromInt32( nYear+i ) );
+ aPopupMenu.SetPopupMenu( 10+i, pYearPopupMenus[i] );
+ nYearIdCount += 1000;
+ }
+
+ mbMenuDown = TRUE;
+ nCurItemId = aPopupMenu.Execute( this, rPos );
+ mbMenuDown = FALSE;
+
+ // Menu zerstoeren
+ aPopupMenu.SetPopupMenu( 2, NULL );
+ for ( i = 0; i < MENU_YEAR_COUNT; i++ )
+ {
+ aPopupMenu.SetPopupMenu( 10+i, NULL );
+ delete pYearPopupMenus[i];
+ }
+
+ if ( nCurItemId )
+ {
+ USHORT nTempMonthOff = nMonthOff % 12;
+ USHORT nTempYearOff = nMonthOff / 12;
+ USHORT nNewMonth = nCurItemId % 1000;
+ USHORT nNewYear = nYear+((nCurItemId-1000)/1000);
+ if ( nTempMonthOff < nNewMonth )
+ nNewMonth -= nTempMonthOff;
+ else
+ {
+ nNewYear--;
+ nNewMonth = 12-(nTempMonthOff-nNewMonth);
+ }
+ nNewYear -= nTempYearOff;
+ SetFirstDate( Date( 1, nNewMonth, nNewYear ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplTracking( const Point& rPos, BOOL bRepeat )
+{
+ Date aTempDate = maCurDate;
+ USHORT nHitTest = ImplHitTest( rPos, aTempDate );
+
+ if ( mbSpinDown )
+ {
+ mbPrevIn = (nHitTest & CALENDAR_HITTEST_PREV) != 0;
+ mbNextIn = (nHitTest & CALENDAR_HITTEST_NEXT) != 0;
+
+ if ( bRepeat && (mbPrevIn || mbNextIn) )
+ {
+ mbScrollDateRange = TRUE;
+ ImplScroll( mbPrevIn );
+ mbScrollDateRange = FALSE;
+ }
+ }
+ else
+ ImplMouseSelect( aTempDate, nHitTest, TRUE, FALSE, FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ImplEndTracking( const Point& rPos, BOOL bCancel )
+{
+ BOOL bSelection = mbSelection;
+ BOOL bSpinDown = mbSpinDown;
+
+ mbDrag = FALSE;
+ mbSelection = FALSE;
+ mbMultiSelection = FALSE;
+ mbUnSel = FALSE;
+ mbSpinDown = FALSE;
+ mbPrevIn = FALSE;
+ mbNextIn = FALSE;
+
+ if ( bCancel )
+ {
+ if ( maOldFirstDate != maFirstDate )
+ SetFirstDate( maOldFirstDate );
+
+ if ( !bSpinDown )
+ {
+ Table* pOldSel = new Table( *mpSelectTable );
+ Date aOldDate = maCurDate;
+ maCurDate = maOldCurDate;
+ *mpSelectTable = *mpOldSelectTable;
+ HideFocus();
+ ImplUpdateSelection( pOldSel );
+ if ( !pOldSel->Get( aOldDate.GetDate() ) )
+ ImplUpdateDate( aOldDate );
+ // Damit Focus-Rechteck auch wieder neu ausgegeben wird
+ if ( HasFocus() || !mpSelectTable->Get( maCurDate.GetDate() ) )
+ ImplUpdateDate( maCurDate );
+ delete pOldSel;
+ }
+ }
+
+ if ( !bSpinDown )
+ {
+ if ( !bCancel )
+ {
+ // Feststellen, ob wir sichtbaren Bereich scrollen sollen
+ ULONG nSelCount = mpSelectTable->Count();
+ if ( nSelCount )
+ {
+ Date aFirstSelDate( mpSelectTable->GetObjectKey( 0 ) );
+ Date aLastSelDate( mpSelectTable->GetObjectKey( nSelCount-1 ) );
+ if ( aLastSelDate < GetFirstMonth() )
+ ImplScroll( TRUE );
+ else if ( GetLastMonth() < aFirstSelDate )
+ ImplScroll( FALSE );
+ }
+ }
+
+ if ( mbAllSel ||
+ (!bCancel && ((maCurDate != maOldCurDate) || (*mpOldSelectTable != *mpSelectTable))) )
+ Select();
+
+ if ( !bSelection && (mnWinStyle & WB_TABSTOP) && !bCancel )
+ GrabFocus();
+
+ delete mpOldSelectTable;
+ mpOldSelectTable = NULL;
+ delete mpRestoreSelectTable;
+ mpRestoreSelectTable = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_STATIC_LINK( Calendar, ScrollHdl, Timer*, pTimer )
+{
+ BOOL bPrevIn = (pThis->mnDragScrollHitTest & CALENDAR_HITTEST_PREV) != 0;
+ BOOL bNextIn = (pThis->mnDragScrollHitTest & CALENDAR_HITTEST_NEXT) != 0;
+ if( bNextIn || bPrevIn )
+ {
+ pThis->mbScrollDateRange = TRUE;
+ pThis->ImplScroll( bPrevIn );
+ pThis->mbScrollDateRange = FALSE;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && !mbMenuDown )
+ {
+ Date aTempDate = maCurDate;
+ USHORT nHitTest = ImplHitTest( rMEvt.GetPosPixel(), aTempDate );
+ if ( nHitTest )
+ {
+ if ( nHitTest & CALENDAR_HITTEST_MONTHTITLE )
+ ImplShowMenu( rMEvt.GetPosPixel(), aTempDate );
+ else
+ {
+ maOldFirstDate = maFirstDate;
+
+ mbPrevIn = (nHitTest & CALENDAR_HITTEST_PREV) != 0;
+ mbNextIn = (nHitTest & CALENDAR_HITTEST_NEXT) != 0;
+ if ( mbPrevIn || mbNextIn )
+ {
+ mbSpinDown = TRUE;
+ mbScrollDateRange = TRUE;
+ ImplScroll( mbPrevIn );
+ mbScrollDateRange = FALSE;
+ // Hier muss BUTTONREPEAT stehen, also nicht wieder
+ // auf SCROLLREPEAT aendern, sondern mit TH abklaeren,
+ // warum es evtl. anders sein sollte (71775)
+ StartTracking( STARTTRACK_BUTTONREPEAT );
+ }
+ else
+ {
+ if ( (rMEvt.GetClicks() == 2) && (nHitTest & CALENDAR_HITTEST_DAY) )
+ DoubleClick();
+ else
+ {
+ if ( mpOldSelectTable )
+ delete mpOldSelectTable;
+ maOldCurDate = maCurDate;
+ mpOldSelectTable = new Table( *mpSelectTable );
+
+ if ( !mbSelection )
+ {
+ mbDrag = TRUE;
+ StartTracking();
+ }
+
+ mbMultiSelection = (mnWinStyle & (WB_MULTISELECT | WB_RANGESELECT)) != 0;
+ if ( (nHitTest & CALENDAR_HITTEST_DAY) && mbMultiSelection )
+ mbWeekSel = TRUE;
+ else
+ mbWeekSel = FALSE;
+ ImplMouseSelect( aTempDate, nHitTest, FALSE, rMEvt.IsShift(), rMEvt.IsMod1() );
+ }
+ }
+ }
+ }
+
+ return;
+ }
+
+ Control::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && mbSelection )
+ ImplEndTracking( rMEvt.GetPosPixel(), FALSE );
+ else
+ Control::MouseButtonUp( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( mbSelection && rMEvt.GetButtons() )
+ ImplTracking( rMEvt.GetPosPixel(), FALSE );
+ else
+ Control::MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::Tracking( const TrackingEvent& rTEvt )
+{
+ Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+
+ if ( rTEvt.IsTrackingEnded() )
+ ImplEndTracking( aMousePos, rTEvt.IsTrackingCanceled() );
+ else
+ ImplTracking( aMousePos, rTEvt.IsTrackingRepeat() );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::KeyInput( const KeyEvent& rKEvt )
+{
+ Date aNewDate = maCurDate;
+ BOOL bMultiSel = (mnWinStyle & (WB_RANGESELECT | WB_MULTISELECT)) != 0;
+ BOOL bExpand = rKEvt.GetKeyCode().IsShift();
+ BOOL bExtended = rKEvt.GetKeyCode().IsMod1();
+
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_HOME:
+ aNewDate.SetDay( 1 );
+ break;
+
+ case KEY_END:
+ aNewDate.SetDay( aNewDate.GetDaysInMonth() );
+ break;
+
+ case KEY_LEFT:
+ aNewDate--;
+ break;
+
+ case KEY_RIGHT:
+ aNewDate++;
+ break;
+
+ case KEY_UP:
+ aNewDate -= 7;
+ break;
+
+ case KEY_DOWN:
+ aNewDate += 7;
+ break;
+
+ case KEY_PAGEUP:
+ {
+ Date aTempDate = aNewDate;
+ aTempDate -= aNewDate.GetDay()+1;
+ aNewDate -= aTempDate.GetDaysInMonth();
+ }
+ break;
+
+ case KEY_PAGEDOWN:
+ aNewDate += aNewDate.GetDaysInMonth();
+ break;
+
+ case KEY_SPACE:
+ if ( bMultiSel && !(mnWinStyle & WB_RANGESELECT) )
+ {
+ if ( !bExpand )
+ {
+ BOOL bDateSel = IsDateSelected( maCurDate );
+ SelectDate( maCurDate, !bDateSel );
+ mbSelLeft = FALSE;
+ SelectionChanging();
+ mbTravelSelect = TRUE;
+ Select();
+ mbTravelSelect = FALSE;
+ }
+ }
+ else
+ Control::KeyInput( rKEvt );
+ break;
+
+ default:
+ Control::KeyInput( rKEvt );
+ break;
+ }
+
+ if ( aNewDate != maCurDate )
+ {
+ if ( bMultiSel && bExpand )
+ {
+ Table* pOldSel = new Table( *mpSelectTable );
+ Date aOldAnchorDate = maAnchorDate;
+ mbSelLeft = aNewDate < maAnchorDate;
+ if ( !bExtended )
+ {
+ if ( mbSelLeft )
+ {
+ ImplCalendarSelectDateRange( mpSelectTable, Date( 1, 1, 0 ), aNewDate, FALSE );
+ ImplCalendarSelectDateRange( mpSelectTable, maAnchorDate, Date( 31, 12, 9999 ), FALSE );
+ }
+ else
+ {
+ ImplCalendarSelectDateRange( mpSelectTable, Date( 1, 1, 0 ), maAnchorDate, FALSE );
+ ImplCalendarSelectDateRange( mpSelectTable, aNewDate, Date( 31, 12, 9999 ), FALSE );
+ }
+ }
+ ImplCalendarSelectDateRange( mpSelectTable, aNewDate, maAnchorDate, TRUE );
+ mbDirect = TRUE;
+ SetCurDate( aNewDate );
+ mbDirect = FALSE;
+ maAnchorDate = aOldAnchorDate;
+ mbInSelChange = TRUE;
+ SelectionChanging();
+ mbInSelChange = FALSE;
+ ImplUpdateSelection( pOldSel );
+ }
+ else
+ {
+ if ( mnWinStyle & WB_RANGESELECT )
+ {
+ SetNoSelection();
+ SelectDate( aNewDate, TRUE );
+ }
+ mbDirect = TRUE;
+ SetCurDate( aNewDate );
+ mbDirect = FALSE;
+ }
+ mbTravelSelect = TRUE;
+ Select();
+ mbTravelSelect = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::Paint( const Rectangle& rRect )
+{
+ ImplDraw( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::GetFocus()
+{
+ ImplUpdateDate( maCurDate );
+ Control::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::LoseFocus()
+{
+ HideFocus();
+ Control::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::Resize()
+{
+ ImplUpdate( TRUE );
+ Control::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::RequestHelp( const HelpEvent& rHEvt )
+{
+ if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) )
+ {
+ Date aDate = maCurDate;
+ if ( GetDate( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ), aDate ) )
+ {
+ Rectangle aDateRect = GetDateRect( aDate );
+ Point aPt = OutputToScreenPixel( aDateRect.TopLeft() );
+ aDateRect.Left() = aPt.X();
+ aDateRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aDateRect.BottomRight() );
+ aDateRect.Right() = aPt.X();
+ aDateRect.Bottom() = aPt.Y();
+
+ if ( (rHEvt.GetMode() & HELPMODE_BALLOON) || (mnWinStyle & WB_QUICKHELPSHOWSDATEINFO) )
+ {
+ ImplDateInfo* pInfo;
+ if ( mpDateTable )
+ {
+ pInfo = mpDateTable->Get( aDate.GetDate() );
+ if ( !pInfo )
+ pInfo = mpDateTable->Get( Date( aDate.GetDay(), aDate.GetMonth(), 0 ).GetDate() );
+ }
+ else
+ pInfo = NULL;
+ if ( pInfo )
+ {
+ XubString aStr = pInfo->maText;
+ if ( aStr.Len() )
+ {
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aDateRect, aStr );
+ return;
+ }
+ }
+ }
+
+ if ( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ USHORT nWeek = aDate.GetWeekOfYear( maIntn.GetWeekStart(), maIntn.GetWeekCountStart() );
+ USHORT nMonth = aDate.GetMonth();
+ XubString aStr( maDayText );
+ aStr.AppendAscii( ": " );
+ aStr.Append( XubString::CreateFromInt32( aDate.GetDayOfYear() ) );
+ aStr.AppendAscii( " / " );
+ aStr.Append( maWeekText );
+ aStr.AppendAscii( ": " );
+ aStr.Append( XubString::CreateFromInt32( nWeek ) );
+ // Evt. noch Jahr hinzufuegen, wenn es nicht das gleiche ist
+ if ( (nMonth == 12) && (nWeek == 1) )
+ {
+ aStr.AppendAscii( ", " );
+ aStr.Append( XubString::CreateFromInt32( aDate.GetYear()+1 ) );
+ }
+ else if ( (nMonth == 1) && (nWeek > 50) )
+ {
+ aStr.AppendAscii( ", " );
+ aStr.Append( XubString::CreateFromInt32( aDate.GetYear()-1 ) );
+ }
+ Help::ShowQuickHelp( this, aDateRect, aStr );
+ return;
+ }
+ }
+ }
+
+ Control::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ if ( !mbSelection && rCEvt.IsMouseEvent() )
+ {
+ Date aTempDate = maCurDate;
+ USHORT nHitTest = ImplHitTest( rCEvt.GetMousePosPixel(), aTempDate );
+ if ( nHitTest & CALENDAR_HITTEST_MONTHTITLE )
+ {
+ ImplShowMenu( rCEvt.GetMousePosPixel(), aTempDate );
+ return;
+ }
+ }
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ long nNotchDelta = pData->GetNotchDelta();
+ if ( nNotchDelta < 0 )
+ {
+ while ( nNotchDelta < 0 )
+ {
+ ImplScroll( TRUE );
+ nNotchDelta++;
+ }
+ }
+ else
+ {
+ while ( nNotchDelta > 0 )
+ {
+ ImplScroll( FALSE );
+ nNotchDelta--;
+ }
+ }
+
+ return;
+ }
+ }
+
+ Control::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ ImplFormat();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SelectionChanging()
+{
+ maSelectionChangingHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::DateRangeChanged()
+{
+ maDateRangeChangedHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::RequestDateInfo()
+{
+ maRequestDateInfoHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SetInternational( const International& rIntn )
+{
+ ImplUpdate( TRUE );
+
+ maIntn = rIntn;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SelectDate( const Date& rDate, BOOL bSelect )
+{
+ if ( !rDate.IsValid() )
+ return;
+
+ Table* pOldSel;
+
+ if ( !mbInSelChange )
+ pOldSel = new Table( *mpSelectTable );
+ else
+ pOldSel = NULL;
+
+ ImplCalendarSelectDate( mpSelectTable, rDate, bSelect );
+
+ if ( pOldSel )
+ {
+ ImplUpdateSelection( pOldSel );
+ delete pOldSel;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SelectDateRange( const Date& rStartDate, const Date& rEndDate,
+ BOOL bSelect )
+{
+ if ( !rStartDate.IsValid() || !rEndDate.IsValid() )
+ return;
+
+ Table* pOldSel;
+
+ if ( !mbInSelChange )
+ pOldSel = new Table( *mpSelectTable );
+ else
+ pOldSel = NULL;
+
+ ImplCalendarSelectDateRange( mpSelectTable, rStartDate, rEndDate, bSelect );
+
+ if ( pOldSel )
+ {
+ ImplUpdateSelection( pOldSel );
+ delete pOldSel;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SetNoSelection()
+{
+ Table* pOldSel;
+
+ if ( !mbInSelChange )
+ pOldSel = new Table( *mpSelectTable );
+ else
+ pOldSel = NULL;
+
+ ImplCalendarClearSelectDate( mpSelectTable );
+
+ if ( pOldSel )
+ {
+ ImplUpdateSelection( pOldSel );
+ delete pOldSel;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Calendar::IsDateSelected( const Date& rDate ) const
+{
+ return mpSelectTable->IsKeyValid( rDate.GetDate() );
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Calendar::GetSelectDateCount() const
+{
+ return mpSelectTable->Count();
+}
+
+// -----------------------------------------------------------------------
+
+Date Calendar::GetSelectDate( ULONG nIndex ) const
+{
+ if ( nIndex < mpSelectTable->Count() )
+ return Date( mpSelectTable->GetObjectKey( nIndex ) );
+ else
+ {
+ Date aDate( 0, 0, 0 );
+ return aDate;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SetCurDate( const Date& rNewDate )
+{
+ if ( !rNewDate.IsValid() )
+ return;
+
+ if ( maCurDate != rNewDate )
+ {
+ BOOL bUpdate = IsVisible() && IsUpdateMode();
+ Date aOldDate = maCurDate;
+ maCurDate = rNewDate;
+ maAnchorDate = maCurDate;
+
+ if ( !(mnWinStyle & (WB_RANGESELECT | WB_MULTISELECT)) )
+ {
+ ImplCalendarSelectDate( mpSelectTable, aOldDate, FALSE );
+ ImplCalendarSelectDate( mpSelectTable, maCurDate, TRUE );
+ }
+ else if ( !HasFocus() )
+ bUpdate = FALSE;
+
+ // Aktuelles Datum noch in den sichtbaren Bereich verschieben
+ if ( mbFormat || (maCurDate < GetFirstMonth()) )
+ SetFirstDate( maCurDate );
+ else if ( maCurDate > GetLastMonth() )
+ {
+ Date aTempDate = GetLastMonth();
+ long nDateOff = maCurDate-aTempDate;
+ if ( nDateOff < 365 )
+ {
+ Date maFirstDate = GetFirstMonth();
+ maFirstDate += maFirstDate.GetDaysInMonth();
+ aTempDate++;
+ while ( nDateOff > aTempDate.GetDaysInMonth() )
+ {
+ maFirstDate += maFirstDate.GetDaysInMonth();
+ long nDaysInMonth = aTempDate.GetDaysInMonth();
+ aTempDate += nDaysInMonth;
+ nDateOff -= nDaysInMonth;
+ }
+ SetFirstDate( maFirstDate );
+ }
+ else
+ SetFirstDate( maCurDate );
+ }
+ else
+ {
+ if ( bUpdate )
+ {
+ HideFocus();
+ ImplUpdateDate( aOldDate );
+ ImplUpdateDate( maCurDate );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SetFirstDate( const Date& rNewFirstDate )
+{
+ if ( maFirstDate != rNewFirstDate )
+ {
+ maFirstDate = Date( 1, rNewFirstDate.GetMonth(), rNewFirstDate.GetYear() );
+ mbDropPos = FALSE;
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Date Calendar::GetFirstMonth() const
+{
+ if ( maFirstDate.GetDay() > 1 )
+ {
+ if ( maFirstDate.GetMonth() == 12 )
+ return Date( 1, 1, maFirstDate.GetYear()+1 );
+ else
+ return Date( 1, maFirstDate.GetMonth()+1, maFirstDate.GetYear() );
+ }
+ else
+ return maFirstDate;
+}
+
+// -----------------------------------------------------------------------
+
+Date Calendar::GetLastMonth() const
+{
+ Date aDate = GetFirstMonth();
+ USHORT nMonthCount = GetMonthCount();
+ for ( USHORT i = 0; i < nMonthCount; i++ )
+ aDate += aDate.GetDaysInMonth();
+ aDate--;
+ return aDate;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Calendar::GetMonthCount() const
+{
+ if ( mbFormat )
+ return 1;
+ else
+ return (USHORT)(mnMonthPerLine*mnLines);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Calendar::GetDropDate( Date& rDate ) const
+{
+ if( mbDropPos )
+ {
+ rDate = maDropDate;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Calendar::GetDate( const Point& rPos, Date& rDate ) const
+{
+ Date aDate = maCurDate;
+ USHORT nHitTest = ImplHitTest( rPos, aDate );
+ if ( nHitTest & CALENDAR_HITTEST_DAY )
+ {
+ rDate = aDate;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle Calendar::GetDateRect( const Date& rDate ) const
+{
+ Rectangle aRect;
+
+ if ( mbFormat || (rDate < maFirstDate) || (rDate > (maFirstDate+mnDayCount)) )
+ return aRect;
+
+ long nX;
+ long nY;
+ ULONG nDaysOff;
+ USHORT nDayIndex;
+ Date aDate = GetFirstMonth();
+
+ if ( rDate < aDate )
+ {
+ aRect = GetDateRect( aDate );
+ nDaysOff = aDate-rDate;
+ nX = (long)(nDaysOff*mnDayWidth);
+ aRect.Left() -= nX;
+ aRect.Right() -= nX;
+ return aRect;
+ }
+ else
+ {
+ Date aLastDate = GetLastMonth();
+ if ( rDate > aLastDate )
+ {
+ USHORT nWeekDay = (USHORT)aLastDate.GetDayOfWeek();
+ nWeekDay = (nWeekDay+(7-(USHORT)maIntn.GetWeekStart())) % 7;
+ aLastDate -= nWeekDay;
+ aRect = GetDateRect( aLastDate );
+ nDaysOff = rDate-aLastDate;
+ nDayIndex = 0;
+ for ( USHORT i = 0; i <= nDaysOff; i++ )
+ {
+ if ( aLastDate == rDate )
+ {
+ aRect.Left() += nDayIndex*mnDayWidth;
+ aRect.Right() = aRect.Left()+mnDayWidth;
+ return aRect;
+ }
+ if ( nDayIndex == 6 )
+ {
+ nDayIndex = 0;
+ aRect.Top() += mnDayHeight;
+ aRect.Bottom() += mnDayHeight;
+ }
+ else
+ nDayIndex++;
+ aLastDate++;
+ }
+ }
+ }
+
+ nY = 0;
+ for ( long i = 0; i < mnLines; i++ )
+ {
+ nX = 0;
+ for ( long j = 0; j < mnMonthPerLine; j++ )
+ {
+ USHORT nDaysInMonth = aDate.GetDaysInMonth();
+
+ // Monat gerufen
+ if ( (aDate.GetMonth() == rDate.GetMonth()) &&
+ (aDate.GetYear() == rDate.GetYear()) )
+ {
+ long nDayX = nX+mnDaysOffX;
+ long nDayY = nY+mnDaysOffY;
+ nDayIndex = (USHORT)aDate.GetDayOfWeek();
+ nDayIndex = (nDayIndex+(7-(USHORT)maIntn.GetWeekStart())) % 7;
+ for ( USHORT nDay = 1; nDay <= nDaysInMonth; nDay++ )
+ {
+ if ( nDay == rDate.GetDay() )
+ {
+ aRect.Left() = nDayX + (nDayIndex*mnDayWidth);
+ aRect.Top() = nDayY;
+ aRect.Right() = aRect.Left()+mnDayWidth;
+ aRect.Bottom() = aRect.Top()+mnDayHeight;
+ break;
+ }
+ if ( nDayIndex == 6 )
+ {
+ nDayIndex = 0;
+ nDayY += mnDayHeight;
+ }
+ else
+ nDayIndex++;
+ }
+ }
+
+ aDate += nDaysInMonth;
+ nX += mnMonthWidth;
+ }
+
+ nY += mnMonthHeight;
+ }
+
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SetStandardColor( const Color& rColor )
+{
+ if ( mpStandardColor )
+ *mpStandardColor = rColor;
+ else
+ mpStandardColor = new Color( rColor );
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SetSaturdayColor( const Color& rColor )
+{
+ if ( mpSaturdayColor )
+ *mpSaturdayColor = rColor;
+ else
+ mpSaturdayColor = new Color( rColor );
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::SetSundayColor( const Color& rColor )
+{
+ if ( mpSundayColor )
+ *mpSundayColor = rColor;
+ else
+ mpSundayColor = new Color( rColor );
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::AddDateInfo( const Date& rDate, const String& rText,
+ const Color* pTextColor, const Color* pFrameColor,
+ USHORT nFlags )
+{
+ if ( !mpDateTable )
+ mpDateTable = new ImplDateTable( 256, 256 );
+
+ BOOL bChanged = FALSE;
+ ULONG nKey = rDate.GetDate();
+ ImplDateInfo* pDateInfo = mpDateTable->Get( nKey );
+ if ( pDateInfo )
+ pDateInfo->maText = rText;
+ else
+ {
+ pDateInfo = new ImplDateInfo( rText );
+ mpDateTable->Insert( nKey, pDateInfo );
+ }
+ if ( pTextColor )
+ {
+ if ( pDateInfo->mpTextColor )
+ {
+ if ( *(pDateInfo->mpTextColor) != *pTextColor )
+ {
+ *(pDateInfo->mpTextColor) = *pTextColor;
+ bChanged = TRUE;
+ }
+ }
+ else
+ {
+ pDateInfo->mpTextColor = new Color( *pTextColor );
+ bChanged = TRUE;
+ }
+ }
+ else
+ {
+ if ( pDateInfo->mpTextColor )
+ {
+ delete pDateInfo->mpTextColor;
+ pDateInfo->mpTextColor = NULL;
+ bChanged = TRUE;
+ }
+ }
+ if ( pFrameColor )
+ {
+ if ( pDateInfo->mpFrameColor )
+ {
+ if ( *(pDateInfo->mpFrameColor) != *pFrameColor )
+ {
+ *(pDateInfo->mpFrameColor) = *pFrameColor;
+ bChanged = TRUE;
+ }
+ }
+ else
+ {
+ pDateInfo->mpFrameColor = new Color( *pFrameColor );
+ bChanged = TRUE;
+ }
+ }
+ else
+ {
+ if ( pDateInfo->mpFrameColor )
+ {
+ delete pDateInfo->mpFrameColor;
+ pDateInfo->mpFrameColor = NULL;
+ bChanged = TRUE;
+ }
+ }
+ if ( pDateInfo->mnFlags != nFlags )
+ {
+ pDateInfo->mnFlags = nFlags;
+ bChanged = TRUE;
+ }
+
+ if ( bChanged )
+ ImplUpdateDate( rDate );
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::RemoveDateInfo( const Date& rDate )
+{
+ if ( mpDateTable )
+ {
+ ImplDateInfo* pDateInfo = mpDateTable->Remove( rDate.GetDate() );
+ if ( pDateInfo )
+ {
+ delete pDateInfo;
+ ImplUpdateDate( rDate );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::ClearDateInfo()
+{
+ if ( mpDateTable )
+ {
+ ImplDateInfo* pDateInfo = mpDateTable->First();
+ while ( pDateInfo )
+ {
+ ULONG nKey = mpDateTable->GetCurKey();
+ mpDateTable->Remove( nKey );
+ Date aDate( nKey );
+ ImplUpdateDate( aDate );
+ delete pDateInfo;
+ pDateInfo = mpDateTable->First();
+ }
+ delete mpDateTable;
+ mpDateTable = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString Calendar::GetDateInfoText( const Date& rDate )
+{
+ XubString aRet;
+ if ( mpDateTable )
+ {
+ ULONG nKey = rDate.GetDate();
+ ImplDateInfo* pDateInfo = mpDateTable->Get( nKey );
+ if ( pDateInfo )
+ aRet = pDateInfo->maText;
+ }
+ return aRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Calendar::ShowDropPos( const Point& rPos, Date& rDate )
+{
+ Date aTempDate = maCurDate;
+ mnDragScrollHitTest = ImplHitTest( rPos, aTempDate );
+
+ if ( mnDragScrollHitTest )
+ {
+ if ( mnDragScrollHitTest & (CALENDAR_HITTEST_PREV | CALENDAR_HITTEST_NEXT) )
+ {
+ if ( !maDragScrollTimer.IsActive() )
+ maDragScrollTimer.Start();
+ }
+ else
+ {
+ maDragScrollTimer.Stop();
+ if ( mnDragScrollHitTest & CALENDAR_HITTEST_DAY )
+ {
+ if ( !mbDropPos || (aTempDate != maDropDate) )
+ {
+ if( mbDropPos )
+ ImplInvertDropPos();
+ maDropDate = aTempDate;
+ mbDropPos = TRUE;
+ ImplInvertDropPos();
+ }
+
+ rDate = maDropDate;
+ return TRUE;
+ }
+ }
+ }
+ else
+ maDragScrollTimer.Stop();
+
+ HideDropPos();
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::HideDropPos()
+{
+ if ( mbDropPos )
+ {
+ ImplInvertDropPos();
+ mbDropPos = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::StartSelection()
+{
+ if ( mpOldSelectTable )
+ delete mpOldSelectTable;
+ maOldCurDate = maCurDate;
+ mpOldSelectTable = new Table( *mpSelectTable );
+
+ mbSelection = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Calendar::EndSelection()
+{
+ if ( mbDrag || mbSpinDown || mbSelection )
+ {
+ if ( !mbSelection )
+ ReleaseMouse();
+
+ mbDrag = FALSE;
+ mbSelection = FALSE;
+ mbMultiSelection = FALSE;
+ mbSpinDown = FALSE;
+ mbPrevIn = FALSE;
+ mbNextIn = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size Calendar::CalcWindowSizePixel( long nCalcMonthPerLine,
+ long nCalcLines ) const
+{
+ XubString a99Text( XubString( RTL_CONSTASCII_USTRINGPARAM( "99" ) ) );
+ Font aOldFont = GetFont();
+
+ // Wochenanzeige beruecksichtigen
+ long nWeekWidth;
+ if ( mnWinStyle & WB_WEEKNUMBER )
+ {
+ Font aTempFont = aOldFont;
+ ImplGetWeekFont( aTempFont );
+ ((Calendar*)this)->SetFont( aTempFont );
+ nWeekWidth = GetTextWidth( a99Text )+WEEKNUMBER_OFFX;
+ ((Calendar*)this)->SetFont( aOldFont );
+ }
+ else
+ nWeekWidth = 0;
+
+ if ( mnWinStyle & WB_BOLDTEXT )
+ {
+ Font aFont = aOldFont;
+ if ( aFont.GetWeight() < WEIGHT_BOLD )
+ aFont.SetWeight( WEIGHT_BOLD );
+ else
+ aFont.SetWeight( WEIGHT_NORMAL );
+ ((Calendar*)this)->SetFont( aFont );
+ }
+
+ Size aSize;
+ long n99TextWidth = GetTextWidth( a99Text );
+ long nTextHeight = GetTextHeight();
+
+ if ( mnWinStyle & WB_BOLDTEXT )
+ ((Calendar*)this)->SetFont( aOldFont );
+
+ aSize.Width() += ((n99TextWidth+DAY_OFFX)*7) + nWeekWidth;
+ aSize.Width() += MONTH_BORDERX*2;
+ aSize.Width() *= nCalcMonthPerLine;
+
+ aSize.Height() = nTextHeight + TITLE_OFFY + (TITLE_BORDERY*2);
+ aSize.Height() += nTextHeight + WEEKDAY_OFFY;
+ aSize.Height() += ((nTextHeight+DAY_OFFY)*6);
+ aSize.Height() += MONTH_OFFY;
+ aSize.Height() *= nCalcLines;
+
+ return aSize;
+}
+
+// =======================================================================
+
+#define CALFIELD_EXTRA_BUTTON_WIDTH 14
+#define CALFIELD_EXTRA_BUTTON_HEIGHT 8
+#define CALFIELD_SEP_X 6
+#define CALFIELD_BORDERLINE_X 5
+#define CALFIELD_BORDER_YTOP 4
+#define CALFIELD_BORDER_Y 5
+
+// =======================================================================
+
+class ImplCFieldFloatWin : public FloatingWindow
+{
+private:
+ Calendar* mpCalendar;
+ PushButton* mpTodayBtn;
+ PushButton* mpNoneBtn;
+ FixedLine* mpFixedLine;
+
+public:
+ ImplCFieldFloatWin( Window* pParent );
+ ~ImplCFieldFloatWin();
+
+ void SetCalendar( Calendar* pCalendar )
+ { mpCalendar = pCalendar; }
+
+ PushButton* EnableTodayBtn( BOOL bEnable );
+ PushButton* EnableNoneBtn( BOOL bEnable );
+ void ArrangeButtons();
+
+ long Notify( NotifyEvent& rNEvt );
+};
+
+// -----------------------------------------------------------------------
+
+ImplCFieldFloatWin::ImplCFieldFloatWin( Window* pParent ) :
+ FloatingWindow( pParent )
+{
+ mpCalendar = NULL;
+ mpTodayBtn = NULL;
+ mpNoneBtn = NULL;
+ mpFixedLine = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplCFieldFloatWin::~ImplCFieldFloatWin()
+{
+ delete mpTodayBtn;
+ delete mpNoneBtn;
+ delete mpFixedLine;
+}
+
+// -----------------------------------------------------------------------
+
+PushButton* ImplCFieldFloatWin::EnableTodayBtn( BOOL bEnable )
+{
+ if ( bEnable )
+ {
+ if ( !mpTodayBtn )
+ {
+ mpTodayBtn = new PushButton( this, WB_NOPOINTERFOCUS );
+ XubString aTodayText( SvtResId( STR_SVT_CALENDAR_TODAY ) );
+ mpTodayBtn->SetText( aTodayText );
+ Size aSize;
+ aSize.Width() = mpTodayBtn->GetCtrlTextWidth( mpTodayBtn->GetText() );
+ aSize.Height() = mpTodayBtn->GetTextHeight();
+ aSize.Width() += CALFIELD_EXTRA_BUTTON_WIDTH;
+ aSize.Height() += CALFIELD_EXTRA_BUTTON_HEIGHT;
+ mpTodayBtn->SetSizePixel( aSize );
+ mpTodayBtn->Show();
+ }
+ }
+ else
+ {
+ if ( mpTodayBtn )
+ {
+ delete mpTodayBtn;
+ mpTodayBtn = NULL;
+ }
+ }
+
+ return mpTodayBtn;
+}
+
+// -----------------------------------------------------------------------
+
+PushButton* ImplCFieldFloatWin::EnableNoneBtn( BOOL bEnable )
+{
+ if ( bEnable )
+ {
+ if ( !mpNoneBtn )
+ {
+ mpNoneBtn = new PushButton( this, WB_NOPOINTERFOCUS );
+ XubString aNoneText( SvtResId( STR_SVT_CALENDAR_NONE ) );
+ mpNoneBtn->SetText( aNoneText );
+ Size aSize;
+ aSize.Width() = mpNoneBtn->GetCtrlTextWidth( mpNoneBtn->GetText() );
+ aSize.Height() = mpNoneBtn->GetTextHeight();
+ aSize.Width() += CALFIELD_EXTRA_BUTTON_WIDTH;
+ aSize.Height() += CALFIELD_EXTRA_BUTTON_HEIGHT;
+ mpNoneBtn->SetSizePixel( aSize );
+ mpNoneBtn->Show();
+ }
+ }
+ else
+ {
+ if ( mpNoneBtn )
+ {
+ delete mpNoneBtn;
+ mpNoneBtn = NULL;
+ }
+ }
+
+ return mpNoneBtn;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplCFieldFloatWin::ArrangeButtons()
+{
+ long nBtnHeight = 0;
+ long nBtnWidth = 0;
+ Size aOutSize = GetOutputSizePixel();
+ if ( mpTodayBtn && mpNoneBtn )
+ {
+ Size aTodayBtnSize = mpTodayBtn->GetSizePixel();
+ Size aNoneBtnSize = mpNoneBtn->GetSizePixel();
+ if ( aTodayBtnSize.Width() < aNoneBtnSize.Width() )
+ aTodayBtnSize.Width() = aNoneBtnSize.Width();
+ else
+ aNoneBtnSize.Width() = aTodayBtnSize.Width();
+ if ( aTodayBtnSize.Height() < aNoneBtnSize.Height() )
+ aTodayBtnSize.Height() = aNoneBtnSize.Height();
+ else
+ aNoneBtnSize.Height() = aTodayBtnSize.Height();
+
+ nBtnWidth = aTodayBtnSize.Width() + aNoneBtnSize.Width() + CALFIELD_SEP_X;
+ nBtnHeight = aTodayBtnSize.Height();
+ long nX = (aOutSize.Width()-nBtnWidth)/2;
+ long nY = aOutSize.Height()+CALFIELD_BORDER_Y+CALFIELD_BORDER_YTOP;
+ mpTodayBtn->SetPosSizePixel( Point( nX, nY ), aTodayBtnSize );
+ nX += aTodayBtnSize.Width() + CALFIELD_SEP_X;
+ mpNoneBtn->SetPosSizePixel( Point( nX, nY ), aNoneBtnSize );
+ }
+ else if ( mpTodayBtn )
+ {
+ Size aTodayBtnSize = mpTodayBtn->GetSizePixel();
+ nBtnWidth = aTodayBtnSize.Width();
+ nBtnHeight = aTodayBtnSize.Height();
+ mpTodayBtn->SetPosPixel( Point( (aOutSize.Width()-nBtnWidth)/2, aOutSize.Height()+CALFIELD_BORDER_Y+CALFIELD_BORDER_YTOP ) );
+ }
+ else if ( mpNoneBtn )
+ {
+ Size aNoneBtnSize = mpNoneBtn->GetSizePixel();
+ nBtnWidth = aNoneBtnSize.Width();
+ nBtnHeight = aNoneBtnSize.Height();
+ mpNoneBtn->SetPosPixel( Point( (aOutSize.Width()-nBtnWidth)/2, aOutSize.Height()+CALFIELD_BORDER_Y+CALFIELD_BORDER_YTOP ) );
+ }
+
+ if ( nBtnHeight )
+ {
+ if ( !mpFixedLine )
+ {
+ mpFixedLine = new FixedLine( this );
+ mpFixedLine->Show();
+ }
+ long nLineWidth = aOutSize.Width()-(CALFIELD_BORDERLINE_X*2);
+ mpFixedLine->SetPosSizePixel( (aOutSize.Width()-nLineWidth)/2, aOutSize.Height()+((CALFIELD_BORDER_YTOP-2)/2),
+ nLineWidth, 2, WINDOW_POSSIZE_POSSIZE );
+ aOutSize.Height() += nBtnHeight + (CALFIELD_BORDER_Y*2) + CALFIELD_BORDER_YTOP;
+ SetOutputSizePixel( aOutSize );
+ }
+ else
+ {
+ if ( mpFixedLine )
+ {
+ delete mpFixedLine;
+ mpFixedLine = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ImplCFieldFloatWin::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ if ( pKEvt->GetKeyCode().GetCode() == KEY_RETURN )
+ mpCalendar->Select();
+ }
+
+ return FloatingWindow::Notify( rNEvt );
+}
+
+// =======================================================================
+
+CalendarField::CalendarField( Window* pParent, WinBits nWinStyle ) :
+ DateField( pParent, nWinStyle ),
+ maDefaultDate( 0, 0, 0 )
+{
+ mpFloatWin = NULL;
+ mpCalendar = NULL;
+ mnCalendarStyle = 0;
+ mbToday = FALSE;
+ mbNone = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+CalendarField::CalendarField( Window* pParent, const ResId& rResId ) :
+ DateField( pParent, rResId ),
+ maDefaultDate( 0, 0, 0 )
+{
+ mpFloatWin = NULL;
+ mpCalendar = NULL;
+ mnCalendarStyle = 0;
+ mbToday = FALSE;
+ mbNone = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+CalendarField::~CalendarField()
+{
+ if ( mpFloatWin )
+ {
+ delete mpCalendar;
+ delete mpFloatWin;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( CalendarField, ImplSelectHdl, Calendar*, pCalendar )
+{
+ if ( !pCalendar->IsTravelSelect() )
+ {
+ mpFloatWin->EndPopupMode();
+ EndDropDown();
+ GrabFocus();
+ Date aNewDate = mpCalendar->GetSelectDate( 0 );
+ if ( IsEmptyDate() || ( aNewDate != GetDate() ) )
+ {
+ SetDate( aNewDate );
+ SetModifyFlag();
+ Modify();
+ }
+ Select();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( CalendarField, ImplClickHdl, PushButton*, pBtn )
+{
+ mpFloatWin->EndPopupMode();
+ EndDropDown();
+ GrabFocus();
+
+ if ( pBtn == mpTodayBtn )
+ {
+ Date aToday;
+ if ( (aToday != GetDate()) || IsEmptyDate() )
+ {
+ SetDate( aToday );
+ SetModifyFlag();
+ Modify();
+ }
+ }
+ else if ( pBtn == mpNoneBtn )
+ {
+ if ( !IsEmptyDate() )
+ {
+ SetEmptyDate();
+ SetModifyFlag();
+ Modify();
+ }
+ }
+ Select();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( CalendarField, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
+{
+ EndDropDown();
+ GrabFocus();
+ mpCalendar->EndSelection();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void CalendarField::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL CalendarField::ShowDropDown( BOOL bShow )
+{
+ if ( bShow )
+ {
+ Calendar* pCalendar = GetCalendar();
+
+ Date aDate = GetDate();
+ if ( IsEmptyDate() || !aDate.IsValid() )
+ {
+ if ( maDefaultDate.IsValid() )
+ aDate = maDefaultDate;
+ else
+ aDate = Date();
+ }
+ if ( pCalendar->GetStyle() & (WB_RANGESELECT | WB_MULTISELECT) )
+ {
+ pCalendar->SetNoSelection();
+ pCalendar->SelectDate( aDate );
+ }
+ pCalendar->SetCurDate( aDate );
+ Point aPos( GetParent()->OutputToScreenPixel( GetPosPixel() ) );
+ Rectangle aRect( aPos, GetSizePixel() );
+ aRect.Bottom() -= 1;
+ mpCalendar->SetOutputSizePixel( mpCalendar->CalcWindowSizePixel() );
+ mpFloatWin->SetOutputSizePixel( mpCalendar->GetSizePixel() );
+ mpFloatWin->SetCalendar( mpCalendar );
+ mpTodayBtn = mpFloatWin->EnableTodayBtn( mbToday );
+ mpNoneBtn = mpFloatWin->EnableNoneBtn( mbNone );
+ if ( mpTodayBtn )
+ mpTodayBtn->SetClickHdl( LINK( this, CalendarField, ImplClickHdl ) );
+ if ( mpNoneBtn )
+ mpNoneBtn->SetClickHdl( LINK( this, CalendarField, ImplClickHdl ) );
+ mpFloatWin->ArrangeButtons();
+ mpCalendar->EnableCallEverySelect();
+ mpCalendar->StartSelection();
+ mpCalendar->GrabFocus();
+ mpCalendar->Show();
+ mpFloatWin->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN );
+ }
+ else
+ {
+ mpFloatWin->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
+ mpCalendar->EndSelection();
+ EndDropDown();
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Calendar* CalendarField::CreateCalendar( Window* pParent )
+{
+ return new Calendar( pParent, mnCalendarStyle | WB_TABSTOP );
+}
+
+// -----------------------------------------------------------------------
+
+Calendar* CalendarField::GetCalendar()
+{
+ if ( !mpFloatWin )
+ {
+ mpFloatWin = new ImplCFieldFloatWin( this );
+ mpFloatWin->SetPopupModeEndHdl( LINK( this, CalendarField, ImplPopupModeEndHdl ) );
+ mpCalendar = CreateCalendar( mpFloatWin );
+ mpCalendar->SetPosPixel( Point() );
+ mpCalendar->SetSelectHdl( LINK( this, CalendarField, ImplSelectHdl ) );
+ }
+
+ return mpCalendar;
+}
diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src
new file mode 100644
index 000000000000..2919e3d55148
--- /dev/null
+++ b/svtools/source/control/calendar.src
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * $RCSfile: calendar.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "svtools.hrc"
+String STR_SVT_CALENDAR_DAY
+{
+ Text = "Tag" ;
+ Text [ ENGLISH ] = "Day" ;
+ Text [ english_us ] = "Day" ;
+ Text [ italian ] = "Giorno" ;
+ Text [ spanish ] = "Día" ;
+ Text [ french ] = "Jour" ;
+ Text [ dutch ] = "Dag" ;
+ Text [ swedish ] = "Dag" ;
+ Text [ danish ] = "Dag" ;
+ Text [ portuguese_brazilian ] = "Tag" ;
+ Text [ portuguese ] = "Dia" ;
+ Text[ chinese_simplified ] = "Ìì";
+ Text[ russian ] = "Äåíü";
+ Text[ polish ] = "dzieñ";
+ Text[ japanese ] = "“ú";
+ Text[ chinese_traditional ] = "¤Ñ";
+ Text[ arabic ] = "íæã";
+ Text[ dutch ] = "Dag";
+ Text[ chinese_simplified ] = "Ìì";
+ Text[ greek ] = "ÇìÝñá";
+ Text[ korean ] = "ÀÏÀÚ";
+ Text[ turkish ] = "Gün";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_CALENDAR_WEEK
+{
+ Text = "Woche" ;
+ Text [ ENGLISH ] = "Week" ;
+ Text [ dutch ] = "Week" ;
+ Text [ english_us ] = "Week" ;
+ Text [ italian ] = "Settim." ;
+ Text [ spanish ] = "Semana" ;
+ Text [ french ] = "Semaine" ;
+ Text [ swedish ] = "Vecka" ;
+ Text [ danish ] = "Uge" ;
+ Text [ portuguese ] = "Semana" ;
+ Text [ portuguese_brazilian ] = "Woche" ;
+ Text[ chinese_simplified ] = "ÖÜ";
+ Text[ russian ] = "Íåäåëÿ";
+ Text[ polish ] = "tydzieñ";
+ Text[ japanese ] = "T";
+ Text[ chinese_traditional ] = "©P";
+ Text[ arabic ] = "ÃÓÈæÚ";
+ Text[ dutch ] = "Week";
+ Text[ chinese_simplified ] = "ÖÜ";
+ Text[ greek ] = "ÅâäïìÜäá";
+ Text[ korean ] = "ÁÖ";
+ Text[ turkish ] = "Hafta";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_CALENDAR_TODAY
+{
+ Text = "Heute" ;
+ Text [ ENGLISH ] = "Today" ;
+ Text [ portuguese ] = "Hoje" ;
+ Text [ english_us ] = "Today" ;
+ Text [ portuguese_brazilian ] = "Heute" ;
+ Text [ swedish ] = "Idag" ;
+ Text [ danish ] = "I dag" ;
+ Text [ italian ] = "Oggi" ;
+ Text [ spanish ] = "Hoy" ;
+ Text [ french ] = "Aujourd'hui" ;
+ Text [ dutch ] = "Vandaag" ;
+ Text[ chinese_simplified ] = "½ñÌì";
+ Text[ russian ] = "Ñåãîäíÿ";
+ Text[ polish ] = "dzisiaj";
+ Text[ japanese ] = "¡“ú";
+ Text[ chinese_traditional ] = "¤µ¤Ñ";
+ Text[ arabic ] = "Çáíæã";
+ Text[ dutch ] = "Vandaag";
+ Text[ chinese_simplified ] = "½ñÌì";
+ Text[ greek ] = "ÓÞìåñá";
+ Text[ korean ] = "¿À´Ã";
+ Text[ turkish ] = "Bugün";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_CALENDAR_NONE
+{
+ Text = "Keines" ;
+ Text [ ENGLISH ] = "None" ;
+ Text [ portuguese ] = "Nenhum" ;
+ Text [ english_us ] = "None" ;
+ Text [ portuguese_brazilian ] = "Keines" ;
+ Text [ swedish ] = "Ingen" ;
+ Text [ danish ] = "Ingen" ;
+ Text [ italian ] = "Senza" ;
+ Text [ spanish ] = "Ninguno" ;
+ Text [ french ] = "Aucun(e)" ;
+ Text [ dutch ] = "Geen" ;
+ Text[ chinese_simplified ] = "ÎÞ";
+ Text[ russian ] = "Áåç";
+ Text[ polish ] = "brak";
+ Text[ japanese ] = "‚È‚µ";
+ Text[ chinese_traditional ] = "µL";
+ Text[ arabic ] = "ÈÏæä";
+ Text[ dutch ] = "Geen";
+ Text[ chinese_simplified ] = "ÎÞ";
+ Text[ greek ] = "ÊáíÝíá";
+ Text[ korean ] = "¾øÀ½";
+ Text[ turkish ] = "Yok";
+ Text[ language_user1 ] = " ";
+};
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
new file mode 100644
index 000000000000..2af1f99aeadf
--- /dev/null
+++ b/svtools/source/control/ctrlbox.cxx
@@ -0,0 +1,1227 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrlbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _CTRLBOX_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+
+#include <svtdata.hxx>
+#include <svtools.hrc>
+#include <ctrlbox.hxx>
+#include <ctrltool.hxx>
+
+#define IMGTEXTSPACE 2
+#define SYMBOLFONTTEXT "AbCdEfGhIj"
+#define EXTRAFONTSIZE 5
+
+// ========================================================================
+// ColorListBox
+// ========================================================================
+
+// --------------------
+// - ImplColorListData -
+// --------------------
+
+struct ImplColorListData
+{
+ Color aColor;
+ BOOL bColor;
+
+ ImplColorListData() : aColor( COL_BLACK ) { bColor = FALSE; }
+ ImplColorListData( const Color& rColor ) : aColor( rColor ) { bColor = TRUE; }
+};
+
+DECLARE_LIST( ImpColorList, ImplColorListData* );
+
+// -----------------------------------------------------------------------
+
+void ColorListBox::ImplInit()
+{
+ pColorList = new ImpColorList( 256, 64 );
+ aImageSize.Width() = GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "xxx" ) ) );
+ aImageSize.Height() = GetTextHeight();
+ aImageSize.Height() -= 2;
+
+ EnableUserDraw( TRUE );
+ SetUserItemSize( aImageSize );
+}
+
+// -----------------------------------------------------------------------
+
+void ColorListBox::ImplDestroyColorEntries()
+{
+ for ( USHORT n = (USHORT) pColorList->Count(); n; )
+ {
+ ImplColorListData* pData = pColorList->GetObject( --n );
+ delete pData;
+ }
+ pColorList->Clear();
+}
+
+// -----------------------------------------------------------------------
+
+ColorListBox::ColorListBox( Window* pParent, WinBits nWinStyle ) :
+ ListBox( pParent, nWinStyle )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+ColorListBox::ColorListBox( Window* pParent, const ResId& rResId ) :
+ ListBox( pParent, rResId )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+ColorListBox::~ColorListBox()
+{
+ ImplDestroyColorEntries();
+ delete pColorList;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ColorListBox::InsertEntry( const XubString& rStr, USHORT nPos )
+{
+ nPos = ListBox::InsertEntry( rStr, nPos );
+ if ( nPos != LISTBOX_ERROR )
+ {
+ ImplColorListData* pData = new ImplColorListData;
+ pColorList->Insert( pData, nPos );
+ }
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ColorListBox::InsertEntry( const Color& rColor, const XubString& rStr,
+ USHORT nPos )
+{
+ nPos = ListBox::InsertEntry( rStr, nPos );
+ if ( nPos != LISTBOX_ERROR )
+ {
+ ImplColorListData* pData = new ImplColorListData( rColor );
+ pColorList->Insert( pData, nPos );
+ }
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+void ColorListBox::RemoveEntry( USHORT nPos )
+{
+ ListBox::RemoveEntry( nPos );
+ delete pColorList->Remove( nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void ColorListBox::Clear()
+{
+ ImplDestroyColorEntries();
+ ListBox::Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void ColorListBox::CopyEntries( const ColorListBox& rBox )
+{
+ // Liste leeren
+ ImplDestroyColorEntries();
+
+ // Daten kopieren
+ USHORT nCount = (USHORT) rBox.pColorList->Count();
+ for ( USHORT n = 0; n < nCount; n++ )
+ {
+ ImplColorListData* pData = rBox.pColorList->GetObject( n );
+ USHORT nPos = InsertEntry( rBox.GetEntry( n ), LISTBOX_APPEND );
+ if ( nPos != LISTBOX_ERROR )
+ pColorList->Insert( new ImplColorListData( *pData ), nPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ColorListBox::GetEntryPos( const Color& rColor ) const
+{
+ for( USHORT n = (USHORT) pColorList->Count(); n; )
+ {
+ ImplColorListData* pData = pColorList->GetObject( --n );
+ if ( pData->bColor && ( pData->aColor == rColor ) )
+ {
+ return n;
+ }
+ }
+ return LISTBOX_ENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+Color ColorListBox::GetEntryColor( USHORT nPos ) const
+{
+ Color aColor;
+ ImplColorListData* pData = pColorList->GetObject( nPos );
+ if ( pData && pData->bColor )
+ aColor = pData->aColor;
+ return aColor;
+}
+
+// -----------------------------------------------------------------------
+
+void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ ImplColorListData* pData = pColorList->GetObject( rUDEvt.GetItemId() );
+ if ( pData )
+ {
+ if ( pData->bColor )
+ {
+ Point aPos( rUDEvt.GetRect().TopLeft() );
+ aPos.X() += 2;
+ aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aImageSize.Height() ) / 2;
+ rUDEvt.GetDevice()->Push();
+ rUDEvt.GetDevice()->SetFillColor( pData->aColor );
+ rUDEvt.GetDevice()->SetLineColor( COL_BLACK );
+ rUDEvt.GetDevice()->DrawRect( Rectangle( aPos, aImageSize ) );
+ rUDEvt.GetDevice()->Pop();
+ ListBox::DrawEntry( rUDEvt, FALSE, TRUE, FALSE );
+ }
+ else
+ {
+ ListBox::DrawEntry( rUDEvt, FALSE, TRUE, TRUE );
+ }
+ }
+ else
+ {
+ ListBox::DrawEntry( rUDEvt, TRUE, TRUE, FALSE );
+ }
+}
+
+// =======================================================================
+// LineListBox
+// =======================================================================
+
+// -------------------
+// - ImpListListData -
+// -------------------
+
+struct ImpLineListData
+{
+ long nLine1;
+ long nLine2;
+ long nDistance;
+};
+
+DECLARE_LIST( ImpLineList, ImpLineListData* );
+
+// -----------------------------------------------------------------------
+
+void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance,
+ Bitmap& rBmp, XubString& rStr )
+{
+ Size aSize = GetOutputSizePixel();
+ aSize.Width() -= 20;
+ aSize.Width() -= aTxtSize.Width();
+ aSize.Height() = aTxtSize.Height();
+
+ // SourceUnit nach Twips
+ if ( eSourceUnit == FUNIT_POINT )
+ {
+ nLine1 *= 20;
+ nLine2 *= 20;
+ nDistance *= 20;
+ }
+ else if ( eSourceUnit == FUNIT_MM )
+ {
+ nLine1 *= 14440;
+ nLine1 /= 254;
+ nLine2 *= 14440;
+ nLine2 /= 254;
+ nDistance *= 14440;
+ nDistance /= 254;
+ }
+
+ // Linien malen
+ aSize = aVirDev.PixelToLogic( aSize );
+ long nPix = aVirDev.PixelToLogic( Size( 0, 1 ) ).Height();
+ long n1 = nLine1 / 100;
+ long n2 = nLine2 / 100;
+ long nDist = nDistance / 100;
+ n1 += nPix-1;
+ n1 -= n1%nPix;
+ if ( n2 )
+ {
+ nDist += nPix-1;
+ nDist -= nDist%nPix;
+ n2 += nPix-1;
+ n2 -= n2%nPix;
+ }
+ long nVirHeight = n1+nDist+n2;
+ if ( nVirHeight > aSize.Height() )
+ aSize.Height() = nVirHeight;
+ // negative Breiten muss und darf man nicht painten
+ if ( aSize.Width() > 0 )
+ {
+ Size aVirSize = aVirDev.LogicToPixel( aSize );
+ if ( aVirDev.GetOutputSizePixel() != aVirSize )
+ aVirDev.SetOutputSizePixel( aVirSize );
+ aVirDev.SetFillColor( GetSettings().GetStyleSettings().GetFieldColor() );
+ aVirDev.DrawRect( Rectangle( Point(), aSize ) );
+ aVirDev.SetFillColor( aColor );
+ aVirDev.DrawRect( Rectangle( 0, 0, aSize.Width(), n1-nPix ) );
+ if ( n2 )
+ {
+ aVirDev.DrawRect( Rectangle( 0, n1+nDist,
+ aSize.Width(), n1+nDist+n2-nPix ) );
+ }
+ rBmp = aVirDev.GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) );
+ }
+ // Twips nach Unit
+ if ( eUnit == FUNIT_POINT )
+ {
+ nLine1 /= 20;
+ nLine2 /= 20;
+ nDistance /= 20;
+ rStr.AssignAscii( " pt" );
+ }
+ else if ( eUnit == FUNIT_MM )
+ {
+ nLine1 *= 254;
+ nLine1 /= 14400;
+ nLine2 *= 254;
+ nLine2 /= 14400;
+ nDistance *= 254;
+ nDistance /= 14400;
+ rStr.AssignAscii( " mm" );
+ }
+
+ rStr.Insert( aIntn.GetNum( nLine1+nLine2+nDistance, 2 ), 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void LineListBox::ImplInit()
+{
+ aTxtSize.Width() = GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "99,99 mm" ) ) );
+ aTxtSize.Height() = GetTextHeight();
+ pLineList = new ImpLineList;
+ eUnit = FUNIT_POINT;
+ eSourceUnit = FUNIT_POINT;
+
+ aVirDev.SetLineColor();
+ aVirDev.SetMapMode( MapMode( MAP_TWIP ) );
+}
+
+// -----------------------------------------------------------------------
+
+LineListBox::LineListBox( Window* pParent, WinBits nWinStyle ) :
+ ListBox( pParent, nWinStyle ),
+ aIntn( Application::GetAppInternational() ),
+ aColor( COL_BLACK )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+LineListBox::LineListBox( Window* pParent, const ResId& rResId ) :
+ ListBox( pParent, rResId ),
+ aIntn( Application::GetAppInternational() ),
+ aColor( COL_BLACK )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+LineListBox::~LineListBox()
+{
+ ULONG n = 0;
+ ULONG nCount = pLineList->Count();
+ while ( n < nCount )
+ {
+ ImpLineListData* pData = pLineList->GetObject( n );
+ if ( pData )
+ delete pData;
+ n++;
+ }
+ delete pLineList;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT LineListBox::InsertEntry( const XubString& rStr, USHORT nPos )
+{
+ nPos = ListBox::InsertEntry( rStr, nPos );
+ if ( nPos != LISTBOX_ERROR )
+ pLineList->Insert( NULL, nPos );
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT LineListBox::InsertEntry( long nLine1, long nLine2, long nDistance,
+ USHORT nPos )
+{
+ XubString aStr;
+ Bitmap aBmp;
+ ImpGetLine( nLine1, nLine2, nDistance, aBmp, aStr );
+ nPos = ListBox::InsertEntry( aStr, aBmp, nPos );
+ if ( nPos != LISTBOX_ERROR )
+ {
+ ImpLineListData* pData = new ImpLineListData;
+ pData->nLine1 = nLine1;
+ pData->nLine2 = nLine2;
+ pData->nDistance = nDistance;
+ pLineList->Insert( pData, nPos );
+ }
+
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+void LineListBox::RemoveEntry( USHORT nPos )
+{
+ ListBox::RemoveEntry( nPos );
+ ImpLineListData* pData = pLineList->Remove( nPos );
+ if ( pData )
+ delete pData;
+}
+
+// -----------------------------------------------------------------------
+
+void LineListBox::Clear()
+{
+ ULONG n = 0;
+ ULONG nCount = pLineList->Count();
+ while ( n < nCount )
+ {
+ ImpLineListData* pData = pLineList->GetObject( n );
+ if ( pData )
+ delete pData;
+ n++;
+ }
+
+ pLineList->Clear();
+ ListBox::Clear();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT LineListBox::GetEntryPos( long nLine1, long nLine2,
+ long nDistance ) const
+{
+ ULONG n = 0;
+ ULONG nCount = pLineList->Count();
+ while ( n < nCount )
+ {
+ ImpLineListData* pData = pLineList->GetObject( n );
+ if ( pData )
+ {
+ if ( (pData->nLine1 == nLine1) &&
+ (pData->nLine2 == nLine2) &&
+ (pData->nDistance == nDistance) )
+ return (USHORT)n;
+ }
+
+ n++;
+ }
+
+ return LISTBOX_ENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+long LineListBox::GetEntryLine1( USHORT nPos ) const
+{
+ ImpLineListData* pData = pLineList->GetObject( nPos );
+ if ( pData )
+ return pData->nLine1;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long LineListBox::GetEntryLine2( USHORT nPos ) const
+{
+ ImpLineListData* pData = pLineList->GetObject( nPos );
+ if ( pData )
+ return pData->nLine2;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long LineListBox::GetEntryDistance( USHORT nPos ) const
+{
+ ImpLineListData* pData = pLineList->GetObject( nPos );
+ if ( pData )
+ return pData->nDistance;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void LineListBox::SetColor( const Color& rColor )
+{
+ // Farben austauschen
+ aColor = rColor;
+
+ // Variablen anlegen
+ ULONG n = 0;
+ ULONG nCount = pLineList->Count();
+ if ( !nCount )
+ return;
+
+ XubString aStr;
+ Bitmap aBmp;
+
+ // Eintrage mit Linien austauschen
+ SetUpdateMode( FALSE );
+ USHORT nSelEntry = GetSelectEntryPos();
+ while ( n < nCount )
+ {
+ ImpLineListData* pData = pLineList->GetObject( n );
+ if ( pData )
+ {
+ // ListBox-Daten austauschen
+ ListBox::RemoveEntry( (USHORT)n );
+ ImpGetLine( pData->nLine1, pData->nLine2, pData->nDistance,
+ aBmp, aStr );
+ ListBox::InsertEntry( aStr, aBmp, (USHORT)n );
+ }
+
+ n++;
+ }
+
+ if ( nSelEntry != LISTBOX_ENTRY_NOTFOUND )
+ SelectEntryPos( nSelEntry );
+
+ SetUpdateMode( TRUE );
+ Invalidate();
+}
+
+// ===================================================================
+// FontNameBox
+// ===================================================================
+
+struct ImplFontNameListData
+{
+ FontInfo maInfo;
+ USHORT mnType;
+
+ ImplFontNameListData( const FontInfo& rInfo,
+ USHORT nType ) :
+ maInfo( rInfo ),
+ mnType( nType )
+ {}
+};
+
+DECLARE_LIST( ImplFontList, ImplFontNameListData* );
+
+// -------------------------------------------------------------------
+
+FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle ),
+ maImagePrinterFont( SvtResId( RID_IMG_PRINTERFONT ) ),
+ maImageBitmapFont( SvtResId( RID_IMG_BITMAPFONT ) ),
+ maImageScalableFont( SvtResId( RID_IMG_SCALABLEFONT ) )
+{
+ mpFontList = NULL;
+ mbWYSIWYG = FALSE;
+ mbSymbols = FALSE;
+}
+
+// -------------------------------------------------------------------
+
+FontNameBox::FontNameBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( pParent, rResId ),
+ maImagePrinterFont( SvtResId( RID_IMG_PRINTERFONT ) ),
+ maImageBitmapFont( SvtResId( RID_IMG_BITMAPFONT ) ),
+ maImageScalableFont( SvtResId( RID_IMG_SCALABLEFONT ) )
+{
+ mpFontList = NULL;
+ mbWYSIWYG = FALSE;
+ mbSymbols = FALSE;
+}
+
+// -------------------------------------------------------------------
+
+FontNameBox::~FontNameBox()
+{
+ ImplDestroyFontList();
+}
+
+// -------------------------------------------------------------------
+
+void FontNameBox::ImplDestroyFontList()
+{
+ if ( mpFontList )
+ {
+ ImplFontNameListData* pInfo = mpFontList->First();
+ while ( pInfo )
+ {
+ delete pInfo;
+ pInfo = mpFontList->Next();
+ }
+ delete mpFontList;
+ }
+}
+
+// -------------------------------------------------------------------
+
+void FontNameBox::Fill( const FontList* pList )
+{
+ // Vorherigen Namen merken und Box loeschen
+ XubString aOldText = GetText();
+ Clear();
+
+ ImplDestroyFontList();
+ mpFontList = new ImplFontList;
+
+ // Fonts eintragen
+ USHORT nFontCount = pList->GetFontNameCount();
+ for ( USHORT i = 0; i < nFontCount; i++ )
+ {
+ const FontInfo& rFontInfo = pList->GetFontName( i );
+ ULONG nIndex = InsertEntry( rFontInfo.GetName() );
+ if ( nIndex != LISTBOX_ERROR )
+ {
+ USHORT nType = pList->GetFontNameType( i );
+ ImplFontNameListData* pData = new ImplFontNameListData( rFontInfo, nType );
+ mpFontList->Insert( pData, nIndex );
+ }
+ }
+
+ ImplCalcUserItemSize();
+
+ // Text wieder setzen
+ if ( aOldText.Len() )
+ SetText( aOldText );
+}
+
+// -------------------------------------------------------------------
+
+void FontNameBox::EnableWYSIWYG( BOOL bEnable )
+{
+ if ( bEnable != mbWYSIWYG )
+ {
+ mbWYSIWYG = bEnable;
+ EnableUserDraw( mbWYSIWYG | mbSymbols );
+ ImplCalcUserItemSize();
+ }
+}
+
+// -------------------------------------------------------------------
+
+void FontNameBox::EnableSymbols( BOOL bEnable )
+{
+ if ( bEnable != mbSymbols )
+ {
+ mbSymbols = bEnable;
+ EnableUserDraw( mbWYSIWYG | mbSymbols );
+ ImplCalcUserItemSize();
+ }
+}
+
+// -------------------------------------------------------------------
+
+void FontNameBox::ImplCalcUserItemSize()
+{
+ Size aUserItemSz;
+ if ( mbWYSIWYG && mpFontList )
+ {
+ USHORT nMaxLen = 0;
+ BOOL bSymbolFont = FALSE;
+ for ( USHORT n = GetEntryCount(); n; )
+ {
+ ImplFontNameListData* pData = mpFontList->GetObject( --n );
+ XubString aFontName = pData->maInfo.GetName();
+ if ( aFontName.Len() > nMaxLen )
+ nMaxLen = aFontName.Len();
+ if ( pData->maInfo.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
+ bSymbolFont = TRUE;
+ }
+
+ // Maximale Breite schaetzen
+ Size aOneCharSz( GetTextWidth( XubString( 'X' ) ), GetTextHeight() );
+ Size aSz( aOneCharSz );
+ aSz.Width() *= nMaxLen;
+ // Nur XX% der Breite, weil die ListBox die normalen Breiten berechnet...
+ aSz.Width() *= 1;
+ aSz.Width() /= 10;
+ if ( bSymbolFont )
+ aSz.Width() += (sizeof( SYMBOLFONTTEXT )-1) * aOneCharSz.Width();
+ aSz.Height() *= 14;
+ aSz.Height() /= 10;
+ aUserItemSz = aSz;
+ }
+ if ( mbSymbols )
+ {
+ Size aSz = maImageScalableFont.GetSizePixel();
+ aUserItemSz.Width() += aSz.Width() + IMGTEXTSPACE;
+ if ( aSz.Height() > aUserItemSz.Height() )
+ aUserItemSz.Height() = aSz.Height();
+ }
+ SetUserItemSize( aUserItemSz );
+}
+
+// -------------------------------------------------------------------
+
+void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ ImplFontNameListData* pData = mpFontList->GetObject( rUDEvt.GetItemId() );
+ const FontInfo& rInfo = pData->maInfo;
+ USHORT nType = pData->mnType;
+ Point aTopLeft = rUDEvt.GetRect().TopLeft();
+ long nX = aTopLeft.X();
+ long nH = rUDEvt.GetRect().GetHeight();
+
+ if ( mbSymbols )
+ {
+ nX += IMGTEXTSPACE;
+ Image* pImg = NULL;
+ if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER )
+ pImg = &maImagePrinterFont;
+ else if ( nType & FONTLIST_FONTNAMETYPE_SCALABLE )
+ pImg = &maImageScalableFont;
+ else
+ pImg = &maImageBitmapFont;
+
+ if ( pImg )
+ {
+ Point aPos( nX, aTopLeft.Y() + (nH-pImg->GetSizePixel().Height())/2 );
+ rUDEvt.GetDevice()->DrawImage( aPos, *pImg );
+ }
+
+ // X immer um gleiche Breite aendern, auch wenn kein Image ausgegeben.
+ nX += maImagePrinterFont.GetSizePixel().Width();
+ }
+
+ if ( mbWYSIWYG && mpFontList )
+ {
+ nX += IMGTEXTSPACE;
+ BOOL bSymbolFont = rInfo.GetCharSet() == RTL_TEXTENCODING_SYMBOL;
+ if ( bSymbolFont )
+ {
+ XubString aText( rInfo.GetName() );
+ aText.AppendAscii( " " );
+ Point aPos( nX, aTopLeft.Y() + (nH-rUDEvt.GetDevice()->GetTextHeight())/2 );
+ rUDEvt.GetDevice()->DrawText( aPos, aText );
+ nX += rUDEvt.GetDevice()->GetTextWidth( aText );
+ }
+
+ Color aTextColor = rUDEvt.GetDevice()->GetTextColor();
+ Font aOldFont( rUDEvt.GetDevice()->GetFont() );
+ Size aSz( aOldFont.GetSize() );
+ aSz.Height() += EXTRAFONTSIZE;
+ Font aFont( rInfo );
+ aFont.SetSize( aSz );
+ rUDEvt.GetDevice()->SetFont( aFont );
+ rUDEvt.GetDevice()->SetTextColor( aTextColor );
+ long nTextHeight = rUDEvt.GetDevice()->GetTextHeight();
+ Point aPos( nX, aTopLeft.Y() + (nH-nTextHeight)/2 );
+ if ( bSymbolFont )
+ rUDEvt.GetDevice()->DrawText( aPos, XubString( RTL_CONSTASCII_USTRINGPARAM( SYMBOLFONTTEXT ) ) );
+ else
+ rUDEvt.GetDevice()->DrawText( aPos, rInfo.GetName() );
+ rUDEvt.GetDevice()->SetFont( aOldFont );
+ DrawEntry( rUDEvt, FALSE, FALSE); // Separator
+ }
+ else
+ {
+ DrawEntry( rUDEvt, TRUE, TRUE );
+ }
+}
+
+// ===================================================================
+// FontStyleBox
+// ===================================================================
+
+FontStyleBox::FontStyleBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+}
+
+// -------------------------------------------------------------------
+
+FontStyleBox::FontStyleBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( pParent, rResId )
+{
+ aLastStyle = GetText();
+}
+
+// -------------------------------------------------------------------
+
+FontStyleBox::~FontStyleBox()
+{
+}
+
+// -------------------------------------------------------------------
+
+void FontStyleBox::Select()
+{
+ // Damit Text nach einem Fill erhalten bleibt
+ aLastStyle = GetText();
+ ComboBox::Select();
+}
+
+// -------------------------------------------------------------------
+
+void FontStyleBox::LoseFocus()
+{
+ // Damit Text nach einem Fill erhalten bleibt
+ aLastStyle = GetText();
+ ComboBox::LoseFocus();
+}
+
+// -------------------------------------------------------------------
+
+void FontStyleBox::Modify()
+{
+ International aIntn = Application::GetAppInternational();
+ XubString aStr = GetText();
+ USHORT nEntryCount = GetEntryCount();
+
+ if ( GetEntryPos( aStr ) == COMBOBOX_ENTRY_NOTFOUND )
+ {
+ aIntn.ToUpper( aStr );
+ for ( USHORT i = 0; i < nEntryCount; i++ )
+ {
+ XubString aEntryText = GetEntry( i );
+ aIntn.ToUpper( aEntryText );
+
+ if ( aStr == aEntryText )
+ {
+ SetText( GetEntry( i ) );
+ break;
+ }
+ }
+ }
+
+ ComboBox::Modify();
+}
+
+// -------------------------------------------------------------------
+
+void FontStyleBox::Fill( const XubString& rName, const FontList* pList )
+{
+ // Achtung: In dieser Methode muss ComboBox::SetText() aufgerufen werden,
+ // da sonst aLastStyle ueberschrieben wird
+ // Vorherige Position merken und Box loeschen
+ XubString aOldText = GetText();
+ USHORT nPos = GetEntryPos( aOldText );
+ Clear();
+
+ // Existiert ein Font mit diesem Namen
+ sal_Handle hFontInfo = pList->GetFirstFontInfo( rName );
+ if ( hFontInfo )
+ {
+ BOOL bFound = FALSE;
+ BOOL bNormal = FALSE;
+ BOOL bItalic = FALSE;
+ BOOL bBold = FALSE;
+ BOOL bBoldItalic = FALSE;
+ FontInfo aInfo;
+ while ( hFontInfo )
+ {
+ aInfo = pList->GetFontInfo( hFontInfo );
+
+ XubString aStyleText = pList->GetStyleName( aInfo );
+ FontWeight eWeight = aInfo.GetWeight();
+ FontItalic eItalic = aInfo.GetItalic();
+ if ( eWeight <= WEIGHT_NORMAL )
+ {
+ bNormal = TRUE;
+ if ( eItalic != ITALIC_NONE )
+ bItalic = TRUE;
+ }
+ else
+ {
+ if ( eItalic != ITALIC_NONE )
+ bBoldItalic = TRUE;
+ else
+ bBold = TRUE;
+ }
+ if ( aStyleText == pList->GetItalicStr() )
+ bItalic = TRUE;
+ else if ( aStyleText == pList->GetBoldStr() )
+ bBold = TRUE;
+ else if ( aStyleText == pList->GetBoldItalicStr() )
+ bBoldItalic = TRUE;
+ if ( !bFound && (aStyleText == aLastStyle) )
+ bFound = TRUE;
+
+ // Falls doch mal doppelte Strings kommen, dann
+ // nach Moeglichkeit abfangen
+ if ( GetEntryPos( aStyleText ) == LISTBOX_ENTRY_NOTFOUND )
+ InsertEntry( aStyleText );
+
+ hFontInfo = pList->GetNextFontInfo( hFontInfo );
+ }
+
+ // Bestimmte Styles als Nachbildung
+ if ( bNormal )
+ {
+ if ( !bItalic )
+ {
+ if ( !bFound && (aLastStyle == pList->GetItalicStr()) )
+ bFound = TRUE;
+ InsertEntry( pList->GetItalicStr() );
+ }
+ if ( !bBold )
+ {
+ if ( !bFound && (aLastStyle == pList->GetBoldStr()) )
+ bFound = TRUE;
+ InsertEntry( pList->GetBoldStr() );
+ }
+ }
+ if ( !bBoldItalic )
+ {
+ if ( bNormal || bItalic || bBold )
+ {
+ if ( !bFound && (aLastStyle == pList->GetBoldItalicStr()) )
+ bFound = TRUE;
+ InsertEntry( pList->GetBoldItalicStr() );
+ }
+ }
+ if ( aOldText.Len() )
+ {
+ if ( bFound )
+ ComboBox::SetText( aLastStyle );
+ else
+ {
+ if ( nPos >= GetEntryCount() )
+ ComboBox::SetText( GetEntry( 0 ) );
+ else
+ ComboBox::SetText( GetEntry( nPos ) );
+ }
+ }
+ }
+ else
+ {
+ // Wenn Font nicht, dann Standard-Styles einfuegen
+ InsertEntry( pList->GetNormalStr() );
+ InsertEntry( pList->GetItalicStr() );
+ InsertEntry( pList->GetBoldStr() );
+ InsertEntry( pList->GetBoldItalicStr() );
+ if ( aOldText.Len() )
+ {
+ if ( nPos > GetEntryCount() )
+ ComboBox::SetText( GetEntry( 0 ) );
+ else
+ ComboBox::SetText( GetEntry( nPos ) );
+ }
+ }
+}
+
+// ===================================================================
+// FontSizeBox
+// ===================================================================
+
+FontSizeBox::FontSizeBox( Window* pParent, WinBits nWinSize ) :
+ MetricBox( pParent, nWinSize )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+FontSizeBox::FontSizeBox( Window* pParent, const ResId& rResId ) :
+ MetricBox( pParent, rResId )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+FontSizeBox::~FontSizeBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeBox::ImplInit()
+{
+ EnableAutocomplete( FALSE );
+
+ bRelativeMode = FALSE;
+ bPtRelative = FALSE;
+ bRelative = FALSE;
+ bStdSize = FALSE;
+ pFontList = NULL;
+
+ International aIntn = GetInternational();
+ aIntn.SetNumTrailingZeros( FALSE );
+ SetInternational( aIntn );
+
+ SetDecimalDigits( 1 );
+ SetMin( 20 );
+ SetMax( 9999 );
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeBox::Modify()
+{
+ MetricBox::Modify();
+
+ if ( bRelativeMode )
+ {
+ XubString aStr = GetText();
+ aStr.EraseLeadingChars();
+
+ BOOL bNewMode = bRelative;
+ BOOL bOldPtRelMode = bPtRelative;
+
+ if ( bRelative )
+ {
+ bPtRelative = FALSE;
+ const xub_Unicode* pStr = aStr.GetBuffer();
+ while ( *pStr )
+ {
+ if ( ((*pStr < '0') || (*pStr > '9')) && (*pStr != '%') )
+ {
+ if ( ('-' == *pStr || '+' == *pStr) && !bPtRelative )
+ bPtRelative = TRUE;
+ else if ( bPtRelative && 'p' == *pStr && 't' == *++pStr )
+ ;
+ else
+ {
+ bNewMode = FALSE;
+ break;
+ }
+ }
+ pStr++;
+ }
+ }
+ else
+ {
+ if ( STRING_NOTFOUND != aStr.Search( '%' ) )
+ {
+ bNewMode = TRUE;
+ bPtRelative = FALSE;
+ }
+
+ if ( '-' == aStr.GetChar( 0 ) || '+' == aStr.GetChar( 0 ) )
+ {
+ bNewMode = TRUE;
+ bPtRelative = TRUE;
+ }
+ }
+
+ if ( bNewMode != bRelative || bPtRelative != bOldPtRelMode )
+ SetRelative( bNewMode );
+
+ MetricBox::Modify();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeBox::Fill( const FontInfo& rInfo, const FontList* pList )
+{
+ // Merken fuer Relative-Mode
+ aFontInfo = rInfo;
+ pFontList = pList;
+
+ // Im Relative-Mode, muessen keine Fontgroessen gesetzt werden
+ if ( bRelative )
+ return;
+
+ // Fontgroessen abfragen
+ const long* pAry = pList->GetSizeAry( rInfo );
+
+ // Wenn es das Array mit den Standardgroessen ist, muessen wir im
+ // Normalfall die ListBox nicht neu fuellen
+ if ( (pAry == pList->GetStdSizeAry()) && GetEntryCount() )
+ {
+ if ( bStdSize )
+ return;
+ bStdSize = TRUE;
+ }
+ else
+ bStdSize = FALSE;
+
+ Selection aSelection = GetSelection();
+ XubString aStr = GetText();
+
+ Clear();
+
+ while ( *pAry )
+ {
+ InsertValue( *pAry );
+ pAry++;
+ }
+
+ SetText( aStr );
+ SetSelection( aSelection );
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeBox::EnableRelativeMode( USHORT nMin, USHORT nMax, USHORT nStep )
+{
+ bRelativeMode = TRUE;
+ nRelMin = nMin;
+ nRelMax = nMax;
+ nRelStep = nStep;
+ SetUnit( FUNIT_POINT );
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeBox::EnablePtRelativeMode( short nMin, short nMax, short nStep )
+{
+ bRelativeMode = TRUE;
+ nPtRelMin = nMin;
+ nPtRelMax = nMax;
+ nPtRelStep = nStep;
+ SetUnit( FUNIT_POINT );
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeBox::SetRelative( BOOL bNewRelative )
+{
+ if ( bRelativeMode )
+ {
+ Selection aSelection = GetSelection();
+ XubString aStr = GetText();
+ aStr.EraseLeadingChars();
+
+ if ( bNewRelative )
+ {
+ bRelative = TRUE;
+ bStdSize = FALSE;
+
+ if ( bPtRelative )
+ {
+ SetDecimalDigits( 1 );
+ SetMin( nPtRelMin );
+ SetMax( nPtRelMax );
+ SetUnit( FUNIT_POINT );
+
+ Clear();
+ short i = nPtRelMin, n = 0;
+ // JP 30.06.98: mehr als 100 Werte machen keinen Sinn
+ while ( i <= nPtRelMax && n++ < 100 )
+ {
+ InsertValue( i );
+ i += nPtRelStep;
+ }
+ }
+ else
+ {
+ SetDecimalDigits( 0 );
+ SetMin( nRelMin );
+ SetMax( nRelMax );
+ SetCustomUnitText( '%' );
+ SetUnit( FUNIT_CUSTOM );
+
+ Clear();
+ USHORT i = nRelMin;
+ while ( i <= nRelMax )
+ {
+ InsertValue( i );
+ i += nRelStep;
+ }
+ }
+ }
+ else
+ {
+ bRelative = bPtRelative = FALSE;
+ SetDecimalDigits( 1 );
+ SetMin( 20 );
+ SetMax( 9999 );
+ SetUnit( FUNIT_POINT );
+ if ( pFontList )
+ Fill( aFontInfo, pFontList );
+ }
+
+ SetText( aStr );
+ SetSelection( aSelection );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString FontSizeBox::CreateFieldText( long nValue ) const
+{
+ XubString sRet( MetricBox::CreateFieldText( nValue ) );
+ if ( bRelativeMode && bPtRelative && (0 <= nValue) && sRet.Len() )
+ sRet.Insert( '+', 0 );
+ return sRet;
+}
diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src
new file mode 100644
index 000000000000..db8eb8810ec7
--- /dev/null
+++ b/svtools/source/control/ctrlbox.src
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrlbox.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "svtools.hrc"
+
+#ifndef IMAGE_STDBTN_COLOR
+#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
+#endif
+
+
+IMAGE RID_IMG_SCALABLEFONT
+{
+ ImageBitmap = Bitmap { File = "scalfont.bmp" ; };
+ MaskColor = IMAGE_STDBTN_COLOR ;
+};
+
+IMAGE RID_IMG_PRINTERFONT
+{
+ ImageBitmap = Bitmap { File = "prnfont.bmp" ; };
+ MaskColor = IMAGE_STDBTN_COLOR ;
+};
+
+IMAGE RID_IMG_BITMAPFONT
+{
+ ImageBitmap = Bitmap { File = "bmpfont.bmp" ; };
+ MaskColor = IMAGE_STDBTN_COLOR ;
+};
+
diff --git a/svtools/source/control/ctrldll.cxx b/svtools/source/control/ctrldll.cxx
new file mode 100644
index 000000000000..19c26d4e80cf
--- /dev/null
+++ b/svtools/source/control/ctrldll.cxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrldll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef WIN
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#endif
+
+#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/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
new file mode 100644
index 000000000000..ed38c9cc7a93
--- /dev/null
+++ b/svtools/source/control/ctrltool.cxx
@@ -0,0 +1,865 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrltool.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define CTRLTOOL_CXX
+
+#include <string.h>
+
+#ifndef TOOLS_INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _VCL_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+#ifndef _VCL_SYSTEM_HXX
+#include <vcl/system.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <vcl/wrkwin.hxx>
+#endif
+
+#define private public
+
+#include <svtools.hrc>
+#include <svtdata.hxx>
+#include <ctrltool.hxx>
+
+// =======================================================================
+
+// Standard Fontgroessen fuer scalierbare Fonts
+static long aStdSizeAry[] =
+{
+ 60,
+ 70,
+ 80,
+ 90,
+ 100,
+ 110,
+ 120,
+ 140,
+ 160,
+ 180,
+ 200,
+ 220,
+ 240,
+ 260,
+ 280,
+ 320,
+ 360,
+ 400,
+ 440,
+ 480,
+ 540,
+ 600,
+ 660,
+ 720,
+ 800,
+ 880,
+ 960,
+ 0
+};
+
+// =======================================================================
+
+// -----------------------------
+// - class ImplFontListFonInfo -
+// -----------------------------
+
+class ImplFontListFontInfo : public FontInfo
+{
+ friend class FontList;
+
+private:
+ OutputDevice* mpDevice;
+ ImplFontListFontInfo* mpNext;
+
+public:
+ ImplFontListFontInfo( const FontInfo& rInfo,
+ OutputDevice* pDev ) :
+ FontInfo( rInfo )
+ {
+ mpDevice = pDev;
+ }
+
+ OutputDevice* GetDevice() const { return mpDevice; }
+};
+
+// ------------------------------
+// - class ImplFontListNameInfo -
+// ------------------------------
+
+class ImplFontListNameInfo
+{
+ friend class FontList;
+
+private:
+ XubString maSearchName;
+ ImplFontListFontInfo* mpFirst;
+ USHORT mnType;
+
+ ImplFontListNameInfo( const XubString& rSearchName ) :
+ maSearchName( rSearchName )
+ {}
+
+ const XubString& GetSearchName() const { return maSearchName; }
+};
+
+// =======================================================================
+
+static StringCompare ImplCompareFontInfo( ImplFontListFontInfo* pInfo1,
+ ImplFontListFontInfo* pInfo2 )
+{
+ if ( pInfo1->GetWeight() < pInfo2->GetWeight() )
+ return COMPARE_LESS;
+ else if ( pInfo1->GetWeight() > pInfo2->GetWeight() )
+ return COMPARE_GREATER;
+
+ if ( pInfo1->GetItalic() < pInfo2->GetItalic() )
+ return COMPARE_LESS;
+ else if ( pInfo1->GetItalic() > pInfo2->GetItalic() )
+ return COMPARE_GREATER;
+
+ return pInfo1->GetStyleName().CompareTo( pInfo2->GetStyleName() );
+}
+
+// =======================================================================
+
+static void ImplMakeSearchString( XubString& rStr )
+{
+ rStr.ToLowerAscii();
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplMakeSearchStringFromName( XubString& rStr )
+{
+ rStr = rStr.GetToken( 0, ';' );
+ ImplMakeSearchString( rStr );
+}
+
+// -----------------------------------------------------------------------
+
+ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, ULONG* pIndex ) const
+{
+ // Wenn kein Eintrag in der Liste oder der Eintrag groesser ist als
+ // der Letzte, dann hinten dranhaengen. Wir vergleichen erst mit dem
+ // letzten Eintrag, da die Liste von VCL auch sortiert zurueckkommt
+ // und somit die Wahrscheinlichkeit das hinten angehaengt werden muss
+ // sehr gross ist.
+ StringCompare eComp;
+ ULONG nCount = Count();
+ if ( !nCount )
+ {
+ if ( pIndex )
+ *pIndex = LIST_APPEND;
+ return NULL;
+ }
+ else
+ {
+ ImplFontListNameInfo* pCmpData = (ImplFontListNameInfo*)List::GetObject( nCount-1 );
+ eComp = rSearchName.CompareTo( pCmpData->maSearchName );
+ if ( eComp == COMPARE_GREATER )
+ {
+ if ( pIndex )
+ *pIndex = LIST_APPEND;
+ return NULL;
+ }
+ else if ( eComp == COMPARE_EQUAL )
+ return pCmpData;
+ }
+
+ // Fonts in der Liste suchen
+ ImplFontListNameInfo* pCompareData;
+ ImplFontListNameInfo* pFoundData = NULL;
+ ULONG nLow = 0;
+ ULONG nHigh = nCount-1;
+ ULONG nMid;
+
+ do
+ {
+ nMid = (nLow + nHigh) / 2;
+ pCompareData = (ImplFontListNameInfo*)List::GetObject( nMid );
+ eComp = rSearchName.CompareTo( pCompareData->maSearchName );
+ if ( eComp == COMPARE_LESS )
+ {
+ if ( !nMid )
+ break;
+ nHigh = nMid-1;
+ }
+ else
+ {
+ if ( eComp == COMPARE_GREATER )
+ nLow = nMid + 1;
+ else
+ {
+ pFoundData = pCompareData;
+ break;
+ }
+ }
+ }
+ while ( nLow <= nHigh );
+
+ if ( pIndex )
+ {
+ eComp = rSearchName.CompareTo( pCompareData->maSearchName );
+ if ( eComp == COMPARE_GREATER )
+ *pIndex = (nMid+1);
+ else
+ *pIndex = nMid;
+ }
+
+ return pFoundData;
+}
+
+// -----------------------------------------------------------------------
+
+ImplFontListNameInfo* FontList::ImplFindByName( const XubString& rStr ) const
+{
+ XubString aSearchName = rStr;
+ ImplMakeSearchStringFromName( aSearchName );
+ return ImplFind( aSearchName, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void FontList::ImplInsertFonts( OutputDevice* pDevice, BOOL bAll,
+ BOOL bInsertData )
+{
+ rtl_TextEncoding eSystemEncoding = gsl_getSystemTextEncoding();
+
+ USHORT nType;
+ if ( pDevice->GetOutDevType() != OUTDEV_PRINTER )
+ nType = FONTLIST_FONTNAMETYPE_SCREEN;
+ else
+ nType = FONTLIST_FONTNAMETYPE_PRINTER;
+
+ // Alle Fonts vom Device abfragen
+ USHORT n = pDevice->GetDevFontCount();
+ USHORT i;
+ for( i = 0; i < n; i++ )
+ {
+ FontInfo aFontInfo = pDevice->GetDevFont( i );
+
+ // Wenn keine Raster-Schriften angezeigt werden sollen,
+ // dann diese ignorieren
+ if ( !bAll && (aFontInfo.GetType() == TYPE_RASTER) )
+ continue;
+
+ XubString aSearchName = aFontInfo.GetName();
+ ImplFontListNameInfo* pData;
+ ULONG nIndex;
+ ImplMakeSearchString( aSearchName );
+ pData = ImplFind( aSearchName, &nIndex );
+
+ if ( !pData )
+ {
+ if ( bInsertData )
+ {
+ ImplFontListFontInfo* pNewInfo = new ImplFontListFontInfo( aFontInfo, pDevice );
+ pData = new ImplFontListNameInfo( aSearchName );
+ pData->mpFirst = pNewInfo;
+ pNewInfo->mpNext = NULL;
+ pData->mnType = 0;
+ Insert( (void*)pData, nIndex );
+ }
+ }
+ else
+ {
+ if ( bInsertData )
+ {
+ BOOL bInsert = TRUE;
+ ImplFontListFontInfo* pPrev = NULL;
+ ImplFontListFontInfo* pTemp = pData->mpFirst;
+ ImplFontListFontInfo* pNewInfo = new ImplFontListFontInfo( aFontInfo, pDevice );
+ while ( pTemp )
+ {
+ StringCompare eComp = ImplCompareFontInfo( pNewInfo, pTemp );
+ if ( (eComp == COMPARE_LESS) || (eComp == COMPARE_EQUAL) )
+ {
+ if ( eComp == COMPARE_EQUAL )
+ {
+ // Overwrite charset, because charset should match
+ // with the system charset
+ if ( (pTemp->GetCharSet() != eSystemEncoding) &&
+ (pNewInfo->GetCharSet() == eSystemEncoding) )
+ {
+ ImplFontListFontInfo* pTemp2 = pTemp->mpNext;
+ *((FontInfo*)pTemp) = *((FontInfo*)pNewInfo);
+ pTemp->mpNext = pTemp2;
+ }
+ delete pNewInfo;
+ bInsert = FALSE;
+ }
+
+ break;
+ }
+
+ pPrev = pTemp;
+ pTemp = pTemp->mpNext;
+ }
+
+ if ( bInsert )
+ {
+ pNewInfo->mpNext = pTemp;
+ if ( pPrev )
+ pPrev->mpNext = pNewInfo;
+ else
+ pData->mpFirst = pNewInfo;
+ }
+ }
+ }
+
+ if ( pData )
+ {
+ pData->mnType |= nType;
+ if ( aFontInfo.GetType() != TYPE_RASTER )
+ pData->mnType |= FONTLIST_FONTNAMETYPE_SCALABLE;
+ }
+ }
+}
+
+// =======================================================================
+
+FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, BOOL bAll ) :
+ List( 4096, pDevice->GetDevFontCount(), 32 )
+{
+ // Variablen initialisieren
+ mpDev = pDevice;
+ mpDev2 = pDevice2;
+ mpSizeAry = NULL;
+
+ // Stylenamen festlegen
+ maLight = XubString( SvtResId( STR_SVT_STYLE_LIGHT ) );
+ maLightItalic = XubString( SvtResId( STR_SVT_STYLE_LIGHT_ITALIC ) );
+ maNormal = XubString( SvtResId( STR_SVT_STYLE_NORMAL ) );
+ maNormalItalic = XubString( SvtResId( STR_SVT_STYLE_NORMAL_ITALIC ) );
+ maBold = XubString( SvtResId( STR_SVT_STYLE_BOLD ) );
+ maBoldItalic = XubString( SvtResId( STR_SVT_STYLE_BOLD_ITALIC ) );
+ maBlack = XubString( SvtResId( STR_SVT_STYLE_BLACK ) );
+ maBlackItalic = XubString( SvtResId( STR_SVT_STYLE_BLACK_ITALIC ) );
+
+ ImplInsertFonts( pDevice, bAll, TRUE );
+
+ // Gegebenenfalls muessen wir mit den Bildschirmfonts vergleichen,
+ // damit dort die eigentlich doppelten auf Equal mappen koennen
+ BOOL bCompareWindow = FALSE;
+ if ( !pDevice2 && (pDevice->GetOutDevType() == OUTDEV_PRINTER) )
+ {
+ bCompareWindow = TRUE;
+ pDevice2 = Application::GetDefaultDevice();
+ }
+
+ if ( pDevice2 &&
+ (pDevice2->GetOutDevType() != pDevice->GetOutDevType()) )
+ ImplInsertFonts( pDevice2, bAll, !bCompareWindow );
+}
+
+// -----------------------------------------------------------------------
+
+FontList::~FontList()
+{
+ // Gegebenenfalls SizeArray loeschen
+ if ( mpSizeAry )
+ delete mpSizeAry;
+
+ // FontInfos loeschen
+ ImplFontListNameInfo* pData = (ImplFontListNameInfo*)First();
+ while ( pData )
+ {
+ ImplFontListFontInfo* pTemp;
+ ImplFontListFontInfo* pInfo = pData->mpFirst;
+ while ( pInfo )
+ {
+ pTemp = pInfo->mpNext;
+ delete pInfo;
+ pInfo = pTemp;
+ }
+ ImplFontListNameInfo* pNext = (ImplFontListNameInfo*)Next();
+ delete pData;
+ pData = pNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString FontList::GetStyleName( const FontInfo& rInfo ) const
+{
+ XubString aStyleName = rInfo.GetStyleName();
+
+ // Nur wenn kein StyleName gesetzt ist, geben wir einen syntetischen
+ // Namen zurueck
+ if ( !aStyleName.Len() )
+ {
+ FontWeight eWeight = rInfo.GetWeight();
+ FontItalic eItalic = rInfo.GetItalic();
+ if ( eWeight > WEIGHT_BOLD )
+ {
+ if ( eItalic > ITALIC_NONE )
+ aStyleName = maBlackItalic;
+ else
+ aStyleName = maBlack;
+ }
+ else if ( eWeight > WEIGHT_MEDIUM )
+ {
+ if ( eItalic > ITALIC_NONE )
+ aStyleName = maBoldItalic;
+ else
+ aStyleName = maBold;
+ }
+ else if ( eWeight > WEIGHT_LIGHT )
+ {
+ if ( eItalic > ITALIC_NONE )
+ aStyleName = maNormalItalic;
+ else
+ aStyleName = maNormal;
+ }
+ else if ( eWeight != WEIGHT_DONTKNOW )
+ {
+ if ( eItalic > ITALIC_NONE )
+ aStyleName = maLightItalic;
+ else
+ aStyleName = maLight;
+ }
+ else
+ {
+ if ( eItalic > ITALIC_NONE )
+ aStyleName = maNormalItalic;
+ else
+ aStyleName = maNormal;
+ }
+ }
+
+ return aStyleName;
+}
+
+// -----------------------------------------------------------------------
+
+XubString FontList::GetFontMapText( const FontInfo& rInfo ) const
+{
+ if ( !rInfo.GetName().Len() )
+ {
+ XubString aEmptryStr;
+ return aEmptryStr;
+ }
+
+ ImplFontListNameInfo* pData = ImplFindByName( rInfo.GetName() );
+ if ( !pData )
+ {
+ if ( !maMapNotAvailable.Len() )
+ ((FontList*)this)->maMapNotAvailable = XubString( SvtResId( STR_SVT_FONTMAP_NOTAVAILABLE ) );
+ return maMapNotAvailable;
+ }
+
+ USHORT nType = pData->mnType;
+ if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER )
+ {
+ if ( !maMapPrinterOnly.Len() )
+ ((FontList*)this)->maMapPrinterOnly = XubString( SvtResId( STR_SVT_FONTMAP_PRINTERONLY ) );
+ return maMapPrinterOnly;
+ }
+ else if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_SCREEN )
+ {
+ if ( !maMapScreenOnly.Len() )
+ ((FontList*)this)->maMapScreenOnly = XubString( SvtResId( STR_SVT_FONTMAP_SCREENONLY ) );
+ return maMapScreenOnly;
+ }
+ else
+ {
+ BOOL bNotSynthetic = FALSE;
+ BOOL bNoneAvailable = FALSE;
+ const XubString& rStyleName = rInfo.GetStyleName();
+ FontWeight eMinWeight = pData->mpFirst->GetWeight();
+ FontWeight eWeight = rInfo.GetWeight();
+ FontItalic eItalic = rInfo.GetItalic();
+ ImplFontListFontInfo* pFontInfo = pData->mpFirst;
+ if ( rStyleName.Len() )
+ {
+ while ( pFontInfo )
+ {
+ if ( (eWeight == pFontInfo->GetWeight()) &&
+ (eItalic == pFontInfo->GetItalic()) )
+ {
+ bNotSynthetic = TRUE;
+ break;
+ }
+
+ pFontInfo = pFontInfo->mpNext;
+ }
+
+ if ( !bNotSynthetic )
+ {
+ bNoneAvailable = TRUE;
+
+ // Testen, ob es ein syntetischer Style ist
+ if ( eMinWeight <= WEIGHT_NORMAL )
+ {
+ if ( (rStyleName == maNormal) || (rStyleName == maLight) ||
+ (rStyleName == maNormalItalic) || (rStyleName == maLightItalic) )
+ bNoneAvailable = FALSE;
+ }
+
+ if ( (rStyleName == maBold) || (rStyleName == maBlack) ||
+ (rStyleName == maBoldItalic) || (rStyleName == maBlackItalic) )
+ bNoneAvailable = FALSE;
+ }
+ }
+ else
+ bNotSynthetic = TRUE;
+
+ if ( bNoneAvailable )
+ {
+ XubString aEmptryStr;
+ return aEmptryStr;
+ }
+ else if ( !bNotSynthetic )
+ {
+ if ( !maMapStyleNotAvailable.Len() )
+ ((FontList*)this)->maMapStyleNotAvailable = XubString( SvtResId( STR_SVT_FONTMAP_STYLENOTAVAILABLE ) );
+ return maMapStyleNotAvailable;
+ }
+ else
+ {
+ /* Size not available not implemented yet
+ if ( !(nType & FONTLIST_FONTNAMETYPE_SCALABLE) )
+ {
+ ...
+ {
+ if ( !maMapSizeNotAvailable.Len() )
+ ((FontList*)this)->maMapSizeNotAvailable = XubString( SvtResId( STR_SVT_FONTMAP_SIZENOTAVAILABLE ) );
+ return maMapSizeNotAvailable;
+ }
+ }
+ */
+
+
+ if ( !maMapBoth.Len() )
+ ((FontList*)this)->maMapBoth = XubString( SvtResId( STR_SVT_FONTMAP_BOTH ) );
+ return maMapBoth;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT FontList::GetFontNameType( const XubString& rFontName ) const
+{
+ ImplFontListNameInfo* pData = ImplFindByName( rFontName );
+ if ( pData )
+ return pData->mnType;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+FontInfo FontList::Get( const XubString& rName, const XubString& rStyleName ) const
+{
+ ImplFontListNameInfo* pData = ImplFindByName( rName );
+ ImplFontListFontInfo* pFontInfo = NULL;
+ ImplFontListFontInfo* pFontNameInfo = NULL;
+ if ( pData )
+ {
+ ImplFontListFontInfo* pSearchInfo = pData->mpFirst;
+ pFontNameInfo = pSearchInfo;
+ while ( pSearchInfo )
+ {
+ if ( rStyleName == GetStyleName( *pSearchInfo ) )
+ {
+ pFontInfo = pSearchInfo;
+ break;
+ }
+
+ pSearchInfo = pSearchInfo->mpNext;
+ }
+ }
+
+ // Konnten die Daten nicht gefunden werden, dann muessen bestimmte
+ // Attribute nachgebildet werden
+ if ( !pFontInfo )
+ {
+ FontInfo aInfo;
+
+ // Falls der Fontname stimmt, uebernehmen wir soviel wie moeglich
+ if ( pFontNameInfo )
+ aInfo = *pFontNameInfo;
+ else
+ aInfo.SetName( rName );
+ aInfo.SetStyleName( rStyleName );
+
+ if ( rStyleName == maNormal )
+ {
+ aInfo.SetItalic( ITALIC_NONE );
+ aInfo.SetWeight( WEIGHT_NORMAL );
+ }
+ else if ( rStyleName == maNormalItalic )
+ {
+ aInfo.SetItalic( ITALIC_NORMAL );
+ aInfo.SetWeight( WEIGHT_NORMAL );
+ }
+ else if ( rStyleName == maBold )
+ {
+ aInfo.SetItalic( ITALIC_NONE );
+ aInfo.SetWeight( WEIGHT_BOLD );
+ }
+ else if ( rStyleName == maBoldItalic )
+ {
+ aInfo.SetItalic( ITALIC_NORMAL );
+ aInfo.SetWeight( WEIGHT_BOLD );
+ }
+ else if ( rStyleName == maLight )
+ {
+ aInfo.SetItalic( ITALIC_NONE );
+ aInfo.SetWeight( WEIGHT_LIGHT );
+ }
+ else if ( rStyleName == maLightItalic )
+ {
+ aInfo.SetItalic( ITALIC_NORMAL );
+ aInfo.SetWeight( WEIGHT_LIGHT );
+ }
+ else if ( rStyleName == maBlack )
+ {
+ aInfo.SetItalic( ITALIC_NONE );
+ aInfo.SetWeight( WEIGHT_BLACK );
+ }
+ else if ( rStyleName == maBlackItalic )
+ {
+ aInfo.SetItalic( ITALIC_NORMAL );
+ aInfo.SetWeight( WEIGHT_BLACK );
+ }
+ else
+ {
+ aInfo.SetItalic( ITALIC_NONE );
+ aInfo.SetWeight( WEIGHT_DONTKNOW );
+ }
+
+ return aInfo;
+ }
+ else
+ return *pFontInfo;
+}
+
+// -----------------------------------------------------------------------
+
+FontInfo FontList::Get( const XubString& rName,
+ FontWeight eWeight, FontItalic eItalic ) const
+{
+ ImplFontListNameInfo* pData = ImplFindByName( rName );
+ ImplFontListFontInfo* pFontInfo = NULL;
+ ImplFontListFontInfo* pFontNameInfo = NULL;
+ if ( pData )
+ {
+ ImplFontListFontInfo* pSearchInfo = pData->mpFirst;
+ pFontNameInfo = pSearchInfo;
+ while ( pSearchInfo )
+ {
+ if ( (eWeight == pSearchInfo->GetWeight()) &&
+ (eItalic == pSearchInfo->GetItalic()) )
+ {
+ pFontInfo = pSearchInfo;
+ break;
+ }
+
+ pSearchInfo = pSearchInfo->mpNext;
+ }
+ }
+
+ // Konnten die Daten nicht gefunden werden, dann muessen bestimmte
+ // Attribute nachgebildet werden
+ if ( !pFontInfo )
+ {
+ FontInfo aInfo;
+
+ // Falls der Fontname stimmt, uebernehmen wir soviel wie moeglich
+ if ( pFontNameInfo )
+ {
+ aInfo = *pFontNameInfo;
+ aInfo.SetStyleName( XubString() );
+ }
+ else
+ aInfo.SetName( rName );
+
+ aInfo.SetWeight( eWeight );
+ aInfo.SetItalic( eItalic );
+ return aInfo;
+ }
+ else
+ return *pFontInfo;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL FontList::IsAvailable( const XubString& rName ) const
+{
+ return (ImplFindByName( rName ) != 0);
+}
+
+// -----------------------------------------------------------------------
+
+const FontInfo& FontList::GetFontName( USHORT nFont ) const
+{
+ DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontName(): nFont >= Count" );
+
+ ImplFontListNameInfo* pData = (ImplFontListNameInfo*)List::GetObject( nFont );
+ return *(pData->mpFirst);
+}
+
+// -----------------------------------------------------------------------
+
+USHORT FontList::GetFontNameType( USHORT nFont ) const
+{
+ DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontNameType(): nFont >= Count" );
+
+ ImplFontListNameInfo* pData = (ImplFontListNameInfo*)List::GetObject( nFont );
+ return pData->mnType;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Handle FontList::GetFirstFontInfo( const XubString& rName ) const
+{
+ ImplFontListNameInfo* pData = ImplFindByName( rName );
+ if ( !pData )
+ return (sal_Handle)NULL;
+ else
+ return (sal_Handle)pData->mpFirst;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Handle FontList::GetNextFontInfo( sal_Handle hFontInfo ) const
+{
+ ImplFontListFontInfo* pInfo = (ImplFontListFontInfo*)(void*)hFontInfo;
+ return (sal_Handle)(pInfo->mpNext);
+}
+
+// -----------------------------------------------------------------------
+
+const FontInfo& FontList::GetFontInfo( sal_Handle hFontInfo ) const
+{
+ ImplFontListFontInfo* pInfo = (ImplFontListFontInfo*)(void*)hFontInfo;
+ return *pInfo;
+}
+
+// -----------------------------------------------------------------------
+
+const long* FontList::GetSizeAry( const FontInfo& rInfo ) const
+{
+ // Size-Array vorher loeschen
+ if ( mpSizeAry )
+ {
+ delete ((FontList*)this)->mpSizeAry;
+ ((FontList*)this)->mpSizeAry = NULL;
+ }
+
+ // Falls kein Name, dann Standardgroessen
+ if ( !rInfo.GetName().Len() )
+ return aStdSizeAry;
+
+ // Zuerst nach dem Fontnamen suchen um das Device dann von dem
+ // entsprechenden Font zu nehmen
+ OutputDevice* pDevice = mpDev;
+ ImplFontListNameInfo* pData = ImplFindByName( rInfo.GetName() );
+ if ( pData )
+ pDevice = pData->mpFirst->GetDevice();
+
+ USHORT nDevSizeCount = pDevice->GetDevFontSizeCount( rInfo );
+ if ( !nDevSizeCount ||
+ (pDevice->GetDevFontSize( rInfo, 0 ).Height() == 0) )
+ return aStdSizeAry;
+
+ MapMode aOldMapMode = pDevice->GetMapMode();
+ MapMode aMap( MAP_10TH_INCH, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) );
+ pDevice->SetMapMode( aMap );
+
+ USHORT i;
+ USHORT nRealCount = 0;
+ long nOldHeight = 0;
+ ((FontList*)this)->mpSizeAry = new long[nDevSizeCount+1];
+ for ( i = 0; i < nDevSizeCount; i++ )
+ {
+ Size aSize = pDevice->GetDevFontSize( rInfo, i );
+ if ( aSize.Height() != nOldHeight )
+ {
+ nOldHeight = aSize.Height();
+ ((FontList*)this)->mpSizeAry[nRealCount] = nOldHeight;
+ nRealCount++;
+ }
+ }
+ ((FontList*)this)->mpSizeAry[nRealCount] = 0;
+
+ pDevice->SetMapMode( aOldMapMode );
+ return mpSizeAry;
+}
+
+// -----------------------------------------------------------------------
+
+const long* FontList::GetStdSizeAry()
+{
+ return aStdSizeAry;
+}
+
+
diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src
new file mode 100644
index 000000000000..2ae746c57295
--- /dev/null
+++ b/svtools/source/control/ctrltool.src
@@ -0,0 +1,425 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrltool.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "svtools.hrc"
+
+String STR_SVT_STYLE_LIGHT
+{
+ Text = "Light" ;
+ Text [ ENGLISH ] = "Light" ;
+ Text [ english_us ] = "Light" ;
+ Text [ italian ] = "Light" ;
+ Text [ spanish ] = "Light" ;
+ Text [ french ] = "Estompé" ;
+ Text [ dutch ] = "Light" ;
+ Text [ swedish ] = "Ljus" ;
+ Text [ danish ] = "Light" ;
+ Text [ portuguese_brazilian ] = "Light" ;
+ Text [ portuguese ] = "Claro" ;
+ Text[ russian ] = "Òîíêèé";
+ Text[ polish ] = "Light";
+ Text[ japanese ] = "׎š";
+ Text[ chinese_simplified ] = "ϸ";
+ Text[ chinese_traditional ] = "²Ó";
+ Text[ arabic ] = "ÝÇÊÍ";
+ Text[ greek ] = "Áðáëü";
+ Text[ korean ] = "Light";
+ Text[ turkish ] = "Ýnce";
+ Text[ language_user1 ] = " ";
+};
+
+String STR_SVT_STYLE_LIGHT_ITALIC
+{
+ Text = "Light Kursiv" ;
+ Text [ ENGLISH ] = "Light Italic" ;
+ Text [ english_us ] = "Light Italic" ;
+ Text [ italian ] = "Corsivo Light" ;
+ Text [ spanish ] = "Cursiva light" ;
+ Text [ french ] = "Italique estompé" ;
+ Text [ dutch ] = "Light Cursief" ;
+ Text [ swedish ] = "Ljus kursiv" ;
+ Text [ danish ] = "Light kursiv" ;
+ Text [ portuguese_brazilian ] = "Light Italic" ;
+ Text [ portuguese ] = "Itálico claro" ;
+ Text[ russian ] = "Òîíêèé êóðñèâ";
+ Text[ polish ] = "Kursywa light";
+ Text[ japanese ] = "׎š ŽÎ‘Ì";
+ Text[ chinese_simplified ] = "ϸбÌå";
+ Text[ chinese_traditional ] = "²Ó±×Åé";
+ Text[ arabic ] = "ÝÇÊÍ ãÇÆá";
+ Text[ greek ] = "ÐëÜãéá ÁðáëÜ";
+ Text[ korean ] = "°¡º­¿î ÀÌÅŸ¯Ã¼";
+ Text[ turkish ] = "Ýnce italik";
+ Text[ language_user1 ] = " ";
+};
+
+String STR_SVT_STYLE_NORMAL
+{
+ Text = "Standard" ;
+ Text [ ENGLISH ] = "Regular" ;
+ Text [ english_us ] = "Regular" ;
+ Text [ italian ] = "Standard" ;
+ Text [ spanish ] = "Predeterminado" ;
+ Text [ french ] = "Normal" ;
+ Text [ dutch ] = "Normaal" ;
+ Text [ swedish ] = "Normal" ;
+ Text [ danish ] = "Normal" ;
+ Text [ portuguese_brazilian ] = "Normal" ;
+ Text [ portuguese ] = "Padrão" ;
+ Text[ russian ] = "Ñòàíäàðò";
+ Text[ polish ] = "Standard";
+ Text[ japanese ] = "•W€";
+ Text[ chinese_simplified ] = "±ê×¼";
+ Text[ chinese_traditional ] = "¼Ð·Ç";
+ Text[ arabic ] = "ÞíÇÓí";
+ Text[ greek ] = "ÐñïåðéëïãÞ";
+ Text[ korean ] = "º¸Åë";
+ Text[ turkish ] = "Normal";
+ Text[ language_user1 ] = " ";
+};
+
+String STR_SVT_STYLE_NORMAL_ITALIC
+{
+ Text = "Kursiv" ;
+ Text [ ENGLISH ] = "Italic" ;
+ Text [ english_us ] = "Italic" ;
+ Text [ italian ] = "Corsivo" ;
+ Text [ spanish ] = "Cursiva" ;
+ Text [ french ] = "Italique" ;
+ Text [ dutch ] = "Cursief" ;
+ Text [ swedish ] = "Kursiv" ;
+ Text [ danish ] = "Kursiv" ;
+ Text [ portuguese_brazilian ] = "Italic" ;
+ Text [ portuguese ] = "Itálico" ;
+ Text[ russian ] = "Êóðñèâ";
+ Text[ polish ] = "Kursywa";
+ Text[ japanese ] = "ŽÎ‘Ì";
+ Text[ chinese_simplified ] = "бÌå";
+ Text[ chinese_traditional ] = "±×Åé";
+ Text[ arabic ] = "ãÇÆá";
+ Text[ greek ] = "ÐëÜãéá";
+ Text[ korean ] = "±â¿ïÀÓ²Ã";
+ Text[ turkish ] = "Ýtalik";
+ Text[ language_user1 ] = " ";
+};
+
+String STR_SVT_STYLE_BOLD
+{
+ Text = "Fett" ;
+ Text [ ENGLISH ] = "Bold" ;
+ Text [ english_us ] = "Bold" ;
+ Text [ italian ] = "Grassetto" ;
+ Text [ spanish ] = "Negrita" ;
+ Text [ french ] = "Gras" ;
+ Text [ dutch ] = "Vet" ;
+ Text [ swedish ] = "Fet" ;
+ Text [ danish ] = "Fed" ;
+ Text [ portuguese_brazilian ] = "Bold" ;
+ Text [ portuguese ] = "Negrito" ;
+ Text[ russian ] = "Æèðíûé";
+ Text[ polish ] = "Pogrubienie";
+ Text[ japanese ] = "‘¾Žš";
+ Text[ chinese_simplified ] = "´ÖÌå";
+ Text[ chinese_traditional ] = "²ÊÅé";
+ Text[ arabic ] = "ÚÑíÖ";
+ Text[ greek ] = "¸íôïíï";
+ Text[ korean ] = "±½°Ô";
+ Text[ turkish ] = "Kalýn";
+ Text[ language_user1 ] = " ";
+};
+
+String STR_SVT_STYLE_BOLD_ITALIC
+{
+ Text = "Fett Kursiv" ;
+ Text [ ENGLISH ] = "Bold Italic" ;
+ Text [ english_us ] = "Bold Italic" ;
+ Text [ italian ] = "Corsivo Grassetto" ;
+ Text [ spanish ] = "Cursiva negrita" ;
+ Text [ french ] = "Italique gras" ;
+ Text [ dutch ] = "Vet Cursief" ;
+ Text [ swedish ] = "Fet kursiv" ;
+ Text [ danish ] = "Fed kursiv" ;
+ Text [ portuguese_brazilian ] = "Bold Italic" ;
+ Text [ portuguese ] = "Negrito itálico" ;
+ Text[ russian ] = "Æèðíûé êóðñèâ";
+ Text[ polish ] = "Pogrubiona kursywa";
+ Text[ japanese ] = "‘¾Žš‚̎ΑÌ";
+ Text[ chinese_simplified ] = "´ÖбÌå";
+ Text[ chinese_traditional ] = "²Ê±×Åé";
+ Text[ arabic ] = "ÚÑíÖ ãÇÆá";
+ Text[ greek ] = "ÐëÜãéá ¸íôïíá";
+ Text[ korean ] = "±½Àº ÀÌÅŸ¯Ã¼";
+ Text[ turkish ] = "Kalýn italik";
+ Text[ language_user1 ] = " ";
+};
+
+String STR_SVT_STYLE_BLACK
+{
+ Text = "Black" ;
+ Text [ ENGLISH ] = "Black" ;
+ Text [ english_us ] = "Black" ;
+ Text [ italian ] = "Black" ;
+ Text [ spanish ] = "Black" ;
+ Text [ french ] = "Extra gras" ;
+ Text [ dutch ] = "Black" ;
+ Text [ swedish ] = "Svart" ;
+ Text [ danish ] = "Black" ;
+ Text [ portuguese_brazilian ] = "Black" ;
+ Text [ portuguese ] = "Preto" ;
+ Text[ russian ] = "×åðíûé";
+ Text[ polish ] = "Czarny";
+ Text[ japanese ] = "•";
+ Text[ chinese_simplified ] = "ºÚÌå";
+ Text[ language_user1 ] = " ";
+ Text[ chinese_traditional ] = "¶ÂÅé";
+ Text[ arabic ] = "ÃÓæÏ";
+ Text[ greek ] = "Ìáýñï";
+ Text[ korean ] = "°Ë°Ô";
+ Text[ turkish ] = "Siyah";
+};
+
+String STR_SVT_STYLE_BLACK_ITALIC
+{
+ Text = "Black Kursiv" ;
+ Text [ ENGLISH ] = "Black Italic" ;
+ Text [ english_us ] = "Black Italic" ;
+ Text [ italian ] = "Corsivo Black" ;
+ Text [ spanish ] = "Cursiva black" ;
+ Text [ french ] = "Italique extra gras" ;
+ Text [ dutch ] = "Black Cursief" ;
+ Text [ swedish ] = "Svart kursiv" ;
+ Text [ danish ] = "Black kursiv" ;
+ Text [ portuguese_brazilian ] = "Black Italic" ;
+ Text [ portuguese ] = "Preto itálico" ;
+ Text[ russian ] = "×åðíûé êóðñèâ";
+ Text[ polish ] = "Czarna kursywa";
+ Text[ japanese ] = "•‚̎ΑÌ";
+ Text[ chinese_simplified ] = "ºÚбÌå";
+ Text[ language_user1 ] = " ";
+ Text[ chinese_traditional ] = "¶Â±×Åé";
+ Text[ arabic ] = "ÃÓæÏ ãÇÆá";
+ Text[ greek ] = "ÐëÜãéá Ìáýñï";
+ Text[ korean ] = "°ËÁ¤ ÀÌÅŸ¯Ã¼";
+ Text[ turkish ] = "Siyah italik";
+};
+
+/*
+Finnische Texte:
+ "Light",
+ "Light Kursivoitu",
+ "Normaali",
+ "Kursivoitu",
+ "Lihavoitu",
+ "Lihavoitu Kursivoitu",
+ "Black",
+ "Black Kursivoitu"
+*/
+
+String STR_SVT_FONTMAP_BOTH
+{
+ TEXT = "Für Ausdruck und Anzeige am Bildschirm wird die gleiche Schriftart verwendet." ;
+ TEXT [ English ] = "The same font will be used on both your printer and your screen." ;
+ TEXT [ norwegian ] = "The same font will be used on both your printer and your screen." ;
+ TEXT [ italian ] = "Questo tipo di carattere verrà utilizzato sia per lo schermo che per la stampante." ;
+ TEXT [ portuguese_brazilian ] = "Esta mesma fonte ser utilizada na impressora e na tela." ;
+ TEXT [ portuguese ] = "O tipo de letra utilizado para a impressora e para o ecrã é o mesmo." ;
+ TEXT [ finnish ] = "Tätä fonttia voidaan käyttää kirjoittimessa ja näytössä." ;
+ TEXT [ danish ] = "Denne skrifttype vil blive brugt både på skærmen og på printeren." ;
+ TEXT [ french ] = "La même police est utilisée pour l'impression et l'affichage à l'écran." ;
+ TEXT [ swedish ] = "Samma teckensnitt används för både skrivare och bildskärm." ;
+ TEXT [ dutch ] = "Dit lettertype wordt voor zowel de printer als het scherm gebruikt." ;
+ TEXT [ spanish ] = "Se usará la misma fuente en la impresora y en pantalla" ;
+ TEXT [ english_us ] = "The same font will be used on both your printer and your screen." ;
+ TEXT[ chinese_simplified ] = "ÆÁÄ»ÏÔʾºÍ´òӡʹÓÃͬһÖÖ×ÖÌå¡£";
+ TEXT[ russian ] = "Äëÿ ïå÷àòè è âûâîäà íà ýêðàí èñïîëüçóåòñÿ îäèí è òîò æå øðèôò";
+ TEXT[ polish ] = "U¿yj tej samej czcionki dla wydruku i ekranu";
+ TEXT[ japanese ] = "ˆóü‚Ɖæ–Ê•\\Ž¦‚É‚Í“¯‚¶Ì«ÝÄ‚ÌŽí—Þ‚ªŽg—p‚³‚ê‚Ä‚¢‚Ü‚·B";
+ TEXT[ chinese_traditional ] = "¿Ã¹õÅã¥Ü©M¦C¦L¨Ï¥Î²Î¤@ªº¦r«¬";
+ TEXT[ arabic ] = "ÓæÝ íÊã ÇÓÊÎÏÇã äÝÓ ÇáÎØ ááØÇÈÚÉ æÇáÔÇÔÉ.";
+ TEXT[ greek ] = "Ç ãñáììáôïóåéñÜ áõôÞ èá ÷ñçóéìïðïéçèåß ãéá ôçí ïèüíç êáé ãéá ôïí åêôõðùôÞ.";
+ TEXT[ korean ] = "´ç½ÅÀÇ ½Ã½ºÅÛ°ú È­¸é¿¡´Â °°Àº ±Û²ÃÀÌ »ç¿ëµÉ °Í ÀÔ´Ï´Ù.";
+ TEXT[ turkish ] = "Yazdýrma ve ekranda görüntüleme için ayný yazýtipi kullanýlacak.";
+ TEXT[ language_user1 ] = " ";
+};
+
+String STR_SVT_FONTMAP_PRINTERONLY
+{
+ TEXT = "Druckerschrift. Die Bildschirmanzeige kann etwas abweichen." ;
+ TEXT [ English ] = "This is a printer font. The screen image may not exactly match." ;
+ TEXT [ norwegian ] = "This is a printer font. The screen image may not exactly match." ;
+ TEXT [ italian ] = "Il tipo di carattere visualizzato differisce da quello stampato." ;
+ TEXT [ portuguese_brazilian ] = "Esta é uma fonte de impressora. A imagem na tela pode não corresponder exatamente." ;
+ TEXT [ portuguese ] = "Letra de impressora. A letra vista no ecrã pode apresentar um pequeno desvio." ;
+ TEXT [ finnish ] = "Tämä on kirjoitinfontti. Näytön sisältö ei ehkä ole aivan samanlainen." ;
+ TEXT [ danish ] = "Dette er en printerskrifttype. Skærmbilledet svarer muligvis ikke helt til printerskrifttypen." ;
+ TEXT [ french ] = "Police d'imprimante. L'affichage et l'impression ne seront pas toujours identiques." ;
+ TEXT [ swedish ] = "Detta är ett skrivarteckensnitt. Visningen på skärmbilden kan avvika något." ;
+ TEXT [ dutch ] = "Dit is een printerlettertype. De weergave op het scherm kan iets afwijken." ;
+ TEXT [ spanish ] = "Fuente de impresora. La imagen en pantalla podría ser diferente." ;
+ TEXT [ english_us ] = "This is a printer font. The screen image may differ." ;
+ TEXT[ chinese_simplified ] = "ÕâÊÇ´òÓ¡×ÖÌå¡£ÆÁÄ»ÏÔʾµÄ×ÖÌåÓëÆä¿ÉÄÜ»áÓÐЩƫ²î¡£";
+ TEXT[ russian ] = "Øðèôò ïå÷àòè. Íà ýêðàíå ìîæåò íåìíîãî îòëè÷àòüñÿ.";
+ TEXT[ polish ] = "Czcionka drukarkowa. Obraz czcionek na ekranie mo¿e siê trochê ró¿niæ.";
+ TEXT[ japanese ] = "ÌßØÝÀ—p‚ÌÌ«ÝÄ‚Å‚·B‰æ–Ê•\\Ž¦‚Æ‚Í­‚µˆÙ‚È‚è‚Ü‚·B";
+ TEXT[ chinese_traditional ] = "¦C¦L¦r«¬¡C¿Ã¹õÅã¥Ü¦r«¬¥i¯à²¤·L¦³¨Ç°¾®t¡C";
+ TEXT[ arabic ] = "åÐÇ ÎØ ÇáØÇÈÚÉ. ÞÏ íÎÊáÝ ÇáãÙåÑ Úáì ÇáÔÇÔÉ ÈÚÖ ÇáÔÆ.";
+ TEXT[ greek ] = "ÃñáììáôïóåéñÜ åêôõðùôÞ. Ç åìöÜíéóç ôçò óôçí ïèüíç åßíáé äõíáôüí íá äéáöÝñåé.";
+ TEXT[ korean ] = "ÀÌ°ÍÀº Àμ⠱۲ÃÀÔ´Ï´Ù. È­¸éÀÇ À̹ÌÁö¿Í´Â ´Ù¸¦°Í ÀÔ´Ï´Ù.";
+ TEXT[ turkish ] = "Yazýcý yazýtipi. Ekrandaki görüntü biraz farklý olabilir.";
+};
+
+String STR_SVT_FONTMAP_SCREENONLY
+{
+ TEXT = "Bildschirmschrift. Der Ausdruck kann etwas abweichen." ;
+ TEXT [ English ] = "This is a screen font. The printer image may not exactly match." ;
+ TEXT [ norwegian ] = "This is a screen font. The printer image may not exactly match." ;
+ TEXT [ italian ] = "Questo è un carattere per lo schermo. La stampa può essere leggermente diversa." ;
+ TEXT [ portuguese_brazilian ] = "Esta é uma fonte de tela. A imagem impressa pode não corresponder exatamente." ;
+ TEXT [ portuguese ] = "Letra de ecrã. A letra impressa pode apresentar um pequeno desvio." ;
+ TEXT [ finnish ] = "Tämä on näyttöfontti. Tulosteen sisältö ei ehkä ole aivan samanlainen." ;
+ TEXT [ danish ] = "Dette er en skærmskrifttype. Udskriften kan muligvis afvige lidt." ;
+ TEXT [ french ] = "Police d'écran. L'impression et l'affichage ne seront pas toujours identiques." ;
+ TEXT [ swedish ] = "Detta är ett skärmteckensnitt. Utskriften kan vara lätt avvikande." ;
+ TEXT [ dutch ] = "Dit is een schermlettertype. De afdruk kan iets afwijken." ;
+ TEXT [ spanish ] = "Fuente de pantalla. La imagen en la impresora podría ser diferente." ;
+ TEXT [ english_us ] = "This is a screen font. The printer image may differ." ;
+ TEXT[ chinese_simplified ] = "ÕâÊÇÆÁÄ»×ÖÌå¡£´òÓ¡³öÀ´µÄ×ÖÌåÓëÆä¿ÉÄÜ»áÓÐһЩƫ²î¡£";
+ TEXT[ russian ] = "Øðèôò ýêðàíà.  ïå÷àòè ìîãóò áûòü îòêëîíåíèÿ.";
+ TEXT[ polish ] = "To jest czcionka ekranowa. Wydruk bêdzie siê trochê ró¿ni³.";
+ TEXT[ japanese ] = "‰æ–Ê—p‚ÌÌ«ÝÄ‚Å‚·Bˆóü²Ò°¼Þ‚Æ‚Í­‚µˆÙ‚È‚è‚Ü‚·B";
+ TEXT[ chinese_traditional ] = "¿Ã¹õ¦r«¬¡C¦C¦L¥X¥i¯à·|¦³¤@¨Ç°¾®t¡C";
+ TEXT[ arabic ] = "åÐÇ ÎØ ÔÇÔÉ. ÞÏ íÎÊáÝ ÇáãÙåÑ Úáì ÇáæÑÞ ÇáãØÈæÚ ÈÚÖ ÇáÔÆ.";
+ TEXT[ greek ] = "ÃñáììáôïóåéñÜ ïèüíçò. Ç åìöÜíéóç ôçò óôçí åêôýðùóç åßíáé äõíáôüí íá äéáöÝñåé.";
+ TEXT[ korean ] = "ÀÌ°ÍÀº È­¸é ÆùÆ® ÀÔ´Ï´Ù. Àμâ À̹ÌÁö¿Í´Â ´Ù¸¦ °Í ÀÔ´Ï´Ù.";
+ TEXT[ turkish ] = "Ekran yazýtipi. Yazdýrma biraz farklý olabilir.";
+};
+
+String STR_SVT_FONTMAP_SIZENOTAVAILABLE
+{
+ TEXT = "Diese Schriftgröße ist nicht installiert. Die am besten passende vorhandene Größe wird benutzt." ;
+ TEXT [ English ] = "This font size is not installed. The closest available size will be used." ;
+ TEXT[ english_us ] = "This font size has not been installed. The closest available size will be used.";
+ TEXT[ portuguese ] = "Este tamanho de letra não está instalado. Será utilizado o tamanho disponível mais adequado.";
+ TEXT[ russian ] = "Òàêîé ðàçìåð øðèôòà íå èíñòàëëèðîâàí. Ïîýòîìó áóäåò èñïîëüçîâàí íàèáîëåå ïîäõîäÿùèé ðàçìåð.";
+ TEXT[ greek ] = "Ôï ìÝãåèïò ôçò ãñáììáôïóåéñÜò äåí Ý÷åé åãêáôáóôáèåß. ×ñçóéìïðïéåßôáé ôï ðëçóéÝóôåñï ìÝãåèïò.";
+ TEXT[ dutch ] = "Deze schriftgrootte is niet geïnstalleerd. De meest passende voorhanden zijnde grootte wordt toegepast.";
+ TEXT[ french ] = "Cette taille de police n'a pas été installée. La taille disponible la plus appropriée va être utilisée.";
+ TEXT[ spanish ] = "Este tamaño de fuente no está instalado. Se usará el tamaño disponible más adecuado.";
+ TEXT[ italian ] = "Il font delle dimensioni indicate non è installato. Il programma utilizzerà le dimensioni disponibili.";
+ TEXT[ danish ] = "Denne skriftstørrelse er ikke installeret. Den tilgængelige størrelse, som passer bedst, vil blive brugt i stedet.";
+ TEXT[ swedish ] = "Den här teckenstorleken är inte installerad. Den tillgängliga storlek som passar bäst används.";
+ TEXT[ polish ] = "Dany rozmiar czcionki nie jest zaistalowany. U¿yty zostanie najbardziej pasuj¹cy, ju¿ istniej¹ca rozmiar.";
+ TEXT[ portuguese_brazilian ] = "This font size is not installed. The closest available size will be used.";
+ TEXT[ japanese ] = "‚±‚ÌÌ«ÝÄ»²½Þ‚Ͳݽİق³‚ê‚Ä‚¢‚Ü‚¹‚ñBÅ‚à“KØ‚È»²½Þ‚ª‘I‚΂ê‚Ü‚·B";
+ TEXT[ korean ] = "ÀÌ ±Û²ÃÀÇ Å©±â´Â ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù. À¯È¿ÇÑ °¡Àå À¯»çÇÑ Å©±â°¡ »ç¿ëµÉ°Í ÀÔ´Ï´Ù.";
+ TEXT[ chinese_simplified ] = "ûÓа²×°ÕâÖÖ×ÖÌå´óС¡£Ê¹ÓõÄÊÇÏÖÓеÄ×î½Ó½üµÄ×ÖÌå´óС¡£";
+ TEXT[ chinese_traditional ] = "¨S¦³¦w¸Ë³o­Ó¦r«¬¡C±Ä¥Î³Ìªñ¦üªº¦r«¬¡C";
+ TEXT[ arabic ] = "ÍÌã ÇáÎØ åÐÇ ÛíÑ ãËÈÊ. ÓæÝ íÊã ÇÓÊÎÏÇã ÃßËÑ ÇáÃÍÌÇã ÇáãæÌæÏÉ ÞÑÈÇð áå.";
+ TEXT[ turkish ] = "Bu yazýtipi boyu yüklenmedi. Mevcut boylardan en uygun olaný kullanýlacak.";
+};
+
+String STR_SVT_FONTMAP_STYLENOTAVAILABLE
+{
+ TEXT = "Dieser Schriftstil wird nachgebildet oder der am besten passende Stil wird verwendet." ;
+ TEXT [ English ] = "This font style will be generated or the closest matching style will be used." ;
+ TEXT[ english_us ] = "This font style will be simulated or the closest matching style will be used.";
+ TEXT[ portuguese ] = "Este estilo de letra será simulado ou será utilizado o estilo disponível mais adequado.";
+ TEXT[ russian ] = "Áóäåò ñîçäàí ëèáî òàêîé ñòèëü øðèôòà, ëèáî áóäåò èñïîëüçîâàí íàèáîëåå ïîõîæèé.";
+ TEXT[ greek ] = "Ôï óôõë áõôü ãñáììáôïóåéñÜò èá áíôéãñáöåß Þ èá ÷ñçóéìïðïéçèåß ôï ðëçóéÝóôåñï óôõë..";
+ TEXT[ dutch ] = "Dit lettertype wordt nagebootst of het meest overeenkomende voorhanden zijnde type wordt gebruikt.";
+ TEXT[ french ] = "Ce style de police sera imité ou le style le plus approprié sera utilisé.";
+ TEXT[ spanish ] = "Se imitará este estilo de fuente o se usará el más adecuado.";
+ TEXT[ italian ] = "Verrà riprodotto lo stile di questo font oppure verrà utilizzato quello che gli è più simile.";
+ TEXT[ danish ] = "Denne skrifttype bliver reproduceret eller den type, som passer bedst, vil blive brugt istedet.";
+ TEXT[ swedish ] = "Det här teckensnittet efterbildas eller närmast motsvarande teckensnitt används.";
+ TEXT[ polish ] = "Dany styl czcionki zostanie skopiowany lub zostanie u¿yty najlepiej pasuj¹cy styl.";
+ TEXT[ portuguese_brazilian ] = "This font style will be generated or the closest matching style will be used.";
+ TEXT[ japanese ] = "‚±‚ÌÌ«ÝĽÀ²Ù‚ÍC³‚³‚ê‚é‚©A‚Ü‚½‚ÍÅ‚à“K؂ȽÀ²Ù‚ªŽg—p‚³‚ê‚Ü‚·B";
+ TEXT[ korean ] = "ÀÌ ±Û²Ãü¿¡ °¡Àå À¯»çÇÑ ±Û²Ãü°¡ »ç¿ëµÉ°Í ÀÔ´Ï´Ù.";
+ TEXT[ chinese_simplified ] = "Éú³ÉÕâÖÖ×ÖÌå»òʹÓÃ×î½Ó½üµÄ×ÖÌå¡£";
+ TEXT[ chinese_traditional ] = "¼Ò¥é³o­Ó¦r«¬©Î±Ä¥Î³Ìªñ¦üªº¦r«¬¡C";
+ TEXT[ arabic ] = "ÓæÝ íÊã ÊÞáíÏ äãØ ÇáÎØ åÐÇ¡ Ãæ ÓæÝ íÊã ÇÓÊÎÏÇã ÃÞÑÈ äãØð áå.";
+ TEXT[ turkish ] = "Bu yazýtipi taklit edilecek ya da en uygun olan biçim kullanýlacak.";
+ TEXT[ language_user1 ] = " ";
+};
+
+String STR_SVT_FONTMAP_NOTAVAILABLE
+{
+ TEXT = "Diese Schriftart ist nicht installiert. Die am besten passende vorhandene Schriftart wird benutzt." ;
+ TEXT [ English ] = "This font is not installed. The closest available font will be used." ;
+ TEXT[ english_us ] = "This font has not been installed. The closest available font will be used.";
+ TEXT[ portuguese ] = "Este tipo de letra não está instalado. Será utilizado o tipo de letra disponível mais adequado.";
+ TEXT[ russian ] = "Ýòîò òèï øðèôòà íå èíñòàëëèðîâàí. Ïîýòîìó áóäåò èñïîëüçîâàí îäèí èç íàèáîëåå ïîäõîäÿùèõ.";
+ TEXT[ greek ] = "Ç ãñáììáôïóåéñÜ äåí Ý÷åé åãêáôáóôáèåß. ×ñçóéìïðïéåßôáé ç ðëçóéÝóôåñç (áðü Üðïøç ÷áñáêôçñéóôéêþí) ãñáììáôïóåéñÜ.";
+ TEXT[ dutch ] = "Dit lettertype is niet geïnstalleerd. Het meest overeenkomende voorhanden zijnde type wordt gebruikt.";
+ TEXT[ french ] = "Ce type de police n'a pas été installé. Le type de police le plus approprié va être utilisé.";
+ TEXT[ spanish ] = "Esta fuente no está instalada. Se usará la fuente existente más adecuada.";
+ TEXT[ italian ] = "Questo font non è installato. Il programma utilizzerà il font che gli è più simile.";
+ TEXT[ danish ] = "Denne skrifttype er ikke installeret. Den tilgængelige skrifttype, som passer bedst, vil blive brugt i stedet.";
+ TEXT[ swedish ] = "Det här teckensnittet är inte installerat. Det tillgängliga teckensnitt som passar bäst används.";
+ TEXT[ polish ] = "Dana czcionka nie jest zainstalowana.U¿yta zostanie najbardziej pasuj¹ca, ju¿ istniej¹ca czcionka.";
+ TEXT[ portuguese_brazilian ] = "This font is not installed. The closest available font will be used.";
+ TEXT[ japanese ] = "‚±‚ÌÌ«ÝĂͲݽİق³‚ê‚Ä‚¢‚Ü‚¹‚ñBÅ‚à“KØ‚ÈÌ«ÝÄ‚ª‘I‚΂ê‚Ü‚·B";
+ TEXT[ korean ] = "ÀÌ ±Û²ÃÀº ¼³Ä¡µÇÁö ¾Ê¾Ò½À´Ï´Ù. À¯È¿ÇÑ °¡Àå À¯»çÇÑ ±Û²ÃÀÌ »ç¿ëµÉ°Í ÀÔ´Ï´Ù.";
+ TEXT[ chinese_simplified ] = "ûÓа²×°ÕâÖÖ×ÖÌ塣ʹÓõÄÊÇÏÖÓеÄ×î½Ó½üµÄ×ÖÌå¡£";
+ TEXT[ chinese_traditional ] = "¨S¦³¦w¸Ë³o­Ó¦r«¬¡C±Ä¥Î³Ìªñ¦üªº¦r«¬¡C";
+ TEXT[ arabic ] = "åÐÇ ÇáÎØ ÛíÑ ãËÈÊ. ÓæÝ íÊã ÇÓÊÎÏÇã ÃßËÑ ÇáÎØæØ ÇáãæÌæÏÉ ÞÑÈÇð áå.";
+ TEXT[ turkish ] = "Bu yazýtipi yüklenmedi. Mevcut yazýtiplerinden en uygun olaný kullanýlacak.";
+};
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
new file mode 100644
index 000000000000..e52b4107c3d4
--- /dev/null
+++ b/svtools/source/control/filectrl.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * $RCSfile: filectrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_FIELCTRL_CXX
+
+#ifndef _URLOBJ_HXX //autogen wg. INetURLObject
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _VCL_FILEDLG_HXX
+#include <vcl/filedlg.hxx>
+#endif
+
+#include <filedlg.hxx>
+#include <svtdata.hxx>
+
+#include <filectrl.hxx>
+#include <filectrl.hrc>
+
+#pragma hdrstop
+
+// =======================================================================
+
+FileControl::FileControl( Window* pParent, WinBits nStyle, FileControlMode nFlags ) :
+ Window( pParent, nStyle|WB_DIALOGCONTROL ),
+ maEdit( this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP ),
+ maButton( this, nStyle&(~WB_BORDER)|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ),
+ maButtonText( SvtResId( STR_FILECTRL_BUTTONTEXT ) ),
+ mnFlags( nFlags ),
+ mnInternalFlags( FILECTRL_ORIGINALBUTTONTEXT ),
+ mpVclDlg( 0 ),
+ mpFDlg( 0 )
+{
+ maButton.SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
+ mbOpenDlg = TRUE;
+
+ maButton.Show();
+ maEdit.Show();
+
+ SetCompoundControl( TRUE );
+
+ SetStyle( ImplInitStyle( GetStyle() ) );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits FileControl::ImplInitStyle( WinBits nStyle )
+{
+ if ( !( nStyle & WB_NOTABSTOP ) )
+ {
+ maEdit.SetStyle( (maEdit.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+ maButton.SetStyle( (maButton.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+ }
+ else
+ {
+ maEdit.SetStyle( (maEdit.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+ maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+ }
+
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+
+ if ( !(nStyle & WB_NOBORDER ) )
+ nStyle |= WB_BORDER;
+
+ nStyle &= ~WB_TABSTOP;
+
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+FileControl::~FileControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FileControl::SetText( const XubString& rStr )
+{
+ maEdit.SetText( rStr );
+ if ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN )
+ Resize();
+}
+
+// -----------------------------------------------------------------------
+
+XubString FileControl::GetText() const
+{
+ return maEdit.GetText();
+}
+
+// -----------------------------------------------------------------------
+
+void FileControl::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_ENABLE )
+ {
+ maEdit.Enable( IsEnabled() );
+ maButton.Enable( IsEnabled() );
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ GetEdit().SetZoom( GetZoom() );
+ GetButton().SetZoom( GetZoom() );
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ GetEdit().SetControlFont( GetControlFont() );
+ // Fuer den Button nur die Hoehe uebernehmen, weil in
+ // HTML immer Courier eingestellt wird.
+ Font aFont = GetButton().GetControlFont();
+ aFont.SetSize( GetControlFont().GetSize() );
+ GetButton().SetControlFont( aFont );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ GetEdit().SetControlForeground( GetControlForeground() );
+ GetButton().SetControlForeground( GetControlForeground() );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ GetEdit().SetControlBackground( GetControlBackground() );
+ GetButton().SetControlBackground( GetControlBackground() );
+ }
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void FileControl::Resize()
+{
+ static long ButtonBorder = 10;
+
+ if( mnInternalFlags & FILECTRL_INRESIZE )
+ return;
+ mnInternalFlags |= FILECTRL_INRESIZE;//InResize = TRUE
+
+ Size aOutSz = GetOutputSizePixel();
+ long nButtonTextWidth = maButton.GetTextWidth( maButtonText );
+ if ( (mnInternalFlags & FILECTRL_ORIGINALBUTTONTEXT == 0) ||
+ nButtonTextWidth < aOutSz.Width()/3 &&
+ ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN
+ ? ( maEdit.GetTextWidth( maEdit.GetText() )
+ <= aOutSz.Width() - nButtonTextWidth - ButtonBorder )
+ : TRUE )
+ )
+ {
+ maButton.SetText( maButtonText );
+ }
+ else
+ {
+ XubString aSmallText( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ maButton.SetText( aSmallText );
+ nButtonTextWidth = maButton.GetTextWidth( aSmallText );
+ }
+
+ long nButtonWidth = nButtonTextWidth+ButtonBorder;
+ maEdit.SetPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() );
+ maButton.SetPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() );
+
+ mnInternalFlags &= ~FILECTRL_INRESIZE; //InResize = FALSE
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( FileControl, ButtonHdl, PushButton*, EMPTYARG )
+{
+ XubString aNewText;
+ mpVclDlg = GetpApp()->CreateFileDialog( this, mbOpenDlg ? WB_OPEN : WB_SAVEAS );
+
+ if ( mpVclDlg )
+ {
+ mpVclDlg->SetPath( maEdit.GetText() );
+
+ maDialogCreatedHdl.Call( this );
+
+ if ( mpVclDlg->Execute() )
+ aNewText = mpVclDlg->GetPath();
+ DELETEZ( mpVclDlg );
+ }
+ else
+ {
+ mpFDlg = new FileDialog( this, mbOpenDlg ? WB_OPEN : WB_SAVEAS );
+ mpFDlg->SetPath( maEdit.GetText() );
+
+ maDialogCreatedHdl.Call( this );
+
+ if ( mpFDlg->Execute() )
+ aNewText = mpFDlg->GetPath();
+ DELETEZ( mpFDlg );
+ }
+
+ if ( aNewText.Len() )
+ {
+ INetURLObject aObj( aNewText );
+ if ( aObj.GetProtocol() == INET_PROT_FILE )
+ aNewText = aObj.PathToFileName();
+ SetText( aNewText );
+ maEdit.GetModifyHdl().Call( &maEdit );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void FileControl::GetFocus()
+{
+ maEdit.GrabFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void FileControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ WinBits nOldEditStyle = GetEdit().GetStyle();
+ if ( GetStyle() & WB_BORDER )
+ GetEdit().SetStyle( nOldEditStyle|WB_BORDER );
+ GetEdit().Draw( pDev, rPos, rSize, nFlags );
+ if ( GetStyle() & WB_BORDER )
+ GetEdit().SetStyle( nOldEditStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void FileControl::SetButtonText( const XubString& rStr )
+{
+ mnInternalFlags &= ~FILECTRL_ORIGINALBUTTONTEXT;
+ maButtonText = rStr;
+ Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void FileControl::ResetButtonText()
+{
+ mnInternalFlags |= FILECTRL_ORIGINALBUTTONTEXT;
+ maButtonText = XubString( SvtResId( STR_FILECTRL_BUTTONTEXT ) );
+ Resize();
+}
+
+
diff --git a/svtools/source/control/filectrl.src b/svtools/source/control/filectrl.src
new file mode 100644
index 000000000000..2f56127d657d
--- /dev/null
+++ b/svtools/source/control/filectrl.src
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * $RCSfile: filectrl.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "filectrl.hrc"
+String STR_FILECTRL_BUTTONTEXT
+{
+ Text = "Durchsuchen..." ;
+ Text [ ENGLISH ] = "Browse..." ;
+ Text [ english_us ] = "Browse..." ;
+ Text [ portuguese_brazilian ] = "Durchsuchen..." ;
+ Text [ swedish ] = "Genomsök..." ;
+ Text [ danish ] = "Gennemse..." ;
+ Text [ italian ] = "Sfoglia..." ;
+ Text [ spanish ] = "Examinar..." ;
+ Text [ french ] = "Parcourir..." ;
+ Text [ dutch ] = "Bladeren..." ;
+ Text [ portuguese ] = "Pesquisar..." ;
+ Text[ chinese_simplified ] = "ä¯ÀÀ...";
+ Text[ russian ] = "Îáçîð...";
+ Text[ polish ] = "Przegl¹daj...";
+ Text[ japanese ] = "ŒŸõ...";
+ Text[ chinese_traditional ] = "ÂsÄý...";
+ Text[ arabic ] = "ÇÓÊÚÑÇÖ...";
+ Text[ greek ] = "ÁíáæÞôçóç...";
+ Text[ korean ] = "ã¾Æº¸±â...";
+ Text[ turkish ] = "Tara...";
+};
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
new file mode 100644
index 000000000000..6ddf7ee51eb6
--- /dev/null
+++ b/svtools/source/control/fmtfield.cxx
@@ -0,0 +1,1017 @@
+/*************************************************************************
+ *
+ * $RCSfile: fmtfield.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _ZFORMAT_HXX //autogen
+#include "zformat.hxx"
+#endif
+
+#ifndef _FMTFIELD_HXX_
+#include "fmtfield.hxx"
+#endif // _FMTFIELD_HXX_
+
+//==============================================================================
+// regulaerer Ausdruck, um komplette Zahlen und alles, was waehrend der Eingabe einer kompletten Zahl als Fragment vorkommt,
+// abzudecken :
+// [+/-][{ziffer}*.]*{ziffer}*[,{ziffer}*][e[+/-]{ziffer}*]
+const char __FAR_DATA szNumericInput[] = "_[\\x2D\\x2B]?([0-9]*\\x++)*[0-9]*(\\x##[0-9]*)?(e[\\x2D\\x2B]?[0-9]*)?_";
+ // (die beiden _ sind fuer die Normierung, damit kann ich erzwingen, dass nie ein Teilstring gefunden wird)
+
+//==============================================================================
+SvNumberFormatter* FormattedField::StaticFormatter::s_cFormatter = NULL;
+ULONG FormattedField::StaticFormatter::s_nReferences = 0;
+
+//------------------------------------------------------------------------------
+SvNumberFormatter* FormattedField::StaticFormatter::GetFormatter()
+{
+ if (!s_cFormatter)
+ s_cFormatter = new SvNumberFormatter(Application::GetAppInternational().GetLanguage());
+ return s_cFormatter;
+}
+
+//------------------------------------------------------------------------------
+FormattedField::StaticFormatter::StaticFormatter()
+{
+ ++s_nReferences;
+}
+
+//------------------------------------------------------------------------------
+FormattedField::StaticFormatter::~StaticFormatter()
+{
+ if (--s_nReferences == 0)
+ {
+ delete s_cFormatter;
+ s_cFormatter = NULL;
+ }
+}
+
+//==============================================================================
+DBG_NAME(FormattedField);
+
+#define INIT_MEMBERS() \
+ m_aLastSelection(0,0) \
+ ,m_bStrictFormat(TRUE) \
+ ,m_nFormatKey(0) \
+ ,m_pFormatter(NULL) \
+ ,m_dMinValue(0) \
+ ,m_dMaxValue(0) \
+ ,m_bHasMin(FALSE) \
+ ,m_bHasMax(FALSE) \
+ ,m_dCurrentValue(0) \
+ ,m_bValueDirty(TRUE) \
+ ,m_bEnableEmptyField(TRUE) \
+ ,m_dDefaultValue(0) \
+ ,m_dSpinSize(1) \
+ ,m_dSpinFirst(-1000000) \
+ ,m_dSpinLast(1000000) \
+ ,m_bTreatAsNumber(TRUE) \
+ ,m_pLastOutputColor(NULL)
+
+//------------------------------------------------------------------------------
+FormattedField::FormattedField(Window* pParent, WinBits nStyle, SvNumberFormatter* pInitialFormatter, INT32 nFormatKey)
+ :SpinField(pParent, nStyle)
+ ,INIT_MEMBERS()
+{
+ DBG_CTOR(FormattedField, NULL);
+
+ if (pInitialFormatter)
+ {
+ m_pFormatter = pInitialFormatter;
+ m_nFormatKey = nFormatKey;
+ }
+}
+
+//------------------------------------------------------------------------------
+FormattedField::FormattedField(Window* pParent, const ResId& rResId, SvNumberFormatter* pInitialFormatter, INT32 nFormatKey)
+ :SpinField(pParent, rResId)
+ ,INIT_MEMBERS()
+{
+ DBG_CTOR(FormattedField, NULL);
+
+ if (pInitialFormatter)
+ {
+ m_pFormatter = pInitialFormatter;
+ m_nFormatKey = nFormatKey;
+ }
+}
+
+//------------------------------------------------------------------------------
+FormattedField::~FormattedField()
+{
+ DBG_DTOR(FormattedField, NULL);
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetValidateText(const XubString& rText, const String* pErrorText)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ if (CheckText(rText))
+ SetText(rText);
+ else
+ if (pErrorText)
+ ImplSetText(*pErrorText, NULL);
+ else
+ ImplSetValue(m_dDefaultValue, TRUE);
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetText(const XubString& rStr)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ SpinField::SetText(rStr);
+ m_bValueDirty = TRUE;
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetTextFormatted(const XubString& rStr)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+#if DBG_UTIL
+ if (ImplGetFormatter()->IsTextFormat(m_nFormatKey))
+ DBG_WARNING("FormattedField::SetTextFormatted : valid only with text formats !");
+#endif
+
+ m_sCurrentTextValue = rStr;
+
+ String sFormatted;
+ ImplGetFormatter()->GetOutputString(m_sCurrentTextValue, m_nFormatKey, sFormatted, &m_pLastOutputColor);
+
+ // calculate the new selection
+ Selection aSel(GetSelection());
+ Selection aNewSel(aSel);
+ aNewSel.Justify();
+ USHORT nNewLen = sFormatted.Len();
+ USHORT nCurrentLen = GetText().Len();
+ if ((nNewLen > nCurrentLen) && (aNewSel.Max() == nCurrentLen))
+ { // the new text is longer and the cursor was behind the last char (of the old text)
+ if (aNewSel.Min() == 0)
+ { // the whole text was selected -> select the new text on the whole, too
+ aNewSel.Max() = nNewLen;
+ if (!nCurrentLen)
+ { // there wasn't really a previous selection (as there was no previous text), we're setting a new one -> check the selection options
+ ULONG nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions();
+ if (nSelOptions & SELECTION_OPTION_SHOWFIRST)
+ { // selection should be from right to left -> swap min and max
+ aNewSel.Min() = aNewSel.Max();
+ aNewSel.Max() = 0;
+ }
+ }
+ }
+ else if (aNewSel.Max() == aNewSel.Min())
+ { // there was no selection -> set the cursor behind the new last char
+ aNewSel.Max() = nNewLen;
+ aNewSel.Min() = nNewLen;
+ }
+ }
+ else if (aNewSel.Max() > nNewLen)
+ aNewSel.Max() = nNewLen;
+ else
+ aNewSel = aSel; // don't use the justified version
+ SpinField::SetText(sFormatted, aNewSel);
+ m_bValueDirty = FALSE;
+}
+
+//------------------------------------------------------------------------------
+String FormattedField::GetTextValue() const
+{
+ if (m_bValueDirty)
+ {
+ ((FormattedField*)this)->m_sCurrentTextValue = GetText();
+ ((FormattedField*)this)->m_bValueDirty = FALSE;
+ }
+ return m_sCurrentTextValue;
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::Modify()
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ if (!IsStrictFormat())
+ {
+ m_bValueDirty = TRUE;
+ SpinField::Modify();
+ return;
+ }
+
+ String sCheck = GetText();
+ if (CheckText(sCheck))
+ {
+ m_sLastValidText = sCheck;
+ m_aLastSelection = GetSelection();
+ m_bValueDirty = TRUE;
+ }
+ else
+ {
+ ImplSetText(m_sLastValidText, &m_aLastSelection);
+ }
+
+ SpinField::Modify();
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::ImplSetText(const XubString& rNew, Selection* pNewSel)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ if (pNewSel)
+ SpinField::SetText(rNew, *pNewSel);
+ else
+ {
+ Selection aSel(GetSelection());
+ aSel.Justify();
+
+ USHORT nNewLen = rNew.Len();
+ USHORT nCurrentLen = GetText().Len();
+
+ if ((nNewLen > nCurrentLen) && (aSel.Max() == nCurrentLen))
+ { // new new text is longer and the cursor is behind the last char
+ if (aSel.Min() == 0)
+ { // the whole text was selected -> select the new text on the whole, too
+ aSel.Max() = nNewLen;
+ if (!nCurrentLen)
+ { // there wasn't really a previous selection (as there was no previous text), we're setting a new one -> check the selection options
+ ULONG nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions();
+ if (nSelOptions & SELECTION_OPTION_SHOWFIRST)
+ { // selection should be from right to left -> swap min and max
+ aSel.Min() = aSel.Max();
+ aSel.Max() = 0;
+ }
+ }
+ }
+ else if (aSel.Max() == aSel.Min())
+ { // there was no selection -> set the cursor behind the new last char
+ aSel.Max() = nNewLen;
+ aSel.Min() = nNewLen;
+ }
+ }
+ else if (aSel.Max() > nNewLen)
+ aSel.Max() = nNewLen;
+ SpinField::SetText(rNew, aSel);
+ }
+
+ m_bValueDirty = TRUE;
+ // muss nicht stimmen, aber sicherheitshalber ...
+}
+
+//------------------------------------------------------------------------------
+long FormattedField::PreNotify(NotifyEvent& rNEvt)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ if (rNEvt.GetType() == EVENT_KEYINPUT)
+ m_aLastSelection = GetSelection();
+ return SpinField::PreNotify(rNEvt);
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::ImplSetFormatKey(ULONG nFormatKey)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ m_nFormatKey = nFormatKey;
+ BOOL bNeedFormatter = (m_pFormatter == NULL) && (nFormatKey != 0);
+ if (bNeedFormatter)
+ {
+ ImplGetFormatter(); // damit wird ein Standard-Formatter angelegt
+
+ m_nFormatKey = nFormatKey;
+ // kann sein, dass das in dem Standard-Formatter keinen Sinn macht, aber der nimmt dann ein Default-Format an.
+ // Auf diese Weise kann ich einfach einen der - formatteruebergreifended gleichen - Standard-Keys setzen.
+ DBG_ASSERT(m_pFormatter->GetEntry(nFormatKey) != NULL, "FormattedField::ImplSetFormatKey : invalid format key !");
+ // Wenn SetFormatKey aufgerufen wird, ohne dass ein Formatter existiert, muss der Key einer der Standard-Werte
+ // sein, der in allen Formattern (also auch in meinem neu angelegten) vorhanden ist.
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetFormatKey(ULONG nFormatKey)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ BOOL bNoFormatter = (m_pFormatter == NULL);
+ ImplSetFormatKey(nFormatKey);
+ FormatChanged((bNoFormatter && (m_pFormatter != NULL)) ? FCT_FORMATTER : FCT_KEYONLY);
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, BOOL bResetFormat)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ if (bResetFormat)
+ {
+ m_pFormatter = pFormatter;
+ m_nFormatKey = 0;
+ }
+ else
+ {
+ XubString sOldFormat;
+ LanguageType aOldLang;
+ GetFormat(sOldFormat, aOldLang);
+
+ ULONG nDestKey = pFormatter->TestNewString(sOldFormat);
+ if (nDestKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ // die Sprache des neuen Formatters
+ const SvNumberformat* pDefaultEntry = pFormatter->GetEntry(0);
+ LanguageType aNewLang = pDefaultEntry ? pDefaultEntry->GetLanguage() : LANGUAGE_DONTKNOW;
+
+ // den alten Format-String in die neue Sprache konvertieren
+ USHORT nCheckPos;
+ short nType;
+ pFormatter->PutandConvertEntry(sOldFormat, nCheckPos, nType, nDestKey, aOldLang, aNewLang);
+ m_nFormatKey = nDestKey;
+ }
+ m_pFormatter = pFormatter;
+ }
+
+ FormatChanged(FCT_FORMATTER);
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::GetFormat(XubString& rFormatString, LanguageType& eLang) const
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ const SvNumberformat* pFormatEntry = ImplGetFormatter()->GetEntry(m_nFormatKey);
+ DBG_ASSERT(pFormatEntry != NULL, "FormattedField::ResetConformanceTester : no number format for the given format key.");
+ rFormatString = pFormatEntry ? pFormatEntry->GetFormatstring() : XubString();
+ eLang = pFormatEntry ? pFormatEntry->GetLanguage() : LANGUAGE_DONTKNOW;
+}
+
+//------------------------------------------------------------------------------
+BOOL FormattedField::SetFormat(const XubString& rFormatString, LanguageType eLang)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ ULONG nNewKey = ImplGetFormatter()->TestNewString(rFormatString, eLang);
+ if (nNewKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ USHORT nCheckPos;
+ short nType;
+ XubString rFormat(rFormatString);
+ if (!ImplGetFormatter()->PutEntry(rFormat, nCheckPos, nType, nNewKey))
+ return FALSE;
+ DBG_ASSERT(nNewKey != NUMBERFORMAT_ENTRY_NOT_FOUND, "FormattedField::SetFormatString : PutEntry returned an invalid key !");
+ }
+
+ if (nNewKey != m_nFormatKey)
+ SetFormatKey(nNewKey);
+ return TRUE;
+}
+
+//------------------------------------------------------------------------------
+BOOL FormattedField::GetThousandsSep() const
+{
+ DBG_ASSERT(!ImplGetFormatter()->IsTextFormat(m_nFormatKey),
+ "FormattedField::GetThousandsSep : your'e sure what your'e doing when setting the precision of a text format ?");
+
+ BOOL bThousand, IsRed;
+ USHORT nPrecision, nAnzLeading;
+ ImplGetFormatter()->GetFormatSpecialInfo(m_nFormatKey, bThousand, IsRed, nPrecision, nAnzLeading);
+
+ return bThousand;
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetThousandsSep(BOOL _bUseSeparator)
+{
+ DBG_ASSERT(!ImplGetFormatter()->IsTextFormat(m_nFormatKey),
+ "FormattedField::SetThousandsSep : your'e sure what your'e doing when setting the precision of a text format ?");
+
+ // get the current settings
+ BOOL bThousand, IsRed;
+ USHORT nPrecision, nAnzLeading;
+ ImplGetFormatter()->GetFormatSpecialInfo(m_nFormatKey, bThousand, IsRed, nPrecision, nAnzLeading);
+ if (bThousand == _bUseSeparator)
+ return;
+
+ // we need the language for the following
+ LanguageType eLang;
+ String sFmtDescription;
+ GetFormat(sFmtDescription, eLang);
+
+ // generate a new format ...
+ ImplGetFormatter()->GenerateFormat(sFmtDescription, m_nFormatKey, eLang, _bUseSeparator, IsRed, nPrecision, nAnzLeading);
+ // ... and introduce it to the formatter
+ USHORT nCheckPos;
+ ULONG nNewKey;
+ short nType;
+ ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang);
+
+ // set the new key
+ ImplSetFormatKey(nNewKey);
+ FormatChanged(FCT_THOUSANDSSEP);
+}
+
+//------------------------------------------------------------------------------
+USHORT FormattedField::GetDecimalDigits() const
+{
+ DBG_ASSERT(!ImplGetFormatter()->IsTextFormat(m_nFormatKey),
+ "FormattedField::GetDecimalDigits : your'e sure what your'e doing when setting the precision of a text format ?");
+
+ BOOL bThousand, IsRed;
+ USHORT nPrecision, nAnzLeading;
+ ImplGetFormatter()->GetFormatSpecialInfo(m_nFormatKey, bThousand, IsRed, nPrecision, nAnzLeading);
+
+ return nPrecision;
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetDecimalDigits(USHORT _nPrecision)
+{
+ DBG_ASSERT(!ImplGetFormatter()->IsTextFormat(m_nFormatKey),
+ "FormattedField::SetDecimalDigits : your'e sure what your'e doing when setting the precision of a text format ?");
+
+ // get the current settings
+ BOOL bThousand, IsRed;
+ USHORT nPrecision, nAnzLeading;
+ ImplGetFormatter()->GetFormatSpecialInfo(m_nFormatKey, bThousand, IsRed, nPrecision, nAnzLeading);
+ if (nPrecision == _nPrecision)
+ return;
+
+ // we need the language for the following
+ LanguageType eLang;
+ String sFmtDescription;
+ GetFormat(sFmtDescription, eLang);
+
+ // generate a new format ...
+ ImplGetFormatter()->GenerateFormat(sFmtDescription, m_nFormatKey, eLang, bThousand, IsRed, _nPrecision, nAnzLeading);
+ // ... and introduce it to the formatter
+ USHORT nCheckPos;
+ ULONG nNewKey;
+ short nType;
+ ImplGetFormatter()->PutEntry(sFmtDescription, nCheckPos, nType, nNewKey, eLang);
+
+ // set the new key
+ ImplSetFormatKey(nNewKey);
+ FormatChanged(FCT_PRECISION);
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::FormatChanged(FORMAT_CHANGE_TYPE /*nWhat*/)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ m_pLastOutputColor = NULL;
+ ReFormat();
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::ReFormat()
+{
+ if (!IsEmptyFieldEnabled() || GetText().Len())
+ if (TreatingAsNumber())
+ ImplSetValue(GetValue(), TRUE);
+ else
+ SetTextFormatted(GetTextValue());
+}
+
+//------------------------------------------------------------------------------
+long FormattedField::Notify(NotifyEvent& rNEvt)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ if ((rNEvt.GetType() == EVENT_KEYINPUT) && !IsReadOnly())
+ {
+ const KeyEvent& rKEvt = *rNEvt.GetKeyEvent();
+ USHORT nMod = rKEvt.GetKeyCode().GetModifier();
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ if (!nMod && ImplGetFormatter()->IsTextFormat(m_nFormatKey))
+ {
+ // the base class would translate this into calls to Up/Down/First/Last,
+ // but we don't want this if we are text-formatted
+ return 1;
+ }
+ }
+ }
+
+ if ((rNEvt.GetType() == EVENT_COMMAND) && !IsReadOnly())
+ {
+ const CommandEvent* pCommand = rNEvt.GetCommandEvent();
+ if (pCommand->GetCommand() == COMMAND_WHEEL)
+ {
+ const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
+ if ((pData->GetMode() == COMMAND_WHEEL_SCROLL) && ImplGetFormatter()->IsTextFormat(m_nFormatKey))
+ {
+ // same as above : prevent the base class from doing Up/Down-calls
+ // (normally I should put this test into the Up/Down methods itself, shouldn't I ?)
+ // FS - 71553 - 19.01.00
+ return 1;
+ }
+ }
+ }
+
+ if (rNEvt.GetType() == EVENT_LOSEFOCUS)
+ {
+ // Sonderbehandlung fuer leere Texte
+ if (GetText().Len() == 0)
+ {
+ if (!IsEmptyFieldEnabled())
+ {
+ if (TreatingAsNumber())
+ {
+ ImplSetValue(m_dCurrentValue, TRUE);
+ Modify();
+ }
+ else
+ {
+ String sNew = GetTextValue();
+ if (sNew.Len())
+ SetTextFormatted(sNew);
+ else
+ SetTextFormatted(m_sDefaultText);
+ }
+ m_bValueDirty = FALSE;
+ }
+ }
+ else
+ {
+ String sOld = GetText();
+ ReFormat();
+ if (GetText() != sOld)
+ Modify();
+ }
+ }
+
+ return SpinField::Notify( rNEvt );
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetMinValue(double dMin)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ DBG_ASSERT(m_bTreatAsNumber, "FormattedField::SetMinValue : only to be used in numeric mode !");
+
+ m_dMinValue = dMin;
+ m_bHasMin = TRUE;
+ // fuer die Ueberpruefung des aktuellen Wertes an der neuen Grenze -> ImplSetValue
+ ReFormat();
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetMaxValue(double dMax)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ DBG_ASSERT(m_bTreatAsNumber, "FormattedField::SetMaxValue : only to be used in numeric mode !");
+
+ m_dMaxValue = dMax;
+ m_bHasMax = TRUE;
+ // fuer die Ueberpruefung des aktuellen Wertes an der neuen Grenze -> ImplSetValue
+ ReFormat();
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetTextValue(const XubString& rText)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ SetText(rText);
+ ReFormat();
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::EnableEmptyField(BOOL bEnable)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ if (bEnable == m_bEnableEmptyField)
+ return;
+
+ m_bEnableEmptyField = bEnable;
+ if (!m_bEnableEmptyField && GetText().Len()==0)
+ ImplSetValue(m_dCurrentValue, TRUE);
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::ImplSetValue(double dVal, BOOL bForce)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ if (m_bHasMin && (dVal<m_dMinValue))
+ dVal = m_dMinValue;
+ if (m_bHasMax && (dVal>m_dMaxValue))
+ dVal = m_dMaxValue;
+ if (!bForce && (dVal == GetValue()))
+ return;
+
+ DBG_ASSERT(ImplGetFormatter() != NULL, "FormattedField::ImplSetValue : can't set a value without a formatter !");
+
+ m_bValueDirty = FALSE;
+ m_dCurrentValue = dVal;
+
+ String sNewText;
+ if (ImplGetFormatter()->IsTextFormat(m_nFormatKey))
+ {
+ // zuerst die Zahl als String im Standard-Format
+ String sTemp;
+ ImplGetFormatter()->GetOutputString(dVal, 0, sTemp, &m_pLastOutputColor);
+ // dann den String entsprechend dem Text-Format
+ ImplGetFormatter()->GetOutputString(sTemp, m_nFormatKey, sNewText, &m_pLastOutputColor);
+ }
+ else
+ {
+ ImplGetFormatter()->GetOutputString(dVal, m_nFormatKey, sNewText, &m_pLastOutputColor);
+ }
+
+ ImplSetText(sNewText, NULL);
+ m_bValueDirty = FALSE;
+ DBG_ASSERT(CheckText(sNewText), "FormattedField::ImplSetValue : formatted string doesn't match the criteria !");
+}
+
+//------------------------------------------------------------------------------
+BOOL FormattedField::ImplGetValue(double& dNewVal)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ dNewVal = m_dCurrentValue;
+ if (!m_bValueDirty)
+ return TRUE;
+
+ dNewVal = m_dDefaultValue;
+ String sText(GetText());
+ if (!sText.Len())
+ return TRUE;
+
+ DBG_ASSERT(ImplGetFormatter() != NULL, "FormattedField::ImplGetValue : can't give you a current value without a formatter !");
+
+ ULONG nFormatKey = m_nFormatKey; // IsNumberFormat veraendert den FormatKey ...
+
+ if (ImplGetFormatter()->IsTextFormat(nFormatKey) && m_bTreatAsNumber)
+ // damit wir in einem als Text formatierten Feld trotzdem eine Eingabe wie '1,1' erkennen ...
+ nFormatKey = 0;
+
+ // Sonderbehandlung fuer %-Formatierung
+ if (ImplGetFormatter()->GetType(m_nFormatKey) == NUMBERFORMAT_PERCENT)
+ {
+ ULONG nTempFormat = 0;
+ double dTemp;
+ if (m_pFormatter->IsNumberFormat(sText, nTempFormat, dTemp) &&
+ NUMBERFORMAT_NUMBER == m_pFormatter->GetType(nTempFormat))
+ // der String entspricht einer Number-Formatierung, hat also nur kein %
+ // -> dranhaengen
+ sText += '%';
+ // (damit wird aus einer Eingabe '3' ein '3%', und der Formatter macht dann daraus
+ // ein double 0.03. Ansonsten wuerden wir hier bei einer Eingabe von '3' ein double
+ // 3 zurueckliefern, was 300 Prozent entspricht ...
+ }
+ if (!ImplGetFormatter()->IsNumberFormat(sText, nFormatKey, dNewVal))
+ return FALSE;
+
+
+ if (m_bHasMin && (dNewVal<m_dMinValue))
+ dNewVal = m_dMinValue;
+ if (m_bHasMax && (dNewVal>m_dMaxValue))
+ dNewVal = m_dMaxValue;
+ return TRUE;
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::SetValue(double dVal)
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ ImplSetValue(dVal, m_bValueDirty);
+}
+
+//------------------------------------------------------------------------------
+double FormattedField::GetValue()
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+
+ if (!ImplGetValue(m_dCurrentValue))
+ m_dCurrentValue = m_dDefaultValue;
+
+ m_bValueDirty = FALSE;
+ return m_dCurrentValue;
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::Up()
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ SetValue(GetValue() + m_dSpinSize);
+ // das setValue handelt Bereichsueberschreitungen (min/max) automatisch
+ SetModifyFlag();
+ Modify();
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::Down()
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ SetValue(GetValue() - m_dSpinSize);
+ SetModifyFlag();
+ Modify();
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::First()
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ if (m_bHasMin)
+ {
+ SetValue(m_dMinValue);
+ SetModifyFlag();
+ Modify();
+ }
+}
+
+//------------------------------------------------------------------------------
+void FormattedField::Last()
+{
+ DBG_CHKTHIS(FormattedField, NULL);
+ if (m_bHasMax)
+ {
+ SetValue(m_dMaxValue);
+ SetModifyFlag();
+ Modify();
+ }
+}
+
+//==============================================================================
+//------------------------------------------------------------------------------
+DoubleNumericField::~DoubleNumericField()
+{
+ delete m_pConformanceTester;
+}
+
+//------------------------------------------------------------------------------
+void DoubleNumericField::FormatChanged(FORMAT_CHANGE_TYPE nWhat)
+{
+ ResetConformanceTester();
+ FormattedField::FormatChanged(nWhat);
+}
+
+//------------------------------------------------------------------------------
+BOOL DoubleNumericField::CheckText(const XubString& sText) const
+{
+ // Ich wuerde das CheckText gern ueber den NumberFormatter laufen lassen (da gibt es schliesslich ein IsNumberFormat),
+ // aber der erkennt leider keine Fragmente (also zum Beispiel '1e', was waehrend der Eingabe zwangslaeufig irgendwann mal
+ // vorkommt), also dieser Umweg ueber einen SearchText.
+
+ if (!sText.Len())
+ return TRUE;
+
+ String sForceComplete = '_';
+ sForceComplete += sText;
+ sForceComplete += '_';
+
+ USHORT nStart = 0, nEnd = sForceComplete.Len();
+ BOOL bFound = m_pConformanceTester->SearchFrwrd(sForceComplete, &nStart, &nEnd);
+
+ if (bFound && (nStart == 0) && (nEnd == sForceComplete.Len() - 1))
+ return TRUE;
+
+ return FALSE;
+}
+
+//------------------------------------------------------------------------------
+void DoubleNumericField::ResetConformanceTester()
+{
+ String sDescription = String::CreateFromAscii(szNumericInput);
+ // the thousands and the decimal separator are language dependent
+ const SvNumberformat* pFormatEntry = ImplGetFormatter()->GetEntry(m_nFormatKey);
+ char cSepHexCode[3];
+
+ unsigned char cSeparator = pFormatEntry ? International(pFormatEntry->GetLanguage()).GetNumThousandSep() : ',';
+ sprintf(cSepHexCode, "%0X", cSeparator);
+ sDescription.SearchAndReplaceAscii("++", String::CreateFromAscii(cSepHexCode));
+
+ cSeparator = pFormatEntry ? International(pFormatEntry->GetLanguage()).GetNumDecimalSep() : '.';
+ sprintf(cSepHexCode, "%0X", cSeparator);
+ sDescription.SearchAndReplaceAscii("##", String::CreateFromAscii(cSepHexCode));
+
+ delete m_pConformanceTester;
+ m_pConformanceTester = new SearchText(SearchParam(sDescription, SearchParam::SRCH_REGEXP, FALSE), GetpApp()->GetAppInternational());
+}
+
+
+//==============================================================================
+
+//------------------------------------------------------------------------------
+DoubleCurrencyField::DoubleCurrencyField(Window* pParent, WinBits nStyle)
+ :FormattedField(pParent, nStyle)
+ ,m_bChangingFormat(FALSE)
+{
+ m_bPrependCurrSym = FALSE;
+
+ // initialize with a system currency format
+ SvNumberFormatter* pFormatter = StandardFormatter();
+ const NfCurrencyEntry* pSystemCurrency = pFormatter->MatchSystemCurrency();
+ if (!pSystemCurrency)
+ pSystemCurrency = &pFormatter->GetCurrencyEntry(LANGUAGE_SYSTEM);
+ if (pSystemCurrency)
+ m_sCurrencySymbol = pSystemCurrency->GetSymbol();
+ else
+ // no more options ...
+ m_sCurrencySymbol.AssignAscii("DM");
+ UpdateCurrencyFormat();
+}
+
+//------------------------------------------------------------------------------
+DoubleCurrencyField::DoubleCurrencyField(Window* pParent, const ResId& rResId)
+ :FormattedField(pParent, rResId)
+ ,m_bChangingFormat(FALSE)
+{
+ m_bPrependCurrSym = FALSE;
+
+ // initialize with a system currency format
+ SvNumberFormatter* pFormatter = StandardFormatter();
+ const NfCurrencyEntry* pSystemCurrency = pFormatter->MatchSystemCurrency();
+ if (!pSystemCurrency)
+ pSystemCurrency = &pFormatter->GetCurrencyEntry(LANGUAGE_SYSTEM);
+ if (pSystemCurrency)
+ m_sCurrencySymbol = pSystemCurrency->GetSymbol();
+ else
+ // no more options ...
+ m_sCurrencySymbol.AssignAscii("DM");
+ UpdateCurrencyFormat();
+}
+
+//------------------------------------------------------------------------------
+void DoubleCurrencyField::FormatChanged(FORMAT_CHANGE_TYPE nWhat)
+{
+ if (m_bChangingFormat)
+ {
+ FormattedField::FormatChanged(nWhat);
+ return;
+ }
+
+ switch (nWhat)
+ {
+ case FCT_FORMATTER:
+ case FCT_PRECISION:
+ case FCT_THOUSANDSSEP:
+ // the aspects which changed don't take our currency settings into account (in fact, they most probably
+ // destroyed them)
+ UpdateCurrencyFormat();
+ break;
+ case FCT_KEYONLY:
+ DBG_ERROR("DoubleCurrencyField::FormatChanged : somebody modified my key !");
+ // We always build our own format from the settings we get via special methods (setCurrencySymbol etc.).
+ // Nobody but ourself should modifiy the format key directly !
+ break;
+ }
+
+ FormattedField::FormatChanged(nWhat);
+}
+
+//------------------------------------------------------------------------------
+void DoubleCurrencyField::setCurrencySymbol(const String& _sSymbol)
+{
+ if (m_sCurrencySymbol == _sSymbol)
+ return;
+
+ m_sCurrencySymbol = _sSymbol;
+ UpdateCurrencyFormat();
+ FormatChanged(FCT_CURRENCY_SYMBOL);
+}
+
+//------------------------------------------------------------------------------
+void DoubleCurrencyField::setPrependCurrSym(BOOL _bPrepend)
+{
+ if (m_bPrependCurrSym == _bPrepend)
+ return;
+
+ m_bPrependCurrSym = _bPrepend;
+ UpdateCurrencyFormat();
+ FormatChanged(FCT_CURRSYM_POSITION);
+}
+
+//------------------------------------------------------------------------------
+void DoubleCurrencyField::UpdateCurrencyFormat()
+{
+ // the old settings
+ XubString sOldFormat;
+ LanguageType eLanguage;
+ GetFormat(sOldFormat, eLanguage);
+ BOOL bThSep = GetThousandsSep();
+ USHORT nDigits = GetDecimalDigits();
+
+ // build a new format string with the base class' and my own settings
+ International aIntl(eLanguage);
+ XubString sNewFormat;
+ if (bThSep)
+ {
+ sNewFormat = '#';
+ sNewFormat += aIntl.GetNumThousandSep();
+ sNewFormat.AppendAscii("##0");
+ }
+ else
+ sNewFormat = '0';
+
+ if (nDigits)
+ {
+ sNewFormat += aIntl.GetNumDecimalSep();
+
+ XubString sTemp;
+ sTemp.Fill(nDigits, '0');
+ sNewFormat += sTemp;
+ }
+
+ if (getPrependCurrSym())
+ {
+ XubString sSymbol = getCurrencySymbol();
+ sSymbol.EraseLeadingChars(' ');
+ sSymbol.EraseTrailingChars(' ');
+
+ XubString sTemp = sSymbol;
+ sTemp += ' ';
+ sTemp += sNewFormat;
+
+ // for negative values : $ -0.00, not -$ 0.00 ...
+ // (the real solution would be a possibility to choose a "positive currency format" and a "negative currency format" ...
+ // But not now ... (and hey, you could take a formatted field for this ....))
+ // FS - 31.03.00 74642
+ sTemp += ';';
+ sTemp += sSymbol;
+ sTemp.AppendAscii(" -");
+ sTemp += sNewFormat;
+
+ sNewFormat = sTemp;
+ }
+ else
+ {
+ XubString sTemp = getCurrencySymbol();
+ sTemp.EraseLeadingChars(' ');
+ sTemp.EraseTrailingChars(' ');
+
+ sNewFormat += ' ';
+ sNewFormat += sTemp;
+ }
+
+ // set this new basic format
+ m_bChangingFormat = TRUE;
+ SetFormat(sNewFormat, eLanguage);
+ m_bChangingFormat = FALSE;
+}
+
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
new file mode 100644
index 000000000000..7bde8d02b60a
--- /dev/null
+++ b/svtools/source/control/headbar.cxx
@@ -0,0 +1,1673 @@
+/*************************************************************************
+ *
+ * $RCSfile: headbar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_HEADBAR_CXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+
+#ifndef _VCL_APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _VCL_HELP_HXX
+#include <vcl/help.hxx>
+#endif
+#ifndef _VCL_IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+
+#ifndef _HEADBAR_HXX
+#include <headbar.hxx>
+#endif
+
+// =======================================================================
+
+struct ImplHeadItem
+{
+ USHORT mnId;
+ HeaderBarItemBits mnBits;
+ long mnSize;
+ ULONG mnHelpId;
+ Image maImage;
+ XubString maOutText;
+ XubString maText;
+ XubString maHelpText;
+ void* mpUserData;
+};
+
+DECLARE_LIST( ImplHeadItemList, ImplHeadItem* );
+
+// =======================================================================
+
+#define HEAD_ARROWSIZE1 4
+#define HEAD_ARROWSIZE2 7
+
+#define HEADERBAR_TEXTOFF 2
+#define HEADERBAR_ARROWOFF 5
+#define HEADERBAR_SPLITOFF 3
+
+#define HEADERBAR_DRAGOFF 4
+#define HEADERBAR_DRAGOUTOFF 15
+
+#define HEAD_HITTEST_ITEM ((USHORT)0x0001)
+#define HEAD_HITTEST_DIVIDER ((USHORT)0x0002)
+
+// =======================================================================
+
+void HeaderBar::ImplInit( WinBits nWinStyle )
+{
+ mpItemList = new ImplHeadItemList;
+ mnBorderOff1 = 0;
+ mnBorderOff2 = 0;
+ mnOffset = 0;
+ mnDX = 0;
+ mnDY = 0;
+ mnDragSize = 0;
+ mnStartPos = 0;
+ mnDragPos = 0;
+ mnMouseOff = 0;
+ mnCurItemId = 0;
+ mnItemDragPos = HEADERBAR_ITEM_NOTFOUND;
+ mbDrag = FALSE;
+ mbItemDrag = FALSE;
+ mbOutDrag = FALSE;
+ mbItemMode = FALSE;
+
+ // StyleBits auswerten
+ if ( nWinStyle & WB_DRAG )
+ mbDragable = TRUE;
+ else
+ mbDragable = FALSE;
+ if ( nWinStyle & WB_BUTTONSTYLE )
+ mbButtonStyle = TRUE;
+ else
+ mbButtonStyle = FALSE;
+ if ( nWinStyle & WB_BORDER )
+ {
+ mnBorderOff1 = 1;
+ mnBorderOff2 = 1;
+ }
+ else
+ {
+ if ( nWinStyle & WB_BOTTOMBORDER )
+ mnBorderOff2 = 1;
+ }
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+HeaderBar::HeaderBar( Window* pParent, WinBits nWinStyle ) :
+ Window( pParent, nWinStyle & WB_3DLOOK )
+{
+ ImplInit( nWinStyle );
+ SetSizePixel( CalcWindowSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+HeaderBar::HeaderBar( Window* pParent, const ResId& rResId ) :
+ Window( pParent, rResId )
+{
+ ImplInit( rResId.aWinBits );
+}
+
+// -----------------------------------------------------------------------
+
+HeaderBar::~HeaderBar()
+{
+ // Alle Items loeschen
+ ImplHeadItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ delete mpItemList;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont;
+ aFont = rStyleSettings.GetToolFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else
+ aColor = rStyleSettings.GetFaceColor();
+ SetBackground( aColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long HeaderBar::ImplGetItemPos( USHORT nPos ) const
+{
+ long nX = -mnOffset;
+ for ( USHORT i = 0; i < nPos; i++ )
+ nX += mpItemList->GetObject( i )->mnSize;
+ return nX;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle HeaderBar::ImplGetItemRect( USHORT nPos ) const
+{
+ Rectangle aRect( ImplGetItemPos( nPos ), 0, 0, mnDY-1 );
+ aRect.Right() = aRect.Left() + mpItemList->GetObject( nPos )->mnSize - 1;
+ // Gegen Ueberlauf auf einigen Systemen testen
+ if ( aRect.Right() > 16000 )
+ aRect.Right() = 16000;
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT HeaderBar::ImplHitTest( const Point& rPos,
+ long& nMouseOff, USHORT& nPos ) const
+{
+ ImplHeadItem* pItem;
+ USHORT nCount = (USHORT)mpItemList->Count();
+ BOOL bLastFixed = TRUE;
+ long nX = -mnOffset;
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ pItem = mpItemList->GetObject( i );
+
+ if ( rPos.X() < (nX+pItem->mnSize) )
+ {
+ USHORT nMode;
+
+ if ( !bLastFixed && (rPos.X() < (nX+HEADERBAR_SPLITOFF)) )
+ {
+ nMode = HEAD_HITTEST_DIVIDER;
+ nPos = i-1;
+ nMouseOff = rPos.X()-nX+1;
+ }
+ else
+ {
+ nPos = i;
+
+ if ( !(pItem->mnBits & HIB_FIXED) && (rPos.X() >= (nX+pItem->mnSize-HEADERBAR_SPLITOFF)) )
+ {
+ nMode = HEAD_HITTEST_DIVIDER;
+ nMouseOff = rPos.X()-(nX+pItem->mnSize);
+ }
+ else
+ {
+ nMode = HEAD_HITTEST_ITEM;
+ nMouseOff = rPos.X()-nX;
+ }
+ }
+
+ return nMode;
+ }
+
+ if ( pItem->mnBits & HIB_FIXED )
+ bLastFixed = TRUE;
+ else
+ bLastFixed = FALSE;
+
+ nX += pItem->mnSize;
+ }
+
+ if ( !bLastFixed )
+ {
+ pItem = mpItemList->GetObject( nCount-1 );
+ if ( (pItem->mnSize < 4) && (rPos.X() < (nX+HEADERBAR_SPLITOFF)) )
+ {
+ nPos = nCount-1;
+ nMouseOff = rPos.X()-nX+1;
+ return HEAD_HITTEST_DIVIDER;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplInvertDrag( USHORT nStartPos, USHORT nEndPos )
+{
+ Rectangle aRect1 = ImplGetItemRect( nStartPos );
+ Rectangle aRect2 = ImplGetItemRect( nEndPos );
+ Point aStartPos = aRect1.Center();
+ Point aEndPos = aStartPos;
+ Rectangle aStartRect( aStartPos.X()-2, aStartPos.Y()-2,
+ aStartPos.X()+2, aStartPos.Y()+2 );
+
+ if ( nEndPos > nStartPos )
+ {
+ aStartPos.X() += 3;
+ aEndPos.X() = aRect2.Right()-6;
+ }
+ else
+ {
+ aStartPos.X() -= 3;
+ aEndPos.X() = aRect2.Left()+6;
+ }
+
+ SetRasterOp( ROP_INVERT );
+ DrawRect( aStartRect );
+ DrawLine( aStartPos, aEndPos );
+ if ( nEndPos > nStartPos )
+ {
+ DrawLine( Point( aEndPos.X()+1, aEndPos.Y()-3 ),
+ Point( aEndPos.X()+1, aEndPos.Y()+3 ) );
+ DrawLine( Point( aEndPos.X()+2, aEndPos.Y()-2 ),
+ Point( aEndPos.X()+2, aEndPos.Y()+2 ) );
+ DrawLine( Point( aEndPos.X()+3, aEndPos.Y()-1 ),
+ Point( aEndPos.X()+3, aEndPos.Y()+1 ) );
+ DrawPixel( Point( aEndPos.X()+4, aEndPos.Y() ) );
+ }
+ else
+ {
+ DrawLine( Point( aEndPos.X()-1, aEndPos.Y()-3 ),
+ Point( aEndPos.X()-1, aEndPos.Y()+3 ) );
+ DrawLine( Point( aEndPos.X()-2, aEndPos.Y()-2 ),
+ Point( aEndPos.X()-2, aEndPos.Y()+2 ) );
+ DrawLine( Point( aEndPos.X()-3, aEndPos.Y()-1 ),
+ Point( aEndPos.X()-3, aEndPos.Y()+1 ) );
+ DrawPixel( Point( aEndPos.X()-4, aEndPos.Y() ) );
+ }
+ SetRasterOp( ROP_OVERPAINT );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplDrawItem( OutputDevice* pDev,
+ USHORT nPos, BOOL bHigh, BOOL bDrag,
+ const Rectangle& rItemRect,
+ const Rectangle* pRect,
+ ULONG nFlags )
+{
+ Rectangle aRect = rItemRect;
+
+ // Wenn kein Platz, dann brauchen wir auch nichts ausgeben
+ if ( aRect.GetWidth() <= 1 )
+ return;
+
+ // Feststellen, ob Rectangle ueberhaupt sichtbar
+ if ( pRect )
+ {
+ if ( aRect.Right() < pRect->Left() )
+ return;
+ else if ( aRect.Left() > pRect->Right() )
+ return;
+ }
+ else
+ {
+ if ( aRect.Right() < 0 )
+ return;
+ else if ( aRect.Left() > mnDX )
+ return;
+ }
+
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ HeaderBarItemBits nBits = pItem->mnBits;
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ // Border muss nicht gemalt werden
+ aRect.Top() += mnBorderOff1;
+ aRect.Bottom() -= mnBorderOff2;
+
+ // Hintergrund loeschen
+ if ( !pRect || bDrag )
+ {
+ if ( bDrag )
+ {
+ pDev->SetLineColor();
+ pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
+ pDev->DrawRect( aRect );
+ }
+ else
+ pDev->DrawWallpaper( aRect, GetBackground() );
+ }
+
+ // Trennlinie malen
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ pDev->DrawLine( Point( aRect.Right(), aRect.Top() ),
+ Point( aRect.Right(), aRect.Bottom() ) );
+
+ // ButtonStyle malen
+ if ( mbButtonStyle && !(nBits & HIB_FLAT) )
+ {
+ if ( aRect.GetWidth() >= 2 )
+ {
+ if ( bHigh )
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom() ) );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-1, aRect.Top() ) );
+ if ( !bHigh )
+ {
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( aRect.Right()-1, aRect.Top()+1 ),
+ Point( aRect.Right()-1, aRect.Bottom() ) );
+ pDev->DrawLine( Point( aRect.Left()+1, aRect.Bottom() ),
+ Point( aRect.Right()-1, aRect.Bottom() ) );
+ }
+ }
+
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+
+ // Wenn selektiert, verschiebt sich das Rechteck um 1 Pixel
+ if ( bHigh )
+ aRect.Move( 1, 1 );
+ }
+
+ // Wenn kein Platz, dann brauchen wir auch nichts ausgeben
+ if ( aRect.GetWidth() < 1 )
+ return;
+
+ // Positionen und Groessen berechnen und Inhalt ausgeben
+ pItem->maOutText = pItem->maText;
+ Size aImageSize = pItem->maImage.GetSizePixel();
+ Size aTxtSize( pDev->GetTextWidth( pItem->maOutText ), 0 );
+ if ( pItem->maOutText.Len() )
+ aTxtSize.Height() = pDev->GetTextHeight();
+ long nArrowWidth = 0;
+ if ( nBits & (HIB_UPARROW | HIB_DOWNARROW) )
+ nArrowWidth = HEAD_ARROWSIZE2+HEADERBAR_ARROWOFF;
+
+ // Wenn kein Platz fuer Image, dann nicht ausgeben
+ long nTestHeight = aImageSize.Height();
+ if ( !(nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) )
+ nTestHeight += aTxtSize.Height();
+ if ( (aImageSize.Width() > aRect.GetWidth()) || (nTestHeight > aRect.GetHeight()) )
+ {
+ aImageSize.Width() = 0;
+ aImageSize.Height() = 0;
+ }
+
+ // Text auf entsprechende Laenge kuerzen
+ BOOL bLeftText = FALSE;
+ long nMaxTxtWidth = aRect.GetWidth()-(HEADERBAR_TEXTOFF*2)-nArrowWidth;
+ if ( nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE) )
+ nMaxTxtWidth -= aImageSize.Width();
+ long nTxtWidth = aTxtSize.Width();
+ if ( nTxtWidth > nMaxTxtWidth )
+ {
+ bLeftText = TRUE;
+ // 3 == Len of "..."
+ pItem->maOutText.AppendAscii( "..." );
+ do
+ {
+ pItem->maOutText.Erase( pItem->maOutText.Len()-3-1, 1 );
+ nTxtWidth = pDev->GetTextWidth( pItem->maOutText );
+ }
+ while ( (nTxtWidth > nMaxTxtWidth) && (pItem->maOutText.Len() > 3) );
+ if ( pItem->maOutText.Len() == 3 )
+ {
+ nTxtWidth = 0;
+ pItem->maOutText.Erase();
+ }
+ }
+
+ // Text/Imageposition berechnen
+ long nTxtPos;
+ if ( !bLeftText && (nBits & HIB_RIGHT) )
+ {
+ nTxtPos = aRect.Right()-nTxtWidth-HEADERBAR_TEXTOFF;
+ if ( nBits & HIB_RIGHTIMAGE )
+ nTxtPos -= aImageSize.Width();
+ }
+ else if ( !bLeftText && (nBits & HIB_CENTER) )
+ {
+ long nTempWidth = nTxtWidth;
+ if ( nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE) )
+ nTempWidth += aImageSize.Width();
+ nTxtPos = aRect.Left()+(aRect.GetWidth()-nTempWidth)/2;
+ if ( nBits & HIB_LEFTIMAGE )
+ nTxtPos += aImageSize.Width();
+ if ( nArrowWidth )
+ {
+ if ( nTxtPos+nTxtWidth+nArrowWidth >= aRect.Right() )
+ {
+ nTxtPos = aRect.Left()+HEADERBAR_TEXTOFF;
+ if ( nBits & HIB_LEFTIMAGE )
+ nTxtPos += aImageSize.Width();
+ }
+ }
+ }
+ else
+ {
+ nTxtPos = aRect.Left()+HEADERBAR_TEXTOFF;
+ if ( nBits & HIB_LEFTIMAGE )
+ nTxtPos += aImageSize.Width();
+ if ( nBits & HIB_RIGHT )
+ nTxtPos += nArrowWidth;
+ }
+
+ // TextPosition berechnen
+ long nTxtPosY;
+ if ( pItem->maOutText.Len() || (nArrowWidth && aTxtSize.Height()) )
+ {
+ if ( nBits & HIB_TOP )
+ {
+ nTxtPosY = aRect.Top();
+ if ( !(nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) )
+ nTxtPosY += aImageSize.Height();
+ }
+ else if ( nBits & HIB_BOTTOM )
+ nTxtPosY = aRect.Bottom()-aTxtSize.Height();
+ else
+ {
+ long nTempHeight = aTxtSize.Height();
+ if ( !(nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) )
+ nTempHeight += aImageSize.Height();
+ nTxtPosY = aRect.Top()+((aRect.GetHeight()-nTempHeight)/2);
+ if ( !(nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) )
+ nTxtPosY += aImageSize.Height();
+ }
+ }
+
+ // Text ausgebeben
+ if ( pItem->maOutText.Len() )
+ {
+ if ( IsEnabled() )
+ pDev->DrawText( Point( nTxtPos, nTxtPosY ), pItem->maOutText );
+ else
+ pDev->DrawCtrlText( Point( nTxtPos, nTxtPosY ), pItem->maOutText, 0, STRING_LEN, TEXT_DRAW_DISABLE );
+ }
+
+ // Wenn Image vorhanden, Position berechnen und ausgeben
+ long nImagePosY;
+ if ( aImageSize.Width() && aImageSize.Height() )
+ {
+ long nImagePos = nTxtPos;
+ if ( nBits & HIB_LEFTIMAGE )
+ {
+ nImagePos -= aImageSize.Width();
+ if ( nBits & HIB_RIGHT )
+ nImagePos -= nArrowWidth;
+ }
+ else if ( nBits & HIB_RIGHTIMAGE )
+ {
+ nImagePos += nTxtWidth;
+ if ( !(nBits & HIB_RIGHT) )
+ nImagePos += nArrowWidth;
+ }
+ else
+ {
+ if ( nBits & HIB_RIGHT )
+ nImagePos = aRect.Right()-aImageSize.Width();
+ else if ( nBits & HIB_CENTER )
+ nImagePos = aRect.Left()+(aRect.GetWidth()-aImageSize.Width())/2;
+ else
+ nImagePos = aRect.Left()+HEADERBAR_TEXTOFF;
+ }
+
+ if ( nBits & HIB_TOP )
+ nImagePosY = aRect.Top();
+ else if ( nBits & HIB_BOTTOM )
+ {
+ nImagePosY = aRect.Bottom()-aImageSize.Height();
+ if ( !(nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) )
+ nImagePosY -= aTxtSize.Height();
+ }
+ else
+ {
+ long nTempHeight = aImageSize.Height();
+ if ( !(nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) )
+ nTempHeight += aTxtSize.Height();
+ nImagePosY = aRect.Top()+((aRect.GetHeight()-nTempHeight)/2);
+ }
+ if ( nImagePos+aImageSize.Width() <= aRect.Right() )
+ {
+ USHORT nStyle = 0;
+ if ( !IsEnabled() )
+ nStyle |= IMAGE_DRAW_DISABLE;
+ pDev->DrawImage( Point( nImagePos, nImagePosY ), pItem->maImage, nStyle );
+ }
+ }
+
+ if ( nBits & (HIB_UPARROW | HIB_DOWNARROW) )
+ {
+ long nArrowX = nTxtPos;
+ if ( nBits & HIB_RIGHT )
+ nArrowX -= nArrowWidth;
+ else
+ nArrowX += nTxtWidth+HEADERBAR_ARROWOFF;
+ if ( !(nBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) && !pItem->maText.Len() )
+ {
+ if ( nBits & HIB_RIGHT )
+ nArrowX -= aImageSize.Width();
+ else
+ nArrowX += aImageSize.Width();
+ }
+
+ // Feststellen, ob Platz genug ist, das Item zu malen
+ BOOL bDraw = TRUE;
+ if ( nArrowX < aRect.Left()+HEADERBAR_TEXTOFF )
+ bDraw = FALSE;
+ else if ( nArrowX+HEAD_ARROWSIZE2 > aRect.Right() )
+ bDraw = FALSE;
+
+ if ( bDraw )
+ {
+ long nArrowY;
+ if ( aTxtSize.Height() )
+ nArrowY = nTxtPosY+(aTxtSize.Height()/2);
+ else if ( aImageSize.Width() && aImageSize.Height() )
+ nArrowY = nImagePosY+(aImageSize.Height()/2);
+ else
+ {
+ if ( nBits & HIB_TOP )
+ nArrowY = aRect.Top()+1;
+ else if ( nBits & HIB_BOTTOM )
+ nArrowY = aRect.Bottom()-HEAD_ARROWSIZE2-1;
+ else
+ nArrowY = aRect.Top()+((aRect.GetHeight()-HEAD_ARROWSIZE2)/2);;
+ }
+ nArrowY -= HEAD_ARROWSIZE1-1;
+ if ( nBits & HIB_DOWNARROW )
+ {
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( Point( nArrowX, nArrowY ),
+ Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) );
+ pDev->DrawLine( Point( nArrowX, nArrowY ),
+ Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ) );
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ),
+ Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) );
+ }
+ else
+ {
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ),
+ Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) );
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ),
+ Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ) );
+ pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ),
+ Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) );
+ }
+ }
+ }
+
+ // Gegebenenfalls auch UserDraw aufrufen
+ if ( nBits & HIB_USERDRAW )
+ {
+ Region aRegion( aRect );
+ if ( pRect )
+ aRegion.Intersect( *pRect );
+ pDev->SetClipRegion( aRegion );
+ UserDrawEvent aODEvt( pDev, aRect, pItem->mnId );
+ UserDraw( aODEvt );
+ pDev->SetClipRegion();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplDrawItem( USHORT nPos, BOOL bHigh, BOOL bDrag,
+ const Rectangle* pRect )
+{
+ Rectangle aRect = ImplGetItemRect( nPos );
+ ImplDrawItem( this, nPos, bHigh, bDrag, aRect, pRect, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplUpdate( USHORT nPos, BOOL bEnd, BOOL bDirect )
+{
+ if ( IsVisible() && IsUpdateMode() )
+ {
+ if ( !bDirect )
+ {
+ Rectangle aRect;
+ USHORT nItemCount = (USHORT)(mpItemList->Count());
+ if ( nPos < nItemCount )
+ aRect = ImplGetItemRect( nPos );
+ else
+ {
+ aRect.Bottom() = mnDY-1;
+ if ( nItemCount )
+ aRect.Left() = ImplGetItemRect( nItemCount-1 ).Right();
+ }
+ if ( bEnd )
+ aRect.Right() = mnDX-1;
+ aRect.Top() += mnBorderOff1;
+ aRect.Bottom() -= mnBorderOff2;
+ Invalidate( aRect );
+ }
+ else
+ {
+ for ( USHORT i = nPos; i < mpItemList->Count(); i++ )
+ ImplDrawItem( i );
+ if ( bEnd )
+ {
+ Rectangle aRect = ImplGetItemRect( (USHORT)mpItemList->Count() );
+ aRect.Left() = aRect.Right();
+ aRect.Right() = mnDX-1;
+ if ( aRect.Left() < aRect.Right() )
+ {
+ aRect.Top() += mnBorderOff1;
+ aRect.Bottom() -= mnBorderOff2;
+ Erase( aRect );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplStartDrag( const Point& rMousePos, BOOL bCommand )
+{
+ USHORT nPos;
+ USHORT nHitTest = ImplHitTest( rMousePos, mnMouseOff, nPos );
+ if ( nHitTest )
+ {
+ mbDrag = FALSE;
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ if ( nHitTest & HEAD_HITTEST_DIVIDER )
+ mbDrag = TRUE;
+ else
+ {
+ if ( ((pItem->mnBits & HIB_CLICKABLE) && !(pItem->mnBits & HIB_FLAT)) ||
+ (mbDragable && !(pItem->mnBits & HIB_FIXEDPOS)) )
+ {
+ mbItemMode = TRUE;
+ mbDrag = TRUE;
+ if ( bCommand )
+ {
+ if ( mbDragable )
+ mbItemDrag = TRUE;
+ else
+ {
+ mbItemMode = FALSE;
+ mbDrag = FALSE;
+ }
+ }
+ }
+ else
+ {
+ if ( !bCommand )
+ {
+ mnCurItemId = pItem->mnId;
+ Select();
+ mnCurItemId = 0;
+ }
+ }
+ }
+
+ if ( mbDrag )
+ {
+ mbOutDrag = FALSE;
+ mnCurItemId = pItem->mnId;
+ mnItemDragPos = nPos;
+ StartTracking();
+ mnStartPos = rMousePos.X()-mnMouseOff;
+ mnDragPos = mnStartPos;
+ StartDrag();
+ if ( mbItemMode )
+ ImplDrawItem( nPos, TRUE, mbItemDrag );
+ else
+ {
+ Rectangle aSizeRect( mnDragPos, 0, mnDragPos, mnDragSize+mnDY );
+ ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
+ }
+ }
+ else
+ mnMouseOff = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplDrag( const Point& rMousePos )
+{
+ BOOL bNewOutDrag;
+ USHORT nPos = GetItemPos( mnCurItemId );
+
+ mnDragPos = rMousePos.X()-mnMouseOff;
+ if ( mbItemMode )
+ {
+ Rectangle aItemRect = ImplGetItemRect( nPos );
+ if ( aItemRect.IsInside( rMousePos ) )
+ bNewOutDrag = FALSE;
+ else
+ bNewOutDrag = TRUE;
+
+ // Evt. ItemDrag anschalten
+ if ( bNewOutDrag && mbDragable && !mbItemDrag &&
+ !(mpItemList->GetObject(nPos)->mnBits & HIB_FIXEDPOS) )
+ {
+ if ( (rMousePos.Y() >= aItemRect.Top()) && (rMousePos.Y() <= aItemRect.Bottom()) )
+ {
+ mbItemDrag = TRUE;
+ ImplDrawItem( nPos, TRUE, mbItemDrag );
+ }
+ }
+
+ USHORT nOldItemDragPos = mnItemDragPos;
+ if ( mbItemDrag )
+ {
+ if ( (rMousePos.Y() < -HEADERBAR_DRAGOUTOFF) || (rMousePos.Y() > mnDY+HEADERBAR_DRAGOUTOFF) )
+ bNewOutDrag = TRUE;
+ else
+ bNewOutDrag = FALSE;
+
+ if ( bNewOutDrag )
+ mnItemDragPos = HEADERBAR_ITEM_NOTFOUND;
+ else
+ {
+ USHORT nTempId = GetItemId( Point( rMousePos.X(), 2 ) );
+ if ( nTempId )
+ mnItemDragPos = GetItemPos( nTempId );
+ else
+ {
+ if ( rMousePos.X() <= 0 )
+ mnItemDragPos = 0;
+ else
+ mnItemDragPos = GetItemCount()-1;
+ }
+
+ // Nicht verschiebbare Items aussparen
+ if ( mnItemDragPos < nPos )
+ {
+ while ( (mpItemList->GetObject(mnItemDragPos)->mnBits & HIB_FIXEDPOS) &&
+ (mnItemDragPos < nPos) )
+ mnItemDragPos++;
+ }
+ else if ( mnItemDragPos > nPos )
+ {
+ while ( (mpItemList->GetObject(mnItemDragPos)->mnBits & HIB_FIXEDPOS) &&
+ (mnItemDragPos > nPos) )
+ mnItemDragPos--;
+ }
+ }
+
+ if ( (mnItemDragPos != nOldItemDragPos) &&
+ (nOldItemDragPos != nPos) &&
+ (nOldItemDragPos != HEADERBAR_ITEM_NOTFOUND) )
+ {
+ ImplInvertDrag( nPos, nOldItemDragPos );
+ ImplDrawItem( nOldItemDragPos );
+ }
+ }
+
+ if ( bNewOutDrag != mbOutDrag )
+ ImplDrawItem( nPos, !bNewOutDrag, mbItemDrag );
+
+ if ( mbItemDrag )
+ {
+ if ( (mnItemDragPos != nOldItemDragPos) &&
+ (mnItemDragPos != nPos) &&
+ (mnItemDragPos != HEADERBAR_ITEM_NOTFOUND) )
+ {
+ ImplDrawItem( mnItemDragPos, FALSE, TRUE );
+ ImplInvertDrag( nPos, mnItemDragPos );
+ }
+ }
+
+ mbOutDrag = bNewOutDrag;
+ }
+ else
+ {
+ Rectangle aItemRect = ImplGetItemRect( nPos );
+ if ( mnDragPos < aItemRect.Left() )
+ mnDragPos = aItemRect.Left();
+ if ( (mnDragPos < 0) || (mnDragPos > mnDX-1) )
+ HideTracking();
+ else
+ {
+ Rectangle aSizeRect( mnDragPos, 0, mnDragPos, mnDragSize+mnDY );
+ ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
+ }
+ }
+
+ Drag();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::ImplEndDrag( BOOL bCancel )
+{
+ HideTracking();
+
+ if ( bCancel || mbOutDrag )
+ {
+ if ( mbItemMode && (!mbOutDrag || mbItemDrag) )
+ {
+ USHORT nPos = GetItemPos( mnCurItemId );
+ ImplDrawItem( nPos );
+ }
+
+ mnCurItemId = 0;
+ }
+ else
+ {
+ USHORT nPos = GetItemPos( mnCurItemId );
+ if ( mbItemMode )
+ {
+ if ( mbItemDrag )
+ {
+ Pointer aPointer( POINTER_ARROW );
+ SetPointer( aPointer );
+ if ( (mnItemDragPos != nPos) &&
+ (mnItemDragPos != HEADERBAR_ITEM_NOTFOUND) )
+ {
+ ImplInvertDrag( nPos, mnItemDragPos );
+ MoveItem( mnCurItemId, mnItemDragPos );
+ }
+ else
+ ImplDrawItem( nPos );
+ }
+ else
+ {
+ Select();
+ ImplUpdate( nPos );
+ }
+ }
+ else
+ {
+ long nDelta = mnDragPos - mnStartPos;
+ if ( nDelta )
+ {
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ pItem->mnSize += nDelta;
+ ImplUpdate( nPos, TRUE );
+ }
+ }
+ }
+
+ mbDrag = FALSE;
+ EndDrag();
+ mnCurItemId = 0;
+ mnItemDragPos = HEADERBAR_ITEM_NOTFOUND;
+ mbOutDrag = FALSE;
+ mbItemMode = FALSE;
+ mbItemDrag = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ if ( rMEvt.GetClicks() == 2 )
+ {
+ long nTemp;
+ USHORT nPos;
+ USHORT nHitTest = ImplHitTest( rMEvt.GetPosPixel(), nTemp, nPos );
+ if ( nHitTest )
+ {
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ if ( nHitTest & HEAD_HITTEST_DIVIDER )
+ mbItemMode = FALSE;
+ else
+ mbItemMode = TRUE;
+ mnCurItemId = pItem->mnId;
+ DoubleClick();
+ mbItemMode = FALSE;
+ mnCurItemId = 0;
+ }
+ }
+ else
+ ImplStartDrag( rMEvt.GetPosPixel(), FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::MouseMove( const MouseEvent& rMEvt )
+{
+ long nTemp1;
+ USHORT nTemp2;
+ PointerStyle eStyle = POINTER_ARROW;
+ USHORT nHitTest = ImplHitTest( rMEvt.GetPosPixel(), nTemp1, nTemp2 );
+
+ if ( nHitTest & HEAD_HITTEST_DIVIDER )
+ eStyle = POINTER_HSIZEBAR;
+ Pointer aPtr( eStyle );
+ SetPointer( aPtr );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Tracking( const TrackingEvent& rTEvt )
+{
+ Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+
+ if ( rTEvt.IsTrackingEnded() )
+ ImplEndDrag( rTEvt.IsTrackingCanceled() );
+ else
+ ImplDrag( aMousePos );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Paint( const Rectangle& rRect )
+{
+ if ( mnBorderOff1 || mnBorderOff2 )
+ {
+ SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() );
+ if ( mnBorderOff1 )
+ DrawLine( Point( 0, 0 ), Point( mnDX-1, 0 ) );
+ if ( mnBorderOff2 )
+ DrawLine( Point( 0, mnDY-1 ), Point( mnDX-1, mnDY-1 ) );
+ }
+
+ USHORT nCurItemPos;
+ if ( mbDrag )
+ nCurItemPos = GetItemPos( mnCurItemId );
+ else
+ nCurItemPos = HEADERBAR_ITEM_NOTFOUND;
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+ for ( USHORT i = 0; i < nItemCount; i++ )
+ ImplDrawItem( i, (i == nCurItemPos) ? TRUE : FALSE, FALSE, &rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Rectangle aRect( aPos, aSize );
+ Font aFont = GetDrawPixelFont( pDev );
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ if ( nFlags & WINDOW_DRAW_MONO )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ pDev->SetTextColor( GetTextColor() );
+ pDev->SetTextFillColor();
+
+ if ( !(nFlags & WINDOW_DRAW_NOBACKGROUND) )
+ {
+ pDev->DrawWallpaper( aRect, GetBackground() );
+ if ( mnBorderOff1 || mnBorderOff2 )
+ {
+ pDev->SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() );
+ if ( mnBorderOff1 )
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right(), aRect.Top() ) );
+ if ( mnBorderOff2 )
+ pDev->DrawLine( Point( aRect.Left(), aRect.Bottom() ), Point( aRect.Right(), aRect.Bottom() ) );
+ }
+ }
+
+ Rectangle aItemRect( aRect );
+// aItemRect.Bottom()--;
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+ for ( USHORT i = 0; i < nItemCount; i++ )
+ {
+ aItemRect.Left() = aRect.Left()+ImplGetItemPos( i );
+ aItemRect.Right() = aItemRect.Left() + mpItemList->GetObject( i )->mnSize - 1;
+ // Gegen Ueberlauf auf einigen Systemen testen
+ if ( aItemRect.Right() > 16000 )
+ aItemRect.Right() = 16000;
+ Region aRegion( aRect );
+ pDev->SetClipRegion( aRegion );
+ ImplDrawItem( pDev, i, FALSE, FALSE, aItemRect, &aRect, nFlags );
+ pDev->SetClipRegion();
+ }
+
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Resize()
+{
+ Size aSize = GetOutputSizePixel();
+ if ( IsVisible() && (mnDY != aSize.Height()) )
+ Invalidate();
+ mnDX = aSize.Width();
+ mnDY = aSize.Height();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.IsMouseEvent() && (rCEvt.GetCommand() == COMMAND_STARTDRAG) && !mbDrag )
+ {
+ ImplStartDrag( rCEvt.GetMousePosPixel(), TRUE );
+ return;
+ }
+
+ Window::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+ if ( nItemId )
+ {
+ if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) )
+ {
+ Rectangle aItemRect = GetItemRect( nItemId );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+
+ XubString aStr = GetHelpText( nItemId );
+ if ( !aStr.Len() || !(rHEvt.GetMode() & HELPMODE_BALLOON) )
+ {
+ ImplHeadItem* pItem = mpItemList->GetObject( GetItemPos( nItemId ) );
+ // Wir zeigen die Quick-Hilfe nur an, wenn Text nicht
+ // vollstaendig sichtbar, ansonsten zeigen wir den Hilfetext
+ // an, wenn das Item keinen Text besitzt
+ if ( pItem->maOutText != pItem->maText )
+ aStr = pItem->maText;
+ else if ( pItem->maText.Len() )
+ aStr.Erase();
+ }
+
+ if ( aStr.Len() )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
+ else
+ Help::ShowQuickHelp( this, aItemRect, aStr );
+ return;
+ }
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
+ {
+ ULONG nHelpId = GetHelpId( nItemId );
+ if ( nHelpId )
+ {
+ // Wenn eine Hilfe existiert, dann ausloesen
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pHelp->Start( nHelpId );
+ return;
+ }
+ }
+ }
+
+ Window::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_ENABLE )
+ Invalidate();
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::UserDraw( const UserDrawEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::StartDrag()
+{
+ maStartDragHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Drag()
+{
+ maDragHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::EndDrag()
+{
+ maEndDragHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::InsertItem( USHORT nItemId, const Image& rImage,
+ long nSize, HeaderBarItemBits nBits, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "HeaderBar::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == HEADERBAR_ITEM_NOTFOUND,
+ "HeaderBar::InsertItem(): ItemId already exists" );
+
+ // Item anlegen und in die Liste einfuegen
+ ImplHeadItem* pItem = new ImplHeadItem;
+ pItem->mnId = nItemId;
+ pItem->mnBits = nBits;
+ pItem->mnSize = nSize;
+ pItem->maImage = rImage;
+ pItem->mpUserData = 0;
+ mpItemList->Insert( pItem, nPos );
+
+ // Ausgabe updaten
+ ImplUpdate( nPos, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::InsertItem( USHORT nItemId, const XubString& rText,
+ long nSize, HeaderBarItemBits nBits, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "HeaderBar::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == HEADERBAR_ITEM_NOTFOUND,
+ "HeaderBar::InsertItem(): ItemId already exists" );
+
+ // Item anlegen und in die Liste einfuegen
+ ImplHeadItem* pItem = new ImplHeadItem;
+ pItem->mnId = nItemId;
+ pItem->mnBits = nBits;
+ pItem->mnSize = nSize;
+ pItem->mnHelpId = 0;
+ pItem->maText = rText;
+ pItem->mpUserData = 0;
+ mpItemList->Insert( pItem, nPos );
+
+ // Ausgabe updaten
+ ImplUpdate( nPos, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::InsertItem( USHORT nItemId,
+ const Image& rImage, const XubString& rText,
+ long nSize, HeaderBarItemBits nBits,
+ USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "HeaderBar::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == HEADERBAR_ITEM_NOTFOUND,
+ "HeaderBar::InsertItem(): ItemId already exists" );
+
+ // Item anlegen und in die Liste einfuegen
+ ImplHeadItem* pItem = new ImplHeadItem;
+ pItem->mnId = nItemId;
+ pItem->mnBits = nBits;
+ pItem->mnSize = nSize;
+ pItem->mnHelpId = 0;
+ pItem->maImage = rImage;
+ pItem->maText = rText;
+ pItem->mpUserData = 0;
+ mpItemList->Insert( pItem, nPos );
+
+ // Ausgabe updaten
+ ImplUpdate( nPos, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::RemoveItem( USHORT nItemId )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ ImplHeadItem* pItem = mpItemList->Remove( nPos );
+ delete pItem;
+ ImplUpdate( nPos, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::MoveItem( USHORT nItemId, USHORT nNewPos )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ if ( nPos != nNewPos )
+ {
+ ImplHeadItem* pItem = mpItemList->Remove( nPos );
+ if ( nNewPos < nPos )
+ nPos = nNewPos;
+ mpItemList->Insert( pItem, nNewPos );
+ ImplUpdate( nPos, TRUE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::Clear()
+{
+ // Alle Items loeschen
+ ImplHeadItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+ mpItemList->Clear();
+
+ ImplUpdate( 0, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetOffset( long nNewOffset )
+{
+ // Hier erstmal neu zeichnen, damit mit alten Offset noch das
+ // richtige gemalt wird
+ //Update();
+
+ // Bereich verschieben
+ Rectangle aRect( 0, mnBorderOff1, mnDX-1, mnDY-mnBorderOff1-mnBorderOff2-1 );
+ long nDelta = mnOffset-nNewOffset;
+ mnOffset = nNewOffset;
+ Scroll( nDelta, 0, aRect );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT HeaderBar::GetItemCount() const
+{
+ return (USHORT)mpItemList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT HeaderBar::GetItemPos( USHORT nItemId ) const
+{
+ ImplHeadItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nItemId )
+ return (USHORT)mpItemList->GetCurPos();
+ pItem = mpItemList->Next();
+ }
+
+ return HEADERBAR_ITEM_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT HeaderBar::GetItemId( USHORT nPos ) const
+{
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem )
+ return pItem->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT HeaderBar::GetItemId( const Point& rPos ) const
+{
+ USHORT nPos = 0;
+ while ( nPos < mpItemList->Count() )
+ {
+ if ( ImplGetItemRect( nPos ).IsInside( rPos ) )
+ return GetItemId( nPos );
+
+ nPos++;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle HeaderBar::GetItemRect( USHORT nItemId ) const
+{
+ Rectangle aRect;
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ aRect = ImplGetItemRect( nPos );
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetItemSize( USHORT nItemId, long nNewSize )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem->mnSize != nNewSize )
+ {
+ pItem->mnSize = nNewSize;
+ ImplUpdate( nPos, TRUE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long HeaderBar::GetItemSize( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnSize;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetItemBits( USHORT nItemId, HeaderBarItemBits nNewBits )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem->mnBits != nNewBits )
+ {
+ pItem->mnBits = nNewBits;
+ ImplUpdate( nPos );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+HeaderBarItemBits HeaderBar::GetItemBits( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnBits;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetItemData( USHORT nItemId, void* pNewData )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ mpItemList->GetObject( nPos )->mpUserData = pNewData;
+ ImplUpdate( nPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void* HeaderBar::GetItemData( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mpUserData;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetItemImage( USHORT nItemId, const Image& rImage )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ mpItemList->GetObject( nPos )->maImage = rImage;
+ ImplUpdate( nPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image HeaderBar::GetItemImage( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maImage;
+ else
+ return Image();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetItemText( USHORT nItemId, const XubString& rText )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ mpItemList->GetObject( nPos )->maText = rText;
+ ImplUpdate( nPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString HeaderBar::GetItemText( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maText;
+ else
+ return String();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetHelpText( USHORT nItemId, const XubString& rText )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ mpItemList->GetObject( nPos )->maHelpText = rText;
+}
+
+// -----------------------------------------------------------------------
+
+XubString HeaderBar::GetHelpText( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ {
+ ImplHeadItem* pItem = mpItemList->GetObject( nPos );
+ if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
+ {
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId );
+ }
+
+ return pItem->maHelpText;
+ }
+ else
+ return XubString();
+}
+
+// -----------------------------------------------------------------------
+
+void HeaderBar::SetHelpId( USHORT nItemId, ULONG nHelpId )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ mpItemList->GetObject( nPos )->mnHelpId = nHelpId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG HeaderBar::GetHelpId( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != HEADERBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnHelpId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Size HeaderBar::CalcWindowSizePixel() const
+{
+ long nMaxImageSize = 0;
+ Size aSize( 0, GetTextHeight() );
+
+ ImplHeadItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Image-Groessen beruecksichtigen
+ long nImageHeight = pItem->maImage.GetSizePixel().Height();
+ if ( !(pItem->mnBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) && pItem->maText.Len() )
+ nImageHeight += aSize.Height();
+ if ( nImageHeight > nMaxImageSize )
+ nMaxImageSize = nImageHeight;
+
+ // Breite aufaddieren
+ aSize.Width() += pItem->mnSize;
+
+ pItem = mpItemList->Next();
+ }
+
+ if ( nMaxImageSize > aSize.Height() )
+ aSize.Height() = nMaxImageSize;
+
+ // Border aufaddieren
+ if ( mbButtonStyle )
+ aSize.Height() += 4;
+ else
+ aSize.Height() += 2;
+ aSize.Height() += mnBorderOff1+mnBorderOff2;
+
+ return aSize;
+}
diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk
new file mode 100644
index 000000000000..f3f0e97e9b47
--- /dev/null
+++ b/svtools/source/control/makefile.mk
@@ -0,0 +1,141 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=ctrl
+TARGETSTAT=_ctrl
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= ctrltool.cxx \
+ ctrlbox.cxx \
+ stdctrl.cxx \
+ stdmenu.cxx \
+ valueset.cxx \
+ tabbar.cxx \
+ headbar.cxx \
+ prgsbar.cxx \
+ ruler.cxx \
+ taskbar.cxx \
+ taskbox.cxx \
+ taskstat.cxx \
+ taskmisc.cxx \
+ calendar.cxx \
+ filectrl.cxx \
+ scrwin.cxx \
+ reginfo.cxx \
+ groupset.cxx \
+ fmtfield.cxx
+
+.IF "$(GUI)"!="DOS"
+SRCFILES= ctrltool.src \
+ ctrlbox.src \
+ calendar.src \
+ filectrl.src
+.ENDIF
+
+SLOFILES= $(SLO)$/ctrltool.obj \
+ $(SLO)$/ctrlbox.obj \
+ $(SLO)$/stdctrl.obj \
+ $(SLO)$/stdmenu.obj \
+ $(SLO)$/valueset.obj \
+ $(SLO)$/tabbar.obj \
+ $(SLO)$/headbar.obj \
+ $(SLO)$/prgsbar.obj \
+ $(SLO)$/ruler.obj \
+ $(SLO)$/taskbar.obj \
+ $(SLO)$/taskbox.obj \
+ $(SLO)$/taskstat.obj \
+ $(SLO)$/taskmisc.obj \
+ $(SLO)$/calendar.obj \
+ $(SLO)$/filectrl.obj \
+ $(SLO)$/scrwin.obj \
+ $(SLO)$/reginfo.obj \
+ $(SLO)$/groupset.obj \
+ $(SLO)$/fmtfield.obj
+
+# statisch fuer setup
+
+OBJFILES= $(OBJ)$/prgsbar.obj \
+ $(OBJ)$/stdctrl.obj \
+ $(OBJ)$/reginfo.obj \
+ $(OBJ)$/tabbar.obj
+
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= $(SLOFILES)
+
+LIB2TARGET= $(LB)$/$(TARGETSTAT).lib
+LIB2OBJFILES= $(OBJFILES)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/control/prgsbar.cxx b/svtools/source/control/prgsbar.cxx
new file mode 100644
index 000000000000..e370d9d87c22
--- /dev/null
+++ b/svtools/source/control/prgsbar.cxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * $RCSfile: prgsbar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_PRGSBAR_CXX
+
+#ifndef _TOOLS_DEBUGS_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _VCL_STATUS_HXX
+#include <vcl/status.hxx>
+#endif
+#ifndef _PRGSBAR_HXX
+#include <prgsbar.hxx>
+#endif
+
+// =======================================================================
+
+#define PROGRESSBAR_OFFSET 3
+#define PROGRESSBAR_WIN_OFFSET 2
+
+// =======================================================================
+
+void ProgressBar::ImplInit()
+{
+ mnPercent = 0;
+ mbCalcNew = TRUE;
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+ProgressBar::ProgressBar( Window* pParent, WinBits nWinStyle ) :
+ Window( pParent, nWinStyle )
+{
+ SetOutputSizePixel( Size( 150, 20 ) );
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+ProgressBar::ProgressBar( Window* pParent, const ResId& rResId ) :
+ Window( pParent, rResId )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+ProgressBar::~ProgressBar()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ProgressBar::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+/* !!! Derzeit unterstuetzen wir keine Textausgaben
+ if ( bFont )
+ {
+ Font aFont;
+ aFont = rStyleSettings.GetAppFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+*/
+
+ if ( bBackground )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else
+ aColor = rStyleSettings.GetFaceColor();
+ SetBackground( aColor );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor = rStyleSettings.GetHighlightColor();
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ if ( aColor.IsRGBEqual( GetBackground().GetColor() ) )
+ {
+ if ( aColor.GetLuminance() > 100 )
+ aColor.DecreaseLuminance( 64 );
+ else
+ aColor.IncreaseLuminance( 64 );
+ }
+ SetLineColor();
+ SetFillColor( aColor );
+/* !!! Derzeit unterstuetzen wir keine Textausgaben
+ SetTextColor( aColor );
+ SetTextFillColor();
+*/
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ProgressBar::ImplDrawProgress( USHORT nOldPerc, USHORT nNewPerc )
+{
+ if ( mbCalcNew )
+ {
+ mbCalcNew = FALSE;
+
+ Size aSize = GetOutputSizePixel();
+ mnPrgsHeight = aSize.Height()-(PROGRESSBAR_WIN_OFFSET*2);
+ mnPrgsWidth = (mnPrgsHeight*2)/3;
+ maPos.Y() = PROGRESSBAR_WIN_OFFSET;
+ long nMaxWidth = (aSize.Width()-(PROGRESSBAR_WIN_OFFSET*2)+PROGRESSBAR_OFFSET);
+ USHORT nMaxCount = (USHORT)(nMaxWidth / (mnPrgsWidth+PROGRESSBAR_OFFSET));
+ if ( nMaxCount <= 1 )
+ nMaxCount = 1;
+ else
+ {
+ while ( ((10000/(10000/nMaxCount))*(mnPrgsWidth+PROGRESSBAR_OFFSET)) > nMaxWidth )
+ nMaxCount--;
+ }
+ mnPercentCount = 10000/nMaxCount;
+ nMaxWidth = ((10000/(10000/nMaxCount))*(mnPrgsWidth+PROGRESSBAR_OFFSET))-PROGRESSBAR_OFFSET;
+ maPos.X() = (aSize.Width()-nMaxWidth)/2;
+ }
+
+ ::DrawProgress( this, maPos, PROGRESSBAR_OFFSET, mnPrgsWidth, mnPrgsHeight,
+ nOldPerc*100, nNewPerc*100, mnPercentCount );
+}
+
+// -----------------------------------------------------------------------
+
+void ProgressBar::Paint( const Rectangle& )
+{
+ ImplDrawProgress( 0, mnPercent );
+}
+
+// -----------------------------------------------------------------------
+
+void ProgressBar::Resize()
+{
+ mbCalcNew = TRUE;
+ if ( IsReallyVisible() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ProgressBar::SetValue( USHORT nNewPercent )
+{
+ DBG_ASSERTWARNING( nNewPercent <= 100, "StatusBar::SetProgressValue(): nPercent > 100" );
+
+ if ( nNewPercent < mnPercent )
+ {
+ mbCalcNew = TRUE;
+ mnPercent = nNewPercent;
+ if ( IsReallyVisible() )
+ {
+ Invalidate();
+ Update();
+ }
+ }
+ else
+ {
+ ImplDrawProgress( mnPercent, nNewPercent );
+ mnPercent = nNewPercent;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ProgressBar::StateChanged( StateChangedType nType )
+{
+/* !!! Derzeit unterstuetzen wir keine Textausgaben
+ if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else
+*/
+ if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void ProgressBar::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+
+ Window::DataChanged( rDCEvt );
+}
+
diff --git a/svtools/source/control/reginfo.cxx b/svtools/source/control/reginfo.cxx
new file mode 100644
index 000000000000..40c76ca1f9fe
--- /dev/null
+++ b/svtools/source/control/reginfo.cxx
@@ -0,0 +1,785 @@
+/*************************************************************************
+ *
+ * $RCSfile: reginfo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifdef MAC
+#include "mac_start.h"
+
+#ifndef __TYPES__
+ #include <Types.h>
+#endif
+
+#ifndef __RESOURCES__
+ #include <Resources.h>
+#endif
+
+#ifndef __FILES__
+ #include <Files.h>
+#endif
+
+#ifndef __ERRORS__
+ #include <Errors.h>
+#endif
+
+#ifndef __FOLDERS__
+ #include <Folders.h>
+#endif
+
+#ifndef __SCRIPT__
+ #include <script.h>
+#endif
+
+#ifndef __FINDER__
+ #include <finder.h>
+#endif
+#include "mac_end.h"
+#endif
+
+#include "reginfo.hxx"
+
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+
+String aEmptyString;
+
+#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 aEmptyString;
+ 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 aEmptyString;
+ String aRes;
+ if(ReadKey_Impl( rKey, pImp->aGroupHdl, aRes))
+ return aRes;
+ else
+ return aEmptyString;
+}
+
+String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const
+{
+ DBG_HDL aEmptyString;
+ 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 <tools/svpm.h>
+
+struct RegInfo_Impl
+{
+ char *pKeyList;
+ String aCurrentApp;
+ void BuildKeyList( const String &rGroup );
+};
+
+void RegInfo_Impl::BuildKeyList( const String &rGroup )
+{
+ USHORT nLen = 0;
+ do
+ {
+ nLen+=1000;
+ delete[] pKeyList;
+ pKeyList = new char[nLen];
+ *(int *)pKeyList = 0;
+ }
+ while( PrfQueryProfileString(
+ HINI_USERPROFILE, rGroup,
+ 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("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(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 )
+{
+ PrfWriteProfileString(
+ HINI_USERPROFILE, MakeAppGroupString_Impl( rGroup ), 0, 0);
+}
+
+
+String RegInfo::ReadKey( const String& rKey ) const
+{
+ char *pBuffer= new char[MAXREGVALUE];
+ *pBuffer=0;
+ PrfQueryProfileString(
+ HINI_USERPROFILE, pImp->aCurrentApp, rKey, 0, pBuffer, MAXREGVALUE);
+ String aRet(pBuffer);
+ delete[] pBuffer;
+ return aRet;
+}
+
+
+String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const
+{
+ char *pBuffer= new char[MAXREGVALUE];
+ *pBuffer=0;
+ PrfQueryProfileString(
+ HINI_USERPROFILE, pImp->aCurrentApp, rKey, rDefault, pBuffer, MAXREGVALUE);
+ String aRet(pBuffer);
+ delete[] pBuffer;
+ return aRet;
+}
+
+
+void RegInfo::WriteKey( const String& rKey, const String& rValue )
+{
+ PrfWriteProfileString(
+ HINI_USERPROFILE, pImp->aCurrentApp, rKey, rValue);
+}
+
+void RegInfo::DeleteKey( const String& rKey )
+{
+ PrfWriteProfileString(
+ HINI_USERPROFILE, pImp->aCurrentApp, rKey, 0);
+}
+
+#elif defined(MAC)
+
+/* Idee:
+
+ In eine Resource SVðð (SV<Apfel><Apfel>) sind die Resource IDs
+ der Gruppen Ÿber den Namen der Resource zugŠnglich.
+
+ †ber die aktuelle Gruppe sind die Values Ÿber den Namen der Resource
+ als Key zugŠnglich ...
+*/
+
+// Wir tuen so, als wŠren es "normale" SV-Resourcen
+
+#define kAPPInfo 'SVðð'
+
+//****************************************************
+
+#pragma options align=mac68k
+
+typedef struct
+{
+ OSType nResType; // kAPPInfo + k
+}
+ SVGroupInfo, *SVGroupInfoPtr, **SVGroupInfoHdl;
+
+//****************************************************
+
+typedef struct
+{
+ USHORT nValueLen;
+ char aValue[1]; // LŠnge wie in nLen
+}
+ SVKeyInfo, *SVKeyInfoPtr, **SVKeyInfoHdl;
+
+//****************************************************
+
+#pragma options align=reset
+
+//****************************************************
+
+struct RegInfo_Impl
+{
+ short nResFile;
+ OSType nCurrentGroup;
+ String aCurrentName;
+
+ SVGroupInfoHdl GetNamedInfo(const String& rName);
+
+ BOOL FindInfoFile( const String& rName, FSSpec *pResult );
+};
+
+//****************************************************
+
+SVGroupInfoHdl RegInfo_Impl::GetNamedInfo(const String& rName)
+{
+ String aName(rName);
+ short nOldRes = CurResFile();
+ UseResFile(nResFile);
+
+ SVGroupInfoHdl hResult = (SVGroupInfoHdl) Get1NamedResource(kAPPInfo,rName.GetPascalStr());
+
+ UseResFile(nOldRes);
+
+ return hResult;
+}
+
+//****************************************************
+
+BOOL RegInfo_Impl::FindInfoFile( const String& rName, FSSpec *pResult )
+{
+ OSErr nErr;
+ long nDirID;
+ short nVRefNum;
+ BOOL bResult = FALSE;
+
+ nErr = FindFolder( kOnSystemDisk, kPreferencesFolderType,
+ kCreateFolder, &nVRefNum, &nDirID );
+
+ if ( nErr == noErr )
+ {
+ nErr = FSMakeFSSpec( nVRefNum, nDirID, rName.GetPascalStr(), pResult );
+ if ( nErr == fnfErr )
+ {
+ FSpCreateResFile( pResult, 'SDsv', 'DATA', smRoman );
+ nErr = FSMakeFSSpec( nVRefNum, nDirID, rName.GetPascalStr(), pResult );
+ }
+ if ( nErr == noErr )
+ {
+ FInfo aInfo;
+ nErr = FSpGetFInfo( pResult, &aInfo );
+ if ( ( nErr == noErr ) && ! ( aInfo.fdFlags & kIsInvisible ) )
+ {
+ aInfo.fdFlags |= kIsInvisible;
+ nErr = FSpSetFInfo( pResult, &aInfo );
+ }
+ bResult = TRUE;
+ }
+ }
+
+ return bResult;
+}
+
+//****************************************************
+
+RegInfo::RegInfo()
+{
+ FSSpec aFile;
+
+ if ( !pImp->FindInfoFile( "svdbt.dll", &aFile ) )
+ {
+ pImp = NULL;
+ return;
+ }
+
+ pImp=new RegInfo_Impl;
+
+ short nOldRes = CurResFile();
+ pImp->nResFile = FSpOpenResFile( &aFile, fsRdWrPerm );
+ pImp->nCurrentGroup = 0L;
+ UseResFile( nOldRes );
+
+ if ( pImp->nResFile < 0 )
+ {
+ delete pImp;
+ pImp = NULL;
+ }
+}
+
+//****************************************************
+
+RegInfo::~RegInfo()
+{
+ if (pImp)
+ {
+ CloseResFile( pImp->nResFile );
+ delete pImp;
+ }
+}
+
+//****************************************************
+
+String RegInfo::GetKeyName( USHORT nKey ) const
+{
+ String aResult;
+
+ if (!pImp || !pImp -> nCurrentGroup)
+ return aResult;
+
+ short nOldRes = CurResFile();
+ UseResFile(pImp -> nResFile);
+
+ SVKeyInfoHdl hKeyInfo = (SVKeyInfoHdl) Get1IndResource(pImp -> nCurrentGroup,nKey + 1);
+
+ if (hKeyInfo)
+ {
+ Str255 aName;
+ ResType nType;
+ short nMacKey;
+
+ GetResInfo((Handle) hKeyInfo,&nMacKey,&nType,aName);
+ if (ResError() == noErr)
+ aResult = String((char*) &aName[1], aName[0]);
+ }
+
+ UseResFile(nOldRes);
+ return aResult;
+}
+
+//****************************************************
+
+USHORT RegInfo::GetKeyCount() const
+{
+ USHORT nResult = 0;
+
+ if (pImp -> nCurrentGroup)
+ {
+ short nOldRes = CurResFile();
+ UseResFile(pImp -> nResFile);
+
+ nResult = Count1Resources(pImp -> nCurrentGroup);
+ UseResFile(nOldRes);
+ }
+ return nResult;
+}
+
+//****************************************************
+
+void RegInfo::SetAppGroup( const String& rGroup )
+{
+ if (!pImp)
+ return;
+
+ pImp->aCurrentName = rGroup;
+ SVGroupInfoHdl hGroup = pImp -> GetNamedInfo(rGroup);
+ if (hGroup)
+ {
+ pImp->nCurrentGroup = (*hGroup)-> nResType;
+ ReleaseResource((Handle) hGroup);
+ }
+ else
+ pImp->nCurrentGroup = 0L;
+}
+
+//****************************************************
+
+void RegInfo::DeleteAppGroup( const String &rGroup )
+{
+ SVGroupInfoHdl hToDelete = pImp -> GetNamedInfo(rGroup);
+ if (hToDelete)
+ {
+ if ((*hToDelete)-> nResType == pImp->nCurrentGroup)
+ {
+ pImp->nCurrentGroup = 0L;
+ pImp->aCurrentName.Erase();
+ }
+ RemoveResource((Handle) hToDelete);
+ }
+}
+
+//****************************************************
+
+String RegInfo::ReadKey( const String& rKey ) const
+{
+ String aResult;
+
+ if (!pImp || !pImp -> nCurrentGroup)
+ return aResult;
+
+ short nOldRes = CurResFile();
+ UseResFile(pImp -> nResFile);
+
+ SVKeyInfoHdl hKeyInfo = (SVKeyInfoHdl) Get1NamedResource(pImp->nCurrentGroup,rKey.GetPascalStr());
+
+ if (hKeyInfo)
+ {
+ HLock((Handle) hKeyInfo);
+ aResult = String((*hKeyInfo)->aValue, (*hKeyInfo)->nValueLen);
+ HUnlock((Handle) hKeyInfo);
+
+ ReleaseResource((Handle) hKeyInfo);
+ }
+
+ UseResFile(nOldRes);
+ return aResult;
+}
+
+//****************************************************
+
+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 )
+{
+ if (!pImp)
+ return;
+
+ short nOldRes = CurResFile();
+ UseResFile(pImp -> nResFile);
+
+ // Wenn wir noch keine Resource zur aktuellen Gruppe haben ...
+ if (!pImp -> nCurrentGroup)
+ {
+ // ... dann muessen wir hier eine Anlegen
+
+ if (!pImp -> aCurrentName.Len())
+ return; // Kein aktueller Name ???
+
+ short nNewId = Unique1ID(kAPPInfo);
+
+ SVGroupInfoHdl hNewInfo = (SVGroupInfoHdl) NewHandle(sizeof(SVGroupInfo));
+
+ // Die Neue Resource liegt im Bereich Ÿber "SVðð"
+ pImp -> nCurrentGroup = kAPPInfo + nNewId;
+
+ (*(hNewInfo))-> nResType = pImp -> nCurrentGroup;
+ DBG_ASSERT(CurResFile() == pImp -> nResFile,"wrong ResFile");
+ AddResource((Handle) hNewInfo ,kAPPInfo, nNewId, pImp -> aCurrentName.GetPascalStr());
+ ReleaseResource((Handle) hNewInfo);
+ }
+
+ SVKeyInfoHdl hKeyInfo = (SVKeyInfoHdl) Get1NamedResource(pImp -> nCurrentGroup,rKey.GetPascalStr());
+ int nNewSize = rValue.Len() + sizeof(USHORT);
+
+ // Haben wir zu diesem Key schon eine Resource ?
+ if (hKeyInfo)
+ {
+ int nSize = GetHandleSize((Handle) hKeyInfo);
+ OSErr nMemErr = noErr;
+ if (nSize < nNewSize)
+ {
+ SetHandleSize((Handle) hKeyInfo,nNewSize);
+ nMemErr = MemError();
+ }
+
+ if (nMemErr == noErr)
+ {
+ (*hKeyInfo)->nValueLen = rValue.Len();
+ BlockMoveData(rValue.GetStr(), (*hKeyInfo)->aValue, rValue.Len());
+ ChangedResource((Handle) hKeyInfo);
+ }
+ else // Handle konnte nicht groesser werden
+ RemoveResource((Handle) hKeyInfo);
+ }
+ else
+ {
+ // Resource zu diesemm Key neu anlegen
+
+ hKeyInfo = (SVKeyInfoHdl) NewHandle(nNewSize);
+ if (hKeyInfo)
+ {
+ short nNewId = Unique1ID(pImp -> nCurrentGroup);
+
+ (*hKeyInfo)->nValueLen = rValue.Len();
+ BlockMoveData(rValue.GetStr(), (*hKeyInfo)->aValue, rValue.Len());
+
+ AddResource((Handle) hKeyInfo ,pImp -> nCurrentGroup, nNewId, rKey.GetPascalStr());
+ }
+ }
+
+ UseResFile(nOldRes);
+}
+
+//****************************************************
+
+void RegInfo::DeleteKey( const String& rKey )
+{
+ // Wenn wir noch keine aktuellen Gruppe haben ...
+ if (!pImp -> nCurrentGroup)
+ return;
+
+ String aKey(rKey);
+
+ short nOldRes = CurResFile();
+ UseResFile(pImp -> nResFile);
+
+ SVKeyInfoHdl hKeyInfo = (SVKeyInfoHdl) Get1NamedResource(pImp -> nCurrentGroup,rKey.GetPascalStr());
+
+ if (hKeyInfo)
+ RemoveResource((Handle) hKeyInfo);
+
+ UseResFile(nOldRes);
+}
+
+//****************************************************
+
+#else
+
+RegInfo::RegInfo()
+{
+}
+
+
+RegInfo::~RegInfo()
+{
+}
+
+String RegInfo::GetKeyName( USHORT nKey ) const
+{
+ return aEmptyString;
+}
+
+USHORT RegInfo::GetKeyCount() const
+{
+ return 0;
+}
+
+void RegInfo::SetAppGroup( const String& rGroup )
+{
+ return ;
+}
+
+void RegInfo::DeleteAppGroup( const String &rGroup )
+{
+ return;
+}
+
+String RegInfo::ReadKey( const String& rKey ) const
+{
+ return aEmptyString;
+}
+
+String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const
+{
+ return aEmptyString;
+}
+
+void RegInfo::WriteKey( const String& rKey, const String& rValue )
+{
+ return;
+}
+
+void RegInfo::DeleteKey( const String& rKey )
+{
+ return;
+}
+
+#endif
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
new file mode 100644
index 000000000000..6124f5f8b042
--- /dev/null
+++ b/svtools/source/control/ruler.cxx
@@ -0,0 +1,3064 @@
+/*************************************************************************
+ *
+ * $RCSfile: ruler.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#ifdef VCL
+#include <vcl/svapp.hxx>
+#else
+#include <vcl/svapp.hxx>
+#endif
+#endif
+#ifndef _POLY_HXX
+#include <vcl/poly.hxx>
+#endif
+
+#define _SV_RULER_CXX
+#define private public
+#include <ruler.hxx>
+
+// =======================================================================
+
+#define RULER_OFF 2
+#define RULER_TEXTOFF 2
+#define RULER_RESIZE_OFF 4
+#define RULER_LINE_WIDTH 7
+#define RULER_MIN_SIZE 3
+
+#define RULER_TICK1_WIDTH 1
+#define RULER_TICK2_WIDTH 3
+#define RULER_TICK3_WIDTH 5
+
+#define RULER_VAR_SIZE 8
+
+#define RULER_TAB_HEIGHT2 2
+#define RULER_TAB_WIDTH2 2
+#define RULER_TAB_CWIDTH 8
+#define RULER_TAB_CWIDTH2 4
+#define RULER_TAB_CWIDTH3 4
+#define RULER_TAB_CWIDTH4 2
+#define RULER_TAB_DHEIGHT 4
+#define RULER_TAB_DHEIGHT2 1
+#define RULER_TAB_DWIDTH 5
+#define RULER_TAB_DWIDTH2 3
+#define RULER_TAB_DWIDTH3 3
+#define RULER_TAB_DWIDTH4 1
+
+#define RULER_UPDATE_LINES 0x01
+#define RULER_UPDATE_DRAW 0x02
+
+#define RULER_CLIP 150
+
+// =======================================================================
+
+#define RULER_UNIT_MM 0
+#define RULER_UNIT_CM 1
+#define RULER_UNIT_M 2
+#define RULER_UNIT_KM 3
+#define RULER_UNIT_INCH 4
+#define RULER_UNIT_FOOT 5
+#define RULER_UNIT_MILE 6
+#define RULER_UNIT_POINT 7
+#define RULER_UNIT_PICA 8
+#define RULER_UNIT_COUNT 9
+
+struct ImplRulerUnitData
+{
+ MapUnit eMapUnit; // MAP_UNIT zum Umrechnen
+ long nTickUnit; // Teiler fuer Einheit
+ long nTick1; // Schrittweite
+ long nTick2; // Tick fuer halbe Werte
+ long nTick3; // Tick fuer Zahlenausgabe
+ long n100THMM; // Teiler fuer Einheit
+ USHORT nUnitDigits; // Anzahl Nachkommastellen
+ sal_Char aUnitStr[8]; // Einheiten-String
+};
+
+static ImplRulerUnitData aImplRulerUnitTab[RULER_UNIT_COUNT] =
+{
+{ MAP_100TH_MM, 100, 25, 50, 100, 100, 3, " mm" }, // MM
+{ MAP_100TH_MM, 1000, 250, 500, 1000, 1000, 3, " cm" }, // CM
+{ MAP_MM, 1000, 250, 500, 1000, 10000, 4, " m" }, // M
+{ MAP_CM, 100000, 25000, 50000, 100000, 100000, 6, " km" }, // KM
+{ MAP_100TH_INCH, 100, 10, 50, 100, 2540, 3, "\"" }, // INCH
+{ MAP_100TH_INCH, 1200, 120, 600, 1200, 30480, 3, "'" }, // FOOT
+{ MAP_10TH_INCH, 633600, 63360, 316800, 633600, 1609344, 4, " miles" }, // MILE
+{ MAP_POINT, 1, 12, 12, 36, 353, 2, " pt" }, // POINT
+{ MAP_100TH_MM, 423, 423, 423, 846, 423, 3, " pi" } // PICA
+};
+
+// =======================================================================
+
+struct ImplRulerHitTest
+{
+ long nPos;
+ RulerType eType;
+ USHORT nAryPos;
+ USHORT mnDragSize;
+ BOOL bSize;
+ BOOL bSizeBar;
+};
+
+// =======================================================================
+
+ImplRulerData::ImplRulerData()
+{
+ memset( this, 0, sizeof( ImplRulerData ) );
+
+ // PageBreite == EditWinBreite
+ bAutoPageWidth = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplRulerData::~ImplRulerData()
+{
+ if ( pLines )
+ delete pLines;
+
+ if ( pArrows )
+ delete pArrows;
+
+ if ( pBorders )
+ delete pBorders;
+
+ if ( pIndents )
+ delete pIndents;
+
+ if ( pTabs )
+ delete pTabs;
+}
+
+// -----------------------------------------------------------------------
+
+ImplRulerData& ImplRulerData::operator=( const ImplRulerData& rData )
+{
+ if ( pLines )
+ delete pLines;
+
+ if ( pArrows )
+ delete pArrows;
+
+ if ( pBorders )
+ delete pBorders;
+
+ if ( pIndents )
+ delete pIndents;
+
+ if ( pTabs )
+ delete pTabs;
+
+ memcpy( this, &rData, sizeof( ImplRulerData ) );
+
+ if ( rData.pLines )
+ {
+ pLines = new RulerLine[nLines];
+ memcpy( pLines, rData.pLines, nLines*sizeof( RulerLine ) );
+ }
+
+ if ( rData.pArrows )
+ {
+ pArrows = new RulerArrow[nArrows];
+ memcpy( pArrows, rData.pArrows, nArrows*sizeof( RulerArrow ) );
+ }
+
+ if ( rData.pBorders )
+ {
+ pBorders = new RulerBorder[nBorders];
+ memcpy( pBorders, rData.pBorders, nBorders*sizeof( RulerBorder ) );
+ }
+
+ if ( rData.pIndents )
+ {
+ pIndents = new RulerIndent[nIndents];
+ memcpy( pIndents, rData.pIndents, nIndents*sizeof( RulerIndent ) );
+ }
+
+ if ( rData.pTabs )
+ {
+ pTabs = new RulerTab[nTabs];
+ memcpy( pTabs, rData.pTabs, nTabs*sizeof( RulerTab ) );
+ }
+
+ return *this;
+}
+
+// =======================================================================
+
+void Ruler::ImplInit( WinBits nWinBits )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ // Default WinBits setzen
+ if ( !(nWinBits & WB_VERT) )
+ nWinBits |= WB_HORZ;
+
+ // Variablen initialisieren
+ mnWinStyle = nWinBits; // Window-Style
+ mnBorderOff = 0; // Border-Offset
+ mnWinOff = 0; // EditWinOffset
+ mnWinWidth = 0; // EditWinWidth
+ mnWidth = 0; // Fensterbreite
+ mnHeight = 0; // Fensterhoehe
+ mnVirOff = 0; // Offset des VirtualDeice vom linke/oberen Rand
+ mnVirWidth = 0; // Breite bzw. Hoehe vom VirtualDevice
+ mnVirHeight = 0; // Hoehe bzw. Breite vom VirtualDevice
+ mnDragPos = 0; // Drag-Position (NullPunkt)
+ mnUpdateEvtId = 0; // Noch kein Update-Event verschickt
+ mnDragAryPos = 0; // Drag-Array-Index
+ mnDragSize = 0; // Wird beim Draggen die Groesse geaendert
+ mnDragScroll = 0; // Soll beim Draggen gescrollt werden
+ mnDragModifier = 0; // Modifier-Tasten beim Draggen
+ mnExtraStyle = 0; // Style des Extra-Feldes
+ mnExtraClicks = 0; // Click-Anzahl fuer Extra-Feld
+ mnExtraModifier = 0; // Modifier-Tasten beim Click im Extrafeld
+ mbCalc = TRUE; // Muessen Pagebreiten neu berechnet werden
+ mbFormat = TRUE; // Muss neu ausgegeben werden
+ mbDrag = FALSE; // Sind wir im Drag-Modus
+ mbDragDelete = FALSE; // Wird Maus beim Draggen unten rausgezogen
+ mbDragCanceled = FALSE; // Wurde Dragging abgebrochen
+ mbAutoWinWidth = TRUE; // EditWinBreite == RulerBreite
+ mbActive = TRUE; // Ist Lineal aktiv
+ mnUpdateFlags = 0; // Was soll im Update-Handler upgedatet werden
+ mpData = &maData; // Wir zeigen auf die normalen Daten
+ meExtraType = RULER_EXTRA_DONTKNOW; // Was im ExtraFeld dargestellt wird
+ meDragType = RULER_TYPE_DONTKNOW; // Gibt an, was gedragt wird
+
+ // Units initialisieren
+ mnUnitIndex = RULER_UNIT_CM;
+ meUnit = FUNIT_CM;
+ maZoom = Fraction( 1, 1 );
+ meSourceUnit = MAP_100TH_MM;
+
+ // Border-Breiten berechnen
+ if ( nWinBits & WB_BORDER )
+ {
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ mnBorderWidth = 2;
+ else
+ mnBorderWidth = 1;
+ }
+ else
+ mnBorderWidth = 0;
+
+ // Einstellungen setzen
+ ImplInitSettings( TRUE, TRUE, TRUE );
+
+ // Default-Groesse setzen
+ long nDefHeight = GetTextHeight() + RULER_OFF*2 + RULER_TEXTOFF*2 + mnBorderWidth;
+ Size aDefSize;
+ if ( nWinBits & WB_HORZ )
+ aDefSize.Height() = nDefHeight;
+ else
+ aDefSize.Width() = nDefHeight;
+ SetOutputSizePixel( aDefSize );
+}
+
+// -----------------------------------------------------------------------
+
+Ruler::Ruler( Window* pParent, WinBits nWinStyle ) :
+ Window( pParent, nWinStyle & WB_3DLOOK ),
+ maVirDev( *this ),
+ maMapMode( MAP_100TH_MM )
+{
+ ImplInit( nWinStyle );
+}
+
+// -----------------------------------------------------------------------
+
+Ruler::~Ruler()
+{
+ if ( mnUpdateEvtId )
+ Application::RemoveUserEvent( mnUpdateEvtId );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 )
+{
+ if ( nX1 < -RULER_CLIP )
+ {
+ nX1 = -RULER_CLIP;
+ if ( nX2 < -RULER_CLIP )
+ return;
+ }
+ long nClip = mnVirWidth+RULER_CLIP;
+ if ( nX2 > nClip )
+ {
+ nX2 = nClip;
+ if ( nX1 > nClip )
+ return;
+ }
+
+ if ( mnWinStyle & WB_HORZ )
+ maVirDev.DrawLine( Point( nX1, nY1 ), Point( nX2, nY2 ) );
+ else
+ maVirDev.DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 )
+{
+ if ( nX1 < -RULER_CLIP )
+ {
+ nX1 = -RULER_CLIP;
+ if ( nX2 < -RULER_CLIP )
+ return;
+ }
+ long nClip = mnVirWidth+RULER_CLIP;
+ if ( nX2 > nClip )
+ {
+ nX2 = nClip;
+ if ( nX1 > nClip )
+ return;
+ }
+
+ if ( mnWinStyle & WB_HORZ )
+ maVirDev.DrawRect( Rectangle( nX1, nY1, nX2, nY2 ) );
+ else
+ maVirDev.DrawRect( Rectangle( nY1, nX1, nY2, nX2 ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplVDrawText( long nX, long nY, const String& rText )
+{
+ if ( (nX > -RULER_CLIP) && (nX < mnVirWidth+RULER_CLIP) )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ maVirDev.DrawText( Point( nX, nY ), rText );
+ else
+ maVirDev.DrawText( Point( nY, nX ), rText );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplInvertLines( BOOL bErase )
+{
+ // Positionslinien
+ if ( mpData->nLines && mbActive && !mbDrag && !mbFormat &&
+ !(mnUpdateFlags & RULER_UPDATE_LINES) )
+ {
+ long n;
+ long nNullWinOff = mpData->nNullVirOff+mnVirOff;
+ long nRulX1 = mpData->nRulVirOff+mnVirOff;
+ long nRulX2 = nRulX1+mpData->nRulWidth;
+ long nY = (RULER_OFF*2)+mnVirHeight-1;
+
+ // Rectangle berechnen
+ Rectangle aRect;
+ if ( mnWinStyle & WB_HORZ )
+ aRect.Bottom() = nY;
+ else
+ aRect.Right() = nY;
+
+ // Linien ausgeben
+ for ( USHORT i = 0; i < mpData->nLines; i++ )
+ {
+ n = mpData->pLines[i].nPos+nNullWinOff;
+ if ( (n >= nRulX1) && (n < nRulX2) )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ {
+ aRect.Left() = n;
+ aRect.Right() = n;
+ }
+ else
+ {
+ aRect.Top() = n;
+ aRect.Bottom() = n;
+ }
+ if ( bErase )
+ {
+ Rectangle aTempRect = aRect;
+ if ( mnWinStyle & WB_HORZ )
+ aTempRect.Bottom() = RULER_OFF-1;
+ else
+ aTempRect.Right() = RULER_OFF-1;
+ Erase( aTempRect );
+ if ( mnWinStyle & WB_HORZ )
+ {
+ aTempRect.Bottom() = aRect.Bottom();
+ aTempRect.Top() = aTempRect.Bottom()-RULER_OFF+1;
+ }
+ else
+ {
+ aTempRect.Right() = aRect.Right();
+ aTempRect.Left() = aTempRect.Right()-RULER_OFF+1;
+ }
+ Erase( aTempRect );
+ }
+ Invert( aRect );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
+{
+ long n = 0;
+ long nTick = 0;
+ long nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
+ long nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1;
+ Size aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
+ long nTickWidth;
+ long nX;
+ long nY;
+ BOOL bNoTicks = FALSE;
+
+ // Groessenvorberechnung
+ if ( mnWinStyle & WB_HORZ )
+ nTickWidth = aPixSize.Width();
+ else
+ nTickWidth = aPixSize.Height();
+ long nMaxWidth = maVirDev.PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width();
+ if ( nMaxWidth < 0 )
+ nMaxWidth *= -1;
+ nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit;
+ UniString aNumStr( UniString::CreateFromInt32( nMaxWidth ) );
+ long nTxtWidth = GetTextWidth( aNumStr );
+ if ( (nTxtWidth*2) > nTickWidth )
+ {
+ long nMulti = 1;
+ long nOrgTick3 = nTick3;
+ long nTextOff = 2;
+ while ( nTickWidth < nTxtWidth+nTextOff )
+ {
+ long nOldMulti = nMulti;
+ if ( !nTickWidth )
+ nMulti *= 10;
+ else if ( nMulti < 10 )
+ nMulti++;
+ else if ( nMulti < 100 )
+ nMulti += 10;
+ else if ( nMulti < 1000 )
+ nMulti += 100;
+ else
+ nMulti += 1000;
+ // Ueberlauf, dann geben wir nichts aus, da wir bei so einem
+ // unsinnigen Massstab sowieso nichts vernuenftiges anzeigen
+ // koennen
+ if ( nMulti < nOldMulti )
+ {
+ bNoTicks = TRUE;
+ break;
+ }
+ if ( nMulti >= 100 )
+ nTextOff = 4;
+ nTick3 = nOrgTick3 * nMulti;
+ aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
+ if ( mnWinStyle & WB_HORZ )
+ nTickWidth = aPixSize.Width();
+ else
+ nTickWidth = aPixSize.Height();
+ }
+ nTickCount = nTick3;
+ }
+ else
+ maVirDev.SetLineColor( GetSettings().GetStyleSettings().GetWindowTextColor() );
+
+ if ( !bNoTicks )
+ {
+ long nTxtWidth2;
+ long nTxtHeight2 = GetTextHeight()/2;
+ while ( ((nStart-n) >= nMin) || ((nStart+n) <= nMax) )
+ {
+ // Null-Punkt
+ if ( !nTick )
+ {
+ if ( nStart > nMin )
+ {
+ // Nur 0 malen, wenn Margin1 nicht gleich dem NullPunkt ist
+ if ( (mpData->nMargin1Style & RULER_STYLE_INVISIBLE) || (mpData->nMargin1 != 0) )
+ {
+ aNumStr = (sal_Unicode)'0';
+ nTxtWidth2 = maVirDev.GetTextWidth( aNumStr )/2;
+ if ( mnWinStyle & WB_HORZ )
+ nX = nStart-nTxtWidth2;
+ else
+ nX = nStart+nTxtWidth2;
+ ImplVDrawText( nX, nCenter-nTxtHeight2, aNumStr );
+ }
+ }
+ }
+ else
+ {
+ aPixSize = maVirDev.LogicToPixel( Size( nTick, nTick ), maMapMode );
+
+ if ( mnWinStyle & WB_HORZ )
+ n = aPixSize.Width();
+ else
+ n = aPixSize.Height();
+
+ // Tick3 - Ausgabe (Text)
+ if ( !(nTick % nTick3) )
+ {
+ aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit );
+ nTxtWidth2 = GetTextWidth( aNumStr )/2;
+
+ nX = nStart+n;
+ nY = nCenter-nTxtHeight2;
+ if ( nX < nMax )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ nX -= nTxtWidth2;
+ else
+ nX += nTxtWidth2;
+ ImplVDrawText( nX, nY, aNumStr );
+ }
+ nX = nStart-n;
+ if ( nX > nMin )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ nX -= nTxtWidth2;
+ else
+ nX += nTxtWidth2;
+ ImplVDrawText( nX, nY, aNumStr );
+ }
+ }
+ // Tick/Tick2 - Ausgabe (Striche)
+ else
+ {
+ if ( !(nTick % aImplRulerUnitTab[mnUnitIndex].nTick2) )
+ nTickWidth = RULER_TICK2_WIDTH;
+ else
+ nTickWidth = RULER_TICK1_WIDTH;
+ long nT1 = nCenter-(nTickWidth/2);
+ long nT2 = nT1+nTickWidth-1;
+ long nT;
+
+ nT = nStart+n;
+ if ( nT < nMax )
+ ImplVDrawLine( nT, nT1, nT, nT2 );
+ nT = nStart-n;
+ if ( nT > nMin )
+ ImplVDrawLine( nT, nT1, nT, nT2 );
+ }
+ }
+
+ nTick += nTickCount;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawArrows( long nCenter )
+{
+ USHORT i;
+ long n1;
+ long n2;
+ long n3;
+ long n4;
+ long nLogWidth;
+ String aStr;
+ String aStr2;
+ BOOL bDrawUnit;
+ long nTxtWidth;
+ long nTxtHeight2 = GetTextHeight()/2;
+ International aIntn = Application::GetAppInternational();
+
+ aIntn.SetNumTrailingZeros( FALSE );
+ maVirDev.SetLineColor( GetSettings().GetStyleSettings().GetWindowTextColor() );
+ for ( i = 0; i < mpData->nArrows; i++ )
+ {
+ n1 = mpData->pArrows[i].nPos+mpData->nNullVirOff+1;
+ n2 = n1+mpData->pArrows[i].nWidth-2;
+
+ // Einheit umrechnen
+ nLogWidth = mpData->pArrows[i].nLogWidth;
+ if ( meSourceUnit == MAP_TWIP )
+ {
+ if ( nLogWidth >= 100000 )
+ nLogWidth = (nLogWidth*254)/144;
+ else
+ nLogWidth = (nLogWidth*2540)/1440;
+ }
+ if ( nLogWidth >= 1000000 )
+ nLogWidth = (nLogWidth / aImplRulerUnitTab[mnUnitIndex].n100THMM) * 1000;
+ else
+ nLogWidth = (nLogWidth*1000) / aImplRulerUnitTab[mnUnitIndex].n100THMM;
+ aStr = aIntn.GetNum( nLogWidth, aImplRulerUnitTab[mnUnitIndex].nUnitDigits );
+
+ // Einheit an den String haengen
+ aStr2 = aStr;
+ aStr2.AppendAscii( aImplRulerUnitTab[mnUnitIndex].aUnitStr );
+
+ // Textbreite ermitteln
+ bDrawUnit = TRUE;
+ nTxtWidth = GetTextWidth( aStr2 );
+ if ( nTxtWidth < mpData->pArrows[i].nWidth-10 )
+ aStr = aStr2;
+ else
+ {
+ nTxtWidth = GetTextWidth( aStr );
+ if ( nTxtWidth > mpData->pArrows[i].nWidth-10 )
+ bDrawUnit = FALSE;
+ }
+
+ // Ist genuegen Platz fuer Einheiten-String vorhanden
+ if ( bDrawUnit )
+ {
+ n3 = n1 + ((n2-n1)/2) - 1;
+ if ( mnWinStyle & WB_HORZ )
+ n3 -= nTxtWidth/2;
+ else
+ n3 += nTxtWidth/2;
+ if ( mnWinStyle & WB_HORZ )
+ {
+ n4 = n3 + nTxtWidth + 2;
+ ImplVDrawLine( n1, nCenter, n3, nCenter );
+ ImplVDrawLine( n4, nCenter, n2, nCenter );
+ }
+ else
+ {
+ n4 = n3 - nTxtWidth - 2;
+ ImplVDrawLine( n1, nCenter, n4, nCenter );
+ ImplVDrawLine( n3, nCenter, n2, nCenter );
+ }
+ ImplVDrawText( n3, nCenter-nTxtHeight2, aStr );
+ }
+ else
+ ImplVDrawLine( n1, nCenter, n2, nCenter );
+ ImplVDrawLine( n1+1, nCenter-1, n1+1, nCenter+1 );
+ ImplVDrawLine( n1+2, nCenter-2, n1+2, nCenter+2 );
+ ImplVDrawLine( n2-1, nCenter-1, n2-1, nCenter+1 );
+ ImplVDrawLine( n2-2, nCenter-2, n2-2, nCenter+2 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawBorders( long nMin, long nMax, long nVirTop, long nVirBottom )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ long n;
+ long n1;
+ long n2;
+ long nTemp1;
+ long nTemp2;
+ USHORT i;
+
+ for ( i = 0; i < mpData->nBorders; i++ )
+ {
+ if ( mpData->pBorders[i].nStyle & RULER_STYLE_INVISIBLE )
+ continue;
+
+ n1 = mpData->pBorders[i].nPos+mpData->nNullVirOff;
+ n2 = n1+mpData->pBorders[i].nWidth;
+
+ if ( ((n1 >= nMin) && (n1 <= nMax)) || ((n2 >= nMin) && (n2 <= nMax)) )
+ {
+ if ( (n2-n1) > 3 )
+ {
+ maVirDev.SetLineColor();
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
+ else
+ maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ ImplVDrawRect( n1, nVirTop, n2, nVirBottom );
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ ImplVDrawLine( n1+1, nVirTop, n1+1, nVirBottom );
+ ImplVDrawLine( n1, nVirTop, n2, nVirTop );
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ ImplVDrawLine( n1, nVirTop, n1, nVirBottom );
+ ImplVDrawLine( n1, nVirBottom, n2, nVirBottom );
+ ImplVDrawLine( n2-1, nVirTop, n2-1, nVirBottom );
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ ImplVDrawLine( n2, nVirTop, n2, nVirBottom );
+ }
+ else
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ ImplVDrawLine( n1, nVirTop, n1, nVirBottom );
+ ImplVDrawLine( n2, nVirTop, n2, nVirBottom );
+ }
+
+ if ( mpData->pBorders[i].nStyle & RULER_BORDER_VARIABLE )
+ {
+ if ( n2-n1 > RULER_VAR_SIZE+4 )
+ {
+ nTemp1 = n1 + (((n2-n1+1)-RULER_VAR_SIZE) / 2);
+ nTemp2 = nVirTop + (((nVirBottom-nVirTop+1)-RULER_VAR_SIZE) / 2);
+ long nTemp3 = nTemp1+RULER_VAR_SIZE-1;
+ long nTemp4 = nTemp2+RULER_VAR_SIZE-1;
+ long nTempY = nTemp2;
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ else
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ while ( nTempY <= nTemp4 )
+ {
+ ImplVDrawLine( nTemp1, nTempY, nTemp3, nTempY );
+ nTempY += 2;
+ }
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ nTempY = nTemp2+1;
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ while ( nTempY <= nTemp4 )
+ {
+ ImplVDrawLine( nTemp1, nTempY, nTemp3, nTempY );
+ nTempY += 2;
+ }
+ }
+ }
+ }
+
+ if ( mpData->pBorders[i].nStyle & RULER_BORDER_SIZEABLE )
+ {
+ if ( n2-n1 > RULER_VAR_SIZE+10 )
+ {
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ ImplVDrawLine( n1+4, nVirTop+3, n1+4, nVirBottom-3 );
+ ImplVDrawLine( n2-5, nVirTop+3, n2-5, nVirBottom-3 );
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ ImplVDrawLine( n1+5, nVirTop+3, n1+5, nVirBottom-3 );
+ ImplVDrawLine( n2-4, nVirTop+3, n2-4, nVirBottom-3 );
+ }
+ else
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ ImplVDrawLine( n1+4, nVirTop+3, n1+4, nVirBottom-3 );
+ ImplVDrawLine( n2-4, nVirTop+3, n2-4, nVirBottom-3 );
+ }
+ }
+ }
+ }
+ else
+ {
+ n = n1+((n2-n1)/2);
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ else
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ if ( mpData->pBorders[i].nStyle & RULER_BORDER_SNAP )
+ ImplVDrawLine( n, nVirTop, n, nVirBottom );
+ else
+ {
+ ImplVDrawLine( n-1, nVirTop, n-1, nVirBottom );
+ ImplVDrawLine( n+1, nVirTop, n+1, nVirBottom );
+ maVirDev.SetLineColor();
+ maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ ImplVDrawRect( n, nVirTop, n, nVirBottom );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawIndent( const Polygon& rPoly, USHORT nStyle )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Point aPos1;
+ Point aPos2;
+ USHORT nIndentStyle = nStyle & RULER_INDENT_STYLE;
+
+ if ( nStyle & RULER_STYLE_INVISIBLE )
+ return;
+
+ if ( nStyle & RULER_STYLE_DONTKNOW )
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
+ }
+ else
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
+ }
+
+ maVirDev.DrawPolygon( rPoly );
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) && !(nStyle & RULER_STYLE_DONTKNOW) )
+ {
+ if ( nIndentStyle == RULER_INDENT_BOTTOM )
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ aPos1 = rPoly.GetPoint( 2 );
+ aPos1.X()++;
+ aPos2 = rPoly.GetPoint( 1 );
+ aPos2.X()++;
+ maVirDev.DrawLine( aPos2, aPos1 );
+ aPos2.X()--;
+ aPos2.Y()++;
+ aPos1 = rPoly.GetPoint( 0 );
+ aPos1.Y()++;
+ maVirDev.DrawLine( aPos2, aPos1 );
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ aPos2 = rPoly.GetPoint( 4 );
+ aPos2.Y()++;
+ maVirDev.DrawLine( aPos1, aPos2 );
+ aPos2.X()--;
+ aPos1 = rPoly.GetPoint( 3 );
+ aPos1.X()--;
+ maVirDev.DrawLine( aPos2, aPos1 );
+ aPos1.Y()--;
+ aPos2 = rPoly.GetPoint( 2 );
+ aPos2.X()++;
+ aPos2.Y()--;
+ maVirDev.DrawLine( aPos2, aPos1 );
+ }
+ else
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ aPos1 = rPoly.GetPoint( 2 );
+ aPos1.X()++;
+ aPos1.Y()++;
+ aPos2 = rPoly.GetPoint( 3 );
+ aPos2.Y()++;
+ maVirDev.DrawLine( aPos1, aPos2 );
+ aPos2 = rPoly.GetPoint( 1 );
+ aPos2.X()++;
+ maVirDev.DrawLine( aPos1, aPos2 );
+ aPos2.X()--;
+ aPos2.Y()--;
+ aPos1 = rPoly.GetPoint( 0 );
+ aPos1.Y()--;
+ maVirDev.DrawLine( aPos2, aPos1 );
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ aPos2 = rPoly.GetPoint( 4 );
+ aPos2.Y()--;
+ maVirDev.DrawLine( aPos1, aPos2 );
+ aPos2.X()--;
+ aPos1 = rPoly.GetPoint( 3 );
+ aPos1.X()--;
+ maVirDev.DrawLine( aPos2, aPos1 );
+ }
+
+ maVirDev.SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ maVirDev.SetFillColor();
+ maVirDev.DrawPolygon( rPoly );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawIndents( long nMin, long nMax, long nVirTop, long nVirBottom )
+{
+ USHORT i;
+ long n;
+ long nIndentHeight = (mnVirHeight/2) - 1;
+ long nIndentWidth2 = nIndentHeight-3;
+ Polygon aPoly( 5 );
+
+ for ( i = 0; i < mpData->nIndents; i++ )
+ {
+ if ( mpData->pIndents[i].nStyle & RULER_STYLE_INVISIBLE )
+ continue;
+
+ USHORT nStyle = mpData->pIndents[i].nStyle;
+ USHORT nIndentStyle = nStyle & RULER_INDENT_STYLE;
+
+ n = mpData->pIndents[i].nPos+mpData->nNullVirOff;
+
+ if ( (n >= nMin) && (n <= nMax) )
+ {
+ if ( nIndentStyle == RULER_INDENT_BOTTOM )
+ {
+ aPoly.SetPoint( Point( n+0, nVirBottom-nIndentHeight ), 0 );
+ aPoly.SetPoint( Point( n-nIndentWidth2, nVirBottom-3 ), 1 );
+ aPoly.SetPoint( Point( n-nIndentWidth2, nVirBottom ), 2 );
+ aPoly.SetPoint( Point( n+nIndentWidth2, nVirBottom ), 3 );
+ aPoly.SetPoint( Point( n+nIndentWidth2, nVirBottom-3 ), 4 );
+ }
+ else
+ {
+ aPoly.SetPoint( Point( n+0, nVirTop+nIndentHeight ), 0 );
+ aPoly.SetPoint( Point( n-nIndentWidth2, nVirTop+3 ), 1 );
+ aPoly.SetPoint( Point( n-nIndentWidth2, nVirTop ), 2 );
+ aPoly.SetPoint( Point( n+nIndentWidth2, nVirTop ), 3 );
+ aPoly.SetPoint( Point( n+nIndentWidth2, nVirTop+3 ), 4 );
+ }
+
+ ImplDrawIndent( aPoly, nStyle );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCenterTabPos( Point& rPos, USHORT nStyle )
+{
+ rPos.Y() += RULER_TAB_HEIGHT/2;
+ if ( nStyle == RULER_TAB_LEFT )
+ rPos.X() -= RULER_TAB_WIDTH/2;
+ else if ( nStyle == RULER_TAB_RIGHT )
+ rPos.X() += RULER_TAB_WIDTH/2;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawRulerTab( OutputDevice* pDevice,
+ const Point& rPos, USHORT nStyle )
+{
+ if ( nStyle & RULER_STYLE_INVISIBLE )
+ return;
+
+ USHORT nTabStyle = nStyle & RULER_TAB_STYLE;
+
+ if ( nTabStyle == RULER_TAB_DEFAULT )
+ {
+ pDevice->DrawRect( Rectangle( rPos.X() - RULER_TAB_DWIDTH2 + 1,
+ rPos.Y() - RULER_TAB_DHEIGHT2 + 1,
+ rPos.X() - RULER_TAB_DWIDTH2 + RULER_TAB_DWIDTH,
+ rPos.Y() ) );
+ pDevice->DrawRect( Rectangle( rPos.X() - RULER_TAB_DWIDTH2 + RULER_TAB_DWIDTH3,
+ rPos.Y() - RULER_TAB_DHEIGHT + 1,
+ rPos.X() - RULER_TAB_DWIDTH2 + RULER_TAB_DWIDTH3 + RULER_TAB_DWIDTH4 - 1,
+ rPos.Y() ) );
+
+ }
+ else if ( nTabStyle == RULER_TAB_LEFT )
+ {
+ pDevice->DrawRect( Rectangle( rPos.X(),
+ rPos.Y() - RULER_TAB_HEIGHT2 + 1,
+ rPos.X() + RULER_TAB_WIDTH - 1,
+ rPos.Y() ) );
+ pDevice->DrawRect( Rectangle( rPos.X(),
+ rPos.Y() - RULER_TAB_HEIGHT + 1,
+ rPos.X() + RULER_TAB_WIDTH2 - 1,
+ rPos.Y() ) );
+ }
+ else if ( nTabStyle == RULER_TAB_RIGHT )
+ {
+ pDevice->DrawRect( Rectangle( rPos.X() - RULER_TAB_WIDTH + 1,
+ rPos.Y() - RULER_TAB_HEIGHT2 + 1,
+ rPos.X(),
+ rPos.Y() ) );
+ pDevice->DrawRect( Rectangle( rPos.X() - RULER_TAB_WIDTH2 + 1,
+ rPos.Y() - RULER_TAB_HEIGHT + 1,
+ rPos.X(),
+ rPos.Y() ) );
+ }
+ else
+ {
+ pDevice->DrawRect( Rectangle( rPos.X() - RULER_TAB_CWIDTH2 + 1,
+ rPos.Y() - RULER_TAB_HEIGHT2 + 1,
+ rPos.X() - RULER_TAB_CWIDTH2 + RULER_TAB_CWIDTH,
+ rPos.Y() ) );
+ pDevice->DrawRect( Rectangle( rPos.X() - RULER_TAB_CWIDTH2 + RULER_TAB_CWIDTH3,
+ rPos.Y() - RULER_TAB_HEIGHT + 1,
+ rPos.X() - RULER_TAB_CWIDTH2 + RULER_TAB_CWIDTH3 + RULER_TAB_CWIDTH4 - 1,
+ rPos.Y() ) );
+
+ if ( nTabStyle == RULER_TAB_DECIMAL )
+ {
+ pDevice->DrawRect( Rectangle( rPos.X() - RULER_TAB_CWIDTH2 + RULER_TAB_CWIDTH - 1,
+ rPos.Y() - RULER_TAB_HEIGHT + 1 + 1,
+ rPos.X() - RULER_TAB_CWIDTH2 + RULER_TAB_CWIDTH,
+ rPos.Y() - RULER_TAB_HEIGHT + 1 + 2 ) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawTab( OutputDevice* pDevice, const Point& rPos, USHORT nStyle )
+{
+ if ( nStyle & RULER_STYLE_INVISIBLE )
+ return;
+
+ pDevice->SetLineColor();
+ if ( nStyle & RULER_STYLE_DONTKNOW )
+ pDevice->SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
+ else
+ pDevice->SetFillColor( GetSettings().GetStyleSettings().GetWindowTextColor() );
+
+ ImplDrawRulerTab( pDevice, rPos, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawTabs( long nMin, long nMax, long nVirBottom )
+{
+ for ( USHORT i = 0; i < mpData->nTabs; i++ )
+ {
+ if ( mpData->pTabs[i].nStyle & RULER_STYLE_INVISIBLE )
+ continue;
+
+ long n = mpData->pTabs[i].nPos+mpData->nNullVirOff;
+ if ( (n >= nMin) && (n <= nMax) )
+ ImplDrawTab( &maVirDev, Point( n, nVirBottom ), mpData->pTabs[i].nStyle );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont;
+ aFont = rStyleSettings.GetToolFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else
+ aColor = rStyleSettings.GetFaceColor();
+ SetBackground( aColor );
+ }
+
+ maVirDev.SetSettings( GetSettings() );
+ maVirDev.SetBackground( GetBackground() );
+ Font aFont = GetFont();
+ if ( mnWinStyle & WB_VERT )
+ aFont.SetOrientation( 900 );
+ maVirDev.SetFont( aFont );
+ maVirDev.SetTextColor( GetTextColor() );
+ maVirDev.SetTextFillColor( GetTextFillColor() );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplCalc()
+{
+ // Offset berechnen
+ mpData->nRulVirOff = mnWinOff + mpData->nPageOff;
+ if ( mpData->nRulVirOff > mnVirOff )
+ mpData->nRulVirOff -= mnVirOff;
+ else
+ mpData->nRulVirOff = 0;
+ long nRulWinOff = mpData->nRulVirOff+mnVirOff;
+
+ // Nicht sichtbaren Bereich der Page berechnen
+ long nNotVisPageWidth;
+ if ( mpData->nPageOff < 0 )
+ {
+ nNotVisPageWidth = -(mpData->nPageOff);
+ if ( nRulWinOff < mnWinOff )
+ nNotVisPageWidth -= mnWinOff-nRulWinOff;
+ }
+ else
+ nNotVisPageWidth = 0;
+
+ // Breite berechnen
+ if ( mnWinStyle & WB_HORZ )
+ {
+ if ( mbAutoWinWidth )
+ mnWinWidth = mnWidth - mnVirOff;
+ if ( mpData->bAutoPageWidth )
+ mpData->nPageWidth = mnWinWidth;
+ mpData->nRulWidth = Min( mnWinWidth, mpData->nPageWidth-nNotVisPageWidth );
+ if ( nRulWinOff+mpData->nRulWidth > mnWidth )
+ mpData->nRulWidth = mnWidth-nRulWinOff;
+ }
+ else
+ {
+ if ( mbAutoWinWidth )
+ mnWinWidth = mnHeight - mnVirOff;
+ if ( mpData->bAutoPageWidth )
+ mpData->nPageWidth = mnWinWidth;
+ mpData->nRulWidth = Min( mnWinWidth, mpData->nPageWidth-nNotVisPageWidth );
+ if ( nRulWinOff+mpData->nRulWidth > mnHeight )
+ mpData->nRulWidth = mnHeight-nRulWinOff;
+ }
+
+ mbCalc = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplFormat()
+{
+ // Wenn schon formatiert ist, brauchen wir es nicht nochmal
+ if ( !mbFormat )
+ return;
+
+ // Wenn Fenster noch keine Groesse hat, brauchen wir noch nichts machen
+ if ( !mnVirWidth )
+ return;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ long nP1; // Pixel-Position von Page1
+ long nP2; // Pixel-Position von Page2
+ long nM1; // Pixel-Position von Margin1
+ long nM2; // Pixel-Position von Margin2
+ long nVirTop; // Obere/Linke-Kante bei Ausgabe
+ long nVirBottom; // Untere/Rechte-Kante bei Ausgabe
+ long nVirLeft; // Linke/Obere-Kante bei Ausgabe
+ long nVirRight; // Rechte/Untere-Kante bei Ausgabe
+ long nNullVirOff; // Fuer schnellere Berechnung
+
+ // Werte berechnen
+ if ( mbCalc )
+ ImplCalc();
+ mpData->nNullVirOff = mnWinOff+mpData->nPageOff+mpData->nNullOff-mnVirOff;
+ nNullVirOff = mpData->nNullVirOff;
+ nVirLeft = mpData->nRulVirOff;
+ nVirRight = nVirLeft+mpData->nRulWidth-1;
+ nVirTop = 0;
+ nVirBottom = mnVirHeight-1;
+
+ if ( !IsReallyVisible() )
+ return;
+
+ Size aVirDevSize;
+ BOOL b3DLook = !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO);
+
+ // VirtualDevice initialisieren
+ if ( mnWinStyle & WB_HORZ )
+ {
+ aVirDevSize.Width() = mnVirWidth;
+ aVirDevSize.Height() = mnVirHeight;
+ }
+ else
+ {
+ aVirDevSize.Height() = mnVirWidth;
+ aVirDevSize.Width() = mnVirHeight;
+ }
+ if ( aVirDevSize != maVirDev.GetOutputSizePixel() )
+ maVirDev.SetOutputSizePixel( aVirDevSize, TRUE );
+ else
+ maVirDev.Erase();
+
+ // Raender berechnen
+ if ( !(mpData->nMargin1Style & RULER_STYLE_INVISIBLE) )
+ {
+ nM1 = mpData->nMargin1+nNullVirOff;
+ if ( mpData->bAutoPageWidth )
+ {
+ nP1 = nVirLeft;
+ if ( nM1 < nVirLeft )
+ nP1--;
+ }
+ else
+ nP1 = nNullVirOff-mpData->nNullOff;
+ }
+ else
+ {
+ nM1 = nVirLeft-1;
+ nP1 = nM1;
+ }
+ if ( !(mpData->nMargin2Style & RULER_STYLE_INVISIBLE) )
+ {
+ nM2 = mpData->nMargin2+nNullVirOff;
+ if ( mpData->bAutoPageWidth )
+ {
+ nP2 = nVirRight;
+ if ( nM2 > nVirRight )
+ nP2++;
+ }
+ else
+ nP2 = nNullVirOff-mpData->nNullOff+mpData->nPageWidth;
+ if ( nM2 > nP2 )
+ nM2 = nP2;
+ }
+ else
+ {
+ nM2 = nVirRight+1;
+ nP2 = nM2;
+ }
+
+ // Obere/untere Kante ausgeben
+ if ( b3DLook )
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ else
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ ImplVDrawLine( nVirLeft, nVirTop, nP2, nVirTop );
+ if ( b3DLook )
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ ImplVDrawLine( nVirLeft, nVirBottom, nP2, nVirBottom );
+
+ // Jetzt wird zwischen dem Schatten ausgegeben
+ nVirTop++;
+ nVirBottom--;
+
+ // Margin1, Margin2 und Zwischenraum ausgeben
+ maVirDev.SetLineColor();
+ if ( b3DLook )
+ maVirDev.SetFillColor( rStyleSettings.GetFaceColor() );
+ else
+ maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ if ( nM1 > nVirLeft )
+ ImplVDrawRect( nP1, nVirTop, nM1-1, nVirBottom );
+ if ( nM2 < nP2 )
+ ImplVDrawRect( nM2+1, nVirTop, nP2, nVirBottom );
+ if ( nM2-nM1 > 0 )
+ {
+ maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ ImplVDrawRect( nM1, nVirTop, nM2-1, nVirBottom );
+ }
+ if ( b3DLook )
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ if ( nM1 > nVirLeft )
+ {
+ ImplVDrawLine( nP1+1, nVirTop, nM1-1, nVirTop );
+ if ( nP1 >= nVirLeft )
+ {
+ ImplVDrawLine( nP1+1, nVirTop, nP1+1, nVirBottom );
+ ImplVDrawLine( nP1, nVirBottom+1, nP1+1, nVirBottom+1 );
+ }
+ }
+ if ( nM2 < nP2 )
+ {
+ ImplVDrawLine( nM2+1, nVirTop, nM2+1, nVirBottom );
+ ImplVDrawLine( nM2+1, nVirTop, nP2, nVirTop );
+ if ( nP2 <= nVirRight+1 )
+ {
+ ImplVDrawLine( nP2, nVirTop-1, nP2, nVirBottom );
+ ImplVDrawLine( nP2-1, nVirBottom+1, nP2, nVirBottom+1 );
+ }
+ }
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ if ( nM1 > nVirLeft )
+ {
+ ImplVDrawLine( nM1-1, nVirTop, nM1-1, nVirBottom );
+ ImplVDrawLine( nP1, nVirBottom, nM1-1, nVirBottom );
+ if ( nP1 >= nVirLeft )
+ {
+ ImplVDrawLine( nP1, nVirTop, nP1, nVirBottom );
+ ImplVDrawLine( nP1, nVirBottom, nP1+1, nVirBottom );
+ }
+ }
+ if ( nM2 < nP2 )
+ {
+ ImplVDrawLine( nM2+1, nVirBottom, nP2-1, nVirBottom );
+ if ( nP2 <= nVirRight+1 )
+ ImplVDrawLine( nP2-1, nVirTop, nP2-1, nVirBottom );
+ }
+ if ( nM2-nM1 > 0 )
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ if ( nM1 >= nVirLeft )
+ ImplVDrawLine( nM1, nVirTop, nM1, nVirBottom );
+ ImplVDrawLine( nM1, nVirTop, nM2-1, nVirTop );
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ ImplVDrawLine( nM1, nVirBottom, nM2-1, nVirBottom );
+ if ( nM2 <= nVirRight )
+ ImplVDrawLine( nM2, nVirTop, nM2, nVirBottom );
+ }
+ }
+ else
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ if ( nP1 >= nVirLeft )
+ ImplVDrawLine( nP1, nVirTop, nP1, nVirBottom+1 );
+ if ( nM1 > nP1 )
+ ImplVDrawLine( nM1, nVirTop, nM1, nVirBottom );
+ if ( nM2 < nP2 )
+ ImplVDrawLine( nM2, nVirTop, nM2, nVirBottom );
+ if ( nP2 <= nVirRight+1 )
+ ImplVDrawLine( nP2, nVirTop, nP2, nVirBottom+1 );
+ }
+
+ // Lineal-Beschriftung (nur wenn keine Bemassungspfeile)
+ if ( !mpData->pArrows )
+ {
+ long nMin = nVirLeft;
+ long nMax = nP2;
+ long nStart = nNullVirOff;
+ long nCenter = nVirTop+((nVirBottom-nVirTop)/2);
+
+ // Nicht Schatten uebermalen
+ if ( nP1 > nVirLeft )
+ nMin++;
+ if ( nP2 < nVirRight )
+ nMax--;
+
+ // Beschriftung ausgeben
+ ImplDrawTicks( nMin, nMax, nStart, nCenter );
+ }
+
+ // Spalten ausgeben
+ if ( mpData->pBorders )
+ ImplDrawBorders( nVirLeft, nP2, nVirTop, nVirBottom );
+
+ // Einzuege ausgeben
+ if ( mpData->pIndents )
+ ImplDrawIndents( nVirLeft, nP2, nVirTop-1, nVirBottom+1 );
+
+ // Tabs
+ if ( mpData->pTabs )
+ ImplDrawTabs( nVirLeft, nP2, nVirBottom+1 );
+
+ // Bemassungspfeile
+ if ( mpData->pArrows )
+ ImplDrawArrows( nVirTop+((nVirBottom-nVirTop)/2) );
+
+ // Wir haben formatiert
+ mbFormat = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplInitExtraField( BOOL bUpdate )
+{
+ // Extra-Field beruecksichtigen
+ if ( mnWinStyle & WB_EXTRAFIELD )
+ {
+ maExtraRect.Left() = RULER_OFF;
+ maExtraRect.Top() = RULER_OFF;
+ maExtraRect.Right() = RULER_OFF+mnVirHeight-1;
+ maExtraRect.Bottom() = RULER_OFF+mnVirHeight-1;
+ mnVirOff = maExtraRect.Right()+1;
+ }
+ else
+ {
+ maExtraRect.SetEmpty();
+ mnVirOff = 0;
+ }
+
+ if ( bUpdate )
+ {
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDraw()
+{
+ if ( mbFormat )
+ ImplFormat();
+
+ if ( IsReallyVisible() )
+ {
+ // Lineal ueber das VirtualDevice ausgeben
+ Point aOffPos;
+ Size aVirDevSize = maVirDev.GetOutputSizePixel();
+ if ( mnWinStyle & WB_HORZ )
+ {
+ aOffPos.X() = mnVirOff;
+ aOffPos.Y() = RULER_OFF;
+ }
+ else
+ {
+ aOffPos.X() = RULER_OFF;
+ aOffPos.Y() = mnVirOff;
+ }
+ DrawOutDev( aOffPos, aVirDevSize, Point(), aVirDevSize, maVirDev );
+
+ // Positionslinien neu malen
+ ImplInvertLines( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrawExtra( BOOL bPaint )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aRect = maExtraRect;
+ BOOL bEraseRect = FALSE;
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ aRect.Left() += 2;
+ aRect.Top() += 2;
+ aRect.Right() -= 2;
+ aRect.Bottom() -= 2;
+ }
+ else
+ {
+ aRect.Left() += 1;
+ aRect.Top() += 1;
+ aRect.Right() -= 1;
+ aRect.Bottom() -= 1;
+ }
+
+ if ( !bPaint && !(mnExtraStyle & RULER_STYLE_HIGHLIGHT) )
+ {
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ SetFillColor( rStyleSettings.GetFaceColor() );
+ else
+ SetFillColor( rStyleSettings.GetWindowColor() );
+ bEraseRect = TRUE;
+ }
+ else
+ {
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) && (mnExtraStyle & RULER_STYLE_HIGHLIGHT) )
+ {
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ bEraseRect = TRUE;
+ }
+ }
+
+ if ( bEraseRect )
+ {
+ SetLineColor();
+ DrawRect( aRect );
+ }
+
+ // Inhalt ausgeben
+ if ( meExtraType == RULER_EXTRA_NULLOFFSET )
+ {
+ SetLineColor( rStyleSettings.GetWindowTextColor() );
+ DrawLine( Point( aRect.Left()+1, aRect.Top()+4 ),
+ Point( aRect.Right()-1, aRect.Top()+4 ) );
+ DrawLine( Point( aRect.Left()+4, aRect.Top()+1 ),
+ Point( aRect.Left()+4, aRect.Bottom()-1 ) );
+ }
+ else if ( meExtraType == RULER_EXTRA_TAB )
+ {
+ USHORT nTabStyle = mnExtraStyle & RULER_TAB_STYLE;
+ Point aCenter = aRect.Center();
+ ImplCenterTabPos( aCenter, nTabStyle );
+ ImplDrawTab( this, aCenter, nTabStyle );
+ }
+
+ if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) && (mnExtraStyle & RULER_STYLE_HIGHLIGHT) )
+ Invert( aRect );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplUpdate( BOOL bMustCalc )
+{
+ // Hier schon Linien loeschen, damit Sie vor dem Neuberechnen schon
+ // geloscht sind, da danach die alten Positionen nicht mehr bestimmt
+ // werden koennen
+ if ( !mbFormat )
+ ImplInvertLines();
+
+ // Flags setzen
+ if ( bMustCalc )
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+
+ // Wenn wir am Draggen sind, wird nach dem Drag-Handler automatisch
+ // das Lineal neu upgedatet
+ if ( mbDrag )
+ return;
+
+ // Gegebenenfalls Update ausloesen
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ mnUpdateFlags |= RULER_UPDATE_DRAW;
+ if ( !mnUpdateEvtId )
+ mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Ruler::ImplHitTest( const Point& rPos, ImplRulerHitTest* pHitTest ) const
+{
+ USHORT i;
+ USHORT nStyle;
+ long nHitBottom;
+ long nX;
+ long nY;
+ long n1;
+ long n2;
+
+ if ( !mbActive )
+ return FALSE;
+
+ // Position ermitteln
+ if ( mnWinStyle & WB_HORZ )
+ {
+ nX = rPos.X();
+ nY = rPos.Y();
+ }
+ else
+ {
+ nX = rPos.Y();
+ nY = rPos.X();
+ }
+ nHitBottom = mnVirHeight+(RULER_OFF*2);
+
+ // Initialisieren
+ memset( pHitTest, 0, sizeof( ImplRulerHitTest ) );
+
+ // Damit ueberstehende Tabs und Einzuege mit beruecksichtigt werden
+ long nXExtraOff;
+ if ( mpData->pTabs || mpData->pIndents )
+ nXExtraOff = (mnVirHeight/2) - 4;
+ else
+ nXExtraOff = 0;
+
+ // Test auf ausserhalb
+ nX -= mnVirOff;
+ long nXTemp = nX;
+ if ( (nX < mpData->nRulVirOff-nXExtraOff) || (nX > mpData->nRulVirOff+mpData->nRulWidth+nXExtraOff) ||
+ (nY < 0) || (nY > nHitBottom) )
+ {
+ pHitTest->nPos = 0;
+ pHitTest->eType = RULER_TYPE_OUTSIDE;
+ return FALSE;
+ }
+
+ nX -= mpData->nNullVirOff;
+ pHitTest->nPos = nX;
+ pHitTest->eType = RULER_TYPE_DONTKNOW;
+
+ // Zuerst die Tabs testen
+ Rectangle aRect;
+ if ( mpData->pTabs )
+ {
+ aRect.Bottom() = nHitBottom;
+ aRect.Top() = aRect.Bottom()-RULER_TAB_HEIGHT-RULER_OFF;
+
+ for ( i = mpData->nTabs; i; i-- )
+ {
+ nStyle = mpData->pTabs[i-1].nStyle;
+ if ( !(nStyle & RULER_STYLE_INVISIBLE) )
+ {
+ nStyle &= RULER_TAB_STYLE;
+
+ // Default-Tabs werden nur angezeigt
+ if ( nStyle != RULER_TAB_DEFAULT )
+ {
+ n1 = mpData->pTabs[i-1].nPos;
+
+ if ( nStyle == RULER_TAB_LEFT )
+ {
+ aRect.Left() = n1;
+ aRect.Right() = n1+RULER_TAB_WIDTH-1;
+ }
+ else if ( nStyle == RULER_TAB_RIGHT )
+ {
+ aRect.Right() = n1;
+ aRect.Left() = n1-RULER_TAB_WIDTH-1;
+ }
+ else
+ {
+ aRect.Left() = n1-RULER_TAB_CWIDTH2+1;
+ aRect.Right() = n1-RULER_TAB_CWIDTH2+RULER_TAB_CWIDTH;
+ }
+
+ if ( aRect.IsInside( Point( nX, nY ) ) )
+ {
+ pHitTest->eType = RULER_TYPE_TAB;
+ pHitTest->nAryPos = i-1;
+ return TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ // Dann die Einzuege
+ if ( mpData->pIndents )
+ {
+ long nIndentHeight = (mnVirHeight/2) - 1;
+ long nIndentWidth2 = nIndentHeight-3;
+
+ for ( i = mpData->nIndents; i; i-- )
+ {
+ nStyle = mpData->pIndents[i-1].nStyle;
+ if ( !(nStyle & RULER_STYLE_INVISIBLE) )
+ {
+ nStyle &= RULER_INDENT_STYLE;
+ n1 = mpData->pIndents[i-1].nPos;
+
+ if ( nStyle == RULER_INDENT_BOTTOM )
+ {
+ aRect.Left() = n1-nIndentWidth2;
+ aRect.Right() = n1+nIndentWidth2;
+ aRect.Top() = nHitBottom-nIndentHeight-RULER_OFF+1;
+ aRect.Bottom() = nHitBottom;
+ }
+ else
+ {
+ aRect.Left() = n1-nIndentWidth2;
+ aRect.Right() = n1+nIndentWidth2;
+ aRect.Top() = 0;
+ aRect.Bottom() = nIndentHeight+RULER_OFF-1;
+ }
+
+ if ( aRect.IsInside( Point( nX, nY ) ) )
+ {
+ pHitTest->eType = RULER_TYPE_INDENT;
+ pHitTest->nAryPos = i-1;
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ // Jetzt zaehlt nichts mehr, was links oder rechts uebersteht
+ if ( (nXTemp < mpData->nRulVirOff) || (nXTemp > mpData->nRulVirOff+mpData->nRulWidth) )
+ {
+ pHitTest->nPos = 0;
+ pHitTest->eType = RULER_TYPE_OUTSIDE;
+ return FALSE;
+ }
+
+ // Danach die Spalten testen
+ for ( i = mpData->nBorders; i; i-- )
+ {
+ n1 = mpData->pBorders[i-1].nPos;
+ n2 = n1 + mpData->pBorders[i-1].nWidth;
+
+ // Spalten werden mit mindestens 3 Pixel breite gezeichnet
+ if ( !mpData->pBorders[i-1].nWidth )
+ {
+ n1--;
+ n2++;
+ }
+
+ if ( (nX >= n1) && (nX <= n2) )
+ {
+ nStyle = mpData->pBorders[i-1].nStyle;
+ if ( !(nStyle & RULER_STYLE_INVISIBLE) )
+ {
+ pHitTest->eType = RULER_TYPE_BORDER;
+ pHitTest->nAryPos = i-1;
+
+ if ( !(nStyle & RULER_BORDER_SIZEABLE) )
+ {
+ if ( nStyle & RULER_BORDER_MOVEABLE )
+ {
+ pHitTest->bSizeBar = TRUE;
+ pHitTest->mnDragSize = RULER_DRAGSIZE_MOVE;
+ }
+ }
+ else
+ {
+ long nMOff = RULER_MOUSE_BORDERWIDTH;
+ while ( nMOff*2 >= (n2-n1-RULER_MOUSE_BORDERMOVE) )
+ {
+ if ( nMOff < 2 )
+ {
+ nMOff = 0;
+ break;
+ }
+ else
+ nMOff--;
+ }
+
+ if ( nX <= n1+nMOff )
+ {
+ pHitTest->bSize = TRUE;
+ pHitTest->mnDragSize = RULER_DRAGSIZE_1;
+ }
+ else if ( nX >= n2-nMOff )
+ {
+ pHitTest->bSize = TRUE;
+ pHitTest->mnDragSize = RULER_DRAGSIZE_2;
+ }
+ else
+ {
+ if ( nStyle & RULER_BORDER_MOVEABLE )
+ {
+ pHitTest->bSizeBar = TRUE;
+ pHitTest->mnDragSize = RULER_DRAGSIZE_MOVE;
+ }
+ }
+ }
+
+ return TRUE;
+ }
+ }
+ }
+
+ // Und zum Schluss die Raender
+ if ( (mpData->nMargin1Style & (RULER_MARGIN_SIZEABLE | RULER_STYLE_INVISIBLE)) == RULER_MARGIN_SIZEABLE )
+ {
+ n1 = mpData->nMargin1;
+ if ( (nX >= n1-RULER_MOUSE_MARGINWIDTH) && (nX <= n1+RULER_MOUSE_MARGINWIDTH) )
+ {
+ pHitTest->eType = RULER_TYPE_MARGIN1;
+ pHitTest->bSize = TRUE;
+ return TRUE;
+ }
+ }
+ if ( (mpData->nMargin2Style & (RULER_MARGIN_SIZEABLE | RULER_STYLE_INVISIBLE)) == RULER_MARGIN_SIZEABLE )
+ {
+ n1 = mpData->nMargin2;
+ if ( (nX >= n1-RULER_MOUSE_MARGINWIDTH) && (nX <= n1+RULER_MOUSE_MARGINWIDTH) )
+ {
+ pHitTest->eType = RULER_TYPE_MARGIN2;
+ pHitTest->bSize = TRUE;
+ return TRUE;
+ }
+ }
+
+ // Jetzt nocheinmal die Tabs testen, nur mit etwas mehr spielraum
+ if ( mpData->pTabs )
+ {
+ aRect.Top() = RULER_OFF;
+ aRect.Bottom() = nHitBottom;
+
+ for ( i = mpData->nTabs; i; i-- )
+ {
+ nStyle = mpData->pTabs[i-1].nStyle;
+ if ( !(nStyle & RULER_STYLE_INVISIBLE) )
+ {
+ nStyle &= RULER_TAB_STYLE;
+
+ // Default-Tabs werden nur angezeigt
+ if ( nStyle != RULER_TAB_DEFAULT )
+ {
+ n1 = mpData->pTabs[i-1].nPos;
+
+ if ( nStyle == RULER_TAB_LEFT )
+ {
+ aRect.Left() = n1;
+ aRect.Right() = n1+RULER_TAB_WIDTH-1;
+ }
+ else if ( nStyle == RULER_TAB_RIGHT )
+ {
+ aRect.Right() = n1;
+ aRect.Left() = n1-RULER_TAB_WIDTH-1;
+ }
+ else
+ {
+ aRect.Left() = n1-RULER_TAB_CWIDTH2+1;
+ aRect.Right() = n1-RULER_TAB_CWIDTH2+RULER_TAB_CWIDTH;
+ }
+
+ aRect.Left()--;
+ aRect.Right()++;
+
+ if ( aRect.IsInside( Point( nX, nY ) ) )
+ {
+ pHitTest->eType = RULER_TYPE_TAB;
+ pHitTest->nAryPos = i-1;
+ return TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Ruler::ImplDocHitTest( const Point& rPos, RulerType eDragType,
+ ImplRulerHitTest* pHitTest ) const
+{
+ Point aPos = rPos;
+
+ if ( mnWinStyle & WB_HORZ )
+ aPos.X() += mnWinOff;
+ else
+ aPos.Y() += mnWinOff;
+
+ if ( (eDragType == RULER_TYPE_INDENT) || (eDragType == RULER_TYPE_DONTKNOW) )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ aPos.Y() = RULER_OFF+1;
+ else
+ aPos.X() = RULER_OFF+1;
+
+ // HitTest durchfuehren
+ if ( ImplHitTest( aPos, pHitTest ) )
+ {
+ if ( (pHitTest->eType == eDragType) || (eDragType == RULER_TYPE_DONTKNOW) )
+ return TRUE;
+ }
+ }
+
+ if ( (eDragType == RULER_TYPE_INDENT) || (eDragType == RULER_TYPE_TAB) ||
+ (eDragType == RULER_TYPE_DONTKNOW) )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ aPos.Y() = mnHeight-RULER_OFF-1;
+ else
+ aPos.X() = mnWidth-RULER_OFF-1;
+
+ // HitTest durchfuehren
+ if ( ImplHitTest( aPos, pHitTest ) )
+ {
+ if ( (pHitTest->eType == eDragType) || (eDragType == RULER_TYPE_DONTKNOW) )
+ return TRUE;
+ }
+ }
+
+ if ( (eDragType == RULER_TYPE_MARGIN1) || (eDragType == RULER_TYPE_MARGIN2) ||
+ (eDragType == RULER_TYPE_BORDER) || (eDragType == RULER_TYPE_DONTKNOW) )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ aPos.Y() = RULER_OFF + (mnVirHeight/2);
+ else
+ aPos.X() = RULER_OFF + (mnVirHeight/2);
+
+ // HitTest durchfuehren
+ if ( ImplHitTest( aPos, pHitTest ) )
+ {
+ if ( (pHitTest->eType == eDragType) || (eDragType == RULER_TYPE_DONTKNOW) )
+ return TRUE;
+ }
+ }
+
+ // Auf DontKnow setzen
+ pHitTest->eType = RULER_TYPE_DONTKNOW;
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Ruler::ImplStartDrag( ImplRulerHitTest* pHitTest, USHORT nModifier )
+{
+ // Wenn eine Spalte angeklick wurde, die weder verschiebar noch
+ // in der Groesse aenderbar ist, brauchen wir auch kein Drag ausloesen
+ if ( (pHitTest->eType == RULER_TYPE_BORDER) &&
+ !pHitTest->bSize && !pHitTest->bSizeBar )
+ return FALSE;
+
+ // Dragdaten setzen
+ meDragType = pHitTest->eType;
+ mnDragPos = pHitTest->nPos;
+ mnDragAryPos = pHitTest->nAryPos;
+ mnDragSize = pHitTest->mnDragSize;
+ mnDragModifier = nModifier;
+ maDragData = maData;
+ mpData = &maDragData;
+
+ // Handler rufen
+ if ( StartDrag() )
+ {
+ // Wenn der Handler das Draggen erlaubt, dann das Draggen
+ // initialisieren
+ ImplInvertLines();
+ mbDrag = TRUE;
+ mnStartDragPos = mnDragPos;
+ StartTracking();
+ return TRUE;
+ }
+ else
+ {
+ // Ansonsten muessen wir die Daten zuruecksetzen
+ meDragType = RULER_TYPE_DONTKNOW;
+ mnDragPos = 0;
+ mnDragAryPos = 0;
+ mnDragSize = 0;
+ mnDragModifier = 0;
+ mpData = &maData;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplDrag( const Point& rPos )
+{
+ long nX;
+ long nY;
+ long nOutHeight;
+
+ if ( mnWinStyle & WB_HORZ )
+ {
+ nX = rPos.X();
+ nY = rPos.Y();
+ nOutHeight = mnHeight;
+ }
+ else
+ {
+ nX = rPos.Y();
+ nY = rPos.X();
+ nOutHeight = mnWidth;
+ }
+
+ // X berechnen und einpassen
+ nX -= mnVirOff;
+ if ( nX < mpData->nRulVirOff )
+ {
+ nX = mpData->nRulVirOff;
+ mnDragScroll = RULER_SCROLL_1;
+ }
+ else if ( nX > mpData->nRulVirOff+mpData->nRulWidth )
+ {
+ nX = mpData->nRulVirOff+mpData->nRulWidth;
+ mnDragScroll = RULER_SCROLL_2;
+ }
+ nX -= mpData->nNullVirOff;
+
+ // Wenn oberhalb oder links vom Lineal, dann alte Werte
+ mbDragDelete = FALSE;
+ if ( nY < 0 )
+ {
+ if ( !mbDragCanceled )
+ {
+ // Daten wiederherstellen
+ mbDragCanceled = TRUE;
+ ImplRulerData aTempData;
+ aTempData = maDragData;
+ maDragData = maData;
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+
+ // Handler rufen
+ mnDragPos = mnStartDragPos;
+ Drag();
+
+ // Und neu ausgeben (zeitverzoegert)
+/*
+ mnUpdateFlags |= RULER_UPDATE_DRAW;
+ if ( mnUpdateEvtId )
+ Application::RemoveUserEvent( mnUpdateEvtId );
+ mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL );
+*/
+ ImplDraw();
+
+ // Daten wieder wie vor dem Cancel herstellen
+ maDragData = aTempData;
+ }
+ }
+ else
+ {
+ mbDragCanceled = FALSE;
+
+ // +2, damit nicht so schnell die Tabs geloescht werden
+ if ( nY > nOutHeight+2 )
+ mbDragDelete = TRUE;
+
+ mnDragPos = nX;
+
+ // Handler rufen
+ Drag();
+
+ // Und neu ausgeben
+ if ( mbFormat )
+ ImplDraw();
+ }
+
+ mnDragScroll = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ImplEndDrag()
+{
+ // Werte uebernehmen
+ if ( mbDragCanceled )
+ maDragData = maData;
+ else
+ maData = maDragData;
+ mpData = &maData;
+ mbDrag = FALSE;
+
+ // Handler rufen
+ EndDrag();
+
+ // Drag-Werte zuruecksetzen
+ meDragType = RULER_TYPE_DONTKNOW;
+ mnDragPos = 0;
+ mnDragAryPos = 0;
+ mnDragSize = 0;
+ mbDragCanceled = FALSE;
+ mbDragDelete = FALSE;
+ mnDragModifier = 0;
+ mnDragScroll = 0;
+ mnStartDragPos = 0;
+
+ // Und neu ausgeben
+ ImplDraw();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Ruler, ImplUpdateHdl, void*, EMPTYARG )
+{
+ mnUpdateEvtId = 0;
+
+ // Feststellen, was upgedatet werden muss
+ if ( mnUpdateFlags & RULER_UPDATE_DRAW )
+ {
+ mnUpdateFlags = 0;
+ ImplDraw();
+ }
+ else if ( mnUpdateFlags & RULER_UPDATE_LINES )
+ {
+ mnUpdateFlags = 0;
+ ImplInvertLines();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && !IsTracking() )
+ {
+ Point aMousePos = rMEvt.GetPosPixel();
+ USHORT nMouseClicks = rMEvt.GetClicks();
+ USHORT nMouseModifier = rMEvt.GetModifier();
+
+ // Gegebenenfalls Lineal updaten (damit mit den richtigen Daten
+ // gearbeitet wird und die Anzeige auch zur Bearbeitung passt)
+ if ( mbFormat )
+ {
+ ImplDraw();
+ mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ }
+
+ if ( maExtraRect.IsInside( aMousePos ) )
+ {
+ mnExtraClicks = nMouseClicks;
+ mnExtraModifier = nMouseModifier;
+ ExtraDown();
+ mnExtraClicks = 0;
+ mnExtraModifier = 0;
+ }
+ else
+ {
+ ImplRulerHitTest aHitTest;
+
+ if ( nMouseClicks == 1 )
+ {
+ if ( ImplHitTest( aMousePos, &aHitTest ) )
+ ImplStartDrag( &aHitTest, nMouseModifier );
+ else
+ {
+ // Position innerhalb des Lineal-Bereiches
+ if ( aHitTest.eType == RULER_TYPE_DONTKNOW )
+ {
+ mnDragPos = aHitTest.nPos;
+ Click();
+ mnDragPos = 0;
+
+ // Nocheinmal HitTest durchfuehren, da durch den Click
+ // zum Beispiel ein neuer Tab gesetzt werden konnte
+ if ( ImplHitTest( aMousePos, &aHitTest ) )
+ ImplStartDrag( &aHitTest, nMouseModifier );
+ }
+ }
+ }
+ else
+ {
+ if ( ImplHitTest( aMousePos, &aHitTest ) )
+ {
+ mnDragPos = aHitTest.nPos;
+ mnDragAryPos = aHitTest.nAryPos;
+ }
+ meDragType = aHitTest.eType;
+
+ DoubleClick();
+
+ meDragType = RULER_TYPE_DONTKNOW;
+ mnDragPos = 0;
+ mnDragAryPos = 0;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::MouseMove( const MouseEvent& rMEvt )
+{
+ PointerStyle ePtrStyle = POINTER_ARROW;
+
+ // Gegebenenfalls Lineal updaten (damit mit den richtigen Daten
+ // gearbeitet wird und die Anzeige auch zur Bearbeitung passt)
+ if ( mbFormat )
+ {
+ ImplDraw();
+ mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ }
+
+ ImplRulerHitTest aHitTest;
+ if ( ImplHitTest( rMEvt.GetPosPixel(), &aHitTest ) )
+ {
+ if ( aHitTest.bSize )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ ePtrStyle = POINTER_ESIZE;
+ else
+ ePtrStyle = POINTER_SSIZE;
+ }
+ else if ( aHitTest.bSizeBar )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ ePtrStyle = POINTER_HSIZEBAR;
+ else
+ ePtrStyle = POINTER_VSIZEBAR;
+ }
+ }
+
+ SetPointer( Pointer( ePtrStyle ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ // Bei Abbruch, den alten Status wieder herstellen
+ if ( rTEvt.IsTrackingCanceled() )
+ {
+ mbDragCanceled = TRUE;
+ mbFormat = TRUE;
+ }
+
+ ImplEndDrag();
+ }
+ else
+ ImplDrag( rTEvt.GetMouseEvent().GetPosPixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::Paint( const Rectangle& )
+{
+ ImplDraw();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ // Extra-Field beruecksichtigen
+ if ( mnWinStyle & WB_EXTRAFIELD )
+ {
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( maExtraRect.Left(), maExtraRect.Top() ),
+ Point( maExtraRect.Right()-1, maExtraRect.Top() ) );
+ DrawLine( Point( maExtraRect.Left(), maExtraRect.Top() ),
+ Point( maExtraRect.Left(), maExtraRect.Bottom()-1 ) );
+ DrawLine( Point( maExtraRect.Left(), maExtraRect.Bottom()-1 ),
+ Point( maExtraRect.Right()-1, maExtraRect.Bottom()-1 ) );
+ DrawLine( Point( maExtraRect.Right()-1, maExtraRect.Top() ),
+ Point( maExtraRect.Right()-1, maExtraRect.Bottom()-1 ) );
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( maExtraRect.Left()+1, maExtraRect.Top()+1 ),
+ Point( maExtraRect.Right()-2, maExtraRect.Top()+1 ) );
+ DrawLine( Point( maExtraRect.Left()+1, maExtraRect.Top()+1 ),
+ Point( maExtraRect.Left()+1, maExtraRect.Bottom()-2 ) );
+ DrawLine( Point( maExtraRect.Left(), maExtraRect.Bottom() ),
+ Point( maExtraRect.Right(), maExtraRect.Bottom() ) );
+ DrawLine( Point( maExtraRect.Right(), maExtraRect.Top() ),
+ Point( maExtraRect.Right(), maExtraRect.Bottom() ) );
+ }
+ else
+ {
+ SetLineColor( rStyleSettings.GetWindowTextColor() );
+ SetFillColor( rStyleSettings.GetWindowColor() );
+ DrawRect( maExtraRect );
+ }
+
+ // Imhalt vom Extrafeld ausgeben
+ ImplDrawExtra( TRUE );
+ }
+
+ if ( mnWinStyle & WB_BORDER )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ {
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( mnBorderOff, mnHeight-2 ),
+ Point( mnWidth, mnHeight-2 ) );
+ if ( mnBorderOff )
+ {
+ DrawLine( Point( mnBorderOff-1, mnHeight-2 ),
+ Point( mnBorderOff-1, mnHeight-1 ) );
+ }
+ }
+ SetLineColor( rStyleSettings.GetWindowTextColor() );
+ DrawLine( Point( mnBorderOff, mnHeight-1 ),
+ Point( mnWidth, mnHeight-1 ) );
+ }
+ else
+ {
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( mnWidth-2, mnBorderOff ),
+ Point( mnWidth-2, mnHeight ) );
+ if ( mnBorderOff )
+ {
+ DrawLine( Point( mnWidth-2, mnBorderOff-1 ),
+ Point( mnWidth-1, mnBorderOff-1 ) );
+ }
+ }
+ SetLineColor( rStyleSettings.GetWindowTextColor() );
+ DrawLine( Point( mnWidth-1, mnBorderOff ),
+ Point( mnWidth-1, mnHeight ) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::Resize()
+{
+ Size aWinSize = GetOutputSizePixel();
+
+ long nNewHeight;
+ if ( mnWinStyle & WB_HORZ )
+ {
+ if ( aWinSize.Height() != mnHeight )
+ nNewHeight = aWinSize.Height();
+ else
+ nNewHeight = 0;
+ }
+ else
+ {
+ if ( aWinSize.Width() != mnWidth )
+ nNewHeight = aWinSize.Width();
+ else
+ nNewHeight = 0;
+ }
+
+ // Hier schon Linien loeschen
+ BOOL bVisible = IsReallyVisible();
+ if ( bVisible && mpData->nLines )
+ {
+ ImplInvertLines();
+ mnUpdateFlags |= RULER_UPDATE_LINES;
+ if ( !mnUpdateEvtId )
+ mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL );
+ }
+ mbFormat = TRUE;
+
+ // Wenn sich die Hoehe bzw. Breite aendert, dann muessen besimmte Werte
+ // neu berechnet werden
+ if ( nNewHeight )
+ {
+ mbCalc = TRUE;
+ mnVirHeight = nNewHeight - mnBorderWidth - (RULER_OFF*2);
+ ImplInitExtraField( FALSE );
+ }
+ else
+ {
+ if ( mpData->bAutoPageWidth )
+ ImplUpdate( TRUE );
+ else if ( mbAutoWinWidth )
+ mbCalc = TRUE;
+ }
+
+ // Wenn Ruler eine Groesse hat, dann Groesse vom VirtualDevice setzen
+ if ( (mnVirWidth > RULER_MIN_SIZE) ||
+ ((aWinSize.Width() > RULER_MIN_SIZE) && (aWinSize.Height() > RULER_MIN_SIZE)) )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ mnVirWidth = aWinSize.Width()-mnVirOff;
+ else
+ mnVirWidth = aWinSize.Height()-mnVirOff;
+ if ( mnVirWidth < RULER_MIN_SIZE )
+ mnVirWidth = 0;
+ }
+
+ // Gegebenenfalls ein Teil vom Rand loeschen, da 3D-Effekt/Trennlinie am
+ // Fensterrand
+ if ( bVisible )
+ {
+ if ( nNewHeight )
+ Invalidate();
+ else if ( mpData->bAutoPageWidth )
+ {
+ // Nur bei AutoPageWidth haben wir rechts einen 3D-Effekt,
+ // der sich der Fensterbreite anpasst und deshalb neu gezeichnet
+ // werden muss
+ Rectangle aRect;
+
+ if ( mnWinStyle & WB_HORZ )
+ {
+ if ( mnWidth < aWinSize.Width() )
+ aRect.Left() = mnWidth-RULER_RESIZE_OFF;
+ else
+ aRect.Left() = aWinSize.Width()-RULER_RESIZE_OFF;
+ aRect.Right() = aRect.Left()+RULER_RESIZE_OFF;
+ aRect.Top() = RULER_OFF;
+ aRect.Bottom() = RULER_OFF+mnVirHeight;
+ }
+ else
+ {
+ if ( mnHeight < aWinSize.Height() )
+ aRect.Top() = mnHeight-RULER_RESIZE_OFF;
+ else
+ aRect.Top() = aWinSize.Height()-RULER_RESIZE_OFF;
+ aRect.Bottom() = aRect.Top()+RULER_RESIZE_OFF;
+ aRect.Left() = RULER_OFF;
+ aRect.Right() = RULER_OFF+mnVirHeight;
+ }
+
+ Invalidate( aRect );
+ }
+ }
+
+ // Neue Groesse merken
+ mnWidth = aWinSize.Width();
+ mnHeight = aWinSize.Height();
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ ImplFormat();
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ ImplDraw();
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ mbFormat = TRUE;
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long Ruler::StartDrag()
+{
+ if ( maStartDragHdl.IsSet() )
+ return maStartDragHdl.Call( this );
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::Drag()
+{
+ maDragHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::EndDrag()
+{
+ maEndDragHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::Click()
+{
+ maClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::ExtraDown()
+{
+ maExtraDownHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::Activate()
+{
+ mbActive = TRUE;
+
+ // Positionslinien wieder anzeigen (erst hinter mbActive=TRUE rufen, da
+ // von ImplInvertLines() ausgewertet wird). Das Zeichnen der Linien
+ // wird verzoegert, damit im vermutlich noch nicht gepainteten Zustand
+ // Linien gezeichnet werden.
+ mnUpdateFlags |= RULER_UPDATE_LINES;
+ if ( !mnUpdateEvtId )
+ mnUpdateEvtId = Application::PostUserEvent( LINK( this, Ruler, ImplUpdateHdl ), NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::Deactivate()
+{
+ // Positionslinien loeschen (schon vor mbActive=FALSE rufen, da
+ // von ImplInvertLines() ausgewertet wird)
+ ImplInvertLines();
+
+ mbActive = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Ruler::StartDocDrag( const MouseEvent& rMEvt, RulerType eDragType )
+{
+ if ( !mbDrag )
+ {
+ Point aMousePos = rMEvt.GetPosPixel();
+ USHORT nMouseClicks = rMEvt.GetClicks();
+ USHORT nMouseModifier = rMEvt.GetModifier();
+ ImplRulerHitTest aHitTest;
+
+ // Gegebenenfalls Lineal updaten (damit mit den richtigen Daten
+ // gearbeitet wird und die Anzeige auch zur Bearbeitung passt)
+ if ( mbFormat )
+ {
+ ImplDraw();
+ mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ }
+
+ if ( nMouseClicks == 1 )
+ {
+ if ( ImplDocHitTest( aMousePos, eDragType, &aHitTest ) )
+ {
+ Pointer aPtr;
+
+ if ( aHitTest.bSize )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ aPtr = Pointer( POINTER_ESIZE );
+ else
+ aPtr = Pointer( POINTER_SSIZE );
+ }
+ else if ( aHitTest.bSizeBar )
+ {
+ if ( mnWinStyle & WB_HORZ )
+ aPtr = Pointer( POINTER_HSIZEBAR );
+ else
+ aPtr = Pointer( POINTER_VSIZEBAR );
+ }
+ SetPointer( aPtr );
+ return ImplStartDrag( &aHitTest, nMouseModifier );
+ }
+ }
+ else if ( nMouseClicks == 2 )
+ {
+ if ( ImplDocHitTest( aMousePos, eDragType, &aHitTest ) )
+ {
+ mnDragPos = aHitTest.nPos;
+ mnDragAryPos = aHitTest.nAryPos;
+ }
+ eDragType = aHitTest.eType;
+
+ DoubleClick();
+
+ eDragType = RULER_TYPE_DONTKNOW;
+ mnDragPos = 0;
+ mnDragAryPos = 0;
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+RulerType Ruler::GetDocType( const Point& rPos, RulerType eDragType,
+ USHORT* pAryPos ) const
+{
+ ImplRulerHitTest aHitTest;
+
+ // Gegebenenfalls Lineal updaten (damit mit den richtigen Daten
+ // gearbeitet wird und die Anzeige auch zur Bearbeitung passt)
+ if ( IsReallyVisible() && mbFormat )
+ {
+ ((Ruler*)this)->ImplDraw();
+ ((Ruler*)this)->mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ }
+
+ // HitTest durchfuehren
+ ImplDocHitTest( rPos, eDragType, &aHitTest );
+
+ // Werte zurueckgeben
+ if ( pAryPos )
+ *pAryPos = aHitTest.nAryPos;
+ return aHitTest.eType;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::CancelDrag()
+{
+ if ( mbDrag )
+ {
+ ImplDrag( Point( -1, -1 ) );
+ ImplEndDrag();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+RulerType Ruler::GetType( const Point& rPos, USHORT* pAryPos ) const
+{
+ ImplRulerHitTest aHitTest;
+
+ // Gegebenenfalls Lineal updaten (damit mit den richtigen Daten
+ // gearbeitet wird und die Anzeige auch zur Bearbeitung passt)
+ if ( IsReallyVisible() && mbFormat )
+ {
+ ((Ruler*)this)->ImplDraw();
+ ((Ruler*)this)->mnUpdateFlags &= ~RULER_UPDATE_DRAW;
+ }
+
+ // HitTest durchfuehren
+ ImplHitTest( rPos, &aHitTest );
+
+ // Werte zurueckgeben
+ if ( pAryPos )
+ *pAryPos = aHitTest.nAryPos;
+ return aHitTest.eType;
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetWinPos( long nNewOff, long nNewWidth )
+{
+ // Gegebenenfalls werden die Breiten automatisch berechnet
+ if ( !nNewWidth )
+ mbAutoWinWidth = TRUE;
+ else
+ mbAutoWinWidth = FALSE;
+
+ // Werte setzen (werden in ImplFormat gegebenenfalls mitberechnet)
+ mnWinOff = nNewOff;
+ mnWinWidth = nNewWidth;
+ ImplUpdate( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetPagePos( long nNewOff, long nNewWidth )
+{
+ // Muessen wir ueberhaupt was machen
+ if ( (mpData->nPageOff == nNewOff) && (mpData->nPageWidth == nNewWidth) )
+ return;
+
+ // Gegebenenfalls werden die Breiten automatisch berechnet
+ if ( !nNewWidth )
+ mpData->bAutoPageWidth = TRUE;
+ else
+ mpData->bAutoPageWidth = FALSE;
+
+ // Werte setzen (werden in ImplFormat gegebenenfalls mitberechnet)
+ mpData->nPageOff = nNewOff;
+ mpData->nPageWidth = nNewWidth;
+ ImplUpdate( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetBorderPos( long nOff )
+{
+ if ( mnWinStyle & WB_BORDER )
+ {
+ if ( mnBorderOff != nOff )
+ {
+ mnBorderOff = nOff;
+
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetUnit( FieldUnit eNewUnit )
+{
+ if ( meUnit != eNewUnit )
+ {
+ meUnit = eNewUnit;
+ switch ( meUnit )
+ {
+ case FUNIT_MM:
+ mnUnitIndex = RULER_UNIT_MM;
+ break;
+ case FUNIT_CM:
+ mnUnitIndex = RULER_UNIT_CM;
+ break;
+ case FUNIT_M:
+ mnUnitIndex = RULER_UNIT_M;
+ break;
+ case FUNIT_KM:
+ mnUnitIndex = RULER_UNIT_KM;
+ break;
+ case FUNIT_INCH:
+ mnUnitIndex = RULER_UNIT_INCH;
+ break;
+ case FUNIT_FOOT:
+ mnUnitIndex = RULER_UNIT_FOOT;
+ break;
+ case FUNIT_MILE:
+ mnUnitIndex = RULER_UNIT_MILE;
+ break;
+ case FUNIT_POINT:
+ mnUnitIndex = RULER_UNIT_POINT;
+ break;
+ case FUNIT_PICA:
+ mnUnitIndex = RULER_UNIT_PICA;
+ break;
+
+#ifdef DBG_UTIL
+ default:
+ DBG_ERRORFILE( "Ruler::SetUnit() - Wrong Unit" );
+ break;
+#endif
+ }
+
+ maMapMode.SetMapUnit( aImplRulerUnitTab[mnUnitIndex].eMapUnit );
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetZoom( const Fraction& rNewZoom )
+{
+ DBG_ASSERT( rNewZoom.GetNumerator(), "Ruler::SetZoom() with scale 0 is not allowed" );
+
+ if ( maZoom != rNewZoom )
+ {
+ maZoom = rNewZoom;
+ maMapMode.SetScaleX( maZoom );
+ maMapMode.SetScaleY( maZoom );
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetExtraType( RulerExtra eNewExtraType, USHORT nStyle )
+{
+ if ( mnWinStyle & WB_EXTRAFIELD )
+ {
+ meExtraType = eNewExtraType;
+ mnExtraStyle = nStyle;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ ImplDrawExtra( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetNullOffset( long nPos )
+{
+ if ( mpData->nNullOff != nPos )
+ {
+ mpData->nNullOff = nPos;
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetMargin1( long nPos, USHORT nMarginStyle )
+{
+ if ( (mpData->nMargin1 != nPos) || (mpData->nMargin1Style != nMarginStyle) )
+ {
+ mpData->nMargin1 = nPos;
+ mpData->nMargin1Style = nMarginStyle;
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetMargin2( long nPos, USHORT nMarginStyle )
+{
+ DBG_ASSERT( (nPos >= mpData->nMargin1) ||
+ (mpData->nMargin1Style & RULER_STYLE_INVISIBLE) ||
+ (mpData->nMargin2Style & RULER_STYLE_INVISIBLE),
+ "Ruler::SetMargin2() - Margin2 < Margin1" );
+
+ if ( (mpData->nMargin2 != nPos) || (mpData->nMargin2Style != nMarginStyle) )
+ {
+ mpData->nMargin2 = nPos;
+ mpData->nMargin2Style = nMarginStyle;
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetLines( USHORT n, const RulerLine* pLineAry )
+{
+ // Testen, ob sich was geaendert hat
+ if ( mpData->nLines == n )
+ {
+ USHORT i = n;
+ const RulerLine* pAry1 = mpData->pLines;
+ const RulerLine* pAry2 = pLineAry;
+ while ( i )
+ {
+ if ( (pAry1->nPos != pAry2->nPos) ||
+ (pAry1->nStyle != pAry2->nStyle) )
+ break;
+ pAry1++;
+ pAry2++;
+ i--;
+ }
+ if ( !i )
+ return;
+ }
+
+ // Neue Werte setzen und neu ausgeben
+ BOOL bMustUpdate;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ bMustUpdate = TRUE;
+ else
+ bMustUpdate = FALSE;
+
+ // Alte Linien loeschen
+ if ( bMustUpdate )
+ ImplInvertLines();
+
+ // Neue Daten setzen
+ if ( !n || !pLineAry )
+ {
+ if ( !mpData->pLines )
+ return;
+ delete mpData->pLines;
+ mpData->nLines = 0;
+ mpData->pLines = NULL;
+ }
+ else
+ {
+ if ( mpData->nLines != n )
+ {
+ if ( mpData->pLines )
+ delete mpData->pLines;
+ mpData->nLines = n;
+ mpData->pLines = new RulerLine[n];
+ }
+
+ memcpy( mpData->pLines, pLineAry, n*sizeof( RulerLine ) );
+
+ // Linien neu ausgeben
+ if ( bMustUpdate )
+ ImplInvertLines();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetArrows( USHORT n, const RulerArrow* pArrowAry )
+{
+ if ( !n || !pArrowAry )
+ {
+ if ( !mpData->pArrows )
+ return;
+ delete mpData->pArrows;
+ mpData->nArrows = 0;
+ mpData->pArrows = NULL;
+ }
+ else
+ {
+ if ( mpData->nArrows != n )
+ {
+ if ( mpData->pArrows )
+ delete mpData->pArrows;
+ mpData->nArrows = n;
+ mpData->pArrows = new RulerArrow[n];
+ }
+ else
+ {
+ USHORT i = n;
+ const RulerArrow* pAry1 = mpData->pArrows;
+ const RulerArrow* pAry2 = pArrowAry;
+ while ( i )
+ {
+ if ( (pAry1->nPos != pAry2->nPos) ||
+ (pAry1->nWidth != pAry2->nWidth) ||
+ (pAry1->nLogWidth != pAry2->nLogWidth) ||
+ (pAry1->nStyle != pAry2->nStyle) )
+ break;
+ pAry1++;
+ pAry2++;
+ i--;
+ }
+ if ( !i )
+ return;
+ }
+
+ memcpy( mpData->pArrows, pArrowAry, n*sizeof( RulerArrow ) );
+ }
+
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetBorders( USHORT n, const RulerBorder* pBrdAry )
+{
+ if ( !n || !pBrdAry )
+ {
+ if ( !mpData->pBorders )
+ return;
+ delete mpData->pBorders;
+ mpData->nBorders = 0;
+ mpData->pBorders = NULL;
+ }
+ else
+ {
+ if ( mpData->nBorders != n )
+ {
+ if ( mpData->pBorders )
+ delete mpData->pBorders;
+ mpData->nBorders = n;
+ mpData->pBorders = new RulerBorder[n];
+ }
+ else
+ {
+ USHORT i = n;
+ const RulerBorder* pAry1 = mpData->pBorders;
+ const RulerBorder* pAry2 = pBrdAry;
+ while ( i )
+ {
+ if ( (pAry1->nPos != pAry2->nPos) ||
+ (pAry1->nWidth != pAry2->nWidth) ||
+ (pAry1->nStyle != pAry2->nStyle) )
+ break;
+ pAry1++;
+ pAry2++;
+ i--;
+ }
+ if ( !i )
+ return;
+ }
+
+ memcpy( mpData->pBorders, pBrdAry, n*sizeof( RulerBorder ) );
+ }
+
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetIndents( USHORT n, const RulerIndent* pIndentAry )
+{
+ DBG_ASSERT( mnWinStyle & WB_HORZ,
+ "Ruler::SetIndents() not allowed when WB_VERT" );
+
+ if ( !n || !pIndentAry )
+ {
+ if ( !mpData->pIndents )
+ return;
+ delete mpData->pIndents;
+ mpData->nIndents = 0;
+ mpData->pIndents = NULL;
+ }
+ else
+ {
+ if ( mpData->nIndents != n )
+ {
+ if ( mpData->pIndents )
+ delete mpData->pIndents;
+ mpData->nIndents = n;
+ mpData->pIndents = new RulerIndent[n];
+ }
+ else
+ {
+ USHORT i = n;
+ const RulerIndent* pAry1 = mpData->pIndents;
+ const RulerIndent* pAry2 = pIndentAry;
+ while ( i )
+ {
+ if ( (pAry1->nPos != pAry2->nPos) ||
+ (pAry1->nStyle != pAry2->nStyle) )
+ break;
+ pAry1++;
+ pAry2++;
+ i--;
+ }
+ if ( !i )
+ return;
+ }
+
+ memcpy( mpData->pIndents, pIndentAry, n*sizeof( RulerIndent ) );
+ }
+
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetTabs( USHORT n, const RulerTab* pTabAry )
+{
+ DBG_ASSERT( mnWinStyle & WB_HORZ,
+ "Ruler::SetTabs() not allowed when WB_VERT" );
+
+ if ( !n || !pTabAry )
+ {
+ if ( !mpData->pTabs )
+ return;
+ delete mpData->pTabs;
+ mpData->nTabs = 0;
+ mpData->pTabs = NULL;
+ }
+ else
+ {
+ if ( mpData->nTabs != n )
+ {
+ if ( mpData->pTabs )
+ delete mpData->pTabs;
+ mpData->nTabs = n;
+ mpData->pTabs = new RulerTab[n];
+ }
+ else
+ {
+ USHORT i = n;
+ const RulerTab* pAry1 = mpData->pTabs;
+ const RulerTab* pAry2 = pTabAry;
+ while ( i )
+ {
+ if ( (pAry1->nPos != pAry2->nPos) ||
+ (pAry1->nStyle != pAry2->nStyle) )
+ break;
+ pAry1++;
+ pAry2++;
+ i--;
+ }
+ if ( !i )
+ return;
+ }
+
+ memcpy( mpData->pTabs, pTabAry, n*sizeof( RulerTab ) );
+ }
+
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::SetStyle( WinBits nStyle )
+{
+ if ( mnWinStyle != nStyle )
+ {
+ mnWinStyle = nStyle;
+ ImplInitExtraField( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Ruler::DrawTab( OutputDevice* pDevice, const Point& rPos, USHORT nStyle )
+{
+ const StyleSettings& rStyleSettings = pDevice->GetSettings().GetStyleSettings();
+ Point aPos( rPos );
+ USHORT nTabStyle = nStyle & RULER_TAB_STYLE;
+
+ pDevice->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ pDevice->SetLineColor();
+ pDevice->SetFillColor( pDevice->GetSettings().GetStyleSettings().GetWindowTextColor() );
+ ImplCenterTabPos( aPos, nTabStyle );
+ ImplDrawRulerTab( pDevice, aPos, nTabStyle );
+ pDevice->Pop();
+}
diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx
new file mode 100644
index 000000000000..10ef086ed9fd
--- /dev/null
+++ b/svtools/source/control/scrwin.cxx
@@ -0,0 +1,603 @@
+/*************************************************************************
+ *
+ * $RCSfile: scrwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SVT_SCRWIN_CXX
+#include <scrwin.hxx>
+
+//===================================================================
+
+void ScrollableWindow::ImpInitialize( ScrollableWindowFlags nFlags )
+{
+ bHandleDragging = (BOOL) ( nFlags & SCRWIN_THUMBDRAGGING );
+ bVCenter = (nFlags & SCRWIN_VCENTER) == SCRWIN_VCENTER;
+ bHCenter = (nFlags & SCRWIN_HCENTER) == SCRWIN_HCENTER;
+ bScrolling = FALSE;
+
+ // set the handlers for the scrollbars
+ aVScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
+ aHScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) );
+ aVScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
+ aHScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) );
+
+ nColumnPixW = nLinePixH = GetSettings().GetStyleSettings().GetScrollBarSize();
+}
+
+//-------------------------------------------------------------------
+
+ScrollableWindow::ScrollableWindow( Window* pParent, WinBits nBits,
+ ScrollableWindowFlags nFlags ) :
+ Window( pParent, WinBits(nBits|WB_CLIPCHILDREN) ),
+ aVScroll( this, WinBits(WB_VSCROLL | WB_DRAG) ),
+ aHScroll( this, WinBits(WB_HSCROLL | WB_DRAG) ),
+ aCornerWin( this )
+{
+ ImpInitialize( nFlags );
+}
+
+//-------------------------------------------------------------------
+
+ScrollableWindow::ScrollableWindow( Window* pParent, const ResId& rId,
+ ScrollableWindowFlags nFlags ) :
+ Window( pParent, rId ),
+ aVScroll( this, WinBits(WB_VSCROLL | WB_DRAG) ),
+ aHScroll( this, WinBits(WB_HSCROLL | WB_DRAG) ),
+ aCornerWin( this )
+{
+ ImpInitialize( nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollableWindow::Command( const CommandEvent& rCEvt )
+{
+ if ( (rCEvt.GetCommand() == COMMAND_WHEEL) ||
+ (rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
+ (rCEvt.GetCommand() == COMMAND_AUTOSCROLL) )
+ {
+ ScrollBar* pHScrBar;
+ ScrollBar* pVScrBar;
+ if ( aHScroll.IsVisible() )
+ pHScrBar = &aHScroll;
+ else
+ pHScrBar = NULL;
+ if ( aVScroll.IsVisible() )
+ pVScrBar = &aVScroll;
+ else
+ pVScrBar = NULL;
+ if ( HandleScrollCommand( rCEvt, pHScrBar, pVScrBar ) )
+ return;
+ }
+
+ Window::Command( rCEvt );
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Resize();
+ Invalidate();
+ }
+
+ Window::DataChanged( rDCEvt );
+}
+
+//-------------------------------------------------------------------
+
+Size __EXPORT ScrollableWindow::GetOutputSizePixel() const
+{
+ Size aSz( Window::GetOutputSizePixel() );
+
+ long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize();
+ if ( aHScroll.IsVisible() )
+ aSz.Height() -= nTmp;
+ if ( aVScroll.IsVisible() )
+ aSz.Width() -= nTmp;
+ return aSz;
+}
+
+//-------------------------------------------------------------------
+
+Size ScrollableWindow::GetOutputSize() const
+{
+ return PixelToLogic( GetOutputSizePixel() );
+}
+
+//-------------------------------------------------------------------
+
+IMPL_LINK( ScrollableWindow, EndScrollHdl, ScrollBar *, pScroll )
+{
+ // notify the start of scrolling, if not already scrolling
+ if ( !bScrolling )
+ StartScroll(), bScrolling = TRUE;
+
+ // get the delta in logic coordinates
+ Size aDelta( PixelToLogic( Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) );
+
+ // scroll the window, if this is not already done
+ if ( !bHandleDragging )
+ {
+ if ( pScroll == &aHScroll )
+ Scroll( aDelta.Width(), 0 );
+ else
+ Scroll( 0, aDelta.Height() );
+ }
+
+ // notify the end of scrolling
+ bScrolling = FALSE;
+ EndScroll( aDelta.Width(), aDelta.Height() );
+ return 0;
+}
+
+//-------------------------------------------------------------------
+
+IMPL_LINK( ScrollableWindow, ScrollHdl, ScrollBar *, pScroll )
+{
+ // notify the start of scrolling, if not already scrolling
+ if ( !bScrolling )
+ StartScroll(), bScrolling = TRUE;
+
+ if ( bHandleDragging )
+ {
+ // get the delta in logic coordinates
+ Size aDelta( PixelToLogic(
+ Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) );
+ if ( pScroll == &aHScroll )
+ Scroll( aDelta.Width(), 0 );
+ else
+ Scroll( 0, aDelta.Height() );
+ }
+ return 0;
+}
+
+//-------------------------------------------------------------------
+
+void __EXPORT ScrollableWindow::Resize()
+{
+ // get the new output-size in pixel
+ Size aOutPixSz = Window::GetOutputSizePixel();
+
+ // determine the size of the output-area and if we need scrollbars
+ const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ BOOL bVVisible = FALSE; // by default no vertical-ScrollBar
+ BOOL bHVisible = FALSE; // by default no horizontal-ScrollBar
+ BOOL bChanged; // determines if a visiblility was changed
+ do
+ {
+ bChanged = FALSE;
+
+ // does we need a vertical ScrollBar
+ if ( aOutPixSz.Width() < aTotPixSz.Width() && !bHVisible )
+ { bHVisible = TRUE;
+ aOutPixSz.Height() -= nScrSize;
+ bChanged = TRUE;
+ }
+
+ // does we need a horizontal ScrollBar
+ if ( aOutPixSz.Height() < aTotPixSz.Height() && !bVVisible )
+ { bVVisible = TRUE;
+ aOutPixSz.Width() -= nScrSize;
+ bChanged = TRUE;
+ }
+
+ }
+ while ( bChanged ); // until no visibility has changed
+
+ // store the old offset and map-mode
+ MapMode aMap( GetMapMode() );
+ Point aOldPixOffset( aPixOffset );
+
+ // justify (right/bottom borders should never exceed the virtual window)
+ Size aPixDelta;
+ if ( aPixOffset.X() < 0 &&
+ aPixOffset.X() + aTotPixSz.Width() < aOutPixSz.Width() )
+ aPixDelta.Width() =
+ aOutPixSz.Width() - ( aPixOffset.X() + aTotPixSz.Width() );
+ if ( aPixOffset.Y() < 0 &&
+ aPixOffset.Y() + aTotPixSz.Height() < aOutPixSz.Height() )
+ aPixDelta.Height() =
+ aOutPixSz.Height() - ( aPixOffset.Y() + aTotPixSz.Height() );
+ if ( aPixDelta.Width() || aPixDelta.Height() )
+ {
+ aPixOffset.X() += aPixDelta.Width();
+ aPixOffset.Y() += aPixDelta.Height();
+ }
+
+ // for axis without scrollbar restore the origin
+ if ( !bVVisible || !bHVisible )
+ {
+ aPixOffset = Point(
+ bHVisible
+ ? aPixOffset.X()
+ : ( bHCenter
+ ? (aOutPixSz.Width()-aTotPixSz.Width()) / 2
+ : 0 ),
+ bVVisible
+ ? aPixOffset.Y()
+ : ( bVCenter
+ ? (aOutPixSz.Height()-aTotPixSz.Height()) / 2
+ : 0 ) );
+ }
+ if ( bHVisible && !aHScroll.IsVisible() )
+ aPixOffset.X() = 0;
+ if ( bVVisible && !aVScroll.IsVisible() )
+ aPixOffset.Y() = 0;
+
+ // select the shifted map-mode
+ if ( aPixOffset != aOldPixOffset )
+ {
+ Window::SetMapMode( MapMode( MAP_PIXEL ) );
+ Window::Scroll(
+ aPixOffset.X() - aOldPixOffset.X(),
+ aPixOffset.Y() - aOldPixOffset.Y() );
+ SetMapMode( aMap );
+ }
+
+ // show or hide scrollbars
+ aVScroll.Show( bVVisible );
+ aHScroll.Show( bHVisible );
+
+ // disable painting in the corner between the scrollbars
+ if ( bVVisible && bHVisible )
+ {
+ aCornerWin.SetPosSizePixel(
+ *((Point*) &aOutPixSz), Size(nScrSize, nScrSize) );
+ aCornerWin.Show();
+ }
+ else
+ aCornerWin.Hide();
+
+ // resize scrollbars and set their ranges
+ if ( bHVisible )
+ {
+ aHScroll.SetPosSizePixel(
+ Point( 0, aOutPixSz.Height() ),
+ Size( aOutPixSz.Width(), nScrSize ) );
+ aHScroll.SetRange( Range( 0, aTotPixSz.Width() ) );
+ aHScroll.SetPageSize( aOutPixSz.Width() );
+ aHScroll.SetVisibleSize( aOutPixSz.Width() );
+ aHScroll.SetLineSize( nColumnPixW );
+ aHScroll.SetThumbPos( -aPixOffset.X() );
+ }
+ if ( bVVisible )
+ {
+ aVScroll.SetPosSizePixel(
+ Point( aOutPixSz.Width(), 0 ),
+ Size( nScrSize,aOutPixSz.Height() ) );
+ aVScroll.SetRange( Range( 0, aTotPixSz.Height() ) );
+ aVScroll.SetPageSize( aOutPixSz.Height() );
+ aVScroll.SetVisibleSize( aOutPixSz.Height() );
+ aVScroll.SetLineSize( nLinePixH );
+ aVScroll.SetThumbPos( -aPixOffset.Y() );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void __EXPORT ScrollableWindow::StartScroll()
+{
+}
+
+//-------------------------------------------------------------------
+
+void __EXPORT ScrollableWindow::EndScroll( long nDeltaX, long nDeltaY )
+{
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::SetMapMode( const MapMode& rNewMapMode )
+{
+ MapMode aMap( rNewMapMode );
+ aMap.SetOrigin( aMap.GetOrigin() + PixelToLogic( aPixOffset, aMap ) );
+ Window::SetMapMode( aMap );
+}
+
+//-------------------------------------------------------------------
+
+MapMode ScrollableWindow::GetMapMode() const
+{
+ MapMode aMap( Window::GetMapMode() );
+ aMap.SetOrigin( aMap.GetOrigin() - PixelToLogic( aPixOffset ) );
+ return aMap;
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::SetTotalSize( const Size& rNewSize )
+{
+ aTotPixSz = LogicToPixel( rNewSize );
+ ScrollableWindow::Resize();
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::SetVisibleSize( const Size& rNewSize )
+{
+ // get the rectangle, we wish to view
+ Rectangle aWish( Point(0, 0), LogicToPixel(rNewSize) );
+
+ // get maximum rectangle for us from our parent-window (subst our border!)
+ Rectangle aMax( Point(0, 0), GetParent()->GetOutputSizePixel() );
+ aMax.Left() -= ( Window::GetSizePixel().Width() -
+ Window::GetOutputSizePixel().Width() );
+ aMax.Bottom() -= (Window::GetSizePixel().Height() -
+ Window::GetOutputSizePixel().Height());
+
+ Size aWill( aWish.GetIntersection(aMax).GetSize() );
+ BOOL bHScroll = FALSE;
+ const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ if ( aWill.Width() < aWish.GetSize().Width() )
+ { bHScroll = TRUE;
+ aWill.Height() =
+ Min( aWill.Height()+nScrSize, aMax.GetSize().Height() );
+ }
+ if ( aWill.Height() < aWish.GetSize().Height() )
+ aWill.Width() =
+ Min( aWill.Width()+nScrSize, aMax.GetSize().Width() );
+ if ( !bHScroll && (aWill.Width() < aWish.GetSize().Width()) )
+ aWill.Height() =
+ Min( aWill.Height()+nScrSize, aMax.GetSize().Height() );
+ Window::SetOutputSizePixel( aWill );
+}
+
+//-------------------------------------------------------------------
+
+BOOL ScrollableWindow::MakeVisible( const Rectangle& rTarget, BOOL bSloppy )
+{
+ Rectangle aTarget;
+ Rectangle aTotRect( Point(0, 0), PixelToLogic( aTotPixSz ) );
+
+ if ( bSloppy )
+ {
+ aTarget = rTarget;
+
+ // at maximum to right border
+ if ( aTarget.Right() > aTotRect.Right() )
+ {
+ long nDelta = aTarget.Right() - aTotRect.Right();
+ aTarget.Left() -= nDelta;
+ aTarget.Right() -= nDelta;
+
+ // too wide?
+ if ( aTarget.Left() < aTotRect.Left() )
+ aTarget.Left() = aTotRect.Left();
+ }
+
+ // at maximum to bottom border
+ if ( aTarget.Bottom() > aTotRect.Bottom() )
+ {
+ long nDelta = aTarget.Bottom() - aTotRect.Bottom();
+ aTarget.Top() -= nDelta;
+ aTarget.Bottom() -= nDelta;
+
+ // too high?
+ if ( aTarget.Top() < aTotRect.Top() )
+ aTarget.Top() = aTotRect.Top();
+ }
+
+ // at maximum to left border
+ if ( aTarget.Left() < aTotRect.Left() )
+ {
+ long nDelta = aTarget.Left() - aTotRect.Left();
+ aTarget.Right() -= nDelta;
+ aTarget.Left() -= nDelta;
+
+ // too wide?
+ if ( aTarget.Right() > aTotRect.Right() )
+ aTarget.Right() = aTotRect.Right();
+ }
+
+ // at maximum to top border
+ if ( aTarget.Top() < aTotRect.Top() )
+ {
+ long nDelta = aTarget.Top() - aTotRect.Top();
+ aTarget.Bottom() -= nDelta;
+ aTarget.Top() -= nDelta;
+
+ // too high?
+ if ( aTarget.Bottom() > aTotRect.Bottom() )
+ aTarget.Bottom() = aTotRect.Bottom();
+ }
+ }
+ else
+ aTarget = rTarget.GetIntersection( aTotRect );
+
+ // is the area already visible?
+ Rectangle aVisArea( GetVisibleArea() );
+ if ( aVisArea.IsInside(rTarget) )
+ return TRUE;
+
+ // is there somewhat to scroll?
+ if ( aVisArea.TopLeft() != aTarget.TopLeft() )
+ {
+ Rectangle aBox( aTarget.GetUnion(aVisArea) );
+ long nDeltaX = ( aBox.Right() - aVisArea.Right() ) +
+ ( aBox.Left() - aVisArea.Left() );
+ long nDeltaY = ( aBox.Top() - aVisArea.Top() ) +
+ ( aBox.Bottom() - aVisArea.Bottom() );
+ Scroll( nDeltaX, nDeltaY );
+ }
+
+ // determine if the target is completely visible
+ return aVisArea.GetWidth() >= aTarget.GetWidth() &&
+ aVisArea.GetHeight() >= aTarget.GetHeight();
+}
+
+//-------------------------------------------------------------------
+
+Rectangle ScrollableWindow::GetVisibleArea() const
+{
+ Point aTopLeft( PixelToLogic( Point() ) );
+ Size aSz( GetOutputSize() );
+ return Rectangle( aTopLeft, aSz );
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::SetLineSize( ULONG nHorz, ULONG nVert )
+{
+ Size aPixSz( LogicToPixel( Size(nHorz, nVert) ) );
+ nColumnPixW = aPixSz.Width();
+ nLinePixH = aPixSz.Height();
+ aVScroll.SetLineSize( nLinePixH );
+ aHScroll.SetLineSize( nColumnPixW );
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::Scroll( long nDeltaX, long nDeltaY )
+{
+ if ( !bScrolling )
+ StartScroll();
+
+ // get the delta in pixel
+ Size aDeltaPix( LogicToPixel( Size(nDeltaX, nDeltaY) ) );
+ Size aOutPixSz( GetOutputSizePixel() );
+ MapMode aMap( GetMapMode() );
+ Point aNewPixOffset( aPixOffset );
+
+ // scrolling horizontally?
+ if ( nDeltaX != 0 )
+ {
+ aNewPixOffset.X() -= aDeltaPix.Width();
+ if ( ( aOutPixSz.Width() - aNewPixOffset.X() ) > aTotPixSz.Width() )
+ aNewPixOffset.X() = - ( aTotPixSz.Width() - aOutPixSz.Width() );
+ else if ( aNewPixOffset.X() > 0 )
+ aNewPixOffset.X() = 0;
+ }
+
+ // scrolling vertically?
+ if ( nDeltaY != 0 )
+ {
+ aNewPixOffset.Y() -= aDeltaPix.Height();
+ if ( ( aOutPixSz.Height() - aNewPixOffset.Y() ) > aTotPixSz.Height() )
+ aNewPixOffset.Y() = - ( aTotPixSz.Height() - aOutPixSz.Height() );
+ else if ( aNewPixOffset.Y() > 0 )
+ aNewPixOffset.Y() = 0;
+ }
+
+ // recompute the logical scroll units
+ aDeltaPix.Width() = aPixOffset.X() - aNewPixOffset.X();
+ aDeltaPix.Height() = aPixOffset.Y() - aNewPixOffset.Y();
+ Size aDelta( PixelToLogic(aDeltaPix) );
+ nDeltaX = aDelta.Width();
+ nDeltaY = aDelta.Height();
+ aPixOffset = aNewPixOffset;
+
+ // scrolling?
+ if ( nDeltaX != 0 || nDeltaY != 0 )
+ {
+ Update();
+
+ // does the new area overlap the old one?
+ if ( Abs( (int)aDeltaPix.Height() ) < aOutPixSz.Height() ||
+ Abs( (int)aDeltaPix.Width() ) < aOutPixSz.Width() )
+ {
+ // scroll the overlapping area
+ SetMapMode( aMap );
+
+ // never scroll the scrollbars itself!
+ Window::Scroll(-nDeltaX, -nDeltaY,
+ PixelToLogic( Rectangle( Point(0, 0), aOutPixSz ) ) );
+ }
+ else
+ {
+ // repaint all
+ SetMapMode( aMap );
+ Invalidate();
+ }
+
+ Update();
+ }
+
+ if ( !bScrolling )
+ {
+ EndScroll( nDeltaX, nDeltaY );
+ if ( nDeltaX )
+ aHScroll.SetThumbPos( -aPixOffset.X() );
+ if ( nDeltaY )
+ aVScroll.SetThumbPos( -aPixOffset.Y() );
+ }
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::ScrollLines( long nLinesX, long nLinesY )
+{
+ Size aDelta( PixelToLogic( Size( nColumnPixW, nLinePixH ) ) );
+ Scroll( aDelta.Width()*nLinesX, aDelta.Height()*nLinesY );
+}
+
+//-------------------------------------------------------------------
+
+void ScrollableWindow::ScrollPages( long nPagesX, ULONG nOverlapX,
+ long nPagesY, ULONG nOverlapY )
+{
+ Size aOutSz( GetVisibleArea().GetSize() );
+ Scroll( nPagesX * aOutSz.Width() + (nPagesX>0 ? 1 : -1) * nOverlapX,
+ nPagesY * aOutSz.Height() + (nPagesY>0 ? 1 : -1) * nOverlapY );
+}
+
+
diff --git a/svtools/source/control/stdctrl.cxx b/svtools/source/control/stdctrl.cxx
new file mode 100644
index 000000000000..026a6642d209
--- /dev/null
+++ b/svtools/source/control/stdctrl.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdctrl.hxx>
+
+// =======================================================================
+
+FixedInfo::FixedInfo( Window* pParent, WinBits nWinStyle ) :
+ FixedText( pParent, nWinStyle | WB_INFO )
+{
+}
+
+// -----------------------------------------------------------------------
+
+FixedInfo::FixedInfo( Window* pParent, const ResId& rResId ) :
+ FixedText( pParent, rResId )
+{
+ SetStyle( GetStyle() | WB_INFO );
+}
diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx
new file mode 100644
index 000000000000..46707d960e3d
--- /dev/null
+++ b/svtools/source/control/stdmenu.cxx
@@ -0,0 +1,446 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdmenu.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef _APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#include <ctrltool.hxx>
+#include <stdmenu.hxx>
+
+// ========================================================================
+
+FontNameMenu::FontNameMenu()
+{
+ SetMenuFlags( GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS );
+}
+
+// -----------------------------------------------------------------------
+
+FontNameMenu::~FontNameMenu()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FontNameMenu::Select()
+{
+ maCurName = GetItemText( GetCurItemId() );
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void FontNameMenu::Highlight()
+{
+ XubString aTempName = maCurName;
+ maCurName = GetItemText( GetCurItemId() );
+ maHighlightHdl.Call( this );
+ maCurName = aTempName;
+}
+
+// -----------------------------------------------------------------------
+
+void FontNameMenu::Fill( const FontList* pList )
+{
+ // Menu loeschen
+ Clear();
+
+ // Fonts eintragen
+ International aIntn = Application::GetAppInternational();
+ USHORT nFontCount = pList->GetFontNameCount();
+ for ( USHORT i = 0; i < nFontCount; i++ )
+ {
+ const XubString& rName = pList->GetFontName( i ).GetName();
+
+ // Sortieren, nach der in der Applikation eingestellten
+ // International-Klasse
+ USHORT j = GetItemCount();
+ while ( j )
+ {
+ XubString aText = GetItemText( GetItemId( j-1 ) );
+ if ( aIntn.Compare( rName, aText ) == COMPARE_GREATER )
+ break;
+ j--;
+ }
+
+ InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, j );
+ }
+
+ SetCurName( maCurName );
+}
+
+// -----------------------------------------------------------------------
+
+void FontNameMenu::SetCurName( const XubString& rName )
+{
+ maCurName = rName;
+
+ // Menueintrag checken
+ USHORT nChecked = 0;
+ USHORT nItemCount = GetItemCount();
+ for( USHORT i = 0; i < nItemCount; i++ )
+ {
+ USHORT nItemId = GetItemId( i );
+
+ if ( IsItemChecked( nItemId ) )
+ nChecked = nItemId;
+
+ XubString aText = GetItemText( nItemId );
+ if ( aText == maCurName )
+ {
+ CheckItem( nItemId, TRUE );
+ return;
+ }
+ }
+
+ if ( nChecked )
+ CheckItem( nChecked, FALSE );
+}
+
+// ========================================================================
+
+FontStyleMenu::FontStyleMenu()
+{
+ SetMenuFlags( GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS );
+}
+
+// -----------------------------------------------------------------------
+
+FontStyleMenu::~FontStyleMenu()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FontStyleMenu::Select()
+{
+ USHORT nCurId = GetCurItemId();
+
+ if ( (nCurId >= FONTSTYLEMENU_FIRSTID) && (nCurId <= FONTSTYLEMENU_LASTID) )
+ {
+ maCurStyle = GetItemText( nCurId );
+ maSelectHdl.Call( this );
+ }
+ else
+ PopupMenu::Select();
+}
+
+// -----------------------------------------------------------------------
+
+void FontStyleMenu::Highlight()
+{
+ USHORT nCurId = GetCurItemId();
+
+ if ( (nCurId >= FONTSTYLEMENU_FIRSTID) && (nCurId <= FONTSTYLEMENU_LASTID) )
+ {
+ XubString aTempName = maCurStyle;
+ maCurStyle = GetItemText( nCurId );
+ maHighlightHdl.Call( this );
+ maCurStyle = aTempName;
+ }
+ else
+ PopupMenu::Highlight();
+}
+
+// -----------------------------------------------------------------------
+
+void FontStyleMenu::Fill( const XubString& rName, const FontList* pList )
+{
+ USHORT nItemId = GetItemId( 0 );
+ while ( (nItemId >= FONTSTYLEMENU_FIRSTID) &&
+ (nItemId <= FONTSTYLEMENU_LASTID) )
+ {
+ RemoveItem( 0 );
+ nItemId = GetItemId( 0 );
+ }
+
+ // Existiert ein Font mit diesem Namen
+ sal_Handle hFontInfo = pList->GetFirstFontInfo( rName );
+ if ( hFontInfo )
+ {
+ USHORT nPos = 0;
+ USHORT nId = FONTSTYLEMENU_FIRSTID;
+ BOOL bNormal = FALSE;
+ BOOL bItalic = FALSE;
+ BOOL bBold = FALSE;
+ BOOL bBoldItalic = FALSE;
+ FontInfo aInfo;
+ while ( hFontInfo )
+ {
+ aInfo = pList->GetFontInfo( hFontInfo );
+
+ XubString aStyleText = pList->GetStyleName( aInfo );
+ FontWeight eWeight = aInfo.GetWeight();
+ FontItalic eItalic = aInfo.GetItalic();
+ if ( eWeight <= WEIGHT_NORMAL )
+ {
+ bNormal = TRUE;
+ if ( eItalic != ITALIC_NONE )
+ bItalic = TRUE;
+ }
+ else
+ {
+ if ( eItalic != ITALIC_NONE )
+ bBoldItalic = TRUE;
+ else
+ bBold = TRUE;
+ }
+ if ( aStyleText == pList->GetItalicStr() )
+ bItalic = TRUE;
+ else if ( aStyleText == pList->GetBoldStr() )
+ bBold = TRUE;
+ else if ( aStyleText == pList->GetBoldItalicStr() )
+ bBoldItalic = TRUE;
+
+ InsertItem( nId, aStyleText,
+ MIB_RADIOCHECK | MIB_AUTOCHECK, nPos );
+ nPos++;
+ nId++;
+
+ hFontInfo = pList->GetNextFontInfo( hFontInfo );
+ }
+
+ // Bestimmte Styles als Nachbildung
+ if ( bNormal )
+ {
+ if ( !bItalic )
+ {
+ InsertItem( nId, pList->GetItalicStr(),
+ MIB_RADIOCHECK | MIB_AUTOCHECK, nPos );
+ nPos++;
+ nId++;
+ }
+ if ( !bBold )
+ {
+ InsertItem( nId, pList->GetBoldStr(),
+ MIB_RADIOCHECK | MIB_AUTOCHECK, nPos );
+ nPos++;
+ nId++;
+ }
+ }
+ if ( !bBoldItalic )
+ {
+ if ( bNormal || bItalic || bBold )
+ {
+ InsertItem( nId, pList->GetBoldItalicStr(),
+ MIB_RADIOCHECK | MIB_AUTOCHECK, nPos );
+ nPos++;
+ nId++;
+ }
+ }
+ }
+ else
+ {
+ // Wenn Font nicht, dann Standard-Styles einfuegen
+ InsertItem( FONTSTYLEMENU_FIRSTID, pList->GetNormalStr(),
+ MIB_RADIOCHECK | MIB_AUTOCHECK, 0 );
+ InsertItem( FONTSTYLEMENU_FIRSTID+1, pList->GetItalicStr(),
+ MIB_RADIOCHECK | MIB_AUTOCHECK, 0 );
+ InsertItem( FONTSTYLEMENU_FIRSTID+2, pList->GetBoldStr(),
+ MIB_RADIOCHECK | MIB_AUTOCHECK, 0 );
+ InsertItem( FONTSTYLEMENU_FIRSTID+3, pList->GetBoldItalicStr(),
+ MIB_RADIOCHECK | MIB_AUTOCHECK, 0 );
+ }
+
+ SetCurStyle( maCurStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void FontStyleMenu::SetCurStyle( const XubString& rStyle )
+{
+ maCurStyle = rStyle;
+
+ // Menueintrag checken
+ USHORT nChecked = 0;
+ USHORT nItemCount = GetItemCount();
+ for( USHORT i = 0; i < nItemCount; i++ )
+ {
+ USHORT nItemId = GetItemId( i );
+
+ if ( (nItemId < FONTSTYLEMENU_FIRSTID) ||
+ (nItemId > FONTSTYLEMENU_LASTID) )
+ break;
+
+ if ( IsItemChecked( nItemId ) )
+ nChecked = nItemId;
+
+ XubString aText = GetItemText( nItemId );
+ if ( aText == maCurStyle )
+ {
+ CheckItem( nItemId, TRUE );
+ return;
+ }
+ }
+
+ if ( nChecked )
+ CheckItem( nChecked, FALSE );
+}
+
+// ========================================================================
+
+FontSizeMenu::FontSizeMenu() :
+ maIntn( Application::GetAppInternational() )
+{
+ mpHeightAry = NULL;
+
+ maIntn.SetNumTrailingZeros( FALSE );
+ maIntn.SetNumDigits( 1 );
+
+ SetMenuFlags( GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS );
+}
+
+// -----------------------------------------------------------------------
+
+FontSizeMenu::~FontSizeMenu()
+{
+ if ( mpHeightAry )
+ delete mpHeightAry;
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeMenu::Select()
+{
+ mnCurHeight = mpHeightAry[GetCurItemId()-1];
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeMenu::Highlight()
+{
+ long nTempHeight = mnCurHeight;
+ USHORT nCurItemId = GetCurItemId();
+ if ( !nCurItemId )
+ mnCurHeight = 0;
+ else
+ mnCurHeight = mpHeightAry[nCurItemId-1];
+ maHighlightHdl.Call( this );
+ mnCurHeight = nTempHeight;
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeMenu::Fill( const FontInfo& rInfo, const FontList* pList )
+{
+ // Menu loeschen
+ Clear();
+
+ // Groessen ermitteln
+ const long* pAry = pList->GetSizeAry( rInfo );
+
+ // Array kopieren
+ if ( mpHeightAry )
+ delete mpHeightAry;
+ USHORT n = 0;
+ while ( pAry[n] )
+ n++;
+ mpHeightAry = new long[n];
+ memcpy( mpHeightAry, pAry, n*sizeof(long) );
+
+ // Groessen einfuegen
+ USHORT nId = 1;
+ while ( *pAry )
+ {
+ InsertItem( nId, maIntn.GetNum( *pAry ),
+ MIB_RADIOCHECK | MIB_AUTOCHECK );
+ nId++;
+ pAry++;
+ }
+
+ SetCurHeight( mnCurHeight );
+}
+
+// -----------------------------------------------------------------------
+
+void FontSizeMenu::SetCurHeight( long nHeight )
+{
+ mnCurHeight = nHeight;
+
+ // Menueintrag checken
+ XubString aHeight = maIntn.GetNum( nHeight );
+ USHORT nChecked = 0;
+ USHORT nItemCount = GetItemCount();
+ for( USHORT i = 0; i < nItemCount; i++ )
+ {
+ USHORT nItemId = GetItemId( i );
+
+ if ( IsItemChecked( nItemId ) )
+ nChecked = nItemId;
+
+ XubString aText = GetItemText( nItemId );
+ if ( aText == aHeight )
+ {
+ CheckItem( nItemId, TRUE );
+ return;
+ }
+ }
+
+ if ( nChecked )
+ CheckItem( nChecked, FALSE );
+}
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
new file mode 100644
index 000000000000..eaa4fee223e8
--- /dev/null
+++ b/svtools/source/control/tabbar.cxx
@@ -0,0 +1,2588 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabbar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_TIME_HXX
+#include <tools/time.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _VCL_POLY_HXX
+#include <vcl/poly.hxx>
+#endif
+#ifndef _VCL_APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _VCL_HELP_HXX
+#include <vcl/help.hxx>
+#endif
+#ifndef _VCL_DECOVIEW_HXX
+#include <vcl/decoview.hxx>
+#endif
+#ifndef _VCL_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _VCL_EDIT_HXX
+#include <vcl/edit.hxx>
+#endif
+
+#define _SV_TABBAR_CXX
+#define private public
+#include <tabbar.hxx>
+
+// =======================================================================
+
+#define TABBAR_OFFSET_X 7
+#define TABBAR_OFFSET_X2 2
+#define TABBAR_DRAG_SCROLLOFF 5
+#define TABBAR_MINSIZE 5
+
+// =======================================================================
+
+struct ImplTabBarItem
+{
+ USHORT mnId;
+ TabBarPageBits mnBits;
+ XubString maText;
+ XubString maHelpText;
+ Rectangle maRect;
+ long mnWidth;
+ ULONG mnHelpId;
+ BOOL mbShort;
+ BOOL mbSelect;
+ BOOL mbEnable;
+
+ ImplTabBarItem( USHORT nItemId, const XubString& rText,
+ TabBarPageBits nPageBits ) :
+ maText( rText )
+ {
+ mnId = nItemId;
+ mnBits = nPageBits;
+ mnWidth = 0;
+ mnHelpId = 0;
+ mbShort = FALSE;
+ mbSelect = FALSE;
+ mbEnable = TRUE;
+ }
+};
+
+DECLARE_LIST( ImplTabBarList, ImplTabBarItem* );
+
+// =======================================================================
+
+// -----------------
+// - ImplTabButton -
+// -----------------
+
+class ImplTabButton : public PushButton
+{
+public:
+ ImplTabButton( TabBar* pParent, WinBits nWinStyle = 0 ) :
+ PushButton( pParent, nWinStyle | WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOLIGHTBORDER | WB_NOPOINTERFOCUS ) {}
+
+ TabBar* GetParent() const { return (TabBar*)Window::GetParent(); }
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual BOOL QueryDrop( const DropEvent& rDEvt );
+ virtual BOOL Drop( const DropEvent& rEvt );
+};
+
+// =======================================================================
+
+long ImplTabButton::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
+ {
+ if ( GetParent()->IsInEditMode() )
+ {
+ GetParent()->EndEditMode();
+ return TRUE;
+ }
+ }
+
+ return PushButton::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplTabButton::QueryDrop( const DropEvent& rDEvt )
+{
+ TabBar* pParent = GetParent();
+ Point aPos = OutputToScreenPixel( rDEvt.GetPosPixel() );
+ aPos = pParent->ScreenToOutputPixel( aPos );
+ BYTE nWindowType = rDEvt.GetWindowType();
+ if ( rDEvt.IsLeaveWindow() )
+ {
+ Size aWinSize = pParent->GetSizePixel();
+ if ( ((aPos.X() >= 0) && (aPos.X() < aWinSize.Width())) &&
+ ((aPos.Y() >= 0) && (aPos.Y() < aWinSize.Height())) )
+ nWindowType = 0;
+ }
+ DropEvent aNewDEvt( aPos, rDEvt.GetData(), rDEvt.GetAction(), nWindowType );
+ return pParent->QueryDrop( aNewDEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplTabButton::Drop( const DropEvent& rDEvt )
+{
+ TabBar* pParent = GetParent();
+ Point aPos = OutputToScreenPixel( rDEvt.GetPosPixel() );
+ aPos = pParent->ScreenToOutputPixel( aPos );
+ DropEvent aNewDEvt( aPos, rDEvt.GetData(), rDEvt.GetAction(), rDEvt.GetWindowType() );
+ return pParent->Drop( aNewDEvt );
+}
+
+// =======================================================================
+
+// ----------------
+// - ImplTabSizer -
+// ----------------
+
+class ImplTabSizer : public Window
+{
+private:
+ Point maStartPos;
+ long mnOff;
+
+public:
+ ImplTabSizer( TabBar* pParent, WinBits nWinStyle = 0 );
+
+ TabBar* GetParent() const { return (TabBar*)Window::GetParent(); }
+ void ImplTrack( const Point& rMousePos );
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Tracking( const TrackingEvent& rTEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual BOOL QueryDrop( const DropEvent& rDEvt );
+ virtual BOOL Drop( const DropEvent& rEvt );
+};
+
+// -----------------------------------------------------------------------
+
+ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle ) :
+ Window( pParent, nWinStyle & WB_3DLOOK )
+{
+ SetPointer( Pointer( POINTER_HSIZEBAR ) );
+ SetSizePixel( Size( 7, 0 ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTabSizer::ImplTrack( const Point& rMousePos )
+{
+ TabBar* pParent = GetParent();
+ Point aWinPos = pParent->GetPosPixel();
+ Size aWinSize = GetSizePixel();
+
+ aWinPos = pParent->GetParent()->OutputToScreenPixel( aWinPos );
+ pParent->mnSplitSize = rMousePos.X() - aWinPos.X() + (aWinSize.Width()-mnOff);
+ if ( pParent->mnSplitSize < TABBAR_MINSIZE )
+ pParent->mnSplitSize = TABBAR_MINSIZE;
+ pParent->Split();
+ pParent->Update();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTabSizer::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( GetParent()->IsInEditMode() )
+ {
+ GetParent()->EndEditMode();
+ return;
+ }
+
+ if ( rMEvt.IsLeft() )
+ {
+ Point aMousePos = rMEvt.GetPosPixel();
+ maStartPos = OutputToScreenPixel( aMousePos );
+ mnOff = aMousePos.X();
+ StartTracking();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTabSizer::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( rTEvt.IsTrackingCanceled() )
+ ImplTrack( maStartPos );
+ GetParent()->mnSplitSize = 0;
+ }
+ else
+ ImplTrack( OutputToScreenPixel( rTEvt.GetMouseEvent().GetPosPixel() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTabSizer::Paint( const Rectangle& )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ DecorationView aDecoView( this );
+ long nOffX = 0;
+ Size aOutputSize = GetOutputSizePixel();
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ DrawLine( Point( 0, 0 ), Point( 0, aOutputSize.Height()-1 ) );
+ nOffX++;
+ aOutputSize.Width()--;
+ }
+ aDecoView.DrawButton( Rectangle( Point( nOffX, 0 ), aOutputSize ), BUTTON_DRAW_NOLIGHTBORDER );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplTabSizer::QueryDrop( const DropEvent& rDEvt )
+{
+ TabBar* pParent = GetParent();
+ Point aPos = OutputToScreenPixel( rDEvt.GetPosPixel() );
+ aPos = pParent->ScreenToOutputPixel( aPos );
+ BYTE nWindowType = rDEvt.GetWindowType();
+ if ( rDEvt.IsLeaveWindow() )
+ {
+ Size aWinSize = pParent->GetSizePixel();
+ if ( ((aPos.X() >= 0) && (aPos.X() < aWinSize.Width())) &&
+ ((aPos.Y() >= 0) && (aPos.Y() < aWinSize.Height())) )
+ nWindowType = 0;
+ }
+ DropEvent aNewDEvt( aPos, rDEvt.GetData(), rDEvt.GetAction(), nWindowType );
+ return pParent->QueryDrop( aNewDEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplTabSizer::Drop( const DropEvent& rDEvt )
+{
+ TabBar* pParent = GetParent();
+ Point aPos = OutputToScreenPixel( rDEvt.GetPosPixel() );
+ aPos = pParent->ScreenToOutputPixel( aPos );
+ DropEvent aNewDEvt( aPos, rDEvt.GetData(), rDEvt.GetAction(), rDEvt.GetWindowType() );
+ return pParent->Drop( aNewDEvt );
+}
+
+// =======================================================================
+
+// Heisst nicht Impl, da evtl. mal von aussen benutz- und ueberladbar
+
+// --------------
+// - TabBarEdit -
+// --------------
+
+class TabBarEdit : public Edit
+{
+private:
+ Timer maLoseFocusTimer;
+ BOOL mbPostEvt;
+
+ DECL_LINK( ImplEndEditHdl, void* );
+ DECL_LINK( ImplEndTimerHdl, void* );
+
+public:
+ TabBarEdit( TabBar* pParent, WinBits nWinStyle = 0 );
+
+ TabBar* GetParent() const { return (TabBar*)Window::GetParent(); }
+
+ void SetPostEvent() { mbPostEvt = TRUE; }
+ void ResetPostEvent() { mbPostEvt = FALSE; }
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void LoseFocus();
+};
+
+// -----------------------------------------------------------------------
+
+TabBarEdit::TabBarEdit( TabBar* pParent, WinBits nWinStyle ) :
+ Edit( pParent, nWinStyle )
+{
+ mbPostEvt = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+long TabBarEdit::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ if ( !pKEvt->GetKeyCode().GetModifier() )
+ {
+ if ( pKEvt->GetKeyCode().GetCode() == KEY_RETURN )
+ {
+ if ( !mbPostEvt )
+ {
+ if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), (void*)FALSE ) )
+ mbPostEvt = TRUE;
+ }
+ return TRUE;
+ }
+ else if ( pKEvt->GetKeyCode().GetCode() == KEY_ESCAPE )
+ {
+ if ( !mbPostEvt )
+ {
+ if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), (void*)TRUE ) )
+ mbPostEvt = TRUE;
+ }
+ return TRUE;
+ }
+ }
+ }
+
+ return Edit::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBarEdit::LoseFocus()
+{
+ if ( !mbPostEvt )
+ {
+ if ( PostUserEvent( LINK( this, TabBarEdit, ImplEndEditHdl ), (void*)FALSE ) )
+ mbPostEvt = TRUE;
+ }
+
+ Edit::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( TabBarEdit, ImplEndEditHdl, void*, pCancel )
+{
+ ResetPostEvent();
+ maLoseFocusTimer.Stop();
+
+ // We need this query, because the edit get a losefous event,
+ // when it shows the context menu or the insert symbol dialog
+ if ( !HasFocus() && HasChildPathFocus( TRUE ) )
+ {
+ maLoseFocusTimer.SetTimeout( 30 );
+ maLoseFocusTimer.SetTimeoutHdl( LINK( this, TabBarEdit, ImplEndTimerHdl ) );
+ maLoseFocusTimer.Start();
+ }
+ else
+ GetParent()->EndEditMode( pCancel != 0 );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( TabBarEdit, ImplEndTimerHdl, void*, pCancel )
+{
+ if ( HasFocus() )
+ return 0;
+
+ // We need this query, because the edit get a losefous event,
+ // when it shows the context menu or the insert symbol dialog
+ if ( HasChildPathFocus( TRUE ) )
+ maLoseFocusTimer.Start();
+ else
+ GetParent()->EndEditMode( TRUE );
+
+ return 0;
+}
+
+// =======================================================================
+
+void TabBar::ImplInit( WinBits nWinStyle )
+{
+ mpItemList = new ImplTabBarList;
+ mpFirstBtn = NULL;
+ mpPrevBtn = NULL;
+ mpNextBtn = NULL;
+ mpLastBtn = NULL;
+ mpSizer = NULL;
+ mpEdit = NULL;
+ mnMaxPageWidth = 0;
+ mnCurMaxWidth = 0;
+ mnOffX = 0;
+ mnOffY = 0;
+ mnOutWidth = 0;
+ mnSplitSize = 0;
+ mnSwitchTime = 0;
+ mnWinStyle = nWinStyle;
+ mnCurPageId = 0;
+ mnFirstPos = 0;
+ mnDropPos = 0;
+ mnSwitchId = 0;
+ mnEditId = 0;
+ mbFormat = TRUE;
+ mbFirstFormat = TRUE;
+ mbSizeFormat = TRUE;
+ mbAutoMaxWidth = TRUE;
+ mbInSwitching = FALSE;
+ mbAutoEditMode = FALSE;
+ mbEditCanceled = FALSE;
+ mbDropPos = FALSE;
+ mbInSelect = FALSE;
+ mbSelColor = FALSE;
+ mbSelTextColor = FALSE;
+
+ if ( nWinStyle & WB_3DTAB )
+ mnOffY++;
+
+ if ( nWinStyle & WB_DRAG )
+ EnableDrop();
+
+ ImplInitControls();
+ ImplInitSettings( TRUE, TRUE );
+ SetSizePixel( Size( 100, CalcWindowSizePixel().Height() ) );
+}
+
+// -----------------------------------------------------------------------
+
+TabBar::TabBar( Window* pParent, WinBits nWinStyle ) :
+ Window( pParent, (nWinStyle & WB_3DLOOK) | WB_CLIPCHILDREN )
+{
+ ImplInit( nWinStyle );
+}
+
+// -----------------------------------------------------------------------
+
+TabBar::~TabBar()
+{
+ EndEditMode( TRUE );
+
+ // Controls loeschen
+ if ( mpPrevBtn )
+ delete mpPrevBtn;
+ if ( mpNextBtn )
+ delete mpNextBtn;
+ if ( mpFirstBtn )
+ delete mpFirstBtn;
+ if ( mpLastBtn )
+ delete mpLastBtn;
+ if ( mpSizer )
+ delete mpSizer;
+
+ // Alle Items loeschen
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Itemlist loeschen
+ delete mpItemList;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::ImplInitSettings( BOOL bFont, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont;
+ aFont = rStyleSettings.GetToolFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ aFont.SetWeight( WEIGHT_BOLD );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bBackground )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else
+ aColor = rStyleSettings.GetFaceColor();
+ SetBackground( aColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::ImplGetColors( Color& rFaceColor, Color& rFaceTextColor,
+ Color& rSelectColor, Color& rSelectTextColor )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( IsControlBackground() )
+ rFaceColor = GetControlBackground();
+ else
+ rFaceColor = rStyleSettings.GetFaceColor();
+ if ( IsControlForeground() )
+ rFaceTextColor = GetControlForeground();
+ else
+ rFaceTextColor = rStyleSettings.GetButtonTextColor();
+ if ( mbSelColor )
+ rSelectColor = maSelColor;
+ else
+ rSelectColor = rStyleSettings.GetWindowColor();
+ if ( mbSelTextColor )
+ rSelectTextColor = maSelTextColor;
+ else
+ rSelectTextColor = rStyleSettings.GetWindowTextColor();
+
+ // Bei 3D-Tabs wird Selektions- und Face-Farbe umgedreht, da die
+ // selektierten Tabs in 3D erscheinen sollen
+ if ( mnWinStyle & WB_3DTAB )
+ {
+ Color aTempColor = rFaceColor;
+ rFaceColor = rSelectColor;
+ rSelectColor = aTempColor;
+ aTempColor = rFaceTextColor;
+ rFaceTextColor = rSelectTextColor;
+ rSelectTextColor = rFaceTextColor;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TabBar::ImplCalcWidth()
+{
+ // Groessen muessen nur ermittelt werden, wenn sich Text aendert oder
+ // wenn der Font geaendert wurde
+ if ( !mbSizeFormat )
+ return FALSE;
+
+ // Breiten der Tabs mit dem fetten Font ermitteln
+ Font aFont = GetFont();
+ if ( aFont.GetWeight() != WEIGHT_BOLD )
+ {
+ aFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aFont );
+ }
+
+ if ( mnMaxPageWidth )
+ mnCurMaxWidth = mnMaxPageWidth;
+ else if ( mbAutoMaxWidth )
+ {
+ mnCurMaxWidth = mnOutWidth-mnOffX-
+ TABBAR_OFFSET_X-TABBAR_OFFSET_X-
+ TABBAR_OFFSET_X2-TABBAR_OFFSET_X2-TABBAR_OFFSET_X2;
+ if ( mnCurMaxWidth < 1 )
+ mnCurMaxWidth = 1;
+ }
+ else
+ mnCurMaxWidth = 0;
+
+ BOOL bChanged = FALSE;
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ long nNewWidth = GetTextWidth( pItem->maText );
+ if ( mnCurMaxWidth && (nNewWidth > mnCurMaxWidth) )
+ {
+ pItem->mbShort = TRUE;
+ nNewWidth = mnCurMaxWidth;
+ }
+ else
+ pItem->mbShort = FALSE;
+ nNewWidth += TABBAR_OFFSET_X+TABBAR_OFFSET_X2;
+ if ( pItem->mnWidth != nNewWidth )
+ {
+ pItem->mnWidth = nNewWidth;
+ if ( !pItem->maRect.IsEmpty() )
+ bChanged = TRUE;
+ }
+ pItem = mpItemList->Next();
+ }
+ mbSizeFormat = FALSE;
+ mbFormat = TRUE;
+ return bChanged;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::ImplFormat()
+{
+ ImplCalcWidth();
+
+ if ( !mbFormat )
+ return;
+
+ USHORT n = 0;
+ long x = mnOffX;
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Bei allen nicht sichtbaren Tabs, wird ein leeres Rechteck
+ // gesetzt
+ if ( (n+1 < mnFirstPos) || (x > mnOutWidth) )
+ pItem->maRect.SetEmpty();
+ else
+ {
+ // Etwas von der Tab vor der ersten sichtbaren Page
+ // muss auch zu sehen sein
+ if ( n+1 == mnFirstPos )
+ pItem->maRect.Left() = x-pItem->mnWidth;
+ else
+ {
+ pItem->maRect.Left() = x;
+ x += pItem->mnWidth;
+ }
+ pItem->maRect.Right() = x+TABBAR_OFFSET_X+TABBAR_OFFSET_X2;
+ pItem->maRect.Bottom() = maWinSize.Height()-1;
+ }
+
+ n++;
+ pItem = mpItemList->Next();
+ }
+
+ mbFormat = FALSE;
+
+ // Button enablen/disablen
+ ImplEnableControls();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::ImplGetLastFirstPos()
+{
+ USHORT nCount = (USHORT)(mpItemList->Count());
+ if ( !nCount || mbSizeFormat || mbFormat )
+ return 0;
+
+ USHORT nLastFirstPos = nCount-1;
+ long nWinWidth = mnOutWidth-mnOffX-TABBAR_OFFSET_X;
+ long nWidth = mpItemList->GetObject( nLastFirstPos )->mnWidth;
+ while ( nLastFirstPos && (nWidth < nWinWidth) )
+ {
+ nLastFirstPos--;
+ nWidth += mpItemList->GetObject( nLastFirstPos )->mnWidth;
+ }
+ if ( (nLastFirstPos != (USHORT)(mpItemList->Count()-1)) &&
+ (nWidth > nWinWidth) )
+ nLastFirstPos++;
+ return nLastFirstPos;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::ImplInitControls()
+{
+ if ( mnWinStyle & WB_SIZEABLE )
+ {
+ if ( !mpSizer )
+ mpSizer = new ImplTabSizer( this, mnWinStyle & (WB_DRAG | WB_3DLOOK) );
+ mpSizer->Show();
+
+ if ( mnWinStyle & WB_DRAG )
+ mpSizer->EnableDrop();
+ }
+ else
+ {
+ if ( mpSizer )
+ {
+ delete mpSizer;
+ mpSizer = NULL;
+ }
+ }
+
+ Link aLink = LINK( this, TabBar, ImplClickHdl );
+
+ if ( mnWinStyle & (WB_MINSCROLL | WB_SCROLL) )
+ {
+ if ( !mpPrevBtn )
+ {
+ mpPrevBtn = new ImplTabButton( this, WB_REPEAT );
+ mpPrevBtn->SetSymbol( SYMBOL_PREV );
+ mpPrevBtn->SetClickHdl( aLink );
+ if ( mnWinStyle & WB_DRAG )
+ mpPrevBtn->EnableDrop();
+ }
+ mpPrevBtn->Show();
+
+ if ( !mpNextBtn )
+ {
+ mpNextBtn = new ImplTabButton( this, WB_REPEAT );
+ mpNextBtn->SetSymbol( SYMBOL_NEXT );
+ mpNextBtn->SetClickHdl( aLink );
+ if ( mnWinStyle & WB_DRAG )
+ mpNextBtn->EnableDrop();
+ }
+ mpNextBtn->Show();
+ }
+ else
+ {
+ if ( mpPrevBtn )
+ {
+ delete mpPrevBtn;
+ mpPrevBtn = NULL;
+ }
+ if ( mpNextBtn )
+ {
+ delete mpNextBtn;
+ mpNextBtn = NULL;
+ }
+ }
+
+ if ( mnWinStyle & WB_SCROLL )
+ {
+ if ( !mpFirstBtn )
+ {
+ mpFirstBtn = new ImplTabButton( this );
+ mpFirstBtn->SetSymbol( SYMBOL_FIRST );
+ mpFirstBtn->SetClickHdl( aLink );
+ if ( mnWinStyle & WB_DRAG )
+ mpFirstBtn->EnableDrop();
+ }
+ mpFirstBtn->Show();
+
+ if ( !mpLastBtn )
+ {
+ mpLastBtn = new ImplTabButton( this );
+ mpLastBtn->SetSymbol( SYMBOL_LAST );
+ mpLastBtn->SetClickHdl( aLink );
+ if ( mnWinStyle & WB_DRAG )
+ mpLastBtn->EnableDrop();
+ }
+ mpLastBtn->Show();
+ }
+ else
+ {
+ if ( mpFirstBtn )
+ {
+ delete mpFirstBtn;
+ mpFirstBtn = NULL;
+ }
+ if ( mpLastBtn )
+ {
+ delete mpLastBtn;
+ mpLastBtn = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::ImplEnableControls()
+{
+ if ( mbSizeFormat || mbFormat )
+ return;
+
+ // Buttons enablen/disblen
+ BOOL bEnableBtn = mnFirstPos > 0;
+ if ( mpFirstBtn )
+ mpFirstBtn->Enable( bEnableBtn );
+ if ( mpPrevBtn )
+ mpPrevBtn->Enable( bEnableBtn );
+
+ bEnableBtn = mnFirstPos < ImplGetLastFirstPos();
+ if ( mpNextBtn )
+ mpNextBtn->Enable( bEnableBtn );
+ if ( mpLastBtn )
+ mpLastBtn->Enable( bEnableBtn );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::ImplShowPage( USHORT nPos )
+{
+ // Breite berechnen
+ long nWidth = GetOutputSizePixel().Width();
+ if ( nWidth >= TABBAR_OFFSET_X )
+ nWidth -= TABBAR_OFFSET_X;
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+ if ( nPos < mnFirstPos )
+ SetFirstPageId( pItem->mnId );
+ else if ( pItem->maRect.Right() > nWidth )
+ {
+ while ( pItem->maRect.Right() > nWidth )
+ {
+ USHORT nNewPos = mnFirstPos+1;
+ SetFirstPageId( GetPageId( nNewPos ) );
+ ImplFormat();
+ if ( nNewPos != mnFirstPos )
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( TabBar, ImplClickHdl, ImplTabButton*, pBtn )
+{
+ EndEditMode();
+
+ USHORT nNewPos = mnFirstPos;
+
+ if ( pBtn == mpFirstBtn )
+ nNewPos = 0;
+ else if ( pBtn == mpPrevBtn )
+ {
+ if ( mnFirstPos )
+ nNewPos = mnFirstPos-1;
+ }
+ else if ( pBtn == mpNextBtn )
+ {
+ USHORT nCount = GetPageCount();
+ if ( mnFirstPos < nCount )
+ nNewPos = mnFirstPos+1;
+ }
+ else
+ {
+ USHORT nCount = GetPageCount();
+ if ( nCount )
+ nNewPos = nCount-1;
+ }
+
+ if ( nNewPos != mnFirstPos )
+ SetFirstPageId( GetPageId( nNewPos ) );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeaveWindow() )
+ mbInSelect = FALSE;
+
+ Window::MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // Bei Klick in unser Fenster EditModus nur beenden und Klick nicht
+ // ausfuehren
+ if ( IsInEditMode() )
+ {
+ EndEditMode();
+ return;
+ }
+
+ if ( !rMEvt.IsLeft() )
+ {
+ Window::MouseButtonDown( rMEvt );
+ return;
+ }
+
+ ImplTabBarItem* pItem;
+ USHORT nSelId = GetPageId( rMEvt.GetPosPixel() );
+
+ if ( rMEvt.IsMod2() && mbAutoEditMode && nSelId )
+ {
+ if ( StartEditMode( nSelId ) )
+ return;
+ }
+
+ if ( (rMEvt.GetMode() & (MOUSE_MULTISELECT | MOUSE_RANGESELECT)) && (rMEvt.GetClicks() == 1) )
+ {
+ if ( nSelId )
+ {
+ USHORT nPos = GetPagePos( nSelId );
+ BOOL bSelectTab = FALSE;
+ pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem->mbEnable )
+ {
+ if ( (rMEvt.GetMode() & MOUSE_MULTISELECT) && (mnWinStyle & WB_MULTISELECT) )
+ {
+ if ( nSelId != mnCurPageId )
+ {
+ SelectPage( nSelId, !IsPageSelected( nSelId ) );
+ bSelectTab = TRUE;
+ }
+ }
+ else if ( mnWinStyle & (WB_MULTISELECT | WB_RANGESELECT) )
+ {
+ bSelectTab = TRUE;
+ USHORT n;
+ BOOL bSelect;
+ USHORT nCurPos = GetPagePos( mnCurPageId );
+ if ( nPos <= nCurPos )
+ {
+ // Alle Tabs bis zur angeklickten Tab deselektieren
+ // und alle Tabs von der angeklickten Tab bis
+ // zur aktuellen Position selektieren
+ n = 0;
+ while ( n < nCurPos )
+ {
+ pItem = mpItemList->GetObject( n );
+ if ( n < nPos )
+ bSelect = FALSE;
+ else
+ bSelect = TRUE;
+
+ if ( pItem->mbSelect != bSelect )
+ {
+ pItem->mbSelect = bSelect;
+ if ( !pItem->maRect.IsEmpty() )
+ Invalidate( pItem->maRect );
+ }
+
+ n++;
+ }
+ }
+
+ if ( nPos >= nCurPos )
+ {
+ // Alle Tabs von der aktuellen bis zur angeklickten
+ // Tab selektieren und alle Tabs von der angeklickten
+ // Tab bis zur letzten Tab deselektieren
+ USHORT nCount = (USHORT)mpItemList->Count();
+ n = nCurPos;
+ while ( n < nCount )
+ {
+ pItem = mpItemList->GetObject( n );
+
+ if ( n <= nPos )
+ bSelect = TRUE;
+ else
+ bSelect = FALSE;
+
+ if ( pItem->mbSelect != bSelect )
+ {
+ pItem->mbSelect = bSelect;
+ if ( !pItem->maRect.IsEmpty() )
+ Invalidate( pItem->maRect );
+ }
+
+ n++;
+ }
+ }
+ }
+
+ // Gegebenenfalls muss die selektierte Tab gescrollt werden
+ if ( bSelectTab )
+ {
+ ImplShowPage( nPos );
+ Update();
+ Select();
+ }
+ }
+ else
+ ImplShowPage( nPos );
+ mbInSelect = TRUE;
+
+ return;
+ }
+ }
+ else if ( rMEvt.GetClicks() == 2 )
+ {
+ // Gegebenenfalls den Double-Click-Handler rufen
+ if ( !rMEvt.GetModifier() && (!nSelId || (nSelId == mnCurPageId)) )
+ {
+ USHORT nOldCurId = mnCurPageId;
+ mnCurPageId = nSelId;
+ DoubleClick();
+ // Abfrage, da im DoubleClick-Handler die aktuelle Seite
+ // umgeschaltet werden konnte
+ if ( mnCurPageId == nSelId )
+ mnCurPageId = nOldCurId;
+ }
+
+ return;
+ }
+ else
+ {
+ if ( nSelId )
+ {
+ // Nur Select ausfuehren, wenn noch nicht aktuelle Page
+ if ( nSelId != mnCurPageId )
+ {
+ USHORT nPos = GetPagePos( nSelId );
+ pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem->mbEnable )
+ {
+ if ( !pItem->mbSelect )
+ {
+ // Muss invalidiert werden
+ BOOL bUpdate = FALSE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ bUpdate = TRUE;
+
+ // Alle selektierten Items deselektieren
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) )
+ {
+ pItem->mbSelect = FALSE;
+ if ( bUpdate )
+ Invalidate( pItem->maRect );
+ }
+
+ pItem = mpItemList->Next();
+ }
+ }
+
+ if ( DeactivatePage() )
+ {
+ SetCurPageId( nSelId );
+ Update();
+ ActivatePage();
+ Select();
+ }
+ }
+ else
+ ImplShowPage( nPos );
+ mbInSelect = TRUE;
+ }
+
+ return;
+ }
+ }
+
+ Window::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ mbInSelect = FALSE;
+ Window::MouseButtonUp( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::Paint( const Rectangle& )
+{
+ // Items berechnen und ausgeben
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+ ImplTabBarItem* pItem;
+
+ // kein Item, dann auch nichts zu tun
+ if ( nItemCount )
+ {
+ // TabBar muss formatiert sein
+ ImplFormat();
+
+ // Beim ersten Format auch dafuer sorgen, das aktuelle TabPage
+ // sichtbar wird
+ if ( mbFirstFormat )
+ {
+ mbFirstFormat = FALSE;
+
+ if ( mnCurPageId && (mnFirstPos == 0) && !mbDropPos )
+ {
+ pItem = mpItemList->GetObject( GetPagePos( mnCurPageId ) );
+ if ( pItem->maRect.IsEmpty() )
+ {
+ // mbDropPos setzen (bzw. misbrauchen) um Invalidate()
+ // zu unterbinden
+ mbDropPos = TRUE;
+ SetFirstPageId( mnCurPageId );
+ mbDropPos = FALSE;
+ if ( mnFirstPos != 0 )
+ ImplFormat();
+ }
+ }
+ }
+ }
+
+ // Farben ermitteln
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Color aFaceColor;
+ Color aSelectColor;
+ Color aFaceTextColor;
+ Color aSelectTextColor;
+ ImplGetColors( aFaceColor, aFaceTextColor, aSelectColor, aSelectTextColor );
+
+ // Font selektieren
+ Font aFont = GetFont();
+ Font aLightFont = aFont;
+ aLightFont.SetWeight( WEIGHT_LIGHT );
+
+ // Bei Border oben und unten einen Strich extra malen
+ if ( (mnWinStyle & WB_BORDER) || (mnWinStyle & WB_TOPBORDER) )
+ {
+ Size aOutputSize = GetOutputSizePixel();
+
+ // Bei 3D-Tabs wird auch der Border in 3D gemalt
+ if ( mnWinStyle & WB_3DTAB )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( mnOffX, 0 ), Point( aOutputSize.Width(), 0 ) );
+ }
+
+ // Border malen (Strich oben und Strich unten)
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ DrawLine( Point( mnOffX, mnOffY ), Point( aOutputSize.Width()-1, mnOffY ) );
+ }
+ else
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+
+ // Items ausgeben
+ if ( nItemCount )
+ {
+ // letzten sichtbaren Eintrag suchen
+ USHORT n = mnFirstPos+1;
+ if ( n >= nItemCount )
+ n = nItemCount-1;
+ pItem = mpItemList->Seek( n );
+ while ( pItem )
+ {
+ if ( !pItem->maRect.IsEmpty() )
+ {
+ n++;
+ pItem = mpItemList->Next();
+ }
+ else
+ break;
+ }
+
+ // Alle Tabs ausgeben (von hinten nach vorn und aktuellen zuletzt)
+ if ( pItem )
+ n--;
+ else if ( n >= nItemCount )
+ n = nItemCount-1;
+ pItem = mpItemList->Seek( n );
+ ImplTabBarItem* pCurItem = NULL;
+ while ( pItem )
+ {
+ // CurrentItem als letztes ausgeben, da es alle anderen ueberdeckt
+ if ( !pCurItem && (pItem->mnId == mnCurPageId) )
+ {
+ pCurItem = pItem;
+ pItem = mpItemList->Prev();
+ if ( !pItem )
+ pItem = pCurItem;
+ continue;
+ }
+
+ if ( !pItem->maRect.IsEmpty() )
+ {
+ Rectangle aRect = pItem->maRect;
+
+ // Aktuelle Page wird mit einem fetten Font ausgegeben
+ if ( pItem->mnId == mnCurPageId )
+ SetFont( aFont );
+ else
+ SetFont( aLightFont );
+
+ // Je nach Status die richtige FillInBrush setzen
+ if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) )
+ {
+ SetFillColor( aSelectColor );
+ SetTextColor( aSelectTextColor );
+ }
+ else
+ {
+ SetFillColor( aFaceColor );
+ SetTextColor( aFaceTextColor );
+ }
+
+ // Muss Font Kursiv geschaltet werden
+ if ( pItem->mnBits & TPB_SPECIAL )
+ {
+ SetTextColor( Color( COL_LIGHTBLUE ) );
+ }
+
+ // Position der Page berechnen
+ Point aPos0 = Point( aRect.Left(), mnOffY );
+ Point aPos1 = Point( aRect.Left()+TABBAR_OFFSET_X, aRect.Bottom() );
+ Point aPos2 = Point( aRect.Right()-TABBAR_OFFSET_X, aRect.Bottom() );
+ Point aPos3 = Point( aRect.Right(), mnOffY );
+
+ // Zuerst geben wir das Polygon gefuellt aus
+ Polygon aPoly( 4 );
+ aPoly[0] = aPos0;
+ aPoly[1] = aPos1;
+ aPoly[2] = aPos2;
+ aPoly[3] = aPos3;
+ DrawPolygon( aPoly );
+
+ // Danach den Text zentiert ausgeben
+ XubString aText = pItem->maText;
+ if ( pItem->mbShort )
+ aText = GetEllipsisString( aText, mnCurMaxWidth, TEXT_DRAW_ENDELLIPSIS );
+ Size aRectSize = aRect.GetSize();
+ long nTextWidth = GetTextWidth( aText );
+ long nTextHeight = GetTextHeight();
+ Point aTxtPos( aRect.Left()+(aRectSize.Width()-nTextWidth)/2,
+ (aRectSize.Height()-nTextHeight)/2 );
+ if ( !pItem->mbEnable )
+ DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) );
+ else
+ DrawText( aTxtPos, aText );
+
+ // Jetzt im Inhalt den 3D-Effekt ausgeben
+ aPos0.X()++;
+ aPos1.X()++;
+ aPos2.X()--;
+ aPos3.X()--;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( aPos0, aPos1 );
+
+ if ( !pItem->mbSelect && (pItem->mnId != mnCurPageId) )
+ {
+ DrawLine( Point( aPos0.X(), aPos0.Y()+1 ),
+ Point( aPos3.X(), aPos3.Y()+1 ) );
+ }
+
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( aPos2, aPos3 );
+ aPos1.X()--;
+ aPos1.Y()--;
+ aPos2.Y()--;
+ DrawLine( aPos1, aPos2 );
+
+ // Da etwas uebermalt werden konnte, muessen wir die Polygon-
+ // umrandung nocheinmal ausgeben
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ SetFillColor();
+ DrawPolygon( aPoly );
+
+ // Beim dem aktuellen Tab die restlichten Ausgaben vornehmen und
+ // die Schleife abbrechen, da die aktuelle Tab als letztes
+ // ausgegeben wird
+ if ( pItem == pCurItem )
+ {
+ // Beim aktuellen Item muss der oberstes Strich geloescht
+ // werden
+ SetLineColor();
+ SetFillColor( aSelectColor );
+ Rectangle aDelRect( aPos0, aPos3 );
+ DrawRect( aDelRect );
+ if ( mnWinStyle & WB_3DTAB )
+ {
+ aDelRect.Top()--;
+ DrawRect( aDelRect );
+ }
+
+ break;
+ }
+
+ pItem = mpItemList->Prev();
+ }
+ else
+ {
+ if ( pItem == pCurItem )
+ break;
+
+ pItem = NULL;
+ }
+
+ if ( !pItem )
+ pItem = pCurItem;
+ }
+ }
+
+ // Font wieder herstellen
+ SetFont( aFont );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::Resize()
+{
+ Size aNewSize = GetOutputSizePixel();
+
+ // Sizer anordnen
+ if ( mpSizer )
+ {
+ Size aSizerSize = mpSizer->GetSizePixel();
+ Point aNewSizerPos( aNewSize.Width()-aSizerSize.Width(), 0 );
+ Size aNewSizerSize( aSizerSize.Width(), aNewSize.Height() );
+ mpSizer->SetPosSizePixel( aNewSizerPos, aNewSizerSize );
+ mnOutWidth = aNewSize.Width() - aSizerSize.Width() - 1;
+ }
+ else
+ mnOutWidth = aNewSize.Width()-1;
+
+ // Scroll-Buttons anordnen
+ long nHeight = aNewSize.Height();
+ if ( nHeight != maWinSize.Height() )
+ {
+ long nX = 0;
+ Size aBtnSize( nHeight, nHeight );
+ if ( mpFirstBtn )
+ {
+ mpFirstBtn->SetPosSizePixel( Point( nX, 0 ), aBtnSize );
+ nX += nHeight;
+ }
+ if ( mpPrevBtn )
+ {
+ mpPrevBtn->SetPosSizePixel( Point( nX, 0 ), aBtnSize );
+ nX += nHeight;
+ }
+ if ( mpNextBtn )
+ {
+ mpNextBtn->SetPosSizePixel( Point( nX, 0 ), aBtnSize );
+ nX += nHeight;
+ }
+ if ( mpLastBtn )
+ {
+ mpLastBtn->SetPosSizePixel( Point( nX, 0 ), aBtnSize );
+ nX += nHeight;
+ }
+ mnOffX = nX;
+ }
+
+ // Groesse merken
+ maWinSize = aNewSize;
+
+ // Neu formatieren
+ mbSizeFormat = TRUE;
+ if ( IsReallyVisible() )
+ {
+ if ( ImplCalcWidth() )
+ Invalidate();
+ ImplFormat();
+ }
+
+ // Button enablen/disablen
+ ImplEnableControls();
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nItemId = GetPageId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+ if ( nItemId )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ {
+ XubString aStr = GetHelpText( nItemId );
+ if ( aStr.Len() )
+ {
+ Rectangle aItemRect = GetPageRect( nItemId );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
+ return;
+ }
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
+ {
+ ULONG nHelpId = GetHelpId( nItemId );
+ if ( nHelpId )
+ {
+ // Wenn eine Hilfe existiert, dann ausloesen
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pHelp->Start( nHelpId );
+ return;
+ }
+ }
+
+ // Bei Quick- oder Ballloon-Help zeigen wir den Text an,
+ // wenn dieser abgeschnitten oder nicht voll sichtbar ist
+ if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) )
+ {
+ USHORT nPos = GetPagePos( nItemId );
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem->mbShort ||
+ (pItem->maRect.Right()-TABBAR_OFFSET_X-5 > mnOutWidth) )
+ {
+ Rectangle aItemRect = GetPageRect( nItemId );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ XubString aStr = mpItemList->GetObject( nPos )->maText;
+ if ( aStr.Len() )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
+ else
+ Help::ShowQuickHelp( this, aItemRect, aStr );
+ return;
+ }
+ }
+ }
+ }
+
+ Window::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ if ( (mbSizeFormat || mbFormat) && mpItemList->Count() )
+ ImplFormat();
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ Invalidate();
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::Split()
+{
+ maSplitHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::ActivatePage()
+{
+ maActivatePageHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+long TabBar::DeactivatePage()
+{
+ if ( maDeactivatePageHdl.IsSet() )
+ return maDeactivatePageHdl.Call( this );
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+long TabBar::StartRenaming()
+{
+ if ( maStartRenamingHdl.IsSet() )
+ return maStartRenamingHdl.Call( this );
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+long TabBar::AllowRenaming()
+{
+ if ( maAllowRenamingHdl.IsSet() )
+ return maAllowRenamingHdl.Call( this );
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::EndRenaming()
+{
+ maEndRenamingHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::InsertPage( USHORT nPageId, const XubString& rText,
+ TabBarPageBits nBits, USHORT nPos )
+{
+ DBG_ASSERT( nPageId, "TabBar::InsertPage(): PageId == 0" );
+ DBG_ASSERT( GetPagePos( nPageId ) == TAB_PAGE_NOTFOUND,
+ "TabBar::InsertPage(): PageId already exists" );
+ DBG_ASSERT( nBits <= TPB_SPECIAL, "TabBar::InsertPage(): nBits is wrong" );
+
+ // PageItem anlegen und in die Item-Liste eintragen
+ ImplTabBarItem* pItem = new ImplTabBarItem( nPageId, rText, nBits );
+ mpItemList->Insert( pItem, nPos );
+ mbSizeFormat = TRUE;
+
+ // CurPageId gegebenenfalls setzen
+ if ( !mnCurPageId )
+ mnCurPageId = nPageId;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::RemovePage( USHORT nPageId )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ // Existiert Item
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ if ( mnCurPageId == nPageId )
+ mnCurPageId = 0;
+
+ // Testen, ob erste sichtbare Seite verschoben werden muss
+ if ( mnFirstPos > nPos )
+ mnFirstPos--;
+
+ // Item-Daten loeschen
+ delete mpItemList->Remove( nPos );
+ mbFormat = TRUE;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::MovePage( USHORT nPageId, USHORT nNewPos )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos < nNewPos )
+ nNewPos--;
+
+ if ( nPos == nNewPos )
+ return;
+
+ // Existiert Item
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ // TabBar-Item in der Liste verschieben
+ ImplTabBarItem* pItem = mpItemList->Remove( nPos );
+ mpItemList->Insert( pItem, nNewPos );
+ mbFormat = TRUE;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::Clear()
+{
+ // Alle Items loeschen
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Item-Daten loeschen
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Items aus der Liste loeschen
+ mpItemList->Clear();
+ mbSizeFormat = TRUE;
+ mnCurPageId = 0;
+ mnFirstPos = 0;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::EnablePage( USHORT nPageId, BOOL bEnable )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem->mbEnable != bEnable )
+ {
+ pItem->mbEnable = bEnable;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate( pItem->maRect );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TabBar::IsPageEnabled( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mbEnable;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetPageBits( USHORT nPageId, TabBarPageBits nBits )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem->mnBits != nBits )
+ {
+ pItem->mnBits = nBits;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate( pItem->maRect );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+TabBarPageBits TabBar::GetPageBits( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnBits;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::GetPageCount() const
+{
+ return (USHORT)mpItemList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::GetPageId( USHORT nPos ) const
+{
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem )
+ return pItem->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::GetPagePos( USHORT nPageId ) const
+{
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nPageId )
+ return (USHORT)mpItemList->GetCurPos();
+
+ pItem = mpItemList->Next();
+ }
+
+ return TAB_PAGE_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::GetPageId( const Point& rPos ) const
+{
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->maRect.IsInside( rPos ) )
+ return pItem->mnId;
+
+ pItem = mpItemList->Next();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle TabBar::GetPageRect( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maRect;
+ else
+ return Rectangle();
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetCurPageId( USHORT nPageId )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ // Wenn Item nicht existiert, dann nichts machen
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ // Wenn sich aktuelle Page nicht geaendert hat, dann muessen wir
+ // jetzt nichts mehr machen
+ if ( nPageId == mnCurPageId )
+ return;
+
+ // Muss invalidiert werden
+ BOOL bUpdate = FALSE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ bUpdate = TRUE;
+
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+ ImplTabBarItem* pOldItem;
+
+ if ( mnCurPageId )
+ pOldItem = mpItemList->GetObject( GetPagePos( mnCurPageId ) );
+ else
+ pOldItem = NULL;
+
+ // Wenn Page nicht selektiert, dann vorher selektierte Seite
+ // deselktieren, wenn dies die einzige selektierte Seite ist
+ if ( !pItem->mbSelect && pOldItem )
+ {
+ USHORT nSelPageCount = GetSelectPageCount();
+ if ( nSelPageCount == 1 )
+ pOldItem->mbSelect = FALSE;
+ pItem->mbSelect = TRUE;
+ }
+
+ mnCurPageId = nPageId;
+ mbFormat = TRUE;
+
+ // Dafuer sorgen, das aktuelle Page sichtbar wird
+ if ( IsReallyVisible() )
+ {
+ if ( nPos < mnFirstPos )
+ SetFirstPageId( nPageId );
+ else
+ {
+ // sichtbare Breite berechnen
+ long nWidth = mnOutWidth;
+ if ( nWidth > TABBAR_OFFSET_X )
+ nWidth -= TABBAR_OFFSET_X;
+
+ if ( pItem->maRect.IsEmpty() )
+ ImplFormat();
+
+ while ( (pItem->maRect.Right() > nWidth) ||
+ pItem->maRect.IsEmpty() )
+ {
+ USHORT nNewPos = mnFirstPos+1;
+ // Dafuer sorgen, das min. die aktuelle TabPages als
+ // erste TabPage sichtbar ist
+ if ( nNewPos >= nPos )
+ {
+ SetFirstPageId( nPageId );
+ break;
+ }
+ else
+ SetFirstPageId( GetPageId( nNewPos ) );
+ ImplFormat();
+ // Falls erste Seite nicht weitergeschaltet wird, dann
+ // koennen wir abbrechen
+ if ( nNewPos != mnFirstPos )
+ break;
+ }
+ }
+ }
+
+ // Leiste neu ausgeben
+ if ( bUpdate )
+ {
+ Invalidate( pItem->maRect );
+ if ( pOldItem )
+ Invalidate( pOldItem->maRect );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetFirstPageId( USHORT nPageId )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ // Wenn Item nicht existiert, dann FALSE zurueckgeben
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ if ( nPos != mnFirstPos )
+ {
+ // Dafuer sorgen, das nach Moeglichkteit soviele Pages wie
+ // moeglich sichtbar sind
+ ImplFormat();
+ USHORT nLastFirstPos = ImplGetLastFirstPos();
+ USHORT nNewPos;
+ if ( nPos > nLastFirstPos )
+ nNewPos = nLastFirstPos;
+ else
+ nNewPos = nPos;
+
+ if ( nNewPos != mnFirstPos )
+ {
+ mnFirstPos = nNewPos;
+ mbFormat = TRUE;
+
+ // Leiste neu ausgeben (Achtung: mbDropPos beachten, da wenn
+ // dieses Flag gesetzt ist, wird direkt gepaintet)
+ if ( IsReallyVisible() && IsUpdateMode() && !mbDropPos )
+ Invalidate();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SelectPage( USHORT nPageId, BOOL bSelect )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem->mbSelect != bSelect )
+ {
+ pItem->mbSelect = bSelect;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate( pItem->maRect );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SelectPageRange( BOOL bSelect, USHORT nStartPos, USHORT nEndPos )
+{
+ Rectangle aPaintRect;
+ USHORT nPos = nStartPos;
+ ImplTabBarItem* pItem = mpItemList->Seek( nPos );
+ while ( pItem && (nPos <= nEndPos) )
+ {
+ if ( (pItem->mbSelect != bSelect) && (pItem->mnId != mnCurPageId) )
+ {
+ pItem->mbSelect = bSelect;
+ aPaintRect.Union( pItem->maRect );
+ }
+
+ nPos++;
+ pItem = mpItemList->Next();
+ }
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() && !aPaintRect.IsEmpty() )
+ Invalidate( aPaintRect );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::GetSelectPage( USHORT nSelIndex ) const
+{
+ USHORT nSelected = 0;
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbSelect )
+ nSelected++;
+
+ if ( nSelected == nSelIndex )
+ return pItem->mnId;
+
+ pItem = mpItemList->Next();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::GetSelectPageCount() const
+{
+ USHORT nSelected = 0;
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbSelect )
+ nSelected++;
+
+ pItem = mpItemList->Next();
+ }
+
+ return nSelected;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TabBar::IsPageSelected( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mbSelect;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TabBar::StartEditMode( USHORT nPageId )
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( mpEdit || (nPos == TAB_PAGE_NOTFOUND) || (mnOutWidth < 8) )
+ return FALSE;
+
+ mnEditId = nPageId;
+ if ( StartRenaming() )
+ {
+ ImplShowPage( nPos );
+ ImplFormat();
+ Update();
+
+ mpEdit = new TabBarEdit( this, WB_CENTER );
+ Rectangle aRect = GetPageRect( mnEditId );
+ long nX = aRect.Left()+TABBAR_OFFSET_X+(TABBAR_OFFSET_X2/2);
+ long nWidth = aRect.GetWidth()-(TABBAR_OFFSET_X*2)-TABBAR_OFFSET_X2;
+ if ( mnEditId != GetCurPageId() )
+ nX += 1;
+ if ( nX+nWidth > mnOutWidth )
+ nWidth = mnOutWidth-nX;
+ if ( nWidth < 3 )
+ {
+ nX = aRect.Left();
+ nWidth = aRect.GetWidth();
+ }
+ mpEdit->SetText( GetPageText( mnEditId ) );
+ mpEdit->SetPosSizePixel( nX, aRect.Top()+mnOffY+1, nWidth, aRect.GetHeight()-3 );
+ Font aFont = GetPointFont();
+ Color aForegroundColor;
+ Color aBackgroundColor;
+ Color aFaceColor;
+ Color aSelectColor;
+ Color aFaceTextColor;
+ Color aSelectTextColor;
+ ImplGetColors( aFaceColor, aFaceTextColor, aSelectColor, aSelectTextColor );
+ if ( mnEditId != GetCurPageId() )
+ aFont.SetWeight( WEIGHT_LIGHT );
+ if ( IsPageSelected( mnEditId ) || (mnEditId == GetCurPageId()) )
+ {
+ aForegroundColor = aSelectTextColor;
+ aBackgroundColor = aSelectColor;
+ }
+ else
+ {
+ aForegroundColor = aFaceTextColor;
+ aBackgroundColor = aFaceColor;
+ }
+ if ( GetPageBits( mnEditId ) & TPB_SPECIAL )
+ aForegroundColor = Color( COL_LIGHTBLUE );
+ mpEdit->SetControlFont( aFont );
+ mpEdit->SetControlForeground( aForegroundColor );
+ mpEdit->SetControlBackground( aBackgroundColor );
+ mpEdit->GrabFocus();
+ mpEdit->SetSelection( Selection( 0, mpEdit->GetText().Len() ) );
+ mpEdit->Show();
+ return TRUE;
+ }
+ else
+ {
+ mnEditId = 0;
+ return FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::EndEditMode( BOOL bCancel )
+{
+ if ( mpEdit )
+ {
+ // call hdl
+ BOOL bEnd = TRUE;
+ mbEditCanceled = bCancel;
+ maEditText = mpEdit->GetText();
+ mpEdit->SetPostEvent();
+ if ( !bCancel )
+ {
+ long nAllowRenaming = AllowRenaming();
+ if ( nAllowRenaming == TAB_RENAMING_YES )
+ SetPageText( mnEditId, maEditText );
+ else if ( nAllowRenaming == TAB_RENAMING_NO )
+ bEnd = FALSE;
+ else // nAllowRenaming == TAB_RENAMING_CANCEL
+ mbEditCanceled = TRUE;
+ }
+
+ // renaming not allowed, than reset edit data
+ if ( !bEnd )
+ {
+ mpEdit->ResetPostEvent();
+ mpEdit->GrabFocus();
+ }
+ else
+ {
+ // close edit and call end hdl
+ delete mpEdit;
+ mpEdit = NULL;
+ EndRenaming();
+ mnEditId = 0;
+ }
+
+ // reset
+ maEditText.Erase();
+ mbEditCanceled = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetMaxPageWidth( long nMaxWidth )
+{
+ if ( mnMaxPageWidth != nMaxWidth )
+ {
+ mnMaxPageWidth = nMaxWidth;
+ mbSizeFormat = TRUE;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetSelectColor()
+{
+ if ( mbSelColor )
+ {
+ maSelColor = Color( COL_TRANSPARENT );
+ mbSelColor = FALSE;
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetSelectColor( const Color& rColor )
+{
+ if ( rColor.GetTransparency() )
+ {
+ if ( mbSelColor )
+ {
+ maSelColor = Color( COL_TRANSPARENT );
+ mbSelColor = FALSE;
+ Invalidate();
+ }
+ }
+ else
+ {
+ if ( maSelColor != rColor )
+ {
+ maSelColor = rColor;
+ mbSelColor = TRUE;
+ Invalidate();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetSelectTextColor()
+{
+ if ( mbSelTextColor )
+ {
+ maSelTextColor = Color( COL_TRANSPARENT );
+ mbSelTextColor = FALSE;
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetSelectTextColor( const Color& rColor )
+{
+ if ( rColor.GetTransparency() )
+ {
+ if ( mbSelTextColor )
+ {
+ maSelTextColor = Color( COL_TRANSPARENT );
+ mbSelTextColor = FALSE;
+ Invalidate();
+ }
+ }
+ else
+ {
+ if ( maSelTextColor != rColor )
+ {
+ maSelTextColor = rColor;
+ mbSelTextColor = TRUE;
+ Invalidate();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetPageText( USHORT nPageId, const XubString& rText )
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ mpItemList->GetObject( nPos )->maText = rText;
+ mbSizeFormat = TRUE;
+
+ // Leiste neu ausgeben
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString TabBar::GetPageText( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maText;
+ else
+ return XubString();
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetHelpText( USHORT nPageId, const XubString& rText )
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ mpItemList->GetObject( nPos )->maHelpText = rText;
+}
+
+// -----------------------------------------------------------------------
+
+XubString TabBar::GetHelpText( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ ImplTabBarItem* pItem = mpItemList->GetObject( nPos );
+ if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
+ {
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId );
+ }
+
+ return pItem->maHelpText;
+ }
+ else
+ return XubString();
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetHelpId( USHORT nPageId, ULONG nHelpId )
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ mpItemList->GetObject( nPos )->mnHelpId = nHelpId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG TabBar::GetHelpId( USHORT nPageId ) const
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnHelpId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long TabBar::GetMinSize() const
+{
+ long nMinSize = TABBAR_MINSIZE + TABBAR_OFFSET_X;
+ if ( mnWinStyle & WB_MINSCROLL )
+ nMinSize += mpPrevBtn->GetSizePixel().Width()*2;
+ else if ( mnWinStyle & WB_SCROLL )
+ nMinSize += mpFirstBtn->GetSizePixel().Width()*4;
+ return nMinSize;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TabBar::StartDrag( const CommandEvent& rCEvt, Region& rRegion )
+{
+ if ( !(mnWinStyle & WB_DRAG) || (rCEvt.GetCommand() != COMMAND_STARTDRAG) )
+ return FALSE;
+
+ // Testen, ob angeklickte Seite selektiert ist. Falls dies nicht
+ // der Fall ist, setzen wir ihn als aktuellen Eintrag. Falls Drag and
+ // Drop auch mal ueber Tastatur ausgeloest werden kann, testen wir
+ // dies nur bei einer Mausaktion.
+ // Ausserdem machen wir das nur, wenn kein Select() ausgeloest wurde,
+ // da der Select schon den Bereich gescrollt haben kann
+ if ( rCEvt.IsMouseEvent() && !mbInSelect )
+ {
+ USHORT nSelId = GetPageId( rCEvt.GetMousePosPixel() );
+
+ // Falls kein Eintrag angeklickt wurde, starten wir kein Dragging
+ if ( !nSelId )
+ return FALSE;
+
+ // Testen, ob Seite selektiertiert ist. Falls nicht, als aktuelle
+ // Seite setzen und Select rufen.
+ if ( !IsPageSelected( nSelId ) )
+ {
+ if ( DeactivatePage() )
+ {
+ SetCurPageId( nSelId );
+ Update();
+ ActivatePage();
+ Select();
+ }
+ else
+ return FALSE;
+ }
+ }
+ mbInSelect = FALSE;
+
+
+#ifdef MAC
+ PolyPolygon aPolyPoly;
+
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbSelect && !pItem->maRect.IsEmpty() )
+ {
+ // Polygon fuer DragRegion aufbauen
+ Rectangle aRect = pItem->maRect;
+ Polygon aPoly( 4 );
+ aPoly[0] = Point( aRect.Left(), mnOffY );
+ aPoly[1] = Point( aRect.Left()+TABBAR_OFFSET_X, aRect.Bottom() );
+ aPoly[2] = Point( aRect.Right()-TABBAR_OFFSET_X, aRect.Bottom() );
+ aPoly[3] = Point( aRect.Right(), mnOffY );
+ aPolyPoly.Insert( aPoly );
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ Region aRegion( aPolyPoly );
+#else
+ Region aRegion;
+#endif
+
+ // Region zuweisen
+ rRegion = aRegion;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabBar::ShowDropPos( const Point& rPos )
+{
+ ImplTabBarItem* pItem;
+ USHORT nDropId;
+ USHORT nNewDropPos;
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+ short nScroll = 0;
+
+ if ( rPos.X() > mnOutWidth-TABBAR_DRAG_SCROLLOFF )
+ {
+ pItem = mpItemList->GetObject( mpItemList->Count()-1 );
+ if ( !pItem->maRect.IsEmpty() && (rPos.X() > pItem->maRect.Right()) )
+ nNewDropPos = (USHORT)mpItemList->Count();
+ else
+ {
+ nNewDropPos = mnFirstPos+1;
+ nScroll = 1;
+ }
+ }
+ else if ( (rPos.X() <= mnOffX) ||
+ (!mnOffX && (rPos.X() <= TABBAR_DRAG_SCROLLOFF)) )
+ {
+ if ( mnFirstPos )
+ {
+ nNewDropPos = mnFirstPos;
+ nScroll = -1;
+ }
+ else
+ nNewDropPos = 0;
+ }
+ else
+ {
+ nDropId = GetPageId( rPos );
+ if ( nDropId )
+ {
+ nNewDropPos = GetPagePos( nDropId );
+ if ( mnFirstPos && (nNewDropPos == mnFirstPos-1) )
+ nScroll = -1;
+ }
+ else
+ nNewDropPos = nItemCount;
+ }
+
+ if ( mbDropPos && (nNewDropPos == mnDropPos) && !nScroll )
+ return mnDropPos;
+
+ if ( mbDropPos )
+ HideDropPos();
+ mbDropPos = TRUE;
+ mnDropPos = nNewDropPos;
+
+ if ( nScroll )
+ {
+ USHORT nOldFirstPos = mnFirstPos;
+ SetFirstPageId( GetPageId( mnFirstPos+nScroll ) );
+
+ // Direkt ausgeben, da kein Paint bei Drag and Drop moeglich
+ if ( nOldFirstPos != mnFirstPos )
+ {
+ Rectangle aRect( mnOffX, 0, mnOutWidth, maWinSize.Height() );
+ SetFillColor();
+ DrawRect( aRect );
+ Paint( aRect );
+ }
+ }
+
+ // Drop-Position-Pfeile ausgeben
+ Color aBlackColor( COL_BLACK );
+ long nX;
+ long nY = (maWinSize.Height()/2)-1;
+ USHORT nCurPos = GetPagePos( mnCurPageId );
+
+ SetLineColor( aBlackColor );
+ if ( mnDropPos < nItemCount )
+ {
+ pItem = mpItemList->GetObject( mnDropPos );
+ nX = pItem->maRect.Left()+TABBAR_OFFSET_X;
+ if ( mnDropPos == nCurPos )
+ nX--;
+ else
+ nX++;
+ DrawLine( Point( nX, nY ), Point( nX, nY ) );
+ DrawLine( Point( nX+1, nY-1 ), Point( nX+1, nY+1 ) );
+ DrawLine( Point( nX+2, nY-2 ), Point( nX+2, nY+2 ) );
+ }
+ if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) )
+ {
+ pItem = mpItemList->GetObject( mnDropPos-1 );
+ nX = pItem->maRect.Right()-TABBAR_OFFSET_X;
+ if ( mnDropPos == nCurPos )
+ nX++;
+ DrawLine( Point( nX, nY ), Point( nX, nY ) );
+ DrawLine( Point( nX-1, nY-1 ), Point( nX-1, nY+1 ) );
+ DrawLine( Point( nX-2, nY-2 ), Point( nX-2, nY+2 ) );
+ }
+
+ return mnDropPos;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::HideDropPos()
+{
+ if ( mbDropPos )
+ {
+ ImplTabBarItem* pItem;
+ long nX;
+ long nY1 = (maWinSize.Height()/2)-3;
+ long nY2 = nY1 + 5;
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+
+ if ( mnDropPos < nItemCount )
+ {
+ pItem = mpItemList->GetObject( mnDropPos );
+ nX = pItem->maRect.Left()+TABBAR_OFFSET_X;
+ // Paint direkt aufrufen, da bei Drag and Drop kein Paint
+ // moeglich
+ Rectangle aRect( nX-1, nY1, nX+3, nY2 );
+ Region aRegion( aRect );
+ SetClipRegion( aRegion );
+ Paint( aRect );
+ SetClipRegion();
+ }
+ if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) )
+ {
+ pItem = mpItemList->GetObject( mnDropPos-1 );
+ nX = pItem->maRect.Right()-TABBAR_OFFSET_X;
+ // Paint direkt aufrufen, da bei Drag and Drop kein Paint
+ // moeglich
+ Rectangle aRect( nX-2, nY1, nX+1, nY2 );
+ Region aRegion( aRect );
+ SetClipRegion( aRegion );
+ Paint( aRect );
+ SetClipRegion();
+ }
+
+ mbDropPos = FALSE;
+ mnDropPos = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TabBar::SwitchPage( const Point& rPos )
+{
+ BOOL bSwitch = FALSE;
+ USHORT nSwitchId = GetPageId( rPos );
+ if ( !nSwitchId )
+ EndSwitchPage();
+ else
+ {
+ if ( nSwitchId != mnSwitchId )
+ {
+ mnSwitchId = nSwitchId;
+ mnSwitchTime = Time::GetSystemTicks();
+ }
+ else
+ {
+ // Erst nach 500 ms umschalten
+ if ( mnSwitchId != GetCurPageId() )
+ {
+ if ( Time::GetSystemTicks() > mnSwitchTime+500 )
+ {
+ mbInSwitching = TRUE;
+ if ( DeactivatePage() )
+ {
+ SetCurPageId( mnSwitchId );
+ Update();
+ ActivatePage();
+ Select();
+ bSwitch = TRUE;
+ }
+ mbInSwitching = FALSE;
+ }
+ }
+ }
+ }
+
+ return bSwitch;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::EndSwitchPage()
+{
+ mnSwitchTime = 0;
+ mnSwitchId = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void TabBar::SetStyle( WinBits nStyle )
+{
+ mnWinStyle = nStyle;
+ ImplInitControls();
+ // Evt. Controls neu anordnen
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Resize();
+}
+
+// -----------------------------------------------------------------------
+
+Size TabBar::CalcWindowSizePixel() const
+{
+ long nWidth = 0;
+
+ if ( mpItemList->Count() )
+ {
+ ((TabBar*)this)->ImplCalcWidth();
+ ImplTabBarItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ nWidth += pItem->mnWidth;
+ pItem = mpItemList->Next();
+ }
+ nWidth += TABBAR_OFFSET_X+TABBAR_OFFSET_X2;
+ }
+
+ return Size( nWidth, GetTextHeight()+3 );
+}
diff --git a/svtools/source/control/taskbar.cxx b/svtools/source/control/taskbar.cxx
new file mode 100644
index 000000000000..131bede4df03
--- /dev/null
+++ b/svtools/source/control/taskbar.cxx
@@ -0,0 +1,645 @@
+/*************************************************************************
+ *
+ * $RCSfile: taskbar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TASKBAR_CXX
+
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _VCL_FLOATWIN_HXX
+#include <vcl/floatwin.hxx>
+#endif
+
+#include <taskbar.hxx>
+
+// =======================================================================
+
+class ImplTaskBarFloat : public FloatingWindow
+{
+public:
+ TaskBar* mpTaskBar;
+
+public:
+ ImplTaskBarFloat( TaskBar* pTaskBar );
+
+ void Paint();
+};
+
+// -----------------------------------------------------------------------
+
+ImplTaskBarFloat::ImplTaskBarFloat( TaskBar* pTaskBar ) :
+ FloatingWindow( pTaskBar, 0 )
+{
+ mpTaskBar = pTaskBar;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTaskBarFloat::Paint()
+{
+}
+
+// =======================================================================
+
+#define TASKBAR_BORDER 2
+#define TASKBAR_OFFSIZE 3
+#define TASKBAR_OFFX 2
+#define TASKBAR_OFFY 1
+#define TASKBAR_BUTTONOFF 5
+#define TASKBAR_AUTOHIDE_HEIGHT 2
+
+// =======================================================================
+
+TaskBar::TaskBar( Window* pParent, WinBits nWinStyle ) :
+ Window( pParent, WB_3DLOOK )
+{
+ mpButtonBar = NULL;
+ mpTaskToolBox = NULL;
+ mpStatusBar = NULL;
+ mnStatusWidth = 0;
+ mnOldStatusWidth = 0;
+ mnLines = 1;
+ mnWinBits = nWinStyle;
+ mbStatusText = FALSE;
+ mbShowItems = FALSE;
+ mbAutoHide = FALSE;
+
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+TaskBar::~TaskBar()
+{
+ if ( mpButtonBar )
+ delete mpButtonBar;
+ if ( mpTaskToolBox )
+ delete mpTaskToolBox;
+ if ( mpStatusBar )
+ delete mpStatusBar;
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::ImplInitSettings()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( Window::GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetFaceColor();
+ else
+ aColor = rStyleSettings.GetWindowColor();
+ SetBackground( aColor );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::ImplNewHeight( long nNewHeight )
+{
+ long nOldHeight = GetSizePixel().Height();
+ if ( nNewHeight != nOldHeight )
+ {
+ long nY = GetPosPixel().Y()-(nNewHeight-nOldHeight);
+ SetPosSizePixel( 0, nY, 0, nNewHeight,
+ WINDOW_POSSIZE_Y | WINDOW_POSSIZE_HEIGHT );
+ TaskResize();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::TaskResize()
+{
+ maTaskResizeHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+TaskButtonBar* TaskBar::CreateButtonBar()
+{
+ return new TaskButtonBar( this );
+}
+
+// -----------------------------------------------------------------------
+
+TaskToolBox* TaskBar::CreateTaskToolBox()
+{
+ return new TaskToolBox( this );
+}
+
+// -----------------------------------------------------------------------
+
+TaskStatusBar* TaskBar::CreateTaskStatusBar()
+{
+ return new TaskStatusBar( this );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( mnWinBits & WB_SIZEABLE )
+ {
+ TaskToolBox* pTempTaskToolBox = GetTaskToolBox();
+ TaskStatusBar* pTempStatusBar = GetStatusBar();
+
+ if ( pTempTaskToolBox && pTempStatusBar )
+ {
+ long nStatusX = pTempStatusBar->GetPosPixel().X()-TASKBAR_OFFSIZE-2;
+ long nMouseX = rMEvt.GetPosPixel().X();
+ PointerStyle ePtrStyle;
+ if ( (nMouseX >= nStatusX-1) && (nMouseX <= nStatusX+3) )
+ ePtrStyle = POINTER_HSIZEBAR;
+ else
+ ePtrStyle = POINTER_ARROW;
+ Pointer aPtr( ePtrStyle );
+ SetPointer( aPtr );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && (mnWinBits & WB_SIZEABLE) )
+ {
+ TaskToolBox* pTempTaskToolBox = GetTaskToolBox();
+ TaskStatusBar* pTempStatusBar = GetStatusBar();
+
+ if ( pTempTaskToolBox && pTempStatusBar )
+ {
+ long nStatusX = pTempStatusBar->GetPosPixel().X()-TASKBAR_OFFSIZE-2;
+ long nMouseX = rMEvt.GetPosPixel().X();
+ if ( (nMouseX >= nStatusX-1) && (nMouseX <= nStatusX+3) )
+ {
+ if ( rMEvt.GetClicks() == 2 )
+ {
+ if ( mnStatusWidth )
+ {
+ mnStatusWidth = 0;
+ Resize();
+ }
+ }
+ else
+ {
+ StartTracking();
+ mnOldStatusWidth = mnStatusWidth;
+ mnMouseOff = nMouseX-nStatusX;
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( rTEvt.IsTrackingCanceled() )
+ {
+ mnStatusWidth = mnOldStatusWidth;
+ Resize();
+ Update();
+ }
+ }
+ else
+ {
+ Size aSize = GetOutputSizePixel();
+
+#ifdef MAC
+ if ( !Application::IsFullScreenMode() )
+ aSize.Width() -= 17;
+#endif
+
+ long nMouseX = rTEvt.GetMouseEvent().GetPosPixel().X()-mnMouseOff;
+ if ( nMouseX < 0 )
+ nMouseX = 0;
+ long nMaxX = aSize.Width()-TASKBAR_OFFX-TASKBAR_OFFSIZE-1;
+ if ( nMouseX > nMaxX )
+ nMouseX = nMaxX;
+ mnStatusWidth = aSize.Width()-nMouseX-TASKBAR_OFFX-TASKBAR_OFFSIZE;
+ Resize();
+ Update();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::Paint( const Rectangle& rRect )
+{
+ if ( mnWinBits & (WB_BORDER | WB_SIZEABLE) )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Size aSize = GetOutputSizePixel();
+ long nY = 0;
+
+ if ( mnWinBits & WB_BORDER )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( 0, 0 ), Point( aSize.Width()-1, 0 ) );
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( 0, 1 ), Point( aSize.Width()-1, 1 ) );
+ nY += 2;
+ }
+
+ if ( (mnWinBits & WB_SIZEABLE) )
+ {
+ TaskButtonBar* pTempButtonBar = GetButtonBar();
+ TaskToolBox* pTempTaskToolBox = GetTaskToolBox();
+ TaskStatusBar* pTempStatusBar = GetStatusBar();
+
+ if ( pTempTaskToolBox && pTempStatusBar )
+ {
+ long nStatusX = pTempStatusBar->GetPosPixel().X()-TASKBAR_OFFSIZE-2;
+ if ( nStatusX > 0 )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( nStatusX, nY ), Point( nStatusX, aSize.Height()-1 ) );
+ nStatusX++;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( nStatusX, nY ), Point( nStatusX, aSize.Height()-1 ) );
+ }
+ }
+ }
+ }
+
+ Window::Paint( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::Resize()
+{
+ if ( !IsReallyShown() )
+ return;
+
+ TaskButtonBar* pTempButtonBar = GetButtonBar();
+ TaskToolBox* pTempTaskToolBox = GetTaskToolBox();
+ TaskStatusBar* pTempStatusBar = GetStatusBar();
+ Point aToolPos( TASKBAR_OFFX, 0 );
+ Size aSize = GetOutputSizePixel();
+ Size aStatusSize;
+ Size aToolSize( aSize.Width()-(TASKBAR_OFFX*2), 0 );
+ long nOldStatusX = -1;
+ long nNewStatusX = -1;
+ long nTaskHeight = aSize.Height() - (TASKBAR_OFFY*2);
+
+#ifdef MAC
+ if ( !Application::IsFullScreenMode() )
+ aSize.Width() -= 17;
+#endif
+
+ if ( mnWinBits & WB_BORDER )
+ {
+ nTaskHeight -= TASKBAR_BORDER;
+ aToolPos.Y() += TASKBAR_BORDER;
+ }
+
+ if ( pTempButtonBar )
+ {
+ USHORT i = 0;
+ BOOL bVisibleItems = FALSE;
+ while ( i < pTempButtonBar->GetItemCount() )
+ {
+ if ( pTempButtonBar->IsItemVisible( pTempButtonBar->GetItemId( i ) ) )
+ {
+ bVisibleItems = TRUE;
+ break;
+ }
+ i++;
+ }
+ if ( mbStatusText || !bVisibleItems )
+ pTempButtonBar->Hide();
+ else
+ {
+ Size aButtonBarSize = pTempButtonBar->CalcWindowSizePixel();
+ if ( pTempButtonBar->GetItemCount() )
+ nTaskHeight = aButtonBarSize.Height();
+ else
+ aButtonBarSize.Height() = nTaskHeight;
+ Point aTempPos = aToolPos;
+ aTempPos.Y() += (aSize.Height()-aButtonBarSize.Height()-aTempPos.Y())/2;
+ pTempButtonBar->SetPosSizePixel( aTempPos, aButtonBarSize );
+ pTempButtonBar->Show();
+ aToolPos.X() += aButtonBarSize.Width()+TASKBAR_BUTTONOFF;
+ }
+ }
+
+ if ( pTempStatusBar )
+ {
+ aStatusSize = pTempStatusBar->CalcWindowSizePixel();
+ if ( mnStatusWidth )
+ aStatusSize.Width() = mnStatusWidth;
+ if ( !pTempTaskToolBox || mbStatusText )
+ aStatusSize.Width() = aSize.Width();
+ long nMaxHeight = aSize.Height()-(TASKBAR_OFFY*2);
+ if ( mnWinBits & WB_BORDER )
+ nMaxHeight -= TASKBAR_BORDER;
+ if ( nMaxHeight+2 > aStatusSize.Height() )
+ aStatusSize.Height() = nMaxHeight;
+ Point aPos( aSize.Width()-aStatusSize.Width(), 0 );
+ if ( pTempTaskToolBox && (mnWinBits & WB_SIZEABLE) && !mbStatusText )
+ {
+ long nMinToolWidth = aToolPos.X()+50;
+ if ( aPos.X() < nMinToolWidth )
+ {
+ aStatusSize.Width() -= nMinToolWidth-aPos.X();
+ aPos.X() = nMinToolWidth;
+ }
+ }
+ if ( aPos.X() < 0 )
+ {
+ aStatusSize.Width() = aSize.Width();
+ aPos.X() = 0;
+ }
+ if ( mnWinBits & WB_BORDER )
+ aPos.Y() += TASKBAR_BORDER;
+ aPos.Y() += (aSize.Height()-aStatusSize.Height()-aPos.Y())/2;
+ if ( mnWinBits & WB_SIZEABLE )
+ {
+ if ( pTempTaskToolBox )
+ {
+ nOldStatusX = pTempStatusBar->GetPosPixel().X()-TASKBAR_OFFSIZE-2;
+ nNewStatusX = aPos.X()-TASKBAR_OFFSIZE-2;
+ }
+ }
+ pTempStatusBar->SetPosSizePixel( aPos, aStatusSize );
+ pTempStatusBar->Show();
+ aToolSize.Width() = aPos.X()-aToolPos.X()-TASKBAR_OFFX;
+ if ( mnWinBits & WB_SIZEABLE )
+ aToolSize.Width() -= (TASKBAR_OFFSIZE*2)-2;
+ }
+
+ if ( pTempTaskToolBox )
+ {
+ if ( aToolSize.Width() <= 24 )
+ pTempTaskToolBox->Hide();
+ else
+ {
+ aToolSize.Height() = pTempTaskToolBox->CalcWindowSizePixel().Height();
+ if ( pTempTaskToolBox->GetItemCount() )
+ nTaskHeight = aToolSize.Height();
+ else
+ aToolSize.Height() = nTaskHeight;
+ aToolPos.Y() += (aSize.Height()-aToolSize.Height()-aToolPos.Y())/2;
+ pTempTaskToolBox->SetPosSizePixel( aToolPos, aToolSize );
+ pTempTaskToolBox->Show();
+ }
+ }
+
+ if ( nOldStatusX != nNewStatusX )
+ {
+ if ( nOldStatusX > 0 )
+ {
+ Rectangle aRect( nOldStatusX, 0, nOldStatusX+2, aSize.Height()-1 );
+ Invalidate( aRect );
+ }
+ if ( nNewStatusX > 0 )
+ {
+ Rectangle aRect( nNewStatusX, 0, nNewStatusX+2, aSize.Height()-1 );
+ Invalidate( aRect );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ Format();
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_FORMAT )
+ {
+ ImplInitSettings();
+ ImplNewHeight( CalcWindowSizePixel().Height() );
+ Format();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ // Asyncronen StateChanged ausloesen, damit sich die
+ // TaskBar an die neuen Groessen der Child-Fenster
+ // orientieren kann
+ PostStateChanged( STATE_CHANGE_FORMAT );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::Format()
+{
+ ImplNewHeight( CalcWindowSizePixel().Height() );
+ Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::SetLines( USHORT nLines )
+{
+ mnLines = nLines;
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::EnableAutoHide( BOOL bAutoHide )
+{
+ mbAutoHide = bAutoHide;
+
+ if ( mbAutoHide )
+ {
+ ImplNewHeight( TASKBAR_AUTOHIDE_HEIGHT );
+ }
+ else
+ {
+ ImplNewHeight( CalcWindowSizePixel().Height() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::ShowStatusText( const String& rText )
+{
+ if ( mpStatusBar )
+ {
+ if ( !mbStatusText )
+ {
+ mbStatusText = TRUE;
+ if ( mpStatusBar->AreItemsVisible() )
+ {
+ mbShowItems = TRUE;
+ mpStatusBar->HideItems();
+ }
+ else
+ mbShowItems = TRUE;
+ maOldText = mpStatusBar->GetText();
+ Resize();
+ mpStatusBar->SetText( rText );
+ Update();
+ mpStatusBar->Update();
+ }
+ else
+ mpStatusBar->SetText( rText );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskBar::HideStatusText()
+{
+ if ( mbStatusText && mpStatusBar )
+ {
+ mbStatusText = FALSE;
+ mpStatusBar->SetText( maOldText );
+ Resize();
+ if ( mbShowItems )
+ mpStatusBar->ShowItems();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size TaskBar::CalcWindowSizePixel() const
+{
+ TaskButtonBar* pTempButtonBar = GetButtonBar();
+ TaskToolBox* pTempTaskToolBox = GetTaskToolBox();
+ TaskStatusBar* pTempStatusBar = GetStatusBar();
+ Size aSize;
+ long nTempHeight;
+
+ if ( pTempButtonBar && pTempButtonBar->GetItemCount() )
+ aSize.Height() = pTempButtonBar->CalcWindowSizePixel().Height()+(TASKBAR_OFFY*2);
+ if ( pTempTaskToolBox && pTempTaskToolBox->GetItemCount() )
+ {
+ nTempHeight = pTempTaskToolBox->CalcWindowSizePixel().Height()+(TASKBAR_OFFY*2);
+ if ( nTempHeight > aSize.Height() )
+ aSize.Height() = nTempHeight;
+ }
+ if ( pTempStatusBar )
+ {
+ nTempHeight = pTempStatusBar->GetSizePixel().Height();
+ if ( nTempHeight > aSize.Height() )
+ aSize.Height() = nTempHeight;
+ }
+
+ if ( mnWinBits & WB_BORDER )
+ aSize.Height() += TASKBAR_BORDER;
+
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+TaskButtonBar* TaskBar::GetButtonBar() const
+{
+ if ( !mpButtonBar )
+ ((TaskBar*)this)->mpButtonBar = ((TaskBar*)this)->CreateButtonBar();
+ return mpButtonBar;
+}
+
+// -----------------------------------------------------------------------
+
+TaskToolBox* TaskBar::GetTaskToolBox() const
+{
+ if ( !mpTaskToolBox )
+ ((TaskBar*)this)->mpTaskToolBox = ((TaskBar*)this)->CreateTaskToolBox();
+ return mpTaskToolBox;
+}
+
+// -----------------------------------------------------------------------
+
+TaskStatusBar* TaskBar::GetStatusBar() const
+{
+ if ( !mpStatusBar )
+ {
+ ((TaskBar*)this)->mpStatusBar = ((TaskBar*)this)->CreateTaskStatusBar();
+ if ( mpStatusBar )
+ mpStatusBar->mpNotifyTaskBar = (TaskBar*)this;
+ }
+ return mpStatusBar;
+}
diff --git a/svtools/source/control/taskbox.cxx b/svtools/source/control/taskbox.cxx
new file mode 100644
index 000000000000..73a9798a12ee
--- /dev/null
+++ b/svtools/source/control/taskbox.cxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * $RCSfile: taskbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TASKBAR_CXX
+
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+#ifndef _SV_SYSTEM_HXX
+#include <vcl/system.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <vcl/help.hxx>
+#endif
+
+#include <taskbar.hxx>
+
+// =======================================================================
+
+#define TASKBOX_TASKOFF 3
+
+// =======================================================================
+
+struct ImplTaskItem
+{
+ Image maImage;
+ XubString maText;
+};
+
+DECLARE_LIST( ImplTaskItemList, ImplTaskItem* );
+
+// =======================================================================
+
+TaskToolBox::TaskToolBox( Window* pParent, WinBits nWinStyle ) :
+ ToolBox( pParent, nWinStyle | WB_SCROLL | WB_3DLOOK )
+{
+ mpItemList = new ImplTaskItemList;
+ mnMaxTextWidth = 0;
+ mnActiveItemId = 0;
+ mnTaskItem = 0;
+ mnSmallItem = TOOLBOX_ITEM_NOTFOUND;
+ mbMinActivate = FALSE;
+
+ SetAlign( WINDOWALIGN_BOTTOM );
+ SetButtonType( BUTTON_SYMBOLTEXT );
+}
+
+// -----------------------------------------------------------------------
+
+TaskToolBox::~TaskToolBox()
+{
+ ImplTaskItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ delete mpItemList;
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::ActivateTaskItem( USHORT nItemId, BOOL bMinActivate )
+{
+ if ( nItemId )
+ {
+ if ( nItemId != mnActiveItemId )
+ {
+ if ( mnActiveItemId )
+ CheckItem( mnActiveItemId, FALSE );
+ CheckItem( nItemId );
+ mnActiveItemId = nItemId;
+ }
+ else
+ {
+ if ( !bMinActivate )
+ return;
+
+ mbMinActivate = TRUE;
+ }
+
+ mnTaskItem = nItemId-1;
+ ActivateTask();
+ mnTaskItem = 0;
+ mbMinActivate = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::ActivateTask()
+{
+ maActivateTaskHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::ContextMenu()
+{
+ maContextMenuHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( !rMEvt.IsRight() )
+ ToolBox::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::Resize()
+{
+ mnOldItemCount = mpItemList->Count();
+ mnUpdatePos = (USHORT)mnOldItemCount;
+ mnUpdateNewPos = TOOLBOX_ITEM_NOTFOUND;
+ ImplFormat();
+ ToolBox::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ USHORT nItemId = GetItemId( rCEvt.GetMousePosPixel() );
+// Dies machen wir nicht mehr, da es von zu vielen als stoerend empfunden wurde
+// ActivateTaskItem( nItemId );
+ mnTaskItem = nItemId-1;
+
+ maContextMenuPos = OutputToScreenPixel( rCEvt.GetMousePosPixel() );
+ ContextMenu();
+ maContextMenuPos = Point();
+ mnTaskItem = 0;
+ }
+ else
+ ToolBox::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) )
+ {
+ USHORT nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+
+ if ( nItemId )
+ {
+ ImplTaskItem* pItem = mpItemList->GetObject( nItemId-1 );
+ if ( pItem )
+ {
+ if ( pItem->maText != GetItemText( nItemId ) )
+ {
+ Rectangle aItemRect = GetItemRect( nItemId );
+ if ( rHEvt.GetMode() & HELPMODE_QUICK )
+ Help::ShowQuickHelp( this, aItemRect, pItem->maText );
+ else
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, pItem->maText );
+ }
+ else
+ Help::ShowQuickHelp( this, Rectangle(), String() );
+ return;
+ }
+ }
+ }
+
+ ToolBox::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TaskToolBox::QueryDrop( DropEvent& rDEvt )
+{
+ if ( !rDEvt.IsLeaveWindow() )
+ {
+ USHORT nItemId = GetItemId( rDEvt.GetPosPixel() );
+ if ( nItemId )
+ ActivateTaskItem( nItemId );
+ }
+ return ToolBox::QueryDrop( rDEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::Select()
+{
+ USHORT nItemId = GetCurItemId();
+ ActivateTaskItem( nItemId, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::ImplFormat()
+{
+ if ( mnUpdateNewPos == TOOLBOX_ITEM_NOTFOUND )
+ {
+ // Eintraege aus der Liste entfernen
+ while ( mpItemList->Count() > mnUpdatePos )
+ delete mpItemList->Remove( (ULONG)mnUpdatePos );
+ mnUpdateNewPos = mnUpdatePos;
+ }
+
+ // Maximale Itemgroesse berechnen
+ long nOldMaxTextWidth = mnMaxTextWidth;
+ mnMaxTextWidth = 70;
+ if ( mpItemList->Count() )
+ {
+ long nWinSize = GetOutputSizePixel().Width()-8;
+ long nItemSize = mpItemList->GetObject(0)->maImage.GetSizePixel().Width()+7+TASKBOX_TASKOFF+2;
+ nWinSize -= mpItemList->Count()*nItemSize;
+ if ( nWinSize > 0 )
+ nWinSize /= mpItemList->Count();
+ else
+ nWinSize = 0;
+ if ( nWinSize < mnMaxTextWidth )
+ mnMaxTextWidth = nWinSize;
+ if ( (mnMaxTextWidth < nOldMaxTextWidth) ||
+ ((mnMaxTextWidth-nOldMaxTextWidth > 3) &&
+ (mnSmallItem != TOOLBOX_ITEM_NOTFOUND)) )
+ {
+ mnSmallItem = TOOLBOX_ITEM_NOTFOUND;
+ mnUpdateNewPos = 0;
+ }
+ }
+
+ // Eintraege aus der ToolBox entfernen, die ersetzt werden
+ USHORT nBtnPos = (mnUpdateNewPos*2);
+ while ( nBtnPos < GetItemCount() )
+ RemoveItem( nBtnPos );
+ if ( mnUpdateNewPos <= (mnActiveItemId-1) )
+ mnActiveItemId = 0;
+
+ // Neue Eintrage einfuegen
+ USHORT i = mnUpdateNewPos;
+ while ( i < mpItemList->Count() )
+ {
+ ImplTaskItem* pItem = mpItemList->GetObject( i );
+
+ // Textlaenge berechnen
+ XubString aText = pItem->maText;
+ if ( !aText.Len() )
+ aText = ' ';
+ long nTxtWidth = GetTextWidth( aText );
+ if ( nTxtWidth > mnMaxTextWidth )
+ {
+ if ( mnSmallItem == TOOLBOX_ITEM_NOTFOUND )
+ mnSmallItem = i;
+ // 3 == Len of "..."
+ aText.AppendAscii( "..." );
+ do
+ {
+ aText.Erase( aText.Len()-3-1, 1 );
+ nTxtWidth = GetTextWidth( aText );
+ }
+ while ( (nTxtWidth > mnMaxTextWidth) && (aText.Len() > 3) );
+ }
+
+ USHORT nItemId = i+1;
+ if ( aText.EqualsAscii( "..." ) )
+ InsertItem( nItemId, pItem->maImage, TIB_LEFT );
+ else
+ InsertItem( nItemId, pItem->maImage, aText, TIB_LEFT );
+ InsertSeparator( TOOLBOX_APPEND, TASKBOX_TASKOFF );
+ i++;
+ }
+
+ if ( mnUpdateNewPos != 0 )
+ mnMaxTextWidth = nOldMaxTextWidth;
+
+ if ( mnNewActivePos+1 != mnActiveItemId )
+ {
+ if ( mnActiveItemId )
+ CheckItem( mnActiveItemId, FALSE );
+ mnActiveItemId = mnNewActivePos+1;
+ CheckItem( mnActiveItemId );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::StartUpdateTask()
+{
+ mnOldItemCount = mpItemList->Count();
+ mnUpdatePos = 0;
+ mnUpdateNewPos = TOOLBOX_ITEM_NOTFOUND;
+ mnNewActivePos = 0xFFFE;
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::UpdateTask( const Image& rImage, const String& rText,
+ BOOL bActive )
+{
+ ImplTaskItem* pItem = mpItemList->GetObject( mnUpdatePos );
+ if ( pItem )
+ {
+ if ( (pItem->maText != rText) || (pItem->maImage != rImage) )
+ {
+ // Eintraege aus der Liste entfernen
+ while ( mpItemList->Count() > mnUpdatePos )
+ delete mpItemList->Remove( (ULONG)mnUpdatePos );
+ pItem = NULL;
+ }
+ }
+
+ if ( !pItem )
+ {
+ if ( mnUpdatePos < mnUpdateNewPos )
+ mnUpdateNewPos = mnUpdatePos;
+
+ pItem = new ImplTaskItem;
+ pItem->maImage = rImage;
+ pItem->maText = rText;
+ mpItemList->Insert( pItem, LIST_APPEND );
+ }
+
+ if ( bActive )
+ mnNewActivePos = mnUpdatePos;
+
+ mnUpdatePos++;
+}
+
+// -----------------------------------------------------------------------
+
+void TaskToolBox::EndUpdateTask()
+{
+ if ( mnUpdateNewPos == TOOLBOX_ITEM_NOTFOUND )
+ {
+ // Eintraege aus der Liste entfernen
+ while ( mpItemList->Count() > mnUpdatePos )
+ delete mpItemList->Remove( (ULONG)mnUpdatePos );
+ mnUpdateNewPos = mnUpdatePos;
+ }
+
+ ImplFormat();
+}
+
diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx
new file mode 100644
index 000000000000..1438417d2a88
--- /dev/null
+++ b/svtools/source/control/taskmisc.cxx
@@ -0,0 +1,416 @@
+/*************************************************************************
+ *
+ * $RCSfile: taskmisc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TASKBAR_CXX
+
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_HELP_HXX
+#include <vcl/help.hxx>
+#endif
+
+#include <taskbar.hxx>
+
+// =======================================================================
+
+TaskButtonBar::TaskButtonBar( Window* pParent, WinBits nWinStyle ) :
+ ToolBox( pParent, nWinStyle | WB_3DLOOK )
+{
+ SetAlign( WINDOWALIGN_BOTTOM );
+ SetButtonType( BUTTON_SYMBOLTEXT );
+}
+
+// -----------------------------------------------------------------------
+
+TaskButtonBar::~TaskButtonBar()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void TaskButtonBar::RequestHelp( const HelpEvent& rHEvt )
+{
+ ToolBox::RequestHelp( rHEvt );
+}
+
+// =======================================================================
+
+WindowArrange::WindowArrange()
+{
+ mpWinList = new List;
+}
+
+// -----------------------------------------------------------------------
+
+WindowArrange::~WindowArrange()
+{
+ delete mpWinList;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplCeilSqareRoot( USHORT nVal )
+{
+ USHORT i;
+
+ // Ueberlauf verhindern
+ if ( nVal > 0xFE * 0xFE )
+ return 0xFE;
+
+ for ( i=0; i*i < nVal; i++ )
+ {}
+
+ return i;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplPosSizeWindow( Window* pWindow,
+ long nX, long nY, long nWidth, long nHeight )
+{
+ if ( nWidth < 32 )
+ nWidth = 32;
+ if ( nHeight < 24 )
+ nHeight = 24;
+ pWindow->SetPosSizePixel( nX, nY, nWidth, nHeight );
+}
+
+// -----------------------------------------------------------------------
+
+void WindowArrange::ImplTile( const Rectangle& rRect )
+{
+ USHORT nCount = (USHORT)mpWinList->Count();
+ if ( nCount < 3 )
+ {
+ ImplVert( rRect );
+ return;
+ }
+
+ USHORT i;
+ USHORT j;
+ USHORT nCols;
+ USHORT nRows;
+ USHORT nActRows;
+ USHORT nOffset;
+ long nOverWidth;
+ long nOverHeight;
+ Window* pWindow;
+ long nX = rRect.Left();
+ long nY = rRect.Top();
+ long nWidth = rRect.GetWidth();
+ long nHeight = rRect.GetHeight();
+ long nRectY = nY;
+ long nRectWidth = nWidth;
+ long nRectHeight = nHeight;
+ long nTempWidth;
+ long nTempHeight;
+
+ nCols = ImplCeilSqareRoot( nCount );
+ nOffset = (nCols*nCols) - nCount;
+ if ( nOffset >= nCols )
+ {
+ nRows = nCols -1;
+ nOffset -= nCols;
+ }
+ else
+ nRows = nCols;
+
+ nWidth /= nCols;
+ if ( nWidth < 1 )
+ nWidth = 1;
+ nOverWidth = nRectWidth-(nWidth*nCols);
+
+ pWindow = (Window*)mpWinList->First();
+ for ( i = 0; i < nCols; i++ )
+ {
+ if ( i < nOffset )
+ nActRows = nRows - 1;
+ else
+ nActRows = nRows;
+
+ nTempWidth = nWidth;
+ if ( nOverWidth > 0 )
+ {
+ nTempWidth++;
+ nOverWidth--;
+ }
+
+ nHeight = nRectHeight / nActRows;
+ if ( nHeight < 1 )
+ nHeight = 1;
+ nOverHeight = nRectHeight-(nHeight*nActRows);
+ for ( j = 0; j < nActRows; j++ )
+ {
+ // Ueberhang verteilen
+ nTempHeight = nHeight;
+ if ( nOverHeight > 0 )
+ {
+ nTempHeight++;
+ nOverHeight--;
+ }
+ ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nTempHeight );
+ nY += nTempHeight;
+
+ pWindow = (Window*)mpWinList->Next();
+ if ( !pWindow )
+ break;
+ }
+
+ nX += nWidth;
+ nY = nRectY;
+
+ if ( !pWindow )
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WindowArrange::ImplHorz( const Rectangle& rRect )
+{
+ long nCount = (long)mpWinList->Count();
+ long nX = rRect.Left();
+ long nY = rRect.Top();
+ long nWidth = rRect.GetWidth();
+ long nHeight = rRect.GetHeight();
+ long nRectHeight = nHeight;
+ long nOver;
+ long nTempHeight;
+ Window* pWindow;
+
+ nHeight /= nCount;
+ if ( nHeight < 1 )
+ nHeight = 1;
+ nOver = nRectHeight - (nCount*nHeight);
+ pWindow = (Window*)mpWinList->First();
+ while ( pWindow )
+ {
+ nTempHeight = nHeight;
+ if ( nOver > 0 )
+ {
+ nTempHeight++;
+ nOver--;
+ }
+ ImplPosSizeWindow( pWindow, nX, nY, nWidth, nTempHeight );
+ nY += nTempHeight;
+
+ pWindow = (Window*)mpWinList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WindowArrange::ImplVert( const Rectangle& rRect )
+{
+ long nCount = (long)mpWinList->Count();
+ long nX = rRect.Left();
+ long nY = rRect.Top();
+ long nWidth = rRect.GetWidth();
+ long nHeight = rRect.GetHeight();
+ long nRectWidth = nWidth;
+ long nOver;
+ long nTempWidth;
+ Window* pWindow;
+
+ nWidth /= nCount;
+ if ( nWidth < 1 )
+ nWidth = 1;
+ nOver = nRectWidth - (nCount*nWidth);
+ pWindow = (Window*)mpWinList->First();
+ while ( pWindow )
+ {
+ nTempWidth = nWidth;
+ if ( nOver > 0 )
+ {
+ nTempWidth++;
+ nOver--;
+ }
+ ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nHeight );
+ nX += nTempWidth;
+
+ pWindow = (Window*)mpWinList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WindowArrange::ImplCascade( const Rectangle& rRect )
+{
+ long nX = rRect.Left();
+ long nY = rRect.Top();
+ long nWidth = rRect.GetWidth();
+ long nHeight = rRect.GetHeight();
+ long nRectWidth = nWidth;
+ long nRectHeight = nHeight;
+ long nOff;
+ long nCascadeWins;
+ long nLeftBorder;
+ long nTopBorder;
+ long nRightBorder;
+ long nBottomBorder;
+ long nStartOverWidth;
+ long nStartOverHeight;
+ long nOverWidth;
+ long nOverHeight;
+ long nTempX;
+ long nTempY;
+ long nTempWidth;
+ long nTempHeight;
+ long i;
+ Window* pWindow;
+ Window* pTempWindow;
+
+ // Border-Fenster suchen um den Versatz zu ermitteln
+ pTempWindow = (Window*)mpWinList->First();
+ pTempWindow->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
+ while ( !nTopBorder )
+ {
+ Window* pBrdWin = pTempWindow->GetWindow( WINDOW_REALPARENT );
+ if ( !pBrdWin || (pBrdWin->GetWindow( WINDOW_CLIENT ) != pTempWindow) )
+ break;
+ pTempWindow = pBrdWin;
+ pTempWindow->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
+ }
+ if ( !nTopBorder )
+ nTopBorder = 22;
+ nOff = nTopBorder;
+
+ nCascadeWins = nRectHeight / 3 / nOff;
+ if ( !nCascadeWins )
+ nCascadeWins = 1;
+ nWidth -= nCascadeWins*nOff;
+ nHeight -= nCascadeWins*nOff;
+ if ( nWidth < 1 )
+ nWidth = 1;
+ if ( nHeight < 1 )
+ nHeight = 1;
+
+ nStartOverWidth = nRectWidth-(nWidth+(nCascadeWins*nOff));
+ nStartOverHeight = nRectHeight-(nHeight+(nCascadeWins*nOff));
+
+ i = 0;
+ pWindow = (Window*)mpWinList->First();
+ while ( pWindow )
+ {
+ if ( !i )
+ {
+ nOverWidth = nStartOverWidth;
+ nOverHeight = nStartOverHeight;
+ }
+
+ // Position
+ nTempX = nX + (i*nOff);
+ nTempY = nY + (i*nOff);
+
+ // Ueberhang verteilen
+ nTempWidth = nWidth;
+ if ( nOverWidth > 0 )
+ {
+ nTempWidth++;
+ nOverWidth--;
+ }
+ nTempHeight = nHeight;
+ if ( nOverHeight > 0 )
+ {
+ nTempHeight++;
+ nOverHeight--;
+ }
+
+ ImplPosSizeWindow( pWindow, nTempX, nTempY, nTempWidth, nTempHeight );
+
+ if ( i < nCascadeWins )
+ i++;
+ else
+ i = 0;
+
+ pWindow = (Window*)mpWinList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WindowArrange::Arrange( USHORT nType, const Rectangle& rRect )
+{
+ if ( !mpWinList->Count() )
+ return;
+
+ switch ( nType )
+ {
+ case WINDOWARRANGE_TILE:
+ ImplTile( rRect );
+ break;
+ case WINDOWARRANGE_HORZ:
+ ImplHorz( rRect );
+ break;
+ case WINDOWARRANGE_VERT:
+ ImplVert( rRect );
+ break;
+ case WINDOWARRANGE_CASCADE:
+ ImplCascade( rRect );
+ break;
+ }
+}
+
diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx
new file mode 100644
index 000000000000..4c83b4bd09e9
--- /dev/null
+++ b/svtools/source/control/taskstat.cxx
@@ -0,0 +1,769 @@
+/*************************************************************************
+ *
+ * $RCSfile: taskstat.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TASKBAR_CXX
+
+#ifndef _TOOLS_LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+#ifndef _SV_SYSTEM_HXX
+#include <vcl/system.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <vcl/help.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#include <taskbar.hxx>
+
+// =======================================================================
+
+#define TASKSTATUSBAR_CLOCXOFFX 3
+#define TASKSTATUSBAR_IMAGEOFFX 1
+
+// =======================================================================
+
+struct ImplTaskSBFldItem
+{
+ TaskStatusFieldItem maItem;
+ USHORT mnId;
+ long mnOffX;
+};
+
+DECLARE_LIST( ImplTaskSBItemList, ImplTaskSBFldItem* );
+
+// =======================================================================
+
+BOOL ITaskStatusNotify::MouseButtonDown( USHORT nItemd, const MouseEvent& rMEvt )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ITaskStatusNotify::MouseButtonUp( USHORT nItemd, const MouseEvent& rMEvt )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ITaskStatusNotify::MouseMove( USHORT nItemd, const MouseEvent& rMEvt )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ITaskStatusNotify::Command( USHORT nItemd, const CommandEvent& rCEvt )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ITaskStatusNotify::QueryDrop( USHORT nItemd, DropEvent& rDEvt, BOOL& bRet )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ITaskStatusNotify::Drop( USHORT nItemd, const DropEvent& rDEvt, BOOL& bRet )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ITaskStatusNotify::UpdateHelp( USHORT nItemd )
+{
+ return FALSE;
+}
+
+// =======================================================================
+
+TaskStatusFieldItem::TaskStatusFieldItem()
+{
+ mpNotify = NULL;
+ mnFlags = 0;
+}
+
+// -----------------------------------------------------------------------
+
+TaskStatusFieldItem::TaskStatusFieldItem( const TaskStatusFieldItem& rItem ) :
+ mpNotify( rItem.mpNotify ),
+ maImage( rItem.maImage ),
+ maQuickHelpText( rItem.maQuickHelpText ),
+ maHelpText( rItem.maHelpText ),
+ mnFlags( rItem.mnFlags )
+{
+}
+
+// -----------------------------------------------------------------------
+
+TaskStatusFieldItem::TaskStatusFieldItem( ITaskStatusNotify* pNotify,
+ const Image& rImage,
+ const XubString& rQuickHelpText,
+ const XubString& rHelpText,
+ USHORT nFlags ) :
+ mpNotify( pNotify ),
+ maImage( rImage ),
+ maQuickHelpText( rQuickHelpText ),
+ maHelpText( rHelpText ),
+ mnFlags( nFlags )
+{
+}
+
+// -----------------------------------------------------------------------
+
+TaskStatusFieldItem::~TaskStatusFieldItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+const TaskStatusFieldItem& TaskStatusFieldItem::operator=( const TaskStatusFieldItem& rItem )
+{
+ mpNotify = rItem.mpNotify;
+ maImage = rItem.maImage;
+ maQuickHelpText = rItem.maQuickHelpText;
+ maHelpText = rItem.maHelpText;
+ mnFlags = rItem.mnFlags;
+ return *this;
+}
+
+// =======================================================================
+
+TaskStatusBar::TaskStatusBar( Window* pParent, WinBits nWinStyle ) :
+ StatusBar( pParent, nWinStyle | WB_3DLOOK ),
+ maTime( 0, 0, 0 )
+{
+ mpFieldItemList = NULL;
+ mpNotifyTaskBar = NULL;
+ mpNotify = NULL;
+ mnClockWidth = 0;
+ mnItemWidth = 0;
+ mnFieldWidth = 0;
+ mnFieldFlags = 0;
+ mbFlashItems = FALSE;
+ mbOutInterval = FALSE;
+
+ maTimer.SetTimeoutHdl( LINK( this, TaskStatusBar, ImplTimerHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+TaskStatusBar::~TaskStatusBar()
+{
+ if ( mpFieldItemList )
+ {
+ ImplTaskSBFldItem* pItem = mpFieldItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpFieldItemList->Next();
+ }
+
+ delete mpFieldItemList;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( TaskStatusBar, ImplTimerHdl, Timer*, EMPTYARG )
+{
+ BOOL bUpdate = ImplUpdateClock();
+ if ( ImplUpdateFlashItems() )
+ bUpdate = TRUE;
+ if ( bUpdate )
+ SetItemData( TASKSTATUSBAR_STATUSFIELDID, NULL );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplTaskSBFldItem* TaskStatusBar::ImplGetFieldItem( USHORT nItemId ) const
+{
+ if ( !mpFieldItemList )
+ return NULL;
+
+ ImplTaskSBFldItem* pItem = mpFieldItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nItemId )
+ return pItem;
+
+ pItem = mpFieldItemList->Next();
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplTaskSBFldItem* TaskStatusBar::ImplGetFieldItem( const Point& rPos, BOOL& rFieldRect ) const
+{
+ if ( GetItemId( rPos ) == TASKSTATUSBAR_STATUSFIELDID )
+ {
+ rFieldRect = TRUE;
+
+ if ( mpFieldItemList )
+ {
+ long nX = rPos.X()-GetItemRect( TASKSTATUSBAR_STATUSFIELDID ).Left();
+ ImplTaskSBFldItem* pItem = mpFieldItemList->First();
+ while ( pItem )
+ {
+ if ( nX < pItem->mnOffX+pItem->maItem.GetImage().GetSizePixel().Width() )
+ return pItem;
+
+ pItem = mpFieldItemList->Next();
+ }
+ }
+ }
+ else
+ rFieldRect = FALSE;
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TaskStatusBar::ImplUpdateClock()
+{
+ if ( mnFieldFlags & TASKSTATUSFIELD_CLOCK )
+ {
+ Time aTime;
+ maTimer.SetTimeout( ((long)60000)-((aTime.GetSec()*1000)+(aTime.Get100Sec()*10)) );
+ if ( (aTime.GetMin() != maTime.GetMin()) ||
+ (aTime.GetHour() != maTime.GetHour()) )
+ {
+ maTime = aTime;
+ maTimeText = maIntn.GetTime( aTime, FALSE, FALSE );
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TaskStatusBar::ImplUpdateFlashItems()
+{
+ if ( mbFlashItems )
+ {
+ if ( mbOutInterval )
+ {
+ maTimer.SetTimeout( 900 );
+ mbOutInterval = FALSE;
+ }
+ else
+ {
+ maTimer.SetTimeout( 700 );
+ mbOutInterval = TRUE;
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::ImplUpdateField( BOOL bItems )
+{
+ maTimer.Stop();
+
+ if ( bItems )
+ {
+ ImplTaskSBFldItem* pItem = mpFieldItemList->First();
+ mnItemWidth = 0;
+ mbFlashItems = FALSE;
+ mbOutInterval = FALSE;
+ while ( pItem )
+ {
+ mnItemWidth += TASKSTATUSBAR_IMAGEOFFX;
+ pItem->mnOffX = mnItemWidth;
+ mnItemWidth += pItem->maItem.GetImage().GetSizePixel().Width();
+ if ( pItem->maItem.GetFlags() & TASKSTATUSFIELDITEM_FLASH )
+ mbFlashItems = TRUE;
+
+ pItem = mpFieldItemList->Next();
+ }
+ }
+ else
+ {
+ if ( mnFieldFlags & TASKSTATUSFIELD_CLOCK )
+ {
+ XubString aStr = maIntn.GetTime( Time( 23, 59, 59 ), FALSE, FALSE );
+ mnClockWidth = GetTextWidth( aStr )+(TASKSTATUSBAR_CLOCXOFFX*2);
+ }
+ else
+ mnClockWidth = 0;
+ }
+
+ long nNewWidth = mnItemWidth+mnClockWidth;
+ if ( mnItemWidth && !mnClockWidth )
+ nNewWidth += TASKSTATUSBAR_IMAGEOFFX;
+ if ( nNewWidth != mnFieldWidth )
+ {
+ RemoveItem( TASKSTATUSBAR_STATUSFIELDID );
+
+ if ( mnItemWidth || mnClockWidth )
+ {
+ mnFieldWidth = nNewWidth;
+ long nOffset = GetItemOffset( TASKSTATUSBAR_STATUSFIELDID );
+ USHORT nItemPos = GetItemPos( TASKSTATUSBAR_STATUSFIELDID );
+ InsertItem( TASKSTATUSBAR_STATUSFIELDID, nNewWidth, SIB_RIGHT | SIB_IN | SIB_USERDRAW, nOffset, nItemPos );
+ }
+ else
+ mnFieldWidth = 0;
+
+ if ( mpNotifyTaskBar )
+ mpNotifyTaskBar->Resize();
+ }
+ else
+ SetItemData( TASKSTATUSBAR_STATUSFIELDID, NULL );
+
+ if ( mbFlashItems || (mnFieldFlags & TASKSTATUSFIELD_CLOCK) )
+ {
+ ImplUpdateClock();
+ mbOutInterval = TRUE;
+ ImplUpdateFlashItems();
+ maTimer.Start();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ BOOL bFieldRect;
+ BOOL bBaseClass = FALSE;
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( rMEvt.GetPosPixel(), bFieldRect );
+
+ ITaskStatusNotify* pNotify = mpNotify;
+ USHORT nItemId = 0;
+
+ if ( bFieldRect )
+ nItemId = TASKSTATUSBAR_CLOCKID;
+
+ if ( pItem )
+ {
+ pNotify = pItem->maItem.GetNotifyObject();
+ nItemId = pItem->mnId;
+ }
+
+ if ( pNotify )
+ bBaseClass = pNotify->MouseButtonDown( nItemId, rMEvt );
+
+ if ( bBaseClass )
+ StatusBar::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ BOOL bFieldRect;
+ BOOL bBaseClass = FALSE;
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( rMEvt.GetPosPixel(), bFieldRect );
+
+ ITaskStatusNotify* pNotify = mpNotify;
+ USHORT nItemId = 0;
+
+ if ( bFieldRect )
+ nItemId = TASKSTATUSBAR_CLOCKID;
+
+ if ( pItem )
+ {
+ pNotify = pItem->maItem.GetNotifyObject();
+ nItemId = pItem->mnId;
+ }
+
+ if ( pNotify )
+ bBaseClass = pNotify->MouseButtonUp( nItemId, rMEvt );
+
+ if ( bBaseClass )
+ StatusBar::MouseButtonUp( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::MouseMove( const MouseEvent& rMEvt )
+{
+ BOOL bFieldRect;
+ BOOL bBaseClass = FALSE;
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( rMEvt.GetPosPixel(), bFieldRect );
+
+ ITaskStatusNotify* pNotify = mpNotify;
+ USHORT nItemId = 0;
+
+ if ( bFieldRect )
+ nItemId = TASKSTATUSBAR_CLOCKID;
+
+ if ( pItem )
+ {
+ pNotify = pItem->maItem.GetNotifyObject();
+ nItemId = pItem->mnId;
+ }
+
+ if ( pNotify )
+ bBaseClass = pNotify->MouseMove( nItemId, rMEvt );
+
+ if ( bBaseClass )
+ StatusBar::MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::Command( const CommandEvent& rCEvt )
+{
+ BOOL bFieldRect;
+ BOOL bBaseClass = FALSE;
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( rCEvt.GetMousePosPixel(), bFieldRect );
+
+ ITaskStatusNotify* pNotify = mpNotify;
+ USHORT nItemId = 0;
+
+ if ( bFieldRect )
+ nItemId = TASKSTATUSBAR_CLOCKID;
+
+ if ( pItem )
+ {
+ pNotify = pItem->maItem.GetNotifyObject();
+ nItemId = pItem->mnId;
+ }
+
+ if ( pNotify )
+ bBaseClass = pNotify->Command( nItemId, rCEvt );
+
+ if ( bBaseClass )
+ StatusBar::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TaskStatusBar::QueryDrop( DropEvent& rDEvt )
+{
+ BOOL bFieldRect;
+ BOOL bBaseClass = FALSE;
+ BOOL bRet = FALSE;
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( rDEvt.GetPosPixel(), bFieldRect );
+
+ ITaskStatusNotify* pNotify = mpNotify;
+ USHORT nItemId = 0;
+
+ if ( bFieldRect )
+ nItemId = TASKSTATUSBAR_CLOCKID;
+
+ if ( pItem )
+ {
+ pNotify = pItem->maItem.GetNotifyObject();
+ nItemId = pItem->mnId;
+ }
+
+ if ( pNotify )
+ bBaseClass = pNotify->QueryDrop( nItemId, rDEvt, bRet );
+
+ if ( bBaseClass )
+ {
+ StatusBar::QueryDrop( rDEvt );
+ return TRUE;
+ }
+ else
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TaskStatusBar::Drop( const DropEvent& rDEvt )
+{
+ BOOL bFieldRect;
+ BOOL bBaseClass = FALSE;
+ BOOL bRet = FALSE;
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( rDEvt.GetPosPixel(), bFieldRect );
+
+ ITaskStatusNotify* pNotify = mpNotify;
+ USHORT nItemId = 0;
+
+ if ( bFieldRect )
+ nItemId = TASKSTATUSBAR_CLOCKID;
+
+ if ( pItem )
+ {
+ pNotify = pItem->maItem.GetNotifyObject();
+ nItemId = pItem->mnId;
+ }
+
+ if ( pNotify )
+ bBaseClass = pNotify->Drop( nItemId, rDEvt, bRet );
+
+ if ( bBaseClass )
+ return StatusBar::Drop( rDEvt );
+ else
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::RequestHelp( const HelpEvent& rHEvt )
+{
+ BOOL bFieldRect;
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ), bFieldRect );
+ if ( bFieldRect )
+ {
+ ITaskStatusNotify* pNotify = mpNotify;
+ USHORT nItemId = 0;
+
+ if ( pItem )
+ {
+ pNotify = pItem->maItem.GetNotifyObject();
+ nItemId = pItem->mnId;
+ }
+
+ if ( pNotify )
+ pNotify->UpdateHelp( nItemId );
+
+ if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) )
+ {
+ Rectangle aItemRect = GetItemRect( TASKSTATUSBAR_STATUSFIELDID );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ if ( pItem )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ {
+ XubString aStr = pItem->maItem.GetHelpText();
+ if ( !aStr.Len() )
+ aStr = pItem->maItem.GetQuickHelpText();
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
+ }
+ else
+ Help::ShowQuickHelp( this, aItemRect, pItem->maItem.GetQuickHelpText() );
+ }
+ else
+ {
+ XubString aStr = maIntn.GetLongDate( Date() );
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
+ else
+ Help::ShowQuickHelp( this, aItemRect, aStr );
+ }
+ return;
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
+ {
+ if ( pItem )
+ {
+ ULONG nHelpId = pItem->maItem.GetHelpId();
+ if ( nHelpId )
+ {
+ // Wenn eine Hilfe existiert, dann ausloesen
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pHelp->Start( nHelpId );
+ return;
+ }
+ }
+ }
+ }
+
+ StatusBar::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ if ( rUDEvt.GetItemId() == TASKSTATUSBAR_STATUSFIELDID )
+ {
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ Rectangle aRect = rUDEvt.GetRect();
+
+ if ( mpFieldItemList )
+ {
+ ImplTaskSBFldItem* pItem = mpFieldItemList->First();
+ while ( pItem )
+ {
+ if ( !mbOutInterval || !(pItem->maItem.GetFlags() & TASKSTATUSFIELDITEM_FLASH) )
+ {
+ const Image& rImage = pItem->maItem.GetImage();
+ Size aImgSize = rImage.GetSizePixel();
+ pDev->DrawImage( Point( aRect.Left()+pItem->mnOffX,
+ aRect.Top()+((aRect.GetHeight()-aImgSize.Width())/2) ),
+ rImage );
+ }
+
+ pItem = mpFieldItemList->Next();
+ }
+ }
+
+ if ( mnFieldFlags & TASKSTATUSFIELD_CLOCK )
+ {
+ long nX = mnItemWidth+TASKSTATUSBAR_CLOCXOFFX;
+ Point aPos = GetItemTextPos( TASKSTATUSBAR_STATUSFIELDID );
+ aPos.X() = aRect.Left()+nX;
+ pDev->DrawText( aPos, maTimeText );
+ }
+ }
+ else
+ StatusBar::UserDraw( rUDEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::InsertStatusField( long nOffset, USHORT nPos,
+ USHORT nFlags )
+{
+ mnFieldFlags = nFlags;
+ ImplUpdateField( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::SetFieldFlags( USHORT nFlags )
+{
+ if ( mnFieldFlags != nFlags )
+ {
+ mnFieldFlags = nFlags;
+ ImplUpdateField( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::AddStatusFieldItem( USHORT nItemId, const TaskStatusFieldItem& rItem,
+ USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "TaskStatusBar::AddStatusFieldItem() - Item is 0" );
+ DBG_ASSERT( !ImplGetFieldItem( nItemId ), "TaskStatusBar::AddStatusFieldItem() - Item-Id already exist" );
+
+ if ( !mpFieldItemList )
+ mpFieldItemList = new ImplTaskSBItemList;
+
+ ImplTaskSBFldItem* pItem = new ImplTaskSBFldItem;
+ pItem->maItem = rItem;
+ pItem->mnId = nItemId;
+ pItem->mnOffX = 0;
+ mpFieldItemList->Insert( pItem, (ULONG)nPos );
+
+ ImplUpdateField( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::ModifyStatusFieldItem( USHORT nItemId, const TaskStatusFieldItem& rItem )
+{
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId );
+ if ( pItem )
+ {
+ BOOL bUpdate = (pItem->maItem.GetImage() != rItem.GetImage()) ||
+ (pItem->maItem.GetFlags() != rItem.GetFlags());
+ pItem->maItem = rItem;
+ if ( bUpdate )
+ ImplUpdateField( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TaskStatusBar::RemoveStatusFieldItem( USHORT nItemId )
+{
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId );
+ if ( pItem )
+ {
+ mpFieldItemList->Remove( pItem );
+ delete pItem;
+ ImplUpdateField( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TaskStatusBar::GetStatusFieldItem( USHORT nItemId, TaskStatusFieldItem& rItem ) const
+{
+ ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId );
+ if ( pItem )
+ {
+ rItem = pItem->maItem;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
new file mode 100644
index 000000000000..79f0acb6a098
--- /dev/null
+++ b/svtools/source/control/valueset.cxx
@@ -0,0 +1,2461 @@
+/*************************************************************************
+ *
+ * $RCSfile: valueset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifdef VCL
+#ifndef _SV_DECOVIEW_HXX
+#include <vcl/decoview.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _IMAGE_HXX
+#include <vcl/image.hxx>
+#endif
+#ifndef _SCRBAR_HXX
+#include <vcl/scrbar.hxx>
+#endif
+#ifndef _HELP_HXX
+#include <vcl/help.hxx>
+#endif
+
+#define _SV_VALUESET_CXX
+#define private public
+#include <valueset.hxx>
+
+// =======================================================================
+
+#define ITEM_OFFSET 4
+#define ITEM_OFFSET_DOUBLE 6
+#define NAME_OFFSET 2
+#define NAME_OFFSET_FLAT 1
+#define SCRBAR_OFFSET 2
+#define VALUESET_ITEM_NONEITEM 0xFFFE
+
+#define VALUESET_SCROLL_OFFSET 4
+
+enum ValueSetItemType { VALUESETITEM_NONE, VALUESETITEM_IMAGE,
+ VALUESETITEM_COLOR, VALUESETITEM_USERDRAW,
+ VALUESETITEM_SPACE };
+
+struct ValueSetItem
+{
+ USHORT mnId;
+ USHORT mnBits;
+ ValueSetItemType meType;
+ Image maImage;
+ Color maColor;
+ XubString maText;
+ void* mpData;
+ Rectangle maRect;
+
+ ValueSetItem();
+ ~ValueSetItem();
+};
+
+DECLARE_LIST( ValueItemList, ValueSetItem* );
+
+// =======================================================================
+
+ValueSetItem::ValueSetItem()
+{
+ mnBits = 0;
+ mpData = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ValueSetItem::~ValueSetItem()
+{
+}
+
+// =======================================================================
+
+void ValueSet::ImplInit( WinBits nWinStyle )
+{
+ Size aWinSize = GetSizePixel();
+ mpItemList = new ValueItemList;
+ mpNoneItem = NULL;
+ mpScrBar = NULL;
+ mnTextOffset = 0;
+ mnVisLines = 0;
+ mnLines = 0;
+ mnUserItemWidth = 0;
+ mnUserItemHeight = 0;
+ mnFirstLine = 0;
+ mnOldItemId = 0;
+ mnSelItemId = 0;
+ mnHighItemId = 0;
+ mnDropPos = VALUESET_ITEM_NOTFOUND;
+ mnCols = 0;
+ mnCurCol = 0;
+ mnUserCols = 0;
+ mnUserVisLines = 0;
+ mnSpacing = 0;
+ mnFrameStyle = 0;
+ mbFormat = TRUE;
+ mbHighlight = FALSE;
+ mbSelection = FALSE;
+ mbNoSelection = TRUE;
+ mbDrawSelection = TRUE;
+ mbBlackSel = FALSE;
+ mbDoubleSel = FALSE;
+ mbScroll = FALSE;
+ mbDropPos = FALSE;
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+ValueSet::ValueSet( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ maVirDev( *this ),
+ maColor( COL_TRANSPARENT )
+{
+ ImplInit( nWinStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ValueSet::ValueSet( Window* pParent, const ResId& rResId ) :
+ Control( pParent, rResId ),
+ maVirDev( *this ),
+ maColor( COL_TRANSPARENT )
+{
+ ImplInit( rResId.aWinBits );
+}
+
+// -----------------------------------------------------------------------
+
+ValueSet::~ValueSet()
+{
+ if ( mpScrBar )
+ delete mpScrBar;
+
+ if ( mpNoneItem )
+ delete mpNoneItem;
+
+ ValueSetItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+ delete mpItemList;
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont;
+ aFont = rStyleSettings.GetAppFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( GetStyle() & WB_FLATVALUESET )
+ aColor = rStyleSettings.GetWindowColor();
+ else
+ aColor = rStyleSettings.GetFaceColor();
+ SetBackground( aColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplInitScrollBar()
+{
+ if ( GetStyle() & WB_VSCROLL )
+ {
+ if ( !mpScrBar )
+ {
+ mpScrBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG );
+ mpScrBar->SetScrollHdl( LINK( this, ValueSet, ImplScrollHdl ) );
+ }
+ else
+ {
+ // Wegen Einstellungsaenderungen passen wir hier die Breite an
+ long nScrBarWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ mpScrBar->SetPosSizePixel( 0, 0, nScrBarWidth, 0, WINDOW_POSSIZE_WIDTH );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplFormatItem( ValueSetItem* pItem )
+{
+ if ( pItem->meType == VALUESETITEM_SPACE )
+ return;
+
+ Rectangle aRect = pItem->maRect;
+ WinBits nStyle = GetStyle();
+ if ( nStyle & WB_ITEMBORDER )
+ {
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ if ( nStyle & WB_FLATVALUESET )
+ {
+ if ( nStyle & WB_DOUBLEBORDER )
+ {
+ aRect.Left() += 2;
+ aRect.Top() += 2;
+ aRect.Right() -= 2;
+ aRect.Bottom() -= 2;
+ }
+ else
+ {
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ }
+ }
+ else
+ {
+ DecorationView aView( &maVirDev );
+ aRect = aView.DrawFrame( aRect, mnFrameStyle );
+ }
+ }
+
+ if ( pItem == mpNoneItem )
+ pItem->maText = GetText();
+
+ if ( (aRect.GetHeight() > 0) && (aRect.GetWidth() > 0) )
+ {
+ if ( pItem == mpNoneItem )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ maVirDev.SetFont( GetFont() );
+ maVirDev.SetTextColor( rStyleSettings.GetWindowTextColor() );
+ maVirDev.SetTextFillColor();
+ maVirDev.SetFillColor( rStyleSettings.GetWindowColor() );
+ maVirDev.DrawRect( aRect );
+ Point aTxtPos( aRect.Left()+2, aRect.Top() );
+ long nTxtWidth = GetTextWidth( pItem->maText );
+ if ( nStyle & WB_RADIOSEL )
+ {
+ aTxtPos.X() += 4;
+ aTxtPos.Y() += 4;
+ }
+ if ( (aTxtPos.X()+nTxtWidth) > aRect.Right() )
+ {
+ maVirDev.SetClipRegion( Region( aRect ) );
+ maVirDev.DrawText( aTxtPos, pItem->maText );
+ maVirDev.SetClipRegion();
+ }
+ else
+ maVirDev.DrawText( aTxtPos, pItem->maText );
+ }
+ else if ( pItem->meType == VALUESETITEM_COLOR )
+ {
+ maVirDev.SetFillColor( pItem->maColor );
+ maVirDev.DrawRect( aRect );
+ }
+ else
+ {
+ if ( IsColor() )
+ maVirDev.SetFillColor( maColor );
+ else
+ maVirDev.SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() );
+ maVirDev.DrawRect( aRect );
+
+ if ( pItem->meType == VALUESETITEM_USERDRAW )
+ {
+ UserDrawEvent aUDEvt( &maVirDev, aRect, pItem->mnId );
+ UserDraw( aUDEvt );
+ }
+ else
+ {
+ Size aImageSize = pItem->maImage.GetSizePixel();
+ Size aRectSize = aRect.GetSize();
+ Point aPos( aRect.Left(), aRect.Top() );
+ aPos.X() += (aRectSize.Width()-aImageSize.Width())/2;
+ aPos.Y() += (aRectSize.Height()-aImageSize.Height())/2;
+ if ( (aImageSize.Width() > aRectSize.Width()) ||
+ (aImageSize.Height() > aRectSize.Height()) )
+ {
+ maVirDev.SetClipRegion( Region( aRect ) );
+ maVirDev.DrawImage( aPos, pItem->maImage );
+ maVirDev.SetClipRegion();
+ }
+ else
+ maVirDev.DrawImage( aPos, pItem->maImage );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::Format()
+{
+ Size aWinSize = GetOutputSizePixel();
+ Size aOrgWinSize = aWinSize;
+ ULONG nItemCount = mpItemList->Count();
+ WinBits nStyle = GetStyle();
+ long nTxtHeight = GetTextHeight();
+ long nStartX;
+ long nY;
+ long nNameOff;
+ long nOff;
+ long nSpace;
+ long nNoneSpace;
+ ScrollBar* pDelScrBar = NULL;
+
+ // Scrolling beruecksichtigen
+ if ( nStyle & WB_VSCROLL )
+ ImplInitScrollBar();
+ else
+ {
+ if ( mpScrBar )
+ {
+ // ScrollBar erst spaeter zerstoeren, damit keine rekursiven
+ // Aufrufe entstehen koennen
+ pDelScrBar = mpScrBar;
+ mpScrBar = NULL;
+ }
+ }
+
+ // Item-Offset berechnen
+ if ( nStyle & WB_ITEMBORDER )
+ {
+ if ( nStyle & WB_DOUBLEBORDER )
+ nOff = ITEM_OFFSET_DOUBLE;
+ else
+ nOff = ITEM_OFFSET;
+ }
+ else
+ nOff = 0;
+ nSpace = mnSpacing;
+
+ // Groesse beruecksichtigen, wenn NameField vorhanden
+ if ( nStyle & WB_NAMEFIELD )
+ {
+ long nNameOffset = (nStyle & WB_FLATVALUESET) ? NAME_OFFSET_FLAT : NAME_OFFSET;
+ aWinSize.Height() -= nTxtHeight+(nNameOffset*2);
+ nNameOff = nNameOffset+2+nSpace;
+ }
+ else
+ nNameOff = 0;
+
+ // Offset und Groesse beruecksichtigen, wenn NoneField vorhanden
+ if ( nStyle & WB_NONEFIELD )
+ {
+ nY = nTxtHeight+nOff;
+ nNoneSpace = nSpace;
+ if ( nStyle & WB_RADIOSEL )
+ nY += 8;
+ }
+ else
+ {
+ nY = 0;
+ nNoneSpace = 0;
+ }
+
+ // Breite vom ScrollBar berechnen
+ long nScrBarWidth = 0;
+ if ( mpScrBar )
+ nScrBarWidth = mpScrBar->GetSizePixel().Width()+SCRBAR_OFFSET;
+
+ // Spaltenanzahl berechnen
+ if ( !mnUserCols )
+ {
+ if ( mnUserItemWidth )
+ {
+ mnCols = (USHORT)((aWinSize.Width()-nScrBarWidth+nSpace) / (mnUserItemWidth+nSpace));
+ if ( !mnCols )
+ mnCols = 1;
+ }
+ else
+ mnCols = 1;
+ }
+ else
+ mnCols = mnUserCols;
+
+ // Zeilenanzahl berechnen
+ mbScroll = FALSE;
+ mnLines = (long)mpItemList->Count() / mnCols;
+ if ( mpItemList->Count() % mnCols )
+ mnLines++;
+ else if ( !mnLines )
+ mnLines = 1;
+
+ long nCalcHeight = aWinSize.Height()-nY-nNameOff;
+ if ( mnUserVisLines )
+ mnVisLines = mnUserVisLines;
+ else if ( mnUserItemHeight )
+ {
+ mnVisLines = (nCalcHeight-nNoneSpace+nSpace) / (mnUserItemHeight+nSpace);
+ if ( !mnVisLines )
+ mnVisLines = 1;
+ }
+ else
+ mnVisLines = mnLines;
+ if ( mnLines > mnVisLines )
+ mbScroll = TRUE;
+ if ( mnLines <= mnVisLines )
+ mnFirstLine = 0;
+ else
+ {
+ if ( mnFirstLine > (USHORT)(mnLines-mnVisLines) )
+ mnFirstLine = (USHORT)(mnLines-mnVisLines);
+ }
+
+ // Itemgroessen berechnen
+ long nColSpace = (mnCols-1)*nSpace;
+ long nLineSpace = ((mnVisLines-1)*nSpace)+nNoneSpace;
+ long nItemWidth;
+ long nItemHeight;
+ if ( mnUserItemWidth && !mnUserCols )
+ {
+ nItemWidth = mnUserItemWidth;
+ if ( nItemWidth > aWinSize.Width()-nScrBarWidth-nColSpace )
+ nItemWidth = aWinSize.Width()-nScrBarWidth-nColSpace;
+ }
+ else
+ nItemWidth = (aWinSize.Width()-nScrBarWidth-nColSpace) / mnCols;
+ if ( mnUserItemHeight && !mnUserVisLines )
+ {
+ nItemHeight = mnUserItemHeight;
+ if ( nItemHeight > nCalcHeight-nNoneSpace )
+ nItemHeight = nCalcHeight-nNoneSpace;
+ }
+ else
+ {
+ nCalcHeight -= nLineSpace;
+ nItemHeight = nCalcHeight / mnVisLines;
+ }
+
+ // Windowgroessen runden und virtuelles Device anlegen
+ aWinSize.Width() = (nItemWidth*mnCols)+nColSpace+nScrBarWidth;
+ aWinSize.Height() = (nItemHeight*mnVisLines)+nY+nNameOff+nLineSpace;
+ nStartX = (aOrgWinSize.Width()-aWinSize.Width())/2;
+ maVirDev.SetSettings( GetSettings() );
+ maVirDev.SetBackground( GetBackground() );
+ maVirDev.SetOutputSizePixel( Size( aOrgWinSize.Width(),
+ aWinSize.Height() ), TRUE );
+
+ // Bei zu kleinen Items machen wir nichts
+ long nMinHeight = 2;
+ if ( nStyle & WB_ITEMBORDER )
+ nMinHeight = 4;
+ if ( (nItemWidth <= 0) || (nItemHeight <= nMinHeight) || !nItemCount )
+ {
+ for ( ULONG i = 0; i < nItemCount; i++ )
+ {
+ ValueSetItem* pItem = mpItemList->GetObject( i );
+ pItem->maRect.SetEmpty();
+ }
+
+ if ( nStyle & WB_NONEFIELD )
+ {
+ if ( mpNoneItem )
+ {
+ mpNoneItem->maRect.SetEmpty();
+ mpNoneItem->maText = GetText();
+ }
+ }
+ else
+ {
+ if ( mpNoneItem )
+ {
+ delete mpNoneItem;
+ mpNoneItem = NULL;
+ }
+ }
+
+ if ( mpScrBar )
+ mpScrBar->Hide();
+ }
+ else
+ {
+ // Frame-Style ermitteln
+ if ( nStyle & WB_DOUBLEBORDER )
+ mnFrameStyle = FRAME_DRAW_DOUBLEIN;
+ else
+ mnFrameStyle = FRAME_DRAW_IN;
+
+ // Selektionsfarben und -breiten ermitteln
+ // Gegebenenfalls die Farben anpassen, damit man die Selektion besser
+ // erkennen kann
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Color aHighColor( rStyleSettings.GetHighlightColor() );
+ if ( ((aHighColor.GetRed() > 0x80) || (aHighColor.GetGreen() > 0x80) ||
+ (aHighColor.GetBlue() > 0x80)) ||
+ ((aHighColor.GetRed() == 0x80) && (aHighColor.GetGreen() == 0x80) &&
+ (aHighColor.GetBlue() == 0x80)) )
+ mbBlackSel = TRUE;
+ else
+ mbBlackSel = FALSE;
+
+ // Wenn die Items groesser sind, dann die Selektion doppelt so breit
+ // zeichnen
+ if ( (nStyle & WB_DOUBLEBORDER) &&
+ ((nItemWidth >= 25) && (nItemHeight >= 20)) )
+ mbDoubleSel = TRUE;
+ else
+ mbDoubleSel = FALSE;
+
+ // Trennlinie zum Namefield zeichnen
+ if ( nStyle & WB_NAMEFIELD )
+ {
+ if ( !(nStyle & WB_FLATVALUESET) )
+ {
+ Point aPos1( nStartX+ITEM_OFFSET, aWinSize.Height()-2 );
+ Point aPos2( nStartX+aWinSize.Width()-ITEM_OFFSET-1,
+ aWinSize.Height()-2 );
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ maVirDev.SetLineColor( rStyleSettings.GetShadowColor() );
+ maVirDev.DrawLine( aPos1, aPos2 );
+ aPos1.Y()++;
+ aPos2.Y()++;
+ maVirDev.SetLineColor( rStyleSettings.GetLightColor() );
+ }
+ else
+ maVirDev.SetLineColor( rStyleSettings.GetWindowTextColor() );
+ maVirDev.DrawLine( aPos1, aPos2 );
+ }
+
+ // TextOffset befindet sich unter der Kante
+ long nNameOffset = (nStyle & WB_FLATVALUESET) ? NAME_OFFSET_FLAT : NAME_OFFSET;
+ mnTextOffset = aWinSize.Height()+nNameOffset;
+ }
+
+ // Items berechnen und zeichnen
+ maVirDev.SetLineColor();
+ long x = nStartX;
+ long y = nY+nNoneSpace;
+ ULONG nFirstItem = mnFirstLine * mnCols;
+ ULONG nLastItem = nFirstItem + (mnVisLines * mnCols);
+ for ( ULONG i = 0; i < nItemCount; i++ )
+ {
+ ValueSetItem* pItem = mpItemList->GetObject( i );
+
+ if ( (i >= nFirstItem) && (i < nLastItem) )
+ {
+ pItem->maRect.Left() = x;
+ pItem->maRect.Top() = y;
+ pItem->maRect.Right() = pItem->maRect.Left()+nItemWidth-1;
+ pItem->maRect.Bottom() = pItem->maRect.Top()+nItemHeight-1;
+
+ ImplFormatItem( pItem );
+
+ if ( !((i+1) % mnCols) )
+ {
+ x = nStartX;
+ y += nItemHeight+nSpace;
+ }
+ else
+ x += nItemWidth+nSpace;
+ }
+ else
+ pItem->maRect.SetEmpty();
+ }
+
+ // NoSelection-Field erzeugen und anzeigen
+ if ( nStyle & WB_NONEFIELD )
+ {
+ if ( !mpNoneItem )
+ mpNoneItem = new ValueSetItem;
+
+ mpNoneItem->mnId = 0;
+ mpNoneItem->meType = VALUESETITEM_NONE;
+ mpNoneItem->maRect.Left() = nStartX;
+ mpNoneItem->maRect.Right() = mpNoneItem->maRect.Left()+aWinSize.Width()-1;
+ mpNoneItem->maRect.Bottom() = nY-1;
+
+ ImplFormatItem( mpNoneItem );
+ }
+ else
+ {
+ if ( mpNoneItem )
+ {
+ delete mpNoneItem;
+ mpNoneItem = NULL;
+ }
+ }
+
+ // ScrollBar anordnen, Werte setzen und anzeigen
+ if ( mpScrBar )
+ {
+ Point aPos( nStartX+(nItemWidth*mnCols)+nColSpace+SCRBAR_OFFSET,
+ nY+nNoneSpace+1 );
+ Size aSize( nScrBarWidth-SCRBAR_OFFSET,
+ ((nItemHeight+nSpace)*mnVisLines)-2-nSpace );
+ mpScrBar->SetPosSizePixel( aPos, aSize );
+ mpScrBar->SetRangeMax( mnLines );
+ mpScrBar->SetVisibleSize( mnVisLines );
+ mpScrBar->SetThumbPos( (long)mnFirstLine );
+ long nPageSize = mnVisLines;
+ if ( nPageSize < 1 )
+ nPageSize = 1;
+ mpScrBar->SetPageSize( nPageSize );
+ mpScrBar->Show();
+ }
+ }
+
+ // Jetzt haben wir formatiert und warten auf das naechste
+ mbFormat = FALSE;
+
+ // ScrollBar loeschen
+ if ( pDelScrBar )
+ delete pDelScrBar;
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplDrawItemText( const XubString& rText )
+{
+ if ( !(GetStyle() & WB_NAMEFIELD) )
+ return;
+
+ Size aWinSize = GetOutputSizePixel();
+ long nTxtWidth = GetTextWidth( rText );
+
+ // Rechteck loeschen und Text ausgeben
+ if ( GetStyle() & WB_FLATVALUESET )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetFaceColor() );
+ DrawRect( Rectangle( Point( 0, mnTextOffset ), Point( aWinSize.Width(), aWinSize.Height() ) ) );
+ SetTextColor( rStyleSettings.GetButtonTextColor() );
+ }
+ else
+ Erase( Rectangle( Point( 0, mnTextOffset ), Point( aWinSize.Width(), aWinSize.Height() ) ) );
+ DrawText( Point( (aWinSize.Width()-nTxtWidth) / 2, mnTextOffset ), rText );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplDrawSelect()
+{
+ if ( !IsReallyVisible() )
+ return;
+
+ BOOL bFocus = HasFocus();
+ BOOL bDrawSel;
+
+ if ( (mbNoSelection && !mbHighlight) || (!mbDrawSelection && mbHighlight) )
+ bDrawSel = FALSE;
+ else
+ bDrawSel = TRUE;
+
+ if ( !bFocus &&
+ ((mbNoSelection && !mbHighlight) || (!mbDrawSelection && mbHighlight)) )
+ {
+ XubString aEmptyStr;
+ ImplDrawItemText( aEmptyStr );
+ return;
+ }
+
+ USHORT nItemId = mnSelItemId;
+
+ if ( mbHighlight )
+ nItemId = mnHighItemId;
+
+ ValueSetItem* pItem;
+ if ( nItemId )
+ pItem = mpItemList->GetObject( GetItemPos( nItemId ) );
+ else
+ {
+ if ( mpNoneItem )
+ pItem = mpNoneItem;
+ else
+ {
+ pItem = ImplGetFirstItem();
+ if ( !bFocus || !pItem )
+ return;
+ }
+ }
+
+ if ( pItem->maRect.IsEmpty() )
+ return;
+
+ // Selection malen
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aRect = pItem->maRect;
+ Control::SetFillColor();
+
+ // Selectionsausgabe festlegen
+ WinBits nStyle = GetStyle();
+ if ( nStyle & WB_RADIOSEL )
+ {
+ aRect.Left() += 3;
+ aRect.Top() += 3;
+ aRect.Right() -= 3;
+ aRect.Bottom() -= 3;
+ if ( nStyle & WB_DOUBLEBORDER )
+ {
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ }
+
+ if ( bFocus )
+ ShowFocus( aRect );
+
+ if ( bDrawSel )
+ {
+ SetLineColor( rStyleSettings.GetHighlightColor() );
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ DrawRect( aRect );
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ DrawRect( aRect );
+ }
+ }
+ else
+ {
+ if ( bDrawSel )
+ {
+ if ( mbBlackSel )
+ SetLineColor( Color( COL_BLACK ) );
+ else
+ SetLineColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( aRect );
+ }
+ if ( mbDoubleSel )
+ {
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ if ( bDrawSel )
+ DrawRect( aRect );
+ }
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ Rectangle aRect2 = aRect;
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ if ( bDrawSel )
+ DrawRect( aRect );
+ if ( mbDoubleSel )
+ {
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ if ( bDrawSel )
+ DrawRect( aRect );
+ }
+
+ if ( bDrawSel )
+ {
+ if ( mbBlackSel )
+ SetLineColor( Color( COL_WHITE ) );
+ else
+ SetLineColor( rStyleSettings.GetHighlightTextColor() );
+ }
+ else
+ SetLineColor( Color( COL_LIGHTGRAY ) );
+ DrawRect( aRect2 );
+
+ if ( bFocus )
+ ShowFocus( aRect2 );
+ }
+
+ ImplDrawItemText( pItem->maText );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplHideSelect( USHORT nItemId )
+{
+ Rectangle aRect;
+
+ if ( nItemId )
+ aRect = mpItemList->GetObject( GetItemPos( nItemId ) )->maRect;
+ else
+ {
+ if ( mpNoneItem )
+ aRect = mpNoneItem->maRect;
+ }
+
+ if ( !aRect.IsEmpty() )
+ {
+ HideFocus();
+ Point aPos = aRect.TopLeft();
+ Size aSize = aRect.GetSize();
+ DrawOutDev( aPos, aSize, aPos, aSize, maVirDev );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplHighlightItem( USHORT nItemId, BOOL bIsSelection )
+{
+ if ( mnHighItemId != nItemId )
+ {
+ // Alten merken, um vorherige Selektion zu entfernen
+ USHORT nOldItem = mnHighItemId;
+ mnHighItemId = nItemId;
+
+ // Wenn keiner selektiert ist, dann Selektion nicht malen
+ if ( !bIsSelection && mbNoSelection )
+ mbDrawSelection = FALSE;
+
+ // Neu ausgeben und alte Selection wegnehmen
+ ImplHideSelect( nOldItem );
+ ImplDrawSelect();
+ mbDrawSelection = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplDrawDropPos( BOOL bShow )
+{
+ if ( (mnDropPos != VALUESET_ITEM_NOTFOUND) && mpItemList->Count() )
+ {
+ USHORT nItemPos = mnDropPos;
+ USHORT nItemId1;
+ USHORT nItemId2 = 0;
+ BOOL bRight;
+ if ( nItemPos >= mpItemList->Count() )
+ {
+ nItemPos = (USHORT)(mpItemList->Count()-1);
+ bRight = TRUE;
+ }
+ else
+ bRight = FALSE;
+
+ nItemId1 = GetItemId( nItemPos );
+ if ( (nItemId1 != mnSelItemId) && (nItemId1 != mnHighItemId) )
+ nItemId1 = 0;
+ Rectangle aRect2 = mpItemList->GetObject( nItemPos )->maRect;
+ Rectangle aRect1;
+ if ( bRight )
+ {
+ aRect1 = aRect2;
+ aRect2.SetEmpty();
+ }
+ else if ( nItemPos > 0 )
+ {
+ aRect1 = mpItemList->GetObject( nItemPos-1 )->maRect;
+ nItemId2 = GetItemId( nItemPos-1 );
+ if ( (nItemId2 != mnSelItemId) && (nItemId2 != mnHighItemId) )
+ nItemId2 = 0;
+ }
+
+ // Items ueberhaupt sichtbar (nur Erstes/Letztes)
+ if ( !aRect1.IsEmpty() || !aRect2.IsEmpty() )
+ {
+ if ( nItemId1 )
+ ImplHideSelect( nItemId1 );
+ if ( nItemId2 )
+ ImplHideSelect( nItemId2 );
+
+ if ( bShow )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ long nX;
+ long nY;
+ SetLineColor( rStyleSettings.GetButtonTextColor() );
+ if ( !aRect1.IsEmpty() )
+ {
+ Point aPos = aRect1.RightCenter();
+ nX = aPos.X()-2;
+ nY = aPos.Y();
+ for ( USHORT i = 0; i < 4; i++ )
+ DrawLine( Point( nX-i, nY-i ), Point( nX-i, nY+i ) );
+ }
+ if ( !aRect2.IsEmpty() )
+ {
+ Point aPos = aRect2.LeftCenter();
+ nX = aPos.X()+2;
+ nY = aPos.Y();
+ for ( USHORT i = 0; i < 4; i++ )
+ DrawLine( Point( nX+i, nY-i ), Point( nX+i, nY+i ) );
+ }
+ }
+ else
+ {
+ if ( !aRect1.IsEmpty() )
+ {
+ Point aPos = aRect1.TopLeft();
+ Size aSize = aRect1.GetSize();
+ DrawOutDev( aPos, aSize, aPos, aSize, maVirDev );
+ }
+ if ( !aRect2.IsEmpty() )
+ {
+ Point aPos = aRect2.TopLeft();
+ Size aSize = aRect2.GetSize();
+ DrawOutDev( aPos, aSize, aPos, aSize, maVirDev );
+ }
+ }
+
+ if ( nItemId1 || nItemId2 )
+ ImplDrawSelect();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplDraw()
+{
+ if ( mbFormat )
+ Format();
+
+ HideFocus();
+
+ Point aDefPos;
+ Size aSize = maVirDev.GetOutputSizePixel();
+
+ if ( mpScrBar )
+ {
+ Point aScrPos = mpScrBar->GetPosPixel();
+ Size aScrSize = mpScrBar->GetSizePixel();
+ Point aTempPos( 0, aScrPos.Y() );
+ Size aTempSize( aSize.Width(), aScrPos.Y() );
+
+ DrawOutDev( aDefPos, aTempSize, aDefPos, aTempSize, maVirDev );
+ aTempSize.Width() = aScrPos.X()-1;
+ aTempSize.Height() = aScrSize.Height();
+ DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, maVirDev );
+ aTempPos.Y() = aScrPos.Y()+aScrSize.Height();
+ aTempSize.Width() = aSize.Width();
+ aTempSize.Height() = aSize.Height()-aTempPos.Y();
+ DrawOutDev( aTempPos, aTempSize, aTempPos, aTempSize, maVirDev );
+ }
+ else
+ DrawOutDev( aDefPos, aSize, aDefPos, aSize, maVirDev );
+
+ ImplDrawSelect();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ValueSet::ImplScroll( const Point& rPos )
+{
+ Size aOutSize = GetOutputSizePixel();
+ long nScrBarWidth;
+
+ if ( mpScrBar )
+ nScrBarWidth = mpScrBar->GetSizePixel().Width();
+ else
+ nScrBarWidth = 0;
+
+ if ( !mbScroll || (rPos.X() < 0) || (rPos.X() > aOutSize.Width()-nScrBarWidth) )
+ return FALSE;
+
+ long nScrollOffset;
+ USHORT nOldLine = mnFirstLine;
+ const Rectangle& rTopRect = mpItemList->GetObject( mnFirstLine*mnCols )->maRect;
+ if ( rTopRect.GetHeight() <= 16 )
+ nScrollOffset = VALUESET_SCROLL_OFFSET/2;
+ else
+ nScrollOffset = VALUESET_SCROLL_OFFSET;
+ if ( (mnFirstLine > 0) && (rPos.Y() >= 0) )
+ {
+ long nTopPos = rTopRect.Top();
+ if ( (rPos.Y() >= nTopPos) && (rPos.Y() <= nTopPos+nScrollOffset) )
+ mnFirstLine--;
+ }
+ if ( (mnFirstLine == nOldLine) &&
+ (mnFirstLine < (USHORT)(mnLines-mnVisLines)) && (rPos.Y() < aOutSize.Height()) )
+ {
+ long nBottomPos = mpItemList->GetObject( (mnFirstLine+mnVisLines-1)*mnCols )->maRect.Bottom();
+ if ( (rPos.Y() >= nBottomPos-nScrollOffset) && (rPos.Y() <= nBottomPos) )
+ mnFirstLine++;
+ }
+
+ if ( mnFirstLine != nOldLine )
+ {
+ mbFormat = TRUE;
+ ImplDraw();
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ValueSet::ImplGetItem( const Point& rPos, BOOL bMove )
+{
+ if ( mpNoneItem )
+ {
+ if ( mpNoneItem->maRect.IsInside( rPos ) )
+ return VALUESET_ITEM_NONEITEM;
+ }
+
+ ULONG nItemCount = mpItemList->Count();
+ for ( ULONG i = 0; i < nItemCount; i++ )
+ {
+ ValueSetItem* pItem = mpItemList->GetObject( i );
+ if ( pItem->maRect.IsInside( rPos ) )
+ return (USHORT)i;
+ }
+
+ // Wenn Spacing gesetzt ist, wird der vorher selektierte
+ // Eintrag zurueckgegeben, wenn die Maus noch nicht das Fenster
+ // verlassen hat
+ if ( bMove && mnSpacing && mnHighItemId )
+ {
+ Point aDefPos;
+ Rectangle aWinRect( aDefPos, maVirDev.GetOutputSizePixel() );
+ if ( aWinRect.IsInside( rPos ) )
+ return GetItemPos( mnHighItemId );
+ }
+
+ return VALUESET_ITEM_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+ValueSetItem* ValueSet::ImplGetItem( USHORT nPos )
+{
+ if ( nPos == VALUESET_ITEM_NONEITEM )
+ return mpNoneItem;
+ else
+ return mpItemList->GetObject( nPos );
+}
+
+// -----------------------------------------------------------------------
+
+ValueSetItem* ValueSet::ImplGetFirstItem()
+{
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+ USHORT i = 0;
+
+ while ( i < nItemCount )
+ {
+ ValueSetItem* pItem = mpItemList->GetObject( i );
+ if ( pItem->meType != VALUESETITEM_SPACE )
+ return pItem;
+ i++;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ValueSet,ImplScrollHdl, ScrollBar*, pScrollBar )
+{
+ USHORT nNewFirstLine = (USHORT)pScrollBar->GetThumbPos();
+ if ( nNewFirstLine != mnFirstLine )
+ {
+ mnFirstLine = nNewFirstLine;
+ mbFormat = TRUE;
+ ImplDraw();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ValueSet,ImplTimerHdl, Timer*, pTimer )
+{
+ ImplTracking( GetPointerPosPixel(), TRUE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplTracking( const Point& rPos, BOOL bRepeat )
+{
+ if ( bRepeat || mbSelection )
+ {
+ if ( ImplScroll( rPos ) )
+ {
+ if ( mbSelection )
+ {
+ maTimer.SetTimeoutHdl( LINK( this, ValueSet, ImplTimerHdl ) );
+ maTimer.SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
+ maTimer.Start();
+ }
+ }
+ }
+
+ ValueSetItem* pItem = ImplGetItem( ImplGetItem( rPos ) );
+ if ( pItem && (pItem->meType != VALUESETITEM_SPACE) )
+ ImplHighlightItem( pItem->mnId );
+ else
+ ImplHighlightItem( mnSelItemId, FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::ImplEndTracking( const Point& rPos, BOOL bCancel )
+{
+ ValueSetItem* pItem;
+
+ // Bei Abbruch, den alten Status wieder herstellen
+ if ( bCancel )
+ pItem = NULL;
+ else
+ pItem = ImplGetItem( ImplGetItem( rPos ) );
+
+ if ( pItem && (pItem->meType != VALUESETITEM_SPACE) )
+ {
+ SelectItem( pItem->mnId );
+ if ( !mbSelection && !(GetStyle() & WB_NOPOINTERFOCUS) )
+ GrabFocus();
+ mbHighlight = FALSE;
+ mbSelection = FALSE;
+ Select();
+ }
+ else
+ {
+ ImplHighlightItem( mnSelItemId, FALSE );
+ mbHighlight = FALSE;
+ mbSelection = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ ValueSetItem* pItem = ImplGetItem( ImplGetItem( rMEvt.GetPosPixel() ) );
+ if ( mbSelection )
+ {
+ mbHighlight = TRUE;
+ if ( pItem && (pItem->meType != VALUESETITEM_SPACE) )
+ {
+ mnOldItemId = mnSelItemId;
+ mnHighItemId = mnSelItemId;
+ ImplHighlightItem( pItem->mnId );
+ }
+
+ return;
+ }
+ else
+ {
+ if ( pItem && (pItem->meType != VALUESETITEM_SPACE) && !rMEvt.IsMod2() )
+ {
+ if ( (pItem->mnBits & VIB_NODOUBLECLICK) || (rMEvt.GetClicks() == 1) )
+ {
+ mnOldItemId = mnSelItemId;
+ mbHighlight = TRUE;
+ mnHighItemId = mnSelItemId;
+ ImplHighlightItem( pItem->mnId );
+ StartTracking( STARTTRACK_SCROLLREPEAT );
+ }
+ else if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
+
+ return;
+ }
+ }
+ }
+
+ Control::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ // Wegen SelectionMode
+ if ( rMEvt.IsLeft() && mbSelection )
+ ImplEndTracking( rMEvt.GetPosPixel(), FALSE );
+ else
+ Control::MouseButtonUp( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::MouseMove( const MouseEvent& rMEvt )
+{
+ // Wegen SelectionMode
+ if ( mbSelection )
+ ImplTracking( rMEvt.GetPosPixel(), FALSE );
+ Control::MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::Tracking( const TrackingEvent& rTEvt )
+{
+ Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+
+ if ( rTEvt.IsTrackingEnded() )
+ ImplEndTracking( aMousePos, rTEvt.IsTrackingCanceled() );
+ else
+ ImplTracking( aMousePos, rTEvt.IsTrackingRepeat() );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::KeyInput( const KeyEvent& rKEvt )
+{
+ USHORT nLastItem = (USHORT)mpItemList->Count();
+ USHORT nItemPos = VALUESET_ITEM_NOTFOUND;
+ USHORT nCurPos;
+ USHORT nCalcPos;
+
+ if ( !nLastItem || !ImplGetFirstItem() )
+ {
+ Control::KeyInput( rKEvt );
+ return;
+ }
+ else
+ nLastItem--;
+
+ if ( mnSelItemId )
+ nCurPos = GetItemPos( mnSelItemId );
+ else
+ nCurPos = VALUESET_ITEM_NONEITEM;
+ nCalcPos = nCurPos;
+
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_HOME:
+ if ( mpNoneItem )
+ nItemPos = VALUESET_ITEM_NONEITEM;
+ else
+ {
+ nItemPos = 0;
+ while ( ImplGetItem( nItemPos )->meType == VALUESETITEM_SPACE )
+ nItemPos++;
+ }
+ break;
+
+ case KEY_END:
+ nItemPos = nLastItem;
+ while ( ImplGetItem( nItemPos )->meType == VALUESETITEM_SPACE )
+ {
+ if ( nItemPos == 0 )
+ nItemPos = VALUESET_ITEM_NONEITEM;
+ else
+ nItemPos--;
+ }
+ break;
+
+ case KEY_LEFT:
+ do
+ {
+ if ( nCalcPos == VALUESET_ITEM_NONEITEM )
+ nItemPos = nLastItem;
+ else if ( !nCalcPos )
+ {
+ if ( mpNoneItem )
+ nItemPos = VALUESET_ITEM_NONEITEM;
+ else
+ nItemPos = nLastItem;
+ }
+ else
+ nItemPos = nCalcPos-1;
+ nCalcPos = nItemPos;
+ }
+ while ( ImplGetItem( nItemPos )->meType == VALUESETITEM_SPACE );
+ break;
+
+ case KEY_RIGHT:
+ do
+ {
+ if ( nCalcPos == VALUESET_ITEM_NONEITEM )
+ nItemPos = 0;
+ else if ( nCalcPos == nLastItem )
+ {
+ if ( mpNoneItem )
+ nItemPos = VALUESET_ITEM_NONEITEM;
+ else
+ nItemPos = 0;
+ }
+ else
+ nItemPos = nCalcPos+1;
+ nCalcPos = nItemPos;
+ }
+ while ( ImplGetItem( nItemPos )->meType == VALUESETITEM_SPACE );
+ break;
+
+ case KEY_UP:
+ do
+ {
+ if ( nCalcPos == VALUESET_ITEM_NONEITEM )
+ {
+ if ( nLastItem+1 <= mnCols )
+ nItemPos = mnCurCol;
+ else
+ {
+ nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+mnCurCol;
+ if ( nItemPos+mnCols <= nLastItem )
+ nItemPos += mnCols;
+ }
+ }
+ else if ( nCalcPos >= mnCols )
+ nItemPos = nCalcPos-mnCols;
+ else
+ {
+ if ( mpNoneItem )
+ {
+ mnCurCol = nCalcPos%mnCols;
+ nItemPos = VALUESET_ITEM_NONEITEM;
+ }
+ else
+ {
+ if ( nLastItem+1 <= mnCols )
+ nItemPos = nCalcPos;
+ else
+ {
+ nItemPos = ((((nLastItem+1)/mnCols)-1)*mnCols)+nCalcPos;
+ if ( nItemPos+mnCols <= nLastItem )
+ nItemPos += mnCols;
+ }
+ }
+ }
+ nCalcPos = nItemPos;
+ }
+ while ( ImplGetItem( nItemPos )->meType == VALUESETITEM_SPACE );
+ break;
+
+ case KEY_DOWN:
+ do
+ {
+ if ( nCalcPos == VALUESET_ITEM_NONEITEM )
+ nItemPos = mnCurCol;
+ else if ( nCalcPos+mnCols <= nLastItem )
+ nItemPos = nCalcPos+mnCols;
+ else
+ {
+ if ( mpNoneItem )
+ {
+ mnCurCol = nCalcPos%mnCols;
+ nItemPos = VALUESET_ITEM_NONEITEM;
+ }
+ else
+ nItemPos = nCalcPos%mnCols;
+ }
+ nCalcPos = nItemPos;
+ }
+ while ( ImplGetItem( nItemPos )->meType == VALUESETITEM_SPACE );
+ break;
+
+ default:
+ Control::KeyInput( rKEvt );
+ break;
+ }
+
+ if ( nItemPos != VALUESET_ITEM_NOTFOUND )
+ {
+ USHORT nItemId;
+ if ( nItemPos != VALUESET_ITEM_NONEITEM )
+ nItemId = GetItemId( nItemPos );
+ else
+ nItemId = 0;
+ if ( nItemId != mnSelItemId )
+ {
+ SelectItem( nItemId );
+ Select();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::Command( const CommandEvent& rCEvt )
+{
+ if ( (rCEvt.GetCommand() == COMMAND_WHEEL) ||
+ (rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
+ (rCEvt.GetCommand() == COMMAND_AUTOSCROLL) )
+ {
+ if ( HandleScrollCommand( rCEvt, NULL, mpScrBar ) )
+ return;
+ }
+
+ Control::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::Paint( const Rectangle& rRect )
+{
+ if ( GetStyle() & WB_FLATVALUESET )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetFaceColor() );
+ long nOffY = maVirDev.GetOutputSizePixel().Height();
+ Size aWinSize = GetOutputSizePixel();
+ DrawRect( Rectangle( Point( 0, nOffY ), Point( aWinSize.Width(), aWinSize.Height() ) ) );
+ }
+
+ ImplDraw();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::GetFocus()
+{
+ ImplDrawSelect();
+ Control::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::LoseFocus()
+{
+ if ( mbNoSelection && mnSelItemId )
+ ImplHideSelect( mnSelItemId );
+ else
+ HideFocus();
+ Control::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::Resize()
+{
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ Control::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::RequestHelp( const HelpEvent& rHEvt )
+{
+ if ( (rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON)) == HELPMODE_QUICK )
+ {
+ Point aPos = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
+ ULONG nItemCount = mpItemList->Count();
+ for ( ULONG i = 0; i < nItemCount; i++ )
+ {
+ ValueSetItem* pItem = mpItemList->GetObject( i );
+ if ( pItem->maRect.IsInside( aPos ) )
+ {
+ Rectangle aItemRect = pItem->maRect;
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ Help::ShowQuickHelp( this, aItemRect, GetItemText( pItem->mnId ) );
+ return;
+ }
+ }
+ }
+
+ Control::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ if ( mbFormat )
+ Format();
+ }
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_TEXT )
+ {
+ if ( mpNoneItem && !mbFormat && IsReallyVisible() && IsUpdateMode() )
+ {
+ ImplFormatItem( mpNoneItem );
+ Invalidate( mpNoneItem->maRect );
+ }
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ mbFormat = TRUE;
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ mbFormat = TRUE;
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::UserDraw( const UserDrawEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::InsertItem( USHORT nItemId, const Image& rImage, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
+ "ValueSet::InsertItem(): ItemId already exists" );
+
+ ValueSetItem* pItem = new ValueSetItem;
+ pItem->mnId = nItemId;
+ pItem->meType = VALUESETITEM_IMAGE;
+ pItem->maImage = rImage;
+ mpItemList->Insert( pItem, (ULONG)nPos );
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::InsertItem( USHORT nItemId, const Color& rColor, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
+ "ValueSet::InsertItem(): ItemId already exists" );
+
+ ValueSetItem* pItem = new ValueSetItem;
+ pItem->mnId = nItemId;
+ pItem->meType = VALUESETITEM_COLOR;
+ pItem->maColor = rColor;
+ mpItemList->Insert( pItem, (ULONG)nPos );
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::InsertItem( USHORT nItemId, const Image& rImage,
+ const XubString& rText, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
+ "ValueSet::InsertItem(): ItemId already exists" );
+
+ ValueSetItem* pItem = new ValueSetItem;
+ pItem->mnId = nItemId;
+ pItem->meType = VALUESETITEM_IMAGE;
+ pItem->maImage = rImage;
+ pItem->maText = rText;
+ mpItemList->Insert( pItem, (ULONG)nPos );
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::InsertItem( USHORT nItemId, const Color& rColor,
+ const XubString& rText, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
+ "ValueSet::InsertItem(): ItemId already exists" );
+
+ ValueSetItem* pItem = new ValueSetItem;
+ pItem->mnId = nItemId;
+ pItem->meType = VALUESETITEM_COLOR;
+ pItem->maColor = rColor;
+ pItem->maText = rText;
+ mpItemList->Insert( pItem, (ULONG)nPos );
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::InsertItem( USHORT nItemId, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
+ "ValueSet::InsertItem(): ItemId already exists" );
+
+ ValueSetItem* pItem = new ValueSetItem;
+ pItem->mnId = nItemId;
+ pItem->meType = VALUESETITEM_USERDRAW;
+ mpItemList->Insert( pItem, (ULONG)nPos );
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::InsertSpace( USHORT nItemId, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ValueSet::InsertSpace(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
+ "ValueSet::InsertSpace(): ItemId already exists" );
+
+ ValueSetItem* pItem = new ValueSetItem;
+ pItem->mnId = nItemId;
+ pItem->meType = VALUESETITEM_SPACE;
+ mpItemList->Insert( pItem, (ULONG)nPos );
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::RemoveItem( USHORT nItemId )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos == VALUESET_ITEM_NOTFOUND )
+ return;
+
+ delete mpItemList->Remove( nPos );
+
+ // Variablen zuruecksetzen
+ if ( (mnHighItemId == nItemId) || (mnSelItemId == nItemId) )
+ {
+ mnCurCol = 0;
+ mnOldItemId = 0;
+ mnHighItemId = 0;
+ mnSelItemId = 0;
+ mbNoSelection = TRUE;
+ }
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::CopyItems( const ValueSet& rValueSet )
+{
+ ValueSetItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ pItem = rValueSet.mpItemList->First();
+ while ( pItem )
+ {
+ mpItemList->Insert( new ValueSetItem( *pItem ) );
+ pItem = rValueSet.mpItemList->Next();
+ }
+
+ // Variablen zuruecksetzen
+ mnFirstLine = 0;
+ mnCurCol = 0;
+ mnOldItemId = 0;
+ mnHighItemId = 0;
+ mnSelItemId = 0;
+ mbNoSelection = TRUE;
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::Clear()
+{
+ ValueSetItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+ mpItemList->Clear();
+
+ // Variablen zuruecksetzen
+ mnFirstLine = 0;
+ mnCurCol = 0;
+ mnOldItemId = 0;
+ mnHighItemId = 0;
+ mnSelItemId = 0;
+ mbNoSelection = TRUE;
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ValueSet::GetItemCount() const
+{
+ return (USHORT)mpItemList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ValueSet::GetItemPos( USHORT nItemId ) const
+{
+ ValueSetItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nItemId )
+ return (USHORT)mpItemList->GetCurPos();
+ pItem = mpItemList->Next();
+ }
+
+ return VALUESET_ITEM_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ValueSet::GetItemId( USHORT nPos ) const
+{
+ ValueSetItem* pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem )
+ return pItem->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ValueSet::GetItemId( const Point& rPos ) const
+{
+ ValueSetItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->maRect.IsInside( rPos ) )
+ return pItem->mnId;
+
+ pItem = mpItemList->Next();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle ValueSet::GetItemRect( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != VALUESET_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maRect;
+ else
+ return Rectangle();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetColCount( USHORT nNewCols )
+{
+ if ( mnUserCols != nNewCols )
+ {
+ mnUserCols = nNewCols;
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetLineCount( USHORT nNewLines )
+{
+ if ( mnUserVisLines != nNewLines )
+ {
+ mnUserVisLines = nNewLines;
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetItemWidth( long nNewItemWidth )
+{
+ if ( mnUserItemWidth != nNewItemWidth )
+ {
+ mnUserItemWidth = nNewItemWidth;
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetItemHeight( long nNewItemHeight )
+{
+ if ( mnUserItemHeight != nNewItemHeight )
+ {
+ mnUserItemHeight = nNewItemHeight;
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetFirstLine( USHORT nNewLine )
+{
+ if ( mnFirstLine != nNewLine )
+ {
+ mnFirstLine = nNewLine;
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SelectItem( USHORT nItemId )
+{
+ USHORT nPos;
+
+ if ( nItemId )
+ {
+ nPos = GetItemPos( nItemId );
+ if ( nPos == VALUESET_ITEM_NOTFOUND )
+ return;
+ if ( mpItemList->GetObject( nPos )->meType == VALUESETITEM_SPACE )
+ return;
+ }
+
+ if ( (mnSelItemId != nItemId) || mbNoSelection )
+ {
+ USHORT nOldItem = mnSelItemId;
+ mnSelItemId = nItemId;
+ mbNoSelection = FALSE;
+
+ BOOL bNewOut;
+ BOOL bNewLine;
+ if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
+ bNewOut = TRUE;
+ else
+ bNewOut = FALSE;
+ bNewLine = FALSE;
+
+ // Gegebenenfalls in den sichtbaren Bereich scrollen
+ if ( mbScroll && nItemId )
+ {
+ USHORT nNewLine = (USHORT)(nPos / mnCols);
+ if ( nNewLine < mnFirstLine )
+ {
+ mnFirstLine = nNewLine;
+ bNewLine = TRUE;
+ }
+ else if ( nNewLine > (USHORT)(mnFirstLine+mnVisLines-1) )
+ {
+ mnFirstLine = (USHORT)(nNewLine-mnVisLines+1);
+ bNewLine = TRUE;
+ }
+ }
+
+ if ( bNewOut )
+ {
+ if ( bNewLine )
+ {
+ // Falls sich der sichtbare Bereich geaendert hat,
+ // alles neu ausgeben
+ mbFormat = TRUE;
+ ImplDraw();
+ }
+ else
+ {
+ // alte Selection wegnehmen und neue ausgeben
+ ImplHideSelect( nOldItem );
+ ImplDrawSelect();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetNoSelection()
+{
+ mbNoSelection = TRUE;
+ mbHighlight = FALSE;
+ mbSelection = FALSE;
+
+ if ( IsReallyVisible() && IsUpdateMode() )
+ ImplDraw();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetItemBits( USHORT nItemId, USHORT nItemBits )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != VALUESET_ITEM_NOTFOUND )
+ mpItemList->GetObject( nPos )->mnBits = nItemBits;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ValueSet::GetItemBits( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != VALUESET_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnBits;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetItemImage( USHORT nItemId, const Image& rImage )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos == VALUESET_ITEM_NOTFOUND )
+ return;
+
+ ValueSetItem* pItem = mpItemList->GetObject( nPos );
+ pItem->meType = VALUESETITEM_IMAGE;
+ pItem->maImage = rImage;
+
+ if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
+ {
+ ImplFormatItem( pItem );
+ Invalidate( pItem->maRect );
+ }
+ else
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Image ValueSet::GetItemImage( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != VALUESET_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maImage;
+ else
+ return Image();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetItemColor( USHORT nItemId, const Color& rColor )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos == VALUESET_ITEM_NOTFOUND )
+ return;
+
+ ValueSetItem* pItem = mpItemList->GetObject( nPos );
+ pItem->meType = VALUESETITEM_COLOR;
+ pItem->maColor = rColor;
+
+ if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
+ {
+ ImplFormatItem( pItem );
+ Invalidate( pItem->maRect );
+ }
+ else
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Color ValueSet::GetItemColor( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != VALUESET_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maColor;
+ else
+ return Color();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetItemData( USHORT nItemId, void* pData )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos == VALUESET_ITEM_NOTFOUND )
+ return;
+
+ ValueSetItem* pItem = mpItemList->GetObject( nPos );
+ pItem->mpData = pData;
+
+ if ( pItem->meType == VALUESETITEM_USERDRAW )
+ {
+ if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
+ {
+ ImplFormatItem( pItem );
+ Invalidate( pItem->maRect );
+ }
+ else
+ mbFormat = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void* ValueSet::GetItemData( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != VALUESET_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mpData;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetItemText( USHORT nItemId, const XubString& rText )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos == VALUESET_ITEM_NOTFOUND )
+ return;
+
+ ValueSetItem* pItem = mpItemList->GetObject( nPos );
+ pItem->maText = rText;
+
+ if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
+ {
+ USHORT nTempId = mnSelItemId;
+
+ if ( mbHighlight )
+ nTempId = mnHighItemId;
+
+ if ( nTempId == nItemId )
+ ImplDrawItemText( pItem->maText );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString ValueSet::GetItemText( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != VALUESET_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maText;
+ else
+ return XubString();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetColor( const Color& rColor )
+{
+ maColor = rColor;
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ ImplDraw();
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::SetExtraSpacing( USHORT nNewSpacing )
+{
+ if ( GetStyle() & WB_ITEMBORDER )
+ {
+ mnSpacing = nNewSpacing;
+
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::StartSelection()
+{
+ mnOldItemId = mnSelItemId;
+ mbHighlight = TRUE;
+ mbSelection = TRUE;
+ mnHighItemId = mnSelItemId;
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::EndSelection()
+{
+ if ( mbHighlight )
+ {
+ if ( IsTracking() )
+ EndTracking( ENDTRACK_CANCEL );
+
+ ImplHighlightItem( mnSelItemId );
+ mbHighlight = FALSE;
+ }
+ mbSelection = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ValueSet::StartDrag( const CommandEvent& rCEvt, Region& rRegion )
+{
+ if ( rCEvt.GetCommand() != COMMAND_STARTDRAG )
+ return FALSE;
+
+ // Gegebenenfalls eine vorhandene Aktion abbrechen
+ EndSelection();
+
+ // Testen, ob angeklickte Seite selektiert ist. Falls dies nicht
+ // der Fall ist, setzen wir ihn als aktuellen Eintrag. Falls Drag and
+ // Drop auch mal ueber Tastatur ausgeloest werden kann, testen wir
+ // dies nur bei einer Mausaktion.
+ USHORT nSelId;
+ if ( rCEvt.IsMouseEvent() )
+ nSelId = GetItemId( rCEvt.GetMousePosPixel() );
+ else
+ nSelId = mnSelItemId;
+
+ // Falls kein Eintrag angeklickt wurde, starten wir kein Dragging
+ if ( !nSelId )
+ return FALSE;
+
+ // Testen, ob Seite selektiertiert ist. Falls nicht, als aktuelle
+ // Seite setzen und Select rufen.
+ if ( nSelId != mnSelItemId )
+ {
+ SelectItem( nSelId );
+ Update();
+ Select();
+ }
+
+#ifdef MAC
+ Region aRegion( GetItemRect( nSelId ) );
+#else
+ Region aRegion;
+#endif
+
+ // Region zuweisen
+ rRegion = aRegion;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, USHORT nDesireCols,
+ USHORT nDesireLines )
+{
+ long nCalcCols = (long)nDesireCols;
+ long nCalcLines = (long)nDesireLines;
+
+ if ( !nCalcCols )
+ {
+ if ( mnUserCols )
+ nCalcCols = (long)mnUserCols;
+ else
+ nCalcCols = 1;
+ }
+
+ if ( !nCalcLines )
+ {
+ nCalcLines = mnVisLines;
+
+ if ( mbFormat )
+ {
+ if ( mnUserVisLines )
+ nCalcLines = mnUserVisLines;
+ else
+ {
+ nCalcLines = (long)mpItemList->Count() / nCalcCols;
+ if ( mpItemList->Count() % nCalcCols )
+ nCalcLines++;
+ else if ( !nCalcLines )
+ nCalcLines = 1;
+ }
+ }
+ }
+
+ Size aSize( rItemSize.Width()*nCalcCols, rItemSize.Height()*nCalcLines );
+ WinBits nStyle = GetStyle();
+ long nTxtHeight = GetTextHeight();
+ long nSpace;
+ long n;
+
+ if ( nStyle & WB_ITEMBORDER )
+ {
+ if ( nStyle & WB_DOUBLEBORDER )
+ n = ITEM_OFFSET_DOUBLE;
+ else
+ n = ITEM_OFFSET;
+
+ aSize.Width() += n*nCalcCols;
+ aSize.Height() += n*nCalcLines;
+ }
+ else
+ n = 0;
+
+ if ( mnSpacing )
+ {
+ nSpace = mnSpacing;
+ aSize.Width() += mnSpacing*(nCalcCols-1);
+ aSize.Height() += mnSpacing*(nCalcLines-1);
+ }
+ else
+ nSpace = 0;
+
+ if ( nStyle & WB_NAMEFIELD )
+ {
+ long nNameOffset = (nStyle & WB_FLATVALUESET) ? NAME_OFFSET_FLAT : NAME_OFFSET;
+ aSize.Height() += nTxtHeight + (nNameOffset*3) + 2 + nSpace;
+ }
+
+ if ( nStyle & WB_NONEFIELD )
+ {
+ aSize.Height() += nTxtHeight + n + nSpace;
+ if ( nStyle & WB_RADIOSEL )
+ aSize.Height() += 8;
+ }
+
+ // Evt. ScrollBar-Breite aufaddieren
+ aSize.Width() += GetScrollWidth();
+
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+Size ValueSet::CalcItemSizePixel( const Size& rItemSize, BOOL bOut ) const
+{
+ Size aSize = rItemSize;
+
+ WinBits nStyle = GetStyle();
+ if ( nStyle & WB_ITEMBORDER )
+ {
+ long n;
+
+ if ( nStyle & WB_DOUBLEBORDER )
+ n = ITEM_OFFSET_DOUBLE;
+ else
+ n = ITEM_OFFSET;
+
+ if ( bOut )
+ {
+ aSize.Width() += n;
+ aSize.Height() += n;
+ }
+ else
+ {
+ aSize.Width() -= n;
+ aSize.Height() -= n;
+ }
+ }
+
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+long ValueSet::GetScrollWidth() const
+{
+ if ( GetStyle() & WB_VSCROLL )
+ {
+ ((ValueSet*)this)->ImplInitScrollBar();
+ return mpScrBar->GetSizePixel().Width()+SCRBAR_OFFSET;
+ }
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ValueSet::ShowDropPos( const Point& rPos )
+{
+ mbDropPos = TRUE;
+
+ // Gegebenenfalls scrollen
+ ImplScroll( rPos );
+
+ // DropPosition ermitteln
+ USHORT nPos = ImplGetItem( rPos, TRUE );
+ if ( nPos == VALUESET_ITEM_NONEITEM )
+ nPos = 0;
+ else if ( nPos == VALUESET_ITEM_NOTFOUND )
+ {
+ Size aOutSize = GetOutputSizePixel();
+ if ( GetStyle() & WB_NAMEFIELD )
+ aOutSize.Height() = mnTextOffset;
+ if ( (rPos.X() >= 0) && (rPos.X() < aOutSize.Width()) &&
+ (rPos.Y() >= 0) && (rPos.Y() < aOutSize.Height()) )
+ nPos = (USHORT)mpItemList->Count();
+ }
+ else
+ {
+ // Im letzten viertel, dann wird ein Item spaeter eingefuegt
+ Rectangle aRect = mpItemList->GetObject( nPos )->maRect;
+ if ( rPos.X() > aRect.Left()+aRect.GetWidth()-(aRect.GetWidth()/4) )
+ nPos++;
+ }
+
+ if ( nPos != mnDropPos )
+ {
+ ImplDrawDropPos( FALSE );
+ mnDropPos = nPos;
+ ImplDrawDropPos( TRUE );
+ }
+
+ return mnDropPos;
+}
+
+// -----------------------------------------------------------------------
+
+void ValueSet::HideDropPos()
+{
+ if ( mbDropPos )
+ {
+ ImplDrawDropPos( FALSE );
+ mbDropPos = FALSE;
+ }
+}
diff --git a/svtools/source/dialogs/colctrl.cxx b/svtools/source/dialogs/colctrl.cxx
new file mode 100644
index 000000000000..eb7c168af6de
--- /dev/null
+++ b/svtools/source/dialogs/colctrl.cxx
@@ -0,0 +1,814 @@
+/*************************************************************************
+ *
+ * $RCSfile: colctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _SV_SALBTYPE_HXX //autogen
+#include <vcl/salbtype.hxx>
+#endif
+
+#ifndef _SV_BMPACC_HXX //autogen
+#include <vcl/bmpacc.hxx>
+#endif
+
+#include <colctrl.hxx>
+
+// ----------------
+// - ColorControl -
+// ----------------
+
+// -----------------------------------------------------------------------
+SvColorControl::SvColorControl( Window* pParent, WinBits nStyle ) :
+ Control ( pParent, nStyle ),
+ mpBitmap ( NULL ),
+ mpReadAccess ( NULL ),
+ mnLuminance ( 50 )
+{
+ Initialize();
+}
+
+// -----------------------------------------------------------------------
+SvColorControl::SvColorControl( Window* pParent, const ResId& rResId ) :
+ Control ( pParent, rResId ),
+ mpBitmap ( NULL ),
+ mpReadAccess ( NULL ),
+ mnLuminance ( 50 )
+{
+ Initialize();
+}
+
+
+// -----------------------------------------------------------------------
+SvColorControl::~SvColorControl()
+{
+ if( mpReadAccess )
+ mpBitmap->ReleaseAccess( mpReadAccess );
+
+ delete mpBitmap;
+
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::Initialize()
+{
+ SetLineColor( Color( COL_BLACK ) );
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::CreateBitmap()
+{
+ Size aSize = GetOutputSizePixel();
+ Size aBmpSize;
+ if( mpBitmap && mpBitmap->GetSizePixel() != aSize )
+ {
+ delete mpBitmap;
+ mpBitmap = NULL;
+ }
+ if( !mpBitmap )
+ mpBitmap = new Bitmap( aSize, 24 );
+
+ BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess();
+
+ USHORT nX = (USHORT) aSize.Width();
+ USHORT nY = (USHORT) aSize.Height();
+
+ UINT16 nHue, nSat;
+ UINT16 nBri = mnLuminance;
+ ColorHSB aColHSB( 0, 0, mnLuminance );
+
+ for( USHORT i = 0; i < nY; i++ )
+ {
+ nSat = 100 - ( 100.0 * i + 0.5 ) / nY;
+
+ for( USHORT j = 0; j < nX; j++ )
+ {
+ nHue = ( 360.0 * j + 0.5 ) / nX;
+
+ aColHSB.SetHue( nHue );
+ aColHSB.SetSat( nSat );
+ Color aCol( aColHSB.GetRGB() );
+
+ pWriteAccess->SetPixel( i, j, BitmapColor( aCol ) );
+
+ }
+ }
+
+ /*
+ erster Ansatz nur mit RGB
+ USHORT n1_6 = (USHORT) ((nX+3) / 6);
+ USHORT n2_6 = (USHORT) ((nX*2+3) / 6);
+ USHORT n3_6 = (USHORT) ((nX*3+3) / 6);
+ USHORT n4_6 = (USHORT) ((nX*4+3) / 6);
+ USHORT n5_6 = (USHORT) ((nX*5+3) / 6);
+ USHORT n6_6 = nX;
+
+ BitmapColor aBmpColor;
+ BYTE cR, cG, cB;
+ */
+ /*
+ for( USHORT i = 0; i < nY; i++ )
+ {
+ USHORT nK = 100 * i / nY;
+
+ for( USHORT j = 0; j < nX; j++ )
+ {
+ if( j < n1_6 )
+ {
+ cR = 255;
+ cG = 255 * j / n1_6;
+ cB = 0;
+ }
+ else if( j < n2_6 )
+ {
+ cR = 255 - 255 * ( j - n1_6 ) / n1_6;
+ cG = 255;
+ cB = 0;
+ }
+ else if( j < n3_6 )
+ {
+ cR = 0;
+ cG = 255;
+ cB = 255 * (j - n2_6 ) / n1_6;
+ }
+ else if( j < n4_6 )
+ {
+ cR = 0;
+ cG = 255 - 255 * ( j - n3_6 ) / n1_6;
+ cB = 255;
+ }
+ else if( j < n5_6 )
+ {
+ cR = 255 * (j - n4_6 ) / n1_6;
+ cG = 0;
+ cB = 255;
+ }
+ else if( j < nX )
+ {
+ cR = 255;
+ cG = 0;
+ cB = 255 - 255 * ( j - n5_6 ) / n1_6;;
+ }
+
+ //cR -= ( cR - mnLuminance * 256 / 100 ) * nK / 100;
+ //cG -= ( cG - mnLuminance * 256 / 100 ) * nK / 100;
+ //cB -= ( cB - mnLuminance * 256 / 100 ) * nK / 100;
+
+ //aBmpColor.SetRed( cR );
+ //aBmpColor.SetGreen( cG );
+ //aBmpColor.SetBlue( cB );
+
+ //pWriteAccess->SetPixel( i, j, aBmpColor );
+
+ ColorHSB aColHSB( Color( cR, cG, cB ) );
+ aColHSB.SetSat( nK );
+ Color aCol( aColHSB.GetRGB() );
+
+ pWriteAccess->SetPixel( i, j, BitmapColor( aCol ) );
+
+ }
+ }
+ */
+ mpBitmap->ReleaseAccess( pWriteAccess );
+
+ mpReadAccess = mpBitmap->AcquireReadAccess();
+
+ SetColor( maColor ); // Anzeige der Position im Control
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::ShowPosition( const Point& rPos )
+{
+ // Explizites Abfragen des Bereichs, da schon mal ein Wert < 0 vorhanden ist
+ if( mpBitmap )
+ {
+ long nX = rPos.X();
+ long nY = rPos.Y();
+ if( nX < 0L )
+ nX = 0L;
+ else if( nX >= mpBitmap->GetSizePixel().Width() )
+ nX = mpBitmap->GetSizePixel().Width() - 1L;
+
+ if( nY < 0L )
+ nY= 0L;
+ else if( nY >= mpBitmap->GetSizePixel().Height() )
+ nY = mpBitmap->GetSizePixel().Height() - 1L;
+
+ Point aPos = maPosition;
+ maPosition.X() = nX - 2;
+ maPosition.Y() = nY - 2;
+ Invalidate( Rectangle( aPos, Size( 5, 5) ) );
+ Invalidate( Rectangle( maPosition, Size( 5, 5) ) );
+
+ maColor = mpReadAccess->GetPixel( nY, nX );
+ }
+}
+// -----------------------------------------------------------------------
+void SvColorControl::MouseMove( const MouseEvent& rMEvt )
+{
+ if( rMEvt.IsLeft() )
+ {
+ ShowPosition( rMEvt.GetPosPixel() );
+ Modify();
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( rMEvt.IsLeft() && !rMEvt.IsShift() )
+ {
+ //ShowPointer( FALSE );
+ CaptureMouse();
+ ShowPosition( rMEvt.GetPosPixel() );
+ Modify();
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ //ShowPointer( TRUE );
+ if( IsMouseCaptured() )
+ ReleaseMouse();
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::Paint( const Rectangle& rRect )
+{
+ if( !mpBitmap )
+ CreateBitmap();
+
+ // dither bitmap if there only 256 colors available !
+ if( GetBitCount() <= 8 )
+ mpBitmap->Dither();
+
+ DrawBitmap( rRect.TopLeft(), rRect.GetSize(),
+ rRect.TopLeft(), rRect.GetSize(), *mpBitmap );
+
+ // Positions-Control (Fadenkreuz oder Aehnliches)
+ Point aPos1( maPosition );
+ Point aPos2( maPosition );
+ aPos2.X() += 4;
+ DrawLine( aPos1, aPos2 );
+ aPos2.X() -= 4;
+ aPos2.Y() += 4;
+ DrawLine( aPos1, aPos2 );
+ aPos1.Y() += 4;
+ aPos2.X() += 4;
+ DrawLine( aPos1, aPos2 );
+ aPos1.X() += 4;
+ aPos2.Y() -= 4;
+ DrawLine( aPos1, aPos2 );
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::Resize()
+{
+ CreateBitmap();
+
+ Control::Resize();
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::Modify()
+{
+ maModifyHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::SetColor( const ColorHSB& rCol, BOOL bSetColor )
+{
+ if( bSetColor )
+ maColor = rCol.GetRGB();
+
+ if( mpBitmap )
+ {
+ USHORT nX = (USHORT) mpBitmap->GetSizePixel().Width();
+ USHORT nY = (USHORT) mpBitmap->GetSizePixel().Height();
+
+ INT16 nZ = rCol.GetBri();
+ SetLuminance( nZ );
+
+ nX = rCol.GetHue() * nX / 360; // Farbe
+ nY = nY - rCol.GetSat() * nY / 100; // Saettigung
+
+ ShowPosition( Point( nX, nY ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::SetColor( const Color& rCol )
+{
+ maColor = rCol;
+
+ if( mpBitmap )
+ {
+ ColorHSB aColHsb( rCol );
+ SetColor( aColHsb, FALSE );
+ /*
+ BOOL bDone = FALSE;
+ USHORT nX = (USHORT) mpBitmap->GetSizePixel().Width();
+ USHORT nY = (USHORT) mpBitmap->GetSizePixel().Height();
+ USHORT i, j;
+
+ BitmapColor aBmpColor;
+
+ for( i = 0; i < nY && !bDone; i++ )
+ {
+ for( j = 0; j < nX && !bDone; j++ )
+ {
+ aBmpColor = mpReadAccess->GetPixel( i, j );
+
+ if( maColor == (Color)aBmpColor )
+ bDone = TRUE;
+ }
+ }
+
+ if( bDone )
+ ShowPosition( Point( j, i ) );
+ */
+ }
+}
+
+// -----------------------------------------------------------------------
+void SvColorControl::SetLuminance( short nLum )
+{
+ if( nLum != mnLuminance &&
+ nLum >= 0 && nLum <= 100 )
+ {
+ mnLuminance = nLum;
+
+ if( mnLuminance < 40 )
+ SetLineColor( Color( COL_WHITE ) );
+ else
+ SetLineColor( Color( COL_BLACK ) );
+
+ CreateBitmap();
+
+ USHORT nX = maPosition.X() + 2;
+ USHORT nY = maPosition.Y() + 2;
+ maColor = mpReadAccess->GetPixel( nY, nX );
+
+ Invalidate();
+ }
+}
+
+
+// -----------------------
+// - ColorPreviewControl -
+// -----------------------
+
+
+// -----------------------------------------------------------------------
+ColorPreviewControl::ColorPreviewControl( Window* pParent, WinBits nStyle ) :
+ Control ( pParent, nStyle )
+{
+ SetFillColor( maColor );
+ SetLineColor( maColor );
+}
+
+// -----------------------------------------------------------------------
+ColorPreviewControl::ColorPreviewControl( Window* pParent, const ResId& rResId ) :
+ Control ( pParent, rResId )
+{
+ SetFillColor( maColor );
+ SetLineColor( maColor );
+}
+
+
+// -----------------------------------------------------------------------
+ColorPreviewControl::~ColorPreviewControl()
+{
+}
+
+// -----------------------------------------------------------------------
+void ColorPreviewControl::Paint( const Rectangle& rRect )
+{
+ DrawRect( rRect );
+}
+
+// -----------------------------------------------------------------------
+void ColorPreviewControl::SetColor( const Color& rCol )
+{
+ if( rCol != maColor )
+ {
+ maColor = rCol;
+ SetFillColor( maColor );
+ SetLineColor( maColor );
+ Invalidate();
+ }
+}
+
+
+// -----------------------
+// - ColorMixingControl -
+// -----------------------
+
+
+// -----------------------------------------------------------------------
+ColorMixingControl::ColorMixingControl( Window* pParent, WinBits nStyle,
+ USHORT nRows, USHORT nColumns ) :
+ ValueSet ( pParent, nStyle ),
+ mnRows ( nRows ),
+ mnColumns ( nColumns )
+{
+ Initialize();
+}
+
+// -----------------------------------------------------------------------
+ColorMixingControl::ColorMixingControl( Window* pParent, const ResId& rResId,
+ USHORT nRows, USHORT nColumns ) :
+ ValueSet ( pParent, rResId ),
+ mnRows ( nRows ),
+ mnColumns ( nColumns )
+{
+ Initialize();
+}
+
+
+// -----------------------------------------------------------------------
+ColorMixingControl::~ColorMixingControl()
+{
+}
+
+// -----------------------------------------------------------------------
+void ColorMixingControl::Initialize()
+{
+ SetColCount( mnColumns );
+
+ Color aColor;
+ String aStr;
+ for( USHORT i = 1; i <= mnRows * mnColumns; i++ )
+ {
+ InsertItem( i, aColor, aStr );
+ }
+
+ /*maColor[ 0 ] = Color( COL_LIGHTRED );
+ maColor[ 1 ] = Color( COL_LIGHTGREEN );
+ maColor[ 2 ] = Color( COL_YELLOW );
+ maColor[ 3 ] = Color( COL_LIGHTBLUE );*/
+
+ SetColor( CMC_TOPLEFT, Color( COL_LIGHTRED ) );
+ SetColor( CMC_BOTTOMRIGHT, Color( COL_LIGHTBLUE ) );
+
+ SetColor( CMC_TOPRIGHT, Color( COL_LIGHTGREEN ) );
+ SetColor( CMC_BOTTOMLEFT, Color( COL_YELLOW ) );
+
+ /*FillColumn( 0 );
+ FillColumn( mnColumns - 1 );
+ for( i = 0; i < mnRows; i++ )
+ FillRow( i );*/
+}
+
+// -----------------------------------------------------------------------
+Color ColorMixingControl::CalcDifferenceColor( USHORT nCol1, USHORT nCol2,
+ USHORT nSteps )
+{
+ // Die Berechnung ist noch etwas ungenau, daher sollte besser mit floats
+ // gearbeitet werden... (muss !!!)
+ Color aColor( GetItemColor( nCol1 ) );
+ Color aColor2( GetItemColor( nCol2 ) );
+
+ aColor.SetRed( (UINT8) ( ( aColor2.GetRed() - aColor.GetRed() ) / nSteps ) );
+ aColor.SetGreen( (UINT8) ( ( aColor2.GetGreen() - aColor.GetGreen() ) / nSteps ) );
+ aColor.SetBlue( (UINT8) ( ( aColor2.GetBlue() - aColor.GetBlue() ) / nSteps ) );
+
+ return( aColor );
+}
+
+// -----------------------------------------------------------------------
+void ColorMixingControl::FillRow( USHORT nRow )
+{
+ USHORT nCol1 = nRow * mnColumns + 1;
+ USHORT nCol2 = ( nRow + 1 ) * mnColumns;
+ Color aColor( GetItemColor( nCol1 ) );
+ Color aDiffColor( CalcDifferenceColor( nCol1, nCol2, mnColumns - 1 ) );
+
+ for( USHORT i = nCol1 + 1; i < nCol2; i++ )
+ {
+ aColor.SetRed( aColor.GetRed() + aDiffColor.GetRed() );
+ aColor.SetGreen( aColor.GetGreen() + aDiffColor.GetGreen() );
+ aColor.SetBlue( aColor.GetBlue() + aDiffColor.GetBlue() );
+
+ SetItemColor( i, aColor );
+ SetItemText( i, GetRGBString( aColor ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+void ColorMixingControl::FillColumn( USHORT nColumn )
+{
+ USHORT nCol1 = nColumn + 1;
+ USHORT nCol2 = nColumn + ( mnRows - 1 ) * mnColumns + 1;
+ Color aColor( GetItemColor( nCol1 ) );
+ Color aDiffColor( CalcDifferenceColor( nCol1, nCol2, mnRows - 1 ) );
+
+ for( USHORT i = nCol1 + mnColumns; i < nCol2; i += mnColumns )
+ {
+ aColor.SetRed( aColor.GetRed() + aDiffColor.GetRed() );
+ aColor.SetGreen( aColor.GetGreen() + aDiffColor.GetGreen() );
+ aColor.SetBlue( aColor.GetBlue() + aDiffColor.GetBlue() );
+
+ SetItemColor( i, aColor );
+ SetItemText( i, GetRGBString( aColor ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+void ColorMixingControl::SetRows( USHORT nRows )
+{
+ mnRows = nRows;
+}
+
+// -----------------------------------------------------------------------
+void ColorMixingControl::SetColumns( USHORT nColumns )
+{
+ mnColumns = nColumns;
+}
+
+// -----------------------------------------------------------------------
+void ColorMixingControl::SetColor( CMCPosition ePos, const Color& rCol )
+{
+ if( rCol != maColor[ ePos ] )
+ {
+ maColor[ ePos ] = rCol;
+ USHORT nPos, nColumn;
+ String aStr( GetRGBString( rCol ) );
+
+ switch( ePos )
+ {
+ case CMC_TOPLEFT:
+ nPos = 1;
+ nColumn = 0;
+ break;
+
+ case CMC_TOPRIGHT:
+ nPos = mnColumns;
+ nColumn = mnColumns - 1;
+ break;
+
+ case CMC_BOTTOMLEFT:
+ nPos = ( mnRows - 1 ) * mnColumns + 1;
+ nColumn = 0;
+ break;
+
+ case CMC_BOTTOMRIGHT:
+ nPos = mnRows * mnColumns;
+ nColumn = mnColumns - 1;
+ break;
+ }
+ SetItemColor( nPos, rCol );
+ SetItemText( nPos, aStr );
+ FillColumn( nColumn );
+
+ for( USHORT i = 0; i < mnRows; i++ )
+ FillRow( i );
+ }
+}
+
+// -----------------------------------------------------------------------
+String ColorMixingControl::GetRGBString( const Color& rColor )
+{
+ String aStr( String::CreateFromInt32(rColor.GetRed()) );
+ aStr += ' ';
+ aStr += String::CreateFromInt32(rColor.GetGreen());
+ aStr += ' ';
+ aStr += String::CreateFromInt32(rColor.GetBlue());
+
+ return aStr;
+}
+// -----------------------------------------------------------------------
+CMCPosition ColorMixingControl::GetCMCPosition() const
+{
+ CMCPosition ePos = CMC_OTHER;
+ USHORT nPos = GetSelectItemId();
+
+ if( nPos == 1 )
+ ePos = CMC_TOPLEFT;
+ else if( nPos == mnColumns )
+ ePos = CMC_TOPRIGHT;
+ else if( nPos == ( mnRows - 1 ) * mnColumns + 1 )
+ ePos = CMC_BOTTOMLEFT;
+ else if( nPos == mnRows * mnColumns )
+ ePos = CMC_BOTTOMRIGHT;
+
+ return( ePos );
+}
+
+
+// ------------
+// - ColorHSB -
+// ------------
+
+// Erste Ansaetze gingen auf die Berechnung von Sven Hannover zurueck
+// Der jetzige Algorithmus stammt im weitesten Sinne aus dem Foley/VanDam
+
+
+/**************************************************************************
+|*
+|* ColorHSB::ColorHSB()
+|*
+|* Beschreibung RGB nach HSB
+|* Ersterstellung SOH 02.10.97
+|*
+**************************************************************************/
+
+ColorHSB::ColorHSB( const Color& rColor )
+{
+ UINT8 c[3];
+ UINT8 cMax, cMin;
+
+ c[0] = rColor.GetRed();
+ c[1] = rColor.GetGreen();
+ c[2] = rColor.GetBlue();
+
+ cMax = c[0];
+ if( c[1] > cMax )
+ cMax = c[1];
+ if( c[2] > cMax )
+ cMax = c[2];
+
+ // Brightness = max(R, G, B);
+ mnBri = cMax * 100 / 255;
+
+ cMin = c[0];
+ if( c[1] < cMin )
+ cMin = c[1];
+ if( c[2] < cMin )
+ cMin = c[2];
+
+ UINT8 cDelta = cMax - cMin;
+
+ // Saturation = max - min / max
+ if( mnBri > 0 )
+ mnSat = cDelta * 100 / cMax;
+ else
+ mnSat = 0;
+
+ if( mnSat == 0 )
+ mnHue = 0; // Default = undefined
+ else
+ {
+ double dHue;
+
+ if( c[0] == cMax )
+ {
+ dHue = (double)( c[1] - c[2] ) / (double)cDelta;
+ }
+ else if( c[1] == cMax )
+ {
+ dHue = 2.0 + (double)( c[2] - c[0] ) / (double)cDelta;
+ }
+ else if ( c[2] == cMax )
+ {
+ dHue = 4.0 + (double)( c[0] - c[1] ) / (double)cDelta;
+ }
+ dHue *= 60.0;
+
+ if( dHue < 0.0 )
+ dHue += 360.0;
+
+ mnHue = (UINT16) dHue;
+ }
+}
+
+/**************************************************************************
+|*
+|* ColorHSB::GetRGB()
+|*
+|* Beschreibung HSB nach RGB
+|* Ersterstellung SOH 02.10.97
+|*
+**************************************************************************/
+
+Color ColorHSB::GetRGB() const
+{
+ UINT8 cR,cG,cB;
+ UINT8 nB = (UINT8) ( mnBri * 255 / 100 );
+
+ if( mnSat == 0 )
+ {
+ cR = nB;
+ cG = nB;
+ cB = nB;
+ }
+ else
+ {
+ double dH = mnHue;
+ double f;
+ UINT16 n;
+ if( dH == 360.0 )
+ dH = 0.0;
+
+ dH /= 60.0;
+ n = (UINT16) dH;
+ f = dH - n;
+
+ UINT8 a = (UINT8) ( nB * ( 100 - mnSat ) / 100 );
+ UINT8 b = (UINT8) ( nB * ( 100 - ( (double)mnSat * f + 0.5 ) ) / 100 );
+ UINT8 c = (UINT8) ( nB * ( 100 - ( (double)mnSat * ( 1.0 - f ) + 0.5 ) ) / 100 );
+
+ switch( n )
+ {
+ case 0: cR = nB; cG = c; cB = a; break;
+ case 1: cR = b; cG = nB; cB = a; break;
+ case 2: cR = a; cG = nB; cB = c; break;
+ case 3: cR = a; cG = b; cB = nB; break;
+ case 4: cR = c; cG = a; cB = nB; break;
+ case 5: cR = nB; cG = a; cB = b; break;
+ }
+ }
+
+ return( Color( cR, cG, cB ) );
+}
+
+// ------------
+// - ColorCMYK -
+// ------------
+
+
+// -----------------------------------------------------------------------
+ColorCMYK::ColorCMYK( const Color& rColor )
+{
+ mnCyan = 255 - rColor.GetRed();
+ mnMagenta = 255 - rColor.GetGreen();
+ mnYellow = 255 - rColor.GetBlue();
+
+ mnKey = Min( Min( mnCyan, mnMagenta ), mnYellow );
+
+ mnCyan = mnCyan - mnKey;
+ mnMagenta = mnMagenta - mnKey;
+ mnYellow = mnYellow - mnKey;
+}
+
+// -----------------------------------------------------------------------
+Color ColorCMYK::GetRGB() const
+{
+ INT16 nTmp = Max( 0, 255 - ( mnCyan + mnKey ) );
+ UINT8 cR = (UINT8) nTmp;
+ nTmp = Max( 0, 255 - ( mnMagenta + mnKey ) );
+ UINT8 cG = (UINT8) nTmp;
+ nTmp = Max( 0, 255 - ( mnYellow + mnKey ) );
+ UINT8 cB = (UINT8) nTmp;
+
+ return( Color( cR, cG, cB ) );
+}
+
+
diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx
new file mode 100644
index 000000000000..5ffb0640b003
--- /dev/null
+++ b/svtools/source/dialogs/colrdlg.cxx
@@ -0,0 +1,358 @@
+/*************************************************************************
+ *
+ * $RCSfile: colrdlg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "svtdata.hxx"
+#include "colrdlg.hrc"
+#include "colrdlg.hxx"
+
+// ---------------
+// - ColorDialog -
+// ---------------
+
+SvColorDialog::SvColorDialog( Window* pWindow ) :
+ ModalDialog ( pWindow, SvtResId( DLG_COLOR ) ),
+ maColMixCtrl ( this, SvtResId( VAL_SET_COLOR ), 8, 8 ),
+ maBtn1 ( this, SvtResId( BTN_1 ) ),
+ maBtn2 ( this, SvtResId( BTN_2 ) ),
+ //maBtn3 ( this, SvtResId( BTN_3 ) ),
+ //maBtn4 ( this, SvtResId( BTN_4 ) ),
+ //maFtRGB ( this, SvtResId( FT_RGB ) ),
+ maCtlColor ( this, SvtResId( CTL_COLOR ) ),
+
+ maFtCyan ( this, SvtResId( FT_CYAN ) ),
+ maNumCyan ( this, SvtResId( NUM_CYAN ) ),
+ maFtMagenta ( this, SvtResId( FT_MAGENTA ) ),
+ maNumMagenta ( this, SvtResId( NUM_MAGENTA ) ),
+ maFtYellow ( this, SvtResId( FT_YELLOW ) ),
+ maNumYellow ( this, SvtResId( NUM_YELLOW ) ),
+ maFtKey ( this, SvtResId( FT_KEY ) ),
+ maNumKey ( this, SvtResId( NUM_KEY ) ),
+
+ maFtRed ( this, SvtResId( FT_RED ) ),
+ maNumRed ( this, SvtResId( NUM_RED ) ),
+ maFtGreen ( this, SvtResId( FT_GREEN ) ),
+ maNumGreen ( this, SvtResId( NUM_GREEN ) ),
+ maFtBlue ( this, SvtResId( FT_BLUE ) ),
+ maNumBlue ( this, SvtResId( NUM_BLUE ) ),
+
+ maFtHue ( this, SvtResId( FT_HUE ) ),
+ maNumHue ( this, SvtResId( NUM_HUE ) ),
+ maFtSaturation ( this, SvtResId( FT_SATURATION ) ),
+ maNumSaturation ( this, SvtResId( NUM_SATURATION ) ),
+ maFtLuminance ( this, SvtResId( FT_LUMINANCE ) ),
+ maNumLuminance ( this, SvtResId( NUM_LUMINANCE ) ),
+ maCtlPreview ( this, SvtResId( CTL_PREVIEW ) ),
+ maCtlPreviewOld ( this, SvtResId( CTL_PREVIEW_OLD ) ),
+
+ maBtnOK ( this, SvtResId( BTN_OK ) ),
+ maBtnCancel ( this, SvtResId( BTN_CANCEL ) ),
+ maBtnHelp ( this, SvtResId( BTN_HELP ) )
+{
+ FreeResource();
+
+ maColMixCtrl.SetDoubleClickHdl( LINK( this, SvColorDialog, ClickMixCtrlHdl ) );
+ maColMixCtrl.SetSelectHdl( LINK( this, SvColorDialog, SelectMixCtrlHdl ) );
+
+ Link aLink( LINK( this, SvColorDialog, ColorModifyHdl ) );
+ maCtlColor.SetModifyHdl( aLink );
+
+ maNumRed.SetModifyHdl( aLink );
+ maNumGreen.SetModifyHdl( aLink );
+ maNumBlue.SetModifyHdl( aLink );
+
+ maNumCyan.SetModifyHdl( aLink );
+ maNumMagenta.SetModifyHdl( aLink );
+ maNumYellow.SetModifyHdl( aLink );
+ maNumKey.SetModifyHdl( aLink );
+
+ maNumHue.SetModifyHdl( aLink );
+ maNumSaturation.SetModifyHdl( aLink );
+ maNumLuminance.SetModifyHdl( aLink );
+
+ aLink = ( LINK( this, SvColorDialog, ClickBtnHdl ) );
+ maBtn1.SetClickHdl( aLink );
+ maBtn2.SetClickHdl( aLink );
+ //maBtn3.SetClickHdl( aLink );
+ //maBtn4.SetClickHdl( aLink );
+
+ maColMixCtrl.SetExtraSpacing( 0 );
+}
+
+
+// -----------------------------------------------------------------------
+SvColorDialog::~SvColorDialog()
+{
+}
+
+// -----------------------------------------------------------------------
+void SvColorDialog::Initialize()
+{
+ maNumRed.SetValue( maColor.GetRed() );
+ maNumGreen.SetValue( maColor.GetGreen() );
+ maNumBlue.SetValue( maColor.GetBlue() );
+
+ ColorCMYK aColorCMYK( maColor );
+
+ long aCyan = (long) ( (double)aColorCMYK.GetCyan() * 100.0 / 255.0 + 0.5 );
+ long aMagenta = (long) ( (double)aColorCMYK.GetMagenta() * 100.0 / 255.0 + 0.5 );
+ long aYellow = (long) ( (double)aColorCMYK.GetYellow() * 100.0 / 255.0 + 0.5 );
+ long aKey = (long) ( (double)aColorCMYK.GetKey() * 100.0 / 255.0 + 0.5 );
+ maNumCyan.SetValue( aCyan );
+ maNumMagenta.SetValue( aMagenta );
+ maNumYellow.SetValue( aYellow );
+ maNumKey.SetValue( aKey );
+
+ ColorHSB aColorHSB( maColor );
+ maNumHue.SetValue( aColorHSB.GetHue() );
+ maNumSaturation.SetValue( aColorHSB.GetSat() );
+ maNumLuminance.SetValue( aColorHSB.GetBri() );
+
+ maCtlColor.SetColor( aColorHSB );
+
+ maColMixCtrl.SelectItem( 1 );
+
+ maCtlPreview.SetColor( maColor );
+ maCtlPreviewOld.SetColor( maColor );
+}
+
+// -----------------------------------------------------------------------
+void SvColorDialog::SetColor( const Color& rColor )
+{
+ maColor = rColor;
+}
+
+// -----------------------------------------------------------------------
+const Color& SvColorDialog::GetColor() const
+{
+ return( maColor );
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( SvColorDialog, ColorModifyHdl, void *, p )
+{
+ UINT16 n = 0x00; // 1 == RGB, 2 == CMYK, 4 == HSB
+
+ if( p == &maCtlColor )
+ {
+ maColor = maCtlColor.GetColor();
+ maNumRed.SetValue( maColor.GetRed() );
+ maNumGreen.SetValue( maColor.GetGreen() );
+ maNumBlue.SetValue( maColor.GetBlue() );
+
+ n = 7;
+ }
+ else if( p == &maNumRed )
+ {
+ maColor.SetRed( (UINT8)maNumRed.GetValue() );
+ maCtlColor.SetColor( maColor );
+ n = 6;
+ }
+ else if( p == &maNumGreen )
+ {
+ maColor.SetGreen( (UINT8)maNumGreen.GetValue() );
+ maCtlColor.SetColor( maColor );
+ n = 6;
+ }
+ else if( p == &maNumBlue )
+ {
+ maColor.SetBlue( (UINT8)maNumBlue.GetValue() );
+ maCtlColor.SetColor( maColor );
+ n = 6;
+ }
+ else if( p == &maNumHue ||
+ p == &maNumSaturation ||
+ p == &maNumLuminance )
+ {
+
+ ColorHSB aColorHSB( (UINT16) maNumHue.GetValue(),
+ (UINT16) maNumSaturation.GetValue(),
+ (UINT16) maNumLuminance.GetValue() );
+ maCtlColor.SetColor( aColorHSB );
+ maColor = maCtlColor.GetColor();
+ n = 3;
+ }
+ else if( p == &maNumCyan ||
+ p == &maNumMagenta ||
+ p == &maNumYellow ||
+ p == &maNumKey )
+ {
+ long aCyan = (long) ( (double)maNumCyan.GetValue() * 255.0 / 100.0 + 0.5 );
+ long aMagenta = (long) ( (double)maNumMagenta.GetValue() * 255.0 / 100.0 + 0.5 );
+ long aYellow = (long) ( (double)maNumYellow.GetValue() * 255.0 / 100.0 + 0.5 );
+ long aKey = (long) ( (double)maNumKey.GetValue() * 255.0 / 100.0 + 0.5 );
+
+ ColorCMYK aColorCMYK( (UINT16) aCyan,
+ (UINT16) aMagenta,
+ (UINT16) aYellow,
+ (UINT16) aKey );
+ maColor = aColorCMYK.GetRGB();
+ maCtlColor.SetColor( maColor );
+ n = 5;
+ }
+
+ if( n & 1 ) // RGB setzen
+ {
+ maNumRed.SetValue( maColor.GetRed() );
+ maNumGreen.SetValue( maColor.GetGreen() );
+ maNumBlue.SetValue( maColor.GetBlue() );
+ }
+ if( n & 2 ) // CMYK setzen
+ {
+ ColorCMYK aColorCMYK( maColor );
+ long aCyan = (long) ( (double)aColorCMYK.GetCyan() * 100.0 / 255.0 + 0.5 );
+ long aMagenta = (long) ( (double)aColorCMYK.GetMagenta() * 100.0 / 255.0 + 0.5 );
+ long aYellow = (long) ( (double)aColorCMYK.GetYellow() * 100.0 / 255.0 + 0.5 );
+ long aKey = (long) ( (double)aColorCMYK.GetKey() * 100.0 / 255.0 + 0.5 );
+ maNumCyan.SetValue( aCyan );
+ maNumMagenta.SetValue( aMagenta );
+ maNumYellow.SetValue( aYellow );
+ maNumKey.SetValue( aKey );
+ }
+ if( n & 4 ) // HSB setzen
+ {
+ ColorHSB aColorHSB( maColor );
+ maNumHue.SetValue( aColorHSB.GetHue() );
+ maNumSaturation.SetValue( aColorHSB.GetSat() );
+ maNumLuminance.SetValue( aColorHSB.GetBri() );
+ }
+
+ maCtlPreview.SetColor( maColor );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( SvColorDialog, ClickBtnHdl, void *, p )
+{
+ /*
+ Color aColor = maCtlColor.GetColor();
+ if( p == &maBtn1 )
+ maColMixCtrl.SetColor( CMC_TOPLEFT, aColor );
+ if( p == &maBtn2 )
+ maColMixCtrl.SetColor( CMC_TOPRIGHT, aColor );
+ if( p == &maBtn3 )
+ maColMixCtrl.SetColor( CMC_BOTTOMLEFT, aColor );
+ if( p == &maBtn4 )
+ maColMixCtrl.SetColor( CMC_BOTTOMRIGHT, aColor );
+ */
+
+ if( p == &maBtn1 )
+ {
+ CMCPosition ePos = maColMixCtrl.GetCMCPosition();
+ if( ePos != CMC_OTHER )
+ maColMixCtrl.SetColor( ePos, maColor );
+ }
+ else if( p == &maBtn2 )
+ {
+ USHORT nPos = maColMixCtrl.GetSelectItemId();
+ maColor = maColMixCtrl.GetItemColor( nPos );
+ maCtlColor.SetColor( maColor );
+ ColorModifyHdl( &maCtlColor );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( SvColorDialog, ClickMixCtrlHdl, void *, p )
+{
+ USHORT nPos = maColMixCtrl.GetSelectItemId();
+ CMCPosition ePos = maColMixCtrl.GetCMCPosition();
+
+ if( ePos != CMC_OTHER )
+ maColMixCtrl.SetColor( ePos, maColor );
+ else
+ {
+ maColor = maColMixCtrl.GetItemColor( nPos );
+ maCtlColor.SetColor( maColor );
+ ColorModifyHdl( &maCtlColor );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+IMPL_LINK( SvColorDialog, SelectMixCtrlHdl, void *, p )
+{
+ //USHORT nPos = maColMixCtrl.GetSelectItemId();
+ //maFtRGB.SetText( maColMixCtrl.GetItemText( nPos ) );
+
+ CMCPosition ePos = maColMixCtrl.GetCMCPosition();
+ if( ePos == CMC_OTHER )
+ maBtn1.Enable( FALSE );
+ else
+ maBtn1.Enable();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+short SvColorDialog::Execute()
+{
+ Initialize();
+
+ short nRet = ModalDialog::Execute();
+
+ return( nRet );
+}
+
diff --git a/svtools/source/dialogs/colrdlg.hrc b/svtools/source/dialogs/colrdlg.hrc
new file mode 100644
index 000000000000..6d06df632a8e
--- /dev/null
+++ b/svtools/source/dialogs/colrdlg.hrc
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: colrdlg.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define DLG_COLOR 996
+
+#define VAL_SET_COLOR 2
+#define BTN_1 1
+#define BTN_2 2
+#define BTN_3 3
+#define BTN_4 4
+#define FT_RGB 12
+
+#define CTL_COLOR 1
+
+#define FT_RED 1
+#define NUM_RED 1
+#define FT_GREEN 2
+#define NUM_GREEN 2
+#define FT_BLUE 3
+#define NUM_BLUE 3
+
+#define FT_CYAN 7
+#define NUM_CYAN 7
+#define FT_MAGENTA 8
+#define NUM_MAGENTA 8
+#define FT_YELLOW 9
+#define NUM_YELLOW 9
+#define FT_KEY 10
+#define NUM_KEY 10
+
+#define FT_HUE 4
+#define NUM_HUE 4
+#define FT_SATURATION 5
+#define NUM_SATURATION 5
+#define FT_LUMINANCE 6
+#define NUM_LUMINANCE 6
+
+#define CTL_PREVIEW 3
+#define CTL_PREVIEW_OLD 4
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+
diff --git a/svtools/source/dialogs/colrdlg.src b/svtools/source/dialogs/colrdlg.src
new file mode 100644
index 000000000000..e9b07fd387a1
--- /dev/null
+++ b/svtools/source/dialogs/colrdlg.src
@@ -0,0 +1,576 @@
+/*************************************************************************
+ *
+ * $RCSfile: colrdlg.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "colrdlg.hrc"
+#define DIFF 3
+ModalDialog DLG_COLOR
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 165 + DIFF ) ;
+ Moveable = TRUE ;
+ Text = "Farbe" ;
+ Text [ ENGLISH ] = "Color" ;
+ Text [ english_us ] = "Color" ;
+ Text [ portuguese_brazilian ] = "Farbe" ;
+ Text [ swedish ] = "Färg" ;
+ Text [ danish ] = "Farve" ;
+ Text [ italian ] = "Colore" ;
+ Text [ spanish ] = "Color" ;
+ Text [ french ] = "Couleur" ;
+ Text [ dutch ] = "Kleur" ;
+ Text [ portuguese ] = "Cor" ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 205 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 205 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 205 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Control CTL_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 100 , 6 ) ;
+ Size = MAP_APPFONT ( 100 , 100 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_RED
+ {
+ Pos = MAP_APPFONT ( 64 , 123 + DIFF ) ;
+ Size = MAP_APPFONT ( 23 , 10 ) ;
+ Text = "~Rot" ;
+ Text [ ENGLISH ] = "~Red" ;
+ Text [ english_us ] = "~Red" ;
+ Text [ portuguese_brazilian ] = "~Rot" ;
+ Text [ swedish ] = "~Rött" ;
+ Text [ danish ] = "Rød" ;
+ Text [ italian ] = "~Rosso" ;
+ Text [ spanish ] = "~Rojo" ;
+ Text [ french ] = "~Rouge" ;
+ Text [ dutch ] = "~Rood" ;
+ Text [ portuguese ] = "~Vermelho" ;
+ Text[ chinese_simplified ] = "ºìÉ«(~R)";
+ Text[ russian ] = "~Êðàñí.";
+ Text[ polish ] = "Czerw.";
+ Text[ japanese ] = "Ô(~R)";
+ Text[ chinese_traditional ] = "¬õ¦â(~R)";
+ Text[ arabic ] = "ÃÍãÑ";
+ Text[ dutch ] = "~Rood";
+ Text[ chinese_simplified ] = "ºìÉ«(~R)";
+ Text[ greek ] = "Êüêêéíï";
+ Text[ korean ] = "»¡°­(~R)";
+ Text[ turkish ] = "~Kýrmýzý";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_GREEN
+ {
+ Pos = MAP_APPFONT ( 64 , 136 + DIFF ) ;
+ Size = MAP_APPFONT ( 23 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Grün : ~Gr³n */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Grün : ~Gr³n */
+ Text = "~Grün" ;
+ Text [ ENGLISH ] = "~Green" ;
+ Text [ english_us ] = "~Green" ;
+ Text [ portuguese_brazilian ] = "~Grün" ;
+ Text [ swedish ] = "~Grönt" ;
+ Text [ danish ] = "Grøn" ;
+ Text [ italian ] = "~Verde" ;
+ Text [ spanish ] = "~Verde" ;
+ Text [ french ] = "~Vert" ;
+ Text [ dutch ] = "~Groen" ;
+ Text [ portuguese ] = "~Verde" ;
+ Text[ chinese_simplified ] = "ÂÌÉ«(~G)";
+ Text[ russian ] = "~Çåëåí.";
+ Text[ polish ] = "Zielony";
+ Text[ japanese ] = "—Î(~G)";
+ Text[ chinese_traditional ] = "ºñ¦â(~G)";
+ Text[ arabic ] = "ÃÎÖÑ";
+ Text[ dutch ] = "~Groen";
+ Text[ chinese_simplified ] = "ÂÌÉ«(~G)";
+ Text[ greek ] = "ÐñÜóéíï";
+ Text[ korean ] = "ÃÊ·Ï(~G)";
+ Text[ turkish ] = "~Yeþil";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_BLUE
+ {
+ Pos = MAP_APPFONT ( 64 , 149 + DIFF ) ;
+ Size = MAP_APPFONT ( 23 , 10 ) ;
+ Text = "~Blau" ;
+ Text [ ENGLISH ] = "~Blue" ;
+ Text [ english_us ] = "~Blue" ;
+ Text [ portuguese_brazilian ] = "~Blau" ;
+ Text [ swedish ] = "~Blått" ;
+ Text [ danish ] = "Blå" ;
+ Text [ italian ] = "~Blu" ;
+ Text [ spanish ] = "~Azul" ;
+ Text [ french ] = "~Bleu" ;
+ Text [ dutch ] = "~Blauw" ;
+ Text [ portuguese ] = "~Azul" ;
+ Text[ chinese_simplified ] = "À¶É«(~B)";
+ Text[ russian ] = "Ñèíèé";
+ Text[ polish ] = "Nieb.";
+ Text[ japanese ] = "Â(~B)";
+ Text[ chinese_traditional ] = "ÂŦâ(~B)";
+ Text[ arabic ] = "ÃÒÑÞ";
+ Text[ dutch ] = "~Blauw";
+ Text[ chinese_simplified ] = "À¶É«(~B)";
+ Text[ greek ] = "Ìðëå";
+ Text[ korean ] = "ÆĶû(~B)";
+ Text[ turkish ] = "~Mavi";
+ Text[ language_user1 ] = " ";
+ };
+ NumericField NUM_RED
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 122 + DIFF ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 255 ;
+ Last = 255 ;
+ };
+ NumericField NUM_GREEN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 135 + DIFF ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 255 ;
+ Last = 255 ;
+ };
+ NumericField NUM_BLUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 148 + DIFF ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 255 ;
+ Last = 255 ;
+ };
+ FixedText FT_CYAN
+ {
+ Pos = MAP_APPFONT ( 6 , 110 + DIFF ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text = "~Cyan" ;
+ Text [ ENGLISH ] = "~Cyan" ;
+ Text [ english_us ] = "~Cyan" ;
+ Text [ portuguese_brazilian ] = "~Cyan" ;
+ Text [ swedish ] = "~Cyanblått" ;
+ Text [ danish ] = "Cyan" ;
+ Text [ italian ] = "~Ciano" ;
+ Text [ spanish ] = "~Cian" ;
+ Text [ french ] = "~Cyan" ;
+ Text [ dutch ] = "~Cyaan" ;
+ Text [ portuguese ] = "~Ciano" ;
+ Text[ chinese_simplified ] = "À¶ÂÌÉ«(~C)";
+ Text[ russian ] = "Ãîëóáîé";
+ Text[ polish ] = "Nieb.-ziel.";
+ Text[ japanese ] = "¼±Ý(~C)";
+ Text[ chinese_traditional ] = "Âźñ¦â(~C)";
+ Text[ arabic ] = "ÃÒÑÞ ÓãÇæí";
+ Text[ dutch ] = "~Cyaan";
+ Text[ chinese_simplified ] = "À¶ÂÌÉ«(~C)";
+ Text[ greek ] = "Êõáíü";
+ Text[ korean ] = "û·Ï(~C)";
+ Text[ turkish ] = "~Camgöbeði";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_MAGENTA
+ {
+ Pos = MAP_APPFONT ( 6 , 123 + DIFF ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text = "~Magenta" ;
+ Text [ ENGLISH ] = "~Magenta" ;
+ Text [ english_us ] = "~Magenta" ;
+ Text [ portuguese_brazilian ] = "~Magenta" ;
+ Text [ swedish ] = "~Magenta" ;
+ Text [ danish ] = "Magenta" ;
+ Text [ italian ] = "~Magenta" ;
+ Text [ spanish ] = "~Magenta" ;
+ Text [ french ] = "~Magenta" ;
+ Text [ dutch ] = "~Magenta" ;
+ Text [ portuguese ] = "~Magenta" ;
+ Text[ chinese_simplified ] = "×ϺìÉ«(~M)";
+ Text[ russian ] = "~Ëèëîâûé";
+ Text[ polish ] = "Purpurowy";
+ Text[ japanese ] = "ϾÞÝÀ(~M)";
+ Text[ chinese_traditional ] = "µµ¬õ¦â(~M)";
+ Text[ arabic ] = "ÃÑÌæÇäí";
+ Text[ dutch ] = "~Magenta";
+ Text[ chinese_simplified ] = "×ϺìÉ«(~M)";
+ Text[ greek ] = "ÌáôæÝíôá";
+ Text[ korean ] = "¸¶Á¨Å¸(~M)";
+ Text[ turkish ] = "M~or";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_YELLOW
+ {
+ Pos = MAP_APPFONT ( 6 , 136 + DIFF ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text = "~Yellow" ;
+ Text [ ENGLISH ] = "~Yellow" ;
+ Text [ english_us ] = "~Yellow" ;
+ Text [ portuguese_brazilian ] = "~Yellow" ;
+ Text [ swedish ] = "~Gult" ;
+ Text [ danish ] = "Gul" ;
+ Text [ italian ] = "~Giallo" ;
+ Text [ spanish ] = "~Amarillo" ;
+ Text [ french ] = "~Jaune" ;
+ Text [ dutch ] = "~Yellow" ;
+ Text [ portuguese ] = "~Amarelo" ;
+ Text[ chinese_simplified ] = "»ÆÉ«(~Y)";
+ Text[ russian ] = "~Æåëòûé";
+ Text[ polish ] = "¯ó³ty";
+ Text[ japanese ] = "‰©(~Y)";
+ Text[ chinese_traditional ] = "¶À¦â(~Y)";
+ Text[ arabic ] = "ÃÕÝÑ";
+ Text[ dutch ] = "~Yellow";
+ Text[ chinese_simplified ] = "»ÆÉ«(~Y)";
+ Text[ greek ] = "Êßôñéíï";
+ Text[ korean ] = "³ë¶û(~Y)";
+ Text[ turkish ] = "~Sarý";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_KEY
+ {
+ Pos = MAP_APPFONT ( 6 , 149 + DIFF ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text = "~Key" ;
+ Text [ ENGLISH ] = "~Key" ;
+ Text [ english_us ] = "~Key" ;
+ Text [ portuguese_brazilian ] = "~Key" ;
+ Text [ swedish ] = "~Key" ;
+ Text [ danish ] = "Nøgle" ;
+ Text [ italian ] = "~Chiave" ;
+ Text [ spanish ] = "~Llave" ;
+ Text [ french ] = "~Khôl" ;
+ Text [ dutch ] = "~Key" ;
+ Text [ portuguese ] = "~Chave" ;
+ Text[ chinese_simplified ] = "¼üÂë(~K)";
+ Text[ russian ] = "~Êëþ÷";
+ Text[ polish ] = "Klucz";
+ Text[ japanese ] = "•(~K)";
+ Text[ chinese_traditional ] = "Áä½X(~K)";
+ Text[ arabic ] = "ãÝÊÇÍ";
+ Text[ dutch ] = "~Key";
+ Text[ chinese_simplified ] = "¼üÂë(~K)";
+ Text[ greek ] = "~Êëåéäß";
+ Text[ korean ] = "Å°(~K)";
+ Text[ turkish ] = "~Key";
+ Text[ language_user1 ] = " ";
+ };
+ MetricField NUM_CYAN
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 34 , 109 + DIFF ) ;
+ Size = MAP_APPFONT ( 27 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Last = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ MetricField NUM_MAGENTA
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 34 , 122 + DIFF ) ;
+ Size = MAP_APPFONT ( 27 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Last = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ MetricField NUM_YELLOW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 34 , 135 + DIFF ) ;
+ Size = MAP_APPFONT ( 27 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Last = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ MetricField NUM_KEY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 34 , 148 + DIFF ) ;
+ Size = MAP_APPFONT ( 27 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Last = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = " %" ;
+ };
+ Control CTL_PREVIEW_OLD
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 184 , 109 ) ;
+ Size = MAP_APPFONT ( 35 , 51 + DIFF ) ;
+ TabStop = TRUE ;
+ };
+ Control CTL_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 219 , 109 ) ;
+ Size = MAP_APPFONT ( 35 , 51 + DIFF ) ;
+ TabStop = TRUE ;
+ };
+ Control VAL_SET_COLOR
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 91 , 100 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_HUE
+ {
+ Pos = MAP_APPFONT ( 117 , 123 + DIFF ) ;
+ Size = MAP_APPFONT ( 35 , 10 ) ;
+ Text = "~Farbe" ;
+ Text [ ENGLISH ] = "H~ue" ;
+ Text [ english_us ] = "H~ue" ;
+ Text [ portuguese_brazilian ] = "~Farbe" ;
+ Text [ swedish ] = "~Färg" ;
+ Text [ danish ] = "Farve" ;
+ Text [ italian ] = "~Colore" ;
+ Text [ spanish ] = "~Color" ;
+ Text [ french ] = "~Teinte" ;
+ Text [ dutch ] = "~Kleur" ;
+ Text [ portuguese ] = "~Tons" ;
+ Text[ chinese_simplified ] = "ÑÕÉ«(~U)";
+ Text[ russian ] = "Öâåò";
+ Text[ polish ] = "Kolor";
+ Text[ japanese ] = "F‡‚¢(~U)";
+ Text[ chinese_traditional ] = "ÃC¦â(~U)";
+ Text[ arabic ] = "Çááæä";
+ Text[ dutch ] = "~Kleur";
+ Text[ chinese_simplified ] = "ÑÕÉ«(~U)";
+ Text[ greek ] = "×ñþìá";
+ Text[ korean ] = "»öÁ¶(~U)";
+ Text[ turkish ] = "~Renk";
+ Text[ language_user1 ] = " ";
+ };
+ NumericField NUM_HUE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 153 , 122 + DIFF ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 359 ;
+ Last = 359 ;
+ };
+ FixedText FT_SATURATION
+ {
+ Pos = MAP_APPFONT ( 117 , 136 + DIFF ) ;
+ Size = MAP_APPFONT ( 35 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Sättigung : ~Sõttigung */
+ /* ### ACHTUNG: Neuer Text in Resource? ~Sättigung : ~Sõttigung */
+ Text = "~Sättigung" ;
+ Text [ ENGLISH ] = "~Saturation" ;
+ Text [ english_us ] = "~Saturation" ;
+ Text [ portuguese_brazilian ] = "~Sättigung" ;
+ Text [ swedish ] = "Mä~ttnad" ;
+ Text [ danish ] = "Mætning" ;
+ Text [ italian ] = "~Saturazione" ;
+ Text [ spanish ] = "~Saturación" ;
+ Text [ french ] = "S~aturation" ;
+ Text [ dutch ] = "~Verzadiging" ;
+ Text [ portuguese ] = "~Saturação" ;
+ Text[ chinese_simplified ] = "±¥ºÍ¶È(~S)";
+ Text[ russian ] = "~Íàñûùåí.";
+ Text[ polish ] = "Nasycenie";
+ Text[ japanese ] = "Ê“x(~S)";
+ Text[ chinese_traditional ] = "¹¡©M«×(~S)";
+ Text[ arabic ] = "ÇáÅÔÈÇÚ";
+ Text[ dutch ] = "~Verzadiging";
+ Text[ chinese_simplified ] = "±¥ºÍ¶È(~S)";
+ Text[ greek ] = "Êïñå~óìüò";
+ Text[ korean ] = "äµµ(~S)";
+ Text[ turkish ] = "~Doygunluk";
+ Text[ language_user1 ] = " ";
+ };
+ NumericField NUM_SATURATION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 153 , 135 + DIFF ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Last = 100 ;
+ };
+ FixedText FT_LUMINANCE
+ {
+ Pos = MAP_APPFONT ( 117 , 149 + DIFF ) ;
+ Size = MAP_APPFONT ( 35 , 10 ) ;
+ Text = "He~lligkeit" ;
+ Text [ ENGLISH ] = "~Luminance" ;
+ Text [ english_us ] = "Bright~ness" ;
+ Text [ portuguese_brazilian ] = "He~lligkeit" ;
+ Text [ swedish ] = "~Ljusstyrka" ;
+ Text [ danish ] = "Lysstyrke" ;
+ Text [ italian ] = "~Luminosità" ;
+ Text [ spanish ] = "~Brillo" ;
+ Text [ french ] = "~Luminosité" ;
+ Text [ dutch ] = "Hel~derheid" ;
+ Text [ portuguese ] = "~Brilho" ;
+ Text[ chinese_simplified ] = "ÁÁ¶È(~L)";
+ Text[ russian ] = "ßðêîñòü";
+ Text[ polish ] = "JasnoϾ";
+ Text[ japanese ] = "–¾“x(~L)";
+ Text[ chinese_traditional ] = "«G«×(~L)";
+ Text[ arabic ] = "ÇáÅÖÇÁÉ";
+ Text[ dutch ] = "Hel~derheid";
+ Text[ chinese_simplified ] = "ÁÁ¶È(~L)";
+ Text[ greek ] = "Öùôåéíüôçôá";
+ Text[ korean ] = "¹à±â(~N)";
+ Text[ turkish ] = "Par~laklýk";
+ Text[ language_user1 ] = " ";
+ };
+ NumericField NUM_LUMINANCE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 153 , 148 + DIFF ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Last = 100 ;
+ };
+ /*
+ FixedText FT_RGB {
+ Pos = MAP_APPFONT( 6, 110 );
+ Size = MAP_APPFONT( 43, 10 );
+ };
+*/
+ PushButton BTN_1
+ {
+ Pos = MAP_APPFONT ( 80 , 109 ) ;
+ Size = MAP_APPFONT ( 17 , 12 ) ;
+ Text = "~<--" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_2
+ {
+ Pos = MAP_APPFONT ( 100 , 109 ) ;
+ Size = MAP_APPFONT ( 17 , 12 ) ;
+ Text = "--~>" ;
+ TabStop = TRUE ;
+ };
+ /*
+ PushButton BTN_3 {
+ Pos = MAP_APPFONT( 6, 137 );
+ Size = MAP_APPFONT( 12, 12 );
+ Text = "~3";
+ TabStop = TRUE;
+ };
+ PushButton BTN_4 {
+ Pos = MAP_APPFONT( 21, 137 );
+ Size = MAP_APPFONT( 12, 12 );
+ Text = "~4";
+ TabStop = TRUE;
+ };
+*/
+ Text[ chinese_simplified ] = "ÑÕÉ«";
+ Text[ russian ] = "Öâåò";
+ Text[ polish ] = "Kolor";
+ Text[ japanese ] = "F";
+ Text[ chinese_traditional ] = "ÃC¦â";
+ Text[ arabic ] = "Çááæä";
+ Text[ dutch ] = "Kleur";
+ Text[ chinese_simplified ] = "ÑÕÉ«";
+ Text[ greek ] = "×ñþìá";
+ Text[ korean ] = "»ö»ó";
+ Text[ turkish ] = "Renk";
+ Text[ language_user1 ] = " ";
+};
diff --git a/svtools/source/dialogs/filedlg.cxx b/svtools/source/dialogs/filedlg.cxx
new file mode 100644
index 000000000000..f596badb43e6
--- /dev/null
+++ b/svtools/source/dialogs/filedlg.cxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * $RCSfile: filedlg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <filedlg.hxx>
+#include <filedlg2.hxx>
+#include <vcl/rcid.h>
+
+PathDialog::PathDialog( Window* _pParent, WinBits nStyle, BOOL bCreateDir ) :
+ ModalDialog( _pParent, WB_STDMODAL | nStyle )
+{
+ pImpFileDlg = new ImpSvFileDlg;
+ pImpFileDlg->CreateDialog( this, nStyle, WINDOW_PATHDIALOG, bCreateDir );
+}
+
+PathDialog::~PathDialog()
+{
+ delete pImpFileDlg;
+}
+
+short PathDialog::Execute()
+{
+ pImpFileDlg->GetDialog()->PreExecute();
+ short n = ModalDialog::Execute();
+ return n;
+}
+
+UniString PathDialog::GetPath() const
+{
+ return pImpFileDlg->GetDialog()->GetPath();
+}
+
+void PathDialog::SetPath( const UniString& rPath )
+{
+ pImpFileDlg->GetDialog()->SetPath( rPath );
+}
+
+void PathDialog::SetPath( const Edit& rEdit )
+{
+ pImpFileDlg->GetDialog()->SetPath( rEdit );
+}
+
+long PathDialog::OK()
+{
+ if( aOKHdlLink.IsSet() )
+ return aOKHdlLink.Call( this );
+ else
+ return TRUE;
+}
+
+
+FileDialog::FileDialog( Window* _pParent, WinBits nStyle ) :
+ PathDialog( _pParent, WB_STDMODAL | nStyle )
+{
+ // Dadurch dass hier bei VCL nicht der CTOR mit ResType verwendet wird,
+ // wurde im PathDialog-CTOR leider ein ImpPathDialog angelegt...
+ // So zwar scheisse, aber der Dialog ist eh' nur ein Hack:
+ pImpFileDlg->CreateDialog( this, nStyle, WINDOW_FILEDIALOG, FALSE );
+}
+
+FileDialog::~FileDialog()
+{
+}
+
+void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask )
+{
+ ((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask );
+}
+
+void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask, const UniString& rSysType )
+{
+ ((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask );
+}
+
+void FileDialog::RemoveFilter( const UniString& rFilter )
+{
+ ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveFilter( rFilter );
+}
+
+void FileDialog::RemoveAllFilter()
+{
+ ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveAllFilter();
+}
+
+void FileDialog::SetCurFilter( const UniString& rFilter )
+{
+ ((ImpFileDialog*)pImpFileDlg->GetDialog())->SetCurFilter( rFilter );
+}
+
+UniString FileDialog::GetCurFilter() const
+{
+ return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetCurFilter();
+}
+
+void FileDialog::FileSelect()
+{
+ aFileHdlLink.Call( this );
+}
+
+void FileDialog::FilterSelect()
+{
+ aFilterHdlLink.Call( this );
+}
+
+USHORT FileDialog::GetFilterCount() const
+{
+ return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterCount();
+}
+
+UniString FileDialog::GetFilterName( USHORT nPos ) const
+{
+ return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterName( nPos );
+}
+
+UniString FileDialog::GetFilterType( USHORT nPos ) const
+{
+ return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos );
+}
+
+void FileDialog::SetOkButtonText( const UniString& rText )
+{
+ pImpFileDlg->SetOkButtonText( rText );
+}
+
+void FileDialog::SetCancelButtonText( const UniString& rText )
+{
+ pImpFileDlg->SetCancelButtonText( rText );
+}
diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx
new file mode 100644
index 000000000000..cd798724a878
--- /dev/null
+++ b/svtools/source/dialogs/filedlg2.cxx
@@ -0,0 +1,1377 @@
+/*************************************************************************
+ *
+ * $RCSfile: filedlg2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _SV_FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _SV_EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#ifndef _SV_LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <svtdata.hxx>
+
+#include <filedlg2.hxx>
+#include <filedlg.hxx>
+#include <filedlg2.hrc>
+
+#ifndef _SV_MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#ifndef _VOS_SECURITY_HXX_
+#include <vos/security.hxx>
+#endif
+
+#include <vcl/rcid.h>
+
+#include <stdctrl.hxx>
+
+#if defined (WNT) && defined (MSC)
+#pragma optimize ("", off)
+#endif
+
+#include <helpid.hrc>
+
+
+DECLARE_LIST( UniStringList, UniString* );
+
+#define STD_BTN_WIDTH 80
+#define STD_BTN_HEIGHT 26
+
+#ifndef UNX
+ #define ALLFILES "*.*"
+#else
+ #define ALLFILES "*"
+#endif
+// #define STD_BTN_WIDTH 90
+// #define STD_BTN_HEIGHT 35
+
+#define INITCONTROL( p, ControlClass, nBits, aPos, aSize, aTitel, nHelpId ) \
+ p = new ControlClass( GetPathDialog(), WinBits( nBits ) ); \
+ p->SetHelpId( nHelpId ); \
+ p->SetPosSizePixel( aPos, aSize ); \
+ p->SetText( aTitel ); \
+ p->Show();
+
+
+inline BOOL IsPrintable( sal_Unicode c )
+{
+ return c >= 32 && c != 127 ? TRUE : FALSE;
+}
+
+long
+KbdListBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
+ sal_Unicode cCharCode = aKeyEvt.GetCharCode();
+
+ if ( IsPrintable ( cCharCode ) )
+ {
+ USHORT nCurrentPos = GetSelectEntryPos();
+ USHORT nEntries = GetEntryCount();
+
+ for ( USHORT i = 1; i < nEntries; i++ )
+ {
+ UniString aEntry = GetEntry ( (i + nCurrentPos) % nEntries );
+ aEntry.EraseLeadingChars( ' ' );
+ aEntry.ToUpperAscii();
+ UniString aCompare( cCharCode );
+ aCompare.ToUpperAscii();
+
+ if ( aEntry.CompareTo( aCompare, 1 ) == COMPARE_EQUAL )
+ {
+ SelectEntryPos ( (i + nCurrentPos) % nEntries );
+ break;
+ }
+ }
+ }
+ else
+ if ( aKeyEvt.GetKeyCode().GetCode() == KEY_RETURN )
+ {
+ DoubleClick();
+ }
+ }
+
+ return ListBox::PreNotify ( rNEvt );
+}
+
+ImpPathDialog::ImpPathDialog( PathDialog* pDlg, WinBits nWinBits, RESOURCE_TYPE nType, BOOL bCreateDir )
+{
+ pSvPathDialog = pDlg;
+ nDirCount = 0;
+
+ // initialize Controls if not used as a base class
+ if ( nType == WINDOW_PATHDIALOG )
+ {
+ InitControls();
+ if( pNewDirBtn )
+ pNewDirBtn->Enable( bCreateDir );
+ }
+
+ pDlg->SetHelpId( HID_FILEDLG_PATHDLG );
+}
+
+ImpPathDialog::~ImpPathDialog()
+{
+ delete pEdit;
+ delete pDirTitel;
+ delete pDirList;
+ delete pDirPath;
+ delete pDriveList;
+ delete pDriveTitle;
+ delete pLoadBtn;
+ delete pOkBtn;
+ delete pCancelBtn;
+ delete pNewDirBtn;
+# ifdef UNX
+ delete pHomeBtn;
+# endif
+}
+
+void ImpPathDialog::InitControls()
+{
+ PathDialog* pDlg = GetPathDialog();
+ pDlg->SetText( UniString( SvtResId( STR_FILEDLG_SELECT ) ) );
+
+ Size a3Siz = pDlg->LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
+ Size a6Siz = pDlg->LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
+ Size aBtnSiz = pDlg->LogicToPixel( Size( 70, 14 ), MAP_APPFONT );
+ Size aFTSiz = pDlg->LogicToPixel( Size( 142, 10 ), MAP_APPFONT );
+ Size aEDSiz = pDlg->LogicToPixel( Size( 142, 12 ), MAP_APPFONT );
+ Point aPnt( a6Siz.Width(), a6Siz.Height() );
+ long nLbH1 = pDlg->LogicToPixel( Size( 0, 93 ), MAP_APPFONT ).Height();
+ long nLbH2 = pDlg->LogicToPixel( Size( 0, 60 ), MAP_APPFONT ).Height();
+ long nH = 0;
+ UniString aEmptyStr;
+
+ INITCONTROL( pDirTitel, FixedText, 0,
+ aPnt, aFTSiz, UniString( SvtResId( STR_FILEDLG_DIR ) ), HID_FILEDLG_DIR );
+ aPnt.Y() += aFTSiz.Height() + a3Siz.Height();
+
+ INITCONTROL( pEdit, Edit, WB_BORDER, aPnt, aEDSiz, aPath.GetFull(), HID_FILEDLG_EDIT );
+
+ aPnt.Y() += aEDSiz.Height() + a3Siz.Height();
+#ifndef UNX
+ INITCONTROL( pDirList, KbdListBox, WB_AUTOHSCROLL | WB_BORDER,
+ aPnt, Size( aEDSiz.Width(), nLbH1 ), aEmptyStr, HID_FILEDLG_DIRS );
+ aPnt.Y() += nLbH1 + a6Siz.Height();
+ INITCONTROL( pDriveTitle, FixedText, 0,
+ aPnt, aFTSiz, UniString( SvtResId( STR_FILEDLG_DRIVES ) ), HID_FILEDLG_DRIVE );
+ aPnt.Y() += aFTSiz.Height() + a3Siz.Height();
+ INITCONTROL( pDriveList, ListBox, WB_DROPDOWN,
+ aPnt, Size( aEDSiz.Width(), nLbH2 ), aEmptyStr, HID_FILEDLG_DRIVES );
+ nH = aPnt.Y() + aEDSiz.Height() + a6Siz.Height();
+#else
+ long nNewH = nLbH1 + 3 * a3Siz.Height() +
+ aFTSiz.Height() + aEDSiz.Height();
+ INITCONTROL( pDirList, KbdListBox, WB_AUTOHSCROLL | WB_BORDER,
+ aPnt, Size( aEDSiz.Width(), nNewH ), aEmptyStr, HID_FILEDLG_DIRS );
+ nH = aPnt.Y() + nNewH + a6Siz.Height();
+ pDriveTitle = NULL;
+ pDriveList = NULL;
+#endif
+
+ aPnt.X() = 2 * a6Siz.Width() + aEDSiz.Width();
+ aPnt.Y() = a6Siz.Height();
+ INITCONTROL( pOkBtn, PushButton, WB_DEFBUTTON,
+ aPnt, aBtnSiz, Button::GetStandardText( BUTTON_OK ), 0 );
+ aPnt.Y() += aBtnSiz.Height() + a3Siz.Height();
+ INITCONTROL( pCancelBtn, CancelButton, 0,
+ aPnt, aBtnSiz, Button::GetStandardText( BUTTON_CANCEL ), 0 );
+ aPnt.Y() += aBtnSiz.Height() + a3Siz.Height();
+ INITCONTROL( pNewDirBtn, PushButton, WB_DEFBUTTON,
+ aPnt, aBtnSiz, UniString( SvtResId( STR_FILEDLG_NEWDIR ) ), HID_FILEDLG_NEWDIR );
+#ifdef UNX
+ aPnt.Y() += aBtnSiz.Height() + a3Siz.Height();
+ INITCONTROL( pHomeBtn, PushButton, WB_DEFBUTTON,
+ aPnt, aBtnSiz, UniString( SvtResId( STR_FILEDLG_HOME ) ), HID_FILEDLG_HOME );
+#else
+ pHomeBtn = NULL;
+#endif
+
+ pDirPath = 0;
+ pLoadBtn = 0;
+ // Dialogbreite == OKBtn-Position + OKBtn-Breite + Rand
+ long nW = aPnt.X() + aBtnSiz.Width() + a6Siz.Width();
+
+ pDlg->SetOutputSizePixel( Size( nW, nH ) ); // Groesse ggf. auch Resource wird geplaettet?
+
+ if (pDirList)
+ pDirList->SetDoubleClickHdl(LINK( this, ImpPathDialog, DblClickHdl) );
+
+ if (pDirList)
+ pDirList->SetSelectHdl( LINK( this, ImpPathDialog, SelectHdl ) );
+
+ if (pDriveList)
+ pDriveList->SetSelectHdl( LINK( this, ImpPathDialog, SelectHdl ) );
+
+ if (pOkBtn)
+ pOkBtn->SetClickHdl( LINK( this, ImpPathDialog, ClickHdl) );
+
+ if (pCancelBtn)
+ pCancelBtn->SetClickHdl( LINK( this, ImpPathDialog, ClickHdl) );
+
+ if (pHomeBtn)
+ pHomeBtn->SetClickHdl( LINK( this, ImpPathDialog, ClickHdl) );
+
+ if (pNewDirBtn)
+ pNewDirBtn->SetClickHdl( LINK( this, ImpPathDialog, ClickHdl) );
+
+ nOwnChilds = pDlg->GetChildCount();
+}
+
+
+
+IMPL_LINK( ImpPathDialog, SelectHdl, ListBox *, p )
+{
+ if( p == pDriveList )
+ {
+ UniString aDrive( pDriveList->GetSelectEntry(), 0, 2);
+ aDrive += '\\';
+ SetPath( aDrive );
+ }
+ else
+ if( p == pDirList )
+ {
+ // isolate the pure name of the entry
+ // removing trainling stuff and leading spaces
+ UniString aEntry( pDirList->GetSelectEntry() );
+
+ aEntry.EraseLeadingChars( ' ' );
+ USHORT nPos = aEntry.Search( '/' );
+ aEntry.Erase( nPos );
+
+ // build the absolute path to the selected item
+ DirEntry aNewPath;
+ aNewPath.ToAbs();
+
+ USHORT nCurPos = pDirList->GetSelectEntryPos();
+
+ // Wird nach oben gewechselt
+ if( nCurPos < nDirCount )
+ aNewPath = aNewPath[nDirCount-nCurPos-1];
+ else
+ aNewPath += aEntry;
+
+ pEdit->SetText( aNewPath.GetFull() );
+ }
+
+ return 0;
+}
+
+
+IMPL_LINK( ImpPathDialog, ClickHdl, Button*, pBtn )
+{
+ if ( pBtn == pOkBtn || pBtn == pLoadBtn )
+ {
+ DirEntry aFile( pEdit->GetText() );
+
+ // Existiert File / File ueberschreiben
+ if( IsFileOk( aFile ) )
+ {
+ // Ja, dann kompletten Pfad mit Filenamen merken und Dialog beenden
+ aPath = aFile;
+ aPath.ToAbs();
+ GetPathDialog()->EndDialog( TRUE );
+ }
+ else
+ {
+ DirEntry aCheck( aPath );
+ aCheck += aFile;
+ if( aCheck.Exists() )
+ {
+ aCheck.ToAbs();
+ SetPath( aCheck.GetFull() );
+ pEdit->SetSelection( Selection( 0x7FFFFFFF, 0x7FFFFFFF ) );
+ }
+ }
+ }
+ else
+ if ( pBtn == pCancelBtn )
+ {
+ GetPathDialog()->EndDialog( FALSE );
+ }
+ else
+ if ( pBtn == pHomeBtn )
+ {
+ NAMESPACE_RTL( OUString )aHomeDir;
+ NAMESPACE_VOS( OSecurity ) aSecurity;
+ if ( aSecurity.getHomeDir( aHomeDir ) )
+ {
+ DirEntry aFile ( aHomeDir );
+ if ( IsFileOk( aFile ) )
+ {
+ aFile.ToAbs();
+ SetPath( aFile.GetFull() );
+ }
+ }
+ }
+ else
+ if ( pBtn == pNewDirBtn )
+ {
+ DirEntry aFile( pEdit->GetText() );
+ if( ! aFile.Exists() && ! FileStat( aFile ).IsKind( FSYS_KIND_WILD ) )
+ aFile.MakeDir();
+
+ if( IsFileOk ( aFile ) )
+ {
+ aFile.ToAbs();
+ SetPath( aFile.GetFull() );
+ }
+ }
+
+ return 0;
+}
+
+
+IMPL_LINK( ImpPathDialog, DblClickHdl, ListBox*, pBox )
+{
+ // isolate the pure name of the entry
+ // removing trainling stuff and leading spaces
+ UniString aEntry( pBox->GetSelectEntry() );
+
+ aEntry.EraseLeadingChars( ' ' );
+ USHORT nPos = aEntry.Search( '/' );
+ aEntry.Erase( nPos );
+
+ // build the absolute path to the selected item
+ DirEntry aNewPath;
+ aNewPath.ToAbs();
+ if( pBox == pDirList )
+ {
+ USHORT nCurPos = pDirList->GetSelectEntryPos();
+
+ // Wenn es schon das aktuelle ist, dann mache nichts
+ if( nCurPos == nDirCount-1 )
+ return 0;
+
+ // Wird nach oben gewechselt
+ if( nCurPos < nDirCount )
+ aNewPath = aNewPath[nDirCount-nCurPos-1];
+ else
+ aNewPath += aEntry;
+ }
+ else
+ aNewPath += aEntry;
+
+ USHORT nCurPos = pBox->GetSelectEntryPos();
+
+ pSvPathDialog->EnterWait();
+
+ if( FileStat( aNewPath ).GetKind() & FSYS_KIND_DIR )
+ {
+ // Neuen Pfad setzen und Listboxen updaten
+ aPath = aNewPath;
+ if( !aPath.SetCWD( TRUE ) )
+ {
+ ErrorBox aBox( GetPathDialog(),
+ WB_OK_CANCEL | WB_DEF_OK,
+ UniString( SvtResId( STR_FILEDLG_CANTCHDIR ) ) );
+ if( aBox.Execute() == RET_CANCEL )
+ GetPathDialog()->EndDialog( FALSE );
+ }
+ UpdateEntries( TRUE );
+ }
+
+ pSvPathDialog->LeaveWait();
+ return 0;
+}
+
+void ImpPathDialog::UpdateEntries( const BOOL dummy_bWithDirs )
+{
+ UniString aTabString;
+ DirEntry aTmpPath;
+ aTmpPath.ToAbs();
+
+ nDirCount = aTmpPath.Level();
+
+ pDirList->SetUpdateMode( FALSE );
+ pDirList->Clear();
+
+ for( USHORT i = nDirCount; i > 0; i-- )
+ {
+ UniString aName( aTabString );
+ aName += aTmpPath[i-1].GetName();
+ pDirList->InsertEntry( aName );
+ aTabString.AppendAscii( " ", 2 );
+ }
+
+ // scan the directory
+ DirEntry aCurrent;
+ aCurrent.ToAbs();
+
+ Dir aDir( aCurrent, FSYS_KIND_DIR|FSYS_KIND_FILE );
+
+ USHORT nEntries = aDir.Count();
+ if( nEntries )
+ {
+ UniStringList aSortDirList;
+ for ( USHORT n = 0; n < nEntries; n++ )
+ {
+ DirEntry& rEntry = aDir[n];
+ UniString aName( rEntry.GetName() );
+ if( aName.Len() && ( aName.GetChar(0) != '.' ) && rEntry.Exists() )
+ {
+ if( FileStat( rEntry ).GetKind() & FSYS_KIND_DIR )
+ {
+ ULONG l;
+ for( l = 0; l < aSortDirList.Count(); l++ )
+ if( *aSortDirList.GetObject(l) > aName )
+ break;
+ aSortDirList.Insert( new UniString( aName ), l );
+ }
+ }
+ }
+
+ for( ULONG l = 0; l < aSortDirList.Count(); l++ )
+ {
+ UniString aEntryStr( aTabString );
+ aEntryStr += *aSortDirList.GetObject(l);
+ pDirList->InsertEntry( aEntryStr );
+ delete aSortDirList.GetObject(l);
+ }
+ }
+
+ UpdateDirs( aTmpPath );
+}
+
+void ImpPathDialog::UpdateDirs( const DirEntry& rTmpPath )
+{
+ pDirList->SelectEntryPos( nDirCount-1 );
+ pDirList->SetTopEntry( nDirCount > 1
+ ? nDirCount - 2
+ : nDirCount - 1 );
+ pDirList->SetUpdateMode( TRUE );
+ pDirList->Invalidate();
+ pDirList->Update();
+
+ UniString aDirName = rTmpPath.GetFull();
+ if( pDirPath )
+ pDirPath->SetText( aDirName );
+ else
+ pEdit->SetText( aDirName );
+}
+
+BOOL ImpPathDialog::IsFileOk( const DirEntry& rDirEntry )
+{
+ if( FileStat( rDirEntry ).GetKind() & (FSYS_KIND_WILD | FSYS_KIND_DEV) )
+ return FALSE;
+ else
+ {
+ // Datei vorhanden ?
+ if( ! rDirEntry.Exists() )
+ {
+ UniString aQueryTxt( SvtResId( STR_FILEDLG_ASKNEWDIR ) );
+ aQueryTxt.SearchAndReplaceAscii( "%s", rDirEntry.GetFull() );
+ QueryBox aQuery( GetPathDialog(),
+ WB_YES_NO | WB_DEF_YES,
+ aQueryTxt );
+ if( aQuery.Execute() == RET_YES )
+ rDirEntry.MakeDir();
+ else
+ return FALSE;
+ }
+ if( !FileStat( rDirEntry ).IsKind( FSYS_KIND_DIR ) )
+ {
+ UniString aBoxText( SvtResId( STR_FILEDLG_CANTOPENDIR ) );
+ aBoxText.AppendAscii( "\n[" );
+ aBoxText += rDirEntry.GetFull();
+ aBoxText.AppendAscii( "]" );
+ InfoBox aBox( GetPathDialog(), aBoxText );
+ aBox.Execute();
+ return FALSE;
+ }
+ }
+ return GetPathDialog()->OK() != 0;
+}
+
+
+void ImpPathDialog::PreExecute()
+{
+ // Neues Verzeichnis setzen und Listboxen updaten
+ aPath.SetCWD( TRUE );
+ UpdateEntries( TRUE );
+
+ // Zusaetzliche Buttons anordnen
+ Point aPos;
+ Size aSize;
+ long nDY;
+ if( pLoadBtn )
+ {
+ aPos = pLoadBtn->GetPosPixel();
+ aSize = pLoadBtn->GetSizePixel();
+ nDY = pLoadBtn->GetSizePixel().Height() * 2;
+ }
+ else
+ {
+ aPos = pCancelBtn->GetPosPixel();
+ aSize = pCancelBtn->GetSizePixel();
+ nDY = pCancelBtn->GetPosPixel().Y() - pOkBtn->GetPosPixel().Y();
+ }
+
+ // Standard-Controls anpassen
+ long nMaxWidth = 0;
+
+ // Maximale Breite ermitteln
+ USHORT nChilds = GetPathDialog()->GetChildCount();
+ USHORT n;
+ for ( n = nOwnChilds; n < nChilds; n++ )
+ {
+ Window* pChild = GetPathDialog()->GetChild( n );
+ pChild = pChild->GetWindow( WINDOW_CLIENT );
+ if( pChild->GetType() != WINDOW_WINDOW )
+ {
+ long nWidth = pChild->GetTextWidth( pChild->GetText() ) + 12;
+ if( nMaxWidth < nWidth )
+ nMaxWidth = nWidth;
+ nWidth = pChild->GetSizePixel().Width();
+ if( nMaxWidth < nWidth )
+ nMaxWidth = nWidth;
+ }
+ }
+
+ if( nMaxWidth > aSize.Width() )
+ {
+ Size aDlgSize = GetPathDialog()->GetOutputSizePixel();
+ GetPathDialog()->SetOutputSizePixel( Size( aDlgSize.Width()+nMaxWidth-aSize.Width(), aDlgSize.Height() ) );
+ aSize.Width() = nMaxWidth;
+
+ if( pOkBtn )
+ pOkBtn->SetSizePixel( aSize );
+ if( pCancelBtn )
+ pCancelBtn->SetSizePixel( aSize );
+ if( pLoadBtn )
+ pLoadBtn->SetSizePixel( aSize );
+ }
+ else
+ nMaxWidth = aSize.Width();
+
+ for ( n = nOwnChilds; n < nChilds; n++ )
+ {
+ Window* pChild = GetPathDialog()->GetChild( n );
+ pChild = pChild->GetWindow( WINDOW_CLIENT );
+ if( pChild->GetType() != WINDOW_WINDOW )
+ {
+ aPos.Y() += nDY;
+ pChild->SetPosSizePixel( aPos, aSize );
+ }
+ else
+ {
+ Size aDlgSize = GetPathDialog()->GetOutputSizePixel();
+ long nExtra = Min( aDlgSize.Height(), (long)160);
+ GetPathDialog()->SetOutputSizePixel( Size( aDlgSize.Width()+nExtra, aDlgSize.Height() ) );
+ Size aSz( nExtra, nExtra );
+ aSz.Width() -= 8;
+ aSz.Height() -= 8;
+ Point aCtrlPos( aDlgSize.Width() + 2, (aDlgSize.Height()-aSz.Height())/2 );
+ pChild->SetPosSizePixel( aCtrlPos, aSz );
+ }
+ }
+
+ // Laufwerke-LB fuellen
+ if( pDriveList )
+ {
+ DirEntry aTmpDirEntry;
+ Dir aDir( aTmpDirEntry, FSYS_KIND_BLOCK );
+
+ USHORT nCount = aDir.Count(), i;
+ for( i = 0; i < nCount; ++i )
+ {
+ DirEntry& rEntry = aDir[i];
+ UniString aStr = rEntry.GetFull( FSYS_STYLE_HOST, FALSE );
+
+ UniString aVolume = rEntry.GetVolume() ;
+ aStr.ToUpperAscii();
+ if ( aVolume.Len() )
+ {
+ aStr += ' ';
+ aStr += aVolume;
+ }
+ pDriveList->InsertEntry( aStr );
+
+ }
+ UniString aPathStr = aPath.GetFull();
+
+ for ( i = 0; i < pDriveList->GetEntryCount(); ++i )
+ {
+ UniString aEntry = pDriveList->GetEntry(i);
+ int nLen = aEntry.Len();
+ nLen = nLen > 2 ? 2 : nLen;
+ if ( aEntry.CompareIgnoreCaseToAscii( aPathStr, nLen ) == COMPARE_EQUAL )
+ {
+ pDriveList->SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+}
+
+void ImpPathDialog::PostExecute()
+{
+}
+
+void ImpPathDialog::SetPath( UniString const & rPath )
+{
+ aPath = DirEntry( rPath );
+
+ pSvPathDialog->EnterWait();
+
+ DirEntry aFile( rPath );
+ // Falls der Pfad eine Wildcard oder einen Filenamen enthaelt
+ // -> abschneiden und merken
+ if( FileStat( aFile ).GetKind() & (FSYS_KIND_FILE | FSYS_KIND_WILD) || !aFile.Exists() )
+ aFile.CutName();
+
+ // Neue Maske und neues Verzeichnis setzen, und Listboxen updaten
+ pEdit->SetText( rPath );
+ aFile.SetCWD( TRUE );
+ UpdateEntries( TRUE );
+
+ pSvPathDialog->LeaveWait();
+}
+
+void ImpPathDialog::SetPath( Edit const & rEdit )
+{
+ UniString aPresetText = rEdit.GetText();
+ if( aPresetText.Len() )
+ SetPath( aPresetText );
+}
+
+
+UniString ImpPathDialog::GetPath() const
+{
+ DirEntry aFile( pEdit->GetText() );
+ aFile.ToAbs();
+ return aFile.GetFull();
+}
+
+
+ImpFileDialog::ImpFileDialog( PathDialog* pDlg, WinBits nWinBits, RESOURCE_TYPE nType ) :
+ ImpPathDialog( pDlg, nWinBits, nType, FALSE )
+{
+ bOpen = (nWinBits & WB_SAVEAS) == 0;
+
+ SvtResId aSvtResId = bOpen ? STR_FILEDLG_OPEN : STR_FILEDLG_SAVE;
+
+ // Titel setzen
+ GetFileDialog()->SetText( UniString( aSvtResId ) );
+ nDirCount = 0;
+
+ // initialize Controls if not used as a base class
+ if ( nType == WINDOW_FILEDIALOG )
+ InitControls();
+
+ pDlg->SetHelpId( HID_FILEDLG_OPENDLG );
+
+}
+
+ImpFileDialog::~ImpFileDialog()
+{
+ ImpFilterItem* pItem = aFilterList.First();
+ while( pItem )
+ {
+ delete pItem;
+ pItem = aFilterList.Next();
+ }
+
+ delete pFileTitel;
+ if (pFileList && ( pFileList != pDirList ) )
+ delete pFileList;
+
+ delete pTypeTitel;
+ delete pTypeList;
+}
+
+void ImpFileDialog::InitControls()
+{
+ UniString aEmptyStr;
+
+ const nW = 160;
+ const nH = 48; // Um den Dialog in eine akzeptable Form zu bringen
+
+ INITCONTROL( pFileTitel, FixedText, 0,
+ Point(10, 12), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_FILE ) ), HID_FILEDLG_FILE );
+ INITCONTROL( pEdit, Edit, WB_BORDER,
+ Point(10, 31), Size(nW, 20), aEmptyStr, HID_FILEDLG_EDIT ); // aMask()
+ INITCONTROL( pFileList, ListBox, WB_SORT | WB_AUTOHSCROLL | WB_BORDER,
+ Point(10, 58), Size(nW, 180-nH), aEmptyStr, HID_FILEDLG_FILES );
+
+ INITCONTROL( pDirTitel, FixedText, 0,
+ Point(nW+20, 12), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_DIR ) ), HID_FILEDLG_DIR );
+ INITCONTROL( pDirPath, FixedInfo, WB_PATHELLIPSIS,
+ Point(nW+20, 33), Size(nW, 20), aPath.GetFull(), HID_FILEDLG_PATH );
+ INITCONTROL( pDirList, KbdListBox, WB_AUTOHSCROLL | WB_BORDER,
+ Point(nW+20, 58), Size(nW, 180-nH ), aEmptyStr, HID_FILEDLG_DIRS );
+
+ INITCONTROL( pTypeTitel, FixedText, 0,
+ Point(10, 246-nH), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_TYPE ) ), HID_FILEDLG_TYPE );
+
+#ifndef UNX
+ INITCONTROL( pTypeList, ListBox, WB_DROPDOWN,
+ Point(10, 265-nH ), Size(nW, 100 ), aEmptyStr, HID_FILEDLG_TYPES );
+
+ INITCONTROL( pDriveTitle, FixedText, 0,
+ Point(nW+20, 246-nH), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_DRIVES ) ), HID_FILEDLG_DRIVE );
+ INITCONTROL( pDriveList, ListBox, WB_DROPDOWN,
+ Point(nW+20, 265-nH ), Size(nW, 100 ), aEmptyStr, HID_FILEDLG_DRIVES );
+ pNewDirBtn = NULL;
+ pHomeBtn = NULL;
+#else
+ INITCONTROL( pTypeList, ListBox, WB_DROPDOWN,
+ Point(10, 265-nH ), Size(2*nW+20, 100 ), aEmptyStr, HID_FILEDLG_TYPES );
+
+ pDriveTitle = NULL;
+ pDriveList = NULL;
+ pNewDirBtn = NULL;
+ pHomeBtn = NULL;
+#endif
+
+ const long nButtonStartX = 2*nW+20+15;
+ INITCONTROL( pOkBtn, PushButton, WB_DEFBUTTON,
+ Point(nButtonStartX, 10), Size(STD_BTN_WIDTH, STD_BTN_HEIGHT),
+ Button::GetStandardText( BUTTON_OK ), 0 );
+ INITCONTROL( pCancelBtn, CancelButton, 0,
+ Point(nButtonStartX, 45 ), Size(STD_BTN_WIDTH, STD_BTN_HEIGHT),
+ Button::GetStandardText( BUTTON_CANCEL ), 0 );
+
+ pLoadBtn = 0;
+
+ GetFileDialog()->SetOutputSizePixel( Size(nButtonStartX+STD_BTN_WIDTH+10, 298-nH) );
+
+ nOwnChilds = GetPathDialog()->GetChildCount();
+
+ // Handler setzen
+ if (pDriveList)
+ pDriveList->SetSelectHdl( LINK( this, ImpFileDialog, SelectHdl ) );
+
+ if (pDirList)
+ pDirList->SetDoubleClickHdl(LINK( this, ImpFileDialog, DblClickHdl) );
+
+ if (pOkBtn)
+ pOkBtn->SetClickHdl( LINK( this, ImpFileDialog, ClickHdl) );
+
+ if (pCancelBtn)
+ pCancelBtn->SetClickHdl( LINK( this, ImpFileDialog, ClickHdl) );
+
+ if( pFileList )
+ {
+ pFileList->SetSelectHdl( LINK( this, ImpFileDialog, SelectHdl ) );
+ pFileList->SetDoubleClickHdl( LINK( this, ImpFileDialog, DblClickHdl ) );
+ }
+
+ if( pTypeList )
+ pTypeList->SetSelectHdl( LINK( this, ImpFileDialog, DblClickHdl ) );
+}
+
+IMPL_LINK( ImpFileDialog, SelectHdl, ListBox *, p )
+{
+ if( p == pDriveList )
+ {
+ UniString aDrive ( pDriveList->GetSelectEntry(), 0, 2);
+ aDrive += '\\';
+ SetPath( aDrive );
+ }
+ else if (p == pFileList)
+ {
+ // Ausgewaehltes File in das Edit stellen
+ pEdit->SetText( pFileList->GetSelectEntry() );
+ GetFileDialog()->FileSelect();
+ }
+ return 0;
+}
+
+
+IMPL_LINK( ImpFileDialog, DblClickHdl, ListBox *, pBox )
+{
+ // isolate the pure name of the entry
+ // removing trailing stuff and leading spaces
+ UniString aEntry( pBox->GetSelectEntry() );
+
+ aEntry.EraseLeadingChars( ' ' );
+ USHORT nPos = aEntry.Search( '/' );
+ aEntry.Erase( nPos );
+
+ // build the absolute path to the selected item
+ DirEntry aNewPath;
+ aNewPath.ToAbs();
+
+ if( ( pDirList != pFileList ) && ( pBox == pDirList ) )
+ {
+ // SVLOOK
+ USHORT nCurPos = pDirList->GetSelectEntryPos();
+
+ // Wenn es schon das aktuelle ist, dann mache nichts
+ if( nCurPos == nDirCount-1 )
+ return 0;
+
+ // Wird nach oben gewechselt
+ if( nCurPos < nDirCount )
+ aNewPath = aNewPath[nDirCount-nCurPos-1];
+ else
+ aNewPath += aEntry;
+ }
+ else
+ {
+ // non-SVLOOK
+ if( aEntry == UniString( SvtResId( STR_FILEDLG_GOUP ) ) )
+ aEntry.AssignAscii( ".." );
+ aNewPath += aEntry;
+ }
+
+ if( pBox == pFileList )
+ {
+ DirEntry aFile( aEntry );
+
+ // Abfrage, ob File ueberschrieben werden soll...
+ if( !FileStat(aFile).IsKind(FSYS_KIND_DIR) && IsFileOk( aFile ) )
+ {
+ // dann kompletten Pfad mit Filenamen merken und Dialog beenden
+ aPath = aNewPath;
+ GetFileDialog()->EndDialog( TRUE );
+ }
+ }
+
+ USHORT nCurPos = pBox->GetSelectEntryPos();
+
+ GetFileDialog()->EnterWait();
+
+ UniString aFull = aNewPath.GetFull();
+
+ if( ( ( pBox == pDirList ) && ( pDirList != pFileList ) ) ||
+ ( ( pDirList == pFileList ) && FileStat( aNewPath ).GetKind() & FSYS_KIND_DIR ) )
+ {
+ // Neuen Pfad setzen und Listboxen updaten
+ aPath = aNewPath;
+ if( !aPath.SetCWD( TRUE ) )
+ {
+ if( ErrorBox( GetFileDialog(), WB_OK_CANCEL|WB_DEF_OK,
+ UniString( SvtResId( STR_FILEDLG_CANTCHDIR ) ) ).Execute() == RET_CANCEL )
+ {
+ GetFileDialog()->EndDialog( FALSE );
+ }
+ }
+ UpdateEntries( TRUE );
+ GetFileDialog()->FileSelect();
+ }
+
+ if( pBox == pTypeList )
+ {
+ // Neue Maske setzen, und Listboxen updaten
+ USHORT nCurPos = pTypeList->GetSelectEntryPos();
+ if( nCurPos+1 > (USHORT)aFilterList.Count() )
+ aMask = UniString::CreateFromAscii( ALLFILES );
+ else
+ {
+ UniString aFilterListMask = aFilterList.GetObject( nCurPos )->aMask;
+// if( aFilterListMask.Search( ';' ) == STRING_NOTFOUND ) // kein ; in der Maske
+// aMask = WildCard( aFilterListMask, '\0' );
+// else // ; muss beruecksichtigt werden
+ aMask = WildCard( aFilterListMask, ';' );
+ }
+
+ pEdit->SetText( aMask() );
+ UpdateEntries( FALSE );
+ GetFileDialog()->FilterSelect();
+ }
+
+ GetFileDialog()->LeaveWait();
+
+ return 0;
+}
+
+IMPL_LINK( ImpFileDialog, ClickHdl, Button*, pBtn )
+{
+ if( ( pBtn == pOkBtn ) || ( pBtn == pLoadBtn ) )
+ {
+ DirEntry aFile( pEdit->GetText() );
+
+ // Existiert File / File ueberschreiben
+ if( IsFileOk( aFile ) )
+ {
+ // Ja, dann kompletten Pfad mit Filenamen merken und Dialog beenden
+ aPath = aFile;
+ aPath.ToAbs();
+ GetFileDialog()->EndDialog( TRUE );
+ }
+ else
+ {
+ GetFileDialog()->EnterWait();
+
+ // Falls der Pfad eine Wildcard oder einen Filenamen enthaelt
+ // -> abschneiden und merken
+ if( FileStat( aFile ).GetKind() & (FSYS_KIND_FILE | FSYS_KIND_WILD) || !aFile.Exists() )
+ {
+ aMask = aFile.CutName();
+ }
+
+ // Neue Maske und neues Verzeichnis setzen, und Listboxen updaten
+ pEdit->SetText( aMask() );
+ aFile.SetCWD( TRUE );
+ UpdateEntries( TRUE );
+
+ GetFileDialog()->LeaveWait();
+ }
+ }
+ else if( pBtn == pCancelBtn )
+ GetFileDialog()->EndDialog( FALSE );
+
+ return 0;
+}
+
+void ImpFileDialog::UpdateEntries( const BOOL bWithDirs )
+{
+ GetFileDialog()->EnterWait();
+
+ UniString aTabString;
+ DirEntry aTmpPath;
+ aTmpPath.ToAbs();
+ nDirCount = aTmpPath.Level();
+
+ if( pFileList )
+ {
+ pFileList->SetUpdateMode( FALSE );
+ pFileList->Clear();
+ }
+
+ if( bWithDirs && (pDirList != pFileList) )
+ {
+ pDirList->SetUpdateMode( FALSE );
+ pDirList->Clear();
+
+ for( USHORT i = nDirCount; i > 0; i-- )
+ {
+ UniString aEntryStr( aTabString );
+ aEntryStr += aTmpPath[i-1].GetName();
+ pDirList->InsertEntry( aEntryStr );
+ aTabString.AppendAscii( " ", 2 );
+ }
+ }
+
+ // for the combined box insert a '..'
+ // (this happens only if WB_SVLOOK is not set)
+
+ if( pDirList == pFileList && nDirCount != 1 )
+ pFileList->InsertEntry( UniString( SvtResId( STR_FILEDLG_GOUP ) ) );
+
+ // scan the directory
+ DirEntry aCurrent;
+ aCurrent.ToAbs();
+ Dir aDir( aCurrent, FSYS_KIND_DIR|FSYS_KIND_FILE );
+ USHORT nEntries = aDir.Count();
+
+ // TempMask, weil Vergleich case-sensitiv
+ BOOL bMatchCase = FALSE; //aCurrent.IsCaseSensitive();
+ UniString aWildCard( aMask.GetWildCard() );
+ if ( !bMatchCase )
+ aWildCard.ToLowerAscii();
+ WildCard aTmpMask( aWildCard, ';' );
+ if ( nEntries )
+ {
+ UniStringList aSortDirList;
+ for ( USHORT n = 0; n < nEntries; n++ )
+ {
+ DirEntry& rEntry = aDir[n];
+ UniString aName( rEntry.GetName() );
+
+ if( aName.Len() &&
+ ( ( ( aName.GetChar(0) != '.' ) ||
+ ( ( aName.GetChar(0) == '.' ) && ( aMask.GetWildCard() ).GetChar(0) == '.' ) )
+ && rEntry.Exists() ) )
+ {
+ FileStat aFileStat( rEntry );
+ UniString aTmpName( aName );
+ if ( !bMatchCase )
+ aTmpName.ToLowerAscii();
+ if( ( aFileStat.GetKind() & FSYS_KIND_FILE ) && aTmpMask.Matches( aTmpName ) )
+ {
+ ULONG n = aFileStat.GetKind();
+ if( pFileList )
+ pFileList->InsertEntry( aName );
+ }
+ else if( bWithDirs && ( aFileStat.GetKind() & FSYS_KIND_DIR ) )
+ {
+ if( pDirList == pFileList )
+ {
+ UniString aEntryStr( aName );
+ aEntryStr += '/';
+ pDirList->InsertEntry( aEntryStr );
+ }
+ else
+ {
+ ULONG l;
+ for( l = 0; l < aSortDirList.Count(); l++ )
+ if( *aSortDirList.GetObject(l) > aName )
+ break;
+ aSortDirList.Insert( new UniString( aName ), l );
+ }
+ }
+ }
+ }
+ for( ULONG l = 0; l < aSortDirList.Count(); l++ )
+ {
+ UniString aEntryStr( aTabString );
+ aEntryStr += *aSortDirList.GetObject(l);
+ pDirList->InsertEntry( aEntryStr );
+ delete aSortDirList.GetObject(l);
+ }
+ }
+
+ if( bWithDirs )
+ UpdateDirs( aTmpPath );
+
+ if( pFileList )
+ {
+ if ( pDirList == pFileList && nDirCount > 1 )
+ pFileList->SelectEntryPos( 1 );
+ else
+ pFileList->SetNoSelection();
+ pFileList->SetUpdateMode( TRUE );
+ pFileList->Invalidate();
+ pFileList->Update();
+ }
+
+ if( pDriveList )
+ {
+ if( pDirList->GetEntryCount() > 0 )
+ {
+ UniString aStr( pDirList->GetEntry( 0 ) );
+ aStr.Erase( 2 );
+ aStr.ToLowerAscii();
+ pDriveList->SelectEntry( aStr );
+ }
+ }
+
+ GetFileDialog()->LeaveWait();
+}
+
+BOOL ImpFileDialog::IsFileOk( const DirEntry& rDirEntry )
+{
+ if( FileStat( rDirEntry ).GetKind() & (FSYS_KIND_WILD | FSYS_KIND_DEV) )
+ return FALSE;
+ if( FileStat( rDirEntry ).GetKind() & FSYS_KIND_DIR )
+ {
+ if( pFileList )
+ return FALSE;
+ }
+ else if( bOpen )
+ {
+ // Datei vorhanden ?
+ if( !FileStat( rDirEntry ).IsKind( FSYS_KIND_FILE ) )
+ {
+ UniString aErrorString( SvtResId( STR_FILEDLG_CANTOPENFILE ) );
+ aErrorString.AppendAscii( "\n[" );
+ aErrorString += rDirEntry.GetFull();
+ aErrorString += ']';
+ InfoBox aBox( GetFileDialog(),
+ aErrorString );
+ aBox.Execute();
+ return FALSE;
+ }
+ }
+ else
+ {
+ // Datei vorhanden ?
+ if( FileStat( ExtendFileName( rDirEntry ) ).IsKind( FSYS_KIND_FILE ) )
+ {
+ UniString aQueryString( SvtResId( STR_FILEDLG_OVERWRITE ) );
+ aQueryString.AppendAscii( "\n[" );
+ aQueryString += rDirEntry.GetFull();
+ aQueryString += ']';
+ QueryBox aBox( GetFileDialog(),
+ WinBits( WB_YES_NO | WB_DEF_NO ),
+ aQueryString );
+ if( aBox.Execute() != RET_YES )
+ return FALSE;
+ }
+ }
+ return GetFileDialog()->OK() != 0;
+}
+
+void ImpFileDialog::SetPath( UniString const & rPath )
+{
+ aPath = DirEntry( rPath );
+ GetFileDialog()->EnterWait();
+
+ DirEntry aFile( rPath );
+
+ // Falls der Pfad eine Wildcard oder einen Filenamen enthaelt
+ // -> abschneiden und merken
+ if( FileStat( aFile ).GetKind() & (FSYS_KIND_FILE | FSYS_KIND_WILD) || !aFile.Exists() )
+ {
+ aMask = aFile.CutName();
+
+ // Neue Maske und neues Verzeichnis setzen, und Listboxen updaten
+ if( pDirList )
+ {
+ UniString aWildCard( aMask.GetWildCard() );
+ pEdit->SetText( aWildCard );
+ }
+ else
+ pEdit->SetText( rPath );
+ }
+
+ aFile.SetCWD( TRUE );
+
+ UpdateEntries( TRUE );
+
+ GetFileDialog()->LeaveWait();
+}
+
+void ImpFileDialog::SetPath( Edit const& rEdit )
+{
+ UniString aPresetText = rEdit.GetText();
+ if( aPresetText.Len() )
+ SetPath( aPresetText );
+}
+
+
+void ImpFileDialog::AddFilter( const UniString& rFilter, const UniString& rMask )
+{
+ aFilterList.Insert( new ImpFilterItem( rFilter, rMask ), LIST_APPEND );
+ if( pTypeList )
+ pTypeList->InsertEntry( rFilter, LISTBOX_APPEND );
+
+ if( !GetCurFilter().Len() )
+ SetCurFilter( rFilter );
+}
+
+void ImpFileDialog::RemoveFilter( const UniString& rFilter )
+{
+ ImpFilterItem* pItem = aFilterList.First();
+ while( pItem && pItem->aName != rFilter )
+ pItem = aFilterList.Next();
+
+ if( pItem )
+ {
+ delete aFilterList.Remove();
+ if( pTypeList )
+ pTypeList->RemoveEntry( rFilter );
+ }
+}
+
+void ImpFileDialog::RemoveAllFilter()
+{
+ ImpFilterItem* pItem = aFilterList.First();
+ while( pItem )
+ {
+ delete pItem;
+ pItem = aFilterList.Next();
+ }
+ aFilterList.Clear();
+
+ if( pTypeList )
+ pTypeList->Clear();
+}
+
+void ImpFileDialog::SetCurFilter( const UniString& rFilter )
+{
+ if( !pTypeList )
+ return;
+
+ ImpFilterItem* pItem = aFilterList.First();
+ while( pItem && pItem->aName != rFilter )
+ pItem = aFilterList.Next();
+
+ if( pItem )
+ pTypeList->SelectEntryPos( (USHORT)aFilterList.GetCurPos() );
+ else
+ pTypeList->SetNoSelection();
+}
+
+UniString ImpFileDialog::GetCurFilter() const
+{
+ UniString aFilter;
+ if ( pTypeList )
+ aFilter = pTypeList->GetSelectEntry();
+ return aFilter;
+}
+
+void ImpFileDialog::PreExecute()
+{
+ // ListBoxen erst unmittelbar vor Execute fuellen
+ // (damit vor Execute der Pfad umgesetzt werden kann, ohne das immer die
+ // Listboxen sofort upgedatet werden)
+
+ GetFileDialog()->EnterWait();
+
+ // Wenn kein Filter vorhanden, dann auch keine FilterBox
+ if( pTypeList && !pTypeList->GetEntryCount() )
+ {
+ // pTypeList->InsertEntry( "* (all files)" );
+ pTypeTitel->Disable();
+ pTypeList->Disable();
+ }
+
+ if( pTypeList )
+ {
+ USHORT nCurType = pTypeList->GetSelectEntryPos();
+ if( nCurType < aFilterList.Count() )
+ {
+ UniString aFilterListMask = aFilterList.GetObject( nCurType )->aMask;
+ if( aFilterListMask.Search( ';' ) == STRING_NOTFOUND ) // kein ; in der Maske
+ aMask = WildCard( aFilterListMask, '\0' );
+ else // ; in der Maske, muss in der Wildcard beruecksichtigt werden
+ aMask = WildCard( aFilterListMask, ';' );
+ }
+ else
+ aMask = UniString::CreateFromAscii( ALLFILES );
+ }
+ else
+ aMask = UniString::CreateFromAscii( ALLFILES );
+
+ // Neue Maske setzen
+ if( pEdit->GetText().Len() == 0 )
+ pEdit->SetText( aMask() );
+
+ ImpPathDialog::PreExecute();
+
+ GetFileDialog()->LeaveWait();
+}
+
+UniString ImpFileDialog::GetPath() const
+{
+ DirEntry aFile( pEdit->GetText() );
+ return ExtendFileName( aFile );
+}
+
+UniString ImpFileDialog::ExtendFileName( DirEntry aEntry ) const
+{
+ aEntry.ToAbs();
+ // das ganze Theater hier ohnehin nur machen, wenn Dateiname
+ // ohne Extension angegeben wurde
+ if( !aEntry.GetExtension().Len() )
+ {
+ UniString aPostfix; // hier kommt die ausgesuchte Extension herein
+
+ // ist ein Filter mit Extension gesetzt?
+ USHORT nChosenFilterPos = pTypeList->GetSelectEntryPos();
+ if( nChosenFilterPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ UniString aExtensionMask = GetFileDialog()->GetFilterType( nChosenFilterPos );
+ // aExtension ist z.B. *.sdw, alles bis einschliesslich Punkt abschneiden
+ UniString aExtension = aExtensionMask.Copy( aExtensionMask.Search( '.' )+1 );
+
+ // hat der Filter ueberhaupt eine Extension
+ if( aExtension.Len() )
+ {
+ // keine Wildcards enthalten?
+ if( ( aExtension.Search( '*' ) == STRING_NOTFOUND ) &&
+ ( aExtension.Search( '?' ) == STRING_NOTFOUND ) )
+ {
+ // OK, Filter hat Extension ohne Wildcards -> verwenden
+ aPostfix = aExtension;
+ }
+ else
+ {
+ // Filter hat Extension mit Wildcards (z.B. *.*) -> nicht verwenden
+ aPostfix.Erase();
+ }
+ }
+ else
+ {
+ // Filter hatte keine Extension (schwer vorstellbar) -> nichts anhaengen
+ aPostfix.Erase();
+ }
+ }
+ else
+ {
+ // kein Filter gefunden (merkwÆrdig) -> Default-Extension anhaengen
+ aPostfix = GetFileDialog()->GetDefaultExt();
+ }
+
+ // jetzt kann es mit dem Anhaengen losgehen
+ const sal_Unicode* pExt = aPostfix.GetBuffer();
+ while( *pExt == '*' || *pExt == '?' )
+ pExt++;
+
+ if( *pExt )
+ {
+ UniString aName = aEntry.GetName();
+ if( *pExt != '.' )
+ aName += '.';
+ aName += pExt;
+ aEntry.SetName( aName );
+ }
+ }
+ return aEntry.GetFull();
+}
+
+
+void ImpSvFileDlg::CreateDialog( PathDialog* pSvDlg, WinBits nStyle, RESOURCE_TYPE nType, BOOL bCreate )
+{
+ delete pDlg;
+ if ( nType == WINDOW_PATHDIALOG )
+ pDlg = new ImpPathDialog( pSvDlg, nStyle, nType, bCreate );
+ else
+ pDlg = new ImpFileDialog( pSvDlg, nStyle, nType );
+}
+
+
diff --git a/svtools/source/dialogs/filedlg2.hrc b/svtools/source/dialogs/filedlg2.hrc
new file mode 100644
index 000000000000..bcb474f0e9db
--- /dev/null
+++ b/svtools/source/dialogs/filedlg2.hrc
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: filedlg2.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#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/filedlg2.hxx b/svtools/source/dialogs/filedlg2.hxx
new file mode 100644
index 000000000000..f9f41eb8413d
--- /dev/null
+++ b/svtools/source/dialogs/filedlg2.hxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * $RCSfile: filedlg2.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FILEDLG2_HXX
+#define _FILEDLG2_HXX
+
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _FSYS_HXX //autogen
+#include <tools/fsys.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX //autogen wg. PushButton
+#include <vcl/button.hxx>
+#endif
+class FixedText;
+class Edit;
+class ListBox;
+class ListBox;
+class Button;
+
+class PathDialog;
+class FileDialog;
+class ImpPathDialog;
+
+struct ImpFilterItem
+{
+ String aName;
+ String aMask;
+
+ ImpFilterItem( const String & rFilter, const String & rMask )
+ {
+ aName = rFilter;
+ aMask = rMask;
+ }
+};
+
+DECLARE_LIST( ImpFilterList, ImpFilterItem* )
+
+#ifndef _SV_LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif // _SV_LSTBOX_HXX
+
+class KbdListBox : public ListBox
+{
+public:
+
+ KbdListBox( Window* pParent, WinBits nStyle = WB_BORDER )
+ : ListBox ( pParent, nStyle )
+ {};
+
+virtual long PreNotify( NotifyEvent& rNEvt );
+
+};
+
+
+class ImpPathDialog
+{
+ friend class ImpFileDialog;
+
+private:
+ PathDialog* pSvPathDialog;
+ Edit* pEdit;
+ FixedText* pDirTitel;
+ KbdListBox* pDirList;
+ FixedText* pDirPath;
+ ListBox* pDriveList;
+ FixedText* pDriveTitle;
+ PushButton* pLoadBtn;
+ PushButton* pOkBtn;
+ PushButton* pCancelBtn;
+ PushButton* pHomeBtn;
+ PushButton* pNewDirBtn;
+
+ USHORT nOwnChilds;
+
+ DirEntry aPath; // aktuell angewaehlter Pfad
+ USHORT nDirCount; // Anzahl der Verzeichnis-
+ // Verschachtelungen
+
+protected:
+
+ virtual void UpdateEntries( const BOOL bWithDirs );
+ void UpdateDirs( const DirEntry& rTmpPath );
+
+ BOOL IsFileOk( const DirEntry& rDirEntry );
+ void InitControls();
+
+ DECL_LINK( SelectHdl, ListBox * );
+ DECL_LINK( DblClickHdl, ListBox * );
+ DECL_LINK( ClickHdl, Button * );
+
+public:
+ ImpPathDialog( PathDialog* pDlg, WinBits nWinBits, RESOURCE_TYPE nType, BOOL bCreateDir );
+ virtual ~ImpPathDialog();
+
+ virtual void SetPath( const String& rPath );
+ virtual void SetPath( const Edit& rEdit );
+ virtual String GetPath() const;
+
+ virtual void PreExecute();
+ virtual void PostExecute();
+
+ PathDialog* GetPathDialog() const { return pSvPathDialog; }
+
+ void SetOkButtonText( const String& rText ) { pOkBtn->SetText( rText ); }
+ void SetCancelButtonText( const String& rText ) { pCancelBtn->SetText( rText ); }
+
+};
+
+
+class ImpFileDialog : public ImpPathDialog
+{
+private:
+ FixedText* pFileTitel;
+ ListBox* pFileList;
+ FixedText* pTypeTitel;
+ ListBox* pTypeList;
+
+ WildCard aMask; // aktuelle Maske
+
+ ImpFilterList aFilterList; // Filterliste
+ USHORT nCurFilter; // aktueller Filter
+
+ BOOL bOpen; // TRUE = Open; FALSE = SAVEAS
+
+protected:
+ void InitControls();
+
+ String ExtendFileName( DirEntry aEntry ) const;
+
+ DECL_LINK( SelectHdl, ListBox * );
+ DECL_LINK( DblClickHdl, ListBox * );
+ DECL_LINK( ClickHdl, Button * );
+
+ virtual void UpdateEntries( const BOOL bWithDirs );
+ BOOL IsFileOk( const DirEntry& rDirEntry );
+
+public:
+ ImpFileDialog( PathDialog* pDlg, WinBits nWinBits, RESOURCE_TYPE nType );
+ virtual ~ImpFileDialog();
+
+ void AddFilter( const String& rFilter, const String& rMask );
+ void RemoveFilter( const String& rFilter );
+ void RemoveAllFilter();
+ void SetCurFilter( const String& rFilter );
+ String GetCurFilter() const;
+
+ USHORT GetFilterCount() const { return (USHORT)aFilterList.Count(); }
+ inline String GetFilterName( USHORT nPos ) const;
+ inline String GetFilterType( USHORT nPos ) const;
+
+ virtual void SetPath( const String& rPath );
+ virtual void SetPath( const Edit& rEdit );
+ virtual String GetPath() const;
+
+ virtual void PreExecute();
+
+ FileDialog* GetFileDialog() const { return (FileDialog*)GetPathDialog(); }
+};
+
+inline String ImpFileDialog::GetFilterName( USHORT nPos ) const
+{
+ String aName;
+ ImpFilterItem* pItem = aFilterList.GetObject( nPos );
+ if ( pItem )
+ aName = pItem->aName;
+ return aName;
+}
+
+inline String ImpFileDialog::GetFilterType( USHORT nPos ) const
+{
+ String aMask;
+ ImpFilterItem* pItem = aFilterList.GetObject( nPos );
+ if ( pItem )
+ aMask = pItem->aMask;
+ return aMask;
+}
+
+class ImpSvFileDlg
+{
+private:
+ ImpPathDialog* pDlg;
+
+public:
+ ImpSvFileDlg() { pDlg = 0; }
+ ~ImpSvFileDlg() { delete pDlg; }
+
+ ImpPathDialog* GetDialog() const { return pDlg; }
+ void CreateDialog( PathDialog* pCreateFrom, WinBits nStyle, RESOURCE_TYPE nType, BOOL bCreate );
+
+ void SetOkButtonText( const String& rText ) { pDlg->SetOkButtonText( rText ); } // ihr habts ja nicht anders gewollt
+ void SetCancelButtonText( const String& rText ) { pDlg->SetCancelButtonText( rText ); }
+
+};
+
+#endif // _FILEDLG2_HXX
diff --git a/svtools/source/dialogs/filedlg2.src b/svtools/source/dialogs/filedlg2.src
new file mode 100644
index 000000000000..45364d5cbb31
--- /dev/null
+++ b/svtools/source/dialogs/filedlg2.src
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * $RCSfile: filedlg2.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <filedlg2.hrc>
+String STR_FILEDLG_SELECT
+{
+ Text = "Verzeichnis auswählen" ;
+ Text [ ENGLISH ] = "Select" ;
+ Text [ portuguese ] = "Seleccionar directório" ;
+ Text [ english_us ] = "Select Directory" ;
+ Text [ portuguese_brazilian ] = "Verzeichnis auswählen" ;
+ Text [ swedish ] = "Välj mapp" ;
+ Text [ danish ] = "Vælg bibliotek" ;
+ Text [ italian ] = "Scelta cartella" ;
+ Text [ spanish ] = "Seleccionar directorio" ;
+ Text [ french ] = "Sélection du répertoire" ;
+ Text [ dutch ] = "Map selecteren" ;
+ Text[ chinese_simplified ] = "Ñ¡ÔñĿ¼";
+ Text[ russian ] = "Âûáîð êàòàëîãà";
+ Text[ polish ] = "Wybierz katalog";
+ Text[ japanese ] = "ÃÞ¨Ú¸ÄØ‚ð‘I‘ð";
+ Text[ chinese_traditional ] = "¿ï¾Ü¥Ø¿ý";
+ Text[ arabic ] = "ÊÍÏíÏ ÇáÏáíá";
+ Text[ greek ] = "ÅðéëïãÞ êáôáëüãïõ";
+ Text[ korean ] = "µð·ºÅ丮 ¼±ÅÃ";
+ Text[ turkish ] = "Dizin seç";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_CANTCHDIR
+{
+ Text = "Kann nicht in Verzeichnis wechseln" ;
+ Text [ ENGLISH ] = "Can't change directory" ;
+ Text [ english_us ] = "Cannot change to directory" ;
+ Text [ portuguese_brazilian ] = "Kann nicht in Verzeichnis wechseln" ;
+ Text [ swedish ] = "Kan inte byta mapp" ;
+ Text [ danish ] = "Kan ikke skifte til bibliotek" ;
+ Text [ italian ] = "Impossibile passare alla cartella" ;
+ Text [ spanish ] = "No es posible cambiar en directorio" ;
+ Text [ french ] = "Impossible de changer le répertoire" ;
+ Text [ dutch ] = "Kan niet in map komen" ;
+ Text [ portuguese ] = "Impossível mudar para directório" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨×ªµ½Ä¿Â¼";
+ Text[ russian ] = "Ñìåíèòü êàòàëîã íåâîçìîæíî";
+ Text[ polish ] = "Nie mo¿e zmieniæ katalogu";
+ Text[ japanese ] = "ÃÞ¨Ú¸ÄØ‚ð•ÏX‚Å‚«‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "µLªkÂà¨ì¥Ø¿ý";
+ Text[ arabic ] = "áÇ íãßä ÊÛííÑ ÇáÏáíá";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá ãßíåé áëëáãÞ óôïí êáôÜëïãï";
+ Text[ korean ] = "µð·ºÅ丮¸¦ º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Dizin deðiþtirilemiyor";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_OPEN
+{
+ Text = "Öffnen" ;
+ Text [ ENGLISH ] = "Open" ;
+ Text [ portuguese ] = "Abrir" ;
+ Text [ english_us ] = "Open" ;
+ Text [ portuguese_brazilian ] = "Öffnen" ;
+ Text [ swedish ] = "Öppna" ;
+ Text [ danish ] = "Åbn" ;
+ Text [ italian ] = "Apri" ;
+ Text [ spanish ] = "Abrir" ;
+ Text [ french ] = "Ouvrir" ;
+ Text [ dutch ] = "Openen" ;
+ Text[ chinese_simplified ] = "´ò¿ª";
+ Text[ russian ] = "Îòêðûòü";
+ Text[ polish ] = "Otwórz";
+ Text[ japanese ] = "ŠJ‚­";
+ Text[ chinese_traditional ] = "¶}±ÒÂÂÀÉ";
+ Text[ arabic ] = "ÝÊÍ";
+ Text[ greek ] = "¢íïéãìá";
+ Text[ korean ] = "¿­±â";
+ Text[ turkish ] = "Aç";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_FILE
+{
+ Text = "~Datei" ;
+ Text [ ENGLISH ] = "~File" ;
+ Text [ portuguese ] = "~Ficheiro" ;
+ Text [ english_us ] = "~File" ;
+ Text [ portuguese_brazilian ] = "Datei" ;
+ Text [ swedish ] = "F~il" ;
+ Text [ danish ] = "Fil" ;
+ Text [ italian ] = "File" ;
+ Text [ spanish ] = "~Archivo" ;
+ Text [ french ] = "~Fichier" ;
+ Text [ dutch ] = "~Bestand" ;
+ Text[ chinese_simplified ] = "Îļþ(~F)";
+ Text[ russian ] = "~Ôàéë";
+ Text[ polish ] = "Plik";
+ Text[ japanese ] = "̧²Ù(~F)";
+ Text[ chinese_traditional ] = "ÀÉ®×(~F)";
+ Text[ arabic ] = "ãáÝ";
+ Text[ greek ] = "Áñ÷åßï";
+ Text[ korean ] = "ÆÄÀÏ(~F)";
+ Text[ turkish ] = "~Dosya";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_DIR
+{
+ Text = "~Verzeichnis" ;
+ Text [ ENGLISH ] = "~Directory" ;
+ Text [ portuguese ] = "~Directório" ;
+ Text [ english_us ] = "~Directory" ;
+ Text [ portuguese_brazilian ] = "Verzeichnis" ;
+ Text [ swedish ] = "Mapp" ;
+ Text [ danish ] = "Bibliotek" ;
+ Text [ italian ] = "Cartella" ;
+ Text [ spanish ] = "~Directorio" ;
+ Text [ french ] = "~Répertoire" ;
+ Text [ dutch ] = "~Directory" ;
+ Text[ chinese_simplified ] = "Ŀ¼(~D)";
+ Text[ russian ] = "Êàòàëîã";
+ Text[ polish ] = "Katalog";
+ Text[ japanese ] = "ÃÞ¨Ú¸ÄØ(~D)";
+ Text[ chinese_traditional ] = "¥Ø¿ý(~D)";
+ Text[ arabic ] = "Ïáíá";
+ Text[ greek ] = "ÊáôÜëïãïò";
+ Text[ korean ] = "µð·ºÅ丮(~D)";
+ Text[ turkish ] = "~Dizin";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_TYPE
+{
+ Text = "Datei~typ" ;
+ Text [ ENGLISH ] = "File ~type" ;
+ Text [ portuguese ] = "~Tipo de ficheiro" ;
+ Text [ english_us ] = "File ~type" ;
+ Text [ portuguese_brazilian ] = "Dateityp" ;
+ Text [ swedish ] = "Fil~typ" ;
+ Text [ danish ] = "Filtype" ;
+ Text [ italian ] = "Tipo di file" ;
+ Text [ spanish ] = "Tipo de ar~chivo" ;
+ Text [ french ] = "~Type de fichier" ;
+ Text [ dutch ] = "Bestand~type" ;
+ Text[ chinese_simplified ] = "ÎļþÀàÐÍ(~T)";
+ Text[ russian ] = "Òèï ôàéëà";
+ Text[ polish ] = "Typ pliku";
+ Text[ japanese ] = "̧²Ù‚ÌŽí—Þ(~T)";
+ Text[ chinese_traditional ] = "ÀÉ®×Ãþ«¬(~T)";
+ Text[ arabic ] = "äæÚ ÇáãáÝ";
+ Text[ greek ] = "Ôýðïò áñ÷åßïõ";
+ Text[ korean ] = "ÆÄÀÏ ÇüÅÂ(~T)";
+ Text[ turkish ] = "Dosya ~tipi";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_CANTOPENFILE
+{
+ Text = "Kann Datei nicht öffnen" ;
+ Text [ English ] = "Can't open file" ;
+ Text [ portuguese ] = "Impossível abrir ficheiro" ;
+ Text [ english_us ] = "Can't open file" ;
+ Text [ portuguese_brazilian ] = "Kann Datei nicht öffnen" ;
+ Text [ swedish ] = "Kan inte öppna fil" ;
+ Text [ danish ] = "Kan ikke åbne fil" ;
+ Text [ italian ] = "Impossibile aprire il file" ;
+ Text [ spanish ] = "No es posible abrir el archivo" ;
+ Text [ french ] = "Impossible d'ouvrir le fichier" ;
+ Text [ dutch ] = "Kan bestand niet openen" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨´ò¿ªÎļþ";
+ Text[ russian ] = "Îòêðûòü ôàéë íåâîçìîæíî";
+ Text[ polish ] = "Nie mo¿e otworzyæ pliku";
+ Text[ japanese ] = "̧²Ù‚ðŠJ‚­‚±‚Æ‚ª‚Å‚«‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "µLªk¶}±ÒÀÉ®×";
+ Text[ arabic ] = "áÇ íãßä ÝÊÍ ÇáãáÝ";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá áíïé÷èåß ôï áñ÷åßï";
+ Text[ korean ] = "ÆÄÀÏÀ» ¿­ ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Dosya açýlamýyor";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_CANTOPENDIR
+{
+ Text = "Kann Verzeichnis nicht öffnen" ;
+ Text [ English ] = "Can't open directory" ;
+ Text [ portuguese ] = "Impossível abrir directório" ;
+ Text [ english_us ] = "Can't open directory" ;
+ Text [ portuguese_brazilian ] = "Kann Verzeichnis nicht öffnen" ;
+ Text [ swedish ] = "Kan inte öppna mappen" ;
+ Text [ danish ] = "Kan ikke åbne bibliotek" ;
+ Text [ italian ] = "Imposibile aprire la cartella" ;
+ Text [ spanish ] = "No es posible abrir el directorio" ;
+ Text [ french ] = "Impossible d'ouvrir le répertoire" ;
+ Text [ dutch ] = "Kan map niet openen" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨´ò¿ªÄ¿Â¼";
+ Text[ russian ] = "Îòêðûòü êàòàëîã íåâîçìîæíî";
+ Text[ polish ] = "Nie mo¿e otworzyæ katalogu";
+ Text[ japanese ] = "ÃÞ¨Ú¸ÄØ‚ðŠJ‚­‚±‚Æ‚ª‚Å‚«‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "µLªk¶}±Ò¥Ø¿ý";
+ Text[ arabic ] = "áÇ íãßä ÝÊÍ ÇáÏáíá";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá áíïé÷èåß ï êáôÜëïãïò";
+ Text[ korean ] = "µð·ºÅ丮¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Dizin açýlamýyor";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_OVERWRITE
+{
+ Text = "Datei existiert. \nDatei überschreiben?" ;
+ Text [ English ] = "File exists. \nOverwrite file?" ;
+ Text [ portuguese ] = "O ficheiro já existe.\nSobregravar?" ;
+ Text [ english_us ] = "This file already exists. \nOverwrite ?" ;
+ Text [ portuguese_brazilian ] = "Datei existiert. \nDatei überschreiben?" ;
+ Text [ swedish ] = "Filen finns redan. \nSkriva över filen?" ;
+ Text [ danish ] = "Filen eksisterer allerede.\nSkal den overskrives?" ;
+ Text [ italian ] = "Il file esistet. \nSovrascriverlo?" ;
+ Text [ spanish ] = "El archivo ya existe.\n¿Desea sobrescribirlo?" ;
+ Text [ french ] = "Ce fichier existe déjà. \nVoulez-vous le remplacer ?" ;
+ Text [ dutch ] = "Het bestand bestaat reeds. \nOverschrijven?" ;
+ Text[ chinese_simplified ] = "Îļþ´æÔÚ¡£ \nÄúÒª¸²Ð´ÎļþÂð£¿";
+ Text[ russian ] = "Ýòî ôàéë óæå ñóùåñòâóåò. \nÏåðåïèñàòü åãî?";
+ Text[ polish ] = "Plik ju¿ istnieje. \nSkasowaæ plik przez zapisanie?";
+ Text[ japanese ] = "̧²Ù‚Í‚ ‚è‚Ü‚·B \nã‘‚«‚µ‚Ü‚·‚©H";
+ Text[ chinese_traditional ] = "Àɮצs¦b¡C \n±z­nÂмgÀɮסH";
+ Text[ arabic ] = "åÐÇ ÇáãáÝ ãæÌæÏ ãÓÈÞÇð.\nåá ÊÑíÏ ÇáßÊÇÈÉ ÝæÞå¿";
+ Text[ greek ] = "Ôï áñ÷åßï áõôü õðÜñ÷åé Þäç. \nÍá áíôéêáôáóôáèåß;";
+ Text[ korean ] = "ÀÌ ÆÄÀÏÀº ÀÌ¹Ì Á¸ÀçÇÕ´Ï´Ù. \n µ¤¾î ¾²½Ã°Ú½À´Ï±î ?";
+ Text[ turkish ] = "Dosya mevcut. \nÜzerine yazýlsýn mý?";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_GOUP
+{
+ Text = "Eine Ebene höher" ;
+ Text [ English ] = "Go up" ;
+ Text [ portuguese ] = "Um nível acima" ;
+ Text [ english_us ] = "Up One Level" ;
+ Text [ portuguese_brazilian ] = "Eine Ebene höher" ;
+ Text [ swedish ] = "En nivå högre" ;
+ Text [ danish ] = "Et niveau op" ;
+ Text [ italian ] = "Un livello più alto" ;
+ Text [ spanish ] = "Subir un nivel" ;
+ Text [ french ] = "Niveau supérieur" ;
+ Text [ dutch ] = "Een niveau hoger" ;
+ Text[ chinese_simplified ] = "ÏòÉÏÉýÒ»¼¶";
+ Text[ russian ] = "Íà îäèí óðîâåíü ââåðõ";
+ Text[ polish ] = "Jeden poziom wy¿ej";
+ Text[ japanese ] = "ˆê‚Âã‚ÌÌ«ÙÀÞ‚Ö";
+ Text[ chinese_traditional ] = "¦V¤Wª@¤@¯Å";
+ Text[ arabic ] = "ãÓÊæì æÇÍÏ ááÃÚáì";
+ Text[ greek ] = "¸íá åðßðåäï ðéï øçëÜ";
+ Text[ korean ] = "ÇÑ ¼öÁØ À§·Î";
+ Text[ turkish ] = "Bir seviye yukarý";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_SAVE
+{
+ Text = "Speichern" ;
+ Text [ English ] = "Save" ;
+ Text [ portuguese ] = "Guardar" ;
+ Text [ english_us ] = "Save" ;
+ Text [ portuguese_brazilian ] = "Speichern" ;
+ Text [ swedish ] = "Spara" ;
+ Text [ danish ] = "Gem" ;
+ Text [ italian ] = "Salva" ;
+ Text [ spanish ] = "Guardar" ;
+ Text [ french ] = "Enregistrer" ;
+ Text [ dutch ] = "Opslaan" ;
+ Text[ chinese_simplified ] = "´æÅÌ";
+ Text[ russian ] = "Ñîõðàíèòü";
+ Text[ polish ] = "Zapisz";
+ Text[ japanese ] = "•Û‘¶";
+ Text[ chinese_traditional ] = "Àx¦s";
+ Text[ arabic ] = "ÍÝÙ";
+ Text[ greek ] = "ÁðïèÞêåõóç";
+ Text[ korean ] = "ÀúÀå";
+ Text[ turkish ] = "Kaydet";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_DRIVES
+{
+ Text = "~Laufwerke" ;
+ Text [ English ] = "D~rives" ;
+ Text [ portuguese ] = "~Unidades" ;
+ Text [ english_us ] = "D~rive" ;
+ Text [ portuguese_brazilian ] = "Unidades" ;
+ Text [ swedish ] = "~Enheter" ;
+ Text [ danish ] = "Drev" ;
+ Text [ italian ] = "Drive" ;
+ Text [ spanish ] = "~Unidades" ;
+ Text [ french ] = "~Lecteurs" ;
+ Text [ dutch ] = "~Stations" ;
+ Text[ chinese_simplified ] = "Çý¶¯ÅÌ(~R)";
+ Text[ russian ] = "Äèñêè";
+ Text[ polish ] = "Napêdy";
+ Text[ japanese ] = "ÄÞײÌÞ(~R)";
+ Text[ chinese_traditional ] = "ÅX°Ê¾¹(~R)";
+ Text[ arabic ] = "ãÍÑßÇÊ ÇáÃÞÑÇÕ";
+ Text[ greek ] = "ÌïíÜäá äßóêïõ";
+ Text[ korean ] = "µå¶óÀ̺ê(~R)";
+ Text[ turkish ] = "~Sürücü";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_HOME
+{
+ Text = "Benutzer Verzeichnis" ;
+ Text [ ENGLISH ] = "Home Directory" ;
+ Text [ portuguese ] = "Directório do utilizador" ;
+ Text [ english_us ] = "User Directory" ;
+ Text [ portuguese_brazilian ] = "Verzeichnis" ;
+ Text [ swedish ] = "Användarmapp" ;
+ Text [ danish ] = "Brugerbibliotek" ;
+ Text [ italian ] = "Cartella utente" ;
+ Text [ spanish ] = "Directorio de usuario" ;
+ Text [ french ] = "Répertoire d'utilisateur" ;
+ Text [ dutch ] = "Gebruikers-map" ;
+ Text[ chinese_simplified ] = "ʹÓÃÕßĿ¼";
+ Text[ russian ] = "Êàòàëîã ïîëüçîâàòåëÿ";
+ Text[ polish ] = "Katalog u¿ytkowników";
+ Text[ japanese ] = "Õ°»Þ°‚ÌÃÞ¨Ú¸ÄØ";
+ Text[ chinese_traditional ] = "¦Û­q¥Ø¿ý";
+ Text[ arabic ] = "Ïáíá ÇáãÓÊÎÏã";
+ Text[ greek ] = "ÊáôÜëïãïò ÷ñÞóôç";
+ Text[ korean ] = "»ç¿ëÀÚ µð·ºÅ丮";
+ Text[ turkish ] = "Kullanýcý dizini";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_NEWDIR
+{
+ Text = "Verzeichnis anlegen" ;
+ Text [ ENGLISH ] = "Create Directory" ;
+ Text [ portuguese ] = "Criar directório" ;
+ Text [ english_us ] = "Create Directory" ;
+ Text [ portuguese_brazilian ] = "Verzeichnis" ;
+ Text [ swedish ] = "Skapa mapp" ;
+ Text [ danish ] = "Opret bibliotek" ;
+ Text [ italian ] = "Crea cartella" ;
+ Text [ spanish ] = "Crear directorio" ;
+ Text [ french ] = "Créer un répertoire" ;
+ Text [ dutch ] = "Map maken" ;
+ Text[ chinese_simplified ] = "´´½¨Ä¿Â¼";
+ Text[ russian ] = "Ñîçäàòü êàòàëîã";
+ Text[ polish ] = "Utwórz katalog";
+ Text[ japanese ] = "ÃÞ¨Ú¸ÄØ‚ðì¬";
+ Text[ chinese_traditional ] = "«Ø¥ß¥Ø¿ý";
+ Text[ arabic ] = "ÅäÔÇÁ Ïáíá";
+ Text[ greek ] = "Äçìéïõñãßá êáôáëüãïõ";
+ Text[ korean ] = "µð·ºÅ丮 ¸¸µé±â";
+ Text[ turkish ] = "Dizin oluþtur";
+ Text[ language_user1 ] = " ";
+};
+String STR_FILEDLG_ASKNEWDIR
+{
+ Text = "Soll das Verzeichnis %s angelegt werden ?" ;
+ Text [ English ] = "Do you want the directory %s to be created ?" ;
+ Text [ english_us ] = "Do you want the directory %s to be created ?" ;
+ Text [ portuguese_brazilian ] = "Soll das Verzeichnis %s angelegt werden ?" ;
+ Text [ swedish ] = "Skall mappen %s skapas ?" ;
+ Text [ danish ] = "Skal biblioteket %s oprettes?" ;
+ Text [ italian ] = "Si deve creare una cartella %s ?" ;
+ Text [ spanish ] = "¿Desea crear el directorio %s?" ;
+ Text [ french ] = "Souhaitez vous créer le répertoire %s ?" ;
+ Text [ dutch ] = "Wilt u dat map %s wordt aangelegd ?" ;
+ Text [ portuguese ] = "Deseja criar o directório %s ?" ;
+ Text[ chinese_simplified ] = "ÄúÒª½¨Á¢Õâ¸öĿ¼ %s £¿";
+ Text[ russian ] = "Ñîçäàòü êàòàëîã %s ?";
+ Text[ polish ] = "Czy utworzyæ katalog %s?";
+ Text[ japanese ] = "ÃÞ¨Ú¸ÄØ%s‚ð쬂µ‚Ü‚·‚©?";
+ Text[ chinese_traditional ] = "±z­n«Ø¥ß³o­Ó¥Ø¿ý %s ¡H";
+ Text[ arabic ] = "åá ÊÑíÏ ÅäÔÇÁ ÇáÏáíá %s¿";
+ Text[ greek ] = "ÈÝëåôå íá äçìéïõñãçèåß ï êáôÜëïãïò %s;";
+ Text[ korean ] = "µð·ºÅ丮 %s ¸¦ ¸¸µå½Ã°Ú½À´Ï±î ?";
+ Text[ turkish ] = "%s oluþturulsun mu ?";
+ Text[ language_user1 ] = " ";
+};
diff --git a/svtools/source/dialogs/makefile.mk b/svtools/source/dialogs/makefile.mk
new file mode 100644
index 000000000000..9a0dada89c60
--- /dev/null
+++ b/svtools/source/dialogs/makefile.mk
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=dialogs
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SRCFILES= filedlg2.src \
+ prnsetup.src \
+ printdlg.src \
+ colrdlg.src
+
+SLOFILES= $(SLO)$/filedlg.obj \
+ $(SLO)$/filedlg2.obj \
+ $(SLO)$/prnsetup.obj \
+ $(SLO)$/printdlg.obj \
+ $(SLO)$/colctrl.obj \
+ $(SLO)$/colrdlg.obj \
+ $(SLO)$/property.obj \
+ $(SLO)$/wizdlg.obj \
+ $(SLO)$/mcvmath.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx
new file mode 100644
index 000000000000..e4127fab5579
--- /dev/null
+++ b/svtools/source/dialogs/mcvmath.cxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * $RCSfile: mcvmath.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <mcvmath.hxx>
+
+// ---------------------------------------------------------------------
+// die folgenden Tabellen enthalten sin(phi) * 2**14
+// fuer phi= 360Grad*2**-32 bis 360 Grad
+// def. fuer x: phi=360Grad * 2**(x-16)
+// d.h. x = 16 -> 360 Grad
+// x = -16 -> (2**-16) * 360 Grad
+// x: -16 ... 0 ... 15
+//x= 0, 1, 2, 3, 4, 5, 6, 7,
+// 8, 9, 10, 11, 12, 13, 14, 15
+
+static const short CosTab[16] =
+{
+ 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16383,
+ 16379, 16364, 16305, 16069, 15137, 11585, 0, -16383
+};
+static const short SinTab[16]=
+{
+ 2, 3, 6, 13, 25, 50, 101, 201,
+ 402, 804, 1606, 3196, 6270, 11585, 16384, 0
+};
+
+/**************************************************************************
+|*
+|* ImpMultBig2()
+|*
+|* Beschreibung Multiplikation fuer FixPoint-Berechnungen
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+// first parameter should be the bigger one
+
+Fix ImpMultBig2( const Fix& a, const Fix& b )
+{
+ Fix f;
+ f.x = (((b.x+FIX_A2)>>FIX_P2)*a.x+FIX_A3)>>FIX_P3;
+ return f;
+}
+
+/**************************************************************************
+|*
+|* ImpMultBig2()
+|*
+|* Beschreibung Multiplikation fuer FixPoint-Berechnungen
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+// first parameter should be the bigger one
+
+FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb )
+{
+ Fix rr = ImpMultBig2(ra.r,rb.r)-ImpMultBig2(ra.i,rb.i);
+ Fix ii = ImpMultBig2(ra.r,rb.i)+ImpMultBig2(ra.i,rb.r);
+ return FixCpx( rr,ii );
+}
+
+/**************************************************************************
+|*
+|* ImpSqrt()
+|*
+|* Beschreibung Wurzelfunktion fuer FixPoint-Berechnungen
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+USHORT ImpSqrt( ULONG nRadi )
+{
+ register ULONG inf = 1;
+ register ULONG sup = nRadi;
+ register USHORT sqr;
+
+ if ( !nRadi )
+ return 0;
+
+ while ( (inf<<1) <= sup )
+ {
+ sup >>= 1;
+ inf <<= 1;
+ }
+ sqr = (sup+inf) >> 1; // Anfangswert der Iteration
+
+ sqr = (nRadi/sqr + sqr) >> 1; // 2 Newton-Iterationen reichen fuer
+ sqr = (nRadi/sqr + sqr) >> 1; // +- 1 Digit
+
+ return sqr;
+}
+
+/**************************************************************************
+|*
+|* ImpExPI()
+|*
+|* Beschreibung EXPI-Funktion fuer FixPoint-Berechnungen
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+// e**(i*nPhi), Einheit nPhi: 2**16 == 360 Grad
+
+FixCpx ImpExPI( USHORT nPhi )
+{
+ short i;
+ FixCpx aIter(1L); // e**(0*i)
+ FixCpx Mul;
+ const char Sft=14-FIX_POST;
+
+ for ( i = 15; i >= 0; i-- )
+ {
+ if ( (1L<<i) & nPhi )
+ {
+ Mul.r.x = CosTab[i]>>Sft; // e**(i(phi1+phi2)) =
+ Mul.i.x = SinTab[i]>>Sft; // e**(i*phi1)) * e**(i*phi2))
+ aIter *= Mul;
+ }
+ }
+
+ return aIter;
+}
+
+/**************************************************************************
+|*
+|* ImpATanx2()
+|*
+|* Beschreibung ATANX2-Funktion fuer FixPoint-Berechnungen
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+// use for x*x+y*y==1 only
+
+static USHORT ImpATanx2( const Fix& rX, const Fix& rY )
+{
+ USHORT phi0 = 0; // result angel higher part
+ USHORT phi = 0; // dito lower part
+ long x = rX.x;
+ long y = rY.x;
+ long z;
+ const char Sft=14-FIX_POST;
+ short i;
+ FixCpx aTry;
+ FixCpx aInc;
+ FixCpx aIter(1L);
+ BOOL Small = FALSE;
+
+ if ( (x==0) && (y==0) )
+ return 0;
+
+ if ( y < 0)
+ {
+ // reduce 3. to 1. quadrant (0..90 Degree)
+ phi0 += 180L * 65536L / 360L;
+ // turn 180 degree
+ y *= -1;
+ x *= -1;
+ }
+
+ if ( x < 0)
+ {
+ // 2. to 1. q.
+ phi0 += 90L * 65536L / 360L;
+ // turn 90 degree clockwise
+ z = y;
+ y = -x;
+ x = z;
+ }
+
+ for ( i = 13; i >= 0; i-- )
+ {
+ aInc.r.x = CosTab[i]>>Sft; // e**(i(phi1+phi2)) =
+ aInc.i.x = SinTab[i]>>Sft; // e**(i*phi1)) * e**(i*phi2))
+ aTry = aIter*aInc;
+
+ if ( Small )
+ {
+ // is try ok
+ if ( aTry.r.x >= x )
+ {
+ aIter = aTry;
+ phi += (1<<i);
+ }
+ }
+ else
+ {
+ // is try ok
+ if ( aTry.i.x <= y )
+ {
+ aIter = aTry;
+ phi += (1<<i);
+
+ if ( i > 11 )
+ Small=TRUE;
+ }
+ }
+ }
+
+ return phi0+phi;
+}
+
+/**************************************************************************
+|*
+|* ImpATan2()
+|*
+|* Beschreibung ATAN-Funktion fuer FixPoint-Berechnungen
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+USHORT ImpATan2( const short x, const short y )
+{
+ Fix rRad = ImpSqrt(ULONG(long(x)*x+long(y)*y));
+
+ if ( !rRad.x )
+ return 0;
+ Fix fx = x;
+ fx.DivBig( rRad ); // Normiere auf Einheitskreis
+ Fix fy = y;
+ fy.DivBig( rRad );
+
+ return ImpATanx2( fx, fy );
+}
+
+/**************************************************************************
+|*
+|* ImpCartToPolar()
+|*
+|* Beschreibung Koordinaaten-Wandlung
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+void ImpCartToPolar( const short x, const short y, Fix& rRad, USHORT& rPhi )
+{
+ rRad = Fix( ImpSqrt( ULONG( long(x)*x+long(y)*y ) ) );
+
+ if ( !rRad.x )
+ rPhi=0;
+ else
+ {
+ // Normiere auf Einheitskreis
+ Fix fx = x;
+ fx.DivBig(rRad);
+ Fix fy = y;
+ fy.DivBig(rRad);
+ rPhi = ImpATanx2(fx, fy);
+ }
+}
+
+/**************************************************************************
+|*
+|* ImpPolarToCart()
+|*
+|* Beschreibung Koordinaaten-Wandlung
+|* Ersterstellung SH 01.07.93
+|* Letzte Aenderung SH 01.07.93
+|*
+**************************************************************************/
+
+void ImpPolarToCart( const Fix& rR, const USHORT Phi, short& rX, short& rY )
+{
+ FixCpx fc = ImpExPI( Phi ); // calculate sin() & cos()
+ fc.GetReal().MultBig( rR );
+ rX = long( fc.GetReal() );
+ fc.GetImag().MultBig( rR );
+ rY = long( fc.GetImag() );
+}
+
diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx
new file mode 100644
index 000000000000..02eaf3a78657
--- /dev/null
+++ b/svtools/source/dialogs/mcvmath.hxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * $RCSfile: mcvmath.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _MCVMATH_HXX
+#define _MCVMATH_HXX
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+class FixCpx;
+class ColWheel;
+
+// No of fractal bits
+// allowed range 0..14, must be even
+#define FIX_POST 14
+
+// scale for ...Big() -Functions
+#if (FIX_POST>=4)
+#define FIX_P2 4
+#define FIX_P3 (FIX_POST-FIX_P2)
+#else
+#define FIX_P2 0
+#define FIX_P3 FIX_POST
+#endif
+
+#if (FIX_POST>=1)
+#define FIX_ADD (1<<(FIX_POST-1))
+#else
+#define FIX_ADD 0
+#endif
+
+#if (FIX_P2>=1)
+#define FIX_A2 (1<<(FIX_P2-1))
+#else
+#define FIX_A2 0
+#endif
+
+#if (FIX_P3>=1)
+#define FIX_A3 (1<<(FIX_P3-1))
+#else
+#define FIX_A3 0
+#endif
+
+// -------
+// - Fix -
+// -------
+
+class Fix
+{
+private:
+ friend FixCpx;
+ friend ColWheel;
+
+// friend Fix ImpMultBig2( const Fix& a, const Fix& b );
+
+public:
+ long x;
+
+public:
+ Fix() { x=0; }
+ Fix( int i ) { x=(long(i)<<FIX_POST); }
+ Fix( short l ) { x=(long(l)<<FIX_POST); }
+ Fix( USHORT l ) { x=(long(l)<<FIX_POST); }
+ Fix( long l ) { x=(l<<FIX_POST); }
+ Fix( long Z, long N ) { x=(Z<<FIX_POST)/N; }
+
+ void SetInternVal( long nVal ) { x=nVal; }
+ long GetInternVal() const { return x; }
+
+ void operator+= ( const Fix& a ) { x+=a.x; }
+ void operator-= ( const Fix& a ) { x-=a.x; }
+ void operator*= ( const Fix& a ) { x=(x*a.x+FIX_ADD)>>FIX_POST; }
+ void operator/= ( const Fix& a ) { x=(x<<FIX_POST)/a.x; }
+ friend Fix operator- ( const Fix& a );
+
+ void MultBig( const Fix& a )
+ { x=((((a.x+FIX_A2)>>FIX_P2)*x+FIX_A3)>>FIX_P3); }
+ void DivBig( const Fix& a )
+ { x=((x<<FIX_P3)/a.x)<<FIX_P2; }
+
+ friend BOOL operator> ( const Fix& a, const Fix& b ) { return a.x > b.x; }
+ friend BOOL operator< ( const Fix& a, const Fix& b ) { return a.x < b.x; }
+
+ operator long() const { return (x+FIX_ADD) >> FIX_POST; }
+ operator double() const { return double(x)/(1<<FIX_POST); }
+
+ friend Fix operator+ ( const Fix& a, const Fix& b );
+ friend Fix operator- ( const Fix& a, const Fix& b );
+ friend Fix operator* ( const Fix& a, const Fix& b );
+ friend Fix operator/ ( const Fix& a, const Fix& b );
+
+ friend FixCpx operator-( const FixCpx& a );
+};
+
+// ----------
+// - FixCpx -
+// ----------
+
+class FixCpx
+{
+// friend FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb );
+
+public:
+ Fix r;
+ Fix i;
+
+public:
+ FixCpx() : r(), i() {}
+ FixCpx( Fix a ) : r( a ), i() {}
+ FixCpx( Fix a, Fix b ) : r( a ), i( b ) {}
+
+ Fix& GetReal() { return r; }
+ Fix& GetImag() { return i; }
+
+ void operator*= ( const FixCpx& ra );
+ void MultBig( const FixCpx& ra, const FixCpx& rb );
+
+ friend FixCpx operator+ ( const FixCpx& a, const FixCpx& b );
+ friend FixCpx operator- ( const FixCpx& a, const FixCpx& b );
+ friend FixCpx operator* ( const FixCpx& a, const FixCpx& b );
+ friend FixCpx operator/ ( const FixCpx& a, const FixCpx& b );
+ friend FixCpx operator- ( const FixCpx& a );
+};
+
+inline Fix operator- ( const Fix& a )
+{
+ Fix f;
+ f.x = -a.x;
+ return f;
+}
+
+inline Fix operator+ ( const Fix& a, const Fix& b )
+{
+ long l = a.x+b.x;
+ return *((Fix*)&l);
+}
+
+inline Fix operator- ( const Fix& a, const Fix& b )
+{
+ long l = a.x-b.x;
+ return *((Fix*)&l);
+}
+
+inline Fix operator* ( const Fix& a, const Fix& b )
+{
+ long l=(a.x*b.x+FIX_ADD)>>FIX_POST;
+ return *((Fix*)&l);
+}
+
+inline Fix operator/ ( const Fix& a, const Fix& b )
+{
+ long l=(a.x<<FIX_POST)/b.x;
+ return *((Fix*)&l);
+}
+
+inline FixCpx operator- ( const FixCpx& a )
+{
+ FixCpx fc;
+
+ fc.r.x = -a.r.x;
+ fc.i.x = -a.i.x;
+ return fc;
+}
+
+inline FixCpx operator+ ( const FixCpx& a, const FixCpx& b )
+{
+ return FixCpx( a.r+b.r, a.i+b.i );
+}
+
+inline FixCpx operator- ( const FixCpx& a, const FixCpx& b )
+{
+ return FixCpx( a.r-b.r, a.i-b.i );
+}
+
+inline void FixCpx::operator*= ( const FixCpx& ra )
+{
+ Fix rr = ra.r*r-ra.i*i;
+ i = ra.r*i+ra.i*r;
+ r = rr;
+}
+
+inline FixCpx operator* ( const FixCpx& a, const FixCpx& b )
+{
+ return FixCpx( a.r*b.r-a.i*b.i, a.r*b.i+a.i*b.r );
+}
+
+inline FixCpx operator/ ( const FixCpx& a, const FixCpx& b )
+{
+ return FixCpx( (a.r*b.r+a.i*b.i)/(b.r*b.r+b.i*b.i),
+ (b.r*a.r-a.r*b.i)/(b.r*b.r+b.i*b.i) );
+}
+
+// -----------------------------------------------------------------------
+
+Fix ImpMultBig2( const Fix& a, const Fix& b );
+FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb );
+
+void ImpCartToPolar( const short x, const short y, Fix& rRad, USHORT& rPhi );
+void ImpPolarToCart( const Fix& rR, const USHORT Phi, short& rX, short& rY );
+
+USHORT ImpSqrt( ULONG nRadi );
+USHORT ImpATan2( const short x, const short y );
+FixCpx ImpExPI( USHORT nPhi );
+
+#endif // _MCVMATH_HXX
diff --git a/svtools/source/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx
new file mode 100644
index 000000000000..dd6ba66fc705
--- /dev/null
+++ b/svtools/source/dialogs/printdlg.cxx
@@ -0,0 +1,527 @@
+/*************************************************************************
+ *
+ * $RCSfile: printdlg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_APP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _VCL_PRINT_HXX
+#include <vcl/print.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _VCL_FILEDLG_HXX
+#include <vcl/filedlg.hxx>
+#endif
+#ifndef _SVTOOLS_FILEDLG_HXX
+#include <filedlg.hxx>
+#endif
+#include <tools/urlobj.hxx>
+#pragma hdrstop
+
+#include "printdlg.hrc"
+#include <prnsetup.hxx>
+#include <printdlg.hxx>
+#include <svtdata.hxx>
+
+// =======================================================================
+
+PrintDialog::PrintDialog( Window* pWindow ) :
+ ModalDialog ( pWindow, SvtResId( DLG_SVT_PRNDLG_PRINTDLG ) ),
+ maGrpPrinter ( this, SvtResId( GRP_PRINTER ) ),
+ maFtName ( this, SvtResId( FT_NAME ) ),
+ maLbName ( this, SvtResId( LB_NAMES ) ),
+ maBtnProperties ( this, SvtResId( BTN_PROPERTIES ) ),
+ maFtStatus ( this, SvtResId( FT_STATUS ) ),
+ maFiStatus ( this, SvtResId( FI_STATUS ) ),
+ maFtType ( this, SvtResId( FT_TYPE ) ),
+ maFiType ( this, SvtResId( FI_TYPE ) ),
+ maFtLocation ( this, SvtResId( FT_LOCATION ) ),
+ maFiLocation ( this, SvtResId( FI_LOCATION ) ),
+ maFtComment ( this, SvtResId( FT_COMMENT ) ),
+ maFiComment ( this, SvtResId( FI_COMMENT ) ),
+ maCbxFilePrint ( this, SvtResId( CBX_FILEPRINT ) ),
+ maFiPrintFile ( this, SvtResId( FI_PRINTFILE ) ),
+ maBtnBrowse ( this, SvtResId( BTN_BROWSE ) ),
+ maGrpPrintRange ( this, SvtResId( GRP_PRINTRANGE ) ),
+ maRbtAll ( this, SvtResId( RBT_ALL ) ),
+ maRbtPages ( this, SvtResId( RBT_PAGES ) ),
+ maRbtSelection ( this, SvtResId( RBT_SELECTION ) ),
+ maEdtPages ( this, SvtResId( EDT_PAGES ) ),
+ maGrpCopies ( this, SvtResId( GRP_COPIES ) ),
+ maFtCopies ( this, SvtResId( FT_COPIES ) ),
+ maNumCopies ( this, SvtResId( NUM_COPIES ) ),
+ maImgCollate ( this, SvtResId( IMG_COLLATE ) ),
+ maImgNotCollate ( this, SvtResId( IMG_NOT_COLLATE ) ),
+ maCbxCollate ( this, SvtResId( CBX_COLLATE ) ),
+ maBtnOptions ( this, SvtResId( BTN_OPTIONS ) ),
+ maBtnHelp ( this, SvtResId( BTN_HELP ) ),
+ maBtnOK ( this, SvtResId( BTN_OK ) ),
+ maBtnCancel ( this, SvtResId( BTN_CANCEL ) )
+{
+ FreeResource();
+
+ mpPrinter = NULL;
+ mpTempPrinter = NULL;
+ mnCopyCount = 1;
+ mnFirstPage = 0;
+ mnLastPage = 0;
+ mnMinPage = 1;
+ mnMaxPage = 65535;
+ meCheckRange = PRINTDIALOG_ALL;
+ mbAll = TRUE;
+ mbSelection = FALSE;
+ mbFromTo = FALSE;
+ mbRange = FALSE;
+ mbCollate = FALSE;
+ mbCollateCheck = FALSE;
+ mbOptions = FALSE;
+
+ maStatusTimer.SetTimeout( IMPL_PRINTDLG_STATUS_UPDATE );
+ maStatusTimer.SetTimeoutHdl( LINK( this, PrintDialog, ImplStatusHdl ) );
+ maBtnProperties.SetClickHdl( LINK( this, PrintDialog, ImplPropertiesHdl ) );
+ maLbName.SetSelectHdl( LINK( this, PrintDialog, ImplChangePrinterHdl ) );
+ maBtnBrowse.SetClickHdl( LINK( this, PrintDialog, ImplBrowseHdl ) );
+
+ maFiPrintFile.SetStyle( maFiPrintFile.GetStyle() | WB_PATHELLIPSIS );
+
+ Link aLink( LINK( this, PrintDialog, ImplModifyControlHdl ) );
+ maCbxFilePrint.SetClickHdl( aLink );
+ maRbtAll.SetClickHdl( aLink );
+ maRbtPages.SetClickHdl( aLink );
+ maRbtSelection.SetClickHdl( aLink );
+ maEdtPages.SetModifyHdl( aLink );
+ maNumCopies.SetModifyHdl( aLink );
+ maCbxCollate.SetClickHdl( aLink );
+ maBtnOptions.SetClickHdl( aLink );
+
+ maRbtAll.Check();
+
+ // Because we have no local print Dialog, or in the other case
+ // the print client and print server must handle this with a
+ // temporaery file and copy the file after printing to the
+ // destionation file name.
+ if ( Application::IsRemoteServer() )
+ maCbxFilePrint.Enable( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+PrintDialog::~PrintDialog()
+{
+ ImplFreePrnDlgListBox( &maLbName, FALSE );
+ delete mpTempPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void PrintDialog::ImplSetInfo()
+{
+ const QueueInfo* pInfo = (QueueInfo*)(maLbName.GetEntryData( maLbName.GetSelectEntryPos() ));
+ if ( pInfo )
+ {
+ maFiType.SetText( pInfo->GetDriver() );
+ maFiLocation.SetText( pInfo->GetLocation() );
+ maFiComment.SetText( pInfo->GetComment() );
+ maFiStatus.SetText( ImplPrnDlgGetStatusText( *pInfo ) );
+ }
+ else
+ {
+ XubString aTempStr;
+ maFiType.SetText( aTempStr );
+ maFiLocation.SetText( aTempStr );
+ maFiComment.SetText( aTempStr );
+ maFiStatus.SetText( aTempStr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PrintDialog::ImplCheckOK()
+{
+ // Ueberprueft, ob der OK-Button enabled ist
+ BOOL bEnable = TRUE;
+
+ if ( maCbxFilePrint.IsChecked() )
+ bEnable = maFiPrintFile.GetText().Len() > 0;
+
+ if ( bEnable && maRbtPages.IsChecked() )
+ bEnable = maEdtPages.GetText().Len() > 0;
+
+ if ( bEnable )
+ {
+ if ( mpTempPrinter )
+ bEnable = mpTempPrinter->IsValid();
+ else
+ bEnable = mpPrinter->IsValid();
+ }
+
+ maBtnOK.Enable( bEnable );
+}
+
+// -----------------------------------------------------------------------
+
+void PrintDialog::ImplInitControls()
+{
+ // Alles
+ if ( mbAll )
+ {
+ maRbtAll.Enable();
+ if( meCheckRange == PRINTDIALOG_ALL )
+ maRbtAll.Check( TRUE );
+ }
+ else
+ maRbtAll.Enable( FALSE );
+
+ // Selektion
+ if ( mbSelection )
+ {
+ maRbtSelection.Enable();
+ if ( meCheckRange == PRINTDIALOG_SELECTION )
+ maRbtSelection.Check( TRUE );
+ }
+ else
+ maRbtSelection.Enable( FALSE );
+
+ // Seiten
+ if ( mbRange )
+ {
+ maRbtPages.Enable();
+ maEdtPages.Show();
+ maEdtPages.SetText( maRangeText );
+
+ if( ( meCheckRange == PRINTDIALOG_FROMTO ) ||
+ ( meCheckRange == PRINTDIALOG_RANGE ) )
+ {
+ maRbtPages.Check( TRUE );
+ maEdtPages.Enable();
+ }
+ else
+ maEdtPages.Enable( FALSE );
+ }
+ else
+ {
+ maRbtPages.Enable( FALSE );
+ maEdtPages.Hide();
+ }
+
+ // Anzahl Kopien
+ maNumCopies.SetValue( mnCopyCount );
+
+ // Sortierung
+ maCbxCollate.Enable( mbCollate );
+ maCbxCollate.Check( mbCollateCheck );
+
+ // Zusaetze-Button
+ if ( mbOptions )
+ maBtnOptions.Show();
+}
+
+// -----------------------------------------------------------------------
+
+void PrintDialog::ImplFillDialogData()
+{
+ if ( maRbtAll.IsChecked() )
+ meCheckRange = PRINTDIALOG_ALL;
+ else if( maRbtSelection.IsChecked() )
+ meCheckRange = PRINTDIALOG_SELECTION;
+ else
+ {
+ meCheckRange = PRINTDIALOG_RANGE;
+ maRangeText = maEdtPages.GetText();
+ }
+
+ mnCopyCount = (USHORT) maNumCopies.GetValue();
+ mbCollateCheck = maCbxCollate.IsChecked();
+
+ // In Datei drucken
+ if ( maCbxFilePrint.IsChecked() )
+ mpPrinter->SetPrintFile( maFiPrintFile.GetText() );
+ mpPrinter->EnablePrintFile( maCbxFilePrint.IsChecked() );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrintDialog, ImplStatusHdl, Timer*, EMPTYARG )
+{
+ QueueInfo aInfo;
+ ImplPrnDlgUpdateQueueInfo( &maLbName, aInfo );
+ maFiStatus.SetText( ImplPrnDlgGetStatusText( aInfo ) );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrintDialog, ImplPropertiesHdl, void*, EMPTYARG )
+{
+ if ( !mpTempPrinter )
+ mpTempPrinter = new Printer( mpPrinter->GetJobSetup() );
+ mpTempPrinter->Setup();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrintDialog, ImplChangePrinterHdl, void*, EMPTYARG )
+{
+ mpTempPrinter = ImplPrnDlgListBoxSelect( &maLbName, &maBtnProperties,
+ mpPrinter, mpTempPrinter );
+ ImplSetInfo();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrintDialog, ImplBrowseHdl, void*, EMPTYARG )
+{
+ VclFileDialog* pVclFileDlg = GetpApp()->CreateFileDialog( this, WB_SAVEAS );
+ if ( pVclFileDlg )
+ {
+ short nRet = pVclFileDlg->Execute();
+
+ if ( nRet == RET_OK )
+ {
+ INetURLObject aObj( pVclFileDlg->GetPath() );
+ maFiPrintFile.SetText( aObj.PathToFileName() );
+ ImplCheckOK();
+ }
+
+ delete pVclFileDlg;
+ }
+ else
+ {
+ FileDialog* pFileDlg = new FileDialog( this, WB_SAVEAS );
+ short nRet = pFileDlg->Execute();
+
+ if ( nRet == RET_OK )
+ {
+ maFiPrintFile.SetText( pFileDlg->GetPath() );
+ ImplCheckOK();
+ }
+
+ delete pFileDlg;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrintDialog, ImplModifyControlHdl, void*, p )
+{
+ // Drucken in Datei
+ if ( !p || (p == &maCbxFilePrint) )
+ {
+ BOOL bCheck = maCbxFilePrint.IsChecked();
+ if ( bCheck && !maFiPrintFile.GetText().Len() )
+ ImplBrowseHdl( &maBtnBrowse );
+ maFiPrintFile.Enable( bCheck );
+ maBtnBrowse.Enable( bCheck );
+ ImplCheckOK();
+ }
+
+ // Radiobuttons (Umfang)
+ if ( !p || (p == &maRbtAll) || (p == &maRbtPages) || (p == &maRbtSelection) )
+ {
+ BOOL bCheck = maRbtPages.IsChecked();
+ maEdtPages.Enable( bCheck );
+ if ( p == &maRbtPages )
+ maEdtPages.GrabFocus();
+ ImplCheckOK();
+ }
+
+ // Edit-Felder (Dateiname, Seiten)
+ if ( p == &maEdtPages )
+ ImplCheckOK();
+
+ // Anzahl Kopien
+ BOOL bNumCopies = FALSE;
+
+ if ( !p || p == &maNumCopies )
+ {
+ if ( p )
+ bNumCopies = TRUE;
+ BOOL bCopies = maNumCopies.GetValue() > 1;
+ maCbxCollate.Enable( bCopies && mbCollate );
+
+ if ( !bCopies )
+ maCbxCollate.Check( FALSE );
+ else if ( mbCollateCheck )
+ maCbxCollate.Check( TRUE );
+ }
+
+ // Sortieren
+ if ( !p || p == &maCbxCollate || bNumCopies )
+ {
+ BOOL bCheck = maCbxCollate.IsChecked();
+
+ if ( !bNumCopies )
+ mbCollateCheck = maCbxCollate.IsChecked();
+
+ if( bCheck )
+ {
+ maImgCollate.Show();
+ maImgNotCollate.Hide();
+ }
+ else
+ {
+ maImgCollate.Hide();
+ maImgNotCollate.Show();
+ }
+ }
+
+ // Zus"atze
+ if ( p == &maBtnOptions )
+ ClickOptionsHdl();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long PrintDialog::ClickOptionsHdl()
+{
+ if ( maOptionsHdlLink.IsSet() )
+ return maOptionsHdlLink.Call( this );
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+long PrintDialog::OK()
+{
+ if ( maOKHdlLink.IsSet() )
+ return maOKHdlLink.Call( this );
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+long PrintDialog::Notify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_GETFOCUS) && IsReallyVisible() )
+ ImplStatusHdl( &maStatusTimer );
+
+ return ModalDialog::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void PrintDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( rDCEvt.GetType() == DATACHANGED_PRINTER )
+ {
+ mpTempPrinter = ImplPrnDlgUpdatePrinter( mpPrinter, mpTempPrinter );
+ Printer* pPrn;
+ if ( mpTempPrinter )
+ pPrn = mpTempPrinter;
+ else
+ pPrn = mpPrinter;
+ ImplFillPrnDlgListBox( pPrn, &maLbName, &maBtnProperties );
+ ImplSetInfo();
+ ImplCheckOK();
+ }
+
+ ModalDialog::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+short PrintDialog::Execute()
+{
+ if ( !mpPrinter || mpPrinter->IsPrinting() || mpPrinter->IsJobActive() )
+ {
+ DBG_ERRORFILE( "PrinterSetupDialog::Execute() - No Printer or printer is printing" );
+ return FALSE;
+ }
+
+ // Controls initialisieren
+ ImplFillPrnDlgListBox( mpPrinter, &maLbName, &maBtnProperties );
+ ImplSetInfo();
+ maStatusTimer.Start();
+ ImplInitControls();
+ ImplModifyControlHdl( NULL );
+
+ // Dialog starten
+ short nRet = ModalDialog::Execute();
+
+ // Wenn Dialog mit OK beendet wurde, dann die Daten updaten
+ if( nRet == TRUE )
+ {
+ if ( mpTempPrinter )
+ mpPrinter->SetPrinterProps( mpTempPrinter );
+ ImplFillDialogData();
+ }
+
+ maStatusTimer.Stop();
+
+ return nRet;
+}
+
+
diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc
new file mode 100644
index 000000000000..4b674f1c83f3
--- /dev/null
+++ b/svtools/source/dialogs/printdlg.hrc
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: printdlg.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <svtools.hrc>
+
+#define GRP_PRINTER 1
+#define LB_NAMES 2
+#define BTN_PROPERTIES 3
+#define FT_NAME 4
+#define FT_STATUS 5
+#define FI_STATUS 6
+#define FT_TYPE 7
+#define FI_TYPE 8
+#define FT_LOCATION 9
+#define FI_LOCATION 10
+#define FT_COMMENT 11
+#define FI_COMMENT 12
+#define CBX_FILEPRINT 13
+#define FI_PRINTFILE 14
+#define BTN_BROWSE 15
+
+#define GRP_PRINTRANGE 16
+#define RBT_ALL 17
+#define RBT_PAGES 18
+#define RBT_SELECTION 19
+#define EDT_PAGES 20
+
+#define GRP_COPIES 21
+#define FT_COPIES 22
+#define NUM_COPIES 23
+#define CBX_COLLATE 24
+#define IMG_COLLATE 25
+#define IMG_NOT_COLLATE 26
+
+#define BTN_OK 27
+#define BTN_CANCEL 28
+#define BTN_HELP 29
+#define BTN_OPTIONS 30
diff --git a/svtools/source/dialogs/printdlg.src b/svtools/source/dialogs/printdlg.src
new file mode 100644
index 000000000000..cb3e65ae32c9
--- /dev/null
+++ b/svtools/source/dialogs/printdlg.src
@@ -0,0 +1,616 @@
+/*************************************************************************
+ *
+ * $RCSfile: printdlg.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "printdlg.hrc"
+
+#ifndef IMAGE_STDBTN_COLOR
+#define IMAGE_STDBTN_COLOR Color { Red = 0xC000; Green = 0xC000; Blue = 0xC000; }
+#endif
+
+ModalDialog DLG_SVT_PRNDLG_PRINTDLG
+{
+ SVLook = TRUE ;
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 260 , 169 ) ;
+ Text = "Drucken" ;
+ Text [ ENGLISH ] = "Print" ;
+ Text [ english_us ] = "Print" ;
+ Text [ portuguese_brazilian ] = "Drucken" ;
+ Text [ swedish ] = "Skriv ut" ;
+ Text [ danish ] = "Udskriv" ;
+ Text [ italian ] = "Stampa" ;
+ Text [ spanish ] = "Imprimir" ;
+ Text [ french ] = "Impression" ;
+ Text [ dutch ] = "Afdrukken" ;
+ Text [ portuguese ] = "Imprimir" ;
+ GroupBox GRP_PRINTER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 90 ) ;
+ Text = "Drucker" ;
+ Text [ ENGLISH ] = "Printer" ;
+ Text [ english_us ] = "Printer" ;
+ Text [ portuguese_brazilian ] = "Drucker" ;
+ Text [ swedish ] = "Skrivare" ;
+ Text [ danish ] = "Printer" ;
+ Text [ italian ] = "Stampante" ;
+ Text [ spanish ] = "Impresora" ;
+ Text [ french ] = "Imprimante" ;
+ Text [ dutch ] = "Printer" ;
+ Text [ portuguese ] = "Impressora" ;
+ Text[ chinese_simplified ] = "´òÓ¡»ú";
+ Text[ russian ] = "Ïðèíòåð";
+ Text[ polish ] = "Drukarka";
+ Text[ japanese ] = "ÌßØÝÀ";
+ Text[ chinese_traditional ] = "¦Lªí¾÷";
+ Text[ arabic ] = "ÇáØÇÈÚÉ";
+ Text[ greek ] = "ÅêôõðùôÞò";
+ Text[ korean ] = "ÇÁ¸°ÅÍ";
+ Text[ turkish ] = "Yazýcý";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Name" ;
+ Text [ ENGLISH ] = "~Name" ;
+ Text [ english_us ] = "~Name" ;
+ Text [ portuguese_brazilian ] = "~Name" ;
+ Text [ swedish ] = "~Namn" ;
+ Text [ danish ] = "Navn" ;
+ Text [ italian ] = "~Nome" ;
+ Text [ spanish ] = "~Nombre" ;
+ Text [ french ] = "~Nom" ;
+ Text [ dutch ] = "~Naam" ;
+ Text [ portuguese ] = "~Nome" ;
+ Text[ chinese_simplified ] = "Ãû³Æ(~N)";
+ Text[ russian ] = "~Èìÿ";
+ Text[ polish ] = "Nazwa";
+ Text[ japanese ] = "–¼‘O(~N)";
+ Text[ chinese_traditional ] = "¦WºÙ(~N)";
+ Text[ arabic ] = "ÇáÇÓã";
+ Text[ greek ] = "¼íïìá";
+ Text[ korean ] = "À̸§(~N)";
+ Text[ turkish ] = "~Ad";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_NAMES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 12 ) ;
+ Size = MAP_APPFONT ( 125 , 80 ) ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ PushButton BTN_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( 188 , 12 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text = "~Eigenschaften..." ;
+ Text [ ENGLISH ] = "~Properties..." ;
+ Text [ portuguese ] = "~Propriedades..." ;
+ Text [ english_us ] = "Propert~ies..." ;
+ Text [ portuguese_brazilian ] = "~Eigenschaften..." ;
+ Text [ swedish ] = "~Egenskaper..." ;
+ Text [ danish ] = "Egenskaber..." ;
+ Text [ italian ] = "~Proprietà..." ;
+ Text [ spanish ] = "~Propiedades..." ;
+ Text [ french ] = "~Propriétés..." ;
+ Text [ dutch ] = "~Eigenschappen..." ;
+ Text[ chinese_simplified ] = "ÊôÐÔ(~I)...";
+ Text[ russian ] = "~Ñâîéñòâà...";
+ Text[ polish ] = "W³aœciwoœci...";
+ Text[ japanese ] = "ÌßÛÊßè(~I)...";
+ Text[ chinese_traditional ] = "ÄÝ©Ê(~I)...";
+ Text[ arabic ] = "ÎÕÇÆÕ...";
+ Text[ greek ] = "Éäéüôçôåò...";
+ Text[ korean ] = "µî·ÏÁ¤º¸(~I)...";
+ Text[ turkish ] = "~Özellikler...";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_STATUS
+ {
+ Pos = MAP_APPFONT ( 12 , 29 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Status" ;
+ Text [ ENGLISH ] = "Status" ;
+ Text [ english_us ] = "Status" ;
+ Text [ portuguese_brazilian ] = "Status" ;
+ Text [ swedish ] = "Status" ;
+ Text [ danish ] = "Status" ;
+ Text [ italian ] = "Stato" ;
+ Text [ spanish ] = "Estado" ;
+ Text [ french ] = "État" ;
+ Text [ dutch ] = "Status" ;
+ Text [ portuguese ] = "Estado" ;
+ Text[ chinese_simplified ] = "״̬";
+ Text[ russian ] = "Ñîñòîÿíèå";
+ Text[ polish ] = "Stan";
+ Text[ japanese ] = "½Ã°À½";
+ Text[ chinese_traditional ] = "ª¬ºA";
+ Text[ arabic ] = "ÇáÍÇáÉ";
+ Text[ greek ] = "ÊáôÜóôáóç";
+ Text[ korean ] = "»óÅÂ";
+ Text[ turkish ] = "Durum";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_STATUS
+ {
+ Pos = MAP_APPFONT ( 60 , 29 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Typ" ;
+ Text [ ENGLISH ] = "Type" ;
+ Text [ english_us ] = "Type" ;
+ Text [ portuguese_brazilian ] = "Typ" ;
+ Text [ swedish ] = "Typ" ;
+ Text [ danish ] = "Type" ;
+ Text [ italian ] = "Tipo" ;
+ Text [ spanish ] = "Tipo" ;
+ Text [ french ] = "Type" ;
+ Text [ dutch ] = "Type" ;
+ Text [ portuguese ] = "Tipo" ;
+ Text[ chinese_simplified ] = "ÀàÐÍ";
+ Text[ russian ] = "Òèï";
+ Text[ polish ] = "Typ";
+ Text[ japanese ] = "Ží—Þ";
+ Text[ chinese_traditional ] = "Ãþ«¬";
+ Text[ arabic ] = "ÇáäæÚ";
+ Text[ greek ] = "Ôýðïò";
+ Text[ korean ] = "ÇüÅÂ";
+ Text[ turkish ] = "Tip";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_TYPE
+ {
+ Pos = MAP_APPFONT ( 60 , 40 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ FixedText FT_LOCATION
+ {
+ Pos = MAP_APPFONT ( 12 , 51 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Ort" ;
+ Text [ ENGLISH ] = "Location" ;
+ Text [ english_us ] = "Location" ;
+ Text [ portuguese_brazilian ] = "Ort" ;
+ Text [ swedish ] = "Plats" ;
+ Text [ danish ] = "Placering" ;
+ Text [ italian ] = "Percorso" ;
+ Text [ spanish ] = "Ubicación" ;
+ Text [ french ] = "Emplacement" ;
+ Text [ dutch ] = "Plaats" ;
+ Text [ portuguese ] = "Lugar" ;
+ Text[ chinese_simplified ] = "λÖÃ";
+ Text[ russian ] = "Ëîêàëèçàöèÿ";
+ Text[ polish ] = "Lokalizacja";
+ Text[ japanese ] = "êŠ";
+ Text[ chinese_traditional ] = "¦ì¸m";
+ Text[ arabic ] = "ÇáãæÞÚ";
+ Text[ greek ] = "ÈÝóç";
+ Text[ korean ] = "À§Ä¡";
+ Text[ turkish ] = "Yer";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_LOCATION
+ {
+ Pos = MAP_APPFONT ( 60 , 51 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ FixedText FT_COMMENT
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Kommentar" ;
+ Text [ ENGLISH ] = "Comment" ;
+ Text [ english_us ] = "Comment" ;
+ Text [ portuguese_brazilian ] = "Kommentar" ;
+ Text [ swedish ] = "Kommentar" ;
+ Text [ danish ] = "Kommentar" ;
+ Text [ italian ] = "Commento" ;
+ Text [ spanish ] = "Comentario" ;
+ Text [ french ] = "Commentaire" ;
+ Text [ dutch ] = "Commentaar" ;
+ Text [ portuguese ] = "Comentário" ;
+ Text[ chinese_simplified ] = "×¢½â";
+ Text[ russian ] = "Êîììåíòàðèé";
+ Text[ polish ] = "Komentarz";
+ Text[ japanese ] = "ºÒÝÄ";
+ Text[ chinese_traditional ] = "ª`¸Ñ";
+ Text[ arabic ] = "ÊÚáíÞ";
+ Text[ greek ] = "Ó÷üëéï";
+ Text[ korean ] = "¸Þ¸ð";
+ Text[ turkish ] = "Açýklama";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_COMMENT
+ {
+ Pos = MAP_APPFONT ( 60 , 62 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ CheckBox CBX_FILEPRINT
+ {
+ Pos = MAP_APPFONT ( 12 , 77 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text = "Ausdruck ~in Datei" ;
+ Text [ ENGLISH ] = "Print to f~ile" ;
+ Text [ english_us ] = "Print to file" ;
+ Text [ portuguese_brazilian ] = "Ausdruck ~in Datei" ;
+ Text [ swedish ] = "Skriv ut till ~fil" ;
+ Text [ danish ] = "Udskrift til fil" ;
+ Text [ italian ] = "Stampa su ~file" ;
+ Text [ spanish ] = "Imprimir ~en archivo" ;
+ Text [ french ] = "Imprimer dans un ~fichier " ;
+ Text [ dutch ] = "Afdrukken in ~bestand" ;
+ Text [ portuguese ] = "Imprimir em ~ficheiro" ;
+ Text[ chinese_simplified ] = "´òÓ¡³ÉÎļþ";
+ Text[ russian ] = "Ïå÷àòü â ôàéë";
+ Text[ polish ] = "Drukuj do pliku";
+ Text[ japanese ] = "̧²Ù‚Öo—Í";
+ Text[ chinese_traditional ] = "¦C¦L¦¨ÀÉ®×";
+ Text[ arabic ] = "ØÈÇÚÉ Åáì ãáÝ";
+ Text[ greek ] = "Åêôýðùóç óå áñ÷åßï";
+ Text[ korean ] = "ÆÄÀÏ·Î Àμâ";
+ Text[ turkish ] = "D~osyaya yazdýr";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_PRINTFILE
+ {
+ Pos = MAP_APPFONT ( 90 , 77 ) ;
+ Size = MAP_APPFONT ( 141 , 12 ) ;
+ };
+ PushButton BTN_BROWSE
+ {
+ Pos = MAP_APPFONT ( 234 , 75 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~..." ;
+ };
+ GroupBox GRP_PRINTRANGE
+ {
+ Pos = MAP_APPFONT ( 6 , 96 ) ;
+ Size = MAP_APPFONT ( 117 , 47 ) ;
+ Text = "Druckbereich" ;
+ Text [ ENGLISH ] = "Print range" ;
+ Text [ english_us ] = "Print range" ;
+ Text [ portuguese_brazilian ] = "Druckbereich" ;
+ Text [ swedish ] = "Utskriftsområde" ;
+ Text [ danish ] = "Udskriftsområde" ;
+ Text [ italian ] = "Area di stampa" ;
+ Text [ spanish ] = "Área de impresión" ;
+ Text [ french ] = "Zone d'impression" ;
+ Text [ dutch ] = "Afdrukbereik" ;
+ Text [ portuguese ] = "Área de impressão" ;
+ Text[ chinese_simplified ] = "´òÓ¡ÇøÓò";
+ Text[ russian ] = "Îáëàñòü ïå÷àòè";
+ Text[ polish ] = "Zakres wydruku";
+ Text[ japanese ] = "ˆóü”͈Í";
+ Text[ chinese_traditional ] = "¦C¦L­S³ò";
+ Text[ arabic ] = "äØÇÞ ÇáØÈÇÚÉ";
+ Text[ greek ] = "Ðåñéï÷Þ åêôýðùóçò";
+ Text[ korean ] = "Àμ⠿µ¿ª";
+ Text[ turkish ] = "Yazdýrma alaný";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RBT_ALL
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Alles" ;
+ Text [ ENGLISH ] = "~All" ;
+ Text [ portuguese ] = "~Tudo" ;
+ Text [ english_us ] = "All" ;
+ Text [ portuguese_brazilian ] = "~Alles" ;
+ Text [ swedish ] = "~Allt" ;
+ Text [ danish ] = "Alt" ;
+ Text [ italian ] = "~Tutto" ;
+ Text [ spanish ] = "~Todo" ;
+ Text [ french ] = "~Tout" ;
+ Text [ dutch ] = "~Alles" ;
+ Text[ chinese_simplified ] = "È«²¿";
+ Text[ russian ] = "~Âñå";
+ Text[ polish ] = "Wszystko";
+ Text[ japanese ] = "‚·‚ׂÄ";
+ Text[ chinese_traditional ] = "¥þ³¡";
+ Text[ arabic ] = "Çáßá";
+ Text[ greek ] = "¼ëá";
+ Text[ korean ] = "ÀüºÎ";
+ Text[ turkish ] = "~Tümü";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RBT_PAGES
+ {
+ Pos = MAP_APPFONT ( 12 , 117 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Seiten" ;
+ Text [ ENGLISH ] = "Pa~ges" ;
+ Text [ portuguese ] = "~Páginas" ;
+ Text [ english_us ] = "Pages" ;
+ Text [ portuguese_brazilian ] = "~Seiten" ;
+ Text [ swedish ] = "~Sidor" ;
+ Text [ danish ] = "Sider" ;
+ Text [ italian ] = "~Pagine" ;
+ Text [ spanish ] = "~Páginas" ;
+ Text [ french ] = "P~ages" ;
+ Text [ dutch ] = "~Pagina" ;
+ Text[ chinese_simplified ] = "Ò³";
+ Text[ russian ] = "~Ñòðàíèöû";
+ Text[ polish ] = "Strony";
+ Text[ japanese ] = "Íß°¼ÞŽw’è";
+ Text[ chinese_traditional ] = "­¶";
+ Text[ arabic ] = "ÕÝÍÇÊ";
+ Text[ greek ] = "Óåëßäåò";
+ Text[ korean ] = "ÆäÀÌÁö";
+ Text[ turkish ] = "~Sayfa";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RBT_SELECTION
+ {
+ Pos = MAP_APPFONT ( 12 , 129 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "A~uswahl" ;
+ Text [ ENGLISH ] = "~Selection" ;
+ Text [ portuguese ] = "~Selecção" ;
+ Text [ english_us ] = "Selection" ;
+ Text [ portuguese_brazilian ] = "A~uswahl" ;
+ Text [ swedish ] = "~Urval" ;
+ Text [ danish ] = "Udvalg" ;
+ Text [ italian ] = "Scelta" ;
+ Text [ spanish ] = "~Selección" ;
+ Text [ french ] = "~Sélection" ;
+ Text [ dutch ] = "~Selectie" ;
+ Text[ chinese_simplified ] = "Ñ¡Ôñ";
+ Text[ russian ] = "Âûäåëåíèå";
+ Text[ polish ] = "Wybór";
+ Text[ japanese ] = "‘I‘ð‚µ‚½•”•ª";
+ Text[ chinese_traditional ] = "¿ï¾Ü";
+ Text[ arabic ] = "ÇáÊÍÏíÏ";
+ Text[ greek ] = "ÅðéëïãÞ";
+ Text[ korean ] = "¼±ÅÃ";
+ Text[ turkish ] = "Seçim";
+ Text[ language_user1 ] = " ";
+ };
+ Edit EDT_PAGES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 116 ) ;
+ Size = MAP_APPFONT ( 57 , 12 ) ;
+ };
+ GroupBox GRP_COPIES
+ {
+ Pos = MAP_APPFONT ( 129 , 96 ) ;
+ Size = MAP_APPFONT ( 125 , 47 ) ;
+ Text = "Kopien" ;
+ Text [ ENGLISH ] = "Copies" ;
+ Text [ english_us ] = "Copies" ;
+ Text [ portuguese_brazilian ] = "Kopien" ;
+ Text [ swedish ] = "Kopior" ;
+ Text [ danish ] = "Kopier" ;
+ Text [ italian ] = "Copia" ;
+ Text [ spanish ] = "Copias" ;
+ Text [ french ] = "Copies" ;
+ Text [ dutch ] = "Kopieën" ;
+ Text [ portuguese ] = "Cópias" ;
+ Text[ chinese_simplified ] = "·ÝÊý";
+ Text[ russian ] = "Êîïèè";
+ Text[ polish ] = "Kopie";
+ Text[ japanese ] = "ˆóü•””";
+ Text[ chinese_traditional ] = "¥ó¼Æ";
+ Text[ arabic ] = "äÓÎ";
+ Text[ greek ] = "Áíôßãñáöá";
+ Text[ korean ] = "º¹»ç";
+ Text[ turkish ] = "Kopya";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_COPIES
+ {
+ Pos = MAP_APPFONT ( 135 , 106 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ DeltaLang = < Default ; Default ; Default ; Default ; > ;
+ DeltaLang [ ENGLISH ] = < Default ; Default ; 19 ; Default ; > ;
+ Text = "E~xemplare" ;
+ Text [ ENGLISH ] = "Number of ~copies" ;
+ Text [ english_us ] = "Number of copies" ;
+ Text [ portuguese_brazilian ] = "E~xemplare" ;
+ Text [ swedish ] = "E~xemplar" ;
+ Text [ danish ] = "Antal kopier" ;
+ Text [ italian ] = "~Numero di copie" ;
+ Text [ spanish ] = "~Ejemplares" ;
+ Text [ french ] = "E~xemplaire(s)" ;
+ Text [ dutch ] = "E~xemplaren" ;
+ Text [ portuguese ] = "E~xemplares" ;
+ Text[ chinese_simplified ] = "´òÓ¡·ÝÊý";
+ Text[ russian ] = "Ýêçåìïëÿðà(îâ)";
+ Text[ polish ] = "Egzemplarze";
+ Text[ japanese ] = "•””";
+ Text[ chinese_traditional ] = "¦C¦L¥ó¼Æ";
+ Text[ arabic ] = "ÚÏÏ ÇáäÓÎ";
+ Text[ greek ] = "Áíôß~ãñáöá";
+ Text[ korean ] = "º¹»çº» ¼ö";
+ Text[ turkish ] = "~Kopya sayýsý";
+ Text[ language_user1 ] = " ";
+ };
+ NumericField NUM_COPIES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 201 , 105 ) ;
+ Size = MAP_APPFONT ( 39 , 12 ) ;
+ DeltaLang = < Default ; Default ; Default ; Default ; > ;
+ DeltaLang [ ENGLISH ] = < 1 ; Default ; -1 ; Default ; > ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 9999 ;
+ StrictFormat = TRUE ;
+ First = 1 ;
+ Last = 9999 ;
+ };
+ CheckBox CBX_COLLATE
+ {
+ Pos = MAP_APPFONT ( 201 , 123 ) ;
+ Size = MAP_APPFONT ( 47 , 10 ) ;
+ DeltaLang = < Default ; Default ; Default ; Default ; > ;
+ DeltaLang [ ENGLISH ] = < 2 ; Default ; Default ; Default ; > ;
+ Text = "S~ortieren" ;
+ Text [ ENGLISH ] = "C~ollate" ;
+ Text [ english_us ] = "Co~llate" ;
+ Text [ portuguese_brazilian ] = "S~ortieren" ;
+ Text [ swedish ] = "S~ortera" ;
+ Text [ danish ] = "Sorter" ;
+ Text [ italian ] = "~Ordina" ;
+ Text [ spanish ] = "~Ordenar" ;
+ Text [ french ] = "T~rier" ;
+ Text [ dutch ] = "S~orteren" ;
+ Text [ portuguese ] = "~Ordenar" ;
+ Text[ chinese_simplified ] = "ÅÅÐò(~L)";
+ Text[ russian ] = "Ñîðòèðîâàòü";
+ Text[ polish ] = "Sortuj";
+ Text[ japanese ] = "•”’PˆÊ‚ňóü(~L)";
+ Text[ chinese_traditional ] = "±Æ§Ç(~L)";
+ Text[ arabic ] = "ÊÑÊíÈ ÇáäÓÎ";
+ Text[ greek ] = "Ôáîéíüìçóç";
+ Text[ korean ] = "´ëÁ¶(~L)";
+ Text[ turkish ] = "S~ýrala";
+ Text[ language_user1 ] = " ";
+ };
+ FixedImage IMG_COLLATE
+ {
+ Pos = MAP_APPFONT ( 132 , 118 ) ;
+ Size = MAP_APPFONT ( 67 , 22 ) ;
+ Fixed = Image
+ {
+ ImageBitmap = Bitmap { File = "collate.bmp" ; };
+ MaskColor = IMAGE_STDBTN_COLOR ;
+ };
+ Hide = TRUE ;
+ };
+ FixedImage IMG_NOT_COLLATE
+ {
+ Pos = MAP_APPFONT ( 132 , 118 ) ;
+ Size = MAP_APPFONT ( 67 , 22 ) ;
+ Fixed = Image
+ {
+ ImageBitmap = Bitmap { File = "ncollate.bmp" ; };
+ MaskColor = IMAGE_STDBTN_COLOR ;
+ };
+ Hide = TRUE ;
+ };
+ PushButton BTN_OPTIONS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zusätze... : Zusõtze... */
+ /* ### ACHTUNG: Neuer Text in Resource? Zusätze... : Zusõtze... */
+ Text = "~Zusätze..." ;
+ Text [ ENGLISH ] = "Op~tions..." ;
+ Text [ portuguese ] = "Opçõe~s..." ;
+ Text [ english_us ] = "~Options..." ;
+ Text [ portuguese_brazilian ] = "Zusätze..." ;
+ Text [ swedish ] = "F~ler..." ;
+ Text [ danish ] = "Flere..." ;
+ Text [ italian ] = "E~xtra..." ;
+ Text [ spanish ] = "~Opciones..." ;
+ Text [ french ] = "~Options..." ;
+ Text [ dutch ] = "~Overige..." ;
+ Text[ chinese_simplified ] = "ÆäËû(~O)...";
+ Text[ russian ] = "Ïàðàìåòðû...";
+ Text[ polish ] = "Dodatki...";
+ Text[ japanese ] = "µÌß¼®Ý(~O)...";
+ Text[ chinese_traditional ] = "¨ä¥L(~O)...";
+ Text[ arabic ] = "ÎíÇÑÇÊ...";
+ Text[ greek ] = "Ðñüóèåôá...";
+ Text[ korean ] = "¿É¼Ç(~O)...";
+ Text[ turkish ] = "~Seçenekler...";
+ Text[ language_user1 ] = " ";
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 95 , 149 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 148 , 149 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 204 , 149 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ Text[ chinese_simplified ] = "´òÓ¡";
+ Text[ russian ] = "Ïå÷àòü";
+ Text[ polish ] = "Drukuj";
+ Text[ japanese ] = "ˆóü";
+ Text[ chinese_traditional ] = "¦C¦L";
+ Text[ arabic ] = "ØÈÇÚÉ";
+ Text[ greek ] = "Åêôýðùóç";
+ Text[ korean ] = "Àμâ";
+ Text[ turkish ] = "Yazdýr";
+ Text[ language_user1 ] = " ";
+};
diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx
new file mode 100644
index 000000000000..2300821d6613
--- /dev/null
+++ b/svtools/source/dialogs/prnsetup.cxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * $RCSfile: prnsetup.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _VCL_PRINT_HXX
+#include <vcl/print.hxx>
+#endif
+
+#pragma hdrstop
+
+#include <svtdata.hxx>
+#include "prnsetup.hrc"
+#include <prnsetup.hxx>
+
+// =======================================================================
+
+void ImplFillPrnDlgListBox( const Printer* pPrinter,
+ ListBox* pBox, PushButton* pPropBtn )
+{
+ ImplFreePrnDlgListBox( pBox );
+
+ USHORT nCount = Printer::GetQueueCount();
+ if ( nCount )
+ {
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ const QueueInfo& rInfo = Printer::GetQueueInfo( i, FALSE );
+ USHORT nPos = pBox->InsertEntry( rInfo.GetPrinterName() );
+ if ( nPos != LISTBOX_ERROR )
+ pBox->SetEntryData( nPos, new QueueInfo( rInfo ) );
+ }
+
+ pBox->SelectEntry( pPrinter->GetName() );
+ }
+
+ pBox->Enable( nCount != 0 );
+ pPropBtn->Enable( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFreePrnDlgListBox( ListBox* pBox, BOOL bClear )
+{
+ USHORT nEntryCount = pBox->GetEntryCount();
+ for ( USHORT i = 0; i < nEntryCount; i++ )
+ delete (QueueInfo*)pBox->GetEntryData( i );
+
+ if ( bClear )
+ pBox->Clear();
+}
+
+// -----------------------------------------------------------------------
+
+Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn,
+ Printer* pPrinter, Printer* pTempPrinter )
+{
+ if ( pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ const QueueInfo& rInfo = *((QueueInfo*)(pBox->GetEntryData( pBox->GetSelectEntryPos() )));
+
+ if ( !pTempPrinter )
+ {
+ if ( (pPrinter->GetName() == rInfo.GetPrinterName()) &&
+ (pPrinter->GetDriverName() == rInfo.GetDriver()) )
+ pTempPrinter = new Printer( pPrinter->GetJobSetup() );
+ else
+ pTempPrinter = new Printer( rInfo );
+ }
+ else
+ {
+ if ( (pTempPrinter->GetName() != rInfo.GetPrinterName()) ||
+ (pTempPrinter->GetDriverName() != rInfo.GetDriver()) )
+ {
+ delete pTempPrinter;
+ pTempPrinter = new Printer( rInfo );
+ }
+ }
+
+ pPropBtn->Enable( pTempPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
+ }
+ else
+ pPropBtn->Disable();
+
+ return pTempPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinter )
+{
+ XubString aPrnName;
+ if ( pTempPrinter )
+ aPrnName = pTempPrinter->GetName();
+ else
+ aPrnName = pPrinter->GetName();
+
+ BOOL bFound = FALSE;
+ USHORT nCount = Printer::GetQueueCount();
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ if ( aPrnName == Printer::GetQueueInfo( i, FALSE ).GetPrinterName() )
+ {
+ bFound = TRUE;
+ break;
+ }
+ }
+
+ if ( !bFound )
+ {
+ if ( pTempPrinter )
+ delete pTempPrinter;
+ pTempPrinter = new Printer;
+ }
+
+ return pTempPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplPrnDlgUpdateQueueInfo( ListBox* pBox, QueueInfo& rInfo )
+{
+ if ( pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ rInfo = *((QueueInfo*)(pBox->GetEntryData( pBox->GetSelectEntryPos() )));
+
+ USHORT nCount = Printer::GetQueueCount();
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ const QueueInfo& rTempInfo = Printer::GetQueueInfo( i, FALSE );
+ if ( (rInfo.GetPrinterName() == rTempInfo.GetPrinterName()) &&
+ (rInfo.GetDriver() == rTempInfo.GetDriver()) )
+ {
+ rInfo = Printer::GetQueueInfo( i );
+ break;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplPrnDlgAddString( XubString& rStr, const XubString& rAddStr )
+{
+ if ( rStr.Len() )
+ rStr.AppendAscii( "; " );
+ rStr += rAddStr;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplPrnDlgAddResString( XubString& rStr, USHORT nResId )
+{
+ SvtResId aResId( nResId );
+ XubString aAddStr( aResId );
+ ImplPrnDlgAddString( rStr, aAddStr );
+}
+
+// -----------------------------------------------------------------------
+
+XubString ImplPrnDlgGetStatusText( const QueueInfo& rInfo )
+{
+ XubString aStr;
+ ULONG nStatus = rInfo.GetStatus();
+
+ // Default-Printer
+ if ( rInfo.GetPrinterName().Len() &&
+ (rInfo.GetPrinterName() == Printer::GetDefaultPrinterName()) )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_DEFPRINTER );
+
+ // Status
+ if ( nStatus & QUEUE_STATUS_READY )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_READY );
+ if ( nStatus & QUEUE_STATUS_PAUSED )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAUSED );
+ if ( nStatus & QUEUE_STATUS_PENDING_DELETION )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PENDING );
+ if ( nStatus & QUEUE_STATUS_BUSY )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_BUSY );
+ if ( nStatus & QUEUE_STATUS_INITIALIZING )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_INITIALIZING );
+ if ( nStatus & QUEUE_STATUS_WAITING )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_WAITING );
+ if ( nStatus & QUEUE_STATUS_WARMING_UP )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_WARMING_UP );
+ if ( nStatus & QUEUE_STATUS_PROCESSING )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PROCESSING );
+ if ( nStatus & QUEUE_STATUS_PRINTING )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PRINTING );
+ if ( nStatus & QUEUE_STATUS_OFFLINE )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OFFLINE );
+ if ( nStatus & QUEUE_STATUS_ERROR )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_ERROR );
+ if ( nStatus & QUEUE_STATUS_SERVER_UNKNOWN )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_SERVER_UNKNOWN );
+ if ( nStatus & QUEUE_STATUS_PAPER_JAM )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_JAM );
+ if ( nStatus & QUEUE_STATUS_PAPER_OUT )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_OUT );
+ if ( nStatus & QUEUE_STATUS_MANUAL_FEED )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_MANUAL_FEED );
+ if ( nStatus & QUEUE_STATUS_PAPER_PROBLEM )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_PROBLEM );
+ if ( nStatus & QUEUE_STATUS_IO_ACTIVE )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_IO_ACTIVE );
+ if ( nStatus & QUEUE_STATUS_OUTPUT_BIN_FULL )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OUTPUT_BIN_FULL );
+ if ( nStatus & QUEUE_STATUS_TONER_LOW )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_TONER_LOW );
+ if ( nStatus & QUEUE_STATUS_NO_TONER )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_NO_TONER );
+ if ( nStatus & QUEUE_STATUS_PAGE_PUNT )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAGE_PUNT );
+ if ( nStatus & QUEUE_STATUS_USER_INTERVENTION )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_USER_INTERVENTION );
+ if ( nStatus & QUEUE_STATUS_OUT_OF_MEMORY )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OUT_OF_MEMORY );
+ if ( nStatus & QUEUE_STATUS_DOOR_OPEN )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_DOOR_OPEN );
+ if ( nStatus & QUEUE_STATUS_POWER_SAVE )
+ ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_POWER_SAVE );
+
+ // Anzahl Jobs
+ ULONG nJobs = rInfo.GetJobs();
+ if ( nJobs && (nJobs != QUEUE_JOBS_DONTKNOW) )
+ {
+ XubString aJobStr( SvtResId( STR_SVT_PRNDLG_JOBCOUNT ) );
+ XubString aJobs( XubString::CreateFromInt32( nJobs ) );
+ aJobStr.SearchAndReplaceAscii( "%d", aJobs );
+ ImplPrnDlgAddString( aStr, aJobStr );
+ }
+
+ return aStr;
+}
+
+// =======================================================================
+
+PrinterSetupDialog::PrinterSetupDialog( Window* pWindow ) :
+ ModalDialog ( pWindow, SvtResId( DLG_SVT_PRNDLG_PRNSETUPDLG ) ),
+ maGrpPrinter ( this, SvtResId( GRP_PRINTER ) ),
+ maFtName ( this, SvtResId( FT_NAME ) ),
+ maLbName ( this, SvtResId( LB_NAMES ) ),
+ maBtnProperties ( this, SvtResId( BTN_PROPERTIES ) ),
+ maFtStatus ( this, SvtResId( FT_STATUS ) ),
+ maFiStatus ( this, SvtResId( FI_STATUS ) ),
+ maFtType ( this, SvtResId( FT_TYPE ) ),
+ maFiType ( this, SvtResId( FI_TYPE ) ),
+ maFtLocation ( this, SvtResId( FT_LOCATION ) ),
+ maFiLocation ( this, SvtResId( FI_LOCATION ) ),
+ maFtComment ( this, SvtResId( FT_COMMENT ) ),
+ maFiComment ( this, SvtResId( FI_COMMENT ) ),
+ maBtnOK ( this, SvtResId( BTN_OK ) ),
+ maBtnCancel ( this, SvtResId( BTN_CANCEL ) ),
+ maBtnHelp ( this, SvtResId( BTN_HELP ) )
+{
+ FreeResource();
+
+ mpPrinter = NULL;
+ mpTempPrinter = NULL;
+
+ maStatusTimer.SetTimeout( IMPL_PRINTDLG_STATUS_UPDATE );
+ maStatusTimer.SetTimeoutHdl( LINK( this, PrinterSetupDialog, ImplStatusHdl ) );
+ maBtnProperties.SetClickHdl( LINK( this, PrinterSetupDialog, ImplPropertiesHdl ) );
+ maLbName.SetSelectHdl( LINK( this, PrinterSetupDialog, ImplChangePrinterHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+PrinterSetupDialog::~PrinterSetupDialog()
+{
+ ImplFreePrnDlgListBox( &maLbName, FALSE );
+ delete mpTempPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void PrinterSetupDialog::ImplSetInfo()
+{
+ const QueueInfo* pInfo = (QueueInfo*)(maLbName.GetEntryData( maLbName.GetSelectEntryPos() ));
+ if ( pInfo )
+ {
+ maFiType.SetText( pInfo->GetDriver() );
+ maFiLocation.SetText( pInfo->GetLocation() );
+ maFiComment.SetText( pInfo->GetComment() );
+ maFiStatus.SetText( ImplPrnDlgGetStatusText( *pInfo ) );
+ }
+ else
+ {
+ XubString aTempStr;
+ maFiType.SetText( aTempStr );
+ maFiLocation.SetText( aTempStr );
+ maFiComment.SetText( aTempStr );
+ maFiStatus.SetText( aTempStr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrinterSetupDialog, ImplStatusHdl, Timer*, EMPTYARG )
+{
+ QueueInfo aInfo;
+ ImplPrnDlgUpdateQueueInfo( &maLbName, aInfo );
+ maFiStatus.SetText( ImplPrnDlgGetStatusText( aInfo ) );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrinterSetupDialog, ImplPropertiesHdl, void*, EMPTYARG )
+{
+ if ( !mpTempPrinter )
+ mpTempPrinter = new Printer( mpPrinter->GetJobSetup() );
+ mpTempPrinter->Setup();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( PrinterSetupDialog, ImplChangePrinterHdl, void*, EMPTYARG )
+{
+ mpTempPrinter = ImplPrnDlgListBoxSelect( &maLbName, &maBtnProperties,
+ mpPrinter, mpTempPrinter );
+ ImplSetInfo();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long PrinterSetupDialog::Notify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_GETFOCUS) && IsReallyVisible() )
+ ImplStatusHdl( &maStatusTimer );
+
+ return ModalDialog::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void PrinterSetupDialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( rDCEvt.GetType() == DATACHANGED_PRINTER )
+ {
+ mpTempPrinter = ImplPrnDlgUpdatePrinter( mpPrinter, mpTempPrinter );
+ Printer* pPrn;
+ if ( mpTempPrinter )
+ pPrn = mpTempPrinter;
+ else
+ pPrn = mpPrinter;
+ ImplFillPrnDlgListBox( pPrn, &maLbName, &maBtnProperties );
+ ImplSetInfo();
+ }
+
+ ModalDialog::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+short PrinterSetupDialog::Execute()
+{
+ if ( !mpPrinter || mpPrinter->IsPrinting() || mpPrinter->IsJobActive() )
+ {
+ DBG_ERRORFILE( "PrinterSetupDialog::Execute() - No Printer or printer is printing" );
+ return FALSE;
+ }
+
+ ImplFillPrnDlgListBox( mpPrinter, &maLbName, &maBtnProperties );
+ ImplSetInfo();
+ maStatusTimer.Start();
+
+ // Dialog starten
+ short nRet = ModalDialog::Execute();
+
+ // Wenn Dialog mit OK beendet wurde, dann die Daten updaten
+ if ( nRet == TRUE )
+ {
+ if ( mpTempPrinter )
+ mpPrinter->SetPrinterProps( mpTempPrinter );
+ }
+
+ maStatusTimer.Stop();
+
+ return nRet;
+}
diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc
new file mode 100644
index 000000000000..4d5fede29c84
--- /dev/null
+++ b/svtools/source/dialogs/prnsetup.hrc
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: prnsetup.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <svtools.hrc>
+
+#define GRP_PRINTER 1
+#define LB_NAMES 2
+#define BTN_PROPERTIES 3
+#define FT_NAME 4
+#define FT_STATUS 5
+#define FI_STATUS 6
+#define FT_TYPE 7
+#define FI_TYPE 8
+#define FT_LOCATION 9
+#define FI_LOCATION 10
+#define FT_COMMENT 11
+#define FI_COMMENT 12
+
+#define BTN_OK 13
+#define BTN_CANCEL 14
+#define BTN_HELP 15
diff --git a/svtools/source/dialogs/prnsetup.src b/svtools/source/dialogs/prnsetup.src
new file mode 100644
index 000000000000..476d57e085a7
--- /dev/null
+++ b/svtools/source/dialogs/prnsetup.src
@@ -0,0 +1,966 @@
+/*************************************************************************
+ *
+ * $RCSfile: prnsetup.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "prnsetup.hrc"
+
+String STR_SVT_PRNDLG_READY
+{
+ Text = "Bereit" ;
+ Text [ ENGLISH ] = "Ready" ;
+ Text [ portuguese ] = "Pronto" ;
+ Text [ english_us ] = "Ready" ;
+ Text [ portuguese_brazilian ] = "Bereit" ;
+ Text [ swedish ] = "Redo" ;
+ Text [ danish ] = "Klar" ;
+ Text [ italian ] = "Pronto" ;
+ Text [ spanish ] = "Preparado" ;
+ Text [ french ] = "Disponible" ;
+ Text [ dutch ] = "Klaar" ;
+ Text[ chinese_simplified ] = "¾ÍÐ÷";
+ Text[ russian ] = "Ãîòîâ";
+ Text[ polish ] = "Gotowy";
+ Text[ japanese ] = "±²ÄÞØݸޒ†";
+ Text[ chinese_traditional ] = "´Nºü";
+ Text[ arabic ] = "ÌÇåÒÉ";
+ Text[ greek ] = "Óå åôïéìüôçôá";
+ Text[ korean ] = "Áغñ";
+ Text[ turkish ] = "Hazýr";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_PAUSED
+{
+ Text = "Angehalten" ;
+ Text [ ENGLISH ] = "Paused" ;
+ Text [ portuguese ] = "Cancelado" ;
+ Text [ english_us ] = "Paused" ;
+ Text [ portuguese_brazilian ] = "Angehalten" ;
+ Text [ swedish ] = "Stoppad" ;
+ Text [ danish ] = "Stoppet" ;
+ Text [ italian ] = "Pausa" ;
+ Text [ spanish ] = "Detenido" ;
+ Text [ french ] = "Arrêté" ;
+ Text [ dutch ] = "Gestopt" ;
+ Text[ chinese_simplified ] = "ÔÝÍ£";
+ Text[ russian ] = "Îñòàíîâëåí";
+ Text[ polish ] = "Zatrzymane";
+ Text[ japanese ] = "’†’f";
+ Text[ chinese_traditional ] = "¼È°±";
+ Text[ arabic ] = "ãæÞæÝÉ";
+ Text[ greek ] = "ÄéáêïðÞ";
+ Text[ korean ] = "ÀϽÃÁ¤Áö";
+ Text[ turkish ] = "Durduruldu";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_PENDING
+{
+ Text = "Löschen anstehend" ;
+ Text [ ENGLISH ] = "Pending deletion" ;
+ Text [ portuguese ] = "Eliminar pendente" ;
+ Text [ english_us ] = "Pending deletion" ;
+ Text [ portuguese_brazilian ] = "Löschen anstehend" ;
+ Text [ swedish ] = "Radering i vänteläge" ;
+ Text [ danish ] = "Slet igangværende" ;
+ Text [ italian ] = "Cancellazione in attesa" ;
+ Text [ spanish ] = "Eliminación pendiente" ;
+ Text [ french ] = "Suppression imminente" ;
+ Text [ dutch ] = "Wissen verwacht" ;
+ Text[ chinese_simplified ] = "ɾ³ýµÈºòµÄ";
+ Text[ russian ] = "Óäàëåíèå îòëîæåíî";
+ Text[ polish ] = "Oczekiwanie na usuniêcie";
+ Text[ japanese ] = "휂ð‘Ò‚Á‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "§R°£µ¥­Ôªº";
+ Text[ arabic ] = "ÇáÍÐÝ ãÚáÞ";
+ Text[ greek ] = "ÄéáãñáöÞ óôç óõíÝ÷åéá";
+ Text[ korean ] = "´ë±âÁß ÀÛ¾÷ »èÁ¦";
+ Text[ turkish ] = "Silinmek üzere";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_BUSY
+{
+ Text = "Ausgelastet" ;
+ Text [ ENGLISH ] = "Busy" ;
+ Text [ portuguese ] = "Ocupado" ;
+ Text [ english_us ] = "Busy" ;
+ Text [ portuguese_brazilian ] = "Ausgelastet" ;
+ Text [ swedish ] = "Upptaget" ;
+ Text [ danish ] = "Optaget" ;
+ Text [ italian ] = "Sovraccarico" ;
+ Text [ spanish ] = "Ocupado" ;
+ Text [ french ] = "Système occupé" ;
+ Text [ dutch ] = "Bezig" ;
+ Text[ chinese_simplified ] = "æµ";
+ Text[ russian ] = "Â äåéñòâèè";
+ Text[ polish ] = "Zajêty";
+ Text[ japanese ] = "ËÞ¼Þ°ó‘Ô";
+ Text[ chinese_traditional ] = "¦£¸L";
+ Text[ arabic ] = "ãÔÛæáÉ";
+ Text[ greek ] = "Áðáó÷ïëçìÝíïò";
+ Text[ korean ] = "»ç¿ëÁß";
+ Text[ turkish ] = "Meþgul";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_INITIALIZING
+{
+ Text = "Initialisieren" ;
+ Text [ ENGLISH ] = "Initialzing" ;
+ Text [ portuguese ] = "Inicializar" ;
+ Text [ english_us ] = "Initializing" ;
+ Text [ portuguese_brazilian ] = "Initialisieren" ;
+ Text [ swedish ] = "Initierar" ;
+ Text [ danish ] = "Initialiserer" ;
+ Text [ italian ] = "Inizializza" ;
+ Text [ spanish ] = "Inicializar" ;
+ Text [ french ] = "Initialisation" ;
+ Text [ dutch ] = "Initialiseren" ;
+ Text[ chinese_simplified ] = "³õʼ»¯";
+ Text[ russian ] = "Èíèöèàëèçèðîâàòü";
+ Text[ polish ] = "Inicjacja";
+ Text[ japanese ] = "‰Šú‰»";
+ Text[ chinese_traditional ] = "ªì©l¤Æ";
+ Text[ arabic ] = "ÊåíÆÉ";
+ Text[ greek ] = "Áñ÷éêïðïßçóç";
+ Text[ korean ] = "ÃʱâÈ­";
+ Text[ turkish ] = "Baþlat";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_WAITING
+{
+ Text = "Wartend" ;
+ Text [ ENGLISH ] = "Waiting" ;
+ Text [ portuguese ] = "Esperando" ;
+ Text [ english_us ] = "Waiting" ;
+ Text [ portuguese_brazilian ] = "Wartend" ;
+ Text [ swedish ] = "Väntar" ;
+ Text [ danish ] = "Venter" ;
+ Text [ italian ] = "Attesa" ;
+ Text [ spanish ] = "En espera" ;
+ Text [ french ] = "En attente" ;
+ Text [ dutch ] = "Wachtend" ;
+ Text[ chinese_simplified ] = "µÈºò";
+ Text[ russian ] = "Â îæèäàíèè";
+ Text[ polish ] = "Oczekiwanie";
+ Text[ japanese ] = "‘Ò‹@’†";
+ Text[ chinese_traditional ] = "µ¥­Ô";
+ Text[ arabic ] = "ÇäÊÙÇÑ";
+ Text[ greek ] = "ÁíáìïíÞ";
+ Text[ korean ] = "´ë±âÁß";
+ Text[ turkish ] = "Beklemede";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_WARMING_UP
+{
+ Text = "Anlaufen" ;
+ Text [ ENGLISH ] = "Warming up" ;
+ Text [ portuguese ] = "Aquecimento" ;
+ Text [ english_us ] = "Warming up" ;
+ Text [ portuguese_brazilian ] = "Anlaufen" ;
+ Text [ swedish ] = "Startar" ;
+ Text [ danish ] = "Varmer op" ;
+ Text [ italian ] = "In avvio" ;
+ Text [ spanish ] = "Arranque" ;
+ Text [ french ] = "Préchauffage" ;
+ Text [ dutch ] = "Beginnen" ;
+ Text[ chinese_simplified ] = "Ô¤ÈÈ";
+ Text[ russian ] = "Çàïóñê";
+ Text[ polish ] = "Rozgrzewanie";
+ Text[ japanese ] = "€”õ’†";
+ Text[ chinese_traditional ] = "¹w¼ö";
+ Text[ arabic ] = "ÇÓÊÚÏÇÏ";
+ Text[ language_user1 ] = " ";
+ Text[ greek ] = "Ðñïåôïéìáóßá";
+ Text[ korean ] = "ÁغñÁß";
+ Text[ turkish ] = "Isýnýyor";
+};
+String STR_SVT_PRNDLG_PROCESSING
+{
+ Text = "Verarbeiten" ;
+ Text [ ENGLISH ] = "Processing" ;
+ Text [ portuguese ] = "Processamento" ;
+ Text [ english_us ] = "Processing" ;
+ Text [ portuguese_brazilian ] = "Verarbeiten" ;
+ Text [ swedish ] = "Bearbeta" ;
+ Text [ danish ] = "Behandler" ;
+ Text [ italian ] = "Modifica" ;
+ Text [ spanish ] = "Procesar" ;
+ Text [ french ] = "Modifier" ;
+ Text [ dutch ] = "Verwerken" ;
+ Text[ chinese_simplified ] = "´¦Àí";
+ Text[ russian ] = "Îáðàáîòêà";
+ Text[ polish ] = "Opracuj";
+ Text[ japanese ] = "ˆ—";
+ Text[ chinese_traditional ] = "³B²z";
+ Text[ arabic ] = "ãÚÇáÌÉ";
+ Text[ greek ] = "Åðåîåñãáóßá";
+ Text[ korean ] = "ÁøÇàÁß";
+ Text[ turkish ] = "Ýþleniyor";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_PRINTING
+{
+ Text = "Drucken" ;
+ Text [ ENGLISH ] = "Printing" ;
+ Text [ portuguese ] = "Imprimindo" ;
+ Text [ english_us ] = "Printing" ;
+ Text [ portuguese_brazilian ] = "Drucken" ;
+ Text [ swedish ] = "Skriv ut" ;
+ Text [ danish ] = "Udskriv" ;
+ Text [ italian ] = "Stampa" ;
+ Text [ spanish ] = "Imprimir" ;
+ Text [ french ] = "Imprimer" ;
+ Text [ dutch ] = "Printwn" ;
+ Text[ chinese_simplified ] = "´òÓ¡";
+ Text[ russian ] = "Ïå÷àòü";
+ Text[ polish ] = "Drukuj";
+ Text[ japanese ] = "ˆóü";
+ Text[ chinese_traditional ] = "¦C¦L";
+ Text[ arabic ] = "ØÈÇÚÉ";
+ Text[ greek ] = "Åêôýðùóç";
+ Text[ korean ] = "ÀμâÁß";
+ Text[ turkish ] = "Yazdýr";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_OFFLINE
+{
+ Text = "Offline" ;
+ Text [ ENGLISH ] = "Offline" ;
+ Text [ portuguese ] = "Offline" ;
+ Text [ english_us ] = "Offline" ;
+ Text [ portuguese_brazilian ] = "Offline" ;
+ Text [ swedish ] = "Offline" ;
+ Text [ danish ] = "Offline" ;
+ Text [ italian ] = "Offline" ;
+ Text [ spanish ] = "Desconectado" ;
+ Text [ french ] = "Hors ligne" ;
+ Text [ dutch ] = "Offline" ;
+ Text[ chinese_simplified ] = "ÍÑ»ú";
+ Text[ russian ] = "Offline";
+ Text[ polish ] = "Offline";
+ Text[ japanese ] = "µÌײÝ";
+ Text[ chinese_traditional ] = "³s½u";
+ Text[ arabic ] = "ÛíÑ ãÊÕá";
+ Text[ greek ] = "×ùñßò óýíäåóç";
+ Text[ korean ] = "¿ÀÇÁ¶óÀÎ";
+ Text[ turkish ] = "Çevrimdýþý";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_ERROR
+{
+ Text = "Fehler" ;
+ Text [ ENGLISH ] = "Error" ;
+ Text [ portuguese ] = "Erro" ;
+ Text [ english_us ] = "Error" ;
+ Text [ portuguese_brazilian ] = "Fehler" ;
+ Text [ swedish ] = "Fel" ;
+ Text [ danish ] = "Fejl" ;
+ Text [ italian ] = "Errore" ;
+ Text [ spanish ] = "Error" ;
+ Text [ french ] = "Erreur" ;
+ Text [ dutch ] = "Fout" ;
+ Text[ chinese_simplified ] = "´íÎó";
+ Text[ russian ] = "Îøèáêà";
+ Text[ polish ] = "B³¹d";
+ Text[ japanese ] = "´×°";
+ Text[ chinese_traditional ] = "¿ù»~";
+ Text[ arabic ] = "ÎØÃ";
+ Text[ greek ] = "ÓöÜëìá";
+ Text[ korean ] = "¿À·ù";
+ Text[ turkish ] = "Hata";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_SERVER_UNKNOWN
+{
+ Text = "Unbekannter Server" ;
+ Text [ ENGLISH ] = "Unknown Server" ;
+ Text [ portuguese ] = "Servidor desconhecido" ;
+ Text [ english_us ] = "Unknown Server" ;
+ Text [ portuguese_brazilian ] = "Unbekannter Server" ;
+ Text [ swedish ] = "Obekant server" ;
+ Text [ danish ] = "Ukendt server" ;
+ Text [ italian ] = "Server sconosciuto" ;
+ Text [ spanish ] = "Servidor desconocido" ;
+ Text [ french ] = "Serveur inconnu" ;
+ Text [ dutch ] = "Onbekende server" ;
+ Text[ chinese_simplified ] = "²»Ã÷µÄ·þÎñÆ÷";
+ Text[ russian ] = "Íåèçâåñòíûé ñåðâåð";
+ Text[ polish ] = "Nieznany serwer";
+ Text[ japanese ] = "•s–¾‚Ì»°ÊÞ°";
+ Text[ chinese_traditional ] = "¤£©úªº¦øªA¾¹";
+ Text[ arabic ] = "ãÒæøÏ ÛíÑ ãÚÑæÝ";
+ Text[ greek ] = "¢ãíùóôïò äéáêïìéóôÞò";
+ Text[ korean ] = "¾Ë¼ö¾ø´Â ¼­¹ö";
+ Text[ turkish ] = "Bilinmeyen sunucu";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_PAPER_JAM
+{
+ Text = "Papierstau" ;
+ Text [ ENGLISH ] = "Paper jam" ;
+ Text [ portuguese ] = "Engarrafamento de papel" ;
+ Text [ english_us ] = "Paper jam" ;
+ Text [ portuguese_brazilian ] = "Papierstau" ;
+ Text [ swedish ] = "Papperskö" ;
+ Text [ danish ] = "Papirstop" ;
+ Text [ italian ] = "Inceppamento" ;
+ Text [ spanish ] = "Bloqueo de papel" ;
+ Text [ french ] = "Bourrage" ;
+ Text [ dutch ] = "Papieropstopping" ;
+ Text[ chinese_simplified ] = "¿¨Ö½";
+ Text[ russian ] = "Çàåäàíèå áóìàãè";
+ Text[ polish ] = "Papier zablokowany";
+ Text[ japanese ] = "—pŽ†‹l‚Ü‚è";
+ Text[ chinese_traditional ] = "¥d¯È";
+ Text[ arabic ] = "ÊßÏÓ ÇáæÑÞ";
+ Text[ greek ] = "ÌðëïêÜñéóìá ÷áñôéïý";
+ Text[ korean ] = "¿ëÁö °É¸²";
+ Text[ turkish ] = "Kaðýt sýkýþmasý";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_PAPER_OUT
+{
+ Text = "Papiermangel" ;
+ Text [ ENGLISH ] = "Paper out" ;
+ Text [ portuguese ] = "Falta de papel" ;
+ Text [ english_us ] = "Not enough paper" ;
+ Text [ portuguese_brazilian ] = "Papiermangel" ;
+ Text [ swedish ] = "Det saknas papper" ;
+ Text [ danish ] = "Ikke nok papir" ;
+ Text [ italian ] = "Carta esaurita" ;
+ Text [ spanish ] = "Falta de papel" ;
+ Text [ french ] = "Manque de papier" ;
+ Text [ dutch ] = "Geen papier" ;
+ Text[ chinese_simplified ] = "Ö½ÓÃÍê";
+ Text[ russian ] = "Íåõâàòêà áóìàãè";
+ Text[ polish ] = "Brak papieru";
+ Text[ japanese ] = "—pŽ†•s‘«";
+ Text[ chinese_traditional ] = "¯È¥Î§¹";
+ Text[ arabic ] = "äÞÕ Ýí ÇáæÑÞ";
+ Text[ greek ] = "¸ëëåéøç ÷áñôéïý";
+ Text[ korean ] = "¿ëÁö°¡ ºÎÁ·ÇÕ´Ï´Ù.";
+ Text[ turkish ] = "Yeterli miktarda kaðýt yok";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_MANUAL_FEED
+{
+ Text = "Manuelle Papierzufuhr" ;
+ Text [ ENGLISH ] = "Manual feed" ;
+ Text [ portuguese ] = "Alimentação manual" ;
+ Text [ english_us ] = "Manual feed" ;
+ Text [ portuguese_brazilian ] = "Manuelle Papierzufuhr" ;
+ Text [ swedish ] = "Manuell pappersinmatning" ;
+ Text [ danish ] = "Manuel papirfødning" ;
+ Text [ italian ] = "Alimentazione carta manuale" ;
+ Text [ spanish ] = "Alimentación manual" ;
+ Text [ french ] = "Alimentation manuelle" ;
+ Text [ dutch ] = "Handmatige papiertoevoer" ;
+ Text[ chinese_simplified ] = "ÊÖ¹¤ËÍÖ½";
+ Text[ russian ] = "Ðó÷íàÿ ïîäà÷à áóìàãè";
+ Text[ polish ] = "Rêczne podawanie papieru";
+ Text[ japanese ] = "Žè“®‚Å—pŽ†‹Ÿ‹‹";
+ Text[ chinese_traditional ] = "¤â¤u°e¯È";
+ Text[ arabic ] = "ÇáÅãÏÇÏ ÈÇáæÑÞ íÏæíÇð";
+ Text[ greek ] = "×åéñïêßíçôïò åöïäéáóìüò ÷áñôéïý";
+ Text[ korean ] = "¼öµ¿ ±ÞÁö";
+ Text[ turkish ] = "El ile besleme";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_PAPER_PROBLEM
+{
+ Text = "Papierproblem" ;
+ Text [ ENGLISH ] = "Paper problem" ;
+ Text [ portuguese ] = "Problemas com papel" ;
+ Text [ english_us ] = "Paper problem" ;
+ Text [ portuguese_brazilian ] = "Papierproblem" ;
+ Text [ swedish ] = "Pappersproblem" ;
+ Text [ danish ] = "Papirproblem" ;
+ Text [ italian ] = "Errore carta" ;
+ Text [ spanish ] = "Problema de papel" ;
+ Text [ french ] = "Problème d'allimentation de papier" ;
+ Text [ dutch ] = "Papierprobleem" ;
+ Text[ chinese_simplified ] = "Ö½ÕÅÎÊÌâ";
+ Text[ russian ] = "Ïðîáëåìà ñ áóìàãîé";
+ Text[ polish ] = "Problem z papierem";
+ Text[ japanese ] = "—pŽ†‚Ì–â‘è";
+ Text[ chinese_traditional ] = "¯È±i°ÝÃD";
+ Text[ arabic ] = "ãÔßáÉ Ýí ÇáæÑÞ";
+ Text[ greek ] = "Ðñüâëçìá ìå ôï ÷áñôß";
+ Text[ korean ] = "¿ëÁö ¹®Á¦";
+ Text[ turkish ] = "Kaðýt sorunu";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_IO_ACTIVE
+{
+ Text = "E/A aktiv" ;
+ Text [ ENGLISH ] = "I/O active" ;
+ Text [ portuguese ] = "I/O activos" ;
+ Text [ english_us ] = "I/O active" ;
+ Text [ portuguese_brazilian ] = "E/A aktiv" ;
+ Text [ swedish ] = "I/O aktiv" ;
+ Text [ danish ] = "I/O aktiv" ;
+ Text [ italian ] = "I/O attivo" ;
+ Text [ spanish ] = "I/O activos" ;
+ Text [ french ] = "E/S active" ;
+ Text [ dutch ] = "I/O actief" ;
+ Text[ chinese_simplified ] = "¼¤»îÊäÈë/Êä³ö";
+ Text[ russian ] = "Àêòèâíûé Âõîä/Âûõîä";
+ Text[ polish ] = "We/Wy aktywne";
+ Text[ japanese ] = "I/O ±¸Ã¨ÌÞ";
+ Text[ chinese_traditional ] = "¿E¬¡¿é¤J/¿é¥X";
+ Text[ arabic ] = "ÇáÅÏÎÇá/ÇáÅÎÑÇÌ äÔØ";
+ Text[ greek ] = "Åéó/Åî åíåñãÜ";
+ Text[ korean ] = "I/O È°¼º";
+ Text[ turkish ] = "G/Ç aktif";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_OUTPUT_BIN_FULL
+{
+ Text = "Ausgabefach ist voll" ;
+ Text [ ENGLISH ] = "Output bin full" ;
+ Text [ portuguese ] = "Cesto de saída está cheio" ;
+ Text [ english_us ] = "Output bin full" ;
+ Text [ portuguese_brazilian ] = "Ausgabefach ist voll" ;
+ Text [ swedish ] = "Utgångsfacket är fullt" ;
+ Text [ danish ] = "Output-bakken er fyldt" ;
+ Text [ italian ] = "Il vano di uscita è pieno" ;
+ Text [ spanish ] = "La papelera de salida está llena" ;
+ Text [ french ] = "Le bac de sortie est plein" ;
+ Text [ dutch ] = "Postvak UIT is vol" ;
+ Text[ chinese_simplified ] = "Êä³ö»º³åÇøÒçÂú";
+ Text[ russian ] = "Óñòðîéñòâî âûäà÷è çàïîëíåíî";
+ Text[ polish ] = "Zasobnik wyjœciowy zape³niony";
+ Text[ japanese ] = "ˆóü±³ÄÌ߯ėp‚Ì—eŠí‚ª‚¢‚Á‚Ï‚¢‚Å‚·B";
+ Text[ chinese_traditional ] = "¿é¥X½w¨R°Ï·¸º¡";
+ Text[ arabic ] = "ÏÑÌ ÇáÅÎÑÇÌ ããÊáÆ";
+ Text[ greek ] = "Ôï ôìÞìá åîáãùãÞò åßíáé ðëÞñåò";
+ Text[ korean ] = "Ãâ·ÂÇÔÀÌ °¡µæ Âü";
+ Text[ turkish ] = "Çýktý çekmecesi doldu";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_TONER_LOW
+{
+ Text = "Niedriger Tonerstand" ;
+ Text [ ENGLISH ] = "Towner low" ;
+ Text [ portuguese ] = "Pouco toner" ;
+ Text [ english_us ] = "Toner low" ;
+ Text [ portuguese_brazilian ] = "Niedriger Tonerstand" ;
+ Text [ swedish ] = "Lite toner" ;
+ Text [ danish ] = "Næsten ingen toner" ;
+ Text [ italian ] = "Livello del toner basso" ;
+ Text [ spanish ] = "Tóner bajo" ;
+ Text [ french ] = "Remplissez du toner" ;
+ Text [ dutch ] = "Lage tonerstand" ;
+ Text[ chinese_simplified ] = "Ä«·Û²»×ã";
+ Text[ russian ] = "Íèçêîå ñîñòîÿíèå òîíåðà";
+ Text[ polish ] = "Ma³o tonera";
+ Text[ japanese ] = "ÄÅ°‚ÌŽc—Ê‚ª­‚È‚­‚È‚Á‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "¾¥¯»¤£¨¬";
+ Text[ arabic ] = "ÇäÎÝÇÖ ãÓÍæÞ ÇáÍÈÑ";
+ Text[ greek ] = "×áìçëÞ óôÜèìç ôïõ Toner";
+ Text[ korean ] = "Åä³Ê°¡ Àû½À´Ï´Ù.";
+ Text[ turkish ] = "Toner azaldý";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_NO_TONER
+{
+ Text = "Kein Toner" ;
+ Text [ ENGLISH ] = "No toner" ;
+ Text [ portuguese ] = "Sem toner" ;
+ Text [ english_us ] = "No toner" ;
+ Text [ portuguese_brazilian ] = "Kein Toner" ;
+ Text [ swedish ] = "Toner slut" ;
+ Text [ danish ] = "Ingen toner" ;
+ Text [ italian ] = "Manca il toner" ;
+ Text [ spanish ] = "No hay tóner" ;
+ Text [ french ] = "Pas de toner" ;
+ Text [ dutch ] = "Geen toner" ;
+ Text[ chinese_simplified ] = "Ä«·ÛÓÃÍê";
+ Text[ russian ] = "Íåò òîíåðà";
+ Text[ polish ] = "Brak tonera";
+ Text[ japanese ] = "ÄÅ°‚ª‚ ‚è‚Ü‚¹‚ñB";
+ Text[ language_user1 ] = " ";
+ Text[ chinese_traditional ] = "¾¥¯»¥Î§¹";
+ Text[ arabic ] = "áÇ íæÌÏ ãÓÍæÞ ÇáÍÈÑ";
+ Text[ greek ] = "Äåí õðÜñ÷åé Ôoner";
+ Text[ korean ] = "Åä³Ê°¡ ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Toner bitti";
+};
+String STR_SVT_PRNDLG_PAGE_PUNT
+{
+ Text = "Seitenverwurf" ;
+ Text [ ENGLISH ] = "Page punt" ;
+ Text [ portuguese ] = "Eliminar página" ;
+ Text [ english_us ] = "Delete Page" ;
+ Text [ portuguese_brazilian ] = "Seitenverwurf" ;
+ Text [ swedish ] = "Kassera sida" ;
+ Text [ danish ] = "Kasser side" ;
+ Text [ italian ] = "Rigetta pagina" ;
+ Text [ spanish ] = "Eliminar página" ;
+ Text [ french ] = "Suppression de page" ;
+ Text [ dutch ] = "Pagina's uitzonderen" ;
+ Text[ chinese_simplified ] = "ɾ³ýÒ³";
+ Text[ russian ] = "Óäàëåíèå ñòðàíèöû";
+ Text[ polish ] = "Usuñ stronê";
+ Text[ japanese ] = "Íß°¼Þíœ";
+ Text[ chinese_traditional ] = "§R°£­¶";
+ Text[ arabic ] = "ÍÐÝ ÕÝÍÉ";
+ Text[ greek ] = "ÄéáãñáöÞ óåëßäáò";
+ Text[ korean ] = "ÆäÀÌÁö »èÁ¦";
+ Text[ turkish ] = "Sayfayý sil";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_USER_INTERVENTION
+{
+ Text = "Benutzerzugriff notwendig" ;
+ Text [ ENGLISH ] = "User intervention necessary" ;
+ Text [ portuguese ] = "Necessária intervenção do utilizador" ;
+ Text [ english_us ] = "User intervention necessary" ;
+ Text [ portuguese_brazilian ] = "Benutzerzugriff notwendig" ;
+ Text [ swedish ] = "Åtkomst nödvändigt för användaren " ;
+ Text [ danish ] = "Brugerhandling krævet" ;
+ Text [ italian ] = "È necessario l'accesso utente" ;
+ Text [ spanish ] = "Intervención necesaria del usuario " ;
+ Text [ french ] = "Intervention de l'utilisateur requise" ;
+ Text [ dutch ] = "Ingrijpen door gebruiker noodzakelijk" ;
+ Text[ chinese_simplified ] = "ÐèҪʹÓÃÕßÉ趨";
+ Text[ russian ] = "Íåîáõîäèìî âìåøàòåëüñòâî ïîëüçîâàòåëÿ";
+ Text[ polish ] = "Konieczna interwencja u¿ytkownika";
+ Text[ japanese ] = "Õ°»Þ°‚̱¸¾½‚ª•K—v";
+ Text[ chinese_traditional ] = "»Ý­n¦Û­q";
+ Text[ arabic ] = "ãä ÇáÖÑæÑí Ãä íÊÏÎá ÇáãÓÊÎÏã";
+ Text[ greek ] = "ÐáñÝìâáóç ôïõ ÷ñÞóôç áíáãêáßá";
+ Text[ korean ] = "»ç¿ëÀÚ °³ÀÔÀÌ ÇÊ¿äÇÔ";
+ Text[ turkish ] = "Kullanýcý müdahalesi gerekiyor";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_OUT_OF_MEMORY
+{
+ Text = "Nicht genügend Speicher" ;
+ Text [ ENGLISH ] = "Out of memory" ;
+ Text [ portuguese ] = "Memória insuficiente" ;
+ Text [ english_us ] = "Insufficient memory" ;
+ Text [ portuguese_brazilian ] = "Nicht genügend Speicher" ;
+ Text [ swedish ] = "Ej tillräckligt med minne" ;
+ Text [ danish ] = "Ikke nok hukommelse" ;
+ Text [ italian ] = "Non c'è abbastanza memoria" ;
+ Text [ spanish ] = "Memoria insuficiente" ;
+ Text [ french ] = "Mémoire insuffisante" ;
+ Text [ dutch ] = "Niet voldoende opslagruimte" ;
+ Text[ chinese_simplified ] = "ÄÚ´æ²»×ã";
+ Text[ russian ] = "Íåäîñòàòî÷íî ïàìÿòè";
+ Text[ polish ] = "Nie wystarczy pamiêci";
+ Text[ japanese ] = "\\•ª‚ÈÒÓØ‚ª‚ ‚è‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "°O¾ÐÅ餣¨¬";
+ Text[ arabic ] = "ÇáÐÇßÑÉ ÛíÑ ßÇÝíÉ";
+ Text[ greek ] = "Ç ìíÞìç äåí åðáñêåß";
+ Text[ korean ] = "¸Þ¸ð¸®°¡ ºÎÁ·ÇÕ´Ï´Ù.";
+ Text[ turkish ] = "Bellek yeterli deðil";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_DOOR_OPEN
+{
+ Text = "Abdeckung offen" ;
+ Text [ ENGLISH ] = "Door open" ;
+ Text [ portuguese ] = "Capa aberta" ;
+ Text [ english_us ] = "Cover open" ;
+ Text [ portuguese_brazilian ] = "Abdeckung offen" ;
+ Text [ swedish ] = "Luckan är öppen" ;
+ Text [ danish ] = "Låget er åben" ;
+ Text [ italian ] = "Apri copertura" ;
+ Text [ spanish ] = "Abrir cubierta" ;
+ Text [ french ] = "Boîtier ouvert" ;
+ Text [ dutch ] = "Afdekking boven" ;
+ Text[ chinese_simplified ] = "»¤¸Ç³¨¿ª";
+ Text[ russian ] = "Êðûøêà îòêðûòà";
+ Text[ polish ] = "Pokrywa otwarta";
+ Text[ japanese ] = "ÌßØÝÀ°‚ÌŠW‚ªŠJ‚¢‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "Å@»\\´¯¶}";
+ Text[ arabic ] = "ÇáÛØÇÁ ãÝÊæÍ";
+ Text[ greek ] = "ÊÜëõììá áíïé÷ôü";
+ Text[ korean ] = "µ¤°³¸¦ ¿ÀÇ»óÅ·Î";
+ Text[ turkish ] = "Kapak açýk";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_POWER_SAVE
+{
+ Text = "Energiesparmodus" ;
+ Text [ ENGLISH ] = "Power save" ;
+ Text [ portuguese ] = "Modo poupança de energia" ;
+ Text [ english_us ] = "Power save mode" ;
+ Text [ portuguese_brazilian ] = "Energiesparmodus" ;
+ Text [ swedish ] = "Energiesparläge" ;
+ Text [ danish ] = "Energisparende modus" ;
+ Text [ italian ] = "Modo risparmio energetico" ;
+ Text [ spanish ] = "Modo de ahorro energético" ;
+ Text [ french ] = "Mode économie d'énergie" ;
+ Text [ dutch ] = "Energiespaarmodus" ;
+ Text[ chinese_simplified ] = "½ÚÔ¼µçԴģʽ";
+ Text[ russian ] = "Ðåæèì ýêîíîìèè ýëåêòðîýíåðãèè";
+ Text[ polish ] = "Tryb oszczêdzania energii";
+ Text[ japanese ] = "´Èٷްߌ¸Ó°ÄÞ";
+ Text[ chinese_traditional ] = "¸`¬ù¹q·½¼Ò¦¡";
+ Text[ arabic ] = "æÖÚ ÊæÝíÑ ÇáØÇÞÉ";
+ Text[ greek ] = "ÊáôÜóôáóç åîïéêïíüìçóçò åíÝñãåéáò";
+ Text[ korean ] = "Àü¿ø ÀúÀå ¸ðµå";
+ Text[ turkish ] = "Enerji tasarruf kipi";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_DEFPRINTER
+{
+ Text = "Standarddrucker" ;
+ Text [ ENGLISH ] = "Default printer" ;
+ Text [ portuguese ] = "Impressora-padrão" ;
+ Text [ english_us ] = "Default printer" ;
+ Text [ portuguese_brazilian ] = "Standarddrucker" ;
+ Text [ swedish ] = "Standardskrivare" ;
+ Text [ danish ] = "Standardprinter" ;
+ Text [ italian ] = "Stampante predefinta" ;
+ Text [ spanish ] = "Predeterminada" ;
+ Text [ french ] = "Imprimante par défaut" ;
+ Text [ dutch ] = "Standaardprinter" ;
+ Text[ chinese_simplified ] = "ĬÈÏ´òÓ¡»ú";
+ Text[ russian ] = "Ñòàíäàðòíûé ïðèíòåð";
+ Text[ polish ] = "Drukarka domyœlna";
+ Text[ japanese ] = "•W€ÌßØÝÀ";
+ Text[ chinese_traditional ] = "Àq»{¦Lªí¾÷";
+ Text[ arabic ] = "ÇáØÇÈÚÉ ÇáÇÝÊÑÇÖíÉ";
+ Text[ greek ] = "ÐñïåðéëåãìÝíïò åêôõðùôÞò";
+ Text[ korean ] = "±âº» ÇÁ¸°ÅÍ";
+ Text[ turkish ] = "Standart yazýcý";
+ Text[ language_user1 ] = " ";
+};
+String STR_SVT_PRNDLG_JOBCOUNT
+{
+ Text = "%d Dokumente" ;
+ Text [ ENGLISH ] = "%d documents" ;
+ Text [ portuguese ] = "%d documentos" ;
+ Text [ english_us ] = "%d documents" ;
+ Text [ portuguese_brazilian ] = "%d Dokumente" ;
+ Text [ swedish ] = "%d dokument" ;
+ Text [ danish ] = "%d dokumenter" ;
+ Text [ italian ] = "%d documenti" ;
+ Text [ spanish ] = "%d documentos" ;
+ Text [ french ] = "%d documents" ;
+ Text [ dutch ] = "%d documenten" ;
+ Text[ chinese_simplified ] = "%d Îĵµ";
+ Text[ russian ] = "%d äîêóìåíòà(îâ)";
+ Text[ polish ] = "%d dokumenty";
+ Text[ japanese ] = "%d‚ÌÄÞ·­ÒÝÄ";
+ Text[ chinese_traditional ] = "%d ¤å¥ó";
+ Text[ arabic ] = "ãÓÊäÏÇÊ%d ";
+ Text[ greek ] = "%d Ýããñáöá";
+ Text[ korean ] = "%d ¹®¼­";
+ Text[ turkish ] = "%d belge";
+ Text[ language_user1 ] = " ";
+};
+
+ModalDialog DLG_SVT_PRNDLG_PRNSETUPDLG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Size = MAP_APPFONT ( 260 , 104 ) ;
+ Text = "Drucker einrichten" ;
+ Text [ ENGLISH ] = "Printer Setup" ;
+ Text [ english_us ] = "Printer Setup" ;
+ Text [ portuguese_brazilian ] = "Drucker einrichten" ;
+ Text [ swedish ] = "Installera skrivare" ;
+ Text [ danish ] = "Indstil printer" ;
+ Text [ italian ] = "Imposta stampante" ;
+ Text [ spanish ] = "Configurar impresora" ;
+ Text [ french ] = "Imprimante sélectionnée" ;
+ Text [ dutch ] = "Printer instellen" ;
+ Text [ portuguese ] = "Configurar impressora" ;
+ GroupBox GRP_PRINTER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 75 ) ;
+ Text = "Drucker" ;
+ Text [ ENGLISH ] = "Printer" ;
+ Text [ english_us ] = "Printer" ;
+ Text [ portuguese_brazilian ] = "Drucker" ;
+ Text [ swedish ] = "Skrivare" ;
+ Text [ danish ] = "Printer" ;
+ Text [ italian ] = "Stampante" ;
+ Text [ spanish ] = "Impresora" ;
+ Text [ french ] = "Imprimante" ;
+ Text [ dutch ] = "Printer" ;
+ Text [ portuguese ] = "Impressora" ;
+ Text[ chinese_simplified ] = "´òÓ¡»ú";
+ Text[ russian ] = "Ïðèíòåð";
+ Text[ polish ] = "Drukarka";
+ Text[ japanese ] = "ÌßØÝÀ";
+ Text[ chinese_traditional ] = "¦Lªí¾÷";
+ Text[ arabic ] = "ÇáØÇÈÚÉ";
+ Text[ greek ] = "ÅêôõðùôÞò";
+ Text[ korean ] = "ÇÁ¸°ÅÍ";
+ Text[ turkish ] = "Yazýcý";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "~Name" ;
+ Text [ ENGLISH ] = "~Name" ;
+ Text [ english_us ] = "~Name" ;
+ Text [ portuguese_brazilian ] = "~Name" ;
+ Text [ swedish ] = "~Namn" ;
+ Text [ danish ] = "Navn" ;
+ Text [ italian ] = "~Nome" ;
+ Text [ spanish ] = "~Nombre" ;
+ Text [ french ] = "~Nom" ;
+ Text [ dutch ] = "~Naam" ;
+ Text [ portuguese ] = "~Nome" ;
+ Text[ chinese_simplified ] = "Ãû³Æ(~N)";
+ Text[ russian ] = "~Èìÿ";
+ Text[ polish ] = "Nazwa";
+ Text[ japanese ] = "–¼‘O(~N)";
+ Text[ chinese_traditional ] = "¦WºÙ(~N)";
+ Text[ arabic ] = "ÇáÇÓã";
+ Text[ greek ] = "¼íïìá";
+ Text[ korean ] = "À̸§(~N)";
+ Text[ turkish ] = "~Ad";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_NAMES
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 12 ) ;
+ Size = MAP_APPFONT ( 125 , 80 ) ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ PushButton BTN_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( 188 , 12 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text = "~Eigenschaften..." ;
+ Text [ ENGLISH ] = "~Properties..." ;
+ Text [ portuguese ] = "~Propriedades..." ;
+ Text [ english_us ] = "Propert~ies..." ;
+ Text [ portuguese_brazilian ] = "~Eigenschaften..." ;
+ Text [ swedish ] = "~Egenskaper..." ;
+ Text [ danish ] = "Egenskaber..." ;
+ Text [ italian ] = "~Proprietà..." ;
+ Text [ spanish ] = "~Propiedades..." ;
+ Text [ french ] = "~Propriétés..." ;
+ Text [ dutch ] = "~Eigenschappen..." ;
+ Text[ chinese_simplified ] = "ÊôÐÔ(~I)...";
+ Text[ russian ] = "~Ñâîéñòâà...";
+ Text[ polish ] = "W³aœciwoœci...";
+ Text[ japanese ] = "ÌßÛÊßè(~I)...";
+ Text[ chinese_traditional ] = "ÄÝ©Ê(~I)...";
+ Text[ arabic ] = "ÎÕÇÆÕ...";
+ Text[ greek ] = "Éäéüôçôåò...";
+ Text[ korean ] = "µî·ÏÁ¤º¸(~I)...";
+ Text[ turkish ] = "~Özellikler...";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_STATUS
+ {
+ Pos = MAP_APPFONT ( 12 , 29 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Status" ;
+ Text [ ENGLISH ] = "Status" ;
+ Text [ english_us ] = "Status" ;
+ Text [ portuguese_brazilian ] = "Status" ;
+ Text [ swedish ] = "Status" ;
+ Text [ danish ] = "Status" ;
+ Text [ italian ] = "Stato" ;
+ Text [ spanish ] = "Estado" ;
+ Text [ french ] = "État" ;
+ Text [ dutch ] = "Status" ;
+ Text [ portuguese ] = "Estado" ;
+ Text[ chinese_simplified ] = "״̬";
+ Text[ russian ] = "Ñîñòîÿíèå";
+ Text[ polish ] = "Stan";
+ Text[ japanese ] = "½Ã°À½";
+ Text[ chinese_traditional ] = "ª¬ºA";
+ Text[ arabic ] = "ÇáÍÇáÉ";
+ Text[ greek ] = "ÊáôÜóôáóç";
+ Text[ korean ] = "»óÅÂ";
+ Text[ turkish ] = "Durum";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_STATUS
+ {
+ Pos = MAP_APPFONT ( 60 , 29 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Typ" ;
+ Text [ ENGLISH ] = "Type" ;
+ Text [ english_us ] = "Type" ;
+ Text [ portuguese_brazilian ] = "Typ" ;
+ Text [ swedish ] = "Typ" ;
+ Text [ danish ] = "Type" ;
+ Text [ italian ] = "Tipo" ;
+ Text [ spanish ] = "Tipo" ;
+ Text [ french ] = "Type" ;
+ Text [ dutch ] = "Type" ;
+ Text [ portuguese ] = "Tipo" ;
+ Text[ chinese_simplified ] = "ÀàÐÍ";
+ Text[ russian ] = "Òèï";
+ Text[ polish ] = "Typ";
+ Text[ japanese ] = "À²Ìß";
+ Text[ chinese_traditional ] = "Ãþ«¬";
+ Text[ arabic ] = "ÇáäæÚ";
+ Text[ greek ] = "Ôýðïò";
+ Text[ korean ] = "ÇüÅÂ";
+ Text[ turkish ] = "Tip";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_TYPE
+ {
+ Pos = MAP_APPFONT ( 60 , 40 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ FixedText FT_LOCATION
+ {
+ Pos = MAP_APPFONT ( 12 , 51 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Ort" ;
+ Text [ ENGLISH ] = "Location" ;
+ Text [ english_us ] = "Location" ;
+ Text [ portuguese_brazilian ] = "Ort" ;
+ Text [ swedish ] = "Plats" ;
+ Text [ danish ] = "Placering" ;
+ Text [ italian ] = "Percorso" ;
+ Text [ spanish ] = "Ubicación" ;
+ Text [ french ] = "Emplacement" ;
+ Text [ dutch ] = "Plaats" ;
+ Text [ portuguese ] = "Lugar" ;
+ Text[ chinese_simplified ] = "λÖÃ";
+ Text[ russian ] = "Ìåñòî";
+ Text[ polish ] = "Lokalizacja";
+ Text[ japanese ] = "êŠ";
+ Text[ chinese_traditional ] = "¦ì¸m";
+ Text[ arabic ] = "ÇáãæÞÚ";
+ Text[ greek ] = "Ôïðïèåóßá";
+ Text[ korean ] = "À§Ä¡";
+ Text[ turkish ] = "Yer";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_LOCATION
+ {
+ Pos = MAP_APPFONT ( 60 , 51 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ FixedText FT_COMMENT
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Kommentar" ;
+ Text [ ENGLISH ] = "Comment" ;
+ Text [ english_us ] = "Comment" ;
+ Text [ portuguese_brazilian ] = "Kommentar" ;
+ Text [ swedish ] = "Kommentar" ;
+ Text [ danish ] = "Kommentar" ;
+ Text [ italian ] = "Commento" ;
+ Text [ spanish ] = "Comentario" ;
+ Text [ french ] = "Commentaire" ;
+ Text [ dutch ] = "Commentaar" ;
+ Text [ portuguese ] = "Comentário" ;
+ Text[ chinese_simplified ] = "×¢½â";
+ Text[ russian ] = "Êîììåíòàðèé";
+ Text[ polish ] = "Komentarz";
+ Text[ japanese ] = "ºÒÝÄ";
+ Text[ chinese_traditional ] = "ª`¸Ñ";
+ Text[ arabic ] = "ÊÚáíÞ";
+ Text[ greek ] = "Ó÷üëéï";
+ Text[ korean ] = "¸Þ¸ð";
+ Text[ turkish ] = "Açýklama";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_COMMENT
+ {
+ Pos = MAP_APPFONT ( 60 , 62 ) ;
+ Size = MAP_APPFONT ( 188 , 10 ) ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 95 , 84 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 148 , 84 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 204 , 84 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ Text[ chinese_simplified ] = "É趨´òÓ¡»ú";
+ Text[ russian ] = "Óñòàíîâèòü ïðèíòåð";
+ Text[ polish ] = "Ustaw drukarkê";
+ Text[ japanese ] = "ÌßØÝÀÝ’è";
+ Text[ chinese_traditional ] = "³]©w¦Lªí¾÷";
+ Text[ arabic ] = "ÅÚÏÇÏ ÇáØÇÈÚÉ";
+ Text[ language_user1 ] = " ";
+ Text[ greek ] = "ÅãêáôÜóôáóç åêôõðùôÞ";
+ Text[ korean ] = "ÇÁ¸°ÅÍ ¼³Á¤";
+ Text[ turkish ] = "Yazýcý ayarlarý";
+};
diff --git a/svtools/source/dialogs/propctrl.cxx b/svtools/source/dialogs/propctrl.cxx
new file mode 100644
index 000000000000..f2e5959937b1
--- /dev/null
+++ b/svtools/source/dialogs/propctrl.cxx
@@ -0,0 +1,534 @@
+/*************************************************************************
+ *
+ * $RCSfile: propctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _USR_INTROSP_HXX
+#include <usr/inspect.hxx>
+#endif
+#ifndef _USR_SERINFO_HXX
+#include <usr/serinfo.hxx>
+#endif
+#ifndef _USR_INTROSP_HXX
+#include <usr/introsp.hxx>
+#endif
+
+#include <propctrl.hxx>
+#include <property.hxx>
+
+
+// Controller-Implementation
+class PropertyEditorControler_Impl : public SvPropertyDataControl
+{
+ XIntrospectionAccessRef mxUnoAccess;
+ PropertySequence mPropSeq;
+ XPropertyEditorRef mxEditor;
+ SvPropertyBox* mpPropBox;
+ UsrAny maUnoObj;
+
+public:
+ // Provisorisch direkt Window mitgeben
+ PropertyEditorControler_Impl( SvPropertyBox* pPropBox_ );
+ //SimplePropertyEditor_Impl( void );
+
+ // Objekt zum Editieren setzen, dies loest das Eintragen
+ // der Properties in die PropertyBox aus
+ void setObject( XPropertyEditorRef xEditor_, const UsrAny& aToEditObj,
+ /* HACK fuer History-Interface*/String aPath, BOOL bBack=FALSE, BOOL bForward=FALSE );
+
+ /* SPAETER
+ SMART_UNO_DECLARATION(ImplIntrospection,UsrObject);
+
+ // Methoden von XInterface
+ XInterface * queryInterface( Uik aUik );
+ XIdlClassRef getIdlClass();
+ */
+
+ // Methoden von SvPropertyDataControl
+ virtual void Modified( const String& aName,
+ const String& aVal,
+ void* pData);
+
+ virtual void Clicked( const String& aName,
+ const String& aVal,
+ void* pData);
+
+ virtual void Commit( const String& aName,
+ const String& aVal,
+ void* pData);
+
+ virtual void Select( const String& aName,
+ void* pData);
+
+ virtual void LinkClicked(const String& aName,
+ void* pData);
+
+ // TODO: Das muss raus, sehr unglueckliche Schnittstelle
+ // PropertyBox erzwingt Zustand des Controllers
+ virtual String GetTheCorrectProperty() const;
+};
+
+// Methoden von XPropertyEditor
+PropertyEditorControler_Impl::PropertyEditorControler_Impl( SvPropertyBox* pPropBox_ )
+{
+ mpPropBox = pPropBox_;
+}
+
+void PropertyEditorControler_Impl::setObject( XPropertyEditorRef xEditor_, const UsrAny& aToEditObj,
+ /* HACK fuer History-Interface*/ String aPath, BOOL bBack, BOOL bForward )
+{
+ static XIntrospectionRef xIntrospection;
+
+ // Ohne Fenster laeuft gar nix
+ if( !mpPropBox )
+ return;
+
+ // Fenster aufraeumen
+ mpPropBox->ClearAll();
+
+ // Editor und Objekt übernehmen
+ mxEditor = xEditor_;
+ maUnoObj = aToEditObj;
+
+ if( !xIntrospection.is() )
+ {
+ // Introspection-Service holen
+ XServiceManagerRef xServiceManager = getGlobalServiceManager();
+ XServiceProviderRef xProv = xServiceManager->getServiceProvider
+ ( "com.sun.star.beans.Introspection", UikSequence(), UikSequence() );
+ xIntrospection = (XIntrospection *)xProv->newInstance()
+ ->queryInterface( XIntrospection::getSmartUik() );
+ }
+ if( !xIntrospection.is() )
+ return;
+
+ // und unspecten
+ mxUnoAccess = xIntrospection->inspect( maUnoObj );
+ if( !mxUnoAccess.Is() )
+ return;
+
+ // Uns als Controler anmelden
+ mpPropBox->SetController( this );
+
+ // Properties anlegen
+ mPropSeq = mxUnoAccess->getProperties();
+ UINT32 nPropCount = mPropSeq.getLen();
+ const Property* pProps = mPropSeq.getConstArray();
+
+ // 1. Seite anlegen
+ USHORT nPropPageId = mpPropBox->AppendPage("Properties");
+
+ // Beim Eintragen solls nicht flimmern
+ mpPropBox->DisableUpdate();
+
+ // Dummy-Properties fuer Path und Navigation
+ SvPropertyData aProperty;
+ if( aPath.Len() )
+ {
+ // Interface und Structs werden Hyperlinks
+ aProperty.bIsHyperLink = FALSE;
+ aProperty.bIsLocked = TRUE;
+ aProperty.bHasVisibleXButton = FALSE;
+ aProperty.eKind = KOC_EDIT;
+ aProperty.pControl = NULL;
+ aProperty.pDataPtr = NULL;
+ aProperty.aName = "Path";
+ aProperty.aValue = aPath;
+ mpPropBox->InsertEntry( aProperty );
+ }
+ if( bBack || bForward )
+ {
+ // Interface und Structs werden Hyperlinks
+ aProperty.bIsHyperLink = TRUE;
+ aProperty.bIsLocked = TRUE;
+ // HACK, solange Hyperlink nicht funktioniert
+ aProperty.bHasVisibleXButton = aProperty.bIsHyperLink;
+ aProperty.eKind = KOC_EDIT;
+ UINT32 iHandle;
+ aProperty.pControl = NULL;
+ if( bBack )
+ {
+ iHandle = 1000001;
+ aProperty.pDataPtr = (void*)iHandle;
+ aProperty.aName = "<-";
+ aProperty.aValue = "Back";
+ mpPropBox->InsertEntry( aProperty );
+ }
+ if( bForward )
+ {
+ iHandle = 1000000;
+ aProperty.pDataPtr = (void*)iHandle;
+ aProperty.aName = "->";
+ aProperty.aValue = "Forward";
+ mpPropBox->InsertEntry( aProperty );
+ }
+ }
+
+ // Properties eintragen
+ // TODO: Wo kommen die Strings her
+ UINT32 i;
+ for( i = 0 ; i < nPropCount ; i++ )
+ {
+ const Property& rProp = pProps[ i ];
+
+ // TypeClass des Property ermitteln
+ XIdlClassRef xPropClass = rProp.Type;
+ if( !xPropClass.is() )
+ {
+ DBG_ERROR( "PropertyEditorControler_Impl::Commit(), Property without type" )
+ return;
+ }
+ TypeClass eType = xPropClass->getTypeClass();
+
+ // Interface und Structs werden Hyperlinks
+ aProperty.bIsHyperLink = ( eType == TYPECLASS_INTERFACE || eType == TYPECLASS_STRUCT );
+ aProperty.bIsLocked = ((rProp.Attributes & PROPERTY_READONLY) != 0 );
+
+ // HACK, solange Hyperlink nicht funktioniert
+ aProperty.bHasVisibleXButton = aProperty.bIsHyperLink;
+
+ // Wert holen und in String wandeln
+ UsrAny aVal = mxUnoAccess->getPropertyValueByIndex( maUnoObj, i );
+ String aStrVal = AnyToString( aVal );
+
+ // Properties reinbraten
+ aProperty.eKind = KOC_EDIT;
+ aProperty.aName = rProp.Name;
+ aProperty.aValue = aStrVal;
+ aProperty.pDataPtr = (void*)i;
+ aProperty.pControl = NULL;
+ //aProperty.theValues.Insert(new String("1"),aProperty.theValues.Count());
+ //aProperty.theValues.Insert(new String("2"),aProperty.theValues.Count());
+ //aProperty.theValues.Insert(new String("3"),aProperty.theValues.Count());
+ //aProperty.theValues.Insert(new String("4"),aProperty.theValues.Count());
+ mpPropBox->InsertEntry( aProperty );
+ }
+
+ // 2. Seite fuer Listener
+ // TODO: Wo kommen die Eintraege her
+ USHORT nListenerPageId = mpPropBox->AppendPage("Listener");
+
+ XIdlClassSequence aSupportedListenerSeq = mxUnoAccess->getSupportedListeners();
+ const XIdlClassRef* pListenerArray = aSupportedListenerSeq.getConstArray();
+ UINT32 nIfaceCount = aSupportedListenerSeq.getLen();
+
+ // Property-Data vorfuellen
+ aProperty.eKind = KOC_EDIT;
+ //aProperty.eKind = KOC_UNDEFINED;
+ aProperty.aValue = "Listener-Value";
+ aProperty.bHasVisibleXButton = TRUE;
+ // TEST
+ //aProperty.bIsHyperLink = TRUE;
+ aProperty.bIsHyperLink = FALSE;
+ aProperty.bIsLocked = TRUE;
+ //aProperty.bIsLocked = FALSE;
+ aProperty.pDataPtr = NULL;
+ aProperty.pControl = NULL;
+
+ for( UINT32 j = 0 ; j < nIfaceCount ; j++ )
+ {
+ const XIdlClassRef& rxIfaceClass = pListenerArray[j];
+ aProperty.aName = rxIfaceClass->getName();
+ mpPropBox->InsertEntry( aProperty );
+ }
+ mpPropBox->EnableUpdate();
+ mpPropBox->SetPage( nPropPageId );
+}
+
+void PropertyEditorControler_Impl::Modified
+( const String& aName, const String& aVal, void* pData)
+{
+}
+
+void PropertyEditorControler_Impl::Clicked
+( const String& aName, const String& aVal, void* pData)
+{
+ // HACK, solange LinkClicked nicht funktioniert
+ UINT32 iPos = (UINT32)pData;
+ UINT32 nPropCount = mPropSeq.getLen();
+ if( iPos >= nPropCount )
+ {
+ // Spezial-IDs fuer forward/back?
+ BOOL bForward = (iPos == 1000000);
+ BOOL bBack = (iPos == 1000001);
+ if( bForward || bBack )
+ {
+ // Unterstuetzt der PropertyEditor das?
+ XPropertyEditorNavigationRef xPropEdNav = (XPropertyEditorNavigation*)
+ mxEditor->queryInterface( XPropertyEditorNavigation::getSmartUik() );
+ if( xPropEdNav.is() )
+ {
+ if( bForward )
+ xPropEdNav->forward();
+ else
+ xPropEdNav->back();
+ }
+ }
+ return;
+ }
+
+ const Property* pProps = mPropSeq.getConstArray();
+ const Property& rProp = pProps[ iPos ];
+ XIdlClassRef xPropClass = rProp.Type;
+ if( !xPropClass.is() )
+ {
+ DBG_ERROR( "PropertyEditorControler_Impl::Commit(), Property without type" )
+ return;
+ }
+ TypeClass eType = xPropClass->getTypeClass();
+ if( eType == TYPECLASS_INTERFACE || eType == TYPECLASS_STRUCT )
+ LinkClicked( aName, pData );
+}
+
+void PropertyEditorControler_Impl::Commit
+( const String& aName, const String& aVal, void* pData)
+{
+ UINT32 iPos = (UINT32)pData;
+ UINT32 nPropCount = mPropSeq.getLen();
+ if( iPos >= nPropCount )
+ return;
+
+ // String in Property-Typ wandeln
+ const Property* pProps = mPropSeq.getConstArray();
+ const Property& rProp = pProps[ iPos ];
+ XIdlClassRef xPropClass = rProp.Type;
+ if( !xPropClass.is() )
+ {
+ DBG_ERROR( "PropertyEditorControler_Impl::Commit(), Property without type" )
+ return;
+ }
+ TypeClass eType = xPropClass->getTypeClass();
+ UsrAny aValue = StringToAny( aVal, eType );
+
+ // Wert setzen
+ mxUnoAccess->setPropertyValueByIndex( maUnoObj, iPos, aValue );
+
+ // Wert neu holen und ggf. neu setzen
+ UsrAny aNewVal = mxUnoAccess->getPropertyValueByIndex( maUnoObj, iPos );
+ String aNewStrVal = AnyToString( aNewVal );
+ if( aNewStrVal != aVal )
+ mpPropBox->SetPropertyValue( aName, aNewStrVal );
+}
+
+void PropertyEditorControler_Impl::Select
+( const String& aName, void* pData)
+{
+}
+
+void PropertyEditorControler_Impl::LinkClicked(const String& aName, void* pData)
+{
+ UINT32 iPos = (UINT32)pData;
+ UINT32 nPropCount = mPropSeq.getLen();
+ if( iPos >= nPropCount )
+ return;
+
+ // Wert holen und an Master-Controller zurueckgeben
+ UsrAny aNewObj = mxUnoAccess->getPropertyValueByIndex( maUnoObj, iPos );
+ mxEditor->setObject( aNewObj, aName );
+}
+
+
+// TODO: Das muss raus, sehr unglueckliche Schnittstelle
+// PropertyBox erzwingt Zustand des Controllers
+String PropertyEditorControler_Impl::GetTheCorrectProperty() const
+{
+ return String();
+}
+
+
+SMART_UNO_IMPLEMENTATION(SimplePropertyEditor_Impl,UsrObject);
+
+// Methoden von XInterface
+XInterface * SimplePropertyEditor_Impl::queryInterface( Uik aUik )
+{
+ if( aUik == XPropertyEditor::getSmartUik() )
+ return (XPropertyEditor *)this;
+ if( aUik == XPropertyEditorNavigation::getSmartUik() )
+ return (XPropertyEditorNavigation *)this;
+ return UsrObject::queryInterface( aUik );
+}
+
+XIdlClassRef SimplePropertyEditor_Impl::getIdlClass()
+{
+ // TODO: Unterstuetzen
+ return NULL;
+}
+
+
+// Methoden von SimplePropertyEditor_Impl
+SimplePropertyEditor_Impl::SimplePropertyEditor_Impl( Window *pParent )
+ : maHistorySeq( 10 ), maHistoryNames( 10 ), bSimpleHistory( FALSE )
+{
+ //XVCLComponent xC = pParent->getVCLComponent
+ //xC->addVCLComponentListener( MyListener )
+
+ pActiveControler = NULL;
+ mpPropBox = new SvPropertyBox( pParent );
+ mpPropBox->Show();
+
+ long cxOut = pParent->GetOutputSizePixel().Width();
+ long cyOut = pParent->GetOutputSizePixel().Height();
+ Size aSize( cxOut, cyOut );
+ mpPropBox->SetPosSizePixel( Point( 0, 0 ), aSize );
+
+ mnHistoryCount = 0;
+ mnActualHistoryLevel = -1;
+}
+
+SimplePropertyEditor_Impl::~SimplePropertyEditor_Impl()
+{
+ delete mpPropBox;
+ if( pActiveControler )
+ delete pActiveControler;
+}
+
+// Private Methode zum Anlegen/Aktivieren der Controller
+void SimplePropertyEditor_Impl::showObject( const UsrAny& aToShowObj )
+{
+ if( pActiveControler )
+ delete pActiveControler;
+
+ // Neuen Controller auf der Wiese anlegen (TODO: Controller cachen?)
+ pActiveControler = new PropertyEditorControler_Impl( mpPropBox );
+
+ XPropertyEditorRef xThis = (XPropertyEditor *)this;
+ pActiveControler->setObject( xThis, aToShowObj,
+ /*aPath*/bSimpleHistory ? getPath() : String(),
+ /*bBack*/bSimpleHistory && mnActualHistoryLevel > 0,
+ /*bForward*/bSimpleHistory && (INT32)mnHistoryCount > mnActualHistoryLevel );
+}
+
+String SimplePropertyEditor_Impl::getPath( void )
+{
+ String aRetStr;
+ const String* pStr = maHistoryNames.getConstArray();
+ for( INT32 i = 0 ; i <= mnActualHistoryLevel ; i++ )
+ {
+ String aName = pStr[i];
+
+ // Root speziell behandeln
+ if( i == 0 )
+ {
+ aRetStr += aName;
+ }
+ else
+ {
+ // Ist es ein Index?
+ long l = (long)aName;
+ String aNumStr( l );
+ if( aNumStr == aName )
+ {
+ aRetStr += '[';
+ aRetStr += aName;
+ aRetStr += ']';
+ }
+ else
+ {
+ aRetStr += '.';
+ aRetStr += aName;
+ }
+ }
+ }
+ return aRetStr;
+}
+
+// Methoden von XPropertyEditor
+void SimplePropertyEditor_Impl::setObject( const UsrAny& aToEditObj, const XubString& aObjName )
+{
+ // History pflegen
+ mnActualHistoryLevel++;
+ mnHistoryCount = (UINT32)mnActualHistoryLevel;
+ UINT32 iHistorySize = maHistorySeq.getLen();
+ if( mnHistoryCount > iHistorySize )
+ {
+ maHistorySeq.realloc( iHistorySize + 10 );
+ maHistoryNames.realloc( iHistorySize + 10 );
+ }
+
+ // Neues Object eintragen
+ maHistorySeq.getArray()[ mnHistoryCount ] = aToEditObj;
+ maHistoryNames.getArray()[ mnHistoryCount ] = aObjName;
+
+ // Object anzeigen
+ showObject( aToEditObj );
+}
+
+// Methoden von PropertyEditorNavigation
+void SimplePropertyEditor_Impl::forward(void)
+{
+ if( (INT32)mnHistoryCount > mnActualHistoryLevel )
+ {
+ // Naechstes Object darstellen
+ mnActualHistoryLevel++;
+ showObject( maHistorySeq.getConstArray()[mnActualHistoryLevel] );
+ }
+}
+
+void SimplePropertyEditor_Impl::back(void)
+{
+ if( mnActualHistoryLevel > 0 )
+ {
+ // Voriges Object darstellen
+ mnActualHistoryLevel--;
+ showObject( maHistorySeq.getConstArray()[mnActualHistoryLevel] );
+ }
+}
+
+
diff --git a/svtools/source/dialogs/property.cxx b/svtools/source/dialogs/property.cxx
new file mode 100644
index 000000000000..5c0ce590c08c
--- /dev/null
+++ b/svtools/source/dialogs/property.cxx
@@ -0,0 +1,1582 @@
+/*************************************************************************
+ *
+ * $RCSfile: property.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PCH
+#include "ui_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+//------------------------------------------------------------------
+
+//#include "Svitems.hxx"
+
+#include "property.hxx"
+/*
+#include "property.hrc"
+#include "Scresid.hxx"
+*/
+#define FRAME_OFFSET 4
+
+
+SvXPropertyControl::SvXPropertyControl( Window* pParent, WinBits nWinStyle)
+ : Control(pParent,nWinStyle)
+{
+}
+
+SvXPropertyControl::SvXPropertyControl( Window* pParent, const ResId& rResId )
+ : Control(pParent,rResId )
+{
+}
+
+//------------------------------------------------------------------
+
+SvXPropertyEdit::SvXPropertyEdit( Window* pParent, WinBits nWinStyle)
+ : SvXPropertyControl(pParent,nWinStyle),
+ aEdit(this,WB_BORDER | WB_TABSTOP)
+{
+ pListener=NULL;
+ aEdit.SetModifyHdl(
+ LINK( this, SvXPropertyEdit, ModifiedHdl ));
+ aEdit.SetGetFocusHdl(
+ LINK( this, SvXPropertyEdit, GetFocusHdl));
+ aEdit.SetLoseFocusHdl(
+ LINK( this, SvXPropertyEdit, LoseFocusHdl));
+
+ aEdit.Show();
+}
+
+SvXPropertyEdit::SvXPropertyEdit( Window* pParent, const ResId& rResId)
+ : SvXPropertyControl(pParent,rResId),
+ aEdit(this,WB_BORDER | WB_TABSTOP)
+{
+ pListener=NULL;
+ aEdit.SetModifyHdl(
+ LINK( this, SvXPropertyEdit, ModifiedHdl ));
+ aEdit.SetGetFocusHdl(
+ LINK( this, SvXPropertyEdit, GetFocusHdl));
+ aEdit.SetLoseFocusHdl(
+ LINK( this, SvXPropertyEdit, LoseFocusHdl));
+
+ Size aSize=GetSizePixel();
+ SetCtrSize(aSize);
+ aEdit.Show();
+}
+
+void SvXPropertyEdit::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener)
+{
+ pListener=pCtrListener;
+}
+
+SvXPropertyCtrListener* SvXPropertyEdit::GetSvXPropertyCtrListener()
+{
+ return pListener;
+}
+
+
+void SvXPropertyEdit::SetCtrSize(const Size& rSize)
+{
+ SetSizePixel(rSize);
+ Size aSize=GetOutputSizePixel();
+ Point aPos(0,0);
+ aEdit.SetPosPixel(aPos);
+ aEdit.SetSizePixel(aSize);
+}
+
+void SvXPropertyEdit::SetLocked(BOOL bLocked)
+{
+ if(bLocked)
+ Disable();
+ else
+ Enable();
+}
+
+void SvXPropertyEdit::SetProperty(const String &rString)
+{
+ aEdit.SetText(rString);
+}
+
+String SvXPropertyEdit::GetProperty() const
+{
+ return aEdit.GetText();
+}
+
+BOOL SvXPropertyEdit::HasList()
+{
+ return FALSE;
+};
+
+
+void SvXPropertyEdit::ClearList()
+{
+ return;
+}
+void SvXPropertyEdit::InsertEntry( const String& rString,USHORT nPos)
+{
+ return;
+}
+
+void SvXPropertyEdit::SetMyName(const String &rString)
+{
+ aName=rString;
+}
+
+String SvXPropertyEdit::GetMyName()const
+{
+ return aName;
+}
+
+void SvXPropertyEdit::SetMyData(void* pDat)
+{
+ pData=pDat;
+}
+
+void* SvXPropertyEdit::GetMyData()
+{
+ return pData;
+}
+
+
+IMPL_LINK( SvXPropertyEdit, ModifiedHdl, Edit*, pEd )
+{
+ if(pListener!=NULL)
+ pListener->Modified(this);
+ return 0;
+}
+
+IMPL_LINK( SvXPropertyEdit, GetFocusHdl, Edit*, pEd )
+{
+ if(pListener!=NULL)
+ pListener->GetFocus(this);
+ return 0;
+}
+
+IMPL_LINK( SvXPropertyEdit, LoseFocusHdl, Edit*, pEd )
+{
+ if(pListener!=NULL)
+ pListener->LoseFocus(this);
+ return 0;
+}
+
+//------------------------------------------------------------------
+
+SvXPropertyListBox::SvXPropertyListBox( Window* pParent, WinBits nWinStyle)
+ : SvXPropertyControl(pParent,nWinStyle),
+ aListBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
+{
+ pListener=NULL;
+ aListBox.SetSelectHdl(
+ LINK( this, SvXPropertyListBox, ModifiedHdl ));
+ aListBox.SetGetFocusHdl(
+ LINK( this, SvXPropertyListBox, GetFocusHdl));
+ aListBox.SetLoseFocusHdl(
+ LINK( this, SvXPropertyListBox, LoseFocusHdl));
+ aListBox.Show();
+}
+
+SvXPropertyListBox::SvXPropertyListBox( Window* pParent, const ResId& rResId)
+ : SvXPropertyControl(pParent,rResId),
+ aListBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
+{
+ pListener=NULL;
+ aListBox.SetSelectHdl(
+ LINK( this, SvXPropertyListBox, ModifiedHdl ));
+ aListBox.SetGetFocusHdl(
+ LINK( this, SvXPropertyListBox, GetFocusHdl));
+ aListBox.SetLoseFocusHdl(
+ LINK( this, SvXPropertyListBox, LoseFocusHdl));
+
+ Size aSize=GetSizePixel();
+ SetCtrSize(aSize);
+ aListBox.Show();
+}
+
+void SvXPropertyListBox::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener)
+{
+ pListener=pCtrListener;
+}
+
+SvXPropertyCtrListener* SvXPropertyListBox::GetSvXPropertyCtrListener()
+{
+ return pListener;
+}
+
+
+void SvXPropertyListBox::SetCtrSize(const Size& rSize)
+{
+ SetSizePixel(rSize);
+ Size aSize=GetOutputSizePixel();
+ Point aPos(0,0);
+ aListBox.SetPosPixel(aPos);
+ aListBox.SetSizePixel(aSize);
+}
+
+void SvXPropertyListBox::SetLocked(BOOL bLocked)
+{
+ if(bLocked)
+ Disable();
+ else
+ Enable();
+}
+
+void SvXPropertyListBox::SetProperty(const String &rString)
+{
+ aListBox.SelectEntry(rString);
+}
+
+String SvXPropertyListBox::GetProperty()const
+{
+ return aListBox.GetSelectEntry();
+}
+
+BOOL SvXPropertyListBox::HasList()
+{
+ return TRUE;
+}
+
+
+void SvXPropertyListBox::ClearList()
+{
+ aListBox.Clear();
+}
+
+void SvXPropertyListBox::InsertEntry( const String& rString,USHORT nPos)
+{
+ aListBox.InsertEntry(rString,nPos);
+}
+
+void SvXPropertyListBox::SetMyName(const String &rString)
+{
+ aName=rString;
+}
+
+String SvXPropertyListBox::GetMyName()const
+{
+ return aName;
+}
+
+void SvXPropertyListBox::SetMyData(void* pDat)
+{
+ pData=pDat;
+}
+
+void* SvXPropertyListBox::GetMyData()
+{
+ return pData;
+}
+
+IMPL_LINK( SvXPropertyListBox, ModifiedHdl, ListBox*, pLB )
+{
+ if(pListener!=NULL)
+ pListener->Modified(this);
+ return 0;
+}
+
+IMPL_LINK( SvXPropertyListBox, GetFocusHdl, ListBox*, pLB )
+{
+ if(pListener!=NULL)
+ pListener->GetFocus(this);
+ return 0;
+}
+
+IMPL_LINK( SvXPropertyListBox, LoseFocusHdl, ListBox*, pLB )
+{
+ if(pListener!=NULL)
+ pListener->LoseFocus(this);
+ return 0;
+}
+
+//------------------------------------------------------------------
+
+
+SvXPropertyComboBox::SvXPropertyComboBox( Window* pParent, WinBits nWinStyle)
+ : SvXPropertyControl(pParent,nWinStyle),
+ aComboBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
+{
+ pListener=NULL;
+ aComboBox.SetModifyHdl(
+ LINK( this, SvXPropertyComboBox, ModifiedHdl ));
+ aComboBox.SetGetFocusHdl(
+ LINK( this, SvXPropertyComboBox, GetFocusHdl));
+ aComboBox.SetLoseFocusHdl(
+ LINK( this, SvXPropertyComboBox, LoseFocusHdl));
+ aComboBox.Show();
+}
+
+SvXPropertyComboBox::SvXPropertyComboBox( Window* pParent, const ResId& rResId)
+ : SvXPropertyControl(pParent,rResId),
+ aComboBox(this,WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
+{
+ pListener=NULL;
+ aComboBox.SetModifyHdl(
+ LINK( this, SvXPropertyComboBox, ModifiedHdl ));
+ aComboBox.SetGetFocusHdl(
+ LINK( this, SvXPropertyComboBox, GetFocusHdl));
+ aComboBox.SetLoseFocusHdl(
+ LINK( this, SvXPropertyComboBox, LoseFocusHdl));
+
+ Size aSize=GetSizePixel();
+ SetCtrSize(aSize);
+ aComboBox.Show();
+}
+
+void SvXPropertyComboBox::SetLocked(BOOL bLocked)
+{
+ if(bLocked)
+ Disable();
+ else
+ Enable();
+}
+
+void SvXPropertyComboBox::SetSvXPropertyCtrListener(SvXPropertyCtrListener* pCtrListener)
+{
+ pListener=pCtrListener;
+}
+
+SvXPropertyCtrListener* SvXPropertyComboBox::GetSvXPropertyCtrListener()
+{
+ return pListener;
+}
+
+
+void SvXPropertyComboBox::SetCtrSize(const Size& rSize)
+{
+ SetSizePixel(rSize);
+ Size aSize=GetOutputSizePixel();
+ Point aPos(0,0);
+ aComboBox.SetPosPixel(aPos);
+ aComboBox.SetSizePixel(aSize);
+}
+
+
+void SvXPropertyComboBox::SetProperty(const String &rString)
+{
+ aComboBox.SetText(rString);
+}
+
+String SvXPropertyComboBox::GetProperty() const
+{
+ return aComboBox.GetText();
+}
+
+BOOL SvXPropertyComboBox::HasList()
+{
+ return TRUE;
+}
+
+void SvXPropertyComboBox::ClearList()
+{
+ aComboBox.Clear();
+}
+
+void SvXPropertyComboBox::InsertEntry( const String& rString,USHORT nPos)
+{
+ aComboBox.InsertEntry(rString,nPos);
+}
+
+void SvXPropertyComboBox::SetMyName(const String &rString)
+{
+ aName=rString;
+}
+
+String SvXPropertyComboBox::GetMyName()const
+{
+ return aName;
+}
+
+void SvXPropertyComboBox::SetMyData(void* pDat)
+{
+ pData=pDat;
+}
+
+void* SvXPropertyComboBox::GetMyData()
+{
+ return pData;
+}
+
+IMPL_LINK( SvXPropertyComboBox, ModifiedHdl, ComboBox*, pCB )
+{
+ if(pListener!=NULL)
+ pListener->Modified(this);
+ return 0;
+}
+
+IMPL_LINK( SvXPropertyComboBox, GetFocusHdl, ComboBox*, pCB )
+{
+ if(pListener!=NULL)
+ pListener->GetFocus(this);
+ return 0;
+}
+
+IMPL_LINK( SvXPropertyComboBox, LoseFocusHdl, ComboBox*, pCB )
+{
+ if(pListener!=NULL)
+ pListener->LoseFocus(this);
+ return 0;
+}
+//------------------------------------------------------------------
+
+SvPropertyLine::SvPropertyLine( Window* pParent,WinBits nWinStyle)
+ : Control(pParent,nWinStyle),
+ aName(this,WB_BORDER),
+ aXButton(this,WB_BORDER),
+ pSvXPropertyControl(NULL),
+ bIsLocked(FALSE),
+ bIsHyperlink(FALSE)
+{
+ bNeedsRepaint = TRUE;
+ bHasXButton = FALSE;
+ aXButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "..." ) ) );
+ aName.Show();
+ aXButton.Show();
+ eKindOfCtr = KOC_UNDEFINED;
+ Wallpaper aWall = GetBackground();
+ aWall.SetColor( Color( COL_TRANSPARENT ) );
+ SetBackground( aWall );
+}
+
+SvPropertyLine::SvPropertyLine( Window* pParent,const ResId& rResId )
+ : Control(pParent,rResId),
+ aName (this,WB_BORDER),
+ aXButton (this,WB_BORDER),
+ pSvXPropertyControl(NULL),
+ bIsLocked(FALSE),
+ bIsHyperlink(FALSE)
+{
+ bNeedsRepaint = TRUE;
+ bHasXButton = FALSE;
+ eKindOfCtr = KOC_UNDEFINED;
+ aXButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "..." ) ) );
+ aName.Show();
+ aXButton.Show();
+ Wallpaper aWall = GetBackground();
+ aWall.SetColor( Color( COL_TRANSPARENT ) );
+ SetBackground( aWall );
+ Resize();
+}
+
+void SvPropertyLine::SetSvXPropertyControl(SvXPropertyControl* pXControl)
+{
+ pSvXPropertyControl=pXControl;
+ pSvXPropertyControl->Show();
+ Resize();
+}
+
+SvXPropertyControl* SvPropertyLine::GetSvXPropertyControl()
+{
+ return pSvXPropertyControl;
+}
+
+void SvPropertyLine::Resize()
+{
+ Size aSize=GetOutputSizePixel();
+ Size a2Size=aSize;
+
+ aSize.Width()=nNameWidth;
+ a2Size.Width()-=nNameWidth;
+
+ Point aPos(0,0);
+ aName.SetPosPixel(aPos);
+ aName.SetSizePixel(aSize);
+
+ USHORT nXButtonWidth=0;
+
+ if(bHasXButton)
+ {
+ nXButtonWidth=(USHORT)aSize.Height();
+ }
+ a2Size.Width()=a2Size.Width()-nXButtonWidth;
+
+ aPos.X()+=aSize.Width();
+
+ if(pSvXPropertyControl!=NULL)
+ {
+ pSvXPropertyControl->SetPosPixel(aPos);
+ pSvXPropertyControl->SetCtrSize(a2Size);
+ }
+
+ if(bHasXButton)
+ {
+ aPos.X()=GetOutputSizePixel().Width()
+ -nXButtonWidth;
+ aSize.Width()=nXButtonWidth;
+ aXButton .SetSizePixel(aSize);
+ aXButton .SetPosPixel(aPos);
+ }
+}
+
+void SvPropertyLine::SetNeedsRepaint(BOOL bFlag)
+{
+ bNeedsRepaint=bFlag;
+}
+
+BOOL SvPropertyLine::NeedsRepaint()
+{
+ return bNeedsRepaint;
+}
+
+void SvPropertyLine::SetName(const String& rString )
+{
+ aName.SetText(rString);
+ aName.Invalidate();
+}
+
+String SvPropertyLine::GetName() const
+{
+ return aName.GetText();
+}
+
+void SvPropertyLine::SetKindOfControl(eKindOfControl eKOC)
+{
+ eKindOfCtr=eKOC;
+}
+
+eKindOfControl SvPropertyLine::GetKindOfControl()
+{
+ return eKindOfCtr;
+}
+
+void SvPropertyLine::ShowXButton()
+{
+ bHasXButton=TRUE;
+ aXButton.Show();
+ Resize();
+}
+void SvPropertyLine::HideXButton()
+{
+ bHasXButton=FALSE;
+ aXButton.Hide();
+ Resize();
+}
+BOOL SvPropertyLine::IsVisibleXButton()
+{
+ return bHasXButton;
+}
+
+void SvPropertyLine::ShowAsHyperLink(BOOL nFlag)
+{
+ bIsHyperlink=nFlag;
+ if(nFlag)
+ {
+ Font aFont=GetFont();
+ aFont.SetUnderline(UNDERLINE_SINGLE);
+ aFont.SetColor(Color(COL_BLUE));
+ aName.SetFont(aFont);
+ }
+ else
+ {
+ Font aFont=GetFont();
+ aName.SetFont(aFont);
+ }
+}
+
+BOOL SvPropertyLine::IsShownAsHyperlink()
+{
+ return bIsHyperlink;
+}
+
+void SvPropertyLine::Locked(BOOL nFlag)
+{
+ bIsLocked=nFlag;
+ if(pSvXPropertyControl!=NULL)
+ pSvXPropertyControl->SetLocked(nFlag);
+}
+
+BOOL SvPropertyLine::IsLocked()
+{
+ return bIsLocked;
+}
+
+void SvPropertyLine::SetNameWidth(USHORT nWidth)
+{
+ nNameWidth=nWidth;
+ Resize();
+}
+
+void SvPropertyLine::SetClickHdl(const Link& rLink)
+{
+ aXButton.SetClickHdl(rLink );
+}
+
+//----------------------------------------------------------
+
+SvXPropEvListener::SvXPropEvListener()
+{
+ pTheActiveControl=NULL;
+}
+
+void SvXPropEvListener::Modified (SvXPropertyControl *pSvXPCtr)
+{
+ pTheActiveControl=pSvXPCtr;
+ aModifyLink.Call(this);
+}
+
+void SvXPropEvListener::GetFocus (SvXPropertyControl *pSvXPCtr)
+{
+ pTheActiveControl=pSvXPCtr;
+ aGetFocusLink.Call(this);
+}
+
+void SvXPropEvListener::LoseFocus (SvXPropertyControl *pSvXPCtr)
+{
+ pTheActiveControl=pSvXPCtr;
+ aLoseFocusLink.Call(this);
+}
+
+void SvXPropEvListener::KeyInput (SvXPropertyControl *pSvXPCtr,const KeyCode& theKeyCode)
+{
+ pTheActiveControl=pSvXPCtr;
+ aKeyCode=theKeyCode;
+ aKeyInputLink.Call(this);
+}
+
+SvXPropertyControl * SvXPropEvListener::GetPropertyControl()
+{
+ return pTheActiveControl;
+}
+
+KeyCode SvXPropEvListener::GetKeyCode() const
+{
+ return aKeyCode;
+}
+
+//------------------------------------------------------------------
+
+SvListBoxForProperties::SvListBoxForProperties( Window* pParent, WinBits nWinStyle)
+ : Control(pParent,nWinStyle),
+ aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG),
+ aPlayGround(this,WB_DIALOGCONTROL),
+ pPropDataControl(NULL)
+{
+
+ aListener.SetModifyHdl (LINK( this, SvListBoxForProperties, ModifyHdl));
+ aListener.SetGetFocusHdl (LINK( this, SvListBoxForProperties, GetFocusHdl));
+ aListener.SetLoseFocusHdl(LINK( this, SvListBoxForProperties,LoseFocusHdl));
+ aListener.SetKeyInputHdl (LINK( this, SvListBoxForProperties, KeyInputHdl));
+
+ nYOffset=0;
+ nTheNameSize=0;
+ ListBox aListBox(this,WB_DROPDOWN);
+ aListBox.SetPosSizePixel(Point(0,0),Size(100,100));
+ nRowHeight=(USHORT)aListBox.GetSizePixel().Height();
+ Wallpaper aWall = aPlayGround.GetBackground();
+ aWall.SetColor( Color( COL_TRANSPARENT ) );
+ aPlayGround.SetBackground( aWall );
+ aPlayGround.Show();
+ aVScroll.Hide();
+ aVScroll.SetScrollHdl(
+ LINK( this, SvListBoxForProperties, ScrollHdl ));
+
+}
+
+
+SvListBoxForProperties::SvListBoxForProperties( Window* pParent, const ResId& rResId )
+ : Control(pParent,rResId),
+ aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG),
+ aPlayGround(this,0),
+ pPropDataControl(NULL)
+{
+ nTheNameSize=0;
+ nYOffset=0;
+ ListBox aListBox(this,WB_DROPDOWN);
+ aListBox.SetPosSizePixel(Point(0,0),Size(100,100));
+ nRowHeight=(USHORT)aListBox.GetSizePixel().Height();
+ Wallpaper aWall = aPlayGround.GetBackground();
+ aWall.SetColor( Color( COL_TRANSPARENT ) );
+ aPlayGround.SetBackground( aWall );
+ aPlayGround.Show();
+ aVScroll.Hide();
+ aVScroll.SetScrollHdl( LINK( this, SvListBoxForProperties, ScrollHdl ) );
+ UpdateVScroll();
+ Resize();
+}
+
+SvListBoxForProperties::~SvListBoxForProperties()
+{
+ Clear();
+}
+
+void SvListBoxForProperties::Clear()
+{
+ for(USHORT i=0;i<PLineArray.Count();i++)
+ {
+ SvPropertyLine* pPropLine=PLineArray[i];
+
+ switch(pPropLine->GetKindOfControl())
+ {
+ case KOC_LISTBOX:
+ case KOC_COMBOBOX:
+ case KOC_EDIT: delete pPropLine->GetSvXPropertyControl();
+ break;
+ }
+ delete pPropLine;
+ }
+ PLineArray.Remove(0,PLineArray.Count());
+}
+
+
+void SvListBoxForProperties::Resize()
+{
+ Size aSize=GetOutputSizePixel();
+ Size a2Size=aSize;
+ Size aVScrollSize;
+
+ if(aVScroll.IsVisible())
+ {
+ Point aPos(0,0);
+ aVScrollSize=aVScroll.GetSizePixel();
+ aVScrollSize.Height()=aSize.Height();
+ a2Size.Width()-=aVScrollSize.Width();
+ aPos.X()=a2Size.Width();
+ aVScroll.SetPosPixel(aPos);
+ aVScroll.SetSizePixel(aVScrollSize);
+ }
+
+ aPlayGround.SetPosPixel(Point(0,0));
+ aPlayGround.SetSizePixel(a2Size);
+ UpdatePosNSize();
+}
+
+void SvListBoxForProperties::SetController( SvPropertyDataControl *pPDC)
+{
+ pPropDataControl=pPDC;
+}
+
+USHORT SvListBoxForProperties::CalcVisibleLines()
+{
+ Size aSize=aPlayGround.GetOutputSizePixel();
+ USHORT nResult=0;
+ if(nRowHeight!=0)
+ nResult=(USHORT) aSize.Height()/nRowHeight;
+
+ return nResult;
+}
+
+void SvListBoxForProperties::UpdateVScroll()
+{
+ USHORT nLines=CalcVisibleLines();
+ aVScroll.SetPageSize(nLines-1);
+ aVScroll.SetVisibleSize(nLines-1);
+ aVScroll.SetRange(Range(0,PLineArray.Count()-1));
+ if(PLineArray.Count()<=nLines)
+ {
+ aVScroll.Hide();
+ }
+ else
+ {
+ BOOL bFlag=aVScroll.IsVisible();
+ aVScroll.Show();
+ if(!bFlag)Resize();
+ }
+
+
+}
+
+void SvListBoxForProperties::UpdatePosNSize()
+{
+ Point aPos(0,nYOffset);
+
+ for(USHORT i=0; i<PLineArray.Count();i++)
+ {
+ if((PLineArray[i])->NeedsRepaint())
+ {
+ (PLineArray[i])->SetPosPixel(aPos);
+ Size aSize=aPlayGround.GetOutputSizePixel();
+ aSize.Height()=nRowHeight;
+ (PLineArray[i])->SetSizePixel(aSize);
+ (PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET);
+ (PLineArray[i])->Invalidate();
+ (PLineArray[i])->Update();
+ (PLineArray[i])->Show();
+ (PLineArray[i])->SetNeedsRepaint(FALSE);
+ }
+ else
+ {
+ if((PLineArray[i])->IsVisible())
+ {
+ Size aSize=aPlayGround.GetOutputSizePixel();
+ aSize.Height()=nRowHeight;
+ (PLineArray[i])->SetSizePixel(aSize);
+ (PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET);
+ (PLineArray[i])->Invalidate();
+ }
+ }
+
+ aPos.Y()+=nRowHeight;
+ }
+ aPlayGround.Invalidate();
+ aPlayGround.Update();
+}
+
+void SvListBoxForProperties::UpdatePlayGround()
+{
+ Point aPos(0,0);
+ long nThumbPos=aVScroll.GetThumbPos();
+ long nLines=aVScroll.GetPageSize();
+ long nDelta=aVScroll.GetDelta();
+
+ USHORT nStart,nEnd;
+ Size aSize=aPlayGround.GetOutputSizePixel();
+ Point aPEnd;
+ aPEnd.X()=aSize.Width();
+
+ if(nDelta>0)
+ {
+ nStart=(USHORT)(nThumbPos+nLines+1-nDelta);
+ nEnd=(USHORT)(nThumbPos+nLines);
+ aPos.Y()=(nLines+1-nDelta)*nRowHeight;
+ }
+ else
+ {
+ nStart=(USHORT)nThumbPos;
+ nEnd=(USHORT)(nThumbPos-nDelta);
+ aPEnd.Y()=(nThumbPos-nDelta)*nRowHeight;;
+ }
+
+ aSize.Height()=nRowHeight;
+
+ nDelta=-nDelta*nRowHeight;
+
+ aPlayGround.Scroll(0,nDelta,SCROLL_CHILDREN);
+
+ for(USHORT i=nStart; i<=nEnd;i++)
+ {
+ (PLineArray[i])->SetPosSizePixel(aPos,aSize);
+ (PLineArray[i])->SetNameWidth(nTheNameSize+2*FRAME_OFFSET);
+ (PLineArray[i])->Show();
+ aPos.Y()+=nRowHeight;
+ }
+ aPlayGround.Update();
+}
+
+void SvListBoxForProperties::UpdateAll()
+{
+ UpdatePosNSize();
+ UpdatePlayGround();
+ //UpdateVScroll();
+}
+
+void SvListBoxForProperties::DisableUpdate()
+{
+ bUpdate=FALSE;
+}
+
+void SvListBoxForProperties::EnableUpdate()
+{
+ bUpdate=TRUE;
+ UpdateAll();
+}
+
+void SvListBoxForProperties::SetPropertyValue( const String & rEntryName, const String & rValue )
+{
+ USHORT i, iEnd = PLineArray.Count();
+ for( i = 0 ; i < iEnd ; i++ )
+ {
+ SvPropertyLine* pPropLine = PLineArray[ i ];
+ SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl();
+ if( pSvXPCtr && pSvXPCtr->GetMyName() == rEntryName )
+ {
+ pSvXPCtr->SetProperty( rValue );
+ }
+ }
+}
+
+USHORT SvListBoxForProperties::AppendEntry( const SvPropertyData& aPropData)
+{
+ return InsertEntry(aPropData);
+}
+
+USHORT SvListBoxForProperties::InsertEntry( const SvPropertyData& aPropData, USHORT nPos)
+{
+ USHORT nInsPos=nPos;
+ SvPropertyLine* pPropLine=new SvPropertyLine(&aPlayGround,WB_TABSTOP | WB_DIALOGCONTROL);
+
+ long nThumbPos=aVScroll.GetThumbPos();
+ long nLines=aVScroll.GetPageSize();
+
+ if(nPos==LISTBOX_APPEND)
+ {
+ nInsPos=PLineArray.Count();
+ PLineArray.Insert(pPropLine,nInsPos);
+ }
+ else
+ {
+ PLineArray.Insert(pPropLine,nPos);
+ }
+ pPropLine->SetNameWidth(nTheNameSize);
+ UpdateVScroll();
+ UpdatePosNSize();
+ ChangeEntry(aPropData,nInsPos);
+ return nInsPos;
+}
+
+void SvListBoxForProperties::ChangeEntry( const SvPropertyData& aPropData, USHORT nPos)
+{
+ if(nPos<PLineArray.Count())
+ {
+ SvPropertyLine* pPropLine=PLineArray[nPos];
+
+ switch(pPropLine->GetKindOfControl())
+ {
+ case KOC_LISTBOX:
+ case KOC_COMBOBOX:
+ case KOC_EDIT: delete pPropLine->GetSvXPropertyControl();
+ break;
+ }
+
+ switch(aPropData.eKind)
+ {
+ case KOC_LISTBOX:
+ pPropLine->SetSvXPropertyControl(
+ new SvXPropertyComboBox(pPropLine,WB_TABSTOP));
+ pPropLine->SetKindOfControl(aPropData.eKind);
+ break;
+ case KOC_COMBOBOX:
+ pPropLine->SetSvXPropertyControl(
+ new SvXPropertyComboBox(pPropLine,WB_TABSTOP));
+ pPropLine->SetKindOfControl(aPropData.eKind);
+ break;
+ case KOC_EDIT:
+ pPropLine->SetSvXPropertyControl(
+ new SvXPropertyEdit(pPropLine,WB_TABSTOP));
+ pPropLine->SetKindOfControl(aPropData.eKind);
+ break;
+ case KOC_USERDEFINED:
+ pPropLine->SetSvXPropertyControl(aPropData.pControl);
+ aPropData.pControl->SetParent(pPropLine);
+ pPropLine->SetKindOfControl(aPropData.eKind);
+ break;
+ default:
+ pPropLine->SetSvXPropertyControl(NULL);
+ pPropLine->SetKindOfControl(KOC_UNDEFINED);
+ break;
+ }
+
+ SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl();
+
+ if(pSvXPCtr!=NULL)
+ {
+ pSvXPCtr->SetSvXPropertyCtrListener(&aListener);
+ pSvXPCtr->SetProperty(aPropData.aValue);
+ pSvXPCtr->SetMyData(aPropData.pDataPtr);
+ pSvXPCtr->SetMyName(aPropData.aName);
+
+ if(pSvXPCtr->HasList())
+ {
+ for(int i=0;i<aPropData.theValues.Count();i++)
+ {
+ pSvXPCtr->InsertEntry(*(aPropData.theValues[i]));
+ }
+ }
+ }
+
+ pPropLine->SetName(aPropData.aName);
+
+ USHORT nTextWidth=(USHORT)aPlayGround.GetTextWidth(aPropData.aName);
+
+ if ( nTheNameSize < nTextWidth )
+ nTheNameSize = nTextWidth;
+
+ if ( aPropData.bHasVisibleXButton )
+ {
+ pPropLine->SetClickHdl(LINK( this, SvListBoxForProperties, ClickHdl ) );
+ pPropLine->ShowXButton();
+ }
+ else
+ pPropLine->HideXButton();
+
+ pPropLine->Locked(aPropData.bIsLocked);
+
+ pPropLine->ShowAsHyperLink(aPropData.bIsHyperLink);
+ pPropLine->SetData(aPropData.pDataPtr);
+ }
+}
+
+USHORT SvListBoxForProperties::GetFirstVisibleEntry()
+{
+ return 0;
+}
+void SvListBoxForProperties::SetFirstVisibleEntry(USHORT nPos)
+{
+ return;
+}
+
+void SvListBoxForProperties::SetSelectedEntry(USHORT nPos)
+{
+ return;
+}
+
+USHORT SvListBoxForProperties::GetSelectedEntry()
+{
+ return 0;
+}
+
+IMPL_LINK( SvListBoxForProperties, ScrollHdl, ScrollBar*, pSB )
+{
+ if(pSB!=NULL)
+ {
+ long nDelta=aVScroll.GetDelta();
+ nYOffset=-aVScroll.GetThumbPos()*nRowHeight;
+ //aPlayGround.SetUpdateMode(FALSE);
+
+ long nThumbPos=aVScroll.GetThumbPos();
+ long nLines=aVScroll.GetPageSize();
+
+ UpdatePlayGround();
+
+ for(int i=nThumbPos-nDelta; i<nThumbPos+nLines-nDelta;i++)
+ {
+ if(i>=nThumbPos && i<=nThumbPos+nLines)
+ {
+ (PLineArray[i])->SetNeedsRepaint(TRUE);
+ }
+ else
+ {
+ (PLineArray[i])->Hide();
+ (PLineArray[i])->SetNeedsRepaint(FALSE);
+ }
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( SvListBoxForProperties, ClickHdl, PushButton*,pPB)
+{
+ if(pPB!=NULL)
+ {
+ SvPropertyLine *pPropLine=(SvPropertyLine *)pPB->GetParent();
+ SvXPropertyControl* pSvXPCtr=pPropLine->GetSvXPropertyControl();
+ pPropDataControl->Clicked(pSvXPCtr->GetMyName(),
+ pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData());
+ }
+ return 0;
+}
+
+IMPL_LINK( SvListBoxForProperties, ModifyHdl,SvXPropEvListener*, pSvXPEvL)
+{
+ if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
+ {
+
+ SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl();
+
+ pPropDataControl->Modified(pSvXPCtr->GetMyName(),
+ pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData());
+
+ }
+ return 0;
+}
+
+IMPL_LINK( SvListBoxForProperties, GetFocusHdl,SvXPropEvListener*, pSvXPEvL)
+{
+ if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
+ {
+ SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl();
+
+ pPropDataControl->Select(pSvXPCtr->GetMyName(),pSvXPCtr->GetMyData());
+ }
+ return 0;
+}
+
+IMPL_LINK( SvListBoxForProperties, LoseFocusHdl,SvXPropEvListener*, pSvXPEvL)
+{
+ if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
+ {
+ SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl();
+
+ pPropDataControl->Commit(pSvXPCtr->GetMyName(),
+ pSvXPCtr->GetProperty(),pSvXPCtr->GetMyData());
+ /*
+ {
+ pSvXPCtr->SetProperty(
+ pPropDataControl->GetTheCorrectProperty());
+ }
+ */
+ }
+ return 0;
+}
+
+IMPL_LINK( SvListBoxForProperties, KeyInputHdl,SvXPropEvListener*, pSvXPEvL)
+{
+ if(pSvXPEvL!=NULL && pPropDataControl!=NULL)
+ {
+ SvXPropertyControl* pSvXPCtr=aListener.GetPropertyControl();
+ }
+ return 0;
+}
+
+
+
+
+SvTabPageForProperties::SvTabPageForProperties(Window* pParent,WinBits nWinStyle)
+ : TabPage(pParent,nWinStyle),
+ aLbProp(this)
+{
+ aLbProp.Show();
+}
+
+void SvTabPageForProperties::Resize()
+{
+ Point aPos(3,3);
+ Size aSize=GetOutputSizePixel();
+ aSize.Width()-=6;
+ aSize.Height()-=6;
+
+ aLbProp.SetPosSizePixel(aPos,aSize);
+}
+
+SvListBoxForProperties* SvTabPageForProperties::GetTheListBox()
+{
+ return &aLbProp;
+}
+
+
+SvPropertyBox::SvPropertyBox( Window* pParent, WinBits nWinStyle)
+ : Control(pParent,nWinStyle),
+ aTabControl(this)
+{
+ aTabControl.Show();
+}
+
+SvPropertyBox::SvPropertyBox( Window* pParent, const ResId& rResId )
+ : Control(pParent,rResId),
+ aTabControl(this)
+{
+ aTabControl.Show();
+ Resize();
+}
+
+SvPropertyBox::~SvPropertyBox()
+{
+ ClearAll();
+}
+
+
+void SvPropertyBox::ClearAll()
+{
+ USHORT nCount=aTabControl.GetPageCount();
+
+ for(USHORT i=nCount;i>=1;i--)
+ {
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(i);
+ aTabControl.RemovePage(i);
+ delete pPage;
+ }
+}
+
+
+void SvPropertyBox::Resize()
+{
+ Point aPos(3,3);
+ Size aSize=GetOutputSizePixel();
+ aSize.Width()-=6;
+ aSize.Height()-=6;
+
+ aTabControl.SetPosSizePixel(aPos,aSize);
+
+ USHORT nCount=aTabControl.GetPageCount();
+
+ aSize=aTabControl.GetOutputSizePixel();
+ for(USHORT i=1;i<=nCount;i++)
+ {
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(i);
+ pPage->SetSizePixel(aSize);
+ }
+
+}
+
+
+USHORT SvPropertyBox::AppendPage( const String & rText )
+{
+ USHORT nId=aTabControl.GetPageCount()+1;
+ aTabControl.InsertPage( nId,rText);
+ SvTabPageForProperties* pPage=new SvTabPageForProperties(&aTabControl);
+ pPage->SetSizePixel(aTabControl.GetOutputSizePixel());
+ pPage->GetTheListBox()->SetController(pThePropDataCtr);
+ aTabControl.SetTabPage( nId, pPage);
+ aTabControl.SetCurPageId(nId);
+ return nId;
+}
+
+void SvPropertyBox::SetPage( USHORT nId)
+{
+ aTabControl.SetCurPageId(nId);
+}
+
+USHORT SvPropertyBox::GetCurPage()
+{
+ return aTabControl.GetCurPageId();
+}
+
+USHORT SvPropertyBox::CalcVisibleLines()
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ return pPage->GetTheListBox()->CalcVisibleLines();
+}
+void SvPropertyBox::EnableUpdate()
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ pPage->GetTheListBox()->EnableUpdate();
+}
+
+void SvPropertyBox::DisableUpdate()
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ pPage->GetTheListBox()->DisableUpdate();
+}
+
+void SvPropertyBox::SetController(SvPropertyDataControl *pDataCtr)
+{
+ pThePropDataCtr=pDataCtr;
+ USHORT nCount=aTabControl.GetPageCount();
+
+ for(USHORT i=1;i<=nCount;i++)
+ {
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(i);
+
+ pPage->GetTheListBox()->SetController(pThePropDataCtr);
+ }
+
+}
+
+USHORT SvPropertyBox::InsertEntry( const SvPropertyData& rData, USHORT nPos)
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ return pPage->GetTheListBox()->InsertEntry(rData,nPos);
+}
+
+void SvPropertyBox::ChangeEntry( const SvPropertyData& rData, USHORT nPos)
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ pPage->GetTheListBox()->ChangeEntry(rData,nPos);
+}
+
+USHORT SvPropertyBox::AppendEntry( const SvPropertyData& rData)
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ return pPage->GetTheListBox()->AppendEntry(rData);
+}
+
+void SvPropertyBox::SetPropertyValue( const String & rEntryName, const String & rValue )
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ pPage->GetTheListBox()->SetPropertyValue( rEntryName, rValue );
+}
+
+void SvPropertyBox::SetFirstVisibleEntry(USHORT nPos)
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ pPage->GetTheListBox()->SetFirstVisibleEntry(nPos);
+}
+USHORT SvPropertyBox::GetFirstVisibleEntry()
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ return pPage->GetTheListBox()->GetFirstVisibleEntry();
+}
+
+void SvPropertyBox::SetSelectedEntry(USHORT nPos)
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ pPage->GetTheListBox()->SetSelectedEntry(nPos);
+}
+USHORT SvPropertyBox::GetSelectedEntry()
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ return pPage->GetTheListBox()->GetSelectedEntry();
+}
+
+void SvPropertyBox::ClearTable()
+{
+ SvTabPageForProperties* pPage=(SvTabPageForProperties*)
+ aTabControl.GetTabPage(aTabControl.GetCurPageId());
+ pPage->GetTheListBox()->Clear();
+}
+
+
+void SvBasicPropertyDataControl::Modified(const String& aName,
+ const String& aVal,void* pData)
+{
+ aEntryName=aName;
+ aEntryProperty=aVal;
+ pTheData=pData;
+ aModifyLink.Call(this);
+}
+
+void SvBasicPropertyDataControl::Clicked( const String& aName,
+ const String& aVal,
+ void* pData) //Xtension-Button pressed
+{
+ aEntryName=aName;
+ aEntryProperty=aVal;
+ pTheData=pData;
+ aClickedLink.Call(this);
+}
+
+void SvBasicPropertyDataControl::Commit( const String& aName,
+ const String& aVal,
+ void* pData) //User accept changes
+{
+ aEntryName=aName;
+ aEntryProperty=aVal;
+ pTheData=pData;
+ aCommitLink.Call(this);
+}
+
+void SvBasicPropertyDataControl::Select( const String& aName,
+ void* pData) //User select new Row
+{
+ aEntryName=aName;
+ pTheData=pData;
+ aSelectLink.Call(this);
+}
+
+void SvBasicPropertyDataControl::LinkClicked(const String& aName, void* pData)
+{
+}
+
+
+String SvBasicPropertyDataControl::GetName() const //Tell's the name of the Property
+{
+ return aEntryName;
+}
+
+String SvBasicPropertyDataControl::GetProperty() const //Tell's the content of the Property
+{
+ return aEntryProperty;
+}
+
+void* SvBasicPropertyDataControl::GetData() //Tell's the storage
+{
+ return pTheData;
+}
+
+/*
+String SvBasicPropertyDataControl::GetTheCorrectProperty() const
+{
+ return aCorrectProperty;
+}
+*/
+
+void SvBasicPropertyDataControl::SetTheCorrectProperty(const String& aString)
+{
+ aCorrectProperty=aString;
+}
+
+void SvBasicPropertyDataControl::SetIsCorrect(BOOL nFlag)
+{
+ bCorrectness=nFlag;
+}
+
+
+
+//========================================================================
+// Property-Dialog:
+/* zum TESTEN im CALC*/
+//========================================================================
+/*
+ScPropertyDlg::ScPropertyDlg( Window* pParent) :
+ ModalDialog ( pParent, ScResId( RID_SCDLG_PROPERTIES) ),
+ aPropListBox ( this, ResId( CTR_PROPLINE) ),
+ aKindOfListBox (this,ResId( LB_KIND_OF_PROP)),
+ aModAnswer (this,ResId(FT_ANSMOD )),
+ aClickAnswer (this,ResId(FT_ANSCLICK )),
+ aCommitAnswer (this,ResId(FT_ANSCOMMIT)),
+ aSelectAnswer (this,ResId(FT_ANSSELECT)),
+ anOk(this,ResId( BTN_OK)),
+ aCancel(this,ResId( BTN_CANCEL))
+{
+ FreeResource();
+
+ aKindOfListBox.SelectEntryPos(0);
+ aKindOfListBox.SetSelectHdl(
+ LINK( this, ScPropertyDlg, ModifiedHdl ));
+ nCount=0;
+ nClickCount=0;
+
+ String aString("Don't know ");
+
+ aBaProDatCtr.SetModifyHdl (LINK( this, ScPropertyDlg, RowModifiedHdl ));
+ aBaProDatCtr.SetClickedHdl(LINK( this, ScPropertyDlg, ClickHdl ));
+ aBaProDatCtr.SetCommitHdl (LINK( this, ScPropertyDlg, SelectHdl ));
+ aBaProDatCtr.SetSelectHdl (LINK( this, ScPropertyDlg, CommitHdl ));
+
+ aPropListBox.SetController(&aBaProDatCtr);
+
+ USHORT nPageId=aPropListBox.AppendPage("YabbaDabbaDo");
+ aPropListBox.SetPage(nPageId);
+ aProperty.eKind=KOC_EDIT;
+ aProperty.aName=aString;
+ aProperty.aName+=String((USHORT)++nCount);
+ aProperty.aValue=sizeof ComboBox;
+ aProperty.bHasVisibleXButton=FALSE;
+ aProperty.bIsHyperLink=FALSE;
+ aProperty.bIsLocked=FALSE;
+ aProperty.pDataPtr=NULL;
+ aProperty.pControl=NULL;
+ aProperty.theValues.Insert(new String("1"),aProperty.theValues.Count());
+ aProperty.theValues.Insert(new String("2"),aProperty.theValues.Count());
+ aProperty.theValues.Insert(new String("3"),aProperty.theValues.Count());
+ aProperty.theValues.Insert(new String("4"),aProperty.theValues.Count());
+ aPropListBox.InsertEntry(aProperty);
+ aProperty.bHasVisibleXButton=TRUE;
+ aProperty.aName=aString;
+ aProperty.aName+=String((USHORT)++nCount);
+ aProperty.aValue="42";
+ aProperty.eKind=KOC_LISTBOX;
+ aPropListBox.InsertEntry(aProperty);
+ aProperty.aName=aString;
+ aProperty.aName+=String((USHORT)++nCount);
+ aProperty.eKind=KOC_COMBOBOX;
+ aProperty.bHasVisibleXButton=FALSE;
+ aPropListBox.InsertEntry(aProperty);
+}
+
+ScPropertyDlg::~ScPropertyDlg()
+{
+ delete aProperty.theValues[0];
+ delete aProperty.theValues[1];
+ delete aProperty.theValues[2];
+ delete aProperty.theValues[3];
+}
+
+IMPL_LINK( ScPropertyDlg, ModifiedHdl, ListBox*, pLB )
+{
+ if(pLB!=NULL)
+ {
+ String aString("Don't know ");
+ aProperty.aName=aString;
+ aProperty.aName+=String((USHORT)++nCount);
+ if(nCount>20)
+ {
+ String aStr("Yabba ");
+ aStr+=aPropListBox.GetCurPage();
+ USHORT nPageId=aPropListBox.AppendPage(aStr);
+ aPropListBox.SetPage(nPageId);
+ nCount=0;
+ }
+
+ aProperty.eKind=(eKindOfControl)(aKindOfListBox.GetSelectEntryPos()+1);
+ aProperty.bHasVisibleXButton=FALSE;
+ if((nCount % 5)==0) aProperty.bHasVisibleXButton=TRUE;
+ aPropListBox.InsertEntry(aProperty);
+ }
+ return 0;
+}
+
+IMPL_LINK( ScPropertyDlg, RowModifiedHdl, SvBasicPropertyDataControl* ,pProCtr)
+{
+ if(pProCtr!=NULL)
+ {
+ aModAnswer.SetText(aBaProDatCtr.GetProperty());
+ aModAnswer.Invalidate();
+ aBaProDatCtr.SetIsCorrect(TRUE);
+ }
+ return 0;
+}
+
+IMPL_LINK( ScPropertyDlg, CommitHdl, SvBasicPropertyDataControl*,pProCtr)
+{
+ if(pProCtr!=NULL)
+ {
+ aCommitAnswer.SetText(aBaProDatCtr.GetProperty());
+ aCommitAnswer.Invalidate();
+ aBaProDatCtr.SetIsCorrect(TRUE);
+ }
+ return 0;
+}
+
+IMPL_LINK( ScPropertyDlg, ClickHdl, SvBasicPropertyDataControl*,pProCtr)
+{
+ if(pProCtr!=NULL)
+ {
+ aClickAnswer.SetText(aBaProDatCtr.GetName());
+ aClickAnswer.Invalidate();
+ aBaProDatCtr.SetIsCorrect(TRUE);
+ }
+ return 0;
+}
+
+IMPL_LINK( ScPropertyDlg, SelectHdl, SvBasicPropertyDataControl*,pProCtr)
+{
+ if(pProCtr!=NULL)
+ {
+ aSelectAnswer.SetText(aBaProDatCtr.GetName());
+ aSelectAnswer.Invalidate();
+ aBaProDatCtr.SetIsCorrect(TRUE);
+ }
+ return 0;
+}
+*/
+
+
diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx
new file mode 100644
index 000000000000..1382624638fc
--- /dev/null
+++ b/svtools/source/dialogs/wizdlg.cxx
@@ -0,0 +1,678 @@
+/*************************************************************************
+ *
+ * $RCSfile: wizdlg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SVT_WIZDLG_CXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _VCL_FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _VCL_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _VCL_TABPAGE_HXX
+#include <vcl/tabpage.hxx>
+#endif
+
+#ifndef _SVT_WIZDLG_HXX
+#include <wizdlg.hxx>
+#endif
+
+// =======================================================================
+
+#define WIZARDDIALOG_BUTTON_OFFSET_Y 6
+#define WIZARDDIALOG_BUTTON_DLGOFFSET_X 6
+#define WIZARDDIALOG_LINE_DLGOFFSET_X 6
+#define WIZARDDIALOG_VIEW_DLGOFFSET_X 6
+#define WIZARDDIALOG_VIEW_DLGOFFSET_Y 6
+
+// =======================================================================
+
+struct ImplWizPageData
+{
+ ImplWizPageData* mpNext;
+ TabPage* mpPage;
+};
+
+// -----------------------------------------------------------------------
+
+struct ImplWizButtonData
+{
+ ImplWizButtonData* mpNext;
+ Button* mpButton;
+ long mnOffset;
+};
+
+// =======================================================================
+
+void WizardDialog::ImplInitData()
+{
+ mpFirstPage = NULL;
+ mpFirstBtn = NULL;
+ mpFixedLine = NULL;
+ mpCurTabPage = NULL;
+ mpPrevBtn = NULL;
+ mpNextBtn = NULL;
+ mpViewWindow = NULL;
+ mnCurLevel = 0;
+ meViewAlign = WINDOWALIGN_LEFT;
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::ImplCalcSize( Size& rSize )
+{
+ // ButtonBar-Hoehe berechnen
+ long nMaxHeight = 0;
+ ImplWizButtonData* pBtnData = mpFirstBtn;
+ while ( pBtnData )
+ {
+ long nBtnHeight = pBtnData->mpButton->GetSizePixel().Height();
+ if ( nBtnHeight > nMaxHeight )
+ nMaxHeight = nBtnHeight;
+ pBtnData = pBtnData->mpNext;
+ }
+ if ( nMaxHeight )
+ nMaxHeight += WIZARDDIALOG_BUTTON_OFFSET_Y*2;
+ if ( mpFixedLine && mpFixedLine->IsVisible() )
+ nMaxHeight += mpFixedLine->GetSizePixel().Height();
+ rSize.Height() += nMaxHeight;
+
+ // View-Window-Groesse dazurechnen
+ if ( mpViewWindow && mpViewWindow->IsVisible() )
+ {
+ Size aViewSize = mpViewWindow->GetSizePixel();
+ if ( meViewAlign == WINDOWALIGN_TOP )
+ rSize.Height() += aViewSize.Height();
+ else if ( meViewAlign == WINDOWALIGN_LEFT )
+ rSize.Width() += aViewSize.Width();
+ else if ( meViewAlign == WINDOWALIGN_BOTTOM )
+ rSize.Height() += aViewSize.Height();
+ else if ( meViewAlign == WINDOWALIGN_RIGHT )
+ rSize.Width() += aViewSize.Width();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::ImplPosCtrls()
+{
+ Size aDlgSize = GetOutputSizePixel();
+ long nBtnWidth = 0;
+ long nMaxHeight = 0;
+ long nOffY = aDlgSize.Height();
+
+ ImplWizButtonData* pBtnData = mpFirstBtn;
+ while ( pBtnData )
+ {
+ Size aBtnSize = pBtnData->mpButton->GetSizePixel();
+ long nBtnHeight = aBtnSize.Height();
+ if ( nBtnHeight > nMaxHeight )
+ nMaxHeight = nBtnHeight;
+ nBtnWidth += aBtnSize.Width();
+ nBtnWidth += pBtnData->mnOffset;
+ pBtnData = pBtnData->mpNext;
+ }
+
+ if ( nMaxHeight )
+ {
+ long nOffX = aDlgSize.Width()-nBtnWidth-WIZARDDIALOG_BUTTON_DLGOFFSET_X;
+ nOffY -= WIZARDDIALOG_BUTTON_OFFSET_Y+nMaxHeight;
+
+ pBtnData = mpFirstBtn;
+ while ( pBtnData )
+ {
+ Size aBtnSize = pBtnData->mpButton->GetSizePixel();
+ Point aPos( nOffX, nOffY+((nMaxHeight-aBtnSize.Height())/2) );
+ pBtnData->mpButton->SetPosPixel( aPos );
+ nOffX += aBtnSize.Width();
+ nOffX += pBtnData->mnOffset;
+ pBtnData = pBtnData->mpNext;
+ }
+
+ nOffY -= WIZARDDIALOG_BUTTON_OFFSET_Y;
+ }
+
+ if ( mpFixedLine && mpFixedLine->IsVisible() )
+ {
+ nOffY -= mpFixedLine->GetSizePixel().Height();
+ mpFixedLine->SetPosSizePixel( WIZARDDIALOG_LINE_DLGOFFSET_X, nOffY,
+ aDlgSize.Width()-(WIZARDDIALOG_LINE_DLGOFFSET_X*2), 0,
+ WINDOW_POSSIZE_POS | WINDOW_POSSIZE_WIDTH );
+ }
+
+ if ( mpViewWindow && mpViewWindow->IsVisible() )
+ {
+ long nViewOffX = 0;
+ long nViewOffY = 0;
+ long nViewWidth = 0;
+ long nViewHeight = 0;
+ long nDlgHeight = nOffY;
+ USHORT nViewPosFlags = WINDOW_POSSIZE_POS;
+ if ( meViewAlign == WINDOWALIGN_TOP )
+ {
+ nViewOffX = WIZARDDIALOG_VIEW_DLGOFFSET_X;
+ nViewOffY = WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+ nViewWidth = aDlgSize.Width()-(WIZARDDIALOG_VIEW_DLGOFFSET_X*2);
+ nViewPosFlags |= WINDOW_POSSIZE_WIDTH;
+ }
+ else if ( meViewAlign == WINDOWALIGN_LEFT )
+ {
+ nViewOffX = WIZARDDIALOG_VIEW_DLGOFFSET_X;
+ nViewOffY = WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+ nViewHeight = nDlgHeight-(WIZARDDIALOG_VIEW_DLGOFFSET_Y*2);
+ nViewPosFlags |= WINDOW_POSSIZE_HEIGHT;
+ }
+ else if ( meViewAlign == WINDOWALIGN_BOTTOM )
+ {
+ nViewOffX = WIZARDDIALOG_VIEW_DLGOFFSET_X;
+ nViewOffY = nDlgHeight-mpViewWindow->GetSizePixel().Height()-WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+ nViewWidth = aDlgSize.Width()-(WIZARDDIALOG_VIEW_DLGOFFSET_X*2);
+ nViewPosFlags |= WINDOW_POSSIZE_WIDTH;
+ }
+ else if ( meViewAlign == WINDOWALIGN_RIGHT )
+ {
+ nViewOffX = aDlgSize.Width()-mpViewWindow->GetSizePixel().Width()-WIZARDDIALOG_VIEW_DLGOFFSET_X;
+ nViewOffY = WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+ nViewHeight = nDlgHeight-(WIZARDDIALOG_VIEW_DLGOFFSET_Y*2);
+ nViewPosFlags |= WINDOW_POSSIZE_HEIGHT;
+ }
+ mpViewWindow->SetPosSizePixel( nViewOffX, nViewOffY,
+ nViewWidth, nViewHeight,
+ nViewPosFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::ImplPosTabPage()
+{
+ if ( !mpCurTabPage )
+ return;
+
+ // ButtonBar-Hoehe berechnen
+ long nMaxHeight = 0;
+ ImplWizButtonData* pBtnData = mpFirstBtn;
+ while ( pBtnData )
+ {
+ long nBtnHeight = pBtnData->mpButton->GetSizePixel().Height();
+ if ( nBtnHeight > nMaxHeight )
+ nMaxHeight = nBtnHeight;
+ pBtnData = pBtnData->mpNext;
+ }
+ if ( nMaxHeight )
+ nMaxHeight += WIZARDDIALOG_BUTTON_OFFSET_Y*2;
+ if ( mpFixedLine && mpFixedLine->IsVisible() )
+ nMaxHeight += mpFixedLine->GetSizePixel().Height();
+
+ // TabPage positionieren
+ Size aDlgSize = GetOutputSizePixel();
+ aDlgSize.Height() -= nMaxHeight;
+ long nOffX = 0;
+ long nOffY = 0;
+ if ( mpViewWindow && mpViewWindow->IsVisible() )
+ {
+ Size aViewSize = mpViewWindow->GetSizePixel();
+ if ( meViewAlign == WINDOWALIGN_TOP )
+ {
+ nOffY += aViewSize.Height()+WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+ aDlgSize.Height() -= aViewSize.Height()+WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+ }
+ else if ( meViewAlign == WINDOWALIGN_LEFT )
+ {
+ nOffX += aViewSize.Width()+WIZARDDIALOG_VIEW_DLGOFFSET_X;
+ aDlgSize.Width() -= aViewSize.Width()+WIZARDDIALOG_VIEW_DLGOFFSET_X;
+ }
+ else if ( meViewAlign == WINDOWALIGN_BOTTOM )
+ aDlgSize.Height() -= aViewSize.Height()+WIZARDDIALOG_VIEW_DLGOFFSET_Y;
+ else if ( meViewAlign == WINDOWALIGN_RIGHT )
+ aDlgSize.Width() -= aViewSize.Width()+WIZARDDIALOG_VIEW_DLGOFFSET_X;
+ }
+ Point aPos( nOffX, nOffY );
+ mpCurTabPage->SetPosSizePixel( aPos, aDlgSize );
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::ImplShowTabPage( TabPage* pTabPage )
+{
+ if ( mpCurTabPage == pTabPage )
+ return;
+
+ TabPage* pOldTabPage = mpCurTabPage;
+ if ( pOldTabPage )
+ pOldTabPage->DeactivatePage();
+
+ mpCurTabPage = pTabPage;
+ if ( pTabPage )
+ {
+ ImplPosTabPage();
+ pTabPage->ActivatePage();
+ pTabPage->Show();
+ }
+
+ if ( pOldTabPage )
+ pOldTabPage->Hide();
+}
+
+// -----------------------------------------------------------------------
+
+TabPage* WizardDialog::ImplGetPage( USHORT nLevel ) const
+{
+ USHORT nTempLevel = 0;
+ ImplWizPageData* pPageData = mpFirstPage;
+ while ( pPageData )
+ {
+ if ( (nTempLevel == nLevel) || !pPageData->mpNext )
+ break;
+
+ nTempLevel++;
+ pPageData = pPageData->mpNext;
+ }
+
+ if ( pPageData )
+ return pPageData->mpPage;
+ return NULL;
+}
+
+// =======================================================================
+
+WizardDialog::WizardDialog( Window* pParent, WinBits nStyle ) :
+ ModalDialog( pParent, nStyle )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+WizardDialog::WizardDialog( Window* pParent, const ResId& rResId ) :
+ ModalDialog( pParent, rResId )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+WizardDialog::~WizardDialog()
+{
+ if ( mpFixedLine )
+ delete mpFixedLine;
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::Resize()
+{
+ if ( IsReallyShown() && !IsInInitShow() )
+ {
+ ImplPosCtrls();
+ ImplPosTabPage();
+ }
+
+ Dialog::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ if ( IsDefaultSize() )
+ {
+ Size aDlgSize = GetPageSizePixel();
+ if ( !aDlgSize.Width() || !aDlgSize.Height() )
+ {
+ ImplWizPageData* pPageData = mpFirstPage;
+ while ( pPageData )
+ {
+ if ( pPageData->mpPage )
+ {
+ Size aPageSize = pPageData->mpPage->GetSizePixel();
+ if ( aPageSize.Width() > aDlgSize.Width() )
+ aDlgSize.Width() = aPageSize.Width();
+ if ( aPageSize.Height() > aDlgSize.Height() )
+ aDlgSize.Height() = aPageSize.Height();
+ }
+
+ pPageData = pPageData->mpNext;
+ }
+ }
+ ImplCalcSize( aDlgSize );
+ SetOutputSizePixel( aDlgSize );
+ }
+
+ ImplPosCtrls();
+ ImplPosTabPage();
+ ImplShowTabPage( ImplGetPage( mnCurLevel ) );
+ }
+
+ Dialog::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+long WizardDialog::Notify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) && mpPrevBtn && mpNextBtn )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( aKeyCode.IsMod1() )
+ {
+ if ( aKeyCode.IsShift() || (nKeyCode == KEY_PAGEUP) )
+ {
+ if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEUP) )
+ {
+ if ( mpPrevBtn->IsVisible() &&
+ mpPrevBtn->IsEnabled() && mpPrevBtn->IsInputEnabled() )
+ {
+ mpPrevBtn->SetPressed( TRUE );
+ mpPrevBtn->SetPressed( FALSE );
+ mpPrevBtn->Click();
+ }
+ return TRUE;
+ }
+ }
+ else
+ {
+ if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEDOWN) )
+ {
+ if ( mpNextBtn->IsVisible() &&
+ mpNextBtn->IsEnabled() && mpNextBtn->IsInputEnabled() )
+ {
+ mpNextBtn->SetPressed( TRUE );
+ mpNextBtn->SetPressed( FALSE );
+ mpNextBtn->Click();
+ }
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return Dialog::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::ActivatePage()
+{
+ maActivateHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+long WizardDialog::DeactivatePage()
+{
+ if ( maDeactivateHdl.IsSet() )
+ return maDeactivateHdl.Call( this );
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL WizardDialog::ShowNextPage()
+{
+ return ShowPage( mnCurLevel+1 );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL WizardDialog::ShowPrevPage()
+{
+ if ( !mnCurLevel )
+ return FALSE;
+ return ShowPage( mnCurLevel-1 );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL WizardDialog::ShowPage( USHORT nLevel )
+{
+ if ( DeactivatePage() )
+ {
+ mnCurLevel = nLevel;
+ ActivatePage();
+ ImplShowTabPage( ImplGetPage( mnCurLevel ) );
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL WizardDialog::Finnish( long nResult )
+{
+ if ( DeactivatePage() )
+ {
+ if ( mpCurTabPage )
+ mpCurTabPage->DeactivatePage();
+
+ if ( IsInExecute() )
+ EndDialog( nResult );
+ else if ( GetStyle() & WB_CLOSEABLE )
+ Close();
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::AddPage( TabPage* pPage )
+{
+ ImplWizPageData* pNewPageData = new ImplWizPageData;
+ pNewPageData->mpNext = NULL;
+ pNewPageData->mpPage = pPage;
+
+ if ( !mpFirstPage )
+ mpFirstPage = pNewPageData;
+ else
+ {
+ ImplWizPageData* pPageData = mpFirstPage;
+ while ( pPageData->mpNext )
+ pPageData = pPageData->mpNext;
+ pPageData->mpNext = pNewPageData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::RemovePage( TabPage* pPage )
+{
+ ImplWizPageData* pPrevPageData = NULL;
+ ImplWizPageData* pPageData = mpFirstPage;
+ while ( pPageData )
+ {
+ if ( pPageData->mpPage == pPage )
+ {
+ if ( pPrevPageData )
+ pPrevPageData->mpNext = pPageData->mpNext;
+ else
+ mpFirstPage = pPageData->mpNext;
+ if ( pPage == mpCurTabPage )
+ mpCurTabPage = NULL;
+ delete pPageData;
+ return;
+ }
+
+ pPrevPageData = pPageData;
+ pPageData = pPageData->mpNext;
+ }
+
+ DBG_ERROR( "WizardDialog::RemovePage() - Page not in list" );
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::SetPage( USHORT nLevel, TabPage* pPage )
+{
+ USHORT nTempLevel = 0;
+ ImplWizPageData* pPageData = mpFirstPage;
+ while ( pPageData )
+ {
+ if ( (nTempLevel == nLevel) || !pPageData->mpNext )
+ break;
+
+ nTempLevel++;
+ pPageData = pPageData->mpNext;
+ }
+
+ if ( pPageData )
+ {
+ if ( pPageData->mpPage == mpCurTabPage )
+ mpCurTabPage = NULL;
+ pPageData->mpPage = pPage;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+TabPage* WizardDialog::GetPage( USHORT nLevel ) const
+{
+ USHORT nTempLevel = 0;
+ ImplWizPageData* pPageData = mpFirstPage;
+ while ( pPageData )
+ {
+ if ( nTempLevel == nLevel )
+ return pPageData->mpPage;
+
+ nTempLevel++;
+ pPageData = pPageData->mpNext;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::AddButton( Button* pButton, long nOffset )
+{
+ ImplWizButtonData* pNewBtnData = new ImplWizButtonData;
+ pNewBtnData->mpNext = NULL;
+ pNewBtnData->mpButton = pButton;
+ pNewBtnData->mnOffset = nOffset;
+
+ if ( !mpFirstBtn )
+ mpFirstBtn = pNewBtnData;
+ else
+ {
+ ImplWizButtonData* pBtnData = mpFirstBtn;
+ while ( pBtnData->mpNext )
+ pBtnData = pBtnData->mpNext;
+ pBtnData->mpNext = pNewBtnData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::RemoveButton( Button* pButton )
+{
+ ImplWizButtonData* pPrevBtnData = NULL;
+ ImplWizButtonData* pBtnData = mpFirstBtn;
+ while ( pBtnData )
+ {
+ if ( pBtnData->mpButton == pButton )
+ {
+ if ( pPrevBtnData )
+ pPrevBtnData->mpNext = pBtnData->mpNext;
+ else
+ mpFirstBtn = pBtnData->mpNext;
+ delete pBtnData;
+ return;
+ }
+
+ pPrevBtnData = pBtnData;
+ pBtnData = pBtnData->mpNext;
+ }
+
+ DBG_ERROR( "WizardDialog::RemoveButton() - Button not in list" );
+}
+
+// -----------------------------------------------------------------------
+
+void WizardDialog::ShowButtonFixedLine( BOOL bVisible )
+{
+ if ( !mpFixedLine )
+ {
+ if ( !bVisible )
+ return;
+
+ mpFixedLine = new FixedLine( this );
+ }
+
+ mpFixedLine->Show( bVisible );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL WizardDialog::IsButtonFixedLineVisible()
+{
+ return (mpFixedLine && mpFixedLine->IsVisible());
+}
diff --git a/svtools/source/edit/makefile.mk b/svtools/source/edit/makefile.mk
new file mode 100644
index 000000000000..b73818d70cb8
--- /dev/null
+++ b/svtools/source/edit/makefile.mk
@@ -0,0 +1,135 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=edit
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+CXXFILES= \
+ textdata.cxx \
+ textdoc.cxx \
+ texteng.cxx \
+ textundo.cxx \
+ textview.cxx \
+ txtattr.cxx \
+ xtextedt.cxx \
+ sychconv.cxx
+
+.IF "$(VCL)" != ""
+CXXFILES+= \
+ svmedit.cxx
+.ENDIF
+
+
+SLOFILES= \
+ $(SLO)$/textdata.obj \
+ $(SLO)$/textdoc.obj \
+ $(SLO)$/texteng.obj \
+ $(SLO)$/textundo.obj \
+ $(SLO)$/textview.obj \
+ $(SLO)$/txtattr.obj \
+ $(SLO)$/xtextedt.obj \
+ $(SLO)$/sychconv.obj
+
+.IF "$(VCL)" != ""
+SLOFILES+= \
+ $(SLO)$/svmedit.obj
+.ENDIF
+
+OBJFILES= \
+ $(OBJ)$/textdata.obj \
+ $(OBJ)$/textdoc.obj \
+ $(OBJ)$/texteng.obj \
+ $(OBJ)$/textundo.obj \
+ $(OBJ)$/textview.obj \
+ $(OBJ)$/txtattr.obj \
+ $(OBJ)$/xtextedt.obj \
+ $(OBJ)$/sychconv.obj
+
+.IF "$(VCL)" != ""
+OBJFILES+= \
+ $(OBJ)$/svmedit.obj
+.ENDIF
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= $(SLOFILES)
+
+LIB2TARGET= $(LB)$/$(TARGET).lib
+LIB2OBJFILES= $(OBJFILES)
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx
new file mode 100644
index 000000000000..29d293e734c7
--- /dev/null
+++ b/svtools/source/edit/svmedit.cxx
@@ -0,0 +1,1396 @@
+/*************************************************************************
+ *
+ * $RCSfile: svmedit.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <vcl/rc.h>
+#include <vcl/decoview.hxx>
+
+#include <svmedit.hxx>
+#include <xtextedt.hxx>
+#include <brdcst.hxx>
+#include <lstner.hxx>
+
+#ifndef _UNDO_HXX
+#include <undo.hxx>
+#endif
+
+
+// IDs erstmal aus VCL geklaut, muss mal richtig delivert werden...
+#define SV_MENU_EDIT_UNDO 1
+#define SV_MENU_EDIT_CUT 2
+#define SV_MENU_EDIT_COPY 3
+#define SV_MENU_EDIT_PASTE 4
+#define SV_MENU_EDIT_DELETE 5
+#define SV_MENU_EDIT_SELECTALL 6
+#define SV_MENU_EDIT_INSERTSYMBOL 7
+
+#ifndef _SV_SCRBAR_HXX //autogen
+#include <vcl/scrbar.hxx>
+#endif
+
+
+class TextWindow : public Window
+{
+private:
+ ExtTextEngine* mpExtTextEngine;
+ ExtTextView* mpExtTextView;
+
+ BOOL mbInMBDown;
+ BOOL mbFocusSelectionHide;
+ BOOL mbIgnoreTab;
+ BOOL mbActivePopup;
+
+public:
+ TextWindow( Window* pParent );
+ ~TextWindow();
+
+ ExtTextEngine* GetTextEngine() const { return mpExtTextEngine; }
+ ExtTextView* GetTextView() const { return mpExtTextView; }
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvent );
+
+ virtual BOOL QueryDrop( DropEvent& rEvt );
+ virtual BOOL Drop( const DropEvent& rEvt );
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ BOOL IsAutoFocusHide() const { return mbFocusSelectionHide; }
+ void SetAutoFocusHide( BOOL bAutoHide ) { mbFocusSelectionHide = bAutoHide; }
+
+ BOOL IsIgnoreTab() const { return mbIgnoreTab; }
+ void SetIgnoreTab( BOOL bIgnore ) { mbIgnoreTab = bIgnore; }
+};
+
+
+class ImpSvMEdit : public SfxListener
+{
+private:
+ MultiLineEdit* pSvMultiLineEdit;
+
+ TextWindow* mpTextWindow;
+ ScrollBar* mpHScrollBar;
+ ScrollBar* mpVScrollBar;
+ ScrollBarBox* mpScrollBox;
+
+ Point maTextWindowOffset;
+ ULONG mnTextWidth;
+
+protected:
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ void ImpInitScrollBars();
+ void ImpSetScrollBarRanges();
+ DECL_LINK( ScrollHdl, ScrollBar* );
+
+public:
+ ImpSvMEdit( MultiLineEdit* pSvMultiLineEdit, WinBits nWinStyle );
+ ~ImpSvMEdit();
+
+ void SetModified( BOOL bMod );
+ BOOL IsModified() const;
+
+ void SetReadOnly( BOOL bRdOnly );
+ BOOL IsReadOnly() const;
+
+ void SetMaxTextLen( ULONG nLen );
+ ULONG GetMaxTextLen() const;
+
+ void SetInsertMode( BOOL bInsert );
+ BOOL IsInsertMode() const;
+
+ void InsertText( const String& rStr );
+ String GetSelected() const;
+
+ void SetSelection( const Selection& rSelection );
+ Selection GetSelection() const;
+
+ void Cut();
+ void Copy();
+ void Paste();
+
+ void SetText( const String& rStr );
+ String GetText() const;
+ String GetTextLines() const;
+
+ void Resize();
+ void GetFocus();
+
+ BOOL HandleCommand( const CommandEvent& rCEvt );
+
+ void Enable( BOOL bEnable );
+
+ Size CalcMinimumSize() const;
+ Size CalcSize( USHORT nColumns, USHORT nLines ) const;
+ void GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const;
+
+ void SetAlign( WinBits nWinStyle );
+
+ TextWindow* GetTextWindow() { return mpTextWindow; }
+ ScrollBar* GetHScrollBar() { return mpHScrollBar; }
+ ScrollBar* GetVScrollBar() { return mpVScrollBar; }
+
+ void SetTextWindowOffset( const Point& rOffset );
+};
+
+
+ImpSvMEdit::ImpSvMEdit( MultiLineEdit* pEdt, WinBits nWinStyle )
+{
+ pSvMultiLineEdit = pEdt;
+
+ mnTextWidth = 0;
+
+ mpTextWindow = new TextWindow( pEdt );
+ mpHScrollBar = ( nWinStyle & WB_HSCROLL ) ? new ScrollBar( pEdt, WB_HSCROLL|WB_DRAG ) : NULL;
+ mpVScrollBar = ( nWinStyle & WB_VSCROLL ) ? new ScrollBar( pEdt, WB_VSCROLL|WB_DRAG ) : NULL;
+ mpScrollBox = ( mpVScrollBar && mpHScrollBar ) ? new ScrollBarBox( pEdt, WB_SIZEABLE ) : NULL;
+
+ SetAlign( nWinStyle );
+ StartListening( *mpTextWindow->GetTextEngine() );
+
+ if ( nWinStyle & WB_NOHIDESELECTION )
+ mpTextWindow->SetAutoFocusHide( FALSE );
+ else
+ mpTextWindow->SetAutoFocusHide( TRUE );
+
+ if ( nWinStyle & WB_READONLY )
+ mpTextWindow->GetTextView()->SetReadOnly( TRUE );
+
+ if ( nWinStyle & WB_IGNORETAB )
+ mpTextWindow->SetIgnoreTab( TRUE );
+
+ mpTextWindow->Show();
+ if ( mpHScrollBar )
+ {
+ mpHScrollBar->Show();
+ mpHScrollBar->SetScrollHdl( LINK( this, ImpSvMEdit, ScrollHdl ) );
+ }
+ if ( mpVScrollBar )
+ {
+ mpVScrollBar->Show();
+ mpVScrollBar->SetScrollHdl( LINK( this, ImpSvMEdit, ScrollHdl ) );
+ }
+ if ( mpScrollBox )
+ mpScrollBox->Show();
+
+ ImpInitScrollBars();
+}
+
+ImpSvMEdit::~ImpSvMEdit()
+{
+ EndListening( *mpTextWindow->GetTextEngine() );
+ delete mpTextWindow;
+ delete mpHScrollBar;
+ delete mpVScrollBar;
+ delete mpScrollBox;
+}
+
+void ImpSvMEdit::ImpSetScrollBarRanges()
+{
+ if ( mpVScrollBar )
+ {
+ ULONG nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
+ mpVScrollBar->SetRange( Range( 0, (long)nTextHeight ) );
+ }
+ if ( mpHScrollBar )
+ {
+// ULONG nTextWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
+ // Es gibt kein Notify bei Breiten-Aenderung...
+// ULONG nW = Max( (ULONG)mpTextWindow->GetOutputSizePixel().Width()*5, (ULONG)nTextWidth );
+// mpHScrollBar->SetRange( Range( 0, (long)nW ) );
+ mpHScrollBar->SetRange( Range( 0, (long)mnTextWidth ) );
+ }
+}
+
+void ImpSvMEdit::ImpInitScrollBars()
+{
+ static const sal_Unicode sampleText[] = { 'x', '\0' };
+ if ( mpHScrollBar || mpVScrollBar )
+ {
+ ImpSetScrollBarRanges();
+ Size aCharBox;
+ aCharBox.Width() = mpTextWindow->GetTextWidth( sampleText );
+ aCharBox.Height() = mpTextWindow->GetTextHeight();
+ Size aOutSz = mpTextWindow->GetOutputSizePixel();
+ if ( mpHScrollBar )
+ {
+ mpHScrollBar->SetVisibleSize( aOutSz.Width() );
+ mpHScrollBar->SetPageSize( aOutSz.Width() * 8 / 10 );
+ mpHScrollBar->SetLineSize( aCharBox.Width()*10 );
+ mpHScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().X() );
+ }
+ if ( mpVScrollBar )
+ {
+ mpVScrollBar->SetVisibleSize( aOutSz.Height() );
+ mpVScrollBar->SetPageSize( aOutSz.Height() * 8 / 10 );
+ mpVScrollBar->SetLineSize( aCharBox.Height() );
+ mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
+ }
+ }
+}
+
+IMPL_LINK( ImpSvMEdit, ScrollHdl, ScrollBar*, pCurScrollBar )
+{
+ long nDiffX = 0, nDiffY = 0;
+
+ if ( pCurScrollBar == mpVScrollBar )
+ nDiffY = mpTextWindow->GetTextView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
+ else if ( pCurScrollBar == mpHScrollBar )
+ nDiffX = mpTextWindow->GetTextView()->GetStartDocPos().X() - pCurScrollBar->GetThumbPos();
+
+ mpTextWindow->GetTextView()->Scroll( nDiffX, nDiffY );
+ // mpTextWindow->GetTextView()->ShowCursor( FALSE, TRUE );
+
+ return 0;
+}
+
+
+// void ImpSvMEdit::ImpModified()
+// {
+// // Wann wird das gerufen ?????????????????????
+// pSvMultiLineEdit->Modify();
+// }
+
+void ImpSvMEdit::SetAlign( WinBits nWinStyle )
+{
+ if ( nWinStyle & WB_CENTER )
+ mpTextWindow->GetTextEngine()->SetTextAlign( TXTALIGN_CENTER );
+ else if ( nWinStyle & WB_RIGHT )
+ mpTextWindow->GetTextEngine()->SetTextAlign( TXTALIGN_RIGHT );
+ else
+ mpTextWindow->GetTextEngine()->SetTextAlign( TXTALIGN_LEFT );
+}
+
+void ImpSvMEdit::SetTextWindowOffset( const Point& rOffset )
+{
+ maTextWindowOffset = rOffset;
+ Resize();
+}
+
+void ImpSvMEdit::SetModified( BOOL bMod )
+{
+ mpTextWindow->GetTextEngine()->SetModified( bMod );
+}
+
+BOOL ImpSvMEdit::IsModified() const
+{
+ return mpTextWindow->GetTextEngine()->IsModified();
+}
+
+void ImpSvMEdit::SetInsertMode( BOOL bInsert )
+{
+ mpTextWindow->GetTextView()->SetInsertMode( bInsert );
+}
+
+void ImpSvMEdit::SetReadOnly( BOOL bRdOnly )
+{
+ mpTextWindow->GetTextView()->SetReadOnly( bRdOnly );
+ // Farbe anpassen ???????????????????????????
+}
+
+BOOL ImpSvMEdit::IsReadOnly() const
+{
+ return mpTextWindow->GetTextView()->IsReadOnly();
+}
+
+void ImpSvMEdit::SetMaxTextLen( ULONG nLen )
+{
+ mpTextWindow->GetTextEngine()->SetMaxTextLen( nLen );
+}
+
+ULONG ImpSvMEdit::GetMaxTextLen() const
+{
+ return mpTextWindow->GetTextEngine()->GetMaxTextLen();
+}
+
+void ImpSvMEdit::InsertText( const String& rStr )
+{
+ mpTextWindow->GetTextView()->InsertText( rStr );
+}
+
+String ImpSvMEdit::GetSelected() const
+{
+ return mpTextWindow->GetTextView()->GetSelected();
+}
+
+void ImpSvMEdit::Resize()
+{
+ Size aSz = pSvMultiLineEdit->GetOutputSizePixel();
+ long nSBWidth = pSvMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSBWidth = pSvMultiLineEdit->CalcZoom( nSBWidth );
+
+ if ( mpHScrollBar )
+ aSz.Height() -= nSBWidth;
+ if ( mpVScrollBar )
+ aSz.Width() -= nSBWidth;
+
+ Size aTextWindowSz( aSz );
+ aTextWindowSz.Width() -= maTextWindowOffset.X();
+ aTextWindowSz.Height() -= maTextWindowOffset.Y();
+ mpTextWindow->SetPosSizePixel( maTextWindowOffset, aTextWindowSz );
+
+ if ( !mpHScrollBar )
+ mpTextWindow->GetTextEngine()->SetMaxTextWidth( aSz.Width() );
+
+ if ( mpHScrollBar )
+ mpHScrollBar->SetPosSizePixel( 0, aSz.Height(), aSz.Width(), nSBWidth );
+
+ if ( mpVScrollBar )
+ mpVScrollBar->SetPosSizePixel( aSz.Width(), 0, nSBWidth, aSz.Height() );
+
+ if ( mpScrollBox )
+ mpScrollBox->SetPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth );
+
+ ImpInitScrollBars();
+}
+
+void ImpSvMEdit::GetFocus()
+{
+ mpTextWindow->GrabFocus();
+}
+
+void ImpSvMEdit::Cut()
+{
+ if ( !mpTextWindow->GetTextView()->IsReadOnly() )
+ mpTextWindow->GetTextView()->Cut();
+}
+
+void ImpSvMEdit::Copy()
+{
+ mpTextWindow->GetTextView()->Copy();
+}
+
+void ImpSvMEdit::Paste()
+{
+ if ( !mpTextWindow->GetTextView()->IsReadOnly() )
+ mpTextWindow->GetTextView()->Paste();
+}
+
+void ImpSvMEdit::SetText( const String& rStr )
+{
+ BOOL bWasModified = mpTextWindow->GetTextEngine()->IsModified();
+ mpTextWindow->GetTextEngine()->SetText( rStr );
+ if ( !bWasModified )
+ mpTextWindow->GetTextEngine()->SetModified( FALSE );
+
+ mpTextWindow->GetTextView()->SetSelection( TextSelection() );
+}
+
+String ImpSvMEdit::GetText() const
+{
+ return mpTextWindow->GetTextEngine()->GetText();
+}
+
+String ImpSvMEdit::GetTextLines() const
+{
+ return mpTextWindow->GetTextEngine()->GetTextLines();
+}
+
+void ImpSvMEdit::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ if ( rHint.ISA( TextHint ) )
+ {
+ const TextHint& rTextHint = (const TextHint&)rHint;
+ if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED )
+ {
+ if ( mpHScrollBar )
+ mpHScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().X() );
+ if ( mpVScrollBar )
+ mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
+ {
+ if ( mpTextWindow->GetTextView()->GetStartDocPos().Y() )
+ {
+ long nOutHeight = mpTextWindow->GetOutputSizePixel().Height();
+ long nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
+ if ( nTextHeight < nOutHeight )
+ mpTextWindow->GetTextView()->Scroll( 0, mpTextWindow->GetTextView()->GetStartDocPos().Y() );
+ }
+
+ ImpSetScrollBarRanges();
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED )
+ {
+ if ( mpHScrollBar )
+ {
+ ULONG nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
+ if ( nWidth != mnTextWidth )
+ {
+ mnTextWidth = nWidth;
+ mpHScrollBar->SetRange( Range( 0, (long)mnTextWidth ) );
+ mpHScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().X() );
+ }
+ }
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_MODIFIED )
+ {
+ pSvMultiLineEdit->Modify();
+ }
+ }
+}
+
+void ImpSvMEdit::SetSelection( const Selection& rSelection )
+{
+ String aText = mpTextWindow->GetTextEngine()->GetText();
+
+ Selection aNewSelection( rSelection );
+ if ( aNewSelection.Min() < 0 )
+ aNewSelection.Min() = 0;
+ else if ( aNewSelection.Min() > aText.Len() )
+ aNewSelection.Min() = aText.Len();
+ if ( aNewSelection.Max() < 0 )
+ aNewSelection.Max() = 0;
+ else if ( aNewSelection.Max() > aText.Len() )
+ aNewSelection.Max() = aText.Len();
+
+ long nEnd = Max( aNewSelection.Min(), aNewSelection.Max() );
+ TextSelection aTextSel;
+ ULONG nPara = 0;
+ USHORT nChar = 0;
+ USHORT x = 0;
+ while ( x <= nEnd )
+ {
+ if ( x == aNewSelection.Min() )
+ aTextSel.GetStart() = TextPaM( nPara, nChar );
+ if ( x == aNewSelection.Max() )
+ aTextSel.GetEnd() = TextPaM( nPara, nChar );
+
+ if ( ( x < aText.Len() ) && ( aText.GetChar( x ) == '\n' ) )
+ {
+ nPara++;
+ nChar = 0;
+ }
+ else
+ nChar++;
+ x++;
+ }
+ mpTextWindow->GetTextView()->SetSelection( aTextSel );
+}
+
+Selection ImpSvMEdit::GetSelection() const
+{
+ Selection aSel;
+ TextSelection aTextSel( mpTextWindow->GetTextView()->GetSelection() );
+ aTextSel.Justify();
+ // Selektion flachklopfen => jeder Umbruch ein Zeichen...
+
+ ExtTextEngine* pExtTextEngine = mpTextWindow->GetTextEngine();
+ // Absaetze davor:
+ ULONG n;
+ for ( n = 0; n < aTextSel.GetStart().GetPara(); n++ )
+ {
+ aSel.Min() += pExtTextEngine->GetTextLen( n );
+ aSel.Min()++;
+ }
+
+ // Erster Absatz mit Selektion:
+ aSel.Max() = aSel.Min();
+ aSel.Min() += aTextSel.GetStart().GetIndex();
+
+ for ( n = aTextSel.GetStart().GetPara(); n < aTextSel.GetEnd().GetPara(); n++ )
+ {
+ aSel.Max() += pExtTextEngine->GetTextLen( n );
+ aSel.Max()++;
+ }
+
+ aSel.Max() += aTextSel.GetEnd().GetIndex();
+
+ return aSel;
+}
+
+Size ImpSvMEdit::CalcMinimumSize() const
+{
+ Size aSz( mpTextWindow->GetTextEngine()->CalcTextWidth(),
+ mpTextWindow->GetTextEngine()->GetTextHeight() );
+
+ if ( mpHScrollBar )
+ aSz.Height() += mpHScrollBar->GetSizePixel().Height();
+ if ( mpVScrollBar )
+ aSz.Width() += mpVScrollBar->GetSizePixel().Width();
+
+ return aSz;
+}
+
+Size ImpSvMEdit::CalcSize( USHORT nColumns, USHORT nLines ) const
+{
+ static const sal_Unicode sampleText[] = { 'X', '\0' };
+
+ Size aSz;
+ Size aCharSz;
+ aCharSz.Width() = mpTextWindow->GetTextWidth( sampleText );
+ aCharSz.Height() = mpTextWindow->GetTextHeight();
+
+ if ( nLines )
+ aSz.Height() = nLines*aCharSz.Height();
+ else
+ aSz.Height() = mpTextWindow->GetTextEngine()->GetTextHeight();
+
+ if ( nColumns )
+ aSz.Width() = nColumns*aCharSz.Width();
+ else
+ aSz.Width() = mpTextWindow->GetTextEngine()->CalcTextWidth();
+
+ if ( mpHScrollBar )
+ aSz.Height() += mpHScrollBar->GetSizePixel().Height();
+ if ( mpVScrollBar )
+ aSz.Width() += mpVScrollBar->GetSizePixel().Width();
+
+ return aSz;
+}
+
+void ImpSvMEdit::GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const
+{
+ static const sal_Unicode sampleText[] = { 'x', '\0' };
+ Size aOutSz = mpTextWindow->GetOutputSizePixel();
+ Size aCharSz( mpTextWindow->GetTextWidth( sampleText ), mpTextWindow->GetTextHeight() );
+ rnCols = (USHORT) (aOutSz.Width()/aCharSz.Width());
+ rnLines = (USHORT) (aOutSz.Height()/aCharSz.Height());
+}
+
+void ImpSvMEdit::Enable( BOOL bEnable )
+{
+ mpTextWindow->Enable( bEnable );
+ if ( mpHScrollBar )
+ mpHScrollBar->Enable( bEnable );
+ if ( mpVScrollBar )
+ mpVScrollBar->Enable( bEnable );
+}
+
+BOOL ImpSvMEdit::HandleCommand( const CommandEvent& rCEvt )
+{
+ BOOL bDone = FALSE;
+ if ( ( rCEvt.GetCommand() == COMMAND_WHEEL ) ||
+ ( rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL ) ||
+ ( rCEvt.GetCommand() == COMMAND_AUTOSCROLL ) )
+ {
+ mpTextWindow->HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar );
+ bDone = TRUE;
+ }
+ return bDone;
+}
+
+
+TextWindow::TextWindow( Window* pParent ) : Window( pParent )
+{
+ mbInMBDown = FALSE;
+ mbFocusSelectionHide = FALSE;
+ mbIgnoreTab = FALSE;
+ mbActivePopup = FALSE;
+
+ SetPointer( Pointer( POINTER_TEXT ) );
+
+ mpExtTextEngine = new ExtTextEngine;
+ mpExtTextEngine->SetMaxTextLen( STRING_MAXLEN );
+ mpExtTextView = new ExtTextView( mpExtTextEngine, this );
+ mpExtTextEngine->InsertView( mpExtTextView );
+ mpExtTextEngine->EnableUndo( TRUE );
+ mpExtTextView->ShowCursor();
+
+ Color aBackgroundColor = GetSettings().GetStyleSettings().GetWorkspaceColor();
+ SetBackground( aBackgroundColor );
+ pParent->SetBackground( aBackgroundColor );
+ EnableDrop( TRUE );
+}
+
+TextWindow::~TextWindow()
+{
+ delete mpExtTextView;
+ delete mpExtTextEngine;
+}
+
+void TextWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ mpExtTextView->MouseMove( rMEvt );
+ Window::MouseMove( rMEvt );
+}
+
+void TextWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ mbInMBDown = TRUE; // Dann im GetFocus nicht alles selektieren wird
+ mpExtTextView->MouseButtonDown( rMEvt );
+ Window::MouseButtonDown( rMEvt );
+ GrabFocus();
+ mbInMBDown = FALSE;
+}
+
+void TextWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ mpExtTextView->MouseButtonUp( rMEvt );
+ Window::MouseButtonUp( rMEvt );
+}
+
+void TextWindow::KeyInput( const KeyEvent& rKEvent )
+{
+ BOOL bDone = FALSE;
+ USHORT nCode = rKEvent.GetKeyCode().GetCode();
+ if ( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() )
+ {
+ mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) );
+ bDone = TRUE;
+ }
+ else if ( (nCode == KEY_S) && rKEvent.GetKeyCode().IsShift() && rKEvent.GetKeyCode().IsMod1() )
+ {
+ if ( Edit::GetGetSpecialCharsFunction() )
+ {
+ // Damit die Selektion erhalten bleibt
+ mbActivePopup = TRUE;
+ XubString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
+ if ( aChars.Len() )
+ {
+ mpExtTextView->InsertText( aChars );
+ mpExtTextView->GetTextEngine()->SetModified( TRUE );
+ }
+ mbActivePopup = FALSE;
+ bDone = TRUE;
+ }
+ }
+ else if ( nCode == KEY_TAB )
+ {
+ if ( !mbIgnoreTab || rKEvent.GetKeyCode().IsMod1() )
+ bDone = mpExtTextView->KeyInput( rKEvent );
+ }
+ else
+ {
+ bDone = mpExtTextView->KeyInput( rKEvent );
+ }
+
+ if ( !bDone )
+ Window::KeyInput( rKEvent );
+}
+
+void TextWindow::Paint( const Rectangle& rRect )
+{
+ mpExtTextView->Paint( rRect );
+}
+
+void TextWindow::Resize()
+{
+}
+
+void TextWindow::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ PopupMenu* pPopup = Edit::CreatePopupMenu();
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED )
+ pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES );
+ if ( !mpExtTextView->HasSelection() )
+ {
+ pPopup->EnableItem( SV_MENU_EDIT_CUT, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_COPY, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_DELETE, FALSE );
+ }
+ if ( mpExtTextView->IsReadOnly() )
+ {
+ pPopup->EnableItem( SV_MENU_EDIT_CUT, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_PASTE, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_DELETE, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_INSERTSYMBOL, FALSE );
+ }
+ if ( !mpExtTextView->GetTextEngine()->HasUndoManager() || !mpExtTextView->GetTextEngine()->GetUndoManager().GetUndoActionCount() )
+ {
+ pPopup->EnableItem( SV_MENU_EDIT_UNDO, FALSE );
+ }
+// if ( ( maSelection.Min() == 0 ) && ( maSelection.Max() == maText.Len() ) )
+// {
+// pPopup->EnableItem( SV_MENU_EDIT_SELECTALL, FALSE );
+// }
+ if ( !Edit::GetGetSpecialCharsFunction() )
+ {
+ USHORT nPos = pPopup->GetItemPos( SV_MENU_EDIT_INSERTSYMBOL );
+ pPopup->RemoveItem( nPos );
+ pPopup->RemoveItem( nPos-1 );
+ }
+
+ mbActivePopup = TRUE;
+ Point aPos = rCEvt.GetMousePosPixel();
+ if ( !rCEvt.IsMouseEvent() )
+ {
+ // !!! Irgendwann einmal Menu zentriert in der Selektion anzeigen !!!
+ Size aSize = GetOutputSizePixel();
+ aPos = Point( aSize.Width()/2, aSize.Height()/2 );
+ }
+// pPopup->RemoveDisabledEntries();
+ USHORT n = pPopup->Execute( this, aPos );
+ Edit::DeletePopupMenu( pPopup );
+ switch ( n )
+ {
+ case SV_MENU_EDIT_UNDO: mpExtTextView->Undo();
+ mpExtTextEngine->SetModified( TRUE );
+ mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
+ break;
+ case SV_MENU_EDIT_CUT: mpExtTextView->Cut();
+ mpExtTextEngine->SetModified( TRUE );
+ mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
+ break;
+ case SV_MENU_EDIT_COPY: mpExtTextView->Copy();
+ break;
+ case SV_MENU_EDIT_PASTE: mpExtTextView->Paste();
+ mpExtTextEngine->SetModified( TRUE );
+ mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
+ break;
+ case SV_MENU_EDIT_DELETE: mpExtTextView->DeleteSelected();
+ mpExtTextEngine->SetModified( TRUE );
+ mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
+ break;
+ case SV_MENU_EDIT_SELECTALL: mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
+ break;
+ case SV_MENU_EDIT_INSERTSYMBOL:
+ {
+ XubString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
+ if ( aChars.Len() )
+ {
+ mpExtTextView->InsertText( aChars );
+ mpExtTextEngine->SetModified( TRUE );
+ mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
+ }
+ }
+ break;
+ }
+ mbActivePopup = FALSE;
+ }
+ else
+ {
+ mpExtTextView->Command( rCEvt );
+ }
+ Window::Command( rCEvt );
+}
+
+void TextWindow::GetFocus()
+{
+ Window::GetFocus();
+ if ( !mbActivePopup )
+ {
+ BOOL bGotoCursor = !mpExtTextView->IsReadOnly();
+ if ( mbFocusSelectionHide && IsReallyVisible() && !mpExtTextView->IsReadOnly()
+ && ( !mbInMBDown || ( GetSettings().GetStyleSettings().GetSelectionOptions() & SELECTION_OPTION_FOCUS ) ) )
+ {
+ // Alles selektieren, aber nicht scrollen
+ BOOL bAutoScroll = mpExtTextView->IsAutoScroll();
+ mpExtTextView->SetAutoScroll( FALSE );
+ mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) );
+ mpExtTextView->SetAutoScroll( bAutoScroll );
+ bGotoCursor = FALSE;
+ }
+ mpExtTextView->SetPaintSelection( TRUE );
+ mpExtTextView->ShowCursor( bGotoCursor );
+ }
+}
+
+void TextWindow::LoseFocus()
+{
+ Window::LoseFocus();
+
+ if ( mbFocusSelectionHide && !mbActivePopup )
+ mpExtTextView->SetPaintSelection( FALSE );
+}
+
+BOOL TextWindow::QueryDrop( DropEvent& rEvt )
+{
+ return mpExtTextView->QueryDrop( rEvt );
+}
+
+BOOL TextWindow::Drop( const DropEvent& rEvt )
+{
+ return mpExtTextView->Drop( rEvt );
+}
+
+
+MultiLineEdit::MultiLineEdit( Window* pParent, WinBits nWinStyle )
+ : Edit( pParent, nWinStyle )
+{
+ SetType( WINDOW_MULTILINEEDIT );
+ pImpSvMEdit = new ImpSvMEdit( this, nWinStyle );
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ pUpdateDataTimer = 0;
+
+ SetCompoundControl( TRUE );
+ SetStyle( ImplInitStyle( nWinStyle ) );
+}
+
+MultiLineEdit::MultiLineEdit( Window* pParent, const ResId& rResId )
+ : Edit( pParent, rResId.SetRT( RSC_MULTILINEEDIT ) )
+{
+ SetType( WINDOW_MULTILINEEDIT );
+ WinBits nWinStyle = rResId.aWinBits;
+ pImpSvMEdit = new ImpSvMEdit( this, nWinStyle );
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ pUpdateDataTimer = 0;
+
+ USHORT nMaxLen = Edit::GetMaxTextLen();
+ if ( nMaxLen )
+ SetMaxTextLen( nMaxLen );
+
+ SetText( Edit::GetText() );
+
+ if ( IsVisible() )
+ pImpSvMEdit->Resize();
+
+ SetCompoundControl( TRUE );
+ SetStyle( ImplInitStyle( nWinStyle ) );
+}
+
+MultiLineEdit::~MultiLineEdit()
+{
+ delete pImpSvMEdit;
+ delete pUpdateDataTimer;
+}
+
+WinBits MultiLineEdit::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+
+ if ( !(nStyle & WB_IGNORETAB ))
+ nStyle |= WINDOW_DLGCTRL_MOD1TAB;
+
+ return nStyle;
+}
+
+
+void MultiLineEdit::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ // Der Font muss immer mit manipuliert werden, weil die TextEngine
+ // sich nicht um TextColor/Background kuemmert
+
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+
+ Font aFont = rStyleSettings.GetFieldFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ aFont.SetTransparent( FALSE );
+ SetZoomedPointFont( aFont );
+ Font TheFont = GetFont();
+ TheFont.SetColor( aTextColor );
+ TheFont.SetFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
+ pImpSvMEdit->GetTextWindow()->SetFont( TheFont );
+ pImpSvMEdit->GetTextWindow()->GetTextEngine()->SetFont( TheFont );
+ pImpSvMEdit->GetTextWindow()->SetTextColor( aTextColor );
+
+ if ( bBackground )
+ {
+ if( IsControlBackground() )
+ pImpSvMEdit->GetTextWindow()->SetBackground( GetControlBackground() );
+ else
+ pImpSvMEdit->GetTextWindow()->SetBackground( rStyleSettings.GetFieldColor() );
+ // Auch am MultiLineEdit einstellen, weil die TextComponent
+ // ggf. die Scrollbars hidet.
+ SetBackground( pImpSvMEdit->GetTextWindow()->GetBackground() );
+ }
+}
+
+void MultiLineEdit::Modify()
+{
+ aModifyHdlLink.Call( this );
+ if ( pUpdateDataTimer )
+ pUpdateDataTimer->Start();
+}
+
+IMPL_LINK( MultiLineEdit, ImpUpdateDataHdl, Timer*, EMPTYARG )
+{
+ UpdateData();
+ return 0;
+}
+
+void MultiLineEdit::UpdateData()
+{
+ aUpdateDataHdlLink.Call( this );
+}
+
+void MultiLineEdit::SetModifyFlag()
+{
+ pImpSvMEdit->SetModified( TRUE );
+}
+
+void MultiLineEdit::ClearModifyFlag()
+{
+ pImpSvMEdit->SetModified( TRUE );
+}
+
+BOOL MultiLineEdit::IsModified() const
+{
+ return pImpSvMEdit->IsModified();
+}
+
+void MultiLineEdit::EnableUpdateData( ULONG nTimeout )
+{
+ if ( !nTimeout )
+ DisableUpdateData();
+ else
+ {
+ if ( !pUpdateDataTimer )
+ {
+ pUpdateDataTimer = new Timer;
+ pUpdateDataTimer->SetTimeoutHdl( LINK( this, MultiLineEdit, ImpUpdateDataHdl ) );
+ }
+ pUpdateDataTimer->SetTimeout( nTimeout );
+ }
+}
+
+void MultiLineEdit::SetReadOnly( BOOL bReadOnly )
+{
+ pImpSvMEdit->SetReadOnly( bReadOnly );
+ Edit::SetReadOnly( bReadOnly );
+}
+
+BOOL MultiLineEdit::IsReadOnly() const
+{
+ return pImpSvMEdit->IsReadOnly();
+}
+
+void MultiLineEdit::SetMaxTextLen( ULONG nMaxLen )
+{
+ pImpSvMEdit->SetMaxTextLen( nMaxLen );
+}
+
+ULONG MultiLineEdit::GetMaxTextLen() const
+{
+ return pImpSvMEdit->GetMaxTextLen();
+}
+
+void MultiLineEdit::ReplaceSelected( const String& rStr )
+{
+ pImpSvMEdit->InsertText( rStr );
+}
+
+void MultiLineEdit::DeleteSelected()
+{
+ pImpSvMEdit->InsertText( String() );
+}
+
+String MultiLineEdit::GetSelected() const
+{
+ return pImpSvMEdit->GetSelected();
+}
+
+void MultiLineEdit::Cut()
+{
+ pImpSvMEdit->Cut();
+}
+
+void MultiLineEdit::Copy()
+{
+ pImpSvMEdit->Copy();
+}
+
+void MultiLineEdit::Paste()
+{
+ pImpSvMEdit->Paste();
+}
+
+void MultiLineEdit::SetText( const String& rStr )
+{
+ pImpSvMEdit->SetText( rStr );
+}
+
+String MultiLineEdit::GetText() const
+{
+ return pImpSvMEdit->GetText();
+}
+
+String MultiLineEdit::GetTextLines() const
+{
+ return pImpSvMEdit->GetTextLines();
+}
+
+void MultiLineEdit::Resize()
+{
+ pImpSvMEdit->Resize();
+}
+
+void MultiLineEdit::GetFocus()
+{
+ Edit::GetFocus();
+ pImpSvMEdit->GetFocus();
+}
+
+void MultiLineEdit::SetSelection( const Selection& rSelection )
+{
+ pImpSvMEdit->SetSelection( rSelection );
+}
+
+Selection MultiLineEdit::GetSelection() const
+{
+ return pImpSvMEdit->GetSelection();
+}
+
+Size MultiLineEdit::CalcMinimumSize() const
+{
+ Size aSz = pImpSvMEdit->CalcMinimumSize();
+
+ long nLeft, nTop, nRight, nBottom;
+ ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
+ aSz.Width() += nLeft+nRight;
+ aSz.Height() += nTop+nBottom;
+
+ return aSz;
+}
+
+Size MultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const
+{
+ Size aSz = rPrefSize;
+ long nLeft, nTop, nRight, nBottom;
+ ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
+
+ // In der Hoehe auf ganze Zeilen justieren
+
+ long nHeight = aSz.Height() - nTop - nBottom;
+ long nLineHeight = pImpSvMEdit->CalcSize( 1, 1 ).Height();
+ long nLines = nHeight / nLineHeight;
+ if ( nLines < 1 )
+ nLines = 1;
+
+ aSz.Height() = nLines * nLineHeight;
+ aSz.Height() += nTop+nBottom;
+
+ return aSz;
+}
+
+Size MultiLineEdit::CalcSize( USHORT nColumns, USHORT nLines ) const
+{
+ Size aSz = pImpSvMEdit->CalcSize( nColumns, nLines );
+
+ long nLeft, nTop, nRight, nBottom;
+ ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
+ aSz.Width() += nLeft+nRight;
+ aSz.Height() += nTop+nBottom;
+ return aSz;
+}
+
+void MultiLineEdit::GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const
+{
+ pImpSvMEdit->GetMaxVisColumnsAndLines( rnCols, rnLines );
+}
+
+void MultiLineEdit::StateChanged( StateChangedType nType )
+{
+ if( nType == STATE_CHANGE_ENABLE )
+ {
+ pImpSvMEdit->Enable( IsEnabled() );
+ }
+ else if( nType == STATE_CHANGE_READONLY )
+ {
+ pImpSvMEdit->SetReadOnly( IsReadOnly() );
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ pImpSvMEdit->GetTextWindow()->SetZoom( GetZoom() );
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Resize();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Resize();
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ pImpSvMEdit->SetAlign( GetStyle() );
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ }
+
+ Control::StateChanged( nType );
+}
+
+void MultiLineEdit::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Resize();
+ Invalidate();
+ }
+ else
+ Control::DataChanged( rDCEvt );
+}
+
+void MultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ ImplInitSettings( TRUE, TRUE, TRUE );
+
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Font aFont = pImpSvMEdit->GetTextWindow()->GetDrawPixelFont( pDev );
+ aFont.SetTransparent( TRUE );
+ OutDevType eOutDevType = pDev->GetOutDevType();
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ pDev->SetTextFillColor();
+
+ // Border/Background
+ pDev->SetLineColor();
+ pDev->SetFillColor();
+ BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER);
+ BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground();
+ if ( bBorder || bBackground )
+ {
+ Rectangle aRect( aPos, aSize );
+ if ( bBorder )
+ {
+ DecorationView aDecoView( pDev );
+ aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+ }
+ if ( bBackground )
+ {
+ pDev->SetFillColor( GetControlBackground() );
+ pDev->DrawRect( aRect );
+ }
+ }
+
+ // Inhalt
+ if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ {
+ if ( !(nFlags & WINDOW_DRAW_NODISABLE ) && !IsEnabled() )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ pDev->SetTextColor( rStyleSettings.GetDisableColor() );
+ }
+ else
+ {
+ pDev->SetTextColor( GetTextColor() );
+ }
+ }
+
+ XubString aText = GetText();
+ Size aTextSz( pDev->GetTextWidth( aText ), pDev->GetTextHeight() );
+ ULONG nLines = (ULONG) (aSize.Height() / aTextSz.Height());
+ if ( !nLines )
+ nLines = 1;
+ aTextSz.Height() = nLines*aTextSz.Height();
+ long nOnePixel = GetDrawPixel( pDev, 1 );
+ long nOffX = 3*nOnePixel;
+ long nOffY = 2*nOnePixel;
+
+ // Clipping?
+ if ( ( nOffY < 0 ) || ( (nOffY+aTextSz.Height()) > aSize.Height() ) || ( (nOffX+aTextSz.Width()) > aSize.Width() ) )
+ {
+ Rectangle aClip( aPos, aSize );
+ if ( aTextSz.Height() > aSize.Height() )
+ aClip.Bottom() += aTextSz.Height() - aSize.Height() + 1; // Damit HP-Drucker nicht 'weg-optimieren'
+ pDev->IntersectClipRegion( aClip );
+ }
+
+ TextEngine aTE;
+ aTE.SetText( GetText() );
+ aTE.SetMaxTextWidth( aSize.Width() );
+ aTE.SetFont( aFont );
+ aTE.SetTextAlign( pImpSvMEdit->GetTextWindow()->GetTextEngine()->GetTextAlign() );
+ aTE.Draw( pDev, Point( aPos.X() + nOffX, aPos.Y() + nOffY ) );
+
+ pDev->Pop();
+}
+
+long MultiLineEdit::Notify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+ if( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ nDone = pImpSvMEdit->HandleCommand( *rNEvt.GetCommandEvent() );
+ }
+ return nDone ? nDone : Edit::Notify( rNEvt );
+}
+
+long MultiLineEdit::PreNotify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+
+ if( ( rNEvt.GetType() == EVENT_KEYINPUT ) && ( !GetTextView()->IsCursorEnabled() ) )
+ {
+ const KeyEvent& rKEvent = *rNEvt.GetKeyEvent();
+ if ( !rKEvent.GetKeyCode().IsShift() && ( rKEvent.GetKeyCode().GetGroup() == KEYGROUP_CURSOR ) )
+ {
+ nDone = 1;
+ TextSelection aSel = pImpSvMEdit->GetTextWindow()->GetTextView()->GetSelection();
+ if ( aSel.HasRange() )
+ {
+ aSel.GetStart() = aSel.GetEnd();
+ pImpSvMEdit->GetTextWindow()->GetTextView()->SetSelection( aSel );
+ }
+ else
+ {
+ switch ( rKEvent.GetKeyCode().GetCode() )
+ {
+ case KEY_UP:
+ {
+ if ( pImpSvMEdit->GetVScrollBar() )
+ pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_LINEUP );
+ }
+ break;
+ case KEY_DOWN:
+ {
+ if ( pImpSvMEdit->GetVScrollBar() )
+ pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_LINEDOWN );
+ }
+ break;
+ case KEY_PAGEUP :
+ {
+ if ( pImpSvMEdit->GetVScrollBar() )
+ pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_PAGEUP );
+ }
+ break;
+ case KEY_PAGEDOWN:
+ {
+ if ( pImpSvMEdit->GetVScrollBar() )
+ pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_PAGEDOWN );
+ }
+ break;
+ case KEY_LEFT:
+ {
+ if ( pImpSvMEdit->GetHScrollBar() )
+ pImpSvMEdit->GetHScrollBar()->DoScrollAction( SCROLL_LINEUP );
+ }
+ break;
+ case KEY_RIGHT:
+ {
+ if ( pImpSvMEdit->GetHScrollBar() )
+ pImpSvMEdit->GetHScrollBar()->DoScrollAction( SCROLL_LINEDOWN );
+ }
+ break;
+ case KEY_HOME:
+ {
+ if ( rKEvent.GetKeyCode().IsMod1() )
+ pImpSvMEdit->GetTextWindow()->GetTextView()->
+ SetSelection( TextSelection( TextPaM( 0, 0 ) ) );
+ }
+ break;
+ case KEY_END:
+ {
+ if ( rKEvent.GetKeyCode().IsMod1() )
+ pImpSvMEdit->GetTextWindow()->GetTextView()->
+ SetSelection( TextSelection( TextPaM( 0xFFFF, 0xFFFF ) ) );
+ }
+ break;
+ default:
+ {
+ nDone = 0;
+ }
+ }
+ }
+ }
+ }
+
+ return nDone ? nDone : Edit::PreNotify( rNEvt );
+}
+
+//
+// Internas fuer abgeleitete Klassen, z.B. TextComponent
+
+ExtTextEngine* MultiLineEdit::GetTextEngine() const
+{
+ return pImpSvMEdit->GetTextWindow()->GetTextEngine();
+}
+
+ExtTextView* MultiLineEdit::GetTextView() const
+{
+ return pImpSvMEdit->GetTextWindow()->GetTextView();
+}
+
+ScrollBar* MultiLineEdit::GetHScrollBar() const
+{
+ return pImpSvMEdit->GetHScrollBar();
+}
+
+
+ScrollBar* MultiLineEdit::GetVScrollBar() const
+{
+ return pImpSvMEdit->GetVScrollBar();
+}
+
+void MultiLineEdit::EnableFocusSelectionHide( BOOL bHide )
+{
+ pImpSvMEdit->GetTextWindow()->SetAutoFocusHide( bHide );
+}
+
+BOOL MultiLineEdit::IsFocusSelectionHideEnabled() const
+{
+ return pImpSvMEdit->GetTextWindow()->IsAutoFocusHide();
+}
diff --git a/svtools/source/edit/sychconv.cxx b/svtools/source/edit/sychconv.cxx
new file mode 100644
index 000000000000..e9bae812c5a5
--- /dev/null
+++ b/svtools/source/edit/sychconv.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: sychconv.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SYCHCONV_HXX
+#include "sychconv.hxx"
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <vcl/outdev.hxx>
+#endif
+
+const BOOL SymCharConverter::Convert( Font& rFont, UniString& rString, OutputDevice* pDev )
+{
+ // hibyte 0 = exact matching
+ // 1 = little differences,
+ // 2 = the converted character does not look like the original but got the same meaning
+ // 3 = the destination does not match looking and meaning of the original
+
+ static USHORT __READONLY_DATA aWingdingsToStarBatsTable[ 256 - 32 ] =
+ {
+ 0x0020, 0x0238, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0174, 0x02BA, 0x017B, 0x017C, 0x037C, 0x037C, 0x037C, 0x037C,
+ 0x0000, 0x0000, 0x0372, 0x0272, 0x0372, 0x0000, 0x0000, 0x0374, 0x0279, 0x0000, 0x027A, 0x0000, 0x0178, 0x0278, 0x0000, 0x0137,
+ 0x027E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x017D, 0x0000, 0x0000, 0x0000, 0x0021, 0x03AC, 0x00AD, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x01C0, 0x0000, 0x0000, 0x0286, 0x0286, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0022, 0x0023, 0x0024, 0x0025,
+ 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x0133, 0x0000, 0x0000, 0x0000, 0x0000, 0x0193, 0x0194, 0x0000,
+ 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x005C, 0x005D, 0x005E, 0x005F, 0x0060,
+ 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01A5, 0x0095,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x002E, 0x0000, 0x0125, 0x0000, 0x0000, 0x0000, 0x014B, 0x024D, 0x014E, 0x014A,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x002F, 0x0000, 0x0000, 0x0000, 0x0035, 0x0000, 0x0000, 0x0000,
+ 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0031, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01B1,
+ 0x01AF, 0x01B2, 0x01B0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0150, 0x0032, 0x0033, 0x0034, 0x01C8
+ };
+
+ static USHORT __READONLY_DATA aMonotypeSortsToStarBatsTable[ 256 - 32 ]=
+ {
+ 0x0020, 0x00cb, 0x00cb, 0x00cb, 0x00cb, 0x0074, 0x00ba, 0x0021, 0x00cc, 0x007b, 0x0036, 0x007d, 0x007e, 0x0037, 0x0038, 0x0038,
+ 0x0039, 0x0038, 0x0038, 0x0039, 0x003a, 0x004f, 0x0050, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0086, 0x0086, 0x0086,
+ 0x0052, 0x00cd, 0x0044, 0x0045, 0x0046, 0x0047, 0x0041, 0x0041, 0x0058, 0x0057, 0x0075, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059,
+ 0x005a, 0x004b, 0x004b, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004e, 0x004b, 0x004b, 0x00ce, 0x00ce, 0x00ce,
+ 0x00ce, 0x00ce, 0x00ce, 0x00ce, 0x00cf, 0x00cf, 0x00cf, 0x00cf, 0x00cf, 0x00cf, 0x00b9, 0x00b9, 0x003b, 0x003c, 0x003d, 0x003e,
+ 0x003f, 0x003e, 0x0040, 0x00c5, 0x00c4, 0x002b, 0x002c, 0x00d0, 0x00d1, 0x00d1, 0x00d1, 0x0091, 0x0092, 0x0093, 0x0094, 0x0000,
+ 0x00d2, 0x00d3, 0x00d2, 0x00d3, 0x00d2, 0x00d3, 0x00d2, 0x00d3, 0x00d2, 0x00d3, 0x00d2, 0x00d3, 0x00d2, 0x00d3, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x00d4, 0x00d4, 0x00d4, 0x00d6, 0x00d6, 0x00d4, 0x00d4, 0x00d5, 0x002a, 0x00d6, 0x00d7, 0x0068, 0x0069, 0x006a, 0x006b,
+ 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066,
+ 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062,
+ 0x0063, 0x0064, 0x0065, 0x0066, 0x0030, 0x0031, 0x00d8, 0x00d9, 0x00da, 0x00bc, 0x00db, 0x00bc, 0x00bc, 0x00bc, 0x00bc, 0x0031,
+ 0x0031, 0x0031, 0x002f, 0x002f, 0x002f, 0x00be, 0x00be, 0x0031, 0x0031, 0x00af, 0x00af, 0x00af, 0x00af, 0x00af, 0x00af, 0x00af,
+ 0x0000, 0x00af, 0x0035, 0x00dc, 0x00da, 0x00dc, 0x00db, 0x00da, 0x00dc, 0x00db, 0x00dc, 0x00dc, 0x00dc, 0x00dc, 0x00af, 0x0000
+ };
+
+ const USHORT* pTransTable = NULL;
+
+ BOOL bIsAvailable = ( pDev ) ? pDev->IsFontAvailable( rFont.GetName() ) : FALSE;
+ if ( !bIsAvailable )
+ {
+ if ( rFont.GetName().CompareToAscii( RTL_CONSTASCII_STRINGPARAM( "Wingdings" ) ) == COMPARE_EQUAL )
+ pTransTable = &aWingdingsToStarBatsTable[ 0 ];
+ else if ( rFont.GetName().CompareToAscii( RTL_CONSTASCII_STRINGPARAM( "Monotype Sorts" ) ) == COMPARE_EQUAL )
+ pTransTable = &aMonotypeSortsToStarBatsTable[ 0 ];
+ }
+ if ( pTransTable )
+ {
+ sal_Unicode c;
+ for ( UINT16 i = rString.Len(); i--; )
+ {
+ c = rString.GetChar( i );
+ c -= 32;
+ c = ( ((UINT16)c) >= 224 ) ? 0 : (sal_Unicode) pTransTable[ c ];
+ if ( !c ) // if character is out of range or not matching
+ c = 0xA5; // we will default a StarBats-Bullet
+ rString.SetChar( i, c );
+ }
+ rFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ rFont.SetName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarBats" ) ) );
+ return TRUE;
+ }
+ else return FALSE;
+};
diff --git a/svtools/source/edit/textdat2.hxx b/svtools/source/edit/textdat2.hxx
new file mode 100644
index 000000000000..f96ec1890291
--- /dev/null
+++ b/svtools/source/edit/textdat2.hxx
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * $RCSfile: textdat2.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _TEXTDAT2_HXX
+#define _TEXTDAT2_HXX
+
+#ifndef _SVARRAY_HXX
+#include <svarray.hxx>
+#endif
+
+#ifndef _LIST_HXX //autogen
+#include <tools/list.hxx>
+#endif
+
+#ifndef _SV_SELENG_HXX //autogen
+#include <vcl/seleng.hxx>
+#endif
+
+#ifndef _SV_VIRDEV_HXX //autogen
+#include <vcl/virdev.hxx>
+#endif
+
+#ifndef _SV_CURSOR_HXX
+#include <vcl/cursor.hxx>
+#endif
+
+class TextNode;
+class TextView;
+
+#define PORTIONKIND_TEXT 0
+#define PORTIONKIND_TAB 1
+
+#define DELMODE_SIMPLE 0
+#define DELMODE_RESTOFWORD 1
+#define DELMODE_RESTOFCONTENT 2
+
+#define DEL_LEFT 1
+#define DEL_RIGHT 2
+#define TRAVEL_X_DONTKNOW 0xFFFF
+#define MAXCHARSINPARA 0x3FFF-CHARPOSGROW
+
+#define LINE_SEP 0x0A
+
+
+class TextPortion
+{
+private:
+ USHORT nLen;
+ long nWidth;
+ BYTE nKind;
+
+ TextPortion() { nLen = 0; nKind = PORTIONKIND_TEXT; nWidth = -1;}
+
+public:
+ TextPortion( USHORT nL ) {
+ nLen = nL;
+ nKind = PORTIONKIND_TEXT;
+ nWidth= -1;
+ }
+
+ USHORT GetLen() const { return nLen; }
+ USHORT& GetLen() { return nLen; }
+
+ long GetWidth()const { return nWidth; }
+ long& GetWidth() { return nWidth; }
+
+ BYTE GetKind() const { return nKind; }
+ BYTE& GetKind() { return nKind; }
+
+ BOOL HasValidSize() const { return nWidth != (-1); }
+};
+
+
+
+typedef TextPortion* TextPortionPtr;
+SV_DECL_PTRARR( TextPortionArray, TextPortionPtr, 0, 8 );
+
+class TETextPortionList : public TextPortionArray
+{
+public:
+ TETextPortionList();
+ ~TETextPortionList();
+
+ void Reset();
+ USHORT FindPortion( USHORT nCharPos, USHORT& rPortionStart );
+ void DeleteFromPortion( USHORT nDelFrom );
+};
+
+
+
+class TextLine
+{
+private:
+ USHORT mnStart;
+ USHORT mnEnd;
+ USHORT mnStartPortion;
+ USHORT mnEndPortion;
+
+ short mnStartX;
+
+ BOOL mbInvalid; // fuer geschickte Formatierung/Ausgabe
+
+public:
+ TextLine() {
+ mnStart = mnEnd = 0;
+ mnStartPortion = mnEndPortion = 0;
+ mnStartX = 0;
+ mbInvalid = TRUE;
+ }
+
+ BOOL IsIn( USHORT nIndex ) const
+ { return ( (nIndex >= mnStart ) && ( nIndex < mnEnd ) ); }
+
+ BOOL IsIn( USHORT nIndex, BOOL bInclEnd ) const
+ { return ( ( nIndex >= mnStart ) && ( bInclEnd ? ( nIndex <= mnEnd ) : ( nIndex < mnEnd ) ) ); }
+
+ void SetStart( USHORT n ) { mnStart = n; }
+ USHORT GetStart() const { return mnStart; }
+ USHORT& GetStart() { return mnStart; }
+
+ void SetEnd( USHORT n ) { mnEnd = n; }
+ USHORT GetEnd() const { return mnEnd; }
+ USHORT& GetEnd() { return mnEnd; }
+
+ void SetStartPortion( USHORT n ) { mnStartPortion = n; }
+ USHORT GetStartPortion() const { return mnStartPortion; }
+ USHORT& GetStartPortion() { return mnStartPortion; }
+
+ void SetEndPortion( USHORT n ) { mnEndPortion = n; }
+ USHORT GetEndPortion() const { return mnEndPortion; }
+ USHORT& GetEndPortion() { return mnEndPortion; }
+
+ USHORT GetLen() const { return mnEnd - mnStart; }
+
+ BOOL IsInvalid() const { return mbInvalid; }
+ BOOL IsValid() const { return !mbInvalid; }
+ void SetInvalid() { mbInvalid = TRUE; }
+ void SetValid() { mbInvalid = FALSE; }
+
+ BOOL IsEmpty() const { return (mnEnd > mnStart) ? FALSE : TRUE; }
+
+ short GetStartX() const { return mnStartX; }
+ void SetStartX( short n ) { mnStartX = n; }
+
+ inline BOOL operator == ( const TextLine& rLine ) const;
+ inline BOOL operator != ( const TextLine& rLine ) const;
+};
+
+typedef TextLine* TextLinePtr;
+SV_DECL_PTRARR_DEL( TextLines, TextLinePtr, 1, 4 );
+
+inline BOOL TextLine::operator == ( const TextLine& rLine ) const
+{
+ return ( ( mnStart == rLine.mnStart ) &&
+ ( mnEnd == rLine.mnEnd ) &&
+ ( mnStartPortion == rLine.mnStartPortion ) &&
+ ( mnEndPortion == rLine.mnEndPortion ) );
+}
+
+inline BOOL TextLine::operator != ( const TextLine& rLine ) const
+{
+ return !( *this == rLine );
+}
+
+
+
+class TEParaPortion
+{
+private:
+ TextNode* mpNode;
+
+ TextLines maLines;
+ TETextPortionList maTextPortions;
+
+ USHORT mnInvalidPosStart;
+ short mnInvalidDiff;
+
+ BOOL mbInvalid;
+ BOOL mbSimple; // nur lineares Tippen
+
+
+ TEParaPortion( const TEParaPortion& ) {;}
+
+public:
+ TEParaPortion( TextNode* pNode );
+ ~TEParaPortion();
+
+
+ BOOL IsInvalid() const { return mbInvalid; }
+ BOOL IsSimpleInvalid() const { return mbSimple; }
+ void SetNotSimpleInvalid() { mbSimple = FALSE; }
+ void SetValid() { mbInvalid = FALSE; mbSimple = TRUE;}
+
+ void MarkInvalid( USHORT nStart, short nDiff);
+ void MarkSelectionInvalid( USHORT nStart, USHORT nEnd );
+
+ USHORT GetInvalidPosStart() const { return mnInvalidPosStart; }
+ short GetInvalidDiff() const { return mnInvalidDiff; }
+
+ TextNode* GetNode() const { return mpNode; }
+ TextLines& GetLines() { return maLines; }
+ TETextPortionList& GetTextPortions() { return maTextPortions; }
+
+ USHORT GetLineNumber( USHORT nIndex, BOOL bInclEnd );
+ void CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLine );
+};
+
+
+
+
+DECLARE_LIST( DummyTEParaPortionList, TEParaPortion* );
+
+class TEParaPortions : public DummyTEParaPortionList
+{
+public:
+ TEParaPortions();
+ ~TEParaPortions();
+
+ void Reset();
+// long GetYOffset( TEParaPortion* pPPortion );
+// USHORT FindParagraph( long nYOffset );
+};
+
+
+class TextSelFunctionSet: public FunctionSet
+{
+private:
+ TextView* mpView;
+
+public:
+ TextSelFunctionSet( TextView* pView );
+
+ virtual void BeginDrag();
+
+ virtual void CreateAnchor();
+
+ virtual BOOL SetCursorAtPoint( const Point& rPointPixel, BOOL bDontSelectAtCursor = FALSE );
+
+ virtual BOOL IsSelectionAtPoint( const Point& rPointPixel );
+ virtual void DeselectAll();
+
+ virtual void DeselectAtPoint( const Point& );
+ virtual void DestroyAnchor();
+};
+
+
+class IdleFormatter : public Timer
+{
+private:
+ TextView* mpView;
+ USHORT mnRestarts;
+
+public:
+ IdleFormatter();
+ ~IdleFormatter();
+
+ void DoIdleFormat( TextView* pV );
+ void ForceTimeout();
+ void ResetRestarts() { mnRestarts = 0; }
+ TextView* GetView() { return mpView; }
+};
+
+struct TextDDInfo
+{
+ Cursor maCursor;
+ TextPaM maDropPos;
+
+ BOOL mbStarterOfDD;
+ BOOL mbVisCursor;
+
+ TextDDInfo()
+ {
+ maCursor.SetStyle( CURSOR_SHADOW );
+ mbStarterOfDD = FALSE;
+ mbVisCursor = FALSE;
+ }
+};
+
+#endif // _TEXTDAT2_HXX
diff --git a/svtools/source/edit/textdata.cxx b/svtools/source/edit/textdata.cxx
new file mode 100644
index 000000000000..3b995edfbe50
--- /dev/null
+++ b/svtools/source/edit/textdata.cxx
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * $RCSfile: textdata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <textdata.hxx>
+#include <textdat2.hxx>
+
+#include <tools/debug.hxx>
+
+SV_IMPL_PTRARR( TextLines, TextLinePtr );
+
+
+ // -------------------------------------------------------------------------
+// (+) class TextSelection
+// -------------------------------------------------------------------------
+
+TextSelection::TextSelection()
+{
+}
+
+TextSelection::TextSelection( const TextPaM& rPaM ) :
+ maStartPaM( rPaM ), maEndPaM( rPaM )
+{
+}
+
+TextSelection::TextSelection( const TextPaM& rStart, const TextPaM& rEnd ) :
+ maStartPaM( rStart ), maEndPaM( rEnd )
+{
+}
+
+void TextSelection::Justify()
+{
+ if ( maEndPaM < maStartPaM )
+ {
+ TextPaM aTemp( maStartPaM );
+ maStartPaM = maEndPaM;
+ maEndPaM = aTemp;
+ }
+}
+
+
+ // -------------------------------------------------------------------------
+// (+) class TETextPortionList
+// -------------------------------------------------------------------------
+TETextPortionList::TETextPortionList()
+{
+}
+
+TETextPortionList::~TETextPortionList()
+{
+ Reset();
+}
+
+void TETextPortionList::Reset()
+{
+ for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
+ delete GetObject( nPortion );
+ Remove( 0, Count() );
+}
+
+void TETextPortionList::DeleteFromPortion( USHORT nDelFrom )
+{
+ DBG_ASSERT( ( nDelFrom < Count() ) || ( (nDelFrom == 0) && (Count() == 0) ), "DeleteFromPortion: Out of range" );
+ for ( USHORT nP = nDelFrom; nP < Count(); nP++ )
+ delete GetObject( nP );
+ Remove( nDelFrom, Count()-nDelFrom );
+}
+
+USHORT TETextPortionList::FindPortion( USHORT nCharPos, USHORT& nPortionStart )
+{
+ // Bei nCharPos an Portion-Grenze wird die linke Portion gefunden
+ USHORT nTmpPos = 0;
+ for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
+ {
+ TextPortion* pPortion = GetObject( nPortion );
+ nTmpPos += pPortion->GetLen();
+ if ( nTmpPos >= nCharPos )
+ {
+ nPortionStart = nTmpPos - pPortion->GetLen();
+ return nPortion;
+ }
+ }
+ DBG_ERROR( "FindPortion: Nicht gefunden!" );
+ return ( Count() - 1 );
+}
+
+ // -------------------------------------------------------------------------
+// (+) class TEParaPortion
+// -------------------------------------------------------------------------
+TEParaPortion::TEParaPortion( TextNode* pN )
+{
+ mpNode = pN;
+ mnInvalidPosStart = mnInvalidDiff = 0;
+ mbInvalid = TRUE;
+ mbSimple = FALSE;
+}
+
+TEParaPortion::~TEParaPortion()
+{
+}
+
+void TEParaPortion::MarkInvalid( USHORT nStart, short nDiff )
+{
+ if ( mbInvalid == FALSE )
+ {
+ mnInvalidPosStart = ( nDiff >= 0 ) ? nStart : ( nStart + nDiff );
+ mnInvalidDiff = nDiff;
+ }
+ else
+ {
+ // Einfaches hintereinander tippen
+ if ( ( nDiff > 0 ) && ( mnInvalidDiff > 0 ) &&
+ ( ( mnInvalidPosStart+mnInvalidDiff ) == nStart ) )
+ {
+ mnInvalidDiff += nDiff;
+ }
+ // Einfaches hintereinander loeschen
+ else if ( ( nDiff < 0 ) && ( mnInvalidDiff < 0 ) && ( mnInvalidPosStart == nStart ) )
+ {
+ mnInvalidPosStart += nDiff;
+ mnInvalidDiff += nDiff;
+ }
+ else
+ {
+ DBG_ASSERT( ( nDiff >= 0 ) || ( (nStart+nDiff) >= 0 ), "MarkInvalid: Diff out of Range" );
+ mnInvalidPosStart = Min( mnInvalidPosStart, (USHORT) ( (nDiff < 0) ? nStart+nDiff : nDiff ) );
+ mnInvalidDiff = 0;
+ mbSimple = FALSE;
+ }
+ }
+ mbInvalid = TRUE;
+}
+
+void TEParaPortion::MarkSelectionInvalid( USHORT nStart, USHORT nEnd )
+{
+ if ( mbInvalid == FALSE )
+ {
+ mnInvalidPosStart = nStart;
+// nInvalidPosEnd = nEnd;
+ }
+ else
+ {
+ mnInvalidPosStart = Min( mnInvalidPosStart, nStart );
+// nInvalidPosEnd = pNode->Len();
+ }
+ mnInvalidDiff = 0;
+ mbInvalid = TRUE;
+ mbSimple = FALSE;
+}
+
+USHORT TEParaPortion::GetLineNumber( USHORT nChar, BOOL bInclEnd )
+{
+ for ( USHORT nLine = 0; nLine < maLines.Count(); nLine++ )
+ {
+ TextLine* pLine = maLines.GetObject( nLine );
+ if ( ( bInclEnd && ( pLine->GetEnd() >= nChar ) ) ||
+ ( pLine->GetEnd() > nChar ) )
+ {
+ return nLine;
+ }
+ }
+
+ // Dann sollte es am Ende der letzten Zeile sein!
+ DBG_ASSERT( nChar == maLines[ maLines.Count() - 1 ]->GetEnd(), "Index voll daneben!" );
+ DBG_ASSERT( !bInclEnd, "Zeile nicht gefunden: FindLine" );
+ return ( maLines.Count() - 1 );
+}
+
+
+void TEParaPortion::CorrectValuesBehindLastFormattedLine( USHORT nLastFormattedLine )
+{
+ USHORT nLines = maLines.Count();
+ DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Leere Portion?" );
+ if ( nLastFormattedLine < ( nLines - 1 ) )
+ {
+ const TextLine* pLastFormatted = maLines[ nLastFormattedLine ];
+ const TextLine* pUnformatted = maLines[ nLastFormattedLine+1 ];
+ short nPortionDiff = pUnformatted->GetStartPortion() - pLastFormatted->GetEndPortion();
+ short nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd();
+ nTextDiff++; // LastFormatted->GetEnd() war incl. => 1 zuviel abgezogen!
+
+ // Die erste unformatierte muss genau eine Portion hinter der letzten der
+ // formatierten beginnen:
+ // Wenn in der geaenderten Zeile eine Portion gesplittet wurde,
+ // kann nLastEnd > nNextStart sein!
+ short nPDiff = -( nPortionDiff-1 );
+ short nTDiff = -( nTextDiff-1 );
+ if ( nPDiff || nTDiff )
+ {
+ for ( USHORT nL = nLastFormattedLine+1; nL < nLines; nL++ )
+ {
+ TextLine* pLine = maLines[ nL ];
+
+ pLine->GetStartPortion() += nPDiff;
+ pLine->GetEndPortion() += nPDiff;
+
+ pLine->GetStart() += nTDiff;
+ pLine->GetEnd() += nTDiff;
+
+ pLine->SetValid();
+ }
+ }
+ }
+}
+
+ // -------------------------------------------------------------------------
+// (+) class TEParaPortions
+// -------------------------------------------------------------------------
+TEParaPortions::TEParaPortions()
+{
+}
+
+TEParaPortions::~TEParaPortions()
+{
+ Reset();
+}
+
+void TEParaPortions::Reset()
+{
+ for ( USHORT nPortion = 0; nPortion < Count(); nPortion++ )
+ delete GetObject( nPortion );
+ Clear();
+}
+
+ // -------------------------------------------------------------------------
+// (+) class IdleFormatter
+// -------------------------------------------------------------------------
+IdleFormatter::IdleFormatter()
+{
+ mpView = 0;
+ mnRestarts = 0;
+}
+
+IdleFormatter::~IdleFormatter()
+{
+ mpView = 0;
+}
+
+void IdleFormatter::DoIdleFormat( TextView* pV )
+{
+ mpView = pV;
+
+ if ( IsActive() )
+ mnRestarts++;
+
+ if ( mnRestarts > 4 )
+ ForceTimeout();
+ else
+ Start();
+}
+
+void IdleFormatter::ForceTimeout()
+{
+ if ( IsActive() )
+ {
+ Stop();
+ ((Link&)GetTimeoutHdl()).Call( this );
+ }
+}
+
+TYPEINIT1( TextHint, SfxSimpleHint );
+
+TextHint::TextHint( ULONG nId ) : SfxSimpleHint( nId )
+{
+ mnValue = 0;
+}
+
+TextHint::TextHint( ULONG nId, ULONG nValue ) : SfxSimpleHint( nId )
+{
+ mnValue = nValue;
+}
+
diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx
new file mode 100644
index 000000000000..f9e651808011
--- /dev/null
+++ b/svtools/source/edit/textdoc.cxx
@@ -0,0 +1,1073 @@
+/*************************************************************************
+ *
+ * $RCSfile: textdoc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <textdoc.hxx>
+
+#include <stdlib.h>
+
+SV_IMPL_PTRARR( TextCharAttribs, TextCharAttribPtr );
+
+
+
+// Vergleichmethode wird von QuickSort gerufen...
+
+EXTERN_C
+#if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC ))
+int _stdcall
+#else
+#ifdef WNT
+#if _MSC_VER >= 1200
+int __cdecl
+#else
+int _cdecl
+#endif
+#else
+int
+#endif
+#endif
+
+CompareStart( const void* pFirst, const void* pSecond )
+{
+ if ( (*((TextCharAttrib**)pFirst))->GetStart() < (*((TextCharAttrib**)pSecond))->GetStart() )
+ return (-1);
+ else if ( (*((TextCharAttrib**)pFirst))->GetStart() > (*((TextCharAttrib**)pSecond))->GetStart() )
+ return (1);
+ return 0;
+}
+
+
+ // -------------------------------------------------------------------------
+// (+) class TextCharAttrib
+// -------------------------------------------------------------------------
+TextCharAttrib::TextCharAttrib( const TextAttrib& rAttr, USHORT nStart, USHORT nEnd )
+{
+ mpAttr = rAttr.Clone();
+ mnStart = nStart,
+ mnEnd = nEnd;
+}
+
+TextCharAttrib::TextCharAttrib( const TextCharAttrib& rTextCharAttrib )
+{
+ mpAttr = rTextCharAttrib.GetAttr().Clone();
+ mnStart = rTextCharAttrib.mnStart;
+ mnEnd = rTextCharAttrib.mnEnd;
+}
+
+TextCharAttrib::~TextCharAttrib()
+{
+ delete mpAttr;
+}
+
+ // -------------------------------------------------------------------------
+// (+) class TextCharAttribList
+// -------------------------------------------------------------------------
+
+TextCharAttribList::TextCharAttribList()
+{
+ mbHasEmptyAttribs = FALSE;
+}
+
+TextCharAttribList::~TextCharAttribList()
+{
+ // PTRARR_DEL
+}
+
+void TextCharAttribList::Clear( BOOL bDestroyAttribs )
+{
+ if ( bDestroyAttribs )
+ TextCharAttribs::DeleteAndDestroy( 0, Count() );
+ else
+ TextCharAttribs::Remove( 0, Count() );
+}
+
+
+void TextCharAttribList::InsertAttrib( TextCharAttrib* pAttrib )
+{
+ if ( pAttrib->IsEmpty() )
+ mbHasEmptyAttribs = TRUE;
+
+ const USHORT nCount = Count();
+ const USHORT nStart = pAttrib->GetStart(); // vielleicht besser fuer Comp.Opt.
+ BOOL bInserted = FALSE;
+ for ( USHORT x = 0; x < nCount; x++ )
+ {
+ TextCharAttrib* pCurAttrib = GetObject( x );
+ if ( pCurAttrib->GetStart() > nStart )
+ {
+ Insert( pAttrib, x );
+ bInserted = TRUE;
+ break;
+ }
+ }
+ if ( !bInserted )
+ Insert( pAttrib, nCount );
+}
+
+void TextCharAttribList::ResortAttribs()
+{
+ if ( Count() )
+ qsort( (void*)GetData(), Count(), sizeof( TextCharAttrib* ), CompareStart );
+}
+
+TextCharAttrib* TextCharAttribList::FindAttrib( USHORT nWhich, USHORT nPos )
+{
+ // Rueckwaerts, falls eins dort endet, das naechste startet.
+ // => Das startende gilt...
+
+ for ( USHORT nAttr = Count(); nAttr; )
+ {
+ TextCharAttrib* pAttr = GetObject( --nAttr );
+
+ if ( pAttr->GetEnd() < nPos )
+ return 0;
+
+ if ( ( pAttr->Which() == nWhich ) && pAttr->IsIn(nPos) )
+ return pAttr;
+ }
+ return NULL;
+}
+
+TextCharAttrib* TextCharAttribList::FindNextAttrib( USHORT nWhich, USHORT nFromPos, USHORT nMaxPos ) const
+{
+ DBG_ASSERT( nWhich, "FindNextAttrib: Which?" );
+ const USHORT nAttribs = Count();
+ for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ )
+ {
+ TextCharAttrib* pAttr = GetObject( nAttr );
+ if ( ( pAttr->GetStart() >= nFromPos ) &&
+ ( pAttr->GetEnd() <= nMaxPos ) &&
+ ( pAttr->Which() == nWhich ) )
+ return pAttr;
+ }
+ return NULL;
+}
+
+BOOL TextCharAttribList::HasAttrib( USHORT nWhich ) const
+{
+ for ( USHORT nAttr = Count(); nAttr; )
+ {
+ const TextCharAttrib* pAttr = GetObject( --nAttr );
+ if ( pAttr->Which() == nWhich )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL TextCharAttribList::HasBoundingAttrib( USHORT nBound )
+{
+ // Rueckwaerts, falls eins dort endet, das naechste startet.
+ // => Das startende gilt...
+ for ( USHORT nAttr = Count(); nAttr; )
+ {
+ TextCharAttrib* pAttr = GetObject( --nAttr );
+
+ if ( pAttr->GetEnd() < nBound )
+ return FALSE;
+
+ if ( ( pAttr->GetStart() == nBound ) || ( pAttr->GetEnd() == nBound ) )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+TextCharAttrib* TextCharAttribList::FindEmptyAttrib( USHORT nWhich, USHORT nPos )
+{
+ if ( !mbHasEmptyAttribs )
+ return 0;
+
+ const USHORT nAttribs = Count();
+ for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ )
+ {
+ TextCharAttrib* pAttr = GetObject( nAttr );
+ if ( pAttr->GetStart() > nPos )
+ return 0;
+
+ if ( ( pAttr->GetStart() == nPos ) && ( pAttr->GetEnd() == nPos ) && ( pAttr->Which() == nWhich ) )
+ return pAttr;
+ }
+ return 0;
+}
+
+void TextCharAttribList::DeleteEmptyAttribs()
+{
+ for ( USHORT nAttr = 0; nAttr < Count(); nAttr++ )
+ {
+ TextCharAttrib* pAttr = GetObject( nAttr );
+ if ( pAttr->IsEmpty() )
+ {
+ Remove( nAttr );
+ delete pAttr;
+ nAttr--;
+ }
+ }
+ mbHasEmptyAttribs = FALSE;
+}
+
+#ifdef DBG_UTIL
+BOOL TextCharAttribList::DbgCheckAttribs()
+{
+ BOOL bOK = TRUE;
+ for ( USHORT nAttr = 0; nAttr < Count(); nAttr++ )
+ {
+ TextCharAttrib* pAttr = GetObject( nAttr );
+ if ( pAttr->GetStart() > pAttr->GetEnd() )
+ {
+ bOK = FALSE;
+ DBG_ERROR( "Attr verdreht" );
+ }
+ }
+ return bOK;
+}
+#endif
+
+ // -------------------------------------------------------------------------
+// (+) class TextNode
+// -------------------------------------------------------------------------
+
+TextNode::TextNode( const String& rText ) :
+ maText( rText )
+{
+}
+
+void TextNode::ExpandAttribs( USHORT nIndex, USHORT nNew )
+{
+ if ( !nNew )
+ return;
+
+ BOOL bResort = FALSE;
+ USHORT nAttribs = maCharAttribs.Count();
+ for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ )
+ {
+ TextCharAttrib* pAttrib = maCharAttribs.GetAttrib( nAttr );
+ if ( pAttrib->GetEnd() >= nIndex )
+ {
+ // Alle Attribute hinter der Einfuegeposition verschieben...
+ if ( pAttrib->GetStart() > nIndex )
+ {
+ pAttrib->MoveForward( nNew );
+ }
+ // 0: Leeres Attribut expandieren, wenn an Einfuegestelle
+ else if ( pAttrib->IsEmpty() )
+ {
+ // Index nicht pruefen, leeres durfte nur dort liegen.
+ // Wenn spaeter doch Ueberpruefung:
+ // Spezialfall: Start == 0; AbsLen == 1, nNew = 1 => Expand, weil durch Absatzumbruch!
+ // Start <= nIndex, End >= nIndex => Start=End=nIndex!
+// if ( pAttrib->GetStart() == nIndex )
+ pAttrib->Expand( nNew );
+ }
+ // 1: Attribut startet davor, geht bis Index...
+ else if ( pAttrib->GetEnd() == nIndex ) // Start muss davor liegen
+ {
+ // Nur expandieren, wenn kein Feature,
+ // und wenn nicht in ExcludeListe!
+ // Sonst geht z.B. ein UL bis zum neuen ULDB, beide expandieren
+ if ( !maCharAttribs.FindEmptyAttrib( pAttrib->Which(), nIndex ) )
+ {
+ pAttrib->Expand( nNew );
+ }
+ else
+ bResort = TRUE;
+ }
+ // 2: Attribut startet davor, geht hinter Index...
+ else if ( ( pAttrib->GetStart() < nIndex ) && ( pAttrib->GetEnd() > nIndex ) )
+ {
+ pAttrib->Expand( nNew );
+ }
+ // 3: Attribut startet auf Index...
+ else if ( pAttrib->GetStart() == nIndex )
+ {
+ if ( nIndex == 0 )
+ {
+ pAttrib->Expand( nNew );
+// bResort = TRUE; // es gibt ja keine Features mehr...
+ }
+ else
+ pAttrib->MoveForward( nNew );
+ }
+ }
+
+ DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Expand: Attribut verdreht!" );
+ DBG_ASSERT( ( pAttrib->GetEnd() <= maText.Len() ), "Expand: Attrib groesser als Absatz!" );
+ DBG_ASSERT( !pAttrib->IsEmpty(), "Leeres Attribut nach ExpandAttribs?" );
+ }
+
+ if ( bResort )
+ maCharAttribs.ResortAttribs();
+
+#ifdef EDITDEBUG
+ DBG_ASSERT( CheckOrderedList( (TextCharAttribs*)&maCharAttribs ), "Expand: Start-Liste verdreht" );
+#endif
+}
+
+void TextNode::CollapsAttribs( USHORT nIndex, USHORT nDeleted )
+{
+ if ( !nDeleted )
+ return;
+
+ BOOL bResort = FALSE;
+ USHORT nEndChanges = nIndex+nDeleted;
+
+ for ( USHORT nAttr = 0; nAttr < maCharAttribs.Count(); nAttr++ )
+ {
+ TextCharAttrib* pAttrib = maCharAttribs.GetAttrib( nAttr );
+ BOOL bDelAttr = FALSE;
+ if ( pAttrib->GetEnd() >= nIndex )
+ {
+ // Alles Attribute hinter der Einfuegeposition verschieben...
+ if ( pAttrib->GetStart() >= nEndChanges )
+ {
+ pAttrib->MoveBackward( nDeleted );
+ }
+ // 1. Innenliegende Attribute loeschen...
+ else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() <= nEndChanges ) )
+ {
+ // Spezialfall: Attrubt deckt genau den Bereich ab
+ // => als leeres Attribut behalten.
+ if ( ( pAttrib->GetStart() == nIndex ) && ( pAttrib->GetEnd() == nEndChanges ) )
+ pAttrib->GetEnd() = nIndex; // leer
+ else
+ bDelAttr = TRUE;
+ }
+ // 2. Attribut beginnt davor, endet drinnen oder dahinter...
+ else if ( ( pAttrib->GetStart() <= nIndex ) && ( pAttrib->GetEnd() > nIndex ) )
+ {
+ if ( pAttrib->GetEnd() <= nEndChanges ) // endet drinnen
+ pAttrib->GetEnd() = nIndex;
+ else
+ pAttrib->Collaps( nDeleted ); // endet dahinter
+ }
+ // 3. Attribut beginnt drinnen, endet dahinter...
+ else if ( ( pAttrib->GetStart() >= nIndex ) && ( pAttrib->GetEnd() > nEndChanges ) )
+ {
+ // Features duerfen nicht expandieren!
+ pAttrib->GetStart() = nEndChanges;
+ pAttrib->MoveBackward( nDeleted );
+ }
+ }
+
+ DBG_ASSERT( pAttrib->GetStart() <= pAttrib->GetEnd(), "Collaps: Attribut verdreht!" );
+ DBG_ASSERT( ( pAttrib->GetEnd() <= maText.Len()) || bDelAttr, "Collaps: Attrib groesser als Absatz!" );
+ if ( bDelAttr /* || pAttrib->IsEmpty() */ )
+ {
+ bResort = TRUE;
+ maCharAttribs.RemoveAttrib( nAttr );
+ delete pAttrib;
+ nAttr--;
+ }
+ else if ( pAttrib->IsEmpty() )
+ maCharAttribs.HasEmptyAttribs() = TRUE;
+ }
+
+ if ( bResort )
+ maCharAttribs.ResortAttribs();
+
+#ifdef EDITDEBUG
+ DBG_ASSERT( CheckOrderedList( (TextCharAttribs)&maCharAttribs ), "Collaps: Start-Liste verdreht" );
+#endif
+}
+
+void TextNode::InsertText( USHORT nPos, const String& rText )
+{
+ maText.Insert( rText, nPos );
+ ExpandAttribs( nPos, rText.Len() );
+}
+
+void TextNode::InsertText( USHORT nPos, sal_Unicode c )
+{
+ maText.Insert( c, nPos );
+ ExpandAttribs( nPos, 1 );
+}
+
+void TextNode::RemoveText( USHORT nPos, USHORT nChars )
+{
+ maText.Erase( nPos, nChars );
+ CollapsAttribs( nPos, nChars );
+}
+
+TextNode* TextNode::Split( USHORT nPos, BOOL bKeepEndingAttribs )
+{
+ String aNewText = maText.Copy( nPos );
+ maText.Erase( nPos );
+ TextNode* pNew = new TextNode( aNewText );
+
+ for ( USHORT nAttr = 0; nAttr < maCharAttribs.Count(); nAttr++ )
+ {
+ TextCharAttrib* pAttrib = maCharAttribs.GetAttrib( nAttr );
+ if ( pAttrib->GetEnd() < nPos )
+ {
+ // bleiben unveraendert....
+ ;
+ }
+ else if ( pAttrib->GetEnd() == nPos )
+ {
+ // muessen als leeres Attribut kopiert werden.
+ // !FindAttrib nur sinnvoll, wenn Rueckwaerts durch Liste!
+ if ( bKeepEndingAttribs && !pNew->maCharAttribs.FindAttrib( pAttrib->Which(), 0 ) )
+ {
+ TextCharAttrib* pNewAttrib = new TextCharAttrib( *pAttrib );
+ pNewAttrib->GetStart() = 0;
+ pNewAttrib->GetEnd() = 0;
+ pNew->maCharAttribs.InsertAttrib( pNewAttrib );
+ }
+ }
+ else if ( pAttrib->IsInside( nPos ) || ( !nPos && !pAttrib->GetStart() ) )
+ {
+ // Wenn ganz vorne gecuttet wird, muss das Attribut erhalten bleiben!
+ // muessen kopiert und geaendert werden
+ TextCharAttrib* pNewAttrib = new TextCharAttrib( *pAttrib );
+ pNewAttrib->GetStart() = 0;
+ pNewAttrib->GetEnd() = pAttrib->GetEnd()-nPos;
+ pNew->maCharAttribs.InsertAttrib( pNewAttrib );
+ // stutzen:
+ pAttrib->GetEnd() = nPos;
+ }
+ else
+ {
+ DBG_ASSERT( pAttrib->GetStart() >= nPos, "Start < nPos!" );
+ DBG_ASSERT( pAttrib->GetEnd() >= nPos, "End < nPos!" );
+ // alle dahinter verschieben in den neuen Node (this)
+ maCharAttribs.RemoveAttrib( nAttr );
+ pNew->maCharAttribs.InsertAttrib( pAttrib );
+ pAttrib->GetStart() -= nPos;
+ pAttrib->GetEnd() -= nPos;
+ nAttr--;
+ }
+ }
+ return pNew;
+}
+
+void TextNode::Append( const TextNode& rNode )
+{
+ USHORT nOldLen = maText.Len();
+
+ maText += rNode.GetText();
+
+#ifdef EDITDEBUG
+ DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute VOR AppendAttribs kaputt" );
+#endif
+
+ const USHORT nAttribs = rNode.GetCharAttribs().Count();
+ for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ )
+ {
+ TextCharAttrib* pAttrib = rNode.GetCharAttribs().GetAttrib( nAttr );
+ BOOL bMelted = FALSE;
+ if ( pAttrib->GetStart() == 0 )
+ {
+ // Evtl koennen Attribute zusammengefasst werden:
+ USHORT nTmpAttribs = maCharAttribs.Count();
+ for ( USHORT nTmpAttr = 0; nTmpAttr < nTmpAttribs; nTmpAttr++ )
+ {
+ TextCharAttrib* pTmpAttrib = maCharAttribs.GetAttrib( nTmpAttr );
+
+ if ( pTmpAttrib->GetEnd() == nOldLen )
+ {
+ if ( ( pTmpAttrib->Which() == pAttrib->Which() ) &&
+ ( pTmpAttrib->GetAttr() == pAttrib->GetAttr() ) )
+ {
+ pTmpAttrib->GetEnd() += pAttrib->GetLen();
+ bMelted = TRUE;
+ break; // es kann nur eins von der Sorte an der Stelle geben
+ }
+ }
+ }
+ }
+
+ if ( !bMelted )
+ {
+ TextCharAttrib* pNewAttrib = new TextCharAttrib( *pAttrib );
+ pNewAttrib->GetStart() += nOldLen;
+ pNewAttrib->GetEnd() += nOldLen;
+ maCharAttribs.InsertAttrib( pNewAttrib );
+ }
+ }
+
+#ifdef EDITDEBUG
+ DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute NACH AppendAttribs kaputt" );
+#endif
+}
+
+ // -------------------------------------------------------------------------
+// (+) class TextDoc
+// -------------------------------------------------------------------------
+
+TextDoc::TextDoc()
+{
+ mnLeftMargin = 0;
+};
+
+TextDoc::~TextDoc()
+{
+ DestroyTextNodes();
+}
+
+void TextDoc::Clear()
+{
+ DestroyTextNodes();
+}
+
+void TextDoc::DestroyTextNodes()
+{
+ for ( ULONG nNode = 0; nNode < maTextNodes.Count(); nNode++ )
+ delete maTextNodes.GetObject( nNode );
+ maTextNodes.Clear();
+}
+
+String TextDoc::GetText( const sal_Unicode* pSep ) const
+{
+ ULONG nLen = GetTextLen( pSep );
+ ULONG nNodes = maTextNodes.Count();
+
+ if ( nLen > STRING_MAXLEN )
+ {
+ DBG_ERROR( "Text zu gross fuer String" );
+ return String();
+ }
+
+ String aASCIIText;
+ ULONG nLastNode = nNodes-1;
+ for ( ULONG nNode = 0; nNode < nNodes; nNode++ )
+ {
+ TextNode* pNode = maTextNodes.GetObject( nNode );
+ String aTmp( pNode->GetText() );
+ aASCIIText += aTmp;
+ if ( pSep && ( nNode != nLastNode ) )
+ aASCIIText += pSep;
+ }
+
+ return aASCIIText;
+}
+
+XubString TextDoc::GetText( ULONG nPara ) const
+{
+ XubString aText;
+ TextNode* pNode = ( nPara < maTextNodes.Count() ) ? maTextNodes.GetObject( nPara ) : 0;
+ if ( pNode )
+ aText = pNode->GetText();
+
+ return aText;
+}
+
+
+ULONG TextDoc::GetTextLen( const xub_Unicode* pSep, const TextSelection* pSel ) const
+{
+ ULONG nLen = 0;
+ ULONG nNodes = maTextNodes.Count();
+ if ( nNodes )
+ {
+ ULONG nStartNode = 0;
+ ULONG nEndNode = nNodes-1;
+ if ( pSel )
+ {
+ nStartNode = pSel->GetStart().GetPara();
+ nEndNode = pSel->GetEnd().GetPara();
+ }
+
+ for ( ULONG nNode = nStartNode; nNode <= nEndNode; nNode++ )
+ {
+ TextNode* pNode = maTextNodes.GetObject( nNode );
+
+ USHORT nS = 0;
+ ULONG nE = pNode->GetText().Len();
+ if ( pSel && ( nNode == pSel->GetStart().GetPara() ) )
+ nS = pSel->GetStart().GetIndex();
+ if ( pSel && ( nNode == pSel->GetEnd().GetPara() ) )
+ nE = pSel->GetEnd().GetIndex();
+
+ nLen += ( nE - nS );
+ }
+
+ if ( pSep )
+ nLen += (nEndNode-nStartNode) * String( pSep ).Len();
+ }
+
+ return nLen;
+}
+
+TextPaM TextDoc::InsertText( const TextPaM& rPaM, xub_Unicode c )
+{
+ DBG_ASSERT( c != 0x0A, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
+ DBG_ASSERT( c != 0x0D, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
+
+ TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ pNode->InsertText( rPaM.GetIndex(), c );
+
+ TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+1 );
+ return aPaM;
+}
+
+TextPaM TextDoc::InsertText( const TextPaM& rPaM, const XubString& rStr )
+{
+ DBG_ASSERT( rStr.Search( 0x0A ) == STRING_NOTFOUND, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
+ DBG_ASSERT( rStr.Search( 0x0D ) == STRING_NOTFOUND, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
+
+ TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ pNode->InsertText( rPaM.GetIndex(), rStr );
+
+ TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.Len() );
+ return aPaM;
+}
+
+TextPaM TextDoc::InsertParaBreak( const TextPaM& rPaM, BOOL bKeepEndingAttribs )
+{
+ TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ TextNode* pNew = pNode->Split( rPaM.GetIndex(), bKeepEndingAttribs );
+
+ maTextNodes.Insert( pNew, rPaM.GetPara()+1 );
+
+ TextPaM aPaM( rPaM.GetPara()+1, 0 );
+ return aPaM;
+}
+
+TextPaM TextDoc::ConnectParagraphs( TextNode* pLeft, TextNode* pRight )
+{
+ USHORT nPrevLen = pLeft->GetText().Len();
+ pLeft->Append( *pRight );
+
+ // der rechte verschwindet.
+ ULONG nRight = maTextNodes.GetPos( pRight );
+ maTextNodes.Remove( nRight );
+ delete pRight;
+
+ ULONG nLeft = maTextNodes.GetPos( pLeft );
+ TextPaM aPaM( nLeft, nPrevLen );
+ return aPaM;
+}
+
+TextPaM TextDoc::RemoveChars( const TextPaM& rPaM, USHORT nChars )
+{
+ TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ pNode->RemoveText( rPaM.GetIndex(), nChars );
+
+ return rPaM;
+}
+
+BOOL TextDoc::IsValidPaM( const TextPaM& rPaM )
+{
+ if ( rPaM.GetPara() >= maTextNodes.Count() )
+ {
+ DBG_ERROR( "PaM: Para out of range" );
+ return FALSE;
+ }
+ TextNode * pNode = maTextNodes.GetObject( rPaM.GetPara() );
+ if ( rPaM.GetIndex() > pNode->GetText().Len() )
+ {
+ DBG_ERROR( "PaM: Index out of range" );
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*
+
+void TextDoc::InsertAttribInSelection( TextNode* pNode, USHORT nStart, USHORT nEnd, const SfxPoolItem& rPoolItem )
+{
+ DBG_ASSERT( pNode, "Wohin mit dem Attribut?" );
+ DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribut zu gross!" );
+
+ // fuer Optimierung:
+ // dieses endet am Anfang der Selektion => kann erweitert werden
+ TextCharAttrib* pEndingAttrib = 0;
+ // dieses startet am Ende der Selektion => kann erweitert werden
+ TextCharAttrib* pStartingAttrib = 0;
+
+ DBG_ASSERT( nStart <= nEnd, "Kleiner Rechenfehler in InsertAttribInSelection" );
+
+ RemoveAttribs( pNode, nStart, nEnd, pStartingAttrib, pEndingAttrib, rPoolItem.Which() );
+
+ if ( pStartingAttrib && pEndingAttrib &&
+ ( *(pStartingAttrib->GetItem()) == rPoolItem ) &&
+ ( *(pEndingAttrib->GetItem()) == rPoolItem ) )
+ {
+ // wird ein groesses Attribut.
+ pEndingAttrib->GetEnd() = pStartingAttrib->GetEnd();
+ pCurPool->Remove( *(pStartingAttrib->GetItem()) );
+ pNode->GetCharAttribs().GetAttribs().Remove( pNode->GetCharAttribs().GetAttribs().GetPos( pStartingAttrib ) );
+ delete pStartingAttrib;
+ }
+ else if ( pStartingAttrib && ( *(pStartingAttrib->GetItem()) == rPoolItem ) )
+ pStartingAttrib->GetStart() = nStart;
+ else if ( pEndingAttrib && ( *(pEndingAttrib->GetItem()) == rPoolItem ) )
+ pEndingAttrib->GetEnd() = nEnd;
+ else
+ InsertAttrib( rPoolItem, pNode, nStart, nEnd );
+
+ if ( pStartingAttrib )
+ pNode->GetCharAttribs().ResortAttribs();
+}
+
+BOOL TextDoc::RemoveAttribs( TextNode* pNode, USHORT nStart, USHORT nEnd, USHORT nWhich )
+{
+ TextCharAttrib* pStarting;
+ TextCharAttrib* pEnding;
+ return RemoveAttribs( pNode, nStart, nEnd, pStarting, pEnding, nWhich );
+}
+
+BOOL TextDoc::RemoveAttribs( TextNode* pNode, USHORT nStart, USHORT nEnd, TextCharAttrib*& rpStarting, TextCharAttrib*& rpEnding, USHORT nWhich )
+{
+ DBG_ASSERT( pNode, "Wohin mit dem Attribut?" );
+ DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribut zu gross!" );
+
+ // dieses endet am Anfang der Selektion => kann erweitert werden
+ rpEnding = 0;
+ // dieses startet am Ende der Selektion => kann erweitert werden
+ rpStarting = 0;
+
+ BOOL bChanged = FALSE;
+
+ DBG_ASSERT( nStart <= nEnd, "Kleiner Rechenfehler in InsertAttribInSelection" );
+
+ // ueber die Attribute iterieren...
+ USHORT nAttr = 0;
+ TextCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
+ while ( pAttr )
+ {
+ BOOL bRemoveAttrib = FALSE;
+ if ( !nWhich || ( pAttr->Which() == nWhich ) )
+ {
+ // Attribut beginnt in Selection
+ if ( ( pAttr->GetStart() >= nStart ) && ( pAttr->GetStart() <= nEnd ) )
+ {
+ bChanged = TRUE;
+ if ( pAttr->GetEnd() > nEnd )
+ {
+ pAttr->GetStart() = nEnd; // dann faengt es dahinter an
+ rpStarting = pAttr;
+ break; // es kann kein weiteres Attrib hier liegen
+ }
+ else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) )
+ {
+ // Feature nur loeschen, wenn genau an der Stelle
+ bRemoveAttrib = TRUE;
+ }
+ }
+
+ // Attribut endet in Selection
+ else if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetEnd() <= nEnd ) )
+ {
+ bChanged = TRUE;
+ if ( ( pAttr->GetStart() < nStart ) && !pAttr->IsFeature() )
+ {
+ pAttr->GetEnd() = nStart; // dann hoert es hier auf
+ rpEnding = pAttr;
+ }
+ else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) )
+ {
+ // Feature nur loeschen, wenn genau an der Stelle
+ bRemoveAttrib = TRUE;
+ }
+ }
+ // Attribut ueberlappt die Selektion
+ else if ( ( pAttr->GetStart() <= nStart ) && ( pAttr->GetEnd() >= nEnd ) )
+ {
+ bChanged = TRUE;
+ if ( pAttr->GetStart() == nStart )
+ {
+ pAttr->GetStart() = nEnd;
+ rpStarting = pAttr;
+ break; // es kann weitere Attribute geben!
+ }
+ else if ( pAttr->GetEnd() == nEnd )
+ {
+ pAttr->GetEnd() = nStart;
+ rpEnding = pAttr;
+ break; // es kann weitere Attribute geben!
+ }
+ else // Attribut muss gesplittet werden...
+ {
+ USHORT nOldEnd = pAttr->GetEnd();
+ pAttr->GetEnd() = nStart;
+ rpEnding = pAttr;
+// ULONG nSavePos = pNode->GetCharAttribs().GetStartList().GetCurPos();
+ InsertAttrib( *pAttr->GetItem(), pNode, nEnd, nOldEnd );
+// pNode->GetCharAttribs().GetStartList().Seek( nSavePos );
+ break; // es kann weitere Attribute geben!
+ }
+ }
+ }
+ if ( bRemoveAttrib )
+ {
+ DBG_ASSERT( ( pAttr != rpStarting ) && ( pAttr != rpEnding ), "Loeschen und behalten des gleichen Attributs ?" );
+ pNode->GetCharAttribs().GetAttribs().Remove(nAttr);
+ pCurPool->Remove( *pAttr->GetItem() );
+ delete pAttr;
+ nAttr--;
+ }
+ nAttr++;
+ pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
+ }
+ return bChanged;
+}
+
+#pragma SEG_FUNCDEF(editdoc_3f)
+
+void TextDoc::InsertAttrib( const SfxPoolItem& rPoolItem, TextNode* pNode, USHORT nStart, USHORT nEnd )
+{
+ // Diese Methode prueft nicht mehr, ob ein entspr. Attribut
+ // schon an der Stelle existiert!
+
+ // pruefen, ob neues Attrib oder einfach nur Ende eines Attribs...
+// const SfxPoolItem& rDefItem = pNode->GetContentAttribs().GetItem( rPoolItem.Which() );
+// BOOL bCreateAttrib = ( rDefItem != rPoolItem );
+
+ // Durch den Verlust der Exclude-Liste geht es nicht mehr, dass ich
+ // kein neues Attribut benoetige und nur das alte nicht expandiere...
+// if ( !bCreateAttrib )
+ {
+ // => Wenn schon Default-Item, dann wenigstens nur dann einstellen,
+ // wenn davor wirklich ein entsprechendes Attribut.
+// if ( pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart ) )
+// bCreateAttrib = TRUE;
+ // Aber kleiner Trost:
+ // Die wenigsten schreiben, aendern das Attr, schreiben, und
+ // stellen dann wieder das Default-Attr ein.
+ }
+
+ // 22.9.95:
+ // Die Uberlegung, einfach das andere Attribut nicht zu expandieren, war
+ // sowieso falsch, da das DefAttr aus einer Vorlage kommen kann,
+ // die irgendwann verschwindet!
+// if ( bCreateAttrib )
+// {
+ TextCharAttrib* pAttrib = MakeCharAttrib( *pCurPool, rPoolItem, nStart, nEnd );
+ DBG_ASSERT( pAttrib, "MakeCharAttrib fehlgeschlagen!" );
+ pNode->GetCharAttribs().InsertAttrib( pAttrib );
+// }
+// else
+// {
+// TextCharAttrib* pTmpAttrib =
+// pNode->GetCharAttribs().FindAnyAttrib( rPoolItem.Which() );
+// if ( pTmpAttrib ) // sonst benoetige ich es sowieso nicht....
+// {
+// aExcludeList.Insert( pTmpAttrib->GetItem() );
+// }
+// }
+}
+
+#pragma SEG_FUNCDEF(editdoc_40)
+
+void TextDoc::InsertAttrib( TextNode* pNode, USHORT nStart, USHORT nEnd, const SfxPoolItem& rPoolItem )
+{
+ if ( nStart != nEnd )
+ {
+ InsertAttribInSelection( pNode, nStart, nEnd, rPoolItem );
+ }
+ else
+ {
+ // Pruefen, ob schon ein neues Attribut mit der WhichId an der Stelle:
+ TextCharAttrib* pAttr = pNode->GetCharAttribs().FindEmptyAttrib( rPoolItem.Which(), nStart );
+ if ( pAttr )
+ {
+ // Attribut entfernen....
+ pNode->GetCharAttribs().GetAttribs().Remove(
+ pNode->GetCharAttribs().GetAttribs().GetPos( pAttr ) );
+ }
+
+ // pruefen, ob ein 'gleiches' Attribut an der Stelle liegt.
+ pAttr = pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart );
+ if ( pAttr )
+ {
+ if ( pAttr->IsInside( nStart ) ) // splitten
+ {
+ // ???????????????????????????????
+ // eigentlich noch pruefen, ob wirklich splittet, oder return !
+ // ???????????????????????????????
+ USHORT nOldEnd = pAttr->GetEnd();
+ pAttr->GetEnd() = nStart;
+ pAttr = MakeCharAttrib( *pCurPool, *(pAttr->GetItem()), nStart, nOldEnd );
+ pNode->GetCharAttribs().InsertAttrib( pAttr );
+ }
+ else if ( pAttr->GetEnd() == nStart )
+ {
+ DBG_ASSERT( !pAttr->IsEmpty(), "Doch noch ein leeres Attribut?" );
+ // pruefen, ob genau das gleiche Attribut
+ if ( *(pAttr->GetItem()) == rPoolItem )
+ return;
+ }
+ }
+ InsertAttrib( rPoolItem, pNode, nStart, nStart );
+ }
+}
+
+#pragma SEG_FUNCDEF(editdoc_41)
+
+void TextDoc::FindAttribs( TextNode* pNode, USHORT nStartPos, USHORT nEndPos, SfxItemSet& rCurSet )
+{
+ DBG_ASSERT( pNode, "Wo soll ich suchen ?" );
+ DBG_ASSERT( nStartPos <= nEndPos, "Ungueltiger Bereich!" );
+
+ USHORT nAttr = 0;
+ TextCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
+ // keine Selection...
+ if ( nStartPos == nEndPos )
+ {
+ while ( pAttr && ( pAttr->GetStart() <= nEndPos) )
+ {
+ const SfxPoolItem* pItem = 0;
+ // Attribut liegt dadrueber...
+ if ( ( pAttr->GetStart() < nStartPos ) && ( pAttr->GetEnd() > nStartPos ) )
+ pItem = pAttr->GetItem();
+ // Attribut endet hier, ist nicht leer
+ else if ( ( pAttr->GetStart() < nStartPos ) && ( pAttr->GetEnd() == nStartPos ) )
+ {
+ if ( !pNode->GetCharAttribs().FindEmptyAttrib( pAttr->GetItem()->Which(), nStartPos ) )
+ pItem = pAttr->GetItem();
+ }
+ // Attribut endet hier, ist leer
+ else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() == nStartPos ) )
+ {
+// if ( aExcludeList.FindAttrib( pAttr->GetItem()->Which() ) )
+ pItem = pAttr->GetItem();
+// else if ( pNode->Len() == 0 ) // Sonderfall
+// pItem = pAttr->GetItem();
+ }
+ // Attribut beginnt hier
+ else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() > nStartPos ) )
+ {
+ if ( nStartPos == 0 ) // Sonderfall
+ pItem = pAttr->GetItem();
+ }
+
+ if ( pItem )
+ {
+ USHORT nWhich = pItem->Which();
+ if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
+ {
+ rCurSet.Put( *pItem );
+ }
+ else if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
+ {
+ const SfxPoolItem& rItem = rCurSet.Get( nWhich );
+ if ( rItem != *pItem )
+ {
+ rCurSet.InvalidateItem( nWhich );
+ }
+ }
+ }
+ nAttr++;
+ pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
+ }
+ }
+ else // Selektion
+ {
+ while ( pAttr && ( pAttr->GetStart() < nEndPos) )
+ {
+ const SfxPoolItem* pItem = 0;
+ // Attribut liegt dadrueber...
+ if ( ( pAttr->GetStart() <= nStartPos ) && ( pAttr->GetEnd() >= nEndPos ) )
+ pItem = pAttr->GetItem();
+ // Attribut startet mitten drin...
+ else if ( pAttr->GetStart() >= nStartPos )
+ {
+ // !!! pItem = pAttr->GetItem();
+ // einfach nur pItem reicht nicht, da ich z.B. bei Shadow
+ // niemals ein ungleiches Item finden wuerde, da ein solche
+ // seine Anwesenheit durch Abwesenheit repraesentiert!
+ // if ( ... )
+ // Es muesste geprueft werden, on genau das gleiche Attribut
+ // an der Bruchstelle aufsetzt, was recht aufwendig ist.
+ // Da ich beim Einfuegen von Attributen aber etwas optimiere
+ // tritt der Fall nicht so schnell auf...
+ // Also aus Geschwindigkeitsgruenden:
+ rCurSet.InvalidateItem( pAttr->GetItem()->Which() );
+
+ }
+ // Attribut endet mitten drin...
+ else if ( pAttr->GetEnd() > nStartPos )
+ {
+ // pItem = pAttr->GetItem();
+ // s.o.
+
+ // -----------------31.05.95 16:01-------------------
+ // Ist falsch, wenn das gleiche Attribut sofort wieder
+ // eingestellt wird!
+ // => Sollte am besten nicht vorkommen, also gleich beim
+ // Setzen von Attributen richtig machen!
+ // --------------------------------------------------
+ rCurSet.InvalidateItem( pAttr->GetItem()->Which() );
+ }
+
+ if ( pItem )
+ {
+ USHORT nWhich = pItem->Which();
+ if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF )
+ {
+ rCurSet.Put( *pItem );
+ }
+ else if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_ON )
+ {
+ const SfxPoolItem& rItem = rCurSet.Get( nWhich );
+ if ( rItem != *pItem )
+ {
+ rCurSet.InvalidateItem( nWhich );
+ }
+ }
+ }
+ nAttr++;
+ pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr );
+ }
+ }
+}
+
+
+*/
+
+
diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx
new file mode 100644
index 000000000000..9659ccce438a
--- /dev/null
+++ b/svtools/source/edit/textdoc.hxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * $RCSfile: textdoc.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TEXTDOC_HXX
+#define _TEXTDOC_HXX
+
+#ifndef _SVARRAY_HXX
+#include <svarray.hxx>
+#endif
+
+#ifndef _TEXTDATA_HXX
+#include <textdata.hxx>
+#endif
+
+#ifndef _TXTATTR_HXX
+#include <txtattr.hxx>
+#endif
+
+#include <tools/debug.hxx>
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#ifndef _LIST_HXX //autogen
+#include <tools/list.hxx>
+#endif
+
+
+typedef TextCharAttrib* TextCharAttribPtr;
+SV_DECL_PTRARR_DEL( TextCharAttribs, TextCharAttribPtr, 0, 4 );
+
+class TextCharAttribList : private TextCharAttribs
+{
+private:
+ BOOL mbHasEmptyAttribs;
+
+ TextCharAttribList( const TextCharAttribList& ) {;}
+
+public:
+ TextCharAttribList();
+ ~TextCharAttribList();
+
+ void Clear( BOOL bDestroyAttribs );
+ USHORT Count() const { return TextCharAttribs::Count(); }
+
+ TextCharAttrib* GetAttrib( USHORT n ) const { return TextCharAttribs::GetObject( n ); }
+ void RemoveAttrib( USHORT n ) { TextCharAttribs::Remove( n, 1 ); }
+
+ void InsertAttrib( TextCharAttrib* pAttrib );
+
+ void DeleteEmptyAttribs();
+ void ResortAttribs();
+
+ BOOL HasEmptyAttribs() const { return mbHasEmptyAttribs; }
+ BOOL& HasEmptyAttribs() { return mbHasEmptyAttribs; }
+
+ TextCharAttrib* FindAttrib( USHORT nWhich, USHORT nPos );
+ TextCharAttrib* FindNextAttrib( USHORT nWhich, USHORT nFromPos, USHORT nMaxPos = 0xFFFF ) const;
+ TextCharAttrib* FindEmptyAttrib( USHORT nWhich, USHORT nPos );
+ BOOL HasAttrib( USHORT nWhich ) const;
+ BOOL HasBoundingAttrib( USHORT nBound );
+
+#ifdef DBG_UTIL
+ BOOL DbgCheckAttribs();
+#endif
+};
+
+
+class TextNode
+{
+private:
+ String maText;
+ TextCharAttribList maCharAttribs;
+
+ TextNode( const TextNode& ) {;}
+protected:
+ void ExpandAttribs( USHORT nIndex, USHORT nNewChars );
+ void CollapsAttribs( USHORT nIndex, USHORT nDelChars );
+
+public:
+ TextNode( const String& rText );
+
+
+ const String& GetText() const { return maText; }
+// String& GetText() { return maText; }
+
+ const TextCharAttribList& GetCharAttribs() const { return maCharAttribs; }
+ TextCharAttribList& GetCharAttribs() { return maCharAttribs; }
+
+ void InsertText( USHORT nPos, const String& rText );
+ void InsertText( USHORT nPos, sal_Unicode c );
+ void RemoveText( USHORT nPos, USHORT nChars );
+
+ TextNode* Split( USHORT nPos, BOOL bKeepEndigAttribs );
+ void Append( const TextNode& rNode );
+};
+
+
+
+DECLARE_LIST( TextNodeList, TextNode* );
+
+class TextDoc
+{
+private:
+ TextNodeList maTextNodes;
+ USHORT mnLeftMargin;
+
+protected:
+ void DestroyTextNodes();
+
+public:
+ TextDoc();
+ ~TextDoc();
+
+ void Clear();
+
+ TextNodeList& GetNodes() { return maTextNodes; }
+ const TextNodeList& GetNodes() const { return maTextNodes; }
+
+ TextPaM RemoveChars( const TextPaM& rPaM, USHORT nChars );
+ TextPaM InsertText( const TextPaM& rPaM, sal_Unicode c );
+ TextPaM InsertText( const TextPaM& rPaM, const String& rStr );
+
+ TextPaM InsertParaBreak( const TextPaM& rPaM, BOOL bKeepEndingAttribs );
+ TextPaM ConnectParagraphs( TextNode* pLeft, TextNode* pRight );
+
+ ULONG GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
+ String GetText( const sal_Unicode* pSep ) const;
+ String GetText( ULONG nPara ) const;
+
+ void SetLeftMargin( USHORT n ) { mnLeftMargin = n; }
+ USHORT GetLeftMargin() const { return mnLeftMargin; }
+
+// BOOL RemoveAttribs( TextNode* pNode, USHORT nStart, USHORT nEnd ), USHORT nWhich = 0 );
+// BOOL RemoveAttribs( TextNode* pNode, USHORT nStart, USHORT nEnd, TextCharAttrib*& rpStarting, TextCharAttrib*& rpEnding, USHORT nWhich = 0 );
+// void InsertAttrib( const EditCharAttrib* pAttr );
+// void InsertAttribInSelection( const EditCharAttrib* pAttr );
+// void FindAttribs( TextNode* pNode, USHORT nStartPos, USHORT nEndPos, SfxItemSet& rCurSet );
+
+ BOOL IsValidPaM( const TextPaM& rPaM );
+};
+
+#endif // _TEXTDOC_HXX
diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx
new file mode 100644
index 000000000000..1443fc3e72ed
--- /dev/null
+++ b/svtools/source/edit/texteng.cxx
@@ -0,0 +1,2691 @@
+/*************************************************************************
+ *
+ * $RCSfile: texteng.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#include <texteng.hxx>
+#include <textview.hxx>
+#include <textdoc.hxx>
+#include <textdat2.hxx>
+#include <textundo.hxx>
+#include <textund2.hxx>
+
+#include <tools/isolang.hxx>
+
+#ifndef _SV_WINDOW_HXX //autogen
+#include <vcl/window.hxx>
+#endif
+
+#include <vcl/edit.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_
+#include <com/sun/star/text/XBreakIterator.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_CHARACTERITERATORMODE_HPP_
+#include <com/sun/star/text/CharacterIteratorMode.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_WORDTYPE_HPP_
+#include <com/sun/star/text/WordType.hpp>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#include <vcl/unohelp.hxx>
+
+using namespace ::com::sun::star;
+
+typedef TextView* TextViewPtr;
+SV_DECL_PTRARR( TextViews, TextViewPtr, 0, 1 );
+// SV_IMPL_PTRARR( TextViews, TextViewPtr );
+
+SV_DECL_VARARR_SORT( TESortedPositions, ULONG, 16, 8 );
+SV_IMPL_VARARR_SORT( TESortedPositions, ULONG );
+
+#define RESDIFF 10
+#define SCRLRANGE 20 // 1/20 der Breite/Hoehe scrollen, wenn im QueryDrop
+
+
+ // -------------------------------------------------------------------------
+// (-) class TextEngine
+// -------------------------------------------------------------------------
+TextEngine::TextEngine() : maWordDelimiters( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " .=+-*/()[]<>{};,:\"\t" ) ) )
+{
+ mpDoc = 0;
+ mpTEParaPortions = 0;
+
+ mpViews = new TextViews;
+ mpActiveView = NULL;
+
+ mbIsFormatting = FALSE;
+ mbFormatted = FALSE;
+ mbUpdate = TRUE;
+ mbModified = FALSE;
+ mbUndoEnabled = FALSE;
+ mbIsInUndo = FALSE;
+ mbDowning = FALSE;
+
+ meAlign = TXTALIGN_LEFT;
+
+ mnMaxTextWidth = 0;
+ mnMaxTextLen = 0;
+ mnCurTextHeight = 0;
+
+ mpUndoManager = 0;
+
+ mpIdleFormatter = new IdleFormatter;
+
+ mpRefDev = new VirtualDevice;
+
+ ImpInitDoc();
+
+ Font aFont;
+ aFont.SetTransparent( FALSE );
+ Color aFillColor( aFont.GetFillColor() );
+ aFillColor.SetTransparency( 0 );
+ aFont.SetFillColor( aFillColor );
+ SetFont( aFont );
+}
+
+TextEngine::~TextEngine()
+{
+ mbDowning = TRUE;
+
+ delete mpIdleFormatter;
+ delete mpDoc;
+ delete mpTEParaPortions;
+ delete mpViews; // nur die Liste, nicht die Vies
+ delete mpRefDev;
+ delete mpUndoManager;
+}
+
+void TextEngine::InsertView( TextView* pTextView )
+{
+ mpViews->Insert( pTextView, mpViews->Count() );
+ pTextView->SetSelection( TextSelection() );
+
+ if ( !GetActiveView() )
+ SetActiveView( pTextView );
+}
+
+void TextEngine::RemoveView( TextView* pTextView )
+{
+ USHORT nPos = mpViews->GetPos( pTextView );
+ if( nPos != USHRT_MAX )
+ {
+ pTextView->HideCursor();
+ mpViews->Remove( nPos, 1 );
+ if ( pTextView == GetActiveView() )
+ SetActiveView( 0 );
+ }
+}
+
+USHORT TextEngine::GetViewCount() const
+{
+ return mpViews->Count();
+}
+
+TextView* TextEngine::GetView( USHORT nView ) const
+{
+ return mpViews->GetObject( nView );
+}
+
+TextView* TextEngine::GetActiveView() const
+{
+ return mpActiveView;
+}
+
+void TextEngine::SetActiveView( TextView* pTextView )
+{
+ if ( pTextView != mpActiveView )
+ {
+ if ( mpActiveView )
+ mpActiveView->HideSelection();
+
+ mpActiveView = pTextView;
+
+ if ( mpActiveView )
+ mpActiveView->ShowSelection();
+ }
+}
+
+void TextEngine::SetFont( const Font& rFont )
+{
+ if ( rFont != maFont )
+ {
+ maFont = rFont;
+
+ // Wegen Selektion keinen Transparenten Font zulassen...
+ // (Sonst spaeter in ImplPaint den Hintergrund anders loeschen...)
+ maFont.SetTransparent( FALSE );
+ Color aFillColor( maFont.GetFillColor() );
+ aFillColor.SetTransparency( 0 );
+ maFont.SetFillColor( aFillColor );
+
+ maFont.SetAlign( ALIGN_TOP );
+ mpRefDev->SetFont( maFont );
+ Size aTextSize;
+ aTextSize.Width() = mpRefDev->GetTextWidth( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " " ) ) );
+ aTextSize.Height() = mpRefDev->GetTextHeight();
+ if ( !aTextSize.Width() )
+ aTextSize.Width() = mpRefDev->GetTextWidth( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "XXXX" ) ) );
+
+ mnDefTab = (USHORT)aTextSize.Width();
+ if ( !mnDefTab )
+ mnDefTab = 1;
+ mnCharHeight = (USHORT)aTextSize.Height();
+ if ( rFont.GetPitch() == PITCH_FIXED )
+ {
+ String aX100;
+ aX100.Fill( 100, 'X' );
+ mnFixCharWidth100 = (USHORT)mpRefDev->GetTextWidth( aX100 );
+ }
+ else
+ mnFixCharWidth100 = 0;
+
+ FormatFullDoc();
+ }
+}
+
+void TextEngine::SetDefTab( USHORT nDefTab )
+{
+ mnDefTab = nDefTab;
+ // evtl neu setzen?
+}
+
+void TextEngine::SetMaxTextLen( ULONG nLen )
+{
+ mnMaxTextLen = nLen;
+}
+
+void TextEngine::SetMaxTextWidth( ULONG nMaxWidth )
+{
+ if ( nMaxWidth != mnMaxTextWidth )
+ {
+ mnMaxTextWidth = Min( nMaxWidth, (ULONG)0x7FFFFFFF );
+ FormatFullDoc();
+ UpdateViews();
+ }
+}
+
+static sal_Unicode static_aLFText[] = { '\n', 0 };
+static sal_Unicode static_aCRText[] = { '\r', 0 };
+static sal_Unicode static_aCRLFText[] = { '\r', '\n', 0 };
+
+static inline const sal_Unicode* static_getLineEndText( LineEnd aLineEnd )
+{
+ const sal_Unicode* pRet = NULL;
+
+ switch( aLineEnd )
+ {
+ case LINEEND_LF: pRet = static_aLFText;break;
+ case LINEEND_CR: pRet = static_aCRText;break;
+ case LINEEND_CRLF: pRet = static_aCRLFText;break;
+ }
+ return pRet;
+}
+
+String TextEngine::GetText( LineEnd aSeparator ) const
+{
+ return mpDoc->GetText( static_getLineEndText( aSeparator ) );
+}
+
+String TextEngine::GetTextLines( LineEnd aSeparator ) const
+{
+ String aText;
+ ULONG nParas = mpTEParaPortions->Count();
+ const sal_Unicode* pSep = static_getLineEndText( aSeparator );
+ for ( ULONG nP = 0; nP < nParas; nP++ )
+ {
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nP );
+
+ USHORT nLines = pTEParaPortion->GetLines().Count();
+ for ( USHORT nL = 0; nL < nLines; nL++ )
+ {
+ TextLine* pLine = pTEParaPortion->GetLines()[nL];
+ aText += pTEParaPortion->GetNode()->GetText().Copy( pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() );
+ if ( pSep && ( ( (nP+1) < nParas ) || ( (nL+1) < nLines ) ) )
+ aText += pSep;
+ }
+ }
+ return aText;
+}
+
+String TextEngine::GetText( ULONG nPara ) const
+{
+ return mpDoc->GetText( nPara );
+}
+
+ULONG TextEngine::GetTextLen( LineEnd aSeparator ) const
+{
+ return mpDoc->GetTextLen( static_getLineEndText( aSeparator ) );
+}
+
+ULONG TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator ) const
+{
+ TextSelection aSel( rSel );
+ aSel.Justify();
+ ValidateSelection( aSel );
+ return mpDoc->GetTextLen( static_getLineEndText( aSeparator ), &aSel );
+}
+
+USHORT TextEngine::GetTextLen( ULONG nPara ) const
+{
+ return mpDoc->GetNodes().GetObject( nPara )->GetText().Len();
+}
+
+void TextEngine::SetUpdateMode( BOOL bUpdate )
+{
+ if ( bUpdate != mbUpdate )
+ {
+ mbUpdate = bUpdate;
+ if ( mbUpdate )
+ {
+ FormatAndUpdate( GetActiveView() );
+ if ( GetActiveView() )
+ GetActiveView()->ShowCursor();
+ }
+ }
+}
+
+void TextEngine::SetWordDelimiters( const String& rDelimiters )
+{
+ maWordDelimiters = rDelimiters;
+ if ( maWordDelimiters.Search( ' ' ) == STRING_NOTFOUND )
+ maWordDelimiters += ' ';
+ if ( maWordDelimiters.Search( '\t' ) == STRING_NOTFOUND )
+ maWordDelimiters += '\t';
+}
+
+BOOL TextEngine::DoesKeyMoveCursor( const KeyEvent& rKeyEvent )
+{
+ BOOL bDoesMove = FALSE;
+
+ switch ( rKeyEvent.GetKeyCode().GetCode() )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_HOME:
+ case KEY_END:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ {
+ if ( !rKeyEvent.GetKeyCode().IsMod2() )
+ bDoesMove = TRUE;
+ }
+ break;
+ }
+ return bDoesMove;
+}
+
+BOOL TextEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent )
+{
+ BOOL bDoesChange = FALSE;
+
+ KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction();
+ if ( eFunc != KEYFUNC_DONTKNOW )
+ {
+ switch ( eFunc )
+ {
+ case KEYFUNC_UNDO:
+ case KEYFUNC_REDO:
+ case KEYFUNC_CUT:
+ case KEYFUNC_PASTE: bDoesChange = TRUE;
+ break;
+ default: // wird dann evtl. unten bearbeitet.
+ eFunc = KEYFUNC_DONTKNOW;
+ }
+ }
+ if ( eFunc == KEYFUNC_DONTKNOW )
+ {
+ switch ( rKeyEvent.GetKeyCode().GetCode() )
+ {
+ case KEY_DELETE:
+ case KEY_BACKSPACE:
+ {
+ if ( !rKeyEvent.GetKeyCode().IsMod2() )
+ bDoesChange = TRUE;
+ }
+ break;
+ case KEY_RETURN:
+ case KEY_TAB:
+ {
+ if ( !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() )
+ bDoesChange = TRUE;
+ }
+ break;
+ default:
+ {
+ bDoesChange = TextEngine::IsSimpleCharInput( rKeyEvent );
+ }
+ }
+ }
+ return bDoesChange;
+}
+
+BOOL TextEngine::IsSimpleCharInput( const KeyEvent& rKeyEvent )
+{
+ if( rKeyEvent.GetCharCode() >= 32 && rKeyEvent.GetCharCode() != 127 &&
+#ifndef MAC
+ KEY_MOD2 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT ) )
+#else
+ KEY_MOD1 != rKeyEvent.GetKeyCode().GetModifier() )
+#endif
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void TextEngine::ImpInitDoc()
+{
+ if ( mpDoc )
+ mpDoc->Clear();
+ else
+ mpDoc = new TextDoc;
+
+ delete mpTEParaPortions;
+ mpTEParaPortions = new TEParaPortions;
+
+ TextNode* pNode = new TextNode( String() );
+ mpDoc->GetNodes().Insert( pNode );
+
+ TEParaPortion* pIniPortion = new TEParaPortion( pNode );
+ mpTEParaPortions->Insert( pIniPortion, (ULONG)0 );
+
+ mbFormatted = FALSE;
+
+ ImpParagraphRemoved( TEXT_PARA_ALL );
+ ImpParagraphInserted( 0 );
+}
+
+String TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) const
+{
+ String aText;
+
+ if ( !rSel.HasRange() )
+ return aText;
+
+ TextSelection aSel( rSel );
+ aSel.Justify();
+
+ ULONG nStartPara = aSel.GetStart().GetPara();
+ ULONG nEndPara = aSel.GetEnd().GetPara();
+ const sal_Unicode* pSep = static_getLineEndText( aSeparator );
+ for ( ULONG nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; nNode++ )
+ {
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
+
+ USHORT nStartPos = 0;
+ USHORT nEndPos = pNode->GetText().Len();
+ if ( nNode == nStartPara )
+ nStartPos = aSel.GetStart().GetIndex();
+ if ( nNode == nEndPara ) // kann auch == nStart sein!
+ nEndPos = aSel.GetEnd().GetIndex();
+
+ aText += pNode->GetText().Copy( nStartPos, nEndPos-nStartPos );
+ if ( nNode < nEndPara )
+ aText += pSep;
+ }
+ return aText;
+}
+
+void TextEngine::ImpRemoveText()
+{
+ ImpInitDoc();
+
+ TextPaM aStartPaM( 0, 0 );
+ TextSelection aEmptySel( aStartPaM, aStartPaM );
+ for ( USHORT nView = 0; nView < mpViews->Count(); nView++ )
+ {
+ TextView* pView = mpViews->GetObject( nView );
+ pView->maSelection = aEmptySel;
+ }
+ ResetUndo();
+}
+
+void TextEngine::SetText( const XubString& rText )
+{
+ ImpRemoveText();
+
+ BOOL bUndoCurrentlyEnabled = IsUndoEnabled();
+ // Der von Hand reingesteckte Text kann nicht vom Anwender rueckgaengig gemacht werden.
+ EnableUndo( FALSE );
+
+ TextPaM aStartPaM( 0, 0 );
+ TextSelection aEmptySel( aStartPaM, aStartPaM );
+
+ TextPaM aPaM = aStartPaM;
+ if ( rText.Len() )
+ aPaM = ImpInsertText( aEmptySel, rText );
+
+ for ( USHORT nView = 0; nView < mpViews->Count(); nView++ )
+ {
+ TextView* pView = mpViews->GetObject( nView );
+// if ( !pView->IsReadOnly() )
+// pView->maSelection = aPaM;
+// else
+ pView->maSelection = aEmptySel;
+
+ // Wenn kein Text, dann auch Kein Format&Update
+ // => Der Text bleibt stehen.
+ if ( !rText.Len() && GetUpdateMode() )
+ pView->Invalidate();
+ }
+
+ if( !rText.Len() ) // sonst muss spaeter noch invalidiert werden, !bFormatted reicht.
+ mnCurTextHeight = 0;
+
+ FormatAndUpdate();
+
+ EnableUndo( bUndoCurrentlyEnabled );
+ DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "Undo nach SetText?" );
+}
+
+
+void TextEngine::CursorMoved( ULONG nNode )
+{
+ // Leere Attribute loeschen, aber nur, wenn Absatz nicht leer!
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
+ if ( pNode && pNode->GetCharAttribs().HasEmptyAttribs() && pNode->GetText().Len() )
+ pNode->GetCharAttribs().DeleteEmptyAttribs();
+}
+
+void TextEngine::ImpRemoveChars( const TextPaM& rPaM, USHORT nChars, SfxUndoAction* pCurUndo )
+{
+ DBG_ASSERT( nChars, "ImpRemoveChars - 0 Chars?!" );
+ if ( IsUndoEnabled() && !IsInUndo() )
+ {
+ // Attribute muessen hier vorm RemoveChars fuer UNDO gesichert werden!
+ TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+ XubString aStr( pNode->GetText().Copy( rPaM.GetIndex(), nChars ) );
+
+ // Pruefen, ob Attribute geloescht oder geaendert werden:
+ USHORT nStart = rPaM.GetIndex();
+ USHORT nEnd = nStart + nChars;
+ for ( USHORT nAttr = pNode->GetCharAttribs().Count(); nAttr; )
+ {
+ TextCharAttrib* pAttr = pNode->GetCharAttribs().GetAttrib( --nAttr );
+ if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetStart() < nEnd ) )
+ {
+// TextSelection aSel( rPaM );
+// aSel.GetEnd().GetIndex() += nChars;
+// TextUndoSetAttribs* pAttrUndo = CreateAttribUndo( aSel );
+// InsertUndo( pAttrUndo );
+ break; // for
+ }
+ }
+// if ( pCurUndo && ( CreateTextPaM( pCurUndo->GetEPaM() ) == rPaM ) )
+// pCurUndo->GetStr() += aStr;
+// else
+ InsertUndo( new TextUndoRemoveChars( this, rPaM, aStr ) );
+ }
+
+ mpDoc->RemoveChars( rPaM, nChars );
+ ImpCharsRemoved( rPaM.GetPara(), rPaM.GetIndex(), nChars );
+}
+
+TextPaM TextEngine::ImpConnectParagraphs( ULONG nLeft, ULONG nRight )
+{
+ DBG_ASSERT( nLeft != nRight, "Den gleichen Absatz zusammenfuegen ?" );
+
+ TextNode* pLeft = mpDoc->GetNodes().GetObject( nLeft );
+ TextNode* pRight = mpDoc->GetNodes().GetObject( nRight );
+
+ if ( IsUndoEnabled() && !IsInUndo() )
+ InsertUndo( new TextUndoConnectParas( this, nLeft, pLeft->GetText().Len() ) );
+
+ // Erstmal Portions suchen, da pRight nach ConnectParagraphs weg.
+ TEParaPortion* pLeftPortion = mpTEParaPortions->GetObject( nLeft );
+ TEParaPortion* pRightPortion = mpTEParaPortions->GetObject( nRight );
+ DBG_ASSERT( pLeft && pLeftPortion, "Blinde Portion in ImpConnectParagraphs(1)" );
+ DBG_ASSERT( pRight && pRightPortion, "Blinde Portion in ImpConnectParagraphs(2)" );
+
+ TextPaM aPaM = mpDoc->ConnectParagraphs( pLeft, pRight );
+ ImpParagraphRemoved( nRight );
+
+ pLeftPortion->MarkSelectionInvalid( aPaM.GetIndex(), pLeft->GetText().Len() );
+
+ mpTEParaPortions->Remove( nRight );
+ delete pRightPortion;
+ // der rechte Node wird von EditDoc::ConnectParagraphs() geloescht.
+
+ return aPaM;
+}
+
+TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
+{
+ if ( !rSel.HasRange() )
+ return rSel.GetStart();
+
+ TextSelection aSel( rSel );
+ aSel.Justify();
+ TextPaM aStartPaM( aSel.GetStart() );
+ TextPaM aEndPaM( aSel.GetEnd() );
+
+ CursorMoved( aStartPaM.GetPara() ); // nur damit neu eingestellte Attribute verschwinden...
+ CursorMoved( aEndPaM.GetPara() ); // nur damit neu eingestellte Attribute verschwinden...
+
+ DBG_ASSERT( mpDoc->IsValidPaM( aStartPaM ), "Index im Wald in ImpDeleteText" )
+ DBG_ASSERT( mpDoc->IsValidPaM( aEndPaM ), "Index im Wald in ImpDeleteText" )
+
+ ULONG nStartNode = aStartPaM.GetPara();
+ ULONG nEndNode = aEndPaM.GetPara();
+
+ // Alle Nodes dazwischen entfernen....
+ for ( ULONG z = nStartNode+1; z < nEndNode; z++ )
+ {
+ // Immer nStartNode+1, wegen Remove()!
+ ImpRemoveParagraph( nStartNode+1 );
+ }
+
+ if ( nStartNode != nEndNode )
+ {
+ // Den Rest des StartNodes...
+ TextNode* pLeft = mpDoc->GetNodes().GetObject( nStartNode );
+ USHORT nChars = pLeft->GetText().Len() - aStartPaM.GetIndex();
+ if ( nChars )
+ {
+ ImpRemoveChars( aStartPaM, nChars );
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nStartNode );
+ DBG_ASSERT( pPortion, "Blinde Portion in ImpDeleteText(3)" );
+ pPortion->MarkSelectionInvalid( aStartPaM.GetIndex(), pLeft->GetText().Len() );
+ }
+
+ // Den Anfang des EndNodes....
+ nEndNode = nStartNode+1; // Die anderen Absaetze wurden geloescht
+ nChars = aEndPaM.GetIndex();
+ if ( nChars )
+ {
+ aEndPaM.GetPara() = nEndNode;
+ aEndPaM.GetIndex() = 0;
+ ImpRemoveChars( aEndPaM, nChars );
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nEndNode );
+ DBG_ASSERT( pPortion, "Blinde Portion in ImpDeleteText(4)" );
+ pPortion->MarkSelectionInvalid( 0, pPortion->GetNode()->GetText().Len() );
+ }
+
+ // Zusammenfuegen....
+ aStartPaM = ImpConnectParagraphs( nStartNode, nEndNode );
+ }
+ else
+ {
+ USHORT nChars;
+ nChars = aEndPaM.GetIndex() - aStartPaM.GetIndex();
+ ImpRemoveChars( aStartPaM, nChars );
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nStartNode );
+ DBG_ASSERT( pPortion, "Blinde Portion in ImpDeleteText(5)" );
+ pPortion->MarkInvalid( aEndPaM.GetIndex(), aStartPaM.GetIndex() - aEndPaM.GetIndex() );
+ }
+
+// UpdateSelections();
+ TextModified();
+ return aStartPaM;
+}
+
+void TextEngine::ImpRemoveParagraph( ULONG nPara )
+{
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara );
+
+ // Der Node wird vom Undo verwaltet und ggf. zerstoert!
+ /* delete */ mpDoc->GetNodes().Remove( nPara );
+ if ( IsUndoEnabled() && !IsInUndo() )
+ InsertUndo( new TextUndoDelPara( this, pNode, nPara ) );
+ else
+ delete pNode;
+
+ mpTEParaPortions->Remove( nPara );
+ delete pPortion;
+
+ ImpParagraphRemoved( nPara );
+}
+
+TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, sal_Unicode c, BOOL bOverwrite )
+{
+ DBG_ASSERT( c != '\n', "Zeilenumbruch bei InsertText ?" );
+ DBG_ASSERT( c != '\r', "Zeilenumbruch bei InsertText ?" );
+
+ TextPaM aPaM( rCurSel.GetStart() );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+
+ if ( pNode->GetText().Len() < STRING_MAXLEN )
+ {
+ BOOL bDoOverwrite = ( bOverwrite &&
+ ( aPaM.GetIndex() < pNode->GetText().Len() ) ) ? TRUE : FALSE;
+
+ BOOL bUndoAction = ( rCurSel.HasRange() || bDoOverwrite );
+
+ if ( bUndoAction )
+ UndoActionStart( TEXTUNDO_INSERT );
+
+ if ( rCurSel.HasRange() )
+ {
+ aPaM = ImpDeleteText( rCurSel );
+ }
+ else if ( bDoOverwrite )
+ {
+ // Wenn Selektion, dann kein Zeichen ueberschreiben
+ TextSelection aTmpSel( aPaM );
+ aTmpSel.GetEnd().GetIndex()++;
+ ImpDeleteText( aTmpSel );
+ }
+
+ if ( IsUndoEnabled() && !IsInUndo() )
+ {
+ TextUndoInsertChars* pNewUndo = new TextUndoInsertChars( this, aPaM, c );
+ BOOL bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? TRUE : FALSE;
+ InsertUndo( pNewUndo, bTryMerge );
+ }
+
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( aPaM.GetPara() );
+ pPortion->MarkInvalid( aPaM.GetIndex(), 1 );
+ if ( c == '\t' )
+ pPortion->SetNotSimpleInvalid();
+ aPaM = mpDoc->InsertText( aPaM, c );
+ ImpCharsInserted( aPaM.GetPara(), aPaM.GetIndex()-1, 1 );
+
+ TextModified();
+
+ if ( bUndoAction )
+ UndoActionEnd( TEXTUNDO_INSERT );
+ }
+
+ return aPaM;
+}
+
+TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, const XubString& rStr )
+{
+ TextPaM aPaM;
+
+ if ( rCurSel.HasRange() )
+ aPaM = ImpDeleteText( rCurSel );
+ else
+ aPaM = rCurSel.GetEnd();
+
+ TextPaM aCurPaM( aPaM ); // fuers Invalidieren
+
+ XubString aText( rStr );
+ aText.ConvertLineEnd( LINEEND_LF );
+
+ USHORT nStart = 0;
+ while ( nStart < aText.Len() )
+ {
+ USHORT nEnd = aText.Search( LINE_SEP, nStart );
+ if ( nEnd == STRING_NOTFOUND )
+ nEnd = aText.Len(); // nicht dereferenzieren!
+
+ // Start == End => Leerzeile
+ if ( nEnd > nStart )
+ {
+ ULONG nL = aPaM.GetIndex();
+ nL += ( nEnd-nStart );
+ if ( nL > STRING_MAXLEN )
+ {
+ USHORT nDiff = (USHORT) (nL-STRING_MAXLEN);
+ nEnd -= nDiff;
+ }
+
+ XubString aLine( aText, nStart, nEnd-nStart );
+ if ( IsUndoEnabled() && !IsInUndo() )
+ InsertUndo( new TextUndoInsertChars( this, aPaM, aLine ) );
+
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( aPaM.GetPara() );
+ pPortion->MarkInvalid( aPaM.GetIndex(), aLine.Len() );
+ if ( aLine.Search( '\t' ) != STRING_NOTFOUND )
+ pPortion->SetNotSimpleInvalid();
+
+ aPaM = mpDoc->InsertText( aPaM, aLine );
+ ImpCharsInserted( aPaM.GetPara(), aPaM.GetIndex()-aLine.Len(), aLine.Len() );
+
+ }
+ if ( nEnd < aText.Len() )
+ aPaM = ImpInsertParaBreak( aPaM );
+
+ nStart = nEnd+1;
+ }
+
+ TextModified();
+ return aPaM;
+}
+
+TextPaM TextEngine::ImpInsertParaBreak( const TextSelection& rCurSel, BOOL bKeepEndingAttribs )
+{
+ TextPaM aPaM;
+ if ( rCurSel.HasRange() )
+ aPaM = ImpDeleteText( rCurSel );
+ else
+ aPaM = rCurSel.GetEnd();
+
+ return ImpInsertParaBreak( aPaM, bKeepEndingAttribs );
+}
+
+TextPaM TextEngine::ImpInsertParaBreak( const TextPaM& rPaM, BOOL bKeepEndingAttribs )
+{
+ if ( IsUndoEnabled() && !IsInUndo() )
+ InsertUndo( new TextUndoSplitPara( this, rPaM.GetPara(), rPaM.GetIndex() ) );
+
+ TextPaM aPaM( mpDoc->InsertParaBreak( rPaM, bKeepEndingAttribs ) );
+
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( rPaM.GetPara() );
+ DBG_ASSERT( pPortion, "Blinde Portion in ImpInsertParaBreak" );
+ pPortion->MarkInvalid( rPaM.GetIndex(), 0 );
+
+ TextNode* pNewNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ TEParaPortion* pNewPortion = new TEParaPortion( pNewNode );
+ mpTEParaPortions->Insert( pNewPortion, aPaM.GetPara() );
+ ImpParagraphInserted( aPaM.GetPara() );
+
+ CursorMoved( rPaM.GetPara() ); // falls leeres Attribut entstanden.
+ TextModified();
+ return aPaM;
+}
+
+Rectangle TextEngine::PaMtoEditCursor( const TextPaM& rPaM, BOOL bSpecial )
+{
+ DBG_ASSERT( GetUpdateMode(), "Darf bei Update=FALSE nicht erreicht werden: PaMtoEditCursor" );
+
+ Rectangle aEditCursor;
+ long nY = 0;
+ for ( ULONG nPortion = 0; nPortion < rPaM.GetPara(); nPortion++ )
+ {
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject(nPortion);
+ nY += pPortion->GetLines().Count() * mnCharHeight;
+ }
+ aEditCursor = GetEditCursor( rPaM, bSpecial );
+ aEditCursor.Top() += nY;
+ aEditCursor.Bottom() += nY;
+ return aEditCursor;
+}
+
+Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, BOOL bSpecial )
+{
+ DBG_ASSERT( IsFormatted(), "GetEditCursor: Nicht formatiert" );
+
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( rPaM.GetPara() );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+
+ /*
+ bSpecial: Wenn hinter dem letzten Zeichen einer umgebrochenen Zeile,
+ am Ende der Zeile bleiben, nicht am Anfang der naechsten.
+ Zweck: - END => wirklich hinter das letzte Zeichen
+ - Selektion....
+ */
+
+ long nY = 0;
+ USHORT nCurIndex = 0;
+ TextLine* pLine = 0;
+ for ( USHORT nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
+ {
+ TextLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
+ if ( ( pTmpLine->GetStart() == rPaM.GetIndex() ) || ( pTmpLine->IsIn( rPaM.GetIndex(), bSpecial ) ) )
+ {
+ pLine = pTmpLine;
+ break;
+ }
+
+ nCurIndex += pTmpLine->GetLen();
+ nY += mnCharHeight;
+ }
+ if ( !pLine )
+ {
+ // Cursor am Ende des Absatzes.
+ DBG_ASSERT( rPaM.GetIndex() == nCurIndex, "Index voll daneben in GetEditCursor!" );
+
+ pLine = pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1 );
+ nY -= mnCharHeight;
+ nCurIndex -= pLine->GetLen();
+ }
+
+ Rectangle aEditCursor;
+
+ aEditCursor.Top() = nY;
+ nY += mnCharHeight;
+ aEditCursor.Bottom() = nY-1;
+
+ // innerhalb der Zeile suchen....
+ long nX = pLine->GetStartX();
+ for ( USHORT i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ )
+ {
+ TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( i );
+ nCurIndex += pTextPortion->GetLen();
+ if ( nCurIndex <= rPaM.GetIndex() )
+ {
+ nX += pTextPortion->GetWidth();
+
+ if ( nCurIndex == rPaM.GetIndex() )
+ break; // for
+ }
+ else // suchen und Ende
+ {
+ nCurIndex -= pTextPortion->GetLen();
+ nX += (long)CalcTextWidth( rPaM.GetPara(), nCurIndex, rPaM.GetIndex()-nCurIndex );
+ break; // for
+ }
+ }
+
+ aEditCursor.Left() = aEditCursor.Right() = nX;
+ return aEditCursor;
+}
+
+const TextAttrib* TextEngine::FindAttrib( const TextPaM& rPaM, USHORT nWhich ) const
+{
+ const TextAttrib* pAttr = NULL;
+ const TextCharAttrib* pCharAttr = FindCharAttrib( rPaM, nWhich );
+ if ( pCharAttr )
+ pAttr = &pCharAttr->GetAttr();
+ return pAttr;
+}
+
+const TextCharAttrib* TextEngine::FindCharAttrib( const TextPaM& rPaM, USHORT nWhich ) const
+{
+ const TextCharAttrib* pAttr = NULL;
+ TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+ if ( pNode && ( rPaM.GetIndex() < pNode->GetText().Len() ) )
+ pAttr = pNode->GetCharAttribs().FindAttrib( nWhich, rPaM.GetIndex() );
+ return pAttr;
+}
+
+BOOL TextEngine::HasAttrib( USHORT nWhich ) const
+{
+ BOOL bAttr = FALSE;
+ for ( ULONG n = mpDoc->GetNodes().Count(); --n && !bAttr; )
+ {
+ TextNode* pNode = mpDoc->GetNodes().GetObject( n );
+ bAttr = pNode->GetCharAttribs().HasAttrib( nWhich );
+ }
+ return bAttr;
+}
+
+TextPaM TextEngine::GetPaM( const Point& rDocPos, BOOL bSmart )
+{
+ DBG_ASSERT( GetUpdateMode(), "Darf bei Update=FALSE nicht erreicht werden: GetPaM" );
+
+ long nY = 0;
+ for ( ULONG nPortion = 0; nPortion < mpTEParaPortions->Count(); nPortion++ )
+ {
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
+ long nTmpHeight = pPortion->GetLines().Count() * mnCharHeight;
+ nY += nTmpHeight;
+ if ( nY > rDocPos.Y() )
+ {
+ nY -= nTmpHeight;
+ Point aPosInPara( rDocPos );
+ aPosInPara.Y() -= nY;
+
+ TextPaM aPaM( nPortion, 0 );
+ aPaM.GetIndex() = ImpFindIndex( nPortion, aPosInPara, bSmart );
+ return aPaM;
+ }
+ }
+
+ // Nicht gefunden - Dann den letzten sichtbare...
+ ULONG nLastNode = mpDoc->GetNodes().Count() - 1;
+ TextNode* pLast = mpDoc->GetNodes().GetObject( nLastNode );
+ return TextPaM( nLastNode, pLast->GetText().Len() );
+}
+
+USHORT TextEngine::ImpFindIndex( ULONG nPortion, const Point& rPosInPara, BOOL bSmart )
+{
+ DBG_ASSERT( IsFormatted(), "GetPaM: Nicht formatiert" );
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
+
+ USHORT nCurIndex = 0;
+
+ long nY = 0;
+ TextLine* pLine = 0;
+ USHORT nLine;
+ for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ )
+ {
+ TextLine* pTmpLine = pPortion->GetLines().GetObject( nLine );
+ nY += mnCharHeight;
+ if ( nY > rPosInPara.Y() ) // das war 'se
+ {
+ pLine = pTmpLine;
+ break; // richtige Y-Position intressiert nicht
+ }
+ }
+ DBG_ASSERT( pLine, "ImpFindIndex: pLine ?" );
+
+ nCurIndex = GetCharPos( nPortion, nLine, rPosInPara.X(), bSmart );
+
+ if ( nCurIndex && ( nCurIndex == pLine->GetEnd() ) &&
+ ( pLine != pPortion->GetLines().GetObject( pPortion->GetLines().Count()-1) ) )
+ {
+ nCurIndex--;
+ }
+ return nCurIndex;
+}
+
+USHORT TextEngine::GetCharPos( ULONG nPortion, USHORT nLine, long nXPos, BOOL bSmart )
+{
+
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
+ TextLine* pLine = pPortion->GetLines().GetObject( nLine );
+
+ USHORT nCurIndex = pLine->GetStart();
+
+ if ( !nXPos )
+ return nCurIndex;
+
+ long nTmpX = pLine->GetStartX();
+ for ( USHORT i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ )
+ {
+ TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( i );
+ nTmpX += pTextPortion->GetWidth();
+
+ if ( nTmpX > nXPos )
+ {
+ if( pTextPortion->GetLen() > 1 )
+ {
+ nTmpX -= pTextPortion->GetWidth(); // vor die Portion stellen
+ // Optimieren: Kein GetTextBreak, wenn feste Fontbreite...
+ Font aFont;
+ SeekCursor( nPortion, nCurIndex+1, aFont );
+ mpRefDev->SetFont( aFont );
+ nCurIndex = mpRefDev->GetTextBreak( pPortion->GetNode()->GetText(), nXPos-nTmpX, nCurIndex );
+ }
+ return nCurIndex;
+ }
+ nCurIndex += pTextPortion->GetLen();
+ }
+ return nCurIndex;
+}
+
+
+ULONG TextEngine::GetTextHeight() const
+{
+ DBG_ASSERT( GetUpdateMode(), "Sollte bei Update=FALSE nicht verwendet werden: GetTextHeight" );
+ DBG_ASSERT( IsFormatted() || IsFormatting(), "GetTextHeight: Nicht formatiert" );
+ return mnCurTextHeight;
+}
+
+ULONG TextEngine::CalcTextWidth()
+{
+ if ( !IsFormatted() && !IsFormatting() )
+ FormatDoc();
+
+ long nMaxWidth = 0;
+ long nCurWidth = 0;
+
+ // --------------------------------------------------
+ // Ueber alle Absaetze...
+ // --------------------------------------------------
+ ULONG nParas = mpTEParaPortions->Count();
+ for ( ULONG nPara = mpTEParaPortions->Count(); nPara; )
+ {
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( --nPara );
+
+ // --------------------------------------------------
+ // Ueber die Zeilen des Absatzes...
+ // --------------------------------------------------
+ for ( USHORT nLine = pPortion->GetLines().Count(); nLine; )
+ {
+ TextLine* pLine = pPortion->GetLines().GetObject( --nLine );
+ // --------------------------------------------------
+ // Ueber die Portions der Zeile
+ // --------------------------------------------------
+ nCurWidth = 0;
+ for ( USHORT nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ )
+ {
+ TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( nTP );
+ nCurWidth += pTextPortion->GetWidth();
+ }
+ if ( nCurWidth > nMaxWidth )
+ nMaxWidth = nCurWidth;
+ }
+ }
+ nMaxWidth++; // Ein breiter, da in CreateLines bei >= umgebrochen wird.
+ return (ULONG)nMaxWidth;
+}
+
+ULONG TextEngine::CalcTextHeight()
+{
+ DBG_ASSERT( GetUpdateMode(), "Sollte bei Update=FALSE nicht verwendet werden: CalcTextHeight" );
+
+ ULONG nY = 0;
+ for ( ULONG nPortion = mpTEParaPortions->Count(); nPortion; )
+ nY += CalcParaHeight( --nPortion );
+ return nY;
+}
+
+ULONG TextEngine::CalcTextWidth( ULONG nPara, USHORT nPortionStart, USHORT nLen, const Font* pFont )
+{
+ // Innerhalb des Textes darf es keinen Portionwechsel (Attribut/Tab) geben!
+ DBG_ASSERT( mpDoc->GetNodes().GetObject( nPara )->GetText().Search( '\t', nPortionStart ) >= (nPortionStart+nLen), "CalcTextWidth: Tab!" );
+
+ ULONG nWidth;
+ if ( mnFixCharWidth100 )
+ nWidth = (ULONG)nLen*mnFixCharWidth100/100;
+ else
+ {
+ if ( pFont )
+ {
+ if ( !mpRefDev->GetFont().IsSameInstance( *pFont ) )
+ mpRefDev->SetFont( *pFont );
+ }
+ else
+ {
+ Font aFont;
+ SeekCursor( nPara, nPortionStart+1, aFont );
+ mpRefDev->SetFont( aFont );
+ }
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ nWidth = (ULONG)mpRefDev->GetTextWidth( pNode->GetText(), nPortionStart, nLen );
+
+ }
+ return nWidth;
+}
+
+
+USHORT TextEngine::GetLineCount( ULONG nParagraph ) const
+{
+ DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" );
+
+ TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph );
+ if ( pPPortion )
+ return pPPortion->GetLines().Count();
+
+ return 0xFFFF;
+}
+
+USHORT TextEngine::GetLineLen( ULONG nParagraph, USHORT nLine ) const
+{
+ DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" );
+
+ TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph );
+ if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) )
+ {
+ TextLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ return pLine->GetLen();
+ }
+
+ return 0xFFFF;
+}
+
+ULONG TextEngine::CalcParaHeight( ULONG nParagraph )
+{
+ ULONG nHeight = 0;
+
+ TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph );
+ DBG_ASSERT( pPPortion, "Absatz nicht gefunden: GetParaHeight" );
+ if ( pPPortion )
+ nHeight = pPPortion->GetLines().Count() * mnCharHeight;
+
+ return nHeight;
+}
+
+void TextEngine::UpdateSelections()
+{
+}
+
+Range TextEngine::GetInvalidYOffsets( ULONG nPortion )
+{
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion );
+ USHORT nLines = pTEParaPortion->GetLines().Count();
+ USHORT nLastInvalid, nFirstInvalid = 0;
+ USHORT nLine;
+ for ( nLine = 0; nLine < nLines; nLine++ )
+ {
+ TextLine* pL = pTEParaPortion->GetLines().GetObject( nLine );
+ if ( pL->IsInvalid() )
+ {
+ nFirstInvalid = nLine;
+ break;
+ }
+ }
+
+ for ( nLastInvalid = nFirstInvalid; nLastInvalid < nLines; nLastInvalid++ )
+ {
+ TextLine* pL = pTEParaPortion->GetLines().GetObject( nLine );
+ if ( pL->IsValid() )
+ break;
+ }
+
+ if ( nLastInvalid >= nLines )
+ nLastInvalid = nLines-1;
+
+ return Range( nFirstInvalid*mnCharHeight, ((nLastInvalid+1)*mnCharHeight)-1 );
+}
+
+ULONG TextEngine::GetParagraphCount() const
+{
+ return mpDoc->GetNodes().Count();
+}
+
+void TextEngine::EnableUndo( BOOL bEnable )
+{
+ // Beim Umschalten des Modus Liste loeschen:
+ if ( bEnable != IsUndoEnabled() )
+ ResetUndo();
+
+ mbUndoEnabled = bEnable;
+}
+
+SfxUndoManager& TextEngine::GetUndoManager()
+{
+ if ( !mpUndoManager )
+ mpUndoManager = new TextUndoManager( this );
+ return *mpUndoManager;
+}
+
+void TextEngine::UndoActionStart( USHORT nId )
+{
+ if ( IsUndoEnabled() && !IsInUndo() )
+ {
+ String aComment;
+ // ...
+ GetUndoManager().EnterListAction( aComment, XubString(), nId );
+ }
+}
+
+void TextEngine::UndoActionEnd( USHORT nId )
+{
+ if ( IsUndoEnabled() && !IsInUndo() )
+ GetUndoManager().LeaveListAction();
+}
+
+void TextEngine::InsertUndo( TextUndo* pUndo, BOOL bTryMerge )
+{
+ DBG_ASSERT( !IsInUndo(), "InsertUndo im Undomodus!" );
+ GetUndoManager().AddUndoAction( pUndo, bTryMerge );
+}
+
+void TextEngine::ResetUndo()
+{
+ if ( mpUndoManager )
+ mpUndoManager->Clear();
+}
+
+void TextEngine::InsertContent( TextNode* pNode, ULONG nPara )
+{
+ DBG_ASSERT( pNode, "NULL-Pointer in InsertContent! " );
+ DBG_ASSERT( IsInUndo(), "InsertContent nur fuer Undo()!" );
+ TEParaPortion* pNew = new TEParaPortion( pNode );
+ mpTEParaPortions->Insert( pNew, nPara );
+ mpDoc->GetNodes().Insert( pNode, nPara );
+ ImpParagraphInserted( nPara );
+}
+
+TextPaM TextEngine::SplitContent( ULONG nNode, USHORT nSepPos )
+{
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nNode );
+ DBG_ASSERT( pNode, "Ungueltiger Node in SplitContent" );
+ DBG_ASSERT( IsInUndo(), "SplitContent nur fuer Undo()!" );
+ DBG_ASSERT( nSepPos <= pNode->GetText().Len(), "Index im Wald: SplitContent" );
+ TextPaM aPaM( nNode, nSepPos );
+ return ImpInsertParaBreak( aPaM );
+}
+
+TextPaM TextEngine::ConnectContents( ULONG nLeftNode )
+{
+ DBG_ASSERT( IsInUndo(), "ConnectContent nur fuer Undo()!" );
+ return ImpConnectParagraphs( nLeftNode, nLeftNode+1 );
+}
+
+void TextEngine::SeekCursor( ULONG nPara, USHORT nPos, Font& rFont )
+{
+ rFont = maFont;
+
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ USHORT nAttribs = pNode->GetCharAttribs().Count();
+ for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ )
+ {
+ TextCharAttrib* pAttrib = pNode->GetCharAttribs().GetAttrib( nAttr );
+ if ( pAttrib->GetStart() > nPos )
+ break;
+
+ // Beim Seeken nicht die Attr beruecksichtigen, die dort beginnen!
+ // Leere Attribute werden beruecksichtigt( verwendet), da diese
+ // gerade eingestellt wurden.
+ // 12.4.95: Doch keine Leeren Attribute verwenden:
+ // - Wenn gerade eingestellt und leer => keine Auswirkung auf Font
+ // In einem leeren Absatz eingestellte Zeichen werden sofort wirksam.
+ if ( ( ( pAttrib->GetStart() < nPos ) && ( pAttrib->GetEnd() >= nPos ) )
+ || !pNode->GetText().Len() )
+ {
+ pAttrib->GetAttr().SetFont( rFont );
+ }
+ }
+}
+
+void TextEngine::SetUpdateMode( BOOL bUp, TextView* pCurView, BOOL bForceUpdate )
+{
+ BOOL bChanged = ( GetUpdateMode() != bUp );
+
+ mbUpdate = bUp;
+ if ( mbUpdate && ( bChanged || bForceUpdate ) )
+ FormatAndUpdate( pCurView );
+}
+
+void TextEngine::FormatAndUpdate( TextView* pCurView )
+{
+ if ( mbDowning )
+ return ;
+
+ if ( IsInUndo() )
+ IdleFormatAndUpdate( pCurView );
+ else
+ {
+ FormatDoc();
+ UpdateViews( pCurView );
+ }
+}
+
+
+void TextEngine::IdleFormatAndUpdate( TextView* pCurView )
+{
+ mpIdleFormatter->DoIdleFormat( pCurView );
+}
+
+void TextEngine::TextModified()
+{
+ mbFormatted = FALSE;
+}
+
+void TextEngine::UpdateViews( TextView* pCurView )
+{
+ if ( !GetUpdateMode() || IsFormatting() || maInvalidRec.IsEmpty() )
+ return;
+
+ DBG_ASSERT( IsFormatted(), "UpdateViews: Doc nicht formatiert!" );
+
+ for ( USHORT nView = 0; nView < mpViews->Count(); nView++ )
+ {
+ TextView* pView = mpViews->GetObject( nView );
+ pView->HideCursor();
+
+ Rectangle aClipRec( maInvalidRec );
+ Rectangle aVisArea( pView->GetStartDocPos(), pView->GetWindow()->GetOutputSizePixel() );
+ aClipRec.Intersection( aVisArea );
+ if ( !aClipRec.IsEmpty() )
+ {
+ // in Fensterkoordinaten umwandeln....
+ aClipRec.SetPos( pView->GetWindowPos( aClipRec.TopLeft() ) );
+
+ if ( pView == pCurView )
+ pView->ImpPaint( aClipRec, TRUE );
+ else
+ pView->GetWindow()->Invalidate( aClipRec );
+ }
+ }
+
+ if ( pCurView )
+ {
+ pCurView->ShowCursor( pCurView->mbAutoScroll );
+ }
+
+ maInvalidRec = Rectangle();
+}
+
+IMPL_LINK_INLINE_START( TextEngine, IdleFormatHdl, Timer *, EMPTYARG )
+{
+ mpIdleFormatter->ResetRestarts();
+ FormatAndUpdate( mpIdleFormatter->GetView() );
+ return 0;
+}
+IMPL_LINK_INLINE_END( TextEngine, IdleFormatHdl, Timer *, EMPTYARG )
+
+void TextEngine::CheckIdleFormatter()
+{
+ mpIdleFormatter->ForceTimeout();
+}
+
+void TextEngine::FormatFullDoc()
+{
+ for ( ULONG nPortion = 0; nPortion < mpTEParaPortions->Count(); nPortion++ )
+ {
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion );
+ USHORT nLen = pTEParaPortion->GetNode()->GetText().Len();
+ pTEParaPortion->MarkSelectionInvalid( 0, nLen );
+ }
+ FormatDoc();
+}
+
+void TextEngine::FormatDoc()
+{
+ if ( !GetUpdateMode() || IsFormatting() )
+ return;
+
+ mbIsFormatting = TRUE;
+ mbModified = TRUE;
+
+ long nY = 0;
+ BOOL bGrow = FALSE;
+
+ maInvalidRec = Rectangle(); // leermachen
+ for ( ULONG nPara = 0; nPara < mpTEParaPortions->Count(); nPara++ )
+ {
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+ if ( pTEParaPortion->IsInvalid() )
+ {
+ ImpFormattingParagraph( nPara );
+
+ if ( CreateLines( nPara ) )
+ bGrow = TRUE;
+
+ // InvalidRec nur einmal setzen...
+ if ( maInvalidRec.IsEmpty() )
+ {
+ // Bei Paperwidth 0 (AutoPageSize) bleibt es sonst Empty()...
+ long nWidth = (long)mnMaxTextWidth;
+ if ( !nWidth )
+ nWidth = 0x7FFFFFFF;
+ Range aInvRange( GetInvalidYOffsets( nPara ) );
+ maInvalidRec = Rectangle( Point( 0, nY+aInvRange.Min() ),
+ Size( nWidth, aInvRange.Len() ) );
+ }
+ else
+ {
+ maInvalidRec.Bottom() = nY + CalcParaHeight( nPara );
+ }
+ }
+ else if ( bGrow )
+ {
+ maInvalidRec.Bottom() = nY + CalcParaHeight( nPara );
+ }
+ nY += CalcParaHeight( nPara );
+ }
+
+ if ( !maInvalidRec.IsEmpty() )
+ {
+ ULONG nNewHeight = CalcTextHeight();
+ long nDiff = nNewHeight - mnCurTextHeight;
+ if ( nNewHeight < mnCurTextHeight )
+ {
+ maInvalidRec.Bottom() = (long)Max( nNewHeight, mnCurTextHeight );
+ if ( maInvalidRec.IsEmpty() )
+ {
+ maInvalidRec.Top() = 0;
+ // Left und Right werden nicht ausgewertet, aber wegen IsEmpty gesetzt.
+ maInvalidRec.Left() = 0;
+ maInvalidRec.Right() = mnMaxTextWidth;
+ }
+ }
+
+ mnCurTextHeight = nNewHeight;
+ if ( nDiff )
+ {
+ mbFormatted = TRUE;
+ ImpTextHeightChanged();
+ }
+ }
+
+ mbIsFormatting = FALSE;
+ mbFormatted = TRUE;
+
+ ImpTextFormatted();
+}
+
+void TextEngine::CreateAndInsertEmptyLine( ULONG nPara )
+{
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+
+ TextLine* pTmpLine = new TextLine;
+ pTmpLine->SetStart( pNode->GetText().Len() );
+ pTmpLine->SetEnd( pTmpLine->GetStart() );
+ pTEParaPortion->GetLines().Insert( pTmpLine, pTEParaPortion->GetLines().Count() );
+
+ if ( meAlign == TXTALIGN_CENTER )
+ pTmpLine->SetStartX( (short)(mnMaxTextWidth / 2) );
+ else if ( meAlign == TXTALIGN_RIGHT )
+ pTmpLine->SetStartX( (short)mnMaxTextWidth );
+ else
+ pTmpLine->SetStartX( mpDoc->GetLeftMargin() );
+
+ BOOL bLineBreak = pNode->GetText().Len() ? TRUE : FALSE;
+
+ TextPortion* pDummyPortion = new TextPortion( 0 );
+ pDummyPortion->GetWidth() = 0;
+ pTEParaPortion->GetTextPortions().Insert( pDummyPortion, pTEParaPortion->GetTextPortions().Count() );
+
+ if ( bLineBreak == TRUE )
+ {
+ // -2: Die neue ist bereits eingefuegt.
+ TextLine* pLastLine = pTEParaPortion->GetLines().GetObject( pTEParaPortion->GetLines().Count()-2 );
+ DBG_ASSERT( pLastLine, "Weicher Umbruch, keine Zeile ?!" );
+ USHORT nPos = (USHORT) pTEParaPortion->GetTextPortions().Count() - 1 ;
+ pTmpLine->SetStartPortion( nPos );
+ pTmpLine->SetEndPortion( nPos );
+ }
+}
+
+void TextEngine::ImpBreakLine( ULONG nPara, TextLine* pLine, TextPortion* pPortion, USHORT nPortionStart, long nRemainingWidth )
+{
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+
+ // Font sollte noch eingestellt sein.
+ USHORT nMaxBreakPos = mpRefDev->GetTextBreak( pNode->GetText(), nRemainingWidth, nPortionStart );
+
+ DBG_ASSERT( nMaxBreakPos < pNode->GetText().Len(), "Break?!" );
+
+ if ( nMaxBreakPos == STRING_LEN ) // GetTextBreak() ist anderer Auffassung als GetTextSize()
+ nMaxBreakPos = pNode->GetText().Len() - 1;
+
+ uno::Reference < text::XBreakIterator > xBI = GetBreakIterator();
+ text::LineBreakHyphenationOptions aHyphOptions( NULL, 1 );
+ text::LineBreakUserOptions aUserOptions;
+ text::LineBreakResults aLBR = xBI->getLineBreak( pNode->GetText(), nMaxBreakPos, GetLocale(), pLine->GetStart(), aHyphOptions, aUserOptions );
+ USHORT nBreakPos = aLBR.breakIndex;
+ if ( nBreakPos <= pLine->GetStart() )
+ nBreakPos = nMaxBreakPos;
+
+ // die angeknackste Portion ist die End-Portion
+ pLine->SetEnd( nBreakPos );
+ USHORT nEndPortion = SplitTextPortion( nPara, nBreakPos );
+
+ sal_Bool bBlankSeparator = ( ( nBreakPos >= pLine->GetStart() ) &&
+ ( pNode->GetText().GetChar( nBreakPos ) == ' ' ) ) ? sal_True : sal_False;
+ if ( bBlankSeparator )
+ {
+ // Blanks am Zeilenende generell unterdruecken...
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+ TextPortion* pTP = pTEParaPortion->GetTextPortions().GetObject( nEndPortion );
+ DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion am Anfang der Zeile?" );
+ pTP->GetWidth() = (long)CalcTextWidth( nPara, nBreakPos-pTP->GetLen(), pTP->GetLen()-1 );
+ }
+ pLine->SetEndPortion( nEndPortion );
+}
+
+USHORT TextEngine::SplitTextPortion( ULONG nPara, USHORT nPos )
+{
+
+ // Die Portion bei nPos wird geplittet, wenn bei nPos nicht
+ // sowieso ein Wechsel ist
+ if ( nPos == 0 )
+ return 0;
+
+ USHORT nSplitPortion;
+ USHORT nTmpPos = 0;
+ TextPortion* pTextPortion = 0;
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+ USHORT nPortions = pTEParaPortion->GetTextPortions().Count();
+ for ( nSplitPortion = 0; nSplitPortion < nPortions; nSplitPortion++ )
+ {
+ TextPortion* pTP = pTEParaPortion->GetTextPortions().GetObject(nSplitPortion);
+ nTmpPos += pTP->GetLen();
+ if ( nTmpPos >= nPos )
+ {
+ if ( nTmpPos == nPos ) // dann braucht nichts geteilt werden
+ return nSplitPortion;
+ pTextPortion = pTP;
+ break;
+ }
+ }
+
+ DBG_ASSERT( pTextPortion, "Position ausserhalb des Bereichs!" );
+
+ USHORT nOverlapp = nTmpPos - nPos;
+ pTextPortion->GetLen() -= nOverlapp;
+ TextPortion* pNewPortion = new TextPortion( nOverlapp );
+ pTEParaPortion->GetTextPortions().Insert( pNewPortion, nSplitPortion+1 );
+ pTextPortion->GetWidth() = (long)CalcTextWidth( nPara, nPos-pTextPortion->GetLen(), pTextPortion->GetLen() );
+
+ return nSplitPortion;
+}
+
+void TextEngine::CreateTextPortions( ULONG nPara, USHORT nStartPos )
+{
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+ TextNode* pNode = pTEParaPortion->GetNode();
+ DBG_ASSERT( pNode->GetText().Len(), "CreateTextPortions sollte nicht fuer leere Absaetze verwendet werden!" );
+
+ TESortedPositions aPositions;
+ ULONG nZero = 0;
+ aPositions.Insert( nZero );
+
+ USHORT nAttribs = pNode->GetCharAttribs().Count();
+ for ( USHORT nAttr = 0; nAttr < nAttribs; nAttr++ )
+ {
+ TextCharAttrib* pAttrib = pNode->GetCharAttribs().GetAttrib( nAttr );
+
+ // Start und Ende in das Array eintragen...
+ // Die InsertMethode laesst keine doppelten Werte zu....
+ aPositions.Insert( pAttrib->GetStart() );
+ aPositions.Insert( pAttrib->GetEnd() );
+ }
+ aPositions.Insert( pNode->GetText().Len() );
+
+ USHORT nTabPos = pNode->GetText().Search( '\t', 0 );
+ while ( nTabPos != STRING_NOTFOUND )
+ {
+ aPositions.Insert( nTabPos );
+ aPositions.Insert( nTabPos + 1 );
+ nTabPos = pNode->GetText().Search( '\t', nTabPos+1 );
+ }
+
+ // Ab ... loeschen:
+ // Leider muss die Anzahl der TextPortions mit aPositions.Count()
+ // nicht uebereinstimmen, da evtl. Zeilenumbrueche...
+ USHORT nPortionStart = 0;
+ USHORT nInvPortion = 0;
+ for ( USHORT nP = 0; nP < pTEParaPortion->GetTextPortions().Count(); nP++ )
+ {
+ TextPortion* pTmpPortion = pTEParaPortion->GetTextPortions().GetObject(nP);
+ nPortionStart += pTmpPortion->GetLen();
+ if ( nPortionStart >= nStartPos )
+ {
+ nPortionStart -= pTmpPortion->GetLen();
+ nInvPortion = nP;
+ break;
+ }
+ }
+ DBG_ASSERT( nP < pTEParaPortion->GetTextPortions().Count() || !pTEParaPortion->GetTextPortions().Count(), "Nichts zum loeschen: CreateTextPortions" );
+ if ( nInvPortion && ( nPortionStart+pTEParaPortion->GetTextPortions().GetObject(nInvPortion)->GetLen() > nStartPos ) )
+ {
+ // lieber eine davor...
+ // Aber nur wenn es mitten in der Portion war, sonst ist es evtl.
+ // die einzige in der Zeile davor !
+ nInvPortion--;
+ nPortionStart -= pTEParaPortion->GetTextPortions().GetObject(nInvPortion)->GetLen();
+ }
+ pTEParaPortion->GetTextPortions().DeleteFromPortion( nInvPortion );
+
+ // Eine Portion kann auch durch einen Zeilenumbruch entstanden sein:
+ aPositions.Insert( nPortionStart );
+
+ USHORT nInvPos;
+ BOOL bFound = aPositions.Seek_Entry( nPortionStart, &nInvPos );
+ DBG_ASSERT( bFound && ( nInvPos < (aPositions.Count()-1) ), "InvPos ?!" );
+ for ( USHORT i = nInvPos+1; i < aPositions.Count(); i++ )
+ {
+ TextPortion* pNew = new TextPortion( (USHORT)aPositions[i] - (USHORT)aPositions[i-1] );
+ pTEParaPortion->GetTextPortions().Insert( pNew, pTEParaPortion->GetTextPortions().Count());
+ }
+
+ DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine Portions?!" );
+#ifdef EDITDEBUG
+ DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" );
+#endif
+}
+
+void TextEngine::RecalcTextPortion( ULONG nPara, USHORT nStartPos, short nNewChars )
+{
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+ DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine Portions!" );
+ DBG_ASSERT( nNewChars, "RecalcTextPortion mit Diff == 0" );
+
+ TextNode* const pNode = pTEParaPortion->GetNode();
+ if ( nNewChars > 0 )
+ {
+ // Wenn an nStartPos ein Attribut beginnt/endet, oder vor nStartPos
+ // ein Tab steht, faengt eine neue Portion an,
+ // ansonsten wird die Portion an nStartPos erweitert.
+ // Oder wenn ganz vorne ( StartPos 0 ) und dann ein Tab
+
+ if ( ( pNode->GetCharAttribs().HasBoundingAttrib( nStartPos ) ) ||
+ ( nStartPos && ( pNode->GetText().GetChar( nStartPos - 1 ) == '\t' ) ) ||
+ ( ( !nStartPos && ( nNewChars < pNode->GetText().Len() ) && pNode->GetText().GetChar( nNewChars ) == '\t' ) ) )
+ {
+ USHORT nNewPortionPos = 0;
+ if ( nStartPos )
+ nNewPortionPos = SplitTextPortion( nPara, nStartPos ) + 1;
+// else if ( ( pTEParaPortion->GetTextPortions().Count() == 1 ) &&
+// !pTEParaPortion->GetTextPortions()[0]->GetLen() )
+// pTEParaPortion->GetTextPortions().Reset(); // DummyPortion
+
+ // Eine leere Portion kann hier stehen, wenn der Absatz leer war,
+ // oder eine Zeile durch einen harten Zeilenumbruch entstanden ist.
+ if ( ( nNewPortionPos < pTEParaPortion->GetTextPortions().Count() ) &&
+ !pTEParaPortion->GetTextPortions()[nNewPortionPos]->GetLen() )
+ {
+ // Dann die leere Portion verwenden.
+ pTEParaPortion->GetTextPortions()[nNewPortionPos]->GetLen() += nNewChars;
+ }
+ else
+ {
+ TextPortion* pNewPortion = new TextPortion( nNewChars );
+ pTEParaPortion->GetTextPortions().Insert( pNewPortion, nNewPortionPos );
+ }
+ }
+ else
+ {
+ USHORT nPortionStart;
+ const USHORT nTP = pTEParaPortion->GetTextPortions().
+ FindPortion( nStartPos, nPortionStart );
+ TextPortion* const pTP = pTEParaPortion->GetTextPortions()[ nTP ];
+ DBG_ASSERT( pTP, "RecalcTextPortion: Portion nicht gefunden" );
+ pTP->GetLen() += nNewChars;
+ pTP->GetWidth() = (-1);
+ }
+ }
+ else
+ {
+ // Portion schrumpfen oder ggf. entfernen.
+ // Vor Aufruf dieser Methode muss sichergestellt sein, dass
+ // keine Portions in dem geloeschten Bereich lagen!
+
+ // Es darf keine reinragende oder im Bereich startende Portion geben,
+ // also muss nStartPos <= nPos <= nStartPos - nNewChars(neg.) sein
+ USHORT nPortion = 0;
+ USHORT nPos = 0;
+ USHORT nEnd = nStartPos-nNewChars;
+ USHORT nPortions = pTEParaPortion->GetTextPortions().Count();
+ TextPortion* pTP = 0;
+ for ( nPortion = 0; nPortion < nPortions; nPortion++ )
+ {
+ pTP = pTEParaPortion->GetTextPortions()[ nPortion ];
+ if ( ( nPos+pTP->GetLen() ) > nStartPos )
+ {
+ DBG_ASSERT( nPos <= nStartPos, "Start falsch!" );
+ DBG_ASSERT( nPos+pTP->GetLen() >= nEnd, "End falsch!" );
+ break;
+ }
+ nPos += pTP->GetLen();
+ }
+ DBG_ASSERT( pTP, "RecalcTextPortion: Portion nicht gefunden" );
+ if ( ( nPos == nStartPos ) && ( (nPos+pTP->GetLen()) == nEnd ) )
+ {
+ // Portion entfernen;
+ pTEParaPortion->GetTextPortions().Remove( nPortion );
+ delete pTP;
+ }
+ else
+ {
+ DBG_ASSERT( pTP->GetLen() > (-nNewChars), "Portion zu klein zum schrumpfen!" );
+ pTP->GetLen() += nNewChars;
+ }
+ DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Keine mehr da!" );
+ }
+
+#ifdef EDITDEBUG
+ DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" );
+#endif
+}
+
+void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange, TextSelection const* pSelection )
+{
+ if ( !GetUpdateMode() )
+ return;
+
+ if ( !IsFormatted() )
+ FormatDoc();
+
+ long nY = rStartPos.Y();
+
+ TextPaM const* pSelStart = 0;
+ TextPaM const* pSelEnd = 0;
+ if ( pSelection && pSelection->HasRange() )
+ {
+ BOOL bInvers = pSelection->GetEnd() < pSelection->GetStart();
+ pSelStart = !bInvers ? &pSelection->GetStart() : &pSelection->GetEnd();
+ pSelEnd = bInvers ? &pSelection->GetStart() : &pSelection->GetEnd();
+ }
+ DBG_ASSERT( !pPaintRange || ( pPaintRange->GetStart() < pPaintRange->GetEnd() ), "ImpPaint: Paint-Range?!" );
+
+ const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings();
+
+ // --------------------------------------------------
+ // Ueber alle Absaetze...
+ // --------------------------------------------------
+ for ( ULONG nPara = 0; nPara < mpTEParaPortions->Count(); nPara++ )
+ {
+ TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara );
+ // falls beim Tippen Idle-Formatierung, asynchrones Paint.
+ if ( pPortion->IsInvalid() )
+ return;
+
+ ULONG nParaHeight = CalcParaHeight( nPara );
+ USHORT nIndex = 0;
+ if ( ( !pPaintArea || ( ( nY + (long)nParaHeight ) > pPaintArea->Top() ) )
+ && ( !pPaintRange || ( ( nPara >= pPaintRange->GetStart().GetPara() ) && ( nPara <= pPaintRange->GetEnd().GetPara() ) ) ) )
+ {
+ // --------------------------------------------------
+ // Ueber die Zeilen des Absatzes...
+ // --------------------------------------------------
+ USHORT nLines = pPortion->GetLines().Count();
+ for ( USHORT nLine = 0; nLine < nLines; nLine++ )
+ {
+ TextLine* pLine = pPortion->GetLines().GetObject(nLine);
+ Point aTmpPos( rStartPos.X() + pLine->GetStartX(), nY );
+
+ if ( ( !pPaintArea || ( ( nY + mnCharHeight ) > pPaintArea->Top() ) )
+ && ( !pPaintRange || (
+ ( TextPaM( nPara, pLine->GetStart() ) < pPaintRange->GetEnd() ) &&
+ ( TextPaM( nPara, pLine->GetEnd() ) > pPaintRange->GetStart() ) ) ) )
+ {
+ // --------------------------------------------------
+ // Ueber die Portions der Zeile...
+ // --------------------------------------------------
+ nIndex = pLine->GetStart();
+ for ( USHORT y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ )
+ {
+ DBG_ASSERT( pPortion->GetTextPortions().Count(), "Zeile ohne Textportion im Paint!" );
+ TextPortion* pTextPortion = pPortion->GetTextPortions().GetObject( y );
+ DBG_ASSERT( pTextPortion, "NULL-Pointer im Portioniterator in UpdateViews" );
+
+ long nTxtWidth = pTextPortion->GetWidth();
+
+ // nur ausgeben, was im sichtbaren Bereich beginnt:
+ if ( ( ( aTmpPos.X() + nTxtWidth ) >= 0 )
+ && ( !pPaintRange || (
+ ( TextPaM( nPara, nIndex ) < pPaintRange->GetEnd() ) &&
+ ( TextPaM( nPara, nIndex + pTextPortion->GetLen() ) > pPaintRange->GetStart() ) ) ) )
+ {
+ switch ( pTextPortion->GetKind() )
+ {
+ case PORTIONKIND_TEXT:
+ {
+ {
+ Font aFont;
+ SeekCursor( nPara, nIndex+1, aFont );
+ if ( pSelection )
+ aFont.SetTransparent( FALSE );
+ pOutDev->SetFont( aFont );
+
+ USHORT nTmpIndex = nIndex;
+ USHORT nEnd = nTmpIndex + pTextPortion->GetLen();
+ Point aPos = aTmpPos;
+ if ( pPaintRange )
+ {
+ // evtl soll nicht alles ausgegeben werden...
+ if ( ( pPaintRange->GetStart().GetPara() == nPara )
+ && ( nTmpIndex < pPaintRange->GetStart().GetIndex() ) )
+ {
+ USHORT nL = pPaintRange->GetStart().GetIndex() - nTmpIndex;
+ // aPos.X() += pOutDev->GetTextSize( pPortion->GetNode()->GetText(), nTmpIndex, nL ).Width();
+ aPos.X() += (long)CalcTextWidth( nPara, nTmpIndex, nL, &aFont );
+ nTmpIndex += nL;
+ }
+ if ( ( pPaintRange->GetEnd().GetPara() == nPara )
+ && ( nEnd > pPaintRange->GetEnd().GetIndex() ) )
+ {
+ nEnd = pPaintRange->GetEnd().GetIndex();
+ }
+ }
+
+ BOOL bDone = FALSE;
+ if ( pSelStart )
+ {
+ // liegt ein Teil in der Selektion???
+ TextPaM aTextStart( nPara, nTmpIndex );
+ TextPaM aTextEnd( nPara, nEnd );
+ if ( ( aTextStart < *pSelEnd ) && ( aTextEnd > *pSelStart ) )
+ {
+ USHORT nL;
+
+ // 1) Bereich vor Selektion
+ if ( aTextStart < *pSelStart )
+ {
+ nL = pSelStart->GetIndex() - nTmpIndex;
+ pOutDev->SetFont( aFont );
+ pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL );
+ // aPos.X() += pOutDev->GetTextSize( pPortion->GetNode()->GetText(), nTmpIndex, nL ).Width();
+ aPos.X() += (long)CalcTextWidth( nPara, nTmpIndex, nL, &aFont );
+ nTmpIndex += nL;
+
+ }
+ // 2) Bereich mit Selektion
+ nL = nEnd-nTmpIndex;
+ if ( aTextEnd > *pSelEnd )
+ nL = pSelEnd->GetIndex() - nTmpIndex;
+ pOutDev->SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ pOutDev->SetTextFillColor( rStyleSettings.GetHighlightColor() );
+ pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL );
+ // aPos.X() += pOutDev->GetTextSize( pPortion->GetNode()->GetText(), nTmpIndex, nL ).Width();
+ aPos.X() += (long)CalcTextWidth( nPara, nTmpIndex, nL, &aFont );
+ nTmpIndex += nL;
+
+ // 3) Bereich nach Selektion
+ if ( nTmpIndex < nEnd )
+ {
+ pOutDev->SetFont( aFont );
+ pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nEnd-nTmpIndex );
+ }
+ bDone = TRUE;
+ }
+ }
+ if ( !bDone )
+ pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nEnd-nTmpIndex );
+ }
+
+ }
+ break;
+ case PORTIONKIND_TAB:
+ {
+ // Bei HideSelection() nur Range, pSelection = 0.
+ if ( pSelStart || pPaintRange )
+ {
+ Rectangle aTabArea( aTmpPos, Point( aTmpPos.X()+nTxtWidth, aTmpPos.Y()+mnCharHeight-1 ) );
+ BOOL bDone = FALSE;
+ if ( pSelStart )
+ {
+ // liegt der Tab in der Selektion???
+ TextPaM aTextStart( nPara, nIndex );
+ TextPaM aTextEnd( nPara, nIndex+1 );
+ if ( ( aTextStart < *pSelEnd ) && ( aTextEnd > *pSelStart ) )
+ {
+ Color aOldColor = pOutDev->GetFillColor();
+ pOutDev->SetFillColor( rStyleSettings.GetHighlightColor() );
+ pOutDev->DrawRect( aTabArea );
+ pOutDev->SetFillColor( aOldColor );
+ bDone = TRUE;
+ }
+ }
+ if ( !bDone )
+ {
+ pOutDev->Erase( aTabArea );
+ }
+
+ }
+ }
+ break;
+ default: DBG_ERROR( "ImpPaint: Unknown Portion-Type !" );
+ }
+ }
+ aTmpPos.X() += nTxtWidth;
+ if ( pPaintArea && ( aTmpPos.X() > pPaintArea->Right() ) )
+ break; // Keine weitere Ausgabe in Zeile noetig
+
+ nIndex += pTextPortion->GetLen();
+ }
+ }
+
+ nY += mnCharHeight;
+
+ if ( pPaintArea && ( nY >= pPaintArea->Bottom() ) )
+ break; // keine sichtbaren Aktionen mehr...
+ }
+ }
+ else
+ {
+ nY += nParaHeight;
+ }
+
+ if ( pPaintArea && ( nY > pPaintArea->Bottom() ) )
+ break; // keine sichtbaren Aktionen mehr...
+ }
+}
+
+BOOL TextEngine::CreateLines( ULONG nPara )
+{
+ // BOOL: Aenderung der Hoehe des Absatzes Ja/Nein - TRUE/FALSE
+
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+ DBG_ASSERT( pTEParaPortion->IsInvalid(), "CreateLines: Portion nicht invalid!" );
+
+ USHORT nOldLineCount = pTEParaPortion->GetLines().Count();
+
+ // ---------------------------------------------------------------
+ // Schnelle Sonderbehandlung fuer leere Absaetze...
+ // ---------------------------------------------------------------
+ if ( pTEParaPortion->GetNode()->GetText().Len() == 0 )
+ {
+ // schnelle Sonderbehandlung...
+ if ( pTEParaPortion->GetTextPortions().Count() )
+ pTEParaPortion->GetTextPortions().Reset();
+ if ( pTEParaPortion->GetLines().Count() )
+ pTEParaPortion->GetLines().DeleteAndDestroy( 0, pTEParaPortion->GetLines().Count() );
+ CreateAndInsertEmptyLine( nPara );
+ pTEParaPortion->SetValid();
+ return nOldLineCount != pTEParaPortion->GetLines().Count();
+ }
+
+ // ---------------------------------------------------------------
+ // Initialisierung......
+ // ---------------------------------------------------------------
+
+ if ( pTEParaPortion->GetLines().Count() == 0 )
+ {
+ TextLine* pL = new TextLine;
+ pTEParaPortion->GetLines().Insert( pL, 0 );
+ }
+
+ const short nInvalidDiff = pTEParaPortion->GetInvalidDiff();
+ const USHORT nInvalidStart = pTEParaPortion->GetInvalidPosStart();
+ const USHORT nInvalidEnd = nInvalidStart + Abs( nInvalidDiff );
+ BOOL bQuickFormat = FALSE;
+ if ( pTEParaPortion->IsSimpleInvalid() && ( nInvalidDiff > 0 ) )
+ {
+ bQuickFormat = TRUE;
+ }
+ else if ( ( pTEParaPortion->IsSimpleInvalid() ) && ( nInvalidDiff < 0 ) )
+ {
+ // pruefen, ob loeschen ueber Portiongrenzen erfolgte...
+ USHORT nStart = nInvalidStart; // DOPPELT !!!!!!!!!!!!!!!
+ USHORT nEnd = nStart - nInvalidDiff; // neg.
+ bQuickFormat = TRUE;
+ USHORT nPos = 0;
+ USHORT nPortions = pTEParaPortion->GetTextPortions().Count();
+ for ( USHORT nTP = 0; nTP < nPortions; nTP++ )
+ {
+ // Es darf kein Start/Ende im geloeschten Bereich liegen.
+ TextPortion* const pTP = pTEParaPortion->GetTextPortions().GetObject( nTP );
+ nPos += pTP->GetLen();
+ if ( ( nPos > nStart ) && ( nPos < nEnd ) )
+ {
+ bQuickFormat = FALSE;
+ break;
+ }
+ }
+ }
+
+ if ( bQuickFormat )
+ RecalcTextPortion( nPara, nInvalidStart, nInvalidDiff );
+ else
+ CreateTextPortions( nPara, nInvalidStart );
+
+ // ---------------------------------------------------------------
+ // Zeile mit InvalidPos suchen, eine Zeile davor beginnen...
+ // Zeilen flaggen => nicht removen !
+ // ---------------------------------------------------------------
+
+ USHORT nLine = pTEParaPortion->GetLines().Count()-1;
+ for ( USHORT nL = 0; nL <= nLine; nL++ )
+ {
+ TextLine* pLine = pTEParaPortion->GetLines().GetObject( nL );
+ if ( pLine->GetEnd() > nInvalidStart )
+ {
+ nLine = nL;
+ break;
+ }
+ pLine->SetValid();
+ }
+ // Eine Zeile davor beginnen...
+ // Wenn ganz hinten getippt wird, kann sich die Zeile davor nicht aendern.
+ if ( nLine && ( !pTEParaPortion->IsSimpleInvalid() || ( nInvalidEnd < pNode->GetText().Len() ) || ( nInvalidDiff <= 0 ) ) )
+ nLine--;
+
+ TextLine* pLine = pTEParaPortion->GetLines().GetObject( nLine );
+
+ // ---------------------------------------------------------------
+ // Ab hier alle Zeilen durchformatieren...
+ // ---------------------------------------------------------------
+ USHORT nDelFromLine = 0xFFFF;
+ BOOL bLineBreak = FALSE;
+
+ USHORT nIndex = pLine->GetStart();
+ TextLine aSaveLine( *pLine );
+
+ Font aFont;
+
+ BOOL bCalcPortion = TRUE;
+
+ while ( nIndex < pNode->GetText().Len() )
+ {
+ BOOL bEOL = FALSE;
+ BOOL bEOC = FALSE;
+ USHORT nPortionStart = 0;
+ USHORT nPortionEnd = 0;
+
+ USHORT nTmpPos = nIndex;
+ USHORT nTmpPortion = pLine->GetStartPortion();
+ long nTmpWidth = mpDoc->GetLeftMargin();
+// long nXWidth = mnMaxTextWidth ? ( mnMaxTextWidth - mpDoc->GetLeftMargin() ) : 0x7FFFFFFF;
+ // Margin nicht abziehen, ist schon in TmpWidth enthalten.
+ long nXWidth = mnMaxTextWidth ? mnMaxTextWidth : 0x7FFFFFFF;
+ if ( nXWidth < nTmpWidth )
+ nXWidth = nTmpWidth;
+
+ // Portion suchen, die nicht mehr in Zeile passt....
+ TextPortion* pPortion;
+ BOOL bBrokenLine = FALSE;
+ bLineBreak = FALSE;
+
+ while ( ( nTmpWidth <= nXWidth ) && !bEOL && ( nTmpPortion < pTEParaPortion->GetTextPortions().Count() ) )
+ {
+ nPortionStart = nTmpPos;
+ pPortion = pTEParaPortion->GetTextPortions().GetObject( nTmpPortion );
+ DBG_ASSERT( pPortion->GetLen(), "Leere Portion in CreateLines ?!" );
+ if ( pNode->GetText().GetChar( nTmpPos ) == '\t' )
+ {
+ long nCurPos = nTmpWidth-mpDoc->GetLeftMargin();
+ nTmpWidth = ((nCurPos/mnDefTab)+1)*mnDefTab+mpDoc->GetLeftMargin();
+ pPortion->GetWidth() = nTmpWidth - nCurPos - mpDoc->GetLeftMargin();
+ // Wenn dies das erste Token in der Zeile ist, und
+ // nTmpWidth > aPaperSize.Width, habe ich eine Endlos-Schleife!
+ if ( ( nTmpWidth >= nXWidth ) && ( nTmpPortion == pLine->GetStartPortion() ) )
+ {
+ // Aber was jetzt ? Tab passend machen!
+ pPortion->GetWidth() = nXWidth-1;
+ nTmpWidth = pPortion->GetWidth();
+ bEOL = TRUE;
+ bBrokenLine = TRUE;
+ }
+ pPortion->GetKind() = PORTIONKIND_TAB;
+ }
+ else
+ {
+ if ( bCalcPortion || !pPortion->HasValidSize() )
+ pPortion->GetWidth() = (long)CalcTextWidth( nPara, nTmpPos, pPortion->GetLen() );
+ nTmpWidth += pPortion->GetWidth();
+ }
+
+ nTmpPos += pPortion->GetLen();
+ nPortionEnd = nTmpPos;
+ nTmpPortion++;
+ }
+
+ // das war evtl. eine Portion zu weit:
+ BOOL bFixedEnd = FALSE;
+ if ( nTmpWidth > nXWidth )
+ {
+ nPortionEnd = nTmpPos;
+ nTmpPos -= pPortion->GetLen();
+ nPortionStart = nTmpPos;
+ nTmpPortion--;
+ bEOL = FALSE;
+ bEOC = FALSE;
+
+ nTmpWidth -= pPortion->GetWidth();
+ if ( pPortion->GetKind() == PORTIONKIND_TAB )
+ {
+ bEOL = TRUE;
+ bFixedEnd = TRUE;
+ }
+ }
+ else
+ {
+ bEOL = TRUE;
+ bEOC = TRUE;
+ pLine->SetEnd( nPortionEnd );
+ DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine TextPortions?" );
+ pLine->SetEndPortion( (USHORT)pTEParaPortion->GetTextPortions().Count() - 1 );
+ }
+
+ if ( bFixedEnd )
+ {
+ pLine->SetEnd( nPortionStart );
+ pLine->SetEndPortion( nTmpPortion-1 );
+ }
+ else if ( bLineBreak || bBrokenLine )
+ {
+ pLine->SetEnd( nPortionStart+1 );
+ pLine->SetEndPortion( nTmpPortion-1 );
+ bEOC = FALSE; // wurde oben gesetzt, vielleich mal die if's umstellen?
+ }
+ else if ( !bEOL )
+ {
+ DBG_ASSERT( (nPortionEnd-nPortionStart) == pPortion->GetLen(), "Doch eine andere Portion?!" );
+ long nRemainingWidth = mnMaxTextWidth - nTmpWidth;
+ ImpBreakLine( nPara, pLine, pPortion, nPortionStart, nRemainingWidth );
+ }
+
+ if ( ( meAlign == TXTALIGN_CENTER ) || ( meAlign == TXTALIGN_RIGHT ) )
+ {
+ // Ausrichten...
+ long nTextWidth = 0;
+ for ( USHORT nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ )
+ {
+ TextPortion* pTextPortion = pTEParaPortion->GetTextPortions().GetObject( nTP );
+ nTextWidth += pTextPortion->GetWidth();
+ }
+ long nSpace = mnMaxTextWidth - nTextWidth;
+ if ( nSpace > 0 )
+ {
+ if ( meAlign == TXTALIGN_CENTER )
+ pLine->SetStartX( (USHORT)(nSpace / 2) );
+ else // TXTALIGN_RIGHT
+ pLine->SetStartX( (USHORT)nSpace );
+ }
+ }
+ else
+ {
+ pLine->SetStartX( mpDoc->GetLeftMargin() );
+ }
+
+ // -----------------------------------------------------------------
+ // pruefen, ob die Zeile neu ausgegeben werden muss...
+ // -----------------------------------------------------------------
+ pLine->SetInvalid();
+
+ if ( pTEParaPortion->IsSimpleInvalid() )
+ {
+ // Aenderung durch einfache Textaenderung...
+ // Formatierung nicht abbrechen, da Portions evtl. wieder
+ // gesplittet werden muessen!
+ // Wenn irgendwann mal abbrechbar, dann fogende Zeilen Validieren!
+ // Aber ggf. als Valid markieren, damit weniger Ausgabe...
+ if ( pLine->GetEnd() < nInvalidStart )
+ {
+ if ( *pLine == aSaveLine )
+ {
+ pLine->SetValid();
+ }
+ }
+ else
+ {
+ USHORT nStart = pLine->GetStart();
+ USHORT nEnd = pLine->GetEnd();
+
+ if ( nStart > nInvalidEnd )
+ {
+ if ( ( ( nStart-nInvalidDiff ) == aSaveLine.GetStart() ) &&
+ ( ( nEnd-nInvalidDiff ) == aSaveLine.GetEnd() ) )
+ {
+ pLine->SetValid();
+ if ( bCalcPortion && bQuickFormat )
+ {
+ bCalcPortion = FALSE;
+ pTEParaPortion->CorrectValuesBehindLastFormattedLine( nLine );
+ break;
+ }
+ }
+ }
+ else if ( bQuickFormat && ( nEnd > nInvalidEnd) )
+ {
+ // Wenn die ungueltige Zeile so endet, dass die naechste an
+ // der 'gleichen' Textstelle wie vorher beginnt, also nicht
+ // anders umgebrochen wird, brauche ich dort auch nicht die
+ // textbreiten neu bestimmen:
+ if ( nEnd == ( aSaveLine.GetEnd() + nInvalidDiff ) )
+ {
+ bCalcPortion = FALSE;
+ pTEParaPortion->CorrectValuesBehindLastFormattedLine( nLine );
+ break;
+ }
+ }
+ }
+ }
+
+ nIndex = pLine->GetEnd(); // naechste Zeile Start = letzte Zeile Ende
+ // weil nEnd hinter das letzte Zeichen zeigt!
+
+ USHORT nEndPortion = pLine->GetEndPortion();
+
+ // Naechste Zeile oder ggf. neue Zeile....
+ pLine = 0;
+ if ( nLine < pTEParaPortion->GetLines().Count()-1 )
+ pLine = pTEParaPortion->GetLines().GetObject( ++nLine );
+ if ( pLine && ( nIndex >= pNode->GetText().Len() ) )
+ {
+ nDelFromLine = nLine;
+ break;
+ }
+ if ( !pLine && ( nIndex < pNode->GetText().Len() ) )
+ {
+ pLine = new TextLine;
+ pTEParaPortion->GetLines().Insert( pLine, ++nLine );
+ }
+ if ( pLine )
+ {
+ aSaveLine = *pLine;
+ pLine->SetStart( nIndex );
+ pLine->SetEnd( nIndex );
+ pLine->SetStartPortion( nEndPortion+1 );
+ pLine->SetEndPortion( nEndPortion+1 );
+ }
+ } // while ( Index < Len )
+
+ if ( nDelFromLine != 0xFFFF )
+ pTEParaPortion->GetLines().DeleteAndDestroy( nDelFromLine, pTEParaPortion->GetLines().Count() - nDelFromLine );
+
+ DBG_ASSERT( pTEParaPortion->GetLines().Count(), "Keine Zeile nach CreateLines!" );
+
+ if ( bLineBreak == TRUE )
+ CreateAndInsertEmptyLine( nPara );
+
+ pTEParaPortion->SetValid();
+
+ return nOldLineCount != pTEParaPortion->GetLines().Count();
+}
+
+String TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord )
+{
+ String aWord;
+ if ( rCursorPos.GetPara() < mpDoc->GetNodes().Count() )
+ {
+ TextSelection aSel( rCursorPos );
+ TextNode* pNode = mpDoc->GetNodes().GetObject( rCursorPos.GetPara() );
+ uno::Reference < text::XBreakIterator > xBI = GetBreakIterator();
+ text::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rCursorPos.GetIndex(), GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
+ aSel.GetStart().GetIndex() = aBoundary.startPos;
+ aSel.GetEnd().GetIndex() = aBoundary.endPos;
+ aWord = pNode->GetText().Copy( aSel.GetStart().GetIndex(), aSel.GetEnd().GetIndex() - aSel.GetStart().GetIndex() );
+ if ( pStartOfWord )
+ *pStartOfWord = aSel.GetStart();
+ }
+ return aWord;
+}
+
+BOOL TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
+{
+ BOOL bUpdate = GetUpdateMode();
+ SetUpdateMode( FALSE );
+
+ UndoActionStart( TEXTUNDO_READ );
+ TextSelection aSel;
+ if ( pSel )
+ aSel = *pSel;
+ else
+ {
+ ULONG nParas = mpDoc->GetNodes().Count();
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
+ aSel = TextPaM( nParas-1 , pNode->GetText().Len() );
+ }
+
+ if ( aSel.HasRange() )
+ aSel = ImpDeleteText( aSel );
+
+ ByteString aLine;
+ BOOL bDone = rInput.ReadLine( aLine );
+ String aTmpStr( aLine, rInput.GetStreamCharSet() ), aStr;
+ while ( bDone )
+ {
+ aSel = ImpInsertText( aSel, aTmpStr );
+ bDone = rInput.ReadLine( aLine );
+ aTmpStr = String( aLine, rInput.GetStreamCharSet() );
+ if ( bDone )
+ aSel = ImpInsertParaBreak( aSel.GetEnd() );
+ }
+
+ UndoActionEnd( TEXTUNDO_READ );
+
+ TextSelection aNewSel( aSel.GetEnd(), aSel.GetEnd() );
+
+ // Damit bei FormatAndUpdate nicht auf die ungueltige Selektion zugegriffen wird.
+ if ( GetActiveView() )
+ GetActiveView()->maSelection = aNewSel;
+
+ SetUpdateMode( bUpdate );
+ FormatAndUpdate( GetActiveView() );
+// if ( GetActiveView() )
+// GetActiveView()->SetSelection( aNewSel );
+ return rInput.GetError() ? FALSE : TRUE;
+}
+
+#if SUPD < 540
+BOOL TextEngine::Write( SvStream& rOutput, const TextSelection* pSel )
+{
+ return Write( rOutput, pSel, FALSE );
+}
+#endif
+
+BOOL TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, BOOL bHTML )
+{
+ TextSelection aSel;
+ if ( pSel )
+ aSel = *pSel;
+ else
+ {
+ ULONG nParas = mpDoc->GetNodes().Count();
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nParas - 1 );
+ aSel.GetStart() = TextPaM( 0, 0 );
+ aSel.GetEnd() = TextPaM( nParas-1, pNode->GetText().Len() );
+ }
+
+ if ( bHTML )
+ {
+ rOutput.WriteLine( "<HTML>" );
+ rOutput.WriteLine( "<BODY>" );
+ }
+
+ for ( ULONG nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); nPara++ )
+ {
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+
+ USHORT nStartPos = 0;
+ USHORT nEndPos = pNode->GetText().Len();
+ if ( nPara == aSel.GetStart().GetPara() )
+ nStartPos = aSel.GetStart().GetIndex();
+ if ( nPara == aSel.GetEnd().GetPara() )
+ nEndPos = aSel.GetEnd().GetIndex();
+
+ String aText;
+ if ( !bHTML )
+ {
+ aText = pNode->GetText().Copy( nStartPos, nEndPos-nStartPos );
+ }
+ else
+ {
+ aText.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "<P STYLE=\"margin-bottom: 0cm\">" ) );
+
+ if ( nStartPos == nEndPos )
+ {
+ // Leerzeilen werden von Writer wegoptimiert
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "<BR>" ) );
+ }
+ else
+ {
+ USHORT nTmpStart = nStartPos;
+ USHORT nTmpEnd = nEndPos;
+ do
+ {
+ TextCharAttrib* pAttr = pNode->GetCharAttribs().FindNextAttrib( TEXTATTR_HYPERLINK, nTmpStart, nEndPos );
+ nTmpEnd = pAttr ? pAttr->GetStart() : nEndPos;
+
+ // Text vor dem Attribut
+ aText += pNode->GetText().Copy( nTmpStart, nTmpEnd-nTmpStart );
+
+ if ( pAttr )
+ {
+ nTmpEnd = Min( pAttr->GetEnd(), nEndPos );
+
+ // z.B. <A HREF="http://www.mopo.de/">Morgenpost</A>
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "<A HREF=\"" ) );
+ aText += ((const TextAttribHyperLink&) pAttr->GetAttr() ).GetURL();
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\">" ) );
+ nTmpStart = pAttr->GetStart();
+ aText += pNode->GetText().Copy( nTmpStart, nTmpEnd-nTmpStart );
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "</A>" ) );
+
+ nTmpStart = pAttr->GetEnd();
+ }
+ } while ( nTmpEnd < nEndPos );
+ }
+
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "</P>" ) );
+ }
+ rOutput.WriteLine( ByteString( aText, rOutput.GetStreamCharSet() ) );
+ }
+
+ if ( bHTML )
+ {
+ rOutput.WriteLine( "</BODY>" );
+ rOutput.WriteLine( "</HTML>" );
+ }
+
+ return rOutput.GetError() ? FALSE : TRUE;
+}
+
+void TextEngine::RemoveAttribs( ULONG nPara )
+{
+ if ( nPara < mpDoc->GetNodes().Count() )
+ {
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ if ( pNode->GetCharAttribs().Count() )
+ {
+ pNode->GetCharAttribs().Clear( TRUE );
+
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+ pTEParaPortion->MarkSelectionInvalid( 0, pNode->GetText().Len() );
+
+ mbFormatted = FALSE;
+ FormatAndUpdate( NULL );
+ }
+ }
+}
+
+void TextEngine::SetAttrib( const TextAttrib& rAttr, ULONG nPara, USHORT nStart, USHORT nEnd )
+{
+ // Es wird hier erstmal nicht geprueft, ob sich Attribute ueberlappen!
+ // Diese Methode ist erstmal nur fuer einen Editor, der fuer eine Zeile
+ // _schnell_ das Syntax-Highlight einstellen will.
+
+ // Da die TextEngine z.Zt fuer Editoren gedacht ist gibt es auch kein
+ // Undo fuer Attribute!
+
+ if ( nPara < mpDoc->GetNodes().Count() )
+ {
+ TextNode* pNode = mpDoc->GetNodes().GetObject( nPara );
+ TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
+
+ USHORT nMax = pNode->GetText().Len();
+ if ( nStart > nMax )
+ nStart = nMax;
+ if ( nEnd > nMax )
+ nEnd = nMax;
+
+ pNode->GetCharAttribs().InsertAttrib( new TextCharAttrib( rAttr, nStart, nEnd ) );
+ pTEParaPortion->MarkSelectionInvalid( nStart, nEnd );
+
+ mbFormatted = FALSE;
+ FormatAndUpdate( NULL );
+ }
+}
+
+void TextEngine::SetTextAlign( TxtAlign eAlign )
+{
+ if ( eAlign != meAlign )
+ {
+ meAlign = eAlign;
+ FormatFullDoc();
+ }
+}
+
+
+void TextEngine::ValidateSelection( TextSelection& rSel ) const
+{
+ ValidatePaM( rSel.GetStart() );
+ ValidatePaM( rSel.GetEnd() );
+}
+
+void TextEngine::ValidatePaM( TextPaM& rPaM ) const
+{
+ ULONG nMaxPara = mpDoc->GetNodes().Count() - 1;
+ if ( rPaM.GetPara() > nMaxPara )
+ {
+ rPaM.GetPara() = nMaxPara;
+ rPaM.GetIndex() = 0xFFFF;
+ }
+
+ USHORT nMaxIndex = GetTextLen( rPaM.GetPara() );
+ if ( rPaM.GetIndex() > nMaxIndex )
+ rPaM.GetIndex() = nMaxIndex;
+}
+
+
+// Status & Selektionsanpassung
+
+void TextEngine::ImpParagraphInserted( ULONG nPara )
+{
+ // Die aktive View braucht nicht angepasst werden, aber bei allen
+ // passiven muss die Selektion angepasst werden:
+ if ( mpViews->Count() > 1 )
+ {
+ for ( USHORT nView = mpViews->Count(); nView; )
+ {
+ TextView* pView = mpViews->GetObject( --nView );
+ if ( pView != GetActiveView() )
+ {
+// BOOL bInvers = pView->maSelection.GetEnd() < pView->maSelection.GetStart();
+// TextPaM& rMin = !bInvers ? pView->maSelection.GetStart(): pView->maSelection.GetEnd();
+// TextPaM& rMax = bInvers ? pView->maSelection.GetStart() : pView->maSelection.GetEnd();
+//
+// if ( rMin.GetPara() >= nPara )
+// rMin.GetPara()++;
+// if ( rMax.GetPara() >= nPara )
+// rMax.GetPara()++;
+ for ( int n = 0; n <= 1; n++ )
+ {
+ TextPaM& rPaM = n ? pView->maSelection.GetStart(): pView->maSelection.GetEnd();
+ if ( rPaM.GetPara() >= nPara )
+ rPaM.GetPara()++;
+ }
+ }
+ }
+ }
+ Broadcast( TextHint( TEXT_HINT_PARAINSERTED, nPara ) );
+}
+
+void TextEngine::ImpParagraphRemoved( ULONG nPara )
+{
+ if ( mpViews->Count() > 1 )
+ {
+ for ( USHORT nView = mpViews->Count(); nView; )
+ {
+ TextView* pView = mpViews->GetObject( --nView );
+ if ( pView != GetActiveView() )
+ {
+ ULONG nParas = mpDoc->GetNodes().Count();
+ for ( int n = 0; n <= 1; n++ )
+ {
+ TextPaM& rPaM = n ? pView->maSelection.GetStart(): pView->maSelection.GetEnd();
+ if ( rPaM.GetPara() > nPara )
+ rPaM.GetPara()--;
+ else if ( rPaM.GetPara() == nPara )
+ {
+ rPaM.GetIndex() = 0;
+ if ( rPaM.GetPara() >= nParas )
+ rPaM.GetPara()--;
+ }
+ }
+ }
+ }
+ }
+ Broadcast( TextHint( TEXT_HINT_PARAREMOVED, nPara ) );
+}
+
+void TextEngine::ImpCharsRemoved( ULONG nPara, USHORT nPos, USHORT nChars )
+{
+ if ( mpViews->Count() > 1 )
+ {
+ for ( USHORT nView = mpViews->Count(); nView; )
+ {
+ TextView* pView = mpViews->GetObject( --nView );
+ if ( pView != GetActiveView() )
+ {
+ USHORT nEnd = nPos+nChars;
+ for ( int n = 0; n <= 1; n++ )
+ {
+ TextPaM& rPaM = n ? pView->maSelection.GetStart(): pView->maSelection.GetEnd();
+ if ( rPaM.GetPara() == nPara )
+ {
+ if ( rPaM.GetIndex() > nEnd )
+ rPaM.GetIndex() -= nChars;
+ else if ( rPaM.GetIndex() > nPos )
+ rPaM.GetIndex() = nPos;
+ }
+ }
+ }
+ }
+ }
+}
+
+void TextEngine::ImpCharsInserted( ULONG nPara, USHORT nPos, USHORT nChars )
+{
+ if ( mpViews->Count() > 1 )
+ {
+ for ( USHORT nView = mpViews->Count(); nView; )
+ {
+ TextView* pView = mpViews->GetObject( --nView );
+ if ( pView != GetActiveView() )
+ {
+ for ( int n = 0; n <= 1; n++ )
+ {
+ TextPaM& rPaM = n ? pView->maSelection.GetStart(): pView->maSelection.GetEnd();
+ if ( rPaM.GetPara() == nPara )
+ {
+ if ( rPaM.GetIndex() >= nPos )
+ rPaM.GetIndex() += nChars;
+ }
+ }
+ }
+ }
+ }
+}
+
+void TextEngine::ImpFormattingParagraph( ULONG nPara )
+{
+ Broadcast( TextHint( TEXT_HINT_FORMATPARA, nPara ) );
+}
+
+void TextEngine::ImpTextHeightChanged()
+{
+ Broadcast( TextHint( TEXT_HINT_TEXTHEIGHTCHANGED ) );
+}
+
+void TextEngine::ImpTextFormatted()
+{
+ Broadcast( TextHint( TEXT_HINT_TEXTFORMATTED ) );
+}
+
+void TextEngine::Draw( OutputDevice* pDev, const Point& rPos )
+{
+ ImpPaint( pDev, rPos, NULL );
+}
+
+void TextEngine::SetLeftMargin( USHORT n )
+{
+ mpDoc->SetLeftMargin( n );
+}
+
+USHORT TextEngine::GetLeftMargin() const
+{
+ return mpDoc->GetLeftMargin();
+}
+
+uno::Reference< text::XBreakIterator > TextEngine::GetBreakIterator()
+{
+ static uno::Reference < text::XBreakIterator > mxBreakIterator;
+ if ( !mxBreakIterator.is() )
+ mxBreakIterator = vcl::unohelper::CreateBreakIterator();
+ return mxBreakIterator;
+}
+
+::com::sun::star::lang::Locale TextEngine::GetLocale()
+{
+#if SUPD <= 594
+ static ::com::sun::star::lang::Locale maLocale;
+#endif
+ if ( !maLocale.Language.getLength() )
+ {
+ String aLanguage, aCountry;
+ ConvertLanguageToIsoNames( LANGUAGE_ENGLISH, aLanguage, aCountry );
+ maLocale.Language = aLanguage;
+ maLocale.Country = aCountry;
+ }
+ return maLocale;
+}
diff --git a/svtools/source/edit/textund2.hxx b/svtools/source/edit/textund2.hxx
new file mode 100644
index 000000000000..05d400896fed
--- /dev/null
+++ b/svtools/source/edit/textund2.hxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: textund2.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _TEXTUND2_HXX
+#define _TEXTUND2_HXX
+
+#include <textundo.hxx>
+
+
+class TextUndoDelPara : public TextUndo
+{
+private:
+ BOOL mbDelObject;
+ ULONG mnPara;
+ TextNode* mpNode; // Zeigt auf das gueltige, nicht zerstoerte Objekt!
+
+public:
+ TYPEINFO();
+ TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, ULONG nPara );
+ ~TextUndoDelPara();
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+
+class TextUndoConnectParas : public TextUndo
+{
+private:
+ ULONG mnPara;
+ USHORT mnSepPos;
+
+public:
+ TYPEINFO();
+ TextUndoConnectParas( TextEngine* pTextEngine, ULONG nPara, USHORT nSepPos );
+ ~TextUndoConnectParas();
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+
+class TextUndoSplitPara : public TextUndo
+{
+private:
+ ULONG mnPara;
+ USHORT mnSepPos;
+
+public:
+ TYPEINFO();
+ TextUndoSplitPara( TextEngine* pTextEngine, ULONG nPara, USHORT nSepPos );
+ ~TextUndoSplitPara();
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+
+class TextUndoInsertChars : public TextUndo
+{
+private:
+ TextPaM maTextPaM;
+ String maText;
+
+public:
+ TYPEINFO();
+ TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const String& rStr );
+
+// const TextPaM& GetTextPaM() { return aTextPaM; }
+// String& GetStr() { return aText; }
+
+ virtual void Undo();
+ virtual void Redo();
+
+ virtual BOOL Merge( SfxUndoAction *pNextAction );
+};
+
+
+class TextUndoRemoveChars : public TextUndo
+{
+private:
+ TextPaM maTextPaM;
+ String maText;
+
+public:
+ TYPEINFO();
+ TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const String& rStr );
+
+// const TextPaM& GetTextPaM() { return aTextPaM; }
+// String& GetStr() { return aText; }
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+
+class TextUndoSetAttribs: public TextUndo
+{
+private:
+ TextSelection maSelection;
+// SfxItemSet aNewAttribs;
+// TextInfoArray aPrevAttribs;
+// BYTE nSpecial;
+// BOOL bSetIsRemove;
+// USHORT nRemoveWhich;
+//
+// void ImpSetSelection( TextView* pView );
+
+
+public:
+ TYPEINFO();
+ TextUndoSetAttribs( TextEngine* pTextEngine, const TextSelection& rESel );
+ ~TextUndoSetAttribs();
+
+// TextInfoArray& GetTextInfos() { return aPrevAttribs; }
+// SfxItemSet& GetNewAttribs() { return aNewAttribs; }
+// void SetSpecial( BYTE n ) { nSpecial = n; }
+// void SetRemoveAttribs( BOOL b ) { bSetIsRemove = b; }
+// void SetRemoveWhich( USHORT n ) { nRemoveWhich = n; }
+
+ virtual void Undo();
+ virtual void Redo();
+};
+
+#endif // _TEXTUND2_HXX
diff --git a/svtools/source/edit/textundo.cxx b/svtools/source/edit/textundo.cxx
new file mode 100644
index 000000000000..2be7d39b0524
--- /dev/null
+++ b/svtools/source/edit/textundo.cxx
@@ -0,0 +1,374 @@
+/*************************************************************************
+ *
+ * $RCSfile: textundo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <texteng.hxx>
+#include <textview.hxx>
+#include <textundo.hxx>
+#include <textund2.hxx>
+#include <textdata.hxx>
+#include <textdoc.hxx>
+#include <textdat2.hxx>
+
+TYPEINIT1( TextUndo, SfxUndoAction );
+TYPEINIT1( TextUndoDelPara, TextUndo );
+TYPEINIT1( TextUndoConnectParas, TextUndo );
+TYPEINIT1( TextUndoSplitPara, TextUndo );
+TYPEINIT1( TextUndoInsertChars, TextUndo );
+TYPEINIT1( TextUndoRemoveChars, TextUndo );
+TYPEINIT1( TextUndoSetAttribs, TextUndo );
+
+
+TextUndoManager::TextUndoManager( TextEngine* p )
+{
+ mpTextEngine = p;
+}
+
+TextUndoManager::~TextUndoManager()
+{
+}
+
+BOOL __EXPORT TextUndoManager::Undo( USHORT nCount )
+{
+ if ( GetUndoActionCount() == 0 )
+ return FALSE;
+
+ UndoRedoStart();
+
+ mpTextEngine->SetIsInUndo( TRUE );
+ BOOL bDone = SfxUndoManager::Undo( nCount );
+ mpTextEngine->SetIsInUndo( FALSE );
+
+ UndoRedoEnd();
+
+ return bDone;
+}
+
+BOOL __EXPORT TextUndoManager::Redo( USHORT nCount )
+{
+ if ( GetRedoActionCount() == 0 )
+ return FALSE;
+
+
+ UndoRedoStart();
+
+ mpTextEngine->SetIsInUndo( TRUE );
+ BOOL bDone = SfxUndoManager::Redo( nCount );
+ mpTextEngine->SetIsInUndo( FALSE );
+
+ UndoRedoEnd();
+
+ return bDone;
+}
+
+void TextUndoManager::UndoRedoStart()
+{
+ DBG_ASSERT( GetView(), "Undo/Redo: Active View?" );
+
+// if ( GetView() )
+// GetView()->HideSelection();
+}
+
+void TextUndoManager::UndoRedoEnd()
+{
+ if ( GetView() )
+ {
+ TextSelection aNewSel( GetView()->GetSelection() );
+ aNewSel.GetStart() = aNewSel.GetEnd();
+ GetView()->maSelection = aNewSel;
+ }
+
+ mpTextEngine->UpdateSelections();
+
+ mpTextEngine->FormatAndUpdate( GetView() );
+}
+
+
+TextUndo::TextUndo( USHORT nI, TextEngine* p )
+{
+ mnId = nI;
+ mpTextEngine = p;
+}
+
+TextUndo::~TextUndo()
+{
+}
+
+USHORT __EXPORT TextUndo::GetId() const
+{
+ //nId sollte mal entfallen => GetId ueberall ueberladen...
+ return mnId;
+}
+
+XubString __EXPORT TextUndo::GetComment() const
+{
+// return mpTextEngine->GetUndoComment( this );
+ return String();
+}
+
+void TextUndo::SetSelection( const TextSelection& rSel )
+{
+ if ( GetView() )
+ GetView()->maSelection = rSel;
+}
+
+
+TextUndoDelPara::TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, ULONG nPara )
+ : TextUndo( TEXTUNDO_DELCONTENT, pTextEngine )
+{
+ mpNode = pNode;
+ mnPara = nPara;
+ mbDelObject = TRUE;
+}
+
+TextUndoDelPara::~TextUndoDelPara()
+{
+ if ( mbDelObject )
+ delete mpNode;
+}
+
+void __EXPORT TextUndoDelPara::Undo()
+{
+ GetTextEngine()->InsertContent( mpNode, mnPara );
+ mbDelObject = FALSE; // gehoert wieder der Engine
+
+ if ( GetView() )
+ {
+ TextSelection aSel( TextPaM( mnPara, 0 ), TextPaM( mnPara, mpNode->GetText().Len() ) );
+ SetSelection( aSel );
+ }
+}
+
+void __EXPORT TextUndoDelPara::Redo()
+{
+ // pNode stimmt nicht mehr, falls zwischendurch Undos, in denen
+ // Absaetze verschmolzen sind.
+ mpNode = GetDoc()->GetNodes().GetObject( mnPara );
+
+ delete GetTEParaPortions()->GetObject( mnPara );
+ GetTEParaPortions()->Remove( mnPara );
+
+ // Node nicht loeschen, haengt im Undo!
+ GetDoc()->GetNodes().Remove( mnPara );
+ GetTextEngine()->ImpParagraphRemoved( mnPara );
+
+ mbDelObject = TRUE; // gehoert wieder dem Undo
+
+ ULONG nParas = GetDoc()->GetNodes().Count();
+ ULONG n = mnPara < nParas ? mnPara : (nParas-1);
+ TextNode* pN = GetDoc()->GetNodes().GetObject( n );
+ TextPaM aPaM( n, pN->GetText().Len() );
+ SetSelection( aPaM );
+}
+
+ // -----------------------------------------------------------------------
+// TextUndoConnectParas
+// ------------------------------------------------------------------------
+TextUndoConnectParas::TextUndoConnectParas( TextEngine* pTextEngine, ULONG nPara, USHORT nPos )
+ : TextUndo( TEXTUNDO_CONNECTPARAS, pTextEngine )
+{
+ mnPara = nPara;
+ mnSepPos = nPos;
+}
+
+TextUndoConnectParas::~TextUndoConnectParas()
+{
+}
+
+void __EXPORT TextUndoConnectParas::Undo()
+{
+ TextPaM aPaM = GetTextEngine()->SplitContent( mnPara, mnSepPos );
+ SetSelection( aPaM );
+}
+
+void __EXPORT TextUndoConnectParas::Redo()
+{
+ TextPaM aPaM = GetTextEngine()->ConnectContents( mnPara );
+ SetSelection( aPaM );
+}
+
+
+TextUndoSplitPara::TextUndoSplitPara( TextEngine* pTextEngine, ULONG nPara, USHORT nPos )
+ : TextUndo( TEXTUNDO_SPLITPARA, pTextEngine )
+{
+ mnPara = nPara;
+ mnSepPos = nPos;
+}
+
+TextUndoSplitPara::~TextUndoSplitPara()
+{
+}
+
+void __EXPORT TextUndoSplitPara::Undo()
+{
+ TextPaM aPaM = GetTextEngine()->ConnectContents( mnPara );
+ SetSelection( aPaM );
+}
+
+void __EXPORT TextUndoSplitPara::Redo()
+{
+ TextPaM aPaM = GetTextEngine()->SplitContent( mnPara, mnSepPos );
+ SetSelection( aPaM );
+}
+
+
+TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
+ : TextUndo( TEXTUNDO_INSERTCHARS, pTextEngine ),
+ maTextPaM( rTextPaM ), maText( rStr )
+{
+}
+
+void __EXPORT TextUndoInsertChars::Undo()
+{
+ TextSelection aSel( maTextPaM, maTextPaM );
+ aSel.GetEnd().GetIndex() += maText.Len();
+ TextPaM aPaM = GetTextEngine()->ImpDeleteText( aSel );
+ SetSelection( aPaM );
+}
+
+void __EXPORT TextUndoInsertChars::Redo()
+{
+ TextSelection aSel( maTextPaM, maTextPaM );
+ GetTextEngine()->ImpInsertText( aSel, maText );
+ TextPaM aNewPaM( maTextPaM );
+ aNewPaM.GetIndex() += maText.Len();
+ SetSelection( TextSelection( aSel.GetStart(), aNewPaM ) );
+}
+
+BOOL __EXPORT TextUndoInsertChars::Merge( SfxUndoAction* pNextAction )
+{
+ if ( !pNextAction->ISA( TextUndoInsertChars ) )
+ return FALSE;
+
+ TextUndoInsertChars* pNext = (TextUndoInsertChars*)pNextAction;
+
+ if ( maTextPaM.GetPara() != pNext->maTextPaM.GetPara() )
+ return FALSE;
+
+ if ( ( maTextPaM.GetIndex() + maText.Len() ) == pNext->maTextPaM.GetIndex() )
+ {
+ maText += pNext->maText;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+TextUndoRemoveChars::TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
+ : TextUndo( TEXTUNDO_REMOVECHARS, pTextEngine ),
+ maTextPaM( rTextPaM ), maText( rStr )
+{
+}
+
+void __EXPORT TextUndoRemoveChars::Undo()
+{
+ TextSelection aSel( maTextPaM, maTextPaM );
+ GetTextEngine()->ImpInsertText( aSel, maText );
+ aSel.GetEnd().GetIndex() += maText.Len();
+ SetSelection( aSel );
+}
+
+void __EXPORT TextUndoRemoveChars::Redo()
+{
+ TextSelection aSel( maTextPaM, maTextPaM );
+ aSel.GetEnd().GetIndex() += maText.Len();
+ TextPaM aPaM = GetTextEngine()->ImpDeleteText( aSel );
+ SetSelection( aPaM );
+}
+
+
+TextUndoSetAttribs::TextUndoSetAttribs( TextEngine* pTextEngine, const TextSelection& rSel )
+ : TextUndo( TEXTUNDO_ATTRIBS, pTextEngine ), maSelection( rSel )
+{
+ maSelection.Justify();
+// aNewAttribs.Set( rNewItems );
+// mbSetIsRemove = FALSE;
+// mnRemoveWhich = 0;
+// mnSpecial = 0;
+}
+
+TextUndoSetAttribs::~TextUndoSetAttribs()
+{
+ // ...............
+}
+
+void __EXPORT TextUndoSetAttribs::Undo()
+{
+ for ( ULONG nPara = maSelection.GetStart().GetPara(); nPara <= maSelection.GetEnd().GetPara(); nPara++ )
+ {
+// ContentAttribsInfo* pInf = aPrevAttribs[ (USHORT)(nPara-aESel.nStartPara) ];
+// GetTextEngine()->RemoveCharAttribs( nPara );
+// TextNode* pNode = GetTextEngine()->GetTextDoc().GetObject( nPara );
+// for ( USHORT nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ )
+// {
+// GetTextEngine()->GetTextDoc().InsertAttrib( pNode, pX->GetStart(), pX->GetEnd(), *pX->GetItem() );
+// }
+ }
+ SetSelection( maSelection );
+}
+
+void __EXPORT TextUndoSetAttribs::Redo()
+{
+// if ( !bSetIsRemove )
+// GetTextEngine()->SetAttribs( aSel, aNewAttribs, nSpecial );
+// else
+// GetTextEngine()->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich );
+ SetSelection( maSelection );
+}
diff --git a/svtools/source/edit/textundo.hxx b/svtools/source/edit/textundo.hxx
new file mode 100644
index 000000000000..31bb776178d5
--- /dev/null
+++ b/svtools/source/edit/textundo.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: textundo.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _TEXTUNDO_HXX
+#define _TEXTUNDO_HXX
+
+#ifndef _UNDO_HXX
+#include <undo.hxx>
+#endif
+
+class TextEngine;
+
+class TextUndoManager : public SfxUndoManager
+{
+ TextEngine* mpTextEngine;
+
+protected:
+
+ void UndoRedoStart();
+ void UndoRedoEnd();
+
+ TextView* GetView() const { return mpTextEngine->GetActiveView(); }
+
+public:
+ TextUndoManager( TextEngine* pTextEngine );
+ ~TextUndoManager();
+
+ virtual BOOL Undo( USHORT nCount=1 );
+ virtual BOOL Redo( USHORT nCount=1 );
+
+};
+
+class TextUndo : public SfxUndoAction
+{
+private:
+ USHORT mnId;
+ TextEngine* mpTextEngine;
+
+protected:
+
+ TextView* GetView() const { return mpTextEngine->GetActiveView(); }
+ void SetSelection( const TextSelection& rSel );
+
+ TextDoc* GetDoc() const { return mpTextEngine->mpDoc; }
+ TEParaPortions* GetTEParaPortions() const { return mpTextEngine->mpTEParaPortions; }
+
+public:
+ TYPEINFO();
+ TextUndo( USHORT nId, TextEngine* pTextEngine );
+ virtual ~TextUndo();
+
+ TextEngine* GetTextEngine() const { return mpTextEngine; }
+
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+
+ virtual XubString GetComment() const;
+ virtual USHORT GetId() const;
+};
+
+#endif // _TEXTUNDO_HXX
diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx
new file mode 100644
index 000000000000..df85abfbf485
--- /dev/null
+++ b/svtools/source/edit/textview.cxx
@@ -0,0 +1,1760 @@
+/*************************************************************************
+ *
+ * $RCSfile: textview.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <textview.hxx>
+#include <texteng.hxx>
+#include <textdoc.hxx>
+#include <textdata.hxx>
+#include <textdat2.hxx>
+
+#include <undo.hxx>
+
+#ifndef _SV_CURSOR_HXX //autogen
+#include <vcl/cursor.hxx>
+#endif
+
+#ifndef _SV_WINDOW_HXX //autogen
+#include <vcl/window.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _SV_CLIP_HXX //autogen
+#include <vcl/clip.hxx>
+#endif
+
+#ifndef _SV_DRAG_HXX //autogen
+#include <vcl/drag.hxx>
+#endif
+
+#ifndef _SV_SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _NEW_HXX
+#include <tools/new.hxx>
+#endif
+
+#include <sot/formats.hxx>
+
+#ifndef _URLBMK_HXX
+#include <urlbmk.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_
+#include <com/sun/star/text/XBreakIterator.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_CHARACTERITERATORMODE_HPP_
+#include <com/sun/star/text/CharacterIteratorMode.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_WORDTYPE_HPP_
+#include <com/sun/star/text/WordType.hpp>
+#endif
+
+using namespace ::com::sun::star;
+
+
+ // -------------------------------------------------------------------------
+// (+) class TextView
+// -------------------------------------------------------------------------
+TextView::TextView( TextEngine* pEng, Window* pWindow )
+{
+ mpWindow = pWindow;
+ mpTextEngine = pEng;
+ mpVirtDev = NULL;
+
+ mbPaintSelection = TRUE;
+ mbAutoScroll = TRUE;
+ mbInsertMode = TRUE;
+ mbReadOnly = FALSE;
+ mbHighlightSelection = FALSE;
+ mbAutoIndent = FALSE;
+ mbCursorEnabled = TRUE;
+// mbInSelection = FALSE;
+
+ mnTravelXPos = TRAVEL_X_DONTKNOW;
+
+ mpSelFuncSet = new TextSelFunctionSet( this );
+ mpSelEngine = new SelectionEngine( mpWindow, mpSelFuncSet );
+ mpSelEngine->SetSelectionMode( RANGE_SELECTION );
+ mpSelEngine->EnableDrag( TRUE );
+
+ mpCursor = new Cursor;
+ mpCursor->Show();
+ pWindow->SetCursor( mpCursor );
+
+ if ( pWindow->GetSettings().GetStyleSettings().GetSelectionOptions() & SELECTION_OPTION_INVERT )
+ mbHighlightSelection = TRUE;
+
+ pWindow->SetLineColor();
+
+ mpDDInfo = 0;
+}
+
+TextView::~TextView()
+{
+ delete mpSelEngine;
+ delete mpSelFuncSet;
+ delete mpVirtDev;
+
+ if ( mpWindow->GetCursor() == mpCursor )
+ mpWindow->SetCursor( 0 );
+ delete mpCursor;
+ delete mpDDInfo;
+}
+
+void TextView::Invalidate()
+{
+ mpWindow->Invalidate();
+}
+
+void TextView::SetSelection( const TextSelection& rTextSel, BOOL bGotoCursor )
+{
+ // Falls jemand gerade ein leeres Attribut hinterlassen hat,
+ // und dann der Outliner die Selektion manipulitert:
+ if ( !maSelection.HasRange() )
+ mpTextEngine->CursorMoved( maSelection.GetStart().GetPara() );
+
+ // Wenn nach einem KeyInput die Selection manipuliert wird:
+ mpTextEngine->CheckIdleFormatter();
+
+ HideSelection();
+ maSelection = rTextSel;
+ mpTextEngine->ValidateSelection( maSelection );
+ ShowSelection();
+ ShowCursor( bGotoCursor );
+}
+
+void TextView::SetSelection( const TextSelection& rTextSel )
+{
+ SetSelection( rTextSel, mbAutoScroll );
+}
+
+const TextSelection& TextView::GetSelection() const
+{
+ return maSelection;
+}
+
+void TextView::DeleteSelected()
+{
+// HideSelection();
+
+ mpTextEngine->UndoActionStart( TEXTUNDO_DELETE );
+ TextPaM aPaM = mpTextEngine->ImpDeleteText( maSelection );
+ mpTextEngine->UndoActionEnd( TEXTUNDO_DELETE );
+
+ maSelection = aPaM;
+ mpTextEngine->FormatAndUpdate( this );
+ ShowCursor();
+}
+
+void TextView::ImpPaint( OutputDevice* pOut, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange, TextSelection const* pSelection )
+{
+ if ( !mbPaintSelection )
+ pSelection = NULL;
+ else
+ {
+ // Richtige Hintergrundfarbe einstellen.
+ // Ich bekomme leider nicht mit, ob sich diese inzwischen geaendert hat.
+ Font aFont = mpTextEngine->GetFont();
+ Color aColor = pOut->GetBackground().GetColor();
+ aColor.SetTransparency( 0 );
+ if ( aColor != aFont.GetFillColor() )
+ {
+ aFont.SetTransparent( FALSE );
+ aFont.SetFillColor( aColor );
+ mpTextEngine->maFont = aFont;
+ }
+ }
+
+ mpTextEngine->ImpPaint( pOut, rStartPos, pPaintArea, pPaintRange, pSelection );
+}
+
+void TextView::Paint( const Rectangle& rRect )
+{
+ ImpPaint( rRect, FALSE );
+}
+
+void TextView::ImpPaint( const Rectangle& rRect, BOOL bUseVirtDev )
+{
+ if ( !mpTextEngine->GetUpdateMode() || mpTextEngine->IsInUndo() )
+ return;
+
+ if ( bUseVirtDev )
+ {
+ VirtualDevice* pVDev = GetVirtualDevice();
+
+ const Color& rBackgroundColor = mpWindow->GetBackground().GetColor();
+ if ( pVDev->GetFillColor() != rBackgroundColor )
+ pVDev->SetFillColor( rBackgroundColor );
+ if ( pVDev->GetBackground().GetColor() != rBackgroundColor )
+ pVDev->SetBackground( rBackgroundColor );
+
+ BOOL bVDevValid = TRUE;
+ Size aOutSz( pVDev->GetOutputSizePixel() );
+ if ( ( aOutSz.Width() < rRect.GetWidth() ) ||
+ ( aOutSz.Height() < rRect.GetHeight() ) )
+ {
+ bVDevValid = pVDev->SetOutputSizePixel( rRect.GetSize() );
+ }
+ else
+ {
+ // Das VirtDev kann bei einem Resize sehr gross werden =>
+ // irgendwann mal kleiner machen!
+ if ( ( aOutSz.Height() > ( rRect.GetHeight() + 20 ) ) ||
+ ( aOutSz.Width() > ( rRect.GetWidth() + 20 ) ) )
+ {
+ bVDevValid = pVDev->SetOutputSizePixel( rRect.GetSize() );
+ }
+ else
+ {
+ pVDev->Erase();
+ }
+ }
+ if ( !bVDevValid )
+ {
+ ImpPaint( rRect, FALSE /* ohne VDev */ );
+ return;
+ }
+
+ Rectangle aTmpRec( Point( 0, 0 ), rRect.GetSize() );
+ Point aStartPos = GetDocPos( rRect.TopLeft() );
+ aStartPos.X() *= (-1);
+ aStartPos.Y() *= (-1);
+
+ TextSelection *pTmpPtr = mbHighlightSelection ? NULL : &maSelection;
+ ImpPaint( pVDev, aStartPos, &aTmpRec, NULL, pTmpPtr );
+
+ mpWindow->DrawOutDev( rRect.TopLeft(), rRect.GetSize(),
+ Point(0,0), rRect.GetSize(), *pVDev );
+
+// ShowSelection();
+ if ( mbHighlightSelection )
+ ImpHighlight( maSelection );
+ }
+ else
+ {
+ Point aStartPos( -maStartDocPos.X(), -maStartDocPos.Y() );
+
+ TextSelection *pTmpPtr = mbHighlightSelection ? NULL : &maSelection;
+ ImpPaint( mpWindow, aStartPos, &rRect, NULL, pTmpPtr );
+
+// ShowSelection();
+ if ( mbHighlightSelection )
+ ImpHighlight( maSelection );
+ }
+}
+
+void TextView::ImpHighlight( const TextSelection& rSel )
+{
+ TextSelection aSel( rSel );
+ aSel.Justify();
+ if ( aSel.HasRange() && !mpTextEngine->IsInUndo() && mpTextEngine->GetUpdateMode() )
+ {
+ BOOL bInvertSelection = FALSE;
+#ifdef MAC
+ bInvertSelection = ( mpWindow->GetBackground().GetColor() != COL_WHITE );
+#endif
+ mpCursor->Hide();
+
+ DBG_ASSERT( !mpTextEngine->mpIdleFormatter->IsActive(), "ImpHighlight: Not formatted!" );
+
+ Rectangle aVisArea( maStartDocPos, mpWindow->GetOutputSizePixel() );
+ long nY = 0;
+ ULONG nStartPara = aSel.GetStart().GetPara();
+ ULONG nEndPara = aSel.GetEnd().GetPara();
+ for ( ULONG nPara = 0; nPara <= nEndPara; nPara++ )
+ {
+ long nParaHeight = (long)mpTextEngine->CalcParaHeight( nPara );
+ if ( ( nPara >= nStartPara ) && ( ( nY + nParaHeight ) > aVisArea.Top() ) )
+ {
+ TEParaPortion* pTEParaPortion = mpTextEngine->mpTEParaPortions->GetObject( nPara );
+ USHORT nStartLine = 0;
+ USHORT nEndLine = pTEParaPortion->GetLines().Count() -1;
+ if ( nPara == nStartPara )
+ nStartLine = pTEParaPortion->GetLineNumber( aSel.GetStart().GetIndex(), FALSE );
+ if ( nPara == nEndPara )
+ nEndLine = pTEParaPortion->GetLineNumber( aSel.GetEnd().GetIndex(), TRUE );
+
+ // ueber die Zeilen iterieren....
+ for ( USHORT nLine = nStartLine; nLine <= nEndLine; nLine++ )
+ {
+ TextLine* pLine = pTEParaPortion->GetLines().GetObject( nLine );
+ USHORT nStartIndex = pLine->GetStart();
+ USHORT nEndIndex = pLine->GetEnd();
+ if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) )
+ nStartIndex = aSel.GetStart().GetIndex();
+ if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) )
+ nEndIndex = aSel.GetEnd().GetIndex();
+
+ // Kann passieren, wenn am Anfang einer umgebrochenen Zeile.
+ if ( nEndIndex < nStartIndex )
+ nEndIndex = nStartIndex;
+
+ Rectangle aTmpRec( mpTextEngine->GetEditCursor( TextPaM( nPara, nStartIndex ), FALSE ) );
+ aTmpRec.Top() += nY;
+ aTmpRec.Bottom() += nY;
+ Point aTopLeft( aTmpRec.TopLeft() );
+
+ aTmpRec = mpTextEngine->GetEditCursor( TextPaM( nPara, nEndIndex ), TRUE );
+ aTmpRec.Top() += nY;
+ aTmpRec.Bottom() += nY;
+ Point aBottomRight( aTmpRec.BottomRight() );
+ aBottomRight.X()--;
+
+ // Nur Painten, wenn im sichtbaren Bereich...
+ if ( ( aTopLeft.X() < aBottomRight.X() ) && ( aBottomRight.Y() >= aVisArea.Top() ) )
+ {
+ Point aPnt1( GetWindowPos( aTopLeft ) );
+ Point aPnt2( GetWindowPos( aBottomRight ) );
+
+ Rectangle aRect( aPnt1, aPnt2 );
+ /*! (pb) NOOLDSV
+ if ( bInvertSelection )
+ mpWindow->InvertRect( aRect );
+ else
+ mpWindow->HighlightRect( aRect );
+ */
+ mpWindow->Invert( aRect );
+ }
+ }
+ }
+ nY += nParaHeight;
+
+ if ( nY >= aVisArea.Bottom() )
+ break;
+ }
+ }
+}
+
+
+void TextView::ShowSelection()
+{
+ if ( maSelection.HasRange() )
+ {
+ if ( mbHighlightSelection )
+ ImpHighlight( maSelection );
+ else
+ {
+ // Den Bereich neu zeichnen...
+ Rectangle aOutArea( Point( 0, 0 ), mpWindow->GetOutputSizePixel() );
+ Point aStartPos( -maStartDocPos.X(), -maStartDocPos.Y() );
+ TextSelection aRange( maSelection );
+ aRange.Justify();
+ BOOL bVisCursor = mpCursor->IsVisible();
+ mpCursor->Hide();
+ ImpPaint( mpWindow, aStartPos, &aOutArea, &aRange, &maSelection );
+ if ( bVisCursor )
+ mpCursor->Show();
+ }
+ }
+}
+
+void TextView::HideSelection()
+{
+ if ( maSelection.HasRange() )
+ {
+ if ( mbHighlightSelection )
+ ImpHighlight( maSelection );
+ else
+ {
+ // Den Bereich neu zeichnen...
+ Rectangle aOutArea( Point( 0, 0 ), mpWindow->GetOutputSizePixel() );
+ Point aStartPos( -maStartDocPos.X(), -maStartDocPos.Y() );
+ TextSelection aRange( maSelection );
+ aRange.Justify();
+ BOOL bVisCursor = mpCursor->IsVisible();
+ mpCursor->Hide();
+ ImpPaint( mpWindow, aStartPos, &aOutArea, &aRange, NULL );
+ if ( bVisCursor )
+ mpCursor->Show();
+ }
+ }
+}
+
+void TextView::ShowSelection( const TextSelection& rRange )
+{
+ if ( rRange.HasRange() )
+ {
+ if ( mbHighlightSelection )
+ ImpHighlight( rRange );
+ else
+ {
+ // Den Bereich neu zeichnen...
+ Rectangle aOutArea( Point( 0, 0 ), mpWindow->GetOutputSizePixel() );
+ Point aStartPos( -maStartDocPos.X(), -maStartDocPos.Y() );
+ TextSelection aRange( rRange );
+ aRange.Justify();
+ BOOL bVisCursor = mpCursor->IsVisible();
+ mpCursor->Hide();
+ ImpPaint( mpWindow, aStartPos, &aOutArea, &aRange, &maSelection );
+ if ( bVisCursor )
+ mpCursor->Show();
+ }
+ }
+}
+
+VirtualDevice* TextView::GetVirtualDevice()
+{
+ if ( !mpVirtDev )
+ {
+ mpVirtDev = new VirtualDevice;
+ mpVirtDev->SetLineColor();
+ }
+ return mpVirtDev;
+}
+
+void TextView::EraseVirtualDevice()
+{
+ delete mpVirtDev;
+ mpVirtDev = 0;
+}
+
+BOOL TextView::KeyInput( const KeyEvent& rKeyEvent )
+{
+ BOOL bDone = TRUE;
+ BOOL bModified = FALSE;
+ BOOL bMoved = FALSE;
+ BOOL bEndKey = FALSE; // spezielle CursorPosition
+ BOOL bAllowIdle = TRUE;
+
+ // Um zu pruefen ob durch irgendeine Aktion mModified, das lokale
+ // bModified wird z.B. bei Cut/Paste nicht gesetzt, weil dort an anderen
+ // Stellen das updaten erfolgt.
+ BOOL bWasModified = mpTextEngine->IsModified();
+ mpTextEngine->SetModified( FALSE );
+
+ TextSelection aCurSel( maSelection );
+ TextSelection aOldSel( aCurSel );
+
+ USHORT nCode = rKeyEvent.GetKeyCode().GetCode();
+ KeyFuncType eFunc = rKeyEvent.GetKeyCode().GetFunction();
+ if ( eFunc != KEYFUNC_DONTKNOW )
+ {
+ switch ( eFunc )
+ {
+ case KEYFUNC_CUT:
+ {
+ if ( !mbReadOnly )
+ Cut();
+ }
+ break;
+ case KEYFUNC_COPY:
+ {
+ Copy();
+ }
+ break;
+ case KEYFUNC_PASTE:
+ {
+ if ( !mbReadOnly )
+ Paste();
+ }
+ break;
+ case KEYFUNC_UNDO:
+ {
+ if ( !mbReadOnly )
+ Undo();
+ }
+ break;
+ case KEYFUNC_REDO:
+ {
+ if ( !mbReadOnly )
+ Redo();
+ }
+ break;
+
+ default: // wird dann evtl. unten bearbeitet.
+ eFunc = KEYFUNC_DONTKNOW;
+ }
+ }
+ if ( eFunc == KEYFUNC_DONTKNOW )
+ {
+ switch ( nCode )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_HOME:
+ case KEY_END:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ {
+ if ( !rKeyEvent.GetKeyCode().IsMod2() )
+ {
+ aCurSel = ImpMoveCursor( rKeyEvent );
+ bMoved = TRUE;
+ if ( nCode == KEY_END )
+ bEndKey = TRUE;
+ }
+ }
+ break;
+ case KEY_BACKSPACE:
+ case KEY_DELETE:
+ {
+ if ( !mbReadOnly && !rKeyEvent.GetKeyCode().IsMod2() )
+ {
+ BYTE nDel = ( nCode == KEY_DELETE ) ? DEL_RIGHT : DEL_LEFT;
+ BYTE nMode = rKeyEvent.GetKeyCode().IsMod1() ? DELMODE_RESTOFWORD : DELMODE_SIMPLE;
+ if ( ( nMode == DELMODE_RESTOFWORD ) && rKeyEvent.GetKeyCode().IsShift() )
+ nMode = DELMODE_RESTOFCONTENT;
+
+ mpTextEngine->UndoActionStart( TEXTUNDO_DELETE );
+ aCurSel = ImpDelete( nDel, nMode );
+ mpTextEngine->UndoActionEnd( TEXTUNDO_DELETE );
+ bModified = TRUE;
+ bAllowIdle = FALSE;
+ }
+ else
+ bDone = FALSE;
+ }
+ break;
+ case KEY_TAB:
+ {
+ if ( !mbReadOnly && !rKeyEvent.GetKeyCode().IsShift() &&
+ !rKeyEvent.GetKeyCode().IsMod1() && !rKeyEvent.GetKeyCode().IsMod2() &&
+ ImplCheckTextLen( 'x' ) )
+ {
+ aCurSel = mpTextEngine->ImpInsertText( aCurSel, '\t', !IsInsertMode() );
+ bModified = TRUE;
+ }
+ else
+ bDone = FALSE;
+ }
+ break;
+ case KEY_RETURN:
+ {
+ // Shift-RETURN darf nicht geschluckt werden, weil dann keine
+ // mehrzeilige Eingabe in Dialogen/Property-Editor moeglich.
+ if ( !mbReadOnly && !rKeyEvent.GetKeyCode().IsMod1() &&
+ !rKeyEvent.GetKeyCode().IsMod2() && ImplCheckTextLen( 'x' ) )
+ {
+ mpTextEngine->UndoActionStart( TEXTUNDO_INSERT );
+ aCurSel = mpTextEngine->ImpInsertParaBreak( aCurSel );
+ if ( mbAutoIndent )
+ {
+ TextNode* pPrev = mpTextEngine->mpDoc->GetNodes().GetObject( aCurSel.GetEnd().GetPara() - 1 );
+ USHORT n = 0;
+ while ( ( n < pPrev->GetText().Len() ) && (
+ ( pPrev->GetText().GetChar( n ) == ' ' ) ||
+ ( pPrev->GetText().GetChar( n ) == '\t' ) ) )
+ {
+ n++;
+ }
+ if ( n )
+ aCurSel = mpTextEngine->ImpInsertText( aCurSel, pPrev->GetText().Copy( 0, n ) );
+ }
+ mpTextEngine->UndoActionEnd( TEXTUNDO_INSERT );
+ bModified = TRUE;
+ }
+ else
+ bDone = FALSE;
+ }
+ break;
+ case KEY_INSERT:
+ {
+ if ( !mbReadOnly )
+ SetInsertMode( !IsInsertMode() );
+ }
+ break;
+ default:
+ {
+ if ( TextEngine::IsSimpleCharInput( rKeyEvent ) )
+ {
+ xub_Unicode nCharCode = rKeyEvent.GetCharCode();
+ if ( !mbReadOnly && ImplCheckTextLen( nCharCode ) ) // sonst trotzdem das Zeichen schlucken...
+ {
+ aCurSel = mpTextEngine->ImpInsertText( aCurSel, nCharCode, !IsInsertMode() );
+ bModified = TRUE;
+ }
+ }
+ else
+ bDone = FALSE;
+ }
+ }
+ }
+
+ if ( aCurSel != aOldSel )
+ maSelection = aCurSel;
+
+ mpTextEngine->UpdateSelections();
+
+ if ( ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) )
+ mnTravelXPos = TRAVEL_X_DONTKNOW;
+
+ if ( bModified )
+ {
+ // Idle-Formatter nur, wenn AnyInput.
+ if ( bAllowIdle && Application::AnyInput( INPUT_KEYBOARD) )
+ mpTextEngine->IdleFormatAndUpdate( this );
+ else
+ mpTextEngine->FormatAndUpdate( this);
+ }
+ else if ( bMoved )
+ {
+ // Selection wird jetzt gezielt in ImpMoveCursor gemalt.
+ ImpShowCursor( mbAutoScroll, TRUE, bEndKey );
+ }
+
+ if ( mpTextEngine->IsModified() )
+ mpTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
+ else if ( bWasModified )
+ mpTextEngine->SetModified( TRUE );
+
+ return bDone;
+}
+
+void TextView::MouseButtonUp( const MouseEvent& rMouseEvent )
+{
+ mnTravelXPos = TRAVEL_X_DONTKNOW;
+ mpSelEngine->SelMouseButtonUp( rMouseEvent );
+}
+
+void TextView::MouseButtonDown( const MouseEvent& rMouseEvent )
+{
+ mpTextEngine->CheckIdleFormatter(); // Falls schnelles Tippen und MouseButtonDown
+ mnTravelXPos = TRAVEL_X_DONTKNOW;
+
+ mpTextEngine->SetActiveView( this );
+
+ mpSelEngine->SelMouseButtonDown( rMouseEvent );
+
+ // Sonderbehandlungen
+ if ( !rMouseEvent.IsShift() && ( rMouseEvent.GetClicks() >= 2 ) )
+ {
+ if ( rMouseEvent.IsMod2() )
+ {
+ HideSelection();
+ maSelection.GetStart() = maSelection.GetEnd();
+ SetCursorAtPoint( rMouseEvent.GetPosPixel() ); // Wird von SelectionEngine bei MOD2 nicht gesetzt
+ }
+
+ if ( rMouseEvent.GetClicks() == 2 )
+ {
+ // Wort selektieren
+ if ( maSelection.GetEnd().GetIndex() < mpTextEngine->GetTextLen( maSelection.GetEnd().GetPara() ) )
+ {
+ HideSelection();
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( maSelection.GetEnd().GetPara() );
+ uno::Reference < text::XBreakIterator > xBI = mpTextEngine->GetBreakIterator();
+ text::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), maSelection.GetEnd().GetIndex(), mpTextEngine->GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
+ maSelection.GetStart().GetIndex() = aBoundary.startPos;
+ maSelection.GetEnd().GetIndex() = aBoundary.endPos;
+ ShowSelection();
+ ShowCursor( TRUE, TRUE );
+ }
+ }
+ else if ( rMouseEvent.GetClicks() == 3 )
+ {
+ // Absatz selektieren
+ if ( maSelection.GetEnd().GetIndex() < mpTextEngine->GetTextLen( maSelection.GetEnd().GetPara() ) )
+ {
+ HideSelection();
+ maSelection.GetStart().GetIndex() = 0;
+ maSelection.GetEnd().GetIndex() = mpTextEngine->mpDoc->GetNodes().GetObject( maSelection.GetEnd().GetPara() )->GetText().Len();
+ ShowSelection();
+ ShowCursor( TRUE, TRUE );
+ }
+ }
+ }
+}
+
+
+void TextView::MouseMove( const MouseEvent& rMouseEvent )
+{
+ mnTravelXPos = TRAVEL_X_DONTKNOW;
+ mpSelEngine->SelMouseMove( rMouseEvent );
+}
+
+void TextView::Command( const CommandEvent& rCEvt )
+{
+ mpTextEngine->CheckIdleFormatter(); // Falls schnelles Tippen und MouseButtonDown
+ mpTextEngine->SetActiveView( this );
+ BOOL bCallSelectionEngineCommand = TRUE;
+ if ( ( rCEvt.GetCommand() == COMMAND_STARTDRAG ) )
+ {
+ }
+ if ( bCallSelectionEngineCommand )
+ mpSelEngine->Command( rCEvt );
+}
+
+void TextView::ShowCursor( BOOL bGotoCursor, BOOL bForceVisCursor )
+{
+ // Die Einstellung hat mehr Gewicht:
+ if ( !mbAutoScroll )
+ bGotoCursor = FALSE;
+ ImpShowCursor( bGotoCursor, bForceVisCursor, FALSE );
+}
+
+void TextView::HideCursor()
+{
+ mpCursor->Hide();
+}
+
+void TextView::Scroll( long ndX, long ndY )
+{
+ DBG_ASSERT( mpTextEngine->IsFormatted(), "Scroll: Nicht formatiert!" );
+
+ if ( !ndX && !ndY )
+ return;
+
+ Point aNewStartPos( maStartDocPos );
+
+ // Vertical:
+ aNewStartPos.Y() -= ndY;
+ if ( aNewStartPos.Y() < 0 )
+ aNewStartPos.Y() = 0;
+
+ // Horizontal:
+ aNewStartPos.X() -= ndX;
+ if ( aNewStartPos.X() < 0 )
+ aNewStartPos.X() = 0;
+
+ long nDiffX = maStartDocPos.X() - aNewStartPos.X();
+ long nDiffY = maStartDocPos.Y() - aNewStartPos.Y();
+
+ if ( nDiffX || nDiffY )
+ {
+ BOOL bVisCursor = mpCursor->IsVisible();
+ mpCursor->Hide();
+ mpWindow->Update();
+ maStartDocPos = aNewStartPos;
+
+ mpWindow->Scroll( nDiffX, nDiffY );
+ mpWindow->Update();
+ mpCursor->SetPos( mpCursor->GetPos() + Point( nDiffX, nDiffY ) );
+ if ( bVisCursor && !mbReadOnly )
+ mpCursor->Show();
+ }
+}
+
+void TextView::Undo()
+{
+ mpTextEngine->SetActiveView( this );
+ mpTextEngine->GetUndoManager().Undo( 1 );
+}
+
+void TextView::Redo()
+{
+ mpTextEngine->SetActiveView( this );
+ mpTextEngine->GetUndoManager().Redo( 0 );
+}
+
+void TextView::Cut()
+{
+ mpTextEngine->UndoActionStart( TEXTUNDO_CUT );
+ Copy();
+ DeleteSelected();
+ mpTextEngine->UndoActionEnd( TEXTUNDO_CUT );
+}
+
+void TextView::Copy()
+{
+ Clipboard::Clear();
+ TextSelection aSel( maSelection );
+ aSel.Justify();
+ SvMemoryStream aMem;
+ mpTextEngine->Write( aMem, &aSel );
+ aMem << '\0';
+ Clipboard::CopyData( (const char*)aMem.GetData(), aMem.Tell(), FORMAT_STRING );
+ if ( mpTextEngine->HasAttrib( TEXTATTR_HYPERLINK ) )
+ {
+ // Dann auch als HTML
+ aMem.SetStreamSize( 0 );
+ aMem.Seek( 0 );
+ mpTextEngine->Write( aMem, &aSel, TRUE );
+ aMem << '\0';
+ Clipboard::CopyData( (const char*)aMem.GetData(), aMem.Tell(), SOT_FORMATSTR_ID_HTML );
+ }
+}
+
+void TextView::Paste()
+{
+ BOOL bPaste = TRUE;
+ if ( mpTextEngine->GetMaxTextLen() )
+ {
+ // QuickCheck, kein String > 64K moeglich...
+ String aStr( Clipboard::PasteString() );
+ aStr.ConvertLineEnd( LINEEND_LF );
+ bPaste = ImplCheckTextLen( aStr );
+ }
+
+ if ( bPaste )
+ {
+ mpTextEngine->UndoActionStart( TEXTUNDO_PASTE );
+
+ ULONG nLen = Clipboard::GetDataLen( FORMAT_STRING );
+ void* pBuf = SvMemAlloc( nLen );
+ Clipboard::PasteData( pBuf, nLen, FORMAT_STRING );
+
+ // commented out while converting to Unicode
+ // long nStringLen = strlen( (const char*) pBuf ); // 0-terminiert, Datenmuell im Clipborad dahinter.
+
+ SvMemoryStream aMem( (char*)pBuf, nLen /*nStringLen*/, STREAM_READ );
+ aMem.ObjectOwnsMemory( TRUE );
+ mpTextEngine->Read( aMem, &maSelection );
+
+ mpTextEngine->UndoActionEnd( TEXTUNDO_PASTE );
+ }
+}
+
+String TextView::GetSelected()
+{
+ return mpTextEngine->GetText( maSelection, GetSystemLineEnd() );
+}
+
+void TextView::SetInsertMode( BOOL bInsert )
+{
+ if ( mbInsertMode != bInsert )
+ {
+ mbInsertMode = bInsert;
+ ShowCursor( mbAutoScroll, FALSE );
+ }
+}
+
+void TextView::SetReadOnly( BOOL bReadOnly )
+{
+ if ( mbReadOnly != bReadOnly )
+ {
+ mbReadOnly = bReadOnly;
+ if ( !mbReadOnly )
+ ShowCursor( mbAutoScroll, FALSE );
+ else
+ HideCursor();
+ }
+}
+
+TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent )
+{
+ // Eigentlich nur bei Up/Down noetig, aber was solls.
+ mpTextEngine->CheckIdleFormatter();
+
+ TextPaM aPaM( maSelection.GetEnd() );
+ TextPaM aOldEnd( aPaM );
+
+ BOOL bCtrl = rKeyEvent.GetKeyCode().IsMod1() ? TRUE : FALSE;
+
+ switch ( rKeyEvent.GetKeyCode().GetCode() )
+ {
+ case KEY_UP: aPaM = CursorUp( aPaM );
+ break;
+ case KEY_DOWN: aPaM = CursorDown( aPaM );
+ break;
+ case KEY_HOME: aPaM = bCtrl ? CursorStartOfDoc() : CursorStartOfLine( aPaM );
+ break;
+ case KEY_END: aPaM = bCtrl ? CursorEndOfDoc() : CursorEndOfLine( aPaM );
+ break;
+ case KEY_PAGEUP: aPaM = bCtrl ? CursorStartOfDoc() : PageUp( aPaM );
+ break;
+ case KEY_PAGEDOWN: aPaM = bCtrl ? CursorEndOfDoc() : PageDown( aPaM );
+ break;
+ case KEY_LEFT: aPaM = CursorLeft( aPaM, bCtrl );
+ break;
+ case KEY_RIGHT: aPaM = CursorRight( aPaM, bCtrl );
+ break;
+ }
+
+ // Bewirkt evtl. ein CreateAnchor oder Deselection all
+ mpSelEngine->CursorPosChanging( rKeyEvent.GetKeyCode().IsShift(), rKeyEvent.GetKeyCode().IsMod1() );
+
+ if ( aOldEnd != aPaM )
+ {
+ mpTextEngine->CursorMoved( aOldEnd.GetPara() );
+
+
+ TextSelection aOldSelection( maSelection );
+ maSelection.GetEnd() = aPaM;
+ if ( rKeyEvent.GetKeyCode().IsShift() )
+ {
+ // Dann wird die Selektion erweitert...
+ ShowSelection( TextSelection( aOldEnd, aPaM ) );
+ }
+ else
+ {
+ maSelection.GetStart() = aPaM;
+ }
+ }
+
+ return maSelection;
+}
+
+void TextView::InsertText( const XubString& rStr, BOOL bSelect )
+{
+// HideSelection();
+
+ TextSelection aNewSel( maSelection );
+
+ mpTextEngine->UndoActionStart( TEXTUNDO_INSERT );
+ TextPaM aPaM = mpTextEngine->ImpInsertText( maSelection, rStr );
+ mpTextEngine->UndoActionEnd( TEXTUNDO_INSERT );
+
+ if ( bSelect )
+ {
+ aNewSel.Justify();
+ aNewSel.GetEnd() = aPaM;
+ maSelection = aNewSel;
+ }
+ else
+ maSelection = aPaM;
+
+ mpTextEngine->FormatAndUpdate( this );
+}
+
+TextPaM TextView::CursorLeft( const TextPaM& rPaM, BOOL bWordMode )
+{
+ TextPaM aPaM( rPaM );
+
+ if ( aPaM.GetIndex() )
+ {
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ uno::Reference < text::XBreakIterator > xBI = mpTextEngine->GetBreakIterator();
+ if ( bWordMode )
+ {
+ text::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rPaM.GetIndex(), mpTextEngine->GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
+ if ( aBoundary.startPos == rPaM.GetIndex() )
+ aBoundary = xBI->previousWord( pNode->GetText(), rPaM.GetIndex(), mpTextEngine->GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aPaM.GetIndex() = aBoundary.startPos;
+ }
+ else
+ {
+ sal_Int32 nCount = 1;
+ aPaM.GetIndex() = xBI->previousCharacters( pNode->GetText(), aPaM.GetIndex(), mpTextEngine->GetLocale(), text::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
+ }
+ }
+ else if ( aPaM.GetPara() )
+ {
+ aPaM.GetPara()--;
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ aPaM.GetIndex() = pNode->GetText().Len();
+ }
+ return aPaM;
+}
+
+TextPaM TextView::CursorRight( const TextPaM& rPaM, BOOL bWordMode )
+{
+ TextPaM aPaM( rPaM );
+
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ if ( aPaM.GetIndex() < pNode->GetText().Len() )
+ {
+ uno::Reference < text::XBreakIterator > xBI = mpTextEngine->GetBreakIterator();
+ if ( bWordMode )
+ {
+ text::Boundary aBoundary = xBI->nextWord( pNode->GetText(), aPaM.GetIndex(), mpTextEngine->GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aPaM.GetIndex() = aBoundary.startPos;
+ }
+ else
+ {
+ sal_Int32 nCount = 1;
+ aPaM.GetIndex() = xBI->nextCharacters( pNode->GetText(), aPaM.GetIndex(), mpTextEngine->GetLocale(), text::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
+ }
+ }
+ else if ( aPaM.GetPara() < ( mpTextEngine->mpDoc->GetNodes().Count()-1) )
+ {
+ aPaM.GetPara()++;
+ aPaM.GetIndex() = 0;
+ }
+
+ return aPaM;
+}
+
+TextPaM TextView::ImpDelete( BYTE nMode, BYTE nDelMode )
+{
+ if ( maSelection.HasRange() ) // dann nur Sel. loeschen
+ return mpTextEngine->ImpDeleteText( maSelection );
+
+ TextPaM aStartPaM = maSelection.GetStart();
+ TextPaM aEndPaM = aStartPaM;
+ if ( nMode == DEL_LEFT )
+ {
+ if ( nDelMode == DELMODE_SIMPLE )
+ {
+ aEndPaM = CursorLeft( aEndPaM );
+ }
+ else if ( nDelMode == DELMODE_RESTOFWORD )
+ {
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ uno::Reference < text::XBreakIterator > xBI = mpTextEngine->GetBreakIterator();
+ text::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), maSelection.GetEnd().GetIndex(), mpTextEngine->GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
+ if ( aBoundary.startPos == maSelection.GetEnd().GetIndex() )
+ aBoundary = xBI->previousWord( pNode->GetText(), maSelection.GetEnd().GetIndex(), mpTextEngine->GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aEndPaM.GetIndex() = aBoundary.startPos;
+ }
+ else // DELMODE_RESTOFCONTENT
+ {
+ if ( aEndPaM.GetIndex() != 0 )
+ aEndPaM.GetIndex() = 0;
+ else if ( aEndPaM.GetPara() )
+ {
+ // Absatz davor
+ aEndPaM.GetPara()--;
+ aEndPaM.GetIndex() = 0;
+ }
+ }
+ }
+ else
+ {
+ if ( nDelMode == DELMODE_SIMPLE )
+ {
+ aEndPaM = CursorRight( aEndPaM );
+ }
+ else if ( nDelMode == DELMODE_RESTOFWORD )
+ {
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ uno::Reference < text::XBreakIterator > xBI = mpTextEngine->GetBreakIterator();
+ text::Boundary aBoundary = xBI->nextWord( pNode->GetText(), maSelection.GetEnd().GetIndex(), mpTextEngine->GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aEndPaM.GetIndex() = aBoundary.startPos;
+ }
+ else // DELMODE_RESTOFCONTENT
+ {
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ if ( aEndPaM.GetIndex() < pNode->GetText().Len() )
+ aEndPaM.GetIndex() = pNode->GetText().Len();
+ else if ( aEndPaM.GetPara() < ( mpTextEngine->mpDoc->GetNodes().Count() - 1 ) )
+ {
+ // Absatz danach
+ aEndPaM.GetPara()++;
+ TextNode* pNextNode = mpTextEngine->mpDoc->GetNodes().GetObject( aEndPaM.GetPara() );
+ aEndPaM.GetIndex() = pNextNode->GetText().Len();
+ }
+ }
+ }
+
+ return mpTextEngine->ImpDeleteText( TextSelection( aStartPaM, aEndPaM ) );
+}
+
+
+
+TextPaM TextView::CursorUp( const TextPaM& rPaM )
+{
+ TextPaM aPaM( rPaM );
+
+ long nX;
+ if ( mnTravelXPos == TRAVEL_X_DONTKNOW )
+ {
+ nX = mpTextEngine->GetEditCursor( rPaM, FALSE ).Left();
+ mnTravelXPos = nX+1;
+ }
+ else
+ nX = mnTravelXPos;
+
+ TEParaPortion* pPPortion = mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
+ USHORT nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), FALSE );
+ if ( nLine ) // gleicher Absatz
+ {
+ USHORT nCharPos = mpTextEngine->GetCharPos( rPaM.GetPara(), nLine-1, nX );
+ aPaM.GetIndex() = nCharPos;
+ // Wenn davor eine autom.Umgebrochene Zeile, und ich muss genau an das
+ // Ende dieser Zeile, landet der Cursor in der aktuellen Zeile am Anfang
+ // Siehe Problem: Letztes Zeichen einer autom.umgebr. Zeile = Cursor
+ TextLine* pLine = pPPortion->GetLines().GetObject( nLine - 1 );
+ if ( aPaM.GetIndex() && ( aPaM.GetIndex() == pLine->GetEnd() ) )
+ aPaM.GetIndex()--;
+ }
+ else if ( rPaM.GetPara() ) // vorheriger Absatz
+ {
+ aPaM.GetPara()--;
+ pPPortion = mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
+ USHORT nL = pPPortion->GetLines().Count() - 1;
+ USHORT nCharPos = mpTextEngine->GetCharPos( aPaM.GetPara(), nL, nX+1 );
+ aPaM.GetIndex() = nCharPos;
+ }
+
+ return aPaM;
+}
+
+TextPaM TextView::CursorDown( const TextPaM& rPaM )
+{
+ TextPaM aPaM( rPaM );
+
+ long nX;
+ if ( mnTravelXPos == TRAVEL_X_DONTKNOW )
+ {
+ nX = mpTextEngine->GetEditCursor( rPaM, FALSE ).Left();
+ mnTravelXPos = nX+1;
+ }
+ else
+ nX = mnTravelXPos;
+
+ TEParaPortion* pPPortion = mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
+ USHORT nLine = pPPortion->GetLineNumber( rPaM.GetIndex(), FALSE );
+ if ( nLine < ( pPPortion->GetLines().Count() - 1 ) )
+ {
+ USHORT nCharPos = mpTextEngine->GetCharPos( rPaM.GetPara(), nLine+1, nX );
+ aPaM.GetIndex() = nCharPos;
+
+ // Sonderbehandlung siehe CursorUp...
+ TextLine* pLine = pPPortion->GetLines().GetObject( nLine + 1 );
+ if ( ( aPaM.GetIndex() == pLine->GetEnd() ) && ( aPaM.GetIndex() > pLine->GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().Len() )
+ aPaM.GetIndex()--;
+ }
+ else if ( rPaM.GetPara() < ( mpTextEngine->mpDoc->GetNodes().Count() - 1 ) ) // naechster Absatz
+ {
+ aPaM.GetPara()++;
+ pPPortion = mpTextEngine->mpTEParaPortions->GetObject( aPaM.GetPara() );
+ USHORT nCharPos = mpTextEngine->GetCharPos( aPaM.GetPara(), 0, nX+1 );
+ aPaM.GetIndex() = nCharPos;
+ TextLine* pLine = pPPortion->GetLines().GetObject( 0 );
+ if ( ( aPaM.GetIndex() == pLine->GetEnd() ) && ( aPaM.GetIndex() > pLine->GetStart() ) && ( pPPortion->GetLines().Count() > 1 ) )
+ aPaM.GetIndex()--;
+ }
+
+ return aPaM;
+}
+
+TextPaM TextView::CursorStartOfLine( const TextPaM& rPaM )
+{
+ TextPaM aPaM( rPaM );
+
+ TEParaPortion* pPPortion = mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
+ USHORT nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), FALSE );
+ TextLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ aPaM.GetIndex() = pLine->GetStart();
+
+ return aPaM;
+}
+
+TextPaM TextView::CursorEndOfLine( const TextPaM& rPaM )
+{
+ TextPaM aPaM( rPaM );
+
+ TEParaPortion* pPPortion = mpTextEngine->mpTEParaPortions->GetObject( rPaM.GetPara() );
+ USHORT nLine = pPPortion->GetLineNumber( aPaM.GetIndex(), FALSE );
+ TextLine* pLine = pPPortion->GetLines().GetObject( nLine );
+ aPaM.GetIndex() = pLine->GetEnd();
+
+ if ( pLine->GetEnd() > pLine->GetStart() ) // Leerzeile
+ {
+ xub_Unicode cLastChar = pPPortion->GetNode()->GetText().GetChar((USHORT)(aPaM.GetIndex()-1) );
+ if ( ( cLastChar == ' ' ) && ( aPaM.GetIndex() != pPPortion->GetNode()->GetText().Len() ) )
+ {
+ // Bei einem Blank in einer autom. umgebrochenen Zeile macht es Sinn,
+ // davor zu stehen, da der Anwender hinter das Wort will.
+ // Wenn diese geaendert wird, Sonderbehandlung fuer Pos1 nach End!
+ aPaM.GetIndex()--;
+ }
+ }
+ return aPaM;
+}
+
+TextPaM TextView::CursorStartOfParagraph( const TextPaM& rPaM )
+{
+ TextPaM aPaM( rPaM );
+ aPaM.GetIndex() = 0;
+ return aPaM;
+}
+
+TextPaM TextView::CursorEndOfParagraph( const TextPaM& rPaM )
+{
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( rPaM.GetPara() );
+ TextPaM aPaM( rPaM );
+ aPaM.GetIndex() = pNode->GetText().Len();
+ return aPaM;
+}
+
+TextPaM TextView::CursorStartOfDoc()
+{
+ TextPaM aPaM( 0, 0 );
+ return aPaM;
+}
+
+TextPaM TextView::CursorEndOfDoc()
+{
+ ULONG nNode = mpTextEngine->mpDoc->GetNodes().Count() - 1;
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( nNode );
+ TextPaM aPaM( nNode, pNode->GetText().Len() );
+ return aPaM;
+}
+
+TextPaM TextView::PageUp( const TextPaM& rPaM )
+{
+ Rectangle aRec = mpTextEngine->PaMtoEditCursor( rPaM );
+ Point aTopLeft = aRec.TopLeft();
+ aTopLeft.Y() -= mpWindow->GetOutputSizePixel().Height() * 9/10;
+ aTopLeft.X() += 1;
+ if ( aTopLeft.Y() < 0 )
+ aTopLeft.Y() = 0;
+
+ TextPaM aPaM = mpTextEngine->GetPaM( aTopLeft );
+ return aPaM;
+}
+
+TextPaM TextView::PageDown( const TextPaM& rPaM )
+{
+ Rectangle aRec = mpTextEngine->PaMtoEditCursor( rPaM );
+ Point aBottomRight = aRec.BottomRight();
+ aBottomRight.Y() += mpWindow->GetOutputSizePixel().Height() * 9/10;
+ aBottomRight.X() += 1;
+ long nHeight = mpTextEngine->GetTextHeight();
+ if ( aBottomRight.Y() > nHeight )
+ aBottomRight.Y() = nHeight-1;
+
+ TextPaM aPaM = mpTextEngine->GetPaM( aBottomRight );
+ return aPaM;
+}
+
+void TextView::ImpShowCursor( BOOL bGotoCursor, BOOL bForceVisCursor, BOOL bSpecial )
+{
+ if ( mpTextEngine->IsFormatting() )
+ return;
+ if ( mpTextEngine->GetUpdateMode() == FALSE )
+ return;
+ if ( mpTextEngine->IsInUndo() )
+ return;
+
+ mpTextEngine->CheckIdleFormatter();
+ if ( !mpTextEngine->IsFormatted() )
+ mpTextEngine->FormatAndUpdate( this );
+
+
+ TextPaM aPaM( maSelection.GetEnd() );
+ Rectangle aEditCursor = mpTextEngine->PaMtoEditCursor( aPaM, bSpecial );
+ if ( !IsInsertMode() && !maSelection.HasRange() )
+ {
+ TextNode* pNode = mpTextEngine->mpDoc->GetNodes().GetObject( aPaM.GetPara() );
+ if ( pNode->GetText().Len() && ( aPaM.GetIndex() < pNode->GetText().Len() ) )
+ {
+ long nWidth = (long)mpTextEngine->CalcTextWidth( aPaM.GetPara(), aPaM.GetIndex(), 1 );
+ aEditCursor.Right() += nWidth;
+ }
+ }
+
+ Size aOutSz = mpWindow->GetOutputSizePixel();
+ if ( aEditCursor.GetHeight() > aOutSz.Height() )
+ aEditCursor.Bottom() = aEditCursor.Top() + aOutSz.Height() - 1;
+
+ if ( bGotoCursor )
+ {
+ long nVisStartY = maStartDocPos.Y();
+ long nVisEndY = maStartDocPos.Y() + aOutSz.Height();
+ long nVisStartX = maStartDocPos.X();
+ long nVisEndX = maStartDocPos.X() + aOutSz.Width();
+ long nMoreX = aOutSz.Width() / 4;
+
+ Point aNewStartPos( maStartDocPos );
+
+ if ( aEditCursor.Bottom() > nVisEndY )
+ {
+ aNewStartPos.Y() += ( aEditCursor.Bottom() - nVisEndY );
+ }
+ else if ( aEditCursor.Top() < nVisStartY )
+ {
+ aNewStartPos.Y() -= ( nVisStartY - aEditCursor.Top() );
+ }
+
+ if ( aEditCursor.Right() > nVisEndX )
+ {
+ aNewStartPos.X() += ( aEditCursor.Right() - nVisEndX );
+
+ // Darfs ein bischen mehr sein?
+ aNewStartPos.X() += nMoreX;
+ }
+ else if ( aEditCursor.Left() < nVisStartX )
+ {
+ aNewStartPos.X() -= ( nVisStartX - aEditCursor.Left() );
+
+ // Darfs ein bischen mehr sein?
+ aNewStartPos.X() -= nMoreX;
+ }
+
+ // X kann durch das 'bischen mehr' falsch sein:
+// ULONG nMaxTextWidth = mpTextEngine->GetMaxTextWidth();
+// if ( !nMaxTextWidth || ( nMaxTextWidth > 0x7FFFFFFF ) )
+// nMaxTextWidth = 0x7FFFFFFF;
+// long nMaxX = (long)nMaxTextWidth - aOutSz.Width();
+ long nMaxX = mpTextEngine->CalcTextWidth() - aOutSz.Width();
+ if ( nMaxX < 0 )
+ nMaxX = 0;
+
+ if ( aNewStartPos.X() < 0 )
+ aNewStartPos.X() = 0;
+ else if ( aNewStartPos.X() > nMaxX )
+ aNewStartPos.X() = nMaxX;
+
+ // Y sollte nicht weiter unten als noetig liegen:
+ long nYMax = mpTextEngine->GetTextHeight() - aOutSz.Height();
+ if ( nYMax < 0 )
+ nYMax = 0;
+ if ( aNewStartPos.Y() > nYMax )
+ aNewStartPos.Y() = nYMax;
+
+ if ( aNewStartPos != maStartDocPos )
+ {
+ Scroll( -(aNewStartPos.X() - maStartDocPos.X()), -(aNewStartPos.Y() - maStartDocPos.Y()) );
+ mpTextEngine->Broadcast( TextHint( TEXT_HINT_VIEWSCROLLED ) );
+ }
+ }
+
+ Point aPoint( GetWindowPos( aEditCursor.TopLeft() ) );
+ mpCursor->SetPos( aPoint );
+ mpCursor->SetSize( aEditCursor.GetSize() );
+ if ( bForceVisCursor && mbCursorEnabled )
+ mpCursor->Show();
+}
+
+BOOL TextView::SetCursorAtPoint( const Point& rPosPixel )
+{
+// if ( !Rectangle( Point(), mpWindow->GetOutputSizePixel() ).IsInside( rPosPixel ) && !mbInSelection )
+// return FALSE;
+
+ mpTextEngine->CheckIdleFormatter();
+
+ Point aDocPos = GetDocPos( rPosPixel );
+
+ TextPaM aPaM = mpTextEngine->GetPaM( aDocPos );
+
+ // aTmpNewSel: Diff zwischen alt und neu, nicht die neue Selektion
+ TextSelection aTmpNewSel( maSelection.GetEnd(), aPaM );
+ maSelection.GetEnd() = aPaM;
+
+ if ( !mpSelEngine->HasAnchor() )
+ {
+ if ( maSelection.GetStart() != aPaM )
+ mpTextEngine->CursorMoved( maSelection.GetStart().GetPara() );
+ maSelection.GetStart() = aPaM;
+ }
+ else
+ {
+ ShowSelection( aTmpNewSel );
+ }
+
+ BOOL bForceCursor = mpDDInfo ? FALSE : TRUE; // && !mbInSelection
+ ImpShowCursor( mbAutoScroll, bForceCursor, FALSE );
+ return TRUE;
+}
+
+BOOL TextView::IsSelectionAtPoint( const Point& rPosPixel )
+{
+// if ( !Rectangle( Point(), mpWindow->GetOutputSizePixel() ).IsInside( rPosPixel ) && !mbInSelection )
+// return FALSE;
+
+ Point aDocPos = GetDocPos( rPosPixel );
+ TextPaM aPaM = mpTextEngine->GetPaM( aDocPos, FALSE );
+ // Bei Hyperlinks D&D auch ohne Selektion starten.
+ // BeginDrag wird aber nur gerufen, wenn IsSelectionAtPoint()
+ // Problem: IsSelectionAtPoint wird bei Command() nicht gerufen,
+ // wenn vorher im MBDown schon FALSE returnt wurde.
+ return ( IsInSelection( aPaM ) ||
+ ( /* mpSelEngine->IsInCommand() && */ mpTextEngine->FindAttrib( aPaM, TEXTATTR_HYPERLINK ) ) );
+}
+
+BOOL TextView::IsInSelection( const TextPaM& rPaM )
+{
+ TextSelection aSel = maSelection;
+ aSel.Justify();
+
+ ULONG nStartNode = aSel.GetStart().GetPara();
+ ULONG nEndNode = aSel.GetEnd().GetPara();
+ ULONG nCurNode = rPaM.GetPara();
+
+ if ( ( nCurNode > nStartNode ) && ( nCurNode < nEndNode ) )
+ return TRUE;
+
+ if ( nStartNode == nEndNode )
+ {
+ if ( nCurNode == nStartNode )
+ if ( ( rPaM.GetIndex() >= aSel.GetStart().GetIndex() ) && ( rPaM.GetIndex() < aSel.GetEnd().GetIndex() ) )
+ return TRUE;
+ }
+ else if ( ( nCurNode == nStartNode ) && ( rPaM.GetIndex() >= aSel.GetStart().GetIndex() ) )
+ return TRUE;
+ else if ( ( nCurNode == nEndNode ) && ( rPaM.GetIndex() < aSel.GetEnd().GetIndex() ) )
+ return TRUE;
+
+ return FALSE;
+}
+
+void TextView::ImpHideDDCursor()
+{
+ if ( mpDDInfo && mpDDInfo->mbVisCursor )
+ {
+ mpDDInfo->maCursor.Hide();
+ mpDDInfo->mbVisCursor = FALSE;
+ }
+}
+
+void TextView::ImpShowDDCursor()
+{
+ if ( !mpDDInfo->mbVisCursor )
+ {
+ Rectangle aCursor = mpTextEngine->PaMtoEditCursor( mpDDInfo->maDropPos, TRUE );
+ aCursor.Right()++;
+ aCursor.SetPos( GetWindowPos( aCursor.TopLeft() ) );
+
+ mpDDInfo->maCursor.SetWindow( mpWindow );
+ mpDDInfo->maCursor.SetPos( aCursor.TopLeft() );
+ mpDDInfo->maCursor.SetSize( aCursor.GetSize() );
+ mpDDInfo->maCursor.Show();
+ mpDDInfo->mbVisCursor = TRUE;
+ }
+}
+
+void TextView::BeginDrag()
+{
+ delete mpDDInfo;
+ mpDDInfo = new TextDDInfo;
+
+ mpDDInfo->mbStarterOfDD = TRUE;
+
+ DragServer::Clear();
+
+ TextSelection aSel( maSelection );
+ aSel.Justify();
+
+ // D&D eines Hyperlinks.
+ // Besser waere es im MBDown sich den MBDownPaM zu merken,
+ // ist dann aber inkompatibel => spaeter mal umstellen.
+ TextPaM aPaM( mpTextEngine->GetPaM( GetDocPos( GetWindow()->GetPointerPosPixel() ) ) );
+
+ const TextCharAttrib* pAttr = mpTextEngine->FindCharAttrib( aPaM, TEXTATTR_HYPERLINK );
+ if ( pAttr )
+ {
+ aSel = aPaM;
+ aSel.GetStart().GetIndex() = pAttr->GetStart();
+ aSel.GetEnd().GetIndex() = pAttr->GetEnd();
+
+ const TextAttribHyperLink& rLink = (const TextAttribHyperLink&)pAttr->GetAttr();
+ String aText( rLink.GetDescription() );
+ if ( !aText.Len() )
+ aText = mpTextEngine->GetText( aSel );
+ INetBookmark aBookmark( rLink.GetURL(), aText );
+ aBookmark.CopyDragServer();
+ }
+
+ DragServer::CopyString( mpTextEngine->GetText( aSel ) );
+
+ Region* pDDRegion = NULL;
+#ifdef MAC
+ // ... Region ermitteln
+ Size aOutSz = mpWindow->GetOutputSizePixel();
+ Rectangle aStartCursor( mpTextEngine->GetEditCursor( aSel.GetStart(), FALSE ) );
+ Rectangle aEndCursor( mpTextEngine->GetEditCursor( aSel.GetEnd(), TRUE ) );
+
+ Point aTopLeft = aStartCursor.TopLeft();
+ aTopLeft -= maStartDocPos;
+
+ Point aBottomRight = aStartCursor.BottomRight();
+ aBottomRight -= maStartDocPos;
+
+ if ( aStartCursor.Top() != aEndCursor.Top() )
+ {
+ // Dann einfach das Rechteck mit den kompletten Zeilem
+ aTopLeft.X() = 0;
+ aBottomRight.X() = aOutSz.Width();
+ }
+
+ pDDRegion = new Region( Rectangle( aTopLeft, aBottomRight ) );
+#endif
+
+ mpCursor->Hide();
+
+ mpWindow->ExecuteDrag( Pointer( POINTER_MOVEDATA ),
+ Pointer( POINTER_COPYDATA ), DRAG_ALL, pDDRegion );
+
+ DragServer::Clear();
+ ImpHideDDCursor();
+
+ delete mpDDInfo;
+ mpDDInfo = 0;
+}
+
+BOOL TextView::QueryDrop( DropEvent& rEvt )
+{
+ if ( rEvt.IsLeaveWindow() )
+ {
+ ImpHideDDCursor();
+ return FALSE;
+ }
+
+ BOOL bDrop = FALSE;
+ if ( !mbReadOnly && DragServer::HasFormat( 0, FORMAT_STRING ) &&
+ ( ( rEvt.GetAction() == DROP_COPY ) || ( rEvt.GetAction() == DROP_MOVE ) ) )
+ {
+ if ( !mpDDInfo )
+ mpDDInfo = new TextDDInfo;
+
+ TextPaM aPrevDropPos = mpDDInfo->maDropPos;
+ Point aDocPos = GetDocPos( rEvt.GetPosPixel() );
+ mpDDInfo->maDropPos = mpTextEngine->GetPaM( aDocPos );
+
+ Size aOutSize = mpWindow->GetOutputSizePixel();
+ if ( ( rEvt.GetPosPixel().X() < 0 ) || ( rEvt.GetPosPixel().X() > aOutSize.Width() ) ||
+ ( rEvt.GetPosPixel().Y() < 0 ) || ( rEvt.GetPosPixel().Y() > aOutSize.Height() ) )
+ {
+ // Scrollen ?
+ }
+
+ // Nicht in Selektion droppen:
+ if ( IsInSelection( mpDDInfo->maDropPos ) )
+ {
+ ImpHideDDCursor();
+ return FALSE;
+ }
+
+ // Alten Cursor wegzeichnen...
+ if ( !mpDDInfo->mbVisCursor || ( aPrevDropPos != mpDDInfo->maDropPos ) )
+ {
+ ImpHideDDCursor();
+ ImpShowDDCursor();
+ }
+ bDrop = TRUE;
+ }
+ return bDrop;
+}
+
+BOOL TextView::Drop( const DropEvent& rEvt )
+{
+ BOOL bDone = FALSE;
+ if ( !mbReadOnly && mpDDInfo )
+ {
+ ImpHideDDCursor();
+
+ // Daten fuer das loeschen nach einem DROP_MOVE:
+ TextSelection aPrevSel( maSelection );
+ aPrevSel.Justify();
+ ULONG nPrevParaCount = mpTextEngine->GetParagraphCount();
+ USHORT nPrevStartParaLen = mpTextEngine->GetTextLen( aPrevSel.GetStart().GetPara() );
+
+ BOOL bStarterOfDD = FALSE;
+ for ( USHORT nView = mpTextEngine->GetViewCount(); nView && !bStarterOfDD; )
+ bStarterOfDD = mpTextEngine->GetView( --nView )->mpDDInfo ? mpTextEngine->GetView( nView )->mpDDInfo->mbStarterOfDD : FALSE;
+
+ HideSelection();
+ maSelection = mpDDInfo->maDropPos;
+
+ mpTextEngine->UndoActionStart( TEXTUNDO_DRAGANDDROP );
+
+ String aText = DragServer::PasteString( 0 );
+ aText.ConvertLineEnd( LINEEND_LF );
+
+ if ( aText.Len() && ( aText.GetChar( aText.Len()-1 ) == LINE_SEP ) )
+ aText.Erase( aText.Len()-1 );
+
+ if ( ImplCheckTextLen( aText ) )
+ maSelection = mpTextEngine->ImpInsertText( mpDDInfo->maDropPos, aText );
+
+ if ( aPrevSel.HasRange() &&
+ ( rEvt.GetAction() == DROP_MOVE ) || !bStarterOfDD )
+ {
+ // ggf. Selection anpasssen:
+ if ( ( mpDDInfo->maDropPos.GetPara() < aPrevSel.GetStart().GetPara() ) ||
+ ( ( mpDDInfo->maDropPos.GetPara() == aPrevSel.GetStart().GetPara() )
+ && ( mpDDInfo->maDropPos.GetIndex() < aPrevSel.GetStart().GetIndex() ) ) )
+ {
+ ULONG nNewParasBeforeSelection =
+ mpTextEngine->GetParagraphCount() - nPrevParaCount;
+
+ aPrevSel.GetStart().GetPara() += nNewParasBeforeSelection;
+ aPrevSel.GetEnd().GetPara() += nNewParasBeforeSelection;
+
+ if ( mpDDInfo->maDropPos.GetPara() == aPrevSel.GetStart().GetPara() )
+ {
+ USHORT nNewChars =
+ mpTextEngine->GetTextLen( aPrevSel.GetStart().GetPara() ) - nPrevStartParaLen;
+
+ aPrevSel.GetStart().GetIndex() += nNewChars;
+ if ( aPrevSel.GetStart().GetPara() == aPrevSel.GetEnd().GetPara() )
+ aPrevSel.GetEnd().GetIndex() += nNewChars;
+ }
+ }
+ else
+ {
+ // aktuelle Selektion anpassen
+ TextPaM aPaM = maSelection.GetStart();
+ aPaM.GetPara() -= ( aPrevSel.GetEnd().GetPara() - aPrevSel.GetStart().GetPara() );
+ if ( aPrevSel.GetEnd().GetPara() == mpDDInfo->maDropPos.GetPara() )
+ {
+ aPaM.GetIndex() -= aPrevSel.GetEnd().GetIndex();
+ if ( aPrevSel.GetStart().GetPara() == mpDDInfo->maDropPos.GetPara() )
+ aPaM.GetIndex() += aPrevSel.GetStart().GetIndex();
+ }
+ maSelection = aPaM;
+
+ }
+ mpTextEngine->ImpDeleteText( aPrevSel );
+ }
+
+ mpTextEngine->UndoActionEnd( TEXTUNDO_DRAGANDDROP );
+
+ delete mpDDInfo;
+ mpDDInfo = 0;
+
+ mpTextEngine->FormatAndUpdate( this );
+
+ mpTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
+ }
+
+ return bDone;
+}
+
+void TextView::SetPaintSelection( BOOL bPaint )
+{
+ if ( bPaint != mbPaintSelection )
+ {
+ mbPaintSelection = bPaint;
+ ShowSelection( maSelection );
+ }
+}
+
+void TextView::SetHighlightSelection( BOOL bSelectByHighlight )
+{
+ if ( bSelectByHighlight != mbHighlightSelection )
+ {
+ // Falls umschalten zwischendurch moeglich...
+ mbHighlightSelection = bSelectByHighlight;
+ }
+}
+
+BOOL TextView::Read( SvStream& rInput )
+{
+ BOOL bDone = mpTextEngine->Read( rInput, &maSelection );
+ ShowCursor();
+ return bDone;
+}
+
+BOOL TextView::Write( SvStream& rOutput )
+{
+ return mpTextEngine->Read( rOutput, &maSelection );
+}
+
+BOOL TextView::ImplCheckTextLen( const String& rNewText )
+{
+ BOOL bOK = TRUE;
+ if ( mpTextEngine->GetMaxTextLen() )
+ {
+ ULONG n = mpTextEngine->GetTextLen();
+ n += rNewText.Len();
+ if ( n > mpTextEngine->GetMaxTextLen() )
+ {
+ // nur dann noch ermitteln, wie viel Text geloescht wird
+ n -= mpTextEngine->GetTextLen( maSelection );
+ if ( n > mpTextEngine->GetMaxTextLen() )
+ {
+ // Beep hat hier eigentlich nichts verloren, sondern lieber ein Hdl,
+ // aber so funktioniert es wenigstens in ME, BasicIDE, SourceView
+ Sound::Beep();
+ bOK = FALSE;
+ }
+ }
+ }
+ return bOK;
+}
+
+
+ // -------------------------------------------------------------------------
+// (+) class TextSelFunctionSet
+// -------------------------------------------------------------------------
+TextSelFunctionSet::TextSelFunctionSet( TextView* pView )
+{
+ mpView = pView;
+}
+
+void __EXPORT TextSelFunctionSet::BeginDrag()
+{
+ mpView->BeginDrag();
+}
+
+void __EXPORT TextSelFunctionSet::CreateAnchor()
+{
+// TextSelection aSel( mpView->GetSelection() );
+// aSel.GetStart() = aSel.GetEnd();
+// mpView->SetSelection( aSel );
+
+ // Es darf kein ShowCursor folgen:
+ mpView->HideSelection();
+ mpView->maSelection.GetStart() = mpView->maSelection.GetEnd();
+}
+
+BOOL __EXPORT TextSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, BOOL )
+{
+ return mpView->SetCursorAtPoint( rPointPixel );
+}
+
+BOOL __EXPORT TextSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel )
+{
+ return mpView->IsSelectionAtPoint( rPointPixel );
+}
+
+void __EXPORT TextSelFunctionSet::DeselectAll()
+{
+ CreateAnchor();
+}
+
+void __EXPORT TextSelFunctionSet::DeselectAtPoint( const Point& )
+{
+ // Nur bei Mehrfachselektion
+}
+
+void __EXPORT TextSelFunctionSet::DestroyAnchor()
+{
+ // Nur bei Mehrfachselektion
+}
+
diff --git a/svtools/source/edit/txtattr.cxx b/svtools/source/edit/txtattr.cxx
new file mode 100644
index 000000000000..d88a4afa64bd
--- /dev/null
+++ b/svtools/source/edit/txtattr.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * $RCSfile: txtattr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <txtattr.hxx>
+#include <vcl/font.hxx>
+
+
+
+
+TextAttrib::~TextAttrib()
+{
+}
+
+void TextAttrib::SetFont( Font& ) const
+{
+}
+
+TextAttrib* TextAttrib::Clone() const
+{
+ return NULL;
+}
+
+int TextAttrib::operator==( const TextAttrib& rAttr ) const
+{
+ return mnWhich == rAttr.mnWhich;
+}
+
+
+TextAttribFontColor::TextAttribFontColor( const Color& rColor )
+ : TextAttrib( TEXTATTR_FONTCOLOR ), maColor( rColor )
+{
+}
+
+TextAttribFontColor::TextAttribFontColor( const TextAttribFontColor& rAttr )
+ : TextAttrib( rAttr ), maColor( rAttr.maColor )
+{
+}
+
+TextAttribFontColor::~TextAttribFontColor()
+{
+}
+
+void TextAttribFontColor::SetFont( Font& rFont ) const
+{
+ rFont.SetColor( maColor );
+}
+
+TextAttrib* TextAttribFontColor::Clone() const
+{
+ return new TextAttribFontColor( *this );
+}
+
+int TextAttribFontColor::operator==( const TextAttrib& rAttr ) const
+{
+ return ( ( TextAttrib::operator==(rAttr ) ) &&
+ ( maColor == ((const TextAttribFontColor&)rAttr).maColor ) );
+}
+
+
+TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL )
+ : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL )
+{
+ maColor = COL_BLUE;
+}
+
+TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription )
+ : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription )
+{
+ maColor = COL_BLUE;
+}
+
+TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr )
+ : TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription )
+{
+ maColor = rAttr.maColor;
+}
+
+TextAttribHyperLink::~TextAttribHyperLink()
+{
+}
+
+void TextAttribHyperLink::SetFont( Font& rFont ) const
+{
+ rFont.SetColor( maColor );
+ rFont.SetUnderline( UNDERLINE_SINGLE );
+}
+
+TextAttrib* TextAttribHyperLink::Clone() const
+{
+ return new TextAttribHyperLink( *this );
+}
+
+int TextAttribHyperLink::operator==( const TextAttrib& rAttr ) const
+{
+ return ( ( TextAttrib::operator==(rAttr ) ) &&
+ ( maURL == ((const TextAttribHyperLink&)rAttr).maURL ) &&
+ ( maDescription == ((const TextAttribHyperLink&)rAttr).maDescription ) &&
+ ( maColor == ((const TextAttribHyperLink&)rAttr).maColor ) );
+}
diff --git a/svtools/source/edit/xtextedt.cxx b/svtools/source/edit/xtextedt.cxx
new file mode 100644
index 000000000000..0203f0727f02
--- /dev/null
+++ b/svtools/source/edit/xtextedt.cxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * $RCSfile: xtextedt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <xtextedt.hxx>
+#include <txtcmp.hxx>
+#include <vcl/svapp.hxx> // International
+
+ // -------------------------------------------------------------------------
+// class ExtTextEngine
+// -------------------------------------------------------------------------
+ExtTextEngine::ExtTextEngine() : maGroupChars( String::CreateFromAscii( "(){}[]", 6 ) )
+{
+}
+
+ExtTextEngine::~ExtTextEngine()
+{
+}
+
+TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
+{
+ TextSelection aSel( rCursor );
+ USHORT nPos = rCursor.GetIndex();
+ ULONG nPara = rCursor.GetPara();
+ ULONG nParas = GetParagraphCount();
+ if ( ( nPara < nParas ) && ( nPos < GetTextLen( nPara ) ) )
+ {
+ USHORT nMatchChar = maGroupChars.Search( GetText( rCursor.GetPara() ).GetChar( nPos ) );
+ if ( nMatchChar != STRING_NOTFOUND )
+ {
+ if ( ( nMatchChar % 2 ) == 0 )
+ {
+ // Vorwaerts suchen...
+ sal_Unicode nSC = maGroupChars.GetChar( nMatchChar );
+ sal_Unicode nEC = maGroupChars.GetChar( nMatchChar+1 );
+
+ USHORT nCur = nPos+1;
+ USHORT nLevel = 1;
+ while ( nLevel && ( nPara < nParas ) )
+ {
+ XubString aStr = GetText( nPara );
+ while ( nCur < aStr.Len() )
+ {
+ if ( aStr.GetChar( nCur ) == nSC )
+ nLevel++;
+ else if ( aStr.GetChar( nCur ) == nEC )
+ {
+ nLevel--;
+ if ( !nLevel )
+ break; // while nCur...
+ }
+ nCur++;
+ }
+
+ if ( nLevel )
+ {
+ nPara++;
+ nCur = 0;
+ }
+ }
+ if ( nLevel == 0 ) // gefunden
+ {
+ aSel.GetStart() = rCursor;
+ aSel.GetEnd() = TextPaM( nPara, nCur+1 );
+ }
+ }
+ else
+ {
+ // Rueckwaerts suchen...
+ xub_Unicode nEC = maGroupChars.GetChar( nMatchChar );
+ xub_Unicode nSC = maGroupChars.GetChar( nMatchChar-1 );
+
+ USHORT nCur = rCursor.GetIndex()-1;
+ USHORT nLevel = 1;
+ while ( nLevel )
+ {
+ if ( GetTextLen( nPara ) )
+ {
+ XubString aStr = GetText( nPara );
+ while ( nCur )
+ {
+ if ( aStr.GetChar( nCur ) == nSC )
+ {
+ nLevel--;
+ if ( !nLevel )
+ break; // while nCur...
+ }
+ else if ( aStr.GetChar( nCur ) == nEC )
+ nLevel++;
+
+ nCur--;
+ }
+ }
+
+ if ( nLevel )
+ {
+ if ( nPara )
+ {
+ nPara--;
+ nCur = GetTextLen( nPara )-1; // egal ob negativ, weil if Len()
+ }
+ else
+ break;
+ }
+ }
+
+ if ( nLevel == 0 ) // gefunden
+ {
+ aSel.GetStart() = rCursor;
+ aSel.GetStart().GetIndex()++; // hinter das Zeichen
+ aSel.GetEnd() = TextPaM( nPara, nCur );
+ }
+ }
+ }
+ }
+ return aSel;
+}
+
+BOOL ExtTextEngine::Search( TextSelection& rSel, const SearchParam& rSearchParam, BOOL bForward )
+{
+ TextSelection aSel( rSel );
+ aSel.Justify();
+
+ TextPaM aStartPaM( aSel.GetEnd() );
+ if ( aSel.HasRange() && (
+ ( rSearchParam.IsSrchInSelection() && bForward ) ||
+ ( !rSearchParam.IsSrchInSelection() && !bForward ) ) )
+ {
+ aStartPaM = aSel.GetStart();
+ }
+
+ BOOL bFound = FALSE;
+ ULONG nStartNode, nEndNode;
+
+ if ( rSearchParam.IsSrchInSelection() )
+ nEndNode = bForward ? aSel.GetEnd().GetPara() : aSel.GetStart().GetPara();
+ else
+ nEndNode = bForward ? (GetParagraphCount()-1) : 0;
+
+ nStartNode = aStartPaM.GetPara();
+ SearchText aSearcher( rSearchParam, Application::GetAppInternational() );
+
+ // ueber die Absaetze iterieren...
+ for ( ULONG nNode = nStartNode;
+ bForward ? ( nNode <= nEndNode) : ( nNode >= nEndNode );
+ bForward ? nNode++ : nNode-- )
+ {
+ String aText = GetText( nNode );
+ USHORT nStartPos = 0;
+ USHORT nEndPos = aText.Len();
+ if ( nNode == nStartNode )
+ {
+ if ( bForward )
+ nStartPos = aStartPaM.GetIndex();
+ else
+ nEndPos = aStartPaM.GetIndex();
+ }
+ if ( ( nNode == nEndNode ) && rSearchParam.IsSrchInSelection() )
+ {
+ if ( bForward )
+ nEndPos = aSel.GetEnd().GetIndex();
+ else
+ nStartPos = aSel.GetStart().GetIndex();
+ }
+
+ if ( bForward )
+ bFound = aSearcher.SearchFrwrd( aText, &nStartPos, &nEndPos );
+ else
+ bFound = aSearcher.SearchBkwrd( aText, &nEndPos, &nStartPos );
+
+ if ( bFound )
+ {
+ rSel.GetStart().GetPara() = nNode;
+ rSel.GetStart().GetIndex() = nStartPos;
+ rSel.GetEnd().GetPara() = nNode;
+ rSel.GetEnd().GetIndex() = nEndPos;
+ // Ueber den Absatz selektieren?
+ if( nStartPos == (USHORT)(nEndPos+1) ) // USHORT fuer 0 und -1 !
+ {
+ if ( (rSel.GetEnd().GetPara()+1) < GetParagraphCount() )
+ {
+ rSel.GetEnd().GetPara()++;
+ rSel.GetEnd().GetIndex() = 0;
+ }
+ else
+ {
+ rSel.GetEnd().GetIndex() = nStartPos;
+ bFound = FALSE;
+ }
+ }
+ else if ( bForward && ( rSel.GetEnd().GetIndex() < aText.Len() ) )
+ rSel.GetEnd().GetIndex()++;
+ else if ( !bForward && ( rSel.GetStart().GetIndex() < aText.Len() ) )
+ rSel.GetStart().GetIndex()++;
+
+ break;
+ }
+
+ if ( !bForward && !nNode ) // Bei rueckwaertsuche, wenn nEndNode = 0:
+ break;
+ }
+
+ return bFound;
+}
+
+
+ // -------------------------------------------------------------------------
+// class ExtTextView
+// -------------------------------------------------------------------------
+ExtTextView::ExtTextView( ExtTextEngine* pEng, Window* pWindow )
+ : TextView( pEng, pWindow )
+{
+}
+
+ExtTextView::~ExtTextView()
+{
+}
+
+BOOL ExtTextView::MatchGroup()
+{
+ TextSelection aTmpSel( GetSelection() );
+ aTmpSel.Justify();
+ if ( ( aTmpSel.GetStart().GetPara() != aTmpSel.GetEnd().GetPara() ) ||
+ ( ( aTmpSel.GetEnd().GetIndex() - aTmpSel.GetStart().GetIndex() ) > 1 ) )
+ {
+ return FALSE;
+ }
+
+ TextSelection aMatchSel = ((ExtTextEngine*)GetTextEngine())->MatchGroup( aTmpSel.GetStart() );
+ if ( aMatchSel.HasRange() )
+ SetSelection( aMatchSel );
+
+ return aMatchSel.HasRange() ? TRUE : FALSE;
+}
+
+BOOL ExtTextView::Search( const SearchParam& rSearchParam, BOOL bForward )
+{
+ BOOL bFound = FALSE;
+ TextSelection aSel( GetSelection() );
+ if ( ((ExtTextEngine*)GetTextEngine())->Search( aSel, rSearchParam, bForward ) )
+ {
+ bFound = TRUE;
+ // Erstmal den Anfang des Wortes als Selektion einstellen,
+ // damit das ganze Wort in den sichtbaren Bereich kommt.
+ SetSelection( aSel.GetStart() );
+ ShowCursor( TRUE, FALSE );
+ }
+ else
+ {
+ aSel = GetSelection().GetEnd();
+ }
+
+ SetSelection( aSel );
+ ShowCursor();
+
+ return bFound;
+}
+
+USHORT ExtTextView::Replace( const SearchParam& rSearchParam, BOOL bAll, BOOL bForward )
+{
+ USHORT nFound = 0;
+
+ if ( !bAll )
+ {
+ if ( GetSelection().HasRange() )
+ {
+ InsertText( rSearchParam.GetReplaceStr() );
+ nFound = 1;
+ Search( rSearchParam, bForward ); // gleich zum naechsten
+ }
+ else
+ {
+ if( Search( rSearchParam, bForward ) )
+ nFound = 1;
+ }
+ }
+ else
+ {
+ // Der Writer ersetzt alle, vom Anfang bis Ende...
+
+ ExtTextEngine* pTextEngine = (ExtTextEngine*)GetTextEngine();
+
+ // HideSelection();
+ TextSelection aSel;
+ if ( rSearchParam.IsSrchInSelection() )
+ {
+ aSel = GetSelection();
+ aSel.Justify();
+ }
+
+ TextSelection aSearchSel( aSel );
+
+ BOOL bFound = pTextEngine->Search( aSel, rSearchParam, TRUE );
+ if ( bFound )
+ pTextEngine->UndoActionStart( XTEXTUNDO_REPLACEALL );
+ while ( bFound )
+ {
+ nFound++;
+
+ TextPaM aNewStart = pTextEngine->ImpInsertText( aSel, rSearchParam.GetReplaceStr() );
+ aSel = aSearchSel;
+ aSel.GetStart() = aNewStart;
+ bFound = pTextEngine->Search( aSel, rSearchParam, TRUE );
+ }
+ if ( nFound )
+ {
+ SetSelection( aSel.GetStart() );
+ pTextEngine->FormatAndUpdate( this );
+ pTextEngine->UndoActionEnd( XTEXTUNDO_REPLACEALL );
+ }
+ }
+ return nFound;
+}
+
+BOOL ExtTextView::ImpIndentBlock( BOOL bRight )
+{
+ BOOL bDone = FALSE;
+
+ TextSelection aSel = GetSelection();
+ aSel.Justify();
+
+ HideSelection();
+ GetTextEngine()->UndoActionStart( bRight ? XTEXTUNDO_INDENTBLOCK : XTEXTUNDO_UNINDENTBLOCK );
+
+ ULONG nStartPara = aSel.GetStart().GetPara();
+ ULONG nEndPara = aSel.GetEnd().GetPara();
+ BOOL bIndentAll = TRUE;
+ if ( aSel.HasRange() && !aSel.GetEnd().GetIndex() )
+ {
+ nEndPara--; // den dann nicht einruecken...
+ }
+
+ for ( ULONG nPara = nStartPara; nPara <= nEndPara; nPara++ )
+ {
+ if ( bRight )
+ {
+ // Tabs hinzufuegen
+ GetTextEngine()->ImpInsertText( TextPaM( nPara, 0 ), '\t' );
+ bDone = TRUE;
+ }
+ else
+ {
+ // Tabs/Blanks entfernen
+ String aText = GetTextEngine()->GetText( nPara );
+ if ( aText.Len() && (
+ ( aText.GetChar( 0 ) == '\t' ) ||
+ ( aText.GetChar( 0 ) == ' ' ) ) )
+ {
+ GetTextEngine()->ImpDeleteText( TextSelection( TextPaM( nPara, 0 ), TextPaM( nPara, 1 ) ) );
+ bDone = TRUE;
+ }
+ }
+ }
+
+ GetTextEngine()->UndoActionEnd( bRight ? XTEXTUNDO_INDENTBLOCK : XTEXTUNDO_UNINDENTBLOCK );
+
+ BOOL bRange = aSel.HasRange();
+ if ( bRight )
+ {
+ aSel.GetStart().GetIndex()++;
+ if ( bRange && ( aSel.GetEnd().GetPara() == nEndPara ) )
+ aSel.GetEnd().GetIndex()++;
+ }
+ else
+ {
+ if ( aSel.GetStart().GetIndex() )
+ aSel.GetStart().GetIndex()--;
+ if ( bRange && aSel.GetEnd().GetIndex() )
+ aSel.GetEnd().GetIndex()--;
+ }
+
+ maSelection = aSel;
+ GetTextEngine()->FormatAndUpdate( this );
+
+ return bDone;
+}
+
+BOOL ExtTextView::IndentBlock()
+{
+ return ImpIndentBlock( TRUE );
+}
+
+BOOL ExtTextView::UnindentBlock()
+{
+ return ImpIndentBlock( FALSE );
+}
+
diff --git a/svtools/source/filerec/filerec.cxx b/svtools/source/filerec/filerec.cxx
new file mode 100644
index 000000000000..075090e9b076
--- /dev/null
+++ b/svtools/source/filerec/filerec.cxx
@@ -0,0 +1,1039 @@
+/*************************************************************************
+ *
+ * $RCSfile: filerec.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "filerec.hxx"
+
+//========================================================================
+
+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 );
+ ULONG 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
+ ULONG nHeader;
+ *pStream >> nHeader;
+
+ // k"onnte es sich um einen extended-Record handeln?
+ USHORT nPreTag = 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 = 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 = 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;
+ *_pStream >> nHeader;
+ if ( !SetHeader_Impl( nHeader ) )
+ bRet = FALSE;
+ else
+ {
+ // eigenen Header einlesen
+ *_pStream >> nHeader;
+ _nRecordVer = SFX_REC_VER(nHeader);
+ _nRecordTag = SFX_REC_TAG(nHeader);
+
+ // falscher Record-Typ?
+ _nRecordType = 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
+ UINT32 nStartPos = pStream->Tell();
+ DBG( DbgOutf( "SfxFileRec: reading record at %ul", nStartPos ) );
+
+ // 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 = SFX_REC_TAG(nHeader);
+
+ // richtigen Record gefunden?
+ if ( _nRecordTag == nTag )
+ {
+ // gefundener Record-Typ passend?
+ _nRecordType = 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 nContentSize // 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 nContentSize // 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(__LITTLEENDIAN)
+ _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 << 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(__LITTLEENDIAN)
+ _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 )
+: _nContentNo(0), _pContentOfs( NULL )
+{
+ // 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!" );
+ if ( nNewPos > _pStream->Tell() )
+ _pStream->Seek( nNewPos );
+
+ // ggf. Content-Header lesen
+ if ( _nRecordType == SFX_REC_TYPE_MIXTAGS ||
+ _nRecordType == SFX_REC_TYPE_MIXTAGS_RELOC )
+ {
+ _nContentVer = 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
new file mode 100644
index 000000000000..d190b7dcf097
--- /dev/null
+++ b/svtools/source/filerec/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=filerec
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ filerec.cxx
+
+SLOFILES = \
+ $(SLO)$/filerec.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/source/filter.vcl/filter/dlgejpg.cxx b/svtools/source/filter.vcl/filter/dlgejpg.cxx
new file mode 100644
index 000000000000..3bd89b7f0c13
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgejpg.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgejpg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#pragma hdrstop
+
+#include "dlgejpg.hxx"
+#include "dlgejpg.hrc"
+#include "strings.hrc"
+
+#define KEY_QUALITY "JPG-EXPORT-QUALITY"
+#define KEY_GRAYSCALES "JPG_EXPORT_COLORMODE"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportEJPG::DlgExportEJPG( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_JPG, rPara.pResMgr ) ),
+ aFiDescr ( this, ResId( FI_DESCR ) ),
+ aNumFldQuality ( this, ResId( NUM_FLD_QUALITY ) ),
+ aGrpQuality ( this, ResId( GRP_QUALITY ) ),
+ aRbGray ( this, ResId( RB_GRAY ) ),
+ aRbRGB ( this, ResId( RB_RGB ) ),
+ aGrpColors ( this, ResId( GRP_COLORS ) ),
+ aBtnOK ( this, ResId( BTN_OK ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL ) ),
+ aBtnHelp ( this, ResId( BTN_HELP ) ),
+ pConfig ( rPara.pCfg ),
+ pMgr ( rPara.pResMgr )
+{
+ FreeResource();
+
+ // Config-Parameter lesen
+ ByteString aStr( pConfig->ReadKey( KEY_QUALITY ) );
+
+ if ( !aStr.Len() )
+ aNumFldQuality.SetValue( 75 );
+ else
+ aNumFldQuality.SetValue( aStr.ToInt32() );
+
+ if ( pConfig->ReadKey( KEY_GRAYSCALES ).ToInt32() )
+ aRbGray.Check( TRUE );
+ else
+ aRbRGB.Check( TRUE );
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportEJPG, OK ) );
+}
+
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportEJPG, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ pConfig->WriteKey( KEY_QUALITY, ByteString::CreateFromInt32( (long)aNumFldQuality.GetValue() ) );
+ pConfig->WriteKey( KEY_GRAYSCALES, ByteString::CreateFromInt32( (sal_Int32)aRbGray.IsChecked() ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+
+
diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc
new file mode 100644
index 000000000000..f93826427388
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgejpg.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "svtools.hrc"
+
+#define BTN_OK 1
+#define BTN_CANCEL 1
+#define BTN_HELP 1
+#define FI_DESCR 1
+#define NUM_FLD_QUALITY 1
+#define GRP_QUALITY 1
+#define GRP_COLORS 2
+#define RB_GRAY 1
+#define RB_RGB 2
+
+
diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hxx b/svtools/source/filter.vcl/filter/dlgejpg.hxx
new file mode 100644
index 000000000000..faddda9c262e
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgejpg.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgejpg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DLGEJPG_HXX_
+#define _DLGEJPG_HXX_
+
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/config.hxx>
+#include "stdctrl.hxx"
+#include <fltcall.hxx>
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen
+|*
+\************************************************************************/
+class DlgExportEJPG : public ModalDialog
+{
+private:
+ FixedInfo aFiDescr;
+ NumericField aNumFldQuality;
+ GroupBox aGrpQuality;
+ RadioButton aRbGray;
+ RadioButton aRbRGB;
+ GroupBox aGrpColors;
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ DECL_LINK( OK, void * );
+
+public:
+ DlgExportEJPG( FltCallDialogParameter& rDlgPara );
+};
+
+#endif // _DLGEJPG_HXX_
+
diff --git a/svtools/source/filter.vcl/filter/dlgejpg.src b/svtools/source/filter.vcl/filter/dlgejpg.src
new file mode 100644
index 000000000000..11cbffb37255
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgejpg.src
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgejpg.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "dlgejpg.hrc"
+ModalDialog DLG_EXPORT_JPG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 159 , 111 ) ;
+ Text = "JPEG Optionen" ;
+ Text [ ENGLISH ] = "JPEG Optionen" ;
+ Text [ english_us ] = "JPEG Options" ;
+ Text [ italian ] = "Opzioni JPEG" ;
+ Text [ spanish ] = "Opciones JPEG" ;
+ Text [ french ] = "Options JPEG" ;
+ Text [ dutch ] = "JPEG-opties" ;
+ Text [ swedish ] = "JPEG-alternativ" ;
+ Text [ danish ] = "JPEG-indstillinger" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 103 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 103 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 103 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ GroupBox GRP_QUALITY
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 90 , 55 ) ;
+ Text = "Qualität" ;
+ Text [ ENGLISH ] = "Quality" ;
+ Text [ english_us ] = "Quality" ;
+ Text [ italian ] = "Qualità" ;
+ Text [ spanish ] = "Calidad" ;
+ Text [ french ] = "Qualité" ;
+ Text [ dutch ] = "Kwaliteit" ;
+ Text [ swedish ] = "Kvalitet" ;
+ Text [ danish ] = "Kvalitet" ;
+ Text [ portuguese_brazilian ] = "Qualität" ;
+ Text [ portuguese ] = "Qualidade" ;
+ Text[ chinese_simplified ] = "ÖÊÁ¿";
+ Text[ russian ] = "Êà÷åñòâî";
+ Text[ polish ] = "JakoϾ";
+ Text[ japanese ] = "‰æ‘œ•iŽ¿";
+ Text[ chinese_traditional ] = "½è¶q";
+ Text[ arabic ] = "ÇáÌæÏÉ";
+ Text[ dutch ] = "Kwaliteit";
+ Text[ chinese_simplified ] = "ÖÊÁ¿";
+ Text[ greek ] = "Ðïéüôçôá";
+ Text[ korean ] = "È­Áú";
+ Text[ turkish ] = "Kalite";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FI_DESCR
+ {
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 81 , 21 ) ;
+ Text = "0: min. Qualität\n100: max. Qualität" ;
+ Text [ ENGLISH ] = "0: min. quality\n100: max. quality" ;
+ Text [ english_us ] = "0: min. Quality\n100: max. Quality" ;
+ Text [ italian ] = "Q: min. qualità\n100: max. qualità" ;
+ Text [ spanish ] = "0: mín. calidad\n100: máx. calidad" ;
+ Text [ french ] = "0: qualité min.\n100: qualité max." ;
+ Text [ dutch ] = "0: min. kwaliteit\n100: max. kwaliteit" ;
+ Text [ swedish ] = "0: min. kvalitet\n100: max. kvalitet" ;
+ Text [ danish ] = "0: min. kvalitet\n100: maks. kvalitet" ;
+ Text [ portuguese_brazilian ] = "0: min. Qualidade\n100: max. Qualidade" ;
+ Text [ portuguese ] = "0: min. Qualidade\n100: max. Qualidade" ;
+ Text[ chinese_simplified ] = "0: ×î²î \n100: ×î¼Ñ¡¡";
+ Text[ russian ] = "0: íèçêîå êà÷åñòâî\n100: âûñîêîå êà÷åñòâî";
+ Text[ polish ] = "0: min. jakoϾ\n100: max. jakoϾ";
+ Text[ japanese ] = "0: Å’á\n100: Å‚";
+ Text[ chinese_traditional ] = "0: ³Ì®t \n100: ³Ì¨Î¡@";
+ Text[ arabic ] = "0: ÇáÍÏ ÇáÃÏäì ááÌæÏÉ\n100: ÇáÍÏ ÇáÃÞÕì ááÌæÏÉ";
+ Text[ dutch ] = "0: min. kwaliteit\n100: max. kwaliteit";
+ Text[ chinese_simplified ] = "0: ×î²î \n100: ×î¼Ñ¡¡";
+ Text[ greek ] = "0: åëÜ÷éóôç ðïéüôçôá\n100: ìÝãéóôç ðïéüôçôá";
+ Text[ korean ] = "0: ÃÖ¼Ò ¼º´É\n100: ÃÖ´ë ¼º´É";
+ Text[ turkish ] = "0: asg. kalite\n100: azm. kalite";
+ Text[ language_user1 ] = " ";
+ };
+ NumericField NUM_FLD_QUALITY
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ StrictFormat = TRUE ;
+ Last = 100 ;
+ Repeat = TRUE ;
+ };
+ GroupBox GRP_COLORS
+ {
+ Pos = MAP_APPFONT ( 6 , 61 ) ;
+ Size = MAP_APPFONT ( 90 , 44 ) ;
+ Text = "Farbauflösung" ;
+ Text [ ENGLISH ] = "Color resolution" ;
+ Text [ english_us ] = "Color resolution" ;
+ Text [ portuguese_brazilian ] = "Farbauflösung" ;
+ Text [ swedish ] = "Färgupplösning" ;
+ Text [ danish ] = "Farveopløsning" ;
+ Text [ italian ] = "Profondità cromatica" ;
+ Text [ spanish ] = "Resolución del color" ;
+ Text [ french ] = "Résolution couleur" ;
+ Text [ dutch ] = "Kleurdichtheid" ;
+ Text [ portuguese ] = "Resolução de cores" ;
+ Text[ chinese_simplified ] = "ÑÕÉ«·Ö±æÂÊ";
+ Text[ russian ] = "Öâåòîâîå ðàçðåøåíèå";
+ Text[ polish ] = "Rozdzielczoœæ kolorów";
+ Text[ japanese ] = "F‚̉𑜓x";
+ Text[ chinese_traditional ] = "ÃC¦â¸ÑªR«×";
+ Text[ arabic ] = "ÇÓÊÈÇäÉ Çááæä";
+ Text[ dutch ] = "Kleurdichtheid";
+ Text[ chinese_simplified ] = "ÑÕÉ«·Ö±æÂÊ";
+ Text[ greek ] = "ÁíÜëõóç ÷ñùìÜôùí";
+ Text[ korean ] = "Ä÷¯ ÇØ»óµµ";
+ Text[ turkish ] = "Renk çözünürlüðü";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_GRAY
+ {
+ Pos = MAP_APPFONT ( 12 , 72 ) ;
+ Size = MAP_APPFONT ( 81 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "Graustufen" ;
+ Text [ ENGLISH ] = "Grayscales" ;
+ Text [ english_us ] = "Grayscale" ;
+ Text [ portuguese ] = "Tons de cinzento" ;
+ Text [ portuguese_brazilian ] = "Graustufen" ;
+ Text [ swedish ] = "Gråskalor" ;
+ Text [ danish ] = "Gråtoner" ;
+ Text [ italian ] = "Toni di grigio" ;
+ Text [ spanish ] = "Escala de grises" ;
+ Text [ french ] = "Niveaux de gris" ;
+ Text [ dutch ] = "Grijswaarden" ;
+ Text[ chinese_simplified ] = "»Ò¶È";
+ Text[ russian ] = "Îòòåíêè ñåðîãî";
+ Text[ polish ] = "Odcienie szaroœci";
+ Text[ japanese ] = "¸ÞÚ°½¹°Ù";
+ Text[ chinese_traditional ] = "¦Ç«×";
+ Text[ arabic ] = "ÏÑÌÇÊ ÇáÑãÇÏí";
+ Text[ dutch ] = "Grijswaarden";
+ Text[ chinese_simplified ] = "»Ò¶È";
+ Text[ greek ] = "ÄéáâÜèìéóç ôïõ ãêñé";
+ Text[ korean ] = "ȸ»öÁ¶";
+ Text[ turkish ] = "Gri tonlama";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_RGB
+ {
+ Pos = MAP_APPFONT ( 12 , 87 ) ;
+ Size = MAP_APPFONT ( 81 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "Echtfarben" ;
+ Text [ ENGLISH ] = "TrueColors" ;
+ Text [ english_us ] = "True Colors" ;
+ Text [ portuguese ] = "Cores reais" ;
+ Text [ portuguese_brazilian ] = "Echtfarben" ;
+ Text [ swedish ] = "True Colors" ;
+ Text [ danish ] = "Ægte farver" ;
+ Text [ italian ] = "Colori reali" ;
+ Text [ spanish ] = "Colores reales" ;
+ Text [ french ] = "Vraies couleurs (Truecolor)" ;
+ Text [ dutch ] = "Echte kleuren" ;
+ Text[ chinese_simplified ] = "·ÂÕæÉ«";
+ Text[ russian ] = "Íàòóðàëüíûå öâåòà";
+ Text[ polish ] = "Trwa³e kolory";
+ Text[ japanese ] = "‘NÊF";
+ Text[ chinese_traditional ] = "¥þ±m";
+ Text[ arabic ] = "ÃáæÇä ÍÞíÞíÉ";
+ Text[ dutch ] = "Echte kleuren";
+ Text[ chinese_simplified ] = "·ÂÕæÉ«";
+ Text[ greek ] = "ÖõóéêÜ ÷ñþìáôá";
+ Text[ korean ] = "Æ®·ç Ä÷¯";
+ Text[ turkish ] = "Gerçek renkler";
+ Text[ language_user1 ] = " ";
+ };
+ Text [ portuguese_brazilian ] = "JPEG Optionen" ;
+ Text [ portuguese ] = "Opções JPEG" ;
+ Text[ chinese_simplified ] = "JPEG Ñ¡Ïî";
+ Text[ russian ] = "Ïàðàìåòðû JPEG";
+ Text[ polish ] = "Opcje JPEG";
+ Text[ japanese ] = "JPEG µÌß¼®Ý";
+ Text[ chinese_traditional ] = "JPEG ¿ï¶µ";
+ Text[ arabic ] = "ÎíÇÑÇÊJPEG ";
+ Text[ dutch ] = "JPEG-opties";
+ Text[ chinese_simplified ] = "JPEG Ñ¡Ïî";
+ Text[ greek ] = "ÅðéëïãÝò JPEG";
+ Text[ korean ] = "JPEG ¿É¼Ç";
+ Text[ turkish ] = "JPEG seçenekleri";
+ Text[ language_user1 ] = " ";
+};
diff --git a/svtools/source/filter.vcl/filter/dlgexpor.cxx b/svtools/source/filter.vcl/filter/dlgexpor.cxx
new file mode 100644
index 000000000000..1f53a52914db
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgexpor.cxx
@@ -0,0 +1,517 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgexpor.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <tools/ref.hxx>
+#include <vcl/config.hxx>
+#include <vcl/msgbox.hxx>
+#include "dlgexpor.hxx"
+#include "dlgexpor.hrc"
+#include "strings.hrc"
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportPix::DlgExportPix( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_PIX, rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK_PIX ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL_PIX ) ),
+ aBtnHelp ( this, ResId( BTN_HELP_PIX ) ),
+ aGrpMode ( this, ResId( GRP_MODE_PIX ) ),
+ aCbbRes ( this, ResId( CBB_RES_PIX ) ),
+ aRbOriginal ( this, ResId( RB_ORIGINAL_PIX ) ),
+ aRbRes ( this, ResId( RB_RES_PIX ) ),
+ aRbSize ( this, ResId( RB_SIZE_PIX ) ),
+ aFtSizeX ( this, ResId( FT_SIZEX_PIX ) ),
+ aMtfSizeX ( this, ResId( MTF_SIZEX_PIX ) ),
+ aFtSizeY ( this, ResId( FT_SIZEY_PIX ) ),
+ aMtfSizeY ( this, ResId( MTF_SIZEY_PIX ) ),
+ aGrpColors ( this, ResId( GRP_COLORS ) ),
+ aLbColors ( this, ResId( LB_COLORS ) ),
+ aCbxRLE ( this, ResId( CBX_RLE ) ),
+ pConfig ( rPara.pCfg ),
+ pMgr ( rPara.pResMgr ),
+ rExt ( rPara.aFilterExt )
+
+{
+ String aTitle( rExt );
+
+ FreeResource();
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportPix, OK ) );
+ aRbOriginal.SetClickHdl( LINK( this, DlgExportPix, ClickRbOriginal ) );
+ aRbRes.SetClickHdl( LINK( this, DlgExportPix, ClickRbRes ) );
+ aRbSize.SetClickHdl( LINK( this, DlgExportPix, ClickRbSize ) );
+ aLbColors.SetSelectHdl( LINK( this, DlgExportPix, SelectLbColors ) );
+
+ aTitle.ToUpperAscii();
+ aTitle += String( ResId( EXPORT_DIALOG_TITLE, pMgr ) );
+ SetText( aTitle );
+
+
+ // Config-Parameter lesen
+ ByteString aStrColors( rExt, RTL_TEXTENCODING_UTF8 );
+ aStrColors.Append( ByteString( String( ResId( KEY_COLORS, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrColors = pConfig->ReadKey( aStrColors );
+ ByteString aStrMode( rExt, RTL_TEXTENCODING_UTF8 );
+ aStrMode.Append( ByteString( String( ResId( KEY_MODE, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrMode = pConfig->ReadKey( aStrMode );
+ ByteString aStrRes( rExt, RTL_TEXTENCODING_UTF8 );
+ aStrRes.Append( ByteString( String( ResId( KEY_RES, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrRes = pConfig->ReadKey( aStrRes );
+ ByteString aStrSizeX( rExt, RTL_TEXTENCODING_UTF8 );
+ aStrSizeX.Append( ByteString( String( ResId( KEY_SIZEX, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrSizeX = pConfig->ReadKey( aStrSizeX );
+ ByteString aStrSizeY( rExt, RTL_TEXTENCODING_UTF8 );
+ aStrSizeY.Append( ByteString( String( ResId( KEY_SIZEY, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrSizeY = pConfig->ReadKey( aStrSizeY );
+ ByteString aStrRLE( rExt, RTL_TEXTENCODING_UTF8 );
+ aStrRLE.Append( ByteString( String( ResId( KEY_RLE_CODING, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrRLE = pConfig->ReadKey( aStrRLE );
+
+ aLbColors.SelectEntryPos( Min( (USHORT) 7, (USHORT)aStrColors.ToInt32() ) );
+ aCbxRLE.Check( aStrRLE.CompareIgnoreCaseToAscii( "false", 5 ) == COMPARE_EQUAL );
+
+ if ( !aStrRes.Len() )
+ aStrRes = 75;
+
+ aStrRes += " DPI";
+ aCbbRes.SetText( UniString( aStrRes, RTL_TEXTENCODING_UTF8 ) );
+
+ aMtfSizeX.SetDefaultUnit( FUNIT_MM );
+ aMtfSizeY.SetDefaultUnit( FUNIT_MM );
+
+ if ( !aStrSizeX.Len() )
+ aMtfSizeX.SetValue( 10000 );
+ else
+ aMtfSizeX.SetValue( aStrSizeX.ToInt32() );
+
+ if ( !aStrSizeY.Len() )
+ aMtfSizeY.SetValue( 10000 );
+ else
+ aMtfSizeY.SetValue( aStrSizeY.ToInt32() );
+
+ switch ( rPara.eFieldUnit )
+ {
+// case FUNIT_NONE :
+// case FUNIT_KM :
+// case FUNIT_PERCENT :
+// case FUNIT_CUSTOM :
+// case FUNIT_MILE :
+// case FUNIT_FOOT :
+// case FUNIT_M :
+ case FUNIT_MM :
+ case FUNIT_CM :
+ case FUNIT_TWIP :
+ case FUNIT_POINT :
+ case FUNIT_PICA :
+ case FUNIT_INCH :
+ case FUNIT_100TH_MM :
+ {
+ aMtfSizeX.SetUnit( rPara.eFieldUnit );
+ aMtfSizeY.SetUnit( rPara.eFieldUnit );
+ }
+ break;
+ }
+
+ switch ( aStrMode.ToInt32() )
+ {
+ case 2 :
+ {
+ aRbSize.Check( TRUE );
+ ClickRbSize( NULL );
+ }
+ break;
+ case 1 :
+ {
+ aRbRes.Check( TRUE );
+ ClickRbRes( NULL );
+ }
+ break;
+ default :
+ {
+ aRbOriginal.Check( TRUE );
+ ClickRbOriginal( NULL );
+ }
+ break;
+ }
+ SelectLbColors( &aLbColors );
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportPix, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+
+ ByteString aStrMode;
+ ByteString aRLEStr;
+
+ long nRes = Max( Min( aCbbRes.GetText().ToInt32(), 600L), 75L );
+ long nSizeX = (long)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM );
+ long nSizeY = (long)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM );
+
+ if ( aRbRes.IsChecked() )
+ aStrMode = '1';
+ else if ( aRbSize.IsChecked() )
+ aStrMode = '2';
+ else
+ aStrMode = '0';
+
+ if ( aCbxRLE.IsChecked() )
+ aRLEStr = ByteString( "TRUE", 4 );
+ else
+ aRLEStr = ByteString( "FALSE", 5 );
+
+ ByteString aExt0( rExt, RTL_TEXTENCODING_UTF8 );
+ aExt0.Append( ByteString( String( ResId( KEY_MODE, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aExt0, aStrMode );
+
+ ByteString aExt1( rExt, RTL_TEXTENCODING_UTF8 );
+ aExt1.Append( ByteString( String( ResId( KEY_RES, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aExt1, ByteString::CreateFromInt32( nRes ) );
+
+ ByteString aExt2( rExt, RTL_TEXTENCODING_UTF8 );
+ aExt2.Append( ByteString( String( ResId( KEY_SIZEX, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aExt2, ByteString::CreateFromInt32( nSizeX ) );
+
+ ByteString aExt3( rExt, RTL_TEXTENCODING_UTF8 );
+ aExt3.Append( ByteString( String( ResId( KEY_SIZEY, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aExt3, ByteString::CreateFromInt32( nSizeY ) );
+
+ ByteString aExt4( rExt, RTL_TEXTENCODING_UTF8 );
+ aExt4.Append( ByteString( String( ResId( KEY_COLORS, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aExt4, ByteString::CreateFromInt32( (sal_Int32)aLbColors.GetSelectEntryPos() ) );
+
+ ByteString aExt5( rExt, RTL_TEXTENCODING_UTF8 );
+ aExt5.Append( ByteString( String( ResId( KEY_RLE_CODING, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aExt5, ByteString::CreateFromInt32( (sal_Int32)aLbColors.GetSelectEntryPos() ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportPix, ClickRbOriginal, void*, EMPTYARG )
+{
+ aCbbRes.Disable();
+
+ aFtSizeX.Disable();
+ aMtfSizeX.Disable();
+ aFtSizeY.Disable();
+ aMtfSizeY.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportPix, ClickRbRes, void*, EMPTYARG )
+{
+ aCbbRes.Enable();
+
+ aFtSizeX.Disable();
+ aMtfSizeX.Disable();
+ aFtSizeY.Disable();
+ aMtfSizeY.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportPix, ClickRbSize, void*, EMPTYARG )
+{
+ aFtSizeX.Enable();
+ aMtfSizeX.Enable();
+ aFtSizeY.Enable();
+ aMtfSizeY.Enable();
+
+ aCbbRes.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportPix, SelectLbColors, void*, EMPTYARG )
+{
+ const USHORT nLbPos = aLbColors.GetSelectEntryPos();
+
+ if ( ( nLbPos >= 3 ) && ( nLbPos <= 6 ) )
+ aCbxRLE.Enable();
+ else
+ aCbxRLE.Disable();
+
+ return 0L;
+}
+
+
+/******************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Ctor
+|*
+\************************************************************************/
+
+DlgExportVec::DlgExportVec( FltCallDialogParameter& rPara ) :
+ ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_VEC, rPara.pResMgr ) ),
+ aBtnOK ( this, ResId( BTN_OK_VEC ) ),
+ aBtnCancel ( this, ResId( BTN_CANCEL_VEC ) ),
+ aBtnHelp ( this, ResId( BTN_HELP_VEC ) ),
+ aRbOriginal ( this, ResId( RB_ORIGINAL_VEC ) ),
+ aRbSize ( this, ResId( RB_SIZE_VEC ) ),
+ aGrpMode ( this, ResId( GRP_MODE_VEC ) ),
+ aFtSizeX ( this, ResId( FT_SIZEX_VEC ) ),
+ aMtfSizeX ( this, ResId( MTF_SIZEX_VEC ) ),
+ aFtSizeY ( this, ResId( FT_SIZEY_VEC ) ),
+ aMtfSizeY ( this, ResId( MTF_SIZEY_VEC ) ),
+ aGrpSize ( this, ResId( GRP_SIZE_VEC ) ),
+ pConfig ( rPara.pCfg ),
+ pMgr ( rPara.pResMgr ),
+ rExt ( rPara.aFilterExt )
+
+{
+ String aTitle( rExt );
+
+ FreeResource();
+
+ aBtnOK.SetClickHdl( LINK( this, DlgExportVec, OK ) );
+ aRbOriginal.SetClickHdl( LINK( this, DlgExportVec, ClickRbOriginal ) );
+ aRbSize.SetClickHdl( LINK( this, DlgExportVec, ClickRbSize ) );
+
+ aTitle.ToUpperAscii();
+ aTitle += String( ResId( EXPORT_DIALOG_TITLE, pMgr ) );
+ SetText( aTitle );
+
+ // Config-Parameter lesen
+ // String aStrMode = pConfig->ReadKey( rExt + String( ResId( KEY_MODE, pMgr ) ) );
+ ByteString aExt( rExt, RTL_TEXTENCODING_UTF8 );
+ ByteString aStrMode( aExt );
+ aStrMode.Append( ByteString( String( ResId( KEY_MODE, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrMode = pConfig->ReadKey( aStrMode );
+
+ ByteString aStrSizeX( aExt );
+ aStrSizeX.Append( ByteString( String( ResId( KEY_SIZEX, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrSizeX = pConfig->ReadKey( aStrSizeX );
+
+ ByteString aStrSizeY( aExt );
+ aStrSizeY.Append( ByteString( String( ResId( KEY_SIZEY, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStrSizeY = pConfig->ReadKey( aStrSizeY );
+
+ aMtfSizeX.SetDefaultUnit( FUNIT_MM );
+ aMtfSizeY.SetDefaultUnit( FUNIT_MM );
+
+ if ( !aStrSizeX.Len() )
+ aMtfSizeX.SetValue( 10000 );
+ else
+ aMtfSizeX.SetValue( aStrSizeX.ToInt32() );
+
+ if ( !aStrSizeY.Len() )
+ aMtfSizeY.SetValue( 10000 );
+ else
+ aMtfSizeY.SetValue( aStrSizeY.ToInt32() );
+
+ switch ( rPara.eFieldUnit )
+ {
+// case FUNIT_NONE :
+// case FUNIT_KM :
+// case FUNIT_PERCENT :
+// case FUNIT_CUSTOM :
+// case FUNIT_MILE :
+// case FUNIT_FOOT :
+ case FUNIT_MM :
+ case FUNIT_CM :
+ case FUNIT_M :
+ case FUNIT_TWIP :
+ case FUNIT_POINT :
+ case FUNIT_PICA :
+ case FUNIT_INCH :
+ case FUNIT_100TH_MM :
+ {
+ aMtfSizeX.SetUnit( rPara.eFieldUnit );
+ aMtfSizeY.SetUnit( rPara.eFieldUnit );
+ }
+ break;
+ }
+
+ switch ( aStrMode.ToInt32() )
+ {
+ case 1 :
+ {
+ aRbSize.Check( TRUE );
+ ClickRbSize( NULL );
+ }
+ break;
+
+ default :
+ {
+ aRbOriginal.Check( TRUE );
+ ClickRbOriginal( NULL );
+ }
+ break;
+ }
+}
+
+/*************************************************************************
+|*
+|* Speichert eingestellte Werte in ini-Datei
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportVec, OK, void *, EMPTYARG )
+{
+ // Config-Parameter schreiben
+ long nSizeX = (long)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM );
+ long nSizeY = (long)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM );
+
+ ByteString aStrMode;
+ if ( aRbSize.IsChecked() )
+ aStrMode = '1';
+ else
+ aStrMode = '0';
+
+ ByteString aExt( rExt, RTL_TEXTENCODING_UTF8 );
+ ByteString aDest( aExt );
+ aDest.Append( ByteString( String( ResId( KEY_MODE, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aDest, aStrMode );
+
+ aDest = aExt;
+ aDest.Append( ByteString( String( ResId( KEY_SIZEX, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aDest, ByteString::CreateFromInt32( nSizeX ) );
+
+ aDest = aExt;
+ aDest.Append( ByteString( String( ResId( KEY_SIZEY, pMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ pConfig->WriteKey( aDest, ByteString::CreateFromInt32( nSizeY ) );
+
+ EndDialog( RET_OK );
+
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportVec, ClickRbOriginal, void*, EMPTYARG )
+{
+ aGrpSize.Disable();
+ aFtSizeX.Disable();
+ aMtfSizeX.Disable();
+ aFtSizeY.Disable();
+ aMtfSizeY.Disable();
+
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Enabled/Disabled Controls
+|*
+\************************************************************************/
+
+IMPL_LINK( DlgExportVec, ClickRbSize, void*, EMPTYARG )
+{
+ aGrpSize.Enable();
+ aFtSizeX.Enable();
+ aMtfSizeX.Enable();
+ aFtSizeY.Enable();
+ aMtfSizeY.Enable();
+
+ return 0;
+}
+
+
+
diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc
new file mode 100644
index 000000000000..cf35e9785666
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgexpor.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <svtools.hrc>
+
+#define BTN_OK_PIX 1
+#define BTN_CANCEL_PIX 1
+#define BTN_HELP_PIX 1
+#define CBX_RES_PIX 1
+#define CBX_SIZE_PIX 2
+#define CBX_RLE 3
+#define CBB_RES_PIX 1
+#define LB_COLORS 1
+#define MTF_SIZEX_PIX 1
+#define MTF_SIZEY_PIX 2
+#define FT_SIZEX_PIX 1
+#define FT_SIZEY_PIX 2
+#define GRP_MODE_PIX 1
+#define GRP_COLORS 4
+#define RB_ORIGINAL_PIX 1
+#define RB_RES_PIX 2
+#define RB_SIZE_PIX 3
+
+#define BTN_OK_VEC 1
+#define BTN_CANCEL_VEC 1
+#define BTN_HELP_VEC 1
+#define CBX_SIZE_VEC 2
+#define MTF_SIZEX_VEC 1
+#define MTF_SIZEY_VEC 2
+#define FT_SIZEX_VEC 1
+#define FT_SIZEY_VEC 2
+#define GRP_SIZE_VEC 1
+#define GRP_MODE_VEC 2
+#define RB_ORIGINAL_VEC 1
+#define RB_SIZE_VEC 2
diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hxx b/svtools/source/filter.vcl/filter/dlgexpor.hxx
new file mode 100644
index 000000000000..2b1e59922d6b
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgexpor.hxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgexpor.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DLGEXPOR_HXX_
+#define _DLGEXPOR_HXX_
+
+#include "fltcall.hxx"
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <vcl/group.hxx>
+#include <vcl/lstbox.hxx>
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen bei Pixelformaten
+|*
+\************************************************************************/
+class DlgExportPix : public ModalDialog
+{
+private:
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ ListBox aLbColors;
+ CheckBox aCbxRLE;
+ GroupBox aGrpColors;
+
+ RadioButton aRbOriginal;
+ RadioButton aRbRes;
+ RadioButton aRbSize;
+ FixedText aFtSizeX;
+ MetricField aMtfSizeX;
+ FixedText aFtSizeY;
+ MetricField aMtfSizeY;
+ GroupBox aGrpMode;
+ ComboBox aCbbRes;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ const String& rExt;
+
+ DECL_LINK( OK, void* p );
+ DECL_LINK( ClickRbOriginal,void* p );
+ DECL_LINK( ClickRbRes,void* p );
+ DECL_LINK( ClickRbSize,void* p );
+ DECL_LINK( SelectLbColors, void* p );
+
+public:
+ DlgExportPix( FltCallDialogParameter& rPara );
+};
+
+
+/*************************************************************************
+|*
+|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten
+|*
+\************************************************************************/
+class DlgExportVec : public ModalDialog
+{
+private:
+ OKButton aBtnOK;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+
+ RadioButton aRbOriginal;
+ RadioButton aRbSize;
+ GroupBox aGrpMode;
+
+ FixedText aFtSizeX;
+ MetricField aMtfSizeX;
+ FixedText aFtSizeY;
+ MetricField aMtfSizeY;
+ GroupBox aGrpSize;
+
+ Config* pConfig;
+ ResMgr* pMgr;
+
+ const String& rExt;
+
+ DECL_LINK( OK, void* p );
+ DECL_LINK( ClickRbOriginal,void* p );
+ DECL_LINK( ClickRbSize,void* p );
+
+public:
+ DlgExportVec( FltCallDialogParameter& rPara );
+};
+
+#endif // _DLGEXPOR_HXX_
+
diff --git a/svtools/source/filter.vcl/filter/dlgexpor.src b/svtools/source/filter.vcl/filter/dlgexpor.src
new file mode 100644
index 000000000000..d983cecc51dd
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/dlgexpor.src
@@ -0,0 +1,809 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgexpor.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include "dlgexpor.hrc"
+
+ModalDialog DLG_EXPORT_PIX
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 178 , 144 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ GroupBox GRP_COLORS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 110 , 45 ) ;
+ Text = "Farbauflösung" ;
+ Text [ ENGLISH ] = "Color resolution" ;
+ Text [ english_us ] = "Color resolution" ;
+ Text [ portuguese ] = "Resolução de cores" ;
+ Text [ portuguese_brazilian ] = "Farbauflösung" ;
+ Text [ swedish ] = "Färgupplösning" ;
+ Text [ danish ] = "Farveopløsning" ;
+ Text [ italian ] = "Profondità cromatica" ;
+ Text [ spanish ] = "Resolución del color" ;
+ Text [ french ] = "Résolution couleur" ;
+ Text [ dutch ] = "Kleurdichtheid" ;
+ Text[ chinese_simplified ] = "ÑÕÉ«·Ö±æÂÊ";
+ Text[ russian ] = "Öâåòîâîå ðàçðåøåíèå";
+ Text[ polish ] = "Rozdzielczoœæ kolorów";
+ Text[ japanese ] = "F‚̉𑜓x";
+ Text[ chinese_traditional ] = "ÃC¦â¸ÑªR«×";
+ Text[ arabic ] = "ÇÓÊÈÇäÉ Çááæä";
+ Text[ greek ] = "ÁíÜëõóç ÷ñùìÜôùí";
+ Text[ korean ] = "Ä÷¯ ÇØ»óµµ";
+ Text[ turkish ] = "Renk çözünürlüðü";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_COLORS
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 98 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ StringList =
+ {
+ < "Original" ; Default ; > ;
+ < "1Bit - Schwellenwert" ; Default ; > ;
+ < "1Bit - Gedithert" ; Default ; > ;
+ < "4Bit - Graustufenpalette" ; Default ; > ;
+ < "4Bit - Farbpalette" ; Default ; > ;
+ < "8Bit - Graustufenpalette" ; Default ; > ;
+ < "8Bit - Farbpalette" ; Default ; > ;
+ < "24Bit - Echtfarben" ; Default ; > ;
+ };
+ StringList [ ENGLISH ] =
+ {
+ < "Original" ; Default ; > ;
+ < "1Bit - Schwellenwert" ; Default ; > ;
+ < "1Bit - Gedithert" ; Default ; > ;
+ < "4Bit - Graustufenpalette" ; Default ; > ;
+ < "4Bit - Farbpalette" ; Default ; > ;
+ < "8Bit - Graustufenpalette" ; Default ; > ;
+ < "8Bit - Farbpalette" ; Default ; > ;
+ < "24Bit - Echtfarben" ; Default ; > ;
+ };
+ StringList [ english_us ] =
+ {
+ < "Original" ; Default ; > ;
+ < "1 Bit - Threshold Value" ; Default ; > ;
+ < "1 Bit - Dithering" ; Default ; > ;
+ < "4 Bit - Grayscale" ; Default ; > ;
+ < "4 Bit - Color Palette" ; Default ; > ;
+ < "8 Bit - Grayscales" ; Default ; > ;
+ < "8 Bit - Color Palette" ; Default ; > ;
+ < "24 Bit - True Colors" ; Default ; > ;
+ };
+ stringlist [ portuguese ] =
+ {
+ < "Original" ; Default ; > ;
+ < "Valor limite - 1 bit" ; Default ; > ;
+ < "Sombreado - 1 bit" ; Default ; > ;
+ < "Paleta de tons cinzentos de 4 bits" ; Default ; > ;
+ < "Paleta de cores de 4 bits" ; Default ; > ;
+ < "Paleta de tons cinzentos de 8 bits" ; Default ; > ;
+ < "Paleta de cores de 8 bits" ; Default ; > ;
+ < "Cores reais de 24 bits" ; Default ; > ;
+ };
+ stringlist [ portuguese_brazilian ] =
+ {
+ < "Original" ; Default ; > ;
+ < "1Bit - Schwellenwert" ; Default ; > ;
+ < "1Bit - Gedithert" ; Default ; > ;
+ < "4Bit - Graustufenpalette" ; Default ; > ;
+ < "4Bit - Farbpalette" ; Default ; > ;
+ < "8Bit - Graustufenpalette" ; Default ; > ;
+ < "8Bit - Farbpalette" ; Default ; > ;
+ < "24Bit - Echtfarben" ; Default ; > ;
+ };
+ stringlist [ swedish ] =
+ {
+ < "Original" ; Default ; > ;
+ < "1bit-tröskelvärde" ; Default ; > ;
+ < "1bit-ditrering" ; Default ; > ;
+ < "4bit-gråskalepalett" ; Default ; > ;
+ < "4bit-färgpalett" ; Default ; > ;
+ < "8Bit - gråskalepalett" ; Default ; > ;
+ < "8Bit - färgpalett" ; Default ; > ;
+ < "24bit - True Colors" ; Default ; > ;
+ };
+ stringlist [ danish ] =
+ {
+ < "Original" ; Default ; > ;
+ < "1bit - tærskelværdi" ; Default ; > ;
+ < "1bit - dithering" ; Default ; > ;
+ < "4bit - gråtoneskala" ; Default ; > ;
+ < "4bit - farvepalet" ; Default ; > ;
+ < "8bit - gråtoneskala" ; Default ; > ;
+ < "8bit - farvepalet" ; Default ; > ;
+ < "24bit - ægte farver" ; Default ; > ;
+ };
+ stringlist [ italian ] =
+ {
+ < "Originale" ; Default ; > ;
+ < "Valore soglia 1 bit" ; Default ; > ;
+ < "Dithering a 1 bit" ; Default ; > ;
+ < "Scala di grigio 4 bit" ; Default ; > ;
+ < "Tavola dei colori 4 bit" ; Default ; > ;
+ < "Scala di grigio 8 bit" ; Default ; > ;
+ < "Tavola dei colori a 8 bit" ; Default ; > ;
+ < "Colori reali - 24 bit" ; Default ; > ;
+ };
+ stringlist [ spanish ] =
+ {
+ < "Original" ; Default ; > ;
+ < "Valor umbral de 1 bit" ; Default ; > ;
+ < "1 bit - difusionado" ; Default ; > ;
+ < "Paleta de escala de grises 4 bits" ; Default ; > ;
+ < "Paleta de colores de 4 bits" ; Default ; > ;
+ < "Paleta de escala de grises 8 bits" ; Default ; > ;
+ < "Paleta de colores de 8 bits" ; Default ; > ;
+ < "Color real 24 bits" ; Default ; > ;
+ };
+ stringlist [ french ] =
+ {
+ < "Original" ; Default ; > ;
+ < "Valeur de seuil 1 bit" ; Default ; > ;
+ < "Dithering (diffusion) 1 bit" ; Default ; > ;
+ < "Niveaux de gris 4 bits" ; Default ; > ;
+ < "Palette de couleurs 4 bits" ; Default ; > ;
+ < "Niveaux de gris 8 bits" ; Default ; > ;
+ < "Palette de couleurs 8 bits" ; Default ; > ;
+ < "Couleurs 24 bit (Truecolor)" ; Default ; > ;
+ };
+ stringlist [ dutch ] =
+ {
+ < "Origineel" ; Default ; > ;
+ < "1Bit - grenswaarde" ; Default ; > ;
+ < "1Bit - geditherd" ; Default ; > ;
+ < "4Bit - grijswaardenpalet" ; Default ; > ;
+ < "4Bit - kleurenpalet" ; Default ; > ;
+ < "8Bit - grijswaardenpalet" ; Default ; > ;
+ < "8Bit - kleurenpalet" ; Default ; > ;
+ < "24Bit - echte kleuren" ; Default ; > ;
+ };
+ StringList [ chinese_simplified ] =
+ {
+ < "Ô­¼þ" ; Default ; > ;
+ < "1 λ³õʼֵ" ; Default ; > ;
+ < "1 붶¶¯" ; Default ; > ;
+ < "4 λ»Ò¶Èµ÷É«°å" ; Default ; > ;
+ < "4 λµ÷É«°å" ; Default ; > ;
+ < "8 λ»Ò¶Èµ÷É«°å" ; Default ; > ;
+ < "8 λµ÷É«°å" ; Default ; > ;
+ < "24 λ·ÂÕæÑÕÉ«" ; Default ; > ;
+ };
+ StringList [ russian ] =
+ {
+ < "Îðèãèíàë" ; Default ; > ;
+ < "1-ðàçðÿäíîå ïîðîãîâîå çíà÷åíèå" ; Default ; > ;
+ < "1-ðàçðÿäíîå ïñåâäîïîëóòîíîâîå èçîáðàæåíèå" ; Default ; > ;
+ < "4-ðàçðÿäíàÿ ãàììà îòòåíêîâ ñåðîãî" ; Default ; > ;
+ < "4-ðàçðÿäíàÿ öâåòîâàÿ ïàëèòðà" ; Default ; > ;
+ < "8-ðàçÿäíàÿ ãàììà îòòåíêîâ ñåðîãî" ; Default ; > ;
+ < "8-ðàçðÿäíàÿ öâåòîâàÿ ïàëèòðà" ; Default ; > ;
+ < "24-ðàçðÿäíîå êîäèðîâàíèå öâåòà" ; Default ; > ;
+ };
+ StringList [ polish ] =
+ {
+ < "Orygina³" ; Default ; > ;
+ < "WartoϾ progowa - 1bit" ; Default ; > ;
+ < "Rozsiewanie - 1 bit" ; Default ; > ;
+ < "Paleta odcieni szaroœci - 4bity" ; Default ; > ;
+ < "Paleta kolorów - 4bity" ; Default ; > ;
+ < "Paleta odcieni szaroœci - 8bitów" ; Default ; > ;
+ < "Paleta kolorów - 8bitów" ; Default ; > ;
+ < "True Color - 24bity" ; Default ; > ;
+ };
+ StringList [ japanese ] =
+ {
+ < "µØ¼ÞÅÙ" ; Default ; > ;
+ < "1Bit ‚µ‚«‚¢’l" ; Default ; > ;
+ < "1Bit ÃÞ¨»Þ–@" ; Default ; > ;
+ < "4Bit-¸ÞÚ°½¹°Ù" ; Default ; > ;
+ < "4Bit-¶×°ÊßÚ¯Ä" ; Default ; > ;
+ < "8Bit-¸ÞÚ°½¹°Ù" ; Default ; > ;
+ < "8Bit-¶×°ÊßÚ¯Ä" ; Default ; > ;
+ < "24Bit-‘NÊF" ; Default ; > ;
+ };
+ StringList [ chinese_traditional ] =
+ {
+ < "­ì¥ó" ; Default ; > ;
+ < "1 ¦ì¤¸ªì©l­È" ; Default ; > ;
+ < "1 ¦ì¤¸§Ý°Ê" ; Default ; > ;
+ < "4 ¦ì¤¸¦Ç«×¦âªO" ; Default ; > ;
+ < "4 ¦ì¤¸¦âªO" ; Default ; > ;
+ < "8 ¦ì¤¸¦Ç«×¦âªO" ; Default ; > ;
+ < "8 ¦ì¤¸¦âªO" ; Default ; > ;
+ < "24 ¦ì¤¸¥þ±m" ; Default ; > ;
+ };
+ StringList [ arabic ] =
+ {
+ < "ÇáÃÕá" ; Default ; > ;
+ < "ÞíãÉ ÇáÈÏÁ 1 ÈÊ" ; Default ; > ;
+ < "1 ÈÊ Dithering" ; Default ; > ;
+ < "áæÍ ÏÑÌÇÊ ÇáÑãÇÏí 4 ÈÊ" ; Default ; > ;
+ < "áæÍ ÃáæÇä 4 ÈÊ" ; Default ; > ;
+ < "áæÍ ÏÑÌÇÊ ÇáÑãÇÏí 8 ÈÊ" ; Default ; > ;
+ < "áæÍ ÃáæÇä 8 ÈÊ" ; Default ; > ;
+ < "ÃáæÇä ÍÞíÞíÉ 24 ÈÊ" ; Default ; > ;
+ };
+ StringList [ greek ] =
+ {
+ < "Áñ÷éêü" ; Default ; > ;
+ < "ÔéìÞ ïñßïõ 1 bit" ; Default ; > ;
+ < "Áðüäïóç ÷ñùìÜôùí 1 bit" ; Default ; > ;
+ < "ÄéáâÜèìéóç ôïõ ãêñé: 4 bit" ; Default ; > ;
+ < "ÐáëÝôá ÷ñùìÜôùí 4 bit" ; Default ; > ;
+ < "ÄéáâÜèìéóç ôïõ ãêñé: 8 bit" ; Default ; > ;
+ < "ÐáëÝôá ÷ñùìÜôùí 8 bit" ; Default ; > ;
+ < "24 bit - ÖõóéêÜ ÷ñþìáôá" ; Default ; > ;
+ };
+ StringList [ korean ] =
+ {
+ < "¿øº»" ; Default ; > ;
+ < "1 ºñÆ®- ÀÓ°è°ª" ; Default ; > ;
+ < "1ºñÆ® - Èçµé¸²" ; Default ; > ;
+ < "4 ºñÆ® - ȸ»öÁ¶" ; Default ; > ;
+ < "4 ºñÆ® - »ö»ó ÆÄ·¹Æ®" ; Default ; > ;
+ < "8 ºñÆ® - ȸ»öÁ¶" ; Default ; > ;
+ < "8 ºñÆ® - »ö»ó ÆÄ·¹Æ®" ; Default ; > ;
+ < "24 ºñÆ® - Æ®·ç Ä÷¯" ; Default ; > ;
+ };
+ StringList [ turkish ] =
+ {
+ < "Asýl" ; Default ; > ;
+ < "1Bit - eþik deðer" ; Default ; > ;
+ < "1Bit - titrek" ; Default ; > ;
+ < "4Bit - gri tonlama paleti" ; Default ; > ;
+ < "4Bit - renk paleti" ; Default ; > ;
+ < "8Bit - gri tonlama paleti" ; Default ; > ;
+ < "8Bit - renk paleti" ; Default ; > ;
+ < "24Bit - gerçek renk" ; Default ; > ;
+ };
+ StringList [ language_user1 ] =
+ {
+ < " " ; Default ; > ;
+ < " " ; Default ; > ;
+ < " " ; Default ; > ;
+ < " " ; Default ; > ;
+ < " " ; Default ; > ;
+ < " " ; Default ; > ;
+ < " " ; Default ; > ;
+ < " " ; Default ; > ;
+ };
+ };
+ CheckBox CBX_RLE
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "RLE-Kodierung" ;
+ Text [ ENGLISH ] = "RLE-Coding" ;
+ Text [ english_us ] = "RLE coding" ;
+ Text [ portuguese_brazilian ] = "RLE-Kodierung" ;
+ Text [ swedish ] = "RLE-kodning" ;
+ Text [ danish ] = "RLE-kodning" ;
+ Text [ italian ] = "Codifica RLE" ;
+ Text [ spanish ] = "Codificación RLE" ;
+ Text [ french ] = "Code RLE" ;
+ Text [ dutch ] = "RLE-codering" ;
+ Text [ portuguese ] = "Codificação RLE" ;
+ Text[ chinese_simplified ] = "RLE - ±àÂë";
+ Text[ russian ] = "Êîäèðîâêà RLE";
+ Text[ polish ] = "Kodowanie RLE";
+ Text[ japanese ] = "RLE º°ÃިݸÞ";
+ Text[ chinese_traditional ] = "RLE ½s½X";
+ Text[ arabic ] = "ÊÑãíÒ RLE";
+ Text[ greek ] = "Êùäéêïðïßçóç RLE";
+ Text[ korean ] = "RLE ÄÚµù";
+ Text[ turkish ] = "RLE kodlama";
+ Text[ language_user1 ] = " ";
+ };
+ GroupBox GRP_MODE_PIX
+ {
+ Pos = MAP_APPFONT ( 6 , 51 ) ;
+ Size = MAP_APPFONT ( 110 , 87 ) ;
+ Text = "Modus" ;
+ Text [ ENGLISH ] = "Mode" ;
+ Text [ english_us ] = "Mode" ;
+ Text [ italian ] = "Modo" ;
+ Text [ spanish ] = "Modo" ;
+ Text [ french ] = "Mode" ;
+ Text [ dutch ] = "Modus" ;
+ Text [ swedish ] = "Läge" ;
+ Text [ danish ] = "Modus" ;
+ Text [ portuguese ] = "Modo" ;
+ Text [ portuguese_brazilian ] = "Modus" ;
+ Text[ chinese_simplified ] = "ģʽ";
+ Text[ russian ] = "Ðåæèì";
+ Text[ polish ] = "Tryb";
+ Text[ japanese ] = "Ó°ÄÞ";
+ Text[ chinese_traditional ] = "¼Ò¦¡";
+ Text[ arabic ] = "ÇáæÖÚ";
+ Text[ greek ] = "ÊáôÜóôáóç";
+ Text[ korean ] = "¸ðµå";
+ Text[ turkish ] = "Kip";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_ORIGINAL_PIX
+ {
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ Text = "~Original" ;
+ Text [ ENGLISH ] = "~Original" ;
+ TabStop = TRUE ;
+ Text [ dutch ] = "~Origineel" ;
+ Text [ english_us ] = "~Original" ;
+ Text [ italian ] = "~Originale" ;
+ Text [ spanish ] = "~Original" ;
+ Text [ french ] = "~Original" ;
+ Text [ swedish ] = "~Original" ;
+ Text [ danish ] = "Original" ;
+ Text [ portuguese ] = "~Original" ;
+ Text [ portuguese_brazilian ] = "~Original" ;
+ Text[ chinese_simplified ] = "Ô­¼þ(~O)";
+ Text[ russian ] = "Îðèãèíàë";
+ Text[ polish ] = "Orygina³";
+ Text[ japanese ] = "µØ¼ÞÅÙ(~O)";
+ Text[ chinese_traditional ] = "­ì¥ó(~O)";
+ Text[ arabic ] = "ÇáÃÕá";
+ Text[ greek ] = "Áñ÷éêü";
+ Text[ korean ] = "¿øº»(~O)";
+ Text[ turkish ] = "~Asýl";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_RES_PIX
+ {
+ Pos = MAP_APPFONT ( 12 , 75 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ Text = "~Auflösung" ;
+ Text [ ENGLISH ] = "~Resolution" ;
+ TabStop = TRUE ;
+ Text [ dutch ] = "~Resolutie" ;
+ Text [ english_us ] = "~Resolution" ;
+ Text [ italian ] = "~Risoluzione" ;
+ Text [ spanish ] = "~Resolución" ;
+ Text [ french ] = "Résolution" ;
+ Text [ swedish ] = "~Upplösning" ;
+ Text [ danish ] = "Opløsning" ;
+ Text [ portuguese ] = "~Resolução" ;
+ Text [ portuguese_brazilian ] = "~Auflösung" ;
+ Text[ chinese_simplified ] = "·Ö±æÂÊ(~R)";
+ Text[ russian ] = "Ðàçðåøåíèå";
+ Text[ polish ] = "RozdzielczoϾ";
+ Text[ japanese ] = "‰ð‘œ“x(~R)";
+ Text[ chinese_traditional ] = "¸ÑªR«×(~R)";
+ Text[ arabic ] = "ÇáÇÓÊÈÇäÉ";
+ Text[ greek ] = "ÁíÜëõóç";
+ Text[ korean ] = "ÇØ»óµµ(~R)";
+ Text[ turkish ] = "~Çözünürlük";
+ Text[ language_user1 ] = " ";
+ };
+ ComboBox CBB_RES_PIX
+ {
+ Pos = MAP_APPFONT ( 70 , 75 ) ;
+ Size = MAP_APPFONT ( 40 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList =
+ {
+ "75 DPI" ;
+ "150 DPI" ;
+ "300 DPI" ;
+ "600 DPI" ;
+ };
+ };
+ RadioButton RB_SIZE_PIX
+ {
+ Pos = MAP_APPFONT ( 12 , 90 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ Text = "~Größe" ;
+ Text [ ENGLISH ] = "~Size" ;
+ TabStop = TRUE ;
+ Text [ dutch ] = "~Grootte" ;
+ Text [ english_us ] = "~Size" ;
+ Text [ italian ] = "~Dimensione" ;
+ Text [ spanish ] = "~Tamaño" ;
+ Text [ french ] = "Taille" ;
+ Text [ swedish ] = "~Storlek" ;
+ Text [ danish ] = "Størrelse" ;
+ Text [ portuguese ] = "~Tamanho" ;
+ Text [ portuguese_brazilian ] = "~Größe" ;
+ Text[ chinese_simplified ] = "´óС(~S)";
+ Text[ russian ] = "Ðàçìåð";
+ Text[ polish ] = "Rozmiar";
+ Text[ japanese ] = "»²½Þ(~S)";
+ Text[ chinese_traditional ] = "¤j¤p(~S)";
+ Text[ arabic ] = "ÇáÍÌã";
+ Text[ greek ] = "ÌÝãåèïò";
+ Text[ korean ] = "Å©±â(~S)";
+ Text[ turkish ] = "~Büyüklük";
+ Text[ language_user1 ] = " ";
+ };
+ MetricField MTF_SIZEX_PIX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 105 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ MetricField MTF_SIZEY_PIX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 120 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ FixedText FT_SIZEX_PIX
+ {
+ Pos = MAP_APPFONT ( 18 , 106 ) ;
+ Size = MAP_APPFONT ( 41 , 10 ) ;
+ Text = "Breite" ;
+ Text [ ENGLISH ] = "Width" ;
+ Text [ english_us ] = "Width" ;
+ Text [ italian ] = "Larghezza" ;
+ Text [ spanish ] = "Ancho" ;
+ Text [ french ] = "Largeur" ;
+ Text [ dutch ] = "Breedte" ;
+ Text [ swedish ] = "Bredd" ;
+ Text [ danish ] = "Bredde" ;
+ Text [ portuguese_brazilian ] = "Breite" ;
+ Text [ portuguese ] = "Largura" ;
+ Text[ chinese_simplified ] = "¿í¶È";
+ Text[ russian ] = "Øèðèíà";
+ Text[ polish ] = "Szer.";
+ Text[ japanese ] = "•";
+ Text[ chinese_traditional ] = "¼e«×";
+ Text[ arabic ] = "ÇáÚÑÖ";
+ Text[ greek ] = "ÐëÜôïò";
+ Text[ korean ] = "³Êºñ";
+ Text[ turkish ] = "Geniþlik";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SIZEY_PIX
+ {
+ Pos = MAP_APPFONT ( 18 , 121 ) ;
+ Size = MAP_APPFONT ( 41 , 10 ) ;
+ Text = "Höhe" ;
+ Text [ ENGLISH ] = "Height" ;
+ Text [ english_us ] = "Height" ;
+ Text [ italian ] = "Altezza" ;
+ Text [ spanish ] = "Altura" ;
+ Text [ french ] = "Hauteur" ;
+ Text [ dutch ] = "Hoogte" ;
+ Text [ swedish ] = "Höjd" ;
+ Text [ danish ] = "Højde" ;
+ Text [ portuguese ] = "Altura" ;
+ Text [ portuguese_brazilian ] = "Höhe" ;
+ Text[ chinese_simplified ] = "¸ß¶È";
+ Text[ russian ] = "Âûñîòà";
+ Text[ polish ] = "Wys.";
+ Text[ japanese ] = "‚‚³";
+ Text[ chinese_traditional ] = "°ª«×";
+ Text[ arabic ] = "ÇáÇÑÊÝÇÚ";
+ Text[ greek ] = "¾øïò";
+ Text[ korean ] = "³ôÀÌ";
+ Text[ turkish ] = "Yükseklik";
+ Text[ language_user1 ] = " ";
+ };
+ OKButton BTN_OK_PIX
+ {
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL_PIX
+ {
+ Pos = MAP_APPFONT ( 122 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP_PIX
+ {
+ Pos = MAP_APPFONT ( 122 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+ModalDialog DLG_EXPORT_VEC
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 178 , 98 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ MetricField MTF_SIZEX_VEC
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 59 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ MetricField MTF_SIZEY_VEC
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 99999 ;
+ StrictFormat = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_MM ;
+ First = 100 ;
+ Last = 99999 ;
+ SpinSize = 100 ;
+ };
+ GroupBox GRP_SIZE_VEC
+ {
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 110 , 44 ) ;
+ Text = "Größe" ;
+ Text [ ENGLISH ] = "Size" ;
+ Text [ dutch ] = "Grootte" ;
+ Text [ english_us ] = "Size" ;
+ Text [ italian ] = "Dimensione" ;
+ Text [ spanish ] = "Tamaño" ;
+ Text [ french ] = "Taille" ;
+ Text [ swedish ] = "Storlek" ;
+ Text [ danish ] = "Størrelse" ;
+ Text [ portuguese_brazilian ] = "Größe" ;
+ Text [ portuguese ] = "Tamanho" ;
+ Text[ chinese_simplified ] = "´óС";
+ Text[ russian ] = "Ðàçìåð";
+ Text[ polish ] = "Rozmiar";
+ Text[ japanese ] = "»²½Þ";
+ Text[ chinese_traditional ] = "¤j¤p";
+ Text[ arabic ] = "ÇáÍÌã";
+ Text[ greek ] = "ÌÝãåèïò";
+ Text[ korean ] = "Å©±â";
+ Text[ turkish ] = "Büyüklük";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SIZEX_VEC
+ {
+ Pos = MAP_APPFONT ( 12 , 59 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Breite" ;
+ Text [ ENGLISH ] = "Width" ;
+ Text [ dutch ] = "Breedte" ;
+ Text [ english_us ] = "Width" ;
+ Text [ italian ] = "Larghezza" ;
+ Text [ spanish ] = "Ancho" ;
+ Text [ french ] = "Largeur" ;
+ Text [ swedish ] = "Bredd" ;
+ Text [ danish ] = "Bredde" ;
+ Text [ portuguese ] = "Largura" ;
+ Text [ portuguese_brazilian ] = "Breite" ;
+ Text[ chinese_simplified ] = "¿í¶È";
+ Text[ russian ] = "Øèðèíà";
+ Text[ polish ] = "Szer.";
+ Text[ japanese ] = "•";
+ Text[ chinese_traditional ] = "¼e«×";
+ Text[ arabic ] = "ÇáÚÑÖ";
+ Text[ greek ] = "ÐëÜôïò";
+ Text[ korean ] = "³Êºñ";
+ Text[ turkish ] = "Geniþlik";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SIZEY_VEC
+ {
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text = "Höhe" ;
+ Text [ ENGLISH ] = "Height" ;
+ Text [ english_us ] = "Height" ;
+ Text [ italian ] = "Altezza" ;
+ Text [ spanish ] = "Altura" ;
+ Text [ french ] = "Hauteur" ;
+ Text [ dutch ] = "Hoogte" ;
+ Text [ swedish ] = "Höjd" ;
+ Text [ danish ] = "Højde" ;
+ Text [ portuguese_brazilian ] = "Höhe" ;
+ Text [ portuguese ] = "Altura" ;
+ Text[ chinese_simplified ] = "¸ß¶È";
+ Text[ russian ] = "Âûñîòà";
+ Text[ polish ] = "Wys.";
+ Text[ japanese ] = "‚‚³";
+ Text[ chinese_traditional ] = "°ª«×";
+ Text[ arabic ] = "ÇáÇÑÊÝÇÚ";
+ Text[ greek ] = "¾øïò";
+ Text[ korean ] = "³ôÀÌ";
+ Text[ turkish ] = "Yükseklik";
+ Text[ language_user1 ] = " ";
+ };
+ OKButton BTN_OK_VEC
+ {
+ Pos = MAP_APPFONT ( 122 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL_VEC
+ {
+ Pos = MAP_APPFONT ( 122 , 24 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP_VEC
+ {
+ Pos = MAP_APPFONT ( 122 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_ORIGINAL_VEC
+ {
+ Pos = MAP_APPFONT ( 12 , 12 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ Text = "~Original" ;
+ Text [ ENGLISH ] = "~Original" ;
+ TabStop = TRUE ;
+ Text [ dutch ] = "~Origineel" ;
+ Text [ english_us ] = "~Original" ;
+ Text [ italian ] = "~Originale" ;
+ Text [ spanish ] = "~Original" ;
+ Text [ french ] = "~Original" ;
+ Text [ swedish ] = "~Original" ;
+ Text [ danish ] = "Original" ;
+ Text [ portuguese_brazilian ] = "~Original" ;
+ Text [ portuguese ] = "~Original" ;
+ Text[ chinese_simplified ] = "Ô­¼þ(~O)";
+ Text[ russian ] = "Îðèãèíàë";
+ Text[ polish ] = "Orygina³";
+ Text[ japanese ] = "µØ¼ÞÅÙ(~O)";
+ Text[ chinese_traditional ] = "­ì¥ó(~O)";
+ Text[ arabic ] = "ÇáÃÕá";
+ Text[ greek ] = "Áñ÷éêü";
+ Text[ korean ] = "¿øº»(~O)";
+ Text[ turkish ] = "~Asýl";
+ Text[ language_user1 ] = " ";
+ };
+ RadioButton RB_SIZE_VEC
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 98 , 12 ) ;
+ Text = "~Größe" ;
+ Text [ ENGLISH ] = "~Size" ;
+ TabStop = TRUE ;
+ Text [ dutch ] = "~Grootte" ;
+ Text [ english_us ] = "~Size" ;
+ Text [ italian ] = "~Dimensione" ;
+ Text [ spanish ] = "~Tamaño" ;
+ Text [ french ] = "Taille" ;
+ Text [ swedish ] = "~Storlek" ;
+ Text [ danish ] = "Størrelse" ;
+ Text [ portuguese_brazilian ] = "~Größe" ;
+ Text [ portuguese ] = "~Tamanho" ;
+ Text[ chinese_simplified ] = "´óС(~S)";
+ Text[ russian ] = "Ðàçìåð";
+ Text[ polish ] = "Rozmiar";
+ Text[ japanese ] = "»²½Þ(~S)";
+ Text[ chinese_traditional ] = "¤j¤p(~S)";
+ Text[ arabic ] = "ÇáÍÌã";
+ Text[ greek ] = "ÌÝãåèïò";
+ Text[ korean ] = "Å©±â(~S)";
+ Text[ turkish ] = "~Büyüklük";
+ Text[ language_user1 ] = " ";
+ };
+ GroupBox GRP_MODE_VEC
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 110 , 42 ) ;
+ Text = "Modus" ;
+ Text [ ENGLISH ] = "Mode" ;
+ Text [ dutch ] = "Modus" ;
+ Text [ english_us ] = "Mode" ;
+ Text [ italian ] = "Modo" ;
+ Text [ spanish ] = "Modo" ;
+ Text [ french ] = "Mode" ;
+ Text [ swedish ] = "Läge" ;
+ Text [ danish ] = "Modus" ;
+ Text [ portuguese_brazilian ] = "Modus" ;
+ Text [ portuguese ] = "Modo" ;
+ Text[ chinese_simplified ] = "ģʽ";
+ Text[ russian ] = "Ðåæèì";
+ Text[ polish ] = "Tryb";
+ Text[ japanese ] = "Ó°ÄÞ";
+ Text[ chinese_traditional ] = "¼Ò¦¡";
+ Text[ arabic ] = "ÇáæÖÚ";
+ Text[ greek ] = "ÊáôÜóôáóç";
+ Text[ korean ] = "¸ðµå";
+ Text[ turkish ] = "Kip";
+ Text[ language_user1 ] = " ";
+ };
+};
diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
new file mode 100644
index 000000000000..17c0c47587d2
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -0,0 +1,2735 @@
+/*************************************************************************
+ *
+ * $RCSfile: filter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if defined UNX && defined ALPHA
+#include <fstream.hxx>
+#endif
+#include <unotools/processfactory.hxx>
+#include <ucbhelper/content.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/tempfile.hxx>
+#include <vcl/salctype.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include "filter.hxx"
+#include "fltcall.hxx"
+#include "wmf.hxx"
+#include "gifread.hxx"
+#include "pngread.hxx"
+#include "jpeg.hxx"
+#include "xbmread.hxx"
+#include "xpmread.hxx"
+#include "solar.hrc"
+#include "strings.hrc"
+#include "dlgexpor.hxx"
+#include "dlgejpg.hxx"
+#include "sgffilt.hxx"
+#ifndef _VOS_MODULE_HXX_
+#include "vos/module.hxx"
+#endif
+
+#ifdef MAC
+#include "extattr.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_XWEAK_HPP_
+#include <com/sun/star/uno/XWeak.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_XAGGREGATION_HPP_
+#include <com/sun/star/uno/XAggregation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SVG_XSVGWRITER_HPP_
+#include <com/sun/star/svg/XSVGWriter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+
+#define IMPEXP_FILTERPATHES "Pathes"
+
+#define IMP_BMP "SVBMP"
+#define IMP_SVMETAFILE "SVMETAFILE"
+#define IMP_WMF "SVWMF"
+#define IMP_EMF "SVEMF"
+#define IMP_SVSGF "SVSGF"
+#define IMP_SVSGV "SVSGV"
+#define IMP_GIF "SVIGIF"
+#define IMP_PNG "SVIPNG"
+#define IMP_JPEG "SVIJPEG"
+#define IMP_XBM "SVIXBM"
+#define IMP_XPM "SVIXPM"
+#define EXP_BMP "SVBMP"
+#define EXP_SVMETAFILE "SVMETAFILE"
+#define EXP_WMF "SVWMF"
+#define EXP_EMF "SVEMF"
+#define EXP_JPEG "SVEJPEG"
+#define EXP_SVG "SVESVG"
+
+#define BMP_SHORTNAME "BMP"
+#define GIF_SHORTNAME "GIF"
+#define JPG_SHORTNAME "JPG"
+#define MET_SHORTNAME "MET"
+#define PCT_SHORTNAME "PCT"
+#define PNG_SHORTNAME "PNG"
+#define SVM_SHORTNAME "SVM"
+#define TIF_SHORTNAME "TIF"
+#define WMF_SHORTNAME "WMF"
+#define EMF_SHORTNAME "EMF"
+
+#if defined WIN || (defined OS2 && !defined ICC)
+
+#define IMPORT_FUNCTION_NAME "_GraphicImport"
+#define EXPORT_FUNCTION_NAME "_GraphicExport"
+#define IMPDLG_FUNCTION_NAME "_DoImportDialog"
+#define EXPDLG_FUNCTION_NAME "_DoExportDialog"
+
+#else
+
+#define IMPORT_FUNCTION_NAME "GraphicImport"
+#define EXPORT_FUNCTION_NAME "GraphicExport"
+#define IMPDLG_FUNCTION_NAME "DoImportDialog"
+#define EXPDLG_FUNCTION_NAME "DoExportDialog"
+
+#endif
+
+// Compilerfehler, wenn Optimierung bei WNT & MSC
+#if defined WNT && defined MSC
+#pragma optimize( "", off )
+#endif
+
+// -----------
+// - statics -
+// -----------
+
+ULONG GraphicFilter::nFilterCount = 0UL;
+Link GraphicFilter::aLastFilterHdl = Link();
+
+// -------------------------
+// - ImpFilterOutputStream -
+// -------------------------
+
+class ImpFilterOutputStream : public ::cppu::WeakImplHelper1< ::com::sun::star::io::XOutputStream >
+{
+protected:
+
+ SvStream& mrStm;
+
+ virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& rData ) { mrStm.Write( rData.getConstArray(), rData.getLength() ); }
+ virtual void SAL_CALL flush() { mrStm.Flush(); }
+ virtual void SAL_CALL closeOutput() {}
+
+public:
+
+ ImpFilterOutputStream( SvStream& rStm ) : mrStm( rStm ) {}
+ ~ImpFilterOutputStream() {}
+};
+
+// -------------------------
+// - ImpFilterCallbackData -
+// -------------------------
+
+struct ImpFilterCallbackData
+{
+ GraphicFilter * pFilt;
+ USHORT * pPercent;
+ Link * pUpdatePercentHdl;
+ BOOL * pAbort;
+ USHORT nFilePercentOfTotal;
+};
+
+// ---------------------
+// - ImpFilterCallback -
+// ---------------------
+
+BOOL ImplDirEntryHelper::Exists( const INetURLObject& rObj )
+{
+ BOOL bExists = FALSE;
+
+ try
+ {
+ ::rtl::OUString aTitle;
+ ::ucb::Content aCnt( rObj.GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.getPropertyValue( ::rtl::OUString::createFromAscii( "Title" ) ) >>= aTitle;
+
+ if( aTitle.getLength() )
+ bExists = TRUE;
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+
+ return bExists;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplDirEntryHelper::Kill( const String& rStr )
+{
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( rStr, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+}
+
+// ---------------------
+// - ImpFilterCallback -
+// ---------------------
+
+BOOL ImpFilterCallback( void* pCallerData, USHORT nPercent )
+{
+ ImpFilterCallbackData* pData= (ImpFilterCallbackData*) pCallerData;
+
+ nPercent = nPercent * pData->nFilePercentOfTotal / 100;
+
+ if( nPercent >= ( 3 + *pData->pPercent ) )
+ {
+ *pData->pPercent = nPercent;
+ pData->pUpdatePercentHdl->Call( pData->pFilt );
+ }
+
+ return *pData->pAbort;
+}
+
+// --------------------
+// - Helper functions -
+// --------------------
+
+static String ImpGetNthEntry( const String& rStr, USHORT nEntry )
+{
+ const sal_Unicode* pA = rStr.GetBuffer();
+ const sal_Unicode* pEnd = pA + rStr.Len();
+
+ sal_uInt16 i;
+ for( i = 0; ( i < nEntry ) && ( pA != pEnd ); i++ )
+ {
+ while( ( *pA != ',' ) && ( pA != pEnd ) )
+ pA++;
+
+ if( *pA == ',')
+ pA++;
+ }
+ i = 0;
+ if( *pA == '"' )
+ {
+ *pA++;
+ while( ( ( pA + i ) != pEnd ) && ( pA[i] != '"' ) )
+ i++;
+ }
+ else
+ {
+ while( ( ( pA + i ) != pEnd ) && ( pA[i] != ',' ) )
+ i++;
+ }
+ return String( pA, (xub_StrLen)i );
+}
+
+//--------------------------------------------------------------------------
+
+static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ ULONG i;
+ for ( i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetFormatName( const String& rStr )
+{
+ return ImpGetNthEntry( rStr, 0 );
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetMacType( const String& rStr )
+{
+ return ImpGetNthEntry( rStr, 1 );
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetFormatExtension( const String& rStr )
+{
+ return ImpGetNthEntry( rStr, 2 );
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetFilterName( const String& rStr )
+{
+ return ImpGetNthEntry( rStr, 3 );
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetFilterVendor( const String& rStr )
+{
+ return ImpGetNthEntry( rStr, 4 );
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetFilterPixOrVec( const String& rStr )
+{
+ return ImpGetNthEntry( rStr, 5 );
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetFilterDialog( const String& rStr )
+{
+ return ImpGetNthEntry( rStr, 6 );
+}
+
+//--------------------------------------------------------------------------
+
+inline String ImpGetExtension( const String &rPath )
+{
+ String aExt;
+ INetURLObject aURL;
+
+ aURL.SetSmartURL( rPath );
+ aExt = aURL.GetFileExtension().ToUpperAscii();
+ return aExt;
+}
+
+/*************************************************************************
+|*
+|* ImpPeekGraphicFormat()
+|*
+|* Beschreibung:
+|* Diese Funktion kann zweierlei:
+|* 1.) Datei anlesen, Dateiformat ermitteln
+|* Eingabe-prarameter:
+|* rPath - Dateipfad
+|* rFormatExtension - Inhalt egal
+|* bTest - setze FALSE
+|* Ausgabe-parameter:
+|* Funkionswert - TRUE wenn Erfolg
+|* rFormatExtension - Bei Erfolg: uebliche Dateiendung
+|* des Formats (Grossbuchstaben)
+|* 2.) Datei anlesen, Dateiformat ueberpruefen
+|* Eingabe-prarameter:
+|* rPath - Dateipfad
+|* rFormatExtension - uebliche Dateiendung des Formats
+|* (Grossbuchstaben)
+|* bTest - setze TRUE
+|* Ausgabe-parameter:
+|* Funkionswert - FALSE, wenn die Datei bestimmt nicht
+|* vom uebgebenen Format ist.
+|* TRUE, wenn die Datei WAHRSCHEINLICH von
+|* dem Format ist, ODER WENN DAS FORMAT
+|* DIESER FUNKTION NICHT BEKANNT IST!
+|*
+|* Ersterstellung OH 26.05.95
+|* Letzte Aenderung OH 07.08.95
+|*
+*************************************************************************/
+
+static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, BOOL bTest )
+{
+ USHORT i;
+ BYTE sFirstBytes[ 256 ];
+ ULONG nFirstLong,nSecondLong;
+ ULONG nStreamPos = rStream.Tell();
+
+ rStream.Seek( STREAM_SEEK_TO_END );
+ ULONG nStreamLen = rStream.Tell() - nStreamPos;
+ rStream.Seek( nStreamPos );
+
+ // Die ersten 256 Bytes in einen Buffer laden:
+ if( nStreamLen >= 256 )
+ rStream.Read( sFirstBytes, 256 );
+ else
+ {
+ rStream.Read( sFirstBytes, nStreamLen );
+
+ for( i = (USHORT) nStreamLen; i < 256; i++ )
+ sFirstBytes[ i ]=0;
+ }
+
+ if( rStream.GetError() )
+ return FALSE;
+
+ // Die ersten 8 Bytes in nFirstLong, nSecondLong unterbringen,
+ // Big-Endian:
+ for( i = 0, nFirstLong = 0L, nSecondLong = 0L; i < 4; i++ )
+ {
+ nFirstLong=(nFirstLong<<8)|(ULONG)sFirstBytes[i];
+ nSecondLong=(nSecondLong<<8)|(ULONG)sFirstBytes[i+4];
+ }
+
+ // Folgende Variable ist nur bei bTest==TRUE interessant. Sie
+ // bleibt FALSE, wenn das Format (rFormatExtension) hier noch nicht
+ // einprogrammiert wurde.
+ BOOL bSomethingTested = FALSE;
+
+ // Nun werden die verschieden Formate ueberprueft. Dabei ist die
+ // Reihenfolge nicht egal. Z.b. koennte eine MET-Datei auch durch
+ // den BMP-Test gehen, umgekehrt kann eine BMP-Datei kaum durch den
+ // MET-Test gehen. Also sollte MET vor BMP getestet werden.
+ // Theoretisch waere aber vielleicht auch eine BMP-Datei denkbar,
+ // die durch den MET-Test geht.
+ // Diese Probleme gibt es natuerlich nicht nur bei MET und BMP.
+ // Deshalb wird im Falle der Uberpruefung eines Formats (bTest==TRUE)
+ // nur genau dieses eine Format getestet. Alles andere koennte fatale
+ // Folgen haben, z.B. wenn der Benutzer sagt, es sei BMP-Datei (und es
+ // ist BMP-Datei), und hier wuerde die Datei durch den MET-Test gehen...
+
+ //--------------------------- MET ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "MET", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if( sFirstBytes[2] == 0xd3 )
+ {
+ rStream.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ rStream.Seek( nStreamPos );
+ USHORT nFieldSize;
+ BYTE nMagic;
+ BOOL bOK=TRUE;
+ rStream >> nFieldSize >> nMagic;
+ for (i=0; i<3; i++) {
+ if (nFieldSize<6) { bOK=FALSE; break; }
+ if (nStreamLen < rStream.Tell() + nFieldSize ) { bOK=FALSE; break; }
+ rStream.SeekRel(nFieldSize-3);
+ rStream >> nFieldSize >> nMagic;
+ if (nMagic!=0xd3) { bOK=FALSE; break; }
+ }
+ rStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ if (bOK && !rStream.GetError()) {
+ rFormatExtension= UniString::CreateFromAscii( "MET", 3 );
+ return TRUE;
+ }
+ }
+ }
+
+ //--------------------------- BMP ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "BMP", 3 ) == COMPARE_EQUAL ) )
+ {
+ BYTE nOffs;
+
+ bSomethingTested=TRUE;
+
+ // OS/2-Bitmaparray ('BA') koennen wir evtl. auch lesen,
+ // dementspr. muessen wir den Offset anpassen,
+ // um auf die erste Bitmap im Array zu stossen
+ if ( sFirstBytes[0] == 0x42 && sFirstBytes[1] == 0x41 )
+ nOffs = 14;
+ else
+ nOffs = 0;
+
+ // Jetzt testen wir zunaechst auf 'BM'
+ if ( sFirstBytes[0+nOffs]==0x42 && sFirstBytes[1+nOffs]==0x4d )
+ {
+ // unter OS/2 koennen die Reserved-Flags != 0 sein
+ // (was sie eigentlich nicht duerften);
+ // in diesem Fall testen wir die Groesse des BmpInfoHeaders
+ if ( ( sFirstBytes[6+nOffs]==0x00 &&
+ sFirstBytes[7+nOffs]==0x00 &&
+ sFirstBytes[8+nOffs]==0x00 &&
+ sFirstBytes[9+nOffs]==0x00 ) ||
+ sFirstBytes[14+nOffs] == 0x28 ||
+ sFirstBytes[14+nOffs] == 0x0c )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "BMP", 3 );
+ return TRUE;
+ }
+ }
+ }
+
+ //--------------------------- WMF/EMF ------------------------------------
+
+ if( !bTest ||
+ ( rFormatExtension.CompareToAscii( "WMF", 3 ) == COMPARE_EQUAL ) ||
+ ( rFormatExtension.CompareToAscii( "EMF", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested = TRUE;
+
+ if ( nFirstLong==0xd7cdc69a || nFirstLong==0x01000900 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "WMF", 3 );
+ return TRUE;
+ }
+ else if( nFirstLong == 0x01000000 && sFirstBytes[ 40 ] == 0x20 && sFirstBytes[ 41 ] == 0x45 &&
+ sFirstBytes[ 42 ] == 0x4d && sFirstBytes[ 43 ] == 0x46 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "EMF", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- PCX ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "PCX", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if (sFirstBytes[0]==0x0a)
+ {
+ BYTE nVersion=sFirstBytes[1];
+ BYTE nEncoding=sFirstBytes[2];
+ if( ( nVersion==0 || nVersion==2 || nVersion==3 || nVersion==5 ) && nEncoding<=1 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "PCX", 3 );
+ return TRUE;
+ }
+ }
+ }
+
+ //--------------------------- TIF ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "TIF", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if ( nFirstLong==0x49492a00 || nFirstLong==0x4d4d002a )
+ {
+ rFormatExtension=UniString::CreateFromAscii( "TIF", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- GIF ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "GIF", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if ( nFirstLong==0x47494638 && (sFirstBytes[4]==0x37 || sFirstBytes[4]==0x39) && sFirstBytes[5]==0x61 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "GIF", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- PNG ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "PNG", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if (nFirstLong==0x89504e47 && nSecondLong==0x0d0a1a0a)
+ {
+ rFormatExtension = UniString::CreateFromAscii( "PNG", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- JPG ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "JPG", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if ( ( nFirstLong==0xffd8ffe0 && sFirstBytes[6]==0x4a && sFirstBytes[7]==0x46 && sFirstBytes[8]==0x49 && sFirstBytes[9]==0x46 ) ||
+ ( nFirstLong==0xffd8fffe ) || ( 0xffd8ff00 == ( nFirstLong & 0xffffff00 ) ) )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "JPG", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- SVM ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "SVM", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if( nFirstLong==0x53564744 && sFirstBytes[4]==0x49 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "SVM", 3 );
+ return TRUE;
+ }
+ else if( sFirstBytes[2]==0x56 && sFirstBytes[3]==0x43 && sFirstBytes[4]==0x4C &&
+ sFirstBytes[5]==0x4D && sFirstBytes[6]==0x54 && sFirstBytes[7]==0x46 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "SVM", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- PCD ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "PCD", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested = TRUE;
+ if( nStreamLen >= 2055 )
+ {
+ char sBuf[8];
+ rStream.Seek( nStreamPos + 2048 );
+ rStream.Read( sBuf, 7 );
+
+ if( strncmp( sBuf, "PCD_IPI", 7 ) == 0 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "PCD", 3 );
+ return TRUE;
+ }
+ }
+ }
+
+ //--------------------------- PSD ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "PSD", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested = TRUE;
+ if ( ( nFirstLong == 0x38425053 ) && ( (nSecondLong >> 16 ) == 1 ) )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "PSD", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- EPS ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "EPS", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested = TRUE;
+ if ( ( nFirstLong == 0xC5D0D3C6 ) || ( ImplSearchEntry( sFirstBytes, (BYTE*)"%!PS-Adobe", 10, 10 ) &&
+ ImplSearchEntry( &sFirstBytes[15], (BYTE*)"EPS", 3, 3 ) ) )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "EPS", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- DXF ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "DXF", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+
+ i=0;
+ while (i<256 && sFirstBytes[i]<=32)
+ i++;
+
+ if (i<256)
+ {
+ if( sFirstBytes[i]=='0' )
+ i++;
+ else
+ i=256;
+ }
+ while( i<256 && sFirstBytes[i]<=32 )
+ i++;
+
+ if (i+7<256)
+ {
+ if (strncmp((char*)(sFirstBytes+i),"SECTION",7)==0)
+ {
+ rFormatExtension = UniString::CreateFromAscii( "DXF", 3 );
+ return TRUE;
+ }
+ }
+
+ if( strncmp( (char*) sFirstBytes, "AutoCAD Binary DXF", 18 ) == 0 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "DXF", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- PCT ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "PCT", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested = TRUE;
+ if( nStreamLen >= 525 )
+ {
+ BYTE sBuf[4];
+ sal_uInt32 nOffset; // in ms documents the pict format is used without the first 512 bytes
+ for ( nOffset = 10; nOffset <= 512; nOffset += 512 )
+ {
+ rStream.Seek( nStreamPos + nOffset );
+ rStream.Read( sBuf,3 );
+ if ( sBuf[ 0 ] == 0x00 && sBuf[ 1 ] == 0x11 && ( sBuf[ 2 ] == 0x01 || sBuf[ 2 ] == 0x02 ) )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "PCT", 3 );
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ //------------------------- PBM + PGM + PPM ---------------------------
+ if( !bTest ||
+ ( rFormatExtension.CompareToAscii( "PBM", 3 ) == COMPARE_EQUAL ) ||
+ ( rFormatExtension.CompareToAscii( "PGM", 3 ) == COMPARE_EQUAL ) ||
+ ( rFormatExtension.CompareToAscii( "PPM", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if ( sFirstBytes[ 0 ] == 'P' )
+ {
+ switch( sFirstBytes[ 1 ] )
+ {
+ case '1' :
+ case '4' :
+ rFormatExtension = UniString::CreateFromAscii( "PBM", 3 );
+ return TRUE;
+
+ case '2' :
+ case '5' :
+ rFormatExtension = UniString::CreateFromAscii( "PGM", 3 );
+ return TRUE;
+
+ case '3' :
+ case '6' :
+ rFormatExtension = UniString::CreateFromAscii( "PPM", 3 );
+ return TRUE;
+ }
+ }
+ }
+
+ //--------------------------- RAS( SUN RasterFile )------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "RAS", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested=TRUE;
+ if( nFirstLong == 0x59a66a95 )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "RAS", 3 );
+ return TRUE;
+ }
+ }
+
+ //--------------------------- XPM ------------------------------------
+ if( !bTest )
+ {
+ bSomethingTested = TRUE;
+ if( ImplSearchEntry( sFirstBytes, (BYTE*)"/* XPM */", 256, 9 ) )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "XPM", 3 );
+ return TRUE;
+ }
+ }
+ else if( rFormatExtension.CompareToAscii( "XPM", 3 ) == COMPARE_EQUAL )
+ {
+ bSomethingTested = TRUE;
+ return TRUE;
+ }
+
+ //--------------------------- XBM ------------------------------------
+ if( !bTest )
+ {
+ ULONG nSize = ( nStreamLen > 2048 ) ? 2048 : nStreamLen;
+ BYTE* pBuf = new BYTE [ nSize ];
+
+ rStream.Seek( nStreamPos );
+ rStream.Read( pBuf, nSize );
+ BYTE* pPtr = ImplSearchEntry( pBuf, (BYTE*)"#define", nSize, 7 );
+
+ if( pPtr )
+ {
+ if( ImplSearchEntry( pPtr, (BYTE*)"_width", pBuf + nSize - pPtr, 6 ) )
+ {
+ rFormatExtension = UniString::CreateFromAscii( "XBM", 3 );
+ delete pBuf;
+ return TRUE;
+ }
+ }
+ delete pBuf;
+ }
+ else if( rFormatExtension.CompareToAscii( "XBM", 3 ) == COMPARE_EQUAL )
+ {
+ bSomethingTested = TRUE;
+ return TRUE;
+ }
+
+ //--------------------------- TGA ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "TGA", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested = TRUE;
+ if( rFormatExtension.CompareToAscii( "TGA", 3 ) == COMPARE_EQUAL )
+ return TRUE;
+ }
+
+ //--------------------------- SGV ------------------------------------
+ if( !bTest || ( rFormatExtension.CompareToAscii( "SGV", 3 ) == COMPARE_EQUAL ) )
+ {
+ bSomethingTested = TRUE;
+ if( rFormatExtension.CompareToAscii( "SGV", 3 ) == COMPARE_EQUAL )
+ return TRUE;
+ }
+
+ return bTest && !bSomethingTested;
+}
+
+//--------------------------------------------------------------------------
+
+static USHORT ImpTestOrFindFormat( GraphicFilter& rFilter, Config& rConfig, const String& rPath,
+ SvStream& rStream, String* pConfigString, USHORT* pFormat )
+{
+ USHORT n = rConfig.GetKeyCount();
+
+#ifdef MAC
+ // ggf. Filter anhand der Mac-Typen raussuchen:
+ if( *pFormat == GRFILTER_FORMAT_DONTKNOW )
+ {
+ String aFormType;
+ String aType;
+ SvEaMgr aFile( rPath );
+
+ aFile.GetFileType( aType );
+ aType.Cut( 4 );
+
+ for( USHORT i = 0; i < n; i++ )
+ {
+ aFormType=ImpGetMacType(rConfig.ReadKey(i));
+ aFormType.Cut( 4 );
+ if( aFormType == aType && aFormType != "????" )
+ {
+ *pFormat = i;
+ break;
+ }
+ }
+ }
+#endif
+
+ // ggf. Filter bzw. Format durch anlesen ermitteln,
+ // oder durch anlesen zusichern, dass das Format stimmt:
+ if( *pFormat == GRFILTER_FORMAT_DONTKNOW )
+ {
+ String aFormatExt;
+
+ if( ImpPeekGraphicFormat( rStream, aFormatExt, FALSE ) )
+ {
+ // teuer
+ for( USHORT i = 0; i < n; i++ )
+ {
+ UniString aConfigString( rConfig.ReadKey( i ), RTL_TEXTENCODING_UTF8 );
+
+ if( ImpGetFormatExtension( aConfigString ).ToUpperAscii() == aFormatExt )
+ {
+ *pFormat = i;
+
+ if( pConfigString )
+ *pConfigString = aConfigString;
+
+ return GRFILTER_OK;
+ }
+ }
+ }
+
+ // ggf. Filter anhand der Datei-Endung raussuchen:
+ if( rPath.Len() )
+ {
+ String aExt( ImpGetExtension( rPath ) );
+
+ for( USHORT i = 0; i < n; i++ )
+ {
+ String aConfigString( rConfig.ReadKey( i ), RTL_TEXTENCODING_UTF8 );
+
+ if( ImpGetFormatExtension( aConfigString ).ToUpperAscii() == aExt )
+ {
+ *pFormat = i;
+
+ if( pConfigString )
+ *pConfigString = aConfigString;
+
+ return GRFILTER_OK;
+ }
+ }
+ }
+
+ return GRFILTER_FORMATERROR;
+ }
+ else
+ {
+ String aConfigString( rConfig.ReadKey( *pFormat ), RTL_TEXTENCODING_UTF8 );
+ String aFormatExt( ImpGetFormatExtension( aConfigString ).ToUpperAscii() );
+
+ if( !ImpPeekGraphicFormat( rStream, aFormatExt, TRUE ) )
+ return GRFILTER_FORMATERROR;
+
+ if( pConfigString )
+ *pConfigString = aConfigString;
+ }
+
+ return GRFILTER_OK;
+}
+
+//--------------------------------------------------------------------------
+
+static void ImpCorrectFilterUpdateNumber( String & rFilter )
+{
+ xub_StrLen i, nq, npq;
+
+ String aUPD( UniString::CreateFromInt32( SOLARUPD ) );
+ String aDllExt( __DLLEXTENSION, RTL_TEXTENCODING_UTF8 );
+
+ aDllExt.Erase( 2 );
+
+ const sal_Unicode* pSource = rFilter.GetBuffer();
+ const sal_Unicode* pEnd = pSource + rFilter.Len();
+
+ // Fragezeichen suchen
+ for( i = 0, nq = 0; pSource != pEnd; i++ )
+ {
+ if( *pSource++ == '?' )
+ {
+ if( nq == 0 )
+ npq = i;
+ nq++;
+ }
+ else if( nq == aUPD.Len() )
+ break;
+ else
+ nq = 0;
+ }
+
+ // Fragezeichen durch UPD-Nummer ersetzen
+ if( nq == aUPD.Len() )
+ rFilter.Replace( npq, nq, aUPD );
+
+ // Sternchen suchen
+ pSource = rFilter.GetBuffer();
+ for( i = 0, nq = 0; pSource != pEnd; i++ )
+ {
+ if( *pSource++ == '*' )
+ {
+ if( nq == 0 )
+ npq=i;
+ nq++;
+ }
+ else if( nq == 2 )
+ break;
+ else
+ nq=0;
+ }
+ // Sternchen durch Plattform-Kuerzel ersetzen
+ if( nq == 2 )
+ rFilter.Replace( npq, nq, aDllExt );
+}
+
+//--------------------------------------------------------------------------
+
+static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, const String& rFilterExt, Config* pOptions )
+{
+ Graphic aGraphic;
+ ByteString aResMgrName( "svt", 3 );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ if ( ( rGraphic.GetType() != GRAPHIC_NONE ) && pOptions )
+ {
+ String aStrMode( rFilterExt );
+ sal_Int32 nMode;
+ aStrMode += String( ResId( KEY_MODE, pResMgr ) );
+
+ nMode = pOptions->ReadKey( ByteString( aStrMode, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+
+ if( rGraphic.GetType() == GRAPHIC_BITMAP )
+ {
+ // Auflösung wird eingestellt
+ if( nMode == 1 )
+ {
+ Bitmap aBitmap( rGraphic.GetBitmap() );
+ MapMode aMap( MAP_100TH_INCH );
+
+ String aKey( rFilterExt );
+ aKey += String( ResId( KEY_RES, pResMgr ) );
+ long nDPI = pOptions->ReadKey( ByteString( aKey, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+ Fraction aFrac( 1, Min( Max( nDPI, 75L ), 600L ) );
+
+ aMap.SetScaleX( aFrac );
+ aMap.SetScaleY( aFrac );
+
+ Size aOldSize = aBitmap.GetSizePixel();
+ aBitmap.SetPrefMapMode( aMap );
+ aBitmap.SetPrefSize( Size( aOldSize.Width() * 100,
+ aOldSize.Height() * 100 ) );
+
+ aGraphic = Graphic( aBitmap );
+ }
+ // Groesse wird eingestellt
+ else if( nMode == 2 )
+ {
+ Bitmap aBitmap( rGraphic.GetBitmap() );
+ String aKeyDX( rFilterExt );
+ aKeyDX += String( ResId( KEY_SIZEX, pResMgr ) );
+ long nDX = pOptions->ReadKey( ByteString( aKeyDX, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+ String aKeyDY( rFilterExt );
+ aKeyDY += String( ResId( KEY_SIZEY, pResMgr ) );
+ long nDY = pOptions->ReadKey( ByteString( aKeyDY, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+
+ aBitmap.SetPrefMapMode( MapMode( MAP_100TH_MM ) );
+ aBitmap.SetPrefSize( Size( nDX, nDY ) );
+ aGraphic = Graphic( aBitmap );
+ }
+ else
+ aGraphic = rGraphic;
+ }
+ else
+ {
+ if( ( nMode == 1 ) || ( nMode == 2 ) )
+ {
+ GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() );
+ String aKeyDX( rFilterExt );
+ aKeyDX += String( ResId( KEY_SIZEX, pResMgr ) );
+ long nDX = pOptions->ReadKey( ByteString( aKeyDX, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+ String aKeyDY( rFilterExt );
+ aKeyDY += String( ResId( KEY_SIZEY, pResMgr ) );
+ long nDY = pOptions->ReadKey( ByteString( aKeyDY, RTL_TEXTENCODING_UTF8 ) ).ToInt32();
+ Size aNewSize( OutputDevice::LogicToLogic( Size( nDX, nDY ), MAP_100TH_MM, aMtf.GetPrefMapMode() ) );
+
+ if( aNewSize.Width() && aNewSize.Height() )
+ {
+ const Size aPrefSize( aMtf.GetPrefSize() );
+ aMtf.Scale( Fraction( aNewSize.Width(), aPrefSize.Width() ),
+ Fraction( aNewSize.Height(), aPrefSize.Height() ) );
+ }
+
+ aGraphic = Graphic( aMtf );
+ }
+ else
+ aGraphic = rGraphic;
+ }
+ }
+ else
+ aGraphic = rGraphic;
+
+ delete pResMgr;
+
+ return aGraphic;
+}
+
+// --------------------------
+// - ImpFilterLibCacheEntry -
+// --------------------------
+
+class ImpFilterLibCache;
+
+struct ImpFilterLibCacheEntry
+{
+ ImpFilterLibCacheEntry* mpNext;
+ ::vos::OModule maLibrary;
+ String maFiltername;
+ PFilterCall mpfnImport;
+ PFilterDlgCall mpfnImportDlg;
+
+ ImpFilterLibCacheEntry( const String& rPathname, const String& rFiltername );
+ int operator==( const String& rFiltername ) const { return maFiltername == rFiltername; }
+
+ PFilterCall GetImportFunction();
+ PFilterDlgCall GetImportDlgFunction();
+ PFilterCall GetExportFunction() { return (PFilterCall) maLibrary.getSymbol( UniString::CreateFromAscii( EXPORT_FUNCTION_NAME ) ); }
+ PFilterDlgCall GetExportDlgFunction() { return (PFilterDlgCall) maLibrary.getSymbol( UniString::CreateFromAscii( EXPDLG_FUNCTION_NAME ) ); }
+};
+
+// ------------------------------------------------------------------------
+
+ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const String& rPathname, const String& rFiltername ) :
+ mpNext ( NULL ),
+ maLibrary ( rPathname ),
+ maFiltername ( rFiltername ),
+ mpfnImport ( NULL ),
+ mpfnImportDlg ( NULL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
+{
+ if( !mpfnImport )
+ mpfnImport = (PFilterCall) maLibrary.getSymbol( UniString::CreateFromAscii( IMPORT_FUNCTION_NAME ) );
+
+ return mpfnImport;
+}
+
+// ------------------------------------------------------------------------
+
+PFilterDlgCall ImpFilterLibCacheEntry::GetImportDlgFunction()
+{
+ if( !mpfnImportDlg )
+ mpfnImportDlg = (PFilterDlgCall)maLibrary.getSymbol( UniString::CreateFromAscii( IMPDLG_FUNCTION_NAME ) );
+
+ return mpfnImportDlg;
+}
+
+// ---------------------
+// - ImpFilterLibCache -
+// ---------------------
+
+class ImpFilterLibCache
+{
+ ImpFilterLibCacheEntry* mpFirst;
+ ImpFilterLibCacheEntry* mpLast;
+ ImpFilterLibCacheEntry* mpLastUsed;
+
+public:
+ ImpFilterLibCache();
+ ~ImpFilterLibCache();
+
+ ImpFilterLibCacheEntry* GetFilter( INetURLObject& rFilter, const String& rFiltername );
+};
+
+// ------------------------------------------------------------------------
+
+ImpFilterLibCache::ImpFilterLibCache() :
+ mpFirst ( NULL ),
+ mpLast ( NULL ),
+ mpLastUsed ( NULL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+ImpFilterLibCache::~ImpFilterLibCache()
+{
+ ImpFilterLibCacheEntry* pEntry = mpFirst;
+ while( pEntry )
+ {
+ ImpFilterLibCacheEntry* pNext = pEntry->mpNext;
+ delete pEntry;
+ pEntry = pNext;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ImpFilterLibCacheEntry* ImpFilterLibCache::GetFilter( INetURLObject& rFilter, const String& rFiltername )
+{
+ if( mpLastUsed && ( *mpLastUsed == rFiltername ) )
+ return mpLastUsed;
+ else
+ {
+ ImpFilterLibCacheEntry* pEntry = mpFirst;
+
+ while( pEntry )
+ {
+ if( *pEntry == rFiltername )
+ break;
+ else
+ pEntry = pEntry->mpNext;
+ }
+
+ if( !pEntry )
+ {
+ pEntry = new ImpFilterLibCacheEntry( rFilter.GetFull(), rFiltername );
+
+ if( !mpFirst )
+ mpFirst = mpLast = pEntry;
+ else
+ mpLast = mpLast->mpNext = pEntry;
+ }
+
+ mpLastUsed = pEntry;
+ return pEntry;
+ }
+};
+
+// ------------------------------------------------------------------------
+
+static ImpFilterLibCache aCache;
+
+// -----------------
+// - GraphicFilter -
+// -----------------
+
+GraphicFilter::GraphicFilter()
+{
+ ImplInit( String() );
+}
+
+// ------------------------------------------------------------------------
+
+GraphicFilter::GraphicFilter( const INetURLObject& rPath )
+{
+ ImplInit( rPath.PathToFileName() );
+}
+
+// ------------------------------------------------------------------------
+
+GraphicFilter::GraphicFilter( const String& rMultiPath )
+{
+ ImplInit( rMultiPath );
+}
+
+// ------------------------------------------------------------------------
+
+GraphicFilter::~GraphicFilter()
+{
+ // no graphic filter, no handler => restore old handler
+ if( !--nFilterCount )
+ Application::SetFilterHdl( aLastFilterHdl );
+
+ String aCfgPath( pConfig->GetPathName() );
+
+ delete pErrorEx;
+ delete pConfig;
+ delete pConfigPath;
+ delete pFilterPath;
+ delete pOptionsConfigPath;
+
+ if( pOptionsConfig )
+ {
+ pOptionsConfig->Flush();
+ delete pOptionsConfig;
+ }
+ ImplDirEntryHelper::Kill( aCfgPath );
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::ImplInit( const String& rInitPath )
+{
+ pErrorEx = new FilterErrorEx;
+ pConfig = new Config( TempFile::CreateTempName() );
+ pConfig->EnablePersistence( FALSE );
+ pConfigPath = new String;
+ pFilterPath = new String;
+ pOptionsConfigPath = new String;
+
+ ImplCreateMultiConfig( rInitPath );
+ pOptionsConfig = NULL;
+ bOptionsEnabled = FALSE;
+ nPercent = 0;
+ bAbort = FALSE;
+ bCacheEnabled = TRUE;
+
+ // first instance of GraphicFilter sets link
+ if( !nFilterCount++ )
+ {
+ // save old link
+ aLastFilterHdl = Application::GetFilterHdl();
+ Application::SetFilterHdl( LINK( this, GraphicFilter, FilterCallback ) );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::ImplCreateMultiConfig( const String& rMultiPath )
+{
+ *pConfigPath = rMultiPath;
+
+ if( rMultiPath.Len() )
+ {
+ for( long i = rMultiPath.GetTokenCount( ';' ); i; )
+ {
+ Config aCfg( rMultiPath.GetToken( (USHORT) --i, ';' ) );
+
+ // clone import entries
+ if( aCfg.HasGroup( IMP_FILTERSECTION ) )
+ {
+ aCfg.SetGroup( IMP_FILTERSECTION );
+ pConfig->SetGroup( IMP_FILTERSECTION );
+
+ for( USHORT n = 0, nCount = aCfg.GetKeyCount(); n < nCount; n++ )
+ pConfig->WriteKey( aCfg.GetKeyName( n ), aCfg.ReadKey( n ) );
+ }
+
+ // clone export entries
+ if( aCfg.HasGroup( EXP_FILTERSECTION ) )
+ {
+ aCfg.SetGroup( EXP_FILTERSECTION );
+ pConfig->SetGroup( EXP_FILTERSECTION );
+
+ for( USHORT n = 0, nCount = aCfg.GetKeyCount(); n < nCount; n++ )
+ pConfig->WriteKey( aCfg.GetKeyName( n ), aCfg.ReadKey( n ) );
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GraphicFilter::ImplSetError( ULONG nError, const SvStream* pStm )
+{
+ pErrorEx->nFilterError = nError;
+ pErrorEx->nStreamError = pStm ? pStm->GetError() : ERRCODE_NONE;
+ return nError;
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::EnableConfigCache( BOOL bEnable )
+{
+ bCacheEnabled = bEnable;
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::SetConfigPath( const INetURLObject& rPath )
+{
+ SetConfigPath( rPath.PathToFileName() );
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::SetConfigPath( const String& rMultiPath )
+{
+ // delete old import group
+ if( pConfig->HasGroup( IMP_FILTERSECTION ) )
+ pConfig->DeleteGroup( IMP_FILTERSECTION );
+
+ // delete old export group
+ if( pConfig->HasGroup( EXP_FILTERSECTION ) )
+ pConfig->DeleteGroup( EXP_FILTERSECTION );
+
+ ImplCreateMultiConfig( rMultiPath );
+}
+
+// ------------------------------------------------------------------------
+
+const String& GraphicFilter::GetConfigPath() const
+{
+ DBG_ASSERT( pConfigPath, "GraphicFilter::GetConfigPath(): Missing ConfigPath!" );
+ return *pConfigPath;
+}
+
+// ------------------------------------------------------------------------
+
+Config& GraphicFilter::GetConfig() const
+{
+ DBG_ASSERT( pConfig, "GraphicFilter::GetConfig(): Missing Config!" );
+ return *pConfig;
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::SetFilterPath( const INetURLObject& rPath )
+{
+ SetFilterPath( rPath.PathToFileName() );
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::SetFilterPath( const String& rMultiPath )
+{
+ *pFilterPath = rMultiPath;
+
+ // delete old filter path group
+ if( pConfig->HasGroup( IMPEXP_FILTERPATHES ) )
+ pConfig->DeleteGroup( IMPEXP_FILTERPATHES );
+
+ pConfig->SetGroup( IMPEXP_FILTERPATHES );
+
+ // add new pathes to group
+ for( USHORT i = 0, nCount = rMultiPath.GetTokenCount( ';' ); i < nCount; i++ )
+ {
+ INetURLObject aPath;
+ aPath.SetSmartURL( rMultiPath.GetToken( i, ';' ) );
+ if( ImplDirEntryHelper::Exists( aPath ) )
+ {
+ ByteString aKey( 'P' );
+ aKey += ByteString::CreateFromInt32( i );
+ pConfig->WriteKey( aKey, aPath.PathToFileName(), RTL_TEXTENCODING_UTF8 );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+const String& GraphicFilter::GetFilterPath() const
+{
+ DBG_ASSERT( pFilterPath, "GraphicFilter::GetFilterPath(): Missing FilterPath!" );
+ return *pFilterPath;
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::SetOptionsConfigPath( const INetURLObject& rConfigPath )
+{
+ const String aNewPath( rConfigPath.PathToFileName() );
+
+ if( aNewPath != GetOptionsConfigPath() )
+ {
+ *pOptionsConfigPath = aNewPath;
+
+ if( pOptionsConfig )
+ {
+ pOptionsConfig->Flush();
+ delete pOptionsConfig;
+ }
+
+ if( aNewPath.Len() )
+ {
+ pOptionsConfig = new Config( aNewPath );
+ pOptionsConfig->SetGroup( OPT_FILTERSECTION );
+ bOptionsEnabled = TRUE;
+ }
+ else
+ {
+ pOptionsConfig = NULL;
+ bOptionsEnabled = FALSE;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+const String& GraphicFilter::GetOptionsConfigPath() const
+{
+ DBG_ASSERT( pOptionsConfigPath, "GraphicFilter::GetOptionsConfigPath(): Missing OptionsConfigPath!" );
+ return *pOptionsConfigPath;
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::GetImportFormatCount()
+{
+ DBG_ASSERT (pConfig,"GraphicFilter::GetImportFormatCount() : no Config" );
+
+ pConfig->SetGroup( IMP_FILTERSECTION );
+ return pConfig->GetKeyCount();
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::GetImportFormatNumber( const String& rFormatName )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::GetImportFormatNumber() : no Config" );
+
+ pConfig->SetGroup( IMP_FILTERSECTION );
+
+ USHORT nKeys = pConfig->GetKeyCount();
+ USHORT i = 0;
+ String aFormatStr;
+ String aUpperFormat( rFormatName );
+
+ aUpperFormat.ToUpperAscii();
+
+ xub_StrLen nLen = aUpperFormat.Len();
+ while( i < nKeys )
+ {
+ UniString aFormat( pConfig->ReadKey( i ), RTL_TEXTENCODING_UTF8 );
+ if( ImpGetFormatName( aFormat ).CompareIgnoreCaseToAscii( aUpperFormat.GetBuffer(), nLen ) == COMPARE_EQUAL )
+ break;
+
+ i++;
+ }
+
+ return( ( i == nKeys ) ? GRFILTER_FORMAT_NOTFOUND : i );
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetImportFormatName( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::GetImportFormatName() : no Config" );
+
+ pConfig->SetGroup( IMP_FILTERSECTION );
+ UniString aFormat( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 );
+ return ImpGetFormatName( aFormat );
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetImportFormatShortName( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::GetImportFormatShortName() : no Config" );
+
+ pConfig->SetGroup( IMP_FILTERSECTION );
+ return UniString( pConfig->GetKeyName( nFormat ), RTL_TEXTENCODING_UTF8 );
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetImportFormatType( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::GetImportFormatType() : no Config" );
+
+ pConfig->SetGroup( IMP_FILTERSECTION );
+
+#ifdef MAC
+
+ String aStr=ImpGetMacType( pConfig->ReadKey( nFormat ) );
+
+ if( !aStr.Len() )
+ {
+ aStr = "????.";
+ aStr += ImpGetFormatExtension( pConfig->ReadKey(nFormat) );
+ }
+
+ return aStr;
+
+#else
+
+ return ImpGetFormatExtension( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) );
+
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetImportOSFileType( USHORT nFormat )
+{
+ String aOSFileType;
+
+#ifdef MAC
+
+ DBG_ASSERT( pConfig,"GraphicFilter::GetImportOSFileType() : no Config" );
+ pConfig->SetGroup( IMP_FILTERSECTION );
+ aOSFileType = ImpGetMacType( pConfig->ReadKey( nFormat ) );
+
+#endif
+
+ return aOSFileType;
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetImportWildcard( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::GetImportWildcard() : no Config" );
+
+ String aWildcard( UniString::CreateFromAscii( "*.", 2 ) );
+ pConfig->SetGroup( IMP_FILTERSECTION );
+ aWildcard.Append( ImpGetFormatExtension( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) ) );
+ return aWildcard;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GraphicFilter::IsImportPixelFormat( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::IsImportPixelFormat() : no Config" );
+
+ pConfig->SetGroup( IMP_FILTERSECTION );
+ return ( ImpGetNthEntry( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ), 5 )
+ .CompareIgnoreCaseToAscii( "PIX", 3 ) == COMPARE_EQUAL );
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::GetExportFormatCount()
+{
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+ return pConfig->GetKeyCount();
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::GetExportFormatNumber( const String& rFormatName )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+
+ USHORT nKeys = pConfig->GetKeyCount();
+ USHORT i = 0;
+ String aUpperFormat( rFormatName );
+ while( i < nKeys )
+ {
+ UniString aTemp( pConfig->ReadKey( i ), RTL_TEXTENCODING_UTF8 );
+ if( ImpGetFormatName( aTemp ).EqualsIgnoreCaseAscii( aUpperFormat ) )
+ break;
+ i++;
+ }
+
+ return( ( i == nKeys ) ? GRFILTER_FORMAT_NOTFOUND : i );
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetExportFormatName( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+ return ImpGetFormatName( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) );
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetExportFormatShortName( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+ return UniString( pConfig->GetKeyName( nFormat ), RTL_TEXTENCODING_UTF8 );
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetExportFormatType( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+
+#ifdef MAC
+
+ String aStr = ImpGetMacType( pConfig->ReadKey( nFormat ) );
+
+ if ( !aStr.Len() )
+ {
+ aStr = "????.";
+ aStr += ImpGetFormatExtension( pConfig->ReadKey(nFormat) );
+ }
+
+ return aStr;
+
+#else
+
+ return ImpGetFormatExtension( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) );
+
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetExportOSFileType( USHORT nFormat )
+{
+ String aOSFileType;
+
+#ifdef MAC
+
+ DBG_ASSERT( pConfig,"GraphicFilter::GetExportOSFileType() : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+ aOSFileType = ImpGetMacType( pConfig->ReadKey( nFormat ) );
+
+#endif
+
+ return aOSFileType;
+}
+
+// ------------------------------------------------------------------------
+
+String GraphicFilter::GetExportWildcard( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::GetExportWildcard() : no Config" );
+
+ String aWildcard( UniString::CreateFromAscii( "*.", 2 ) );
+ pConfig->SetGroup( EXP_FILTERSECTION );
+ aWildcard.Append( ImpGetFormatExtension( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) ) );
+ return aWildcard;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GraphicFilter::IsExportPixelFormat( USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter::IsExportPixelFormat() : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+ return ( ImpGetNthEntry( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ), 5 )
+ .CompareIgnoreCaseToAscii( "PIX", 3 ) == COMPARE_EQUAL );
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::CanImportGraphic( const INetURLObject& rPath,
+ USHORT nFormat, USHORT* pDeterminedFormat )
+{
+ String aPath( rPath.PathToFileName() );
+ SvFileStream aIStream( aPath, STREAM_READ | STREAM_SHARE_DENYNONE );
+
+ return CanImportGraphic( aPath, aIStream, nFormat, pDeterminedFormat );
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::CanImportGraphic( const String& rPath, SvStream& rIStream,
+ USHORT nFormat, USHORT* pDeterminedFormat )
+{
+ DBG_ASSERT(pConfig,"GraphicFilter:: : no Config");
+
+ if( !bCacheEnabled || pConfig->GetGroup() != IMP_FILTERSECTION )
+ pConfig->SetGroup( IMP_FILTERSECTION );
+
+ ULONG nStreamPos = rIStream.Tell();
+ USHORT nRes = ImpTestOrFindFormat( *this, *pConfig, rPath, rIStream, NULL, &nFormat );
+
+ rIStream.Seek(nStreamPos);
+
+ if( nRes==GRFILTER_OK && pDeterminedFormat!=NULL )
+ *pDeterminedFormat = nFormat;
+
+ return (USHORT) ImplSetError( nRes, &rIStream );
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath,
+ USHORT nFormat, USHORT * pDeterminedFormat )
+{
+ const String aPath( rPath.PathToFileName() );
+ SvFileStream aIStm( aPath, STREAM_READ | STREAM_SHARE_DENYNONE );
+
+ return ImportGraphic( rGraphic, aPath, aIStm, nFormat, pDeterminedFormat );
+}
+
+//-------------------------------------------------------------------------
+
+USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream,
+ USHORT nFormat, USHORT* pDeterminedFormat )
+{
+ ImpFilterCallbackData aCallbackData;
+ String aFilterName;
+ String aConfigString;
+ String aUpperName;
+ ULONG nStmBegin;
+ USHORT nStatus;
+ GraphicReader* pContext = rGraphic.GetContext();
+ GfxLinkType eLinkType = GFX_LINK_TYPE_NONE;
+ BOOL bDummyContext = ( pContext == (GraphicReader*) 1 );
+ const BOOL bLinkSet = rGraphic.IsLink();
+
+ ResetLastError();
+
+ if( !pContext || bDummyContext )
+ {
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+
+ if( bDummyContext )
+ {
+ rGraphic.SetContext( NULL );
+ nStmBegin = 0;
+ }
+ else
+ nStmBegin = rIStream.Tell();
+
+ if( !bCacheEnabled || pConfig->GetGroup() != IMP_FILTERSECTION )
+ pConfig->SetGroup( IMP_FILTERSECTION );
+
+ aCallbackData.pFilt = this;
+ aCallbackData.pPercent = &nPercent;
+ aCallbackData.pUpdatePercentHdl = &aUpdatePercentHdlLink;
+ aCallbackData.pAbort = &bAbort;
+ aCallbackData.nFilePercentOfTotal = 100;
+ bAbort = FALSE;
+ nPercent = 0;
+ nStatus = ImpTestOrFindFormat( *this, *pConfig, rPath, rIStream, &aConfigString, &nFormat );
+
+ // Falls Pending, geben wir GRFILTER_OK zurueck,
+ // um mehr Bytes anzufordern
+ if( rIStream.GetError() == ERRCODE_IO_PENDING )
+ {
+ rGraphic.SetContext( (GraphicReader*) 1 );
+ rIStream.ResetError();
+ rIStream.Seek( nStmBegin );
+ return (USHORT) ImplSetError( GRFILTER_OK );
+ }
+
+ rIStream.Seek( nStmBegin );
+
+ if( ( nStatus != GRFILTER_OK ) || rIStream.GetError() )
+ return (USHORT) ImplSetError( ( nStatus != GRFILTER_OK ) ? nStatus : GRFILTER_OPENERROR, &rIStream );
+
+ if( pDeterminedFormat != NULL )
+ *pDeterminedFormat = nFormat;
+
+ aUpperName = aFilterName = ImpGetFilterName( aConfigString );
+ aUpperName.ToUpperAscii();
+ }
+ else
+ {
+ if( pContext && !bDummyContext )
+ aUpperName = pContext->GetUpperFilterName();
+
+ nStmBegin = 0;
+ nStatus = GRFILTER_OK;
+ }
+
+ // read graphic
+ if( aUpperName.CompareToAscii( IMP_GIF ) == COMPARE_EQUAL )
+ {
+ if( rGraphic.GetContext() == (GraphicReader*) 1 )
+ rGraphic.SetContext( NULL );
+
+ if( !ImportGIF( rIStream, rGraphic, NULL ) )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ eLinkType = GFX_LINK_TYPE_NATIVE_GIF;
+ }
+ else if( aUpperName.CompareToAscii( IMP_PNG ) == COMPARE_EQUAL )
+ {
+ if ( rGraphic.GetContext() == (GraphicReader*) 1 )
+ rGraphic.SetContext( NULL );
+ if ( !ImportPNG( rIStream, rGraphic, NULL ) )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ eLinkType = GFX_LINK_TYPE_NATIVE_PNG;
+ }
+ else if( aUpperName.CompareToAscii( IMP_JPEG ) == COMPARE_EQUAL )
+ {
+ if( rGraphic.GetContext() == (GraphicReader*) 1 )
+ rGraphic.SetContext( NULL );
+
+ if( !ImportJPEG( rIStream, rGraphic, NULL ) )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ eLinkType = GFX_LINK_TYPE_NATIVE_JPG;
+ }
+ else if( aUpperName.CompareToAscii( IMP_XBM ) == COMPARE_EQUAL )
+ {
+ if( rGraphic.GetContext() == (GraphicReader*) 1 )
+ rGraphic.SetContext( NULL );
+
+ if( !ImportXBM( rIStream, rGraphic, NULL ) )
+ nStatus = GRFILTER_FILTERERROR;
+ }
+ else if( aUpperName.CompareToAscii( IMP_XPM ) == COMPARE_EQUAL )
+ {
+ if( rGraphic.GetContext() == (GraphicReader*) 1 )
+ rGraphic.SetContext( NULL );
+
+ if( !ImportXPM( rIStream, rGraphic, NULL ) )
+ nStatus = GRFILTER_FILTERERROR;
+ }
+ else if( ( aUpperName.CompareToAscii( IMP_BMP ) == COMPARE_EQUAL ) ||
+ ( aUpperName.CompareToAscii( IMP_SVMETAFILE ) == COMPARE_EQUAL ) )
+ {
+ // SV interne Importfilter fuer Bitmaps und MetaFiles
+ aStartFilterHdlLink.Call( this );
+ nPercent = 60;
+ aUpdatePercentHdlLink.Call( this );
+ rIStream >> rGraphic;
+ nPercent = 100;
+ aUpdatePercentHdlLink.Call( this );
+
+ if( rIStream.GetError() )
+ nStatus = GRFILTER_FORMATERROR;
+ }
+ else if( ( aUpperName.CompareToAscii( IMP_WMF ) == COMPARE_EQUAL ) ||
+ ( aUpperName.CompareToAscii( IMP_EMF ) == COMPARE_EQUAL ) )
+ {
+ GDIMetaFile aMtf;
+ aStartFilterHdlLink.Call( this );
+ nPercent = 1;
+
+ if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, &ImpFilterCallback, &aCallbackData ) )
+ nStatus = GRFILTER_FORMATERROR;
+ else
+ {
+ rGraphic = aMtf;
+ eLinkType = GFX_LINK_TYPE_NATIVE_WMF;
+ }
+ }
+ else if( ( aUpperName.CompareToAscii( IMP_SVSGF ) == COMPARE_EQUAL )
+ || ( aUpperName.CompareToAscii( IMP_SVSGV ) == COMPARE_EQUAL ) )
+ {
+ USHORT nVersion;
+ unsigned char nTyp = CheckSgfTyp( rIStream, nVersion );
+
+ switch( nTyp )
+ {
+ case SGF_BITIMAGE:
+ {
+ String aTempFileName( TempFile::CreateTempName() );
+ SvFileStream aTempStream( aTempFileName, STREAM_READ | STREAM_WRITE | STREAM_SHARE_DENYNONE );
+
+ if( aTempStream.GetError() )
+ return GRFILTER_OPENERROR;
+
+ // SGF in temporaere Datei filtern
+ aStartFilterHdlLink.Call( this );
+ nPercent = 30;
+ aUpdatePercentHdlLink.Call( this );
+
+ if( !SgfBMapFilter( rIStream, aTempStream ) )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ {
+ nPercent = 60;
+ aUpdatePercentHdlLink.Call( this );
+ aTempStream.Seek( 0L );
+ aTempStream >> rGraphic;
+
+ nPercent = 100;
+ aUpdatePercentHdlLink.Call( this );
+ if( aTempStream.GetError() )
+ nStatus = GRFILTER_FILTERERROR;
+ }
+ aTempStream.Close();
+ ImplDirEntryHelper::Kill( aTempFileName );
+ }
+ break;
+
+ case SGF_SIMPVECT:
+ {
+ GDIMetaFile aMtf;
+
+ aStartFilterHdlLink.Call( this );
+ nPercent = 50;
+ aUpdatePercentHdlLink.Call( this );
+ if( !SgfVectFilter( rIStream, aMtf ) )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ {
+ nPercent = 100;
+ aUpdatePercentHdlLink.Call( this );
+ rGraphic = Graphic( aMtf );
+ }
+ }
+ break;
+
+ case SGF_STARDRAW:
+ {
+ if( nVersion != SGV_VERSION )
+ nStatus = GRFILTER_VERSIONERROR;
+ else
+ {
+ GDIMetaFile aMtf;
+
+ aStartFilterHdlLink.Call( this );
+ nPercent = 50;
+ aUpdatePercentHdlLink.Call( this );
+ if( !SgfSDrwFilter( rIStream, aMtf, aFilterPath, aFilterPath, aConfigPath ) )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ {
+ nPercent = 100;
+ aUpdatePercentHdlLink.Call( this );
+ rGraphic = Graphic( aMtf );
+ }
+ }
+ }
+ break;
+
+ default:
+ {
+ nStatus = GRFILTER_FORMATERROR;
+ }
+ break;
+ }
+ }
+ else if( ImpGetFilterVendor( aConfigString ).CompareIgnoreCaseToAscii( "SD", 2 ) == COMPARE_EQUAL )
+ {
+ ImpFilterLibCacheEntry* pFilter = NULL;
+
+ pConfig->SetGroup( IMPEXP_FILTERPATHES );
+ ImpCorrectFilterUpdateNumber( aFilterName );
+
+ // find first filter in filter pathes
+ for( USHORT i = 0, nPathCount = pConfig->GetKeyCount(); i < nPathCount; i++ )
+ {
+ INetURLObject aFilterPath;
+ aFilterPath.SetSmartURL( UniString( pConfig->ReadKey( i ), RTL_TEXTENCODING_UTF8 ) );
+ aFilterPath.Append( aFilterName );
+ if ( pFilter = aCache.GetFilter( aFilterPath, aFilterName ) )
+ {
+ if ( ImplDirEntryHelper::Exists( aFilterPath ) )
+ break;
+ }
+ }
+
+ if( !pFilter )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ {
+ PFilterCall pFunc = pFilter->GetImportFunction();
+
+ if( !pFunc )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ {
+ aStartFilterHdlLink.Call( this );
+ aUpdatePercentHdlLink.Call( this );
+
+ if( !(*pFunc)( rIStream, rGraphic, &ImpFilterCallback, &aCallbackData, GetOptionsConfig(), FALSE ) )
+ nStatus = GRFILTER_FORMATERROR;
+ else
+ {
+ nPercent = 100;
+ aUpdatePercentHdlLink.Call( this );
+
+ // try to set link type if format matches
+ if( nFormat != GRFILTER_FORMAT_DONTKNOW )
+ {
+ const String aShortName( GetImportFormatShortName( nFormat ).ToUpperAscii() );
+
+ if( aShortName.CompareToAscii( TIF_SHORTNAME ) == COMPARE_EQUAL )
+ eLinkType = GFX_LINK_TYPE_NATIVE_TIF;
+ else if( aShortName.CompareToAscii( MET_SHORTNAME ) == COMPARE_EQUAL )
+ eLinkType = GFX_LINK_TYPE_NATIVE_MET;
+ else if( aShortName.CompareToAscii( PCT_SHORTNAME ) == COMPARE_EQUAL )
+ eLinkType = GFX_LINK_TYPE_NATIVE_PCT;
+ }
+ }
+ }
+ }
+ }
+ else
+ nStatus = GRFILTER_FILTERERROR;
+
+ // Set error code or try to set native buffer
+ if( nStatus != GRFILTER_OK )
+ {
+ if( bAbort )
+ nStatus = GRFILTER_ABORT;
+
+ ImplSetError( nStatus, &rIStream );
+ rIStream.Seek( nStmBegin );
+ rGraphic.Clear();
+
+ if( nPercent )
+ aErrorHdlLink.Call( this );
+ }
+ else if( ( eLinkType != GFX_LINK_TYPE_NONE ) && !rGraphic.GetContext() && !bLinkSet )
+ {
+ const ULONG nStmEnd = rIStream.Tell();
+ const ULONG nBufSize = nStmEnd - nStmBegin;
+
+ if( nBufSize )
+ {
+ BYTE* pBuf = new BYTE[ nBufSize ];
+ GraphicReader* pOldContext = rGraphic.GetContext();
+
+ rIStream.Seek( nStmBegin );
+ rIStream.Read( pBuf, nBufSize );
+ rGraphic.SetLink( GfxLink( pBuf, nBufSize, eLinkType, TRUE ) );
+ }
+ }
+
+ if( nPercent && !pContext )
+ {
+ nPercent = 0;
+ aEndFilterHdlLink.Call( this );
+ }
+
+ return nStatus;
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath, USHORT nFormat )
+{
+ const BOOL bAlreadyExists = ImplDirEntryHelper::Exists( rPath );
+ const String aPath( rPath.PathToFileName() );
+ SvFileStream aOStm( aPath, STREAM_WRITE | STREAM_TRUNC );
+ USHORT nRet = ExportGraphic( rGraphic, aPath, aOStm, nFormat );
+
+ aOStm.Close();
+
+ if( ( GRFILTER_OK != nRet ) && !bAlreadyExists )
+ ImplDirEntryHelper::Kill( aPath );
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPath,
+ SvStream& rOStm, USHORT nFormat )
+{
+ DBG_ASSERT( pConfig, "GraphicFilter:: : no Config" );
+
+ USHORT nFormatCount = GetExportFormatCount();
+
+ ResetLastError();
+
+ if( nFormat == GRFILTER_FORMAT_DONTKNOW )
+ {
+ INetURLObject aURL;
+ aURL.SetSmartURL( rPath );
+ String aExt( aURL.GetFileExtension().ToUpperAscii() );
+
+
+ for( USHORT i = 0; i < nFormatCount; i++ )
+ {
+ if ( ImpGetFormatExtension( UniString( pConfig->ReadKey( i ), RTL_TEXTENCODING_UTF8 ) )
+ .CompareIgnoreCaseToAscii( aExt ) == COMPARE_EQUAL )
+ {
+ nFormat=i;
+ break;
+ }
+ }
+ }
+
+ if( nFormat >= nFormatCount )
+ return (USHORT) ImplSetError( GRFILTER_FORMATERROR );
+
+ ImpFilterCallbackData aCallbackData;
+ aCallbackData.pFilt=this;
+ aCallbackData.pPercent=&nPercent;
+ aCallbackData.pUpdatePercentHdl=&aUpdatePercentHdlLink;
+ aCallbackData.pAbort=&bAbort;
+ aCallbackData.nFilePercentOfTotal=100;
+ bAbort=FALSE;
+
+ String aKey( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 );
+ String aFilterName( ImpGetFilterName( aKey ) );
+ String aUpperName( aFilterName );
+ String aFilterVendor( ImpGetFilterVendor( aKey ).ToUpperAscii() );
+ String aPixOrVec( ImpGetFilterPixOrVec( aKey).ToUpperAscii() );
+
+ aUpperName.ToUpperAscii();
+ nPercent=0;
+ aStartFilterHdlLink.Call(this);
+ aUpdatePercentHdlLink.Call(this);
+
+ USHORT nStatus = GRFILTER_OK;
+ GraphicType eType;
+ Graphic aGraphic( ImpGetScaledGraphic( rGraphic,
+ UniString( pConfig->GetKeyName( nFormat ), RTL_TEXTENCODING_UTF8 ),
+ GetOptionsConfig() ) );
+
+ eType = aGraphic.GetType();
+
+ if( aPixOrVec.CompareToAscii( "PIX", 3 ) == COMPARE_EQUAL )
+ {
+ if( eType != GRAPHIC_BITMAP )
+ {
+ Size aSizePixel;
+ ULONG nColorCount,nBitsPerPixel,nNeededMem,nMaxMem;
+ VirtualDevice aVirDev;
+
+ // Maximalen Speicherbedarf fuer das Bildes holen:
+ if( GetOptionsConfig() )
+ nMaxMem = (UINT32)GetOptionsConfig()->ReadKey( "VEC-TO-PIX-MAX-KB", "1024" ).ToInt32();
+ else
+ nMaxMem = 1024;
+
+ nMaxMem *= 1024; // In Bytes
+
+ // Berechnen, wie gross das Bild normalerweise werden wuerde:
+ aSizePixel=aVirDev.LogicToPixel(aGraphic.GetPrefSize(),aGraphic.GetPrefMapMode());
+
+ // Berechnen, wieviel Speicher das Bild benoetigen wuerde:
+ nColorCount=aVirDev.GetColorCount();
+ if (nColorCount<=2) nBitsPerPixel=1;
+ else if (nColorCount<=4) nBitsPerPixel=2;
+ else if (nColorCount<=16) nBitsPerPixel=4;
+ else if (nColorCount<=256) nBitsPerPixel=8;
+ else if (nColorCount<=65536) nBitsPerPixel=16;
+ else nBitsPerPixel=24;
+ nNeededMem=((ULONG)aSizePixel.Width()*(ULONG)aSizePixel.Height()*nBitsPerPixel+7)/8;
+
+ // ggf. Groesse des Bildes einschraenken:
+ if (nMaxMem<nNeededMem)
+ {
+ double fFak=sqrt(((double)nMaxMem)/((double)nNeededMem));
+ aSizePixel.Width()=(ULONG)(((double)aSizePixel.Width())*fFak);
+ aSizePixel.Height()=(ULONG)(((double)aSizePixel.Height())*fFak);
+ }
+
+ aVirDev.SetMapMode(MapMode(MAP_PIXEL));
+ aVirDev.SetOutputSizePixel(aSizePixel);
+ Graphic aGraphic2=aGraphic;
+ aGraphic2.Draw(&aVirDev,Point(0,0),aSizePixel); // Gemein: dies aendert den MapMode
+ aVirDev.SetMapMode(MapMode(MAP_PIXEL));
+ aGraphic=Graphic(aVirDev.GetBitmap(Point(0,0),aSizePixel));
+ }
+ }
+ else if ( aPixOrVec.CompareToAscii( "VEC", 3 ) != COMPARE_EQUAL )
+ nStatus=GRFILTER_FILTERERROR;
+
+ if( GRFILTER_OK == nStatus )
+ {
+ if( aUpperName.CompareToAscii( EXP_BMP ) == COMPARE_EQUAL )
+ {
+ nPercent = 60;
+ aUpdatePercentHdlLink.Call( this );
+
+ if( !rOStm.GetError() )
+ {
+ Bitmap aBmp( aGraphic.GetBitmap() );
+
+ if( GetOptionsConfig() )
+ {
+ ResMgr* pResMgr = CREATERESMGR( svt );
+ UniString aRLEKey( pConfig->GetKeyName( nFormat ), RTL_TEXTENCODING_UTF8 );
+
+ aRLEKey += UniString( ResId( KEY_RLE_CODING, pResMgr ) );
+ ByteString aRLEStr( GetOptionsConfig()->ReadKey( ByteString( aRLEKey, RTL_TEXTENCODING_UTF8 ) ) );
+
+ // Wollen wir RLE-Kodiert speichern?
+ aGraphic.GetBitmap().Write( rOStm, aRLEStr.CompareIgnoreCaseToAscii( "FALSE", 5 ) != COMPARE_EQUAL );
+
+ delete pResMgr;
+ }
+ else
+ rOStm << aBmp;
+ }
+
+ nPercent = 90;
+ aUpdatePercentHdlLink.Call( this );
+
+ if( rOStm.GetError() )
+ nStatus = GRFILTER_IOERROR;
+ }
+ else if( aUpperName.CompareToAscii( EXP_SVMETAFILE ) == COMPARE_EQUAL )
+ {
+ if( !rOStm.GetError() )
+ {
+ GDIMetaFile aMTF;
+
+ if ( eType != GRAPHIC_BITMAP )
+ aMTF = aGraphic.GetGDIMetaFile();
+ else
+ {
+ VirtualDevice aVirDev;
+
+ aMTF.Record( &aVirDev );
+ aGraphic.Draw( &aVirDev, Point(), aGraphic.GetPrefSize() );
+ aMTF.Stop();
+ aMTF.SetPrefSize( aGraphic.GetPrefSize() );
+ aMTF.SetPrefMapMode( aGraphic.GetPrefMapMode() );
+ }
+
+ nPercent = 60;
+ aUpdatePercentHdlLink.Call( this );
+ rOStm << aMTF;
+ nPercent = 90;
+ aUpdatePercentHdlLink.Call( this );
+ }
+
+ if( rOStm.GetError() )
+ nStatus = GRFILTER_IOERROR;
+ }
+ else if ( aUpperName.CompareToAscii( EXP_WMF ) == COMPARE_EQUAL )
+ {
+ if( !rOStm.GetError() )
+ {
+ if( eType == GRAPHIC_GDIMETAFILE )
+ {
+ if ( !ConvertGDIMetaFileToWMF( aGraphic.GetGDIMetaFile(), rOStm, &ImpFilterCallback, &aCallbackData ) )
+ nStatus = GRFILTER_FORMATERROR;
+ }
+ else
+ {
+ Bitmap aBmp( aGraphic.GetBitmap() );
+ GDIMetaFile aMTF;
+ VirtualDevice aVirDev;
+
+ aMTF.Record( &aVirDev );
+ aVirDev.DrawBitmap( Point(), aBmp );
+ aMTF.Stop();
+ aMTF.SetPrefSize( aBmp.GetSizePixel() );
+
+ if( !ConvertGDIMetaFileToWMF( aMTF, rOStm, &ImpFilterCallback, &aCallbackData) )
+ nStatus = GRFILTER_FORMATERROR;
+ }
+ }
+
+ if( rOStm.GetError() )
+ nStatus = GRFILTER_IOERROR;
+ }
+ else if ( aUpperName.CompareToAscii( EXP_EMF ) == COMPARE_EQUAL )
+ {
+ if( !rOStm.GetError() )
+ {
+ if( eType == GRAPHIC_GDIMETAFILE )
+ {
+ if ( !ConvertGDIMetaFileToEMF( aGraphic.GetGDIMetaFile(), rOStm, &ImpFilterCallback, &aCallbackData ) )
+ nStatus = GRFILTER_FORMATERROR;
+ }
+ else
+ {
+ Bitmap aBmp( aGraphic.GetBitmap() );
+ GDIMetaFile aMTF;
+ VirtualDevice aVirDev;
+
+ aMTF.Record( &aVirDev );
+ aVirDev.DrawBitmap( Point(), aBmp );
+ aMTF.Stop();
+ aMTF.SetPrefSize( aBmp.GetSizePixel() );
+
+ if( !ConvertGDIMetaFileToEMF( aMTF, rOStm, &ImpFilterCallback, &aCallbackData) )
+ nStatus = GRFILTER_FORMATERROR;
+ }
+ }
+
+ if( rOStm.GetError() )
+ nStatus = GRFILTER_IOERROR;
+ }
+ else if( aUpperName.CompareToAscii( EXP_JPEG ) == COMPARE_EQUAL )
+ {
+ if( !rOStm.GetError() )
+ {
+ if( !ExportJPEG( rOStm, aGraphic, &ImpFilterCallback, &aCallbackData, GetOptionsConfig() ) )
+ nStatus = GRFILTER_FORMATERROR;
+ }
+
+ if( rOStm.GetError() )
+ nStatus = GRFILTER_IOERROR;
+ }
+ else if( aUpperName.CompareToAscii( EXP_SVG ) == COMPARE_EQUAL )
+ {
+ if( !rOStm.GetError() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr( ::utl::getProcessServiceFactory() );
+
+ if( xMgr.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > xSaxWriter( xMgr->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" ) ), ::com::sun::star::uno::UNO_QUERY );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::svg::XSVGWriter > xSVGWriter( xMgr->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.svg.SVGWriter" ) ), ::com::sun::star::uno::UNO_QUERY );
+
+ if( xSaxWriter.is() && xSVGWriter.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > xActiveDataSource(
+ xSaxWriter, ::com::sun::star::uno::UNO_QUERY );
+
+ if( xActiveDataSource.is() )
+ {
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xStmIf(
+ static_cast< ::cppu::OWeakObject* >( new ImpFilterOutputStream( rOStm ) ) );
+
+ SvMemoryStream aMemStm( 65535, 65535 );
+
+ aMemStm.SetCompressMode( COMPRESSMODE_FULL );
+ ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( aMemStm );
+
+ nPercent = 60;
+ aUpdatePercentHdlLink.Call( this );
+
+ xActiveDataSource->setOutputStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >(
+ xStmIf, ::com::sun::star::uno::UNO_QUERY ) );
+ ::com::sun::star::uno::Sequence< sal_Int8 > aMtfSeq( (sal_Int8*) aMemStm.GetData(), aMemStm.Tell() );
+ xSVGWriter->write( xSaxWriter, aMtfSeq );
+ nPercent = 90;
+ aUpdatePercentHdlLink.Call( this );
+ }
+ }
+ }
+ }
+ }
+ else if( aFilterVendor.CompareToAscii( "SD" ) == COMPARE_EQUAL )
+ {
+ INetURLObject aFilterFilePath;
+ BOOL bFound = FALSE;
+
+ pConfig->SetGroup( IMPEXP_FILTERPATHES );
+ ImpCorrectFilterUpdateNumber( aFilterName );
+
+ // find first filter in filter pathes
+ for( USHORT i = 0, nPathCount = pConfig->GetKeyCount(); i < nPathCount; i++ )
+ {
+ aFilterFilePath.SetSmartURL( UniString( pConfig->ReadKey( i ), RTL_TEXTENCODING_UTF8 ) );
+ aFilterFilePath.Append( aFilterName );
+ if( ImplDirEntryHelper::Exists( aFilterFilePath ) )
+ {
+ bFound = TRUE;
+ break;
+ }
+ }
+
+ if( !bFound )
+ nStatus = GRFILTER_FILTERERROR;
+ else
+ {
+ ::vos::OModule aLibrary( aFilterFilePath.PathToFileName() );
+ PFilterCall pFunc = (PFilterCall) aLibrary.getSymbol( UniString::CreateFromAscii( EXPORT_FUNCTION_NAME ) );
+
+ if( pFunc )
+ {
+ if( !rOStm.GetError() )
+ {
+ if ( !(*pFunc)( rOStm, aGraphic, &ImpFilterCallback, &aCallbackData, GetOptionsConfig(), FALSE ) )
+ nStatus = GRFILTER_FORMATERROR;
+ }
+ else
+ nStatus = GRFILTER_IOERROR;
+ }
+ else
+ nStatus = GRFILTER_FILTERERROR;
+ }
+ }
+ else
+ nStatus = GRFILTER_FILTERERROR;
+ }
+
+ if( nStatus != GRFILTER_OK )
+ {
+ if( bAbort )
+ nStatus = GRFILTER_ABORT;
+
+ ImplSetError( nStatus, &rOStm );
+ aErrorHdlLink.Call( this );
+ }
+ else
+ {
+ nPercent = 100;
+ aUpdatePercentHdlLink.Call( this );
+ }
+
+ aEndFilterHdlLink.Call( this );
+
+ return nStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GraphicFilter::Setup( USHORT nFormat )
+{
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GraphicFilter::HasImportDialog( USHORT nFormat )
+{
+ BOOL bRet = FALSE;
+
+ if( pConfig && GetOptionsConfig() )
+ {
+ pConfig->SetGroup( IMP_FILTERSECTION );
+ bRet = ( ImpGetFilterDialog( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) ).CompareToAscii( "TRUE", 4 ) == COMPARE_EQUAL );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GraphicFilter::DoImportDialog( Window* pWindow, USHORT nFormat )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+ DBG_ASSERT( GetOptionsConfig(),"GraphicFilter:: : no OptionsConfig" );
+
+ pConfig->SetGroup( IMP_FILTERSECTION );
+
+ String aFilterName( ImpGetFilterName( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) ) );
+ String aUpperName( aFilterName );
+ BOOL bRet = FALSE;
+
+ aUpperName.ToUpperAscii();
+
+ if( ( aUpperName.CompareToAscii( IMP_BMP ) == COMPARE_EQUAL ) || ( aUpperName.CompareToAscii( IMP_SVMETAFILE ) == COMPARE_EQUAL ) )
+ {
+ // Bitmaps und SV-MetaFiles
+ }
+ else if( aUpperName.CompareToAscii( IMP_WMF ) == COMPARE_EQUAL )
+ {
+ // Import-Filter fuer WMF
+ }
+ else if( ( aUpperName.CompareToAscii( IMP_SVSGF ) == COMPARE_EQUAL ) || ( aUpperName.CompareToAscii( IMP_SVSGV ) ) )
+ {
+ // StarDraw- und StarWriter-Filter
+ }
+ else
+ {
+ // ladbare Filter
+ String aFilterVendor( ImpGetFilterVendor( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) ) );
+
+ // eigene Filter
+ if( aFilterVendor.CompareToAscii( "SD", 2 ) == COMPARE_EQUAL )
+ {
+ ImpFilterLibCacheEntry* pFilter = NULL;
+
+ pConfig->SetGroup( IMPEXP_FILTERPATHES );
+ ImpCorrectFilterUpdateNumber( aFilterName );
+
+ // find first filter in filter pathes
+ for( USHORT i = 0, nPathCount = pConfig->GetKeyCount(); i < nPathCount; i++ )
+ {
+ INetURLObject aFilterPath;
+ aFilterPath.SetSmartURL( UniString( pConfig->ReadKey( i ), RTL_TEXTENCODING_UTF8 ) );
+ if ( pFilter = aCache.GetFilter( aFilterPath, aFilterName ) )
+ {
+ aFilterPath.Append( aFilterName );
+ if ( ImplDirEntryHelper::Exists( aFilterPath ) )
+ break;
+ }
+ }
+
+ if( pFilter )
+ {
+ PFilterDlgCall pFunc = pFilter->GetImportDlgFunction();
+
+ // Dialog in DLL ausfuehren
+ if( pFunc )
+ {
+ FltCallDialogParameter aFltCallDlgPara( pWindow, NULL, GetOptionsConfig(), FUNIT_MM );
+ bRet = (*pFunc)( aFltCallDlgPara );
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GraphicFilter::HasExportDialog( USHORT nFormat )
+{
+ BOOL bRet = FALSE;
+
+ if( pConfig && GetOptionsConfig() )
+ {
+ pConfig->SetGroup( EXP_FILTERSECTION );
+ bRet = ( ImpGetFilterDialog( UniString( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 ) )
+ .CompareToAscii( "TRUE", 4 ) == COMPARE_EQUAL );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GraphicFilter::DoExportDialog( Window* pWindow, USHORT nFormat )
+{
+ return DoExportDialog( pWindow, nFormat, FUNIT_MM );
+}
+
+BOOL GraphicFilter::DoExportDialog( Window* pWindow, USHORT nFormat, FieldUnit eFieldUnit )
+{
+ DBG_ASSERT( pConfig,"GraphicFilter:: : no Config" );
+
+ pConfig->SetGroup( EXP_FILTERSECTION );
+
+ String aKey( pConfig->ReadKey( nFormat ), RTL_TEXTENCODING_UTF8 );
+ String aFilterName( ImpGetFilterName( aKey ) );
+ String aUpperName( aFilterName );
+ String aFilterVendor( ImpGetFilterVendor( aKey ).ToUpperAscii() );
+ BOOL bRet = FALSE;
+
+ aUpperName.ToUpperAscii();
+
+ if( GetOptionsConfig() )
+ GetOptionsConfig()->Update();
+
+ // Export-Dialog fuer Bitmap's, SVM's und WMF's
+ if( ( aUpperName.CompareToAscii( EXP_BMP ) == COMPARE_EQUAL ) ||
+ ( aUpperName.CompareToAscii( EXP_SVMETAFILE ) == COMPARE_EQUAL ) ||
+ ( aUpperName.CompareToAscii( EXP_WMF ) == COMPARE_EQUAL ) ||
+ ( aUpperName.CompareToAscii( EXP_EMF ) == COMPARE_EQUAL ) ||
+ ( aUpperName.CompareToAscii( EXP_JPEG ) == COMPARE_EQUAL ) )
+ {
+ ByteString aResMgrName( "svt", 3 );
+ ResMgr* pResMgr;
+
+ aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) );
+ pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetAppInternational().GetLanguage() );
+
+ FltCallDialogParameter aFltCallDlgPara( pWindow, pResMgr, GetOptionsConfig(), eFieldUnit );
+
+ // JPEG-Dialog
+ if( aUpperName.CompareToAscii( EXP_JPEG ) == COMPARE_EQUAL )
+ bRet = ( DlgExportEJPG( aFltCallDlgPara ).Execute() == RET_OK );
+ // Fuer Bitmaps nehmen wir den Pixel-Dialog
+ else if( aUpperName.CompareToAscii( EXP_BMP ) != COMPARE_EQUAL )
+ {
+ aFltCallDlgPara.aFilterExt = UniString( pConfig->GetKeyName( nFormat ), RTL_TEXTENCODING_UTF8 );
+ bRet = ( DlgExportVec( aFltCallDlgPara ).Execute() == RET_OK );
+ }
+ // Fuer Vektorformate nehmen wir den Vektor-Dialog
+ else
+ {
+ aFltCallDlgPara.aFilterExt = UniString( pConfig->GetKeyName( nFormat ), RTL_TEXTENCODING_UTF8 );
+ bRet = ( DlgExportPix( aFltCallDlgPara ).Execute() == RET_OK );
+ }
+
+
+ delete pResMgr;
+ }
+ // ladbare Filter
+ else
+ {
+ // eigene Filter
+ if( aFilterVendor.CompareToAscii( "SD", 2 ) == COMPARE_EQUAL )
+ {
+ INetURLObject aFilterFilePath;
+ BOOL bFound = FALSE;
+
+ pConfig->SetGroup( IMPEXP_FILTERPATHES );
+ ImpCorrectFilterUpdateNumber( aFilterName );
+
+ // find first filter in filter pathes
+ for( USHORT i = 0, nPathCount = pConfig->GetKeyCount(); i < nPathCount; i++ )
+ {
+ aFilterFilePath.SetSmartURL( UniString( pConfig->ReadKey( i ), RTL_TEXTENCODING_UTF8 ) );
+ aFilterFilePath.Append( aFilterName );
+
+ if( ImplDirEntryHelper::Exists( aFilterFilePath ) )
+ {
+ bFound = TRUE;
+ break;
+ }
+ }
+
+ if( bFound )
+ {
+ ::vos::OModule aLibrary( aFilterFilePath.PathToFileName() );
+ PFilterDlgCall pFunc = (PFilterDlgCall) aLibrary.getSymbol( UniString( EXPDLG_FUNCTION_NAME, RTL_TEXTENCODING_UTF8 ) );
+
+ // Dialog in DLL ausfuehren
+ if( pFunc )
+ {
+ FltCallDialogParameter aFltCallDlgPara( pWindow, NULL, GetOptionsConfig(), eFieldUnit );
+ bRet = (*pFunc)( aFltCallDlgPara );
+ }
+ }
+ }
+ }
+
+ if( bRet && GetOptionsConfig() )
+ GetOptionsConfig()->Flush();
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+const FilterErrorEx& GraphicFilter::GetLastError() const
+{
+ return *pErrorEx;
+}
+
+// ------------------------------------------------------------------------
+
+void GraphicFilter::ResetLastError()
+{
+ pErrorEx->nFilterError = pErrorEx->nStreamError = 0UL;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( GraphicFilter, FilterCallback, ConvertData*, pData )
+{
+ long nRet = 0L;
+
+ if( pData )
+ {
+ USHORT nFormat = GRFILTER_FORMAT_DONTKNOW;
+ ByteString aShortName;
+ const BOOL bOptions = AreOptionsEnabled();
+
+ EnableOptions( FALSE );
+
+ switch( pData->mnFormat )
+ {
+ case( CVT_BMP ): aShortName = BMP_SHORTNAME; break;
+ case( CVT_GIF ): aShortName = GIF_SHORTNAME; break;
+ case( CVT_JPG ): aShortName = JPG_SHORTNAME; break;
+ case( CVT_MET ): aShortName = MET_SHORTNAME; break;
+ case( CVT_PCT ): aShortName = PCT_SHORTNAME; break;
+ case( CVT_PNG ): aShortName = PNG_SHORTNAME; break;
+ case( CVT_SVM ): aShortName = SVM_SHORTNAME; break;
+ case( CVT_TIF ): aShortName = TIF_SHORTNAME; break;
+ case( CVT_WMF ): aShortName = WMF_SHORTNAME; break;
+ case( CVT_EMF ): aShortName = EMF_SHORTNAME; break;
+
+ default:
+ break;
+ }
+
+ if( GRAPHIC_NONE == pData->maGraphic.GetType() || pData->maGraphic.GetContext() ) // Import
+ {
+ if( aShortName.Len() )
+ {
+ for( USHORT i = 0, nCount = GetImportFormatCount(); i < nCount; i++ )
+ {
+ ByteString aImpShortName( GetImportFormatShortName( i ), RTL_TEXTENCODING_UTF8 );
+ aImpShortName.ToUpperAscii();
+ if( aImpShortName.CompareTo( aShortName ) == COMPARE_EQUAL )
+ {
+ nFormat = i;
+ break;
+ }
+ }
+ }
+
+ nRet = ( ImportGraphic( pData->maGraphic, String(), pData->mrStm, nFormat ) == GRFILTER_OK );
+ }
+ else if( aShortName.Len() ) // Export
+ {
+ for( USHORT i = 0, nCount = GetExportFormatCount(); i < nCount; i++ )
+ {
+ ByteString aExpShortName( GetExportFormatShortName( i ), RTL_TEXTENCODING_UTF8 );
+ aExpShortName.ToUpperAscii();
+ if( aExpShortName.CompareTo( aShortName ) == COMPARE_EQUAL )
+ {
+ nFormat = i;
+ break;
+ }
+ }
+
+ if( nFormat )
+ nRet = ( ExportGraphic( pData->maGraphic, String(), pData->mrStm, nFormat ) == GRFILTER_OK );
+ }
+
+ EnableOptions( bOptions );
+ }
+
+ return nRet;
+}
diff --git a/svtools/source/filter.vcl/filter/filter2.cxx b/svtools/source/filter.vcl/filter/filter2.cxx
new file mode 100644
index 000000000000..01dd188534d7
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/filter2.cxx
@@ -0,0 +1,1427 @@
+/*************************************************************************
+ *
+ * $RCSfile: filter2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <stdio.h>
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/config.hxx>
+#include "filter.hxx"
+
+#define DATA_SIZE 640
+#define IMP_FILTERSECTION "Graphics Filters - Import"
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphicDescriptor::GraphicDescriptor( const String* pPath )
+{
+ ImpConstruct();
+
+ if ( pPath )
+ {
+ INetURLObject aURL( *pPath, INET_PROT_FILE );
+ aPathExt = aURL.GetFileExtension().ToLowerAscii();
+ }
+
+ bLinked = TRUE;
+ bLinkChanged = FALSE;
+ bWideSearch = FALSE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphicDescriptor::GraphicDescriptor( const INetURLObject& rPath ) :
+ aFileStm( rPath.PathToFileName(), STREAM_READ ),
+ aPathExt( rPath.GetFileExtension().ToLowerAscii() )
+{
+ ImpConstruct();
+
+ if ( aFileStm.IsOpen() && !aFileStm.GetError() )
+ {
+ nStmPos = 0;
+ aFileStm.Seek( nStmPos );
+ bDataReady = TRUE;
+ }
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphicDescriptor::GraphicDescriptor( SvStream& rInStream, const String* pPath)
+{
+ ImpConstruct();
+
+ if ( pPath )
+ {
+ INetURLObject aURL( *pPath, INET_PROT_FILE );
+// aURL.SetSmartURL( *pPath );
+ aPathExt = aURL.GetFileExtension().ToLowerAscii();
+ }
+
+ nStmPos = rInStream.Tell();
+ pBaseStm = &rInStream;
+ bBaseStm = TRUE;
+
+ if ( !pBaseStm->GetError() )
+ bDataReady = TRUE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+GraphicDescriptor::~GraphicDescriptor()
+{
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::Detect( BOOL bExtendedInfo )
+{
+ BOOL bRet = FALSE;
+
+ // Link-Status ueberpruefen
+ if ( bLinked && bLinkChanged )
+ {
+ DBG_ASSERT( aReqLink.IsSet(), "Wo ist der RequestHandler???" );
+ if ( pMemStm = (SvStream*) aReqLink.Call( this ) )
+ {
+ nStmPos = pMemStm->Tell();
+ bDataReady = TRUE;
+ }
+ }
+
+ if ( bDataReady )
+ {
+ SvStream& rStm = GetSearchStream();
+ UINT16 nOldFormat = rStm.GetNumberFormatInt();
+
+ if ( ImpDetectGIF( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectJPG( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectBMP( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectPNG( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectTIF( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectPCX( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectDXF( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectMET( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectSGF( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectSGV( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectSVM( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectWMF( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectEMF( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectPCT( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectXBM( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectXPM( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectPBM( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectPGM( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectPPM( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectRAS( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectTGA( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectPSD( rStm, bExtendedInfo ) ) bRet = TRUE;
+ else if ( ImpDetectEPS( rStm, bExtendedInfo ) ) bRet = TRUE;
+
+ // diese Formate lassen sich nur bei WideSearch im gesamten
+ // Stream ermitteln
+ else if ( bWideSearch )
+ {
+ if ( ImpDetectPCD( rStm, bExtendedInfo ) )
+ bRet = TRUE;
+ }
+
+ rStm.SetNumberFormatInt( nOldFormat );
+ rStm.Seek( nStmPos );
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::IsDataReady() const
+{
+ return bDataReady;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::IsWideSearch() const
+{
+ return bWideSearch;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+SvStream& GraphicDescriptor::GetSearchStream() const
+{
+ DBG_ASSERT( bDataReady, "Was laeuft hier falsch???" );
+
+ if ( bLinked )
+ return *pMemStm;
+ else if ( bBaseStm )
+ return *pBaseStm;
+ else
+ return (SvStream&) aFileStm;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphicDescriptor::SetRequestHdl( const Link& rRequestLink )
+{
+ aReqLink = rRequestLink;
+ bLinkChanged = TRUE;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+ULONG GraphicDescriptor::GetRequestedByteCount() const
+{
+ return DATA_SIZE;
+}
+
+
+/******************************************************************************/
+/* IMP-Methoden */
+/* */
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+void GraphicDescriptor::ImpConstruct()
+{
+ nFormat = GFF_NOT;
+ nBitsPerPixel = 0;
+ nPlanes = 0;
+ bCompressed = FALSE;
+ bDataReady = FALSE;
+ bLinked = FALSE;
+ bWideSearch = TRUE;
+ bBaseStm = FALSE;
+ pMemStm = NULL;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectBMP( SvStream& rStm, BOOL bExtendedInfo )
+{
+ UINT16 nTemp16;
+ BOOL bRet = FALSE;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStm.Seek( nStmPos );
+
+ rStm >> nTemp16;
+
+ // OS/2-BitmapArray
+ if ( nTemp16 == 0x4142 )
+ {
+ rStm.SeekRel( 0x0c );
+ rStm >> nTemp16;
+ }
+
+ // Bitmap
+ if ( nTemp16 == 0x4d42 )
+ {
+ nFormat = GFF_BMP;
+ bRet = TRUE;
+
+ if ( bExtendedInfo )
+ {
+ UINT32 nTemp32;
+ UINT32 nCompression;
+
+ // bis zur ersten Information
+ rStm.SeekRel( 0x10 );
+
+ // PixelBreite auslesen
+ rStm >> nTemp32;
+ aPixSize.Width() = nTemp32;
+
+ // PixelHoehe auslesen
+ rStm >> nTemp32;
+ aPixSize.Height() = nTemp32;
+
+ // Planes auslesen
+ rStm >> nTemp16;
+ nPlanes = nTemp16;
+
+ // BitCount auslesen
+ rStm >> nTemp16;
+ nBitsPerPixel = nTemp16;
+
+ // Compression auslesen
+ rStm >> nTemp32;
+ bCompressed = ( ( nCompression = nTemp32 ) > 0 );
+
+ // logische Breite
+ rStm.SeekRel( 4 );
+ rStm >> nTemp32;
+ if ( nTemp32 )
+ aLogSize.Width() = ( aPixSize.Width() * 100000 ) / nTemp32;
+
+ // logische Hoehe
+ rStm >> nTemp32;
+ if ( nTemp32 )
+ aLogSize.Height() = ( aPixSize.Height() * 100000 ) / nTemp32;
+
+ // Wir wollen noch etwas feiner differenzieren und
+ // auf sinnvolle Werte ueberpruefen ( Bug-Id #29001 )
+ if ( ( nBitsPerPixel > 24 ) || ( nCompression > 3 ) )
+ {
+ nFormat = GFF_NOT;
+ bRet = FALSE;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectGIF( SvStream& rStm, BOOL bExtendedInfo )
+{
+ UINT32 nTemp32;
+ UINT16 nTemp16;
+ BOOL bRet = FALSE;
+ BYTE cByte;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStm.Seek( nStmPos );
+
+ rStm >> nTemp32;
+ if ( nTemp32 == 0x38464947 )
+ {
+ rStm >> nTemp16;
+ if ( ( nTemp16 == 0x6137 ) || ( nTemp16 == 0x6139 ) )
+ {
+ nFormat = GFF_GIF;
+ bRet = TRUE;
+
+ if ( bExtendedInfo )
+ {
+ UINT16 nTemp16;
+
+ // PixelBreite auslesen
+ rStm >> nTemp16;
+ aPixSize.Width() = nTemp16;
+
+ // PixelHoehe auslesen
+ rStm >> nTemp16;
+ aPixSize.Height() = nTemp16;
+
+ // Bits/Pixel auslesen
+ rStm >> cByte;
+ nBitsPerPixel = ( ( cByte & 112 ) >> 4 ) + 1;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectJPG( SvStream& rStm, BOOL bExtendedInfo )
+{
+ UINT32 nTemp32;
+ BOOL bRet = FALSE;
+ BYTE cByte;
+ BOOL bM_COM;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ rStm.Seek( nStmPos );
+
+ rStm >> nTemp32;
+
+ // compare upper 28 bits
+ if( 0xffd8ff00 == ( nTemp32 & 0xffffff00 ) )
+ {
+ nFormat = GFF_JPG;
+ return TRUE;
+ }
+
+ bM_COM = ( nTemp32 == 0xffd8fffe );
+ if ( ( nTemp32 == 0xffd8ffe0 ) || bM_COM )
+ {
+ if( !bM_COM )
+ {
+ rStm.SeekRel( 2 );
+ rStm >> nTemp32;
+ }
+
+ if( bM_COM || ( nTemp32 == 0x4a464946 ) )
+ {
+ nFormat = GFF_JPG;
+ bRet = TRUE;
+
+ if( bExtendedInfo )
+ {
+ MapMode aMap;
+ UINT16 nTemp16;
+ ULONG nCount = 9;
+ ULONG nMax;
+ ULONG nResX;
+ ULONG nResY;
+ BYTE cUnit;
+
+ // Groesse des verbleibenden Puffers ermitteln
+ if ( bLinked )
+ nMax = ( (SvMemoryStream&) rStm ).GetSize() - 16;
+ else
+ nMax = DATA_SIZE - 16;
+
+ // max. 8K
+ nMax = Min( nMax, (ULONG) 8192 );
+
+ // Res-Unit ermitteln
+ rStm.SeekRel( 3 );
+ rStm >> cUnit;
+
+ // ResX ermitteln
+ rStm >> nTemp16;
+ nResX = nTemp16;
+
+ // ResY ermitteln
+ rStm >> nTemp16;
+ nResY = nTemp16;
+
+ // SOF0/1-Marker finden, aber dabei
+ // nicht mehr als DATA_SIZE Pixel lesen, falls
+ // kein WideSearch
+ do
+ {
+ while ( ( cByte != 0xff ) &&
+ ( bWideSearch || ( nCount++ < nMax ) ) )
+ {
+ rStm >> cByte;
+ }
+
+ while ( ( cByte == 0xff ) &&
+ ( bWideSearch || ( nCount++ < nMax ) ) )
+ {
+ rStm >> cByte;
+ }
+ }
+ while ( ( cByte != 0xc0 ) &&
+ ( cByte != 0xc1 ) &&
+ ( bWideSearch || ( nCount < nMax ) ) );
+
+ // wir haben den SOF0/1-Marker
+ if ( ( cByte == 0xc0 ) || ( cByte == 0xc1 ) )
+ {
+ // Hoehe einlesen
+ rStm.SeekRel( 3 );
+ rStm >> nTemp16;
+ aPixSize.Height() = nTemp16;
+
+ // Breite einlesen
+ rStm >> nTemp16;
+ aPixSize.Width() = nTemp16;
+
+ // Bit/Pixel einlesen
+ rStm >> cByte;
+ nBitsPerPixel = ( cByte == 3 ? 24 : cByte == 1 ? 8 : 0 );
+
+ // logische Groesse setzen
+ if ( cUnit && nResX && nResY )
+ {
+ aMap.SetMapUnit( cUnit == 1 ? MAP_INCH : MAP_CM );
+ aMap.SetScaleX( Fraction( 1, nResX ) );
+ aMap.SetScaleY( Fraction( 1, nResY ) );
+ aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap,
+ MapMode( MAP_100TH_MM ) );
+ }
+
+ // Planes immer 1
+ nPlanes = 1;
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPCD( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet = FALSE;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStm.Seek( nStmPos );
+
+ if ( bWideSearch )
+ {
+ UINT32 nTemp32;
+ UINT16 nTemp16;
+ BYTE cByte;
+
+ rStm.SeekRel( 2048 );
+ rStm >> nTemp32;
+ rStm >> nTemp16;
+ rStm >> cByte;
+
+ if ( ( nTemp32 == 0x5f444350 ) &&
+ ( nTemp16 == 0x5049 ) &&
+ ( cByte == 0x49 ) )
+ {
+ nFormat = GFF_PCD;
+ bRet = TRUE;
+ }
+ }
+ else if ( bRet = ( aPathExt.CompareToAscii( "pcd", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_PCD;
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPCX( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet = FALSE;
+ BYTE cByte;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStm.Seek( nStmPos );
+
+ rStm >> cByte;
+ if ( cByte == 0x0a )
+ {
+ nFormat = GFF_PCX;
+ bRet = TRUE;
+
+ if ( bExtendedInfo )
+ {
+ UINT16 nTemp16;
+ USHORT nXmin;
+ USHORT nXmax;
+ USHORT nYmin;
+ USHORT nYmax;
+ USHORT nDPIx;
+ USHORT nDPIy;
+
+
+ rStm.SeekRel( 1 );
+
+ // Kompression lesen
+ rStm >> cByte;
+ bCompressed = ( cByte > 0 );
+
+ // Bits/Pixel lesen
+ rStm >> cByte;
+ nBitsPerPixel = cByte;
+
+ // Bildabmessungen
+ rStm >> nTemp16;
+ nXmin = nTemp16;
+ rStm >> nTemp16;
+ nYmin = nTemp16;
+ rStm >> nTemp16;
+ nXmax = nTemp16;
+ rStm >> nTemp16;
+ nYmax = nTemp16;
+
+ aPixSize.Width() = nXmax - nXmin + 1;
+ aPixSize.Height() = nYmax - nYmin + 1;
+
+ // Aufloesung
+ rStm >> nTemp16;
+ nDPIx = nTemp16;
+ rStm >> nTemp16;
+ nDPIy = nTemp16;
+
+ // logische Groesse setzen
+ MapMode aMap( MAP_INCH, Point(),
+ Fraction( 1, nDPIx ), Fraction( 1, nDPIy ) );
+ aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap,
+ MapMode( MAP_100TH_MM ) );
+
+
+ // Anzahl Farbebenen
+ rStm.SeekRel( 49 );
+ rStm >> cByte;
+ nPlanes = cByte;
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPNG( SvStream& rStm, BOOL bExtendedInfo )
+{
+ UINT32 nTemp32;
+ BOOL bRet = FALSE;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ rStm.Seek( nStmPos );
+
+ rStm >> nTemp32;
+ if ( nTemp32 == 0x89504e47 )
+ {
+ rStm >> nTemp32;
+ if ( nTemp32 == 0x0d0a1a0a )
+ {
+ nFormat = GFF_PNG;
+ bRet = TRUE;
+
+ if ( bExtendedInfo )
+ {
+ BYTE cByte;
+
+ // IHDR-Chunk
+ rStm.SeekRel( 8 );
+
+ // Breite einlesen
+ rStm >> nTemp32;
+ aPixSize.Width() = nTemp32;
+
+ // Hoehe einlesen
+ rStm >> nTemp32;
+ aPixSize.Height() = nTemp32;
+
+ // Bits/Pixel einlesen
+ rStm >> cByte;
+ nBitsPerPixel = cByte;
+
+ // Planes immer 1;
+ // Kompression immer
+ nPlanes = 1;
+ bCompressed = TRUE;
+
+ if ( bWideSearch )
+ {
+ BOOL bOk = FALSE;
+ UINT32 nLen32;
+
+ rStm.SeekRel( 8 );
+
+ // so lange ueberlesen, bis wir den pHYs-Chunk haben oder
+ // den Anfang der Bilddaten
+ rStm >> nLen32;
+ rStm >> nTemp32;
+ while( ( nTemp32 != 0x70485973 ) && ( nTemp32 != 0x49444154 ) )
+ {
+ rStm.SeekRel( 4 + nLen32 );
+ rStm >> nLen32;
+ rStm >> nTemp32;
+ }
+
+ if ( nTemp32 == 0x70485973 )
+ {
+ ULONG nXRes;
+ ULONG nYRes;
+
+ // horizontale Aufloesung
+ rStm >> nTemp32;
+ nXRes = nTemp32;
+
+ // vertikale Aufloesung
+ rStm >> nTemp32;
+ nYRes = nTemp32;
+
+ // Unit einlesen
+ rStm >> cByte;
+
+ if ( cByte )
+ {
+ if ( nXRes )
+ aLogSize.Width() = ( aPixSize.Width() * 100000 ) /
+ nTemp32;
+
+ if ( nYRes )
+ aLogSize.Height() = ( aPixSize.Height() * 100000 ) /
+ nTemp32;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectTIF( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bOk = FALSE;
+ BOOL bRet = FALSE;
+ BYTE cByte1;
+ BYTE cByte2;
+
+ rStm.Seek( nStmPos );
+ rStm >> cByte1;
+ rStm >> cByte2;
+ if ( cByte1 == cByte2 )
+ {
+ if ( cByte1 == 0x49 )
+ {
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ bOk = TRUE;
+ }
+ else if ( cByte1 == 0x4d )
+ {
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ bOk = TRUE;
+ }
+
+ if ( bOk )
+ {
+ UINT16 nTemp16;
+
+ rStm >> nTemp16;
+ if ( nTemp16 == 0x2a )
+ {
+ nFormat = GFF_TIF;
+ bRet = TRUE;
+
+ if ( bExtendedInfo )
+ {
+ ULONG nCount;
+ ULONG nMax = DATA_SIZE - 48;
+ UINT32 nTemp32;
+ BOOL bOk;
+
+ // Offset des ersten IFD einlesen
+ rStm >> nTemp32;
+ rStm.SeekRel( ( nCount = ( nTemp32 + 2 ) ) - 0x08 );
+
+ if ( bWideSearch || ( nCount < nMax ) )
+ {
+ // Tag's lesen, bis wir auf Tag256 ( Width ) treffen
+ // nicht mehr Bytes als DATA_SIZE lesen
+ rStm >> nTemp16;
+ while ( ( nTemp16 != 256 ) && ( bOk = ( bWideSearch || ( nCount < nMax ) ) ) )
+ {
+ rStm.SeekRel( 10 );
+ rStm >> nTemp16;
+ nCount += 12;
+ }
+
+ if ( bOk )
+ {
+ // Breite lesen
+ rStm >> nTemp16;
+ rStm.SeekRel( 4 );
+ if ( nTemp16 == 3 )
+ {
+ rStm >> nTemp16;
+ aPixSize.Width() = nTemp16;
+ rStm.SeekRel( 2 );
+ }
+ else
+ {
+ rStm >> nTemp32;
+ aPixSize.Width() = nTemp32;
+ }
+ nCount += 12;
+
+ // Hoehe lesen
+ rStm.SeekRel( 2 );
+ rStm >> nTemp16;
+ rStm.SeekRel( 4 );
+ if ( nTemp16 == 3 )
+ {
+ rStm >> nTemp16;
+ aPixSize.Height() = nTemp16;
+ rStm.SeekRel( 2 );
+ }
+ else
+ {
+ rStm >> nTemp32;
+ aPixSize.Height() = nTemp32;
+ }
+ nCount += 12;
+
+ // ggf. Bits/Pixel lesen
+ rStm >> nTemp16;
+ if ( nTemp16 == 258 )
+ {
+ rStm.SeekRel( 6 );
+ rStm >> nTemp16;
+ nBitsPerPixel = nTemp16;
+ rStm.SeekRel( 2 );
+ nCount += 12;
+ }
+ else
+ rStm.SeekRel( -2 );
+
+ // ggf. Compression lesen
+ rStm >> nTemp16;
+ if ( nTemp16 == 259 )
+ {
+ rStm.SeekRel( 6 );
+ rStm >> nTemp16;
+ bCompressed = ( nTemp16 > 1 );
+ rStm.SeekRel( 2 );
+ nCount += 12;
+ }
+ else
+ rStm.SeekRel( -2 );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectXBM( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "xbm", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_XBM;
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectXPM( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "xpm", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_XPM;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPBM( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet = FALSE;
+
+ // erst auf Datei Extension pruefen, da diese aussagekraeftiger ist
+ // als die 2 ID Bytes
+
+ if ( aPathExt.CompareToAscii( "pbm", 3 ) == COMPARE_EQUAL )
+ bRet = TRUE;
+ else
+ {
+ BYTE nFirst, nSecond;
+ rStm.Seek( nStmPos );
+ rStm >> nFirst >> nSecond;
+ if ( nFirst == 'P' && ( ( nSecond == '1' ) || ( nSecond == '4' ) ) )
+ bRet = TRUE;
+ }
+
+ if ( bRet )
+ nFormat = GFF_PBM;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPGM( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet = FALSE;
+
+ if ( aPathExt.CompareToAscii( "pgm", 3 ) == COMPARE_EQUAL )
+ bRet = TRUE;
+ else
+ {
+ BYTE nFirst, nSecond;
+ rStm.Seek( nStmPos );
+ rStm >> nFirst >> nSecond;
+ if ( nFirst == 'P' && ( ( nSecond == '2' ) || ( nSecond == '5' ) ) )
+ bRet = TRUE;
+ }
+
+ if ( bRet )
+ nFormat = GFF_PGM;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPPM( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet = FALSE;
+
+ if ( aPathExt.CompareToAscii( "ppm", 3 ) == COMPARE_EQUAL )
+ bRet = TRUE;
+ else
+ {
+ BYTE nFirst, nSecond;
+ rStm.Seek( nStmPos );
+ rStm >> nFirst >> nSecond;
+ if ( nFirst == 'P' && ( ( nSecond == '3' ) || ( nSecond == '6' ) ) )
+ bRet = TRUE;
+ }
+
+ if ( bRet )
+ nFormat = GFF_PPM;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectRAS( SvStream& rStm, BOOL bExtendedInfo )
+{
+ UINT32 nMagicNumber;
+ rStm.Seek( nStmPos );
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ rStm >> nMagicNumber;
+ if ( nMagicNumber == 0x59a66a95 )
+ {
+ nFormat = GFF_RAS;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectTGA( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "tga", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_TGA;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPSD( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet = FALSE;
+
+ UINT32 nMagicNumber;
+ rStm.Seek( nStmPos );
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ rStm >> nMagicNumber;
+ if ( nMagicNumber == 0x38425053 )
+ {
+ UINT16 nVersion;
+ rStm >> nVersion;
+ if ( nVersion == 1 )
+ {
+ bRet = TRUE;
+ if ( bExtendedInfo )
+ {
+ UINT16 nChannels;
+ UINT32 nRows;
+ UINT32 nColumns;
+ UINT16 nDepth;
+ UINT16 nMode;
+ rStm.SeekRel( 6 ); // Pad
+ rStm >> nChannels >> nRows >> nColumns >> nDepth >> nMode;
+ if ( ( nDepth == 1 ) || ( nDepth == 8 ) || ( nDepth == 16 ) )
+ {
+ nBitsPerPixel = ( nDepth == 16 ) ? 8 : nDepth;
+ switch ( nChannels )
+ {
+ case 4 :
+ case 3 :
+ nBitsPerPixel = 24;
+ case 2 :
+ case 1 :
+ aPixSize.Width() = nColumns;
+ aPixSize.Height() = nRows;
+ break;
+ default:
+ bRet = FALSE;
+ }
+ }
+ else
+ bRet = FALSE;
+ }
+ }
+ }
+
+ if ( bRet )
+ nFormat = GFF_PSD;
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectEPS( SvStream& rStm, BOOL bExtendedInfo )
+{
+ // es wird die EPS mit Vorschaubild Variante und die Extensionübereinstimmung
+ // geprüft
+
+ UINT32 nFirstLong;
+ rStm.Seek( nStmPos );
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+ rStm >> nFirstLong;
+ if ( ( nFirstLong == 0xC5D0D3C6 ) || ( aPathExt.CompareToAscii( "eps", 3 ) == COMPARE_EQUAL ) )
+ {
+ nFormat = GFF_EPS;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectDXF( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "dxf", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_DXF;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectMET( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "met", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_MET;
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectPCT( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "pct", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_PCT;
+ else
+ {
+ BYTE sBuf[4];
+
+ rStm.Seek( nStmPos + 522 );
+ rStm.Read( sBuf, 3 );
+
+ if( !rStm.GetError() )
+ {
+ if ( ( sBuf[0] == 0x00 ) && ( sBuf[1] == 0x11 ) &&
+ ( ( sBuf[2] == 0x01 ) || ( sBuf[2] == 0x02 ) ) )
+ {
+ bRet = TRUE;
+ nFormat = GFF_PCT;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectSGF( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "sgf",3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_SGF;
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectSGV( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "sgv", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_SGV;
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectSVM( SvStream& rStm, BOOL bExtendedInfo )
+{
+ UINT32 nTemp32;
+ BOOL bRet = FALSE;
+ BYTE cByte;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStm.Seek( nStmPos );
+
+ rStm >> nTemp32;
+ if ( nTemp32 == 0x44475653 )
+ {
+ rStm >> cByte;
+ if ( cByte == 0x49 )
+ {
+ nFormat = GFF_SVM;
+ bRet = TRUE;
+
+ if ( bExtendedInfo )
+ {
+ UINT32 nTemp32;
+ UINT16 nTemp16;
+
+ rStm.SeekRel( 0x04 );
+
+ // Breite auslesen
+ rStm >> nTemp32;
+ aLogSize.Width() = nTemp32;
+
+ // Hoehe auslesen
+ rStm >> nTemp32;
+ aLogSize.Height() = nTemp32;
+
+ // Map-Unit auslesen und PrefSize ermitteln
+ rStm >> nTemp16;
+ aLogSize = OutputDevice::LogicToLogic( aLogSize,
+ MapMode( (MapUnit) nTemp16 ),
+ MapMode( MAP_100TH_MM ) );
+ }
+ }
+ }
+ else
+ {
+ // StringLen-Feld ueberlesen
+ rStm.SeekRel( -2L );
+ rStm >> nTemp32;
+
+ if( nTemp32 == 0x4D4C4356 )
+ {
+ UINT16 nTmp16;
+
+ rStm >> nTmp16;
+
+ if( nTmp16 == 0x4654 )
+ {
+ nFormat = GFF_SVM;
+ bRet = TRUE;
+
+ if( bExtendedInfo )
+ {
+ MapMode aMapMode;
+
+ rStm.SeekRel( 0x06 );
+ rStm >> aMapMode;
+ rStm >> aLogSize;
+ aLogSize = OutputDevice::LogicToLogic( aLogSize, aMapMode, MapMode( MAP_100TH_MM ) );
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectWMF( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "wmf",3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_WMF;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+BOOL GraphicDescriptor::ImpDetectEMF( SvStream& rStm, BOOL bExtendedInfo )
+{
+ BOOL bRet;
+
+ if ( bRet = ( aPathExt.CompareToAscii( "emf", 3 ) == COMPARE_EQUAL ) )
+ nFormat = GFF_EMF;
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|*
+|*
+\************************************************************************/
+
+USHORT GraphicDescriptor::GetImportFormatNumber( USHORT nFormat, Config& rConfig )
+{
+ ByteString aKeyName;
+ const ByteString aOldGroup( rConfig.GetGroup() );
+ USHORT nKeyNumber = GRFILTER_FORMAT_NOTFOUND;
+
+ rConfig.SetGroup( IMP_FILTERSECTION );
+
+ switch( nFormat )
+ {
+ case( GFF_BMP ) : aKeyName = "bmp"; break;
+ case( GFF_GIF ) : aKeyName = "gif"; break;
+ case( GFF_JPG ) : aKeyName = "jpg"; break;
+ case( GFF_PCD ) : aKeyName = "pcd"; break;
+ case( GFF_PCX ) : aKeyName = "pcx"; break;
+ case( GFF_PNG ) : aKeyName = "png"; break;
+ case( GFF_XBM ) : aKeyName = "xbm"; break;
+ case( GFF_XPM ) : aKeyName = "xpm"; break;
+ case( GFF_PBM ) : aKeyName = "pbm"; break;
+ case( GFF_PGM ) : aKeyName = "pgm"; break;
+ case( GFF_PPM ) : aKeyName = "ppm"; break;
+ case( GFF_RAS ) : aKeyName = "ras"; break;
+ case( GFF_TGA ) : aKeyName = "tga"; break;
+ case( GFF_PSD ) : aKeyName = "psd"; break;
+ case( GFF_EPS ) : aKeyName = "eps"; break;
+ case( GFF_TIF ) : aKeyName = "tif"; break;
+ case( GFF_DXF ) : aKeyName = "dxf"; break;
+ case( GFF_MET ) : aKeyName = "met"; break;
+ case( GFF_PCT ) : aKeyName = "pct"; break;
+ case( GFF_SGF ) : aKeyName = "sgf"; break;
+ case( GFF_SGV ) : aKeyName = "sgv"; break;
+ case( GFF_SVM ) : aKeyName = "svm"; break;
+ case( GFF_WMF ) : aKeyName = "wmf"; break;
+ case( GFF_EMF ) : aKeyName = "emf"; break;
+ }
+
+ if( aKeyName.Len() )
+ {
+ for( USHORT i = 0, nCount = rConfig.GetKeyCount(); i < nCount; i++ )
+ {
+ if( rConfig.GetKeyName( i ).CompareIgnoreCaseToAscii( aKeyName ) == COMPARE_EQUAL )
+ {
+ nKeyNumber = i;
+ break;
+ }
+ }
+ }
+
+ rConfig.SetGroup( aOldGroup );
+
+ return nKeyNumber;
+}
diff --git a/svtools/source/filter.vcl/filter/fldll.cxx b/svtools/source/filter.vcl/filter/fldll.cxx
new file mode 100644
index 000000000000..ea9b47083c31
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/fldll.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * $RCSfile: fldll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef WIN
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#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/filter.vcl/filter/gradwrap.cxx b/svtools/source/filter.vcl/filter/gradwrap.cxx
new file mode 100644
index 000000000000..d17c97e04074
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/gradwrap.cxx
@@ -0,0 +1,619 @@
+/*************************************************************************
+ *
+ * $RCSfile: gradwrap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <math.h>
+#include <svgrad.hxx>
+#include <svbmpacc.hxx>
+#include <gradwrap.hxx>
+
+// -------------------
+// - GradientWrapper -
+// -------------------
+
+GradientWrapper::GradientWrapper(const Link& rDrawPolyRecordHdl,
+ const Link& rDrawPolyPolyRecordHdl,
+ const Link& rSetFillInBrushRecordHdl) :
+ aDrawPolyRecordHdl (rDrawPolyRecordHdl),
+ aDrawPolyPolyRecordHdl (rDrawPolyPolyRecordHdl),
+ aSetFillInBrushRecordHdl(rSetFillInBrushRecordHdl)
+{
+}
+
+// ------------------------------------------------------------------------
+
+GradientWrapper::~GradientWrapper()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void GradientWrapper::WriteLinearGradient(const Rectangle& rRect,
+ const Gradient& rGradient)
+{
+ USHORT nStepCount = 100;
+
+ Rectangle aRect = rRect;
+ aRect.Left()--;
+ aRect.Top()--;
+ aRect.Right()++;
+ aRect.Bottom()++;
+
+ // rotiertes BoundRect ausrechnen
+ double fAngle = (rGradient.GetAngle() % 3600) * F_PI1800;
+ double fWidth = aRect.GetWidth();
+ double fHeight = aRect.GetHeight();
+ double fDX = fWidth * fabs( cos( fAngle ) ) +
+ fHeight * fabs( sin( fAngle ) );
+ double fDY = fHeight * fabs( cos( fAngle ) ) +
+ fWidth * fabs( sin( fAngle ) );
+ fDX = (fDX - fWidth) * 0.5 + 0.5;
+ fDY = (fDY - fHeight) * 0.5 + 0.5;
+ aRect.Left() -= (long)fDX;
+ aRect.Right() += (long)fDX;
+ aRect.Top() -= (long)fDY;
+ aRect.Bottom() += (long)fDY;
+
+ // Rand berechnen und Rechteck neu setzen
+ Point aCenter = rRect.Center();
+ Rectangle aFullRect = aRect;
+ long nBorder = (long)rGradient.GetBorder() * aRect.GetHeight() / 100;
+ BOOL bLinear;
+
+ // Rand berechnen und Rechteck neu setzen fuer linearen Farbverlauf
+ if ( rGradient.GetStyle() == GRADIENT_LINEAR )
+ {
+ bLinear = TRUE;
+ aRect.Top() += nBorder;
+ }
+ // Rand berechnen und Rechteck neu setzen fuer axiale Farbverlauf
+ else
+ {
+ bLinear = FALSE;
+ nBorder >>= 1;
+
+ aRect.Top() += nBorder;
+ aRect.Bottom() -= nBorder;
+ }
+
+ // Top darf nicht groesser als Bottom sein
+ aRect.Top() = Min( aRect.Top(), (long)(aRect.Bottom() - 1) );
+
+ long nMinRect = aRect.GetHeight();
+
+ // Anzahl der Schritte berechnen, falls nichts uebergeben wurde
+ if ( !nStepCount )
+ {
+ long nInc = ((nMinRect >> 9) + 1) << 3;
+
+ if ( !nInc )
+ nInc = 1;
+
+ nStepCount = (USHORT)(nMinRect / nInc);
+ }
+ // minimal drei Schritte
+ long nSteps = Max( nStepCount, (USHORT)3 );
+
+ // Falls axialer Farbverlauf, muss die Schrittanzahl ungerade sein
+ if ( !bLinear && !(nSteps & 1) )
+ nSteps++;
+
+ // Berechnung ueber Double-Addition wegen Genauigkeit
+ double fScanLine = aRect.Top();
+ double fScanInc = (double)aRect.GetHeight() / (double)nSteps;
+
+ // Intensitaeten von Start- und Endfarbe ggf. aendern und
+ // Farbschrittweiten berechnen
+ long nFactor;
+ const Color& rStartCol = rGradient.GetStartColor();
+ const Color& rEndCol = rGradient.GetEndColor();
+ long nRed = rStartCol.GetRed();
+ long nGreen = rStartCol.GetGreen();
+ long nBlue = rStartCol.GetBlue();
+ long nEndRed = rEndCol.GetRed();
+ long nEndGreen = rEndCol.GetGreen();
+ long nEndBlue = rEndCol.GetBlue();
+ nFactor = rGradient.GetStartIntensity();
+ nRed = (nRed * nFactor) / 100;
+ nGreen = (nGreen * nFactor) / 100;
+ nBlue = (nBlue * nFactor) / 100;
+ nFactor = rGradient.GetEndIntensity();
+ nEndRed = (nEndRed * nFactor) / 100;
+ nEndGreen = (nEndGreen * nFactor) / 100;
+ nEndBlue = (nEndBlue * nFactor) / 100;
+ long nStepRed = (nEndRed - nRed) / nSteps;
+ long nStepGreen = (nEndGreen - nGreen) / nSteps;
+ long nStepBlue = (nEndBlue - nBlue) / nSteps;
+ long nSteps2;
+
+ if ( bLinear )
+ {
+ // Um 1 erhoeht, um die Border innerhalb der Schleife
+ // zeichnen zu koennen
+ nSteps2 = nSteps + 1;
+ }
+ else
+ {
+ nStepRed <<= 1;
+ nStepGreen <<= 1;
+ nStepBlue <<= 1;
+ nRed = nEndRed;
+ nGreen = nEndGreen;
+ nBlue = nEndBlue;
+
+ // Um 2 erhoeht, um die Border innerhalb der Schleife
+ // zeichnen zu koennen
+ nSteps2 = nSteps + 2;
+ }
+ Color aCol( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue );
+
+ // GDI-Objekte sichern und setzen
+ Brush aBrush( aCol );
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+
+ // Startpolygon erzeugen (== Borderpolygon)
+ Polygon aPoly( 4 );
+ Polygon aTempPoly( 2 );
+ aPoly[0] = aFullRect.TopLeft();
+ aPoly[1] = aFullRect.TopRight();
+ aPoly[2] = aRect.TopRight();
+ aPoly[3] = aRect.TopLeft();
+ aPoly.Rotate( aCenter, rGradient.GetAngle() );
+
+ // Schleife, um rotierten Verlauf zu fuellen
+ for ( long i = 0; i < nSteps2; i++ )
+ {
+ Polygon aTempPoly = aPoly;
+ aTempPoly.Clip( rRect );
+ aDrawPolyRecordHdl.Call(&aTempPoly);
+ aTempPoly.SetSize( 2 );
+
+ // neues Polygon berechnen
+ aRect.Top() = (long)(fScanLine += fScanInc);
+
+ // unteren Rand komplett fuellen
+ if ( i == nSteps )
+ {
+ aTempPoly[0] = aFullRect.BottomLeft();
+ aTempPoly[1] = aFullRect.BottomRight();
+ }
+ else
+ {
+ aTempPoly[0] = aRect.TopLeft();
+ aTempPoly[1] = aRect.TopRight();
+ }
+ aTempPoly.Rotate( aCenter, rGradient.GetAngle() );
+
+ aPoly[0] = aPoly[3];
+ aPoly[1] = aPoly[2];
+ aPoly[2] = aTempPoly[1];
+ aPoly[3] = aTempPoly[0];
+
+ // Farbintensitaeten aendern...
+ // fuer lineare FV
+ if ( bLinear )
+ {
+ nRed += nStepRed;
+ nGreen += nStepGreen;
+ nBlue += nStepBlue;
+ }
+ // fuer radiale FV
+ else
+ {
+ if ( i <= (nSteps >> 1) )
+ {
+ nRed -= nStepRed;
+ nGreen -= nStepGreen;
+ nBlue -= nStepBlue;
+ }
+ // genau die Mitte und hoeher
+ else
+ {
+ nRed += nStepRed;
+ nGreen += nStepGreen;
+ nBlue += nStepBlue;
+ }
+ }
+
+ nRed = MinMax( nRed, 0, 255 );
+ nGreen = MinMax( nGreen, 0, 255 );
+ nBlue = MinMax( nBlue, 0, 255 );
+
+ // fuer lineare FV ganz normale Bestimmung der Farbe
+ if ( bLinear || (i <= nSteps) )
+ {
+ aCol = Color( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue );
+ }
+ // fuer axiale FV muss die letzte Farbe der ersten
+ // Farbe entsprechen
+ else
+ {
+ aCol = Color( (BYTE) nEndRed, (BYTE) nEndGreen, (BYTE) nEndBlue );
+ }
+
+ aBrush.SetColor(aCol);
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GradientWrapper::WriteRadialGradient(const Rectangle& rRect,
+ const Gradient& rGradient)
+{
+ USHORT nStepCount = 100;
+ Rectangle aClipRect = rRect;
+ Rectangle aRect = rRect;
+ long nZWidth = aRect.GetWidth() * (long)rGradient.GetOfsX() / 100;
+ long nZHeight= aRect.GetHeight() * (long)rGradient.GetOfsY() / 100;
+ Size aSize = aRect.GetSize();
+ Point aCenter( aRect.Left() + nZWidth, aRect.Top() + nZHeight );
+
+ // Radien-Berechnung fuer Kreisausgabe (Kreis schliesst Rechteck ein)
+ if ( rGradient.GetStyle() == GRADIENT_RADIAL )
+ {
+ aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() +
+ (double)aSize.Height()*(double)aSize.Height()));
+ aSize.Height() = aSize.Width();
+ }
+ // Radien-Berechnung fuer Ellipse
+ else
+ {
+ aSize.Width() = (long)(0.5 + (double)aSize.Width() * 1.4142);
+ aSize.Height() = (long)(0.5 + (double)aSize.Height() * 1.4142);
+ }
+
+ long nBorderX = (long)rGradient.GetBorder() * aSize.Width() / 100;
+ long nBorderY = (long)rGradient.GetBorder() * aSize.Height() / 100;
+ aSize.Width() -= nBorderX;
+ aSize.Height() -= nBorderY;
+ aRect.Left() = aCenter.X() - (aSize.Width() >> 1);
+ aRect.Top() = aCenter.Y() - (aSize.Height() >> 1);
+ aRect.SetSize( aSize );
+
+ long nMinRect = Min( aRect.GetWidth(), aRect.GetHeight() );
+
+ // Anzahl der Schritte berechnen, falls nichts uebergeben wurde
+ if ( !nStepCount )
+ {
+ long nInc = ((nMinRect >> 9) + 1) << 3;
+
+ if ( !nInc )
+ nInc = 1;
+
+ nStepCount = (USHORT)(nMinRect / nInc);
+ }
+ // minimal drei Schritte
+ long nSteps = Max( nStepCount, (USHORT)3 );
+
+ // Ausgabebegrenzungen und Schrittweite fuer jede Richtung festlegen
+ double fScanLeft = aRect.Left();
+ double fScanTop = aRect.Top();
+ double fScanRight = aRect.Right();
+ double fScanBottom = aRect.Bottom();
+ double fScanInc = (double)nMinRect / (double)nSteps * 0.5;
+
+ // Intensitaeten von Start- und Endfarbe ggf. aendern und
+ // Farbschrittweiten berechnen
+ long nFactor;
+ const Color& rStartCol = rGradient.GetStartColor();
+ const Color& rEndCol = rGradient.GetEndColor();
+ long nRed = rStartCol.GetRed();
+ long nGreen = rStartCol.GetGreen();
+ long nBlue = rStartCol.GetBlue();
+ long nEndRed = rEndCol.GetRed();
+ long nEndGreen = rEndCol.GetGreen();
+ long nEndBlue = rEndCol.GetBlue();
+ nFactor = rGradient.GetStartIntensity();
+ nRed = (nRed * nFactor) / 100;
+ nGreen = (nGreen * nFactor) / 100;
+ nBlue = (nBlue * nFactor) / 100;
+ nFactor = rGradient.GetEndIntensity();
+ nEndRed = (nEndRed * nFactor) / 100;
+ nEndGreen = (nEndGreen * nFactor) / 100;
+ nEndBlue = (nEndBlue * nFactor) / 100;
+ long nStepRed = (nEndRed - nRed) / nSteps;
+ long nStepGreen = (nEndGreen - nGreen) / nSteps;
+ long nStepBlue = (nEndBlue - nBlue) / nSteps;
+ Color aCol( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue );
+
+ // GDI-Objekte sichern und setzen
+ Brush aBrush( aCol );
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+
+ // Recteck erstmal ausgeben
+ PolyPolygon aPolyPoly( 2 );
+ Polygon aPoly( rRect );
+
+ aPolyPoly.Insert( aPoly );
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, rGradient.GetAngle() );
+ aPolyPoly.Insert( aPoly );
+
+ // erstes Polygon zeichnen (entspricht Rechteck)
+ PolyPolygon aTempPolyPoly = aPolyPoly;
+ aTempPolyPoly.Clip( aClipRect );
+ aDrawPolyPolyRecordHdl.Call(&aTempPolyPoly);
+
+ for ( long i = 0; i < nSteps; i++ )
+ {
+ Color aCol( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue );
+ aBrush.SetColor( aCol );
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+
+ // neues Polygon berechnen
+ aRect.Left() = (long)(fScanLeft += fScanInc);
+ aRect.Top() = (long)(fScanTop += fScanInc);
+ aRect.Right() = (long)(fScanRight -= fScanInc);
+ aRect.Bottom() = (long)(fScanBottom -= fScanInc);
+
+ if ( (aRect.GetWidth() < 2) || (aRect.GetHeight() < 2) )
+ break;
+
+ aPoly = Polygon( aRect.Center(),
+ aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
+ aPoly.Rotate( aCenter, rGradient.GetAngle() );
+
+ aPolyPoly.Replace( aPolyPoly.GetObject( 1 ), 0 );
+ aPolyPoly.Replace( aPoly, 1 );
+
+ PolyPolygon aTempPolyPoly = aPolyPoly;
+ aTempPolyPoly.Clip( aClipRect );
+ aDrawPolyPolyRecordHdl.Call(&aTempPolyPoly);
+
+ // Farbe entsprechend anpassen
+ nRed += nStepRed;
+ nGreen += nStepGreen;
+ nBlue += nStepBlue;
+
+#ifndef VCL
+ nRed = MinMax( nRed, 0, 0xFFFF );
+ nGreen = MinMax( nGreen, 0, 0xFFFF );
+ nBlue = MinMax( nBlue, 0, 0xFFFF );
+#else
+ nRed = MinMax( nRed, 0, 0xFF );
+ nGreen = MinMax( nGreen, 0, 0xFF );
+ nBlue = MinMax( nBlue, 0, 0xFF );
+#endif
+ }
+
+ // Falls PolyPolygon-Ausgabe, muessen wir noch ein letztes
+ // inneres Polygon zeichnen
+ aBrush.SetColor( Color( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue ) );
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+
+ aPoly = aPolyPoly.GetObject( 1 );
+ if ( !aPoly.GetBoundRect().IsEmpty() )
+ {
+ aPoly.Clip( aClipRect );
+ aDrawPolyRecordHdl.Call(&aPoly);
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GradientWrapper::WriteRectGradient(const Rectangle& rRect,
+ const Gradient& rGradient)
+{
+ USHORT nStepCount = 100;
+ Rectangle aClipRect = rRect;
+ Rectangle aRect = rRect;
+
+ aRect.Left()--;
+ aRect.Top()--;
+ aRect.Right()++;
+ aRect.Bottom()++;
+
+ // rotiertes BoundRect ausrechnen
+ double fAngle = (rGradient.GetAngle() % 3600) * F_PI1800;
+ double fWidth = aRect.GetWidth();
+ double fHeight = aRect.GetHeight();
+ double fDX = fWidth * fabs( cos( fAngle ) ) +
+ fHeight * fabs( sin( fAngle ) );
+ double fDY = fHeight * fabs( cos( fAngle ) ) +
+ fWidth * fabs( sin( fAngle ) );
+ fDX = (fDX - fWidth) * 0.5 + 0.5;
+ fDY = (fDY - fHeight) * 0.5 + 0.5;
+ aRect.Left() -= (long)fDX;
+ aRect.Right() += (long)fDX;
+ aRect.Top() -= (long)fDY;
+ aRect.Bottom() += (long)fDY;
+
+ // Quadratisch machen, wenn angefordert;
+ Size aSize = aRect.GetSize();
+ if ( rGradient.GetStyle() == GRADIENT_SQUARE )
+ {
+ if ( aSize.Width() > aSize.Height() )
+ aSize.Height() = aSize.Width();
+ else
+ aSize.Width() = aSize.Height();
+ }
+
+ // neue Mittelpunkte berechnen
+ long nZWidth = aRect.GetWidth() * (long)rGradient.GetOfsX() / 100;
+ long nZHeight = aRect.GetHeight() * (long)rGradient.GetOfsY() / 100;
+ long nBorderX = (long)rGradient.GetBorder() * aSize.Width() / 100;
+ long nBorderY = (long)rGradient.GetBorder() * aSize.Height() / 100;
+ Point aCenter( aRect.Left() + nZWidth, aRect.Top() + nZHeight );
+
+ // Rand beruecksichtigen
+ aSize.Width() -= nBorderX;
+ aSize.Height() -= nBorderY;
+
+ // Ausgaberechteck neu setzen
+ aRect.Left() = aCenter.X() - (aSize.Width() >> 1);
+ aRect.Top() = aCenter.Y() - (aSize.Height() >> 1);
+ aRect.SetSize( aSize );
+
+ long nMinRect = Min( aRect.GetWidth(), aRect.GetHeight() );
+
+ // Anzahl der Schritte berechnen, falls nichts uebergeben wurde
+ if ( !nStepCount )
+ {
+ long nInc = ((nMinRect >> 9) + 1) << 3;
+
+ if ( !nInc )
+ nInc = 1;
+
+ nStepCount = (USHORT)(nMinRect / nInc);
+ }
+ // minimal drei Schritte
+ long nSteps = Max( nStepCount, (USHORT)3 );
+
+ // Ausgabebegrenzungen und Schrittweite fuer jede Richtung festlegen
+ double fScanLeft = aRect.Left();
+ double fScanTop = aRect.Top();
+ double fScanRight = aRect.Right();
+ double fScanBottom = aRect.Bottom();
+ double fScanInc = (double)nMinRect / (double)nSteps * 0.5;
+
+ // Intensitaeten von Start- und Endfarbe ggf. aendern und
+ // Farbschrittweiten berechnen
+ long nFactor;
+ const Color& rStartCol = rGradient.GetStartColor();
+ const Color& rEndCol = rGradient.GetEndColor();
+ long nRed = rStartCol.GetRed();
+ long nGreen = rStartCol.GetGreen();
+ long nBlue = rStartCol.GetBlue();
+ long nEndRed = rEndCol.GetRed();
+ long nEndGreen = rEndCol.GetGreen();
+ long nEndBlue = rEndCol.GetBlue();
+ nFactor = rGradient.GetStartIntensity();
+ nRed = (nRed * nFactor) / 100;
+ nGreen = (nGreen * nFactor) / 100;
+ nBlue = (nBlue * nFactor) / 100;
+ nFactor = rGradient.GetEndIntensity();
+ nEndRed = (nEndRed * nFactor) / 100;
+ nEndGreen = (nEndGreen * nFactor) / 100;
+ nEndBlue = (nEndBlue * nFactor) / 100;
+ long nStepRed = (nEndRed - nRed) / nSteps;
+ long nStepGreen = (nEndGreen - nGreen) / nSteps;
+ long nStepBlue = (nEndBlue - nBlue) / nSteps;
+ Color aCol( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue );
+
+ // GDI-Objekte sichern und setzen
+ Brush aBrush( aCol );
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+
+ // Recteck erstmal ausgeben
+ PolyPolygon aPolyPoly( 2 );
+ Polygon aPoly( rRect );
+
+ aPolyPoly.Insert( aPoly );
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, rGradient.GetAngle() );
+ aPolyPoly.Insert( aPoly );
+
+ PolyPolygon aTempPolyPoly = aPolyPoly;
+ aTempPolyPoly.Clip( aClipRect );
+ aDrawPolyPolyRecordHdl.Call(&aTempPolyPoly);
+
+ // Schleife, um nacheinander die Polygone/PolyPolygone auszugeben
+ for ( long i = 0; i < nSteps; i++ )
+ {
+ Color aCol( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue );
+ aBrush.SetColor( aCol );
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+
+ // neues Polygon berechnen
+ aRect.Left() = (long)(fScanLeft += fScanInc);
+ aRect.Top() = (long)(fScanTop += fScanInc);
+ aRect.Right() = (long)(fScanRight -= fScanInc);
+ aRect.Bottom() = (long)(fScanBottom-= fScanInc);
+
+ if ( (aRect.GetWidth() < 2) || (aRect.GetHeight() < 2) )
+ break;
+
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, rGradient.GetAngle() );
+
+ aPolyPoly.Replace( aPolyPoly.GetObject( 1 ), 0 );
+ aPolyPoly.Replace( aPoly, 1 );
+
+ PolyPolygon aTempPolyPoly = aPolyPoly;
+ aTempPolyPoly.Clip( aClipRect );
+ aDrawPolyPolyRecordHdl.Call(&aTempPolyPoly);
+
+ // Farben aendern
+ nRed += nStepRed;
+ nGreen += nStepGreen;
+ nBlue += nStepBlue;
+
+#ifndef VCL
+ nRed = MinMax( nRed, 0, 65535 );
+ nGreen = MinMax( nGreen, 0, 65535 );
+ nBlue = MinMax( nBlue, 0, 65535 );
+#else
+ nRed = MinMax( nRed, 0, 0xFF );
+ nGreen = MinMax( nGreen, 0, 0xFF );
+ nBlue = MinMax( nBlue, 0, 0xFF );
+#endif
+ }
+
+ aBrush.SetColor( Color( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue ) );
+ aSetFillInBrushRecordHdl.Call(&aBrush);
+
+ aPoly = aPolyPoly.GetObject( 1 );
+ if ( !aPoly.GetBoundRect().IsEmpty() )
+ {
+ aPoly.Clip( aClipRect );
+ aDrawPolyRecordHdl.Call(&aPoly);
+ }
+}
diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk
new file mode 100644
index 000000000000..71c638a89764
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/makefile.mk
@@ -0,0 +1,137 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SVTOOLS
+TARGET=filter
+DEPTARGET=vfilter
+VERSION=$(UPD)
+
+# --- Settings -----------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(GUI)"=="WIN"
+LINKFLAGS=$(LINKFLAGS) /PACKC:32768
+.ENDIF
+
+# --- UNOTypes -----------------------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+UNOTYPES=\
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.XWeak \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.io.XActiveDataSource \
+ com.sun.star.io.XOutputStream \
+ com.sun.star.svg.XSVGWriter \
+ com.sun.star.xml.sax.XDocumentHandler
+
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= filter.cxx \
+ filter2.cxx \
+ dlgexpor.cxx \
+ dlgejpg.cxx \
+ sgfbram.cxx \
+ sgvmain.cxx \
+ sgvtext.cxx \
+ sgvspln.cxx
+
+SRCFILES= strings.src \
+ dlgexpor.src \
+ dlgejpg.src
+
+SLOFILES= $(SLO)$/filter.obj \
+ $(SLO)$/filter2.obj \
+ $(SLO)$/dlgexpor.obj \
+ $(SLO)$/dlgejpg.obj \
+ $(SLO)$/sgfbram.obj \
+ $(SLO)$/sgvmain.obj \
+ $(SLO)$/sgvtext.obj \
+ $(SLO)$/sgvspln.obj
+
+EXCEPTIONSNOOPTFILES= $(SLO)$/filter.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.ELSE
+
+dummy:
+ @+echo VCL not set. nothing to do!
+
+.ENDIF # VCL
+
diff --git a/svtools/source/filter.vcl/filter/sgf.ini b/svtools/source/filter.vcl/filter/sgf.ini
new file mode 100644
index 000000000000..7444e40c8836
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/sgf.ini
@@ -0,0 +1,118 @@
+#Family : (Roman,Swiss,Modern,Script,Decora);
+#CharSet : (Ansi,IBMPC,Mac,Symbol,System); Default is System
+#Attribute: (Bold,Ital,Sans,Serf,Fixd);
+
+[SGV Fonts fuer StarView]
+#IF-ID Fontname Attribute SV-Fam ChSet Width FontName
+ 3848=(ITC Zapf Dingbats) Decora ()
+ 5720=(Symbol) Serf Decora Symbol ()
+ 5721=(Symbol) Bold Serf Decora Symbol ()
+ 5723=(Symbol Sans) Sans Decora Symbol ()
+ 5724=(Symbol Sans) Bold Sans Decora Symbol ()
+ 90133=(Dom Casual) Sans Script ()
+ 90326=(Brush) Bold Ital Serf Script ()
+ 90349=(Park Avenue) Ital Serf Script ()
+ 90508=(Uncial) Sans Roman ()
+ 91118=(Antique Olive) Bold Sans Swiss ()
+ 91119=(Antique Olive) Sans Swiss ()
+ 91120=(Antique Olive Compact) Bold Sans Swiss ()
+ 91335=(ITC Benguiat) Bold Serf Roman ()
+ 91336=(ITC Benguiat) Bold Ital Serf Roman ()
+ 91846=(Antique Olive) Ital Sans Roman ()
+#92500=(CG Times) Serf Roman ()
+#92501=(CG Times) Ital Serf Roman ()
+#92504=(CG Times) Bold Serf Roman ()
+#92505=(CG Times) Bold Ital Serf Roman ()
+#93950=(Courier) Serf Fixd Modern ()
+#93951=(Courier) Ital Serf Fixd Modern ()
+#93952=(Courier) Bold Serf Fixd Modern ()
+#93953=(Courier) Bold Ital Serf Fixd Modern ()
+#94021=(Univers) Sans Swiss ()
+#94022=(Univers) Ital Sans Swiss ()
+#94023=(Univers) Bold Sans Swiss ()
+#94024=(Univers) Bold Ital Sans Swiss ()
+102004=(Avanti) Bold Ital Sans Swiss ()
+102005=(Avanti) Ital Sans Swiss ()
+102007=(Booklet) Bold Sans Roman ()
+102008=(Booklet) Bold Ital Sans Roman ()
+102009=(Booklet) Ital Sans Roman ()
+102010=(Centuri) Sans Roman ()
+102011=(Centuri) Bold Sans Roman ()
+102012=(Centuri) Bold Ital Sans Roman ()
+102013=(Centuri) Ital Sans Roman ()
+102014=(Paltus) Bold Sans Roman ()
+102015=(Paltus) Sans Roman ()
+102016=(Paltus) Bold Ital Sans Roman ()
+102017=(Paltus) Ital Sans Roman ()
+102018=(Sans) Sans Swiss ()
+102019=(Sans) Bold Sans Swiss ()
+102020=(Sans) Bold Ital Sans Swiss ()
+102021=(Sans) Ital Sans Swiss ()
+102022=(SansCondensed) Sans Swiss ()
+102023=(SansCondensed) Bold Sans Swiss ()
+102024=(SansCondensed) Bold Ital Sans Swiss ()
+102025=(SansCondensed) Ital Sans Swiss ()
+102026=(PS-Roman) Sans Roman ()
+102027=(PS-Roman) Bold Sans Roman ()
+102028=(PS-Roman) Bold Ital Sans Roman ()
+102029=(PS-Roman) Ital Sans Roman ()
+200111=(Chalenge) Sans ()
+200112=(Chalenge) Bold Sans ()
+200113=(Chalenge) Ital Sans ()
+200114=(Chalenge) Bold Ital Sans ()
+200121=(Office) Sans ()
+200122=(Office) Bold Sans ()
+200123=(Office) Ital Sans ()
+200124=(Office) Bold Ital Sans ()
+200131=(Milano) Sans ()
+200132=(Milano) Bold Sans ()
+200133=(Milano) Ital Sans ()
+200134=(Milano) Bold Ital Sans ()
+200141=(Atlantic) Sans Roman ()
+200142=(Atlantic) Bold Sans Roman ()
+200143=(Atlantic) Ital Sans Roman ()
+200144=(Atlantic) Bold Ital Sans Roman ()
+200151=(Pentagon) Sans ()
+200152=(Pentagon) Bold Sans ()
+200153=(Pentagon) Ital Sans ()
+200154=(Pentagon) Bold Ital Sans ()
+200161=(Classico) Sans ()
+200162=(Classico) Bold Sans ()
+200163=(Classico) Ital Sans ()
+200164=(Classico) Bold Ital Sans ()
+200211=(Westcost) Sans ()
+200212=(Westcost) Bold Sans ()
+200213=(Westcost) Ital Sans ()
+200214=(Westcost) Bold Ital Sans ()
+200221=(Finish) Sans ()
+200222=(Finish) Bold Sans ()
+200223=(Finish) Ital Sans ()
+200224=(Finish) Bold Ital Sans ()
+200231=(Classic) Sans ()
+200232=(Classic) Bold Sans ()
+200233=(Classic) Ital Sans ()
+200234=(Classic) Bold Ital Sans ()
+200241=(Hilton) Sans ()
+200242=(Hilton) Bold Sans ()
+200243=(Hilton) Ital Sans ()
+200244=(Hilton) Bold Ital Sans ()
+200251=(Progress) Sans ()
+200252=(Progress) Bold Sans ()
+200253=(Progress) Ital Sans ()
+200254=(Progress) Bold Ital Sans ()
+200261=(PrestigeElite) Sans ()
+200262=(PrestigeElite) Bold Sans ()
+200263=(PrestigeElite) Ital Sans ()
+200271=(Ovetti) Bold Sans ()
+200272=(Ovetti) Sans ()
+200301=(Cescendo) Sans ()
+200302=(Funky) Sans Decora ()
+200303=(Speed) Sans Decora ()
+200304=(Skyline) Sans Decora ()
+200305=(Calculator) Sans Decora ()
+200306=(Xpress) Sans Decora ()
+200307=(Console) Sans Decora ()
+200308=(Paisley) Sans ()
+200309=(Nova) Sans ()
+200310=(New York) Sans Decora ()
+200311=(Shanghai) Sans Decora ()
diff --git a/svtools/source/filter.vcl/filter/sgfbram.cxx b/svtools/source/filter.vcl/filter/sgfbram.cxx
new file mode 100644
index 000000000000..824abf8271f3
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/sgfbram.cxx
@@ -0,0 +1,696 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgfbram.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <tools/stream.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/color.hxx>
+#include <vcl/virdev.hxx>
+#include "sgffilt.hxx"
+#include "sgfbram.hxx"
+
+#if defined( WIN ) && defined( MSC )
+#pragma code_seg( "SVTOOLS_FILTER4", "SVTOOLS_CODE" )
+#endif
+
+/*************************************************************************
+|*
+|* operator>>( SvStream&, SgfHeader& )
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead)
+{
+ rIStream.Read((char*)&rHead.Magic,SgfHeaderSize);
+#if defined __BIGENDIAN
+ rHead.Magic =SWAPSHORT(rHead.Magic );
+ rHead.Version=SWAPSHORT(rHead.Version);
+ rHead.Typ =SWAPSHORT(rHead.Typ );
+ rHead.Xsize =SWAPSHORT(rHead.Xsize );
+ rHead.Ysize =SWAPSHORT(rHead.Ysize );
+ rHead.Xoffs =SWAPSHORT(rHead.Xoffs );
+ rHead.Yoffs =SWAPSHORT(rHead.Yoffs );
+ rHead.Planes =SWAPSHORT(rHead.Planes );
+ rHead.SwGrCol=SWAPSHORT(rHead.SwGrCol);
+ rHead.OfsLo =SWAPSHORT(rHead.OfsLo );
+ rHead.OfsHi =SWAPSHORT(rHead.OfsHi );
+#endif
+ return rIStream;
+}
+
+
+/*************************************************************************
+|*
+|* SgfHeader::ChkMagic()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfHeader::ChkMagic()
+{ return Magic=='J'*256+'J'; }
+
+UINT32 SgfHeader::GetOffset()
+{ return UINT32(OfsLo)+0x00010000*UINT32(OfsHi); }
+
+
+/*************************************************************************
+|*
+|* operator>>( SvStream&, SgfEntry& )
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr)
+{
+ rIStream.Read((char*)&rEntr.Typ,SgfEntrySize);
+#if defined __BIGENDIAN
+ rEntr.Typ =SWAPSHORT(rEntr.Typ );
+ rEntr.iFrei=SWAPSHORT(rEntr.iFrei);
+ rEntr.lFreiLo=SWAPSHORT (rEntr.lFreiLo);
+ rEntr.lFreiHi=SWAPSHORT (rEntr.lFreiHi);
+ rEntr.OfsLo=SWAPSHORT(rEntr.OfsLo);
+ rEntr.OfsHi=SWAPSHORT(rEntr.OfsHi);
+#endif
+ return rIStream;
+}
+
+UINT32 SgfEntry::GetOffset()
+{ return UINT32(OfsLo)+0x00010000*UINT32(OfsHi); }
+
+
+/*************************************************************************
+|*
+|* operator>>( SvStream&, SgfVector& )
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+SvStream& operator>>(SvStream& rIStream, SgfVector& rVect)
+{
+ rIStream.Read((char*)&rVect,sizeof(rVect));
+#if defined __BIGENDIAN
+ rVect.Flag =SWAPSHORT(rVect.Flag );
+ rVect.x =SWAPSHORT(rVect.x );
+ rVect.y =SWAPSHORT(rVect.y );
+ rVect.OfsLo=SWAPLONG (rVect.OfsLo);
+ rVect.OfsHi=SWAPLONG (rVect.OfsHi);
+#endif
+ return rIStream;
+}
+
+
+/*************************************************************************
+|*
+|* operator<<( SvStream&, BmpFileHeader& )
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead)
+{
+#if defined __BIGENDIAN
+ rHead.Typ =SWAPSHORT(rHead.Typ );
+ rHead.SizeLo =SWAPSHORT(rHead.SizeLo );
+ rHead.SizeHi =SWAPSHORT(rHead.SizeHi );
+ rHead.Reserve1=SWAPSHORT(rHead.Reserve1);
+ rHead.Reserve2=SWAPSHORT(rHead.Reserve2);
+ rHead.OfsLo =SWAPSHORT(rHead.OfsLo );
+ rHead.OfsHi =SWAPSHORT(rHead.OfsHi );
+#endif
+ rOStream.Write((char*)&rHead,sizeof(rHead));
+#if defined __BIGENDIAN
+ rHead.Typ =SWAPSHORT(rHead.Typ );
+ rHead.SizeLo =SWAPSHORT(rHead.SizeLo );
+ rHead.SizeHi =SWAPSHORT(rHead.SizeHi );
+ rHead.Reserve1=SWAPSHORT(rHead.Reserve1);
+ rHead.Reserve2=SWAPSHORT(rHead.Reserve2);
+ rHead.OfsLo =SWAPSHORT(rHead.OfsLo );
+ rHead.OfsHi =SWAPSHORT(rHead.OfsHi );
+#endif
+ return rOStream;
+}
+
+void BmpFileHeader::SetSize(UINT32 Size)
+{
+ SizeLo=UINT16(Size & 0x0000FFFF);
+ SizeHi=UINT16((Size & 0xFFFF0000)>>16);
+}
+
+void BmpFileHeader::SetOfs(UINT32 Ofs)
+{
+ OfsLo=UINT16(Ofs & 0x0000FFFF);
+ OfsHi=UINT16((Ofs & 0xFFFF0000)>>16);
+}
+
+UINT32 BmpFileHeader::GetOfs()
+{
+ return UINT32(OfsLo)+0x00010000*UINT32(OfsHi);
+}
+
+/*************************************************************************
+|*
+|* operator<<( SvStream&, BmpInfoHeader& )
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rInfo)
+{
+#if defined __BIGENDIAN
+ rInfo.Size =SWAPLONG (rInfo.Size );
+ rInfo.Width =SWAPLONG (rInfo.Width );
+ rInfo.Hight =SWAPLONG (rInfo.Hight );
+ rInfo.Planes =SWAPSHORT(rInfo.Planes );
+ rInfo.PixBits =SWAPSHORT(rInfo.PixBits );
+ rInfo.Compress=SWAPLONG (rInfo.Compress);
+ rInfo.ImgSize =SWAPLONG (rInfo.ImgSize );
+ rInfo.xDpmm =SWAPLONG (rInfo.xDpmm );
+ rInfo.yDpmm =SWAPLONG (rInfo.yDpmm );
+ rInfo.ColUsed =SWAPLONG (rInfo.ColUsed );
+ rInfo.ColMust =SWAPLONG (rInfo.ColMust );
+#endif
+ rOStream.Write((char*)&rInfo,sizeof(rInfo));
+#if defined __BIGENDIAN
+ rInfo.Size =SWAPLONG (rInfo.Size );
+ rInfo.Width =SWAPLONG (rInfo.Width );
+ rInfo.Hight =SWAPLONG (rInfo.Hight );
+ rInfo.Planes =SWAPSHORT(rInfo.Planes );
+ rInfo.PixBits =SWAPSHORT(rInfo.PixBits );
+ rInfo.Compress=SWAPLONG (rInfo.Compress);
+ rInfo.ImgSize =SWAPLONG (rInfo.ImgSize );
+ rInfo.xDpmm =SWAPLONG (rInfo.xDpmm );
+ rInfo.yDpmm =SWAPLONG (rInfo.yDpmm );
+ rInfo.ColUsed =SWAPLONG (rInfo.ColUsed );
+ rInfo.ColMust =SWAPLONG (rInfo.ColMust );
+#endif
+ return rOStream;
+}
+
+
+/*************************************************************************
+|*
+|* operator<<( SvStream&, RGBQuad& )
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+SvStream& operator<<(SvStream& rOStream, const RGBQuad& rQuad)
+{
+ rOStream.Write((char*)&rQuad,sizeof(rQuad));
+ return rOStream;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// PcxExpand ///////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class PcxExpand
+{
+private:
+ USHORT Count;
+ BYTE Data;
+public:
+ PcxExpand() { Count=0; }
+ BYTE GetByte(SvStream& rInp);
+};
+
+BYTE PcxExpand::GetByte(SvStream& rInp)
+{
+ if (Count>0) {
+ Count--;
+ } else {
+ rInp.Read((char*)&Data,1);
+ if ((Data & 0xC0) == 0xC0) {
+ Count=(Data & 0x3F) -1;
+ rInp.Read((char*)&Data,1);
+ }
+ }
+ return Data;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SgfBMapFilter ///////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/*************************************************************************
+|*
+|* SgfFilterBmp()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&)
+{
+ BmpFileHeader aBmpHead;
+ BmpInfoHeader aBmpInfo;
+ USHORT nWdtInp=(rHead.Xsize+7)/8; // Breite der Input-Bitmap in Bytes
+ USHORT nWdtOut; // Breite der Output-Bitmap in Bytes
+ USHORT nColors; // Anzahl der Farben (1,16,256)
+ USHORT nColBits; // Anzahl der Bits/Pixel (2, 4, 8)
+ USHORT i,j,k; // Spaltenz„hler, Zeilenz„hler, Planez„hler
+ USHORT a,b; // Hilfsvariable
+ BYTE pl1,pl2; // Masken fr die Planes
+ BYTE* pBuf=NULL; // Buffer fr eine Pixelzeile
+ PcxExpand aPcx;
+ ULONG nOfs;
+ BYTE cRGB[4];
+
+ if (rHead.Planes<=1) nColBits=1; else nColBits=4; if (rHead.Typ==4) nColBits=8;
+ nColors=1<<nColBits;
+ nWdtOut=((rHead.Xsize*nColBits+31)/32)*4;
+ aBmpHead.Typ='B'+'M'*256;
+ aBmpHead.SetOfs(sizeof(aBmpHead)+sizeof(aBmpInfo)+nColors*4);
+ aBmpHead.SetSize(aBmpHead.GetOfs()+nWdtOut*rHead.Ysize);
+ aBmpHead.Reserve1=0;
+ aBmpHead.Reserve2=0;
+ aBmpInfo.Size=sizeof(aBmpInfo);
+ aBmpInfo.Width=rHead.Xsize;
+ aBmpInfo.Hight=rHead.Ysize;
+ aBmpInfo.Planes=1;
+ aBmpInfo.PixBits=nColBits;
+ aBmpInfo.Compress=0;
+ aBmpInfo.ImgSize=0;
+ aBmpInfo.xDpmm=0;
+ aBmpInfo.yDpmm=0;
+ aBmpInfo.ColUsed=0;
+ aBmpInfo.ColMust=0;
+ pBuf=new BYTE[nWdtOut];
+ if (!pBuf) return FALSE; // Fehler: kein Speichel da
+ rOut<<aBmpHead<<aBmpInfo;
+ memset(pBuf,0,nWdtOut); // Buffer mit Nullen fllen
+
+ if (nColors==2)
+ {
+
+ rOut<<RGBQuad(0x00,0x00,0x00); // Schwarz
+ rOut<<RGBQuad(0xFF,0xFF,0xFF); // Weiss
+ nOfs=rOut.Tell();
+ for (j=0;j<rHead.Ysize;j++)
+ rOut.Write((char*)pBuf,nWdtOut); // Datei erstmal komplett mit Nullen fllen
+ for (j=0;j<rHead.Ysize;j++) {
+ for(i=0;i<nWdtInp;i++) {
+ pBuf[i]=aPcx.GetByte(rInp);
+ }
+ for(i=nWdtInp;i<nWdtOut;i++) pBuf[i]=0; // noch bis zu 3 Bytes
+ rOut.Seek(nOfs+((ULONG)rHead.Ysize-j-1L)*(ULONG)nWdtOut); // rckw„rts schreiben!
+ rOut.Write((char*)pBuf,nWdtOut);
+ }
+ } else if (nColors==16) {
+ rOut<<RGBQuad(0x00,0x00,0x00); // Schwarz
+ rOut<<RGBQuad(0x24,0x24,0x24); // Grau 80%
+ rOut<<RGBQuad(0x49,0x49,0x49); // Grau 60%
+ rOut<<RGBQuad(0x92,0x92,0x92); // Grau 40%
+ rOut<<RGBQuad(0x6D,0x6D,0x6D); // Grau 30%
+ rOut<<RGBQuad(0xB6,0xB6,0xB6); // Grau 20%
+ rOut<<RGBQuad(0xDA,0xDA,0xDA); // Grau 10%
+ rOut<<RGBQuad(0xFF,0xFF,0xFF); // Weiss
+ rOut<<RGBQuad(0x00,0x00,0x00); // Schwarz
+ rOut<<RGBQuad(0xFF,0x00,0x00); // Rot
+ rOut<<RGBQuad(0x00,0x00,0xFF); // Blau
+ rOut<<RGBQuad(0xFF,0x00,0xFF); // Magenta
+ rOut<<RGBQuad(0x00,0xFF,0x00); // Gruen
+ rOut<<RGBQuad(0xFF,0xFF,0x00); // Gelb
+ rOut<<RGBQuad(0x00,0xFF,0xFF); // Cyan
+ rOut<<RGBQuad(0xFF,0xFF,0xFF); // Weiss
+
+ nOfs=rOut.Tell();
+ for (j=0;j<rHead.Ysize;j++)
+ rOut.Write((char*)pBuf,nWdtOut); // Datei erstmal komplett mit Nullen fllen
+ for (j=0;j<rHead.Ysize;j++) {
+ memset(pBuf,0,nWdtOut);
+ for(k=0;k<4;k++) {
+ if (k==0) {
+ pl1=0x10; pl2=0x01;
+ } else {
+ pl1<<=1; pl2<<=1;
+ }
+ for(i=0;i<nWdtInp;i++) {
+ a=i*4;
+ b=aPcx.GetByte(rInp);
+ if (b & 0x80) pBuf[a ]|=pl1;
+ if (b & 0x40) pBuf[a ]|=pl2;
+ if (b & 0x20) pBuf[a+1]|=pl1;
+ if (b & 0x10) pBuf[a+1]|=pl2;
+ if (b & 0x08) pBuf[a+2]|=pl1;
+ if (b & 0x04) pBuf[a+2]|=pl2;
+ if (b & 0x02) pBuf[a+3]|=pl1;
+ if (b & 0x01) pBuf[a+3]|=pl2;
+ }
+ }
+ for(i=nWdtInp*4;i<nWdtOut;i++) pBuf[i]=0; // noch bis zu 3 Bytes
+ rOut.Seek(nOfs+((ULONG)rHead.Ysize-j-1L)*(ULONG)nWdtOut); // rckw„rts schreiben!
+ rOut.Write((char*)pBuf,nWdtOut);
+ }
+ } else if (nColors==256) {
+ cRGB[3]=0; // der 4. Paletteneintrag fr BMP
+ for (i=0;i<256;i++) { // Palette kopieren
+ rInp.Read((char*)cRGB,3);
+ pl1=cRGB[0]; // Rot mit Blau tauschen
+ cRGB[0]=cRGB[2];
+ cRGB[2]=pl1;
+ rOut.Write((char*)cRGB,4);
+ }
+
+ nOfs=rOut.Tell();
+ for (j=0;j<rHead.Ysize;j++)
+ rOut.Write((char*)pBuf,nWdtOut); // Datei erstmal komplett mit Nullen fllen
+ for (j=0;j<rHead.Ysize;j++) {
+ for(i=0;i<rHead.Xsize;i++)
+ pBuf[i]=aPcx.GetByte(rInp);
+ for(i=rHead.Xsize;i<nWdtOut;i++) pBuf[i]=0; // noch bis zu 3 Bytes
+ rOut.Seek(nOfs+((ULONG)rHead.Ysize-j-1L)*(ULONG)nWdtOut); // rckw„rts schreiben!
+ rOut.Write((char*)pBuf,nWdtOut);
+ }
+ }
+ delete pBuf;
+ return TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* SgfBMapFilter()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfBMapFilter(SvStream& rInp, SvStream& rOut)
+{
+ ULONG nFileStart; // Offset des SgfHeaders. Im allgemeinen 0.
+ SgfHeader aHead;
+ SgfEntry aEntr;
+ ULONG nNext;
+ BOOL bRdFlag=FALSE; // Grafikentry gelesen ?
+ BOOL bRet=FALSE; // Returncode
+
+ nFileStart=rInp.Tell();
+ rInp>>aHead;
+ if (aHead.ChkMagic() && (aHead.Typ==SgfBitImag0 || aHead.Typ==SgfBitImag1 ||
+ aHead.Typ==SgfBitImag2 || aHead.Typ==SgfBitImgMo)) {
+ nNext=aHead.GetOffset();
+ while (nNext && !bRdFlag && !rInp.GetError() && !rOut.GetError()) {
+ rInp.Seek(nFileStart+nNext);
+ rInp>>aEntr;
+ nNext=aEntr.GetOffset();
+ if (aEntr.Typ==aHead.Typ) {
+ bRdFlag=TRUE;
+ switch(aEntr.Typ) {
+ case SgfBitImag0:
+ case SgfBitImag1:
+ case SgfBitImag2:
+ case SgfBitImgMo: bRet=SgfFilterBMap(rInp,rOut,aHead,aEntr); break;
+ }
+ }
+ } // while(nNext)
+ }
+ if (rInp.GetError()) bRet=FALSE;
+ return(bRet);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SgfVectFilter ///////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Fr StarDraw Embedded SGF-Vector
+long SgfVectXofs=0;
+long SgfVectYofs=0;
+long SgfVectXmul=0;
+long SgfVectYmul=0;
+long SgfVectXdiv=0;
+long SgfVectYdiv=0;
+BOOL SgfVectScal=FALSE;
+
+////////////////////////////////////////////////////////////
+// Hpgl2SvFarbe ////////////////////////////////////////////
+////////////////////////////////////////////////////////////
+
+Color Hpgl2SvFarbe( BYTE nFarb )
+{
+ ULONG nColor = COL_BLACK;
+
+ switch (nFarb & 0x07) {
+ case 0: nColor=COL_WHITE; break;
+ case 1: nColor=COL_YELLOW; break;
+ case 2: nColor=COL_LIGHTMAGENTA; break;
+ case 3: nColor=COL_LIGHTRED; break;
+ case 4: nColor=COL_LIGHTCYAN; break;
+ case 5: nColor=COL_LIGHTGREEN; break;
+ case 6: nColor=COL_LIGHTBLUE; break;
+ case 7: nColor=COL_BLACK; break;
+ }
+ Color aColor( nColor );
+ return aColor;
+}
+
+/*************************************************************************
+|*
+|* SgfFilterVect()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMtf)
+{
+ VirtualDevice aOutDev;
+ SgfVector aVect;
+ BYTE nFarb;
+ BYTE nFrb0=7;
+ BYTE nLTyp;
+ BYTE nOTyp;
+ BOOL bEoDt=FALSE;
+ BOOL bPDwn=FALSE;
+ Point aP0(0,0);
+ Point aP1(0,0);
+ String Msg;
+ USHORT RecNr=0;
+
+ rMtf.Record(&aOutDev);
+ aOutDev.SetLineColor(Color(COL_BLACK));
+ aOutDev.SetFillColor(Color(COL_BLACK));
+
+ while (!bEoDt && !rInp.GetError()) {
+ rInp>>aVect; RecNr++;
+ nFarb=(BYTE) (aVect.Flag & 0x000F);
+ nLTyp=(BYTE)((aVect.Flag & 0x00F0) >>4);
+ nOTyp=(BYTE)((aVect.Flag & 0x0F00) >>8);
+ bEoDt=(aVect.Flag & 0x4000) !=0;
+ bPDwn=(aVect.Flag & 0x8000) !=0;
+
+ long x=aVect.x-rHead.Xoffs;
+ long y=rHead.Ysize-(aVect.y-rHead.Yoffs);
+ if (SgfVectScal) {
+ if (SgfVectXdiv==0) SgfVectXdiv=rHead.Xsize;
+ if (SgfVectYdiv==0) SgfVectYdiv=rHead.Ysize;
+ if (SgfVectXdiv==0) SgfVectXdiv=1;
+ if (SgfVectYdiv==0) SgfVectYdiv=1;
+ x=SgfVectXofs+ x *SgfVectXmul /SgfVectXdiv;
+ y=SgfVectYofs+ y *SgfVectXmul /SgfVectYdiv;
+ }
+ aP1=Point(x,y);
+ if (!bEoDt && !rInp.GetError()) {
+ if (bPDwn && nLTyp<=6) {
+ switch(nOTyp) {
+ case 1: if (nFarb!=nFrb0) {
+ switch(rHead.SwGrCol) {
+ case SgfVectFarb: aOutDev.SetLineColor(Hpgl2SvFarbe(nFarb)); break;
+ case SgfVectGray: break;
+ case SgfVectWdth: break;
+ }
+ }
+ aOutDev.DrawLine(aP0,aP1); break; // Linie
+ case 2: break; // Kreis
+ case 3: break; // Text
+ case 5: aOutDev.DrawRect(Rectangle(aP0,aP1)); break; // Rechteck (solid)
+ }
+ }
+ aP0=aP1;
+ nFrb0=nFarb;
+ }
+ }
+ rMtf.Stop();
+ rMtf.WindStart();
+ MapMode aMap( MAP_10TH_MM, Point(),
+ Fraction( 1, 4 ), Fraction( 1, 4 ) );
+ rMtf.SetPrefMapMode( aMap );
+ rMtf.SetPrefSize( Size( (short)rHead.Xsize, (short)rHead.Ysize ) );
+ return TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* SgfVectFilter()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf)
+{
+ ULONG nFileStart; // Offset des SgfHeaders. Im allgemeinen 0.
+ SgfHeader aHead;
+ SgfEntry aEntr;
+ ULONG nNext;
+ BOOL bRdFlag=FALSE; // Grafikentry gelesen ?
+ BOOL bRet=FALSE; // Returncode
+
+ nFileStart=rInp.Tell();
+ rInp>>aHead;
+ if (aHead.ChkMagic() && aHead.Typ==SGF_SIMPVECT) {
+ nNext=aHead.GetOffset();
+ while (nNext && !bRdFlag && !rInp.GetError()) {
+ rInp.Seek(nFileStart+nNext);
+ rInp>>aEntr;
+ nNext=aEntr.GetOffset();
+ if (aEntr.Typ==aHead.Typ) {
+ bRet=SgfFilterVect(rInp,aHead,aEntr,rMtf);
+ }
+ } // while(nNext)
+ if (bRdFlag) {
+ if (!rInp.GetError()) bRet=TRUE; // Scheinbar Ok
+ }
+ }
+ return(bRet);
+}
+
+
+/*************************************************************************
+|*
+|* SgfFilterPScr()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&)
+{
+ return FALSE; // PostSrcipt wird noch nicht unterstuetzt !
+}
+
+
+/*************************************************************************
+|*
+|* CheckSgfTyp()
+|*
+|* Beschreibung Feststellen, uwas fr ein SGF/SGV es sich handelt.
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BYTE CheckSgfTyp(SvStream& rInp, USHORT& nVersion)
+{
+#ifdef DEBUG // RecordgrӇen checken. Neuer Compiler hat vielleichte anderes Allignment!
+ if (sizeof(SgfHeader)!=SgfHeaderSize ||
+ sizeof(SgfEntry) !=SgfEntrySize ||
+ sizeof(SgfVector)!=SgfVectorSize ||
+ sizeof(BmpFileHeader)!=BmpFileHeaderSize ||
+ sizeof(BmpInfoHeader)!=BmpInfoHeaderSize ||
+ sizeof(RGBQuad )!=RGBQuadSize ) return SGF_DONTKNOW;
+#endif
+
+ ULONG nPos;
+ SgfHeader aHead;
+ nVersion=0;
+ nPos=rInp.Tell();
+ rInp>>aHead;
+ rInp.Seek(nPos);
+ if (aHead.ChkMagic()) {
+ nVersion=aHead.Version;
+ switch(aHead.Typ) {
+ case SgfBitImag0:
+ case SgfBitImag1:
+ case SgfBitImag2:
+ case SgfBitImgMo: return SGF_BITIMAGE;
+ case SgfSimpVect: return SGF_SIMPVECT;
+ case SgfPostScrp: return SGF_POSTSCRP;
+ case SgfStarDraw: return SGF_STARDRAW;
+ default : return SGF_DONTKNOW;
+ }
+ } else {
+ return SGF_DONTKNOW;
+ }
+}
diff --git a/svtools/source/filter.vcl/filter/sgvmain.cxx b/svtools/source/filter.vcl/filter/sgvmain.cxx
new file mode 100644
index 000000000000..33e59755579a
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/sgvmain.cxx
@@ -0,0 +1,1220 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgvmain.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef MAC
+#include <mac_start.h>
+#include <math.h>
+#include <mac_end.h>
+#else
+#include <math.h>
+#endif
+#include <vcl/graph.hxx>
+#include <vcl/poly.hxx>
+#include "filter.hxx"
+#include "sgffilt.hxx"
+#include "sgfbram.hxx"
+#include "sgvmain.hxx"
+#include "sgvspln.hxx"
+
+#ifdef DEBUG
+//#include "Debug.c"
+#endif
+
+#define SWAPPOINT(p) { \
+ p.x=SWAPSHORT(p.x); \
+ p.y=SWAPSHORT(p.y); }
+
+#define SWAPPAGE(p) { \
+ p.Next =SWAPLONG (p.Next ); \
+ p.nList =SWAPLONG (p.nList ); \
+ p.ListEnd=SWAPLONG (p.ListEnd); \
+ p.Paper.Size.x=SWAPSHORT(p.Paper.Size.x); \
+ p.Paper.Size.y=SWAPSHORT(p.Paper.Size.y); \
+ p.Paper.RandL =SWAPSHORT(p.Paper.RandL ); \
+ p.Paper.RandR =SWAPSHORT(p.Paper.RandR ); \
+ p.Paper.RandO =SWAPSHORT(p.Paper.RandO ); \
+ p.Paper.RandU =SWAPSHORT(p.Paper.RandU ); \
+ SWAPPOINT(p.U); \
+ UINT16 iTemp; \
+ for (iTemp=0;iTemp<20;iTemp++) { \
+ rPage.HlpLnH[iTemp]=SWAPSHORT(rPage.HlpLnH[iTemp]); \
+ rPage.HlpLnV[iTemp]=SWAPSHORT(rPage.HlpLnV[iTemp]); }}
+
+#define SWAPOBJK(o) { \
+ o.Last =SWAPLONG (o.Last ); \
+ o.Next =SWAPLONG (o.Next ); \
+ o.MemSize =SWAPSHORT(o.MemSize ); \
+ SWAPPOINT(o.ObjMin); \
+ SWAPPOINT(o.ObjMax); }
+
+#define SWAPLINE(l) { \
+ l.LMSize=SWAPSHORT(l.LMSize); \
+ l.LDicke=SWAPSHORT(l.LDicke); }
+
+#define SWAPAREA(a) { \
+ a.FDummy2=SWAPSHORT(a.FDummy2); \
+ a.FMuster=SWAPSHORT(a.FMuster); }
+
+#define SWAPTEXT(t) { \
+ SWAPLINE(t.L); \
+ SWAPAREA(t.F); \
+ t.FontLo =SWAPSHORT(t.FontLo ); \
+ t.FontHi =SWAPSHORT(t.FontHi ); \
+ t.Grad =SWAPSHORT(t.Grad ); \
+ t.Breite =SWAPSHORT(t.Breite ); \
+ t.Schnitt=SWAPSHORT(t.Schnitt); \
+ t.LnFeed =SWAPSHORT(t.LnFeed ); \
+ t.Slant =SWAPSHORT(t.Slant ); \
+ SWAPLINE(t.ShdL); \
+ SWAPAREA(t.ShdF); \
+ SWAPPOINT(t.ShdVers); \
+ SWAPAREA(t.BackF); }
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Einschränkungen:
+//
+// þ Flächenmuster werden den unter StarView verfügbaren Mustern angenähert.
+// þ Linienenden werden unter StarView immer rund dargestellt und gehen über
+// den Endpunkt der Linie hinaus.
+// þ Linienmuster werden den unter StarView verfügbaren Mustern angenähert.
+// Transparent/Opak wird zur Zeit noch nicht berücksichtigt.
+// þ Keine gedrehten Ellipsen
+//
+//
+//
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#if defined( WIN ) && defined( MSC )
+#pragma code_seg( "svtools", "AUTO_CODE" )
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Für Fontübersetzung /////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+SgfFontLst* pSgfFonts = 0;
+
+#if defined( WIN ) && defined( MSC )
+#pragma code_seg( "SVTOOLS_FILTER3", "SVTOOLS_CODE" )
+static void AntiMscBug() {}
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Für Kreisunterarten, Text und gedrehte Rechtecke ////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+void RotatePoint(PointType& P, INT16 cx, INT16 cy, double sn, double cs)
+{
+ INT16 dx,dy;
+ double x1,y1;
+ dx=P.x-cx;
+ dy=P.y-cy;
+ x1=dx*cs-dy*sn;
+ y1=dy*cs+dx*sn;
+ P.x=cx+INT16(x1);
+ P.y=cy+INT16(y1);
+}
+
+void RotatePoint(Point& P, INT16 cx, INT16 cy, double sn, double cs)
+{
+ INT16 dx,dy;
+ double x1,y1;
+ dx=(INT16)(P.X()-cx);
+ dy=(INT16)(P.Y()-cy);
+ x1=dx*cs-dy*sn;
+ y1=dy*cs+dx*sn;
+ P=Point(cx+INT16(x1),cy+INT16(y1));
+}
+
+INT16 iMulDiv(INT16 a, INT16 Mul, INT16 Div)
+{
+ INT32 Temp;
+ Temp=INT32(a)*INT32(Mul)/INT32(Div);
+ return INT16(Temp);
+}
+
+UINT16 MulDiv(UINT16 a, UINT16 Mul, UINT16 Div)
+{
+ UINT32 Temp;
+ Temp=UINT32(a)*UINT32(Mul)/UINT32(Div);
+ return UINT16(Temp);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// SgfFilterSDrw ///////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd)
+{
+ rIStream.Read((char*)&rDtHd.Reserved[0],DtHdSize);
+ return rIStream;
+}
+
+void DtHdOverSeek(SvStream& rInp)
+{
+ ULONG FPos=rInp.Tell();
+ FPos+=(ULONG)DtHdSize;
+ rInp.Seek(FPos);
+// rInp.seekg(rInp.tellg()+(ULONG)DtHdSize);
+}
+
+
+SvStream& operator>>(SvStream& rIStream, PageType& rPage)
+{
+ rIStream.Read((char*)&rPage.Next,PageSize);
+#if defined __BIGENDIAN
+ SWAPPAGE(rPage);
+#endif
+ return rIStream;
+}
+
+void ObjkOverSeek(SvStream& rInp, ObjkType& rObjk)
+{
+ ULONG Siz;
+ Siz=(ULONG)rObjk.MemSize+rObjk.Last; // ObjSize+ObjAnhSize
+ rInp.Seek(rInp.Tell()+Siz);
+}
+
+SvStream& operator>>(SvStream& rInp, ObjkType& rObjk)
+{ // Die Fileposition im Stream bleibt unverändert!
+ ULONG nPos;
+ nPos=rInp.Tell();
+ rInp.Read((char*)&rObjk.Last,ObjkSize);
+#if defined __BIGENDIAN
+ SWAPOBJK(rObjk);
+#endif
+#ifdef InArbeit
+ ULONG nPos1=rInp.Tell();
+ if(nPos == nPos1) InfoBox( NULL, "tellg funkt nich" ).Execute();
+#endif
+ rInp.Seek(nPos);
+#ifdef InArbeit
+ if (rInp.Tell() != nPos) InfoBox( NULL, "seekg funkt nich" ).Execute();
+#endif
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, StrkType& rStrk)
+{
+ rInp.Read((char*)&rStrk.Last,StrkSize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rStrk);
+ SWAPLINE (rStrk.L);
+ SWAPPOINT(rStrk.Pos1);
+ SWAPPOINT(rStrk.Pos2);
+#endif
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, RectType& rRect)
+{
+ rInp.Read((char*)&rRect.Last,RectSize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rRect);
+ SWAPLINE (rRect.L);
+ SWAPAREA (rRect.F);
+ SWAPPOINT(rRect.Pos1);
+ SWAPPOINT(rRect.Pos2);
+ rRect.Radius =SWAPSHORT(rRect.Radius );
+ rRect.DrehWink=SWAPSHORT(rRect.DrehWink);
+ rRect.Slant =SWAPSHORT(rRect.Slant );
+#endif
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, PolyType& rPoly)
+{
+ rInp.Read((char*)&rPoly.Last,PolySize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rPoly);
+ SWAPLINE (rPoly.L);
+ SWAPAREA (rPoly.F);
+ // rPoly.EckP=SWAPLONG(rPoly.EckP);
+#endif
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, SplnType& rSpln)
+{
+ rInp.Read((char*)&rSpln.Last,SplnSize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rSpln);
+ SWAPLINE (rSpln.L);
+ SWAPAREA (rSpln.F);
+ // rSpln.EckP=SWAPLONG(rSpln.EckP);
+#endif
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, CircType& rCirc)
+{
+ rInp.Read((char*)&rCirc.Last,CircSize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rCirc);
+ SWAPLINE (rCirc.L);
+ SWAPAREA (rCirc.F);
+ SWAPPOINT(rCirc.Radius);
+ SWAPPOINT(rCirc.Center);
+ rCirc.DrehWink =SWAPSHORT(rCirc.DrehWink );
+ rCirc.StartWink=SWAPSHORT(rCirc.StartWink);
+ rCirc.RelWink =SWAPSHORT(rCirc.RelWink );
+#endif
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, TextType& rText)
+{
+ rInp.Read((char*)&rText.Last,TextSize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rText);
+ SWAPTEXT (rText.T);
+ SWAPPOINT(rText.Pos1);
+ SWAPPOINT(rText.Pos2);
+ rText.TopOfs =SWAPSHORT(rText.TopOfs );
+ rText.DrehWink=SWAPSHORT(rText.DrehWink);
+ rText.BoxSlant=SWAPSHORT(rText.BoxSlant);
+ rText.BufSize =SWAPSHORT(rText.BufSize );
+ //rText.Buf =SWAPLONG (rText.Buf );
+ //rText.Ext =SWAPLONG (rText.Ext );
+ SWAPPOINT(rText.FitSize);
+ rText.FitBreit=SWAPSHORT(rText.FitBreit);
+#endif
+ rText.Buffer=NULL;
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, BmapType& rBmap)
+{
+ rInp.Read((char*)&rBmap.Last,BmapSize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rBmap);
+ SWAPAREA (rBmap.F);
+ SWAPPOINT(rBmap.Pos1);
+ SWAPPOINT(rBmap.Pos2);
+ rBmap.DrehWink=SWAPSHORT(rBmap.DrehWink);
+ rBmap.Slant =SWAPSHORT(rBmap.Slant );
+ SWAPPOINT(rBmap.PixSize);
+#endif
+ return rInp;
+}
+SvStream& operator>>(SvStream& rInp, GrupType& rGrup)
+{
+ rInp.Read((char*)&rGrup.Last,GrupSize);
+#if defined __BIGENDIAN
+ SWAPOBJK (rGrup);
+ rGrup.SbLo =SWAPSHORT(rGrup.SbLo );
+ rGrup.SbHi =SWAPSHORT(rGrup.SbHi );
+ rGrup.UpLo =SWAPSHORT(rGrup.UpLo );
+ rGrup.UpHi =SWAPSHORT(rGrup.UpHi );
+ rGrup.ChartSize=SWAPSHORT(rGrup.ChartSize);
+ rGrup.ChartPtr =SWAPLONG (rGrup.ChartPtr );
+#endif
+ return rInp;
+}
+
+
+
+/*************************************************************************
+|*
+|* Sgv2SvFarbe()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+#ifndef VCL
+Color Sgv2SvFarbe(BYTE nFrb1, BYTE nFrb2, BYTE nInts)
+{
+ UINT16 r1=0,g1=0,b1=0,r2=0,g2=0,b2=0;
+ BYTE nInt2=100-nInts;
+ switch(nFrb1 & 0x07) {
+ case 0: r1=0xFFFF; g1=0xFFFF; b1=0xFFFF; break;
+ case 1: r1=0xFFFF; g1=0xFFFF; break;
+ case 2: g1=0xFFFF; b1=0xFFFF; break;
+ case 3: g1=0xFFFF; break;
+ case 4: r1=0xFFFF; b1=0xFFFF; break;
+ case 5: r1=0xFFFF; break;
+ case 6: b1=0xFFFF; break;
+ case 7: break;
+ }
+ switch(nFrb2 & 0x07) {
+ case 0: r2=0xFFFF; g2=0xFFFF; b2=0xFFFF; break;
+ case 1: r2=0xFFFF; g2=0xFFFF; break;
+ case 2: g2=0xFFFF; b2=0xFFFF; break;
+ case 3: g2=0xFFFF; break;
+ case 4: r2=0xFFFF; b2=0xFFFF; break;
+ case 5: r2=0xFFFF; break;
+ case 6: b2=0xFFFF; break;
+ case 7: break;
+ }
+#else
+Color Sgv2SvFarbe(BYTE nFrb1, BYTE nFrb2, BYTE nInts)
+{
+ UINT16 r1=0,g1=0,b1=0,r2=0,g2=0,b2=0;
+ BYTE nInt2=100-nInts;
+ switch(nFrb1 & 0x07) {
+ case 0: r1=0xFF; g1=0xFF; b1=0xFF; break;
+ case 1: r1=0xFF; g1=0xFF; break;
+ case 2: g1=0xFF; b1=0xFF; break;
+ case 3: g1=0xFF; break;
+ case 4: r1=0xFF; b1=0xFF; break;
+ case 5: r1=0xFF; break;
+ case 6: b1=0xFF; break;
+ case 7: break;
+ }
+ switch(nFrb2 & 0x07) {
+ case 0: r2=0xFF; g2=0xFF; b2=0xFF; break;
+ case 1: r2=0xFF; g2=0xFF; break;
+ case 2: g2=0xFF; b2=0xFF; break;
+ case 3: g2=0xFF; break;
+ case 4: r2=0xFF; b2=0xFF; break;
+ case 5: r2=0xFF; break;
+ case 6: b2=0xFF; break;
+ case 7: break;
+ }
+#endif
+ r1=(UINT16)((UINT32)r1*nInts/100+(UINT32)r2*nInt2/100);
+ g1=(UINT16)((UINT32)g1*nInts/100+(UINT32)g2*nInt2/100);
+ b1=(UINT16)((UINT32)b1*nInts/100+(UINT32)b2*nInt2/100);
+ Color aColor(r1,g1,b1);
+ return aColor;
+}
+
+void SetLine(ObjLineType& rLine, OutputDevice& rOut)
+{
+/* !!!
+ PenStyle aStyle=PEN_SOLID;
+ switch(rLine.LMuster & 0x07) {
+ case 0: aStyle=PEN_NULL; break;
+ case 1: aStyle=PEN_SOLID; break;
+ case 2: aStyle=PEN_DOT; break; // ù ù ù ù ù ù ù ù ù ù ù ù ù ù
+ case 3: aStyle=PEN_DASH; break; // ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ ÄÄ
+ case 4: aStyle=PEN_DASH; break; // ÄÄÄ ÄÄÄ ÄÄÄ ÄÄÄ ÄÄÄ ÄÄÄ ÄÄÄ
+ case 5: aStyle=PEN_DASHDOT; break; // ÄÄ ù ÄÄ ù ÄÄ ù ÄÄ ù ÄÄ ù ÄÄ
+ case 6: aStyle=PEN_DASHDOT; break; // ÄÄ Ä ÄÄ Ä ÄÄ Ä ÄÄ Ä ÄÄ Ä ÄÄ
+ case 7: aStyle=PEN_DASHDOT; break; // ÄÄÄ Ä Ä ÄÄÄ Ä Ä ÄÄÄ Ä Ä ÄÄÄ
+ }
+ Pen aPen(Sgv2SvFarbe(rLine.LFarbe,rLine.LBFarbe,rLine.LIntens),rLine.LDicke,aStyle);
+ SetPen(aPen,rOut);
+*/
+ if( 0 == ( rLine.LMuster & 0x07 ) )
+ rOut.SetLineColor();
+ else
+ rOut.SetLineColor( Sgv2SvFarbe(rLine.LFarbe,rLine.LBFarbe,rLine.LIntens) );
+}
+
+void SetArea(ObjAreaType& rArea, OutputDevice& rOut)
+{
+/*
+ BrushStyle aStyle=BRUSH_SOLID;
+ switch(rArea.FMuster & 0x00FF) {
+ case 0: aStyle=BRUSH_NULL; break;
+ case 1: aStyle=BRUSH_SOLID; break;
+ case 2: case 4: case 6: case 8:
+ case 10: case 12: case 14: case 16:
+ case 43: case 45: aStyle=BRUSH_VERT; break;
+ case 3: case 5: case 7: case 9:
+ case 11: case 13: case 15: case 17:
+ case 42: case 44: aStyle=BRUSH_HORZ; break;
+ case 18: case 20: case 22: case 24:
+ case 26: case 28: case 30: case 32:
+ case 46: case 48: aStyle=BRUSH_UPDIAG; break;
+ case 19: case 21: case 23: case 25:
+ case 27: case 29: case 31: case 33:
+ case 47: case 49: aStyle=BRUSH_DOWNDIAG; break;
+ case 34: case 35: case 36: case 37: aStyle=BRUSH_CROSS; break;
+ case 38: case 39: case 40: case 41: aStyle=BRUSH_DIAGCROSS; break;
+ default: aStyle=BRUSH_DIAGCROSS; break;
+ }
+ Brush aBrush(Sgv2SvFarbe(rArea.FFarbe,rArea.FBFarbe,rArea.FIntens),aStyle);
+ aBrush.SetTransparent((rArea.FMuster & 0x80) !=0L);
+ SetBrush(aBrush,rOut);
+*/
+ if( 0 == ( rArea.FMuster & 0x00FF ) )
+ rOut.SetFillColor();
+ else
+ rOut.SetFillColor( Sgv2SvFarbe( rArea.FFarbe,rArea.FBFarbe,rArea.FIntens ) );
+}
+
+/*************************************************************************
+|*
+|* ObjkType::DrawObjekt()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void ObjkType::Draw(OutputDevice&)
+{
+// ShowSDObjk(*this);
+}
+
+void Obj0Type::Draw(OutputDevice&) {}
+
+/*************************************************************************
+|*
+|* StrkType::DrawObjekt()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void StrkType::Draw(OutputDevice& rOut)
+{
+ SetLine(L,rOut);
+ rOut.DrawLine(Point(Pos1.x,Pos1.y),Point(Pos2.x,Pos2.y)); // !!!
+}
+
+/*************************************************************************
+|*
+|* RectType::DrawObjekt()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void SgfAreaColorIntens(UINT16 Muster, BYTE Col1, BYTE Col2, BYTE Int, OutputDevice& rOut)
+{
+ ObjAreaType F;
+ F.FMuster=Muster;
+ F.FFarbe=Col2;
+ F.FBFarbe=Col1;
+ F.FIntens=Int;
+ SetArea(F,rOut);
+}
+
+void DrawSlideRect(INT16 x1, INT16 y1, INT16 x2, INT16 y2, ObjAreaType& F, OutputDevice& rOut)
+{
+ INT16 i,i0,b,b0;
+ INT16 Int1,Int2;
+ INT16 Col1,Col2;
+ // ClipMerk: HgdClipRec;
+ INT16 cx,cy;
+ INT16 MaxR;
+ INT32 dx,dy;
+
+ rOut.SetLineColor();
+ if (x1>x2) { i=x1; x1=x2; x2=i; }
+ if (y1>y2) { i=y1; y1=y2; y2=i; }
+ Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87;
+ Int1=100-F.FIntens; Int2=F.FIntens;
+ if (Int1==Int2) {
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut);
+ rOut.DrawRect(Rectangle(x1,y1,x2,y2));
+ } else {
+ b0=Int1;
+ switch (F.FBFarbe & 0x38) {
+ case 0x08: { // vertikal
+ i0=y1;
+ i=y1;
+ while (i<=y2) {
+ b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-y1) /(INT32)(y2-y1+1));
+ if (b!=b0) {
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut);
+ rOut.DrawRect(Rectangle(x1,i0,x2,i-1));
+ i0=i; b0=b;
+ }
+ i++;
+ }
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut);
+ rOut.DrawRect(Rectangle(x1,i0,x2,y2));
+ } break;
+ case 0x28: { // horizontal
+ i0=x1;
+ i=x1;
+ while (i<=x2) {
+ b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-x1) /(INT32)(x2-x1+1));
+ if (b!=b0) {
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut);
+ rOut.DrawRect(Rectangle(i0,y1,i-1,y2));
+ i0=i; b0=b;
+ }
+ i++;
+ }
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut);
+ rOut.DrawRect(Rectangle(i0,y1,x2,y2));
+ } break;
+
+ case 0x18: case 0x38: { // Kreis
+ Region ClipMerk=rOut.GetClipRegion();
+ double a;
+
+ rOut.SetClipRegion(Region(Rectangle(x1,y1,x2,y2)));
+ cx=(x1+x2) /2;
+ cy=(y1+y2) /2;
+ dx=x2-x1+1;
+ dy=y2-y1+1;
+ a=sqrt((double)(dx*dx+dy*dy));
+ MaxR=INT16(a) /2 +1;
+ b0=Int2;
+ i0=MaxR; if (MaxR<1) MaxR=1;
+ i=MaxR;
+ while (i>=0) {
+ b=Int1+INT16((INT32(Int2-Int1)*INT32(i)) /INT32(MaxR));
+ if (b!=b0) {
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut);
+ //if (i0>200 || (Col1 & $80)!=0 || (Col2 & $80)!=0) {
+ // then begin { Fallunterscheidung für etwas bessere Performance }
+ // s2:=i0-i+2;
+ // SetPenSize(s2);
+ // s2:=s2 div 2;
+ // Circle(cx,cy,i0-s2,i0-s2);{}
+ // else
+ rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0));
+ i0=i; b0=b;
+ }
+ i--;
+ }
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int1,rOut);
+ rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0));
+ rOut.SetClipRegion(ClipMerk);
+ } break; // Kreis
+ }
+ }
+}
+
+
+void RectType::Draw(OutputDevice& rOut)
+{
+ if (L.LMuster!=0) L.LMuster=1; // keine Linienmuster hier, nur an oder aus
+ SetArea(F,rOut);
+ if (DrehWink==0) {
+ if ((F.FBFarbe & 0x38)==0 || Radius!=0) {
+ SetLine(L,rOut);
+ rOut.DrawRect(Rectangle(Pos1.x,Pos1.y,Pos2.x,Pos2.y),Radius,Radius);
+ } else {
+ DrawSlideRect(Pos1.x,Pos1.y,Pos2.x,Pos2.y,F,rOut);
+ if (L.LMuster!=0) {
+ SetLine(L,rOut);
+ rOut.SetFillColor();
+ rOut.DrawRect(Rectangle(Pos1.x,Pos1.y,Pos2.x,Pos2.y));
+ }
+ }
+ } else {
+ Point aPts[4];
+ USHORT i;
+ double sn,cs;
+ sn=sin(double(DrehWink)*3.14159265359/18000);
+ cs=cos(double(DrehWink)*3.14159265359/18000);
+ aPts[0]=Point(Pos1.x,Pos1.y);
+ aPts[1]=Point(Pos2.x,Pos1.y);
+ aPts[2]=Point(Pos2.x,Pos2.y);
+ aPts[3]=Point(Pos1.x,Pos2.y);
+ for (i=0;i<4;i++) {
+ RotatePoint(aPts[i],Pos1.x,Pos1.y,sn,cs);
+ }
+ SetLine(L,rOut);
+ Polygon aPoly(4,aPts);
+ rOut.DrawPolygon(aPoly);
+ }
+}
+
+/*************************************************************************
+|*
+|* PolyType::Draw()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void PolyType::Draw(OutputDevice& rOut)
+{
+ if ((Flags & PolyClosBit) !=0) SetArea(F,rOut);
+ SetLine(L,rOut);
+ Polygon aPoly(nPoints);
+ USHORT i;
+ for(i=0;i<nPoints;i++) aPoly.SetPoint(Point(EckP[i].x,EckP[i].y),i);
+ if ((Flags & PolyClosBit) !=0) {
+ rOut.DrawPolygon(aPoly);
+ } else {
+ rOut.DrawPolyLine(aPoly);
+ }
+}
+
+/*************************************************************************
+|*
+|* SplnType::Draw()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void SplnType::Draw(OutputDevice& rOut)
+{
+ if ((Flags & PolyClosBit) !=0) SetArea(F,rOut);
+ SetLine(L,rOut);
+ Polygon aPoly(0);
+ Polygon aSpln(nPoints);
+ USHORT i;
+ for(i=0;i<nPoints;i++) aSpln.SetPoint(Point(EckP[i].x,EckP[i].y),i);
+ if ((Flags & PolyClosBit) !=0) {
+ Spline2Poly(aSpln,TRUE,aPoly);
+ if (aPoly.GetSize()>0) rOut.DrawPolygon(aPoly);
+ } else {
+ Spline2Poly(aSpln,FALSE,aPoly);
+ if (aPoly.GetSize()>0) rOut.DrawPolyLine(aPoly);
+ }
+}
+
+/*************************************************************************
+|*
+|* CircType::Draw()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void DrawSlideCirc(INT16 cx, INT16 cy, INT16 rx, INT16 ry, ObjAreaType& F, OutputDevice& rOut)
+{
+ INT16 x1=cx-rx;
+ INT16 y1=cy-ry;
+ INT16 x2=cx+rx;
+ INT16 y2=cy+ry;
+
+ INT16 i,i0,b,b0;
+ INT16 Int1,Int2;
+ INT16 Col1,Col2;
+
+ rOut.SetLineColor();
+ Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87;
+ Int1=100-F.FIntens; Int2=F.FIntens;
+ if (Int1==Int2) {
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut);
+ rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
+ } else {
+ b0=Int1;
+ switch (F.FBFarbe & 0x38) {
+ case 0x08: { // vertikal
+ Region ClipMerk=rOut.GetClipRegion();
+ i0=y1;
+ i=y1;
+ while (i<=y2) {
+ b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-y1) /(INT32)(y2-y1+1));
+ if (b!=b0) {
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut);
+ rOut.SetClipRegion(Rectangle(x1,i0,x2,i-1));
+ rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
+ i0=i; b0=b;
+ }
+ i++;
+ }
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut);
+ rOut.SetClipRegion(Rectangle(x1,i0,x2,y2));
+ rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
+ rOut.SetClipRegion(ClipMerk);
+ } break;
+ case 0x28: { // horizontal
+ Region ClipMerk=rOut.GetClipRegion();
+ i0=x1;
+ i=x1;
+ while (i<=x2) {
+ b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-x1) /(INT32)(x2-x1+1));
+ if (b!=b0) {
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut);
+ rOut.SetClipRegion(Rectangle(i0,y1,i-1,y2));
+ rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
+ i0=i; b0=b;
+ }
+ i++;
+ }
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut);
+ rOut.SetClipRegion(Rectangle(i0,y1,x2,y2));
+ rOut.DrawEllipse(Rectangle(x1,y1,x2,y2));
+ rOut.SetClipRegion(ClipMerk);
+ } break;
+
+ case 0x18: case 0x38: { // Kreis
+ INT16 MaxR;
+
+ if (rx<1) rx=1;
+ if (ry<1) ry=1;
+ MaxR=rx;
+ b0=Int2;
+ i0=MaxR; if (MaxR<1) MaxR=1;
+ i=MaxR;
+ while (i>=0) {
+ b=Int1+INT16((INT32(Int2-Int1)*INT32(i)) /INT32(MaxR));
+ if (b!=b0) {
+ INT32 temp=INT32(i0)*INT32(ry)/INT32(rx);
+ INT16 j0=INT16(temp);
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut);
+ rOut.DrawEllipse(Rectangle(cx-i0,cy-j0,cx+i0,cy+j0));
+ i0=i; b0=b;
+ }
+ i--;
+ }
+ SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int1,rOut);
+ rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0));
+ } break; // Kreis
+ }
+ }
+}
+
+
+void CircType::Draw(OutputDevice& rOut)
+{
+ Rectangle aRect(Center.x-Radius.x,Center.y-Radius.y,Center.x+Radius.x,Center.y+Radius.y);
+
+ if (L.LMuster!=0) L.LMuster=1; // keine Linienmuster hier, nur an oder aus
+ SetArea(F,rOut);
+ if ((Flags & 0x03)==CircFull) {
+ if ((F.FBFarbe & 0x38)==0) {
+ SetLine(L,rOut);
+ rOut.DrawEllipse(aRect);
+ } else {
+ DrawSlideCirc(Center.x,Center.y,Radius.x,Radius.y,F,rOut);
+ if (L.LMuster!=0) {
+ SetLine(L,rOut);
+ rOut.SetFillColor();
+ rOut.DrawEllipse(aRect);
+ }
+ }
+ } else {
+ PointType a,b;
+ Point aStrt,aEnde;
+ double sn,cs;
+
+ a.x=Center.x+Radius.x; a.y=Center.y; b=a;
+ sn=sin(double(StartWink)*3.14159265359/18000);
+ cs=cos(double(StartWink)*3.14159265359/18000);
+ RotatePoint(a,Center.x,Center.y,sn,cs);
+ sn=sin(double(StartWink+RelWink)*3.14159265359/18000);
+ cs=cos(double(StartWink+RelWink)*3.14159265359/18000);
+ RotatePoint(b,Center.x,Center.y,sn,cs);
+ if (Radius.x!=Radius.y) {
+ if (Radius.x<1) Radius.x=1;
+ if (Radius.y<1) Radius.y=1;
+ a.y-=Center.y;
+ b.y-=Center.y;
+ a.y=iMulDiv(a.y,Radius.y,Radius.x);
+ b.y=iMulDiv(b.y,Radius.y,Radius.x);
+ a.y+=Center.y;
+ b.y+=Center.y;
+ }
+ aStrt=Point(a.x,a.y);
+ aEnde=Point(b.x,b.y);
+ SetLine(L,rOut);
+ switch (Flags & 0x03) {
+ case CircArc : rOut.DrawArc(aRect,aEnde,aStrt); break;
+ case CircSect:
+ case CircAbsn: rOut.DrawPie(aRect,aEnde,aStrt); break;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* BmapType::Draw()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+
+void BmapType::SetPaths(const INetURLObject rFltPath, const INetURLObject rCfgPath)
+{
+ aFltPath = rFltPath;
+ aCfgPath = rCfgPath;
+}
+
+void BmapType::Draw(OutputDevice& rOut)
+{
+ //ifstream aInp;
+ unsigned char nSgfTyp;
+ USHORT nVersion;
+ String aStr( Filename[ 1 ], (xub_StrLen)Filename[ 0 ], RTL_TEXTENCODING_UTF8 );
+ INetURLObject aFNam;
+ aFNam.SetSmartURL( aStr );
+ BOOL Ok = ImplDirEntryHelper::Exists( aFNam );
+ if (!Ok)
+ {
+ aStr = aFNam.GetName(); // Path weg, nur nach Namen suchen
+ aFNam.SetSmartURL( aStr );
+ Ok = ImplDirEntryHelper::Exists( aFNam );
+ }
+ SvFileStream aInp( aFNam.PathToFileName(), STREAM_READ );
+ if (Ok)
+ Ok=aInp.GetError() ? FALSE : TRUE;
+ if (Ok) {
+ nSgfTyp=CheckSgfTyp(aInp,nVersion);
+ switch(nSgfTyp) {
+ case SGF_BITIMAGE: {
+ GraphicFilter aFlt;
+ Graphic aGrf;
+ USHORT nRet;
+ aFlt.SetFilterPath(aFltPath);
+ aFlt.SetConfigPath(aCfgPath);
+ nRet=aFlt.ImportGraphic(aGrf,aFNam);
+ aGrf.Draw(&rOut,Point(Pos1.x,Pos1.y),Size(Pos2.x-Pos1.x,Pos2.y-Pos1.y));
+ } break;
+ case SGF_SIMPVECT: {
+ GDIMetaFile aMtf;
+ SgfVectXofs=Pos1.x;
+ SgfVectYofs=Pos1.y;
+ SgfVectXmul=Pos2.x-Pos1.x;
+ SgfVectYmul=Pos2.y-Pos1.y;
+ SgfVectXdiv=0;
+ SgfVectYdiv=0;
+ SgfVectScal=TRUE;
+ Ok=SgfVectFilter(aInp,aMtf);
+ SgfVectXofs=0;
+ SgfVectYofs=0;
+ SgfVectXmul=0;
+ SgfVectYmul=0;
+ SgfVectXdiv=0;
+ SgfVectYdiv=0;
+ SgfVectScal=FALSE;
+ aMtf.Play(&rOut);
+ } break;
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* GrupType::...
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+UINT32 GrupType::GetSubPtr()
+{
+ return UINT32(SbLo)+0x00010000*UINT32(SbHi);
+}
+
+/*************************************************************************
+|*
+|* DrawObjkList()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void DrawObjkList(SvStream& rInp, OutputDevice& rOut, const INetURLObject& rFltPath, const INetURLObject& rCfgPath)
+{
+ ObjkType aObjk;
+ USHORT nGrpCnt=0;
+ BOOL bEnde=FALSE;
+ do {
+ rInp>>aObjk;
+ if (!rInp.GetError()) {
+ switch(aObjk.Art) {
+ case ObjStrk: { StrkType aStrk; rInp>>aStrk; if (!rInp.GetError()) aStrk.Draw(rOut); } break;
+ case ObjRect: { RectType aRect; rInp>>aRect; if (!rInp.GetError()) aRect.Draw(rOut); } break;
+ case ObjCirc: { CircType aCirc; rInp>>aCirc; if (!rInp.GetError()) aCirc.Draw(rOut); } break;
+ case ObjText: {
+ TextType aText;
+ rInp>>aText;
+ if (!rInp.GetError()) {
+ aText.Buffer=new UCHAR[aText.BufSize+1]; // Ein mehr für LookAhead bei CK-Trennung
+ rInp.Read((char* )aText.Buffer,aText.BufSize);
+ if (!rInp.GetError()) aText.Draw(rOut);
+ delete aText.Buffer;
+ }
+ } break;
+ case ObjBmap: {
+ BmapType aBmap;
+ rInp>>aBmap;
+ if (!rInp.GetError()) {
+ aBmap.SetPaths( rFltPath, rCfgPath );
+ aBmap.Draw(rOut);
+ }
+ } break;
+ case ObjPoly: {
+ PolyType aPoly;
+ rInp>>aPoly;
+ if (!rInp.GetError()) {
+ aPoly.EckP=new PointType[aPoly.nPoints];
+ rInp.Read((char*)aPoly.EckP,4*aPoly.nPoints);
+#if defined __BIGENDIAN
+ for(short i=0;i<aPoly.nPoints;i++) SWAPPOINT(aPoly.EckP[i]);
+#endif
+ if (!rInp.GetError()) aPoly.Draw(rOut);
+ delete aPoly.EckP;
+ }
+ } break;
+ case ObjSpln: {
+ SplnType aSpln;
+ rInp>>aSpln;
+ if (!rInp.GetError()) {
+ aSpln.EckP=new PointType[aSpln.nPoints];
+ rInp.Read((char*)aSpln.EckP,4*aSpln.nPoints);
+#if defined __BIGENDIAN
+ for(short i=0;i<aSpln.nPoints;i++) SWAPPOINT(aSpln.EckP[i]);
+#endif
+ if (!rInp.GetError()) aSpln.Draw(rOut);
+ delete aSpln.EckP;
+ }
+ } break;
+ case ObjGrup: {
+ GrupType aGrup;
+ rInp>>aGrup;
+ if (!rInp.GetError()) {
+ rInp.Seek(rInp.Tell()+aGrup.Last); // Obj-Anhängsel
+ if(aGrup.GetSubPtr()!=0L) nGrpCnt++;// DrawObjkList(rInp,rOut,rFltPath,rCfgPath);
+ }
+ } break;
+ default: {
+ aObjk.Draw(rOut); // Objektbezeichnung auf 2. Screen
+ ObjkOverSeek(rInp,aObjk); // zum nächsten Objekt
+ }
+ }
+ } // if rInp
+ if (!rInp.GetError()) {
+ if (aObjk.Next==0L) {
+ if (nGrpCnt==0) bEnde=TRUE;
+ else nGrpCnt--;
+ }
+ } else {
+ bEnde=TRUE; // Lesefehler
+ }
+ } while (!bEnde);
+}
+
+/*************************************************************************
+|*
+|* SkipObjkList()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+void SkipObjkList(SvStream& rInp)
+{
+ ObjkType aObjk;
+ do
+ {
+ rInp>>aObjk;
+ if(aObjk.Art==ObjGrup) {
+ GrupType aGrup;
+ rInp>>aGrup;
+ rInp.Seek(rInp.Tell()+aGrup.Last); // Obj-Anhängsel
+ if(aGrup.GetSubPtr()!=0L) SkipObjkList(rInp);
+ } else {
+ ObjkOverSeek(rInp,aObjk); // zum nächsten Objekt
+ }
+ } while (aObjk.Next!=0L && !rInp.GetError());
+}
+
+/*************************************************************************
+|*
+|* SgfFilterSDrw()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfFilterSDrw(SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf, const INetURLObject& rFltPath, const INetURLObject& rCfgPath)
+{
+ BOOL bRet = FALSE;
+ ObjkType aObjk;
+ PageType aPage;
+ VirtualDevice aOutDev;
+ OutputDevice* pOutDev;
+ ULONG nStdPos;
+ ULONG nZchPos;
+ USHORT Num;
+
+ pOutDev=&aOutDev;
+ DtHdOverSeek(rInp); // DataHeader weglesen
+
+ nStdPos=rInp.Tell();
+ do { // Standardseiten weglesen
+ rInp>>aPage;
+ if (aPage.nList!=0) SkipObjkList(rInp);
+ } while (aPage.Next!=0L && !rInp.GetError());
+
+// ShowMsg("Zeichnungseite(n)\n");
+ nZchPos=rInp.Tell();
+ rInp>>aPage;
+
+ rMtf.Record(pOutDev);
+ Num=aPage.StdPg;
+ if (Num!=0) {
+ rInp.Seek(nStdPos);
+ while(Num>1 && aPage.Next!=0L && !rInp.GetError()) { // Standardseite suchen
+ rInp>>aPage;
+ if (aPage.nList!=0) SkipObjkList(rInp);
+ Num--;
+ }
+ rInp>>aPage;
+ if(Num==1 && aPage.nList!=0L) DrawObjkList(rInp,*pOutDev,rFltPath,rCfgPath);
+ rInp.Seek(nZchPos);
+ nZchPos=rInp.Tell();
+ rInp>>aPage;
+ }
+ if (aPage.nList!=0L) DrawObjkList(rInp,*pOutDev,rFltPath,rCfgPath);
+
+ rMtf.Stop();
+ rMtf.WindStart();
+ MapMode aMap(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4));
+ rMtf.SetPrefMapMode(aMap);
+ rMtf.SetPrefSize(Size((INT16)aPage.Paper.Size.x,(INT16)aPage.Paper.Size.y));
+ bRet=TRUE;
+ return bRet;
+}
+
+
+
+/*************************************************************************
+|*
+|* SgfSDrwFilter()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath, const INetURLObject& rFltPath, const INetURLObject& rCfgPath)
+{
+#ifdef DEBUG // Recordgrößen checken. Neuer Compiler hat vielleichte anderes Allignment!
+ if (sizeof(ObjTextType)!=ObjTextTypeSize) return FALSE;
+#endif
+
+ ULONG nFileStart; // Offset des SgfHeaders. Im allgemeinen 0.
+ SgfHeader aHead;
+ SgfEntry aEntr;
+ ULONG nNext;
+ BOOL bRdFlag=FALSE; // Grafikentry gelesen ?
+ BOOL bRet=FALSE; // Returncode
+
+ aIniPath.Append( String::CreateFromAscii( "sgf.ini", 7 ) );
+// aIniPath.ToAbs();
+
+ pSgfFonts = new SgfFontLst;
+
+ pSgfFonts->AssignFN( aIniPath.PathToFileName() );
+ nFileStart=rInp.Tell();
+ rInp>>aHead;
+ if (aHead.ChkMagic() && aHead.Typ==SgfStarDraw && aHead.Version==SGV_VERSION) {
+ nNext=aHead.GetOffset();
+ while (nNext && !bRdFlag && !rInp.GetError()) {
+ rInp.Seek(nFileStart+nNext);
+ rInp>>aEntr;
+ nNext=aEntr.GetOffset();
+ if (aEntr.Typ==aHead.Typ) {
+ bRet=SgfFilterSDrw(rInp,aHead,aEntr,rMtf,rFltPath,rCfgPath);
+ }
+ } // while(nNext)
+ if (bRdFlag) {
+ if (!rInp.GetError()) bRet=TRUE; // Scheinbar Ok
+ }
+ }
+ delete pSgfFonts;
+ return(bRet);
+}
+
+/*
+Bitmap Dither(BYTE Intens)
+{
+ Bitmap aBmp;
+ BmpInfoHeader Info;
+
+
+const dmatrix: array[0..7,0..7] of byte =
+ (( 0, 48, 12, 60, 3, 51, 15, 63 ),
+ ( 32, 16, 44, 28, 35, 19, 47, 31 ),
+ ( 8, 56, 4, 52, 11, 59, 7, 55 ),
+ ( 40, 24, 36, 20, 43, 27, 39, 23 ),
+ ( 2, 50, 14, 62, 1, 49, 13, 61 ),
+ ( 34, 18, 46, 30, 33, 17, 45, 29 ),
+ ( 10, 58, 6, 54, 9, 57, 5, 53 ),
+ ( 42, 26, 38, 22, 41, 25, 37, 21 ));
+
+
+ cmatrix: array[0..7,0..7] of byte;
+ dmatrixn,dmatrixi: array[0..7] of byte;
+
+
+procedure SetColorIntens(col0,col1,bal: integer);
+var cmatrix0: array[0..63] of byte absolute cmatrix;
+ dmatrix0: array[0..63] of byte absolute dmatrix;
+ n,i: integer;
+ b,bit: byte;
+begin
+if col0=col1 then bal:=0;
+if bal<=32 then
+ begin
+ plotcolor0:=col0 and $1F; plotcolor1:=col1 and $1F;
+ plotbal:=bal;
+ end
+else
+ begin
+ plotcolor0:=col1 and $1F; plotcolor1:=col0 and $1F;
+ plotbal:=64-bal;
+ end;
+for n:=0 to 63 do
+ if plotbal<=dmatrix0[n] then cmatrix0[n]:=col0 else cmatrix0[n]:=col1;
+end;
+*/
+
+#if defined( WIN ) && defined( MSC )
+#pragma code_seg( "svtools", "AUTO_CODE" )
+#endif
+
diff --git a/svtools/source/filter.vcl/filter/sgvspln.cxx b/svtools/source/filter.vcl/filter/sgvspln.cxx
new file mode 100644
index 000000000000..1934ca6091cb
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/sgvspln.cxx
@@ -0,0 +1,1115 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgvspln.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef MAC
+#include <mac_start.h>
+#include <math.h>
+#include <mac_end.h>
+#else
+#include <math.h>
+#endif
+
+
+#ifndef _SV_POLY_HXX //autogen
+#include <vcl/poly.hxx>
+#endif
+
+#if defined( WIN ) && defined( MSC )
+#pragma code_seg( "SVTOOLS_FILTER2", "SVTOOLS_CODE" )
+#pragma optimize( "", off )
+#endif
+
+#if defined( PM2 ) && defined( __BORLANDC__ )
+#pragma option -Od
+#endif
+
+extern "C" {
+
+/*.pn 277 */
+/*.hlAnhang: C - Programme*/
+/*.hrKonstanten- und Macro-Definitionen*/
+/*.fe Die Include-Datei u_const.h ist in das Verzeichnis zu stellen, */
+/*.fe wo der Compiler nach Include-Dateien sucht. */
+
+
+/*----------------------- FILE u_const.h ---------------------------*/
+
+#ifndef S390
+#define IEEE
+#endif
+
+/* IEEE - Norm fuer die Darstellung von Gleitkommazahlen:
+
+ 8 Byte lange Gleitkommazahlen, mit
+
+ 53 Bit Mantisse ==> Mantissenbereich: 2 hoch 52 versch. Zahlen
+ mit 0.1 <= Zahl < 1.0,
+ 1 Vorzeichen-Bit
+ 11 Bit Exponent ==> Exponentenbereich: -1024...+1023
+
+ Die 1. Zeile ( #define IEEE ) ist zu loeschen, falls die Maschine
+ bzw. der Compiler keine Gleitpunktzahlen gemaess der IEEE-Norm
+ benutzt. Zusaetzlich muessen die Zahlen MAXEXPON, MINEXPON
+ (s.u.) angepasst werden.
+ */
+
+#ifdef IEEE /*----------- Falls IEEE Norm --------------------*/
+
+#define MACH_EPS 2.220446049250313e-016 /* Maschinengenauigkeit */
+ /* IBM-AT: = 2 hoch -52 */
+/* MACH_EPS ist die kleinste positive, auf der Maschine darstellbare
+ Zahl x, die der Bedingung genuegt: 1.0 + x > 1.0 */
+
+#define EPSQUAD 4.930380657631324e-032
+#define EPSROOT 1.490116119384766e-008
+
+#define POSMAX 8.98846567431158e+307 /* groesste positive Zahl */
+#define POSMIN 5.56268464626800e-309 /* kleinste positive Zahl */
+#define MAXROOT 9.48075190810918e+153
+
+#define BASIS 2 /* Basis der Zahlendarst. */
+#ifndef PI
+#define PI 3.141592653589793e+000
+#endif
+#define EXP_1 2.718281828459045e+000
+
+#else /*------------------ sonst -----------------------*/
+
+#ifndef S390
+double exp (double);
+double atan (double);
+double pow (double,double);
+double sqrt (double);
+#endif
+
+double masch() /* MACH_EPS maschinenunabhaengig bestimmen */
+{
+ double eps = 1.0, x = 2.0, y = 1.0;
+ while ( y < x )
+ { eps *= 0.5;
+ x = 1.0 + eps;
+ }
+ eps *= 2.0; return (eps);
+}
+
+short basis() /* BASIS maschinenunabhaengig bestimmen */
+{
+ double x = 1.0, one = 1.0, b = 1.0;
+
+ while ( (x + one) - x == one ) x *= 2.0;
+ while ( (x + b) == x ) b *= 2.0;
+
+ return ( (short) ((x + b) - x) );
+}
+
+#define BASIS basis() /* Basis der Zahlendarst. */
+
+/* Falls die Maschine (der Compiler) keine IEEE-Darstellung fuer
+ Gleitkommazahlen nutzt, muessen die folgenden 2 Konstanten an-
+ gepasst werden.
+ */
+
+#ifndef S390
+#define MAXEXPON 1023.0 /* groesster Exponent */
+#define MINEXPON -1024.0 /* kleinster Exponent */
+#else
+#include <float.h>
+#define MAXEXPON 75.0
+#define MINEXPON -79.0
+#endif
+
+
+#define MACH_EPS masch()
+#define EPSQUAD MACH_EPS * MACH_EPS
+#define EPSROOT sqrt(MACH_EPS)
+
+#define POSMAX pow ((double) BASIS, MAXEXPON)
+#define POSMIN pow ((double) BASIS, MINEXPON)
+#define MAXROOT sqrt(POSMAX)
+
+#define PI 4.0 * atan (1.0)
+#define EXP_1 exp(1.0)
+
+#endif /*-------------- ENDE ifdef ----------------------*/
+
+
+#define NEGMAX -POSMIN /* groesste negative Zahl */
+#define NEGMIN -POSMAX /* kleinste negative Zahl */
+
+#define TRUE 1
+#define FALSE 0
+
+
+/* Definition von Funktionsmakros:
+ */
+
+// #define min(X, Y) ((X) < (Y) ? (X) : (Y)) /* Minimum von X,Y */
+// #define max(X, Y) ((X) > (Y) ? (X) : (Y)) /* Maximum von X,Y */
+#define abs(X) ((X) >= 0 ? (X) : -(X)) /* Absolutbetrag von X */
+#define sign(X, Y) (Y < 0 ? -abs(X) : abs(X)) /* Vorzeichen von */
+ /* Y mal abs(X) */
+#define sqr(X) ((X) * (X)) /* Quadrat von X */
+
+/*------------------- ENDE FILE u_const.h --------------------------*/
+
+
+
+
+
+
+
+
+
+/*.HL Anhang: C - Programme*/
+/*.HRGleichungssysteme fr Tridiagonalmatrizen*/
+
+/*.FE P 3.7 TRIDIAGONALE GLEICHUNGSSYSTEME*/
+
+
+/*---------------------- MODUL TRIDIAGONAL ------------------------*/
+
+USHORT TriDiagGS(BOOL rep, USHORT n, double* lower,
+ double* diag, double* upper, double* b)
+ /************************/
+ /* GAUSS-Verfahren fuer */
+ /* Tridiagonalmatrizen */
+ /************************/
+
+/*====================================================================*/
+/* */
+/* trdiag bestimmt die Loesung x des linearen Gleichungssystems */
+/* A * x = b mit tridiagonaler n x n Koeffizientenmatrix A, die in */
+/* den 3 Vektoren lower, upper und diag wie folgt abgespeichert ist: */
+/* */
+/* ( diag[0] upper[0] 0 0 . . . 0 ) */
+/* ( lower[1] diag[1] upper[1] 0 . . . ) */
+/* ( 0 lower[2] diag[2] upper[2] 0 . ) */
+/* A = ( . 0 lower[3] . . . ) */
+/* ( . . . . . 0 ) */
+/* ( . . . . . ) */
+/* ( . . . upper[n-2] ) */
+/* ( 0 . . . 0 lower[n-1] diag[n-1] ) */
+/* */
+/*====================================================================*/
+/* */
+/* Anwendung: */
+/* ========= */
+/* Vorwiegend fuer diagonaldominante Tridiagonalmatrizen, wie */
+/* sie bei der Spline-Interpolation auftreten. */
+/* Fuer diagonaldominante Matrizen existiert immer eine LU- */
+/* Zerlegung; fuer nicht diagonaldominante Tridiagonalmatrizen */
+/* sollte die Funktion band vorgezogen werden, da diese mit */
+/* Spaltenpivotsuche arbeitet und daher numerisch stabiler ist. */
+/* */
+/*====================================================================*/
+/* */
+/* Eingabeparameter: */
+/* ================ */
+/* n Dimension der Matrix ( > 1 ) USHORT n */
+/* */
+/* lower untere Nebendiagonale double lower[n] */
+/* diag Hauptdiagonale double diag[n] */
+/* upper obere Nebendiagonale double upper[n] */
+/* */
+/* bei rep != 0 enthalten lower, diag und upper die */
+/* Dreieckzerlegung der Ausgangsmatrix. */
+/* */
+/* b rechte Seite des Systems double b[n] */
+/* rep = 0 erstmaliger Aufruf BOOL rep */
+/* !=0 wiederholter Aufruf */
+/* fuer gleiche Matrix, */
+/* aber verschiedenes b. */
+/* */
+/* Ausgabeparameter: */
+/* ================ */
+/* b Loesungsvektor des Systems; double b[n] */
+/* die urspruengliche rechte Seite wird ueberspeichert */
+/* */
+/* lower ) enthalten bei rep = 0 die Zerlegung der Matrix; */
+/* diag ) die urspruenglichen Werte von lower u. diag werden */
+/* upper ) ueberschrieben */
+/* */
+/* Die Determinante der Matrix ist bei rep = 0 durch */
+/* det A = diag[0] * ... * diag[n-1] bestimmt. */
+/* */
+/* Rueckgabewert: */
+/* ============= */
+/* = 0 alles ok */
+/* = 1 n < 2 gewaehlt */
+/* = 2 Die Dreieckzerlegung der Matrix existiert nicht */
+/* */
+/*====================================================================*/
+/* */
+/* Benutzte Funktionen: */
+/* =================== */
+/* */
+/* Aus der C Bibliothek: fabs() */
+/* */
+/*====================================================================*/
+
+/*.cp 5 */
+{
+ USHORT i;
+ short j;
+
+// double fabs(double);
+
+ if ( n < 2 ) return(1); /* n mindestens 2 */
+
+ /* Wenn rep = 0 ist, */
+ /* Dreieckzerlegung der */
+ if (rep == 0) /* Matrix u. det be- */
+ { /* stimmen */
+ for (i = 1; i < n; i++)
+ { if ( fabs(diag[i-1]) < MACH_EPS ) /* Wenn ein diag[i] = 0 */
+ return(2); /* ist, ex. keine Zerle- */
+ lower[i] /= diag[i-1]; /* gung. */
+ diag[i] -= lower[i] * upper[i-1];
+ }
+ }
+
+ if ( fabs(diag[n-1]) < MACH_EPS ) return(2);
+
+ for (i = 1; i < n; i++) /* Vorwaertselimination */
+ b[i] -= lower[i] * b[i-1];
+
+ b[n-1] /= diag[n-1]; /* Rueckwaertselimination */
+ for (j = n-2; j >= 0; j--) {
+ i=j;
+ b[i] = ( b[i] - upper[i] * b[i+1] ) / diag[i];
+ }
+ return(0);
+}
+
+/*----------------------- ENDE TRIDIAGONAL -------------------------*/
+
+
+
+
+
+
+
+
+
+/*.HL Anhang: C - Programme*/
+/*.HRGleichungssysteme mit zyklisch tridiagonalen Matrizen*/
+
+/*.FE P 3.8 SYSTEME MIT ZYKLISCHEN TRIDIAGONALMATRIZEN */
+
+
+/*---------------- MODUL ZYKLISCH TRIDIAGONAL ----------------------*/
+
+
+USHORT ZyklTriDiagGS(BOOL rep, USHORT n, double* lower, double* diag,
+ double* upper, double* lowrow, double* ricol, double* b)
+ /******************************/
+ /* Systeme mit zyklisch tri- */
+ /* diagonalen Matrizen */
+ /******************************/
+
+/*====================================================================*/
+/* */
+/* tzdiag bestimmt die Loesung x des linearen Gleichungssystems */
+/* A * x = b mit zyklisch tridiagonaler n x n Koeffizienten- */
+/* matrix A, die in den 5 Vektoren lower, upper, diag, lowrow und */
+/* ricol wie folgt abgespeichert ist: */
+/* */
+/* ( diag[0] upper[0] 0 0 . . 0 ricol[0] ) */
+/* ( lower[1] diag[1] upper[1] 0 . . 0 ) */
+/* ( 0 lower[2] diag[2] upper[2] 0 . ) */
+/* A = ( . 0 lower[3] . . . . ) */
+/* ( . . . . . 0 ) */
+/* ( . . . . . ) */
+/* ( 0 . . . upper[n-2] ) */
+/* ( lowrow[0] 0 . . 0 lower[n-1] diag[n-1] ) */
+/* */
+/* Speicherplatz fuer lowrow[1],..,lowrow[n-3] und ricol[1],..., */
+/* ricol[n-3] muss zusaetzlich bereitgestellt werden, da dieser */
+/* fuer die Aufnahme der Zerlegungsmatrix verfuegbar sein muss, die */
+/* auf die 5 genannten Vektoren ueberspeichert wird. */
+/* */
+/*====================================================================*/
+/* */
+/* Anwendung: */
+/* ========= */
+/* Vorwiegend fuer diagonaldominante zyklische Tridiagonalmatri- */
+/* zen wie sie bei der Spline-Interpolation auftreten. */
+/* Fuer diagonaldominante Matrizen existiert immer eine LU- */
+/* Zerlegung. */
+/* */
+/*====================================================================*/
+/* */
+/* Eingabeparameter: */
+/* ================ */
+/* n Dimension der Matrix ( > 2 ) USHORT n */
+/* lower untere Nebendiagonale double lower[n] */
+/* diag Hauptdiagonale double diag[n] */
+/* upper obere Nebendiagonale double upper[n] */
+/* b rechte Seite des Systems double b[n] */
+/* rep = 0 erstmaliger Aufruf BOOL rep */
+/* !=0 wiederholter Aufruf */
+/* fuer gleiche Matrix, */
+/* aber verschiedenes b. */
+/* */
+/* Ausgabeparameter: */
+/* ================ */
+/* b Loesungsvektor des Systems, double b[n] */
+/* die urspruengliche rechte Seite wird ueberspeichert */
+/* */
+/* lower ) enthalten bei rep = 0 die Zerlegung der Matrix; */
+/* diag ) die urspruenglichen Werte von lower u. diag werden */
+/* upper ) ueberschrieben */
+/* lowrow ) double lowrow[n-2] */
+/* ricol ) double ricol[n-2] */
+/* */
+/* Die Determinante der Matrix ist bei rep = 0 durch */
+/* det A = diag[0] * ... * diag[n-1] bestimmt. */
+/* */
+/* Rueckgabewert: */
+/* ============= */
+/* = 0 alles ok */
+/* = 1 n < 3 gewaehlt */
+/* = 2 Die Zerlegungsmatrix existiert nicht */
+/* */
+/*====================================================================*/
+/* */
+/* Benutzte Funktionen: */
+/* =================== */
+/* */
+/* Aus der C Bibliothek: fabs() */
+/* */
+/*====================================================================*/
+
+/*.cp 5 */
+{
+ double temp; // fabs(double);
+ USHORT i;
+ short j;
+
+ if ( n < 3 ) return(1);
+
+ if (rep == 0) /* Wenn rep = 0 ist, */
+ { /* Zerlegung der */
+ lower[0] = upper[n-1] = 0.0; /* Matrix berechnen. */
+
+ if ( fabs (diag[0]) < MACH_EPS ) return(2);
+ /* Ist ein Diagonalelement */
+ temp = 1.0 / diag[0]; /* betragsmaessig kleiner */
+ upper[0] *= temp; /* MACH_EPS, so ex. keine */
+ ricol[0] *= temp; /* Zerlegung. */
+
+ for (i = 1; i < n-2; i++)
+ { diag[i] -= lower[i] * upper[i-1];
+ if ( fabs(diag[i]) < MACH_EPS ) return(2);
+ temp = 1.0 / diag[i];
+ upper[i] *= temp;
+ ricol[i] = -lower[i] * ricol[i-1] * temp;
+ }
+
+ diag[n-2] -= lower[n-2] * upper[n-3];
+ if ( fabs(diag[n-2]) < MACH_EPS ) return(2);
+
+ for (i = 1; i < n-2; i++)
+ lowrow[i] = -lowrow[i-1] * upper[i-1];
+
+ lower[n-1] -= lowrow[n-3] * upper[n-3];
+ upper[n-2] = ( upper[n-2] - lower[n-2] * ricol[n-3] ) / diag[n-2];
+
+ for (temp = 0.0, i = 0; i < n-2; i++)
+ temp -= lowrow[i] * ricol[i];
+ diag[n-1] += temp - lower[n-1] * upper[n-2];
+
+ if ( fabs(diag[n-1]) < MACH_EPS ) return(2);
+ } /* end if ( rep == 0 ) */
+
+ b[0] /= diag[0]; /* Vorwaertselemination */
+ for (i = 1; i < n-1; i++)
+ b[i] = ( b[i] - b[i-1] * lower[i] ) / diag[i];
+
+ for (temp = 0.0, i = 0; i < n-2; i++)
+ temp -= lowrow[i] * b[i];
+
+ b[n-1] = ( b[n-1] + temp - lower[n-1] * b[n-2] ) / diag[n-1];
+
+ b[n-2] -= b[n-1] * upper[n-2]; /* Rueckwaertselimination */
+ for (j = n-3; j >= 0; j--) {
+ i=j;
+ b[i] -= upper[i] * b[i+1] + ricol[i] * b[n-1];
+ }
+ return(0);
+}
+
+/*------------------ ENDE ZYKLISCH TRIDIAGONAL ---------------------*/
+
+
+} // extern "C"
+
+
+/*************************************************************************
+|*
+|* NaturalSpline()
+|*
+|* Beschreibung Berechnet die Koeffizienten eines natrlichen
+|* kubischen Polynomsplines mit n Sttzstellen.
+|* Ersterstellung JOE 17-08.93
+|* Letzte Aenderung JOE 17-08.93
+|*
+*************************************************************************/
+
+USHORT NaturalSpline(USHORT n, double* x, double* y,
+ double Marg0, double MargN,
+ BYTE MargCond,
+ double* b, double* c, double* d)
+{
+ USHORT i;
+ double* a;
+ double* h;
+ USHORT error;
+
+ if (n<2) return 1;
+ if (MargCond<0 || MargCond>3) return 2;
+ a=new double[n+1];
+ h=new double[n+1];
+ for (i=0;i<n;i++) {
+ h[i]=x[i+1]-x[i];
+ if (h[i]<=0.0) { delete a; delete h; return 1; }
+ }
+ for (i=0;i<n-1;i++) {
+ a[i]=3.0*((y[i+2]-y[i+1])/h[i+1]-(y[i+1]-y[i])/h[i]);
+ b[i]=h[i];
+ c[i]=h[i+1];
+ d[i]=2.0*(h[i]+h[i+1]);
+ }
+ switch (MargCond) {
+ case 0: {
+ if (n==2) {
+ a[0]=a[0]/3.0;
+ d[0]=d[0]*0.5;
+ } else {
+ a[0] =a[0]*h[1]/(h[0]+h[1]);
+ a[n-2]=a[n-2]*h[n-2]/(h[n-1]+h[n-2]);
+ d[0] =d[0]-h[0];
+ d[n-2]=d[n-2]-h[n-1];
+ c[0] =c[0]-h[0];
+ b[n-2]=b[n-2]-h[n-1];
+ }
+ }
+ case 1: {
+ a[0] =a[0]-1.5*((y[1]-y[0])/h[0]-Marg0);
+ a[n-2]=a[n-2]-1.5*(MargN-(y[n]-y[n-1])/h[n-1]);
+ d[0] =d[0]-h[0]*0.5;
+ d[n-2]=d[n-2]-h[n-1]*0.5;
+ }
+ case 2: {
+ a[0] =a[0]-h[0]*Marg0*0.5;
+ a[n-2]=a[n-2]-h[n-1]*MargN*0.5;
+ }
+ case 3: {
+ a[0] =a[0]+Marg0*h[0]*h[0]*0.5;
+ a[n-2]=a[n-2]-MargN*h[n-1]*h[n-1]*0.5;
+ d[0] =d[0]+h[0];
+ d[n-2]=d[n-2]+h[n-1];
+ }
+ } // switch MargCond
+ if (n==2) {
+ c[1]=a[0]/d[0];
+ } else {
+ error=TriDiagGS(FALSE,n-1,b,d,c,a);
+ if (error!=0) { delete a; delete h; return error+2; }
+ for (i=0;i<n-1;i++) c[i+1]=a[i];
+ }
+ switch (MargCond) {
+ case 0: {
+ if (n==2) {
+ c[2]=c[1];
+ c[0]=c[1];
+ } else {
+ c[0]=c[1]+h[0]*(c[1]-c[2])/h[1];
+ c[n]=c[n-1]+h[n-1]*(c[n-1]-c[n-2])/h[n-2];
+ }
+ }
+ case 1: {
+ c[0]=1.5*((y[1]-y[0])/h[0]-Marg0);
+ c[0]=(c[0]-c[1]*h[0]*0.5)/h[0];
+ c[n]=1.5*((y[n]-y[n-1])/h[n-1]-MargN);
+ c[n]=(c[n]-c[n-1]*h[n-1]*0.5)/h[n-1];
+ }
+ case 2: {
+ c[0]=Marg0*0.5;
+ c[n]=MargN*0.5;
+ }
+ case 3: {
+ c[0]=c[1]-Marg0*h[0]*0.5;
+ c[n]=c[n-1]+MargN*h[n-1]*0.5;
+ }
+ } // switch MargCond
+ for (i=0;i<n;i++) {
+ b[i]=(y[i+1]-y[i])/h[i]-h[i]*(c[i+1]+2.0*c[i])/3.0;
+ d[i]=(c[i+1]-c[i])/(3.0*h[i]);
+ }
+ delete a;
+ delete h;
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* PeriodicSpline()
+|*
+|* Beschreibung Berechnet die Koeffizienten eines periodischen
+|* kubischen Polynomsplines mit n Sttzstellen.
+|* Ersterstellung JOE 17-08.93
+|* Letzte Aenderung JOE 17-08.93
+|*
+*************************************************************************/
+
+
+USHORT PeriodicSpline(USHORT n, double* x, double* y,
+ double* b, double* c, double* d)
+{ // Arrays mssen von [0..n] dimensioniert sein!
+ USHORT Error;
+ USHORT i,im1,nm1; //integer
+ double hr,hl;
+ double* a;
+ double* lowrow;
+ double* ricol;
+
+ if (n<2) return 4;
+ nm1=n-1;
+ for (i=0;i<=nm1;i++) if (x[i+1]<=x[i]) return 2; // muá streng nonoton fallend sein!
+ if (y[n]!=y[0]) return 3; // Anfang muá gleich Ende sein!
+
+ a =new double[n+1];
+ lowrow=new double[n+1];
+ ricol =new double[n+1];
+
+ if (n==2) {
+ c[1]=3.0*((y[2]-y[1])/(x[2]-x[1]));
+ c[1]=c[1]-3.0*((y[i]-y[0])/(x[1]-x[0]));
+ c[1]=c[1]/(x[2]-x[0]);
+ c[2]=-c[1];
+ } else {
+ for (i=1;i<=nm1;i++) {
+ im1=i-1;
+ hl=x[i]-x[im1];
+ hr=x[i+1]-x[i];
+ b[im1]=hl;
+ d[im1]=2.0*(hl+hr);
+ c[im1]=hr;
+ a[im1]=3.0*((y[i+1]-y[i])/hr-(y[i]-y[im1])/hl);
+ }
+ hl=x[n]-x[nm1];
+ hr=x[1]-x[0];
+ b[nm1]=hl;
+ d[nm1]=2.0*(hl+hr);
+ lowrow[0]=hr;
+ ricol[0]=hr;
+ a[nm1]=3.0*((y[1]-y[0])/hr-(y[n]-y[nm1])/hl);
+ Error=ZyklTriDiagGS(FALSE,n,b,d,c,lowrow,ricol,a);
+ if (Error!=0) { delete a,lowrow,ricol; return(Error+4); }
+ for (i=0;i<=nm1;i++) c[i+1]=a[i];
+ }
+ c[0]=c[n];
+ for (i=0;i<=nm1;i++) {
+ hl=x[i+1]-x[i];
+ b[i]=(y[i+1]-y[i])/hl;
+ b[i]=b[i]-hl*(c[i+1]+2.0*c[i])/3.0;
+ d[i]=(c[i+1]-c[i])/hl/3.0;
+ }
+ delete a,lowrow,ricol;
+ return 0;
+}
+
+
+
+/*************************************************************************
+|*
+|* ParaSpline()
+|*
+|* Beschreibung Berechnet die Koeffizienten eines parametrischen
+|* natrlichen oder periodischen kubischen
+|* Polynomsplines mit n Sttzstellen.
+|* Ersterstellung JOE 17-08.93
+|* Letzte Aenderung JOE 17-08.93
+|*
+*************************************************************************/
+
+USHORT ParaSpline(USHORT n, double* x, double* y, BYTE MargCond,
+ double Marg01, double Marg02,
+ double MargN1, double MargN2,
+ BOOL CondT, double* T,
+ double* bx, double* cx, double* dx,
+ double* by, double* cy, double* dy)
+{
+ USHORT Error,Marg;
+ USHORT i;
+ double deltX,deltY,delt,
+ alphX,alphY,
+ betX,betY;
+
+ if (n<2) return 1;
+ if (MargCond<0 || MargCond>4) return 2; // ungltige Randbedingung
+ if (CondT==FALSE) {
+ T[0]=0.0;
+ for (i=0;i<n;i++) {
+ deltX=x[i+1]-x[i]; deltY=y[i+1]-y[i];
+ delt =deltX*deltX+deltY*deltY;
+ if (delt<=0.0) return 3; // zwei identische Punkte nacheinander!
+ T[i+1]=T[i]+sqrt(delt);
+ }
+ }
+ switch (MargCond) {
+ case 0: Marg=0; break;
+ case 1: case 2: {
+ Marg=MargCond;
+ alphX=Marg01; betX=MargN1;
+ alphY=Marg02; betY=MargN2;
+ } break;
+ case 3: {
+ if (x[n]!=x[0]) return 3;
+ if (y[n]!=y[0]) return 4;
+ } break;
+ case 4: {
+ Marg=1;
+ if (abs(Marg01)>=MAXROOT) {
+ alphX=0.0;
+ alphY=sign(1.0,y[1]-y[0]);
+ } else {
+ alphX=sign(sqrt(1.0/(1.0+Marg01*Marg01)),x[1]-x[0]);
+ alphY=alphX*Marg01;
+ }
+ if (abs(MargN1)>=MAXROOT) {
+ betX=0.0;
+ betY=sign(1.0,y[n]-y[n-1]);
+ } else {
+ betX=sign(sqrt(1.0/(1.0+MargN1*MargN1)),x[n]-x[n-1]);
+ betY=betX*MargN1;
+ }
+ }
+ } // switch MargCond
+ if (MargCond==3) {
+ Error=PeriodicSpline(n,T,x,bx,cx,dx);
+ if (Error!=0) return(Error+4);
+ Error=PeriodicSpline(n,T,y,by,cy,dy);
+ if (Error!=0) return(Error+10);
+ } else {
+ Error=NaturalSpline(n,T,x,alphX,betX,MargCond,bx,cx,dx);
+ if (Error!=0) return(Error+4);
+ Error=NaturalSpline(n,T,y,alphY,betY,MargCond,by,cy,dy);
+ if (Error!=0) return(Error+9);
+ }
+ return 0;
+}
+
+
+
+/*************************************************************************
+|*
+|* CalcSpline()
+|*
+|* Beschreibung Berechnet die Koeffizienten eines parametrischen
+|* natrlichen oder periodischen kubischen
+|* Polynomsplines. Die Eckpunkte des šbergebenen
+|* Polygons werden als Sttzstellen angenommen.
+|* n liefert die Anzahl der Teilpolynome.
+|* Ist die Berechnung fehlerfrei verlaufen, so
+|* liefert die Funktion TRUE. Nur in diesem Fall
+|* ist Speicher fr 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)
+{
+ BYTE Marg;
+ double Marg01,Marg02;
+ double MargN1,MargN2;
+ USHORT i;
+ Point P0(-32768,-32768);
+ Point Pt;
+
+ n=rPoly.GetSize();
+ ax=new double[rPoly.GetSize()+2];
+ ay=new double[rPoly.GetSize()+2];
+
+ n=0;
+ for (i=0;i<rPoly.GetSize();i++) {
+ Pt=rPoly.GetPoint(i);
+ if (i==0 || Pt!=P0) {
+ ax[n]=Pt.X();
+ ay[n]=Pt.Y();
+ n++;
+ P0=Pt;
+ }
+ }
+
+ if (Periodic) {
+ Marg=3;
+ ax[n]=ax[0];
+ ay[n]=ay[0];
+ n++;
+ } else {
+ Marg=2;
+ }
+
+ bx=new double[n+1];
+ by=new double[n+1];
+ cx=new double[n+1];
+ cy=new double[n+1];
+ dx=new double[n+1];
+ dy=new double[n+1];
+ T =new double[n+1];
+
+ Marg01=0.0; Marg02=0.0;
+ MargN1=0.0; MargN2=0.0;
+ if (n>0) n--; // n Korregieren (Anzahl der Teilpolynome)
+
+ if ((Marg==3 && n>=3) || (Marg==2 && n>=2)) {
+ i=ParaSpline(n,ax,ay,Marg,Marg01,Marg01,MargN1,MargN2,FALSE,T,bx,cx,dx,by,cy,dy);
+ if (i==0) {
+ return TRUE;
+ } else {
+ delete ax,ay,bx,by,cx,cy,dx,dy,T;
+ n=0;
+ return FALSE;
+ }
+ } else {
+ delete ax,ay,bx,by,cx,cy,dx,dy,T;
+ n=0;
+ return FALSE;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Spline2Poly()
+|*
+|* Beschreibung Konvertiert einen parametrichen kubischen
+|* Polynomspline Spline (natrlich 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 Koordinatenberl„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)
+{
+ short MinKoord=-32000; // zur Vermeidung
+ short MaxKoord=32000; // von šberl„ufen
+
+ double* ax; // ¿
+ double* ay; // ³ Koeffizienten
+ double* bx; // ³ der Polynome
+ double* by; // ³
+ double* cx; // ³
+ double* cy; // ³
+ double* dx; // ³
+ double* dy; // ³
+ double* tv; // Ù
+
+ double Step; // Schrittweite fr t
+ double dt1,dt2,dt3; // Delta t, ý, ^3
+ double t;
+ BOOL bEnde; // Teilpolynom zu Ende?
+ USHORT n; // Anzahl der zu zeichnenden Teilpolynome
+ USHORT i; // aktuelles Teilpolynom
+ BOOL bOk; // noch alles ok?
+ USHORT PolyMax=16380;// Maximale Anzahl von Polygonpunkten
+ long x,y;
+
+ bOk=CalcSpline(rSpln,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv);
+ if (bOk) {
+ Step =10;
+
+ rPoly.SetSize(1);
+ rPoly.SetPoint(Point(short(ax[0]),short(ay[0])),0); // erster Punkt
+ i=0;
+ while (i<n) { // n Teilpolynome malen
+ t=tv[i]+Step;
+ bEnde=FALSE;
+ while (!bEnde) { // ein Teilpolynom interpolieren
+ bEnde=t>=tv[i+1];
+ if (bEnde) t=tv[i+1];
+ dt1=t-tv[i]; dt2=dt1*dt1; dt3=dt2*dt1;
+ x=long(ax[i]+bx[i]*dt1+cx[i]*dt2+dx[i]*dt3);
+ y=long(ay[i]+by[i]*dt1+cy[i]*dt2+dy[i]*dt3);
+ if (x<MinKoord) x=MinKoord; if (x>MaxKoord) x=MaxKoord;
+ if (y<MinKoord) y=MinKoord; if (y>MaxKoord) y=MaxKoord;
+ if (rPoly.GetSize()<PolyMax) {
+ rPoly.SetSize(rPoly.GetSize()+1);
+ rPoly.SetPoint(Point(short(x),short(y)),rPoly.GetSize()-1);
+ } else {
+ bOk=FALSE; // Fehler: Polygon wird zu groá
+ }
+ t=t+Step;
+ } // Ende von Teilpolynom
+ i++; // n„chstes Teilpolynom
+ }
+ delete ax,ay,bx,by,cx,cy,dx,dy,tv;
+ return bOk;
+ } // Ende von if (bOk)
+ rPoly.SetSize(0);
+ return FALSE;
+}
+
+
+
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* CalcLine()
+|*
+|* Beschreibung Routine fr DrawSpline (s.u.).
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+/*void CalcLine(short x1, short y1,
+ short x2, short y2,
+ short hb, Polygon& rPoly)
+{
+ short dx,dy,dxp,dyp;
+ double l;
+
+ rPoly.SetSize(4);
+ dx=x2-x1;
+ dy=y2-y1;
+ l=sqrt(dx*dx+dy*dy);
+ if (l>0) {
+ dxp=short((long(dy)*long(hb))/l);
+ dyp=short((long(dx)*long(hb))/l);
+ rPoly.SetPoint(Point(x1-dxp,y1+dyp),0);
+ rPoly.SetPoint(Point(x1+dxp,y1-dyp),1);
+ rPoly.SetPoint(Point(x2+dxp,y2-dyp),2);
+ rPoly.SetPoint(Point(x2-dxp,y2+dyp),3);
+ } else {
+ rPoly.SetPoint(Point(x1,y1+hb),0);
+ rPoly.SetPoint(Point(x1,y1-hb),1);
+ rPoly.SetPoint(Point(x2,y2-hb),2);
+ rPoly.SetPoint(Point(x2,y2+hb),3);
+ }
+} */
+
+
+/*************************************************************************
+|*
+|* DrawSpline()
+|*
+|* Beschreibung Alte Routine. Dicke Linien werden mit Polys gemalt.
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+/*
+BOOL DrawSpline(OutputDevice& rOut, Polygon& rPoly, BOOL Periodic)
+{
+ short MinKoord=-12000; // StarDraw-Definitionen
+ short MaxKoord=32000; // zur Vermeidung von šberl„ufen
+
+ double* ax; // ¿
+ double* ay; // ³ Koeffizienten
+ double* bx; // ³ der Polynome
+ double* by; // ³
+ double* cx; // ³
+ double* cy; // ³
+ double* dx; // ³
+ double* dy; // ³
+ double* tv; // Ù
+
+ double Step; // Schrittweite fr t
+ double dt1,dt2,dt3; // Delta t, ý, ^3
+ double t;
+ BOOL bEnde; // Teilpolynom zu Ende?
+ USHORT FHB; // Halbe Linienbreite in SGV
+ Point P10,P20; // letzter Punkt (Screen) fr Anschluá
+ Point P100,P200; // erster Punkt (Screen) zum Schlieáen des pSpline
+ BOOL bFirst; // erster Schrit des ersten Teilpolynoms?
+ BOOL bThin; // Strichst„rke 1 Pixel?
+ Polygon aFP(0); // fr gefllten Spline
+ Polygon aLP(4); // fr dicke Umrandung
+ BOOL bFill; // gefllter Spline?
+ BOOL bOutl; // umrandeter Spline?
+ USHORT n; // Anzahl der zu zeichnenden Teilpolynome
+ USHORT i; // aktuelles Teilpolynom
+ BOOL bOk; // noch alles ok?
+ USHORT StatA,StatB;
+ USHORT PolyMax=16384;// Maximale Anzahl von Polygonpunkten
+ Pen aPenMerk;
+ Brush aBrushMerk;
+ short x0,y0;
+ long x,y;
+
+ bOk=CalcSpline(rPoly,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv);
+ if (bOk) {
+ aPenMerk=rOut.GetPen();
+ aBrushMerk=rOut.GetFillInBrush();
+ bFill=rOut.GetFillInBrush().GetStyle()!=BRUSH_NULL && Periodic;
+ bOutl=rOut.GetPen().GetStyle()!=PEN_NULL;
+ FHB =rOut.GetPen().GetWidth() /2;
+ bThin=rOut.GetPen().GetWidth()<=1;
+ Step =10;
+
+ StatA=1; if (!bFill) StatA++;
+ StatB=2; if (!bOutl) StatB--;
+
+ while (StatA<=StatB) {
+ if (StatA==1) {
+ rOut.SetFillInBrush(aBrushMerk);
+ rOut.SetPen(Pen(PEN_NULL));
+ } else {
+ if (!bThin) {
+ rOut.SetFillInBrush(Brush(rOut.GetPen().GetColor()));
+ rOut.SetPen(Pen(PEN_NULL));
+ } else {
+ rOut.SetPen(aPenMerk);
+ }
+ }
+ bFirst=TRUE;
+
+ x0=short(ax[0]); y0=short(ay[0]); // erster Punkt
+ i=0;
+ while (i<n) { // n Teilpolynome malen
+ t=tv[i]+Step;
+ bEnde=FALSE;
+ while (!bEnde) { // ein Teilpolynom interpolieren
+ bEnde=t>=tv[i+1];
+ if (bEnde) t=tv[i+1];
+ dt1=t-tv[i]; dt2=dt1*dt1; dt3=dt2*dt1;
+ x=long(ax[i]+bx[i]*dt1+cx[i]*dt2+dx[i]*dt3);
+ y=long(ay[i]+by[i]*dt1+cy[i]*dt2+dy[i]*dt3);
+ if (x-FHB<MinKoord) x=MinKoord+FHB; if (x+FHB>MaxKoord) x=MaxKoord-FHB;
+ if (y-FHB<MinKoord) y=MinKoord+FHB; if (y+FHB>MaxKoord) y=MaxKoord-FHB;
+ if (StatA==1) { // Fl„che
+ if (aFP.GetSize()<PolyMax) {
+ aFP.SetSize(aFP.GetSize()+1);
+ aFP.SetPoint(Point(short(x),short(y)),aFP.GetSize()-1);
+ } else {
+ bOk=FALSE; // Fehler: Polygon wird zu groá
+ }
+ } else { // Umrandung
+ if (bThin) {
+ rOut.DrawLine(Point(x0,y0),Point(short(x),short(y)));
+ } else {
+ CalcLine(x0,y0,short(x),short(y),FHB,aLP);
+ rOut.DrawPolygon(aLP);
+ if (bFirst) {
+ P100=aLP.GetPoint(0); // fr pSpline merken
+ P200=aLP.GetPoint(1);
+ } else {
+ Polygon aMP(4);
+ aMP.SetPoint(P10,0);
+ aMP.SetPoint(P20,1);
+ aMP.SetPoint(aLP.GetPoint(1),2);
+ aMP.SetPoint(aLP.GetPoint(0),3);
+ rOut.DrawPolygon(aMP);
+ }
+ P10=aLP.GetPoint(3); // zum Fllen der M„useecken merken
+ P20=aLP.GetPoint(2);
+ } // Ende von Umrandung
+ } // Ende von if (StatA==1)
+ x0=short(x); y0=short(y); // die letzten Koordinaten merken
+ bFirst=FALSE;
+ t=t+Step;
+ } // Ende von Teilpolynom
+ i++; // n„chstes Teilpolynom
+ }
+ if (StatA==1) {
+ rOut.DrawPolygon(aFP);
+ } else {
+ if (!bThin && Periodic) { // nun die letzte M„useecke fllen
+ Polygon aMP(4);
+ aMP.SetPoint(aLP[3],1);
+ aMP.SetPoint(aLP[4],2);
+ aMP.SetPoint(P100,3);
+ aMP.SetPoint(P200,4);
+ rOut.DrawPolygon(aMP);
+ }
+ }
+ StatA++;
+ } // Ende von while (StatA<=StatB)
+ rOut.SetPen(aPenMerk);
+ rOut.SetFillInBrush(aBrushMerk);
+ delete ax,ay,bx,by,cx,cy,dx,dy,tv;
+ return TRUE;
+ } // Ende von if (bOk)
+ return FALSE;
+} */
+
+
+
+
diff --git a/svtools/source/filter.vcl/filter/sgvtext.cxx b/svtools/source/filter.vcl/filter/sgvtext.cxx
new file mode 100644
index 000000000000..67302778a8bc
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/sgvtext.cxx
@@ -0,0 +1,1370 @@
+/*************************************************************************
+ *
+ * $RCSfile: sgvtext.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef MAC
+#include <mac_start.h>
+#include <math.h>
+#include <mac_end.h>
+#else
+#include <math.h>
+#endif
+
+#include <vcl/config.hxx>
+#include <filter.hxx>
+#include "sgffilt.hxx"
+#include "sgfbram.hxx"
+#include "sgvmain.hxx"
+// #include "Debug.c"
+
+extern SgfFontLst* pSgfFonts;
+
+#if defined( WIN ) && defined( MSC )
+#pragma code_seg( "SVTOOLS_FILTER1", "SVTOOLS_CODE" )
+#endif
+
+#ifndef abs
+#define abs(x) ((x)<0 ? -(x) : (x))
+#endif
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Einschränkungen: Schatten nur grau, 2D und mit fixem Abstand.
+//
+//
+//
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+// AbsBase.Pas
+
+// die folgenden Werte sind in % vom maximalen Schriftgrad der Zeile */
+#define UndlSpace 5 /* Untersteichungsabstand von der Baseline */
+#define UndlWidth 6 /* Untersteichungsdicke */
+#define UndlSpac2 7 /* Zwischenraum bei doppelter Unterstreichung */
+#define StrkSpace 25 /* Abstand der Durchstreichlinie von der Baseline*/
+#define StrkWidth 5 /* Durchstreichungsliniendicke */
+#define StrkSpac2 7 /* Zwischenraum bei doppelter Durchstreichung */
+#define OutlWidth 2 /* Strichstärke ist 2% vom Schriftgrad */
+
+// vvv Sonderzeichen im TextBuffer vvv
+#define TextEnd 0 /* ^@ Ende der Zeichenkette */
+#define HardSpace 6 /* ^F Hartspace (wird nicht umbrochen) ,' ' */
+#define GrafText 7 /* ^G Im Text eingebundene Grafik (future) */
+#define Tabulator 9 /* ^I Tabulatorzeichen, Pfeil */
+#define LineFeed 10 /* ^J Neue Zeile */
+#define SoftTrennK 11 /* ^K Zeichen für k-c-Austausch bei Trennung, 'k' */
+#define AbsatzEnd 13 /* ^M Neuer Absatz =CR */
+#define HardTrenn 16 /* ^P Hartes Trennzeichen (wird nicht umbrochen), '-' */
+#define SoftTrennAdd 19 /* ^S Zusatz-Zeichen Trennung von z.b."Schiff-fahrt" */
+#define Paragraf 21 /* ^U Zeichen welches für Paragraf-Zeichen */
+#define Escape 27 /* ^[ Escapesequenz einleiten */
+#define SoftTrenn 31 /* ^_ Weiches Trennzeichen, '-' nur Zeilenende */
+#define MaxEscValLen 8
+#define MaxEscLen (MaxEscValLen+3)
+
+//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
+// Escapesequenzen: [Esc]<Ident><Value>[Esc] also mind. 4 Char
+// Max. Länge von Value soll sein: 8 Char (7+Vorzeichen). Demnach max. Länge
+// einer Escapesequenz: 11 Char.
+// Identifer:
+
+#define EscFont 'F' /* FontID, z.B. 92500 für CG Times */
+#define EscGrad 'G' /* Schriftgrad 1..255 für «Pt-127«Pt */
+#define EscBreit 'B' /* Breite 1..255% des Schriftgrades */
+#define EscKaptS 'K' /* Kapitälchengröße 1..255% des Schriftgrades */
+#define EscLFeed 'L' /* Zeilenabstand 1..32767% vom max. Schriftgrad der Zeile */
+ // oder 1..32767 für 1..16383«Pt absolut (Wenn Bit 15=1)
+#define EscSlant 'S' /* Kursiv(Winkel) 1..8999 für 0.01ø..89.99ø */
+#define EscVPos 'V' /* Zeichen Vertikal-Position 1..255 für «Pt..127«Pt */
+#define EscZAbst 'Z' /* Zeichenabstand -128..127% */
+#define EscHJust 'A' /* H-Justify Absatz: Links, Zentr, Rechts, Block, Austreibend, Gesperrt (0..5)*/
+
+#define EscFarbe 'C' /* Farbe 0..7 */
+#define EscBFarb 'U' /* BackFarbe 0..7 */
+#define EscInts 'I' /* Farbintensität 0..100% */
+#define EscMustr 'M' /* Muster 0..? inkl. Transp... */
+#define EscMFarb 'O' /* Musterfarbe 0..7 */
+#define EscMBFrb 'P' /* 2. Musterfarbe 0..7 */
+#define EscMInts 'W' /* Musterintensität 0..7 */
+
+#define EscSMstr 'E' /* Schattenmuster 0..? inkl. Transp... */
+#define EscSFarb 'R' /* Schattenfarbe 0..7 */
+#define EscSBFrb 'T' /* 2. Schattenfarbe 0..7 */
+#define EscSInts 'Q' /* Schattenintensität 0..7 */
+
+#define EscSXDst 'X' /* Schattenversatz X 0..100% */
+#define EscSYDst 'Y' /* Schattenversatz Y 0..100% */
+#define EscSDist 'D' /* Schattenversatz X-Y 0..100% */
+
+#define EscBold 'f' /* Fett // */
+#define EscLSlnt 'l' /* LKursiv // */
+#define EscRSlnt 'r' /* RKursiv // */
+#define EscUndln 'u' /* Unterstrichen // */
+#define EscDbUnd 'p' /* doppelt Unterstrichen // */
+#define EscKaptF 'k' /* Kapitälchenflag // */
+#define EscStrik 'd' /* Durchgestrichen // */
+#define EscDbStk 'e' /* doppelt Durchgestrichen // */
+#define EscSupSc 'h' /* Hochgestellt // */
+#define EscSubSc 't' /* Tiefgestellt // */
+#define Esc2DShd 's' /* 2D-Schatten // */
+#define Esc3DShd 'j' /* 3D-Schatten // */
+#define Esc4DShd 'i' /* 4D-Schatten // */
+#define EscEbShd 'b' /* Embossed // */
+
+// AllEscIdent =[EscFont, EscGrad, EscBreit,EscKaptS,EscLFeed,EscSlant,EscVPos, EscZAbst,EscHJust,
+// EscFarbe,EscBFarb,EscInts, EscMustr,EscMFarb,EscMBFrb,EscMInts,
+// EscSMstr,EscSFarb,EscSBFrb,EscSInts,EscSXDst,EscSYDst,EscSDist,
+// EscBold, EscLSlnt,EscRSlnt,EscUndln,EscDbUnd,EscKaptF,EscStrik,EscDbStk,
+// EscSupSc,EscSubSc,Esc2DShd,Esc3DShd,Esc4DShd];
+// Justify muß spätestens am Anfang des Absatzes stehen
+#define EscSet '' /* Flag setzen */
+#define EscReset '' /* Flag löschen */
+#define EscDeflt '' /* Flag auf default setzen */
+#define EscToggl '' /* Flag Toggeln */
+#define EscRelat '%'
+#define EscNoFlg 0
+#define EscNoVal -2147483647 /* -MaxLongInt */
+//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
+#define NoTrenn 0xFFFF /* Wert für Parameter 'Rest' von GetTextChar(), wenn auf keinen Fall getrennt werden soll */
+#define DoTrenn 0xFFFE /* Wert für Parameter 'Rest' von GetTextChar(), wenn getrennt werden soll */
+
+#define MaxLineChars 1024
+
+#define ChrXPosArrSize (MaxLineChars+1+1) /* 2k - Beginnt mit 0 im gegensatz zu StarDraw */
+#define CharLineSize (MaxLineChars+1+1)
+#define EscStr (UCHAR[MaxEscLen+1]);
+
+#define MinChar 32
+#define MaxChar 255
+
+
+//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
+
+#define DefaultCharWidth 4800
+#define GradDiv 2
+#define CharTopToBase 100 /* wegen Apostrophe und Umlaute mehr als 75% */
+#define CharTopToBtm 120 /* Zeilenhöhe ist größer als Schriftgrad */
+ // bei Avanti-Bold '' eigentlich sogar 130%
+
+// end of AbsBase.Pas
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+// DefBase.Pas
+
+#define TextBoldBit 0x0001 /* Fett */
+#define TextRSlnBit 0x0002 /* Kursiv */
+#define TextUndlBit 0x0004 /* Unterstrichen */
+#define TextStrkBit 0x0008 /* Durchgesteichen */
+#define TextSupSBit 0x0010 /* Hocgestellt */
+#define TextSubSBit 0x0020 /* Tiefgestellt */
+#define TextKaptBit 0x0040 /* Kapitälchen */
+#define TextLSlnBit 0x0080 /* Linkskursiv */
+#define TextDbUnBit 0x0100 /* Doppelt unterstrichen */
+#define TextDbStBit 0x0200 /* Doppelt durchgestrichen */
+#define TextSh2DBit 0x0400 /* 2D-Schatten 2.0 */
+#define TextSh3DBit 0x0800 /* 3D-Schatten 2.0 */
+#define TextSh4DBit 0x1000 /* 4D-Schatten 2.0 */
+#define TextShEbBit 0x2000 /* Embossed-Schatten 2.0 */
+#define FontAtrBits (TextBoldBit | TextRSlnBit)
+
+#define THJustLeft 0x00
+#define THJustCenter 0x01
+#define THJustRight 0x02
+#define THJustBlock 0x03
+#define THJustDrvOut 0x04 /* Austreibend Formatiert */
+#define THJustLocked 0x05 /* A l s S p e r r s c h r i f t */
+#define TVJustTop 0x00 /* Future */
+#define TVJustCenter 0x10 /* Future */
+#define TVJustBottom 0x20 /* Future */
+#define TVJustBlock 0x30 /* Future */
+
+#define MaxCharSlant 4200 /* Maximal 42ø kursiv ! */
+
+// end of DefBase.Pas
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+
+
+BOOL CheckTextOutl(ObjAreaType& F, ObjLineType& L);
+
+BOOL CheckTextOutl(ObjAreaType& F, ObjLineType& L)
+{
+ return (F.FIntens!=L.LIntens) ||
+ ((F.FFarbe!=L.LFarbe) && (F.FIntens>0)) ||
+ ((F.FBFarbe!=L.LBFarbe) && (F.FIntens<100));
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+// Misc.Pas
+
+short hPoint2Sgf(short a)
+{
+ long b;
+ b=long(a)*127*SgfDpmm/(144*5);
+ return short(b);
+}
+
+short Sgf2hPoint(short a)
+{
+ long b;
+ b=long(a)*5*144/(127*SgfDpmm);
+ return short(b);
+}
+
+// End of Misc.Pas
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+// AbsRead.Pas
+
+// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
+// ³ Function GetTopToBaseLine() Function GetBaseLineToBtm() ³
+// ³ ³
+// ³ Abstand von Zeilenoberkante bis BaseLine bzw. von BaseLine bis ³
+// ³ Unterkante berechnen. Alles in SGF-Units. ³
+// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
+
+USHORT GetTopToBaseLine(USHORT MaxGrad)
+{
+ long ret;
+ ret=long(MaxGrad)*long(CharTopToBase) /long(100);
+ return USHORT(ret);
+}
+
+// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
+// ³ Function GetTextChar() Function GetTextCharConv() ³
+// ³ ³
+// ³ Liest ein Zeichen aus dem Textbuffer, wertet dabei eventuell ³
+// ³ auftretende Escapesequenzen aus und setzt dementsprechend den ³
+// ³ Ein-/Ausgabeparameter AktAtr. Index wird entsprechend erhöht. ³
+// ³ Der Parameter Rest muß immer die Anzahl der Zeichen beinhalten, ³
+// ³ den angeforderten Zeichen in der aktuellen Zeile noch folgen. ³
+// ³ Ansonsten funktioniert die Silbentrennung nicht richtig. Gibt man ³
+// ³ stattdessen die Konstante NoTrenn an, wird in keinem Fall ³
+// ³ getrennt, die Konstante DoTrenn bewirkt dagegen, daß überall dort ³
+// ³ getrennt wird, wo ein SoftTrenner vorkommt. ³
+// ³ ³
+// ³ SoftTrenner werden immer in ein Minuszeichen konvertiert. ³
+// ³ GetTextCharConv() konvertiert zusätzlich HardSpace und AbsatzEnde ³
+// ³ in Spaces sowie HardTrenner in Minuszeichen. TextEnde wird immer ³
+// ³ als Char(0) geliefert. ³
+// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
+
+
+
+UCHAR ConvertTextChar(UCHAR c)
+{
+ if (c<32) {
+ switch (c) {
+ case HardSpace : c=' '; break;
+ case AbsatzEnd : c=' '; break;
+ case SoftTrenn : c='-'; break;
+ case HardTrenn : c='-'; break;
+ case SoftTrennK : c='-'; break;
+ case SoftTrennAdd: c='-';
+ }
+ }
+ return c;
+}
+
+
+
+USHORT GetSchnittBit(UCHAR c)
+{
+ USHORT r=0;
+ switch (c) {
+ case EscBold : r=TextBoldBit; break;
+ case EscRSlnt: r=TextRSlnBit; break;
+ case EscUndln: r=TextUndlBit; break;
+ case EscStrik: r=TextStrkBit; break;
+ case EscDbUnd: r=TextDbUnBit; break;
+ case EscDbStk: r=TextDbStBit; break;
+ case EscSupSc: r=TextSupSBit; break;
+ case EscSubSc: r=TextSubSBit; break;
+ case EscKaptF: r=TextKaptBit; break;
+ case EscLSlnt: r=TextLSlnBit; break;
+ case Esc2DShd: r=TextSh2DBit; break;
+ case Esc3DShd: r=TextSh3DBit; break;
+ case Esc4DShd: r=TextSh4DBit; break;
+ case EscEbShd: r=TextShEbBit;
+ }
+ return r;
+}
+
+
+
+long ChgValue(long Def, long Min, long Max, UCHAR FlgVal, long NumVal)
+{
+ long r=0;
+
+ if (FlgVal==EscDeflt) {
+ r=Def; // zurück auf Default
+ } else {
+ if (NumVal!=EscNoVal) r=NumVal; // Hart setzen
+ }
+
+ if (Min!=0 || Max!=0) {
+ if (r>Max) r=Max;
+ if (r<Min) r=Min;
+ }
+ return r;
+}
+
+
+
+void ChgSchnittBit(USHORT Bit, USHORT Radio1, USHORT Radio2, USHORT Radio3,
+ UCHAR FlgVal, USHORT Schnitt0, USHORT& Schnitt)
+{
+ USHORT All,Rad;
+
+ Rad=Radio1 | Radio2 | Radio3;
+ All=Bit | Rad;
+
+ switch (FlgVal) {
+ case EscSet : Schnitt=(Schnitt & ~All) | Bit; break;
+ case EscReset: Schnitt=(Schnitt & ~All); break;
+ case EscDeflt: Schnitt=(Schnitt & ~All) | (Schnitt0 & All); break;
+ case EscToggl: Schnitt=(Schnitt & ~Rad) ^ Bit;
+ }
+}
+
+
+
+UCHAR GetNextChar(UCHAR* TBuf, USHORT Index)
+{
+ USHORT Cnt;
+ while (TBuf[Index]==Escape) {
+ Index++;
+ Cnt=0;
+ while (TBuf[Index]!=Escape && Cnt<=MaxEscLen) {
+ Index++; Cnt++; }
+ Index++;
+ }
+ return TBuf[Index];
+}
+
+
+
+UCHAR ProcessOne(UCHAR* TBuf, USHORT& Index,
+ ObjTextType& Atr0, ObjTextType& AktAtr,
+ BOOL ScanEsc)
+{
+ UCHAR c;
+ UCHAR Ident;
+ BOOL Ende;
+ BOOL q;
+ UCHAR FlgVal;
+ long NumVal;
+ long Sgn;
+ short i;
+ BOOL EoVal;
+
+ do {
+ c=TBuf[Index]; Index++;
+ Ende=(c!=Escape);
+ if (Ende==FALSE) {
+ c=TBuf[Index]; Index++;
+ Ident=c; // Identifer merken
+ FlgVal=EscNoFlg;
+ NumVal=EscNoVal;
+ c=TBuf[Index]; Index++; // Hier fängt der Wert an
+ if (c==EscSet || c==EscReset || c==EscDeflt || c==EscToggl) FlgVal=c; else {
+ if (c=='-') Sgn=-1; else Sgn=1;
+ if (c=='+' || c=='-') { c=TBuf[Index]; Index++; }
+ i=MaxEscValLen;
+ NumVal=0;
+ do {
+ NumVal=10*NumVal+c-'0';
+ EoVal=(TBuf[Index]<'0' || TBuf[Index]>'9');
+ if (EoVal==FALSE) { c=TBuf[Index]; Index++; }
+ i--;
+ } while (i>0 && EoVal==FALSE);
+ NumVal=Sgn*NumVal;
+ }
+ q=!CheckTextOutl(AktAtr.F,AktAtr.L);
+
+ switch (Ident) {
+ case EscFont : AktAtr.SetFont(ULONG (ChgValue(Atr0.GetFont(),0,0 ,FlgVal,NumVal)));break;
+ case EscGrad : AktAtr.Grad =USHORT(ChgValue(Atr0.Grad, 2,2000 ,FlgVal,NumVal)); break;
+ case EscBreit: AktAtr.Breite =USHORT(ChgValue(Atr0.Breite, 1,1000 ,FlgVal,NumVal)); break;
+ case EscKaptS: AktAtr.Kapit =(BYTE)(ChgValue(Atr0.Kapit, 1,255 ,FlgVal,NumVal)); break;
+ case EscLFeed: AktAtr.LnFeed =USHORT(ChgValue(Atr0.LnFeed, 1,65535 ,FlgVal,NumVal)); break;
+ case EscSlant: AktAtr.Slant =USHORT(ChgValue(Atr0.Slant, 1,MaxCharSlant ,FlgVal,NumVal)); break;
+ case EscVPos : AktAtr.ChrVPos=char (ChgValue(Atr0.ChrVPos,-128,127 ,FlgVal,NumVal)); break;
+ case EscZAbst: AktAtr.ZAbst =(BYTE)(ChgValue(Atr0.ZAbst, 1,255 ,FlgVal,NumVal)); break;
+ case EscHJust: AktAtr.Justify=(BYTE)(ChgValue(Atr0.Justify & 0x0F,0,5 ,FlgVal,NumVal)); break;
+ case EscFarbe: { AktAtr.L.LFarbe =(BYTE)(ChgValue(Atr0.L.LFarbe,0,7 ,FlgVal,NumVal)); if (q) AktAtr.F.FFarbe =AktAtr.L.LFarbe; } break;
+ case EscBFarb: { AktAtr.L.LBFarbe=(BYTE)(ChgValue(Atr0.L.LBFarbe,0,255,FlgVal,NumVal)); if (q) AktAtr.F.FBFarbe=AktAtr.L.LBFarbe; } break;
+ case EscInts : { AktAtr.L.LIntens=(BYTE)(ChgValue(Atr0.L.LIntens,0,100,FlgVal,NumVal)); if (q) AktAtr.F.FIntens=AktAtr.L.LIntens; } break;
+
+ case EscMustr: { AktAtr.F.FMuster=USHORT(ChgValue(Atr0.F.FMuster,0,65535,FlgVal,NumVal)); } break;
+ case EscMFarb: { AktAtr.F.FFarbe =(BYTE)(ChgValue(Atr0.F.FFarbe,0,7 ,FlgVal,NumVal)); } break;
+ case EscMBFrb: { AktAtr.F.FBFarbe=(BYTE)(ChgValue(Atr0.F.FBFarbe,0,255,FlgVal,NumVal)); } break;
+ case EscMInts: { AktAtr.F.FIntens=(BYTE)(ChgValue(Atr0.F.FIntens,0,100,FlgVal,NumVal)); } break;
+
+ case EscSMstr: { AktAtr.ShdF.FMuster=USHORT(ChgValue(Atr0.ShdF.FMuster,0,65535,FlgVal,NumVal)); } break;
+ case EscSFarb: { AktAtr.ShdL.LFarbe =(BYTE)(ChgValue(Atr0.ShdL.LFarbe,0,7 ,FlgVal,NumVal)); AktAtr.ShdF.FFarbe =AktAtr.ShdL.LFarbe; } break;
+ case EscSBFrb: { AktAtr.ShdL.LBFarbe=(BYTE)(ChgValue(Atr0.ShdL.LBFarbe,0,255,FlgVal,NumVal)); AktAtr.ShdF.FBFarbe=AktAtr.ShdL.LBFarbe; } break;
+ case EscSInts: { AktAtr.ShdL.LIntens=(BYTE)(ChgValue(Atr0.ShdL.LIntens,0,100,FlgVal,NumVal)); AktAtr.ShdF.FIntens=AktAtr.ShdL.LIntens; } break;
+ case EscSDist: { AktAtr.ShdVers.x=(short)ChgValue(Atr0.ShdVers.x,0,30000,FlgVal,NumVal); AktAtr.ShdVers.y=AktAtr.ShdVers.x; } break;
+ case EscSXDst: { AktAtr.ShdVers.x=(short)ChgValue(Atr0.ShdVers.x,0,30000,FlgVal,NumVal); } break;
+ case EscSYDst: { AktAtr.ShdVers.y=(short)ChgValue(Atr0.ShdVers.y,0,30000,FlgVal,NumVal); } break;
+
+ case EscBold : ChgSchnittBit(TextBoldBit,0,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscRSlnt: ChgSchnittBit(TextRSlnBit,TextLSlnBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscUndln: ChgSchnittBit(TextUndlBit,TextDbUnBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscStrik: ChgSchnittBit(TextStrkBit,TextDbStBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscDbUnd: ChgSchnittBit(TextDbUnBit,TextUndlBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscDbStk: ChgSchnittBit(TextDbStBit,TextStrkBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscSupSc: ChgSchnittBit(TextSupSBit,TextSubSBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscSubSc: ChgSchnittBit(TextSubSBit,TextSupSBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscKaptF: ChgSchnittBit(TextKaptBit,0,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscLSlnt: ChgSchnittBit(TextLSlnBit,TextRSlnBit,0,0 ,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case Esc2DShd: ChgSchnittBit(TextSh2DBit,TextSh3DBit,TextSh4DBit,TextShEbBit,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case Esc3DShd: ChgSchnittBit(TextSh3DBit,TextSh2DBit,TextSh4DBit,TextShEbBit,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case Esc4DShd: ChgSchnittBit(TextSh4DBit,TextSh2DBit,TextSh3DBit,TextShEbBit,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ case EscEbShd: ChgSchnittBit(TextShEbBit,TextSh2DBit,TextSh3DBit,TextSh4DBit,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break;
+ } //endcase
+ if (TBuf[Index]==Escape) Index++; // zweites Esc weglesen }
+ } // if Ende==FALSE
+ } while (Ende==FALSE && ScanEsc==FALSE);
+ if (Ende==FALSE) c=Escape;
+ return c;
+} // end of ProcessOne
+
+
+UCHAR GetTextChar(UCHAR* TBuf, USHORT& Index,
+ ObjTextType& Atr0, ObjTextType& AktAtr,
+ USHORT Rest, BOOL ScanEsc)
+{
+ UCHAR c,c0,nc;
+
+ c=ProcessOne(TBuf,Index,Atr0,AktAtr,ScanEsc);
+ if (ScanEsc==FALSE) {
+ if (c==SoftTrennAdd || c==SoftTrennK || c==SoftTrenn) {
+ nc=GetNextChar(TBuf,Index);
+ c0=c;
+ if (Rest==0 || Rest==DoTrenn ||
+ nc==' ' || nc==AbsatzEnd || nc==TextEnd) c='-';
+ else {
+ c=ProcessOne(TBuf,Index,Atr0,AktAtr,ScanEsc); // den Trenner überspringen
+ if (c0==SoftTrennAdd) {
+ if (c>=32) c=ProcessOne(TBuf,Index,Atr0,AktAtr,ScanEsc); // und hier noch 'nen Buchstaben überspringen
+ }
+ }
+ }
+ if ((Rest==1 || Rest==DoTrenn) && GetNextChar(TBuf,Index)==SoftTrennK) {
+ if (c=='c') c='k';
+ else if (c=='C') c='K';
+ }
+ }
+ return c;
+}
+
+ // HardSpace und HardTrenn müssen explizit konvertiert werden ! }
+ // if AktAtr.Schnitt and TextKaptBit =TextKaptBit then c:=UpCase(c);(explizit) }
+
+ // Bei der Trennmethode SoftTrennAdd wird davon ausgegangen, daß der zu }
+ // trennende Konsonant bereits 3x mal im TextBuf vorhanden ist, z.b.: }
+ // "Schiff-fahrt". Wenn nicht getrennt, dann wird "-f" entfernt. }
+
+
+
+UCHAR GetTextCharConv(UCHAR* TBuf, USHORT& Index,
+ ObjTextType& Atr0, ObjTextType& AktAtr,
+ USHORT Rest, BOOL ScanEsc)
+{
+ UCHAR c;
+
+ c=GetTextChar(TBuf,Index,Atr0,AktAtr,Rest,ScanEsc);
+ if (c<32) {
+ switch (c) {
+ case HardSpace : c=' '; break;
+ case AbsatzEnd : c=' '; break;
+ case HardTrenn : c='-';
+ }
+ }
+ return c;
+}
+
+
+// ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
+// ³ Function GetLineFeed() ³
+// ³ ³
+// ³ Benötigter Zeilenabstand in SGF-Units. ChrVPos wird berücksichtigt.³
+// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
+USHORT GetLineFeed(UCHAR* TBuf, USHORT Index, ObjTextType Atr0, ObjTextType AktAtr,
+ USHORT nChar, USHORT& LF, USHORT& MaxGrad)
+{
+ UCHAR c=0;
+ BOOL AbsEnd=FALSE;
+ ULONG LF100=0;
+ ULONG MaxLF100=0;
+ BOOL LFauto=0;
+ BOOL First=TRUE;
+ USHORT Grad;
+ USHORT i=0;
+ USHORT r=1;
+
+ MaxGrad=0;
+ while (!AbsEnd && nChar>0) {
+ nChar--;
+ c=GetTextChar(TBuf,Index,Atr0,AktAtr,nChar,FALSE);
+ i++;
+ AbsEnd=(c==TextEnd || c==AbsatzEnd);
+ if (First || (!AbsEnd && c!=' ' && c!=HardTrenn)) {
+ LFauto=(AktAtr.LnFeed & 0x8000)==0;
+ LF100=AktAtr.LnFeed & 0x7FFF;
+ if (LFauto) LF100=LF100*AktAtr.Grad; else LF100*=LF100;
+ if (AktAtr.ChrVPos>0) LF100-=AktAtr.ChrVPos*100;
+ if (LF100>MaxLF100) MaxLF100=LF100;
+ Grad=AktAtr.Grad;
+ if (AktAtr.ChrVPos>0) Grad-=AktAtr.ChrVPos;
+ if (Grad>MaxGrad) MaxGrad=Grad;
+ First=FALSE;
+ }
+ if (!AbsEnd && c!=' ') r=i;
+ }
+ MaxGrad=hPoint2Sgf(MaxGrad);
+ if (MaxLF100<=4000) { // sonst Overflowgefahr
+ LF=USHORT(hPoint2Sgf(short(MaxLF100)) /100);
+ } else {
+ LF=USHORT(hPoint2Sgf(short(MaxLF100) /100));
+ }
+
+ return r;
+}
+
+// End of AbsRead.Pas
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+// iFont.Pas
+
+#define DefaultSlant 1500 /* Default: Italic ist 15ø */
+#define SuperSubFact 60 /* SuperScript/SubScript: 60% vom Schriftgrad */
+#define DefaultSpace 40 /* Default: Space ist 40% vom SchriftGrad */
+
+USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dreh,
+ USHORT FitXMul, USHORT FitXDiv, USHORT FitYMul, USHORT FitYDiv)
+{
+ SgfFontOne* pSgfFont; // Font aus dem IniFile
+ Font aFont;
+ Color aColor;
+ ULONG Grad;
+ ULONG Brei;
+ String FNam;
+ USHORT StdBrei=50; // Durchschnittliche Zeichenbreite in % von Schriftgrad
+ BOOL bFit=(FitXMul!=1 || FitXDiv!=1 || FitYMul!=1 || FitYDiv!=1);
+
+ pSgfFont = pSgfFonts->GetFontDesc(Atr.GetFont());
+
+ if ( pSgfFont!=NULL )
+ {
+ FNam =pSgfFont->SVFName;
+ StdBrei=pSgfFont->SVWidth;
+ if (pSgfFont->Fixd) aFont.SetPitch(PITCH_FIXED); else aFont.SetPitch(PITCH_VARIABLE);
+ aFont.SetFamily(pSgfFont->SVFamil);
+ aFont.SetCharSet(pSgfFont->SVChSet);
+ aFont.SetName(FNam);
+ }
+ else
+ { // Falls nich im Inifile, sind hier einige Fonts hart kodiert
+ aFont.SetPitch(PITCH_VARIABLE);
+ switch (Atr.GetFont()) {
+ case 92500: case 92501: case 92504: case 92505:
+ {
+#if defined(WIN) || defined(WNT) || defined(PM2)
+ FNam=String::CreateFromAscii( "Times New Roman" ); // CG Times ist unter Windows und OS/2 Times New Roman
+#else
+ FNam=String::CreateFromAscii( "Times" ); // ansonsten ist das einfach Times
+#endif
+ StdBrei=40;
+ aFont.SetFamily(FAMILY_ROMAN);
+ } break;
+ case 94021: case 94022: case 94023: case 94024: {
+#if defined(WIN) || defined(WNT)
+ FNam=String::CreateFromAscii( "Arial", 5 ); // Univers ist unter Windows Arial
+#else
+ FNam=String::CreateFromAscii( "Helvetica" ); // und ansonsten Helvetica
+#endif
+ aFont.SetFamily(FAMILY_SWISS);
+ StdBrei=47;
+ } break;
+ case 93950: case 93951: case 93952: case 93953: {
+#if defined(WIN) || defined(WNT)
+ FNam=String::CreateFromAscii( "Courier New" ); // Der Vector-Courierfont unter Windows heißt Courier New
+#else
+ FNam=String::CreateFromAscii( "Courier" ); // ansonsten ist und bleibt Courier immer Courier
+#endif
+ aFont.SetFamily(FAMILY_ROMAN);
+ aFont.SetPitch(PITCH_FIXED);
+ } break;
+ default: FNam=String::CreateFromAscii( "Helvetica", 9 );
+ }
+ aFont.SetName(FNam);
+ //aFont.SetCharSet(CHARSET_SYSTEM);
+ }
+
+ Grad=ULONG(Atr.Grad);
+ if ((Atr.Schnitt & TextKaptBit) !=0 && Kapt) Grad=Grad*ULONG(Atr.Kapit)/100;
+ if ((Atr.Schnitt & TextSupSBit) !=0 || (Atr.Schnitt & TextSubSBit) !=0) Grad=Grad*SuperSubFact/100;
+ Brei=Grad;
+ if (Atr.Breite!=100 || bFit) {
+ if (bFit) {
+ Grad=Grad*ULONG(FitYMul)/ULONG(FitYDiv);
+ Brei=Brei*ULONG(FitXMul)/ULONG(FitXDiv);
+ }
+ Brei=Brei*ULONG(Atr.Breite)/100;
+ Brei=Brei*ULONG(StdBrei)/100;
+ aFont.SetSize(Size(hPoint2Sgf(USHORT(Brei)),hPoint2Sgf(USHORT(Grad))));
+ } else {
+ aFont.SetSize(Size(0,hPoint2Sgf(USHORT(Grad))));
+ }
+
+ aColor=Sgv2SvFarbe(Atr.L.LFarbe,Atr.L.LBFarbe,Atr.L.LIntens); aFont.SetColor(aColor);
+ aColor=Sgv2SvFarbe(Atr.F.FFarbe,Atr.F.FBFarbe,Atr.F.FIntens); aFont.SetFillColor(aColor);
+ aFont.SetTransparent(TRUE);
+ aFont.SetAlign(ALIGN_BASELINE);
+
+ Dreh/=10; Dreh=3600-Dreh; if (Dreh==3600) Dreh=0;
+ aFont.SetOrientation(Dreh);
+
+ if ((Atr.Schnitt & TextBoldBit) !=0) aFont.SetWeight(WEIGHT_BOLD);
+ if ((Atr.Schnitt & TextRSlnBit) !=0) aFont.SetItalic(ITALIC_NORMAL);
+ if ((Atr.Schnitt & TextUndlBit) !=0) aFont.SetUnderline(UNDERLINE_SINGLE);
+ if ((Atr.Schnitt & TextDbUnBit) !=0) aFont.SetUnderline(UNDERLINE_DOUBLE);
+ if ((Atr.Schnitt & TextStrkBit) !=0) aFont.SetStrikeout(STRIKEOUT_SINGLE);
+ if ((Atr.Schnitt & TextDbStBit) !=0) aFont.SetStrikeout(STRIKEOUT_DOUBLE);
+ if ((Atr.Schnitt & TextSh2DBit) !=0) aFont.SetShadow(TRUE);
+ if ((Atr.Schnitt & TextSh3DBit) !=0) aFont.SetShadow(TRUE);
+ if ((Atr.Schnitt & TextSh4DBit) !=0) aFont.SetShadow(TRUE);
+ if ((Atr.Schnitt & TextShEbBit) !=0) aFont.SetShadow(TRUE);
+ if (CheckTextOutl(Atr.F,Atr.L)) aFont.SetOutline(TRUE);
+
+ if (aFont!=rOut.GetFont()) rOut.SetFont(aFont);
+
+ return 0;
+}
+
+// iFont.Pas
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+// Absatz.Pas
+
+struct ProcChrSta {
+ USHORT Index;
+ USHORT ChrXP;
+ UCHAR OutCh;
+ BOOL Kapt;
+ ObjTextType Attrib;
+};
+
+void InitProcessCharState(ProcChrSta& State, ObjTextType& AktAtr, USHORT IndexA)
+{
+ State.Attrib=AktAtr;
+ State.OutCh=0;
+ State.Index=IndexA;
+ State.ChrXP=0;
+ State.Kapt=FALSE;
+}
+
+BOOL UpcasePossible(UCHAR c)
+{
+ if ((c>='a' && c<='z') || c=='ä' || c=='ö' || c=='ü') return TRUE;
+ else return FALSE;
+}
+
+UCHAR Upcase(UCHAR c)
+{
+ if ((c>=(UCHAR)'a' && c<=(UCHAR)'z')) c=(c-(UCHAR)'a')+(UCHAR)'A';
+ else if (c==(UCHAR)'ä') c=(UCHAR)'Ä';
+ else if (c==(UCHAR)'ö') c=(UCHAR)'Ö';
+ else if (c==(UCHAR)'ü') c=(UCHAR)'Ü';
+ return c;
+}
+
+USHORT GetCharWidth(OutputDevice& rOut, UCHAR c)
+{
+ UCHAR c1;
+ USHORT ChrWidth;
+
+ c1 = ByteString::Convert((char)c,RTL_TEXTENCODING_IBM_437, gsl_getSystemTextEncoding() );
+ if (c==' ')
+ {
+ ChrWidth=(USHORT)rOut.GetTextWidth( String('A') );
+ if (rOut.GetFont().GetPitch()!=PITCH_FIXED) {
+ ChrWidth=MulDiv(ChrWidth,DefaultSpace,100);
+ }
+ } else {
+ if (c>=MinChar && c<=MaxChar) {
+ ChrWidth=(USHORT)rOut.GetTextWidth(String((char)c1));
+ } else {
+ ChrWidth=(USHORT)rOut.GetTextWidth(String('A'));
+ }
+ }
+ return ChrWidth;
+}
+
+UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& Atr0,
+ USHORT& nChars, USHORT Rest,
+ short* Line, UCHAR* cLine)
+{
+ USHORT KernDist=0; // Wert für Kerning
+ USHORT ChrWidth;
+ UCHAR c;
+ UCHAR c1;
+ BOOL AbsEnd;
+
+ c=GetTextChar(TBuf,R.Index,Atr0,R.Attrib,Rest,FALSE); // versucht evtl. zu trennen, wenn Rest entsprechenden Wert besitzt
+
+ AbsEnd=(c==AbsatzEnd || c==TextEnd);
+ if (AbsEnd==FALSE) {
+ R.OutCh=ConvertTextChar(c); // von HardTrenn nach '-', ...
+ R.Kapt=(R.Attrib.Schnitt & TextKaptBit) !=0 && UpcasePossible(R.OutCh);
+ if (R.Kapt) R.OutCh=Upcase(R.OutCh);
+ SetTextContext(rOut,R.Attrib,R.Kapt,0,1,1,1,1);
+
+ if (R.Kapt) c1=Upcase(c); else c1=c;
+ ChrWidth=GetCharWidth(rOut,c1);
+
+ if (R.Attrib.ZAbst!=100) { // Spezial-Zeichenabstand ?
+ ULONG Temp;
+ Temp=ULONG(ChrWidth)*ULONG(R.Attrib.ZAbst)/100;
+ ChrWidth=USHORT(Temp);
+ }
+ nChars++;
+ if (R.ChrXP>32000) R.ChrXP=32000;
+ Line[nChars]=R.ChrXP-KernDist;
+ cLine[nChars]=c;
+ R.ChrXP+=ChrWidth-KernDist; // Position für den nächsten Character
+ }
+ return c;
+}
+
+void FormatLine(UCHAR* TBuf, USHORT& Index, ObjTextType& Atr0, ObjTextType& AktAtr,
+ USHORT UmbWdt, USHORT AdjWdt,
+ short* Line, USHORT& nChars,
+ double rSn, double rCs,
+ UCHAR* cLine, BOOL TextFit)
+{
+ VirtualDevice vOut;
+ UCHAR c,c0;
+ UCHAR ct;
+ BOOL First; // erster Char ?
+ BYTE Just; // Absatzformatierung
+ BOOL Border; // Rand der Box erreicht ?
+ BOOL Border0;
+ BOOL AbsEnd; // Ende des Absatzes erreicht ?
+ ProcChrSta* R=new ProcChrSta;
+ ProcChrSta* R0=new ProcChrSta;
+ ProcChrSta* WErec=new ProcChrSta;
+ USHORT WEnChar;
+ ProcChrSta* WErec0=new ProcChrSta;
+ USHORT WEnChar0;
+ ProcChrSta* TRrec=new ProcChrSta;
+ USHORT TRnChar;
+
+ USHORT WordEndCnt; // Justieren und Trennen
+ BOOL WordEnd;
+ BOOL Trenn;
+
+ short BoxRest; // zum Quetschen und formatieren
+ USHORT i,j,k,h;
+ USHORT re,li;
+
+ vOut.SetMapMode(MapMode(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4)));
+
+ nChars=0;
+ SetTextContext(vOut,AktAtr,FALSE,0,1,1,1,1);
+ InitProcessCharState(*R,AktAtr,Index);
+ (*R0)=(*R); (*WErec)=(*R); WEnChar=0; c0=0; Border0=FALSE;
+ Border=FALSE; First=TRUE;
+ WordEndCnt=0;
+
+ do { // mal schauen, wieviele Worte so in die Zeile passen
+ if (Border) c=ProcessChar(vOut,TBuf,*R,Atr0,nChars,DoTrenn,Line,cLine);
+ else c=ProcessChar(vOut,TBuf,*R,Atr0,nChars,NoTrenn,Line,cLine);
+ AbsEnd=(c==AbsatzEnd || c==TextEnd);
+ //if not AbsEnd then
+ {
+ if (First) {
+ Just=R->Attrib.Justify & 0x0F; // Absatzformat steht wenn, dann am Anfang
+ }
+ Border=R->ChrXP>UmbWdt;
+ WordEnd=(AbsEnd || (c==' ')) && (c0!=' ') && (c0!=0);
+ Trenn=c=='-';
+ if (WordEnd && !Border0) {
+ WordEndCnt++;
+ (*WErec)=(*R0);
+ WEnChar=nChars-1;
+ }
+ if (Trenn && !Border) {
+ WordEndCnt++;
+ (*WErec)=(*R);
+ WEnChar=nChars;
+ }
+ }
+ (*R0)=(*R); c0=c;
+ Border0=Border;
+ First=FALSE;
+ AbsEnd=AbsEnd || (nChars>=MaxLineChars);
+ } while (!(AbsEnd || (Border && ((WordEndCnt>0) || WordEnd || Trenn))));
+
+ if (Border) { // Trennen und Quetschen
+ (*WErec0)=(*WErec); WEnChar0=WEnChar;
+ AbsEnd=FALSE; c0=0;
+ (*R)=(*WErec); nChars=WEnChar;
+ (*TRrec)=(*R); TRnChar=nChars;
+ Border0=FALSE; Border=FALSE;
+ do { // erst mal gucken wieviele Silben noch reinpassen
+ ct=ProcessChar(vOut,TBuf,*TRrec,Atr0,TRnChar,DoTrenn,Line,cLine);
+ c=ProcessChar(vOut,TBuf,*R,Atr0,nChars,NoTrenn,Line,cLine);
+ AbsEnd=(ct==AbsatzEnd) || (ct==TextEnd) || (nChars>=MaxLineChars);
+
+ Border=TRrec->ChrXP>UmbWdt;
+ WordEnd=AbsEnd || ((AbsEnd || (c==' ')) && (c0!=' ') && (c0!=0));
+ Trenn=ct=='-';
+ if (WordEnd && (!Border0 || (WordEndCnt==0))) {
+ WordEndCnt++;
+ (*WErec)=(*R0);
+ if (AbsEnd) WEnChar=nChars; else WEnChar=nChars-1;
+ (*TRrec)=(*R); TRnChar=nChars; // zum weitersuchen
+ }
+ if (Trenn && (!Border || (WordEndCnt==0))) {
+ WordEndCnt++; // merken, daß man hier trennen kann
+ (*WErec)=(*TRrec);
+ WEnChar=TRnChar;
+ (*TRrec)=(*R); TRnChar=nChars; // zum weitersuchen
+ }
+ (*R0)=(*R); c0=c;
+ Border0=Border;
+ Border=R->ChrXP>UmbWdt;
+ } while (!(AbsEnd || (Border && ((WordEndCnt>0) || WordEnd || Trenn))));
+
+ while (WErec0->Index<WErec->Index) { // damit Line[] auch garantiert stimmt }
+ c=ProcessChar(vOut,TBuf,*WErec0,Atr0,WEnChar0,WEnChar-WEnChar0-1,Line,cLine);
+ }
+
+ (*R)=(*WErec); nChars=WEnChar;
+
+ if (UmbWdt>=R->ChrXP) {
+ BoxRest=UmbWdt-R->ChrXP;
+ } else { // Zusammenquetschen
+ BoxRest=R->ChrXP-UmbWdt; // um soviel muß gequetscht werden
+ for (i=2;i<=nChars;i++) { // 1. CharPosition bleibt !
+ Line[i]-=(i-1)*(BoxRest) /(nChars-1);
+ }
+ R->ChrXP=UmbWdt;
+ Line[nChars+1]=UmbWdt;
+ }
+ }
+
+ if (!AbsEnd) {
+ do { // Leerzeichen weglesen
+ (*WErec)=(*R);
+ c=GetTextChar(TBuf,R->Index,Atr0,R->Attrib,NoTrenn,FALSE);
+ nChars++;
+ Line[nChars]=R->ChrXP;
+ cLine[nChars]=c;
+ } while (c==' ');
+ if (c!=' ' && c!=AbsatzEnd && c!=TextEnd) {
+ nChars--;
+ (*R)=(*WErec);
+ }
+ }
+
+ if (AbsEnd && nChars<MaxLineChars) { // Ausrichten, statt Blocksatz aber linksbündig
+ if (Just==3) Just=0;
+ nChars++; Line[nChars]=R->ChrXP; // Damit AbsatzEnde auch weggelesen wird
+ Line[nChars+1]=R->ChrXP; // denn die Breite von CR oder #0 ist nun mal sehr klein
+ if (TBuf[R->Index-1]!=AbsatzEnd && TBuf[R->Index-1]!=TextEnd) {
+ c=GetTextChar(TBuf,R->Index,Atr0,R->Attrib,NoTrenn,FALSE); // Kleine Korrektur. Notig, wenn nur 1 Wort in
+ }
+ }
+
+ BoxRest=AdjWdt-R->ChrXP;
+ if (TextFit) Just=THJustLeft;
+
+ switch (Just) {
+ case THJustLeft: break; // Links
+ case THJustCenter: {
+ BoxRest=BoxRest /2; // Mitte
+ for (i=1;i<=nChars;i++) Line[i]+=BoxRest;
+ } break;
+ case THJustRight: { // Rechts
+ for (i=1;i<=nChars;i++) Line[i]+=BoxRest;
+ } break;
+ case THJustDrvOut:
+ case THJustBlock: { // Block und Austreibend
+ re=nChars;
+ if (Just==THJustDrvOut) re--;
+ while (re>=1 && (cLine[re]==' ' || cLine[re]==TextEnd || cLine[re]==AbsatzEnd)) re--;
+ li=1;
+ while (li<=re && (cLine[li]==' ' || cLine[li]==TextEnd || cLine[li]==AbsatzEnd)) li++;
+ if (Just==THJustDrvOut) BoxRest=AdjWdt-Line[re+1];
+
+ j=0; // Anzahl der Spaces ermitteln
+ for (i=li;i<=re;i++) {
+ if (cLine[i]==' ') {
+ j++;
+ }
+ }
+
+ if (j==0) { // nur 1 Wort ? -> Strecken !
+ for (i=li+1;i<=re;i++) { // von links nach rechts
+ Line[i]+=MulDiv(i-li,BoxRest,re-li+1-1);
+ }
+ } else {
+ k=0; h=0;
+ for (i=li;i<=re;i++) { // j Spaces aufbohren !
+ if (cLine[i]==' ') { // Space gefunden !
+ k++;
+ h=MulDiv(k,BoxRest,j);
+ }
+ Line[i]+=h;
+ }
+ }
+ for (i=re+1;i<=nChars;i++) Line[i]+=BoxRest; // und den Rest anpassen
+ Line[nChars+1]=AdjWdt;
+ } break;
+ case THJustLocked: { //Gesperrt
+ re=nChars-1;
+ while (re>=1 && (cLine[re]==' ' || cLine[re]==TextEnd || cLine[re]==AbsatzEnd)) re--;
+ li=1;
+ while (li<=re && (cLine[li]==' ' || cLine[li]==TextEnd || cLine[li]==AbsatzEnd)) li++;
+ BoxRest=AdjWdt-Line[re+1];
+ for (i=li+1;i<=re;i++) { // Strecken von links nach rechts
+ Line[i]+=MulDiv(i-li,BoxRest,re-li+1-1);
+ }
+ for (i=re+1;i<=nChars;i++) Line[i]+=BoxRest; // und den Rest anpassen
+ Line[nChars+1]=AdjWdt;
+ } break;
+ }
+ Index=R->Index;
+ AktAtr=R->Attrib;
+ delete R;
+ delete R0;
+ delete WErec;
+ delete WErec0;
+ delete TRrec;
+}
+
+
+
+// End of Absatz.Pas
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+// DrawText.Pas
+
+void DrawChar(OutputDevice& rOut, UCHAR c, ObjTextType T, PointType Pos, USHORT DrehWink,
+ USHORT FitXMul, USHORT FitXDiv, USHORT FitYMul, USHORT FitYDiv)
+{
+ SetTextContext(rOut,T,UpcasePossible(c),DrehWink,FitXMul,FitXDiv,FitYMul,FitYDiv);
+ if ((T.Schnitt & TextKaptBit)!=0 && UpcasePossible(c)) c=Upcase(c);
+ String s( (char)c, RTL_TEXTENCODING_IBM_437 );
+ rOut.DrawText( Point( Pos.x, Pos.y ), s );
+}
+
+/*************************************************************************
+|*
+|* TextType::Draw()
+|*
+|* Beschreibung
+|* Ersterstellung JOE 09.08.93
+|* Letzte Aenderung JOE 09.08.93
+|*
+*************************************************************************/
+void TextType::Draw(OutputDevice& rOut)
+{
+ if ((Flags & TextOutlBit)!=0) return; // Sourcetext für Outliner !!
+
+ ObjTextType T1,T2;
+ USHORT Index1;
+ USHORT Index2;
+ UCHAR c;
+ USHORT l; // Anzahl der Zeichen in der Zeile
+ USHORT i;
+ short yPos0;
+ short xPos;
+ short yPos;
+ USHORT LF;
+ USHORT MaxGrad;
+ short xSize;
+ short xSAdj;
+ short ySize;
+ double sn,cs;
+ USHORT TopToBase;
+ BOOL Ende;
+ USHORT lc;
+ BOOL LineFit; // FitSize.x=0? oder Flags -> jede Zeile stretchen
+ BOOL TextFit;
+ short* xLine;
+ UCHAR* cLine; // Buffer für FormatLine
+ USHORT FitXMul;
+ USHORT FitXDiv;
+ USHORT FitYMul;
+ USHORT FitYDiv;
+ BOOL Fehler;
+ UCHAR* Buf=Buffer; // Zeiger auf die Buchstaben
+
+ pSgfFonts->ReadList();
+ xLine=new short[ChrXPosArrSize];
+ cLine=new UCHAR[CharLineSize];
+
+ TextFit=(Flags & TextFitBits)!=0;
+ LineFit=FALSE;
+ LineFit=((Flags & TextFitZBit)!=0);
+ if (TextFit && FitSize.x==0) LineFit=TRUE;
+
+ if (DrehWink==0) {
+ sn=0.0;
+ cs=1.0;
+ } else {
+ sn=sin(double(DrehWink)*3.14159265359/18000);
+ cs=cos(double(DrehWink)*3.14159265359/18000);
+ }
+
+ T1=T; Index1=0; yPos=0; xPos=0;
+ if (TextFit) {
+ ySize=Pos2.y-Pos1.y;
+ xSize=32000 /2; // Umbruch
+ xSAdj=Pos2.x-Pos1.x; // zum Ausrichten bei Zentriert/Blocksatz
+ //if (xSize<=0) { xSize=32000 /2; LineFit=TRUE; }
+ FitXMul=abs(Pos2.x-Pos1.x); FitXDiv=FitSize.x; if (FitXDiv==0) FitXDiv=1;
+ FitYMul=abs(Pos2.y-Pos1.y); FitYDiv=FitSize.y; if (FitYDiv==0) FitYDiv=1;
+ } else {
+ xSize=Pos2.x-Pos1.x;
+ xSAdj=xSize;
+ ySize=Pos2.y-Pos1.y;
+ FitXMul=1; FitXDiv=1;
+ FitYMul=1; FitYDiv=1;
+ }
+ if (xSize<0) xSize=0;
+ if (xSAdj<0) xSAdj=0;
+
+ do {
+ T2=T1; Index2=Index1;
+ FormatLine(Buf,Index2,T,T2,xSize,xSAdj,xLine,l,sn,cs,cLine,LineFit);
+ Fehler=(Index2==Index1);
+ if (!Fehler) {
+ lc=GetLineFeed(Buf,Index1,T,T1,l,LF,MaxGrad);
+ if (TextFit) {
+ if (LineFit) FitXDiv=xLine[lc+1];
+ if (FitXDiv>0) {
+ long Temp;
+ for (i=1;i<=l+1;i++) {
+ Temp=long(xLine[i])*long(FitXMul) /long(FitXDiv);
+ xLine[i]=short(Temp);
+ }
+ LF=MulDiv(LF,FitYMul,FitYDiv);
+ MaxGrad=MulDiv(MaxGrad,FitYMul,FitYDiv);
+ } else {
+ FitXDiv=1; // 0 gibts nicht
+ }
+ }
+ yPos0=yPos;
+ TopToBase=GetTopToBaseLine(MaxGrad);
+ yPos+=TopToBase;
+ Ende=(yPos0+short(MulDiv(MaxGrad,CharTopToBtm,100))>ySize) && !TextFit;
+ if (!Ende) {
+ T2=T1; Index2=Index1;
+ i=1;
+ while (i<=l) {
+ c=GetTextCharConv(Buf,Index2,T,T2,l-i,FALSE);
+ long xp1,yp1; // wegen Overflowgefahr
+ PointType Pos;
+ xp1=long(Pos1.x)+xPos+long(xLine[i]);
+ yp1=long(Pos1.y)+yPos;
+ if (xp1>32000) xp1=32000; if (xp1<-12000) xp1=-12000;
+ if (yp1>32000) yp1=32000; if (yp1<-12000) yp1=-12000;
+ Pos.x=short(xp1);
+ Pos.y=short(yp1);
+
+ if (DrehWink!=0) RotatePoint(Pos,Pos1.x,Pos1.y,sn,cs);
+ DrawChar(rOut,c,T2,Pos,DrehWink,FitXMul,FitXDiv,FitYMul,FitYDiv);
+ i++;
+ } // while i<=l
+ yPos=yPos0+LF;
+ T1=T2; Index1=Index2; // Für die nächste Zeile
+ } // if ObjMin.y+yPos<=Obj_Max.y
+ } // if !Fehler
+ } while (c!=TextEnd && !Ende && !Fehler);
+ delete cLine;
+ delete xLine;
+}
+
+// End of DrawText.Pas
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+
+// nicht mehr benötigt, da der Pointer nun extra geführt wird
+// (DEC Alpha hat nämlich 64Bit-Pointer!)
+//UCHAR* TextType::GetBufPtr()
+//{
+// ULONG Temp;
+// Temp=ULONG(BufLo)+0x00010000*ULONG(BufHi);
+// return (UCHAR*)Temp;
+//}
+//
+//void TextType::SetBufPtr(UCHAR* Ptr)
+//{
+// ULONG Temp=(ULONG)Ptr;
+// BufLo=USHORT(Temp & 0x0000FFFF);
+// BufHi=USHORT((Temp & 0xFFFF0000)>>16);
+//}
+
+UINT32 ObjTextType::GetFont()
+{
+ return ULONG(FontLo)+0x00010000*ULONG(FontHi);
+}
+
+void ObjTextType::SetFont(UINT32 FontID)
+{
+ FontLo=USHORT(FontID & 0x0000FFFF);
+ FontHi=USHORT((FontID & 0xFFFF0000)>>16);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////
+// SGF.Ini lesen ////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////
+SgfFontOne::SgfFontOne()
+{
+ Next=NULL;
+ IFID=0;
+ Bold=FALSE;
+ Ital=FALSE;
+ Sans=FALSE;
+ Serf=FALSE;
+ Fixd=FALSE;
+ SVFamil=FAMILY_DONTKNOW;
+ SVChSet=RTL_TEXTENCODING_DONTKNOW;
+ SVWidth=40;
+}
+
+void SgfFontOne::ReadOne( ByteString& ID, ByteString& Dsc )
+{
+ USHORT i,j,n;
+ ByteString s;
+
+ if ( Dsc.Len() < 4 || ( Dsc.GetChar( 0 ) != '(' ) )
+ return;
+ i=1; // Erster Buchstabe des IF-Fontnamen. Davor ist eine '('
+ while ( i < Dsc.Len() && ( Dsc.GetChar( i ) !=')' ) )
+ i++;
+ Dsc.Erase(0,i+1); // IF-Fontname löschen inkl. ()
+
+ if ( Dsc.Len() < 2 || ( Dsc.GetChar( Dsc.Len() - 1 ) !=')' ) )
+ return;
+ i=Dsc.Len()-2; // hier ist die ')' des SV-Fontnames
+ j=0;
+ while ( i > 0 && ( Dsc.GetChar( i ) != '(' ) )
+ {
+ i--;
+ j++;
+ }
+ SVFName=String(Dsc,i+1,j); // SV-Fontname rausholen
+ Dsc.Erase(i,j);
+
+ IFID = (UINT32)ID.ToInt32();
+ n=Dsc.GetTokenCount(' ');
+ for (i=0;i<n;i++)
+ {
+ s = Dsc.GetToken( i,' ' );
+ if ( s.Len() )
+ {
+ s.ToUpperAscii();
+ if ( s.CompareTo( "BOLD", 4 ) == COMPARE_EQUAL ) Bold=TRUE;
+ else if ( s.CompareTo( "ITAL", 4 ) == COMPARE_EQUAL ) Ital=TRUE;
+ else if ( s.CompareTo( "SERF", 4 ) == COMPARE_EQUAL ) Serf=TRUE;
+ else if ( s.CompareTo( "SANS", 4 ) == COMPARE_EQUAL ) Sans=TRUE;
+ else if ( s.CompareTo( "FIXD", 4 ) == COMPARE_EQUAL ) Fixd=TRUE;
+ else if ( s.CompareTo( "ROMAN", 5 ) == COMPARE_EQUAL ) SVFamil=FAMILY_ROMAN;
+ else if ( s.CompareTo( "SWISS", 5 ) == COMPARE_EQUAL ) SVFamil=FAMILY_SWISS;
+ else if ( s.CompareTo( "MODERN", 6 ) == COMPARE_EQUAL ) SVFamil=FAMILY_MODERN;
+ else if ( s.CompareTo( "SCRIPT", 6 ) == COMPARE_EQUAL ) SVFamil=FAMILY_SCRIPT;
+ else if ( s.CompareTo( "DECORA", 6 ) == COMPARE_EQUAL ) SVFamil=FAMILY_DECORATIVE;
+ else if ( s.CompareTo( "ANSI", 4 ) == COMPARE_EQUAL ) SVChSet=RTL_TEXTENCODING_MS_1252;
+ else if ( s.CompareTo( "IBMPC", 5 ) == COMPARE_EQUAL ) SVChSet=RTL_TEXTENCODING_IBM_850;
+ else if ( s.CompareTo( "MAC", 3 ) == COMPARE_EQUAL ) SVChSet=RTL_TEXTENCODING_APPLE_ROMAN;
+ else if ( s.CompareTo( "SYMBOL", 6 ) == COMPARE_EQUAL ) SVChSet=RTL_TEXTENCODING_SYMBOL;
+ else if ( s.CompareTo( "SYSTEM", 6 ) == COMPARE_EQUAL ) SVChSet = gsl_getSystemTextEncoding();
+ else if ( s.IsNumericAscii() ) SVWidth=s.ToInt32();
+ }
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+
+SgfFontLst::SgfFontLst()
+{
+ pList=NULL;
+ Last=NULL;
+ LastID=0;
+ LastLn=NULL;
+ Tried=FALSE;
+}
+
+SgfFontLst::~SgfFontLst()
+{
+ RausList();
+}
+
+void SgfFontLst::RausList()
+{
+ SgfFontOne* P;
+ SgfFontOne* P1;
+ P=pList;
+ while (P!=NULL) {
+ P1=P->Next;
+ delete P;
+ P=P1;
+ }
+ pList=NULL;
+ Last=NULL;
+ Tried=FALSE;
+ LastID=0;
+ LastLn=NULL;
+}
+
+void SgfFontLst::AssignFN(const String& rFName)
+{ FNam=rFName; }
+
+void SgfFontLst::ReadList()
+{
+ if (!Tried) {
+ Tried=TRUE;
+ LastID=0;
+ LastLn=NULL;
+ SgfFontOne* P,P1;
+ Config aCfg(FNam);
+ aCfg.SetGroup("SGV Fonts fuer StarView");
+ USHORT Anz=aCfg.GetKeyCount();
+ USHORT i;
+ ByteString FID,Dsc;
+
+ for (i=0;i<Anz;i++)
+ {
+ FID = aCfg.GetKeyName( i );
+ FID = FID.EraseAllChars(); // Leerzeichen weg
+ Dsc = aCfg.ReadKey( i );
+ if ( FID.IsNumericAscii() )
+ {
+ P=new SgfFontOne; // neuer Eintrag
+ if (Last!=NULL) Last->Next=P; else pList=P; Last=P; // einklinken
+ P->ReadOne(FID,Dsc); // und Zeile interpretieren
+ }
+ }
+ }
+}
+
+SgfFontOne* SgfFontLst::GetFontDesc(UINT32 ID)
+{
+ if (ID!=LastID) {
+ SgfFontOne* P;
+ P=pList;
+ while (P!=NULL && P->IFID!=ID) P=P->Next;
+ LastID=ID;
+ LastLn=P;
+ }
+ return LastLn;
+}
diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc
new file mode 100644
index 000000000000..feee7a0eb9df
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/strings.hrc
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "svtools.hrc"
diff --git a/svtools/source/filter.vcl/filter/strings.src b/svtools/source/filter.vcl/filter/strings.src
new file mode 100644
index 000000000000..7fd31d283077
--- /dev/null
+++ b/svtools/source/filter.vcl/filter/strings.src
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: strings.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "strings.hrc"
+
+String EXPORT_DIALOG_TITLE
+{
+ Text = " Optionen" ;
+ Text [ ENGLISH ] = " options" ;
+ Text [ english_us ] = " Options" ;
+ Text [ italian ] = " Opzioni" ;
+ Text [ spanish ] = " Opciones" ;
+ Text [ french ] = "[_]Options" ;
+ Text [ dutch ] = " Opties" ;
+ Text [ swedish ] = " Alternativ" ;
+ Text [ danish ] = " Alternativer" ;
+ Text [ portuguese_brazilian ] = " Optionen" ;
+ Text [ portuguese ] = " Opções" ;
+ Text[ chinese_simplified ] = " Ñ¡Ïî";
+ Text[ russian ] = " Ïàðàìåòðû";
+ Text[ polish ] = " Opcje";
+ Text[ japanese ] = " µÌß¼®Ý";
+ Text[ chinese_traditional ] = " ¿ï¶µ";
+ Text[ arabic ] = " ÇáÎíÇÑÇÊ";
+ Text[ greek ] = " ÅðéëïãÝò";
+ Text[ korean ] = " ¿É¼Ç";
+ Text[ turkish ] = " Seçenekler";
+ Text[ language_user1 ] = " ";
+};
+
+String KEY_MODE
+{
+ Text = "-EXPORT-MODE" ;
+};
+
+String KEY_RES
+{
+ Text = "-EXPORT-RES" ;
+};
+
+String KEY_SIZEX
+{
+ Text = "-EXPORT-SIZEX" ;
+};
+
+String KEY_SIZEY
+{
+ Text = "-EXPORT-SIZEY" ;
+};
+
+String KEY_COLORS
+{
+ Text = "-COLORS" ;
+};
+
+String KEY_RLE_CODING
+{
+ Text = "-RLE_CODING" ;
+};
diff --git a/svtools/source/filter.vcl/igif/decode.cxx b/svtools/source/filter.vcl/igif/decode.cxx
new file mode 100644
index 000000000000..f7d9198d5bfa
--- /dev/null
+++ b/svtools/source/filter.vcl/igif/decode.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * $RCSfile: decode.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/new.hxx>
+#include "decode.hxx"
+
+// ------------------------------------------------------------------------
+
+struct GIFLZWTableEntry
+{
+ GIFLZWTableEntry* pPrev;
+ GIFLZWTableEntry* pFirst;
+ BYTE nData;
+};
+
+// ------------------------------------------------------------------------
+
+GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) :
+ nDataSize ( cDataSize ),
+ bEOIFound ( FALSE ),
+ nOutBufDataLen ( 0 ),
+ nInputBitsBuf ( 0 ),
+ nInputBitsBufSize ( 0 )
+{
+ pTable = new GIFLZWTableEntry[ 4096 ];
+ pOutBuf = new BYTE[ 4096 ];
+
+ nClearCode = 1 << nDataSize;
+ nEOICode = nClearCode + 1;
+ nTableSize = nEOICode + 1;
+ nCodeSize = nDataSize + 1;
+ nOldCode = 0xffff;
+ pOutBufData = pOutBuf + 4096;
+
+ for( USHORT i = 0; i < nTableSize; i++ )
+ {
+ pTable[i].pPrev = NULL;
+ pTable[i].pFirst = pTable + i;
+ pTable[i].nData = (BYTE) i;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+GIFLZWDecompressor::~GIFLZWDecompressor()
+{
+ delete[] pOutBuf;
+ delete[] pTable;
+}
+
+// ------------------------------------------------------------------------
+
+HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, BYTE cBufSize,
+ ULONG& rCount, BOOL& rEOI )
+{
+ ULONG nTargetSize = 4096;
+ ULONG nCount = 0;
+ HPBYTE pTarget = (HPBYTE) SvMemAlloc( nTargetSize );
+ HPBYTE pTmpTarget = pTarget;
+
+ nBlockBufSize = cBufSize;
+ nBlockBufPos = 0;
+ pBlockBuf = pSrc;
+
+ while( ProcessOneCode() )
+ {
+ nCount += nOutBufDataLen;
+
+ if( nCount > nTargetSize )
+ {
+ ULONG nNewSize = nTargetSize << 1;
+ ULONG nOffset = pTmpTarget - pTarget;
+ HPBYTE pTmp = (HPBYTE) SvMemAlloc( nNewSize );
+
+ HMEMCPY( pTmp, pTarget, nTargetSize );
+ SvMemFree( pTarget );
+
+ nTargetSize = nNewSize;
+ pTmpTarget = ( pTarget = pTmp ) + nOffset;
+ }
+
+ HMEMCPY( pTmpTarget, pOutBufData, nOutBufDataLen );
+ pTmpTarget += nOutBufDataLen;
+ pOutBufData += nOutBufDataLen;
+ nOutBufDataLen = 0;
+
+ if ( bEOIFound )
+ break;
+ }
+
+ rCount = nCount;
+ rEOI = bEOIFound;
+
+ return pTarget;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFLZWDecompressor::AddToTable( USHORT nPrevCode, USHORT nCodeFirstData )
+{
+ GIFLZWTableEntry* pE;
+
+ if( nTableSize < 4096 )
+ {
+ pE = pTable + nTableSize;
+ pE->pPrev = pTable + nPrevCode;
+ pE->pFirst = pE->pPrev->pFirst;
+ pE->nData = pTable[ nCodeFirstData ].pFirst->nData;
+ nTableSize++;
+
+ if ( ( nTableSize == (USHORT) (1 << nCodeSize) ) && ( nTableSize < 4096 ) )
+ nCodeSize++;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFLZWDecompressor::ProcessOneCode()
+{
+ GIFLZWTableEntry* pE;
+ USHORT nCode;
+ BOOL bRet = FALSE;
+ BOOL bEndOfBlock = FALSE;
+
+ while( nInputBitsBufSize < nCodeSize )
+ {
+ if( nBlockBufPos >= nBlockBufSize )
+ {
+ bEndOfBlock = TRUE;
+ break;
+ }
+
+ nInputBitsBuf |= ( (ULONG) pBlockBuf[ nBlockBufPos++ ] ) << nInputBitsBufSize;
+ nInputBitsBufSize += 8;
+ }
+
+ if ( !bEndOfBlock )
+ {
+ // Einen Code aus dem Eingabe-Buffer holen:
+ nCode = ( (USHORT) nInputBitsBuf ) & ( ~( 0xffff << nCodeSize ) );
+ nInputBitsBuf >>= nCodeSize;
+ nInputBitsBufSize -= nCodeSize;
+
+ if ( nCode < nClearCode )
+ {
+ if ( nOldCode != 0xffff )
+ AddToTable( nOldCode, nCode );
+ }
+ else if ( ( nCode > nEOICode ) && ( nCode <= nTableSize ) )
+ {
+ if ( nCode == nTableSize )
+ AddToTable( nOldCode, nOldCode );
+ else
+ AddToTable( nOldCode, nCode );
+ }
+ else
+ {
+ if ( nCode == nClearCode )
+ {
+ nTableSize = nEOICode + 1;
+ nCodeSize = nDataSize + 1;
+ nOldCode = 0xffff;
+ nOutBufDataLen = 0;
+ }
+ else
+ bEOIFound = TRUE;
+
+ return TRUE;
+ }
+
+ nOldCode = nCode;
+
+ // Zeichen(/-folge) des Codes nCode in den Ausgabe-Buffer schreiben:
+ pE = pTable + nCode;
+ do
+ {
+ nOutBufDataLen++;
+ *(--pOutBufData) = pE->nData;
+ pE = pE->pPrev;
+ }
+ while( pE );
+
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
diff --git a/svtools/source/filter.vcl/igif/decode.hxx b/svtools/source/filter.vcl/igif/decode.hxx
new file mode 100644
index 000000000000..da5d06157533
--- /dev/null
+++ b/svtools/source/filter.vcl/igif/decode.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * $RCSfile: decode.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DECODE_HXX
+#define _DECODE_HXX
+
+#ifndef _BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+
+struct GIFLZWTableEntry;
+
+class GIFLZWDecompressor
+{
+ GIFLZWTableEntry* pTable;
+ HPBYTE pOutBuf;
+ HPBYTE pOutBufData;
+ HPBYTE pBlockBuf;
+ ULONG nInputBitsBuf;
+ USHORT nTableSize;
+ USHORT nClearCode;
+ USHORT nEOICode;
+ USHORT nCodeSize;
+ USHORT nOldCode;
+ USHORT nOutBufDataLen;
+ USHORT nInputBitsBufSize;
+ BOOL bEOIFound;
+ BYTE nDataSize;
+ BYTE nBlockBufSize;
+ BYTE nBlockBufPos;
+
+ void AddToTable(USHORT nPrevCode, USHORT nCodeFirstData);
+ BOOL ProcessOneCode();
+
+
+public:
+
+ GIFLZWDecompressor( BYTE cDataSize );
+ ~GIFLZWDecompressor();
+
+ HPBYTE DecompressBlock( HPBYTE pSrc, BYTE cBufSize, ULONG& rCount, BOOL& rEOI );
+};
+
+#endif
diff --git a/svtools/source/filter.vcl/igif/gifread.cxx b/svtools/source/filter.vcl/igif/gifread.cxx
new file mode 100644
index 000000000000..b605173656ea
--- /dev/null
+++ b/svtools/source/filter.vcl/igif/gifread.cxx
@@ -0,0 +1,890 @@
+/*************************************************************************
+ *
+ * $RCSfile: gifread.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _GIFPRIVATE
+
+#include <tools/new.hxx>
+#include "decode.hxx"
+#include "gifread.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+#define NO_PENDING( rStm ) ( ( rStm ).GetError() != ERRCODE_IO_PENDING )
+
+// -------------
+// - GIFReader -
+// -------------
+
+GIFReader::GIFReader( SvStream& rStm, void* pCallData ) :
+ rIStm ( rStm ),
+ aGPalette ( 256 ),
+ aLPalette ( 256 ),
+ pAcc8 ( NULL ),
+ pAcc1 ( NULL ),
+ nLastPos ( rStm.Tell() ),
+ eActAction ( GLOBAL_HEADER_READING ),
+ bImGraphicReady ( FALSE ),
+ nLoops ( 1 ),
+ bGCTransparent ( FALSE ),
+ nLogWidth100 ( 0UL ),
+ nLogHeight100 ( 0UL )
+{
+ maUpperName = UniString::CreateFromAscii( "SVIGIF", 6 );
+ pSrcBuf = new BYTE[ 256 ];
+ ClearImageExtensions();
+}
+
+// ------------------------------------------------------------------------
+
+GIFReader::~GIFReader()
+{
+ aImGraphic.SetContext( NULL );
+
+ if( pAcc1 )
+ aBmp1.ReleaseAccess( pAcc1 );
+
+ if( pAcc8 )
+ aBmp8.ReleaseAccess( pAcc8 );
+
+ delete[] pSrcBuf;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFReader::ClearImageExtensions()
+{
+ nGCDisposalMethod = 0;
+ bGCTransparent = FALSE;
+ nTimer = 0;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal,
+ BOOL bWatchForBackgroundColor )
+{
+ const Size aSize( nWidth, nHeight );
+
+ if( bGCTransparent )
+ {
+ const Color aWhite( COL_WHITE );
+
+ aBmp1 = Bitmap( aSize, 1 );
+
+ if( !aAnimation.Count() )
+ aBmp1.Erase( aWhite );
+
+ pAcc1 = aBmp1.AcquireWriteAccess();
+
+ if( pAcc1 )
+ {
+ cTransIndex1 = (BYTE) pAcc1->GetBestPaletteIndex( aWhite );
+ cNonTransIndex1 = cTransIndex1 ? 0 : 1;
+ }
+ else
+ bStatus = FALSE;
+ }
+
+ if( bStatus )
+ {
+ aBmp8 = Bitmap( aSize, 8, pPal );
+
+ if( !!aBmp8 && bWatchForBackgroundColor && aAnimation.Count() )
+ aBmp8.Erase( (*pPal)[ nBackgroundColor ] );
+ else
+ aBmp8.Erase( Color( COL_WHITE ) );
+
+ pAcc8 = aBmp8.AcquireWriteAccess();
+ bStatus = ( pAcc8 != NULL );
+ }
+
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFReader::ReadGlobalHeader()
+{
+ char pBuf[ 7 ];
+ BYTE nRF;
+ BYTE nAspect;
+ BOOL bRet = FALSE;
+
+ rIStm.Read( pBuf, 6 );
+ if( NO_PENDING( rIStm ) )
+ {
+ pBuf[ 6 ] = 0;
+ if( !strcmp( pBuf, "GIF87a" ) || !strcmp( pBuf, "GIF89a" ) )
+ {
+ rIStm.Read( pBuf, 7 );
+ if( NO_PENDING( rIStm ) )
+ {
+ SvMemoryStream aMemStm;
+
+ aMemStm.SetBuffer( pBuf, 7, FALSE, 7 );
+ aMemStm >> nGlobalWidth;
+ aMemStm >> nGlobalHeight;
+ aMemStm >> nRF;
+ aMemStm >> nBackgroundColor;
+ aMemStm >> nAspect;
+
+ bGlobalPalette = (BOOL) ( nRF & 0x80 );
+
+ if( bGlobalPalette )
+ ReadPaletteEntries( &aGPalette, 1 << ( ( nRF & 7 ) + 1 ) );
+ else
+ nBackgroundColor = 0;
+
+ if( NO_PENDING( rIStm ) )
+ bRet = TRUE;
+ }
+ }
+ else
+ bStatus = FALSE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount )
+{
+ const ULONG nLen = 3UL * nCount;
+ BYTE* pBuf = new BYTE[ nLen ];
+
+ rIStm.Read( pBuf, nLen );
+ if( NO_PENDING( rIStm ) )
+ {
+ BYTE* pTmp = pBuf;
+
+ for( ULONG i = 0UL; i < nCount; )
+ {
+ BitmapColor& rColor = (*pPal)[ (USHORT) i++ ];
+
+ rColor.SetRed( *pTmp++ );
+ rColor.SetGreen( *pTmp++ );
+ rColor.SetBlue( *pTmp++ );
+ }
+
+ // nach Moeglichkeit noch einige Standardfarben unterbringen
+ if( nCount < 256UL )
+ {
+ (*pPal)[ 255UL ] = Color( COL_WHITE );
+
+ if( nCount < 255UL )
+ (*pPal)[ 254UL ] = Color( COL_BLACK );
+ }
+ }
+
+ delete[] pBuf;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFReader::ReadExtension()
+{
+ BYTE cFunction;
+ BYTE cSize;
+ BYTE cByte;
+ BOOL bRet = FALSE;
+ BOOL bOverreadDataBlocks = FALSE;
+
+ // Extension-Label
+ rIStm >> cFunction;
+ if( NO_PENDING( rIStm ) )
+ {
+ // Block-Laenge
+ rIStm >> cSize;
+
+ switch( cFunction )
+ {
+ // 'Graphic Control Extension'
+ case( 0xf9 ) :
+ {
+ BYTE cFlags;
+
+ rIStm >> cFlags;
+ rIStm >> nTimer;
+ rIStm >> nGCTransparentIndex;
+ rIStm >> cByte;
+
+ if ( NO_PENDING( rIStm ) )
+ {
+ nGCDisposalMethod = ( cFlags >> 2) & 7;
+ bGCTransparent = ( cFlags & 1 ) ? TRUE : FALSE;
+ bStatus = ( cSize == 4 ) && ( cByte == 0 );
+ bRet = TRUE;
+ }
+ }
+ break;
+
+ // Application-Extension
+ case ( 0xff ) :
+ {
+ if ( NO_PENDING( rIStm ) )
+ {
+ // default diese Extension ueberlesen
+ bOverreadDataBlocks = TRUE;
+
+ // Appl.-Extension hat Laenge 11
+ if ( cSize == 0x0b )
+ {
+ ByteString aAppId;
+ ByteString aAppCode;
+
+ rIStm.Read( aAppId.AllocBuffer( 8 ), 8 );
+ rIStm.Read( aAppCode.AllocBuffer( 3 ), 3 );
+ rIStm >> cSize;
+
+ // NetScape-Extension
+ if( aAppId == "NETSCAPE" && aAppCode == "2.0" && cSize == 3 )
+ {
+ rIStm >> cByte;
+
+ // Loop-Extension
+ if ( cByte == 0x01 )
+ {
+ rIStm >> cByte;
+ nLoops = cByte;
+ rIStm >> cByte;
+ nLoops |= ( (USHORT) cByte << 8 );
+ rIStm >> cByte;
+
+ bStatus = ( cByte == 0 );
+ bRet = NO_PENDING( rIStm );
+ bOverreadDataBlocks = FALSE;
+
+ // Netscape interpretiert den LoopCount
+ // als reine Anzahl der _Wiederholungen_;
+ // bei uns ist es die Gesamtanzahl der
+ // Durchlaeufe
+ if( nLoops )
+ nLoops++;
+ }
+ else
+ rIStm.SeekRel( -1 );
+ }
+ else if ( aAppId == "STARDIV " && aAppCode == "5.0" && cSize == 9 )
+ {
+ rIStm >> cByte;
+
+ // Loop-Extension
+ if ( cByte == 0x01 )
+ {
+ rIStm >> nLogWidth100 >> nLogHeight100;
+ rIStm >> cByte;
+ bStatus = ( cByte == 0 );
+ bRet = NO_PENDING( rIStm );
+ bOverreadDataBlocks = FALSE;
+ }
+ else
+ rIStm.SeekRel( -1 );
+ }
+
+ }
+ }
+ }
+ break;
+
+ // alles andere ueberlesen
+ default:
+ bOverreadDataBlocks = TRUE;
+ break;
+ }
+
+ // Sub-Blocks ueberlesen
+ if ( bOverreadDataBlocks )
+ {
+ bRet = TRUE;
+ while( cSize && bStatus && !rIStm.IsEof() )
+ {
+ USHORT nCount = (USHORT) cSize + 1;
+ char* pBuffer = new char[ nCount ];
+
+ bRet = FALSE;
+ rIStm.Read( pBuffer, nCount );
+ if( NO_PENDING( rIStm ) )
+ {
+ cSize = (BYTE) pBuffer[ cSize ];
+ bRet = TRUE;
+ }
+ else
+ cSize = 0;
+
+ delete[] pBuffer;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFReader::ReadLocalHeader()
+{
+ BYTE pBuf[ 9 ];
+ BOOL bRet = FALSE;
+
+ rIStm.Read( pBuf, 9 );
+ if( NO_PENDING( rIStm ) )
+ {
+ SvMemoryStream aMemStm;
+ BitmapPalette* pPal;
+ BYTE nFlags;
+
+ aMemStm.SetBuffer( (char*) pBuf, 9, FALSE, 9 );
+ aMemStm >> nImagePosX;
+ aMemStm >> nImagePosY;
+ aMemStm >> nImageWidth;
+ aMemStm >> nImageHeight;
+ aMemStm >> nFlags;
+
+ // Falls Interlaced, ersten Startwert vorgeben
+ bInterlaced = ( ( nFlags & 0x40 ) == 0x40 );
+ nLastInterCount = 7;
+ nLastImageY = 0;
+
+ if( nFlags & 0x80 )
+ {
+ pPal = &aLPalette;
+ ReadPaletteEntries( pPal, 1 << ( (nFlags & 7 ) + 1 ) );
+ }
+ else
+ pPal = &aGPalette;
+
+ // Falls alles soweit eingelesen werden konnte, kann
+ // nun das lokale Bild angelegt werden;
+ // es wird uebergeben, ob der BackgroundColorIndex evtl.
+ // beruecksichtigt werden soll ( wenn Globale Farbtab. und
+ // diese auch fuer dieses Bild gilt )
+ if( NO_PENDING( rIStm ) )
+ {
+ CreateBitmaps( nImageWidth, nImageHeight, pPal, bGlobalPalette && ( pPal == &aGPalette ) );
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GIFReader::ReadNextBlock()
+{
+ ULONG nRet = 0UL;
+ ULONG nRead;
+ BYTE cBlockSize;
+
+ rIStm >> cBlockSize;
+
+ if ( rIStm.IsEof() )
+ nRet = 4UL;
+ else if ( NO_PENDING( rIStm ) )
+ {
+ if ( cBlockSize == 0 )
+ nRet = 2UL;
+ else
+ {
+ rIStm.Read( pSrcBuf, cBlockSize );
+
+ if( NO_PENDING( rIStm ) )
+ {
+ if( bOverreadBlock )
+ nRet = 3UL;
+ else
+ {
+ BOOL bEOI;
+ HPBYTE pTarget = pDecomp->DecompressBlock( pSrcBuf, cBlockSize, nRead, bEOI );
+
+ nRet = ( bEOI ? 3 : 1 );
+
+ if( nRead && !bOverreadBlock )
+ FillImages( pTarget, nRead );
+
+ SvMemFree( pTarget );
+ }
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GIFReader::FillImages( HPBYTE pBytes, ULONG nCount )
+{
+ for( ULONG i = 0UL; i < nCount; i++ )
+ {
+ if( nImageX >= nImageWidth )
+ {
+ if( bInterlaced )
+ {
+ long nT1, nT2;
+
+ // falls Interlaced, werden die Zeilen kopiert
+ if( nLastInterCount )
+ {
+ long nMinY = Min( (long) nLastImageY + 1, (long) nImageHeight - 1 );
+ long nMaxY = Min( (long) nLastImageY + nLastInterCount, (long) nImageHeight - 1 );
+
+ // letzte gelesene Zeile kopieren, wenn Zeilen
+ // nicht zusanmmenfallen ( kommt vorm wenn wir am Ende des Bildes sind )
+ if( ( nMinY > nLastImageY ) && ( nLastImageY < ( nImageHeight - 1 ) ) )
+ {
+ HPBYTE pScanline8 = pAcc8->GetScanline( nYAcc );
+ ULONG nSize8 = pAcc8->GetScanlineSize();
+ HPBYTE pScanline1;
+ ULONG nSize1;
+
+ if( bGCTransparent )
+ {
+ pScanline1 = pAcc1->GetScanline( nYAcc );
+ nSize1 = pAcc1->GetScanlineSize();
+ }
+
+ for( long j = nMinY; j <= nMaxY; j++ )
+ {
+ HMEMCPY( pAcc8->GetScanline( j ), pScanline8, nSize8 );
+
+ if( bGCTransparent )
+ HMEMCPY( pAcc1->GetScanline( j ), pScanline1, nSize1 );
+ }
+ }
+ }
+
+ nT1 = ( ++nImageY ) << 3;
+ nLastInterCount = 7;
+
+ if( nT1 >= nImageHeight )
+ {
+ nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 );
+ nT1 = ( nT2 << 3 ) + 4;
+ nLastInterCount = 3;
+
+ if( nT1 >= nImageHeight )
+ {
+ nT2 -= ( nImageHeight + 3 ) >> 3;
+ nT1 = ( nT2 << 2 ) + 2;
+ nLastInterCount = 1;
+
+ if( nT1 >= nImageHeight )
+ {
+ nT2 -= ( nImageHeight + 1 ) >> 2;
+ nT1 = ( nT2 << 1 ) + 1;
+ nLastInterCount = 0;
+ }
+ }
+ }
+
+ nLastImageY = (USHORT) nT1;
+ nYAcc = nT1;
+ }
+ else
+ {
+ nLastImageY = ++nImageY;
+ nYAcc = nImageY;
+ }
+
+ // Zeile faengt von vorne an
+ nImageX = 0;
+ }
+
+ if( nImageY < nImageHeight )
+ {
+ const BYTE cTmp = pBytes[ i ];
+
+ if( bGCTransparent )
+ {
+ if( cTmp == nGCTransparentIndex )
+ pAcc1->SetPixel( nYAcc, nImageX++, cTransIndex1 );
+ else
+ {
+ pAcc8->SetPixel( nYAcc, nImageX, cTmp );
+ pAcc1->SetPixel( nYAcc, nImageX++, cNonTransIndex1 );
+ }
+ }
+ else
+ pAcc8->SetPixel( nYAcc, nImageX++, cTmp );
+ }
+ else
+ {
+ bOverreadBlock = TRUE;
+ break;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GIFReader::CreateNewBitmaps()
+{
+ AnimationBitmap aAnimBmp;
+
+ aBmp8.ReleaseAccess( pAcc8 );
+ pAcc8 = NULL;
+
+ if( bGCTransparent )
+ {
+ aBmp1.ReleaseAccess( pAcc1 );
+ pAcc1 = NULL;
+ aAnimBmp.aBmpEx = BitmapEx( aBmp8, aBmp1 );
+ }
+ else
+ aAnimBmp.aBmpEx = BitmapEx( aBmp8 );
+
+ aAnimBmp.aPosPix = Point( nImagePosX, nImagePosY );
+ aAnimBmp.aSizePix = Size( nImageWidth, nImageHeight );
+ aAnimBmp.nWait = ( nTimer != 65535 ) ? nTimer : ANIMATION_TIMEOUT_ON_CLICK;
+ aAnimBmp.bUserInput = FALSE;
+
+ if( nGCDisposalMethod == 2 )
+ aAnimBmp.eDisposal = DISPOSE_BACK;
+ else if( nGCDisposalMethod == 3 )
+ aAnimBmp.eDisposal = DISPOSE_PREVIOUS;
+ else
+ aAnimBmp.eDisposal = DISPOSE_NOT;
+
+ aAnimation.Insert( aAnimBmp );
+
+ if( aAnimation.Count() == 1 )
+ {
+ aAnimation.SetDisplaySizePixel( Size( nGlobalWidth, nGlobalHeight ) );
+ aAnimation.SetLoopCount( nLoops );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+const Graphic& GIFReader::GetIntermediateGraphic()
+{
+ // Intermediate-Graphic nur erzeugen, wenn schon
+ // Daten vorliegen, aber die Graphic noch nicht
+ // vollstaendig eingelesen wurde
+ if ( bImGraphicReady && !aAnimation.Count() )
+ {
+ Bitmap aBmp;
+
+ aBmp8.ReleaseAccess( pAcc8 );
+
+ if ( bGCTransparent )
+ {
+ aBmp1.ReleaseAccess( pAcc1 );
+ aImGraphic = BitmapEx( aBmp8, aBmp1 );
+
+ pAcc1 = aBmp1.AcquireWriteAccess();
+ bStatus = bStatus && ( pAcc1 != NULL );
+ }
+ else
+ aImGraphic = aBmp8;
+
+ pAcc8 = aBmp8.AcquireWriteAccess();
+ bStatus = bStatus && ( pAcc8 != NULL );
+ }
+
+ return aImGraphic;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GIFReader::ProcessGIF()
+{
+ BOOL bRead = FALSE;
+ BOOL bEnd = FALSE;
+
+ if ( !bStatus )
+ eActAction = ABORT_READING;
+
+ // Stream an die richtige Stelle bringen
+ rIStm.Seek( nLastPos );
+
+ switch( eActAction )
+ {
+ // naechsten Marker lesen
+ case( MARKER_READING ):
+ {
+ BYTE cByte;
+
+ rIStm >> cByte;
+
+ if( rIStm.IsEof() )
+ eActAction = END_READING;
+ else if( NO_PENDING( rIStm ) )
+ {
+ bRead = TRUE;
+
+ if( cByte == '!' )
+ eActAction = EXTENSION_READING;
+ else if( cByte == ',' )
+ eActAction = LOCAL_HEADER_READING;
+ else if( cByte == ';' )
+ eActAction = END_READING;
+ else
+ eActAction = ABORT_READING;
+ }
+ }
+ break;
+
+ // ScreenDescriptor lesen
+ case( GLOBAL_HEADER_READING ):
+ {
+ if( ( bRead = ReadGlobalHeader() ) == TRUE )
+ {
+ ClearImageExtensions();
+ eActAction = MARKER_READING;
+ }
+ }
+ break;
+
+
+ // Extension lesen
+ case( EXTENSION_READING ):
+ {
+ if( ( bRead = ReadExtension() ) == TRUE )
+ eActAction = MARKER_READING;
+ }
+ break;
+
+
+ // Image-Descriptor lesen
+ case( LOCAL_HEADER_READING ):
+ {
+ if( ( bRead = ReadLocalHeader() ) == TRUE )
+ {
+ nYAcc = nImageX = nImageY = 0;
+ eActAction = FIRST_BLOCK_READING;
+ }
+ }
+ break;
+
+
+ // ersten Datenblock lesen
+ case( FIRST_BLOCK_READING ):
+ {
+ BYTE cDataSize;
+
+ rIStm >> cDataSize;
+
+ if( rIStm.IsEof() )
+ eActAction = ABORT_READING;
+ else if( cDataSize > 12 )
+ bStatus = FALSE;
+ else if( NO_PENDING( rIStm ) )
+ {
+ bRead = TRUE;
+ pDecomp = new GIFLZWDecompressor( cDataSize );
+ eActAction = NEXT_BLOCK_READING;
+ bOverreadBlock = FALSE;
+ }
+ else
+ eActAction = FIRST_BLOCK_READING;
+ }
+ break;
+
+ // naechsten Datenblock lesen
+ case( NEXT_BLOCK_READING ):
+ {
+ USHORT nLastImageX = nImageX;
+ USHORT nLastImageY = nImageY;
+ ULONG nRet = ReadNextBlock();
+
+ // Return: 0:Pending / 1:OK; / 2:OK und letzter Block: / 3:EOI / 4:HardAbort
+ if( nRet )
+ {
+ bRead = TRUE;
+
+ if ( nRet == 1UL )
+ {
+ bImGraphicReady = TRUE;
+ eActAction = NEXT_BLOCK_READING;
+ bOverreadBlock = FALSE;
+ }
+ else
+ {
+ if( nRet == 2UL )
+ {
+ delete pDecomp;
+ CreateNewBitmaps();
+ eActAction = MARKER_READING;
+ ClearImageExtensions();
+ }
+ else if( nRet == 3UL )
+ {
+ eActAction = NEXT_BLOCK_READING;
+ bOverreadBlock = TRUE;
+ }
+ else
+ {
+ delete pDecomp;
+ CreateNewBitmaps();
+ eActAction = ABORT_READING;
+ ClearImageExtensions();
+ }
+ }
+ }
+ else
+ {
+ nImageX = nLastImageX;
+ nImageY = nLastImageY;
+ }
+ }
+ break;
+
+ // ein Fehler trat auf
+ case( ABORT_READING ):
+ {
+ bEnd = TRUE;
+ eActAction = END_READING;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ // Stream an die richtige Stelle bringen,
+ // falls Daten gelesen werden konnten
+ // entweder alte Position oder aktuelle Position
+ if( bRead || bEnd )
+ nLastPos = rIStm.Tell();
+
+ return bRead;
+}
+
+// ------------------------------------------------------------------------
+
+ReadState GIFReader::ReadGIF( Graphic& rGraphic )
+{
+ ReadState eReadState;
+
+ bStatus = TRUE;
+
+ while( ProcessGIF() && ( eActAction != END_READING ) ) {}
+
+ if( !bStatus )
+ eReadState = GIFREAD_ERROR;
+ else if( eActAction == END_READING )
+ eReadState = GIFREAD_OK;
+ else
+ {
+ if ( rIStm.GetError() == ERRCODE_IO_PENDING )
+ rIStm.ResetError();
+
+ eReadState = GIFREAD_NEED_MORE;
+ }
+
+ if( aAnimation.Count() == 1 )
+ {
+ rGraphic = aAnimation.Get( 0 ).aBmpEx;
+
+ if( nLogWidth100 && nLogHeight100 )
+ {
+ rGraphic.SetPrefSize( Size( nLogWidth100, nLogHeight100 ) );
+ rGraphic.SetPrefMapMode( MAP_100TH_MM );
+ }
+ }
+ else
+ rGraphic = aAnimation;
+
+ return eReadState;
+}
+
+
+// -------------
+// - ImportGIF -
+// -------------
+
+BOOL ImportGIF( SvStream & rStm, Graphic& rGraphic, void* pCallerData )
+{
+ GIFReader* pGIFReader = (GIFReader*) rGraphic.GetContext();
+ USHORT nOldFormat = rStm.GetNumberFormatInt();
+ ReadState eReadState;
+ BOOL bRet = TRUE;
+
+ rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ if( !pGIFReader )
+ pGIFReader = new GIFReader( rStm, pCallerData );
+
+ rGraphic.SetContext( NULL );
+ eReadState = pGIFReader->ReadGIF( rGraphic );
+
+ if( eReadState == GIFREAD_ERROR )
+ {
+ bRet = FALSE;
+ delete pGIFReader;
+ }
+ else if( eReadState == GIFREAD_OK )
+ delete pGIFReader;
+ else
+ {
+ rGraphic = pGIFReader->GetIntermediateGraphic();
+ rGraphic.SetContext( pGIFReader );
+ }
+
+ rStm.SetNumberFormatInt( nOldFormat );
+
+ return bRet;
+}
diff --git a/svtools/source/filter.vcl/igif/makefile.mk b/svtools/source/filter.vcl/igif/makefile.mk
new file mode 100644
index 000000000000..39cd875fd527
--- /dev/null
+++ b/svtools/source/filter.vcl/igif/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=VCL
+TARGET=igif
+DEPTARGET=vigif
+
+
+# --- Settings -----------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# --- Files --------------------------------------------------------
+
+
+CXXFILES= gifread.cxx \
+ decode.cxx
+
+SLOFILES= $(SLO)$/gifread.obj \
+ $(SLO)$/decode.obj
+
+
+.INCLUDE : target.mk
+
+.ELSE
+
+dummy:
+ @+echo VCL not set. nothing to do!
+
+.ENDIF #VCL
diff --git a/svtools/source/filter.vcl/ixbm/makefile.mk b/svtools/source/filter.vcl/ixbm/makefile.mk
new file mode 100644
index 000000000000..6d3c4bf1bfec
--- /dev/null
+++ b/svtools/source/filter.vcl/ixbm/makefile.mk
@@ -0,0 +1,95 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=VCL
+TARGET=ixbm
+DEPTARGET=vixbm
+VERSION=$(UPD)
+
+
+# --- Settings -----------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# --- Files --------------------------------------------------------
+
+
+CXXFILES= xbmread.cxx
+
+SLOFILES= $(SLO)$/xbmread.obj
+
+
+.INCLUDE : target.mk
+
+.ELSE
+
+dummy:
+ @+echo VCL not set. nothing to do!
+
+.ENDIF #VCL
diff --git a/svtools/source/filter.vcl/ixbm/xbmread.cxx b/svtools/source/filter.vcl/ixbm/xbmread.cxx
new file mode 100644
index 000000000000..4ede60dfa508
--- /dev/null
+++ b/svtools/source/filter.vcl/ixbm/xbmread.cxx
@@ -0,0 +1,429 @@
+/*************************************************************************
+ *
+ * $RCSfile: xbmread.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define XBMMINREAD 512
+
+#define _XBMPRIVATE
+#include <ctype.h>
+#include "xbmread.hxx"
+
+// -------------
+// - XBMReader -
+// -------------
+
+XBMReader::XBMReader( SvStream& rStm, void* pCallData ) :
+ rIStm ( rStm ),
+ nWidth ( 0 ),
+ nHeight ( 0 ),
+ nLastPos ( rStm.Tell() ),
+ pAcc1 ( NULL ),
+ bStatus ( TRUE )
+{
+ pHexTable = new short[ 256 ];
+ maUpperName = String::CreateFromAscii( "SVIXBM", 6 );
+ InitTable();
+}
+
+// ------------------------------------------------------------------------
+
+XBMReader::~XBMReader()
+{
+ delete[] pHexTable;
+
+ if( pAcc1 )
+ aBmp1.ReleaseAccess( pAcc1 );
+}
+
+// ------------------------------------------------------------------------
+
+void XBMReader::InitTable()
+{
+ memset( pHexTable, 0, sizeof( short ) );
+
+ pHexTable['0'] = 0;
+ pHexTable['1'] = 1;
+ pHexTable['2'] = 2;
+ pHexTable['3'] = 3;
+ pHexTable['4'] = 4;
+ pHexTable['5'] = 5;
+ pHexTable['6'] = 6;
+ pHexTable['7'] = 7;
+ pHexTable['8'] = 8;
+ pHexTable['9'] = 9;
+ pHexTable['A'] = 10;
+ pHexTable['B'] = 11;
+ pHexTable['C'] = 12;
+ pHexTable['D'] = 13;
+ pHexTable['E'] = 14;
+ pHexTable['F'] = 15;
+ pHexTable['X'] = 0;
+ pHexTable['a'] = 10;
+ pHexTable['b'] = 11;
+ pHexTable['c'] = 12;
+ pHexTable['d'] = 13;
+ pHexTable['e'] = 14;
+ pHexTable['f'] = 15;
+ pHexTable['x'] = 0;
+ pHexTable[' '] = -1;
+ pHexTable[','] = -1;
+ pHexTable['}'] = -1;
+ pHexTable['\n'] = -1;
+ pHexTable['\t'] = -1;
+ pHexTable['\0'] = -1;
+}
+
+// ------------------------------------------------------------------------
+
+ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
+ const char* pTok2, const char* pTok3 )
+{
+ ByteString aRet;
+ long nPos1;
+ long nPos2;
+ long nPos3;
+
+ bStatus = FALSE;
+
+ do
+ {
+ if( !pInStm->ReadLine( aRet ) )
+ break;
+
+ if( pTok1 )
+ {
+ if( ( nPos1 = aRet.Search( pTok1 ) ) != STRING_NOTFOUND )
+ {
+ bStatus = TRUE;
+
+ if( pTok2 )
+ {
+ bStatus = FALSE;
+
+ if( ( ( nPos2 = aRet.Search( pTok2 ) ) != STRING_NOTFOUND ) &&
+ ( nPos2 > nPos1 ) )
+ {
+ bStatus = TRUE;
+
+ if( pTok3 )
+ {
+ bStatus = FALSE;
+
+ if( ( ( nPos3 = aRet.Search( pTok3 ) ) != STRING_NOTFOUND ) && ( nPos3 > nPos2 ) )
+ bStatus = TRUE;
+ }
+ }
+ }
+ }
+ }
+ }
+ while( !bStatus );
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------
+
+long XBMReader::ParseDefine( const sal_Char* pDefine )
+{
+ long nRet = 0;
+ char* pTmp = (char*) pDefine;
+ char cTmp;
+
+ // bis zum Ende gehen
+ pTmp += ( strlen( pDefine ) - 1 );
+ cTmp = *pTmp--;
+
+ // letzte Ziffer suchen
+ while( pHexTable[ cTmp ] == -1 )
+ cTmp = *pTmp--;
+
+ // bis vor die Zahl laufen
+ while( pHexTable[ cTmp ] != -1 )
+ cTmp = *pTmp--;
+
+ // auf Anfang der Zahl gehen
+ pTmp += 2;
+
+ // Hex lesen
+ if( ( pTmp[0] == '0' ) && ( ( pTmp[1] == 'X' ) || ( pTmp[1] == 'x' ) ) )
+ {
+ pTmp += 2;
+ cTmp = *pTmp++;
+
+ while ( pHexTable[ cTmp ] != -1 )
+ {
+ nRet = ( nRet << 4 ) + pHexTable[ cTmp ];
+ cTmp = *pTmp++;
+ }
+ }
+ // Dezimal lesen
+ else
+ {
+ cTmp = *pTmp++;
+ while( ( cTmp >= '0' ) && ( cTmp <= '9' ) )
+ {
+ nRet = nRet * 10 + ( cTmp - '0' );
+ cTmp = *pTmp++;
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat )
+{
+ ByteString aLine;
+ long nRow = 0;
+ long nCol = 0;
+ long nBits = ( eFormat == XBM10 ) ? 16 : 8;
+ long nBit;
+ USHORT nValue;
+ USHORT nDigits;
+ BOOL bFirstLine = TRUE;
+
+ while( nRow < nHeight )
+ {
+ if( bFirstLine )
+ {
+ long nPos;
+
+ // einfuehrende geschweifte Klammer loeschen
+ if( (nPos = ( aLine = aLastLine ).Search( '{' ) ) != STRING_NOTFOUND )
+ aLine.Erase( 0, nPos + 1 );
+
+ bFirstLine = FALSE;
+ }
+ else if( !pInStm->ReadLine( aLine ) )
+ break;
+
+ if( aLine.Len() )
+ {
+ const USHORT nCount = aLine.GetTokenCount( ',' );
+
+ for( USHORT i = 0; ( i < nCount ) && ( nRow < nHeight ); i++ )
+ {
+ const ByteString aToken( aLine.GetToken( i, ',' ) );
+ const ULONG nLen = aToken.Len();
+ BOOL bProcessed = FALSE;
+
+ nBit = nDigits = nValue = 0;
+
+ for( ULONG n = 0UL; n < nLen; n++ )
+ {
+ const unsigned char cChar = aToken.GetChar( n );
+ const short nTable = pHexTable[ cChar ];
+
+ if( isxdigit( cChar ) || !nTable )
+ {
+ nValue = ( nValue << 4 ) + nTable;
+ nDigits++;
+ bProcessed = TRUE;
+ }
+ else if( ( nTable < 0 ) && nDigits )
+ {
+ bProcessed = TRUE;
+ break;
+ }
+ }
+
+ if( bProcessed )
+ {
+ while( ( nCol < nWidth ) && ( nBit < nBits ) )
+ pAcc1->SetPixel( nRow, nCol++, ( nValue & ( 1 << nBit++ ) ) ? aBlack : aWhite );
+
+ if( nCol == nWidth )
+ nCol = 0, nRow++;
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+ReadState XBMReader::ReadXBM( Graphic& rGraphic )
+{
+ ReadState eReadState;
+ BYTE cDummy;
+
+ // sehen, ob wir _alles_ lesen koennen
+ rIStm.Seek( STREAM_SEEK_TO_END );
+ rIStm >> cDummy;
+
+ // falls wir nicht alles lesen koennen
+ // kehren wir zurueck und warten auf neue Daten
+ if ( rIStm.GetError() != ERRCODE_IO_PENDING )
+ {
+ ByteString aLine;
+ int nValue;
+
+ rIStm.Seek( nLastPos );
+ bStatus = FALSE;
+ aLine = FindTokenLine( &rIStm, "#define", "_width" );
+
+ if ( bStatus )
+ {
+ if ( ( nValue = (int) ParseDefine( aLine.GetBuffer() ) ) > 0 )
+ {
+ nWidth = nValue;
+ aLine = FindTokenLine( &rIStm, "#define", "_height" );
+
+ // Falls die Hoehe nicht folgt, suchen wir noch
+ // einmal vom Anfang der Datei an
+ if ( !bStatus )
+ {
+ rIStm.Seek( nLastPos );
+ aLine = FindTokenLine( &rIStm, "#define", "_height" );
+ }
+ }
+ else
+ bStatus = FALSE;
+
+ if ( bStatus )
+ {
+ if ( ( nValue = (int) ParseDefine( aLine.GetBuffer() ) ) > 0 )
+ {
+ nHeight = nValue;
+ aLine = FindTokenLine( &rIStm, "static", "_bits" );
+
+ if ( bStatus )
+ {
+ XBMFormat eFormat;
+
+ if ( aLine.Search( "short" ) != STRING_NOTFOUND )
+ eFormat = XBM10;
+ else if ( aLine.Search( "char" ) != STRING_NOTFOUND )
+ eFormat = XBM11;
+ else
+ bStatus = FALSE;
+
+ if ( bStatus && nWidth && nHeight )
+ {
+ aBmp1 = Bitmap( Size( nWidth, nHeight ), 1 );
+ pAcc1 = aBmp1.AcquireWriteAccess();
+
+ if( pAcc1 )
+ {
+ aWhite = pAcc1->GetBestMatchingColor( Color( COL_WHITE ) );
+ aBlack = pAcc1->GetBestMatchingColor( Color( COL_BLACK ) );
+ bStatus = ParseData( &rIStm, aLine, eFormat );
+ }
+ else
+ bStatus = FALSE;
+ }
+ }
+ }
+ }
+ }
+
+ if( bStatus )
+ {
+ Bitmap aBlackBmp( Size( pAcc1->Width(), pAcc1->Height() ), 1 );
+
+ aBmp1.ReleaseAccess( pAcc1 ), pAcc1 = NULL;
+ aBlackBmp.Erase( Color( COL_BLACK ) );
+ rGraphic = BitmapEx( aBlackBmp, aBmp1 );
+ eReadState = XBMREAD_OK;
+ }
+ else
+ eReadState = XBMREAD_ERROR;
+ }
+ else
+ {
+ rIStm.ResetError();
+ eReadState = XBMREAD_NEED_MORE;
+ }
+
+ return eReadState;
+}
+
+// -------------
+// - ImportXBM -
+// -------------
+
+BOOL ImportXBM( SvStream& rStm, Graphic& rGraphic, void* pCallerData )
+{
+ XBMReader* pXBMReader = (XBMReader*) rGraphic.GetContext();
+ ReadState eReadState;
+ BOOL bRet = TRUE;
+
+ if( !pXBMReader )
+ pXBMReader = new XBMReader( rStm, pCallerData );
+
+ rGraphic.SetContext( NULL );
+ eReadState = pXBMReader->ReadXBM( rGraphic );
+
+ if( eReadState == XBMREAD_ERROR )
+ {
+ bRet = FALSE;
+ delete pXBMReader;
+ }
+ else if( eReadState == XBMREAD_OK )
+ delete pXBMReader;
+ else
+ rGraphic.SetContext( pXBMReader );
+
+ return bRet;
+}
diff --git a/svtools/source/filter.vcl/ixpm/makefile.mk b/svtools/source/filter.vcl/ixpm/makefile.mk
new file mode 100644
index 000000000000..7c4ed303c09b
--- /dev/null
+++ b/svtools/source/filter.vcl/ixpm/makefile.mk
@@ -0,0 +1,95 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:58:59 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=VCL
+TARGET=ixpm
+DEPTARGET=vixpm
+VERSION=$(UPD)
+
+
+# --- Settings -----------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# --- Files --------------------------------------------------------
+
+
+CXXFILES= xpmread.cxx
+
+SLOFILES= $(SLO)$/xpmread.obj
+
+
+.INCLUDE : target.mk
+
+.ELSE
+
+dummy:
+ @+echo VCL not set. nothing to do!
+
+.ENDIF #VCL
diff --git a/svtools/source/filter.vcl/ixpm/rgbtable.hxx b/svtools/source/filter.vcl/ixpm/rgbtable.hxx
new file mode 100644
index 000000000000..d7425faa8068
--- /dev/null
+++ b/svtools/source/filter.vcl/ixpm/rgbtable.hxx
@@ -0,0 +1,729 @@
+/*************************************************************************
+ *
+ * $RCSfile: rgbtable.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+struct XPMRGBTab
+{
+ char* name;
+ BYTE red;
+ BYTE green;
+ BYTE blue;
+};
+
+static XPMRGBTab pRGBTable[] = {
+{ "white", 255, 255, 255 },
+{ "black", 0, 0, 0 },
+{ "snow", 255, 250, 250 },
+{ "GhostWhite", 248, 248, 255 },
+{ "WhiteSmoke", 245, 245, 245 },
+{ "gainsboro", 220, 220, 220 },
+{ "FloralWhite", 255, 250, 240 },
+{ "OldLace", 253, 245, 230 },
+{ "linen", 250, 240, 230 },
+{ "AntiqueWhite", 250, 235, 215 },
+{ "PapayaWhip", 255, 239, 213 },
+{ "BlanchedAlmond", 255, 235, 205 },
+{ "bisque", 255, 228, 196 },
+{ "PeachPuff", 255, 218, 185 },
+{ "NavajoWhite", 255, 222, 173 },
+{ "moccasin", 255, 228, 181 },
+{ "cornsilk", 255, 248, 220 },
+{ "ivory", 255, 255, 240 },
+{ "LemonChiffon", 255, 250, 205 },
+{ "seashell", 255, 245, 238 },
+{ "honeydew", 240, 255, 240 },
+{ "MintCream", 245, 255, 250 },
+{ "azure", 240, 255, 255 },
+{ "AliceBlue", 240, 248, 255 },
+{ "lavender", 230, 230, 250 },
+{ "LavenderBlush", 255, 240, 245 },
+{ "MistyRose", 255, 228, 225 },
+{ "DarkSlateGray", 47, 79, 79 },
+{ "DarkSlateGrey", 47, 79, 79 },
+{ "DimGray", 105, 105, 105 },
+{ "DimGrey", 105, 105, 105 },
+{ "SlateGray", 112, 128, 144 },
+{ "SlateGrey", 112, 128, 144 },
+{ "LightSlateGray", 119, 136, 153 },
+{ "LightSlateGrey", 119, 136, 153 },
+{ "gray", 190, 190, 190 },
+{ "grey", 190, 190, 190 },
+{ "LightGrey", 211, 211, 211 },
+{ "LightGray", 211, 211, 211 },
+{ "MidnightBlue", 25, 25, 112 },
+{ "navy", 0, 0, 128 },
+{ "NavyBlue", 0, 0, 128 },
+{ "CornflowerBlue", 100, 149, 237 },
+{ "DarkSlateBlue", 72, 61, 139 },
+{ "SlateBlue", 106, 90, 205 },
+{ "MediumSlateBlue", 123, 104, 238 },
+{ "LightSlateBlue", 132, 112, 255 },
+{ "MediumBlue", 0, 0, 205 },
+{ "RoyalBlue", 65, 105, 225 },
+{ "blue", 0, 0, 255 },
+{ "DodgerBlue", 30, 144, 255 },
+{ "DeepSkyBlue", 0, 191, 255 },
+{ "SkyBlue", 135, 206, 235 },
+{ "LightSkyBlue", 135, 206, 250 },
+{ "SteelBlue", 70, 130, 180 },
+{ "LightSteelBlue", 176, 196, 222 },
+{ "LightBlue", 173, 216, 230 },
+{ "PowderBlue", 176, 224, 230 },
+{ "PaleTurquoise", 175, 238, 238 },
+{ "DarkTurquoise", 0, 206, 209 },
+{ "MediumTurquoise", 72, 209, 204 },
+{ "turquoise", 64, 224, 208 },
+{ "cyan", 0, 255, 255 },
+{ "LightCyan", 224, 255, 255 },
+{ "CadetBlue", 95, 158, 160 },
+{ "MediumAquamarine", 102, 205, 170 },
+{ "aquamarine", 127, 255, 212 },
+{ "DarkGreen", 0, 100, 0 },
+{ "DarkOliveGreen", 85, 107, 47 },
+{ "DarkSeaGreen", 143, 188, 143 },
+{ "SeaGreen", 46, 139, 87 },
+{ "MediumSeaGreen", 60, 179, 113 },
+{ "LightSeaGreen", 32, 178, 170 },
+{ "PaleGreen", 152, 251, 152 },
+{ "SpringGreen", 0, 255, 127 },
+{ "LawnGreen", 124, 252, 0 },
+{ "green", 0, 255, 0 },
+{ "chartreuse", 127, 255, 0 },
+{ "MediumSpringGreen", 0, 250, 154 },
+{ "GreenYellow", 173, 255 , 47 },
+{ "LimeGreen", 50, 205, 50 },
+{ "YellowGreen", 154, 205, 50 },
+{ "ForestGreen", 34, 139, 34 },
+{ "OliveDrab", 107, 142, 35 },
+{ "DarkKhaki", 189, 183, 107 },
+{ "khaki", 240, 230, 140 },
+{ "PaleGoldenrod", 238, 232, 170 },
+{ "LightGoldenrodYellow", 250, 250, 210 },
+{ "LightYellow", 255, 255, 224 },
+{ "yellow", 255, 255, 0 },
+{ "gold", 255, 215, 0 },
+{ "LightGoldenrod", 238, 221, 130 },
+{ "goldenrod", 218, 165, 32 },
+{ "DarkGoldenrod", 184, 134, 11 },
+{ "RosyBrown", 188, 143, 143 },
+{ "IndianRed", 205, 92, 92 },
+{ "SaddleBrown", 139, 69, 19 },
+{ "sienna", 160, 82, 45 },
+{ "peru", 205, 133, 63 },
+{ "burlywood", 222, 184, 135 },
+{ "beige", 245, 245, 220 },
+{ "wheat", 245, 222, 179 },
+{ "SandyBrown", 244, 164, 96 },
+{ "tan", 210, 180, 140 },
+{ "chocolate", 210, 105, 30 },
+{ "firebrick", 178, 34, 34 },
+{ "brown", 165, 42, 42 },
+{ "DarkSalmon", 233, 150, 122 },
+{ "salmon", 250, 128, 114 },
+{ "LightSalmon", 255, 160, 122 },
+{ "orange", 255, 165, 0 },
+{ "DarkOrange", 255, 140, 0 },
+{ "coral", 255, 127, 80 },
+{ "LightCoral", 240, 128, 128 },
+{ "tomato", 255, 99, 71 },
+{ "OrangeRed", 255, 69, 0 },
+{ "red", 255, 0, 0 },
+{ "HotPink", 255, 105, 180 },
+{ "DeepPink", 255, 20, 147 },
+{ "pink", 255, 192, 203 },
+{ "LightPink", 255, 182, 193 },
+{ "PaleVioletRed", 219, 112, 147 },
+{ "maroon", 176, 48, 96 },
+{ "MediumVioletRed", 199, 21, 133 },
+{ "VioletRed", 208, 32, 144 },
+{ "magenta", 255, 0, 255 },
+{ "violet", 238, 130, 238 },
+{ "plum", 221, 160, 221 },
+{ "orchid", 218, 112, 214 },
+{ "MediumOrchid", 186, 85, 211 },
+{ "DarkOrchid", 153, 50, 204 },
+{ "DarkViolet", 148, 0, 211 },
+{ "BlueViolet", 138, 43, 226 },
+{ "purple", 160, 32, 240 },
+{ "MediumPurple", 147, 112, 219 },
+{ "thistle", 216, 191, 216 },
+{ "snow1", 255, 250, 250 },
+{ "snow2", 238, 233, 233 },
+{ "snow3", 205, 201, 201 },
+{ "snow4", 139, 137, 137 },
+{ "seashell1", 255, 245, 238 },
+{ "seashell2", 238, 229, 222 },
+{ "seashell3", 205, 197, 191 },
+{ "seashell4", 139, 134, 130 },
+{ "AntiqueWhite1", 255, 239, 219 },
+{ "AntiqueWhite2", 238, 223, 204 },
+{ "AntiqueWhite3", 205, 192, 176 },
+{ "AntiqueWhite4", 139, 131, 120 },
+{ "bisque1", 255, 228, 196 },
+{ "bisque2", 238, 213, 183 },
+{ "bisque3", 205, 183, 158 },
+{ "bisque4", 139, 125, 107 },
+{ "PeachPuff1", 255, 218, 185 },
+{ "PeachPuff2", 238, 203, 173 },
+{ "PeachPuff3", 205, 175, 149 },
+{ "PeachPuff4", 139, 119, 101 },
+{ "NavajoWhite1", 255, 222, 173 },
+{ "NavajoWhite2", 238, 207, 161 },
+{ "NavajoWhite3", 205, 179, 139 },
+{ "NavajoWhite4", 139, 121, 94 },
+{ "LemonChiffon1", 255, 250, 205 },
+{ "LemonChiffon2", 238, 233, 191 },
+{ "LemonChiffon3", 205, 201, 165 },
+{ "LemonChiffon4", 139, 137, 112 },
+{ "cornsilk1", 255, 248, 220 },
+{ "cornsilk2", 238, 232, 205 },
+{ "cornsilk3", 205, 200, 177 },
+{ "cornsilk4", 139, 136, 120 },
+{ "ivory1", 255, 255, 240 },
+{ "ivory2", 238, 238, 224 },
+{ "ivory3", 205, 205, 193 },
+{ "ivory4", 139, 139, 131 },
+{ "honeydew1", 240, 255, 240 },
+{ "honeydew2", 224, 238, 224 },
+{ "honeydew3", 193, 205, 193 },
+{ "honeydew4", 131, 139, 131 },
+{ "LavenderBlush1", 255, 240, 245 },
+{ "LavenderBlush2", 238, 224, 229 },
+{ "LavenderBlush3", 205, 193, 197 },
+{ "LavenderBlush4", 139, 131, 134 },
+{ "MistyRose1", 255, 228, 225 },
+{ "MistyRose2", 238, 213, 210 },
+{ "MistyRose3", 205, 183, 181 },
+{ "MistyRose4", 139, 125, 123 },
+{ "azure1", 240, 255, 255 },
+{ "azure2", 224, 238, 238 },
+{ "azure3", 193, 205, 205 },
+{ "azure4", 131, 139, 139 },
+{ "SlateBlue1", 131, 111, 255 },
+{ "SlateBlue2", 122, 103, 238 },
+{ "SlateBlue3", 105, 89, 205 },
+{ "SlateBlue4", 71, 60, 139 },
+{ "RoyalBlue1", 72, 118, 255 },
+{ "RoyalBlue2", 67, 110, 238 },
+{ "RoyalBlue3", 58, 95, 205 },
+{ "RoyalBlue4", 39, 64, 139 },
+{ "blue1", 0, 0, 255 },
+{ "blue2", 0, 0, 238 },
+{ "blue3", 0, 0, 205 },
+{ "blue4", 0, 0, 139 },
+{ "DodgerBlue1", 30, 144, 255 },
+{ "DodgerBlue2", 28, 134, 238 },
+{ "DodgerBlue3", 24, 116, 205 },
+{ "DodgerBlue4", 16, 78, 139 },
+{ "SteelBlue1", 99, 184, 255 },
+{ "SteelBlue2", 92, 172, 238 },
+{ "SteelBlue3", 79, 148, 205 },
+{ "SteelBlue4", 54, 100, 139 },
+{ "DeepSkyBlue1", 0, 191, 255 },
+{ "DeepSkyBlue2", 0, 178, 238 },
+{ "DeepSkyBlue3", 0, 154, 205 },
+{ "DeepSkyBlue4", 0, 104, 139 },
+{ "SkyBlue1", 135, 206, 255 },
+{ "SkyBlue2", 126, 192, 238 },
+{ "SkyBlue3", 108, 166, 205 },
+{ "SkyBlue4", 74, 112, 139 },
+{ "LightSkyBlue1", 176, 226, 255 },
+{ "LightSkyBlue2", 164, 211, 238 },
+{ "LightSkyBlue3", 141, 182, 205 },
+{ "LightSkyBlue4", 96, 123, 139 },
+{ "SlateGray1", 198, 226, 255 },
+{ "SlateGray2", 185, 211, 238 },
+{ "SlateGray3", 159, 182, 205 },
+{ "SlateGray4", 108, 123, 139 },
+{ "LightSteelBlue1", 202, 225, 255 },
+{ "LightSteelBlue2", 188, 210, 238 },
+{ "LightSteelBlue3", 162, 181, 205 },
+{ "LightSteelBlue4", 110, 123, 139 },
+{ "LightBlue1", 191, 239, 255 },
+{ "LightBlue2", 178, 223, 238 },
+{ "LightBlue3", 154, 192, 205 },
+{ "LightBlue4", 104, 131, 139 },
+{ "LightCyan1", 224, 255, 255 },
+{ "LightCyan2", 209, 238, 238 },
+{ "LightCyan3", 180, 205, 205 },
+{ "LightCyan4", 122, 139, 139 },
+{ "PaleTurquoise1", 187, 255, 255 },
+{ "PaleTurquoise2", 174, 238, 238 },
+{ "PaleTurquoise3", 150, 205, 205 },
+{ "PaleTurquoise4", 102, 139, 139 },
+{ "CadetBlue1", 152, 245, 255 },
+{ "CadetBlue2", 142, 229, 238 },
+{ "CadetBlue3", 122, 197, 205 },
+{ "CadetBlue4", 83, 134, 139 },
+{ "turquoise1", 0, 245, 255 },
+{ "turquoise2", 0, 229, 238 },
+{ "turquoise3", 0, 197, 205 },
+{ "turquoise4", 0, 134, 139 },
+{ "cyan1", 0, 255, 255 },
+{ "cyan2", 0, 238, 238 },
+{ "cyan3", 0, 205, 205 },
+{ "cyan4", 0, 139, 139 },
+{ "DarkSlateGray1", 151, 255, 255 },
+{ "DarkSlateGray2", 141, 238, 238 },
+{ "DarkSlateGray3", 121, 205, 205 },
+{ "DarkSlateGray4", 82, 139, 139 },
+{ "aquamarine1", 127, 255, 212 },
+{ "aquamarine2", 118, 238, 198 },
+{ "aquamarine3", 102, 205, 170 },
+{ "aquamarine4", 69, 139, 116 },
+{ "DarkSeaGreen1", 193, 255, 193 },
+{ "DarkSeaGreen2", 180, 238, 180 },
+{ "DarkSeaGreen3", 155, 205, 155 },
+{ "DarkSeaGreen4", 105, 139, 105 },
+{ "SeaGreen1", 84, 255, 159 },
+{ "SeaGreen2", 78, 238, 148 },
+{ "SeaGreen3", 67, 205, 128 },
+{ "SeaGreen4", 46, 139, 87 },
+{ "PaleGreen1", 154, 255, 154 },
+{ "PaleGreen2", 144, 238, 144 },
+{ "PaleGreen3", 124, 205, 124 },
+{ "PaleGreen4", 84, 139, 84 },
+{ "SpringGreen1", 0, 255, 127 },
+{ "SpringGreen2", 0, 238, 118 },
+{ "SpringGreen3", 0, 205, 102 },
+{ "SpringGreen4", 0, 139, 69 },
+{ "green1", 0, 255, 0 },
+{ "green2", 0, 238, 0 },
+{ "green3", 0, 205, 0 },
+{ "green4", 0, 139, 0 },
+{ "chartreuse1", 127, 255, 0 },
+{ "chartreuse2", 118, 238, 0 },
+{ "chartreuse3", 102, 205, 0 },
+{ "chartreuse4", 69, 139, 0 },
+{ "OliveDrab1", 192, 255, 62 },
+{ "OliveDrab2", 179, 238, 58 },
+{ "OliveDrab3", 154, 205, 50 },
+{ "OliveDrab4", 105, 139, 34 },
+{ "DarkOliveGreen1", 202, 255, 112 },
+{ "DarkOliveGreen2", 188, 238, 104 },
+{ "DarkOliveGreen3", 162, 205, 90 },
+{ "DarkOliveGreen4", 110, 139, 61 },
+{ "khaki1", 255, 246, 143 },
+{ "khaki2", 238, 230, 133 },
+{ "khaki3", 205, 198, 115 },
+{ "khaki4", 139, 134, 78 },
+{ "LightGoldenrod1", 255, 236, 139 },
+{ "LightGoldenrod2", 238, 220, 130 },
+{ "LightGoldenrod3", 205, 190, 112 },
+{ "LightGoldenrod4", 139, 129, 76 },
+{ "LightYellow1", 255, 255, 224 },
+{ "LightYellow2", 238, 238, 209 },
+{ "LightYellow3", 205, 205, 180 },
+{ "LightYellow4", 139, 139, 122 },
+{ "yellow1", 255, 255, 0 },
+{ "yellow2", 238, 238, 0 },
+{ "yellow3", 205, 205, 0 },
+{ "yellow4", 139, 139, 0 },
+{ "gold1", 255, 215, 0 },
+{ "gold2", 238, 201, 0 },
+{ "gold3", 205, 173, 0 },
+{ "gold4", 139, 117, 0 },
+{ "goldenrod1", 255, 193, 37 },
+{ "goldenrod2", 238, 180, 34 },
+{ "goldenrod3", 205, 155, 29 },
+{ "goldenrod4", 139, 105, 20 },
+{ "DarkGoldenrod1", 255, 185, 15 },
+{ "DarkGoldenrod2", 238, 173, 14 },
+{ "DarkGoldenrod3", 205, 149, 12 },
+{ "DarkGoldenrod4", 139, 101, 8 },
+{ "RosyBrown1", 255, 193, 193 },
+{ "RosyBrown2", 238, 180, 180 },
+{ "RosyBrown3", 205, 155, 155 },
+{ "RosyBrown4", 139, 105, 105 },
+{ "IndianRed1", 255, 106, 106 },
+{ "IndianRed2", 238, 99, 99 },
+{ "IndianRed3", 205, 85, 85 },
+{ "IndianRed4", 139, 58, 58 },
+{ "sienna1", 255, 130, 71 },
+{ "sienna2", 238, 121, 66 },
+{ "sienna3", 205, 104, 57 },
+{ "sienna4", 139, 71, 38 },
+{ "burlywood1", 255, 211, 155 },
+{ "burlywood2", 238, 197, 145 },
+{ "burlywood3", 205, 170, 125 },
+{ "burlywood4", 139, 115, 85 },
+{ "wheat1", 255, 231, 186 },
+{ "wheat2", 238, 216, 174 },
+{ "wheat3", 205, 186, 150 },
+{ "wheat4", 139, 126, 102 },
+{ "tan1", 255, 165, 79 },
+{ "tan2", 238, 154, 73 },
+{ "tan3", 205, 133, 63 },
+{ "tan4", 139 , 90, 43 },
+{ "chocolate1", 255, 127, 36 },
+{ "chocolate2", 238, 118, 33 },
+{ "chocolate3", 205, 102, 29 },
+{ "chocolate4", 139, 69, 19 },
+{ "firebrick1", 255, 48, 48 },
+{ "firebrick2", 238, 44, 44 },
+{ "firebrick3", 205, 38, 38 },
+{ "firebrick4", 139, 26, 26 },
+{ "brown1", 255, 64, 64 },
+{ "brown2", 238, 59, 59 },
+{ "brown3", 205, 51, 51 },
+{ "brown4", 139, 35, 35 },
+{ "salmon1", 255, 140, 105 },
+{ "salmon2", 238, 130, 98 },
+{ "salmon3", 205, 112, 84 },
+{ "salmon4", 139, 76, 57 },
+{ "LightSalmon1", 255, 160, 122 },
+{ "LightSalmon2", 238, 149, 114 },
+{ "LightSalmon3", 205, 129, 98 },
+{ "LightSalmon4", 139, 87, 66 },
+{ "orange1", 255, 165, 0 },
+{ "orange2", 238, 154, 0 },
+{ "orange3", 205, 133, 0 },
+{ "orange4", 139 , 90, 0 },
+{ "DarkOrange1", 255, 127, 0 },
+{ "DarkOrange2", 238, 118, 0 },
+{ "DarkOrange3", 205, 102, 0 },
+{ "DarkOrange4", 139 , 69, 0 },
+{ "coral1", 255, 114, 86 },
+{ "coral2", 238, 106, 80 },
+{ "coral3", 205, 91, 69 },
+{ "coral4", 139, 62, 47 },
+{ "tomato1", 255, 99, 71 },
+{ "tomato2", 238, 92, 66 },
+{ "tomato3", 205, 79, 57 },
+{ "tomato4", 139, 54, 38 },
+{ "OrangeRed1", 255, 69, 0 },
+{ "OrangeRed2", 238, 64, 0 },
+{ "OrangeRed3", 205, 55, 0 },
+{ "OrangeRed4", 139, 37, 0 },
+{ "red1", 255, 0, 0 },
+{ "red2", 238, 0, 0 },
+{ "red3", 205, 0, 0 },
+{ "red4", 139, 0, 0 },
+{ "DeepPink1", 255, 20, 147 },
+{ "DeepPink2", 238, 18, 137 },
+{ "DeepPink3", 205, 16, 118 },
+{ "DeepPink4", 139, 10, 80 },
+{ "HotPink1", 255, 110, 180 },
+{ "HotPink2", 238, 106, 167 },
+{ "HotPink3", 205, 96, 144 },
+{ "HotPink4", 139, 58, 98 },
+{ "pink1", 255, 181, 197 },
+{ "pink2", 238, 169, 184 },
+{ "pink3", 205, 145, 158 },
+{ "pink4", 139, 99, 108 },
+{ "LightPink1", 255, 174, 185 },
+{ "LightPink2", 238, 162, 173 },
+{ "LightPink3", 205, 140, 149 },
+{ "LightPink4", 139, 95, 101 },
+{ "PaleVioletRed1", 255, 130, 171 },
+{ "PaleVioletRed2", 238, 121, 159 },
+{ "PaleVioletRed3", 205, 104, 137 },
+{ "PaleVioletRed4", 139, 71, 93 },
+{ "maroon1", 255, 52, 179 },
+{ "maroon2", 238, 48, 167 },
+{ "maroon3", 205, 41, 144 },
+{ "maroon4", 139, 28, 98 },
+{ "VioletRed1", 255, 62, 150 },
+{ "VioletRed2", 238, 58, 140 },
+{ "VioletRed3", 205, 50, 120 },
+{ "VioletRed4", 139, 34, 82 },
+{ "magenta1", 255, 0, 255 },
+{ "magenta2", 238, 0, 238 },
+{ "magenta3", 205, 0, 205 },
+{ "magenta4", 139, 0, 139 },
+{ "orchid1", 255, 131, 250 },
+{ "orchid2", 238, 122, 233 },
+{ "orchid3", 205, 105, 201 },
+{ "orchid4", 139, 71, 137 },
+{ "plum1", 255, 187, 255 },
+{ "plum2", 238, 174, 238 },
+{ "plum3", 205, 150, 205 },
+{ "plum4", 139, 102, 139 },
+{ "MediumOrchid1", 224, 102, 255 },
+{ "MediumOrchid2", 209, 95, 238 },
+{ "MediumOrchid3", 180, 82, 205 },
+{ "MediumOrchid4", 122, 55, 139 },
+{ "DarkOrchid1", 191, 62, 255 },
+{ "DarkOrchid2", 178, 58, 238 },
+{ "DarkOrchid3", 154, 50, 205 },
+{ "DarkOrchid4", 104, 34, 139 },
+{ "purple1", 155, 48, 255 },
+{ "purple2", 145, 44, 238 },
+{ "purple3", 125, 38, 205 },
+{ "purple4", 85, 26, 139 },
+{ "MediumPurple1", 171, 130, 255 },
+{ "MediumPurple2", 159, 121, 238 },
+{ "MediumPurple3", 137, 104, 205 },
+{ "MediumPurple4", 93, 71, 139 },
+{ "thistle1", 255, 225, 255 },
+{ "thistle2", 238, 210, 238 },
+{ "thistle3", 205, 181, 205 },
+{ "thistle4", 139, 123, 139 },
+{ "gray0", 0, 0, 0 },
+{ "grey0", 0, 0, 0 },
+{ "gray1", 3, 3, 3 },
+{ "grey1", 3, 3, 3 },
+{ "gray2", 5, 5, 5 },
+{ "grey2", 5, 5, 5 },
+{ "gray3", 8, 8, 8 },
+{ "grey3", 8, 8, 8 },
+{ "gray4", 10, 10, 10 },
+{ "grey4", 10, 10, 10 },
+{ "gray5", 13, 13, 13 },
+{ "grey5", 13, 13, 13 },
+{ "gray6", 15, 15, 15 },
+{ "grey6", 15, 15, 15 },
+{ "gray7", 18, 18, 18 },
+{ "grey7", 18, 18, 18 },
+{ "gray8", 20, 20, 20 },
+{ "grey8", 20, 20, 20 },
+{ "gray9", 23, 23, 23 },
+{ "grey9", 23, 23, 23 },
+{ "gray10", 26, 26, 26 },
+{ "grey10", 26, 26, 26 },
+{ "gray11", 28, 28, 28 },
+{ "grey11", 28, 28, 28 },
+{ "gray12", 31, 31, 31 },
+{ "grey12", 31, 31, 31 },
+{ "gray13", 33, 33, 33 },
+{ "grey13", 33, 33, 33 },
+{ "gray14", 36, 36, 36 },
+{ "grey14", 36, 36, 36 },
+{ "gray15", 38, 38, 38 },
+{ "grey15", 38, 38, 38 },
+{ "gray16", 41, 41, 41 },
+{ "grey16", 41, 41, 41 },
+{ "gray17", 43, 43, 43 },
+{ "grey17", 43, 43, 43 },
+{ "gray18", 46, 46, 46 },
+{ "grey18", 46, 46, 46 },
+{ "gray19", 48, 48, 48 },
+{ "grey19", 48, 48, 48 },
+{ "gray20", 51, 51, 51 },
+{ "grey20", 51, 51, 51 },
+{ "gray21", 54, 54, 54 },
+{ "grey21", 54, 54, 54 },
+{ "gray22", 56, 56, 56 },
+{ "grey22", 56, 56, 56 },
+{ "gray23", 59, 59, 59 },
+{ "grey23", 59, 59, 59 },
+{ "gray24", 61, 61, 61 },
+{ "grey24", 61, 61, 61 },
+{ "gray25", 64, 64, 64 },
+{ "grey25", 64, 64, 64 },
+{ "gray26", 66, 66, 66 },
+{ "grey26", 66, 66, 66 },
+{ "gray27", 69, 69, 69 },
+{ "grey27", 69, 69, 69 },
+{ "gray28", 71, 71, 71 },
+{ "grey28", 71, 71, 71 },
+{ "gray29", 74, 74, 74 },
+{ "grey29", 74, 74, 74 },
+{ "gray30", 77, 77, 77 },
+{ "grey30", 77, 77, 77 },
+{ "gray31", 79, 79, 79 },
+{ "grey31", 79, 79, 79 },
+{ "gray32", 82, 82, 82 },
+{ "grey32", 82, 82, 82 },
+{ "gray33", 84, 84, 84 },
+{ "grey33", 84, 84, 84 },
+{ "gray34", 87, 87, 87 },
+{ "grey34", 87, 87, 87 },
+{ "gray35", 89, 89, 89 },
+{ "grey35", 89, 89, 89 },
+{ "gray36", 92, 92, 92 },
+{ "grey36", 92, 92, 92 },
+{ "gray37", 94, 94, 94 },
+{ "grey37", 94, 94, 94 },
+{ "gray38", 97, 97, 97 },
+{ "grey38", 97, 97, 97 },
+{ "gray39", 99, 99, 99 },
+{ "grey39", 99, 99, 99 },
+{ "gray40", 102, 102, 102 },
+{ "grey40", 102, 102, 102 },
+{ "gray41", 105, 105, 105 },
+{ "grey41", 105, 105, 105 },
+{ "gray42", 107, 107, 107 },
+{ "grey42", 107, 107, 107 },
+{ "gray43", 110, 110, 110 },
+{ "grey43", 110, 110, 110 },
+{ "gray44", 112, 112, 112 },
+{ "grey44", 112, 112, 112 },
+{ "gray45", 115, 115, 115 },
+{ "grey45", 115, 115, 115 },
+{ "gray46", 117, 117, 117 },
+{ "grey46", 117, 117, 117 },
+{ "gray47", 120, 120, 120 },
+{ "grey47", 120, 120, 120 },
+{ "gray48", 122, 122, 122 },
+{ "grey48", 122, 122, 122 },
+{ "gray49", 125, 125, 125 },
+{ "grey49", 125, 125, 125 },
+{ "gray50", 127, 127, 127 },
+{ "grey50", 127, 127, 127 },
+{ "gray51", 130, 130, 130 },
+{ "grey51", 130, 130, 130 },
+{ "gray52", 133, 133, 133 },
+{ "grey52", 133, 133, 133 },
+{ "gray53", 135, 135, 135 },
+{ "grey53", 135, 135, 135 },
+{ "gray54", 138, 138, 138 },
+{ "grey54", 138, 138, 138 },
+{ "gray55", 140, 140, 140 },
+{ "grey55", 140, 140, 140 },
+{ "gray56", 143, 143, 143 },
+{ "grey56", 143, 143, 143 },
+{ "gray57", 145, 145, 145 },
+{ "grey57", 145, 145, 145 },
+{ "gray58", 148, 148, 148 },
+{ "grey58", 148, 148, 148 },
+{ "gray59", 150, 150, 150 },
+{ "grey59", 150, 150, 150 },
+{ "gray60", 153, 153, 153 },
+{ "grey60", 153, 153, 153 },
+{ "gray61", 156, 156, 156 },
+{ "grey61", 156, 156, 156 },
+{ "gray62", 158, 158, 158 },
+{ "grey62", 158, 158, 158 },
+{ "gray63", 161, 161, 161 },
+{ "grey63", 161, 161, 161 },
+{ "gray64", 163, 163, 163 },
+{ "grey64", 163, 163, 163 },
+{ "gray65", 166, 166, 166 },
+{ "grey65", 166, 166, 166 },
+{ "gray66", 168, 168, 168 },
+{ "grey66", 168, 168, 168 },
+{ "gray67", 171, 171, 171 },
+{ "grey67", 171, 171, 171 },
+{ "gray68", 173, 173, 173 },
+{ "grey68", 173, 173, 173 },
+{ "gray69", 176, 176, 176 },
+{ "grey69", 176, 176, 176 },
+{ "gray70", 179, 179, 179 },
+{ "grey70", 179, 179, 179 },
+{ "gray71", 181, 181, 181 },
+{ "grey71", 181, 181, 181 },
+{ "gray72", 184, 184, 184 },
+{ "grey72", 184, 184, 184 },
+{ "gray73", 186, 186, 186 },
+{ "grey73", 186, 186, 186 },
+{ "gray74", 189, 189, 189 },
+{ "grey74", 189, 189, 189 },
+{ "gray75", 191, 191, 191 },
+{ "grey75", 191, 191, 191 },
+{ "gray76", 194, 194, 194 },
+{ "grey76", 194, 194, 194 },
+{ "gray77", 196, 196, 196 },
+{ "grey77", 196, 196, 196 },
+{ "gray78", 199, 199, 199 },
+{ "grey78", 199, 199, 199 },
+{ "gray79", 201, 201, 201 },
+{ "grey79", 201, 201, 201 },
+{ "gray80", 204, 204, 204 },
+{ "grey80", 204, 204, 204 },
+{ "gray81", 207, 207, 207 },
+{ "grey81", 207, 207, 207 },
+{ "gray82", 209, 209, 209 },
+{ "grey82", 209, 209, 209 },
+{ "gray83", 212, 212, 212 },
+{ "grey83", 212, 212, 212 },
+{ "gray84", 214, 214, 214 },
+{ "grey84", 214, 214, 214 },
+{ "gray85", 217, 217, 217 },
+{ "grey85", 217, 217, 217 },
+{ "gray86", 219, 219, 219 },
+{ "grey86", 219, 219, 219 },
+{ "gray87", 222, 222, 222 },
+{ "grey87", 222, 222, 222 },
+{ "gray88", 224, 224, 224 },
+{ "grey88", 224, 224, 224 },
+{ "gray89", 227, 227, 227 },
+{ "grey89", 227, 227, 227 },
+{ "gray90", 229, 229, 229 },
+{ "grey90", 229, 229, 229 },
+{ "gray91", 232, 232, 232 },
+{ "grey91", 232, 232, 232 },
+{ "gray92", 235, 235, 235 },
+{ "grey92", 235, 235, 235 },
+{ "gray93", 237, 237, 237 },
+{ "grey93", 237, 237, 237 },
+{ "gray94", 240, 240, 240 },
+{ "grey94", 240, 240, 240 },
+{ "gray95", 242, 242, 242 },
+{ "grey95", 242, 242, 242 },
+{ "gray96", 245, 245, 245 },
+{ "grey96", 245, 245, 245 },
+{ "gray97", 247, 247, 247 },
+{ "grey97", 247, 247, 247 },
+{ "gray98", 250, 250, 250 },
+{ "grey98", 250, 250, 250 },
+{ "gray99", 252, 252, 252 },
+{ "grey99", 252, 252, 252 },
+{ "gray100", 255, 255, 255 },
+{ "grey100", 255, 255, 255 },
+{ "DarkGrey", 169, 169, 169 },
+{ "DarkGray", 169, 169, 169 },
+{ "DarkBlue", 0, 0, 139 },
+{ "DarkCyan", 0, 139, 139 },
+{ "DarkMagenta", 139, 0, 139 },
+{ "DarkRed", 139, 0, 0 },
+{ "LightGreen", 144, 238, 144 },
+{ NULL, 0 , 0, 0}
+};
diff --git a/svtools/source/filter.vcl/ixpm/xpmread.cxx b/svtools/source/filter.vcl/ixpm/xpmread.cxx
new file mode 100644
index 000000000000..af267eb0d961
--- /dev/null
+++ b/svtools/source/filter.vcl/ixpm/xpmread.cxx
@@ -0,0 +1,714 @@
+/*************************************************************************
+ *
+ * $RCSfile: xpmread.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+#ifndef _GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#include "rgbtable.hxx"
+#define _XPMPRIVATE
+#include "xpmread.hxx"
+
+// -------------
+// - XPMReader -
+// -------------
+
+XPMReader::XPMReader( SvStream& rStm, void* pCallData ) :
+ mrIStm ( rStm ),
+ mnIdentifier ( XPMIDENTIFIER ),
+ mnTempAvail ( 0 ),
+ mnStatus ( 0 ),
+ mbTransparent ( FALSE ),
+ mnCpp ( 0 ),
+ mnWidth ( 0 ),
+ mnHeight ( 0 ),
+ mnColors ( 0 ),
+ mcThisByte ( 0 ),
+ mnLastPos ( rStm.Tell() ),
+ mpFastColorTable( NULL ),
+ mpColMap ( NULL ),
+ mpAcc ( NULL ),
+ mpMaskAcc ( NULL ),
+ mbStatus ( TRUE )
+{
+
+}
+
+// ------------------------------------------------------------------------
+
+XPMReader::~XPMReader()
+{
+ if( mpAcc )
+ maBmp.ReleaseAccess( mpAcc );
+}
+
+// ------------------------------------------------------------------------
+
+#ifdef WNT
+#pragma optimize ("",off)
+#endif
+
+ReadState XPMReader::ReadXPM( Graphic& rGraphic )
+{
+ ReadState eReadState;
+ BYTE cDummy;
+
+ // sehen, ob wir _alles_ lesen koennen
+ mrIStm.Seek( STREAM_SEEK_TO_END );
+ mrIStm >> cDummy;
+
+ // falls wir nicht alles lesen koennen
+ // kehren wir zurueck und warten auf neue Daten
+ if ( mrIStm.GetError() != ERRCODE_IO_PENDING )
+ {
+ mrIStm.Seek( mnLastPos );
+ mbStatus = TRUE;
+
+ if ( mbStatus )
+ {
+ mpStringBuf = new BYTE [ XPMSTRINGBUF ];
+ mpTempBuf = new BYTE [ XPMTEMPBUFSIZE ];
+
+ if ( ( mbStatus = ImplGetString() ) == TRUE )
+ {
+ mnIdentifier = XPMVALUES; // Bitmap informationen einholen
+ mnWidth = ImplGetULONG( 0 );
+ mnHeight = ImplGetULONG( 1 );
+ mnColors = ImplGetULONG( 2 );
+ mnCpp = ImplGetULONG( 3 );
+ }
+ if ( mbStatus && mnWidth && mnHeight && mnColors && mnCpp )
+ {
+ mnIdentifier = XPMCOLORS;
+
+ // mpColMap beinhaltet für jede vorhandene
+ // Farbe: ( mnCpp )Byte(s)-> ASCII Eintrag der der Farbe zugeordnet ist
+ // 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 ( ImplGetColor( i ) == FALSE )
+ {
+ mbStatus = FALSE;
+ break;
+ }
+ }
+ if ( mbStatus )
+ {
+ // bei mehr als 256 Farben wird eine 24 Bit Grafik erstellt
+ maBmp = Bitmap( Size( mnWidth, mnHeight ), ( mnColors > 256 ) ? 24 : 8 );
+ mpAcc = maBmp.AcquireWriteAccess();
+
+ // mbTransparent ist TRUE wenn mindestens eine Farbe Transparent ist
+ if ( mbTransparent )
+ {
+ maMaskBmp = Bitmap( Size( mnWidth, mnHeight ), 1 );
+ if ( ( mpMaskAcc = maMaskBmp.AcquireWriteAccess() ) == NULL )
+ mbStatus = FALSE;
+ }
+ if( mpAcc && mbStatus )
+ {
+ ULONG i;
+ if ( mnColors <=256 ) // palette is only needed by using less than 257
+ { // colors
+
+ BYTE* pPtr = &mpColMap[mnCpp];
+
+ for ( i = 0; i < mnColors; i++ )
+ {
+ mpAcc->SetPaletteColor( (BYTE)i, Color( pPtr[1], pPtr[2], pPtr[3] ) );
+ pPtr += ( mnCpp + 4 );
+ }
+ // using 2 charakters per pixel and less than 257 Colors we speed up
+ if ( mnCpp == 2 ) // by using a 64kb indexing table
+ {
+ mpFastColorTable = new BYTE[ 256 * 256 ];
+ for ( pPtr = mpColMap, i = 0; i < mnColors; i++, pPtr += mnCpp + 4 )
+ {
+ ULONG j = pPtr[ 0 ] << 8;
+ j += pPtr[ 1 ];
+ mpFastColorTable[ j ] = (BYTE)i;
+ }
+ }
+ }
+ // now we get the bitmap data
+ mnIdentifier = XPMPIXELS;
+ for ( i = 0; i < mnHeight; i++ )
+ {
+ if ( ImplGetScanLine( i ) == FALSE )
+ {
+ mbStatus = FALSE;
+ break;
+ }
+ }
+ mnIdentifier = XPMEXTENSIONS;
+ }
+ }
+ }
+
+ delete[] mpFastColorTable;
+ delete[] mpColMap;
+ delete[] mpStringBuf;
+ delete[] mpTempBuf;
+
+ }
+ if( mbStatus )
+ {
+ if ( mpMaskAcc )
+ {
+ maMaskBmp.ReleaseAccess ( mpMaskAcc), mpMaskAcc = NULL;
+ maBmp.ReleaseAccess( mpAcc ), mpAcc = NULL;
+ rGraphic = Graphic( BitmapEx( maBmp, maMaskBmp ) );
+ }
+ else
+ {
+ maBmp.ReleaseAccess( mpAcc ), mpAcc = NULL;
+ rGraphic = maBmp;
+ }
+ eReadState = XPMREAD_OK;
+ }
+ else
+ {
+ if ( mpMaskAcc ) maMaskBmp.ReleaseAccess ( mpMaskAcc), mpMaskAcc = NULL;
+ if ( mpAcc ) maBmp.ReleaseAccess( mpAcc ), mpAcc = NULL;
+ eReadState = XPMREAD_ERROR;
+ }
+ }
+ else
+ {
+ mrIStm.ResetError();
+ eReadState = XPMREAD_NEED_MORE;
+ }
+ return eReadState;
+}
+
+#ifdef WNT
+#pragma optimize ("",on)
+#endif
+
+// ------------------------------------------------------------------------
+// ImplGetColor ermittelt sämtliche Farbwerte,
+// die Rückgabe ist TRUE wenn sämtliche Farben zugeordnet werden konnten
+
+BOOL XPMReader::ImplGetColor( ULONG nNumb )
+{
+ BYTE* pString = mpStringBuf;
+ BYTE* pPtr = ( mpColMap + nNumb * ( 4 + mnCpp ) );
+ BOOL bStatus = ImplGetString();
+
+ if ( bStatus )
+ {
+ for ( ULONG i = 0; i < mnCpp; i++ )
+ *pPtr++ = *pString++;
+ bStatus = ImplGetColSub ( pPtr );
+ }
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+// ImpGetScanLine liest den String mpBufSize aus und schreibt die Pixel in die
+// Bitmap. Der Parameter nY gibt die horizontale Position an.
+
+BOOL XPMReader::ImplGetScanLine( ULONG nY )
+{
+ BOOL bStatus = ImplGetString();
+ BYTE* pString = mpStringBuf;
+ BYTE* pColor;
+ BitmapColor aWhite;
+ BitmapColor aBlack;
+
+ if ( bStatus )
+ {
+ if ( mpMaskAcc )
+ {
+ aWhite = mpMaskAcc->GetBestMatchingColor( Color( COL_WHITE ) );
+ aBlack = mpMaskAcc->GetBestMatchingColor( Color( COL_BLACK ) );
+ }
+ if ( mnStringSize != ( mnWidth * mnCpp ))
+ bStatus = FALSE;
+ else
+ {
+ ULONG i, j;
+ if ( mpFastColorTable )
+ {
+ for ( i = 0; i < mnWidth; i++ )
+ {
+ j = (*pString++) << 8;
+ j += *pString++;
+ BYTE k = (BYTE)mpFastColorTable[ j ];
+ mpAcc->SetPixel( nY, i, BitmapColor( (BYTE)k ) );
+
+ if ( mpMaskAcc )
+ mpMaskAcc->SetPixel( nY, i,
+ ( mpColMap[ k * (mnCpp + 4) + mnCpp] ) ? aWhite : aBlack );
+ }
+ }
+ else for ( i = 0; i < mnWidth; i++ )
+ {
+ pColor = mpColMap;
+ for ( j = 0; j < mnColors; j++ )
+ {
+ if ( ImplCompare( pString, pColor, mnCpp, XPMCASESENSITIVE ) == TRUE )
+ {
+ if ( mnColors > 256 )
+ mpAcc->SetPixel( nY, i, Color ( pColor[3], pColor[4], pColor[5] ) );
+ else
+ mpAcc->SetPixel( nY, i, BitmapColor( (BYTE) j ) );
+
+ if ( mpMaskAcc )
+ mpMaskAcc->SetPixel( nY, i, (
+ pColor[ mnCpp ] ) ? aWhite : aBlack );
+
+ break;
+ }
+ pColor += ( mnCpp + 4 );
+ }
+ pString += mnCpp;
+ }
+
+ }
+ }
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+// versucht aus mpStringBuf einen Farbwert zu übermitteln
+// wurde eine Farbe gefunden wird an pDest[1]..pDest[2] der RGB wert geschrieben
+// pDest[0] enthält 0xff wenn die Farbe transparent ist sonst 0
+
+BOOL XPMReader::ImplGetColSub( BYTE* pDest )
+{
+ unsigned char cTransparent[] = "None";
+
+ BOOL bColStatus = FALSE;
+
+ if ( ImplGetColKey( 'c' ) || ImplGetColKey( 'm' ) || ImplGetColKey( 'g' ) )
+ {
+ // hexentry for RGB or HSV color ?
+ if ( *mpPara == '#' )
+ {
+ *pDest++ = 0;
+ bColStatus = TRUE;
+ switch ( mnParaSize )
+ {
+ case 25 :
+ ImplGetRGBHex ( pDest, 6 );
+ break;
+ case 13 :
+ ImplGetRGBHex ( pDest, 2 );
+ break;
+ case 7 :
+ ImplGetRGBHex ( pDest, 0 );
+ break;
+ default:
+ bColStatus = FALSE;
+ break;
+ }
+ }
+ // maybe pixel is transparent
+ else if ( ImplCompare( &cTransparent[0], mpPara, 4 ))
+ {
+ *pDest++ = 0xff;
+ bColStatus = TRUE;
+ mbTransparent = TRUE;
+ }
+ // last we will try to get the colorname
+ else if ( mnParaSize > 2 ) // name must enlarge the minimum size
+ {
+ ULONG i = 0;
+ while ( TRUE )
+ {
+ if ( pRGBTable[ i ].name == NULL )
+ break;
+ if ( pRGBTable[ i ].name[ mnParaSize ] == 0 )
+ {
+ if ( ImplCompare ( (unsigned char*)pRGBTable[ i ].name,
+ mpPara, mnParaSize, XPMCASENONSENSITIVE ) )
+ {
+ bColStatus = TRUE;
+ *pDest++ = 0;
+ *pDest++ = pRGBTable[ i ].red;
+ *pDest++ = pRGBTable[ i ].green;
+ *pDest++ = pRGBTable[ i ].blue;
+ }
+ }
+ i++;
+ }
+ }
+ }
+ return bColStatus;
+}
+
+// ------------------------------------------------------------------------
+// ImplGetColKey durchsuch den String mpStringBuf nach einem Parameter 'nKey'
+// und gibt einen BOOL zurück. ( wenn TRUE werden mpPara und mnParaSize gesetzt )
+
+BOOL XPMReader::ImplGetColKey( BYTE nKey )
+{
+ BYTE nTemp, nPrev = ' ';
+
+ mpPara = mpStringBuf + mnCpp + 1;
+ mnParaSize = 0;
+
+ while ( *mpPara != 0 )
+ {
+ if ( *mpPara == nKey )
+ {
+ nTemp = *( mpPara + 1 );
+ if ( nTemp == ' ' || nTemp == 0x09 )
+ {
+ if ( nPrev == ' ' || nPrev == 0x09 )
+ break;
+ }
+ }
+ nPrev = *mpPara;
+ *mpPara++;
+ }
+ if ( *mpPara )
+ {
+ mpPara++;
+ while ( (*mpPara == ' ') || (*mpPara == 0x09) )
+ {
+ mpPara++;
+ }
+ if ( *mpPara != 0 )
+ {
+ while ( *(mpPara+mnParaSize) != ' ' && *(mpPara+mnParaSize) != 0x09 &&
+ *(mpPara+mnParaSize) != 0 )
+ {
+ mnParaSize++;
+ }
+ }
+ }
+ return ( mnParaSize ) ? TRUE : FALSE;
+}
+
+// ------------------------------------------------------------------------
+// ImplGetRGBHex übersetzt den ASCII-Hexadezimalwert der sich bei mpPara befindet
+// in einen RGB wert und schreibt diesen nach pDest
+// folgende Formate müssen sich bei mpPara befinden:
+// wenn nAdd = 0 : '#12ab12' -> RGB = 0x12, 0xab, 0x12
+// 2 : '#1234abcd1234' " " " "
+// 6 : '#12345678abcdefab12345678' " " " "
+
+
+void XPMReader::ImplGetRGBHex( BYTE* pDest,ULONG nAdd )
+{
+ BYTE* pPtr = mpPara+1;
+ BYTE nHex, nTemp;
+
+ for ( ULONG i = 0; i < 3; i++ )
+ {
+ nHex = (*pPtr++) - '0';
+ if ( nHex > 9 )
+ nHex = ((nHex - 'A' + '0') & 7) + 10;
+
+ nTemp = (*pPtr++) - '0';
+ if ( nTemp > 9 )
+ nTemp = ((nTemp - 'A' + '0') & 7) + 10;
+ nHex = ( nHex << 4 ) + nTemp;
+
+ pPtr += nAdd;
+ *pDest++ = (BYTE)nHex;
+ }
+}
+
+// ------------------------------------------------------------------------
+// ImplGetUlong gibt den wert einer bis zu 6stelligen ASCII-Dezimalzahl zurück.
+
+ULONG XPMReader::ImplGetULONG( ULONG nPara )
+{
+ if ( ImplGetPara ( nPara ) )
+ {
+ ULONG nRetValue = 0;
+ BYTE* pPtr = mpPara;
+
+ if ( ( mnParaSize > 6 ) || ( mnParaSize == 0 ) ) return 0;
+ for ( ULONG i = 0; i < mnParaSize; i++ )
+ {
+ BYTE j = (*pPtr++) - 48;
+ if ( j > 9 ) return 0; // ascii is invalid
+ nRetValue*=10;
+ nRetValue+=j;
+ }
+ return nRetValue;
+ }
+ else return 0;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL XPMReader::ImplCompare( BYTE* pSource, BYTE* pDest, ULONG nSize, ULONG nMode )
+{
+ BOOL bRet = TRUE;
+
+ if ( nMode == XPMCASENONSENSITIVE )
+ {
+ for ( ULONG i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ {
+ bRet = FALSE;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for ( ULONG i = 0; i < nSize; i++ )
+ {
+ if ( pSource[i] != pDest[i] )
+ {
+ bRet = FALSE;
+ break;
+ }
+ }
+ }
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+// ImplGetPara versucht den nNumb ( 0...x ) Parameter aus mpStringBuf zu ermitteln.
+// Ein Parameter ist durch Spaces oder Tabs von den anderen getrennt.
+// Konnte der Parameter gefunden werden ist der Rückgabewert TRUE und mpPara + mnParaSize
+// werden gesetzt.
+
+BOOL XPMReader::ImplGetPara ( ULONG nNumb )
+{
+ BYTE nByte;
+ ULONG pSize = 0;
+ BYTE* pPtr = mpStringBuf;
+ ULONG nCount = 0;
+
+ if ( ( *pPtr != ' ' ) && ( *pPtr != 0x09 ) )
+ {
+ mpPara = pPtr;
+ mnParaSize = 0;
+ nCount = 0;
+ }
+ else
+ {
+ mpPara = NULL;
+ nCount = 0xffffffff;
+ }
+
+ while ( pSize < mnStringSize )
+ {
+ nByte = *pPtr;
+
+ if ( mpPara )
+ {
+ if ( ( nByte == ' ' ) || ( nByte == 0x09 ) )
+ {
+ if ( nCount == nNumb )
+ break;
+ else
+ mpPara = NULL;
+ }
+ else
+ mnParaSize++;
+ }
+ else
+ {
+ if ( ( nByte != ' ' ) && ( nByte != 0x09 ) )
+ {
+ mpPara = pPtr;
+ mnParaSize = 1;
+ nCount++;
+ }
+ }
+ pSize++;
+ pPtr++;
+ }
+ return ( ( nCount == nNumb ) && ( mpPara ) ) ? TRUE : FALSE;
+}
+
+// ------------------------------------------------------------------------
+// Der nächste String wird ausgelesen und in mpStringBuf (mit 0 abgeschloßen) abgelegt;
+// mnStringSize enthält die Größe des gelesenen Strings.
+// Bemerkungen wie '//' und '/*.....*/' werden übersprungen.
+
+BOOL XPMReader::ImplGetString( void )
+{
+ BYTE sID[] = "/* XPM */";
+ BYTE* pString = mpStringBuf;
+
+ mnStringSize = 0;
+ mpStringBuf[0] = 0;
+
+ while( mbStatus && ( mnStatus != XPMFINISHED ) )
+ {
+ if ( mnTempAvail == 0 )
+ {
+ mnTempAvail = mrIStm.Read( mpTempBuf, XPMTEMPBUFSIZE );
+ if ( mnTempAvail == 0 )
+ break;
+
+ mpTempPtr = mpTempBuf;
+
+ if ( mnIdentifier == XPMIDENTIFIER )
+ {
+ if ( mnTempAvail <= 50 )
+ {
+ mbStatus = FALSE; // file is too short to be a correct XPM format
+ break;
+ }
+ for ( int i = 0; i < 9; i++ ) // searching for "/* XPM */"
+ if ( *mpTempPtr++ != sID[i] )
+ {
+ mbStatus = FALSE;
+ break;
+ }
+ mnTempAvail-=9;
+ mnIdentifier++;
+ }
+ }
+ mcLastByte = mcThisByte;
+ mcThisByte = *mpTempPtr++;
+ mnTempAvail--;
+
+ if ( mnStatus & XPMDOUBLE )
+ {
+ if ( mcThisByte == 0x0a )
+ mnStatus &=~XPMDOUBLE;
+ continue;
+ }
+ if ( mnStatus & XPMREMARK )
+ {
+ if ( ( mcThisByte == '/' ) && ( mcLastByte == '*' ) )
+ mnStatus &=~XPMREMARK;
+ continue;
+ }
+ if ( mnStatus & XPMSTRING ) // characters in string
+ {
+ if ( mcThisByte == '"' )
+ {
+ mnStatus &=~XPMSTRING; // end of parameter by eol
+ break;
+ }
+ if ( mnStringSize >= XPMSTRINGBUF )
+ {
+ mbStatus = FALSE;
+ break;
+ }
+ *pString++ = mcThisByte;
+ pString[0] = 0;
+ mnStringSize++;
+ continue;
+ }
+ else
+ { // characters beside string
+ switch ( mcThisByte )
+ {
+ case '*' :
+ if ( mcLastByte == '/' ) mnStatus |= XPMREMARK;
+ break;
+ case '/' :
+ if ( mcLastByte == '/' ) mnStatus |= XPMDOUBLE;
+ break;
+ case '"' : mnStatus |= XPMSTRING;
+ break;
+ case '{' :
+ if ( mnIdentifier == XPMDEFINITION )
+ mnIdentifier++;
+ break;
+ case '}' :
+ if ( mnIdentifier == XPMENDEXT )
+ mnStatus = XPMFINISHED;
+ break;
+ }
+ }
+ }
+ return mbStatus;
+}
+
+// -------------
+// - ImportXPM -
+// -------------
+
+BOOL ImportXPM( SvStream& rStm, Graphic& rGraphic, void* pCallerData )
+{
+ XPMReader* pXPMReader = (XPMReader*) rGraphic.GetContext();
+ ReadState eReadState;
+ BOOL bRet = TRUE;
+
+ if( !pXPMReader )
+ pXPMReader = new XPMReader( rStm, pCallerData );
+
+ rGraphic.SetContext( NULL );
+ eReadState = pXPMReader->ReadXPM( rGraphic );
+
+ if( eReadState == XPMREAD_ERROR )
+ {
+ bRet = FALSE;
+ delete pXPMReader;
+ }
+ else if( eReadState == XPMREAD_OK )
+ delete pXPMReader;
+ else
+ rGraphic.SetContext( pXPMReader );
+
+ return bRet;
+}
diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx
new file mode 100644
index 000000000000..36865f13210f
--- /dev/null
+++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx
@@ -0,0 +1,565 @@
+/*************************************************************************
+ *
+ * $RCSfile: jpeg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+extern "C"
+{
+ #include "jpeg/jpeg.h"
+}
+
+#define _JPEGPRIVATE
+
+#include <vcl/config.hxx>
+#include <tools/new.hxx>
+#include <vcl/bmpacc.hxx>
+#include "jpeg.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+#define JPEGMINREAD 512
+
+// -------------
+// - (C-Calls) -
+// -------------
+
+extern "C" void* JPEGMalloc( size_t nSize )
+{
+ return (void*) new BYTE[ nSize ];
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" void JPEGFree( void* pBuf )
+{
+ delete[] (BYTE*) pBuf;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" long StreamRead( void* pIStm, void* pBuffer, long nBufferSize )
+{
+ SvStream* pSvStm = (SvStream*) pIStm;
+ long nRead;
+
+ if( pSvStm->GetError() != ERRCODE_IO_PENDING )
+ {
+ long nActPos = pSvStm->Tell();
+
+ nRead = (long) pSvStm->Read( pBuffer, nBufferSize );
+
+ if( pSvStm->GetError() == ERRCODE_IO_PENDING )
+ {
+ nRead = 0;
+
+ // Damit wir wieder an die alte Position
+ // seeken koennen, setzen wir den Error temp.zurueck
+ pSvStm->ResetError();
+ pSvStm->Seek( nActPos );
+ pSvStm->SetError( ERRCODE_IO_PENDING );
+ }
+ }
+ else
+ nRead = 0;
+
+ return nRead;
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" long StreamWrite( void* pOStm, void* pBuffer, long nBufferSize )
+{
+ return (long) ( (SvStream*) pOStm )->Write( pBuffer, nBufferSize );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" void* CreateBitmap( void* pJPEGReader, long nWidth, long nHeight, long bGray,
+ long* pAlignedWidth, long* pTopDown )
+
+{
+ return ( (JPEGReader*) pJPEGReader )->CreateBitmap( Size( nWidth, nHeight ), (BOOL) bGray,
+ *pAlignedWidth, *pTopDown );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" void* GetScanline( void* pJPEGWriter, long nY )
+{
+ return ( (JPEGWriter*) pJPEGWriter )->GetScanline( nY );
+}
+
+// ------------------------------------------------------------------------
+
+extern "C" long JPEGCallback( void* pCallbackData, long nPercent )
+{
+/*
+ MyCallbackHandler* pH = (MyCallbackHandler*) pCallbackData;
+
+ if ( pH->pCallback )
+ {
+ return (short) (pH->pCallback) ( pH->pCallerData,
+ (USHORT) (pH->nMinPercent+(pH->nMaxPercent-pH->nMinPercent) * nPercent / 100 ) );
+ }
+*/
+
+ return 0L;
+}
+
+// --------------
+// - JPEGReader -
+// --------------
+
+JPEGReader::JPEGReader( SvStream& rStm, void* pCallData ) :
+ rIStm ( rStm ),
+ pAcc ( NULL ),
+ pAcc1 ( NULL ),
+ pBuffer ( NULL ),
+ nLastPos ( rStm.Tell() ),
+ nLastLines ( 0 )
+{
+ maUpperName = String::CreateFromAscii( "SVIJPEG", 7 );
+ nFormerPos = nLastPos;
+}
+
+// ------------------------------------------------------------------------
+
+JPEGReader::~JPEGReader()
+{
+ if( pBuffer )
+ SvMemFree( pBuffer );
+
+ if( pAcc )
+ aBmp.ReleaseAccess( pAcc );
+
+ if( pAcc1 )
+ aBmp1.ReleaseAccess( pAcc1 );
+}
+
+// ------------------------------------------------------------------------
+
+void* JPEGReader::CreateBitmap( const Size& rSize, BOOL bGray,
+ long& rAlignedWidth, long& rTopDown )
+{
+ void* pBmpBuf = NULL;
+
+ if( pAcc )
+ aBmp.ReleaseAccess( pAcc );
+
+ if( bGray )
+ {
+ BitmapPalette aGrayPal( 256 );
+
+ for( USHORT n = 0; n < 256; n++ )
+ {
+ const BYTE cGray = (BYTE) n;
+ aGrayPal[ n ] = BitmapColor( cGray, cGray, cGray );
+ }
+
+ aBmp = Bitmap( rSize, 8, &aGrayPal );
+ }
+ else
+ aBmp = Bitmap( rSize, 24 );
+
+ pAcc = aBmp.AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ const ULONG nFormat = pAcc->GetScanlineFormat();
+
+ if( ( bGray && ( BMP_FORMAT_8BIT_PAL == nFormat ) ) ||
+ ( !bGray && ( BMP_FORMAT_24BIT_TC_BGR == nFormat ) ) )
+ {
+ pBmpBuf = pAcc->GetBuffer();
+ rAlignedWidth = pAcc->GetScanlineSize();
+ rTopDown = pAcc->IsTopDown();
+ }
+ else
+ {
+ rAlignedWidth = AlignedWidth4Bytes( rSize.Width() * ( bGray ? 8 : 24 ) );
+ rTopDown = TRUE;
+ pBmpBuf = pBuffer = SvMemAlloc( rAlignedWidth * rSize.Height() );
+ }
+ }
+
+ return pBmpBuf;
+}
+
+// ------------------------------------------------------------------------
+
+void JPEGReader::FillBitmap()
+{
+ if( pBuffer && pAcc )
+ {
+ HPBYTE pTmp;
+ BitmapColor aColor;
+ long nAlignedWidth;
+ long nWidth = pAcc->Width();
+ long nHeight = pAcc->Height();
+
+ if( pAcc->GetBitCount() == 8 )
+ {
+ BitmapColor* pCols = new BitmapColor[ 256 ];
+
+ for( USHORT n = 0; n < 256; n++ )
+ {
+ const BYTE cGray = (BYTE) n;
+ pCols[ n ] = pAcc->GetBestMatchingColor( BitmapColor( cGray, cGray, cGray ) );
+ }
+
+ nAlignedWidth = AlignedWidth4Bytes( pAcc->Width() * 8L );
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ pTmp = (BYTE*) pBuffer + nY * nAlignedWidth;
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pAcc->SetPixel( nY, nX, pCols[ *pTmp++ ] );
+ }
+
+ delete[] pCols;
+ }
+ else
+ {
+ nAlignedWidth = AlignedWidth4Bytes( pAcc->Width() * 24L );
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ pTmp = (BYTE*) pBuffer + nY * nAlignedWidth;
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aColor.SetBlue( *pTmp++ );
+ aColor.SetGreen( *pTmp++ );
+ aColor.SetRed( *pTmp++ );
+ pAcc->SetPixel( nY, nX, aColor );
+ }
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+Graphic JPEGReader::CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines )
+{
+ Graphic aGraphic;
+ const Size aSizePix( rBitmap.GetSizePixel() );
+
+ if( !nLastLines )
+ {
+ if( pAcc1 )
+ aBmp1.ReleaseAccess( pAcc1 );
+
+ aBmp1 = Bitmap( rBitmap.GetSizePixel(), 1 );
+ aBmp1.Erase( Color( COL_WHITE ) );
+ pAcc1 = aBmp1.AcquireWriteAccess();
+ }
+
+ if( nLines && ( nLines < aSizePix.Height() ) )
+ {
+ if( pAcc1 )
+ {
+ const long nNewLines = nLines - nLastLines;
+
+ if( nNewLines )
+ {
+ pAcc1->SetFillColor( Color( COL_BLACK ) );
+ pAcc1->FillRect( Rectangle( Point( 0, nLastLines ),
+ Size( pAcc1->Width(), nNewLines ) ) );
+ }
+
+ aBmp1.ReleaseAccess( pAcc1 );
+ aGraphic = BitmapEx( rBitmap, aBmp1 );
+ pAcc1 = aBmp1.AcquireWriteAccess();
+ }
+ else
+ aGraphic = rBitmap;
+ }
+ else
+ aGraphic = rBitmap;
+
+ nLastLines = nLines;
+
+ return aGraphic;
+}
+
+// ------------------------------------------------------------------------
+
+ReadState JPEGReader::Read( Graphic& rGraphic )
+{
+ long nEndPos;
+ long nLines;
+ ReadState eReadState;
+ BOOL bRet = FALSE;
+ BYTE cDummy;
+
+ // sehen, ob wir _alles_ lesen koennen
+ rIStm.Seek( STREAM_SEEK_TO_END );
+ rIStm >> cDummy;
+ nEndPos = rIStm.Tell();
+
+ // falls wir nicht alles lesen koennen, gucken wir,
+ // ob min. JPEGMINREAD Bytes gelesen werden koennen
+ if( rIStm.GetError() == ERRCODE_IO_PENDING )
+ {
+ rIStm.ResetError();
+ if( ( nEndPos - nFormerPos ) < JPEGMINREAD )
+ {
+ rIStm.Seek( nLastPos );
+ return JPEGREAD_NEED_MORE;
+ }
+ }
+
+ // an Anfang springen
+ rIStm.Seek( nLastPos );
+
+ // (Teil-) Bild einlesen
+ ReadJPEG( this, &rIStm, &nLines );
+
+ if( pAcc )
+ {
+ if( pBuffer )
+ {
+ FillBitmap();
+ SvMemFree( pBuffer );
+ pBuffer = NULL;
+ }
+
+ aBmp.ReleaseAccess( pAcc );
+ pAcc = NULL;
+
+ if( rIStm.GetError() == ERRCODE_IO_PENDING )
+ rGraphic = CreateIntermediateGraphic( aBmp, nLines );
+ else
+ rGraphic = aBmp;
+
+ bRet = TRUE;
+ }
+ else if( rIStm.GetError() == ERRCODE_IO_PENDING )
+ bRet = TRUE;
+
+ // Status setzen ( Pending hat immer Vorrang )
+ if( rIStm.GetError() == ERRCODE_IO_PENDING )
+ {
+ eReadState = JPEGREAD_NEED_MORE;
+ rIStm.ResetError();
+ nFormerPos = rIStm.Tell();
+ }
+ else
+ {
+ if( bRet )
+ eReadState = JPEGREAD_OK;
+ else
+ eReadState = JPEGREAD_ERROR;
+ }
+
+ return eReadState;
+}
+
+
+// --------------
+// - JPEGWriter -
+// --------------
+
+JPEGWriter::JPEGWriter( SvStream& rStm, PFilterCallback pClb, void* pData, Config* pCfg ) :
+ rOStm ( rStm ),
+ pAcc ( NULL ),
+ pBuffer ( NULL ),
+ pCallback ( pClb ),
+ pCallerData ( pData ),
+ pConfig ( pCfg )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void* JPEGWriter::GetScanline( long nY )
+{
+ void* pScanline = NULL;
+
+ if( pAcc )
+ {
+ if( bNative )
+ pScanline = pAcc->GetScanline( nY );
+ else if( pBuffer )
+ {
+ BitmapColor aColor;
+ long nWidth = pAcc->Width();
+ BYTE* pTmp = pBuffer;
+
+ if( pAcc->HasPalette() )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aColor = pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( nY, nX ) );
+ *pTmp++ = aColor.GetBlue();
+ *pTmp++ = aColor.GetGreen();
+ *pTmp++ = aColor.GetRed();
+ }
+ }
+ else
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aColor = pAcc->GetPixel( nY, nX );
+ *pTmp++ = aColor.GetBlue();
+ *pTmp++ = aColor.GetGreen();
+ *pTmp++ = aColor.GetRed();
+ }
+ }
+
+ pScanline = pBuffer;
+ }
+ }
+
+ return pScanline;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL JPEGWriter::Write( const Graphic& rGraphic )
+{
+ BOOL bRet;
+
+ aBmp = rGraphic.GetBitmap();
+ pAcc = aBmp.AcquireReadAccess();
+
+ if( pAcc )
+ {
+// MyCallbackHandler aCbH;
+
+// aCbH.pCallback = pCallback;
+// aCbH.pCallerData = pCallerData;
+// aCbH.nMinPercent = 0;
+// aCbH.nMaxPercent = 99;
+
+ long nQuality = 75;
+
+ if( pConfig )
+ nQuality = Min( pConfig->ReadKey( "JPG-EXPORT-QUALITY", ByteString::CreateFromInt32(nQuality) ).ToInt32(), (INT32)100 );
+
+ bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR );
+
+ if( !bNative )
+ pBuffer = new BYTE[ AlignedWidth4Bytes( pAcc->Width() * 24L ) ];
+
+ bRet = (BOOL) WriteJPEG( this, &rOStm, pAcc->Width(), pAcc->Height(), nQuality, NULL );
+// bRet = (BOOL) WriteJPEG( this, &rOStm, pAcc->Width(), pAcc->Height(), nQuality, &aCbH );
+
+ delete[] pBuffer;
+ pBuffer = NULL;
+
+ aBmp.ReleaseAccess( pAcc );
+ pAcc = NULL;
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// --------------
+// - ImportJPEG -
+// --------------
+
+BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData )
+{
+ JPEGReader* pJPEGReader = (JPEGReader*) rGraphic.GetContext();
+ ReadState eReadState;
+ BOOL bRet = TRUE;
+
+ if( !pJPEGReader )
+ pJPEGReader = new JPEGReader( rStm, pCallerData );
+
+ rGraphic.SetContext( NULL );
+ eReadState = pJPEGReader->Read( rGraphic );
+
+ if( eReadState == JPEGREAD_ERROR )
+ {
+ bRet = FALSE;
+ delete pJPEGReader;
+ }
+ else if( eReadState == JPEGREAD_OK )
+ delete pJPEGReader;
+ else
+ rGraphic.SetContext( pJPEGReader );
+
+ const GraphicType eType = rGraphic.GetType();
+
+ if( eType != GRAPHIC_BITMAP )
+ {
+ ;
+ }
+
+ return bRet;
+}
+
+// --------------
+// - ExportJPEG -
+// --------------
+
+BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic,
+ PFilterCallback pCallback, void* pCallerData, Config* pOptionsConfig )
+{
+ JPEGWriter aJPEGWriter( rOStm, pCallback, pCallerData, pOptionsConfig );
+ return aJPEGWriter.Write( rGraphic );
+}
diff --git a/svtools/source/filter.vcl/jpeg/makefile.mk b/svtools/source/filter.vcl/jpeg/makefile.mk
new file mode 100644
index 000000000000..5a714ad0fb73
--- /dev/null
+++ b/svtools/source/filter.vcl/jpeg/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SVTOOLS
+TARGET=jpeg
+DEPTARGET=vjpeg
+TARGET2=jpg
+
+
+# --- Settings -----------------------------------------------------------
+
+.IF "$(VCL)" != ""
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+.IF "$(GUI)$(CPU)"=="WNTP"
+CFLAGS=$(CFLAGS) -Od
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+
+SLOFILES= $(SLO)$/jpeg.obj
+
+.INCLUDE : target.mk
+
+.ELSE
+
+dummy:
+ @+echo VCL not set. nothing to do!
+
+.ENDIF #VCL
diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx
new file mode 100644
index 000000000000..3e504f830b0e
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/emfwr.cxx
@@ -0,0 +1,1207 @@
+/*************************************************************************
+ *
+ * $RCSfile: emfwr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "emfwr.hxx"
+#include <vcl/salbtype.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define WIN_EMR_HEADER 1
+#define WIN_EMR_POLYBEZIER 2
+#define WIN_EMR_POLYGON 3
+#define WIN_EMR_POLYLINE 4
+#define WIN_EMR_POLYBEZIERTO 5
+#define WIN_EMR_POLYLINETO 6
+#define WIN_EMR_POLYPOLYLINE 7
+#define WIN_EMR_POLYPOLYGON 8
+#define WIN_EMR_SETWINDOWEXTEX 9
+#define WIN_EMR_SETWINDOWORGEX 10
+#define WIN_EMR_SETVIEWPORTEXTEX 11
+#define WIN_EMR_SETVIEWPORTORGEX 12
+#define WIN_EMR_SETBRUSHORGEX 13
+#define WIN_EMR_EOF 14
+#define WIN_EMR_SETPIXELV 15
+#define WIN_EMR_SETMAPPERFLAGS 16
+#define WIN_EMR_SETMAPMODE 17
+#define WIN_EMR_SETBKMODE 18
+#define WIN_EMR_SETPOLYFILLMODE 19
+#define WIN_EMR_SETROP2 20
+#define WIN_EMR_SETSTRETCHBLTMODE 21
+#define WIN_EMR_SETTEXTALIGN 22
+#define WIN_EMR_SETCOLORADJUSTMENT 23
+#define WIN_EMR_SETTEXTCOLOR 24
+#define WIN_EMR_SETBKCOLOR 25
+#define WIN_EMR_OFFSETCLIPRGN 26
+#define WIN_EMR_MOVETOEX 27
+#define WIN_EMR_SETMETARGN 28
+#define WIN_EMR_EXCLUDECLIPRECT 29
+#define WIN_EMR_INTERSECTCLIPRECT 30
+#define WIN_EMR_SCALEVIEWPORTEXTEX 31
+#define WIN_EMR_SCALEWINDOWEXTEX 32
+#define WIN_EMR_SAVEDC 33
+#define WIN_EMR_RESTOREDC 34
+#define WIN_EMR_SETWORLDTRANSFORM 35
+#define WIN_EMR_MODIFYWORLDTRANSFORM 36
+#define WIN_EMR_SELECTOBJECT 37
+#define WIN_EMR_CREATEPEN 38
+#define WIN_EMR_CREATEBRUSHINDIRECT 39
+#define WIN_EMR_DELETEOBJECT 40
+#define WIN_EMR_ANGLEARC 41
+#define WIN_EMR_ELLIPSE 42
+#define WIN_EMR_RECTANGLE 43
+#define WIN_EMR_ROUNDRECT 44
+#define WIN_EMR_ARC 45
+#define WIN_EMR_CHORD 46
+#define WIN_EMR_PIE 47
+#define WIN_EMR_SELECTPALETTE 48
+#define WIN_EMR_CREATEPALETTE 49
+#define WIN_EMR_SETPALETTEENTRIES 50
+#define WIN_EMR_RESIZEPALETTE 51
+#define WIN_EMR_REALIZEPALETTE 52
+#define WIN_EMR_EXTFLOODFILL 53
+#define WIN_EMR_LINETO 54
+#define WIN_EMR_ARCTO 55
+#define WIN_EMR_POLYDRAW 56
+#define WIN_EMR_SETARCDIRECTION 57
+#define WIN_EMR_SETMITERLIMIT 58
+#define WIN_EMR_BEGINPATH 59
+#define WIN_EMR_ENDPATH 60
+#define WIN_EMR_CLOSEFIGURE 61
+#define WIN_EMR_FILLPATH 62
+#define WIN_EMR_STROKEANDFILLPATH 63
+#define WIN_EMR_STROKEPATH 64
+#define WIN_EMR_FLATTENPATH 65
+#define WIN_EMR_WIDENPATH 66
+#define WIN_EMR_SELECTCLIPPATH 67
+#define WIN_EMR_ABORTPATH 68
+
+#define WIN_EMR_GDICOMMENT 70
+#define WIN_EMR_FILLRGN 71
+#define WIN_EMR_FRAMERGN 72
+#define WIN_EMR_INVERTRGN 73
+#define WIN_EMR_PAINTRGN 74
+#define WIN_EMR_EXTSELECTCLIPRGN 75
+#define WIN_EMR_BITBLT 76
+#define WIN_EMR_STRETCHBLT 77
+#define WIN_EMR_MASKBLT 78
+#define WIN_EMR_PLGBLT 79
+#define WIN_EMR_SETDIBITSTODEVICE 80
+#define WIN_EMR_STRETCHDIBITS 81
+#define WIN_EMR_EXTCREATEFONTINDIRECTW 82
+#define WIN_EMR_EXTTEXTOUTA 83
+#define WIN_EMR_EXTTEXTOUTW 84
+#define WIN_EMR_POLYBEZIER16 85
+#define WIN_EMR_POLYGON16 86
+#define WIN_EMR_POLYLINE16 87
+#define WIN_EMR_POLYBEZIERTO16 88
+#define WIN_EMR_POLYLINETO16 89
+#define WIN_EMR_POLYPOLYLINE16 90
+#define WIN_EMR_POLYPOLYGON16 91
+#define WIN_EMR_POLYDRAW16 92
+#define WIN_EMR_CREATEMONOBRUSH 93
+#define WIN_EMR_CREATEDIBPATTERNBRUSHPT 94
+#define WIN_EMR_EXTCREATEPEN 95
+#define WIN_EMR_POLYTEXTOUTA 96
+#define WIN_EMR_POLYTEXTOUTW 97
+
+#define WIN_SRCCOPY 0x00CC0020L
+#define WIN_SRCPAINT 0x00EE0086L
+#define WIN_SRCAND 0x008800C6L
+#define WIN_SRCINVERT 0x00660046L
+
+#define HANDLE_INVALID 0xffffffff
+#define MAXHANDLES 65000
+
+#define LINE_SELECT 0x00000001
+#define FILL_SELECT 0x00000002
+#define TEXT_SELECT 0x00000004
+
+// -------------
+// - EMFWriter -
+// -------------
+
+BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm,
+ PFilterCallback pCallback, void* pCallerData )
+{
+ const ULONG nHeaderPos = rOStm.Tell();
+
+ mpHandlesUsed = new BOOL[ MAXHANDLES ];
+ HMEMSET( mpHandlesUsed, 0, MAXHANDLES * sizeof( BOOL ) );
+ mnHandleCount = mnLastPercent = mnRecordPos = mnRecordCount = 0;
+ mnLineHandle = mnFillHandle = mnTextHandle = HANDLE_INVALID;
+ mbRecordOpen = FALSE;
+
+ mpStm = &rOStm;
+ mpCallback = pCallback;
+ mpCallerData = pCallerData;
+ maVDev.EnableOutput( FALSE );
+ maVDev.SetMapMode( rMtf.GetPrefMapMode() );
+
+ const Size aMtfSizePix( maVDev.LogicToPixel( rMtf.GetPrefSize(), rMtf.GetPrefMapMode() ) );
+ const Size aMtfSizeLog( maVDev.LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_100TH_MM ) );
+
+ // seek over header
+ rOStm.SeekRel( 100 );
+
+ // write initial values
+ ImplBeginRecord( WIN_EMR_SETWINDOWORGEX );
+ (*mpStm) << (INT32) 0 << (INT32) 0;
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SETWINDOWEXTEX );
+ (*mpStm) << (INT32) aMtfSizePix.Width() << (INT32) aMtfSizePix.Height();
+ ImplEndRecord();
+
+ ImplWriteRasterOp( ROP_OVERPAINT );
+
+ ImplBeginRecord( WIN_EMR_SETBKMODE );
+ (*mpStm) << (UINT32) 1; // TRANSPARENT
+ ImplEndRecord();
+
+ // write emf data
+ ImplWrite( rMtf );
+
+ // write header
+ const ULONG nEndPos = mpStm->Tell(); mpStm->Seek( nHeaderPos );
+
+ (*mpStm) << (UINT32) 0x00000001 << (UINT32) 100;
+ (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizePix.Width() - 1 ) << (INT32) ( aMtfSizePix.Height() - 1 );
+ (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizeLog.Width() - 1 ) << (INT32) ( aMtfSizeLog.Height() - 1 );
+ (*mpStm) << (UINT32) 0x464d4520 << (UINT32) 0x10000 << (UINT32) ( nEndPos - nHeaderPos );
+ (*mpStm) << (UINT32) mnRecordCount << (UINT16) ( mnHandleCount + 1 ) << (UINT16) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0;
+ (*mpStm) << (INT32) aMtfSizePix.Width() << (INT32) aMtfSizePix.Height();
+ (*mpStm) << (INT32) ( aMtfSizeLog.Width() / 100 ) << (INT32) ( aMtfSizeLog.Height() / 100 );
+ (*mpStm) << (UINT32) 0 << (UINT32) 0 << (UINT32) 0;
+
+ mpStm->Seek( nEndPos );
+ delete[] mpHandlesUsed;
+
+ return( mpStm->GetError() == ERRCODE_NONE );
+}
+
+// -----------------------------------------------------------------------------
+
+ULONG EMFWriter::ImplAcquireHandle()
+{
+ ULONG nHandle = HANDLE_INVALID;
+
+ for( ULONG i = 0; i < MAXHANDLES && ( HANDLE_INVALID == nHandle ); i++ )
+ {
+ if( !mpHandlesUsed[ i ] )
+ {
+ mpHandlesUsed[ i ] = TRUE;
+
+ if( ( nHandle = i ) == mnHandleCount )
+ mnHandleCount++;
+ }
+ }
+
+ DBG_ASSERT( nHandle != HANDLE_INVALID, "No more handles available" );
+ return( nHandle != HANDLE_INVALID ? nHandle + 1 : HANDLE_INVALID );
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplReleaseHandle( ULONG nHandle )
+{
+ DBG_ASSERT( nHandle && ( nHandle < MAXHANDLES ), "Handle out of range" );
+ mpHandlesUsed[ nHandle - 1 ] = FALSE;
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplBeginRecord( ULONG nType )
+{
+ DBG_ASSERT( !mbRecordOpen, "Another record is already opened!" );
+
+ if( !mbRecordOpen )
+ {
+ mbRecordOpen = TRUE;
+ mnRecordPos = mpStm->Tell();
+
+ (*mpStm) << nType;
+ mpStm->SeekRel( 4 );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplEndRecord()
+{
+ DBG_ASSERT( mbRecordOpen, "Record was not opened!" );
+
+ if( mbRecordOpen )
+ {
+ const ULONG nActPos = mpStm->Tell();
+
+ mpStm->Seek( mnRecordPos + 4 );
+ ( *mpStm ) << ( nActPos - mnRecordPos );
+ mpStm->Seek( nActPos );
+
+ mnRecordCount++;
+ mbRecordOpen = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL EMFWriter::ImplPrepareHandleSelect( ULONG& rHandle, ULONG nSelectType )
+{
+ if( rHandle != HANDLE_INVALID )
+ {
+ UINT32 nStockObject = 0x80000000;
+
+ if( LINE_SELECT == nSelectType )
+ nStockObject |= 0x00000007;
+ else if( FILL_SELECT == nSelectType )
+ nStockObject |= 0x00000001;
+ else if( TEXT_SELECT == nSelectType )
+ nStockObject |= 0x0000000a;
+
+ // select stock object first
+ ImplBeginRecord( WIN_EMR_SELECTOBJECT );
+ ( *mpStm ) << nStockObject;
+ ImplEndRecord();
+
+ // destroy handle of created object
+ ImplBeginRecord( WIN_EMR_DELETEOBJECT );
+ ( *mpStm ) << rHandle;
+ ImplEndRecord();
+
+ // mark handle as free
+ ImplReleaseHandle( rHandle );
+ }
+
+ rHandle = ImplAcquireHandle();
+
+ return( HANDLE_INVALID != rHandle );
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplCheckLineAttr()
+{
+ if( mbLineChanged && ImplPrepareHandleSelect( mnLineHandle, LINE_SELECT ) )
+ {
+ ULONG nStyle = maVDev.IsLineColor() ? 0 : 5;
+ ULONG nWidth = 0, nHeight = 0;
+
+ ImplBeginRecord( WIN_EMR_CREATEPEN );
+ (*mpStm) << mnLineHandle << nStyle << nWidth << nHeight;
+ ImplWriteColor( maVDev.GetLineColor() );
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SELECTOBJECT );
+ (*mpStm) << mnLineHandle;
+ ImplEndRecord();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplCheckFillAttr()
+{
+ if( mbFillChanged && ImplPrepareHandleSelect( mnFillHandle, FILL_SELECT ) )
+ {
+ ULONG nStyle = maVDev.IsFillColor() ? 0 : 1;
+ ULONG nPatternStyle = 0;
+
+ ImplBeginRecord( WIN_EMR_CREATEBRUSHINDIRECT );
+ (*mpStm) << mnFillHandle << nStyle;
+ ImplWriteColor( maVDev.GetFillColor() );
+ (*mpStm) << nPatternStyle;
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SELECTOBJECT );
+ (*mpStm) << mnFillHandle;
+ ImplEndRecord();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplCheckTextAttr()
+{
+ if( mbTextChanged && ImplPrepareHandleSelect( mnTextHandle, TEXT_SELECT ) )
+ {
+ const Font& rFont = maVDev.GetFont();
+ String aFontName( rFont.GetName() );
+ INT32 i, nWeight;
+ BYTE nPitchAndFamily;
+
+ ImplBeginRecord( WIN_EMR_EXTCREATEFONTINDIRECTW );
+ (*mpStm) << mnTextHandle;
+ ImplWriteExtent( rFont.GetSize().Height() );
+ ImplWriteExtent( rFont.GetSize().Width() );
+ (*mpStm) << (INT32) rFont.GetOrientation() << (INT32) rFont.GetOrientation();
+
+ switch( rFont.GetWeight() )
+ {
+ case WEIGHT_THIN: nWeight = 100; break;
+ case WEIGHT_ULTRALIGHT: nWeight = 200; break;
+ case WEIGHT_LIGHT: nWeight = 300; break;
+ case WEIGHT_SEMILIGHT: nWeight = 300; break;
+ case WEIGHT_NORMAL: nWeight = 400; break;
+ case WEIGHT_MEDIUM: nWeight = 500; break;
+ case WEIGHT_SEMIBOLD: nWeight = 600; break;
+ case WEIGHT_BOLD: nWeight = 700; break;
+ case WEIGHT_ULTRABOLD: nWeight = 800; break;
+ case WEIGHT_BLACK: nWeight = 900; break;
+ default: nWeight = 0; break;
+ }
+
+ (*mpStm) << nWeight;
+ (*mpStm) << (BYTE) ( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 );
+ (*mpStm) << (BYTE) ( ( UNDERLINE_NONE == rFont.GetUnderline() ) ? 0 : 1 );
+ (*mpStm) << (BYTE) ( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 );
+ (*mpStm) << (BYTE) ( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 );
+ (*mpStm) << (BYTE) 0 << (BYTE) 0 << (BYTE) 0;
+
+ switch( rFont.GetPitch() )
+ {
+ case PITCH_FIXED: nPitchAndFamily = 0x01; break;
+ case PITCH_VARIABLE: nPitchAndFamily = 0x02; break;
+ default: nPitchAndFamily = 0x00; break;
+ }
+
+ switch( rFont.GetFamily() )
+ {
+ case FAMILY_DECORATIVE: nPitchAndFamily |= 0x50; break;
+ case FAMILY_MODERN: nPitchAndFamily |= 0x30; break;
+ case FAMILY_ROMAN: nPitchAndFamily |= 0x10; break;
+ case FAMILY_SCRIPT: nPitchAndFamily |= 0x40; break;
+ case FAMILY_SWISS: nPitchAndFamily |= 0x20; break;
+ default: break;
+ }
+
+ (*mpStm) << nPitchAndFamily;
+
+ for( i = 0; i < 32; i++ )
+ (*mpStm) << (sal_Unicode) ( ( i < aFontName.Len() ) ? aFontName.GetChar( i ) : 0 );
+
+ // dummy elfFullName
+ for( i = 0; i < 64; i++ )
+ (*mpStm) << (sal_Unicode) 0;
+
+ // dummy elfStyle
+ for( i = 0; i < 32; i++ )
+ (*mpStm) << (sal_Unicode) 0;
+
+ // dummy elfVersion, elfStyleSize, elfMatch, elfReserved
+ (*mpStm) << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 ;
+
+ // dummy elfVendorId
+ (*mpStm) << (UINT32) 0;
+
+ // dummy elfCulture
+ (*mpStm) << (UINT32) 0;
+
+ // dummy elfPanose
+ (*mpStm) << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0;
+
+ // fill record to get a record size divideable by 4
+ (*mpStm) << (UINT16) 0;
+
+ ImplEndRecord();
+
+ // TextAlign
+ UINT32 nTextAlign;
+
+ switch( rFont.GetAlign() )
+ {
+ case ALIGN_TOP: nTextAlign = 0; break;
+ case ALIGN_BOTTOM: nTextAlign = 8; break;
+ default: nTextAlign = 24; break;
+ }
+
+ ImplBeginRecord( WIN_EMR_SETTEXTALIGN );
+ (*mpStm) << nTextAlign;
+ ImplEndRecord();
+
+ // Text color
+ ImplBeginRecord( WIN_EMR_SETTEXTCOLOR );
+ ImplWriteColor( rFont.GetColor() );
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SELECTOBJECT );
+ (*mpStm) << mnTextHandle;
+ ImplEndRecord();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWriteColor( const Color& rColor )
+{
+ UINT32 nCol = rColor.GetRed();
+
+ nCol |= ( (UINT32) rColor.GetGreen() ) << 8;
+ nCol |= ( (UINT32) rColor.GetBlue() ) << 16;
+
+ (*mpStm) << nCol;
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWriteRasterOp( RasterOp eRop )
+{
+ UINT32 nROP2;
+
+ switch( eRop )
+ {
+ case ROP_INVERT: nROP2 = 6; break;
+ case ROP_XOR: nROP2 = 7; break;
+ default: nROP2 = 13;break;
+ }
+
+ ImplBeginRecord( WIN_EMR_SETROP2 );
+ (*mpStm) << nROP2;
+ ImplEndRecord();
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWriteExtent( long nExtent )
+{
+ const Size aSize( maVDev.LogicToPixel( Size( nExtent, nExtent ) ) );
+ (*mpStm) << (INT32) aSize.Width();
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWritePoint( const Point& rPoint )
+{
+ const Point aPoint( maVDev.LogicToPixel( rPoint ) );
+
+ (*mpStm) << (INT32) aPoint.X() << (INT32) aPoint.Y();
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWriteSize( const Size& rSize)
+{
+ const Size aSize( maVDev.LogicToPixel( rSize ) );
+
+ (*mpStm) << (INT32) aSize.Width() << (INT32) aSize.Height();
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWriteRect( const Rectangle& rRect )
+{
+ const Rectangle aRect( maVDev.LogicToPixel( rRect ) );
+
+ (*mpStm) << aRect.Left() << aRect.Top() << aRect.Right() << aRect.Bottom();
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWritePolygonRecord( const Polygon& rPoly, BOOL bClose )
+{
+ if( rPoly.GetSize() )
+ {
+ if( bClose )
+ ImplCheckFillAttr();
+
+ ImplCheckLineAttr();
+
+ ImplBeginRecord( bClose ? WIN_EMR_POLYGON : WIN_EMR_POLYLINE );
+ ImplWriteRect( rPoly.GetBoundRect() );
+ (*mpStm) << (UINT32) rPoly.GetSize();
+
+ for( USHORT i = 0; i < rPoly.GetSize(); i++ )
+ ImplWritePoint( rPoly[ i ] );
+
+ ImplEndRecord();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly )
+{
+ const UINT32 nPolyCount = rPolyPoly.Count();
+
+ if( nPolyCount )
+ {
+ if( 1 == nPolyCount )
+ ImplWritePolygonRecord( rPolyPoly[ 0 ], TRUE );
+ else
+ {
+ UINT32 nTotalPoints = 0, i;
+
+ for( i = 0; i < nPolyCount; i++ )
+ nTotalPoints += rPolyPoly[ i ].GetSize();
+
+ if( nTotalPoints )
+ {
+ ImplCheckFillAttr();
+ ImplCheckLineAttr();
+
+ ImplBeginRecord( WIN_EMR_POLYPOLYGON );
+ ImplWriteRect( rPolyPoly.GetBoundRect() );
+ (*mpStm) << nPolyCount << nTotalPoints;
+
+ for( i = 0; i < nPolyCount; i++ )
+ (*mpStm) << (UINT32) rPolyPoly[ i ].GetSize();
+
+ for( i = 0; i < nPolyCount; i++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ i ];
+
+ for( USHORT n = 0; n < rPoly.GetSize(); n++ )
+ ImplWritePoint( rPoly[ n ] );
+ }
+
+ ImplEndRecord();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt,
+ const Size& rSz, UINT32 nROP )
+{
+ if( !!rBmp )
+ {
+ SvMemoryStream aMemStm( 65535, 65535 );
+ const Size aBmpSizePixel( rBmp.GetSizePixel() );
+
+ ImplBeginRecord( WIN_EMR_STRETCHDIBITS );
+ ImplWriteRect( Rectangle( rPt, rSz ) );
+ ImplWritePoint( rPt );
+ (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) aBmpSizePixel.Width() << (INT32) aBmpSizePixel.Height();
+
+ // write offset positions and sizes later
+ const ULONG nOffPos = mpStm->Tell();
+ mpStm->SeekRel( 16 );
+
+ (*mpStm) << (UINT32) 0 << ( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP );
+ ImplWriteSize( rSz );
+
+ rBmp.Write( aMemStm, TRUE, FALSE );
+
+ UINT32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize;
+ UINT16 nBitCount;
+
+ // get DIB parameters
+ aMemStm.Seek( 0 );
+ aMemStm >> nHeaderSize;
+ aMemStm.SeekRel( 10 );
+ aMemStm >> nBitCount >> nCompression >> nImageSize;
+ aMemStm.SeekRel( 8 );
+ aMemStm >> nColsUsed;
+
+ nPalCount = ( nBitCount <= 8 ) ? ( nColsUsed ? nColsUsed : ( 1 << (UINT32) nBitCount ) ) :
+ ( ( 3 == nCompression ) ? 12 : 0 );
+
+ mpStm->Write( aMemStm.GetData(), nDIBSize );
+
+ const ULONG nEndPos = mpStm->Tell();
+ mpStm->Seek( nOffPos );
+ (*mpStm) << (UINT32) 80 << (UINT32)( nHeaderSize + ( nPalCount << 2 ) );
+ (*mpStm) << (UINT32)( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ) << nImageSize;
+ mpStm->Seek( nEndPos );
+
+ ImplEndRecord();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, const long* pDXArray, UINT32 nWidth )
+{
+ UINT32 nLen = rText.Len(), i;
+
+ if( nLen )
+ {
+ sal_Int32 nNormWidth;
+ long* pOwnArray;
+ long* pDX;
+
+ // get text sizes
+ if( pDXArray )
+ {
+ pOwnArray = NULL;
+ nNormWidth = maVDev.GetTextWidth( rText );
+ pDX = (long*) pDXArray;
+ }
+ else
+ {
+ pOwnArray = new long[ nLen ];
+ nNormWidth = maVDev.GetTextArray( rText, pOwnArray );
+ pDX = pOwnArray;
+ }
+
+ if( nLen > 1 )
+ {
+ nNormWidth = pDX[ nLen - 2 ] + maVDev.GetTextWidth( rText.GetChar( nLen - 1 ) );
+
+ if( nWidth && nNormWidth && ( nWidth != nNormWidth ) )
+ {
+ const double fFactor = (double) nWidth / nNormWidth;
+
+ for( i = 0; i < ( nLen - 1 ); i++ )
+ pDX[ i ] = FRound( pDX[ i ] * fFactor );
+ }
+ }
+
+ // write text record
+ ImplBeginRecord( WIN_EMR_EXTTEXTOUTW );
+
+ ImplWriteRect( Rectangle( rPos, Size( nNormWidth, maVDev.GetTextHeight() ) ) );
+ (*mpStm) << (UINT32) 2; // GM_ADVANCED
+ (*mpStm) << (INT32) 0 << (INT32) 0;
+ ImplWritePoint( rPos );
+ (*mpStm) << (UINT32) nLen << (UINT32) 76 << (UINT32) 2;
+ (*mpStm) << (INT32) 0 << (INT32) 0 << (INT32) 0 << (INT32) 0;
+ (*mpStm) << (UINT32) ( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) );
+
+ // write text
+ for( i = 0; i < nLen; i++ )
+ (*mpStm) << (sal_Unicode)rText.GetChar( i );
+
+ // padding word
+ if( nLen & 1 )
+ (*mpStm) << (UINT16) 0;
+
+ // write DX array
+ ImplWriteExtent( pDX[ 0 ] );
+
+ if( nLen > 1 )
+ {
+ for( i = 1; i < ( nLen - 1 ); i++ )
+ ImplWriteExtent( pDX[ i ] - pDX[ i - 1 ] );
+
+ ImplWriteExtent( pDX[ nLen - 2 ] / ( nLen - 1 ) );
+ }
+
+ ImplEndRecord();
+ delete[] pOwnArray;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
+{
+ for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
+ {
+ const MetaAction* pAction = rMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
+
+ ImplCheckLineAttr();
+ ImplBeginRecord( WIN_EMR_SETPIXELV );
+ ImplWritePoint( pA->GetPoint() );
+ ImplWriteColor( pA->GetColor() );
+ ImplEndRecord();
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ if( maVDev.IsLineColor() )
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pAction;
+
+ ImplCheckLineAttr();
+ ImplBeginRecord( WIN_EMR_SETPIXELV );
+ ImplWritePoint( pA->GetPoint() );
+ ImplWriteColor( maVDev.GetLineColor() );
+ ImplEndRecord();
+ }
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ if( maVDev.IsLineColor() )
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pAction;
+
+ ImplCheckLineAttr();
+
+ ImplBeginRecord( WIN_EMR_MOVETOEX );
+ ImplWritePoint( pA->GetStartPoint() );
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_LINETO );
+ ImplWritePoint( pA->GetEndPoint() );
+ ImplEndRecord();
+
+ ImplBeginRecord( WIN_EMR_SETPIXELV );
+ ImplWritePoint( pA->GetEndPoint() );
+ ImplWriteColor( maVDev.GetLineColor() );
+ ImplEndRecord();
+ }
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pAction;
+
+ ImplCheckFillAttr();
+ ImplCheckLineAttr();
+
+ ImplBeginRecord( WIN_EMR_RECTANGLE );
+ ImplWriteRect( pA->GetRect() );
+ ImplEndRecord();
+ }
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
+
+ ImplCheckFillAttr();
+ ImplCheckLineAttr();
+
+ ImplBeginRecord( WIN_EMR_ROUNDRECT );
+ ImplWriteRect( pA->GetRect() );
+ ImplWriteSize( Size( pA->GetHorzRound(), pA->GetVertRound() ) );
+ ImplEndRecord();
+ }
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
+
+ ImplCheckFillAttr();
+ ImplCheckLineAttr();
+
+ ImplBeginRecord( WIN_EMR_ELLIPSE );
+ ImplWriteRect( pA->GetRect() );
+ ImplEndRecord();
+ }
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ case( META_PIE_ACTION ):
+ case( META_CHORD_ACTION ):
+ case( META_POLYGON_ACTION ):
+ {
+ if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ {
+ Polygon aPoly;
+
+ switch( nType )
+ {
+ case( META_ARC_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ const MetaPieAction* pA = (const MetaPieAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ aPoly = ( (const MetaPolygonAction*) pAction )->GetPolygon();
+ break;
+ }
+
+ ImplWritePolygonRecord( aPoly, nType != META_ARC_ACTION );
+ }
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ if( maVDev.IsLineColor() )
+ ImplWritePolygonRecord( ( (const MetaPolyLineAction*) pAction )->GetPolygon(), FALSE );
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ if( maVDev.IsLineColor() || maVDev.IsFillColor() )
+ ImplWritePolyPolygonRecord( ( (const MetaPolyPolygonAction*) pAction )->GetPolyPolygon() );
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+ GDIMetaFile aTmpMtf;
+
+ maVDev.AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ ImplWrite( aTmpMtf );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
+ GDIMetaFile aTmpMtf;
+
+ maVDev.AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ ImplWrite( aTmpMtf );
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ ImplCheckFillAttr();
+ ImplCheckLineAttr();
+ ImplWritePolyPolygonRecord( ( (MetaTransparentAction*) pAction )->GetPolyPolygon() );
+ }
+ break;
+
+ case META_FLOATTRANSPARENT_ACTION:
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aTmpMtf.Move( nMoveX, nMoveY );
+
+ ImplCheckFillAttr();
+ ImplCheckLineAttr();
+ ImplCheckTextAttr();
+ ImplWrite( aTmpMtf );
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+ sal_Bool bFound = sal_False;
+
+ for( ULONG i = 0, nCount = aGDIMetaFile.GetActionCount(); ( i < nCount ) && !bFound; i++ )
+ {
+ const MetaAction* pSubstAct = aGDIMetaFile.GetAction( i );
+
+ if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ bFound = sal_True;
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pAction;
+ ImplWriteBmpRecord( pBmpScaleAction->GetBitmap(), pBmpScaleAction->GetPoint(),
+ pBmpScaleAction->GetSize(), WIN_SRCCOPY );
+ }
+ }
+ }
+ break;
+
+ case META_BMP_ACTION:
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction *) pAction;
+ ImplWriteBmpRecord( pA->GetBitmap(), pA->GetPoint(), pA->GetBitmap().GetSizePixel(), WIN_SRCCOPY );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
+ ImplWriteBmpRecord( pA->GetBitmap(), pA->GetPoint(), pA->GetSize(), WIN_SRCCOPY );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
+ Bitmap aTmp( pA->GetBitmap() );
+
+ if( aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ) )
+ ImplWriteBmpRecord( aTmp, pA->GetDestPoint(), pA->GetDestSize(), WIN_SRCCOPY );
+ }
+ break;
+
+ case META_BMPEX_ACTION:
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction *) pAction;
+ Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
+ Bitmap aMsk( pA->GetBitmapEx().GetMask() );
+
+ if( !!aMsk )
+ {
+ aBmp.Replace( aMsk, COL_WHITE );
+ aMsk.Invert();
+ ImplWriteBmpRecord( aMsk, pA->GetPoint(), aMsk.GetSizePixel(), WIN_SRCPAINT );
+ ImplWriteBmpRecord( aBmp, pA->GetPoint(), aBmp.GetSizePixel(), WIN_SRCAND );
+ }
+ else
+ ImplWriteBmpRecord( aBmp, pA->GetPoint(), aBmp.GetSizePixel(), WIN_SRCCOPY );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
+ Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
+ Bitmap aMsk( pA->GetBitmapEx().GetMask() );
+
+ if( !!aMsk )
+ {
+ aBmp.Replace( aMsk, COL_WHITE );
+ aMsk.Invert();
+ ImplWriteBmpRecord( aMsk, pA->GetPoint(), pA->GetSize(), WIN_SRCPAINT );
+ ImplWriteBmpRecord( aBmp, pA->GetPoint(), pA->GetSize(), WIN_SRCAND );
+ }
+ else
+ ImplWriteBmpRecord( aBmp, pA->GetPoint(), pA->GetSize(), WIN_SRCCOPY );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
+ BitmapEx aBmpEx( pA->GetBitmapEx() );
+ aBmpEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+ Bitmap aMsk( aBmpEx.GetMask() );
+
+ if( !!aMsk )
+ {
+ aBmp.Replace( aMsk, COL_WHITE );
+ aMsk.Invert();
+ ImplWriteBmpRecord( aMsk, pA->GetDestPoint(), pA->GetDestSize(), WIN_SRCPAINT );
+ ImplWriteBmpRecord( aBmp, pA->GetDestPoint(), pA->GetDestSize(), WIN_SRCAND );
+ }
+ else
+ ImplWriteBmpRecord( aBmp, pA->GetDestPoint(), pA->GetDestSize(), WIN_SRCCOPY );
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+ const String aText( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+
+ ImplCheckTextAttr();
+ ImplWriteTextRecord( pA->GetPoint(), aText, NULL, 0 );
+ }
+ break;
+
+ case META_TEXTRECT_ACTION:
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+ const String aText( pA->GetText() );
+
+ ImplCheckTextAttr();
+ ImplWriteTextRecord( pA->GetRect().TopLeft(), aText, NULL, 0 );
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ const String aText( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+
+ ImplCheckTextAttr();
+ ImplWriteTextRecord( pA->GetPoint(), aText, pA->GetDXArray(), 0 );
+ }
+ break;
+
+ case META_STRETCHTEXT_ACTION:
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+ const String aText( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+
+ ImplCheckTextAttr();
+ ImplWriteTextRecord( pA->GetPoint(), aText, NULL, pA->GetWidth() );
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+ mbLineChanged = TRUE;
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+ mbFillChanged = TRUE;
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ case( META_TEXTLINECOLOR_ACTION ):
+ case( META_TEXTFILLCOLOR_ACTION ):
+ case( META_TEXTALIGN_ACTION ):
+ case( META_FONT_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+ mbTextChanged = TRUE;
+ }
+ break;
+
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+
+ ImplBeginRecord( WIN_EMR_INTERSECTCLIPRECT );
+ ImplWriteRect( ( (MetaISectRectClipRegionAction*) pAction )->GetRect() );
+ ImplEndRecord();
+ }
+ break;
+
+ case( META_CLIPREGION_ACTION ):
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+ }
+ break;
+
+ case( META_REFPOINT_ACTION ):
+ case( META_MAPMODE_ACTION ):
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+ break;
+
+ case( META_PUSH_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+
+ ImplBeginRecord( WIN_EMR_SAVEDC );
+ ImplEndRecord();
+ }
+ break;
+
+ case( META_POP_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+
+ ImplBeginRecord( WIN_EMR_RESTOREDC );
+ (*mpStm) << (INT32) -1;
+ ImplEndRecord();
+
+ ImplWriteRasterOp( maVDev.GetRasterOp() );
+ mbLineChanged = mbFillChanged = mbTextChanged = TRUE;
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( &maVDev );
+ ImplWriteRasterOp( ( (MetaRasterOpAction*) pAction )->GetRasterOp() );
+ }
+ break;
+
+ case( META_MASK_ACTION ):
+ case( META_MASKSCALE_ACTION ):
+ case( META_MASKSCALEPART_ACTION ):
+ case( META_WALLPAPER_ACTION ):
+ case( META_TEXTLINE_ACTION ):
+ case( META_COMMENT_ACTION ):
+ case( META_GRADIENTEX_ACTION ):
+ {
+ // !!! >>> we don't want to support these actions
+ }
+ break;
+
+ default:
+ DBG_ERROR( ( ByteString( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" ) += ByteString( nType ) ).GetBuffer() );
+ break;
+ }
+ }
+}
diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx
new file mode 100644
index 000000000000..f88edaeb92a6
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/emfwr.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: emfwr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _EMFWR_HXX
+#define _EMFWR_HXX
+
+#include <tools/debug.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/virdev.hxx>
+#include "fltcall.hxx"
+
+// -------------
+// - EMFWriter -
+// -------------
+
+class EMFWriter
+{
+private:
+
+ VirtualDevice maVDev;
+ PFilterCallback mpCallback;
+ void* mpCallerData;
+ SvStream* mpStm;
+ BOOL* mpHandlesUsed;
+ ULONG mnHandleCount;
+ ULONG mnLastPercent;
+ ULONG mnRecordCount;
+ ULONG mnRecordPos;
+ BOOL mbRecordOpen;
+ BOOL mbLineChanged;
+ ULONG mnLineHandle;
+ BOOL mbFillChanged;
+ ULONG mnFillHandle;
+ BOOL mbTextChanged;
+ ULONG mnTextHandle;
+
+ void ImplBeginRecord( ULONG nType );
+ void ImplEndRecord();
+
+ ULONG ImplAcquireHandle();
+ void ImplReleaseHandle( ULONG nHandle );
+
+ BOOL ImplPrepareHandleSelect( ULONG& rHandle, ULONG nSelectType );
+ void ImplCheckLineAttr();
+ void ImplCheckFillAttr();
+ void ImplCheckTextAttr();
+
+ void ImplWriteColor( const Color& rColor );
+ void ImplWriteRasterOp( RasterOp eRop );
+ void ImplWriteExtent( long nExtent );
+ void ImplWritePoint( const Point& rPoint );
+ void ImplWriteSize( const Size& rSize);
+ void ImplWriteRect( const Rectangle& rRect );
+ void ImplWritePolygonRecord( const Polygon& rPoly, BOOL bClose );
+ void ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly );
+ void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, UINT32 nROP );
+ void ImplWriteTextRecord( const Point& rPos, const String rText, const long* pDXArray, UINT32 nWidth );
+
+ void ImplWrite( const GDIMetaFile& rMtf );
+
+public:
+
+ EMFWriter() {}
+
+ BOOL WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm,
+ PFilterCallback pCallback, void* pCallerData );
+};
+
+#endif // _EMFWR_HXX
diff --git a/svtools/source/filter.vcl/wmf/enhwmf.cxx b/svtools/source/filter.vcl/wmf/enhwmf.cxx
new file mode 100644
index 000000000000..ed2c10be2dd7
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/enhwmf.cxx
@@ -0,0 +1,1077 @@
+/*************************************************************************
+ *
+ * $RCSfile: enhwmf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "winmtf.hxx"
+
+//=========================== GDI-Array ===================================
+
+#define EMR_HEADER 1
+#define EMR_POLYBEZIER 2
+#define EMR_POLYGON 3
+#define EMR_POLYLINE 4
+#define EMR_POLYBEZIERTO 5
+#define EMR_POLYLINETO 6
+#define EMR_POLYPOLYLINE 7
+#define EMR_POLYPOLYGON 8
+#define EMR_SETWINDOWEXTEX 9
+#define EMR_SETWINDOWORGEX 10
+#define EMR_SETVIEWPORTEXTEX 11
+#define EMR_SETVIEWPORTORGEX 12
+#define EMR_SETBRUSHORGEX 13
+#define EMR_EOF 14
+#define EMR_SETPIXELV 15
+#define EMR_SETMAPPERFLAGS 16
+#define EMR_SETMAPMODE 17
+#define EMR_SETBKMODE 18
+#define EMR_SETPOLYFILLMODE 19
+#define EMR_SETROP2 20
+#define EMR_SETSTRETCHBLTMODE 21
+#define EMR_SETTEXTALIGN 22
+#define EMR_SETCOLORADJUSTMENT 23
+#define EMR_SETTEXTCOLOR 24
+#define EMR_SETBKCOLOR 25
+#define EMR_OFFSETCLIPRGN 26
+#define EMR_MOVETOEX 27
+#define EMR_SETMETARGN 28
+#define EMR_EXCLUDECLIPRECT 29
+#define EMR_INTERSECTCLIPRECT 30
+#define EMR_SCALEVIEWPORTEXTEX 31
+#define EMR_SCALEWINDOWEXTEX 32
+#define EMR_SAVEDC 33
+#define EMR_RESTOREDC 34
+#define EMR_SETWORLDTRANSFORM 35
+#define EMR_MODIFYWORLDTRANSFORM 36
+#define EMR_SELECTOBJECT 37
+#define EMR_CREATEPEN 38
+#define EMR_CREATEBRUSHINDIRECT 39
+#define EMR_DELETEOBJECT 40
+#define EMR_ANGLEARC 41
+#define EMR_ELLIPSE 42
+#define EMR_RECTANGLE 43
+#define EMR_ROUNDRECT 44
+#define EMR_ARC 45
+#define EMR_CHORD 46
+#define EMR_PIE 47
+#define EMR_SELECTPALETTE 48
+#define EMR_CREATEPALETTE 49
+#define EMR_SETPALETTEENTRIES 50
+#define EMR_RESIZEPALETTE 51
+#define EMR_REALIZEPALETTE 52
+#define EMR_EXTFLOODFILL 53
+#define EMR_LINETO 54
+#define EMR_ARCTO 55
+#define EMR_POLYDRAW 56
+#define EMR_SETARCDIRECTION 57
+#define EMR_SETMITERLIMIT 58
+#define EMR_BEGINPATH 59
+#define EMR_ENDPATH 60
+#define EMR_CLOSEFIGURE 61
+#define EMR_FILLPATH 62
+#define EMR_STROKEANDFILLPATH 63
+#define EMR_STROKEPATH 64
+#define EMR_FLATTENPATH 65
+#define EMR_WIDENPATH 66
+#define EMR_SELECTCLIPPATH 67
+#define EMR_ABORTPATH 68
+
+#define EMR_GDICOMMENT 70
+#define EMR_FILLRGN 71
+#define EMR_FRAMERGN 72
+#define EMR_INVERTRGN 73
+#define EMR_PAINTRGN 74
+#define EMR_EXTSELECTCLIPRGN 75
+#define EMR_BITBLT 76
+#define EMR_STRETCHBLT 77
+#define EMR_MASKBLT 78
+#define EMR_PLGBLT 79
+#define EMR_SETDIBITSTODEVICE 80
+#define EMR_STRETCHDIBITS 81
+#define EMR_EXTCREATEFONTINDIRECTW 82
+#define EMR_EXTTEXTOUTA 83
+#define EMR_EXTTEXTOUTW 84
+#define EMR_POLYBEZIER16 85
+#define EMR_POLYGON16 86
+#define EMR_POLYLINE16 87
+#define EMR_POLYBEZIERTO16 88
+#define EMR_POLYLINETO16 89
+#define EMR_POLYPOLYLINE16 90
+#define EMR_POLYPOLYGON16 91
+#define EMR_POLYDRAW16 92
+#define EMR_CREATEMONOBRUSH 93
+#define EMR_CREATEDIBPATTERNBRUSHPT 94
+#define EMR_EXTCREATEPEN 95
+#define EMR_POLYTEXTOUTA 96
+#define EMR_POLYTEXTOUTW 97
+#define EMR_SETICMMODE 98
+#define EMR_CREATECOLORSPACE 99
+#define EMR_SETCOLORSPACE 100
+#define EMR_DELETECOLORSPACE 101
+#define EMR_GLSRECORD 102
+#define EMR_GLSBOUNDEDRECORD 103
+#define EMR_PIXELFORMAT 104
+
+//-----------------------------------------------------------------------------------
+
+BOOL EnhWMFReader::ReadEnhWMF() // SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, PFilterCallback pcallback, void * pcallerdata)
+{
+ UINT32 nStretchBltMode = 0;
+ UINT32 nRecType, nRecSize, nNextPos;
+ UINT32 nWidth, nHeight, nPoints, nColor, nIndex;
+ UINT32 nDat32, nNom1, nDen1, nNom2, nDen2;
+ INT32 nX32, nY32, nx32, ny32;
+ INT16 nX16, nY16;
+
+ BOOL bFlag, bStatus = ReadHeader();
+
+ while( bStatus && nRecordCount-- )
+ {
+ *pWMF >> nRecType >> nRecSize;
+
+ if ( ( nRecSize < 8 ) || ( nRecSize & 3 ) ) // Parameter sind immer durch 4 teilbar
+ {
+ bStatus = FALSE;
+ break;
+ }
+ nNextPos = pWMF->Tell() + ( nRecSize - 8 );
+
+ if( aBmpSaveList.Count() && ( nRecType != EMR_STRETCHBLT ) && ( nRecType != EMR_STRETCHDIBITS ) )
+ pOut->ResolveBitmapActions( aBmpSaveList );
+
+ bFlag = FALSE;
+
+ switch( nRecType )
+ {
+ case EMR_HEADER : // wir haben schon laengst einen header eingelesen
+ break;
+
+ case EMR_POLYBEZIER :
+ break;
+
+ case EMR_POLYGON :
+ {
+ pWMF->SeekRel( 16 );
+ *pWMF >> nPoints;
+ Polygon aPoly( (UINT16)nPoints );
+ for( UINT16 k = 0; k < (UINT16)nPoints; k++ )
+ {
+ *pWMF >> nX32 >> nY32;
+ aPoly[ k ] = Point( nX32, nY32 );
+ }
+ pOut->DrawPolygon( aPoly );
+ }
+ break;
+
+ case EMR_POLYBEZIERTO :
+ break;
+
+ case EMR_POLYLINETO :
+ bFlag = TRUE;
+ case EMR_POLYLINE :
+ {
+ pWMF->SeekRel( 0x10 );
+ *pWMF >> nPoints;
+ UINT16 i = 0;
+ if ( bFlag )
+ {
+ i++;
+ nPoints++;
+ }
+ Polygon aPolygon( (UINT16)nPoints );
+ for ( ; i < (UINT16)nPoints; i++ )
+ {
+ *pWMF >> nX32 >> nY32;
+ aPolygon[ i ] = Point( nX32, nY32 );
+ }
+ pOut->DrawPolyLine( aPolygon, bFlag );
+ }
+ break;
+
+ case EMR_POLYPOLYLINE :
+ {
+ UINT16* pnPoints;
+
+ INT32 i, nPoly;
+ pWMF->SeekRel( 0x10 );
+
+ // Anzahl der Polygone:
+ *pWMF >> nPoly >> i;
+
+ // Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln:
+ pnPoints = new UINT16[ nPoly ];
+
+ for ( i = 0; i < nPoly; i++ )
+ {
+ *pWMF >> nPoints;
+ pnPoints[ i ] = (UINT16)nPoints;
+ }
+
+ // Polygonpunkte holen:
+
+ for ( i = 0; i < nPoly; i++ )
+ {
+ Polygon aPoly( pnPoints[ i ] );
+ for( UINT16 k = 0; k < pnPoints[ i ]; k++ )
+ {
+ *pWMF >> nX32 >> nY32;
+ aPoly[ k ] = Point( nX32, nY32 );
+ }
+ pOut->DrawPolyLine( aPoly, FALSE );
+ }
+ delete pnPoints;
+ }
+ break;
+
+ case EMR_POLYPOLYGON :
+ {
+ UINT16* pnPoints;
+ Point* pPtAry;
+
+ INT32 i, nPoly, nGesPoints;
+ pWMF->SeekRel( 0x10 );
+
+ // Anzahl der Polygone:
+ *pWMF >> nPoly >> nGesPoints;
+
+ // Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln:
+ pnPoints = new UINT16[ nPoly ];
+
+ for ( i = 0; i < nPoly; i++ )
+ {
+ *pWMF >> nPoints;
+ pnPoints[ i ] = (UINT16)nPoints;
+ }
+ // Polygonpunkte holen:
+ pPtAry = (Point*) new char[ nGesPoints * sizeof(Point) ];
+
+ for ( i = 0; i < nGesPoints; i++ )
+ {
+ *pWMF >> nX32 >> nY32;
+ pPtAry[ i ] = Point( nX32, nY32 );
+ }
+ // PolyPolygon Actions erzeugen
+ PolyPolygon aPolyPoly( (UINT16)nPoly, pnPoints, pPtAry );
+
+ pOut->DrawPolyPolygon( aPolyPoly );
+ delete (char*) pPtAry;
+ delete pnPoints;
+ }
+ break;
+
+ case EMR_SETWINDOWEXTEX :
+ { // #75383#
+ *pWMF >> nWidth >> nHeight;
+ if( nWidth > 1 && nHeight > 1 )
+ pOut->SetWinExt( Size( nWidth, nHeight ) );
+ }
+ break;
+
+ case EMR_SETWINDOWORGEX :
+ {
+ *pWMF >> nX32 >> nY32;
+ pOut->SetWinOrg( Point( nX32, nY32 ) );
+ }
+ break;
+
+ case EMR_SETVIEWPORTEXTEX :
+ case EMR_SETVIEWPORTORGEX :
+ break;
+
+ case EMR_SCALEVIEWPORTEXTEX :
+ {
+ *pWMF >> nNom1 >> nDen1 >> nNom2 >> nDen2;
+ pOut->ScaleDevExt( (double)nNom1 / nDen1, (double)nNom2 / nDen2 );
+ }
+ break;
+
+ case EMR_SCALEWINDOWEXTEX :
+ {
+ *pWMF >> nNom1 >> nDen1 >> nNom2 >> nDen2;
+ pOut->ScaleWinExt( (double)nNom1 / nDen1, (double)nNom2 / nDen2 );
+ }
+ break;
+
+ case EMR_SETBRUSHORGEX :
+ break;
+ case EMR_EOF :
+ nRecordCount = 0; // #76846#
+ break;
+
+ case EMR_SETPIXELV :
+ {
+ *pWMF >> nX32 >> nY32;
+ pOut->DrawPixel( Point( nX32, nY32 ), ReadColor() );
+ }
+ break;
+
+ case EMR_SETMAPPERFLAGS :
+ break;
+
+ case EMR_SETMAPMODE :
+ {
+ UINT32 nMapMode;
+ *pWMF >> nMapMode;
+ if ( nMapMode )
+ break;
+ }
+ break;
+
+ case EMR_SETBKMODE :
+ {
+ *pWMF >> nDat32;
+ pOut->SetBkMode( nDat32 );
+ }
+ break;
+
+ case EMR_SETPOLYFILLMODE :
+ break;
+
+ case EMR_SETROP2 :
+ {
+ *pWMF >> nDat32;
+ pOut->SetRasterOp( nDat32 );
+ }
+ break;
+
+ case EMR_SETSTRETCHBLTMODE :
+ {
+ *pWMF >> nStretchBltMode;
+ }
+ break;
+
+ case EMR_SETTEXTALIGN :
+ {
+ *pWMF >> nDat32;
+ pOut->SetTextAlign( nDat32 );
+ }
+ break;
+
+ case EMR_SETCOLORADJUSTMENT :
+ break;
+
+ case EMR_SETTEXTCOLOR :
+ {
+ pOut->SetTextColor( ReadColor() );
+ }
+ break;
+
+ case EMR_SETBKCOLOR :
+ {
+ pOut->SetBkColor( ReadColor() );
+ }
+ break;
+
+ case EMR_OFFSETCLIPRGN :
+ {
+ *pWMF >> nX32 >> nY32;
+ pOut->MoveClipRegion( Size( nX32, nY32 ) );
+ }
+ break;
+
+ case EMR_MOVETOEX :
+ {
+ *pWMF >> nX32 >> nY32;
+ pOut->MoveTo( Point( nX32, nY32 ) );
+ }
+ break;
+
+ case EMR_SETMETARGN :
+ case EMR_EXCLUDECLIPRECT :
+ break;
+
+ case EMR_INTERSECTCLIPRECT :
+ {
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32;
+ pOut->IntersectClipRect( ReadRectangle( nX32, nY32, nx32, ny32 ) );
+ }
+ break;
+
+ case EMR_SAVEDC :
+ {
+ pOut->Push();
+ }
+ break;
+
+ case EMR_RESTOREDC :
+ {
+ pOut->Pop();
+ }
+ break;
+
+ case EMR_SETWORLDTRANSFORM :
+ {
+ XForm aTempXForm;
+ *pWMF >> aTempXForm.eM11 >> aTempXForm.eM12 >> aTempXForm.eM21 >> aTempXForm.eM22 >> aTempXForm.eDx >> aTempXForm.eDy;
+ pOut->SetWorldTransform( aTempXForm );
+ }
+ break;
+
+ case EMR_MODIFYWORLDTRANSFORM :
+ {
+ UINT32 nMode;
+ XForm aTempXForm;
+ *pWMF >> aTempXForm.eM11 >> aTempXForm.eM12 >> aTempXForm.eM21 >> aTempXForm.eM22 >> aTempXForm.eDx >> aTempXForm.eDy >> nMode;
+ pOut->ModifyWorldTransform( aTempXForm, nMode );
+ }
+ break;
+
+ case EMR_SELECTOBJECT :
+ {
+ *pWMF >> nIndex;
+ pOut->SelectObject( nIndex );
+ }
+ break;
+
+ case EMR_CREATEPEN :
+ {
+ *pWMF >> nIndex;
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ {
+
+ LineInfo aLineInfo;
+ UINT32 nStyle;
+ Size aSize;
+
+ *pWMF >> nStyle >> aSize.Width() >> aSize.Height();
+
+ if ( aSize.Width() )
+ aLineInfo.SetWidth( aSize.Width() );
+
+ BOOL bTransparent = FALSE;
+ UINT16 nDashCount = 0;
+ UINT16 nDotCount = 0;
+ switch( nStyle )
+ {
+ case PS_DASHDOTDOT :
+ nDotCount++;
+ case PS_DASHDOT :
+ nDashCount++;
+ case PS_DOT :
+ nDotCount++;
+ break;
+ case PS_DASH :
+ nDashCount++;
+ break;
+ case PS_NULL :
+ bTransparent = TRUE;
+ aLineInfo.SetStyle( LINE_NONE );
+ break;
+ default :
+ case PS_INSIDEFRAME :
+ case PS_SOLID :
+ aLineInfo.SetStyle( LINE_SOLID );
+ }
+ if ( nDashCount | nDotCount )
+ {
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( nDashCount );
+ aLineInfo.SetDotCount( nDotCount );
+ }
+ pOut->CreateObject( nIndex, GDI_PEN, new WinMtfLineStyle( ReadColor(), aLineInfo, bTransparent ) );
+ }
+ }
+ break;
+ case EMR_CREATEBRUSHINDIRECT :
+ {
+ UINT32 nStyle;
+ *pWMF >> nIndex;
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ {
+ *pWMF >> nStyle;
+ pOut->CreateObject( nIndex, GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? TRUE : FALSE ) );
+ }
+ }
+ break;
+ case EMR_DELETEOBJECT :
+ {
+ *pWMF >> nIndex;
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ pOut->DeleteObject( nIndex );
+ }
+ break;
+
+ case EMR_ANGLEARC :
+ break;
+
+ case EMR_ELLIPSE :
+ {
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32;
+ pOut->DrawEllipse( ReadRectangle( nX32, nY32, nx32, ny32 ) );
+ }
+ break;
+
+ case EMR_RECTANGLE :
+ {
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32;
+ pOut->DrawRect( ReadRectangle( nX32, nY32, nx32, ny32 ) );
+ }
+ break;
+
+ case EMR_ROUNDRECT :
+ {
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nWidth >> nHeight;
+ Size aSize( Size( nWidth, nHeight ) );
+ pOut->DrawRoundRect( ReadRectangle( nX32, nY32, nx32, ny32 ), aSize );
+ }
+ break;
+
+ case EMR_ARC :
+ {
+ UINT32 nStartX, nStartY, nEndX, nEndY;
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY;
+ pOut->DrawArc( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ) );
+ }
+ break;
+
+ case EMR_CHORD :
+ {
+ UINT32 nStartX, nStartY, nEndX, nEndY;
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY;
+ pOut->DrawChord( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ) );
+ }
+ break;
+
+ case EMR_PIE :
+ {
+ UINT32 nStartX, nStartY, nEndX, nEndY;
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY;
+ pOut->DrawPie( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ) );
+ }
+ break;
+
+ case EMR_SELECTPALETTE :
+ case EMR_CREATEPALETTE :
+ case EMR_SETPALETTEENTRIES :
+ case EMR_RESIZEPALETTE :
+ case EMR_REALIZEPALETTE :
+ case EMR_EXTFLOODFILL :
+ break;
+
+ case EMR_LINETO :
+ {
+ *pWMF >> nX32 >> nY32;
+ pOut->LineTo( Point( nX32, nY32 ) );
+ }
+ break;
+
+ case EMR_ARCTO :
+ {
+ UINT32 nStartX, nStartY, nEndX, nEndY;
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY;
+ pOut->DrawArc( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), TRUE );
+ }
+ break;
+ case EMR_POLYDRAW :
+ case EMR_SETARCDIRECTION :
+ case EMR_SETMITERLIMIT :
+ case EMR_BEGINPATH :
+ case EMR_ENDPATH :
+ case EMR_CLOSEFIGURE :
+ case EMR_FILLPATH :
+ case EMR_STROKEANDFILLPATH :
+ case EMR_STROKEPATH :
+ case EMR_FLATTENPATH :
+ case EMR_WIDENPATH :
+ case EMR_SELECTCLIPPATH :
+ case EMR_ABORTPATH :
+
+ case EMR_GDICOMMENT :
+ case EMR_FILLRGN :
+ case EMR_FRAMERGN :
+ case EMR_INVERTRGN :
+ case EMR_PAINTRGN :
+ case EMR_EXTSELECTCLIPRGN :
+ break;
+ case EMR_BITBLT :
+ {
+ UINT32 nRasterOp;
+ Size aDestExt;
+ Point aDestOrg;
+ Bitmap aBmp;
+
+ pWMF->SeekRel( 0x10 );
+ *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nRasterOp;
+ aDestOrg = Point( nX32, nY32 );
+ aDestExt = Size( nx32, ny32 );
+ *pWMF >> nX32 >> nY32 >> nColor;
+
+ UINT32 nNewRop = R2_BLACK;
+ switch( nRasterOp )
+ {
+ case DSTINVERT :
+ nNewRop = R2_NOT;
+ break;
+ case 0x00990066 :
+ case SRCINVERT:
+ nNewRop = R2_XORPEN;
+ break;
+ case BLACKNESS :
+ nColor = 0;
+ break;
+ case WHITENESS :
+ nColor = 0xffffff;
+ break;
+ }
+ pOut->Push();
+ UINT32 nOldRop = pOut->SetRasterOp( nNewRop );
+ pOut->DrawRect( Rectangle( aDestOrg, aDestExt ) );
+ pOut->SetRasterOp( nOldRop );
+ pOut->Pop();
+ }
+ break;
+
+ case EMR_STRETCHBLT :
+ {
+ INT32 xDest, yDest, cxDest, cyDest, xSrc, ySrc, cxSrc, cySrc;
+ UINT32 dwRop, iUsageSrc, offBmiSrc, cbBmiSrc, offBitsSrc, cbBitsSrc;
+ XForm xformSrc;
+
+ UINT32 nStartPos = pWMF->Tell() - 8;
+
+ pWMF->SeekRel( 0x10 );
+ *pWMF >> xDest >> yDest >> cxDest >> cyDest >> dwRop >> xSrc >> ySrc >> xformSrc.eM11 >> xformSrc.eM12 >>
+ xformSrc.eM21 >> xformSrc.eM22 >> xformSrc.eDx >> xformSrc.eDy >> nColor >> iUsageSrc >> offBmiSrc >>
+ cbBmiSrc >> offBitsSrc >> cbBitsSrc >> cxSrc >> cySrc;
+
+ if ( offBmiSrc )
+ {
+ Bitmap aBitmap;
+ Rectangle aRect( Point( xDest, yDest ), Size( cxDest+1, cyDest+1 ) );
+
+ UINT32 nSize = cbBmiSrc + cbBitsSrc + 14;
+ char* pBuf = new char[ nSize ];
+ SvMemoryStream aTmp( pBuf, nSize, STREAM_READ | STREAM_WRITE );
+ aTmp.ObjectOwnsMemory( TRUE );
+ aTmp << (BYTE)'B'
+ << (BYTE)'M'
+ << (UINT32)cbBitsSrc
+ << (UINT16)0
+ << (UINT16)0
+ << (UINT32)cbBmiSrc + 14;
+ pWMF->Seek( nStartPos + offBmiSrc );
+ pWMF->Read( pBuf + 14, cbBmiSrc );
+ pWMF->Seek( nStartPos + offBitsSrc );
+ pWMF->Read( pBuf + 14 + cbBmiSrc, cbBitsSrc );
+ aTmp.Seek( 0 );
+ aBitmap.Read( aTmp, TRUE );
+ aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop ), LIST_APPEND );
+ }
+ else
+ {
+ if( aBmpSaveList.Count() )
+ pOut->ResolveBitmapActions( aBmpSaveList );
+
+ Point aDestOrg = Point( xDest, yDest );
+ Size aDestExt = Size( cxDest, cyDest );
+
+ UINT32 nNewRop = R2_BLACK;
+ switch( dwRop )
+ {
+ case DSTINVERT :
+ nNewRop = R2_NOT;
+ break;
+ case 0x00990066 :
+ case SRCINVERT:
+ nNewRop = R2_XORPEN;
+ break;
+ case BLACKNESS :
+ nColor = 0;
+ break;
+ case WHITENESS :
+ nColor = 0xffffff;
+ break;
+ }
+ pOut->Push();
+ UINT32 nOldRop = pOut->SetRasterOp( nNewRop );
+ pOut->DrawRect( Rectangle( aDestOrg, aDestExt ), FALSE );
+ pOut->SetRasterOp( nOldRop );
+ pOut->Pop();
+ }
+ }
+ break;
+
+ case EMR_STRETCHDIBITS :
+ {
+ INT32 xDest, yDest, xSrc, ySrc, cxSrc, cySrc, cxDest, cyDest;
+ UINT32 offBmiSrc, cbBmiSrc, offBitsSrc, cbBitsSrc, iUsageSrc, dwRop;
+ UINT32 nStartPos = pWMF->Tell() - 8;
+
+ pWMF->SeekRel( 0x10 );
+ *pWMF >> xDest >> yDest >> xSrc >> ySrc >> cxSrc >> cySrc >> offBmiSrc >> cbBmiSrc >> offBitsSrc
+ >> cbBitsSrc >> iUsageSrc >> dwRop >> cxDest >> cyDest;
+
+ Bitmap aBitmap;
+ Rectangle aRect( Point( xDest, yDest ), Size( cxDest+1, cyDest+1 ) );
+
+ UINT32 nSize = cbBmiSrc + cbBitsSrc + 14;
+ char* pBuf = new char[ nSize ];
+ SvMemoryStream aTmp( pBuf, nSize, STREAM_READ | STREAM_WRITE );
+ aTmp.ObjectOwnsMemory( TRUE );
+ aTmp << (BYTE)'B'
+ << (BYTE)'M'
+ << (UINT32)cbBitsSrc
+ << (UINT16)0
+ << (UINT16)0
+ << (UINT32)cbBmiSrc + 14;
+ pWMF->Seek( nStartPos + offBmiSrc );
+ pWMF->Read( pBuf + 14, cbBmiSrc );
+ pWMF->Seek( nStartPos + offBitsSrc );
+ pWMF->Read( pBuf + 14 + cbBmiSrc, cbBitsSrc );
+ aTmp.Seek( 0 );
+ aBitmap.Read( aTmp, TRUE );
+ aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop ), LIST_APPEND );
+ }
+ break;
+
+ case EMR_MASKBLT :
+ case EMR_PLGBLT :
+ case EMR_SETDIBITSTODEVICE :
+ break;
+
+ case EMR_EXTCREATEFONTINDIRECTW :
+ {
+ *pWMF >> nIndex;
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ {
+ LOGFONTW aLogFont;
+ *pWMF >> aLogFont.lfHeight >> aLogFont.lfWidth >> aLogFont.lfEscapement >> aLogFont.lfOrientation >> aLogFont.lfWeight >> aLogFont.lfItalic
+ >> aLogFont.lfUnderline >> aLogFont.lfStrikeOut >> aLogFont.lfCharSet >> aLogFont.lfOutPrecision >> aLogFont.lfClipPrecision
+ >> aLogFont.lfQuality >> aLogFont.lfPitchAndFamily;
+
+ for ( int i = 0; i < LF_FACESIZE; i++ )
+ {
+ UINT16 nChar;
+ *pWMF >> nChar;
+ aLogFont.lfFaceName[ i ] = (BYTE)nChar;
+ }
+ pOut->CreateObject( nIndex, GDI_FONT, new WinMtfFontStyle( aLogFont ) );
+ }
+ }
+ break;
+ case EMR_EXTTEXTOUTA :
+ bFlag = TRUE;
+ case EMR_EXTTEXTOUTW :
+ {
+ INT32 nLeft, nTop, nRight, nBottom, ptlReferenceX, ptlReferenceY, nGfxMode, nXScale, nYScale;
+ UINT32 nCurPos, nLen, nOffString, nOptions, offDx;
+
+ nCurPos = pWMF->Tell() - 8;
+
+ *pWMF >> nLeft >> nTop >> nRight >> nBottom >> nGfxMode >> nXScale >> nYScale
+ >> ptlReferenceX >> ptlReferenceY >> nLen >> nOffString >> nOptions;
+
+ pWMF->SeekRel( 0x10 );
+ *pWMF >> offDx;
+
+ Point aPos;
+
+ if ( nGfxMode != GM_COMPATIBLE )
+ aPos = Point( nLeft, nTop );
+ else
+ aPos = Point( ptlReferenceX, ptlReferenceY );
+
+ UINT32 nSize = nLen;
+
+ if ( nLen )
+ {
+ if ( !bFlag )
+ nSize <<= 1;
+
+ BYTE* pBuf = new BYTE[ nSize + 1 ];
+
+ pWMF->Seek( nCurPos + nOffString );
+ pWMF->Read( pBuf, nSize );
+
+ String aText;
+ if( bFlag )
+ aText = String( (char*)pBuf, (USHORT)nLen, pOut->GetCharSet() );
+ else
+ {
+ #ifdef __BIGENDIAN
+ pBuf += nSize;
+ BYTE nTemp;
+ for( UINT32 i = 0; i < nLen; i++ )
+ {
+ pBuf -= 2;
+ pBuf[ 2 ] = *pBuf;
+ }
+ pBuf++;
+ #endif
+ aText = String( (sal_Unicode*)pBuf, (xub_StrLen)nLen );
+ }
+ #ifdef __BIGENDIAN
+ pBuf--;
+ #endif
+ delete[] pBuf;
+ pOut->DrawText( aPos, aText );
+ }
+ }
+ break;
+
+ case EMR_POLYBEZIERTO16 :
+ bFlag = TRUE;
+ case EMR_POLYBEZIER16 :
+ {
+ pWMF->SeekRel( 16 );
+ *pWMF >> nPoints;
+ UINT16 i = 0;
+ if ( bFlag )
+ {
+ i++;
+ nPoints++;
+ }
+ Polygon aPoly( (UINT16)nPoints );
+ for( ; i < (UINT16)nPoints; i++ )
+ {
+ *pWMF >> nX16 >> nY16;
+ aPoly[ i ] = Point( nX16, nY16 );
+ }
+ pOut->DrawPolyBezier( aPoly, bFlag ); // Line( aPoly, bFlag );
+ }
+ break;
+ case EMR_POLYGON16 :
+ {
+ pWMF->SeekRel( 16 );
+ *pWMF >> nPoints;
+ Polygon aPoly( (UINT16)nPoints );
+ for( UINT16 k = 0; k < (UINT16)nPoints; k++ )
+ {
+ *pWMF >> nX16 >> nY16;
+ aPoly[ k ] = Point( nX16, nY16 );
+ }
+ pOut->DrawPolygon( aPoly );
+ }
+ break;
+ case EMR_POLYLINETO16 :
+ bFlag = TRUE;
+ case EMR_POLYLINE16 :
+ {
+ pWMF->SeekRel( 16 );
+ *pWMF >> nPoints;
+ UINT16 i = 0;
+ if ( bFlag )
+ {
+ i++;
+ nPoints++;
+ }
+
+ Polygon aPoly( (UINT16)nPoints );
+ for( ; i < (UINT16)nPoints; i++ )
+ {
+ *pWMF >> nX16 >> nY16;
+ aPoly[ i ] = Point( nX16, nY16 );
+ }
+ pOut->DrawPolyLine( aPoly, bFlag );
+ }
+ break;
+
+ case EMR_POLYPOLYLINE16 :
+ {
+ UINT16* pnPoints;
+
+ INT32 i, nPoly, nGesPoints;
+ pWMF->SeekRel( 0x10 );
+ // Anzahl der Polygone:
+ *pWMF >> nPoly >> nGesPoints;
+ // Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln:
+ pnPoints = new UINT16[ nPoly ];
+ for ( i = 0; i < nPoly; i++ )
+ {
+ *pWMF >> nPoints;
+ pnPoints[ i ] = (UINT16)nPoints;
+ }
+ // Polygonpunkte holen:
+ for ( i = 0; i < nPoly; i++ )
+ {
+ Polygon aPolygon( pnPoints[ i ] );
+ for ( UINT16 k = 0; k < pnPoints[ i ]; k++ )
+ {
+ *pWMF >> nX16 >> nY16;
+ aPolygon[ k ] = Point( nX16, nY16 );
+ }
+ pOut->DrawPolyLine( aPolygon );
+ }
+ delete pnPoints;
+ }
+ break;
+
+ case EMR_POLYPOLYGON16 :
+ {
+ UINT16* pnPoints;
+ Point* pPtAry;
+
+ INT32 i, nPoly, nGesPoints;
+ pWMF->SeekRel( 0x10 );
+ // Anzahl der Polygone:
+ *pWMF >> nPoly >> nGesPoints;
+ // Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln:
+ pnPoints = new UINT16[ nPoly ];
+ for ( i = 0; i < nPoly; i++ )
+ {
+ *pWMF >> nPoints;
+ pnPoints[ i ] = (UINT16)nPoints;
+ }
+ // Polygonpunkte holen:
+ pPtAry = (Point*) new char[ nGesPoints * sizeof(Point) ];
+ for ( i = 0; i < nGesPoints; i++ )
+ {
+ *pWMF >> nX16 >> nY16;
+ pPtAry[ i ] = Point( nX16, nY16 );
+ }
+
+ // PolyPolygon Actions erzeugen
+ PolyPolygon aPolyPoly( (UINT16)nPoly, pnPoints, pPtAry );
+ pOut->DrawPolyPolygon( aPolyPoly );
+ delete (char*) pPtAry;
+ delete pnPoints;
+ };
+ break;
+ case EMR_POLYDRAW16 :
+ break;
+ case EMR_CREATEMONOBRUSH :
+ case EMR_CREATEDIBPATTERNBRUSHPT :
+ case EMR_EXTCREATEPEN :
+ case EMR_POLYTEXTOUTA :
+ case EMR_POLYTEXTOUTW :
+ case EMR_SETICMMODE :
+ break;
+ case EMR_CREATECOLORSPACE :
+ case EMR_SETCOLORSPACE :
+ case EMR_DELETECOLORSPACE :
+ break;
+ case EMR_GLSRECORD :
+ case EMR_GLSBOUNDEDRECORD :
+ case EMR_PIXELFORMAT :
+ break;
+
+ default :
+// bStatus = FALSE;
+ break;
+ }
+ pWMF->Seek( nNextPos );
+ }
+ if( aBmpSaveList.Count() )
+ pOut->ResolveBitmapActions( aBmpSaveList );
+
+ if ( bStatus )
+ pWMF->Seek(nEndPos);
+
+ return bStatus;
+};
+
+//-----------------------------------------------------------------------------------
+
+BOOL EnhWMFReader::ReadHeader()
+{
+ Rectangle aPlaceableBound;
+ UINT32 nUINT32, nHeaderSize, nPalEntries;
+ INT32 nLeft, nTop, nRight, nBottom;
+ INT32 nPixX, nPixY, nMillX, nMillY;
+
+ // METAFILEHEADER SPARE ICH MIR HIER
+ // Einlesen des METAHEADER
+ *pWMF >> nUINT32 >> nHeaderSize;
+ if ( nUINT32 != 1 ) // Typ
+ return FALSE;
+
+ // bound size
+ pWMF->SeekRel( 16 );
+
+ // picture frame size
+ *pWMF >> nLeft >> nTop >> nRight >> nBottom;
+ aPlaceableBound.Left() = nLeft;
+ aPlaceableBound.Top() = nTop;
+ aPlaceableBound.Right() = nRight;
+ aPlaceableBound.Bottom() = nBottom;
+
+ *pWMF >> nUINT32; // signature
+
+ if ( nUINT32 != 0x464d4520 )
+ return FALSE;
+
+ *pWMF >> nUINT32; // nVersion
+ *pWMF >> nEndPos; // size of metafile
+ nEndPos += nStartPos;
+ *pWMF >> nRecordCount;
+
+ if ( !nRecordCount )
+ return FALSE;
+
+ pWMF->SeekRel( 0xc );
+ *pWMF >> nPalEntries >> nPixX >> nPixY >> nMillX >> nMillY;
+
+ pOut->SetDevExt( aPlaceableBound.GetSize() );
+ pOut->SetWinOrg( Point( FRound( ( (double) aPlaceableBound.Left() * nPixX ) / ( nMillX * 100.0 ) ),
+ FRound( ( (double) aPlaceableBound.Top() * nPixY ) / ( nMillY * 100.0 ) ) ) );
+ pOut->SetWinExt( Size( FRound( ( (double) aPlaceableBound.GetWidth() * nPixX ) / ( nMillX * 100.0 ) ),
+ FRound( ( (double) aPlaceableBound.GetHeight() * nPixY ) / ( nMillY * 100.0 ) ) ) );
+ pWMF->Seek( nStartPos + nHeaderSize );
+ return TRUE;
+}
+
+//-----------------------------------------------------------------------------------
+
+Rectangle EnhWMFReader::ReadRectangle( INT32 x1, INT32 y1, INT32 x2, INT32 y2 )
+{
+ Point aTL ( Point( x1, y1 ) );
+ Point aBR( Point( --x2, --y2 ) );
+ return Rectangle( aTL, aBR );
+}
+
diff --git a/svtools/source/filter.vcl/wmf/makefile.mk b/svtools/source/filter.vcl/wmf/makefile.mk
new file mode 100644
index 000000000000..090588e12bdf
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SVTOOLS
+TARGET=wmf
+VERSION=$(UPD)
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(GUI)"=="WIN"
+LINKFLAGS=$(LINKFLAGS) /PACKC:32768
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= wmf.cxx \
+ winmtf.cxx \
+ winwmf.cxx \
+ enhwmf.cxx \
+ emfwr.cxx \
+ wmfwr.cxx
+
+SLOFILES= $(SLO)$/wmf.obj \
+ $(SLO)$/winmtf.obj \
+ $(SLO)$/winwmf.obj \
+ $(SLO)$/enhwmf.obj \
+ $(SLO)$/emfwr.obj \
+ $(SLO)$/wmfwr.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx
new file mode 100644
index 000000000000..e00ff00c7c78
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/winmtf.cxx
@@ -0,0 +1,1262 @@
+/*************************************************************************
+ *
+ * $RCSfile: winmtf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include "winmtf.hxx"
+#include <vcl/metaact.hxx>
+
+// ------------------------------------------------------------------------
+
+WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont )
+{
+ Size aFontSize( Size( 0, rFont.lfHeight ) );
+
+ aFont.SetName( UniString( (char*)rFont.lfFaceName, RTL_TEXTENCODING_UTF8 ) );
+ aFont.SetSize( aFontSize );
+
+ CharSet eCharSet;
+ switch ( rFont.lfCharSet )
+ {
+ case ANSI_CHARSET:
+ eCharSet = RTL_TEXTENCODING_MS_1252;
+ break;
+
+ case SYMBOL_CHARSET:
+ eCharSet = RTL_TEXTENCODING_SYMBOL;
+ break;
+
+ case OEM_CHARSET:
+ case DEFAULT_CHARSET:
+ case SHIFTJIS_CHARSET:
+ case HANGEUL_CHARSET:
+ case CHINESEBIG5_CHARSET:
+ default:
+ eCharSet = gsl_getSystemTextEncoding();
+ break;
+ }
+ aFont.SetCharSet( eCharSet );
+
+ FontFamily eFamily;
+ switch ( rFont.lfPitchAndFamily & 0xf0 )
+ {
+ case FF_ROMAN:
+ eFamily = FAMILY_ROMAN;
+ break;
+
+ case FF_SWISS:
+ eFamily = FAMILY_SWISS;
+ break;
+
+ case FF_MODERN:
+ eFamily = FAMILY_MODERN;
+ break;
+
+ case FF_SCRIPT:
+ eFamily = FAMILY_SCRIPT;
+ break;
+
+ case FF_DECORATIVE:
+ eFamily = FAMILY_DECORATIVE;
+ break;
+
+ default:
+ eFamily = FAMILY_DONTKNOW;
+ break;
+ }
+ aFont.SetFamily( eFamily );
+
+ FontPitch ePitch;
+ switch ( rFont.lfPitchAndFamily & 0x0f )
+ {
+ case FIXED_PITCH:
+ ePitch = PITCH_FIXED;
+ break;
+
+ case DEFAULT_PITCH:
+ case VARIABLE_PITCH:
+ default:
+ ePitch = PITCH_VARIABLE;
+ break;
+ }
+ aFont.SetPitch( ePitch );
+
+ FontWeight eWeight;
+ if( rFont.lfWeight <= FW_THIN )
+ eWeight = WEIGHT_THIN;
+ else if( rFont.lfWeight <= FW_ULTRALIGHT )
+ eWeight = WEIGHT_ULTRALIGHT;
+ else if( rFont.lfWeight <= FW_LIGHT )
+ eWeight = WEIGHT_LIGHT;
+ else if( rFont.lfWeight < FW_MEDIUM )
+ eWeight = WEIGHT_NORMAL;
+ else if( rFont.lfWeight == FW_MEDIUM )
+ eWeight = WEIGHT_MEDIUM;
+ else if( rFont.lfWeight <= FW_SEMIBOLD )
+ eWeight = WEIGHT_SEMIBOLD;
+ else if( rFont.lfWeight <= FW_BOLD )
+ eWeight = WEIGHT_BOLD;
+ else if( rFont.lfWeight <= FW_ULTRABOLD )
+ eWeight = WEIGHT_ULTRABOLD;
+ else
+ eWeight = WEIGHT_BLACK;
+ aFont.SetWeight( eWeight );
+
+ if( rFont.lfItalic )
+ aFont.SetItalic( ITALIC_NORMAL );
+
+ if( rFont.lfUnderline )
+ aFont.SetUnderline( UNDERLINE_SINGLE );
+
+ if( rFont.lfStrikeOut )
+ aFont.SetStrikeout( STRIKEOUT_SINGLE );
+
+ if ( rFont.lfOrientation )
+ aFont.SetOrientation( (short)rFont.lfOrientation );
+ else
+ aFont.SetOrientation( (short)rFont.lfEscapement );
+};
+
+// ------------------------------------------------------------------------
+
+WinMtf::WinMtf( WinMtfOutput* pWinMtfOutput, SvStream& rStreamWMF, PFilterCallback pcallback, void * pcallerdata ) :
+ pOut ( pWinMtfOutput ),
+ pCallback ( pcallback ),
+ pCallerData ( pcallerdata ),
+ pWMF ( &rStreamWMF )
+{
+ SvLockBytes *pLB = pWMF->GetLockBytes();
+ if ( pLB )
+ pLB->SetSynchronMode( TRUE );
+
+ nStartPos = pWMF->Tell();
+
+ pOut->SetDevOrg( Point() );
+}
+
+// ------------------------------------------------------------------------
+
+WinMtf::~WinMtf()
+{
+ delete pOut;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL WinMtf::Callback( USHORT nPercent )
+{
+ if ( pCallback != NULL )
+ {
+ if( (*pCallback)( pCallerData, nPercent ) )
+ {
+ pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+Color WinMtf::ReadColor()
+{
+ UINT32 nColor;
+ *pWMF >> nColor;
+ return Color( (BYTE)nColor, (BYTE)( nColor >> 8 ), (BYTE)( nColor >> 16 ) );
+};
+
+//-----------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
+
+WinMtfOutput::WinMtfOutput() :
+ mnActTextAlign ( TA_LEFT | TA_TOP | TA_NOUPDATECP ),
+ mnBkMode ( OPAQUE ),
+ maBkColor ( COL_WHITE ),
+ mbNopMode ( FALSE ),
+ mbFontChanged ( FALSE ),
+ maActPos ( Point() ),
+ meRasterOp ( ROP_OVERPAINT ),
+ mnEntrys ( 16 )
+{
+ maFont.SetCharSet( gsl_getSystemTextEncoding() );
+ mpGDIObj = new GDIObj*[ mnEntrys ];
+ for ( UINT32 i = 0; i < mnEntrys; i++ )
+ {
+ mpGDIObj[ i ] = NULL;
+ }
+};
+
+//-----------------------------------------------------------------------------------
+
+WinMtfOutput::~WinMtfOutput()
+{
+ while( maSaveStack.Count() )
+ delete maSaveStack.Pop();
+
+ for ( UINT32 i = 0; i < mnEntrys; i++ )
+ {
+ delete mpGDIObj[ i ];
+ }
+ delete mpGDIObj;
+};
+
+//-----------------------------------------------------------------------------------
+
+Point WinMtfOutput::ImplMap( const Point& rPt )
+{
+ if( mnWinExtX && mnWinExtY )
+ {
+ return Point( FRound( ( ( (double) rPt.X() - mnWinOrgX ) * mnDevWidth / mnWinExtX + mnDevOrgX ) * maXForm.eM11 ),
+ FRound( ( ( (double) rPt.Y() - mnWinOrgY ) * mnDevHeight / mnWinExtY + mnDevOrgY ) * maXForm.eM12 ) );
+ }
+ else
+ return Point();
+};
+
+// ------------------------------------------------------------------------
+
+Size WinMtfOutput::ImplMap( const Size& rSz )
+{
+ if( mnWinExtX && mnWinExtY )
+ {
+ return Size( FRound( ( (double) rSz.Width() * mnDevWidth / mnWinExtX ) * maXForm.eM11 ),
+ FRound( ( (double) rSz.Height() * mnDevHeight / mnWinExtY ) * maXForm.eM12 ) );
+ }
+ else
+ return Size();
+}
+
+//-----------------------------------------------------------------------------------
+
+Rectangle WinMtfOutput::ImplMap( const Rectangle& rRect )
+{
+ return Rectangle( ImplMap( rRect.TopLeft() ), ImplMap( rRect.GetSize() ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::ImplMap( Font& rFont )
+{
+ // !!! HACK: Wir setzen die Breite jetzt immer auf Null,
+ // da OS die Breite unterschiedlich interpretieren;
+ // muss spaeter in SV portabel gemacht werden ( KA 08.02.96 )
+ Size aFontSize = ImplMap ( rFont.GetSize() );
+
+ if( aFontSize.Height() < 0 )
+ aFontSize.Height() *= -1;
+
+ rFont.SetSize( Size( 0, aFontSize.Height() ) );
+
+ if( ( mnWinExtX * mnWinExtY ) < 0 )
+ rFont.SetOrientation( 3600 - rFont.GetOrientation() );
+}
+
+//-----------------------------------------------------------------------------------
+
+Polygon& WinMtfOutput::ImplMap( Polygon& rPolygon )
+{
+ UINT16 nPoints = rPolygon.GetSize();
+ for ( UINT16 i = 0; i < nPoints; i++ )
+ {
+ rPolygon[ i ] = ImplMap( rPolygon[ i ] );
+ }
+ return rPolygon;
+}
+
+//-----------------------------------------------------------------------------------
+
+PolyPolygon& WinMtfOutput::ImplMap( PolyPolygon& rPolyPolygon )
+{
+ UINT16 nPolys = rPolyPolygon.Count();
+ for ( UINT16 i = 0; i < nPolys; ImplMap( rPolyPolygon[ i++ ] ) );
+ return rPolyPolygon;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::SelectObject( INT32 nIndex )
+{
+ GDIObj* pGDIObj = NULL;
+
+ if ( nIndex & ENHMETA_STOCK_OBJECT )
+ pGDIObj = new GDIObj();
+ else
+ {
+ nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen
+
+ if ( (UINT32)nIndex < mnEntrys )
+ pGDIObj = mpGDIObj[ nIndex ];
+ }
+
+ if( pGDIObj == NULL )
+ return;
+
+ if ( nIndex & ENHMETA_STOCK_OBJECT )
+ {
+ UINT16 nStockId = (BYTE)nIndex;
+ switch( nStockId )
+ {
+ case WHITE_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ) ) );
+ }
+ break;
+ case LTGRAY_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_LIGHTGRAY ) ) );
+ }
+ break;
+ case GRAY_BRUSH :
+ case DKGRAY_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_GRAY ) ) );
+ }
+ break;
+ case BLACK_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_BLACK ) ) );
+ }
+ break;
+ case NULL_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_TRANSPARENT ), TRUE ) );
+ }
+ break;
+ case WHITE_PEN :
+ {
+ pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_WHITE ) ) );
+ }
+ break;
+ case BLACK_PEN :
+ {
+ pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_BLACK ) ) );
+ }
+ break;
+ case NULL_PEN :
+ {
+ pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_TRANSPARENT ), TRUE ) );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if ( pGDIObj->pStyle )
+ {
+ switch( pGDIObj->eType )
+ {
+ case GDI_PEN :
+ maLineStyle = (WinMtfLineStyle*)pGDIObj->pStyle;
+ break;
+ case GDI_BRUSH :
+ maFillStyle = (WinMtfFillStyle*)pGDIObj->pStyle;
+ break;
+ case GDI_FONT :
+ {
+ maFont = ((WinMtfFontStyle*)pGDIObj->pStyle)->aFont;
+ if ( ( mnActTextAlign & TA_BASELINE) == TA_BASELINE )
+ maFont.SetAlign( ALIGN_BASELINE );
+ else if( ( mnActTextAlign & TA_BOTTOM) == TA_BOTTOM )
+ maFont.SetAlign( ALIGN_BOTTOM );
+ else
+ maFont.SetAlign( ALIGN_TOP );
+
+ if( mnBkMode == TRANSPARENT )
+ maFont.SetTransparent( TRUE );
+ else
+ {
+ maFont.SetFillColor( maBkColor );
+ maFont.SetTransparent( FALSE );
+ }
+ maFont.SetColor( maTextColor );
+ mbFontChanged = TRUE;
+ }
+ break;
+ }
+ }
+ if ( nIndex & ENHMETA_STOCK_OBJECT )
+ delete pGDIObj;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::Push( BOOL bWinExtSet )
+{
+ SaveStruct* pSave = new SaveStruct;
+
+ pSave->aActPos = maActPos;
+ pSave->nActTextAlign = mnActTextAlign;
+ pSave->nBkMode = mnBkMode;
+ pSave->aBkColor = maBkColor;
+ pSave->bWinExtSet = bWinExtSet;
+ pSave->aLineStyle = maLineStyle;
+ pSave->aFillStyle = maFillStyle;
+ pSave->aTextColor = maTextColor;
+ pSave->aFont = maFont;
+ pSave->bFontChanged = mbFontChanged;
+
+ if ( bWinExtSet )
+ {
+ pSave->nWinOrgX = mnWinOrgX;
+ pSave->nWinOrgY = mnWinOrgY;
+ pSave->nWinExtX = mnWinExtX;
+ pSave->nWinExtY = mnWinExtY;
+ pSave->nDevOrgX = mnDevOrgX;
+ pSave->nDevOrgY = mnDevOrgY;
+ pSave->nDevWidth = mnDevWidth;
+ pSave->nDevHeight = mnDevHeight;
+ }
+ maSaveStack.Push( pSave );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::Pop()
+{
+ // Die aktuellen Daten vom Stack holen
+ if( maSaveStack.Count() )
+ {
+ // Die aktuelle Daten auf dem Stack sichern
+ SaveStruct* pSave = maSaveStack.Pop();
+
+ mnBkMode = pSave->nBkMode;
+ maBkColor = pSave->aBkColor;
+ maActPos = pSave->aActPos;
+ mnActTextAlign = pSave->nActTextAlign;
+ maLineStyle = pSave->aLineStyle;
+ maFillStyle = pSave->aFillStyle;
+ maTextColor = pSave->aTextColor;
+ maFont = pSave->aFont;
+ mbFontChanged = pSave->bFontChanged;
+
+ if ( pSave->bWinExtSet )
+ {
+ mnWinOrgX = pSave->nWinOrgX;
+ mnWinOrgY = pSave->nWinOrgY;
+ mnWinExtX = pSave->nWinExtX;
+ mnWinExtY = pSave->nWinExtY;
+ mnDevOrgX = pSave->nDevOrgX;
+ mnDevOrgY = pSave->nDevOrgY;
+ mnDevWidth = pSave->nDevWidth;
+ mnDevHeight = pSave->nDevHeight;
+ }
+ delete pSave;
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::SetBkMode( UINT32 nMode )
+{
+ maFont.SetTransparent( ( mnBkMode = nMode ) == TRANSPARENT );
+ mbFontChanged = TRUE;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::SetBkColor( const Color& rColor )
+{
+ maBkColor = rColor;
+ maFont.SetFillColor( rColor );
+ maFont.SetTransparent( mnBkMode == TRANSPARENT );
+ mbFontChanged = TRUE;
+}
+
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::SetTextColor( const Color& rColor )
+{
+ maTextColor = rColor;
+ maFont.SetColor( rColor );
+ mbFontChanged = TRUE;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::SetTextAlign( UINT32 nAlign )
+{
+ mnActTextAlign = nAlign;
+
+ if ( ( mnActTextAlign & TA_BASELINE ) == TA_BASELINE )
+ maFont.SetAlign( ALIGN_BASELINE );
+ else if( ( mnActTextAlign & TA_BOTTOM ) == TA_BOTTOM )
+ maFont.SetAlign( ALIGN_BOTTOM );
+ else
+ maFont.SetAlign( ALIGN_TOP );
+
+ mbFontChanged = TRUE;
+}
+
+//-----------------------------------------------------------------------------------
+
+UINT32 WinMtfOutput::SetRasterOp( UINT32 nROP2 )
+{
+ UINT32 nRetROP = mnRop;
+ if ( nROP2 != mnRop )
+ {
+ mnRop = nROP2;
+ static WinMtfFillStyle aNopFillStyle;
+ static WinMtfLineStyle aNopLineStyle;
+
+ if ( mbNopMode && ( nROP2 != R2_NOP ) )
+ { // beim uebergang von R2_NOP auf anderen Modus
+ // gesetzten Pen und Brush aktivieren
+ maFillStyle = aNopFillStyle;
+ maLineStyle = aNopLineStyle;
+ mbNopMode = FALSE;
+ }
+ switch( nROP2 )
+ {
+ case R2_NOT:
+ meRasterOp = ROP_INVERT;
+ break;
+
+ case R2_XORPEN:
+ meRasterOp = ROP_XOR;
+ break;
+
+ case R2_NOP:
+ {
+ meRasterOp = ROP_OVERPAINT;
+ if( mbNopMode = FALSE )
+ {
+ aNopFillStyle = maFillStyle;
+ aNopLineStyle = maLineStyle;
+ maFillStyle = WinMtfFillStyle( Color( COL_TRANSPARENT ), TRUE );
+ maLineStyle = WinMtfLineStyle( Color( COL_TRANSPARENT ), TRUE );
+ mbNopMode = TRUE;
+ }
+ }
+ break;
+
+ default:
+ meRasterOp = ROP_OVERPAINT;
+ break;
+ }
+ }
+ return nRetROP;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::ImplResizeObjectArry( UINT32 nNewEntrys )
+{
+ GDIObj** pGDIObj = new GDIObj*[ mnEntrys << 1 ];
+ UINT32 nIndex;
+ for ( nIndex = 0; nIndex < mnEntrys; nIndex++ )
+ pGDIObj[ nIndex ] = mpGDIObj[ nIndex ];
+ for ( mnEntrys = nNewEntrys; nIndex < mnEntrys; pGDIObj[ nIndex++ ] = NULL );
+ delete mpGDIObj, mpGDIObj = pGDIObj;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle )
+{
+ if ( pStyle )
+ {
+ if ( eType == GDI_FONT )
+ ImplMap( ((WinMtfFontStyle*)pStyle)->aFont );
+ else if ( eType == GDI_PEN )
+ {
+ Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+ if ( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetStyle() == LINE_DASH )
+ {
+ aSize.Width() += 1;
+ long nDotLen = ImplMap( aSize ).Width();
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDistance( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDotLen( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDashLen( nDotLen * 4 );
+ }
+ }
+ }
+ UINT32 nIndex;
+ for ( nIndex = 0; nIndex < mnEntrys; nIndex++ )
+ {
+ if ( mpGDIObj[ nIndex ] == NULL )
+ break;
+ }
+ if ( nIndex == mnEntrys )
+ ImplResizeObjectArry( mnEntrys << 1 );
+
+ mpGDIObj[ nIndex ] = new GDIObj( eType, pStyle );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::CreateObject( INT32 nIndex, GDIObjectType eType, void* pStyle )
+{
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ {
+ nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen
+ if ( pStyle )
+ {
+ if ( eType == GDI_FONT )
+ ImplMap( ((WinMtfFontStyle*)pStyle)->aFont );
+ else if ( eType == GDI_PEN )
+ {
+ Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+ if ( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetStyle() == LINE_DASH )
+ {
+ aSize.Width() += 1;
+ long nDotLen = ImplMap( aSize ).Width();
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDistance( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDotLen( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDashLen( nDotLen * 4 );
+ }
+ }
+ }
+ if ( (UINT32)nIndex >= mnEntrys )
+ ImplResizeObjectArry( nIndex + 16 );
+
+ if ( mpGDIObj[ nIndex ] != NULL )
+ delete mpGDIObj[ nIndex ];
+
+ mpGDIObj[ nIndex ] = new GDIObj( eType, pStyle );
+ }
+ else
+ delete pStyle;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::DeleteObject( INT32 nIndex )
+{
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ {
+ nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen
+ delete mpGDIObj[ nIndex ], mpGDIObj[ nIndex ] = NULL;
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfOutput::DrawText( Point& rPosition, String& rText, INT32* pDXArry )
+{
+ rPosition = ImplMap( rPosition );
+
+ if ( pDXArry )
+ {
+ INT32 i, nSum, nLen = rText.Len();
+
+ for( i = 0, nSum = 0; i < nLen; i++ )
+ {
+ INT32 nTemp = ImplMap( Size( pDXArry[ i ], 0 ) ).Width();
+ nSum += nTemp;
+ pDXArry[ i ] = nSum;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
+
+WinMtfMetaOutput::WinMtfMetaOutput( GDIMetaFile& rGDIMetaFile ) : WinMtfOutput()
+{
+ maLatestLineStyle.aLineColor = Color( 0x12, 0x34, 0x56 );
+ maLatestFillStyle.aFillColor = Color( 0x12, 0x34, 0x56 );
+ mpGDIMetaFile = &rGDIMetaFile;
+ mnPushPopCount = 0;
+
+ mnRop = R2_BLACK + 1;
+ SetRasterOp( R2_BLACK );
+};
+
+//-----------------------------------------------------------------------------------
+
+WinMtfMetaOutput::~WinMtfMetaOutput()
+{
+ while( mnPushPopCount > 0 )
+ {
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ mnPushPopCount--;
+ }
+ mpGDIMetaFile->SetPrefMapMode( MAP_100TH_MM );
+ mpGDIMetaFile->SetPrefSize( Size( mnDevWidth, mnDevHeight ) );
+};
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::UpdateLineStyle()
+{
+ if (!( maLatestLineStyle == maLineStyle ) )
+ {
+ maLatestLineStyle = maLineStyle;
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, !maLineStyle.bTransparent ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::UpdateFillStyle()
+{
+ if (!( maLatestFillStyle == maFillStyle ) )
+ {
+ maLatestFillStyle = maFillStyle;
+ mpGDIMetaFile->AddAction( new MetaFillColorAction( maFillStyle.aFillColor, !maFillStyle.bTransparent ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+UINT32 WinMtfMetaOutput::SetRasterOp( UINT32 nRasterOp )
+{
+ UINT32 nRetROP = WinMtfOutput::SetRasterOp( nRasterOp );
+ if ( nRetROP != nRasterOp )
+ mpGDIMetaFile->AddAction( new MetaRasterOpAction( meRasterOp ) );
+ return nRetROP;
+};
+
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawPixel( const Point& rSource, const Color& rColor )
+{
+ mpGDIMetaFile->AddAction( new MetaPixelAction( ImplMap( rSource), rColor ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::LineTo( const Point& rPoint )
+{
+ Point aDest( ImplMap( rPoint ) );
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaLineAction( maActPos, aDest, maLineStyle.aLineInfo ) );
+ maActPos = aDest;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawLine( const Point& rSource, const Point& rDest )
+{
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaLineAction( ImplMap( rSource), ImplMap( rDest ), maLineStyle.aLineInfo ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawRect( const Rectangle& rRect, BOOL bEdge )
+{
+ UpdateFillStyle();
+ if ( bEdge )
+ {
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, FALSE ) );
+ mpGDIMetaFile->AddAction( new MetaRectAction( ImplMap( rRect ) ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, !maLineStyle.bTransparent ) );
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( ImplMap( rRect ) ),maLineStyle.aLineInfo ) );
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaRectAction( ImplMap( rRect ) ) );
+ }
+ }
+ else
+ {
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( Color(), FALSE ) );
+ mpGDIMetaFile->AddAction( new MetaRectAction( ImplMap( rRect ) ) );
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawRoundRect( const Rectangle& rRect, const Size& rSize )
+{
+ UpdateLineStyle();
+ UpdateFillStyle();
+ mpGDIMetaFile->AddAction( new MetaRoundRectAction( ImplMap( rRect ), labs( ImplMap( rSize ).Width() ), labs( ImplMap( rSize ).Height() ) ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawEllipse( const Rectangle& rRect )
+{
+ UpdateFillStyle();
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ Point aCenter( ImplMap( rRect.Center() ) );
+ Size aRad( ImplMap( Size( rRect.GetWidth() / 2, rRect.GetHeight() / 2 ) ) );
+
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, FALSE ) );
+ mpGDIMetaFile->AddAction( new MetaEllipseAction( ImplMap( rRect ) ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, !maLineStyle.bTransparent ) );
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aCenter, aRad.Width(), aRad.Height() ), maLineStyle.aLineInfo ) );
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaEllipseAction( ImplMap( rRect ) ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawArc( const Rectangle& rRect, const Point& rStart, const Point& rEnd, BOOL bTo )
+{
+ UpdateLineStyle();
+ UpdateFillStyle();
+
+ Rectangle aRect( ImplMap( rRect ) );
+ Point aStart( ImplMap( rStart ) );
+ Point aEnd( ImplMap( rEnd ) );
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aRect, aStart, aEnd, POLY_ARC ), maLineStyle.aLineInfo ) );
+ else
+ mpGDIMetaFile->AddAction( new MetaArcAction( aRect, aStart, aEnd ) );
+
+ if ( bTo )
+ maActPos = aEnd;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawPie( const Rectangle& rRect, const Point& rStart, const Point& rEnd )
+{
+ UpdateFillStyle();
+
+ Rectangle aRect( ImplMap( rRect ) );
+ Point aStart( ImplMap( rStart ) );
+ Point aEnd( ImplMap( rEnd ) );
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, FALSE ) );
+ mpGDIMetaFile->AddAction( new MetaPieAction( aRect, aStart, aEnd ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, !maLineStyle.bTransparent ) );
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aRect, aStart, aEnd, POLY_PIE ), maLineStyle.aLineInfo ) );
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPieAction( aRect, aStart, aEnd ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawChord( const Rectangle& rRect, const Point& rStart, const Point& rEnd )
+{
+ UpdateFillStyle();
+
+ Rectangle aRect( ImplMap( rRect ) );
+ Point aStart( ImplMap( rStart ) );
+ Point aEnd( ImplMap( rEnd ) );
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, FALSE ) );
+ mpGDIMetaFile->AddAction( new MetaChordAction( aRect, aStart, aEnd ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, !maLineStyle.bTransparent ) );
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aRect, aStart, aEnd, POLY_CHORD ), maLineStyle.aLineInfo ) );
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaChordAction( aRect, aStart, aEnd ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawPolygon( Polygon& rPolygon )
+{
+ UpdateFillStyle();
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ USHORT nCount = rPolygon.GetSize();
+ if ( nCount )
+ {
+ if ( rPolygon[ nCount - 1 ] != rPolygon[ 0 ] )
+ {
+ Point aPoint( rPolygon[ 0 ] );
+ rPolygon.Insert( nCount, aPoint );
+ }
+ }
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, FALSE ) );
+ mpGDIMetaFile->AddAction( new MetaPolygonAction( ImplMap( rPolygon ) ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, !maLineStyle.bTransparent ) );
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( rPolygon, maLineStyle.aLineInfo ) );
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolygonAction( ImplMap( rPolygon ) ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawPolyPolygon( PolyPolygon& rPolyPolygon )
+{
+ UpdateLineStyle();
+ UpdateFillStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyPolygonAction( ImplMap( rPolyPolygon ) ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawPolyLine( Polygon& rPolygon, BOOL bTo )
+{
+ UpdateLineStyle();
+ ImplMap( rPolygon );
+ if ( bTo )
+ {
+ rPolygon[ 0 ] = maActPos;
+ maActPos = rPolygon[ rPolygon.GetSize() - 1 ];
+ }
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( rPolygon, maLineStyle.aLineInfo ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawPolyBezier( Polygon& rPolygon, BOOL bTo )
+{
+ UpdateLineStyle();
+ UINT16 nPoints = rPolygon.GetSize();
+ if ( ( nPoints >= 4 ) && ( ( ( nPoints - 4 ) % 3 ) == 0 ) )
+ {
+ ImplMap( rPolygon );
+ if ( bTo )
+ {
+ rPolygon[ 0 ] = maActPos;
+ maActPos = rPolygon[ nPoints - 1 ];
+ }
+ // create bezier polygon
+ const USHORT nSegPoints = 25;
+ const USHORT nSegments = ( ( nPoints - 4 ) / 3 ) + 1;
+ Polygon aBezPoly( nSegments * nSegPoints );
+
+ USHORT nSeg, nBezPos, nStartPos;
+ for( nSeg = 0, nBezPos = 0, nStartPos = 0; nSeg < nSegments; nSeg++, nStartPos += 3 )
+ {
+ const Polygon aSegPoly( rPolygon[ nStartPos ], rPolygon[ nStartPos + 1 ],
+ rPolygon[ nStartPos + 3 ], rPolygon[ nStartPos + 2 ],
+ nSegPoints );
+ for( USHORT nSegPos = 0; nSegPos < nSegPoints; )
+ aBezPoly[ nBezPos++ ] = aSegPoly[ nSegPos++ ];
+ }
+
+ if( nBezPos != aBezPoly.GetSize() )
+ aBezPoly.SetSize( nBezPos );
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( aBezPoly, maLineStyle.aLineInfo ) );
+ }
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::DrawText( Point& rPosition, String& rText, INT32* pDXArry )
+{
+ WinMtfOutput::DrawText( rPosition, rText, pDXArry );
+
+ if( mbFontChanged )
+ {
+ mpGDIMetaFile->AddAction( new MetaFontAction( maFont ) );
+ mpGDIMetaFile->AddAction( new MetaTextAlignAction( maFont.GetAlign() ) );
+ mpGDIMetaFile->AddAction( new MetaTextColorAction( maFont.GetColor() ) );
+ mpGDIMetaFile->AddAction( new MetaTextFillColorAction( maFont.GetFillColor(), !maFont.IsTransparent() ) );
+ mbFontChanged = FALSE;
+ }
+
+ if( mnActTextAlign & ( TA_UPDATECP | TA_RIGHT_CENTER ) )
+ {
+ VirtualDevice aVDev;
+ sal_Int32 nTextWidth;
+
+ aVDev.SetMapMode( MapMode( MAP_100TH_MM ) );
+ aVDev.SetFont( maFont );
+
+ if( pDXArry )
+ {
+ UINT32 nLen = rText.Len();
+ nTextWidth = aVDev.GetTextWidth( rText.GetChar( nLen - 1 ) );
+ if( nLen > 1 )
+ nTextWidth += pDXArry[ nLen - 2 ];
+ }
+ else
+ nTextWidth = aVDev.GetTextWidth( rText );
+
+ if( mnActTextAlign & TA_UPDATECP )
+ rPosition = maActPos;
+
+ if( mnActTextAlign & TA_RIGHT_CENTER )
+ rPosition.X() -= ( ( mnActTextAlign & TA_RIGHT_CENTER ) == TA_RIGHT ) ? nTextWidth : ( nTextWidth >> 1 );
+
+ if( mnActTextAlign & TA_UPDATECP )
+ maActPos.X() = rPosition.X() + nTextWidth;
+ }
+
+ if( pDXArry )
+ mpGDIMetaFile->AddAction( new MetaTextArrayAction( rPosition, rText, pDXArry, 0, STRING_LEN ) );
+ else
+ mpGDIMetaFile->AddAction( new MetaTextAction( rPosition, rText, 0, STRING_LEN ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::ResolveBitmapActions( List& rSaveList )
+{
+ for( ULONG i = 0, nCount = rSaveList.Count(); i < nCount; i++ )
+ {
+ BSaveStruct* pSave1 = (BSaveStruct*) rSaveList.GetObject( i );
+ BOOL bDrawn = FALSE;
+
+ UpdateFillStyle();
+
+ if( i < ( nCount - 1 ) )
+ {
+ BSaveStruct* pSave2 = (BSaveStruct*) rSaveList.GetObject( i + 1 );
+
+ if( ( pSave1->aOutRect == pSave2->aOutRect ) &&
+ ( pSave1->nWinRop == SRCPAINT) && ( pSave2->nWinRop == SRCAND ) )
+ {
+ Bitmap aMask( pSave1->aBmp ); aMask.Invert();
+ BitmapEx aBmpEx( pSave2->aBmp, aMask );
+ mpGDIMetaFile->AddAction( new MetaBmpExScaleAction( ImplMap( pSave1->aOutRect.TopLeft() ), ImplMap( pSave1->aOutRect.GetSize() ), aBmpEx ) );
+ bDrawn = TRUE;
+ i++;
+ delete pSave2;
+ }
+ }
+ if( !bDrawn )
+ {
+ UINT32 nNewROP, nOldROP;
+ switch( pSave1->nWinRop )
+ {
+ case DSTINVERT: nNewROP = R2_NOT; break;
+ case SRCINVERT: nNewROP = R2_XORPEN; break;
+ default: nNewROP = R2_BLACK; break;
+ }
+ nOldROP = SetRasterOp( nNewROP );
+ mpGDIMetaFile->AddAction( new MetaBmpScaleAction( ImplMap( pSave1->aOutRect.TopLeft() ), ImplMap( pSave1->aOutRect.GetSize() ), pSave1->aBmp ) );
+ SetRasterOp( nOldROP );
+ }
+ delete pSave1;
+ }
+ rSaveList.Clear();
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::IntersectClipRect( const Rectangle& rRect )
+{
+ mpGDIMetaFile->AddAction( new MetaISectRectClipRegionAction( ImplMap( rRect ) ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::MoveClipRegion( const Size& rSize )
+{
+ Size aSize( ImplMap( rSize ) );
+ mpGDIMetaFile->AddAction( new MetaMoveClipRegionAction( aSize.Width(), aSize.Height() ) );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::SetDevOrg( const Point& rPoint )
+{
+ mnDevOrgX = rPoint.X();
+ mnDevOrgY = rPoint.Y();
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::SetDevOrgOffset( INT32 nXAdd, INT32 nYAdd )
+{
+ mnDevOrgX += nXAdd;
+ mnDevOrgY += nYAdd;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::SetDevExt( const Size& rSize )
+{
+ mnDevWidth = rSize.Width();
+ mnDevHeight = rSize.Height();
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::ScaleDevExt( double fX, double fY )
+{
+ mnDevWidth = FRound( mnDevWidth * fX );
+ mnDevHeight = FRound( mnDevHeight * fY );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::SetWinOrg( const Point& rPoint )
+{
+ mnWinOrgX = rPoint.X();
+ mnWinOrgY = rPoint.Y();
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::SetWinOrgOffset( INT32 nXAdd, INT32 nYAdd )
+{
+ mnWinOrgX += nXAdd;
+ mnWinOrgY += nYAdd;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::SetWinExt( const Size& rSize )
+{
+ mnWinExtX = rSize.Width();
+ mnWinExtY = rSize.Height();
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::ScaleWinExt( double fX, double fY )
+{
+ mnWinExtX = FRound( mnWinExtX * fX );
+ mnWinExtY = FRound( mnWinExtY * fY );
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::SetWorldTransform( const XForm& rXForm )
+{
+ maXForm.eM11 = rXForm.eM11;
+ maXForm.eM12 = rXForm.eM12;
+ maXForm.eM21 = rXForm.eM21;
+ maXForm.eM22 = rXForm.eM22;
+ maXForm.eDx = rXForm.eDx;
+ maXForm.eDy = rXForm.eDy;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::ModifyWorldTransform( const XForm& rXForm, UINT32 nMode )
+{
+ switch( nMode )
+ {
+ case MWT_IDENTITY :
+ {
+ maXForm.eM11 = maXForm.eM12 = maXForm.eM21 = maXForm.eM22 = 1.0f;
+ maXForm.eDx = maXForm.eDx = 0.0f;
+ }
+ break;
+
+ case MWT_LEFTMULTIPLY :
+ case MWT_RIGHTMULTIPLY :
+ break;
+ }
+ }
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::Push( BOOL bExtSet )
+{
+ WinMtfOutput::Push( bExtSet );
+ // bei SaveDC muessen wir die verzoegerte Selektion
+ // von Objekten umgehen, damit beim RestoreDC wieder
+ // die richtigen Objekte selektiert werden
+ UpdateLineStyle();
+ UpdateFillStyle();
+ if( mbFontChanged )
+ {
+ mpGDIMetaFile->AddAction( new MetaFontAction( maFont ) );
+ mpGDIMetaFile->AddAction( new MetaTextAlignAction( maFont.GetAlign() ) );
+ mpGDIMetaFile->AddAction( new MetaTextColorAction( maFont.GetColor() ) );
+ mpGDIMetaFile->AddAction( new MetaTextFillColorAction( maFont.GetFillColor(), !maFont.IsTransparent() ) );
+ mbFontChanged = FALSE;
+ }
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_ALL ) );
+ mnPushPopCount++;
+}
+
+//-----------------------------------------------------------------------------------
+
+void WinMtfMetaOutput::Pop()
+{
+ WinMtfOutput::Pop();
+ maLatestLineStyle = maLineStyle;
+ maLatestFillStyle = maFillStyle;
+ if( mnPushPopCount > 0 )
+ {
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ mnPushPopCount--;
+ }
+}
+
diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx
new file mode 100644
index 000000000000..2d129a55ab6b
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/winmtf.hxx
@@ -0,0 +1,687 @@
+/*************************************************************************
+ *
+ * $RCSfile: winmtf.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _WINMTF_HXX
+#define _WINMTF_HXX
+
+#include <math.h>
+#include <stdlib.h>
+#include <sot/object.hxx>
+#ifndef _TOOL_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STACK_HXX
+#include <tools/stack.hxx>
+#endif
+#ifndef _TOOLS_TABLE_HXX
+#include <tools/table.hxx>
+#endif
+#ifndef _DYNARY_HXX
+#include <tools/dynary.hxx>
+#endif
+#ifndef _SV_GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <vcl/virdev.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <vcl/poly.hxx>
+#endif
+#ifndef _SV_FONT_HXX
+#include <vcl/font.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+#ifndef _SV_LINEINFO_HXX
+#include <vcl/lineinfo.hxx>
+#endif
+#ifndef _FLTCALL_HXX
+#include <fltcall.hxx>
+#endif
+
+
+#define TRANSPARENT 1
+#define OPAQUE 2
+#define BKMODE_LAST 2
+
+/* xform stuff */
+#define MWT_IDENTITY 1
+#define MWT_LEFTMULTIPLY 2
+#define MWT_RIGHTMULTIPLY 3
+
+#define ENHMETA_STOCK_OBJECT 0x80000000
+
+/* Stock Logical Objects */
+#define WHITE_BRUSH 0
+#define LTGRAY_BRUSH 1
+#define GRAY_BRUSH 2
+#define DKGRAY_BRUSH 3
+#define BLACK_BRUSH 4
+#define NULL_BRUSH 5
+#define HOLLOW_BRUSH NULL_BRUSH
+#define WHITE_PEN 6
+#define BLACK_PEN 7
+#define NULL_PEN 8
+#define OEM_FIXED_FONT 10
+#define ANSI_FIXED_FONT 11
+#define ANSI_VAR_FONT 12
+#define SYSTEM_FONT 13
+#define DEVICE_DEFAULT_FONT 14
+#define DEFAULT_PALETTE 15
+#define SYSTEM_FIXED_FONT 16
+
+
+#define R2_BLACK 1
+#define R2_NOTMERGEPEN 2
+#define R2_MASKNOTPEN 3
+#define R2_NOTCOPYPEN 4
+#define R2_MASKPENNOT 5
+#define R2_NOT 6
+#define R2_XORPEN 7
+#define R2_NOTMASKPEN 8
+#define R2_MASKPEN 9
+#define R2_NOTXORPEN 10
+#define R2_NOP 11
+#define R2_MERGENOTPEN 12
+#define R2_COPYPEN 13
+#define R2_MERGEPENNOT 14
+#define R2_MERGEPEN 15
+#define R2_WHITE 16
+
+/* Mapping Modes */
+#define MM_TEXT 1
+#define MM_LOMETRIC 2
+#define MM_HIMETRIC 3
+#define MM_LOENGLISH 4
+#define MM_HIENGLISH 5
+#define MM_TWIPS 6
+#define MM_ISOTROPIC 7
+#define MM_ANISOTROPIC 8
+
+
+/* Graphics Modes */
+#define GM_COMPATIBLE 1
+#define GM_ADVANCED 2
+#define GM_LAST 2
+
+/* StretchBlt() Modes */
+#define BLACKONWHITE 1
+#define WHITEONBLACK 2
+#define COLORONCOLOR 3
+#define HALFTONE 4
+#define MAXSTRETCHBLTMODE 4
+#define STRETCH_ANDSCANS BLACKONWHITE
+#define STRETCH_ORSCANS WHITEONBLACK
+#define STRETCH_DELETESCANS COLORONCOLOR
+#define STRETCH_HALFTONE HALFTONE
+
+#define LF_FACESIZE 32
+
+struct LOGFONTW
+{
+ INT32 lfHeight;
+ INT32 lfWidth;
+ INT32 lfEscapement;
+ INT32 lfOrientation;
+ INT32 lfWeight;
+ BYTE lfItalic;
+ BYTE lfUnderline;
+ BYTE lfStrikeOut;
+ BYTE lfCharSet;
+ BYTE lfOutPrecision;
+ BYTE lfClipPrecision;
+ BYTE lfQuality;
+ BYTE lfPitchAndFamily;
+ BYTE lfFaceName[ LF_FACESIZE ];
+};
+
+#define TA_NOUPDATECP 0x0000
+#define TA_UPDATECP 0x0001
+#define TA_LEFT 0x0000
+#define TA_RIGHT 0x0002
+#define TA_CENTER 0x0006
+#define TA_RIGHT_CENTER (TA_RIGHT | TA_CENTER)
+#define TA_TOP 0x0000
+#define TA_BOTTOM 0x0008
+#define TA_BASELINE 0x0018
+
+#define SRCCOPY 0x00CC0020L
+#define SRCPAINT 0x00EE0086L
+#define SRCAND 0x008800C6L
+#define SRCINVERT 0x00660046L
+#define SRCERASE 0x00440328L
+#define NOTSRCCOPY 0x00330008L
+#define NOTSRCERASE 0x001100A6L
+#define MERGECOPY 0x00C000CAL
+#define MERGEPAINT 0x00BB0226L
+#define PATCOPY 0x00F00021L
+#define PATPAINT 0x00FB0A09L
+#define PATINVERT 0x005A0049L
+#define DSTINVERT 0x00550009L
+#define BLACKNESS 0x00000042L
+#define WHITENESS 0x00FF0062L
+
+#define PS_SOLID 0
+#define PS_DASH 1
+#define PS_DOT 2
+#define PS_DASHDOT 3
+#define PS_DASHDOTDOT 4
+#define PS_NULL 5
+#define PS_INSIDEFRAME 6
+
+#define ANSI_CHARSET 0
+#define DEFAULT_CHARSET 1
+#define SYMBOL_CHARSET 2
+#define SHIFTJIS_CHARSET 128
+#define HANGEUL_CHARSET 129
+#define CHINESEBIG5_CHARSET 136
+#define OEM_CHARSET 255
+
+#define DEFAULT_PITCH 0x00
+#define FIXED_PITCH 0x01
+#define VARIABLE_PITCH 0x02
+
+/* Font Families */
+#define FF_DONTCARE 0x00
+#define FF_ROMAN 0x10
+#define FF_SWISS 0x20
+#define FF_MODERN 0x30
+#define FF_SCRIPT 0x40
+#define FF_DECORATIVE 0x50
+
+#define FW_DONTCARE 0
+#define FW_THIN 100
+#define FW_EXTRALIGHT 200
+#define FW_LIGHT 300
+#define FW_NORMAL 400
+#define FW_MEDIUM 500
+#define FW_SEMIBOLD 600
+#define FW_BOLD 700
+#define FW_EXTRABOLD 800
+#define FW_HEAVY 900
+#define FW_ULTRALIGHT 200
+#define FW_REGULAR 400
+#define FW_DEMIBOLD 600
+#define FW_ULTRABOLD 800
+#define FW_BLACK 900
+
+#define BS_SOLID 0
+#define BS_NULL 1
+#define BS_HOLLOW 1
+#define BS_HATCHED 2
+#define BS_PATTERN 3
+#define BS_INDEXED 4
+#define BS_DIBPATTERN 5
+#define BS_DIBPATTERNPT 6
+#define BS_PATTERN8X8 7
+#define BS_DIBPATTERN8X8 8
+#define BS_MONOPATTERN 9
+
+#define W_HS_HORIZONTAL 0
+#define W_HS_VERTICAL 1
+#define W_HS_FDIAGONAL 2
+#define W_HS_BDIAGONAL 3
+#define W_HS_CROSS 4
+#define W_HS_DIAGCROSS 5
+
+//============================ WMFReader ==================================
+
+// -----------------------------------------------------------------------------
+
+struct WinMtfFontStyle
+{
+ Font aFont;
+
+ WinMtfFontStyle( LOGFONTW& rLogFont );
+};
+
+// -----------------------------------------------------------------------------
+
+struct WinMtfFillStyle
+{
+ Color aFillColor;
+ BOOL bTransparent;
+
+ WinMtfFillStyle() :
+ aFillColor ( Color( COL_BLACK ) ),
+ bTransparent( FALSE )
+ {
+ };
+
+ WinMtfFillStyle( const Color& rColor, BOOL bTrans = FALSE ) :
+ aFillColor ( rColor ),
+ bTransparent( bTrans )
+ {
+ };
+
+ BOOL operator==( const WinMtfFillStyle& rStyle )
+ { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) ); };
+ BOOL operator==( WinMtfFillStyle* pStyle )
+ { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) ); };
+ void operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; };
+ void operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; };
+};
+
+// -----------------------------------------------------------------------------
+
+struct WinMtfLineStyle
+{
+ Color aLineColor;
+ LineInfo aLineInfo;
+ BOOL bTransparent;
+
+ WinMtfLineStyle() :
+ aLineColor ( COL_BLACK ),
+ bTransparent( FALSE ) {};
+
+ WinMtfLineStyle( const Color& rColor, BOOL bTrans = FALSE ) :
+ aLineColor ( rColor ),
+ bTransparent( bTrans ) {};
+
+ WinMtfLineStyle( const Color& rColor, const LineInfo rStyle, BOOL bTrans = FALSE ) :
+ aLineColor ( rColor ),
+ aLineInfo ( rStyle ),
+ bTransparent( bTrans ) {};
+
+ BOOL operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); };
+ BOOL operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); };
+ void operator=( const WinMtfLineStyle& rStyle )
+ {
+ aLineColor = rStyle.aLineColor;
+ bTransparent = rStyle.bTransparent;
+ aLineInfo = rStyle.aLineInfo;
+ };
+
+ void operator=( WinMtfLineStyle* pStyle )
+ {
+ aLineColor = pStyle->aLineColor;
+ bTransparent = pStyle->bTransparent;
+ aLineInfo = pStyle->aLineInfo;
+ };
+};
+
+// -----------------------------------------------------------------------------
+
+struct SaveStruct
+{
+ UINT32 nBkMode;
+ BOOL bWinExtSet;
+ long nWinOrgX, nWinOrgY, nWinExtX, nWinExtY;
+ long nDevOrgX, nDevOrgY, nDevWidth, nDevHeight;
+ WinMtfLineStyle aLineStyle;
+ WinMtfFillStyle aFillStyle;
+ Color aBkColor;
+ Color aTextColor;
+ Point aActPos;
+ BOOL bFontChanged;
+ Font aFont;
+ UINT32 nActTextAlign;
+};
+
+DECLARE_STACK( SaveStack, SaveStruct* );
+
+// -----------------------------------------------------------------------------
+
+struct BSaveStruct
+{
+ Bitmap aBmp;
+ Rectangle aOutRect;
+ UINT32 nWinRop;
+
+ BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, UINT32 nRop ) :
+ aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ){};
+};
+
+// -----------------------------------------------------------------------------
+
+enum GDIObjectType { GDI_DUMMY = 0, GDI_PEN = 1, GDI_BRUSH = 2, GDI_FONT = 3, GDI_PALETTE = 4, GDI_BITMAP = 5, GDI_REGION = 6 };
+
+struct GDIObj
+{
+ void* pStyle;
+ GDIObjectType eType;
+
+ GDIObj() :
+ pStyle ( NULL ),
+ eType ( GDI_DUMMY )
+ {
+ };
+
+ GDIObj( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; };
+ void Set( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; };
+ void Delete()
+ {
+ if ( pStyle )
+ {
+ switch ( eType )
+ {
+ case GDI_PEN :
+ delete (WinMtfLineStyle*)pStyle;
+ break;
+ case GDI_BRUSH :
+ delete (WinMtfFillStyle*)pStyle;
+ break;
+ case GDI_FONT :
+ delete (WinMtfFontStyle*)pStyle;
+ break;
+
+ default:
+ delete pStyle;
+ }
+ pStyle = NULL;
+ }
+ };
+
+ ~GDIObj()
+ {
+ Delete();
+ }
+};
+
+// -----------------------------------------------------------------------------
+
+struct XForm
+{
+ float eM11;
+ float eM12;
+ float eM21;
+ float eM22;
+ float eDx;
+ float eDy;
+ XForm()
+ {
+ eM11 = eM12 = eM21 = eM22 = 1.0f;
+ eDx = eDx = 0.0f;
+ };
+};
+
+// -----------------------------------------------------------------------------
+
+class WinMtfOutput
+{
+ protected:
+
+ GDIObj** mpGDIObj;
+ UINT32 mnEntrys;
+ UINT32 mnActTextAlign; // Aktuelle Textausrichtung (im MS-Windows-Format)
+ UINT32 mnBkMode; // Aktueller Modus, wie der Hintergrund uebermalt
+ Point maActPos; // wird. (ist gleich TRANSPARENT oder nicht)
+
+
+ BOOL mbFontChanged;
+ Font maFont;
+ WinMtfLineStyle maLineStyle;
+ WinMtfFillStyle maFillStyle;
+
+ Color maTextColor;
+ Color maBkColor;
+
+ UINT32 mnRop;
+ RasterOp meRasterOp;
+ BOOL mbNopMode;
+
+ SaveStack maSaveStack; // Stapel fuer aktuelle Zustaende bzw. DCs (Drawing-Contexts)
+
+ XForm maXForm;
+ long mnDevOrgX, mnDevOrgY;
+ long mnDevWidth, mnDevHeight;
+ long mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin
+ long mnWinExtX, mnWinExtY; // aktuelles Window-Extent
+
+ Point ImplMap( const Point& rPt );
+ Size ImplMap( const Size& rSz );
+ Rectangle ImplMap( const Rectangle& rRectangle );
+ void ImplMap( Font& rFont );
+ Polygon& ImplMap( Polygon& rPolygon );
+ PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon );
+ void ImplResizeObjectArry( UINT32 nNewEntry );
+
+ public:
+
+ virtual void SetDevOrg( const Point& rPoint ) {};
+ virtual void SetDevOrgOffset( INT32 nXAdd, INT32 nYAdd ){};
+ virtual void SetDevExt( const Size& rSize ){};
+ virtual void ScaleDevExt( double fX, double fY ){};
+
+ virtual void SetWinOrg( const Point& rPoint ){};
+ virtual void SetWinOrgOffset( INT32 nX, INT32 nY ){};
+ virtual void SetWinExt( const Size& rSize ){};
+ virtual void ScaleWinExt( double fX, double fY ){};
+
+ virtual void SetWorldTransform( const XForm& rXForm ){};
+ virtual void ModifyWorldTransform( const XForm& rXForm, UINT32 nMode ){};
+
+ virtual void Push( BOOL bWinExtSet = TRUE );
+ virtual void Pop();
+
+ void SetBkMode( UINT32 nMode );
+ void SetBkColor( const Color& rColor );
+ void SetTextColor( const Color& rColor );
+ void SetTextAlign( UINT32 nAlign );
+ virtual UINT32 SetRasterOp( UINT32 nRasterOp );
+ void CreateObject( GDIObjectType, void* pStyle = NULL );
+ void CreateObject( INT32 nIndex, GDIObjectType, void* pStyle = NULL );
+ void DeleteObject( INT32 nIndex );
+ void SelectObject( INT32 nIndex );
+ CharSet GetCharSet(){ return maFont.GetCharSet(); };
+
+ virtual void DrawPixel( const Point& rSource, const Color& rColor ){};
+ void MoveTo( const Point& rPoint ) { maActPos = ImplMap( rPoint ); };
+ virtual void LineTo( const Point& rPoint ){};
+ virtual void DrawLine( const Point& rSource, const Point& rDest ){};
+ virtual void DrawRect( const Rectangle& rRect, BOOL bEdge = TRUE ){};
+ virtual void DrawRoundRect( const Rectangle& rRect, const Size& rSize ){};
+ virtual void DrawEllipse( const Rectangle& rRect ){};
+ virtual void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, BOOL bDrawTo = FALSE ){};
+ virtual void DrawPie( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ){};
+ virtual void DrawChord( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ){};
+ virtual void DrawPolygon( Polygon& rPolygon ){};
+ virtual void DrawPolyPolygon( PolyPolygon& rPolyPolygon ){};
+ virtual void DrawPolyLine( Polygon& rPolygon, BOOL bDrawTo = FALSE ){};
+ virtual void DrawPolyBezier( Polygon& rPolygin, BOOL bDrawTo = FALSE ){};
+ virtual void DrawText( Point& rPosition, String& rString, INT32* pDXArry = NULL );
+ virtual void ResolveBitmapActions( List& rSaveList ){};
+ virtual void IntersectClipRect( const Rectangle& rRectangle ){};
+ virtual void MoveClipRegion( const Size& rSize ){};
+
+ WinMtfOutput();
+ virtual ~WinMtfOutput();
+};
+
+// -----------------------------------------------------------------------------
+
+class WinMtfMetaOutput : public WinMtfOutput
+{
+ UINT32 mnPushPopCount; // hoehe des Stapels
+ GDIMetaFile* mpGDIMetaFile;
+ WinMtfLineStyle maLatestLineStyle;
+ WinMtfFillStyle maLatestFillStyle;
+
+ void UpdateLineStyle();
+ void UpdateFillStyle();
+
+ public:
+
+ virtual void SetDevOrg( const Point& rPoint );
+ virtual void SetDevOrgOffset( INT32 nXAdd, INT32 nYAdd );
+ virtual void SetDevExt( const Size& rSize );
+ virtual void ScaleDevExt( double fX, double fY );
+
+ virtual void SetWinOrg( const Point& rPoint );
+ virtual void SetWinOrgOffset( INT32 nX, INT32 nY );
+ virtual void SetWinExt( const Size& rSize );
+ virtual void ScaleWinExt( double fX, double fY );
+
+ virtual void SetWorldTransform( const XForm& rXForm );
+ virtual void ModifyWorldTransform( const XForm& rXForm, UINT32 nMode );
+
+ virtual void Push( BOOL bWinExtSet = TRUE );
+ virtual void Pop();
+
+ virtual UINT32 SetRasterOp( UINT32 nRasterOp );
+
+ virtual void LineTo( const Point& rPoint );
+ virtual void DrawPixel( const Point& rSource, const Color& rColor );
+ virtual void DrawLine( const Point& rSource, const Point& rDest );
+ virtual void DrawRect( const Rectangle& rRect, BOOL bEdge = TRUE );
+ virtual void DrawRoundRect( const Rectangle& rRect, const Size& rSize );
+ virtual void DrawEllipse( const Rectangle& rRect );
+ virtual void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, BOOL bDrawTo = FALSE );
+ virtual void DrawPie( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle );
+ virtual void DrawChord( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle );
+ virtual void DrawPolygon( Polygon& rPolygon );
+ virtual void DrawPolyPolygon( PolyPolygon& rPolyPolygon );
+ virtual void DrawPolyLine( Polygon& rPolygon, BOOL bDrawTo = FALSE );
+ virtual void DrawPolyBezier( Polygon& rPolygin, BOOL bDrawTo = FALSE );
+ virtual void DrawText( Point& rPosition, String& rString, INT32* pDXArry = NULL );
+ virtual void ResolveBitmapActions( List& rSaveList );
+ virtual void IntersectClipRect( const Rectangle& rRectangle );
+ virtual void MoveClipRegion( const Size& rSize );
+
+
+ WinMtfMetaOutput( GDIMetaFile& rGDIMetaFile );
+ virtual ~WinMtfMetaOutput();
+};
+
+// -----------------------------------------------------------------------------
+
+class WinMtf
+{
+ protected:
+
+ WinMtfOutput* pOut; //
+ SvStream* pWMF; // Die einzulesende WMF/EMF-Datei
+
+ UINT32 nStartPos, nEndPos;
+ List aBmpSaveList;
+
+ PFilterCallback pCallback;
+ void* pCallerData;
+
+ // Sorgt dafuer, das aSampledBrush der aktuelle Brush des GDIMetaFiles ist.
+
+ Color ReadColor();
+ BOOL Callback( USHORT nPercent );
+
+ WinMtf( WinMtfOutput* pOut, SvStream& rStreamWMF, PFilterCallback pcallback, void * pcallerdata );
+ ~WinMtf();
+
+ public:
+
+};
+
+//============================ EMFReader ==================================
+
+class EnhWMFReader : public WinMtf
+{
+
+private:
+
+ INT32 nRecordCount;
+
+ BOOL ReadHeader();
+ Rectangle ReadRectangle( INT32, INT32, INT32, INT32 ); // Liesst und konvertiert ein Rechteck
+ void ImplExtTextOut( BOOL bWideCharakter );
+
+public:
+ EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile,
+ PFilterCallback pcallback, void * pcallerdata ) : WinMtf( new WinMtfMetaOutput( rGDIMetaFile ), rStreamWMF,
+ pcallback, pcallerdata ) {};
+
+ BOOL ReadEnhWMF();
+};
+
+//============================ WMFReader ==================================
+
+class WMFReader : public WinMtf
+{
+private:
+
+ BOOL bWinExtSet;
+ UINT16 nUnitsPerInch;
+
+ // Liesst den Kopf der WMF-Datei
+ BOOL ReadHeader();
+
+ // Liesst die Parameter des Rocords mit der Funktionsnummer nFunction.
+ void ReadRecordParams( USHORT nFunction );
+
+ Point ReadPoint(); // Liesst und konvertiert einen Punkt (erst X dann Y)
+ Point ReadYX(); // Liesst und konvertiert einen Punkt (erst Y dann X)
+ Rectangle ReadRectangle(); // Liesst und konvertiert ein Rechteck
+ Size ReadYXExt();
+ void ImplSetWMFSize( const Size& rSize );
+
+public:
+
+ WMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile,
+ PFilterCallback pcallback, void * pcallerdata ) : WinMtf( new WinMtfMetaOutput( rGDIMetaFile ), rStreamWMF,
+ pcallback, pcallerdata ) {};
+
+ // Liesst aus dem Stream eine WMF-Datei und fuellt das GDIMetaFile
+ void ReadWMF();
+};
+
+#endif
+
+
diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx
new file mode 100644
index 000000000000..6e352ae8ecfd
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/winwmf.cxx
@@ -0,0 +1,886 @@
+/*************************************************************************
+ *
+ * $RCSfile: winwmf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "winmtf.hxx"
+
+//====================== MS-Windows-defines ===============================
+
+#define W_META_SETBKCOLOR 0x0201
+#define W_META_SETBKMODE 0x0102
+#define W_META_SETMAPMODE 0x0103
+#define W_META_SETROP2 0x0104
+#define W_META_SETRELABS 0x0105
+#define W_META_SETPOLYFILLMODE 0x0106
+#define W_META_SETSTRETCHBLTMODE 0x0107
+#define W_META_SETTEXTCHAREXTRA 0x0108
+#define W_META_SETTEXTCOLOR 0x0209
+#define W_META_SETTEXTJUSTIFICATION 0x020A
+#define W_META_SETWINDOWORG 0x020B
+#define W_META_SETWINDOWEXT 0x020C
+#define W_META_SETVIEWPORTORG 0x020D
+#define W_META_SETVIEWPORTEXT 0x020E
+#define W_META_OFFSETWINDOWORG 0x020F
+#define W_META_SCALEWINDOWEXT 0x0410
+#define W_META_OFFSETVIEWPORTORG 0x0211
+#define W_META_SCALEVIEWPORTEXT 0x0412
+#define W_META_LINETO 0x0213
+#define W_META_MOVETO 0x0214
+#define W_META_EXCLUDECLIPRECT 0x0415
+#define W_META_INTERSECTCLIPRECT 0x0416
+#define W_META_ARC 0x0817
+#define W_META_ELLIPSE 0x0418
+#define W_META_FLOODFILL 0x0419
+#define W_META_PIE 0x081A
+#define W_META_RECTANGLE 0x041B
+#define W_META_ROUNDRECT 0x061C
+#define W_META_PATBLT 0x061D
+#define W_META_SAVEDC 0x001E
+#define W_META_SETPIXEL 0x041F
+#define W_META_OFFSETCLIPRGN 0x0220
+#define W_META_TEXTOUT 0x0521
+#define W_META_BITBLT 0x0922
+#define W_META_STRETCHBLT 0x0B23
+#define W_META_POLYGON 0x0324
+#define W_META_POLYLINE 0x0325
+#define W_META_ESCAPE 0x0626
+#define W_META_RESTOREDC 0x0127
+#define W_META_FILLREGION 0x0228
+#define W_META_FRAMEREGION 0x0429
+#define W_META_INVERTREGION 0x012A
+#define W_META_PAINTREGION 0x012B
+#define W_META_SELECTCLIPREGION 0x012C
+#define W_META_SELECTOBJECT 0x012D
+#define W_META_SETTEXTALIGN 0x012E
+#define W_META_DRAWTEXT 0x062F
+#define W_META_CHORD 0x0830
+#define W_META_SETMAPPERFLAGS 0x0231
+#define W_META_EXTTEXTOUT 0x0a32
+#define W_META_SETDIBTODEV 0x0d33
+#define W_META_SELECTPALETTE 0x0234
+#define W_META_REALIZEPALETTE 0x0035
+#define W_META_ANIMATEPALETTE 0x0436
+#define W_META_SETPALENTRIES 0x0037
+#define W_META_POLYPOLYGON 0x0538
+#define W_META_RESIZEPALETTE 0x0139
+#define W_META_DIBBITBLT 0x0940
+#define W_META_DIBSTRETCHBLT 0x0b41
+#define W_META_DIBCREATEPATTERNBRUSH 0x0142
+#define W_META_STRETCHDIB 0x0f43
+#define W_META_EXTFLOODFILL 0x0548
+#define W_META_RESETDC 0x014C
+#define W_META_STARTDOC 0x014D
+#define W_META_STARTPAGE 0x004F
+#define W_META_ENDPAGE 0x0050
+#define W_META_ABORTDOC 0x0052
+#define W_META_ENDDOC 0x005E
+#define W_META_DELETEOBJECT 0x01f0
+#define W_META_CREATEPALETTE 0x00f7
+#define W_META_CREATEBRUSH 0x00F8
+#define W_META_CREATEPATTERNBRUSH 0x01F9
+#define W_META_CREATEPENINDIRECT 0x02FA
+#define W_META_CREATEFONTINDIRECT 0x02FB
+#define W_META_CREATEBRUSHINDIRECT 0x02FC
+#define W_META_CREATEBITMAPINDIRECT 0x02FD
+#define W_META_CREATEBITMAP 0x06FE
+#define W_META_CREATEREGION 0x06FF
+
+//=================== Methoden von WMFReader ==============================
+
+inline Point WMFReader::ReadPoint()
+{
+ short nX, nY;
+ *pWMF >> nX >> nY;
+ return Point( nX, nY );
+}
+
+// ------------------------------------------------------------------------
+
+inline Point WMFReader::ReadYX()
+{
+ short nX, nY;
+ *pWMF >> nY >> nX;
+ return Point( nX, nY );
+}
+
+// ------------------------------------------------------------------------
+
+Rectangle WMFReader::ReadRectangle()
+{
+ Point aBR, aTL;
+ aBR = ReadYX();
+ aTL = ReadYX();
+ aBR.X()--;
+ aBR.Y()--;
+ return Rectangle( aTL, aBR );
+}
+
+// ------------------------------------------------------------------------
+
+Size WMFReader::ReadYXExt()
+{
+ short nW, nH;
+ *pWMF >> nH >> nW;
+ return Size( nW, nH );
+}
+
+// ------------------------------------------------------------------------
+
+void WMFReader::ReadRecordParams( USHORT nFunction )
+{
+ switch( nFunction )
+ {
+ case W_META_SETBKCOLOR:
+ {
+ pOut->SetBkColor( ReadColor() );
+ }
+ break;
+
+ case W_META_SETBKMODE:
+ {
+ USHORT nDat;
+ *pWMF >> nDat;
+ pOut->SetBkMode( nDat );
+ }
+ break;
+
+ // !!!
+ case W_META_SETMAPMODE:
+ {
+ short nMapMode;
+ *pWMF >> nMapMode;
+#ifdef DBG_ASSERT
+ if ( nMapMode != 8 ) // nur MM_ANISOTROPHIC == 8 wird unterstuetzt
+ {
+ DBG_ASSERT(0,"WMF-Import: MapMode ignored");
+ }
+#endif
+ }
+ break;
+
+ case W_META_SETROP2:
+ {
+ UINT16 nROP2;
+ *pWMF >> nROP2;
+ pOut->SetRasterOp( nROP2 );
+ }
+ break;
+
+ case W_META_SETTEXTCOLOR:
+ {
+ pOut->SetTextColor( ReadColor() );
+ }
+ break;
+
+ case W_META_SETWINDOWORG:
+ {
+ pOut->SetWinOrg( ReadYX() );
+ }
+ break;
+
+ case W_META_SETWINDOWEXT:
+ {
+ short nWidth, nHeight;
+ *pWMF >> nHeight >> nWidth;
+ ImplSetWMFSize( Size( nWidth, nHeight ) );
+ }
+ break;
+
+ case W_META_OFFSETWINDOWORG:
+ {
+ short nXAdd, nYAdd;
+ *pWMF >> nYAdd >> nXAdd;
+ pOut->SetWinOrgOffset( nXAdd, nYAdd );
+ }
+ break;
+
+ case W_META_SCALEWINDOWEXT:
+ {
+ short nXNum, nXDenom, nYNum, nYDenom;
+ *pWMF >> nYDenom >> nYNum >> nXDenom >> nXNum;
+ pOut->ScaleWinExt( (double)nXNum / nXDenom, (double)nYNum / nYDenom );
+ }
+ break;
+
+ case W_META_SETVIEWPORTORG:
+ case W_META_SETVIEWPORTEXT:
+ break;
+
+ case W_META_OFFSETVIEWPORTORG:
+ {
+ short nXAdd, nYAdd;
+ *pWMF >> nYAdd >> nXAdd;
+ pOut->SetDevOrgOffset( nXAdd, nYAdd );
+ }
+ break;
+
+ case W_META_SCALEVIEWPORTEXT:
+ {
+ short nXNum, nXDenom, nYNum, nYDenom;
+ *pWMF >> nYDenom >> nYNum >> nXDenom >> nXNum;
+ pOut->ScaleDevExt( (double)nXNum / nXDenom, (double)nYNum / nYDenom );
+ }
+ break;
+
+ case W_META_LINETO:
+ {
+ pOut->LineTo( ReadYX() );
+ }
+ break;
+
+ case W_META_MOVETO:
+ {
+ pOut->MoveTo( ReadYX() );
+ }
+ break;
+
+ case W_META_INTERSECTCLIPRECT:
+ {
+ pOut->IntersectClipRect( ReadRectangle() );
+ }
+ break;
+
+ case W_META_RECTANGLE:
+ {
+ pOut->DrawRect( ReadRectangle() );
+ }
+ break;
+
+ case W_META_ROUNDRECT:
+ {
+ Size aSize( ReadYXExt() );
+ pOut->DrawRoundRect( ReadRectangle(), aSize );
+ }
+ break;
+
+ case W_META_ELLIPSE:
+ {
+ pOut->DrawEllipse( ReadRectangle() );
+ }
+ break;
+
+ case W_META_ARC:
+ {
+ Point aEnd( ReadYX() );
+ Point aStart( ReadYX() );
+ pOut->DrawArc( ReadRectangle(), aStart, aEnd );
+ }
+ break;
+
+ case W_META_PIE:
+ {
+ Point aEnd( ReadYX() );
+ Point aStart( ReadYX() );
+ pOut->DrawPie( ReadRectangle(), aStart, aEnd );
+ }
+ break;
+
+ case W_META_CHORD:
+ {
+ Point aEnd( ReadYX() );
+ Point aStart( ReadYX() );
+ pOut->DrawChord( ReadRectangle(), aStart, aEnd );
+ }
+ break;
+
+ case W_META_POLYGON:
+ {
+ USHORT i,nPoints;
+ *pWMF >> nPoints;
+ Polygon aPoly( nPoints );
+ for( i = 0; i < nPoints; i++ )
+ aPoly[ i ] = ReadPoint();
+ pOut->DrawPolygon( aPoly );
+ }
+ break;
+
+ case W_META_POLYPOLYGON:
+ {
+ USHORT i, nPoly, nPoints;
+ USHORT* pnPoints;
+ Point* pPtAry;
+ // Anzahl der Polygone:
+ *pWMF >> nPoly;
+ // Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln:
+ pnPoints = new USHORT[ nPoly ];
+ nPoints = 0;
+ for( i = 0; i < nPoly; i++ )
+ {
+ *pWMF >> pnPoints[i];
+ nPoints += pnPoints[i];
+ }
+ // Polygonpunkte holen:
+ pPtAry = (Point*) new char[ nPoints * sizeof(Point) ];
+ for ( i = 0; i < nPoints; i++ )
+ pPtAry[ i ] = ReadPoint();
+ // PolyPolygon Actions erzeugen
+ PolyPolygon aPolyPoly( nPoly, pnPoints, pPtAry );
+ pOut->DrawPolyPolygon( aPolyPoly );
+ delete (char*) pPtAry;
+ delete pnPoints;
+ }
+ break;
+
+ case W_META_POLYLINE:
+ {
+ USHORT i,nPoints;
+ *pWMF >> nPoints;
+ Polygon aPoly( nPoints );
+ for( i = 0; i < nPoints; i++ )
+ aPoly[ i ] = ReadPoint();
+ pOut->DrawPolyLine( aPoly );
+ }
+ break;
+
+ case W_META_SAVEDC:
+ {
+ pOut->Push( bWinExtSet );
+ }
+ break;
+
+ case W_META_RESTOREDC:
+ {
+ pOut->Pop();
+ }
+ break;
+
+ case W_META_SETPIXEL:
+ {
+ const Color aColor = ReadColor();
+ pOut->DrawPixel( ReadYX(), aColor );
+ }
+ break;
+
+ case W_META_OFFSETCLIPRGN:
+ {
+ pOut->MoveClipRegion( ReadYXExt() );
+ }
+ break;
+
+ case W_META_TEXTOUT:
+ {
+ USHORT nLength;
+ *pWMF >> nLength;
+ if ( nLength )
+ {
+ char* pChar = new char[ ( nLength + 1 ) &~ 1 ];
+ pWMF->Read( pChar, ( nLength + 1 ) &~ 1 );
+ String aText( pChar, nLength, pOut->GetCharSet() );
+ delete pChar;
+ Point aPosition( ReadYX() );
+ pOut->DrawText( aPosition, aText );
+ }
+ }
+ break;
+
+ case W_META_EXTTEXTOUT:
+ {
+ USHORT i,nLen,nOptions,nData;
+ long nRecordSize,nRecSizeLeft, *pDXAry;
+ Point aPosition;
+ Rectangle aRect;
+
+ pWMF->SeekRel(-6);
+ *pWMF >> nRecordSize;
+ pWMF->SeekRel(2);
+ aPosition = ReadYX();
+ *pWMF >> nLen >> nOptions;
+ // Nur wenn der Text auch Zeichen enthaelt, macht die Ausgabe Sinn
+ if( nLen )
+ {
+ if( nOptions )
+ {
+ const Point aPt1( ReadPoint() );
+ const Point aPt2( ReadPoint() );
+ aRect = Rectangle( aPt1, aPt2 );
+ }
+ char* pChar = new char[ ( nLen + 1 ) &~ 1 ];
+ pWMF->Read( pChar, ( nLen + 1 ) &~ 1 );
+ String aText( pChar, nLen, pOut->GetCharSet() );
+ delete pChar;
+
+ nRecSizeLeft=(nRecordSize-7-(((long)nLen+1)>>1))<<1;
+
+ if( nOptions )
+ nRecSizeLeft-=8;
+
+ if( nRecSizeLeft >= (long) nLen )
+ {
+ pDXAry = new long[ nLen ];
+
+ for( i = 0; i < nLen; i++ )
+ {
+ *pWMF >> nData;
+ pDXAry[ i ] = nData;
+ }
+ pOut->DrawText( aPosition, aText, pDXAry );
+ delete[] pDXAry;
+ }
+ else
+ pOut->DrawText( aPosition, aText );
+ }
+ }
+ break;
+
+ case W_META_SELECTOBJECT:
+ {
+ INT16 nObjIndex;
+ *pWMF >> nObjIndex;
+ pOut->SelectObject( nObjIndex );
+ }
+ break;
+
+ case W_META_SETTEXTALIGN:
+ {
+ UINT16 nAlign;
+ *pWMF >> nAlign;
+ pOut->SetTextAlign( nAlign );
+ }
+ break;
+
+ case W_META_BITBLT:
+ case W_META_STRETCHBLT:
+ case W_META_DIBBITBLT:
+ case W_META_DIBSTRETCHBLT:
+ case W_META_STRETCHDIB:
+ {
+ long nWinROP;
+ short nSx, nSy, nSxe, nSye, nUsage;
+ Bitmap aBmp;
+
+ *pWMF >> nWinROP;
+
+ if( nFunction == W_META_STRETCHDIB )
+ *pWMF >> nUsage;
+
+ if( nFunction==W_META_STRETCHDIB || nFunction==W_META_STRETCHBLT || nFunction==W_META_DIBSTRETCHBLT )
+ *pWMF >> nSye >> nSxe;
+
+ *pWMF >> nSy >> nSx;
+
+ if( nFunction == W_META_STRETCHDIB || nFunction == W_META_DIBBITBLT || nFunction == W_META_DIBSTRETCHBLT )
+ {
+ switch( nWinROP )
+ {
+ case PATCOPY :
+ {
+ *pWMF >> nUsage; // i don't know anything of this parameter, so its called nUsage
+ Size aDestSize( ReadYXExt() );
+ pOut->DrawRect( Rectangle( ReadYX(), aDestSize ), FALSE );
+ }
+ break;
+ default :
+ {
+ Size aDestSize( ReadYXExt() );
+ Rectangle aDestRect( ReadYX(), aDestSize );
+ aBmp.Read( *pWMF, FALSE );
+ aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP ), LIST_APPEND );
+ }
+ break;
+ }
+ }
+ else
+ {
+ if( aBmpSaveList.Count() )
+ pOut->ResolveBitmapActions( aBmpSaveList );
+ }
+ }
+ break;
+
+ case W_META_DIBCREATEPATTERNBRUSH:
+ {
+ Bitmap aBmp;
+ BitmapReadAccess* pBmp;
+ UINT32 nRed = 0, nGreen = 0, nBlue = 0, nCount = 1;
+ UINT16 nFunction;
+
+ *pWMF >> nFunction >> nFunction;
+
+ aBmp.Read( *pWMF, FALSE );
+ pBmp = aBmp.AcquireReadAccess();
+ if ( pBmp )
+ {
+ for ( INT32 y = 0; y < pBmp->Height(); y++ )
+ {
+ for ( INT32 x = 0; x < pBmp->Width(); x++ )
+ {
+ const BitmapColor aColor( pBmp->GetColor( y, x ) );
+
+ nRed += aColor.GetRed();
+ nGreen += aColor.GetGreen();
+ nBlue += aColor.GetBlue();
+ }
+ }
+ nCount = pBmp->Height() * pBmp->Width();
+ if ( !nCount )
+ nCount++;
+ aBmp.ReleaseAccess( pBmp );
+ }
+ Color aColor( (BYTE)( nRed / nCount ), (BYTE)( nGreen / nCount ), (BYTE)( nBlue / nCount ) );
+ pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( aColor, FALSE ) );
+ }
+ break;
+
+ case W_META_DELETEOBJECT:
+ {
+ INT16 nIndex;
+ *pWMF >> nIndex;
+ pOut->DeleteObject( nIndex );
+ }
+ break;
+
+ case W_META_CREATEPALETTE:
+ {
+ pOut->CreateObject( GDI_DUMMY );
+ }
+ break;
+
+ case W_META_CREATEBRUSH:
+ {
+ pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ), FALSE ) );
+ }
+ break;
+
+ case W_META_CREATEPATTERNBRUSH:
+ {
+ pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ), FALSE ) );
+ }
+ break;
+
+ case W_META_CREATEPENINDIRECT:
+ {
+ LineInfo aLineInfo;
+ USHORT nStyle, nWidth, nHeight;
+
+ *pWMF >> nStyle >> nWidth >> nHeight;
+
+ if ( nWidth )
+ aLineInfo.SetWidth( nWidth );
+
+ BOOL bTransparent = FALSE;
+ UINT16 nDashCount = 0;
+ UINT16 nDotCount = 0;
+ switch( nStyle )
+ {
+ case PS_DASHDOTDOT :
+ nDotCount++;
+ case PS_DASHDOT :
+ nDashCount++;
+ case PS_DOT :
+ nDotCount++;
+ break;
+ case PS_DASH :
+ nDashCount++;
+ break;
+ case PS_NULL :
+ bTransparent = TRUE;
+ aLineInfo.SetStyle( LINE_NONE );
+ break;
+ default :
+ case PS_INSIDEFRAME :
+ case PS_SOLID :
+ aLineInfo.SetStyle( LINE_SOLID );
+ }
+ if ( nDashCount | nDotCount )
+ {
+ aLineInfo.SetStyle( LINE_DASH );
+ aLineInfo.SetDashCount( nDashCount );
+ aLineInfo.SetDotCount( nDotCount );
+ }
+ pOut->CreateObject( GDI_PEN, new WinMtfLineStyle( ReadColor(), aLineInfo, bTransparent ) );
+ }
+ break;
+
+ case W_META_CREATEBRUSHINDIRECT:
+ {
+ USHORT nStyle;
+ *pWMF >> nStyle;
+ pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? TRUE : FALSE ) );
+ }
+ break;
+
+ case W_META_CREATEFONTINDIRECT:
+ {
+ Size aFontSize;
+ INT16 lfEscapement, lfOrientation, lfWeight; // ( ehemals USHORT )
+
+ LOGFONTW aLogFont;
+ aFontSize = ReadYXExt();
+ *pWMF >> lfEscapement >> lfOrientation >> lfWeight
+ >> aLogFont.lfItalic >> aLogFont.lfUnderline >> aLogFont.lfStrikeOut >> aLogFont.lfCharSet >> aLogFont.lfOutPrecision
+ >> aLogFont.lfClipPrecision >> aLogFont.lfQuality >> aLogFont.lfPitchAndFamily;
+ pWMF->Read( aLogFont.lfFaceName, LF_FACESIZE );
+ aLogFont.lfWidth = aFontSize.Width();
+ aLogFont.lfHeight = aFontSize.Height();
+ aLogFont.lfEscapement = lfEscapement;
+ aLogFont.lfOrientation = lfOrientation;
+ aLogFont.lfWeight = lfWeight;
+ pOut->CreateObject( GDI_FONT, new WinMtfFontStyle( aLogFont ) );
+ }
+ break;
+
+ case W_META_CREATEBITMAPINDIRECT:
+ {
+ pOut->CreateObject( GDI_DUMMY );
+ }
+ break;
+
+ case W_META_CREATEBITMAP:
+ {
+ pOut->CreateObject( GDI_DUMMY );
+ }
+ break;
+
+ case W_META_CREATEREGION:
+ {
+ pOut->CreateObject( GDI_DUMMY );
+ }
+ break;
+
+ case W_META_SETRELABS:
+ case W_META_SETPOLYFILLMODE:
+ case W_META_SETSTRETCHBLTMODE:
+ case W_META_SETTEXTCHAREXTRA:
+ case W_META_SETTEXTJUSTIFICATION:
+ case W_META_EXCLUDECLIPRECT:
+ case W_META_FLOODFILL:
+ break;
+ case W_META_PATBLT:
+ {
+ UINT32 nROP, nOldROP;
+ *pWMF >> nROP;
+ Size aSize = ReadYXExt();
+ nOldROP = pOut->SetRasterOp( nROP );
+ pOut->DrawRect( Rectangle( ReadYX(), aSize ), FALSE );
+ pOut->SetRasterOp( nOldROP );
+ }
+ break;
+ case W_META_ESCAPE:
+ case W_META_FILLREGION:
+ case W_META_FRAMEREGION:
+ case W_META_INVERTREGION:
+ case W_META_PAINTREGION:
+ case W_META_SELECTCLIPREGION:
+ case W_META_DRAWTEXT:
+ case W_META_SETMAPPERFLAGS:
+ case W_META_SETDIBTODEV:
+ case W_META_SELECTPALETTE:
+ case W_META_REALIZEPALETTE:
+ case W_META_ANIMATEPALETTE:
+ case W_META_SETPALENTRIES:
+ case W_META_RESIZEPALETTE:
+ case W_META_EXTFLOODFILL:
+ case W_META_RESETDC:
+ case W_META_STARTDOC:
+ case W_META_STARTPAGE:
+ case W_META_ENDPAGE:
+ case W_META_ABORTDOC:
+ case W_META_ENDDOC:
+ break;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL WMFReader::ReadHeader()
+{
+ Rectangle aPlaceableBound;
+ ULONG nl;
+
+ // Einlesen des METAFILEHEADER, falls vorhanden
+ *pWMF >> nl;
+
+ if ( nl == 0x9ac6cdd7L )
+ {
+ INT16 nVal;
+
+ // hmf (Unused) ueberlesen wir
+ pWMF->SeekRel(2);
+
+ // BoundRect
+ *pWMF >> nVal; aPlaceableBound.Left() = nVal;
+ *pWMF >> nVal; aPlaceableBound.Top() = nVal;
+ *pWMF >> nVal; aPlaceableBound.Right() = nVal;
+ *pWMF >> nVal; aPlaceableBound.Bottom() = nVal;
+
+ // inch
+ *pWMF >> nUnitsPerInch;
+
+ // reserved
+ pWMF->SeekRel( 4 );
+
+ // checksum pruefen wir lieber nicht
+ pWMF->SeekRel( 2 );
+ }
+ else
+ {
+ // Unit wird bei den alten MTF's als MM_TEXT angenommen
+ nUnitsPerInch = 96;
+ pWMF->SeekRel( -4 ); // zurueck zum Anfang
+ }
+
+ // Einlesen des METAHEADER
+ *pWMF >> nl; // Typ und Headergroesse
+
+ if( nl != 0x00090001 )
+ {
+ pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return FALSE;
+ }
+
+ pWMF->SeekRel( 2 ); // Version (von Windows)
+ pWMF->SeekRel( 4 ); // Size (der Datei in Words)
+ pWMF->SeekRel( 2 ); // NoObjects (Maximale Anzahl der gleichzeitigen Objekte)
+ pWMF->SeekRel( 4 ); // MaxRecord (Groesse des groessten Records in Words)
+ pWMF->SeekRel( 2 ); // NoParameters (Unused
+
+ pOut->SetWinOrg( aPlaceableBound.TopLeft() );
+
+ ImplSetWMFSize( aPlaceableBound.GetSize() );
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+void WMFReader::ImplSetWMFSize( const Size& rSize )
+{
+ pOut->SetWinExt( rSize );
+
+ // try to calculate size of WMF
+ if( !bWinExtSet && rSize.Width() > 1 && rSize.Height() > 1 )
+ {
+ const Fraction aFrac( 1, nUnitsPerInch );
+ MapMode aWMFMap( MAP_INCH, Point(), aFrac, aFrac );
+ Size aSize100( OutputDevice::LogicToLogic( rSize, aWMFMap, MAP_100TH_MM ) );
+ pOut->SetDevExt( Size( labs( aSize100.Width() ), labs( aSize100.Height() ) ) );
+ bWinExtSet = TRUE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void WMFReader::ReadWMF() // SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, PFilterCallback pcallback, void * pcallerdata)
+{
+ USHORT nFunction;
+ ULONG nRecSize;
+ ULONG nPos, nPercent, nLastPercent;
+
+ pOut->SetWinOrg( Point() );
+ pOut->SetWinExt( Size( 1, 1 ) );
+ pOut->SetDevExt( Size( 10000, 10000 ) );
+ bWinExtSet = FALSE;
+
+ nEndPos=pWMF->Seek( STREAM_SEEK_TO_END );
+ pWMF->Seek( nStartPos );
+ Callback( (USHORT) ( nLastPercent = 0 ) );
+
+ if ( ReadHeader() )
+ {
+
+ nPos = pWMF->Tell();
+
+ if( nEndPos - nStartPos )
+ {
+ while( TRUE )
+ {
+ nPercent = ( nPos - nStartPos ) * 100 / ( nEndPos - nStartPos );
+
+ if( nLastPercent + 4 <= nPercent )
+ {
+ if( Callback( (USHORT) nPercent ) )
+ break;
+
+ nLastPercent = nPercent;
+ }
+
+ *pWMF >> nRecSize >> nFunction;
+
+ if( pWMF->GetError() || ( nRecSize < 3 ) || ( nRecSize==3 && nFunction==0 ) || pWMF->IsEof() )
+ {
+
+ if( pWMF->IsEof() )
+ pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
+
+ break;
+ }
+
+ if( aBmpSaveList.Count() &&
+ ( nFunction != W_META_STRETCHDIB ) &&
+ ( nFunction != W_META_DIBBITBLT ) &&
+ ( nFunction != W_META_DIBSTRETCHBLT ) )
+ {
+ pOut->ResolveBitmapActions( aBmpSaveList );
+ }
+
+ ReadRecordParams( nFunction );
+ pWMF->Seek( nPos += nRecSize * 2 );
+ }
+ }
+ else
+ pWMF->SetError( SVSTREAM_GENERALERROR );
+
+ if( !pWMF->GetError() && aBmpSaveList.Count() )
+ pOut->ResolveBitmapActions( aBmpSaveList );
+ }
+ if ( pWMF->GetError() )
+ pWMF->Seek( nStartPos );
+}
+
diff --git a/svtools/source/filter.vcl/wmf/wmf.cxx b/svtools/source/filter.vcl/wmf/wmf.cxx
new file mode 100644
index 000000000000..d085bfc45e21
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/wmf.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * $RCSfile: wmf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "winmtf.hxx"
+#include "emfwr.hxx"
+#include "wmfwr.hxx"
+#include "wmf.hxx"
+
+// -----------------------------------------------------------------------------
+
+BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile,
+ PFilterCallback pCallback, void * pCallerData)
+{
+ UINT32 nMetaType;
+ UINT32 nOrgPos = rStreamWMF.Tell();
+ UINT16 nOrigNumberFormat = rStreamWMF.GetNumberFormatInt();
+ rStreamWMF.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStreamWMF.Seek( 0x28 );
+ rStreamWMF >> nMetaType;
+ rStreamWMF.Seek( nOrgPos );
+ if ( nMetaType == 0x464d4520 )
+ {
+ if ( EnhWMFReader( rStreamWMF, rGDIMetaFile, pCallback, pCallerData ).ReadEnhWMF() == FALSE )
+ rStreamWMF.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ }
+ else
+ {
+ WMFReader( rStreamWMF, rGDIMetaFile, pCallback, pCallerData ).ReadWMF();
+ }
+ rStreamWMF.SetNumberFormatInt( nOrigNumberFormat );
+ return !rStreamWMF.GetError();
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF )
+{
+ UINT32 nMetaType;
+ UINT32 nOrgPos = rStream.Tell();
+ UINT16 nOrigNumberFormat = rStream.GetNumberFormatInt();
+ rStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rStream.Seek( 0x28 );
+ rStream >> nMetaType;
+ rStream.Seek( nOrgPos );
+ if ( nMetaType == 0x464d4520 )
+ {
+ if ( EnhWMFReader( rStream, rMTF, NULL, NULL ).ReadEnhWMF() == FALSE )
+ rStream.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ }
+ else
+ {
+ WMFReader( rStream, rMTF, NULL, NULL ).ReadWMF();
+ }
+ rStream.SetNumberFormatInt( nOrigNumberFormat );
+ return !rStream.GetError();
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ PFilterCallback pCallback, void * pCallerData,
+ BOOL bPlaceable)
+{
+ WMFWriter aWMFWriter;
+ return aWMFWriter.WriteWMF(rMTF,rTargetStream,pCallback,pCallerData,bPlaceable);
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ PFilterCallback pCallback, void * pCallerData )
+{
+ EMFWriter aEMFWriter;
+ return aEMFWriter.WriteEMF( rMTF, rTargetStream, pCallback, pCallerData );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF )
+{
+ return WMFWriter().WriteWMF( rMTF, rStream, NULL, NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF )
+{
+ return WMFWriter().WriteWMF( rMTF, rStream, NULL, NULL, FALSE );
+}
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx
new file mode 100644
index 000000000000..ad860a457d7d
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx
@@ -0,0 +1,1787 @@
+/*************************************************************************
+ *
+ * $RCSfile: wmfwr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <vcl/salbtype.hxx>
+#include "wmfwr.hxx"
+
+//====================== MS-Windows-defines ===============================
+
+#define W_META_SETBKCOLOR 0x0201
+#define W_META_SETBKMODE 0x0102
+#define W_META_SETMAPMODE 0x0103
+#define W_META_SETROP2 0x0104
+#define W_META_SETRELABS 0x0105
+#define W_META_SETPOLYFILLMODE 0x0106
+#define W_META_SETSTRETCHBLTMODE 0x0107
+#define W_META_SETTEXTCHAREXTRA 0x0108
+#define W_META_SETTEXTCOLOR 0x0209
+#define W_META_SETTEXTJUSTIFICATION 0x020A
+#define W_META_SETWINDOWORG 0x020B
+#define W_META_SETWINDOWEXT 0x020C
+#define W_META_SETVIEWPORTORG 0x020D
+#define W_META_SETVIEWPORTEXT 0x020E
+#define W_META_OFFSETWINDOWORG 0x020F
+#define W_META_SCALEWINDOWEXT 0x0410
+#define W_META_OFFSETVIEWPORTORG 0x0211
+#define W_META_SCALEVIEWPORTEXT 0x0412
+#define W_META_LINETO 0x0213
+#define W_META_MOVETO 0x0214
+#define W_META_EXCLUDECLIPRECT 0x0415
+#define W_META_INTERSECTCLIPRECT 0x0416
+#define W_META_ARC 0x0817
+#define W_META_ELLIPSE 0x0418
+#define W_META_FLOODFILL 0x0419
+#define W_META_PIE 0x081A
+#define W_META_RECTANGLE 0x041B
+#define W_META_ROUNDRECT 0x061C
+#define W_META_PATBLT 0x061D
+#define W_META_SAVEDC 0x001E
+#define W_META_SETPIXEL 0x041F
+#define W_META_OFFSETCLIPRGN 0x0220
+#define W_META_TEXTOUT 0x0521
+#define W_META_BITBLT 0x0922
+#define W_META_STRETCHBLT 0x0B23
+#define W_META_POLYGON 0x0324
+#define W_META_POLYLINE 0x0325
+#define W_META_ESCAPE 0x0626
+#define W_META_RESTOREDC 0x0127
+#define W_META_FILLREGION 0x0228
+#define W_META_FRAMEREGION 0x0429
+#define W_META_INVERTREGION 0x012A
+#define W_META_PAINTREGION 0x012B
+#define W_META_SELECTCLIPREGION 0x012C
+#define W_META_SELECTOBJECT 0x012D
+#define W_META_SETTEXTALIGN 0x012E
+#define W_META_DRAWTEXT 0x062F
+#define W_META_CHORD 0x0830
+#define W_META_SETMAPPERFLAGS 0x0231
+#define W_META_EXTTEXTOUT 0x0a32
+#define W_META_SETDIBTODEV 0x0d33
+#define W_META_SELECTPALETTE 0x0234
+#define W_META_REALIZEPALETTE 0x0035
+#define W_META_ANIMATEPALETTE 0x0436
+#define W_META_SETPALENTRIES 0x0037
+#define W_META_POLYPOLYGON 0x0538
+#define W_META_RESIZEPALETTE 0x0139
+#define W_META_DIBBITBLT 0x0940
+#define W_META_DIBSTRETCHBLT 0x0b41
+#define W_META_DIBCREATEPATTERNBRUSH 0x0142
+#define W_META_STRETCHDIB 0x0f43
+#define W_META_EXTFLOODFILL 0x0548
+#define W_META_RESETDC 0x014C
+#define W_META_STARTDOC 0x014D
+#define W_META_STARTPAGE 0x004F
+#define W_META_ENDPAGE 0x0050
+#define W_META_ABORTDOC 0x0052
+#define W_META_ENDDOC 0x005E
+#define W_META_DELETEOBJECT 0x01f0
+#define W_META_CREATEPALETTE 0x00f7
+#define W_META_CREATEBRUSH 0x00F8
+#define W_META_CREATEPATTERNBRUSH 0x01F9
+#define W_META_CREATEPENINDIRECT 0x02FA
+#define W_META_CREATEFONTINDIRECT 0x02FB
+#define W_META_CREATEBRUSHINDIRECT 0x02FC
+#define W_META_CREATEBITMAPINDIRECT 0x02FD
+#define W_META_CREATEBITMAP 0x06FE
+#define W_META_CREATEREGION 0x06FF
+
+#define W_TRANSPARENT 1
+#define W_OPAQUE 2
+
+#define W_R2_BLACK 1
+#define W_R2_NOTMERGEPEN 2
+#define W_R2_MASKNOTPEN 3
+#define W_R2_NOTCOPYPEN 4
+#define W_R2_MASKPENNOT 5
+#define W_R2_NOT 6
+#define W_R2_XORPEN 7
+#define W_R2_NOTMASKPEN 8
+#define W_R2_MASKPEN 9
+#define W_R2_NOTXORPEN 10
+#define W_R2_NOP 11
+#define W_R2_MERGENOTPEN 12
+#define W_R2_COPYPEN 13
+#define W_R2_MERGEPENNOT 14
+#define W_R2_MERGEPEN 15
+#define W_R2_WHITE 16
+
+#define W_TA_NOUPDATECP 0x0000
+#define W_TA_UPDATECP 0x0001
+#define W_TA_LEFT 0x0000
+#define W_TA_RIGHT 0x0002
+#define W_TA_CENTER 0x0006
+#define W_TA_TOP 0x0000
+#define W_TA_BOTTOM 0x0008
+#define W_TA_BASELINE 0x0018
+
+#define W_SRCCOPY 0x00CC0020L
+#define W_SRCPAINT 0x00EE0086L
+#define W_SRCAND 0x008800C6L
+#define W_SRCINVERT 0x00660046L
+#define W_SRCERASE 0x00440328L
+#define W_NOTSRCCOPY 0x00330008L
+#define W_NOTSRCERASE 0x001100A6L
+#define W_MERGECOPY 0x00C000CAL
+#define W_MERGEPAINT 0x00BB0226L
+#define W_PATCOPY 0x00F00021L
+#define W_PATPAINT 0x00FB0A09L
+#define W_PATINVERT 0x005A0049L
+#define W_DSTINVERT 0x00550009L
+#define W_BLACKNESS 0x00000042L
+#define W_WHITENESS 0x00FF0062L
+
+#define W_PS_SOLID 0
+#define W_PS_DASH 1
+#define W_PS_DOT 2
+#define W_PS_DASHDOT 3
+#define W_PS_DASHDOTDOT 4
+#define W_PS_NULL 5
+#define W_PS_INSIDEFRAME 6
+
+#define W_LF_FACESIZE 32
+
+#define W_ANSI_CHARSET 0
+#define W_DEFAULT_CHARSET 1
+#define W_SYMBOL_CHARSET 2
+#define W_SHIFTJIS_CHARSET 128
+#define W_HANGEUL_CHARSET 129
+#define W_CHINESEBIG5_CHARSET 136
+#define W_OEM_CHARSET 255
+
+#define W_DEFAULT_PITCH 0x00
+#define W_FIXED_PITCH 0x01
+#define W_VARIABLE_PITCH 0x02
+
+#define W_FF_DONTCARE 0x00
+#define W_FF_ROMAN 0x10
+#define W_FF_SWISS 0x20
+#define W_FF_MODERN 0x30
+#define W_FF_SCRIPT 0x40
+#define W_FF_DECORATIVE 0x50
+
+#define W_FW_DONTCARE 0
+#define W_FW_THIN 100
+#define W_FW_EXTRALIGHT 200
+#define W_FW_LIGHT 300
+#define W_FW_NORMAL 400
+#define W_FW_MEDIUM 500
+#define W_FW_SEMIBOLD 600
+#define W_FW_BOLD 700
+#define W_FW_EXTRABOLD 800
+#define W_FW_HEAVY 900
+#define W_FW_ULTRALIGHT 200
+#define W_FW_REGULAR 400
+#define W_FW_DEMIBOLD 600
+#define W_FW_ULTRABOLD 800
+#define W_FW_BLACK 900
+
+#define W_BS_SOLID 0
+#define W_BS_HOLLOW 1
+#define W_BS_HATCHED 2
+#define W_BS_PATTERN 3
+#define W_BS_INDEXED 4
+#define W_BS_DIBPATTERN 5
+
+#define W_HS_HORIZONTAL 0
+#define W_HS_VERTICAL 1
+#define W_HS_FDIAGONAL 2
+#define W_HS_BDIAGONAL 3
+#define W_HS_CROSS 4
+#define W_HS_DIAGCROSS 5
+
+//========================== Methoden von WMFWriter ==========================
+
+void WMFWriter::MayCallback()
+{
+ ULONG nPercent;
+
+ // Wir gehen mal einfach so davon aus, dass 16386 Actions einer Bitmap entsprechen
+ // (in der Regel wird ein Metafile entweder nur Actions oder einige Bitmaps und fast
+ // keine Actions enthalten. Dann ist das Verhaeltnis ziemlich unwichtig)
+
+ nPercent=((nWrittenBitmaps<<14)+(nActBitmapPercent<<14)/100+nWrittenActions)
+ *100
+ /((nNumberOfBitmaps<<14)+nNumberOfActions);
+
+ if (nPercent>=nLastPercent+3) {
+ nLastPercent=nPercent;
+ if(pCallback!=NULL && nPercent<=100) {
+ if (((*pCallback)(pCallerData,(USHORT)nPercent))==TRUE) bStatus=FALSE;
+ }
+ }
+}
+
+
+void WMFWriter::CountActionsAndBitmaps( const GDIMetaFile & rMTF )
+{
+ ULONG nAction, nActionCount;
+
+ nActionCount = rMTF.GetActionCount();
+
+ for ( nAction=0; nAction<nActionCount; nAction++ )
+ {
+ MetaAction* pMA = rMTF.GetAction( nAction );
+
+ switch( pMA->GetType() )
+ {
+ case META_BMP_ACTION:
+ case META_BMPSCALE_ACTION:
+ case META_BMPSCALEPART_ACTION:
+ case META_BMPEX_ACTION:
+ case META_BMPEXSCALE_ACTION:
+ case META_BMPEXSCALEPART_ACTION:
+ nNumberOfBitmaps++;
+ break;
+ }
+ nNumberOfActions++;
+ }
+}
+
+
+void WMFWriter::WritePointXY(const Point & rPoint)
+{
+ Point aPt( pVirDev->LogicToLogic(rPoint,aSrcMapMode,aTargetMapMode) );
+ *pWMF << ((short)aPt.X()) << ((short)aPt.Y());
+}
+
+
+void WMFWriter::WritePointYX(const Point & rPoint)
+{
+ Point aPt( pVirDev->LogicToLogic(rPoint,aSrcMapMode,aTargetMapMode) );
+ *pWMF << ((short)aPt.Y()) << ((short)aPt.X());
+}
+
+
+void WMFWriter::WriteDX(long nDX)
+{
+ Size aSz( pVirDev->LogicToLogic(Size(nDX,0),aSrcMapMode,aTargetMapMode) );
+ *pWMF << ((short)aSz.Width());
+}
+
+
+void WMFWriter::WriteSize(const Size & rSize)
+{
+ Size aSz( pVirDev->LogicToLogic(rSize,aSrcMapMode,aTargetMapMode) );
+ *pWMF << ((short)aSz.Width()) << ((short)aSz.Height());
+}
+
+
+void WMFWriter::WriteHeightWidth(const Size & rSize)
+{
+ Size aSz( pVirDev->LogicToLogic(rSize,aSrcMapMode,aTargetMapMode) );
+ *pWMF << ((short)aSz.Height()) << ((short)aSz.Width());
+}
+
+
+void WMFWriter::WriteRectangle(const Rectangle & rRect)
+{
+ WritePointYX(Point(rRect.Right()+1,rRect.Bottom()+1));
+ WritePointYX(rRect.TopLeft());
+}
+
+
+void WMFWriter::WriteColor(const Color & rColor)
+{
+ *pWMF << (BYTE) rColor.GetRed() << (BYTE) rColor.GetGreen() << (BYTE) rColor.GetBlue() << (BYTE) 0;
+}
+
+
+void WMFWriter::WriteRecordHeader(ULONG nSizeWords, USHORT nType)
+{
+ nActRecordPos=pWMF->Tell();
+ if (nSizeWords>nMaxRecordSize) nMaxRecordSize=nSizeWords;
+ *pWMF << nSizeWords << nType;
+}
+
+
+void WMFWriter::UpdateRecordHeader()
+{
+ ULONG nPos,nSize;
+
+ nPos=pWMF->Tell(); nSize=nPos-nActRecordPos;
+ if ((nSize & 1)!=0) {
+ *pWMF << (BYTE)0;
+ nPos++; nSize++;
+ }
+ nSize/=2;
+ if (nSize>nMaxRecordSize) nMaxRecordSize=nSize;
+ pWMF->Seek(nActRecordPos);
+ *pWMF << nSize;
+ pWMF->Seek(nPos);
+}
+
+
+void WMFWriter::WMFRecord_Arc(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt)
+{
+ WriteRecordHeader(0x0000000b,W_META_ARC);
+ WritePointYX(rEndPt);
+ WritePointYX(rStartPt);
+ WriteRectangle(rRect);
+}
+
+void WMFWriter::WMFRecord_Chord(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt)
+{
+ WriteRecordHeader(0x0000000b,W_META_CHORD);
+ WritePointYX(rEndPt);
+ WritePointYX(rStartPt);
+ WriteRectangle(rRect);
+}
+
+
+void WMFWriter::WMFRecord_CreateBrushIndirect(const Color& rColor)
+{
+ WriteRecordHeader(0x00000007,W_META_CREATEBRUSHINDIRECT);
+
+ if( rColor==Color(COL_TRANSPARENT) )
+ *pWMF << (UINT16) W_BS_HOLLOW;
+ else
+ *pWMF << (UINT16) W_BS_SOLID;
+
+ WriteColor( rColor );
+ *pWMF << (UINT16) 0;
+}
+
+
+void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont)
+{
+ USHORT nWeight,i;
+ BYTE nCharSet,nPitchFamily;
+
+ WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT);
+
+ WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height()));
+
+ *pWMF << (short)rFont.GetOrientation() << (short)rFont.GetOrientation();
+
+ switch (rFont.GetWeight()) {
+ case WEIGHT_THIN: nWeight=W_FW_THIN; break;
+ case WEIGHT_ULTRALIGHT: nWeight=W_FW_ULTRALIGHT; break;
+ case WEIGHT_LIGHT: nWeight=W_FW_LIGHT; break;
+ case WEIGHT_SEMILIGHT: nWeight=W_FW_LIGHT; break;
+ case WEIGHT_NORMAL: nWeight=W_FW_NORMAL; break;
+ case WEIGHT_MEDIUM: nWeight=W_FW_MEDIUM; break;
+ case WEIGHT_SEMIBOLD: nWeight=W_FW_SEMIBOLD; break;
+ case WEIGHT_BOLD: nWeight=W_FW_BOLD; break;
+ case WEIGHT_ULTRABOLD: nWeight=W_FW_ULTRABOLD; break;
+ case WEIGHT_BLACK: nWeight=W_FW_BLACK; break;
+ default: nWeight=W_FW_DONTCARE;
+ }
+ *pWMF << nWeight;
+
+ if (rFont.GetItalic()==ITALIC_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1;
+ if (rFont.GetUnderline()==UNDERLINE_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1;
+ if (rFont.GetStrikeout()==STRIKEOUT_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1;
+
+ switch (rFont.GetCharSet())
+ {
+ case RTL_TEXTENCODING_SYMBOL : nCharSet = W_SYMBOL_CHARSET; break;
+ default: nCharSet = W_ANSI_CHARSET;
+ }
+ *pWMF << nCharSet;
+
+ *pWMF << (BYTE)0 << (BYTE)0 << (BYTE)0;
+
+ switch (rFont.GetPitch()) {
+ case PITCH_FIXED: nPitchFamily=W_FIXED_PITCH; break;
+ case PITCH_VARIABLE: nPitchFamily=W_VARIABLE_PITCH; break;
+ default: nPitchFamily=W_DEFAULT_PITCH;
+ }
+ switch (rFont.GetFamily()) {
+ case FAMILY_DECORATIVE: nPitchFamily|=W_FF_DECORATIVE; break;
+ case FAMILY_MODERN: nPitchFamily|=W_FF_MODERN; break;
+ case FAMILY_ROMAN: nPitchFamily|=W_FF_ROMAN; break;
+ case FAMILY_SCRIPT: nPitchFamily|=W_FF_SCRIPT; break;
+ case FAMILY_SWISS: nPitchFamily|=W_FF_SWISS; break;
+ default: nPitchFamily|=W_FF_DONTCARE;
+ }
+ *pWMF << nPitchFamily;
+
+ ByteString aFontName( rFont.GetName(), RTL_TEXTENCODING_UTF8 );
+ for ( i = 0; i < W_LF_FACESIZE; i++ )
+ {
+ if ( i < aFontName.Len() )
+ *pWMF << (BYTE)aFontName.GetChar( i );
+ else
+ *pWMF << (BYTE)0;
+ }
+
+ UpdateRecordHeader();
+}
+
+
+void WMFWriter::WMFRecord_CreatePenIndirect(const Color& rColor)
+{
+ WriteRecordHeader(0x00000008,W_META_CREATEPENINDIRECT);
+
+ if( rColor == Color( COL_TRANSPARENT ) )
+ *pWMF << (UINT16) W_PS_NULL;
+ else
+ *pWMF << (UINT16) W_PS_SOLID;
+
+ WriteSize( Size() );
+ WriteColor(rColor);
+}
+
+void WMFWriter::WMFRecord_CreatePenIndirect(const Color& rColor, const LineInfo& rLineInfo )
+{
+ WriteRecordHeader(0x00000008,W_META_CREATEPENINDIRECT);
+
+ USHORT nStyle = W_PS_SOLID;
+ switch( rLineInfo.GetStyle() )
+ {
+ case LINE_DASH :
+ {
+ if ( rLineInfo.GetDotCount() )
+ {
+ if ( !rLineInfo.GetDashCount() )
+ nStyle = W_PS_DOT;
+ else
+ {
+ if ( !rLineInfo.GetDotCount() == 1 )
+ nStyle = W_PS_DASHDOT;
+ else
+ nStyle = W_PS_DASHDOTDOT;
+ }
+ }
+ else
+ nStyle = W_PS_DASH;
+ }
+ break;
+ case LINE_NONE :
+ nStyle = W_PS_NULL;
+ break;
+ }
+ *pWMF << nStyle;
+
+ WriteSize( Size( rLineInfo.GetWidth(), 0 ) );
+ WriteColor( rColor );
+}
+
+void WMFWriter::WMFRecord_DeleteObject(USHORT nObjectHandle)
+{
+ WriteRecordHeader(0x00000004,W_META_DELETEOBJECT);
+ *pWMF << nObjectHandle;
+}
+
+
+void WMFWriter::WMFRecord_Ellipse(const Rectangle & rRect)
+{
+ WriteRecordHeader(0x00000007,W_META_ELLIPSE);
+ WriteRectangle(rRect);
+}
+
+
+void WMFWriter::WMFRecord_ExtTextOut(const Point & rPoint, const ByteString & rString, const long * pDXAry)
+{
+ USHORT nLen,i;
+
+ nLen=rString.Len();
+ if (nLen<=1 || pDXAry==NULL)
+ {
+ WMFRecord_TextOut(rPoint,rString);
+ return;
+ }
+
+ WriteRecordHeader(0,W_META_EXTTEXTOUT);
+ WritePointYX(rPoint);
+ *pWMF << nLen << (USHORT)0;
+
+ for ( i = 0; i < nLen; i++ )
+ *pWMF << (BYTE)rString.GetChar( i );
+ if ((nLen&1)!=0) *pWMF << (BYTE)0;
+ WriteDX(pDXAry[0]);
+ for (i=1; i<(nLen-1); i++) WriteDX(pDXAry[i]-pDXAry[i-1]);
+ WriteDX(pDXAry[nLen-2]/(nLen-1));
+ UpdateRecordHeader();
+}
+
+
+void WMFWriter::WMFRecord_ExtTextOut(const Point & rPoint, const ByteString & rString, ULONG nWidth)
+{
+ USHORT nLen,i;
+ long * pDXAry;
+ sal_Int32 nNormSize;
+
+ pVirDev->SetFont(aSrcFont);
+ nLen=rString.Len();
+ pDXAry=new long[nLen];
+ nNormSize = pVirDev->GetTextArray( UniString( rString, RTL_TEXTENCODING_UTF8 ),pDXAry );
+ if (nLen<=1 || nNormSize ==(long)nWidth )
+ {
+ WMFRecord_TextOut(rPoint,rString);
+ delete pDXAry;
+ return;
+ }
+ for (i=0; i<(nLen-1); i++) pDXAry[i]=pDXAry[i]*((long)nWidth)/nNormSize;
+ WMFRecord_ExtTextOut(rPoint,rString,pDXAry);
+ delete pDXAry;
+}
+
+
+void WMFWriter::WMFRecord_LineTo(const Point & rPoint)
+{
+ WriteRecordHeader(0x00000005,W_META_LINETO);
+ WritePointYX(rPoint);
+}
+
+
+void WMFWriter::WMFRecord_MoveTo(const Point & rPoint)
+{
+ WriteRecordHeader(0x00000005,W_META_MOVETO);
+ WritePointYX(rPoint);
+}
+
+
+void WMFWriter::WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt)
+{
+ WriteRecordHeader(0x0000000b,W_META_PIE);
+ WritePointYX(rEndPt);
+ WritePointYX(rStartPt);
+ WriteRectangle(rRect);
+}
+
+
+void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly)
+{
+ USHORT nSize,i;
+ nSize=rPoly.GetSize();
+
+ WriteRecordHeader(((ULONG)nSize)*2+4,W_META_POLYGON);
+ *pWMF << nSize;
+ for (i=0; i<nSize; i++) WritePointXY(rPoly.GetPoint(i));
+}
+
+
+void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly)
+{
+ USHORT nSize,i;
+ nSize=rPoly.GetSize();
+
+ WriteRecordHeader(((ULONG)nSize)*2+4,W_META_POLYLINE);
+ *pWMF << nSize;
+ for (i=0; i<nSize; i++) WritePointXY(rPoly.GetPoint(i));
+}
+
+
+void WMFWriter::WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly)
+{
+ const Polygon * pPoly;
+ USHORT nCount,nSize,i,j;
+
+ WriteRecordHeader(0,W_META_POLYPOLYGON);
+ nCount=rPolyPoly.Count();
+ *pWMF << nCount;
+ for (i=0; i<nCount; i++) *pWMF << ((USHORT)(rPolyPoly.GetObject(i).GetSize()));
+ for (i=0; i<nCount; i++) {
+ pPoly=&(rPolyPoly.GetObject(i));
+ nSize=pPoly->GetSize();
+ for (j=0; j<nSize; j++) WritePointXY(pPoly->GetPoint(j));
+ }
+ UpdateRecordHeader();
+}
+
+
+void WMFWriter::WMFRecord_Rectangle(const Rectangle & rRect)
+{
+ WriteRecordHeader( 0x00000007,W_META_RECTANGLE );
+ WriteRectangle( rRect );
+}
+
+
+void WMFWriter::WMFRecord_RestoreDC()
+{
+ WriteRecordHeader(0x00000004,W_META_RESTOREDC);
+ *pWMF << (short)-1;
+}
+
+
+void WMFWriter::WMFRecord_RoundRect(const Rectangle & rRect, long nHorzRound, long nVertRound)
+{
+ WriteRecordHeader(0x00000009,W_META_ROUNDRECT);
+ WriteHeightWidth(Size(nHorzRound,nVertRound));
+ WriteRectangle(rRect);
+}
+
+
+void WMFWriter::WMFRecord_SaveDC()
+{
+ WriteRecordHeader(0x00000003,W_META_SAVEDC);
+}
+
+
+void WMFWriter::WMFRecord_SelectObject(USHORT nObjectHandle)
+{
+ WriteRecordHeader(0x00000004,W_META_SELECTOBJECT);
+ *pWMF << nObjectHandle;
+}
+
+
+void WMFWriter::WMFRecord_SetBkColor(const Color & rColor)
+{
+ WriteRecordHeader(0x00000005,W_META_SETBKCOLOR);
+ WriteColor(rColor);
+}
+
+
+void WMFWriter::WMFRecord_SetBkMode(BOOL bTransparent)
+{
+ WriteRecordHeader(0x00000004,W_META_SETBKMODE);
+ if (bTransparent==TRUE) *pWMF << (USHORT)W_TRANSPARENT;
+ else *pWMF << (USHORT)W_OPAQUE;
+}
+
+void WMFWriter::WMFRecord_SetStretchBltMode()
+{
+ WriteRecordHeader( 0x00000004, W_META_SETSTRETCHBLTMODE );
+ *pWMF << (USHORT) 3; // STRETCH_DELETESCANS
+}
+
+void WMFWriter::WMFRecord_SetPixel(const Point & rPoint, const Color & rColor)
+{
+ WriteRecordHeader(0x00000007,W_META_SETPIXEL);
+ WriteColor(rColor);
+ WritePointYX(rPoint);
+}
+
+
+void WMFWriter::WMFRecord_SetROP2(RasterOp eROP)
+{
+ USHORT nROP2;
+
+ switch (eROP) {
+ case ROP_INVERT: nROP2=W_R2_NOT; break;
+ case ROP_XOR: nROP2=W_R2_XORPEN; break;
+ default: nROP2=W_R2_COPYPEN;
+ }
+ WriteRecordHeader(0x00000004,W_META_SETROP2);
+ *pWMF << nROP2;
+}
+
+
+void WMFWriter::WMFRecord_SetTextAlign(FontAlign eFontAlign)
+{
+ USHORT nAlign;
+
+ switch (eFontAlign) {
+ case ALIGN_TOP: nAlign=W_TA_TOP; break;
+ case ALIGN_BOTTOM: nAlign=W_TA_BOTTOM; break;
+ default: nAlign=W_TA_BASELINE;
+ }
+ nAlign|=W_TA_LEFT;
+ nAlign|=W_TA_NOUPDATECP;
+
+ WriteRecordHeader(0x00000004,W_META_SETTEXTALIGN);
+ *pWMF << nAlign;
+}
+
+
+void WMFWriter::WMFRecord_SetTextColor(const Color & rColor)
+{
+ WriteRecordHeader(0x00000005,W_META_SETTEXTCOLOR);
+ WriteColor(rColor);
+}
+
+
+void WMFWriter::WMFRecord_SetWindowExt(const Size & rSize)
+{
+ WriteRecordHeader(0x00000005,W_META_SETWINDOWEXT);
+ WriteHeightWidth(rSize);
+}
+
+
+void WMFWriter::WMFRecord_SetWindowOrg(const Point & rPoint)
+{
+ WriteRecordHeader(0x00000005,W_META_SETWINDOWORG);
+ WritePointYX(rPoint);
+}
+
+
+void WMFWriter::WMFRecord_StretchDIB( const Point & rPoint, const Size & rSize,
+ const Bitmap & rBitmap, ULONG nROP )
+{
+ ULONG nPosAnf,nPosEnd;
+
+ nActBitmapPercent=50;
+ MayCallback();
+
+ WriteRecordHeader(0x00000000,W_META_STRETCHDIB);
+
+ // Die Reihenfolge im Metafile soll jetzt sein:
+ // einige Parameter (laenge 22), dann die Bitmap ohne FILEHEADER.
+ // Da aber *pWMF << rBitmap einen FILEHEADER der Laenge 14
+ // erzeugt, schreiben wir zuerst die Bitmap an die richtige Position
+ // Und ueberschreiben hinterher den FILEHEADER mit den Parametern.
+ nPosAnf=pWMF->Tell(); // Position merken, wo Parameter hin sollen
+ *pWMF << (long)0 << (long)0; // 8 bytes auffuellen (diese 8 bytes +
+ // 14 bytes ueberfluessigen FILEHEADER
+ // = 22 bytes Parameter)
+ *pWMF << rBitmap; // Bitmap schreiben
+
+ // Parameter schreiben:
+ nPosEnd=pWMF->Tell();
+ pWMF->Seek(nPosAnf);
+
+ // Raster-Op bestimmen, falls nichts uebergeben wurde
+ if( !nROP )
+ {
+ switch( eSrcRasterOp )
+ {
+ case ROP_INVERT: nROP = W_DSTINVERT; break;
+ case ROP_XOR: nROP = W_SRCINVERT; break;
+ default: nROP = W_SRCCOPY;
+ }
+ }
+
+ *pWMF << nROP <<
+ (short) 0 <<
+ (short) rBitmap.GetSizePixel().Height() <<
+ (short) rBitmap.GetSizePixel().Width() <<
+ (short) 0 <<
+ (short) 0;
+
+ WriteHeightWidth(rSize);
+ WritePointYX(rPoint);
+ pWMF->Seek(nPosEnd);
+
+ UpdateRecordHeader();
+
+ nWrittenBitmaps++;
+ nActBitmapPercent=0;
+}
+
+
+void WMFWriter::WMFRecord_TextOut(const Point & rPoint, const ByteString & rString)
+{
+ USHORT nLen,i;
+
+ WriteRecordHeader(0,W_META_TEXTOUT);
+ nLen=rString.Len();
+ *pWMF << nLen;
+ for ( i = 0; i < nLen; i++ )
+ *pWMF << (BYTE)rString.GetChar( i );
+ if ((nLen&1)!=0) *pWMF << (BYTE)0;
+ WritePointYX(rPoint);
+ UpdateRecordHeader();
+}
+
+
+void WMFWriter::WMFRecord_EndOfFile()
+{
+ WriteRecordHeader(0x00000003,0x0000);
+}
+
+
+void WMFWriter::WMFRecord_IntersectClipRect( const Rectangle& rRect )
+{
+ WriteRecordHeader( 0x00000007, W_META_INTERSECTCLIPRECT );
+ WriteRectangle(rRect);
+}
+
+
+USHORT WMFWriter::AllocHandle()
+{
+ USHORT i;
+
+ for (i=0; i<MAXOBJECTHANDLES; i++) {
+ if (bHandleAllocated[i]==FALSE) {
+ bHandleAllocated[i]=TRUE;
+ return i;
+ }
+ }
+ bStatus=FALSE;
+ return 0xffff;
+}
+
+
+void WMFWriter::FreeHandle(USHORT nObjectHandle)
+{
+ if (nObjectHandle<MAXOBJECTHANDLES) bHandleAllocated[nObjectHandle]=FALSE;
+}
+
+
+void WMFWriter::CreateSelectDeletePen(const Color& rColor)
+{
+ USHORT nOldHandle;
+
+ nOldHandle=nDstPenHandle;
+ nDstPenHandle=AllocHandle();
+ WMFRecord_CreatePenIndirect(rColor);
+ WMFRecord_SelectObject(nDstPenHandle);
+ if (nOldHandle<MAXOBJECTHANDLES) {
+ WMFRecord_DeleteObject(nOldHandle);
+ FreeHandle(nOldHandle);
+ }
+}
+
+
+void WMFWriter::CreateSelectDeleteFont(const Font & rFont)
+{
+ USHORT nOldHandle;
+
+ nOldHandle=nDstFontHandle;
+ nDstFontHandle=AllocHandle();
+ WMFRecord_CreateFontIndirect(rFont);
+ WMFRecord_SelectObject(nDstFontHandle);
+ if (nOldHandle<MAXOBJECTHANDLES) {
+ WMFRecord_DeleteObject(nOldHandle);
+ FreeHandle(nOldHandle);
+ }
+}
+
+
+void WMFWriter::CreateSelectDeleteBrush(const Color& rColor)
+{
+ USHORT nOldHandle;
+
+ nOldHandle=nDstBrushHandle;
+ nDstBrushHandle=AllocHandle();
+ WMFRecord_CreateBrushIndirect(rColor);
+ WMFRecord_SelectObject(nDstBrushHandle);
+ if (nOldHandle<MAXOBJECTHANDLES) {
+ WMFRecord_DeleteObject(nOldHandle);
+ FreeHandle(nOldHandle);
+ }
+}
+
+
+void WMFWriter::SetAttrForLines()
+{
+
+ if (bAttrReadyForLines==TRUE) return;
+
+ if (bDstGraphicsInvalid || eDstROP2!=eSrcRasterOp) {
+ eDstROP2=eSrcRasterOp;
+ WMFRecord_SetROP2(eDstROP2);
+ }
+ if (bDstGraphicsInvalid || aDstLineColor!=aSrcLineColor) {
+ aDstLineColor=aSrcLineColor;
+ CreateSelectDeletePen(aDstLineColor);
+ }
+ if (bDstGraphicsInvalid || aDstFillColor!=aSrcFillColor) {
+ aDstFillColor=aSrcFillColor;
+ CreateSelectDeleteBrush(aDstFillColor);
+ }
+ if (bDstGraphicsInvalid || bDstIsClipping!=bSrcIsClipping ||
+ (bSrcIsClipping==TRUE && aDstClipRegion!=aSrcClipRegion)) {
+ bDstIsClipping=bSrcIsClipping;
+ aDstClipRegion=aSrcClipRegion;
+ if (bDstGraphicsInvalid==FALSE || bSrcIsClipping==TRUE) {
+ //...???...
+ }
+ }
+
+ bAttrReadyForLines=TRUE;
+ bAttrReadyForAreas=FALSE;
+ bAttrReadyForText=FALSE;
+ bDstGraphicsInvalid=FALSE;
+}
+
+
+void WMFWriter::SetAttrForAreas()
+{
+ if( aSrcFillColor == Color( COL_TRANSPARENT ) )
+ {
+ SetAttrForLines();
+ return;
+ }
+
+ if (bAttrReadyForAreas==TRUE) return;
+
+ if (bDstGraphicsInvalid || eDstROP2!=eSrcRasterOp) {
+ eDstROP2=eSrcRasterOp;
+ WMFRecord_SetROP2(eDstROP2);
+ }
+ if (bDstGraphicsInvalid || aDstLineColor!=aSrcLineColor) {
+ aDstLineColor=aSrcLineColor;
+ CreateSelectDeletePen(aDstLineColor);
+ }
+ if (bDstGraphicsInvalid || aDstFillColor!=aSrcFillColor) {
+ aDstFillColor=aSrcFillColor;
+ CreateSelectDeleteBrush(aDstFillColor);
+ }
+ if (bDstGraphicsInvalid || bDstIsClipping!=bSrcIsClipping ||
+ (bSrcIsClipping==TRUE && aDstClipRegion!=aSrcClipRegion)) {
+ bDstIsClipping=bSrcIsClipping;
+ aDstClipRegion=aSrcClipRegion;
+ if (bDstGraphicsInvalid==FALSE || bSrcIsClipping==TRUE) {
+ //...???...
+ }
+ }
+
+ bAttrReadyForAreas=TRUE;
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForText=FALSE;
+ bDstGraphicsInvalid=FALSE;
+}
+
+
+void WMFWriter::SetAttrForText()
+{
+ if (bAttrReadyForText==TRUE) return;
+
+ if (bDstGraphicsInvalid==FALSE) SetAttrForLines();
+
+ if (bDstTextInvalid || aDstTextColor!=aSrcFont.GetColor()) {
+ aDstTextColor=aSrcFont.GetColor();
+ WMFRecord_SetTextColor(aDstTextColor);
+ }
+ if (bDstTextInvalid || eDstTextAlign!=aSrcFont.GetAlign()) {
+ eDstTextAlign=aSrcFont.GetAlign();
+ WMFRecord_SetTextAlign(eDstTextAlign);
+ }
+ if (bDstTextInvalid || aDstFont!=aSrcFont) {
+ aDstFont=aSrcFont;
+ CreateSelectDeleteFont(aDstFont);
+ }
+
+ bAttrReadyForText=TRUE;
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ bDstTextInvalid=FALSE;
+}
+
+
+void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
+{
+ ULONG nA, nACount;
+ MetaAction* pMA;
+
+ if( bStatus )
+ {
+ nACount = rMTF.GetActionCount();
+
+ WMFRecord_SetStretchBltMode();
+
+ for( nA=0; nA<nACount; nA++ )
+ {
+ pMA = rMTF.GetAction( nA );
+
+ switch( pMA->GetType() )
+ {
+ case META_PIXEL_ACTION:
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction *) pMA;
+ SetAttrForLines();
+ WMFRecord_SetPixel( pA->GetPoint(), pA->GetColor() );
+ }
+ break;
+
+ case META_POINT_ACTION:
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pMA;
+ const Point& rPt = pA->GetPoint();
+ SetAttrForLines();
+ WMFRecord_MoveTo( rPt);
+ WMFRecord_LineTo( rPt );
+ }
+ break;
+
+ case META_LINE_ACTION:
+ {
+ const MetaLineAction* pA = (const MetaLineAction *) pMA;
+ const LineInfo& rLineInfo = pA->GetLineInfo();
+ SetAttrForLines();
+ if ( rLineInfo.IsDefault() )
+ {
+ WMFRecord_MoveTo( pA->GetStartPoint() );
+ WMFRecord_LineTo( pA->GetEndPoint() );
+ }
+ else
+ {
+ USHORT nCurrentHandle = AllocHandle();
+ WMFRecord_CreatePenIndirect( aSrcLineColor, rLineInfo );
+ WMFRecord_SelectObject(nCurrentHandle);
+ WMFRecord_MoveTo( pA->GetStartPoint() );
+ WMFRecord_LineTo( pA->GetEndPoint() );
+ WMFRecord_DeleteObject(nCurrentHandle);
+ FreeHandle(nCurrentHandle);
+ WMFRecord_SelectObject(nDstPenHandle);
+ }
+ }
+ break;
+
+ case META_RECT_ACTION:
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pMA;
+ SetAttrForAreas();
+ WMFRecord_Rectangle( pA->GetRect() );
+ }
+ break;
+
+ case META_ROUNDRECT_ACTION:
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pMA;
+ SetAttrForAreas();
+ WMFRecord_RoundRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+ break;
+
+ case META_ELLIPSE_ACTION:
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pMA;
+ SetAttrForAreas();
+ WMFRecord_Ellipse( pA->GetRect() );
+ }
+ break;
+
+ case META_ARC_ACTION:
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pMA;
+ SetAttrForLines();
+ WMFRecord_Arc( pA->GetRect(),pA->GetStartPoint(),pA->GetEndPoint() );
+ }
+ break;
+
+ case META_PIE_ACTION:
+ {
+ const MetaPieAction* pA = (const MetaPieAction*) pMA;
+ SetAttrForAreas();
+ WMFRecord_Pie( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+
+ case META_CHORD_ACTION:
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pMA;
+ SetAttrForAreas();
+ WMFRecord_Chord( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case META_POLYLINE_ACTION:
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
+ const LineInfo& rLineInfo = pA->GetLineInfo();
+ SetAttrForLines();
+
+ if ( rLineInfo.IsDefault() )
+ WMFRecord_PolyLine( pA->GetPolygon() );
+ else
+ {
+ USHORT nCurrentHandle = AllocHandle();
+ WMFRecord_CreatePenIndirect( aSrcLineColor, rLineInfo );
+ WMFRecord_SelectObject(nCurrentHandle);
+ WMFRecord_PolyLine( pA->GetPolygon() );
+ WMFRecord_DeleteObject(nCurrentHandle);
+ FreeHandle(nCurrentHandle);
+ WMFRecord_SelectObject(nDstPenHandle);
+ }
+ }
+ break;
+
+ case META_POLYGON_ACTION:
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pMA;
+ SetAttrForAreas();
+ WMFRecord_Polygon( pA->GetPolygon() );
+ }
+ break;
+
+ case META_POLYPOLYGON_ACTION:
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pMA;
+ SetAttrForAreas();
+ WMFRecord_PolyPolygon( pA->GetPolyPolygon() );
+ }
+ break;
+
+ case META_TEXT_ACTION:
+ case META_TEXTRECT_ACTION:
+ {
+ const MetaTextAction * pA = (const MetaTextAction*) pMA;
+ String aTemp( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ rtl_TextEncoding eChrSet = aSrcFont.GetCharSet();
+ rtl_TextEncoding eTargetChrSet = RTL_TEXTENCODING_MS_1252;
+ if ( eChrSet == RTL_TEXTENCODING_DONTKNOW )
+ eChrSet = gsl_getSystemTextEncoding();
+ if ( eChrSet != RTL_TEXTENCODING_SYMBOL )
+ eTargetChrSet = RTL_TEXTENCODING_SYMBOL;
+ ByteString aStr( aTemp, eChrSet, eTargetChrSet );
+ SetAttrForText();
+ WMFRecord_TextOut( pA->GetPoint(), aStr );
+ }
+ break;
+
+ case META_TEXTARRAY_ACTION:
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA;
+
+ String aTemp( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ rtl_TextEncoding eChrSet = aSrcFont.GetCharSet();
+ rtl_TextEncoding eTargetChrSet = RTL_TEXTENCODING_MS_1252;
+ if ( eChrSet == RTL_TEXTENCODING_DONTKNOW )
+ eChrSet = gsl_getSystemTextEncoding();
+ if ( eChrSet != RTL_TEXTENCODING_SYMBOL )
+ eTargetChrSet = RTL_TEXTENCODING_SYMBOL;
+ ByteString aStr( aTemp, eChrSet, eTargetChrSet );
+ SetAttrForText();
+ WMFRecord_ExtTextOut( pA->GetPoint(), aStr,pA->GetDXArray() );
+ }
+ break;
+
+ case META_STRETCHTEXT_ACTION:
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction *) pMA;
+ String aTemp( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ rtl_TextEncoding eChrSet = aSrcFont.GetCharSet();
+ rtl_TextEncoding eTargetChrSet = RTL_TEXTENCODING_MS_1252;
+ if ( eChrSet == RTL_TEXTENCODING_DONTKNOW )
+ eChrSet = gsl_getSystemTextEncoding();
+ if ( eChrSet != RTL_TEXTENCODING_SYMBOL )
+ eTargetChrSet = RTL_TEXTENCODING_SYMBOL;
+ ByteString aStr( aTemp, eChrSet, eTargetChrSet );
+ SetAttrForText();
+ WMFRecord_ExtTextOut( pA->GetPoint(),aStr,pA->GetWidth() );
+ }
+ break;
+
+ case META_BMP_ACTION:
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction *) pMA;
+ WMFRecord_StretchDIB( pA->GetPoint(), pA->GetBitmap().GetSizePixel(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALE_ACTION:
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pMA;
+ WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), pA->GetBitmap() );
+ }
+ break;
+
+ case META_BMPSCALEPART_ACTION:
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA;
+ Bitmap aTmp( pA->GetBitmap() );
+
+ if( aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ) )
+ WMFRecord_StretchDIB( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
+ }
+
+ case META_BMPEX_ACTION:
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction *) pMA;
+ Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
+ Bitmap aMsk( pA->GetBitmapEx().GetMask() );
+
+ if( !!aMsk )
+ {
+ aBmp.Replace( aMsk, COL_WHITE );
+ aMsk.Invert();
+ WMFRecord_StretchDIB( pA->GetPoint(), aMsk.GetSizePixel(), aBmp, W_SRCPAINT );
+ WMFRecord_StretchDIB( pA->GetPoint(), aBmp.GetSizePixel(), aBmp, W_SRCAND );
+ }
+ else
+ WMFRecord_StretchDIB( pA->GetPoint(), aBmp.GetSizePixel(), aBmp );
+ }
+ break;
+
+ case META_BMPEXSCALE_ACTION:
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
+ Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
+ Bitmap aMsk( pA->GetBitmapEx().GetMask() );
+
+ if( !!aMsk )
+ {
+ aBmp.Replace( aMsk, COL_WHITE );
+ aMsk.Invert();
+ WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), aMsk, W_SRCPAINT );
+ WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), aBmp, W_SRCAND );
+ }
+ else
+ WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), aBmp );
+ }
+ break;
+
+ case META_BMPEXSCALEPART_ACTION:
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA;
+ BitmapEx aBmpEx( pA->GetBitmapEx() );
+ aBmpEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+ Bitmap aMsk( aBmpEx.GetMask() );
+
+ if( !!aMsk )
+ {
+ aBmp.Replace( aMsk, COL_WHITE );
+ aMsk.Invert();
+ WMFRecord_StretchDIB( pA->GetDestPoint(), pA->GetDestSize(), aMsk, W_SRCPAINT );
+ WMFRecord_StretchDIB( pA->GetDestPoint(), pA->GetDestSize(), aBmp, W_SRCAND );
+ }
+ else
+ WMFRecord_StretchDIB( pA->GetDestPoint(), pA->GetDestSize(), aBmp );
+ }
+
+ case META_GRADIENT_ACTION:
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pMA;
+ GDIMetaFile aTmpMtf;
+
+ pVirDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ WriteRecords( aTmpMtf );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pMA;
+ GDIMetaFile aTmpMtf;
+
+ pVirDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ WriteRecords( aTmpMtf );
+ }
+ break;
+
+ case META_WALLPAPER_ACTION:
+ {
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pMA;
+ const Color& rColor = pA->GetWallpaper().GetColor();
+ const Color aOldLineColor( aSrcLineColor );
+ const Color aOldFillColor( aSrcFillColor );
+
+ aSrcLineColor = rColor;
+ aSrcFillColor = rColor;
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ SetAttrForAreas();
+ WMFRecord_Rectangle( pA->GetRect() );
+ aSrcLineColor = aOldLineColor;
+ aSrcFillColor = aOldFillColor;
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ }
+ break;
+
+ case META_ISECTRECTCLIPREGION_ACTION:
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pMA;
+ WMFRecord_IntersectClipRect( pA->GetRect() );
+ }
+ break;
+
+ case META_LINECOLOR_ACTION:
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aSrcLineColor = pA->GetColor();
+ else
+ aSrcLineColor = Color( COL_TRANSPARENT );
+
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ }
+ break;
+
+ case META_FILLCOLOR_ACTION:
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aSrcFillColor = pA->GetColor();
+ else
+ aSrcFillColor = Color( COL_TRANSPARENT );
+
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ }
+ break;
+
+ case META_TEXTCOLOR_ACTION:
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pMA;
+ aSrcFont.SetColor( pA->GetColor() );
+ bAttrReadyForText = FALSE;
+ }
+ break;
+
+ case META_TEXTFILLCOLOR_ACTION:
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pMA;
+
+ if( pA->IsSetting() )
+ aSrcFont.SetFillColor( pA->GetColor() );
+ else
+ aSrcFont.SetFillColor( Color( COL_TRANSPARENT ) );
+
+ bAttrReadyForText = FALSE;
+ }
+ break;
+
+ case META_TEXTALIGN_ACTION:
+ {
+ const MetaTextAlignAction* pA = (const MetaTextAlignAction*) pMA;
+ WMFRecord_SetTextAlign( pA->GetTextAlign() );
+ }
+ break;
+
+
+ case META_MAPMODE_ACTION:
+ {
+ const MetaMapModeAction* pA = (const MetaMapModeAction*) pMA;
+
+ if (aSrcMapMode!=pA->GetMapMode())
+ {
+ if( pA->GetMapMode().GetMapUnit() == MAP_RELATIVE )
+ {
+ MapMode aMM = pA->GetMapMode();
+ Fraction aScaleX = aMM.GetScaleX();
+ Fraction aScaleY = aMM.GetScaleY();
+
+ Point aOrigin = aSrcMapMode.GetOrigin();
+ BigInt aX( aOrigin.X() );
+ aX *= BigInt( aScaleX.GetDenominator() );
+ if( aOrigin.X() >= 0 )
+ if( aScaleX.GetNumerator() >= 0 )
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ else
+ aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
+ else
+ if( aScaleX.GetNumerator() >= 0 )
+ aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
+ else
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ aX /= BigInt( aScaleX.GetNumerator() );
+ aOrigin.X() = (long)aX + aMM.GetOrigin().X();
+ BigInt aY( aOrigin.Y() );
+ aY *= BigInt( aScaleY.GetDenominator() );
+ if( aOrigin.Y() >= 0 )
+ if( aScaleY.GetNumerator() >= 0 )
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ else
+ aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
+ else
+ if( aScaleY.GetNumerator() >= 0 )
+ aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
+ else
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ aY /= BigInt( aScaleY.GetNumerator() );
+ aOrigin.Y() = (long)aY + aMM.GetOrigin().Y();
+ aSrcMapMode.SetOrigin( aOrigin );
+
+ aScaleX *= aSrcMapMode.GetScaleX();
+ aScaleY *= aSrcMapMode.GetScaleY();
+ aSrcMapMode.SetScaleX( aScaleX );
+ aSrcMapMode.SetScaleY( aScaleY );
+ }
+ else
+ aSrcMapMode=pA->GetMapMode();
+
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ bAttrReadyForText=FALSE;
+ bDstGraphicsInvalid=TRUE;
+ bDstTextInvalid=TRUE;
+ }
+ }
+ break;
+
+ case META_FONT_ACTION:
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pMA;
+ aSrcFont=pA->GetFont();
+ bAttrReadyForText=FALSE;
+ }
+ break;
+
+ case META_PUSH_ACTION:
+ {
+ WMFWriterAttrStackMember* pAt = new WMFWriterAttrStackMember;
+
+ pAt->aLineColor=aSrcLineColor;
+ pAt->aFillColor=aSrcFillColor;
+ pAt->eRasterOp=eSrcRasterOp;
+ pAt->aFont=aSrcFont;
+ pAt->aMapMode=aSrcMapMode;
+ pAt->aClipRegion=aSrcClipRegion;
+ pAt->pSucc=pAttrStack;
+ pAttrStack=pAt;
+
+ // Fuer das SaveDC muessen wir ggf. alle Objekte
+ // sofort selektieren, damit beim RestoreDC im ::Pop
+ // alles wieder richtig restauriert wird
+ SetAttrForLines();
+ SetAttrForAreas();
+ SetAttrForText();
+
+ // Das machen wir nur, um die ClipRegion nach einem evtl.
+ // IntersectClipRect wieder zuruecksetzen zu koennen
+ WMFRecord_SaveDC();
+ }
+ break;
+
+ case META_POP_ACTION:
+ {
+ WMFWriterAttrStackMember * pAt=pAttrStack;
+
+ if( pAt )
+ {
+ aSrcLineColor=pAt->aLineColor;
+ aSrcFillColor=pAt->aFillColor;
+ eSrcRasterOp=pAt->eRasterOp;
+ aSrcFont=pAt->aFont;
+ aSrcMapMode=pAt->aMapMode;
+ aSrcClipRegion=pAt->aClipRegion;
+ pAttrStack=pAt->pSucc;
+ delete pAt;
+
+ WMFRecord_RestoreDC();
+
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ bAttrReadyForText=FALSE;
+ bDstGraphicsInvalid=TRUE;
+ }
+ }
+ break;
+
+ case META_EPS_ACTION :
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*)pMA;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+
+ INT32 nCount = aGDIMetaFile.GetActionCount();
+ for ( INT32 i = 0; i < nCount; i++ )
+ {
+ const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i );
+ if ( pMetaAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*)pMetaAct;
+ WMFRecord_StretchDIB( pA->GetPoint(), pA->GetSize(), pBmpScaleAction->GetBitmap() );
+ break;
+ }
+ }
+ }
+ break;
+
+ case META_RASTEROP_ACTION:
+ {
+ const MetaRasterOpAction* pA = (const MetaRasterOpAction*) pMA;
+ eSrcRasterOp=pA->GetRasterOp();
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ bAttrReadyForText=FALSE;
+ }
+ break;
+
+ case META_TRANSPARENT_ACTION:
+ {
+ SetAttrForAreas();
+ WMFRecord_PolyPolygon( ( (MetaTransparentAction*) pMA )->GetPolyPolygon() );
+ }
+ break;
+
+ case META_FLOATTRANSPARENT_ACTION:
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pMA;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ SetAttrForLines();
+ SetAttrForAreas();
+ SetAttrForText();
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aTmpMtf.Move( nMoveX, nMoveY );
+
+ WriteRecords( aTmpMtf );
+ }
+ break;
+
+ // Unsupported Actions
+ case META_MASK_ACTION:
+ case META_MASKSCALE_ACTION:
+ case META_MASKSCALEPART_ACTION:
+ {
+ DBG_ERROR( "Unsupported action: MetaMask...Action!" );
+ }
+ break;
+
+ case META_CLIPREGION_ACTION:
+ break;
+
+ case META_ISECTREGIONCLIPREGION_ACTION:
+ {
+ DBG_ERROR( "Unsupported action: MetaISectRegionClipRegionAction!" );
+ }
+ break;
+
+ case META_MOVECLIPREGION_ACTION:
+ {
+ DBG_ERROR( "Unsupported action: MetaMoveClipRegionAction!" );
+ }
+ break;
+ }
+
+ nWrittenActions++;
+ MayCallback();
+
+ if (pWMF->GetError())
+ bStatus=FALSE;
+
+ if(bStatus==FALSE)
+ break;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void WMFWriter::WriteHeader( const GDIMetaFile & rMTF, BOOL bPlaceable )
+{
+ if( bPlaceable )
+ {
+ USHORT nCheckSum, nValue;
+ Size aSize( pVirDev->LogicToLogic(Size(1,1),MapMode(MAP_INCH), aTargetMapMode) );
+ USHORT nUnitsPerInch = (USHORT) ( ( aSize.Width() + aSize.Height() ) >> 1 );
+
+ nCheckSum=0;
+ nValue=0xcdd7; nCheckSum^=nValue; *pWMF << nValue;
+ nValue=0x9ac6; nCheckSum^=nValue; *pWMF << nValue;
+ nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
+ nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
+ nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
+ nValue=(USHORT) aTargetSize.Width(); nCheckSum^=nValue; *pWMF << nValue;
+ nValue=(USHORT) aTargetSize.Height(); nCheckSum^=nValue; *pWMF << nValue;
+ nValue=nUnitsPerInch; nCheckSum^=nValue; *pWMF << nValue;
+ nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
+ nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
+ *pWMF << nCheckSum;
+ }
+
+ nMetafileHeaderPos=pWMF->Tell();
+ *pWMF << (USHORT)0x0001 // Typ: Datei
+ << (USHORT)0x0009 // Headerlaenge in Worten
+ << (USHORT)0x0300 // Version als BCD-Zahl
+ << (ULONG) 0x00000000 // Dateilaenge (ohne 1. Header), wird spaeter durch UpdateHeader() berichtigt
+ << (USHORT)MAXOBJECTHANDLES // Maximalezahl der gleichzeitigen Objekte
+ << (ULONG) 0x00000000 // Maximale Record-laenge, wird spaeter durch UpdateHeader() berichtigt
+ << (USHORT)0x0000; // Reserved
+}
+
+// ------------------------------------------------------------------------
+
+void WMFWriter::UpdateHeader()
+{
+ ULONG nPos,nFileSize;
+
+ nPos=pWMF->Tell(); // Endposition = Gesammtgroesse der Datei
+ nFileSize=nPos-nMetafileHeaderPos; // Groesse des 1. Headers abziehen
+ if ((nFileSize&1)!=0) { // ggf. auf ganze Worte aufrunden
+ *pWMF << (BYTE)0;
+ nPos++;
+ nFileSize++;
+ }
+ nFileSize>>=1; // In Anzahl Worte umrechnen
+ pWMF->Seek(nMetafileHeaderPos+6); // Zum Dateigroessen-Eintrag im zweiten Header
+ *pWMF << nFileSize; // Dateigroesse berichtigen
+ pWMF->SeekRel(2); // Zum Max-Record-Laenge-Eintrag im zweiten Header
+ *pWMF << nMaxRecordSize; // und berichtigen
+ pWMF->Seek(nPos);
+}
+
+// ------------------------------------------------------------------------
+
+BOOL WMFWriter::WriteWMF(const GDIMetaFile& rMTF, SvStream& rTargetStream,
+ PFilterCallback pcallback, void* pcallerdata,
+ BOOL bPlaceable)
+{
+ WMFWriterAttrStackMember * pAt;
+
+ bStatus=TRUE;
+ pVirDev = new VirtualDevice;
+ pCallback=pcallback;
+ pCallerData=pcallerdata;
+ nLastPercent=0;
+
+ pWMF=&rTargetStream;
+ pWMF->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+
+ nMaxRecordSize=0;
+
+ aSrcMapMode=rMTF.GetPrefMapMode();
+
+ if( bPlaceable )
+ {
+ aTargetMapMode = aSrcMapMode;
+ aTargetSize = rMTF.GetPrefSize();
+ nTargetDivisor = CalcSaveTargetMapMode(aTargetMapMode, aTargetSize);
+ aTargetSize.Width() /= nTargetDivisor;
+ aTargetSize.Height() /= nTargetDivisor;
+ }
+ else
+ {
+ aTargetMapMode = MapMode( MAP_INCH );
+
+ const long nUnit = pVirDev->LogicToPixel( Size( 1, 1 ), aTargetMapMode ).Width();
+ const Fraction aFrac( 1, nUnit );
+
+ aTargetMapMode.SetScaleX( aFrac );
+ aTargetMapMode.SetScaleY( aFrac );
+ aTargetSize = pVirDev->LogicToLogic( rMTF.GetPrefSize(), aSrcMapMode, aTargetMapMode );
+ }
+
+ pVirDev->SetMapMode( aTargetMapMode );
+
+ aSrcLineColor = Color( COL_BLACK );
+ aSrcFillColor = Color( COL_WHITE );
+ eSrcRasterOp=ROP_OVERPAINT;
+ aSrcFont=Font();
+ bSrcIsClipping=FALSE;
+ aSrcClipRegion=Region();
+ pAttrStack=NULL;
+
+ aDstLineColor = Color( COL_BLACK );
+ aDstFillColor = Color( COL_WHITE );
+ eDstROP2=ROP_OVERPAINT;
+ aDstTextColor=Color(COL_BLACK);
+ eDstTextAlign=ALIGN_BASELINE;
+ aDstFont=Font();
+ bDstIsClipping=FALSE;
+ aDstClipRegion=Region();
+
+ for (USHORT i=0; i<MAXOBJECTHANDLES; i++)
+ bHandleAllocated[i]=FALSE;
+
+ nDstPenHandle=0xffff;
+ nDstFontHandle=0xffff;
+ nDstBrushHandle=0xffff;
+
+ bDstTextInvalid=TRUE;
+ bDstGraphicsInvalid=TRUE;
+
+ bAttrReadyForLines=FALSE;
+ bAttrReadyForAreas=FALSE;
+ bAttrReadyForText=FALSE;
+
+ nNumberOfActions=0;
+ nNumberOfBitmaps=0;
+ nWrittenActions=0;
+ nWrittenBitmaps=0;
+ nActBitmapPercent=0;
+
+ CountActionsAndBitmaps(rMTF);
+
+ WriteHeader(rMTF,bPlaceable);
+ WMFRecord_SetWindowOrg(Point(0,0));
+ WMFRecord_SetWindowExt(rMTF.GetPrefSize());
+ WMFRecord_SetBkMode( TRUE );
+
+ // Write records
+ WriteRecords(rMTF);
+
+ WMFRecord_EndOfFile();
+ UpdateHeader();
+
+ while(pAttrStack)
+ {
+ pAt=pAttrStack;
+ pAttrStack=pAt->pSucc;
+ delete pAt;
+ }
+
+ delete pVirDev;
+
+ return bStatus;
+}
+
+// ------------------------------------------------------------------------
+
+USHORT WMFWriter::CalcSaveTargetMapMode(MapMode& rMapMode,
+ const Size& rPrefSize)
+{
+ Fraction aDivFrac(2, 1);
+ USHORT nDivisor = 1;
+
+ Size aSize = pVirDev->LogicToLogic( rPrefSize, aSrcMapMode, rMapMode );
+
+ while( nDivisor <= 64 && (aSize.Width() > 32767 || aSize.Height() > 32767) )
+ {
+ Fraction aFrac = rMapMode.GetScaleX();
+
+ aFrac *= aDivFrac;
+ rMapMode.SetScaleX(aFrac);
+ aFrac = rMapMode.GetScaleY();
+ aFrac *= aDivFrac;
+ rMapMode.SetScaleY(aFrac);
+ nDivisor <<= 1;
+ aSize = pVirDev->LogicToLogic( rPrefSize, aSrcMapMode, rMapMode );
+ }
+
+ return nDivisor;
+}
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.hxx b/svtools/source/filter.vcl/wmf/wmfwr.hxx
new file mode 100644
index 000000000000..1ac7603c1ba9
--- /dev/null
+++ b/svtools/source/filter.vcl/wmf/wmfwr.hxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * $RCSfile: wmfwr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _WMFWR_HXX
+#define _WMFWR_HXX
+
+#include <tools/bigint.hxx>
+#include <tools/debug.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/gdimtf.hxx>
+#include <vcl/virdev.hxx>
+#include "fltcall.hxx"
+
+// -----------------------------------------------------------------------------
+
+#define MAXOBJECTHANDLES 16
+
+// -----------------------------------------------------------------------------
+
+struct WMFWriterAttrStackMember
+{
+ struct WMFWriterAttrStackMember * pSucc;
+ Color aLineColor;
+ Color aFillColor;
+ RasterOp eRasterOp;
+ Font aFont;
+ MapMode aMapMode;
+ Region aClipRegion;
+};
+
+// -------------
+// - WMFWriter -
+// -------------
+
+class WMFWriter
+{
+private:
+
+ BOOL bStatus;
+
+ PFilterCallback pCallback;
+ void* pCallerData;
+ ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde.
+
+ SvStream* pWMF;
+ VirtualDevice* pVirDev;
+ MapMode aTargetMapMode;
+ Size aTargetSize;
+ USHORT nTargetDivisor;
+
+ ULONG nMetafileHeaderPos;
+ ULONG nMaxRecordSize; // in Worten
+ ULONG nActRecordPos;
+
+ // Aktuelle Attribute im Quell-Metafile:
+ Color aSrcLineColor;
+ Color aSrcFillColor;
+ RasterOp eSrcRasterOp;
+ Font aSrcFont;
+ MapMode aSrcMapMode;
+ BOOL bSrcIsClipping;
+ Region aSrcClipRegion;
+ WMFWriterAttrStackMember * pAttrStack;
+
+ // Aktuelle Attribute im Ziel-Metafile:
+ RasterOp eDstROP2;
+ Color aDstTextColor;
+ FontAlign eDstTextAlign;
+ Color aDstLineColor;
+ Color aDstFillColor;
+ Font aDstFont;
+ BOOL bDstIsClipping; // ???: derzeit unberuecksichtigt
+ Region aDstClipRegion; // ???: derzeit unberuecksichtigt
+ BOOL bHandleAllocated[MAXOBJECTHANDLES]; // Welche Handles vergeben sind
+ USHORT nDstPenHandle,nDstFontHandle,nDstBrushHandle; // Welche Handles die jeweiligen
+ // Selected-Objects besitzen
+ // 0xffff = keines:
+ BOOL bDstTextInvalid; // ist TRUE, wenn die Variablen aDstTextColor, eDstTextAlign
+ // und aDstFont nicht mit den Attributen im Ziel-Metafile
+ // uebereinstimmen (Das ist am Anfang der Fall)
+ BOOL bDstGraphicsInvalid; // dito fuer alle anderen Attribute
+
+ // Damit nicht bei jeder Operation alle Attribute verglichen werden muessen:
+ BOOL bAttrReadyForLines; // Ist TRUE, wenn die Attribute im Ziel-Metafile so
+ // gesetzt sind, dass Linien ausgegeben werden koennen.
+ BOOL bAttrReadyForAreas; // Ist TRUE, wenn die Attribute im Ziel-Metafile so
+ // gesetzt sind, dass gefuellte Polygone, Rechtecke etc.
+ // (einschliesslich Umrahmung) ausgegeben werden koennen.
+ BOOL bAttrReadyForText; // Ist TRUE, wenn die Attribute im Ziel-Metafile so
+ // gesetzt sind, dass Text ausgegeben werden kann.
+
+ ULONG nNumberOfActions; // Anzahl der Actions im GDIMetafile
+ ULONG nNumberOfBitmaps; // Anzahl der Bitmaps
+ ULONG nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Orders
+ ULONG nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps
+ ULONG nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist.
+
+ void MayCallback();
+ // Berechnet anhand der obigen 5 Parameter eine Prozentzahl
+ // und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen
+ // moechte.
+
+ void CountActionsAndBitmaps(const GDIMetaFile & rMTF);
+ // Zaehlt die Bitmaps und Actions (nNumberOfActions und nNumberOfBitmaps muessen
+ // zu Anfang auf 0 gesetzt werden, weil diese Methode rekursiv ist)
+
+ void WritePointXY(const Point & rPoint);
+ void WritePointYX(const Point & rPoint);
+ void WriteDX(long nDX);
+ void WriteSize(const Size & rSize);
+ void WriteHeightWidth(const Size & rSize);
+ void WriteRectangle(const Rectangle & rRect);
+ void WriteColor(const Color & rColor);
+
+ void WriteRecordHeader(ULONG nSizeWords, USHORT nType);
+ // nSizeWords ist die Groesse des gesammten Records in Anzahl Worte.
+ // Wenn nSizeWords unbekannt ist, dann 0 einsetzen (siehe UpdateRecordHeader()).
+
+ void UpdateRecordHeader();
+ // berichtig die Groesse des Records nach dem Schreiben der Parameter, wenn
+ // nSizeWords bei Aufruf von WriteRecordHeader(..) unbekannt war.
+ // fuegt ggf. noch ein BYTE 0 ein damit Anzahl Bytes immer gerade.
+
+ void WMFRecord_Arc(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
+ void WMFRecord_Chord(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
+ void WMFRecord_CreateBrushIndirect(const Color& rColor);
+ void WMFRecord_CreateFontIndirect(const Font & rFont);
+ void WMFRecord_CreatePenIndirect(const Color& rColor);
+ void WMFRecord_CreatePenIndirect(const Color& rColor, const LineInfo& rLineInfo );
+ void WMFRecord_DeleteObject(USHORT nObjectHandle);
+ void WMFRecord_Ellipse(const Rectangle & rRect);
+ void WMFRecord_ExtTextOut(const Point & rPoint, const ByteString & rString, const long * pDXAry);
+ void WMFRecord_ExtTextOut(const Point & rPoint, const ByteString & rString, ULONG nWidth);
+ void WMFRecord_LineTo(const Point & rPoint);
+ void WMFRecord_MoveTo(const Point & rPoint);
+ void WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
+ void WMFRecord_Polygon(const Polygon & rPoly);
+ void WMFRecord_PolyLine(const Polygon & rPoly);
+ void WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly);
+ void WMFRecord_Rectangle(const Rectangle & rRect);
+ void WMFRecord_RestoreDC();
+ void WMFRecord_RoundRect(const Rectangle & rRect, long nHorzRound, long nVertRound);
+ void WMFRecord_SaveDC();
+ void WMFRecord_SelectObject(USHORT nObjectHandle);
+ void WMFRecord_SetBkColor(const Color & rColor);
+ void WMFRecord_SetBkMode(BOOL bTransparent);
+ void WMFRecord_SetStretchBltMode();
+ void WMFRecord_SetPixel(const Point & rPoint, const Color & rColor);
+ void WMFRecord_SetROP2(RasterOp eROP);
+ void WMFRecord_SetTextAlign(FontAlign eFontAlign);
+ void WMFRecord_SetTextColor(const Color & rColor);
+ void WMFRecord_SetWindowExt(const Size & rSize);
+ void WMFRecord_SetWindowOrg(const Point & rPoint);
+ void WMFRecord_StretchDIB(const Point & rPoint, const Size & rSize, const Bitmap & rBitmap, ULONG nROP = 0UL );
+ void WMFRecord_TextOut(const Point & rPoint, const ByteString & rString);
+ void WMFRecord_EndOfFile();
+ void WMFRecord_IntersectClipRect( const Rectangle& rRect);
+
+ USHORT AllocHandle();
+ void FreeHandle(USHORT nObjectHandle);
+ void CreateSelectDeletePen(const Color& rColor);
+ void CreateSelectDeleteFont(const Font & rFont);
+ void CreateSelectDeleteBrush(const Color& rColor);
+
+ void SetAttrForLines(); // Setzt die Dst-Attribute fuer Linien
+ void SetAttrForAreas(); // Setzt die Dst-Attribute fuer gefuellte Dinge.
+ // Macht automatisch SetAttrForLines, wenn BrushStyle NULL
+ void SetAttrForText(); // Setzt die Dst-Attribute fuer Text-Ausgabe
+
+ void WriteRecords(const GDIMetaFile & rMTF);
+
+ void WriteHeader(const GDIMetaFile & rMTF, BOOL bPlaceable);
+ void UpdateHeader();
+
+ USHORT CalcSaveTargetMapMode(MapMode& rMapMode, const Size& rPrefSize);
+
+public:
+
+ WMFWriter() {}
+
+ BOOL WriteWMF(const GDIMetaFile & rMTF, SvStream & rTargetStream,
+ PFilterCallback pcallback, void * pcallerdata,
+ BOOL bPlaceable=TRUE);
+};
+
+#endif
diff --git a/svtools/source/items/aeitem.cxx b/svtools/source/items/aeitem.cxx
new file mode 100644
index 000000000000..aebb93af79a8
--- /dev/null
+++ b/svtools/source/items/aeitem.cxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * $RCSfile: aeitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <tools/string.hxx>
+
+#include <svarray.hxx>
+#include "aeitem.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxAllEnumItem);
+
+// -----------------------------------------------------------------------
+
+struct SfxAllEnumValue_Impl
+{
+ USHORT nValue;
+ XubString aText;
+};
+
+SV_DECL_PTRARR_DEL(SfxAllEnumValueArr, SfxAllEnumValue_Impl*, 0, 8);
+SV_IMPL_PTRARR(SfxAllEnumValueArr, SfxAllEnumValue_Impl*);
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem( USHORT nWhich, USHORT nVal, const XubString &rText ):
+ SfxEnumItem(nWhich, nVal),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( nVal, rText );
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem(USHORT nWhich, USHORT nVal):
+ SfxEnumItem(nWhich, nVal),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( nVal );
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem( USHORT nWhich, SvStream &rStream ):
+ SfxEnumItem(nWhich, rStream),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+ InsertValue( GetValue() );
+}
+
+// -----------------------------------------------------------------------
+
+
+SfxAllEnumItem::SfxAllEnumItem(USHORT nWhich):
+ SfxEnumItem(nWhich, 0),
+ pValues( 0 )
+{
+ DBG_CTOR(SfxAllEnumItem, 0);
+}
+
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy):
+ SfxEnumItem(rCopy),
+ pValues(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 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SfxAllEnumItem::~SfxAllEnumItem()
+{
+ DBG_DTOR(SfxAllEnumItem, 0);
+ delete pValues;
+}
+
+// -----------------------------------------------------------------------
+
+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 nVersion ) 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::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/eitem.cxx b/svtools/source/items/eitem.cxx
new file mode 100644
index 000000000000..bc3a5f84e9db
--- /dev/null
+++ b/svtools/source/items/eitem.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: eitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SFXENUMITEM_HXX
+#include <eitem.hxx>
+#endif
+//============================================================================
+//
+// class SfxEnumItem
+//
+//============================================================================
+
+TYPEINIT1(SfxEnumItem, CntEnumItem);
+
+//============================================================================
+//
+// class SfxBoolItem
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxBoolItem, CntBoolItem);
+
+
diff --git a/svtools/source/items/flagitem.cxx b/svtools/source/items/flagitem.cxx
new file mode 100644
index 000000000000..bfa4a816084a
--- /dev/null
+++ b/svtools/source/items/flagitem.cxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * $RCSfile: flagitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#pragma hdrstop
+
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "flagitem.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 nItemVersion) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ rStream << nVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+SfxItemPresentation SfxFlagItem::GetPresentation
+(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ XubString& rText,
+ const International *
+) const
+{
+ DBG_CHKTHIS(SfxFlagItem, 0);
+ rText.Erase();
+ for ( int nFlag = 0; nFlag < GetFlagCount(); ++nFlag )
+#ifndef ENABLEUNICODE
+ rText += String( GetFlag(nFlag) );
+#else
+ rText += UniString::CreateFromInt32( GetFlag(nFlag) );
+#endif
+ return SFX_ITEM_PRESENTATION_NAMELESS;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SfxFlagItem::GetFlagText( BYTE nV ) 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 &rStream, USHORT nVersion) 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/intitem.cxx b/svtools/source/items/intitem.cxx
new file mode 100644
index 000000000000..a5db1767f543
--- /dev/null
+++ b/svtools/source/items/intitem.cxx
@@ -0,0 +1,306 @@
+/*************************************************************************
+ *
+ * $RCSfile: intitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _BIGINT_HXX
+#include <tools/bigint.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _SFXINTITEM_HXX
+#include <intitem.hxx>
+#endif
+#ifndef _SFXMETRICITEM_HXX
+#include <metitem.hxx>
+#endif
+#ifndef _SBXVAR_HXX
+#include <sbxvar.hxx>
+#endif
+
+//============================================================================
+//
+// 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 nWhich, SvStream & rStream):
+ SfxPoolItem(nWhich)
+{
+ 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 International *) 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 nMemberId) const
+{
+ sal_Int16 nValue = m_nValue;
+ rVal <<= nValue;
+ return TRUE;
+}
+
+//============================================================================
+// virtual
+BOOL SfxInt16Item::PutValue(const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId)
+{
+ sal_Int16 nValue;
+ 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 nWhich, UINT32 nValue):
+ SfxInt32Item(nWhich, nValue)
+{
+ DBG_CTOR(SfxMetricItem, 0);
+}
+
+//============================================================================
+SfxMetricItem::SfxMetricItem(USHORT nWhich, SvStream & rStream):
+ SfxInt32Item(nWhich, 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/itemdel.cxx b/svtools/source/items/itemdel.cxx
new file mode 100644
index 000000000000..d3acda749a45
--- /dev/null
+++ b/svtools/source/items/itemdel.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * $RCSfile: itemdel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _ERRCODE_HXX //autogen
+#include <tools/errcode.hxx>
+#endif
+#include <limits.h>
+
+#include <sbx.hxx>
+
+#include "svtdata.hxx"
+#include "svarray.hxx"
+#include "args.hxx"
+#include "itempool.hxx"
+#include "itemdel.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxItemDesruptor_Impl);
+
+// -----------------------------------------------------------------------
+
+class SfxItemDesruptor_Impl
+{
+ SfxPoolItem *pItem;
+ Link aLink;
+
+private:
+ DECL_LINK( Delete, void * );
+ SfxItemDesruptor_Impl( const SfxItemDesruptor_Impl& ); // n.i.
+
+public:
+ SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt );
+ ~SfxItemDesruptor_Impl();
+};
+
+SV_DECL_PTRARR( SfxItemDesruptorList_Impl, SfxItemDesruptor_Impl*, 4, 4 );
+
+// ------------------------------------------------------------------------
+SfxItemDesruptor_Impl::SfxItemDesruptor_Impl( SfxPoolItem *pItemToDesrupt ):
+ pItem(pItemToDesrupt),
+ aLink( LINK(this, SfxItemDesruptor_Impl, Delete) )
+{
+ DBG_CTOR(SfxItemDesruptor_Impl, 0);
+
+ pItem->SetRef( SFX_ITEMS_DELETEONIDLE );
+
+ // im Idle abarbeiten
+ GetpApp()->InsertIdleHdl( aLink, 1 );
+
+ // und in Liste eintragen (damit geflusht werden kann)
+ SfxItemDesruptorList_Impl* &rpList
+ = ImpSvtData::GetSvtData().pItemDesruptList;
+ if ( !rpList )
+ rpList = new SfxItemDesruptorList_Impl;
+ const SfxItemDesruptor_Impl *pThis = this;
+ rpList->Insert( pThis, rpList->Count() );
+}
+
+// ------------------------------------------------------------------------
+SfxItemDesruptor_Impl::~SfxItemDesruptor_Impl()
+{
+ DBG_DTOR(SfxItemDesruptor_Impl, 0);
+
+ // aus Idle-Handler austragen
+ GetpApp()->RemoveIdleHdl( aLink );
+
+ // und aus Liste austragen
+ SfxItemDesruptorList_Impl* &rpList
+ = ImpSvtData::GetSvtData().pItemDesruptList;
+ DBG_ASSERT( rpList, "no DesruptorList" );
+ const SfxItemDesruptor_Impl *pThis = this;
+ if ( rpList ) HACK(warum?)
+ rpList->Remove( rpList->GetPos(pThis) );
+
+ // Item l"oschen
+ pItem->SetRef( 0 );
+ DBG_CHKOBJ( pItem, SfxPoolItem, 0 );
+ DBG_ASSERT( 0 == pItem->GetRef(), "desrupting pooled item" );
+ delete pItem;
+}
+
+// ------------------------------------------------------------------------
+IMPL_LINK( SfxItemDesruptor_Impl, Delete, void *, pvoid )
+{
+ {DBG_CHKTHIS(SfxItemDesruptor_Impl, 0);}
+ delete this;
+ return 0;
+}
+
+// ------------------------------------------------------------------------
+SfxPoolItem* DeleteItemOnIdle( SfxPoolItem* pItem )
+{
+ DBG_ASSERT( 0 == pItem->GetRef(), "deleting item in use" );
+ new SfxItemDesruptor_Impl( pItem );
+ return pItem;
+}
+
+// ------------------------------------------------------------------------
+void DeleteOnIdleItems()
+{
+ SfxItemDesruptorList_Impl* &rpList
+ = ImpSvtData::GetSvtData().pItemDesruptList;
+ if ( rpList )
+ {
+ USHORT n;
+ while ( 0 != ( n = rpList->Count() ) )
+ // Remove ist implizit im Dtor
+ delete rpList->GetObject( n-1 );
+ DELETEZ(rpList);
+ }
+}
+
+
diff --git a/svtools/source/items/macitem.cxx b/svtools/source/items/macitem.cxx
new file mode 100644
index 000000000000..17c831ad167c
--- /dev/null
+++ b/svtools/source/items/macitem.cxx
@@ -0,0 +1,395 @@
+/*************************************************************************
+ *
+ * $RCSfile: macitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#pragma hdrstop
+#define ITEMID_MACRO 0
+
+#include "macitem.hxx"
+#include <segmentc.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SvxMacroItem);
+
+SEG_EOFGLOBALS()
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1_AUTOFACTORY(SvxMacroItem, SfxPoolItem);
+
+// -----------------------------------------------------------------------
+
+
+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));
+ }
+
+ 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;
+}
+
+
+#pragma SEG_FUNCDEF(macitem_02)
+
+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;
+}
+
+#pragma SEG_FUNCDEF(macitem_03)
+
+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;
+}
+
+#pragma SEG_FUNCDEF(macitem_04)
+
+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;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_05)
+
+void SvxMacroTableDtor::DelDtor()
+{
+ SvxMacro* pTmp = First();
+ while( pTmp )
+ {
+ delete pTmp;
+ pTmp = Next();
+ }
+ Clear();
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_06)
+
+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;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_07)
+
+SfxPoolItem* SvxMacroItem::Clone( SfxItemPool* ) const
+{
+ return new SvxMacroItem( *this );
+}
+
+//------------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_08)
+
+SfxItemPresentation SvxMacroItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ XubString& rText,
+ const International *
+) 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;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_09)
+
+SvStream& SvxMacroItem::Store( SvStream& rStrm , USHORT nItemVersion ) const
+{
+ return aMacroTable.Write( rStrm );
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_0a)
+
+SfxPoolItem* SvxMacroItem::Create( SvStream& rStrm, USHORT nVersion ) const
+{
+ SvxMacroItem* pAttr = new SvxMacroItem( Which() );
+ pAttr->aMacroTable.Read( rStrm, nVersion );
+ return pAttr;
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_0b)
+
+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 ) );
+}
+
+// -----------------------------------------------------------------------
+#pragma SEG_FUNCDEF(macitem_0c)
+
+USHORT SvxMacroItem::GetVersion( USHORT nFileFormatVersion ) const
+{
+ return SOFFICE_FILEFORMAT_31 == nFileFormatVersion
+ ? 0 : aMacroTable.GetVersion();
+}
+
+/*------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.15 2000/09/18 14:13:34 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.14 2000/08/31 13:41:28 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.13 2000/04/12 08:01:39 sb
+ Adapted to Unicode.
+
+ Revision 1.12 2000/02/09 16:23:32 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.11 1999/09/01 06:52:36 sb
+ #66082# Added International param to SfxPoolItem::GetPresentation().
+
+ Revision 1.10 1998/07/23 11:54:38 ANK
+ #53261# SvxMacro- Konstruktor geaendert setzt jetzt auch eType
+
+
+ Rev 1.9 23 Jul 1998 13:54:38 ANK
+ #53261# SvxMacro- Konstruktor geaendert setzt jetzt auch eType
+
+ Rev 1.8 08 Jul 1998 16:06:16 MIB
+ Get(JavaScript|StarBasic)String
+
+ Rev 1.7 27 May 1998 19:33:56 ANK
+ neuer Konstruktor fuer SvxMacro
+
+ Rev 1.6 15 May 1998 19:42:42 ANK
+ neue Fkt SvxMacro::GetLanguage
+
+ Rev 1.5 19 Jan 1998 19:18:06 MH
+ chg: header
+
+ Rev 1.4 04 Mar 1997 12:36:00 WP
+ WTC Anpassungen verallgemeinert
+
+ Rev 1.3 05 Feb 1997 14:55:24 AB
+ SvxMacro geaendert
+
+ Rev 1.2 06 Dec 1996 14:39:18 TRI
+ WTC Anpassung
+
+ Rev 1.1 05 Dec 1996 10:28:12 JP
+ GetScripType -> GetScriptType
+
+ Rev 1.0 03 Dec 1996 19:39:56 JP
+ Initial revision.
+
+------------------------------------------------------------------------*/
+
+#pragma SEG_EOFMODULE
+
diff --git a/svtools/source/items/makefile.mk b/svtools/source/items/makefile.mk
new file mode 100644
index 000000000000..19c14890907f
--- /dev/null
+++ b/svtools/source/items/makefile.mk
@@ -0,0 +1,176 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PROJECTPCH=items
+PROJECTPCHSOURCE=items
+
+PRJNAME=SVTOOLS
+TARGET=items
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+# Every source directory generates headers in a own output directory to
+# enable parallel building of the source directories within a project!
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+UNOTYPES=\
+ com.sun.star.awt.Point \
+ com.sun.star.awt.Rectangle \
+ com.sun.star.awt.Size \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.beans.PropertyState \
+ com.sun.star.beans.XPropertySetInfo \
+ com.sun.star.chaos.ContentType \
+ com.sun.star.chaos.MenuDescriptor \
+ com.sun.star.chaos.MenuItemDescriptor \
+ com.sun.star.chaos.WallPaper \
+ com.sun.star.container.XNameAccess \
+ com.sun.star.container.XNameContainer \
+ com.sun.star.io.XActiveDataControl \
+ com.sun.star.io.XActiveDataSource \
+ com.sun.star.io.XOutputStream \
+ com.sun.star.lang.IllegalArgumentException \
+ com.sun.star.lang.XMultiServiceFactory\
+ com.sun.star.lang.XTypeProvider\
+ com.sun.star.lang.XServiceInfo\
+ com.sun.star.lang.XUnoTunnel\
+ com.sun.star.ucb.TransferResult \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.XWeak \
+ com.sun.star.util.DateTime \
+ com.sun.star.util.DateTimeRange
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+LIB2TARGET=$(SLB)$/items1.lib
+LIB2OBJFILES=\
+ $(SLO)$/bintitem.obj \
+ $(SLO)$/cenumitm.obj \
+ $(SLO)$/cintitem.obj \
+ $(SLO)$/cntcmpmn.obj \
+ $(SLO)$/cntwall.obj \
+ $(SLO)$/cstitem.obj \
+ $(SLO)$/ctypeitm.obj \
+ $(SLO)$/custritm.obj \
+ $(SLO)$/dateitem.obj \
+ $(SLO)$/dtritem.obj \
+ $(SLO)$/frqitem.obj \
+ $(SLO)$/itemiter.obj \
+ $(SLO)$/itempool.obj \
+ $(SLO)$/itemprop.obj \
+ $(SLO)$/itemset.obj \
+ $(SLO)$/lckbitem.obj \
+ $(SLO)$/poolio.obj \
+ $(SLO)$/poolitem.obj \
+ $(SLO)$/sfontitm.obj \
+ $(SLO)$/sitem.obj \
+ $(SLO)$/slstitm.obj \
+ $(SLO)$/tfrmitem.obj \
+ $(SLO)$/tresitem.obj \
+ $(SLO)$/whiter.obj
+
+LIB3TARGET=$(SLB)$/items2.lib
+LIB3OBJFILES=\
+ $(SLO)$/aeitem.obj \
+ $(SLO)$/args.obj \
+ $(SLO)$/compat.obj \
+ $(SLO)$/eitem.obj \
+ $(SLO)$/flagitem.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
+
+SLOFILES=\
+ $(LIB2OBJFILES) \
+ $(LIB3OBJFILES)
+
+.ENDIF
+
+SRCFILES=\
+ cstitem.src
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/items/poolcach.cxx b/svtools/source/items/poolcach.cxx
new file mode 100644
index 000000000000..d50edbf56614
--- /dev/null
+++ b/svtools/source/items/poolcach.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * $RCSfile: poolcach.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <limits.h>
+
+#pragma hdrstop
+
+#include "itempool.hxx"
+#include "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),
+ pItemToPut( &pItemPool->Put(*pPutItem) ),
+ pSetToPut( 0 )
+{
+ DBG_CTOR(SfxItemPoolCache, 0);
+ DBG_ASSERT(pItemPool, "kein Pool angegeben");
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
+ const SfxItemSet *pPutSet ):
+ pPool(pItemPool),
+ pCache(new SfxItemModifyArr_Impl),
+ pItemToPut( 0 ),
+ pSetToPut( pPutSet )
+{
+ 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
new file mode 100644
index 000000000000..158ac4b6954a
--- /dev/null
+++ b/svtools/source/items/ptitem.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * $RCSfile: ptitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_POINT_HPP_
+#include <com/sun/star/awt/Point.hpp>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#include "sbx.hxx"
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "ptitem.hxx"
+#include "memberid.hrc"
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxPointItem);
+
+
+// -----------------------------------------------------------------------
+
+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 International *
+) 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 nVersion ) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ Point aStr;
+ rStream >> aStr;
+ return new SfxPointItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxPointItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ DBG_CHKTHIS(SfxPointItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxPointItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ rVal <<= com::sun::star::awt::Point( aVal.getX(), aVal.getY() );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxPointItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ BOOL bRet = FALSE;
+ com::sun::star::awt::Point aValue;
+ if ( rVal >>= aValue )
+ {
+ aVal.setX( aValue.X );
+ aVal.setY( aValue.Y );
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/rectitem.cxx b/svtools/source/items/rectitem.cxx
new file mode 100644
index 000000000000..7d143e90ff61
--- /dev/null
+++ b/svtools/source/items/rectitem.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: rectitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_
+#include <com/sun/star/awt/Rectangle.hpp>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#include "sbx.hxx"
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "rectitem.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 International *
+) 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 nVersion ) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ Rectangle aStr;
+ rStream >> aStr;
+ return new SfxRectangleItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxRectangleItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ DBG_CHKTHIS(SfxRectangleItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+
+// -----------------------------------------------------------------------
+BOOL SfxRectangleItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId) const
+{
+ rVal <<= com::sun::star::awt::Rectangle( aVal.getX(),
+ aVal.getY(),
+ aVal.getWidth(),
+ aVal.getHeight() );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxRectangleItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ BOOL bRet = FALSE;
+ com::sun::star::awt::Rectangle aValue;
+ if ( rVal >>= aValue )
+ {
+ aVal.setX( aValue.X );
+ aVal.setY( aValue.Y );
+ aVal.setWidth( aValue.Width );
+ aVal.setHeight( aValue.Height );
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/rngitem.cxx b/svtools/source/items/rngitem.cxx
new file mode 100644
index 000000000000..c59640318186
--- /dev/null
+++ b/svtools/source/items/rngitem.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * $RCSfile: rngitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#pragma hdrstop
+
+#ifndef NUMTYPE
+
+#include "rngitem.hxx"
+#include "sbx.hxx"
+#include "args.hxx"
+
+#if SUPD<355
+DBG_NAME(SfxRangeItem);
+#endif
+
+
+#define NUMTYPE USHORT
+#define SfxXRangeItem SfxRangeItem
+#define SfxXRangesItem SfxUShortRangesItem
+#include "rngitem.cxx"
+
+#define NUMTYPE ULONG
+#define SfxXRangeItem SfxULongRangeItem
+#define SfxXRangesItem SfxULongRangesItem
+#include "rngitem.cxx"
+
+#else
+
+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 nWhich, NUMTYPE from, NUMTYPE to ):
+ SfxPoolItem( nWhich ),
+ 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 International *
+) 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 nVersion ) const
+{
+ NUMTYPE nVon, nBis;
+ rStream >> nVon;
+ rStream >> nBis;
+ return new SfxXRangeItem( Which(), nVon, nBis );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxXRangeItem::Store(SvStream &rStream, USHORT nItemVersion) 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 International * ) const
+{
+ HACK(n. i.)
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//-------------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangesItem::Clone( SfxItemPool *pPool ) const
+{
+ return new SfxXRangesItem( *this );
+}
+
+//-------------------------------------------------------------------------
+
+SfxPoolItem* SfxXRangesItem::Create( SvStream &rStream, USHORT nVersion ) const
+{
+ return new SfxXRangesItem( Which(), rStream );
+}
+
+//-------------------------------------------------------------------------
+
+SvStream& SfxXRangesItem::Store( SvStream &rStream, USHORT nItemVersion ) const
+{
+ NUMTYPE nCount = Count_Impl( _pRanges );
+ rStream >> nCount;
+ for ( NUMTYPE n = 0; _pRanges[n]; ++n )
+ rStream >> _pRanges[n];
+ return rStream;
+}
+
+
+/*------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.24 2000/09/18 14:13:35 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.23 2000/08/31 13:41:28 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.22 2000/05/26 16:38:31 os
+ Set/FillVariable removed
+
+ Revision 1.21 2000/04/12 08:01:39 sb
+ Adapted to Unicode.
+
+ Revision 1.20 2000/02/09 16:23:50 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.19 1999/09/27 12:16:04 hr
+ for-scope
+
+ Revision 1.18 1999/09/08 15:35:16 sb
+ #66082# Copied Count_Impl from nranges.cxx.
+
+ Revision 1.17 1999/09/01 06:52:36 sb
+ #66082# Added International param to SfxPoolItem::GetPresentation().
+
+ Revision 1.16 1998/01/09 11:17:06 MH
+ chg: header
+
+
+ Rev 1.15 09 Jan 1998 12:17:06 MH
+ chg: header
+
+ Rev 1.14 05 Mar 1997 13:44:56 MI
+ falsche Var verwendet daher op== falsch
+
+ Rev 1.13 03 Feb 1997 10:00:14 MI
+ Typeinfo fuer Ranges
+
+ Rev 1.12 03 Feb 1997 09:13:22 MI
+ NUMTYPE durch USHORT ersetzt
+
+ Rev 1.11 02 Feb 1997 16:46:32 MI
+ compilebar
+
+ Rev 1.10 02 Feb 1997 13:29:24 MI
+ jetzt auch Sfx..RangesItem (mehrere Ranges)
+
+ Rev 1.9 02 Feb 1997 12:23:56 MI
+ jetzt auch LongRange
+
+ Rev 1.8 14 Nov 1996 18:49:12 MI
+ FileFirmat 4.0
+
+ Rev 1.7 14 Mar 1996 17:40:46 MH
+ del: S_VERSION
+
+ Rev 1.6 12 Mar 1996 12:49:42 OV
+ ein fehlendes DBG_CTOR eingefuegt
+
+ Rev 1.5 21 Nov 1995 15:50:52 MI
+ FillVariable fuer strukturierte Items
+
+ Rev 1.4 20 Nov 1995 15:44:20 AB
+ Unicode-Anpassung
+
+ Rev 1.3 15 Nov 1995 20:16:36 MI
+ GetVariable/SetVariable
+
+ Rev 1.2 05 Jul 1995 18:11:38 MI
+ GetValueText raus #pragmas rein
+
+ Rev 1.1 29 Jun 1995 17:16:30 MI
+ GetPresentation impl.
+
+ Rev 1.0 22 Feb 1995 16:26:28 OV
+ Initial revision.
+
+------------------------------------------------------------------------*/
+#undef NUMTYPE
+#undef SfxXRangeItem
+#undef SfxXRangesItem
+
+
+#endif
+
diff --git a/svtools/source/items/stritem.cxx b/svtools/source/items/stritem.cxx
new file mode 100644
index 000000000000..0829221cc1db
--- /dev/null
+++ b/svtools/source/items/stritem.cxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * $RCSfile: stritem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SFXSTRITEM_HXX
+#include <stritem.hxx>
+#endif
+
+//============================================================================
+//
+// class SfxStringItem
+//
+//============================================================================
+
+TYPEINIT1_AUTOFACTORY(SfxStringItem, CntUnencodedStringItem)
+
+//============================================================================
+// virtual
+SfxStringItem::SfxStringItem(USHORT nWhich, SvStream & rStream):
+ CntUnencodedStringItem(nWhich)
+{
+ 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
new file mode 100644
index 000000000000..f62020536731
--- /dev/null
+++ b/svtools/source/items/style.cxx
@@ -0,0 +1,1201 @@
+/*************************************************************************
+ *
+ * $RCSfile: style.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#pragma hdrstop
+
+#include <smplhint.hxx>
+#include <poolitem.hxx>
+#include <itemset.hxx>
+#include <itempool.hxx>
+#include <poolio.hxx>
+#include <filerec.hxx>
+#include <itemiter.hxx>
+#include "style.hxx"
+
+#define STYLESTREAM "SfxStyleSheets"
+#define STYLESTREAM_VERSION USHORT(50)
+
+
+
+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,
+ 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 )
+{}
+
+//=========================================================================
+
+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 )
+ : aName( rName ), aParent(), aFollow( rName ),
+ nFamily( eFam ), nMask(mask), rPool( r ),
+ nHelpId( 0 ), pSet( NULL ), bMySet( FALSE )
+{
+}
+
+SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
+ : aName( r.aName ), aParent( r.aParent ), aFollow( r.aFollow ),
+ nFamily( r.nFamily ),
+ nMask( r.nMask ),
+ rPool( r.rPool ),
+ nHelpId( r.nHelpId ), aHelpFile( r.aHelpFile ), bMySet( r.bMySet )
+{
+ if( r.pSet )
+ pSet = bMySet ? new SfxItemSet( *r.pSet ) : r.pSet;
+ else
+ pSet = NULL;
+}
+
+SfxStyleSheetBase::~SfxStyleSheetBase()
+{
+ 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;
+}
+
+// Parent aendern
+
+const XubString& SfxStyleSheetBase::GetParent() const
+{
+ return aParent;
+}
+
+BOOL SfxStyleSheetBase::SetParent( const XubString& rName )
+{
+ 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()
+{
+#if SUPD >= 368
+ return GetDescription( SFX_MAPUNIT_CM );
+
+/*!!!
+ if ( !pSet )
+ GetItemSet();
+ SfxItemIter aIter( *pSet );
+ XubString aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ XubString aItemPresentation;
+
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ SFX_MAPUNIT_CM, aItemPresentation ) )
+ {
+ if ( aDesc.Len() && aItemPresentation.Len() )
+#ifndef ENABLEUNICODE
+ aDesc += " + ";
+#else
+ aDesc += L" + ";
+#endif
+ if ( aItemPresentation.Len() )
+ aDesc += aItemPresentation;
+ }
+ pItem = aIter.NextItem();
+ }
+ return aDesc;
+*/
+}
+
+// eingestellte Attribute ausgeben
+
+XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric )
+{
+#endif
+ SfxItemIter aIter( GetItemSet() );
+ XubString aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ XubString aItemPresentation;
+
+#if SUPD >= 368
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ eMetric, aItemPresentation ) )
+#else
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ SFX_MAPUNIT_CM, aItemPresentation ) )
+#endif
+ {
+ 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;
+ int nn=SFXSTYLEBIT_USED;
+ int nnn=SFXSTYLEBIT_ALL;
+ 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.Count();
+ else
+ for(USHORT i=0; i<pBasePool->aStyles.Count(); i++)
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(i);
+ if(DoesStyleMatch(pStyle))
+ n++;
+ }
+ return n;
+}
+
+SfxStyleSheetBase* SfxStyleSheetIterator::operator[](USHORT nIdx)
+{
+ if( IsTrivialSearch())
+ return pBasePool->aStyles.GetObject(nIdx);
+
+ USHORT z = 0;
+ for(USHORT n=0; n<pBasePool->aStyles.Count(); n++)
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+ 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.Count() )
+ nIdx = 0;
+ else
+ for( USHORT n = 0; n < pBasePool->aStyles.Count(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+
+ if ( DoesStyleMatch( pStyle ) )
+ {
+ nIdx = n;
+ break;
+ }
+ }
+
+ if ( nIdx != -1 )
+ {
+ nAktPosition = (USHORT)nIdx;
+ return pAktStyle = pBasePool->aStyles.GetObject(nIdx);
+ }
+ return 0;
+}
+
+
+SfxStyleSheetBase* SfxStyleSheetIterator::Next()
+{
+ INT32 nIdx = -1;
+
+ if ( IsTrivialSearch() &&
+ (USHORT)pBasePool->aStyles.Count() > nAktPosition + 1 )
+ nIdx = nAktPosition + 1;
+ else
+ for( USHORT n = nAktPosition + 1; n < pBasePool->aStyles.Count(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+
+ if ( DoesStyleMatch( pStyle ) )
+ {
+ nIdx = n;
+ break;
+ }
+ }
+
+ if ( nIdx != -1 )
+ {
+ nAktPosition = (USHORT)nIdx;
+ return pAktStyle = pBasePool->aStyles.GetObject(nIdx);
+ }
+ return 0;
+}
+
+
+SfxStyleSheetBase* SfxStyleSheetIterator::Find(const XubString& rStr)
+{
+ for ( USHORT n = 0; n < pBasePool->aStyles.Count(); n++ )
+ {
+ SfxStyleSheetBase* pStyle = pBasePool->aStyles.GetObject(n);
+
+ if ( DoesStyleMatch( pStyle ) &&
+ pStyle->GetName().Equals( rStr ) )
+ {
+ 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;
+#if SUPD > 363
+ rpIter = CreateIterator( nSearchFamily, nMask );
+#else
+ rpIter = new SfxStyleSheetIterator( this, nSearchFamily, nMask );
+#endif
+ }
+ return *rpIter;
+}
+
+
+SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r )
+: rPool(r), aAppName(r.GetName()),
+ nMask(0xFFFF), nSearchFamily(SFX_STYLE_FAMILY_PARA)
+{
+ pImp = new SfxStyleSheetBasePool_Impl;
+}
+
+SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r )
+: rPool(r.rPool),
+ nMask( r.nMask ), nSearchFamily(r.nSearchFamily),aAppName(r.aAppName)
+{
+ pImp = new SfxStyleSheetBasePool_Impl;
+ *this += r;
+}
+
+SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
+{
+ 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 ////////////////////////////////
+
+
+#if SUPD > 363
+
+SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator
+(
+ SfxStyleFamily eFam,
+ USHORT mask
+)
+{
+ return new SfxStyleSheetIterator(this,eFam,mask);
+}
+
+#endif
+
+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, "FamilyAll als Familie nicht erlaubt" );
+
+ SfxStyleSheetIterator aIter(this, eFam, mask);
+ SfxStyleSheetBase* p = aIter.Find( rName );
+ DBG_ASSERT( !p, "StyleSheet bereits vorhanden" );
+ SfxStyleSheetIterator& rIter = GetIterator_Impl();
+
+ if( !p )
+ {
+ p = Create( rName, eFam, mask );
+ if(0xffff == nPos || nPos == aStyles.Count() ||
+ nPos == rIter.Count())
+ aStyles.Insert( p, aStyles.Count() );
+ else
+ {
+ rIter[nPos];
+ aStyles.Insert(p, rIter.GetPos());
+ }
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) );
+ }
+ return *p;
+}
+
+/////////////////////////////// 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() );
+ Erase( pOld );
+ SfxStyleSheetBase* pNew = Create( rSheet );
+ aStyles.Insert( pNew, aStyles.Count() );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *pNew ) );
+ return *pNew;
+}
+
+SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator=( const SfxStyleSheetBasePool& r )
+{
+ if( &r != this )
+ {
+ Clear();
+ *this += r;
+ }
+ return *this;
+}
+
+SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBasePool& rP )
+{
+ if( &rP != this )
+ {
+ // kopieren
+ SfxStyleSheetBasePool& r = (SfxStyleSheetBasePool&) rP;
+ for( SfxStyleSheetBase* p = r.aStyles.First(); p; p = r.aStyles.Next() )
+ Add(*p);
+
+ }
+ 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);
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::First()
+{
+ return GetIterator_Impl().First();
+}
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Next()
+{
+ return GetIterator_Impl().Next();
+}
+
+//////////////////////////////// Loeschen /////////////////////////////////
+
+SfxStyleSheetBase* SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
+{
+ if( p )
+ {
+ // Alle Styles umsetzen, deren Parent dieser hier ist
+ ChangeParent( p->GetName(), p->GetParent() );
+ aStyles.Remove( p );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
+ }
+ return p;
+}
+
+void SfxStyleSheetBasePool::Erase( SfxStyleSheetBase* p )
+{
+ if( p )
+ {
+ Remove(p);
+ delete p;
+ }
+}
+
+void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p )
+{
+ DBG_ASSERT( p, "Kein StyleSheet?" );
+ SfxStyleSheetIterator aIter(
+ this, p->GetFamily(), p->GetMask());
+ SfxStyleSheetBase* pOld = aIter.Find( p->GetName() );
+ DBG_ASSERT( !pOld, "StyleSheet bereits vorhanden" );
+ if( p->GetParent().Len() )
+ {
+ pOld = aIter.Find( p->GetParent() );
+ DBG_ASSERT( pOld, "Parent nicht mehr vorhanden" );
+ }
+ aStyles.Insert( p, aStyles.Count() );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) );
+}
+
+void SfxStyleSheetBasePool::Clear()
+{
+ while( aStyles.Count() )
+ {
+ SfxStyleSheetBase* p = aStyles.First();
+ aStyles.Remove( p );
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
+ delete p;
+ }
+}
+
+/////////////////////////// Parents umsetzen ////////////////////////////////
+
+void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld,
+ const XubString& rNew,
+ BOOL bVirtual)
+{
+ const ULONG nPos = aStyles.GetCurPos();
+ 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);
+ aStyles.Seek(nPos);
+}
+
+/////////////////////////// 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;
+ 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;
+
+ USHORT nCount;
+ for ( nCount = 0; aStylesRec.GetContent(); nCount++ )
+ {
+ // kann nicht mehr weiterlesen?
+ if ( rStream.GetError() )
+ break;
+
+ // Globale Teile
+ XubString aName, aParent, aFollow;
+ String aHelpFile;
+ USHORT nFamily, nMask,nCount;
+ ULONG nHelpId;
+ rStream.ReadByteString(aName, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aParent, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aFollow, rtl_TextEncoding(nCharSet));
+ rStream >> nFamily >> nMask;
+ SfxPoolItem::readByteString(rStream, aHelpFile);
+ rStream >> nHelpId;
+
+#ifndef ENABLEUNICODE
+ // bei Unicode keine Konvertierung erforderlich
+ aName.Convert( (CharSet) nCharSet );
+ aParent.Convert( (CharSet) nCharSet );
+ aFollow.Convert( (CharSet) nCharSet );
+
+ // #72939# When loading from a different CharSet, several style
+ // names may have been converted to the same string, so the styles
+ // can't be inserted. If a style with this name already exists,
+ // generate an internal name so the information from the styles
+ // isn't lost.
+ if ( nCharSet != ::GetSystemCharSet() &&
+ Find( aName, (SfxStyleFamily)nFamily ) != NULL )
+ {
+ DBG_WARNING("style has to be renamed");
+ USHORT nMax = aStyles.Count() + 1;
+ for ( USHORT nAdd=1; nAdd<=nMax; nAdd++ )
+ {
+ aName = '_';
+ aName += nAdd;
+ if ( Find( aName, (SfxStyleFamily)nFamily ) == NULL )
+ break;
+ }
+ }
+#endif
+ SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nMask);
+ 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
+ nCount = aStyles.Count();
+
+ //! 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 ( USHORT i = 0; i < nCount; i++ )
+ {
+ SfxStyleSheetBase* p = aStyles.GetObject( i );
+ XubString aText = p->aParent;
+ p->aParent.Erase();
+ p->SetParent( aText );
+ aText = p->aFollow;
+ p->aFollow.Erase();
+ p->SetFollow( aText );
+ }
+ }
+
+ // 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;
+
+ USHORT nCount;
+ rStream >> nCount;
+ USHORT i;
+ for ( i = 0; i < nCount; i++ )
+ {
+ // kann nicht mehr weiterlesen?
+ if ( rStream.GetError() )
+ {
+ nCount = i;
+ break;
+ }
+
+ // Globale Teile
+ XubString aName, aParent, aFollow;
+ String aHelpFile;
+ USHORT nFamily, nMask,nCount;
+ ULONG nHelpId;
+ rStream.ReadByteString(aName, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aParent, rtl_TextEncoding(nCharSet));
+ rStream.ReadByteString(aFollow, rtl_TextEncoding(nCharSet));
+ rStream >> nFamily >> nMask;
+ SfxPoolItem::readByteString(rStream, aHelpFile);
+ if(nVersion!=STYLESTREAM_VERSION)
+ {
+ USHORT nTmpHelpId;
+ rStream >> nTmpHelpId;
+ nHelpId=nTmpHelpId;
+ }
+ else
+ rStream >> nHelpId;
+
+#ifndef ENABLEUNICODE
+ // bei Unicode keine Konvertierung erforderlich
+ aName.Convert( (CharSet) nCharSet );
+ aParent.Convert( (CharSet) nCharSet );
+ aFollow.Convert( (CharSet) nCharSet );
+#endif
+ SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nMask);
+ 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 < nCount; i++ )
+ {
+ SfxStyleSheetBase* p = aStyles.GetObject( i );
+ XubString aText = p->aParent;
+ p->aParent.Erase();
+ p->SetParent( aText );
+ aText = p->aFollow;
+ p->aFollow.Erase();
+ p->SetFollow( aText );
+ }
+ 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 eCharSet
+ = ::GetStoreCharSet( rStream.GetStreamCharSet() );
+ {
+ SfxSingleRecordWriter aHeaderRec( &rStream,
+ SFX_STYLES_REC_HEADER,
+ STYLESTREAM_VERSION );
+ rStream << (short) eCharSet;
+ }
+
+ // die StyleSheets in einen MultiVarRecord
+ {
+ 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;
+ ULONG nHelpId = p->GetHelpId( aHelpFile );
+ rStream.WriteByteString(p->GetName(), eCharSet);
+ rStream.WriteByteString(p->GetParent(), eCharSet);
+ rStream.WriteByteString(p->GetFollow(), eCharSet);
+ rStream << (USHORT)p->GetFamily() << 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;
+ }
+ }
+ }
+
+ return BOOL( rStream.GetError() == SVSTREAM_OK );
+}
+
+SfxItemPool& SfxStyleSheetBasePool::GetPool()
+{
+ return rPool;
+}
+
+const SfxItemPool& SfxStyleSheetBasePool::GetPool() const
+{
+ return rPool;
+}
+
+/////////////////////// SfxStyleSheet /////////////////////////////////
+
+SfxStyleSheet::SfxStyleSheet(const XubString &rName,
+ SfxStyleSheetBasePool& rPool,
+ SfxStyleFamily eFam,
+ USHORT mask ):
+ SfxStyleSheetBase(rName, rPool, eFam, mask)
+{}
+
+SfxStyleSheet::SfxStyleSheet(const SfxStyleSheet& rStyle) :
+ SfxStyleSheetBase(rStyle)
+{}
+
+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::SFX_NOTIFY(SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType )
+{
+ SFX_FORWARD(rBC, rBCType, rHint, rHintType);
+}
+
+//////////////////////// SfxStyleSheetPool ///////////////////////////////
+
+SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool& rSet):
+ SfxStyleSheetBasePool(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;
+}
+*/
+
diff --git a/svtools/source/items/szitem.cxx b/svtools/source/items/szitem.cxx
new file mode 100644
index 000000000000..c4c8127fcb68
--- /dev/null
+++ b/svtools/source/items/szitem.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: szitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_
+#include <com/sun/star/awt/Size.hpp>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _GEN_HXX //autogen
+#include <tools/gen.hxx>
+#endif
+
+#include "args.hxx"
+#include "poolitem.hxx"
+#include "szitem.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 International *
+) 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 nVersion ) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ Size aStr;
+ rStream >> aStr;
+ return new SfxSizeItem(Which(), aStr);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxSizeItem::Store(SvStream &rStream, USHORT nItemVersion) const
+{
+ DBG_CHKTHIS(SfxSizeItem, 0);
+ rStream << aVal;
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxSizeItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ Size aTmp(aVal);
+ if(CONVERT_TWIPS&nMemberId)
+ {
+ aTmp.Height() = ( aTmp.Height() * 127 + 36) / 72;
+ aTmp.Width() = ( aTmp.Width() * 127 + 36) / 72;
+ }
+ rVal <<= com::sun::star::awt::Size( aTmp.getWidth(), aTmp.getHeight() );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+BOOL SfxSizeItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ BOOL bRet = FALSE;
+ com::sun::star::awt::Size aValue;
+ if ( rVal >>= aValue )
+ {
+ Size aTmp( aValue.Width, aValue.Height );
+ if(CONVERT_TWIPS&nMemberId)
+ {
+ aTmp.Height() = ( aTmp.Height() * 72 + 63) / 127;
+ aTmp.Width() = ( aTmp.Width() * 72 + 63) / 127;
+ }
+ aVal = aTmp;
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+
+
diff --git a/svtools/source/items/wallitem.cxx b/svtools/source/items/wallitem.cxx
new file mode 100644
index 000000000000..d45e9748e950
--- /dev/null
+++ b/svtools/source/items/wallitem.cxx
@@ -0,0 +1,694 @@
+/*************************************************************************
+ *
+ * $RCSfile: wallitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HPP_
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CHAOS_WALLPAPER_HPP_
+#include <com/sun/star/chaos/WallPaper.hpp>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <tools/string.hxx>
+
+#ifndef _URLOBJ_HXX //autogen wg. INetURLObject
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _STREAM_HXX //autogen wg. SvMemoryStream
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+
+#include <vcl/graph.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#ifndef _SV_GRADIENT_HXX
+#include <vcl/gradient.hxx>
+#endif
+#ifndef _SV_CVTGRF_HXX //autogen wg. GraphicConverter
+#include <vcl/cvtgrf.hxx>
+#endif
+
+#include "wallitem.hxx"
+#include "cntwall.hxx"
+
+#define WALLITEMFLAG_ERROR 0x0001
+#define WALLITEMFLAG_DITHERED 0x0002
+
+
+DBG_NAME( SfxWallpaperItem );
+TYPEINIT1( SfxWallpaperItem, SfxPoolItem );
+
+// -----------------------------------------------------------------------
+
+class WallpaperSink_Impl: public cppu::OWeakObject,
+ public com::sun::star::io::XOutputStream
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource > _aSource;
+ SvMemoryStream *_pStream;
+ WallpaperLoader *_pWallpaper;
+
+public:
+
+ WallpaperSink_Impl();
+ virtual ~WallpaperSink_Impl();
+
+ void RequestData( WallpaperLoader *pWallpaper, const String& rURL );
+ void Release();
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type& aType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ acquire()
+ throw(::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ release()
+ throw(::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 );
+};
+
+// -----------------------------------------------------------------------
+
+//static
+void SfxBrushItemLink::Set( SfxBrushItemLink* pLink )
+{
+ SfxBrushItemLink** ppLink = (SfxBrushItemLink**)GetAppData(SHL_BRUSHITEM);
+ if( !*ppLink )
+ *ppLink = pLink;
+ else
+ delete pLink;
+}
+
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::SfxWallpaperItem( USHORT nWhich ) :
+ SfxPoolItem( nWhich ), _nFlags(0)
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+}
+
+SfxWallpaperItem::SfxWallpaperItem( USHORT nWhich, SvStream& rStream, USHORT nVersion )
+ : SfxPoolItem( nWhich )
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+ _nFlags = 0;
+ rStream >> _aWallpaper;
+ readByteString(rStream, _aURL);
+ readByteString(rStream, _aFilter);
+}
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::SfxWallpaperItem( const SfxWallpaperItem& rItem ) :
+ SfxPoolItem( rItem ),
+ _aWallpaper( rItem._aWallpaper ),
+ _aURL( rItem._aURL ),
+ _nFlags( rItem._nFlags )
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::SfxWallpaperItem( USHORT nWhich, const Wallpaper& rPaper ) :
+ SfxPoolItem( nWhich ), _nFlags(0), _aWallpaper( rPaper )
+{
+ DBG_CTOR( SfxWallpaperItem, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+SfxWallpaperItem::~SfxWallpaperItem()
+{
+ DBG_DTOR(SfxWallpaperItem, 0);
+}
+
+// -----------------------------------------------------------------------
+
+int SfxWallpaperItem::operator==( const SfxPoolItem& rItem ) const
+{
+ DBG_CHKTHIS( SfxWallpaperItem, 0 );
+ DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
+ const SfxWallpaperItem& rWallItem = (const SfxWallpaperItem&)rItem;
+ if( rWallItem._aURL != _aURL )
+ return 0;
+ if( !_aURL.Len() )
+ {
+ if( rWallItem._aWallpaper == _aWallpaper )
+ return TRUE;
+ return 0;
+ }
+ else
+ {
+ // Wenn eine URL gesetzt ist, sind die Items auch dann gleich, wenn
+ // das eine Item bereits die Bitmap geladen hat und das andere nicht.
+ // Deshalb kann der Wallpaper-Vergleichsoperator nicht benutzt werden.
+ if( rWallItem._aWallpaper.GetColor() != _aWallpaper.GetColor() )
+ return 0;
+ if( rWallItem._aWallpaper.GetStyle() != _aWallpaper.GetStyle() )
+ return 0;
+ if( rWallItem._aWallpaper.GetGradient() != _aWallpaper.GetGradient() )
+ return 0;
+ if( rWallItem._aWallpaper.GetRect() != _aWallpaper.GetRect() )
+ return 0;
+ }
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxWallpaperItem::Create( SvStream& rStream, USHORT nVersion) const
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ return new SfxWallpaperItem( Which(), rStream, nVersion );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SfxWallpaperItem::Store( SvStream& rStream, USHORT ) const
+{
+ DBG_CHKTHIS( SfxWallpaperItem, 0 );
+ BitmapEx aBmpTemp;
+ if( _aURL.Len() )
+ {
+ // Bei gesetzter URL die Grafik als Link speichern, und deshalb
+ // temporaer in der Wallpaper zuruecksetzen.
+ aBmpTemp = _aWallpaper.GetBitmap();
+ ((SfxWallpaperItem*)this)->_aWallpaper.SetBitmap();
+ }
+ rStream << _aWallpaper;
+ writeByteString(rStream, _aURL);
+ writeByteString(rStream, _aFilter);
+ if( _aURL.Len() )
+ ((SfxWallpaperItem*)this)->_aWallpaper.SetBitmap( aBmpTemp );
+ return rStream;
+}
+
+// -----------------------------------------------------------------------
+
+SfxPoolItem* SfxWallpaperItem::Clone( SfxItemPool* ) const
+{
+ DBG_CHKTHIS( SfxWallpaperItem, 0 );
+ return new SfxWallpaperItem( *this );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxWallpaperItem::QueryValue( com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ com::sun::star::chaos::WallPaper aVal;
+
+ aVal.Style = (com::sun::star::chaos::WallpaperStyle)_aWallpaper.GetStyle();
+ aVal.Color = (sal_Int32) _aWallpaper.GetColor().GetColor();
+ aVal.ImageURL = GetBitmapURL();
+ rVal <<= aVal;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SfxWallpaperItem::PutValue( const com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ com::sun::star::chaos::WallPaper aVal;
+ if ( rVal >>= aVal )
+ {
+ if ( aVal.ImageURL.getLength() )
+ SetBitmapURL( aVal.ImageURL, GetBitmapFilter() );
+
+ SetColor( aVal.Color );
+ SetStyle( (WallpaperStyle)aVal.Style );
+
+ return TRUE;
+ }
+
+ DBG_ERROR( "SfxWallpaperItem::PutValue - Wrong type!" );
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SfxWallpaperItem::SetBitmapURL( const XubString& rURL, const String& rFilter )
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ if( rURL != _aURL || rFilter != _aFilter )
+ {
+ _aURL = rURL;
+ _aFilter = rFilter;
+ _nFlags = 0;
+ _aWallpaper.SetBitmap();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const Wallpaper& SfxWallpaperItem::GetWallpaper( BOOL bNeedsBitmap ) const
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ if( bNeedsBitmap && !IsDownloaded() )
+ ((SfxWallpaperItem*)this)->Download();
+ if( !(_nFlags & WALLITEMFLAG_DITHERED ))
+ {
+ if( _aWallpaper.IsBitmap())
+ {
+ BitmapEx aBmp( _aWallpaper.GetBitmap() );
+ OutputDevice* pOutDev = Application::GetDefaultDevice();
+
+ if ( pOutDev->GetBitCount() <= 8 && aBmp.GetBitmap().GetBitCount() >= 8 )
+ {
+ aBmp.Dither( BMP_DITHER_MATRIX );
+ aBmp = BitmapEx( aBmp.GetBitmap().CreateDisplayBitmap( pOutDev ), aBmp.GetMask() );
+ ( (SfxWallpaperItem*)this )->_aWallpaper.SetBitmap( aBmp );
+ }
+ }
+ ( (SfxWallpaperItem*)this )->_nFlags |= WALLITEMFLAG_DITHERED;
+ }
+ return _aWallpaper;
+}
+
+void SfxWallpaperItem::SetGraphic( const Graphic& rGraphic, BOOL bKeepLink )
+{
+ DBG_CHKTHIS(SfxWallpaperItem, 0);
+ BitmapEx aBmp( rGraphic.GetBitmapEx() );
+ _aWallpaper.SetBitmap( aBmp );
+ if( !bKeepLink )
+ {
+ _aURL.Erase();
+ _aFilter.Erase();
+ }
+ _nFlags &= ~( WALLITEMFLAG_ERROR | WALLITEMFLAG_DITHERED );
+}
+
+BOOL SfxWallpaperItem::IsDownloaded() const
+{
+ if( _nFlags & WALLITEMFLAG_ERROR )
+ return TRUE; // Endlos-Downloads verhindern
+ return !_aURL.Len() || _aWallpaper.IsBitmap();
+}
+
+void SfxWallpaperItem::Download()
+{
+ if( _aURL.Len() )
+ {
+ SfxBrushItemLink* pLink = SfxBrushItemLink::Get();
+ if( pLink )
+ {
+ Graphic aGraphic( pLink->GetGraphic( _aURL, _aFilter ) );
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ BitmapEx aBmp( aGraphic.GetBitmapEx() );
+ _aWallpaper.SetBitmap( aBmp );
+ _nFlags &= ~WALLITEMFLAG_ERROR;
+ }
+ else
+ _nFlags |= WALLITEMFLAG_ERROR;
+ }
+ }
+ _nFlags &= ~WALLITEMFLAG_DITHERED;
+}
+
+//============================================================================
+class WallpaperLoader_Impl
+{
+public:
+
+ Link _aDoneLink;
+ SfxWallpaperItem _aWallpaper;
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > _xOutputStream;
+ WallpaperSink_Impl* _pWallpaperSink;
+ BOOL _bDone;
+
+ WallpaperLoader_Impl( const SfxWallpaperItem& rItem );
+};
+
+WallpaperLoader_Impl::WallpaperLoader_Impl( const SfxWallpaperItem& rWallpaper )
+ : _aWallpaper( rWallpaper )
+{
+ _pWallpaperSink = NULL;
+ _bDone = FALSE;
+}
+
+WallpaperLoader::WallpaperLoader( const CntWallpaperItem& rWallpaper )
+{
+ SfxWallpaperItem aSfxWallpaper( rWallpaper.Which() );
+
+ aSfxWallpaper.SetBitmapURL( rWallpaper.GetBitmapURL(), String() );
+ aSfxWallpaper.SetColor( rWallpaper.GetColor() );
+ aSfxWallpaper.SetStyle( (WallpaperStyle) rWallpaper.GetStyle() );
+
+ pImp = new WallpaperLoader_Impl( aSfxWallpaper );
+}
+
+WallpaperLoader::~WallpaperLoader()
+{
+ if ( !pImp->_bDone && pImp->_pWallpaperSink )
+ {
+ pImp->_pWallpaperSink->Release();
+ pImp->_pWallpaperSink = NULL;
+ }
+ delete pImp;
+}
+
+void WallpaperLoader::RequestData( const Link& rDoneLink )
+{
+ WallpaperLoaderRef aRef( this );
+
+ pImp->_aDoneLink = rDoneLink;
+
+ if ( pImp->_aWallpaper.GetBitmapURL().Len() )
+ {
+ WallpaperSink_Impl *pStream = new WallpaperSink_Impl();
+ pImp->_xOutputStream = pStream;
+ pImp->_pWallpaperSink = pStream;
+ pStream->RequestData( this, pImp->_aWallpaper.GetBitmapURL() );
+ }
+ else
+ Done();
+}
+
+const Wallpaper& WallpaperLoader::GetWallpaper() const
+{
+ return pImp->_aWallpaper.GetWallpaper();
+}
+
+void WallpaperLoader::Done()
+{
+ WallpaperLoaderRef aRef( this );
+
+ pImp->_bDone = TRUE;
+
+ if ( pImp->_aDoneLink.IsSet() )
+ pImp->_aDoneLink.Call( this );
+}
+
+void WallpaperLoader::SetBitmap( SvStream *pStream )
+{
+ WallpaperLoaderRef aRef( this );
+
+ if( pStream && ! pStream->GetError() )
+ {
+ pStream->Seek( STREAM_SEEK_TO_BEGIN );
+ Graphic aGraphic;
+ GraphicConverter::Import( *pStream, aGraphic );
+
+ if( aGraphic.GetType() != GRAPHIC_NONE )
+ {
+ pImp->_aWallpaper.SetGraphic( aGraphic, TRUE );
+ }
+ }
+
+ Done();
+}
+
+
+//============================================================================
+
+WallpaperSink_Impl::WallpaperSink_Impl()
+{
+ _pStream = NULL;
+ _pWallpaper = NULL;
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+WallpaperSink_Impl::~WallpaperSink_Impl()
+{
+ delete _pStream;
+}
+
+//--------------------------------------------------------------------------------------------------
+void WallpaperSink_Impl::RequestData( WallpaperLoader *pWallpaper,
+ const String& rURL )
+{
+ _pWallpaper = pWallpaper;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > xMgr(
+ utl::getProcessServiceFactory() );
+ if ( !xMgr.is() )
+ return;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > xFact(
+ xMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.frame.DataSourceFactory" ) ),
+ com::sun::star::uno::UNO_QUERY );
+ if ( xFact.is() )
+ {
+ INetURLObject aURL( rURL );
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArgs( 1 );
+ aArgs.getArray()[ 0 ] <<= rtl::OUString( aURL.GetMainURL() );
+
+ String aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
+ _aSource = com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource >(
+ xFact->createInstanceWithArguments(
+ aProt, aArgs ),
+ com::sun::star::uno::UNO_QUERY );
+ if ( _aSource.is() )
+ {
+ _aSource->setOutputStream( this );
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataControl > aControl(
+ _aSource, com::sun::star::uno::UNO_QUERY );
+ if ( aControl.is() )
+ aControl->start();
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+void WallpaperSink_Impl::Release()
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > aRef( this );
+
+ _pWallpaper = NULL;
+
+ if ( _aSource.is() )
+ {
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataControl > aControl(
+ _aSource, com::sun::star::uno::UNO_QUERY );
+ if ( aControl.is() )
+ aControl->terminate();
+
+ _aSource = com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource >();
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+com::sun::star::uno::Any SAL_CALL WallpaperSink_Impl::
+ queryInterface( const com::sun::star::uno::Type& aType )
+ throw( com::sun::star::uno::RuntimeException )
+{
+ com::sun::star::uno::Any aRet
+ = cppu::queryInterface( aType,
+ static_cast< com::sun::star::io::XOutputStream * >( this ) );
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( aType );
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::acquire()
+ throw(::com::sun::star::uno::RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::release()
+ throw(::com::sun::star::uno::RuntimeException )
+{
+ OWeakObject::release();
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::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 )
+{
+ if ( !_pStream )
+ _pStream = new SvMemoryStream( aData.getLength(), 4096 );
+
+ _pStream->Seek( STREAM_SEEK_TO_END );
+ _pStream->Write( aData.getConstArray(), aData.getLength() );
+}
+
+//--------------------------------------------------------------------------------------------------
+// virtual
+void SAL_CALL WallpaperSink_Impl::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 WallpaperSink_Impl::closeOutput()
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+ if ( _pWallpaper )
+ _pWallpaper->SetBitmap( _pStream );
+
+ _aSource = com::sun::star::uno::Reference<
+ com::sun::star::io::XActiveDataSource >();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/*
+ $Log: not supported by cvs2svn $
+ Revision 1.23 2000/09/18 14:13:36 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.22 2000/08/31 13:41:29 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.21 2000/06/30 11:35:56 pb
+ chg: GetAppWindow() replaced
+
+ Revision 1.20 2000/04/12 08:01:40 sb
+ Adapted to Unicode.
+
+ Revision 1.19 2000/03/22 11:49:38 kso
+ Removed: SmartUno leftovers.
+
+ Revision 1.18 2000/03/21 11:37:55 kso
+ Added: [Put|QueryValue( ... com::sun::star::uno::Any ... )
+
+ Revision 1.17 2000/02/09 16:24:16 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.16 2000/01/28 11:23:43 dv
+ #70466# Changed service name
+
+ Revision 1.15 1999/11/19 17:12:36 sb
+ Module structure transposition.
+
+ Revision 1.14 1999/10/26 12:46:30 dv
+ Don't use GetGlobalServiceMgr() any longer
+
+ Revision 1.13 1999/08/23 13:30:58 dv
+ The CntWallpaperItem now uses the class Color
+
+ Revision 1.12 1999/08/18 14:14:21 dv
+ added: include cntwall.hxx
+
+ Revision 1.11 1999/08/18 09:12:51 dv
+ #66082# The WallpaperLoader is now constructed with a CntWallpaperItem
+
+*/
+
diff --git a/svtools/source/memtools/makefile.mk b/svtools/source/memtools/makefile.mk
new file mode 100644
index 000000000000..502ab08de680
--- /dev/null
+++ b/svtools/source/memtools/makefile.mk
@@ -0,0 +1,118 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=svarray
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= \
+ svarray.cxx
+
+.IF "$(GUI)"!="DOS"
+CXXFILES+= \
+ hashtab.cxx \
+ hashcont.cxx
+.ENDIF
+
+.IF "$(GUI)"=="WIN" || "$(GUI)"=="DOS"
+OBJFILES= \
+ $(OBJ)$/svarray.obj
+
+.IF "$(GUI)"!="DOS"
+OBJFILES+= \
+ $(OBJ)$/hashtab.obj \
+ $(OBJ)$/hashcont.obj
+.ENDIF
+
+SLOFILES=\
+ $(SLO)$/memempty.obj
+
+.ELSE
+SLOFILES=\
+ $(SLO)$/hashtab.obj \
+ $(SLO)$/hashcont.obj \
+ $(SLO)$/svarray.obj
+
+OBJFILES=\
+ $(OBJ)$/memempty.obj
+
+LIB2TARGET=$(LB)$/ssvmem.lib
+LIB2OBJFILES=\
+ $(OBJ)$/hashtab.obj \
+ $(OBJ)$/hashcont.obj \
+ $(OBJ)$/svarray.obj
+
+.ENDIF #"$(GUI)"=="WIN" || "$(GUI)"=="DOS"
+
+# --- Targets -------------------------------------------------------
+
+
+.INCLUDE : target.mk
diff --git a/svtools/source/memtools/svarray.cxx b/svtools/source/memtools/svarray.cxx
new file mode 100644
index 000000000000..81eeea25cfaa
--- /dev/null
+++ b/svtools/source/memtools/svarray.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * $RCSfile: svarray.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SVARRAY_CXX
+
+#define _SVSTDARR_BOOLS
+#define _SVSTDARR_BYTES
+#define _SVSTDARR_ULONGS
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_LONGS
+#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
+
+#include <svstdarr.hxx>
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+
+#ifdef MAC
+#pragma segment NEVER_PURGE
+#endif
+
+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( 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;
+ if( ! ( bExist = Seek_Entry( aE, &nP ) ) )
+ SvUShorts::Insert( aE, nP );
+ return !bExist;
+}
+
+BOOL SvUShortsSort::Insert( const USHORT aE, USHORT& rP )
+{
+ BOOL bExist;
+ if( ! ( bExist = Seek_Entry( aE, &rP ) ) )
+ 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/config.src b/svtools/source/misc/config.src
new file mode 100644
index 000000000000..fe948229cfe7
--- /dev/null
+++ b/svtools/source/misc/config.src
@@ -0,0 +1,1005 @@
+/*************************************************************************
+ *
+ * $RCSfile: config.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "svtools.hrc"
+
+String STR_WARNING_ITEM
+{
+ TEXT = "Eintrag hat falsche Version!" ;
+ TEXT [ English ] = "Item has wrong version!" ;
+ TEXT [ norwegian ] = "Element har feil versjon!" ;
+ TEXT [ italian ] = "La voce ha una versione errata!" ;
+ TEXT [ portuguese_brazilian ] = "Versão errada do item!" ;
+ TEXT [ portuguese ] = "O registo tem a versão errada!" ;
+ TEXT [ finnish ] = "Kohteen versio on väärä!" ;
+ TEXT [ danish ] = "Elementets version er forkert! " ;
+ TEXT [ french ] = "Version incorrecte !" ;
+ TEXT [ swedish ] = "Post har fel version!" ;
+ TEXT [ dutch ] = "Verkeerde versie van item!" ;
+ TEXT [ spanish ] = "¡La entrada contiene una versión incorrecta!" ;
+ TEXT [ english_us ] = "Incorrect Version!" ;
+ TEXT[ chinese_simplified ] = "ÌõÄ¿°æ±¾ÎÞЧ";
+ TEXT[ russian ] = "Íåïðàâèëüíàÿ âåðñèÿ ýëåìåíòà!";
+ TEXT[ polish ] = "Wersja elementu jest nieprawid³owa!";
+ TEXT[ japanese ] = "“ü—Í€–ڂͳ‚µ‚­‚È‚¢ÊÞ°¼Þ®Ý‚Å‚·!";
+ TEXT[ chinese_traditional ] = "¶µ¥Øª©¥»µL®Ä";
+ TEXT[ arabic ] = "ÇáÅÏÎÇá áå ÅÕÏÇÑ ÎÇØÆ!";
+ TEXT[ dutch ] = "Verkeerde versie van item!";
+ TEXT[ chinese_simplified ] = "ÌõÄ¿°æ±¾ÎÞЧ";
+ TEXT[ greek ] = "Ç åããñáöÞ õðÜñ÷åé óå ëÜèïò Ýêäïóç!";
+ TEXT[ korean ] = "¾ÆÀÌÅÛÀÌ À߸øµÈ ¹öÁ¯À» °¡Áö°í ÀÖ½À´Ï´Ù!";
+ TEXT[ turkish ] = "Giriþin sürümü yanlýþ!";
+ TEXT[ language_user1 ] = " ";
+};
+String STR_KEY_SUB_INI
+{
+ Text = "Untergeordnete Ini-Datei" ;
+ Text [ English ] = "Sub ini file" ;
+ Text [ norwegian ] = "+++Sub ini fil" ;
+ Text [ italian ] = "File ini sub" ;
+ Text [ portuguese_brazilian ] = "Arquivo sub ini" ;
+ Text [ portuguese ] = "Ficheiro sub-ini" ;
+ Text [ finnish ] = "ini.alitiedosto" ;
+ Text [ danish ] = "Underordnet Ini-fil" ;
+ Text [ french ] = "Fichier Sub-ini" ;
+ Text [ swedish ] = "Underordnad Ini-fil" ;
+ Text [ dutch ] = "Sub ini bestand" ;
+ Text [ spanish ] = "Archivo sub ini" ;
+ Text [ english_us ] = "Subordinate Ini File" ;
+ Text[ chinese_simplified ] = "ÏÂÊôµÄ Ini-Îļþ";
+ Text[ russian ] = "Ïîäôàéë Ini";
+ Text[ polish ] = "Plik podrzêdny Ini";
+ Text[ japanese ] = "»ÌÞ Ini ̧²Ù";
+ Text[ chinese_traditional ] = "¤UÄݪºIni-ÀÉ®×";
+ Text[ arabic ] = "ãáÝ Ini ÝÑÚí";
+ Text[ dutch ] = "Sub ini bestand";
+ Text[ chinese_simplified ] = "ÏÂÊôµÄ Ini-Îļþ";
+ Text[ greek ] = "ÕöéóôÜìåíï áñ÷åßï Ini";
+ Text[ korean ] = "¼­ºê Ini ÆÄÀÏ";
+ Text[ turkish ] = "Alt ini dosyasý";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_CONFIG_DIR
+{
+ Text = "Konfiguration" ;
+ Text [ English ] = "Configuration" ;
+ Text [ norwegian ] = "Konfigurasjoner" ;
+ Text [ italian ] = "Configurazione" ;
+ Text [ portuguese_brazilian ] = "Configurações" ;
+ Text [ portuguese ] = "Configuração" ;
+ Text [ finnish ] = "Määritykset" ;
+ Text [ danish ] = "Konfigurationer" ;
+ Text [ french ] = "Configuration" ;
+ Text [ swedish ] = "Konfiguration" ;
+ Text [ dutch ] = "Configuraties" ;
+ Text [ spanish ] = "Configuración" ;
+ Text [ english_us ] = "Configuration" ;
+ Text[ chinese_simplified ] = "ÅäÖÃ";
+ Text[ russian ] = "Êîíôèãóðàöèÿ";
+ Text[ polish ] = "Ustawienia";
+ Text[ japanese ] = "Ý’è";
+ Text[ chinese_traditional ] = "°t¸m";
+ Text[ arabic ] = "Êßæíä";
+ Text[ dutch ] = "Configuraties";
+ Text[ chinese_simplified ] = "ÅäÖÃ";
+ Text[ greek ] = "ÐáñÜìåôñïé";
+ Text[ korean ] = "¼³Á¤";
+ Text[ turkish ] = "Konfigürasyon";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_WORK_PATH
+{
+ Text = "Arbeitsverzeichnis" ;
+ Text [ English ] = "Working path" ;
+ Text [ norwegian ] = "Arbeidsbane" ;
+ Text [ italian ] = "Cartella di lavoro" ;
+ Text [ portuguese_brazilian ] = "Caminho de trabalho" ;
+ Text [ portuguese ] = "Pasta de trabalho" ;
+ Text [ finnish ] = "Työhakemisto" ;
+ Text [ danish ] = "Arbejdsmappe" ;
+ Text [ french ] = "Dossier de travail" ;
+ Text [ swedish ] = "Arbetsmapp" ;
+ Text [ dutch ] = "Werkmap" ;
+ Text [ spanish ] = "Directorio de trabajo" ;
+ Text [ english_us ] = "My Documents" ;
+ Text[ chinese_simplified ] = "¹¤×÷Ŀ¼";
+ Text[ russian ] = "Ðàáî÷àÿ ïàïêà";
+ Text[ polish ] = "Folder roboczy";
+ Text[ japanese ] = "Ü°·Ý¸ÞÃÞ¨Ú¸ÄØ";
+ Text[ chinese_traditional ] = "¤u§@¥Ø¿ý";
+ Text[ arabic ] = "ãÓÊäÏÇÊí";
+ Text[ dutch ] = "Werkmap";
+ Text[ chinese_simplified ] = "¹¤×÷Ŀ¼";
+ Text[ greek ] = "ÊáôÜëïãïò åñãáóßáò";
+ Text[ korean ] = "³» ¹®¼­";
+ Text[ turkish ] = "Çalýþma dizini";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_GRAPHICS_PATH
+{
+ Text = "Grafiken" ;
+ Text [ English ] = "Grafics" ;
+ Text [ norwegian ] = "Grafikk" ;
+ Text [ italian ] = "Immagini" ;
+ Text [ portuguese_brazilian ] = "Gráficos" ;
+ Text [ portuguese ] = "Imagens" ;
+ Text [ finnish ] = "Grafiikka" ;
+ Text [ danish ] = "Billeder" ;
+ Text [ french ] = "Images" ;
+ Text [ swedish ] = "Grafiker" ;
+ Text [ dutch ] = "Afbeeldingen" ;
+ Text [ spanish ] = "Imágenes" ;
+ Text [ english_us ] = "Graphics" ;
+ Text[ chinese_simplified ] = "ͼÐÎ";
+ Text[ russian ] = "Ãðàôèêè";
+ Text[ polish ] = "Grafiki";
+ Text[ japanese ] = "¸Þ×̨¯¸½";
+ Text[ chinese_traditional ] = "¹Ï§Î";
+ Text[ arabic ] = "ÕæÑ";
+ Text[ dutch ] = "Afbeeldingen";
+ Text[ chinese_simplified ] = "ͼÐÎ";
+ Text[ greek ] = "ÃñáöéêÜ";
+ Text[ korean ] = "±×·¡ÇÈ";
+ Text[ turkish ] = "Grafik";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_BITMAP_PATH
+{
+ Text = "Symbole" ;
+ Text [ English ] = "Symbols" ;
+ Text [ english_us ] = "Icons" ;
+ Text [ italian ] = "Simboli" ;
+ Text [ spanish ] = "Símbolos" ;
+ Text [ french ] = "Icônes" ;
+ Text [ dutch ] = "Symbolen" ;
+ Text [ swedish ] = "Symboler" ;
+ Text [ danish ] = "Symboler" ;
+ Text [ portuguese ] = "Símbolos" ;
+ Text [ portuguese_brazilian ] = "Symbole" ;
+ Text[ chinese_simplified ] = "ͼ±ê";
+ Text[ russian ] = "Ñèìâîëû";
+ Text[ polish ] = "Symbole";
+ Text[ japanese ] = "¼ÝÎÞÙ";
+ Text[ chinese_traditional ] = "¹Ï¥Ü";
+ Text[ arabic ] = "ÑãæÒ";
+ Text[ dutch ] = "Symbolen";
+ Text[ chinese_simplified ] = "ͼ±ê";
+ Text[ greek ] = "Óýìâïëá";
+ Text[ korean ] = "±âÈ£";
+ Text[ language_user1 ] = "BLG 18.01.00 : Ds la liste des chemin \"Outils - Options - Chemins\"";
+ Text[ turkish ] = "Simgeler";
+};
+String STR_KEY_BASIC_PATH
+{
+ Text = "BASIC" ;
+};
+String STR_KEY_DATABASE_PATH
+{
+ Text = "Datenbankanfragen" ;
+ Text [ English ] = "Database queries" ;
+ Text [ norwegian ] = "Database" ;
+ Text [ italian ] = "Ricerca database" ;
+ Text [ portuguese_brazilian ] = "Base de Dados" ;
+ Text [ portuguese ] = "Consultas à base de dados" ;
+ Text [ finnish ] = "Tietokanta" ;
+ Text [ danish ] = "Databaseforespørgsler" ;
+ Text [ french ] = "Interrogations de B.D." ;
+ Text [ swedish ] = "Databasfrågor" ;
+ Text [ dutch ] = "Database query's" ;
+ Text [ spanish ] = "Consulta de base de datos" ;
+ Text [ english_us ] = "Database Queries" ;
+ Text[ chinese_simplified ] = "²éѯÊý¾Ý¿â";
+ Text[ russian ] = "Çàïðîñû áàçû äàííûõ";
+ Text[ polish ] = "Kwerendy bazy danych";
+ Text[ japanese ] = "ÃÞ°ÀÍÞ°½ ¸´Ø°";
+ Text[ chinese_traditional ] = "¬d¸ß¸ê®Æ®w";
+ Text[ arabic ] = "ÇÓÊÚáÇãÇÊ ÞÇÚÏÉ ÇáÈíÇäÇÊ";
+ Text[ dutch ] = "Database query's";
+ Text[ chinese_simplified ] = "²éѯÊý¾Ý¿â";
+ Text[ greek ] = "ÅñùôÞìáôá âÜóçò äåäïìÝíùí";
+ Text[ korean ] = "µ¥ÀÌÅͺ£À̽º ÁúÀÇ";
+ Text[ turkish ] = "Veritabaný sorgularý";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_PALETTE_PATH
+{
+ Text = "Paletten" ;
+ Text [ English ] = "Pallets" ;
+ Text [ norwegian ] = "Palletter" ;
+ Text [ italian ] = "Tavolozze" ;
+ Text [ portuguese_brazilian ] = "Paletas" ;
+ Text [ portuguese ] = "Paletas" ;
+ Text [ finnish ] = "Paletit" ;
+ Text [ danish ] = "Paletter" ;
+ Text [ french ] = "Palettes" ;
+ Text [ swedish ] = "Paletter" ;
+ Text [ dutch ] = "Paletten" ;
+ Text [ spanish ] = "Paletas" ;
+ Text [ english_us ] = "Palettes" ;
+ Text[ chinese_simplified ] = "µ÷É«°å";
+ Text[ russian ] = "Ïàëèòðà";
+ Text[ polish ] = "Paleta";
+ Text[ japanese ] = "ÊßÚ¯Ä";
+ Text[ chinese_traditional ] = "¦âªO";
+ Text[ arabic ] = "áæÍÇÊ ÃáæÇä ÑÓã";
+ Text[ dutch ] = "Paletten";
+ Text[ chinese_simplified ] = "µ÷É«°å";
+ Text[ greek ] = "ÐáëÝôåò";
+ Text[ korean ] = "ÆÄ·¹Æ®";
+ Text[ turkish ] = "Paletler";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_BACKUP_PATH
+{
+ Text = "Sicherungskopien" ;
+ Text [ English ] = "Backup" ;
+ Text [ norwegian ] = "Sikkerhetskopi" ;
+ Text [ italian ] = "Backup" ;
+ Text [ portuguese_brazilian ] = "Backup" ;
+ Text [ portuguese ] = "Cópias de segurança" ;
+ Text [ finnish ] = "Varmistus" ;
+ Text [ danish ] = "Sikkerhedskopier" ;
+ Text [ french ] = "Copies de sauvegarde" ;
+ Text [ swedish ] = "Säkerhetskopior" ;
+ Text [ dutch ] = "Reservekopieën" ;
+ Text [ spanish ] = "Copias de seguridad" ;
+ Text [ english_us ] = "Backup Copies" ;
+ Text[ chinese_simplified ] = "°²È«±¸¼þ";
+ Text[ russian ] = "Ðåçåðâíûå êîïèè";
+ Text[ polish ] = "Kopie zapasowe";
+ Text[ japanese ] = "ÊÞ¯¸±¯Ìß ºËß°";
+ Text[ chinese_traditional ] = "¦w¥þ³Æ¥ó";
+ Text[ arabic ] = "äÓÎ ÇÍÊíÇØíÉ";
+ Text[ dutch ] = "Reservekopieën";
+ Text[ chinese_simplified ] = "°²È«±¸¼þ";
+ Text[ greek ] = "Áíôßãñáöá áóöáëåßáò";
+ Text[ korean ] = "¹é¾÷ º¹»ç";
+ Text[ turkish ] = "Yedekleme kopyalarý";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_MODULES_PATH
+{
+ Text = "Module" ;
+ Text [ English ] = "Modules" ;
+ Text [ norwegian ] = "Moduler" ;
+ Text [ italian ] = "Moduli" ;
+ Text [ portuguese_brazilian ] = "Módulos" ;
+ Text [ portuguese ] = "Módulos" ;
+ Text [ finnish ] = "Moduulit" ;
+ Text [ danish ] = "Moduler" ;
+ Text [ french ] = "Modules" ;
+ Text [ swedish ] = "Moduler" ;
+ Text [ dutch ] = "Modules" ;
+ Text [ spanish ] = "Módulos" ;
+ Text [ english_us ] = "Modules" ;
+ Text[ chinese_simplified ] = "Ä£¿é";
+ Text[ russian ] = "Ìîäóëè";
+ Text[ polish ] = "Modu³y";
+ Text[ japanese ] = "Ó¼Þ­°Ù";
+ Text[ chinese_traditional ] = "¼Ò¶ô";
+ Text[ arabic ] = "æÍÏÇÊ äãØíÉ";
+ Text[ dutch ] = "Modules";
+ Text[ chinese_simplified ] = "Ä£¿é";
+ Text[ greek ] = "ËåéôïõñãéêÝò ìïíÜäåò";
+ Text[ korean ] = "¸ðµâ";
+ Text[ turkish ] = "Modüller";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_TEMPLATE_PATH
+{
+ Text = "Dokumentvorlagen" ;
+ Text [ English ] = "Dokument templates" ;
+ Text [ norwegian ] = "Dokumentmaler" ;
+ Text [ italian ] = "Modelli" ;
+ Text [ portuguese_brazilian ] = "Modelos de documento" ;
+ Text [ portuguese ] = "Modelos de documentos" ;
+ Text [ finnish ] = "Asiakirjamallit" ;
+ Text [ danish ] = "Dokumentskabeloner" ;
+ Text [ french ] = "Modèles de document" ;
+ Text [ swedish ] = "Dokumentmallar" ;
+ Text [ dutch ] = "Sjablonen" ;
+ Text [ spanish ] = "Plantilla de documento" ;
+ Text [ english_us ] = "Templates" ;
+ Text[ chinese_simplified ] = "ÎĵµÑùʽ";
+ Text[ russian ] = "Øàáëîíû äîêóìåíòà";
+ Text[ polish ] = "Szablony dokumentu";
+ Text[ japanese ] = "ÄÞ·­ÒÝÄ‚ÌÃÝÌßÚ°Ä";
+ Text[ chinese_traditional ] = "¤å¥ó¼Ë¦¡";
+ Text[ arabic ] = "ÞæÇáÈ ãÓÊäÏ";
+ Text[ dutch ] = "Sjablonen";
+ Text[ chinese_simplified ] = "ÎĵµÑùʽ";
+ Text[ greek ] = "Ðñüôõðá åããñÜöùí";
+ Text[ korean ] = "¹®¼­ ÅÛÇø®Æ®";
+ Text[ turkish ] = "Belge þablonlarý";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_GLOSSARY_PATH
+{
+ Text = "AutoText" ;
+ Text [ English ] = "AutoText";
+ Text[ english_us ] = "AutoText";
+ Text[ portuguese ] = "AutoTexto";
+ Text[ russian ] = "Àâòîòåêñò";
+ Text[ greek ] = "ÁõôïÊåßìåíï";
+ Text[ dutch ] = "AutoTekst";
+ Text[ french ] = "AutoTexte";
+ Text[ spanish ] = "AutoText";
+ Text[ italian ] = "Testo automatico";
+ Text[ danish ] = "AutoTekst";
+ Text[ swedish ] = "AutoText";
+ Text[ polish ] = "Autotekst";
+ Text[ portuguese_brazilian ] = "AutoText";
+ Text[ japanese ] = "“ü—ÍŽx‰‡";
+ Text[ korean ] = "AutoText";
+ Text[ chinese_simplified ] = "×Ô¶¯Í¼Îļ¯";
+ Text[ chinese_traditional ] = "¦Û°Ê¹Ï¤å¶°";
+ Text[ turkish ] = "AutoText";
+ Text[ arabic ] = "äÕ ÊáÞÇÆí";
+};
+String STR_KEY_DICTIONARY_PATH
+{
+ Text = "Wörterbücher" ;
+ Text [ English ] = "Dictionaries" ;
+ Text [ norwegian ] = "Ordlister" ;
+ Text [ italian ] = "Dizionari" ;
+ Text [ portuguese_brazilian ] = "Dicionários" ;
+ Text [ portuguese ] = "Dicionários" ;
+ Text [ french ] = "Dictionnaires" ;
+ Text [ dutch ] = "Woordenboeken" ;
+ Text [ spanish ] = "Diccionarios" ;
+ Text [ danish ] = "Ordbøger" ;
+ Text [ swedish ] = "Ordböcker" ;
+ Text [ finnish ] = "Dictionaries" ;
+ Text [ english_us ] = "Dictionaries" ;
+ Text[ chinese_simplified ] = "×Öµä";
+ Text[ russian ] = "Ñëîâàðè";
+ Text[ polish ] = "S³owniki";
+ Text[ japanese ] = "Ž«‘";
+ Text[ chinese_traditional ] = "¦r¨å";
+ Text[ arabic ] = "ÇáÞæÇãíÓ";
+ Text[ dutch ] = "Woordenboeken";
+ Text[ chinese_simplified ] = "×Öµä";
+ Text[ greek ] = "ËåîéêÜ";
+ Text[ korean ] = "ȍ˟";
+ Text[ turkish ] = "Sözlükler";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_DESKTOP_DIR
+{
+ Text = "Desktop" ;
+ Text [ English ] = "Desktop" ;
+ Text [ dutch ] = "Desktop" ;
+ Text [ english_us ] = "Desktop" ;
+ Text [ italian ] = "Desktop" ;
+ Text [ spanish ] = "Escritorio" ;
+ Text [ french ] = "Desktop" ;
+ Text [ swedish ] = "Desktop" ;
+ Text [ danish ] = "Desktop" ;
+ Text [ portuguese ] = "Desktop" ;
+ Text [ portuguese_brazilian ] = "Desktop" ;
+ Text[ chinese_simplified ] = "×ÀÃæ";
+ Text[ russian ] = "Ðàáî÷èé ñòîë";
+ Text[ polish ] = "Pulpit";
+ Text[ japanese ] = "ÃÞ½¸Ä¯Ìß";
+ Text[ chinese_traditional ] = "®à­±";
+ Text[ arabic ] = "ÓØÍ ÇáãßÊÈ";
+ Text[ dutch ] = "Desktop";
+ Text[ chinese_simplified ] = "×ÀÃæ";
+ Text[ greek ] = "Desktop";
+ Text[ korean ] = "µ¥½ºÅ© ž";
+ Text[ turkish ] = "Masaüstü";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_EXPLORER_DIR
+{
+ Text = "Explorer" ;
+ Text [ English ] = "Explorer" ;
+ Text [ portuguese ] = "Explorer" ;
+ Text [ english_us ] = "Explorer" ;
+ Text [ portuguese_brazilian ] = "Explorer" ;
+ Text [ swedish ] = "Explorer" ;
+ Text [ danish ] = "Explorer" ;
+ Text [ italian ] = "Explorer" ;
+ Text [ spanish ] = "Explorador" ;
+ Text [ french ] = "Explorer" ;
+ Text [ dutch ] = "Explorer" ;
+ Text[ chinese_simplified ] = "×ÊÔ´¹ÜÀíÆ÷";
+ Text[ russian ] = "Ïðîâîäíèê";
+ Text[ polish ] = "Eksplorator";
+ Text[ japanese ] = "´¸½ÌßÛ°×";
+ Text[ chinese_traditional ] = "ÀÉ®×Á`ºÞ";
+ Text[ arabic ] = "ÇáãÓÊßÔÝ";
+ Text[ dutch ] = "Explorer";
+ Text[ chinese_simplified ] = "×ÊÔ´¹ÜÀíÆ÷";
+ Text[ greek ] = "Explorer";
+ Text[ korean ] = "ÀͽºÇ÷¯·Î";
+ Text[ turkish ] = "Explorer";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_HELP_DIR
+{
+ Text = "Hilfedateien" ;
+ Text [ English ] = "Helpfiles" ;
+ Text [ english_us ] = "Help" ;
+ Text [ italian ] = "File della Guida" ;
+ Text [ spanish ] = "Archivos de ayuda" ;
+ Text [ french ] = "Fichiers d'aide" ;
+ Text [ dutch ] = "Help-bestanden" ;
+ Text [ swedish ] = "Hjälpfiler" ;
+ Text [ danish ] = "Hjælp-filer" ;
+ Text [ portuguese ] = "Ficheiros de ajuda" ;
+ Text [ portuguese_brazilian ] = "Hilfedateien" ;
+ Text[ chinese_simplified ] = "ÇóÖúÎļþ";
+ Text[ russian ] = "Ôàéëû ñïðàâêè";
+ Text[ polish ] = "Pliki pomocy";
+ Text[ japanese ] = "ÍÙÌß̧²Ù";
+ Text[ chinese_traditional ] = "»¡©úÀÉ®×";
+ Text[ arabic ] = "ãáÝÇÊ ÇáãÓÇÚÏÉ";
+ Text[ dutch ] = "Help-bestanden";
+ Text[ chinese_simplified ] = "ÇóÖúÎļþ";
+ Text[ greek ] = "Áñ÷åßá âïÞèåéáò";
+ Text[ korean ] = "µµ¿ò¸» ÆÄÀÏ";
+ Text[ turkish ] = "Yardým dosyalarý";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_BOOKMARK_DIR
+{
+ Text = "Bookmarks" ;
+ Text [ English ] = "Bookmarks" ;
+ Text [ dutch ] = "Bookmarks" ;
+ Text [ english_us ] = "Bookmarks" ;
+ Text [ italian ] = "Bookmark" ;
+ Text [ spanish ] = "Marcadores" ;
+ Text [ french ] = "Bookmarks" ;
+ Text [ swedish ] = "Bokmärken" ;
+ Text [ danish ] = "Bogmærker" ;
+ Text [ portuguese ] = "Marcadores" ;
+ Text [ portuguese_brazilian ] = "Bookmarks" ;
+ Text[ chinese_simplified ] = "ÊéÇ©";
+ Text[ russian ] = "Çàêëàäêè";
+ Text[ polish ] = "Zak³adki";
+ Text[ japanese ] = "ÌÞ¯¸Ï°¸";
+ Text[ chinese_traditional ] = "®ÑÅÒ";
+ Text[ arabic ] = "ÅÔÇÑÇÊ ãÑÌÚíÉ";
+ Text[ dutch ] = "Bookmarks";
+ Text[ chinese_simplified ] = "ÊéÇ©";
+ Text[ greek ] = "Óåëéäïäåßêôçò";
+ Text[ korean ] = "Ã¥°¥ÇÇ";
+ Text[ turkish ] = "Yer iþareti";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_GALLERY_DIR
+{
+ Text = "Gallery" ;
+ Text [ English ] = "Gallery" ;
+ Text [ dutch ] = "Gallery" ;
+ Text [ english_us ] = "Gallery" ;
+ Text [ italian ] = "Gallery" ;
+ Text [ spanish ] = "Gallery" ;
+ Text [ french ] = "Gallery" ;
+ Text [ swedish ] = "Gallery" ;
+ Text [ danish ] = "Gallery" ;
+ Text [ portuguese ] = "Gallery" ;
+ Text [ portuguese_brazilian ] = "Gallery" ;
+ Text[ chinese_simplified ] = "»­ÀÈ";
+ Text[ russian ] = "Ãàëåðåÿ";
+ Text[ polish ] = "Galeria";
+ Text[ japanese ] = "·Þ¬×Ø°";
+ Text[ chinese_traditional ] = "µe´Y";
+ Text[ arabic ] = "ÇáÌÇáíÑí";
+ Text[ dutch ] = "Gallery";
+ Text[ chinese_simplified ] = "»­ÀÈ";
+ Text[ greek ] = "Gallery";
+ Text[ korean ] = "°¶·¯¸®";
+ Text[ turkish ] = "Galeri";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_NEW_DIR
+{
+ Text = "Standardvorlagen" ;
+ Text [ English ] = "standard templates" ;
+ Text [ dutch ] = "Standaardsjablonen" ;
+ Text [ english_us ] = "Default Templates" ;
+ Text [ swedish ] = "Standardformatmallar" ;
+ Text [ danish ] = "Standardskabeloner" ;
+ Text [ italian ] = "Modelli standard" ;
+ Text [ spanish ] = "Plantillas predeterminadas" ;
+ Text [ french ] = "Modèles par défaut" ;
+ Text [ portuguese ] = "Modelos-padrão" ;
+ Text [ portuguese_brazilian ] = "Standardvorlagen" ;
+ Text[ chinese_simplified ] = "±ê×¼Ñùʽ";
+ Text[ russian ] = "Ñòàíäàðòíûå øàáëîíû";
+ Text[ polish ] = "Szablony standardowe";
+ Text[ japanese ] = "•W€½À²Ù";
+ Text[ chinese_traditional ] = "¼Ð·Ç¼Ë¦¡";
+ Text[ arabic ] = "ÞæÇáÈ ÞíÇÓíÉ";
+ Text[ dutch ] = "Standaardsjablonen";
+ Text[ chinese_simplified ] = "±ê×¼Ñùʽ";
+ Text[ greek ] = "Ðñüôõðá ðñïåðéëïãÞò";
+ Text[ korean ] = "±âº» ÅÛÇø®Æ®";
+ Text[ turkish ] = "Standart þablonlar";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_AGENT_DIR
+{
+ Text = "Agents" ;
+ Text [ English ] = "Agents" ;
+ Text [ dutch ] = "Agenten" ;
+ Text [ english_us ] = "Agents" ;
+ Text [ swedish ] = "Agenter" ;
+ Text [ danish ] = "Agenter" ;
+ Text [ italian ] = "Agents" ;
+ Text [ spanish ] = "Agentes" ;
+ Text [ french ] = "Agents" ;
+ Text [ portuguese_brazilian ] = "Agents" ;
+ Text [ portuguese ] = "Agentes" ;
+ Text[ chinese_simplified ] = "ÖúÀí";
+ Text[ russian ] = "Àññèñòåíòû";
+ Text[ polish ] = "Agenci";
+ Text[ japanese ] = "´°¼ÞªÝÄ";
+ Text[ chinese_traditional ] = "§U²z";
+ Text[ arabic ] = "ÚãáÇÁ";
+ Text[ dutch ] = "Agenten";
+ Text[ chinese_simplified ] = "ÖúÀí";
+ Text[ greek ] = "ÐñïãñÜììáôá Agent";
+ Text[ korean ] = "¿¡ÀÌÀüÆ®";
+ Text[ turkish ] = "Aracý";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_TRASH_DIR
+{
+ Text = "Papierkorb" ;
+ Text [ English ] = "Trash" ;
+ Text [ English_US ] = "Recycle Bin" ;
+ Text [ portuguese ] = "Reciclagem" ;
+ Text [ portuguese_brazilian ] = "Mülleimer" ;
+ Text [ swedish ] = "Papperskorg" ;
+ Text [ danish ] = "Papirkurv" ;
+ Text [ italian ] = "Cestino" ;
+ Text [ spanish ] = "Papelera" ;
+ Text [ french ] = "Corbeille" ;
+ Text [ dutch ] = "Prullenbak" ;
+ Text[ chinese_simplified ] = "»ØÊÕÕ¾";
+ Text[ russian ] = "Êîðçèíà";
+ Text[ polish ] = "Kosz";
+ Text[ japanese ] = "‚²‚Ý” ";
+ Text[ chinese_traditional ] = "¸ê·½¦^¦¬µ©";
+ Text[ arabic ] = "ÓáÉ ÇáãÍÐæÝÇÊ";
+ Text[ dutch ] = "Prullenbak";
+ Text[ chinese_simplified ] = "»ØÊÕÕ¾";
+ Text[ greek ] = "ÊÜäïò áíáêýêëùóçò";
+ Text[ korean ] = "ÈÞÁöÅë";
+ Text[ turkish ] = "Çöp kutusu";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_STORAGE_DIR
+{
+ Text = "Nachrichtenspeicher" ;
+ Text [ English ] = "Mail Storages" ;
+ Text [ portuguese ] = "Memória de mensagens" ;
+ Text [ english_us ] = "Mail/News Storage" ;
+ Text [ portuguese_brazilian ] = "Nachrichtenspeicher" ;
+ Text [ swedish ] = "Meddelandelager" ;
+ Text [ danish ] = "Meddelelseslager" ;
+ Text [ italian ] = "Memoria messaggi" ;
+ Text [ spanish ] = "Memoria de mensajes" ;
+ Text [ french ] = "Mémoire pour messages" ;
+ Text [ dutch ] = "Geheugen voor berichten" ;
+ Text[ chinese_simplified ] = "µç×ÓÓʼþ/ÐÂÎÅ´¢´æÌå";
+ Text[ russian ] = "Íàêîïèòåëü ñîîáùåíèé";
+ Text[ polish ] = "Pamiêæ wiadomoœci";
+ Text[ japanese ] = "Ò¯¾°¼Þ—pÒÓØ";
+ Text[ chinese_traditional ] = "¹q¤l¶l¥ó/·s»DÀx¦sÅé";
+ Text[ arabic ] = "ÍÝÙ ÇáÃÎÈÇÑ";
+ Text[ dutch ] = "Geheugen voor berichten";
+ Text[ chinese_simplified ] = "µç×ÓÓʼþ/ÐÂÎÅ´¢´æÌå";
+ Text[ greek ] = "ÁðïèÞêåõóç ìçíõìÜôùí";
+ Text[ korean ] = "¿ìÆí/´º½º ÀúÀå¼Ò";
+ Text[ turkish ] = "Ýleti depolama alaný";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_STARTMENU_DIR
+{
+ Text = "Start-Menü" ;
+ Text [ English ] = "Start-Menu" ;
+ Text [ portuguese ] = "Menu de início" ;
+ Text [ english_us ] = "Start Menu" ;
+ Text [ portuguese_brazilian ] = "Start-Menü" ;
+ Text [ swedish ] = "Startmeny" ;
+ Text [ danish ] = "Start-menu" ;
+ Text [ italian ] = "Menu di avvio" ;
+ Text [ spanish ] = "Menú de inicio" ;
+ Text [ french ] = "Menu Démarrer" ;
+ Text [ dutch ] = "Startmenu" ;
+ Text[ chinese_simplified ] = "¿ªÊ¼²Ëµ¥ÃüÁî";
+ Text[ russian ] = "Ìåíþ çàïóñêà";
+ Text[ polish ] = "Menu Start";
+ Text[ japanese ] = "½À°ÄÒÆ­°";
+ Text[ chinese_traditional ] = "¶}©l¥\\¯àªí";
+ Text[ arabic ] = "ÞÇÆãÉ ÇáÈÏÁ";
+ Text[ dutch ] = "Startmenu";
+ Text[ chinese_simplified ] = "¿ªÊ¼²Ëµ¥ÃüÁî";
+ Text[ greek ] = "Ìåíïý åêêßíçóçò";
+ Text[ korean ] = "½ÃÀÛ ¸Þ´º";
+ Text[ turkish ] = "Baþlat mönüsü";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_DOWNLOAD_DIR
+{
+ Text = "Download-Verzeichnis" ;
+ Text [ english_us ] = "Downloads" ;
+ Text [ portuguese ] = "Atalho de descarga" ;
+ Text [ portuguese_brazilian ] = "Download-Verzeichnis" ;
+ Text [ swedish ] = "Nerladdningskatalog" ;
+ Text [ danish ] = "Overførsels-bibliotek" ;
+ Text [ italian ] = "Cartella download" ;
+ Text [ spanish ] = "Ruta de descarga" ;
+ Text [ french ] = "Répertoire de Téléchargement (Download)" ;
+ Text [ dutch ] = "Download-map" ;
+ Text[ chinese_simplified ] = "ÏÂÔØĿ¼";
+ Text[ russian ] = "Êàòàëîã çàãðóçêè";
+ Text[ polish ] = "Katalog pobierania";
+ Text[ japanese ] = "ÀÞ³ÝÛ°ÄÞ ÃÞ¨Ú¸ÄØ";
+ Text[ chinese_traditional ] = "¤U¸ü¥Ø¿ý";
+ Text[ arabic ] = "ãÓÇÑÇáÊäÒíá";
+ Text[ dutch ] = "Download-map";
+ Text[ chinese_simplified ] = "ÏÂÔØĿ¼";
+ Text[ greek ] = "ÊáôÜëïãïò ëÞøçò áñ÷åßùí";
+ Text[ korean ] = "´Ù¿î·Îµå °æ·Î";
+ Text[ turkish ] = "Ýndirme dizini";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_AUTOSTART_DIR
+{
+ Text = "Autostart-Verzeichnis" ;
+ Text [ english ] = "Autostart path" ;
+ Text [ english_us ] = "AutoStart" ;
+ Text [ portuguese ] = "Directório Autostart" ;
+ Text [ portuguese_brazilian ] = "Autostart-Verzeichnis" ;
+ Text [ swedish ] = "Autostart-katalog" ;
+ Text [ danish ] = "Autostart-bibliotek" ;
+ Text [ italian ] = "Cartella autostart" ;
+ Text [ spanish ] = "Directorio Inicio" ;
+ Text [ french ] = "Répertoire Autostart" ;
+ Text [ dutch ] = "Autostart-map" ;
+ Text[ chinese_simplified ] = "×Ô¶¯Æô¶¯Ä¿Â¼";
+ Text[ russian ] = "Ïàïêà Àâòîçàïóñêà";
+ Text[ polish ] = "Katalog Autostartu";
+ Text[ japanese ] = "µ°Ä½À°Ä ÃÞ¨Ú¸ÄØ";
+ Text[ chinese_traditional ] = "¦Û°Ê±Ò°Êªº¥Ø¿ý";
+ Text[ arabic ] = "ãÓÇÑ ÇáÈÏÁ ÇáÊáÞÇÆí";
+ Text[ dutch ] = "Autostart-map";
+ Text[ chinese_simplified ] = "×Ô¶¯Æô¶¯Ä¿Â¼";
+ Text[ greek ] = "ÊáôÜëïãïò ÁõôïÅêêßíçóçò";
+ Text[ korean ] = "ÀÚµ¿½ÃÀÛ µð·ºÅ丮";
+ Text[ turkish ] = "Otomatik baþlat dizini";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_QUICKSTART_DIR
+{
+ Text = "Quickstart-Verzeichnis" ;
+ Text [ english ] = "Quickstart path" ;
+ Text [ english_us ] = "Quickstart" ;
+ TEXT[ italian ] = "Cartella quickstart";
+ TEXT[ portuguese_brazilian ] = "Quickstart-Verzeichnis";
+ TEXT[ portuguese ] = "Directório Quickstart";
+ TEXT[ danish ] = "Kvikstart-bibliotek";
+ TEXT[ french ] = "Répertoire Quickstart";
+ TEXT[ swedish ] = "Quickstart-mapp";
+ TEXT[ dutch ] = "Quickstart-pad";
+ TEXT[ spanish ] = "Directorio Quickstart";
+ TEXT[ chinese_simplified ] = "¿ìËÙÆô¶¯Ä¿Â¼";
+ TEXT[ russian ] = "Êàòàëîã áûñòðîãî çàïóñêà";
+ TEXT[ polish ] = "Katalog szybkiego startu";
+ TEXT[ japanese ] = "¸²¯¸½À°Ä ÃÞ¨Ú¸ÄØ";
+ TEXT[ chinese_traditional ] = "¨³³t±Ò°Êªº¥Ø¿ý";
+ TEXT[ arabic ] = "Ïáíá Quickstart";
+ TEXT[ dutch ] = "Quickstart-pad";
+ TEXT[ chinese_simplified ] = "¿ìËÙÆô¶¯Ä¿Â¼";
+ TEXT[ greek ] = "ÄéáäñïìÞ ãñÞãïñçò åêêßíçóçò (Quickstart)";
+ TEXT[ korean ] = "ºü¸¥½ÃÀÛ °æ·Î";
+ TEXT[ turkish ] = "Quickstart dizini";
+ TEXT[ language_user1 ] = " ";
+};
+String STR_KEY_AUTOPILOT_DIR
+{
+ Text = "Autopiloten" ;
+ Text [ English ] = "Autopilots" ;
+ Text [ portuguese ] = "AutoPilotos" ;
+ Text [ english_us ] = "AutoPilots" ;
+ Text [ portuguese_brazilian ] = "Autopiloten" ;
+ Text [ swedish ] = "Autopiloter" ;
+ Text [ danish ] = "AutoPiloter" ;
+ Text [ italian ] = "Piloti automatici" ;
+ Text [ spanish ] = "AutoPilotos" ;
+ Text [ french ] = "AutoPilotes" ;
+ Text [ dutch ] = "AutoPiloot" ;
+ Text[ chinese_simplified ] = "×Ô¶¯ÎļþÖúÀí";
+ Text[ russian ] = "Àâòîïèëîòû";
+ Text[ polish ] = "Autopiloci";
+ Text[ japanese ] = "µ°ÄÊß²Û¯Ä";
+ Text[ chinese_traditional ] = "¦Û°ÊÀɮקU²z";
+ Text[ arabic ] = "ãÑÔÏæä Âáíæä";
+ Text[ dutch ] = "AutoPiloot";
+ Text[ chinese_simplified ] = "×Ô¶¯ÎļþÖúÀí";
+ Text[ greek ] = "AutoPilots";
+ Text[ korean ] = "ÀÚµ¿ ÆÄÀÏ·µ";
+ Text[ turkish ] = "Otopilot";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_GROUP_DIR
+{
+ Text = "Gruppenverzeichnis" ;
+ Text [ English ] = "Group path" ;
+ Text [ english_us ] = "Groups" ;
+ Text[ portuguese ] = "Directório de grupo";
+ Text[ russian ] = "Ãðóïïîâîé êàòàëîã";
+ Text[ dutch ] = "Groepdirectory";
+ Text[ french ] = "Répertoire de groupes";
+ Text[ spanish ] = "Directorio de grupo";
+ Text[ italian ] = "Cartella di gruppo";
+ Text[ danish ] = "Gruppebibliotek";
+ Text[ swedish ] = "Gruppkatalog";
+ Text[ polish ] = "Katalog grup";
+ Text[ portuguese_brazilian ] = "Group path";
+ Text[ japanese ] = "¸ÞÙ°Ìß ÃÞ¨Ú¸ÄØ";
+ Text[ chinese_simplified ] = "С×éĿ¼";
+ Text[ chinese_traditional ] = "¸s²Õ¥Ø¿ý";
+ Text[ arabic ] = "Ïáíá ãÌãæÚÇÊ";
+ Text[ dutch ] = "Groepdirectory";
+ Text[ chinese_simplified ] = "С×éĿ¼";
+ Text[ greek ] = "ÊáôÜëïãïò ïìÜäáò";
+ Text[ korean ] = "±×·ì µð·ºÅ丮";
+ Text[ turkish ] = "Grup dizini";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_PLUGINS_PATH
+{
+ Text = "Plugins-Verzeichnis" ;
+ Text [ English ] = "Plugins directory" ;
+ Text[ english_us ] = "Plug-Ins";
+ Text[ portuguese ] = "Directório de plug-ins";
+ Text[ russian ] = "Êàòàëîã Plugins";
+ Text[ dutch ] = "Plugins directory";
+ Text[ french ] = "Répertoire de Plug-Ins";
+ Text[ spanish ] = "Directorio de Plug-ins";
+ Text[ italian ] = "Cartella plugin";
+ Text[ danish ] = "PlugIn-bibliotek";
+ Text[ swedish ] = "Plugins-mapp";
+ Text[ polish ] = "Katalog dodatków Plugin";
+ Text[ portuguese_brazilian ] = "Plugins directory";
+ Text[ japanese ] = "Ìß×¸Þ²Ý ÃÞ¨Ú¸ÄØ";
+ Text[ chinese_simplified ] = "Plug-In Ŀ¼";
+ Text[ chinese_traditional ] = "Plugins ¥Ø¿ý";
+ Text[ arabic ] = "Ïáíá Plugins";
+ Text[ dutch ] = "Plugins directory";
+ Text[ chinese_simplified ] = "Plug-In Ŀ¼";
+ Text[ greek ] = "ÊáôÜëïãïò Plugins";
+ Text[ korean ] = "Ç÷¯±× ÀÎ µð·ºÅ丮";
+ Text[ turkish ] = "Plug-In dizini";
+};
+String STR_KEY_FAVORITES_DIR
+{
+ Text[ language_user1 ] = " ";
+ Text = "Ordner-Bookmarks" ;
+ Text [ English ] = "Folder Bookmarks" ;
+ Text[ english_us ] = "Folder Bookmarks";
+ Text[ portuguese ] = "Pastas correntes";
+ Text[ greek ] = "Óåëéäïäåßêôåò êáôáëüãùí";
+ Text[ dutch ] = "Bookmarks voor mappen";
+ Text[ french ] = "Répertoires courants";
+ Text[ spanish ] = "Marcadores de carpetas";
+ Text[ swedish ] = "Mappbokmärken";
+ Text[ russian ] = "Çàêëàäêè ê ïàïêàì";
+ Text[ italian ] = "Bookmark della cartella";
+ Text[ danish ] = "Mappe-bogmærker";
+ Text[ polish ] = "Zak³adki folderu";
+ Text[ portuguese_brazilian ] = "User directories";
+ Text[ japanese ] = "Ì«ÙÀÞ‚ÌÌÞ¯¸Ï°¸";
+ Text[ korean ] = "Æú´õ Ã¥°¥ÇÇ";
+ Text[ chinese_simplified ] = "Îļþ¼ÐÊéÇ©";
+ Text[ chinese_traditional ] = "¸ê®Æ§¨®ÑÅÒ";
+ Text[ arabic ] = "ÅÔÇÑÇÊ ãÑÌÚíÉ áãÌáÏÇÊ";
+ Text[ turkish ] = "Yer iþareti klasörü";
+};
+String STR_KEY_FILTER_PATH
+{
+ Text = "Filter" ;
+ Text [ English ] = "Filter" ;
+ Text[ english_us ] = "Filters";
+ Text[ portuguese ] = "Filtros";
+ Text[ greek ] = "Ößëôñï";
+ Text[ dutch ] = "Filter";
+ Text[ french ] = "Filtre";
+ Text[ spanish ] = "Filtros";
+ Text[ swedish ] = "Filter";
+ Text[ russian ] = "Ôèëüòð";
+ Text[ italian ] = "Filtro";
+ Text[ danish ] = "Filtre";
+ Text[ polish ] = "Filtr";
+ Text[ portuguese_brazilian ] = "Filter";
+ Text[ japanese ] = "̨ÙÀ";
+ Text[ korean ] = "ÇÊÅÍ";
+ Text[ chinese_simplified ] = "ɸѡ";
+ Text[ chinese_traditional ] = "¹LÂo¾¹";
+ Text[ arabic ] = "ÝáÊÑ";
+ Text[ turkish ] = "Filtre";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_ADDINS_PATH
+{
+ Text = "AddIns" ;
+ Text [ English ] = "AddIns" ;
+ Text[ english_us ] = "Add-Ins";
+ Text[ portuguese ] = "AddIns";
+ Text[ greek ] = "AddIns";
+ Text[ dutch ] = "AddIns";
+ Text[ french ] = "Add-Ins";
+ Text[ spanish ] = "AddIns";
+ Text[ swedish ] = "AddIns";
+ Text[ russian ] = "AddIns";
+ Text[ italian ] = "AddIns";
+ Text[ danish ] = "AddIns";
+ Text[ polish ] = "AddIns";
+ Text[ portuguese_brazilian ] = "AddIns";
+ Text[ japanese ] = "±ÄÞ²Ý";
+ Text[ korean ] = "¾ÖµåÀÎ";
+ Text[ chinese_simplified ] = "AddIns";
+ Text[ chinese_traditional ] = "AddIns";
+ Text[ arabic ] = "AddIns";
+ Text[ turkish ] = "Add-In";
+};
+String STR_KEY_USERCONFIG_PATH
+{
+ Text = "Benutzer Konfiguration" ;
+ Text [ English ] = "User Settings" ;
+ Text[ english_us ] = "User Configuration";
+ Text[ portuguese ] = "Configuração personalizada";
+ Text[ greek ] = "ÐáñÜìåôñïé ÷ñÞóôç";
+ Text[ dutch ] = "Gebruikerscofiguratie";
+ Text[ french ] = "Configuration d'utilisateur";
+ Text[ spanish ] = "Configuración de usuario";
+ Text[ swedish ] = "Användarkonfiguration";
+ Text[ russian ] = "Êîíôèãóðàöèÿ ïîëüçîâàòåëÿ";
+ Text[ italian ] = "Configurazione utente";
+ Text[ danish ] = "Brugerkonfigurationer";
+ Text[ polish ] = "Konfiguracje u¿ytkownika";
+ Text[ portuguese_brazilian ] = "User Settings";
+ Text[ japanese ] = "Õ°»Þ°Ý’è";
+ Text[ korean ] = "»ç¿ëÀÚ ¼³Á¤";
+ Text[ chinese_simplified ] = "ʹÓÃÕßÅäÖÃ";
+ Text[ chinese_traditional ] = "¨Ï¥ÎªÌ³]©w";
+ Text[ arabic ] = "Êßæíä ÇáãÓÊÎÏã";
+ Text[ turkish ] = "Kullanýcý konfigürasyonu";
+ Text[ language_user1 ] = " ";
+};
+String STR_KEY_USERDICTIONARY_DIR
+{
+ Text = "Benutzerwörterbücher" ;
+ Text [ English ] = "User Dictionaries" ;
+ Text[ english_us ] = "User Dictionaries";
+ Text[ portuguese ] = "Dicionários personalizados";
+ Text[ russian ] = "Ñëîâàðè ïîëüçîâàòåëÿ";
+ Text[ greek ] = "ËåîéêÜ ÷ñÞóôç";
+ Text[ dutch ] = "Gebruikerswoordenboek";
+ Text[ french ] = "Dictionnaires de l'utilisateur";
+ Text[ spanish ] = "Diccionarios de usuario";
+ Text[ italian ] = "Dizionari utente";
+ Text[ danish ] = "Brugerordbøger";
+ Text[ swedish ] = "Användarordböcker";
+ Text[ polish ] = "S³owniki u¿ytkownika";
+ Text[ portuguese_brazilian ] = "User Dictionaries";
+ Text[ japanese ] = "Õ°»Þ°Ž«‘";
+ Text[ korean ] = "»ç¿ëÀÚ »çÀü";
+ Text[ chinese_simplified ] = "Óû§×Öµä";
+ Text[ chinese_traditional ] = "¦Û­q¦r¨å";
+ Text[ arabic ] = "ÞæÇãíÓ ÇáãÓÊÎÏã";
+ Text[ turkish ] = "Kullanýcý sözlükleri";
+};
+String STR_KEY_AUTOCORRECT_DIR
+{
+ Text = "AutoKorrektur" ;
+ Text [ English ] = "AutoCorrect" ;
+ Text[ english_us ] = "AutoCorrect";
+ Text[ portuguese ] = "AutoCorrecção";
+ Text[ russian ] = "Àâòîçàìåíà";
+ Text[ greek ] = "ÁõôïÄéüñèùóç";
+ Text[ dutch ] = "AutoCorrectie";
+ Text[ french ] = "AutoCorrection";
+ Text[ spanish ] = "AutoCorrección";
+ Text[ italian ] = "Correzione automatica";
+ Text[ danish ] = "AutoKorrektur";
+ Text[ swedish ] = "AutoKorrigering";
+ Text[ polish ] = "Autokorekta";
+ Text[ portuguese_brazilian ] = "AutoCorrect";
+ Text[ japanese ] = "µ°ÄºÚ¸Ä";
+ Text[ korean ] = "ÀÚµ¿ °íħ";
+ Text[ chinese_simplified ] = "×Ô¶¯¸üÕý";
+ Text[ chinese_traditional ] = "¦Û°Ê§ó¥¿";
+ Text[ arabic ] = "ÊÕÍíÍ ÊáÞÇÆí";
+ Text[ turkish ] = "Otomatik düzeltme";
+};
+#if defined STR_KEY_LINGUISTIC_DIR
+String STR_KEY_LINGUISTIC_DIR
+{
+ Text = "Linguistik" ;
+ Text [ English ] = "Linguistic" ;
+ Text[ english_us ] = "Language";
+ Text[ portuguese ] = "Linguística";
+ Text[ russian ] = "Ëèíãâèñòèêà";
+ Text[ greek ] = "Ãëþóóá";
+ Text[ dutch ] = "Linguïstiek";
+ Text[ french ] = "Linguistique";
+ Text[ spanish ] = "Lingüística";
+ Text[ italian ] = "Linguistica";
+ Text[ danish ] = "Lingvistik";
+ Text[ swedish ] = "Lingvistik";
+ Text[ polish ] = "Lingwistyka";
+ Text[ portuguese_brazilian ] = "Linguistic";
+ Text[ japanese ] = "Œ¾Œê";
+ Text[ korean ] = "¾ð¾î";
+ Text[ chinese_simplified ] = "ÓïÑÔ";
+ Text[ chinese_traditional ] = "»y¨¥";
+ Text[ arabic ] = "ÇááÛÉ";
+ Text[ turkish ] = "Dil";
+};
+#endif // STR_KEY_LINGUISTIC_DIR
+
diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src
new file mode 100644
index 000000000000..8800d1b6ebd9
--- /dev/null
+++ b/svtools/source/misc/errtxt.src
@@ -0,0 +1,2778 @@
+/*************************************************************************
+ *
+ * $RCSfile: errtxt.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define __RSC
+#include "svtools.hrc"
+#include "sfxecode.hxx"
+ // pragma ----------------------------------------------------------------
+Resource RID_ERRCTX
+{
+ String ERRCTX_ERROR
+ {
+ Text = "Fehler" ;
+ Text [ ENGLISH ] = "Error" ;
+ Text [ english_us ] = "Error" ;
+ Text [ italian ] = "Errore" ;
+ Text [ spanish ] = "Error" ;
+ Text [ french ] = "Erreur" ;
+ Text [ dutch ] = "Fout" ;
+ Text [ swedish ] = "Fel" ;
+ Text [ danish ] = "Fejl" ;
+ Text [ portuguese_brazilian ] = "Fehler" ;
+ Text [ portuguese ] = "Erro" ;
+ Text[ chinese_simplified ] = "´íÎó";
+ Text[ russian ] = "Îøèáêà";
+ Text[ polish ] = "B³¹d";
+ Text[ japanese ] = "´×°";
+ Text[ chinese_traditional ] = "¿ù»~";
+ Text[ arabic ] = "ÎØÃ";
+ Text[ dutch ] = "Fout";
+ Text[ chinese_simplified ] = "´íÎó";
+ Text[ greek ] = "ÓöÜëìá";
+ Text[ korean ] = "¿À·ù";
+ Text[ turkish ] = "Hata";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_WARNING
+ {
+ Text = "Warnung" ;
+ Text [ ENGLISH ] = "Warning" ;
+ Text [ dutch ] = "Waarschuwing" ;
+ Text [ english_us ] = "Warning" ;
+ Text [ italian ] = "Avvertenza" ;
+ Text [ spanish ] = "Advertencia" ;
+ Text [ french ] = "Message d'avertissement" ;
+ Text [ swedish ] = "Varning" ;
+ Text [ danish ] = "Advarsel" ;
+ Text [ portuguese ] = "Aviso" ;
+ Text [ portuguese_brazilian ] = "Warnung" ;
+ Text[ chinese_simplified ] = "¾¯¸æ";
+ Text[ russian ] = "Ïðåäóïðåæäåíèå";
+ Text[ polish ] = "Ostrze¿enie";
+ Text[ japanese ] = "Œx";
+ Text[ chinese_traditional ] = "ĵ§i";
+ Text[ arabic ] = "ÊÍÐíÑ";
+ Text[ dutch ] = "Waarschuwing";
+ Text[ chinese_simplified ] = "¾¯¸æ";
+ Text[ greek ] = "Ðñïåéäïðïßçóç";
+ Text[ korean ] = "°æ°í";
+ Text[ turkish ] = "Uyarý";
+ };
+ String ERRCTX_SFX_LOADTEMPLATE
+ {
+ Text = "$(ERR) beim Laden der Vorlage $(ARG1)" ;
+ Text [ ENGLISH ] = "$(ERR) while loading template $(ARG1)" ;
+ Text [ dutch ] = "$(ERR) bij laden van sjabloon $(ARG1)" ;
+ Text [ english_us ] = "$(ERR) loading the template $(ARG1)" ;
+ Text [ italian ] = "$(ERR) nel caricare il modello $(ARG1)" ;
+ Text [ spanish ] = "$(ERR) al cargar la plantilla $(ARG1)" ;
+ Text [ french ] = "$(ERR) lors du chargement du modèle $(ARG1)" ;
+ Text [ swedish ] = "$(ERR) vid laddning av formatmallen $(ARG1)" ;
+ Text [ danish ] = "$(ERR) under indlæsning af skabelonen $(ARG1)" ;
+ Text [ portuguese ] = "$(ERR) ao carregar o modelo $(ARG1)" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Laden der Vorlage $(ARG1)" ;
+ Text[ chinese_simplified ] = "$(ERR)·¢ÉúÔÚ×°ÔØÑùʽ$(ARG1)ʱ";
+ Text[ russian ] = "$(ERR) ïðè çàãðóçêå øàáëîíà $(ARG1)";
+ Text[ polish ] = "$(ERR) przy ³adowaniu szablonu $(ARG1)";
+ Text[ japanese ] = "$(ERR)ÃÝÌßÚ°Ä$(ARG1)‚Ì“Ç‚Ýž‚Ý‚ÌÛ";
+ Text[ chinese_traditional ] = "¸Ë¸ü¼Ë¦¡ $(ARG1) ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÊÍãíá ÇáÞÇáÈ $(ARG1)";
+ Text[ dutch ] = "$(ERR) bij laden van sjabloon $(ARG1)";
+ Text[ chinese_simplified ] = "$(ERR)·¢ÉúÔÚ×°ÔØÑùʽ$(ARG1)ʱ";
+ Text[ greek ] = "$(ERR) êáôÜ ôç öüñôùóç ôïõ ðñïôýðïõ $(ARG1)";
+ Text[ korean ] = "¼­½ÄÆÄÀÏ $(ARG1)À» ·ÎµåÇÏ´øÁß $(ERR)";
+ Text[ turkish ] = "$(ARG1) þablonu yüklenirken $(ERR)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_SFX_SAVEDOC
+ {
+ Text = "$(ERR) beim Speichern des Dokumentes $(ARG1)" ;
+ Text [ italian ] = "$(ERR) nel salvare il documento $(ARG1)";
+ Text [ portuguese_brazilian ] = "$(ERR) beim Speichern des Dokumentes $(ARG1)";
+ Text [ portuguese ] = "$(ERR) ao guardar o documento $(ARG1)";
+ Text [ danish ] = "$(ERR) under forsøg på at gemme dokumentet $(ARG1)";
+ Text [ french ] = "$(ERR) lors de l'enregistrement du document $(ARG1)";
+ Text [ swedish ] = "$(ERR) när dokumentet $(ARG1) sparades";
+ Text [ dutch ] = "$(ERR) bij opslaan van document $(ARG1)";
+ Text [ spanish ] = "$(ERR) al guardar el documento $(ARG1)";
+ Text [ english_us ] = "$(ERR) saving the document $(ARG1)";
+ Text[ chinese_simplified ] = "´æÅÌÎĵµ $(ARG1) ʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè ñîõðàíåíèè äîêóìåíòà $(ARG1)";
+ Text[ polish ] = "$(ERR) przy zapisywaniu dokumentu $(ARG1)";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ$(ARG1)‚Ì•Û‘¶‚ÌÛ";
+ Text[ chinese_traditional ] = "Àx¦s¤å¥ó $(ARG1) ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÍÝÙ ÇáãÓÊäÏ $(ARG1)";
+ Text[ dutch ] = "$(ERR) bij opslaan van document $(ARG1)";
+ Text[ chinese_simplified ] = "´æÅÌÎĵµ $(ARG1) ʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôçí áðïèÞêåõóçôïõ åããñÜöïõ $(ARG1)";
+ Text[ korean ] = "¹®¼­$(ARG1)¸¦ ÀúÀåÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "$(ARG1) belgesi kaydedilirken $(ERR)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_SFX_SAVEASDOC
+ {
+ Text = "$(ERR) beim Speichern des Dokumentes $(ARG1)";
+ Text [ italian ] = "$(ERR) nel salvare il documento $(ARG1)";
+ Text [ portuguese_brazilian ] = "$(ERR) beim Speichern des Dokumentes $(ARG1)";
+ Text [ portuguese ] = "$(ERR) ao guardar o documento $(ARG1)";
+ Text [ danish ] = "$(ERR) under forsøg på at gemme dokumentet $(ARG1)";
+ Text [ french ] = "$(ERR) lors de l'enregistrement du document $(ARG1)";
+ Text [ swedish ] = "$(ERR) när dokumentet $(ARG1) sparades";
+ Text [ dutch ] = "$(ERR) bij opslaan van document $(ARG1)";
+ Text [ spanish ] = "$(ERR) al guardar el documento $(ARG1)";
+ Text [ english_us ] = "$(ERR) saving the document $(ARG1)";
+ Text[ chinese_simplified ] = "´æÅÌÎĵµ $(ARG1) ʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè ñîõðàíåíèè äîêóìåíòà $(ARG1)";
+ Text[ polish ] = "$(ERR) przy zapisywaniu dokumentu $(ARG1)";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ$(ARG1)‚Ì•Û‘¶‚ÌÛ";
+ Text[ chinese_traditional ] = "Àx¦s¤å¥ó $(ARG1) ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÍÝÙ ÇáãÓÊäÏ $(ARG1)";
+ Text[ dutch ] = "$(ERR) bij opslaan van document $(ARG1)";
+ Text[ chinese_simplified ] = "´æÅÌÎĵµ $(ARG1) ʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôçí áðïèÞêåõóçôïõ åããñÜöïõ $(ARG1)";
+ Text[ korean ] = "¹®¼­$(ARG1)¸¦ ÀúÀåÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "$(ARG1) belgesi kaydedilirken $(ERR)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_SFX_DOCINFO
+ {
+ Text = "$(ERR) beim Anzeigen der Docinfo des Dokumentes $(ARG1)" ;
+ Text [ ENGLISH ] = "$(ERR) while showing docinfo for document $(ARG1)" ;
+ Text [ dutch ] = "$(ERR) bij weergeven van document info bij document $(ARG1)" ;
+ Text [ english_us ] = "$(ERR) displaying doc. information for document $(ARG1)" ;
+ Text [ italian ] = "$(ERR) nel visualizzare le informazioni riguardanti il documento $(ARG1)" ;
+ Text [ spanish ] = "$(ERR) al mostrar la información del documento $(ARG1)" ;
+ Text [ french ] = "$(ERR) lors de l'affichage des informations sur le document $(ARG1)" ;
+ Text [ swedish ] = "$(ERR) vid visning av dokumentinfo för $(ARG1)" ;
+ Text [ danish ] = "$(ERR) ved visning af dokumentinfo for dokumentet $(ARG1)" ;
+ Text [ portuguese ] = "$(ERR) ao mostrar informações sobre o documento $(ARG1)" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Anzeigen der Docinfo des Dokumentes $(ARG1)" ;
+ Text[ chinese_simplified ] = "ÏÔʾÎĵµ $(ARG1) ÎĵµÐÅϢʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè ïîêàçå èíôîðìàöèè ê äîêóìåíòó $(ARG1)";
+ Text[ polish ] = "$(ERR) przy wyœwietlaniu informacji o dokumencie dla dokumentu $(ARG1)";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ$(ARG1)‚ÌÄÞ·­ÒÝÄî•ñ‚Ì•\\Ž¦‚ÌÛ";
+ Text[ chinese_traditional ] = "Åã¥Ü¤å¥ó $(ARG1) ªº¤å¥ó¸ê°T®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÅÙåÇÑ ãÚáæãÇÊ ÇáãÓÊäÏ ÇáÎÇÕÉ ÈÇáãÓÊäÏ $(ARG1)";
+ Text[ dutch ] = "$(ERR) bij weergeven van document info bij document $(ARG1)";
+ Text[ chinese_simplified ] = "ÏÔʾÎĵµ $(ARG1) ÎĵµÐÅϢʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôçí åìöÜíéóç ôçò ðëçñïöïñßáò ôïõ åããñÜöïõ $(ARG1)";
+ Text[ korean ] = "¹®¼­$(ARG1)ÀÇ ¹®¼­ Á¤º¸¸¦ Ç¥½ÃÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "$(ARG1) belgesinin, belge bilgileri görüntülenirken $(ERR)";
+ };
+ String ERRCTX_SFX_DOCTEMPLATE
+ {
+ Text = "$(ERR) beim Schreiben des Dokumentes $(ARG1) als Vorlage" ;
+ Text [ ENGLISH ] = "$(ERR) saving document $(ARG1) as template" ;
+ Text [ dutch ] = "$(ERR) bij opslaan van document $(ARG1) als sjabloon" ;
+ Text [ english_us ] = "$(ERR) writing document $(ARG1) as template" ;
+ Text [ italian ] = "$(ERR) nella scrittura del documento $(ARG1) come modello" ;
+ Text [ spanish ] = "$(ERR) al escribir el documento $(ARG1) como plantilla" ;
+ Text [ french ] = "$(ERR) lors de l'enregistrement du document $(ARG1) en tant que modèle" ;
+ Text [ swedish ] = "$(ERR) vid när dokumentet $(ARG1) skrevs som formatmall" ;
+ Text [ danish ] = "$(ERR) under skrivning af dokumentet $(ARG1) som skabelon" ;
+ Text [ portuguese ] = "$(ERR) ao escrever o documento $(ARG1) como modelo" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Schreiben des Dokumentes $(ARG1) als Vorlage" ;
+ Text[ chinese_simplified ] = "ÔÚ¸²Ð´ÑùʽÎĵµ$(ARG1)ʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè çàïèñè äîêóìåíòà $(ARG1) êàê øàáëîíà";
+ Text[ polish ] = "$(ERR) przy zapisywaniu dokumentu $(ARG1) jako szablonu";
+ Text[ japanese ] = "$(ERR)ÃÝÌßÚ°Ä‚Æ‚µ‚ÄÄÞ·­ÒÝÄ$(ARG1)‚ð‘‚«ž‚ÞÛ";
+ Text[ chinese_traditional ] = "¼g¤J¼Ë¦¡¤å¥ó $(ARG1) ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ßÊÇÈÉ ÇáãÓÊäÏ $(ARG1) ßÞÇáÈ";
+ Text[ dutch ] = "$(ERR) bij opslaan van document $(ARG1) als sjabloon";
+ Text[ chinese_simplified ] = "ÔÚ¸²Ð´ÑùʽÎĵµ$(ARG1)ʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôçí åããñáöÞ ôïõ åããñÜöïõ $(ARG1) ùò ðñüôõðï";
+ Text[ korean ] = "¹®¼­$(ARG1)¸¦ ¼­½ÄÆÄÀÏ·Î ±â·ÏÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "$(ARG1) belgesi þablon olarak yazýlýrken $(ERR)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_SFX_MOVEORCOPYCONTENTS
+ {
+ Text = "$(ERR) beim Kopieren oder Verschieben von Dokumentinhalten" ;
+ Text [ ENGLISH ] = "$(ERR) beim Kopieren oder Verschieben von Dokumentinhalten" ;
+ Text [ portuguese ] = "$(ERR) ao copiar ou mover conteúdos do documento" ;
+ Text [ english_us ] = "$(ERR) copying or moving document contents" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Kopieren oder Verschieben von Dokumentinhalten" ;
+ Text [ swedish ] = "$(ERR) vid kopiering eller förflyttning av dokumentinnehåll" ;
+ Text [ danish ] = "$(ERR) under kopiering eller flytning af dokumentindhold" ;
+ Text [ italian ] = "$(ERR) nel copiare o spostare i contenuti dei documenti" ;
+ Text [ spanish ] = "$(ERR) al copiar o desplazar los contenidos del documento." ;
+ Text [ french ] = "$(ERR) lors de la copie ou du déplacement du contenu des documents " ;
+ Text [ dutch ] = "$(ERR) bij kopiëren of verplaatsen van documentinhoud" ;
+ Text[ chinese_simplified ] = "¸´ÖÆ»òÒƶ¯ÎĵµÄÚÈÝʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè êîïèðîâàíèè èëè ïåðåìåùåíèè ñîäåðæèìîãî äîêóìåíòà";
+ Text[ polish ] = "$(ERR) przy kopiowaniu lub przenoszeniu zawartoœci wiadomoœci";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ‚Ì“à—e‚ðºËß°‚Ü‚½‚͈ړ®‚·‚éÛ";
+ Text[ chinese_traditional ] = "½Æ»s©M²¾°Ê¤å¥ó¤º®e®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ äÓÎ Ãæ ÅÒÇÍÉ ãÍÊæíÇÊ ÇáãÓÊäÏ";
+ Text[ dutch ] = "$(ERR) bij kopiëren of verplaatsen van documentinhoud";
+ Text[ chinese_simplified ] = "¸´ÖÆ»òÒƶ¯ÎĵµÄÚÈÝʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôçí áíôéãñáöÞ Þ ìåôáêßíçóç ôùí ðåñéå÷ïìÝíùí ôïõ åããñÜöïõ";
+ Text[ korean ] = "¹®¼­ ³»¿ëÀ» º¹»ç ¶Ç´Â À̵¿ÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "Belge içeriði kopyalanýrken ya da taþýnýrken $(ERR)";
+ };
+ String ERRCTX_SFX_DOCMANAGER
+ {
+ Text = "$(ERR) beim Starten des Docmanagers" ;
+ Text [ ENGLISH ] = "$(ERR) starting the docmanager" ;
+ Text [ english_us ] = "$(ERR) starting the Document Manager" ;
+ Text [ italian ] = "$(ERR) nell'avvio del Docmanager" ;
+ Text [ spanish ] = "$(ERR) al inicializar el administrador de documentos" ;
+ Text [ french ] = "$(ERR) lors du démarrage du gestionnaire de documents" ;
+ Text [ dutch ] = "$(ERR) bij het starten van het documentbeheer" ;
+ Text [ swedish ] = "$(ERR) vid start av dokumentmanagern" ;
+ Text [ danish ] = "$(ERR) ved start af dokumentmanageren" ;
+ Text [ portuguese ] = "$(ERR) ao iniciar o Gestor de Documentos" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Starten des Docmanagers" ;
+ Text[ chinese_simplified ] = "Æô¶¯Îĵµ¹ÜÀí³ÌÐòʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè çàïóñêå äèñïåò÷åðà äîêóìåíòà";
+ Text[ polish ] = "$(ERR) przy w³¹czaniu mened¿era dokumentów";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ ÏÈ°¼Þ¬‚ÌŠJŽn‚ÌÛ";
+ Text[ chinese_traditional ] = "±Ò°Ê¤å¥óÁ`ºÞ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÈÏÁ ãÏíÑ ÇáãÓÊäÏ";
+ Text[ dutch ] = "$(ERR) bij het starten van het documentbeheer";
+ Text[ chinese_simplified ] = "Æô¶¯Îĵµ¹ÜÀí³ÌÐòʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôçí åêêßíçóç ôïõ äéá÷åéñéóôÞ ôùí åããñÜöùí";
+ Text[ korean ] = "¹®¼­°ü¸®ÀÚ¸¦ ½ÃÀÛÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "Belge yöneticisi baþlatýlýrken $(ERR)";
+ };
+ String ERRCTX_SFX_OPENDOC
+ {
+ Text = "$(ERR) beim Laden des Dokumentes $(ARG1)" ;
+ Text [ ENGLISH ] = "$(ERR) opening document $(ARG1)" ;
+ Text [ english_us ] = "$(ERR) loading document $(ARG1)" ;
+ Text [ italian ] = "$(ERR) nel caricare il documento $(ARG1)" ;
+ Text [ spanish ] = "$(ERR) al cargar el documento $(ARG1)" ;
+ Text [ french ] = "$(ERR) lors du chargement du document $(ARG1)" ;
+ Text [ dutch ] = "$(ERR) bij openen van document $(ARG1)" ;
+ Text [ swedish ] = "$(ERR) vid laddning av dokumentet $(ARG1)" ;
+ Text [ danish ] = "$(ERR) under indlæsning af dokumentet $(ARG1)" ;
+ Text [ portuguese ] = "$(ERR) ao carregar o documento $(ARG1)" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Laden des Dokumentes $(ARG1)" ;
+ Text[ chinese_simplified ] = "×°ÔØÎĵµ $(ARG1) ʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè çàãðóçêå äîêóìåíòà $(ARG1)";
+ Text[ polish ] = "$(ERR) przy ³adowaniu dokumentu $(ARG1)";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ$(ARG1)‚Ì“Ç‚Ýž‚Ý‚ÌÛ";
+ Text[ chinese_traditional ] = "¸Ë¸ü¤å¥ó $(ARG1) ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÊÍãíá ÇáãÓÊäÏ $(ARG1)";
+ Text[ dutch ] = "$(ERR) bij openen van document $(ARG1)";
+ Text[ chinese_simplified ] = "×°ÔØÎĵµ $(ARG1) ʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôï öüñôùìá ôïõ åããñÜöïõ $(ARG1)";
+ Text[ korean ] = "¹®¼­$(ARG1)¸¦ ·ÎµåÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "$(ARG1) belgesi yüklenirken $(ERR)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_SFX_NEWDOCDIRECT
+ {
+ Text = "$(ERR) beim Anlegen eines neuen Dokumentes" ;
+ Text [ ENGLISH ] = "$(ERR) creating a new document" ;
+ Text [ english_us ] = "$(ERR) creating a new document" ;
+ Text [ italian ] = "$(ERR) nella creazione di un nuovo documento" ;
+ Text [ spanish ] = "$(ERR) al crear un nuevo documento" ;
+ Text [ french ] = "$(ERR) lors de la création d'un nouveau document" ;
+ Text [ dutch ] = "$(ERR) bij maken van nieuw document" ;
+ Text [ swedish ] = "$(ERR) när ett nytt dokument skapades" ;
+ Text [ danish ] = "$(ERR) under oprettelsen af et nyt dokument" ;
+ Text [ portuguese ] = "$(ERR) ao criar o novo documento" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Anlegen eines neuen Dokumentes" ;
+ Text[ chinese_simplified ] = "н¨ÎĵµÊ±·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè ñîçäàíèè íîâîãî äîêóìåíòà";
+ Text[ polish ] = "$(ERR) przy tworzeniu nowego dokumentu";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ‚ÌV‹K쬂ÌÛ";
+ Text[ chinese_traditional ] = "«Ø¥ß¤@­Ó·s¤å¥ó®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÅäÔÇÁ ãÓÊäÏ ÌÏíÏ";
+ Text[ dutch ] = "$(ERR) bij maken van nieuw document";
+ Text[ chinese_simplified ] = "н¨ÎĵµÊ±·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôç äçìéïõñãßá åíüò íÝïõ åããñÜöïõ";
+ Text[ korean ] = "»õ ¹®¼­¸¦ ÀÛ¼ºÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "Yeni belge oluþturulurken $(ERR)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_SFX_NEWDOC
+ {
+ Text = "$(ERR) beim Anlegen eines neuen Dokumentes" ;
+ Text [ ENGLISH ] = "$(ERR) creating a new document" ;
+ Text [ dutch ] = "$(ERR) bij maken van nieuw document" ;
+ Text [ english_us ] = "$(ERR) creating a new document" ;
+ Text [ italian ] = "$(ERR) nella creazione di un nuovo documento" ;
+ Text [ spanish ] = "$(ERR) al crear un nuevo documento" ;
+ Text [ french ] = "$(ERR) lors de la création d'un nouveau document" ;
+ Text [ swedish ] = "$(ERR) när ett nytt dokument skapades" ;
+ Text [ danish ] = "$(ERR) under oprettelsen af et nyt dokument" ;
+ Text [ portuguese ] = "$(ERR) ao criar o novo documento" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Anlegen eines neuen Dokumentes" ;
+ Text[ chinese_simplified ] = "н¨ÎĵµÊ±·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè ñîçäàíèè íîâîãî äîêóìåíòà";
+ Text[ polish ] = "$(ERR) przy tworzeniu nowego dokumentu";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ‚ÌV‹K쬂ÌÛ";
+ Text[ chinese_traditional ] = "«Ø¥ß¤@­Ó·s¤å¥ó®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÅäÔÇÁ ãÓÊäÏ ÌÏíÏ";
+ Text[ dutch ] = "$(ERR) bij maken van nieuw document";
+ Text[ chinese_simplified ] = "н¨ÎĵµÊ±·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôç äçìéïõñãßá åíüò íÝïõ åããñÜöïõ";
+ Text[ korean ] = "»õ ¹®¼­¸¦ ÀÛ¼ºÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "Yeni belge oluþturulurken $(ERR)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCTX_SFX_CREATEOBJSH
+ {
+ Text = "$(ERR) beim Aufklappen einer Rubrik" ;
+ Text [ ENGLISH ] = "$(ERR) expanding entry" ;
+ Text [ dutch ] = "$(ERR) bij openen van een rubriek" ;
+ Text [ english_us ] = "$(ERR) expanding entry" ;
+ Text [ italian ] = "$(ERR) nell'apertura di una voce" ;
+ Text [ spanish ] = "$(ERR) al abrir una rúbrica" ;
+ Text [ french ] = "$(ERR) lors de l'ouverture d'une rubrique" ;
+ Text [ swedish ] = "$(ERR) när en rubrik öppnades" ;
+ Text [ danish ] = "$(ERR) under åbning af en rubrik" ;
+ Text [ portuguese ] = "$(ERR) ao abrir rubrica" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Aufklappen einer Rubrik" ;
+ Text[ chinese_simplified ] = "´ò¿ª·ÖÀàÌõĿʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè ðàñêðûâàíèè ðóáðèêè";
+ Text[ polish ] = "$(ERR) przy otwieraniu rubryki";
+ Text[ japanese ] = "$(ERR)ÂØ°•\\Ž¦‚ðŠJ‚­Û";
+ Text[ chinese_traditional ] = "ÂX®iÅã¥Ü¤@­Ó¤ÀÄæ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÝÊÍ ÃÍÏ ÇáÃÚãÏÉ";
+ Text[ dutch ] = "$(ERR) bij openen van een rubriek";
+ Text[ chinese_simplified ] = "´ò¿ª·ÖÀàÌõĿʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôï Üíïéãìá ìéáò åããñáöÞò";
+ Text[ korean ] = "Ç׸ñÀ» Àü°³ÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "Giriþi açarken $(ERR)";
+ };
+ String ERRCTX_SFX_LOADBASIC
+ {
+ Text = "$(ERR) beim Laden des BASIC des Dokuments $(ARG1)" ;
+ Text [ ENGLISH ] = "$(ERR) while loading BASIC of document $(ARG1)" ;
+ Text [ dutch ] = "$(ERR) bij laden van BASIC van document $(ARG1)" ;
+ Text [ english_us ] = "$(ERR) loading BASIC of document $(ARG1)" ;
+ Text [ italian ] = "$(ERR) nel caricare il BASIC del documento $(ARG1)" ;
+ Text [ spanish ] = "$(ERR) al cargar el BASIC del documento $(ARG1)" ;
+ Text [ french ] = "$(ERR) lors du chargement du BASIC du document $(ARG1)" ;
+ Text [ swedish ] = "$(ERR) vid laddning av BASIC i dokumentet $(ARG1)" ;
+ Text [ danish ] = "$(ERR) under indlæsning af BASIC fra dokumentet $(ARG1)" ;
+ Text [ portuguese ] = "$(ERR) ao carregar o BASIC do documento $(ARG1)" ;
+ Text [ portuguese_brazilian ] = "$(ERR) beim Laden des BASIC des Dokuments $(ARG1)" ;
+ Text[ chinese_simplified ] = "×°ÔØÎĵµ $(ARG1) BASIC ʱ·¢Éú $(ERR)";
+ Text[ russian ] = "$(ERR) ïðè çàãðóçêå BASIC äîêóìåíòà $(ARG1)";
+ Text[ polish ] = "$(ERR) przy ³adowaniu dokumentu BASIC $(ARG1)";
+ Text[ japanese ] = "$(ERR)ÄÞ·­ÒÝÄ$(ARG1)‚ÌBASIC‚Ì“Ç‚Ýž‚Ý‚ÌÛ";
+ Text[ chinese_traditional ] = "¸Ë¸ü¤å¥ó $(ARG1) BASIC ®Éµo¥Í $(ERR)";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÊÍãíá BASIC ÇáãÓÊäÏ $(ARG1)";
+ Text[ dutch ] = "$(ERR) bij laden van BASIC van document $(ARG1)";
+ Text[ chinese_simplified ] = "×°ÔØÎĵµ $(ARG1) BASIC ʱ·¢Éú $(ERR)";
+ Text[ greek ] = "$(ERR) êáôÜ ôç öüñôùóç ôïõ BASIC ôïõ åããñÜöïõ $(ARG1)";
+ Text[ korean ] = "¹®¼­$(ARG1)ÀÇ BASICÀ» ·ÎµåÇÏ´ø Áß $(ERR)";
+ Text[ turkish ] = "$(ARG1) belgesi ile ilgili BASIC yüklenirken $(ERR)";
+ };
+ String ERRCTX_SFX_SEARCHADDRESS
+ {
+ Text = "$(ERR) bei der Adressensuche" ;
+ Text [ ENGLISH ] = "$(ERR) searching for an address" ;
+ Text[ english_us ] = "$(ERR) searching for an address";
+ Text[ portuguese ] = "$(ERR) ao procurar o endereço";
+ Text[ russian ] = "$(ERR) searching for an address";
+ Text[ greek ] = "$(ERR) êáôÜ ôçí áíáæÞôçóç äéåýèõíóçò";
+ Text[ dutch ] = "$(ERR) bij zoeken naar een adres";
+ Text[ french ] = "$(ERR) lors de la recherche d'adresse";
+ Text[ spanish ] = "$(ERR) searching for an address";
+ Text[ italian ] = "$(ERR) searching for an address";
+ Text[ danish ] = "$(ERR) under adressesøgningen";
+ Text[ swedish ] = "$(ERR) vid adressökning";
+ Text[ polish ] = "$(ERR) searching for an address";
+ Text[ portuguese_brazilian ] = "$(ERR) searching for an address";
+ Text[ japanese ] = "$(ERR) ±ÄÞÚ½ŒŸõ’†‚É”­¶‚µ‚Ü‚µ‚½";
+ Text[ korean ] = "$(ERR) searching for an address";
+ Text[ chinese_simplified ] = "ÔÚËÑÑ°µØַʱ³öÏÖ$(ERR)";
+ Text[ chinese_traditional ] = "¦b·j´M¦a§}®É¥X²{ $(ERR)";
+ Text[ turkish ] = "$(ERR) searching for an address";
+ Text[ arabic ] = "$(ERR) ÃËäÇÁ ÇáÈÍË Úä ÇáÚäæÇä";
+ };
+};
+Resource RID_ERRHDL
+{
+ String ERRCODE_CLASS_ABORT
+ {
+ Text = "Abbruch" ;
+ Text = "Abort" ;
+ };
+ String ERRCODE_CLASS_NOTEXISTS
+ {
+ Text = "Nichtexistentes Objekt" ;
+ Text [ ENGLISH ] = "Nonexistant object" ;
+ Text [ dutch ] = "Object bestaat niet" ;
+ Text [ english_us ] = "Nonexistent object" ;
+ Text [ italian ] = "Oggetto inesistente" ;
+ Text [ spanish ] = "Objeto no existente" ;
+ Text [ french ] = "Cet objet n'existe pas" ;
+ Text [ swedish ] = "Icke-existerande objekt" ;
+ Text [ danish ] = "Ikke-eksisterende objekt" ;
+ Text [ portuguese ] = "Objecto inexistente" ;
+ Text [ portuguese_brazilian ] = "Nichtexistentes Objekt" ;
+ Text[ chinese_simplified ] = "²»´æÔڵĶÔÏó";
+ Text[ russian ] = "Íåñóùåñòâóþùèé îáúåêò";
+ Text[ polish ] = "Nieistniej¹cy obiekt";
+ Text[ japanese ] = "‘¶Ý‚µ‚È‚¢µÌÞ¼Þª¸Ä";
+ Text[ chinese_traditional ] = "¤£¦s¦bªºª«¥ó";
+ Text[ arabic ] = "ßÇÆä ÛíÑ ãæÌæÏ";
+ Text[ dutch ] = "Object bestaat niet";
+ Text[ chinese_simplified ] = "²»´æÔڵĶÔÏó";
+ Text[ greek ] = "Ìç õðáñêôü áíôéêåßìåíï";
+ Text[ korean ] = "¾ø´Â °³Ã¼";
+ Text[ turkish ] = "Mevcut olmayan nesne";
+ };
+ String ERRCODE_CLASS_ALREADYEXISTS
+ {
+ Text = "Objekt existiert bereits" ;
+ Text [ ENGLISH ] = "Object already exists" ;
+ Text [ dutch ] = "Object bestaat reeds" ;
+ Text [ english_us ] = "Object already exists" ;
+ Text [ italian ] = "L'oggetto esiste già" ;
+ Text [ spanish ] = "El objeto ya existe" ;
+ Text [ french ] = "Cet objet existe déjà" ;
+ Text [ swedish ] = "Objekt existerar redan" ;
+ Text [ danish ] = "Objektet eksisterer allerede" ;
+ Text [ portuguese ] = "Objecto já existe" ;
+ Text [ portuguese_brazilian ] = "Objekt existiert bereits" ;
+ Text[ chinese_simplified ] = "¶ÔÏóÒѾ­´æÔÚ";
+ Text[ russian ] = "Îáúåêò óæå ñóùåñòâóåò";
+ Text[ polish ] = "Obiekt ju¿ istnieje";
+ Text[ japanese ] = "µÌÞ¼Þª¸Ä‚Í‚·‚Å‚É‚ ‚è‚Ü‚·";
+ Text[ chinese_traditional ] = "ª«¥ó¤w¸g¦s¦b";
+ Text[ arabic ] = "ÇáßÇÆä ãæÌæÏ ãÓÈÞÇð";
+ Text[ dutch ] = "Object bestaat reeds";
+ Text[ chinese_simplified ] = "¶ÔÏóÒѾ­´æÔÚ";
+ Text[ greek ] = "Ôï áíôéêåßìåíï õðÜñ÷åé Þäç";
+ Text[ korean ] = "°³Ã¼°¡ ÀÌ¹Ì ÀÖÀ½";
+ Text[ turkish ] = "Nesne mevcut";
+ };
+ String ERRCODE_CLASS_ACCESS
+ {
+ Text = "Kein Zugriff auf Objekt" ;
+ Text [ ENGLISH ] = "object could not be accessed" ;
+ Text [ dutch ] = "Geen toegang tot object" ;
+ Text [ english_us ] = "Object not accessible" ;
+ Text [ italian ] = "Accesso all'oggetto non possibile" ;
+ Text [ spanish ] = "No hay acceso al objeto" ;
+ Text [ french ] = "Impossible d'accéder à l'objet" ;
+ Text [ swedish ] = "Ingen åtkomst till objekt" ;
+ Text [ danish ] = "Ingen adgang til objekt" ;
+ Text [ portuguese ] = "Objecto inacessível" ;
+ Text [ portuguese_brazilian ] = "Kein Zugriff auf Objekt" ;
+ Text[ chinese_simplified ] = "²»Äܹ»¶ÁÈ¡¶ÔÏó";
+ Text[ russian ] = "Îáúåêò íå äîñòóïåí";
+ Text[ polish ] = "Obiekt niedostêpny";
+ Text[ japanese ] = "µÌÞ¼Þª¸Ä‚ɱ¸¾½‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "¤£¯à°÷Ū¨úª«¥ó";
+ Text[ arabic ] = "áÇ íãßä ÇáæÕæá Åáì ÇáßÇÆä";
+ Text[ dutch ] = "Geen toegang tot object";
+ Text[ chinese_simplified ] = "²»Äܹ»¶ÁÈ¡¶ÔÏó";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá ãßíåé ðñüóâáóç óôï áíôéêåßìåíï.";
+ Text[ korean ] = "°³Ã¼¿¡ ¾×¼¼½º ¸øÇÔ";
+ Text[ turkish ] = "Nesneye eriþim saðlanamýyor";
+ };
+ String ERRCODE_CLASS_PATH
+ {
+ Text = "Unzulässiger Pfad" ;
+ Text [ ENGLISH ] = "Invalid path" ;
+ Text [ dutch ] = "Ongeoorloofd pad" ;
+ Text [ english_us ] = "Inadmissable path" ;
+ Text [ italian ] = "Percorso incorretto" ;
+ Text [ spanish ] = "Ruta no autorizada" ;
+ Text [ french ] = "Chemin incorrect" ;
+ Text [ swedish ] = "Otillåten sökväg" ;
+ Text [ danish ] = "Ugyldig sti" ;
+ Text [ portuguese ] = "Atalho não autorizado" ;
+ Text [ portuguese_brazilian ] = "Unzulässiger Pfad" ;
+ Text[ chinese_simplified ] = "·¾¶ÎÞЧ";
+ Text[ russian ] = "Íåäîïóñòèìûé ïóòü";
+ Text[ polish ] = "Niedopuszczalna œcie¿ka";
+ Text[ japanese ] = "•s‹–‰Â‚ÌÊß½";
+ Text[ chinese_traditional ] = "¸ô®|µL®Ä";
+ Text[ arabic ] = "ãÓÇÑ ãÍÙæÑ";
+ Text[ dutch ] = "Ongeoorloofd pad";
+ Text[ chinese_simplified ] = "·¾¶ÎÞЧ";
+ Text[ greek ] = "Ìç Ýãêõñç äéáäñïìÞ";
+ Text[ korean ] = "Çã¿ëµÇÁö ¾Ê´Â °æ·Î";
+ Text[ turkish ] = "Geçersiz veri yolu";
+ };
+ String ERRCODE_CLASS_LOCKING
+ {
+ Text = "Lockingproblem" ;
+ Text [ ENGLISH ] = "Sharing conflict" ;
+ Text [ dutch ] = "Locking-probleem" ;
+ Text [ english_us ] = "Locking problem" ;
+ Text [ italian ] = "Problema di locking" ;
+ Text [ spanish ] = "Problema de bloqueo" ;
+ Text [ french ] = "Problème de verrouillage" ;
+ Text [ swedish ] = "Låsproblem" ;
+ Text [ danish ] = "Låseproblem" ;
+ Text [ portuguese ] = "Problema de bloqueio" ;
+ Text [ portuguese_brazilian ] = "Lockingproblem" ;
+ Text[ chinese_simplified ] = "Ëø¶¨³åÍ»";
+ Text[ russian ] = "Ïðîáëåìà âõîäà â ñèñòåìó";
+ Text[ polish ] = "Problem blokady";
+ Text[ japanese ] = "‹¤—LÕ“Ë";
+ Text[ language_user1 ] = " ";
+ Text[ chinese_traditional ] = "ÀÉ®×Âê©w½Ä¬ð";
+ Text[ arabic ] = "ãÔßáÉ Ýí ÇáÊÃãíä";
+ Text[ dutch ] = "Locking-probleem";
+ Text[ chinese_simplified ] = "Ëø¶¨³åÍ»";
+ Text[ greek ] = "Ðñüâëçìá êëåéäþìáôïò";
+ Text[ korean ] = "Àá±Ý ¹®Á¦";
+ Text[ turkish ] = "Kenetlenme sorunu";
+ };
+ String ERRCODE_CLASS_PARAMETER
+ {
+ Text = "Falscher Parameter" ;
+ Text [ ENGLISH ] = "Wrong parameter" ;
+ Text [ english_us ] = "Wrong parameter" ;
+ Text [ italian ] = "Parametro errato" ;
+ Text [ spanish ] = "Parámetro falso" ;
+ Text [ french ] = "Erreur de paramètre" ;
+ Text [ dutch ] = "Verkeerde parameter" ;
+ Text [ swedish ] = "Felaktig parameter" ;
+ Text [ danish ] = "Forkert parameter" ;
+ Text [ portuguese ] = "Parâmetro incorrecto" ;
+ Text [ portuguese_brazilian ] = "Falscher Parameter" ;
+ Text[ chinese_simplified ] = "ÎÞЧµÄ²ÎÊý";
+ Text[ russian ] = "Íåïðàâèëüíûé ïàðàìåòð";
+ Text[ polish ] = "Nieprawid³owy parametr";
+ Text[ japanese ] = "³‚µ‚­‚È‚¢Êß×Ò°À";
+ Text[ chinese_traditional ] = "§UÅܶqµL®Ä";
+ Text[ arabic ] = "ãÚáãÉ ÎÇØÆÉ";
+ Text[ dutch ] = "Verkeerde parameter";
+ Text[ chinese_simplified ] = "ÎÞЧµÄ²ÎÊý";
+ Text[ greek ] = "ËÜèïò ðáñÜìåôñïò";
+ Text[ korean ] = "Ʋ¸° ÆĶó¹ÌÅÍ";
+ Text[ turkish ] = "Yanlýþ parametre";
+ };
+ String ERRCODE_CLASS_SPACE
+ {
+ Text = "Resource erschöpft" ;
+ Text [ ENGLISH ] = "No space left" ;
+ Text [ dutch ] = "Resource uitgeput" ;
+ Text [ english_us ] = "Resource exhausted" ;
+ Text [ italian ] = "Risorse esaurite" ;
+ Text [ spanish ] = "No hay recursos diponibles" ;
+ Text [ french ] = "Ressource épuisée" ;
+ Text [ swedish ] = "Inga resurser kvar" ;
+ Text [ danish ] = "Ressource opbrugt" ;
+ Text [ portuguese ] = "Recursos esgotados" ;
+ Text [ portuguese_brazilian ] = "Resource erschöpft" ;
+ Text[ chinese_simplified ] = "×ÊÔ´ÒѾ­ÓÃÍê";
+ Text[ russian ] = "Ðåñóðñû èñ÷åðïàíû";
+ Text[ polish ] = "Wyczerpany zasób";
+ Text[ japanese ] = "Ø¿°½‚ªŽg‚¢s‚­‚³‚ê‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "¸ê·½¤w¸g¥ÎºÉ";
+ Text[ arabic ] = "Êã ÇÓÊåáÇß ÇáãÕÏÑ ßáå";
+ Text[ dutch ] = "Resource uitgeput";
+ Text[ chinese_simplified ] = "×ÊÔ´ÒѾ­ÓÃÍê";
+ Text[ greek ] = "Ïé ðüñïé åîáíôëÞèçêáí";
+ Text[ korean ] = "¸®¼Ò½º °í°¥";
+ Text[ turkish ] = "Kaynak tükendi";
+ };
+ String ERRCODE_CLASS_NOTSUPPORTED
+ {
+ Text = "Aktion nicht unterstützt" ;
+ Text [ ENGLISH ] = "Action not supported" ;
+ Text [ dutch ] = "Activiteit wordt niet ondersteund" ;
+ Text [ english_us ] = "Action not supported" ;
+ Text [ italian ] = "Operazione non supportata" ;
+ Text [ spanish ] = "Acción no apoyada" ;
+ Text [ french ] = "Action non soutenue" ;
+ Text [ swedish ] = "Åtgärd inte understödd" ;
+ Text [ danish ] = "Handlingen understøttes ikke" ;
+ Text [ portuguese ] = "Acção sem suporte" ;
+ Text [ portuguese_brazilian ] = "Aktion nicht unterstützt" ;
+ Text[ chinese_simplified ] = "²Ù×÷²»ÊÜÖ§³Ö";
+ Text[ russian ] = "Äåéñòâèå íå ïîääåðæèâàåòñÿ";
+ Text[ polish ] = "Akcja nie jest obs³ugiwana";
+ Text[ japanese ] = "±¸¼®Ý‚ÍŽx‰‡‚³‚ê‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "¾Þ§@¤£¨ü¤ä´©";
+ Text[ arabic ] = "åÐÇ ÇáÅÌÑÇÁ áÇ íõÏÚã";
+ Text[ dutch ] = "Activiteit wordt niet ondersteund";
+ Text[ chinese_simplified ] = "²Ù×÷²»ÊÜÖ§³Ö";
+ Text[ greek ] = "Ç åíÝñãåéá äåí õðïóôçñßæåôáé";
+ Text[ korean ] = "ÀÛ¾÷À» Áö¿øÇÏÁö ¾ÊÀ½";
+ Text[ turkish ] = "Ýþlem desteklenmiyor";
+ };
+ String ERRCODE_CLASS_READ
+ {
+ Text = "Leseproblem" ;
+ Text [ ENGLISH ] = "Read problem" ;
+ Text [ english_us ] = "Read Error" ;
+ Text [ italian ] = "Errore di lettura" ;
+ Text [ spanish ] = "Error de lectura" ;
+ Text [ french ] = "Erreur de lecture" ;
+ Text [ dutch ] = "Probleem bij lezen" ;
+ Text [ swedish ] = "Läsproblem" ;
+ Text [ danish ] = "Læsefejl" ;
+ Text [ portuguese ] = "Erro de leitura" ;
+ Text [ portuguese_brazilian ] = "Leseproblem" ;
+ Text[ chinese_simplified ] = "¶ÁÈ¡´íÎó";
+ Text[ russian ] = "Ïðîáëåìà ñ÷èòûâàíèÿ";
+ Text[ polish ] = "B³¹d odczytu";
+ Text[ japanese ] = "“Ç‚ÝŽæ‚è´×°";
+ Text[ chinese_traditional ] = "Ū¨ú¿ù»~";
+ Text[ arabic ] = "ÎØÃ Ýí ÇáÞÑÇÁÉ";
+ Text[ dutch ] = "Probleem bij lezen";
+ Text[ chinese_simplified ] = "¶ÁÈ¡´íÎó";
+ Text[ greek ] = "ÓöÜëìá áíÜãíùóçò";
+ Text[ korean ] = "Àб⠿À·ù";
+ Text[ turkish ] = "Okuma hatasý";
+ };
+ String ERRCODE_CLASS_WRITE
+ {
+ Text = "Schreibproblem" ;
+ Text [ ENGLISH ] = "Write problem" ;
+ Text [ dutch ] = "Probleem bij schrijven" ;
+ Text [ english_us ] = "Write Error" ;
+ Text [ italian ] = "Errore di scrittura" ;
+ Text [ spanish ] = "Error de escritura" ;
+ Text [ french ] = "Erreur d'écriture" ;
+ Text [ swedish ] = "Skrivproblem" ;
+ Text [ danish ] = "Skrivefejl" ;
+ Text [ portuguese ] = "Erro de escrita" ;
+ Text [ portuguese_brazilian ] = "Schreibproblem" ;
+ Text[ chinese_simplified ] = "¸²Ð´´íÎó";
+ Text[ russian ] = "Ïðîáëåìà çàïèñè";
+ Text[ polish ] = "B³¹d zapisu";
+ Text[ japanese ] = "‘‚«ž‚Ý´×°";
+ Text[ chinese_traditional ] = "Âмg¿ù»~";
+ Text[ arabic ] = "ÎØà Ýí ÇáßÊÇÈÉ";
+ Text[ dutch ] = "Probleem bij schrijven";
+ Text[ chinese_simplified ] = "¸²Ð´´íÎó";
+ Text[ greek ] = "ÓöÜëìá åããñáöÞò";
+ Text[ korean ] = "¾²±â ¿À·ù";
+ Text[ turkish ] = "Yazma hatasý";
+ };
+ String ERRCODE_CLASS_UNKNOWN
+ {
+ Text = "Unbekannt" ;
+ Text [ ENGLISH ] = "Error class is unknown" ;
+ Text [ dutch ] = "Onbekend" ;
+ Text [ english_us ] = "unknown" ;
+ Text [ italian ] = "Sconosciuto" ;
+ Text [ spanish ] = "Desconocido" ;
+ Text [ french ] = "Inconnu" ;
+ Text [ swedish ] = "Obekant" ;
+ Text [ danish ] = "Ukendt" ;
+ Text [ portuguese ] = "Desconhecido" ;
+ Text [ portuguese_brazilian ] = "Unbekannt" ;
+ Text[ chinese_simplified ] = "²»Ã÷";
+ Text[ russian ] = "Íåèçâåñòíî";
+ Text[ polish ] = "Nieznany";
+ Text[ japanese ] = "•s–¾";
+ Text[ chinese_traditional ] = "¤£©ú";
+ Text[ arabic ] = "ÛíÑ ãÚÑæÝ";
+ Text[ dutch ] = "Onbekend";
+ Text[ chinese_simplified ] = "²»Ã÷";
+ Text[ greek ] = "¢ãíùóôï";
+ Text[ korean ] = "¾Ë·ÁÁöÁö ¾ÊÀ½";
+ Text[ turkish ] = "Bilinmiyor";
+ };
+ String ERRCODE_CLASS_VERSION
+ {
+ Text = "Versionskonflikt" ;
+ Text [ ENGLISH ] = "Incompatible Version" ;
+ Text [ english_us ] = "Version Incompatibility" ;
+ Text [ italian ] = "Conflitto di versione" ;
+ Text [ spanish ] = "Versiones incompatibles" ;
+ Text [ french ] = "Incompatibilité entre versions" ;
+ Text [ dutch ] = "Incompatibele versie" ;
+ Text [ swedish ] = "Versionskonflikt" ;
+ Text [ danish ] = "Versionskonflikt" ;
+ Text [ portuguese ] = "Incompatibilidade entre versões" ;
+ Text [ portuguese_brazilian ] = "Versionskonflikt" ;
+ Text[ chinese_simplified ] = "°æ±¾³åÍ»";
+ Text[ russian ] = "Íåñîâìåñòèìîñòü âåðñèé";
+ Text[ polish ] = "Niezgodna wersja";
+ Text[ japanese ] = "ÊÞ°¼Þ®Ýˆá”½";
+ Text[ chinese_traditional ] = "ª©¥»½Ä¬ð";
+ Text[ arabic ] = "ÅÕÏÇÑÇÊ ÛíÑ ãÊæÇÝÞÉ";
+ Text[ dutch ] = "Incompatibele versie";
+ Text[ chinese_simplified ] = "°æ±¾³åÍ»";
+ Text[ greek ] = "ÄéÝíåîç Ýêäïóçò";
+ Text[ korean ] = "ȣȯµÇÁö ¾Ê´Â ¹öÀü";
+ Text[ turkish ] = "Sürüm uyumsuzluðu";
+ };
+ String ERRCODE_CLASS_GENERAL
+ {
+ Text = "Allgemeiner Fehler" ;
+ Text [ ENGLISH ] = "General Error" ;
+ Text [ dutch ] = "Algemene fout" ;
+ Text [ english_us ] = "General Error" ;
+ Text [ italian ] = "Errore generale" ;
+ Text [ spanish ] = "Error general" ;
+ Text [ french ] = "Erreur générale" ;
+ Text [ swedish ] = "Allmänt fel" ;
+ Text [ danish ] = "Generel fejl" ;
+ Text [ portuguese ] = "Erro geral" ;
+ Text [ portuguese_brazilian ] = "Allgemeiner Fehler" ;
+ Text[ chinese_simplified ] = "Ò»°ã´íÎó";
+ Text[ russian ] = "Îáùàÿ îøèáêà";
+ Text[ polish ] = "B³¹d ogólny";
+ Text[ japanese ] = "ˆê”Ê“I‚È´×°";
+ Text[ chinese_traditional ] = "¤@¯ë¿ù»~";
+ Text[ arabic ] = "ÎØÃ ÚÇã";
+ Text[ dutch ] = "Algemene fout";
+ Text[ chinese_simplified ] = "Ò»°ã´íÎó";
+ Text[ greek ] = "Ãåíéêü óöÜëìá";
+ Text[ korean ] = "ÀϹÝÀû ¿À·ù";
+ Text[ turkish ] = "Genel hata";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_CLASS_FORMAT
+ {
+ Text = "Falsches Format" ;
+ Text [ ENGLISH ] = "Wrong format" ;
+ Text [ dutch ] = "Foutief formaat" ;
+ Text [ english_us ] = "Incorrect format" ;
+ Text [ italian ] = "Formato errato" ;
+ Text [ spanish ] = "Formato incorrecto" ;
+ Text [ french ] = "Erreur de format" ;
+ Text [ swedish ] = "Felaktigt format" ;
+ Text [ danish ] = "Forkert format" ;
+ Text [ portuguese ] = "Formato incorrecto" ;
+ Text [ portuguese_brazilian ] = "Falsches Format" ;
+ Text[ chinese_simplified ] = "´íÎóµÄ¸ñʽ";
+ Text[ russian ] = "Íåïðàâèëüíûé ôîðìàò";
+ Text[ polish ] = "Nieprawid³owy format";
+ Text[ japanese ] = "³‚µ‚­‚È‚¢‘Ž®";
+ Text[ chinese_traditional ] = "®æ¦¡µL®Ä";
+ Text[ arabic ] = "ÊäÓíÞ ÎÇØÆ";
+ Text[ dutch ] = "Foutief formaat";
+ Text[ chinese_simplified ] = "´íÎóµÄ¸ñʽ";
+ Text[ greek ] = "Ìç áðïäåêôÞ ìïñöÞ";
+ Text[ korean ] = "Ʋ¸° ¼­½Ä";
+ Text[ turkish ] = "Yanlýþ format";
+ };
+ String ERRCODE_CLASS_CREATE
+ {
+ Text = "Fehler beim Anlegen" ;
+ Text [ ENGLISH ] = "Create error" ;
+ Text [ dutch ] = "Fout bij maken van object" ;
+ Text [ english_us ] = "Error creating object" ;
+ Text [ italian ] = "Errore durante la creazione" ;
+ Text [ spanish ] = "Error al crear" ;
+ Text [ french ] = "Erreur lors de la création" ;
+ Text [ swedish ] = "Fel vid uppläggning" ;
+ Text [ danish ] = "Fejl under oprettelsen" ;
+ Text [ portuguese ] = "Erro ao criar" ;
+ Text [ portuguese_brazilian ] = "Fehler beim Anlegen" ;
+ Text[ chinese_simplified ] = "½¨Á¢¶ÔÏóʱ·¢Éú´íÎó";
+ Text[ russian ] = "Îøèáêà ïðè ñîçäàíèè";
+ Text[ polish ] = "B³¹d przy tworzeniu obiektu";
+ Text[ japanese ] = "쬂ÌÛ‚Ì´×°";
+ Text[ chinese_traditional ] = "µo¥Í¿ù»~¦b«Ø¥ß";
+ Text[ arabic ] = "ÎØà ÃËäÇÁ ÇáÅäÔÇÁ";
+ Text[ dutch ] = "Fout bij maken van object";
+ Text[ chinese_simplified ] = "½¨Á¢¶ÔÏóʱ·¢Éú´íÎó";
+ Text[ greek ] = "ÓöÜëìá êáôÜ ôçí äçìéïõñãßá";
+ Text[ korean ] = "°³Ã¼ ÀÛ¼º½Ã ¿À·ù";
+ Text[ turkish ] = "Oluþturma hatasý";
+ };
+ String ERRCODE_CLASS_SBX
+ {
+ Text = "Unzulässiger Wert oder Datentyp" ;
+ Text [ ENGLISH ] = "Invalid value or data type" ;
+ Text [ english_us ] = "Inadmissable value or data type" ;
+ Text [ italian ] = "Valore o tipo di dati non permesso" ;
+ Text [ spanish ] = "Valor o tipo de datos inadmisible" ;
+ Text [ french ] = "Valeur ou type de données incorrect(e)" ;
+ Text [ dutch ] = "Niet toegestane waarde of gegevenstype" ;
+ Text [ swedish ] = "Otillåtet värde eller datatyp" ;
+ Text [ danish ] = "Ikke-tilladt værdi eller datatype" ;
+ Text [ portuguese ] = "Valor ou tipo de dados não autorizados" ;
+ Text [ portuguese_brazilian ] = "Unzulässiger Wert oder Datentyp" ;
+ Text[ chinese_simplified ] = "ÎÞЧµÄÊýÖµ»òÊý¾ÝÀàÐÍ";
+ Text[ russian ] = "Çíà÷åíèå èëè òèï äàííûõ íå äîïóñòèìû";
+ Text[ polish ] = "Niedopuszczalna wartoϾ lub typ pliku";
+ Text[ japanese ] = "•s‹–‰Â‚Ì’l‚Ü‚½‚ÍÃÞ°ÀÀ²Ìß";
+ Text[ chinese_traditional ] = "¼Æ­È©Î¸ê®ÆÃþ«¬µL®Ä";
+ Text[ arabic ] = "ÞãíÉ ãÍÙæÑÉ¡ Ãæ äæÚ ÈíÇäÇÊ ãÍÙæÑ";
+ Text[ dutch ] = "Niet toegestane waarde of gegevenstype";
+ Text[ chinese_simplified ] = "ÎÞЧµÄÊýÖµ»òÊý¾ÝÀàÐÍ";
+ Text[ greek ] = "Ìç áðïäåêôÞ ôéìÞ Þ ôýðïò äåäïìÝíùí";
+ Text[ korean ] = "Çã¿ëµÇÁö ¾Ê´Â °ª ¶Ç´Â µ¥ÀÌÅÍ À¯Çü";
+ Text[ turkish ] = "Geçersiz deðer ya da veri tipi";
+ };
+ String ERRCODE_CLASS_RUNTIME
+ {
+ Text = "BASIC-Laufzeitfehler" ;
+ Text [ ENGLISH ] = "BASIC runtime error" ;
+ Text [ dutch ] = "BASIC runtime error" ;
+ Text [ english_us ] = "BASIC runtime error" ;
+ Text [ italian ] = "Errore di runtime basic" ;
+ Text [ spanish ] = "Error de ejecución de BASIC" ;
+ Text [ french ] = "Runtime error BASIC" ;
+ Text [ swedish ] = "BASIC-runtimefel" ;
+ Text [ danish ] = "BASIC-runtimefejl" ;
+ Text [ portuguese ] = "Erro de rotina BASIC" ;
+ Text [ portuguese_brazilian ] = "Basic-Laufzeitfehler" ;
+ Text[ chinese_simplified ] = "BASIC ÔËÐÐʱ¼ä´íÎó";
+ Text[ russian ] = "Îøèáêà ïðè âûïîëíåíèè BASIC";
+ Text[ polish ] = "B³¹d czasu przebiegu BASIC";
+ Text[ japanese ] = "BASIC‚Ì×ÝÀ²Ñ ´×°";
+ Text[ chinese_traditional ] = "BASIC ¹B¦æ®É¶¡¿ù»~";
+ Text[ arabic ] = "ÎØÃ Ýí æÞÊ ÊÔÛíá BASIC";
+ Text[ dutch ] = "BASIC runtime error";
+ Text[ chinese_simplified ] = "BASIC ÔËÐÐʱ¼ä´íÎó";
+ Text[ greek ] = "ÓöÜëìá ÷ñüíïõ åêôÝëåóçò BASIC";
+ Text[ korean ] = "BASIC ½ÇÇà½Ã°£ ¿À·ù";
+ Text[ turkish ] = "BASIC yürütüm süresi hatasý";
+ };
+ String ERRCODE_CLASS_COMPILER
+ {
+ Text = "BASIC-Syntaxfehler" ;
+ Text [ ENGLISH ] = "BASIC syntax error" ;
+ Text [ portuguese ] = "Erro de sintaxe BASIC" ;
+ Text [ english_us ] = "BASIC syntax error" ;
+ Text [ portuguese_brazilian ] = "Basic-Compilerfehler" ;
+ Text [ swedish ] = "BASIC-syntaxfel" ;
+ Text [ danish ] = "BASIC-syntaksfejl" ;
+ Text [ italian ] = "Errore di sintassi BASIC" ;
+ Text [ spanish ] = "Error de sintaxis de BASIC" ;
+ Text [ french ] = "Syntax error BASIC" ;
+ Text [ dutch ] = "BASIC syntax error" ;
+ Text[ chinese_simplified ] = "BASIC Óï·¨´íÎó";
+ Text[ russian ] = "Ñèíòàêñè÷åñêàÿ îøèáêà BASIC";
+ Text[ polish ] = "B³¹d sk³adni BASIC";
+ Text[ japanese ] = "BASIC‚̼ÝÀ¯¸½´×°";
+ Text[ chinese_traditional ] = "BASIC »yªk¿ù»~";
+ Text[ arabic ] = "ÎØà Ýí ÈäÇÁ ÌãáÉ BASIC";
+ Text[ dutch ] = "BASIC syntax error";
+ Text[ chinese_simplified ] = "BASIC Óï·¨´íÎó";
+ Text[ greek ] = "ÓöÜëìá óýíôáîçò BASIC";
+ Text[ korean ] = "BASIC ¹®Àå ¿À·ù";
+ Text[ turkish ] = "BASIC söz dizimi hatasý";
+ };
+ String 1
+ {
+ Text = "Allgemeiner Fehler" ;
+ Text [ ENGLISH ] = "General Error" ;
+ Text [ dutch ] = "Algemene fout" ;
+ Text [ english_us ] = "General Error" ;
+ Text [ italian ] = "Errore generale" ;
+ Text [ spanish ] = "Error general" ;
+ Text [ french ] = "Erreur générale" ;
+ Text [ swedish ] = "Allmänt fel" ;
+ Text [ danish ] = "Generel fejl" ;
+ Text [ portuguese ] = "Erro geral" ;
+ Text [ portuguese_brazilian ] = "Allgemeiner Fehler" ;
+ Text[ chinese_simplified ] = "Ò»°ã´íÎó";
+ Text[ russian ] = "Îáùàÿ îøèáêà";
+ Text[ polish ] = "B³¹d ogólny";
+ Text[ japanese ] = "ˆê”Ê“I‚È´×°";
+ Text[ chinese_traditional ] = "¤@¯ëªº¿ù»~";
+ Text[ arabic ] = "ÎØÃ ÚÇã";
+ Text[ dutch ] = "Algemene fout";
+ Text[ chinese_simplified ] = "Ò»°ã´íÎó";
+ Text[ greek ] = "Ãåíéêü óöÜëìá";
+ Text[ korean ] = "ÀϹÝÀû ¿À·ù";
+ Text[ turkish ] = "Genel hata";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_IO_GENERAL
+ {
+ Text = "Allgemeiner Ein-/Ausgabefehler" ;
+ Text [ ENGLISH ] = "General input/output error" ;
+ Text [ dutch ] = "Algemene input/output error" ;
+ Text [ english_us ] = "General input/output error" ;
+ Text [ italian ] = "Errore generale di I/O" ;
+ Text [ spanish ] = "Error general de entrada/salida" ;
+ Text [ french ] = "Erreur générale d'entrée/sortie" ;
+ Text [ swedish ] = "Allmänt input-/outputfel" ;
+ Text [ danish ] = "Generel input-/outputfejl" ;
+ Text [ portuguese ] = "Erro geral de entrada/saída." ;
+ Text [ portuguese_brazilian ] = "Allgemeiner Ein-/Ausgabefehler" ;
+ Text[ chinese_simplified ] = "Ò»°ãµÄÊäÈëÓëÊä³ö´íÎó";
+ Text[ russian ] = "Îáùàÿ îøèáêà ââîäà-âûâîäà";
+ Text[ polish ] = "Ogólny b³¹d wejœcia/wyjœcia";
+ Text[ japanese ] = "ˆê”Ê“I‚È I/O ´×°";
+ Text[ chinese_traditional ] = "¤@¯ëªº¿é¤J/¿é¥X¿ù»~";
+ Text[ arabic ] = "ÍÏË ÎØÃ ÅÏÎÇá/ÅÎÑÇÌ ÚÇã";
+ Text[ dutch ] = "Algemene input/output error";
+ Text[ chinese_simplified ] = "Ò»°ãµÄÊäÈëÓëÊä³ö´íÎó";
+ Text[ greek ] = "Ãåíéêü óöÜëìá åéóáãùãÞò/åîáãùãÞò";
+ Text[ korean ] = "ÀϹÝÀû ÀÔ·Â/Ãâ·Â ¿À·ù";
+ Text[ turkish ] = "Genel girdi/çýktý hatasý";
+ };
+ String ERRCODE_IO_MISPLACEDCHAR
+ {
+ Text = "Der Name der Datei ist ungültig" ;
+ Text [ ENGLISH ] = "Invalid filename" ;
+ Text [ dutch ] = "Ongeldige bestandsnaam" ;
+ Text [ english_us ] = "Invalid file name" ;
+ Text [ italian ] = "Il nome del file non è valido" ;
+ Text [ spanish ] = "El nombre del archivo no es válido." ;
+ Text [ french ] = "Nom de fichier incorrect" ;
+ Text [ swedish ] = "Namnet på filen är ogiltigt" ;
+ Text [ danish ] = "Filnavnet er ugyldigt" ;
+ Text [ portuguese ] = "O nome do ficheiro não é válido." ;
+ Text [ portuguese_brazilian ] = "Der Name der Datei ist ungültig" ;
+ Text[ chinese_simplified ] = "ÎÞЧµÄÎļþÃû";
+ Text[ russian ] = "Íåïðàâèëüíîå èìÿ ôàéëà";
+ Text[ polish ] = "Nazwa pliku jest nieprawid³owa";
+ Text[ japanese ] = "̧²Ù–¼‚Í–³Œø‚Å‚·";
+ Text[ chinese_traditional ] = "ÀɮצWµL®Ä";
+ Text[ arabic ] = "ÇÓã ÇáãáÝ ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "Ongeldige bestandsnaam";
+ Text[ chinese_simplified ] = "ÎÞЧµÄÎļþÃû";
+ Text[ greek ] = "Ôï üíïìá ôïõ áñ÷åßïõ äåí åßíáé Ýãêõñï";
+ Text[ korean ] = "ÆÄÀÏ À̸§ÀÌ À¯È¿ÇÏÁö ¾ÊÀ½";
+ Text[ turkish ] = "Dosyanýn adý geçerli deðil";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_IO_NOTEXISTS
+ {
+ Text = "Die Datei existiert nicht" ;
+ Text [ ENGLISH ] = "Nonexistant file" ;
+ Text [ dutch ] = "Bestand bestaat niet" ;
+ Text [ english_us ] = "Nonexistent file" ;
+ Text [ italian ] = "Il file non esiste" ;
+ Text [ spanish ] = "El archivo no existe" ;
+ Text [ french ] = "Fichier inexistant" ;
+ Text [ swedish ] = "Filen existerar inte" ;
+ Text [ danish ] = "Filen eksisterer ikke" ;
+ Text [ portuguese ] = "O ficheiro não existe." ;
+ Text [ portuguese_brazilian ] = "Die Datei existiert nicht" ;
+ Text[ chinese_simplified ] = "Îļþ²»´æÔÚ";
+ Text[ russian ] = "Ýòîò ôàéë íå ñóùåñòâóåò";
+ Text[ polish ] = "Plik nie istnieje";
+ Text[ japanese ] = "̧²Ù‚Í‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "Àɮפ£¦s¦b";
+ Text[ arabic ] = "ÇáãáÝ ÛíÑ ãæÌæÏ";
+ Text[ dutch ] = "Bestand bestaat niet";
+ Text[ chinese_simplified ] = "Îļþ²»´æÔÚ";
+ Text[ greek ] = "Ôï áñ÷åßï äåí õðÜñ÷åé";
+ Text[ korean ] = "ÆÄÀÏÀÌ ¾øÀ½";
+ Text[ turkish ] = "Dosya mevcut deðil";
+ };
+ String ERRCODE_IO_ALREADYEXISTS
+ {
+ Text = "Die Datei existiert bereits" ;
+ Text [ ENGLISH ] = "Nonexistant file" ;
+ Text [ dutch ] = "Bestand bestaat reeds" ;
+ Text [ english_us ] = "File already exists" ;
+ Text [ italian ] = "Il file esiste già" ;
+ Text [ spanish ] = "El archivo ya existe" ;
+ Text [ french ] = "Un fichier de ce nom existe déjà." ;
+ Text [ swedish ] = "Filen existerar redan" ;
+ Text [ danish ] = "Filen eksisterer allerede" ;
+ Text [ portuguese ] = "O ficheiro já existe." ;
+ Text [ portuguese_brazilian ] = "Die Datei existiert bereits" ;
+ Text[ chinese_simplified ] = "Õâ¸öÎļþÒѾ­´æÔÚ";
+ Text[ russian ] = "Òàêîé ôàéë óæå ñóùåñòâóåò";
+ Text[ polish ] = "Plik ju¿ istnieje";
+ Text[ japanese ] = "̧²Ù‚Í‚·‚Å‚É‚ ‚è‚Ü‚·";
+ Text[ chinese_traditional ] = "³o­ÓÀɮפw¸g¦s¦b";
+ Text[ arabic ] = "ÇáãáÝ ãæÌæÏ ãÓÈÞÇð";
+ Text[ dutch ] = "Bestand bestaat reeds";
+ Text[ chinese_simplified ] = "Õâ¸öÎļþÒѾ­´æÔÚ";
+ Text[ greek ] = "Ôï áñ÷åßï õðÜñ÷åé Þäç";
+ Text[ korean ] = "ÆÄÀÏÀÌ ÀÌ¹Ì ÀÖÀ½";
+ Text[ turkish ] = "Dosya mevcut";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_IO_NOTADIRECTORY
+ {
+ Text = "Bei dem Objekt handelt es sich nicht um ein Verzeichnis" ;
+ Text [ ENGLISH ] = "The object is not a directory" ;
+ Text [ english_us ] = "The object is not a directory" ;
+ Text [ italian ] = "L'oggetto non è una cartella" ;
+ Text [ spanish ] = "El objeto no es un directorio." ;
+ Text [ french ] = "L'objet indiqué n'est pas un répertoire" ;
+ Text [ dutch ] = "Object is geen directory" ;
+ Text [ swedish ] = "Objektet är ingen katalog" ;
+ Text [ danish ] = "Objektet er ikke et bibliotek" ;
+ Text [ portuguese ] = "O objecto não é um directório." ;
+ Text [ portuguese_brazilian ] = "Bei dem Objekt handelt es sich nicht um ein Verzeichnis" ;
+ Text[ chinese_simplified ] = "¶ÔÏó²»ÊÇÒ»¸öĿ¼";
+ Text[ russian ] = "Ýòîò îáúåêò íå ÿâëÿåòñÿ êàòàëîãîì";
+ Text[ polish ] = "Ten obiekt nie jest katalogiem";
+ Text[ japanese ] = "µÌÞ¼Þª¸Ä‚ÍÃÞ¨Ú¸ÄØ‚Å‚Í‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "ª«¥ó¤£¬O¤@­Ó¥Ø¿ý";
+ Text[ arabic ] = "åÐÇ ÇáßÇÆä áíÓ ÏáíáÇð";
+ Text[ dutch ] = "Object is geen directory";
+ Text[ chinese_simplified ] = "¶ÔÏó²»ÊÇÒ»¸öĿ¼";
+ Text[ greek ] = "Ôï áíôéêåßìåíï äåí åßíáé êáôÜëïãïò";
+ Text[ korean ] = "°³Ã¼´Â µð·ºÅ丮°¡ ¾Æ´Ô";
+ Text[ turkish ] = "Nesne, dizin deðil";
+ };
+ String ERRCODE_IO_NOTAFILE
+ {
+ Text = "Bei dem Objekt handelt es sich nicht um eine Datei" ;
+ Text [ ENGLISH ] = "The object is not a file" ;
+ Text [ english_us ] = "The object is not a file" ;
+ Text [ italian ] = "L'oggetto non è un file" ;
+ Text [ spanish ] = "El objeto no es ningún archivo." ;
+ Text [ french ] = "L'objet indiqué n'est pas un fichier" ;
+ Text [ dutch ] = "Object is geen bestand" ;
+ Text [ swedish ] = "Objektet är ingen fil" ;
+ Text [ danish ] = "Objektet er ikke en fil" ;
+ Text [ portuguese ] = "O objecto não é um ficheiro." ;
+ Text [ portuguese_brazilian ] = "Bei dem Objekt handelt es sich nicht um eine Datei" ;
+ Text[ chinese_simplified ] = "¶ÔÏó²»ÊÇÒ»¸öÎļþ";
+ Text[ russian ] = "Ýòîò îáúåêò íå ÿâëÿåòñÿ ôàéëîì";
+ Text[ polish ] = "Ten obiekt nie jest plikiem";
+ Text[ japanese ] = "µÌÞ¼Þª¸Ä‚Í̧²Ù‚Å‚Í‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "ª«¥ó¤£¬O¤@­ÓÀÉ®×";
+ Text[ arabic ] = "åÐÇ ÇáßÇÆä áíÓ ãáÝÇð";
+ Text[ dutch ] = "Object is geen bestand";
+ Text[ chinese_simplified ] = "¶ÔÏó²»ÊÇÒ»¸öÎļþ";
+ Text[ greek ] = "Ôï åðéëåãìÝíï áíôéêåßìåíï äåí åßíáé áñ÷åßï";
+ Text[ korean ] = "°³Ã¼´Â ÆÄÀÏÀÌ ¾Æ´Ô";
+ Text[ turkish ] = "Nesne, dosya deðil";
+ };
+ String ERRCODE_IO_INVALIDDEVICE
+ {
+ Text = "Das angegebene Gerät ist ungültig" ;
+ Text [ ENGLISH ] = "The device is invalid" ;
+ Text [ dutch ] = "Het aangegeven apparaat bestaat niet." ;
+ Text [ english_us ] = "The specified device is invalid" ;
+ Text [ italian ] = "L'apparecchiatura indicata non è valida" ;
+ Text [ spanish ] = "El dispositivo especificado no es válido." ;
+ Text [ french ] = "Le périphérique indiqué est incorrect" ;
+ Text [ swedish ] = "Den angivna apparaten är ogiltig" ;
+ Text [ danish ] = "Den angivne enhed er ugyldig" ;
+ Text [ portuguese ] = "O periférico indicado não é válido." ;
+ Text [ portuguese_brazilian ] = "Das angebene Gerät ist ungültig" ;
+ Text[ chinese_simplified ] = "Ö¸¶¨µÄÉ豸ÎÞЧ";
+ Text[ russian ] = "Çàäàííîå óñòðîéñòâî íå äîñòóïíî";
+ Text[ polish ] = "Podane urz¹dzenie jest nieprawid³owe";
+ Text[ japanese ] = "Žw’肵‚½ÃÞ¨ÊÞ²½‚Í–³Œø‚Å‚·";
+ Text[ chinese_traditional ] = "«ü©wªº³]³ÆµL®Ä";
+ Text[ arabic ] = "ÇáÌåÇÒ ÇáãÚØì ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "Het aangegeven apparaat bestaat niet.";
+ Text[ chinese_simplified ] = "Ö¸¶¨µÄÉ豸ÎÞЧ";
+ Text[ greek ] = "Ç êáèïñéóìÝíç óõóêåõÞ äåí åßíáé Ýãêõñç";
+ Text[ korean ] = "ÁöÁ¤µÈ ÀåÄ¡°¡ À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Belirtilen cihaz geçerli deðil";
+ };
+ String ERRCODE_IO_ACCESSDENIED
+ {
+ Text = "Aufgrund fehlender Rechte kann auf das Objekt\nnicht zugegriffen werden" ;
+ Text [ ENGLISH ] = "The device cannot be accessed because\nof insufficient user rights" ;
+ Text [ dutch ] = "Er bestaat geen recht op toegang\n tot object." ;
+ Text [ english_us ] = "The object cannot be accessed\ndue to insufficient user rights" ;
+ Text [ italian ] = "A causa di diritti mancanti non è possibile\naccedere all'oggetto" ;
+ Text [ spanish ] = "No es posible acceder al objeto\npor falta de derechos." ;
+ Text [ french ] = "Impossible d'accéder à l'objet\ndroits d'accès insuffisants" ;
+ Text [ swedish ] = "Åtkomst till objektet kan inte medges\neftersom rättigheter saknas" ;
+ Text [ danish ] = "Det er ikke muligt at få adgang til objektet,\nfordi de krævede adgangsrettigheder mangler" ;
+ Text [ portuguese ] = "Impossível o acesso ao objecto\npor falta de direitos." ;
+ Text [ portuguese_brazilian ] = "Aufgrund fehlender Rechte kann auf das Objekt\nnicht zugegriffen werden" ;
+ Text[ chinese_simplified ] = "ȱÉÙ¶ÁȡȨÀû£¬\nÎÞ·¨¶ÁÈ¡Õâ¸ö¶ÔÏó";
+ Text[ russian ] = "Èç-çà îòñóòñòâóþùèõ ïðàâ äîñòóï ê îáúåêòó\níå ðàçðåøåí";
+ Text[ polish ] = "Brak dostêpu do obiektu \n z powodu brakuj¹cych praw dostêpu";
+ Text[ japanese ] = "Œ —˜‚ª‚È‚¢‚Ì‚Å\nµÌÞ¼Þª¸Ä‚ɱ¸¾½‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "¯Ê¤ÖŪ¨úÅv§Q¡M\nµLªkŪ¨ú³o­Óª«¥ó";
+ Text[ arabic ] = "áÇ íãßä ÇáæÕæá Åáì ÇáßÇÆä¡\náÚÏã ÊæÝÑ ÇáÍÞæÞ ÇááÇÒãÉ";
+ Text[ dutch ] = "Er bestaat geen recht op toegang\n tot object.";
+ Text[ chinese_simplified ] = "ȱÉÙ¶ÁȡȨÀû£¬\nÎÞ·¨¶ÁÈ¡Õâ¸ö¶ÔÏó";
+ Text[ greek ] = "Ç ðñüóâáóç óôï áíôéêåßìåíï äåí åßíáé äõíáôÞ\nëüãù Ýëëåéøçò äéêáéùìÜôùí";
+ Text[ korean ] = "»ç¿ëÀÚ ±ÇÇÑÀÌ ¾ø¾î °³Ã¼¿¡\n¾×¼¼½ºÇÒ ¼ö ¾øÀ½";
+ Text[ turkish ] = "Gerekli eriþim haklarýnýn olmamasý nedeniyle \nnesneye eriþim saðlanamýyor";
+ };
+ String ERRCODE_IO_LOCKVIOLATION
+ {
+ Text = "Fehler beim gemeinsamen Zugriff auf das Objekt" ;
+ Text [ ENGLISH ] = "Sharing violation while accessing the object" ;
+ Text [ english_us ] = "Sharing violation while accessing the object" ;
+ Text [ italian ] = "Errore nell'accesso comune all'oggetto" ;
+ Text [ spanish ] = "Error al acceder conjuntamente al objeto." ;
+ Text [ french ] = "Erreur lors de la tentative d'accès partagé sur l'objet" ;
+ Text [ dutch ] = "Fout bij gelijktijdige toegang tot object" ;
+ Text [ swedish ] = "Fel vid gemensam åtkomst till objektet" ;
+ Text [ danish ] = "Fejl under fælles adgang til objektet" ;
+ Text [ portuguese ] = "Erro ao tentar acesso partilhado ao objecto." ;
+ Text [ portuguese_brazilian ] = "Fehler beim gemeinsamen Zugriff auf das Objekt" ;
+ Text[ chinese_simplified ] = "ÔÚͬʱ¶ÁÈ¡Õâ¸ö¶ÔÏóʱ·¢Éú´íÎó";
+ Text[ russian ] = "Îøèáêà ïðè êîëëåêòèâíîì äîñòóïå ê îáúåêòó";
+ Text[ polish ] = "Nast¹pi³o naruszenie zasad wspó³u¿ytkowania podczas dostêpu do obiektu";
+ Text[ japanese ] = "µÌÞ¼Þª¸Äã‚Ì‹¤—L±¸¾½‚ÌÛ‚Ì´×°";
+ Text[ chinese_traditional ] = "¦b¦P®ÉŪ¨ú³o­Óª«¥ó®Éµo¥Í¿ù»~";
+ Text[ arabic ] = "ÍÏË ÎØà ÃËäÇÁ ãÍÇæáÉ ÇáæÕæá ÇáãÔÊÑß Åáì ÇáßÇÆä";
+ Text[ dutch ] = "Fout bij gelijktijdige toegang tot object";
+ Text[ chinese_simplified ] = "ÔÚͬʱ¶ÁÈ¡Õâ¸ö¶ÔÏóʱ·¢Éú´íÎó";
+ Text[ greek ] = "ÓöÜëìá êáôÜ ôçí êïéíÞ ðñüóâáóç óôï áíôéêåßìåíï";
+ Text[ korean ] = "°³Ã¼¿¡ °øÀ¯ ¾×¼¼½ºÇÒ ¶§ ¿À·ù";
+ Text[ turkish ] = "Nesneye eriþimde bir paylaþým hatasý oluþtu";
+ };
+ String ERRCODE_IO_OUTOFSPACE
+ {
+ Text = "Auf dem Gerät ist kein Platz mehr verfügbar" ;
+ Text [ ENGLISH ] = "No more space on device" ;
+ Text [ dutch ] = "Onvoldoende opslagruimte" ;
+ Text [ english_us ] = "No more space on device" ;
+ Text [ italian ] = "Sul dispositivo non c'è più posto" ;
+ Text [ spanish ] = "No hay espacio disponible en el dispositivo." ;
+ Text [ french ] = "Les ressources du périphérique sont épuisées" ;
+ Text [ swedish ] = "Det finns ingen plats kvar på apparaten" ;
+ Text [ danish ] = "Der er ikke mere tilgængelig plads på enheden" ;
+ Text [ portuguese ] = "Não há mais espaço no periférico." ;
+ Text [ portuguese_brazilian ] = "Auf dem Gerät ist kein Platz mehr verfügbar" ;
+ Text[ chinese_simplified ] = "É豸ÉϵĿÉÓÿռäÒѾ­ÓÃÍê";
+ Text[ russian ] = "Íà ýòîì óñòðîéñòâå ñâîáîäíîãî ìåñòà áîëüøå íåò";
+ Text[ polish ] = "Nie ma wiêcej miejsca na tym urz¹dzeniu";
+ Text[ japanese ] = "ÃÞ¨ÊÞ²½ã‚É‹ó‚«—e—Ê‚ª‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "³]³Æªº¥i¥ÎªÅ¶¡¤w¸g¥ÎºÉ";
+ Text[ arabic ] = "áã íÚÏ åäÇß ãßÇä Ýí ÇáÌåÇÒ";
+ Text[ dutch ] = "Onvoldoende opslagruimte";
+ Text[ chinese_simplified ] = "É豸ÉϵĿÉÓÿռäÒѾ­ÓÃÍê";
+ Text[ greek ] = "Äåí åßíáé äéáèÝóéìïò ðåñéóóüôåñïò ÷þñïò óôç óõóêåõÞ";
+ Text[ korean ] = "ÀåÄ¡¿¡ ´õ ÀÌ»ó ÀÌ¿ë °ø°£ÀÌ ¾øÀ½";
+ Text[ turkish ] = "Cihazda yeterli alan kalmadý";
+ };
+ String ERRCODE_IO_ISWILDCARD
+ {
+ Text = "Die Operation kann nicht auf Dateien, welche\nWildcards enthalten, ausgeführt werden" ;
+ Text [ ENGLISH ] = "This operation is not permitted on filenames containing wildcards" ;
+ Text [ dutch ] = "Deze opdracht kan niet worden uitgevoerd bij bestanden \ndie wildcards bevatten" ;
+ Text [ english_us ] = "This operation cannot be run on\nfiles containing wildcards" ;
+ Text [ italian ] = "L'operazione non può essere effettuata su file che \ncontengono wildcards" ;
+ Text [ spanish ] = "La operación no se puede ejecutar en\narchivos que contengan Wildcards." ;
+ Text [ french ] = "Cette action ne peut pas être exécutée sur des fichiers\ncontenant des caractères génériques (Wildcards)" ;
+ Text [ swedish ] = "Operationen kan inte utföras på filer som\ninnehåller jokertecken" ;
+ Text [ danish ] = "Det er ikke muligt at udføre processen på filer,\nsom indeholder jokertegn" ;
+ Text [ portuguese ] = "A operação não pode ser executada em\nficheiros que contenham caracteres polivalentes (wildcards)" ;
+ Text [ portuguese_brazilian ] = "Die Operation kann nicht auf Dateien, welche\nWildcards enthalten, ausgeführt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨ÔÚº¬ÓÐͨÅä·ûµÄ\nÎļþÖÐÖ´ÐÐÕâ¸ö²Ù×÷";
+ Text[ russian ] = "Âûïîëíèòü îïåðàöèþ ñ ôàéëàìè, \nñîäåðæàùèìè ïîäñòàíîâî÷íûå çíàêè, íåâîçìîæíî";
+ Text[ polish ] = "Operacja nie mo¿e byæ wykonana na plikach, które \nzawieraj¹ symbole wieloznaczne (Wildcarts)";
+ Text[ japanese ] = "ܲÙÄÞ¶°ÄÞ‚ðŠÜ‚Þ̧²Ù‚Å\n‘€ì‚ÍŽÀs‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "³o¨ÇÀɮקt¦³³q°t²Å¡M\n¦ÓµLªk°õ¦æ¾Þ§@";
+ Text[ arabic ] = "áÇ íãßä ÊäÝíÐ åÐå ÇáÚãáíÉ Úáì ãáÝÇÊ\nÊÍÊæí Úáì ÃÍÑÝ ÈÏá.";
+ Text[ dutch ] = "Deze opdracht kan niet worden uitgevoerd bij bestanden \ndie wildcards bevatten";
+ Text[ chinese_simplified ] = "ÎÞ·¨ÔÚº¬ÓÐͨÅä·ûµÄ\nÎļþÖÐÖ´ÐÐÕâ¸ö²Ù×÷";
+ Text[ greek ] = "ÁõôÞ ç ëåéôïõñãßá äåí åßíáé äõíáôüí íá åöáñìïóôåß óå áñ÷åßá ôá ïðïßá \n ðåñéÝ÷ïõí ÷áñáêôÞñåò ìðáëáíôÝñ";
+ Text[ korean ] = "ÀÌ ÀÛµ¿Àº ¿ÍÀϵå Ä«µå¸¦ Æ÷ÇÔÇÏ´Â ÆÄÀÏ \n ¿¡¼­ µ¿ÀÛµÇÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Ýþlem, genel arama karakterleri\n içeren dosyalar üzerinde gerçekleþtirilemiyor";
+ };
+ String ERRCODE_IO_NOTSUPPORTED
+ {
+ Text = "Die Operation wird auf dem vorliegenden Betriebssystem nicht unterstützt" ;
+ Text [ ENGLISH ] = "This operation is not supported on this operating system" ;
+ Text [ english_us ] = "This operation is not supported on this operating system" ;
+ Text [ italian ] = "L'operazione non viene supportata sul sistema operativo presente" ;
+ Text [ spanish ] = "La operación no es apoyada por este sistema operativo." ;
+ Text [ french ] = "Cette opération n'est pas supportée sur ce système d'exploitation." ;
+ Text [ dutch ] = "Deze opdracht wordt niet ondersteund door het bestaande besturingssysteem" ;
+ Text [ swedish ] = "Operationen stöds inte av detta operativsystem" ;
+ Text [ danish ] = "Processen understøttes ikke af dette operativsystem" ;
+ Text [ portuguese ] = "A operação não tem suporte neste sistema operativo." ;
+ Text [ portuguese_brazilian ] = "Die Operation wird auf dem vorliegenden Betriebssystem nicht unterstützt" ;
+ Text[ chinese_simplified ] = "µ±Ç°µÄ²Ù×÷ƽ̨²»Ö§³ÖÕâ¸ö²Ù×÷";
+ Text[ russian ] = "Ýòà îïåðàöèÿ íå ïîääåðæèâàåòñÿ äàííîé îïåðàöèîííîé ñèñòåìîé";
+ Text[ polish ] = "Ta operacja nie jest obs³ugiwana w tym systemie operacyjnym.";
+ Text[ japanese ] = "‚±‚Ì‘€ì‚Í‚±‚̵ÍßÚ°¼®Ý ¼½ÃÑ‚Å‚ÍŽx‰‡‚³‚ê‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "·í«e¨Ï¥Îªº¾Þ§@¨t²Î¤£¤ä´©³o­Ó¾Þ§@";
+ Text[ arabic ] = "äÙÇã ÇáÊÔÛíá åÐÇ áÇ íÏÚã åÐå ÇáÚãáíÉ";
+ Text[ dutch ] = "Deze opdracht wordt niet ondersteund door het bestaande besturingssysteem";
+ Text[ chinese_simplified ] = "µ±Ç°µÄ²Ù×÷ƽ̨²»Ö§³ÖÕâ¸ö²Ù×÷";
+ Text[ greek ] = "Ç ëåéôïõñãßá áõôÞ äåí õðïóôçñßæåôáé óå áõôü ôï ëåéôïõñãéêü óýóôçìá";
+ Text[ korean ] = "ÀÌ ÀÛµ¿Àº ÀÌ ¿ÀÆÛ·¹ÀÌÆà ½Ã½ºÅÛ»ó¿¡¼­ Áö¿øµÇÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Bu iþlem, iþletim sistemi tarafýndan desteklenmiyor";
+ };
+ String ERRCODE_IO_TOOMANYOPENFILES
+ {
+ Text = "Es sind bereits zu viele Dateien geöffnet" ;
+ Text [ ENGLISH ] = "The are too many open files" ;
+ Text [ dutch ] = "Te veel bestanden geopend" ;
+ Text [ english_us ] = "There are too many files open" ;
+ Text [ italian ] = "Ci sono già troppi file aperti" ;
+ Text [ spanish ] = "Hay demasiados archivos abiertos." ;
+ Text [ french ] = "Trop de fichiers ouverts !" ;
+ Text [ swedish ] = "För många filer är redan öppnade" ;
+ Text [ danish ] = "Der er for mange åbne filer allerede" ;
+ Text [ portuguese ] = "Demasiados ficheiros abertos." ;
+ Text [ portuguese_brazilian ] = "Es sind bereits zu viele Dateien geöffnet" ;
+ Text[ chinese_simplified ] = "ÒѾ­´ò¿ªµÄÎļþÌ«¶à";
+ Text[ russian ] = "Îòêðûòî ñëèøêîì ìíîãî ôàéëîâ";
+ Text[ polish ] = "Jest otworzonych za du¿o plików";
+ Text[ japanese ] = "‚·‚Å‚Ȩ́²Ù‚ð‚½‚­‚³‚ñŠJ‚«‚·‚¬‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "¥´¶}¤F¤Ó¦hÀÉ®×";
+ Text[ arabic ] = "ÚÏÏ ÇáãÓÊäÏÇÊ ÇáãÝÊæÍÉ ßÈíÑ ÌÏÇð";
+ Text[ dutch ] = "Te veel bestanden geopend";
+ Text[ chinese_simplified ] = "ÒѾ­´ò¿ªµÄÎļþÌ«¶à";
+ Text[ greek ] = "Åßíáé Þäç ðïëëÜ áñ÷åßá áíïé÷ôÜ";
+ Text[ korean ] = "³Ê¹« ¸¹Àº ÆÄÀÏÀÌ ¿­·ÁÀÖ½À´Ï´Ù.";
+ Text[ turkish ] = "Çok fazla dosya açýk";
+ };
+ String ERRCODE_IO_CANTREAD
+ {
+ Text = "Von der Datei konnte nicht gelesen werden" ;
+ Text [ ENGLISH ] = "The file could not be read" ;
+ Text [ dutch ] = "Bestand kon niet worden gelezen" ;
+ Text [ english_us ] = "Data could not be read from the file" ;
+ Text [ italian ] = "Non è stato possibile leggere dal file" ;
+ Text [ spanish ] = "No se pudo leer del archivo." ;
+ Text [ french ] = "Impossible de lire à partir de ce fichier" ;
+ Text [ swedish ] = "Det gick inte att läsa från filen" ;
+ Text [ danish ] = "Det var ikke muligt at læse filen" ;
+ Text [ portuguese ] = "Foi impossível ler o ficheiro." ;
+ Text [ portuguese_brazilian ] = "Von der Datei konnte nicht gelesen werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨¶ÁÈ¡Õâ¸öÎļþ";
+ Text[ russian ] = "Ïðî÷èòàòü ôàéë íåâîçìîæíî";
+ Text[ polish ] = "Ten plik nie mog³ zostaæ odczytany";
+ Text[ japanese ] = "̧²Ù‚©‚ç“Ç‚ÝŽæ‚ê‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªkŪ¨ú³o­ÓÀÉ®×";
+ Text[ arabic ] = "ÊÚÐÑÊ ÞÑÇÁÉ ÇáãáÝ";
+ Text[ dutch ] = "Bestand kon niet worden gelezen";
+ Text[ chinese_simplified ] = "ÎÞ·¨¶ÁÈ¡Õâ¸öÎļþ";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá ãßíåé áíÜãíùóç ôïõ áñ÷åßïõ";
+ Text[ korean ] = "µ¥ÀÌÅÍ°¡ ÆÄÀÏ·Î ºÎÅÍ ÀÐÇô Áú¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Dosyadan veri okunamadý";
+ };
+ String ERRCODE_IO_CANTWRITE
+ {
+ Text = "Die Datei konnte nicht geschrieben werden" ;
+ Text [ ENGLISH ] = "The file could not be written" ;
+ Text [ english_us ] = "The file could not be written" ;
+ Text [ italian ] = "Non è stato possibile scrivere il file" ;
+ Text [ spanish ] = "No se pudo guardar el archivo" ;
+ Text [ french ] = "Impossible d'écrire le fichier" ;
+ Text [ dutch ] = "Bestand kon niet worden opgeslagen" ;
+ Text [ swedish ] = "Filen kunde inte skrivas" ;
+ Text [ danish ] = "Det var ikke muligt at skrive filen" ;
+ Text [ portuguese ] = "Foi impossível escrever o ficheiro." ;
+ Text [ portuguese_brazilian ] = "Auf die Datei konnte nicht gespeicherwerden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Ð´ÈëÕâ¸öÎļþ";
+ Text[ russian ] = "Çàïèñü ôàéëà íå óäàåòñÿ";
+ Text[ polish ] = "Pliku nie mo¿na by³o zapisaæ";
+ Text[ japanese ] = "̧²Ù‚ð‘‚«ž‚Ý‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk¼g¤J³o­ÓÀÉ®×";
+ Text[ arabic ] = "ÊÚÐÑÊ ßÊÇÈÉ ÇáãáÝ";
+ Text[ dutch ] = "Bestand kon niet worden opgeslagen";
+ Text[ chinese_simplified ] = "ÎÞ·¨Ð´ÈëÕâ¸öÎļþ";
+ Text[ greek ] = "Äåí Þôáí äõíáôÞ ç åããñáöÞ ôïõ áñ÷åßïõ";
+ Text[ korean ] = "ÆÄÀÏÀÌ ¾µ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Dosya yazýlamadý";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_IO_OUTOFMEMORY
+ {
+ Text = "Die Operation konnte wegen Speichermangels nicht ausgeführt werden" ;
+ Text [ ENGLISH ] = "The operation could no be completed because there is no memory left" ;
+ Text [ english_us ] = "The operation could not be run due to insufficient memory." ;
+ Text [ italian ] = "A causa di insufficienza di memoria non è stato possibile completare l'operazione" ;
+ Text [ spanish ] = "La operación no se pudo ejecutar por falta de memoria." ;
+ Text [ french ] = "Impossible d'exécuter cette action, mémoire insuffisante !" ;
+ Text [ dutch ] = "De opdracht kon niet worden uitgevoerd bij gebrek aan vrij geheugen." ;
+ Text [ swedish ] = "Operationen kunde inte utföras på grund av för lite minne." ;
+ Text [ danish ] = "Det var ikke muligt at udføre operationen, fordi der ikke er tilstrækkelig hukommelse" ;
+ Text [ portuguese ] = "Foi impossível executar a operação por não existir memória suficiente." ;
+ Text [ portuguese_brazilian ] = "Die Operation konnte wegen Speichermangels nicht ausgeführt werden" ;
+ Text[ chinese_simplified ] = "ÒòΪÄÚ´æ²»×ã¶øÎÞ·¨Ö´ÐÐÕâ¸ö²Ù×÷";
+ Text[ russian ] = "Èç-çà íåäîñòàòêà ïàìÿòè âûïîëíèòü îïåðàöèþ íåâîçìîæíî";
+ Text[ polish ] = "Operacja nie mog³a zostaæ wykonana z powodu braku pamiêci";
+ Text[ japanese ] = "‚±‚Ì‘€ì‚ÍÒÓØ•s‘«‚Ì‚½‚ߎÀs‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "¦]¬°°O¾ÐÅ餣¨¬¦ÓµLªk°õ¦æ³o­Ó¾Þ§@";
+ Text[ arabic ] = "ÊÚÐÑ ÊäÝíÐ ÇáÚãáíÉ¡ ÈÓÈÈ äÞÕ ÇáÐÇßÑÉ";
+ Text[ dutch ] = "De opdracht kon niet worden uitgevoerd bij gebrek aan vrij geheugen.";
+ Text[ chinese_simplified ] = "ÒòΪÄÚ´æ²»×ã¶øÎÞ·¨Ö´ÐÐÕâ¸ö²Ù×÷";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá åêôåëåóôåß ç ëåéôïõñãßá ëüãù Ýëëåéøçò ìíÞìçò";
+ Text[ korean ] = "¸Þ¸ð¸® ºÎÁ·À¸·Î ÀÎÇÏ¿© ÀÛµ¿ÀÌ ½ÇÇàµÉ ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Ýþlem, bellek yetersizliði nedeniyle yürütülemedi";
+ };
+ String ERRCODE_IO_CANTSEEK
+ {
+ Text = "Die Seekoperation konnte nicht ausgeführt werden" ;
+ Text [ ENGLISH ] = "The seek operation could not be completed" ;
+ Text [ dutch ] = "De zoekopdracht kon niet worden uitgevoerd" ;
+ Text [ english_us ] = "The seek operation could not be run" ;
+ Text [ italian ] = "Non è statopossibile eseguire l'operazione di seek" ;
+ Text [ spanish ] = "No se pudo ejecutar la operación Seek." ;
+ Text [ french ] = "Impossible d'exécuter l'opération Seek" ;
+ Text [ swedish ] = "Seekoperationen kunde inte utföras" ;
+ Text [ danish ] = "Det var ikke muligt at udføre seek-operationen" ;
+ Text [ portuguese ] = "Foi impossível executar a operação de localização." ;
+ Text [ portuguese_brazilian ] = "Die Seekoperation konnte nicht ausgeführt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´ÐÐËÑÑ°²Ù×÷";
+ Text[ russian ] = "Âûïîëíèòü îïåðàöèþ seek íå óäàåòñÿ";
+ Text[ polish ] = "Nie mo¿na by³o wykonaæ operacji pliku (Seek)";
+ Text[ japanese ] = "Seek‘€ì‚ªŽÀs‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "µLªk°õ¦æ·j´M©R¥O";
+ Text[ arabic ] = "ÊÚÐÑ ÊäÝíÐ ÇáÚãáíÉ \"Seek\"";
+ Text[ dutch ] = "De zoekopdracht kon niet worden uitgevoerd";
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´ÐÐËÑÑ°²Ù×÷";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá åêôåëåóôåß ç ëåéôïõñãßá áíáæÞôçóçò";
+ Text[ korean ] = "ã±â ÀÛµ¿ÀÌ ½ÇÇàµÉ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Arama iþlemi yürütülemedi";
+ };
+ String ERRCODE_IO_CANTTELL
+ {
+ Text = "Die Telloperation konnte nicht ausgeführt werden" ;
+ Text [ ENGLISH ] = "The tell operation could not be completed" ;
+ Text [ english_us ] = "The tell operation could not be run" ;
+ Text [ italian ] = "Non è stato possibile eseguire l'operazione tell" ;
+ Text [ spanish ] = "No se pudo ejecutar la operación Tell" ;
+ Text [ french ] = "Impossible d'exécuter l'opération Tell" ;
+ Text [ dutch ] = "De bestandsopdracht TELL kon niet worden uitgevoerd" ;
+ Text [ swedish ] = "Telloperationen kunde inte utföras" ;
+ Text [ danish ] = "Det var ikke muligt at udføre tell-operationen" ;
+ Text [ portuguese ] = "Foi impossível executar a operação Tell" ;
+ Text [ portuguese_brazilian ] = "Die Telloperation konnte nicht ausgeführt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´ÐÐ tell ÃüÁî";
+ Text[ russian ] = "Âûïîëíèòü îïåðàöèþ tell íåâîçìîæíî";
+ Text[ polish ] = "Nie mo¿na by³o wykonaæ operacji pliku (Tell)";
+ Text[ japanese ] = "Tell‘€ì‚ªŽÀs‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "µLªk°õ¦æ Tell ©R¥O";
+ Text[ arabic ] = "ÊÚÐÑ ÊäÝíÐ ÇáÚãáíÉ \"Tell\"";
+ Text[ dutch ] = "De bestandsopdracht TELL kon niet worden uitgevoerd";
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´ÐÐ tell ÃüÁî";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá åêôåëåóôåß ç ëåéôïõñãßá \"Tell\"";
+ Text[ korean ] = "Tell ÀÛ¾÷À» ½ÇÇàÇÏÁö ¸øÇßÀ½";
+ Text[ turkish ] = "Tell iþlemi yürütülemedi";
+ };
+ String ERRCODE_IO_WRONGVERSION
+ {
+ Text = "Die Datei liegt in einer falschen Version vor" ;
+ Text [ ENGLISH ] = "The file has a wrong version" ;
+ Text [ dutch ] = "Bestand heeft verkeerde versie" ;
+ Text [ english_us ] = "Incorrect file version" ;
+ Text [ italian ] = "Il file è presente in una versione errata" ;
+ Text [ spanish ] = "Versión incorrecta de archivo." ;
+ Text [ french ] = "Version de fichier incorrecte" ;
+ Text [ swedish ] = "Filen föreligger i en felaktig version" ;
+ Text [ danish ] = "Filen foreligger i en forkert version" ;
+ Text [ portuguese ] = "Versão incorrecta do ficheiro." ;
+ Text [ portuguese_brazilian ] = "Die Datei liegt in einer falschen Version vor" ;
+ Text[ chinese_simplified ] = "ÎļþµÄ°æ±¾ÎÞЧ";
+ Text[ russian ] = "Ôàéë ïðåäñòàâëåí â íåïðàâèëüíîé âåðñèè";
+ Text[ polish ] = "Wersja pliku jest nieprawid³owa";
+ Text[ japanese ] = "̧²Ù‚ÌÊÞ°¼Þ®Ý‚ª³‚µ‚­‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "Àɮת©¥»µL®Ä";
+ Text[ arabic ] = "ÅÕÏÇÑ ÇáãáÝ ÛíÑ ÕÍíÍ";
+ Text[ dutch ] = "Bestand heeft verkeerde versie";
+ Text[ chinese_simplified ] = "ÎļþµÄ°æ±¾ÎÞЧ";
+ Text[ greek ] = "ËÜèïò Ýêäïóç ôïõ áñ÷åßïõ";
+ Text[ korean ] = "À߸øµÈ ÆÄÀÏ ¹öÁ¯";
+ Text[ turkish ] = "Yanlýþ dosya sürümü";
+ };
+ String ERRCODE_IO_WRONGFORMAT
+ {
+ Text = "Die Datei liegt in einem falschen Format vor" ;
+ Text [ ENGLISH ] = "The file has a wrong format" ;
+ Text [ dutch ] = "Bestand heeft verkeerd formaat" ;
+ Text [ english_us ] = "Incorrect file format" ;
+ Text [ italian ] = "Il file ha un formato errato" ;
+ Text [ spanish ] = "Formato de archivo incorrecto" ;
+ Text [ french ] = "Format de fichier incorrect" ;
+ Text [ swedish ] = "Filen föreligger i ett felaktigt format" ;
+ Text [ danish ] = "Filen foreligger i et forkert format" ;
+ Text [ portuguese ] = "Formato de ficheiro incorrecto." ;
+ Text [ portuguese_brazilian ] = "Die Datei liegt in einem falschen Format vor" ;
+ Text[ chinese_simplified ] = "ÎļþµÄ¸ñʽ´íÎó";
+ Text[ russian ] = "Ôàéë ïðåäñòàâëåí â íåïðàâèëüíîì ôîðìàòå";
+ Text[ polish ] = "Format pliku jest nieprawid³owy";
+ Text[ japanese ] = "̧²Ù‘Ž®‚ª³‚µ‚­‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "Àɮ׮榡¿ù»~";
+ Text[ arabic ] = "ÊäÓíÞ ÇáãáÝ ÛíÑ ÕÍíÍ";
+ Text[ dutch ] = "Bestand heeft verkeerd formaat";
+ Text[ chinese_simplified ] = "ÎļþµÄ¸ñʽ´íÎó";
+ Text[ greek ] = "Ìç Ýãêõñç ìïñöÞ áñ÷åßïõ";
+ Text[ korean ] = "À߸øµÈ ÆÄÀÏ ¼­½Ä";
+ Text[ turkish ] = "Yanlýþ dosya sürümü";
+ };
+ String ERRCODE_IO_INVALIDCHAR
+ {
+ Text = "Der Dateiname enthält unzulässige Zeichen" ;
+ Text [ ENGLISH ] = "The filename contains invalid characters" ;
+ Text [ dutch ] = "De bestandsnaam bevat ongeoorloofde tekens" ;
+ Text [ english_us ] = "The file name contains invalid characters" ;
+ Text [ italian ] = "Il nome del file contiene caratteri non permessi" ;
+ Text [ spanish ] = "El nombre del archivo contiene caracteres inadmisibles." ;
+ Text [ french ] = "Le nom du fichier contient des caractères incorrectes" ;
+ Text [ swedish ] = "Filnamnet innehåller otillåtna tecken" ;
+ Text [ danish ] = "Filnavnet indeholder ugyldige tegn" ;
+ Text [ portuguese ] = "O nome do ficheiro contém caracteres incorrectos." ;
+ Text [ portuguese_brazilian ] = "Der Dateiname enthält unzulässige Zeichen" ;
+ Text[ chinese_simplified ] = "ÎļþÃûÖк¬ÓÐÎÞЧµÄ×Ö·û";
+ Text[ russian ] = "Èìÿ ôàéëà ñîäåðæèò íåäîïóñòèìûå ñèìâîëû";
+ Text[ polish ] = "Nazwa pliku zawiera nieprawid³owe znaki";
+ Text[ japanese ] = "̧²Ù–¼‚É•s“KØ‚È•¶Žš‚ªŠÜ‚Ü‚ê‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "ÀɮצW§t¦³µL®Äªº¦r¤¸";
+ Text[ arabic ] = "íÍÊæí ÇÓã ÇáãáÝ Úáì ÃÍÑÝ ÛíÑ ãÓãæÍ ÈåÇ";
+ Text[ dutch ] = "De bestandsnaam bevat ongeoorloofde tekens";
+ Text[ chinese_simplified ] = "ÎļþÃûÖк¬ÓÐÎÞЧµÄ×Ö·û";
+ Text[ greek ] = "Ôï üíïìá ôïõ áñ÷åßïõ ðåñéÝ÷åé ìç Ýãêõñïõò ÷áñáêôÞñåò";
+ Text[ korean ] = "ÆÄÀÏÀ̸§¿¡ À¯È¿ÇÏÁö ¾ÊÀº ¹®ÀÚ°¡ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù.";
+ Text[ turkish ] = "Dosya adý geçersiz karakterler içeriyor";
+ };
+ String ERRCODE_IO_UNKNOWN
+ {
+ Text = "Es trat ein unbekannter Ein-/Ausgabefehler auf" ;
+ Text [ ENGLISH ] = "The Operation failed due an unknown I/O Error" ;
+ Text [ english_us ] = "An unknown I/O error has occurred" ;
+ Text [ italian ] = "Si è verificato un errore di I/O sconosciuto" ;
+ Text [ spanish ] = "Ha ocurrido un error desconocido de entrada/salida." ;
+ Text [ french ] = "Erreur d'entrée/sortie inconnue" ;
+ Text [ dutch ] = "Onbekende I/O fout" ;
+ Text [ swedish ] = "Ett okänt input-/outputfel uppstod" ;
+ Text [ danish ] = "Der opstod en ukendt input-/outputfejl" ;
+ Text [ portuguese ] = "Surgiu um erro de entrada/saída desconhecido." ;
+ Text [ portuguese_brazilian ] = "Es trat ein unbekannter Ein-/Ausgabefehler auf" ;
+ Text[ chinese_simplified ] = "³öÏÖÒ»¸ö²»Ã÷µÄÊäÈë/Êä³ö´íÎó";
+ Text[ russian ] = "Ïðîèçîøëà íåèçâåñòíàÿ îøèáêà ââîäà-âûâîäà";
+ Text[ polish ] = "Wyst¹pi³ nieznany b³¹d wejœcia/wyjœcia";
+ Text[ japanese ] = "•s–¾‚ÈI/O ´×°‚ª”­¶";
+ Text[ chinese_traditional ] = "¥X²{¤@­Ó¤£©úªº¿é¤J/¿é¥X¿ù»~";
+ Text[ arabic ] = "ÍÏË ÎØà ÅÏÎÇá/ÅÎÑÇÌ ÛíÑ ãÚÑæÝ";
+ Text[ dutch ] = "Onbekende I/O fout";
+ Text[ chinese_simplified ] = "³öÏÖÒ»¸ö²»Ã÷µÄÊäÈë/Êä³ö´íÎó";
+ Text[ greek ] = "ÐáñïõóéÜóôçêå Üãíùóôï óöÜëìá åéóáãùãÞò/åîáãùãÞò";
+ Text[ korean ] = "¾Ë¼ö¾ø´Â ÀÔ/Ãâ·Â ¿À·ù ¹ß»ý";
+ Text[ turkish ] = "Bilinmeyen bir girdi/çýktý hatasý oluþtu";
+ };
+ String ERRCODE_IO_INVALIDACCESS
+ {
+ Text = "Es wurde versucht, in ungültiger Weise auf die Datei zuzugreifen" ;
+ Text [ ENGLISH ] = "The file accessed invalidly" ;
+ Text [ dutch ] = "Ongeldige poging tot openen van bestand" ;
+ Text [ english_us ] = "An invalid attempt was made to access the file" ;
+ Text [ italian ] = "Si è tentato di accedere al file in modo non valido" ;
+ Text [ spanish ] = "Se ha tratado de acceder al archivo de manera no válida." ;
+ Text [ french ] = "La manière dont vous avez essayé d'accéder au fichier est incorrecte" ;
+ Text [ swedish ] = "Ogiltigt försök att få åtkomst till filen" ;
+ Text [ danish ] = "Ugyldigt forsøg på at få adgang til filen" ;
+ Text [ portuguese ] = "Tentativa incorrecta de acesso ao ficheiro." ;
+ Text [ portuguese_brazilian ] = "Es wurde versucht, in ungültiger Weise auf die Datei zuzugreifen" ;
+ Text[ chinese_simplified ] = "¶ÁÈ¡ÎļþµÄ·½Ê½ÎÞЧ";
+ Text[ russian ] = "Áûëà ñîâåðøåíà ïîïûòêà íåçàêîííûì ïóòåì ïîëó÷èòü äîñòóï ê ôàéëó";
+ Text[ polish ] = "Nast¹pi³a próba uzyskania nieprawid³owego dostêpu do pliku";
+ Text[ japanese ] = "–³Œø‚È‚â‚è•û‚Å‚Ì̧²Ù‚ւ̱¸¾½‚ªŽŽ‚Ý‚ç‚ê‚Ü‚µ‚½";
+ Text[ chinese_traditional ] = "Ū¨úÀɮתº¤è¦¡µL®Ä";
+ Text[ arabic ] = "ÊãÊ ãÍÇæáÉ ÇáæÕæá Åáì ÇáãáÝ ÈÔßá ÛíÑ ÕÍíÍ";
+ Text[ dutch ] = "Ongeldige poging tot openen van bestand";
+ Text[ chinese_simplified ] = "¶ÁÈ¡ÎļþµÄ·½Ê½ÎÞЧ";
+ Text[ greek ] = "¸ãéíå ìç Ýãêõñç ðñïóðÜèåéá ðñüóâáóçò óôï áñ÷åßï";
+ Text[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº ÆÄÀÏ Á¢±Ù ½Ãµµ°¡ ÀÖ¾ú½À´Ï´Ù.";
+ Text[ turkish ] = "Dosyaya yetkisiz eriþim denendi";
+ };
+ String ERRCODE_IO_CANTCREATE
+ {
+ Text = "Die Datei konnte nicht angelegt werden" ;
+ Text [ ENGLISH ] = "The file could not be created" ;
+ Text [ dutch ] = "Bestand kon niet worden gemaakt" ;
+ Text [ english_us ] = "The file could not be created" ;
+ Text [ italian ] = "Non è stato possibile creare il file" ;
+ Text [ spanish ] = "No se pudo crear el archivo." ;
+ Text [ french ] = "Impossible de créer le fichier" ;
+ Text [ swedish ] = "Filen kunde inte skapas" ;
+ Text [ danish ] = "Det var ikke muligt at oprette filen" ;
+ Text [ portuguese ] = "Foi impossível criar o ficheiro." ;
+ Text [ portuguese_brazilian ] = "Die Datei konnte nicht angelegt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨½¨Á¢Õâ¸öÎļþ";
+ Text[ russian ] = "Ñîçäàòü ôàéë íåâîçìîæíî";
+ Text[ polish ] = "Plik nie móg³ zostaæ utworzony";
+ Text[ japanese ] = "̧²Ù‚ÍŠi”[‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk«Ø¥ß³o­ÓÀÉ®×";
+ Text[ arabic ] = "ÊÚÐÑ ÅäÔÇÁ ÇáãáÝ";
+ Text[ dutch ] = "Bestand kon niet worden gemaakt";
+ Text[ chinese_simplified ] = "ÎÞ·¨½¨Á¢Õâ¸öÎļþ";
+ Text[ greek ] = "Ôï áñ÷åßï äåí Þôáí äõíáôüí íá äçìéïõñãçèåß";
+ Text[ korean ] = "ÆÄÀÏÀÌ ¸¸µé¾î Áú¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Dosya oluþturulamadý";
+ };
+ String ERRCODE_IO_INVALIDPARAMETER
+ {
+ Text = "Die Operation wurde mit einem ungültigen Parameter gestartet" ;
+ Text [ ENGLISH ] = "An invalid parameter was passed" ;
+ Text [ english_us ] = "The operation was started under an invalid parameter" ;
+ Text [ italian ] = "L'operazione è stata avviata con un parametro non valido" ;
+ Text [ spanish ] = "La operación se inició con un parámetro no válido." ;
+ Text [ french ] = "L'action a été lancée à l'aide d'un paramètre incorrect" ;
+ Text [ dutch ] = "Activiteit uitgevoerd met ongeldige parameter." ;
+ Text [ swedish ] = "Operationen startades med en ogiltig parameter" ;
+ Text [ danish ] = "Processen blev startet med en ugyldig parameter" ;
+ Text [ portuguese ] = "A operação foi iniciada com um parâmetro incorrecto." ;
+ Text [ portuguese_brazilian ] = "Die Operation wurde mit einem ungültigen Parameter gestartet" ;
+ Text[ chinese_simplified ] = "ʹÓÃÒ»¸öÎÞЧµÄ²ÎÊýÆô¶¯ÁËÕâ¸ö²Ù×÷";
+ Text[ russian ] = "Îïåðàöèÿ çàïóùåíà ïðè ïîìîùè íåïðàâèëüíîãî ïàðàìåòðà";
+ Text[ polish ] = "Przy rozpoczêciu operacji u¿yto nieprawid³owego parametru";
+ Text[ japanese ] = "‚±‚Ì‘€ì‚Í–³Œø‚ÈÊß×Ò°À‚ÅŠJŽn‚µ‚Ü‚µ‚½";
+ Text[ chinese_traditional ] = "¨Ï¥Î¤@­ÓµL®Äªº§UÅܶq±Ò°Ê³o­Ó¾Þ§@";
+ Text[ arabic ] = "Êã ÈÏÁ ÇáÚãáíÉ ÈãÚáãÉ ÛíÑ ÕÇáÍÉ";
+ Text[ dutch ] = "Activiteit uitgevoerd met ongeldige parameter.";
+ Text[ chinese_simplified ] = "ʹÓÃÒ»¸öÎÞЧµÄ²ÎÊýÆô¶¯ÁËÕâ¸ö²Ù×÷";
+ Text[ greek ] = "Ç ëåéôïõñãßá åêêßíçóå ìå ìç Ýãêõñç ðáñÜìåôñï";
+ Text[ korean ] = "À¯È¿ÇÏÁö ¾ÊÀº ÆĶó¹ÌÅÍ ÇÏ¿¡¼­ ÀÛµ¿ÀÌ ½ÃÀ۵Ǿú½À´Ï´Ù.";
+ Text[ turkish ] = "Ýþlem geçersiz bir parametre ile baþlatýldý.";
+ };
+ String ERRCODE_IO_ABORT
+ {
+ Text = "Die Operation auf der Datei wurde abgebrochen" ;
+ Text [ ENGLISH ] = "The operation on the file was aborted" ;
+ Text [ dutch ] = "Activiteit werd gestopt" ;
+ Text [ english_us ] = "The operation on the file was aborted" ;
+ Text [ italian ] = "L'operazione sul file è stata interrotta" ;
+ Text [ spanish ] = "Se ha interrumpido la operación en el archivo." ;
+ Text [ french ] = "L'action tentée sur le fichier a été interrompue" ;
+ Text [ swedish ] = "Operationen på filen avbröts" ;
+ Text [ danish ] = "Processen på filen blev afbrudt" ;
+ Text [ portuguese ] = "Cancelada a operação no ficheiro." ;
+ Text [ portuguese_brazilian ] = "Die Operation auf der Datei wurde abgebrochen" ;
+ Text[ chinese_simplified ] = "Õâ¸öÎļþµÄ²Ù×÷ÒѾ­ÖжÏ";
+ Text[ russian ] = "Îïåðàöèÿ ñ ôàéëîì ïðåðâàíà";
+ Text[ polish ] = "Operacja na pliku zosta³a przerwana";
+ Text[ japanese ] = "̧²Ùã‚Ì‘€ì‚Í’†Ž~‚³‚ê‚Ü‚µ‚½";
+ Text[ chinese_traditional ] = "³o­ÓÀɮתº¾Þ§@¤w¸g¤¤Â_";
+ Text[ arabic ] = "Êã ÞØÚ ÇáÚãáíÉ Ýí ÇáãáÝ";
+ Text[ dutch ] = "Activiteit werd gestopt";
+ Text[ chinese_simplified ] = "Õâ¸öÎļþµÄ²Ù×÷ÒѾ­ÖжÏ";
+ Text[ greek ] = "ÄéáêïðÞ ôçò ëåéôïõñãßáò ðÜíù óôï áñ÷åßï";
+ Text[ korean ] = "ÆÄÀÏ »ó¿¡¼­ ÀÛµ¿ÀÌ ÁßÁö µÇ¾ú½À´Ï´Ù.";
+ Text[ turkish ] = "Dosya ile ilgili iþlem iptal edildi";
+ };
+ String ERRCODE_IO_NOTEXISTSPATH
+ {
+ Text = "Der Pfad zu der Datei existiert nicht" ;
+ Text [ ENGLISH ] = "Path to file not found" ;
+ Text [ english_us ] = "Path to the file does not exist" ;
+ Text [ italian ] = "Il percorso del file non esiste" ;
+ Text [ spanish ] = "No existe la ruta de acceso al archivo." ;
+ Text [ french ] = "Le chemin uindiqué pour le fichier n'existe pas" ;
+ Text [ dutch ] = "Pad naar bestand niet gevonden" ;
+ Text [ swedish ] = "Sökvägen till filen existerar inte" ;
+ Text [ danish ] = "Stien til filen eksisterer ikke" ;
+ Text [ portuguese ] = "O atalho para o ficheiro não existe." ;
+ Text [ portuguese_brazilian ] = "Der Pfad zu der Datei existiert nicht" ;
+ Text[ chinese_simplified ] = "Ö¸ÏòÎļþµÄ·¾¶²»´æÔÚ";
+ Text[ russian ] = "Ïóòü ê ôàéëó íå ñóùåñòâóåò";
+ Text[ polish ] = "Œcie¿ka do pliku nie istnieje";
+ Text[ japanese ] = "̧²Ù‚Ö‚ÌÊß½‚Í‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "«ü¦VÀɮתº¸ô®|¤£¦s¦b";
+ Text[ arabic ] = "ÇáãÓÇÑ ÇáãÄÏí Åáì ÇáãáÝ ÛíÑ ãæÌæÏ";
+ Text[ dutch ] = "Pad naar bestand niet gevonden";
+ Text[ chinese_simplified ] = "Ö¸ÏòÎļþµÄ·¾¶²»´æÔÚ";
+ Text[ greek ] = "Ç äéáäñïìÞ ðñïò ôï áñ÷åßï äåí õðÜñ÷åé";
+ Text[ korean ] = "ÆÄÀÏ¿¡´ëÇÑ °æ·Î°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Dosya veri yolu mevcut deðil";
+ };
+ String ERRCODE_IO_RECURSIVE
+ {
+ Text = "Ein Objekt kann nicht in sich selbst kopiert werden." ;
+ Text [ ENGLISH ] = "Cannot copy object into itself." ;
+ Text [ portuguese ] = "É impossível copiar um objecto em si próprio." ;
+ Text [ english_us ] = "An object cannot be copied into itself." ;
+ Text [ portuguese_brazilian ] = "Ein Objekt kann nicht in sich selbt kopiert werden." ;
+ Text [ swedish ] = "Ett objekt kan inte kopieras till sig självt." ;
+ Text [ danish ] = "Det er ikke muligt at kopiere et objekt over i sig selv." ;
+ Text [ italian ] = "Un oggetto non può essere copiato su se stesso." ;
+ Text [ spanish ] = "No es posible copiar un objeto en sí mismo." ;
+ Text [ french ] = "Copie impossible : la cible est identique à la source." ;
+ Text [ dutch ] = "Een object kan niet worden gekopieerd naar zichzelf." ;
+ Text[ chinese_simplified ] = "¶ÔÏóÎÞ·¨±»¸´ÖƵ½×ÔÉíÄÚ¡£";
+ Text[ russian ] = "Ñêîïèðîâàòü îáúåêò ñàì â ñåáÿ íåâîçìîæíî.";
+ Text[ polish ] = "Obiekt nie mo¿e zostaæ skopiowany sam w sobie.";
+ Text[ japanese ] = "µÌÞ¼Þª¸Ä‚Í‚»‚Ì‚à‚ÌŽ©‘̂ɺËß°‚Å‚«‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "ª«¥óµLªk³Q½Æ»s¨ì¦Û¨­¡C";
+ Text[ arabic ] = "áÇ íãßä äÓÎ ßÇÆä Åáì äÝÓå.";
+ Text[ dutch ] = "Een object kan niet worden gekopieerd naar zichzelf.";
+ Text[ chinese_simplified ] = "¶ÔÏóÎÞ·¨±»¸´ÖƵ½×ÔÉíÄÚ¡£";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá áíôéãñáöåß Ýíá áíôéêåßìåíï óôïí åáõôü ôïõ.";
+ Text[ korean ] = "°³Ã¼¸¦ ±× ÀÚü¿¡ º¹»çÇÒ ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Nesne kendi içine kopyalanamaz.";
+ };
+ String ERRCODE_SFX_NOSTDTEMPLATE
+ {
+ Text = "Die Standardvorlage konnte nicht geöffnet werden" ;
+ Text [ ENGLISH ] = "The standard template could not be found" ;
+ Text [ dutch ] = "Standaardsjabloon kon niet worden geopend" ;
+ Text [ english_us ] = "The default template could not be opened" ;
+ Text [ italian ] = "Non è stato possibile aprire il modello standard" ;
+ Text [ spanish ] = "No se pudo abrir la plantilla estándar." ;
+ Text [ french ] = "Impossible d'ouvrir le modèle par défaut" ;
+ Text [ swedish ] = "Standardmallen kunde inte öppnas" ;
+ Text [ danish ] = "Det var ikke muligt at åbne standardskabelonen" ;
+ Text [ portuguese ] = "Foi impossível abrir o modelo padrão." ;
+ Text [ portuguese_brazilian ] = "Die Standardvorlage konnte nicht geöffnet werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨´ò¿ª±ê×¼Ñùʽ";
+ Text[ russian ] = "Íå óäàåòñÿ îòêðûòü ñòàíäàðòíûé øàáëîí";
+ Text[ polish ] = "Nie mo¿na otworzyæ standardowego szablonu";
+ Text[ japanese ] = "•W€½À²Ù‚ÍŠJ‚­‚±‚Æ‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk¶}±Ò¼Ð·Ç¼Ë¦¡";
+ Text[ arabic ] = "ÊÚÐÑ ÝÊÍ ÇáÞÇáÈ ÇáÇÝÊÑÇÖí";
+ Text[ dutch ] = "Standaardsjabloon kon niet worden geopend";
+ Text[ chinese_simplified ] = "ÎÞ·¨´ò¿ª±ê×¼Ñùʽ";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá áíïé÷ôåß ôï ðñüôõðï ðñïåðéëïãÞò.";
+ Text[ korean ] = "±âº» ÅÛÇø®Æ®°¡ ¿­¸®Áö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Standart þablon açýlamadý";
+ };
+ String ERRCODE_SFX_TEMPLATENOTFOUND
+ {
+ Text = "Die angegebene Vorlage wurde nicht gefunden" ;
+ Text [ ENGLISH ] = "The template cannot be found" ;
+ Text [ dutch ] = "Aangegeven sjabloon niet te vinden" ;
+ Text [ english_us ] = "The specified template could not be found" ;
+ Text [ italian ] = "Il modello dato non è stato trovato" ;
+ Text [ spanish ] = "No se encontró la plantilla especificada" ;
+ Text [ french ] = "Le modèle indiqué est introuvable." ;
+ Text [ swedish ] = "Den angivna mallen kunde inte hittas" ;
+ Text [ danish ] = "Den angivne skabelon blev ikke fundet" ;
+ Text [ portuguese ] = "Foi impossível encontrar o modelo indicado." ;
+ Text [ portuguese_brazilian ] = "Die angegebene Vorlage wurde nicht gefunden" ;
+ Text[ chinese_simplified ] = "ûÓÐÕÒµ½Ö¸¶¨µÄÑùʽ";
+ Text[ russian ] = "Çàäàííûé øàáëîí íå íàéäåí";
+ Text[ polish ] = "Podanego szablonu nie znaleziono";
+ Text[ japanese ] = "Žw’肵‚½ÃÝÌßÚ°Ä‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "¨S¦³§ä¨ì«ü©wªº¼Ë¦¡";
+ Text[ arabic ] = "ÊÚÐÑ ÇáÚËæÑ Úáì ÇáÞÇáÈ ÇáãõÚØì";
+ Text[ dutch ] = "Aangegeven sjabloon niet te vinden";
+ Text[ chinese_simplified ] = "ûÓÐÕÒµ½Ö¸¶¨µÄÑùʽ";
+ Text[ greek ] = "Äåí âñÝèçêå ôï åðéëåãìÝíï ðñüôõðï";
+ Text[ korean ] = "ÁöÁ¤µÈ ÅÛÇø®Æ®°¡ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Belirtilen þablon bulunamadý";
+ };
+ String ERRCODE_SFX_NOTATEMPLATE
+ {
+ Text = "Die Datei kann nicht als Vorlage verwendet werden" ;
+ Text [ ENGLISH ] = "The file cannot be used as template" ;
+ Text [ dutch ] = "Bestand kan niet worden gebruikt als sjabloon" ;
+ Text [ english_us ] = "The file cannot be used as template" ;
+ Text [ italian ] = "Il file non è utilizzabile come modello" ;
+ Text [ spanish ] = "No se puede usar el archivo como plantilla" ;
+ Text [ french ] = "Impossible d'utiliser ce fichier comme modèle" ;
+ Text [ swedish ] = "Filen kan inte användas som mall" ;
+ Text [ danish ] = "Det er ikke muligt at bruge filen som skabelon" ;
+ Text [ portuguese ] = "Impossível utilizar o ficheiro como modelo." ;
+ Text [ portuguese_brazilian ] = "Die Datei kann nicht als Vorlage verwendet werden" ;
+ Text[ chinese_simplified ] = "Õâ¸öÎļþÎÞ·¨µ±×÷ÑùʽʹÓÃ";
+ Text[ russian ] = "Èñïîëüçîâàòü ôàéë â êà÷åñòâå øàáëîíà íåâîçìîæíî";
+ Text[ polish ] = "Pliku nie mo¿na u¿yæ jako szablonu";
+ Text[ japanese ] = "‚±‚Ì̧²Ù‚ÍÃÝÌßÚ°Ä‚Æ‚µ‚ÄŽg—p‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "³o­ÓÀÉ®×µLªk³Q·í§@¼Ë¦¡¨Ï¥Î";
+ Text[ arabic ] = "áÇ íãßä ÇÓÊÎÏÇã ÇáãáÝ ßÞÇáÈ";
+ Text[ dutch ] = "Bestand kan niet worden gebruikt als sjabloon";
+ Text[ chinese_simplified ] = "Õâ¸öÎļþÎÞ·¨µ±×÷ÑùʽʹÓÃ";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá ÷ñçóéìïðïéçèåß ôï áñ÷åßï ùò ðñüôõðï";
+ Text[ korean ] = "ÆÄÀÏÀÌ ÅÛÇø®Æ®·Î »ç¿ëµÉ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Dosya, þablon olarak kullanýlamýyor";
+ };
+ String ERRCODE_SFX_CANTREADDOCINFO
+ {
+ Text = "Die Dokumentinformation konnte nicht aus der Datei\ngelesen werden, da das Dokumentinformationsformat\nunbekannt ist oder da keine Dokumentinformation vorhanden\nist" ;
+ Text [ ENGLISH ] = "The document info could not be read because\nthe document does not contain document info\nor because the document info ist not known" ;
+ Text [ dutch ] = "Lezen van documentinfo niet mogelijk.\nDocumentformaat onbekend of geen documentinfo\nvoorhanden" ;
+ Text [ english_us ] = "Document information could not be read from the file because\nthe document information format is unknown or because document information does not\nexist" ;
+ Text [ italian ] = "Non è stato possibile leggere l'informazione sul documento dal file\npoiché il formato del file è sconosciuto o perché non c'è un'informazione sul\ndocumento" ;
+ Text [ spanish ] = "La información del documento no se pudo leer del\narchivo ya que su formato es desconocido o no\nexiste ninguna información acerca del documento." ;
+ Text [ french ] = "Impossible de lire les informations sur le document à partir du fichier :\nsoit le format du fichier d'information est inconnu,\nsoit il n'existe pas d'informations de ce type\n" ;
+ Text [ swedish ] = "Dokumentinformationen kunde inte läsas från\nfilen eftersom dokumentinformationsformatet är\nobekant eller ingen dokumentinformation existerar" ;
+ Text [ danish ] = "Det var ikke muligt at læse dokumentinformationen\nfra filen, fordi dokumentinformationens format er ukendt\neller der ikke er nogen tilgængelig dokumentinformation." ;
+ Text [ portuguese ] = "Impossível ler as informações sobre o documento no ficheiro\n por terem um formato desconhecido ou \npor não existirem." ;
+ Text [ portuguese_brazilian ] = "Die Dokumentinformation konnte nicht aus der Datei\ngelesen werden, da das Dokumentinformationsformat\nunbekannt ist oder da keine Dokumentinformation vorhanden\nist" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨¶Á³öÕâ¸öÎļþµÄÎĵµÐÅÏ¢£¬\nÒòΪÕâ¸öÎĵµÐÅÏ¢µÄ¸ñʽ²»Ã÷»òÎĵµÐÅÏ¢²»´æÔÚ\n";
+ Text[ russian ] = "Ïðî÷èòàòü èíôîðìàöèþ äîêóìåíòà èç ôàéëà\níåâîçìîæíî, ò.ê. ôîðìàò äîêóìåíòà\níåèçâåñòåí èëè èíôîðìàöèè î äîêóìåíòå\níå èìååòñÿ";
+ Text[ polish ] = "Informacji o dokumencie nie mo¿na by³o odczytaæ z pliku\n, poniewa¿ format informacji o dokumencie \njest nieznany lub nie istniej¹ informacje o dokumencie\n.";
+ Text[ japanese ] = "ÄÞ·­ÒÝÄî•ñ‚Ì‘Ž®‚ª•s–¾‚©\nÄÞ·­ÒÝÄî•ñ‚ª‚È‚¢‚©‚Å\ņ²Ù‚©‚çÄÞ·­ÒÝÄî•ñ‚Í“Ç‚ÝŽæ‚ê‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªkŪ¥X³o­ÓÀɮתº¤å¥ó¸ê°T¡M\n¦]¬°³o­Ó¤å¥ó¸ê°T¤£©ú©Î¤å¥ó¸ê°T¤£¦s¦b\n";
+ Text[ arabic ] = "ÊÚÐÑ ÞÑÇÁÉ ãÚáæãÇÊ ÇáãÓÊäÏ ãä ÇáãáÝ¡\náÃä ÊäÓíÞ ãÚáæãÇÊ ÇáãÓÊäÏ\nÛíÑ ãÚÑæÝ¡ Ãæ áÃä ãÚáæãÇÊ ÇáãÓÊäÏ \nÛíÑ ãæÌæÏÉ";
+ Text[ dutch ] = "Lezen van documentinfo niet mogelijk.\nDocumentformaat onbekend of geen documentinfo\nvoorhanden";
+ Text[ chinese_simplified ] = "ÎÞ·¨¶Á³öÕâ¸öÎļþµÄÎĵµÐÅÏ¢£¬\nÒòΪÕâ¸öÎĵµÐÅÏ¢µÄ¸ñʽ²»Ã÷»òÎĵµÐÅÏ¢²»´æÔÚ\n";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá ãßíåé áíÜãíùóç ôùí ðëçñïöïñéþí ôïõ åããñÜöïõ áðü ôï áñ÷åßï\nåßôå åðåéäÞ åßíáé Üãíùóôç ç ìïñöÞ ôïõ åããñÜöïõ ðëçñïöïñéþí\n Þ åðåéäÞ äåí õðÜñ÷ïõí ðëçñïöïñßåò ãéá ôï Ýããñáöï.";
+ Text[ korean ] = "¾Ë¼ö ¾ø´Â ¹®¼­ ¼­½ÄÀ̰ųª \n¹®¼­ Á¤º¸°¡ Á¸ÀçÇÏÁö ¾Ê±â ¶§¹®¿¡ ÆÄÀÏ·Î ºÎÅÍ ¹®¼­ÀÇ Á¤º¸¸¦\nÀÐÀ»¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "Belge bilgileri formatý, bilinmediði ya da belge\nbilgisi mevcut olmadýðý için\ndosyadan okunamadý\n";
+ };
+ String ERRCODE_SFX_ALREADYOPEN
+ {
+ Text = "Das Dokument ist bereits zur Bearbeitung geöffnet" ;
+ Text [ English ] = "This document is already opened" ;
+ Text [ dutch ] = "Document reeds geopend" ;
+ Text [ english_us ] = "This document has already been opened for editing" ;
+ Text [ italian ] = "Il documento è già aperto per la modifica" ;
+ Text [ spanish ] = "El documento ya se ha abierto para editarlo." ;
+ Text [ french ] = "Le document est déjà ouvert pour l'édition" ;
+ Text [ swedish ] = "Dokumentet har redan öppnats för redigering" ;
+ Text [ danish ] = "Dokumentet er allerede åbnet til redigering" ;
+ Text [ portuguese ] = "O documento já se encontra aberto para edição." ;
+ Text [ portuguese_brazilian ] = "Das Dokument ist bereits zur Bearbeitung geöffnet" ;
+ Text[ chinese_simplified ] = "Õâ¸öÎĵµÒѾ­´¦Óڱ༭״̬";
+ Text[ russian ] = "Ýòîò äîêóìåíò óæå îòêðûò äëÿ ðåäàêòèðîâàíèÿ";
+ Text[ polish ] = "Dokument jest otwarty do edycji";
+ Text[ japanese ] = "ÄÞ·­ÒÝÄ‚Í‚·‚Å‚É•ÒW—p‚ÉŠJ‚©‚ê‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "³o­Ó¤å¥ó¤w¸g³B¤_½s¿èª¬ºA";
+ Text[ arabic ] = "ÇáãÓÊäÏ ãÝÊæÍ ÈÔßá ãÓÈÞ ááÊÍÑíÑ.";
+ Text[ dutch ] = "Document reeds geopend";
+ Text[ chinese_simplified ] = "Õâ¸öÎĵµÒѾ­´¦Óڱ༭״̬";
+ Text[ greek ] = "Ôï Ýããñáöï åßíáé Þäç áíïé÷ôü ãéá åðåîåñãáóßá";
+ Text[ korean ] = "¹®¼­´Â ÀÌ¹Ì ¿­·ÁÀÖ½À´Ï´Ù.";
+ Text[ turkish ] = "Belge zaten düzenlenmek üzere açýldý";
+ };
+ String ERRCODE_SFX_WRONGPASSWORD
+ {
+ Text = "Es wurde ein falsches Passwort gesetzt" ;
+ Text [ English ] = "A wrong password was specified" ;
+ Text [ dutch ] = "Foutief wachtwoord" ;
+ Text [ english_us ] = "The wrong password has been entered" ;
+ Text [ italian ] = "È stata impostata una password errata" ;
+ Text [ spanish ] = "Se empleó una contraseña falsa" ;
+ Text [ french ] = "Le mot de passe spécifié est incorrect" ;
+ Text [ swedish ] = "Ett felaktigt lösenord har definierats" ;
+ Text [ danish ] = "Der blev angivet en forkert adgangskode" ;
+ Text [ portuguese ] = "A senha especificada está errada." ;
+ Text [ portuguese_brazilian ] = "Es wurde ein falsches Passwort gesetzt" ;
+ Text[ chinese_simplified ] = "ÊäÈëÁËÒ»¸ö´íÎóµÄ¿ÚÁî";
+ Text[ russian ] = "Ââåäåí íåïðàâèëüíûé ïàðîëü";
+ Text[ polish ] = "Zosta³o u¿yte nieprawid³owe has³o";
+ Text[ japanese ] = "³‚µ‚­‚È‚¢Ê߽ܰÄÞ‚ª“ü—Í‚³‚ê‚Ü‚µ‚½";
+ Text[ chinese_traditional ] = "¿é¤J¤F¤@­Ó¿ù»~ªº±K½X";
+ Text[ arabic ] = "Êã ÊÚííä ßáãÉ ÓÑ ÛíÑ ÕÍíÍÉ";
+ Text[ dutch ] = "Foutief wachtwoord";
+ Text[ chinese_simplified ] = "ÊäÈëÁËÒ»¸ö´íÎóµÄ¿ÚÁî";
+ Text[ greek ] = "Ïñßóôçêå åóöáëìÝíïò êùäéêüò ðñüóâáóçò";
+ Text[ korean ] = "À߸øµÈ Æнº¿öµå°¡ ÀԷµǾú½À´Ï´Ù.";
+ Text[ turkish ] = "Girilen þifre yanlýþ";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_SFX_DOCUMENTREADONLY
+ {
+ Text = "Das Dokument wurde zum Lesen geöffnet" ;
+ Text [ English ] = "The document was opened readonly" ;
+ Text [ dutch ] = "Document geopend als alleen lezen" ;
+ Text [ english_us ] = "The document was opened as read-only" ;
+ Text [ italian ] = "Il documento è stato aperto per la lettura" ;
+ Text [ spanish ] = "Se ha abierto el documento para lectura." ;
+ Text [ french ] = "Le document a été ouvert en mode de lecture seule" ;
+ Text [ swedish ] = "Dokumentet öppnades för läsning" ;
+ Text [ danish ] = "Dokumentet er blevet åbnet til læsning" ;
+ Text [ portuguese ] = "O documento foi aberto para leitura." ;
+ Text [ portuguese_brazilian ] = "Das Dokument wurde zum Lesen geöffnet" ;
+ Text[ chinese_simplified ] = "Õâ¸ö´ò¿ªµÄÎĵµÊÇ·À¸²Ð´µÄ";
+ Text[ russian ] = "Äîêóìåíò îòêðûò äëÿ ÷òåíèÿ";
+ Text[ polish ] = "Dokument zosta³ otwarty tylko do odczytu";
+ Text[ japanese ] = "ÄÞ·­ÒÝÄ‚Í“Ç‚ÝŽæ‚è—p‚ÉŠJ‚©‚ê‚Ü‚µ‚½";
+ Text[ chinese_traditional ] = "¤w¸g¥´¶}Ū¨ú³o­Ó¤å¥ó";
+ Text[ arabic ] = "Êã ÝÊÍ ÇáãáÝ ááÞÑÇÁÉ ÝÞØ";
+ Text[ dutch ] = "Document geopend als alleen lezen";
+ Text[ chinese_simplified ] = "Õâ¸ö´ò¿ªµÄÎĵµÊÇ·À¸²Ð´µÄ";
+ Text[ greek ] = "Ôï Ýããñáöï áíïß÷èçêå ìüíï ãéá áíÜãíùóç";
+ Text[ korean ] = "¹®¼­´Â Àбâ Àü¿ëÀ¸·Î ¿­·ÁÁ³½À´Ï´Ù.";
+ Text[ turkish ] = "Belge, salt okunur olarak açýldý";
+ };
+ String ERRCODE_SFX_OLEGENERAL
+ {
+ Text = "Allgemeiner OLE Fehler" ;
+ Text [ ENGLISH ] = "General OLE Error" ;
+ Text [ english_us ] = "General OLE Error" ;
+ Text [ italian ] = "Errore generale OLE" ;
+ Text [ spanish ] = "Error OLE general" ;
+ Text [ french ] = "Erreur OLE d'ordre général" ;
+ Text [ dutch ] = "Algemene OLE fout" ;
+ Text [ swedish ] = "Allmänt OLE-fel" ;
+ Text [ danish ] = "Generel OLE-fejl" ;
+ Text [ portuguese ] = "Erro OLE geral" ;
+ Text [ portuguese_brazilian ] = "Allgemeiner OLE Fehler" ;
+ Text[ chinese_simplified ] = "Ò»°ãµÄ OLE ´íÎó";
+ Text[ russian ] = "Îáùàÿ îøèáêà OLE";
+ Text[ polish ] = "B³¹d ogólny OLE";
+ Text[ japanese ] = "ˆê”Ê“I‚È OLE ´×°";
+ Text[ chinese_traditional ] = "¤@¯ë OLE ¿ù»~";
+ Text[ arabic ] = "ÎØÃ OLE ÚÇã";
+ Text[ dutch ] = "Algemene OLE fout";
+ Text[ chinese_simplified ] = "Ò»°ãµÄ OLE ´íÎó";
+ Text[ greek ] = "Ãåíéêü óöÜëìá ôïõ OLE";
+ Text[ korean ] = "ÀϹÝOLE ¿À·ù";
+ Text[ turkish ] = "Genel OLE hatasý";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_INET_NAME_RESOLVE
+ {
+ Text = "Der Rechnername $(ARG1) konnte nicht aufgelöst werden" ;
+ Text [ ENGLISH ] = "Could not resolve hostname $(ARG1)" ;
+ Text [ dutch ] = "Computernaam $(ARG1) kon niet worden herleid" ;
+ Text [ english_us ] = "The host name $(ARG1) could not be resolved" ;
+ Text [ italian ] = "Non è stato possibile risolvere il nome dell'host $(ARG1)" ;
+ Text [ spanish ] = "No se pudo resolver el nombre del ordenador $(ARG1)" ;
+ Text [ french ] = "Impossible de résoudre le nom $(ARG1) de l'ordinateur" ;
+ Text [ swedish ] = "Datornamnet $(ARG1) kunde inte lösas upp" ;
+ Text [ danish ] = "Det var ikke muligt at fortolke computernavnet $(ARG1)" ;
+ Text [ portuguese ] = "Impossível resolver o nome do computador $(ARG1)" ;
+ Text [ portuguese_brazilian ] = "Der Rechnername $(ARG1) konnte nicht aufgelöst werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨ÕÒµ½¼ÆËã»úµØÖ· $(ARG1)";
+ Text[ russian ] = "Íå óäàåòñÿ îïðåäåëèòü èìÿ óçëîâîãî êîìïüþòåðà $(ARG1)";
+ Text[ polish ] = "Nazwa komputera $(ARG1) nie mog³a zostaæ przetworzona";
+ Text[ japanese ] = "νĖ¼$(ARG1)‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk§ä¨ì¹q¸£¦a§} $(ARG1)";
+ Text[ arabic ] = "ÊÚÐÑ Íá ÇÓã ÇáãÖíÝ $(ARG1)";
+ Text[ dutch ] = "Computernaam $(ARG1) kon niet worden herleid";
+ Text[ chinese_simplified ] = "ÎÞ·¨ÕÒµ½¼ÆËã»úµØÖ· $(ARG1)";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí ãßíåé áíÜëõóç ôïõ ïíüìáôïò ôïõ õðïëïãéóôÞ $(ARG1)";
+ Text[ korean ] = "È£½ºÆ® À̸§ $(ARG1)ÀÌ È®ÀεÇÁö ¾Ê¾Ò½À´Ï´Ù.";
+ Text[ turkish ] = "$(ARG1) sunucu adý çözülemedi";
+ };
+ String ERRCODE_INET_CONNECT
+ {
+ Text = "Die Internetverbindung zu $(ARG1) konnte nicht hergestellt werden" ;
+ Text [ ENGLISH ] = "The Internetconnection to $(ARG1) could not be established" ;
+ Text [ dutch ] = "Er kon geen Internet-verbinding met $(ARG1) tot stand worden gebracht." ;
+ Text [ english_us ] = "Could not establish Internet connection to $(ARG1)" ;
+ Text [ italian ] = "Non è stato possibile stabilire la connessione a Internet a $(ARG1)" ;
+ Text [ spanish ] = "No se pudo establecer la conexión de Internet a $(ARG1)" ;
+ Text [ french ] = "Impossible d'établir la connexion Internet avec $(ARG1)" ;
+ Text [ swedish ] = "Internetförbindelsen till $(ARG1) kunde inte upprättas" ;
+ Text [ danish ] = "Det var ikke muligt at oprette en Internetforbindelse til $(ARG1)" ;
+ Text [ portuguese ] = "Foi impossível estabelecer a ligação à Internet com $(ARG1)." ;
+ Text [ portuguese_brazilian ] = "Die Internetverbindung zu $(ARG1) konnte nicht hergestellt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨ºÍ $(ARG1) ½¨Á¢¹ú¼Ê»¥ÁªÍøÁ¬½Ó";
+ Text[ russian ] = "Íå óäàåòñÿ íàëàäèòü ñâÿçü Èíòåðíåòà ñ $(ARG1)";
+ Text[ polish ] = "Ustanowienie po³¹czenia internetowego z $(ARG1) by³o niemo¿liwe";
+ Text[ japanese ] = "$(ARG1)‚ւ̲ÝÀ°È¯ÄÚ‘±‚ª‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B";
+ Text[ chinese_traditional ] = "µLªk³s½u¨ì $(ARG1)";
+ Text[ arabic ] = "ÊÚÐÑ Úãá ÇÊÕÇá ÅäÊÑäÊ ãÚ $(ARG1)";
+ Text[ dutch ] = "Er kon geen Internet-verbinding met $(ARG1) tot stand worden gebracht.";
+ Text[ chinese_simplified ] = "ÎÞ·¨ºÍ $(ARG1) ½¨Á¢¹ú¼Ê»¥ÁªÍøÁ¬½Ó";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá ðñáãìáôïðïéçèåß ç óýíäåóç Internet ìå ôï $(ARG1).";
+ Text[ korean ] = "$(ARG1)¿¡ ÀÎÅÍ³Ý ¿¬°áÀ» ÇÏÁö ¸øÇßÀ½";
+ Text[ turkish ] = "$(ARG1) Internet baðlantýsý oluþturulamadý";
+ };
+ String ERRCODE_INET_READ
+ {
+ Text = "Daten konnten nicht über das Internet gelesen werden.\nServerfehlermeldung: $(ARG1)" ;
+ Text [ ENGLISH ] = "Error reading from the internet\n.Server error message: $(ARG1)" ;
+ Text [ english_us ] = "Error reading data from the Internet\n.Server error message: $(ARG1)" ;
+ Text [ italian ] = "Non è stato possibile leggere i dati da Internet.\nMessaggio di errore del server: $(ARG1)" ;
+ Text [ spanish ] = "Los datos no se pudieron leer a través de Internet.\nMensaje de error del servidor: $(ARG1)" ;
+ Text [ french ] = "Erreur de lecture des données à partir de l'Internet.\nMessage d'erreur du serveur : $(ARG1)" ;
+ Text [ dutch ] = "Fout bij lezen van gegevens uit internet\n.Foutmelding van server: $(ARG1)" ;
+ Text [ swedish ] = "Data kunde inte läsas via Internet.\nServerfelmeddelande: $(ARG1)" ;
+ Text [ danish ] = "Det var ikke muligt at læses dataene over Internettet\nServerfejlmelding: $(ARG1)" ;
+ Text [ portuguese ] = "Foi impossível ler os dados via Internet.\nMensagem de erro do servidor: $(ARG1)" ;
+ Text [ portuguese_brazilian ] = "Daten konnten nicht über das Internet gelesen werden.\nServerfehlermeldung: $(ARG1)" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Í¨¹ý¹ú¼Ê»¥ÁªÍø¶ÁÈ¡Êý¾Ý¡£\n·þÎñÆ÷±¨¸æ´íÎó£º$(ARG1)";
+ Text[ russian ] = "Ïðî÷èòàòü äàííûå ÷åðåç Èíòåðíåò íåâîçìîæíî.\nÑîîáùåíèå îøèáêè ñåðâåðà: $(ARG1)";
+ Text[ polish ] = "B³¹d odczytu plików z Internetu.\nKomunikat o b³êdzie serwera: $(ARG1)";
+ Text[ japanese ] = "ÃÞ°À‚ͲÝÀ°È¯Ä‚Å“Ç‚ÝŽæ‚ê‚Ü‚¹‚ñ‚Å‚µ‚½B\n»°ÊÞ° ´×° Ò¯¾°¼Þ: $(ARG1)";
+ Text[ chinese_traditional ] = "µLªk³z¹L Internet Ū¨ú¸ê®Æ¡C\n¦øªA¾¹³ø§i¡G$(ARG1)";
+ Text[ arabic ] = "ÊÚÐÑ ÞÑÇÁÉ ÇáÈíÇäÇÊ ÚÈÑ ÇáÅäÊÑäÊ.\nÑÓÇáÉ ÎØà ãä ÇáãÒæøÏ: $(ARG1)";
+ Text[ dutch ] = "Fout bij lezen van gegevens uit internet\n.Foutmelding van server: $(ARG1)";
+ Text[ chinese_simplified ] = "ÎÞ·¨Í¨¹ý¹ú¼Ê»¥ÁªÍø¶ÁÈ¡Êý¾Ý¡£\n·þÎñÆ÷±¨¸æ´íÎó£º$(ARG1)";
+ Text[ greek ] = "ÓöÜëìá êáôÜ ôçí áíÜãíùóç äåäïìÝíùí áðü ôï Internet.\nÌÞíõìá óöÜëìáôïò ôïõ äéáêïìéóôÞ: $(ARG1)";
+ Text[ korean ] = "µ¥ÀÌÅ͸¦ ÀÎÅͳݿ¡¼­ ÀÐÁö ¸øÇß½À´Ï´Ù.\n¼­¹ö ¿À·ù ¸Þ½ÃÁö: $(ARG1)";
+ Text[ turkish ] = "Internet üzerinden veri okunamadý.\nSunucu hata iletisi: $(ARG1)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_INET_WRITE
+ {
+ Text = "Daten konnten nicht ins Internet übertragen werden.\nServerfehlermeldung: $(ARG1)" ;
+ Text [ ENGLISH ] = "Error writing to the internet.Server error message: $(ARG1)" ;
+ Text [ english_us ] = "Error transferring data to the Internet.\nServer error message: $(ARG1)" ;
+ Text [ italian ] = "Non è stato possibile trasferire i dati in Internet.\nMessaggio di errore del server: $(ARG1)" ;
+ Text [ spanish ] = "No se pudieron transferir los datos a Internet.\nMensaje de error del servidor: $(ARG1)" ;
+ Text [ french ] = "Erreur de transfert de données sur l'Internet.\nMessage d'erreur du serveur : $(ARG1)" ;
+ Text [ dutch ] = "Fout bij gegevenstransfer naar Internet.\nFoutmelding server: $(ARG1)" ;
+ Text [ swedish ] = "Data kunde inte överföras till Internet.\nServerfelmeddelande: $(ARG1)" ;
+ Text [ danish ] = "Det var ikke muligt at overføre dataene til Internettet.\nServerfejlmelding: $(ARG1)" ;
+ Text [ portuguese ] = "Foi impossível transferir dados para a Internet.\nMensagem de erro do servidor: $(ARG1)" ;
+ Text [ portuguese_brazilian ] = "Daten konnten nicht ins Internet übertragen werden.\nServerfehlermeldung: $(ARG1)" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Ïò¹ú¼Ê»¥ÁªÍø´«µÝÊý¾Ý¡£\n·þÎñÆ÷±¨¸æ´íÎó£º$(ARG1)";
+ Text[ russian ] = "Ïåðåäàòü äàííûå â Èíòåðíåò íåâîçìîæíî.\nÑîîáùåíèå îøèáêè ñåðâåðà: $(ARG1)";
+ Text[ polish ] = "Danych nie mo¿na przenieœæ do sieci Internetu.\nKomunikat o b³êdzie z serwera: $(ARG1)";
+ Text[ japanese ] = "ÃÞ°À‚ͲÝÀ°È¯Ä‚É“]‘—‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B\n»°ÊÞ° ´×° Ò¯¾°¼Þ: $(ARG1)";
+ Text[ chinese_traditional ] = "µLªk¦V Internet µo°e¸ê®Æ¡C\n¦øªA¾¹³ø§i¡G$(ARG1)";
+ Text[ arabic ] = "ÊÚÐÑ äÞá ÇáÈíÇäÇÊ ÚÈÑ ÇáÅäÊÑäÊ.\nÑÓÇáÉ ÎØà ãä ÇáãÒæøÏ: $(ARG1)";
+ Text[ dutch ] = "Fout bij gegevenstransfer naar Internet.\nFoutmelding server: $(ARG1)";
+ Text[ chinese_simplified ] = "ÎÞ·¨Ïò¹ú¼Ê»¥ÁªÍø´«µÝÊý¾Ý¡£\n·þÎñÆ÷±¨¸æ´íÎó£º$(ARG1)";
+ Text[ greek ] = "ÓöÜëìá êáôÜ ôçí ìåôÜäïóç äåäïìÝíùí ìÝóù ôïõ Internet.\nÌÞíõìá óöÜëìáôïò ôïõ äéáêïìéóôÞ: $(ARG1)";
+ Text[ korean ] = "µ¥ÀÌÅ͸¦ ÀÎÅͳÝÀ¸·Î º¸³»Áö ¸øÇß½À´Ï´Ù.\n¼­¹ö ¿À·ù ¸Þ½ÃÁö: $(ARG1)";
+ Text[ turkish ] = "Internet üzerinden veri aktarýlamadý.\nSunucu hata iletisi: $(ARG1)";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_INET_GENERAL
+ {
+ Text = "Ein allgemeiner Fehler im Internetbereich trat auf" ;
+ Text [ ENGLISH ] = "Gereral Internet Error" ;
+ Text [ dutch ] = "Algemene Internet fout" ;
+ Text [ english_us ] = "Gereral Internet error has occurred" ;
+ Text [ italian ] = "Si è verificato un errore generale nell'area Internet" ;
+ Text [ spanish ] = "Error general en Internet" ;
+ Text [ french ] = "Erreur générale Internet" ;
+ Text [ swedish ] = "Ett allmänt Internet-fel uppstod" ;
+ Text [ danish ] = "Der opstod en generel Internetfejl" ;
+ Text [ portuguese ] = "Erro geral na Internet" ;
+ Text [ portuguese_brazilian ] = "Ein allgemeiner Fehler im Internetbereich trat auf" ;
+ Text[ chinese_simplified ] = "ÔÚ¹ú¼Ê»¥ÁªÍøÄÚ·¢ÉúÁËÒ»¸öÒ»°ã´íÎó";
+ Text[ russian ] = "Ïðîèçîøëà îáùàÿ îøèáêà â îáëàñòè Èíòåðíåòà";
+ Text[ polish ] = "Wyst¹pi³ ogólny b³¹d w Internecie";
+ Text[ japanese ] = "²ÝÀ°È¯Ä—̈æ‚Ɉê”Ê“I‚È´×°‚ª”­¶";
+ Text[ chinese_traditional ] = "Internet ¤ºµo¥Í¤@­Ó¤@¯ë¿ù»~";
+ Text[ arabic ] = "ÍÏË ÎØà ÚÇã Ýí äØÇÞ ÇáÅäÊÑäÊ";
+ Text[ dutch ] = "Algemene Internet fout";
+ Text[ chinese_simplified ] = "ÔÚ¹ú¼Ê»¥ÁªÍøÄÚ·¢ÉúÁËÒ»¸öÒ»°ã´íÎó";
+ Text[ greek ] = "ÐáñïõóéÜóôçêå ãåíéêü óöÜëìá ôïõ Internet";
+ Text[ korean ] = "ÀÎÅÍ³Ý ¿µ¿ª¿¡ ÀϹÝÀûÀÎ ¿À·ù ¹ß»ý";
+ Text[ turkish ] = "Genel Internet hatasý";
+ };
+ String ERRCODE_INET_OFFLINE
+ {
+ Text = "Die angeforderten Internetdaten liegen nicht im Cache und können nicht übertragen werden, da der Onlinemodus nicht aktiv ist" ;
+ Text [ ENGLISH ] = "The requestet internet data is not available in the cache and cannot be transfered since the online mode is not active" ;
+ Text [ portuguese ] = "Os dados da Internet necessários não se encontram em Cache e não podem ser carregados porque o modo online não está activo." ;
+ Text [ english_us ] = "The requested Internet data is not available in the cache and cannot be transmitted as the Online mode has not be activated" ;
+ Text [ portuguese_brazilian ] = "Die angeforderten Internetdaten liegen nicht im Cache und können nicht übertragen werden, da der Onlinemodus nicht aktiv ist" ;
+ Text [ swedish ] = "De begärda Internetdata ligger inte i cachen och kan därför inte överföras eftersom onlineläget inte är aktivt" ;
+ Text [ danish ] = "De anmodede Internetdata er ikke tilgængelige i cachen og kan ikke overføres, fordi onlinetilstanden ikke er aktiveret" ;
+ Text [ italian ] = "I dati di Internet richiesti non si trovano nella cache e non possono essere trasmessi poiché il modo online non è attivo" ;
+ Text [ spanish ] = "Los datos de Internet solicitados no se encuentran en el caché y no pueden ser transmitidos ya que el modo en línea no está activo." ;
+ Text [ french ] = "Impossible de transmettre les données provenant d'Internet : vous n'êtes pas en mode en ligne et les données ne se trouvent pas dans le cache." ;
+ Text [ dutch ] = "De opgevraagde Internetgegevens zijn niet voorhanden in het cachegeheugen en kunnen niet worden getransfereerd daar de Onlinemodus niet actief is" ;
+ Text[ chinese_simplified ] = "ÒòΪÄúµÄ¼ÆËã»úºÍ»¹Ã»Óк͹ú¼Ê»¥ÁªÍøÁ¬½Ó£¬¶øÇÒ¼ÆËã»úµÄ»º³åÇøҲûÓÐÄúÇëÇóµÄ¹ú¼Ê»¥ÁªÍøµÄÊý¾Ý£¬Òò´ËÎÞ·¨×°ÔØ´«µÝÊý¾Ý";
+ Text[ russian ] = "Çàòðåáîâàííûå äàííûå Èíòåðíåòà íå íàõîäÿòñÿ â êýø è ïåðåäàòü èõ íåâîçìîæíî, ò.ê. ðåæèì Online íå àêòèâèçèðîâàí.";
+ Text[ polish ] = "Wymaganych danych z sieci Internet nie ma w pamiêci podrêcznej i nie mo¿na ich za³adowaæ, poniewa¿ tryb online nie jest uaktywniony.";
+ Text[ japanese ] = "Žw’肵‚½²ÝÀ°È¯Ä‚ÌÃÞ°À‚Í·¬¯¼­‚É‚È‚­‚ÄAµÝ×²Ý Ó°ÄÞ‚ª±¸Ã¨ÌÞ‚Å‚Í‚È‚¢‚½‚ß‚É“]‘—‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "ÁÙ¨S¦³³s½u¨ì Internet ¡M¦Ó¥B½w¨R°Ï¤]¨S¦³¼È¦s½Ð¨Dªº Internet ¸ê®Æ¦ÓµLªk¶Ç»¼¸ê®Æ";
+ Text[ arabic ] = "ãÚáæãÇÊ ÇáÅäÊÑäÊ ÇáãØáæÈÉ ÛíÑ ãæÌæÏÉ Ýí æÍÏÉ ÇáÊÎÒíä ÇáãÄÞÊÉ¡ æáÇ íãßä äÞáåÇ¡ ÅÐ Ãä æÖÚ ÇáÇÊÕÇá ÛíÑ äÔØ";
+ Text[ dutch ] = "De opgevraagde Internetgegevens zijn niet voorhanden in het cachegeheugen en kunnen niet worden getransfereerd daar de Onlinemodus niet actief is";
+ Text[ chinese_simplified ] = "ÒòΪÄúµÄ¼ÆËã»úºÍ»¹Ã»Óк͹ú¼Ê»¥ÁªÍøÁ¬½Ó£¬¶øÇÒ¼ÆËã»úµÄ»º³åÇøҲûÓÐÄúÇëÇóµÄ¹ú¼Ê»¥ÁªÍøµÄÊý¾Ý£¬Òò´ËÎÞ·¨×°ÔØ´«µÝÊý¾Ý";
+ Text[ greek ] = "Ôá æçôïýìåíá äåäïìÝíá ôïõ Internet äåí âñßóêïíôáé óôçí êñõöÞ ìíÞìç êáé äåí åßíáé äõíáôüí íá ìåôáäïèïýí, åðåéäÞ äåí åñãÜæåóôå óå êáôÜóôáóç áð´ åõèåßáò óýíäåóçò";
+ Text[ korean ] = "¿äûµÈ ÀÎÅÍ³Ý µ¥ÀÌÅÍ°¡ ij½Ã¿¡ ¾øÀ¸¸ç ¿Â¶óÀÎ ¸ðµå°¡ È°¼ºÈ­µÇ¾î ÀÖÁö ¾Ê¾Æ µ¥ÀÌÅ͸¦ º¸³¾ ¼ö ¾øÀ½";
+ Text[ turkish ] = "Ýstenen Internet verileri önbellekte bulunmuyor ve çevrimiçi kipi etkin olmadýðý için aktarýlamýyor";
+ };
+ String ERRCODE_SFXMSG_STYLEREPLACE
+ {
+ Text = "Soll der Style $(ARG1) ersetzt werden?" ;
+ Text [ ENGLISH ] = "Should style $(ARG1) be overwritten?" ;
+ ExtraData = ERRCODE_MSG_ERROR | ERRCODE_BUTTON_OK_CANCEL ;
+ Text [ english_us ] = "Should the $(ARG1) Style be replaced?" ;
+ Text [ italian ] = "Sostituire lo stile $(ARG1) ?" ;
+ Text [ spanish ] = "¿Desea sustituir el estilo $(ARG1)?" ;
+ Text [ french ] = "Souhaitez-vous que le style $(ARG1) soit remplacé ?" ;
+ Text [ dutch ] = "Opmaakprofiel $(ARG1) vervangen?" ;
+ Text [ swedish ] = "Ska formatet $(ARG1) ersättas?" ;
+ Text [ danish ] = "Skal typografien $(ARG1) erstattes?" ;
+ Text [ portuguese ] = "Substituir o estilo $(ARG1)?" ;
+ Text [ portuguese_brazilian ] = "Soll der Style $(ARG1) ersetzt werden?" ;
+ Text[ chinese_simplified ] = "Òª¸üÌæÑùʽ $(ARG1) £¿";
+ Text[ russian ] = "Çàìåíèòü ñòèëü $(ARG1)?";
+ Text[ polish ] = "Zamieniæ styl $(ARG1)?";
+ Text[ japanese ] = "½À²Ù $(ARG1)‚ð’uŠ·‚µ‚Ü‚·‚©?";
+ Text[ chinese_traditional ] = "­n§ó´À³o­Ó¼Ë¦¡ $(ARG1)¡H";
+ Text[ arabic ] = "åá ÊÑíÏ ÇÓÊÈÏÇá ÇáäãØ $(ARG1)¿";
+ Text[ dutch ] = "Opmaakprofiel $(ARG1) vervangen?";
+ Text[ chinese_simplified ] = "Òª¸üÌæÑùʽ $(ARG1) £¿";
+ Text[ greek ] = "Íá áíôéêáôáóôáèåß ôï óôõë $(ARG1);";
+ Text[ korean ] = "À¯Çü$(ARG1)À» ´ëüÇϽðڽÀ´Ï±î?";
+ Text[ turkish ] = "$(ARG1) biçimi deðiþtirilsin mi?";
+ Text[ language_user1 ] = "\"Vorlagen\" Styles are always capitalized no matter where they show up. EM15.5.00 - - - -";
+ };
+ String ERRCODE_SFX_NOFILTER
+ {
+ Text = "Ein Filter wurde nicht gefunden" ;
+ Text [ ENGLISH ] = "Filter not ound " ;
+ Text [ english_us ] = "A filter has not been found" ;
+ Text [ italian ] = "Non è stato trovato un filtro" ;
+ Text [ spanish ] = "No se ha encontrado un filtro" ;
+ Text [ french ] = "Filtre introuvable" ;
+ Text [ dutch ] = "Geen filter gevonden" ;
+ Text [ swedish ] = "Inget filter kunde hittas" ;
+ Text [ danish ] = "Der blev ikke fundet et filter" ;
+ Text [ portuguese ] = "O filtro não foi encontrado." ;
+ Text [ portuguese_brazilian ] = "Ein Filter wurde nicht gefunden" ;
+ Text[ chinese_simplified ] = "ûÓÐÕÒµ½¹ýÂËÆ÷";
+ Text[ russian ] = "Ôèëüòð íå íàéäåí";
+ Text[ polish ] = "Filtru nie znaleziono";
+ Text[ japanese ] = "̨ÙÀ‚ÍŒ©‚‚©‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "¨S¦³§ä¨ì¹LÂo¾¹";
+ Text[ arabic ] = "ÊÚÐÑ ÇáÚËæÑ Úáì ÝáÊÑ";
+ Text[ dutch ] = "Geen filter gevonden";
+ Text[ chinese_simplified ] = "ûÓÐÕÒµ½¹ýÂËÆ÷";
+ Text[ greek ] = "Äåí âñÝèçêå êÜðïéï ößëôñï";
+ Text[ korean ] = "ÇÊÅÍ°¡ ¹ß°ßµÇÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Bir filtre bulunamadý";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_SFX_NODOCRELOAD
+ {
+ Text = "Dokument kann nicht bearbeitet werden" ;
+ };
+ String ERRCODE_SFX_CANTFINDORIGINAL
+ {
+ Text = "Das Original konnte nicht bestimmt werden" ;
+ Text [ English ] = "The original could not be detected" ;
+ Text [ dutch ] = "Het origineel kon niet als zodanig worden herkend." ;
+ Text [ english_us ] = "The original could not be determined." ;
+ Text [ swedish ] = "Originalet kunde inte bestämmas." ;
+ Text [ danish ] = "Det var ikke muligt at bestemme originalen" ;
+ Text [ italian ] = "Impossibile determinare l'originale" ;
+ Text [ spanish ] = "No se pudo determinar el original." ;
+ Text [ french ] = "Impossible de déterminer l'original" ;
+ Text [ portuguese ] = "Foi impossível determinar o original." ;
+ Text [ portuguese_brazilian ] = "Das Original konnte nicht bestimmt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨È·¶¨Ô­¼þ";
+ Text[ russian ] = "Îïðåäåëèòü îðèãèíàë íåâîçìîæíî";
+ Text[ polish ] = "Orygina³u nie mo¿na by³o okreœliæ.";
+ Text[ japanese ] = "µØ¼ÞÅÙ‚ÍŒˆ’è‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk½T©w­ì¥ó";
+ Text[ arabic ] = "ÊÚÐÑ ÊÍÏíÏ ÇáÃÕá";
+ Text[ dutch ] = "Het origineel kon niet als zodanig worden herkend.";
+ Text[ chinese_simplified ] = "ÎÞ·¨È·¶¨Ô­¼þ";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá ïñéóôåß ôï áñ÷éêü.";
+ Text[ korean ] = "¿øº»ÀÌ °áÁ¤µÇÁö ¾Ê¾Ò½À´Ï´Ù.";
+ Text[ turkish ] = "Asýl belirlenemedi";
+ };
+ String ERRCODE_SFX_CANTCREATECONTENT
+ {
+ Text = "Der Inhalt konnte nicht erzeugt werden" ;
+ Text [ English ] = "The content could not be created" ;
+ Text [ dutch ] = "Er kon geen inhoud worden gecreëerd." ;
+ Text [ english_us ] = "The contents could not be created." ;
+ Text [ swedish ] = "Innehållet kunde inte skapas" ;
+ Text [ danish ] = "Det var ikke muligt at oprette indholdet" ;
+ Text [ italian ] = "Impossibile creare il contenuto" ;
+ Text [ spanish ] = "No se pudo crear el contenido." ;
+ Text [ french ] = "Impossible de créer le contenu" ;
+ Text [ portuguese ] = "Foi impossível criar o conteúdo." ;
+ Text [ portuguese_brazilian ] = "Der Inhalt konnte nicht erzeugt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Éú³ÉÄÚÈÝ";
+ Text[ russian ] = "Ñîçäàòü ñîäåðæàíèå íåâîçìîæíî";
+ Text[ polish ] = "Zawartoœæ nie mog³a zostaæ utworzona";
+ Text[ japanese ] = "“à—e‚Í쬂ł«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk¥Í¦¨¤º®e";
+ Text[ arabic ] = "ÊÚÐÑ ÅäÔÇÁ ÇáãÍÊæì";
+ Text[ dutch ] = "Er kon geen inhoud worden gecreëerd.";
+ Text[ chinese_simplified ] = "ÎÞ·¨Éú³ÉÄÚÈÝ";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá äçìéïõñãçèåß ôï ðåñéå÷üìåíï.";
+ Text[ korean ] = "³»¿ëÀÌ ¸¸µé¾îÁöÁö ¾Ê¾Ò½À´Ï´Ù.";
+ Text[ turkish ] = "Ýçerik oluþturulamadý";
+ };
+ String ERRCODE_SFX_CANTCREATELINK
+ {
+ Text = "Die Verknüpfung konnte nicht erzeugt werden" ;
+ Text [ English ] = "The link could not be created" ;
+ Text [ dutch ] = "Er kon geen link worden gecreëerd." ;
+ Text [ english_us ] = "The link could not be created." ;
+ Text [ swedish ] = "Länken kunde inte skapas" ;
+ Text [ danish ] = "Det var ikke muligt at oprette kæden" ;
+ Text [ italian ] = "Impossibile creare il collegamento" ;
+ Text [ spanish ] = "No se pudo crear el vínculo." ;
+ Text [ french ] = "Impossible de créer le lien" ;
+ Text [ portuguese ] = "Foi impossível criar a ligação." ;
+ Text [ portuguese_brazilian ] = "Die Verknüpfung konnte nicht erzeugt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Éú³ÉÁ´½Ó";
+ Text[ russian ] = "Ñîçäàòü ññûëêó íåâîçìîæíî";
+ Text[ polish ] = "£¹cze nie mog³o zostaæ utworzone";
+ Text[ japanese ] = "Øݸ‚Í쬂ł«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk«Ø¥ß±¶®|";
+ Text[ arabic ] = "ÊÚÐÑ ÅäÔÇÁ ÇáÇÑÊÈÇØ";
+ Text[ dutch ] = "Er kon geen link worden gecreëerd.";
+ Text[ chinese_simplified ] = "ÎÞ·¨Éú³ÉÁ´½Ó";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá äçìéïõñãçèåß ç óýíäåóç";
+ Text[ korean ] = "¿¬°áÀÌ ¸¸µé¾îÁöÁö ¾Ê¾Ò½À´Ï´Ù.";
+ Text[ turkish ] = "Baðlantý oluþturulamadý";
+ };
+ String ERRCODE_SFX_WRONGBMKFORMAT
+ {
+ Text = "Das Format der Verknüpfung ist ungültig" ;
+ Text [ English ] = "The format of the link ist invalid" ;
+ Text [ dutch ] = "Ongeldig link-formaat" ;
+ Text [ english_us ] = "The link format is invalid." ;
+ Text [ swedish ] = "Länkens format är ogiltigt" ;
+ Text [ danish ] = "Kædeformatet er ugyldigt" ;
+ Text [ italian ] = "Formato del collegamento non valido" ;
+ Text [ spanish ] = "El formato del vínculo no es válido" ;
+ Text [ french ] = "Le format du lien est incorrect" ;
+ Text [ portuguese ] = "O formato da ligação não é válido." ;
+ Text [ portuguese_brazilian ] = "Das Format der Verknüpfung ist ungültig" ;
+ Text[ chinese_simplified ] = "ÎÞЧµÄÁ´½Ó¸ñʽ";
+ Text[ russian ] = "Íåïðàâèëüíûé ôîðìàò ññûëêè";
+ Text[ polish ] = "Format ³¹cza jest nieprawid³owy";
+ Text[ japanese ] = "Øݸ‚Ì‘Ž®‚Í–³Œø‚Å‚·";
+ Text[ chinese_traditional ] = "±¶®|®æ¦¡µL®Ä";
+ Text[ arabic ] = "ÊäÓíÞ ÇáÇÑÊÈÇØ ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "Ongeldig link-formaat";
+ Text[ chinese_simplified ] = "ÎÞЧµÄÁ´½Ó¸ñʽ";
+ Text[ greek ] = "Ç ìïñöÞ ôçò óýíäåóçò äåí åßíáé Ýãêõñç.";
+ Text[ korean ] = "¿¬°áÀÇ ¼­½ÄÀÌÀ¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Baðlantýnýn formatý geçerli deðil";
+ };
+ String ERRCODE_SFX_WRONGICONFILE
+ {
+ Text = "Die Konfiguration der Symbolanzeige ist ungültig" ;
+ Text [ English ] = "The configuration of the symbolview is invalid" ;
+ Text [ dutch ] = "Ongeldige configuratie van pictogramweergave" ;
+ Text [ english_us ] = "The configuration of the icon display is invalid." ;
+ Text [ swedish ] = "Konfigurationen för symbolvisningen är ogiltig." ;
+ Text [ danish ] = "Ikonvisningens konfiguration er ugyldig" ;
+ Text [ italian ] = "Configurazione della visualizzazione dei simboli non valida" ;
+ Text [ spanish ] = "La configuración del panel de símbolos no es válida" ;
+ Text [ french ] = "La configuration de l'affichage des icônes est incorrecte" ;
+ Text [ portuguese ] = "A configuração do painel de ícones não é válida." ;
+ Text [ portuguese_brazilian ] = "Die Konfiguration der Symbolanzeige ist ungültig" ;
+ Text[ chinese_simplified ] = "ͼ±êÏÔʾµÄÅäÖÃÎļþÎÞЧ";
+ Text[ russian ] = "Íåïðàâèëüíàÿ êîíôèãóðàöèÿ ïîêàçà ñèìâîëîâ";
+ Text[ polish ] = "Konfiguracja wyœwietlania symboli jest nieprawid³owa.";
+ Text[ japanese ] = "¼ÝÎÞÙ•\\Ž¦‚Ìݒ肪–³Œø‚Å‚·";
+ Text[ chinese_traditional ] = "¥Î©ó¹Ï¼ÐÅã¥Üªº°t¸mÀÉ®×µL®Ä";
+ Text[ arabic ] = "Êßæíä ÚÑÖ ÇáÑãæÒ ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "Ongeldige configuratie van pictogramweergave";
+ Text[ chinese_simplified ] = "ͼ±êÏÔʾµÄÅäÖÃÎļþÎÞЧ";
+ Text[ greek ] = "Ç äéáìüñöùóç ôçò åìöÜíéóçò ôùí óõìâüëùí äåí åßíáé Ýãêõñç";
+ Text[ korean ] = "¾ÆÀÌÄÜ º¸±â ±¸¼ºÀÌ À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Simge görüntüleme konfigürasyonu geçerli deðil";
+ };
+ String ERRCODE_SFX_CANTWRITEICONFILE
+ {
+ Text = "Die Konfiguration der Symbolanzeige kann nicht gespeichert werden" ;
+ Text [ English ] = "The configuration of the symbolview could not be written" ;
+ Text [ dutch ] = "Configuration van pictogram kan niet worden opgeslagen" ;
+ Text [ english_us ] = "The configuration of the icon display can not be saved." ;
+ Text [ swedish ] = "Konfigurationen för symbolvisningen kan inte sparas." ;
+ Text [ danish ] = "Det er ikke muligt at gemme ikonvisningens konfiguration" ;
+ Text [ italian ] = "Impossibile salvare la configurazione della rappresentazione dei simboli" ;
+ Text [ spanish ] = "No se puede guardar la configuración del panel de símbolos" ;
+ Text [ french ] = "Impossible d'enregistrer les paramètres d'affichage de l'icône" ;
+ Text [ portuguese ] = "É impossível guardar a configuração do painel de ícones." ;
+ Text [ portuguese_brazilian ] = "Die Konfiguration der Symbolanzeige kann nicht gespeichert werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨´æÅÌͼ±êÏÔʾµÄÅäÖÃÎļþ";
+ Text[ russian ] = "Ñîõðàíèòü êîíôèãóðàöèþ ïîêàçà ñèìâîëà íåâîçìîæíî";
+ Text[ polish ] = "Konfiguracji wyœwietlania symboli nie mo¿na by³o zapisaæ.";
+ Text[ japanese ] = "¼ÝÎÞÙ•\\Ž¦‚ÌÝ’è‚Í•Û‘¶‚Å‚«‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "µLªkÀx¦s¹Ï¼ÐÅã¥Üªº°t¸mÀÉ®×";
+ Text[ arabic ] = "ÊÚÐÑÍÝÙ Êßæíä ÚÑÖ ÇáÑãæÒ";
+ Text[ dutch ] = "Configuration van pictogram kan niet worden opgeslagen";
+ Text[ chinese_simplified ] = "ÎÞ·¨´æÅÌͼ±êÏÔʾµÄÅäÖÃÎļþ";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá áðïèçêåõôåß ç äéáìüñöùóç ôçò åìöÜíéóçò ôùí óõìâüëùí";
+ Text[ korean ] = "¾ÆÀÌÄÜ º¸±â ±¸¼ºÀÌ ÀúÀåµÇÁö ¾Ê¾Ò½À´Ï´Ù.";
+ Text[ turkish ] = "Simge görüntüleme konfigürasyonu kaydedilemiyor";
+ };
+ String ERRCODE_SFX_CANTDELICONFILE
+ {
+ Text = "Die Konfiguration der Symbolanzeige konnte nicht gelöscht werden" ;
+ Text [ English ] = "The configuration of the symbolview could not be removed" ;
+ Text [ dutch ] = "Configuratie van pictogram kon niet worden gewist." ;
+ Text [ english_us ] = "The configuration of the icon display could not be deleted." ;
+ Text [ swedish ] = "Konfigurationen för symbolvisningen kunde inte raderas." ;
+ Text [ danish ] = "Det var ikke muligt at slette ikonvisningens konfiguration" ;
+ Text [ italian ] = "Impossibile cancellare la configurazione della rappresentazione dei simbol" ;
+ Text [ spanish ] = "No se pudo eliminar la configuración del panel de símbolos." ;
+ Text [ french ] = "Impossible de supprimer les paramètres d'affichage de l'icône" ;
+ Text [ portuguese ] = "Foi impossível eliminar a configuração do painel de ícones." ;
+ Text [ portuguese_brazilian ] = "Die Konfiguration der Symbolanzeige konnte nicht gelöscht werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨É¾³ýͼ±êÏÔʾµÄÅäÖÃÎļþ";
+ Text[ russian ] = "Óäàëèòü êîíôèãóðàöèþ ïîêàçà ñèìâîëà íåâîçìîæíî";
+ Text[ polish ] = "Konfiguracja wyœwietlania symboli nie mo¿e zostaæ usuniêta.";
+ Text[ japanese ] = "¼ÝÎÞÙ•\\Ž¦‚ÌÝ’è‚Í휂ł«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk§R°£¹Ï¼ÐÅã¥Üªº°t¸mÀÉ®×";
+ Text[ arabic ] = "ÊÚÐÑ ÍÐÝ Êßæíä ÚÑÖ ÇáÑãæÒ.";
+ Text[ dutch ] = "Configuratie van pictogram kon niet worden gewist.";
+ Text[ chinese_simplified ] = "ÎÞ·¨É¾³ýͼ±êÏÔʾµÄÅäÖÃÎļþ";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá äéáãñáöåß ç äéáìüñöùóç ôçò åìöÜíéóçò ôùí óõìâüëùí";
+ Text[ korean ] = "¾ÆÀÌÄÜ º¸±â ±¸¼ºÀÌ »èÁ¦µÇ¾ú½À´Ï´Ù.";
+ Text[ turkish ] = "Simge görüntüleme konfigürasyonu silinemedi.";
+ };
+ String ERRCODE_SFX_CANTRENAMECONTENT
+ {
+ Text = "Der Inhalt konnte nicht umbenannt werden" ;
+ Text [ English ] = "The content could not be renamed" ;
+ Text [ dutch ] = "De naam van de inhoud kon niet worden gewijzigd." ;
+ Text [ english_us ] = "Contents cannot be renamed" ;
+ Text [ swedish ] = "Innehållet kunde inte döpas om" ;
+ Text [ danish ] = "Det var ikke muligt at omdøbe indholdet" ;
+ Text [ italian ] = "Impossibile rinominare il contenuto" ;
+ Text [ spanish ] = "No se puede cambiar el nombre al contenido." ;
+ Text [ french ] = "Impossible de renommer le contenu" ;
+ Text [ portuguese ] = "Foi impossível mudar o nome do conteúdo." ;
+ Text [ portuguese_brazilian ] = "Der Inhalt konnte nicht umbenannt werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨ÖØÃüÃûÄÚÈÝ";
+ Text[ russian ] = "Ïåðåèìåíîâàòü ñîäåðæèìîå íåâîçìîæíî";
+ Text[ polish ] = "Nazwa zawartoœci nie mog³a zostaæ zmieniona.";
+ Text[ japanese ] = "“à—e‚Ì–¼‘O‚Ì•ÏX‚Í‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk­«·s©R¦W¤º®e";
+ Text[ arabic ] = "ÊÚÐÑÊ ÚãáíÉ ÅÚÇÏÉ ÊÓãíÉ ÇáãÍÊæíÇÊ";
+ Text[ dutch ] = "De naam van de inhoud kon niet worden gewijzigd.";
+ Text[ chinese_simplified ] = "ÎÞ·¨ÖØÃüÃûÄÚÈÝ";
+ Text[ greek ] = "Ôï ðåñéå÷üìåíï äåí Þôáí äõíáôüí íá ìåôïíïìáóôåß.";
+ Text[ korean ] = "³»¿ë À̸§ ¹Ù²Ù±â°¡ ¾ÈµË´Ï´Ù.";
+ Text[ turkish ] = "Ýçerik yeniden adlandýrýlamadý";
+ };
+ String ERRCODE_SFX_INVALIDBMKPATH
+ {
+ Text = "Der Bookmarkordner ist ungültig" ;
+ Text [ English ] = "The bookmarkfolder is invalid" ;
+ Text [ dutch ] = "De bookmark-ordner is ongeldig" ;
+ Text [ english_us ] = "The bookmark folder is invalid." ;
+ Text [ swedish ] = "Bokmärkesmappen är ogiltig" ;
+ Text [ danish ] = "Bogmærkemappen er ugyldig" ;
+ Text [ italian ] = "Cartella bookmark non valida" ;
+ Text [ spanish ] = "Carpeta de marcadores no válida" ;
+ Text [ french ] = "Le dossier de Bookmarks indiqué est incorrect" ;
+ Text [ portuguese ] = "A pasta de bookmarks não é válida." ;
+ Text [ portuguese_brazilian ] = "Der Bookmarkordner ist ungültig" ;
+ Text[ chinese_simplified ] = "ÊéÇ©Îļþ¼ÐÎÞЧ";
+ Text[ russian ] = "Íåïðàâèëüíàÿ ïàïêà çàêëàäîê";
+ Text[ polish ] = "Folder z zak³adkami jest nieprawid³owy";
+ Text[ japanese ] = "ÌÞ¯¸Ï°¸ Ì«ÙÀÞ‚Í–³Œø‚Å‚·";
+ Text[ chinese_traditional ] = "®ÑÅÒ¸ê®Æ§¨µL®Ä";
+ Text[ arabic ] = "ãÌáÏ ÇáÅÔÇÑÇÊ ÇáãÑÌÚíÉ ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "De bookmark-ordner is ongeldig";
+ Text[ chinese_simplified ] = "ÊéÇ©Îļþ¼ÐÎÞЧ";
+ Text[ greek ] = "Ï öÜêåëïò óåëéäïäåéêôþí äåí åßíáé Ýãêõñïò";
+ Text[ korean ] = "Ã¥°¥ÇÇ Æú´õ°¡ À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Yer iþareti klasörü geçersizdir";
+ };
+ String ERRCODE_SFX_CANTWRITEURLCFGFILE
+ {
+ Text = "Die Konfiguration der lokal zu speichernden URLs konnte nicht gespeichert werden" ;
+ Text [ English ] = "The configuration of the URLs to save local could not be saved" ;
+ Text [ dutch ] = "De configuratie van de URLs kon niet lokaal worden opgeslagen" ;
+ Text [ english_us ] = "The configuration of the URLs to be saved locally could not be saved" ;
+ Text [ swedish ] = "Konfigurationen för de URL som skall sparas lokalt kunde inte sparas" ;
+ Text [ danish ] = "Det var ikke muligt at gemme konfigurationen på de URLs, som skulle gemmes lokalt" ;
+ Text [ italian ] = "Non è stato possibile salvare la configurazione delle URL da salvare localmente" ;
+ Text [ spanish ] = "No se pudo guardar la configuración de las URLs a guardar localmente." ;
+ Text [ french ] = "Impossible d'enregistrer la configuration pour l'enregistrement local des URLs" ;
+ Text [ portuguese ] = "Foi impossível guardar a configuração dos URLs a serem guardados localmente." ;
+ Text [ portuguese_brazilian ] = "Die Konfiguration der lokal zu speichernden URLs konnte nicht gespeichert werden" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨´æÅÌÒª¾Ö²¿´¢´æ URL µØÖ·µÄÅäÖÃÎļþ";
+ Text[ russian ] = "Ñîõðàíèòü êîíôèãóðàöèþ ëîêàëüíî ñîõðàíÿåìîãî URL íåâîçìîæíî";
+ Text[ polish ] = "Nie mo¿na by³o zapisaæ konfiguracji adresu URL, który mia³ zostaæ lokalnie zapisany.";
+ Text[ japanese ] = "Û°¶Ù‚Å•Û‘¶‚·‚éURL‚ÌÝ’è‚Í•Û‘¶‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk«O¦s§½³¡Àx¦sªº URL °t¸mÀÉ®×";
+ Text[ arabic ] = "ÊÚÐÑ ÍÝÙ Êßæíä ÇáÚäÇæíä (URLs) ÇáæÇÌÈ ÍÝÙåÇ ãÍáíÇð";
+ Text[ dutch ] = "De configuratie van de URLs kon niet lokaal worden opgeslagen";
+ Text[ chinese_simplified ] = "ÎÞ·¨´æÅÌÒª¾Ö²¿´¢´æ URL µØÖ·µÄÅäÖÃÎļþ";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá áðïèçêåõôåß ç äéáìüñöùóç ôùí URL ðïõ ðñüêåéôáé íá áðïèçêåõôïýí ôïðéêÜ";
+ Text[ korean ] = "·ÎÄÿ¡ ÀúÀåµÈ URLÀÇ ±¸¼ºÀÌ ÀúÀåµÇÁö ¾Ê¾Ò½À´Ï´Ù.";
+ Text[ turkish ] = "Yerel olarak kaydedilecek URL'Lerin konfigürasyonu kaydedilemedi";
+ };
+ String ERRCODE_SFX_WRONGURLCFGFORMAT
+ {
+ Text = "Das Format der Konfiguration der lokal zu speichernden URLs ist ungültig" ;
+ Text [ English ] = "The format of the configuration of the URLs to save local is invalid" ;
+ Text [ dutch ] = "De configuratie van de URLs kon niet lokaal worden opgeslagen daar het formaat ongeldig is." ;
+ Text [ english_us ] = "The configuration format of the URLs to be saved locally is invalid" ;
+ Text [ swedish ] = "Formatet för konfigurationen för de URL som skall sparas lokalt är ogiltigt" ;
+ Text [ danish ] = "Konfigurationsformatet på de URLs, som skulle gemmes lokalt, er ugyldigt" ;
+ Text [ italian ] = "Il formato della configurazione delle URL da salvare localmente non è valido" ;
+ Text [ spanish ] = "No es válido el formato de la configuración de las URLs a guardar localmente." ;
+ Text [ french ] = "Le format configuré pour les URLs à enregistrer localement est incorrect" ;
+ Text [ portuguese ] = "O formato da configuração dos URLs a serem guardados localmente não é válido." ;
+ Text [ portuguese_brazilian ] = "Das Format der Konfiguration der lokal zu speichernden URLs ist ungültig" ;
+ Text[ chinese_simplified ] = "¾Ö²¿´¢´æ URL µØÖ·µÄÅäÖÃÎļþ¸ñʽÎÞЧ";
+ Text[ russian ] = "Íåïðàâèëüíûé ôîðìàò êîíôèãóðàöèè ëîêàëüíî ñîõðàíÿåìîãî URL";
+ Text[ polish ] = "Format konfiguracji adresu URL, który ma zostaæ lokalnie zapisany, jest nieprawid³owy.";
+ Text[ japanese ] = "Û°¶Ù‚Å•Û‘¶‚·‚éURL‚ðÝ’è‚·‚é‘Ž®‚ª–³Œø‚Å‚·";
+ Text[ chinese_traditional ] = "§½³¡Àx¦s URL °t¸mÀɮ׮榡µL®Ä";
+ Text[ arabic ] = "ÊäÓíÞ Êßæíä ÇáÚäÇæíä (URLs) ¡ÇáæÇÌÈ ÍÝÙåÇ ãÍáíÇð¡ ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "De configuratie van de URLs kon niet lokaal worden opgeslagen daar het formaat ongeldig is.";
+ Text[ chinese_simplified ] = "¾Ö²¿´¢´æ URL µØÖ·µÄÅäÖÃÎļþ¸ñʽÎÞЧ";
+ Text[ greek ] = "Ç ìïñöÞ ôùí ñõèìßóåùí ôïõ URL, ôï ïðïßï ðñüêåéôáé íá áðïèçêåõôåß ôïðéêÜ, äåí åßíáé Ýãêõñç.";
+ Text[ korean ] = "·ÎÄÿ¡ ÀúÀåµÈ URLÀÇ ±¸¼ºÀÌ À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Yerel olarak kaydedilecek URL'lerin konfigürasyon formatý geçerli deðil";
+ };
+ String ERRCODE_SFX_NODOCUMENT
+ {
+ Text = "Es existiert kein Dokument, auf das die Aktion angewendet werden kann" ;
+ Text [ English ] = "There exists no document to act on" ;
+ Text [ dutch ] = "Er bestaat geen document waarop deze activiteit kan worden toegepast." ;
+ Text [ english_us ] = "This action cannot be applied to a document that does not exist" ;
+ Text [ swedish ] = "Det finns inget dokument som åtgärden kan användas på." ;
+ Text [ danish ] = "Der findes intet dokument, som handlingen kan anvendes på" ;
+ Text [ italian ] = "Non esiste un documento sul quale eseguire tale operazione" ;
+ Text [ spanish ] = "No existe ningún documento al que se le pueda aplicar la acción" ;
+ Text [ french ] = "Il n'existe aucun document auquel l'action peut être appliquée" ;
+ Text [ portuguese ] = "Não existe nenhum documento ao qual possa ser aplicada a acção." ;
+ Text [ portuguese_brazilian ] = "Es existiert kein Dokument, auf das die Aktion angewendet werden kann" ;
+ Text[ chinese_simplified ] = "Ö´ÐвÙ×÷ËùÐèµÄÎĵµ²»´æÔÚ";
+ Text[ russian ] = "Äîêóìåíò, ê êîòîðîìó äîëæíî áûòü ïðèìåíåíî ýòî äåéñòâèå, íå ñóùåñòâóåò";
+ Text[ polish ] = "Nie istnieje ¿aden dokument, do którego mo¿na by zastosowaæ tê akcjê.";
+ Text[ japanese ] = "±¸¼®Ý‚Ì“K—p‚Å‚«‚éÄÞ·­ÒÝÄ‚Í‚ ‚è‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "¥Î¨Ó°õ¦æ¾Þ§@ªº¤å¥ó¤£¦s¦b";
+ Text[ arabic ] = "áÇ íæÌÏ ãÓÊäÏ íãßä ÊØÈíÞ ÇáÅÌÑÇÁ Úáíå";
+ Text[ dutch ] = "Er bestaat geen document waarop deze activiteit kan worden toegepast.";
+ Text[ chinese_simplified ] = "Ö´ÐвÙ×÷ËùÐèµÄÎĵµ²»´æÔÚ";
+ Text[ greek ] = "Äåí õðÜñ÷åé Ýããñáöï óôï ïðïßï íá åöáñìïóôåß ç åíÝñãåéá";
+ Text[ korean ] = "ÀÌ ÀÛ¾÷À» Àû¿ëÇÒ ¼ö ÀÖ´Â ¹®¼­°¡ ¾øÀ½";
+ Text[ turkish ] = "Ýþlemin uygulanabileceði bir belge mevcut deðil";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_SFX_INVALIDLINK
+ {
+ Text = "Die Verknüpfung verweist auf ein ungültiges Ziel" ;
+ Text [ English ] = "Invalid Link Target" ;
+ Text [ dutch ] = "De koppeling verwijst naar een ongeldig doel" ;
+ Text [ english_us ] = "The link refers to an invalid target" ;
+ Text [ swedish ] = "Länken refererar till ett ogiltigt mål" ;
+ Text [ danish ] = "Kæden referer til et ugyldigt mål" ;
+ Text [ italian ] = "Il collegamento si riferisce ad una destinazione non valida" ;
+ Text [ spanish ] = "El vínculo se refiere a un destino no válido" ;
+ Text [ french ] = "Le lien renvoit à une cible incorrecte" ;
+ Text [ portuguese ] = "A ligação remete a um destino não válido." ;
+ Text [ portuguese_brazilian ] = "Die Verknüpfung verweist auf ein ungültiges Ziel" ;
+ Text[ chinese_simplified ] = "Á´½ÓÖ¸ÏòÒ»¸öÎÞЧµÄÄ¿±ê";
+ Text[ russian ] = "Ññûëêà óêàçûâàåò íà íåïðàâèëüíóþ öåëü";
+ Text[ polish ] = "£¹cze odnosi siê do nieprawid³owego celu.";
+ Text[ japanese ] = "Øݸ‚Í–³Œø‚ÈÀ°¹Þ¯Ä‚ðŽQÆ‚µ‚Ä‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "±¶®|«ü¦V¤@­ÓµL®Äªº¥Ø¼Ð";
+ Text[ arabic ] = "íÔíÑ ÇáÇÑÊÈÇØ Åáì åÏÝ ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "De koppeling verwijst naar een ongeldig doel";
+ Text[ chinese_simplified ] = "Á´½ÓÖ¸ÏòÒ»¸öÎÞЧµÄÄ¿±ê";
+ Text[ greek ] = "Ç óýíäåóç áíáöÝñåôáé óå Ýíáí ìç Ýãêõñï ðñïïñéóìü";
+ Text[ korean ] = "¿¬°áÀÌ À¯È¿ÇÏÁö ¾ÊÀº Ÿ°ÙÀ» ÁöÁ¤ÇÏ°í ÀÖÀ½";
+ Text[ turkish ] = "Baðlantý geçersiz bir hedef gösteriyor";
+ };
+ String ERRCODE_SFX_INVALIDTRASHPATH
+ {
+ Text = "Der Pfad für den Papierkorb ist ungültig" ;
+ Text [ English ] = "The path of the trash is invalid" ;
+ Text [ portuguese ] = "O atalho para Reciclagem não é válido" ;
+ Text [ english_us ] = "The Recycle Bin path is invalid" ;
+ Text [ portuguese_brazilian ] = "Der Pfad für den Papierkorb ist ungültig" ;
+ Text [ swedish ] = "Sökvägen till papperskorgen är ogiltig" ;
+ Text [ danish ] = "Stien til papirkurven er ugyldig" ;
+ Text [ italian ] = "Il percorso per il cestino non è valido" ;
+ Text [ spanish ] = "La ruta para la papelera no es válida." ;
+ Text [ french ] = "Le chemin spécifié pour la corbeille est incorrect" ;
+ Text [ dutch ] = "Het pad naar de prullenbak is ongeldig" ;
+ Text[ chinese_simplified ] = "»ØÊÕվ·¾¶ÎÞЧ";
+ Text[ russian ] = "Íåïðàâèëüíûé ïóòü äëÿ êîðçèíû";
+ Text[ polish ] = "Œcie¿ka dla kosza jest nieprawid³owa.";
+ Text[ japanese ] = "‚²‚Ý” ‚ÌÊß½‚ª–³Œø‚Å‚·";
+ Text[ chinese_traditional ] = "¸ê·½¦^¦¬µ©ªº¸ô®|µL®Ä";
+ Text[ arabic ] = "ãÓÇÑ ÓáÉ ÇáãÍÐæÝÇÊ ÛíÑ ÕÇáÍ";
+ Text[ dutch ] = "Het pad naar de prullenbak is ongeldig";
+ Text[ chinese_simplified ] = "»ØÊÕվ·¾¶ÎÞЧ";
+ Text[ greek ] = "Ç äéáäñïìÞ ôïõ êÜäïõ áíáêýêëùóçò äåí åßíáé Ýãêõñç";
+ Text[ korean ] = "ÈÞÁöÅë °æ·Î°¡ À¯È¿ÇÏÁö ¾ÊÀ½";
+ Text[ turkish ] = "Çöp kutusu veri yolu geçerli deðil";
+ };
+ String ERRCODE_SFX_NOTRESTORABLE
+ {
+ Text = "Der Eintrag konnte nicht wiederhergestellt werden" ;
+ Text [ English ] = "The entry could not be restored" ;
+ Text [ portuguese ] = "Foi impossível restaurar a entrada." ;
+ Text [ english_us ] = "The entry could not be restored" ;
+ Text [ portuguese_brazilian ] = "Der Eintrag konnte nicht wiederhergestellt werden" ;
+ Text [ swedish ] = "Posten kunde inte återställas" ;
+ Text [ danish ] = "Det var ikke muligt at gendanne elementet" ;
+ Text [ italian ] = "Non è stato possibile ripristinare la voce" ;
+ Text [ spanish ] = "No se pudo restaurar la entrada." ;
+ Text [ french ] = "Impossible de restaurer l'entrée" ;
+ Text [ dutch ] = "Het item kon niet worden hersteld" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨ÐÞ¸´Õâ¸öÌõÄ¿";
+ Text[ russian ] = "Âîññòàíîâèòü çàïèñü íåâîçìîæíî";
+ Text[ polish ] = "Wpis nie móg³ zostaæ przywrócony";
+ Text[ japanese ] = "€–Ú‚Í•œŒ³‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½";
+ Text[ chinese_traditional ] = "µLªk­×´_³o­Ó¶µ¥Ø";
+ Text[ arabic ] = "ÊÚÐÑÊ ÚãáíÉ ÇÓÊÚÇÏÉ ÇáÅÏÎÇá";
+ Text[ dutch ] = "Het item kon niet worden hersteld";
+ Text[ chinese_simplified ] = "ÎÞ·¨ÐÞ¸´Õâ¸öÌõÄ¿";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá ãßíåé åðáíáöïñÜ ôçò åããñáöÞò";
+ Text[ korean ] = "Ç׸ñÀ» º¹±¸ÇÒ ¼ö ¾øÀ½";
+ Text[ turkish ] = "Giriþ geri yüklenemedi";
+ };
+ String ERRCODE_IO_NAMETOOLONG
+ {
+ Text = "Der Dateiname ist für das Ziel-Dateisystem zu lang." ;
+ Text [ ENGLISH ] = "Filename too long for target filesystem." ;
+ Text [ portuguese ] = "O nome do ficheiro é demasiado extenso para o sistema de ficheiros pretendido." ;
+ Text [ english_us ] = "The file name is too long for the target file system." ;
+ Text [ portuguese_brazilian ] = "Der Dateiname ist für das Ziel-Dateisystem zu lang." ;
+ Text [ swedish ] = "Filnamnet är för långt för mål-filsystemet." ;
+ Text [ danish ] = "Filnavnet er for langt til mål-filsystemet." ;
+ Text [ italian ] = "Il nome del file è troppo lungo per il file system di destinazione." ;
+ Text [ spanish ] = "El nombre del archivo es demasiado largo para el sistema de archivos destino." ;
+ Text [ french ] = "Le nom de fichier est trop long pour le système de fichiers cible." ;
+ Text [ dutch ] = "Bestandsnaam te lang voor het doel-bestandssysteem." ;
+ Text[ chinese_simplified ] = "Õâ¸öÎļþÃûµÄ³¤¶È²»ÊÊÓÚÄ¿±êÎļþϵͳ¡£";
+ Text[ russian ] = "Ñëèøêîì äëèííîå èìÿ ôàéëà äëÿ öåëåâîé ñèñòåìû ôàéëà.";
+ Text[ polish ] = "Nazwa pliku jest za d³uga dla docelowego systemu plików.";
+ Text[ japanese ] = "À°¹Þ¯Ä‚Ì̧²Ù ¼½ÃÑ‚Ì̧²Ù–¼‚ª’·‚·‚¬‚Ü‚·";
+ Text[ chinese_traditional ] = "³o­ÓÀɮצWªºªø«×¤£¾A¥Î©ó¥Ø¼ÐÀɮרt²Î¡C";
+ Text[ arabic ] = "ÇÓã ÇáãáÝ Øæíá ÌÏÇð ÈÇáäÓÈÉ áäÙÇã ÇáãáÝÇÊ ÇáåÏÝ.";
+ Text[ dutch ] = "Bestandsnaam te lang voor het doel-bestandssysteem.";
+ Text[ chinese_simplified ] = "Õâ¸öÎļþÃûµÄ³¤¶È²»ÊÊÓÚÄ¿±êÎļþϵͳ¡£";
+ Text[ greek ] = "Ôï üíïìá åßíáé õðåñâïëéêÜ ìåãÜëï ãéá ôï óýóôçìá ðñïÝëåõóçò áñ÷åßùí.";
+ Text[ korean ] = "ÆÄÀϸíÀÌ ´ë»ó ÆÄÀÏ ½Ã½ºÅÛ¿¡ ³Ê¹« ±é´Ï´Ù.";
+ Text[ turkish ] = "Dosya adý, hedef dosya sistemi için fazla uzun.";
+ };
+ String ERRCODE_SFX_CONSULTUSER
+ {
+ Text = "Die Angaben zum Ausführen der Funktion sind unvollständig." ;
+ Text [ ENGLISH ] = "Can't execute function due to incomplete arguments." ;
+ Text [ english_us ] = "The details for running the function are incomplete." ;
+ Text [ portuguese ] = "Os dados para a execução da função estão incompletos." ;
+ Text [ portuguese_brazilian ] = "Zum Angaben zum Ausführen der Funktion sind unvollständig." ;
+ Text [ swedish ] = "Funktionen kan inte utföras på grund av ofullständiga uppgifter." ;
+ Text [ danish ] = "Angivelserne til udførelse af funktionen er ufuldstændige." ;
+ Text [ italian ] = "I dati sono insufficienti per l'esecuzione della funzione." ;
+ Text [ spanish ] = "La función no se puede ejecutar por falta de argumentos." ;
+ Text [ french ] = "Les données indiquées pour l'exécution de la fonction sont incomplètes." ;
+ Text [ dutch ] = "De gegevens voor het uitvoeren van de functie zijn niet compleet.." ;
+ Text[ chinese_simplified ] = "Ö´Ðй¦ÄܵÄÃüÁî²»ÍêÕû¡£";
+ Text[ russian ] = "Äàííûå äëÿ âûïîëíåíèÿ ýòîé ôóíêöèè ÿâëÿþòñÿ íåïîëíûìè.";
+ Text[ polish ] = "Dane do wykonania funkcji s¹ nie kompletne.";
+ Text[ japanese ] = "‹@”\\‚ðŽÀs‚³‚¹‚邽‚ß‚ÌŽwŽ¦‚ª–¢Š®—¹‚Å‚·B";
+ Text[ chinese_traditional ] = "«ü©w°õ¦æ¥\\¯àªº«ü¥O¤£§¹¾ã¡C";
+ Text[ arabic ] = "ÇáÈíÇäÇÊ ÇááÇÒãÉ áÊäÝíÐ ÇáãåãÉ ÛíÑ ãßÊãáÉ.";
+ Text[ dutch ] = "De gegevens voor het uitvoeren van de functie zijn niet compleet..";
+ Text[ chinese_simplified ] = "Ö´Ðй¦ÄܵÄÃüÁî²»ÍêÕû¡£";
+ Text[ greek ] = "Ôá äåäïìÝíá ãéá ôçí åêôÝëåóç ôçò ëåéôïõñãßáò äåí åßíáé ïëïêëçñùìÝíá.";
+ Text[ korean ] = "±â´É ½ÇÇàÀ» À§ÇÑ ÁöÁ¤»çÇ×ÀÌ ºÒ¿ÏÀüÇÕ´Ï´Ù.";
+ Text[ turkish ] = "Ýþlemin yürütülmesi için gereken bilgiler tam deðil.";
+ };
+ String ERRCODE_SFX_INVALIDSYNTAX
+ {
+ Text = "Die Syntax der Eingabe ist ungültig." ;
+ Text [ English ] = "The syntax of the input is invalid." ;
+ Text [ portuguese ] = "A sintaxe da entrada está incorrecta." ;
+ Text [ english_us ] = "The input syntax is invalid." ;
+ Text [ portuguese_brazilian ] = "Die Syntax der Eingabe ist ungültig." ;
+ Text [ swedish ] = "Inmatningens syntax är ogiltig." ;
+ Text [ danish ] = "Inputsyntaksen er ugyldig." ;
+ Text [ italian ] = "La sintassi della digitazione è errata." ;
+ Text [ spanish ] = "La sintaxis de la entrada no es válida" ;
+ Text [ french ] = "La syntaxe de la saisie est incorrecte." ;
+ Text [ dutch ] = "Onjuiste schrijfwijze." ;
+ Text[ chinese_simplified ] = "ÊäÈëµÄÓï·¨ÎÞЧ¡£";
+ Text[ russian ] = "Íåïðàâèëüíûé ñèíòàêñèñ ââîäà";
+ Text[ polish ] = "Sk³adnia wpisu jest niepoprawna.";
+ Text[ japanese ] = "‚±‚Ì“ü—̼͂ÝÀ¯¸½‚Í–³Œø‚Å‚·B";
+ Text[ chinese_traditional ] = "¿é¤J¤º®e»yªkµL®Ä¡C";
+ Text[ arabic ] = "ÈäÇÁ ÌãáÉ ÇáÅÏÎÇá ÛíÑ ÕÇáÍ.";
+ Text[ dutch ] = "Onjuiste schrijfwijze.";
+ Text[ chinese_simplified ] = "ÊäÈëµÄÓï·¨ÎÞЧ¡£";
+ Text[ greek ] = "ËáíèáóìÝíç óýíôáîç åéóáãùãÞò.";
+ Text[ korean ] = "ÀÔ·Â ±¸¹®ÀÌ À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Giriþ söz dizimi geçerli deðil.";
+ };
+ String ERRCODE_SFX_CANTCREATEFOLDER
+ {
+ Text = "Die Syntax der Eingabe ist falsch." ;
+ Text [ English ] = "The syntax of the input is invalid." ;
+ Text [ portuguese ] = "A sintaxe da entrada está incorrecta." ;
+ Text [ english_us ] = "The input syntax is invalid." ;
+ Text [ portuguese_brazilian ] = "Die Syntax der Eingabe ist falsch." ;
+ Text [ swedish ] = "Inmatningens syntax är felaktig." ;
+ Text [ danish ] = "Inputsyntaksen er forkert" ;
+ Text [ italian ] = "La sintassi della digitazione è errata." ;
+ Text [ spanish ] = "La sintaxis de la entrada es incorrecta." ;
+ Text [ french ] = "La syntaxe de la saisie est incorrecte." ;
+ Text [ dutch ] = "Onjuiste schrijfwijze." ;
+ Text[ chinese_simplified ] = "ÊäÈëµÄÓï·¨´íÎó¡£";
+ Text[ russian ] = "Íåïðàâèëüíûé ñèíòàêñèñ ââîäà.";
+ Text[ polish ] = "Sk³adnia wpisu jest niepoprawna.";
+ Text[ japanese ] = "€–ڂ̼ÝÀ¯¸½‚ª³‚µ‚­‚ ‚è‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "¿é¤J¤º®e»yªk¿ù»~¡C";
+ Text[ arabic ] = "ÈäÇÁ ÌãáÉ ÇáÅÏÎÇá ÛíÑ ÕÍíÍ.";
+ Text[ dutch ] = "Onjuiste schrijfwijze.";
+ Text[ chinese_simplified ] = "ÊäÈëµÄÓï·¨´íÎó¡£";
+ Text[ greek ] = "ËáíèáóìÝíç óýíôáîç åéóáãùãÞò.";
+ Text[ korean ] = "ÀÔ·Â ±¸¹®ÀÌ Æ²¸³´Ï´Ù.";
+ Text[ turkish ] = "Giriþ söz dizimi yanlýþ.";
+ };
+ String ERRCODE_SFX_CANTRENAMEFOLDER
+ {
+ Text = "Die Syntax der Eingabe ist falsch." ;
+ Text [ English ] = "The syntax of the input is invalid." ;
+ Text [ portuguese ] = "A sintaxe da entrada está incorrecta." ;
+ Text [ english_us ] = "The input syntax is invalid." ;
+ Text [ portuguese_brazilian ] = "Die Syntax der Eingabe ist falsch." ;
+ Text [ swedish ] = "Inmatningens syntax är felaktig." ;
+ Text [ danish ] = "Inputsyntaksen er forkert." ;
+ Text [ italian ] = "La sintassi della digitazione è errata." ;
+ Text [ spanish ] = "La sintaxis de entrada es incorrecta." ;
+ Text [ french ] = "La syntaxe de la saisie est incorrecte." ;
+ Text [ dutch ] = "Onjuiste schrijfwijze." ;
+ Text[ chinese_simplified ] = "ÊäÈëµÄÓï·¨´íÎó¡£";
+ Text[ russian ] = "Íåïðàâèëüíûé ñèíòàêñèñ ââîäà.";
+ Text[ polish ] = "Sk³adnia wpisu jest niepoprawna.";
+ Text[ japanese ] = "€–ڂ̼ÝÀ¯¸½‚ª³‚µ‚­‚ ‚è‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "¿é¤Jªº»yªk¿ù»~¡C";
+ Text[ arabic ] = "ÈäÇÁ ÌãáÉ ÇáÅÏÎÇá ÛíÑ ÕÍíÍ.";
+ Text[ dutch ] = "Onjuiste schrijfwijze.";
+ Text[ chinese_simplified ] = "ÊäÈëµÄÓï·¨´íÎó¡£";
+ Text[ greek ] = "ËáíèáóìÝíç óýíôáîç åéóáãùãÞò.";
+ Text[ korean ] = "ÀÔ·Â ±¸¹®ÀÌ Æ²¸³´Ï´Ù.";
+ Text[ turkish ] = "Giriþ söz dizimi yanlýþ.";
+ Text[ language_user1 ] = " ";
+ };
+ String ERRCODE_SFX_WRONG_CDF_FORMAT
+ {
+ Text = "Das Channeldokument hat kein gültiges Format." ;
+ Text [ ENGLISH ] = "Das Channeldokument hat kein gültiges Format." ;
+ Text [ portuguese ] = "O formato do documento do canal não é válido." ;
+ Text [ english_us ] = "The channel document has an invalid format." ;
+ Text [ portuguese_brazilian ] = "Das Channeldokument hat kein gültiges Format." ;
+ Text [ swedish ] = "Channeldokumentet har inget giltigt format." ;
+ Text [ danish ] = "Channel-dokumentet har ikke et gyldigt format." ;
+ Text [ italian ] = "Il documento di canale non ha un formato valido." ;
+ Text [ spanish ] = "El formato del documento del canal no es válido." ;
+ Text [ french ] = "Le format du document Channel est incorrect." ;
+ Text [ dutch ] = "Het channel-document heeft een ongeldig formaat." ;
+ Text[ chinese_simplified ] = "ƵµÀÎĵµµÄ¸ñʽÎÞЧ¡£";
+ Text[ russian ] = "Íåïðàâèëüíûé ôîðìàò äîêóìåíòà êàíàëà.";
+ Text[ polish ] = "Dokument kana³u nie posiada prawid³owego formatu.";
+ Text[ japanese ] = "Á¬ÝÈÙ ÄÞ·­ÒÝÄ‚Ì‘Ž®‚Í–³Œø‚Å‚·B";
+ Text[ chinese_traditional ] = "ÀW¹D¤å¥ó®æ¦¡µL®Ä";
+ Text[ arabic ] = "ÊäÓíÞ ãÓÊäÏ ÇáÞäÇÉ ÛíÑ ÕÇáÍ.";
+ Text[ dutch ] = "Het channel-document heeft een ongeldig formaat.";
+ Text[ chinese_simplified ] = "ƵµÀÎĵµµÄ¸ñʽÎÞЧ¡£";
+ Text[ greek ] = "Ç ìïñöÞ ôïõ åããñÜöïõ êáíáëéïý äåí åßíáé Ýãêõñç.";
+ Text[ korean ] = "ä³Î ¹®¼­ÀÇ ¼­½ÄÀÌ À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Kanal belgesinin formatý geçersiz.";
+ };
+ String ERRCODE_SFX_EMPTY_SERVER
+ {
+ Text = "Der Server darf nicht leer sein" ;
+ Text [ English ] = "The server may not be empty" ;
+ Text [ portuguese ] = "O servidor não pode estar vazio." ;
+ Text [ english_us ] = "The server must not be empty" ;
+ Text [ portuguese_brazilian ] = "Der Server darf nicht leer sein" ;
+ Text [ swedish ] = "Servern får ej vara tom" ;
+ Text [ danish ] = "Serveren må ikke være tom" ;
+ Text [ italian ] = "Il server non può essere vuoto" ;
+ Text [ spanish ] = "El servidor no debe estar vacío." ;
+ Text [ french ] = "Le serveur ne doit pas être vide" ;
+ Text [ dutch ] = "De server mag niet leeg zijn." ;
+ Text[ chinese_simplified ] = "·þÎñÆ÷²»¿ÉÒÔ¿Õȱ";
+ Text[ russian ] = "Ñåðâåð íå äîëæåí áûòü ïóñòûì";
+ Text[ polish ] = "Serwer nie mo¿e byæ pusty";
+ Text[ japanese ] = "»°ÊÞ°‚Í‹ó”’‚Å‚Í‚¢‚¯‚Ü‚¹‚ñ";
+ Text[ chinese_traditional ] = "¦øªA¾¹¤£¥i¥HªÅ¯Ê";
+ Text[ arabic ] = "íÌÈ ÃáÇ íßæä ÇáãÒæøÏ ÝÇÑÛÇð";
+ Text[ dutch ] = "De server mag niet leeg zijn.";
+ Text[ chinese_simplified ] = "·þÎñÆ÷²»¿ÉÒÔ¿Õȱ";
+ Text[ greek ] = "Ï äéáêïìéóôÞò äåí åðéôñÝðåôáé íá åßíáé êåíüò";
+ Text[ korean ] = "¼­¹ö°¡ ºñ¾î¼­´Â ¾ÈµÊ";
+ Text[ turkish ] = "Sunucu boþ olmamalýdýr";
+ };
+ String ERRCODE_SFX_NO_ABOBOX
+ {
+ Text = "Sie benötigen einen Abonnements Ordner, wenn Sie einen Channel installieren wollen." ;
+ Text [ english_us ] = "A subscription folder is required to install a Channel." ;
+ Text [ italian ] = "È necessaria una cartella di sottoscrizione se volete installare un channel.";
+ Text [ portuguese_brazilian ] = "Sie benötigen einen Abonnements Ordner, wenn Sie einen Channel installieren wollen.";
+ Text [ portuguese ] = "Para poder instalar um Channel, necessita de uma pasta para subscrições.";
+ Text [ danish ] = "Du har brug for en abonnement-mappe, hvis du vil installere en channel.";
+ Text [ french ] = "Vous avez besoin d'un dossier d'abonnements pour installer un Channel.";
+ Text [ swedish ] = "Du behöver en prenumerationsmapp om Du vill installera en channel.";
+ Text [ dutch ] = "Om een channel te installeren heeft u een abonnementenmap nodig.";
+ Text [ spanish ] = "Para instalar un canal necesita una carpeta de suscripciones.";
+ Text[ chinese_simplified ] = "Èç¹ûÒª°²×°ÆµµÀ£¬Äú¾ÍÐèÒªÏÈ´´½¨Ò»¸ö¶©ÔÄÎļþ¼Ð¡£";
+ Text[ russian ] = "Äëÿ èíñòàëëÿöèè Channel íåîáõîäèìà ïàïêà ïîäïèñêè.";
+ Text[ polish ] = "Instalacja kana³u wymaga utworzenia folderu subkrypcji.";
+ Text[ japanese ] = "Á¬ÝÈÙ‚ð²Ý½Ä°Ù‚·‚éꇂÍw“ÇÌ«ÙÀÞ‚ª•K—v‚Å‚·B";
+ Text[ chinese_traditional ] = "¦pªG­n¦w¸ËÀW¹D¡M±z´N»Ý­n«Ø¥ß¤@­Ó­q¾\\¸ê®Æ§¨";
+ Text[ arabic ] = "áßí ÊÊãßä ãä ÊËÈíÊ ÞäÇÉ ÃäÊ ÈÍÇÌÉ Åáì ãÌáÏ ÇÔÊÑÇßÇÊ.";
+ Text[ dutch ] = "Om een channel te installeren heeft u een abonnementenmap nodig.";
+ Text[ chinese_simplified ] = "Èç¹ûÒª°²×°ÆµµÀ£¬Äú¾ÍÐèÒªÏÈ´´½¨Ò»¸ö¶©ÔÄÎļþ¼Ð¡£";
+ Text[ greek ] = "Ãéá íá ãßíåé åãêáôÜóôáóç åíüò êáíáëéïý áðáéôåßôáé Ýíáò öÜêåëïò óõíäñïìþí.";
+ Text[ korean ] = "ä³ÎÀ» ¼³Ä¡ÇÏ·Á¸é ¾Ë¸²½Åû Æú´õ°¡ ÇÊ¿äÇÕ´Ï´Ù.";
+ Text[ turkish ] = "Kanal kurmak için bir üyelik klasörünüz olmalý.";
+ };
+#ifdef ERRCODE_IO_INVALIDLENGTH
+ String ERRCODE_IO_INVALIDLENGTH
+ {
+ Text = "Ungültige Datenlänge." ;
+ Text [ english ] = "Invalid data length." ;
+ Text [ portuguese ] = "Extensão de dados incorrecta." ;
+ Text [ english_us ] = "Invalid data length." ;
+ Text [ portuguese_brazilian ] = "Ungültige Datenlänge." ;
+ Text [ swedish ] = "Ogiltig datalängd." ;
+ Text [ danish ] = "Ugyldig datalængde." ;
+ Text [ italian ] = "Lunghezza dati non valida." ;
+ Text [ spanish ] = "Longitud de datos no válida." ;
+ Text [ french ] = "Longueur des données incorrecte." ;
+ Text [ dutch ] = "Onjuiste gegevenslengte" ;
+ Text[ chinese_simplified ] = "ÎÞЧµÄÊý¾Ý³¤¶È¡£";
+ Text[ russian ] = "Íåïðàâèëüíàÿ äëèíà äàííûõ.";
+ Text[ polish ] = "Nieprawid³owa d³ugoœæ danych.";
+ Text[ japanese ] = "–³Œø‚ÈÃÞ°À‚Ì’·‚³B";
+ Text[ chinese_traditional ] = "¸ê®Æªø«×µL®Ä¡C";
+ Text[ arabic ] = "Øæá ÇáÈíÇäÇÊ ÛíÑ ÕÇáÍ.";
+ Text[ dutch ] = "Onjuiste gegevenslengte";
+ Text[ chinese_simplified ] = "ÎÞЧµÄÊý¾Ý³¤¶È¡£";
+ Text[ greek ] = "Ìç Ýãêõñï ìÞêïò äåäïìÝíùí.";
+ Text[ korean ] = "µ¥ÀÌÅÍ ±æÀÌ°¡ À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù.";
+ Text[ turkish ] = "Geçersiz veri uzunluðu.";
+ };
+ String ERRCODE_IO_CURRENTDIR
+ {
+ Text = "Funktion unmöglich: Pfad enthält aktuelles Verzeichnis" ;
+ Text [ english ] = "Funcion impossible: path contains current directory." ;
+ Text [ portuguese ] = "Função impossível: o atalho contém o directório activo." ;
+ Text [ english_us ] = "Function not possible: path contains current directory." ;
+ Text [ portuguese_brazilian ] = "Funktion unmöglich: Pfad enthält aktuelles Verzeichnis" ;
+ Text [ swedish ] = "Funktion omöjlig: Sökväg innehåller aktuell katalog" ;
+ Text [ danish ] = "Funktion ikke mulig: stien indeholder aktuelt bibliotek" ;
+ Text [ italian ] = "Funzione impossibile: il percorso contiene la cartella corrente" ;
+ Text [ spanish ] = "Función imposible: La ruta contiene el directorio actual." ;
+ Text [ french ] = "Impossible d'exécuter la fonction : le chemin indiqué inclut le répertoire actif" ;
+ Text [ dutch ] = "Functie niet mogelijk. Pad bevat actuele directory" ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´Ðй¦ÄÜ£ºÂ·¾¶º¬Óе±Ç°µÄĿ¼";
+ Text[ russian ] = "Íåâîçìîæíàÿ ôóíêöèÿ: ïóòü ñîäåðæèò òåêóùèé êàòàëîã";
+ Text[ polish ] = "Funkcja niemo¿liwa:Œcie¿ka zawiera aktualny katalog";
+ Text[ japanese ] = "‹@”\\•s‰Â”\\FÊß½‚ªŒ»Ý‚ÌÃÞ¨Ú¸ÄØ‚ðŠÜ‚ñ‚Å‚¢‚Ü‚·";
+ Text[ chinese_traditional ] = "µLªk°õ¦æ¥\\¯à¡G¸ô®|§t¦³·í«eªº¥Ø¿ý";
+ Text[ arabic ] = "åÐå ÇáãåãÉ ÛíÑ ããßäÉ: íÍÊæí ÇáãÓÇÑ Úáì ÇáÏáíá ÇáÍÇáí.";
+ Text[ dutch ] = "Functie niet mogelijk. Pad bevat actuele directory";
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´Ðй¦ÄÜ£ºÂ·¾¶º¬Óе±Ç°µÄĿ¼";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá åêôåëåóôåß ç ëåéôïõñãßá: Ç äéáäñïìÞ ðåñéÝ÷åé ôïí ôñÝ÷ùí êáôÜëïãï";
+ Text[ korean ] = "±â´É ºÒ°¡´É: °æ·Î°¡ ÇöÀç µð·ºÅ丮 Æ÷ÇÔ";
+ Text[ turkish ] = "Ýþlev olanaklý deðil: Veri yolu yürürlükteki dizini içeriyor";
+ };
+ String ERRCODE_IO_NOTSAMEDEVICE
+ {
+ Text = "Funktion unmöglich: Nicht dasselbe Gerät (Laufwerk)." ;
+ Text [ english ] = "Function impossible: not same device (drive)." ;
+ Text [ portuguese ] = "Função impossível: periférico não é o mesmo (unidade)." ;
+ Text [ english_us ] = "Function not possible: device (drive) not identical." ;
+ Text [ portuguese_brazilian ] = "Funktion unmöglich: Nicht dasselbe Gerät (Laufwerk)." ;
+ Text [ swedish ] = "Funktion omöjlig: Inte samma apparat (enhet)." ;
+ Text [ danish ] = "Funktion ikke mulig: ikke samme enhed (drev)." ;
+ Text [ italian ] = "Funzione impossibile: apparecchio (drive) diverso." ;
+ Text [ spanish ] = "Función imposible: No es el mismo dispositivo (unidad)." ;
+ Text [ french ] = "Impossible d'exécuter la fonction : il ne s'agit pas du même volume." ;
+ Text [ dutch ] = "Functie niet mogelijk: niet hetzelfde apparaat (station)." ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´Ðй¦ÄÜ£º²»ÊÇͬһ¸öÉ豸(Çý¶¯ÅÌ)¡£";
+ Text[ russian ] = "Íåâîçìîæíàÿ ôóíêöèÿ: äðóãîå óñòðîéñòâî (äèñê).";
+ Text[ polish ] = "Funkcja niemo¿liwa: nie to samo urz¹dzenie (napêd).";
+ Text[ japanese ] = "‹@”\\•s‰Â”\\F“¯‚¶ÃÞ¨ÊÞ²½(ÄÞײÌÞ)‚Å‚Í‚ ‚è‚Ü‚¹‚ñ¡";
+ Text[ chinese_traditional ] = "µLªk°õ¦æ¥\\¯à¡G¤£¬O¦P¤@­Ó³]³Æ(ÅX°Ê½L)¡C";
+ Text[ arabic ] = "åÐå ÇáãåãÉ ÛíÑ ããßäÉ: ÇáÌåÇÒ (ãÍÑß ÇáÃÞÑÇÕ( ÛíÑ ããÇËá.";
+ Text[ dutch ] = "Functie niet mogelijk: niet hetzelfde apparaat (station).";
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´Ðй¦ÄÜ£º²»ÊÇͬһ¸öÉ豸(Çý¶¯ÅÌ)¡£";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá åêôåëåóôåß ç ëåéôïõñãßá: Ç óõóêåõÞ äåí åßíáé ç ßäéá (äßóêïò).";
+ Text[ korean ] = "±â´É ºÒ°¡´É: ÀåÄ¡(µå¶óÀ̺ê)°¡ µ¿ÀÏÇÏÁö ¾ÊÀ½.";
+ Text[ turkish ] = "Ýþlev olanaklý deðil: Chiza (sürücü) ayný deðil.";
+ };
+ String ERRCODE_IO_DEVICENOTREADY
+ {
+ Text = "Gerät (Laufwerk) nicht bereit." ;
+ Text [ english ] = "Device (drive) not ready." ;
+ Text [ portuguese ] = "Periférico (unidade) não está pronto." ;
+ Text [ english_us ] = "Device (drive) not ready." ;
+ Text [ portuguese_brazilian ] = "Gerät (Laufwerk) nicht bereit." ;
+ Text [ swedish ] = "Apparat (enhet) ej redo." ;
+ Text [ danish ] = "Enheden (drevet) er ikke klar." ;
+ Text [ italian ] = "Apparecchio (drive) non pronto." ;
+ Text [ spanish ] = "Dispositivo (unidad) no listo." ;
+ Text [ french ] = "Le périphérique (lecteur) n'est pas prêt." ;
+ Text [ dutch ] = "Apparaat (station) niet gereed." ;
+ Text[ chinese_simplified ] = "É豸(Çý¶¯ÅÌ)»¹Ã»ÓÐ×¼±¸¾ÍÐ÷¡£";
+ Text[ russian ] = "Óñòðîéñòâî (äèñê) íå ãîòîâî.";
+ Text[ polish ] = "Urz¹dzenie (napêd) nie gotowe.";
+ Text[ japanese ] = "ÃÞ¨ÊÞ²½(ÄÞײÌÞ)‚Ì€”õ‚ª‚Å‚«‚Ä‚¢‚Ü‚¹‚ñB";
+ Text[ chinese_traditional ] = "³]³Æ(ÅX°Ê½L)ÁÙ¨S¦³·Ç³Æ´Nºü";
+ Text[ arabic ] = "ÇáÌåÇÒ (ãÍÑß ÇáÃÞÑÇÕ) ÛíÑ ÌÇåÒ.";
+ Text[ dutch ] = "Apparaat (station) niet gereed.";
+ Text[ chinese_simplified ] = "É豸(Çý¶¯ÅÌ)»¹Ã»ÓÐ×¼±¸¾ÍÐ÷¡£";
+ Text[ greek ] = "Ç óõóêåõÞ (ìïíÜäá äßóêïõ) äåí åßíáé Ýôïéìç.";
+ Text[ korean ] = "ÀåÄ¡(µå¶óÀ̺ê)°¡ ÁغñµÇ¾î ÀÖÁö ¾ÊÀ½.";
+ Text[ turkish ] = "Cihaz (sürücü) hazýr deðil.";
+ };
+ String ERRCODE_IO_BADCRC
+ {
+ Text = "Falsche Prüfsumme." ;
+ Text [ english ] = "Bad checksum" ;
+ Text [ portuguese ] = "Soma de revisão errada." ;
+ Text [ english_us ] = "Wrong check amount." ;
+ Text [ portuguese_brazilian ] = "Falsche Prüfsumme." ;
+ Text [ swedish ] = "Fel kontrollsumma." ;
+ Text [ danish ] = "Forkert kontrolsum" ;
+ Text [ italian ] = "Somma da esaminare errata." ;
+ Text [ spanish ] = "Suma errónea de revisión." ;
+ Text [ french ] = "Somme de révision erronée." ;
+ Text [ dutch ] = "Controlegetal niet juist." ;
+ Text[ chinese_simplified ] = "´íÎóµÄ¼ì²éÊýÄ¿¡£";
+ Text[ russian ] = "Íåïðàâèëüíàÿ êîíòðîëüíàÿ ñóììà.";
+ Text[ polish ] = "Nieprawid³owa suma kontrolna.";
+ Text[ japanese ] = "³‚µ‚­‚È‚¢Áª¯¸»Ñ¡";
+ Text[ chinese_traditional ] = "Àˬd¼Æ¥Ø¦³»~";
+ Text[ arabic ] = "ãÌãæÚ ÇÎÊÈÇÑí ÎÇØÆ";
+ Text[ dutch ] = "Controlegetal niet juist.";
+ Text[ chinese_simplified ] = "´íÎóµÄ¼ì²éÊýÄ¿¡£";
+ Text[ greek ] = "ËÜèïò óýíïëï åëÝã÷ïõ";
+ Text[ korean ] = "üũ ÇÕ°è°¡ Ʋ¸³´Ï´Ù.";
+ Text[ turkish ] = "Yanlýþ saðlama toplamý.";
+ };
+ String ERRCODE_IO_WRITEPROTECTED
+ {
+ Text = "Funktion unmöglich: Schreibgeschützt." ;
+ Text [ english ] = "Function impossible: write protected." ;
+ Text [ portuguese ] = "Função impossível: só de leitura." ;
+ Text [ english_us ] = "Function not possible: write protected." ;
+ Text [ portuguese_brazilian ] = "Funktion unmöglich: Schreibgeschützt." ;
+ Text [ swedish ] = "Funktion omöjlig: Skrivskyddad." ;
+ Text [ danish ] = "Funktion ikke mulig: skrivebeskyttet" ;
+ Text [ italian ] = "Funzione impossibile: solo lettura." ;
+ Text [ spanish ] = "Función imposible: Solo lectura." ;
+ Text [ french ] = "Impossible d'exécuter la fonction : en lecture-seule" ;
+ Text [ dutch ] = "Functie niet mogelijk: schrijfbeveiligd." ;
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´Ðй¦ÄÜ£º·À¸²Ð´¡£";
+ Text[ russian ] = "Íåâîçìîæíàÿ ôóíêöèÿ: óñòàíîâëåíà çàùèòà îò çàïèñè.";
+ Text[ polish ] = "Wykonanie funkcji niemo¿liwe: Tylko do odczytu.";
+ Text[ japanese ] = "‹@”\\•s‰Â”\\F‘‚«ž‚Ý•ÛŒìB";
+ Text[ chinese_traditional ] = "µLªk°õ¦æ¥\\¯à¡G¨¾Âмg";
+ Text[ arabic ] = "åÐå ÇáãåãÉ ÛíÑ ããßäÉ: ãÍãí ÖÏ ÇáßÊÇÈÉ.";
+ Text[ dutch ] = "Functie niet mogelijk: schrijfbeveiligd.";
+ Text[ chinese_simplified ] = "ÎÞ·¨Ö´Ðй¦ÄÜ£º·À¸²Ð´¡£";
+ Text[ greek ] = "Äåí åßíáé äõíáôüí íá åêôåëåóôåß ç ëåéôïõñãßá: Ìüíï ãéá áíÜãíùóç";
+ Text[ korean ] = "±â´É ºÒ°¡´É: ¾²±â º¸È£µÊ.";
+ Text[ turkish ] = "Ýþlev olanaklý deðil: Yazma korumalý.";
+ };
+#endif
+};
+
+// eof ------------------------------------------------------------------------
+
diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk
new file mode 100644
index 000000000000..c1f3e9c65ef3
--- /dev/null
+++ b/svtools/source/misc/makefile.mk
@@ -0,0 +1,160 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME= svtools
+TARGET= misc
+LIBTARGET= NO
+USE_LDUMP2= TRUE
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(GUI)"=="MAC"
+CFLAGS += -nomapcr
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=misc
+SRC1FILES=\
+ config.src \
+ demo.src \
+ pver.src \
+ iniman.src \
+ ehdl.src
+
+SRS2NAME=ehdl
+SRC2FILES=\
+ errtxt.src
+
+SRS3NAME=mediatyp
+SRC3FILES=\
+ mediatyp.src
+
+SLOFILES=\
+ $(LIB2OBJFILES) \
+ $(LIB3OBJFILES) \
+ $(SLO)$/svtdata.obj
+
+OBJFILES=\
+ $(OBJ)$/filearch.obj \
+ $(OBJ)$/svtdata.obj
+
+LIB2TARGET=$(SLB)$/misc1.lib
+LIB2OBJFILES=\
+ $(SLO)$/adrparse.obj \
+ $(SLO)$/inethist.obj \
+ $(SLO)$/inettype.obj \
+ $(SLO)$/iniadrtk.obj \
+ $(SLO)$/loginerr.obj \
+ $(SLO)$/strcrypt.obj \
+ $(SLO)$/strmadpt.obj
+
+LIB3TARGET=$(SLB)$/misc2.lib
+LIB3OBJFILES=\
+ $(SLO)$/agprop.obj \
+ $(SLO)$/config.obj \
+ $(SLO)$/confitem.obj \
+ $(SLO)$/demo.obj \
+ $(SLO)$/ehdl.obj \
+ $(SLO)$/filearch.obj \
+ $(SLO)$/flbytes.obj \
+ $(SLO)$/imap.obj \
+ $(SLO)$/imap2.obj \
+ $(SLO)$/imap3.obj \
+ $(SLO)$/iniman.obj \
+ $(SLO)$/iniprop.obj \
+ $(SLO)$/ownlist.obj \
+ $(SLO)$/pver.obj \
+ $(SLO)$/urihelper.obj \
+ $(SLO)$/vcldata.obj
+
+EXCEPTIONSFILES=\
+ $(SLO)$/strmadpt.obj \
+ $(SLO)$/iniman.obj
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+UNOUCROUT=$(OUT)$/inc
+UNOTYPES=\
+ com.sun.star.io.XInputStream \
+ com.sun.star.io.XOutputStream \
+ com.sun.star.io.XSeekable \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XWeak \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.registry.MergeConflictException \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.frame.XConfigManager
+
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/misc/urihelper.cxx b/svtools/source/misc/urihelper.cxx
new file mode 100644
index 000000000000..ff4eb4a075ea
--- /dev/null
+++ b/svtools/source/misc/urihelper.cxx
@@ -0,0 +1,683 @@
+/*************************************************************************
+ *
+ * $RCSfile: urihelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_URIHELPER_HXX
+#include <urihelper.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_FILESYSTEMNOTATION_HPP_
+#include <com/sun/star/ucb/FileSystemNotation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef TOOLS_INETMIME_HXX
+#include <tools/inetmime.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#include <ucbhelper/contentbroker.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+
+namespace unnamed_svtools_urihelper {}
+using namespace unnamed_svtools_urihelper;
+ // unnamed namespaces don't work well yet...
+
+using namespace com::sun;
+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);
+
+ bool bWasAbsolute;
+ INetURLObject
+ aAbsURIRef(rTheBaseURIRef.smartRel2Abs(rTheRelURIRef, bWasAbsolute,
+ bIgnoreFragment,
+ eEncodeMechanism, eCharset,
+ bRelativeNonURIs, eStyle));
+ if (bCheckFileExists && !bWasAbsolute
+ && aAbsURIRef.GetProtocol() == INET_PROT_FILE)
+ {
+ 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)
+ {
+ sal_Bool bExists = false;
+ try
+ {
+ ::ucb::Content(
+ aAbsURIRef.
+ GetMainURL(INetURLObject::NO_DECODE),
+ uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >
+ ()).
+ getPropertyValue(rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Exists")))
+ >>= bExists;
+ }
+ catch (::ucb::ContentCreationException const &)
+ {
+ DBG_ERROR("URIHelper::SmartRel2Abs(): UCB Exception");
+ }
+ catch (uno::Exception const &)
+ {
+ DBG_ERROR("URIHelper::SmartRel2Abs(): UCB Exception");
+ }
+ if (!bExists)
+ 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 unnamed_svtools_urihelper {
+
+static Link aMaybeFileHdl;
+
+}
+
+void URIHelper::SetMaybeFileHdl(Link const & rTheMaybeFileHdl)
+{
+ aMaybeFileHdl = rTheMaybeFileHdl;
+}
+
+//============================================================================
+//
+// GetMaybeFileHdl
+//
+//============================================================================
+
+Link URIHelper::GetMaybeFileHdl()
+{
+ return aMaybeFileHdl;
+}
+
+//============================================================================
+//
+// FindFirstURLInText
+//
+//============================================================================
+
+namespace unnamed_svtools_urihelper {
+
+inline xub_StrLen prevChar(UniString const & rStr, xub_StrLen nPos)
+{
+ return INetMIME::isLowSurrogate(rStr.GetChar(nPos - 1))
+ && nPos >= 2
+ && INetMIME::isHighSurrogate(rStr.GetChar(nPos - 2)) ?
+ nPos - 2 : nPos - 1;
+}
+
+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;
+}
+
+inline bool isWLetter(CharClass const & rCharClass,
+ UniString const & rStr, xub_StrLen nPos)
+{
+ if (rCharClass.isAlphaNumeric(rStr, nPos))
+ return true;
+ sal_Unicode c = rStr.GetChar(nPos);
+ return c == '$' || c == '%' || c == '&' || c == '-' || c == '/'
+ || c == '@' || c == '\\';
+}
+
+inline 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, 1, 1, 1, 1, // !"#$%&'
+ 1, 1, 1, 1, 1, 1, 1, 1, // ()*+,-./
+ 4, 4, 4, 4, 4, 4, 4, 4, // 01234567
+ 4, 4, 1, 1, 0, 1, 0, 1, // 89:;<=>?
+ 1, 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: // letter, ...
+ *pEnd = ++(*pPos);
+ return true;
+ }
+ }
+ else if (rCharClass.isAlphaNumeric(rStr, *pPos))
+ {
+ *pEnd = *pPos = nextChar(rStr, *pPos);
+ return true;
+ }
+ else
+ return false;
+}
+
+inline 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 = p - pBuffer;
+ return nLabels;
+}
+
+inline bool
+scanIPv6reference(UniString const & rStr, xub_StrLen * pPos, xub_StrLen nEnd)
+{
+ sal_Unicode const * pBuffer = rStr.GetBuffer();
+ sal_Unicode const * p = pBuffer + *pPos;
+ bool bSuccess
+ = INetURLObject::scanIPv6reference(p, pBuffer + nEnd, false);
+ *pPos = p - pBuffer;
+ return bSuccess;
+}
+
+}
+
+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 (longest possible) substring of [pBegin..pEnd[
+ // that matches any of the following productions (for which the
+ // appropriate style bit is set in eStyle, if applicable). "\W" stands
+ // for a word break, i.e., the begin or end of the block of text, or a
+ // character that is neither a letter nor a digit (according to
+ // rCharClass). The productions use the auxiliary rules
+ //
+ // domain = label *("." label)
+ // label = alphanum [*(alphanum / "-") alphanum]
+ // alphanum = ALPHA / DIGIT
+ // IPv6reference = "[" IPv6address "]"
+ // IPv6address = hexpart [":" IPv4address]
+ // IPv4address = 1*3DIGIT 3("." 1*3DIGIT)
+ // hexpart = (hexseq ["::" [hexseq]]) / ("::" [hexseq])
+ // hexseq = hex4 *(":" hex4)
+ // hex4 = 1*4HEXDIG
+ // wchar = <any uric character (ignoring the escaped rule), or "%", or
+ // a letter or digit (according to rCharClass)>
+ //
+ // 1st Production (file):
+ // \W "file:" 1*(wchar / "\" / "|") ["#" 1*wchar] \W
+ //
+ // 2nd Production (known scheme):
+ // \W <one of the known schemes, ignoring case> ":" 1*wchar
+ // ["#" 1*wchar] \W
+ //
+ // 3rd Production (mailto):
+ // \W domain "@" domain \W
+ //
+ // 4th Production (ftp):
+ // \W "ftp" 2*("." label) ["/" *wchar] ["#" 1*wchar] \W
+ //
+ // 5th Production (http):
+ // \W label 2*("." label) ["/" *wchar] ["#" 1*wchar] \W
+ //
+ // 6th Production (file):
+ // \W "//" (domain / IPv6reference) ["/" *wchar] ["#" 1*wchar] \W
+ //
+ // 7th Production (Unix file; FSYS_UNX only):
+ // \W "/" 1*wchar \W
+ //
+ // 8th Production (UNC file; FSYS_DOS only):
+ // \W "\\" domain ["\" *(wchar / "\")] \W
+ //
+ // 9th Production (Unix-like DOS file; FSYS_DOS only):
+ // \W ALPHA ":/" *wchar \W
+ //
+ // 10th Production (DOS file; FSYS_DOS only):
+ // \W ALPHA ":\" *(wchar / "\") \W
+
+ for (xub_StrLen nPos = rBegin; nPos != rEnd;)
+ {
+ sal_Unicode c = rText.GetChar(nPos);
+ if ((INetMIME::isAlpha(c) || c == '/' || c == '\\')
+ && (nPos == rBegin
+ || !isWLetter(rCharClass, rText, prevChar(rText, nPos))))
+ {
+ xub_StrLen nURIEnd = STRING_NOTFOUND;
+
+ if (INetMIME::isAlpha(c))
+ {
+ xub_StrLen i = nPos;
+ INetProtocol eScheme
+ = INetURLObject::CompareProtocolScheme(UniString(rText, i,
+ rEnd));
+ if (eScheme != INET_PROT_NOT_VALID) // 1st, 2nd
+ {
+ while (rText.GetChar(i++) != ':');
+ xub_StrLen nPrefixEnd = i;
+ if (eScheme == INET_PROT_FILE)
+ while (i != rEnd
+ && checkWChar(rCharClass, rText, &i, &nURIEnd,
+ true, true));
+ else
+ while (i != rEnd
+ && checkWChar(rCharClass, rText, &i,
+ &nURIEnd));
+ if (i != nPrefixEnd && rText.GetChar(i) == '#')
+ {
+ ++i;
+ while (i != rEnd
+ && checkWChar(rCharClass, rText, &i,
+ &nURIEnd));
+ }
+ }
+ else if (eStyle & INetURLObject::FSYS_DOS
+ && rEnd - i >= 3
+ && rText.GetChar(i + 1) == ':'
+ && rText.GetChar(i + 2) == '/') // 9th
+ {
+ i += 3;
+ nURIEnd = i;
+ while (i != rEnd
+ && checkWChar(rCharClass, rText, &i, &nURIEnd));
+ }
+ else if (eStyle & INetURLObject::FSYS_DOS
+ && rEnd - i >= 3
+ && rText.GetChar(i + 1) == ':'
+ && rText.GetChar(i + 2) == '\\') // 10th
+ {
+ i += 3;
+ nURIEnd = i;
+ while (i != rEnd
+ && checkWChar(rCharClass, rText, &i, &nURIEnd,
+ true));
+ }
+ else
+ {
+ sal_uInt32 nLabels = scanDomain(rText, &i, rEnd);
+ if (nLabels > 0 && i != rEnd && rText.GetChar(i) == '@')
+ // 3rd
+ {
+ ++i;
+ if (scanDomain(rText, &i, rEnd) > 0)
+ nURIEnd = i;
+ }
+ else if (nLabels >= 3) // 4th, 5th
+ {
+ 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));
+ }
+ }
+ }
+ }
+ else if (c == '/')
+ {
+ xub_StrLen i = nPos;
+ if (rEnd - i >= 2)
+ if (rText.GetChar(i + 1) == '/') // 6th
+ {
+ i += 2;
+ if (scanDomain(rText, &i, rEnd) > 0
+ || scanIPv6reference(rText, &i, rEnd))
+ {
+ 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));
+ }
+ }
+ }
+ else if (eStyle & INetURLObject::FSYS_UNX) // 7th
+ {
+ ++i;
+ while (i != rEnd
+ && checkWChar(rCharClass, rText, &i,
+ &nURIEnd));
+ }
+ }
+ else if (eStyle & INetURLObject::FSYS_DOS && c == '\\') // 8th
+ {
+ xub_StrLen i = nPos;
+ if (rEnd - i >= 2 && rText.GetChar(i + 1) == '\\')
+ {
+ i += 2;
+ if (scanDomain(rText, &i, rEnd) > 0)
+ {
+ nURIEnd = i;
+ if (i != rEnd && rText.GetChar(i) == '\\')
+ {
+ nURIEnd = ++i;
+ while (i != rEnd
+ && checkWChar(rCharClass, rText, &i,
+ &nURIEnd, true));
+ }
+ }
+ }
+ }
+
+ if (nURIEnd != STRING_NOTFOUND
+ && (nURIEnd == rEnd
+ || !isWLetter(rCharClass, rText, nURIEnd)))
+ {
+ INetURLObject aURI(UniString(rText, nPos, nURIEnd - nPos),
+ INET_PROT_HTTP, eMechanism, eCharset,
+ eStyle);
+ if (!aURI.HasError())
+ {
+ rBegin = nPos;
+ rEnd = nURIEnd;
+ return aURI.GetMainURL();
+ }
+ }
+
+ ++nPos;
+ while (nPos != rEnd && isWLetter(rCharClass, rText, nPos))
+ nPos = nextChar(rText, nPos);
+ }
+ else
+ nPos = nextChar(rText, nPos);
+ }
+
+ 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 :
+ aObj.GetURLNoPass(eDecodeMechanism, eCharset);
+}
+
+//============================================================================
+//
+// queryFSysStyle
+//
+//============================================================================
+
+INetURLObject::FSysStyle URIHelper::queryFSysStyle(UniString const & rFileUrl,
+ bool bAddConvenienceStyles)
+ throw (uno::RuntimeException)
+{
+ ::ucb::ContentBroker const * pBroker = ::ucb::ContentBroker::get();
+ uno::Reference< star::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 = star::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 < star::ucb::FileSystemNotation::UNKNOWN_NOTATION
+ || nNotation > star::ucb::FileSystemNotation::MAC_NOTATION ?
+ 0 :
+ nNotation
+ - star::ucb::FileSystemNotation::UNKNOWN_NOTATION]
+ [bAddConvenienceStyles];
+}
diff --git a/svtools/source/misc/vcldata.cxx b/svtools/source/misc/vcldata.cxx
new file mode 100644
index 000000000000..799e64855300
--- /dev/null
+++ b/svtools/source/misc/vcldata.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * $RCSfile: vcldata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <vcl/settings.hxx>
+#endif
+
+#ifndef _SVTOOLS_SVTDATA_HXX
+#include <svtdata.hxx>
+#endif
+
+//============================================================================
+//
+// class ImpSvtData
+//
+//============================================================================
+
+ResMgr * ImpSvtData::GetResMgr()
+{
+ return GetResMgr(Application::GetSettings().GetInternational().
+ GetLanguage());
+}
+
diff --git a/svtools/source/notify/brdcst.cxx b/svtools/source/notify/brdcst.cxx
new file mode 100644
index 000000000000..b0f2fbc7e8a3
--- /dev/null
+++ b/svtools/source/notify/brdcst.cxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * $RCSfile: brdcst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#include "hint.hxx"
+#include "smplhint.hxx"
+#include "lstner.hxx"
+
+SV_DECL_PTRARR( SfxListenerArr_Impl, SfxListener*, 0, 2 );
+
+#define _SFX_BRDCST_CXX
+#include "brdcst.hxx"
+
+#include <segmentc.hxx>
+
+SEG_EOFGLOBALS()
+
+//====================================================================
+DBG_NAME(SfxBroadcaster);
+TYPEINIT0(SfxBroadcaster);
+
+//====================================================================
+
+//====================================================================
+// broadcast immedeately
+
+#pragma SEG_FUNCDEF(brdcst_01)
+
+void SfxBroadcaster::Broadcast( const SfxHint &rHint )
+{
+ DBG_CHKTHIS(SfxBroadcaster, 0);
+
+ // is anybody to notify?
+ if ( aListeners.Count() /*! || aGlobListeners.Count() */ )
+ {
+ // determine the type only once, because of its expensiveness
+ const TypeId& rBCType = Type();
+ const TypeId& rHintType = rHint.Type();
+
+ // notify all registered listeners exactly once
+ for ( USHORT n = 0; n < aListeners.Count(); ++n )
+ {
+ SfxListener* pListener = aListeners[n];
+ if ( pListener )
+ pListener->SFX_NOTIFY( *this, rBCType, rHint, rHintType );
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+
+// broadcast after a timeout
+
+#pragma SEG_FUNCDEF(brdcst_02)
+
+void SfxBroadcaster::BroadcastDelayed( const SfxHint& rHint )
+{
+ DBG_WARNING( "not implemented" );
+ Broadcast(rHint);
+}
+//--------------------------------------------------------------------
+
+// broadcast in idle-handler
+
+#pragma SEG_FUNCDEF(brdcst_03)
+
+void SfxBroadcaster::BroadcastInIdle( const SfxHint& rHint )
+{
+ DBG_WARNING( "not implemented" );
+ Broadcast(rHint);
+}
+//--------------------------------------------------------------------
+
+// unregister all listeners
+
+#pragma SEG_FUNCDEF(brdcst_04)
+
+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
+
+#pragma SEG_FUNCDEF(brdcst_05)
+
+SfxBroadcaster::SfxBroadcaster()
+{
+ DBG_CTOR(SfxBroadcaster, 0);
+}
+
+//--------------------------------------------------------------------
+
+// copy ctor of class SfxBroadcaster
+
+#pragma SEG_FUNCDEF(brdcst_06)
+
+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
+
+#pragma SEG_FUNCDEF(brdcst_07)
+#if SUPD>=501
+BOOL
+#else
+void
+#endif
+ 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" );
+#if SUPD>=501
+ return FALSE;
+#endif
+ }
+
+ DBG_ASSERT( USHRT_MAX != aListeners.GetPos(pListener),
+ "AddListener failed" );
+#if SUPD>=501
+ return TRUE;
+#endif
+}
+
+//--------------------------------------------------------------------
+
+// called, if no more listeners exists
+
+#pragma SEG_FUNCDEF(brdcst_08)
+
+void SfxBroadcaster::ListenersGone()
+{
+ DBG_CHKTHIS(SfxBroadcaster,0);
+}
+
+//--------------------------------------------------------------------
+
+// forward a notification to all registered listeners
+
+#pragma SEG_FUNCDEF(brdcst_09)
+
+void SfxBroadcaster::SFX_FORWARD(SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType)
+{
+ const USHORT nCount = aListeners.Count();
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ SfxListener *pListener = aListeners[i];
+ if ( pListener )
+ pListener->SFX_NOTIFY( rBC, rBCType, rHint, rHintType);
+ }
+}
+
+//--------------------------------------------------------------------
+
+// remove one SfxListener from the list
+
+#pragma SEG_FUNCDEF(brdcst_0a)
+
+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();
+}
+
+//--------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(brdcst_0b)
+
+BOOL SfxBroadcaster::HasListeners() const
+{
+ for ( USHORT n = 0; n < aListeners.Count(); ++n )
+ if ( aListeners.GetObject(n) != 0 )
+ return TRUE;
+ return FALSE;
+}
+
+//--------------------------------------------------------------------
+
+#pragma SEG_EOFMODULE
+
diff --git a/svtools/source/notify/cancel.cxx b/svtools/source/notify/cancel.cxx
new file mode 100644
index 000000000000..2e17226fac34
--- /dev/null
+++ b/svtools/source/notify/cancel.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * $RCSfile: cancel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#define _SFX_CANCEL_CXX
+#include <tools/debug.hxx>
+#include "cancel.hxx"
+#include "smplhint.hxx"
+#include "cnclhint.hxx"
+
+#ifndef _SV_SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+
+//=========================================================================
+
+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.
+*/
+
+{
+ return _aJobs.Count() > 0 || ( _pParent && _pParent->CanCancel() );
+}
+
+//-------------------------------------------------------------------------
+
+void SfxCancelManager::Cancel( BOOL bDeep )
+
+/* [Beschreibung]
+
+ Diese Methode markiert alle angemeldeten <SfxCancellable>-Instanzen
+ als suspendiert.
+*/
+
+{
+ 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::SFX_INSERT_CANCELLABLE( 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
+
+ _aJobs.C40_INSERT( SfxCancellable, pJob, _aJobs.Count() );
+ Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) );
+}
+
+//-------------------------------------------------------------------------
+
+
+void SfxCancelManager::SFX_REMOVE_CANCELLABLE( 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.
+*/
+
+{
+ const SfxCancellable *pTmp = pJob;
+ _aJobs.Remove( _aJobs.GetPos( pTmp ), 1 );
+ Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) );
+ Broadcast( SfxCancelHint( pJob, SFXCANCELHINT_REMOVED ) );
+}
+
+//-------------------------------------------------------------------------
+
+SfxCancellable::~SfxCancellable()
+{
+ if ( _pMgr )
+ _pMgr->SFX_REMOVE_CANCELLABLE( 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
+ {
+ Sound::Beep();
+ delete this;
+ }
+#else
+ _bCancelled = TRUE;
+#endif
+}
+
+//-------------------------------------------------------------------------
+
+void SfxCancellable::SetManager( SfxCancelManager *pMgr )
+{
+ if ( _pMgr )
+ _pMgr->SFX_REMOVE_CANCELLABLE( this );
+ _pMgr = pMgr;
+ if ( _pMgr )
+ _pMgr->SFX_INSERT_CANCELLABLE( 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
new file mode 100644
index 000000000000..465e5a74c219
--- /dev/null
+++ b/svtools/source/notify/hint.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: hint.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "hint.hxx"
+#include "segmentc.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
new file mode 100644
index 000000000000..a4919b39840e
--- /dev/null
+++ b/svtools/source/notify/isethint.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: isethint.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "isethint.hxx"
+#include "itemset.hxx"
+#include <segmentc.hxx>
+
+//====================================================================
+
+SEG_EOFGLOBALS()
+
+TYPEINIT1(SfxItemSetHint, SfxHint);
+
+//====================================================================
+
+#pragma SEG_FUNCDEF(isethint_01)
+
+SfxItemSetHint::SfxItemSetHint( SfxItemSet *pItemSet )
+
+/* [Beschreibung]
+
+ Dieser Ctor "ubernimmt das als Parameter "ubergeben <SfxItemSet>,
+ das im Dtor gel"oscht wird.
+*/
+
+: _pItemSet( pItemSet )
+{
+}
+
+//--------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(isethint_02)
+
+SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet )
+
+/* [Beschreibung]
+
+ Dieser Ctor kopiert das als Parameter "ubergeben <SfxItemSet>.
+*/
+
+: _pItemSet( rItemSet.Clone() )
+{
+}
+
+//--------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(isethint_03)
+
+SfxItemSetHint::~SfxItemSetHint()
+{
+ delete _pItemSet;
+}
+
+//--------------------------------------------------------------------
+
+#pragma SEG_EOFMODULE
+
diff --git a/svtools/source/notify/lstner.cxx b/svtools/source/notify/lstner.cxx
new file mode 100644
index 000000000000..cad153962046
--- /dev/null
+++ b/svtools/source/notify/lstner.cxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * $RCSfile: lstner.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#include "hint.hxx"
+#include "brdcst.hxx"
+
+SV_DECL_PTRARR( SfxBroadcasterArr_Impl, SfxBroadcaster*, 0, 2 );
+
+#define _SFX_LSTNER_CXX
+#include "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 SUPD>=501
+ if ( rBroadcaster.AddListener(*this) )
+#else
+ rBroadcaster.AddListener(*this);
+#endif
+ {
+ 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
+
+void SfxListener::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType )
+{
+ const SfxBroadcaster *pBC = &rBC;
+ DBG_ASSERT( USHRT_MAX != aBCs.GetPos(pBC),
+ "notification from unregistered broadcaster" );
+}
+
diff --git a/svtools/source/notify/makefile.mk b/svtools/source/notify/makefile.mk
new file mode 100644
index 000000000000..8bdce9c2e41d
--- /dev/null
+++ b/svtools/source/notify/makefile.mk
@@ -0,0 +1,123 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=notify
+TARGETSTAT=_notify
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+CXXFILES = \
+ smplhint.cxx \
+ hint.cxx \
+ lstner.cxx \
+ isethint.cxx \
+ cancel.cxx \
+ brdcst.cxx
+
+SLOFILES = \
+ $(SLO)$/smplhint.obj \
+ $(SLO)$/hint.obj \
+ $(SLO)$/lstner.obj \
+ $(SLO)$/isethint.obj \
+ $(SLO)$/cancel.obj \
+ $(SLO)$/brdcst.obj
+
+OBJFILES = \
+ $(OBJ)$/smplhint.obj \
+ $(OBJ)$/hint.obj \
+ $(OBJ)$/lstner.obj \
+ $(OBJ)$/isethint.obj \
+ $(OBJ)$/cancel.obj \
+ $(OBJ)$/brdcst.obj
+
+.ENDIF
+
+HXX1TARGET= notify
+HXX1EXT= hxx
+HXX1FILES= $(INC)$/hint.hxx \
+ $(INC)$/smplhint.hxx \
+ $(INC)$/lstner.hxx \
+ $(INC)$/brdcst.hxx
+HXX1EXCL= -E:*include*
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= $(SLOFILES)
+
+LIB2TARGET= $(LB)$/$(TARGETSTAT).lib
+LIB2OBJFILES= $(OBJFILES)
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/source/notify/smplhint.cxx b/svtools/source/notify/smplhint.cxx
new file mode 100644
index 000000000000..3aa796962361
--- /dev/null
+++ b/svtools/source/notify/smplhint.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: smplhint.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "smplhint.hxx"
+#include "segmentc.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
new file mode 100644
index 000000000000..c7cd1dcd823c
--- /dev/null
+++ b/svtools/source/numbers/makefile.mk
@@ -0,0 +1,122 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=svtools
+TARGET=numbers
+
+PROJECTPCH=
+PROJECTPCHSOURCE=
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+# Every source directory generates headers in a own output directory to
+# enable parallel building of the source directories within a project!
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+UNOTYPES = com.sun.star.util.XNumberFormatsSupplier \
+ com.sun.star.util.XNumberFormatter \
+ com.sun.star.util.XNumberFormatPreviewer \
+ com.sun.star.util.XNumberFormatTypes \
+ com.sun.star.util.Date \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XUnoTunnel \
+ com.sun.star.beans.XPropertyAccess \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XWeak \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.lang.XInitialization \
+ com.sun.star.lang.Locale \
+ com.sun.star.io.XPersistObject \
+
+SLOFILES = \
+ $(SLO)$/zforfind.obj \
+ $(SLO)$/zforlist.obj \
+ $(SLO)$/zformat.obj \
+ $(SLO)$/zforscan.obj \
+ $(SLO)$/numhead.obj \
+ $(SLO)$/numuno.obj \
+ $(SLO)$/numfmuno.obj \
+ $(SLO)$/supservs.obj
+
+EXCEPTIONSFILES= \
+ $(SLO)$/numuno.obj \
+ $(SLO)$/numfmuno.obj \
+ $(SLO)$/supservs.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/source/numbers/nbdll.cxx b/svtools/source/numbers/nbdll.cxx
new file mode 100644
index 000000000000..31456c0d7d87
--- /dev/null
+++ b/svtools/source/numbers/nbdll.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: nbdll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef WIN
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#endif
+
+#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
new file mode 100644
index 000000000000..5dfa0a42835e
--- /dev/null
+++ b/svtools/source/numbers/numfmuno.cxx
@@ -0,0 +1,1137 @@
+/*************************************************************************
+ *
+ * $RCSfile: numfmuno.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <vcl/svapp.hxx>
+#include <vcl/color.hxx>
+#include <tools/debug.hxx>
+#include <tools/isolang.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 "zforlist.hxx"
+#include "zformat.hxx"
+#include "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_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 SfxItemPropertyMap* lcl_GetNumberFormatPropertyMap()
+{
+ static SfxItemPropertyMap aNumberFormatPropertyMap_Impl[] =
+ {
+ {MAP_CHAR_LEN(PROPERTYNAME_FMTSTR), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_LOCALE), 0, &getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_TYPE), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_COMMENT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_CURREXT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_CURRSYM), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_DECIMALS), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_LEADING), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_NEGRED), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_STDFORM), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_THOUS), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {MAP_CHAR_LEN(PROPERTYNAME_USERDEF), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY},
+ {0,0,0,0}
+ };
+ return aNumberFormatPropertyMap_Impl;
+}
+
+const SfxItemPropertyMap* lcl_GetNumberSettingsPropertyMap()
+{
+ static SfxItemPropertyMap aNumberSettingsPropertyMap_Impl[] =
+ {
+ {MAP_CHAR_LEN(PROPERTYNAME_NOZERO), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND},
+ {MAP_CHAR_LEN(PROPERTYNAME_NULLDATE), 0, &getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND},
+ {MAP_CHAR_LEN(PROPERTYNAME_STDDEC), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND},
+ {MAP_CHAR_LEN(PROPERTYNAME_TWODIGIT), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND},
+ {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;
+
+ String aLangStr = rLocale.Language;
+ String aCtryStr = rLocale.Country;
+ // Variant is ignored
+
+ LanguageType eRet = ConvertIsoNamesToLanguage( aLangStr, aCtryStr );
+ if ( eRet == LANGUAGE_NONE )
+ eRet = LANGUAGE_SYSTEM; //! or throw an exception?
+
+ return eRet;
+}
+
+void lcl_FillLocale( lang::Locale& rLocale, LanguageType eLang )
+{
+ String aLangStr, aCtryStr;
+ ConvertLanguageToIsoNames( eLang, aLangStr, aCtryStr );
+ rLocale.Language = aLangStr;
+ rLocale.Country = aCtryStr;
+}
+
+//----------------------------------------------------------------------------------------
+
+SvNumberFormatterServiceObj::SvNumberFormatterServiceObj() :
+ pSupplier(NULL)
+{
+}
+
+SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj()
+{
+ if (pSupplier)
+ pSupplier->release();
+}
+
+uno::Reference<uno::XInterface> SAL_CALL SvNumberFormatterServiceObj_NewInstance(
+ const uno::Reference<lang::XMultiServiceFactory>& rSMgr )
+{
+ return (cppu::OWeakObject*) new SvNumberFormatterServiceObj();
+}
+
+// XNumberFormatter
+
+void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier(
+ const uno::Reference<util::XNumberFormatsSupplier>& xSupplier )
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
+ if (!pNew)
+ throw uno::RuntimeException(); // wrong object
+
+ if (pNew)
+ pNew->acquire();
+ if (pSupplier)
+ pSupplier->release();
+ pSupplier = pNew;
+}
+
+uno::Reference<util::XNumberFormatsSupplier> SAL_CALL
+ SvNumberFormatterServiceObj::getNumberFormatsSupplier()
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+ return pSupplier;
+}
+
+sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat(
+ sal_Int32 nKey, const rtl::OUString& aString )
+ throw(util::NotNumericException, uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ if (pFormatter)
+ {
+ String aTemp = aString;
+ ULONG 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ double fRet = 0.0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ if (pFormatter)
+ {
+ String aTemp = aString;
+ ULONG 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ String aRet;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ util::color nRet = aDefaultColor; // color = INT32
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ String aRet;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ util::color nRet = aDefaultColor; // color = INT32
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ String aRet;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ String aRet;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ util::color nRet = aDefaultColor; // color = INT32
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->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("SvNumberFormatterServiceObj");
+}
+
+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* pParent) :
+ pSupplier(pParent)
+{
+ if (pSupplier)
+ pSupplier->acquire();
+}
+
+SvNumberFormatsObj::~SvNumberFormatsObj()
+{
+ if (pSupplier)
+ pSupplier->release();
+}
+
+// XNumberFormats
+
+uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsObj::getByKey( sal_Int32 nKey )
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
+ if (pFormat)
+ return new SvNumberFormatObj( pSupplier, nKey );
+ else
+ throw uno::RuntimeException();
+
+ return NULL;
+}
+
+uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType,
+ const lang::Locale& nLocale, sal_Bool bCreate )
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ if ( pFormatter )
+ {
+ ULONG nIndex = 0;
+ LanguageType eLang = lcl_GetLanguage( nLocale );
+ SvNumberFormatTable& rTable = bCreate ?
+ pFormatter->ChangeCL( nType, nIndex, eLang ) :
+ pFormatter->GetEntryTable( nType, nIndex, eLang );
+ ULONG nCount = rTable.Count();
+ uno::Sequence<sal_Int32> aSeq(nCount);
+ sal_Int32* pAry = aSeq.getArray();
+ for (ULONG i=0; i<nCount; i++)
+ pAry[i] = rTable.GetObjectKey( i );
+
+ return aSeq;
+ }
+ else
+ throw uno::RuntimeException();
+
+ return uno::Sequence<sal_Int32>(0);
+}
+
+sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const rtl::OUString& aFormat,
+ const lang::Locale& nLocale, sal_Bool bScan )
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ if (pFormatter)
+ {
+ String aFormStr = aFormat;
+ LanguageType eLang = lcl_GetLanguage( nLocale );
+ ULONG 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ if (pFormatter)
+ {
+ String aFormStr = aFormat;
+ LanguageType eLang = lcl_GetLanguage( nLocale );
+ LanguageType eNewLang = lcl_GetLanguage( nNewLocale );
+ ULONG nKey = 0;
+ xub_StrLen nCheckPos = 0;
+ short nType = 0;
+ BOOL bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang );
+ 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;
+}
+
+void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey ) throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+
+ if (pFormatter)
+ {
+ pFormatter->DeleteEntry(nKey);
+ pSupplier->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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ String aRet;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ BOOL bRet = FALSE;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ INT32 nRet = 0;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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* pParent, ULONG nK) :
+ pSupplier(pParent),
+ nKey(nK)
+{
+ if (pSupplier)
+ pSupplier->acquire();
+}
+
+SvNumberFormatObj::~SvNumberFormatObj()
+{
+ if (pSupplier)
+ pSupplier->release();
+}
+
+// XPropertySet
+
+uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatObj::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+ static uno::Reference<beans::XPropertySetInfo> aRef =
+ new SfxItemPropertySetInfo( lcl_GetNumberFormatPropertyMap() );
+ return aRef;
+}
+
+void SAL_CALL SvNumberFormatObj::setPropertyValue( const rtl::OUString& aPropertyName,
+ const uno::Any& aValue )
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ uno::Any aRet;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
+ if (pFormat)
+ {
+ String aSymbol, aExt;
+ pFormat->GetNewCurrencySymbol( aSymbol, aExt );
+ String aFmtStr = pFormat->GetFormatstring();
+ String aComment = ((SvNumberformat*)pFormat)->GetComment();
+ //! warum ist GetComment nicht const ???
+ 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;
+ ((SvNumberformat*)pFormat)->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
+ //! warum ist GetFormatSpecialInfo nicht const ???
+
+ String aString = aPropertyName;
+ if (aString.EqualsAscii( PROPERTYNAME_FMTSTR )) aRet <<= rtl::OUString( aFmtStr );
+ else if (aString.EqualsAscii( PROPERTYNAME_LOCALE ))
+ {
+ lang::Locale aLocale;
+ lcl_FillLocale( aLocale, pFormat->GetLanguage() );
+ aRet <<= aLocale;
+ }
+ else if (aString.EqualsAscii( PROPERTYNAME_TYPE )) aRet <<= (sal_Int16)( pFormat->GetType() );
+ else if (aString.EqualsAscii( PROPERTYNAME_COMMENT )) aRet <<= rtl::OUString( aComment );
+ else if (aString.EqualsAscii( PROPERTYNAME_STDFORM )) aRet.setValue( &bStandard, getBooleanCppuType() );
+ else if (aString.EqualsAscii( PROPERTYNAME_USERDEF )) aRet.setValue( &bUserDef, getBooleanCppuType() );
+ else if (aString.EqualsAscii( PROPERTYNAME_DECIMALS )) aRet <<= (sal_Int16)( nDecimals );
+ else if (aString.EqualsAscii( PROPERTYNAME_LEADING )) aRet <<= (sal_Int16)( nLeading );
+ else if (aString.EqualsAscii( PROPERTYNAME_NEGRED )) aRet.setValue( &bRed, getBooleanCppuType() );
+ else if (aString.EqualsAscii( PROPERTYNAME_THOUS )) aRet.setValue( &bThousand, getBooleanCppuType() );
+ else if (aString.EqualsAscii( PROPERTYNAME_CURRSYM )) aRet <<= rtl::OUString( aSymbol );
+ else if (aString.EqualsAscii( PROPERTYNAME_CURREXT )) aRet <<= rtl::OUString( aExt );
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
+ if (pFormat)
+ {
+ String aSymbol, aExt;
+ pFormat->GetNewCurrencySymbol( aSymbol, aExt );
+ String aFmtStr = pFormat->GetFormatstring();
+ String aComment = ((SvNumberformat*)pFormat)->GetComment();
+ //! warum ist GetComment nicht const ???
+ 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;
+ ((SvNumberformat*)pFormat)->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
+ //! warum ist GetFormatSpecialInfo nicht const ???
+ lang::Locale aLocale;
+ lcl_FillLocale( aLocale, pFormat->GetLanguage() );
+
+ uno::Sequence<beans::PropertyValue> aSeq(12);
+ 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 );
+
+ return aSeq;
+ }
+ else
+ throw uno::RuntimeException();
+
+ return uno::Sequence<beans::PropertyValue>(0);
+}
+
+void SAL_CALL SvNumberFormatObj::setPropertyValues( const uno::Sequence<beans::PropertyValue>& aProps )
+ 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* pParent) :
+ pSupplier(pParent)
+{
+ if (pSupplier)
+ pSupplier->acquire();
+}
+
+SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj()
+{
+ if (pSupplier)
+ pSupplier->release();
+}
+
+// XPropertySet
+
+uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatSettingsObj::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+ 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)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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;
+ if ( aValue >>= nInt16 )
+ pFormatter->ChangeStandardPrec( nInt16 );
+ }
+ else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT ))
+ {
+ sal_Int16 nInt16;
+ if ( aValue >>= nInt16 )
+ pFormatter->SetYear2000( nInt16 );
+ }
+ else
+ throw beans::UnknownPropertyException();
+
+ pSupplier->SettingsChanged();
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const rtl::OUString& aPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ uno::Any aRet;
+ SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL;
+ 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
new file mode 100644
index 000000000000..6c593bb10b1c
--- /dev/null
+++ b/svtools/source/numbers/numfmuno.hxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * $RCSfile: numfmuno.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _NUMFMUNO_HXX
+#define _NUMFMUNO_HXX
+
+#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTER_HPP_
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATPREVIEWER_HPP_
+#include <com/sun/star/util/XNumberFormatPreviewer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATS_HPP_
+#include <com/sun/star/util/XNumberFormats.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATTYPES_HPP_
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase3.hxx>
+#endif
+
+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:
+ SvNumberFormatsSupplierObj* pSupplier;
+
+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* pSupplier;
+
+public:
+ SvNumberFormatsObj();
+ SvNumberFormatsObj(SvNumberFormatsSupplierObj* pParent);
+ 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);
+};
+
+
+class SvNumberFormatObj : public cppu::WeakImplHelper3<
+ com::sun::star::beans::XPropertySet,
+ com::sun::star::beans::XPropertyAccess,
+ com::sun::star::lang::XServiceInfo>
+{
+private:
+ SvNumberFormatsSupplierObj* pSupplier;
+ ULONG nKey;
+
+public:
+ SvNumberFormatObj(SvNumberFormatsSupplierObj* pParent, ULONG nK);
+ 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* pSupplier;
+
+public:
+ SvNumberFormatSettingsObj(SvNumberFormatsSupplierObj* pParent);
+ 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
new file mode 100644
index 000000000000..b9b5f5f2be00
--- /dev/null
+++ b/svtools/source/numbers/numhead.cxx
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *
+ * $RCSfile: numhead.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+
+#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(ULONG));
+ rStream << nDataSize; // Groesse am Anfang eintragen
+ rStream.Seek(nPos);
+ }
+}
+*/
+
+// =======================================================================
+
+//#pragma SEG_FUNCDEF(numhead_06)
+
+//! mit Skip() synchron
+ImpSvNumMultipleReadHeader::ImpSvNumMultipleReadHeader(SvStream& rNewStream) :
+ rStream( rNewStream )
+{
+ ULONG 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");
+ }
+ ULONG 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 )
+{
+ ULONG nDataSize;
+ rStream >> nDataSize;
+ rStream.SeekRel( nDataSize );
+ USHORT nID;
+ rStream >> nID;
+ if ( nID != SV_NUMID_SIZES )
+ {
+ DBG_ERROR("SV_NUMID_SIZES nicht gefunden");
+ }
+ ULONG 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();
+ ULONG 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 << 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(ULONG));
+ rStream << nDataSize; // Groesse am Anfang eintragen
+ rStream.Seek(nPos);
+ }
+}
+
+//#pragma SEG_FUNCDEF(numhead_0c)
+
+void ImpSvNumMultipleWriteHeader::EndEntry()
+{
+ ULONG nPos = rStream.Tell();
+ aMemStream << nPos - nEntryStart;
+}
+
+//#pragma SEG_FUNCDEF(numhead_0e)
+
+void ImpSvNumMultipleWriteHeader::StartEntry()
+{
+ ULONG nPos = rStream.Tell();
+ nEntryStart = nPos;
+}
+
+
+/*------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.9 2000/09/18 14:13:40 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.8 2000/08/31 13:41:32 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.7 1999/04/06 15:24:24 ER
+ #64244# add: static ImpSvNumMultipleReadHeader Skip
+
+
+ Rev 1.6 06 Apr 1999 17:24:24 ER
+ #64244# add: static ImpSvNumMultipleReadHeader Skip
+
+ Rev 1.5 17 Oct 1997 14:31:08 ER
+ new: Keyword NNN, ,- ; Datumformate System/DIN, #.##0,-- ; Comments
+
+ Rev 1.4 30 Jul 1997 12:54:20 ER
+ onSave: StoreSYSTEM, onLoad: ConvertSystem; Header aufgeraeumt
+
+ Rev 1.3 22 Feb 1996 11:36:26 STE
+ imp imp imp
+
+ Rev 1.2 26 Jul 1995 19:35:14 STE
+ International
+
+ Rev 1.1 05 Jul 1995 17:04:42 STE
+ die ersten beiden Klassen auskommentiert
+
+ Rev 1.0 05 Jul 1995 16:28:20 STE
+ Initial revision.
+
+
+------------------------------------------------------------------------*/
+
+
+
diff --git a/svtools/source/numbers/numhead.hxx b/svtools/source/numbers/numhead.hxx
new file mode 100644
index 000000000000..ddc649d48929
--- /dev/null
+++ b/svtools/source/numbers/numhead.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: numhead.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef NF_NUMHEAD_HXX
+#define NF_NUMHEAD_HXX
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+// -----------------------------------------------------------------------
+
+ // "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;
+ ULONG 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
new file mode 100644
index 000000000000..c1ad79fe6d3e
--- /dev/null
+++ b/svtools/source/numbers/numuno.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * $RCSfile: numuno.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#define _ZFORLIST_DECLARE_TABLE
+
+#include <vcl/svapp.hxx>
+#include <vcl/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 "zforlist.hxx"
+
+using namespace com::sun::star;
+
+//------------------------------------------------------------------------
+
+class SvNumFmtSuppl_Impl
+{
+public:
+ SvNumberFormatter* pFormatter;
+
+ 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;
+}
+
+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(ULONG nKey)
+{
+ // Basis-Implementierung tut nix...
+}
+
+void SvNumberFormatsSupplierObj::SettingsChanged()
+{
+ // Basis-Implementierung tut nix...
+}
+
+// XNumberFormatsSupplier
+
+uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings()
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ return new SvNumberFormatSettingsObj( this );
+}
+
+uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats()
+ throw(uno::RuntimeException)
+{
+ NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex());
+
+ return new SvNumberFormatsObj( this );
+}
+
+// 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_Int64)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 = (SvNumberFormatsSupplierObj*) xUT->getSomething( getUnoTunnelId() );
+ return pRet;
+}
+
+
+//------------------------------------------------------------------------
+
+
+
diff --git a/svtools/source/numbers/supservs.cxx b/svtools/source/numbers/supservs.cxx
new file mode 100644
index 000000000000..2d31a835bbb0
--- /dev/null
+++ b/svtools/source/numbers/supservs.cxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * $RCSfile: supservs.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
+#include "supservs.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef SVTOOLS_STRMADPT_HXX
+#include <strmadpt.hxx>
+#endif
+#ifndef SVTOOLS_INSTRM_HXX
+#include "instrm.hxx"
+#endif
+
+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;
+
+#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);
+}
+
+//-------------------------------------------------------------------------
+SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject()
+ :m_pOwnFormatter(NULL)
+{
+}
+
+//-------------------------------------------------------------------------
+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)
+{
+ OGuard aGuard(Application::GetSolarMutex());
+ // the mutex of the base class .... hope we have a real (i.e. own) mutex sometimes
+
+ 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 = ConvertIsoNamesToLanguage(aLocale.Language, aLocale.Country);
+ }
+#if DBG_UTIL
+ else
+ {
+ DBG_ERROR("SvNumberFormatsSupplierServiceObject::initialize : unknown argument !");
+ }
+#endif
+ }
+
+ m_pOwnFormatter = new SvNumberFormatter(eNewFormatterLanguage);
+ 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)
+{
+ OGuard aGuard(Application::GetSolarMutex());
+ 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)
+{
+ OGuard aGuard(Application::GetSolarMutex());
+ implEnsureFormatter();
+
+ Reference< XInputStream > xStream(_rxInStream.get());
+ SvInputStream aSvInputSteam(xStream);
+
+ m_pOwnFormatter->Load(aSvInputSteam);
+}
+
+//-------------------------------------------------------------------------
+Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormatSettings() throw(RuntimeException)
+{
+ OGuard aGuard(Application::GetSolarMutex());
+ implEnsureFormatter();
+ return SvNumberFormatsSupplierObj::getNumberFormatSettings();
+}
+
+//-------------------------------------------------------------------------
+Reference< XNumberFormats > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormats() throw(RuntimeException)
+{
+ OGuard aGuard(Application::GetSolarMutex());
+ implEnsureFormatter();
+ return SvNumberFormatsSupplierObj::getNumberFormats();
+}
+
+//-------------------------------------------------------------------------
+void SvNumberFormatsSupplierServiceObject::implEnsureFormatter()
+{
+ if (!m_pOwnFormatter)
+ {
+ DBG_ERROR("SvNumberFormatsSupplierServiceObject::implEnsureFormatter : forced to initialize with a default language !");
+ // you should use XMultiServiceFactory::createInstanceWithArguments (with an Locale as parameter)
+ m_pOwnFormatter = new SvNumberFormatter(LANGUAGE_ENGLISH_US);
+ SetNumberFormatter(m_pOwnFormatter);
+ }
+}
+
diff --git a/svtools/source/numbers/supservs.hxx b/svtools/source/numbers/supservs.hxx
new file mode 100644
index 000000000000..b47ce9b22f20
--- /dev/null
+++ b/svtools/source/numbers/supservs.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: supservs.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
+#define _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
+
+#ifndef _NUMUNO_HXX
+#include "numuno.hxx"
+#endif
+#ifndef _ZFORLIST_HXX
+#include "zforlist.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
+#include <com/sun/star/io/XPersistObject.hpp>
+#endif
+
+//=========================================================================
+//= 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;
+
+public:
+ SvNumberFormatsSupplierServiceObject();
+ ~SvNumberFormatsSupplierServiceObject();
+
+ // XInterface
+ virtual void SAL_CALL acquire() { SvNumberFormatsSupplierObj::acquire(); }
+ virtual void SAL_CALL release() { 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);
+
+protected:
+ void implEnsureFormatter();
+};
+
+
+#endif // _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
+
diff --git a/svtools/source/numbers/zforfind.cxx b/svtools/source/numbers/zforfind.cxx
new file mode 100644
index 000000000000..9c616ab39463
--- /dev/null
+++ b/svtools/source/numbers/zforfind.cxx
@@ -0,0 +1,2316 @@
+/*************************************************************************
+ *
+ * $RCSfile: zforfind.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <float.h>
+
+#ifndef _INTN_HXX //autogen
+#include <tools/intn.hxx>
+#endif
+#ifndef _DATE_HXX //autogen
+#include <tools/date.hxx>
+#endif
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _SYSTEM_HXX //autogen
+#include <vcl/system.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+
+#include "zforlist.hxx" // NUMBERFORMAT_XXX
+#include "zforscan.hxx"
+#include "zformat.hxx"
+
+#define _ZFORFIND_CXX
+#include "zforfind.hxx"
+#undef _ZFORFIND_CXX
+
+
+// wenn's geht das schnellere isdigit benutzen
+#ifdef ENABLEUNICODE
+//#define MyIsdigit(c) (pFormatter->GetCharClass()->isDigit(c))
+#define MyIsdigit(c) ((c) < 256 && isdigit((unsigned char)(c)))
+#else
+#define MyIsdigit(c) (isdigit((unsigned xub_Unicode)(c)))
+#endif
+
+//---------------------------------------------------------------------------
+// Konstruktor
+
+ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
+{
+ pFormatter = pFormatterP;
+ pNullDate = new Date(30,12,1899);
+ nYear2000 = SvNumberFormatter::GetYear2000Default();
+ Reset();
+ ChangeIntl();
+}
+
+
+//---------------------------------------------------------------------------
+// Destruktor
+
+ImpSvNumberInputScan::~ImpSvNumberInputScan()
+{
+ Reset();
+ delete pNullDate;
+}
+
+
+//---------------------------------------------------------------------------
+// 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;
+}
+
+
+//---------------------------------------------------------------------------
+// StringToDouble
+//
+// nur Vorzeichenlose Dezimalzahlen
+
+double ImpSvNumberInputScan::StringToDouble( const XubString& rStr )
+{
+ double fNum = 0.0;
+ xub_StrLen nPos = 0;
+ xub_StrLen nLen = rStr.Len();
+ FASTBOOL bPreComma = TRUE;
+ double fBas;
+
+ while (nPos < nLen)
+ {
+ if (rStr.GetChar(nPos) == '.')
+ {
+ bPreComma = FALSE;
+ fBas = 1.0;
+ }
+ else if (bPreComma)
+ {
+ fNum *= 10.0;
+ fNum += (double) (rStr.GetChar(nPos)-'0');
+ }
+ else
+ {
+ fBas *= 10.0;
+ fNum += ((double)(rStr.GetChar(nPos)-'0'))/fBas;
+ }
+ nPos++;
+ }
+ 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 xub_Unicode*& pStr,
+ XubString& rSymbol )
+{
+ BOOL isNumber = FALSE;
+ xub_Unicode cToken;
+ ScanState eState = SsStart;
+ register const xub_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
+
+BOOL ImpSvNumberInputScan::SkipThousands(
+ const xub_Unicode*& pStr,
+ XubString& rSymbol )
+{
+ BOOL res = FALSE;
+ xub_Unicode cToken;
+ register const xub_Unicode* pHere = pStr;
+ ScanState eState = SsStart;
+ xub_StrLen nCounter; // zaehlt 3er Paare
+
+ while ( ((cToken = *pHere) != 0) && eState != SsStop)
+ {
+ pHere++;
+ switch (eState)
+ {
+ case SsStart:
+ if (cToken == pFormatter->GetInternational()->GetNumThousandSep())
+ {
+ nCounter = 0;
+ eState = SsGetValue;
+ }
+ else
+ {
+ eState = SsStop;
+ pHere--;
+ }
+ break;
+ case SsGetValue:
+ if ( MyIsdigit( cToken ) )
+ {
+ rSymbol += cToken;
+ nCounter++;
+ if (nCounter == 3)
+ {
+ eState = SsStart;
+ res = TRUE; // .000 Kombination gef.
+ }
+ }
+ else
+ {
+ eState = SsStop;
+ pHere--;
+ }
+ break;
+ default:
+ break;
+ } // switch
+ } // while
+
+ if (eState == SsGetValue) // Abbruch mit weniger als 3 St.
+ {
+ if ( nCounter )
+ rSymbol.Erase( rSymbol.Len() - nCounter, nCounter );
+ pHere -= nCounter + 1; // auch . mit zurueck
+ }
+ pStr = pHere;
+
+ return res;
+}
+
+
+//---------------------------------------------------------------------------
+// NumberStringDivision
+
+void ImpSvNumberInputScan::NumberStringDivision( const XubString& rString )
+{
+ register const xub_Unicode* pStr = rString.GetBuffer();
+ register const xub_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++;
+ }
+}
+
+
+//---------------------------------------------------------------------------
+// if rString contains rWhat at nPos
+
+BOOL ImpSvNumberInputScan::StringContains( const XubString& rWhat,
+ const XubString& rString, xub_StrLen nPos )
+{
+ if ( nPos + rWhat.Len() <= rString.Len() )
+ {
+ register const xub_Unicode* pWhat = rWhat.GetBuffer();
+ register const xub_Unicode* const pEnd = pWhat + rWhat.Len();
+ register const xub_Unicode* pStr = rString.GetBuffer() + nPos;
+ while ( pWhat < pEnd )
+ {
+ if ( *pWhat != *pStr )
+ return FALSE;
+ pWhat++;
+ pStr++;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+//---------------------------------------------------------------------------
+// SkipChar
+//
+// ueberspringt genau das angegebene Zeichen
+
+inline BOOL ImpSvNumberInputScan::SkipChar( xub_Unicode c, const XubString& 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 XubString& rString,
+ xub_StrLen& nPos )
+{
+ if ( nPos < rString.Len() )
+ {
+ register const xub_Unicode* p = rString.GetBuffer() + nPos;
+ while ( *p == ' ' )
+ {
+ nPos++;
+ p++;
+ }
+ }
+}
+
+
+//---------------------------------------------------------------------------
+// SkipString
+//
+// jump over rWhat in rString at nPos
+
+inline BOOL ImpSvNumberInputScan::SkipString( const XubString& rWhat,
+ const XubString& rString, xub_StrLen& nPos )
+{
+ if ( StringContains( rWhat, rString, nPos ) )
+ {
+ nPos += rWhat.Len();
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+//---------------------------------------------------------------------------
+// GetThousandSep
+//
+// erkennt genau .111 als Tausenderpunkt
+
+inline BOOL ImpSvNumberInputScan::GetThousandSep(
+ const XubString& rString,
+ xub_StrLen& nPos,
+ USHORT nStringPos )
+{
+ if ( rString.Len() == 1 // keine Blanks
+ && nPos == 0 // safety first!
+ && rString.GetChar(nPos) == pFormatter->GetInternational()->GetNumThousandSep() // '.'
+ && nStringPos < nAnzStrings - 1 // safety first!
+ && IsNum[nStringPos+1] // Zahl folgt
+ && ( sStrArray[nStringPos+1].Len() == 3 // mit 3 Stellen
+ || nPosThousandString == nStringPos+1 ) ) // oder bereits zusammengefasst
+ {
+ nPos++;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+//---------------------------------------------------------------------------
+// GetLogical
+//
+// Umwandlung Text in logischen Wert
+// "TRUE" => 1:
+// "FALSE"=> -1:
+// sonst => 0:
+
+short ImpSvNumberInputScan::GetLogical( const XubString& rString )
+{
+ short res;
+
+ if (rString.Len() < 4) // kein Platz fuer mind 4 Buch.
+ res = 0;
+ else
+ {
+ const xub_Unicode *pTrue, *pFalse;
+ LanguageType eLnge = pFormatter->GetInternational()->GetLanguage();
+ ImpSvNumberformatScan::GetLogicalKeywords( eLnge, pTrue, pFalse );
+#if 0
+// NoMoreUpperNeeded
+ XubString sBool( pTrue );
+ USHORT nLen = rString.Len();
+ if ( nLen == sBool.Len() && pFormatter->GetInternational()->CompareEqual(
+ rString, sBool, INTN_COMPARE_IGNORECASE ) )
+ { // zuerst True
+ res = 1; // True -> 1
+ }
+ else
+ {
+ sBool = pFalse;
+ if ( nLen == sBool.Len() && pFormatter->GetInternational()->CompareEqual(
+ rString, sBool, INTN_COMPARE_IGNORECASE ) )
+ { // dann False
+ res = -1; // False -> -1
+ }
+ else
+ res = 0; // sonst -> 0
+ }
+#else
+ if ( rString == pTrue )
+ res = 1;
+ else if ( rString == pFalse )
+ res = -1;
+ else
+ res = 0;
+#endif
+ }
+
+ return res;
+}
+
+
+//---------------------------------------------------------------------------
+// GetMonth
+//
+// Wandelt String mit Monatsbezeichnung (JAN, Januar) in Zahl des Monats um
+// gibt 0 zurueck, wenn nix gefunden wird.
+
+short ImpSvNumberInputScan::GetMonth( const XubString& rString, xub_StrLen& nPos )
+{
+ short res = 0;
+
+ if (rString.Len() > nPos) // nur wenn Platz
+ {
+ if ( !bTextInitialized )
+ InitText();
+// XubString sString( pFormatter->GetCharClass()->upper(rString) ); // NoMoreUpperNeeded
+ for (int i = 0; i < 12; i++) // 12 Monate
+ {
+ if ( StringContains( aUpperMonthText[i], rString, nPos ) )
+ { // zuerst den langen
+ nPos += aUpperMonthText[i].Len();
+ res = i+1; // lange positiv
+ break; // Ende for
+ }
+ else if ( StringContains( aUpperAbbrevMonthText[i], rString, nPos ) )
+ { // dann den kurzen
+ nPos += aUpperAbbrevMonthText[i].Len();
+ res = -(i+1); // kurze negativ
+ break; // Ende for
+ }
+ }
+ }
+
+ return res; // kein Monat gefunden
+}
+
+
+//---------------------------------------------------------------------------
+// GetDayOfWeek
+//
+// Wandelt String mit Wochentagname (Mo, Montag) in Zahl des Wochentags um
+// (enum DayOfWeek + 1 !), gibt 0 zurueck, wenn nix gefunden wird.
+
+short ImpSvNumberInputScan::GetDayOfWeek( const XubString& rString, xub_StrLen& nPos )
+{
+ short res = 0;
+
+ if (rString.Len() > nPos) // nur wenn Platz
+ {
+ if ( !bTextInitialized )
+ InitText();
+// XubString sString( pFormatter->GetCharClass()->upper(rString) ); // NoMoreUpperNeeded
+ for (short i = 0; i < 7; i++) // 7 Wochentage
+ {
+ if ( StringContains( aUpperDayText[i], rString, nPos ) )
+ { // zuerst den langen
+ nPos += aUpperDayText[i].Len();
+ res = i + 1; // lange positiv
+ break; // Ende for
+ }
+ if ( StringContains( aUpperAbbrevDayText[i], rString, nPos ) )
+ { // dann den kurzen
+ nPos += aUpperAbbrevDayText[i].Len();
+ res = -(i + 1); // kurze negativ
+ break; // Ende for
+ }
+ }
+ }
+
+ return res;
+}
+
+
+//---------------------------------------------------------------------------
+// GetCurrency
+//
+// Lesen eines Waehrungssysmbols
+// '$' => TRUE
+// sonst => FALSE
+
+BOOL ImpSvNumberInputScan::GetCurrency( const XubString& rString, xub_StrLen& nPos,
+ const SvNumberformat* pFormat )
+{
+ if ( rString.Len() > nPos )
+ {
+ if ( !bTextInitialized )
+ InitText();
+// XubString sString( pFormatter->GetCharClass()->upper(rString) ); // NoMoreUpperNeeded
+ if ( StringContains( aUpperCurrSymbol, rString, nPos ) )
+ {
+ nPos += aUpperCurrSymbol.Len();
+ return TRUE;
+ }
+ if ( pFormat )
+ {
+ XubString aSymbol, aExtension;
+ if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) )
+ {
+ if ( aSymbol.Len() <= rString.Len() - nPos )
+ {
+ pFormatter->GetCharClass()->toUpper( aSymbol );
+ if ( StringContains( aSymbol, rString, 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 XubString& rString, xub_StrLen& nPos )
+{
+// XubString sString( pFormatter->GetCharClass()->upper(rString) ); // NoMoreUpperNeeded
+
+ //! Internationalisierung?
+ static const XubString aUpperAM( RTL_CONSTASCII_USTRINGPARAM( "AM" ) );
+ static const XubString aUpperPM( RTL_CONSTASCII_USTRINGPARAM( "PM" ) );
+
+ if ( rString.Len() > nPos )
+ {
+ if ( StringContains( aUpperAM, rString, nPos ) )
+ {
+ nAmPm = 1;
+ nPos += aUpperAM.Len();
+ return TRUE;
+ }
+ else if ( StringContains( aUpperPM, rString, nPos ) )
+ {
+ nAmPm = -1;
+ nPos += aUpperPM.Len();
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+//---------------------------------------------------------------------------
+// GetDecSep
+//
+// Lesen eines Dezimaltrenners (',')
+// ',' => TRUE
+// sonst => FALSE
+
+inline BOOL ImpSvNumberInputScan::GetDecSep( const XubString& rString, xub_StrLen& nPos )
+{
+ if ( rString.Len() > nPos
+ && rString.GetChar(nPos) == pFormatter->GetInternational()->GetNumDecimalSep() )
+ {
+ nPos++;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+//---------------------------------------------------------------------------
+// GetSign
+//
+// Lesen eines Vorzeichens, auch Klammer !?!
+// '+' => 1
+// '-' => -1
+// '(' => -1, nNegCheck = 1
+// sonst => 0
+
+short ImpSvNumberInputScan::GetSign( const XubString& rString, xub_StrLen& nPos )
+{
+ if (rString.Len() > nPos)
+ switch (rString.GetChar(nPos))
+ {
+ case '+':
+ nPos++;
+ return 1;
+ break;
+ case '(': // '(' aehnlich wie '-' ?!?
+ nNegCheck = 1;
+ //! fallthru
+ case '-':
+ nPos++;
+ return -1;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+//---------------------------------------------------------------------------
+// GetESign
+//
+// Lesen eines Vorzeichens, gedacht fuer Exponent ?!?
+// '+' => 1
+// '-' => -1
+// sonst => 0
+
+short ImpSvNumberInputScan::GetESign( const XubString& rString, xub_StrLen& nPos )
+{
+ if (rString.Len() > nPos)
+ switch (rString.GetChar(nPos))
+ {
+ case '+':
+ nPos++;
+ return 1;
+ break;
+ case '-':
+ nPos++;
+ return -1;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
+//---------------------------------------------------------------------------
+// GetNextNumber
+//
+// i zaehlt Strings, j zaehlt Numbers, eigentlich sollte das SkipNumber heissen
+
+inline BOOL ImpSvNumberInputScan::GetNextNumber( USHORT& i, USHORT& j )
+{
+ if ( IsNum[i] )
+ {
+ j++;
+ i++;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+//---------------------------------------------------------------------------
+// GetTimeRef
+
+void ImpSvNumberInputScan::GetTimeRef(
+ double& fOutNumber,
+ USHORT nIndex, // j-Wert fuer den ersten Zeitstring der Eingabe (default 0)
+ USHORT nAnz ) // Anzahl der Zeitstrings
+{
+ xub_Unicode* pChar = NULL;
+ USHORT nHour;
+ USHORT nMinute = 0;
+ USHORT nSecond = 0;
+ double fSecond100 = 0.0;
+ USHORT nStartIndex = nIndex;
+
+ if (nDecPos == 2 && nAnz == 3) // 20:45,5
+ nHour = 0;
+ else
+ nHour = (USHORT) sStrArray[nNums[nIndex++]].ToInt32();
+ if (nIndex - nStartIndex < nAnz)
+ nMinute = (USHORT) sStrArray[nNums[nIndex++]].ToInt32();
+ if (nIndex - nStartIndex < nAnz)
+ nSecond = (USHORT) sStrArray[nNums[nIndex++]].ToInt32();
+ if (nIndex - nStartIndex < nAnz)
+ {
+ XubString s100Sec( '.' );
+ s100Sec += sStrArray[nNums[nIndex]];
+ fSecond100 = StringToDouble( s100Sec );
+ }
+ 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 )
+{
+ USHORT nRes = 0;
+
+ if (sStrArray[nNums[nIndex]].Len() <= 2)
+ {
+ USHORT nNum = (USHORT) sStrArray[nNums[nIndex]].ToInt32();
+ if (nNum <= 12)
+ nRes = nNum;
+ }
+
+ 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;
+}
+
+
+//---------------------------------------------------------------------------
+// GetDateRef
+
+BOOL ImpSvNumberInputScan::GetDateRef( Date& aDt, USHORT& nCounter,
+ const SvNumberformat* pFormat )
+{
+ NfEvalDateFormat eEDF;
+ int nFormatOrder;
+ if ( pFormat && ((pFormat->GetType() & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE) )
+ {
+ eEDF = pFormat->ImpGetScan().GetNumberformatter()->GetEvalDateFormat();
+ switch ( eEDF )
+ {
+ case NF_EVALDATEFORMAT_INTL :
+ case NF_EVALDATEFORMAT_FORMAT :
+ nFormatOrder = 1; // nur ein Durchlauf
+ break;
+ default:
+ nFormatOrder = 2;
+ }
+ }
+ else
+ {
+ eEDF = NF_EVALDATEFORMAT_INTL;
+ nFormatOrder = 1;
+ }
+ BOOL res = TRUE;
+
+ const International* pIntl = pFormatter->GetInternational();
+ for ( int nTryOrder = 1; nTryOrder <= nFormatOrder; nTryOrder++ )
+ {
+ DateFormat DateFmt;
+ switch ( eEDF )
+ {
+ case NF_EVALDATEFORMAT_INTL :
+ DateFmt = pIntl->GetDateFormat();
+ break;
+ case NF_EVALDATEFORMAT_FORMAT :
+ DateFmt = pFormat->GetDateOrder();
+ break;
+ case NF_EVALDATEFORMAT_INTL_FORMAT :
+ if ( nTryOrder == 1 )
+ DateFmt = pIntl->GetDateFormat();
+ else
+ DateFmt = pFormat->GetDateOrder();
+ break;
+ case NF_EVALDATEFORMAT_FORMAT_INTL :
+ if ( nTryOrder == 2 )
+ DateFmt = pIntl->GetDateFormat();
+ else
+ DateFmt = pFormat->GetDateOrder();
+ break;
+ default:
+ DBG_ERROR( "ImpSvNumberInputScan::GetDateRef: unknown NfEvalDateFormat" );
+ }
+
+ res = TRUE;
+ nCounter = 0;
+
+ switch (nAnzNums) // Anzahl der Zahlen im String
+ {
+ case 0: // gar keine
+ if (nMonthPos) // nur Monat (Jan)
+ {
+ aDt.SetDay(1);
+ aDt.SetMonth((USHORT)Abs(nMonth));
+ }
+ else
+ res = FALSE;
+ break;
+
+ case 1: // nur eine Zahl
+ nCounter = 1;
+ switch (nMonthPos) // Wo steht der Monat
+ {
+ case 0: // nicht gefunden => nur Tag eingegeben
+ aDt.SetDay(ImplGetDay(0));
+ break;
+ case 1: // Monat am Anfang (Jan 01)
+ aDt.SetMonth((USHORT)Abs(nMonth));
+ switch (DateFmt)
+ {
+ case MDY:
+ case YMD:
+ aDt.SetDay(ImplGetDay(0));
+ break;
+ case DMY:
+ aDt.SetDay(1);
+ aDt.SetYear(ImplGetYear(0));
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ case 3: // Monat am Ende (10 Jan)
+ aDt.SetMonth((USHORT)Abs(nMonth));
+ switch (DateFmt)
+ {
+ case DMY:
+ aDt.SetDay(ImplGetDay(0));
+ break;
+ case YMD:
+ aDt.SetDay(1);
+ aDt.SetYear(ImplGetYear(0));
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ default:
+ res = FALSE;
+ break;
+ } // switch (nMonthPos)
+ break;
+
+ case 2: // 2 Zahlen
+ nCounter = 2;
+ switch (nMonthPos) // Wo steht der Monat
+ {
+ case 0: // nicht gefunden
+ switch (DateFmt)
+ {
+ case MDY:
+ aDt.SetDay(ImplGetDay(1));
+ aDt.SetMonth(ImplGetMonth(0));
+ break;
+ case DMY:
+ aDt.SetDay(ImplGetDay(0));
+ aDt.SetMonth(ImplGetMonth(1));
+ if (!aDt.IsValid()) // 2. Versuch
+ {
+ aDt.SetDay(1);
+ aDt.SetMonth(ImplGetMonth(0));
+ aDt.SetYear(ImplGetYear(1));
+ }
+ break;
+ case YMD:
+ aDt.SetDay(ImplGetDay(1));
+ aDt.SetMonth(ImplGetMonth(0));
+ if (!aDt.IsValid()) // 2. Versuch
+ {
+ aDt.SetDay(1);
+ aDt.SetMonth(ImplGetMonth(1));
+ aDt.SetYear(ImplGetYear(0));
+ }
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ case 1: // Monat am Anfang (Jan 01 01)
+ switch (DateFmt)
+ {
+ case MDY:
+ aDt.SetDay(ImplGetDay(0));
+ aDt.SetMonth((USHORT)Abs(nMonth));
+ aDt.SetYear(ImplGetYear(1));
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ case 2: // Monat in der Mitte (10 Jan 94)
+ aDt.SetMonth((USHORT)Abs(nMonth));
+ switch (DateFmt)
+ {
+ case DMY:
+ aDt.SetDay(ImplGetDay(0));
+ aDt.SetYear(ImplGetYear(1));
+ break;
+ case YMD:
+ aDt.SetDay(ImplGetDay(1));
+ aDt.SetYear(ImplGetYear(0));
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ default: // sonst., z.B. Monat am Ende (94 10 Jan)
+ res = FALSE;
+ break;
+ } // switch (nMonthPos)
+ break;
+
+ default: // mehr als zwei (31.12.94 8:23) (31.12. 8:23)
+ switch (nMonthPos) // Wo steht der Monat
+ {
+ case 0: // nicht gefunden
+ 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
+ }
+ }
+ }
+ switch (DateFmt)
+ {
+ case MDY:
+ aDt.SetDay(ImplGetDay(1));
+ aDt.SetMonth(ImplGetMonth(0));
+ if ( nCounter > 2 )
+ aDt.SetYear(ImplGetYear(2));
+ break;
+ case DMY:
+ aDt.SetDay(ImplGetDay(0));
+ aDt.SetMonth(ImplGetMonth(1));
+ if ( nCounter > 2 )
+ aDt.SetYear(ImplGetYear(2));
+ break;
+ case YMD:
+ if ( nCounter > 2 )
+ aDt.SetDay(ImplGetDay(2));
+ aDt.SetMonth(ImplGetMonth(1));
+ aDt.SetYear(ImplGetYear(0));
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ case 1: // Monat am Anfang (Jan 01 01 8:23)
+ nCounter = 2;
+ switch (DateFmt)
+ {
+ case MDY:
+ aDt.SetDay(ImplGetDay(0));
+ aDt.SetMonth((USHORT)Abs(nMonth));
+ aDt.SetYear(ImplGetYear(1));
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ case 2: // Monat in der Mitte (10 Jan 94 8:23)
+ nCounter = 2;
+ aDt.SetMonth((USHORT)Abs(nMonth));
+ switch (DateFmt)
+ {
+ case DMY:
+ aDt.SetDay(ImplGetDay(0));
+ aDt.SetYear(ImplGetYear(1));
+ break;
+ case YMD:
+ aDt.SetDay(ImplGetDay(1));
+ aDt.SetYear(ImplGetYear(0));
+ break;
+ default:
+ res = FALSE;
+ break;
+ }
+ break;
+ default: // sonst., z.B. Monat am Ende (94 10 Jan 8:23)
+ nCounter = 2;
+ res = FALSE;
+ break;
+ } // switch (nMonthPos)
+ break;
+ } // switch (nAnzNums)
+
+ if ( nTryOrder < nFormatOrder )
+ {
+ if ( res && aDt.IsValid() )
+ nTryOrder = nFormatOrder; // break for
+ else
+ aDt = Date(); // naechster
+ }
+ }
+
+ return res;
+}
+
+
+//---------------------------------------------------------------------------
+// ScanStartString
+//
+// ersten String analysieren
+// Alles weg => TRUE
+// sonst => FALSE
+
+BOOL ImpSvNumberInputScan::ScanStartString( const XubString& rString,
+ const SvNumberformat* pFormat )
+{
+ xub_StrLen nPos = 0;
+ short nDayOfWeek;
+
+ SkipBlanks(rString, nPos);
+ if ( nSign = GetSign(rString, nPos) ) // Vorzeichen?
+ SkipBlanks(rString, nPos);
+
+ if ( GetDecSep(rString, nPos) ) // Dezimaltrenner (,) im Startstring
+ {
+ nDecPos = 1;
+ SkipBlanks(rString, nPos);
+ }
+ else if ( GetCurrency(rString, nPos, pFormat) ) // Waehrung (DM 1)?
+ {
+ eScannedType = NUMBERFORMAT_CURRENCY; // !!! es ist Geld !!!
+ SkipBlanks(rString, nPos);
+ if (nSign == 0) // noch kein Vorzeichen
+ if ( nSign = GetSign(rString, nPos) ) // DM -1
+ SkipBlanks(rString, nPos);
+ }
+ else if ( nMonth = GetMonth(rString, nPos) ) // Monat (Jan 1)?
+ {
+ eScannedType = NUMBERFORMAT_DATE; // !!! es ist eine Datum !!!
+ nMonthPos = 1; // Monat an 1. Pos
+ if ( nMonth < 0 )
+ SkipChar( '.', rString, nPos ); // abgekuerzt
+ SkipBlanks(rString, nPos);
+ }
+ else if ( nDayOfWeek = GetDayOfWeek( rString, nPos ) )
+ { // Wochentag wird nur weggeparst
+ eScannedType = NUMBERFORMAT_DATE; // !!! es ist eine Datum !!!
+ if ( nPos < rString.Len() )
+ {
+ if ( nDayOfWeek < 0 )
+ { // kurz
+ if ( rString.GetChar( nPos ) == '.' )
+ ++nPos;
+ }
+ else
+ { // lang
+ SkipBlanks(rString, nPos);
+ SkipString( pFormatter->GetInternational()->GetLongDateDayOfWeekSep(), rString, nPos );
+ }
+ SkipBlanks(rString, nPos);
+ if ( nMonth = GetMonth(rString, nPos) ) // Monat (Jan 1)?
+ {
+ nMonthPos = 1; // Monat an 1. Pos
+ if ( nMonth < 0 )
+ SkipChar( '.', rString, nPos ); // abgekuerzt
+ SkipBlanks(rString, nPos);
+ }
+ }
+ }
+
+ if (nPos < rString.Len()) // noch nicht alles weg
+ {
+ // eingegebener StartString gleich StartString im Format?
+ if ( !ScanStringNumFor( rString, nPos, pFormat, 0 ) )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+//---------------------------------------------------------------------------
+// ScanMidString
+//
+// String in der Mitte analysieren
+// Alles weg => TRUE
+// sonst => FALSE
+
+BOOL ImpSvNumberInputScan::ScanMidString(
+ const XubString& rString,
+ USHORT nStringPos )
+{
+ const International* pIntl = pFormatter->GetInternational();
+ xub_StrLen nPos = 0;
+
+ SkipBlanks(rString, nPos);
+ if (GetDecSep(rString, nPos)) // Dezimaltrenner?
+ {
+ if (nDecPos == 1 || nDecPos == 3) // ,12,4 oder 1,E2,1
+ return FALSE;
+ else if (nDecPos == 2) // , doppelt 12,4,
+ {
+ if (bDecSepInDateSeps) // , auch Date Sep
+ {
+ if (eScannedType != NUMBERFORMAT_UNDEFINED &&
+ eScannedType != NUMBERFORMAT_DATE) // schon anderer Typ
+ return FALSE;
+ eScannedType = NUMBERFORMAT_DATE; // !!! Es ist ein Datum !!!
+ SkipBlanks(rString, nPos);
+ }
+ else
+ return FALSE;
+ }
+ else
+ {
+ nDecPos = 2; // , im Mittelstring
+ SkipBlanks(rString, nPos);
+ }
+ }
+
+ if (SkipChar('/', rString, nPos)) // Bruch?
+ {
+ if ( eScannedType != NUMBERFORMAT_UNDEFINED // schon anderes Format
+ && eScannedType != NUMBERFORMAT_DATE) // ausser Datum
+ return FALSE; // => jan/31/1994
+ else if ( eScannedType != NUMBERFORMAT_DATE // bisher als Datum analysiert
+ && ( eSetType == NUMBERFORMAT_FRACTION // und Vorgabe war Bruch
+ || (nAnzNums == 3 // oder 3 Zahlen
+ && nStringPos > 2) ) ) // und ???
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_FRACTION; // !!! es ist ein Bruch
+ }
+ else
+ nPos--; // '/' zurueck
+ }
+
+ if (GetThousandSep(rString, nPos, nStringPos)) // 1.000
+ {
+ if ( eScannedType != NUMBERFORMAT_UNDEFINED // schon anderes Format
+ && eScannedType != NUMBERFORMAT_CURRENCY) // ausser Waehrung
+ return FALSE;
+ nThousand++;
+ }
+
+ SkipBlanks(rString, nPos);
+ xub_Unicode cDate = pIntl->GetDateSep();
+ xub_Unicode cTime = pIntl->GetTimeSep();
+ if ( SkipChar(cDate, 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 // schon anderes Format
+ && eScannedType != NUMBERFORMAT_DATE) // ausser Datum
+ return FALSE;
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_DATE; // !!! es ist ein Datum
+ short nTmpMonth = GetMonth(rString, nPos); // 10. Jan 94
+ if (nMonth && nTmpMonth) // Monat doppelt
+ return FALSE;
+ if (nTmpMonth)
+ {
+ nMonth = nTmpMonth;
+ nMonthPos = 2; // Monat in der Mitte
+ if ( nMonth < 0 )
+ SkipChar( '.', rString, nPos ); // abgekuerzt
+ SkipString( pIntl->GetLongDateMonthSep(), rString, nPos );
+ SkipBlanks(rString, nPos);
+ }
+ }
+
+ short nTempMonth = GetMonth(rString, nPos); // Monat in der Mitte (10 Jan 94)
+ if (nTempMonth)
+ {
+ if (nMonth != 0) // Monat doppelt
+ return FALSE;
+ if ( eScannedType != NUMBERFORMAT_UNDEFINED // schon anderes Format
+ && eScannedType != NUMBERFORMAT_DATE) // ausser Datum
+ return FALSE;
+ eScannedType = NUMBERFORMAT_DATE; // !!! es ist ein Datum
+ nMonth = nTempMonth;
+ nMonthPos = 2; // Monat in der Mitte
+ if ( nMonth < 0 )
+ SkipChar( '.', rString, nPos ); // abgekuerzt
+ SkipString( pIntl->GetLongDateMonthSep(), rString, nPos );
+ SkipBlanks(rString, nPos);
+ }
+
+ if ( SkipChar('E', rString, nPos) // 10E, 10e, 10,Ee
+ || SkipChar('e', rString, nPos) )
+ {
+ if (eScannedType != NUMBERFORMAT_UNDEFINED) // schon anderes Format
+ return FALSE;
+ else
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_SCIENTIFIC; // !!! es ist eine Zahl im E-Format
+ if ( nThousand+2 == nAnzNums // Sonderfall 1,E2
+ && nDecPos == 2 )
+ nDecPos = 3; // 1.100,E2 1.100.100,E3
+ }
+ nESign = GetESign(rString, nPos); // Vorzeichen vom Exponent?
+ SkipBlanks(rString, nPos);
+ }
+
+ if ( SkipChar(cTime, rString, nPos) ) // Zeittrenner?
+ {
+ if (nDecPos) // schon , => Fehler
+ return FALSE;
+ if ( ( eScannedType == NUMBERFORMAT_DATE // bereits Datumsformat
+ || eScannedType == NUMBERFORMAT_DATETIME) // erkannt und
+ && nAnzNums > 3) // mehr als 3 Zahlen? (31.Dez.94 8:23)
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_DATETIME; // !!! es ist Datum mit Uhrzeit
+ }
+ else if ( eScannedType != NUMBERFORMAT_UNDEFINED // schon anderes Format
+ && eScannedType != NUMBERFORMAT_TIME) // ausser Zeit
+ return FALSE;
+ else
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_TIME; // !!! es ist eine Zeit
+ }
+ if ( !nTimePos )
+ nTimePos = nStringPos + 1;
+ }
+
+ // #68232# recognize long date separators like ", " in "September 5, 1999"
+ if ( nPos < rString.Len() && eScannedType == NUMBERFORMAT_DATE
+ && nMonthPos == 1 && pIntl->GetLongDateFormat() == MDY )
+ {
+ if ( SkipString( pIntl->GetLongDateDaySep(), rString, nPos ) )
+ SkipBlanks( rString, nPos );
+ }
+
+ if (nPos < rString.Len()) // noch nicht alles weg?
+ return FALSE;
+
+ return TRUE;
+}
+
+
+//---------------------------------------------------------------------------
+// ScanEndString
+//
+// Schlussteil analysieren
+// Alles weg => TRUE
+// sonst => FALSE
+
+BOOL ImpSvNumberInputScan::ScanEndString( const XubString& rString,
+ const SvNumberformat* pFormat )
+{
+ const International* pIntl = pFormatter->GetInternational();
+ xub_StrLen nPos = 0;
+
+ SkipBlanks(rString, nPos);
+ if (GetDecSep(rString, nPos)) // Dezimaltrenner?
+ {
+ if (nDecPos == 1 || nDecPos == 3) // ,12,4 oder 12,E4,
+ return FALSE;
+ else if (nDecPos == 2) // , doppelt 12,4,
+ {
+ if (bDecSepInDateSeps) // , auch Date Sep
+ {
+ if (eScannedType != NUMBERFORMAT_UNDEFINED &&
+ eScannedType != NUMBERFORMAT_DATE) // schon anderer Typ
+ return FALSE;
+ eScannedType = NUMBERFORMAT_DATE; // !!! es ist ein Datum
+ SkipBlanks(rString, nPos);
+ }
+ else
+ return FALSE;
+ }
+ else
+ {
+ nDecPos = 3; // , im Endstring
+ SkipBlanks(rString, nPos);
+ }
+ }
+
+ if ( nSign == 0 // Konflikt - kein Vorzeichen
+ && eScannedType != NUMBERFORMAT_DATE) // und nicht Datum
+//? Uhrzeit auch abfangen ?
+ { // noch kein Vorzeichen
+ nSign = GetSign(rString, nPos); // 1- DM
+ if (nNegCheck) // '(' als Vorzeichen
+ return FALSE;
+ }
+
+ SkipBlanks(rString, nPos);
+ if (nNegCheck && SkipChar(')', rString, nPos)) // ggf. ')' ueberlesen
+ {
+ nNegCheck = 0;
+ SkipBlanks(rString, nPos);
+ }
+
+ if ( GetCurrency(rString, nPos, pFormat) ) // Waehrungssymbol?
+ {
+ if (eScannedType != NUMBERFORMAT_UNDEFINED) // DM doppelt oder
+ return FALSE;
+ else
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_CURRENCY;
+ } // hinter DM - erlaubt
+ if (nSign == 0) // noch kein Vorzeichen
+ {
+ nSign = GetSign(rString, nPos); // DM -
+ SkipBlanks(rString, nPos);
+ if (nNegCheck) // 3 DM (
+ return FALSE;
+ }
+ if ( nNegCheck && eScannedType == NUMBERFORMAT_CURRENCY
+ && SkipChar(')', rString, nPos) )
+ {
+ nNegCheck = 0; // ggf. ')' ueberlesen
+ SkipBlanks(rString, nPos); // nur bei Waehrung
+ }
+ }
+
+ if ( SkipChar('%', rString, nPos) ) // 1 %
+ {
+ if (eScannedType != NUMBERFORMAT_UNDEFINED) // schon anderes Format
+ return FALSE;
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_PERCENT;
+ }
+
+ xub_Unicode cTime = pIntl->GetTimeSep();
+ if ( SkipChar(cTime, rString, nPos) ) // 10:
+ {
+ if (nDecPos) // schon , => Fehler
+ return FALSE;
+ if (eScannedType == NUMBERFORMAT_DATE && nAnzNums > 2) // 31.Dez.94 8:
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_DATETIME;
+ }
+ else if (eScannedType != NUMBERFORMAT_UNDEFINED &&
+ eScannedType != NUMBERFORMAT_TIME) // schon anderes Format
+ return FALSE;
+ else
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_TIME;
+ }
+ }
+
+ xub_Unicode cDate = pIntl->GetDateSep();
+ if ( SkipChar(cDate, 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) // schon anderes Format
+ return FALSE;
+ else
+ {
+ SkipBlanks(rString, nPos);
+ eScannedType = NUMBERFORMAT_DATE;
+ }
+ short nTmpMonth = GetMonth(rString, nPos); // 10. Jan
+ if (nMonth && nTmpMonth) // Monat doppelt
+ return FALSE;
+ if (nTmpMonth)
+ {
+ nMonth = nTmpMonth;
+ nMonthPos = 3; // Monat hinten
+ if ( nMonth < 0 )
+ SkipChar( '.', rString, nPos ); // abgekuerzt
+ SkipBlanks(rString, nPos);
+ }
+ }
+
+ short nTempMonth = GetMonth(rString, nPos); // 10 Jan
+ if (nTempMonth)
+ {
+ if (nMonth) // Monat doppelt
+ return FALSE;
+ if (eScannedType != NUMBERFORMAT_UNDEFINED &&
+ eScannedType != NUMBERFORMAT_DATE) // schon anderes Format
+ return FALSE;
+ eScannedType = NUMBERFORMAT_DATE;
+ nMonth = nTempMonth;
+ nMonthPos = 3; // Monat hinten
+ if ( nMonth < 0 )
+ SkipChar( '.', rString, nPos ); // abgekuerzt
+ SkipBlanks(rString, nPos);
+ }
+
+ if (GetTimeAmPm(rString, nPos))
+ {
+ if (eScannedType != NUMBERFORMAT_UNDEFINED &&
+ eScannedType != NUMBERFORMAT_TIME &&
+ eScannedType != NUMBERFORMAT_DATETIME) // schon anderes Format
+ return FALSE;
+ else
+ {
+ SkipBlanks(rString, nPos);
+ if ( eScannedType != NUMBERFORMAT_DATETIME )
+ eScannedType = NUMBERFORMAT_TIME;
+ }
+ }
+
+ if ( nNegCheck && SkipChar(')', rString, nPos) )
+ {
+ if (eScannedType == NUMBERFORMAT_CURRENCY) // nur bei Waehrung
+ {
+ nNegCheck = 0; // ggf. ')' ueberlesen
+ SkipBlanks(rString, nPos);
+ }
+ else
+ return FALSE;
+ }
+
+ if ( nPos < rString.Len() &&
+ (eScannedType == NUMBERFORMAT_DATE
+ || eScannedType == NUMBERFORMAT_DATETIME) )
+ { // Wochentag wird nur weggeparst
+ xub_StrLen nOldPos = nPos;
+ const XubString& rSep = pIntl->GetLongDateDayOfWeekSep();
+ if ( StringContains( rSep, rString, nPos ) )
+ {
+ nPos += rSep.Len();
+ SkipBlanks(rString, nPos);
+ }
+ short nDayOfWeek;
+ if ( nDayOfWeek = GetDayOfWeek( rString, nPos ) )
+ {
+ if ( nPos < rString.Len() )
+ {
+ if ( nDayOfWeek < 0 )
+ { // kurz
+ if ( rString.GetChar( nPos ) == '.' )
+ ++nPos;
+ }
+ SkipBlanks(rString, nPos);
+ }
+ }
+ else
+ nPos = nOldPos;
+ }
+
+ if (nPos < rString.Len()) // alles weg?
+ {
+ // eingegebener EndString gleich EndString im Format?
+ if ( !ScanStringNumFor( rString, nPos, pFormat, 0xFFFF ) )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+BOOL ImpSvNumberInputScan::ScanStringNumFor(
+ const XubString& rString, // zu scannender String
+ xub_StrLen nPos, // Position bis zu der abgearbeitet war
+ const SvNumberformat* pFormat, // das zu matchende Format
+ USHORT nString ) // TeilString des TeilFormats
+ // normalerweise 0 oder 0xFFFF
+{
+ const International* pIntl = pFormatter->GetInternational();
+ if ( !pFormat )
+ return FALSE;
+ const XubString* pStr;
+ XubString aString( rString );
+ BOOL bFound = FALSE;
+ BOOL bFirst = TRUE;
+ BOOL bContinue = TRUE;
+ USHORT nSub;
+ do
+ {
+ // wenn am Anfang das zweite/dritte Teilformat gefunden wurde darunter
+ // nicht mehr suchen
+ nSub = nStringScanNumFor;
+ do
+ { // TeilFormate durchprobieren, erst positiv, dann negativ, dann anderes,
+ // letztes (Text) nicht
+ pStr = pFormat->GetNumForString( nSub, nString, TRUE );
+ if ( pStr && pIntl->CompareEqual( aString, *pStr, INTN_COMPARE_IGNORECASE ) )
+ {
+ bFound = TRUE;
+ bContinue = FALSE;
+ }
+ else if ( nSub < 2 )
+ ++nSub;
+ else
+ bContinue = FALSE;
+ } while ( bContinue );
+ if ( !bFound && bFirst && nPos )
+ { // uebriggelassenen SubString probieren
+ bFirst = FALSE;
+ aString.Erase( 0, nPos );
+ bContinue = TRUE;
+ }
+ } while ( bContinue );
+
+ if ( !bFound )
+ {
+ if ( (nString == 0) && !bFirst && (nSign < 0)
+ && pFormat->IsNegativeRealNegative() )
+ { // simpel doppelt negiert? --1
+ aString.EraseAllChars( ' ' );
+ if ( (aString.Len() == 1) && (aString.GetChar(0) == '-') )
+ {
+ bFound = TRUE;
+ nStringScanSign = -1;
+ nSub = 0; //! nicht 1
+ }
+ }
+ if ( !bFound )
+ return FALSE;
+ }
+ else if ( (nSub == 1) && pFormat->IsNegativeRealNegative() )
+ { // negativ
+ if ( nStringScanSign < 0 )
+ {
+ if ( (nSign < 0) && (nStringScanNumFor != 1) )
+ nStringScanSign = 1; // dreifach negiert --1 yyy
+ }
+ else if ( nStringScanSign == 0 )
+ {
+ if ( nSign < 0 )
+ { // nSign und nStringScanSign werden spaeter verknuepft,
+ // Vorzeichen umkehren wenn doppelt negiert
+ if ( (nString == 0) && !bFirst
+ && SvNumberformat::HasStringNegativeSign( aString ) )
+ nStringScanSign = -1; // direkte doppelte Negierung
+ else if ( pFormat->IsNegativeWithoutSign() )
+ nStringScanSign = -1; // indirekte doppelte Negierung
+ }
+ else
+ nStringScanSign = -1;
+ }
+ else // > 0
+ nStringScanSign = -1;
+ }
+ nStringScanNumFor = nSub;
+ return TRUE;
+}
+
+
+//---------------------------------------------------------------------------
+// IsNumberFormatMain
+//
+// erkennt folgende Typen: Zahl Z, Exp.darst. E, Bruch B, Prozent P
+// Waehrung W, Datum D, Uhrzeit U
+// sonst Text T <=> return FALSE; )
+
+BOOL ImpSvNumberInputScan::IsNumberFormatMain(
+ const XubString& rString, // zu analysierender String
+ double& fOutNumber, // OUT: Ergebnis als Zahl, wenn moeglich
+ const SvNumberformat* pFormat ) // evtl. gesetztes Zahlenformat
+{
+ Reset(); // Anfangszustand
+ // NoMoreUpperNeeded, alle Vergleiche auf UpperCase
+ XubString aString( pFormatter->GetCharClass()->upper( rString ) );
+ NumberStringDivision(aString); // Zerlegung in Zahlen/Strings
+ if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS) // zuviele Einzelteile
+ return FALSE; // Njet, Nope, ...
+
+ if (nAnzNums == 0) // keine Zahl in der Eingabe
+ {
+ if ( nAnzStrings > 0 )
+ {
+ // hier kann das Original geaendert werden, wird nicht mehr
+ // gebraucht, das erspart Kopiererei und ToUpper in GetLogical
+ // und ist im Zusammenspiel schneller
+ XubString& rStrArray = sStrArray[0];
+ rStrArray.EraseTrailingChars( ' ' );
+ rStrArray.EraseLeadingChars( ' ' );
+ if ( nLogical = GetLogical( rStrArray ) )
+ {
+ eScannedType = NUMBERFORMAT_LOGICAL;// !!! es ist ein BOOL
+ return TRUE;
+ }
+ else
+ return FALSE; // simple Text
+ }
+ else
+ return FALSE; // simple Text
+ }
+
+ USHORT i = 0; // markiert Symbole
+ USHORT j = 0; // markiert nur Zahlen
+
+ switch ( nAnzNums )
+ {
+ case 1 : // Genau 1 Zahl in der Eingabe
+ { // nAnzStrings >= 1
+ if (GetNextNumber(i,j)) // i=1,0
+ { // Zahl am Anfang
+ if (eSetType == NUMBERFORMAT_FRACTION) // Sonderfall Bruch 1 = 1/1
+ {
+ if (i >= nAnzStrings || // kein Endstring oder ,
+ sStrArray[i].GetChar(0) == pFormatter->GetInternational()->GetNumDecimalSep())
+ {
+ eScannedType = NUMBERFORMAT_FRACTION;
+ return TRUE;
+ }
+ }
+ }
+ else
+ { // Analyse des Anfangsstrings
+ if (!ScanStartString( sStrArray[i], pFormat )) // i=0
+ return FALSE; // schon fehlerhaft
+ i++; // naechstes Symbol, i=1
+ }
+ GetNextNumber(i,j); // i=1,2
+ if (eSetType == NUMBERFORMAT_FRACTION) // Sonderfall Bruch -1 = -1/1
+ {
+ if (nSign && !nNegCheck && // Vorzeichen +, -
+ eScannedType == NUMBERFORMAT_UNDEFINED && // nicht D oder C
+ nDecPos == 0 && // kein Dezimalkomma vorher
+ (i >= nAnzStrings || // kein Endstring oder ,
+ sStrArray[i].GetChar(0) == pFormatter->GetInternational()->GetNumDecimalSep())
+ )
+ {
+ eScannedType = NUMBERFORMAT_FRACTION;
+ return TRUE;
+ }
+ }
+ if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat ))
+ return FALSE;
+ }
+ break;
+ case 2 : // Genau 2 Zahlen in Eingabe
+ { // nAnzStrings >= 3
+ if (!GetNextNumber(i,j)) // i=1,0
+ { // Analyse des Anfangsstrings
+ if (!ScanStartString( sStrArray[i], pFormat ))
+ return FALSE; // schon fehlerhaft
+ i++; // i=1
+ }
+ GetNextNumber(i,j); // i=1,2
+ if (!ScanMidString(sStrArray[i], i))
+ return FALSE;
+ i++; // naechstes Symbol, i=2,3
+ GetNextNumber(i,j); // i=3,4
+ if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat ))
+ return FALSE;
+ if (eSetType == NUMBERFORMAT_FRACTION) // Sonderfall -1.200, als Bruch
+ {
+ if (!nNegCheck && // kein Vorzeichen '('
+ eScannedType == NUMBERFORMAT_UNDEFINED &&
+ (nDecPos == 0 || nDecPos == 3) // kein Dezimalz. oder hinten
+ )
+ {
+ eScannedType = NUMBERFORMAT_FRACTION;
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case 3 : // Genau 3 Zahlen in Eingabe
+ { // nAnzStrings >= 5
+ if (!GetNextNumber(i,j)) // i=1,0
+ { // Analyse des Anfangsstrings
+ if (!ScanStartString( sStrArray[i], pFormat ))
+ return FALSE; // schon fehlerhaft
+ i++; // i=1
+ if (nDecPos == 1) // , am Anfang => Fehler
+ return FALSE;
+ }
+ GetNextNumber(i,j); // i=1,2
+ if (!ScanMidString(sStrArray[i], i))
+ return FALSE;
+ i++; // i=2,3
+ if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E nur am Ende
+ return FALSE;
+ GetNextNumber(i,j); // i=3,4
+ if (!ScanMidString(sStrArray[i], i))
+ 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)// Sonderfall -1.200.100, als Bruch
+ {
+ if (!nNegCheck && // kein Vorzeichen '('
+ eScannedType == NUMBERFORMAT_UNDEFINED &&
+ (nDecPos == 0 || nDecPos == 3) // kein Dezimalz. oder hinten
+ )
+ {
+ eScannedType = NUMBERFORMAT_FRACTION;
+ return TRUE;
+ }
+ }
+ if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos )
+ return FALSE; // #36857# kein echter Bruch
+ }
+ break;
+ default: // Mehr als 3 Zahlen in Eingabe
+ { // nAnzStrings >= 7
+ if (!GetNextNumber(i,j)) // i=1,0
+ { // Analyse des Anfangsstrings
+ if (!ScanStartString( sStrArray[i], pFormat ))
+ return FALSE; // schon fehlerhaft
+ i++; // i=1
+ if (nDecPos == 1) // , am Anfang => Fehler
+ return FALSE;
+ }
+ GetNextNumber(i,j); // i=1,2
+ if (!ScanMidString(sStrArray[i], i))
+ return FALSE;
+ i++; // i=2,3
+ USHORT nThOld = 10; // != 0 oder 1
+ while (nThOld != nThousand && j < nAnzNums-1)
+ // mindestens ein Mal
+ // aber eine Zahl noch lassen
+ { // Abarbeitung Tausenderpkte.
+ nThOld = nThousand;
+ if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E nur am Ende
+ return FALSE;
+ GetNextNumber(i,j);
+ if (i < nAnzStrings && !ScanMidString(sStrArray[i], i))
+ return FALSE;
+ i++;
+ }
+ if (eScannedType == NUMBERFORMAT_DATE || // Abarbeitung langes Datum
+ eScannedType == NUMBERFORMAT_TIME || // lange Uhrzeit
+ eScannedType == NUMBERFORMAT_UNDEFINED) // oder lange Zahl
+ {
+ for (USHORT k = j; k < nAnzNums-1; k++)
+ {
+ if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E nur am Ende
+ return FALSE;
+ GetNextNumber(i,j);
+ if (i < nAnzStrings && !ScanMidString(sStrArray[i], i))
+ return FALSE;
+ i++;
+ }
+ }
+ GetNextNumber(i,j);
+ if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat ))
+ return FALSE;
+ if (eSetType == NUMBERFORMAT_FRACTION)// Sonderfall -1.200.100, als Bruch
+ {
+ if (!nNegCheck && // kein Vorzeichen '('
+ eScannedType == NUMBERFORMAT_UNDEFINED &&
+ (nDecPos == 0 || nDecPos == 3) // kein Dezimalz. oder hinten
+ )
+ {
+ eScannedType = NUMBERFORMAT_FRACTION;
+ return TRUE;
+ }
+ }
+ if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos )
+ return FALSE; // #36857# kein echter Bruch
+ }
+ }
+
+ if (eScannedType == NUMBERFORMAT_UNDEFINED) // alles andere sollte bereits
+ eScannedType = NUMBERFORMAT_NUMBER; // erkannt sein
+
+ return TRUE;
+}
+
+
+//---------------------------------------------------------------------------
+// Die 12 Monate und 7 Wochentage initialisieren
+
+void ImpSvNumberInputScan::InitText()
+{
+ int j;
+ const International* pIntl = pFormatter->GetInternational();
+ const CharClass* pChrCls = pFormatter->GetCharClass();
+ for ( j=0; j<12; j++ )
+ {
+ aUpperMonthText[j] = pChrCls->upper( pIntl->GetMonthText(j+1) );
+ aUpperAbbrevMonthText[j] = pChrCls->upper( pIntl->GetAbbrevMonthText(j+1) );
+ }
+ for ( j=0; j<7; j++ )
+ {
+ aUpperDayText[j] = pChrCls->upper( pIntl->GetDayText( (DayOfWeek) j ) );
+ aUpperAbbrevDayText[j] = pChrCls->upper( pIntl->GetAbbrevDayText( (DayOfWeek) j ) );
+ }
+ aUpperCurrSymbol = pChrCls->upper( pIntl->GetCurrSymbol() );
+ bTextInitialized = TRUE;
+}
+
+
+//===========================================================================
+// P U B L I C
+
+//---------------------------------------------------------------------------
+// ChangeIntl
+//
+// MUST be called if International/Locale is changed
+
+void ImpSvNumberInputScan::ChangeIntl()
+{
+ xub_Unicode cDecSep = pFormatter->GetInternational()->GetNumDecimalSep();
+ bDecSepInDateSeps = ( cDecSep == '-' ||
+ cDecSep == '/' ||
+ cDecSep == '.' ||
+ cDecSep == pFormatter->GetInternational()->GetDateSep());
+ bTextInitialized = FALSE;
+}
+
+
+//---------------------------------------------------------------------------
+// ChangeNullDate
+
+void ImpSvNumberInputScan::ChangeNullDate(
+ const USHORT nDay,
+ const USHORT nMonth,
+ const USHORT nYear )
+{
+ delete pNullDate;
+ pNullDate = new Date(nDay, nMonth, nYear);
+}
+
+
+//---------------------------------------------------------------------------
+// IsNumberFormat
+//
+// => String als Zahl darstellbar
+
+BOOL ImpSvNumberInputScan::IsNumberFormat(
+ const XubString& rString, // zu analysierender String
+ short& F_Type, // IN: alter Typ, OUT: neuer Typ
+ double& fOutNumber, // OUT: Zahl, wenn Umwandlung moeglich
+ const SvNumberformat* pFormat ) // evtl. gesetztes Zahlenformat
+{
+ // in den zerlegten Strings gibt es keine Null-Laengen Strings mehr!
+
+ XubString sResString; // die Eingabe fuer atof
+ BOOL res; // Rueckgabewert
+ eSetType = F_Type; // Typ der Zelle
+
+ if ( !rString.Len() )
+ res = FALSE;
+ else if (rString.Len() > 308) // frueher 100
+ res = FALSE;
+ else
+ res = IsNumberFormatMain(rString, fOutNumber, pFormat);
+
+ if (res)
+ {
+ if ( nNegCheck // ')' nicht gefunden
+ || (eScannedType == NUMBERFORMAT_TIME // Zeit mit Vorzeichen
+ && nSign) )
+ res = FALSE;
+ else // Check der Zahlanzahlen
+ {
+ switch (eScannedType) // Analyseergebnis pruefen
+ {
+ case NUMBERFORMAT_PERCENT: // alle Zahlen
+ case NUMBERFORMAT_CURRENCY:
+ case NUMBERFORMAT_NUMBER:
+ if (nDecPos == 1) // ,05
+ {
+ if (nAnzNums != 1)
+ res = FALSE;
+ }
+ else if (nDecPos == 2) // 1,05
+ {
+ if (nAnzNums != nThousand+2)
+ res = FALSE;
+ }
+ else // 1.100 oder 1.100,
+ {
+ if (nAnzNums != nThousand+1)
+ res = FALSE;
+ }
+ break;
+
+ case NUMBERFORMAT_SCIENTIFIC: // wissenschaftl. Format 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 oder 1.100,
+ {
+ if (nAnzNums != nThousand+2)
+ res = FALSE;
+ }
+ break;
+
+ case NUMBERFORMAT_DATE: // Datum
+ if (nMonth)
+ {
+ if (nAnzNums > 2)
+ res = FALSE;
+ }
+ else
+ {
+ if (nAnzNums > 3)
+ res = FALSE;
+ }
+ break;
+
+ case NUMBERFORMAT_TIME: // Uhrzeit
+ if (nDecPos)
+ {
+ if (nAnzNums > 4)
+ res = FALSE;
+ }
+ else
+ {
+ if (nAnzNums > 3)
+ res = FALSE;
+ }
+ break;
+
+ case NUMBERFORMAT_DATETIME: // Datum + Uhrzeit
+ if (nMonth)
+ {
+ if (nAnzNums > 5)
+ res = FALSE;
+ }
+ else
+ {
+ if (nAnzNums > 6)
+ res = FALSE;
+ }
+ break;
+
+ default:
+ break;
+ } // switch
+ } // else
+ } // if (res)
+
+ if (res) // Bestimmung der Zahl:
+ {
+ switch (eScannedType)
+ {
+ case NUMBERFORMAT_LOGICAL: // Logisch
+ if (nLogical == 1)
+ fOutNumber = 1.0; // True
+ else if (nLogical == -1)
+ fOutNumber = 0.0; // False
+ else
+ res = FALSE; // Oops
+ break;
+
+ case NUMBERFORMAT_PERCENT: // Zahlen
+ case NUMBERFORMAT_CURRENCY:
+ case NUMBERFORMAT_NUMBER:
+ case NUMBERFORMAT_SCIENTIFIC: // erstmal Zahlanteil
+ if (nDecPos == 1) // , am Anfang
+ {
+ sResString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0." ) );
+ sResString += sStrArray[nNums[0]];
+ }
+ else
+ { USHORT k;
+ sResString = sStrArray[nNums[0]];
+ for ( k = 1; k <= nThousand; k++)
+ sResString += sStrArray[nNums[k]]; // Vorkommateil
+ if (nDecPos == 2) // in der Mitte
+ {
+ sResString += '.';
+ sResString += sStrArray[nNums[k]];
+ }
+ }
+
+ if (eScannedType != NUMBERFORMAT_SCIENTIFIC)
+ fOutNumber = StringToDouble(sResString);
+ else // Nachbehandlung Exponent
+ {
+ USHORT i;
+ double fExp;
+
+ if (nDecPos == 2)
+ fExp = StringToDouble(sStrArray[nNums[nThousand+2]]);
+ else
+ fExp = StringToDouble(sStrArray[nNums[nThousand+1]]);
+ if (fExp > 308.0)
+ {
+ F_Type = NUMBERFORMAT_TEXT; // Ueberlauf -> Text
+ if (nESign == -1)
+ fOutNumber = 0.0;
+ else
+ fOutNumber = DBL_MAX;
+/*!*/ return TRUE;
+ }
+ else
+ {
+ fOutNumber = StringToDouble(sResString);
+ if (nESign == -1)
+ {
+#ifdef S390
+ // S390 DBL_MIN = 5.397605347e-79
+ if (fExp == 79.0 && fOutNumber < 5.397605348)
+#else
+ if (fExp == 308.0 && fOutNumber < DBL_MIN*1.0E308)
+#endif
+ {
+ eScannedType = NUMBERFORMAT_TEXT; // Ueberlauf -> Text
+ fOutNumber = 0.0;
+ }
+ else
+ for (i=0; i < (USHORT) fExp; i++)
+ fOutNumber /= 10.0;
+ }
+ else
+ {
+#ifdef S390
+ if (fExp == 75.0 && fOutNumber > DBL_MAX/1.0E75)
+#else
+ if (fExp == 308.0 && fOutNumber > DBL_MAX/1.0E308)
+#endif
+ {
+ fOutNumber = DBL_MAX;
+ eScannedType = NUMBERFORMAT_TEXT; // Ueberlauf -> Text
+ }
+ else
+ for (i=0; i < (USHORT) fExp; i++)
+ fOutNumber *= 10.0;
+ }
+ }
+ }
+
+ if ( nStringScanSign )
+ {
+ if ( nSign )
+ nSign *= nStringScanSign;
+ else
+ nSign = nStringScanSign;
+ }
+ if ( nSign < 0 ) // Vorzeichen dazu
+ fOutNumber = -fOutNumber;
+
+ if (eScannedType == NUMBERFORMAT_PERCENT) // durch 100 dividieren
+ fOutNumber/= 100.0;
+ break;
+
+ case NUMBERFORMAT_FRACTION: // Bruch
+ if (nAnzNums == 1)
+ fOutNumber = StringToDouble(sStrArray[nNums[0]]);
+ else if (nAnzNums == 2)
+ {
+ if (nThousand == 1)
+ {
+ sResString = sStrArray[nNums[0]];
+ sResString += sStrArray[nNums[1]]; // Vorkommateil
+ 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 ) // Vorzeichen dazu
+ fOutNumber = -fOutNumber;
+ break;
+
+ case NUMBERFORMAT_TIME: // Uhrzeit
+ GetTimeRef(fOutNumber, 0, nAnzNums);
+ break;
+
+ case NUMBERFORMAT_DATE: // Datum
+ {
+ Date aDt; // heute
+ USHORT nCounter = 0; // hier dummy
+ res = GetDateRef(aDt, nCounter, pFormat); // Datum->aDt
+ if (aDt.IsValid())
+ {
+ long nDate = (long) (aDt - *pNullDate); // erst nach long!!
+ fOutNumber = (double) nDate; // vorsichtshalber
+ }
+ else
+ res = FALSE;
+ }
+ break;
+
+ case NUMBERFORMAT_DATETIME: // Datum mit Uhrzeit
+ {
+ Date aDt; // heute
+ USHORT nCounter; // hier wichtig
+ res = GetDateRef(aDt, nCounter, pFormat); // Datum->aDt
+ double fTime;
+ GetTimeRef(fTime, nCounter, nAnzNums-nCounter);
+ if (aDt.IsValid())
+ {
+ long nDate = (long) (aDt - *pNullDate);
+ fOutNumber = (double) nDate + fTime;
+ }
+ else
+ res = FALSE;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (res) // Ueberlauf -> 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
new file mode 100644
index 000000000000..262a5572dde2
--- /dev/null
+++ b/svtools/source/numbers/zforlist.cxx
@@ -0,0 +1,3657 @@
+/*************************************************************************
+ *
+ * $RCSfile: zforlist.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <math.h>
+
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _INTN_HXX //autogen
+#include <tools/intn.hxx>
+#endif
+#ifndef _SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+#ifndef _SYSTEM_HXX //autogen
+#include <vcl/system.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX //autogen
+#include <vcl/settings.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
+
+#define _SVSTDARR_USHORTS
+#include "svstdarr.hxx"
+
+#define _ZFORLIST_CXX
+#include "zforlist.hxx"
+#undef _ZFORLIST_CXX
+
+#include "zforscan.hxx"
+#include "zforfind.hxx"
+#include "zformat.hxx"
+#include "numhead.hxx"
+
+
+ // Konstanten fuer Typoffsets pro Land/Sprache (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
+
+// Sprache, die am International gesetzt wird, wenn eine unbekannte Sprache
+// (von einem anderen System) geladen wird. Darf nicht SYSTEM sein, weil
+// "DM" aus deutschen Einstellungen sonst als Datum erkannt wird (#53155#).
+
+#define UNKNOWN_SUBSTITUTE LANGUAGE_ENGLISH_US
+
+static BOOL bIndexTableInitialized = FALSE;
+static ULONG __FAR_DATA theIndexTable[NF_INDEX_TABLE_ENTRIES];
+
+BOOL SvNumberFormatter::bCurrencyTableInitialized = FALSE;
+NfCurrencyTable SvNumberFormatter::theCurrencyTable;
+USHORT SvNumberFormatter::nSystemCurrencyPosition = 0;
+SV_IMPL_PTRARR( NfCurrencyTable, NfCurrencyEntry* );
+const USHORT nCurrencyTableEuroPosition = 1;
+SV_IMPL_PTRARR( NfWSStringsDtor, XubString* );
+
+// ob das BankSymbol immer am Ende ist (1 $;-1 $) oder sprachabhaengig
+#define NF_BANKSYMBOL_FIX_POSITION 1
+
+/***********************Funktionen SvNumberFormatter**************************/
+
+SvNumberFormatter::SvNumberFormatter(LanguageType eLnge)
+{
+//! if (eLnge == LANGUAGE_SYSTEM) // Sprache Systemn uebersteuern
+//! eLnge = System::GetLanguage();
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = LANGUAGE_ENGLISH_US;
+ SysLnge = eLnge;
+ ActLnge = eLnge;
+ eEvalDateFormat = NF_EVALDATEFORMAT_INTL;
+ nDefaultCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ if ( !International::IsFormatAvailable( eLnge ) )
+ eLnge = UNKNOWN_SUBSTITUTE;
+ pIntl = new International( eLnge );
+ String aLanguage, aCountry, aVariant;
+ ConvertLanguageToIsoNames( International::GetRealLanguage( eLnge ), aLanguage, aCountry );
+ pCharClass = new CharClass( ::com::sun::star::lang::Locale( aLanguage, aCountry, aVariant ) );
+ pStringScanner = new ImpSvNumberInputScan( this );
+ pFormatScanner = new ImpSvNumberformatScan( this );
+ pFormatTable = NULL;
+ ImpGenerateFormats(0); // 0 .. 999 fuer SystemEinst.
+ MaxCLOffset = 0;
+ pMergeTable = new SvULONGTable;
+ bNoZero = FALSE;
+ pColorLink = NULL;
+}
+
+SvNumberFormatter::~SvNumberFormatter()
+{
+ SvNumberformat* pEntry = aFTable.First();
+ while (pEntry)
+ {
+ delete pEntry;
+ pEntry = aFTable.Next();
+ }
+ delete pCharClass;
+ delete pIntl;
+ delete pStringScanner;
+ delete pFormatScanner;
+ ClearMergeTable();
+ delete pMergeTable;
+}
+
+Color* SvNumberFormatter::GetUserDefColor(USHORT nIndex)
+{
+ if( pColorLink && pColorLink->IsSet() )
+ return (Color*) ( pColorLink->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)
+{
+//! if (eLnge == LANGUAGE_SYSTEM) // Sprache Systemn uebersteuern
+//! eLnge = System::GetLanguage();
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = LANGUAGE_ENGLISH_US;
+ if (eLnge != SysLnge)
+ {
+ SysLnge = eLnge;
+ ChangeIntl(eLnge);
+ SvNumberformat* pEntry = aFTable.First();
+ while (pEntry) // alte Formate loeschen
+ {
+ pEntry = (SvNumberformat*) aFTable.Remove(aFTable.GetCurKey());
+ delete pEntry;
+ pEntry = (SvNumberformat*) aFTable.First();
+ }
+ ImpGenerateFormats(0); // wieder neue Standardformate
+ }
+}
+
+void SvNumberFormatter::ChangeIntl(LanguageType eLnge)
+{
+//! if (eLnge == LANGUAGE_SYSTEM) // Sprache Systemn uebersteuern
+//! eLnge = System::GetLanguage();
+ if (ActLnge != eLnge)
+ {
+ delete pIntl;
+ ActLnge = eLnge;
+ if ( !International::IsFormatAvailable( eLnge ) )
+ eLnge = UNKNOWN_SUBSTITUTE;
+ pIntl = new International( eLnge );
+
+ String aLanguage, aCountry, aVariant;
+ ConvertLanguageToIsoNames( International::GetRealLanguage( eLnge ), aLanguage, aCountry );
+ pCharClass->setLocale( ::com::sun::star::lang::Locale( aLanguage, aCountry, aVariant ) );
+
+ pFormatScanner->ChangeIntl();
+ pStringScanner->ChangeIntl();
+ }
+}
+
+BOOL SvNumberFormatter::IsTextFormat(ULONG F_Index) const
+{
+ SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
+ if (!pFormat)
+ return FALSE;
+ else
+ return pFormat->IsTextFormat();
+}
+
+BOOL SvNumberFormatter::HasTextFormat(ULONG F_Index) const
+{
+ SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
+ if (!pFormat)
+ return FALSE;
+ else
+ return pFormat->HasTextFormat();
+}
+
+BOOL SvNumberFormatter::PutEntry(XubString& rString,
+ xub_StrLen& nCheckPos,
+ short& nType,
+ ULONG& nKey, // Formatnummer
+ LanguageType eLnge)
+{
+ nKey = 0;
+ if (rString.Len() == 0) // keinen Leerstring
+ {
+ nCheckPos = 1; // -> Fehler
+ return FALSE;
+ }
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+
+ 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;
+ }
+ ULONG 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
+ {
+ bCheck = TRUE;
+ SvNumberformat* pStdFormat =
+ (SvNumberformat*) aFTable.Get(CLOffset + ZF_STANDARD);
+ ULONG nPos = CLOffset + pStdFormat->GetLastInsertKey();
+// ULONG nPos = ImpGetLastCLEntryKey(CLOffset, eLge);
+ if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
+ {
+#ifndef DOS
+ Sound::Beep();
+#endif
+ DBG_ERROR("SvNumberFormatter:: Zu viele Formate pro CL");
+ delete p_Entry;
+ }
+ else if (!aFTable.Insert(nPos+1,p_Entry))
+ delete p_Entry;
+ else
+ {
+ nKey = nPos+1;
+ pStdFormat->SetLastInsertKey((USHORT) (nKey-CLOffset));
+ }
+ }
+ }
+ else
+ delete p_Entry;
+ return bCheck;
+}
+
+BOOL SvNumberFormatter::PutandConvertEntry(XubString& rString,
+ xub_StrLen& nCheckPos,
+ short& nType,
+ ULONG& nKey,
+ LanguageType eLnge,
+ LanguageType eNewLnge)
+{
+ BOOL bRes;
+//! if (eNewLnge == LANGUAGE_SYSTEM) // Sprache Systemn uebersteuern
+//! eNewLnge = System::GetLanguage();
+ if (eNewLnge == LANGUAGE_DONTKNOW)
+ eNewLnge = LANGUAGE_ENGLISH_US;
+
+ pFormatScanner->SetConvertMode(eLnge, eNewLnge);
+ bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge);
+ pFormatScanner->SetConvertMode(FALSE);
+ return bRes;
+}
+
+void SvNumberFormatter::DeleteEntry(ULONG 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(ULONG nFIndex)
+{
+ SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
+ if (pFormat)
+ pFormat->SetUsed(TRUE);
+}
+
+BOOL SvNumberFormatter::Load( SvStream& rStream )
+{
+ LanguageType eSysLang = System::GetLanguage();
+ SvNumberFormatter* pConverter = NULL;
+
+ ImpSvNumMultipleReadHeader aHdr( rStream );
+ USHORT nVersion;
+ rStream >> nVersion;
+ SvNumberformat* pEntry;
+ ULONG 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);
+
+ rStream >> nPos;
+ while (nPos != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ rStream >> eDummy >> eLge;
+ eLnge = (LanguageType) eLge;
+ ImpGenerateCL(eLnge); // ggfs. neue Standardformate anlegen
+
+ ULONG 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( 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;
+ }
+
+ }
+ 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( 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( 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;
+ 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) System::GetLanguage() << (USHORT) SysLnge;
+ 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 << 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() );
+
+ ULONG nOffset = 0;
+ while (nOffset <= MaxCLOffset)
+ {
+ SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nOffset);
+ if (pFormat)
+ rList.Insert( pFormat->GetLanguage(), rList.Count() );
+ nOffset += SV_COUNTRY_LANGUAGE_OFFSET;
+ }
+}
+
+XubString SvNumberFormatter::GetKeyword( LanguageType eLnge, USHORT nIndex )
+{
+ ChangeIntl(eLnge);
+ const String* pTable = pFormatScanner->GetKeyword();
+ if ( pTable && nIndex < NF_KEYWORD_ENTRIES_COUNT )
+ return pTable[nIndex];
+
+ DBG_ERROR("GetKeyword: invalid index");
+ return XubString();
+}
+
+ULONG SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const
+{
+ SvNumberformat* pFormat;
+ ULONG nOffset = 0;
+ while (nOffset <= MaxCLOffset)
+ {
+ pFormat = (SvNumberformat*) aFTable.Get(nOffset);
+ if (pFormat && pFormat->GetLanguage() == eLnge)
+ return nOffset;
+ nOffset += SV_COUNTRY_LANGUAGE_OFFSET;
+ }
+ return nOffset;
+}
+
+ULONG SvNumberFormatter::ImpIsEntry(const XubString& rString,
+ ULONG nCLOffset,
+ LanguageType eLnge)
+{
+#ifndef NF_COMMENT_IN_FORMATSTRING
+#error NF_COMMENT_IN_FORMATSTRING not defined (zformat.hxx)
+#endif
+#if NF_COMMENT_IN_FORMATSTRING
+ XubString aStr( rString );
+ SvNumberformat::EraseComment( aStr );
+#endif
+ ULONG 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() )
+ {
+ XubString 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;
+}
+
+/*
+ULONG SvNumberFormatter::ImpGetLastCLEntryKey(ULONG nCLOffset,
+ LanguageType eLnge)
+{
+ // Diese Funktion ist ueberfluesssig geworden 3.3.95
+ ULONG res = 0;
+ SvNumberformat* pEntry;
+ pEntry = (SvNumberformat*) aFTable.Seek(nCLOffset);
+ while (pEntry && pEntry->GetLanguage() == eLnge)
+ {
+ res = aFTable.GetCurKey();
+ pEntry = (SvNumberformat*) aFTable.Next();
+ }
+ if (res < nCLOffset + SV_MAX_ANZ_STANDARD_FORMATE) // nie bei den Standard-
+ res = nCLOffset + SV_MAX_ANZ_STANDARD_FORMATE; // formaten
+ return res;
+}
+*/
+
+SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable(
+ short& eType,
+ ULONG& FIndex,
+ LanguageType& rLnge)
+{
+ short eTypetmp = eType;
+ if (eType == NUMBERFORMAT_ALL) // Leere Zelle oder don't care
+ rLnge = SysLnge;
+ else
+ {
+ SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(FIndex);
+ if (!pFormat)
+ {
+// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (1)");
+ rLnge = SysLnge;
+ 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);
+}
+
+ULONG SvNumberFormatter::ImpGenerateCL(LanguageType eLnge)
+{
+ ChangeIntl(eLnge);
+ ULONG CLOffset = ImpGetCLOffset(ActLnge);
+ if (CLOffset > MaxCLOffset) // CL noch nicht da
+ {
+ MaxCLOffset += SV_COUNTRY_LANGUAGE_OFFSET;
+ ImpGenerateFormats(MaxCLOffset);
+ CLOffset = MaxCLOffset;
+ }
+ return CLOffset;
+}
+
+SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType,
+ ULONG& FIndex,
+ LanguageType eLnge)
+{
+ ImpGenerateCL(eLnge);
+ return GetEntryTable(eType, FIndex, ActLnge);
+}
+
+SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
+ short eType,
+ ULONG& FIndex,
+ LanguageType eLnge)
+{
+ delete pFormatTable;
+ pFormatTable = new SvNumberFormatTable; // neuer Table
+ ChangeIntl(eLnge);
+ ULONG CLOffset = ImpGetCLOffset(ActLnge);
+ SvNumberformat* pEntry;
+ pEntry = (SvNumberformat*) aFTable.Seek(CLOffset);
+
+ if (eType == NUMBERFORMAT_ALL)
+ {
+ while (pEntry && pEntry->GetLanguage() == ActLnge)
+ {
+ pFormatTable->Insert(aFTable.GetCurKey(),pEntry); // einhaengen
+ pEntry = (SvNumberformat*) aFTable.Next();
+ }
+ }
+ else
+ {
+ while (pEntry && pEntry->GetLanguage() == ActLnge)
+ {
+ if ((pEntry->GetType()) & eType) // von diesem Typ
+ pFormatTable->Insert(aFTable.GetCurKey(),pEntry);// einhaengen
+ pEntry = (SvNumberformat*) aFTable.Next();
+ }
+ }
+ pEntry = aFTable.Get(FIndex);
+ if (!pEntry || !(pEntry->GetType() & eType) // irgendeine Veraenderung
+ || pEntry->GetLanguage() != ActLnge ) // => StandardForm.
+ if (pFormatTable->Count() > 0) // aber nicht leer
+ FIndex = GetStandardFormat(eType, ActLnge);
+ return *pFormatTable;
+}
+
+BOOL SvNumberFormatter::IsNumberFormat(const XubString& sString,
+ ULONG& F_Index,
+ double& fOutNumber)
+{
+ short FType;
+ const SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
+ if (!pFormat)
+ {
+// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (2)");
+ ChangeIntl(SysLnge);
+ 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;
+ }
+}
+
+ULONG SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge )
+{
+ ULONG CLOffset = ImpGenerateCL(eLnge);
+ switch(eType)
+ {
+ case NUMBERFORMAT_DATE : return CLOffset + ZF_STANDARD_DATE;
+ case NUMBERFORMAT_TIME : return CLOffset + ZF_STANDARD_TIME+1;
+ case NUMBERFORMAT_DATETIME : return CLOffset + ZF_STANDARD_DATETIME;
+ case NUMBERFORMAT_CURRENCY :
+ {
+ if ( eLnge == LANGUAGE_SYSTEM )
+ return ImpGetDefaultSystemCurrencyFormat();
+ else
+ return CLOffset + ZF_STANDARD_CURRENCY+3;
+ }
+ case NUMBERFORMAT_PERCENT : return CLOffset + ZF_STANDARD_PERCENT+1;
+ case NUMBERFORMAT_SCIENTIFIC: return CLOffset + ZF_STANDARD_SCIENTIFIC;
+ 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( ULONG nFIndex,
+ LanguageType eLnge )
+{
+ return
+ nFIndex == GetFormatIndex( NF_TIME_MMSS00, eLnge ) ||
+ nFIndex == GetFormatIndex( NF_TIME_HH_MMSS00, eLnge ) ||
+ nFIndex == GetFormatIndex( NF_TIME_HH_MMSS, eLnge )
+ ;
+}
+
+ULONG SvNumberFormatter::GetStandardFormat( ULONG nFIndex, short eType,
+ LanguageType eLnge )
+{
+ if ( IsSpecialStandardFormat( nFIndex, eLnge ) )
+ return nFIndex;
+ else
+ return GetStandardFormat( eType, eLnge );
+}
+
+ULONG SvNumberFormatter::GetStandardFormat( double fNumber, ULONG 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 );
+ }
+ }
+ break;
+ default:
+ return GetStandardFormat( eType, eLnge );
+ }
+}
+
+void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
+ ULONG nFIndex,
+ XubString& 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
+ }
+ ULONG 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,
+ ULONG nFIndex,
+ XubString& 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(XubString& sString,
+ ULONG nFIndex,
+ XubString& 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 XubString& sFormatString,
+ double fPreviewNumber,
+ XubString& sOutString,
+ Color** ppColor,
+ LanguageType eLnge)
+{
+ if (sFormatString.Len() == 0) // keinen Leerstring
+ return FALSE;
+
+ xub_StrLen nCheckPos;
+ ULONG nKey;
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+ ChangeIntl(eLnge); // ggfs. austauschen
+ eLnge = ActLnge;
+ XubString sTmpString = sFormatString;
+ SvNumberformat* p_Entry = new SvNumberformat(sTmpString,
+ pFormatScanner,
+ pStringScanner,
+ nCheckPos,
+ eLnge);
+ if (nCheckPos == 0) // String ok
+ {
+ ULONG 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 XubString& sFormatString,
+ double fPreviewNumber,
+ XubString& sOutString,
+ Color** ppColor,
+ LanguageType eLnge )
+{
+ if (sFormatString.Len() == 0) // keinen Leerstring
+ return FALSE;
+
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+
+ ChangeIntl( eLnge );
+ eLnge = ActLnge;
+ BOOL bEnglish = (eLnge == LANGUAGE_ENGLISH_US);
+
+ String aFormatStringUpper( pCharClass->upper( sFormatString ) );
+ ULONG nCLOffset = ImpGenerateCL( eLnge );
+ ULONG 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;
+ XubString 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 || pIntl->CompareEqual( sFormatString,
+ pEntry->GetFormatstring(), INTN_COMPARE_IGNORECASE ) )
+ { // other Format
+ delete pEntry;
+ sTmpString = sFormatString;
+ pEntry = new SvNumberformat( sTmpString, pFormatScanner,
+ pStringScanner, nCheckPos, eLnge );
+ }
+ else
+ { // verify english
+ xub_StrLen nCheckPos2;
+ // 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 && !pIntl->CompareEqual( sFormatString,
+ pEntry2->GetFormatstring(), INTN_COMPARE_IGNORECASE ) )
+ { // 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;
+}
+
+ULONG SvNumberFormatter::TestNewString(const XubString& sFormatString,
+ LanguageType eLnge)
+{
+ if (sFormatString.Len() == 0) // keinen Leerstring
+ return NUMBERFORMAT_ENTRY_NOT_FOUND;
+
+ xub_StrLen nCheckPos;
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+ ChangeIntl(eLnge); // ggfs. austauschen
+ eLnge = ActLnge;
+ ULONG nRes;
+ BOOL bCheck = FALSE;
+ XubString sTmpString = sFormatString;
+ SvNumberformat* pEntry = new SvNumberformat(sTmpString,
+ pFormatScanner,
+ pStringScanner,
+ nCheckPos,
+ eLnge);
+ if (nCheckPos == 0) // String ok
+ {
+ ULONG 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(XubString& sStr,
+ BOOL bStandard,
+ ULONG nPos)
+{
+ xub_StrLen nCheckPos = 0;
+ SvNumberformat* pFormat = new SvNumberformat(sStr,
+ pFormatScanner,
+ pStringScanner,
+ nCheckPos,
+ ActLnge);
+ if (!pFormat || nCheckPos > 0)
+ {
+ DBG_ERROR
+ ("SvNumberFormatter:: Unbekanntes oder falsches Zahlformat");
+ delete pFormat;
+ return NULL;;
+ }
+ if (bStandard)
+ pFormat->SetStandard();
+ if (!aFTable.Insert(nPos, pFormat))
+ {
+ delete pFormat;
+ return NULL;
+ }
+ return pFormat;
+}
+
+SvNumberformat* SvNumberFormatter::ImpInsertNewStandardFormat( XubString& sStr,
+ ULONG nPos, USHORT nVersion )
+{
+ SvNumberformat* pNewFormat = ImpInsertFormat( sStr, FALSE, nPos );
+ if (pNewFormat)
+ pNewFormat->SetNewStandardDefined( nVersion );
+ // damit es gespeichert, richtig angezeigt und von alten Versionen konvertiert wird
+#ifndef PRODUCT
+ else
+ {
+ ByteString aErr( "New standard format not inserted: " );
+ aErr += ByteString( sStr, RTL_TEXTENCODING_UTF8 );
+ DBG_ERRORFILE( aErr.GetBuffer() );
+ }
+#endif
+ return pNewFormat;
+}
+
+void SvNumberFormatter::GetFormatSpecialInfo(ULONG nFormat,
+ BOOL& bThousand,
+ BOOL& IsRed,
+ USHORT& nPrecision,
+ USHORT& nAnzLeading)
+
+{
+ 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( ULONG nFormat ) const
+{
+ SvNumberformat* pFormat = aFTable.Get( nFormat );
+ if ( pFormat )
+ return pFormat->GetFormatPrecision();
+ else
+ return pFormatScanner->GetStandardPrec();
+}
+
+
+ULONG SvNumberFormatter::GetFormatSpecialInfo( const XubString& rFormatString,
+ BOOL& bThousand, BOOL& IsRed, USHORT& nPrecision,
+ USHORT& nAnzLeading, LanguageType eLnge )
+
+{
+ xub_StrLen nCheckPos = 0;
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+ ChangeIntl(eLnge); // ggfs. austauschen
+ eLnge = ActLnge;
+ XubString 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 ULONG SetIndexTable( NfIndexTableOffset nTabOff, ULONG nIndOff )
+{
+ if ( !bIndexTableInitialized )
+ {
+ DBG_ASSERT( theIndexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND,
+ "SetIndexTable: theIndexTable[nTabOff] bereits belegt" );
+ theIndexTable[nTabOff] = nIndOff;
+ }
+ return nIndOff;
+}
+
+
+void SvNumberFormatter::ImpGenerateFormats(ULONG CLOffset)
+{
+ if ( !bIndexTableInitialized )
+ {
+ for ( USHORT j=0; j<NF_INDEX_TABLE_ENTRIES; j++ )
+ {
+ theIndexTable[j] = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ }
+ }
+ BOOL bOldConvertMode = pFormatScanner->GetConvertMode();
+ if (bOldConvertMode) // fuer diese Funktion
+ pFormatScanner->SetConvertMode(FALSE); // ausschalten
+ xub_StrLen nCheckPos = 0; // Eintrag fuer Standard, Text
+ // und logisch direkt erzeugen
+ SvNumberformat* pNewFormat = NULL;
+ XubString aSystem( RTL_CONSTASCII_USTRINGPARAM( "System" ) ); // Kommentar
+ XubString aDefSystem( RTL_CONSTASCII_USTRINGPARAM( "def/System" ) ); // Kommentar
+ // Zaehler fuer zusaetzliche Standardformate, die nicht in die ersten 10
+ // einer Kategorie passen, insgesamt nochmal ca. 20
+ // Bei jedem ImpInsertNewStandardformat hochzaehlen, neue Formate
+ // hinten anhaengen, nicht einfuegen!
+ USHORT nNewExtended = ZF_STANDARD_NEWEXTENDED;
+
+ SvNumberformat* pStandard = new SvNumberformat(
+ pFormatScanner->GetStandardName(),
+ pFormatScanner, pStringScanner,
+ nCheckPos, ActLnge);
+ pStandard->SetType(NUMBERFORMAT_NUMBER);
+ pStandard->SetStandard();
+ if ( !aFTable.Insert(
+ CLOffset + SetIndexTable( NF_NUMBER_STANDARD, ZF_STANDARD ),
+ pStandard))
+ delete pStandard;
+ else
+ pStandard->SetLastInsertKey(SV_MAX_ANZ_STANDARD_FORMATE);
+ SvNumberformat* pLogical = new SvNumberformat(
+ pFormatScanner->GetBooleanString(),
+ pFormatScanner, pStringScanner,
+ nCheckPos, ActLnge);
+ pLogical->SetType(NUMBERFORMAT_LOGICAL);
+ pLogical->SetStandard();
+ if ( !aFTable.Insert(
+ CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ),
+ pLogical))
+ delete pLogical;
+
+ XubString aWSString = '@';
+ SvNumberformat* pText = new SvNumberformat(aWSString,
+ pFormatScanner, pStringScanner,
+ nCheckPos, ActLnge);
+ pText->SetType(NUMBERFORMAT_TEXT);
+ pText->SetStandard();
+ if ( !aFTable.Insert(
+ CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ),
+ pText))
+ delete pText;
+
+ xub_Unicode cDecSep = pIntl->GetNumDecimalSep();
+ xub_Unicode cThousandSep = pIntl->GetNumThousandSep();
+ // Zahl:
+ XubString s0 = '0'; // 0
+ ImpInsertFormat(s0,FALSE,
+ CLOffset + SetIndexTable( NF_NUMBER_INT, ZF_STANDARD+1 ));
+ XubString s1( RTL_CONSTASCII_USTRINGPARAM( "000" ) ); // 0,00
+ s1.Insert(cDecSep,1);
+ ImpInsertFormat(s1,FALSE,
+ CLOffset + SetIndexTable( NF_NUMBER_DEC2, ZF_STANDARD+2 ));
+ XubString s2( RTL_CONSTASCII_USTRINGPARAM( "###0" ) ); // #.##0
+ s2.Insert(cThousandSep,1);
+ ImpInsertFormat(s2,FALSE,
+ CLOffset + SetIndexTable( NF_NUMBER_1000INT, ZF_STANDARD+3 ));
+ XubString s3( RTL_CONSTASCII_USTRINGPARAM( "###000" ) ); // #.##0,00
+ s3.Insert(cThousandSep,1);
+ s3.Insert(cDecSep,5);
+ ImpInsertFormat(s3,FALSE,
+ CLOffset + SetIndexTable( NF_NUMBER_1000DEC2, ZF_STANDARD+4 ));
+ // ab Version 6
+ XubString sNumSystem; // #.##0,00 System
+ if ( pIntl->IsNumLeadingZero() )
+ sNumSystem = '0';
+ if ( pIntl->IsNumThousandSep() )
+ {
+ if ( pIntl->IsNumLeadingZero() )
+ sNumSystem.Insert( XubString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "###" ) ), 0 );
+ else
+ sNumSystem.Insert( XubString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "####" ) ), 0 );
+ sNumSystem.Insert( cThousandSep, 1 );
+ }
+ USHORT nNumDigits = pIntl->GetNumDigits();
+ if ( nNumDigits )
+ {
+ sNumSystem += cDecSep;
+ for ( USHORT j=0; j<nNumDigits; j++ )
+ {
+ sNumSystem += '0';
+ }
+ }
+ pNewFormat = ImpInsertNewStandardFormat( sNumSystem,
+ CLOffset + SetIndexTable( NF_NUMBER_SYSTEM, ZF_STANDARD+5 ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aSystem );
+
+ // Prozent:
+ XubString s4( RTL_CONSTASCII_USTRINGPARAM( "0%" ) ); // 0%
+ ImpInsertFormat(s4,FALSE,
+ CLOffset + SetIndexTable( NF_PERCENT_INT, ZF_STANDARD_PERCENT ));
+ XubString s5( RTL_CONSTASCII_USTRINGPARAM( "000%" ) ); // 0,00%
+ s5.Insert(cDecSep,1);
+ ImpInsertFormat(s5,TRUE,
+ CLOffset + SetIndexTable( NF_PERCENT_DEC2, ZF_STANDARD_PERCENT+1 ));
+
+ // Waehrung: (keine Standardoption also kein TRUE bei ImpInsertFormat)
+
+ XubString aRed( '[' );
+ aRed += pFormatScanner->GetRedString();
+ aRed += ']';
+
+ XubString sCurrFlat1( RTL_CONSTASCII_USTRINGPARAM( "###0" ) ); // #.##0 DM
+ sCurrFlat1.Insert(cThousandSep,1);
+ XubString sCurrFlat2( sCurrFlat1 ); // #.##0,00 DM
+ XubString sCurrFlat3( sCurrFlat1 ); // #.##0,-- DM
+ // Anzahl Nachkommastellen in Waehrung
+ USHORT nCurrDigits = pIntl->GetCurrDigits();
+ if ( nCurrDigits )
+ {
+ sCurrFlat2 += cDecSep;
+ sCurrFlat3 += cDecSep;
+ sCurrFlat2.Expand( sCurrFlat2.Len() + nCurrDigits, '0' );
+ sCurrFlat3.Expand( sCurrFlat3.Len() + nCurrDigits, '-' );
+ }
+
+ XubString s6 = sCurrFlat1; // #.##0 DM
+ ImpGetPosCurrFormat(s6);
+ XubString s7 = sCurrFlat2; // #.##0,00 DM
+ ImpGetPosCurrFormat(s7);
+ XubString sDash = sCurrFlat3; // #.##0,-- DM
+ ImpGetPosCurrFormat(sDash);
+ XubString sNegStr1 = sCurrFlat1; // -#.##0 DM
+ ImpGetNegCurrFormat(sNegStr1);
+ XubString sNegStr2 = sCurrFlat2; // -#.##0,00 DM
+ ImpGetNegCurrFormat(sNegStr2);
+ XubString sNegStr3 = sCurrFlat3; // -#.##0,-- DM
+ ImpGetNegCurrFormat(sNegStr3);
+ s6 += ';';
+ XubString s8 = s6;
+ s6 += sNegStr1;
+ s8 += aRed;
+ s8 += sNegStr1;
+ s7 += ';';
+ XubString s9 = s7;
+ s7 += sNegStr2;
+ s9 += aRed;
+ s9 += sNegStr2;
+ sDash += ';';
+ XubString sDashed = sDash;
+ sDash += sNegStr3;
+ sDashed += aRed;
+ sDashed += sNegStr3;
+ ImpInsertFormat(s6,FALSE,
+ CLOffset + SetIndexTable( NF_CURRENCY_1000INT, ZF_STANDARD_CURRENCY ));
+ ImpInsertFormat(s7,FALSE,
+ CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2, ZF_STANDARD_CURRENCY+1 ));
+ // Muss immer 1 hinter
+ // Standard sein
+ // fuer Funktion DM()!!
+ ImpInsertFormat(s8,FALSE,
+ CLOffset + SetIndexTable( NF_CURRENCY_1000INT_RED, ZF_STANDARD_CURRENCY+2 ));
+ ImpInsertFormat(s9,FALSE,
+ CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_RED, ZF_STANDARD_CURRENCY+3 ));
+
+ // ab Version 3 dazu
+ XubString s28 = sCurrFlat2; // #.##0,00 DEM
+#if NF_BANKSYMBOL_FIX_POSITION
+ s28.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " CCC" ) );
+#else
+ XubString s28n( sCurrFlat2 ), aCCC( RTL_CONSTASCII_USTRINGPARAM( "CCC" ) );
+ USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
+ pIntl->GetCurrPositiveFormat(), pIntl->GetCurrPositiveFormat(), TRUE );
+ USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
+ pIntl->GetCurrNegativeFormat(), pIntl->GetCurrNegativeFormat(), TRUE );
+ NfCurrencyEntry::CompletePositiveFormatString( s28, aCCC, nPosiForm );
+ NfCurrencyEntry::CompleteNegativeFormatString( s28n, aCCC, nNegaForm );
+ s28 += ';';
+ s28 += s28n;
+#endif
+ pNewFormat = ImpInsertFormat(s28,FALSE,
+ CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_CCC, ZF_STANDARD_CURRENCY+4 ));
+ if ( pNewFormat )
+ pNewFormat->SetUsed(TRUE); // damit es gespeichert wird
+
+ // ab Version 6 dazu: #.##0,-- DM
+ ImpInsertNewStandardFormat( sDashed,
+ CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_DASHED, ZF_STANDARD_CURRENCY+5 ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+
+#if 0 // erDEBUG
+ { // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR EURo und letztes Format testen
+ NfWSStringsDtor aArr;
+ USHORT j, nDefault;
+ const NfCurrencyTable& rTable = GetTheCurrencyTable();
+ const NfCurrencyEntry* pCurr = rTable.GetObject( nCurrencyTableEuroPosition );
+ GetCurrencyFormatStrings( aArr, *pCurr, FALSE );
+ GetCurrencyFormatStrings( aArr, *pCurr, TRUE );
+ for ( j=0; j<aArr.Count(); j++ )
+ {
+ ULONG nCheck, nKey;
+ short nType;
+ PutEntry( *aArr.GetObject(j), nCheck, nType, nKey, ActLnge );
+ }
+ aArr.Remove( 0, aArr.Count() );
+ pCurr = rTable.GetObject( rTable.Count()-1 );
+// GetCurrencyFormatStrings( aArr, *pCurr, FALSE );
+ GetCurrencyFormatStrings( aArr, *pCurr, TRUE );
+ for ( j=0; j<aArr.Count(); j++ )
+ {
+ ULONG nCheck, nKey;
+ short nType;
+ PutEntry( *aArr.GetObject(j), nCheck, nType, nKey, ActLnge );
+ }
+ }
+#endif
+
+ // Datum:
+ XubString s10;
+ ImpGetDateFormat(s10); // TT.MM.JJ kurzes Systemdatum
+ pNewFormat = ImpInsertFormat(s10,TRUE,
+ CLOffset + SetIndexTable( NF_DATE_SYSTEM_SHORT, ZF_STANDARD_DATE ));
+ if ( pNewFormat )
+ pNewFormat->SetComment( aSystem );
+
+ const XubString* pKeyword = pFormatScanner->GetKeyword();
+ xub_Unicode cDateSep = pIntl->GetDateSep();
+ xub_Unicode cTimeSep = pIntl->GetTimeSep();
+
+ XubString s11 = pKeyword[NF_KEY_NN]; // NN TT.MMM JJ
+ s11 += ' ';
+ s11 += pKeyword[NF_KEY_TT];
+ s11 += cDateSep;
+ s11 += pKeyword[NF_KEY_MMM];
+ s11 += ' ';
+ s11 += pKeyword[NF_KEY_JJ];
+ ImpInsertFormat(s11,FALSE,
+ CLOffset + SetIndexTable( NF_DATE_DEF_NNDDMMMYY, ZF_STANDARD_DATE+1 ));
+
+ XubString s12; // MM.JJ
+ XubString s13; // TT.MMM
+ XubString sFullDate; // TT.MM.JJJJ
+ XubString sDDMMYY; // TT.MM.JJ
+ switch(pIntl->GetDateFormat())
+ {
+ case DMY:
+ {
+ s12 = pKeyword[NF_KEY_MM]; // MM.JJ
+ s12 += cDateSep;
+ s12 += pKeyword[NF_KEY_JJ];
+ s13 = pKeyword[NF_KEY_TT]; // TT.MMM
+ s13 += cDateSep;
+ s13 += pKeyword[NF_KEY_MMM];
+ sFullDate = pKeyword[NF_KEY_TT]; // TT
+ sFullDate += cDateSep;
+ sFullDate += pKeyword[NF_KEY_MM]; // MM
+ sFullDate += cDateSep;
+ sDDMMYY = sFullDate;
+ sFullDate += pKeyword[NF_KEY_JJJJ]; // JJJJ
+ sDDMMYY += pKeyword[NF_KEY_JJ]; // JJ
+ }
+ break;
+ case YMD:
+ {
+ s12 = pKeyword[NF_KEY_JJ]; // JJ.MM
+ s12 += cDateSep;
+ s12 += pKeyword[NF_KEY_MM];
+ s13 = pKeyword[NF_KEY_MMM]; // MMM TT
+ s13 += ' ';
+ s13 += pKeyword[NF_KEY_TT];
+ sFullDate = pKeyword[NF_KEY_JJJJ]; // JJJJ
+ sDDMMYY = pKeyword[NF_KEY_JJ]; // JJ
+ XubString aTmp( cDateSep );
+ aTmp += pKeyword[NF_KEY_MM]; // MM
+ aTmp += cDateSep;
+ aTmp += pKeyword[NF_KEY_TT]; // TT
+ sFullDate += aTmp;
+ sDDMMYY += aTmp;
+
+ }
+ break;
+ case MDY:
+ default:
+ {
+ s12 = pKeyword[NF_KEY_MM]; // MM.JJ
+ s12 += cDateSep;
+ s12 += pKeyword[NF_KEY_JJ];
+ s13 = pKeyword[NF_KEY_MMM]; // MMM TT
+ s13 += ' ';
+ s13 += pKeyword[NF_KEY_TT];
+ sFullDate = pKeyword[NF_KEY_MM]; // MM
+ sFullDate += cDateSep;
+ sFullDate += pKeyword[NF_KEY_TT]; // TT
+ sFullDate += cDateSep;
+ sDDMMYY = sFullDate;
+ sFullDate += pKeyword[NF_KEY_JJJJ]; // JJJJ
+ sDDMMYY += pKeyword[NF_KEY_JJ]; // JJ
+ }
+ break;
+ }
+ pNewFormat = ImpInsertFormat(s12,FALSE,
+ CLOffset + SetIndexTable( NF_DATE_SYS_MMYY, ZF_STANDARD_DATE+2 ));
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+
+ ImpInsertFormat(s13,FALSE,
+ CLOffset + SetIndexTable( NF_DATE_SYS_DDMMM, ZF_STANDARD_DATE+3 ));
+
+ XubString s14 = pKeyword[NF_KEY_MMMM]; // MMMM
+ ImpInsertFormat(s14,FALSE,
+ CLOffset + SetIndexTable( NF_DATE_MMMM, ZF_STANDARD_DATE+4 ));
+
+ XubString s15 = pKeyword[NF_KEY_QQ]; // QQ JJ
+ s15 += ' ';
+ s15 += pKeyword[NF_KEY_JJ];
+ ImpInsertFormat(s15,FALSE,
+ CLOffset + SetIndexTable( NF_DATE_QQJJ, ZF_STANDARD_DATE+5 ));
+
+ // ab Version 2 dazu, war TT.MM.[JJ]JJ jetzt (v6) TT.MM.JJJJ
+ pNewFormat = ImpInsertFormat(sFullDate,FALSE,
+ CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYYYY, ZF_STANDARD_DATE+6 ));
+ if ( pNewFormat )
+ {
+ pNewFormat->SetUsed(TRUE); // damit es gespeichert wird
+ pNewFormat->SetComment( aDefSystem );
+ }
+
+ // ab Version 6 dazu
+ pNewFormat = ImpInsertNewStandardFormat( sDDMMYY,
+ CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYY, ZF_STANDARD_DATE+7 ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+ // lange Wochentage: statt "NNN, " steht "NNNN" Code wg. Kompatibilitaet
+ // langes Systemdatum wie eingestellt
+ XubString sLongDate;
+ ImpGetLongDateFormat( sLongDate ); // NNN, T. MMMM JJJJ System
+ pNewFormat = ImpInsertNewStandardFormat( sLongDate,
+ CLOffset + SetIndexTable( NF_DATE_SYSTEM_LONG, ZF_STANDARD_DATE+8 ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aSystem );
+ // harte aber systemabhaengige lange Datumformate
+ sLongDate.Erase();
+ ImpGetLongDateFormat( sLongDate, -1, 1, 1, 1 ); // T. MMM JJ def/System
+ pNewFormat = ImpInsertNewStandardFormat( sLongDate,
+ CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYY, ZF_STANDARD_DATE+9 ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+ //! leider hat das Templin'sche Erbe nur 10 Standardformate pro Kategorie
+ //! vorgesehen, weitere wuerden ZF_STANDARD_TIME ueberschreiben :-((
+ sLongDate.Erase();
+ ImpGetLongDateFormat( sLongDate, -1, 1, 1, 2 ); // T. MMM JJJJ def/System
+ pNewFormat = ImpInsertNewStandardFormat( sLongDate,
+ CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYYYY, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+ sLongDate.Erase();
+ ImpGetLongDateFormat( sLongDate, -1, 1, 2, 2 ); // T. MMMM JJJJ def/System
+ pNewFormat = ImpInsertNewStandardFormat( sLongDate,
+ CLOffset + SetIndexTable( NF_DATE_SYS_DMMMMYYYY, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+ sLongDate.Erase();
+ ImpGetLongDateFormat( sLongDate, 1, 1, 1, 1 ); // NN, T. MMM JJ def/System
+ pNewFormat = ImpInsertNewStandardFormat( sLongDate,
+ CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMYY, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+ sLongDate.Erase();
+ ImpGetLongDateFormat( sLongDate, 1, 1, 2, 2 ); // NN, T. MMMM JJJJ def/System
+ pNewFormat = ImpInsertNewStandardFormat( sLongDate,
+ CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMMYYYY, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+ sLongDate.Erase();
+ ImpGetLongDateFormat( sLongDate, 2, 1, 2, 2 ); // NNN, T. MMMM JJJJ def/System
+ pNewFormat = ImpInsertNewStandardFormat( sLongDate,
+ CLOffset + SetIndexTable( NF_DATE_SYS_NNNNDMMMMYYYY, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDefSystem );
+
+ XubString aDIN( RTL_CONSTASCII_USTRINGPARAM( "DIN 5008 (EN 28601)" ) );
+ XubString sDinTMMMJJJJ; // DIN: T. MMM. JJJJ
+ sDinTMMMJJJJ += pKeyword[NF_KEY_T];
+ sDinTMMMJJJJ += '.';
+ sDinTMMMJJJJ += ' ';
+ sDinTMMMJJJJ += pKeyword[NF_KEY_MMM];
+ sDinTMMMJJJJ += '.';
+ sDinTMMMJJJJ += ' ';
+ sDinTMMMJJJJ += pKeyword[NF_KEY_JJJJ];
+ pNewFormat = ImpInsertNewStandardFormat( sDinTMMMJJJJ,
+ CLOffset + SetIndexTable( NF_DATE_DIN_DMMMYYYY, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDIN );
+
+ XubString sDinTMMMMJJJJ; // DIN: T. MMMM JJJJ
+ sDinTMMMMJJJJ += pKeyword[NF_KEY_T];
+ sDinTMMMMJJJJ += '.';
+ sDinTMMMMJJJJ += ' ';
+ sDinTMMMMJJJJ += pKeyword[NF_KEY_MMMM];
+ sDinTMMMMJJJJ += ' ';
+ sDinTMMMMJJJJ += pKeyword[NF_KEY_JJJJ];
+ pNewFormat = ImpInsertNewStandardFormat( sDinTMMMMJJJJ,
+ CLOffset + SetIndexTable( NF_DATE_DIN_DMMMMYYYY, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDIN );
+
+ XubString sDinMMTT; // DIN: MM-TT
+ sDinMMTT += pKeyword[NF_KEY_MM];
+ sDinMMTT += '-';
+ sDinMMTT += pKeyword[NF_KEY_TT];
+ pNewFormat = ImpInsertNewStandardFormat( sDinMMTT,
+ CLOffset + SetIndexTable( NF_DATE_DIN_MMDD, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDIN );
+
+ XubString sDinJJMMTT = sDinMMTT; // DIN: JJ-MM-TT
+ sDinJJMMTT.Insert( '-', 0 );
+ sDinJJMMTT.Insert( pKeyword[NF_KEY_JJ], 0 );
+ pNewFormat = ImpInsertNewStandardFormat( sDinJJMMTT,
+ CLOffset + SetIndexTable( NF_DATE_DIN_YYMMDD, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDIN );
+
+ XubString sDinJJJJMMTT = sDinMMTT; // DIN: JJJJ-MM-TT
+ sDinJJJJMMTT.Insert( '-', 0 );
+ sDinJJJJMMTT.Insert( pKeyword[NF_KEY_JJJJ], 0 );
+ pNewFormat = ImpInsertNewStandardFormat( sDinJJJJMMTT,
+ CLOffset + SetIndexTable( NF_DATE_DIN_YYYYMMDD, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
+ if ( pNewFormat )
+ pNewFormat->SetComment( aDIN );
+
+ // Uhrzeit:
+ XubString s16 = pKeyword[NF_KEY_HH]; // HH:MM
+ s16 += cTimeSep;
+ s16 += pKeyword[NF_KEY_MMI];
+ ImpInsertFormat(s16,FALSE,
+ CLOffset + SetIndexTable( NF_TIME_HHMM, ZF_STANDARD_TIME ));
+ XubString sFullTime = s16; // HH:MM:SS
+ sFullTime += cTimeSep;
+ sFullTime += pKeyword[NF_KEY_SS];
+ ImpInsertFormat(sFullTime,TRUE,
+ CLOffset + SetIndexTable( NF_TIME_HHMMSS, ZF_STANDARD_TIME+1 ));
+ XubString s18 = s16; // HH:MM AM/PM
+ s18 += ' ';
+ s18 += pKeyword[NF_KEY_AMPM];
+ ImpInsertFormat(s18,FALSE,
+ CLOffset + SetIndexTable( NF_TIME_HHMMAMPM, ZF_STANDARD_TIME+2 ));
+ XubString s19 = sFullTime; // HH:MM:SS AM/PM
+ s19 += ' ';
+ s19 += pKeyword[NF_KEY_AMPM];
+ ImpInsertFormat(s19,FALSE,
+ CLOffset + SetIndexTable( NF_TIME_HHMMSSAMPM, ZF_STANDARD_TIME+3 ));
+ XubString s20 = sFullTime; // [HH]:MM:SS
+ s20.Insert('[',0);
+ s20.Insert(']',3);
+ ImpInsertFormat(s20,FALSE,
+ CLOffset + SetIndexTable( NF_TIME_HH_MMSS, ZF_STANDARD_TIME+4 ));
+ XubString s21 = pKeyword[NF_KEY_MMI]; // MM:SS,00
+ s21 += cTimeSep;
+ s21 += pKeyword[NF_KEY_SS];
+ s21 += cDecSep;
+ s21 += '0';
+ s21 += '0';
+ ImpInsertFormat(s21,FALSE,
+ CLOffset + SetIndexTable( NF_TIME_MMSS00, ZF_STANDARD_TIME+5 ));
+ XubString s29 = s20; // [HH]:MM:SS,00
+ s29 += cDecSep;
+ s29 += '0';
+ s29 += '0';
+ ImpInsertNewStandardFormat( s29,
+ CLOffset + SetIndexTable( NF_TIME_HH_MMSS00, ZF_STANDARD_TIME+6 ),
+ SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 );
+
+ // Datum u. Uhrzeit:
+ XubString s22 = s10; // TT.MM.JJ HH:MM
+ s22 += ' ';
+ s22 += s16;
+ ImpInsertFormat(s22,TRUE,
+ CLOffset + SetIndexTable( NF_DATETIME_SYSTEM_SHORT_HHMM, ZF_STANDARD_DATETIME ));
+ XubString sFullDateTime = sFullDate; // TT.MM.JJJJ HH:MM:SS
+ sFullDateTime += ' ';
+ sFullDateTime += sFullTime;
+ ImpInsertNewStandardFormat( sFullDateTime,
+ CLOffset + SetIndexTable( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, ZF_STANDARD_DATETIME+1 ),
+ SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS );
+
+ // Wissenschaft:
+ XubString s23( RTL_CONSTASCII_USTRINGPARAM( "000E+000" ) ); // 0,00E+000
+ s23.Insert(cDecSep,1);
+ ImpInsertFormat(s23,TRUE,
+ CLOffset + SetIndexTable( NF_SCIENTIFIC_000E000, ZF_STANDARD_SCIENTIFIC ));
+ XubString s24( RTL_CONSTASCII_USTRINGPARAM( "000E+00" ) ); // 0,00E+00
+ s24.Insert(cDecSep,1);
+ ImpInsertFormat(s24,FALSE,
+ CLOffset + SetIndexTable( NF_SCIENTIFIC_000E00, ZF_STANDARD_SCIENTIFIC+1 ));
+
+ // Bruch: (keine Standardopt.)
+ XubString s25( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) ); // # ?/?
+ ImpInsertFormat(s25,FALSE,
+ CLOffset + SetIndexTable( NF_FRACTION_1, ZF_STANDARD_FRACTION ));
+ // "??/" wird vom Compiler als Trigraph fuer '\' interpretiert!
+ XubString s26( RTL_CONSTASCII_USTRINGPARAM( "# ?\?/?\?" ) ); // # ??/??
+ ImpInsertFormat(s26,FALSE,
+ CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 ));
+
+ XubString sWeekOfYear( pKeyword[NF_KEY_WW] );
+ pNewFormat = ImpInsertNewStandardFormat( sWeekOfYear,
+ CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ),
+ SV_NUMBERFORMATTER_VERSION_NF_DATE_WW );
+
+ bIndexTableInitialized = TRUE;
+ if (bOldConvertMode) // jetzt wieder
+ pFormatScanner->SetConvertMode(TRUE); // einschalten
+ DBG_ASSERT( nNewExtended <= ZF_STANDARD_NEWEXTENDEDMAX,
+ "Ueberlauf der nNewExtended Standardformate" );
+}
+
+void SvNumberFormatter::ImpGetDateFormat(XubString& sDateStr)
+{
+ const XubString* pKeyword = pFormatScanner->GetKeyword();
+ xub_Unicode cDateSep = pIntl->GetDateSep();
+ switch (pIntl->GetDateFormat())
+ {
+ case MDY:
+ {
+ if (pIntl->IsDateMonthLeadingZero())
+ sDateStr += pKeyword[NF_KEY_MM];
+ else
+ sDateStr += pKeyword[NF_KEY_M];
+ sDateStr += cDateSep;
+ if (pIntl->IsDateDayLeadingZero())
+ sDateStr += pKeyword[NF_KEY_TT];
+ else
+ sDateStr += pKeyword[NF_KEY_T];
+ sDateStr += cDateSep;
+ if (pIntl->IsDateCentury())
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ else
+ sDateStr += pKeyword[NF_KEY_JJ];
+ }
+ break;
+ case DMY:
+ {
+ if (pIntl->IsDateDayLeadingZero())
+ sDateStr += pKeyword[NF_KEY_TT];
+ else
+ sDateStr += pKeyword[NF_KEY_T];
+ sDateStr += cDateSep;
+ if (pIntl->IsDateMonthLeadingZero())
+ sDateStr += pKeyword[NF_KEY_MM];
+ else
+ sDateStr += pKeyword[NF_KEY_M];
+ sDateStr += cDateSep;
+ if (pIntl->IsDateCentury())
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ else
+ sDateStr += pKeyword[NF_KEY_JJ];
+ }
+ break;
+ case YMD:
+ {
+ if (pIntl->IsDateCentury())
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ else
+ sDateStr += pKeyword[NF_KEY_JJ];
+ sDateStr += cDateSep;
+ if (pIntl->IsDateMonthLeadingZero())
+ sDateStr += pKeyword[NF_KEY_MM];
+ else
+ sDateStr += pKeyword[NF_KEY_M];
+ sDateStr += cDateSep;
+ if (pIntl->IsDateDayLeadingZero())
+ sDateStr += pKeyword[NF_KEY_TT];
+ else
+ sDateStr += pKeyword[NF_KEY_T];
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+void lcl_ImplAddStringMaybeQuoted( String& rDes, const String& rSrc,
+ CharClass* pChrCls )
+{
+ BOOL bQuoted = FALSE;
+ const xub_StrLen nLen = rSrc.Len();
+ xub_StrLen nPos = 0;
+ while ( nPos < nLen )
+ {
+ if ( !bQuoted && pChrCls->isLetter( rSrc, nPos ) )
+ {
+ rDes += '"';
+ bQuoted = TRUE;
+ }
+ else if ( bQuoted && !pChrCls->isLetter( rSrc, nPos ) )
+ {
+ rDes += '"';
+ bQuoted = FALSE;
+ }
+ rDes += rSrc.GetChar( nPos++ );
+ }
+ if ( bQuoted )
+ rDes += '"';
+}
+
+
+void SvNumberFormatter::ImpGetLongDateFormat( XubString& sDateStr,
+ short nShortLongDayOfWeek,
+ short nShortLongDay,
+ short nShortLongMonth,
+ short nShortLongYear )
+{
+ const XubString* pKeyword = pFormatScanner->GetKeyword();
+ switch ( nShortLongDayOfWeek )
+ {
+ case -1 :
+ break;
+ case 0 :
+ switch ( pIntl->GetLongDateDayOfWeekFormat() )
+ {
+ case DAYOFWEEK_NONE :
+ break;
+ case DAYOFWEEK_SHORT :
+ sDateStr += pKeyword[NF_KEY_NN];
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateDayOfWeekSep(), pCharClass );
+ break;
+ case DAYOFWEEK_LONG :
+ sDateStr += pKeyword[NF_KEY_NNNN];
+ // NNNN ist leider bereits mit Separator, so wird es in
+ // aelteren Versionen, die noch kein NNN kennen, korrekt
+ // dargestellt, nur der Formatstring sieht krank aus..
+ break;
+ default:
+ DBG_ERRORFILE( "unknown LongDateDayOfWeekFormat" );
+ }
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_NN];
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateDayOfWeekSep(), pCharClass );
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_NNNN];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongDayOfWeek" );
+ }
+ switch (pIntl->GetLongDateFormat())
+ {
+ case MDY:
+ {
+ switch ( nShortLongMonth )
+ {
+ case -1 :
+ break;
+ case 0 :
+ switch ( pIntl->GetLongDateMonthFormat() )
+ {
+ case MONTH_NORMAL :
+ sDateStr += pKeyword[NF_KEY_M];
+ break;
+ case MONTH_ZERO :
+ sDateStr += pKeyword[NF_KEY_MM];
+ break;
+ case MONTH_SHORT :
+ sDateStr += pKeyword[NF_KEY_MMM];
+ break;
+ case MONTH_LONG :
+ sDateStr += pKeyword[NF_KEY_MMMM];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown LongDateMonthFormat" );
+ }
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_MMM];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_MMMM];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongMonth" );
+ }
+ if ( nShortLongMonth != -1 )
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateMonthSep(), pCharClass );
+
+ switch ( nShortLongDay )
+ {
+ case -1 :
+ break;
+ case 0 :
+ if ( pIntl->IsLongDateDayLeadingZero() )
+ sDateStr += pKeyword[NF_KEY_TT];
+ else
+ sDateStr += pKeyword[NF_KEY_T];
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_T];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_TT];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongDay" );
+ }
+ if ( nShortLongDay != -1 )
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateDaySep(), pCharClass );
+
+ switch ( nShortLongYear )
+ {
+ case -1 :
+ break;
+ case 0 :
+ if ( pIntl->IsLongDateCentury() )
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ else
+ sDateStr += pKeyword[NF_KEY_JJ];
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_JJ];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongYear" );
+ }
+ //if ( nShortLongYear != -1 )
+ // lcl_ImplAddStringMaybeQuoted( sDateStr,
+ // pIntl->GetLongDateYearSep(), pCharClass );
+
+ }
+ break;
+ case DMY:
+ {
+ switch ( nShortLongDay )
+ {
+ case -1 :
+ break;
+ case 0 :
+ if ( pIntl->IsLongDateDayLeadingZero() )
+ sDateStr += pKeyword[NF_KEY_TT];
+ else
+ sDateStr += pKeyword[NF_KEY_T];
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_T];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_TT];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongDay" );
+ }
+ if ( nShortLongDay != -1 )
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateDaySep(), pCharClass );
+
+ switch ( nShortLongMonth )
+ {
+ case -1 :
+ break;
+ case 0 :
+ switch ( pIntl->GetLongDateMonthFormat() )
+ {
+ case MONTH_NORMAL :
+ sDateStr += pKeyword[NF_KEY_M];
+ break;
+ case MONTH_ZERO :
+ sDateStr += pKeyword[NF_KEY_MM];
+ break;
+ case MONTH_SHORT :
+ sDateStr += pKeyword[NF_KEY_MMM];
+ break;
+ case MONTH_LONG :
+ sDateStr += pKeyword[NF_KEY_MMMM];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown LongDateMonthFormat" );
+ }
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_MMM];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_MMMM];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongMonth" );
+ }
+ if ( nShortLongMonth != -1 )
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateMonthSep(), pCharClass );
+
+ switch ( nShortLongYear )
+ {
+ case -1 :
+ break;
+ case 0 :
+ if ( pIntl->IsLongDateCentury() )
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ else
+ sDateStr += pKeyword[NF_KEY_JJ];
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_JJ];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongYear" );
+ }
+ //if ( nShortLongYear != -1 )
+ // lcl_ImplAddStringMaybeQuoted( sDateStr,
+ // pIntl->GetLongDateYearSep(), pCharClass );
+
+ }
+ break;
+ case YMD:
+ {
+ switch ( nShortLongYear )
+ {
+ case -1 :
+ break;
+ case 0 :
+ if ( pIntl->IsLongDateCentury() )
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ else
+ sDateStr += pKeyword[NF_KEY_JJ];
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_JJ];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_JJJJ];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongYear" );
+ }
+ if ( nShortLongYear != -1 )
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateYearSep(), pCharClass );
+
+ switch ( nShortLongMonth )
+ {
+ case -1 :
+ break;
+ case 0 :
+ switch ( pIntl->GetLongDateMonthFormat() )
+ {
+ case MONTH_NORMAL :
+ sDateStr += pKeyword[NF_KEY_M];
+ break;
+ case MONTH_ZERO :
+ sDateStr += pKeyword[NF_KEY_MM];
+ break;
+ case MONTH_SHORT :
+ sDateStr += pKeyword[NF_KEY_MMM];
+ break;
+ case MONTH_LONG :
+ sDateStr += pKeyword[NF_KEY_MMMM];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown LongDateMonthFormat" );
+ }
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_MMM];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_MMMM];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongMonth" );
+ }
+ if ( nShortLongMonth != -1 )
+ lcl_ImplAddStringMaybeQuoted( sDateStr,
+ pIntl->GetLongDateMonthSep(), pCharClass );
+
+ switch ( nShortLongDay )
+ {
+ case -1 :
+ break;
+ case 0 :
+ if ( pIntl->IsLongDateDayLeadingZero() )
+ sDateStr += pKeyword[NF_KEY_TT];
+ else
+ sDateStr += pKeyword[NF_KEY_T];
+ break;
+ case 1 :
+ sDateStr += pKeyword[NF_KEY_T];
+ break;
+ case 2 :
+ sDateStr += pKeyword[NF_KEY_TT];
+ break;
+ default:
+ DBG_ERRORFILE( "unknown nShortLongDay" );
+ }
+ //if ( nShortLongDay != -1 )
+ // lcl_ImplAddStringMaybeQuoted( sDateStr,
+ // pIntl->GetLongDateDaySep(), pCharClass );
+
+ }
+ break;
+ default:
+ DBG_ERRORFILE( "unknown LongDateFormat" );
+ }
+}
+
+void SvNumberFormatter::ImpGetPosCurrFormat(XubString& sPosStr)
+{
+ NfCurrencyEntry::CompletePositiveFormatString( sPosStr,
+ pIntl->GetCurrSymbol(), pIntl->GetCurrPositiveFormat() );
+}
+
+void SvNumberFormatter::ImpGetNegCurrFormat(XubString& sNegStr)
+{
+ NfCurrencyEntry::CompleteNegativeFormatString( sNegStr,
+ pIntl->GetCurrSymbol(), pIntl->GetCurrNegativeFormat() );
+}
+
+void SvNumberFormatter::GenerateFormat(XubString& sString,
+ ULONG nIndex,
+ LanguageType eLnge,
+ BOOL bThousand,
+ BOOL IsRed,
+ USHORT nPrecision,
+ USHORT nAnzLeading)
+{
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+ short eType = GetType(nIndex);
+ USHORT i;
+ ImpGenerateCL(eLnge); // ggfs. neu Standard-
+ // formate anlegen
+ sString.Erase();
+
+ if (nAnzLeading == 0)
+ {
+ if (!bThousand)
+ sString += '#';
+ else
+ {
+ sString += '#';
+ sString += pIntl->GetNumThousandSep();
+ sString += '#';
+ sString += '#';
+ sString += '#';
+ }
+ }
+ else
+ {
+ for (i = 0; i < nAnzLeading; i++)
+ {
+ if (bThousand && i%3 == 0 && i > 0)
+ sString.Insert(pIntl->GetNumThousandSep(),0);
+ sString.Insert('0',0);
+ }
+ if (bThousand && nAnzLeading < 4)
+ {
+ for (i = nAnzLeading; i < 4; i++)
+ {
+ if (bThousand && i%3 == 0)
+ sString.Insert(pIntl->GetNumThousandSep(),0);
+ sString.Insert('#',0);
+ }
+ }
+ }
+ if (nPrecision > 0)
+ {
+ sString += pIntl->GetNumDecimalSep();
+ for (i = 0; i < nPrecision; i++)
+ sString += '0';
+ }
+ if (eType == NUMBERFORMAT_PERCENT)
+ sString += '%';
+ else if (eType == NUMBERFORMAT_CURRENCY)
+ {
+ XubString sNegStr = sString;
+ XubString aCurr;
+ const NfCurrencyEntry* pEntry;
+ BOOL bBank;
+ if ( GetNewCurrencySymbolString( nIndex, aCurr, &pEntry, &bBank ) )
+ {
+ if ( pEntry )
+ {
+ USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
+ pIntl->GetCurrPositiveFormat(),
+ pEntry->GetPositiveFormat(), bBank );
+ USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
+ pIntl->GetCurrNegativeFormat(),
+ pEntry->GetNegativeFormat(), bBank );
+ pEntry->CompletePositiveFormatString( sString, bBank,
+ nPosiForm );
+ pEntry->CompleteNegativeFormatString( sNegStr, bBank,
+ nNegaForm );
+ }
+ else
+ { // wir gehen von einem Banksymbol aus
+ USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
+ pIntl->GetCurrPositiveFormat(),
+ pIntl->GetCurrPositiveFormat(), TRUE );
+ USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
+ pIntl->GetCurrNegativeFormat(),
+ pIntl->GetCurrNegativeFormat(), TRUE );
+ NfCurrencyEntry::CompletePositiveFormatString( sString, aCurr,
+ nPosiForm );
+ NfCurrencyEntry::CompleteNegativeFormatString( sNegStr, aCurr,
+ nNegaForm );
+ }
+ }
+ else
+ {
+ ImpGetPosCurrFormat(sString);
+ ImpGetNegCurrFormat(sNegStr);
+ }
+ if (IsRed)
+ {
+ sString += ';';
+ sString += '[';
+ sString += pFormatScanner->GetRedString();
+ sString += ']';
+ }
+ else
+ sString += ';';
+ sString += sNegStr;
+ }
+ if (IsRed && eType != NUMBERFORMAT_CURRENCY)
+ {
+ XubString sTmpStr = sString;
+ sTmpStr += ';';
+ sTmpStr += '[';
+ sTmpStr += pFormatScanner->GetRedString();
+ sTmpStr += ']';
+ sTmpStr += '-';
+ sTmpStr +=sString;
+ sString = sTmpStr;
+ }
+}
+
+BOOL SvNumberFormatter::IsUserDefined(const XubString& sStr,
+ LanguageType eLnge)
+{
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+ ULONG CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard-
+ // formate anlegen
+ eLnge = ActLnge;
+ ULONG 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;
+}
+
+ULONG SvNumberFormatter::GetEntryKey(const XubString& sStr,
+ LanguageType eLnge)
+{
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+ ULONG CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard-
+ // formate anlegen
+ return ImpIsEntry(sStr, CLOffset, eLnge);
+}
+
+ULONG SvNumberFormatter::GetStandardIndex(LanguageType eLnge)
+{
+ if (eLnge == LANGUAGE_DONTKNOW)
+ eLnge = SysLnge;
+ return GetStandardFormat(NUMBERFORMAT_NUMBER, eLnge);
+}
+
+short SvNumberFormatter::GetType(ULONG 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()
+{
+ ULONG* pIndex = (ULONG*) pMergeTable->First();
+ while (pIndex)
+ {
+ delete pIndex;
+ pIndex = pMergeTable->Next();
+ }
+ pMergeTable->Clear();
+}
+
+SvULONGTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter& rTable)
+{
+ ClearMergeTable();
+ ULONG nCLOffset, nOldKey, nOffset, nNewKey;
+ ULONG* 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 ULONG(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);
+ ULONG nPos = nCLOffset + pStdFormat->GetLastInsertKey();
+ nNewKey = nPos+1;
+ if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
+ {
+#ifndef DOS
+ Sound::Beep();
+#endif
+ 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 ULONG(nNewKey);
+ if (!pMergeTable->Insert(nOldKey,pNewIndex))
+ delete pNewIndex;
+ }
+ }
+ pFormat = rTable.aFTable.Next();
+ }
+ return pMergeTable;
+}
+
+
+ULONG SvNumberFormatter::GetFormatForLanguageIfBuiltIn( ULONG nFormat,
+ LanguageType eLnge )
+{
+ if ( eLnge == LANGUAGE_DONTKNOW )
+ eLnge = SysLnge;
+ if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLnge == SysLnge )
+ return nFormat; // es bleibt wie es ist
+ ULONG nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex
+ if ( nOffset > SV_MAX_ANZ_STANDARD_FORMATE )
+ return nFormat; // kein eingebautes Format
+ ULONG nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren
+ return nCLOffset + nOffset;
+}
+
+
+ULONG 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 = SysLnge;
+ ULONG nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren
+ return nCLOffset + theIndexTable[nTabOff];
+}
+
+
+NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( ULONG nFormat ) const
+{
+ ULONG 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();
+}
+
+
+const NfCurrencyTable& SvNumberFormatter::GetTheCurrencyTable() const
+{
+ while ( !bCurrencyTableInitialized )
+ SvNumberFormatter::ImpInitCurrencyTable();
+ return theCurrencyTable;
+}
+
+
+const NfCurrencyEntry* SvNumberFormatter::MatchSystemCurrency() const
+{
+ const NfCurrencyTable& rTable = GetTheCurrencyTable();
+ return nSystemCurrencyPosition ? rTable[nSystemCurrencyPosition] : NULL;
+}
+
+
+const NfCurrencyEntry& SvNumberFormatter::GetCurrencyEntry( LanguageType eLang ) const
+{
+ if ( eLang == LANGUAGE_DONTKNOW )
+ eLang = SysLnge;
+ if ( eLang == LANGUAGE_SYSTEM )
+ {
+ const NfCurrencyEntry* pCurr = MatchSystemCurrency();
+ return pCurr ? *pCurr : *(GetTheCurrencyTable()[0]);
+ }
+ else
+ {
+ 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]);
+ }
+}
+
+
+ULONG SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
+{
+ if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ xub_StrLen nCheck;
+ short nType;
+ NfWSStringsDtor aCurrList;
+ USHORT nDefault = GetCurrencyFormatStrings( aCurrList,
+ GetCurrencyEntry( LANGUAGE_SYSTEM ), FALSE );
+ DBG_ASSERT( nDefault < aCurrList.Count(), "wo ist das NewCurrency Standard Format?!?" );
+ // wenn bereits geladen oder userdefined wird nDefaultCurrencyFormat
+ // hierbei auf den richtigen Wert gesetzt
+ PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType,
+ nDefaultCurrencyFormat, LANGUAGE_SYSTEM );
+ DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
+ DBG_ASSERT( nDefaultCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND,
+ "nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND" );
+ }
+ return nDefaultCurrencyFormat;
+}
+
+
+BOOL SvNumberFormatter::GetNewCurrencySymbolString( ULONG nFormat,
+ XubString& 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 )
+ {
+ XubString aSymbol, aExtension;
+ if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) )
+ {
+ xub_StrLen nExtLen = aExtension.Len();
+ if ( ppEntry )
+ {
+ LanguageType eExtLang;
+ if ( nExtLen )
+ {
+ ByteString aTmp( aExtension, 1, nExtLen-1, gsl_getSystemTextEncoding() );
+ char* pEnd;
+ long nExtLang = strtol( aTmp.GetBuffer(), &pEnd, 16 );
+ eExtLang = (LanguageType) (
+ (*pEnd || nExtLang == LONG_MIN || nExtLang == LONG_MAX) ?
+ LANGUAGE_DONTKNOW : nExtLang );
+ }
+ else
+ eExtLang = LANGUAGE_DONTKNOW;
+ const NfCurrencyEntry* pFoundEntry = NULL;
+ BOOL bFoundBank = FALSE;
+ const NfCurrencyTable& rTable = GetTheCurrencyTable();
+ USHORT nCount = rTable.Count();
+ const NfCurrencyEntryPtr* ppData = rTable.GetData();
+ for ( USHORT j = 0; j < nCount; j++, ppData++ )
+ {
+ LanguageType eLang = (*ppData)->GetLanguage();
+ if ( !nExtLen || eLang == eExtLang ||
+ (eLang == LANGUAGE_SYSTEM && eExtLang == LANGUAGE_DONTKNOW) )
+ {
+ BOOL bFound;
+ if ( (*ppData)->GetSymbol() == aSymbol )
+ {
+ bFound = TRUE;
+ bFoundBank = FALSE;
+ }
+ else if ( (*ppData)->GetBankSymbol() == aSymbol )
+ {
+ bFound = TRUE;
+ bFoundBank = TRUE;
+ }
+ else
+ bFound = FALSE;
+ if ( bFound )
+ {
+ if ( pFoundEntry && pFoundEntry != *ppData )
+ {
+ pFoundEntry = NULL;
+ break; // for, nicht eindeutig
+ }
+ if ( j == 0 )
+ { // erster Eintrag System
+ pFoundEntry = MatchSystemCurrency();
+ if ( pFoundEntry )
+ break; // for, selbst wenn es mehrere
+ // geben sollte, wird dieser gemeint sein
+ else
+ pFoundEntry = *ppData;
+ }
+ else
+ pFoundEntry = *ppData;
+ }
+ }
+ }
+ 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 ( nExtLen )
+ rStr += aExtension;
+ rStr += ']';
+ }
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+#ifndef PRODUCT
+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:
+ DBG_ERRORFILE("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:
+ DBG_ERRORFILE("lcl_CheckCurrencySymbolPosition: unknown NegativeFormat");
+ break;
+ }
+ if ( nPos >= 0 && nNeg >= 0 && nPos != nNeg )
+ {
+ ByteString aStr( "ER->TH: 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
+ DBG_ERRORFILE( aStr.GetBuffer() );
+#endif
+ }
+}
+#endif
+
+
+// static
+void SvNumberFormatter::ImpInitCurrencyTable()
+{
+ // racing condition moeglich:
+ // while ( !bCurrencyTableInitialized )
+ // ImpInitCurrencyTable();
+ static BOOL bInitializing = FALSE;
+ if ( bCurrencyTableInitialized || bInitializing )
+ return ;
+ bInitializing = TRUE;
+
+ LanguageType eSysLang = System::GetLanguage();
+ NfCurrencyEntryPtr pEntry;
+ USHORT n = International::GetAvailableFormatCount();
+ for ( USHORT j = 0; j < n; j++ )
+ {
+ LanguageType eLang = International::GetAvailableFormat( j );
+#ifdef DEBUG
+ LanguageType eReal = International::GetRealLanguage( eLang );
+ LanguageType eNeut = International::GetNeutralLanguage( eLang );
+ if ( eReal != eLang )
+ BOOL bBreak = TRUE;
+ if ( eNeut != eLang )
+ BOOL bBreak = TRUE;
+#endif
+ International* pIntl = new International( eLang );
+ pEntry = new NfCurrencyEntry( *pIntl );
+#ifndef PRODUCT
+ lcl_CheckCurrencySymbolPosition( *pEntry );
+#endif
+ theCurrencyTable.Insert( pEntry, j );
+ delete pIntl;
+ if ( !nSystemCurrencyPosition && pEntry->GetLanguage() == eSysLang )
+ nSystemCurrencyPosition = j;
+ }
+ DBG_ASSERT( theCurrencyTable.Count(),
+ "SvNumberFormatter::ImpInitCurrencyTable: kein NfCurrencyEntry ?!?" );
+ // erster Eintrag ist System
+ // landesunabhaengigen EURo an zweiter Stelle einfuegen
+ pEntry = new NfCurrencyEntry;
+ pEntry->SetEuro();
+ theCurrencyTable.Insert( pEntry, nCurrencyTableEuroPosition );
+ DBG_ASSERT( theCurrencyTable[0]->GetLanguage() == LANGUAGE_SYSTEM,
+ "SvNumberFormatter::ImpInitCurrencyTable: erster Eintrag nicht System" );
+ DBG_ASSERT( nSystemCurrencyPosition, "Regional Settings Language nicht in TH's Tabellen" );
+ if ( nSystemCurrencyPosition )
+ {
+ if ( nSystemCurrencyPosition >= nCurrencyTableEuroPosition )
+ nSystemCurrencyPosition++;
+ if ( theCurrencyTable[nSystemCurrencyPosition]->GetSymbol() !=
+ theCurrencyTable[0]->GetSymbol() )
+ {
+ if ( theCurrencyTable[0]->IsEuro() )
+ nSystemCurrencyPosition = nCurrencyTableEuroPosition;
+ else
+ nSystemCurrencyPosition = 0;
+ }
+ if ( nSystemCurrencyPosition )
+ theCurrencyTable[nSystemCurrencyPosition]->ApplyVariableInformation(
+ *theCurrencyTable[0] );
+ }
+ bCurrencyTableInitialized = TRUE;
+ bInitializing = FALSE;
+}
+
+
+USHORT SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr,
+ const NfCurrencyEntry& rCurr, BOOL bBank ) const
+{
+ USHORT nDefault = 0;
+ if ( bBank )
+ { // nur Bankensymbole
+ XubString aPositiveBank, aNegativeBank;
+ rCurr.BuildPositiveFormatString( aPositiveBank, TRUE, *pIntl, 1 );
+ rCurr.BuildNegativeFormatString( aNegativeBank, TRUE, *pIntl, 1 );
+
+ WSStringPtr pFormat1 = new String( aPositiveBank );
+ *pFormat1 += ';';
+ WSStringPtr pFormat2 = new String( *pFormat1 );
+
+ XubString 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
+ XubString aPositive, aNegative, aPositiveNoDec, aNegativeNoDec,
+ aPositiveDashed, aNegativeDashed;
+ WSStringPtr pFormat1, pFormat2, pFormat3, pFormat4, pFormat5;
+
+ XubString aRed( '[' );
+ aRed += pFormatScanner->GetRedString();
+ aRed += ']';
+
+ rCurr.BuildPositiveFormatString( aPositive, FALSE, *pIntl, 1 );
+ rCurr.BuildNegativeFormatString( aNegative, FALSE, *pIntl, 1 );
+ if ( rCurr.GetDigits() )
+ {
+ rCurr.BuildPositiveFormatString( aPositiveNoDec, FALSE, *pIntl, 0 );
+ rCurr.BuildNegativeFormatString( aNegativeNoDec, FALSE, *pIntl, 0 );
+ rCurr.BuildPositiveFormatString( aPositiveDashed, FALSE, *pIntl, 2 );
+ rCurr.BuildNegativeFormatString( aNegativeDashed, FALSE, *pIntl, 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 International& rIntl )
+{
+ aSymbol = rIntl.GetCurrSymbol();
+ aBankSymbol = rIntl.GetCurrBankSymbol();
+ eLanguage = rIntl.GetLanguage();
+ nPositiveFormat = rIntl.GetCurrPositiveFormat();
+ nNegativeFormat = rIntl.GetCurrNegativeFormat();
+ nDigits = rIntl.GetCurrDigits();
+ cZeroChar = rIntl.GetCurrZeroChar();
+}
+
+
+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;
+ XubString aEuro( NfCurrencyEntry::GetEuroSymbol() );
+ return aSymbol == aEuro;
+}
+
+
+void NfCurrencyEntry::ApplyVariableInformation( const NfCurrencyEntry& r )
+{
+ nPositiveFormat = r.nPositiveFormat;
+ nNegativeFormat = r.nNegativeFormat;
+ nDigits = r.nDigits;
+ cZeroChar = r.cZeroChar;
+}
+
+
+void NfCurrencyEntry::BuildSymbolString( XubString& 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 += UniString::CreateFromInt32( sal_Int32( eLanguage ), 16 );
+ }
+ }
+ rStr += ']';
+}
+
+
+void NfCurrencyEntry::Impl_BuildFormatStringNumChars( XubString& rStr,
+ const International& rIntl, USHORT nDecimalFormat ) const
+{
+ rStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###0" ) );
+ rStr.Insert( rIntl.GetNumThousandSep(), 1 );
+ if ( nDecimalFormat && nDigits )
+ {
+ rStr += rIntl.GetNumDecimalSep();
+ rStr.Expand( rStr.Len() + nDigits, (nDecimalFormat == 2 ? '-' : cZeroChar) );
+ }
+}
+
+
+void NfCurrencyEntry::BuildPositiveFormatString( XubString& rStr, BOOL bBank,
+ const International& rIntl, USHORT nDecimalFormat ) const
+{
+ Impl_BuildFormatStringNumChars( rStr, rIntl, nDecimalFormat );
+ USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
+ rIntl.GetCurrPositiveFormat(), nPositiveFormat, bBank );
+ CompletePositiveFormatString( rStr, bBank, nPosiForm );
+}
+
+
+void NfCurrencyEntry::BuildNegativeFormatString( XubString& rStr, BOOL bBank,
+ const International& rIntl, USHORT nDecimalFormat ) const
+{
+ Impl_BuildFormatStringNumChars( rStr, rIntl, nDecimalFormat );
+ USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
+ rIntl.GetCurrNegativeFormat(), nNegativeFormat, bBank );
+ CompleteNegativeFormatString( rStr, bBank, nNegaForm );
+}
+
+
+void NfCurrencyEntry::CompletePositiveFormatString( XubString& rStr, BOOL bBank,
+ USHORT nPosiForm ) const
+{
+ XubString aSymStr;
+ BuildSymbolString( aSymStr, bBank );
+ NfCurrencyEntry::CompletePositiveFormatString( rStr, aSymStr, nPosiForm );
+}
+
+
+void NfCurrencyEntry::CompleteNegativeFormatString( XubString& rStr, BOOL bBank,
+ USHORT nNegaForm ) const
+{
+ XubString aSymStr;
+ BuildSymbolString( aSymStr, bBank );
+ NfCurrencyEntry::CompleteNegativeFormatString( rStr, aSymStr, nNegaForm );
+}
+
+
+// static
+void NfCurrencyEntry::CompletePositiveFormatString( XubString& rStr,
+ const XubString& 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( XubString& rStr,
+ const XubString& 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
+ {
+ XubString 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 nIntlFormat,
+ 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;
+ }
+ 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;
+ break;
+ 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- $
+ break;
+ nSign = 1;
+ case 3: // $1-
+ case 7: // 1$-
+ case 10: // 1 $-
+ case 12 : // $ 1-
+ nSign = 2;
+ break;
+ }
+
+ switch ( nCurrFormat )
+ {
+ case 0: // ($1)
+ switch ( nSign )
+ {
+ case 0:
+ return 1; // -$1
+ break;
+ case 1:
+ return 2; // $-1
+ break;
+ case 2:
+ return 3; // $1-
+ break;
+ }
+ break;
+ case 4: // (1$)
+ switch ( nSign )
+ {
+ case 0:
+ return 5; // -1$
+ break;
+ case 1:
+ return 6; // 1-$
+ break;
+ case 2:
+ return 7; // 1$-
+ break;
+ }
+ break;
+ case 14 : // ($ 1)
+ switch ( nSign )
+ {
+ case 0:
+ return 9; // -$ 1
+ break;
+ case 1:
+ return 11; // $ -1
+ break;
+ case 2:
+ return 12; // $ 1-
+ break;
+ }
+ break;
+ case 15 : // (1 $)
+ switch ( nSign )
+ {
+ case 0:
+ return 8; // -1 $
+ break;
+ case 1:
+ return 13; // 1- $
+ break;
+ case 2:
+ return 10; // 1 $-
+ break;
+ }
+ 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;
+ }
+#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;
+ }
+ }
+ 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';
+ break;
+ case RTL_TEXTENCODING_ISO_8859_15 : // UNX real
+ return '\xA4';
+ break;
+ case RTL_TEXTENCODING_IBM_850 : // OS2
+ return '\xD5';
+ break;
+ case RTL_TEXTENCODING_APPLE_ROMAN : // MAC
+ return '\xDB';
+ break;
+ 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
+#elif MAC
+ return '\xDB';
+#else
+#error EuroSymbol is what?
+ return '\x80';
+#endif
+ }
+ return '\x80';
+}
+
+
+
diff --git a/svtools/source/numbers/zformat.cxx b/svtools/source/numbers/zformat.cxx
new file mode 100644
index 000000000000..1bdba6e3112e
--- /dev/null
+++ b/svtools/source/numbers/zformat.cxx
@@ -0,0 +1,3469 @@
+/*************************************************************************
+ *
+ * $RCSfile: zformat.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <ctype.h>
+#include <float.h>
+#include <math.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifndef _INTN_HXX //autogen
+#include <tools/intn.hxx>
+#endif
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _SOLMATH_HXX //autogen wg. SolarMath
+#include <tools/solmath.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+
+#define _ZFORMAT_CXX
+#include "zformat.hxx"
+#include "zforscan.hxx"
+
+#include "zforfind.hxx"
+#include "zforlist.hxx"
+#include "numhead.hxx"
+
+
+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;
+
+#ifdef S390
+const double _D_MAX_D_BY_100 = 7.2E73;
+const double _D_MIN_M_BY_1000 = 5.4E-76;
+#else
+const double _D_MAX_D_BY_100 = 1.7E306;
+const double _D_MIN_M_BY_1000 = 2.3E-305;
+#endif
+
+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 InsertBlanks( XubString& r, xub_StrLen nPos, xub_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 xub_Unicode cNewCurrencyMagic = 0x01; // Magic fuer Format im Kommentar
+
+/***********************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() );
+ switch ( nTypeArray[i] )
+ { // der Krampf fuer Versionen vor SV_NUMBERFORMATTER_VERSION_NEW_CURR
+ case SYMBOLTYPE_CURRENCY :
+ rStream << short( SYMBOLTYPE_STRING );
+ break;
+ case SYMBOLTYPE_CURRDEL :
+ case SYMBOLTYPE_CURREXT :
+ rStream << short(0); // werden ignoriert (hoffentlich..)
+ break;
+ default:
+ rStream << nTypeArray[i];
+ }
+
+ }
+ 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;
+}
+
+/***********************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(nAnzStrings) aI.sStrArray;
+ __DELETE(nAnzStrings) 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 XubString[nAnz];
+ }
+ else
+ {
+ aI.nTypeArray = NULL;
+ aI.sStrArray = NULL;
+ }
+ }
+}
+
+void ImpSvNumFor::Copy( const ImpSvNumFor& rNumFor )
+{
+ Enlarge( rNumFor.nAnzStrings );
+ aI.Copy( rNumFor.aI, nAnzStrings );
+ pColor = rNumFor.pColor;
+ sColorName = rNumFor.sColorName;
+}
+
+void ImpSvNumFor::Save(SvStream& rStream) const
+{
+ rStream << nAnzStrings;
+ aI.Save(rStream, nAnzStrings);
+ rStream.WriteByteString( sColorName, rStream.GetStreamCharSet() );
+}
+
+void ImpSvNumFor::Load(SvStream& rStream, ImpSvNumberformatScan& rSc,
+ XubString& 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] == SYMBOLTYPE_CURRENCY )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+BOOL ImpSvNumFor::GetNewCurrencySymbol( XubString& rSymbol,
+ XubString& rExtension ) const
+{
+ for ( USHORT j=0; j<nAnzStrings; j++ )
+ {
+ if ( aI.nTypeArray[j] == SYMBOLTYPE_CURRENCY )
+ {
+ rSymbol = aI.sStrArray[j];
+ if ( j < nAnzStrings-1 && aI.nTypeArray[j+1] == 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 SYMBOLTYPE_CURRENCY :
+ case SYMBOLTYPE_CURRDEL :
+ case SYMBOLTYPE_CURREXT :
+ nCnt++;
+ break;
+ }
+ }
+ rStream << nCnt;
+ for ( j=0; j<nAnzStrings; j++ )
+ {
+ switch ( aI.nTypeArray[j] )
+ {
+ case SYMBOLTYPE_CURRENCY :
+ case SYMBOLTYPE_CURRDEL :
+ case 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 Sc_FormatSymbolType
+{
+ SYMBOLTYPE_FORMAT = -1, // TeilFormatstring
+ SYMBOLTYPE_COLOR = -2, // Farbe
+ SYMBOLTYPE_ERROR = -3 // Fehler
+};
+
+SvNumberformat::SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge )
+ :
+ rScan(rSc),
+ eLnge(eLge),
+ bStarFlag( FALSE ),
+ nNewStandardDefined(0)
+{
+}
+
+void SvNumberformat::CopyNumberformat( 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;
+ for (USHORT i = 0; i < 4; i++)
+ NumFor[i].Copy(rFormat.NumFor[i]);
+}
+
+SvNumberformat::SvNumberformat( SvNumberformat& rFormat )
+ : rScan(rFormat.rScan), bStarFlag( rFormat.bStarFlag )
+{
+ CopyNumberformat( rFormat );
+}
+
+SvNumberformat::SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc )
+ : rScan(rSc), bStarFlag( rFormat.bStarFlag )
+{
+ CopyNumberformat( rFormat );
+}
+
+SvNumberformat::SvNumberformat(XubString& rString,
+ ImpSvNumberformatScan* pSc,
+ ImpSvNumberInputScan* pISc,
+ xub_StrLen& nCheckPos,
+ LanguageType& eLan,
+ BOOL bStan)
+ :
+ rScan(*pSc),
+ bStarFlag( FALSE ),
+ nNewStandardDefined(0)
+{
+ // Wenn der Tausender-Trenner ein Non-Breaking Space ist (franzoesisch),
+ // alle Vorkommen auf einfaches Space aendern:
+ // (Die Tokens werden hinterher wieder auf das Zeichen vom International gesetzt)
+
+ const xub_Unicode cNBSp = 0xA0;
+ if ( pSc->GetIntl().GetNumThousandSep() == cNBSp )
+ {
+ 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 nStrPos;
+ xub_StrLen nPos = 0;
+ xub_StrLen nPosOld;
+ nCheckPos = 0;
+ XubString aComment;
+ // Zerlegung in 4 Teilstrings:
+ for (USHORT nIndex = 0; nIndex < 4 && !bCancel; nIndex++)
+ {
+ if (rScan.GetConvertMode())
+ (rScan.GetNumberformatter())->ChangeIntl(rScan.GetTmpLnge());
+ // in hinteren Formaten muss
+ // hier ggfs. wieder die
+ // Ausgangssprache eingestellt
+ // werden
+ XubString sStr;
+ nPosOld = nPos; // Position vor Teilstring
+ eSymbolType = ImpNextSymbol(rString, nPos, sStr);
+ if (eSymbolType > 0) // Bedingung
+ {
+ if (nIndex == 0)
+ {
+ bCondition = TRUE;
+ eOp1 = (SvNumberformatLimitOps) eSymbolType;
+ }
+ else if (nIndex == 1 && bCondition)
+ eOp2 = (SvNumberformatLimitOps) eSymbolType;
+ else // Fehler
+ {
+ bCancel = TRUE; // Abbruch for
+ nCheckPos = nPos;
+ }
+ 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 -= nAnzChars;
+ rString.Erase(nPos, nAnzChars);
+ rString.Insert('0',nPos);
+ nPos++;
+ }
+ nPos++; // Skip ']'
+ }
+ else
+ {
+ fNumber = 0.0;
+ rString.Insert('0',nPos);
+ }
+ if (nIndex == 0)
+ fLimit1 = fNumber;
+ else
+ fLimit2 = fNumber;
+ }
+ nPosOld = nPos; // Position vor String
+ eSymbolType = ImpNextSymbol(rString, nPos, sStr);
+ }
+ if (eSymbolType == SYMBOLTYPE_COLOR)
+ {
+ NumFor[nIndex].SetColor(pSc->GetColor(sStr), sStr);
+#ifndef DOS
+ if (NumFor[nIndex].GetColor() == NULL) // Fehler
+ {
+ bCancel = TRUE; // Abbruch for
+ nCheckPos = nPos;
+ }
+ else
+ {
+ rString.Erase(nPosOld,nPos-nPosOld);
+ rString.Insert(sStr,nPosOld);
+ nPos = nPosOld + sStr.Len();
+ rString.Insert(']', nPos);
+ rString.Insert('[', nPosOld);
+ nPos += 2;
+ nPosOld = nPos; // Position vor String
+ eSymbolType = ImpNextSymbol(rString, nPos, sStr);
+ }
+#else
+ bCancel = TRUE; // Abbruch for
+ nCheckPos = nPos;
+#endif
+ }
+ if (eSymbolType == SYMBOLTYPE_FORMAT)
+ {
+ if (nIndex == 1 && eOp1 == NUMBERFORMAT_OP_NO)// Bdg. undefiniert
+ eOp1 = NUMBERFORMAT_OP_GT; // default: > 0
+ else if (nIndex == 2 && eOp2 == NUMBERFORMAT_OP_NO)
+ eOp2 = NUMBERFORMAT_OP_LT; // default: < 0
+ if (sStr.Len() == 0) // leeres Teilformat
+ { // Sonderfall 1
+ }
+/* // Typ undefined
+#ifndef ENABLEUNICODE
+ else if (sStr.ICompare(pSc->GetStandardName()) == COMPARE_EQUAL)
+#else
+ else if (sStr.Compare(pSc->GetStandardName()) == COMPARE_EQUAL)
+#endif
+ {
+ rString.Replace(pSc->GetStandardName(), rString.Search(sStr));
+ NumFor[nIndex].Info().eScannedType = NUMBERFORMAT_NUMBER;
+ }
+*/
+ // -> Sonderfall 2
+ else
+ {
+ nStrPos = pSc->ScanFormat( sStr, aComment );
+ USHORT nAnz = pSc->GetAnzResStrings();
+ if (nAnz == 0) // Fehler
+ nStrPos = 1;
+ if (nStrPos == 0) // ok
+ {
+ 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);
+ if (nIndex == 0) // Typcheck:
+ 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 // Fehler im String
+ {
+ nCheckPos = nPosOld + nStrPos;
+ bCancel = TRUE; // Abbruch for
+ }
+ } // of != Standard
+ }
+ else if (eSymbolType == SYMBOLTYPE_ERROR) // Fehler
+ {
+ nCheckPos = nPos;
+ bCancel = TRUE;
+ }
+ else if (eSymbolType > 0 || // doppelt
+ eSymbolType == SYMBOLTYPE_COLOR )
+ {
+ nCheckPos = nPosOld+1;
+ bCancel = TRUE;
+ }
+ if (rString.Len() == nPos)
+ bCancel = TRUE;
+ } // of for
+ if (bCondition)
+ {
+ if (NumFor[1].GetnAnz() == 0) // kein 2. Teilstring
+ {
+ if (NumFor[1].Info().eScannedType != NUMBERFORMAT_NUMBER)
+ rString.InsertAscii(";Standard", rString.Len());
+ }
+ else if (NumFor[2].GetnAnz() == 0 && eOp2 != NUMBERFORMAT_OP_NO)
+ {
+ if (NumFor[2].Info().eScannedType != NUMBERFORMAT_NUMBER)
+ rString.InsertAscii(";Standard", rString.Len());
+ }
+ }
+ 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 | SsGetColCon
+// | ] | Fehler | SsStop
+// | BLANK | |
+// | Sonst | Symbol += Zeichen | SsGetString
+//---------------+-------------------+-----------------------+---------------
+// SsGetString | ; | | SsStop
+// | Sonst | Symbol+=Zeichen |
+//---------------+-------------------+-----------------------+---------------
+// SsGetColCon | <, > = | del [ |
+// | | Symbol += Zeichen | SsGetCon
+// | BLANK | |
+// | h, H, m, M, s, S | Symbol += Zeichen | SsGetTime
+// | sonst | del [ |
+// | | Symbol += Zeichen | SsGetCol
+//---------------+-------------------+-----------------------+---------------
+// SsGetTime | ] | Symbol += Zeichen | SsGetString
+// | h, H, m, M, s, S | Symbol += Zeichen, * | SsGetString
+// | sonst | del [; Symbol+=Zeichen| SsGetCol
+//---------------+-------------------+-----------------------+---------------
+// SsGetCol | ] | | SsStop
+// | sonst | Symbol += Zeichen |
+//---------------+-------------------+-----------------------+---------------
+// SsGetCon | >, = | Symbol+=Zeichen |
+// | ] | | SsStop
+// | sonst | Fehler | SsStop
+//---------------+-------------------+-----------------------+---------------
+// * : Sonderbedingung
+
+enum ScanState
+{
+ SsStop = 0,
+ SsStart = 1,
+ SsGetCon = 2, // Bedingung
+ SsGetString = 3, // Format
+ SsGetCol = 4, // Farbe
+ SsGetTime = 5, // [MM] fuer Zeiten
+ SsGetColCon = 6 // noch unentschieden
+};
+
+xub_StrLen SvNumberformat::ImpGetNumber(XubString& rString,
+ xub_StrLen& nPos,
+ XubString& sSymbol)
+{
+ xub_StrLen nStartPos = nPos;
+ xub_Unicode cToken;
+ xub_StrLen nLen = rString.Len();
+ if (nPos < nLen)
+ cToken = rString.GetChar(nPos);
+ sSymbol.Erase();
+ while (nPos < nLen-1 && cToken != ']') // bis ']'
+ {
+ if (cToken == ' ') // Blanks loeschen
+ {
+ rString.Erase(nPos,1);
+ nLen--;
+ }
+ else
+ {
+ nPos++;
+ sSymbol += cToken;
+ }
+ cToken = rString.GetChar(nPos);
+ }
+ return nPos - nStartPos;
+}
+
+
+short SvNumberformat::ImpNextSymbol(XubString& rString,
+ xub_StrLen& nPos,
+ XubString& sSymbol)
+{
+ short eType = SYMBOLTYPE_FORMAT;
+ xub_Unicode cToken;
+ xub_Unicode cLetter; // Zwischenergebnis
+ xub_StrLen nLen = rString.Len();
+ ScanState eState = SsStart;
+ sSymbol.Erase();
+ XubString* pKeywords = rScan.GetKeyword();
+ while (nPos < nLen && eState != SsStop)
+ {
+ cToken = rString.GetChar(nPos);
+ nPos++;
+ switch (eState)
+ {
+ case SsStart:
+ {
+ if (cToken == '[')
+ {
+ eState = SsGetColCon;
+ sSymbol += cToken;
+ }
+ else if (cToken == ';')
+ {
+ eState = SsGetString;
+ nPos--;
+ eType = SYMBOLTYPE_FORMAT;
+ }
+ else if (cToken == ']')
+ {
+ eState = SsStop;
+ eType = SYMBOLTYPE_ERROR;
+ }
+ else if (cToken == ' ') // Skip Blanks
+ {
+ rString.Erase(nPos-1,1);
+ nPos--;
+ nLen--;
+ }
+ else
+ {
+ sSymbol += cToken;
+ eState = SsGetString;
+ eType = SYMBOLTYPE_FORMAT;
+ }
+ }
+ break;
+ case SsGetColCon:
+ {
+ switch (cToken)
+ {
+ case '<':
+ case '>':
+ case '=':
+ {
+ sSymbol.EraseAllChars('[');
+ sSymbol += cToken;
+ cLetter = cToken;
+ eState = SsGetCon;
+ switch (cToken)
+ {
+ case '<': eType = NUMBERFORMAT_OP_LT; break;
+ case '>': eType = NUMBERFORMAT_OP_GT; break;
+ case '=': eType = NUMBERFORMAT_OP_EQ; break;
+ default: break;
+ }
+ }
+ break;
+ case ' ':
+ {
+ rString.Erase(nPos-1,1);
+ nPos--;
+ nLen--;
+ }
+ break;
+ case '$' :
+ { // Waehrung ab SV_NUMBERFORMATTER_VERSION_NEW_CURR
+ eType = SYMBOLTYPE_FORMAT;
+ sSymbol += cToken;
+ eState = SsGetString;
+ }
+ break;
+ default:
+ {
+ xub_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
+ {
+ sSymbol += cToken;
+ eState = SsGetTime;
+ cLetter = cToken;
+ }
+ else
+ {
+ sSymbol.EraseAllChars('[');
+ sSymbol += cToken;
+ eType = SYMBOLTYPE_COLOR;
+ eState = SsGetCol;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ case SsGetString:
+ {
+ if (cToken == ';')
+ eState = SsStop;
+ else
+ sSymbol += cToken;
+ }
+ break;
+ case SsGetTime:
+ {
+ if (cToken == ']')
+ {
+ sSymbol += cToken;
+ eState = SsGetString;
+ eType = SYMBOLTYPE_FORMAT;
+ }
+ else
+ {
+ xub_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 = SsGetCol;
+ }
+ }
+ else
+ {
+ sSymbol.EraseAllChars('[');
+ sSymbol += cToken;
+ eType = SYMBOLTYPE_COLOR;
+ eState = SsGetCol;
+ }
+ }
+ }
+ break;
+ case SsGetCon:
+ {
+ switch (cToken)
+ {
+ case '<':
+ {
+ eState = SsStop;
+ eType = SYMBOLTYPE_ERROR;
+ }
+ break;
+ case '>':
+ {
+ if (cLetter == '<')
+ {
+ sSymbol += cToken;
+ cLetter = ' ';
+ eState = SsStop;
+ eType = NUMBERFORMAT_OP_NE;
+ }
+ else
+ {
+ eState = SsStop;
+ eType = SYMBOLTYPE_ERROR;
+ }
+ }
+ break;
+ case '=':
+ {
+ if (cLetter == '<')
+ {
+ sSymbol += cToken;
+ cLetter = ' ';
+ eType = NUMBERFORMAT_OP_LE;
+ }
+ else if (cLetter == '>')
+ {
+ sSymbol += cToken;
+ cLetter = ' ';
+ eType = NUMBERFORMAT_OP_GE;
+ }
+ else
+ {
+ eState = SsStop;
+ eType = SYMBOLTYPE_ERROR;
+ }
+ }
+ break;
+ case ' ':
+ {
+ rString.Erase(nPos-1,1);
+ nPos--;
+ nLen--;
+ }
+ break;
+ default:
+ {
+ eState = SsStop;
+ nPos--;
+ }
+ break;
+ }
+ }
+ break;
+ case SsGetCol:
+ {
+ if (cToken == ']')
+ eState = SsStop;
+ else
+ sSymbol += cToken;
+ }
+ break;
+ default:
+ break;
+ } // of switch
+ } // of while
+
+ return eType;
+}
+
+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;
+ LanguageType eOldTmpLang, eOldNewLang;
+ if ( pHackConverter )
+ { // werden nur hierbei gebraucht
+ bOldConvert = rScan.GetConvertMode();
+ eOldTmpLang = rScan.GetTmpLnge();
+ eOldNewLang = rScan.GetNewLnge();
+ }
+ XubString 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 );
+ }
+ XubString aColorName = NumFor[i].GetColorName();
+ 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;
+ XubString 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;
+ if ( rHdr.BytesLeft() )
+ { // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR
+ USHORT nId;
+ rStream >> nId;
+ DBG_ASSERT( nId == nNewCurrencyVersionId, "SvNumberformat::Load: unknown nId" );
+ if ( nId == nNewCurrencyVersionId )
+ {
+ bNewCurrencyLoaded = TRUE;
+ rStream >> bNewCurrency;
+ if ( bNewCurrency )
+ {
+ for ( USHORT j=0; j<4; j++ )
+ {
+ NumFor[j].LoadNewCurrencyMap( rStream );
+ }
+ }
+ }
+ }
+ 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.
+ XubString aStr( sFormatstring );
+ xub_StrLen nCheckPos;
+ SvNumberformat* pFormat = new SvNumberformat( aStr, &rScan, &rISc,
+ nCheckPos, eLnge, bStandard );
+ DBG_ASSERT( !nCheckPos, "SvNumberformat::Load: NewCurrencyRescan nCheckPos" );
+ CopyNumberformat( *pFormat );
+ delete pFormat;
+ // Zustaende wiederherstellen
+ eType |= nDefined;
+ if ( nNewStandard )
+ SetNewStandardDefined( nNewStandard );
+ }
+ SetComment( aComment );
+
+ rHdr.EndEntry();
+
+ 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;
+ ULONG nKey;
+ short nType = eType;
+ XubString aFormatString( sFormatstring );
+ rConverter.PutandConvertEntry( aFormatString, nCheckPos, nType, nKey,
+ eConvertFrom, eConvertTo );
+ const SvNumberformat* pFormat = rConverter.GetEntry( nKey );
+ DBG_ASSERT( pFormat, "SvNumberformat::ConvertLanguage: Conversion ohne Format" );
+ if ( pFormat )
+ {
+ CopyNumberformat( *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++ )
+ {
+ XubString aColorName = NumFor[i].GetColorName();
+ Color* pColor = rScan.GetColor( aColorName );
+ NumFor[i].SetColor( pColor, aColorName );
+ }
+ }
+}
+
+
+// static
+void SvNumberformat::LoadString( SvStream& rStream, XubString& 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
+{
+ XubString aFormatstring( sFormatstring );
+ XubString 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
+ }
+
+ rHdr.StartEntry();
+ rStream.WriteByteString( aFormatstring, rStream.GetStreamCharSet() );
+ rStream << eType << fLimit1 << fLimit2 << (USHORT) eOp1 << (USHORT) eOp2
+ << bStandard << 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 );
+ }
+ }
+ rHdr.EndEntry();
+}
+
+
+BOOL SvNumberformat::HasNewCurrency() const
+{
+ for ( USHORT j=0; j<4; j++ )
+ {
+ if ( NumFor[j].HasNewCurrency() )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+BOOL SvNumberformat::GetNewCurrencySymbol( XubString& rSymbol,
+ XubString& rExtension ) const
+{
+ for ( USHORT j=0; j<4; j++ )
+ {
+ if ( NumFor[j].GetNewCurrencySymbol( rSymbol, rExtension ) )
+ return TRUE;
+ }
+ rSymbol.Erase();
+ rExtension.Erase();
+ return FALSE;
+}
+
+
+void SvNumberformat::Build50Formatstring( XubString& rStr ) const
+{
+ rStr.Erase();
+ xub_StrLen nStartPos, nPos, nLen;
+ nLen = sFormatstring.Len();
+ nStartPos = 0;
+ while ( (nPos = sFormatstring.SearchAscii( "[$", nStartPos )) != STRING_NOTFOUND )
+ {
+ xub_StrLen nEnd;
+ if ( (nEnd = GetQuoteEnd( sFormatstring, nPos )) < nLen )
+ {
+ rStr += sFormatstring.Copy( nStartPos, ++nEnd - nStartPos );
+ nStartPos = nEnd;
+ }
+ else
+ {
+ rStr += sFormatstring.Copy( nStartPos, nPos - nStartPos );
+ nStartPos = nPos + 2;
+ xub_StrLen nDash;
+ nEnd = nStartPos - 1;
+ do
+ {
+ nDash = sFormatstring.Search( '-', ++nEnd );
+ } while ( (nEnd = GetQuoteEnd( sFormatstring, nDash )) < nLen );
+ xub_StrLen nClose;
+ nEnd = nStartPos - 1;
+ do
+ {
+ nClose = sFormatstring.Search( ']', ++nEnd );
+ } while ( (nEnd = GetQuoteEnd( sFormatstring, nClose )) < nLen );
+ nPos = ( nDash < nClose ? nDash : nClose );
+ if ( sFormatstring.GetChar( nStartPos ) == '"' )
+ rStr += sFormatstring.Copy( nStartPos, nPos - nStartPos );
+ else
+ {
+ rStr += '"';
+ rStr += sFormatstring.Copy( nStartPos, nPos - nStartPos );
+ rStr += '"';
+ }
+ nStartPos = nClose + 1;
+ }
+ }
+ if ( nLen > nStartPos )
+ rStr += sFormatstring.Copy( nStartPos, nLen - nStartPos );
+}
+
+
+void SvNumberformat::ImpGetOutputStandard(double& fNumber, XubString& OutString)
+{
+ OutString.Erase();
+ USHORT nStandardPrec = rScan.GetStandardPrec();
+ if ( fabs(fNumber) > 1.0E15 ) // #58531# war E16
+ SolarMath::DoubleToString(OutString, fNumber, 'E', nStandardPrec /*2*/,
+ rIntl().GetNumDecimalSep());
+ else
+ {
+ SolarMath::DoubleToString( OutString, fNumber, 'F', nStandardPrec /*2*/,
+ rIntl().GetNumDecimalSep(), TRUE );
+ if (OutString.GetChar(0) == '-' &&
+ OutString.GetTokenCount('0') == OutString.Len())
+ OutString.EraseLeadingChars('-'); // nicht -0
+ }
+ return;
+}
+
+void SvNumberformat::ImpGetOutputInputLine(double fNumber, XubString& 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;
+ }
+
+ SolarMath::DoubleToString( OutString, fNumber, 'A', INT_MAX,
+ rIntl().GetNumDecimalSep(), 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(XubString& sString,
+ XubString& 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 SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ OutString += (xub_Unicode) 0x1B;
+ OutString += rInfo.sStrArray[i].GetChar(1);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ InsertBlanks( OutString, OutString.Len(),
+ rInfo.sStrArray[i].GetChar(1) );
+ break;
+ case NF_KEY_GENERAL : // #77026# "General" is the same as "@"
+ case 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,
+ XubString& 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;
+ }
+ 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);
+ break;
+ case NUMBERFORMAT_DATE:
+ {
+ if (fabs(fNumber) > _D_MAX_LONG_) // zu gross
+ {
+ OutString = rScan.GetErrorString();
+ return FALSE;
+ }
+ long nNum = (long) floor(fNumber);
+ Date aDate = *(rScan.GetNullDate()) + nNum;
+ OutString = rIntl().GetDate(aDate);
+ }
+ break;
+ case NUMBERFORMAT_TIME:
+ {
+ if (fNumber < 0.0) // -2:20 -> 21:40
+ {
+ fNumber = -fNumber;
+ fNumber -= floor(fNumber); // Datum hier egal
+ fNumber = 1.0 - fNumber;
+ }
+ else
+ fNumber -= floor(fNumber); // "
+
+ ULONG nTime = (ULONG) floor(0.5 + fNumber * 86400.0);
+ ULONG nHour = nTime / 3600;
+ nHour = nHour % 24;
+ if (nHour < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nHour);
+ OutString += rIntl().GetTimeSep();
+ ULONG nMin = (nTime%3600) / 60;
+ if (nMin < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nMin);
+ OutString += rIntl().GetTimeSep();
+ ULONG nSec = (nTime%60);
+ if (nSec < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nSec);
+ }
+ break;
+ case NUMBERFORMAT_DATETIME:
+ {
+ if (fabs(fNumber) > _D_MAX_LONG_) // zu gross
+ {
+ OutString = rScan.GetErrorString();
+ return FALSE;
+ }
+ double fNum1 = floor(fNumber);
+ long nNum1 = (long) fNum1;
+ Date aDate = *(rScan.GetNullDate()) + nNum1;
+ OutString = rIntl().GetDate(aDate);
+ OutString += ' ';
+ fNumber -= fNum1;
+ ULONG nTime = (ULONG) floor(0.5 + fNumber * 86400.0);
+ ULONG nHour = nTime / 3600;
+ if (nHour < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nHour);
+ OutString += rIntl().GetTimeSep();
+ ULONG nMin = (nTime%3600) / 60;
+ if (nMin < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nMin);
+ }
+ break;
+ case NUMBERFORMAT_FRACTION:
+ case NUMBERFORMAT_CURRENCY: // keine Standardoptimierung
+ break;
+ case NUMBERFORMAT_PERCENT:
+ {
+ if (fabs(fNumber) < _D_MAX_D_BY_100)
+ {
+ fNumber *= 100;
+ SolarMath::DoubleToString(OutString, fNumber, 'F', 2,
+ rIntl().GetNumDecimalSep());
+ if (OutString.GetChar(0) == '-' &&
+ OutString.GetTokenCount('0') == OutString.Len())
+ OutString.EraseLeadingChars('-'); // nicht -0
+ OutString+= '%';
+ }
+ else
+ OutString = rScan.GetErrorString();
+ }
+ break;
+ case NUMBERFORMAT_SCIENTIFIC:
+ {
+ SolarMath::DoubleToString(OutString, fNumber, 'E', 2,
+ rIntl().GetNumDecimalSep());
+ return FALSE;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else // keine Standards mehr
+ {
+ 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 SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ OutString += (xub_Unicode) 0x1B;
+ OutString += rInfo.sStrArray[i].GetChar(1);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ InsertBlanks( OutString, OutString.Len(),
+ rInfo.sStrArray[i].GetChar(1) );
+ break;
+ case SYMBOLTYPE_STRING:
+ case SYMBOLTYPE_CURRENCY:
+ OutString += rInfo.sStrArray[i];
+ break;
+ case 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:
+ {
+ XubString 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, x2, y2;
+
+ 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:
+ double fTest;
+ BOOL bStop = FALSE;
+ while (!bStop)
+ {
+ 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)
+ {
+ x2 = ((y0+nBasis)/y1)*x1 - x0; // naechste Farey-Zahl
+ 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
+ sStr.AssignAscii( aBuf );
+ }
+ sFrac = String::CreateFromInt32(nFrac);
+ sDiv = String::CreateFromInt32(nDiv);
+ if (rInfo.nCntPre > 0 && nFrac == 0)
+ {
+ sFrac.Erase();
+ sDiv.Erase();
+ }
+
+ USHORT j = nAnz-1; // letztes Symbol->rueckw.
+ xub_StrLen k; // Nenner:
+ bRes |= ImpNumberFill(sDiv, fNumber, k, j, nIx, SYMBOLTYPE_FRAC);
+ BOOL bCont = TRUE;
+ if (rInfo.nTypeArray[j] == 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, SYMBOLTYPE_FRACBLANK);
+ if (rInfo.nTypeArray[j] == 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;
+ }
+ XubString sStr;
+ SolarMath::DoubleToString(sStr, fNumber, 'E',
+ rInfo.nCntPre+rInfo.nCntPost-1);
+
+ XubString ExpStr;
+ short nExpSign = 1;
+ xub_StrLen nExPos = sStr.Search('E');
+ if ( nExPos != STRING_NOTFOUND )
+ {
+ ExpStr = sStr.Copy( nExPos );
+ sStr.Erase( nExPos );
+ ExpStr.Erase(0,2); // get rid of "E+" or "E-"
+ sStr.EraseAllChars('.'); // Komma (Punkt) weg
+ if (rInfo.nCntPre != 1) // Reskalierung Exp
+ {
+ sal_Int32 nExp = ExpStr.ToInt32();
+ nExp -= sal_Int32(rInfo.nCntPre)-1;
+ ExpStr = XubString::CreateFromInt32( nExp );
+ }
+ if (ExpStr.GetChar(0) == '-')
+ {
+ nExpSign = -1;
+ ExpStr.Erase(0,1); // Vorzeichen weg
+ }
+ }
+ USHORT j = nAnz-1; // letztes Symbol
+ xub_StrLen k;
+ bRes |= ImpNumberFill(ExpStr, fNumber, k, j, nIx, SYMBOLTYPE_EXP);
+
+ while (k > 0) // fuehrende Nullen loeschen
+ {
+ k--;
+ if (ExpStr.GetChar(k) == '0')
+ ExpStr.Erase(0,1);
+ }
+ BOOL bCont = TRUE;
+ if (rInfo.nTypeArray[j] == SYMBOLTYPE_EXP)
+ {
+ const XubString& 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;
+ return bRes;
+ }
+ break;
+ }
+ }
+ return bRes;
+}
+
+BOOL SvNumberformat::ImpGetTimeOutput(double fNumber,
+ USHORT nIx,
+ XubString& OutString)
+{
+ 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 < 12 )
+ {
+ bInputLine = TRUE;
+ nCntPost = 12;
+ }
+ else
+ {
+ bInputLine = FALSE;
+ nCntPost = xub_StrLen(rInfo.nCntPost);
+ }
+ if (bSign && !rInfo.bThousand) // kein []-Format
+ fNumber = 1.0 - fNumber; // "Kehrwert"
+ double fTime = fNumber * 86400.0;
+ double fFactor = pow( 10.0, double(nCntPost) );
+ fTime = floor( 0.5 + fTime * fFactor ) / fFactor; // runden
+ if (bSign && fTime == 0.0)
+ bSign = FALSE; // nicht -00:00:00
+
+// ULONG nTime = (ULONG) floor(fTime); // Vorkommaanteil
+
+ ULONG nSeconds = 0;
+ ULONG nHours = 0;
+ if( floor( fTime ) > _D_MAX_U_LONG_ )
+ {
+ if( (floor( fTime )/3600.0) > _D_MAX_U_LONG_ )
+ {
+ OutString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###" ) );
+ return FALSE;
+ }
+ else
+ {
+ nSeconds = (ULONG)(((fTime/3600.0) - floor( fTime/3600.0 ))*3600.0);
+ nHours = (ULONG)(fTime/3600.0);
+ }
+ }
+ else
+ nSeconds = (ULONG)floor( fTime );
+
+ XubString sSecStr;
+ SolarMath::DoubleToString(sSecStr, fTime-nSeconds, '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' );
+ nCntPost = sSecStr.Len();
+ }
+ 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;
+ }
+ xub_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 SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ OutString += (xub_Unicode) 0x1B;
+ OutString += rInfo.sStrArray[i].GetChar(1);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ InsertBlanks( OutString, OutString.Len(),
+ rInfo.sStrArray[i].GetChar(1) );
+ break;
+ case SYMBOLTYPE_STRING:
+ case SYMBOLTYPE_CURRENCY:
+ OutString += rInfo.sStrArray[i];
+ break;
+ case SYMBOLTYPE_DIGIT:
+ {
+ xub_StrLen nLen = ( bInputLine && i > 0 &&
+ rInfo.sStrArray[i-1].GetChar(0) == rIntl().GetNumDecimalSep() ?
+ 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.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "AM" ) );
+ else
+ OutString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "PM" ) );
+ }
+ break;
+ case NF_KEY_AP: // A/P
+ {
+ if (cAmPm == 'a')
+ OutString += 'a';
+ else
+ OutString += 'p';
+ }
+ break;
+ case NF_KEY_MI: // M
+ OutString += String::CreateFromInt32(nMin);
+ break;
+ case NF_KEY_MMI: // MM
+ {
+ if (nMin < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nMin);
+ }
+ break;
+ case NF_KEY_H: // H
+ OutString += String::CreateFromInt32(nHour);
+ break;
+ case NF_KEY_HH: // HH
+ {
+ if (nHour < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nHour);
+ }
+ break;
+ case NF_KEY_S: // S
+ OutString += String::CreateFromInt32(nSec);
+ break;
+ case NF_KEY_SS: // SS
+ {
+ if (nSec < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nSec);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if (bSign && rInfo.bThousand)
+ OutString.Insert('-',0);
+ return bRes;
+}
+
+BOOL SvNumberformat::ImpGetDateOutput(double fNumber,
+ USHORT nIx,
+ XubString& OutString)
+{
+ BOOL bRes = FALSE;
+ if (fabs(fNumber) > _D_MAX_LONG_) // zu gross
+ {
+ OutString = rScan.GetErrorString();
+ return FALSE;
+ }
+ long nNum = (long) floor(fNumber);
+ Date aDate = *(rScan.GetNullDate()) + nNum;
+ const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
+ const USHORT nAnz = NumFor[nIx].GetnAnz();
+ for (USHORT i = 0; i < nAnz; i++)
+ {
+ switch (rInfo.nTypeArray[i])
+ {
+ case SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ OutString += (xub_Unicode) 0x1B;
+ OutString += rInfo.sStrArray[i].GetChar(1);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ InsertBlanks( OutString, OutString.Len(),
+ rInfo.sStrArray[i].GetChar(1) );
+ break;
+ case SYMBOLTYPE_STRING:
+ case SYMBOLTYPE_CURRENCY:
+ OutString += rInfo.sStrArray[i];
+ break;
+ case NF_KEY_M: // M
+ OutString += String::CreateFromInt32(aDate.GetMonth());
+ break;
+ case NF_KEY_MM: // MM
+ {
+ if (aDate.GetMonth() < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(aDate.GetMonth());
+ }
+ break;
+ case NF_KEY_MMM: // MMM
+ OutString += rIntl().GetAbbrevMonthText(aDate.GetMonth());
+ break;
+ case NF_KEY_MMMM: // MMMM
+ OutString += rIntl().GetMonthText(aDate.GetMonth());
+ break;
+ case NF_KEY_Q: // Q
+ case NF_KEY_QQ: // QQ
+ {
+ if (rInfo.nTypeArray[i] == NF_KEY_Q)
+ OutString += 'Q';
+ USHORT nMonth = aDate.GetMonth();
+ if (nMonth <= 3)
+ OutString += '1';
+ else if (nMonth <=6)
+ OutString += '2';
+ else if (nMonth <= 9)
+ OutString += '3';
+ else
+ OutString += '4';
+ if (rInfo.nTypeArray[i] == NF_KEY_QQ)
+ {
+ OutString += '.'; // #40387# "1. Quartal" mit Leerzeichen
+ OutString += ' ';
+ OutString += rScan.GetQuartalString();
+ }
+ }
+ break;
+ case NF_KEY_T: // T
+ OutString += String::CreateFromInt32(aDate.GetDay());
+ break;
+ case NF_KEY_TT: // TT
+ {
+ if (aDate.GetDay() < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(aDate.GetDay());
+ }
+ break;
+ case NF_KEY_TTT: // TTT
+ OutString += rIntl().GetAbbrevDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_TTTT: // TTTT
+ OutString += rIntl().GetDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_JJ: // JJ
+ {
+ XubString sStr = String::CreateFromInt32(aDate.GetYear());
+ sStr.Erase(0,2);
+ OutString += sStr;
+ }
+ break;
+ case NF_KEY_JJJJ: // JJJJ
+ OutString += String::CreateFromInt32(aDate.GetYear());
+ break;
+ case NF_KEY_NN: // NN
+ OutString += rIntl().GetAbbrevDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_NNN: // NNN
+ OutString += rIntl().GetDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_NNNN: // NNNN
+ {
+ OutString += rIntl().GetDayText(aDate.GetDayOfWeek());
+ OutString += rIntl().GetLongDateDayOfWeekSep();
+ }
+ break;
+ case NF_KEY_WW : // WW Kalenderwoche
+ OutString += String::CreateFromInt32(
+ aDate.GetWeekOfYear( rIntl().GetWeekStart(),
+ rIntl().GetWeekCountStart() ) );
+ break;
+ default:
+ break;
+ }
+ }
+ return bRes;
+}
+
+BOOL SvNumberformat::ImpGetDateTimeOutput(double fNumber,
+ USHORT nIx,
+ XubString& OutString)
+{
+ BOOL bRes = FALSE;
+ if (fabs(fNumber) > _D_MAX_LONG_) // zu gross
+ {
+ OutString = rScan.GetErrorString();
+ return FALSE;
+ }
+ double fNum1 = floor(fNumber); // -> Datum
+ double fNum2 = fNumber - fNum1; // -> Zeit
+ long nNum1 = (long) fNum1;
+
+ Date aDate = *(rScan.GetNullDate()) + nNum1;
+
+ const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
+ double fTime = fNum2*86400.0;
+ double fFactor = pow(10.0,rInfo.nCntPost);
+ fTime = floor(0.5 + fTime * fFactor) / fFactor; // runden
+
+// ULONG nTime = (ULONG) floor(fTime); // Vorkommaanteil
+
+ ULONG nSeconds = 0;
+ ULONG nHours = 0;
+ if( floor( fTime ) > _D_MAX_U_LONG_ )
+ {
+ if( (floor( fTime )/3600.0) > _D_MAX_U_LONG_ )
+ {
+ OutString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###" ) );
+ return FALSE;
+ }
+ else
+ {
+ nSeconds = (ULONG)(((fTime/3600.0) - floor( fTime/3600.0 ))*3600.0);
+ nHours = (ULONG)(fTime/3600.0);
+ }
+ }
+ else
+ nSeconds = (ULONG)floor( fTime );
+
+ XubString sSecStr;
+ SolarMath::DoubleToString(sSecStr, fTime-nSeconds, 'F', rInfo.nCntPost);
+ sSecStr.EraseLeadingChars('0');
+ sSecStr.EraseLeadingChars('.');
+ 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;
+ }
+ xub_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 SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ OutString += (xub_Unicode) 0x1B;
+ OutString += rInfo.sStrArray[i].GetChar(1);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ InsertBlanks( OutString, OutString.Len(),
+ rInfo.sStrArray[i].GetChar(1) );
+ break;
+ case SYMBOLTYPE_STRING:
+ case SYMBOLTYPE_CURRENCY:
+ OutString += rInfo.sStrArray[i];
+ break;
+ case SYMBOLTYPE_DIGIT:
+ {
+ const xub_StrLen nLen = rInfo.sStrArray[i].Len();
+ const xub_StrLen nCntPost = xub_StrLen(rInfo.nCntPost);
+ 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.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "AM" ) );
+ else
+ OutString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "PM" ) );
+ }
+ break;
+ case NF_KEY_AP: // A/P
+ {
+ if (cAmPm == 'a')
+ OutString += 'a';
+ else
+ OutString += 'p';
+ }
+ break;
+ case NF_KEY_MI: // M
+ OutString += String::CreateFromInt32(nMin);
+ break;
+ case NF_KEY_MMI: // MM
+ {
+ if (nMin < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nMin);
+ }
+ break;
+ case NF_KEY_H: // H
+ OutString += String::CreateFromInt32(nHour);
+ break;
+ case NF_KEY_HH: // HH
+ {
+ if (nHour < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nHour);
+ }
+ break;
+ case NF_KEY_S: // S
+ OutString += String::CreateFromInt32(nSec);
+ break;
+ case NF_KEY_SS: // SS
+ {
+ if (nSec < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(nSec);
+ }
+ break;
+ case NF_KEY_M: // M
+ OutString += String::CreateFromInt32(aDate.GetMonth());
+ break;
+ case NF_KEY_MM: // MM
+ {
+ if (aDate.GetMonth() < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(aDate.GetMonth());
+ }
+ break;
+ case NF_KEY_MMM: // MMM
+ OutString += rIntl().GetAbbrevMonthText(aDate.GetMonth());
+ break;
+ case NF_KEY_MMMM: // MMMM
+ OutString += rIntl().GetMonthText(aDate.GetMonth());
+ break;
+ case NF_KEY_Q: // Q
+ case NF_KEY_QQ: // QQ
+ {
+ USHORT nMonth = aDate.GetMonth();
+ if (nMonth <= 3)
+ OutString += '1';
+ else if (nMonth <=6)
+ OutString += '2';
+ else if (nMonth <= 9)
+ OutString += '3';
+ else
+ OutString += '4';
+ OutString += '.'; // #40387# "1. Quartal" mit Leerzeichen
+ OutString += ' ';
+ OutString += rScan.GetQuartalString();
+ if (rInfo.nTypeArray[i] == NF_KEY_QQ)
+ {
+ OutString += ' ';
+ OutString += String::CreateFromInt32(aDate.GetYear());
+ }
+ }
+ break;
+ case NF_KEY_T: // T
+ OutString += String::CreateFromInt32(aDate.GetDay());
+ break;
+ case NF_KEY_TT: // TT
+ {
+ if (aDate.GetDay() < 10)
+ OutString += '0';
+ OutString += String::CreateFromInt32(aDate.GetDay());
+ }
+ break;
+ case NF_KEY_TTT: // TTT
+ OutString += rIntl().GetAbbrevDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_TTTT: // TTTT
+ OutString += rIntl().GetDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_JJ: // JJ
+ {
+ XubString sStr = String::CreateFromInt32(aDate.GetYear());
+ sStr.Erase(0,2);
+ OutString += sStr;
+ }
+ break;
+ case NF_KEY_JJJJ: // JJJJ
+ OutString += String::CreateFromInt32(aDate.GetYear());
+ break;
+ case NF_KEY_NN: // NN
+ OutString += rIntl().GetAbbrevDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_NNN: // NNN
+ OutString += rIntl().GetDayText(aDate.GetDayOfWeek());
+ break;
+ case NF_KEY_NNNN: // NNNN
+ OutString += rIntl().GetDayText(aDate.GetDayOfWeek());
+ OutString += rIntl().GetLongDateDayOfWeekSep();
+ break;
+ case NF_KEY_WW : // WW Kalenderwoche
+ OutString += String::CreateFromInt32(
+ aDate.GetWeekOfYear( rIntl().GetWeekStart(),
+ rIntl().GetWeekCountStart() ) );
+ break;
+ default:
+ break;
+ }
+ }
+ return bRes;
+}
+
+BOOL SvNumberformat::ImpGetNumberOutput(double fNumber,
+ USHORT nIx,
+ XubString& 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;
+ 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;
+ XubString sStr;
+ long nPrecExp;
+ BOOL bInteger = FALSE;
+ if (rInfo.nThousand == FLAG_STANDARD_IN_FORMAT) // Hack: "Standard"
+ { // im Format
+ bSign = FALSE; // dann Vorzeichen per Format, nicht per Zahl
+ // und keine Zahlformatiererei an dieser
+ } // Stelle!
+ else
+ {
+ 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)
+ {
+ SolarMath::DoubleToString( sStr, fNumber, 'F', 15-nPrecExp );
+ for (long l = 15-nPrecExp; l < (long) rInfo.nCntPost; l++)
+ sStr += '0';
+ }
+ else
+ SolarMath::DoubleToString( sStr, fNumber, '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
+ {
+ SolarMath::DoubleToString(sStr, fNumber, 'F', 0);
+ sStr.EraseLeadingChars('0'); // fuehrende Nullen weg
+ }
+ xub_StrLen nPoint = sStr.Search( '.' );
+ if ( nPoint != STRING_NOTFOUND )
+ {
+ register const xub_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]) != SYMBOLTYPE_DECSEP)
+ {
+ switch ( nType )
+ {
+ case SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ sStr.Insert( (xub_Unicode) 0x1B, k /*++*/ );
+ sStr.Insert(rInfo.sStrArray[j].GetChar(1),k);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) );
+ break;
+ case SYMBOLTYPE_STRING:
+ case SYMBOLTYPE_CURRENCY:
+ sStr.Insert(rInfo.sStrArray[j],k);
+ break;
+ case SYMBOLTYPE_THSEP:
+ if (rInfo.nThousand == 0)
+ sStr.Insert(rInfo.sStrArray[j],k);
+ break;
+ case SYMBOLTYPE_DIGIT:
+ {
+ const XubString& rStr = rInfo.sStrArray[j];
+ const xub_Unicode* p1 = rStr.GetBuffer();
+ register const xub_Unicode* p = p1 + rStr.Len();
+ while ( p1 < p-- )
+ {
+ const xub_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(rIntl().GetCurrBankSymbol(), k);
+ break;
+ case NF_KEY_GENERAL: // Standard im String
+ {
+ XubString 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 && sStr.GetChar( sStr.Len() - 1 ) == rIntl().GetNumDecimalSep() )
+ sStr.Erase( sStr.Len() - 1 ); // DecSep am Ende ohne Nachkommastellen weg
+ if (bSign)
+ sStr.Insert('-',0);
+ OutString = sStr;
+ return bRes;
+}
+
+BOOL SvNumberformat::ImpNumberFillWithThousands(
+ XubString& sStr, // Zahlstring
+ double& rNumber,
+ xub_StrLen k, // Zeiger darin
+ USHORT j, // Symbolzeiger
+ USHORT nIx, // Teilformatstring
+ USHORT nDigCnt) // Anz Dig. im For.
+{
+ BOOL bRes = FALSE;
+ BOOL bLeading = FALSE; // fuehrende 0
+ xub_StrLen nAnzLeadingChars = 0; // Anzahl fuehrende Nullen oder Blanks
+ USHORT nThousandCnt = 0; // Anzahl Ziffern vor letztem .
+ xub_StrLen nLeadingStringChars = 0; // inserted StringChars vor Zahl
+ USHORT nDigitCount = 0; // Zaehlt Vorkommaziffern
+ BOOL bStop = FALSE;
+ const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
+ const xub_Unicode cThousandSep = rIntl().GetNumThousandSep();
+ while (!bStop) // rueckwaerts
+ {
+ if (j == 0)
+ bStop = TRUE;
+ switch (rInfo.nTypeArray[j])
+ {
+ case SYMBOLTYPE_DECSEP:
+ case SYMBOLTYPE_STRING:
+ case SYMBOLTYPE_CURRENCY:
+ sStr.Insert(rInfo.sStrArray[j],k);
+ if ( k == 0 )
+ nLeadingStringChars += rInfo.sStrArray[j].Len();
+ break;
+ case SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ sStr.Insert( (xub_Unicode) 0x1B, k/*++*/ );
+ sStr.Insert(rInfo.sStrArray[j].GetChar(1),k);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) );
+ break;
+ case SYMBOLTYPE_THSEP:
+ {
+ if (k > 0 && rInfo.nThousand == 0)
+ {
+ sStr.Insert(rInfo.sStrArray[j],k);
+ nThousandCnt = 0;
+ }
+ }
+ break;
+ case SYMBOLTYPE_DIGIT:
+ {
+ const XubString& rStr = rInfo.sStrArray[j];
+ const xub_Unicode* p1 = rStr.GetBuffer();
+ register const xub_Unicode* p = p1 + rStr.Len();
+ while ( p1 < p-- )
+ {
+ nDigitCount++;
+ const xub_Unicode c = *p;
+ if (c == cThousandSep)
+ {
+ nDigitCount--;
+ if (k > 0)
+ {
+ sStr.Insert(c,k);
+ nThousandCnt = 0;
+ }
+ }
+ else if (k > 0)
+ {
+ k--;
+ nThousandCnt++;
+ }
+ else
+ bLeading = TRUE;
+ if (bLeading)
+ {
+ if (c == '?')
+ {
+ sStr.Insert(' ',0);
+ nAnzLeadingChars++;
+ }
+ else if (c == '0')
+ {
+ sStr.Insert('0',0);
+ nAnzLeadingChars++;
+ }
+ }
+ if (nDigitCount == nDigCnt && k > 0)
+ { // mehr Zahlen als Stellen
+ ImpDigitFill(sStr, 0, k, nIx, nThousandCnt);
+ }
+ }
+ }
+ break;
+ case NF_KEY_CCC: // CCC-Waehrung
+ sStr.Insert(rIntl().GetCurrBankSymbol(), k);
+ break;
+ case NF_KEY_GENERAL: // Standard im String
+ {
+ XubString sNum;
+ ImpGetOutputStandard(rNumber, sNum);
+ sNum.EraseLeadingChars('-');
+ sStr.Insert(sNum, k);
+ }
+ break;
+
+ default:
+ break;
+ } // switch
+ j--; // naechster String
+ } // while
+ k += nLeadingStringChars + nAnzLeadingChars;
+ if (k > nLeadingStringChars)
+ ImpDigitFill(sStr, nLeadingStringChars, k, nIx, nThousandCnt);
+/*
+ if (k > 0 && rInfo.bThousand) // noch Ziffern da
+ { // Aufuellen mit .
+ while (k > 0)
+ {
+ if (nThousandCnt > 2)
+ { // hier muss . dazwischen
+ sStr.Insert(rIntl().GetNumThousandSep(),k);
+ nThousandCnt = 1;
+ }
+ else
+ nThousandCnt++;
+ k--;
+ }
+ }
+*/
+ return bRes;
+}
+
+void SvNumberformat::ImpDigitFill(
+ XubString& sStr, // Zahlstring
+ xub_StrLen nStart, // Start der Ziffern
+ xub_StrLen& k, // Zeiger darin
+ USHORT nIx, // Index Teilstring
+ USHORT nThousandCnt ) // Anzahl seit .
+{
+ if (NumFor[nIx].Info().bThousand) // noch Ziffern da
+ { // Aufuellen mit .
+ while (k > nStart)
+ {
+ if (nThousandCnt > 2)
+ { // hier muss . dazwischen
+ sStr.Insert(rIntl().GetNumThousandSep(),k);
+ nThousandCnt = 1;
+ }
+ else
+ nThousandCnt++;
+ k--;
+ }
+ }
+ else // einfach ueberspringen
+ k = nStart;
+}
+
+BOOL SvNumberformat::ImpNumberFill(XubString& sStr, // Zahlstring
+ double& rNumber, // Zahl fuer Standard
+ xub_StrLen& k, // Zeigen darin
+ USHORT& j, // Symbolzeiger
+ USHORT nIx, // Teilformatstring
+ short eSymbolType ) // Abbruchtyp
+{
+ BOOL bRes = FALSE;
+ k = sStr.Len(); // hinter letzter Ziffer
+ BOOL bLeading = FALSE; // fuehrende ? oder 0
+ const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
+ const xub_Unicode cThousandSep = rIntl().GetNumThousandSep();
+ short nType;
+ while (j > 0 && (nType = rInfo.nTypeArray[j]) != eSymbolType )
+ { // rueckwaerts:
+ switch ( nType )
+ {
+ case SYMBOLTYPE_STAR:
+ if( bStarFlag )
+ {
+ sStr.Insert( xub_Unicode(0x1B), k++ );
+ sStr.Insert(rInfo.sStrArray[j].GetChar(1),k);
+ bRes = TRUE;
+ }
+ break;
+ case SYMBOLTYPE_BLANK:
+ k = InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) );
+ break;
+ case SYMBOLTYPE_DIGIT:
+ {
+ const XubString& rStr = rInfo.sStrArray[j];
+ const xub_Unicode* p1 = rStr.GetBuffer();
+ register const xub_Unicode* p = p1 + rStr.Len();
+ while ( p1 < p-- )
+ {
+ const xub_Unicode c = *p;
+ if (c == cThousandSep)
+ {
+ if (k > 0)
+ sStr.Insert(c,k);
+ }
+ else if (k > 0)
+ k--;
+ else
+ bLeading = TRUE;
+ if (bLeading)
+ {
+ if (c == '?')
+ sStr.Insert(' ',0);
+ else if (c == '0')
+ sStr.Insert('0',0);
+ } // of if
+ } // of for
+ } // of case digi
+ break;
+ case NF_KEY_CCC: // CCC-Waehrung
+ sStr.Insert(rIntl().GetCurrBankSymbol(), k);
+ break;
+ case NF_KEY_GENERAL: // Standard im String
+ {
+ XubString 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 ImpSvNumberformatInfo& rInfo = NumFor[0].Info();
+ bThousand = rInfo.bThousand;
+ nPrecision = GetFormatPrecision();
+ Color* pColor = NumFor[1].GetColor();
+ if (fLimit1 == 0.0 && fLimit2 == 0.0 && pColor
+ && (*pColor == rScan.GetRedColor()))
+ IsRed = TRUE;
+ else
+ IsRed = FALSE;
+ if (bStandard && rInfo.eScannedType == NUMBERFORMAT_NUMBER)
+ // StandardFormat
+ nAnzLeading = 1;
+ else
+ {
+ nAnzLeading = 0;
+ BOOL bStop = FALSE;
+ USHORT i = 0;
+ const USHORT nAnz = NumFor[0].GetnAnz();
+ while (!bStop && i < nAnz)
+ {
+ short nType = rInfo.nTypeArray[i];
+ if ( nType == SYMBOLTYPE_DIGIT)
+ {
+ register const xub_Unicode* p = rInfo.sStrArray[i].GetBuffer();
+ while ( *p == '#' )
+ p++;
+ while ( *p++ == '0' )
+ nAnzLeading++;
+ }
+ else if (nType == SYMBOLTYPE_DECSEP)
+ bStop = TRUE;
+ i++;
+ }
+ }
+}
+
+const XubString* 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 != SYMBOLTYPE_STRING) &&
+ (*pType != SYMBOLTYPE_CURRENCY) )
+ {
+ pType--;
+ nPos--;
+ }
+ if ( (*pType != SYMBOLTYPE_STRING) && (*pType != 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 != SYMBOLTYPE_STRING) &&
+ (*pType != SYMBOLTYPE_CURRENCY) )
+ {
+ pType++;
+ nPos++;
+ }
+ if ( (*pType != SYMBOLTYPE_STRING) && (*pType != 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 != SYMBOLTYPE_STRING) &&
+ (*pType != SYMBOLTYPE_CURRENCY) )
+ {
+ pType--;
+ nPos--;
+ }
+ if ( (*pType != SYMBOLTYPE_STRING) && (*pType != 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 != SYMBOLTYPE_STRING) &&
+ (*pType != SYMBOLTYPE_CURRENCY) )
+ {
+ pType++;
+ nPos++;
+ }
+ if ( (*pType != SYMBOLTYPE_STRING) && (*pType != SYMBOLTYPE_CURRENCY) )
+ return 0;
+ }
+ return NumFor[nNumFor].Info().nTypeArray[nPos];
+}
+
+
+BOOL SvNumberformat::IsNegativeWithoutSign() const
+{
+ if ( IsNegativeRealNegative() )
+ {
+ const XubString* pStr = GetNumForString( 1, 0, TRUE );
+ if ( pStr )
+ return !HasStringNegativeSign( *pStr );
+ }
+ return FALSE;
+}
+
+
+DateFormat SvNumberformat::GetDateOrder() const
+{
+ if ( (eType & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE )
+ {
+ const short* pType = NumFor[0].Info().nTypeArray;
+ USHORT nAnz = NumFor[0].GetnAnz();
+ for ( USHORT j=0; j<nAnz; j++ )
+ {
+ switch ( pType[j] )
+ {
+ case NF_KEY_T :
+ case NF_KEY_TT :
+ return DMY;
+ break;
+ case NF_KEY_M :
+ case NF_KEY_MM :
+ case NF_KEY_MMM :
+ case NF_KEY_MMMM :
+ return MDY;
+ break;
+ case NF_KEY_JJ :
+ case NF_KEY_JJJJ :
+ return YMD;
+ break;
+ }
+ }
+ }
+ else
+ DBG_ERROR( "SvNumberformat::GetDateOrder: kein Datum" );
+ return rIntl().GetDateFormat();
+}
+
+
+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( XubString& rStr,
+ SvNumberformatLimitOps eOp, double fLimit, xub_Unicode cDecSep )
+{
+ 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;
+ }
+ SolarMath::DoubleToString( rStr, fLimit, 'A', INT_MAX, cDecSep, TRUE );
+ rStr += ']';
+ }
+}
+
+
+XubString SvNumberformat::GetMappedFormatstring(
+ const NfKeywordTable& rKeywords, const International& rIntl,
+ BOOL bDontQuote ) const
+{
+ XubString aStr;
+ // 1 subformat matches all if no condition specified
+ BOOL bDefault1 = ( NumFor[1].GetnAnz() == 0 && eOp1 == NUMBERFORMAT_OP_NO );
+ // with 2 subformats [>=0];[<0] is implied if no condition specified
+ BOOL bDefault2 = ( !bDefault1 && NumFor[2].GetnAnz() == 0 &&
+ eOp1 == NUMBERFORMAT_OP_GE && fLimit1 == 0.0 &&
+ eOp2 == NUMBERFORMAT_OP_NO && fLimit2 == 0.0 );
+ // with 3 subformats [>0];[<0];[=0] is implied if no condition specified
+ BOOL bDefault3 = ( !bDefault2 && NumFor[2].GetnAnz() > 0 &&
+ eOp1 == NUMBERFORMAT_OP_GT && fLimit1 == 0.0 &&
+ eOp2 == NUMBERFORMAT_OP_LT && fLimit2 == 0.0 );
+ BOOL bDefault = bDefault1 || bDefault2 || bDefault3;
+ int nSem = 0; // needed ';' delimiters
+ for ( int n=0; n<4; n++ )
+ {
+ if ( n > 0 )
+ nSem++;
+
+ XubString aPrefix;
+
+ if ( !bDefault )
+ {
+ switch ( n )
+ {
+ case 0 :
+ lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp1,
+ fLimit1, rIntl.GetNumDecimalSep() );
+ break;
+ case 1 :
+ lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp2,
+ fLimit2, rIntl.GetNumDecimalSep() );
+ break;
+ }
+ }
+
+ const XubString& rColorName = NumFor[n].GetColorName();
+ if ( rColorName.Len() )
+ {
+ XubString* pKey = rScan.GetKeyword() + 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
+ }
+ }
+ }
+
+ USHORT nAnz = NumFor[n].GetnAnz();
+ if ( nAnz || aPrefix.Len() )
+ {
+ while ( nSem )
+ {
+ aStr += ';';
+ nSem--;
+ }
+ }
+
+ if ( aPrefix.Len() )
+ aStr += aPrefix;
+
+ if ( nAnz )
+ {
+ const short* pType = NumFor[n].Info().nTypeArray;
+ const XubString* 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 += rIntl.GetLongDateDayOfWeekSep();
+ }
+ else
+ {
+ switch ( pType[j] )
+ {
+ case SYMBOLTYPE_DECSEP :
+ aStr += rIntl.GetNumDecimalSep();
+ break;
+ case SYMBOLTYPE_THSEP :
+ aStr += rIntl.GetNumThousandSep();
+ break;
+ case SYMBOLTYPE_STRING :
+ if( bDontQuote )
+ aStr += pStr[j];
+ else if ( pStr[j].Len() == 1 )
+ {
+ xub_Unicode cx = pStr[j].GetChar(0);
+ switch ( cx )
+ {
+ case '+' :
+ case '-' :
+ case ' ' :
+ aStr += cx; // don't escape simple forms
+ break;
+ default:
+ aStr += '\\';
+ aStr += cx;
+ }
+ }
+ else
+ {
+ aStr += '"';
+ aStr += pStr[j];
+ aStr += '"';
+ }
+ break;
+ default:
+ aStr += pStr[j];
+ }
+
+ }
+ }
+ }
+ }
+ return aStr;
+}
+
+
+// static
+BOOL SvNumberformat::HasStringNegativeSign( const XubString& rStr )
+{
+ // fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored)
+ xub_StrLen nLen = rStr.Len();
+ if ( !nLen )
+ return FALSE;
+ const xub_Unicode* const pBeg = rStr.GetBuffer();
+ const xub_Unicode* const pEnd = pBeg + nLen;
+ register const xub_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 XubString& rStr, XubString& rFormat,
+ XubString& rComment )
+{
+ if ( rComment.Len() )
+ { // alten Kommentar aus Formatstring loeschen
+ //! nicht per EraseComment, der Kommentar muss matchen
+ XubString 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( XubString& 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( XubString& rStr )
+{
+ register const xub_Unicode* p = rStr.GetBuffer();
+ BOOL bInString = FALSE;
+ BOOL bEscaped = FALSE;
+ BOOL bFound = FALSE;
+ xub_StrLen nPos;
+ while ( !bFound && *p )
+ {
+ switch ( *p )
+ {
+ case '\\' :
+ bEscaped = !bEscaped;
+ break;
+ case '\"' :
+ if ( !bEscaped )
+ bInString = !bInString;
+ break;
+ case '{' :
+ if ( !bEscaped && !bInString )
+ {
+ bFound = TRUE;
+ nPos = p - rStr.GetBuffer();
+ }
+ break;
+ }
+ if ( bEscaped && *p != '\\' )
+ bEscaped = FALSE;
+ ++p;
+ }
+ if ( bFound )
+ rStr.Erase( nPos );
+}
+
+
+// static
+BOOL SvNumberformat::IsInQuote( const XubString& rStr, xub_StrLen nPos,
+ xub_Unicode cQuote, xub_Unicode cEscIn, xub_Unicode cEscOut )
+{
+ xub_StrLen nLen = rStr.Len();
+ if ( nPos >= nLen )
+ return FALSE;
+ register const xub_Unicode* p0 = rStr.GetBuffer();
+ register const xub_Unicode* p = p0;
+ register const xub_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 XubString& rStr, xub_StrLen nPos,
+ xub_Unicode cQuote, xub_Unicode cEscIn, xub_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 xub_Unicode* p0 = rStr.GetBuffer();
+ register const xub_Unicode* p = p0 + nPos;
+ register const xub_Unicode* p1 = p0 + nLen;
+ while ( p < p1 )
+ {
+ if ( *p == cQuote && p > p0 && *(p-1) != cEscIn )
+ return p - p0;
+ p++;
+ }
+ return nLen; // String Ende
+}
+
+
+
diff --git a/svtools/source/numbers/zforscan.cxx b/svtools/source/numbers/zforscan.cxx
new file mode 100644
index 000000000000..98eb66c83707
--- /dev/null
+++ b/svtools/source/numbers/zforscan.cxx
@@ -0,0 +1,2406 @@
+/*************************************************************************
+ *
+ * $RCSfile: zforscan.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <stdlib.h>
+
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _INTN_HXX //autogen
+#include <tools/intn.hxx>
+#endif
+#ifndef _SYSTEM_HXX //autogen
+#include <vcl/system.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+
+#include "iniman.hxx"
+#include "zforlist.hxx"
+#include "zformat.hxx"
+
+#define _ZFORSCAN_CXX
+#include "zforscan.hxx"
+#undef _ZFORSCAN_CXX
+
+ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP )
+{
+#ifdef DOS
+#else
+ pFormatter = pFormatterP;
+ const International* pIntl = pFormatter->GetInternational();
+ bConvertMode = FALSE;
+ //! alle Schluesselwoerter muessen aus Grossbuchstaben bestehen !!
+ // 0 bleibt leer!!
+ sKeyword[NF_KEY_E].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "E" ) ); // Exp.
+ sKeyword[NF_KEY_AMPM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AM/PM" ) ); // AM/PM
+ sKeyword[NF_KEY_AP].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "A/P" ) ); // AM/PM
+ sKeyword[NF_KEY_MI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // Minute
+ sKeyword[NF_KEY_MMI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // Minute
+ sKeyword[NF_KEY_S].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "S" ) ); // Sekunde 2
+ sKeyword[NF_KEY_SS].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SS" ) ); // Sekunde 02
+ sKeyword[NF_KEY_Q].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Q" ) ); // Quartal
+ sKeyword[NF_KEY_QQ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "QQ" ) ); // Quartal lang
+ sKeyword[NF_KEY_NN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NN" ) ); // Wochentag kurz
+ sKeyword[NF_KEY_NNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNN" ) ); // Wochentag lang
+ sKeyword[NF_KEY_NNNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNNN" ) ); // Wochentag lang mit Sep
+ sKeyword[NF_KEY_WW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WW" ) ); // Kalenderwoche
+ sKeyword[NF_KEY_CCC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CCC" ) ); // Waehrung Bank
+ SetDependentKeywords( pIntl->GetLanguage() );
+
+ 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;
+
+ sCurString = pFormatter->GetCharClass()->upper( pIntl->GetCurrSymbol() );
+ sErrStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###" ) );
+ Reset();
+#endif
+}
+
+ImpSvNumberformatScan::~ImpSvNumberformatScan()
+{
+ delete pNullDate;
+ Reset();
+}
+
+// static
+void ImpSvNumberformatScan::GetLogicalKeywords( LanguageType eLnge,
+ const xub_Unicode*& pTrue, const xub_Unicode*& pFalse )
+{
+ static const xub_Unicode pDanishTrue[] = { 'S', 'A', 'N', 'D', 0 };
+ static const xub_Unicode pDanishFalse[] = { 'F', 'A', 'L', 'S', 'K', 0 };
+ static const xub_Unicode pDutchTrue[] = { 'W', 'A', 'A', 'R', 0 };
+ static const xub_Unicode pDutchFalse[] = { 'O', 'N', 'W', 'A', 'A', 'R', 0 };
+ static const xub_Unicode pFrenchTrue[] = { 'V', 'R', 'A', 'I', 0 };
+ static const xub_Unicode pFrenchFalse[] = { 'F', 'A', 'U', 'X', 0 };
+ static const xub_Unicode pGermanTrue[] = { 'W', 'A', 'H', 'R', 0 };
+ static const xub_Unicode pGermanFalse[] = { 'F', 'A', 'L', 'S', 'C', 'H', 0 };
+ static const xub_Unicode pItalianTrue[] = { 'V', 'E', 'R', 'O', 0 };
+ static const xub_Unicode pItalianFalse[] = { 'F', 'A', 'L', 'S', 'O', 0 };
+ static const xub_Unicode pNorwegianTrue[] = { 'R', 'I', 'K', 'T', 'I', 'G', 0 };
+ static const xub_Unicode pNorwegianFalse[] = { 'G', 'A', 'L', 'T', 0 };
+ static const xub_Unicode pPortugueseTrue[] = { 'V', 'E', 'R', 'D', 'A', 'D', 'E', 'I', 'R', 'O', 0 };
+ static const xub_Unicode pPortugueseFalse[] = { 'F', 'A', 'L', 'S', 'O', 0 };
+ static const xub_Unicode pSpanishTrue[] = { 'V', 'E', 'R', 'D', 'A', 'D', 'E', 'R', 'O', 0 };
+ static const xub_Unicode pSpanishFalse[] = { 'F', 'A', 'L', 'S', 'O', 0 };
+ static const xub_Unicode pSwedishTrue[] = { 'S', 'A', 'N', 'T', 0 };
+ static const xub_Unicode pSwedishFalse[] = { 'F', 'A', 'L', 'S', 'K', 'T', 0 };
+ static const xub_Unicode pEnglishTrue[] = { 'T', 'R', 'U', 'E', 0 };
+ static const xub_Unicode pEnglishFalse[] = { 'F', 'A', 'L', 'S', 'E', 0 };
+
+ if (eLnge == LANGUAGE_SYSTEM)
+ eLnge = System::GetLanguage();
+ switch (eLnge)
+ {
+ case LANGUAGE_DANISH:
+ pTrue = pDanishTrue;
+ pFalse = pDanishFalse;
+ break;
+
+ case LANGUAGE_DUTCH :
+ case LANGUAGE_DUTCH_BELGIAN :
+ pTrue = pDutchTrue;
+ pFalse = pDutchFalse;
+ break;
+
+ case LANGUAGE_FRENCH:
+ case LANGUAGE_FRENCH_BELGIAN:
+ case LANGUAGE_FRENCH_CANADIAN:
+ case LANGUAGE_FRENCH_SWISS:
+ case LANGUAGE_FRENCH_LUXEMBOURG:
+ case LANGUAGE_FRENCH_MONACO:
+ pTrue = pFrenchTrue;
+ pFalse = pFrenchFalse;
+ break;
+
+ case LANGUAGE_GERMAN:
+ case LANGUAGE_GERMAN_SWISS:
+ case LANGUAGE_GERMAN_AUSTRIAN:
+ case LANGUAGE_GERMAN_LUXEMBOURG:
+ case LANGUAGE_GERMAN_LIECHTENSTEIN:
+ pTrue = pGermanTrue;
+ pFalse = pGermanFalse;
+ break;
+
+ case LANGUAGE_ITALIAN:
+ case LANGUAGE_ITALIAN_SWISS:
+ pTrue = pItalianTrue;
+ pFalse = pItalianFalse;
+ break;
+
+ case LANGUAGE_NORWEGIAN:
+ case LANGUAGE_NORWEGIAN_BOKMAL:
+ case LANGUAGE_NORWEGIAN_NYNORSK:
+ pTrue = pNorwegianTrue;
+ pFalse = pNorwegianFalse;
+ break;
+
+ case LANGUAGE_PORTUGUESE:
+ case LANGUAGE_PORTUGUESE_BRAZILIAN:
+ pTrue = pPortugueseTrue;
+ pFalse = pPortugueseFalse;
+ break;
+
+ case LANGUAGE_SPANISH :
+ case LANGUAGE_SPANISH_MEXICAN :
+ case LANGUAGE_SPANISH_MODERN :
+ 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 :
+ pTrue = pSpanishTrue;
+ pFalse = pSpanishFalse;
+ break;
+
+ case LANGUAGE_SWEDISH:
+ pTrue = pSwedishTrue;
+ pFalse = pSwedishFalse;
+ break;
+
+ default:
+ pTrue = pEnglishTrue;
+ pFalse = pEnglishFalse;
+ break;
+ } // switch
+}
+
+
+void ImpSvNumberformatScan::SetDependentKeywords(LanguageType eLnge)
+{
+ if (eLnge == LANGUAGE_SYSTEM)
+ eLnge = System::GetLanguage();
+ switch (eLnge)
+ {
+ case LANGUAGE_GERMAN:
+ case LANGUAGE_GERMAN_SWISS:
+ case LANGUAGE_GERMAN_AUSTRIAN:
+ case LANGUAGE_GERMAN_LUXEMBOURG:
+ case LANGUAGE_GERMAN_LIECHTENSTEIN:
+ {
+ sNameStandardFormat.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Standard" ) ); //!! darf nur aus 'a'-'Z' bestehen !!
+ sKeyword[NF_KEY_GENERAL].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "STANDARD" ) ); // =sNameStandardFormat
+ // in Grossbuchstaben
+ sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // Monat
+ sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // Monat
+ sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMM" ) ); // Monat Jan
+ sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMM" ) ); // Monat Januar
+ sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "H" ) ); // Stunde 2
+ sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "HH" ) ); // Stunde 02
+ sKeyword[NF_KEY_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T" ) );
+ sKeyword[NF_KEY_TT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TT" ) );
+ sKeyword[NF_KEY_TTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTT" ) );
+ sKeyword[NF_KEY_TTTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTTT" ) );
+ sKeyword[NF_KEY_JJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) );
+ sKeyword[NF_KEY_JJJJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) );
+ sKeyword[NF_KEY_QUARTER].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Quartal" ) );
+ sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WAHR" ) );
+ sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "FALSCH" ) );
+ 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:
+ {
+ // Standard
+ switch ( eLnge )
+ {
+ case LANGUAGE_ENGLISH :
+ case LANGUAGE_ENGLISH_US :
+ case LANGUAGE_ENGLISH_UK :
+ case LANGUAGE_ENGLISH_AUS :
+ case LANGUAGE_ENGLISH_CAN :
+ case LANGUAGE_ENGLISH_NZ :
+ case LANGUAGE_ENGLISH_EIRE :
+ case LANGUAGE_ENGLISH_SAFRICA :
+ case LANGUAGE_ENGLISH_JAMAICA :
+ case LANGUAGE_ENGLISH_CARRIBEAN :
+ case LANGUAGE_ENGLISH_BELIZE :
+ case LANGUAGE_ENGLISH_TRINIDAD :
+ case LANGUAGE_ENGLISH_ZIMBABWE :
+ case LANGUAGE_ENGLISH_PHILIPPINES:
+ sNameStandardFormat.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "General" ) );
+ sKeyword[NF_KEY_GENERAL].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GENERAL" ) );
+ break;
+ case LANGUAGE_PORTUGUESE :
+ case LANGUAGE_SPANISH :
+ case LANGUAGE_SPANISH_MEXICAN :
+ case LANGUAGE_SPANISH_MODERN :
+ 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 :
+ sNameStandardFormat.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Estandar" ) );
+ sKeyword[NF_KEY_GENERAL].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "ESTANDAR" ) );
+ break;
+ case LANGUAGE_PORTUGUESE_BRAZILIAN :
+ sNameStandardFormat.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Geral" ) );
+ sKeyword[NF_KEY_GENERAL].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GERAL" ) );
+ break;
+ case LANGUAGE_FINNISH :
+ sNameStandardFormat.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Yleinen" ) );
+ sKeyword[NF_KEY_GENERAL].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YLEINEN" ) );
+ break;
+ case LANGUAGE_DUTCH :
+ case LANGUAGE_DUTCH_BELGIAN :
+ sNameStandardFormat.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Standaard" ) );
+ sKeyword[NF_KEY_GENERAL].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "STANDAARD" ) );
+ break;
+ default:
+ sNameStandardFormat.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Standard" ) );
+ sKeyword[NF_KEY_GENERAL].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "STANDARD" ) );
+ }
+ // Tag
+ switch ( eLnge )
+ {
+ case LANGUAGE_ITALIAN :
+ case LANGUAGE_ITALIAN_SWISS :
+ sKeyword[NF_KEY_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "G" ) );
+ sKeyword[NF_KEY_TT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GG" ) );
+ sKeyword[NF_KEY_TTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGG" ) );
+ sKeyword[NF_KEY_TTTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGGG" ) );
+ 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_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "J" ) );
+ sKeyword[NF_KEY_TT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) );
+ sKeyword[NF_KEY_TTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJ" ) );
+ sKeyword[NF_KEY_TTTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) );
+ break;
+ case LANGUAGE_FINNISH :
+ sKeyword[NF_KEY_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "P" ) );
+ sKeyword[NF_KEY_TT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PP" ) );
+ sKeyword[NF_KEY_TTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPP" ) );
+ sKeyword[NF_KEY_TTTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPPP" ) );
+ break;
+ default:
+ sKeyword[NF_KEY_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "D" ) );
+ sKeyword[NF_KEY_TT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DD" ) );
+ sKeyword[NF_KEY_TTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDD" ) );
+ sKeyword[NF_KEY_TTTT].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDDD" ) );
+ }
+ // Monat
+ switch ( eLnge )
+ {
+ 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" ) );
+ 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" ) );
+ }
+ // Jahr
+ switch ( eLnge )
+ {
+ 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 :
+ case LANGUAGE_SPANISH_MEXICAN :
+ case LANGUAGE_SPANISH_MODERN :
+ 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_JJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AA" ) );
+ sKeyword[NF_KEY_JJJJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAAA" ) );
+ break;
+ case LANGUAGE_DUTCH :
+ case LANGUAGE_DUTCH_BELGIAN :
+ sKeyword[NF_KEY_JJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) );
+ sKeyword[NF_KEY_JJJJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) );
+ break;
+ case LANGUAGE_FINNISH :
+ sKeyword[NF_KEY_JJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VV" ) );
+ sKeyword[NF_KEY_JJJJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VVVV" ) );
+ break;
+ default:
+ sKeyword[NF_KEY_JJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YY" ) );
+ sKeyword[NF_KEY_JJJJ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YYYY" ) );
+ }
+ // Stunde
+ switch ( eLnge )
+ {
+ 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" ) );
+ }
+ // Quartal
+ sKeyword[NF_KEY_QUARTER].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Quarter" ) );
+ // Logisch
+ const xub_Unicode *pTrue, *pFalse;
+ GetLogicalKeywords( eLnge, pTrue, pFalse );
+ sKeyword[NF_KEY_TRUE] = pTrue;
+ sKeyword[NF_KEY_FALSE] = pFalse;
+ sKeyword[NF_KEY_BOOLEAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BOOLEAN" ) );
+ // Farbe
+ 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;
+ }
+}
+
+
+void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear)
+{
+ delete pNullDate;
+ pNullDate = new Date(nDay, nMonth, nYear);
+}
+
+void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec)
+{
+ nStandardPrec = nPrec;
+}
+
+Color* ImpSvNumberformatScan::GetColor(XubString& sStr)
+{
+ XubString sString = pFormatter->GetCharClass()->upper(sStr);
+ USHORT i = 0;
+ while (i < SC_MAX_ANZ_STANDARD_FARBEN &&
+ sString != sKeyword[NF_KEY_FIRSTCOLOR+i] )
+ i++;
+ if (i >= SC_MAX_ANZ_STANDARD_FARBEN)
+ {
+ const XubString& rColorWord = sKeyword[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(rColorWord,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)
+ return pFormatter->GetUserDefColor((USHORT)nIndex-1);
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+ }
+ else
+ {
+ sStr.Erase();
+ if (bConvertMode)
+ {
+ pFormatter->ChangeIntl(eNewLnge);
+ sStr = sKeyword[NF_KEY_FIRSTCOLOR+i]; // red -> rot
+ pFormatter->ChangeIntl(eTmpLnge);
+ }
+ else
+ sStr = sKeyword[NF_KEY_FIRSTCOLOR+i];
+
+ return &(StandardColor[i]);
+ }
+}
+
+void ImpSvNumberformatScan::ChangeIntl()
+{
+ SetDependentKeywords(pFormatter->GetInternational()->GetLanguage());
+ sCurString = pFormatter->GetCharClass()->upper(pFormatter->GetInternational()->GetCurrSymbol());
+}
+
+USHORT ImpSvNumberformatScan::GetKeyWord(const XubString& sSymbol)
+{
+ USHORT i = NF_KEY_LASTKEYWORD; // unbedingt rueckwaerts!!
+ XubString sString = pFormatter->GetCharClass()->upper(sSymbol);
+ while (i > 0 && sString.Search(sKeyword[i]) != 0)
+ i--; // unbedingt rueckwaerts!!
+ if ( i > NF_KEY_LASTOLDKEYWORD && sString != sKeyword[i] )
+ { // vielleicht doch noch was anderes?
+ // z.B. wird neues NNN in NNNN gefunden, NNNN muss also weitersuchen
+ USHORT j = i - 1;
+ while (j > 0 && sString.Search(sKeyword[j]) != 0)
+ j--; // unbedingt rueckwaerts!!
+ if ( j )
+ return j;
+ }
+ return i; // 0 => nicht gefunden
+}
+
+//---------------------------------------------------------------------------
+// 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 XubString& rStr,
+ xub_StrLen& nPos, XubString& sSymbol )
+{
+ const CharClass* pChrCls = pFormatter->GetCharClass();
+ const xub_StrLen nStart = nPos;
+ short eType;
+ ScanState eState = SsStart;
+ sSymbol.Erase();
+ while ( nPos < rStr.Len() && eState != SsStop )
+ {
+ xub_Unicode cToken = rStr.GetChar( nPos++ );
+ switch (eState)
+ {
+ case SsStart:
+ {
+ switch (cToken)
+ {
+ case '#':
+ case '0':
+ case '?':
+ case '%':
+ case '@':
+ case '[':
+ case ']':
+ case ',':
+ case '.':
+ case '/':
+ case '\'':
+ case ' ':
+ case ':':
+ case '-':
+ {
+ eType = SYMBOLTYPE_DEL;
+ sSymbol += cToken;
+ eState = SsStop;
+ }
+ break;
+ case '*':
+ {
+ eType = SYMBOLTYPE_STAR;
+ sSymbol += cToken;
+ eState = SsGetStar;
+ }
+ break;
+ case '_':
+ {
+ eType = SYMBOLTYPE_BLANK;
+ sSymbol += cToken;
+ eState = SsGetBlank;
+ }
+ break;
+#if NF_COMMENT_IN_FORMATSTRING
+ case '{':
+ eType = SYMBOLTYPE_COMMENT;
+ eState = SsStop;
+ sSymbol.Append( rStr.GetBuffer() + (nPos-1), rStr.Len() - (nPos-1) );
+ nPos = rStr.Len();
+ break;
+#endif
+ case '"':
+ eType = SYMBOLTYPE_STRING;
+ eState = SsGetString;
+ sSymbol += cToken;
+ break;
+ case '\\':
+ eType = SYMBOLTYPE_STRING;
+ eState = SsGetChar;
+ sSymbol += cToken;
+ break;
+ case '$':
+ case '+':
+ case '(':
+ case ')':
+ eType = SYMBOLTYPE_STRING;
+ eState = SsStop;
+ sSymbol += cToken;
+ break;
+ default :
+ {
+ if ( pChrCls->isLetter( rStr, nPos-1 ) )
+ eState = SsGetWord;
+ else
+ {
+ eType = SYMBOLTYPE_STRING;
+ eState = SsStop;
+ }
+ sSymbol += cToken;
+ }
+ break;
+ }
+ }
+ break;
+ case SsGetChar:
+ {
+ sSymbol += cToken;
+ eState = SsStop;
+ }
+ break;
+ case SsGetString:
+ {
+ if (cToken == '"')
+ eState = SsStop;
+// else
+ sSymbol += cToken;
+ }
+ break;
+ case SsGetWord:
+ {
+ if ( pChrCls->isLetter( rStr, nPos-1 ) )
+ sSymbol += cToken;
+ else
+ {
+ BOOL bDontStop = FALSE;
+ switch (cToken)
+ {
+ case '+':
+ case '-': // E+ E-
+ {
+ eType = GetKeyWord(sSymbol);
+ if (eType == NF_KEY_E)
+ {
+ sSymbol += cToken;
+ eState = SsStop;
+ }
+ }
+ break;
+ case '.': // Sf. Waehrung
+ {
+ XubString TestStr = pChrCls->upper(sSymbol);
+ TestStr += cToken;
+ if ( TestStr == sCurString )
+ {
+ sSymbol += cToken;
+ eState = SsStop;
+ eType = SYMBOLTYPE_STRING;
+ }
+ }
+ break;
+ 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 = GetKeyWord(sSymbol);
+ if (!eType)
+ eType = SYMBOLTYPE_STRING;
+ else
+ {
+ xub_StrLen nLen = sKeyword[eType].Len();
+ if ( nPos > nStart + nLen )
+ {
+ nPos = nStart + nLen;
+ sSymbol.Erase( nLen );
+ }
+ }
+ }
+ }
+ }
+ break;
+ case SsGetStar:
+ {
+ eState = SsStop;
+ sSymbol += cToken;
+ nRepPos = (nPos - nStart) - 1; // immer > 0!!
+ }
+ break;
+ case SsGetBlank:
+ {
+ eState = SsStop;
+ sSymbol += cToken;
+ }
+ break;
+ default:
+ break;
+ } // of switch
+ } // of while
+ if (eState == SsGetWord)
+ {
+ eType = GetKeyWord(sSymbol);
+ if ( eType )
+ {
+ xub_StrLen nLen = sKeyword[eType].Len();
+ if ( nPos > nStart + nLen )
+ {
+ nPos = nStart + nLen;
+ sSymbol.Erase( nLen );
+ }
+ }
+ else
+ {
+ eType = SYMBOLTYPE_STRING;
+ // #77026# And now for the Xcl perverts: a word containing the
+ // GENERAL keyword somewhere must be splitted.
+ if ( sSymbol.Len() > sKeyword[NF_KEY_GENERAL].Len() )
+ {
+ XubString aUp( pFormatter->GetCharClass()->upper( sSymbol ) );
+ xub_StrLen nFound = aUp.Search( sKeyword[NF_KEY_GENERAL], 1 );
+ if ( nFound != STRING_NOTFOUND )
+ {
+ nPos = nStart + nFound;
+ sSymbol.Erase( nFound );
+ }
+ }
+ }
+ }
+ return eType;
+}
+
+xub_StrLen ImpSvNumberformatScan::Symbol_Division(const XubString& rString)
+{
+ nCurrPos = STRING_NOTFOUND;
+ // Ist Waehrung im Spiel?
+ XubString sString = pFormatter->GetCharClass()->upper(rString);
+ xub_StrLen nCPos = 0;
+ while (nCPos != STRING_NOTFOUND)
+ {
+ nCPos = sString.Search(sCurString,nCPos);
+ if (nCPos != STRING_NOTFOUND)
+ {
+ // in Quotes?
+ xub_StrLen nQ = SvNumberformat::GetQuoteEnd( sString, nCPos );
+ if ( nQ == STRING_NOTFOUND )
+ {
+ xub_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();
+ const International* pIntl = pFormatter->GetInternational();
+ cOldDecSep = pIntl->GetNumDecimalSep();
+ cOldThousandSep = pIntl->GetNumThousandSep();
+ cOldDateSep = pIntl->GetDateSep();
+ cOldTimeSep = pIntl->GetTimeSep();
+
+ // Wenn der Tausender-Trenner ein Non-Breaking Space ist (franzoesisch), mit
+ // einfachem Space weiterarbeiten, damit die Abfragen auf Space funktionieren.
+ // Der Format-String wird angepasst, so dass beides erlaubt ist.
+ // Fuer die Ausgabe des Format-Strings wird das Zeichen vom International genommen.
+
+ if ( cOldThousandSep == 0xA0 )
+ cOldThousandSep = ' ';
+
+ xub_StrLen nPos = 0;
+ const xub_StrLen nLen = rString.Len();
+ while (nPos < nLen && nAnzStrings < SC_MAX_ANZ_FORMAT_STRINGS)
+ {
+ nTypeArray[nAnzStrings] = Next_Symbol(rString, nPos, sStrArray[nAnzStrings]);
+ if (nTypeArray[nAnzStrings] == 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] == SYMBOLTYPE_STRING
+ || nTypeArray[i] == SYMBOLTYPE_BLANK
+ || nTypeArray[i] == SYMBOLTYPE_STAR) )
+ {
+ 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] == SYMBOLTYPE_EMPTY );
+ return nTypeArray[i];
+ }
+ return 0;
+}
+
+xub_Unicode ImpSvNumberformatScan::PreviousChar(USHORT i)
+{
+ xub_Unicode res = ' ';
+ if (i > 0 && i < nAnzStrings)
+ {
+ i--;
+ while (i > 0 && ( nTypeArray[i] == SYMBOLTYPE_EMPTY
+ || nTypeArray[i] == SYMBOLTYPE_STRING
+ || nTypeArray[i] == SYMBOLTYPE_STAR
+ || nTypeArray[i] == SYMBOLTYPE_BLANK ) )
+ i--;
+ if (sStrArray[i].Len() > 0)
+ res = sStrArray[i].GetChar(xub_StrLen(sStrArray[i].Len()-1));
+ }
+ return res;
+}
+
+xub_Unicode ImpSvNumberformatScan::NextChar(USHORT i)
+{
+ xub_Unicode res = ' ';
+ if (i < nAnzStrings-1)
+ {
+ i++;
+ while (i < nAnzStrings-1 &&
+ ( nTypeArray[i] == SYMBOLTYPE_EMPTY
+ || nTypeArray[i] == SYMBOLTYPE_STRING
+ || nTypeArray[i] == SYMBOLTYPE_STAR
+ || nTypeArray[i] == 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] == SYMBOLTYPE_DEL &&
+ sStrArray[i].GetChar(0) == '/')
+ bStop = TRUE;
+ else if ( nTypeArray[i] == 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 (USHORT i = 0; i < SC_MAX_ANZ_FORMAT_STRINGS; 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;
+}
+
+xub_StrLen ImpSvNumberformatScan::ScanType(const XubString& rString)
+{
+ xub_StrLen nPos = 0;
+ USHORT i = 0; // durchlaeuft die Symbole
+ short eNewType; // neu erkannter Typ
+
+ SkipStrings(i, nPos); // Ausgabestrings ueberlesen
+ while (i < nAnzStrings)
+ {
+ if (nTypeArray[i] > 0) // Schluesselwort
+ {
+ 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_SS: // SS
+ eNewType = NUMBERFORMAT_TIME;
+ break;
+ case NF_KEY_S: // S(Sonderf. S Schilling)
+ {
+/*
+ if (eScannedType != NUMBERFORMAT_TIME &&
+ ( pFormatter->GetInternational()->GetLanguage() == LANGUAGE_GERMAN_AUSTRIAN ||
+ eNewLnge == LANGUAGE_GERMAN_AUSTRIAN) )
+ {
+ xub_Unicode cChar = PreviousChar(i);
+ if (cChar == '[') // nur [s],0 am Anfang!
+ eNewType = NUMBERFORMAT_TIME;
+ else
+ eNewType = NUMBERFORMAT_UNDEFINED;
+ }
+ else
+*/
+ eNewType = NUMBERFORMAT_TIME;
+ }
+ break;
+ case NF_KEY_M: // M
+ case NF_KEY_MM: // MM
+ { // Sonderfall: Minute oder Monat
+ USHORT nIndexPre = PreviousKeyword(i);
+ USHORT nIndexNex = NextKeyword(i);
+ xub_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_Q: // Q
+ case NF_KEY_QQ: // QQ
+ case NF_KEY_T: // T
+ case NF_KEY_TT: // TT
+ case NF_KEY_TTT: // TTT
+ case NF_KEY_TTTT: // TTTT
+ case NF_KEY_JJ: // JJ
+ case NF_KEY_JJJJ: // JJJ
+ case NF_KEY_NN: // NN
+ case NF_KEY_NNN: // NNN
+ case NF_KEY_NNNN: // NNNN
+ case NF_KEY_WW : // WW
+ eNewType = NUMBERFORMAT_DATE;
+ break;
+ case NF_KEY_CCC: // CCC
+ eNewType = NUMBERFORMAT_CURRENCY;
+ break;
+ case NF_KEY_GENERAL: // Standard
+ eNewType = NUMBERFORMAT_NUMBER;
+ break;
+ default:
+ eNewType = NUMBERFORMAT_UNDEFINED;
+ break;
+ }
+ }
+ else // Steuerzeichen
+ {
+ switch ( sStrArray[i].GetChar(0) )
+ {
+ case '#':
+ case '?':
+ eNewType = NUMBERFORMAT_NUMBER;
+ break;
+ case '0':
+ {
+ if (eScannedType == NUMBERFORMAT_TIME)
+ {
+ USHORT nIndexPre = PreviousKeyword(i);
+ if ((nIndexPre == NF_KEY_S || nIndexPre == NF_KEY_SS)
+ && bDecSep) // S, SS ','
+ eNewType = NUMBERFORMAT_TIME;
+ else
+ return nPos; // Fehler
+ }
+ else
+ eNewType = NUMBERFORMAT_NUMBER;
+ }
+ break;
+ case ',':
+ case '.':
+ {
+ bDecSep = TRUE; // fuer SS,0
+ eNewType = NUMBERFORMAT_UNDEFINED;
+ }
+ break;
+ case '%':
+ eNewType = NUMBERFORMAT_PERCENT;
+ break;
+ case '/':
+ eNewType = NUMBERFORMAT_FRACTION;
+ break;
+ case '[':
+ {
+ if ( i < nAnzStrings-1 &&
+ nTypeArray[i+1] == SYMBOLTYPE_STRING &&
+ sStrArray[i+1].GetChar(0) == '$' )
+ {
+ eNewType = NUMBERFORMAT_CURRENCY;
+ }
+ 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; // Fehler
+ }
+ }
+ break;
+ case '@':
+ eNewType = NUMBERFORMAT_TEXT;
+ break;
+ default:
+ 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].GetChar(0) != cOldDateSep )
+ 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].GetChar(0) != cOldTimeSep )
+ 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].GetChar(0) != cOldDateSep
+ && sStrArray[i].GetChar(0) != cOldTimeSep )
+ 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 += sStrArray[i].Len(); // Korrekturposition
+ i++;
+ SkipStrings(i, nPos);
+ }
+ if (bConvertMode) // hier muss Spr./Land ggfs.
+ { // gewechselt werden
+ pFormatter->ChangeIntl(eNewLnge);
+ }
+
+ if ((eScannedType == NUMBERFORMAT_NUMBER || eScannedType == NUMBERFORMAT_UNDEFINED)
+ && nCurrPos != STRING_NOTFOUND)
+ // Check, ob DM
+ eScannedType = NUMBERFORMAT_CURRENCY;
+/*
+ XubString sString = pFormatter->GetCharClass()->upper(rString);
+ USHORT nCPos = 0;
+ while (nCPos != STRING_NOTFOUND)
+ {
+ nCPos = sString.Search(sCurString,nCPos);
+ if (nCPos != STRING_NOTFOUND)
+ {
+ if ( nCPos == 0 ||
+ (nCPos > 0 && sString[(USHORT)(nCPos-1)] != '"'
+ && sString[(USHORT)(nCPos-1)] != '\\') )// dm kann durch "dm
+ { // \d geschuetzt werden
+ eScannedType = NUMBERFORMAT_CURRENCY;
+ nCPos = STRING_NOTFOUND; // Abbruch
+ }
+ else
+ nCPos++; // weitersuchen
+ }
+ }
+ }
+*/
+ if (eScannedType == NUMBERFORMAT_UNDEFINED)
+ eScannedType = NUMBERFORMAT_DEFINED;
+// eScannedType = NUMBERFORMAT_TEXT;
+ return 0; // Alles ok
+}
+
+xub_StrLen ImpSvNumberformatScan::FinalScan( XubString& rString, XubString& rComment )
+{
+ const International* pIntl = pFormatter->GetInternational();
+
+ xub_StrLen nPos = 0; // Korrekturposition
+ USHORT i = 0; // durchlaeuft die Symbole
+ USHORT nCounter = 0; // Zaehlt Ziffern
+ nAnzResStrings = nAnzStrings; // Zaehlt uebrigbleibende Symbole
+ bDecSep = FALSE; // falls schon in TypeCeck benutzt
+
+ switch (eScannedType)
+ {
+ case NUMBERFORMAT_TEXT:
+ case NUMBERFORMAT_DEFINED:
+ {
+ while (i < nAnzStrings)
+ {
+ switch (nTypeArray[i])
+ {
+ case SYMBOLTYPE_BLANK:
+ case SYMBOLTYPE_STAR:
+ break;
+ case SYMBOLTYPE_COMMENT:
+ {
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ SvNumberformat::EraseCommentBraces( rStr );
+ rComment += rStr;
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ break;
+ case NF_KEY_GENERAL : // #77026# "General" is the same as "@"
+ break;
+ default:
+ {
+ if ( nTypeArray[i] != SYMBOLTYPE_DEL ||
+ sStrArray[i].GetChar(0) != '@' )
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ }
+ break;
+ }
+ nPos += sStrArray[i].Len();
+ i++;
+ } // of while
+ }
+ break;
+ case NUMBERFORMAT_NUMBER:
+ case NUMBERFORMAT_PERCENT:
+ case NUMBERFORMAT_CURRENCY:
+ case NUMBERFORMAT_SCIENTIFIC:
+ case NUMBERFORMAT_FRACTION:
+ {
+ xub_Unicode cThousandFill = ' ';
+ while (i < nAnzStrings)
+ {
+ if (eScannedType == NUMBERFORMAT_FRACTION && // Sonderfall
+ nTypeArray[i] == SYMBOLTYPE_DEL && // # ### #/#
+ cOldThousandSep == ' ' && // Frankreich
+ sStrArray[i].GetChar(0) == ' ' && // Schweden
+ !bFrac &&
+ IsLastBlankBeforeFrac(i) )
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING; // del->string
+ } // kein Taus.p.
+
+
+ if (nTypeArray[i] == SYMBOLTYPE_BLANK ||
+ nTypeArray[i] == 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 += sStrArray[i].Len();
+ i++;
+ }
+ else if (nTypeArray[i] == 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] = 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] = SYMBOLTYPE_FRACBLANK;
+ }
+ else
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ else if (nTypeArray[i] == SYMBOLTYPE_DEL)
+ {
+ xub_Unicode cHere = sStrArray[i].GetChar(0);
+ switch ( cHere )
+ {
+ case '#':
+ case '0':
+ case '?':
+ {
+ if (nThousand > 0) // #... #
+ return nPos; // Fehler
+ else if (bFrac && cHere == '0')
+ return nPos; // 0 im Nenner
+ nTypeArray[i] = SYMBOLTYPE_DIGIT;
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ i++;
+ nCounter++;
+ while (i < nAnzStrings &&
+ (sStrArray[i].GetChar(0) == '#' ||
+ sStrArray[i].GetChar(0) == '0' ||
+ sStrArray[i].GetChar(0) == '?')
+ )
+ {
+ rStr += sStrArray[i];
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ nCounter++;
+ i++;
+ }
+ }
+ break;
+ case '-':
+ {
+ if ( bDecSep && nDecPos < i &&
+ nTypeArray[nDecPos] == SYMBOLTYPE_DECSEP )
+ { // "0,--"
+ nTypeArray[i] = SYMBOLTYPE_DIGIT;
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ i++;
+ nCounter++;
+ while (i < nAnzStrings &&
+ (sStrArray[i].GetChar(0) == '-') )
+ {
+ rStr += sStrArray[i];
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ nCounter++;
+ i++;
+ }
+ }
+ else
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ }
+ break;
+ case '.':
+ case ',':
+ case '\'':
+ case ' ':
+ {
+ xub_Unicode cSep = cHere; // merken
+ if ( cSep == cOldThousandSep)
+ {
+ if (bConvertMode)
+ {
+ cSep = pIntl->GetNumThousandSep();
+ sStrArray[i].SetChar( 0, cSep );
+ }
+ xub_Unicode cPre = PreviousChar(i); // letzter Buchst.
+ // vorher (skipt empty)
+ xub_Unicode cNext;
+ if (bExp || bBlank || bFrac)
+ { // hinter E, / oder ' '
+ if (cOldThousandSep != ' ')
+ {
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++; // weg damit
+ }
+ else
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ }
+ else if (i > 0 && i < nAnzStrings-1 &&
+ (cPre == '#' || cPre == '0') &&
+ ((cNext = NextChar(i)) == '#' || cNext == '0')
+ ) // #.#
+ {
+ nPos += sStrArray[i].Len();
+ if (!bThousand) // nur einmal
+ {
+ // hart setzen, falls Non-Breaking Space
+ sStrArray[i].Replace( 0, 1, pIntl->GetNumThousandSep() );
+ nTypeArray[i] = SYMBOLTYPE_THSEP;
+ bThousand = TRUE;
+ cThousandFill = sStrArray[i+1].GetChar(0);
+ }
+ else // weg damit
+ {
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ i++;
+ }
+ else if (i > 0 && (cPre == '#' || cPre == '0')
+ && PreviousType(i) == SYMBOLTYPE_DIGIT
+ && nThousand < FLAG_STANDARD_IN_FORMAT )
+ { // #....
+ if ( cOldThousandSep == ' ' )
+ { // die spinnen, die Franzosen..
+ BOOL bFirst = TRUE;
+ XubString& rStr = sStrArray[i];
+ // hart setzen, Non-Breaking Space
+ xub_Unicode cSepF = pIntl->GetNumThousandSep();
+ while ( i < nAnzStrings
+ && sStrArray[i].GetChar(0) ==
+ cOldThousandSep
+ && NextChar(i) == cOldThousandSep )
+ { // letzter ist Space oder es folgt
+ // noch ein Space => TausenderSep
+ nPos += sStrArray[i].Len();
+ if ( bFirst )
+ {
+ bFirst = FALSE;
+ rStr.Replace( 0, 1, cSepF );
+ nTypeArray[i] = SYMBOLTYPE_THSEP;
+ }
+ else
+ {
+ rStr += cSepF;
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ nThousand++;
+ i++;
+ }
+ if ( i < nAnzStrings-1
+ && sStrArray[i].GetChar(0) ==
+ cOldThousandSep )
+ { // hinter letztem Space ist was
+ // => Space wenn Waehrung enthalten,
+ // sonst TausenderSep
+ 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] = SYMBOLTYPE_STRING;
+ }
+ else
+ {
+ if ( bFirst )
+ {
+ bFirst = FALSE;
+ rStr.Replace( 0, 1, cSepF );
+ nTypeArray[i] = SYMBOLTYPE_THSEP;
+ }
+ else
+ {
+ rStr += cSepF;
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ nThousand++;
+ }
+ i++;
+ }
+ }
+ else
+ {
+ nTypeArray[i] = SYMBOLTYPE_THSEP;
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ i++;
+ nThousand++;
+ while (i < nAnzStrings &&
+ sStrArray[i].GetChar(0) ==
+ cOldThousandSep)
+ {
+ nThousand++;
+ rStr += cSep;
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++;
+ }
+ }
+ }
+ else // irgendwelche .
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ i++;
+ while (i < nAnzStrings &&
+ sStrArray[i].GetChar(0) ==
+ cOldThousandSep)
+ {
+ rStr += sStrArray[i];
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++;
+ }
+ }
+ }
+ else if ( cSep == cOldDecSep)
+ { // Dezimalzeichen
+ if (bConvertMode)
+ {
+ cSep = pIntl->GetNumDecimalSep();
+ sStrArray[i].Replace( 0, 1, cSep );
+ }
+ if (bBlank || bFrac) // , hinter /, ' '
+ return nPos; // Fehler
+ else if (bExp) // hinter dem E
+ {
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++; // weg damit
+ }
+ else if (bDecSep) // irgendwelche ,
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ i++;
+ while (i < nAnzStrings &&
+ sStrArray[i].GetChar(0) ==
+ cOldDecSep)
+ {
+ rStr += sStrArray[i];
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++;
+ }
+ }
+ else
+ {
+ nTypeArray[i] = SYMBOLTYPE_DECSEP;
+ bDecSep = TRUE;
+ nDecPos = i;
+ nCntPre = nCounter;
+ nCounter = 0;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ } // of else = DecSep
+ else // . ohne Bedeutung
+ {
+ if (cSep == ' ' &&
+ eScannedType == NUMBERFORMAT_FRACTION &&
+ sStrArray[i].GetChar(0) == ' ')
+ {
+ if (!bBlank && !bFrac) // nicht doppelt
+ { // oder hinter /
+ if (bDecSep && nCounter > 0)// Nachkom.
+ return nPos; // Fehler
+ bBlank = TRUE;
+ nBlankPos = i;
+ nCntPre = nCounter;
+ nCounter = 0;
+ }
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ }
+ else
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ i++;
+ while (i < nAnzStrings &&
+ sStrArray[i].GetChar(0) == cSep)
+ {
+ rStr += sStrArray[i];
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++;
+ }
+ }
+ }
+ }
+ break;
+ case '/':
+ {
+ if (eScannedType == NUMBERFORMAT_FRACTION)
+ {
+ if ( i == 0 ||
+ (nTypeArray[i-1] != SYMBOLTYPE_DIGIT &&
+ nTypeArray[i-1] != SYMBOLTYPE_EMPTY) )
+ return nPos ? nPos : 1; // /? not allowed
+ else if (!bFrac || (bDecSep && nCounter > 0))
+ {
+ bFrac = TRUE;
+ nCntPost = nCounter;
+ nCounter = 0;
+ nTypeArray[i] = SYMBOLTYPE_FRAC;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ else // / doppelt od. , imZaehl
+ return nPos; // Fehler
+ }
+ else
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ }
+ break;
+ case '[' :
+ {
+ if ( eScannedType == NUMBERFORMAT_CURRENCY &&
+ i < nAnzStrings-1 &&
+ nTypeArray[i+1] == SYMBOLTYPE_STRING &&
+ sStrArray[i+1].GetChar(0) == '$' )
+ { // [$DM-xxx]
+ // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR
+ nPos += sStrArray[i].Len(); // [
+ nTypeArray[i] = SYMBOLTYPE_CURRDEL;
+ nPos += sStrArray[++i].Len(); // $
+ sStrArray[i-1] += sStrArray[i]; // [$
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ if ( ++i >= nAnzStrings )
+ return nPos; // Fehler
+ nPos += sStrArray[i].Len(); // DM
+ XubString& rStr = sStrArray[i];
+ XubString* pStr = &sStrArray[i];
+ nTypeArray[i] = SYMBOLTYPE_CURRENCY; // wandeln
+ BOOL bHadDash = FALSE;
+ i++;
+ while ( i < nAnzStrings &&
+ sStrArray[i].GetChar(0) != ']' )
+ {
+ nPos += sStrArray[i].Len();
+ if ( bHadDash )
+ {
+ *pStr += sStrArray[i];
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ else
+ {
+ if ( sStrArray[i].GetChar(0) == '-' )
+ {
+ bHadDash = TRUE;
+ pStr = &sStrArray[i];
+ nTypeArray[i] = SYMBOLTYPE_CURREXT;
+ }
+ else
+ {
+ *pStr += sStrArray[i];
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ }
+ i++;
+ }
+ if ( rStr.Len() && i < nAnzStrings &&
+ sStrArray[i].GetChar(0) == ']' )
+ {
+ nTypeArray[i] = SYMBOLTYPE_CURRDEL;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ else
+ return nPos; // Fehler
+ }
+ else
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ }
+ break;
+ default: // andere Dels
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ break;
+ } // of switch (Del)
+ } // of else Del
+ else if ( nTypeArray[i] == SYMBOLTYPE_COMMENT )
+ {
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ SvNumberformat::EraseCommentBraces( rStr );
+ rComment += rStr;
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++;
+ }
+ else
+ {
+ DBG_ERRORFILE( "unknown SYMBOLTYPE_..." );
+ 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 (nThousand == 0 && bThousand) // Expansion Tausenderpunkt:
+ {
+ USHORT nMaxPos;
+ if (bFrac)
+ {
+ if (bBlank)
+ nMaxPos = nBlankPos;
+ else
+ nMaxPos = 0; // keine Expansion
+ }
+ else if (bDecSep) // , vorhanden
+ nMaxPos = nDecPos;
+ else if (bExp) // E vorhanden
+ nMaxPos = nExpPos;
+ else // sonst bis Ende
+ nMaxPos = i;
+ i = 0;
+ long nCount = nCntPre;
+ while (i < nMaxPos && nTypeArray[i] != SYMBOLTYPE_THSEP) // nur bis zum ,
+ {
+ if (nTypeArray[i] == SYMBOLTYPE_DIGIT)
+ nCount -= sStrArray[i].Len();
+ i++;
+ }
+ USHORT nPosThSep = i; // Position merken
+ i++; // Ziffern hinter .
+ xub_StrLen nFill = 0;
+ if (nCount > 0) // muesste immer sein
+ nFill = xub_StrLen(nCount % 3);
+ if (nFill)
+ {
+ nFill = 3 - nFill;
+ if (i < nMaxPos)
+ for (xub_StrLen k = 0; k < nFill; k++)
+ sStrArray[i].Insert(cThousandFill,0);
+ nCntPre += USHORT(nFill);
+ }
+ nCount = 0; // Aufuellen mit .
+ while (i < nMaxPos) // nach hinten
+ {
+ if (nTypeArray[i] == SYMBOLTYPE_DIGIT)
+ {
+ xub_StrLen nLen = sStrArray[i].Len();
+ if (nCount+nLen > 3)
+ { // hier muss . dazwischen
+ xub_StrLen nAnz = (nLen+nCount-4)/3+1;
+ xub_StrLen InPos = 3-nCount;
+ for (xub_StrLen k = 0; k < nAnz; k++)
+ {
+ sStrArray[i].Insert(
+ pIntl->GetNumThousandSep(),InPos);
+ InPos += 4;
+ }
+ nCount = sStrArray[i].Len() - InPos + 3;
+ }
+ else
+ nCount += sStrArray[i].Len();
+ }
+ i++;
+ }
+ nCount = 0; // Aufuellen mit .
+ i = nPosThSep; // nach vorn
+ while (i > 0)
+ {
+ i--;
+ if (nTypeArray[i] == SYMBOLTYPE_DIGIT)
+ {
+ xub_StrLen nLen = sStrArray[i].Len();
+ if (nCount+nLen > 3)
+ { // hier muss . dazwischen
+ xub_StrLen nAnz = (nLen+nCount-4)/3+1;
+ xub_StrLen InPos = nLen + nCount - 3;
+ for (xub_StrLen k = 0; k < nAnz; k++)
+ {
+ sStrArray[i].Insert(
+ pIntl->GetNumThousandSep(),InPos);
+ InPos -= 3;
+ }
+ nCount = InPos + 3;
+ }
+ else
+ nCount += sStrArray[i].Len();
+ }
+ }
+ }
+ }
+ break; // of NUMBERFORMAT_NUMBER
+ case NUMBERFORMAT_DATE:
+ {
+ while (i < nAnzStrings)
+ {
+ switch (nTypeArray[i])
+ {
+ case SYMBOLTYPE_BLANK:
+ case SYMBOLTYPE_STAR:
+ case SYMBOLTYPE_STRING:
+ break;
+ case SYMBOLTYPE_COMMENT:
+ {
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ SvNumberformat::EraseCommentBraces( rStr );
+ rComment += rStr;
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ break;
+ case SYMBOLTYPE_DEL:
+ {
+ if (bConvertMode && sStrArray[i].GetChar(0) == cOldDateSep)
+ sStrArray[i].Replace( 0, 1, pIntl->GetDateSep() );
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ }
+ break;
+ case NF_KEY_M: // M
+ case NF_KEY_MM: // MM
+ case NF_KEY_MMM: // MMM
+ case NF_KEY_MMMM: // MMMM
+ case NF_KEY_Q: // Q
+ case NF_KEY_QQ: // QQ
+ case NF_KEY_T: // T
+ case NF_KEY_TT: // TT
+ case NF_KEY_TTT: // TTT
+ case NF_KEY_TTTT: // TTTT
+ case NF_KEY_JJ: // JJ
+ case NF_KEY_JJJJ: // JJJJ
+ case NF_KEY_NN: // NN
+ case NF_KEY_NNN: // NNN
+ case NF_KEY_NNNN: // NNNN
+ case NF_KEY_WW : // WW
+ sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
+ break;
+ default: // andere Keywords
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ break;
+ }
+ nPos += sStrArray[i].Len();
+ i++;
+ } // of while
+ }
+ break; // of NUMBERFORMAT_DATE
+ case NUMBERFORMAT_TIME:
+ {
+ while (i < nAnzStrings)
+ {
+ switch (nTypeArray[i])
+ {
+ case SYMBOLTYPE_BLANK:
+ case SYMBOLTYPE_STAR:
+ {
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ break;
+ case SYMBOLTYPE_DEL:
+ {
+ switch( sStrArray[i].GetChar(0) )
+ {
+ case '0':
+ {
+ if (bDecSep)
+ {
+ nTypeArray[i] = SYMBOLTYPE_DIGIT;
+ XubString& rStr = sStrArray[i];
+ i++;
+ nPos += sStrArray[i].Len();
+ nCounter++;
+ while (i < nAnzStrings &&
+ sStrArray[i].GetChar(0) == '0')
+ {
+ rStr += sStrArray[i];
+ nPos += sStrArray[i].Len();
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ nCounter++;
+ i++;
+ }
+ }
+ else
+ return nPos;
+ }
+ break;
+ case '#':
+ case '?':
+ return nPos;
+ break;
+ case '.':
+ case ',':
+ {
+ bDecSep = TRUE;
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ break;
+ case '[':
+ {
+ if (bThousand) // doppelt
+ return nPos;
+ bThousand = TRUE; // bei Time frei
+ xub_Unicode cChar = pFormatter->GetCharClass()->upper( NextChar(i) ).GetChar(0);
+ if ( cChar == sKeyword[NF_KEY_H].GetChar(0) )
+ nThousand = 1; // H
+ else if ( cChar == sKeyword[NF_KEY_MI].GetChar(0) )
+ nThousand = 2; // M
+ else if ( cChar == sKeyword[NF_KEY_S].GetChar(0) )
+ nThousand = 3; // S
+ else
+ return nPos;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ case ']':
+ {
+ if (!bThousand) // kein [ vorher
+ return nPos;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ break;
+ default:
+ {
+ if (bConvertMode &&
+ sStrArray[i].GetChar(0) == cOldTimeSep)
+ sStrArray[i].Replace( 0, 1, pIntl->GetTimeSep() );
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ break;
+ }
+ }
+ break;
+ case SYMBOLTYPE_STRING:
+ {
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ break;
+ case SYMBOLTYPE_COMMENT:
+ {
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ SvNumberformat::EraseCommentBraces( rStr );
+ rComment += rStr;
+ nTypeArray[i] = 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 += 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
+ {
+ sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
+ nPos += sStrArray[i].Len();
+ i++;
+ }
+ break;
+ default: // andere Keywords
+ {
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ 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:
+ {
+ while (i < nAnzStrings)
+ {
+ switch (nTypeArray[i])
+ {
+ case SYMBOLTYPE_BLANK:
+ case SYMBOLTYPE_STAR:
+ case SYMBOLTYPE_STRING:
+ break;
+ case SYMBOLTYPE_COMMENT:
+ {
+ XubString& rStr = sStrArray[i];
+ nPos += rStr.Len();
+ SvNumberformat::EraseCommentBraces( rStr );
+ rComment += rStr;
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ }
+ break;
+ case SYMBOLTYPE_DEL:
+ {
+ if (bConvertMode && sStrArray[i].GetChar(0) == cOldDateSep)
+ sStrArray[i].Replace( 0, 1, pIntl->GetDateSep() );
+ if (bConvertMode && sStrArray[i].GetChar(0) == cOldTimeSep)
+ sStrArray[i].Replace( 0, 1, pIntl->GetTimeSep() );
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ }
+ 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
+ }
+ 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
+ case NF_KEY_M: // M
+ case NF_KEY_MM: // MM
+ case NF_KEY_MMM: // MMM
+ case NF_KEY_MMMM: // MMMM
+ case NF_KEY_Q: // Q
+ case NF_KEY_QQ: // QQ
+ case NF_KEY_T: // T
+ case NF_KEY_TT: // TT
+ case NF_KEY_TTT: // TTT
+ case NF_KEY_TTTT: // TTTT
+ case NF_KEY_JJ: // JJ
+ case NF_KEY_JJJJ: // JJJJ
+ case NF_KEY_NN: // NN
+ case NF_KEY_NNN: // NNN
+ case NF_KEY_NNNN: // NNNN
+ case NF_KEY_WW : // WW
+ sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
+ break;
+ default: // andere Keywords
+ nTypeArray[i] = SYMBOLTYPE_STRING;
+ break;
+ }
+ nPos += sStrArray[i].Len();
+ i++;
+ } // of while
+ if (bExp)
+ nCntExp = 1; // merkt AM/PM
+ }
+ break; // of Sc_N_F_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;
+ rString.Erase();
+ for (i = 0; i < nAnzStrings; i++)
+ {
+ if ( nTypeArray[i] != SYMBOLTYPE_EMPTY )
+ rString += sStrArray[i];
+ if ( sStrArray[i].Len() > 1 && (nTypeArray[i] == SYMBOLTYPE_STRING ||
+ nTypeArray[i] == SYMBOLTYPE_CURRENCY) )
+ {
+ XubString& rStr = sStrArray[i];
+ xub_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);
+ }
+ else if ( c == '\\' )
+ rStr.Erase(0,1);
+ }
+ }
+ // Strings zusammenfassen:
+ i = 0;
+ while (i < nAnzStrings)
+ {
+ if (nTypeArray[i] == SYMBOLTYPE_STRING)
+ {
+ USHORT iPos = i;
+ USHORT j = i;
+ i++;
+ while ( i < nAnzStrings && nTypeArray[i] == SYMBOLTYPE_STRING )
+ {
+ sStrArray[iPos] += sStrArray[i];
+ nTypeArray[i] = SYMBOLTYPE_EMPTY;
+ nAnzResStrings--;
+ i++;
+ }
+ if (eScannedType == NUMBERFORMAT_CURRENCY)
+ { // dM -> DM
+ xub_StrLen nCPos;
+ XubString sTmpStr = pFormatter->GetCharClass()->upper(sStrArray[j]);
+ nCPos = sTmpStr.Search(sCurString);
+ if ( nCPos != STRING_NOTFOUND )
+ {
+ const XubString& rCurr = pIntl->GetCurrSymbol();
+ sStrArray[j].Replace( nCPos, rCurr.Len(), rCurr );
+ }
+ }
+ }
+ i++;
+ }
+ return 0;
+}
+
+xub_StrLen ImpSvNumberformatScan::ScanFormat( XubString& rString, XubString& 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)
+{
+ USHORT i,j;
+ j = 0;
+ i = 0;
+ while (i < nAnz && j < SC_MAX_ANZ_FORMAT_STRINGS)
+ {
+ if (nTypeArray[j] != 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
new file mode 100644
index 000000000000..3aa56db49f13
--- /dev/null
+++ b/svtools/source/numbers/zforscan.hxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * $RCSfile: zforscan.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _ZFORSCAN_HXX
+#define _ZFORSCAN_HXX
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+#ifndef _DATE_HXX //autogen
+#include <tools/date.hxx>
+#endif
+#ifndef _LANG_HXX //autogen
+#include <tools/lang.hxx>
+#endif
+#ifndef _COLOR_HXX //autogen
+#include <vcl/color.hxx>
+#endif
+
+#include "zformat.hxx" // just for NfKeywordTable
+
+class International;
+class SvNumberFormatter;
+struct ImpSvNumberformatInfo;
+
+
+#define SC_MAX_ANZ_FORMAT_STRINGS 100
+#define SC_MAX_ANZ_STANDARD_FARBEN 10
+#define FLAG_STANDARD_IN_FORMAT 1000
+ // Hack: nThousand=1000
+ // => Standard kommt im
+ // Format vor
+
+enum Sc_SymbolType
+{
+ SYMBOLTYPE_STRING = -1, // String in Ausgabe
+ SYMBOLTYPE_DEL = -2, // Sonderzeichen
+ SYMBOLTYPE_BLANK = -3, // Blank fuer '_'
+ SYMBOLTYPE_STAR = -4, // *-Buchstabe
+ SYMBOLTYPE_DIGIT = -5, // Ziffernplatzhalter
+ SYMBOLTYPE_DECSEP = -6, // Komma
+ SYMBOLTYPE_THSEP = -7, // Tausenderpunkt
+ SYMBOLTYPE_EXP = -8, // Exponent E
+ SYMBOLTYPE_FRAC = -9, // Bruch /
+ SYMBOLTYPE_EMPTY = -10, // geloeschte Symbole
+ SYMBOLTYPE_FRACBLANK = -11, // Trenner Zahl - Zaehler bei Bruch
+ SYMBOLTYPE_COMMENT = -12, // Kommentar folgt
+ SYMBOLTYPE_CURRENCY = -13, // Waehrungssymbol
+ SYMBOLTYPE_CURRDEL = -14, // Waehrungssymbol Delimiter [$]
+ SYMBOLTYPE_CURREXT = -15 // Waehrungssymbol Extension -xxx
+};
+
+
+class ImpSvNumberformatScan
+{
+public: // ---- oeffentlicher Teil
+ static void GetLogicalKeywords( LanguageType eLnge,
+ const xub_Unicode*& pTrue, const xub_Unicode*& pFalse );
+
+ 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( XubString& rString, XubString& rComment ); // Aufruf der Scan-Analyse
+
+ void CopyInfo(ImpSvNumberformatInfo* pInfo,
+ USHORT nAnz); // Kopiert die FormatInfo
+ USHORT GetAnzResStrings() { return nAnzResStrings; }
+
+ const International& GetIntl() { return *pFormatter->GetInternational(); }
+ const CharClass& GetChrCls() { return *pFormatter->GetCharClass(); }
+
+ XubString& GetQuartalString(){ return sKeyword[NF_KEY_QUARTER]; }
+ XubString& GetTrueString() { return sKeyword[NF_KEY_TRUE]; }
+ XubString& GetFalseString() { return sKeyword[NF_KEY_FALSE]; }
+ XubString& GetColorString() { return sKeyword[NF_KEY_COLOR]; }
+ XubString& GetRedString() { return sKeyword[NF_KEY_RED]; }
+ XubString& GetBooleanString(){ return sKeyword[NF_KEY_BOOLEAN]; }
+ XubString& GetErrorString() { return sErrStr; }
+ XubString* GetKeyword() { return sKeyword; }
+
+ Date* GetNullDate() { return pNullDate; }
+ XubString& GetStandardName() { return sNameStandardFormat; }
+ short GetStandardPrec() { return nStandardPrec; }
+ Color& GetRedColor() { return StandardColor[4]; }
+ Color* GetColor(XubString& sStr); // Setzt Hauptfarben oder
+ // definierte Farben
+
+ void SetConvertMode(LanguageType eTmpLge, LanguageType eNewLge)
+ {
+ bConvertMode = TRUE;
+ eNewLnge = eNewLge;
+ eTmpLnge = eTmpLge;
+ }
+ void SetConvertMode(BOOL bMode) { bConvertMode = bMode; }
+ // Veraendert nur die Bool-Variable
+ // (zum temporaeren Unterbrechen des
+ // Convert-Modus)
+ const BOOL GetConvertMode() { return bConvertMode; }
+ const LanguageType GetNewLnge() { return eNewLnge; }
+ // Lesezugriff auf ConvertMode
+ // und Konvertierungsland/Spr.
+ const LanguageType GetTmpLnge() { return eTmpLnge; }
+ // Lesezugriff auf
+ // und Ausgangsland/Spr.
+ SvNumberFormatter* GetNumberformatter() { return pFormatter; }
+ // Zugriff auf Formatierer
+ // (fuer zformat.cxx)
+
+
+private: // ---- privater Teil
+ NfKeywordTable sKeyword; // Schluesselworte der Syntax
+ Color StandardColor[SC_MAX_ANZ_STANDARD_FARBEN];
+ // Array der Standardfarben
+ Date* pNullDate; // "1.1.1900"
+ XubString sNameStandardFormat; // "Standard"
+ short nStandardPrec; // default Precision fuer Standardformat (2)
+ SvNumberFormatter* pFormatter; // Pointer auf die Formatliste
+
+ XubString sStrArray[SC_MAX_ANZ_FORMAT_STRINGS];// Array der Symbole
+ short nTypeArray[SC_MAX_ANZ_FORMAT_STRINGS];// 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
+ XubString sCurString; // Das Waehrungssymbol in Upper
+ XubString 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)
+ xub_Unicode cOldDecSep; // Dezimalsymbol der Ausgangs-
+ xub_Unicode cOldThousandSep; // spr., analog Tausenderpunkt
+ xub_Unicode cOldDateSep; // Datums- und Zeitsymbol
+ xub_Unicode cOldTimeSep;
+ xub_StrLen nCurrPos; // Position des Waehrungssymbols
+
+#ifdef _ZFORSCAN_CXX // ----- private Methoden -----
+ void SetDependentKeywords(LanguageType eLnge);
+ // 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
+ xub_Unicode PreviousChar(USHORT i); // Gibt letzten Buchstaben
+ // vor der Position,
+ // skipt EMPTY, STRING, STAR, BLANK
+ xub_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
+ USHORT GetKeyWord(const XubString& sSymbol); // Vergleicht mit den Keywords
+ // return 0 <=> nicht gefunden
+ short Next_Symbol(const XubString& rStr,
+ xub_StrLen& nPos,
+ XubString& sSymbol); // Naechstes Symbol
+ xub_StrLen Symbol_Division(const XubString& rString);// lexikalische Voranalyse
+ xub_StrLen ScanType(const XubString& rString); // Analyse des Formattyps
+ xub_StrLen FinalScan( XubString& rString, XubString& rComment ); // Endanalyse mit Vorgabe
+ // des Typs
+
+#endif //_ZFORSCAN_CXX
+};
+
+
+
+#endif // _ZFORSCAN_HXX
diff --git a/svtools/source/plugapp/commtest.cxx b/svtools/source/plugapp/commtest.cxx
new file mode 100644
index 000000000000..e9a9b33b2089
--- /dev/null
+++ b/svtools/source/plugapp/commtest.cxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * $RCSfile: commtest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVAPP_HXX //autogen wg. Application
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX //autogen wg. WorkWindow
+#include <vcl/wrkwin.hxx>
+#endif
+#ifndef _SV_TOOLBOX_HXX //autogen wg. ToolBox
+#include <vcl/toolbox.hxx>
+#endif
+
+
+#ifndef _SIMPLECM_HXX //autogen wg. CommunicationManager
+#include <tools/simplecm.hxx>
+#endif
+#ifndef _COMMUNI_HXX //autogen
+#include "communi.hxx"
+#endif
+#include "brooker.hxx"
+//#include <tools/bcst.hxx>
+
+#include "commtest.hrc"
+
+
+
+#define TCP_PORT 17612
+
+#define CUniString( constAsciiStr ) UniString( RTL_CONSTASCII_USTRINGPARAM ( constAsciiStr ) )
+
+
+class PacketSender : public Timer
+{
+ SvStream* mpData;
+ CommunicationLinkRef mxCL;
+
+public:
+ PacketSender( ULONG nDelay, SvStream* pData, CommunicationLink* pCL );
+ virtual void Timeout();
+};
+
+PacketSender::PacketSender( ULONG nDelay, SvStream* pData, CommunicationLink* pCL )
+: mpData( pData )
+, mxCL( pCL )
+{
+ SetTimeout( nDelay );
+ Start();
+}
+
+void PacketSender::Timeout()
+{
+ mxCL->TransferDataStream( mpData );
+ delete mpData;
+ delete this;
+}
+
+
+
+class DelayedDeleter : public Timer
+{
+ CommunicationManager *mpManager;
+
+public:
+ DelayedDeleter( ULONG nDelay, CommunicationManager *pManager );
+ virtual void Timeout();
+};
+
+DelayedDeleter::DelayedDeleter( ULONG nDelay, CommunicationManager *pManager )
+: mpManager( pManager )
+{
+ SetTimeout( nDelay );
+ Start();
+}
+
+void DelayedDeleter::Timeout()
+{
+ delete mpManager;
+ delete this;
+}
+
+
+
+
+class CommunicationTester : public Application
+{
+ DECL_LINK( TBClick, ToolBox* );
+ DECL_LINK( DataReceived, CommunicationLink* );
+ DECL_LINK( ConnectionOpened, CommunicationLink* );
+ DECL_LINK( ConnectionClosed, CommunicationLink* );
+
+
+ CommunicationManager *pClientTcp, *pServerTcp;
+ InformationBroadcaster *pBCSTSend;
+ InformationBroadcaster *pBCSTListen;
+ InformationBrooker *pBCSTBrooker;
+public:
+ CommunicationTester();
+
+ virtual void Main();
+};
+
+CommunicationTester IchSelber;
+
+CommunicationTester::CommunicationTester()
+: pBCSTSend( NULL )
+, pBCSTListen( NULL )
+, pClientTcp( NULL )
+, pBCSTBrooker( NULL )
+, pServerTcp( NULL )
+{}
+
+void CommunicationTester::Main()
+{
+ ResMgr *pRes = new ResMgr( CUniString("commtest.res") );
+ Resource::SetResManager( pRes );
+ WorkWindow aWW( NULL, WB_APP | WB_STDWORK );
+ aWW.Show();
+ ToolBox aTB( &aWW, ResId( TBMenu ) );
+ aTB.Show();
+ aTB.RecalcItems();
+ aTB.SetFloatingMode( TRUE );
+ aTB.SetFloatingMode( FALSE );
+ aTB.SetClickHdl( LINK( this, CommunicationTester, TBClick ) );
+
+ Execute();
+}
+
+#define SWITCH( pManager, ManagerClass ) \
+{ \
+ if ( pManager ) \
+ { \
+ pManager->StopCommunication(); \
+ new DelayedDeleter( 1000, pManager ); \
+ pTB->SetItemState( pTB->GetCurItemId(), STATE_NOCHECK ); \
+ pManager = NULL; \
+ } \
+ else \
+ { \
+ pManager = new ManagerClass; \
+ pManager->SetConnectionOpenedHdl( LINK( this, CommunicationTester, ConnectionOpened ) );\
+ pManager->SetConnectionClosedHdl( LINK( this, CommunicationTester, ConnectionClosed ) );\
+ pManager->SetDataReceivedHdl( LINK( this, CommunicationTester, DataReceived ) );\
+ pTB->SetItemState( pTB->GetCurItemId(), STATE_CHECK ); \
+ } \
+}
+
+
+IMPL_LINK( CommunicationTester, TBClick, ToolBox*, pTB )
+{
+ switch ( pTB->GetCurItemId() )
+ {
+ case SERVER_TCP:
+ {
+ SWITCH( pServerTcp, CommunicationManagerServerViaSocket( TCP_PORT, (USHORT) 32000 ) );
+ if ( pServerTcp )
+ pServerTcp->StartCommunication(); // Am Port horchen
+ }
+ break;
+ case CLIENT_TCP:
+ {
+ SWITCH( pClientTcp, CommunicationManagerClientViaSocket( "localhost", TCP_PORT ) );
+ if ( pClientTcp )
+ pClientTcp->StartCommunication(); // Eine Verbindung aufbauen
+ }
+ break;
+ case BCST_BROOKER:
+ {
+ if ( pBCSTBrooker )
+ {
+ delete pBCSTBrooker;
+ pBCSTBrooker = NULL;
+ }
+ else
+ {
+ pBCSTBrooker = new InformationBrooker();
+ }
+ }
+ break;
+ case BCST_LISTEN:
+ {
+ if ( pBCSTListen )
+ {
+ delete pBCSTListen;
+ pBCSTListen = NULL;
+ }
+ else
+ {
+ pBCSTListen = new InformationBroadcaster();
+ }
+ }
+ case BCST_SEND:
+ {
+ if ( pBCSTSend )
+ {
+ pBCSTSend->Broadcast( BCST_CAT_PL2X, "Message: BCST_CAT_PL2X" );
+ pBCSTSend->Broadcast( BCST_CAT_MINORCOPY, "Message: BCST_CAT_MINORCOPY" );
+ pBCSTSend->Broadcast( BCST_CAT_DELIVER, "Message: BCST_CAT_DELIVER" );
+ pBCSTSend->Broadcast( BCST_CAT_ALL, "Message: BCST_CAT_ALL" );
+ }
+ else
+ {
+ pBCSTSend = new InformationBroadcaster();
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
+IMPL_LINK( CommunicationTester, ConnectionOpened, CommunicationLink*, pCL )
+{
+ SvStream *pData = pCL->GetBestCommunicationStream();
+ while ( pData->Tell() < 70 ) *pData << 123;
+
+ pCL->TransferDataStream( pData );
+ return 0;
+}
+
+IMPL_LINK( CommunicationTester, ConnectionClosed, CommunicationLink*, pCL )
+{
+ return 0;
+}
+
+IMPL_LINK( CommunicationTester, DataReceived, CommunicationLink*, pCL )
+{
+ // Find Manager
+ CommunicationManager* pManager;
+ if ( pClientTcp && pClientTcp->IsLinkValid( pCL ) )
+ {
+ pManager = pClientTcp;
+ }
+ if ( pServerTcp && pServerTcp->IsLinkValid( pCL ) )
+ {
+ DBG_ASSERT( !pManager, "CommunicationLink bei mehreren Managern eingetragen");
+ pManager = pServerTcp;
+ }
+ DBG_ASSERT( pCL->GetCommunicationManager() == pManager, "Manager des Link != Manager bei dem der Link Valid ist");
+
+ // Send Data Back (Echo)
+ new PacketSender( 1000, pCL->GetServiceData(), pCL );
+
+ return 0;
+}
+
diff --git a/svtools/source/plugapp/commtest.hrc b/svtools/source/plugapp/commtest.hrc
new file mode 100644
index 000000000000..23c5c8629d9e
--- /dev/null
+++ b/svtools/source/plugapp/commtest.hrc
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: commtest.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define TBMenu 256
+
+
+#define SERVER_TCP 1
+#define CLIENT_TCP 2
+#define BCST_BROOKER 3
+#define BCST_LISTEN 4
+#define BCST_SEND 5
diff --git a/svtools/source/plugapp/commtest.src b/svtools/source/plugapp/commtest.src
new file mode 100644
index 000000000000..a7c43b0b5d79
--- /dev/null
+++ b/svtools/source/plugapp/commtest.src
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: commtest.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "commtest.hrc"
+
+ToolBox TBMenu {
+ Border = TRUE;
+ SVLook = TRUE;
+ Dockable = TRUE;
+ Pos = MAP_APPFONT( 0, 0 );
+ Size = MAP_APPFONT( 100, 20 );
+ LineCount = 2;
+// FloatingLines = 2;
+ ItemList = {
+ ToolBoxItem {
+ Identifier = SERVER_TCP;
+ Text = "Server TCP";
+ };
+ ToolBoxItem {
+ Identifier = CLIENT_TCP;
+ Text = "Client TCP";
+ };
+ ToolBoxItem {
+ Identifier = BCST_BROOKER;
+ Text = "BroadcastBrooker";
+ };
+ ToolBoxItem {
+ Identifier = BCST_SEND;
+ Text = "BroadcastClientSend";
+ };
+ ToolBoxItem {
+ Identifier = BCST_LISTEN;
+ Text = "BroadcastClientListen";
+ };
+ };
+ Scroll = TRUE;
+};
diff --git a/svtools/source/plugapp/makefile.mk b/svtools/source/plugapp/makefile.mk
new file mode 100644
index 000000000000..fdeb47d6b5ed
--- /dev/null
+++ b/svtools/source/plugapp/makefile.mk
@@ -0,0 +1,111 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=plugapp
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ ttprops.cxx \
+ communi.cxx \
+ brooker.cxx
+
+
+SLOFILES = \
+ $(SLO)$/ttprops.obj \
+ $(SLO)$/communi.obj \
+ $(SLO)$/brooker.obj
+
+
+OBJFILES = $(OBJ)$/commtest.obj $(OBJ)$/brooker.obj
+
+
+.IF "$(GUI)"!="DOS"
+SRCFILES= testtool.src
+.ENDIF
+
+
+LIB1TARGET= $(SLB)$/plugapp.lib
+LIB1OBJFILES= $(SLOFILES)
+
+######## Testapplikation #########
+
+SRC1FILES= commtest.src
+SRS1NAME= commtest
+
+SRS1FILES= $(SRS)$/commtest.srs
+RES1TARGET= commtest
+
+######## Ende Testapplikation #########
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/plugapp/testtool.hrc b/svtools/source/plugapp/testtool.hrc
new file mode 100644
index 000000000000..ca360856ea08
--- /dev/null
+++ b/svtools/source/plugapp/testtool.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * $RCSfile: testtool.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define TTSTART 12345
+
+#define DisplayHidToolBox ( TTSTART + 0 )
+#define TT_SHOW 1
+#define TT_SHOW2 ( TTSTART + 1 )
+#define TT_OUTPUT 3
+#define TT_SEND_DATA 4
+#define TT_ALLWIN 5
+#define TT_KURZNAME 6
+#define TT_LANGNAME 7
+#define TT_ALTERNATE_CAPTION ( TTSTART + 2 )
+
+#define TT_INLINE_TRANSLATION ( TTSTART + 3)
+#define TT_GB_TRANSLATION 1
+#define TT_E_NEW 2
+#define TT_FT_OLD 3
+#define TT_GB_COMMENT 4
+#define TT_E_COMMENT 5
+
+#define TT_PB_SELECT 6
+#define TT_PB_RESTORE 7
+#define TT_PB_ACCEPT 8
+#define TT_PB_NEXT 9
+
+#define TT_DISCARD_CHANGED_DATA ( TTSTART + 4 )
+#define TT_NO_CONTROL ( TTSTART + 5 )
+
+
+#define TT_GPF ( TTSTART + 6 )
diff --git a/svtools/source/plugapp/testtool.src b/svtools/source/plugapp/testtool.src
new file mode 100644
index 000000000000..b2ae9ed1db35
--- /dev/null
+++ b/svtools/source/plugapp/testtool.src
@@ -0,0 +1,622 @@
+/*************************************************************************
+ *
+ * $RCSfile: testtool.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "testtool.hrc"
+#include "solar.hrc"
+
+
+#define Control_Control 5
+#define Control_Border 7
+#define Button_Button Control_Control
+#define ButtonWidth 40
+
+
+ToolBox DisplayHidToolBox {
+ SVLook = TRUE ;
+ Text = "DisplayHID";
+ Text[ english_us ] = "DisplayHID";
+ ItemList = {
+ ToolBoxItem {
+ Type = TOOLBOXITEM_BUTTON;
+ _ToolBoxItemFlags = TIB_AUTOCHECK ;
+
+/*
+class FlagToolBoxState
+{
+ TIB_CHECKABLE, TIB_AUTOCHECK, TIB_RADIOCHECK, TIB_LEFT,
+ TIB_AUTOSIZE, TIB_DROPDOWN,
+};*/
+ Identifier = TT_SHOW;
+ Text = "IDs anzeigen";
+ Text[ english_us ] = "Display IDs";
+ ItemBitmap = Bitmap {
+ File = "ttshow.bmp";
+ };
+ Text[ portuguese ] = "Mostrar IDs";
+ Text[ russian ] = "Ïîêàçàòü IDs";
+ Text[ greek ] = "ÅìöÜíéóç IDs";
+ Text[ dutch ] = "IDs weergeven";
+ Text[ french ] = "Afficher les IDs";
+ Text[ spanish ] = "Mostrar IDs";
+ Text[ italian ] = "Mostra ID";
+ Text[ danish ] = "Vis ID'er";
+ Text[ swedish ] = "Visa ID:n";
+ Text[ polish ] = "Poka¿ IDs";
+ Text[ portuguese_brazilian ] = "IDs anzeigen";
+ Text[ japanese ] = "IDs •\\Ž¦";
+ Text[ korean ] = "ID Ç¥½Ã";
+ Text[ chinese_simplified ] = "ÏÔʾ IDs";
+ Text[ chinese_traditional ] = "Åã¥Ü ID";
+ Text[ arabic ] = "ÅÙåÇÑ IDs";
+ Text[ turkish ] = "ID'leri görüntüle";
+ };
+ ToolBoxItem {
+ Type = TOOLBOXITEM_SEPARATOR;
+ };
+ ToolBoxItem {
+ _ToolBoxItemFlags = TIB_AUTOSIZE;
+ Identifier = TT_OUTPUT;
+ Text = "Das ist das Eingabefenster";
+ Text[ english_us ] = "This is the input window";
+ Text[ portuguese ] = "Esta é a janela de entrada";
+ Text[ russian ] = "Ýòî îêíî ââîäà";
+ Text[ greek ] = "Áõôü åßíáé ôï ðáñÜèõñï åéóáãùãÞò";
+ Text[ dutch ] = "Dit is het invoervenster";
+ Text[ french ] = "Ceci est la fenêtre de saisie";
+ Text[ spanish ] = "Esta es la ventana de entradas";
+ Text[ italian ] = "È una finestra di digitazione";
+ Text[ danish ] = "Dette er inputvinduet";
+ Text[ swedish ] = "Det är inmatningsfönstret";
+ Text[ polish ] = "To jest okno wprowadzania";
+ Text[ portuguese_brazilian ] = "Das ist das Eingabefenster";
+ Text[ japanese ] = "‚±‚ê‚ͲÝÌ߯ĥ³¨ÝÄÞ³‚Å‚·";
+ Text[ korean ] = "ÀÌ°ÍÀº ÀÔ·ÂâÀÔ´Ï´Ù";
+ Text[ chinese_simplified ] = "ÕâÊÇÊäÈëÊÓ´°";
+ Text[ chinese_traditional ] = "³o¬O¤@­Ó¤å¦r¿é¤J¤è¶ô";
+ Text[ arabic ] = "åÐå åí äÇÝÐÉ ÇáÅÏÎÇá";
+ Text[ turkish ] = "Giriþ penceresi";
+ };
+ ToolBoxItem {
+ Type = TOOLBOXITEM_SEPARATOR;
+ };
+ ToolBoxItem {
+ Identifier = TT_SEND_DATA;
+ Text = "Zum TestTool Übertragen";
+ Text[ english_us ] = "Transfer to TestTool";
+ ItemBitmap = Bitmap {
+ File = "ttremote.bmp";
+ };
+ Text[ portuguese ] = "Transferir para TestTool";
+ Text[ russian ] = "Ïåðåäàòü â TestTool";
+ Text[ greek ] = "ÌåôÜäïóç ðñïò ôï TestTool";
+ Text[ dutch ] = "Transfereren naar TestTool";
+ Text[ french ] = "Transmettre au TestTool";
+ Text[ spanish ] = "Transmitir al TestTool";
+ Text[ italian ] = "Trasferisci nel testtool";
+ Text[ danish ] = "Overfør til TestTool";
+ Text[ swedish ] = "Överför till TestTool";
+ Text[ polish ] = "Przenieœ do TestTool";
+ Text[ portuguese_brazilian ] = "Zum TestTool Übertragen";
+ Text[ japanese ] = "TestTool‚Ö“]‘—";
+ Text[ korean ] = "TestTool·Î ¿Å±â±â";
+ Text[ chinese_simplified ] = "´«ËÍÖÁ TestTool";
+ Text[ chinese_traditional ] = "¶Ç»¼µ¹ TestTool";
+ Text[ arabic ] = "äÞá Åáì TestTool";
+ Text[ turkish ] = "TestTool'a aktar";
+ };
+ ToolBoxItem {
+ Type = TOOLBOXITEM_SEPARATOR;
+ };
+ ToolBoxItem {
+ Identifier = TT_ALLWIN;
+ Text = "Alle Fenster anzeigen";
+ Text[ english_us ] = "Show all windows";
+ ItemBitmap = Bitmap {
+ File = "ttall.bmp";
+ };
+ Text[ portuguese ] = "Mostrar janelas todas";
+ Text[ russian ] = "Ïîêàçàòü âñå îêíà";
+ Text[ greek ] = "ÅìöÜíéóç üëùí ôùí ðáñáèýñùí";
+ Text[ dutch ] = "Alle vensters weergeven";
+ Text[ french ] = "Afficher toutes les fenêtres";
+ Text[ spanish ] = "Mostrar todas las ventanas";
+ Text[ italian ] = "Mostra tutte le finestre";
+ Text[ danish ] = "Vis alle vinduer";
+ Text[ swedish ] = "Visa alla fönster";
+ Text[ polish ] = "Poka¿ wszystkie okna";
+ Text[ portuguese_brazilian ] = "Alle Fenster anzeigen";
+ Text[ japanese ] = "‚·‚ׂĂ̳¨ÝÄÞ³‚ð•\\Ž¦";
+ Text[ korean ] = "¸ðµç â Ç¥½Ã";
+ Text[ chinese_simplified ] = "ÏÔʾȫ²¿ÊÓ´°";
+ Text[ chinese_traditional ] = "Åã¥Ü©Ò¦³ªºµøµ¡";
+ Text[ arabic ] = "ÅÙåÇÑ ßÇÝÉ ÇáäæÇÝÐ";
+ Text[ turkish ] = "Tüm pencereleri görüntüle";
+ };
+ ToolBoxItem {
+ Identifier = TT_KURZNAME;
+ Text = "Kurzname Anzeigen(Falls Vorhanden)";
+ Text[ english_us ] = "Show short name (if one exists)";
+ ItemBitmap = Bitmap {
+ File = "ttdef.bmp";
+ };
+ Text[ portuguese ] = "Mostrar nomes abreviados (se existentes)";
+ Text[ russian ] = "Ïîêàçàòü ñîêðàùåííîå èìÿ (åñëè åñòü)";
+ Text[ greek ] = "ÅìöÜíéóç óõíôïìïãñáößá (áí õðÜñ÷åé)";
+ Text[ dutch ] = "Afkorting weergeven (indien voorhanden)";
+ Text[ french ] = "Afficher le nom abrégé (short name) - s'il y a lieu";
+ Text[ spanish ] = "Mostrar nombres abreviados (si existen)";
+ Text[ italian ] = "Mostra nome abbreviato (se esistente)";
+ Text[ danish ] = "Vis kortnavn (hvis findes)";
+ Text[ swedish ] = "Visa kort namn(om det finns)";
+ Text[ polish ] = "Poka¿ skrót (o ile istnieje)";
+ Text[ portuguese_brazilian ] = "Kurzname Anzeigen(Falls Vorhanden)";
+ Text[ japanese ] = "’Z‚¢–¼‘O‚ð•\\Ž¦(Šù‘¶‚·‚éê‡)";
+ Text[ korean ] = "ªÀº À̸§(ÀÖÀ» °æ¿ì) Ç¥½Ã";
+ Text[ chinese_simplified ] = "ÏÔʾ¶ÌÃû³Æ(Èô´æÔڵĻ°)";
+ Text[ chinese_traditional ] = "Åã¥Üµu¦WºÙ(¦pªG¦s¦b)";
+ Text[ arabic ] = "ÅÙåÇÑ ÇáÇÓã ÇáãÎÊÕÑ (ÅÐÇ ßÇä ãæÌæÏÇð)";
+ Text[ turkish ] = "(Varsa) kýsaltmayý görüntüle";
+ };
+ ToolBoxItem {
+ Identifier = TT_LANGNAME;
+ Text = "Langname immer Anzeigen";
+ Text[ english_us ] = "Always show long name";
+ ItemBitmap = Bitmap {
+ File = "tthid.bmp";
+ };
+ Text[ portuguese ] = "Mostrar sempre nome extenso";
+ Text[ russian ] = "Âñåãäà ïîêàçûâàòü ïîëíîå èìÿ";
+ Text[ greek ] = "Íá ãßíåôáé ðÜíôá åìöÜíéóç ôùí ïíïìÜôùí ìåãÜëïõ ìÞêïõò";
+ Text[ dutch ] = "Volledige naam altijd weergeven";
+ Text[ french ] = "Toujours afficher le nom long";
+ Text[ spanish ] = "Mostrar siempre los nombres largos";
+ Text[ italian ] = "Mostra nome intero";
+ Text[ danish ] = "Vis altid langt navn";
+ Text[ swedish ] = "Visa alltid långt namn";
+ Text[ polish ] = "Pokazuj zawsze pe³n¹ nazwê";
+ Text[ portuguese_brazilian ] = "Langname immer Anzeigen";
+ Text[ japanese ] = "í‚É’·‚¢–¼‘O‚ð•\\Ž¦";
+ Text[ korean ] = "±ä À̸§ Ç×»ó Ç¥½Ã";
+ Text[ chinese_simplified ] = "×ÜÊÇÏÔʾ³¤Ãû³Æ(È«³Æ)";
+ Text[ chinese_traditional ] = "Á`¬OÅã¥Üªø¦WºÙ";
+ Text[ arabic ] = "ÅÙåÇÑ ÇáÇÓã ÇáØæíá ÏÇÆãÇð";
+ Text[ turkish ] = "Tam adý daima görüntüle";
+ };
+ };
+ Text[ portuguese ] = "DisplayHID";
+ Text[ russian ] = "DisplayHID";
+ Text[ greek ] = "DisplayHID";
+ Text[ dutch ] = "DisplayHID";
+ Text[ french ] = "DisplayHID";
+ Text[ spanish ] = "DisplayHID";
+ Text[ italian ] = "DisplayHID";
+ Text[ danish ] = "DisplayHID";
+ Text[ swedish ] = "DisplayHID";
+ Text[ polish ] = "DisplayHID";
+ Text[ portuguese_brazilian ] = "DisplayHID";
+ Text[ japanese ] = "DisplayHID";
+ Text[ korean ] = "DisplayHID";
+ Text[ chinese_simplified ] = "DisplayHID";
+ Text[ chinese_traditional ] = "DisplayHID";
+ Text[ arabic ] = "DisplayHID";
+ Text[ turkish ] = "DisplayHID";
+};
+
+Bitmap TT_SHOW2 {
+ File = "ttshow2.bmp";
+};
+
+FloatingWindow TT_INLINE_TRANSLATION {
+ SVLook = TRUE;
+ Size = MAP_APPFONT( 2*Control_Border + 4*ButtonWidth + 3*Button_Button, 120 );
+ Text = "Inplace Translation";
+ Text[ ENGLISH ] = "Inplace Translation";
+ Text[ DANISH ] = "Ny oversættelse";
+ Text[ ENGLISH_US ] = "Inplace Translation";
+ Text[ SPANISH ] = "Nueva traducción";
+ Text[ FRENCH ] = "Relogement inline";
+ Text[ ITALIAN ] = "Nuova traduzione";
+ Text[ JAPANESE ] = "‚Í‚ßž‚Ý–|–ó";
+ Text[ DUTCH ] = "Vertaling";
+ Text[ POLISH ] = "W miejsce t³umaczenia";
+ Text[ PORTUGUESE_BRAZILIAN ] = "Inplace Translation";
+ Text[ RUSSIAN ] = "Íîâûé ïåðåâîä";
+ Text[ SWEDISH ] = "Översättning på plats";
+ Text[ CHINESE_SIMPLIFIED ] = "·­Ò빤¾ß";
+ Text[ PORTUGUESE ] = "Inplace Translation";
+ Moveable = TRUE;
+ Closeable = TRUE;
+ Zoomable = TRUE;
+ GroupBox TT_GB_TRANSLATION {
+ Pos = MAP_APPFONT( 2, 3 );
+ Size = MAP_APPFONT( 173, 44 );
+ Text = "Translation";
+ Text[ ENGLISH_US ] = "Translation";
+ Text[ portuguese ] = "Tradução";
+ Text[ russian ] = "Ïåðåâîä";
+ Text[ dutch ] = "Vertaling";
+ Text[ french ] = "Relogement";
+ Text[ spanish ] = "Traducción";
+ Text[ italian ] = "Traduzione";
+ Text[ danish ] = "Oversættelse";
+ Text[ swedish ] = "Översättning";
+ Text[ polish ] = "T³umaczenie";
+ Text[ portuguese_brazilian ] = "Translation";
+ Text[ japanese ] = "–|–ó";
+ Text[ chinese_simplified ] = "·­Òë";
+ Text[ chinese_traditional ] = "½Ķ";
+ Text[ arabic ] = "ÊÑÌãÉ";
+ Text[ greek ] = "ÌåôÜöñáóç";
+ Text[ korean ] = "¹ø¿ª";
+ Text[ turkish ] = "Çeviri";
+ Text[ language_user1 ] = " ";
+ };
+ Edit TT_E_NEW {
+ Disable = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT( 7, 16 );
+ Size = MAP_APPFONT( 162, 12 );
+ Text = "~Edit";
+ Text[ ENGLISH ] = "Edit";
+ Text[ DANISH ] = "Rediger";
+ Text[ ENGLISH_US ] = "~Edit";
+ Text[ SPANISH ] = "~Editar";
+ Text[ FRENCH ] = "~Edition";
+ Text[ ITALIAN ] = "Modifica";
+ Text[ JAPANESE ] = "•ÒW(~E)";
+ Text[ DUTCH ] = "~Editeren";
+ Text[ POLISH ] = "Edytuj";
+ Text[ PORTUGUESE_BRAZILIAN ] = "Edit";
+ Text[ RUSSIAN ] = "Ïðàâêà";
+ Text[ SWEDISH ] = "~Redigera";
+ Text[ CHINESE_SIMPLIFIED ] = "±à¼­(~E)";
+ Text[ PORTUGUESE ] = "~Editar";
+ TabStop = TRUE;
+ Text[ chinese_traditional ] = "½s¿è(~E)";
+ Text[ arabic ] = "ÊÍÑíÑ";
+ Text[ greek ] = "Åðåîåñãáóßá";
+ Text[ korean ] = "ÆíÁý(~E)";
+ Text[ turkish ] = "~Düzenle";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText TT_FT_OLD {
+ Pos = MAP_APPFONT( 7, 33 );
+ Size = MAP_APPFONT( 162, 10 );
+ Text = "Original Text";
+ Text[ ENGLISH ] = "Original Text";
+ Text[ DANISH ] = "Originaltekst";
+ Text[ ENGLISH_US ] = "Original Text";
+ Text[ SPANISH ] = "Texto original";
+ Text[ FRENCH ] = "Texte d'origine";
+ Text[ ITALIAN ] = "Testo originale";
+ Text[ JAPANESE ] = "µØ¼ÞÅÙ•¶‘";
+ Text[ DUTCH ] = "Originele tekst";
+ Text[ POLISH ] = "Tekst oryginalny";
+ Text[ PORTUGUESE_BRAZILIAN ] = "Original Text";
+ Text[ RUSSIAN ] = "Òåêñò îðèãèíàëà";
+ Text[ SWEDISH ] = "Original text";
+ Text[ CHINESE_SIMPLIFIED ] = "Ô­À´µÄÎÄ×Ö";
+ Text[ PORTUGUESE ] = "Texto original";
+ Text[ chinese_traditional ] = "­ì¨Óªº¤å¦r";
+ Text[ arabic ] = "ÇáäÕ ÇáÃÕáí";
+ Text[ greek ] = "Áñ÷éêü êåßìåíï";
+ Text[ korean ] = "¿ø·¡ ÅؽºÆ®";
+ Text[ turkish ] = "Asýl metin";
+ Text[ language_user1 ] = " ";
+ };
+ GroupBox TT_GB_COMMENT {
+ Pos = MAP_APPFONT( 2, 52 );
+ Size = MAP_APPFONT( 173, 32 );
+ Text = "Comment";
+ Text[ ENGLISH_US ] = "Comment";
+ Text[ portuguese ] = "Comentário";
+ Text[ russian ] = "Êîììåíòàðèé";
+ Text[ dutch ] = "Commentaar";
+ Text[ french ] = "Commentaire";
+ Text[ spanish ] = "Comentario";
+ Text[ italian ] = "Commento";
+ Text[ danish ] = "Kommentar";
+ Text[ swedish ] = "Kommentar";
+ Text[ polish ] = "Komentarz";
+ Text[ portuguese_brazilian ] = "Comment";
+ Text[ japanese ] = "ºÒÝÄ";
+ Text[ chinese_simplified ] = "±¸×¢";
+ Text[ chinese_traditional ] = "³Æµù";
+ Text[ arabic ] = "ÊÚáíÞ";
+ Text[ greek ] = "Ó÷üëéï";
+ Text[ korean ] = "¸Þ¸ð";
+ Text[ turkish ] = "Açýklama";
+ Text[ language_user1 ] = " ";
+ };
+ Edit TT_E_COMMENT {
+ Disable = TRUE;
+ Border = TRUE;
+ Pos = MAP_APPFONT( 7, 64 );
+ Size = MAP_APPFONT( 162, 12 );
+ Text = "~Comment";
+ Text[ ENGLISH_US ] = "~Comment";
+ TabStop = TRUE;
+ Text[ portuguese ] = "~Comentário";
+ Text[ russian ] = "Êîììåíòàðèé";
+ Text[ dutch ] = "~Commentaar";
+ Text[ french ] = "~Commentaire";
+ Text[ spanish ] = "~Comentario";
+ Text[ italian ] = "Commento";
+ Text[ danish ] = "Kommentar";
+ Text[ swedish ] = "~Kommentar";
+ Text[ polish ] = "Komentarz";
+ Text[ portuguese_brazilian ] = "Comment";
+ Text[ japanese ] = "ºÒÝÄ(~C)";
+ Text[ chinese_simplified ] = "±¸×¢(~C)";
+ Text[ chinese_traditional ] = "³Æµù(~C)";
+ Text[ arabic ] = "ÊÚáíÞ";
+ Text[ greek ] = "Ó÷üëéï";
+ Text[ korean ] = "¸Þ¸ð(~C)";
+ Text[ turkish ] = "~Açýklama";
+ Text[ language_user1 ] = " ";
+ };
+ PushButton TT_PB_SELECT {
+ Pos = MAP_APPFONT( Control_Border, 89 );
+ Size = MAP_APPFONT( ButtonWidth, 12 );
+ TabStop = TRUE;
+ Text = "~Select";
+ Text[ ENGLISH ] = "Select";
+ Text[ DANISH ] = "Marker";
+ Text[ ENGLISH_US ] = "~Select";
+ Text[ SPANISH ] = "~Seleccionar";
+ Text[ FRENCH ] = "~Sélectionner";
+ Text[ ITALIAN ] = "Seleziona";
+ Text[ JAPANESE ] = "‘I‘ð‚·‚é(~S)";
+ Text[ DUTCH ] = "~Selecteren";
+ Text[ POLISH ] = "Zaznacz";
+ Text[ PORTUGUESE_BRAZILIAN ] = "Select";
+ Text[ RUSSIAN ] = "Îòáîð";
+ Text[ SWEDISH ] = "~Markera";
+ Text[ CHINESE_SIMPLIFIED ] = "Ñ¡Ôñ(~S)";
+ Text[ PORTUGUESE ] = "~Seleccionar";
+ Text[ chinese_traditional ] = "¿ï¾Ü(~S)";
+ Text[ arabic ] = "ÊÍÏíÏ";
+ Text[ greek ] = "ÅðéëïãÞ";
+ Text[ korean ] = "¼±ÅÃ(~S)";
+ Text[ turkish ] = "~Seç";
+ Text[ language_user1 ] = " ";
+ };
+ PushButton TT_PB_RESTORE {
+ Disable = TRUE;
+ Pos = MAP_APPFONT( Control_Border + ButtonWidth + Button_Button, 89 );
+ Size = MAP_APPFONT( ButtonWidth, 12 );
+ TabStop = TRUE;
+ Text = "~Restore";
+ Text[ ENGLISH ] = "~Restore";
+ Text[ english_us ] = "~Restore";
+ Text[ portuguese ] = "~Restaurar";
+ Text[ russian ] = "~Âîññòàíîâèòü";
+ Text[ greek ] = "Åðáíáöï~ñÜ";
+ Text[ dutch ] = "~Restore";
+ Text[ french ] = "~Restaurer";
+ Text[ spanish ] = "~Restore";
+ Text[ italian ] = "~Rispristina";
+ Text[ danish ] = "Gendan";
+ Text[ swedish ] = "Återställ";
+ Text[ polish ] = "Przywróæ";
+ Text[ portuguese_brazilian ] = "~Restore";
+ Text[ japanese ] = "Œ³‚Ìó‘Ô‚É–ß‚·(~R)";
+ Text[ korean ] = "º¹¿ø(~R)";
+ Text[ chinese_simplified ] = "ÐÞ¸´(~R)";
+ Text[ chinese_traditional ] = "«ì´_(~R)";
+ Text[ arabic ] = "ÇÓÊÚÇÏÉ";
+ Text[ turkish ] = "~Geri yükle";
+ };
+ PushButton TT_PB_ACCEPT {
+ Disable = TRUE;
+ Pos = MAP_APPFONT( Control_Border + 2*(ButtonWidth + Button_Button), 89 );
+ Size = MAP_APPFONT( ButtonWidth, 12 );
+ TabStop = TRUE;
+ Text = "~Accept";
+ Text[ ENGLISH ] = "Accept";
+ Text[ DANISH ] = "Accepter";
+ Text[ ENGLISH_US ] = "~Accept";
+ Text[ SPANISH ] = "~Aceptar";
+ Text[ FRENCH ] = "~Accepter";
+ Text[ ITALIAN ] = "Accetta";
+ Text[ JAPANESE ] = "³‘ø(~A)";
+ Text[ DUTCH ] = "~Accepteren";
+ Text[ POLISH ] = "Zaakceptuj";
+ Text[ PORTUGUESE_BRAZILIAN ] = "Accept";
+ Text[ RUSSIAN ] = "Ïðèíÿòü";
+ Text[ SWEDISH ] = "~Acceptera";
+ Text[ CHINESE_SIMPLIFIED ] = "½ÓÊÜ(~A)";
+ Text[ PORTUGUESE ] = "~Aceitar";
+ Text[ chinese_traditional ] = "±µ¨ü(~A)";
+ Text[ arabic ] = "ÞÈæá";
+ Text[ greek ] = "~Áðïäï÷Þ";
+ Text[ korean ] = "µ¿ÀÇ(~A)";
+ Text[ turkish ] = "~Kabul";
+ Text[ language_user1 ] = " ";
+ };
+ PushButton TT_PB_NEXT {
+ Pos = MAP_APPFONT( Control_Border + 3*(ButtonWidth + Button_Button), 89 );
+ Size = MAP_APPFONT( ButtonWidth, 12 );
+ TabStop = TRUE;
+ Text = "~Next";
+ Text[ ENGLISH ] = "Next";
+ Text[ DANISH ] = "Næste";
+ Text[ ENGLISH_US ] = "~Next";
+ Text[ SPANISH ] = "~Siguiente";
+ Text[ FRENCH ] = "~Suivant";
+ Text[ ITALIAN ] = "Avanti";
+ Text[ JAPANESE ] = "ŽŸ‚Ö(~N)";
+ Text[ DUTCH ] = "~Volgende";
+ Text[ POLISH ] = "Dalej";
+ Text[ PORTUGUESE_BRAZILIAN ] = "Next";
+ Text[ RUSSIAN ] = "Äàëåå";
+ Text[ SWEDISH ] = "~Nästa";
+ Text[ CHINESE_SIMPLIFIED ] = "¼ÌÐø(~N)";
+ Text[ PORTUGUESE ] = "~Seguinte";
+ Text[ chinese_traditional ] = "Ä~Äò(~N)";
+ Text[ arabic ] = "ÇáÊÇáí";
+ Text[ greek ] = "Åðüìåíï";
+ Text[ korean ] = "´ÙÀ½(~N)";
+ Text[ turkish ] = "~Ýleri";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ chinese_traditional ] = "½Ķ¤u¨ã";
+ Text[ arabic ] = "ÊÑÌãÉ Ýí ÇáãæÞÚ";
+ Text[ greek ] = "ÍÝá ìåôÜöñáóç";
+ Text[ korean ] = "³»ºÎ ¹ø¿ª";
+ Text[ turkish ] = "Inplace Translation";
+ Text[ language_user1 ] = " ";
+};
+
+MessBox TT_DISCARD_CHANGED_DATA {
+ Buttons = WB_YES_NO;
+ DefButton = WB_DEF_YES;
+ Message = "The Translation will be lost. Proceed?";
+ Message[ ENGLISH_US ] = "The Translation will be lost. Proceed anyway?";
+ Message[ portuguese ] = "A tradução será perdida. Continuar?";
+ Message[ russian ] = "Ïåðåâîä áóäåò ïîòåðÿí. Âñå ðàâíî ïðîäîëæèòü?";
+ Message[ dutch ] = "De vertaling gaat verloren. Toch doorgaan?";
+ Message[ french ] = "Le relogement sera perdu. Souhaitez-vous poursouivre ?";
+ Message[ spanish ] = "Se perderá la traducción. ¿Continuar?";
+ Message[ italian ] = "La traduzione andrà persa. Continuare?";
+ Message[ danish ] = "Oversættelsen vil gå tabt. Vil du fortsætte alligevel?";
+ Message[ swedish ] = "Översättningen kommer att gå förlorad. Fortsätta ändå?";
+ Message[ polish ] = "T³umaczenie zaginie. Kontynuowaæ?";
+ Message[ portuguese_brazilian ] = "The Translation will be lost. Proceed?";
+ Message[ japanese ] = "–|–󂪎¸‚í‚ê‚Ü‚µ‚½B‘±‚¯‚Ü‚·‚©?";
+ Message[ chinese_simplified ] = "·­ÒëÄÚÈݽ«»áÒÅʧ¡£ÄúÒª¼ÌÐøÂð£¿";
+ Message[ chinese_traditional ] = "½Ķ¤º®e±N·|¬y¥¢¡C±z­nÄ~Äò¡H";
+ Message[ arabic ] = "åÐå ÇáÊÑÌãÉ ÓæÝ ÊÖíÚ. åá ÊÑíÏ ÇáãÊÇÈÚÉ Úáì ÇáÑÛã ãä Ðáß¿";
+ Message[ greek ] = "Ç ìåôÜöñáóç èá ÷áèåß. ÓõíÝ÷åéá;";
+ Message[ korean ] = "¹ø¿ªÀ» ÀÒ°Ô µË´Ï´Ù. °è¼ÓÇϽðڽÀ´Ï±î?";
+ Message[ turkish ] = "Çevriri kaybolacak. Devam etmek istiyor musunuz?";
+ Message[ language_user1 ] = " ";
+};
+
+ErrorBox TT_NO_CONTROL {
+ Buttons = WB_OK;
+ DefButton = WB_DEF_OK;
+ Message = "The Control is no longer valid. The Translation cannot be saved.";
+ Message [ ENGLISH_US ] = "This Control is no longer valid. The Translation cannot be saved.";
+ Message[ portuguese ] = "Este Controlo já não é válido. Impossível guardar a tradução.";
+ Message[ russian ] = "Êîìàíäà áîëüøå íåäåéñòâèòåëüíà. Ïåðåâîä ñîõðàíèòü íåâîçìîæíî.";
+ Message[ dutch ] = "De controle is niet langer geldig. De vertaling kan niet worden opgeslagen";
+ Message[ french ] = "Le contrôle n'est plus valable. Impossible d'enregistrer le relogement.";
+ Message[ spanish ] = "La validez del control no durará mucho. No se puede guardar la traducción.";
+ Message[ italian ] = "Il controllo non è più valido. Non è stato possibile salvare la traduzione.";
+ Message[ danish ] = "Kontrollen er ikke mere tilgængelig. Oversættelsen kan ikke gemmes.";
+ Message[ swedish ] = "Kontrollen är inte längre giltig. Översättningen kan inte sparas.";
+ Message[ polish ] = "Polecenie nie jest wa¿ne. T³umaczenia nie mo¿na zapisaæ.";
+ Message[ portuguese_brazilian ] = "The Control is no longer valid. The Translation cannot be saved.";
+ Message[ japanese ] = "ºÝÄÛ°Ù‚Í‚à‚¤—LŒø‚Å‚Í‚ ‚è‚Ü‚¹‚ñB–|–ó‚ð•Û‘¶‚Å‚«‚Ü‚¹‚ñB";
+ Message[ chinese_simplified ] = "Õâ¸ö¿Ø¼þÒѾ­ÎÞЧ¡£ÎÞ·¨´æÅÌ·­ÒëÄÚÈÝ¡£";
+ Message[ chinese_traditional ] = "³o­Ó±±¨î¶µ¤w¸gµL®Ä¡CµLªkÀx¦s½Ķ¤º®e¡C";
+ Message[ arabic ] = "ÚäÕÑ ÇáÊÍßã åÐÇ áã íÚÏ ÕÇáÍÇð. áÇ íãßä ÍÝÙ ÇáÊÑÌãÉ.";
+ Message[ greek ] = "Ôï óôïé÷åßï åëÝã÷ïõ äåí åßíáé ðëÝïí Ýãêõñï. Äåí åßíáé äõíáôüí íá áðïèçêåõôåß ç ìåôÜöñáóç.";
+ Message[ korean ] = "ÄÁÆ®·ÑÀÌ ´õ ÀÌ»ó À¯È¿ÇÏÁö ¾Ê½À´Ï´Ù. º¯È¯ÇÑ °ÍÀ» ÀúÀåÇÒ ¼ö ¾ø½À´Ï´Ù.";
+ Message[ turkish ] = "Denetim artýk geçerli deðil. Çeviri kaydedilemiyor.";
+ Message[ language_user1 ] = " ";
+};
+
+String TT_GPF
+{
+ Text = "GPF Aufgetreten";
+ Text[ english_us ] = "GPF occured";
+ Text[ portuguese ] = "Ocorreu um erro GPF";
+ Text[ russian ] = "Ïðîèçîøëà îøèáêà";
+ Text[ greek ] = "ÐáñïõóéÜóôçêå ãåíéêü óöÜëìá ðñïóôáóßáò (GPF)";
+ Text[ dutch ] = "Algemene fout opgetreden";
+ Text[ french ] = "Erreur (GPF) survenue";
+ Text[ spanish ] = "Ha ocurrido un error";
+ Text[ italian ] = "Si è verificato un GPF";
+ Text[ danish ] = "Der opstod en fejl";
+ Text[ swedish ] = "Fel uppstod";
+ Text[ polish ] = "Wyst¹pi³ b³¹d";
+ Text[ portuguese_brazilian ] = "GPF Aufgetreten";
+ Text[ japanese ] = "GPF‚ª”­¶‚µ‚Ü‚µ‚½";
+ Text[ korean ] = "GPF ¹ß»ý";
+ Text[ chinese_simplified ] = "³öÏÖ´íÎó";
+ Text[ chinese_traditional ] = "µo¥X¿ù»~";
+ Text[ arabic ] = "ÍÏË ÎØÃ GPF";
+ Text[ turkish ] = "GKH oluþtu";
+};
+
+String TT_ALTERNATE_CAPTION
+{
+ Text = "HelpID ungleich UniqueID: ";
+ Text[ english_us ] = "HelpID does not match UniqueID: ";
+ Text[ portuguese ] = "HelpID desigual a UniqueID ";
+ Text[ russian ] = "HelpID íå ðàâíî UniqueID: ";
+ Text[ greek ] = "HelpID äåí åßíáé ßóï ìå UniqueID:";
+ Text[ dutch ] = "HelpID niet gelijk aan UniqueID: ";
+ Text[ french ] = "HelpID différent de l'UniqueID : ";
+ Text[ spanish ] = "HelpID difiere de UniqueID:";
+ Text[ italian ] = "HelpID diverso da UniqueID: ";
+ Text[ danish ] = "HelpID ikke lig med UniqueID: ";
+ Text[ swedish ] = "HelpID ej lika med UniqueID: ";
+ Text[ polish ] = "HelpID nie jest równy UniquellID: ";
+ Text[ portuguese_brazilian ] = "GPF Aufgetreten";
+ Text[ japanese ] = "ÍÙÌßID ‚Æ ÕÆ°¸ID‚Æ‚Í“¯ˆê‚Å‚Í‚ ‚è‚Ü‚¹‚ñ: ";
+ Text[ korean ] = "µµ¿ò¸»ID¿Í °íÀ¯ID°¡ ÀÏÄ¡ÇÏÁö ¾ÊÀ½ ";
+ Text[ chinese_simplified ] = "HelpID does not match UniqueID: ";
+ Text[ chinese_traditional ] = "HelpID does not match UniqueID: ";
+ Text[ arabic ] = "HelpID ÛíÑ ãØÇÈÞ áÜ UniqueID: ";
+ Text[ turkish ] = "HelpID ile UniqueID eþit deðil: ";
+};
diff --git a/svtools/source/plugapp/ttprops.cxx b/svtools/source/plugapp/ttprops.cxx
new file mode 100644
index 000000000000..7548d4cb764c
--- /dev/null
+++ b/svtools/source/plugapp/ttprops.cxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: ttprops.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_TTPROPS_HXX // handmade
+#include "ttprops.hxx"
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX //autogen
+#include <vcl/bitmap.hxx>
+#endif
+#ifndef _RTTI_HXX // manual
+#include <tools/rtti.hxx>
+#endif
+
+TYPEINIT1( TTProperties, ApplicationProperty )
+
+BOOL TTProperties::RequestProperty( USHORT nRequest )
+{
+ if ( (( nRequest & TT_PR_ONCE ) == 0) || (nDonePRs & (nRequest & 0x0ff)) == 0 )
+ {
+ nActualPR = nRequest;
+ nDonePRs |= nRequest;
+ GetpApp()->Property( *this );
+ return nActualPR == 0;
+ }
+ return TRUE;
+}
+
+
+BOOL TTProperties::GetSlots()
+{
+ RequestProperty( TT_PR_SLOTS );
+ return HasSlots();
+}
+
+USHORT TTProperties::ExecuteFunction( USHORT nSID, SfxPoolItem** ppArgs, USHORT nMode )
+{
+ mnSID = nSID;
+ mppArgs = ppArgs;
+ mnMode = nMode;
+ RequestProperty( TT_PR_DISPATCHER );
+ mppArgs = NULL;
+ return nActualPR;
+}
+
+BOOL TTProperties::Img( Bitmap *pBmp )
+{
+ BOOL bRet;
+ mpBmp = pBmp;
+ bRet = RequestProperty( TT_PR_IMG );
+ mpBmp = NULL;
+ return bRet;
+}
+
+SvtResId TTProperties::GetSvtResId( USHORT nId )
+{
+ return SvtResId( nId );
+}
+
diff --git a/svtools/source/svdde/ddecli.cxx b/svtools/source/svdde/ddecli.cxx
new file mode 100644
index 000000000000..70c6fb0db864
--- /dev/null
+++ b/svtools/source/svdde/ddecli.cxx
@@ -0,0 +1,509 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddecli.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h> // memset
+#include "ddeimp.hxx"
+#include <svdde.hxx>
+
+#include <osl/thread.h>
+
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+// 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() ----------------------------------
+
+#ifdef WNT
+HDDEDATA CALLBACK DdeInternal::CliCallback(
+ WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
+ HDDEDATA hData, DWORD nInfo1, DWORD nInfo2 )
+#else
+#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC )
+HDDEDATA CALLBACK __EXPORT DdeInternal::CliCallback(
+ WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
+ HDDEDATA hData, DWORD nInfo1, DWORD nInfo2 )
+#else
+HDDEDATA CALLBACK _export DdeInternal::CliCallback(
+ WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
+ HDDEDATA hData, DWORD nInfo1, DWORD nInfo2 )
+#endif
+#endif
+{
+ 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 = 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;
+ UINT nFmt = aDdeData.pImp->nFmt;
+ 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, nFmt, (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 = nFmt;
+ 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, nFmt,
+ (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 )
+{
+ aData.Call( (void*)p );
+}
+
+// --- 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 = (short)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 )
+{
+ const char* p = ByteString( rData, osl_getThreadTextEncoding() ).GetBuffer();
+ aDdeData = DdeData( (char*) p, 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 )
+{
+ const char* p = ByteString( rData, osl_getThreadTextEncoding() ).GetBuffer();;
+ aDdeData = DdeData( (char*) p, 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
new file mode 100644
index 000000000000..e6fb2d96f35a
--- /dev/null
+++ b/svtools/source/svdde/ddedata.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddedata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// 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 <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;
+ SetFormat( 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
+{
+ ULONG nRet = pImp->nFmt;
+ switch( nRet )
+ {
+ case CF_TEXT:
+ nRet = FORMAT_STRING;
+ break;
+
+ case CF_BITMAP:
+ nRet = FORMAT_BITMAP;
+ break;
+
+ case CF_METAFILEPICT:
+ nRet = FORMAT_GDIMETAFILE;
+ break;
+
+ default:
+#if defined(WIN) || defined(WNT)
+ if ( pImp->nFmt >= CF_MAX )
+ {
+ TCHAR szName[ 256 ];
+
+ if( GetClipboardFormatName( pImp->nFmt, szName, sizeof(szName) ) )
+ nRet = SotExchange::RegisterFormatName( String(szName) );
+ }
+#endif
+#if defined(PM2)
+ if( pImp->nFmt > CF_PALETTE )
+ {
+ char szName[ 256 ];
+
+ HATOMTBL hSysTable = WinQuerySystemAtomTable();
+ WinQueryAtomName( hSysTable, (ATOM)pImp->nFmt, (PSZ)szName,
+ sizeof( szName ) );
+ nRet = SotExchange::RegisterFormatName( String( szName ) );
+ }
+#endif
+ }
+ return nRet;
+}
+
+// --- 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;
+}
+
+// --- DdeData::SetFormat() ---------------------------------------
+
+void DdeData::SetFormat( ULONG nFmt )
+{
+ switch( nFmt )
+ {
+ case FORMAT_STRING:
+ pImp->nFmt = CF_TEXT;
+ break;
+ case FORMAT_BITMAP:
+ pImp->nFmt = CF_BITMAP;
+ break;
+ case FORMAT_GDIMETAFILE:
+ pImp->nFmt = CF_METAFILEPICT;
+ break;
+
+ default:
+ {
+ String aName( SotExchange::GetFormatName( nFmt ) );
+
+#if defined(WNT) || defined(WIN)
+
+ if( aName.Len() )
+ pImp->nFmt = RegisterClipboardFormat( aName.GetBuffer() );
+ else
+#endif
+#if defined( PM2 )
+
+ if( aName.Len() )
+ {
+ HATOMTBL hSysTable = WinQuerySystemAtomTable();
+ pImp->nFmt = (ULONG)WinAddAtom( hSysTable, (PSZ)aName.GetBuffer() );
+ }
+ else
+#endif
+ pImp->nFmt = (USHORT)nFmt;
+ }
+ }
+}
+
diff --git a/svtools/source/svdde/ddedll.cxx b/svtools/source/svdde/ddedll.cxx
new file mode 100644
index 000000000000..d4220d1b439d
--- /dev/null
+++ b/svtools/source/svdde/ddedll.cxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddedll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifdef WIN
+
+#pragma hdrstop
+
+#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
new file mode 100644
index 000000000000..33863d09ba54
--- /dev/null
+++ b/svtools/source/svdde/ddeimp.hxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddeimp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DDEIMP_HXX
+#define _DDEIMP_HXX
+
+#ifdef OS2
+
+#include "ddemlos2.h"
+#ifndef _SYSDEP_HXX
+#include <vcl/sysdep.hxx>
+#endif
+
+#define WORD USHORT
+#define DWORD ULONG
+#define LPBYTE BYTE*
+#define LPWORD USHORT*
+#define LPDWORD ULONG*
+
+#else
+
+#include <tools/svwin.h>
+extern "C"
+{
+#define BOOL WIN_BOOL
+#define BYTE WIN_BYTE
+#include <ddeml.h>
+#undef BOOL
+#undef BYTE
+};
+
+#endif
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+#ifndef _LIST_HXX //autogen
+#include <tools/list.hxx>
+#endif
+#ifndef _SHL_HXX //autogen
+#include <tools/shl.hxx>
+#endif
+
+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;
+ USHORT 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
new file mode 100644
index 000000000000..98ff34bb52ec
--- /dev/null
+++ b/svtools/source/svdde/ddeinf.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddeinf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define UNICODE
+
+#include <string.h>
+#include "ddeimp.hxx"
+#include <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;
+ HCONV hConv = NULL;
+ short nStatus = DMLERR_NO_ERROR;
+ HSZ hTopic = NULL;
+
+ 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 = pTopic->GetBuffer();
+ hTopic = DdeCreateStringHandle( hDdeInst, p, CP_WINUNICODE );
+ }
+
+ 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( buf ) );
+ }
+ }
+ DdeDisconnectList( hConvList );
+ }
+
+ if ( hTopic)
+ DdeFreeStringHandle( hDdeInst, hTopic );
+ if ( hDdeInst )
+ DdeUninitialize( hDdeInst );
+}
+
+// --- 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( SZDDESYS_TOPIC ) );
+
+ if ( !aSys.GetError() )
+ {
+ DdeRequest aReq( aSys, String( 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
new file mode 100644
index 000000000000..0b4137628da2
--- /dev/null
+++ b/svtools/source/svdde/ddeml1.cxx
@@ -0,0 +1,2689 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddeml1.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*
+ 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,
+ "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,
+ "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
new file mode 100644
index 000000000000..551d7b2950e4
--- /dev/null
+++ b/svtools/source/svdde/ddeml2.cxx
@@ -0,0 +1,1157 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddeml2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define INCL_DOS
+#include <stdlib.h>
+
+#include "ddemlimp.hxx"
+#define LOGFILE
+#define STATUSFILE
+#define DDEDATAFILE
+#include "ddemldeb.hxx"
+
+#ifdef VCL
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx> // fuer IsRemoteServer
+#endif
+#endif
+
+
+#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,"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,
+ "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,
+ "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)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return DMLERR_UNFOUND_QUEUE_ID;
+#endif
+ 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)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return TRUE;
+#endif
+ 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)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ if( !idInst )
+ return 0;
+ return ((ImpDdeMgr*)idInst)->DdeConnectList(hszService,hszTopic,
+ hConvList, pCC );
+}
+
+HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ return ImpDdeMgr::DdeQueryNextServer( hConvList, hConvPrev );
+}
+
+BOOL DdeDisconnectList(HCONVLIST hConvList)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ return ImpDdeMgr::DdeDisconnectList( hConvList );
+}
+
+HCONV DdeConnect(ULONG idInst, HSZ hszService, HSZ hszTopic,
+ CONVCONTEXT* pCC)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ if( !idInst )
+ return 0;
+ return ((ImpDdeMgr*)idInst)->DdeConnect( hszService, hszTopic, pCC );
+}
+
+BOOL DdeDisconnect(HCONV hConv)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ return ImpDdeMgr::DdeDisconnect( hConv );
+}
+
+HCONV DdeReconnect(HCONV hConv)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ return ImpDdeMgr::DdeReconnect( hConv );
+}
+
+
+USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTransact, CONVINFO* pCI )
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return DMLERR_DLL_NOT_INITIALIZED;
+#endif
+ return ImpDdeMgr::DdeQueryConvInfo( hConv, idTransact, pCI );
+}
+
+BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return DMLERR_DLL_NOT_INITIALIZED;
+#endif
+ return ImpDdeMgr::DdeSetUserHandle( hConv, id, hUser );
+}
+
+BOOL DdeAbandonTransaction(ULONG idInst, HCONV hConv, ULONG idTransaction)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ if( !idInst )
+ return FALSE;
+ return ((ImpDdeMgr*)idInst)->DdeAbandonTransaction(hConv,idTransaction);
+}
+
+BOOL DdePostAdvise(ULONG idInst, HSZ hszTopic, HSZ hszItem)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ if( !idInst )
+ return FALSE;
+ return ((ImpDdeMgr*)idInst)->DdePostAdvise( hszTopic, hszItem );
+}
+
+BOOL DdeEnableCallback(ULONG idInst, HCONV hConv, USHORT wCmd)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ 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)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ 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)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ if( !idInst )
+ return 0;
+ return ((ImpDdeMgr*)idInst)->DdeCreateDataHandle( pSrc, cb,
+ cbOff, hszItem, wFmt, afCmd );
+}
+
+HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ return ImpDdeMgr::DdeAddData( hData, pSrc, cb, cbOff );
+}
+
+ULONG DdeGetData(HDDEDATA hData, void* pDst, ULONG cbMax, ULONG cbOff)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ return ImpDdeMgr::DdeGetData( hData, pDst, cbMax, cbOff );
+}
+
+BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ return ImpDdeMgr::DdeAccessData( hData, pcbDataSize );
+}
+
+BOOL DdeUnaccessData(HDDEDATA hData)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ return ImpDdeMgr::DdeUnaccessData( hData );
+}
+
+BOOL DdeFreeDataHandle(HDDEDATA hData)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ return ImpDdeMgr::DdeFreeDataHandle( hData );
+}
+
+USHORT DdeGetLastError(ULONG idInst)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return DMLERR_DLL_NOT_INITIALIZED;
+#endif
+ if( !idInst )
+ return DMLERR_DLL_NOT_INITIALIZED;
+ return ((ImpDdeMgr*)idInst)->DdeGetLastError();
+}
+
+HSZ DdeCreateStringHandle(ULONG idInst, PSZ pszString,int iCodePage )
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ if( !idInst )
+ return 0;
+ return ((ImpDdeMgr*)idInst)->DdeCreateStringHandle(pszString,iCodePage);
+}
+
+ULONG DdeQueryString( ULONG idInst, HSZ hsz, PSZ pBuf,
+ ULONG cchMax, int iCodePage )
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ if( !idInst )
+ return 0;
+ return ((ImpDdeMgr*)idInst)->DdeQueryString( hsz,pBuf,cchMax,iCodePage);
+}
+
+BOOL DdeFreeStringHandle( ULONG idInst, HSZ hsz)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ if( !idInst )
+ return FALSE;
+ return ((ImpDdeMgr*)idInst)->DdeFreeStringHandle( hsz );
+}
+
+BOOL DdeKeepStringHandle( ULONG idInst, HSZ hsz )
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return FALSE;
+#endif
+ if( !idInst )
+ return FALSE;
+ return ((ImpDdeMgr*)idInst)->DdeKeepStringHandle( hsz );
+}
+
+int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return -1;
+#endif
+ return ImpDdeMgr::DdeCmpStringHandles( hsz1, hsz2 );
+}
+
+HDDEDATA DdeNameService( ULONG idInst, HSZ hsz1, HSZ hszRes, USHORT afCmd )
+{
+#ifdef VCL
+ if( Application::IsRemoteServer() )
+ return 0;
+#endif
+ if( !idInst )
+ return 0;
+ return ((ImpDdeMgr*)idInst)->DdeNameService( hsz1, afCmd );
+}
+
+
diff --git a/svtools/source/svdde/ddemldeb.cxx b/svtools/source/svdde/ddemldeb.cxx
new file mode 100644
index 000000000000..6bdd12dfc50e
--- /dev/null
+++ b/svtools/source/svdde/ddemldeb.cxx
@@ -0,0 +1,311 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddemldeb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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
new file mode 100644
index 000000000000..8fde6e335bbd
--- /dev/null
+++ b/svtools/source/svdde/ddemldeb.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddemldeb.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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
new file mode 100644
index 000000000000..e26020cd6370
--- /dev/null
+++ b/svtools/source/svdde/ddemlimp.hxx
@@ -0,0 +1,467 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddemlimp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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
new file mode 100644
index 000000000000..c6dd1cffcbbb
--- /dev/null
+++ b/svtools/source/svdde/ddemlos2.h
@@ -0,0 +1,411 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddemlos2.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#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>
+#ifndef _SYSDEP_HXX
+#include <vcl/sysdep.hxx>
+#endif
+
+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
new file mode 100644
index 000000000000..ae1865e7e1a9
--- /dev/null
+++ b/svtools/source/svdde/ddestrg.cxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddestrg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define UNICODE
+
+#include "ddeimp.hxx"
+#include <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
new file mode 100644
index 000000000000..d949a7bfb738
--- /dev/null
+++ b/svtools/source/svdde/ddesvr.cxx
@@ -0,0 +1,1136 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddesvr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define UNICODE
+#include "ddeimp.hxx"
+#include <svdde.hxx>
+#include <svarray.hxx>
+
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+//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:
+ {
+ short 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 == 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 == 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 == SZDDESYS_ITEM_TOPICS )
+ aRes = pService->Topics();
+ else if ( pTopic->aItem == SZDDESYS_ITEM_SYSITEMS )
+ aRes = pService->SysItems();
+ else if ( pTopic->aItem == SZDDESYS_ITEM_STATUS )
+ aRes = pService->Status();
+ else if ( pTopic->aItem == SZDDESYS_ITEM_FORMATS )
+ aRes = pService->Formats();
+ else if ( pTopic->aItem == 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( NULL, 0, nCbType ).GetFormat() );
+ else
+ pData = pTopic->Get( DdeData( NULL, 0, nCbType ).GetFormat() );
+
+ if ( pData )
+ return DdeCreateDataHandle( pInst->hDdeInstSvr,
+ (LPBYTE)pData->pImp->pData,
+ pData->pImp->nData,
+ 0, hText2, pData->pImp->nFmt, 0);
+ }
+ break;
+
+ case XTYP_POKE:
+ if ( !pTopic->IsSystemTopic() )
+ {
+ DdeData d;
+ d.pImp->hData = hData;
+ d.pImp->nFmt = 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 = nCbType;
+ aExec.Lock();
+ String 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( 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( 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 = 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( SZDDESYS_TOPIC );
+ pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_TOPICS ) );
+ pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_SYSITEMS ) );
+ pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_STATUS ) );
+ pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_FORMATS ) );
+ pSysTopic->AddItem( DdeItem( 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 ?!
+
+#ifndef VCL
+ DdeNameService( pInst->hDdeInstSvr, *pName, NULL, DNS_UNREGISTER );
+#endif
+
+ 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 )
+{
+ DdeData d( NULL, 0, nFmt );
+ return HasCbFormat( d.pImp->nFmt );
+}
+
+// --- DdeService::AddFormat() -------------------------------------
+
+void DdeService::AddFormat( ULONG nFmt )
+{
+ DdeData d( NULL, 0, nFmt );
+ aFormats.Remove( (long)d.pImp->nFmt );
+ aFormats.Insert( (long)d.pImp->nFmt );
+}
+
+// --- DdeService::RemoveFormat() ----------------------------------
+
+void DdeService::RemoveFormat( ULONG nFmt )
+{
+ DdeData d( NULL, 0, nFmt );
+ aFormats.Remove( (long)d.pImp->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() == 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 += (*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() == String::CreateFromAscii( (const sal_Char *)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 = String::CreateFromAscii("TEXT").GetBuffer();
+ break;
+ case CF_BITMAP:
+ p = 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( 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/makefile.mk b/svtools/source/svdde/makefile.mk
new file mode 100644
index 000000000000..d7e840a52ff6
--- /dev/null
+++ b/svtools/source/svdde/makefile.mk
@@ -0,0 +1,123 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+
+.IF "$(GUIBASE)"=="WIN" || "$(GUIBASE)"=="OS2"
+
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=svdde
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= ddecli.cxx \
+ ddesvr.cxx \
+ ddedata.cxx \
+ ddestrg.cxx \
+ ddeinf.cxx
+
+.IF "$(GUIBASE)"=="OS2"
+CXXFILES+=\
+ ddeml1.cxx \
+ ddeml2.cxx \
+ ddemldeb.cxx
+.ENDIF
+
+SLOFILES= $(SLO)$/ddecli.obj \
+ $(SLO)$/ddesvr.obj \
+ $(SLO)$/ddedata.obj \
+ $(SLO)$/ddestrg.obj \
+ $(SLO)$/ddeinf.obj
+
+.IF "$(GUIBASE)"=="OS2"
+SLOFILES+=\
+ $(SLO)$/ddeml1.obj \
+ $(SLO)$/ddeml2.obj \
+ $(SLO)$/ddemldeb.obj
+.ENDIF
+.IF "$(depend)" == ""
+
+# --- Targets -------------------------------------------------------
+
+ALL: $(SLB)$/$(TARGET).lib \
+ ALLTAR
+
+
+.ENDIF
+
+.INCLUDE : target.mk
+
+
+.ELSE
+dummy:
+ @echo GUI == "$(GUI)" - nothing to do
+
+.ENDIF
+
diff --git a/svtools/source/svhtml/htmlkey2.cxx b/svtools/source/svhtml/htmlkey2.cxx
new file mode 100644
index 000000000000..c954ed3c9e37
--- /dev/null
+++ b/svtools/source/svhtml/htmlkey2.cxx
@@ -0,0 +1,700 @@
+/*************************************************************************
+ *
+ * $RCSfile: htmlkey2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "htmlkywd.hxx"
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_doctype32,
+ "HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\"" );
+
+
+// diese werden nur eingeschaltet
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_area, "AREA" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_base, "BASE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_comment, "!--" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_doctype, "!DOCTYPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_embed, "EMBED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_figureoverlay, "OVERLAY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_horzrule, "HR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_horztab, "TAB" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_image, "IMG" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_image2, "IMAGE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_input, "INPUT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_isindex, "ISINDEX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_linebreak, "BR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_li, "LI" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_link, "LINK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_meta, "META" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_nextid, "NEXTID" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_nobr, "NOBR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_of, "OF" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_option, "OPTION" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_param, "PARAM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_range, "RANGE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_spacer, "SPACER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_wbr, "WBR" );
+
+// diese werden wieder abgeschaltet
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_abbreviation, "ABBREV" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_above, "ABOVE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_acronym, "ACRONYM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_address, "ADDRESS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_anchor, "A" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_applet, "APPLET" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_array, "ARRAY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_author, "AU" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_banner, "BANNER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_bar, "BAR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_basefont, "BASEFONT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_below, "BELOW" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_bigprint, "BIG" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_blink, "BLINK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_blockquote, "BLOCKQUOTE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_blockquote30, "BQ" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_body, "BODY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_bold, "B" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_boldtext, "BT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_box, "BOX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_caption, "CAPTION" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_center, "CENTER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_citiation, "CITE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_code, "CODE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_col, "COL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_colgroup, "COLGROUP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_credit, "CREDIT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_dd, "DD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_deflist, "DL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_deletedtext, "DEL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_dirlist, "DIR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_division, "DIV" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_dot, "DOT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_doubledot, "DDOT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_dt, "DT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_emphasis, "EM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_figure, "FIG" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_font, "FONT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_footnote, "FN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_form, "FORM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_frame, "FRAME" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_frameset, "FRAMESET" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_hat, "HAT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_head1, "H1" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_head2, "H2" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_head3, "H3" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_head4, "H4" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_head5, "H5" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_head6, "H6" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_head, "HEAD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_html, "HTML" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_iframe, "IFRAME" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_ilayer, "ILAYER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_insertedtext, "INS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_italic, "I" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_item, "ITEM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_keyboard, "KBD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_language, "LANG" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_layer, "LAYER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_listheader, "LH" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_map, "MAP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_math, "MATH" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_menulist, "MENU" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_multicol, "MULTICOL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_noembed, "NOEMBED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_noframe, "NOFRAME" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_noframes, "NOFRAMES" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_noscript, "NOSCRIPT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_note, "NOTE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_orderlist, "OL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_parabreak, "P" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_person, "PERSON" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_plaintext, "T" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_preformtxt, "PRE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_root, "ROOT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_row, "ROW" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sample, "SAMP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_script, "SCRIPT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_select, "SELECT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_shortquote, "Q" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_smallprint, "SMALL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_span, "SPAN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_squareroot, "AQRT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_strikethrough, "S" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_strong, "STRONG" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_style, "STYLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_subscript, "SUB" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_superscript, "SUP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_table, "TABLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_tablerow, "TR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_tabledata, "TD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_tableheader, "TH" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_tbody, "TBODY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_teletype, "TT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_text, "TEXT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_textarea, "TEXTAREA" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_textflow, "TEXTFLOW" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_tfoot, "TFOOT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_thead, "THEAD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_tilde, "TILDE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_title, "TITLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_underline, "U" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_unorderlist, "UL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_variable, "VAR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_vector, "VEC" );
+
+// obsolete features
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_xmp, "XMP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_listing, "LISTING" );
+
+// proposed features
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_definstance, "DFN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_strike, "STRIKE" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_bgsound, "BGSOUND" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_comment2, "COMMENT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_marquee, "MARQUEE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_plaintext2, "PLAINTEXT" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sdfield, "SDFIELD" );
+
+// die Namen fuer alle Zeichen
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_lt, "lt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_gt, "gt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_amp, "amp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_quot, "quot" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Aacute, "Aacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Agrave, "Agrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Acirc, "Acirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Atilde, "Atilde" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Aring, "Aring" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Auml, "Auml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_AElig, "AElig" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ccedil, "Ccedil" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Eacute, "Eacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Egrave, "Egrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ecirc, "Ecirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Euml, "Euml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Iacute, "Iacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Igrave, "Igrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Icirc, "Icirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Iuml, "Iuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_ETH, "ETH" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ntilde, "Ntilde" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Oacute, "Oacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ograve, "Ograve" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ocirc, "Ocirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Otilde, "Otilde" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ouml, "Ouml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Oslash, "Oslash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Uacute, "Uacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ugrave, "Ugrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Ucirc, "Ucirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Uuml, "Uuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_Yacute, "Yacute" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_THORN, "THORN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_szlig, "szlig" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_aacute, "aacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_agrave, "agrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_acirc, "acirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_atilde, "atilde" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_aring, "aring" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_auml, "auml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_aelig, "aelig" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ccedil, "ccedil" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_eacute, "eacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_egrave, "egrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ecirc, "ecirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_euml, "euml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_iacute, "iacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_igrave, "igrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_icirc, "icirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_iuml, "iuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_eth, "eth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ntilde, "ntilde" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_oacute, "oacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ograve, "ograve" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ocirc, "ocirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_otilde, "otilde" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ouml, "ouml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_oslash, "oslash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_uacute, "uacute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ugrave, "ugrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ucirc, "ucirc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_uuml, "uuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_yacute, "yacute" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_thorn, "thorn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_yuml, "yuml" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_acute, "acute" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_brvbar, "brvbar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_cedil, "cedil" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_cent, "cent" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_copy, "copy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_curren, "curren" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_deg, "deg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_divide, "divide" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_frac12, "frac12" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_frac14, "frac14" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_frac34, "frac34" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_iexcl, "iexcl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_iquest, "iquest" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_laquo, "laquo" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_macr, "macr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_micro, "micro" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_middot, "middot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_nbsp, "nbsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_not, "not" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ordf, "ordf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_ordm, "ordm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_para, "para" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_plusmn, "plusmn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_pound, "pound" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_raquo, "raquo" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_reg, "reg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_sect, "sect" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_shy, "shy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_sup1, "sup1" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_sup2, "sup2" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_sup3, "sup3" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_times, "times" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_uml, "uml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_yen, "yen" );
+
+// Netscape kennt noch ein paar in Grossbuchstaben ...
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_LT, "LT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_GT, "GT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_AMP, "AMP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_C_QUOT, "QUOT" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_COPY, "COPY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_S_REG, "REG" );
+
+// HTML Attribut-Token (=Optionen)
+
+// Attribute ohne Wert
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_box, "BOX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_checked, "CHECKED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_compact, "COMPACT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_continue, "CONTINUE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_controls, "CONTROLS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_declare, "DECLARE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_disabled, "DISABLED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_folded, "FOLDED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_ismap, "ISMAP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_mayscript, "MAYSCRIPT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_multiple, "MULTIPLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_noflow, "NOFLOW" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_nohref, "NOHREF" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_noresize, "NORESIZE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_noshade, "NOSHADE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_nowrap, "NOWRAP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_plain, "PLAIN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_sdfixed, "SDFIXED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_selected, "SELECTED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_shapes, "SHAPES" );
+
+// Attribute mit einem String als Wert
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_above, "ABOVE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_accesskey, "ACCESSKEY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_accept, "ACCEPT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_add_date, "ADD_DATE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_alt, "ALT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_axes, "AXES" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_axis, "AXIS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_below, "BELOW" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_char, "CHAR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_class, "CLASS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_clip, "CLIP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_code, "CODE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_codetype, "CODETYPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_colspec, "COLSPEC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_content, "CONTENT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_coords, "COORDS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_dp, "DP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_enctype, "ENCTYPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_error, "ERROR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_face, "FACE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_frameborder, "FRAMEBORDER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_httpequiv, "HTTP-EQUIV" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_language, "LANGUAGE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_last_modified, "LAST_MODIFIED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_last_visit, "LAST_VISIT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_md, "MD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_n, "N" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_name, "NAME" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_notation, "NOTATION" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_prompt, "PROMPT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_shape, "SHAPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_standby, "STANDBY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_style, "STYLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_title, "TITLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_value, "VALUE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDval, "SDVAL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDnum, "SDNUM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_sdlibrary, "SDLIBRARY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_sdmodule, "SDMODULE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_sdevent, "SDEVENT-" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_sdaddparam, "SDADDPARAM-" );
+
+// Attribute mit einem SGML-Identifier als Wert
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_from, "FROM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_id, "ID" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_target, "TARGET" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_to, "TO" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_until, "UNTIL" );
+
+// Attribute mit einem URI als Wert
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_action, "ACTION" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_background, "BACKGROUND" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_classid, "CLASSID" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_codebase, "CODEBASE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_data, "DATA" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_dynsrc, "DYNSRC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_dynsync, "DYNSYNC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_imagemap, "IMAGEMAP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_href, "HREF" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_lowsrc, "LOWSRC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_script, "SCRIPT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_src, "SRC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_usemap, "USEMAP" );
+
+// Attribute mit Entity-Namen als Wert
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_dingbat, "DINGBAT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_sym, "SYM" );
+
+// Attribute mit einer Farbe als Wert (alle Netscape)
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_alink, "ALINK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_bgcolor, "BGCOLOR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_bordercolor, "BORDERCOLOR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_bordercolorlight, "BORDERCOLORLIGHT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_bordercolordark, "BORDERCOLORDARK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_color, "COLOR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_link, "LINK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_text, "TEXT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_vlink, "VLINK" );
+
+// Attribute mit einem numerischen Wert
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_border, "BORDER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_cellspacing, "CELLSPACING" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_cellpadding, "CELLPADDING" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_charoff, "CHAROFF" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_colspan, "COLSPAN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_framespacing, "FRAMESPACING" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_gutter, "GUTTER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_indent, "INDENT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_height, "HEIGHT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_hspace, "HSPACE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_left, "LEFT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_leftmargin, "LEFTMARGIN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_loop, "LOOP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_marginheight, "MARGINHEIGHT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_marginwidth, "MARGINWIDTH" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_max, "MAX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_maxlength, "MAXLENGTH" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_min, "MIN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_pagex, "PAGEX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_pagey, "PAGEY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_pointsize, "POINT-SIZE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_rowspan, "ROWSPAN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_scrollamount, "SCROLLAMOUNT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_scrolldelay, "SCROLLDELAY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_seqnum, "SEQNUM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_skip, "SKIP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_span, "SPAN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_tabindex, "TABINDEX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_top, "TOP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_topmargin, "TOPMARGIN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_vspace, "VSPACE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_weight, "WEIGHT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_width, "WIDTH" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_x, "X" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_y, "Y" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_zindex, "Z-INDEX" );
+
+// Attribute mit Enum-Werten
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_behavior, "BEHAVIOR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_bgproperties, "BGPROPERTIES" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_clear, "CLEAR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_dir, "DIR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_direction, "DIRECTION" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_format, "FORMAT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_frame, "FRAME" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_lang, "LANG" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_method, "METHOD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_palette, "PALETTE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_rel, "REL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_rev, "REV" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_rules, "RULES" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_scrolling, "SCROLLING" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_sdreadonly, "READONLY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_subtype, "SUBTYPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_type, "TYPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_valign, "VALIGN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_valuetype, "VALUETYPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_visibility, "VISIBILITY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_wrap, "WRAP" );
+
+// Attribute mit Script-Code als Wert
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onblur, "ONBLUR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onchange, "ONCHANGE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onclick, "ONCLICK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onfocus, "ONFOCUS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onload, "ONLOAD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onmouseover, "ONMOUSEOVER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onreset, "ONRESET" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onselect, "ONSELECT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onsubmit, "ONSUBMIT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onunload, "ONUNLOAD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onabort, "ONABORT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onerror, "ONERROR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_onmouseout, "ONMOUSEOUT" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonblur, "SDONBLUR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonchange, "SDONCHANGE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonclick, "SDONCLICK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonfocus, "SDONFOCUS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonload, "SDONLOAD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonmouseover, "SDONMOUSEOVER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonreset, "SDONRESET" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonselect, "SDONSELECT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonsubmit, "SDONSUBMIT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonunload, "SDONUNLOAD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonabort, "SDONABORT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonerror, "SDONERROR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_SDonmouseout, "SDONMOUSEOUT" );
+
+// Attribute mit Kontext-abhaengigen Werten
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_align, "ALIGN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_cols, "COLS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_rows, "ROWS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_start, "START" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_size, "SIZE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_O_units, "UNITS" );
+
+
+// Werte von <INPUT TYPE=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_text, "TEXT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_password, "PASSWORD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_checkbox, "CHECKBOX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_radio, "RADIO" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_range, "RANGE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_scribble, "SCRIBBLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_file, "FILE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_hidden, "HIDDEN" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_submit, "SUBMIT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_image, "IMAGE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_reset, "RESET" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_IT_button, "BUTTON" );
+
+// Werte von <TABLE FRAME=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_void, "VOID" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_above, "ABOVE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_below, "BELOW" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_hsides, "HSIDES" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_lhs, "LHS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_rhs, "RHS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_vsides, "VSIDES" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_box, "BOX" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TF_border, "BORDER" );
+
+// Werte von <TABLE RULES=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TR_none, "NONE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TR_groups, "GROUPS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TR_rows, "ROWS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TR_cols, "COLS" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_TR_all, "ALL" );
+
+// Werte von <P, H?, TR, TH, TD ALIGN=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_left, "LEFT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_center, "CENTER" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_middle, "MIDDLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_right, "RIGHT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_justify, "JUSTIFY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_char, "CHAR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_all, "ALL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_AL_none, "NONE" );
+
+// Werte von <TR VALIGN=...>, <IMG ALIGN=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_VA_top, "TOP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_VA_middle, "MIDDLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_VA_bottom, "BOTTOM" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_VA_baseline, "BASELINE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_VA_texttop, "TEXTTOP" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_VA_absmiddle, "ABSMIDDLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_VA_absbottom, "ABSBOTTOM" );
+
+// Werte von <AREA SHAPE=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SH_rect, "RECT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SH_rectangle, "RECTANGLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SH_circ, "CIRC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SH_circle, "CIRCLE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SH_poly, "POLY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SH_polygon, "POLYGON" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SH_default, "DEFAULT" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LG_starbasic, "STARBASIC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LG_javascript, "JAVASCRIPT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LG_javascript11, "JAVASCRIPT1.1" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LG_livescript, "LIVESCRIPT" );
+//sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LG_vbscript, "VBSCRIPT" );
+//sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LG_unused_javascript, "UNUSED JAVASCRIPT" );
+//sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LG_starone, "StarScript" );
+
+// ein par Werte fuer unser StarBASIC-Support
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SB_library, "$LIBRARY:" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SB_module, "$MODULE:" );
+
+
+// Werte von <FORM METHOD=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_METHOD_get, "GET" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_METHOD_post, "POST" );
+
+// Werte von <META CONTENT/HTTP-EQUIV=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_refresh, "REFRESH" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_generator, "GENERATOR" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_author, "AUTHOR" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_classification, "CLASSIFICATION" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_description, "DESCRIPTION" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_keywords, "KEYWORDS" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_changed, "CHANGED" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_changedby, "CHANGEDBY" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_created, "CREATED" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_content_type, "CONTENT-TYPE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_content_script_type, "CONTENT-SCRIPT-TYPE" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_sdendnote, "SDENDNOTE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_META_sdfootnote, "SDFOOTNOTE" );
+
+// Werte von <UL TYPE=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_ULTYPE_disc, "DISC" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_ULTYPE_square, "SQUARE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_ULTYPE_circle, "CIRCLE" );
+
+// Werte von <FRAMESET SCROLLING=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SCROLL_yes, "YES" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SCROLL_no, "NO" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SCROLL_auto, "AUTO" );
+
+// Werte von <MULTICOL TYPE=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_MCTYPE_horizontal, "HORIZONTAL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_MCTYPE_vertical, "VERTICAL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_MCTYPE_box, "BOX" );
+
+// Werte von <MARQUEE BEHAVIOUR=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_BEHAV_scroll, "SCROLL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_BEHAV_slide, "SLIDE" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_BEHAV_alternate, "ALTERNATE" );
+
+// Werte von <MARQUEE LOOP=...>
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_LOOP_infinite, "INFINITE" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SPTYPE_block, "BLOCK" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SPTYPE_horizontal, "HORIZONTAL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_SPTYPE_vertical, "VERTICAL" );
+
+
+// interne Grafik-Namen
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_private_image, "private:image/" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_internal_gopher, "internal-gopher-" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_internal_icon, "internal-icon-" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_binary, "binary" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_image, "image" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_index, "index" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_menu, "menu" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_movie, "movie" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_sound, "sound" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_telnet, "telnet" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_text, "text" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_GOPHER_unknown, "unknown" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_ICON_baddata, "baddata" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_ICON_delayed, "delayed" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_ICON_embed, "embed" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_ICON_insecure, "insecure" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_INT_ICON_notfound, "notfound" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sdendnote, "sdendnote" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sdendnote_anc, "sdendnoteanc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sdendnote_sym, "sdendnotesym" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sdfootnote, "sdfootnote" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sdfootnote_anc, "sdfootnoteanc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_sdfootnote_sym, "sdfootnotesym" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FTN_anchor, "anc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FTN_symbol, "sym" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_WW_off, "OFF" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_WW_hard, "HARD" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_WW_soft, "SOFT" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_WW_virtual, "VIRTUAL" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_WW_physical, "PHYSICAL" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_on, "on" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_ET_url, "application/x-www-form-urlencoded" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_ET_multipart, "multipart/form-data" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_ET_text, "text/plain" );
diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx
new file mode 100644
index 000000000000..cc7ce74e73f4
--- /dev/null
+++ b/svtools/source/svhtml/htmlkywd.cxx
@@ -0,0 +1,1099 @@
+/*************************************************************************
+ *
+ * $RCSfile: htmlkywd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include <segmentc.hxx>
+
+#include "svparser.hxx"
+#include "htmlkywd.hxx"
+#include "htmltokn.h"
+
+// die Tabelle muss noch sortiert werden
+struct HTML_TokenEntry
+{
+ union
+ {
+ const sal_Char *sToken;
+ const String *pUToken;
+ };
+ int nToken;
+};
+
+// die Farbnamen werden nicht exportiert
+// Sie stammen aus "http://www.uio.no/~mnbjerke/colors_w.html"
+// und scheinen im Gegensatz zu denen aus
+// "http://www.infi.net/wwwimages/colorindex.html"
+// zu stimmen
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_aliceblue, "ALICEBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_antiquewhite, "ANTIQUEWHITE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_aqua, "AQUA" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_aquamarine, "AQUAMARINE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_azure, "AZURE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_beige, "BEIGE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_bisque, "BISQUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_black, "BLACK" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_blanchedalmond, "BLANCHEDALMOND" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_blue, "BLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_blueviolet, "BLUEVIOLET" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_brown, "BROWN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_burlywood, "BURLYWOOD" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_cadetblue, "CADETBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_chartreuse, "CHARTREUSE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_chocolate, "CHOCOLATE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_coral, "CORAL" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_cornflowerblue, "CORNFLOWERBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_cornsilk, "CORNSILK" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_crimson, "CRIMSON" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_cyan, "CYAN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkblue, "DARKBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkcyan, "DARKCYAN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkgoldenrod, "DARKGOLDENROD" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkgray, "DARKGRAY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkgreen, "DARKGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkkhaki, "DARKKHAKI" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkmagenta, "DARKMAGENTA" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkolivegreen, "DARKOLIVEGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkorange, "DARKORANGE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkorchid, "DARKORCHID" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkred, "DARKRED" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darksalmon, "DARKSALMON" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkseagreen, "DARKSEAGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkslateblue, "DARKSLATEBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkslategray, "DARKSLATEGRAY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkturquoise, "DARKTURQUOISE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_darkviolet, "DARKVIOLET" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_deeppink, "DEEPPINK" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_deepskyblue, "DEEPSKYBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_dimgray, "DIMGRAY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_dodgerblue, "DODGERBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_firebrick, "FIREBRICK" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_floralwhite, "FLORALWHITE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_forestgreen, "FORESTGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_fuchsia, "FUCHSIA" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_gainsboro, "GAINSBORO" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_ghostwhite, "GHOSTWHITE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_gold, "GOLD" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_goldenrod, "GOLDENROD" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_gray, "GRAY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_green, "GREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_greenyellow, "GREENYELLOW" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_honeydew, "HONEYDEW" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_hotpink, "HOTPINK" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_indianred, "INDIANRED" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_indigo, "INDIGO" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_ivory, "IVORY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_khaki, "KHAKI" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lavender, "LAVENDER" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lavenderblush, "LAVENDERBLUSH" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lawngreen, "LAWNGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lemonchiffon, "LEMONCHIFFON" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightblue, "LIGHTBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightcoral, "LIGHTCORAL" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightcyan, "LIGHTCYAN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightgoldenrodyellow, "LIGHTGOLDENRODYELLOW" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightgreen, "LIGHTGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightgrey, "LIGHTGREY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightpink, "LIGHTPINK" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightsalmon, "LIGHTSALMON" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightseagreen, "LIGHTSEAGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightskyblue, "LIGHTSKYBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightslategray, "LIGHTSLATEGRAY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightsteelblue, "LIGHTSTEELBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lightyellow, "LIGHTYELLOW" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_lime, "LIME" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_limegreen, "LIMEGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_linen, "LINEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_magenta, "MAGENTA" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_maroon, "MAROON" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumaquamarine, "MEDIUMAQUAMARINE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumblue, "MEDIUMBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumorchid, "MEDIUMORCHID" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumpurple, "MEDIUMPURPLE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumseagreen, "MEDIUMSEAGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumslateblue, "MEDIUMSLATEBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumspringgreen, "MEDIUMSPRINGGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumturquoise, "MEDIUMTURQUOISE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mediumvioletred, "MEDIUMVIOLETRED" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_midnightblue, "MIDNIGHTBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mintcream, "MINTCREAM" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_mistyrose, "MISTYROSE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_moccasin, "MOCCASIN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_navajowhite, "NAVAJOWHITE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_navy, "NAVY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_oldlace, "OLDLACE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_olive, "OLIVE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_olivedrab, "OLIVEDRAB" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_orange, "ORANGE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_orangered, "ORANGERED" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_orchid, "ORCHID" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_palegoldenrod, "PALEGOLDENROD" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_palegreen, "PALEGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_paleturquoise, "PALETURQUOISE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_palevioletred, "PALEVIOLETRED" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_papayawhip, "PAPAYAWHIP" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_peachpuff, "PEACHPUFF" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_peru, "PERU" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_pink, "PINK" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_plum, "PLUM" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_powderblue, "POWDERBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_purple, "PURPLE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_red, "RED" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_rosybrown, "ROSYBROWN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_royalblue, "ROYALBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_saddlebrown, "SADDLEBROWN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_salmon, "SALMON" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_sandybrown, "SANDYBROWN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_seagreen, "SEAGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_seashell, "SEASHELL" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_sienna, "SIENNA" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_silver, "SILVER" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_skyblue, "SKYBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_slateblue, "SLATEBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_slategray, "SLATEGRAY" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_snow, "SNOW" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_springgreen, "SPRINGGREEN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_steelblue, "STEELBLUE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_tan, "TAN" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_teal, "TEAL" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_thistle, "THISTLE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_tomato, "TOMATO" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_turquoise, "TURQUOISE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_violet, "VIOLET" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_wheat, "WHEAT" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_white, "WHITE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_whitesmoke, "WHITESMOKE" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_yellow, "YELLOW" );
+sal_Char __READONLY_DATA SVTOOLS_CONSTASCII_DEF( sHTML_COL_yellowgreen, "YELLOWGREEN" );
+
+
+// Flag: RTF-Token Tabelle wurde schon sortiert
+static int __FAR_DATA bSortKeyWords = FALSE;
+
+static HTML_TokenEntry __FAR_DATA aHTMLTokenTab[] = {
+sHTML_area, HTML_AREA, // Netscape 2.0
+sHTML_base, HTML_BASE, // HTML 3.0
+sHTML_comment, HTML_COMMENT,
+sHTML_doctype, HTML_DOCTYPE,
+sHTML_embed, HTML_EMBED, // Netscape 2.0
+sHTML_figureoverlay,HTML_FIGUREOVERLAY, // HTML 3.0
+sHTML_horzrule, HTML_HORZRULE,
+sHTML_horztab, HTML_HORZTAB, // HTML 3.0
+sHTML_image, HTML_IMAGE,
+sHTML_image2, HTML_IMAGE,
+sHTML_input, HTML_INPUT,
+sHTML_isindex, HTML_ISINDEX, // HTML 3.0
+sHTML_li, HTML_LI_ON,
+sHTML_linebreak, HTML_LINEBREAK,
+sHTML_link, HTML_LINK, // HTML 3.0
+sHTML_meta, HTML_META, // HTML 3.0
+sHTML_nextid, HTML_NEXTID, // HTML 3.0
+sHTML_of, HTML_OF, // HTML 3.0
+sHTML_option, HTML_OPTION,
+sHTML_param, HTML_PARAM, // HotJava
+sHTML_range, HTML_RANGE, // HTML 3.0
+sHTML_spacer, HTML_SPACER, // Netscape 3.0b5
+sHTML_wbr, HTML_WBR, // Netscape
+
+sHTML_abbreviation, HTML_ABBREVIATION_ON, // HTML 3.0
+sHTML_above, HTML_ABOVE_ON, // HTML 3.0
+sHTML_acronym, HTML_ACRONYM_ON, // HTML 3.0
+sHTML_address, HTML_ADDRESS_ON,
+sHTML_anchor, HTML_ANCHOR_ON,
+sHTML_applet, HTML_APPLET_ON, // HotJava
+sHTML_array, HTML_ARRAY_ON, // HTML 3.0
+sHTML_author, HTML_AUTHOR_ON, // HTML 3.0
+sHTML_banner, HTML_BANNER_ON, // HTML 3.0
+sHTML_bar, HTML_BAR_ON, // HTML 3.0
+sHTML_basefont, HTML_BASEFONT_ON, // Netscape
+sHTML_below, HTML_BELOW_ON, // HTML 3.0
+sHTML_bigprint, HTML_BIGPRINT_ON, // HTML 3.0
+sHTML_blink, HTML_BLINK_ON, // Netscape
+sHTML_blockquote, HTML_BLOCKQUOTE_ON,
+sHTML_blockquote30, HTML_BLOCKQUOTE30_ON, // HTML 3.0
+sHTML_body, HTML_BODY_ON,
+sHTML_bold, HTML_BOLD_ON,
+sHTML_boldtext, HTML_BOLDTEXT_ON, // HTML 3.0
+sHTML_box, HTML_BOX_ON, // HTML 3.0
+sHTML_caption, HTML_CAPTION_ON, // HTML 3.0
+sHTML_center, HTML_CENTER_ON, // Netscape
+sHTML_citiation, HTML_CITIATION_ON,
+sHTML_col, HTML_COL_ON, // HTML 3 Table Model Draft
+sHTML_colgroup, HTML_COLGROUP_ON, // HTML 3 Table Model Draft
+sHTML_code, HTML_CODE_ON,
+sHTML_credit, HTML_CREDIT_ON, // HTML 3.0
+sHTML_dd, HTML_DD_ON,
+sHTML_deflist, HTML_DEFLIST_ON,
+sHTML_deletedtext, HTML_DELETEDTEXT_ON, // HTML 3.0
+sHTML_dirlist, HTML_DIRLIST_ON,
+sHTML_division, HTML_DIVISION_ON, // HTML 3.0
+sHTML_dot, HTML_DOT_ON, // HTML 3.0
+sHTML_doubledot, HTML_DOUBLEDOT_ON, // HTML 3.0
+sHTML_dt, HTML_DT_ON,
+sHTML_emphasis, HTML_EMPHASIS_ON,
+sHTML_figure, HTML_FIGURE_ON, // HTML 3.0
+sHTML_font, HTML_FONT_ON, // Netscpe
+sHTML_footnote, HTML_FOOTNOTE_ON, // HTML 3.0
+sHTML_form, HTML_FORM_ON,
+sHTML_frame, HTML_FRAME_ON, // Netscape 2.0
+sHTML_frameset, HTML_FRAMESET_ON, // Netscape 2.0
+sHTML_hat, HTML_HAT_ON, // HTML 3.0
+sHTML_head, HTML_HEAD_ON,
+sHTML_head1, HTML_HEAD1_ON,
+sHTML_head2, HTML_HEAD2_ON,
+sHTML_head3, HTML_HEAD3_ON,
+sHTML_head4, HTML_HEAD4_ON,
+sHTML_head5, HTML_HEAD5_ON,
+sHTML_head6, HTML_HEAD6_ON,
+sHTML_html, HTML_HTML_ON,
+sHTML_iframe, HTML_IFRAME_ON, // IE 3.0b2
+sHTML_ilayer, HTML_ILAYER_ON,
+sHTML_insertedtext, HTML_INSERTEDTEXT_ON, // HTML 3.0
+sHTML_italic, HTML_ITALIC_ON,
+sHTML_item, HTML_ITEM_ON, // HTML 3.0
+sHTML_keyboard, HTML_KEYBOARD_ON,
+sHTML_language, HTML_LANGUAGE_ON, // HTML 3.0
+sHTML_layer, HTML_LAYER_ON,
+sHTML_listheader, HTML_LISTHEADER_ON, // HTML 3.0
+sHTML_map, HTML_MAP_ON, // Netscape 2.0
+sHTML_math, HTML_MATH_ON, // HTML 3.0
+sHTML_menulist, HTML_MENULIST_ON,
+sHTML_multicol, HTML_MULTICOL_ON, // Netscape 3.0b5
+sHTML_nobr, HTML_NOBR_ON, // Netscape
+sHTML_noembed, HTML_NOEMBED_ON, // Netscape 2.0 ???
+sHTML_noframe, HTML_NOFRAMES_ON, // Netscape 2.0 ???
+sHTML_noframes, HTML_NOFRAMES_ON, // Netscape 2.0
+sHTML_noscript, HTML_NOSCRIPT_ON, // Netscape 3.0
+sHTML_note, HTML_NOTE_ON, // HTML 3.0
+sHTML_orderlist, HTML_ORDERLIST_ON,
+sHTML_parabreak, HTML_PARABREAK_ON,
+sHTML_person, HTML_PERSON_ON, // HTML 3.0
+sHTML_plaintext, HTML_PLAINTEXT_ON, // HTML 3.0
+sHTML_preformtxt, HTML_PREFORMTXT_ON,
+sHTML_root, HTML_ROOT_ON, // HTML 3.0
+sHTML_row, HTML_ROW_ON, // HTML 3.0
+sHTML_sample, HTML_SAMPLE_ON,
+sHTML_script, HTML_SCRIPT_ON, // HTML 3.2
+sHTML_select, HTML_SELECT_ON,
+sHTML_shortquote, HTML_SHORTQUOTE_ON, // HTML 3.0
+sHTML_smallprint, HTML_SMALLPRINT_ON, // HTML 3.0
+sHTML_span, HTML_SPAN_ON, // Style Sheets
+sHTML_squareroot, HTML_SQUAREROOT_ON, // HTML 3.0
+sHTML_strikethrough,HTML_STRIKETHROUGH_ON, // HTML 3.0
+sHTML_strong, HTML_STRONG_ON,
+sHTML_style, HTML_STYLE_ON, // HTML 3.0
+sHTML_subscript, HTML_SUBSCRIPT_ON, // HTML 3.0
+sHTML_superscript, HTML_SUPERSCRIPT_ON, // HTML 3.0
+sHTML_table, HTML_TABLE_ON, // HTML 3.0
+sHTML_tabledata, HTML_TABLEDATA_ON, // HTML 3.0
+sHTML_tableheader, HTML_TABLEHEADER_ON, // HTML 3.0
+sHTML_tablerow, HTML_TABLEROW_ON, // HTML 3.0
+sHTML_tbody, HTML_TBODY_ON, // HTML 3 Table Model Draft
+sHTML_teletype, HTML_TELETYPE_ON,
+sHTML_text, HTML_TEXT_ON, // HTML 3.0
+sHTML_textarea, HTML_TEXTAREA_ON,
+sHTML_textflow, HTML_TEXTFLOW_ON,
+sHTML_tfoot, HTML_TFOOT_ON, // HTML 3 Table Model Draft
+sHTML_thead, HTML_THEAD_ON, // HTML 3 Table Model Draft
+sHTML_tilde, HTML_TILDE_ON, // HTML 3.0
+sHTML_title, HTML_TITLE_ON,
+sHTML_underline, HTML_UNDERLINE_ON,
+sHTML_unorderlist, HTML_UNORDERLIST_ON,
+sHTML_variable, HTML_VARIABLE_ON,
+sHTML_vector, HTML_VECTOR_ON, // HTML 3.0
+
+sHTML_xmp, HTML_XMP_ON,
+sHTML_listing, HTML_LISTING_ON,
+
+sHTML_definstance, HTML_DEFINSTANCE_ON,
+sHTML_strike, HTML_STRIKE_ON,
+
+sHTML_bgsound, HTML_BGSOUND,
+sHTML_comment2, HTML_COMMENT2_ON,
+sHTML_marquee, HTML_MARQUEE_ON,
+sHTML_plaintext2, HTML_PLAINTEXT2_ON,
+
+sHTML_sdfield, HTML_SDFIELD_ON,
+};
+
+
+extern "C"
+{
+
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+ _Optlink
+#endif
+ HTMLKeyCompare( const void *pFirst, const void *pSecond)
+{
+ int nRet = 0;
+ if( -1 == ((HTML_TokenEntry*)pFirst)->nToken )
+ {
+ if( -1 == ((HTML_TokenEntry*)pSecond)->nToken )
+ nRet = ((HTML_TokenEntry*)pFirst)->pUToken->CompareTo(
+ *((HTML_TokenEntry*)pSecond)->pUToken );
+ else
+ nRet = ((HTML_TokenEntry*)pFirst)->pUToken->CompareToAscii(
+ ((HTML_TokenEntry*)pSecond)->sToken );
+ }
+ else
+ {
+ if( -1 == ((HTML_TokenEntry*)pSecond)->nToken )
+ nRet = -1 * ((HTML_TokenEntry*)pSecond)->pUToken->CompareToAscii(
+ ((HTML_TokenEntry*)pFirst)->sToken );
+ else
+ nRet = strcmp( ((HTML_TokenEntry*)pFirst)->sToken,
+ ((HTML_TokenEntry*)pSecond)->sToken );
+ }
+
+ return nRet;
+}
+
+}
+
+int GetHTMLToken( const String& rName )
+{
+ if( !bSortKeyWords )
+ {
+ qsort( (void*) aHTMLTokenTab,
+ sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ),
+ sizeof( HTML_TokenEntry ),
+ HTMLKeyCompare );
+ bSortKeyWords = TRUE;
+ }
+
+ int nRet = 0;
+
+ if( !rName.CompareToAscii( sHTML_comment, 3UL) )
+ return HTML_COMMENT;
+
+ void* pFound;
+ HTML_TokenEntry aSrch;
+ aSrch.pUToken = &rName;
+ aSrch.nToken = -1;
+
+ if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
+ (void*) aHTMLTokenTab,
+ sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ),
+ sizeof( HTML_TokenEntry ),
+ HTMLKeyCompare )))
+ nRet = ((HTML_TokenEntry*)pFound)->nToken;
+ return nRet;
+}
+
+/* */
+
+struct HTML_CharEntry
+{
+ union
+ {
+ const sal_Char *sName;
+ const String *pUName;
+ };
+ sal_Unicode cChar;
+};
+
+// Flag: RTF-Token Tabelle wurde schon sortiert
+static int __FAR_DATA bSortCharKeyWords = FALSE;
+
+static HTML_CharEntry __FAR_DATA aHTMLCharNameTab[] = {
+sHTML_C_lt, 60,
+sHTML_C_gt, 62,
+sHTML_C_amp, 38,
+sHTML_C_quot, 34,
+
+sHTML_C_Agrave, 192,
+sHTML_C_Aacute, 193,
+sHTML_C_Acirc, 194,
+sHTML_C_Atilde, 195,
+sHTML_C_Auml, 196,
+sHTML_C_Aring, 197,
+sHTML_C_AElig, 198,
+sHTML_C_Ccedil, 199,
+sHTML_C_Egrave, 200,
+sHTML_C_Eacute, 201,
+sHTML_C_Ecirc, 202,
+sHTML_C_Euml, 203,
+sHTML_C_Igrave, 204,
+sHTML_C_Iacute, 205,
+sHTML_C_Icirc, 206,
+sHTML_C_Iuml, 207,
+sHTML_C_ETH, 208,
+sHTML_C_Ntilde, 209,
+sHTML_C_Ograve, 210,
+sHTML_C_Oacute, 211,
+sHTML_C_Ocirc, 212,
+sHTML_C_Otilde, 213,
+sHTML_C_Ouml, 214,
+sHTML_C_Oslash, 216,
+sHTML_C_Ugrave, 217,
+sHTML_C_Uacute, 218,
+sHTML_C_Ucirc, 219,
+sHTML_C_Uuml, 220,
+sHTML_C_Yacute, 221,
+
+sHTML_C_THORN, 222,
+sHTML_C_szlig, 223,
+
+sHTML_S_agrave, 224,
+sHTML_S_aacute, 225,
+sHTML_S_acirc, 226,
+sHTML_S_atilde, 227,
+sHTML_S_auml, 228,
+sHTML_S_aring, 229,
+sHTML_S_aelig, 230,
+sHTML_S_ccedil, 231,
+sHTML_S_egrave, 232,
+sHTML_S_eacute, 233,
+sHTML_S_ecirc, 234,
+sHTML_S_euml, 235,
+sHTML_S_igrave, 236,
+sHTML_S_iacute, 237,
+sHTML_S_icirc, 238,
+sHTML_S_iuml, 239,
+sHTML_S_eth, 240,
+sHTML_S_ntilde, 241,
+sHTML_S_ograve, 242,
+sHTML_S_oacute, 243,
+sHTML_S_ocirc, 244,
+sHTML_S_otilde, 245,
+sHTML_S_ouml, 246,
+sHTML_S_oslash, 248,
+sHTML_S_ugrave, 249,
+sHTML_S_uacute, 250,
+sHTML_S_ucirc, 251,
+sHTML_S_uuml, 252,
+sHTML_S_yacute, 253,
+sHTML_S_thorn, 254,
+sHTML_S_yuml, 255,
+
+// Sonderzeichen
+sHTML_S_acute, 180,
+sHTML_S_brvbar, 166,
+sHTML_S_cedil, 184,
+sHTML_S_cent, 162,
+sHTML_S_copy, 169,
+sHTML_S_curren, 164,
+sHTML_S_deg, 176,
+sHTML_S_divide, 247,
+sHTML_S_frac12, 189,
+sHTML_S_frac14, 188,
+sHTML_S_frac34, 190,
+sHTML_S_iexcl, 161,
+sHTML_S_iquest, 191,
+sHTML_S_laquo, 171,
+sHTML_S_macr, 175,
+sHTML_S_micro, 181,
+sHTML_S_middot, 183,
+sHTML_S_not, 172,
+sHTML_S_ordf, 170,
+sHTML_S_ordm, 186,
+sHTML_S_para, 182,
+sHTML_S_plusmn, 177,
+sHTML_S_pound, 163,
+sHTML_S_raquo, 187,
+sHTML_S_reg, 174,
+sHTML_S_sect, 167,
+sHTML_S_sup1, 185,
+sHTML_S_sup2, 178,
+sHTML_S_sup3, 179,
+sHTML_S_times, 215,
+sHTML_S_uml, 168,
+sHTML_S_yen, 165,
+
+// Netscape kennt noch ein paar in Grossbuchstaben ...
+sHTML_C_LT, 60,
+sHTML_C_GT, 62,
+sHTML_C_AMP, 38,
+sHTML_C_QUOT, 34,
+sHTML_S_COPY, 169,
+sHTML_S_REG, 174,
+
+// Sonderzeichen, die zu Tokens konvertiert werden !!!
+sHTML_S_nbsp, 1,
+sHTML_S_shy, 2,
+};
+
+extern "C"
+{
+
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+ _Optlink
+#endif
+ HTMLCharNameCompare( const void *pFirst, const void *pSecond)
+{
+ int nRet = 0;
+ if( USHRT_MAX == ((HTML_CharEntry*)pFirst)->cChar )
+ {
+ if( USHRT_MAX == ((HTML_CharEntry*)pSecond)->cChar )
+ nRet = ((HTML_CharEntry*)pFirst)->pUName->CompareTo(
+ *((HTML_CharEntry*)pSecond)->pUName );
+ else
+ nRet = ((HTML_CharEntry*)pFirst)->pUName->CompareToAscii(
+ ((HTML_CharEntry*)pSecond)->sName );
+ }
+ else
+ {
+ if( USHRT_MAX == ((HTML_CharEntry*)pSecond)->cChar )
+ nRet = -1 * ((HTML_CharEntry*)pSecond)->pUName->CompareToAscii(
+ ((HTML_CharEntry*)pFirst)->sName );
+ else
+ nRet = strcmp( ((HTML_CharEntry*)pFirst)->sName,
+ ((HTML_CharEntry*)pSecond)->sName );
+ }
+
+ return nRet;
+}
+
+}
+
+sal_Unicode GetHTMLCharName( const String& rName )
+{
+ if( !bSortCharKeyWords )
+ {
+ qsort( (void*) aHTMLCharNameTab,
+ sizeof( aHTMLCharNameTab ) / sizeof( HTML_CharEntry ),
+ sizeof( HTML_CharEntry ),
+ HTMLCharNameCompare );
+ bSortCharKeyWords = TRUE;
+ }
+
+ sal_Unicode cRet = 0;
+ void* pFound;
+ HTML_CharEntry aSrch;
+ aSrch.pUName = &rName;
+ aSrch.cChar = USHRT_MAX;
+
+ if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
+ (void*) aHTMLCharNameTab,
+ sizeof( aHTMLCharNameTab) / sizeof( HTML_CharEntry ),
+ sizeof( HTML_CharEntry ),
+ HTMLCharNameCompare )))
+ cRet = ((HTML_CharEntry*)pFound)->cChar;
+ return cRet;
+}
+
+/* */
+
+// Flag: Optionen-Tabelle wurde schon sortiert
+static int __FAR_DATA bSortOptionKeyWords = FALSE;
+
+static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = {
+
+// Attribute ohne Wert
+sHTML_O_box, HTML_O_BOX,
+sHTML_O_checked, HTML_O_CHECKED,
+sHTML_O_compact, HTML_O_COMPACT,
+sHTML_O_continue, HTML_O_CONTINUE,
+sHTML_O_controls, HTML_O_CONTROLS, // IExplorer 2.0
+sHTML_O_declare, HTML_O_DECLARE,
+sHTML_O_disabled, HTML_O_DISABLED,
+sHTML_O_folded, HTML_O_FOLDED, // Netscape internal
+sHTML_O_ismap, HTML_O_ISMAP,
+sHTML_O_mayscript, HTML_O_MAYSCRIPT,
+sHTML_O_multiple, HTML_O_MULTIPLE,
+sHTML_O_noflow, HTML_O_NOFLOW,
+sHTML_O_nohref, HTML_O_NOHREF, // Netscape 2.0
+sHTML_O_noresize, HTML_O_NORESIZE, // Netscape 2.0
+sHTML_O_noshade, HTML_O_NOSHADE, // Netscape 2.0
+sHTML_O_nowrap, HTML_O_NOWRAP,
+sHTML_O_plain, HTML_O_PLAIN,
+sHTML_O_sdfixed, HTML_O_SDFIXED,
+sHTML_O_selected, HTML_O_SELECTED,
+sHTML_O_shapes, HTML_O_SHAPES,
+
+// Attribute mit einem String als Wert
+sHTML_O_above, HTML_O_ABOVE,
+sHTML_O_accept, HTML_O_ACCEPT,
+sHTML_O_accesskey, HTML_O_ACCESSKEY,
+sHTML_O_add_date, HTML_O_ADD_DATE, // Netscape internal
+sHTML_O_alt, HTML_O_ALT,
+sHTML_O_axes, HTML_O_AXES,
+sHTML_O_axis, HTML_O_AXIS,
+sHTML_O_below, HTML_O_BELOW,
+sHTML_O_char, HTML_O_CHAR, // HTML 3 Table Model Draft
+sHTML_O_class, HTML_O_CLASS,
+sHTML_O_clip, HTML_O_CLIP,
+sHTML_O_code, HTML_O_CODE, // HotJava
+sHTML_O_codetype, HTML_O_CODETYPE,
+sHTML_O_colspec, HTML_O_COLSPEC,
+sHTML_O_content, HTML_O_CONTENT,
+sHTML_O_coords, HTML_O_COORDS, // Netscape 2.0
+sHTML_O_dp, HTML_O_DP,
+sHTML_O_enctype, HTML_O_ENCTYPE,
+sHTML_O_error, HTML_O_ERROR,
+sHTML_O_face, HTML_O_FACE, // IExplorer 2.0
+sHTML_O_frameborder, HTML_O_FRAMEBORDER, // IExplorer 3.0
+sHTML_O_httpequiv, HTML_O_HTTPEQUIV,
+sHTML_O_language, HTML_O_LANGUAGE, // JavaScript
+sHTML_O_last_modified, HTML_O_LAST_MODIFIED, // Netscape internal
+sHTML_O_last_visit, HTML_O_LAST_VISIT, // Netscape internal
+sHTML_O_md, HTML_O_MD,
+sHTML_O_n, HTML_O_N,
+sHTML_O_name, HTML_O_NAME,
+sHTML_O_notation, HTML_O_NOTATION,
+sHTML_O_prompt, HTML_O_PROMPT,
+sHTML_O_shape, HTML_O_SHAPE,
+sHTML_O_standby, HTML_O_STANDBY,
+sHTML_O_style, HTML_O_STYLE,
+sHTML_O_title, HTML_O_TITLE,
+sHTML_O_value, HTML_O_VALUE,
+sHTML_O_SDval, HTML_O_SDVAL, // StarDiv NumberValue
+sHTML_O_SDnum, HTML_O_SDNUM, // StarDiv NumberFormat
+sHTML_O_sdlibrary, HTML_O_SDLIBRARY,
+sHTML_O_sdmodule, HTML_O_SDMODULE,
+
+// Attribute mit einem SGML-Identifier als Wert
+sHTML_O_from, HTML_O_FROM,
+sHTML_O_id, HTML_O_ID,
+sHTML_O_target, HTML_O_TARGET, // Netscape 2.0
+sHTML_O_to, HTML_O_TO,
+sHTML_O_until, HTML_O_UNTIL,
+
+// Attribute mit einem URI als Wert
+sHTML_O_action, HTML_O_ACTION,
+sHTML_O_background, HTML_O_BACKGROUND,
+sHTML_O_classid, HTML_O_CLASSID,
+sHTML_O_codebase, HTML_O_CODEBASE, // HotJava
+sHTML_O_data, HTML_O_DATA,
+sHTML_O_dynsrc, HTML_O_DYNSRC, // IExplorer 3.0b1
+sHTML_O_dynsync, HTML_O_DYNSYNC, // IExplorer 2.0
+sHTML_O_imagemap, HTML_O_IMAGEMAP,
+sHTML_O_href, HTML_O_HREF,
+sHTML_O_lowsrc, HTML_O_LOWSRC, // Netscape 3.0
+sHTML_O_script, HTML_O_SCRIPT,
+sHTML_O_src, HTML_O_SRC,
+sHTML_O_usemap, HTML_O_USEMAP, // Netscape 2.0
+
+// Attribute mit Entity-Namen als Wert
+sHTML_O_dingbat, HTML_O_DINGBAT,
+sHTML_O_sym, HTML_O_SYM,
+
+// Attribute mit einer Farbe als Wert (alle Netscape)
+sHTML_O_alink, HTML_O_ALINK,
+sHTML_O_bgcolor, HTML_O_BGCOLOR,
+sHTML_O_bordercolor, HTML_O_BORDERCOLOR, // IExplorer 2.0
+sHTML_O_bordercolorlight, HTML_O_BORDERCOLORLIGHT, // IExplorer 2.0
+sHTML_O_bordercolordark, HTML_O_BORDERCOLORDARK, // IExplorer 2.0
+sHTML_O_color, HTML_O_COLOR,
+sHTML_O_link, HTML_O_LINK,
+sHTML_O_text, HTML_O_TEXT,
+sHTML_O_vlink, HTML_O_VLINK,
+
+// Attribute mit einem numerischen Wert
+sHTML_O_border, HTML_O_BORDER,
+sHTML_O_cellspacing,HTML_O_CELLSPACING, // HTML 3 Table Model Draft
+sHTML_O_cellpadding,HTML_O_CELLPADDING, // HTML 3 Table Model Draft
+sHTML_O_charoff, HTML_O_CHAROFF, // HTML 3 Table Model Draft
+sHTML_O_colspan, HTML_O_COLSPAN,
+sHTML_O_framespacing, HTML_O_FRAMESPACING, // IExplorer 3.0
+sHTML_O_gutter, HTML_O_GUTTER, // Netscape 3.0b5
+sHTML_O_indent, HTML_O_INDENT,
+sHTML_O_height, HTML_O_HEIGHT,
+sHTML_O_hspace, HTML_O_HSPACE, // Netscape
+sHTML_O_left, HTML_O_LEFT,
+sHTML_O_leftmargin, HTML_O_LEFTMARGIN, // IExplorer 2.0
+sHTML_O_loop, HTML_O_LOOP, // IExplorer 2.0
+sHTML_O_marginheight,HTML_O_MARGINHEIGHT, // Netscape 2.0
+sHTML_O_marginwidth,HTML_O_MARGINWIDTH, // Netscape 2.0
+sHTML_O_max, HTML_O_MAX,
+sHTML_O_maxlength, HTML_O_MAXLENGTH,
+sHTML_O_min, HTML_O_MIN,
+sHTML_O_pagex, HTML_O_PAGEX,
+sHTML_O_pagey, HTML_O_PAGEY,
+sHTML_O_pointsize, HTML_O_POINTSIZE,
+sHTML_O_rowspan, HTML_O_ROWSPAN,
+sHTML_O_scrollamount, HTML_O_SCROLLAMOUNT, // IExplorer 2.0
+sHTML_O_scrolldelay, HTML_O_SCROLLDELAY, // IExplorer 2.0
+sHTML_O_seqnum, HTML_O_SEQNUM,
+sHTML_O_skip, HTML_O_SKIP,
+sHTML_O_span, HTML_O_SPAN, // HTML 3 Table Model Draft
+sHTML_O_tabindex, HTML_O_TABINDEX,
+sHTML_O_top, HTML_O_TOP,
+sHTML_O_topmargin, HTML_O_TOPMARGIN, // IExplorer 2.0
+sHTML_O_vspace, HTML_O_VSPACE, // Netscape
+sHTML_O_weight, HTML_O_WEIGHT,
+sHTML_O_width, HTML_O_WIDTH,
+sHTML_O_x, HTML_O_X,
+sHTML_O_y, HTML_O_Y,
+sHTML_O_zindex, HTML_O_ZINDEX,
+
+// Attribute mit Enum-Werten
+sHTML_O_bgproperties, HTML_O_BGPROPERTIES, // IExplorer 2.0
+sHTML_O_behavior, HTML_O_BEHAVIOR, // IExplorer 2.0
+sHTML_O_clear, HTML_O_CLEAR,
+sHTML_O_dir, HTML_O_DIR, // HTML 3 Table Model Draft
+sHTML_O_direction, HTML_O_DIRECTION, // IExplorer 2.0
+sHTML_O_format, HTML_O_FORMAT,
+sHTML_O_frame, HTML_O_FRAME, // HTML 3 Table Model Draft
+sHTML_O_lang, HTML_O_LANG,
+sHTML_O_method, HTML_O_METHOD,
+sHTML_O_palette, HTML_O_PALETTE,
+sHTML_O_rel, HTML_O_REL,
+sHTML_O_rev, HTML_O_REV,
+sHTML_O_rules, HTML_O_RULES, // HTML 3 Table Model Draft
+sHTML_O_scrolling, HTML_O_SCROLLING, // Netscape 2.0
+sHTML_O_sdreadonly, HTML_O_SDREADONLY,
+sHTML_O_subtype, HTML_O_SUBTYPE,
+sHTML_O_type, HTML_O_TYPE,
+sHTML_O_valign, HTML_O_VALIGN,
+sHTML_O_valuetype, HTML_O_VALUETYPE,
+sHTML_O_wrap, HTML_O_WRAP,
+sHTML_O_visibility, HTML_O_VISIBILITY,
+
+// Attribute mit Script-Code als Wert
+sHTML_O_onblur, HTML_O_ONBLUR, // JavaScript
+sHTML_O_onchange, HTML_O_ONCHANGE, // JavaScript
+sHTML_O_onclick, HTML_O_ONCLICK, // JavaScript
+sHTML_O_onfocus, HTML_O_ONFOCUS, // JavaScript
+sHTML_O_onload, HTML_O_ONLOAD, // JavaScript
+sHTML_O_onmouseover, HTML_O_ONMOUSEOVER, // JavaScript
+sHTML_O_onreset, HTML_O_ONRESET, // JavaScript
+sHTML_O_onselect, HTML_O_ONSELECT, // JavaScript
+sHTML_O_onsubmit, HTML_O_ONSUBMIT, // JavaScript
+sHTML_O_onunload, HTML_O_ONUNLOAD, // JavaScript
+sHTML_O_onabort, HTML_O_ONABORT, // JavaScript
+sHTML_O_onerror, HTML_O_ONERROR, // JavaScript
+sHTML_O_onmouseout, HTML_O_ONMOUSEOUT, // JavaScript
+
+sHTML_O_SDonblur, HTML_O_SDONBLUR, // StarBasic
+sHTML_O_SDonchange, HTML_O_SDONCHANGE, // StarBasic
+sHTML_O_SDonclick, HTML_O_SDONCLICK, // StarBasic
+sHTML_O_SDonfocus, HTML_O_SDONFOCUS, // StarBasic
+sHTML_O_SDonload, HTML_O_SDONLOAD, // StarBasic
+sHTML_O_SDonmouseover, HTML_O_SDONMOUSEOVER, // StarBasic
+sHTML_O_SDonreset, HTML_O_SDONRESET, // StarBasic
+sHTML_O_SDonselect, HTML_O_SDONSELECT, // StarBasic
+sHTML_O_SDonsubmit, HTML_O_SDONSUBMIT, // StarBasic
+sHTML_O_SDonunload, HTML_O_SDONUNLOAD, // StarBasic
+sHTML_O_SDonabort, HTML_O_SDONABORT, // StarBasic
+sHTML_O_SDonerror, HTML_O_SDONERROR, // StarBasic
+sHTML_O_SDonmouseout, HTML_O_SDONMOUSEOUT, // StarBasic
+
+// Attribute mit Kontext-abhaengigen Werten
+sHTML_O_align, HTML_O_ALIGN,
+sHTML_O_cols, HTML_O_COLS, // Netscape 2.0 vs HTML 2.0
+sHTML_O_rows, HTML_O_ROWS, // Netscape 2.0 vs HTML 2.0
+sHTML_O_size, HTML_O_SIZE,
+sHTML_O_start, HTML_O_START, // Netscape 2.0 vs IExplorer 2.0
+sHTML_O_units, HTML_O_UNITS
+};
+
+int GetHTMLOption( const String& rName )
+{
+ if( !bSortOptionKeyWords )
+ {
+ qsort( (void*) aHTMLOptionTab,
+ sizeof( aHTMLOptionTab ) / sizeof( HTML_TokenEntry ),
+ sizeof( HTML_TokenEntry ),
+ HTMLKeyCompare );
+ bSortOptionKeyWords = TRUE;
+ }
+
+ int nRet = HTML_O_UNKNOWN;
+ void* pFound;
+ HTML_TokenEntry aSrch;
+ aSrch.pUToken = &rName;
+ aSrch.nToken = -1;
+
+ if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
+ (void*) aHTMLOptionTab,
+ sizeof( aHTMLOptionTab ) / sizeof( HTML_TokenEntry ),
+ sizeof( HTML_TokenEntry ),
+ HTMLKeyCompare )))
+ nRet = ((HTML_TokenEntry*)pFound)->nToken;
+ return nRet;
+}
+
+/* */
+
+// Flag: Farb-Tabelle wurde schon sortiert
+struct HTML_ColorEntry
+{
+ union
+ {
+ const sal_Char* sName;
+ const String *pUName;
+ };
+ ULONG nColor;
+};
+
+static int __FAR_DATA bSortColorKeyWords = FALSE;
+
+#define HTML_NO_COLOR 0xffffffffUL
+
+static HTML_ColorEntry __FAR_DATA aHTMLColorNameTab[] = {
+sHTML_COL_aliceblue, 0x00f0f8ffUL,
+sHTML_COL_antiquewhite, 0x00faebd7UL,
+sHTML_COL_aqua, 0x0000ffffUL,
+sHTML_COL_aquamarine, 0x007fffd4UL,
+sHTML_COL_azure, 0x00f0ffffUL,
+sHTML_COL_beige, 0x00f5f5dcUL,
+sHTML_COL_bisque, 0x00ffe4c4UL,
+sHTML_COL_black, 0x00000000UL,
+sHTML_COL_blanchedalmond, 0x00ffebcdUL,
+sHTML_COL_blue, 0x000000ffUL,
+sHTML_COL_blueviolet, 0x008a2be2UL,
+sHTML_COL_brown, 0x00a52a2aUL,
+sHTML_COL_burlywood, 0x00deb887UL,
+sHTML_COL_cadetblue, 0x005f9ea0UL,
+sHTML_COL_chartreuse, 0x007fff00UL,
+sHTML_COL_chocolate, 0x00d2691eUL,
+sHTML_COL_coral, 0x00ff7f50UL,
+sHTML_COL_cornflowerblue, 0x006495edUL,
+sHTML_COL_cornsilk, 0x00fff8dcUL,
+sHTML_COL_crimson, 0x00dc143cUL,
+sHTML_COL_cyan, 0x0000ffffUL,
+sHTML_COL_darkblue, 0x0000008bUL,
+sHTML_COL_darkcyan, 0x00008b8bUL,
+sHTML_COL_darkgoldenrod, 0x00b8860bUL,
+sHTML_COL_darkgray, 0x00a9a9a9UL,
+sHTML_COL_darkgreen, 0x00006400UL,
+sHTML_COL_darkkhaki, 0x00bdb76bUL,
+sHTML_COL_darkmagenta, 0x008b008bUL,
+sHTML_COL_darkolivegreen, 0x00556b2fUL,
+sHTML_COL_darkorange, 0x00ff8c00UL,
+sHTML_COL_darkorchid, 0x009932ccUL,
+sHTML_COL_darkred, 0x008b0000UL,
+sHTML_COL_darksalmon, 0x00e9967aUL,
+sHTML_COL_darkseagreen, 0x008fbc8fUL,
+sHTML_COL_darkslateblue, 0x00483d8bUL,
+sHTML_COL_darkslategray, 0x002f4f4fUL,
+sHTML_COL_darkturquoise, 0x0000ced1UL,
+sHTML_COL_darkviolet, 0x009400d3UL,
+sHTML_COL_deeppink, 0x00ff1493UL,
+sHTML_COL_deepskyblue, 0x0000bfffUL,
+sHTML_COL_dimgray, 0x00696969UL,
+sHTML_COL_dodgerblue, 0x001e90ffUL,
+sHTML_COL_firebrick, 0x00b22222UL,
+sHTML_COL_floralwhite, 0x00fffaf0UL,
+sHTML_COL_forestgreen, 0x00228b22UL,
+sHTML_COL_fuchsia, 0x00ff00ffUL,
+sHTML_COL_gainsboro, 0x00dcdcdcUL,
+sHTML_COL_ghostwhite, 0x00f8f8ffUL,
+sHTML_COL_gold, 0x00ffd700UL,
+sHTML_COL_goldenrod, 0x00daa520UL,
+sHTML_COL_gray, 0x00808080UL,
+sHTML_COL_green, 0x00008000UL,
+sHTML_COL_greenyellow, 0x00adff2fUL,
+sHTML_COL_honeydew, 0x00f0fff0UL,
+sHTML_COL_hotpink, 0x00ff69b4UL,
+sHTML_COL_indianred, 0x00cd5c5cUL,
+sHTML_COL_indigo, 0x004b0082UL,
+sHTML_COL_ivory, 0x00fffff0UL,
+sHTML_COL_khaki, 0x00f0e68cUL,
+sHTML_COL_lavender, 0x00e6e6faUL,
+sHTML_COL_lavenderblush, 0x00fff0f5UL,
+sHTML_COL_lawngreen, 0x007cfc00UL,
+sHTML_COL_lemonchiffon, 0x00fffacdUL,
+sHTML_COL_lightblue, 0x00add8e6UL,
+sHTML_COL_lightcoral, 0x00f08080UL,
+sHTML_COL_lightcyan, 0x00e0ffffUL,
+sHTML_COL_lightgoldenrodyellow, 0x00fafad2UL,
+sHTML_COL_lightgreen, 0x0090ee90UL,
+sHTML_COL_lightgrey, 0x00d3d3d3UL,
+sHTML_COL_lightpink, 0x00ffb6c1UL,
+sHTML_COL_lightsalmon, 0x00ffa07aUL,
+sHTML_COL_lightseagreen, 0x0020b2aaUL,
+sHTML_COL_lightskyblue, 0x0087cefaUL,
+sHTML_COL_lightslategray, 0x00778899UL,
+sHTML_COL_lightsteelblue, 0x00b0c4deUL,
+sHTML_COL_lightyellow, 0x00ffffe0UL,
+sHTML_COL_lime, 0x0000ff00UL,
+sHTML_COL_limegreen, 0x0032cd32UL,
+sHTML_COL_linen, 0x00faf0e6UL,
+sHTML_COL_magenta, 0x00ff00ffUL,
+sHTML_COL_maroon, 0x00800000UL,
+sHTML_COL_mediumaquamarine, 0x0066cdaaUL,
+sHTML_COL_mediumblue, 0x000000cdUL,
+sHTML_COL_mediumorchid, 0x00ba55d3UL,
+sHTML_COL_mediumpurple, 0x009370dbUL,
+sHTML_COL_mediumseagreen, 0x003cb371UL,
+sHTML_COL_mediumslateblue, 0x007b68eeUL,
+sHTML_COL_mediumspringgreen, 0x0000fa9aUL,
+sHTML_COL_mediumturquoise, 0x0048d1ccUL,
+sHTML_COL_mediumvioletred, 0x00c71585UL,
+sHTML_COL_midnightblue, 0x00191970UL,
+sHTML_COL_mintcream, 0x00f5fffaUL,
+sHTML_COL_mistyrose, 0x00ffe4e1UL,
+sHTML_COL_moccasin, 0x00ffe4b5UL,
+sHTML_COL_navajowhite, 0x00ffdeadUL,
+sHTML_COL_navy, 0x00000080UL,
+sHTML_COL_oldlace, 0x00fdf5e6UL,
+sHTML_COL_olive, 0x00808000UL,
+sHTML_COL_olivedrab, 0x006b8e23UL,
+sHTML_COL_orange, 0x00ffa500UL,
+sHTML_COL_orangered, 0x00ff4500UL,
+sHTML_COL_orchid, 0x00da70d6UL,
+sHTML_COL_palegoldenrod, 0x00eee8aaUL,
+sHTML_COL_palegreen, 0x0098fb98UL,
+sHTML_COL_paleturquoise, 0x00afeeeeUL,
+sHTML_COL_palevioletred, 0x00db7093UL,
+sHTML_COL_papayawhip, 0x00ffefd5UL,
+sHTML_COL_peachpuff, 0x00ffdab9UL,
+sHTML_COL_peru, 0x00cd853fUL,
+sHTML_COL_pink, 0x00ffc0cbUL,
+sHTML_COL_plum, 0x00dda0ddUL,
+sHTML_COL_powderblue, 0x00b0e0e6UL,
+sHTML_COL_purple, 0x00800080UL,
+sHTML_COL_red, 0x00ff0000UL,
+sHTML_COL_rosybrown, 0x00bc8f8fUL,
+sHTML_COL_royalblue, 0x004169e1UL,
+sHTML_COL_saddlebrown, 0x008b4513UL,
+sHTML_COL_salmon, 0x00fa8072UL,
+sHTML_COL_sandybrown, 0x00f4a460UL,
+sHTML_COL_seagreen, 0x002e8b57UL,
+sHTML_COL_seashell, 0x00fff5eeUL,
+sHTML_COL_sienna, 0x00a0522dUL,
+sHTML_COL_silver, 0x00c0c0c0UL,
+sHTML_COL_skyblue, 0x0087ceebUL,
+sHTML_COL_slateblue, 0x006a5acdUL,
+sHTML_COL_slategray, 0x00708090UL,
+sHTML_COL_snow, 0x00fffafaUL,
+sHTML_COL_springgreen, 0x0000ff7fUL,
+sHTML_COL_steelblue, 0x004682b4UL,
+sHTML_COL_tan, 0x00d2b48cUL,
+sHTML_COL_teal, 0x00008080UL,
+sHTML_COL_thistle, 0x00d8bfd8UL,
+sHTML_COL_tomato, 0x00ff6347UL,
+sHTML_COL_turquoise, 0x0040e0d0UL,
+sHTML_COL_violet, 0x00ee82eeUL,
+sHTML_COL_wheat, 0x00f5deb3UL,
+sHTML_COL_white, 0x00ffffffUL,
+sHTML_COL_whitesmoke, 0x00f5f5f5UL,
+sHTML_COL_yellow, 0x00ffff00UL,
+sHTML_COL_yellowgreen, 0x009acd32UL
+};
+
+extern "C"
+{
+
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+ _Optlink
+#endif
+ HTMLColorNameCompare( const void *pFirst, const void *pSecond)
+{
+ int nRet = 0;
+ if( HTML_NO_COLOR == ((HTML_ColorEntry*)pFirst)->nColor )
+ {
+ if( HTML_NO_COLOR == ((HTML_ColorEntry*)pSecond)->nColor )
+ nRet = ((HTML_ColorEntry*)pFirst)->pUName->CompareTo(
+ *((HTML_ColorEntry*)pSecond)->pUName );
+ else
+ nRet = ((HTML_ColorEntry*)pFirst)->pUName->CompareToAscii(
+ ((HTML_ColorEntry*)pSecond)->sName );
+ }
+ else
+ {
+ if( HTML_NO_COLOR == ((HTML_ColorEntry*)pSecond)->nColor )
+ nRet = -1 * ((HTML_ColorEntry*)pSecond)->pUName->CompareToAscii(
+ ((HTML_ColorEntry*)pFirst)->sName );
+ else
+ nRet = strcmp( ((HTML_ColorEntry*)pFirst)->sName,
+ ((HTML_ColorEntry*)pSecond)->sName );
+ }
+
+ return nRet;
+}
+
+}
+
+ULONG GetHTMLColor( const String& rName )
+{
+ if( !bSortColorKeyWords )
+ {
+ qsort( (void*) aHTMLColorNameTab,
+ sizeof( aHTMLColorNameTab ) / sizeof( HTML_ColorEntry ),
+ sizeof( HTML_ColorEntry ),
+ HTMLColorNameCompare );
+ bSortColorKeyWords = TRUE;
+ }
+
+ ULONG nRet = ULONG_MAX;
+ void* pFound;
+ HTML_ColorEntry aSrch;
+ aSrch.pUName = &rName;
+ aSrch.nColor = HTML_NO_COLOR;
+
+ if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
+ (void*) aHTMLColorNameTab,
+ sizeof( aHTMLColorNameTab) / sizeof( HTML_ColorEntry ),
+ sizeof( HTML_ColorEntry ),
+ HTMLColorNameCompare )))
+ nRet = ((HTML_ColorEntry*)pFound)->nColor;
+
+ return nRet;
+}
+
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
new file mode 100644
index 000000000000..a30e2ec175de
--- /dev/null
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -0,0 +1,708 @@
+/*************************************************************************
+ *
+ * $RCSfile: htmlout.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/urlobj.hxx>
+
+#ifndef _ZFORMAT_HXX //autogen
+#include <zformat.hxx>
+#endif
+
+#ifndef _SFXMACITEM_HXX
+#include <macitem.hxx>
+#endif
+#ifndef _CACHESTR_HXX //autogen
+#include <tools/cachestr.hxx>
+#endif
+#ifndef _SV_SYSTEM_HXX //autogen
+#include <vcl/system.hxx>
+#endif
+
+#ifndef _ZFORLIST_HXX //autogen
+#include <zforlist.hxx>
+#endif
+
+#ifndef _SV_CLIP_HXX //autogen
+#include <vcl/clip.hxx>
+#endif
+
+#include "htmlout.hxx"
+#include "htmlkywd.hxx"
+#include "imap.hxx"
+#include "imaprect.hxx"
+#include "imapcirc.hxx"
+#include "imappoly.hxx"
+
+#ifndef RTL_CONSTASCII_STRINGPARAM
+#define RTL_CONSTASCII_STRINGPARAM( c ) c, sizeof(c)-1
+#endif
+
+#if defined(MAC)
+const sal_Char HTMLOutFuncs::sNewLine = '\015';
+#elif defined(UNX)
+const sal_Char HTMLOutFuncs::sNewLine = '\012';
+#else
+const sal_Char __FAR_DATA HTMLOutFuncs::sNewLine[] = "\015\012";
+#endif
+
+const sal_Char *lcl_svhtml_GetEntityForANSIChar( sal_Char c )
+{
+ const sal_Char* pStr = 0;
+ switch( (unsigned char)c )
+ {
+// case '\x0a': return HTMLOutFuncs::Out_Tag( rStream, sHTML_linebreak );
+
+ case '<': pStr = sHTML_C_lt; break;
+ case '>': pStr = sHTML_C_gt; break;
+ case '&': pStr = sHTML_C_amp; break;
+ case '"': pStr = sHTML_C_quot; break;
+
+ case 161: pStr = sHTML_S_iexcl; break;
+ case 162: pStr = sHTML_S_cent; break;
+ case 163: pStr = sHTML_S_pound; break;
+ case 164: pStr = sHTML_S_curren; break;
+ case 165: pStr = sHTML_S_yen; break;
+ case 166: pStr = sHTML_S_brvbar; break;
+ case 167: pStr = sHTML_S_sect; break;
+ case 168: pStr = sHTML_S_uml; break;
+ case 169: pStr = sHTML_S_copy; break;
+ case 170: pStr = sHTML_S_ordf; break;
+ case 171: pStr = sHTML_S_laquo; break;
+ case 172: pStr = sHTML_S_not; break;
+ case 174: pStr = sHTML_S_reg; break;
+ case 175: pStr = sHTML_S_macr; break;
+ case 176: pStr = sHTML_S_deg; break;
+ case 177: pStr = sHTML_S_plusmn; break;
+ case 178: pStr = sHTML_S_sup2; break;
+ case 179: pStr = sHTML_S_sup3; break;
+ case 180: pStr = sHTML_S_acute; break;
+ case 181: pStr = sHTML_S_micro; break;
+ case 182: pStr = sHTML_S_para; break;
+ case 183: pStr = sHTML_S_middot; break;
+ case 184: pStr = sHTML_S_cedil; break;
+ case 185: pStr = sHTML_S_sup1; break;
+ case 186: pStr = sHTML_S_ordm; break;
+ case 187: pStr = sHTML_S_raquo; break;
+ case 188: pStr = sHTML_S_frac14; break;
+ case 189: pStr = sHTML_S_frac12; break;
+ case 190: pStr = sHTML_S_frac34; break;
+ case 191: pStr = sHTML_S_iquest; break;
+
+ case 192: pStr = sHTML_C_Agrave; break;
+ case 193: pStr = sHTML_C_Aacute; break;
+ case 194: pStr = sHTML_C_Acirc; break;
+ case 195: pStr = sHTML_C_Atilde; break;
+ case 196: pStr = sHTML_C_Auml; break;
+ case 197: pStr = sHTML_C_Aring; break;
+ case 198: pStr = sHTML_C_AElig; break;
+ case 199: pStr = sHTML_C_Ccedil; break;
+ case 200: pStr = sHTML_C_Egrave; break;
+ case 201: pStr = sHTML_C_Eacute; break;
+ case 202: pStr = sHTML_C_Ecirc; break;
+ case 203: pStr = sHTML_C_Euml; break;
+ case 204: pStr = sHTML_C_Igrave; break;
+ case 205: pStr = sHTML_C_Iacute; break;
+ case 206: pStr = sHTML_C_Icirc; break;
+ case 207: pStr = sHTML_C_Iuml; break;
+ case 208: pStr = sHTML_C_ETH; break;
+ case 209: pStr = sHTML_C_Ntilde; break;
+ case 210: pStr = sHTML_C_Ograve; break;
+ case 211: pStr = sHTML_C_Oacute; break;
+ case 212: pStr = sHTML_C_Ocirc; break;
+ case 213: pStr = sHTML_C_Otilde; break;
+ case 214: pStr = sHTML_C_Ouml; break;
+ case 215: pStr = sHTML_S_times; break;
+ case 216: pStr = sHTML_C_Oslash; break;
+ case 217: pStr = sHTML_C_Ugrave; break;
+ case 218: pStr = sHTML_C_Uacute; break;
+ case 219: pStr = sHTML_C_Ucirc; break;
+ case 220: pStr = sHTML_C_Uuml; break;
+ case 221: pStr = sHTML_C_Yacute; break;
+
+ case 222: pStr = sHTML_C_THORN; break;
+ case 223: pStr = sHTML_C_szlig; break;
+
+ case 224: pStr = sHTML_S_agrave; break;
+ case 225: pStr = sHTML_S_aacute; break;
+ case 226: pStr = sHTML_S_acirc; break;
+ case 227: pStr = sHTML_S_atilde; break;
+ case 228: pStr = sHTML_S_auml; break;
+ case 229: pStr = sHTML_S_aring; break;
+ case 230: pStr = sHTML_S_aelig; break;
+ case 231: pStr = sHTML_S_ccedil; break;
+ case 232: pStr = sHTML_S_egrave; break;
+ case 233: pStr = sHTML_S_eacute; break;
+ case 234: pStr = sHTML_S_ecirc; break;
+ case 235: pStr = sHTML_S_euml; break;
+ case 236: pStr = sHTML_S_igrave; break;
+ case 237: pStr = sHTML_S_iacute; break;
+ case 238: pStr = sHTML_S_icirc; break;
+ case 239: pStr = sHTML_S_iuml; break;
+ case 240: pStr = sHTML_S_eth; break;
+ case 241: pStr = sHTML_S_ntilde; break;
+ case 242: pStr = sHTML_S_ograve; break;
+ case 243: pStr = sHTML_S_oacute; break;
+ case 244: pStr = sHTML_S_ocirc; break;
+ case 245: pStr = sHTML_S_otilde; break;
+ case 246: pStr = sHTML_S_ouml; break;
+ case 247: pStr = sHTML_S_divide; break;
+ case 248: pStr = sHTML_S_oslash; break;
+ case 249: pStr = sHTML_S_ugrave; break;
+ case 250: pStr = sHTML_S_uacute; break;
+ case 251: pStr = sHTML_S_ucirc; break;
+ case 252: pStr = sHTML_S_uuml; break;
+ case 253: pStr = sHTML_S_yacute; break;
+ case 254: pStr = sHTML_S_thorn; break;
+ case 255: pStr = sHTML_S_yuml; break;
+
+ }
+
+ return pStr;
+}
+
+void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest,
+ rtl_TextEncoding eDestEnc )
+{
+ DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW != eDestEnc,
+ "wrong destination encoding" );
+ const sal_Char *pStr = 0;
+ sal_Char cOut = 0U;
+
+ switch( c )
+ {
+ case 0xA0: // is a hard blank
+//!! the TextConverter has a problem with this character - so change it to
+// a hard space - that's the same as our 5.2
+ case 0x2011: // is a hard hyphen
+ pStr = sHTML_S_nbsp;
+ break;
+ case 0xAD: // is a soft hyphen
+ pStr = sHTML_S_shy;
+ break;
+
+ default:
+ // Convert character to ISO8859-1 temporarily
+ sal_Char cANSI = ByteString::ConvertFromUnicode(
+ c, RTL_TEXTENCODING_ISO_8859_1, FALSE );
+ // If it could be converted, there may be an entity for the character.
+ if( cANSI )
+ pStr = lcl_svhtml_GetEntityForANSIChar( cANSI );
+
+ if( !pStr )
+ {
+ cOut = RTL_TEXTENCODING_ISO_8859_1 == eDestEnc
+ ? cANSI
+ : ByteString::ConvertFromUnicode( c, eDestEnc, FALSE );
+
+ // If the character could not be converted to the destination
+ // character set, the original character code is truncated to
+ // an 8-bit-character code.
+ if( !cOut )
+ cOut = (sal_Char)c;
+ }
+ break;
+ }
+
+ if( !pStr && ( (cOut>=' ' && cOut<='~') || cOut=='\t' ||
+ RTL_TEXTENCODING_ISO_8859_1 == eDestEnc ) )
+ rDest += cOut;
+ else
+ {
+ rDest += '&';
+ if( pStr )
+ rDest += pStr;
+ else
+ (rDest += '#') +=
+ ByteString::CreateFromInt32( (sal_Int32)cOut );
+ rDest += ';';
+ }
+}
+
+void HTMLOutFuncs::ConvertStringToHTML( const String& rSrc,
+ ByteString& rDest,
+ rtl_TextEncoding eDestEnc )
+{
+ if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
+ eDestEnc = gsl_getSystemTextEncoding();
+
+ for( sal_uInt32 i=0UL, nLen = rSrc.Len(); i < nLen; i++ )
+ lcl_ConvertCharToHTML( rSrc.GetChar( i ), rDest, eDestEnc );
+}
+
+SvStream& HTMLOutFuncs::Out_AsciiTag( SvStream& rStream, const sal_Char *pStr,
+ BOOL bOn, rtl_TextEncoding )
+{
+ sal_Char sStt[3] = "</";
+ if( bOn )
+ sStt[1] = 0;
+ return (rStream << sStt << pStr << '>');
+}
+
+SvStream& HTMLOutFuncs::Out_Char( SvStream& rStream, sal_Unicode c,
+ rtl_TextEncoding eDestEnc )
+{
+ if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
+ eDestEnc = gsl_getSystemTextEncoding();
+
+ ByteString sOut;
+ lcl_ConvertCharToHTML( c, sOut, eDestEnc );
+ rStream << sOut.GetBuffer();
+ return rStream;
+}
+
+SvStream& HTMLOutFuncs::Out_String( SvStream& rStream, const String& rStr,
+ rtl_TextEncoding eDestEnc )
+{
+ for( sal_uInt32 n = 0UL; n < rStr.Len(); n++ )
+ HTMLOutFuncs::Out_Char( rStream, rStr.GetChar( n ), eDestEnc );
+ return rStream;
+}
+
+SvStream& HTMLOutFuncs::Out_Hex( SvStream& rStream, ULONG nHex, BYTE nLen,
+ rtl_TextEncoding )
+{ // in einen Stream aus
+ sal_Char aNToABuf[] = "0000000000000000";
+
+ DBG_ASSERT( nLen < sizeof(aNToABuf), "zu viele Stellen" );
+ if( nLen>=sizeof(aNToABuf) )
+ nLen = (sizeof(aNToABuf)-1);
+
+ // Pointer an das Bufferende setzen
+ sal_Char *pStr = aNToABuf + (sizeof(aNToABuf)-1);
+ for( BYTE n = 0; n < nLen; ++n )
+ {
+ *(--pStr) = (sal_Char)(nHex & 0xf ) + 48;
+ if( *pStr > '9' )
+ *pStr += 39;
+ nHex >>= 4;
+ }
+ return rStream << pStr;
+}
+
+
+SvStream& HTMLOutFuncs::Out_Color( SvStream& rStream, const Color& rColor,
+ rtl_TextEncoding )
+{
+ rStream << "\"#";
+ Out_Hex( rStream, rColor.GetRed(), 2 );
+ Out_Hex( rStream, rColor.GetGreen(), 2 );
+ Out_Hex( rStream, rColor.GetBlue(), 2 );
+ rStream << '\"';
+
+ return rStream;
+}
+
+SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
+ const ImageMap& rIMap,
+ const String& rName,
+ const HTMLOutEvent *pEventTable,
+ BOOL bOutStarBasic,
+ const sal_Char *pDelim,
+ const sal_Char *pIndentArea,
+ const sal_Char *pIndentMap,
+ rtl_TextEncoding eDestEnc )
+{
+ if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
+ eDestEnc = gsl_getSystemTextEncoding();
+
+ const String& rOutName = rName.Len() ? rName : rIMap.GetName();
+ DBG_ASSERT( rOutName.Len(), "Kein ImageMap-Name" )
+ if( !rOutName.Len() )
+ return rStream;
+
+ ByteString sOut( '<' );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM(sHTML_map ) );
+ sOut.Append( ' ' );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM(sHTML_O_name) );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM("=\"") );
+ rStream << sOut.GetBuffer();
+ sOut.Erase();
+ Out_String( rStream, rOutName, eDestEnc );
+ rStream << '\"';
+
+ for( USHORT i=0U; i<rIMap.GetIMapObjectCount(); i++ )
+ {
+ const IMapObject* pObj = rIMap.GetIMapObject( i );
+ DBG_ASSERT( pObj, "Wo ist das ImageMap-Object?" );
+
+ if( pObj )
+ {
+ const sal_Char *pShape = 0;
+ ByteString aCoords;
+ switch( pObj->GetType() )
+ {
+ case( IMAP_OBJ_RECTANGLE ):
+ {
+ const IMapRectangleObject* pRectObj =
+ (const IMapRectangleObject *)pObj;
+ pShape = sHTML_SH_rect;
+ Rectangle aRect( pRectObj->GetRectangle() );
+ ((((((aCoords =
+ ByteString::CreateFromInt32(aRect.Left())) += ',')
+ += ByteString::CreateFromInt32(aRect.Top())) += ',')
+ += ByteString::CreateFromInt32(aRect.Right())) += ',')
+ += ByteString::CreateFromInt32(aRect.Bottom());
+ }
+ break;
+ case( IMAP_OBJ_CIRCLE ):
+ {
+ const IMapCircleObject* pCirc =
+ (const IMapCircleObject *)pObj;
+ pShape= sHTML_SH_circ;
+ Point aCenter( pCirc->GetCenter() );
+ long nOff = pCirc->GetRadius();
+ ((((aCoords =
+ ByteString::CreateFromInt32(aCenter.X())) += ',')
+ += ByteString::CreateFromInt32(aCenter.Y())) += ',')
+ += ByteString::CreateFromInt32(nOff);
+ }
+ break;
+ case( IMAP_OBJ_POLYGON ):
+ {
+ const IMapPolygonObject* pPolyObj =
+ (const IMapPolygonObject *)pObj;
+ pShape= sHTML_SH_poly;
+ Polygon aPoly( pPolyObj->GetPolygon() );
+ USHORT nCount = aPoly.GetSize();
+ if( nCount>0 )
+ {
+ const Point& rPoint = aPoly[0];
+ ((aCoords =
+ ByteString::CreateFromInt32(rPoint.X())) += ',')
+ += ByteString::CreateFromInt32(rPoint.Y());
+ }
+ for( USHORT j=1; j<nCount; j++ )
+ {
+ const Point& rPoint = aPoly[j];
+ (((aCoords += ',')
+ += ByteString::CreateFromInt32(rPoint.X())) += ',')
+ += ByteString::CreateFromInt32(rPoint.Y());
+ }
+ }
+ break;
+ default:
+ DBG_ASSERT( pShape, "unbekanntes IMapObject" );
+ break;
+ }
+
+ if( pShape )
+ {
+ if( pDelim )
+ rStream << pDelim;
+ if( pIndentArea )
+ rStream << pIndentArea;
+
+ ((((((((((sOut = '<') += sHTML_area) += ' ')
+ += sHTML_O_shape) += '=') += pShape) += ' ')
+ += sHTML_O_coords) += "=\"") += aCoords) += "\" ";
+ rStream << sOut.GetBuffer();
+
+ String aURL( pObj->GetURL() );
+ if( aURL.Len() && pObj->IsActive() )
+ {
+ aURL = INetURLObject::AbsToRel( aURL );
+ (sOut = sHTML_O_href) += "=\"";
+ rStream << sOut.GetBuffer();
+ Out_String( rStream, aURL, eDestEnc ) << '\"';
+ }
+ else
+ rStream << sHTML_O_nohref;
+
+ const String& rName = pObj->GetName();
+ if( rName.Len() )
+ {
+ ((sOut = ' ') += sHTML_O_name) += "=\"";
+ rStream << sOut.GetBuffer();
+ Out_String( rStream, rName, eDestEnc ) << '\"';
+ }
+
+ const String& rTarget = pObj->GetTarget();
+ if( rTarget.Len() && pObj->IsActive() )
+ {
+ ((sOut = ' ') += sHTML_O_target) += "=\"";
+ rStream << sOut.GetBuffer();
+ Out_String( rStream, rTarget, eDestEnc ) << '\"';
+ }
+
+ const String& rDesc = pObj->GetDescription();
+ if( rDesc.Len() )
+ {
+ ((sOut = ' ') += sHTML_O_alt) += "=\"";
+ rStream << sOut.GetBuffer();
+ Out_String( rStream, rDesc, eDestEnc ) << '\"';
+ }
+
+ const SvxMacroTableDtor& rMacroTab = pObj->GetMacroTable();
+ if( pEventTable && rMacroTab.Count() )
+ Out_Events( rStream, rMacroTab, pEventTable,
+ bOutStarBasic, eDestEnc );
+
+ rStream << '>';
+ }
+ }
+
+ }
+
+ if( pDelim )
+ rStream << pDelim;
+ if( pIndentMap )
+ rStream << pIndentMap;
+ Out_AsciiTag( rStream, sHTML_map, FALSE );
+
+ return rStream;
+}
+
+SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, const String& rSource,
+ const String& rLanguage,
+ ScriptType eScriptType,
+ const String& rSrc,
+ const String *pSBLibrary,
+ const String *pSBModule,
+ rtl_TextEncoding eDestEnc )
+{
+ if( RTL_TEXTENCODING_DONTKNOW == eDestEnc )
+ eDestEnc = gsl_getSystemTextEncoding();
+
+ // Script wird komplett nicht eingerueckt!
+ ByteString sOut( '<' );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM(sHTML_script) );
+
+ if( rLanguage.Len() )
+ {
+ sOut.Append( ' ' );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM(sHTML_O_language) );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM("=\"") );
+ rStrm << sOut.GetBuffer();
+ Out_String( rStrm, rLanguage, eDestEnc );
+ sOut = '\"';
+ }
+
+ if( rSrc.Len() )
+ {
+ ((sOut += ' ') += sHTML_O_src) += "=\"";
+ rStrm << sOut.GetBuffer();
+ Out_String( rStrm, INetURLObject::AbsToRel(rSrc), eDestEnc );
+ sOut = '\"';
+ }
+
+ if( STARBASIC != eScriptType && pSBLibrary )
+ {
+ ((sOut += ' ') += sHTML_O_sdlibrary) += "=\"";
+ rStrm << sOut.GetBuffer();
+ Out_String( rStrm, *pSBLibrary, eDestEnc );
+ sOut = '\"';
+ }
+
+ if( STARBASIC != eScriptType && pSBModule )
+ {
+ ((sOut += ' ') += sHTML_O_sdmodule) += "=\"";
+ rStrm << sOut.GetBuffer();
+ Out_String( rStrm, *pSBModule, eDestEnc );
+ sOut = '\"';
+ }
+
+ sOut += '>';
+
+ rStrm << sOut.GetBuffer();
+
+ if( rSource.Len() || pSBLibrary || pSBModule )
+ {
+ rStrm << sNewLine;
+
+ if( JAVASCRIPT != eScriptType )
+ {
+ rStrm << "<!--"
+ << sNewLine;
+ }
+
+ if( STARBASIC == eScriptType )
+ {
+ if( pSBLibrary )
+ {
+ sOut.Assign( RTL_CONSTASCII_STRINGPARAM("' ") );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM(sHTML_SB_library) );
+ sOut.Append( ' ' );
+ ByteString sTmp( *pSBLibrary, eDestEnc );
+ sOut.Append( sTmp );
+ rStrm << sOut.GetBuffer() << sNewLine;
+ }
+
+ if( pSBModule )
+ {
+ sOut.Assign( RTL_CONSTASCII_STRINGPARAM("' ") );
+ sOut.Append( RTL_CONSTASCII_STRINGPARAM(sHTML_SB_module) );
+ sOut.Append( ' ' );
+ ByteString sTmp( *pSBModule, eDestEnc );
+ sOut.Append( sTmp );
+ rStrm << sOut.GetBuffer() << sNewLine;
+ }
+ }
+
+ if( rSource.Len() )
+ {
+ // Wir schreiben das Modul mm ANSI-Zeichensatz, aber mit
+ // System-Zeilenumbruechen raus.
+ ByteString sSource( rSource, eDestEnc );
+ sSource.ConvertLineEnd( GetSystemLineEnd() );
+ rStrm << sSource.GetBuffer();
+ }
+ rStrm << sNewLine;
+
+ if( JAVASCRIPT != eScriptType )
+ {
+ // MIB/MM: Wenn es kein StarBasic ist, kann ein // natuerlich
+ // falsch sein. Da der Kommentar aber beim Einlesen wider
+ // entfernt wird, schickt uns das nicht weiter ...
+ rStrm << (STARBASIC == eScriptType ? "' -->" : "// -->")
+ << sNewLine;
+ }
+ }
+
+ HTMLOutFuncs::Out_AsciiTag( rStrm, sHTML_script, FALSE );
+
+ return rStrm;
+}
+
+
+SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm,
+ const SvxMacroTableDtor& rMacroTable,
+ const HTMLOutEvent *pEventTable,
+ BOOL bOutStarBasic,
+ rtl_TextEncoding eDestEnc )
+{
+ USHORT i=0;
+ while( pEventTable[i].pBasicName || pEventTable[i].pJavaName )
+ {
+ const SvxMacro *pMacro =
+ rMacroTable.Get( pEventTable[i].nEvent );
+
+ if( pMacro && pMacro->GetMacName().Len() &&
+ ( JAVASCRIPT == pMacro->GetScriptType() || bOutStarBasic ))
+ {
+ const sal_Char *pStr = STARBASIC == pMacro->GetScriptType()
+ ? pEventTable[i].pBasicName
+ : pEventTable[i].pJavaName;
+
+ if( pStr )
+ {
+ ByteString sOut( ' ' );
+ (sOut += pStr) += "=\"";
+ rStrm << sOut.GetBuffer();
+
+ Out_String( rStrm, pMacro->GetMacName(), eDestEnc ) << '\"';
+ }
+ }
+ i++;
+ }
+
+ return rStrm;
+}
+
+ByteString& HTMLOutFuncs::CreateTableDataOptionsValNum( ByteString& aStrTD,
+ BOOL bValue,
+ double fVal, ULONG nFormat, SvNumberFormatter& rFormatter,
+ rtl_TextEncoding eDestEnc )
+{
+ if ( bValue )
+ {
+ // printf / scanf ist zu ungenau
+ String aValStr;
+ rFormatter.GetInputLineString( fVal, 0, aValStr );
+ ByteString sTmp( aValStr, eDestEnc );
+ ((((aStrTD += ' ') += sHTML_O_SDval) += "=\"") += sTmp) += '\"';
+ }
+ if ( bValue || nFormat )
+ {
+ ((aStrTD += ' ') += sHTML_O_SDnum) += "=\"";
+ (aStrTD += ByteString::CreateFromInt32(System::GetLanguage()))
+ += ';'; // Language fuer Format 0
+ if ( nFormat )
+ {
+ ByteString aNumStr;
+ LanguageType nLang;
+ const SvNumberformat* pFormatEntry = rFormatter.GetEntry( nFormat );
+ if ( pFormatEntry )
+ {
+ ByteString sTmp( pFormatEntry->GetFormatstring(), eDestEnc );
+ aNumStr = sTmp;
+ nLang = pFormatEntry->GetLanguage();
+ }
+ else
+ nLang = LANGUAGE_SYSTEM;
+ ((aStrTD += nLang) += ';') += aNumStr;
+ }
+ aStrTD += '\"';
+ }
+ return aStrTD;
+}
+
+BOOL HTMLOutFuncs::PrivateURLToInternalImg( String& rURL )
+{
+ if( rURL.Len() > 14UL &&
+ rURL.CompareToAscii( sHTML_private_image, 14UL ) == COMPARE_EQUAL )
+ {
+ rURL.Erase( 0UL, 14UL );
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx
new file mode 100644
index 000000000000..3a38dbb522fc
--- /dev/null
+++ b/svtools/source/svhtml/htmlsupp.cxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * $RCSfile: htmlsupp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+#include <tools/urlobj.hxx>
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_ULONGS
+#include <svstdarr.hxx>
+#endif
+
+#include "parhtml.hxx"
+#include "htmltokn.h"
+#include "htmlkywd.hxx"
+
+/* */
+
+// Tabellen zum Umwandeln von Options-Werten in Strings
+
+static HTMLOptionEnum __READONLY_DATA aScriptLangOptEnums[] =
+{
+ { sHTML_LG_starbasic, HTML_SL_STARBASIC },
+ { sHTML_LG_javascript, HTML_SL_JAVASCRIPT },
+ { sHTML_LG_javascript11,HTML_SL_JAVASCRIPT },
+ { sHTML_LG_livescript, HTML_SL_JAVASCRIPT },
+// { sHTML_LG_unused_javascript, HTML_SL_UNUSEDJS },
+// { sHTML_LG_vbscript, HTML_SL_VBSCRIPT },
+// { sHTML_LG_starone, HTML_SL_STARONE },
+ { 0, 0 }
+};
+
+BOOL HTMLParser::ParseScriptOptions( String& rLangString,
+ HTMLScriptLanguage& rLang,
+ String& rSrc,
+ String& rLibrary,
+ String& rModule )
+{
+ const HTMLOptions *pOptions = GetOptions();
+
+ rLangString.Erase();
+ rLang = HTML_SL_JAVASCRIPT;
+ rSrc.Erase();
+ rLibrary.Erase();
+ rModule.Erase();
+
+ for( USHORT i = pOptions->Count(); i; )
+ {
+ const HTMLOption *pOption = (*pOptions)[ --i ];
+ switch( pOption->GetToken() )
+ {
+ case HTML_O_LANGUAGE:
+ {
+ rLangString = pOption->GetString();
+ USHORT nLang;
+ if( pOption->GetEnum( nLang, aScriptLangOptEnums ) )
+ rLang = (HTMLScriptLanguage)nLang;
+ else
+ rLang = HTML_SL_UNKNOWN;
+ }
+ break;
+
+ case HTML_O_SRC:
+ rSrc = INetURLObject::RelToAbs( pOption->GetString() );
+ break;
+
+ case HTML_O_SDLIBRARY:
+ rLibrary = pOption->GetString();
+ break;
+
+ case HTML_O_SDMODULE:
+ rModule = pOption->GetString();
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+void HTMLParser::RemoveSGMLComment( String &rString, BOOL bFull )
+{
+ sal_Unicode c;
+ while( rString.Len() &&
+ ( ' '==(c=rString.GetChar(0UL)) || '\t'==c || '\r'==c || '\n'==c ) )
+ rString.Erase( 0UL, 1UL );
+
+ while( rString.Len() &&
+ ( ' '==(c=rString.GetChar( rString.Len()-1UL))
+ || '\t'==c || '\r'==c || '\n'==c ) )
+ rString.Erase( rString.Len()-1UL );
+
+
+ // SGML-Kommentare entfernen
+ if( rString.Len() >= 4UL &&
+ rString.CompareToAscii( "<!--", 4UL ) == COMPARE_EQUAL )
+ {
+ sal_uInt32 nPos = 3UL;
+ if( bFull )
+ {
+ // die gesamte Zeile !
+ nPos = 4UL;
+ while( nPos < rString.Len() &&
+ ( ( c = rString.GetChar( nPos )) != '\r' && c != '\n' ) )
+ ++nPos;
+ if( c == '\r' && nPos+1UL < rString.Len() &&
+ '\n' == rString.GetChar( nPos+1UL ))
+ ++nPos;
+ else if( c != '\n' )
+ nPos = 3UL;
+ }
+ rString.Erase( 0UL, ++nPos );
+ }
+
+ if( rString.Len() >=3UL &&
+ rString.Copy(rString.Len()-3UL).CompareToAscii("-->")
+ == COMPARE_EQUAL )
+ {
+ rString.Erase( rString.Len()-3UL );
+ if( bFull )
+ {
+ // auch noch ein "//" oder "'" und ggf CR/LF davor
+ rString.EraseTrailingChars();
+ sal_uInt32 nDel = 0UL, nLen = rString.Len();
+ if( nLen >= 2UL &&
+ rString.Copy(nLen-2UL).CompareToAscii("//") == COMPARE_EQUAL )
+ {
+ nDel = 2UL;
+ }
+ else if( nLen && '\'' == rString.GetChar(nLen-1UL) )
+ {
+ nDel = 1UL;
+ }
+ if( nDel && nLen >= nDel+1UL )
+ {
+ c = rString.GetChar( nLen-(nDel+1UL) );
+ if( '\r'==c || '\n'==c )
+ {
+ nDel++;
+ if( '\n'==c && nLen >= nDel+1UL &&
+ '\r'==rString.GetChar( nLen-(nDel+1UL) ) )
+ nDel++;
+ }
+ }
+ rString.Erase( nLen-nDel );
+ }
+ }
+}
+
diff --git a/svtools/source/svhtml/makefile.mk b/svtools/source/svhtml/makefile.mk
new file mode 100644
index 000000000000..c1e726b83a23
--- /dev/null
+++ b/svtools/source/svhtml/makefile.mk
@@ -0,0 +1,112 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=svhtml
+AUTOSEG=true
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+CXXFILES = \
+ parhtml.cxx \
+ htmlkywd.cxx \
+ htmlkey2.cxx \
+ htmlsupp.cxx \
+ htmlout.cxx
+
+OBJFILES = $(OBJ)$/htmlkey2.obj
+
+SLOFILES=\
+ $(LIB3OBJFILES) \
+ $(LIB4OBJFILES)
+
+# nur damit's was zum builden gibt
+LIB2TARGET =$(LB)$/svhtmlk2.lib
+LIB2OBJFILES =$(OBJFILES)
+
+LIB3TARGET=$(SLB)$/svhtml1.lib
+LIB3OBJFILES=\
+ $(SLO)$/htmlkey2.obj \
+ $(SLO)$/htmlkywd.obj \
+ $(SLO)$/htmlsupp.obj \
+ $(SLO)$/parhtml.obj
+
+LIB4TARGET=$(SLB)$/svhtml2.lib
+LIB4OBJFILES=\
+ $(SLO)$/htmlout.obj
+
+.ENDIF
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
new file mode 100644
index 000000000000..c9a0e2ab51dc
--- /dev/null
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -0,0 +1,2043 @@
+/*************************************************************************
+ *
+ * $RCSfile: parhtml.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _TOOLS_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+#ifndef _RTL_STRBUF_HXX_
+#include <rtl/strbuf.hxx>
+#endif
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_ULONGS
+#include <svstdarr.hxx>
+#endif
+
+#include "parhtml.hxx"
+#include "htmltokn.h"
+#include "htmlkywd.hxx"
+
+const sal_Int32 MAX_LEN = 1024L;
+//static sal_Unicode sTmpBuffer[ MAX_LEN+1 ];
+const sal_Int32 MAX_MACRO_LEN = 1024;
+
+/* */
+
+// Tabellen zum Umwandeln von Options-Werten in Strings
+
+// <INPUT TYPE=xxx>
+static HTMLOptionEnum __READONLY_DATA aInputTypeOptEnums[] =
+{
+ { sHTML_IT_text, HTML_IT_TEXT },
+ { sHTML_IT_password, HTML_IT_PASSWORD },
+ { sHTML_IT_checkbox, HTML_IT_CHECKBOX },
+ { sHTML_IT_radio, HTML_IT_RADIO },
+ { sHTML_IT_range, HTML_IT_RANGE },
+ { sHTML_IT_scribble, HTML_IT_SCRIBBLE },
+ { sHTML_IT_file, HTML_IT_FILE },
+ { sHTML_IT_hidden, HTML_IT_HIDDEN },
+ { sHTML_IT_submit, HTML_IT_SUBMIT },
+ { sHTML_IT_image, HTML_IT_IMAGE },
+ { sHTML_IT_reset, HTML_IT_RESET },
+ { sHTML_IT_button, HTML_IT_BUTTON },
+ { 0, 0 }
+};
+
+// <TABLE FRAME=xxx>
+static HTMLOptionEnum __READONLY_DATA aTableFrameOptEnums[] =
+{
+ { sHTML_TF_void, HTML_TF_VOID },
+ { sHTML_TF_above, HTML_TF_ABOVE },
+ { sHTML_TF_below, HTML_TF_BELOW },
+ { sHTML_TF_hsides, HTML_TF_HSIDES },
+ { sHTML_TF_lhs, HTML_TF_LHS },
+ { sHTML_TF_rhs, HTML_TF_RHS },
+ { sHTML_TF_vsides, HTML_TF_VSIDES },
+ { sHTML_TF_box, HTML_TF_BOX },
+ { sHTML_TF_border, HTML_TF_BOX },
+ { 0, 0 }
+};
+
+// <TABLE RULES=xxx>
+static HTMLOptionEnum __READONLY_DATA aTableRulesOptEnums[] =
+{
+ { sHTML_TR_none, HTML_TR_NONE },
+ { sHTML_TR_groups, HTML_TR_GROUPS },
+ { sHTML_TR_rows, HTML_TR_ROWS },
+ { sHTML_TR_cols, HTML_TR_COLS },
+ { sHTML_TR_all, HTML_TR_ALL },
+ { 0, 0 }
+};
+
+
+SV_IMPL_PTRARR(HTMLOptions,HTMLOptionPtr)
+
+/* */
+
+USHORT HTMLOption::GetEnum( const HTMLOptionEnum *pOptEnums, USHORT nDflt ) const
+{
+ USHORT nValue = nDflt;
+
+ while( pOptEnums->pName )
+ if( aValue.EqualsIgnoreCaseAscii( pOptEnums->pName ) )
+ break;
+ else
+ pOptEnums++;
+
+ if( pOptEnums->pName )
+ nValue = pOptEnums->nValue;
+
+ return nValue;
+}
+
+BOOL HTMLOption::GetEnum( USHORT &rEnum, const HTMLOptionEnum *pOptEnums ) const
+{
+ while( pOptEnums->pName )
+ {
+ if( aValue.EqualsIgnoreCaseAscii( pOptEnums->pName ) )
+ break;
+ else
+ pOptEnums++;
+ }
+
+ const sal_Char *pName = pOptEnums->pName;
+ if( pName )
+ rEnum = pOptEnums->nValue;
+
+ return (pName != 0);
+}
+
+HTMLOption::HTMLOption( USHORT nTok, const String& rToken,
+ const String& rValue )
+ : nToken( nTok ), aToken(rToken), aValue(rValue)
+{
+ DBG_ASSERT( nToken>=HTML_OPTION_START && nToken<HTML_OPTION_END,
+ "HTMLOption: unbekanntes Token" );
+}
+
+ULONG HTMLOption::GetNumber() const
+{
+ DBG_ASSERT( (nToken>=HTML_OPTION_NUMBER_START &&
+ nToken<HTML_OPTION_NUMBER_END) ||
+ (nToken>=HTML_OPTION_CONTEXT_START &&
+ nToken<HTML_OPTION_CONTEXT_END) ||
+ nToken==HTML_O_VALUE,
+ "GetNumber: Option ist nicht numerisch" );
+ String aTmp( aValue );
+ aTmp.EraseLeadingChars();
+ sal_Int32 nTmp = aTmp.ToInt32();
+ return nTmp >= 0L ? (sal_uInt32)nTmp : 0UL;
+}
+
+INT32 HTMLOption::GetSNumber() const
+{
+ DBG_ASSERT( (nToken>=HTML_OPTION_NUMBER_START && nToken<HTML_OPTION_NUMBER_END) ||
+ (nToken>=HTML_OPTION_CONTEXT_START && nToken<HTML_OPTION_CONTEXT_END),
+ "GetSNumber: Option ist nicht numerisch" );
+ String aTmp( aValue );
+ aTmp.EraseLeadingChars();
+ return aTmp.ToInt32();
+}
+
+void HTMLOption::GetNumbers( SvULongs &rLongs, BOOL bSpaceDelim ) const
+{
+ if( rLongs.Count() )
+ rLongs.Remove( 0, rLongs.Count() );
+
+ if( bSpaceDelim )
+ {
+ // das ist ein sehr stark vereinfachter Scanner. Er sucht einfach
+ // alle Tiffern aus dem String
+ BOOL bInNum = FALSE;
+ ULONG nNum = 0UL;
+ for( sal_uInt32 i=0UL; i<aValue.Len(); i++ )
+ {
+ register sal_Unicode c = aValue.GetChar( i );
+ if( c>='0' && c<='9' )
+ {
+ nNum *= 10UL;
+ nNum += (c - '0');
+ bInNum = TRUE;
+ }
+ else if( bInNum )
+ {
+ rLongs.Insert( nNum, rLongs.Count() );
+ bInNum = FALSE;
+ nNum = 0UL;
+ }
+ }
+ if( bInNum )
+ {
+ rLongs.Insert( nNum, rLongs.Count() );
+ }
+ }
+ else
+ {
+ // hier wird auf die korrekte Trennung der Zahlen durch ',' geachtet
+ // und auch mal eine 0 eingefuegt
+ sal_uInt32 nPos = 0UL;
+ while( nPos < aValue.Len() )
+ {
+ register sal_Unicode c;
+ while( nPos < aValue.Len() &&
+ ((c=aValue.GetChar(nPos)) == ' ' || c == '\t' ||
+ c == '\n' || c== '\r' ) )
+ nPos++;
+
+ if( nPos==aValue.Len() )
+ rLongs.Insert( 0UL, rLongs.Count() );
+ else
+ {
+ sal_uInt32 nEnd = aValue.Search( (sal_Unicode)',', nPos );
+ if( STRING_NOTFOUND==nEnd )
+ {
+ sal_Int32 nTmp = aValue.Copy(nPos).ToInt32();
+ rLongs.Insert( nTmp >= 0L ? (sal_uInt32)nTmp : 0UL,
+ rLongs.Count() );
+ nPos = aValue.Len();
+ }
+ else
+ {
+ sal_Int32 nTmp =
+ aValue.Copy(nPos,nEnd-nPos).ToInt32();
+ rLongs.Insert( nTmp >= 0L ? (sal_uInt32)nTmp : 0UL,
+ rLongs.Count() );
+ nPos = nEnd+1UL;
+ }
+ }
+ }
+ }
+}
+
+void HTMLOption::GetColor( Color& rColor ) const
+{
+ DBG_ASSERT( (nToken>=HTML_OPTION_COLOR_START && nToken<HTML_OPTION_COLOR_END) || nToken==HTML_O_SIZE,
+ "GetColor: Option spezifiziert keine Farbe" );
+
+ String aTmp( aValue );
+ aTmp.ToUpperAscii();
+ ULONG nColor = ULONG_MAX;
+ if( '#'!=aTmp.GetChar( 0UL ) )
+ nColor = GetHTMLColor( aTmp );
+
+ if( ULONG_MAX == nColor )
+ {
+ nColor = 0UL;
+ sal_uInt32 nPos = 0UL;
+ for( sal_uInt32 i=0UL; i<6UL; i++ )
+ {
+ // MIB 26.06.97: Wie auch immer Netscape Farbwerte ermittelt,
+ // maximal drei Zeichen, die kleiner als '0' sind werden
+ // ignoriert. Bug #40901# stimmt damit. Mal schauen, was sich
+ // irgendwelche HTML-Autoren noch so einfallen lassen...
+ register sal_Unicode c = nPos<aTmp.Len() ? aTmp.GetChar( nPos++ )
+ : '0';
+ if( c < '0' )
+ {
+ c = nPos<aTmp.Len() ? aTmp.GetChar(nPos++) : '0';
+ if( c < '0' )
+ c = nPos<aTmp.Len() ? aTmp.GetChar(nPos++) : '0';
+ }
+ nColor *= 16UL;
+ if( c >= '0' && c <= '9' )
+ nColor += (c - 48);
+ else if( c >= 'A' && c <= 'F' )
+ nColor += (c - 55);
+ }
+ }
+
+ rColor.SetRed( (BYTE)((nColor & 0x00ff0000UL) >> 16) );
+ rColor.SetGreen( (BYTE)((nColor & 0x0000ff00UL) >> 8));
+ rColor.SetBlue( (BYTE)(nColor & 0x000000ffUL) );
+}
+
+HTMLInputType HTMLOption::GetInputType() const
+{
+ DBG_ASSERT( nToken==HTML_O_TYPE, "GetInputType: Option nicht TYPE" );
+ return (HTMLInputType)GetEnum( aInputTypeOptEnums, HTML_IT_TEXT );
+}
+
+HTMLTableFrame HTMLOption::GetTableFrame() const
+{
+ DBG_ASSERT( nToken==HTML_O_FRAME, "GetTableFrame: Option nicht FRAME" );
+ return (HTMLTableFrame)GetEnum( aTableFrameOptEnums, HTML_TF_VOID );
+}
+
+HTMLTableRules HTMLOption::GetTableRules() const
+{
+ DBG_ASSERT( nToken==HTML_O_RULES, "GetTableRules: Option nicht RULES" );
+ return (HTMLTableRules)GetEnum( aTableRulesOptEnums, HTML_TR_NONE );
+}
+
+/* */
+
+HTMLParser::HTMLParser( SvStream& rIn, int bReadNewDoc )
+ : SvParser( rIn )
+{
+ bNewDoc = bReadNewDoc;
+ bReadListing = bReadXMP = bReadPRE = bReadTextArea =
+ bReadScript = bReadStyle =
+ bEndTokenFound = bIsInBody = bReadNextChar =
+ bReadComment = FALSE;
+ bIsInHeader = TRUE;
+ pOptions = new HTMLOptions;
+}
+
+HTMLParser::~HTMLParser()
+{
+ if( pOptions && pOptions->Count() )
+ pOptions->DeleteAndDestroy( 0, pOptions->Count() );
+ delete pOptions;
+}
+
+SvParserState __EXPORT HTMLParser::CallParser()
+{
+ eState = SVPAR_WORKING;
+ nNextCh = GetNextChar();
+ SaveState( 0 );
+
+ nPre_LinePos = 0UL;
+ bPre_IgnoreNewPara = FALSE;
+
+ AddRef();
+ Continue( 0 );
+ if( SVPAR_PENDING != eState )
+ ReleaseRef(); // dann brauchen wir den Parser nicht mehr!
+
+ return eState;
+}
+
+void HTMLParser::Continue( int nToken )
+{
+ if( !nToken )
+ nToken = GetNextToken();
+
+ while( IsParserWorking() )
+ {
+ SaveState( nToken );
+ nToken = FilterToken( nToken );
+
+ if( nToken )
+ NextToken( nToken );
+
+ if( IsParserWorking() )
+ SaveState( 0 ); // bis hierhin abgearbeitet,
+ // weiter mit neuem Token!
+ nToken = GetNextToken();
+ }
+}
+
+int HTMLParser::FilterToken( int nToken )
+{
+ switch( nToken )
+ {
+ case sal_Unicode(EOF):
+ nToken = 0;
+ break; // nicht verschicken
+
+ case HTML_HEAD_OFF:
+ bIsInBody = TRUE;
+ case HTML_HEAD_ON:
+ bIsInHeader = HTML_HEAD_ON == nToken;
+ break;
+
+ case HTML_BODY_ON:
+ case HTML_FRAMESET_ON:
+ bIsInHeader = FALSE;
+ bIsInBody = HTML_BODY_ON == nToken;
+ break;
+
+ case HTML_BODY_OFF:
+ bIsInBody = bReadPRE = bReadListing = bReadXMP = FALSE;
+ break;
+
+ case HTML_HTML_OFF:
+ nToken = 0;
+ bReadPRE = bReadListing = bReadXMP = FALSE;
+ break; // HTML_ON wurde auch nicht verschickt !
+
+ case HTML_PREFORMTXT_ON:
+ StartPRE();
+ break;
+
+ case HTML_PREFORMTXT_OFF:
+ FinishPRE();
+ break;
+
+ case HTML_LISTING_ON:
+ StartListing();
+ break;
+
+ case HTML_LISTING_OFF:
+ FinishListing();
+ break;
+
+ case HTML_XMP_ON:
+ StartXMP();
+ break;
+
+ case HTML_XMP_OFF:
+ FinishXMP();
+ break;
+
+ default:
+ if( bReadPRE )
+ nToken = FilterPRE( nToken );
+ else if( bReadListing )
+ nToken = FilterListing( nToken );
+ else if( bReadXMP )
+ nToken = FilterXMP( nToken );
+
+ break;
+ }
+
+ return nToken;
+}
+
+#define HTML_ISDIGIT( c ) (c >= '0' && c <= '9')
+#define HTML_ISALPHA( c ) ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') )
+#define HTML_ISALNUM( c ) ( HTML_ISALPHA(c) || HTML_ISDIGIT(c) )
+#define HTML_ISSPACE( c ) ( ' ' == c || (c >= 0x09 && c <= 0x0d) )
+#define HTML_ISPRINTABLE( c ) ( c >= 32 && c != 127)
+
+int HTMLParser::ScanText( const sal_Unicode cBreak )
+{
+ ::rtl::OUStringBuffer sTmpBuffer( MAX_LEN );
+ int bWeiter = TRUE;
+ int bEqSignFound = FALSE;
+ sal_Unicode cQuote = 0U;
+
+ while( bWeiter && IsParserWorking() )
+ {
+ int bNextCh = TRUE;
+ switch( nNextCh )
+ {
+ case '&':
+ bEqSignFound = FALSE;
+ if( bReadXMP )
+ sTmpBuffer.append( (sal_Unicode)'&' );
+ else
+ {
+ ULONG nStreamPos = rInput.Tell();
+ ULONG nLinePos = GetLinePos();
+
+ sal_Unicode cChar = 0U;
+ if( '#' == (nNextCh = GetNextChar()) )
+ {
+ nNextCh = GetNextChar();
+ if( HTML_ISDIGIT(nNextCh) )
+ {
+ do
+ {
+ cChar = cChar * 10U + sal_Unicode( nNextCh - '0');
+ nNextCh = GetNextChar();
+ }
+ while( HTML_ISDIGIT(nNextCh) );
+
+ if( RTL_TEXTENCODING_DONTKNOW != eSrcEnc &&
+ RTL_TEXTENCODING_UCS2 != eSrcEnc &&
+ RTL_TEXTENCODING_UTF8 != eSrcEnc )
+ {
+ sal_Unicode cOrig = cChar;
+ cChar = ByteString::ConvertToUnicode(
+ (sal_Char)cChar, eSrcEnc );
+ if( 0U == cChar )
+ {
+ // #73398#: If the character could not be
+ // converted, because a conversion is not
+ // available, do no conversion at all.
+ cChar = cOrig;
+ }
+ }
+ }
+ else
+ nNextCh = 0U;
+ }
+ else if( HTML_ISALPHA( nNextCh ) )
+ {
+ ::rtl::OUStringBuffer sEntityBuffer( 6L );
+ sal_Int32 nPos = 0L;
+ do
+ {
+ sEntityBuffer.append( nNextCh );
+ nPos++;
+ nNextCh = GetNextChar();
+ }
+ while( nPos < 6L && HTML_ISALNUM( nNextCh ) &&
+ !rInput.IsEof() );
+
+ if( IsParserWorking() && !rInput.IsEof() )
+ {
+ String sEntity( sEntityBuffer.getStr(),
+ (sal_uInt32)nPos );
+ cChar = GetHTMLCharName( sEntity );
+
+ // nicht gefunden ( == 0 ), dann Klartext
+ // oder ein Zeichen das als Attribut eingefuegt
+ // wird
+ if( 0U == cChar && ';' != nNextCh )
+ {
+ DBG_ASSERT( rInput.Tell() - nStreamPos ==
+ (ULONG)(nPos+1L)*GetCharSize(),
+ "UTF-8 geht hier schief" );
+ for( sal_Int32 i=nPos-1L; i>1L; i-- )
+ {
+ nNextCh = sEntityBuffer[i];
+ sEntityBuffer.setLength( i );
+ sEntity.Assign( sEntityBuffer.getStr(),
+ (sal_uInt32)i );
+ cChar = GetHTMLCharName( sEntity );
+ if( cChar )
+ {
+ rInput.SeekRel( -(long)
+ ((nPos-i)*GetCharSize()) );
+ nlLinePos -= sal_uInt32(nPos-i);
+ nPos = i;
+ break;
+ }
+ }
+ }
+
+ if( !cChar ) // unbekanntes Zeichen?
+ {
+ // dann im Stream zurueck, das '&' als Zeichen
+ // einfuegen und mit dem nachfolgenden Zeichen
+ // wieder aufsetzen
+ sTmpBuffer.append( (sal_Unicode)'&' );
+
+// rInput.SeekRel( -(long)(++nPos*GetCharSize()) );
+// nlLinePos -= nPos;
+ DBG_ASSERT( rInput.Tell()-nStreamPos ==
+ (ULONG)(nPos+1)*GetCharSize(),
+ "Falsche Stream-Position" );
+ DBG_ASSERT( nlLinePos-nLinePos ==
+ (ULONG)(nPos+1),
+ "Falsche Zeilen-Position" );
+ rInput.Seek( nStreamPos );
+ nlLinePos = nLinePos;
+ break;
+ }
+
+ // 1 == Non Breaking Space
+ // 2 == SoftHyphen
+
+ if( cChar < 3U )
+ {
+ if( '>' == cBreak )
+ {
+ // Wenn der Inhalt eines Tags gelesen wird,
+ // muessen wir ein Space bzw. - daraus machen
+ switch( cChar )
+ {
+ case 1U: cChar = ' '; break;
+ case 2U: cChar = '-'; break;
+ default:
+ DBG_ASSERT( cChar==1U,
+ "\0x00 sollte doch schon laengt abgefangen sein!" );
+ break;
+ }
+ }
+ else
+ {
+ // Wenn kein Tag gescannt wird, enstprechendes
+ // Token zurueckgeben
+ aToken +=
+ String( sTmpBuffer.makeStringAndClear() );
+ if( cChar )
+ {
+ if( aToken.Len() )
+ {
+ // mit dem Zeichen wieder aufsetzen
+ nNextCh = '&';
+// rInput.SeekRel( -(long)(++nPos*GetCharSize()) );
+// nlLinePos -= nPos;
+ DBG_ASSERT( rInput.Tell()-nStreamPos ==
+ (ULONG)(nPos+1)*GetCharSize(),
+ "Falsche Stream-Position" );
+ DBG_ASSERT( nlLinePos-nLinePos ==
+ (ULONG)(nPos+1),
+ "Falsche Zeilen-Position" );
+ rInput.Seek( nStreamPos );
+ nlLinePos = nLinePos;
+ return HTML_TEXTTOKEN;
+ }
+
+ // Hack: _GetNextChar soll nicht das
+ // naechste Zeichen lesen
+ if( ';' != nNextCh )
+ aToken += ' ';
+ if( 1U == cChar )
+ return HTML_NONBREAKSPACE;
+ if( 2U == cChar )
+ return HTML_SOFTHYPH;
+ }
+ aToken += (sal_Unicode)'&';
+ aToken +=
+ String(sEntityBuffer.makeStringAndClear());
+ break;
+ }
+ }
+ }
+ else
+ nNextCh = 0U;
+ }
+ // MIB 03/02/2000: &{...};-JavaScript-Macros are not
+ // supported any longer.
+ else if( IsParserWorking() )
+ {
+ sTmpBuffer.append( (sal_Unicode)'&' );
+ bNextCh = FALSE;
+ break;
+ }
+
+ bNextCh = (';' == nNextCh);
+ if( cBreak=='>' && (cChar=='\\' || cChar=='\'' ||
+ cChar=='\"' || cChar==' ') )
+ {
+ // ' und " mussen innerhalb von Tags mit einem \
+ // gekennzeichnet werden, um sie von ' und " als Klammern
+ // um Optionen zu unterscheiden. Logischerweise muss
+ // deshalb auch ein \ gekeenzeichnet werden. Ausserdem
+ // schuetzen wir ein Space, weil es kein Trennzeichen
+ // zwischen Optionen ist.
+ sTmpBuffer.append( (sal_Unicode)'\\' );
+ if( MAX_LEN == sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+ }
+ if( IsParserWorking() )
+ {
+ if( cChar )
+ sTmpBuffer.append( cChar );
+ }
+ else if( SVPAR_PENDING==eState && '>'!=cBreak )
+ {
+ // Mit dem '&' Zeichen wieder aufsetzen, der Rest
+ // wird als Texttoken zurueckgegeben.
+ if( aToken.Len() || sTmpBuffer.getLength() )
+ {
+ // Der bisherige Text wird von _GetNextChar()
+ // zurueckgegeben und beim naechsten Aufruf wird
+ // ein neues Zeichen gelesen. Also muessen wir uns
+ // noch vor das & stellen.
+ nNextCh = 0U;
+ rInput.Seek( nStreamPos-(sal_uInt32)GetCharSize() );
+ nlLinePos = nLinePos-1UL;
+ bReadNextChar = TRUE;
+ }
+ bNextCh = FALSE;
+ }
+ }
+ break;
+ case '=':
+ if( '>'==cBreak && !cQuote )
+ bEqSignFound = TRUE;
+ sTmpBuffer.append( nNextCh );
+ break;
+
+ case '\\':
+ if( '>'==cBreak )
+ {
+ // Innerhalb von Tags kennzeichnen
+ sTmpBuffer.append( (sal_Unicode)'\\' );
+ if( MAX_LEN == sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+ }
+ sTmpBuffer.append( (sal_Unicode)'\\' );
+ break;
+
+ case '\"':
+ case '\'':
+ if( '>'==cBreak )
+ {
+ if( bEqSignFound )
+ cQuote = nNextCh;
+ else if( cQuote && (cQuote==nNextCh ) )
+ cQuote = 0U;
+ }
+ sTmpBuffer.append( nNextCh );
+ bEqSignFound = FALSE;
+ break;
+
+ case sal_Unicode(EOF):
+ if( rInput.IsEof() )
+ {
+// MIB 20.11.98: Das macht hier keinen Sinn, oder doch: Zumindest wird
+// abc&auml;<EOF> nicht angezeigt, also lassen wir das in Zukunft.
+// if( '>' != cBreak )
+// eState = SVPAR_ACCEPTED;
+ bWeiter = FALSE;
+ }
+ else
+ {
+ sTmpBuffer.append( nNextCh );
+ }
+ break;
+
+ case '<':
+ bEqSignFound = FALSE;
+ if( '>'==cBreak )
+ sTmpBuffer.append( nNextCh );
+ else
+ bWeiter = FALSE; // Abbrechen, String zusammen
+ break;
+
+ case '\f':
+ if( '>' == cBreak )
+ {
+ // Beim Scannen von Optionen wie ein Space behandeln
+ sTmpBuffer.append( (sal_Unicode)' ' );
+ }
+ else
+ {
+ // sonst wird es ein eigenes Token
+ bWeiter = FALSE;
+ }
+ break;
+
+ case '\r':
+ case '\n':
+ if( '>'==cBreak )
+ {
+ // #26979# cr/lf in Tag wird in _GetNextToken() behandeln
+ sTmpBuffer.append( nNextCh );
+ break;
+ }
+ else if( bReadListing || bReadXMP || bReadPRE || bReadTextArea )
+ {
+ bWeiter = FALSE;
+ break;
+ }
+ // Bug 18984: CR-LF -> Blank
+ // Folge von CR/LF/BLANK/TAB nur in ein Blank wandeln
+ // kein break!!
+ case '\t':
+ if( '\t'==nNextCh && bReadPRE && '>'!=cBreak )
+ {
+ // In <PRE>: Tabs nach oben durchreichen
+ bWeiter = FALSE;
+ break;
+ }
+ // kein break
+ case '\x0b':
+ if( '\x0b'==nNextCh && (bReadPRE || bReadXMP ||bReadListing) &&
+ '>'!=cBreak )
+ {
+ break;
+ }
+ nNextCh = ' ';
+ // kein break;
+ case ' ':
+ sTmpBuffer.append( nNextCh );
+ if( '>'!=cBreak && (!bReadListing && !bReadXMP &&
+ !bReadPRE && !bReadTextArea) )
+ {
+ // alle Folgen von Blanks/Tabs/CR/LF zu einem Blank umwandeln
+ do {
+ if( sal_Unicode(EOF) == (nNextCh = GetNextChar()) &&
+ rInput.IsEof() )
+ {
+ if( aToken.Len() || sTmpBuffer.getLength() > 1L )
+ {
+ // ausser den Blanks wurde noch etwas geselen
+ aToken += String(sTmpBuffer.makeStringAndClear());
+ return HTML_TEXTTOKEN;
+ }
+ else
+ // nur Blanks gelesen: dann darf kein Text
+ // mehr zurueckgegeben werden und _GetNextToken
+ // muss auf EOF laufen
+ return 0;
+ }
+ } while ( ' ' == nNextCh || '\t' == nNextCh ||
+ '\r' == nNextCh || '\n' == nNextCh ||
+ '\x0b' == nNextCh );
+ bNextCh = FALSE;
+ }
+ break;
+
+ default:
+ bEqSignFound = FALSE;
+ if( (nNextCh==cBreak && !cQuote) ||
+ (ULONG(aToken.Len()) + MAX_LEN) > ULONG(STRING_MAXLEN & ~1 ))
+ bWeiter = FALSE;
+ else
+ {
+ do {
+ // alle anderen Zeichen kommen in den Text
+ sTmpBuffer.append( nNextCh );
+ if( MAX_LEN == sTmpBuffer.getLength() )
+ {
+ aToken += String(sTmpBuffer.makeStringAndClear());
+ if( (ULONG(aToken.Len()) + MAX_LEN) >
+ ULONG(STRING_MAXLEN & ~1 ) )
+ {
+ nNextCh = GetNextChar();
+ return HTML_TEXTTOKEN;
+ }
+ }
+ if( ( sal_Unicode(EOF) == (nNextCh = GetNextChar()) &&
+ rInput.IsEof() ) ||
+ !IsParserWorking() )
+ {
+ if( sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+ return HTML_TEXTTOKEN;
+ }
+ } while( HTML_ISALPHA( nNextCh ) || HTML_ISDIGIT( nNextCh ) );
+ bNextCh = FALSE;
+ }
+ }
+
+ if( MAX_LEN == sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+
+ if( bWeiter && bNextCh )
+ nNextCh = GetNextChar();
+ }
+
+ if( sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+
+ return HTML_TEXTTOKEN;
+}
+
+int HTMLParser::_GetNextRawToken()
+{
+ ::rtl::OUStringBuffer sTmpBuffer( MAX_LEN );
+
+ if( bEndTokenFound )
+ {
+ // beim letzten Aufruf haben wir das End-Token bereits gefunden,
+ // deshalb muessen wir es nicht noch einmal suchen
+ bReadScript = FALSE;
+ bReadStyle = FALSE;
+ aEndToken.Erase();
+ bEndTokenFound = FALSE;
+
+ return 0;
+ }
+
+ // per default geben wir HTML_RAWDATA zurueck
+ int bWeiter = TRUE;
+ int nToken = HTML_RAWDATA;
+ SaveState( 0 );
+ while( bWeiter && IsParserWorking() )
+ {
+ int bNextCh = TRUE;
+ switch( nNextCh )
+ {
+ case '<':
+ {
+ // Vielleicht haben wir das Ende erreicht
+
+ // das bisher gelesene erstmal retten
+ aToken += String(sTmpBuffer.makeStringAndClear());
+
+ // und die Position im Stream merken
+ ULONG nStreamPos = rInput.Tell();
+ ULONG nLineNr = GetLineNr();
+ ULONG nLinePos = GetLinePos();
+
+ // Start eines End-Token?
+ int bOffState = FALSE;
+ if( '/' == (nNextCh = GetNextChar()) )
+ {
+ bOffState = TRUE;
+ nNextCh = GetNextChar();
+ }
+ else if( '!' == nNextCh )
+ {
+ sTmpBuffer.append( nNextCh );
+ nNextCh = GetNextChar();
+ }
+
+ // jetzt die Buchstaben danach lesen
+ while( (HTML_ISALPHA(nNextCh) || '-'==nNextCh) &&
+ IsParserWorking() && sTmpBuffer.getLength() < MAX_LEN )
+ {
+ sTmpBuffer.append( nNextCh );
+ nNextCh = GetNextChar();
+ }
+
+ String aTok( sTmpBuffer.getStr(),
+ (sal_uInt32)sTmpBuffer.getLength() );
+ aTok.ToUpperAscii();
+ BOOL bDone = FALSE;
+ if( bReadScript || aEndToken.Len() )
+ {
+ if( !bReadComment )
+ {
+ if( aTok.CompareToAscii( sHTML_comment, 3UL )
+ == COMPARE_EQUAL )
+ {
+ bReadComment = TRUE;
+ }
+ else
+ {
+ // ein Script muss mit "</SCRIPT>" aufhoehren, wobei
+ // wir es mit dem ">" aus sicherheitsgruenden
+ // erstmal nicht so genau nehmen
+ bDone = bOffState && // '>'==nNextCh &&
+ COMPARE_EQUAL == ( bReadScript
+ ? aTok.CompareToAscii(sHTML_script)
+ : aTok.CompareTo(aEndToken) );
+ }
+ }
+ if( bReadComment && '>'==nNextCh && aTok.Len() >= 2UL &&
+ aTok.Copy( aTok.Len()-2UL ).EqualsAscii( "--" ) )
+ {
+ // hier ist ein Kommentar der Art <!-----> zuende
+ bReadComment = FALSE;
+ }
+ }
+ else
+ {
+ // ein Style-Sheet kann mit </STYLE>, </HEAD> oder
+ // <BODY> aughoehren
+ if( bOffState )
+ bDone = aTok.CompareToAscii(sHTML_style)
+ == COMPARE_EQUAL ||
+ aTok.CompareToAscii(sHTML_head)
+ == COMPARE_EQUAL;
+ else
+ bDone =
+ aTok.CompareToAscii(sHTML_body) == COMPARE_EQUAL;
+ }
+
+ if( bDone )
+ {
+ // das war's, jetzt muessen wir gegebenenfalls den
+ // bisher gelesenen String zurueckgeben und dnach normal
+ // weitermachen
+
+ bWeiter = FALSE;
+
+ // nToken==0 heisst, dass _GetNextToken gleich weiterliest
+ if( !aToken.Len() && (bReadStyle || bReadScript) )
+ {
+ // wir koennen sofort die Umgebung beeden und
+ // das End-Token parsen
+ bReadScript = FALSE;
+ bReadStyle = FALSE;
+ aEndToken.Erase();
+ nToken = 0;
+ }
+ else
+ {
+ // wir muessen bReadScript/bReadStyle noch am
+ // Leben lassen und koennen erst beim naechsten
+ // mal das End-Token Parsen
+ bEndTokenFound = TRUE;
+ }
+
+ // jetzt fahren wir im Stream auf das '<' zurueck
+ rInput.Seek( nStreamPos );
+ SetLineNr( nLineNr );
+ SetLinePos( nLinePos );
+ nNextCh = '<';
+
+ // den String wollen wir nicht an das Token haengen
+ sTmpBuffer.setLength( 0L );
+ }
+ else
+ {
+ // "</" merken, alles andere steht noch im buffer
+ aToken += (sal_Unicode)'<';
+ if( bOffState )
+ aToken += (sal_Unicode)'/';
+
+ bNextCh = FALSE;
+ }
+ }
+ break;
+ case '-':
+ sTmpBuffer.append( nNextCh );
+ if( bReadComment )
+ {
+ BOOL bTwoMinus = FALSE;
+ nNextCh = GetNextChar();
+ while( '-' == nNextCh && IsParserWorking() )
+ {
+ bTwoMinus = TRUE;
+
+ if( MAX_LEN == sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+ sTmpBuffer.append( nNextCh );
+ nNextCh = GetNextChar();
+ }
+
+ if( '>' == nNextCh && IsParserWorking() && bTwoMinus )
+ bReadComment = FALSE;
+
+ bNextCh = FALSE;
+ }
+ break;
+
+ case '\r':
+ // \r\n? beendet das aktuelle Text-Token (auch wenn es leer ist)
+ nNextCh = GetNextChar();
+ if( nNextCh=='\n' )
+ nNextCh = GetNextChar();
+ bWeiter = FALSE;
+ break;
+ case '\n':
+ // \n beendet das aktuelle Text-Token (auch wenn es leer ist)
+ nNextCh = GetNextChar();
+ bWeiter = FALSE;
+ break;
+ case sal_Unicode(EOF):
+ // eof beendet das aktuelle Text-Token und tut so, als ob
+ // ein End-Token gelesen wurde
+ if( rInput.IsEof() )
+ {
+ bWeiter = FALSE;
+ if( aToken.Len() || sTmpBuffer.getLength() )
+ {
+ bEndTokenFound = TRUE;
+ }
+ else
+ {
+ bReadScript = FALSE;
+ bReadStyle = FALSE;
+ aEndToken.Erase();
+ nToken = 0;
+ }
+ break;
+ }
+ // kein break
+ default:
+ // alle anderen Zeichen landen im Buffer
+ sTmpBuffer.append( nNextCh );
+ break;
+ }
+
+ if( (!bWeiter && sTmpBuffer.getLength() > 0L) ||
+ MAX_LEN == sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+
+ if( bWeiter && bNextCh )
+ nNextCh = GetNextChar();
+ }
+
+ if( IsParserWorking() )
+ SaveState( 0 );
+ else
+ nToken = 0;
+
+ return nToken;
+}
+
+// scanne das naechste Token,
+int __EXPORT HTMLParser::_GetNextToken()
+{
+ int nRet = 0;
+ sSaveToken.Erase();
+
+ // die Optionen loeschen
+ if( pOptions->Count() )
+ pOptions->DeleteAndDestroy( 0, pOptions->Count() );
+
+ if( !IsParserWorking() ) // wenn schon Fehler, dann nicht weiter!
+ return 0;
+
+ BOOL bReadNextCharSave = bReadNextChar;
+ if( bReadNextChar )
+ {
+ DBG_ASSERT( !bEndTokenFound,
+ "</SCRIPT> gelesen und trotzdem noch ein Zeichen lesen?" );
+ nNextCh = GetNextChar();
+ if( !IsParserWorking() ) // wenn schon Fehler, dann nicht weiter!
+ return 0;
+ bReadNextChar = FALSE;
+ }
+
+ if( bReadScript || bReadStyle || aEndToken.Len() )
+ {
+ nRet = _GetNextRawToken();
+ if( nRet || !IsParserWorking() )
+ return nRet;
+ }
+
+ do {
+ int bNextCh = TRUE;
+ switch( nNextCh )
+ {
+ case '<':
+ {
+ ULONG nStreamPos = rInput.Tell();
+ ULONG nLineNr = GetLineNr();
+ ULONG nLinePos = GetLinePos();
+
+ int bOffState = FALSE;
+ if( '/' == (nNextCh = GetNextChar()) )
+ {
+ bOffState = TRUE;
+ nNextCh = GetNextChar();
+ }
+ if( HTML_ISALPHA( nNextCh ) || '!'==nNextCh ) // fix #26984#
+ {
+ ::rtl::OUStringBuffer sTmpBuffer;
+ do {
+ sTmpBuffer.append( nNextCh );
+ if( MAX_LEN == sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+ nNextCh = GetNextChar();
+ } while( '>' != nNextCh && !HTML_ISSPACE( nNextCh ) &&
+ IsParserWorking() && !rInput.IsEof() );
+
+ if( sTmpBuffer.getLength() )
+ aToken += String(sTmpBuffer.makeStringAndClear());
+
+ // Blanks ueberlesen
+ while( HTML_ISSPACE( nNextCh ) && IsParserWorking() )
+ nNextCh = GetNextChar();
+
+ if( !IsParserWorking() )
+ {
+ if( SVPAR_PENDING == eState )
+ bReadNextChar = bReadNextCharSave;
+ break;
+ }
+
+ // suche das Token in der Tabelle:
+ sSaveToken = aToken;
+ aToken.ToUpperAscii();
+ if( 0 == (nRet = GetHTMLToken( aToken )) )
+ // Unknown Control
+ nRet = HTML_UNKNOWNCONTROL_ON;
+
+ // Wenn es ein Token zum ausschalten ist ...
+ if( bOffState )
+ {
+ if( HTML_TOKEN_ONOFF & nRet )
+ {
+ // und es ein Off-Token gibt, das daraus machen
+ ++nRet;
+ }
+ else if( HTML_LINEBREAK!=nRet )
+ {
+ // und es kein Off-Token gibt, ein unbekanntes
+ // Token daraus machen (ausser </BR>, das wird
+ // wie <BR> behandelt
+ nRet = HTML_UNKNOWNCONTROL_OFF;
+ }
+ }
+
+ if( nRet == HTML_COMMENT )
+ {
+ // fix: sSaveToken wegen Gross-/Kleinschreibung
+ // als Anfang des Kommentars benutzen und ein
+ // Space anhaengen.
+ aToken = sSaveToken;
+ if( '>'!=nNextCh )
+ aToken += (sal_Unicode)' ';
+ ULONG nCStreamPos = 0UL;
+ ULONG nCLineNr, nCLinePos;
+ sal_uInt32 nCStrLen;
+
+ BOOL bDone = FALSE;
+ // bis zum schliessenden --> lesen. wenn keins gefunden
+ // wurde beim der ersten > wieder aufsetzen
+ while( !bDone && !rInput.IsEof() && IsParserWorking() )
+ {
+ if( '>'==nNextCh )
+ {
+ if( !nCStreamPos )
+ {
+ nCStreamPos = rInput.Tell();
+ nCStrLen = aToken.Len();
+ nCLineNr = GetLineNr();
+ nCLinePos = GetLinePos();
+ }
+ bDone = aToken.Len() >= 2UL &&
+ aToken.Copy(aToken.Len()-2UL,2UL).
+ EqualsAscii( "--" );
+ if( !bDone )
+ aToken += nNextCh;
+ }
+ else
+ aToken += nNextCh;
+ if( !bDone )
+ nNextCh = GetNextChar();
+ }
+ if( !bDone && IsParserWorking() && nCStreamPos )
+ {
+ rInput.Seek( nCStreamPos );
+ SetLineNr( nCLineNr );
+ SetLinePos( nCLinePos );
+ aToken.Erase( nCStrLen );
+ nNextCh = '>';
+ }
+ }
+ else
+ {
+ // den TokenString koennen wir jetzt verwerfen
+ aToken.Erase();
+ }
+
+ // dann lesen wir mal alles bis zur schliessenden '>'
+ if( '>' != nNextCh && IsParserWorking() )
+ {
+ ScanText( '>' );
+ if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() )
+ {
+ // zurueck hinter die < gehen und dort neu
+ // aufsetzen, das < als Text zurueckgeben
+ rInput.Seek( nStreamPos );
+ SetLineNr( nLineNr );
+ SetLinePos( nLinePos );
+
+ aToken = '<';
+ nRet = HTML_TEXTTOKEN;
+ nNextCh = GetNextChar();
+ bNextCh = FALSE;
+ break;
+ }
+ }
+ if( SVPAR_PENDING == eState )
+ bReadNextChar = bReadNextCharSave;
+ }
+ else
+ {
+ if( bOffState )
+ {
+ // einfach alles wegschmeissen
+ ScanText( '>' );
+ if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() )
+ {
+ // zurueck hinter die < gehen und dort neu
+ // aufsetzen, das < als Text zurueckgeben
+ rInput.Seek( nStreamPos );
+ SetLineNr( nLineNr );
+ SetLinePos( nLinePos );
+
+ aToken = '<';
+ nRet = HTML_TEXTTOKEN;
+ nNextCh = GetNextChar();
+ bNextCh = FALSE;
+ break;
+ }
+ if( SVPAR_PENDING == eState )
+ bReadNextChar = bReadNextCharSave;
+ aToken.Erase();
+ }
+ else if( '%' == nNextCh )
+ {
+ nRet = HTML_UNKNOWNCONTROL_ON;
+
+ ULONG nCStreamPos = rInput.Tell();
+ ULONG nCLineNr = GetLineNr(), nCLinePos = GetLinePos();
+
+ BOOL bDone = FALSE;
+ // bis zum schliessenden %> lesen. wenn keins gefunden
+ // wurde beim der ersten > wieder aufsetzen
+ while( !bDone && !rInput.IsEof() && IsParserWorking() )
+ {
+ bDone = '>'==nNextCh && aToken.Len() >= 1UL &&
+ '%' == aToken.GetChar( aToken.Len()-1UL );
+ if( !bDone )
+ {
+ aToken += nNextCh;
+ nNextCh = GetNextChar();
+ }
+ }
+ if( !bDone && IsParserWorking() )
+ {
+ rInput.Seek( nCStreamPos );
+ SetLineNr( nCLineNr );
+ SetLinePos( nCLinePos );
+ aToken.AssignAscii( "<%", 2UL );
+ nRet = HTML_TEXTTOKEN;
+ break;
+ }
+ if( IsParserWorking() )
+ {
+ sSaveToken = aToken;
+ aToken.Erase();
+ }
+ }
+ else
+ {
+ aToken = '<';
+ nRet = HTML_TEXTTOKEN;
+ bNextCh = FALSE;
+ break;
+ }
+ }
+
+ if( IsParserWorking() )
+ {
+ bNextCh = '>' == nNextCh;
+ switch( nRet )
+ {
+ case HTML_TEXTAREA_ON:
+ bReadTextArea = TRUE;
+ break;
+ case HTML_TEXTAREA_OFF:
+ bReadTextArea = FALSE;
+ break;
+ case HTML_SCRIPT_ON:
+ if( !bReadTextArea )
+ bReadScript = TRUE;
+ break;
+ case HTML_SCRIPT_OFF:
+ if( !bReadTextArea )
+ {
+ bReadScript = FALSE;
+ // JavaScript kann den Stream veraendern
+ // also muss das letzte Zeichen nochmals
+ // gelesen werden
+ bReadNextChar = TRUE;
+ bNextCh = FALSE;
+ }
+ break;
+
+ case HTML_STYLE_ON:
+ bReadStyle = TRUE;
+ break;
+ case HTML_STYLE_OFF:
+ bReadStyle = FALSE;
+ break;
+ }
+
+ }
+ }
+ break;
+
+ case sal_Unicode(EOF):
+ if( rInput.IsEof() )
+ {
+ eState = SVPAR_ACCEPTED;
+ nRet = nNextCh;
+ }
+ else
+ {
+ // normalen Text lesen
+ goto scan_text;
+ }
+ break;
+
+ case '\f':
+ // Form-Feeds werden jetzt extra nach oben gereicht
+ nRet = HTML_LINEFEEDCHAR; // !!! eigentlich FORMFEEDCHAR
+ break;
+
+ case '\n':
+ case '\r':
+ if( bReadListing || bReadXMP || bReadPRE || bReadTextArea )
+ {
+ sal_Unicode c = GetNextChar();
+ if( ( '\n' != nNextCh || '\r' != c ) &&
+ ( '\r' != nNextCh || '\n' != c ) )
+ {
+ bNextCh = FALSE;
+ nNextCh = c;
+ }
+ nRet = HTML_NEWPARA;
+ break;
+ }
+ // kein break !
+ case '\t':
+ if( bReadPRE )
+ {
+ nRet = HTML_TABCHAR;
+ break;
+ }
+ // kein break !
+ case ' ':
+ // kein break !
+ default:
+
+scan_text:
+ // es folgt "normaler" Text
+ nRet = ScanText();
+ bNextCh = 0 == aToken.Len();
+
+ // der Text sollte noch verarbeitet werden
+ if( !bNextCh && eState == SVPAR_PENDING )
+ {
+ eState = SVPAR_WORKING;
+ bReadNextChar = TRUE;
+ }
+
+ break;
+ }
+
+ if( bNextCh && SVPAR_WORKING == eState )
+ {
+ nNextCh = GetNextChar();
+ if( SVPAR_PENDING == eState && nRet && HTML_TEXTTOKEN != nRet )
+ {
+ bReadNextChar = TRUE;
+ eState = SVPAR_WORKING;
+ }
+ }
+
+ } while( !nRet && SVPAR_WORKING == eState );
+
+ if( SVPAR_PENDING == eState )
+ nRet = -1; // irgendwas ungueltiges
+
+ return nRet;
+}
+
+void HTMLParser::UnescapeToken()
+{
+ sal_uInt32 nPos=0UL;
+
+ BOOL bEscape = FALSE;
+ while( nPos < aToken.Len() )
+ {
+ BOOL bOldEscape = bEscape;
+ bEscape = FALSE;
+ if( '\\'==aToken.GetChar(nPos) && !bOldEscape )
+ {
+ aToken.Erase( nPos, 1UL );
+ bEscape = TRUE;
+ }
+ else
+ {
+ nPos++;
+ }
+ }
+}
+
+// hole die Optionen
+const HTMLOptions *HTMLParser::GetOptions( USHORT *pNoConvertToken ) const
+{
+ // wenn die Option fuer das aktuelle Token schon einmal
+ // geholt wurden, geben wir sie noch einmal zurueck
+ if( pOptions->Count() )
+ return pOptions;
+
+ sal_uInt32 nPos = 0UL;
+ while( nPos < aToken.Len() )
+ {
+ // ein Zeichen ? Dann faengt hier eine Option an
+ if( HTML_ISALPHA( aToken.GetChar(nPos) ) )
+ {
+ USHORT nToken;
+ String aValue;
+ sal_uInt32 nStt = nPos;
+ register sal_Unicode c;
+
+ // Eigentlich sind hier nur ganz bestimmte Zeichen erlaubt.
+ // Netscape achtet aber nur auf "=" und Leerzeichen (siehe
+ // Mozilla: PA_FetchRequestedNameValues in
+ // lipparse/pa_mdl.c
+// while( nPos < aToken.Len() &&
+// ( '-'==(c=aToken[nPos]) || isalnum(c) || '.'==c || '_'==c) )
+ while( nPos < aToken.Len() && '=' != (c=aToken.GetChar(nPos)) &&
+ HTML_ISPRINTABLE(c) && !HTML_ISSPACE(c) )
+ nPos++;
+
+ String sName( aToken.Copy( nStt, nPos-nStt ) );
+
+//JP 23.03.97: die PlugIns wollen die TokenName im "Original" haben
+// also nur fuers Suchen in UpperCase wandeln
+ String sNameUpperCase( sName );
+ sNameUpperCase.ToUpperAscii();
+
+ nToken = GetHTMLOption( sNameUpperCase ); // der Name ist fertig
+ DBG_ASSERTWARNING( nToken!=HTML_O_UNKNOWN,
+ "GetOption: unbekannte HTML-Option" );
+ BOOL bStripCRLF = (nToken < HTML_OPTION_SCRIPT_START ||
+ nToken >= HTML_OPTION_SCRIPT_END) &&
+ (!pNoConvertToken || nToken != *pNoConvertToken);
+
+ while( nPos < aToken.Len() &&
+ ( !HTML_ISPRINTABLE( (c=aToken.GetChar(nPos)) ) ||
+ HTML_ISSPACE(c) ) )
+ nPos++;
+
+ // hat die Option auch einen Wert?
+ if( nPos!=aToken.Len() && '='==c )
+ {
+ nPos++;
+
+ while( nPos < aToken.Len() &&
+ ( !HTML_ISPRINTABLE( (c=aToken.GetChar(nPos)) ) ||
+ ' '==c || '\t'==c || '\r'==c || '\n'==c ) )
+ nPos++;
+
+ if( nPos != aToken.Len() )
+ {
+ sal_uInt32 nLen = 0UL;
+ nStt = nPos;
+ if( ('"'==c) || ('\'')==c )
+ {
+ sal_Unicode cEnd = c;
+ nPos++; nStt++;
+ BOOL bDone = FALSE;
+ BOOL bEscape = FALSE;
+ while( nPos < aToken.Len() && !bDone )
+ {
+ BOOL bOldEscape = bEscape;
+ bEscape = FALSE;
+ c = aToken.GetChar(nPos);
+ switch( c )
+ {
+ case '\r':
+ case '\n':
+ if( bStripCRLF )
+ ((String &)aToken).Erase( nPos, 1UL );
+ else
+ nPos++, nLen++;
+ break;
+ case '\\':
+ if( bOldEscape )
+ {
+ nPos++, nLen++;
+ }
+ else
+ {
+ ((String &)aToken).Erase( nPos, 1UL );
+ bEscape = TRUE;
+ }
+ break;
+ case '"':
+ case '\'':
+ bDone = !bOldEscape && c==cEnd;
+ if( !bDone )
+ nPos++, nLen++;
+ break;
+ default:
+ nPos++, nLen++;
+ break;
+ }
+ }
+ if( nPos!=aToken.Len() )
+ nPos++;
+ }
+ else
+ {
+ // hier sind wir etwas laxer als der
+ // Standard und erlauben alles druckbare
+ BOOL bEscape = FALSE;
+ BOOL bDone = FALSE;
+ while( nPos < aToken.Len() && !bDone )
+ {
+ BOOL bOldEscape = bEscape;
+ bEscape = FALSE;
+ sal_Unicode c = aToken.GetChar(nPos);
+ switch( c )
+ {
+ case ' ':
+ bDone = !bOldEscape;
+ if( !bDone )
+ nPos++, nLen++;
+ break;
+
+ case '\t':
+ case '\r':
+ case '\n':
+ bDone = TRUE;
+ break;
+
+ case '\\':
+ if( bOldEscape )
+ {
+ nPos++, nLen++;
+ }
+ else
+ {
+ ((String &)aToken).Erase( nPos, 1UL );
+ bEscape = TRUE;
+ }
+ break;
+
+ default:
+ if( HTML_ISPRINTABLE( c ) )
+ nPos++, nLen++;
+ else
+ bDone = TRUE;
+ break;
+ }
+ }
+ }
+
+ if( nLen )
+ aValue = aToken.Copy( nStt, nLen );
+ }
+ }
+
+ // Wir kennen das Token und koennen es Speichern
+ HTMLOption *pOption =
+ new HTMLOption( nToken, sName, aValue );
+
+ pOptions->Insert( pOption, pOptions->Count() );
+
+ }
+ else
+ // white space un unerwartete Zeichen ignorieren wie
+ nPos++;
+ }
+
+ return pOptions;
+}
+
+int HTMLParser::FilterPRE( int nToken )
+{
+ switch( nToken )
+ {
+#ifdef HTML_BEHAVIOUR
+ // diese werden laut Definition zu LFs
+ case HTML_PARABREAK_ON:
+ case HTML_LINEBREAK:
+ nToken = HTML_NEWPARA;
+#else
+ // in Netscape zeigen sie aber nur in nicht-leeren Absaetzen Wirkung
+ case HTML_PARABREAK_ON:
+ nToken = HTML_LINEBREAK;
+ case HTML_LINEBREAK:
+#endif
+ case HTML_NEWPARA:
+ nPre_LinePos = 0UL;
+ if( bPre_IgnoreNewPara )
+ nToken = 0;
+ break;
+
+ case HTML_TABCHAR:
+ {
+ sal_uInt32 nSpaces = 8UL - (nPre_LinePos % 8UL);
+ DBG_ASSERT( !aToken.Len(), "Wieso ist das Token nicht leer?" );
+ aToken.Expand( nSpaces, ' ' );
+ nPre_LinePos += nSpaces;
+ nToken = HTML_TEXTTOKEN;
+ }
+ break;
+ // diese bleiben erhalten
+ case HTML_TEXTTOKEN:
+ nPre_LinePos += aToken.Len();
+ break;
+
+ case HTML_SELECT_ON:
+ case HTML_SELECT_OFF:
+ case HTML_BODY_ON:
+ case HTML_FORM_ON:
+ case HTML_FORM_OFF:
+ case HTML_INPUT:
+ case HTML_OPTION:
+ case HTML_TEXTAREA_ON:
+ case HTML_TEXTAREA_OFF:
+
+ case HTML_IMAGE:
+ case HTML_APPLET_ON:
+ case HTML_APPLET_OFF:
+ case HTML_PARAM:
+ case HTML_EMBED:
+
+ case HTML_HEAD1_ON:
+ case HTML_HEAD1_OFF:
+ case HTML_HEAD2_ON:
+ case HTML_HEAD2_OFF:
+ case HTML_HEAD3_ON:
+ case HTML_HEAD3_OFF:
+ case HTML_HEAD4_ON:
+ case HTML_HEAD4_OFF:
+ case HTML_HEAD5_ON:
+ case HTML_HEAD5_OFF:
+ case HTML_HEAD6_ON:
+ case HTML_HEAD6_OFF:
+ case HTML_BLOCKQUOTE_ON:
+ case HTML_BLOCKQUOTE_OFF:
+ case HTML_ADDRESS_ON:
+ case HTML_ADDRESS_OFF:
+ case HTML_HORZRULE:
+
+ case HTML_CENTER_ON:
+ case HTML_CENTER_OFF:
+ case HTML_DIVISION_ON:
+ case HTML_DIVISION_OFF:
+
+ case HTML_SCRIPT_ON:
+ case HTML_SCRIPT_OFF:
+ case HTML_RAWDATA:
+
+ case HTML_TABLE_ON:
+ case HTML_TABLE_OFF:
+ case HTML_CAPTION_ON:
+ case HTML_CAPTION_OFF:
+ case HTML_COLGROUP_ON:
+ case HTML_COLGROUP_OFF:
+ case HTML_COL_ON:
+ case HTML_COL_OFF:
+ case HTML_THEAD_ON:
+ case HTML_THEAD_OFF:
+ case HTML_TFOOT_ON:
+ case HTML_TFOOT_OFF:
+ case HTML_TBODY_ON:
+ case HTML_TBODY_OFF:
+ case HTML_TABLEROW_ON:
+ case HTML_TABLEROW_OFF:
+ case HTML_TABLEDATA_ON:
+ case HTML_TABLEDATA_OFF:
+ case HTML_TABLEHEADER_ON:
+ case HTML_TABLEHEADER_OFF:
+
+ case HTML_ANCHOR_ON:
+ case HTML_ANCHOR_OFF:
+ case HTML_BOLD_ON:
+ case HTML_BOLD_OFF:
+ case HTML_ITALIC_ON:
+ case HTML_ITALIC_OFF:
+ case HTML_UNDERLINE_ON:
+ case HTML_UNDERLINE_OFF:
+ case HTML_BASEFONT_ON:
+ case HTML_BASEFONT_OFF:
+ case HTML_FONT_ON:
+ case HTML_FONT_OFF:
+ case HTML_BLINK_ON:
+ case HTML_BLINK_OFF:
+ case HTML_SPAN_ON:
+ case HTML_SPAN_OFF:
+ break;
+
+ // der Rest wird als unbekanntes Token behandelt
+ default:
+ if( nToken )
+ {
+ nToken =
+ ( ((HTML_TOKEN_ONOFF & nToken) && (1 & nToken))
+ ? HTML_UNKNOWNCONTROL_OFF
+ : HTML_UNKNOWNCONTROL_ON );
+ }
+ break;
+ }
+
+ bPre_IgnoreNewPara = FALSE;
+
+ return nToken;
+}
+
+int HTMLParser::FilterXMP( int nToken )
+{
+ switch( nToken )
+ {
+ case HTML_NEWPARA:
+ if( bPre_IgnoreNewPara )
+ nToken = 0;
+ case HTML_TEXTTOKEN:
+ case HTML_NONBREAKSPACE:
+ case HTML_SOFTHYPH:
+ break; // bleiben erhalten
+
+ default:
+ if( nToken )
+ {
+ if( (HTML_TOKEN_ONOFF & nToken) && (1 & nToken) )
+ {
+ sSaveToken.Insert( '<', 0UL );
+ sSaveToken.Insert( '/', 1UL );
+ }
+ else
+ sSaveToken.Insert( '<', 0UL );
+ if( aToken.Len() )
+ {
+ UnescapeToken();
+ sSaveToken += (sal_Unicode)' ';
+ aToken.Insert( sSaveToken, 0UL );
+ }
+ else
+ aToken = sSaveToken;
+ aToken += (sal_Unicode)'>';
+ nToken = HTML_TEXTTOKEN;
+ }
+ break;
+ }
+
+ bPre_IgnoreNewPara = FALSE;
+
+ return nToken;
+}
+
+int HTMLParser::FilterListing( int nToken )
+{
+ switch( nToken )
+ {
+ case HTML_NEWPARA:
+ if( bPre_IgnoreNewPara )
+ nToken = 0;
+ case HTML_TEXTTOKEN:
+ case HTML_NONBREAKSPACE:
+ case HTML_SOFTHYPH:
+ break; // bleiben erhalten
+
+ default:
+ if( nToken )
+ {
+ nToken =
+ ( ((HTML_TOKEN_ONOFF & nToken) && (1 & nToken))
+ ? HTML_UNKNOWNCONTROL_OFF
+ : HTML_UNKNOWNCONTROL_ON );
+ }
+ break;
+ }
+
+ bPre_IgnoreNewPara = FALSE;
+
+ return nToken;
+}
+
+FASTBOOL HTMLParser::IsHTMLFormat( const sal_Char* pHeader,
+ BOOL bSwitchToUCS2,
+ rtl_TextEncoding eEnc )
+{
+ // Einer der folgenden regulaeren Ausdrucke muss sich auf den String
+ // anwenden lassen, damit das Dok ein HTML-Dokument ist.
+ //
+ // ^[^<]*<[^ \t]*[> \t]
+ // -------
+ // ^<!
+ //
+ // wobei der unterstrichene Teilausdruck einem HTML-Token
+ // ensprechen muss
+
+ ByteString sCmp;
+ BOOL bUCS2B = FALSE;
+ if( bSwitchToUCS2 )
+ {
+ if( 0xfeU == (sal_Char)pHeader[0] &&
+ 0xffU == (sal_Char)pHeader[1] )
+ {
+ eEnc = RTL_TEXTENCODING_UCS2;
+ bUCS2B = TRUE;
+ }
+ else if( 0xffU == (sal_Char)pHeader[0] &&
+ 0xfeU == (sal_Char)pHeader[1] )
+ {
+ eEnc = RTL_TEXTENCODING_UCS2;
+ }
+ }
+ if( RTL_TEXTENCODING_UCS2 == eEnc &&
+ (0xfe == (sal_Char)pHeader[0] && 0xff == (sal_Char)pHeader[1]) ||
+ (0xff == (sal_Char)pHeader[0] && 0xfe == (sal_Char)pHeader[1]) )
+ {
+ if( 0xfe == (sal_Char)pHeader[0] )
+ bUCS2B = TRUE;
+
+ sal_uInt32 nLen;
+ for( nLen = 2UL;
+ pHeader[nLen] != 0 || pHeader[nLen+1UL] != 0;
+ nLen+=2 )
+ ;
+
+ ::rtl::OStringBuffer sTmp( (nLen - 2UL)/2UL );
+ for( sal_uInt32 nPos = 2UL; nPos < nLen; nPos += 2UL )
+ {
+ sal_Unicode cUC;
+ if( bUCS2B )
+ cUC = (sal_Unicode(pHeader[nPos]) << 8) | pHeader[nPos+1UL];
+ else
+ cUC = (sal_Unicode(pHeader[nPos+1UL]) << 8) | pHeader[nPos];
+ if( 0U == cUC )
+ break;
+
+ sTmp.append( cUC < 256U ? (sal_Char)cUC : '.' );
+ }
+ sCmp = ByteString( sTmp.makeStringAndClear() );
+ }
+ else
+ {
+ sCmp = (sal_Char *)pHeader;
+ }
+
+ sCmp.ToUpperAscii();
+
+ // Ein HTML-Dokument muss in der ersten Zeile ein '<' besitzen
+ sal_uInt32 nStart = sCmp.Search( '<' );
+ if( STRING_NOTFOUND == nStart )
+ return FALSE;
+ nStart++;
+
+ // danach duerfen beliebige andere Zeichen bis zu einem blank oder
+ // '>' kommen
+ sal_Char c;
+ sal_uInt32 nPos;
+ for( nPos = nStart; nPos<sCmp.Len(); nPos++ )
+ {
+ if( '>'==(c=sCmp.GetChar(nPos)) || HTML_ISSPACE(c) )
+ break;
+ }
+
+ // wenn das Dokeument hinter dem < aufhoert ist es wohl kein HTML
+ if( nPos==nStart )
+ return FALSE;
+
+ // die Zeichenkette nach dem '<' muss ausserdem ein bekanntes
+ // HTML Token sein. Damit die Ausgabe eines DOS-dir-Befehls nicht
+ // als HTML interpretiert wird, wird ein <DIR> jedoch nicht als HTML
+ // interpretiert.
+ String sTest( sCmp.Copy( nStart, nPos-nStart ), RTL_TEXTENCODING_ASCII_US );
+ int nTok = GetHTMLToken( sTest );
+ if( 0 != nTok && HTML_DIRLIST_ON != nTok )
+ return TRUE;
+
+ // oder es handelt sich um ein "<!" ganz am Anfang der Datei (fix #27092#)
+ if( nStart == 1UL && '!' == sCmp.GetChar( 1UL ) )
+ return TRUE;
+
+ // oder wir finden irgendwo ein <HTML> in den ersten 80 Zeichen
+ nStart = sCmp.Search( sHTML_html );
+ if( nStart!=STRING_NOTFOUND &&
+ nStart>0UL && '<'==sCmp.GetChar(nStart-1UL) &&
+ nStart+4UL < sCmp.Len() && '>'==sCmp.GetChar(nStart+4UL) )
+ return TRUE;
+
+ // sonst ist es wohl doch eher kein HTML-Dokument
+ return FALSE;
+}
+
+BOOL HTMLParser::InternalImgToPrivateURL( String& rURL )
+{
+ if( rURL.Len() < 19UL || 'i' != rURL.GetChar(0UL) ||
+ rURL.CompareToAscii( sHTML_internal_gopher, 9UL ) != COMPARE_EQUAL )
+ return FALSE;
+
+ BOOL bFound = FALSE;
+
+ if( rURL.CompareToAscii( sHTML_internal_gopher,16UL) == COMPARE_EQUAL )
+ {
+ String aName( rURL.Copy(16UL) );
+ switch( aName.GetChar(0UL) )
+ {
+ case 'b':
+ bFound = aName.EqualsAscii( sHTML_INT_GOPHER_binary );
+ break;
+ case 'i':
+ bFound = aName.EqualsAscii( sHTML_INT_GOPHER_image ) ||
+ aName.EqualsAscii( sHTML_INT_GOPHER_index );
+ break;
+ case 'm':
+ bFound = aName.EqualsAscii( sHTML_INT_GOPHER_menu ) ||
+ aName.EqualsAscii( sHTML_INT_GOPHER_movie );
+ break;
+ case 's':
+ bFound = aName.EqualsAscii( sHTML_INT_GOPHER_sound );
+ break;
+ case 't':
+ bFound = aName.EqualsAscii( sHTML_INT_GOPHER_telnet ) ||
+ aName.EqualsAscii( sHTML_INT_GOPHER_text );
+ break;
+ case 'u':
+ bFound = aName.EqualsAscii( sHTML_INT_GOPHER_unknown );
+ break;
+ }
+ }
+ else if( rURL.CompareToAscii( sHTML_internal_icon,14UL) == COMPARE_EQUAL )
+ {
+ String aName( rURL.Copy(14UL) );
+ switch( aName.GetChar(0UL) )
+ {
+ case 'b':
+ bFound = aName.EqualsAscii( sHTML_INT_ICON_baddata );
+ break;
+ case 'd':
+ bFound = aName.EqualsAscii( sHTML_INT_ICON_delayed );
+ break;
+ case 'e':
+ bFound = aName.EqualsAscii( sHTML_INT_ICON_embed );
+ break;
+ case 'i':
+ bFound = aName.EqualsAscii( sHTML_INT_ICON_insecure );
+ break;
+ case 'n':
+ bFound = aName.EqualsAscii( sHTML_INT_ICON_notfound );
+ break;
+ }
+ }
+ if( bFound )
+ {
+ String sTmp ( rURL );
+ rURL.AssignAscii( sHTML_private_image );
+ rURL.Append( sTmp );
+ }
+
+ return bFound;
+}
+
+
+#ifdef USED
+void HTMLParser::SaveState( int nToken )
+{
+ SvParser::SaveState( nToken );
+}
+
+void HTMLParser::RestoreState()
+{
+ SvParser::RestoreState();
+}
+#endif
+
diff --git a/svtools/source/svrtf/makefile.mk b/svtools/source/svrtf/makefile.mk
new file mode 100644
index 000000000000..ca7c598ef083
--- /dev/null
+++ b/svtools/source/svrtf/makefile.mk
@@ -0,0 +1,105 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=svrtf
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+CXXFILES = \
+ svparser.cxx \
+ parrtf.cxx \
+ rtfout.cxx \
+ rtfkeywd.cxx \
+ rtfkey2.cxx
+
+OBJFILES = $(OBJ)$/rtfkey2.obj
+
+SLOFILES = \
+ $(SLO)$/svparser.obj \
+ $(SLO)$/parrtf.obj \
+ $(SLO)$/rtfout.obj \
+ $(SLO)$/rtfkeywd.obj \
+ $(SLO)$/rtfkey2.obj
+
+# nur damit's was zum builden gibt
+LIB2TARGET =$(LB)$/svrtfk2.lib
+LIB2OBJFILES =$(OBJFILES)
+
+.ENDIF
+
+# ==========================================================================
+
+
+.INCLUDE : target.mk
+
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
new file mode 100644
index 000000000000..c5da72a9cbf5
--- /dev/null
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -0,0 +1,591 @@
+/*************************************************************************
+ *
+ * $RCSfile: parrtf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h> // for EOF
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#include "rtftoken.h"
+#include "rtfkeywd.hxx"
+#include "parrtf.hxx"
+
+const int MAX_STRING_LEN = 1024;
+const int MAX_TOKEN_LEN = 128;
+
+#define RTF_ISDIGIT( c ) (c >= '0' && c <= '9')
+#define RTF_ISALPHA( c ) ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') )
+
+SvRTFParser::SvRTFParser( SvStream& rIn, BYTE nStackSize )
+ : SvParser( rIn, nStackSize ),
+ eUNICodeSet( RTL_TEXTENCODING_MS_1252 ) // default ist ANSI-CodeSet
+{
+ // default ist ANSI-CodeSet
+ SetSrcEncoding( RTL_TEXTENCODING_MS_1252 );
+ bRTF_InTextRead = FALSE;
+}
+
+SvRTFParser::~SvRTFParser()
+{
+}
+
+int SvRTFParser::_GetNextToken()
+{
+ int nRet = 0;
+ do {
+ int bNextCh = TRUE;
+ switch( nNextCh )
+ {
+ case '\\':
+ {
+ // Steuerzeichen
+ switch( nNextCh = GetNextChar() )
+ {
+ case '{':
+ case '}':
+ case '\\':
+ aToken = nNextCh;
+ goto ISCHAR_SCANTEXT;
+ case '~': // nonbreaking space
+ aToken = 0xA0;
+ goto ISCHAR_SCANTEXT;
+ case '-': // optional hyphen
+ aToken = 0xAD;
+ goto ISCHAR_SCANTEXT;
+ case '_': // nonbreaking hyphen
+ aToken = 0x2011;
+ goto ISCHAR_SCANTEXT;
+
+ case '\'': // HexValue
+ // es folgt normaler Text
+ aToken = ByteString::ConvertToUnicode( GetHexValue(),
+ GetSrcEncoding() );
+ISCHAR_SCANTEXT:
+ nNextCh = GetNextChar();
+ ScanText();
+ nRet = RTF_TEXTTOKEN;
+ bNextCh = 0 == nNextCh;
+ break;
+
+ case '*': // ignoreflag
+ nRet = RTF_IGNOREFLAG;
+ break;
+ case ':': // subentry in an index entry
+ nRet = RTF_SUBENTRYINDEX;
+ break;
+ case '|': // formula-charakter
+ nRet = RTF_FORMULA;
+ break;
+
+ case 0x0a:
+ case 0x0d:
+ nRet = RTF_PAR;
+ break;
+
+ default:
+ if( RTF_ISALPHA( nNextCh ) )
+ {
+ aToken = '\\';
+ {
+ String aStrBuffer;
+ sal_Unicode* pStr = aStrBuffer.AllocBuffer(
+ MAX_TOKEN_LEN );
+ int nStrLen = 0;
+ do {
+ *(pStr + nStrLen++) = ByteString::
+ ConvertToUnicode( nNextCh,
+ GetSrcEncoding() );
+ if( MAX_TOKEN_LEN == nStrLen )
+ {
+ aToken += aStrBuffer;
+ aToken.GetBufferAccess(); // make unique string!
+ nStrLen = 0;
+ }
+ nNextCh = GetNextChar();
+ } while( RTF_ISALPHA( nNextCh ) );
+ if( nStrLen )
+ {
+ aStrBuffer.ReleaseBufferAccess( nStrLen );
+ aToken += aStrBuffer;
+ }
+ }
+
+ // Minus fuer numerischen Parameter
+ int bNegValue = FALSE;
+ if( '-' == nNextCh )
+ {
+ bNegValue = TRUE;
+ nNextCh = GetNextChar();
+ }
+
+ // evt. Numerischer Parameter
+ if( RTF_ISDIGIT( nNextCh ) )
+ {
+ nTokenValue = 0;
+ do {
+ nTokenValue *= 10;
+ nTokenValue += nNextCh - '0';
+ nNextCh = GetNextChar();
+ } while( RTF_ISDIGIT( nNextCh ) );
+ if( bNegValue )
+ nTokenValue = -nTokenValue;
+ }
+ else if( bNegValue ) // das Minus wieder zurueck
+ {
+ nNextCh = '-';
+ rInput.SeekRel( -1 );
+ }
+ if( ' ' == nNextCh ) // Blank gehoert zum Token!
+ nNextCh = GetNextChar();
+
+ // suche das Token in der Tabelle:
+ if( 0 == (nRet = GetRTFToken( aToken )) )
+ // Unknown Control
+ nRet = RTF_UNKNOWNCONTROL;
+
+ // bug 76812 - unicode token handled as normal text
+ if( !bRTF_InTextRead && RTF_U == nRet )
+ {
+ nRet = RTF_TEXTTOKEN;
+ aToken = (sal_Unicode)nTokenValue;
+
+ // das naechste Zeichen noch ueberlesen
+ // JP 10.12.98: das kann auch ein \{, \}, \'88 sein!
+ sal_Unicode cAnsi = nNextCh;
+ while( 0xD == cAnsi )
+ cAnsi = GetNextChar();
+ while( 0xA == cAnsi )
+ cAnsi = GetNextChar();
+
+ if( '\\' == cAnsi &&
+ '\'' == ( cAnsi = GetNextChar() ))
+ // HexValue ueberlesen
+ cAnsi = GetHexValue();
+
+ // the next char must be read
+ bNextCh = TRUE;
+ break;
+ }
+ }
+ else if( SVPAR_PENDING != eState )
+ {
+ // Bug 34631 - "\ " ueberlesen - Blank als Zeichen
+ // eState = SVPAR_ERROR;
+ }
+
+ bNextCh = FALSE;
+ break;
+ }
+ }
+ break;
+
+ case sal_Unicode(EOF):
+ eState = SVPAR_ACCEPTED;
+ nRet = nNextCh;
+ break;
+
+ case '{':
+ ++nOpenBrakets;
+ nRet = nNextCh;
+ break;
+
+ case '}':
+ --nOpenBrakets;
+ nRet = nNextCh;
+ break;
+
+ case 0x0d:
+ case 0x0a:
+ break;
+
+ default:
+ // es folgt normaler Text
+ ScanText();
+ nRet = RTF_TEXTTOKEN;
+ bNextCh = 0 == nNextCh;
+ break;
+ }
+
+ if( bNextCh )
+ nNextCh = GetNextChar();
+
+ } while( !nRet && SVPAR_WORKING == eState );
+ return nRet;
+}
+
+
+sal_Unicode SvRTFParser::GetHexValue()
+{
+ // Hex-Wert sammeln
+ register int n;
+ register sal_Unicode nHexVal = 0;
+
+ for( n = 0; n < 2; ++n )
+ {
+ nHexVal *= 16;
+ nNextCh = GetNextChar();
+ if( nNextCh >= '0' && nNextCh <= '9' )
+ nHexVal += (nNextCh - 48);
+ else if( nNextCh >= 'a' && nNextCh <= 'f' )
+ nHexVal += (nNextCh - 87);
+ else if( nNextCh >= 'A' && nNextCh <= 'F' )
+ nHexVal += (nNextCh - 55);
+ }
+ return nHexVal;
+}
+
+void SvRTFParser::ScanText( const sal_Unicode cBreak )
+{
+ String aStrBuffer;
+ sal_Unicode* pStr = aStrBuffer.AllocBuffer( MAX_STRING_LEN );
+ int nStrLen = 0;
+ int bWeiter = TRUE;
+ while( bWeiter && IsParserWorking() )
+ {
+ int bNextCh = TRUE;
+ switch( nNextCh )
+ {
+ case '\\':
+ {
+ switch( nNextCh = GetNextChar() )
+ {
+ case '\'':
+ *(pStr + nStrLen++) = ByteString::ConvertToUnicode(
+ GetHexValue(), GetSrcEncoding() );
+ break;
+
+ case '\\':
+ case '}':
+ case '{':
+ case '+': // habe ich in einem RTF-File gefunden
+ *(pStr + nStrLen++) = (sal_Char)nNextCh;
+ break;
+ case '~': // nonbreaking space
+ *(pStr + nStrLen++) = 0xA0;
+ break;
+ case '-': // optional hyphen
+ *(pStr + nStrLen++) = 0xAD;
+ break;
+ case '_': // nonbreaking hyphen
+ *(pStr + nStrLen++) = 0x2011;
+ break;
+
+ case 'u':
+ // UNI-Code Zeichen lesen
+ {
+ nNextCh = GetNextChar();
+ rInput.SeekRel( -2 );
+
+ if( '-' == nNextCh || RTF_ISDIGIT( nNextCh ) )
+ {
+ bRTF_InTextRead = TRUE;
+
+ String sSave( aToken );
+ nNextCh = '\\';
+ int nToken = _GetNextToken();
+ DBG_ASSERT( RTF_U == nToken, "doch kein UNI-Code Zeichen" );
+ // dont convert symbol chars
+ *(pStr + nStrLen++) = (sal_Unicode)nTokenValue;
+
+ // das naechste Zeichen noch ueberlesen
+ // JP 10.12.98: das kann auch ein \{, \}, \'88 sein!
+ sal_Unicode cAnsi = nNextCh;
+ while( 0xD == cAnsi )
+ cAnsi = GetNextChar();
+ while( 0xA == cAnsi )
+ cAnsi = GetNextChar();
+
+ if( '\\' == cAnsi &&
+ '\'' == ( cAnsi = GetNextChar() ))
+ // HexValue ueberlesen
+ cAnsi = GetHexValue();
+
+ aToken = sSave;
+ bRTF_InTextRead = FALSE;
+ }
+ else
+ {
+ nNextCh = '\\';
+ bWeiter = FALSE; // Abbrechen, String zusammen
+ }
+ }
+ break;
+
+ default:
+ rInput.SeekRel( -1 );
+ nNextCh = '\\';
+ bWeiter = FALSE; // Abbrechen, String zusammen
+ break;
+ }
+ }
+ break;
+
+ case sal_Unicode(EOF):
+ eState = SVPAR_ERROR;
+ // weiter
+ case '{':
+ case '}':
+ bWeiter = FALSE;
+ break;
+
+ case 0x0a:
+ case 0x0d:
+ break;
+
+ default:
+ if( nNextCh == cBreak ||
+ aToken.Len() >= ( STRING_MAXLEN - MAX_STRING_LEN ))
+ bWeiter = FALSE;
+ else
+ {
+ do {
+ // alle anderen Zeichen kommen in den Text
+ *(pStr + nStrLen++) = ByteString::ConvertToUnicode(
+ nNextCh, GetSrcEncoding() );
+
+ if( MAX_STRING_LEN == nStrLen )
+ {
+ aToken += aStrBuffer;
+ aToken.GetBufferAccess(); // make unique string!
+ nStrLen = 0;
+ if( aToken.Len() >=
+ ( STRING_MAXLEN - MAX_STRING_LEN ))
+ {
+ nNextCh = GetNextChar();
+ return;
+ }
+ }
+ if( sal_Unicode(EOF) == (nNextCh = GetNextChar() ))
+ {
+ if( nStrLen )
+ {
+ aStrBuffer.ReleaseBufferAccess( nStrLen );
+ aToken += aStrBuffer;
+ }
+ return;
+ }
+ } while( RTF_ISALPHA( nNextCh ) || RTF_ISDIGIT( nNextCh ) );
+ bNextCh = FALSE;
+ }
+ }
+
+ if( MAX_STRING_LEN == nStrLen )
+ {
+ aToken += aStrBuffer;
+ aToken.GetBufferAccess(); // make unique string!
+ nStrLen = 0;
+ }
+
+ if( bWeiter && bNextCh )
+ nNextCh = GetNextChar();
+ }
+ if( nStrLen )
+ {
+ aStrBuffer.ReleaseBufferAccess( nStrLen );
+ aToken += aStrBuffer;
+ }
+}
+
+
+void SvRTFParser::SkipGroup()
+{
+ short nBrackets = 1;
+ sal_Unicode cPrev = 0;
+ do {
+ switch( nNextCh )
+ {
+ case '{':
+ if( '\\' != cPrev )
+ ++nBrackets;
+ break;
+
+ case '}':
+ if( '\\' != cPrev && !--nBrackets )
+ return;
+ break;
+
+ case '\\':
+ if( '\\' == cPrev )
+ nNextCh = 0;
+ break;
+ }
+ cPrev = nNextCh;
+ nNextCh = GetNextChar();
+ } while( sal_Unicode(EOF) != nNextCh && IsParserWorking() );
+
+ if( SVPAR_PENDING != eState && '}' != nNextCh )
+ eState = SVPAR_ERROR;
+}
+
+void SvRTFParser::ReadUnknownData() { SkipGroup(); }
+void SvRTFParser::ReadBitmapData() { SkipGroup(); }
+void SvRTFParser::ReadOLEData() { SkipGroup(); }
+
+
+SvParserState SvRTFParser::CallParser()
+{
+ sal_Char cFirstCh;
+ rInput >> cFirstCh; nNextCh = cFirstCh;
+ eState = SVPAR_WORKING;
+ nOpenBrakets = 0;
+ SetSrcEncoding( RTL_TEXTENCODING_MS_1252 );
+ eUNICodeSet = RTL_TEXTENCODING_MS_1252; // default ist ANSI-CodeSet
+
+ // die 1. beiden Token muessen '{' und \\rtf sein !!
+ if( '{' == GetNextToken() && RTF_RTF == GetNextToken() )
+ {
+ AddRef();
+ Continue( 0 );
+ if( SVPAR_PENDING != eState )
+ ReleaseRef(); // dann brauchen wir den Parser nicht mehr!
+ }
+ else
+ eState = SVPAR_ERROR;
+
+ return eState;
+}
+
+void SvRTFParser::Continue( int nToken )
+{
+// DBG_ASSERT( SVPAR_CS_DONTKNOW == GetCharSet(),
+// "Zeichensatz wurde geaendert." );
+
+ if( !nToken )
+ nToken = GetNextToken();
+
+ while( IsParserWorking() )
+ {
+ SaveState( nToken );
+ switch( nToken )
+ {
+ case '}':
+ if( nOpenBrakets )
+ goto NEXTTOKEN;
+ eState = SVPAR_ACCEPTED;
+ break;
+
+ case '{':
+ // eine unbekannte Gruppe ?
+ {
+ if( RTF_IGNOREFLAG != GetNextToken() )
+ nToken = SkipToken( -1 );
+ else if( RTF_UNKNOWNCONTROL != GetNextToken() )
+ nToken = SkipToken( -2 );
+ else
+ {
+ // gleich herausfiltern
+ ReadUnknownData();
+ nToken = GetNextToken();
+ if( '}' != nToken )
+ eState = SVPAR_ERROR;
+ break; // auf zum naechsten Token!!
+ }
+ }
+ goto NEXTTOKEN;
+
+ case RTF_UNKNOWNCONTROL:
+ break; // unbekannte Token ueberspringen
+
+ case RTF_NEXTTYPE:
+ case RTF_ANSITYPE: SetSrcEncoding( RTL_TEXTENCODING_MS_1252 ); break;
+ case RTF_MACTYPE: SetSrcEncoding( RTL_TEXTENCODING_APPLE_ROMAN ); break;
+ case RTF_PCTYPE: SetSrcEncoding( RTL_TEXTENCODING_IBM_437 ); break;
+ case RTF_PCATYPE: SetSrcEncoding( RTL_TEXTENCODING_IBM_850 ); break;
+
+/*
+ case RTF_ANSICPG:
+ switch( nTokenValue )
+ {
+??? case 1252: SetUNICodeSet( CHARSET_ANSI ); break;
+ }
+ break;
+*/
+ default:
+NEXTTOKEN:
+ NextToken( nToken );
+ break;
+ }
+ if( IsParserWorking() )
+ SaveState( 0 ); // bis hierhin abgearbeitet,
+ // weiter mit neuem Token!
+ nToken = GetNextToken();
+ }
+ if( SVPAR_ACCEPTED == eState && 0 < nOpenBrakets )
+ eState = SVPAR_ERROR;
+}
+
+
+#ifdef USED
+void SvRTFParser::SaveState( int nToken )
+{
+ SvParser::SaveState( nToken );
+}
+
+void SvRTFParser::RestoreState()
+{
+ SvParser::RestoreState();
+}
+#endif
+
+
diff --git a/svtools/source/svrtf/rtfkey2.cxx b/svtools/source/svrtf/rtfkey2.cxx
new file mode 100644
index 000000000000..f77deed8ab94
--- /dev/null
+++ b/svtools/source/svrtf/rtfkey2.cxx
@@ -0,0 +1,1112 @@
+/*************************************************************************
+ *
+ * $RCSfile: rtfkey2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "rtfkeywd.hxx"
+
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEXCHAR, "\\'" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_IGNORE, "\\*" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OPTHYPH, "\\-" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SUBENTRY, "\\:" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ABSH, "\\absh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ABSW, "\\absw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ALT, "\\alt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ANNOTATION, "\\annotation" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ANSI, "\\ansi" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ATNID, "\\atnid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AUTHOR, "\\author" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_B, "\\b" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGBDIAG, "\\bgbdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGCROSS, "\\bgcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGDCROSS, "\\bgdcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGDKBDIAG, "\\bgdkbdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGDKCROSS, "\\bgdkcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGDKDCROSS, "\\bgdkdcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGDKFDIAG, "\\bgdkfdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGDKHORIZ, "\\bgdkhoriz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGDKVERT, "\\bgdkvert" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGFDIAG, "\\bgfdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGHORIZ, "\\bghoriz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BGVERT, "\\bgvert" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BIN, "\\bin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BINFSXN, "\\binfsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BINSXN, "\\binsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BKMKCOLF, "\\bkmkcolf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BKMKCOLL, "\\bkmkcoll" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BKMKEND, "\\bkmkend" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BKMKSTART, "\\bkmkstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BLUE, "\\blue" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BOX, "\\box" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRB, "\\brdrb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRBAR, "\\brdrbar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRBTW, "\\brdrbtw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRCF, "\\brdrcf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDB, "\\brdrdb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDOT, "\\brdrdot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRHAIR, "\\brdrhair" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRL, "\\brdrl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRR, "\\brdrr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRS, "\\brdrs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRSH, "\\brdrsh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRT, "\\brdrt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTH, "\\brdrth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRW, "\\brdrw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRSP, "\\brsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BULLET, "\\bullet" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BUPTIM, "\\buptim" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BXE, "\\bxe" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CAPS, "\\caps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CB, "\\cb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CBPAT, "\\cbpat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CELL, "\\cell" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CELLX, "\\cellx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CF, "\\cf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CFPAT, "\\cfpat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHATN, "\\chatn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHDATE, "\\chdate" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHDPA, "\\chdpa" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHDPL, "\\chdpl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHFTN, "\\chftn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHFTNSEP, "\\chftnsep" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHFTNSEPC, "\\chftnsepc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHPGN, "\\chpgn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHTIME, "\\chtime" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGBDIAG, "\\clbgbdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGCROSS, "\\clbgcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDCROSS, "\\clbgdcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKBDIAG, "\\clbgdkbdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKCROSS, "\\clbgdkcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKDCROSS, "\\clbgdkdcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKFDIAG, "\\clbgdkfdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKHOR, "\\clbgdkhor" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKVERT, "\\clbgdkvert" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGFDIAG, "\\clbgfdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGHORIZ, "\\clbghoriz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBGVERT, "\\clbgvert" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRB, "\\clbrdrb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRL, "\\clbrdrl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRR, "\\clbrdrr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRT, "\\clbrdrt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLCBPAT, "\\clcbpat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLCFPAT, "\\clcfpat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLMGF, "\\clmgf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLMRG, "\\clmrg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLSHDNG, "\\clshdng" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COLNO, "\\colno" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COLORTBL, "\\colortbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COLS, "\\cols" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COLSR, "\\colsr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COLSX, "\\colsx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COLUMN, "\\column" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COLW, "\\colw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COMMENT, "\\comment" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CREATIM, "\\creatim" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CTRL, "\\ctrl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DEFF, "\\deff" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DEFFORMAT, "\\defformat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DEFLANG, "\\deflang" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DEFTAB, "\\deftab" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DELETED, "\\deleted" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTX, "\\dfrmtxtx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTY, "\\dfrmtxty" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DIBITMAP, "\\dibitmap" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DN, "\\dn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOCCOMM, "\\doccomm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOCTEMP, "\\doctemp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DROPCAPLI, "\\dropcapli" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DROPCAPLT, "\\dropcapt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DXFRTEXT, "\\dxfrtext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DY, "\\dy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EDMINS, "\\edmins" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EMDASH, "\\emdash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ENDASH, "\\endash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ENDDOC, "\\enddoc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ENDNHERE, "\\endnhere" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ENDNOTES, "\\endnotes" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EXPND, "\\expnd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EXPNDTW, "\\expndtw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_F, "\\f" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FACINGP, "\\facingp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FACPGSXN, "\\facpgsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FALT, "\\falt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FCHARSET, "\\fcharset" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FDECOR, "\\fdecor" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FI, "\\fi" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FIELD, "\\field" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDDIRTY, "\\flddirty" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDEDIT, "\\fldedit" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDINST, "\\fldinst" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDLOCK, "\\fldlock" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDPRIV, "\\fldpriv" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDRSLT, "\\fldrslt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FMODERN, "\\fmodern" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FN, "\\fn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FNIL, "\\fnil" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FONTTBL, "\\fonttbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTER, "\\footer" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERF, "\\footerf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERL, "\\footerl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERR, "\\footerr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERY, "\\footery" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTNOTE, "\\footnote" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FPRQ, "\\fprq" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FRACWIDTH, "\\fracwidth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FROMAN, "\\froman" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FS, "\\fs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FSCRIPT, "\\fscript" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FSWISS, "\\fswiss" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTECH, "\\ftech" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNBJ, "\\ftnbj" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNCN, "\\ftncn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNRESTART, "\\ftnrestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNSEP, "\\ftnsep" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNSEPC, "\\ftnsepc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNSTART, "\\ftnstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNTJ, "\\ftntj" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GREEN, "\\green" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GUTTER, "\\gutter" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GUTTERSXN, "\\guttersxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADER, "\\header" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERF, "\\headerf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERL, "\\headerl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERR, "\\headerr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERY, "\\headery" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HR, "\\hr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHHOTZ, "\\hyphhotz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_I, "\\i" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ID, "\\id" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_INFO, "\\info" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_INTBL, "\\intbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_IXE, "\\ixe" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_KEEP, "\\keep" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_KEEPN, "\\keepn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_KERNING, "\\kerning" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_KEYCODE, "\\keycode" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_KEYWORDS, "\\keywords" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LANDSCAPE, "\\landscape" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LANG, "\\lang" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LDBLQUOTE, "\\ldblquote" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVEL, "\\level" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LI, "\\li" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINE, "\\line" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINEBETCOL, "\\linebetcol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINECONT, "\\linecont" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINEMOD, "\\linemod" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINEPPAGE, "\\lineppage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINERESTART, "\\linerestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINESTART, "\\linestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINESTARTS, "\\linestarts" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINEX, "\\linex" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LNDSCPSXN, "\\lndscpsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LQUOTE, "\\lquote" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MAC, "\\mac" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MACPICT, "\\macpict" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MAKEBACKUP, "\\makebackup" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGB, "\\margb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGBSXN, "\\margbsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGL, "\\margl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGLSXN, "\\marglsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGMIRROR, "\\margmirror" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGR, "\\margr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGRSXN, "\\margrsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGT, "\\margt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MARGTSXN, "\\margtsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MIN, "\\min" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MO, "\\mo" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NEXTCSET, "\\nextcset" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NEXTFILE, "\\nextfile" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOFCHARS, "\\nofchars" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOFPAGES, "\\nofpages" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOFWORDS, "\\nofwords" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOLINE, "\\noline" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOSUPERSUB, "\\nosupersub" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOWRAP, "\\nowrap" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OPERATOR, "\\operator" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OUTL, "\\outl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PAGE, "\\page" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PAGEBB, "\\pagebb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PAPERH, "\\paperh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PAPERW, "\\paperw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PAR, "\\par" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PARD, "\\pard" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PC, "\\pc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PCA, "\\pca" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGHSXN, "\\pghsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNCONT, "\\pgncont" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNDEC, "\\pgndec" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNLCLTR, "\\pgnlcltr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNLCRM, "\\pgnlcrm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNRESTART, "\\pgnrestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNSTART, "\\pgnstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNSTARTS, "\\pgnstarts" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNUCLTR, "\\pgnucltr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNUCRM, "\\pgnucrm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNX, "\\pgnx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNY, "\\pgny" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGWSXN, "\\pgwsxn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PHCOL, "\\phcol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PHMRG, "\\phmrg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PHPG, "\\phpg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPB, "\\piccropb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPL, "\\piccropl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPR, "\\piccropr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPT, "\\piccropt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICH, "\\pich" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICHGOAL, "\\pichgoal" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICSCALED, "\\picscaled" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICSCALEX, "\\picscalex" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICSCALEY, "\\picscaley" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICT, "\\pict" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICW, "\\picw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICWGOAL, "\\picwgoal" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PLAIN, "\\plain" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PMMETAFILE, "\\pmmetafile" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSNEGX, "\\posnegx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSNEGY, "\\posnegy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSX, "\\posx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSXC, "\\posxc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSXI, "\\posxi" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSXL, "\\posxl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSXO, "\\posxo" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSXR, "\\posxr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSY, "\\posy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSYB, "\\posyb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSYC, "\\posyc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSYIL, "\\posyil" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSYT, "\\posyt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PRINTIM, "\\printim" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PSOVER, "\\psover" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PVMRG, "\\pvmrg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PVPARA, "\\pvpara" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PVPG, "\\pvpg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_QC, "\\qc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_QJ, "\\qj" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_QL, "\\ql" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_QR, "\\qr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RDBLQUOTE, "\\rdblquote" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RED, "\\red" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVBAR, "\\revbar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVISED, "\\revised" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVISIONS, "\\revisions" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVPROP, "\\revprop" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVTIM, "\\revtim" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RI, "\\ri" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ROW, "\\row" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RQUOTE, "\\rquote" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RTF, "\\rtf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RXE, "\\rxe" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_S, "\\s" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SA, "\\sa" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SB, "\\sb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SBASEDON, "\\sbasedon" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SBKCOL, "\\sbkcol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SBKEVEN, "\\sbkeven" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SBKNONE, "\\sbknone" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SBKODD, "\\sbkodd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SBKPAGE, "\\sbkpage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SBYS, "\\sbys" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SCAPS, "\\scaps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECT, "\\sect" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTD, "\\sectd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHAD, "\\shad" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHADING, "\\shading" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHIFT, "\\shift" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SL, "\\sl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SNEXT, "\\snext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_STRIKE, "\\strike" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_STYLESHEET, "\\stylesheet" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SUB, "\\sub" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SUBJECT, "\\subject" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SUPER, "\\super" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TAB, "\\tab" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TB, "\\tb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TC, "\\tc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TCF, "\\tcf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TCL, "\\tcl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TEMPLATE, "\\template" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TITLE, "\\title" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TITLEPG, "\\titlepg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TLDOT, "\\tldot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TLEQ, "\\tleq" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TLHYPH, "\\tlhyph" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TLTH, "\\tlth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TLUL, "\\tlul" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TQC, "\\tqc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TQDEC, "\\tqdec" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TQR, "\\tqr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TQL, "\\tql" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRGAPH, "\\trgaph" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRLEFT, "\\trleft" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TROWD, "\\trowd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRQC, "\\trqc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRQL, "\\trql" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRQR, "\\trqr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRRH, "\\trrh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TX, "\\tx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TXE, "\\txe" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_UL, "\\ul" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULD, "\\uld" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULDB, "\\uldb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULNONE, "\\ulnone" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULW, "\\ulw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_UP, "\\up" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_V, "\\v" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VERN, "\\vern" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VERSION, "\\version" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VERTALB, "\\vertalb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VERTALC, "\\vertalc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VERTALJ, "\\vertalj" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VERTALT, "\\vertalt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WBITMAP, "\\wbitmap" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WBMBITSPIXEL, "\\wbmbitspixel" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WBMPLANES, "\\wbmplanes" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WBMWIDTHBYTES, "\\wbmwidthbytes" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WIDOWCTRL, "\\widowctrl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WMETAFILE, "\\wmetafile" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_XE, "\\xe" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_YR, "\\yr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOBRKHYPH, "\\_" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FORMULA, "\\|" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOBREAK, "\\~" );
+
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AB, "\\ab" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ACAPS, "\\acaps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ACF, "\\acf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ADDITIVE, "\\additive" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ADN, "\\adn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AENDDOC, "\\aenddoc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AENDNOTES, "\\aendnotes" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AEXPND, "\\aexpnd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AF, "\\af" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFS, "\\afs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNBJ, "\\aftnbj" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNCN, "\\aftncn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNALC, "\\aftnnalc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNAR, "\\aftnnar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNAUC, "\\aftnnauc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNCHI, "\\aftnnchi" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNRLC, "\\aftnnrlc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNRUC, "\\aftnnruc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNRESTART, "\\aftnrestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNRSTCONT, "\\aftnrstcont" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNSEP, "\\aftnsep" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNSEPC, "\\aftnsepc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNSTART, "\\aftnstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNTJ, "\\aftntj" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AI, "\\ai" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ALANG, "\\alang" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ALLPROT, "\\allprot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ANNOTPROT, "\\annotprot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AOUTL, "\\aoutl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ASCAPS, "\\ascaps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ASHAD, "\\ashad" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ASTRIKE, "\\astrike" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ATNAUTHOR, "\\atnauthor" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ATNICN, "\\atnicn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ATNREF, "\\atnref" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ATNTIME, "\\atntime" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ATRFEND, "\\atrfend" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ATRFSTART, "\\atrfstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AUL, "\\aul" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AULD, "\\auld" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AULDB, "\\auldb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AULNONE, "\\aulnone" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AULW, "\\aulw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AUP, "\\aup" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BKMKPUB, "\\bkmkpub" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASH, "\\brdrdash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRKFRM, "\\brkfrm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CCHS, "\\cchs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CPG, "\\cpg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CS, "\\cs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CVMME, "\\cvmme" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DATAFIELD, "\\datafield" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DO, "\\do" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOBXCOLUMN, "\\dobxcolumn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOBXMARGIN, "\\dobxmargin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOBXPAGE, "\\dobxpage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOBYMARGIN, "\\dobymargin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOBYPAGE, "\\dobypage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOBYPARA, "\\dobypara" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DODHGT, "\\dodhgt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOLOCK, "\\dolock" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDHOL, "\\dpaendhol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDL, "\\dpaendl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDSOL, "\\dpaendsol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDW, "\\dpaendw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPARC, "\\dparc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPARCFLIPX, "\\dparcflipx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPARCFLIPY, "\\dparcflipy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTHOL, "\\dpastarthol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTL, "\\dpastartl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTSOL, "\\dpastartsol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTW, "\\dpastartw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCALLOUT, "\\dpcallout" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOA, "\\dpcoa" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOACCENT, "\\dpcoaccent" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOBESTFIT, "\\dpcobestfit" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOBORDER, "\\dpcoborder" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCODABS, "\\dpcodabs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCODBOTTOM, "\\dpcodbottom" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCODCENTER, "\\dpcodcenter" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCODTOP, "\\dpcodtop" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOLENGTH, "\\dpcolength" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOMINUSX, "\\dpcominusx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOMINUSY, "\\dpcominusy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOOFFSET, "\\dpcooffset" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOSMARTA, "\\dpcosmarta" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTDOUBLE, "\\dpcotdouble" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTRIGHT, "\\dpcotright" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTSINGLE, "\\dpcotsingle" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTTRIPLE, "\\dpcottriple" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCOUNT, "\\dpcount" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPELLIPSE, "\\dpellipse" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPENDGROUP, "\\dpendgroup" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGCB, "\\dpfillbgcb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGCG, "\\dpfillbgcg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGCR, "\\dpfillbgcr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGGRAY, "\\dpfillbggray" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGPAL, "\\dpfillbgpal" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGCB, "\\dpfillfgcb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGCG, "\\dpfillfgcg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGCR, "\\dpfillfgcr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGGRAY, "\\dpfillfggray" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGPAL, "\\dpfillfgpal" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLPAT, "\\dpfillpat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPGROUP, "\\dpgroup" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINE, "\\dpline" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINECOB, "\\dplinecob" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINECOG, "\\dplinecog" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINECOR, "\\dplinecor" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDADO, "\\dplinedado" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDADODO, "\\dplinedadodo" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDASH, "\\dplinedash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDOT, "\\dplinedot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEGRAY, "\\dplinegray" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEHOLLOW, "\\dplinehollow" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEPAL, "\\dplinepal" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINESOLID, "\\dplinesolid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEW, "\\dplinew" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPPOLYCOUNT, "\\dppolycount" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPPOLYGON, "\\dppolygon" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPPOLYLINE, "\\dppolyline" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPPTX, "\\dpptx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPPTY, "\\dppty" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPRECT, "\\dprect" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPROUNDR, "\\dproundr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPSHADOW, "\\dpshadow" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPSHADX, "\\dpshadx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPSHADY, "\\dpshady" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPTXBX, "\\dptxbx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPTXBXMAR, "\\dptxbxmar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPTXBXTEXT, "\\dptxbxtext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPX, "\\dpx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPXSIZE, "\\dpxsize" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPY, "\\dpy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPYSIZE, "\\dpysize" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DS, "\\ds" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EMSPACE, "\\emspace" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ENSPACE, "\\enspace" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FBIDI, "\\fbidi" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FET, "\\fet" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FID, "\\fid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FILE, "\\file" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FILETBL, "\\filetbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDALT, "\\fldalt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FNETWORK, "\\fnetwork" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FONTEMB, "\\fontemb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FONTFILE, "\\fontfile" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FORMDISP, "\\formdisp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FORMPROT, "\\formprot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FORMSHADE, "\\formshade" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOSNUM, "\\fosnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FRELATIVE, "\\frelative" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNALT, "\\ftnalt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNIL, "\\ftnil" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNALC, "\\ftnnalc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNAR, "\\ftnnar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNAUC, "\\ftnnauc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNCHI, "\\ftnnchi" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNRLC, "\\ftnnrlc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNRUC, "\\ftnnruc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNRSTCONT, "\\ftnrstcont" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNRSTPG, "\\ftnrstpg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTTRUETYPE, "\\fttruetype" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDDOS, "\\fvaliddos" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDHPFS, "\\fvalidhpfs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDMAC, "\\fvalidmac" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDNTFS, "\\fvalidntfs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHAUTO, "\\hyphauto" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHCAPS, "\\hyphcaps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHCONSEC, "\\hyphconsec" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHPAR, "\\hyphpar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINKSELF, "\\linkself" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINKSTYLES, "\\linkstyles" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LTRCH, "\\ltrch" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LTRDOC, "\\ltrdoc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LTRMARK, "\\ltrmark" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LTRPAR, "\\ltrpar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LTRROW, "\\ltrrow" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LTRSECT, "\\ltrsect" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOCOLBAL, "\\nocolbal" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOEXTRASPRL, "\\noextrasprl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOTABIND, "\\notabind" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOWIDCTLPAR, "\\nowidctlpar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJALIAS, "\\objalias" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJALIGN, "\\objalign" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJAUTLINK, "\\objautlink" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJCLASS, "\\objclass" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPB, "\\objcropb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPL, "\\objcropl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPR, "\\objcropr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPT, "\\objcropt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJDATA, "\\objdata" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJECT, "\\object" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJEMB, "\\objemb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJH, "\\objh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJICEMB, "\\objicemb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJLINK, "\\objlink" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJLOCK, "\\objlock" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJNAME, "\\objname" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJPUB, "\\objpub" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJSCALEX, "\\objscalex" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJSCALEY, "\\objscaley" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJSECT, "\\objsect" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJSETSIZE, "\\objsetsize" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJSUB, "\\objsub" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJTIME, "\\objtime" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJTRANSY, "\\objtransy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJUPDATE, "\\objupdate" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJW, "\\objw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OTBLRUL, "\\otblrul" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNHN, "\\pgnhn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSC, "\\pgnhnsc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSH, "\\pgnhnsh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSM, "\\pgnhnsm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSN, "\\pgnhnsn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSP, "\\pgnhnsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICBMP, "\\picbmp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICBPP, "\\picbpp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PN, "\\pn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNACROSS, "\\pnacross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNB, "\\pnb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNCAPS, "\\pncaps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNCARD, "\\pncard" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNCF, "\\pncf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNDEC, "\\pndec" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNF, "\\pnf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNFS, "\\pnfs" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNHANG, "\\pnhang" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNI, "\\pni" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNINDENT, "\\pnindent" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNLCLTR, "\\pnlcltr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNLCRM, "\\pnlcrm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNLVL, "\\pnlvl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNLVLBLT, "\\pnlvlblt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNLVLBODY, "\\pnlvlbody" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNLVLCONT, "\\pnlvlcont" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNNUMONCE, "\\pnnumonce" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNORD, "\\pnord" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNORDT, "\\pnordt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNPREV, "\\pnprev" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNQC, "\\pnqc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNQL, "\\pnql" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNQR, "\\pnqr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRESTART, "\\pnrestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNSCAPS, "\\pnscaps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNSECLVL, "\\pnseclvl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNSP, "\\pnsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNSTART, "\\pnstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNSTRIKE, "\\pnstrike" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNTEXT, "\\pntext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNTXTA, "\\pntxta" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNTXTB, "\\pntxtb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNUCLTR, "\\pnucltr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNUCRM, "\\pnucrm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNUL, "\\pnul" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNULD, "\\pnuld" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNULDB, "\\pnuldb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNULNONE, "\\pnulnone" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNULW, "\\pnulw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PRCOLBL, "\\prcolbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PRINTDATA, "\\printdata" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PSZ, "\\psz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PUBAUTO, "\\pubauto" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RESULT, "\\result" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVAUTH, "\\revauth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVDTTM, "\\revdttm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVPROT, "\\revprot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVTBL, "\\revtbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RSLTBMP, "\\rsltbmp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RSLTMERGE, "\\rsltmerge" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RSLTPICT, "\\rsltpict" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RSLTRTF, "\\rsltrtf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RSLTTXT, "\\rslttxt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RTLCH, "\\rtlch" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RTLDOC, "\\rtldoc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RTLMARK, "\\rtlmark" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RTLPAR, "\\rtlpar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RTLROW, "\\rtlrow" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_RTLSECT, "\\rtlsect" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SEC, "\\sec" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTNUM, "\\sectnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTUNLOCKED, "\\sectunlocked" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SLMULT, "\\slmult" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SOFTCOL, "\\softcol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SOFTLHEIGHT, "\\softlheight" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SOFTLINE, "\\softline" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SOFTPAGE, "\\softpage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SPRSSPBF, "\\sprsspbf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SPRSTSP, "\\sprstsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SUBDOCUMENT, "\\subdocument" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SWPBDR, "\\swpbdr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TCN, "\\tcn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRANSMF, "\\transmf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRB, "\\trbrdrb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRH, "\\trbrdrh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRL, "\\trbrdrl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRR, "\\trbrdrr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRT, "\\trbrdrt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRV, "\\trbrdrv" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRHDR, "\\trhdr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRKEEP, "\\trkeep" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WRAPTRSP, "\\wraptrsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_XEF, "\\xef" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ZWJ, "\\zwj" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ZWNJ, "\\zwnj" );
+
+// neue Tokens zur 1.5
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ABSLOCK, "\\abslock" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ADJUSTRIGHT, "\\adjustright" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNCHOSUNG, "\\aftnnchosung" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNCNUM, "\\aftnncnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBAR, "\\aftnndbar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUM, "\\aftnndbnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUMD, "\\aftnndbnumd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUMK, "\\aftnndbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUMT, "\\aftnndbnumt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGANADA, "\\aftnnganada" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUM, "\\aftnngbnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUMD, "\\aftnngbnumd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUMK, "\\aftnngbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUML, "\\aftnngbnuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNZODIAC, "\\aftnnzodiac" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNZODIACD, "\\aftnnzodiacd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNZODIACL, "\\aftnnzodiacl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ANIMTEXT, "\\animtext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ANSICPG, "\\ansicpg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BACKGROUND, "\\background" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BDBFHDR, "\\bdbfhdr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BLIPTAG, "\\bliptag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BLIPUID, "\\blipuid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BLIPUPI, "\\blipupi" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRART, "\\brdrart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHD, "\\brdrdashd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHDD, "\\brdrdashdd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHDOTSTR, "\\brdrdashdotstr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHSM, "\\brdrdashsm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDREMBOSS, "\\brdremboss" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRENGRAVE, "\\brdrengrave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRFRAME, "\\brdrframe" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTHTNLG, "\\brdrthtnlg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTHTNMG, "\\brdrthtnmg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTHTNSG, "\\brdrthtnsg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHLG, "\\brdrtnthlg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHMG, "\\brdrtnthmg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHSG, "\\brdrtnthsg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHTNLG, "\\brdrtnthtnlg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHTNMG, "\\brdrtnthtnmg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHTNSG, "\\brdrtnthtnsg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTRIPLE, "\\brdrtriple" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRWAVY, "\\brdrwavy" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDRWAVYDB, "\\brdrwavydb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CATEGORY, "\\category" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CGRID, "\\cgrid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHARSCALEX, "\\charscalex" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGBDIAG, "\\chbgbdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGCROSS, "\\chbgcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDCROSS, "\\chbgdcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKBDIAG, "\\chbgdkbdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKCROSS, "\\chbgdkcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKDCROSS, "\\chbgdkdcross" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKFDIAG, "\\chbgdkfdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKHORIZ, "\\chbgdkhoriz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKVERT, "\\chbgdkvert" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGFDIAG, "\\chbgfdiag" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGHORIZ, "\\chbghoriz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBGVERT, "\\chbgvert" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHBRDR, "\\chbrdr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHCBPAT, "\\chcbpat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHCFPAT, "\\chcfpat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CHSHDNG, "\\chshdng" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLTXLRTB, "\\cltxlrtb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLTXTBRL, "\\cltxtbrl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLVERTALB, "\\clvertalb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLVERTALC, "\\clvertalc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLVERTALT, "\\clvertalt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLVMGF, "\\clvmgf" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLVMRG, "\\clvmrg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLTXTBRLV, "\\cltxtbrlv" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLTXBTLR, "\\cltxbtlr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CLTXLRTBV, "\\cltxlrtbv" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_COMPANY, "\\company" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CRAUTH, "\\crauth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_CRDATE, "\\crdate" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DATE, "\\date" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DEFLANGFE, "\\deflangfe" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRAUTH, "\\dfrauth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRDATE, "\\dfrdate" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRSTART, "\\dfrstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRSTOP, "\\dfrstop" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRXST, "\\dfrxst" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DGMARGIN, "\\dgmargin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DNTBLNSBDB, "\\dntblnsbdb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOCTYPE, "\\doctype" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DOCVAR, "\\docvar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DPCODESCENT, "\\dpcodescent" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EMBO, "\\embo" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EMFBLIP, "\\emfblip" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_EXPSHRTN, "\\expshrtn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FAAUTO, "\\faauto" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FBIAS, "\\fbias" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFDEFRES, "\\ffdefres" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFDEFTEXT, "\\ffdeftext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFENTRYMCR, "\\ffentrymcr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFEXITMCR, "\\ffexitmcr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFFORMAT, "\\ffformat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFHASLISTBOX, "\\ffhaslistbox" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFHELPTEXT, "\\ffhelptext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFHPS, "\\ffhps" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFL, "\\ffl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFMAXLEN, "\\ffmaxlen" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFNAME, "\\ffname" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFOWNHELP, "\\ffownhelp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFOWNSTAT, "\\ffownstat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFPROT, "\\ffprot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFRECALC, "\\ffrecalc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFRES, "\\ffres" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFSIZE, "\\ffsize" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFSTATTEXT, "\\ffstattext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFTYPE, "\\fftype" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FFTYPETXT, "\\fftypetxt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLDTYPE, "\\fldtype" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FNAME, "\\fname" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FORMFIELD, "\\formfield" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FROMTEXT, "\\fromtext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNCHOSUNG, "\\ftnnchosung" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNCNUM, "\\ftnncnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBAR, "\\ftnndbar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUM, "\\ftnndbnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUMD, "\\ftnndbnumd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUMK, "\\ftnndbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUMT, "\\ftnndbnumt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGANADA, "\\ftnnganada" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUM, "\\ftnngbnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUMD, "\\ftnngbnumd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUMK, "\\ftnngbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUML, "\\ftnngbnuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNZODIAC, "\\ftnnzodiac" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNZODIACD, "\\ftnnzodiacd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FTNNZODIACL, "\\ftnnzodiacl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_G, "\\g" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GCW, "\\gcw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GRIDTBL, "\\gridtbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HIGHLIGHT, "\\highlight" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HLFR, "\\hlfr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HLINKBASE, "\\hlinkbase" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HLLOC, "\\hlloc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HLSRC, "\\hlsrc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ILVL, "\\ilvl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_IMPR, "\\impr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_JPEGBLIP, "\\jpegblip" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELFOLLOW, "\\levelfollow" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELINDENT, "\\levelindent" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELJC, "\\leveljc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELLEGAL, "\\levellegal" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELNFC, "\\levelnfc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELNORESTART, "\\levelnorestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELNUMBERS, "\\levelnumbers" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELOLD, "\\levelold" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELPREV, "\\levelprev" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELPREVSPACE, "\\levelprevspace" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELSPACE, "\\levelspace" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELSTARTAT, "\\levelstartat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LEVELTEXT, "\\leveltext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LINKVAL, "\\linkval" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LIST, "\\list" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTID, "\\listid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTLEVEL, "\\listlevel" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTNAME, "\\listname" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDE, "\\listoverride" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDECOUNT, "\\listoverridecount" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDEFORMAT, "\\listoverrideformat" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDESTART, "\\listoverridestart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDETABLE, "\\listoverridetable" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTRESTARTHDN, "\\listrestarthdn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTSIMPLE, "\\listsimple" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTTABLE, "\\listtable" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTTEMPLATEID, "\\listtemplateid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LISTTEXT, "\\listtext" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LS, "\\ls" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LYTEXCTTP, "\\lytexcttp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LYTPRTMET, "\\lytprtmet" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MANAGER, "\\manager" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_MSMCAP, "\\msmcap" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOFCHARSWS, "\\nofcharsws" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOLEAD, "\\nolead" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NONSHPPICT, "\\nonshppict" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOSECTEXPAND, "\\nosectexpand" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOSNAPLINEGRID, "\\nosnaplinegrid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOSPACEFORUL, "\\nospaceforul" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOULTRLSPC, "\\noultrlspc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_NOXLATTOYEN, "\\noxlattoyen" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJATTPH, "\\objattph" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJHTML, "\\objhtml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OBJOCX, "\\objocx" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OLDLINEWRAP, "\\oldlinewrap" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OUTLINELEVEL, "\\outlinelevel" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_OVERLAY, "\\overlay" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PANOSE, "\\panose" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRB, "\\pgbrdrb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRFOOT, "\\pgbrdrfoot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRHEAD, "\\pgbrdrhead" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRL, "\\pgbrdrl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDROPT, "\\pgbrdropt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRR, "\\pgbrdrr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRSNAP, "\\pgbrdrsnap" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRT, "\\pgbrdrt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNCHOSUNG, "\\pgnchosung" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNCNUM, "\\pgncnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNDBNUMK, "\\pgndbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNDBNUMT, "\\pgndbnumt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNGANADA, "\\pgnganada" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUM, "\\pgngbnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUMD, "\\pgngbnumd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUMK, "\\pgngbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUML, "\\pgngbnuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNZODIAC, "\\pgnzodiac" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNZODIACD, "\\pgnzodiacd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGNZODIACL, "\\pgnzodiacl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PICPROP, "\\picprop" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNAIUEO, "\\pnaiueo" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNAIUEOD, "\\pnaiueod" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNCHOSUNG, "\\pnchosung" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUMD, "\\pndbnumd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUMK, "\\pndbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUML, "\\pndbnuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUMT, "\\pndbnumt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNGANADA, "\\pnganada" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNGBLIP, "\\pngblip" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUM, "\\pngbnum" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUMD, "\\pngbnumd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUMK, "\\pngbnumk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUML, "\\pngbnuml" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRAUTH, "\\pnrauth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRDATE, "\\pnrdate" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRNFC, "\\pnrnfc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRNOT, "\\pnrnot" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRPNBR, "\\pnrpnbr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRRGB, "\\pnrrgb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRSTART, "\\pnrstart" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRSTOP, "\\pnrstop" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNRXST, "\\pnrxst" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNZODIAC, "\\pnzodiac" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNZODIACD, "\\pnzodiacd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PNZODIACL, "\\pnzodiacl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_LFOLEVEL, "\\lfolevel" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSYIN, "\\posyin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_POSYOUT, "\\posyout" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PRIVATE, "\\private" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PROPNAME, "\\propname" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PROPTYPE, "\\proptype" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVAUTHDEL, "\\revauthdel" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_REVDTTMDEL, "\\revdttmdel" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SAUTOUPD, "\\sautoupd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTDEFAULTCL, "\\sectdefaultcl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTEXPAND, "\\sectexpand" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTLINEGRID, "\\sectlinegrid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTSPECIFYCL, "\\sectspecifycl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SECTSPECIFYL, "\\sectspecifyl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHIDDEN, "\\shidden" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPBOTTOM, "\\shpbottom" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPBXCOLUMN, "\\shpbxcolumn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPBXMARGIN, "\\shpbxmargin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPBXPAGE, "\\shpbxpage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPBYMARGIN, "\\shpbymargin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPBYPAGE, "\\shpbypage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPBYPARA, "\\shpbypara" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPFBLWTXT, "\\shpfblwtxt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPFHDR, "\\shpfhdr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPGRP, "\\shpgrp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPLEFT, "\\shpleft" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPLID, "\\shplid" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPLOCKANCHOR, "\\shplockanchor" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPPICT, "\\shppict" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPRIGHT, "\\shpright" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPRSLT, "\\shprslt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPTOP, "\\shptop" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPTXT, "\\shptxt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPWRK, "\\shpwrk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPWR, "\\shpwr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHPZ, "\\shpz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SPRSBSP, "\\sprsbsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SPRSLNSP, "\\sprslnsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SPRSTSM, "\\sprstsm" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_STATICVAL, "\\staticval" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_STEXTFLOW, "\\stextflow" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_STRIKEDL, "\\strikedl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SUBFONTBYSIZE, "\\subfontbysize" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TCELLD, "\\tcelld" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TIME, "\\time" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TRUNCATEFONTHEIGHT, "\\truncatefontheight" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_UC, "\\uc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_UD, "\\ud" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULDASH, "\\uldash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULDASHD, "\\uldashd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULDASHDD, "\\uldashdd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULTH, "\\ulth" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULWAVE, "\\ulwave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_U, "\\u" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_UPR, "\\upr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_USERPROPS, "\\userprops" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VIEWKIND, "\\viewkind" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VIEWSCALE, "\\viewscale" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_VIEWZK, "\\viewzk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WIDCTLPAR, "\\widctlpar" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WINDOWCAPTION, "\\windowcaption" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WPEQN, "\\wpeqn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WPJST, "\\wpjst" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_WPSP, "\\wpsp" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_YXE, "\\yxe" );
+
+// MS-2000 Tokens
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULTHD, "\\ulthd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULTHDASH, "\\ulthdash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULLDASH, "\\ulldash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULTHLDASH, "\\ulthldash" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULTHDASHD, "\\ulthdashd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULTHDASHDD, "\\ulthdashdd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULHWAVE, "\\ulhwave" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_ULULDBWAVE, "\\ululdbwave" );
+
+// SWG spezifische Attribute
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GRFALIGNV, "\\grfalignv" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GRFALIGNH, "\\grfalignh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_GRFMIRROR, "\\grfmirror" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERYB, "\\headeryb" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERXL, "\\headerxl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERXR, "\\headerxr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERYT, "\\footeryt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERXL, "\\footerxl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERXR, "\\footerxr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HEADERYH, "\\headeryh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERYH, "\\footeryh" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BALANCEDCOLUMN, "\\swcolmnblnc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_UPDNPROP, "\\updnprop" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PRTDATA, "\\prtdata" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BKMKKEY, "\\bkmkkey" );
+
+// Attribute fuer die freifliegenden Rahmen
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYPRINT, "\\flyprint" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYOPAQUE, "\\flyopaque" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYPRTCTD, "\\flyprtctd" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYMAINCNT, "\\flymaincnt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYVERT, "\\flyvert" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYHORZ, "\\flyhorz" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTL, "\\dfrmtxtl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTR, "\\dfrmtxtr" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTU, "\\dfrmtxtu" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTW, "\\dfrmtxtw" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYANCHOR, "\\flyanchor" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYCNTNT, "\\flycntnt" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYCOLUMN, "\\flycolumn" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYPAGE, "\\flypage" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_FLYINPARA, "\\flyinpara" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDBOX, "\\brdbox" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNCOL, "\\brdlncol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNIN, "\\brdlnin" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNOUT, "\\brdlnout" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNDIST, "\\brdlndist" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHADOW, "\\shadow" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHDWDIST, "\\shdwdist" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHDWSTYLE, "\\shdwstyle" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHDWCOL, "\\shdwcol" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SHDWFCOL, "\\shdwfcol" );
+
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCTBL, "\\pgdsctbl" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGDSC, "\\pgdsc" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCUSE, "\\pgdscuse" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCNXT, "\\pgdscnxt" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHEN, "\\hyphen" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHLEAD, "\\hyphlead" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHTRAIL, "\\hyphtrail" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_HYPHMAX, "\\hyphmax" );
+
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_TLSWG, "\\tlswg" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGBRK, "\\pgbrk" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCNO, "\\pgdscno" );
+sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sRTF_SOUTLVL, "\\soutlvl" );
+
diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx
new file mode 100644
index 000000000000..d9daee909e6e
--- /dev/null
+++ b/svtools/source/svrtf/rtfkeywd.cxx
@@ -0,0 +1,1198 @@
+/*************************************************************************
+ *
+ * $RCSfile: rtfkeywd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+
+#include "rtfkeywd.hxx"
+#include "rtftoken.h"
+
+// die Tabelle muss noch sortiert werden
+struct RTF_TokenEntry
+{
+ union{
+ const sal_Char* sToken;
+ const String* pUToken;
+ };
+ int nToken;
+};
+
+// Flag: RTF-Token Tabelle wurde schon sortiert
+static int __FAR_DATA bSortKeyWords = FALSE;
+
+static RTF_TokenEntry __FAR_DATA aRTFTokenTab[] = {
+sRTF_IGNORE, RTF_IGNOREFLAG,
+sRTF_RTF, RTF_RTF,
+sRTF_ANSI, RTF_ANSITYPE,
+sRTF_MAC, RTF_MACTYPE,
+sRTF_PC, RTF_PCTYPE,
+sRTF_PCA, RTF_PCATYPE,
+sRTF_NEXTCSET, RTF_NEXTTYPE,
+sRTF_STYLESHEET, RTF_STYLESHEET,
+sRTF_SBASEDON, RTF_SBASEDON,
+sRTF_SNEXT, RTF_SNEXT,
+sRTF_FONTTBL, RTF_FONTTBL,
+sRTF_DEFF, RTF_DEFF,
+sRTF_FNIL, RTF_FNIL,
+sRTF_FROMAN, RTF_FROMAN,
+sRTF_FSWISS, RTF_FSWISS,
+sRTF_FMODERN, RTF_FMODERN,
+sRTF_FSCRIPT, RTF_FSCRIPT,
+sRTF_FDECOR, RTF_FDECOR,
+sRTF_FTECH, RTF_FTECH,
+sRTF_FCHARSET, RTF_FCHARSET,
+sRTF_FALT, RTF_FALT,
+sRTF_FPRQ, RTF_FPRQ,
+sRTF_COLORTBL, RTF_COLORTBL,
+sRTF_RED, RTF_RED,
+sRTF_GREEN, RTF_GREEN,
+sRTF_BLUE, RTF_BLUE,
+sRTF_CF, RTF_CF,
+sRTF_CB, RTF_CB,
+sRTF_INFO, RTF_INFO,
+sRTF_TITLE, RTF_TITLE,
+sRTF_SUBJECT, RTF_SUBJECT,
+sRTF_AUTHOR, RTF_AUTHOR,
+sRTF_OPERATOR, RTF_OPERATOR,
+sRTF_KEYWORDS, RTF_KEYWORDS,
+sRTF_COMMENT, RTF_COMMENT,
+sRTF_VERSION, RTF_VERSION,
+sRTF_DOCCOMM, RTF_DOCCOMM,
+sRTF_VERN, RTF_VERN,
+sRTF_CREATIM, RTF_CREATIM,
+sRTF_REVTIM, RTF_REVTIM,
+sRTF_PRINTIM, RTF_PRINTIM,
+sRTF_BUPTIM, RTF_BUPTIM,
+sRTF_EDMINS, RTF_EDMINS,
+sRTF_NOFPAGES, RTF_NOFPAGES,
+sRTF_NOFWORDS, RTF_NOFWORDS,
+sRTF_NOFCHARS, RTF_NOFCHARS,
+sRTF_ID, RTF_ID,
+sRTF_YR, RTF_YR,
+sRTF_MO, RTF_MO,
+sRTF_DY, RTF_DY,
+sRTF_HR, RTF_HR,
+sRTF_MIN, RTF_MIN,
+sRTF_ANNOTATION, RTF_ANNOTATION,
+sRTF_ATNID, RTF_ATNID,
+sRTF_FOOTNOTE, RTF_FOOTNOTE,
+sRTF_FOOTER, RTF_FOOTER,
+sRTF_FOOTERL, RTF_FOOTERL,
+sRTF_FOOTERR, RTF_FOOTERR,
+sRTF_FOOTERF, RTF_FOOTERF,
+sRTF_HEADER, RTF_HEADER,
+sRTF_HEADERL, RTF_HEADERL,
+sRTF_HEADERR, RTF_HEADERR,
+sRTF_HEADERF, RTF_HEADERF,
+sRTF_XE, RTF_XE,
+sRTF_BXE, RTF_BXE,
+sRTF_IXE, RTF_IXE,
+sRTF_RXE, RTF_RXE,
+sRTF_TXE, RTF_TXE,
+sRTF_TC, RTF_TC,
+sRTF_TCF, RTF_TCF,
+sRTF_TCL, RTF_TCL,
+sRTF_BKMKSTART, RTF_BKMKSTART,
+sRTF_BKMKEND, RTF_BKMKEND,
+sRTF_PICT, RTF_PICT,
+sRTF_PICW, RTF_PICW,
+sRTF_PICH, RTF_PICH,
+sRTF_WBMBITSPIXEL, RTF_WBMBITSPIXEL,
+sRTF_WBMPLANES, RTF_WBMPLANES,
+sRTF_WBMWIDTHBYTES, RTF_WBMWIDTHBYTES,
+sRTF_PICWGOAL, RTF_PICWGOAL,
+sRTF_PICHGOAL, RTF_PICHGOAL,
+sRTF_BIN, RTF_BIN,
+sRTF_PICSCALEX, RTF_PICSCALEX,
+sRTF_PICSCALEY, RTF_PICSCALEY,
+sRTF_PICSCALED, RTF_PICSCALED,
+sRTF_WBITMAP, RTF_WBITMAP,
+sRTF_WMETAFILE, RTF_WMETAFILE,
+sRTF_MACPICT, RTF_MACPICT,
+sRTF_PICCROPT, RTF_PICCROPT,
+sRTF_PICCROPB, RTF_PICCROPB,
+sRTF_PICCROPL, RTF_PICCROPL,
+sRTF_PICCROPR, RTF_PICCROPR,
+sRTF_FIELD, RTF_FIELD,
+sRTF_FLDDIRTY, RTF_FLDDIRTY,
+sRTF_FLDEDIT, RTF_FLDEDIT,
+sRTF_FLDLOCK, RTF_FLDLOCK,
+sRTF_FLDPRIV, RTF_FLDPRIV,
+sRTF_FLDINST, RTF_FLDINST,
+sRTF_FLDRSLT, RTF_FLDRSLT,
+sRTF_PAPERW, RTF_PAPERW,
+sRTF_PAPERH, RTF_PAPERH,
+sRTF_MARGL, RTF_MARGL,
+sRTF_MARGR, RTF_MARGR,
+sRTF_MARGT, RTF_MARGT,
+sRTF_MARGB, RTF_MARGB,
+sRTF_FACINGP, RTF_FACINGP,
+sRTF_GUTTER, RTF_GUTTER,
+sRTF_DEFTAB, RTF_DEFTAB,
+sRTF_WIDOWCTRL, RTF_WIDOWCTRL,
+sRTF_HYPHHOTZ, RTF_HYPHHOTZ,
+sRTF_FTNSEP, RTF_FTNSEP,
+sRTF_FTNSEPC, RTF_FTNSEPC,
+sRTF_FTNCN, RTF_FTNCN,
+sRTF_ENDNOTES, RTF_ENDNOTES,
+sRTF_ENDDOC, RTF_ENDDOC,
+sRTF_FTNTJ, RTF_FTNTJ,
+sRTF_FTNBJ, RTF_FTNBJ,
+sRTF_FTNSTART, RTF_FTNSTART,
+sRTF_FTNRESTART, RTF_FTNRESTART,
+sRTF_PGNSTART, RTF_PGNSTART,
+sRTF_LINESTART, RTF_LINESTART,
+sRTF_LANDSCAPE, RTF_LANDSCAPE,
+sRTF_FRACWIDTH, RTF_FRACWIDTH,
+sRTF_NEXTFILE, RTF_NEXTFILE,
+sRTF_TEMPLATE, RTF_TEMPLATE,
+sRTF_MAKEBACKUP, RTF_MAKEBACKUP,
+sRTF_DEFFORMAT, RTF_DEFFORMAT,
+sRTF_REVISIONS, RTF_REVISIONS,
+sRTF_MARGMIRROR, RTF_MARGMIRROR,
+sRTF_REVPROP, RTF_REVPROP,
+sRTF_REVBAR, RTF_REVBAR,
+sRTF_SECTD, RTF_SECTD,
+sRTF_SBKNONE, RTF_SBKNONE,
+sRTF_SBKCOL, RTF_SBKCOL,
+sRTF_SBKPAGE, RTF_SBKPAGE,
+sRTF_SBKEVEN, RTF_SBKEVEN,
+sRTF_SBKODD, RTF_SBKODD,
+sRTF_PGNSTARTS, RTF_PGNSTARTS,
+sRTF_PGNCONT, RTF_PGNCONT,
+sRTF_PGNRESTART, RTF_PGNRESTART,
+sRTF_PGNDEC, RTF_PGNDEC,
+sRTF_PGNUCRM, RTF_PGNUCRM,
+sRTF_PGNLCRM, RTF_PGNLCRM,
+sRTF_PGNUCLTR, RTF_PGNUCLTR,
+sRTF_PGNLCLTR, RTF_PGNLCLTR,
+sRTF_PGNX, RTF_PGNX,
+sRTF_PGNY, RTF_PGNY,
+sRTF_HEADERY, RTF_HEADERY,
+sRTF_FOOTERY, RTF_FOOTERY,
+sRTF_LINEMOD, RTF_LINEMOD,
+sRTF_LINEX, RTF_LINEX,
+sRTF_LINESTARTS, RTF_LINESTARTS,
+sRTF_LINERESTART, RTF_LINERESTART,
+sRTF_LINEPPAGE, RTF_LINEPAGE,
+sRTF_LINECONT, RTF_LINECONT,
+sRTF_VERTALT, RTF_VERTALT,
+sRTF_VERTALB, RTF_VERTALB,
+sRTF_VERTALC, RTF_VERTALC,
+sRTF_VERTALJ, RTF_VERTALJ,
+sRTF_COLS, RTF_COLS,
+sRTF_COLSX, RTF_COLSX,
+sRTF_COLNO, RTF_COLNO,
+sRTF_COLSR, RTF_COLSR,
+sRTF_COLW, RTF_COLW,
+sRTF_LINEBETCOL, RTF_LINEBETCOL,
+sRTF_ENDNHERE, RTF_ENDNHERE,
+sRTF_TITLEPG, RTF_TITLEPG,
+sRTF_PARD, RTF_PARD,
+sRTF_S, RTF_S,
+sRTF_QL, RTF_QL,
+sRTF_QR, RTF_QR,
+sRTF_QJ, RTF_QJ,
+sRTF_QC, RTF_QC,
+sRTF_FI, RTF_FI,
+sRTF_LI, RTF_LI,
+sRTF_RI, RTF_RI,
+sRTF_SB, RTF_SB,
+sRTF_SA, RTF_SA,
+sRTF_SL, RTF_SL,
+sRTF_INTBL, RTF_INTBL,
+sRTF_KEEP, RTF_KEEP,
+sRTF_KEEPN, RTF_KEEPN,
+sRTF_LEVEL, RTF_LEVEL,
+sRTF_SBYS, RTF_SBYS,
+sRTF_PAGEBB, RTF_PAGEBB,
+sRTF_NOLINE, RTF_NOLINE,
+sRTF_TX, RTF_TX,
+sRTF_TQL, RTF_TQL,
+sRTF_TQR, RTF_TQR,
+sRTF_TQC, RTF_TQC,
+sRTF_TQDEC, RTF_TQDEC,
+sRTF_TB, RTF_TB,
+sRTF_BRDRT, RTF_BRDRT,
+sRTF_BRDRB, RTF_BRDRB,
+sRTF_BRDRL, RTF_BRDRL,
+sRTF_BRDRR, RTF_BRDRR,
+sRTF_BOX, RTF_BOX,
+sRTF_BRDRS, RTF_BRDRS,
+sRTF_BRDRTH, RTF_BRDRTH,
+sRTF_BRDRSH, RTF_BRDRSH,
+sRTF_BRDRDB, RTF_BRDRDB,
+sRTF_BRDRDOT, RTF_BRDRDOT,
+sRTF_BRDRHAIR, RTF_BRDRHAIR,
+sRTF_BRSP, RTF_BRSP,
+sRTF_TLDOT, RTF_TLDOT,
+sRTF_TLHYPH, RTF_TLHYPH,
+sRTF_TLUL, RTF_TLUL,
+sRTF_TLTH, RTF_TLTH,
+sRTF_POSX, RTF_POSX,
+sRTF_POSXC, RTF_POSXC,
+sRTF_POSXI, RTF_POSXI,
+sRTF_POSXL, RTF_POSXL,
+sRTF_POSXO, RTF_POSXO,
+sRTF_POSXR, RTF_POSXR,
+sRTF_POSY, RTF_POSY,
+sRTF_POSYIL, RTF_POSYIL,
+sRTF_POSYT, RTF_POSYT,
+sRTF_POSYC, RTF_POSYC,
+sRTF_POSYB, RTF_POSYB,
+sRTF_ABSW, RTF_ABSW,
+sRTF_DXFRTEXT, RTF_DXFRTEXT,
+sRTF_PVMRG, RTF_PVMRG,
+sRTF_PVPG, RTF_PVPG,
+sRTF_PHMRG, RTF_PHMRG,
+sRTF_PHPG, RTF_PHPG,
+sRTF_PHCOL, RTF_PHCOL,
+sRTF_CLBRDRB, RTF_CLBRDRB,
+sRTF_CLBRDRT, RTF_CLBRDRT,
+sRTF_CLBRDRL, RTF_CLBRDRL,
+sRTF_CLBRDRR, RTF_CLBRDRR,
+sRTF_TROWD, RTF_TROWD,
+sRTF_TRQL, RTF_TRQL,
+sRTF_TRQR, RTF_TRQR,
+sRTF_TRQC, RTF_TRQC,
+sRTF_TRGAPH, RTF_TRGAPH,
+sRTF_TRRH, RTF_TRRH,
+sRTF_TRLEFT, RTF_TRLEFT,
+sRTF_CELLX, RTF_CELLX,
+sRTF_CLMGF, RTF_CLMGF,
+sRTF_CLMRG, RTF_CLMRG,
+sRTF_PLAIN, RTF_PLAIN,
+sRTF_B, RTF_B,
+sRTF_I, RTF_I,
+sRTF_STRIKE, RTF_STRIKE,
+sRTF_OUTL, RTF_OUTL,
+sRTF_SHAD, RTF_SHAD,
+sRTF_SCAPS, RTF_SCAPS,
+sRTF_CAPS, RTF_CAPS,
+sRTF_V, RTF_V,
+sRTF_F, RTF_F,
+sRTF_FS, RTF_FS,
+sRTF_EXPND, RTF_EXPND,
+sRTF_EXPNDTW, RTF_EXPNDTW,
+sRTF_KERNING, RTF_KERNING,
+sRTF_UL, RTF_UL,
+sRTF_ULW, RTF_ULW,
+sRTF_ULD, RTF_ULD,
+sRTF_ULDB, RTF_ULDB,
+sRTF_ULNONE, RTF_ULNONE,
+sRTF_UP, RTF_UP,
+sRTF_DN, RTF_DN,
+sRTF_REVISED, RTF_REVISED,
+sRTF_SUB, RTF_SUB,
+sRTF_NOSUPERSUB, RTF_NOSUPERSUB,
+sRTF_SUPER, RTF_SUPER,
+sRTF_CHDATE, RTF_CHDATE,
+sRTF_CHTIME, RTF_CHTIME,
+sRTF_CHPGN, RTF_CHPGN,
+sRTF_CHFTN, RTF_CHFTN,
+sRTF_CHATN, RTF_CHATN,
+sRTF_CHFTNSEP, RTF_CHFTNSEP,
+sRTF_CHFTNSEPC, RTF_CHFTNSEPC,
+sRTF_FORMULA, RTF_FORMULA,
+sRTF_NOBREAK, RTF_NONBREAKINGSPACE,
+sRTF_OPTHYPH, RTF_OPTIONALHYPHEN,
+sRTF_NOBRKHYPH, RTF_NONBREAKINGHYPHEN,
+sRTF_HEXCHAR, RTF_HEX,
+sRTF_CELL, RTF_CELL,
+sRTF_ROW, RTF_ROW,
+sRTF_PAR, RTF_PAR,
+sRTF_SECT, RTF_SECT,
+sRTF_PAGE, RTF_PAGE,
+sRTF_COLUMN, RTF_COLUM,
+sRTF_LINE, RTF_LINE,
+sRTF_TAB, RTF_TAB,
+sRTF_SUBENTRY, RTF_SUBENTRYINDEX,
+
+sRTF_DEFLANG, RTF_DEFLANG,
+sRTF_LANG, RTF_LANG,
+sRTF_PMMETAFILE, RTF_OSMETAFILE,
+sRTF_DIBITMAP, RTF_DIBITMAP,
+sRTF_KEYCODE, RTF_KEYCODE,
+sRTF_FN, RTF_FNKEY,
+sRTF_ALT, RTF_ALTKEY,
+sRTF_SHIFT, RTF_SHIFTKEY,
+sRTF_CTRL, RTF_CTRLKEY,
+sRTF_CHDPL, RTF_CHDATEL,
+sRTF_CHDPA, RTF_CHDATEA,
+sRTF_EMDASH, RTF_EMDASH,
+sRTF_ENDASH, RTF_ENDASH,
+sRTF_BULLET, RTF_BULLET,
+sRTF_LQUOTE, RTF_LQUOTE,
+sRTF_RQUOTE, RTF_RQUOTE,
+sRTF_LDBLQUOTE, RTF_LDBLQUOTE,
+sRTF_RDBLQUOTE, RTF_RDBLQUOTE,
+
+sRTF_BKMKCOLF, RTF_BKMKCOLF,
+sRTF_BKMKCOLL, RTF_BKMKCOLL,
+sRTF_PSOVER, RTF_PSOVER,
+sRTF_DOCTEMP, RTF_DOCTEMP,
+sRTF_BINFSXN, RTF_BINFSXN,
+sRTF_BINSXN, RTF_BINSXN,
+sRTF_PGWSXN, RTF_PGWSXN,
+sRTF_PGHSXN, RTF_PGHSXN,
+sRTF_MARGLSXN, RTF_MARGLSXN,
+sRTF_MARGRSXN, RTF_MARGRSXN,
+sRTF_MARGTSXN, RTF_MARGTSXN,
+sRTF_MARGBSXN, RTF_MARGBSXN,
+sRTF_GUTTERSXN, RTF_GUTTERSXN,
+sRTF_LNDSCPSXN, RTF_LNDSCPSXN,
+sRTF_FACPGSXN, RTF_FACPGSXN,
+sRTF_TLEQ, RTF_TLEQ,
+sRTF_BRDRBTW, RTF_BRDRBTW,
+sRTF_BRDRBAR, RTF_BRDRBAR,
+sRTF_BRDRW, RTF_BRDRW,
+sRTF_BRDRCF, RTF_BRDRCF,
+sRTF_ABSH, RTF_ABSH,
+sRTF_PVPARA, RTF_PVPARA,
+sRTF_NOWRAP, RTF_NOWRAP,
+sRTF_DFRMTXTX, RTF_DFRMTXTX,
+sRTF_DFRMTXTY, RTF_DFRMTXTY,
+sRTF_DROPCAPLI, RTF_DROPCAPLI,
+sRTF_DROPCAPLT, RTF_DROPCAPLT,
+sRTF_POSNEGX, RTF_POSNEGX,
+sRTF_POSNEGY, RTF_POSNEGY,
+sRTF_DELETED, RTF_DELETED,
+
+sRTF_SHADING, RTF_SHADING,
+sRTF_BGHORIZ, RTF_BGHORIZ,
+sRTF_BGVERT, RTF_BGVERT,
+sRTF_BGFDIAG, RTF_BGFDIAG,
+sRTF_BGBDIAG, RTF_BGBDIAG,
+sRTF_BGCROSS, RTF_BGCROSS,
+sRTF_BGDCROSS, RTF_BGDCROSS,
+sRTF_BGDKHORIZ, RTF_BGDKHORIZ,
+sRTF_BGDKVERT, RTF_BGDKVERT,
+sRTF_BGDKFDIAG, RTF_BGDKFDIAG,
+sRTF_BGDKBDIAG, RTF_BGDKBDIAG,
+sRTF_BGDKCROSS, RTF_BGDKCROSS,
+sRTF_BGDKDCROSS, RTF_BGDKDCROSS,
+sRTF_CFPAT, RTF_CFPAT,
+sRTF_CBPAT, RTF_CBPAT,
+
+sRTF_CLSHDNG, RTF_CLSHDNG,
+sRTF_CLBGHORIZ, RTF_CLBGHORIZ,
+sRTF_CLBGVERT, RTF_CLBGVERT,
+sRTF_CLBGFDIAG, RTF_CLBGFDIAG,
+sRTF_CLBGBDIAG, RTF_CLBGBDIAG,
+sRTF_CLBGCROSS, RTF_CLBGCROSS,
+sRTF_CLBGDCROSS, RTF_CLBGDCROSS,
+sRTF_CLBGDKHOR, RTF_CLBGDKHOR,
+sRTF_CLBGDKVERT, RTF_CLBGDKVERT,
+sRTF_CLBGDKFDIAG, RTF_CLBGDKFDIAG,
+sRTF_CLBGDKBDIAG, RTF_CLBGDKBDIAG,
+sRTF_CLBGDKCROSS, RTF_CLBGDKCROSS,
+sRTF_CLBGDKDCROSS, RTF_CLBGDKDCROSS,
+sRTF_CLCFPAT, RTF_CLCFPAT,
+sRTF_CLCBPAT, RTF_CLCBPAT,
+
+sRTF_AB, RTF_AB,
+sRTF_ACAPS, RTF_ACAPS,
+sRTF_ACF, RTF_ACF,
+sRTF_ADDITIVE, RTF_ADDITIVE,
+sRTF_ADN, RTF_ADN,
+sRTF_AENDDOC, RTF_AENDDOC,
+sRTF_AENDNOTES, RTF_AENDNOTES,
+sRTF_AEXPND, RTF_AEXPND,
+sRTF_AF, RTF_AF,
+sRTF_AFS, RTF_AFS,
+sRTF_AFTNBJ, RTF_AFTNBJ,
+sRTF_AFTNCN, RTF_AFTNCN,
+sRTF_AFTNNALC, RTF_AFTNNALC,
+sRTF_AFTNNAR, RTF_AFTNNAR,
+sRTF_AFTNNAUC, RTF_AFTNNAUC,
+sRTF_AFTNNCHI, RTF_AFTNNCHI,
+sRTF_AFTNNRLC, RTF_AFTNNRLC,
+sRTF_AFTNNRUC, RTF_AFTNNRUC,
+sRTF_AFTNRESTART, RTF_AFTNRESTART,
+sRTF_AFTNRSTCONT, RTF_AFTNRSTCONT,
+sRTF_AFTNSEP, RTF_AFTNSEP,
+sRTF_AFTNSEPC, RTF_AFTNSEPC,
+sRTF_AFTNSTART, RTF_AFTNSTART,
+sRTF_AFTNTJ, RTF_AFTNTJ,
+sRTF_AI, RTF_AI,
+sRTF_ALANG, RTF_ALANG,
+sRTF_ALLPROT, RTF_ALLPROT,
+sRTF_ANNOTPROT, RTF_ANNOTPROT,
+sRTF_AOUTL, RTF_AOUTL,
+sRTF_ASCAPS, RTF_ASCAPS,
+sRTF_ASHAD, RTF_ASHAD,
+sRTF_ASTRIKE, RTF_ASTRIKE,
+sRTF_ATNAUTHOR, RTF_ATNAUTHOR,
+sRTF_ATNICN, RTF_ATNICN,
+sRTF_ATNREF, RTF_ATNREF,
+sRTF_ATNTIME, RTF_ATNTIME,
+sRTF_ATRFEND, RTF_ATRFEND,
+sRTF_ATRFSTART, RTF_ATRFSTART,
+sRTF_AUL, RTF_AUL,
+sRTF_AULD, RTF_AULD,
+sRTF_AULDB, RTF_AULDB,
+sRTF_AULNONE, RTF_AULNONE,
+sRTF_AULW, RTF_AULW,
+sRTF_AUP, RTF_AUP,
+sRTF_BKMKPUB, RTF_BKMKPUB,
+sRTF_BRDRDASH, RTF_BRDRDASH,
+sRTF_BRKFRM, RTF_BRKFRM,
+sRTF_CCHS, RTF_CCHS,
+sRTF_CPG, RTF_CPG,
+sRTF_CS, RTF_CS,
+sRTF_CVMME, RTF_CVMME,
+sRTF_DATAFIELD, RTF_DATAFIELD,
+sRTF_DO, RTF_DO,
+sRTF_DOBXCOLUMN, RTF_DOBXCOLUMN,
+sRTF_DOBXMARGIN, RTF_DOBXMARGIN,
+sRTF_DOBXPAGE, RTF_DOBXPAGE,
+sRTF_DOBYMARGIN, RTF_DOBYMARGIN,
+sRTF_DOBYPAGE, RTF_DOBYPAGE,
+sRTF_DOBYPARA, RTF_DOBYPARA,
+sRTF_DODHGT, RTF_DODHGT,
+sRTF_DOLOCK, RTF_DOLOCK,
+sRTF_DPAENDHOL, RTF_DPAENDHOL,
+sRTF_DPAENDL, RTF_DPAENDL,
+sRTF_DPAENDSOL, RTF_DPAENDSOL,
+sRTF_DPAENDW, RTF_DPAENDW,
+sRTF_DPARC, RTF_DPARC,
+sRTF_DPARCFLIPX, RTF_DPARCFLIPX,
+sRTF_DPARCFLIPY, RTF_DPARCFLIPY,
+sRTF_DPASTARTHOL, RTF_DPASTARTHOL,
+sRTF_DPASTARTL, RTF_DPASTARTL,
+sRTF_DPASTARTSOL, RTF_DPASTARTSOL,
+sRTF_DPASTARTW, RTF_DPASTARTW,
+sRTF_DPCALLOUT, RTF_DPCALLOUT,
+sRTF_DPCOA, RTF_DPCOA,
+sRTF_DPCOACCENT, RTF_DPCOACCENT,
+sRTF_DPCOBESTFIT, RTF_DPCOBESTFIT,
+sRTF_DPCOBORDER, RTF_DPCOBORDER,
+sRTF_DPCODABS, RTF_DPCODABS,
+sRTF_DPCODBOTTOM, RTF_DPCODBOTTOM,
+sRTF_DPCODCENTER, RTF_DPCODCENTER,
+sRTF_DPCODTOP, RTF_DPCODTOP,
+sRTF_DPCOLENGTH, RTF_DPCOLENGTH,
+sRTF_DPCOMINUSX, RTF_DPCOMINUSX,
+sRTF_DPCOMINUSY, RTF_DPCOMINUSY,
+sRTF_DPCOOFFSET, RTF_DPCOOFFSET,
+sRTF_DPCOSMARTA, RTF_DPCOSMARTA,
+sRTF_DPCOTDOUBLE, RTF_DPCOTDOUBLE,
+sRTF_DPCOTRIGHT, RTF_DPCOTRIGHT,
+sRTF_DPCOTSINGLE, RTF_DPCOTSINGLE,
+sRTF_DPCOTTRIPLE, RTF_DPCOTTRIPLE,
+sRTF_DPCOUNT, RTF_DPCOUNT,
+sRTF_DPELLIPSE, RTF_DPELLIPSE,
+sRTF_DPENDGROUP, RTF_DPENDGROUP,
+sRTF_DPFILLBGCB, RTF_DPFILLBGCB,
+sRTF_DPFILLBGCG, RTF_DPFILLBGCG,
+sRTF_DPFILLBGCR, RTF_DPFILLBGCR,
+sRTF_DPFILLBGGRAY, RTF_DPFILLBGGRAY,
+sRTF_DPFILLBGPAL, RTF_DPFILLBGPAL,
+sRTF_DPFILLFGCB, RTF_DPFILLFGCB,
+sRTF_DPFILLFGCG, RTF_DPFILLFGCG,
+sRTF_DPFILLFGCR, RTF_DPFILLFGCR,
+sRTF_DPFILLFGGRAY, RTF_DPFILLFGGRAY,
+sRTF_DPFILLFGPAL, RTF_DPFILLFGPAL,
+sRTF_DPFILLPAT, RTF_DPFILLPAT,
+sRTF_DPGROUP, RTF_DPGROUP,
+sRTF_DPLINE, RTF_DPLINE,
+sRTF_DPLINECOB, RTF_DPLINECOB,
+sRTF_DPLINECOG, RTF_DPLINECOG,
+sRTF_DPLINECOR, RTF_DPLINECOR,
+sRTF_DPLINEDADO, RTF_DPLINEDADO,
+sRTF_DPLINEDADODO, RTF_DPLINEDADODO,
+sRTF_DPLINEDASH, RTF_DPLINEDASH,
+sRTF_DPLINEDOT, RTF_DPLINEDOT,
+sRTF_DPLINEGRAY, RTF_DPLINEGRAY,
+sRTF_DPLINEHOLLOW, RTF_DPLINEHOLLOW,
+sRTF_DPLINEPAL, RTF_DPLINEPAL,
+sRTF_DPLINESOLID, RTF_DPLINESOLID,
+sRTF_DPLINEW, RTF_DPLINEW,
+sRTF_DPPOLYCOUNT, RTF_DPPOLYCOUNT,
+sRTF_DPPOLYGON, RTF_DPPOLYGON,
+sRTF_DPPOLYLINE, RTF_DPPOLYLINE,
+sRTF_DPPTX, RTF_DPPTX,
+sRTF_DPPTY, RTF_DPPTY,
+sRTF_DPRECT, RTF_DPRECT,
+sRTF_DPROUNDR, RTF_DPROUNDR,
+sRTF_DPSHADOW, RTF_DPSHADOW,
+sRTF_DPSHADX, RTF_DPSHADX,
+sRTF_DPSHADY, RTF_DPSHADY,
+sRTF_DPTXBX, RTF_DPTXBX,
+sRTF_DPTXBXMAR, RTF_DPTXBXMAR,
+sRTF_DPTXBXTEXT, RTF_DPTXBXTEXT,
+sRTF_DPX, RTF_DPX,
+sRTF_DPXSIZE, RTF_DPXSIZE,
+sRTF_DPY, RTF_DPY,
+sRTF_DPYSIZE, RTF_DPYSIZE,
+sRTF_DS, RTF_DS,
+sRTF_EMSPACE, RTF_EMSPACE,
+sRTF_ENSPACE, RTF_ENSPACE,
+sRTF_FBIDI, RTF_FBIDI,
+sRTF_FET, RTF_FET,
+sRTF_FID, RTF_FID,
+sRTF_FILE, RTF_FILE,
+sRTF_FILETBL, RTF_FILETBL,
+sRTF_FLDALT, RTF_FLDALT,
+sRTF_FNETWORK, RTF_FNETWORK,
+sRTF_FONTEMB, RTF_FONTEMB,
+sRTF_FONTFILE, RTF_FONTFILE,
+sRTF_FORMDISP, RTF_FORMDISP,
+sRTF_FORMPROT, RTF_FORMPROT,
+sRTF_FORMSHADE, RTF_FORMSHADE,
+sRTF_FOSNUM, RTF_FOSNUM,
+sRTF_FRELATIVE, RTF_FRELATIVE,
+sRTF_FTNALT, RTF_FTNALT,
+sRTF_FTNIL, RTF_FTNIL,
+sRTF_FTNNALC, RTF_FTNNALC,
+sRTF_FTNNAR, RTF_FTNNAR,
+sRTF_FTNNAUC, RTF_FTNNAUC,
+sRTF_FTNNCHI, RTF_FTNNCHI,
+sRTF_FTNNRLC, RTF_FTNNRLC,
+sRTF_FTNNRUC, RTF_FTNNRUC,
+sRTF_FTNRSTCONT, RTF_FTNRSTCONT,
+sRTF_FTNRSTPG, RTF_FTNRSTPG,
+sRTF_FTTRUETYPE, RTF_FTTRUETYPE,
+sRTF_FVALIDDOS, RTF_FVALIDDOS,
+sRTF_FVALIDHPFS, RTF_FVALIDHPFS,
+sRTF_FVALIDMAC, RTF_FVALIDMAC,
+sRTF_FVALIDNTFS, RTF_FVALIDNTFS,
+sRTF_HYPHAUTO, RTF_HYPHAUTO,
+sRTF_HYPHCAPS, RTF_HYPHCAPS,
+sRTF_HYPHCONSEC, RTF_HYPHCONSEC,
+sRTF_HYPHPAR, RTF_HYPHPAR,
+sRTF_LINKSELF, RTF_LINKSELF,
+sRTF_LINKSTYLES, RTF_LINKSTYLES,
+sRTF_LTRCH, RTF_LTRCH,
+sRTF_LTRDOC, RTF_LTRDOC,
+sRTF_LTRMARK, RTF_LTRMARK,
+sRTF_LTRPAR, RTF_LTRPAR,
+sRTF_LTRROW, RTF_LTRROW,
+sRTF_LTRSECT, RTF_LTRSECT,
+sRTF_NOCOLBAL, RTF_NOCOLBAL,
+sRTF_NOEXTRASPRL, RTF_NOEXTRASPRL,
+sRTF_NOTABIND, RTF_NOTABIND,
+sRTF_NOWIDCTLPAR, RTF_NOWIDCTLPAR,
+sRTF_OBJALIAS, RTF_OBJALIAS,
+sRTF_OBJALIGN, RTF_OBJALIGN,
+sRTF_OBJAUTLINK, RTF_OBJAUTLINK,
+sRTF_OBJCLASS, RTF_OBJCLASS,
+sRTF_OBJCROPB, RTF_OBJCROPB,
+sRTF_OBJCROPL, RTF_OBJCROPL,
+sRTF_OBJCROPR, RTF_OBJCROPR,
+sRTF_OBJCROPT, RTF_OBJCROPT,
+sRTF_OBJDATA, RTF_OBJDATA,
+sRTF_OBJECT, RTF_OBJECT,
+sRTF_OBJEMB, RTF_OBJEMB,
+sRTF_OBJH, RTF_OBJH,
+sRTF_OBJICEMB, RTF_OBJICEMB,
+sRTF_OBJLINK, RTF_OBJLINK,
+sRTF_OBJLOCK, RTF_OBJLOCK,
+sRTF_OBJNAME, RTF_OBJNAME,
+sRTF_OBJPUB, RTF_OBJPUB,
+sRTF_OBJSCALEX, RTF_OBJSCALEX,
+sRTF_OBJSCALEY, RTF_OBJSCALEY,
+sRTF_OBJSECT, RTF_OBJSECT,
+sRTF_OBJSETSIZE, RTF_OBJSETSIZE,
+sRTF_OBJSUB, RTF_OBJSUB,
+sRTF_OBJTIME, RTF_OBJTIME,
+sRTF_OBJTRANSY, RTF_OBJTRANSY,
+sRTF_OBJUPDATE, RTF_OBJUPDATE,
+sRTF_OBJW, RTF_OBJW,
+sRTF_OTBLRUL, RTF_OTBLRUL,
+sRTF_PGNHN, RTF_PGNHN,
+sRTF_PGNHNSC, RTF_PGNHNSC,
+sRTF_PGNHNSH, RTF_PGNHNSH,
+sRTF_PGNHNSM, RTF_PGNHNSM,
+sRTF_PGNHNSN, RTF_PGNHNSN,
+sRTF_PGNHNSP, RTF_PGNHNSP,
+sRTF_PICBMP, RTF_PICBMP,
+sRTF_PICBPP, RTF_PICBPP,
+sRTF_PN, RTF_PN,
+sRTF_PNACROSS, RTF_PNACROSS,
+sRTF_PNB, RTF_PNB,
+sRTF_PNCAPS, RTF_PNCAPS,
+sRTF_PNCARD, RTF_PNCARD,
+sRTF_PNCF, RTF_PNCF,
+sRTF_PNDEC, RTF_PNDEC,
+sRTF_PNF, RTF_PNF,
+sRTF_PNFS, RTF_PNFS,
+sRTF_PNHANG, RTF_PNHANG,
+sRTF_PNI, RTF_PNI,
+sRTF_PNINDENT, RTF_PNINDENT,
+sRTF_PNLCLTR, RTF_PNLCLTR,
+sRTF_PNLCRM, RTF_PNLCRM,
+sRTF_PNLVL, RTF_PNLVL,
+sRTF_PNLVLBLT, RTF_PNLVLBLT,
+sRTF_PNLVLBODY, RTF_PNLVLBODY,
+sRTF_PNLVLCONT, RTF_PNLVLCONT,
+sRTF_PNNUMONCE, RTF_PNNUMONCE,
+sRTF_PNORD, RTF_PNORD,
+sRTF_PNORDT, RTF_PNORDT,
+sRTF_PNPREV, RTF_PNPREV,
+sRTF_PNQC, RTF_PNQC,
+sRTF_PNQL, RTF_PNQL,
+sRTF_PNQR, RTF_PNQR,
+sRTF_PNRESTART, RTF_PNRESTART,
+sRTF_PNSCAPS, RTF_PNSCAPS,
+sRTF_PNSECLVL, RTF_PNSECLVL,
+sRTF_PNSP, RTF_PNSP,
+sRTF_PNSTART, RTF_PNSTART,
+sRTF_PNSTRIKE, RTF_PNSTRIKE,
+sRTF_PNTEXT, RTF_PNTEXT,
+sRTF_PNTXTA, RTF_PNTXTA,
+sRTF_PNTXTB, RTF_PNTXTB,
+sRTF_PNUCLTR, RTF_PNUCLTR,
+sRTF_PNUCRM, RTF_PNUCRM,
+sRTF_PNUL, RTF_PNUL,
+sRTF_PNULD, RTF_PNULD,
+sRTF_PNULDB, RTF_PNULDB,
+sRTF_PNULNONE, RTF_PNULNONE,
+sRTF_PNULW, RTF_PNULW,
+sRTF_PRCOLBL, RTF_PRCOLBL,
+sRTF_PRINTDATA, RTF_PRINTDATA,
+sRTF_PSZ, RTF_PSZ,
+sRTF_PUBAUTO, RTF_PUBAUTO,
+sRTF_RESULT, RTF_RESULT,
+sRTF_REVAUTH, RTF_REVAUTH,
+sRTF_REVDTTM, RTF_REVDTTM,
+sRTF_REVPROT, RTF_REVPROT,
+sRTF_REVTBL, RTF_REVTBL,
+sRTF_RSLTBMP, RTF_RSLTBMP,
+sRTF_RSLTMERGE, RTF_RSLTMERGE,
+sRTF_RSLTPICT, RTF_RSLTPICT,
+sRTF_RSLTRTF, RTF_RSLTRTF,
+sRTF_RSLTTXT, RTF_RSLTTXT,
+sRTF_RTLCH, RTF_RTLCH,
+sRTF_RTLDOC, RTF_RTLDOC,
+sRTF_RTLMARK, RTF_RTLMARK,
+sRTF_RTLPAR, RTF_RTLPAR,
+sRTF_RTLROW, RTF_RTLROW,
+sRTF_RTLSECT, RTF_RTLSECT,
+sRTF_SEC, RTF_SEC,
+sRTF_SECTNUM, RTF_SECTNUM,
+sRTF_SECTUNLOCKED, RTF_SECTUNLOCKED,
+sRTF_SLMULT, RTF_SLMULT,
+sRTF_SOFTCOL, RTF_SOFTCOL,
+sRTF_SOFTLHEIGHT, RTF_SOFTLHEIGHT,
+sRTF_SOFTLINE, RTF_SOFTLINE,
+sRTF_SOFTPAGE, RTF_SOFTPAGE,
+sRTF_SPRSSPBF, RTF_SPRSSPBF,
+sRTF_SPRSTSP, RTF_SPRSTSP,
+sRTF_SUBDOCUMENT, RTF_SUBDOCUMENT,
+sRTF_SWPBDR, RTF_SWPBDR,
+sRTF_TCN, RTF_TCN,
+sRTF_TRANSMF, RTF_TRANSMF,
+sRTF_TRBRDRB, RTF_TRBRDRB,
+sRTF_TRBRDRH, RTF_TRBRDRH,
+sRTF_TRBRDRL, RTF_TRBRDRL,
+sRTF_TRBRDRR, RTF_TRBRDRR,
+sRTF_TRBRDRT, RTF_TRBRDRT,
+sRTF_TRBRDRV, RTF_TRBRDRV,
+sRTF_TRHDR, RTF_TRHDR,
+sRTF_TRKEEP, RTF_TRKEEP,
+sRTF_WRAPTRSP, RTF_WRAPTRSP,
+sRTF_XEF, RTF_XEF,
+sRTF_ZWJ, RTF_ZWJ,
+sRTF_ZWNJ, RTF_ZWNJ,
+
+
+sRTF_ABSLOCK, RTF_ABSLOCK,
+sRTF_ADJUSTRIGHT, RTF_ADJUSTRIGHT,
+sRTF_AFTNNCHOSUNG, RTF_AFTNNCHOSUNG,
+sRTF_AFTNNCNUM, RTF_AFTNNCNUM,
+sRTF_AFTNNDBAR, RTF_AFTNNDBAR,
+sRTF_AFTNNDBNUM, RTF_AFTNNDBNUM,
+sRTF_AFTNNDBNUMD, RTF_AFTNNDBNUMD,
+sRTF_AFTNNDBNUMK, RTF_AFTNNDBNUMK,
+sRTF_AFTNNDBNUMT, RTF_AFTNNDBNUMT,
+sRTF_AFTNNGANADA, RTF_AFTNNGANADA,
+sRTF_AFTNNGBNUM, RTF_AFTNNGBNUM,
+sRTF_AFTNNGBNUMD, RTF_AFTNNGBNUMD,
+sRTF_AFTNNGBNUMK, RTF_AFTNNGBNUMK,
+sRTF_AFTNNGBNUML, RTF_AFTNNGBNUML,
+sRTF_AFTNNZODIAC, RTF_AFTNNZODIAC,
+sRTF_AFTNNZODIACD, RTF_AFTNNZODIACD,
+sRTF_AFTNNZODIACL, RTF_AFTNNZODIACL,
+sRTF_ANIMTEXT, RTF_ANIMTEXT,
+sRTF_ANSICPG, RTF_ANSICPG,
+sRTF_BACKGROUND, RTF_BACKGROUND,
+sRTF_BDBFHDR, RTF_BDBFHDR,
+sRTF_BLIPTAG, RTF_BLIPTAG,
+sRTF_BLIPUID, RTF_BLIPUID,
+sRTF_BLIPUPI, RTF_BLIPUPI,
+sRTF_BRDRART, RTF_BRDRART,
+sRTF_BRDRDASHD, RTF_BRDRDASHD,
+sRTF_BRDRDASHDD, RTF_BRDRDASHDD,
+sRTF_BRDRDASHDOTSTR,RTF_BRDRDASHDOTSTR,
+sRTF_BRDRDASHSM, RTF_BRDRDASHSM,
+sRTF_BRDREMBOSS, RTF_BRDREMBOSS,
+sRTF_BRDRENGRAVE, RTF_BRDRENGRAVE,
+sRTF_BRDRFRAME, RTF_BRDRFRAME,
+sRTF_BRDRTHTNLG, RTF_BRDRTHTNLG,
+sRTF_BRDRTHTNMG, RTF_BRDRTHTNMG,
+sRTF_BRDRTHTNSG, RTF_BRDRTHTNSG,
+sRTF_BRDRTNTHLG, RTF_BRDRTNTHLG,
+sRTF_BRDRTNTHMG, RTF_BRDRTNTHMG,
+sRTF_BRDRTNTHSG, RTF_BRDRTNTHSG,
+sRTF_BRDRTNTHTNLG, RTF_BRDRTNTHTNLG,
+sRTF_BRDRTNTHTNMG, RTF_BRDRTNTHTNMG,
+sRTF_BRDRTNTHTNSG, RTF_BRDRTNTHTNSG,
+sRTF_BRDRTRIPLE, RTF_BRDRTRIPLE,
+sRTF_BRDRWAVY, RTF_BRDRWAVY,
+sRTF_BRDRWAVYDB, RTF_BRDRWAVYDB,
+sRTF_CATEGORY, RTF_CATEGORY,
+sRTF_CGRID, RTF_CGRID,
+sRTF_CHARSCALEX, RTF_CHARSCALEX,
+sRTF_CHBGBDIAG, RTF_CHBGBDIAG,
+sRTF_CHBGCROSS, RTF_CHBGCROSS,
+sRTF_CHBGDCROSS, RTF_CHBGDCROSS,
+sRTF_CHBGDKBDIAG, RTF_CHBGDKBDIAG,
+sRTF_CHBGDKCROSS, RTF_CHBGDKCROSS,
+sRTF_CHBGDKDCROSS, RTF_CHBGDKDCROSS,
+sRTF_CHBGDKFDIAG, RTF_CHBGDKFDIAG,
+sRTF_CHBGDKHORIZ, RTF_CHBGDKHORIZ,
+sRTF_CHBGDKVERT, RTF_CHBGDKVERT,
+sRTF_CHBGFDIAG, RTF_CHBGFDIAG,
+sRTF_CHBGHORIZ, RTF_CHBGHORIZ,
+sRTF_CHBGVERT, RTF_CHBGVERT,
+sRTF_CHBRDR, RTF_CHBRDR,
+sRTF_CHCBPAT, RTF_CHCBPAT,
+sRTF_CHCFPAT, RTF_CHCFPAT,
+sRTF_CHSHDNG, RTF_CHSHDNG,
+sRTF_CLTXLRTB, RTF_CLTXLRTB,
+sRTF_CLTXTBRL, RTF_CLTXTBRL,
+sRTF_CLVERTALB, RTF_CLVERTALB,
+sRTF_CLVERTALC, RTF_CLVERTALC,
+sRTF_CLVERTALT, RTF_CLVERTALT,
+sRTF_CLVMGF, RTF_CLVMGF,
+sRTF_CLVMRG, RTF_CLVMRG,
+sRTF_CLTXTBRLV, RTF_CLTXTBRLV,
+sRTF_CLTXBTLR, RTF_CLTXBTLR,
+sRTF_CLTXLRTBV, RTF_CLTXLRTBV,
+sRTF_COMPANY, RTF_COMPANY,
+sRTF_CRAUTH, RTF_CRAUTH,
+sRTF_CRDATE, RTF_CRDATE,
+sRTF_DATE, RTF_DATE,
+sRTF_DEFLANGFE, RTF_DEFLANGFE,
+sRTF_DFRAUTH, RTF_DFRAUTH,
+sRTF_DFRDATE, RTF_DFRDATE,
+sRTF_DFRSTART, RTF_DFRSTART,
+sRTF_DFRSTOP, RTF_DFRSTOP,
+sRTF_DFRXST, RTF_DFRXST,
+sRTF_DGMARGIN, RTF_DGMARGIN,
+sRTF_DNTBLNSBDB, RTF_DNTBLNSBDB,
+sRTF_DOCTYPE, RTF_DOCTYPE,
+sRTF_DOCVAR, RTF_DOCVAR,
+sRTF_DPCODESCENT, RTF_DPCODESCENT,
+sRTF_EMBO, RTF_EMBO,
+sRTF_EMFBLIP, RTF_EMFBLIP,
+sRTF_EXPSHRTN, RTF_EXPSHRTN,
+sRTF_FAAUTO, RTF_FAAUTO,
+sRTF_FBIAS, RTF_FBIAS,
+sRTF_FFDEFRES, RTF_FFDEFRES,
+sRTF_FFDEFTEXT, RTF_FFDEFTEXT,
+sRTF_FFENTRYMCR, RTF_FFENTRYMCR,
+sRTF_FFEXITMCR, RTF_FFEXITMCR,
+sRTF_FFFORMAT, RTF_FFFORMAT,
+sRTF_FFHASLISTBOX, RTF_FFHASLISTBOX,
+sRTF_FFHELPTEXT, RTF_FFHELPTEXT,
+sRTF_FFHPS, RTF_FFHPS,
+sRTF_FFL, RTF_FFL,
+sRTF_FFMAXLEN, RTF_FFMAXLEN,
+sRTF_FFNAME, RTF_FFNAME,
+sRTF_FFOWNHELP, RTF_FFOWNHELP,
+sRTF_FFOWNSTAT, RTF_FFOWNSTAT,
+sRTF_FFPROT, RTF_FFPROT,
+sRTF_FFRECALC, RTF_FFRECALC,
+sRTF_FFRES, RTF_FFRES,
+sRTF_FFSIZE, RTF_FFSIZE,
+sRTF_FFSTATTEXT, RTF_FFSTATTEXT,
+sRTF_FFTYPE, RTF_FFTYPE,
+sRTF_FFTYPETXT, RTF_FFTYPETXT,
+sRTF_FLDTYPE, RTF_FLDTYPE,
+sRTF_FNAME, RTF_FNAME,
+sRTF_FORMFIELD, RTF_FORMFIELD,
+sRTF_FROMTEXT, RTF_FROMTEXT,
+sRTF_FTNNCHOSUNG, RTF_FTNNCHOSUNG,
+sRTF_FTNNCNUM, RTF_FTNNCNUM,
+sRTF_FTNNDBAR, RTF_FTNNDBAR,
+sRTF_FTNNDBNUM, RTF_FTNNDBNUM,
+sRTF_FTNNDBNUMD, RTF_FTNNDBNUMD,
+sRTF_FTNNDBNUMK, RTF_FTNNDBNUMK,
+sRTF_FTNNDBNUMT, RTF_FTNNDBNUMT,
+sRTF_FTNNGANADA, RTF_FTNNGANADA,
+sRTF_FTNNGBNUM, RTF_FTNNGBNUM,
+sRTF_FTNNGBNUMD, RTF_FTNNGBNUMD,
+sRTF_FTNNGBNUMK, RTF_FTNNGBNUMK,
+sRTF_FTNNGBNUML, RTF_FTNNGBNUML,
+sRTF_FTNNZODIAC, RTF_FTNNZODIAC,
+sRTF_FTNNZODIACD, RTF_FTNNZODIACD,
+sRTF_FTNNZODIACL, RTF_FTNNZODIACL,
+sRTF_G, RTF_G,
+sRTF_GCW, RTF_GCW,
+sRTF_GRIDTBL, RTF_GRIDTBL,
+sRTF_HIGHLIGHT, RTF_HIGHLIGHT,
+sRTF_HLFR, RTF_HLFR,
+sRTF_HLINKBASE, RTF_HLINKBASE,
+sRTF_HLLOC, RTF_HLLOC,
+sRTF_HLSRC, RTF_HLSRC,
+sRTF_ILVL, RTF_ILVL,
+sRTF_IMPR, RTF_IMPR,
+sRTF_JPEGBLIP, RTF_JPEGBLIP,
+sRTF_LEVELFOLLOW, RTF_LEVELFOLLOW,
+sRTF_LEVELINDENT, RTF_LEVELINDENT,
+sRTF_LEVELJC, RTF_LEVELJC,
+sRTF_LEVELLEGAL, RTF_LEVELLEGAL,
+sRTF_LEVELNFC, RTF_LEVELNFC,
+sRTF_LEVELNORESTART,RTF_LEVELNORESTART,
+sRTF_LEVELNUMBERS, RTF_LEVELNUMBERS,
+sRTF_LEVELOLD, RTF_LEVELOLD,
+sRTF_LEVELPREV, RTF_LEVELPREV,
+sRTF_LEVELPREVSPACE,RTF_LEVELPREVSPACE,
+sRTF_LEVELSPACE, RTF_LEVELSPACE,
+sRTF_LEVELSTARTAT, RTF_LEVELSTARTAT,
+sRTF_LEVELTEXT, RTF_LEVELTEXT,
+sRTF_LINKVAL, RTF_LINKVAL,
+sRTF_LIST, RTF_LIST,
+sRTF_LISTID, RTF_LISTID,
+sRTF_LISTLEVEL, RTF_LISTLEVEL,
+sRTF_LISTNAME, RTF_LISTNAME,
+sRTF_LISTOVERRIDE, RTF_LISTOVERRIDE,
+sRTF_LISTOVERRIDECOUNT, RTF_LISTOVERRIDECOUNT,
+sRTF_LISTOVERRIDEFORMAT, RTF_LISTOVERRIDEFORMAT,
+sRTF_LISTOVERRIDESTART, RTF_LISTOVERRIDESTART,
+sRTF_LISTOVERRIDETABLE, RTF_LISTOVERRIDETABLE,
+sRTF_LISTRESTARTHDN,RTF_LISTRESTARTHDN,
+sRTF_LISTSIMPLE, RTF_LISTSIMPLE,
+sRTF_LISTTABLE, RTF_LISTTABLE,
+sRTF_LISTTEMPLATEID,RTF_LISTTEMPLATEID,
+sRTF_LISTTEXT, RTF_LISTTEXT,
+sRTF_LS, RTF_LS,
+sRTF_LYTEXCTTP, RTF_LYTEXCTTP,
+sRTF_LYTPRTMET, RTF_LYTPRTMET,
+sRTF_MANAGER, RTF_MANAGER,
+sRTF_MSMCAP, RTF_MSMCAP,
+sRTF_NOFCHARSWS, RTF_NOFCHARSWS,
+sRTF_NOLEAD, RTF_NOLEAD,
+sRTF_NONSHPPICT, RTF_NONSHPPICT,
+sRTF_NOSECTEXPAND, RTF_NOSECTEXPAND,
+sRTF_NOSNAPLINEGRID,RTF_NOSNAPLINEGRID,
+sRTF_NOSPACEFORUL, RTF_NOSPACEFORUL,
+sRTF_NOULTRLSPC, RTF_NOULTRLSPC,
+sRTF_NOXLATTOYEN, RTF_NOXLATTOYEN,
+sRTF_OBJATTPH, RTF_OBJATTPH,
+sRTF_OBJHTML, RTF_OBJHTML,
+sRTF_OBJOCX, RTF_OBJOCX,
+sRTF_OLDLINEWRAP, RTF_OLDLINEWRAP,
+sRTF_OUTLINELEVEL, RTF_OUTLINELEVEL,
+sRTF_OVERLAY, RTF_OVERLAY,
+sRTF_PANOSE, RTF_PANOSE,
+sRTF_PGBRDRB, RTF_PGBRDRB,
+sRTF_PGBRDRFOOT, RTF_PGBRDRFOOT,
+sRTF_PGBRDRHEAD, RTF_PGBRDRHEAD,
+sRTF_PGBRDRL, RTF_PGBRDRL,
+sRTF_PGBRDROPT, RTF_PGBRDROPT,
+sRTF_PGBRDRR, RTF_PGBRDRR,
+sRTF_PGBRDRSNAP, RTF_PGBRDRSNAP,
+sRTF_PGBRDRT, RTF_PGBRDRT,
+sRTF_PGNCHOSUNG, RTF_PGNCHOSUNG,
+sRTF_PGNCNUM, RTF_PGNCNUM,
+sRTF_PGNDBNUMK, RTF_PGNDBNUMK,
+sRTF_PGNDBNUMT, RTF_PGNDBNUMT,
+sRTF_PGNGANADA, RTF_PGNGANADA,
+sRTF_PGNGBNUM, RTF_PGNGBNUM,
+sRTF_PGNGBNUMD, RTF_PGNGBNUMD,
+sRTF_PGNGBNUMK, RTF_PGNGBNUMK,
+sRTF_PGNGBNUML, RTF_PGNGBNUML,
+sRTF_PGNZODIAC, RTF_PGNZODIAC,
+sRTF_PGNZODIACD, RTF_PGNZODIACD,
+sRTF_PGNZODIACL, RTF_PGNZODIACL,
+sRTF_PICPROP, RTF_PICPROP,
+sRTF_PNAIUEO, RTF_PNAIUEO,
+sRTF_PNAIUEOD, RTF_PNAIUEOD,
+sRTF_PNCHOSUNG, RTF_PNCHOSUNG,
+sRTF_PNDBNUMD, RTF_PNDBNUMD,
+sRTF_PNDBNUMK, RTF_PNDBNUMK,
+sRTF_PNDBNUML, RTF_PNDBNUML,
+sRTF_PNDBNUMT, RTF_PNDBNUMT,
+sRTF_PNGANADA, RTF_PNGANADA,
+sRTF_PNGBLIP, RTF_PNGBLIP,
+sRTF_PNGBNUM, RTF_PNGBNUM,
+sRTF_PNGBNUMD, RTF_PNGBNUMD,
+sRTF_PNGBNUMK, RTF_PNGBNUMK,
+sRTF_PNGBNUML, RTF_PNGBNUML,
+sRTF_PNRAUTH, RTF_PNRAUTH,
+sRTF_PNRDATE, RTF_PNRDATE,
+sRTF_PNRNFC, RTF_PNRNFC,
+sRTF_PNRNOT, RTF_PNRNOT,
+sRTF_PNRPNBR, RTF_PNRPNBR,
+sRTF_PNRRGB, RTF_PNRRGB,
+sRTF_PNRSTART, RTF_PNRSTART,
+sRTF_PNRSTOP, RTF_PNRSTOP,
+sRTF_PNRXST, RTF_PNRXST,
+sRTF_PNZODIAC, RTF_PNZODIAC,
+sRTF_PNZODIACD, RTF_PNZODIACD,
+sRTF_PNZODIACL, RTF_PNZODIACL,
+sRTF_LFOLEVEL, RTF_LFOLEVEL,
+sRTF_POSYIN, RTF_POSYIN,
+sRTF_POSYOUT, RTF_POSYOUT,
+sRTF_PRIVATE, RTF_PRIVATE,
+sRTF_PROPNAME, RTF_PROPNAME,
+sRTF_PROPTYPE, RTF_PROPTYPE,
+sRTF_REVAUTHDEL, RTF_REVAUTHDEL,
+sRTF_REVDTTMDEL, RTF_REVDTTMDEL,
+sRTF_SAUTOUPD, RTF_SAUTOUPD,
+sRTF_SECTDEFAULTCL, RTF_SECTDEFAULTCL,
+sRTF_SECTEXPAND, RTF_SECTEXPAND,
+sRTF_SECTLINEGRID, RTF_SECTLINEGRID,
+sRTF_SECTSPECIFYCL, RTF_SECTSPECIFYCL,
+sRTF_SECTSPECIFYL, RTF_SECTSPECIFYL,
+sRTF_SHIDDEN, RTF_SHIDDEN,
+sRTF_SHPBOTTOM, RTF_SHPBOTTOM,
+sRTF_SHPBXCOLUMN, RTF_SHPBXCOLUMN,
+sRTF_SHPBXMARGIN, RTF_SHPBXMARGIN,
+sRTF_SHPBXPAGE, RTF_SHPBXPAGE,
+sRTF_SHPBYMARGIN, RTF_SHPBYMARGIN,
+sRTF_SHPBYPAGE, RTF_SHPBYPAGE,
+sRTF_SHPBYPARA, RTF_SHPBYPARA,
+sRTF_SHPFBLWTXT, RTF_SHPFBLWTXT,
+sRTF_SHPFHDR, RTF_SHPFHDR,
+sRTF_SHPGRP, RTF_SHPGRP,
+sRTF_SHPLEFT, RTF_SHPLEFT,
+sRTF_SHPLID, RTF_SHPLID,
+sRTF_SHPLOCKANCHOR, RTF_SHPLOCKANCHOR,
+sRTF_SHPPICT, RTF_SHPPICT,
+sRTF_SHPRIGHT, RTF_SHPRIGHT,
+sRTF_SHPRSLT, RTF_SHPRSLT,
+sRTF_SHPTOP, RTF_SHPTOP,
+sRTF_SHPTXT, RTF_SHPTXT,
+sRTF_SHPWRK, RTF_SHPWRK,
+sRTF_SHPWR, RTF_SHPWR,
+sRTF_SHPZ, RTF_SHPZ,
+sRTF_SPRSBSP, RTF_SPRSBSP,
+sRTF_SPRSLNSP, RTF_SPRSLNSP,
+sRTF_SPRSTSM, RTF_SPRSTSM,
+sRTF_STATICVAL, RTF_STATICVAL,
+sRTF_STEXTFLOW, RTF_STEXTFLOW,
+sRTF_STRIKEDL, RTF_STRIKEDL,
+sRTF_SUBFONTBYSIZE, RTF_SUBFONTBYSIZE,
+sRTF_TCELLD, RTF_TCELLD,
+sRTF_TIME, RTF_TIME,
+sRTF_TRUNCATEFONTHEIGHT, RTF_TRUNCATEFONTHEIGHT,
+sRTF_UC, RTF_UC,
+sRTF_UD, RTF_UD,
+sRTF_ULDASH, RTF_ULDASH,
+sRTF_ULDASHD, RTF_ULDASHD,
+sRTF_ULDASHDD, RTF_ULDASHDD,
+sRTF_ULTH, RTF_ULTH,
+sRTF_ULWAVE, RTF_ULWAVE,
+sRTF_U, RTF_U,
+sRTF_UPR, RTF_UPR,
+sRTF_USERPROPS, RTF_USERPROPS,
+sRTF_VIEWKIND, RTF_VIEWKIND,
+sRTF_VIEWSCALE, RTF_VIEWSCALE,
+sRTF_VIEWZK, RTF_VIEWZK,
+sRTF_WIDCTLPAR, RTF_WIDCTLPAR,
+sRTF_WINDOWCAPTION, RTF_WINDOWCAPTION,
+sRTF_WPEQN, RTF_WPEQN,
+sRTF_WPJST, RTF_WPJST,
+sRTF_WPSP, RTF_WPSP,
+sRTF_YXE, RTF_YXE,
+
+// MS-2000 Tokens
+sRTF_ULTHD, RTF_ULTHD,
+sRTF_ULTHDASH, RTF_ULTHDASH,
+sRTF_ULLDASH, RTF_ULLDASH,
+sRTF_ULTHLDASH, RTF_ULTHLDASH,
+sRTF_ULTHDASHD, RTF_ULTHDASHD,
+sRTF_ULTHDASHDD, RTF_ULTHDASHDD,
+sRTF_ULHWAVE, RTF_ULHWAVE,
+sRTF_ULULDBWAVE, RTF_ULULDBWAVE,
+
+
+// SWG spezifische Attribute
+sRTF_GRFALIGNV, RTF_GRF_ALIGNV,
+sRTF_GRFALIGNH, RTF_GRF_ALIGNH,
+sRTF_GRFMIRROR, RTF_GRF_MIRROR,
+sRTF_HEADERYB, RTF_HEADER_YB,
+sRTF_HEADERXL, RTF_HEADER_XL,
+sRTF_HEADERXR, RTF_HEADER_XR,
+sRTF_FOOTERYT, RTF_FOOTER_YT,
+sRTF_FOOTERXL, RTF_FOOTER_XL,
+sRTF_FOOTERXR, RTF_FOOTER_XR,
+sRTF_HEADERYH, RTF_HEADER_YH,
+sRTF_FOOTERYH, RTF_FOOTER_YH,
+sRTF_BALANCEDCOLUMN,RTF_BALANCED_COLUMN,
+sRTF_UPDNPROP, RTF_SWG_ESCPROP,
+sRTF_PRTDATA, RTF_SWG_PRTDATA,
+sRTF_BKMKKEY, RTF_BKMK_KEY,
+
+// Attribute fuer die freifliegenden Rahmen
+sRTF_FLYPRINT, RTF_FLYPRINT,
+sRTF_FLYOPAQUE, RTF_FLYOPAQUE,
+sRTF_FLYPRTCTD, RTF_FLYPRTCTD,
+sRTF_FLYMAINCNT, RTF_FLYMAINCNT,
+sRTF_FLYVERT, RTF_FLYVERT,
+sRTF_FLYHORZ, RTF_FLYHORZ,
+sRTF_DFRMTXTL, RTF_FLYOUTLEFT,
+sRTF_DFRMTXTR, RTF_FLYOUTRIGHT,
+sRTF_DFRMTXTU, RTF_FLYOUTUPPER,
+sRTF_DFRMTXTW, RTF_FLYOUTLOWER,
+sRTF_FLYANCHOR, RTF_FLYANCHOR,
+sRTF_FLYCNTNT, RTF_FLY_CNTNT,
+sRTF_FLYCOLUMN, RTF_FLY_COLUMN,
+sRTF_FLYPAGE, RTF_FLY_PAGE,
+
+sRTF_BRDBOX, RTF_BRDBOX,
+sRTF_BRDLNCOL, RTF_BRDLINE_COL,
+sRTF_BRDLNIN, RTF_BRDLINE_IN,
+sRTF_BRDLNOUT, RTF_BRDLINE_OUT,
+sRTF_BRDLNDIST, RTF_BRDLINE_DIST,
+
+sRTF_SHADOW, RTF_SHADOW,
+sRTF_SHDWDIST, RTF_SHDW_DIST,
+sRTF_SHDWSTYLE, RTF_SHDW_STYLE,
+sRTF_SHDWCOL, RTF_SHDW_COL,
+sRTF_SHDWFCOL, RTF_SHDW_FCOL,
+
+sRTF_FLYINPARA, RTF_FLY_INPARA,
+
+sRTF_PGDSCTBL, RTF_PGDSCTBL,
+sRTF_PGDSC, RTF_PGDSC,
+sRTF_PGDSCUSE, RTF_PGDSCUSE,
+sRTF_PGDSCNXT, RTF_PGDSCNXT,
+
+sRTF_HYPHEN, RTF_HYPHEN,
+sRTF_HYPHLEAD, RTF_HYPHLEAD,
+sRTF_HYPHTRAIL, RTF_HYPHTRAIL,
+sRTF_HYPHMAX, RTF_HYPHMAX,
+
+sRTF_TLSWG, RTF_TLSWG,
+sRTF_PGBRK, RTF_PGBRK,
+
+sRTF_PGDSCNO, RTF_PGDSCNO,
+sRTF_SOUTLVL, RTF_SOUTLVL
+
+};
+
+
+
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+_Optlink
+#endif
+ RTFKeyCompare( const void *pFirst, const void *pSecond)
+{
+ int nRet = 0;
+ if( -1 == ((RTF_TokenEntry*)pFirst)->nToken )
+ {
+ if( -1 == ((RTF_TokenEntry*)pSecond)->nToken )
+ nRet = ((RTF_TokenEntry*)pFirst)->pUToken->CompareTo(
+ *((RTF_TokenEntry*)pSecond)->pUToken );
+ else
+ nRet = ((RTF_TokenEntry*)pFirst)->pUToken->CompareToAscii(
+ ((RTF_TokenEntry*)pSecond)->sToken );
+ }
+ else
+ {
+ if( -1 == ((RTF_TokenEntry*)pSecond)->nToken )
+ nRet = -1 * ((RTF_TokenEntry*)pSecond)->pUToken->CompareToAscii(
+ ((RTF_TokenEntry*)pFirst)->sToken );
+ else
+ nRet = strcmp( ((RTF_TokenEntry*)pFirst)->sToken,
+ ((RTF_TokenEntry*)pSecond)->sToken );
+ }
+
+ return nRet;
+}
+
+int GetRTFToken( const String& rSearch )
+{
+ if( !bSortKeyWords )
+ {
+ qsort( (void*) aRTFTokenTab,
+ sizeof( aRTFTokenTab ) / sizeof( RTF_TokenEntry ),
+ sizeof( RTF_TokenEntry ),
+ RTFKeyCompare );
+ bSortKeyWords = TRUE;
+ }
+
+ int nRet = 0;
+ void* pFound;
+ RTF_TokenEntry aSrch;
+ aSrch.pUToken = &rSearch;
+ aSrch.nToken = -1;
+
+ if( 0 != ( pFound = bsearch( (char *) &aSrch,
+ (void*) aRTFTokenTab,
+ sizeof( aRTFTokenTab ) / sizeof( RTF_TokenEntry ),
+ sizeof( RTF_TokenEntry ),
+ RTFKeyCompare )))
+ nRet = ((RTF_TokenEntry*)pFound)->nToken;
+ return nRet;
+}
+
+
diff --git a/svtools/source/svrtf/rtfkeywd.hxx b/svtools/source/svrtf/rtfkeywd.hxx
new file mode 100644
index 000000000000..f498c1c2f147
--- /dev/null
+++ b/svtools/source/svrtf/rtfkeywd.hxx
@@ -0,0 +1,1197 @@
+/*************************************************************************
+ *
+ * $RCSfile: rtfkeywd.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTFKEYWD_HXX
+#define _RTFKEYWD_HXX
+
+#ifndef _STRING_HXX //autogen
+#include <tools/string.hxx>
+#endif
+
+#ifndef SVTOOLS_CONSTASCII_DECL
+#define SVTOOLS_CONSTASCII_DECL( n, s ) n[sizeof(s)]
+#endif
+#ifndef SVTOOLS_CONSTASCII_DEF
+#define SVTOOLS_CONSTASCII_DEF( n, s ) n[sizeof(s)] = s
+#endif
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEXCHAR, "\\'" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_IGNORE, "\\*" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OPTHYPH, "\\-" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SUBENTRY, "\\:" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ABSH, "\\absh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ABSW, "\\absw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ALT, "\\alt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ANNOTATION, "\\annotation" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ANSI, "\\ansi" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ATNID, "\\atnid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AUTHOR, "\\author" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_B, "\\b" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGBDIAG, "\\bgbdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGCROSS, "\\bgcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGDCROSS, "\\bgdcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGDKBDIAG, "\\bgdkbdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGDKCROSS, "\\bgdkcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGDKDCROSS, "\\bgdkdcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGDKFDIAG, "\\bgdkfdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGDKHORIZ, "\\bgdkhoriz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGDKVERT, "\\bgdkvert" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGFDIAG, "\\bgfdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGHORIZ, "\\bghoriz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BGVERT, "\\bgvert" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BIN, "\\bin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BINFSXN, "\\binfsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BINSXN, "\\binsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BKMKCOLF, "\\bkmkcolf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BKMKCOLL, "\\bkmkcoll" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BKMKEND, "\\bkmkend" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BKMKSTART, "\\bkmkstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BLUE, "\\blue" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BOX, "\\box" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRB, "\\brdrb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRBAR, "\\brdrbar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRBTW, "\\brdrbtw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRCF, "\\brdrcf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRDB, "\\brdrdb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRDOT, "\\brdrdot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRHAIR, "\\brdrhair" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRL, "\\brdrl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRR, "\\brdrr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRS, "\\brdrs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRSH, "\\brdrsh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRT, "\\brdrt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTH, "\\brdrth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRW, "\\brdrw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRSP, "\\brsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BULLET, "\\bullet" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BUPTIM, "\\buptim" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BXE, "\\bxe" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CAPS, "\\caps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CB, "\\cb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CBPAT, "\\cbpat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CELL, "\\cell" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CELLX, "\\cellx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CF, "\\cf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CFPAT, "\\cfpat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHATN, "\\chatn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHDATE, "\\chdate" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHDPA, "\\chdpa" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHDPL, "\\chdpl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHFTN, "\\chftn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHFTNSEP, "\\chftnsep" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHFTNSEPC, "\\chftnsepc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHPGN, "\\chpgn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHTIME, "\\chtime" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGBDIAG, "\\clbgbdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGCROSS, "\\clbgcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGDCROSS, "\\clbgdcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGDKBDIAG, "\\clbgdkbdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGDKCROSS, "\\clbgdkcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGDKDCROSS, "\\clbgdkdcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGDKFDIAG, "\\clbgdkfdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGDKHOR, "\\clbgdkhor" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGDKVERT, "\\clbgdkvert" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGFDIAG, "\\clbgfdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGHORIZ, "\\clbghoriz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBGVERT, "\\clbgvert" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBRDRB, "\\clbrdrb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBRDRL, "\\clbrdrl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBRDRR, "\\clbrdrr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLBRDRT, "\\clbrdrt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLCBPAT, "\\clcbpat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLCFPAT, "\\clcfpat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLMGF, "\\clmgf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLMRG, "\\clmrg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLSHDNG, "\\clshdng" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COLNO, "\\colno" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COLORTBL, "\\colortbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COLS, "\\cols" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COLSR, "\\colsr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COLSX, "\\colsx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COLUMN, "\\column" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COLW, "\\colw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COMMENT, "\\comment" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CREATIM, "\\creatim" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CTRL, "\\ctrl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DEFF, "\\deff" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DEFFORMAT, "\\defformat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DEFLANG, "\\deflang" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DEFTAB, "\\deftab" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DELETED, "\\deleted" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRMTXTX, "\\dfrmtxtx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRMTXTY, "\\dfrmtxty" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DIBITMAP, "\\dibitmap" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DN, "\\dn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOCCOMM, "\\doccomm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOCTEMP, "\\doctemp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DROPCAPLI, "\\dropcapli" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DROPCAPLT, "\\dropcapt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DXFRTEXT, "\\dxfrtext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DY, "\\dy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EDMINS, "\\edmins" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EMDASH, "\\emdash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ENDASH, "\\endash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ENDDOC, "\\enddoc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ENDNHERE, "\\endnhere" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ENDNOTES, "\\endnotes" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EXPND, "\\expnd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EXPNDTW, "\\expndtw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_F, "\\f" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FACINGP, "\\facingp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FACPGSXN, "\\facpgsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FALT, "\\falt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FCHARSET, "\\fcharset" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FDECOR, "\\fdecor" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FI, "\\fi" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FIELD, "\\field" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDDIRTY, "\\flddirty" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDEDIT, "\\fldedit" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDINST, "\\fldinst" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDLOCK, "\\fldlock" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDPRIV, "\\fldpriv" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDRSLT, "\\fldrslt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FMODERN, "\\fmodern" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FN, "\\fn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FNIL, "\\fnil" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FONTTBL, "\\fonttbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTER, "\\footer" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERF, "\\footerf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERL, "\\footerl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERR, "\\footerr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERY, "\\footery" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTNOTE, "\\footnote" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FPRQ, "\\fprq" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FRACWIDTH, "\\fracwidth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FROMAN, "\\froman" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FS, "\\fs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FSCRIPT, "\\fscript" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FSWISS, "\\fswiss" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTECH, "\\ftech" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNBJ, "\\ftnbj" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNCN, "\\ftncn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNRESTART, "\\ftnrestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNSEP, "\\ftnsep" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNSEPC, "\\ftnsepc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNSTART, "\\ftnstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNTJ, "\\ftntj" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GREEN, "\\green" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GUTTER, "\\gutter" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GUTTERSXN, "\\guttersxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADER, "\\header" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERF, "\\headerf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERL, "\\headerl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERR, "\\headerr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERY, "\\headery" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HR, "\\hr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHHOTZ, "\\hyphhotz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_I, "\\i" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ID, "\\id" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_INFO, "\\info" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_INTBL, "\\intbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_IXE, "\\ixe" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_KEEP, "\\keep" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_KEEPN, "\\keepn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_KERNING, "\\kerning" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_KEYCODE, "\\keycode" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_KEYWORDS, "\\keywords" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LANDSCAPE, "\\landscape" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LANG, "\\lang" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LDBLQUOTE, "\\ldblquote" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVEL, "\\level" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LI, "\\li" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINE, "\\line" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINEBETCOL, "\\linebetcol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINECONT, "\\linecont" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINEMOD, "\\linemod" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINEPPAGE, "\\lineppage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINERESTART, "\\linerestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINESTART, "\\linestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINESTARTS, "\\linestarts" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINEX, "\\linex" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LNDSCPSXN, "\\lndscpsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LQUOTE, "\\lquote" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MAC, "\\mac" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MACPICT, "\\macpict" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MAKEBACKUP, "\\makebackup" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGB, "\\margb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGBSXN, "\\margbsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGL, "\\margl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGLSXN, "\\marglsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGMIRROR, "\\margmirror" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGR, "\\margr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGRSXN, "\\margrsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGT, "\\margt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MARGTSXN, "\\margtsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MIN, "\\min" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MO, "\\mo" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NEXTCSET, "\\nextcset" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NEXTFILE, "\\nextfile" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOFCHARS, "\\nofchars" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOFPAGES, "\\nofpages" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOFWORDS, "\\nofwords" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOLINE, "\\noline" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOSUPERSUB, "\\nosupersub" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOWRAP, "\\nowrap" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OPERATOR, "\\operator" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OUTL, "\\outl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PAGE, "\\page" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PAGEBB, "\\pagebb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PAPERH, "\\paperh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PAPERW, "\\paperw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PAR, "\\par" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PARD, "\\pard" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PC, "\\pc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PCA, "\\pca" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGHSXN, "\\pghsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNCONT, "\\pgncont" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNDEC, "\\pgndec" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNLCLTR, "\\pgnlcltr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNLCRM, "\\pgnlcrm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNRESTART, "\\pgnrestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNSTART, "\\pgnstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNSTARTS, "\\pgnstarts" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNUCLTR, "\\pgnucltr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNUCRM, "\\pgnucrm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNX, "\\pgnx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNY, "\\pgny" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGWSXN, "\\pgwsxn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PHCOL, "\\phcol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PHMRG, "\\phmrg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PHPG, "\\phpg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICCROPB, "\\piccropb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICCROPL, "\\piccropl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICCROPR, "\\piccropr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICCROPT, "\\piccropt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICH, "\\pich" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICHGOAL, "\\pichgoal" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICSCALED, "\\picscaled" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICSCALEX, "\\picscalex" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICSCALEY, "\\picscaley" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICT, "\\pict" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICW, "\\picw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICWGOAL, "\\picwgoal" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PLAIN, "\\plain" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PMMETAFILE, "\\pmmetafile" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSNEGX, "\\posnegx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSNEGY, "\\posnegy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSX, "\\posx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSXC, "\\posxc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSXI, "\\posxi" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSXL, "\\posxl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSXO, "\\posxo" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSXR, "\\posxr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSY, "\\posy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSYB, "\\posyb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSYC, "\\posyc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSYIL, "\\posyil" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSYT, "\\posyt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PRINTIM, "\\printim" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PSOVER, "\\psover" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PVMRG, "\\pvmrg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PVPARA, "\\pvpara" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PVPG, "\\pvpg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_QC, "\\qc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_QJ, "\\qj" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_QL, "\\ql" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_QR, "\\qr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RDBLQUOTE, "\\rdblquote" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RED, "\\red" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVBAR, "\\revbar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVISED, "\\revised" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVISIONS, "\\revisions" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVPROP, "\\revprop" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVTIM, "\\revtim" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RI, "\\ri" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ROW, "\\row" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RQUOTE, "\\rquote" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RTF, "\\rtf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RXE, "\\rxe" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_S, "\\s" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SA, "\\sa" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SB, "\\sb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SBASEDON, "\\sbasedon" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SBKCOL, "\\sbkcol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SBKEVEN, "\\sbkeven" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SBKNONE, "\\sbknone" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SBKODD, "\\sbkodd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SBKPAGE, "\\sbkpage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SBYS, "\\sbys" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SCAPS, "\\scaps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECT, "\\sect" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTD, "\\sectd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHAD, "\\shad" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHADING, "\\shading" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHIFT, "\\shift" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SL, "\\sl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SNEXT, "\\snext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_STRIKE, "\\strike" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_STYLESHEET, "\\stylesheet" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SUB, "\\sub" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SUBJECT, "\\subject" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SUPER, "\\super" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TAB, "\\tab" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TB, "\\tb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TC, "\\tc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TCF, "\\tcf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TCL, "\\tcl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TEMPLATE, "\\template" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TITLE, "\\title" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TITLEPG, "\\titlepg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TLDOT, "\\tldot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TLEQ, "\\tleq" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TLHYPH, "\\tlhyph" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TLTH, "\\tlth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TLUL, "\\tlul" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TQC, "\\tqc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TQDEC, "\\tqdec" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TQR, "\\tqr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TQL, "\\tql" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRGAPH, "\\trgaph" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRLEFT, "\\trleft" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TROWD, "\\trowd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRQC, "\\trqc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRQL, "\\trql" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRQR, "\\trqr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRRH, "\\trrh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TX, "\\tx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TXE, "\\txe" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_UL, "\\ul" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULD, "\\uld" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULDB, "\\uldb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULNONE, "\\ulnone" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULW, "\\ulw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_UP, "\\up" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_V, "\\v" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VERN, "\\vern" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VERSION, "\\version" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VERTALB, "\\vertalb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VERTALC, "\\vertalc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VERTALJ, "\\vertalj" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VERTALT, "\\vertalt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WBITMAP, "\\wbitmap" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WBMBITSPIXEL, "\\wbmbitspixel" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WBMPLANES, "\\wbmplanes" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WBMWIDTHBYTES, "\\wbmwidthbytes" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WIDOWCTRL, "\\widowctrl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WMETAFILE, "\\wmetafile" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_XE, "\\xe" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_YR, "\\yr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOBRKHYPH, "\\_" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FORMULA, "\\|" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOBREAK, "\\~" );
+
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AB, "\\ab" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ACAPS, "\\acaps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ACF, "\\acf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ADDITIVE, "\\additive" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ADN, "\\adn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AENDDOC, "\\aenddoc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AENDNOTES, "\\aendnotes" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AEXPND, "\\aexpnd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AF, "\\af" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFS, "\\afs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNBJ, "\\aftnbj" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNCN, "\\aftncn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNALC, "\\aftnnalc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNAR, "\\aftnnar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNAUC, "\\aftnnauc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNCHI, "\\aftnnchi" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNRLC, "\\aftnnrlc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNRUC, "\\aftnnruc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNRESTART, "\\aftnrestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNRSTCONT, "\\aftnrstcont" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNSEP, "\\aftnsep" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNSEPC, "\\aftnsepc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNSTART, "\\aftnstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNTJ, "\\aftntj" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AI, "\\ai" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ALANG, "\\alang" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ALLPROT, "\\allprot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ANNOTPROT, "\\annotprot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AOUTL, "\\aoutl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ASCAPS, "\\ascaps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ASHAD, "\\ashad" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ASTRIKE, "\\astrike" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ATNAUTHOR, "\\atnauthor" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ATNICN, "\\atnicn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ATNREF, "\\atnref" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ATNTIME, "\\atntime" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ATRFEND, "\\atrfend" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ATRFSTART, "\\atrfstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AUL, "\\aul" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AULD, "\\auld" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AULDB, "\\auldb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AULNONE, "\\aulnone" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AULW, "\\aulw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AUP, "\\aup" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BKMKPUB, "\\bkmkpub" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRDASH, "\\brdrdash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRKFRM, "\\brkfrm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CCHS, "\\cchs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CPG, "\\cpg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CS, "\\cs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CVMME, "\\cvmme" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DATAFIELD, "\\datafield" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DO, "\\do" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOBXCOLUMN, "\\dobxcolumn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOBXMARGIN, "\\dobxmargin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOBXPAGE, "\\dobxpage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOBYMARGIN, "\\dobymargin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOBYPAGE, "\\dobypage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOBYPARA, "\\dobypara" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DODHGT, "\\dodhgt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOLOCK, "\\dolock" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPAENDHOL, "\\dpaendhol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPAENDL, "\\dpaendl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPAENDSOL, "\\dpaendsol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPAENDW, "\\dpaendw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPARC, "\\dparc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPARCFLIPX, "\\dparcflipx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPARCFLIPY, "\\dparcflipy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPASTARTHOL, "\\dpastarthol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPASTARTL, "\\dpastartl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPASTARTSOL, "\\dpastartsol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPASTARTW, "\\dpastartw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCALLOUT, "\\dpcallout" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOA, "\\dpcoa" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOACCENT, "\\dpcoaccent" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOBESTFIT, "\\dpcobestfit" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOBORDER, "\\dpcoborder" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCODABS, "\\dpcodabs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCODBOTTOM, "\\dpcodbottom" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCODCENTER, "\\dpcodcenter" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCODTOP, "\\dpcodtop" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOLENGTH, "\\dpcolength" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOMINUSX, "\\dpcominusx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOMINUSY, "\\dpcominusy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOOFFSET, "\\dpcooffset" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOSMARTA, "\\dpcosmarta" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOTDOUBLE, "\\dpcotdouble" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOTRIGHT, "\\dpcotright" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOTSINGLE, "\\dpcotsingle" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOTTRIPLE, "\\dpcottriple" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCOUNT, "\\dpcount" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPELLIPSE, "\\dpellipse" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPENDGROUP, "\\dpendgroup" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLBGCB, "\\dpfillbgcb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLBGCG, "\\dpfillbgcg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLBGCR, "\\dpfillbgcr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLBGGRAY, "\\dpfillbggray" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLBGPAL, "\\dpfillbgpal" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLFGCB, "\\dpfillfgcb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLFGCG, "\\dpfillfgcg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLFGCR, "\\dpfillfgcr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLFGGRAY, "\\dpfillfggray" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLFGPAL, "\\dpfillfgpal" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPFILLPAT, "\\dpfillpat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPGROUP, "\\dpgroup" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINE, "\\dpline" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINECOB, "\\dplinecob" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINECOG, "\\dplinecog" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINECOR, "\\dplinecor" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEDADO, "\\dplinedado" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEDADODO, "\\dplinedadodo" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEDASH, "\\dplinedash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEDOT, "\\dplinedot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEGRAY, "\\dplinegray" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEHOLLOW, "\\dplinehollow" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEPAL, "\\dplinepal" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINESOLID, "\\dplinesolid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPLINEW, "\\dplinew" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPPOLYCOUNT, "\\dppolycount" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPPOLYGON, "\\dppolygon" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPPOLYLINE, "\\dppolyline" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPPTX, "\\dpptx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPPTY, "\\dppty" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPRECT, "\\dprect" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPROUNDR, "\\dproundr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPSHADOW, "\\dpshadow" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPSHADX, "\\dpshadx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPSHADY, "\\dpshady" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPTXBX, "\\dptxbx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPTXBXMAR, "\\dptxbxmar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPTXBXTEXT, "\\dptxbxtext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPX, "\\dpx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPXSIZE, "\\dpxsize" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPY, "\\dpy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPYSIZE, "\\dpysize" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DS, "\\ds" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EMSPACE, "\\emspace" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ENSPACE, "\\enspace" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FBIDI, "\\fbidi" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FET, "\\fet" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FID, "\\fid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FILE, "\\file" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FILETBL, "\\filetbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDALT, "\\fldalt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FNETWORK, "\\fnetwork" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FONTEMB, "\\fontemb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FONTFILE, "\\fontfile" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FORMDISP, "\\formdisp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FORMPROT, "\\formprot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FORMSHADE, "\\formshade" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOSNUM, "\\fosnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FRELATIVE, "\\frelative" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNALT, "\\ftnalt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNIL, "\\ftnil" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNALC, "\\ftnnalc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNAR, "\\ftnnar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNAUC, "\\ftnnauc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNCHI, "\\ftnnchi" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNRLC, "\\ftnnrlc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNRUC, "\\ftnnruc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNRSTCONT, "\\ftnrstcont" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNRSTPG, "\\ftnrstpg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTTRUETYPE, "\\fttruetype" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FVALIDDOS, "\\fvaliddos" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FVALIDHPFS, "\\fvalidhpfs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FVALIDMAC, "\\fvalidmac" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FVALIDNTFS, "\\fvalidntfs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHAUTO, "\\hyphauto" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHCAPS, "\\hyphcaps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHCONSEC, "\\hyphconsec" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHPAR, "\\hyphpar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINKSELF, "\\linkself" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINKSTYLES, "\\linkstyles" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LTRCH, "\\ltrch" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LTRDOC, "\\ltrdoc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LTRMARK, "\\ltrmark" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LTRPAR, "\\ltrpar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LTRROW, "\\ltrrow" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LTRSECT, "\\ltrsect" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOCOLBAL, "\\nocolbal" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOEXTRASPRL, "\\noextrasprl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOTABIND, "\\notabind" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOWIDCTLPAR, "\\nowidctlpar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJALIAS, "\\objalias" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJALIGN, "\\objalign" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJAUTLINK, "\\objautlink" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJCLASS, "\\objclass" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJCROPB, "\\objcropb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJCROPL, "\\objcropl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJCROPR, "\\objcropr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJCROPT, "\\objcropt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJDATA, "\\objdata" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJECT, "\\object" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJEMB, "\\objemb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJH, "\\objh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJICEMB, "\\objicemb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJLINK, "\\objlink" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJLOCK, "\\objlock" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJNAME, "\\objname" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJPUB, "\\objpub" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJSCALEX, "\\objscalex" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJSCALEY, "\\objscaley" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJSECT, "\\objsect" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJSETSIZE, "\\objsetsize" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJSUB, "\\objsub" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJTIME, "\\objtime" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJTRANSY, "\\objtransy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJUPDATE, "\\objupdate" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJW, "\\objw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OTBLRUL, "\\otblrul" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNHN, "\\pgnhn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNHNSC, "\\pgnhnsc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNHNSH, "\\pgnhnsh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNHNSM, "\\pgnhnsm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNHNSN, "\\pgnhnsn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNHNSP, "\\pgnhnsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICBMP, "\\picbmp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICBPP, "\\picbpp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PN, "\\pn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNACROSS, "\\pnacross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNB, "\\pnb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNCAPS, "\\pncaps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNCARD, "\\pncard" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNCF, "\\pncf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNDEC, "\\pndec" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNF, "\\pnf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNFS, "\\pnfs" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNHANG, "\\pnhang" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNI, "\\pni" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNINDENT, "\\pnindent" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNLCLTR, "\\pnlcltr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNLCRM, "\\pnlcrm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNLVL, "\\pnlvl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNLVLBLT, "\\pnlvlblt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNLVLBODY, "\\pnlvlbody" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNLVLCONT, "\\pnlvlcont" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNNUMONCE, "\\pnnumonce" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNORD, "\\pnord" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNORDT, "\\pnordt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNPREV, "\\pnprev" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNQC, "\\pnqc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNQL, "\\pnql" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNQR, "\\pnqr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRESTART, "\\pnrestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNSCAPS, "\\pnscaps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNSECLVL, "\\pnseclvl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNSP, "\\pnsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNSTART, "\\pnstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNSTRIKE, "\\pnstrike" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNTEXT, "\\pntext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNTXTA, "\\pntxta" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNTXTB, "\\pntxtb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNUCLTR, "\\pnucltr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNUCRM, "\\pnucrm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNUL, "\\pnul" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNULD, "\\pnuld" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNULDB, "\\pnuldb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNULNONE, "\\pnulnone" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNULW, "\\pnulw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PRCOLBL, "\\prcolbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PRINTDATA, "\\printdata" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PSZ, "\\psz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PUBAUTO, "\\pubauto" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RESULT, "\\result" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVAUTH, "\\revauth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVDTTM, "\\revdttm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVPROT, "\\revprot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVTBL, "\\revtbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RSLTBMP, "\\rsltbmp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RSLTMERGE, "\\rsltmerge" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RSLTPICT, "\\rsltpict" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RSLTRTF, "\\rsltrtf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RSLTTXT, "\\rslttxt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RTLCH, "\\rtlch" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RTLDOC, "\\rtldoc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RTLMARK, "\\rtlmark" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RTLPAR, "\\rtlpar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RTLROW, "\\rtlrow" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_RTLSECT, "\\rtlsect" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SEC, "\\sec" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTNUM, "\\sectnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTUNLOCKED, "\\sectunlocked" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SLMULT, "\\slmult" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SOFTCOL, "\\softcol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SOFTLHEIGHT, "\\softlheight" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SOFTLINE, "\\softline" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SOFTPAGE, "\\softpage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SPRSSPBF, "\\sprsspbf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SPRSTSP, "\\sprstsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SUBDOCUMENT, "\\subdocument" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SWPBDR, "\\swpbdr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TCN, "\\tcn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRANSMF, "\\transmf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRBRDRB, "\\trbrdrb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRBRDRH, "\\trbrdrh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRBRDRL, "\\trbrdrl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRBRDRR, "\\trbrdrr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRBRDRT, "\\trbrdrt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRBRDRV, "\\trbrdrv" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRHDR, "\\trhdr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRKEEP, "\\trkeep" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WRAPTRSP, "\\wraptrsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_XEF, "\\xef" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ZWJ, "\\zwj" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ZWNJ, "\\zwnj" );
+
+// neue Tokens zur 1.5
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ABSLOCK, "\\abslock" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ADJUSTRIGHT, "\\adjustright" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNCHOSUNG, "\\aftnnchosung" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNCNUM, "\\aftnncnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNDBAR, "\\aftnndbar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNDBNUM, "\\aftnndbnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNDBNUMD, "\\aftnndbnumd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNDBNUMK, "\\aftnndbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNDBNUMT, "\\aftnndbnumt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNGANADA, "\\aftnnganada" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNGBNUM, "\\aftnngbnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNGBNUMD, "\\aftnngbnumd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNGBNUMK, "\\aftnngbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNGBNUML, "\\aftnngbnuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNZODIAC, "\\aftnnzodiac" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNZODIACD, "\\aftnnzodiacd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_AFTNNZODIACL, "\\aftnnzodiacl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ANIMTEXT, "\\animtext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ANSICPG, "\\ansicpg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BACKGROUND, "\\background" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BDBFHDR, "\\bdbfhdr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BLIPTAG, "\\bliptag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BLIPUID, "\\blipuid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BLIPUPI, "\\blipupi" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRART, "\\brdrart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRDASHD, "\\brdrdashd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRDASHDD, "\\brdrdashdd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRDASHDOTSTR, "\\brdrdashdotstr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRDASHSM, "\\brdrdashsm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDREMBOSS, "\\brdremboss" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRENGRAVE, "\\brdrengrave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRFRAME, "\\brdrframe" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTHTNLG, "\\brdrthtnlg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTHTNMG, "\\brdrthtnmg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTHTNSG, "\\brdrthtnsg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTNTHLG, "\\brdrtnthlg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTNTHMG, "\\brdrtnthmg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTNTHSG, "\\brdrtnthsg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTNTHTNLG, "\\brdrtnthtnlg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTNTHTNMG, "\\brdrtnthtnmg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTNTHTNSG, "\\brdrtnthtnsg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRTRIPLE, "\\brdrtriple" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRWAVY, "\\brdrwavy" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDRWAVYDB, "\\brdrwavydb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CATEGORY, "\\category" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CGRID, "\\cgrid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHARSCALEX, "\\charscalex" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGBDIAG, "\\chbgbdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGCROSS, "\\chbgcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGDCROSS, "\\chbgdcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGDKBDIAG, "\\chbgdkbdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGDKCROSS, "\\chbgdkcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGDKDCROSS, "\\chbgdkdcross" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGDKFDIAG, "\\chbgdkfdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGDKHORIZ, "\\chbgdkhoriz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGDKVERT, "\\chbgdkvert" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGFDIAG, "\\chbgfdiag" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGHORIZ, "\\chbghoriz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBGVERT, "\\chbgvert" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHBRDR, "\\chbrdr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHCBPAT, "\\chcbpat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHCFPAT, "\\chcfpat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CHSHDNG, "\\chshdng" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLTXLRTB, "\\cltxlrtb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLTXTBRL, "\\cltxtbrl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLVERTALB, "\\clvertalb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLVERTALC, "\\clvertalc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLVERTALT, "\\clvertalt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLVMGF, "\\clvmgf" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLVMRG, "\\clvmrg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLTXTBRLV, "\\cltxtbrlv" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLTXBTLR, "\\cltxbtlr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CLTXLRTBV, "\\cltxlrtbv" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_COMPANY, "\\company" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CRAUTH, "\\crauth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_CRDATE, "\\crdate" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DATE, "\\date" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DEFLANGFE, "\\deflangfe" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRAUTH, "\\dfrauth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRDATE, "\\dfrdate" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRSTART, "\\dfrstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRSTOP, "\\dfrstop" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRXST, "\\dfrxst" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DGMARGIN, "\\dgmargin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DNTBLNSBDB, "\\dntblnsbdb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOCTYPE, "\\doctype" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DOCVAR, "\\docvar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DPCODESCENT, "\\dpcodescent" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EMBO, "\\embo" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EMFBLIP, "\\emfblip" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_EXPSHRTN, "\\expshrtn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FAAUTO, "\\faauto" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FBIAS, "\\fbias" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFDEFRES, "\\ffdefres" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFDEFTEXT, "\\ffdeftext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFENTRYMCR, "\\ffentrymcr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFEXITMCR, "\\ffexitmcr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFFORMAT, "\\ffformat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFHASLISTBOX, "\\ffhaslistbox" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFHELPTEXT, "\\ffhelptext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFHPS, "\\ffhps" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFL, "\\ffl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFMAXLEN, "\\ffmaxlen" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFNAME, "\\ffname" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFOWNHELP, "\\ffownhelp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFOWNSTAT, "\\ffownstat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFPROT, "\\ffprot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFRECALC, "\\ffrecalc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFRES, "\\ffres" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFSIZE, "\\ffsize" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFSTATTEXT, "\\ffstattext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFTYPE, "\\fftype" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FFTYPETXT, "\\fftypetxt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLDTYPE, "\\fldtype" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FNAME, "\\fname" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FORMFIELD, "\\formfield" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FROMTEXT, "\\fromtext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNCHOSUNG, "\\ftnnchosung" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNCNUM, "\\ftnncnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNDBAR, "\\ftnndbar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNDBNUM, "\\ftnndbnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNDBNUMD, "\\ftnndbnumd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNDBNUMK, "\\ftnndbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNDBNUMT, "\\ftnndbnumt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNGANADA, "\\ftnnganada" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNGBNUM, "\\ftnngbnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNGBNUMD, "\\ftnngbnumd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNGBNUMK, "\\ftnngbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNGBNUML, "\\ftnngbnuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNZODIAC, "\\ftnnzodiac" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNZODIACD, "\\ftnnzodiacd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FTNNZODIACL, "\\ftnnzodiacl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_G, "\\g" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GCW, "\\gcw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GRIDTBL, "\\gridtbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HIGHLIGHT, "\\highlight" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HLFR, "\\hlfr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HLINKBASE, "\\hlinkbase" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HLLOC, "\\hlloc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HLSRC, "\\hlsrc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ILVL, "\\ilvl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_IMPR, "\\impr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_JPEGBLIP, "\\jpegblip" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELFOLLOW, "\\levelfollow" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELINDENT, "\\levelindent" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELJC, "\\leveljc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELLEGAL, "\\levellegal" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELNFC, "\\levelnfc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELNORESTART, "\\levelnorestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELNUMBERS, "\\levelnumbers" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELOLD, "\\levelold" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELPREV, "\\levelprev" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELPREVSPACE, "\\levelprevspace" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELSPACE, "\\levelspace" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELSTARTAT, "\\levelstartat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LEVELTEXT, "\\leveltext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LINKVAL, "\\linkval" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LIST, "\\list" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTID, "\\listid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTLEVEL, "\\listlevel" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTNAME, "\\listname" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTOVERRIDE, "\\listoverride" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTOVERRIDECOUNT, "\\listoverridecount" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTOVERRIDEFORMAT, "\\listoverrideformat" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTOVERRIDESTART, "\\listoverridestart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTOVERRIDETABLE, "\\listoverridetable" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTRESTARTHDN, "\\listrestarthdn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTSIMPLE, "\\listsimple" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTTABLE, "\\listtable" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTTEMPLATEID, "\\listtemplateid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LISTTEXT, "\\listtext" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LS, "\\ls" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LYTEXCTTP, "\\lytexcttp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LYTPRTMET, "\\lytprtmet" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MANAGER, "\\manager" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_MSMCAP, "\\msmcap" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOFCHARSWS, "\\nofcharsws" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOLEAD, "\\nolead" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NONSHPPICT, "\\nonshppict" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOSECTEXPAND, "\\nosectexpand" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOSNAPLINEGRID, "\\nosnaplinegrid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOSPACEFORUL, "\\nospaceforul" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOULTRLSPC, "\\noultrlspc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_NOXLATTOYEN, "\\noxlattoyen" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJATTPH, "\\objattph" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJHTML, "\\objhtml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OBJOCX, "\\objocx" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OLDLINEWRAP, "\\oldlinewrap" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OUTLINELEVEL, "\\outlinelevel" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_OVERLAY, "\\overlay" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PANOSE, "\\panose" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDRB, "\\pgbrdrb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDRFOOT, "\\pgbrdrfoot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDRHEAD, "\\pgbrdrhead" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDRL, "\\pgbrdrl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDROPT, "\\pgbrdropt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDRR, "\\pgbrdrr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDRSNAP, "\\pgbrdrsnap" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRDRT, "\\pgbrdrt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNCHOSUNG, "\\pgnchosung" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNCNUM, "\\pgncnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNDBNUMK, "\\pgndbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNDBNUMT, "\\pgndbnumt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNGANADA, "\\pgnganada" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNGBNUM, "\\pgngbnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNGBNUMD, "\\pgngbnumd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNGBNUMK, "\\pgngbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNGBNUML, "\\pgngbnuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNZODIAC, "\\pgnzodiac" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNZODIACD, "\\pgnzodiacd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGNZODIACL, "\\pgnzodiacl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PICPROP, "\\picprop" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNAIUEO, "\\pnaiueo" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNAIUEOD, "\\pnaiueod" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNCHOSUNG, "\\pnchosung" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNDBNUMD, "\\pndbnumd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNDBNUMK, "\\pndbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNDBNUML, "\\pndbnuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNDBNUMT, "\\pndbnumt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNGANADA, "\\pnganada" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNGBLIP, "\\pngblip" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNGBNUM, "\\pngbnum" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNGBNUMD, "\\pngbnumd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNGBNUMK, "\\pngbnumk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNGBNUML, "\\pngbnuml" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRAUTH, "\\pnrauth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRDATE, "\\pnrdate" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRNFC, "\\pnrnfc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRNOT, "\\pnrnot" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRPNBR, "\\pnrpnbr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRRGB, "\\pnrrgb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRSTART, "\\pnrstart" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRSTOP, "\\pnrstop" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNRXST, "\\pnrxst" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNZODIAC, "\\pnzodiac" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNZODIACD, "\\pnzodiacd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PNZODIACL, "\\pnzodiacl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_LFOLEVEL, "\\lfolevel" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSYIN, "\\posyin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_POSYOUT, "\\posyout" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PRIVATE, "\\private" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PROPNAME, "\\propname" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PROPTYPE, "\\proptype" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVAUTHDEL, "\\revauthdel" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_REVDTTMDEL, "\\revdttmdel" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SAUTOUPD, "\\sautoupd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTDEFAULTCL, "\\sectdefaultcl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTEXPAND, "\\sectexpand" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTLINEGRID, "\\sectlinegrid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTSPECIFYCL, "\\sectspecifycl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SECTSPECIFYL, "\\sectspecifyl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHIDDEN, "\\shidden" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPBOTTOM, "\\shpbottom" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPBXCOLUMN, "\\shpbxcolumn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPBXMARGIN, "\\shpbxmargin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPBXPAGE, "\\shpbxpage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPBYMARGIN, "\\shpbymargin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPBYPAGE, "\\shpbypage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPBYPARA, "\\shpbypara" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPFBLWTXT, "\\shpfblwtxt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPFHDR, "\\shpfhdr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPGRP, "\\shpgrp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPLEFT, "\\shpleft" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPLID, "\\shplid" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPLOCKANCHOR, "\\shplockanchor" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPPICT, "\\shppict" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPRIGHT, "\\shpright" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPRSLT, "\\shprslt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPTOP, "\\shptop" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPTXT, "\\shptxt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPWRK, "\\shpwrk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPWR, "\\shpwr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHPZ, "\\shpz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SPRSBSP, "\\sprsbsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SPRSLNSP, "\\sprslnsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SPRSTSM, "\\sprstsm" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_STATICVAL, "\\staticval" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_STEXTFLOW, "\\stextflow" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_STRIKEDL, "\\strikedl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SUBFONTBYSIZE, "\\subfontbysize" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TCELLD, "\\tcelld" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TIME, "\\time" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TRUNCATEFONTHEIGHT, "\\truncatefontheight" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_UC, "\\uc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_UD, "\\ud" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULDASH, "\\uldash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULDASHD, "\\uldashd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULDASHDD, "\\uldashdd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULTH, "\\ulth" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULWAVE, "\\ulwave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_U, "\\u" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_UPR, "\\upr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_USERPROPS, "\\userprops" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VIEWKIND, "\\viewkind" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VIEWSCALE, "\\viewscale" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_VIEWZK, "\\viewzk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WIDCTLPAR, "\\widctlpar" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WINDOWCAPTION, "\\windowcaption" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WPEQN, "\\wpeqn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WPJST, "\\wpjst" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_WPSP, "\\wpsp" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_YXE, "\\yxe" );
+
+// MS-2000 Tokens
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULTHD, "\\ulthd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULTHDASH, "\\ulthdash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULLDASH, "\\ulldash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULTHLDASH, "\\ulthldash" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULTHDASHD, "\\ulthdashd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULTHDASHDD, "\\ulthdashdd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULHWAVE, "\\ulhwave" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_ULULDBWAVE, "\\ululdbwave" );
+
+// SWG spezifische Attribute
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GRFALIGNV, "\\grfalignv" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GRFALIGNH, "\\grfalignh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_GRFMIRROR, "\\grfmirror" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERYB, "\\headeryb" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERXL, "\\headerxl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERXR, "\\headerxr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERYT, "\\footeryt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERXL, "\\footerxl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERXR, "\\footerxr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HEADERYH, "\\headeryh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FOOTERYH, "\\footeryh" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BALANCEDCOLUMN, "\\swcolmnblnc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_UPDNPROP, "\\updnprop" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PRTDATA, "\\prtdata" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BKMKKEY, "\\bkmkkey" );
+
+// Attribute fuer die freifliegenden Rahmen
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYPRINT, "\\flyprint" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYOPAQUE, "\\flyopaque" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYPRTCTD, "\\flyprtctd" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYMAINCNT, "\\flymaincnt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYVERT, "\\flyvert" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYHORZ, "\\flyhorz" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRMTXTL, "\\dfrmtxtl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRMTXTR, "\\dfrmtxtr" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRMTXTU, "\\dfrmtxtu" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_DFRMTXTW, "\\dfrmtxtw" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYANCHOR, "\\flyanchor" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYCNTNT, "\\flycntnt" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYCOLUMN, "\\flycolumn" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYPAGE, "\\flypage" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_FLYINPARA, "\\flyinpara" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDBOX, "\\brdbox" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDLNCOL, "\\brdlncol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDLNIN, "\\brdlnin" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDLNOUT, "\\brdlnout" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_BRDLNDIST, "\\brdlndist" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHADOW, "\\shadow" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHDWDIST, "\\shdwdist" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHDWSTYLE, "\\shdwstyle" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHDWCOL, "\\shdwcol" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SHDWFCOL, "\\shdwfcol" );
+
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGDSCTBL, "\\pgdsctbl" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGDSC, "\\pgdsc" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGDSCUSE, "\\pgdscuse" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGDSCNXT, "\\pgdscnxt" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHEN, "\\hyphen" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHLEAD, "\\hyphlead" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHTRAIL, "\\hyphtrail" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_HYPHMAX, "\\hyphmax" );
+
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_TLSWG, "\\tlswg" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGBRK, "\\pgbrk" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_PGDSCNO, "\\pgdscno" );
+extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sRTF_SOUTLVL, "\\soutlvl" );
+
+/*************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/svtools/source/svrtf/rtfkeywd.hxx,v 1.1.1.1 2000-09-18 16:59:05 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.19 2000/09/18 14:13:46 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.18 2000/08/31 13:51:38 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.17 2000/03/28 11:47:53 jp
+ changes for Unicode
+
+ Revision 1.16 2000/01/07 10:46:14 jp
+ Task #71411#: new SW token
+
+ Revision 1.15 1999/11/01 11:27:39 jp
+ neue tokens
+
+ Revision 1.14 1999/10/25 14:36:55 jp
+ Bug #69464#: new tabstop token tql
+
+ Revision 1.13 1999/07/22 17:44:51 jp
+ new RTF-Tokens for Header/Footer height
+
+ Revision 1.12 1999/02/16 11:01:16 JP
+ Task #61633#: neue Unter-/Durchstreichungs Werte
+
+
+ Rev 1.11 16 Feb 1999 12:01:16 JP
+ Task #61633#: neue Unter-/Durchstreichungs Werte
+
+ Rev 1.10 27 May 1998 21:22:34 JP
+ Bug #50585#: fehlendes Token lfolevel zugefuegt
+
+ Rev 1.9 03 Apr 1998 18:55:20 JP
+ RTF-Parser um neue Tokens erweitert, nTokenValue wurde ein long
+
+ Rev 1.8 20 Nov 1997 22:28:02 JP
+ HeaderFile Umstellung
+
+ Rev 1.7 08 Oct 1996 13:51:18 JP
+ neue RTF-Token zugefuegt
+
+ Rev 1.6 16 Oct 1995 17:01:16 JP
+ neue Tokens
+
+ Rev 1.5 29 Sep 1995 20:03:30 JP
+ neues Token: kerning
+
+ Rev 1.4 10 Aug 1995 21:02:26 JP
+ neue Token fuer Fonts; Segmentierung
+
+ Rev 1.3 29 Jul 1995 22:40:04 JP
+ neue Token lesen/auswerten: expand/-tw
+
+ Rev 1.2 05 Jul 1995 13:58:22 JP
+ neue Tokens COLSX/COLNO/COLSR
+
+ Rev 1.1 04 Jan 1995 16:20:32 JP
+ TokenName und Token korrigiert
+
+ Rev 1.0 22 Dec 1994 17:19:52 JP
+ Initial revision.
+
+*************************************************************************/
+
+#endif
+ // _RTFKEYWD_HXX
diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx
new file mode 100644
index 000000000000..8793547f06b3
--- /dev/null
+++ b/svtools/source/svrtf/rtfout.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * $RCSfile: rtfout.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+ /*************************************************************************
+#*
+#* $Workfile: rtfout.cxx $
+#*
+#* class HTMLOutFuncs
+#*
+#* Beschreibung DOKUNAME.DOC
+#*
+#* Ersterstellung JP 20.02.96
+#* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 16:59:05 $
+#* $Revision: 1.1.1.1 $
+#*
+#* $Logfile: T:/svtools/source/svrtf/rtfout.cxv $
+#*
+#* Copyright (c) 1989 - 2000, STAR DIVISION
+#*
+#*************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+#ifndef _RTFKEYWD_HXX
+#include <rtfkeywd.hxx>
+#endif
+#ifndef _RTFOUT_HXX
+#include <rtfout.hxx>
+#endif
+
+
+#if defined(MAC)
+const sal_Char RTFOutFuncs::sNewLine = '\015';
+#elif defined(UNX)
+const sal_Char RTFOutFuncs::sNewLine = '\012';
+#else
+const sal_Char __FAR_DATA RTFOutFuncs::sNewLine[] = "\015\012";
+#endif
+
+
+// ER 01.04.99 diese Methode wurde aus sw/source/filter/rtf/rtfatr.cxx
+// Writer& OutRTF_SwChar( Writer& rWrt, BYTE c ) kopiert und angepasst
+SvStream& RTFOutFuncs::Out_Char( SvStream& rStream, sal_Unicode c,
+ rtl_TextEncoding eDestEnc, BOOL bWriteHelpFile )
+{
+ const sal_Char* pStr = 0;
+ switch( c )
+ {
+ case 0x1: // this are control character of our textattributes and
+ case 0x2: // will never be written
+ break;
+
+ case 0xA0: rStream << "\\~"; break;
+ case 0xAD: rStream << "\\-"; break;
+ case 0x2011: rStream << "\\_"; break;
+ case '\n': pStr = sRTF_LINE; break;
+ case '\t': pStr = sRTF_TAB; break;
+
+ default:
+ {
+ sal_Unicode cCh = c;
+ c = (BYTE)ByteString::ConvertFromUnicode( c, eDestEnc, FALSE );
+ if( !c )
+ {
+ // then write as unicode - character
+ // rWrt.Strm() << "\\u";
+ // rWrt.OutULong( eCh ) << " ?";
+ rStream << "\\'";
+ Out_Hex( rStream, cCh, 2 );
+ break;
+ }
+
+ if( !bWriteHelpFile )
+ switch( c )
+ {
+#ifdef MAC
+ case 0xa5: pStr = sRTF_BULLET; break;
+ case 0xd0: pStr = sRTF_ENDASH; break;
+ case 0xd1: pStr = sRTF_EMDASH; break;
+ case 0xd4: pStr = sRTF_LQUOTE; break;
+ case 0xd5: pStr = sRTF_RQUOTE; break;
+ case 0xd2: pStr = sRTF_LDBLQUOTE; break;
+ case 0xd3: pStr = sRTF_RDBLQUOTE; break;
+#else
+ case 149: pStr = sRTF_BULLET; break;
+ case 150: pStr = sRTF_ENDASH; break;
+ case 151: pStr = sRTF_EMDASH; break;
+ case 145: pStr = sRTF_LQUOTE; break;
+ case 146: pStr = sRTF_RQUOTE; break;
+ case 147: pStr = sRTF_LDBLQUOTE; break;
+ case 148: pStr = sRTF_RDBLQUOTE; break;
+#endif
+ // MAC
+ }
+ if( !pStr )
+ switch ( c )
+ {
+ case '\\':
+ case '}':
+ case '{': rStream << '\\' << (sal_Char)c; break;
+
+ default:
+ if( c >= ' ' && c <= '~' )
+ rStream << (sal_Char)c;
+ else if( 0xFF < c )
+ {
+ // write as unicode-char
+ ByteString aNumStr( ByteString::CreateFromInt32( c ));
+ rStream << "\\u" << aNumStr.GetBuffer() << " ?";
+ }
+ else
+ {
+ rStream << "\\'";
+ Out_Hex( rStream, c, 2 );
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ if( pStr )
+ rStream << pStr << ' ';
+
+ return rStream;
+}
+
+
+SvStream& RTFOutFuncs::Out_String( SvStream& rStream, const String& rStr,
+ rtl_TextEncoding eDestEnc, BOOL bWriteHelpFile )
+{
+ for( xub_StrLen n = 0; n < rStr.Len(); n++ )
+ Out_Char( rStream, rStr.GetChar( n ), eDestEnc, bWriteHelpFile );
+ return rStream;
+}
+
+
+SvStream& RTFOutFuncs::Out_Hex( SvStream& rStream, ULONG nHex, BYTE nLen )
+{
+ sal_Char aNToABuf[] = "0000000000000000";
+
+ DBG_ASSERT( nLen < sizeof(aNToABuf), "zu viele Stellen" );
+ if( nLen >= sizeof(aNToABuf) )
+ nLen = (sizeof(aNToABuf)-1);
+
+ // Pointer an das Bufferende setzen
+ sal_Char* pStr = aNToABuf + (sizeof(aNToABuf)-1);
+ for( BYTE n = 0; n < nLen; ++n )
+ {
+ *(--pStr) = (sal_Char)(nHex & 0xf ) + 48;
+ if( *pStr > '9' )
+ *pStr += 39;
+ nHex >>= 4;
+ }
+ return rStream << pStr;
+}
+
+
+
diff --git a/svtools/source/svrtf/rtfout.hxx b/svtools/source/svrtf/rtfout.hxx
new file mode 100644
index 000000000000..fde71d03de73
--- /dev/null
+++ b/svtools/source/svrtf/rtfout.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: rtfout.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTFOUT_HXX
+#define _RTFOUT_HXX
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+class String;
+class SvStream;
+
+class 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,
+ 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_Hex( SvStream&, ULONG nHex, BYTE nLen );
+};
+
+
+#endif
+
+
diff --git a/svtools/source/svrtf/rtftoken.h b/svtools/source/svrtf/rtftoken.h
new file mode 100644
index 000000000000..08dce8728b7e
--- /dev/null
+++ b/svtools/source/svrtf/rtftoken.h
@@ -0,0 +1,1304 @@
+/*************************************************************************
+ *
+ * $RCSfile: rtftoken.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTFTOKEN_H
+#define _RTFTOKEN_H
+
+// 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,
+ RTF_ASSCHARPROP = 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_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_RI,
+ 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_ADJUSTRIGHT,
+ RTF_LS,
+
+
+/* */
+
+ 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_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_ULTH,
+ RTF_EMBO,
+ RTF_IMPR,
+ RTF_STRIKEDL,
+ 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,
+
+ // 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_DROPCAPLT,
+ 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,
+
+ // 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_TCELLD,
+ RTF_CLTXTBRL,
+ RTF_CLTXLRTB,
+ RTF_CLVERTALB,
+ RTF_CLVERTALT,
+ RTF_CLVERTALC,
+ RTF_CLVMGF,
+ RTF_CLVMRG,
+ RTF_CLTXTBRLV,
+ RTF_CLTXBTLR,
+ RTF_CLTXLRTBV,
+
+ 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_AB = RTF_ASSCHARPROP,
+ 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_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
+
+};
+
+
+
+/*************************************************************************
+
+ Source Code Control System - Header
+
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/svtools/source/svrtf/rtftoken.h,v 1.1.1.1 2000-09-18 16:59:05 hr Exp $
+
+ Source Code Control System - Update
+
+ $Log: not supported by cvs2svn $
+ Revision 1.20 2000/09/18 14:13:47 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.19 2000/08/31 13:51:38 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.18 2000/03/28 11:47:56 jp
+ changes for Unicode
+
+ Revision 1.17 2000/01/07 10:46:18 jp
+ Task #71411#: new SW token
+
+ Revision 1.16 1999/11/01 11:27:43 jp
+ neue tokens
+
+ Revision 1.15 1999/10/25 14:36:59 jp
+ Bug #69464#: new tabstop token tql
+
+ Revision 1.14 1999/07/22 17:44:52 jp
+ new RTF-Tokens for Header/Footer height
+
+ Revision 1.13 1999/02/16 11:01:18 JP
+ Task #61633#: neue Unter-/Durchstreichungs Werte
+
+
+ Rev 1.12 16 Feb 1999 12:01:18 JP
+ Task #61633#: neue Unter-/Durchstreichungs Werte
+
+ Rev 1.11 27 May 1998 22:15:48 JP
+ vertikales Alignment in Zellen ist ein Tabellen- und kein Absatztoken
+
+ Rev 1.10 27 May 1998 21:22:32 JP
+ Bug #50585#: fehlendes Token lfolevel zugefuegt
+
+ Rev 1.9 03 Apr 1998 18:55:22 JP
+ RTF-Parser um neue Tokens erweitert, nTokenValue wurde ein long
+
+ Rev 1.8 08 Oct 1996 13:51:20 JP
+ neue RTF-Token zugefuegt
+
+ Rev 1.7 16 Oct 1995 17:01:16 JP
+ neue Tokens
+
+ Rev 1.6 29 Sep 1995 20:03:40 JP
+ neues Token: kerning
+
+ Rev 1.5 10 Aug 1995 21:02:28 JP
+ neue Token fuer Fonts; Segmentierung
+
+ Rev 1.4 29 Jul 1995 22:40:06 JP
+ neue Token lesen/auswerten: expand/-tw
+
+ Rev 1.3 05 Jul 1995 13:41:18 JP
+ neue Tokens COLSX/COLNO/COLSR
+
+ Rev 1.2 04 Jan 1995 16:19:46 JP
+ Tokengruppierung fuer Tabellen
+
+ Rev 1.1 23 Dec 1994 15:01:52 JP
+ jetzt auch mit BrushItem
+
+ Rev 1.0 22 Dec 1994 17:19:52 JP
+ Initial revision.
+
+*************************************************************************/
+
+
+#endif
+ // _RTFTOKEN_H
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
new file mode 100644
index 000000000000..a440ff4acfe5
--- /dev/null
+++ b/svtools/source/svrtf/svparser.cxx
@@ -0,0 +1,692 @@
+/*************************************************************************
+ *
+ * $RCSfile: svparser.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <stdio.h>
+#include "svparser.hxx"
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#define _SVSTDARR_USHORTS
+#include <svstdarr.hxx>
+
+#define SVPAR_CSM_
+
+#define SVPAR_CSM_ANSI 0x0001U
+#define SVPAR_CSM_UTF8 0x0002U
+#define SVPAR_CSM_UCS2B 0x0004U
+#define SVPAR_CSM_UCS2L 0x0008U
+#define SVPAR_CSM_SWITCH 0x8000U
+
+#ifdef ASYNCHRON_TEST
+//HACK
+#include "svgen.hxx"
+#include "toolerr.hxx"
+class _SvLockBytes_Impl
+{
+ AutoTimer aTimer;
+ SvStream& rIn;
+
+ ULONG nDataRead;
+ Link aCallDataRead;
+
+ DECL_STATIC_LINK( _SvLockBytes_Impl, DataRead, Timer* );
+
+public:
+ _SvLockBytes_Impl( SvStream& rInput, const Link& rCallBack );
+ ~_SvLockBytes_Impl();
+
+ ErrCode ReadAt( ULONG nPos, void* pArr, ULONG nCount, ULONG* pReadCnt );
+};
+//HACK
+#endif
+
+// Struktur, um sich die akt. Daten zumerken
+struct SvParser_Impl
+{
+ String aToken; // gescanntes Token
+ ULONG nFilePos; // akt. Position im Stream
+ ULONG nlLineNr; // akt. Zeilen Nummer
+ ULONG nlLinePos; // akt. Spalten Nummer
+ long nTokenValue; // zusaetzlicher Wert (RTF)
+ int nToken; // akt. Token
+ sal_Unicode nNextCh; // akt. Zeichen
+
+ int nSaveToken; // das Token vom Continue
+
+#ifdef ASYNCHRON_TEST
+// HACK
+_SvLockBytes_Impl* pLB;
+//HACK
+#endif
+#ifndef PRODUCT
+ SvFileStream aOut;
+#endif
+};
+
+
+
+// Konstruktor
+SvParser::SvParser( SvStream& rIn, BYTE nStackSize )
+ : rInput( rIn ), eState( SVPAR_NOTSTARTED ),
+ nlLineNr( 1 ), nlLinePos( 1 ),
+ nTokenStackSize( nStackSize ), nTokenStackPos( 0 ),
+ nTokenValue( 0 ),
+ pImplData( 0 ),
+// bWaitForData( FALSE )
+ bDownloadingFile( FALSE ),
+ eSrcEnc( RTL_TEXTENCODING_DONTKNOW )
+{
+ bUCS2BSrcEnc = bSwitchToUCS2 = FALSE;
+ eState = SVPAR_NOTSTARTED;
+ if( nTokenStackSize < 3 )
+ nTokenStackSize = 3;
+ pTokenStack = new TokenStackType[ nTokenStackSize ];
+ pTokenStackPos = pTokenStack;
+
+
+#ifdef ASYNCHRON_TEST
+//HACK
+ pImplData = new SvParser_Impl;
+ pImplData->pLB = new _SvLockBytes_Impl( rInput,
+ STATIC_LINK( this, SvParser, NewDataRead ) );
+//HACK
+#endif
+#ifndef PRODUCT
+
+ // wenn die Datei schon existiert, dann Anhaengen:
+ if( !pImplData )
+ pImplData = new SvParser_Impl;
+ pImplData->aOut.Open( String::CreateFromAscii( "\\parser.dmp" ),
+ STREAM_STD_WRITE | STREAM_NOCREATE );
+ if( pImplData->aOut.GetError() || !pImplData->aOut.IsOpen() )
+ pImplData->aOut.Close();
+ else
+ {
+ pImplData->aOut.Seek( STREAM_SEEK_TO_END );
+ pImplData->aOut << "\x0c\n\n >>>>>>>>>>>>>>> Dump Start <<<<<<<<<<<<<<<\n";
+ }
+#endif
+}
+
+SvParser::~SvParser()
+{
+//HACK
+#ifdef ASYNCHRON_TEST
+delete pImplData->pLB;
+#endif
+//HACK
+#ifndef PRODUCT
+ if( pImplData->aOut.IsOpen() )
+ pImplData->aOut << "\n\n >>>>>>>>>>>>>>> Dump Ende <<<<<<<<<<<<<<<\n";
+ pImplData->aOut.Close();
+#endif
+
+ delete pImplData;
+
+#ifdef MPW
+ // der MPW-Compiler ruft sonst keine Dtoren!
+ for (int n = 0; n < nTokenStackSize; ++n )
+ (pTokenStack+n)->TokenStackType::~TokenStackType();
+ delete (void*) pTokenStack;
+#else
+ __DELETE(nTokenStackSize) pTokenStack;
+#endif
+}
+
+void SvParser::SetSrcEncoding( rtl_TextEncoding eEnc )
+{
+ if( ( eEnc < RTL_TEXTENCODING_STD_COUNT &&
+ eEnc != RTL_TEXTENCODING_UTF7 ) ||
+ RTL_TEXTENCODING_UCS2 == eEnc )
+ {
+ eSrcEnc = eEnc;
+ }
+ else
+ {
+ DBG_ASSERT( !this,
+ "SvParser::SetSrcEncoding: invalid source encoding" );
+ eSrcEnc = RTL_TEXTENCODING_DONTKNOW;
+ }
+}
+
+sal_Unicode SvParser::GetNextChar()
+{
+ sal_Unicode c = 0U;
+
+#ifdef ASYNCHRON_TEST
+//HACK
+ ULONG nRead;
+ sal_Char cAsync;
+ ULONG nErr = pImplData->pLB->ReadAt( rInput.Tell(), &cAsync, 1, &nRead );
+ if( ERRCODE_IO_PENDING == nErr )
+ {
+/* if( bWaitForData )
+ {
+ eState = SVPAR_WAITFORDATA;
+ while( SVPAR_WAITFORDATA == eState )
+ Application::Reschedule();
+ pImplData->pLB->ReadAt( rInput.Tell(), &c, 1, &nRead );
+ }
+ else
+*/ {
+ eState = SVPAR_PENDING;
+ return cAsync;
+ }
+ }
+
+ // Fehlerfall?
+ if( !nRead )
+ {
+ eState = rInput.IsEof() ? SVPAR_ACCEPTED : SVPAR_ERROR;
+ return cAsync;
+ }
+
+ if( rInput.IsEof() )
+ return EOF;
+
+ c = cAsnyc
+//HACK
+#else
+
+ BOOL bErr;
+ if( bSwitchToUCS2 && 0 == rInput.Tell() )
+ {
+ sal_Char c1, c2;
+ BOOL bSeekBack = TRUE;
+
+ rInput >> c1;
+ if( !(bErr = (rInput.IsEof() || rInput.GetError())) )
+ {
+ if( 0xff == c1 || 0xfe == c1 )
+ {
+ rInput >> c2;
+ if( !(bErr = (rInput.IsEof() || rInput.GetError())) )
+ {
+ if( 0xfe == c1 && 0xff == c2 )
+ {
+ eSrcEnc = RTL_TEXTENCODING_UCS2;
+ bUCS2BSrcEnc = TRUE;
+ bSeekBack = FALSE;
+ }
+ else if( 0xff == c1 && 0xfe == c2 )
+ {
+ eSrcEnc = RTL_TEXTENCODING_UCS2;
+ bUCS2BSrcEnc = FALSE;
+ bSeekBack = FALSE;
+ }
+ }
+ }
+ }
+ if( bSeekBack )
+ rInput.Seek( 0 );
+
+ bSwitchToUCS2 = FALSE;
+ }
+
+ if( RTL_TEXTENCODING_UCS2 == eSrcEnc || RTL_TEXTENCODING_UTF8 == eSrcEnc )
+ {
+ sal_Unicode cUC = USHRT_MAX;
+ sal_Char c1, c2, c3;
+
+ if( RTL_TEXTENCODING_UTF8 == eSrcEnc )
+ {
+ rInput >> c1;
+ if( !(bErr = (rInput.IsEof() || rInput.GetError())) )
+ {
+ switch( c1 >> 4 )
+ {
+ case 0: case 1: case 2: case 3:
+ case 4: case 5: case 6: case 7:
+ // 0xxxxxxx
+ cUC = c1;
+ break;
+
+ case 12: case 13:
+ // 110x xxxx 10xx xxxx
+ rInput >> c2;
+ if( !(bErr = (rInput.IsEof() || rInput.GetError())) )
+ {
+ if( (c2 & 0xC0) == 0x80 )
+ {
+ cUC = (sal_Unicode(c1 & 0x1F) << 6) |
+ (c2 & 0x3F);
+ }
+ else
+ {
+ // Kein UTF-8? Dann Zeichen direkt einfuegen
+ cUC = c1;
+ rInput.SeekRel( -1 );
+ }
+ }
+ break;
+
+ case 14:
+ // 1110 xxxx 10xx xxxx 10xx xxxx
+ rInput >> c2 >> c3;
+ if( !(bErr = (rInput.IsEof() || rInput.GetError())) )
+ {
+ if( (c2 & 0xC0) == 0x80 && (c3 & 0xC0) == 0x80 )
+ {
+ cUC = (sal_Unicode(c1 & 0x0F) << 12) |
+ (sal_Unicode(c2 & 0x3F) << 6) |
+ (c3 & 0x3F);
+ }
+ else
+ {
+ // Kein UTF-8? Dann Zeichen direkt einfuegen
+ cUC = c1;
+ rInput.SeekRel( -2 );
+ }
+ }
+ break;
+
+ default:
+ cUC = c1;
+ break;
+ }
+ }
+ }
+ else
+ {
+ rInput >> c1 >> c2;
+ if( 2 == rInput.Tell() && !
+ !(rInput.IsEof() || rInput.GetError()) &&
+ ( (bUCS2BSrcEnc && 0xfe == c1 && 0xff == c2) ||
+ (!bUCS2BSrcEnc && 0xff == c1 && 0xfe == c2) ) )
+ rInput >> c1 >> c2;
+
+ if( !(bErr = (rInput.IsEof() || rInput.GetError())) )
+ {
+ if( bUCS2BSrcEnc )
+ cUC = (sal_Unicode(c1) << 8) | c2;
+ else
+ cUC = (sal_Unicode(c2) << 8) | c1;
+ }
+ }
+
+ if( !bErr )
+ {
+ c = cUC;
+ }
+ }
+ else
+ {
+ sal_Char c1;
+ rInput >> c1;
+ if( RTL_TEXTENCODING_DONTKNOW != eSrcEnc)
+ {
+ // #73398#: If the character could not be converted,
+ // because a conversion is not available, do no conversion at all.
+ sal_Unicode cUC = ByteString::ConvertToUnicode( c1, eSrcEnc );
+ c = 0U != cUC ? cUC : (sal_Unicode)c;
+ }
+
+ bErr = rInput.IsEof() || rInput.GetError();
+ }
+ if( bErr )
+ {
+ if( ERRCODE_IO_PENDING == rInput.GetError() )
+ {
+ eState = SVPAR_PENDING;
+ return c;
+ }
+ else
+ return sal_Unicode(EOF);
+ }
+
+#endif
+
+#ifndef PRODUCT
+ if( pImplData->aOut.IsOpen() )
+ pImplData->aOut << ByteString::ConvertFromUnicode( c,
+ RTL_TEXTENCODING_MS_1251 );
+#endif
+
+ if( c == '\n' )
+ {
+ IncLineNr();
+ SetLinePos( 1L );
+ }
+ else
+ IncLinePos();
+ return c;
+}
+
+int SvParser::GetNextToken()
+{
+ int nRet = 0;
+
+ if( !nTokenStackPos )
+ {
+ aToken.Erase(); // Token-Buffer loeschen
+ nTokenValue = -1; // Kennzeichen fuer kein Value gelesen
+
+ nRet = _GetNextToken();
+ if( SVPAR_PENDING == eState )
+ return nRet;
+ }
+
+ ++pTokenStackPos;
+ if( pTokenStackPos == pTokenStack + nTokenStackSize )
+ pTokenStackPos = pTokenStack;
+
+ // vom Stack holen ??
+ if( nTokenStackPos )
+ {
+ --nTokenStackPos;
+ nTokenValue = pTokenStackPos->nTokenValue;
+ aToken = pTokenStackPos->sToken;
+ nRet = pTokenStackPos->nTokenId;
+ }
+ // nein, dann das aktuelle auf den Stack
+ else if( SVPAR_WORKING == eState )
+ {
+ pTokenStackPos->sToken = aToken;
+ pTokenStackPos->nTokenValue = nTokenValue;
+ pTokenStackPos->nTokenId = nRet;
+ }
+ else if( SVPAR_ACCEPTED != eState && SVPAR_PENDING != eState )
+ eState = SVPAR_ERROR; // irgend ein Fehler
+
+ return nRet;
+}
+
+int SvParser::SkipToken( short nCnt ) // n Tokens zurueck "skippen"
+{
+ pTokenStackPos = GetStackPtr( nCnt );
+ short nTmp = nTokenStackPos - nCnt;
+ if( nTmp < 0 )
+ nTmp = 0;
+ else if( nTmp > nTokenStackSize )
+ nTmp = nTokenStackSize;
+ nTokenStackPos = BYTE(nTmp);
+
+ // und die Werte zurueck
+ aToken = pTokenStackPos->sToken;
+ nTokenValue = pTokenStackPos->nTokenValue;
+
+ return pTokenStackPos->nTokenId;
+}
+
+SvParser::TokenStackType* SvParser::GetStackPtr( short nCnt )
+{
+ BYTE nAktPos = BYTE(pTokenStackPos - pTokenStack );
+ if( nCnt > 0 )
+ {
+ if( nCnt >= nTokenStackSize )
+ nCnt = (nTokenStackSize-1);
+ if( nAktPos + nCnt < nTokenStackSize )
+ nAktPos += BYTE(nCnt);
+ else
+ nAktPos += nCnt - nTokenStackSize;
+ }
+ else if( nCnt < 0 )
+ {
+ if( -nCnt >= nTokenStackSize )
+ nCnt = -nTokenStackSize+1;
+ if( -nCnt <= nAktPos )
+ nAktPos += BYTE(nCnt);
+ else
+ nAktPos += nCnt + nTokenStackSize;
+ }
+ return pTokenStack + nAktPos;
+}
+
+// wird fuer jedes Token gerufen, das in CallParser erkannt wird
+void SvParser::NextToken( int nToken )
+{
+}
+
+
+// fuers asynchrone lesen aus dem SvStream
+
+int SvParser::GetSaveToken() const
+{
+ return pImplData ? pImplData->nSaveToken : 0;
+}
+
+void SvParser::SaveState( int nToken )
+{
+ // aktuellen Status merken
+ if( !pImplData )
+ {
+ pImplData = new SvParser_Impl;
+ pImplData->nSaveToken = 0;
+ }
+
+ pImplData->nFilePos = rInput.Tell();
+ pImplData->nToken = nToken;
+
+ pImplData->aToken = aToken;
+ pImplData->nlLineNr = nlLineNr;
+ pImplData->nlLinePos = nlLinePos;
+ pImplData->nTokenValue= nTokenValue;
+ pImplData->nNextCh = nNextCh;
+}
+
+void SvParser::RestoreState()
+{
+ // alten Status wieder zurueck setzen
+ if( pImplData )
+ {
+ if( ERRCODE_IO_PENDING == rInput.GetError() )
+ rInput.ResetError();
+ aToken = pImplData->aToken;
+ nlLineNr = pImplData->nlLineNr;
+ nlLinePos = pImplData->nlLinePos;
+ nTokenValue= pImplData->nTokenValue;
+ nNextCh = pImplData->nNextCh;
+
+ pImplData->nSaveToken = pImplData->nToken;
+
+ rInput.Seek( pImplData->nFilePos );
+ }
+}
+
+void SvParser::Continue( int nToken )
+{
+}
+
+void SvParser::BuildWhichTbl( SvUShorts &rWhichMap,
+ USHORT *pWhichIds,
+ USHORT nWhichIds )
+{
+ USHORT aNewRange[2];
+
+ for( USHORT nCnt = 0; nCnt < nWhichIds; ++nCnt, ++pWhichIds )
+ if( *pWhichIds )
+ {
+ aNewRange[0] = aNewRange[1] = *pWhichIds;
+ BOOL bIns = TRUE;
+
+ // Position suchen
+ for ( USHORT nOfs = 0; rWhichMap[nOfs]; nOfs += 2 )
+ {
+ if( *pWhichIds < rWhichMap[nOfs] - 1 )
+ {
+ // neuen Range davor
+ rWhichMap.Insert( aNewRange, 2, nOfs );
+ bIns = FALSE;
+ break;
+ }
+ else if( *pWhichIds == rWhichMap[nOfs] - 1 )
+ {
+ // diesen Range nach unten erweitern
+ rWhichMap[nOfs] = *pWhichIds;
+ bIns = FALSE;
+ break;
+ }
+ else if( *pWhichIds == rWhichMap[nOfs+1] + 1 )
+ {
+ if( rWhichMap[nOfs+2] != 0 && rWhichMap[nOfs+2] == *pWhichIds + 1 )
+ {
+ // mit dem naechsten Bereich mergen
+ rWhichMap[nOfs+1] = rWhichMap[nOfs+3];
+ rWhichMap.Remove( nOfs+2, 2 );
+ }
+ else
+ // diesen Range nach oben erweitern
+ rWhichMap[nOfs+1] = *pWhichIds;
+ bIns = FALSE;
+ break;
+ }
+ }
+
+ // einen Range hinten anhaengen
+ if( bIns )
+ rWhichMap.Insert( aNewRange, 2, rWhichMap.Count()-1 );
+ }
+}
+
+
+IMPL_STATIC_LINK( SvParser, NewDataRead, void*, EMPTYARG )
+{
+ switch( pThis->eState )
+ {
+ case SVPAR_PENDING:
+ // Wenn gerade ein File geladen wird duerfen wir nicht weiterlaufen,
+ // sondern muessen den Aufruf ignorieren.
+ if( pThis->IsDownloadingFile() )
+ break;
+
+ pThis->eState = SVPAR_WORKING;
+ pThis->RestoreState();
+
+ pThis->Continue( pThis->pImplData->nToken );
+
+ if( ERRCODE_IO_PENDING == pThis->rInput.GetError() )
+ pThis->rInput.ResetError();
+
+ if( SVPAR_PENDING != pThis->eState )
+ pThis->ReleaseRef(); // ansonsten sind wir fertig!
+ break;
+
+ case SVPAR_WAITFORDATA:
+ pThis->eState = SVPAR_WORKING;
+ break;
+
+ case SVPAR_NOTSTARTED:
+ case SVPAR_WORKING:
+ break;
+
+ default:
+ pThis->ReleaseRef(); // ansonsten sind wir fertig!
+ break;
+ }
+
+ return 0;
+}
+
+
+/* */
+#ifdef ASYNCHRON_TEST
+
+_SvLockBytes_Impl::_SvLockBytes_Impl( SvStream& rInput, const Link& rCallback )
+ : rIn( rInput ), aCallDataRead( rCallback )
+{
+ nDataRead = 50;
+
+ aTimer.SetTimeout( 1000 ); // jede Sekunde 100 Zeichen lesen
+ aTimer.SetTimeoutHdl( STATIC_LINK( this, _SvLockBytes_Impl, DataRead ));
+ aTimer.Start();
+}
+
+_SvLockBytes_Impl::~_SvLockBytes_Impl()
+{
+ aTimer.Stop();
+}
+
+ErrCode _SvLockBytes_Impl::ReadAt( ULONG nPos, void* pArr, ULONG nCount,
+ ULONG* pReadCnt )
+{
+ ErrCode nRet = 0;
+ if( nPos + nCount > nDataRead )
+ {
+ nCount = nDataRead - nPos;
+ nRet = ERRCODE_IO_PENDING;
+ }
+
+ if( nCount )
+ {
+ rIn.Seek( nPos );
+ *pReadCnt = rIn.Read( pArr, nCount );
+ }
+ else
+ *pReadCnt = 0;
+ return rIn.GetError() ? rIn.GetError()
+ : ( rIn.IsEof() ? 0 : nRet );
+}
+
+IMPL_STATIC_LINK( _SvLockBytes_Impl, DataRead, Timer*, pTimer )
+{
+ pThis->nDataRead += 100;
+ pThis->aCallDataRead.Call( pThis );
+
+ return 0;
+}
+
+#endif
+
+
diff --git a/svtools/source/svsql/converter.cxx b/svtools/source/svsql/converter.cxx
new file mode 100644
index 000000000000..496d4691c672
--- /dev/null
+++ b/svtools/source/svsql/converter.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: converter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SV_CONVERTER_HXX_
+#include "converter.hxx"
+#endif
+
+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
new file mode 100644
index 000000000000..6d57aac65586
--- /dev/null
+++ b/svtools/source/svsql/converter.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: converter.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SV_CONVERTER_HXX_
+#define _SV_CONVERTER_HXX_
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+class SvDbaseConverter
+{
+public:
+ static INT32 ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale);
+ static INT32 ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale);
+};
+#endif //_CONVERTER_HXX_
+
+
+
diff --git a/svtools/source/svsql/makefile.mk b/svtools/source/svsql/makefile.mk
new file mode 100644
index 000000000000..a805348e8e4f
--- /dev/null
+++ b/svtools/source/svsql/makefile.mk
@@ -0,0 +1,124 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=svsql
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+# Every source directory generates headers in a own output directory to
+# enable parallel building of the source directories within a project!
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+UNOTYPES = com.sun.star.util.XNumberFormatsSupplier \
+ com.sun.star.util.XNumberFormatter \
+ com.sun.star.util.XNumberFormatTypes \
+ com.sun.star.util.Date \
+ com.sun.star.data.DatabaseFieldType \
+ com.sun.star.data.DatabaseInfo \
+ com.sun.star.data.XDatabaseDescriptor \
+ com.sun.star.sdbc.XDatabaseMetaData \
+ com.sun.star.lang.Locale \
+ com.sun.star.beans.XPropertySet \
+ com.sun.star.uno.TypeClass
+
+SRCFILES = svsql.src
+
+SLOFILES = \
+ $(SLO)$/sdbbison.obj \
+ $(SLO)$/sdbflex.obj \
+ $(SLO)$/sdbsql.obj \
+ $(SLO)$/sdbnode.obj \
+ $(SLO)$/converter.obj
+
+EXCEPTIONSFILES= \
+ $(SLO)$/sdbbison.obj \
+ $(SLO)$/sdbsql.obj
+
+all: \
+ $(MISC)$/sdbflex.cxx \
+ $(MISC)$/sdbbison.cxx \
+ ALLTAR
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/sdbflex.cxx: sdblex.l
+ +flex -i -8 -PSQLyy -L -o$(MISC)$/sdbflex.cxx sdblex.l
+
+$(MISC)$/sdbbison.cxx: sdbyacc.y
+ +bison -v -d -pSQLyy -l -bsql -o$(MISC)$/sdbbison.cxx sdbyacc.y
+ -$(MKDIR) $(OUT)$/inc$/svtools
+ +$(COPY) $(MISC)$/sdbbison.cxx.h $(OUT)$/inc$/svtools$/sdbbison.hxx
diff --git a/svtools/source/undo/makefile.mk b/svtools/source/undo/makefile.mk
new file mode 100644
index 000000000000..3695df13584a
--- /dev/null
+++ b/svtools/source/undo/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=undo
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ undo.cxx
+
+SLOFILES = \
+ $(SLO)$/undo.obj
+
+OBJFILES = \
+ $(OBJ)$/undo.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/source/undo/undo.cxx b/svtools/source/undo/undo.cxx
new file mode 100644
index 000000000000..00d7b22ef2af
--- /dev/null
+++ b/svtools/source/undo/undo.cxx
@@ -0,0 +1,988 @@
+/*************************************************************************
+ *
+ * $RCSfile: undo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+
+#pragma hdrstop
+
+#include "undo.hxx"
+#include "svarray.hxx"
+
+#include "segmentc.hxx"
+
+//========================================================================
+
+SV_DECL_PTRARR( SfxUndoActions, SfxUndoAction*, 20, 8 )
+
+//====================================================================
+
+struct SfxUndoArray
+{
+ SfxUndoActions aUndoActions;
+ USHORT nMaxUndoActions;
+ USHORT nCurUndoAction;
+ SfxUndoArray *pFatherUndoArray;
+ SfxUndoArray(USHORT nMax=0) : pFatherUndoArray(0),
+ nCurUndoAction(0),nMaxUndoActions(nMax){}
+ ~SfxUndoArray();
+};
+
+//=========================================================================
+
+class SfxListUndoAction : public SfxUndoAction, public SfxUndoArray
+
+/* [Beschreibung]
+
+ UndoAction zur Klammerung mehrerer Undos in einer UndoAction.
+ Diese Actions werden vom SfxUndoManager verwendet. Dort
+ wird mit < SfxUndoManager::EnterListAction > eine Klammerebene
+ geoeffnet und mit <SfxUndoManager::LeaveListAction > wieder
+ geschlossen. Redo und Undo auf SfxListUndoActions wirken
+ Elementweise.
+
+*/
+
+
+
+
+{
+ public:
+ TYPEINFO();
+
+#ifndef ENABLEUNICODE
+ SfxListUndoAction( const String &rComment,
+ const String rRepeatComment, USHORT Id, SfxUndoArray *pFather);
+#else
+ SfxListUndoAction( const UniString &rComment,
+ const UniString rRepeatComment, USHORT Id, SfxUndoArray *pFather);
+#endif
+ virtual void Undo();
+ virtual void Redo();
+ virtual void Repeat(SfxRepeatTarget&);
+ virtual BOOL CanRepeat(SfxRepeatTarget&) const;
+
+#ifndef ENABLEUNICODE
+ virtual String GetComment() const;
+ virtual String GetRepeatComment(SfxRepeatTarget&) const;
+#else
+ virtual UniString GetComment() const;
+ virtual UniString GetRepeatComment(SfxRepeatTarget&) const;
+#endif
+ virtual USHORT GetId() const;
+
+
+ private:
+
+ USHORT nId;
+#ifndef ENABLEUNICODE
+ String aComment, aRepeatComment;
+#else
+ UniString aComment, aRepeatComment;
+#endif
+
+};
+
+// STATIC DATA -----------------------------------------------------------
+
+DBG_NAME(SfxUndoAction);
+
+SEG_EOFGLOBALS()
+
+//========================================================================
+
+TYPEINIT0(SfxUndoAction);
+TYPEINIT0(SfxListUndoAction);
+TYPEINIT0(SfxLinkUndoAction);
+TYPEINIT0(SfxRepeatTarget);
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_01)
+
+SfxRepeatTarget::~SfxRepeatTarget()
+{
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_34)
+
+BOOL SfxUndoAction::IsLinked()
+{
+ return bLinked;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_35)
+
+void SfxUndoAction::SetLinked( BOOL bIsLinked )
+{
+ bLinked = bIsLinked;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_36)
+
+SfxUndoAction::~SfxUndoAction()
+{
+ DBG_DTOR(SfxUndoAction, 0);
+ DBG_ASSERT( !IsLinked(), "Gelinkte Action geloescht" )
+}
+
+
+#pragma SEG_FUNCDEF(undo_02)
+
+SfxUndoAction::SfxUndoAction()
+{
+ DBG_CTOR(SfxUndoAction, 0);
+ SetLinked( FALSE );
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_03)
+
+BOOL SfxUndoAction::Merge( SfxUndoAction * )
+{
+ DBG_CHKTHIS(SfxUndoAction, 0);
+ return FALSE;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_04)
+
+XubString SfxUndoAction::GetComment() const
+{
+ DBG_CHKTHIS(SfxUndoAction, 0);
+ return XubString();
+}
+
+//------------------------------------------------------------------------
+
+
+#pragma SEG_FUNCDEF(undo_05)
+
+USHORT SfxUndoAction::GetId() const
+{
+ DBG_CHKTHIS(SfxUndoAction, 0);
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_06)
+
+XubString SfxUndoAction::GetRepeatComment(SfxRepeatTarget&) const
+{
+ DBG_CHKTHIS(SfxUndoAction, 0);
+ return GetComment();
+}
+
+//------------------------------------------------------------------------
+
+
+#pragma SEG_FUNCDEF(undo_07)
+
+void SfxUndoAction::Undo()
+{
+ // die sind nur konzeptuell pure virtual
+ DBG_ERROR( "pure virtual function called: SfxUndoAction::Undo()" );
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_08)
+
+void SfxUndoAction::Redo()
+{
+ // die sind nur konzeptuell pure virtual
+ DBG_ERROR( "pure virtual function called: SfxUndoAction::Redo()" );
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_09)
+
+void SfxUndoAction::Repeat(SfxRepeatTarget&)
+{
+ // die sind nur konzeptuell pure virtual
+ DBG_ERROR( "pure virtual function called: SfxUndoAction::Repeat()" );
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_0A)
+
+BOOL SfxUndoAction::CanRepeat(SfxRepeatTarget&) const
+{
+ return TRUE;
+}
+
+//========================================================================
+
+#pragma SEG_FUNCDEF(undo_0B)
+
+SfxUndoManager::SfxUndoManager( USHORT nMaxUndoActionCount )
+ : pFatherUndoArray(0)
+{
+ pUndoArray=new SfxUndoArray(nMaxUndoActionCount);
+ pActUndoArray=pUndoArray;
+
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_0C)
+
+SfxUndoManager::~SfxUndoManager()
+{
+ delete pUndoArray;
+}
+
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_0D)
+
+void SfxUndoManager::SetMaxUndoActionCount( USHORT nMaxUndoActionCount )
+{
+ // Redo-Actions loeschen
+ for ( USHORT nPos = pActUndoArray->aUndoActions.Count();
+ nPos > pActUndoArray->nCurUndoAction &&
+ !pActUndoArray->aUndoActions[nPos - 1 ]->IsLinked();
+ --nPos )
+ {
+ delete pActUndoArray->aUndoActions[nPos-1];
+ pActUndoArray->aUndoActions.Remove(
+ nPos - 1 );
+ }
+
+ while ( nMaxUndoActionCount < pActUndoArray->aUndoActions.Count() &&
+ !pActUndoArray->aUndoActions[0]->IsLinked())
+ {
+ delete pActUndoArray->aUndoActions[0];
+ pActUndoArray->aUndoActions.Remove(0);
+ --pActUndoArray->nCurUndoAction;
+ }
+
+ pActUndoArray->nMaxUndoActions = nMaxUndoActionCount;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_0E)
+
+USHORT SfxUndoManager::GetMaxUndoActionCount() const
+{
+ return pActUndoArray->nMaxUndoActions;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_0F)
+
+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;
+ }
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_10)
+
+void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge )
+{
+ // 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;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_11)
+
+USHORT SfxUndoManager::GetUndoActionCount() const
+{
+ return pActUndoArray->nCurUndoAction;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_12)
+
+XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const
+{
+ return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //!
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_13)
+
+USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const
+{
+ return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetId(); //!
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_14)
+
+BOOL SfxUndoManager::Undo( USHORT nCount )
+{
+ if ( pActUndoArray->nCurUndoAction )
+ {
+ Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_15)
+
+void SfxUndoManager::Undo( SfxUndoAction &rAction )
+{
+ rAction.Undo();
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_16)
+
+USHORT SfxUndoManager::GetRedoActionCount() const
+{
+ return pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction; //!
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_17)
+
+XubString SfxUndoManager::GetRedoActionComment( USHORT nNo ) const
+{
+ return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetComment(); //!
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_18)
+
+USHORT SfxUndoManager::GetRedoActionId( USHORT nNo ) const
+{
+ return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetId(); //!
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_19)
+
+BOOL SfxUndoManager::Redo( USHORT nNumber )
+{
+ if ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction )
+ {
+ Redo( *pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction++] );
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_1A)
+
+void SfxUndoManager::Redo( SfxUndoAction &rAction )
+{
+ rAction.Redo();
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_1B)
+
+USHORT SfxUndoManager::GetRepeatActionCount() const
+{
+ return pActUndoArray->aUndoActions.Count();
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_1C)
+
+XubString SfxUndoManager::GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo ) const
+{
+ return pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 - nNo ]
+ ->GetRepeatComment(rTarget);
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_1D)
+
+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;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_1E)
+
+void SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction )
+{
+ if ( rAction.CanRepeat(rTarget) )
+ rAction.Repeat(rTarget);
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_1F)
+
+BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const
+{
+ return rAction.CanRepeat(rTarget);
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_20)
+
+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;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_21)
+
+void SfxUndoManager::EnterListAction(
+ const XubString& rComment, const XubString &rRepeatComment, USHORT nId )
+
+/* [Beschreibung]
+
+ Fuegt eine ListUndoAction ein und setzt dessen UndoArray als aktuelles.
+*/
+
+{
+ if ( !pUndoArray->nMaxUndoActions )
+ return;
+
+ pFatherUndoArray=pActUndoArray;
+ SfxListUndoAction *pAction=new SfxListUndoAction(
+ rComment, rRepeatComment, nId, pActUndoArray);
+ AddUndoAction( pAction );
+ pActUndoArray=pAction;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_22)
+
+void SfxUndoManager::LeaveListAction()
+
+/* [Beschreibung]
+
+ Verlaesst die aktuelle ListAction und geht eine Ebene nach oben.
+*/
+{
+ if ( !pUndoArray->nMaxUndoActions )
+ return;
+
+ DBG_ASSERT(pActUndoArray->pFatherUndoArray,"Keine hoehere Undo Ebene existent");
+
+ SfxUndoArray* pTmp=pActUndoArray;
+ pActUndoArray=pActUndoArray->pFatherUndoArray;
+
+//Falls keine UndoAction eingefuegt wurde, entferne die UndoListAction
+
+ if(!pTmp->nCurUndoAction)
+ {
+ SfxUndoAction *pTmpAction=
+ pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1];
+ pActUndoArray->aUndoActions.Remove( --pActUndoArray->nCurUndoAction);
+ delete pTmpAction;
+ }
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_23)
+
+USHORT SfxListUndoAction::GetId() const
+{
+ return nId;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_24)
+
+XubString SfxListUndoAction::GetComment() const
+{
+ return aComment;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_25)
+
+XubString SfxListUndoAction::GetRepeatComment(SfxRepeatTarget &r) const
+{
+ return aRepeatComment;
+}
+
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_26)
+
+SfxListUndoAction::SfxListUndoAction
+(
+ const XubString &rComment,
+ const XubString rRepeatComment,
+ USHORT Id,
+ SfxUndoArray *pFather
+)
+: aComment(rComment), aRepeatComment(rRepeatComment), nId(Id)
+{
+ pFatherUndoArray = pFather;
+ nMaxUndoActions = USHRT_MAX;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_27)
+
+void SfxListUndoAction::Undo()
+{
+ for(INT16 i=nCurUndoAction-1;i>=0;i--)
+ aUndoActions[i]->Undo();
+ nCurUndoAction=0;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_28)
+
+void SfxListUndoAction::Redo()
+{
+ for(USHORT i=nCurUndoAction;i<aUndoActions.Count();i++)
+ aUndoActions[i]->Redo();
+ nCurUndoAction = aUndoActions.Count();
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_29)
+
+void SfxListUndoAction::Repeat(SfxRepeatTarget&rTarget)
+{
+ for(USHORT i=0;i<nCurUndoAction;i++)
+ aUndoActions[i]->Repeat(rTarget);
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_2A)
+
+BOOL SfxListUndoAction::CanRepeat(SfxRepeatTarget&r) const
+{
+ for(USHORT i=0;i<nCurUndoAction;i++)
+ if(!aUndoActions[i]->CanRepeat(r))
+ return FALSE;
+ return TRUE;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_2B)
+
+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;
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_2C)
+
+void SfxLinkUndoAction::Undo()
+{
+ if ( pAction )
+ pUndoManager->Undo(1);
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_2D)
+
+void SfxLinkUndoAction::Redo()
+{
+ if ( pAction )
+ pUndoManager->Redo(1);
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_2E)
+
+BOOL SfxLinkUndoAction::CanRepeat(SfxRepeatTarget& r) const
+{
+ return pAction && pUndoManager->CanRepeat(r,*pAction);
+}
+
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_2F)
+
+void SfxLinkUndoAction::Repeat(SfxRepeatTarget&r)
+{
+ if ( pAction )
+ pUndoManager->Repeat(r,*pAction);
+}
+
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_30)
+
+XubString SfxLinkUndoAction::GetComment() const
+{
+ if ( pAction )
+ return pAction->GetComment();
+ else
+ return XubString();
+}
+
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_31)
+
+XubString SfxLinkUndoAction::GetRepeatComment(SfxRepeatTarget&r) const
+{
+ if ( pAction )
+ return pAction->GetRepeatComment(r);
+ else
+ return XubString();
+}
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_37)
+
+SfxLinkUndoAction::~SfxLinkUndoAction()
+{
+ if( pAction )
+ pAction->SetLinked( FALSE );
+}
+
+
+//------------------------------------------------------------------------
+
+#pragma SEG_FUNCDEF(undo_32)
+
+USHORT SfxLinkUndoAction::GetId() const
+{
+ return pAction ? pAction->GetId() : 0;
+}
+
+#pragma SEG_FUNCDEF(undo_33)
+
+SfxUndoArray::~SfxUndoArray()
+{
+ while ( aUndoActions.Count() )
+ {
+ SfxUndoAction *pAction =
+ aUndoActions[ aUndoActions.Count() - 1 ];
+ aUndoActions.Remove( aUndoActions.Count() - 1 );
+ delete pAction;
+ }
+}
+
+
+
+/*------------------------------------------------------------------------
+
+ $Log: not supported by cvs2svn $
+ Revision 1.44 2000/09/18 14:13:48 willem.vandorp
+ OpenOffice header added.
+
+ Revision 1.43 2000/08/31 13:53:28 willem.vandorp
+ Header and footer replaced
+
+ Revision 1.42 2000/02/09 16:29:42 hr
+ #70473# changes for unicode ( patched by automated patchtool )
+
+ Revision 1.41 1998/01/20 09:08:18 MH
+ chg: header
+
+
+ Rev 1.40 20 Jan 1998 10:08:18 MH
+ chg: header
+
+ Rev 1.39 07 Aug 1997 16:32:38 TJ
+ include
+
+ Rev 1.38 01 Oct 1996 13:29:00 MI
+ ClearRedo()
+
+ Rev 1.37 13 Jun 1996 10:47:00 MI
+ weniger Compiler-Keys
+
+ Rev 1.36 21 Mar 1996 14:56:34 MI
+ alte C_VErSION
+
+ Rev 1.35 19 Mar 1996 12:05:34 TLX
+ #25200# noch vorsichtiger mit gelinten Actions
+
+ Rev 1.34 14 Mar 1996 17:42:58 MH
+ del: S_VERSION
+
+ Rev 1.33 09 Feb 1996 18:43:38 TLX
+ #25200# Bei Remove von Undoactions Linking beachten
+
+ Rev 1.32 01 Dec 1995 17:40:34 TLX
+ Loesche gemergte Actions
+
+ Rev 1.31 29 Nov 1995 12:09:28 TLX
+ Destruktor fuer UndoArrays
+
+ Rev 1.30 23 Nov 1995 16:39:42 AB
+ Unicode-Anpassung
+
+ Rev 1.29 13 Nov 1995 10:48:38 TLX
+ SetMaxUndoCount loescht nur noch ueberzaehlige Actions
+
+ Rev 1.27 06 Nov 1995 16:18:18 MI
+ Bugfix Absturz bei ListActions und zu kleinem MaxCount
+
+ Rev 1.26 04 Oct 1995 16:28:10 MI
+ CanRepeat-Syntax-Fehler in 257
+
+ Rev 1.25 29 Sep 1995 08:30:08 MI
+ neue Methode SfxUndoManager::CanRepeat() mit Index
+
+ Rev 1.24 07 Aug 1995 19:49:42 TLX
+ Auschneiden gibt keinen gpf mehr
+
+ Rev 1.23 31 Jul 1995 14:28:26 MT
+ Undo/Redo in ListUndoAction behoben (nCurPos)
+
+ Rev 1.22 31 Jul 1995 13:09:04 PB
+
+ Rev 1.21 31 Jul 1995 12:50:36 PB
+
+ Rev 1.20 31 Jul 1995 12:46:14 PB
+
+ Rev 1.19 31 Jul 1995 12:38:54 PB
+
+ Rev 1.18 31 Jul 1995 11:22:20 TLX
+
+ Rev 1.17 05 Jul 1995 16:10:48 TLX
+ Neue Undofeatures
+
+ Rev 1.16 06 Jun 1995 18:48:26 TRI
+ ~SfxRepeatTarget impl.
+
+ Rev 1.15 06 Jun 1995 13:26:54 MI
+ SfxRepeatTarget -- INKOMPATIBEL
+
+ Rev 1.14 02 May 1995 18:40:36 TRI
+ WATCOM Anpassung
+
+ Rev 1.13 18 Apr 1995 19:03:50 MI
+ neue Methode Clear() -- kompatibel
+
+ Rev 1.12 29 Mar 1995 17:30:48 MI
+ Bugfix: AddUndoAction
+
+ Rev 1.11 23 Mar 1995 18:45:20 MI
+ Begrenzung implementiert
+
+ Rev 1.10 15 Dec 1994 09:32:38 MI
+ svmem
+
+ Rev 1.9 31 Oct 1994 11:22:54 MI
+ CanRepeat
+
+ Rev 1.8 25 Oct 1994 12:00:48 VB
+ hdrstop
+
+ Rev 1.7 20 Oct 1994 17:10:54 MI
+ Jobsetup
+
+ Rev 1.6 28 Sep 1994 19:29:30 MI
+ pch-Probleme und Printing
+
+ Rev 1.5 23 Sep 1994 09:43:14 MI
+ Bugfix: Syntaxfehler
+
+ Rev 1.4 23 Sep 1994 09:10:56 MI
+ repeat dummy ersetzt
+
+ Rev 1.3 23 Sep 1994 09:01:52 MI
+ repeat-dummy
+
+ Rev 1.2 22 Sep 1994 17:37:02 MI
+ Undo und ItemSet immer mit Pool
+
+ Rev 1.1 21 Sep 1994 10:49:04 MI
+ pch
+
+ Rev 1.0 19 Sep 1994 17:04:18 MI
+ Initial revision.
+
+------------------------------------------------------------------------*/
+
+#pragma SEG_EOFMODULE
+
diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk
new file mode 100644
index 000000000000..46e22c8c3823
--- /dev/null
+++ b/svtools/source/uno/makefile.mk
@@ -0,0 +1,253 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=unoiface
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+UNOUCROUT=$(OUT)$/inc
+
+#not all needed...
+
+UNOTYPES= \
+ com.sun.star.awt.CharSet \
+ com.sun.star.awt.DeviceCapability \
+ com.sun.star.awt.FontDescriptor \
+ com.sun.star.awt.FontPitch \
+ com.sun.star.awt.FontSlant \
+ com.sun.star.awt.FontStrikeout \
+ com.sun.star.awt.FontStrikeout \
+ com.sun.star.awt.FontType \
+ com.sun.star.awt.FontUnderline \
+ com.sun.star.awt.FontWeight \
+ com.sun.star.awt.FontWidth \
+ com.sun.star.awt.KeyModifier \
+ com.sun.star.awt.MenuItemStyle \
+ com.sun.star.awt.MessageBoxCommand \
+ com.sun.star.awt.MouseButton \
+ com.sun.star.awt.PopupMenuDirection \
+ com.sun.star.awt.ScrollBarOrientation \
+ com.sun.star.awt.Style \
+ com.sun.star.awt.TextAlign \
+ com.sun.star.awt.VclWindowPeerAttribute \
+ com.sun.star.awt.WindowAttribute \
+ com.sun.star.awt.XActionListener \
+ com.sun.star.awt.XAdjustmentListener \
+ com.sun.star.awt.XBitmap \
+ com.sun.star.awt.XButton \
+ com.sun.star.awt.XCheckBox \
+ com.sun.star.awt.XComboBox \
+ com.sun.star.awt.XControl \
+ com.sun.star.awt.XControlContainer \
+ com.sun.star.awt.XControlModel \
+ com.sun.star.awt.XCurrencyField \
+ com.sun.star.awt.XDateField \
+ com.sun.star.awt.XDevice \
+ com.sun.star.awt.XDialog \
+ com.sun.star.awt.XFileDialog \
+ com.sun.star.awt.XFixedText \
+ com.sun.star.awt.XFocusListener \
+ com.sun.star.awt.XFont \
+ com.sun.star.awt.XGraphics \
+ com.sun.star.awt.XImageButton \
+ com.sun.star.awt.XImageConsumer \
+ com.sun.star.awt.XImageProducer \
+ com.sun.star.awt.ImageStatus \
+ com.sun.star.awt.XInfoPrinter \
+ com.sun.star.awt.XItemListener \
+ com.sun.star.awt.XKeyListener \
+ com.sun.star.awt.XLayoutConstrains \
+ com.sun.star.awt.XListBox \
+ com.sun.star.awt.XMenuListener \
+ com.sun.star.awt.XMessageBox \
+ com.sun.star.awt.XMouseListener \
+ com.sun.star.awt.XMouseMotionListener \
+ com.sun.star.awt.XNumericField \
+ com.sun.star.util.XNumberFormatsSupplier \
+ com.sun.star.awt.XPaintListener \
+ com.sun.star.awt.XPatternField \
+ com.sun.star.awt.XPointer \
+ com.sun.star.awt.XPrinter \
+ com.sun.star.awt.XPrinterPropertySet \
+ com.sun.star.awt.XPrinterServer \
+ com.sun.star.awt.XProgressBar \
+ com.sun.star.awt.XProgressMonitor \
+ com.sun.star.awt.XRadioButton \
+ com.sun.star.awt.XRegion \
+ com.sun.star.awt.XScrollBar \
+ com.sun.star.awt.XSpinField \
+ com.sun.star.awt.XSpinListener \
+ com.sun.star.awt.XSystemDependentWindowPeer \
+ com.sun.star.awt.XTabController \
+ com.sun.star.awt.XTabControllerModel \
+ com.sun.star.awt.XTextArea \
+ com.sun.star.awt.XTextComponent \
+ com.sun.star.awt.XTextEditField \
+ com.sun.star.awt.XTextLayoutConstrains \
+ com.sun.star.awt.XTextListener \
+ com.sun.star.awt.XTimeField \
+ com.sun.star.awt.XToolkit \
+ com.sun.star.awt.XTopWindow \
+ com.sun.star.awt.XTopWindowListener \
+ com.sun.star.awt.XUnoControlContainer \
+ com.sun.star.awt.XVclContainer \
+ com.sun.star.awt.XVclContainerListener \
+ com.sun.star.awt.XVclContainerPeer \
+ com.sun.star.awt.XVclWindowPeer \
+ com.sun.star.awt.XWindow \
+ com.sun.star.awt.XWindowListener \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.beans.PropertyChangeEvent \
+ com.sun.star.beans.PropertyState \
+ com.sun.star.beans.PropertyStateChangeEvent \
+ com.sun.star.beans.PropertyValue \
+ com.sun.star.beans.PropertyValues \
+ com.sun.star.beans.XFastPropertySet \
+ com.sun.star.beans.XMultiPropertySet \
+ com.sun.star.beans.XPropertiesChangeListener \
+ com.sun.star.beans.XPropertyAccess \
+ com.sun.star.beans.XPropertyChangeListener \
+ com.sun.star.beans.XPropertyContainer \
+ com.sun.star.beans.XPropertySet \
+ com.sun.star.beans.XPropertySetInfo \
+ com.sun.star.beans.XPropertyState \
+ com.sun.star.beans.XVetoableChangeListener \
+ com.sun.star.container.XContainer \
+ com.sun.star.container.XContainerListener \
+ com.sun.star.container.XNameContainer \
+ com.sun.star.frame.XModel \
+ com.sun.star.frame.XFrameLoader \
+ com.sun.star.frame.XLoadEventListener \
+ com.sun.star.frame.XController \
+ com.sun.star.frame.XDispatch \
+ com.sun.star.frame.XDispatchProvider \
+ com.sun.star.frame.XStorable \
+ com.sun.star.frame.XFrame \
+ com.sun.star.frame.FeatureStateEvent \
+ com.sun.star.frame.DispatchDescriptor \
+ com.sun.star.io.XInputStream \
+ com.sun.star.io.XMarkableStream \
+ com.sun.star.io.XObjectInputStream \
+ com.sun.star.io.XConnectable \
+ com.sun.star.io.XActiveDataControl \
+ com.sun.star.io.XActiveDataSink \
+ com.sun.star.io.XActiveDataSource \
+ com.sun.star.lang.IllegalArgumentException \
+ com.sun.star.lang.SystemDependent \
+ com.sun.star.lang.XEventListener \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XServiceName \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XUnoTunnel \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.util.XSearchable \
+ com.sun.star.util.XSearchDescriptor \
+ com.sun.star.util.XURLTransformer \
+ com.sun.star.view.XScreenCursor \
+ com.sun.star.text.XTextCursor \
+ com.sun.star.text.XText \
+ com.sun.star.text.XTextRange \
+ com.sun.star.text.XTextViewCursor \
+ com.sun.star.text.XTextViewCursorSupplier \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XWeak
+
+
+.IF "$(GUI)"!="DOS"
+SRS1NAME= uno
+SRC1FILES= unoifac2.src
+.ENDIF
+
+SLOFILES= \
+ $(SLO)$/registerservices.obj \
+ $(SLO)$/unoifac3.obj \
+ $(SLO)$/unoifac2.obj \
+ $(SLO)$/unoiface.obj \
+ $(SLO)$/imgprod.obj
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= $(SLOFILES)
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/source/uno/registerservices.cxx b/svtools/source/uno/registerservices.cxx
new file mode 100644
index 000000000000..97b73de10a4f
--- /dev/null
+++ b/svtools/source/uno/registerservices.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: registerservices.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#include <cppuhelper/factory.hxx>
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <unoifac3.hxx>
+#include <unoiface.hxx>
+
+#include <toolkit/helper/macros.hxx>
+
+#define IMPL_CREATEINSTANCE( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); }
+
+// for CreateInstance functions implemented elsewhere
+#define DECLARE_CREATEINSTANCE( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+// -------------------------------------------------------------------------------------
+
+IMPL_CREATEINSTANCE( SvtTextLoader )
+IMPL_CREATEINSTANCE( ExtVCLXToolkit )
+DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject )
+
+extern "C"
+{
+
+void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, void* _pRegistryKey )
+{
+ if (_pRegistryKey)
+ {
+ ::com::sun::star::registry::XRegistryKey * pRegistryKey = reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( _pRegistryKey );
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xNewKey;
+
+ xNewKey = pRegistryKey->createKey( ::rtl::OUString::createFromAscii( "/stardiv.svtools.ExtVCLXToolkit/UNO/SERVICES" ) );
+ xNewKey->createKey( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ExtToolkit" ) );
+
+ xNewKey = pRegistryKey->createKey( ::rtl::OUString::createFromAscii( "/stardiv.svtools.SvtTextLoader/UNO/SERVICES" ) );
+ xNewKey->createKey( ::rtl::OUString::createFromAscii( "stardiv.one.frame.FrameLoader" ) );
+ xNewKey->createKey( ::rtl::OUString::createFromAscii( "stardiv.one.frame.TextLoader" ) );
+ xNewKey = pRegistryKey->createKey( ::rtl::OUString::createFromAscii( "/stardiv.svtools.SvtTextLoader/UNO/Loader" ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xLoaderKey = pRegistryKey->createKey( ::rtl::OUString::createFromAscii( "/stardiv.svtools.SvtTextLoader/Loader" ) );
+ xNewKey = xLoaderKey->createKey( ::rtl::OUString::createFromAscii( "Pattern" ) );
+ xNewKey->setAsciiValue( ::rtl::OUString::createFromAscii( ".component:Text*" ) );
+
+ xNewKey = pRegistryKey->createKey( ::rtl::OUString::createFromAscii( "/com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject/UNO/SERVICES" ) );
+ xNewKey->createKey( ::rtl::OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" ) );
+
+// !!!
+/*
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xKey;
+ uno2smart(xKey, *xUnoKey);
+
+ ::rtl::OUString aImpl( L"/" );
+ aImpl += SvUnoAttributeContainer::getStaticImplementationName();
+ aImpl += L"/UNO/SERVICES";
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xNewKey = xKey->createKey( aImpl );
+ ::com::sun::star::uno::Sequence <::rtl::OUString> aSequ = SvUnoAttributeContainer::getStaticSupportedServiceNames();
+ const ::rtl::OUString* pArray = aSequ.getConstArray();
+ for( sal_Int32 i = 0; i < aSequ.getLength(); i++ )
+ xNewKey->createKey( pArray[i] );
+*/
+
+ }
+ return sal_True;
+}
+
+void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey )
+{
+ void* pRet = NULL;
+
+ if ( _pServiceManager )
+ {
+ ::com::sun::star::lang::XMultiServiceFactory* pServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
+
+ if ( rtl_str_compare( sImplementationName, "stardiv.svtools.SvtTextLoader") == 0 )
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames(2);
+ aServiceNames.getArray()[0] = ::rtl::OUString::createFromAscii( "stardiv.one.frame.FrameLoader" );
+ aServiceNames.getArray()[1] = ::rtl::OUString::createFromAscii( "stardiv.one.frame.TextLoader" );
+ xFactory = ::cppu::createSingleFactory( pServiceManager, ::rtl::OUString::createFromAscii( sImplementationName ), SvtTextLoader_CreateInstance, aServiceNames );
+ }
+ else if ( rtl_str_compare( sImplementationName, "stardiv.svtools.ExtVCLXToolkit" ) == 0 )
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames(1);
+ aServiceNames.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.ExtToolkit" );
+ xFactory = ::cppu::createSingleFactory( pServiceManager, ::rtl::OUString::createFromAscii( sImplementationName ), ExtVCLXToolkit_CreateInstance, aServiceNames );
+ }
+ if ( rtl_str_compare( sImplementationName, "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0 )
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames(1);
+ aServiceNames.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" );
+ xFactory = ::cppu::createSingleFactory( pServiceManager, ::rtl::OUString::createFromAscii( sImplementationName ), SvNumberFormatsSupplierServiceObject_CreateInstance, aServiceNames );
+ }
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+}
+
+} // "C"
+
diff --git a/svtools/source/uno/unoifac2.hrc b/svtools/source/uno/unoifac2.hrc
new file mode 100644
index 000000000000..3fff8059c489
--- /dev/null
+++ b/svtools/source/uno/unoifac2.hrc
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * $RCSfile: unoifac2.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVT_UNO_UNOIFAC_HRC_
+#define _SVT_UNO_UNOIFAC_HRC_
+
+
+#ifndef _SOLAR_HRC
+#include <solar.hrc>
+#endif
+
+//! Um den Überblick über alle benutzten HelpID's zu behalten sind diese
+//! zentral in <helpid.hrc>
+#ifndef _SVT_HELPID_HRC
+#include <helpid.hrc>
+#endif
+
+// RID's fuer das Kontextmenu der Textkomponente
+#define RID_CONTEXTMENU (RID_APP_START + 1024)
+#define RID_OPEN_LINK (RID_APP_START + 10)
+#define RID_OPEN_LINK_NEW (RID_APP_START + 11)
+#define RID_DOWNLOAD (RID_APP_START + 12)
+#define RID_ADD_BOOKMARK (RID_APP_START + 13)
+#define RID_COPY_LINK (RID_APP_START + 14)
+
+
+#endif
+
diff --git a/svtools/source/uno/unoifac2.src b/svtools/source/uno/unoifac2.src
new file mode 100644
index 000000000000..b201c22be192
--- /dev/null
+++ b/svtools/source/uno/unoifac2.src
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * $RCSfile: unoifac2.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+
+#ifndef _SVT_UNO_UNOIFAC_HRC_
+#include <unoifac2.hrc>
+#endif
+
+
+Menu RID_CONTEXTMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = RID_OPEN_LINK ;
+ HelpId = HID_TEXTCPNT_OPEN_LINK ;
+ Text = "Öff~nen" ;
+ Text[ English ] = "~Open" ;
+ Text[ italian ] = "~Apri";
+ Text[ portuguese_brazilian ] = "Öff~nen";
+ Text[ portuguese ] = "~Abrir";
+ Text[ danish ] = "Å~bn";
+ Text[ french ] = "Ouvrir";
+ Text[ swedish ] = "~Öppna";
+ Text[ dutch ] = "Ope~nen";
+ Text[ spanish ] = "~Abrir";
+ Text[ english_us ] = "~Open";
+ Text[ chinese_simplified ] = "´ò¿ª(~O)";
+ Text[ russian ] = "Îòêðûòü";
+ Text[ polish ] = "Otwórz";
+ Text[ japanese ] = "ŠJ‚­(~O)";
+ Text[ chinese_traditional ] = "¶}±Ò·sÀÉ(~O)";
+ Text[ arabic ] = "ÝÊÍ";
+ Text[ dutch ] = "Ope~nen";
+ Text[ chinese_simplified ] = "´ò¿ª(~O)";
+ Text[ greek ] = "¢~íïéãìá";
+ Text[ korean ] = "¿­±â(~O)";
+ Text[ turkish ] = "Aç";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_OPEN_LINK_NEW ;
+ HelpId = HID_TEXTCPNT_OPEN_LINK_NEW ;
+ Text = "Öffnen in neuem ~Fenster" ;
+ Text[ English ] = "Open in ~new window" ;
+ Text[ italian ] = "Apri nella ~finestra nuova";
+ Text[ portuguese_brazilian ] = "Öff~nen in neuem ~Fenster";
+ Text[ portuguese ] = "Abrir em ~nova janela";
+ Text[ danish ] = "Åbn i nyt vindue";
+ Text[ french ] = "Ouvrir dans une nouvelle ~fenêtre";
+ Text[ swedish ] = "~Öppna i ett nytt fönster";
+ Text[ dutch ] = "Openen in nieuw ~venster";
+ Text[ spanish ] = "Abrir en ~ventana nueva";
+ Text[ english_us ] = "Open in New ~Window";
+ Text[ chinese_simplified ] = "ʹÓÃÒ»¸öÐÂÊÓ´°´ò¿ª(~W)";
+ Text[ russian ] = "Îòêðûòü â íîâîì îêíå";
+ Text[ polish ] = "Otwórz w nowym oknie";
+ Text[ japanese ] = "V‚µ‚¢³¨ÝÄÞ³‚ðŠJ‚­(~W)";
+ Text[ chinese_traditional ] = "¥Î¤@­Ó·sµøµ¡¶}±Ò(~W)";
+ Text[ arabic ] = "ÝÊÍ Ýí äÇÝÐÉ ÌÏíÏÉ";
+ Text[ dutch ] = "Openen in nieuw ~venster";
+ Text[ chinese_simplified ] = "ʹÓÃÒ»¸öÐÂÊÓ´°´ò¿ª(~W)";
+ Text[ greek ] = "¢íïéãìá óå íÝï ~ðáñÜèõñï";
+ Text[ korean ] = "»õ â¿¡¼­ ¿­±â(~W)";
+ Text[ turkish ] = "Yeni bir pencerede aç";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = RID_DOWNLOAD ;
+ HelpId = HID_TEXTCPNT_DOWNLOAD ;
+ Text = "~Download..." ;
+ Text[ English ] = "~Download..." ;
+ Text[ italian ] = "~Download...";
+ Text[ portuguese_brazilian ] = "~Download...";
+ Text[ portuguese ] = "~Download...";
+ Text[ danish ] = "Overfør...";
+ Text[ french ] = "~Téléchargement...";
+ Text[ swedish ] = "~Ladda ned...";
+ Text[ dutch ] = "~Downloaden...";
+ Text[ spanish ] = "~Descargar...";
+ Text[ english_us ] = "~Download...";
+ Text[ chinese_simplified ] = "ÏÂÔØ(~D)...";
+ Text[ russian ] = "Çàãðóçêà...";
+ Text[ polish ] = "Pobieranie...";
+ Text[ japanese ] = "ÀÞ³ÝÛ°ÄÞ(~D)...";
+ Text[ chinese_traditional ] = "¤U¸ü(~D)...";
+ Text[ arabic ] = "ÊäÒíá...";
+ Text[ dutch ] = "~Downloaden...";
+ Text[ chinese_simplified ] = "ÏÂÔØ(~D)...";
+ Text[ greek ] = "~ËÞøç áñ÷åßùí...";
+ Text[ korean ] = "´Ù¿î·Îµå(~D)...";
+ Text[ turkish ] = "Ýndir...";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_ADD_BOOKMARK ;
+ HelpId = HID_TEXTCPNT_ADD_BOOKMARK ;
+ Text = "Verknüpfung ~hinzufügen" ;
+ Text[ English ] = "~Add bookmark" ;
+ Text[ italian ] = "~Aggiungi collegamento";
+ Text[ portuguese_brazilian ] = "Verknüpfung ~hinzufügen";
+ Text[ portuguese ] = "Adicionar ~ligação";
+ Text[ danish ] = "Tilføj kæde";
+ Text[ french ] = "~Ajouter un lien";
+ Text[ swedish ] = "Lägg till l~änk";
+ Text[ dutch ] = "Koppeling ~toevoegen";
+ Text[ spanish ] = "~Añadir vínculo";
+ Text[ english_us ] = "Add ~Link";
+ Text[ chinese_simplified ] = "ÐÂÔöÁ´½Ó(~L)";
+ Text[ russian ] = "Äîáàâèòü ññûëêó";
+ Text[ polish ] = "Dodaj ³¹cze";
+ Text[ japanese ] = "Øݸ‚̒ljÁ(~L)";
+ Text[ chinese_traditional ] = "¥[¤J±¶®|(~L)";
+ Text[ arabic ] = "ÅÖÇÝÉ ÇÑÊÈÇØ";
+ Text[ dutch ] = "Koppeling ~toevoegen";
+ Text[ chinese_simplified ] = "ÐÂÔöÁ´½Ó(~L)";
+ Text[ greek ] = "ÐñïóèÞê~ç óýíäåóçò";
+ Text[ korean ] = "¿¬°á Ãß°¡(~L)";
+ Text[ turkish ] = "Baðlantýyý ekle";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Separator = TRUE;
+ };
+ MenuItem
+ {
+ Identifier = RID_COPY_LINK ;
+ HelpId = HID_TEXTCPNT_COPY_LINK ;
+ Text = "~Link kopieren" ;
+ Text[ English ] = "~Copy Link" ;
+ Text[ english_us ] = "Cop~y Link" ;
+ Text[ portuguese ] = "~Copiar ligação" ;
+ Text[ portuguese_brazilian ] = "~Link kopieren" ;
+ Text[ swedish ] = "~Kopiera länk" ;
+ Text[ danish ] = "Kopier kæde" ;
+ Text[ italian ] = "Copia ~link" ;
+ Text[ spanish ] = "Copiar ~vínculo" ;
+ Text[ french ] = "Copier le ~lien" ;
+ Text[ dutch ] = "~Link kopiëren" ;
+ Text[ chinese_simplified ] = "¸´ÖÆÁ´½Ó(~Y)";
+ Text[ russian ] = "Êîïèðîâàòü ññûëêó";
+ Text[ polish ] = "Kopiuj ³¹cze";
+ Text[ japanese ] = "Øݸ‚̺Ëß°(~Y)";
+ Text[ chinese_traditional ] = "Î`»s±¶®|(~Y)";
+ Text[ arabic ] = "äÓÎ ÇáÇÑÊÈÇØ";
+ Text[ dutch ] = "~Link kopiëren";
+ Text[ chinese_simplified ] = "¸´ÖÆÁ´½Ó(~Y)";
+ Text[ greek ] = "ÁíôéãñáöÞ ~óýíäåóçò";
+ Text[ korean ] = "¿¬°á º¹»ç(~Y)";
+ Text[ turkish ] = "Baðlantýyý kopyala";
+ Text[ language_user1 ] = " ";
+ };
+ };
+};
+
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
new file mode 100644
index 000000000000..d325e028a36f
--- /dev/null
+++ b/svtools/source/uno/unoiface.cxx
@@ -0,0 +1,1756 @@
+/*************************************************************************
+ *
+ * $RCSfile: unoiface.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SVT_UNOIFACE_CXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#include <svmedit.hxx>
+#ifndef _SVT_UNOIFACE_HXX
+#include <unoiface.hxx>
+#endif
+#include <filedlg.hxx>
+#include <filectrl.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _TOOLKIT_HELPER_CONVERT_HXX_
+#include <toolkit/helper/convert.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_PROPERTY_HXX_
+#include <toolkit/helper/property.hxx>
+#endif
+
+#ifndef _PRODUCE_HXX
+#include <imgprod.hxx>
+#endif
+
+#ifndef _FMTFIELD_HXX_
+#include <fmtfield.hxx>
+#endif
+
+#ifndef _NUMUNO_HXX
+#include <numuno.hxx>
+#endif
+
+#ifndef _CALENDAR_HXX
+#include <calendar.hxx>
+#endif
+
+// ----------------------------------------------------
+// class ExtUnoWrapper
+// ----------------------------------------------------
+void ExtUnoWrapper::RegisterUnoServices()
+{
+/*
+ UnoWrapper::RegisterUnoServices();
+
+ // ImageProducer registrieren...
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::usr::getProcessServiceManager();
+
+ ::rtl::OUString aServiceName( L"stardiv.uno.awt.ImageProducer" );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aServiceNames( &aServiceName, 1 );
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xSSF = ::usr::createOneInstanceFactory
+ ( xMSF, L"ImageProducer", ImageProducer_CreateInstance, aServiceNames );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XSet > xS( xMSF, UNO_QUERY );
+ ::com::sun::star::uno::Any aAny( &xSSF, ::getCppuType((const ::com::sun::star::container::XSet*)0) );
+ xS->insert( aAny );
+*/
+}
+
+// ----------------------------------------------------
+// class ExtVCLXToolkit
+// ----------------------------------------------------
+Window* ExtVCLXToolkit::CreateComponent( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor& rDescriptor, Window* pParent, sal_uInt32 nWinBits )
+{
+ Window* pWindow = NULL;
+ String aServiceName( rDescriptor.WindowServiceName );
+ if ( aServiceName.EqualsIgnoreCaseAscii( "MultiLineEdit" ) )
+ {
+ if ( pParent )
+ {
+ pWindow = new MultiLineEdit( pParent, nWinBits|WB_IGNORETAB);
+ *ppNewComp = new VCLXMultiLineEdit;
+ }
+ else
+ {
+ *ppNewComp = NULL;
+ return NULL;
+ }
+ }
+ // irgendwas muss ich mir noch fuer 'Custom-Bits' einfallen lassen,
+ // jetzt erstmal verschiedene Service-Namen:
+// else if ( aServiceName.ICompare( "FileDialog_open" ) == COMPARE_EQUAL )
+// {
+// pWindow = new FileDialog( pParent, nWinBits|WB_OPEN );
+// *ppNewComp = new VCLXFileDialog;
+// }
+// else if ( aServiceName.ICompare( "FileDialog_save" ) == COMPARE_EQUAL )
+// {
+// pWindow = new FileDialog( pParent, nWinBits|WB_SAVEAS );
+// *ppNewComp = new VCLXFileDialog;
+// }
+ else if ( aServiceName.EqualsIgnoreCaseAscii( "FileControl" ) )
+ {
+ if ( pParent )
+ {
+ pWindow = new FileControl( pParent, nWinBits );
+ *ppNewComp = new VCLXFileControl;
+ }
+ else
+ {
+ *ppNewComp = NULL;
+ return NULL;
+ }
+ }
+ else if (aServiceName.EqualsIgnoreCaseAscii("FormattedField") )
+ {
+ pWindow = new FormattedField(pParent, nWinBits);
+ *ppNewComp = new SVTXFormattedField;
+ }
+ else if (aServiceName.EqualsIgnoreCaseAscii("NumericField") )
+ {
+ pWindow = new DoubleNumericField( pParent, nWinBits );
+ *ppNewComp = new SVTXNumericField;
+ }
+ else if (aServiceName.EqualsIgnoreCaseAscii("LongCurrencyField") )
+ {
+ pWindow = new DoubleCurrencyField( pParent, nWinBits );
+ *ppNewComp = new SVTXCurrencyField;
+ }
+ else if (aServiceName.EqualsIgnoreCaseAscii("datefield") )
+ {
+ pWindow = new CalendarField( pParent, nWinBits);
+ static_cast<CalendarField*>(pWindow)->EnableToday();
+ static_cast<CalendarField*>(pWindow)->EnableNone();
+ static_cast<CalendarField*>(pWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXDateField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pWindow );
+ }
+
+ if ( !pWindow )
+ pWindow = VCLXToolkit::CreateComponent( ppNewComp, rDescriptor, pParent, nWinBits );
+
+ return pWindow;
+}
+
+// ----------------------------------------------------
+// INIT
+// ----------------------------------------------------
+void InitExtVclToolkit()
+{
+ ExtUnoWrapper* pWrapper = new ExtUnoWrapper;
+// pWrapper->SetToolkitCreateFunction( ExtVCLXToolkit_CreateInstance );
+ Application::SetUnoWrapper( pWrapper );
+}
+
+
+ // ----------------------------------------------------
+// class VCLXMultiLineEdit
+// ----------------------------------------------------
+VCLXMultiLineEdit::VCLXMultiLineEdit() : maTextListeners( *this )
+{
+}
+
+VCLXMultiLineEdit::~VCLXMultiLineEdit()
+{
+ MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetModifyHdl( Link() );
+}
+
+::com::sun::star::uno::Any VCLXMultiLineEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextArea*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, 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( VCLXMultiLineEdit )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextArea>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXMultiLineEdit::SetWindow( Window* pWindow )
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pPrevMultiLineEdit = (MultiLineEdit*) GetWindow();
+ if ( pPrevMultiLineEdit )
+ pPrevMultiLineEdit->SetModifyHdl( Link() );
+
+ MultiLineEdit* pNewMultiLineEdit = (MultiLineEdit*) pWindow;
+ if ( pNewMultiLineEdit )
+ pNewMultiLineEdit->SetModifyHdl( LINK( this, VCLXMultiLineEdit, ModifyHdl ) );
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+void VCLXMultiLineEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maTextListeners.addInterface( l );
+}
+
+void VCLXMultiLineEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maTextListeners.removeInterface( l );
+}
+
+void VCLXMultiLineEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
+ if ( pEdit )
+ {
+ pEdit->SetText( aText );
+
+ // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht.
+ // ::com::sun::star::awt::Toolkit soll JAVA-komform sein...
+ ModifyHdl( NULL );
+ }
+}
+
+void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
+ if ( pEdit )
+ {
+ setSelection( rSel );
+ pEdit->ReplaceSelected( aText );
+ }
+}
+
+::rtl::OUString VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
+ if ( pEdit )
+ aText = pEdit->GetText();
+ return aText;
+}
+
+::rtl::OUString VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
+ if ( pMultiLineEdit)
+ aText = pMultiLineEdit->GetSelected();
+ return aText;
+
+}
+
+void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
+ if ( pMultiLineEdit )
+ {
+ pMultiLineEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
+ }
+}
+
+::com::sun::star::awt::Selection VCLXMultiLineEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Selection aSel;
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
+ if ( pMultiLineEdit )
+ {
+ aSel.Min = pMultiLineEdit->GetSelection().Min();
+ aSel.Max = pMultiLineEdit->GetSelection().Max();
+ }
+ return aSel;
+}
+
+sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
+ return ( pMultiLineEdit && !pMultiLineEdit->IsReadOnly() && pMultiLineEdit->IsEnabled() ) ? sal_True : sal_False;
+}
+
+void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
+ if ( pMultiLineEdit )
+ pMultiLineEdit->SetReadOnly( !bEditable );
+}
+
+void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
+ if ( pMultiLineEdit )
+ pMultiLineEdit->SetMaxTextLen( nLen );
+}
+
+sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow();
+ return pMultiLineEdit ? pMultiLineEdit->GetMaxTextLen() : 0;
+}
+
+::rtl::OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow();
+ if ( pEdit )
+ aText = pEdit->GetTextLines();
+ return aText;
+}
+
+::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz;
+ MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
+ if ( pEdit )
+ aSz = AWTSize(pEdit->CalcMinimumSize());
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXMultiLineEdit::getPreferredSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXMultiLineEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
+ if ( pEdit )
+ aSz = AWTSize(pEdit->CalcAdjustedSize( VCLSize(rNewSize )));
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz;
+ MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
+ if ( pEdit )
+ aSz = AWTSize(pEdit->CalcSize( nCols, nLines ));
+ return aSz;
+}
+
+void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nCols = nLines = 0;
+ MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
+ if ( pEdit )
+ {
+ sal_uInt16 nC, nL;
+ pEdit->GetMaxVisColumnsAndLines( nC, nL );
+ nCols = nC;
+ nLines = nL;
+ }
+}
+
+IMPL_LINK( VCLXMultiLineEdit, ModifyHdl, MultiLineEdit*, EMPTYARG )
+{
+ ::com::sun::star::awt::TextEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ maTextListeners.textChanged( aEvent );
+
+ return 1;
+}
+
+void VCLXMultiLineEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow();
+ if ( pMultiLineEdit )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pMultiLineEdit->SetReadOnly( b );
+ }
+ break;
+ case BASEPROPERTY_MAXTEXTLEN:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ pMultiLineEdit->SetMaxTextLen( n );
+ }
+ break;
+ case BASEPROPERTY_FOCUSSELECTIONHIDE:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pMultiLineEdit->EnableFocusSelectionHide( b );
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXMultiLineEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow();
+ if ( pMultiLineEdit )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ aProp <<= pMultiLineEdit->IsReadOnly();
+ }
+ break;
+ case BASEPROPERTY_MAXTEXTLEN:
+ {
+ aProp <<= (sal_Int16) pMultiLineEdit->GetMaxTextLen();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+// ----------------------------------------------------
+// class VCLXFileDialog
+// ----------------------------------------------------
+/*
+VCLXFileDialog::VCLXFileDialog()
+{
+}
+
+VCLXFileDialog::~VCLXFileDialog()
+{
+}
+
+::com::sun::star::uno::Any VCLXFileDialog::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::XXX*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXFileDialog )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XXX>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+void VCLXFileDialog::setPath( const ::rtl::OUString& rPath )
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileDialog* pDlg = (FileDialog*)GetWindow();
+ if ( pDlg )
+ pDlg->SetPath( ::rtl::OUStringToOString( rPath, CHARSET_SYSTEM ) );
+}
+
+::rtl::OUString VCLXFileDialog::getPath()
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aPath;
+ FileDialog* pDlg = (FileDialog*)GetWindow();
+ if ( pDlg )
+ aPath = StringToOUString( pDlg->GetPath(), CHARSET_SYSTEM );
+ return aPath;
+}
+
+void VCLXFileDialog::setFilters( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rFilterNames, const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rMasks )
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileDialog* pDlg = (FileDialog*)GetWindow();
+ if ( pDlg )
+ {
+ sal_uInt32 nFlts = rFilterNames.getLength();
+ for ( sal_uInt32 n = 0; n < nFlts; n++ )
+ pDlg->AddFilter(
+ ::rtl::OUStringToOString( rFilterNames.getConstArray()[n], CHARSET_SYSTEM ),
+ ::rtl::OUStringToOString( rMasks.getConstArray()[n], CHARSET_SYSTEM ) );
+ }
+}
+
+void VCLXFileDialog::setCurrentFilter( const ::rtl::OUString& rFilterName )
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileDialog* pDlg = (FileDialog*)GetWindow();
+ if ( pDlg )
+ pDlg->SetCurFilter( ::rtl::OUStringToOString( rFilterName, CHARSET_SYSTEM ) );
+}
+
+::rtl::OUString VCLXFileDialog::getCurrentFilter()
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aFilter;
+ FileDialog* pDlg = (FileDialog*)GetWindow();
+ if ( pDlg )
+ aFilter = StringToOUString( pDlg->GetCurFilter(), CHARSET_SYSTEM );
+ return aFilter;
+}
+*/
+
+// ----------------------------------------------------
+// class VCLXFileControl
+// ----------------------------------------------------
+VCLXFileControl::VCLXFileControl() : maTextListeners( *this )
+{
+}
+
+VCLXFileControl::~VCLXFileControl()
+{
+ FileControl* pControl = (FileControl*) GetWindow();
+ if ( pControl )
+ pControl->GetEdit().SetModifyHdl( Link() );
+}
+
+::com::sun::star::uno::Any VCLXFileControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, 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( VCLXFileControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+void VCLXFileControl::SetWindow( Window* pWindow )
+{
+ FileControl* pPrevFileControl = (FileControl*) GetWindow();
+ if ( pPrevFileControl )
+ pPrevFileControl->GetEdit().SetModifyHdl( Link() );
+
+ FileControl* pNewFileControl = (FileControl*) pWindow;
+ if ( pNewFileControl )
+ pNewFileControl->GetEdit().SetModifyHdl( LINK( this, VCLXFileControl, ModifyHdl ) );
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+void VCLXFileControl::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maTextListeners.addInterface( l );
+}
+
+void VCLXFileControl::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maTextListeners.removeInterface( l );
+}
+
+void VCLXFileControl::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ pWindow->SetText( aText );
+
+ // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht.
+ // ::com::sun::star::awt::Toolkit soll JAVA-komform sein...
+ ModifyHdl( NULL );
+ }
+}
+
+void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ if ( pFileControl )
+ {
+ pFileControl->GetEdit().SetSelection( Selection( rSel.Min, rSel.Max ) );
+ pFileControl->GetEdit().ReplaceSelected( aText );
+ }
+}
+
+::rtl::OUString VCLXFileControl::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+::rtl::OUString VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ if ( pFileControl)
+ aText = pFileControl->GetEdit().GetSelected();
+ return aText;
+
+}
+
+void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ if ( pFileControl )
+ pFileControl->GetEdit().SetSelection( Selection( aSelection.Min, aSelection.Max ) );
+}
+
+::com::sun::star::awt::Selection VCLXFileControl::getSelection() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Selection aSel;
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ if ( pFileControl )
+ {
+ aSel.Min = pFileControl->GetEdit().GetSelection().Min();
+ aSel.Max = pFileControl->GetEdit().GetSelection().Max();
+ }
+ return aSel;
+}
+
+sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ return ( pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled() ) ? sal_True : sal_False;
+}
+
+void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ if ( pFileControl )
+ pFileControl->GetEdit().SetReadOnly( !bEditable );
+}
+
+void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ if ( pFileControl )
+ pFileControl->GetEdit().SetMaxTextLen( nLen );
+}
+
+sal_Int16 VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FileControl* pFileControl = (FileControl*) GetWindow();
+ return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0;
+}
+
+
+IMPL_LINK( VCLXFileControl, ModifyHdl, Edit*, EMPTYARG )
+{
+ ::com::sun::star::awt::TextEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ maTextListeners.textChanged( aEvent );
+
+ return 1;
+}
+
+::com::sun::star::awt::Size VCLXFileControl::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz;
+ FileControl* pControl = (FileControl*) GetWindow();
+ if ( pControl )
+ {
+ Size aTmpSize = pControl->GetEdit().CalcMinimumSize();
+ aTmpSize.Width() += pControl->GetButton().CalcMinimumSize().Width();
+ aSz = AWTSize(pControl->CalcWindowSize( aTmpSize ));
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXFileControl::getPreferredSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::Size aSz = getMinimumSize();
+ aSz.Height += 4;
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXFileControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz =rNewSize;
+ FileControl* pControl = (FileControl*) GetWindow();
+ if ( pControl )
+ {
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Height != aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXFileControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz;
+ FileControl* pControl = (FileControl*) GetWindow();
+ if ( pControl )
+ {
+ aSz = AWTSize(pControl->GetEdit().CalcSize( nCols ));
+ aSz.Width += pControl->GetButton().CalcMinimumSize().Width();
+ }
+ return aSz;
+}
+
+void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nCols = 0;
+ nLines = 1;
+ FileControl* pControl = (FileControl*) GetWindow();
+ if ( pControl )
+ nCols = (sal_Int16) pControl->GetEdit().GetMaxVisChars();
+}
+
+// ----------------------------------------------------
+// class SVTXFormattedField
+// ----------------------------------------------------
+// --------------------------------------------------------------------------------------
+SVTXFormattedField::SVTXFormattedField()
+ :m_pCurrentSupplier(NULL)
+ ,bIsStandardSupplier(sal_True)
+ ,nKeyToSetDelayed(-1)
+{
+}
+
+// --------------------------------------------------------------------------------------
+SVTXFormattedField::~SVTXFormattedField()
+{
+ if (m_pCurrentSupplier)
+ {
+ m_pCurrentSupplier->release();
+ m_pCurrentSupplier = NULL;
+ }
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_EFFECTIVE_MIN:
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ SetMinValue(Value);
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_MAX:
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ SetMaxValue(Value);
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_DEFAULT:
+ SetDefaultValue(Value);
+ break;
+
+ case BASEPROPERTY_TREATASNUMBER:
+ sal_Bool b;
+ if ( Value >>= b )
+ SetTreatAsNumber(b);
+ break;
+
+ case BASEPROPERTY_FORMATSSUPPLIER:
+ if (!Value.hasValue())
+ setFormatsSupplier(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > (NULL));
+ else
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xNFS;
+ if ( Value >>= xNFS )
+ setFormatsSupplier(xNFS);
+ }
+ break;
+ case BASEPROPERTY_FORMATKEY:
+ if (!Value.hasValue())
+ setFormatKey(0);
+ else
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ setFormatKey(n);
+ }
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_VALUE:
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ const ::com::sun::star::uno::TypeClass rTC = Value.getValueType().getTypeClass();
+ if ((rTC != ::com::sun::star::uno::TypeClass_VOID) && (rTC != ::com::sun::star::uno::TypeClass_STRING) && (rTC != ::com::sun::star::uno::TypeClass_DOUBLE))
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ SetValue(Value);
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ pField->SetSpinSize( n );
+ }
+ break;
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ pField->SetDecimalDigits( n );
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pField->SetThousandsSep( b );
+ }
+ break;
+
+ default:
+ VCLXSpinField::setProperty( PropertyName, Value );
+ }
+ }
+}
+
+// --------------------------------------------------------------------------------------
+::com::sun::star::uno::Any SVTXFormattedField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aReturn;
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_EFFECTIVE_MIN:
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ aReturn <<= GetMinValue();
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_MAX:
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ aReturn <<= GetMaxValue();
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_DEFAULT:
+ aReturn <<= GetDefaultValue();
+ break;
+
+ case BASEPROPERTY_TREATASNUMBER:
+ aReturn <<= GetTreatAsNumber();
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_VALUE:
+ case BASEPROPERTY_VALUE_DOUBLE:
+ aReturn <<= GetValue();
+ break;
+
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ aReturn <<= pField->GetSpinSize();
+ break;
+
+ case BASEPROPERTY_DECIMALACCURACY:
+ aReturn <<= pField->GetDecimalDigits();
+ break;
+
+ case BASEPROPERTY_FORMATSSUPPLIER:
+ {
+ if (!bIsStandardSupplier)
+ { // ansonsten void
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier = getFormatsSupplier();
+ aReturn <<= xSupplier;
+ }
+ }
+ break;
+
+ case BASEPROPERTY_FORMATKEY:
+ {
+ if (!bIsStandardSupplier)
+ aReturn <<= getFormatKey();
+ }
+ break;
+
+ default:
+ aReturn <<= VCLXSpinField::getProperty(PropertyName);
+ }
+ }
+ return aReturn;
+}
+
+// --------------------------------------------------------------------------------------
+::com::sun::star::uno::Any SVTXFormattedField::convertEffectiveValue(const ::com::sun::star::uno::Any& rValue)
+{
+ ::com::sun::star::uno::Any aReturn;
+
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField)
+ return aReturn;
+
+ switch (rValue.getValueType().getTypeClass())
+ {
+ case ::com::sun::star::uno::TypeClass_DOUBLE:
+ if (pField->TreatingAsNumber())
+ {
+ double d;
+ rValue >>= d;
+ aReturn <<= d;
+ }
+ else
+ {
+ SvNumberFormatter* pFormatter = pField->GetFormatter();
+ if (!pFormatter)
+ pFormatter = pField->StandardFormatter();
+ // should never fail
+
+ Color* pDummy;
+ double d;
+ rValue >>= d;
+ String sConverted;
+ pFormatter->GetOutputString(d, 0, sConverted, &pDummy);
+ aReturn <<= ::rtl::OUString( sConverted );
+ }
+ break;
+ case ::com::sun::star::uno::TypeClass_STRING:
+ {
+ ::rtl::OUString aStr;
+ rValue >>= aStr;
+ String sValue = aStr;
+ if (pField->TreatingAsNumber())
+ {
+ SvNumberFormatter* pFormatter = pField->GetFormatter();
+ if (!pFormatter)
+ pFormatter = pField->StandardFormatter();
+
+ double dVal;
+ sal_uInt32 nTestFormat(0);
+ if (!pFormatter->IsNumberFormat(sValue, nTestFormat, dVal))
+ aReturn.clear();
+ aReturn <<=dVal;
+ }
+ else
+ aReturn <<= aStr;
+ }
+ break;
+ default:
+ aReturn.clear();
+ break;
+ }
+ return aReturn;
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::SetMinValue(const ::com::sun::star::uno::Any& rValue)
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField)
+ return;
+
+ switch (rValue.getValueType().getTypeClass())
+
+ {
+ case ::com::sun::star::uno::TypeClass_DOUBLE:
+ double d;
+ rValue >>= d;
+ pField->SetMinValue(d);
+ break;
+ default:
+ DBG_ASSERT(rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
+ if ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID )
+
+ {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+ pField->ClearMinValue();
+ break;
+ }
+}
+
+// --------------------------------------------------------------------------------------
+::com::sun::star::uno::Any SVTXFormattedField::GetMinValue()
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField || !pField->HasMinValue())
+ return ::com::sun::star::uno::Any();
+
+ ::com::sun::star::uno::Any aReturn;
+ aReturn <<= pField->GetMinValue();
+ return aReturn;
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::SetMaxValue(const ::com::sun::star::uno::Any& rValue)
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField)
+ return;
+
+ switch (rValue.getValueType().getTypeClass())
+
+ {
+ case ::com::sun::star::uno::TypeClass_DOUBLE:
+ double d;
+ rValue >>= d;
+ pField->SetMaxValue(d);
+ break;
+ default:
+ if (rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID)
+
+ {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+ pField->ClearMaxValue();
+ break;
+ }
+}
+
+// --------------------------------------------------------------------------------------
+::com::sun::star::uno::Any SVTXFormattedField::GetMaxValue()
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField || !pField->HasMaxValue())
+ return ::com::sun::star::uno::Any();
+
+ ::com::sun::star::uno::Any aReturn;
+ aReturn <<= pField->GetMaxValue();
+ return aReturn;
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::SetDefaultValue(const ::com::sun::star::uno::Any& rValue)
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField)
+ return;
+
+ ::com::sun::star::uno::Any aConverted = convertEffectiveValue(rValue);
+
+ switch (aConverted.getValueType().getTypeClass())
+
+ {
+ case ::com::sun::star::uno::TypeClass_DOUBLE:
+ {
+ double d;
+ aConverted >>= d;
+ pField->SetDefaultValue(d);
+ }
+ break;
+ case ::com::sun::star::uno::TypeClass_STRING:
+ {
+ ::rtl::OUString aStr;
+ aConverted >>= aStr;
+ pField->SetDefaultText( aStr );
+ }
+ break;
+ default:
+ pField->EnableEmptyField(sal_True);
+ // nur noch void erlaubt
+ break;
+ }
+}
+
+// --------------------------------------------------------------------------------------
+::com::sun::star::uno::Any SVTXFormattedField::GetDefaultValue()
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField || pField->IsEmptyFieldEnabled())
+ return ::com::sun::star::uno::Any();
+
+ ::com::sun::star::uno::Any aReturn;
+ if (pField->TreatingAsNumber())
+ aReturn <<= pField->GetDefaultValue();
+ else
+ aReturn <<= ::rtl::OUString( pField->GetDefaultText() );
+ return aReturn;
+}
+
+// --------------------------------------------------------------------------------------
+sal_Bool SVTXFormattedField::GetTreatAsNumber()
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (pField)
+ return pField->TreatingAsNumber();
+
+ return sal_True;
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::SetTreatAsNumber(sal_Bool bSet)
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (pField)
+ pField->TreatAsNumber(bSet);
+}
+
+// --------------------------------------------------------------------------------------
+::com::sun::star::uno::Any SVTXFormattedField::GetValue()
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField)
+ return ::com::sun::star::uno::Any();
+
+ ::com::sun::star::uno::Any aReturn;
+ if (!pField->TreatingAsNumber())
+ {
+ ::rtl::OUString sText = pField->GetTextValue();
+ aReturn <<= sText;
+ }
+ else
+ {
+ if (pField->GetText().Len()) // empty wird erst mal standardmaessig als void nach draussen gereicht
+ aReturn <<= pField->GetValue();
+ }
+
+ return aReturn;
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::SetValue(const ::com::sun::star::uno::Any& rValue)
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (!pField)
+ return;
+
+ if (!rValue.hasValue())
+ {
+ pField->SetText(String());
+ }
+ else
+ {
+ if (rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_DOUBLE )
+ {
+ double d;
+ rValue >>= d;
+ pField->SetValue(d);
+ }
+ else
+ {
+ DBG_ASSERT(rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_STRING, "SVTXFormattedField::SetValue : invalid argument !");
+
+ ::rtl::OUString sText;
+ rValue >>= sText;
+ String aStr( sText );
+ if (!pField->TreatingAsNumber())
+ pField->SetTextFormatted(aStr);
+ else
+ pField->SetTextValue(aStr);
+ }
+ }
+// NotifyTextListeners();
+}
+
+// --------------------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > SVTXFormattedField::getFormatsSupplier(void) const
+{
+ return ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > ((::com::sun::star::util::XNumberFormatsSupplier*)m_pCurrentSupplier);
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::setFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xSupplier)
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+
+ SvNumberFormatsSupplierObj* pNew = NULL;
+ if (!xSupplier.is())
+ {
+ if (pField)
+ {
+ pNew = new SvNumberFormatsSupplierObj(pField->StandardFormatter());
+ bIsStandardSupplier = sal_True;
+ }
+ }
+ else
+ {
+ pNew = SvNumberFormatsSupplierObj::getImplementation(xSupplier);
+ bIsStandardSupplier = sal_False;
+ }
+
+ if (!pNew)
+ return; // TODO : wie das behandeln ?
+
+ if (m_pCurrentSupplier)
+ m_pCurrentSupplier->release();
+ m_pCurrentSupplier = pNew;
+ m_pCurrentSupplier->acquire();
+
+ if (pField)
+ {
+ // den aktuellen Value mit hinueberretten
+ ::com::sun::star::uno::Any aCurrent = GetValue();
+ pField->SetFormatter(m_pCurrentSupplier->GetNumberFormatter(), sal_False);
+ if (nKeyToSetDelayed != -1)
+ {
+ pField->SetFormatKey(nKeyToSetDelayed);
+ nKeyToSetDelayed = -1;
+ }
+ SetValue(aCurrent);
+ NotifyTextListeners();
+ }
+}
+
+// --------------------------------------------------------------------------------------
+sal_Int32 SVTXFormattedField::getFormatKey(void) const
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ return pField ? pField->GetFormatKey() : 0;
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
+{
+ FormattedField* pField = (FormattedField*)GetWindow();
+ if (pField)
+ {
+ if (pField->GetFormatter())
+ pField->SetFormatKey(nKey);
+ else
+ { // Wahrscheinlich bin ich gerade in einem Block, in dem erst der Key und dann der Formatter gesetzt
+ // wird, das passiert initial mit ziemlicher Sicherheit, da die Properties in alphabetischer Reihenfolge
+ // gesetzt werden, und der FormatsSupplier nun mal vor dem FormatKey kommt
+ nKeyToSetDelayed = nKey;
+ }
+ NotifyTextListeners();
+ }
+}
+
+// --------------------------------------------------------------------------------------
+void SVTXFormattedField::NotifyTextListeners()
+{
+ if ( GetTextListeners().getLength() )
+ {
+ ::com::sun::star::awt::TextEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ GetTextListeners().textChanged( aEvent );
+ }
+}
+
+ // ----------------------------------------------------
+// class SVTXNumericField
+// ----------------------------------------------------
+SVTXNumericField::SVTXNumericField()
+{
+}
+
+SVTXNumericField::~SVTXNumericField()
+{
+}
+
+::com::sun::star::uno::Any SVTXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( SVTXNumericField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
+ SVTXFormattedField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetValue( Value );
+}
+
+double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetValue() : 0;
+}
+
+void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetMinValue( Value );
+}
+
+double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetMinValue() : 0;
+}
+
+void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetMaxValue( Value );
+}
+
+double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetMaxValue() : 0;
+}
+
+void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetSpinFirst( Value );
+}
+
+double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetSpinFirst() : 0;
+}
+
+void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetSpinLast( Value );
+}
+
+double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetSpinLast() : 0;
+}
+
+void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetSpinSize( Value );
+}
+
+double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetSpinSize() : 0;
+}
+
+void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetDecimalDigits( Value );
+}
+
+sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetDecimalDigits() : 0;
+}
+
+void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetStrictFormat( bStrict );
+}
+
+sal_Bool SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->IsStrictFormat() : sal_False;
+}
+
+
+ // ----------------------------------------------------
+// class SVTXCurrencyField
+// ----------------------------------------------------
+SVTXCurrencyField::SVTXCurrencyField()
+{
+}
+
+SVTXCurrencyField::~SVTXCurrencyField()
+{
+}
+
+::com::sun::star::uno::Any SVTXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( SVTXCurrencyField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
+ SVTXFormattedField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetValue( Value );
+}
+
+double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetValue() : 0;
+}
+
+void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetMinValue( Value );
+}
+
+double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetMinValue() : 0;
+}
+
+void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetMaxValue( Value );
+}
+
+double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetMaxValue() : 0;
+}
+
+void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetSpinFirst( Value );
+}
+
+double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetSpinFirst() : 0;
+}
+
+void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetSpinLast( Value );
+}
+
+double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetSpinLast() : 0;
+}
+
+void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetSpinSize( Value );
+}
+
+double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetSpinSize() : 0;
+}
+
+void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetDecimalDigits( Value );
+}
+
+sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->GetDecimalDigits() : 0;
+}
+
+void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ if ( pField )
+ pField->SetStrictFormat( bStrict );
+}
+
+sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormattedField* pField = GetFormattedField();
+ return pField ? pField->IsStrictFormat() : sal_False;
+}
+
+void SVTXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aReturn;
+
+ DoubleCurrencyField* pField = (DoubleCurrencyField*)GetFormattedField();
+ if ( pField )
+ {
+#ifdef DBG_UTIL
+ String sAssertion( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "SVTXCurrencyField::setProperty(" ) ) );
+ sAssertion += String( PropertyName );
+ sAssertion.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ") : invalid value !" ) );
+#endif
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ ::rtl::OUString aStr;
+ Value >>= aStr;
+ pField->setCurrencySymbol( aStr );
+ }
+ break;
+ case BASEPROPERTY_CURSYM_POSITION:
+ {
+ sal_Bool b;
+ Value >>= b;
+ pField->setPrependCurrSym(b);
+ }
+ break;
+
+ default:
+ SVTXFormattedField::setProperty(PropertyName, Value);
+ }
+ }
+ else
+ SVTXFormattedField::setProperty(PropertyName, Value);
+}
+
+::com::sun::star::uno::Any SVTXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aReturn;
+
+ DoubleCurrencyField* pField = (DoubleCurrencyField*)GetFormattedField();
+ if ( pField )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ aReturn <<= ::rtl::OUString( pField->getCurrencySymbol() );
+ }
+ break;
+ case BASEPROPERTY_CURSYM_POSITION:
+ {
+ aReturn <<= pField->getPrependCurrSym();
+ }
+ break;
+ default:
+ return SVTXFormattedField::getProperty(PropertyName);
+ }
+ }
+ return SVTXFormattedField::getProperty(PropertyName);
+}
+
diff --git a/svtools/source/urlobj/inetimg.cxx b/svtools/source/urlobj/inetimg.cxx
new file mode 100644
index 000000000000..a19cac29c1da
--- /dev/null
+++ b/svtools/source/urlobj/inetimg.cxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * $RCSfile: inetimg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SOT_DTRANS_HXX
+#include <sot/dtrans.hxx>
+#endif
+#ifndef _SOT_EXCHANGE_HXX
+#include <sot/exchange.hxx>
+#endif
+#ifndef _SOT_FORMATS_HXX
+#include <sot/formats.hxx>
+#endif
+
+#pragma hdrstop
+
+#include "inetimg.hxx"
+
+// Die folgende Struktur wurde den Netscape-Sourcen entnommen:
+// netscape/source/ns/cmd/winfe/feimages.cpp
+struct ImageData_Impl {
+ int iSize; // size of all data, including variable length strings
+ BOOL bIsMap; // For server side maps
+ INT32 iWidth; // Fixed size data correspond to fields in LO_ImageDataStruct
+ INT32 iHeight; // and EDT_ImageData
+ INT32 iHSpace;
+ INT32 iVSpace;
+ INT32 iBorder;
+ int iLowResOffset; // Offsets into string_data. If 0, string is NULL (not used)
+ int iAltOffset; // (alternate text?)
+ int iAnchorOffset; // HREF in image
+ int iExtraHTML_Offset; // Extra HTML (stored in CImageElement)
+ sal_Char pImageURL[1]; // Append all variable-length strings starting here
+};
+
+#define TOKEN_SEPARATOR '\001'
+//=======================================================================
+
+String INetImage::CopyExchange() const
+{
+ String aString;
+ aString += aImageURL;
+ aString += TOKEN_SEPARATOR;
+ aString += aTargetURL;
+ aString += TOKEN_SEPARATOR;
+ aString += aTargetFrame;
+ aString += TOKEN_SEPARATOR;
+ aString += aAlternateText;
+ aString += TOKEN_SEPARATOR;
+ aString += String::CreateFromInt32( aSizePixel.Width() );
+ aString += TOKEN_SEPARATOR;
+ aString += String::CreateFromInt32( aSizePixel.Height() );
+ return aString;
+}
+
+//-----------------------------------------------------------------------
+
+void INetImage::PasteExchange( String aString )
+{
+ USHORT nStart = 0;
+ aImageURL = aString.GetToken( 0, TOKEN_SEPARATOR, nStart );
+ aTargetURL = aString.GetToken( 0, TOKEN_SEPARATOR, nStart );
+ aTargetFrame = aString.GetToken( 0, TOKEN_SEPARATOR, nStart );
+ aAlternateText = aString.GetToken( 0, TOKEN_SEPARATOR, nStart );
+ aSizePixel.Width() = aString.GetToken( 0, TOKEN_SEPARATOR, nStart ).ToInt32();
+ aSizePixel.Height() = aString.GetToken( 0, TOKEN_SEPARATOR, nStart ).ToInt32();
+}
+
+//-----------------------------------------------------------------------
+
+ULONG INetImage::HasFormat( SotDataObject& rObj )
+{
+ ULONG nFmt;
+ const SvDataTypeList& rTypeLst = rObj.GetTypeList();
+ if( !rTypeLst.Get( nFmt = SOT_FORMATSTR_ID_INET_IMAGE ) &&
+ !rTypeLst.Get( nFmt = SOT_FORMATSTR_ID_NETSCAPE_IMAGE ))
+ nFmt = 0;
+ return nFmt;
+}
+
+//-----------------------------------------------------------------------
+
+BOOL INetImage::SetData( SvData& rData ) const
+
+/* [Beschreibung]
+
+ Liefert TRUE, falls in dem SvDataObject ein entsp. Image-Format
+ steht, das wir unterstuetzen. Wenn ja, werden unsere Daten ins
+ Data-Object kopiert.
+*/
+{
+ BOOL bOK = FALSE;
+ const ULONG lFormat = rData.GetFormat();
+
+ if( lFormat == SOT_FORMATSTR_ID_INET_IMAGE )
+ {
+ rData.SetData( CopyExchange() );
+ bOK = TRUE;
+ }
+ else if( lFormat == SOT_FORMATSTR_ID_NETSCAPE_IMAGE )
+ {
+ // Netscape koennen wir nicht exportieren
+ }
+ return bOK;
+}
+
+//-----------------------------------------------------------------------
+
+BOOL INetImage::Copy( SotDataMemberObject& rObj ) const
+
+/* [Beschreibung]
+ Anmerkung: Das Netscape-Image-Format koennen wir nicht exportieren
+*/
+{
+ SvData* pData = new SvData( SOT_FORMATSTR_ID_INET_IMAGE, MEDIUM_MEMORY );
+ ((INetImage*)this)->SetData( *pData );
+ rObj.Append( pData );
+ return TRUE;
+}
+
+//-----------------------------------------------------------------------
+
+BOOL INetImage::Paste( SotDataObject& rObj, ULONG nFormat )
+
+/* [Beschreibung]
+
+ Diese Methode "uberschreibt den Wert dieser Instanz mit dem
+ Inhalt des uebergebenen Datenobjects.
+ nFormat: Typischerweise das Ergebnis von HasFormat
+*/
+
+{
+ BOOL bRet = FALSE;
+
+ SvData aData( nFormat, MEDIUM_ALL );
+ if( rObj.GetData( &aData ) )
+ {
+ void *pData;
+ aData.GetData( &pData, TRANSFER_REFERENCE );
+ UINT32 nLen = aData.GetMinMemorySize();
+ rtl_TextEncoding eSysCSet = gsl_getSystemTextEncoding();
+
+ if( nFormat == SOT_FORMATSTR_ID_INET_IMAGE )
+ {
+ PasteExchange( String( (sal_Char*)pData, eSysCSet ) );
+ bRet = TRUE;
+ }
+ else if( nFormat == SOT_FORMATSTR_ID_NETSCAPE_IMAGE )
+ {
+ ImageData_Impl* pImgData = (ImageData_Impl*)pData;
+
+ const sal_Char* pStart = (const sal_Char*)pImgData;
+ aImageURL = String( (const sal_Char*)&(pImgData->pImageURL[0]),
+ eSysCSet );
+ if( pImgData->iAltOffset )
+ aAlternateText = String( (pStart + pImgData->iAltOffset), eSysCSet );
+ if( pImgData->iAnchorOffset )
+ aTargetURL = String( (pStart + pImgData->iAnchorOffset), eSysCSet );
+
+ aSizePixel.Width() = pImgData->iWidth;
+ aSizePixel.Height() = pImgData->iHeight;
+ bRet = TRUE;
+ }
+ }
+ return bRet;
+}
+
+BOOL INetImage::CopyFormats( SotDataObject& rObj ) const
+{
+ SvDataTypeList& rTypeList = (SvDataTypeList&)rObj.GetTypeList();
+ rTypeList.Append( SvDataType( SOT_FORMATSTR_ID_INET_IMAGE, MEDIUM_MEMORY ) );
+ // Netscape koennen wir nicht exportieren
+ // rTypeList.Append( SvDataType( SOT_FORMATSTR_ID_NETSCAPE_IMAGE, MEDIUM_MEMORY ) );
+ return TRUE;
+}
+
+
diff --git a/svtools/source/urlobj/makefile.mk b/svtools/source/urlobj/makefile.mk
new file mode 100644
index 000000000000..c31618a976be
--- /dev/null
+++ b/svtools/source/urlobj/makefile.mk
@@ -0,0 +1,89 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=urlobj
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ urlbmk.cxx \
+ inetimg.cxx
+
+
+SLOFILES = \
+ $(SLO)$/urlbmk.obj \
+ $(SLO)$/inetimg.obj
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/unx/inc/convert.hxx b/svtools/unx/inc/convert.hxx
new file mode 100644
index 000000000000..812041252935
--- /dev/null
+++ b/svtools/unx/inc/convert.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * $RCSfile: convert.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CONVERT_HXX
+#define _CONVERT_HXX
+
+/*
+#define _SWAPSHORT(x) ((((x) & 0xFF00)>>8) | (((x) & 0x00FF)<<8))
+#define _SWAPLONG(x) ((((x) & 0xFF000000)>>24) | (((x) & 0x00FF0000)>>8) | \
+ (((x) & 0x0000FF00)<<8) | (((x) & 0x000000FF)<<24))
+*/
+class Convert
+{
+public:
+ static void Swap( long & nValue )
+ { nValue = SWAPLONG( nValue ); }
+ static void Swap( ULONG & nValue )
+ { nValue = SWAPLONG( nValue ); }
+ static void Swap( short & nValue )
+ { nValue = SWAPSHORT( nValue ); }
+ static void Swap( USHORT & nValue )
+ { nValue = SWAPSHORT( nValue ); }
+ static void Swap( Point & aPtr )
+ { Swap( aPtr.X() ); Swap( aPtr.Y() ); }
+ static void Swap( Size & aSize )
+ { Swap( aSize.Width() ); Swap( aSize.Height() ); }
+ static void Swap( Rectangle & rRect )
+ { Swap( rRect.Top() ); Swap( rRect.Bottom() );
+ Swap( rRect.Left() ); Swap( rRect.Right() ); }
+/*
+ static USHORT AnsiFloatSize() const { return 6; }
+ static float AnsiToFloat( void * pAnsiFloat )
+ { return 0; }
+ static USHORT AnsiDoubleSize() const { return 12; }
+ static double AnsiToDouble( void * pAnsiDouble )
+ { return 0; }
+*/
+};
+
+#endif // _CONVERT_HXX
diff --git a/svtools/unx/source/svdde/ddedummy.cxx b/svtools/unx/source/svdde/ddedummy.cxx
new file mode 100644
index 000000000000..e172cf91e5c0
--- /dev/null
+++ b/svtools/unx/source/svdde/ddedummy.cxx
@@ -0,0 +1,367 @@
+/*************************************************************************
+ *
+ * $RCSfile: ddedummy.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SVDDE_HXX
+#include <svdde.hxx>
+#endif
+
+static String aString;
+
+DdeData::DdeData()
+{
+}
+
+DdeData::DdeData( const String& )
+{
+}
+
+DdeData::DdeData( const DdeData& )
+{
+}
+
+DdeData::DdeData( const void*, long, ULONG)
+{
+}
+
+DdeData::~DdeData( void )
+{
+}
+
+void DdeData::SetFormat( ULONG )
+{
+}
+
+ULONG DdeData::GetFormat() const
+{
+ return 0L;
+}
+
+DdeData& DdeData::operator = ( const DdeData& rDdeData )
+{
+ return *this;
+}
+
+DdeData::operator long() const
+{
+ return 0L;
+}
+
+DdeData::operator const void*() const
+{
+ return NULL;
+}
+
+long DdeConnection::GetError()
+{
+ return 0L;
+}
+
+DdeConnection::DdeConnection( const String&, const String& )
+{
+}
+
+DdeConnection::~DdeConnection( void )
+{
+}
+
+const String& DdeConnection::GetServiceName()
+{
+ return aString;
+}
+
+const String& DdeConnection::GetTopicName()
+{
+ return aString;
+}
+
+DdeTransaction::DdeTransaction( DdeConnection& rConnection, const String&, long ) :
+ rDde( rConnection )
+{
+}
+
+DdeTransaction::DdeTransaction( const DdeTransaction& rTransaction ) :
+ rDde( rTransaction.rDde )
+{
+}
+
+void DdeTransaction::Execute(void)
+{
+}
+
+void DdeTransaction::Done( BOOL bDataValid )
+{
+}
+
+void DdeTransaction::Data( const DdeData* )
+{
+}
+
+DdeTransaction::~DdeTransaction(void)
+{
+}
+
+DdeRequest::DdeRequest(DdeConnection& rConnection, const String& rString, long lLong ) :
+ DdeTransaction( rConnection, rString, lLong )
+{
+}
+
+DdeExecute::DdeExecute( DdeConnection& rConnection, const String& rString, long lLong ) :
+ DdeTransaction( rConnection, rString, lLong )
+{
+}
+
+DdePoke::DdePoke( DdeConnection& rConnection, const String& rString, const DdeData&, long lLong ) :
+ DdeTransaction( rConnection, rString, lLong )
+{
+}
+
+
+DdeTopic::DdeTopic( const String& )
+{
+}
+
+DdeTopic::~DdeTopic()
+{
+}
+
+void DdeTopic::Connect (long )
+{
+}
+
+void DdeTopic::Disconnect( long )
+{
+}
+
+void DdeTopic::InsertItem( DdeItem* )
+{
+}
+
+DdeItem* DdeTopic::AddItem( const DdeItem& rDdeItem )
+{
+ return (DdeItem*) &rDdeItem;
+}
+
+void DdeTopic::RemoveItem( const DdeItem& )
+{
+}
+
+DdeData* DdeTopic::Get( ULONG )
+{
+ return NULL;
+}
+
+BOOL DdeTopic::MakeItem( const String& )
+{
+ return FALSE;
+}
+
+BOOL DdeTopic::StartAdviseLoop()
+{
+ return FALSE;
+}
+
+BOOL DdeTopic::StopAdviseLoop()
+{
+ return FALSE;
+}
+
+BOOL DdeTopic::Execute( const String* )
+{
+ return FALSE;
+}
+
+BOOL DdeTopic::Put( const DdeData* )
+{
+ return FALSE;
+}
+
+const String& DdeTopic::GetName() const
+{
+ return aString;
+}
+
+DdeService::DdeService( const String& )
+{
+ nStatus = 0;
+}
+
+String DdeService::Topics() {
+ return String();
+}
+
+String DdeService::Formats() {
+ return String();
+}
+
+String DdeService::SysItems() {
+ return String();
+}
+
+String DdeService::Status() {
+ return String();
+}
+
+String DdeService::SysTopicGet(const String& rString) {
+ return rString;
+}
+
+BOOL DdeService::SysTopicExecute(const String*) {
+ return FALSE;
+}
+
+DdeService::~DdeService()
+{
+}
+
+BOOL DdeService::IsBusy()
+{
+ return FALSE;
+}
+
+String DdeService::GetHelp()
+{
+ return aString;
+}
+
+void DdeService::AddFormat( ULONG )
+{
+}
+
+void DdeService::AddTopic( const DdeTopic& )
+{
+}
+
+void DdeService::RemoveTopic( const DdeTopic& )
+{
+}
+
+BOOL DdeService::MakeTopic( const String& )
+{
+ return FALSE;
+}
+
+const String& DdeService::GetName() const
+{
+ return aString;
+}
+
+static DdeServices aDdeServices;
+DdeServices& DdeService::GetServices()
+{
+ return aDdeServices;
+}
+
+DdeItem::DdeItem( const String& )
+{
+}
+
+DdeItem::DdeItem( const DdeItem& )
+{
+}
+
+DdeItem::~DdeItem()
+{
+}
+
+void DdeItem::NotifyClient()
+{
+}
+
+DdeGetPutItem::DdeGetPutItem( const String& rStr ) :
+DdeItem( rStr )
+{
+}
+
+DdeGetPutItem::DdeGetPutItem( const DdeItem& rItem ) :
+DdeItem( rItem )
+{
+}
+
+DdeData* DdeGetPutItem::Get( ULONG )
+{
+ return NULL;
+}
+
+BOOL DdeGetPutItem::Put( const DdeData* )
+{
+ return FALSE;
+}
+
+void DdeGetPutItem::AdviseLoop( BOOL )
+{
+}
+
+DdeLink::DdeLink( DdeConnection& rConnection, const String& rString, long l ) :
+DdeTransaction( rConnection, rString, l )
+{
+}
+
+DdeLink::~DdeLink()
+{
+}
+
+void DdeLink::Notify()
+{
+}
+
+DdeHotLink::DdeHotLink( DdeConnection& rConnection, const String& rString, long l ) :
+DdeLink( rConnection, rString, l )
+{
+}
diff --git a/svtools/unx/source/svdde/makefile.mk b/svtools/unx/source/svdde/makefile.mk
new file mode 100644
index 000000000000..338c0ebc7516
--- /dev/null
+++ b/svtools/unx/source/svdde/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SVTOOLS
+TARGET=svdde
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ ddedummy.cxx
+
+SLOFILES = \
+ $(SLO)/ddedummy.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk
new file mode 100644
index 000000000000..d89efafca35b
--- /dev/null
+++ b/svtools/util/makefile.mk
@@ -0,0 +1,472 @@
+#*************************************************************************
+#*
+#* $RCSfile: makefile.mk,v $
+#*
+#* $Revision: 1.1.1.1 $
+#*
+#* last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+#*
+#* The Contents of this file are made available subject to the terms of
+#* either of the following licenses
+#*
+#* - GNU Lesser General Public License Version 2.1
+#* - Sun Industry Standards Source License Version 1.1
+#*
+#* Sun Microsystems Inc., October, 2000
+#*
+#* GNU Lesser General Public License Version 2.1
+#* =============================================
+#* Copyright 2000 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
+#*
+#*
+#* Sun Industry Standards Source License Version 1.1
+#* =================================================
+#* The contents of this file are subject to the Sun Industry Standards
+#* Source License Version 1.1 (the "License"); You may not use this file
+#* except in compliance with the License. You may obtain a copy of the
+#* License at http://www.openoffice.org/license.html.
+#*
+#* Software provided under this License is provided on an "AS IS" basis,
+#* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+#* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+#* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+#* See the License for the specific provisions governing your rights and
+#* obligations concerning the Software.
+#*
+#* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#*
+#* Copyright: 2000 by Sun Microsystems, Inc.
+#*
+#* All Rights Reserved.
+#*
+#* Contributor(s): _______________________________________
+#*
+#*
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=svtools
+TARGET=svtool
+RESTARGET=svt
+RESTARGETSIMPLE=svs
+VERSION=$(UPD)
+GEN_HID=TRUE
+ENABLE_EXCEPTIONS=TRUE
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+USE_LDUMP2=TRUE
+
+.IF "$(COM)"=="ICC"
+LINKFLAGS+=/SEGMENTS:1024 /PACKD:32768
+.ENDIF
+
+# --- Allgemein ----------------------------------------------------
+
+LIB1TARGET= $(LB)$/svmem.lib
+LIB1ARCHIV= $(LB)$/libsvarray.a
+LIB1FILES= $(LB)$/svarray.lib
+
+LIB2TARGET= $(LB)$/filearch.lib
+LIB2OBJFILES= $(OBJ)$/filearch.obj
+
+.IF "$(GUI)"!="UNX"
+LIB3TARGET= $(LB)$/svtool.lib
+LIB3FILES= $(LB)$/_svt.lib
+LIB3OBJFILES=\
+ $(OBJ)$/wordsel2.obj \
+ $(OBJ)$/rtfkey2.obj
+.ENDIF
+
+.IF "$(GUI)"!="UNX"
+LIB4TARGET= $(LB)$/isvl.lib
+LIB4FILES= $(LB)$/_isvl.lib
+LIB4OBJFILES=\
+ $(OBJ)$/htmlkey2.obj
+.ENDIF
+
+LIB7TARGET= $(SLB)$/svt.lib
+#LIB7ARCHIV= $(LB)$/libsvt$(UPD)$(DLLPOSTFIX).a
+LIB7FILES= \
+ $(SLB)$/misc2.lib \
+ $(SLB)$/items2.lib \
+ $(SLB)$/browse.lib \
+ $(SLB)$/config.lib \
+ $(SLB)$/ctrl.lib \
+ $(SLB)$/dialogs.lib \
+ $(SLB)$/edit.lib \
+ $(SLB)$/unoiface.lib \
+ $(SLB)$/filter.lib \
+ $(SLB)$/igif.lib \
+ $(SLB)$/ipng.lib \
+ $(SLB)$/jpeg.lib \
+ $(SLB)$/ixpm.lib \
+ $(SLB)$/ixbm.lib \
+ $(SLB)$/sbx.lib \
+ $(SLB)$/numbers.lib \
+ $(SLB)$/wmf.lib \
+ $(SLB)$/undo.lib \
+ $(SLB)$/urlobj.lib \
+ $(SLB)$/plugapp.lib \
+ $(SLB)$/svcontnr.lib \
+ $(SLB)$/svhtml2.lib
+
+
+.IF "$(GUI)" == "OS2"
+LIB7FILES+= $(SLB)$/eaimp.lib
+.ENDIF
+
+.IF "$(GUI)" == "UNX"
+LIB7FILES+= $(SLB)$/eaimp.lib
+.ENDIF
+
+LIB7FILES+= \
+ $(SLB)$/svdde.lib
+
+LIB8TARGET= $(SLB)$/svl.lib
+#LIB8ARCHIV= $(LB)$/libsvl$(UPD)$(DLLPOSTFIX).a
+LIB8OBJFILES= $(OBJ)$/svtdata.obj
+LIB8FILES= \
+ $(SLB)$/filerec.lib \
+ $(SLB)$/items1.lib \
+ $(SLB)$/libcall.lib \
+ $(SLB)$/misc1.lib \
+ $(SLB)$/notify.lib \
+ $(SLB)$/srch.lib \
+ $(SLB)$/svarray.lib \
+ $(SLB)$/svhtml1.lib \
+ $(SLB)$/svsql.lib \
+ $(SLB)$/svrtf.lib \
+ $(SLB)$/cmdparse.lib
+
+# Bilden der dyn. Resourcen-DLL --------------------------------------------------
+
+RESLIB1NAME= $(RESTARGET)
+RESLIB1SRSFILES=$(SRS)$/filter.srs \
+ $(SRS)$/misc.srs \
+ $(SRS)$/sbx.srs \
+ $(SRS)$/ctrl.srs \
+ $(SRS)$/items.srs \
+ $(SRS)$/dialogs.srs \
+ $(SRS)$/plugapp.srs \
+ $(SRS)$/uno.srs
+RESLIB2NAME= $(RESTARGETSIMPLE)
+RESLIB2SRSFILES=\
+ $(SRS)$/mediatyp.srs \
+ $(SRS)$/svsql.srs
+
+# Bilden der DLL --------------------------------------------------
+
+SHL1TARGET= svt$(VERSION)$(DLLPOSTFIX)
+SHL1IMPLIB= _svt
+SHL1STDLIBS=$(TOOLSLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(RTLLIB) \
+ $(SVLIB) \
+ $(TKLIB) \
+ $(SVLLIB) \
+ $(SALLIB) \
+ $(UNOTOOLSLIB) \
+ $(UCBHELPERLIB)
+
+
+.IF "$(GUI)"=="WIN"
+SHL1STDLIBS+= \
+ $(LIBPRE) ddeml.lib \
+ $(LIBPRE) shell.lib \
+ $(LIBPRE) ver.lib
+.ENDIF
+
+.IF "$(GUI)"=="WNT"
+SHL1STDLIBS+= \
+ $(LIBCIMT) \
+ $(LIBPRE) advapi32.lib \
+ $(LIBPRE) gdi32.lib
+.ENDIF
+
+.IF "$(VCL)" != ""
+SHL1STDLIBS+= \
+ $(SOTLIB)
+.ENDIF
+
+SHL1STDLIBS += $(JPEG3RDLIB)
+
+#SHL1DEPNU=$(LB)$/isvl.lib
+#SHL1DEPNU=$(SHL2TARGETN)
+SHL1LIBS= \
+ $(SLB)$/svt.lib \
+ $(LB)$/svmem.lib
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+DEFLIB1NAME =svt
+DEF1DES =SvTools
+
+.IF "$(GUI)"=="WNT"
+DEF1EXPORT1 = component_writeInfo
+DEF1EXPORT2 = component_getFactory
+.ELSE
+.IF "$(COM)"=="ICC"
+DEF1EXPORT1 = component_writeInfo
+DEF1EXPORT2 = component_getFactory
+.ELSE
+DEF1EXPORT1 = _component_writeInfo
+DEF1EXPORT2 = _component_getFactory
+.ENDIF
+.ENDIF
+
+# --- svtools lite --------------------------------------------------
+
+SHL2TARGET= svl$(VERSION)$(DLLPOSTFIX)
+SHL2IMPLIB= _isvl
+SHL1OBJS=$(SLO)$/svtdata.obj
+SHL2STDLIBS=$(TOOLSLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(RTLLIB) \
+ $(SALLIB) \
+ $(UNOTOOLSLIB)
+
+.IF "$(GUI)"=="WNT"
+SHL2STDLIBS+= \
+ $(LIBCIMT) \
+ $(LIBPRE) advapi32.lib \
+ $(LIBPRE) gdi32.lib
+.ENDIF
+
+SHL2LIBS= $(SLB)$/svl.lib
+
+SHL2DEF= $(MISC)$/$(SHL2TARGET).def
+
+DEF2NAME= $(SHL2TARGET)
+DEF2DEPN= $(MISC)$/$(SHL2TARGET).flt $(SLB)$/svl.lib
+DEFLIB2NAME=svl
+DEF2DES =SvTools lite
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(GUI)"=="UNX"
+SVTTARGETS= $(LB)$/lib$(SHL2TARGET)$(DLLPOST) $(LB)$/lib$(SHL1TARGET)$(DLLPOST)
+.ELSE
+SVTTARGETS= $(LB)$/isvl.lib \
+ $(BIN)$/$(SHL2TARGET)$(DLLPOST) $(BIN)$/$(SHL1TARGET)$(DLLPOST)
+.ENDIF
+
+ALL: $(SLB)$/svl.lib \
+ $(SLB)$/svt.lib \
+ $(MISC)$/$(SHL2TARGET).flt \
+ $(MISC)$/$(SHL1TARGET).flt \
+ $(MISC)$/$(SHL2TARGET).def \
+ $(MISC)$/$(SHL1TARGET).def \
+ $(SVTTARGETS) \
+ ALLTAR
+
+.INCLUDE : target.mk
+
+# --- Svtools-Control-Filter-Datei ---
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo AUTO_CODE > $@
+ @echo BrowserDataWin >> $@
+ @echo BrowserColumn >> $@
+ @echo ButtonFrame >> $@
+ @echo CreateLoader >> $@
+ @echo DdeString >> $@
+ @echo DlgSource >> $@
+ @echo DlgExport >> $@
+ @echo EditWindow >> $@
+ @echo FileEntry >> $@
+ @echo GIFLZWDecompressor >> $@
+ @echo GIFReader >> $@
+ @echo PNGReader >> $@
+ @echo ImpDetect >> $@
+ @echo ImpDraw >> $@
+ @echo ImpGet >> $@
+ @echo ImpPut >>$@
+ @echo ImpSv >> $@
+ @echo JPEGReader >> $@
+ @echo WMFReader >> $@
+ @echo EnhWMFReader >> $@
+ @echo WMFWriter >> $@
+ @echo LinkStub >> $@
+ @echo MultiTextLineInfo >> $@
+ @echo Regexpr >> $@
+ @echo RemoteControlServer >> $@
+ @echo RemoteControlService >> $@
+ @echo RetStream >> $@
+ @echo SCmdStream >> $@
+ @echo SbxArrayRef >> $@
+ @echo SbxBasicFormater >> $@
+ @echo SbxRes >> $@
+ @echo SbxVariableRef >> $@
+ @echo SfxListUndoAction >> $@
+ @echo SfxPointerEntry >> $@
+ @echo SfxUINT32s >> $@
+ @echo SfxULongRangeItem >> $@
+ @echo SfxULongRanges >> $@
+ @echo SfxULongRangesItem >> $@
+ @echo SgfFontLst >> $@
+ @echo SgfFontOne >> $@
+ @echo StatementCommand >> $@
+ @echo StatementControl >> $@
+ @echo StatementFlow >> $@
+ @echo StatementList >> $@
+ @echo StatementSlot >> $@
+ @echo SVDDE_MISC_CODE >> $@
+ @echo SvInterfaceClient >> $@
+ @echo SvImp >> $@
+ @echo SvStringLockBytes >> $@
+ @echo svtools >> $@
+ @echo SVTOOLS_FILTER >> $@
+ @echo SVTOOLS_CODE >> $@
+ @echo SVTOOLS_FILTER4 >> $@
+ @echo SVTOOLS_FILTER_CODE >> $@
+ @echo ValueSetItem >> $@
+ @echo WMFRecord >> $@
+ @echo WriteRecord >> $@
+ @echo XPMReader >> $@
+ @echo XBMReader >> $@
+ @echo _grow >> $@
+ @echo _ImplINetHistoryLoadTimer >> $@
+ @echo _ImplINetHistoryStoreTimer >> $@
+ @echo sRTF_>>$@
+ @echo sHTML_>>$@
+ @echo unnamed>>$@
+.IF "$(GUI)"=="WNT" || "$(GUI)"=="WIN"
+ @echo WEP>>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+.ENDIF
+.IF "$(COM)"=="MSC"
+ @echo ??_7>>$@
+ @echo ??_8>>$@
+ @echo ??_C>>$@
+ @echo ??_E>>$@
+ @echo ??_F>>$@
+ @echo ??_G>>$@
+ @echo ??_H>>$@
+ @echo ??_I>>$@
+ @echo 0Imp>>$@
+ @echo Impl@@>>$@
+ @echo Imp@@>>$@
+ @echo __CT>>$@
+.ENDIF
+
+$(MISC)$/$(SHL2TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo AUTO_CODE > $@
+ @echo BrowserDataWin >> $@
+ @echo BrowserColumn >> $@
+ @echo ButtonFrame >> $@
+ @echo CreateLoader >> $@
+ @echo DdeString >> $@
+ @echo DlgSource >> $@
+ @echo DlgExport >> $@
+ @echo EditWindow >> $@
+ @echo FileEntry >> $@
+ @echo GIFLZWDecompressor >> $@
+ @echo GIFReader >> $@
+ @echo PNGReader >> $@
+ @echo ImpDetect >> $@
+ @echo ImpDraw >> $@
+ @echo ImpGet >> $@
+ @echo ImpPut >>$@
+ @echo ImpSvNum >>$@
+ @echo JPEGReader >> $@
+ @echo WMFReader >> $@
+ @echo EnhWMFReader >> $@
+ @echo WMFWriter >> $@
+ @echo LinkStub >> $@
+ @echo MultiTextLineInfo >> $@
+ @echo Regexpr >> $@
+ @echo RemoteControlServer >> $@
+ @echo RemoteControlService >> $@
+ @echo RetStream >> $@
+ @echo SCmdStream >> $@
+ @echo SbxArrayRef >> $@
+ @echo SbxBasicFormater >> $@
+ @echo SbxRes >> $@
+ @echo SbxVariableRef >> $@
+ @echo SfxListUndoAction >> $@
+ @echo SfxPointerEntry >> $@
+ @echo SfxUINT32s >> $@
+ @echo SfxULongRangeItem >> $@
+ @echo SfxULongRanges >> $@
+ @echo SfxULongRangesItem >> $@
+ @echo SgfFontLst >> $@
+ @echo SgfFontOne >> $@
+ @echo StatementCommand >> $@
+ @echo StatementControl >> $@
+ @echo StatementFlow >> $@
+ @echo StatementList >> $@
+ @echo StatementSlot >> $@
+ @echo SVDDE_MISC_CODE >> $@
+ @echo SvInterfaceClient >> $@
+ @echo SvImp >> $@
+ @echo SvStringLockBytes >> $@
+ @echo svtools >> $@
+ @echo SVTOOLS_FILTER >> $@
+ @echo SVTOOLS_CODE >> $@
+ @echo SVTOOLS_FILTER4 >> $@
+ @echo SVTOOLS_FILTER_CODE >> $@
+ @echo ValueSetItem >> $@
+ @echo WMFRecord >> $@
+ @echo WriteRecord >> $@
+ @echo XPMReader >> $@
+ @echo XBMReader >> $@
+ @echo _grow >> $@
+ @echo _ImplINetHistoryLoadTimer >> $@
+ @echo _ImplINetHistoryStoreTimer >> $@
+ @echo sRTF_>>$@
+ @echo sHTML_>>$@
+ @echo SdbSqlScanner>>$@
+ @echo Sdbyy_scan>>$@
+ @echo SqlInternalNode>>$@
+ @echo unnamed>>$@
+.IF "$(GUI)"=="WNT" || "$(GUI)"=="WIN"
+ @echo WEP>>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+.ENDIF
+.IF "$(COM)"=="MSC"
+ @echo ??_7>>$@
+ @echo ??_8>>$@
+ @echo ??_C>>$@
+ @echo ??_E>>$@
+ @echo ??_F>>$@
+ @echo ??_G>>$@
+ @echo ??_H>>$@
+ @echo ??_I>>$@
+ @echo 0Imp>>$@
+ @echo Impl@@>>$@
+ @echo Imp@@>>$@
+ @echo __CT>>$@
+.ENDIF
+
diff --git a/svtools/win/res/makefile.mk b/svtools/win/res/makefile.mk
new file mode 100644
index 000000000000..2e422ce51946
--- /dev/null
+++ b/svtools/win/res/makefile.mk
@@ -0,0 +1,61 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
diff --git a/svtools/workben/browser.cxx b/svtools/workben/browser.cxx
new file mode 100644
index 000000000000..593f13e22ce3
--- /dev/null
+++ b/svtools/workben/browser.cxx
@@ -0,0 +1,882 @@
+/*************************************************************************
+ *
+ * $RCSfile: browser.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#pragma hdrstop
+
+//#undef VCL
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _SV_SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+
+#ifndef _SV_MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#ifndef _SV_FLOATWIN_HXX //autogen
+#include <vcl/floatwin.hxx>
+#endif
+
+#ifndef _SV_MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+
+#ifndef _SV_WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+
+#ifndef _SV_EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _SVX_BRWBOX_HXX //autogen
+#include <brwbox.hxx>
+#endif
+
+#ifndef _SV_GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _SV_DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+
+#define MID_BROWSER 10
+#define MID_MODE 11
+#define MID_EVENTVIEW 12
+#define MID_INVALIDATE 13
+#define MID_CLEAR 14
+#define MID_ROW 20
+#define MID_INSERTROW_BEFORE 21
+#define MID_INSERTROW_AT 22
+#define MID_INSERTROW_BEHIND 23
+#define MID_REMOVEROW_BEFORE 24
+#define MID_REMOVEROW_AT 25
+#define MID_REMOVEROW_BEHIND 26
+#define MID_MODIFYROW_BEFORE 27
+#define MID_MODIFYROW_AT 28
+#define MID_MODIFYROW_BEHIND 29
+#define MID_COL 30
+#define MID_INSERTCOL 31
+#define MID_REMOVECOL 32
+#define MID_MOVECOLLEFT 33
+#define MID_MOVECOLRIGHT 34
+#define MID_SELECTIONS 60
+#define MID_SELECTROW 61
+#define MID_SELECTALL 62
+#define MID_SELECTNONE 63
+#define MID_INVERSE 64
+#define MID_EXTRAS 70
+#define MID_STARMONEY_1 71
+
+//==================================================================
+
+class BrowseModeDialog: public ModalDialog
+{
+ RadioButton aSingleSel;
+ RadioButton aMultiSel;
+ GroupBox aSelGroup;
+
+ CheckBox aKeepHighlight;
+ CheckBox aColumnCursor;
+ CheckBox aThumbDragging;
+ GroupBox aOptGroup;
+
+ RadioButton aNoHLines;
+ RadioButton aDottedHLines;
+ RadioButton aFullHLines;
+ GroupBox aHLinGroup;
+
+ RadioButton aNoVLines;
+ RadioButton aDottedVLines;
+ RadioButton aFullVLines;
+ GroupBox aVLinGroup;
+
+ OKButton aOKButton;
+ CancelButton aCancelButton;
+
+public:
+ BrowseModeDialog( Window *pParent );
+
+ void SetMode( BrowserMode eMode );
+ BrowserMode GetMode() const;
+};
+
+//==================================================================
+
+DECLARE_LIST(DataList,long);
+
+class Browser: public BrowseBox
+{
+friend class AppWindow;
+
+ DataList aRows;
+ BOOL bInverse;
+ Edit* pEdit;
+
+protected:
+ virtual long GetRowCount() const;
+ virtual BOOL SeekRow( long nRow );
+ virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect,
+ USHORT nColumnId ) const;
+
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void CursorMoved();
+ virtual void StartScroll();
+ virtual void EndScroll();
+ virtual void Command( const CommandEvent &eEvt );
+
+ virtual BOOL StartDragging( Pointer& rMovePtr,
+ Pointer& rCopyPtr );
+ virtual void EndDragging( const DropAction &rAction );
+ virtual void MouseButtonDown( const BrowserMouseEvent &rEvt );
+
+public:
+ Browser( AppWindow* pParent, BrowserMode eMode );
+ ~Browser();
+
+ void SetInverseSelection( BOOL bInverseSel )
+ { bInverse = bInverseSel; }
+};
+
+//------------------------------------------------------------------
+
+class AppWindow: public WorkWindow
+{
+ MenuBar aMenu;
+ PopupMenu aBrwMenu, aRowMenu, aColMenu, aSelMenu, aExtMenu;
+ Edit aEdit;
+ Browser aBrowser;
+ BrowserMode eCurMode;
+ FloatingWindow *pEventView;
+ ULONG nNewRowNo;
+
+private:
+ DECL_LINK( Modify, void * );
+ DECL_LINK( MenuSelect, Menu * );
+
+protected:
+ void Resize();
+ void Activate();
+
+public:
+ AppWindow();
+ ~AppWindow();
+
+ void Event( const String &rEvent );
+};
+
+//------------------------------------------------------------------
+
+class App: public Application
+{
+protected:
+#ifdef VCL
+ void Main();
+#else
+ void Main( int, char *[] );
+#endif
+
+public:
+ App();
+ ~App();
+};
+
+//==================================================================
+
+App aApp;
+
+//==================================================================
+
+BrowseModeDialog::BrowseModeDialog( Window *pParent ):
+ ModalDialog( pParent, WinBits( WB_MOVEABLE | WB_CLOSEABLE | WB_SVLOOK ) ),
+
+ aSingleSel( this ),
+ aMultiSel( this ),
+ aSelGroup( this ),
+
+ aKeepHighlight( this ),
+ aColumnCursor( this ),
+ aThumbDragging( this ),
+ aOptGroup( this ),
+
+ aNoHLines( this ),
+ aDottedHLines( this ),
+ aFullHLines( this ),
+ aHLinGroup( this ),
+
+ aNoVLines( this, WinBits( WB_GROUP ) ),
+ aDottedVLines( this ),
+ aFullVLines( this ),
+ aVLinGroup( this ),
+
+ aOKButton( this ),
+ aCancelButton( this )
+{
+ SetOutputSizePixel( Size( 290, 220 ) );
+ SetText( String( "Browse Mode", RTL_TEXTENCODING_IBM_850 ) );
+
+ aSingleSel.SetText( String( "single", RTL_TEXTENCODING_IBM_850 ) );
+ aMultiSel.SetText( String( "multi", RTL_TEXTENCODING_IBM_850 ) );
+ aSelGroup.SetText( String( " Selection ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aKeepHighlight.SetText( String( "keep highlight", RTL_TEXTENCODING_IBM_850 ) );
+ aColumnCursor.SetText( String( "column cursor", RTL_TEXTENCODING_IBM_850 ) );
+ aThumbDragging.SetText( String( "thumb dragging", RTL_TEXTENCODING_IBM_850 ) );
+ aOptGroup.SetText( String( " Options ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoHLines.SetText( String( "none", RTL_TEXTENCODING_IBM_850 ) );
+ aDottedHLines.SetText( String( "dotted", RTL_TEXTENCODING_IBM_850 ) );
+ aFullHLines.SetText( String( "full", RTL_TEXTENCODING_IBM_850 ) );
+ aHLinGroup.SetText( String( " Horizontal ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoVLines.SetText( String( "none", RTL_TEXTENCODING_IBM_850 ) );
+ aDottedVLines.SetText( String( "dotted", RTL_TEXTENCODING_IBM_850 ) );
+ aFullVLines.SetText( String( "full", RTL_TEXTENCODING_IBM_850 ) );
+ aVLinGroup.SetText( String( " Vertical ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aSingleSel.SetPosSizePixel( Point( 20, 30 ), Size( 80, 14 ) );
+ aMultiSel.SetPosSizePixel( Point( 20, 70 ), Size( 80, 14 ) );
+ aSelGroup.SetPosSizePixel( Point( 10, 10 ), Size( 100, 80 ) );
+ aSelGroup.SetText( String( " Selection ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aKeepHighlight.SetPosSizePixel( Point( 130, 30 ), Size( 140, 14 ) );
+ aColumnCursor.SetPosSizePixel( Point( 130, 50 ), Size( 140, 14 ) );
+ aThumbDragging.SetPosSizePixel( Point( 130, 70 ), Size( 140, 14 ) );
+ aOptGroup.SetPosSizePixel( Point( 120, 10 ), Size( 160, 80 ) );
+ aOptGroup.SetText( String( " Options ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoHLines.SetPosSizePixel( Point( 20, 120 ), Size( 80, 14 ) );
+ aDottedHLines.SetPosSizePixel( Point( 20, 140 ), Size( 80, 14 ) );
+ aFullHLines.SetPosSizePixel( Point( 20, 160 ), Size( 80, 14 ) );
+ aHLinGroup.SetPosSizePixel( Point( 10, 100 ), Size( 100, 80 ) );
+ aHLinGroup.SetText( String( " horizontal ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoVLines.SetPosSizePixel( Point( 130, 120 ), Size( 80, 14 ) );
+ aDottedVLines.SetPosSizePixel( Point( 130, 140 ), Size( 80, 14 ) );
+ aFullVLines.SetPosSizePixel( Point( 130, 160 ), Size( 80, 14 ) );
+ aVLinGroup.SetPosSizePixel( Point( 120, 100 ), Size( 100, 80 ) );
+ aVLinGroup.SetText( String( " vertical ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aOKButton.SetPosSizePixel( Point( 10, 190 ), Size( 100, 22 ) );
+ aCancelButton.SetPosSizePixel( Point( 120, 190 ), Size( 100, 22 ) );
+
+ aSingleSel.Check();
+ aNoHLines.Check();
+ aNoVLines.Check();
+
+ aSingleSel.Show();
+ aMultiSel.Show();
+ aSelGroup.Show();
+
+ aKeepHighlight.Show();
+ aColumnCursor.Show();
+ aThumbDragging.Show();
+ aOptGroup.Show();
+
+ aNoHLines.Show();
+ aDottedHLines.Show();
+ aFullHLines.Show();
+ aHLinGroup.Show();
+
+ aNoVLines.Show();
+ aDottedVLines.Show();
+ aFullVLines.Show();
+ aVLinGroup.Show();
+
+ aOKButton.Show();
+ aCancelButton.Show();
+}
+
+//------------------------------------------------------------------
+
+void BrowseModeDialog::SetMode( BrowserMode eMode )
+{
+ if ( ( eMode & BROWSER_COLUMNSELECTION ) == BROWSER_COLUMNSELECTION )
+ aColumnCursor.Check();
+ if ( ( eMode & BROWSER_MULTISELECTION ) == BROWSER_MULTISELECTION )
+ aMultiSel.Check();
+ if ( ( eMode & BROWSER_THUMBDRAGGING ) == BROWSER_THUMBDRAGGING )
+ aThumbDragging.Check();
+ if ( ( eMode & BROWSER_KEEPHIGHLIGHT ) == BROWSER_KEEPHIGHLIGHT )
+ aKeepHighlight.Check();
+ if ( ( eMode & BROWSER_HLINESFULL ) == BROWSER_HLINESFULL )
+ aFullHLines.Check();
+ if ( ( eMode & BROWSER_VLINESFULL ) == BROWSER_VLINESFULL )
+ aFullVLines.Check();
+ if ( ( eMode & BROWSER_HLINESDOTS ) == BROWSER_HLINESDOTS )
+ aDottedHLines.Check();
+ if ( ( eMode & BROWSER_VLINESDOTS ) == BROWSER_VLINESDOTS )
+ aDottedVLines.Check();
+}
+
+//------------------------------------------------------------------
+
+BrowserMode BrowseModeDialog::GetMode() const
+{
+ BrowserMode eMode = 0;
+
+ if ( aColumnCursor.IsChecked() )
+ eMode |= BROWSER_COLUMNSELECTION;
+ if ( aMultiSel.IsChecked() )
+ eMode |= BROWSER_MULTISELECTION;
+
+ if ( aKeepHighlight.IsChecked() )
+ eMode |= BROWSER_KEEPHIGHLIGHT;
+ if ( aThumbDragging.IsChecked() )
+ eMode |= BROWSER_THUMBDRAGGING;
+
+ if ( aDottedHLines.IsChecked() )
+ eMode |= BROWSER_HLINESDOTS;
+ if ( aFullHLines.IsChecked() )
+ eMode |= BROWSER_HLINESFULL;
+
+ if ( aDottedVLines.IsChecked() )
+ eMode |= BROWSER_VLINESDOTS;
+ if ( aFullVLines.IsChecked() )
+ eMode |= BROWSER_VLINESFULL;
+
+ return eMode;
+}
+
+//==================================================================
+
+Browser::Browser( AppWindow* pParent, BrowserMode eMode ):
+ BrowseBox( pParent, WinBits(WB_DRAG), eMode ),
+ bInverse(FALSE),
+ pEdit( 0 )
+{
+ for ( long n = 0; n < 100; ++n )
+ aRows.Insert( n, LIST_APPEND );
+
+ //InsertHandleColumn( 30 );
+ InsertDataColumn( 1, String( "eins", RTL_TEXTENCODING_IBM_850 ), 85 ); // FreezeColumn( 1 );
+ InsertDataColumn( 2, String( "zwei", RTL_TEXTENCODING_IBM_850 ), 85 ); // FreezeColumn( 2 );
+ InsertDataColumn( 3, String( "drei", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 4, String( "vier", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 5, String( "fuenf", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 6, String( "sechs", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 7, String( "sieben", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 8, String( "acht", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 9, String( "neun", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn(10, String( "zehn", RTL_TEXTENCODING_IBM_850 ), 85 );
+}
+
+//------------------------------------------------------------------
+
+Browser::~Browser()
+{
+ delete pEdit;
+}
+
+//------------------------------------------------------------------
+
+BOOL Browser::StartDragging( Pointer& rMovePtr, Pointer& rCopyPtr )
+{
+ rMovePtr = Pointer( POINTER_MOVEDATA );
+ rCopyPtr = Pointer( POINTER_COPYDATA );
+ return TRUE;
+}
+
+//------------------------------------------------------------------
+
+void Browser::MouseButtonDown( const BrowserMouseEvent &rEvt )
+{
+ if ( 3 == rEvt.GetClicks() )
+ InfoBox( 0, String( GetColumnAtXPosPixel(rEvt.GetPosPixel().X() ) ) ).Execute();
+ else
+ BrowseBox::MouseButtonDown( rEvt );
+}
+
+//------------------------------------------------------------------
+
+void Browser::EndDragging( const DropAction &rAction )
+{
+}
+
+//------------------------------------------------------------------
+
+void Browser::StartScroll()
+{
+ ( (AppWindow*) GetParent() )->Event( String( "StartScroll", RTL_TEXTENCODING_IBM_850 ) );
+ if ( pEdit )
+ pEdit->Hide();
+ BrowseBox::StartScroll();
+}
+
+//------------------------------------------------------------------
+
+void Browser::EndScroll()
+{
+ BrowseBox::EndScroll();
+ ( (AppWindow*) GetParent() )->Event( String( "EndScroll", RTL_TEXTENCODING_IBM_850 ) );
+ if ( pEdit )
+ pEdit->Show();
+}
+//------------------------------------------------------------------
+
+void Browser::Command( const CommandEvent &rEvt )
+{
+ String aEvent( String( "Command at ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += rEvt.GetMousePosPixel().X();
+ aEvent += String( ":", RTL_TEXTENCODING_IBM_850 );
+ aEvent += rEvt.GetMousePosPixel().Y();
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+ BrowseBox::Command(rEvt);
+}
+
+//------------------------------------------------------------------
+
+void Browser::Select()
+{
+ String aEvent( String( "Select: ", RTL_TEXTENCODING_IBM_850 ) );
+ DELETEZ(pEdit);
+ for ( long nRow = FirstSelectedRow(bInverse); nRow >= 0; nRow = NextSelectedRow() )
+ {
+ if ( bInverse )
+ aEvent += String( String( "~", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( nRow );
+ aEvent += String( ", ", RTL_TEXTENCODING_IBM_850 );
+ }
+ aEvent.Erase( aEvent.Len() - 2 );
+
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+}
+
+//------------------------------------------------------------------
+
+void Browser::DoubleClick()
+{
+ String aEvent( String( "DoubleClick: ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( GetCurRow() );
+ aEvent += String( String( ", ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( FirstSelectedRow() );
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+
+ SetNoSelection();
+ if ( !pEdit )
+ pEdit = new Edit( &GetDataWindow() );
+ Rectangle aRect( GetFieldRect( GetCurColumnId() ) );
+ pEdit->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+ pEdit->Show();
+ pEdit->GrabFocus();
+}
+
+//------------------------------------------------------------------
+
+void Browser::CursorMoved()
+{
+ String aEvent( String( "Cursor: ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( GetCurRow() );
+ aEvent += String( ":", RTL_TEXTENCODING_IBM_850 );
+ aEvent += String( GetCurColumnId() );
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+ if ( IsFieldVisible( GetCurRow(), GetCurColumnId(), TRUE ) )
+ ( (AppWindow*) GetParent() )->Event( String( "completely visible", RTL_TEXTENCODING_IBM_850 ) );
+ else if ( IsFieldVisible( 1, GetCurColumnId(), FALSE) )
+ ( (AppWindow*) GetParent() )->Event( String( "partly visible", RTL_TEXTENCODING_IBM_850 ) );
+ else
+ ( (AppWindow*) GetParent() )->Event( String( "not visible", RTL_TEXTENCODING_IBM_850 ) );
+
+ DELETEZ(pEdit);
+}
+
+//------------------------------------------------------------------
+
+long Browser::GetRowCount() const
+{
+ return aRows.Count();
+}
+
+//------------------------------------------------------------------
+
+BOOL Browser::SeekRow( long nRow )
+{
+ if ( nRow >= 0 && nRow < (long) aRows.Count() )
+ {
+ aRows.Seek(nRow);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+//------------------------------------------------------------------
+
+void Browser::PaintField( OutputDevice& rDev, const Rectangle& rRect,
+ USHORT nColumnId ) const
+{
+ rDev.SetClipRegion( rRect );
+ String aText( aRows.GetCurObject() );
+ aText += String( ".", RTL_TEXTENCODING_IBM_850 );
+ aText += String( nColumnId );
+ rDev.DrawText( rRect.TopLeft(), aText );
+}
+
+//==================================================================
+
+AppWindow::AppWindow():
+ WorkWindow( 0, WinBits(WB_APP|WB_STDWORK) ),
+ aEdit( this, WinBits( WB_BORDER ) ),
+ aBrowser( this, 0 ),
+ eCurMode( 0 ),
+ pEventView( 0 ),
+ nNewRowNo( 2000L )
+{
+ SetText( String( "BrowseBox Testframe", RTL_TEXTENCODING_IBM_850 ) );
+
+ aMenu.InsertItem( MID_BROWSER, String( "~Browser", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_BROWSER, &aBrwMenu );
+ aBrwMenu.InsertItem( MID_MODE, String( "~Mode...", RTL_TEXTENCODING_IBM_850 ) );
+ aBrwMenu.InsertItem( MID_EVENTVIEW, String( "~Event-Viewer", RTL_TEXTENCODING_IBM_850 ) );
+ aBrwMenu.InsertSeparator();
+ aBrwMenu.InsertItem( MID_INVALIDATE, String( "~Invalidate", RTL_TEXTENCODING_IBM_850 ) );
+ aBrwMenu.InsertItem( MID_CLEAR, String( "~Clear", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.InsertItem( MID_ROW, String( "~Row", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_ROW, &aRowMenu );
+ aRowMenu.InsertItem( MID_INSERTROW_BEFORE, String( "Insert before current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_INSERTROW_AT, String( "~Insert at current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_INSERTROW_BEHIND, String( "~Insert behind current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertSeparator();
+ aRowMenu.InsertItem( MID_REMOVEROW_BEFORE, String( "Remove before current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_REMOVEROW_AT, String( "~Remove at current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_REMOVEROW_BEHIND, String( "~Remove behind current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertSeparator();
+ aRowMenu.InsertItem( MID_MODIFYROW_BEFORE, String( "Modify before current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_MODIFYROW_AT, String( "~Modify at current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_MODIFYROW_BEHIND, String( "~Modify behind current", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.InsertItem( MID_COL, String( "~Column", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_COL, &aColMenu );
+ aColMenu.InsertItem( MID_INSERTCOL, String( "~Insert", RTL_TEXTENCODING_IBM_850 ) );
+ aColMenu.InsertItem( MID_REMOVECOL, String( "Re~move", RTL_TEXTENCODING_IBM_850 ) );
+ aColMenu.InsertItem( MID_MOVECOLLEFT, String( "Move ~Left", RTL_TEXTENCODING_IBM_850 ) );
+ aColMenu.InsertItem( MID_MOVECOLRIGHT, String( "Move ~Right", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.InsertItem( MID_SELECTIONS, String( "Selections", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_SELECTIONS, &aSelMenu );
+ aSelMenu.InsertItem( MID_SELECTROW, String( "Row", RTL_TEXTENCODING_IBM_850 ) );
+ aSelMenu.InsertItem( MID_SELECTALL, String( "All", RTL_TEXTENCODING_IBM_850 ) );
+ aSelMenu.InsertItem( MID_SELECTNONE, String( "None", RTL_TEXTENCODING_IBM_850 ) );
+ aSelMenu.InsertItem( MID_INVERSE, String( "Inverse", RTL_TEXTENCODING_IBM_850 ), MENU_APPEND, MIB_CHECKABLE );
+ aMenu.InsertItem( MID_EXTRAS, String( "Extras", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_EXTRAS, &aExtMenu );
+ aExtMenu.InsertItem( MID_STARMONEY_1, String( "StarMoney: SelectRow(+1)+DeleteRow", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.PushSelectHdl( LINK(this, AppWindow, MenuSelect) );
+
+ aEdit.SetModifyHdl( LINK(this,AppWindow,Modify) );
+
+ aEdit.Show();
+ aBrowser.Show();
+ Show();
+}
+
+//------------------------------------------------------------------
+
+AppWindow::~AppWindow()
+{
+ GetpApp()->SetAppMenu( 0 );
+ if ( pEventView )
+ delete pEventView;
+}
+
+//------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( AppWindow, Modify, void *, pCaller )
+{
+ Edit *pEdit = (Edit*) pCaller;
+ aBrowser.GoToRow( pEdit->GetText().ToInt32() );
+ aBrowser.GrabFocus();
+
+ return TRUE;
+}
+IMPL_LINK_INLINE_END( AppWindow, Modify, void *, pCaller )
+
+//------------------------------------------------------------------
+
+IMPL_LINK( AppWindow, MenuSelect, Menu *, pMenu )
+{
+ ULONG nPos;
+
+ switch ( pMenu->GetCurItemId() )
+ {
+ case MID_MODE:
+ {
+ BrowseModeDialog *pDlg = new BrowseModeDialog( this );
+ pDlg->SetMode( eCurMode );
+ if ( pDlg->Execute() == RET_OK )
+ {
+ eCurMode = pDlg->GetMode();
+ aBrowser.SetMode( eCurMode | BROWSER_AUTOSIZE_LASTCOL );
+ }
+ delete pDlg;
+ break;
+ }
+
+ case MID_INVALIDATE:
+ aBrowser.Invalidate();
+ break;
+
+ case MID_INSERTROW_BEFORE:
+ if ( aBrowser.GetCurRow() == 0 )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() - 1;
+ aBrowser.aRows.Insert( nNewRowNo++, nPos );
+ aBrowser.RowInserted( aBrowser.GetCurRow()-1 );
+ break;
+
+ case MID_INSERTROW_AT:
+ nPos = aBrowser.GetCurRow();
+ if ( nPos == BROWSER_ENDOFSELECTION )
+ nPos = 0;
+ aBrowser.aRows.Insert( nNewRowNo++, nPos );
+ aBrowser.RowInserted( nPos );
+ break;
+
+ case MID_INSERTROW_BEHIND:
+ nPos = aBrowser.GetCurRow() + 1;
+ aBrowser.aRows.Insert( nNewRowNo++, nPos );
+ aBrowser.RowInserted( nPos );
+ break;
+
+ case MID_REMOVEROW_BEFORE:
+ if ( aBrowser.GetCurRow() == 0 )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() - 1;
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+
+ case MID_REMOVEROW_AT:
+ nPos = aBrowser.GetCurRow();
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+
+ case MID_REMOVEROW_BEHIND:
+ if ( (aBrowser.GetCurRow()+1) >= aBrowser.GetRowCount() )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() + 1;
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+
+ case MID_MODIFYROW_BEFORE:
+ if ( aBrowser.GetCurRow() == 0 )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() - 1;
+ aBrowser.aRows.Replace( nNewRowNo++, nPos );
+ aBrowser.RowModified( nPos );
+ break;
+
+ case MID_MODIFYROW_AT:
+ nPos = aBrowser.GetCurRow();
+ aBrowser.aRows.Replace( nNewRowNo++, nPos );
+ aBrowser.RowModified( nPos );
+ break;
+
+ case MID_MODIFYROW_BEHIND:
+ if ( (aBrowser.GetCurRow()+1) >= aBrowser.GetRowCount() )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() + 1;
+ aBrowser.aRows.Replace( nNewRowNo++, nPos );
+ aBrowser.RowModified( nPos );
+ break;
+
+ case MID_EVENTVIEW:
+ if ( pEventView )
+ {
+ delete pEventView;
+ pEventView = 0;
+ }
+ else
+ {
+ pEventView = new FloatingWindow( this );
+ pEventView->SetPosPixel( Point( 100, 100 ) );
+ pEventView->SetOutputSizePixel(
+ Size( 320, 8*GetTextHeight() ) );
+ pEventView->Show();
+ aBrowser.CursorMoved();
+ aBrowser.Select();
+ }
+ break;
+
+ case MID_SELECTROW:
+ aBrowser.SelectRow( aBrowser.GetCurRow(),
+ !aBrowser.IsRowSelected( aBrowser.GetCurRow() ) );
+ break;
+
+ case MID_SELECTALL:
+ aBrowser.SelectAll();
+ break;
+
+ case MID_SELECTNONE:
+ aBrowser.SetNoSelection();
+ break;
+
+ case MID_INVERSE:
+ {
+ BOOL bChecked = pMenu->IsItemChecked( MID_INVERSE );
+ pMenu->CheckItem( MID_INVERSE, !bChecked );
+ aBrowser.SetInverseSelection( !bChecked );
+ break;
+ }
+
+ case MID_CLEAR:
+ aBrowser.Clear();
+ break;
+
+ case MID_STARMONEY_1:
+ {
+ nPos = aBrowser.GetCurRow();
+ aBrowser.SelectRow( nPos + 1, TRUE );
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+//------------------------------------------------------------------
+
+void AppWindow::Resize()
+{
+ Size aOutSz( GetOutputSizePixel() );
+
+ aEdit.SetPosSizePixel(
+ Point( 0, 0 ),
+ Size( aOutSz.Width(), 24 ) );
+
+ aBrowser.SetPosSizePixel(
+ Point( 0, aEdit.GetSizePixel().Height() ),
+ Size( aOutSz.Width(), aOutSz.Height() - 24 ) );
+}
+
+//------------------------------------------------------------------
+
+void AppWindow::Activate()
+{
+ GetpApp()->SetAppMenu( &aMenu );
+ aBrowser.GrabFocus();
+}
+
+//------------------------------------------------------------------
+
+void AppWindow::Event( const String &rEvent )
+{
+ if ( pEventView )
+ {
+ pEventView->Scroll( 0, -GetTextHeight() );
+ pEventView->Update();
+ pEventView->DrawText( Point(0, 7*GetTextHeight() ), rEvent );
+ }
+}
+
+//==================================================================
+
+App::App()
+{
+}
+
+//------------------------------------------------------------------
+
+App::~App()
+{
+}
+
+//------------------------------------------------------------------
+
+#ifdef VCL
+void App::Main( )
+#else
+void App::Main( int, char *[] )
+#endif
+{
+ EnableSVLook();
+
+ AppWindow aAppWin;
+
+
+ Execute();
+}
+
diff --git a/svtools/workben/cui/loadlib.cxx b/svtools/workben/cui/loadlib.cxx
new file mode 100644
index 000000000000..8fdca9e60b62
--- /dev/null
+++ b/svtools/workben/cui/loadlib.cxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * $RCSfile: loadlib.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <tools/string.hxx>
+#include <libcall.hxx>
+
+
+extern "C" {
+
+struct VersionInfo
+{
+ char aTime[20];
+ char aDate[20];
+ char aUpd[5];
+ char aMinor;
+ char aBuild[5];
+#if SUPD>564
+ char aInpath[20];
+#endif
+};
+
+#ifdef WNT
+__declspec(dllexport)
+#endif
+ VersionInfo *GetVersionInfo();
+};
+
+typedef VersionInfo*(__LOADONCALLAPI *PFUNC)(void);
+
+int __LOADONCALLAPI main( int argc, char **argv )
+{
+ VersionInfo *pInfo = 0L;
+ PFUNC pFunc;
+
+ if ( argc != 2 )
+ {
+ fprintf( stderr, "USAGE: %s DllName \n", argv[0] );
+ exit(0);
+ }
+ SvLibrary aLibrary(argv[1]);
+ pFunc = (PFUNC) aLibrary.GetFunction( "GetVersionInfo" );
+ if ( pFunc )
+ pInfo = (*pFunc)();
+ if ( pInfo )
+ {
+ fprintf( stdout, "Date : %s\n", pInfo->aDate );
+ fprintf( stdout, "Time : %s\n", pInfo->aTime );
+ fprintf( stdout, "UPD : %s\n", pInfo->aUpd );
+ fprintf( stdout, "Minor : %c\n", pInfo->aMinor );
+ fprintf( stdout, "Build : %s\n", pInfo->aBuild );
+#if SUPD>564
+ fprintf( stdout, "Inpath : %s\n", pInfo->aInpath );
+#endif
+ }
+ else
+ fprintf( stderr, "VersionInfo not Found !\n" );
+ return 0;
+}
+
diff --git a/svtools/workben/cui/makefile.mk b/svtools/workben/cui/makefile.mk
new file mode 100644
index 000000000000..1fd22a706d60
--- /dev/null
+++ b/svtools/workben/cui/makefile.mk
@@ -0,0 +1,106 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=cuidem
+LIBTARGET=NO
+
+TARGETTYPE=CUI
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/loadlib.obj
+
+APP4TARGET= dllver
+.IF "$(GUI)" != "MAC"
+APP4STDLIBS= \
+ $(SVMEMLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(SVLIB) \
+ $(TOOLSLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC"
+APP4STDLIBS+= $(CPPULIB)
+.ENDIF
+.ELSE
+APP4STDLIBS=$(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+APP4LIBS = $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+ $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+APP4OBJS= $(OBJ)$/loadlib.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/workben/makefile.mk b/svtools/workben/makefile.mk
new file mode 100644
index 000000000000..08ab359143dc
--- /dev/null
+++ b/svtools/workben/makefile.mk
@@ -0,0 +1,180 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=SVTOOLS
+TARGET=svdem
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/svdem.obj
+# removed, because these files aren't ported to Unicode
+# $(OBJ)$/browser.obj \
+# $(OBJ)$/stest.obj \
+# $(OBJ)$/grptest.obj
+
+APP1TARGET= $(TARGET)
+.IF "$(GUI)" != "MAC"
+APP1STDLIBS= $(SVTOOLLIB) \
+ $(SVLIB) \
+ $(TOOLSLIB) \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(CPPULIB)
+.ELSE
+APP1STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+APP1LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+ $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+APP1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/_svt.lib
+.ENDIF
+APP1OBJS= $(OBJ)$/svdem.obj
+APP1STACK= 32768
+
+# removed, because these files aren't ported to Unicode
+#APP2TARGET= browser
+.IF "$(GUI)" != "MAC"
+#APP2STDLIBS= $(SVTOOLLIB) \
+# $(SVLIB) \
+# $(SALLIB) \
+# $(TOOLSLIB) \
+# $(VOSLIB) \
+# $(CPPULIB)
+.ELSE
+#APP2STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+#APP2LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+# $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+#APP2DEPN= $(LB)$/_svt.lib $(L)$/itools.lib $(SVLIBDEPEND)
+.ENDIF
+#APP2OBJS= $(OBJ)$/browser.obj
+#APP2STACK= 32768
+
+# removed, because these files aren't ported to Unicode
+#APP3TARGET= stest
+.IF "$(GUI)" != "MAC"
+#APP3STDLIBS= $(SVMEMLIB) \
+# $(SVTOOLLIB) \
+# $(SVLIB) \
+# $(SALLIB) \
+# $(TOOLSLIB) \
+# $(VOSLIB) \
+# $(SVLLIB) \
+# $(CPPULIB)
+.ELSE
+#APP3STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+#APP3LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+# $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+#APP3DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/svmem.lib $(LB)$/_svt.lib
+.ENDIF
+#APP3OBJS= $(OBJ)$/stest.obj
+#APP3STACK= 32768
+
+# removed, because these files aren't ported to Unicode
+#APP4TARGET= grptest
+.IF "$(GUI)" != "MAC"
+#APP4STDLIBS= $(SVMEMLIB) \
+# $(SVTOOLLIB) \
+# $(SVLIB) \
+# $(SALLIB) \
+# $(TOOLSLIB) \
+# $(VOSLIB) \
+# $(CPPULIB)
+.ELSE
+#APP4STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+#APP4LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+# $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+#APP4DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/svmem.lib $(LB)$/_svt.lib
+.ENDIF
+#APP4OBJS= $(OBJ)$/grptest.obj
+#APP4STACK= 32768
+
+
+.IF "$(GUI)" == "MAC"
+MACRES = $(SV_RES)SV.R $(SV_RES)SV_DEMO.R $(SV_RES)SV_POWER.R
+.ENDIF
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/workben/stest.cxx b/svtools/workben/stest.cxx
new file mode 100644
index 000000000000..83d946a7a4bf
--- /dev/null
+++ b/svtools/workben/stest.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * $RCSfile: stest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifdef VCL
+#include <svmedit.hxx>
+#endif
+
+#ifndef _TXTCMP_HXX //autogen
+#include <txtcmp.hxx>
+#endif
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _SV_WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+
+#ifndef _SV_FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+class MyApp : public Application
+{
+public:
+#ifndef VCL
+ virtual void Main( int, char*[] );
+#else
+ virtual void Main( );
+#endif
+};
+
+class SearchWindow : public WorkWindow
+{
+ PushButton aPB;
+ FixedText aFT1, aFT2, aFT3;
+ MultiLineEdit aEText, aESrch;
+ RadioButton aModeN, aModeR, aModeL;
+ SearchParam aParam;
+
+public:
+ SearchWindow();
+
+ DECL_LINK( ClickHdl, Button * );
+};
+
+// --- SearchWindow::SearchWindow() ------------------------------------
+
+SearchWindow::SearchWindow() :
+ WorkWindow( NULL, WinBits( WB_APP | WB_STDWORK )),
+ aPB( this, WinBits( 0 )),
+ aFT1( this, WinBits( 0 )),
+ aFT2( this, WinBits( 0 )),
+ aFT3( this, WinBits( 0 )),
+ aEText( this, WinBits( WB_BORDER )),
+ aESrch( this, WinBits( WB_BORDER )),
+ aModeN( this, WinBits( 0 )),
+ aModeR( this, WinBits( 0 )),
+ aModeL( this, WinBits( 0 )),
+ aParam( "" )
+{
+ aPB.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+ aModeN.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+ aModeR.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+ aModeL.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+
+ SetMapMode( MapMode( MAP_APPFONT ));
+ SetSizePixel( LogicToPixel( Size( 300, 180 ) ) );
+
+ aEText.SetPosSizePixel( LogicToPixel( Point( 0, 22 )), LogicToPixel(Size( 270, 32 )) );
+ aFT1.SetPosSizePixel( LogicToPixel( Point( 0, 10 )), LogicToPixel(Size( 18, 11 )) );
+ aFT2.SetPosSizePixel( LogicToPixel( Point( 0, 60 )), LogicToPixel(Size( 24, 10 )) );
+ aESrch.SetPosSizePixel( LogicToPixel( Point( 0, 70 )), LogicToPixel(Size( 270, 24 )) );
+ aPB.SetPosSizePixel( LogicToPixel( Point( 223, 139 )), LogicToPixel(Size( 48, 12 )) );
+ aFT3.SetPosSizePixel( LogicToPixel( Point( 0, 104 )), LogicToPixel(Size( 270, 15 )) );
+ aModeN.SetPosSizePixel( LogicToPixel( Point( 5, 116 ) ), LogicToPixel( Size( 40, 12 ) ) );
+ aModeR.SetPosSizePixel( LogicToPixel( Point( 5, 126 ) ), LogicToPixel( Size( 40, 12 ) ) );
+ aModeL.SetPosSizePixel( LogicToPixel( Point( 5, 136 ) ), LogicToPixel( Size( 40, 12 ) ) );
+
+ aEText.Show();
+ aFT1.Show();
+ aFT2.Show();
+ aESrch.Show();
+ aPB.Show();
+ aFT3.Show();
+ aModeN.Show();
+ aModeR.Show();
+ aModeL.Show();
+
+ aFT3.SetText( "gefunden:" );
+ aFT1.SetText( "Text:" );
+ aFT2.SetText( "Suche:" );
+ aPB.SetText( "starte Suche" );
+ aModeN.SetText( "normal" );
+ aModeR.SetText( "RegExp" );
+ aModeL.SetText( "LevDis" );
+
+ SetText( "Such-Demo" );
+}
+
+
+// --- SearchWindow::SearchSelectHdl() ---------------------------------
+
+IMPL_LINK( SearchWindow, ClickHdl, Button *, pButton )
+{
+ if( pButton == &aPB )
+ {
+ String sText( aEText.GetText() );
+ String sSrch( aESrch.GetText() );
+
+/* InfoBox( this, String( "T: " ) + sText +
+ String( "\nS: " ) + sSrch ).Execute();
+*/
+ BOOL bRet = FALSE;
+ USHORT nStt = 0, nEnd = sText.Len();
+
+ {
+ aParam.SetSrchStr( sSrch );
+ SearchText aSrchText( aParam, GetpApp()->GetAppInternational() );
+ bRet = aSrchText.SearchFrwrd( sText, &nStt, &nEnd );
+
+// BOOL SearchBkwrd( const String &rStr, USHORT* pStart, USHORT* pEnde );
+ }
+
+ String sFound( "gefunden" );
+ if( !bRet )
+ sFound.Insert( "nicht ", 0 );
+
+ sFound += ": S<";
+ sFound += nStt;
+ sFound += "> E<";
+ sFound += nEnd;
+ sFound += '>';
+
+ if( bRet )
+ {
+ sFound += '<';
+ sFound += sText.Copy( nStt, nEnd - nStt +1 );
+ sFound += '>';
+ }
+
+ aFT3.SetText( sFound );
+ }
+ else if( pButton == &aModeN )
+ {
+ aParam.SetSrchType( SearchParam::SRCH_NORMAL );
+ }
+ else if( pButton == &aModeR )
+ {
+ aParam.SetSrchType( SearchParam::SRCH_REGEXP );
+ }
+ else if( pButton == &aModeL )
+ {
+ aParam.SetSrchType( SearchParam::SRCH_LEVDIST );
+ }
+ return 0;
+}
+
+
+// --- MyApp::Main() -----------------------------------------------
+
+#ifndef VCL
+void MyApp::Main( int, char*[] )
+#else
+void MyApp::Main( )
+#endif
+{
+ SearchWindow* pSearchWindow = new SearchWindow;
+ pSearchWindow->Show();
+ Execute();
+ delete pSearchWindow;
+
+}
+
+// --- aMyApp ------------------------------------------------------
+
+MyApp aMyApp;
diff --git a/svtools/workben/svdem.cxx b/svtools/workben/svdem.cxx
new file mode 100644
index 000000000000..9de046fae423
--- /dev/null
+++ b/svtools/workben/svdem.cxx
@@ -0,0 +1,1176 @@
+/*************************************************************************
+ *
+ * $RCSfile: svdem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <vcl/wrkwin.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/drag.hxx>
+#include <vcl/print.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/slider.hxx>
+#include <vcl/group.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/status.hxx>
+#include <stdmenu.hxx>
+#include <ctrltool.hxx>
+#include <ctrlbox.hxx>
+#include <tabbar.hxx>
+#include <valueset.hxx>
+#include <headbar.hxx>
+#include <prgsbar.hxx>
+#include <calendar.hxx>
+#include <prnsetup.hxx>
+#include <printdlg.hxx>
+
+// -----------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main();
+};
+
+// -----------------------------------------------------------------------
+
+class ShowBitmap : public WorkWindow
+{
+ Bitmap aBmp;
+
+public:
+ ShowBitmap( Window* pParent, const Bitmap& rBmp );
+
+ virtual void Paint( const Rectangle& );
+ virtual BOOL Close();
+};
+
+// -----------------------------------------------------------------------
+
+class ShowFont : public Control
+{
+public:
+ ShowFont( Window* pParent );
+
+ virtual void Paint( const Rectangle& );
+ void SetFont( const Font& rFont )
+ { Invalidate(); Control::SetFont( rFont ); }
+};
+
+// --- class OrientSlider ------------------------------------------------
+
+class OrientSlider : public Slider
+{
+public:
+ OrientSlider( Window* pParent );
+
+ short GetOrientation() const { return (short)GetThumbPos(); }
+};
+
+// -----------------------------------------------------------------------
+
+OrientSlider::OrientSlider( Window* pParent ) :
+ Slider( pParent, WB_HORZ | WB_DRAG )
+{
+ SetThumbPos( 0 );
+ SetLineSize( 10 );
+ SetPageSize( 100 );
+ SetRange( Range( 0, 3600 ) );
+}
+
+// -----------------------------------------------------------------------
+
+class MyFontDialog : public ModalDialog
+{
+private:
+ FontList* pList;
+ Font aCurFont;
+ Printer aPrinter;
+ FontNameBox aFontBox;
+ FontStyleBox aStyleBox;
+ FontSizeBox aSizeBox;
+ ListBox aUnderlineBox;
+ ListBox aStrikeoutBox;
+ CheckBox aWordLineBox;
+ CheckBox aShadowBox;
+ CheckBox aOutlineBox;
+ ColorListBox aColorBox;
+ GroupBox aEffectBox;
+ OrientSlider aLineOrientSlider;
+ ShowFont aShowFont;
+ GroupBox aSampleBox;
+ FixedText aMapText;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+
+public:
+ MyFontDialog( Window* pParent );
+
+ DECL_LINK( SelectFont, ComboBox* );
+ DECL_LINK( SelectStyle, ComboBox* );
+ DECL_LINK( AttrHdl, Window * );
+ void SetAttr();
+ short Execute();
+};
+
+// -----------------------------------------------------------------------
+
+class MyTabBar : public TabBar
+{
+public:
+ MyTabBar( Window* pParent,
+ WinBits nWinStyle = WB_STDTABBAR ) :
+ TabBar( pParent, nWinStyle ) {}
+
+ virtual long DeactivatePage();
+ virtual long AllowRenaming();
+ virtual void Split();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual BOOL QueryDrop( DropEvent& rDEvt );
+};
+
+// -----------------------------------------------------------------------
+
+class MyCalendar : public WorkWindow
+{
+ MenuBar aMenuBar;
+ PopupMenu aWeekStartMenu;
+ PopupMenu aWeekCountMenu;
+ Calendar aCalendar;
+ Color aInfoColor;
+ Color aHolidayColor;
+ Color aFrameColor;
+
+public:
+ MyCalendar( Window* pParent );
+ ~MyCalendar();
+
+ DECL_LINK( RequestDateInfoHdl, Calendar* );
+ DECL_LINK( DoubleClickHdl, Calendar* );
+ DECL_LINK( MenuSelectHdl, Menu* );
+
+ void Resize();
+};
+
+// -----------------------------------------------------------------------
+
+class MyWin : public WorkWindow
+{
+private:
+ Printer aPrn;
+ ToolBox aBox;
+ StatusBar aBar;
+ HeaderBar aHeadBar;
+ ColorListBox aColorList;
+ LineListBox aLineList;
+ ValueSet aValueSet;
+ CalendarField aCalendarField;
+ CalendarField aCalendarField2;
+ MyTabBar aTabBar;
+ ProgressBar aPrgsBar;
+ PushButton aFontBtn;
+ PushButton aCalendarBtn;
+ PushButton aPrnSetupBtn;
+ PushButton aPrnDlgBtn;
+ Size aBoxSize;
+ MyCalendar* pCalendar;
+ PopupMenu* pMenu;
+ FontNameMenu* pNameMenu;
+ FontStyleMenu* pStyleMenu;
+ FontSizeMenu* pSizeMenu;
+
+public:
+ MyWin( Window* pParent, WinBits aWinStyle );
+ ~MyWin();
+
+ DECL_LINK( Test, PushButton* );
+ DECL_LINK( SelectHdl, Window* );
+ DECL_LINK( CalSelectHdl, CalendarField* );
+ void ContextMenu( const Point& rPos );
+
+ void Command( const CommandEvent& rCEvt );
+ void MouseButtonDown( const MouseEvent& rMEvt );
+ void KeyInput( const KeyEvent& rKEvt );
+ void Paint( const Rectangle& rRect );
+ void Resize();
+};
+
+// -----------------------------------------------------------------------
+
+void MyApp::Main()
+{
+ Help aHelp;
+ SetHelp( &aHelp );
+ Help::EnableContextHelp();
+ Help::EnableExtHelp();
+ Help::EnableBalloonHelp();
+ Help::EnableQuickHelp();
+
+ MyWin aMainWin( NULL, WinBits( WB_APP | WB_STDWORK | WB_CLIPCHILDREN ) );
+ aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "SVTOOLS - Workbench" ) ) );
+ aMainWin.GrabFocus();
+ aMainWin.Show();
+
+ Execute();
+}
+
+// -----------------------------------------------------------------------
+
+ShowBitmap::ShowBitmap( Window* pParent, const Bitmap& rBmp ) :
+ WorkWindow( pParent, WB_STDWORK ),
+ aBmp( rBmp )
+{
+ SetOutputSizePixel( rBmp.GetSizePixel() );
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Bitmap-Viewer" ) ) );
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void ShowBitmap::Paint( const Rectangle& )
+{
+ DrawBitmap( Point(), GetOutputSizePixel(), aBmp );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ShowBitmap::Close()
+{
+ Hide();
+ delete this;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+ShowFont::ShowFont( Window* pParent ) :
+ Control( pParent, WB_BORDER )
+{
+ SetMapMode( MapMode( MAP_POINT, Point(),
+ Fraction( 1, 10 ), Fraction( 1, 10 ) ) );
+ SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ShowFont::Paint( const Rectangle& )
+{
+ const Font& rFont = GetFont();
+ String aText;
+ Size aWindowSize( GetOutputSize() );
+ long x,y;
+
+ if ( rFont.GetLineOrientation() )
+ {
+ aText.Append( String::CreateFromInt32( rFont.GetLineOrientation()/10 ) );
+ aText.AppendAscii( " degree." );
+
+ x = aWindowSize.Width()/2;
+ y = aWindowSize.Height()/2;
+ }
+ else
+ {
+ aText = rFont.GetName();
+ if ( !aText.Len() )
+ aText.AssignAscii( "Sample" );
+
+ x = aWindowSize.Width()/2 - GetTextWidth( aText )/2;
+ y = aWindowSize.Height()/2 - GetTextHeight()/2;
+ }
+
+ DrawText( Point( x, y ), aText );
+}
+
+// -----------------------------------------------------------------------
+
+MyFontDialog::MyFontDialog( Window* pParent ) :
+ ModalDialog( pParent, WB_SVLOOK | WB_STDMODAL ),
+ aFontBox( this ),
+ aStyleBox( this ),
+ aSizeBox( this ),
+ aUnderlineBox( this, WB_DROPDOWN ),
+ aStrikeoutBox( this, WB_DROPDOWN ),
+ aWordLineBox( this ),
+ aShadowBox( this ),
+ aOutlineBox( this ),
+ aColorBox( this, WB_DROPDOWN ),
+ aEffectBox( this ),
+ aLineOrientSlider( this ),
+ aShowFont( this ),
+ aSampleBox( this ),
+ aMapText( this, WB_LEFT | WB_WORDBREAK ),
+ aOKBtn( this, WB_DEFBUTTON ),
+ aCancelBtn( this )
+{
+ pList = NULL;
+
+ aFontBox.EnableWYSIWYG( TRUE );
+ aFontBox.EnableSymbols( TRUE );
+ aFontBox.SetPosSizePixel( Point( 10, 10 ), Size( 140, 140 ) );
+ aFontBox.SetSelectHdl( LINK( this, MyFontDialog, SelectFont ) );
+ aFontBox.SetLoseFocusHdl( LINK( this, MyFontDialog, SelectFont ) );
+ aFontBox.Show();
+
+ aStyleBox.SetPosSizePixel( Point( 160, 10 ), Size( 100, 140 ) );
+ aStyleBox.SetSelectHdl( LINK( this, MyFontDialog, SelectStyle ) );
+ aStyleBox.SetLoseFocusHdl( LINK( this, MyFontDialog, SelectStyle ) );
+ aStyleBox.Show();
+
+ aSizeBox.SetPosSizePixel( Point( 270, 10 ), Size( 60, 140 ) );
+ aSizeBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aSizeBox.SetLoseFocusHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aSizeBox.Show();
+
+ aUnderlineBox.SetPosSizePixel( Point( 15, 180 ), Size( 130, 100 ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_NONE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_SINGLE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOUBLE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOTTED" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DONTKNOW" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_LONGDASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASHDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASHDOTDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_SMALLWAVE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_WAVE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOUBLEWAVE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLD" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDOTTED" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDLONGDASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASHDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASHDOTDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDWAVE" ) ) );
+ aUnderlineBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aUnderlineBox.Show();
+
+ aStrikeoutBox.SetPosSizePixel( Point( 15, 210 ), Size( 130, 100 ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_NONE" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_SINGLE" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_DOUBLE" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_DONTKNOW" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_BOLD" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_SLASH" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_X" ) ) );
+ aStrikeoutBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aStrikeoutBox.Show();
+
+ aWordLineBox.SetPosSizePixel( Point( 15, 240 ), Size( 130, 19 ) );
+ aWordLineBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Only ~Words" ) ) );
+ aWordLineBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aWordLineBox.Show();
+
+ aShadowBox.SetPosSizePixel( Point( 15, 260 ), Size( 130, 19 ) );
+ aShadowBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Shadow" ) ) );
+ aShadowBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aShadowBox.Show();
+
+ aOutlineBox.SetPosSizePixel( Point( 15, 280 ), Size( 130, 19 ) );
+ aOutlineBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Outline" ) ) );
+ aOutlineBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aOutlineBox.Show();
+
+ {
+ aColorBox.SetPosSizePixel( Point( 15, 305 ), Size( 130, 100 ) );
+ aColorBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aColorBox.SetUpdateMode( FALSE );
+ aColorBox.InsertEntry( Color( COL_BLACK ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ aColorBox.InsertEntry( Color( COL_BLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ aColorBox.InsertEntry( Color( COL_GREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ aColorBox.InsertEntry( Color( COL_CYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ aColorBox.InsertEntry( Color( COL_RED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ aColorBox.InsertEntry( Color( COL_MAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ aColorBox.InsertEntry( Color( COL_BROWN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ aColorBox.InsertEntry( Color( COL_GRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTGRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTBLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTGREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTCYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTRED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTMAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
+ aColorBox.InsertEntry( Color( COL_YELLOW ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ aColorBox.InsertEntry( Color( COL_WHITE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ aColorBox.SetUpdateMode( TRUE );
+ aColorBox.Show();
+ }
+
+ aEffectBox.SetPosSizePixel( Point( 10, 160 ), Size( 140, 175 ) );
+ aEffectBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Effects" ) ) );
+ aEffectBox.Show();
+
+ Size aSliderSize = aLineOrientSlider.GetSizePixel();
+ aLineOrientSlider.SetPosSizePixel( Point( 160, 335-aSliderSize.Height() ),
+ Size( 250, aSliderSize.Height() ) );
+ aLineOrientSlider.SetSlideHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aLineOrientSlider.Show();
+
+ aShowFont.SetPosSizePixel( Point( 165, 180 ), Size( 240, 70 ) );
+ aShowFont.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Sample" ) ) );
+ aShowFont.Show();
+
+ aSampleBox.SetPosSizePixel( Point( 160, 160 ), Size( 250, 100 ) );
+ aSampleBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Sample" ) ) );
+ aSampleBox.Show();
+
+ aMapText.SetPosSizePixel( Point( 160, 270 ), Size( 250, 35 ) );
+ aMapText.Show();
+
+ aOKBtn.SetPosSizePixel( Point( 340, 10 ), Size( 70, 25 ) );
+ aOKBtn.Show();
+
+ aCancelBtn.SetPosSizePixel( Point( 340, 40 ), Size( 70, 25 ) );
+ aCancelBtn.Show();
+
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "FontDialog" ) ) );
+ SetOutputSizePixel( Size( 420, 345 ) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyFontDialog, SelectFont, ComboBox*, EMPTYARG )
+{
+ aStyleBox.Fill( aFontBox.GetText(), pList );
+ FontInfo aInfo = pList->Get( aFontBox.GetText(), aStyleBox.GetText() );
+ aSizeBox.Fill( aInfo, pList );
+ SetAttr();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyFontDialog, SelectStyle, ComboBox*, EMPTYARG )
+{
+ FontInfo aInfo = pList->Get( aFontBox.GetText(), aStyleBox.GetText() );
+ aSizeBox.Fill( aInfo, pList );
+ SetAttr();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyFontDialog, AttrHdl, Window*, EMPTYARG )
+{
+ SetAttr();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MyFontDialog::SetAttr()
+{
+ FontInfo aFont( pList->Get( aFontBox.GetText(), aStyleBox.GetText() ) );
+ aFont.SetSize( Size( 0, aSizeBox.GetValue() ) );
+ aFont.SetUnderline( (FontUnderline)aUnderlineBox.GetSelectEntryPos() );
+ aFont.SetStrikeout( (FontStrikeout)aStrikeoutBox.GetSelectEntryPos() );
+ aFont.SetColor( Color( (ColorName)aColorBox.GetSelectEntryPos() ) );
+ aFont.SetWordLineMode( aWordLineBox.IsChecked() );
+ aFont.SetShadow( aShadowBox.IsChecked() );
+ aFont.SetOutline( aOutlineBox.IsChecked() );
+ aFont.SetLineOrientation( aLineOrientSlider.GetOrientation() );
+ aFont.SetTransparent( TRUE );
+ aMapText.SetText( pList->GetFontMapText( aFont ) );
+ aShowFont.SetFont( aFont );
+}
+
+// -----------------------------------------------------------------------
+
+short MyFontDialog::Execute()
+{
+ pList = new FontList( &aPrinter, this );
+ aFontBox.Fill( pList );
+ aSizeBox.SetValue( 120 );
+ aUnderlineBox.SelectEntryPos( 0 );
+ aStrikeoutBox.SelectEntryPos( 0 );
+ aColorBox.SelectEntryPos( 0 );
+ SelectFont( &aFontBox );
+ short nRet = ModalDialog::Execute();
+ delete pList;
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+long MyTabBar::DeactivatePage()
+{
+ if ( GetCurPageId() == 6 )
+ {
+ QueryBox aQueryBox( this, WB_YES_NO | WB_DEF_YES,
+ XubString( RTL_CONSTASCII_USTRINGPARAM( "Deactivate" ) ) );
+ if ( aQueryBox.Execute() == RET_YES )
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+long MyTabBar::AllowRenaming()
+{
+ XubString aStr( RTL_CONSTASCII_USTRINGPARAM( "Allow renaming: " ) );
+ aStr += GetEditText();
+ QueryBox aQueryBox( this, WB_YES_NO_CANCEL | WB_DEF_YES, aStr );
+ long nRet = aQueryBox.Execute();
+ if ( nRet == RET_YES )
+ return TAB_RENAMING_YES;
+ else if ( nRet == RET_NO )
+ return TAB_RENAMING_NO;
+ else // ( nRet == RET_CANCEL )
+ return TAB_RENAMING_CANCEL;
+}
+
+// -----------------------------------------------------------------------
+
+void MyTabBar::Split()
+{
+ Size aSize = GetSizePixel();
+ long nWidth = GetSplitSize();
+ long nMaxWidth = GetParent()->GetOutputSizePixel().Width()-50;
+ if ( nWidth < GetMinSize() )
+ nWidth = GetMinSize();
+ else if ( nWidth > nMaxWidth )
+ nWidth = nMaxWidth;
+ SetSizePixel( Size( nWidth, aSize.Height() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void MyTabBar::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_STARTDRAG )
+ {
+ Region aRegion;
+ if ( StartDrag( rCEvt, aRegion ) )
+ {
+ DragServer::Clear();
+ DragServer::CopyString( XubString( RTL_CONSTASCII_USTRINGPARAM( "TabBar" ) ) );
+ if ( GetSelectPageCount() > 1 )
+ {
+ ExecuteDrag( Pointer( POINTER_MOVEFILES ),
+ Pointer( POINTER_COPYFILES ),
+ DRAG_ALL, &aRegion );
+ }
+ else
+ {
+ ExecuteDrag( Pointer( POINTER_MOVEFILE ),
+ Pointer( POINTER_COPYFILE ),
+ DRAG_ALL, &aRegion );
+ }
+ HideDropPos();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MyTabBar::QueryDrop( DropEvent& rDEvt )
+{
+ if ( rDEvt.IsLeaveWindow() )
+ HideDropPos();
+ else
+ ShowDropPos( rDEvt.GetPosPixel() );
+/*
+ if ( rDEvt.IsLeaveWindow() )
+ EndSwitchPage();
+ else
+ SwitchPage( rDEvt.GetPosPixel() );
+*/
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+MyCalendar::MyCalendar( Window* pParent ) :
+ WorkWindow( pParent, WB_STDWORK ),
+ aCalendar( this, WB_TABSTOP | WB_WEEKNUMBER | WB_BOLDTEXT | WB_FRAMEINFO | WB_MULTISELECT ),
+ aInfoColor( COL_LIGHTBLUE ),
+ aHolidayColor( COL_LIGHTRED ),
+ aFrameColor( COL_LIGHTRED )
+{
+ const International& rIntn = aCalendar.GetInternational();
+ aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Wochen~anfang" ) ) );
+ aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Erste Woche" ) ) );
+ aMenuBar.SetPopupMenu( 1, &aWeekStartMenu );
+ aMenuBar.SetPopupMenu( 2, &aWeekCountMenu );
+ for ( USHORT i = 0; i < 7; i++ )
+ aWeekStartMenu.InsertItem( 10+i, rIntn.GetDayText( (DayOfWeek)i ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekStartMenu.CheckItem( 10+(USHORT)rIntn.GetWeekStart() );
+ aWeekCountMenu.InsertItem( 20, XubString( RTL_CONSTASCII_USTRINGPARAM( "~1. Januar" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekCountMenu.InsertItem( 21, XubString( RTL_CONSTASCII_USTRINGPARAM( "Erste 4 ~Tage-Woche" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekCountMenu.InsertItem( 22, XubString( RTL_CONSTASCII_USTRINGPARAM( "Erste ~volle Woche" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekCountMenu.CheckItem( 20+(USHORT)rIntn.GetWeekCountStart() );
+ aMenuBar.SetSelectHdl( LINK( this, MyCalendar, MenuSelectHdl ) );
+ SetMenuBar( &aMenuBar );
+
+ Date aCurDate = aCalendar.GetCurDate();
+ aCalendar.SetRequestDateInfoHdl( LINK( this, MyCalendar, RequestDateInfoHdl ) );
+ aCalendar.SetDoubleClickHdl( LINK( this, MyCalendar, DoubleClickHdl ) );
+ aCalendar.SetSaturdayColor( Color( COL_LIGHTGREEN ) );
+ aCalendar.SetSundayColor( aHolidayColor );
+ aCalendar.AddDateInfo( Date( 1, 1, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Neujahr" ) ), &aHolidayColor, NULL );
+ aCalendar.AddDateInfo( Date( 24, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Heiligabend" ) ), &aInfoColor, NULL );
+ aCalendar.AddDateInfo( Date( 25, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "1. Weihnachttag" ) ), &aHolidayColor, NULL );
+ aCalendar.AddDateInfo( Date( 26, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "2. Weihnachttag" ) ), &aHolidayColor, NULL );
+ aCalendar.AddDateInfo( Date( 31, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Silvester" ) ), &aInfoColor, NULL );
+ aCalendar.SetPosPixel( Point() );
+ aCalendar.SetFirstDate( Date( 1, 1, aCurDate.GetYear() ) );
+ aCalendar.Show();
+
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Calendar" ) ) );
+ SetOutputSizePixel( aCalendar.CalcWindowSizePixel( 3, 4 ) );
+}
+
+// -----------------------------------------------------------------------
+
+MyCalendar::~MyCalendar()
+{
+ SetMenuBar( NULL );
+ aMenuBar.SetPopupMenu( 1, NULL );
+ aMenuBar.SetPopupMenu( 2, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyCalendar, RequestDateInfoHdl, Calendar*, EMPTYARG )
+{
+ USHORT nRequestYear = aCalendar.GetRequestYear();
+ if ( (nRequestYear >= 1954) && (nRequestYear <= 1989) )
+ aCalendar.AddDateInfo( Date( 17, 6, nRequestYear ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Tag der deutschen Einheit" ) ), &aHolidayColor, NULL );
+ else if ( nRequestYear >= 1990 )
+ aCalendar.AddDateInfo( Date( 3, 10, nRequestYear ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Tag der deutschen Einheit" ) ), &aHolidayColor, NULL );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyCalendar, DoubleClickHdl, Calendar*, EMPTYARG )
+{
+ Date aDate = aCalendar.GetCurDate();
+ String aStr( RTL_CONSTASCII_USTRINGPARAM( "Info: " ) );
+ aStr += Application::GetAppInternational().GetDate( aDate );
+ aCalendar.AddDateInfo( aDate, aStr, NULL, &aFrameColor, DIB_BOLD );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyCalendar, MenuSelectHdl, Menu*, pMenu )
+{
+ International aIntn = aCalendar.GetInternational();
+ USHORT nItemId = pMenu->GetCurItemId();
+
+ if ( (nItemId >= 10) && (nItemId <= 19) )
+ aIntn.SetWeekStart( (DayOfWeek)(nItemId-10) );
+ else if ( (nItemId >= 20) && (nItemId <= 29) )
+ aIntn.SetWeekCountStart( (WeekCountStart)(nItemId-20) );
+ aCalendar.SetInternational( aIntn );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MyCalendar::Resize()
+{
+ aCalendar.SetSizePixel( GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::MyWin( Window* pParent, WinBits aWinStyle ) :
+ WorkWindow(pParent, aWinStyle | WB_SVLOOK ),
+ aBox( this, WB_BORDER | WB_SVLOOK ),
+ aBar( this, WB_BORDER | WB_SVLOOK | WB_RIGHT ),
+ aHeadBar( this, WB_BORDER | WB_SVLOOK | WB_DRAG | WB_BUTTONSTYLE ),
+ aColorList( this ),
+ aLineList( this ),
+ aValueSet( this, WB_TABSTOP | WB_NAMEFIELD | WB_NONEFIELD | WB_BORDER | WB_ITEMBORDER | WB_VSCROLL /* | WB_FLATVALUESET */ ),
+ aCalendarField( this, WB_TABSTOP | WB_SPIN | WB_REPEAT | WB_DROPDOWN | WB_BORDER ),
+ aCalendarField2( this, WB_TABSTOP | WB_SPIN | WB_REPEAT | WB_DROPDOWN | WB_BORDER ),
+ aTabBar( this, WB_BORDER | WB_MULTISELECT | WB_SCROLL | WB_SIZEABLE | WB_DRAG ),
+ aPrgsBar( this ),
+ aFontBtn( this ),
+ aCalendarBtn( this ),
+ aPrnSetupBtn( this ),
+ aPrnDlgBtn( this )
+{
+ SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFaceColor() ) );
+
+ pCalendar = NULL;
+ pMenu = NULL;
+
+ Bitmap aBmp;
+ aBox.InsertItem( 1, aBmp );
+ aBox.InsertItem( 2, aBmp );
+ aBox.InsertItem( 3, aBmp );
+ aBox.InsertItem( 4, aBmp );
+ aBox.InsertSeparator();
+ aBox.InsertItem( 5, aBmp );
+ aBox.InsertItem( 6, aBmp );
+ aBox.InsertItem( 7, aBmp );
+ aBox.InsertItem( 8, aBmp );
+ aBox.InsertSpace();
+ aBox.InsertItem( 9, aBmp );
+ aBox.SetPosPixel( Point( 0, 0 ) );
+ aBoxSize = aBox.GetSizePixel();
+ aBox.Show();
+
+ aBar.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Ready" ) ) );
+ aBar.InsertItem( 1, 35 );
+ aBar.InsertItem( 2, 55 );
+ aBar.InsertItem( 3, 55 );
+ aBar.SetItemText( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
+ aBar.SetItemText( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "21.01.93" ) ) );
+ aBar.SetItemText( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "12:00:00" ) ) );
+ aBar.Show();
+
+ long nY = aBox.GetSizePixel().Height()+10;
+ {
+ aHeadBar.SetPosPixel( Point( 0, nY ) );
+ aHeadBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Sender" ) ), 150 );
+ aHeadBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Subject" ) ), 150, HIB_CENTER | HIB_VCENTER | HIB_CLICKABLE );
+ aHeadBar.InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ), 75 );
+ aHeadBar.InsertItem( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ), 60, HIB_RIGHT | HIB_VCENTER | HIB_CLICKABLE );
+ aHeadBar.InsertItem( 9999, String(), HEADERBAR_FULLSIZE, HIB_RIGHT | HIB_VCENTER | HIB_FIXEDPOS );
+ aHeadBar.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ aHeadBar.Show();
+ nY += aHeadBar.GetSizePixel().Height() += 10;
+ }
+
+ {
+ aColorList.SetPosSizePixel( Point( 10, nY ), Size( 130, 180 ) );
+ aColorList.SetUpdateMode( FALSE );
+ aColorList.InsertEntry( Color( COL_BLACK ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ aColorList.InsertEntry( Color( COL_BLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ aColorList.InsertEntry( Color( COL_GREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ aColorList.InsertEntry( Color( COL_CYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ aColorList.InsertEntry( Color( COL_RED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ aColorList.InsertEntry( Color( COL_MAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ aColorList.InsertEntry( Color( COL_BROWN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ aColorList.InsertEntry( Color( COL_GRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTGRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTBLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTGREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTCYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTRED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTMAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
+ aColorList.InsertEntry( Color( COL_YELLOW ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ aColorList.InsertEntry( Color( COL_WHITE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ aColorList.SetUpdateMode( TRUE );
+ aColorList.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ aColorList.Show();
+ }
+
+ {
+ aLineList.SetPosSizePixel( Point( 150, nY ), Size( 130, 180 ) );
+ aLineList.SetUnit( FUNIT_POINT );
+ aLineList.SetSourceUnit( FUNIT_TWIP );
+ aLineList.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Hairline" ) ) );
+ aLineList.InsertEntry( 1500 );
+ aLineList.InsertEntry( 3000 );
+ aLineList.InsertEntry( 4500 );
+ aLineList.InsertEntry( 6000 );
+ aLineList.InsertEntry( 7500 );
+ aLineList.InsertEntry( 9000 );
+ aLineList.InsertEntry( 1500, 1500, 1500 );
+ aLineList.InsertEntry( 3000, 1500, 1500 );
+ aLineList.InsertEntry( 4500, 1500, 1500 );
+ aLineList.InsertEntry( 3000, 3000, 1500 );
+ aLineList.InsertEntry( 4500, 3000, 1500 );
+ aLineList.InsertEntry( 4500, 4500, 1500 );
+ aLineList.Show();
+ }
+
+ {
+ aValueSet.SetPosSizePixel( Point( 290, nY ), Size( 130, 180 ) );
+ aValueSet.InsertItem( 9, Color( COL_BLACK ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ aValueSet.InsertItem( 10, Color( COL_BLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ aValueSet.InsertItem( 11, Color( COL_GREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ aValueSet.InsertItem( 12, Color( COL_CYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ aValueSet.InsertItem( 13, Color( COL_RED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ aValueSet.InsertItem( 14, Color( COL_MAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ aValueSet.InsertItem( 15, Color( COL_BROWN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ aValueSet.InsertItem( 16, Color( COL_GRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ aValueSet.InsertItem( 17, Color( COL_LIGHTGRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
+ aValueSet.InsertItem( 18, Color( COL_LIGHTBLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
+ aValueSet.InsertItem( 19, Color( COL_LIGHTGREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
+ aValueSet.InsertItem( 20, Color( COL_LIGHTCYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
+ aValueSet.InsertItem( 21, Color( COL_LIGHTRED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
+ aValueSet.InsertItem( 22, Color( COL_LIGHTMAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
+ aValueSet.InsertItem( 23, Color( COL_YELLOW ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ aValueSet.InsertItem( 24, Color( COL_WHITE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ aValueSet.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ aValueSet.SetColCount( 4 );
+ aValueSet.SetLineCount( 4 );
+ aValueSet.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ aValueSet.Show();
+ }
+
+ {
+ aCalendarField.EnableEmptyFieldValue( TRUE );
+ aCalendarField.SetCalendarStyle( aCalendarField.GetCalendarStyle() | WB_RANGESELECT );
+ aCalendarField.SetSelectHdl( LINK( this, MyWin, CalSelectHdl ) );
+// aCalendarField.SetDate( Date() );
+ aCalendarField.SetEmptyDate();
+ aCalendarField.EnableToday();
+ aCalendarField.EnableNone();
+ aCalendarField.SetPosSizePixel( Point( 430, nY ), Size( 130, 20 ) );
+ aCalendarField.Show();
+ }
+
+ {
+ aCalendarField2.SetDate( Date() );
+ aCalendarField2.SetPosSizePixel( Point( 570, nY ), Size( 130, 20 ) );
+ aCalendarField2.Show();
+ }
+
+ nY += 200;
+ {
+ aTabBar.SetPosSizePixel( Point( 10, nY ),
+ Size( 300, aTabBar.GetSizePixel().Height() ) );
+ aTabBar.InsertPage( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 1" ) ) );
+ aTabBar.InsertPage( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 2" ) ) );
+ aTabBar.InsertPage( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 3" ) ) );
+ aTabBar.InsertPage( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 4" ) ) );
+ aTabBar.InsertPage( 5, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 5" ) ) );
+ aTabBar.InsertPage( 6, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 6" ) ) );
+ aTabBar.InsertPage( 7, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 7" ) ) );
+ aTabBar.InsertPage( 8, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 8" ) ) );
+ aTabBar.InsertPage( 9, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 9" ) ) );
+ aTabBar.InsertPage( 10, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 10" ) ) );
+ aTabBar.InsertPage( 11, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 11" ) ) );
+ aTabBar.InsertPage( 12, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 12" ) ) );
+ aTabBar.InsertPage( 13, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 13" ) ) );
+ aTabBar.InsertPage( 14, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 14" ) ) );
+ aTabBar.InsertPage( 15, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 15" ) ) );
+ aTabBar.InsertPage( 16, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 16" ) ) );
+ aTabBar.InsertPage( 17, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 17" ) ) );
+ aTabBar.InsertPage( 18, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 18" ) ) );
+ aTabBar.InsertPage( 19, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 19" ) ) );
+ aTabBar.InsertPage( 20, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 20" ) ) );
+ aTabBar.InsertPage( 21, XubString( RTL_CONSTASCII_USTRINGPARAM( "This is a long Page Text" ) ) );
+ aTabBar.InsertPage( 22, XubString( RTL_CONSTASCII_USTRINGPARAM( "Short Text" ) ) );
+ aTabBar.InsertPage( 23, XubString( RTL_CONSTASCII_USTRINGPARAM( "And now a very very long Page Text" ) ) );
+ aTabBar.InsertPage( 24, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 24" ) ) );
+ aTabBar.InsertPage( 25, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 25" ) ) );
+ aTabBar.InsertPage( 26, XubString( RTL_CONSTASCII_USTRINGPARAM( "And now a very long Page Text" ) ) );
+ aTabBar.InsertPage( 27, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 27" ) ) );
+ aTabBar.InsertPage( 28, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 28" ) ) );
+ aTabBar.InsertPage( 29, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 29" ) ) );
+ aTabBar.InsertPage( 30, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 30" ) ) );
+ aTabBar.EnableEditMode();
+ aTabBar.Show();
+ }
+
+ nY += 35;
+ {
+ aPrgsBar.SetPosPixel( Point( 10, nY ) );
+ aPrgsBar.Show();
+ }
+
+ nY += 40;
+ {
+ aFontBtn.SetPosSizePixel( Point( 10, nY ), Size( 100, 30 ) );
+ aFontBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Font..." ) ) );
+ aFontBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aFontBtn.Show();
+
+ aCalendarBtn.SetPosSizePixel( Point( 120, nY ), Size( 100, 30 ) );
+ aCalendarBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Calendar" ) ) );
+ aCalendarBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aCalendarBtn.Show();
+
+ aPrnSetupBtn.SetPosSizePixel( Point( 230, nY ), Size( 100, 30 ) );
+ aPrnSetupBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "PrnSetup..." ) ) );
+ aPrnSetupBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aPrnSetupBtn.Show();
+
+ aPrnDlgBtn.SetPosSizePixel( Point( 340, nY ), Size( 100, 30 ) );
+ aPrnDlgBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Print...." ) ) );
+ aPrnDlgBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aPrnDlgBtn.Show();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::~MyWin()
+{
+ if ( pCalendar )
+ delete pCalendar;
+
+ if ( pMenu )
+ {
+ delete pMenu;
+ delete pNameMenu;
+ delete pStyleMenu;
+ delete pSizeMenu;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyWin, Test, PushButton*, pBtn )
+{
+ if ( pBtn == &aFontBtn )
+ {
+ MyFontDialog* pDlg = new MyFontDialog( this );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ else if ( pBtn == &aCalendarBtn )
+ {
+ if ( !pCalendar )
+ pCalendar = new MyCalendar( this );
+ pCalendar->ToTop();
+ pCalendar->Show();
+ }
+ else if ( pBtn == &aPrnSetupBtn )
+ {
+ PrinterSetupDialog* pDlg = new PrinterSetupDialog( this );
+ pDlg->SetPrinter( &aPrn );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ else if ( pBtn == &aPrnDlgBtn )
+ {
+ PrintDialog* pDlg = new PrintDialog( this );
+ pDlg->SetPrinter( &aPrn );
+ pDlg->EnableRange( PRINTDIALOG_ALL );
+ pDlg->EnableRange( PRINTDIALOG_RANGE );
+ pDlg->Execute();
+ delete pDlg;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyWin, SelectHdl, Window*, pCtrl )
+{
+ if ( pCtrl == &aColorList )
+ {
+ Color aColor = aColorList.GetSelectEntryColor();
+ aValueSet.SetColor( aColor );
+ aLineList.SetColor( aColor );
+ }
+ else if ( pCtrl == &aValueSet )
+ {
+ USHORT nId = aValueSet.GetSelectItemId();
+ if ( nId > 8 )
+ {
+ Color aColor = aValueSet.GetItemColor( nId );
+ aValueSet.SetFillColor( aColor );
+ }
+ }
+ else if ( pCtrl == &aHeadBar )
+ {
+ USHORT nCurItemId = aHeadBar.GetCurItemId();
+ for ( USHORT i = 0; i < aHeadBar.GetItemCount(); i++ )
+ {
+ USHORT nItemId = aHeadBar.GetItemId( i );
+ HeaderBarItemBits nBits = aHeadBar.GetItemBits( nItemId );
+ if ( nItemId == nCurItemId )
+ {
+ HeaderBarItemBits nOldBits = nBits;
+ nBits &= ~(HIB_DOWNARROW | HIB_UPARROW);
+ if ( nOldBits & HIB_DOWNARROW )
+ nBits |= HIB_UPARROW;
+ else
+ nBits |= HIB_DOWNARROW;
+ }
+ else
+ nBits &= ~(HIB_DOWNARROW | HIB_UPARROW);
+ aHeadBar.SetItemBits( nItemId, nBits );
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyWin, CalSelectHdl, CalendarField*, pCtrl )
+{
+ if ( pCtrl == &aCalendarField )
+ {
+ Calendar* pCalendar = pCtrl->GetCalendar();
+ aCalendarField2.SetDate( pCalendar->GetSelectDate( pCalendar->GetSelectDateCount()-1 ) );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::ContextMenu( const Point& rPos )
+{
+ FontList aList( this );
+
+ if ( !pMenu )
+ {
+ pMenu = new PopupMenu;
+ pNameMenu = new FontNameMenu;
+ pStyleMenu = new FontStyleMenu;
+ pSizeMenu = new FontSizeMenu;
+
+ pMenu->InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Font" ) ) );
+ pMenu->InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Attribute" ) ) );
+ pMenu->InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) );
+ pMenu->SetPopupMenu( 1, pNameMenu );
+ pMenu->SetPopupMenu( 2, pStyleMenu );
+ pMenu->SetPopupMenu( 3, pSizeMenu );
+
+ pNameMenu->Fill( &aList );
+ pNameMenu->SetCurName( aList.GetFontName( 0 ).GetName() );
+
+ pStyleMenu->InsertSeparator();
+ pStyleMenu->InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Underline" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ pStyleMenu->InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Stri~keout" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ pStyleMenu->InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Shadow" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ pStyleMenu->InsertItem( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Outline" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ }
+
+ pStyleMenu->Fill( pNameMenu->GetCurName(), &aList );
+ pSizeMenu->Fill( aList.Get( pNameMenu->GetCurName(),
+ pStyleMenu->GetCurStyle() ), &aList );
+
+ pMenu->Execute( this, rPos );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ ContextMenu( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ aValueSet.StartSelection();
+ WorkWindow::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( rKEvt.GetKeyCode().GetCode() == KEY_P )
+ {
+ for ( USHORT i = 0; i <= 130; i += 2 )
+ {
+ for ( USHORT j = 0; j < 6000; j++ )
+ {
+ aPrgsBar.SetValue( i );
+ Application::Reschedule();
+ }
+ }
+ }
+ else if ( rKEvt.GetCharCode() == '+' )
+ aHeadBar.SetOffset( aHeadBar.GetOffset()+1 );
+ else if ( rKEvt.GetCharCode() == '-' )
+ aHeadBar.SetOffset( aHeadBar.GetOffset()-1 );
+
+ WorkWindow::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Paint( const Rectangle& rRect )
+{
+ WorkWindow::Paint( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Resize()
+{
+ Size aWinSize = GetOutputSizePixel();
+
+ aBox.SetSizePixel( Size( aWinSize.Width(), aBoxSize.Height() ) );
+
+ Size aSize = aBar.GetSizePixel();
+ aBar.SetPosSizePixel( Point( 0, aWinSize.Height()-aSize.Height() ),
+ Size( aWinSize.Width(), aSize.Height() ) );
+
+ Size aBarSize = aSize;
+ Point aPos = aHeadBar.GetPosPixel();
+ aSize = aHeadBar.GetSizePixel();
+ aHeadBar.SetSizePixel( Size( aWinSize.Width(), aSize.Height() ) );
+ aHeadBar.SetDragSize( aWinSize.Height() - aSize.Height() - aPos.Y() - aBarSize.Height() );
+
+ aPos = aPrgsBar.GetPosPixel();
+ aSize = aPrgsBar.GetSizePixel();
+ if ( aPos.X() < aWinSize.Width()-10 )
+ aPrgsBar.SetSizePixel( Size( aWinSize.Width()-aPos.X()-10, aSize.Height() ) );
+}
+
+// -----------------------------------------------------------------------
+
+MyApp aMyApp;
diff --git a/svtools/workben/urange.cxx b/svtools/workben/urange.cxx
new file mode 100644
index 000000000000..44e9e868362c
--- /dev/null
+++ b/svtools/workben/urange.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * $RCSfile: urange.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/* Test the SfxUShortRanges class */
+
+#ifndef _SFXITEMS_HXX
+#include <sfxitems.hxx>
+#endif
+
+USHORT nValues1[] = {340,472,482,4288,4374,4890,5026,5356,5724,6130,6186,6666,9222,9764,9908,
+ 10110,11302,11748,11946,12298,12344,12642,12958,13076,13410,13496,14462,
+ 14480,14592,16292,16788,17102,17792,17844,18182,18396,18522,18974,19292,
+ 19630,20336,21808,21972,22382,23568,25156,26978,27158,27730,28014,28280,
+ 28774,29258,30920,30938,31356,31582,32194,32734,32893,33757,33911,34013,
+ 34565,35283,38895,40273,41281,42157,44429,44553,45825,46367,48163,48417,
+ 49501,50499,52105,53035,53715,53899,54015,54131,54865,55155,55507,56325,
+ 57045,59243,59833,59859,59951,60361,61387,62453,62703,63155,63517,63621,
+ 63895,0};
+
+USHORT nValues2[] = {2362,3100,3286,3548,4056,4224,5058,5198,5398,5990,6910,7034,7046,8574,8762,
+ 9360,9494,9720,11432,12900,12946,13626,13844,14344,15028,16306,16494,16972,
+ 17340,17504,17610,18270,18506,19832,19962,20356,20792,21146,21270,21722,
+ 22486,22752,23554,24148,24210,24910,25006,25500,26464,26952,27216,28394,
+ 28398,29602,31130,31642,31894,33343,34191,34593,34931,36221,36637,37287,
+ 37765,39853,41231,41711,41799,44213,44863,46491,47459,48707,48911,49353,
+ 49923,49997,50117,51357,51519,52043,52563,52727,53781,54065,54249,55333,
+ 56549,57361,57777,58165,58507,59229,59719,60379,60845,62697,63123,65169,0};
+
+#include <sv.hxx>
+
+SfxUShortRanges aRanges1a( nValues1 );
+SfxUShortRanges aRanges1b( nValues1 );
+SfxUShortRanges aRanges1c( nValues1 );
+SfxUShortRanges aRanges2( nValues2 );
+
+
+String aStr1;
+String aStr2;
+String aStr3;
+
+
+static String MakeString_Impl( SfxUShortRanges& aRanges )
+{
+ String aStr;
+
+ USHORT nPos = 0;
+ const USHORT* pRanges = ( const USHORT*)aRanges;
+
+ while( pRanges[ nPos ] != 0 )
+ {
+ aStr += pRanges[ nPos ];
+ aStr += " - ";
+ aStr += pRanges[ nPos+1 ];
+ aStr += ", ";
+ nPos += 2;
+ }
+
+
+ return aStr;
+}
+
+
+// -------------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main( int, char* [] );
+};
+
+// -------------------------------------------------------------------------
+
+class MyDialog : public ModalDialog
+{
+private:
+ GroupBox aGroup1;
+ MultiLineEdit aEdit1;
+ GroupBox aGroup2;
+ MultiLineEdit aEdit2;
+ GroupBox aGroup3;
+ MultiLineEdit aEdit3;
+ OKButton aBtn1;
+ CancelButton aBtn2;
+
+public:
+ MyDialog( Window* pParent );
+
+ void MouseButtonDown( const MouseEvent& rMEvt );
+};
+
+// -------------------------------------------------------------------------
+
+MyDialog::MyDialog( Window* pParent ) :
+ ModalDialog( pParent, WB_STDMODAL | WB_SVLOOK ),
+ aGroup1( this ),
+ aEdit1( this, WB_BORDER | WB_READONLY ),
+ aGroup2( this ),
+ aEdit2( this, WB_BORDER | WB_READONLY ),
+ aGroup3( this ),
+ aEdit3( this, WB_BORDER | WB_READONLY ),
+ aBtn1( this, WB_DEFBUTTON ),
+ aBtn2( this )
+{
+ aGroup1.SetText( "Union" );
+ aGroup1.SetPosSizePixel( Point( 5, 5 ), Size( 330, 80 ) );
+ aGroup1.Show();
+
+ aEdit1.SetPosSizePixel( Point ( 10, 20 ), Size( 320, 60 ) );
+ aEdit1.SetText( aStr1 );
+ aEdit1.Show();
+
+ aGroup2.SetText( "Difference" );
+ aGroup2.SetPosSizePixel( Point( 5, 90 ), Size( 330, 80 ) );
+ aGroup2.Show();
+
+ aEdit2.SetPosSizePixel( Point( 10, 105 ), Size( 320, 60 ) );
+ aEdit2.SetText( aStr2 );
+ aEdit2.Show();
+
+ aGroup3.SetText( "Intersection" );
+ aGroup3.SetPosSizePixel( Point( 5, 175 ), Size( 330, 80 ) );
+ aGroup3.Show();
+
+ aEdit3.SetPosSizePixel( Point( 10, 190 ), Size( 320, 60 ) );
+ aEdit3.SetText( aStr3 );
+ aEdit3.Show();
+
+ aBtn1.SetPosSizePixel( Point( 10, 310 ), Size( 100, 25 ) );
+ aBtn1.Show();
+
+ aBtn2.SetPosSizePixel( Point( 120, 310 ), Size( 100, 25 ) );
+ aBtn2.Show();
+
+ SetOutputSizePixel( Size( 340, 345 ) );
+ SetText( "SfxUShortRanges Test" );
+}
+
+// -------------------------------------------------------------------------
+
+void MyDialog::MouseButtonDown( const MouseEvent& rMEvt )
+{
+}
+
+
+// -------------------------------------------------------------------------
+
+class MyWin : public WorkWindow
+{
+public:
+ MyWin( Window* pParent, WinBits aWinStyle ) :
+ WorkWindow( pParent, aWinStyle )
+ {}
+
+ void MouseButtonDown( const MouseEvent& );
+};
+
+
+// -------------------------------------------------------------------------
+
+MyApp aMyApp;
+
+void MyApp::Main( int, char* [] )
+{
+ EnableSVLook();
+ SetAppFont( System::GetStandardFont( STDFONT_APP ) );
+
+ MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
+ aMainWin.SetText( "SfxUShortRanges - Test" );
+ aMainWin.Show();
+
+ aRanges1a += aRanges2;
+ aRanges1b -= aRanges2;
+ aRanges1c /= aRanges2;
+
+ aStr1 = MakeString_Impl( aRanges1a );
+ aStr2 = MakeString_Impl( aRanges1b );
+ aStr3 = MakeString_Impl( aRanges1c );
+
+ Execute();
+}
+
+// -------------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( rMEvt.IsLeft() )
+ {
+ MyDialog* pDialog = new MyDialog( this );
+ pDialog->Execute();
+ delete pDialog;
+ }
+}
+
diff --git a/toolkit/inc/toolkit/awt/vclxbitmap.hxx b/toolkit/inc/toolkit/awt/vclxbitmap.hxx
new file mode 100644
index 000000000000..fc9ce2b44e16
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxbitmap.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxbitmap.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXBITMAP_HXX_
+#define _TOOLKIT_AWT_VCLXBITMAP_HXX_
+
+#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_
+#include <com/sun/star/awt/XBitmap.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDISPLAYBITMAP_HPP_
+#include <com/sun/star/awt/XDisplayBitmap.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _SV_BITMAPEX_HXX
+#include <vcl/bitmapex.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXBitmap
+// ----------------------------------------------------
+
+class VCLXBitmap : public ::com::sun::star::awt::XBitmap,
+ public ::com::sun::star::awt::XDisplayBitmap,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ BitmapEx maBitmap;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+
+public:
+ void SetBitmap( const BitmapEx& rBmp ) { maBitmap = rBmp; }
+ const BitmapEx& GetBitmap() const { return maBitmap; }
+
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXBitmap* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XBitmap
+ ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getDIB() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXBITMAP_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxcontainer.hxx b/toolkit/inc/toolkit/awt/vclxcontainer.hxx
new file mode 100644
index 000000000000..8ca2117966c7
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxcontainer.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxcontainer.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXCONTAINER_HXX_
+#define _TOOLKIT_AWT_VCLXCONTAINER_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
+#include <com/sun/star/awt/XVclContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXContainer
+// ----------------------------------------------------
+
+class VCLXContainer : public ::com::sun::star::awt::XVclContainer,
+ public ::com::sun::star::awt::XVclContainerPeer,
+ public VCLXWindow
+{
+public:
+ VCLXContainer();
+ ~VCLXContainer();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclContainer
+ void SAL_CALL addVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > SAL_CALL getWindows( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclContainerPeer
+ void SAL_CALL enableDialogControl( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTabOrder( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& WindowOrder, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Tabs, sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Windows ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXCONTAINER_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxdevice.hxx b/toolkit/inc/toolkit/awt/vclxdevice.hxx
new file mode 100644
index 000000000000..af080e4981e6
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxdevice.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxdevice.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXDEVICE_HXX_
+#define _TOOLKIT_AWT_VCLXDEVICE_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_
+#include <com/sun/star/awt/XDevice.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+
+class OutputDevice;
+class VirtualDevice;
+
+// ----------------------------------------------------
+// class VCLXDevice
+// ----------------------------------------------------
+
+class VCLXDevice : public ::com::sun::star::awt::XDevice,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+ friend class VCLXGraphics;
+
+private:
+ NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex
+ OutputDevice* mpOutputDevice;
+
+public:
+ void* pDummy;
+ sal_uInt32 nDummy;
+
+protected:
+ NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; }
+ void DestroyOutputDevice();
+
+public:
+ VCLXDevice();
+ ~VCLXDevice();
+
+ void SetOutputDevice( OutputDevice* pOutDev ) { mpOutputDevice = pOutDev; }
+ OutputDevice* GetOutputDevice() const { return mpOutputDevice; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXDevice* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL createGraphics( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > SAL_CALL getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( const ::com::sun::star::awt::FontDescriptor& aDescriptor ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > SAL_CALL createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > SAL_CALL createDisplayBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& Bitmap ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXVirtualDevice
+// ----------------------------------------------------
+
+class VCLXVirtualDevice : public VCLXDevice
+{
+private:
+ VirtualDevice* mpVDev;
+
+public:
+ ~VCLXVirtualDevice() { DestroyOutputDevice(); }
+
+ void SetVirtualDevice( VirtualDevice* pVDev ) { SetOutputDevice( (OutputDevice*)pVDev ); }
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXDEVICE_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxfont.hxx b/toolkit/inc/toolkit/awt/vclxfont.hxx
new file mode 100644
index 000000000000..41eee883a245
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxfont.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxfont.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXFONT_HXX_
+#define _TOOLKIT_AWT_VCLXFONT_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XFONT_HPP_
+#include <com/sun/star/awt/XFont.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_
+#include <com/sun/star/awt/XDevice.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _SV_METRIC_HXX
+#include <vcl/metric.hxx>
+#endif
+
+// ----------------------------------------------------
+// class VCLXFont
+// ----------------------------------------------------
+
+class VCLXFont : public ::com::sun::star::awt::XFont,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice;
+ Font maFont;
+ FontMetric* mpFontMetric;
+
+protected:
+ BOOL ImplAssertValidFontMetric();
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+public:
+ VCLXFont();
+ ~VCLXFont();
+
+ void Init( ::com::sun::star::awt::XDevice& rxDev, const Font& rFont );
+ const Font& GetFont() const { return maFont; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXFont* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XFont
+ ::com::sun::star::awt::FontDescriptor SAL_CALL getFontDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getCharWidth( sal_Unicode c ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getStringWidth( const ::rtl::OUString& str ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getStringWidthArray( const ::rtl::OUString& str, ::com::sun::star::uno::Sequence< sal_Int32 >& rDXArray ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getKernPairs( ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars1, ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars2, ::com::sun::star::uno::Sequence< sal_Int16 >& rnKerns ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+#endif // _TOOLKIT_AWT_VCLXFONT_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxgraphics.hxx b/toolkit/inc/toolkit/awt/vclxgraphics.hxx
new file mode 100644
index 000000000000..58e47054564d
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxgraphics.hxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxgraphics.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXGRAPHICS_HXX_
+#define _TOOLKIT_AWT_VCLXGRAPHICS_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
+#include <com/sun/star/awt/XGraphics.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+
+#include <vcl/font.hxx>
+#include <vcl/color.hxx>
+#include <vcl/vclenum.hxx>
+
+class OutputDevice;
+class Region;
+
+
+#define INITOUTDEV_FONT 0x0001
+#define INITOUTDEV_COLORS 0x0002
+#define INITOUTDEV_RASTEROP 0x0004
+#define INITOUTDEV_CLIPREGION 0x0008
+#define INITOUTDEV_ALL 0xFFFF
+
+
+// ----------------------------------------------------
+// class VCLXGraphics
+// ----------------------------------------------------
+
+class VCLXGraphics : public ::com::sun::star::awt::XGraphics,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice; // nur um bei getDevice() immer das gleiche zurueckzugeben
+
+ OutputDevice* mpOutputDevice;
+ Font maFont;
+ Color maTextColor;
+ Color maTextFillColor;
+ Color maLineColor;
+ Color maFillColor;
+ RasterOp meRasterOp;
+ Region* mpClipRegion;
+
+protected:
+ NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; }
+
+public:
+ VCLXGraphics();
+ ~VCLXGraphics();
+
+ void Init( OutputDevice* pOutDev );
+ void InitOutputDevice( sal_uInt16 nFlags );
+
+ void SetOutputDevice( OutputDevice* pOutDev );
+ OutputDevice* GetOutputDevice() const { return mpOutputDevice; }
+
+ const Font& GetFont() const { return maFont; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXGraphics* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XGraphics
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL getDevice( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& xNewFont ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectFont( const ::com::sun::star::awt::FontDescriptor& aDescription ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setRasterOp( ::com::sun::star::awt::RasterOperation ROP ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& Clipping ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& xClipping ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL push( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL pop( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& xSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& xBitmapHandle, sal_Int32 SourceX, sal_Int32 SourceY, sal_Int32 SourceWidth, sal_Int32 SourceHeight, sal_Int32 DestX, sal_Int32 DestY, sal_Int32 DestWidth, sal_Int32 DestHeight ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPixel( sal_Int32 X, sal_Int32 Y ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawLine( sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawRoundedRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawEllipse( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawArc( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPie( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawChord( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawGradient( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 Height, const ::com::sun::star::awt::Gradient& aGradient ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawText( sal_Int32 X, sal_Int32 Y, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawTextArray( sal_Int32 X, sal_Int32 Y, const ::rtl::OUString& Text, const ::com::sun::star::uno::Sequence< sal_Int32 >& Longs ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXGRAPHICS_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxmenu.hxx b/toolkit/inc/toolkit/awt/vclxmenu.hxx
new file mode 100644
index 000000000000..8c6cd3db788f
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxmenu.hxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxmenu.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXMENU_HXX_
+#define _TOOLKIT_AWT_VCLXMENU_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XMENUBAR_HPP_
+#include <com/sun/star/awt/XMenuBar.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPOPUPMENU_HPP_
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <tools/list.hxx>
+#include <tools/link.hxx>
+
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+class Menu;
+
+DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* );
+
+// ----------------------------------------------------
+// class VCLXMenu
+// ----------------------------------------------------
+
+class VCLXMenu : public ::com::sun::star::awt::XMenuBar,
+ public ::com::sun::star::awt::XPopupMenu,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ Menu* mpMenu;
+ BOOL mbPopup;
+ MenuListenerMultiplexer maMenuListeners;
+ PopupMenuRefList maPopupMenueRefs;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+ DECL_LINK( SelectHdl, Menu* );
+ DECL_LINK( HighlightHdl, Menu* );
+ DECL_LINK( ActivateHdl, Menu* );
+ DECL_LINK( DeactivateHdl, Menu* );
+
+ void ImplCreateMenu( BOOL bPopup );
+
+public:
+ VCLXMenu();
+ ~VCLXMenu();
+
+
+ Menu* GetMenu() const { return mpMenu; }
+ BOOL IsPopupMenu() const { return mbPopup; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXMenu* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XMenu
+ void SAL_CALL addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& aPopupMenu ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPopupMenu
+ void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent, const ::com::sun::star::awt::Rectangle& Area, sal_Int16 Direction ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XMenuBar
+
+};
+
+// ----------------------------------------------------
+// class VCLXMenuBar
+// ----------------------------------------------------
+class VCLXMenuBar : public VCLXMenu
+{
+public:
+ VCLXMenuBar() { ImplCreateMenu( FALSE ); }
+};
+
+// ----------------------------------------------------
+// class VCLXPopupMenu
+// ----------------------------------------------------
+class VCLXPopupMenu : public VCLXMenu
+{
+public:
+ VCLXPopupMenu() { ImplCreateMenu( TRUE ); }
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXMENU_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxpointer.hxx b/toolkit/inc/toolkit/awt/vclxpointer.hxx
new file mode 100644
index 000000000000..88774ca14ebd
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxpointer.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxpointer.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXPOINTER_HXX_
+#define _TOOLKIT_AWT_VCLXPOINTER_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_
+#include <com/sun/star/awt/XPointer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <vcl/pointr.hxx>
+
+// ----------------------------------------------------
+// class VCLXPointer
+// ----------------------------------------------------
+
+class VCLXPointer : public ::com::sun::star::awt::XPointer,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ Pointer maPointer;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+public:
+ VCLXPointer();
+ ~VCLXPointer();
+
+ const Pointer& GetPointer() const { return maPointer; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXPointer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPointer
+ void SAL_CALL setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXPOINTER_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxprinter.hxx b/toolkit/inc/toolkit/awt/vclxprinter.hxx
new file mode 100644
index 000000000000..5a8aa1be9420
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxprinter.hxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxprinter.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXPRINTER_HXX_
+#define _TOOLKIT_AWT_VCLXPRINTER_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XPRINTERPROPERTYSET_HPP_
+#include <com/sun/star/awt/XPrinterPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPRINTER_HPP_
+#include <com/sun/star/awt/XPrinter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPRINTERSERVER_HPP_
+#include <com/sun/star/awt/XPrinterServer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XINFOPRINTER_HPP_
+#include <com/sun/star/awt/XInfoPrinter.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+class Printer;
+class String;
+
+
+// Fuer den Drucker relevante Properties:
+/*
+ sal_Bool Horizontal
+ sal_uInt16 CopyCount;
+ sal_Bool Collate;
+ String FormDescriptor;
+ sal_uInt16 Orientation; // PORTRAIT, LANDSCAPE
+*/
+
+// ----------------------------------------------------
+// class VCLXPrinterPropertySet
+// ----------------------------------------------------
+
+class VCLXPrinterPropertySet : public ::com::sun::star::awt::XPrinterPropertySet,
+ public ::com::sun::star::lang::XTypeProvider,
+ public MutexAndBroadcastHelper,
+ public ::cppu::OPropertySetHelper
+{
+private:
+ Printer* mpPrinter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice;
+
+ sal_Int16 mnOrientation;
+ sal_Bool mbHorizontal;
+
+protected:
+
+public:
+ VCLXPrinterPropertySet( const String& rPrinterName );
+ ~VCLXPrinterPropertySet();
+
+ Printer* GetPrinter() const { return mpPrinter; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > GetDevice();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::setPropertyValue( rPropertyName, aValue ); }
+ ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return OPropertySetHelper::getPropertyValue( rPropertyName ); }
+ void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::addPropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::removePropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::addVetoableChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::removeVetoableChangeListener( rPropertyName, rxListener ); }
+
+ // ::cppu::OPropertySetHelper
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+ void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+ // ::com::sun::star::awt::XPrinterPropertySet
+ void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXPrinter
+// ----------------------------------------------------
+
+class VCLXPrinter: public ::com::sun::star::awt::XPrinter,
+ public VCLXPrinterPropertySet,
+ public ::cppu::OWeakObject
+{
+public:
+ VCLXPrinter( const String& rPrinterName );
+ ~VCLXPrinter();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::beans::XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertySetInfo(); }
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
+ ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
+ void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
+
+ // ::com::sun::star::awt::XPrinterPropertySet
+ void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getFormDescriptions(); }
+ void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getBinarySetup(); }
+ void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setBinarySetup( data ); }
+
+ // ::com::sun::star::awt::XPrinter
+ sal_Bool SAL_CALL start( const ::rtl::OUString& nJobName, sal_Int16 nCopies, sal_Bool nCollate ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL terminate( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXInfoPrinter
+// ----------------------------------------------------
+
+class VCLXInfoPrinter: public ::com::sun::star::awt::XInfoPrinter,
+ public VCLXPrinterPropertySet,
+ public ::cppu::OWeakObject
+{
+public:
+ VCLXInfoPrinter( const String& rPrinterName );
+ ~VCLXInfoPrinter();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::beans::XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertySetInfo(); }
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
+ ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
+ void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
+
+ // ::com::sun::star::awt::XPrinterPropertySet
+ void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getFormDescriptions(); }
+ void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getBinarySetup(); }
+ void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setBinarySetup( data ); }
+
+ // ::com::sun::star::awt::XInfoPrinter
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXPrinterServer
+// ----------------------------------------------------
+
+class VCLXPrinterServer : public ::com::sun::star::awt::XPrinterServer,
+ public ::cppu::OWeakObject
+{
+public:
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPrinterServer
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > SAL_CALL createPrinter( const ::rtl::OUString& printerName ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > SAL_CALL createInfoPrinter( const ::rtl::OUString& printerName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXPRINTER_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxregion.hxx b/toolkit/inc/toolkit/awt/vclxregion.hxx
new file mode 100644
index 000000000000..2c620a93ff18
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxregion.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxregion.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXREGION_HXX_
+#define _TOOLKIT_AWT_VCLXREGION_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XREGION_HPP_
+#include <com/sun/star/awt/XRegion.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <vcl/region.hxx>
+
+// ----------------------------------------------------
+// class VCLXRegion
+// ----------------------------------------------------
+
+class VCLXRegion : public ::com::sun::star::awt::XRegion,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ Region maRegion;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+public:
+ VCLXRegion();
+ ~VCLXRegion();
+
+ void SetRegion( const Region& rRegion ) { maRegion = rRegion; }
+ const Region& GetRegion() const { return maRegion; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXRegion* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XRegion
+ ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > SAL_CALL getRectangles() throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+
+
+#endif // _TOOLKIT_AWT_VCLXREGION_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx
new file mode 100644
index 000000000000..0cbd8472c0ba
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxsystemdependentwindow.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_
+#define _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XSYSTEMDEPENDENTWINDOWPEER_HPP_
+#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+// ----------------------------------------------------
+// class VCLXSystemDependendtWindow
+// ----------------------------------------------------
+
+class VCLXSystemDependentWindow : public ::com::sun::star::awt::XSystemDependentWindowPeer,
+ public VCLXWindow
+{
+public:
+ VCLXSystemDependentWindow();
+ ~VCLXSystemDependentWindow();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XSystemDependendtWindowPeer
+ ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx
new file mode 100644
index 000000000000..271f2b9f491f
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxtoolkit.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
+#define _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XTOOLKIT_HPP_
+#include <com/sun/star/awt/XToolkit.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+class Window;
+class VCLXWindow;
+
+namespace com {
+namespace sun {
+namespace star {
+namespace awt {
+ struct WindowDescriptor;
+} } } }
+
+// ----------------------------------------------------
+// class VCLXTOOLKIT
+// ----------------------------------------------------
+
+class VCLXToolkit : public ::com::sun::star::awt::XToolkit,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+public:
+
+ virtual Window* CreateComponent( VCLXWindow** ppNewComp,
+ const ::com::sun::star::awt::WindowDescriptor& rDescriptor, Window* pParent, sal_uInt32 nWinBits );
+
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XToolkit
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getWorkArea( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL createWindow( const ::com::sun::star::awt::WindowDescriptor& Descriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > SAL_CALL createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& Descriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > SAL_CALL createRegion( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
new file mode 100644
index 000000000000..cb52648d78fe
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxtopwindow.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
+#define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMENUBAR_HPP_
+#include <com/sun/star/awt/XMenuBar.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/awt/vclxcontainer.hxx>
+
+// ----------------------------------------------------
+// class VCLXTopWindow
+// ----------------------------------------------------
+
+class VCLXTopWindow : public ::com::sun::star::awt::XTopWindow,
+ public VCLXContainer
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar;
+
+public:
+ VCLXTopWindow();
+ ~VCLXTopWindow();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTopWindow
+ void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL toFront( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL toBack( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx
new file mode 100644
index 000000000000..6255f73986ee
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxwindow.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
+#define _TOOLKIT_AWT_VCLXWINDOW_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVIEW_HPP_
+#include <com/sun/star/awt/XView.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_
+#include <com/sun/star/awt/XPointer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XGraphics_HPP_
+#include <com/sun/star/awt/XGraphics.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/awt/vclxdevice.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <tools/gen.hxx> // Size
+
+class Window;
+
+// ----------------------------------------------------
+// class VCLXWINDOW
+// ----------------------------------------------------
+
+class VCLXWindow : public ::com::sun::star::awt::XWindow,
+ public ::com::sun::star::awt::XVclWindowPeer,
+ public ::com::sun::star::awt::XLayoutConstrains,
+ public ::com::sun::star::awt::XView,
+ public VCLXDevice
+{
+private:
+ EventListenerMultiplexer maEventListeners;
+ FocusListenerMultiplexer maFocusListeners;
+ WindowListenerMultiplexer maWindowListeners;
+ KeyListenerMultiplexer maKeyListeners;
+ MouseListenerMultiplexer maMouseListeners;
+ MouseMotionListenerMultiplexer maMouseMotionListeners;
+ PaintListenerMultiplexer maPaintListeners;
+ VclContainerListenerMultiplexer maContainerListeners;
+ TopWindowListenerMultiplexer maTopWindowListeners;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> mxPointer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> mxViewGraphics;
+
+ sal_Bool mbDisposing;
+ sal_Bool mbDesignMode;
+
+protected:
+ Size ImplCalcWindowSize( const Size& rOutSz ) const;
+
+public:
+ VCLXWindow();
+ ~VCLXWindow();
+
+ virtual void SetWindow( Window* pWindow );
+ Window* GetWindow() const { return (Window*)GetOutputDevice(); }
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> GetViewGraphics() const { return mxViewGraphics; }
+
+ EventListenerMultiplexer& GetEventListeners() { return maEventListeners; }
+ FocusListenerMultiplexer& GetFocusListeners() { return maFocusListeners; }
+ WindowListenerMultiplexer& GetWindowListeners() { return maWindowListeners; }
+ KeyListenerMultiplexer& GetKeyListeners() { return maKeyListeners; }
+ MouseListenerMultiplexer& GetMouseListeners() { return maMouseListeners; }
+ MouseMotionListenerMultiplexer& GetMouseMotionListeners() { return maMouseMotionListeners; }
+ PaintListenerMultiplexer& GetPaintListeners() { return maPaintListeners; }
+ VclContainerListenerMultiplexer& GetContainerListeners() { return maContainerListeners; }
+ TopWindowListenerMultiplexer& GetTopWindowListeners() { return maTopWindowListeners; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXWindow* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::Component
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFocus( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindowPeer
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > SAL_CALL getToolkit( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& Pointer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBackground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL invalidate( sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL invalidateRect( const ::com::sun::star::awt::Rectangle& Rect, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ sal_Bool SAL_CALL isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Peer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isDesignMode( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setForeground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setControlFont( const ::com::sun::star::awt::FontDescriptor& aFont ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException);
+
+
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXWINDOW_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
new file mode 100644
index 000000000000..514720987daa
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -0,0 +1,1093 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxwindows.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+#define _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_
+#include <com/sun/star/beans/PropertyValues.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HPP_
+#include <com/sun/star/beans/XVetoableChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HPP_
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATECHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFILEDIALOG_HPP_
+#include <com/sun/star/awt/XFileDialog.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTCOMPONENT_HPP_
+#include <com/sun/star/awt/XTextComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_
+#include <com/sun/star/awt/XListBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPROGRESSMONITOR_HPP_
+#include <com/sun/star/awt/XProgressMonitor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
+#include <com/sun/star/awt/TextAlign.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XSCROLLBAR_HPP_
+#include <com/sun/star/awt/XScrollBar.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMESSAGEBOX_HPP_
+#include <com/sun/star/awt/XMessageBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTEDITFIELD_HPP_
+#include <com/sun/star/awt/XTextEditField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_STYLE_HPP_
+#include <com/sun/star/awt/Style.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTIMEFIELD_HPP_
+#include <com/sun/star/awt/XTimeField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XSPINFIELD_HPP_
+#include <com/sun/star/awt/XSpinField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XNUMERICFIELD_HPP_
+#include <com/sun/star/awt/XNumericField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_
+#include <com/sun/star/awt/XButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_
+#include <com/sun/star/awt/XPointer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTAREA_HPP_
+#include <com/sun/star/awt/XTextArea.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XIMAGEBUTTON_HPP_
+#include <com/sun/star/awt/XImageButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFIXEDTEXT_HPP_
+#include <com/sun/star/awt/XFixedText.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDIALOG_HPP_
+#include <com/sun/star/awt/XDialog.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_SCROLLBARORIENTATION_HPP_
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XRADIOBUTTON_HPP_
+#include <com/sun/star/awt/XRadioButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCURRENCYFIELD_HPP_
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_
+#include <com/sun/star/awt/XPatternField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLER_HPP_
+#include <com/sun/star/awt/XTabController.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
+#include <com/sun/star/awt/XVclContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDATEFIELD_HPP_
+#include <com/sun/star/awt/XDateField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCOMBOBOX_HPP_
+#include <com/sun/star/awt/XComboBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCHECKBOX_HPP_
+#include <com/sun/star/awt/XCheckBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XIMAGECONSUMER_HPP_
+#include <com/sun/star/awt/XImageConsumer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MESSAGEBOXCOMMAND_HPP_
+#include <com/sun/star/awt/MessageBoxCommand.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPROGRESSBAR_HPP_
+#include <com/sun/star/awt/XProgressBar.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MENUITEMSTYLE_HPP_
+#include <com/sun/star/awt/MenuItemStyle.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPOPUPMENU_HPP_
+#include <com/sun/star/awt/XPopupMenu.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMENUBAR_HPP_
+#include <com/sun/star/awt/XMenuBar.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POPUPMENUDIRECTION_HPP_
+#include <com/sun/star/awt/PopupMenuDirection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MENUEVENT_HPP_
+#include <com/sun/star/awt/MenuEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMENULISTENER_HPP_
+#include <com/sun/star/awt/XMenuListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMENU_HPP_
+#include <com/sun/star/awt/XMenu.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxtopwindow.hxx>
+
+#include <vcl/pointr.hxx>
+#include <vcl/imgcons.hxx>
+#include <vcl/bitmapex.hxx>
+
+class Button;
+class CheckBox;
+class RadioButton;
+class ListBox;
+class ScrollBar;
+class Edit;
+class Menu;
+class ComboBox;
+class FormatterBase;
+class SpinField;
+
+
+static double ImplCalcLongValue( double nValue, sal_uInt16 nDigits )
+{
+ double n = nValue;
+ for ( sal_uInt16 d = 0; d < nDigits; d++ )
+ n *= 10;
+ return n;
+}
+
+static double ImplCalcDoubleValue( double nValue, sal_uInt16 nDigits )
+{
+ double n = nValue;
+ for ( sal_uInt16 d = 0; d < nDigits; d++ )
+ n /= 10;
+ return n;
+}
+
+// ----------------------------------------------------
+// class VCLXButton
+// ----------------------------------------------------
+class VCLXButton : public ::com::sun::star::awt::XImageConsumer,
+ public ::com::sun::star::awt::XButton,
+ public VCLXWindow
+{
+private:
+ ::rtl::OUString maActionCommand;
+ ImageConsumer maImageConsumer;
+ BitmapEx maBitmap;
+ ActionListenerMultiplexer maActionListeners;
+
+protected:
+ DECL_LINK( ClickHdl, Button* );
+ void ImplUpdateImage( sal_Bool bGetNewImage );
+
+public:
+ VCLXButton();
+ ~VCLXButton();
+
+ void SetWindow( Window* pWindow );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton:
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XImageConsumer
+ void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXImageControl
+// ----------------------------------------------------
+class VCLXImageControl : public ::com::sun::star::awt::XImageConsumer,
+ public VCLXWindow
+{
+ ImageConsumer maImageConsumer;
+ BitmapEx maBitmap;
+
+protected:
+ void ImplUpdateImage( sal_Bool bGetNewImage );
+
+public:
+ VCLXImageControl();
+ ~VCLXImageControl();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XImageConsumer
+ void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXCheckBox
+// ----------------------------------------------------
+class VCLXCheckBox : public ::com::sun::star::awt::XCheckBox,
+ public VCLXWindow
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ DECL_LINK( ClickHdl, CheckBox* );
+
+public:
+ VCLXCheckBox();
+ ~VCLXCheckBox();
+
+ void SetWindow( Window* pWindow );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XCheckBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Int16 n ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXRadioButton
+// ----------------------------------------------------
+class VCLXRadioButton : public ::com::sun::star::awt::XRadioButton,
+ public VCLXWindow
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ DECL_LINK( ClickHdl, RadioButton* );
+
+public:
+ VCLXRadioButton();
+ ~VCLXRadioButton();
+
+ void SetWindow( Window* pWindow );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XRadioButton
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXMessageBox
+// ----------------------------------------------------
+class VCLXMessageBox : public ::com::sun::star::awt::XMessageBox,
+ public VCLXWindow
+{
+public:
+ VCLXMessageBox();
+ ~VCLXMessageBox();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XMessageBox
+ void SAL_CALL setCaptionText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getCaptionText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMessageText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getMessageText( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+// ----------------------------------------------------
+// class VCLXDialog
+// ----------------------------------------------------
+class VCLXDialog : public ::com::sun::star::awt::XDialog,
+ public VCLXTopWindow
+{
+public:
+ VCLXDialog();
+ ~VCLXDialog();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDialog
+ void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getTitle( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL endExecute( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXFixedText
+// ----------------------------------------------------
+class VCLXFixedText : public ::com::sun::star::awt::XFixedText,
+ public VCLXWindow
+{
+public:
+ VCLXFixedText();
+ ~VCLXFixedText();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XFixedText
+ void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXScrollBar
+// ----------------------------------------------------
+class VCLXScrollBar : public ::com::sun::star::awt::XScrollBar,
+ public VCLXWindow
+{
+private:
+ AdjustmentListenerMultiplexer maAdjustmentListeners;
+
+protected:
+ DECL_LINK( ScrollHdl, ScrollBar* );
+
+public:
+ VCLXScrollBar();
+ ~VCLXScrollBar();
+
+ void SetWindow( Window* pWindow );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XScrollbar
+ void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMaximum( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLineIncrement( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getBlockIncrement( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getVisibleSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getOrientation( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXEdit
+// ----------------------------------------------------
+class VCLXEdit : public ::com::sun::star::awt::XTextComponent,
+ public ::com::sun::star::awt::XTextEditField,
+ public ::com::sun::star::awt::XTextLayoutConstrains,
+ public VCLXWindow
+{
+private:
+ TextListenerMultiplexer maTextListeners;
+
+protected:
+ DECL_LINK( ModifyHdl, Edit* );
+
+public:
+ VCLXEdit();
+ ~VCLXEdit();
+
+ void SetWindow( Window* pWindow );
+ TextListenerMultiplexer& GetTextListeners() { return maTextListeners; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextComponent
+ void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertText( const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Selection SAL_CALL getSelection( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEditable( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getMaxTextLen( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextEditField:
+ void SAL_CALL setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXListBox
+// ----------------------------------------------------
+class VCLXListBox : public ::com::sun::star::awt::XListBox,
+ public ::com::sun::star::awt::XTextLayoutConstrains,
+ public VCLXWindow
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ DECL_LINK( SelectHdl, ListBox* );
+ DECL_LINK( DoubleClickHdl, ListBox* );
+
+public:
+ VCLXListBox();
+ ~VCLXListBox();
+
+ void SetWindow( Window* pWindow );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XListBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getSelectedItemPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedItem( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemsPos( const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isMutipleMode( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXComboBox
+// ----------------------------------------------------
+class VCLXComboBox : public ::com::sun::star::awt::XComboBox,
+ public VCLXEdit
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ DECL_LINK( SelectHdl, ComboBox* );
+ DECL_LINK( DoubleClickHdl, ComboBox* );
+
+public:
+ VCLXComboBox();
+ ~VCLXComboBox();
+
+ void SetWindow( Window* pWindow );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XComboBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXSpinField
+// ----------------------------------------------------
+class VCLXSpinField : public ::com::sun::star::awt::XSpinField,
+ public VCLXEdit
+{
+private:
+ SpinListenerMultiplexer maSpinListeners;
+
+protected:
+ DECL_LINK( SpinUpHdl, SpinField* );
+ DECL_LINK( SpinDownHdl, SpinField* );
+ DECL_LINK( SpinFirstHdl, SpinField* );
+ DECL_LINK( SpinLastHdl, SpinField* );
+
+public:
+ VCLXSpinField();
+ ~VCLXSpinField();
+
+ void SetWindow( Window* pWindow );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XSpinField
+ void SAL_CALL addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL up( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL down( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL first( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL last( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXFormattedSpinField
+// ----------------------------------------------------
+class VCLXFormattedSpinField : public VCLXSpinField
+{
+private:
+ FormatterBase* mpFormatter;
+
+protected:
+ FormatterBase* GetFormatter() const { return GetWindow() ? mpFormatter : NULL; }
+
+public:
+ VCLXFormattedSpinField();
+ ~VCLXFormattedSpinField();
+
+ void SetFormatter( FormatterBase* pFormatter ) { mpFormatter = pFormatter; }
+
+ void setStrictFormat( sal_Bool bStrict );
+ sal_Bool isStrictFormat();
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXDateField
+// ----------------------------------------------------
+class VCLXDateField : public ::com::sun::star::awt::XDateField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXDateField();
+ ~VCLXDateField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XDateField
+ void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXTimeField
+// ----------------------------------------------------
+class VCLXTimeField : public ::com::sun::star::awt::XTimeField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXTimeField();
+ ~VCLXTimeField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTimeField
+ void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXNumericField
+// ----------------------------------------------------
+class VCLXNumericField : public ::com::sun::star::awt::XNumericField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXNumericField();
+ ~VCLXNumericField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XNumericField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXCurrencyField
+// ----------------------------------------------------
+class VCLXCurrencyField : public ::com::sun::star::awt::XCurrencyField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXCurrencyField();
+ ~VCLXCurrencyField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XCurrencyField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXPatternField
+// ----------------------------------------------------
+class VCLXPatternField : public ::com::sun::star::awt::XPatternField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXPatternField();
+ ~VCLXPatternField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XPatternField
+ void SAL_CALL setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getString( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+#endif // _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/stdtabcontroller.hxx b/toolkit/inc/toolkit/controls/stdtabcontroller.hxx
new file mode 100644
index 000000000000..ed21f93c80c4
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/stdtabcontroller.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdtabcontroller.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_
+#define _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLER_HPP_
+#include <com/sun/star/awt/XTabController.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWINDOW.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+class StdTabController : public ::com::sun::star::awt::XTabController,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ::osl::Mutex maMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > mxModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > mxControlContainer;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+ sal_Bool ImplCreateComponentSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rModels, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& rComponents, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>* pTabStops, sal_Bool bPeerComponent ) const;
+ // wenn rModels kuerzer als rControls ist, werden nur die rModels entsprechenden Elemente geliefert und die korrespondierenden Elemente aus rControls entfernt
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > ImplFindControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rxCtrlModel ) const;
+ void ImplActivateControl( sal_Bool bFirst ) const;
+
+public:
+ StdTabController();
+ ~StdTabController();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XTabController
+ void SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > SAL_CALL getModel( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& Container ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SAL_CALL getContainer( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL autoTabOrder( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activateTabOrder( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activateFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activateLast( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+#endif // _TOOLKIT_AWT_STDTABCONTROLLER_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx
new file mode 100644
index 000000000000..128357467902
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdtabcontrollermodel.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
+#define _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
+
+
+#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
+#include <com/sun/star/io/XPersistObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <tools/list.hxx>
+#include <tools/gen.hxx>
+
+struct UnoControlModelEntry;
+
+DECLARE_LIST( UnoControlModelEntryListBase, UnoControlModelEntry* );
+
+class UnoControlModelEntryList : public UnoControlModelEntryListBase
+{
+private:
+ ::rtl::OUString maGroupName;
+
+public:
+ UnoControlModelEntryList();
+ ~UnoControlModelEntryList();
+
+ const ::rtl::OUString& GetName() const { return maGroupName; }
+ void SetName( const ::rtl::OUString& rName ) { maGroupName = rName; }
+
+ void Reset();
+ void DestroyEntry( sal_uInt32 nEntry );
+};
+
+struct UnoControlModelEntry
+{
+ sal_Bool bGroup;
+ union
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >* pxControl;
+ UnoControlModelEntryList* pGroup;
+ };
+};
+
+// Keine Referenz halten, nur temporaer fuer AutoTabOrder
+struct ComponentEntry
+{
+ ::com::sun::star::awt::XWindow* pComponent;
+ Point aPos;
+};
+
+DECLARE_LIST( ComponentEntryList, ComponentEntry* );
+
+#define CONTROLPOS_NOTFOUND 0xFFFFFFFF
+
+class StdTabControllerModel : public ::com::sun::star::awt::XTabControllerModel,
+ public ::com::sun::star::io::XPersistObject,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ::osl::Mutex maMutex;
+ UnoControlModelEntryList maControls;
+ sal_Bool mbGroupControl;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+ sal_uInt32 ImplGetControlCount( const UnoControlModelEntryList& rList ) const;
+ void ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** pRefs, const UnoControlModelEntryList& rList ) const;
+ void ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const;
+ sal_uInt32 ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const;
+
+public:
+ StdTabControllerModel();
+ ~StdTabControllerModel();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTabControllerModel
+ sal_Bool SAL_CALL getGroupControl( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getGroupCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+
+
+#endif // _TOOLKIT_HELPER_STDTABCONTROLLERMODEL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx
new file mode 100644
index 000000000000..6a2b88224ba3
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrol.hxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrol.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
+#define _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XView_HPP_
+#include <com/sun/star/awt/XView.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+
+struct UnoControlComponentInfos
+{
+ sal_Bool bVisible;
+ sal_Bool bEnable;
+ long nX, nY, nWidth, nHeight;
+ sal_uInt16 nFlags;
+ float nZoomX, nZoomY;
+
+ UnoControlComponentInfos()
+ {
+ bVisible = sal_True;
+ bEnable = sal_True;
+ nX = nY = nWidth = nHeight = 0;
+ nFlags = 0; // POSSIZE_POSSIZE;
+ nZoomX = nZoomY = 1.0f;
+ }
+};
+
+// ----------------------------------------------------
+// class UnoControl
+// ----------------------------------------------------
+class UnoControl : public ::com::sun::star::awt::XControl,
+ public ::com::sun::star::awt::XWindow,
+ public ::com::sun::star::awt::XView,
+ public ::com::sun::star::beans::XPropertiesChangeListener,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ::osl::Mutex maMutex;
+
+protected:
+ EventListenerMultiplexer maDisposeListeners;
+ WindowListenerMultiplexer maWindowListeners;
+ FocusListenerMultiplexer maFocusListeners;
+ KeyListenerMultiplexer maKeyListeners;
+ MouseListenerMultiplexer maMouseListeners;
+ MouseMotionListenerMultiplexer maMouseMotionListeners;
+ PaintListenerMultiplexer maPaintListeners;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxPeer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > mxModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > mxGraphics;
+
+ sal_Bool mbDisposePeer;
+ sal_Bool mbUpdatingModel;
+ sal_Bool mbRefeshingPeer;
+ sal_Bool mbDesignMode;
+
+ UnoControlComponentInfos maComponentInfos;
+
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParentPeer() const;
+ void updateFromModel();
+ sal_Bool IsUpdatingModel() const { return mbUpdatingModel; }
+ void StartUpdatingModel() { mbUpdatingModel = sal_True; }
+ void EndUpdatingModel() { mbUpdatingModel = sal_False; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer );
+ virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+ virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
+
+public:
+ UnoControl();
+ ~UnoControl();
+
+ virtual ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::uno::XAggregation
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::beans::XPropertiesChangeListener
+ void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFocus( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Context ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isDesignMode( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolbase.hxx b/toolkit/inc/toolkit/controls/unocontrolbase.hxx
new file mode 100644
index 000000000000..72c77fb3c9b0
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolbase.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolbase.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
+#define _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
+
+#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_
+#include <com/sun/star/awt/Size.hpp>
+#endif
+
+#include <toolkit/controls/unocontrol.hxx>
+
+// ----------------------------------------------------
+// class UnoControlBase
+// ----------------------------------------------------
+
+class UnoControlBase : public UnoControl
+{
+protected:
+ sal_Bool ImplHasProperty( const ::rtl::OUString& aPropertyName );
+ void ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis );
+ ::com::sun::star::uno::Any ImplGetPropertyValue( const ::rtl::OUString& aPropertyName );
+
+ sal_Bool ImplGetPropertyValue_BOOL( sal_uInt16 nProp );
+ sal_Int16 ImplGetPropertyValue_INT16( sal_uInt16 nProp );
+ sal_uInt16 ImplGetPropertyValue_UINT16( sal_uInt16 nProp );
+ sal_Int32 ImplGetPropertyValue_INT32( sal_uInt16 nProp );
+ sal_uInt32 ImplGetPropertyValue_UINT32( sal_uInt16 nProp );
+ double ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp );
+ ::rtl::OUString ImplGetPropertyValue_UString( sal_uInt16 nProp );
+
+ // XLayoutConstrains (nur wenn das Control es unterstuetzt!)
+ ::com::sun::star::awt::Size Impl_getMinimumSize();
+ ::com::sun::star::awt::Size Impl_getPreferredSize();
+ ::com::sun::star::awt::Size Impl_calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize );
+
+ // XTextLayoutConstrains (nur wenn das Control es unterstuetzt!)
+ ::com::sun::star::awt::Size Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines );
+ void Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines );
+};
+
+
+
+#endif // _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
new file mode 100644
index 000000000000..a0c2b2680b7c
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolcontainer.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
+#define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
+
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
+#include <com/sun/star/container/XContainer.hpp>
+#endif
+
+#include <toolkit/controls/unocontrol.hxx>
+
+class UnoControlHolderList;
+
+// ----------------------------------------------------
+// class UnoControlContainer
+// ----------------------------------------------------
+class UnoControlContainer : public ::com::sun::star::awt::XUnoControlContainer,
+ public ::com::sun::star::awt::XControlContainer,
+ public ::com::sun::star::container::XContainer,
+ public UnoControl
+{
+private:
+ UnoControlHolderList* mpControls;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > maTabControllers;
+ ContainerListenerMultiplexer maCListeners;
+
+protected:
+ void ImplActivateTabControllers();
+
+public:
+ UnoControlContainer();
+ UnoControlContainer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer );
+ ~UnoControlContainer();
+
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControl::queryInterface(rType); }
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XEventListener
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControlContainer
+ void SAL_CALL setStatusText( const ::rtl::OUString& StatusText ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addControl( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XUnoControlContainer
+ void SAL_CALL setTabControllers( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > >& TabControllers ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > SAL_CALL getTabControllers( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+#endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx
new file mode 100644
index 000000000000..22efa42e98fe
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolcontainermodel.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_
+#define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_
+
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+
+// ----------------------------------------------------
+// class ::com::sun::star::awt::UnoControlContainerModel
+// ----------------------------------------------------
+class UnoControlContainerModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlContainerModel();
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlContainerModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainerModel ) )
+};
+
+
+
+#endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
new file mode 100644
index 000000000000..f053206fd49e
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolmodel.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_
+#define _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
+#include <com/sun/star/io/XPersistObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAKAGG_HXX_
+#include <cppuhelper/weakagg.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+class ImplPropertyTable;
+
+// ----------------------------------------------------
+// class UnoControlModel
+// ----------------------------------------------------
+
+class UnoControlModel : public ::com::sun::star::awt::XControlModel,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::io::XPersistObject,
+ public ::com::sun::star::lang::XComponent,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public MutexAndBroadcastHelper,
+ public ::cppu::OPropertySetHelper,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ImplPropertyTable* mpData;
+ EventListenerMultiplexer maDisposeListeners;
+
+protected:
+ void ImplRegisterProperty( sal_uInt16 nPropType );
+ void ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault );
+ ::com::sun::star::uno::Sequence<sal_Int32> ImplGetPropertyIds() const;
+ virtual void ImplPropertyChanged( sal_uInt16 nPropId );
+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const;
+
+public:
+ UnoControlModel();
+ ~UnoControlModel();
+
+ // ::com::sun::star::uno::XAggregation
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static UnoControlModel* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::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::XControlModel
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyState
+ ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::cppu::OPropertySetHelper
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0;
+ sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+ void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+ // setValue-Methoden ueberladen, um die Einzelproperties des FontDescriptors abzufangen
+ // ::com::sun::star::beans::XPropertySet
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::beans::XFastPropertySet
+ void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) = 0;
+ void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
new file mode 100644
index 000000000000..bf65df79bb8d
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -0,0 +1,1166 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrols.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_UNOCONTROLS_HXX_
+#define _TOOLKIT_HELPER_UNOCONTROLS_HXX_
+
+#ifndef _COM_SUN_STAR_AWT_XTEXTCOMPONENT_HPP_
+#include <com/sun/star/awt/XTextComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLISTENER_HPP_
+#include <com/sun/star/awt/XTextListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_
+#include <com/sun/star/awt/XButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XIMAGECONSUMER_HPP_
+#include <com/sun/star/awt/XImageConsumer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XIMAGEPRODUCER_HPP_
+#include <com/sun/star/awt/XImageProducer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XRADIOBUTTON_HPP_
+#include <com/sun/star/awt/XRadioButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_
+#include <com/sun/star/awt/XItemListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCHECKBOX_HPP_
+#include <com/sun/star/awt/XCheckBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFIXEDTEXT_HPP_
+#include <com/sun/star/awt/XFixedText.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_
+#include <com/sun/star/awt/XListBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCOMBOBOX_HPP_
+#include <com/sun/star/awt/XComboBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDATEFIELD_HPP_
+#include <com/sun/star/awt/XDateField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTIMEFIELD_HPP_
+#include <com/sun/star/awt/XTimeField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XNUMERICFIELD_HPP_
+#include <com/sun/star/awt/XNumericField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCURRENCYFIELD_HPP_
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_
+#include <com/sun/star/awt/XPatternField.hpp>
+#endif
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+#include <vcl/imgcons.hxx>
+#include <vcl/bitmapex.hxx>
+
+// ----------------------------------------------------
+// class UnoControlEditModel
+// ----------------------------------------------------
+class UnoControlEditModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlEditModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlEditModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ) )
+};
+
+// ----------------------------------------------------
+// class UnoEditControl
+// ----------------------------------------------------
+class UnoEditControl : public UnoControlBase,
+ public ::com::sun::star::awt::XTextComponent,
+ public ::com::sun::star::awt::XTextListener,
+ public ::com::sun::star::awt::XLayoutConstrains,
+ public ::com::sun::star::awt::XTextLayoutConstrains
+{
+private:
+ TextListenerMultiplexer maTextListeners;
+
+public:
+
+ UnoEditControl();
+ ::rtl::OUString GetComponentServiceName();
+ TextListenerMultiplexer& GetTextListeners() { return maTextListeners; }
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextComponent
+ void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertText( const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Selection SAL_CALL getSelection( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEditable( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getMaxTextLen( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoEditControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEdit ) )
+};
+
+// ----------------------------------------------------
+// class UnoControlFormattedFieldModel
+// ----------------------------------------------------
+class UnoControlFormattedFieldModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlFormattedFieldModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlFormattedFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ) )
+};
+
+// ----------------------------------------------------
+// class UnoFormattedFieldControl
+// ----------------------------------------------------
+class UnoFormattedFieldControl : public UnoEditControl
+{
+public:
+ UnoFormattedFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoFormattedFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedField ) )
+};
+
+// ----------------------------------------------------
+// class UnoControlFileControlModel
+// ----------------------------------------------------
+class UnoControlFileControlModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlFileControlModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlFileControlModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel ) )
+};
+
+// ----------------------------------------------------
+// class UnoFileControl
+// ----------------------------------------------------
+class UnoFileControl : public UnoEditControl
+{
+public:
+ UnoFileControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoFileControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControl ) )
+};
+
+// ----------------------------------------------------
+// class UnoControlButtonModel
+// ----------------------------------------------------
+class UnoControlButtonModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlButtonModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlButtonModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel ) )
+};
+
+// ----------------------------------------------------
+// class UnoButtonControl
+// ----------------------------------------------------
+class UnoButtonControl : public UnoControlBase,
+ public ::com::sun::star::awt::XButton,
+ public ::com::sun::star::awt::XImageConsumer,
+ public ::com::sun::star::awt::XImageProducer,
+ public ::com::sun::star::awt::XLayoutConstrains
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+ ImageConsumer maImageConsumer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > mxImageProducer;
+ BitmapEx maBitmap;
+
+protected:
+ void ImplUpdateImage( sal_Bool bGetNewImage );
+
+public:
+
+ UnoButtonControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XImageConsumer
+ void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XImageProducer
+ void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL startProduction( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoButtonControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButton ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlImageControlModel
+// ----------------------------------------------------
+class UnoControlImageControlModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlImageControlModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel ) )
+};
+
+// ----------------------------------------------------
+// class UnoImageControlControl
+// ----------------------------------------------------
+class UnoImageControlControl : public UnoControlBase,
+ public ::com::sun::star::awt::XImageConsumer,
+ public ::com::sun::star::awt::XImageProducer,
+ public ::com::sun::star::awt::XLayoutConstrains
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+ ImageConsumer maImageConsumer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > mxImageProducer;
+ BitmapEx maBitmap;
+
+protected:
+ void ImplUpdateImage( sal_Bool bGetNewImage );
+
+public:
+
+ UnoImageControlControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XImageConsumer
+ void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XImageProducer
+ void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL startProduction( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControl ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlRadioButtonModel
+// ----------------------------------------------------
+class UnoControlRadioButtonModel : public UnoControlModel
+
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlRadioButtonModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlRadioButtonModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoRadioButtonControl
+// ----------------------------------------------------
+class UnoRadioButtonControl : public UnoControlBase,
+ public ::com::sun::star::awt::XRadioButton,
+ public ::com::sun::star::awt::XItemListener,
+ public ::com::sun::star::awt::XLayoutConstrains
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ::rtl::OUString maLabel;
+
+public:
+
+ UnoRadioButtonControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XRadioButton
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XItemListener
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoRadioButtonControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButton ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlCheckBoxModel
+// ----------------------------------------------------
+class UnoControlCheckBoxModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlCheckBoxModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlCheckBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel ) )
+};
+
+// ----------------------------------------------------
+// class UnoCheckBoxControl
+// ----------------------------------------------------
+class UnoCheckBoxControl : public UnoControlBase,
+ public ::com::sun::star::awt::XCheckBox,
+ public ::com::sun::star::awt::XItemListener,
+ public ::com::sun::star::awt::XLayoutConstrains
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ::rtl::OUString maLabel;
+
+public:
+
+ UnoCheckBoxControl();
+ ~UnoCheckBoxControl(){;}
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XCheckBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Int16 n ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XItemListener
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoCheckBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBox ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlFixedTextModel
+// ----------------------------------------------------
+class UnoControlFixedTextModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlFixedTextModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlFixedTextModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoFixedTextControl
+// ----------------------------------------------------
+class UnoFixedTextControl : public UnoControlBase,
+ public ::com::sun::star::awt::XFixedText,
+ public ::com::sun::star::awt::XLayoutConstrains
+{
+public:
+ UnoFixedTextControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XFixedText
+ void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoFixedTextControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedText ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlGroupBoxModel
+// ----------------------------------------------------
+class UnoControlGroupBoxModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlGroupBoxModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlGroupBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoGroupBoxControl
+// ----------------------------------------------------
+class UnoGroupBoxControl : public UnoControlBase
+{
+public:
+ UnoGroupBoxControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoGroupBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBox ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlListBoxModel
+// ----------------------------------------------------
+class UnoControlListBoxModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlListBoxModel();
+ ::rtl::OUString getServiceName() const;
+
+ void ImplPropertyChanged( sal_uInt16 nPropId );
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlListBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoListBoxControl
+// ----------------------------------------------------
+class UnoListBoxControl : public UnoControlBase,
+ public ::com::sun::star::awt::XListBox,
+ public ::com::sun::star::awt::XItemListener,
+ public ::com::sun::star::awt::XLayoutConstrains,
+ public ::com::sun::star::awt::XTextLayoutConstrains
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+public:
+
+ UnoListBoxControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+
+ // ::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::XListBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getSelectedItemPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedItem( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemsPos( const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isMutipleMode( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XItemListener
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoListBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBox ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlComboBoxModel
+// ----------------------------------------------------
+class UnoControlComboBoxModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlComboBoxModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlComboBoxModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoComboBoxControl
+// ----------------------------------------------------
+class UnoComboBoxControl : public UnoEditControl,
+ public ::com::sun::star::awt::XComboBox
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+public:
+
+ UnoComboBoxControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XComboBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoComboBoxControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBox ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlDateFieldModel
+// ----------------------------------------------------
+class UnoControlDateFieldModel: public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlDateFieldModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlDateFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoDateFieldControl
+// ----------------------------------------------------
+class UnoDateFieldControl : public UnoEditControl,
+ public ::com::sun::star::awt::XDateField
+{
+public:
+ UnoDateFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XDateField
+ void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoDateFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateField ) )
+};
+
+// ----------------------------------------------------
+// class UnoControlTimeFieldModel
+// ----------------------------------------------------
+class UnoControlTimeFieldModel: public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlTimeFieldModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlTimeFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoTimeFieldControl
+// ----------------------------------------------------
+class UnoTimeFieldControl : public UnoEditControl,
+ public ::com::sun::star::awt::XTimeField
+{
+public:
+ UnoTimeFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTimeField
+ void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoTimeFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeField ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlNumericFieldModel
+// ----------------------------------------------------
+class UnoControlNumericFieldModel: public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlNumericFieldModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlNumericFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoNumericFieldControl
+// ----------------------------------------------------
+class UnoNumericFieldControl : public UnoEditControl,
+ public ::com::sun::star::awt::XNumericField
+{
+public:
+ UnoNumericFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XNumericField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoNumericFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericField ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlCurrencyFieldModel
+// ----------------------------------------------------
+class UnoControlCurrencyFieldModel: public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlCurrencyFieldModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlCurrencyFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoCurrencyFieldControl
+// ----------------------------------------------------
+class UnoCurrencyFieldControl : public UnoEditControl,
+ public ::com::sun::star::awt::XCurrencyField
+{
+public:
+ UnoCurrencyFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XCurrencyField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoCurrencyFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyField ) )
+};
+
+// ----------------------------------------------------
+// class UnoControlPatternFieldModel
+// ----------------------------------------------------
+class UnoControlPatternFieldModel: public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlPatternFieldModel();
+ ::rtl::OUString getServiceName() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlPatternFieldModel, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel ) )
+
+};
+
+// ----------------------------------------------------
+// class UnoPatternFieldControl
+// ----------------------------------------------------
+class UnoPatternFieldControl : public UnoEditControl,
+ public ::com::sun::star::awt::XPatternField
+{
+protected:
+ void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+
+public:
+ UnoPatternFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPatternField
+ void SAL_CALL setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getString( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoPatternFieldControl, ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternField ) )
+
+};
+
+
+
+#endif // _TOOLKIT_HELPER_UNOCONTROLS_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/convert.hxx b/toolkit/inc/toolkit/helper/convert.hxx
new file mode 100644
index 000000000000..58284c01d71a
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/convert.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * $RCSfile: convert.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_CONVERT_HXX_
+#define _TOOLKIT_HELPER_CONVERT_HXX_
+
+#ifndef _COM_SUN_STAR_AWT_RECTANGLE_HPP_
+#include <com/sun/star/awt/Rectangle.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_
+#include <com/sun/star/awt/Size.hpp>
+#endif
+
+#include <tools/gen.hxx>
+
+inline ::com::sun::star::awt::Size AWTSize( const Size& rVCLSize )
+{
+ return ::com::sun::star::awt::Size( rVCLSize.Width(), rVCLSize.Height() );
+}
+
+inline Size VCLSize( const ::com::sun::star::awt::Size& rAWTSize )
+{
+ return Size( rAWTSize.Width, rAWTSize.Height );
+}
+
+inline ::com::sun::star::awt::Rectangle AWTRectangle( const Rectangle& rVCLRect )
+{
+ return ::com::sun::star::awt::Rectangle( rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), rVCLRect.GetHeight() );
+}
+
+inline Rectangle VCLRectangle( const ::com::sun::star::awt::Rectangle& rAWTRect )
+{
+ return Rectangle( rAWTRect.X, rAWTRect.Y, rAWTRect.X+rAWTRect.Width, rAWTRect.Y+rAWTRect.Height );
+}
+
+
+#endif // _TOOLKIT_HELPER_CONVERT_HXX_
diff --git a/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx b/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx
new file mode 100644
index 000000000000..96821f4c327f
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * $RCSfile: emptyfontdescriptor.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_
+#define _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_
+
+#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_
+#include <com/sun/star/awt/FontSlant.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_
+#include <com/sun/star/awt/FontUnderline.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#endif
+
+// ----------------------------------------------------
+// class EmptyFontDescriptor
+// ----------------------------------------------------
+class EmptyFontDescriptor : public ::com::sun::star::awt::FontDescriptor
+{
+public:
+ EmptyFontDescriptor()
+ {
+ // Not all enums are initialized correctly in FontDescriptor-CTOR because
+ // they are set to the first enum value, this is not allways the default value.
+ Slant = ::com::sun::star::awt::FontSlant_DONTKNOW;
+ Underline = ::com::sun::star::awt::FontUnderline::DONTKNOW;
+ Strikeout = ::com::sun::star::awt::FontStrikeout::DONTKNOW;
+ }
+};
+
+
+
+
+#endif // _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
new file mode 100644
index 000000000000..84f15e728eb9
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * $RCSfile: listenermultiplexer.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
+#define _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
+
+
+#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
+#include <com/sun/star/lang/XEventListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
+#include <com/sun/star/awt/XFocusListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERLISTENER_HPP_
+#include <com/sun/star/awt/XVclContainerListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_
+#include <com/sun/star/awt/XKeyListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
+#include <com/sun/star/awt/XMouseListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_
+#include <com/sun/star/awt/XMouseMotionListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_
+#include <com/sun/star/awt/XPaintListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLISTENER_HPP_
+#include <com/sun/star/awt/XTextListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XACTIONLISTENER_HPP_
+#include <com/sun/star/awt/XActionListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_
+#include <com/sun/star/awt/XItemListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
+#include <com/sun/star/container/XContainerListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XSPINLISTENER_HPP_
+#include <com/sun/star/awt/XSpinListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XADJUSTMENTLISTENER_HPP_
+#include <com/sun/star/awt/XAdjustmentListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMENULISTENER_HPP_
+#include <com/sun/star/awt/XMenuListener.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _TOOLKIT_HELPER_MUTEXHELPER_HXX_
+#include <toolkit/helper/mutexhelper.hxx>
+#endif
+
+#ifndef _TOOLKIT_HELPER_MACROS_HXX_
+#include <toolkit/helper/macros.hxx>
+#endif
+
+// ----------------------------------------------------
+// class ListenerMultiplexerBase
+// ----------------------------------------------------
+
+class ListenerMultiplexerBase : public MutexHelper,
+ public ::cppu::OInterfaceContainerHelper,
+ public ::com::sun::star::uno::XInterface
+{
+private:
+ ::cppu::OWeakObject& mrContext;
+
+protected:
+ ::cppu::OWeakObject& GetContext() { return mrContext; }
+
+public:
+ ListenerMultiplexerBase( ::cppu::OWeakObject& rSource );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { mrContext.acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { mrContext.release(); }
+};
+
+
+// ----------------------------------------------------
+// class EventListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer, ::com::sun::star::lang::XEventListener )
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class FocusListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener )
+ void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+
+// ----------------------------------------------------
+// class WindowListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener )
+ void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+
+
+// ----------------------------------------------------
+// class VclContainerListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener )
+ void SAL_CALL windowAdded( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowRemoved( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class KeyListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener )
+ void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class MouseListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
+ void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class MouseMotionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener )
+ void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class PaintListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener )
+ void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TopWindowListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener )
+ void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TextListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener )
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class ActionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener )
+ void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class ItemListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener )
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class ContainerListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
+ void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class SpinListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener )
+ void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class AdjustmentListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener )
+ void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class MenuListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener )
+ void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+
+
+
+#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/macros.hxx b/toolkit/inc/toolkit/helper/macros.hxx
new file mode 100644
index 000000000000..27c1dc081626
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/macros.hxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * $RCSfile: macros.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_MACROS_HXX_
+#define _TOOLKIT_HELPER_MACROS_HXX_
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_XUNOTUNNEL( ClassName ) \
+sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ if( ( rIdentifier.getLength() == 16 ) && ( 0 == rtl_compareMemory( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \
+ { \
+ return (sal_Int64)this; \
+ } \
+ return 0; \
+} \
+const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::GetUnoTunnelId() throw() \
+{ \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL; \
+ if( !pSeq ) \
+ { \
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if( !pSeq ) \
+ { \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \
+ pSeq = &aSeq; \
+ } \
+ } \
+ return *pSeq; \
+} \
+ClassName* ClassName::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw() \
+{ \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( rxIFace, ::com::sun::star::uno::UNO_QUERY ); \
+ return xUT.is() ? (ClassName*)xUT->getSomething( ClassName::GetUnoTunnelId() ) : NULL; \
+}
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_XTYPEPROVIDER_START( ClassName ) \
+::com::sun::star::uno::Sequence< sal_Int8 > ClassName::getImplementationId() throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ static ::cppu::OImplementationId* pId = NULL; \
+ if( !pId ) \
+ { \
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if( ! pId ) \
+ { \
+ static ::cppu::OImplementationId id( sal_False ); \
+ pId = &id; \
+ } \
+ } \
+ return (*pId).getImplementationId(); \
+} \
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > ClassName::getTypes() throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ static ::cppu::OTypeCollection* pCollection = NULL; \
+ if( !pCollection ) \
+ { \
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if( !pCollection ) \
+ { \
+ static ::cppu::OTypeCollection collection(
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_XTYPEPROVIDER_END \
+ ); \
+ pCollection = &collection; \
+ } \
+ } \
+ return (*pCollection).getTypes(); \
+}
+
+// -------------------------------------------------------------------------------------
+
+#define DECL_LISTENERMULTIPLEXER_START( ClassName, InterfaceName ) \
+class ClassName : public ListenerMultiplexerBase, public InterfaceName \
+{ \
+public: \
+ ClassName( ::cppu::OWeakObject& rSource ); \
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); \
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { ListenerMultiplexerBase::acquire(); } \
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { ListenerMultiplexerBase::release(); } \
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+// -------------------------------------------------------------------------------------
+
+#define DECL_LISTENERMULTIPLEXER_END \
+};
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ClassName, InterfaceName ) \
+ClassName::ClassName( ::cppu::OWeakObject& rSource ) \
+ : ListenerMultiplexerBase( rSource ) \
+{ \
+} \
+::com::sun::star::uno::Any ClassName::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, \
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ), \
+ SAL_STATIC_CAST( InterfaceName*, this ) ); \
+ return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); \
+} \
+void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+}
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ClassName, InterfaceName, MethodName, EventType ) \
+void ClassName::MethodName( const EventType& e ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ EventType aMulti( e ); \
+ aMulti.Source = &GetContext(); \
+ ::cppu::OInterfaceIteratorHelper aIt( *this ); \
+ while( aIt.hasMoreElements() ) \
+ ((InterfaceName*)aIt.next())->MethodName( aMulti ); \
+}
+
+// -------------------------------------------------------------------------------------
+
+#define DECLIMPL_SERVICEINFO( ImplName, ServiceName ) \
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::rtl::OUString aServiceName( ServiceName ); \
+ return ::com::sun::star::uno::Sequence< ::rtl::OUString >( &aServiceName, 1);\
+ } \
+ sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) \
+ { return rServiceName == ServiceName; }
+
+
+
+
+
+
+#endif // _TOOLKIT_HELPER_MACROS_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
new file mode 100644
index 000000000000..21f3a4f15907
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: mutexandbroadcasthelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX_
+#define _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX_
+
+#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
+#include <cppuhelper/interfacecontainer.h>
+#endif
+
+
+// Helper class with Mutex and BroadcastHelper, because they must be
+// initialized before calling the OPropertySetHelper-CTOR
+
+class MutexAndBroadcastHelper
+{
+public:
+ MutexAndBroadcastHelper() : BrdcstHelper( Mutex ) {}
+
+
+ ::osl::Mutex Mutex;
+ ::cppu::OBroadcastHelper BrdcstHelper;
+
+ ::osl::Mutex& GetMutex() { return Mutex; }
+
+};
+
+
+
+
+
+
+#endif // _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX
+
+
diff --git a/toolkit/inc/toolkit/helper/mutexhelper.hxx b/toolkit/inc/toolkit/helper/mutexhelper.hxx
new file mode 100644
index 000000000000..5add1377f02d
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/mutexhelper.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * $RCSfile: mutexhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_MUTEXHELPER_HXX_
+#define _TOOLKIT_HELPER_MUTEXHELPER_HXX_
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+// ----------------------------------------------------
+// class MutexHelper
+// ----------------------------------------------------
+
+class MutexHelper
+{
+private:
+ ::osl::Mutex maMutex;
+
+public:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+};
+
+
+
+
+#endif // _TOOLKIT_HELPER_MUTEXHELPER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
new file mode 100644
index 000000000000..bd2e8db1cba3
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * $RCSfile: property.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_PROPERTY_HXX_
+#define _TOOLKIT_HELPER_PROPERTY_HXX_
+
+#include <sal/types.h>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace uno {
+ class Type;
+ class Any;
+} } } }
+
+namespace rtl {
+ class OUString;
+}
+
+
+#define BASEPROPERTY_NOTFOUND 0
+
+#define BASEPROPERTY_TEXT 1 // ::rtl::OUString
+#define BASEPROPERTY_BACKGROUNDCOLOR 2 // sal_Int32
+#define BASEPROPERTY_FILLCOLOR 3 // sal_Int32
+#define BASEPROPERTY_TEXTCOLOR 4 // sal_Int32
+#define BASEPROPERTY_LINECOLOR 5 // sal_Int32
+#define BASEPROPERTY_BORDER 6 // sal_Int16
+#define BASEPROPERTY_ALIGN 7 // sal_Int16
+#define BASEPROPERTY_FONTDESCRIPTOR 8 // ::com::sun::star::awt::FontDescriptor, war mal Font, aber nie gespeichert...
+#define BASEPROPERTY_DROPDOWN 9 // sal_Bool
+#define BASEPROPERTY_MULTILINE 10 // sal_Bool
+#define BASEPROPERTY_STRINGITEMLIST 11 // UStringSequence
+#define BASEPROPERTY_HSCROLL 12 // sal_Bool
+#define BASEPROPERTY_VSCROLL 13 // sal_Bool
+#define BASEPROPERTY_TABSTOP 14 // sal_Bool
+#define BASEPROPERTY_STATE 15 // sal_Int16
+#define BASEPROPERTY_FONT_TYPE 16 // OLD: Font_Type
+#define BASEPROPERTY_FONT_SIZE 17 // OLD: Font_Size
+#define BASEPROPERTY_FONT_ATTRIBS 18 // OLD: Font_Attribs
+#define BASEPROPERTY_DEFAULTCONTROL 19 // ::rtl::OUString (ServiceName)
+#define BASEPROPERTY_LABEL 20 // ::rtl::OUString
+#define BASEPROPERTY_LINECOUNT 21 // sal_Int16
+#define BASEPROPERTY_EXTDATEFORMAT 22 // sal_Int16
+#define BASEPROPERTY_DATESHOWCENTURY 23 // sal_Bool
+#define BASEPROPERTY_EXTTIMEFORMAT 24 // sal_Int16
+#define BASEPROPERTY_NUMSHOWTHOUSANDSEP 25 // sal_Bool
+#define BASEPROPERTY_CURRENCYSYMBOL 26 // ::rtl::OUString
+#define BASEPROPERTY_SPIN 27 // sal_Bool
+#define BASEPROPERTY_STRICTFORMAT 28 // sal_Bool
+#define BASEPROPERTY_DECIMALACCURACY 29 // sal_Int16
+#define BASEPROPERTY_DATE 30 // sal_Int32
+#define BASEPROPERTY_DATEMIN 31 // sal_Int32
+#define BASEPROPERTY_DATEMAX 32 // sal_Int32
+#define BASEPROPERTY_TIME 33 // sal_Int32
+#define BASEPROPERTY_TIMEMIN 34 // sal_Int32
+#define BASEPROPERTY_TIMEMAX 35 // sal_Int32
+#define BASEPROPERTY_VALUE_INT32 36 // sal_Int32
+#define BASEPROPERTY_VALUEMIN_INT32 37 // sal_Int32
+#define BASEPROPERTY_VALUEMAX_INT32 38 // sal_Int32
+#define BASEPROPERTY_VALUESTEP_INT32 39 // sal_Int32
+#define BASEPROPERTY_EDITMASK 40 // ::rtl::OUString
+#define BASEPROPERTY_LITERALMASK 41 // ::rtl::OUString
+#define BASEPROPERTY_IMAGEURL 42 // ::rtl::OUString
+#define BASEPROPERTY_READONLY 43 // sal_Bool
+#define BASEPROPERTY_ENABLED 44 // sal_Bool
+#define BASEPROPERTY_PRINTABLE 45 // sal_Bool
+#define BASEPROPERTY_ECHOCHAR 46 // sal_Int16
+#define BASEPROPERTY_MAXTEXTLEN 47 // sal_Int16
+#define BASEPROPERTY_HARDLINEBREAKS 48 // sal_Int16
+#define BASEPROPERTY_AUTOCOMPLETE 49 // sal_Bool
+#define BASEPROPERTY_MULTISELECTION 50 // sal_Bool
+#define BASEPROPERTY_SELECTEDITEMS 51 // INT16Sequence
+#define BASEPROPERTY_VALUE_DOUBLE 52 // DOUBLE
+#define BASEPROPERTY_VALUEMIN_DOUBLE 53 // DOUBLE
+#define BASEPROPERTY_VALUEMAX_DOUBLE 54 // DOUBLE
+#define BASEPROPERTY_VALUESTEP_DOUBLE 55 // DOUBLE
+#define BASEPROPERTY_TRISTATE 56 // sal_Bool
+#define BASEPROPERTY_DEFAULTBUTTON 57 // sal_Bool
+#define BASEPROPERTY_HELPURL 58 // ::rtl::OUString
+#define BASEPROPERTY_AUTOTOGGLE 59 // sal_Bool
+#define BASEPROPERTY_FOCUSSELECTIONHIDE 60 // sal_Bool
+#define BASEPROPERTY_FORMATKEY 61 // sal_Bool
+#define BASEPROPERTY_FORMATSSUPPLIER 62 // ::com::sun::star::util::XNumberFormatsSupplier
+#define BASEPROPERTY_EFFECTIVE_VALUE 63 // Any (double or string)
+#define BASEPROPERTY_TREATASNUMBER 64 // sal_Bool
+#define BASEPROPERTY_EFFECTIVE_DEFAULT 65 // Any (double or string)
+#define BASEPROPERTY_EFFECTIVE_MIN 66 // Double
+#define BASEPROPERTY_EFFECTIVE_MAX 67 // Double
+#define BASEPROPERTY_CURSYM_POSITION 68 // sal_Bool
+
+
+// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
+#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
+#define BASEPROPERTY_FONTDESCRIPTORPART_NAME 1000 // ::rtl::OUString, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME 1001 // ::rtl::OUString, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_FAMILY 1002 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_CHARSET 1003 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT 1004 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT 1005 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_SLANT 1006 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE 1007 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT 1008 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WIDTH 1009 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_PITCH 1010 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH 1011 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION 1012 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_KERNING 1013 // sal_Bool, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE 1014 // sal_Bool, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_TYPE 1015 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_END 1015
+
+#define PROPERTY_ALIGN_LEFT 0
+#define PROPERTY_ALIGN_CENTER 1
+#define PROPERTY_ALIGN_RIGHT 2
+
+#define PROPERTY_STATE_OFF 0
+#define PROPERTY_STATE_ON 1
+#define PROPERTY_STATE_DONTCARE 2
+
+sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName );
+const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId );
+const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId );
+sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId );
+sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId );
+sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId );
+sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 );
+
+
+
+
+#endif // _TOOLKIT_HELPER_PROPERTY_HXX_
+
+
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
new file mode 100644
index 000000000000..e52ab05c6c8b
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: servicenames.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_SERVICENAMES_HXX_
+#define _TOOLKIT_HELPER_SERVICENAMES_HXX_
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+extern const sal_Char __FAR_DATA szServiceName_Toolkit[], szServiceName2_Toolkit[];
+extern const sal_Char __FAR_DATA szServiceName_MVCIntrospection[], szServiceName2_MVCIntrospection[];
+extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_PopupMenu[];
+extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[];
+extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
+extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
+extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlEdit[], szServiceName2_UnoControlEdit[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlEditModel[], szServiceName2_UnoControlEditModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFileControl[], szServiceName2_UnoControlFileControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFileControlModel[], szServiceName2_UnoControlFileControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlButton[], szServiceName2_UnoControlButton[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlButtonModel[], szServiceName2_UnoControlButtonModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageButton[], szServiceName2_UnoControlImageButton[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageButtonModel[], szServiceName2_UnoControlImageButtonModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageControl[], szServiceName2_UnoControlImageControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageControlModel[], szServiceName2_UnoControlImageControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlRadioButton[], szServiceName2_UnoControlRadioButton[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlRadioButtonModel[], szServiceName2_UnoControlRadioButtonModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCheckBox[], szServiceName2_UnoControlCheckBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCheckBoxModel[], szServiceName2_UnoControlCheckBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlListBox[], szServiceName2_UnoControlListBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlListBoxModel[], szServiceName2_UnoControlListBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlComboBox[], szServiceName2_UnoControlComboBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlComboBoxModel[], szServiceName2_UnoControlComboBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedText[], szServiceName2_UnoControlFixedText[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedTextModel[], szServiceName2_UnoControlFixedTextModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlGroupBox[], szServiceName2_UnoControlGroupBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlGroupBoxModel[], szServiceName2_UnoControlGroupBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlDateField[], szServiceName2_UnoControlDateField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlDateFieldModel[], szServiceName2_UnoControlDateFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTimeField[], szServiceName2_UnoControlTimeField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTimeFieldModel[], szServiceName2_UnoControlTimeFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlNumericField[], szServiceName2_UnoControlNumericField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlNumericFieldModel[], szServiceName2_UnoControlNumericFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyField[], szServiceName2_UnoControlCurrencyField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyFieldModel[], szServiceName2_UnoControlCurrencyFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlPatternField[], szServiceName2_UnoControlPatternField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[], szServiceName2_UnoControlPatternFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[], szServiceName2_UnoControlFormattedField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[], szServiceName2_UnoControlFormattedFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_PrinterServer[], szServiceName2_PrinterServer[];
+
+// ExtUnoWrapper:
+extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[];
+
+
+
+#endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/unomemorystream.hxx b/toolkit/inc/toolkit/helper/unomemorystream.hxx
new file mode 100644
index 000000000000..29a40cd5501a
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/unomemorystream.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: unomemorystream.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_
+#define _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_
+
+
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <tools/stream.hxx>
+
+// ----------------------------------------------------
+// class UNOMEMORYSTREAM
+// ----------------------------------------------------
+
+class UnoMemoryStream : public SvMemoryStream,
+ public ::com::sun::star::io::XInputStream,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+
+public:
+ UnoMemoryStream( sal_uInt32 nInitSize = 0x3FFF, sal_uInt32 nResize = 0x3FFFF );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::acquire(); }
+ void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) { OWeakObject::release(); }
+
+ // ::com::sun::star::io::XInputStream
+ sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
new file mode 100644
index 000000000000..2ed9ee4427eb
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: unopropertyarrayhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+#define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+
+#include <cppuhelper/propshlp.hxx>
+
+#include <tools/table.hxx>
+
+// ----------------------------------------------------
+// class UnoPropertyArrayHelper
+// ----------------------------------------------------
+class UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper
+{
+private:
+ Table maIDs;
+
+protected:
+ sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const;
+
+public:
+ UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs );
+
+ // ::cppu::IPropertyArrayHelper
+ sal_Bool SAL_CALL fillPropertyMembersByHandle( ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties();
+ ::com::sun::star::beans::Property SAL_CALL getPropertyByName(const ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException);
+ sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName);
+ sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName );
+ sal_Int32 SAL_CALL fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames );
+};
+
+
+
+#endif _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/unowrapper.hxx b/toolkit/inc/toolkit/helper/unowrapper.hxx
new file mode 100644
index 000000000000..455c4383c969
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/unowrapper.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: unowrapper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_UNOWRAPPER_HXX_
+#define _TOOLKIT_HELPER_UNOWRAPPER_HXX_
+
+#ifndef _COM_SUN_STAR_AWT_XTOOLKIT_HPP_
+#include <com/sun/star/awt/XToolkit.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
+#include <com/sun/star/awt/XGraphics.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOWPEER_HPP_
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#endif
+
+#include <vcl/unowrap.hxx>
+#include <vcl/window.hxx>
+
+// ----------------------------------------------------
+// class UnoWrapper
+// ----------------------------------------------------
+
+class UnoWrapper : public UnoWrapperBase
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> mxToolkit;
+
+public:
+ UnoWrapper();
+
+ void Destroy();
+
+ // Toolkit
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> GetVCLToolkit();
+ virtual void RegisterUnoServices();
+
+ // Graphics
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> CreateGraphics( OutputDevice* pOutDev );
+ virtual void ReleaseAllGraphics( OutputDevice* pOutDev );
+
+ // Window
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> GetWindowInterface( Window* pWindow, BOOL bCreate );
+ virtual void SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace );
+
+
+ void WindowDestroyed( Window* pWindow );
+ void WindowEvent_Move( Window* pWindow );
+ void WindowEvent_Resize( Window* pWindow );
+ void WindowEvent_Show( Window* pWindow, BOOL bShow );
+ void WindowEvent_Close( Window* pWindow );
+ void WindowEvent_Minimize( Window* pWindow );
+ void WindowEvent_Normalize( Window* pWindow );
+ void WindowEvent_Activate( Window* pWindow, BOOL bActivated );
+ void WindowEvent_MouseButtonUp( Window* pWindow, const MouseEvent& rEvt );
+ void WindowEvent_MouseButtonDown( Window* pWindow, const MouseEvent& rEvt );
+ void WindowEvent_MouseMove( Window* pWindow, const MouseEvent& rEvt );
+ void WindowEvent_Command( Window* pWindow, const CommandEvent& rCEvt );
+ void WindowEvent_KeyInput( Window* pWindow, const KeyEvent& rEvt );
+ void WindowEvent_KeyUp( Window* pWindow, const KeyEvent& rEvt );
+ void WindowEvent_GetFocus( Window* pWindow );
+ void WindowEvent_LoseFocus( Window* pWindow );
+ void WindowEvent_Paint( Window* pWindow, const Rectangle& rRect );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getNewUnoServiceManager();
+
+};
+
+
+
+
+#endif // _TOOLKIT_HELPER_UNOWRAPPER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/vclunohelper.hxx b/toolkit/inc/toolkit/helper/vclunohelper.hxx
new file mode 100644
index 000000000000..837354a7d502
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/vclunohelper.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclunohelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#define _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XInterface;
+}}}}
+
+namespace com { namespace sun { namespace star { namespace awt {
+ class XBitmap;
+ class XWindow;
+ class XWindowPeer;
+ class XGraphics;
+ class XRegion;
+ class XDevice;
+ class XPointer;
+ class XToolkit;
+ class XFont;
+ class XControlContainer;
+ struct SimpleFontMetric;
+ struct FontDescriptor;
+ struct Rectangle;
+}}}}
+
+
+#include <vcl/bitmapex.hxx>
+#include <vcl/region.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/poly.hxx>
+
+class Window;
+class OutputDevice;
+
+// ----------------------------------------------------
+// class VclUnoHelper
+// ----------------------------------------------------
+class VCLUnoHelper
+{
+public:
+ // Toolkit
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> CreateToolkit();
+
+ // Bitmap
+ static BitmapEx GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
+
+ // Window
+ static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
+ static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> GetInterface( Window* pWindow );
+
+ // OutputDevice
+ static OutputDevice* GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice );
+ static OutputDevice* GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics );
+
+ // Region
+ static Region GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion );
+
+
+ // Pointer
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> CreatePointer();
+
+ // Polygon
+ static Polygon CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY );
+
+ // Font
+ static ::com::sun::star::awt::FontDescriptor CreateFontDescriptor( const Font& rFont );
+ static Font CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont );
+ static Font CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont );
+ static ::com::sun::star::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric );
+ static float ConvertFontWidth( FontWidth eWidth );
+ static FontWidth ConvertFontWidth( float f );
+ static float ConvertFontWeight( FontWeight eWeight );
+ static FontWeight ConvertFontWeight( float f );
+
+ // Rectangle
+ static sal_Bool IsZero( ::com::sun::star::awt::Rectangle rRect );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> CreateControlContainer( Window* pWindow );
+
+};
+
+
+#endif // _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst
new file mode 100644
index 000000000000..a991dfa0821c
--- /dev/null
+++ b/toolkit/prj/d.lst
@@ -0,0 +1,35 @@
+mkdir: %_DEST%\inc%_EXT%\toolkit
+mkdir: %_DEST%\inc%_EXT%\toolkit\helper
+mkdir: %_DEST%\inc%_EXT%\toolkit\awt
+mkdir: %_DEST%\inc%_EXT%\toolkit\controls
+
+..\%__SRC%\lib\itk.lib %_DEST%\lib%_EXT%\itk.lib
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+..\%__SRC%\bin\tk%UPD%??.res %_DEST%\bin%_EXT%\tk%upd%??.res
+..\%__SRC%\bin\tk%upd%??.sym %_DEST%\bin%_EXT%\tk?????.sym
+..\%__SRC%\bin\tk%upd%??.dll %_DEST%\bin%_EXT%\tk?????.dll
+..\%__SRC%\misc\tk%upd%??.map %_DEST%\bin%_EXT%\tk?????.map
+
+hedabu: ..\inc\toolkit\awt\vclxcontainer.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxcontainer.hxx
+hedabu: ..\inc\toolkit\awt\vclxdevice.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdevice.hxx
+hedabu: ..\inc\toolkit\awt\vclxtoolkit.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtoolkit.hxx
+hedabu: ..\inc\toolkit\awt\vclxtopwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtopwindow.hxx
+hedabu: ..\inc\toolkit\awt\vclxwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindow.hxx
+hedabu: ..\inc\toolkit\awt\vclxwindows.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindows.hxx
+
+hedabu: ..\inc\toolkit\controls\unocontrol.hxx %_DEST%\inc%_EXT%\toolkit\controls\unocontrol.hxx
+
+hedabu: ..\inc\toolkit\helper\emptyfontdescriptor.hxx %_DEST%\inc%_EXT%\toolkit\helper\emptyfontdescriptor.hxx
+hedabu: ..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\vclunohelper.hxx
+hedabu: ..\inc\toolkit\helper\convert.hxx %_DEST%\inc%_EXT%\toolkit\helper\convert.hxx
+hedabu: ..\inc\toolkit\helper\property.hxx %_DEST%\inc%_EXT%\toolkit\helper\property.hxx
+hedabu: ..\inc\toolkit\helper\macros.hxx %_DEST%\inc%_EXT%\toolkit\helper\macros.hxx
+hedabu: ..\inc\toolkit\helper\mutexhelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\mutexhelper.hxx
+hedabu: ..\inc\toolkit\helper\mutexandbroadcasthelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\mutexandbroadcasthelper.hxx
+hedabu: ..\inc\toolkit\helper\listenermultiplexer.hxx %_DEST%\inc%_EXT%\toolkit\helper\listenermultiplexer.hxx
+hedabu: ..\inc\toolkit\helper\unowrapper.hxx %_DEST%\inc%_EXT%\toolkit\helper\unowrapper.hxx
+
+hedabu: ..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\unohlp.hxx
+
diff --git a/toolkit/source/awt/makefile.mk b/toolkit/source/awt/makefile.mk
new file mode 100644
index 000000000000..160f4956cf6a
--- /dev/null
+++ b/toolkit/source/awt/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=awt
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/vclxbitmap.obj \
+ $(SLO)$/vclxcontainer.obj \
+ $(SLO)$/vclxdevice.obj \
+ $(SLO)$/vclxfont.obj \
+ $(SLO)$/vclxgraphics.obj \
+ $(SLO)$/vclxmenu.obj \
+ $(SLO)$/vclxpointer.obj \
+ $(SLO)$/vclxprinter.obj \
+ $(SLO)$/vclxregion.obj \
+ $(SLO)$/vclxsystemdependentwindow.obj \
+ $(SLO)$/vclxtoolkit.obj \
+ $(SLO)$/vclxtopwindow.obj \
+ $(SLO)$/vclxwindow.obj \
+ $(SLO)$/vclxwindows.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/awt/vclxbitmap.cxx b/toolkit/source/awt/vclxbitmap.cxx
new file mode 100644
index 000000000000..b75a4254d6d7
--- /dev/null
+++ b/toolkit/source/awt/vclxbitmap.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxbitmap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxbitmap.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/stream.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+// ----------------------------------------------------
+// class VCLXBitmap
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXBitmap::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XBitmap*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDisplayBitmap*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXBitmap )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXBitmap )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+// ::com::sun::star::awt::XBitmap
+::com::sun::star::awt::Size VCLXBitmap::getSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSize( maBitmap.GetSizePixel().Width(), maBitmap.GetSizePixel().Height() );
+ return aSize;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getDIB() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ SvMemoryStream aMem;
+ aMem << maBitmap.GetBitmap();
+ return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ SvMemoryStream aMem;
+ aMem << maBitmap.GetMask();
+ return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
+}
+
+
+
+
diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx
new file mode 100644
index 000000000000..a07c97873f17
--- /dev/null
+++ b/toolkit/source/awt/vclxcontainer.cxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxcontainer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxcontainer.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/window.hxx>
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class VCLXContainer
+// ----------------------------------------------------
+VCLXContainer::VCLXContainer()
+{
+}
+
+VCLXContainer::~VCLXContainer()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXContainer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XVclContainer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XVclContainerPeer*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXContainer )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainer>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+// ::com::sun::star::awt::XVclContainer
+void VCLXContainer::addVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetContainerListeners().addInterface( rxListener );
+}
+
+void VCLXContainer::removeVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetContainerListeners().removeInterface( rxListener );
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > VCLXContainer::getWindows( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // Bei allen Childs das Container-Interface abfragen...
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aSeq;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ sal_uInt16 nChilds = pWindow->GetChildCount();
+ if ( nChilds )
+ {
+ aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >( nChilds );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pChildRefs = aSeq.getArray();
+ for ( sal_uInt16 n = 0; n < nChilds; n++ )
+ {
+ Window* pChild = pWindow->GetChild( n );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xWP = pChild->GetComponentInterface( sal_True );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( xWP, ::com::sun::star::uno::UNO_QUERY );
+ pChildRefs[n] = xW;
+ }
+ }
+ }
+ return aSeq;
+}
+
+
+// ::com::sun::star::awt::XVclContainerPeer
+void VCLXContainer::enableDialogControl( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( bEnable )
+ nStyle |= WB_DIALOGCONTROL;
+ else
+ nStyle &= (~WB_DIALOGCONTROL);
+ pWindow->SetStyle( nStyle );
+ }
+}
+
+void VCLXContainer::setTabOrder( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Components, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Tabs, sal_Bool bGroupControl ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_uInt32 nCount = Components.getLength();
+ DBG_ASSERT( nCount == Tabs.getLength(), "setTabOrder: TabCount != ComponentCount" );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = Components.getConstArray();
+ const ::com::sun::star::uno::Any* pTabs = Tabs.getConstArray();
+
+ Window* pPrevWin = NULL;
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
+ {
+ // ::com::sun::star::style::TabStop
+ Window* pWin = VCLUnoHelper::GetWindow( pComps[n] );
+ // NULL kann vorkommen, wenn die ::com::sun::star::uno::Sequence vom TabController kommt und eine Peer fehlt!
+ if ( pWin )
+ {
+ // Reihenfolge der Fenster vor der Manipulation des Styles,
+ // weil z.B. der RadioButton in StateChanged das PREV-Window beruecksichtigt.
+ if ( pPrevWin )
+ pWin->SetZOrder( pPrevWin, WINDOW_ZORDER_BEHIND );
+
+ WinBits nStyle = pWin->GetStyle();
+ nStyle &= ~(WB_TABSTOP|WB_NOTABSTOP|WB_GROUP);
+ if ( pTabs[n].getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN )
+ {
+ sal_Bool bTab;
+ pTabs[n] >>= bTab;
+ nStyle |= ( bTab ? WB_TABSTOP : WB_NOTABSTOP );
+ }
+ pWin->SetStyle( nStyle );
+
+ if ( bGroupControl )
+ {
+ if ( n == 0 )
+ pWin->SetDialogControlStart( sal_True );
+ else
+ pWin->SetDialogControlStart( sal_False );
+ }
+
+ pPrevWin = pWin;
+ }
+ }
+}
+
+void VCLXContainer::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Components ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_uInt32 nCount = Components.getLength();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = Components.getConstArray();
+
+ Window* pPrevWin = NULL;
+ Window* pPrevRadio = NULL;
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
+ {
+ Window* pWin = VCLUnoHelper::GetWindow( pComps[n] );
+ if ( pWin )
+ {
+ Window* pSortBehind = pPrevWin;
+ // #57096# Alle Radios hintereinander sortieren...
+ sal_Bool bNewPrevWin = sal_True;
+ if ( pWin->GetType() == WINDOW_RADIOBUTTON )
+ {
+ if ( pPrevRadio )
+ {
+ bNewPrevWin = ( pPrevWin == pPrevRadio ); // Radio-Button wurde vor das PreWin sortiert....
+ pSortBehind = pPrevRadio;
+ }
+ pPrevRadio = pWin;
+ }
+
+ // Z-Order
+ if ( pSortBehind )
+ pWin->SetZOrder( pSortBehind, WINDOW_ZORDER_BEHIND );
+
+ WinBits nStyle = pWin->GetStyle();
+ if ( n == 0 )
+ nStyle |= WB_GROUP;
+ else
+ nStyle &= (~WB_GROUP);
+ pWin->SetStyle( nStyle );
+
+ // Ein WB_GROUP hinter die Gruppe, falls keine Gruppe mehr folgt.
+ if ( n == ( nCount - 1 ) )
+ {
+ Window* pBehindLast = pWin->GetWindow( WINDOW_NEXT );
+ if ( pBehindLast )
+ {
+ WinBits nStyle = pBehindLast->GetStyle();
+ nStyle |= WB_GROUP;
+ pBehindLast->SetStyle( nStyle );
+ }
+ }
+
+ if ( bNewPrevWin )
+ pPrevWin = pWin;
+ }
+ }
+}
+
+
+
+
+
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx
new file mode 100644
index 000000000000..79298c2fbda2
--- /dev/null
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxdevice.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_AWT_DEVICECAPABILITY_HPP_
+#include <com/sun/star/awt/DeviceCapability.hpp>
+#endif
+
+#include <toolkit/awt/vclxdevice.hxx>
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/awt/vclxbitmap.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+#include <vcl/print.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/font.hxx>
+
+// ----------------------------------------------------
+// class VCLXDevice
+// ----------------------------------------------------
+VCLXDevice::VCLXDevice() : mrMutex( Application::GetSolarMutex() )
+{
+ mpOutputDevice = NULL;
+#ifdef DEBUG
+ nDummy = 0x12345678;
+ pDummy = (void*)0x12345678;
+#endif
+}
+
+VCLXDevice::~VCLXDevice()
+{
+#ifdef DEBUG
+ nDummy = 0xbaadbaad;
+ pDummy = (void*)0xbaadbaad;
+#endif
+}
+
+void VCLXDevice::DestroyOutputDevice()
+{
+ delete mpOutputDevice;
+ mpOutputDevice = NULL;
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXDevice::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDevice*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXDevice )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXDevice )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+// ::com::sun::star::awt::XDevice,
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXDevice::createGraphics( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > xRef;
+
+ if ( mpOutputDevice )
+ xRef = mpOutputDevice->CreateUnoGraphics();
+
+ return xRef;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXDevice::createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef;
+ if ( GetOutputDevice() )
+ {
+ VCLXVirtualDevice* pVDev = new VCLXVirtualDevice;
+ VirtualDevice* pVclVDev = new VirtualDevice( *GetOutputDevice() );
+ pVclVDev->SetOutputSizePixel( Size( nWidth, nHeight ) );
+ pVDev->SetVirtualDevice( pVclVDev );
+ xRef = pVDev;
+ }
+ return xRef;
+}
+
+::com::sun::star::awt::DeviceInfo VCLXDevice::getInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::DeviceInfo aInfo;
+
+ if( mpOutputDevice )
+ {
+ Size aDevSz;
+ OutDevType eDevType = mpOutputDevice->GetOutDevType();
+ if ( eDevType == OUTDEV_WINDOW )
+ {
+ aDevSz = ((Window*)mpOutputDevice)->GetSizePixel();
+ ((Window*)mpOutputDevice)->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
+ }
+ else if ( eDevType == OUTDEV_PRINTER )
+ {
+ aDevSz = ((Printer*)mpOutputDevice)->GetPaperSizePixel();
+ Size aOutSz = mpOutputDevice->GetOutputSizePixel();
+ Point aOffset = ((Printer*)mpOutputDevice)->GetPageOffset();
+ aInfo.LeftInset = aOffset.X();
+ aInfo.TopInset = aOffset.Y();
+ aInfo.RightInset = aDevSz.Width() - aOutSz.Width() - aOffset.X();
+ aInfo.BottomInset = aDevSz.Height() - aOutSz.Height() - aOffset.Y();
+ }
+ else // VirtualDevice
+ {
+ aDevSz = mpOutputDevice->GetOutputSizePixel();
+ aInfo.LeftInset = 0;
+ aInfo.TopInset = 0;
+ aInfo.RightInset = 0;
+ aInfo.BottomInset = 0;
+ }
+
+ aInfo.Width = aDevSz.Width();
+ aInfo.Height = aDevSz.Height();
+
+ Size aTmpSz = mpOutputDevice->LogicToPixel( Size( 1000, 1000 ), MapMode( MAP_CM ) );
+ aInfo.PixelPerMeterX = aTmpSz.Width()/10;
+ aInfo.PixelPerMeterY = aTmpSz.Height()/10;
+
+ aInfo.BitsPerPixel = mpOutputDevice->GetBitCount();
+
+ aInfo.Capabilities = 0;
+ if ( mpOutputDevice->GetOutDevType() != OUTDEV_PRINTER )
+ aInfo.Capabilities = ::com::sun::star::awt::DeviceCapability::RASTEROPERATIONS|::com::sun::star::awt::DeviceCapability::GETBITS;
+ }
+
+ return aInfo;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > VCLXDevice::getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor> aFonts;
+ if( mpOutputDevice )
+ {
+ sal_uInt16 nFonts = mpOutputDevice->GetDevFontCount();
+ if ( nFonts )
+ {
+ aFonts = ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor>( nFonts );
+ ::com::sun::star::awt::FontDescriptor* pFonts = aFonts.getArray();
+ for ( sal_uInt16 n = 0; n < nFonts; n++ )
+ pFonts[n] = VCLUnoHelper::CreateFontDescriptor( mpOutputDevice->GetDevFont( n ) );
+ }
+ }
+ return aFonts;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > VCLXDevice::getFont( const ::com::sun::star::awt::FontDescriptor& rDescriptor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > xRef;
+ if( mpOutputDevice )
+ {
+ VCLXFont* pMetric = new VCLXFont;
+ pMetric->Init( *this, VCLUnoHelper::CreateFont( rDescriptor, mpOutputDevice->GetFont() ) );
+ xRef = pMetric;
+ }
+ return xRef;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > VCLXDevice::createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp;
+ if( mpOutputDevice )
+ {
+ Bitmap aBmp = mpOutputDevice->GetBitmap( Point( nX, nY ), Size( nWidth, nHeight ) );
+
+ VCLXBitmap* pBmp = new VCLXBitmap;
+ pBmp->SetBitmap( BitmapEx( aBmp ) );
+ xBmp = pBmp;
+ }
+ return xBmp;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > VCLXDevice::createDisplayBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rxBitmap ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ BitmapEx aBmp = VCLUnoHelper::GetBitmap( rxBitmap );
+ VCLXBitmap* pBmp = new VCLXBitmap;
+ pBmp->SetBitmap( aBmp );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > xDBmp = pBmp;
+ return xDBmp;
+}
+
+
+
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx
new file mode 100644
index 000000000000..99e55f88b44c
--- /dev/null
+++ b/toolkit/source/awt/vclxfont.cxx
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxfont.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <rtl/ustring.h>
+
+#include <vcl/outdev.hxx>
+
+// ----------------------------------------------------
+// class VCLXFont
+// ----------------------------------------------------
+VCLXFont::VCLXFont()
+{
+ mpFontMetric = NULL;
+}
+
+VCLXFont::~VCLXFont()
+{
+ delete mpFontMetric;
+}
+
+void VCLXFont::Init( ::com::sun::star::awt::XDevice& rxDev, const Font& rFont )
+{
+ mxDevice = &rxDev;
+
+ delete mpFontMetric;
+ mpFontMetric = NULL;
+
+ maFont = rFont;
+}
+
+BOOL VCLXFont::ImplAssertValidFontMetric()
+{
+ if ( !mpFontMetric && mxDevice.is() )
+ {
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+ mpFontMetric = new FontMetric( pOutDev->GetFontMetric() );
+ pOutDev->SetFont( aOldFont );
+ }
+ }
+ return mpFontMetric ? TRUE : FALSE;
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXFont::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XFont*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXFont )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXFont )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+::com::sun::star::awt::FontDescriptor VCLXFont::getFontDescriptor( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return VCLUnoHelper::CreateFontDescriptor( maFont );
+
+}
+
+::com::sun::star::awt::SimpleFontMetric VCLXFont::getFontMetric( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::awt::SimpleFontMetric aFM;
+ if ( ImplAssertValidFontMetric() )
+ aFM = VCLUnoHelper::CreateFontMetric( *mpFontMetric );
+ return aFM;
+}
+
+sal_Int16 VCLXFont::getCharWidth( sal_Unicode c ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int16 nRet = -1;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+
+ nRet = pOutDev->GetTextWidth( c );
+
+ pOutDev->SetFont( aOldFont );
+ }
+ return nRet;
+}
+
+::com::sun::star::uno::Sequence< sal_Int16 > VCLXFont::getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+
+ sal_Int16 nCount = nLast-nFirst + 1;
+ aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nCount );
+ for ( USHORT n = 0; n < nCount; n++ )
+ {
+ aSeq.getArray()[n] = pOutDev->GetTextWidth( nFirst+n );
+ }
+
+ pOutDev->SetFont( aOldFont );
+ }
+ return aSeq;
+}
+
+sal_Int32 VCLXFont::getStringWidth( const ::rtl::OUString& str ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nRet = -1;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+ nRet = pOutDev->GetTextWidth( str );
+ pOutDev->SetFont( aOldFont );
+ }
+ return nRet;
+}
+
+sal_Int32 VCLXFont::getStringWidthArray( const ::rtl::OUString& str, ::com::sun::star::uno::Sequence< sal_Int32 >& rDXArray ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nRet = -1;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+ rDXArray = ::com::sun::star::uno::Sequence<sal_Int32>( str.getLength() );
+ nRet = pOutDev->GetTextArray( str, rDXArray.getArray() );
+ pOutDev->SetFont( aOldFont );
+ }
+ return nRet;
+}
+
+void VCLXFont::getKernPairs( ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars1, ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars2, ::com::sun::star::uno::Sequence< sal_Int16 >& rnKerns ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+
+ ULONG nPairs = pOutDev->GetKerningPairCount();
+ if ( nPairs )
+ {
+ KerningPair* pData = new KerningPair[ nPairs ];
+ pOutDev->GetKerningPairs( nPairs, pData );
+
+ rnChars1 = ::com::sun::star::uno::Sequence<sal_Unicode>( nPairs );
+ rnChars2 = ::com::sun::star::uno::Sequence<sal_Unicode>( nPairs );
+ rnKerns = ::com::sun::star::uno::Sequence<sal_Int16>( nPairs );
+
+ sal_Unicode* pChars1 = rnChars1.getArray();
+ sal_Unicode* pChars2 = rnChars2.getArray();
+ sal_Int16* pKerns = rnKerns.getArray();
+
+ for ( ULONG n = 0; n < nPairs; n++ )
+ {
+ pChars1[n] = pData[n].nChar1;
+ pChars2[n] = pData[n].nChar2;
+ pKerns[n] = pData[n].nKern;
+ }
+
+
+ delete pData;
+ }
+ pOutDev->SetFont( aOldFont );
+ }
+}
+
+
+
diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx
new file mode 100644
index 000000000000..1e475328c5c3
--- /dev/null
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -0,0 +1,518 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxgraphics.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define SMART_UNO_GENERATION // Um einige Funktionen in VCL freizuschalten
+
+#include <toolkit/awt/vclxgraphics.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/gradient.hxx>
+#include <tools/debug.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXGraphics
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXGraphics::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XGraphics*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXGraphics )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXGraphics )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+VCLXGraphics::VCLXGraphics() : mrMutex( Application::GetSolarMutex() )
+{
+ mpOutputDevice = NULL;
+ mpClipRegion = NULL;
+}
+
+VCLXGraphics::~VCLXGraphics()
+{
+ List* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL;
+ if ( pLst )
+ pLst->Remove( this );
+
+ delete mpClipRegion;
+}
+
+void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev )
+{
+ mpOutputDevice = pOutDev;
+ mxDevice = NULL;
+}
+
+void VCLXGraphics::Init( OutputDevice* pOutDev )
+{
+ DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init allready has pOutDev !" );
+ mpOutputDevice = pOutDev;
+
+ maFont = mpOutputDevice->GetFont();
+ maTextColor = COL_BLACK;
+ maTextFillColor = COL_TRANSPARENT;
+ maLineColor = COL_BLACK;
+ maFillColor = COL_WHITE;
+ meRasterOp = ROP_OVERPAINT;
+ mpClipRegion = NULL;
+
+ // Register at OutputDevice
+ List* pLst = mpOutputDevice->GetUnoGraphicsList();
+ if ( !pLst )
+ pLst = mpOutputDevice->CreateUnoGraphicsList();
+ pLst->Insert( this, LIST_APPEND );
+}
+
+void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
+{
+ if(mpOutputDevice)
+ {
+ NAMESPACE_VOS(OGuard) aVclGuard( Application::GetSolarMutex() );
+
+ if ( nFlags & INITOUTDEV_FONT )
+ {
+ mpOutputDevice->SetFont( maFont );
+ mpOutputDevice->SetTextColor( maTextColor );
+ mpOutputDevice->SetTextFillColor( maTextFillColor );
+ }
+
+ if ( nFlags & INITOUTDEV_COLORS )
+ {
+ mpOutputDevice->SetLineColor( maLineColor );
+ mpOutputDevice->SetFillColor( maFillColor );
+ }
+
+ if ( nFlags & INITOUTDEV_RASTEROP )
+ {
+ mpOutputDevice->SetRasterOp( meRasterOp );
+ }
+
+ if ( nFlags & INITOUTDEV_CLIPREGION )
+ {
+ if( mpClipRegion )
+ mpOutputDevice->SetClipRegion( *mpClipRegion );
+ else
+ mpOutputDevice->SetClipRegion();
+ }
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXGraphics::getDevice() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( !mxDevice.is() && mpOutputDevice )
+ {
+ VCLXDevice* pDev = new VCLXDevice;
+ pDev->SetOutputDevice( mpOutputDevice );
+ mxDevice = pDev;
+ }
+ return mxDevice;
+}
+
+::com::sun::star::awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::SimpleFontMetric aM;
+ if( mpOutputDevice )
+ {
+ mpOutputDevice->SetFont( maFont );
+ FontMetric aFMetric = mpOutputDevice->GetFontMetric();
+
+ aM.Ascent = aFMetric.GetAscent();
+ aM.Descent = aFMetric.GetDescent();
+ aM.Leading = aFMetric.GetLeading();
+ aM.Slant = aFMetric.GetSlant();
+ aM.FirstChar = aFMetric.getFirstChar();
+ aM.LastChar = aFMetric.getLastChar();
+ }
+ return aM;
+}
+
+void VCLXGraphics::setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maFont = VCLUnoHelper::CreateFont( rxFont );
+}
+
+void VCLXGraphics::selectFont( const ::com::sun::star::awt::FontDescriptor& rDescription ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maFont = VCLUnoHelper::CreateFont( rDescription, Font() );
+}
+
+void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maTextColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maTextFillColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maLineColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maFillColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setRasterOp( ::com::sun::star::awt::RasterOperation eROP ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ meRasterOp = (RasterOp)eROP;
+}
+
+void VCLXGraphics::setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ delete mpClipRegion;
+ if ( rxRegion.is() )
+ mpClipRegion = new Region( VCLUnoHelper::GetRegion( rxRegion ) );
+ else
+ mpClipRegion = NULL;
+}
+
+void VCLXGraphics::intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ {
+ Region aRegion( VCLUnoHelper::GetRegion( rxRegion ) );
+ if ( !mpClipRegion )
+ mpClipRegion = new Region( aRegion );
+ else
+ mpClipRegion->Intersect( aRegion );
+ }
+}
+
+void VCLXGraphics::push( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+
+ if( mpOutputDevice )
+ mpOutputDevice->Push();
+}
+
+void VCLXGraphics::pop( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+
+ if( mpOutputDevice )
+ mpOutputDevice->Pop();
+}
+
+void VCLXGraphics::copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( mpOutputDevice )
+ {
+ VCLXDevice* pFromDev = VCLXDevice::GetImplementation( rxSource );
+ DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
+ if ( pFromDev )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP );
+ mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ),
+ Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() );
+ }
+ }
+}
+
+void VCLXGraphics::draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( rxBitmapHandle, ::com::sun::star::uno::UNO_QUERY );
+ BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
+
+ Point aPos(nDestX - nSourceX, nDestY - nSourceY);
+ Size aSz = aBmpEx.GetSizePixel();
+
+ if(nDestWidth != nSourceWidth)
+ {
+ float zoomX = (float)nDestWidth / (float)nSourceWidth;
+ aSz.Width() = (long) ((float)aSz.Width() * zoomX);
+ }
+
+ if(nDestHeight != nSourceHeight)
+ {
+ float zoomY = (float)nDestHeight / (float)nSourceHeight;
+ aSz.Height() = (long) ((float)aSz.Height() * zoomY);
+ }
+
+ if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
+ mpOutputDevice->IntersectClipRegion(Region(Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
+
+ mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
+ }
+}
+
+void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPixel( Point( x, y ) );
+ }
+}
+
+void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) );
+ }
+}
+
+void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound );
+ }
+}
+
+void VCLXGraphics::drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
+ }
+}
+
+void VCLXGraphics::drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
+ }
+}
+
+void VCLXGraphics::drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ sal_Int32 nPolys = (sal_uInt16) DataX.getLength();
+ PolyPolygon aPolyPoly( nPolys );
+ for ( sal_Int32 n = 0; n < nPolys; n++ )
+ aPolyPoly[n] = VCLUnoHelper::CreatePolygon( DataX.getConstArray()[n], DataY.getConstArray()[n] );
+
+ mpOutputDevice->DrawPolyPolygon( aPolyPoly );
+ }
+}
+
+void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) );
+ }
+}
+
+void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const ::com::sun::star::awt::Gradient& rGradient ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor);
+ aGradient.SetAngle(rGradient.Angle);
+ aGradient.SetBorder(rGradient.Border);
+ aGradient.SetOfsX(rGradient.XOffset);
+ aGradient.SetOfsY(rGradient.YOffset);
+ aGradient.SetStartIntensity(rGradient.StartIntensity);
+ aGradient.SetEndIntensity(rGradient.EndIntensity);
+ aGradient.SetSteps(rGradient.StepCount);
+ mpOutputDevice->DrawGradient( Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
+ }
+}
+
+void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS |INITOUTDEV_FONT);
+ mpOutputDevice->DrawText( Point( x, y ), rText );
+ }
+}
+
+void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rLongs ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT );
+ mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() );
+ }
+}
+
+
+
+
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
new file mode 100644
index 000000000000..861b2ed3d118
--- /dev/null
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -0,0 +1,348 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxmenu.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/menu.hxx>
+
+// ----------------------------------------------------
+// class VCLXMenu
+// ----------------------------------------------------
+VCLXMenu::VCLXMenu() : maMenuListeners( *this )
+{
+ mpMenu = NULL;
+}
+
+VCLXMenu::~VCLXMenu()
+{
+ for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n );
+ delete pRef;
+ }
+ delete mpMenu;
+}
+
+void VCLXMenu::ImplCreateMenu( sal_Bool bPopup )
+{
+ DBG_ASSERT( !mpMenu, "CreateMenu: Menu exists!" );
+
+ mbPopup = bPopup;
+ if ( mbPopup )
+ mpMenu = new PopupMenu;
+ else
+ mpMenu = new MenuBar;
+
+ mpMenu->SetSelectHdl( LINK( this, VCLXMenu, SelectHdl ) );
+ mpMenu->SetHighlightHdl( LINK( this, VCLXMenu, HighlightHdl ) );
+ mpMenu->SetActivateHdl( LINK( this, VCLXMenu, ActivateHdl ) );
+ mpMenu->SetDeactivateHdl( LINK( this, VCLXMenu, DeactivateHdl ) );
+}
+
+IMPL_LINK( VCLXMenu, SelectHdl, Menu*, EMPTYARG )
+{
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.select( aEvent );
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXMenu, HighlightHdl, Menu*, EMPTYARG )
+{
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.highlight( aEvent );
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXMenu, ActivateHdl, Menu*, EMPTYARG )
+{
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.activate( aEvent );
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXMenu, DeactivateHdl, Menu*, EMPTYARG )
+{
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.deactivate( aEvent );
+ }
+ return 1;
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXMenu::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBar*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenu*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXMenu )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXMenu )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+void VCLXMenu::addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maMenuListeners.addInterface( rxListener );
+}
+
+void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maMenuListeners.removeInterface( rxListener );
+}
+
+void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mpMenu->InsertItem( nItemId, aText, (MenuItemBits)nItemStyle, nPos );
+}
+
+void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( nCount )
+ {
+ sal_uInt16 nP = (sal_uInt16) Min( sal_uInt32(nPos+nCount), (sal_uInt32)mpMenu->GetItemCount() );
+ for ( nP; nP; )
+ mpMenu->RemoveItem( --nP );
+ }
+}
+
+sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu->GetItemCount();
+}
+
+sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu->GetItemId( nPos );
+}
+
+sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu->GetItemPos( nId );
+}
+
+void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mpMenu->EnableItem( nItemId, bEnable );
+}
+
+sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu->IsItemEnabled( nItemId );
+}
+
+void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mpMenu->SetItemText( nItemId, aText );
+}
+
+::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu->GetItemText( nItemId );
+}
+
+void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ VCLXMenu* pVCLMenu = VCLXMenu::GetImplementation( rxPopupMenu );
+ DBG_ASSERT( pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu(), "setPopupMenu: Invalid Menu!" );
+
+ if ( pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu() )
+ {
+ // Selbst eine Ref halten!
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ;
+ *pNewRef = rxPopupMenu;
+ maPopupMenueRefs.Insert( pNewRef, LIST_APPEND );
+
+ mpMenu->SetPopupMenu( nItemId, (PopupMenu*) pVCLMenu->GetMenu() );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef;
+ Menu* pMenu = mpMenu->GetPopupMenu( nItemId );
+ if ( pMenu )
+ {
+ for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n );
+ Menu* pM = ((VCLXMenu*)pRef->get())->GetMenu();
+ if ( pM == pMenu )
+ {
+ aRef = *pRef;
+ break;
+ }
+ }
+ }
+ return aRef;
+}
+
+
+// ::com::sun::star::awt::XPopupMenu
+void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mpMenu->InsertSeparator( nPos );
+}
+
+void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mpMenu->SetDefaultItem( nItemId );
+}
+
+sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu->GetDefaultItem();
+}
+
+void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mpMenu->CheckItem( nItemId, bCheck );
+}
+
+sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu->IsItemChecked( nItemId );
+}
+
+sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int16 nRet = 0;
+ if ( IsPopupMenu() )
+ nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags );
+ return nRet;
+}
+
+
+
diff --git a/toolkit/source/awt/vclxpointer.cxx b/toolkit/source/awt/vclxpointer.cxx
new file mode 100644
index 000000000000..ed757ea4bf71
--- /dev/null
+++ b/toolkit/source/awt/vclxpointer.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxpointer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+// ----------------------------------------------------
+// class VCLXPointer
+// ----------------------------------------------------
+VCLXPointer::VCLXPointer()
+{
+}
+
+VCLXPointer::~VCLXPointer()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPointer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPointer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXPointer )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPointer )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+void VCLXPointer::setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maPointer = Pointer( (PointerStyle)nType );
+}
+
+sal_Int32 VCLXPointer::getType() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return (sal_Int32)maPointer.GetStyle();
+}
+
+
+
diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx
new file mode 100644
index 000000000000..e3f5e70e29bb
--- /dev/null
+++ b/toolkit/source/awt/vclxprinter.cxx
@@ -0,0 +1,474 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxprinter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxprinter.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+
+#include <vcl/print.hxx>
+#include <vcl/jobset.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+
+#include <toolkit/awt/vclxdevice.hxx>
+
+
+#define BINARYSETUPMARKER 0x23864691
+
+#define PROPERTY_Orientation 0
+#define PROPERTY_Horizontal 1
+
+::com::sun::star::beans::Property* ImplGetProperties( sal_uInt16& rElementCount )
+{
+ static ::com::sun::star::beans::Property* pProperties = NULL;
+ static sal_uInt16 nElements = 0;
+ if( !pProperties )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pProperties )
+ {
+ static ::com::sun::star::beans::Property __FAR_DATA aPropTable[] =
+ {
+ ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Orientation" ), PROPERTY_Orientation, ::getCppuType((const sal_Int16*)0), 0 ),
+ ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Horizontal" ), PROPERTY_Horizontal, ::getBooleanCppuType(), 0 )
+ };
+ pProperties = aPropTable;
+ nElements = sizeof( aPropTable ) / sizeof( ::com::sun::star::beans::Property );
+ }
+ }
+ rElementCount = nElements;
+ return pProperties;
+}
+
+// ----------------------------------------------------
+// class VCLXPrinterPropertySet
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPrinterPropertySet::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::beans::XMultiPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XFastPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySet*, (::cppu::OPropertySetHelper*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPrinterPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPrinterPropertySet )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterPropertySet>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
+ : OPropertySetHelper( BrdcstHelper )
+{
+ mpPrinter = new Printer( rPrinterName );
+ mnOrientation = 0;
+ mbHorizontal = sal_False;
+}
+
+VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
+{
+ delete mpPrinter;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice()
+{
+ if ( !mxPrnDevice.is() )
+ {
+ VCLXDevice* pDev = new VCLXDevice;
+ pDev->SetOutputDevice( GetPrinter() );
+ mxPrnDevice = pDev;
+ }
+ return mxPrnDevice;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXPrinterPropertySet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& VCLXPrinterPropertySet::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper* pPropertyArrayHelper = NULL;
+ if ( !pPropertyArrayHelper )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pPropertyArrayHelper )
+ {
+ sal_uInt16 nElements;
+ ::com::sun::star::beans::Property* pProps = ImplGetProperties( nElements );
+ pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( pProps, nElements, sal_False );
+ }
+ }
+ return *pPropertyArrayHelper ;
+}
+
+sal_Bool VCLXPrinterPropertySet::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_Bool bDifferent = sal_False;
+ switch ( nHandle )
+ {
+ case PROPERTY_Orientation:
+ {
+ sal_Int16 n;
+ if( ( rValue >>= n ) && ( n != mnOrientation ) )
+ {
+ rConvertedValue <<= n;
+ rOldValue <<= mnOrientation;
+ bDifferent = sal_True;
+ }
+ }
+ break;
+ case PROPERTY_Horizontal:
+ {
+ sal_Bool b;
+ if( ( rValue >>= b ) && ( b != mbHorizontal ) )
+ {
+ rConvertedValue <<= b;
+ rOldValue <<= mbHorizontal;
+ bDifferent = sal_True;
+ }
+ }
+ break;
+ default:
+ {
+ DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
+ }
+ }
+ return bDifferent;
+}
+
+void VCLXPrinterPropertySet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ switch( nHandle )
+ {
+ case PROPERTY_Orientation:
+ {
+ rValue >>= mnOrientation;
+ }
+ break;
+ case PROPERTY_Horizontal:
+ {
+ rValue >>= mbHorizontal;
+ }
+ break;
+ default:
+ {
+ DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
+ }
+ }
+}
+
+void VCLXPrinterPropertySet::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( ((VCLXPrinterPropertySet*)this)->Mutex );
+
+ switch( nHandle )
+ {
+ case PROPERTY_Orientation:
+ rValue <<= mnOrientation;
+ break;
+ case PROPERTY_Horizontal:
+ rValue <<= mbHorizontal;
+ break;
+ default:
+ {
+ DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
+ }
+ }
+}
+
+// ::com::sun::star::awt::XPrinterPropertySet
+void VCLXPrinterPropertySet::setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ ::com::sun::star::uno::Any aValue;
+ aValue <<= bHorizontal;
+ setFastPropertyValue( PROPERTY_Horizontal, aValue );
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterPropertySet::getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aDescriptions( nPaperBinCount );
+ for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ )
+ {
+ // Format: <DisplayFormName;FormNameId;DisplayPaperBinName;PaperBinNameId;DisplayPaperName;PaperNameId>
+ String aDescr( RTL_CONSTASCII_USTRINGPARAM( "*;*;" ) );
+ aDescr += GetPrinter()->GetPaperBinName( n );
+ aDescr += ';';
+ aDescr += n;
+ aDescr.AppendAscii( ";*;*", 4 );
+
+ aDescriptions.getArray()[n] = aDescr;
+ }
+ return aDescriptions;
+}
+
+void VCLXPrinterPropertySet::selectForm( const ::rtl::OUString& rFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_uInt16 nPaperBin = rFormDescription.getToken( 3, ';' ).toInt32();
+ GetPrinter()->SetPaperBin( nPaperBin );
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXPrinterPropertySet::getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ SvMemoryStream aMem;
+ aMem << BINARYSETUPMARKER;
+ aMem << GetPrinter()->GetJobSetup();
+ return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
+}
+
+void VCLXPrinterPropertySet::setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ SvMemoryStream aMem( (char*) data.getConstArray(), data.getLength(), STREAM_READ );
+ sal_uInt32 nMarker;
+ aMem >> nMarker;
+ DBG_ASSERT( nMarker == BINARYSETUPMARKER, "setBinarySetup - invalid!" );
+ if ( nMarker == BINARYSETUPMARKER )
+ {
+ JobSetup aSetup;
+ aMem >> aSetup;
+ GetPrinter()->SetJobSetup( aSetup );
+ }
+}
+
+
+// ----------------------------------------------------
+// class VCLXPrinter
+// ----------------------------------------------------
+VCLXPrinter::VCLXPrinter( const String& rPrinterName )
+ : VCLXPrinterPropertySet( rPrinterName )
+{
+}
+
+VCLXPrinter::~VCLXPrinter()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPrinter::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPrinter*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXPrinterPropertySet::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPrinter )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter>* ) NULL ),
+ VCLXPrinterPropertySet::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+sal_Bool VCLXPrinter::start( const ::rtl::OUString& rJobName, sal_Int16 nCopies, sal_Bool bCollate ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_Bool bDone = sal_True;
+ if ( GetPrinter() )
+ bDone = GetPrinter()->StartJob( rJobName );
+
+ return bDone;
+}
+
+void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ if ( GetPrinter() )
+ GetPrinter()->EndJob();
+}
+
+void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ if ( GetPrinter() )
+ GetPrinter()->AbortJob();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ if ( GetPrinter() )
+ GetPrinter()->StartPage();
+ return GetDevice();
+}
+
+void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ if ( GetPrinter() )
+ GetPrinter()->EndPage();
+}
+
+
+// ----------------------------------------------------
+// class VCLXInfoPrinter
+// ----------------------------------------------------
+
+VCLXInfoPrinter::VCLXInfoPrinter( const String& rPrinterName )
+ : VCLXPrinterPropertySet( rPrinterName )
+{
+}
+
+VCLXInfoPrinter::~VCLXInfoPrinter()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXInfoPrinter::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XInfoPrinter*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXPrinterPropertySet::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXInfoPrinter )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter>* ) NULL ),
+ VCLXPrinterPropertySet::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XInfoPrinter
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXInfoPrinter::createDevice( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ return GetDevice();
+}
+
+// ----------------------------------------------------
+// class VCLXPrinterServer
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPrinterServer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPrinterServer*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPrinterServer )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterServer>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XPrinterServer
+::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterServer::getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_uInt16 nPrinters = Printer::GetQueueCount();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( nPrinters );
+
+ for ( sal_uInt16 n = 0; n < nPrinters; n++ )
+ {
+ const QueueInfo& rInfo = Printer::GetQueueInfo( n );
+ aNames.getArray()[n] = rInfo.GetPrinterName();
+ }
+
+ return aNames;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > VCLXPrinterServer::createPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > xP;
+ xP = new VCLXPrinter( rPrinterName );
+ return xP;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > VCLXPrinterServer::createInfoPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > xP;
+ xP = new VCLXInfoPrinter( rPrinterName );
+ return xP;
+}
+
+
+
diff --git a/toolkit/source/awt/vclxregion.cxx b/toolkit/source/awt/vclxregion.cxx
new file mode 100644
index 000000000000..ed808b915b75
--- /dev/null
+++ b/toolkit/source/awt/vclxregion.cxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxregion.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxregion.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <vcl/svapp.hxx>
+
+// ----------------------------------------------------
+// class VCLXRegion
+// ----------------------------------------------------
+VCLXRegion::VCLXRegion()
+{
+}
+
+VCLXRegion::~VCLXRegion()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXRegion::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XRegion*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXRegion )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXRegion )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+
+::com::sun::star::awt::Rectangle VCLXRegion::getBounds() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return AWTRectangle( maRegion.GetBoundRect() );
+}
+
+void VCLXRegion::clear() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.SetEmpty();
+}
+
+void VCLXRegion::move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Move( nHorzMove, nVertMove );
+}
+
+void VCLXRegion::unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Union( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Intersect( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Exclude( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.XOr( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.Union( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+void VCLXRegion::intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.Intersect( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+void VCLXRegion::excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.Exclude( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+void VCLXRegion::xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.XOr( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > VCLXRegion::getRectangles() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ULONG nRects = maRegion.GetRectCount();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects( nRects );
+
+ Rectangle aRect;
+ sal_uInt32 nR = 0;
+ RegionHandle h = maRegion.BeginEnumRects();
+ while ( maRegion.GetNextEnumRect( h, aRect ) )
+ aRects.getArray()[nR++] = AWTRectangle( aRect );
+ maRegion.EndEnumRects( h );
+
+ return aRects;
+}
+
+
+
diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx
new file mode 100644
index 000000000000..a25fa6b5ff72
--- /dev/null
+++ b/toolkit/source/awt/vclxsystemdependentwindow.cxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxsystemdependentwindow.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _COM_SUN_STAR_LANG_SYSTEMDEPENDENT_HPP_
+#include <com/sun/star/lang/SystemDependent.hpp>
+#endif
+
+#if defined UNX && ! defined _COM_SUN_STAR_AWT_SYSTEMDEPENDENTXWINDOW_HPP_
+#include <com/sun/star/awt/SystemDependentXWindow.hpp>
+#endif
+
+#include <toolkit/awt/vclxsystemdependentwindow.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#ifndef UNX
+#include <tools/prewin.h>
+#include <windows.h>
+#include <tools/postwin.h>
+#endif
+
+#include <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
+
+// ----------------------------------------------------
+// class VCLXSystemDependentWindow
+// ----------------------------------------------------
+VCLXSystemDependentWindow::VCLXSystemDependentWindow()
+{
+}
+
+VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Any VCLXSystemDependentWindow::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // TODO, check the process id
+ ::com::sun::star::uno::Any aRet;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ const SystemEnvData* pSysData = ((SystemChildWindow *)pWindow)->GetSystemData();
+ if( pSysData )
+ {
+#ifdef UNX
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
+ {
+ ::com::sun::star::awt::SystemDependentXWindow aSD;
+ aSD.DisplayPointer = (sal_Int64)pSysData->pDisplay;
+ aSD.WindowHandle = pSysData->aWindow;
+ aRet <<= aSD;
+ }
+#elif (defined WNT)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
+ {
+ aRet <<= (sal_Int32)pSysData->hWnd;
+ }
+#elif (defined OS2)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 )
+ {
+ aRet <<= (sal_Int32)pSysData->hWnd;
+ }
+#endif
+ }
+ }
+ return aRet;
+}
+
+
+
+
+
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
new file mode 100644
index 000000000000..6113d7c03a07
--- /dev/null
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -0,0 +1,737 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxtoolkit.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_WINDOWCLASS_HPP_
+#include <com/sun/star/awt/WindowClass.hpp>
+#endif
+
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/awt/vclxsystemdependentwindow.hxx>
+#include <toolkit/awt/vclxregion.hxx>
+#include <toolkit/awt/vclxtoolkit.hxx>
+#include <toolkit/awt/vclxtopwindow.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <vcl/btndlg.hxx>
+#include <vcl/button.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/dockwin.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/floatwin.hxx>
+#include <vcl/group.hxx>
+#include <vcl/imgctrl.hxx>
+#include <vcl/longcurr.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/morebtn.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/spin.hxx>
+#include <vcl/split.hxx>
+#include <vcl/splitwin.hxx>
+#include <vcl/status.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/syschild.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabdlg.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wrkwin.hxx>
+
+#include <tools/debug.hxx>
+
+
+
+#define VCLWINDOW_FRAMEWINDOW 0x1000
+#define VCLWINDOW_SYSTEMCHILDWINDOW 0x1001
+
+
+sal_uInt32 ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt16 nCompType )
+{
+ sal_uInt32 nWinBits = 0;
+
+ sal_Bool bMessBox = sal_False;
+ if ( ( nCompType == WINDOW_INFOBOX ) ||
+ ( nCompType == WINDOW_MESSBOX ) ||
+ ( nCompType == WINDOW_QUERYBOX ) ||
+ ( nCompType == WINDOW_WARNINGBOX ) ||
+ ( nCompType == WINDOW_ERRORBOX ) )
+ {
+ bMessBox = sal_True;
+ }
+
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::BORDER )
+ nWinBits |= WB_BORDER;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER )
+ nWinBits |= WB_NOBORDER;
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::SIZEABLE )
+ nWinBits |= WB_SIZEABLE;
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::MOVEABLE )
+ nWinBits |= WB_MOVEABLE;
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::CLOSEABLE )
+ nWinBits |= WB_CLOSEABLE;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL )
+ nWinBits |= WB_HSCROLL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL )
+ nWinBits |= WB_VSCROLL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::LEFT )
+ nWinBits |= WB_LEFT;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CENTER )
+ nWinBits |= WB_CENTER;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT )
+ nWinBits |= WB_RIGHT;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SPIN )
+ nWinBits |= WB_SPIN;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SORT )
+ nWinBits |= WB_SORT;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN )
+ nWinBits |= WB_DROPDOWN;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEFBUTTON )
+ nWinBits |= WB_DEFBUTTON;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::READONLY )
+ nWinBits |= WB_READONLY;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CLIPCHILDREN )
+ nWinBits |= WB_CLIPCHILDREN;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::GROUP )
+ nWinBits |= WB_GROUP;
+
+ // These bits are not uniqe
+ if ( bMessBox )
+ {
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK )
+ nWinBits |= WB_OK;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK_CANCEL )
+ nWinBits |= WB_OK_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO )
+ nWinBits |= WB_YES_NO;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO_CANCEL )
+ nWinBits |= WB_YES_NO_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RETRY_CANCEL )
+ nWinBits |= WB_RETRY_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_OK )
+ nWinBits |= WB_DEF_OK;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_CANCEL )
+ nWinBits |= WB_DEF_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_RETRY )
+ nWinBits |= WB_DEF_RETRY;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_YES )
+ nWinBits |= WB_DEF_YES;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO )
+ nWinBits |= WB_DEF_NO;
+ }
+
+ return nWinBits;
+}
+
+struct ComponentInfo
+{
+ const char* pName;
+ WindowType nWinType;
+};
+
+static ComponentInfo __FAR_DATA aComponentInfos [] =
+{
+ { "buttondialog", WINDOW_BUTTONDIALOG },
+ { "cancelbutton", WINDOW_CANCELBUTTON },
+ { "checkbox", WINDOW_CHECKBOX },
+ { "combobox", WINDOW_COMBOBOX },
+ { "control", WINDOW_CONTROL },
+ { "currencybox", WINDOW_CURRENCYBOX },
+ { "currencyfield", WINDOW_CURRENCYFIELD },
+ { "datebox", WINDOW_DATEBOX },
+ { "datefield", WINDOW_DATEFIELD },
+ { "dialog", WINDOW_DIALOG },
+ { "dockingwindow", WINDOW_DOCKINGWINDOW },
+ { "edit", WINDOW_EDIT },
+ { "errorbox", WINDOW_ERRORBOX },
+ { "fixedbitmap", WINDOW_FIXEDBITMAP },
+ { "fixedimage", WINDOW_FIXEDIMAGE },
+ { "fixedline", WINDOW_FIXEDLINE },
+ { "fixedtext", WINDOW_FIXEDTEXT },
+ { "floatingwindow", WINDOW_FLOATINGWINDOW },
+ { "framewindow", VCLWINDOW_FRAMEWINDOW },
+ { "groupbox", WINDOW_GROUPBOX },
+ { "helpbutton", WINDOW_HELPBUTTON },
+ { "imagebutton", WINDOW_IMAGEBUTTON },
+ { "imageradiobutton", WINDOW_IMAGERADIOBUTTON },
+ { "infobox", WINDOW_INFOBOX },
+ { "listbox", WINDOW_LISTBOX },
+ { "longcurrencybox", WINDOW_LONGCURRENCYBOX },
+ { "longcurrencyfield", WINDOW_LONGCURRENCYFIELD },
+ { "menubutton", WINDOW_MENUBUTTON },
+ { "messbox", WINDOW_MESSBOX },
+ { "metricbox", WINDOW_METRICBOX },
+ { "metricfield", WINDOW_METRICFIELD },
+ { "modaldialog", WINDOW_MODALDIALOG },
+ { "modelessdialog", WINDOW_MODELESSDIALOG },
+ { "morebutton", WINDOW_MOREBUTTON },
+ { "multilistbox", WINDOW_MULTILISTBOX },
+ { "numericbox", WINDOW_NUMERICBOX },
+ { "numericfield", WINDOW_NUMERICFIELD },
+ { "okbutton", WINDOW_OKBUTTON },
+ { "patternbox", WINDOW_PATTERNBOX },
+ { "patternfield", WINDOW_PATTERNFIELD },
+ { "pushbutton", WINDOW_PUSHBUTTON },
+ { "querybox", WINDOW_QUERYBOX },
+ { "radiobutton", WINDOW_RADIOBUTTON },
+ { "scrollbar", WINDOW_SCROLLBAR },
+ { "scrollbarbox", WINDOW_SCROLLBARBOX },
+ { "spinbutton", WINDOW_SPINBUTTON },
+ { "spinfield", WINDOW_SPINFIELD },
+ { "splitter", WINDOW_SPLITTER },
+ { "splitwindow", WINDOW_SPLITWINDOW },
+ { "statusbar", WINDOW_STATUSBAR },
+ { "systemchildwindow", VCLWINDOW_SYSTEMCHILDWINDOW },
+ { "tabcontrol", WINDOW_TABCONTROL },
+ { "tabdialog", WINDOW_TABDIALOG },
+ { "tabpage", WINDOW_TABPAGE },
+ { "timebox", WINDOW_TIMEBOX },
+ { "timefield", WINDOW_TIMEFIELD },
+ { "toolbox", WINDOW_TOOLBOX },
+ { "tristatebox", WINDOW_TRISTATEBOX },
+ { "warningbox", WINDOW_WARNINGBOX },
+ { "window", WINDOW_WINDOW },
+ { "workwindow", WINDOW_WORKWINDOW }
+};
+
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+_Optlink
+#endif
+ ComponentInfoCompare( const void* pFirst, const void* pSecond)
+{
+ return( strcmp( ((ComponentInfo*)pFirst)->pName,
+ ((ComponentInfo*)pSecond)->pName ) );
+}
+
+sal_uInt16 ImplGetComponentType( const String& rServiceName )
+{
+ static sal_Bool bSorted = sal_False;
+ if( !bSorted )
+ {
+ qsort( (void*) aComponentInfos,
+ sizeof( aComponentInfos ) / sizeof( ComponentInfo ),
+ sizeof( ComponentInfo ),
+ ComponentInfoCompare );
+ bSorted = sal_True;
+ }
+
+
+ ComponentInfo aSearch;
+ ByteString aServiceName( rServiceName, gsl_getSystemTextEncoding() );
+ aServiceName.ToLowerAscii();
+ if ( aServiceName.Len() )
+ aSearch.pName = aServiceName.GetBuffer();
+ else
+ aSearch.pName = "window";
+
+ ComponentInfo* pInf = (ComponentInfo*) bsearch( &aSearch,
+ (void*) aComponentInfos,
+ sizeof( aComponentInfos ) / sizeof( ComponentInfo ),
+ sizeof( ComponentInfo ),
+ ComponentInfoCompare );
+
+ return pInf ? pInf->nWinType : 0;
+}
+
+
+// ----------------------------------------------------
+// class VCLXToolkit
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXToolkit::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::XToolkit*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXToolkit )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef;
+ // 07/00: AppWindow doesn't exist anymore...
+ return xRef;
+}
+
+::com::sun::star::awt::Rectangle VCLXToolkit::getWorkArea( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::Rectangle aRect;
+ // 07/00: AppWindow doesn't exist anymore...
+ return aRect;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createWindow( const ::com::sun::star::awt::WindowDescriptor& rDescriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef;
+
+ Window* pParent = NULL;
+ if ( rDescriptor.Parent.is() )
+ {
+ VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent );
+ DBG_ASSERT( pParentComponent, "ParentComponent not valid" );
+ if ( pParentComponent )
+ pParent = pParentComponent->GetWindow();
+ }
+
+ sal_uInt32 nWinBits = ImplGetWinBits( rDescriptor.WindowAttributes,
+ ImplGetComponentType( rDescriptor.WindowServiceName ) );
+
+ VCLXWindow* pNewComp = NULL;
+ Window* pNewWindow = CreateComponent( &pNewComp, rDescriptor, pParent, nWinBits );
+
+ DBG_ASSERT( pNewWindow, "createComponent: Unknown Component!" );
+ DBG_ASSERTWARNING( pNewComp, "createComponent: No special Interface!" );
+
+ if ( pNewWindow )
+ {
+ pNewWindow->SetCreatedWithToolkit( sal_True );
+ pNewWindow->SetPosPixel( Point() );
+
+ if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::MINSIZE )
+ {
+ pNewWindow->SetSizePixel( Size() );
+ }
+ else if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::FULLSIZE )
+ {
+ if ( pParent )
+ pNewWindow->SetSizePixel( pParent->GetOutputSizePixel() );
+ }
+ else if ( !VCLUnoHelper::IsZero( rDescriptor.Bounds ) )
+ {
+ Rectangle aRect = VCLRectangle( rDescriptor.Bounds );
+ pNewWindow->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+ }
+
+ if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::SHOW )
+ pNewWindow->Show();
+
+ if ( !pNewComp )
+ {
+ // Default-Interface
+ xRef = pNewWindow->GetComponentInterface( sal_True );
+ }
+ else
+ {
+ pNewWindow->SetComponentInterface( pNewComp );
+ xRef = pNewComp;
+ }
+ }
+
+ return xRef;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > VCLXToolkit::createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& rDescriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nComponents = rDescriptors.getLength();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > aSeq( nComponents );
+ for ( sal_uInt32 n = 0; n < nComponents; n++ )
+ {
+ ::com::sun::star::awt::WindowDescriptor aDescr = rDescriptors.getConstArray()[n];
+
+ if ( aDescr.ParentIndex == (-1) )
+ aDescr.Parent = NULL;
+ else if ( ( aDescr.ParentIndex >= 0 ) && ( aDescr.ParentIndex < (short)n ) )
+ aDescr.Parent = aSeq.getConstArray()[aDescr.ParentIndex];
+ aSeq.getArray()[n] = createWindow( aDescr );
+ }
+ return aSeq;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXToolkit::createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef;
+ VCLXVirtualDevice* pVDev = new VCLXVirtualDevice;
+ VirtualDevice* pV = new VirtualDevice;
+ pV->SetOutputSizePixel( Size( Width, Height ) );
+ pVDev->SetVirtualDevice( pV );
+
+ xRef = pVDev;
+ return xRef;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > VCLXToolkit::createRegion( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > xRef = new VCLXRegion;
+ return xRef;
+}
+
+Window* VCLXToolkit::CreateComponent( VCLXWindow** ppNewComp,
+ const ::com::sun::star::awt::WindowDescriptor& rDescriptor, Window* pParent, sal_uInt32 nWinBits )
+{
+ String aServiceName( rDescriptor.WindowServiceName );
+ aServiceName.ToLowerAscii();
+
+ Window* pNewWindow = NULL;
+ sal_uInt16 nType = ImplGetComponentType( aServiceName );
+
+ if ( !pParent )
+ {
+ // Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
+ // spaeter mal ::com::sun::star::uno::Exception...
+ sal_Bool bException = sal_True;
+ if ( ( nType == WINDOW_DIALOG ) || ( nType == WINDOW_MODALDIALOG ) || ( nType == WINDOW_MODELESSDIALOG ) )
+ bException = sal_False;
+ else if ( ( nType == WINDOW_WINDOW ) ||
+ ( nType == WINDOW_WORKWINDOW ) ||
+ ( nType == VCLWINDOW_FRAMEWINDOW ) )
+ {
+ if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
+ bException = sal_False;
+ }
+
+ if ( bException )
+ {
+ *ppNewComp = NULL;
+ return NULL;
+ }
+ }
+
+ if ( nType )
+ {
+ NAMESPACE_VOS(OGuard) aVclGuard( Application::GetSolarMutex() );
+ switch ( (WindowType)nType )
+ {
+ case WINDOW_CANCELBUTTON:
+ pNewWindow = new CancelButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_CHECKBOX:
+ pNewWindow = new CheckBox( pParent, nWinBits );
+ *ppNewComp = new VCLXCheckBox;
+ break;
+ case WINDOW_COMBOBOX:
+ pNewWindow = new ComboBox( pParent, nWinBits );
+ ((ComboBox*)pNewWindow)->EnableAutoSize( sal_False );
+ *ppNewComp = new VCLXComboBox;
+ break;
+ case WINDOW_CURRENCYBOX:
+ pNewWindow = new CurrencyBox( pParent, nWinBits );
+ break;
+ case WINDOW_CURRENCYFIELD:
+ pNewWindow = new CurrencyField( pParent, nWinBits );
+ static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXNumericField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(CurrencyField*)pNewWindow );
+ break;
+ case WINDOW_DATEBOX:
+ pNewWindow = new DateBox( pParent, nWinBits );
+ break;
+ case WINDOW_DATEFIELD:
+ pNewWindow = new DateField( pParent, nWinBits );
+ static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXDateField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pNewWindow );
+ break;
+ case WINDOW_DIALOG:
+ pNewWindow = new Dialog( pParent, nWinBits );
+ *ppNewComp = new VCLXDialog;
+ break;
+ case WINDOW_EDIT:
+ pNewWindow = new Edit( pParent, nWinBits );
+ *ppNewComp = new VCLXEdit;
+ break;
+ case WINDOW_ERRORBOX:
+ pNewWindow = new ErrorBox( pParent, nWinBits, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_FIXEDBITMAP:
+ pNewWindow = new FixedBitmap( pParent, nWinBits );
+ break;
+ case WINDOW_FIXEDIMAGE:
+ pNewWindow = new ImageControl( pParent, nWinBits );
+ *ppNewComp = new VCLXImageControl;
+ break;
+ case WINDOW_FIXEDLINE:
+ pNewWindow = new FixedLine( pParent, nWinBits );
+ break;
+ case WINDOW_FIXEDTEXT:
+ pNewWindow = new FixedText( pParent, nWinBits );
+ *ppNewComp = new VCLXFixedText;
+ break;
+ case WINDOW_FLOATINGWINDOW:
+ pNewWindow = new FloatingWindow( pParent, nWinBits );
+ break;
+ case WINDOW_GROUPBOX:
+ pNewWindow = new GroupBox( pParent, nWinBits );
+ break;
+ case WINDOW_HELPBUTTON:
+ pNewWindow = new HelpButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_IMAGEBUTTON:
+ pNewWindow = new ImageButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_IMAGERADIOBUTTON:
+ pNewWindow = new ImageRadioButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_INFOBOX:
+ pNewWindow = new InfoBox( pParent, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_LISTBOX:
+ pNewWindow = new ListBox( pParent, nWinBits );
+ ((ListBox*)pNewWindow)->EnableAutoSize( sal_False );
+ *ppNewComp = new VCLXListBox;
+ break;
+ case WINDOW_LONGCURRENCYBOX:
+ pNewWindow = new LongCurrencyBox( pParent, nWinBits );
+ break;
+ case WINDOW_LONGCURRENCYFIELD:
+ pNewWindow = new LongCurrencyField( pParent, nWinBits );
+ *ppNewComp = new VCLXCurrencyField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(LongCurrencyField*)pNewWindow );
+ break;
+ case WINDOW_MENUBUTTON:
+ pNewWindow = new MenuButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_MESSBOX:
+ pNewWindow = new MessBox( pParent, nWinBits, String(), String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_METRICBOX:
+ pNewWindow = new MetricBox( pParent, nWinBits );
+ break;
+ case WINDOW_METRICFIELD:
+ pNewWindow = new MetricField( pParent, nWinBits );
+ break;
+ case WINDOW_MODALDIALOG:
+ case WINDOW_MODELESSDIALOG:
+ // Modal/Modeless nur durch Show/Execute
+ pNewWindow = new Dialog( pParent, nWinBits );
+ *ppNewComp = new VCLXDialog;
+ break;
+ case WINDOW_MOREBUTTON:
+ pNewWindow = new MoreButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_MULTILISTBOX:
+ pNewWindow = new MultiListBox( pParent, nWinBits );
+ *ppNewComp = new VCLXListBox;
+ break;
+ case WINDOW_NUMERICBOX:
+ pNewWindow = new NumericBox( pParent, nWinBits );
+ break;
+ case WINDOW_NUMERICFIELD:
+ pNewWindow = new NumericField( pParent, nWinBits );
+ static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXNumericField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(NumericField*)pNewWindow );
+ break;
+ case WINDOW_OKBUTTON:
+ pNewWindow = new OKButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_PATTERNBOX:
+ pNewWindow = new PatternBox( pParent, nWinBits );
+ break;
+ case WINDOW_PATTERNFIELD:
+ pNewWindow = new PatternField( pParent, nWinBits );
+ *ppNewComp = new VCLXPatternField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(PatternField*)pNewWindow );
+ break;
+ case WINDOW_PUSHBUTTON:
+ pNewWindow = new PushButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_QUERYBOX:
+ pNewWindow = new QueryBox( pParent, nWinBits, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_RADIOBUTTON:
+ pNewWindow = new RadioButton( pParent, nWinBits );
+ *ppNewComp = new VCLXRadioButton;
+ break;
+ case WINDOW_SCROLLBAR:
+ pNewWindow = new ScrollBar( pParent, nWinBits );
+ *ppNewComp = new VCLXScrollBar;
+ break;
+ case WINDOW_SCROLLBARBOX:
+ pNewWindow = new ScrollBarBox( pParent, nWinBits );
+ break;
+ case WINDOW_SPINBUTTON:
+ pNewWindow = new SpinButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_SPINFIELD:
+ pNewWindow = new SpinField( pParent, nWinBits );
+ *ppNewComp = new VCLXNumericField;
+ break;
+ case WINDOW_SPLITTER:
+ pNewWindow = new Splitter( pParent, nWinBits );
+ break;
+ case WINDOW_SPLITWINDOW:
+ pNewWindow = new SplitWindow( pParent, nWinBits );
+ break;
+ case WINDOW_STATUSBAR:
+ pNewWindow = new StatusBar( pParent, nWinBits );
+ break;
+ case VCLWINDOW_SYSTEMCHILDWINDOW:
+ pNewWindow = new SystemChildWindow( pParent, nWinBits );
+ *ppNewComp = new VCLXSystemDependentWindow();
+ break;
+ case WINDOW_TABCONTROL:
+ pNewWindow = new TabControl( pParent, nWinBits );
+ break;
+ case WINDOW_TABDIALOG:
+ pNewWindow = new TabDialog( pParent, nWinBits );
+ break;
+ case WINDOW_TABPAGE:
+ pNewWindow = new TabPage( pParent, nWinBits );
+ break;
+ case WINDOW_TIMEBOX:
+ pNewWindow = new TimeBox( pParent, nWinBits );
+ break;
+ case WINDOW_TIMEFIELD:
+ pNewWindow = new TimeField( pParent, nWinBits );
+ static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXTimeField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(TimeField*)pNewWindow );
+ break;
+ case WINDOW_TOOLBOX:
+ pNewWindow = new ToolBox( pParent, nWinBits );
+ break;
+ case WINDOW_TRISTATEBOX:
+ pNewWindow = new TriStateBox( pParent, nWinBits );
+ break;
+ case WINDOW_WARNINGBOX:
+ pNewWindow = new WarningBox( pParent, nWinBits, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_WORKWINDOW:
+ case WINDOW_WINDOW:
+ case VCLWINDOW_FRAMEWINDOW:
+ case WINDOW_DOCKINGWINDOW:
+ if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
+ {
+ if (nType == WINDOW_DOCKINGWINDOW )
+ pNewWindow = new DockingWindow( pParent, nWinBits );
+ else
+ pNewWindow = new WorkWindow( pParent, nWinBits );
+ *ppNewComp = new VCLXTopWindow;
+ }
+ else if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_CONTAINER )
+ {
+ if (nType == WINDOW_DOCKINGWINDOW )
+ pNewWindow = new DockingWindow( pParent, nWinBits );
+ else
+ pNewWindow = new Window( pParent, nWinBits );
+ *ppNewComp = new VCLXContainer;
+ }
+ else
+ {
+ if (nType == WINDOW_DOCKINGWINDOW )
+ pNewWindow = new DockingWindow( pParent, nWinBits );
+ else
+ pNewWindow = new Window( pParent, nWinBits );
+ *ppNewComp = new VCLXWindow;
+ }
+ break;
+ default: DBG_ERROR( "UNO3!" );
+ }
+ }
+
+ return pNewWindow;
+}
+
+
+
diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx
new file mode 100644
index 000000000000..1154210da61e
--- /dev/null
+++ b/toolkit/source/awt/vclxtopwindow.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxtopwindow.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <cppuhelper/typeprovider.hxx>
+
+#include <toolkit/awt/vclxtopwindow.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/helper/macros.hxx>
+
+#include <vcl/wrkwin.hxx>
+#include <vcl/syswin.hxx>
+#include <vcl/menu.hxx>
+
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class VCLXTopWindow
+// ----------------------------------------------------
+
+VCLXTopWindow::VCLXTopWindow()
+{
+}
+
+VCLXTopWindow::~VCLXTopWindow()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXTopWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXTopWindow )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ),
+ VCLXContainer::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+void VCLXTopWindow::addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetTopWindowListeners().addInterface( rxListener );
+}
+
+void VCLXTopWindow::removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetTopWindowListeners().removeInterface( rxListener );
+}
+
+void VCLXTopWindow::toFront( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ ((WorkWindow*)pWindow)->ToTop();
+}
+
+void VCLXTopWindow::toBack( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ // ((WorkWindow*)pWindow)->ToBack();
+ DBG_ERROR( "toBack niy" );
+ }
+}
+
+void VCLXTopWindow::setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& rxMenu ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SystemWindow* pWindow = (SystemWindow*) GetWindow();
+ if ( pWindow )
+ {
+ pWindow->SetMenuBar( NULL );
+ if ( rxMenu.is() )
+ {
+ VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu );
+ if ( pMenu && !pMenu->IsPopupMenu() )
+ pWindow->SetMenuBar( (MenuBar*) pMenu->GetMenu() );
+ }
+ }
+ mxMenuBar = rxMenu;
+}
+
+
+
+
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
new file mode 100644
index 000000000000..f4d2f72e205e
--- /dev/null
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -0,0 +1,920 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxwindow.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_STYLE_HPP_
+#include <com/sun/star/awt/Style.hpp>
+#endif
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/property.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <tools/color.hxx>
+
+// ----------------------------------------------------
+// class VCLXWindow
+// ----------------------------------------------------
+VCLXWindow::VCLXWindow()
+ : maEventListeners( *this ),
+ maFocusListeners( *this ),
+ maWindowListeners( *this ),
+ maKeyListeners( *this ),
+ maMouseListeners( *this ),
+ maMouseMotionListeners( *this ),
+ maPaintListeners( *this ),
+ maContainerListeners( *this ),
+ maTopWindowListeners( *this )
+{
+ mbDisposing = sal_False;
+ mbDesignMode = sal_False;
+}
+
+VCLXWindow::~VCLXWindow()
+{
+ if ( GetWindow() )
+ GetWindow()->SetWindowPeer( NULL, NULL );
+}
+
+void VCLXWindow::SetWindow( Window* pWindow )
+{
+ SetOutputDevice( pWindow );
+}
+
+Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const
+{
+ Size aSz = rOutSz;
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ sal_Int32 nLeft, nTop, nRight, nBottom;
+ pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
+ aSz.Width() += nLeft+nRight;
+ aSz.Height() += nTop+nBottom;
+ }
+ return aSz;
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, (::com::sun::star::awt::XWindow*)this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XWindow*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XWindowPeer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XVclWindowPeer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XView*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXDevice::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXWindow )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXWindow )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ),
+ VCLXDevice::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+// ::com::sun::star::lang::Component
+void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mxViewGraphics = NULL;
+
+ if ( GetWindow() && !mbDisposing )
+ {
+ mbDisposing = sal_True;
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+
+ maEventListeners.disposeAndClear( aObj );
+ maFocusListeners.disposeAndClear( aObj );
+ maWindowListeners.disposeAndClear( aObj );
+ maKeyListeners.disposeAndClear( aObj );
+ maMouseListeners.disposeAndClear( aObj );
+ maMouseMotionListeners.disposeAndClear( aObj );
+ maPaintListeners.disposeAndClear( aObj );
+ maContainerListeners.disposeAndClear( aObj );
+ maTopWindowListeners.disposeAndClear( aObj );
+
+ OutputDevice* pOutDev = GetOutputDevice();
+ SetWindow( NULL ); // Damit ggf. Handler abgemeldet werden (virtuell).
+ SetOutputDevice( pOutDev );
+ DestroyOutputDevice();
+
+ mbDisposing = sal_False;
+ }
+}
+
+void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetEventListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetEventListeners().removeInterface( rxListener );
+}
+
+
+// ::com::sun::star::awt::XWindow
+void VCLXWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->SetPosSizePixel( X, Y, Width, Height, Flags );
+}
+
+::com::sun::star::awt::Rectangle VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Rectangle aBounds;
+ if ( GetWindow() )
+ aBounds = AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
+
+ return aBounds;
+}
+
+void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ if ( bVisible )
+ {
+ // #57167# TopWindows mit unsichtbaren Parent anzeigen...
+ ::com::sun::star::uno::Any aTest = queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >*) 0 ) );
+ if ( aTest.hasValue() )
+ {
+ Window* pParent = pWindow->GetWindow( WINDOW_PARENTOVERLAP );
+ if ( pParent && !pParent->IsReallyVisible() )
+ pWindow->SetParent( pWindow->GetWindow( WINDOW_FRAME ) );
+ }
+ }
+
+ pWindow->Show( bVisible );
+ }
+}
+
+void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->Enable( bEnable );
+}
+
+void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->GrabFocus();
+}
+
+void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetWindowListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetWindowListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetFocusListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetFocusListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetKeyListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetKeyListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetMouseListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetMouseListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetMouseMotionListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetMouseMotionListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetPaintListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetPaintListeners().removeInterface( rxListener );
+}
+
+// ::com::sun::star::awt::XWindowPeer
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xRef = Application::GetVCLToolkit();
+ return xRef;
+}
+
+void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& rxPointer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer );
+ if ( pPointer )
+ {
+ mxPointer = rxPointer;
+ if ( GetWindow() )
+ GetWindow()->SetPointer( pPointer->GetPointer() );
+ }
+}
+
+void VCLXWindow::setBackground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ Color aColor( (sal_uInt32)nColor );
+ GetWindow()->SetBackground( aColor );
+ GetWindow()->SetControlBackground( aColor );
+
+ WindowType eWinType = GetWindow()->GetType();
+ if ( ( eWinType == WINDOW_WINDOW ) ||
+ ( eWinType == WINDOW_WORKWINDOW ) ||
+ ( eWinType == WINDOW_FLOATINGWINDOW ) )
+ {
+ GetWindow()->Invalidate();
+ }
+ }
+}
+
+void VCLXWindow::invalidate( sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->Invalidate( (sal_uInt16) nFlags );
+}
+
+void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle& rRect, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->Invalidate( VCLRectangle(rRect), (sal_uInt16) nFlags );
+}
+
+
+// ::com::sun::star::awt::XVclWindowPeer
+sal_Bool VCLXWindow::isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Bool bIsChild = sal_False;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ Window* pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
+ bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow );
+ }
+
+ return bIsChild;
+}
+
+void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mbDesignMode = bOn;
+}
+
+sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ return mbDesignMode;
+}
+
+void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->EnableClipSiblings( bClip );
+}
+
+void VCLXWindow::setForeground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ Color aColor( (sal_uInt32)nColor );
+ GetWindow()->SetControlForeground( aColor );
+ }
+}
+
+void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor& rFont ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont, GetWindow()->GetControlFont() ) );
+}
+
+void VCLXWindow::getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
+
+ switch ( nType )
+ {
+ case ::com::sun::star::awt::Style::FRAME:
+ {
+ Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
+ ForegroundColor = rStyleSettings.GetWindowTextColor().GetColor();
+ BackgroundColor = rStyleSettings.GetWindowColor().GetColor();
+ }
+ break;
+ case ::com::sun::star::awt::Style::DIALOG:
+ {
+ Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
+ ForegroundColor = rStyleSettings.GetDialogTextColor().GetColor();
+ BackgroundColor = rStyleSettings.GetDialogColor().GetColor();
+ }
+ break;
+ default: DBG_ERROR( "VCLWindow::getStyles() - unknown Type" );
+ }
+
+ }
+}
+
+void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ WindowType eWinType = pWindow->GetType();
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_ENABLED:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pWindow->Enable( b );
+ }
+ break;
+ case BASEPROPERTY_TEXT:
+ case BASEPROPERTY_LABEL:
+ {
+ ::rtl::OUString aText;
+ if ( Value >>= aText )
+ pWindow->SetText( aText );
+ }
+ break;
+ case BASEPROPERTY_HELPURL:
+ {
+ ::rtl::OUString aURL;
+ if ( Value >>= aURL )
+ {
+ String aHelpURL( aURL );
+ String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
+ if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL )
+ {
+ String aID = aHelpURL.Copy( aPattern.Len() );
+ pWindow->SetHelpId( aID.ToInt32() );
+ }
+ }
+ }
+ break;
+ case BASEPROPERTY_FONTDESCRIPTOR:
+ {
+ if ( bVoid )
+ pWindow->SetControlFont( Font() );
+ else
+ {
+ ::com::sun::star::awt::FontDescriptor aFont;
+ if ( Value >>= aFont )
+ pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) );
+ }
+ }
+ break;
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ if ( bVoid )
+ {
+ pWindow->SetControlBackground();
+ }
+ else
+ {
+ sal_Int32 nColor;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetBackground( aColor );
+ pWindow->SetControlBackground( aColor );
+ pWindow->Invalidate(); // Falls das Control nicht drauf reagiert
+ }
+ }
+ break;
+ case BASEPROPERTY_TEXTCOLOR:
+ if ( bVoid )
+ {
+ pWindow->SetControlForeground();
+ }
+ else
+ {
+ sal_Int32 nColor;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetTextColor( aColor );
+ pWindow->SetControlForeground( aColor );
+ }
+ }
+ break;
+ case BASEPROPERTY_FILLCOLOR:
+ if ( bVoid )
+ pWindow->SetFillColor();
+ else
+ {
+ sal_Int32 nColor;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetFillColor( aColor );
+ }
+ }
+ break;
+ case BASEPROPERTY_LINECOLOR:
+ if ( bVoid )
+ pWindow->SetLineColor();
+ else
+ {
+ sal_Int32 nColor;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetLineColor( aColor );
+ }
+ }
+ break;
+ case BASEPROPERTY_BORDER:
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ sal_uInt16 nBorder;
+ Value >>= nBorder;
+ if ( !nBorder )
+ {
+ pWindow->SetStyle( nStyle & ~WB_BORDER );
+ }
+ else
+ {
+ pWindow->SetStyle( nStyle | WB_BORDER );
+ pWindow->SetBorderStyle( nBorder );
+ }
+ }
+ break;
+ case BASEPROPERTY_TABSTOP:
+ {
+ WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP;
+ if ( !bVoid )
+ {
+ sal_Bool bTab;
+ Value >>= bTab;
+ if ( bTab )
+ nStyle |= WB_TABSTOP;
+ else
+ nStyle |= WB_NOTABSTOP;
+ }
+ pWindow->SetStyle( nStyle );
+ }
+ break;
+ case BASEPROPERTY_ALIGN:
+ {
+ switch ( eWinType )
+ {
+ case WINDOW_FIXEDTEXT:
+ case WINDOW_EDIT:
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
+ sal_uInt16 nAlign = 0;
+ if ( !bVoid )
+ Value >>= nAlign;
+ if ( nAlign == PROPERTY_ALIGN_LEFT )
+ nStyle |= WB_LEFT;
+ else if ( nAlign == PROPERTY_ALIGN_CENTER )
+ nStyle |= WB_CENTER;
+ else
+ nStyle |= WB_RIGHT;
+ pWindow->SetStyle( nStyle );
+ }
+ break;
+ }
+ }
+ break;
+ case BASEPROPERTY_MULTILINE:
+ {
+ if ( eWinType == WINDOW_FIXEDTEXT )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ sal_Bool bMulti;
+ Value >>= bMulti;
+ if ( bMulti )
+ nStyle |= WB_WORDBREAK;
+ else
+ nStyle &= ~WB_WORDBREAK;
+ pWindow->SetStyle( nStyle );
+ }
+ }
+ break;
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXWindow::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ if ( GetWindow() )
+ {
+ WindowType eWinType = GetWindow()->GetType();
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_ENABLED:
+ aProp <<= (sal_Bool) GetWindow()->IsEnabled();
+ break;
+ case BASEPROPERTY_TEXT:
+ case BASEPROPERTY_LABEL:
+ {
+ ::rtl::OUString aText = GetWindow()->GetText();
+ aProp <<= aText;
+ }
+ break;
+ case BASEPROPERTY_FONTDESCRIPTOR:
+ {
+ Font aFont = GetWindow()->GetControlFont();
+ ::com::sun::star::awt::FontDescriptor aFD = VCLUnoHelper::CreateFontDescriptor( aFont );
+ aProp <<= aFD;
+ }
+ break;
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetControlBackground().GetColor();
+ break;
+ case BASEPROPERTY_TEXTCOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetControlForeground().GetColor();
+ break;
+ case BASEPROPERTY_FILLCOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetFillColor().GetColor();
+ break;
+ case BASEPROPERTY_LINECOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetLineColor().GetColor();
+ break;
+ case BASEPROPERTY_BORDER:
+ {
+ sal_uInt16 nBorder = 0;
+ if ( GetWindow()->GetStyle() & WB_BORDER )
+ nBorder = GetWindow()->GetBorderStyle();
+ aProp <<= nBorder;
+ }
+ break;
+ case BASEPROPERTY_TABSTOP:
+ aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_TABSTOP ) ? sal_True : sal_False;
+ break;
+ case BASEPROPERTY_ALIGN:
+ {
+ switch ( eWinType )
+ {
+ case WINDOW_FIXEDTEXT:
+ case WINDOW_EDIT:
+ {
+ WinBits nStyle = GetWindow()->GetStyle();
+ if ( nStyle & WB_LEFT )
+ aProp <<= (sal_Int16) PROPERTY_ALIGN_LEFT;
+ else if ( nStyle & WB_CENTER )
+ aProp <<= (sal_Int16) PROPERTY_ALIGN_CENTER;
+ else if ( nStyle & WB_RIGHT )
+ aProp <<= (sal_Int16) PROPERTY_ALIGN_RIGHT;
+ }
+ break;
+ }
+ }
+ case BASEPROPERTY_MULTILINE:
+ {
+ if ( eWinType == WINDOW_FIXEDTEXT )
+ aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_WORDBREAK ) ? sal_True : sal_False;
+ }
+ break;
+ }
+ }
+ return aProp;
+}
+
+
+// ::com::sun::star::awt::XLayoutConstrains
+::com::sun::star::awt::Size VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // Diese Methode sollte nur fuer Componenten gerufen werden, die zwar
+ // ueber das ::com::sun::star::awt::Toolkit erzeugt werden koennen, aber fuer die es
+ // kein Interface gibt.
+
+ Size aSz;
+ if ( GetWindow() )
+ {
+ WindowType nWinType = GetWindow()->GetType();
+ WinBits nStyle = GetWindow()->GetStyle();
+ switch ( nWinType )
+ {
+ case WINDOW_MESSBOX:
+ case WINDOW_INFOBOX:
+ case WINDOW_WARNINGBOX:
+ case WINDOW_ERRORBOX:
+ case WINDOW_QUERYBOX:
+ aSz = Size( 250, 100 );
+ break;
+
+ case WINDOW_CONTROL:
+ aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
+ aSz.Height() = GetWindow()->GetTextHeight()+2*6;
+ break;
+
+ case WINDOW_PATTERNBOX:
+ case WINDOW_NUMERICBOX:
+ case WINDOW_METRICBOX:
+ case WINDOW_CURRENCYBOX:
+ case WINDOW_DATEBOX:
+ case WINDOW_TIMEBOX:
+ case WINDOW_LONGCURRENCYBOX:
+ aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
+ aSz.Height() = GetWindow()->GetTextHeight()+2*2;
+ break;
+ case WINDOW_SCROLLBARBOX:
+ case WINDOW_SCROLLBAR:
+ {
+ long n = GetWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
+ aSz = Size( n, n );
+ }
+ break;
+ default: DBG_ERROR( "getMinimumSize: Unknown Type" );
+ }
+ }
+
+ return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
+}
+
+::com::sun::star::awt::Size VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aNewSize( rNewSize );
+ ::com::sun::star::awt::Size aMinSize = getMinimumSize();
+
+ if ( aNewSize.Width < aMinSize.Width )
+ aNewSize.Width = aMinSize.Width;
+ if ( aNewSize.Height < aMinSize.Height )
+ aNewSize.Height = aMinSize.Height;
+
+ return aNewSize;
+}
+
+
+// ::com::sun::star::awt::XView
+sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rxDevice ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( VCLUnoHelper::GetOutputDevice( rxDevice ) )
+ mxViewGraphics = rxDevice;
+ else
+ mxViewGraphics = NULL;
+
+ return mxViewGraphics.is();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ return mxViewGraphics;
+}
+
+::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ if ( GetWindow() )
+ aSz = GetWindow()->GetSizePixel();
+ return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
+}
+
+void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics );
+ Point aPos( nX, nY );
+
+ if ( ( !pDev || ( GetWindow()->GetParent() == pDev ) ) && !GetWindow()->IsVisible() )
+ {
+ Point aOldPos( GetWindow()->GetPosPixel() );
+ GetWindow()->SetPosPixel( aPos );
+
+ // Erstmal ein Update auf den Parent, damit nicht beim Update
+ // auf dieses Fenster noch ein Paint vom Parent abgearbeitet wird,
+ // wo dann ggf. dieses Fenster sofort wieder gehidet wird.
+ if( GetWindow()->GetParent() )
+ GetWindow()->GetParent()->Update();
+
+ GetWindow()->Show();
+ GetWindow()->Update();
+ GetWindow()->SetParentUpdateMode( sal_False );
+ GetWindow()->Hide();
+ GetWindow()->SetParentUpdateMode( sal_True );
+
+ GetWindow()->SetPosPixel( aOldPos );
+ }
+ else if ( pDev )
+ {
+ Size aSz = GetWindow()->GetSizePixel();
+ aSz = pDev->PixelToLogic( aSz );
+ Point aP = pDev->PixelToLogic( aPos );
+ GetWindow()->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS );
+ }
+ }
+}
+
+void VCLXWindow::setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->SetZoom( Fraction( fZoomX ) );
+}
+
+
+
+
+
+
+
+
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
new file mode 100644
index 000000000000..d1602c73b455
--- /dev/null
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -0,0 +1,4078 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclxwindows.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/longcurr.hxx>
+#include <vcl/imgctrl.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/scrbar.hxx>
+
+// ----------------------------------------------------
+// class VCLXButton
+// ----------------------------------------------------
+VCLXButton::VCLXButton() : maActionListeners( *this )
+{
+}
+
+VCLXButton::~VCLXButton()
+{
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ pButton->SetClickHdl( Link() );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXButton::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::XImageConsumer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXButton )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXButton::SetWindow( Window* pWindow )
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ PushButton* pPrevButton = (PushButton*) GetWindow();
+ if ( pPrevButton )
+ pPrevButton->SetClickHdl( Link() );
+
+ PushButton* pNewButton = (PushButton*) pWindow;
+ if ( pNewButton )
+ pNewButton->SetClickHdl( LINK( this, VCLXButton, ClickHdl ) );
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXButton::ImplUpdateImage( sal_Bool bGetNewImage )
+{
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ {
+ sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True;
+ if ( bOK )
+ pButton->SetBitmap( maBitmap );
+ }
+}
+
+void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rLabel );
+}
+
+void VCLXButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maActionCommand = rCommand;
+}
+
+void VCLXButton::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.Init( Width, Height );
+}
+
+void VCLXButton::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*) RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask );
+}
+
+void VCLXButton::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (sal_uInt8*)ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void VCLXButton::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*) ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void VCLXButton::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.Completed( Status );
+
+ // Controls sollen angemeldet bleiben...
+// Producer->removeConsumer( this );
+
+ ImplUpdateImage( sal_True );
+}
+
+
+::com::sun::star::awt::Size VCLXButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ aSz = pButton->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::Size aSz = getMinimumSize();
+ aSz.Width += 16;
+ aSz.Height += 10;
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ {
+ Size aMinSz = pButton->CalcMinimumSize();
+ // Kein Text, also Image
+ if ( !pButton->GetText().Len() )
+ {
+ if ( aSz.Width() < aMinSz.Width() )
+ aSz.Width() = aMinSz.Width();
+ if ( aSz.Height() < aMinSz.Height() )
+ aSz.Height() = aMinSz.Height();
+ }
+ else
+ {
+ if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
+ aSz.Height() = aMinSz.Height();
+ else
+ aSz = aMinSz;
+ }
+ }
+ return AWTSize(aSz);
+}
+
+void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Button* pButton = (Button*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DEFAULTBUTTON:
+ {
+ WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON;
+ sal_Bool b;
+ if ( ( Value >>= b ) && !b )
+ nStyle &= ~WB_DEFBUTTON;
+ pButton->SetStyle( nStyle );
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ Button* pButton = (Button*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DEFAULTBUTTON:
+ {
+ aProp <<= (sal_Bool) ( ( pButton->GetStyle() & WB_DEFBUTTON ) ? sal_True : sal_False );
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+IMPL_LINK( VCLXButton, ClickHdl, Button*, EMPTYARG )
+{
+ if ( GetWindow() && maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = maActionCommand;
+ maActionListeners.actionPerformed( aEvent );
+ }
+ return 1;
+}
+
+// ----------------------------------------------------
+// class VCLXImageControl
+// ----------------------------------------------------
+VCLXImageControl::VCLXImageControl()
+{
+}
+
+VCLXImageControl::~VCLXImageControl()
+{
+}
+
+void VCLXImageControl::ImplUpdateImage( sal_Bool bGetNewImage )
+{
+ ImageControl* pControl = (ImageControl*) GetWindow();
+ if ( pControl )
+ {
+ sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True;
+ if ( bOK )
+ pControl->SetBitmap( maBitmap );
+ }
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXImageControl::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::XImageConsumer*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXImageControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXImageControl::setPosSize( long X, long Y, long Width, long Height, short Flags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ Size aOldSize = GetWindow()->GetSizePixel();
+ VCLXWindow::setPosSize( X, Y, Width, Height, Flags );
+ if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) )
+ ImplUpdateImage( sal_False );
+ }
+}
+
+void VCLXImageControl::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.Init( Width, Height );
+}
+
+void VCLXImageControl::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*) RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask );
+}
+
+void VCLXImageControl::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (sal_uInt8*)ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void VCLXImageControl::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*) ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void VCLXImageControl::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.Completed( Status );
+
+ // Controls sollen angemeldet bleiben...
+// Producer->removeConsumer( this );
+
+ ImplUpdateImage( sal_True );
+}
+
+::com::sun::star::awt::Size VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = maBitmap.GetSizePixel();
+ aSz = ImplCalcWindowSize( aSz );
+
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXImageControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Width < aMinSz.Width )
+ aSz.Width = aMinSz.Width;
+ if ( aSz.Height < aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+ return aSz;
+}
+
+// ----------------------------------------------------
+// class VCLXCheckBox
+// ----------------------------------------------------
+VCLXCheckBox::VCLXCheckBox() : maItemListeners( *this )
+{
+}
+
+VCLXCheckBox::~VCLXCheckBox()
+{
+ CheckBox* pBox = (CheckBox*) GetWindow();
+ if ( pBox )
+ pBox->SetClickHdl( Link() );
+}
+
+void VCLXCheckBox::SetWindow( Window* pWindow )
+{
+ CheckBox* pPrevCheckBox = (CheckBox*) GetWindow();
+ if ( pPrevCheckBox )
+ pPrevCheckBox->SetClickHdl( Link() );
+
+ CheckBox* pNewCheckBox = (CheckBox*) pWindow;
+ if ( pNewCheckBox )
+ pNewCheckBox->SetClickHdl( LINK( this, VCLXCheckBox, ClickHdl ) );
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXCheckBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXCheckBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXCheckBox::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rLabel );
+}
+
+void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox)
+ pCheckBox->SetState( (TriState)n );
+}
+
+short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ return pCheckBox ? pCheckBox->GetState() : 0;
+}
+
+void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox)
+ pCheckBox->EnableTriState( b );
+}
+
+::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ CheckBox* pCheckBox = (CheckBox*) GetWindow();
+ if ( pCheckBox )
+ aSz = pCheckBox->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ CheckBox* pCheckBox = (CheckBox*) GetWindow();
+ if ( pCheckBox )
+ {
+ Size aMinSz = pCheckBox->CalcMinimumSize();
+ if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
+ aSz.Height() = aMinSz.Height();
+ else
+ aSz = aMinSz;
+ }
+ return AWTSize(aSz);
+}
+
+void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TRISTATE:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pCheckBox->EnableTriState( b );
+ }
+ break;
+ case BASEPROPERTY_STATE:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ setState( n );
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXCheckBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TRISTATE:
+ {
+ aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled();
+ }
+ break;
+ case BASEPROPERTY_STATE:
+ {
+ aProp <<= (sal_Int16)pCheckBox->GetState();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+IMPL_LINK( VCLXCheckBox, ClickHdl, CheckBox*, EMPTYARG )
+{
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox && maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+ aEvent.Selected = pCheckBox->GetState();
+ maItemListeners.itemStateChanged( aEvent );
+ }
+ return 1;
+}
+
+// ----------------------------------------------------
+// class VCLXRadioButton
+// ----------------------------------------------------
+VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this )
+{
+}
+
+VCLXRadioButton::~VCLXRadioButton()
+{
+ RadioButton* pBox = (RadioButton*) GetWindow();
+ if ( pBox )
+ pBox->SetClickHdl( Link() );
+}
+
+void VCLXRadioButton::SetWindow( Window* pWindow )
+{
+ RadioButton* pPrevRadioButton = (RadioButton*) GetWindow();
+ if ( pPrevRadioButton )
+ pPrevRadioButton->SetClickHdl( Link() );
+
+ RadioButton* pNewRadioButton = (RadioButton*) pWindow;
+ if ( pNewRadioButton )
+ pNewRadioButton->SetClickHdl( LINK( this, VCLXRadioButton, ClickHdl ) );
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXRadioButton )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ RadioButton* pButton = (RadioButton*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_STATE:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ pButton->SetState( n ? sal_True : sal_False );
+ }
+ break;
+ case BASEPROPERTY_AUTOTOGGLE:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pButton->EnableRadioCheck( b );
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXRadioButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ RadioButton* pButton = (RadioButton*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_STATE:
+ {
+ aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 );
+ }
+ break;
+ case BASEPROPERTY_AUTOTOGGLE:
+ {
+ aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rLabel );
+}
+
+void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ RadioButton* pRadioButton = (RadioButton*)GetWindow();
+ if ( pRadioButton)
+ pRadioButton->Check( b );
+}
+
+sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ RadioButton* pRadioButton = (RadioButton*)GetWindow();
+ return pRadioButton ? pRadioButton->IsChecked() : sal_False;
+}
+
+::com::sun::star::awt::Size VCLXRadioButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ RadioButton* pRadioButton = (RadioButton*) GetWindow();
+ if ( pRadioButton )
+ aSz = pRadioButton->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXRadioButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ RadioButton* pRadioButton = (RadioButton*) GetWindow();
+ if ( pRadioButton )
+ {
+ Size aMinSz = pRadioButton->CalcMinimumSize();
+ if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
+ aSz.Height() = aMinSz.Height();
+ else
+ aSz = aMinSz;
+ }
+ return AWTSize(aSz);
+}
+
+IMPL_LINK( VCLXRadioButton, ClickHdl, RadioButton*, EMPTYARG )
+{
+ // RadioButton reagiert wieder auf Click() statt auf Toggle().
+ // Dadurch wird bei dem RadioButton, den TH uncheckt, kein
+ // itemStateChanged gerufen.
+ // Sollte hoffentlich kein Problem sein, unter JAVA und im Office wird
+ // das Gruppenverhalten von DG/KR erledigt, damit stimmen dann
+ // auch die Properties.
+
+ RadioButton* pRadioButton = (RadioButton*)GetWindow();
+ if ( pRadioButton && pRadioButton->IsStateChanged() && maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+ aEvent.Selected = pRadioButton->IsChecked();
+ maItemListeners.itemStateChanged( aEvent );
+ }
+ return 1;
+}
+
+
+// ----------------------------------------------------
+// class VCLXSpinField
+// ----------------------------------------------------
+VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
+{
+}
+
+VCLXSpinField::~VCLXSpinField()
+{
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ {
+ pSpinField->SetUpHdl( Link() );
+ pSpinField->SetDownHdl( Link() );
+ pSpinField->SetFirstHdl( Link() );
+ pSpinField->SetLastHdl( Link() );
+ }
+}
+
+void VCLXSpinField::SetWindow( Window* pWindow )
+{
+ SpinField* pPrevSpinField = (SpinField*) GetWindow();
+ if ( pPrevSpinField )
+ {
+ pPrevSpinField->SetUpHdl( Link() );
+ pPrevSpinField->SetDownHdl( Link() );
+ pPrevSpinField->SetFirstHdl( Link() );
+ pPrevSpinField->SetLastHdl( Link() );
+ }
+
+ SpinField* pNewSpinField = (SpinField*) pWindow;
+
+ if ( pNewSpinField )
+ {
+ pNewSpinField->SetUpHdl( LINK( this, VCLXSpinField, SpinUpHdl ) );
+ pNewSpinField->SetDownHdl( LINK( this, VCLXSpinField, SpinUpHdl ) );
+ pNewSpinField->SetFirstHdl( LINK( this, VCLXSpinField, SpinUpHdl ) );
+ pNewSpinField->SetLastHdl( LINK( this, VCLXSpinField, SpinUpHdl ) );
+ }
+
+ VCLXEdit::SetWindow( pWindow );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXSpinField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XSpinField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXSpinField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinField>* ) NULL ),
+ VCLXEdit::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maSpinListeners.addInterface( l );
+}
+
+void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maSpinListeners.removeInterface( l );
+}
+
+void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->Up();
+}
+
+void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->Down();
+}
+
+void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->First();
+}
+
+void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->Last();
+}
+
+void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( bRepeat )
+ nStyle |= WB_REPEAT;
+ else
+ nStyle &= ~WB_REPEAT;
+ pWindow->SetStyle( nStyle );
+ }
+}
+
+IMPL_LINK( VCLXSpinField, SpinUpHdl, SpinField*, EMPTYARG )
+{
+ SpinField* pSpinField = (SpinField*)GetWindow();
+ if ( pSpinField && maSpinListeners.getLength() )
+ {
+ ::com::sun::star::awt::SpinEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ maSpinListeners.up( aEvent );
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXSpinField, SpinDownHdl, SpinField*, EMPTYARG )
+{
+ SpinField* pSpinField = (SpinField*)GetWindow();
+ if ( pSpinField && maSpinListeners.getLength() )
+ {
+ ::com::sun::star::awt::SpinEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ maSpinListeners.down( aEvent );
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXSpinField, SpinFirstHdl, SpinField*, EMPTYARG )
+{
+ SpinField* pSpinField = (SpinField*)GetWindow();
+ if ( pSpinField && maSpinListeners.getLength() )
+ {
+ ::com::sun::star::awt::SpinEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ maSpinListeners.first( aEvent );
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXSpinField, SpinLastHdl, SpinField*, EMPTYARG )
+{
+ SpinField* pSpinField = (SpinField*)GetWindow();
+ if ( pSpinField && maSpinListeners.getLength() )
+ {
+ ::com::sun::star::awt::SpinEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ maSpinListeners.last( aEvent );
+ }
+ return 1;
+}
+
+
+
+// ----------------------------------------------------
+// class VCLXListBox
+// ----------------------------------------------------
+VCLXListBox::VCLXListBox()
+ : maItemListeners( *this ),
+ maActionListeners( *this )
+{
+}
+
+VCLXListBox::~VCLXListBox()
+{
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ pBox->SetSelectHdl( Link() );
+ pBox->SetDoubleClickHdl( Link() );
+ }
+}
+
+void VCLXListBox::SetWindow( Window* pWindow )
+{
+ ListBox* pPrevListBox = (ListBox*) GetWindow();
+ if ( pPrevListBox )
+ {
+ pPrevListBox->SetSelectHdl( Link() );
+ pPrevListBox->SetDoubleClickHdl( Link() );
+ }
+
+ ListBox* pNewListBox = (ListBox*) pWindow;
+ if ( pNewListBox )
+ {
+ pNewListBox->SetSelectHdl( LINK( this, VCLXListBox, SelectHdl ) );
+ pNewListBox->SetDoubleClickHdl( LINK( this, VCLXListBox, DoubleClickHdl ) );
+ }
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXListBox::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::XListBox*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXListBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ maActionListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXListBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->InsertEntry( aItem, nPos );
+}
+
+void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nP = nPos;
+ for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
+ {
+ pBox->InsertEntry( aItems.getConstArray()[n], nP );
+ if ( nPos < 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND
+ nP++;
+ }
+ }
+}
+
+void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ for ( sal_uInt16 n = nCount; n; )
+ pBox->RemoveEntry( nPos + (--n) );
+ }
+}
+
+sal_Int16 VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ return pBox ? pBox->GetEntryCount() : 0;
+}
+
+::rtl::OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ String aItem;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ aItem = pBox->GetEntry( nPos );
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nEntries = pBox->GetEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
+ for ( sal_uInt16 n = nEntries; n; )
+ {
+ --n;
+ aSeq.getArray()[n] = ::rtl::OUString( pBox->GetEntry( n ) );
+ }
+ }
+ return aSeq;
+}
+
+sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ return pBox ? pBox->GetSelectEntryPos() : 0;
+}
+
+::com::sun::star::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries );
+ for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
+ aSeq.getArray()[n] = pBox->GetSelectEntryPos( n );
+ }
+ return aSeq;
+}
+
+::rtl::OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ String aItem;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ aItem = pBox->GetSelectEntry();
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nSelEntries );
+ for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
+ aSeq.getArray()[n] = ::rtl::OUString( pBox->GetSelectEntry( n ) );
+ }
+ return aSeq;
+}
+
+void VCLXListBox::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->SelectEntryPos( nPos, bSelect );
+}
+
+void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; )
+ pBox->SelectEntryPos( (sal_uInt16) aPositions.getConstArray()[--n], bSelect );
+ }
+}
+
+void VCLXListBox::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->SelectEntry( aItem, bSelect );
+}
+
+
+void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->SetDropDownLineCount( nLines );
+}
+
+sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int16 nLines = 0;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ nLines = pBox->GetDropDownLineCount();
+ return nLines;
+}
+
+sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Bool bMulti = sal_False;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ bMulti = pBox->IsMultiSelectionEnabled();
+ return bMulti;
+}
+
+void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->EnableMultiSelection( bMulti );
+}
+
+void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->SetTopEntry( nEntry );
+}
+
+IMPL_LINK( VCLXListBox, SelectHdl, ListBox*, EMPTYARG )
+{
+ ListBox* pListBox = (ListBox*)GetWindow();
+ if ( pListBox )
+ {
+ sal_Bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False;
+ if ( bDropDown )
+ {
+ // Bei DropDown den ActionListener rufen...
+ DoubleClickHdl( pListBox );
+ }
+
+ if ( maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+
+ // Bei Mehrfachselektion 0xFFFF, sonst die ID
+ aEvent.Selected = (pListBox->GetSelectEntryCount() == 1 )
+ ? pListBox->GetSelectEntryPos() : 0xFFFF;
+
+ maItemListeners.itemStateChanged( aEvent );
+ }
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXListBox, DoubleClickHdl, ListBox*, EMPTYARG )
+{
+ ListBox* pListBox = (ListBox*)GetWindow();
+ if ( pListBox && maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = pListBox->GetSelectEntry();
+ maActionListeners.actionPerformed( aEvent );
+ }
+ return 1;
+}
+
+void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = (ListBox*)GetWindow();
+ if ( pListBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pListBox->SetReadOnly( b);
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pListBox->EnableMultiSelection( b );
+ }
+ break;
+ case BASEPROPERTY_LINECOUNT:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ pListBox->SetDropDownLineCount( n );
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
+ if ( Value >>= aItems )
+ {
+ pListBox->Clear();
+ addItems( aItems, 0 );
+ }
+ }
+ break;
+ case BASEPROPERTY_SELECTEDITEMS:
+ {
+ ::com::sun::star::uno::Sequence<sal_Int16> aItems;
+ if ( Value >>= aItems )
+ {
+ for ( sal_uInt16 n = pListBox->GetEntryCount(); n; )
+ pListBox->SelectEntryPos( --n, sal_False );
+
+ selectItemsPos( aItems, sal_True );
+
+ if ( !pListBox->GetSelectEntryCount() )
+ pListBox->SetTopEntry( 0 );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXListBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ ListBox* pListBox = (ListBox*)GetWindow();
+ if ( pListBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ aProp <<= (sal_Bool) pListBox->IsReadOnly();
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION:
+ {
+ aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
+ }
+ break;
+ case BASEPROPERTY_LINECOUNT:
+ {
+ aProp <<= (sal_Int16) pListBox->GetDropDownLineCount();
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ sal_uInt16 nItems = pListBox->GetEntryCount();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
+ ::rtl::OUString* pStrings = aSeq.getArray();
+ for ( sal_uInt16 n = 0; n < nItems; n++ )
+ pStrings[n] = pListBox->GetEntry( n );
+ aProp <<= aSeq;
+
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+::com::sun::star::awt::Size VCLXListBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ aSz = pListBox->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXListBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ {
+ aSz = pListBox->CalcMinimumSize();
+ if ( pListBox->GetStyle() & WB_DROPDOWN )
+ aSz.Height() += 4;
+ }
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ aSz = pListBox->CalcAdjustedSize( aSz );
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ aSz = pListBox->CalcSize( nCols, nLines );
+ return AWTSize(aSz);
+}
+
+void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nCols = nLines = 0;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ {
+ sal_uInt16 nC, nL;
+ pListBox->GetMaxVisColumnsAndLines( nC, nL );
+ nCols = nC;
+ nLines = nL;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXMessageBox
+// ----------------------------------------------------
+VCLXMessageBox::VCLXMessageBox()
+{
+}
+
+VCLXMessageBox::~VCLXMessageBox()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXMessageBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMessageBox*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXMessageBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXMessageBox::setCaptionText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rText );
+}
+
+::rtl::OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ String aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+void VCLXMessageBox::setMessageText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MessBox* pBox = (MessBox*)GetWindow();
+ if ( pBox )
+ pBox->SetMessText( rText );
+}
+
+::rtl::OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ MessBox* pBox = (MessBox*)GetWindow();
+ if ( pBox )
+ aText = pBox->GetMessText();
+ return aText;
+}
+
+sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MessBox* pBox = (MessBox*)GetWindow();
+ return pBox ? pBox->Execute() : 0;
+}
+
+
+
+// ----------------------------------------------------
+// class VCLXDialog
+// ----------------------------------------------------
+VCLXDialog::VCLXDialog()
+{
+}
+
+VCLXDialog::~VCLXDialog()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXDialog )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
+ VCLXTopWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( Title );
+}
+
+::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aTitle;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aTitle = pWindow->GetText();
+ return aTitle;
+}
+
+sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int16 nRet = 0;
+ if ( GetWindow() )
+ {
+ Dialog* pDlg = (Dialog*) GetWindow();
+ Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
+ Window* pOldParent = NULL;
+ if ( pParent && !pParent->IsReallyVisible() )
+ {
+ pOldParent = pDlg->GetParent();
+ pDlg->SetParent( pDlg->GetWindow( WINDOW_FRAME ) );
+ }
+ nRet = pDlg->Execute();
+ if ( pOldParent )
+ pDlg->SetParent( pOldParent );
+ }
+ return nRet;
+}
+
+void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Dialog* pDlg = (Dialog*) GetWindow();
+ if ( pDlg )
+ pDlg->EndDialog( 0 );
+}
+
+// ----------------------------------------------------
+// class VCLXFixedText
+// ----------------------------------------------------
+VCLXFixedText::VCLXFixedText()
+{
+}
+
+VCLXFixedText::~VCLXFixedText()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXFixedText::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XFixedText*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXFixedText )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXFixedText::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( Text );
+}
+
+::rtl::OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nNewBits = 0;
+ if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
+ nNewBits = WB_LEFT;
+ else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
+ nNewBits = WB_CENTER;
+ else
+ nNewBits = WB_RIGHT;
+
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
+ pWindow->SetStyle( nStyle | nNewBits );
+ }
+}
+
+short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ short nAlign = 0;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( nStyle & WB_LEFT )
+ nAlign = ::com::sun::star::awt::TextAlign::LEFT;
+ else if ( nStyle & WB_CENTER )
+ nAlign = ::com::sun::star::awt::TextAlign::CENTER;
+ else
+ nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
+ }
+ return nAlign;
+}
+
+::com::sun::star::awt::Size VCLXFixedText::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ FixedText* pFixedText = (FixedText*)GetWindow();
+ if ( pFixedText )
+ aSz = pFixedText->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXFixedText::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Height != aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+
+ return aSz;
+}
+
+// ----------------------------------------------------
+// class VCLXScrollBar
+// ----------------------------------------------------
+VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
+{
+}
+
+VCLXScrollBar::~VCLXScrollBar()
+{
+ ScrollBar* pBox = (ScrollBar*) GetWindow();
+ if ( pBox )
+ pBox->SetScrollHdl( Link() );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXScrollBar::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XScrollBar*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXScrollBar )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XScrollBar>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXScrollBar::SetWindow( Window* pWindow )
+{
+ ScrollBar* pPrevScrollBar = (ScrollBar*) GetWindow();
+ if ( pPrevScrollBar )
+ pPrevScrollBar->SetScrollHdl( Link() );
+
+ ScrollBar* pNewScrollBar = (ScrollBar*) pWindow;
+ if ( pNewScrollBar )
+ pNewScrollBar->SetScrollHdl( LINK( this, VCLXScrollBar, ScrollHdl ) );
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maAdjustmentListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maAdjustmentListeners.addInterface( l );
+}
+
+void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maAdjustmentListeners.removeInterface( l );
+}
+
+void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetThumbPos( n );
+}
+
+void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ {
+ pScrollBar->SetThumbPos( nValue );
+ pScrollBar->SetVisibleSize( nVisible );
+ pScrollBar->SetRangeMax( nMax );
+ }
+}
+
+sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetThumbPos() : 0;
+}
+
+void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetRangeMax( n );
+}
+
+sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetRangeMax() : 0;
+}
+
+void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetLineSize( n );
+}
+
+sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetLineSize() : 0;
+}
+
+void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetPageSize( n );
+}
+
+sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetPageSize() : 0;
+}
+
+void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetVisibleSize( n );
+}
+
+sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetVisibleSize() : 0;
+}
+
+void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_HORZ|WB_VERT);
+ if ( n == ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL )
+ nStyle |= WB_HORZ;
+ else
+ nStyle |= WB_VERT;
+
+ if ( pWindow->IsVisible() )
+ pWindow->Resize();
+ }
+}
+
+sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 n = 0;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( nStyle & WB_HORZ )
+ n = ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL;
+ else
+ n = ::com::sun::star::awt::ScrollBarOrientation::VERTICAL;
+ }
+ return n;
+
+}
+
+IMPL_LINK( VCLXScrollBar, ScrollHdl, ScrollBar*, EMPTYARG )
+{
+ ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
+ if ( pScrollBar && maAdjustmentListeners.getLength() )
+ {
+ ::com::sun::star::awt::AdjustmentEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Value = pScrollBar->GetThumbPos();
+ maAdjustmentListeners.adjustmentValueChanged( aEvent );
+ }
+ return 1;
+}
+
+// ----------------------------------------------------
+// class VCLXEdit
+// ----------------------------------------------------
+
+VCLXEdit::VCLXEdit() : maTextListeners( *this )
+{
+}
+
+VCLXEdit::~VCLXEdit()
+{
+ Edit* pBox = (Edit*) GetWindow();
+ if ( pBox )
+ pBox->SetModifyHdl( Link() );
+}
+
+void VCLXEdit::SetWindow( Window* pWindow )
+{
+ Edit* pPrevEdit = (Edit*) GetWindow();
+ if ( pPrevEdit )
+ pPrevEdit->SetModifyHdl( Link() );
+
+ Edit* pNewEdit = (Edit*) pWindow;
+ if ( pNewEdit )
+ pNewEdit->SetModifyHdl( LINK( this, VCLXEdit, ModifyHdl ) );
+
+ VCLXWindow::SetWindow( pWindow );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextEditField*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXEdit )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextEditField>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maTextListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetTextListeners().addInterface( l );
+}
+
+void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetTextListeners().removeInterface( l );
+}
+
+void VCLXEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ pWindow->SetText( aText );
+
+ // In JAVA wird auch ein textChanged ausgeloest, in VCL nicht.
+ // ::com::sun::star::awt::Toolkit soll JAVA-komform sein...
+ ModifyHdl( NULL );
+ }
+}
+
+void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) );
+ pEdit->ReplaceSelected( aText );
+ }
+}
+
+::rtl::OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+::rtl::OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit)
+ aText = pEdit->GetSelected();
+ return aText;
+
+}
+
+void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
+}
+
+::com::sun::star::awt::Selection VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Selection aSel;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ aSel = pEdit->GetSelection();
+ return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() );
+}
+
+sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False;
+}
+
+void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetReadOnly( !bEditable );
+}
+
+
+void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetMaxTextLen( nLen );
+}
+
+sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ return pEdit ? pEdit->GetMaxTextLen() : 0;
+}
+
+void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetEchoChar( cEcho );
+}
+
+void VCLXEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ pEdit->SetReadOnly( b );
+ }
+ break;
+ case BASEPROPERTY_ECHOCHAR:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ pEdit->SetEchoChar( n );
+ }
+ break;
+ case BASEPROPERTY_MAXTEXTLEN:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ pEdit->SetMaxTextLen( n );
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ aProp <<= (sal_Bool) pEdit->IsReadOnly();
+ }
+ break;
+ case BASEPROPERTY_ECHOCHAR:
+ {
+ aProp <<= (sal_Int16) pEdit->GetEchoChar();
+ }
+ break;
+ case BASEPROPERTY_MAXTEXTLEN:
+ {
+ aProp <<= (sal_Int16) pEdit->GetMaxTextLen();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+::com::sun::star::awt::Size VCLXEdit::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ aSz = pEdit->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXEdit::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ {
+ aSz = pEdit->CalcMinimumSize();
+ aSz.Height() += 4;
+ }
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Height != aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ {
+ if ( nCols )
+ aSz = pEdit->CalcSize( nCols );
+ else
+ aSz = pEdit->CalcMinimumSize();
+ }
+ return AWTSize(aSz);
+}
+
+void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nLines = 1;
+ nCols = 0;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ nCols = pEdit->GetMaxVisChars();
+}
+
+IMPL_LINK( VCLXEdit, ModifyHdl, Edit*, EMPTYARG )
+{
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit && GetTextListeners().getLength() )
+ {
+ ::com::sun::star::awt::TextEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ GetTextListeners().textChanged( aEvent );
+ }
+ return 1;
+}
+
+// ----------------------------------------------------
+// class VCLXComboBox
+// ----------------------------------------------------
+VCLXComboBox::VCLXComboBox()
+ : maItemListeners( *this ),
+ maActionListeners( *this )
+{
+}
+
+VCLXComboBox::~VCLXComboBox()
+{
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ {
+ pBox->SetSelectHdl( Link() );
+ pBox->SetDoubleClickHdl( Link() );
+ }
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXComboBox::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::XComboBox*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXComboBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XComboBox>* ) NULL ),
+ VCLXEdit::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+void VCLXComboBox::SetWindow( Window* pWindow )
+{
+ ComboBox* pPrevComboBox = (ComboBox*) GetWindow();
+ if ( pPrevComboBox )
+ {
+ pPrevComboBox->SetSelectHdl( Link() );
+ pPrevComboBox->SetDoubleClickHdl( Link() );
+ }
+
+ ComboBox* pNewComboBox = (ComboBox*) pWindow;
+ if ( pNewComboBox )
+ {
+ pNewComboBox->SetSelectHdl( LINK( this, VCLXComboBox, SelectHdl ) );
+ pNewComboBox->SetDoubleClickHdl( LINK( this, VCLXComboBox, DoubleClickHdl ) );
+ }
+
+ VCLXEdit::SetWindow( pWindow );
+}
+
+void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ maActionListeners.disposeAndClear( aObj );
+ VCLXEdit::dispose();
+}
+
+
+void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXComboBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ pBox->InsertEntry( aItem, nPos );
+}
+
+void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nP = nPos;
+ for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
+ {
+ pBox->InsertEntry( aItems.getConstArray()[n], nP );
+ if ( nPos < 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND
+ nP++;
+ }
+ }
+}
+
+void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ {
+ for ( sal_uInt16 n = nCount; n; )
+ pBox->RemoveEntry( nPos + (--n) );
+ }
+}
+
+sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ return pBox ? pBox->GetEntryCount() : 0;
+}
+
+::rtl::OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aItem;
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ aItem = pBox->GetEntry( nPos );
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nEntries = pBox->GetEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
+ for ( sal_uInt16 n = nEntries; n; )
+ {
+ --n;
+ aSeq.getArray()[n] = pBox->GetEntry( n );
+ }
+ }
+ return aSeq;
+}
+
+void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ pBox->SetDropDownLineCount( nLines );
+}
+
+sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int16 nLines = 0;
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ nLines = pBox->GetDropDownLineCount();
+ return nLines;
+}
+
+void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = (ComboBox*)GetWindow();
+ if ( pComboBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LINECOUNT:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ pComboBox->SetDropDownLineCount( n );
+ }
+ break;
+ case BASEPROPERTY_AUTOCOMPLETE:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ pComboBox->EnableAutocomplete( n );
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
+ if ( Value >>= aItems )
+ {
+ sal_Bool bUpdate = pComboBox->IsUpdateMode();
+ pComboBox->SetUpdateMode( sal_False );
+ pComboBox->Clear();
+ const ::rtl::OUString* pStrings = aItems.getConstArray();
+ sal_Int32 nItems = aItems.getLength();
+ for ( sal_Int32 n = 0; n < nItems; n++ )
+ pComboBox->InsertEntry( pStrings[n], LISTBOX_APPEND );
+ pComboBox->SetUpdateMode( bUpdate );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXEdit::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXComboBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ ComboBox* pComboBox = (ComboBox*)GetWindow();
+ if ( pComboBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LINECOUNT:
+ {
+ aProp <<= (sal_Int16) pComboBox->GetDropDownLineCount();
+ }
+ break;
+ case BASEPROPERTY_AUTOCOMPLETE:
+ {
+ aProp <<= (sal_Bool) pComboBox->IsAutocompleteEnabled();
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ sal_uInt16 nItems = pComboBox->GetEntryCount();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
+ ::rtl::OUString* pStrings = aSeq.getArray();
+ for ( sal_uInt16 n = 0; n < nItems; n++ )
+ pStrings[n] = pComboBox->GetEntry( n );
+ aProp <<= aSeq;
+
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXEdit::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+IMPL_LINK( VCLXComboBox, SelectHdl, ComboBox*, EMPTYARG )
+{
+ ComboBox* pComboBox = (ComboBox*)GetWindow();
+ if ( pComboBox && !pComboBox->IsTravelSelect() && maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+
+ // Bei Mehrfachselektion 0xFFFF, sonst die ID
+ aEvent.Selected = pComboBox->GetEntryPos( pComboBox->GetText() );
+
+ maItemListeners.itemStateChanged( aEvent );
+ }
+ return 1;
+}
+
+IMPL_LINK( VCLXComboBox, DoubleClickHdl, ComboBox*, EMPTYARG )
+{
+ ComboBox* pComboBox = (ComboBox*)GetWindow();
+ if ( pComboBox && maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+// aEvent.ActionCommand = ...;
+ maActionListeners.actionPerformed( aEvent );
+ }
+ return 1;
+}
+
+::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ aSz = pComboBox->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXComboBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ {
+ aSz = pComboBox->CalcMinimumSize();
+ if ( pComboBox->GetStyle() & WB_DROPDOWN )
+ aSz.Height() += 4;
+ }
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ aSz = pComboBox->CalcAdjustedSize( aSz );
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ aSz = pComboBox->CalcSize( nCols, nLines );
+ return AWTSize(aSz);
+}
+
+void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nCols = nLines = 0;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ {
+ sal_uInt16 nC, nL;
+ pComboBox->GetMaxVisColumnsAndLines( nC, nL );
+ nCols = nC;
+ nLines = nL;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXFormattedSpinField
+// ----------------------------------------------------
+VCLXFormattedSpinField::VCLXFormattedSpinField()
+{
+}
+
+VCLXFormattedSpinField::~VCLXFormattedSpinField()
+{
+}
+
+void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict )
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ pFormatter->SetStrictFormat( bStrict );
+}
+
+sal_Bool VCLXFormattedSpinField::isStrictFormat()
+{
+ FormatterBase* pFormatter = GetFormatter();
+ return pFormatter ? pFormatter->IsStrictFormat() : sal_False;
+}
+
+
+void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ International aInternational( pFormatter->GetInternational() );
+ sal_Bool bInternationalChanged = sal_True;
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_SPIN:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ {
+ WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN;
+ if ( !b )
+ nStyle &= ~WB_SPIN;
+ GetWindow()->SetStyle( nStyle );
+ }
+ }
+ break;
+ case BASEPROPERTY_STRICTFORMAT:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ {
+ pFormatter->SetStrictFormat( b );
+ bInternationalChanged = sal_False;
+ }
+ }
+ break;
+ case BASEPROPERTY_DATESHOWCENTURY:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ aInternational.SetDateCentury( b );
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ sal_Bool b;
+ if ( Value >>= b )
+ aInternational.EnableNumThousandSep( b );
+ }
+ break;
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ ::rtl::OUString aString;
+ if ( Value >>= aString )
+ aInternational.SetCurrSymbol( aString );
+ }
+ break;
+ default:
+ {
+ bInternationalChanged = sal_False;
+ VCLXSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ if ( bInternationalChanged )
+ pFormatter->SetInternational( aInternational );
+ }
+}
+
+::com::sun::star::uno::Any VCLXFormattedSpinField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TABSTOP:
+ {
+ aProp <<= (sal_Bool) ( ( GetWindow()->GetStyle() & WB_SPIN ) ? sal_True : sal_False );
+ }
+ break;
+ case BASEPROPERTY_STRICTFORMAT:
+ {
+ aProp <<= (sal_Bool) pFormatter->IsStrictFormat();
+ }
+ break;
+ case BASEPROPERTY_DATESHOWCENTURY:
+ {
+ aProp <<= (sal_Bool) pFormatter->GetInternational().IsDateCentury();
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ aProp <<= (sal_Bool) pFormatter->GetInternational().IsNumThousandSep();
+ }
+ break;
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ aProp <<= ::rtl::OUString( pFormatter->GetInternational().GetCurrSymbol() );
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+// ----------------------------------------------------
+// class VCLXDateField
+// ----------------------------------------------------
+VCLXDateField::VCLXDateField()
+{
+}
+
+VCLXDateField::~VCLXDateField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXDateField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDateField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXDateField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXDateField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DATE:
+ {
+ if ( bVoid )
+ {
+ ((DateField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((DateField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ setDate( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_DATEMIN:
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ setMin( n );
+ }
+ break;
+ case BASEPROPERTY_DATEMAX:
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ setMax( n );
+ }
+ break;
+ case BASEPROPERTY_EXTDATEFORMAT:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ ((DateField*)GetWindow())->SetExtFormat( (ExtDateFieldFormat) n );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXDateField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DATE:
+ {
+ aProp <<= (sal_Int32) getDate();
+ }
+ break;
+ case BASEPROPERTY_DATEMIN:
+ {
+ aProp <<= (sal_Int32) getMin();
+ }
+ break;
+ case BASEPROPERTY_DATEMAX:
+ {
+ aProp <<= (sal_Int32) getMax();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetDate( nDate );
+}
+
+sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetDate().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setMin( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetMin( nDate );
+}
+
+sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetMin().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setMax( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetMax( nDate );
+}
+
+sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetMax().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setFirst( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetFirst( nDate );
+}
+
+sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetFirst().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setLast( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetLast( nDate );
+}
+
+sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetLast().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetLongFormat( bLong );
+}
+
+sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ return pDateField ? pDateField->IsLongFormat() : sal_False;
+}
+
+void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetEmptyDate();
+}
+
+sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ return pDateField ? pDateField->IsEmptyDate() : sal_False;
+}
+
+void VCLXDateField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+// ----------------------------------------------------
+// class VCLXTimeField
+// ----------------------------------------------------
+VCLXTimeField::VCLXTimeField()
+{
+}
+
+VCLXTimeField::~VCLXTimeField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTimeField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXTimeField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetTime( nTime );
+}
+
+sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetTime().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setMin( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetMin( nTime );
+}
+
+sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetMin().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setMax( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetMax( nTime );
+}
+
+sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetMax().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setFirst( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetFirst( nTime );
+}
+
+sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetFirst().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setLast( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetLast( nTime );
+}
+
+sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetLast().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetEmptyTime();
+}
+
+sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
+}
+
+void VCLXTimeField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TIME:
+ {
+ if ( bVoid )
+ {
+ ((TimeField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((TimeField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ setTime( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_TIMEMIN:
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ setMin( n );
+ }
+ break;
+ case BASEPROPERTY_TIMEMAX:
+ {
+ sal_Int32 n;
+ if ( Value >>= n )
+ setMax( n );
+ }
+ break;
+ case BASEPROPERTY_EXTTIMEFORMAT:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ ((TimeField*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXTimeField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TIME:
+ {
+ aProp <<= (sal_Int32) getTime();
+ }
+ break;
+ case BASEPROPERTY_TIMEMIN:
+ {
+ aProp <<= (sal_Int32) getMin();
+ }
+ break;
+ case BASEPROPERTY_TIMEMAX:
+ {
+ aProp <<= (sal_Int32) getMax();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+// ----------------------------------------------------
+// class VCLXNumericField
+// ----------------------------------------------------
+VCLXNumericField::VCLXNumericField()
+{
+}
+
+VCLXNumericField::~VCLXNumericField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXNumericField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ {
+ // z.B. 105, 2 Digits => 1,05
+ // ein float 1,05 muss also eine 105 einstellen...
+ pNumericFormatter->SetValue(
+ ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
+ }
+}
+
+double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter
+ ? ImplCalcDoubleValue( (double)pNumericFormatter->GetValue(), pNumericFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ pNumericFormatter->SetMin(
+ ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter
+ ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMin(), pNumericFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ pNumericFormatter->SetMax(
+ ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter
+ ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMax(), pNumericFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ if ( pNumericField )
+ pNumericField->SetFirst(
+ ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ return pNumericField
+ ? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ if ( pNumericField )
+ pNumericField->SetLast(
+ ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ return pNumericField
+ ? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ if ( pNumericField )
+ pNumericField->SetSpinSize(
+ ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ return pNumericField
+ ? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ {
+ double n = getValue();
+ pNumericFormatter->SetDecimalDigits( Value );
+ setValue( n );
+ }
+}
+
+sal_Int16 VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
+}
+
+void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ if ( bVoid )
+ {
+ ((NumericField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((NumericField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ double d;
+ if ( Value >>= d )
+ setValue( d );
+ }
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ double d;
+ if ( Value >>= d )
+ setMin( d );
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ double d;
+ if ( Value >>= d )
+ setMax( d );
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ double d;
+ if ( Value >>= d )
+ setSpinSize( d );
+ }
+ break;
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ setDecimalDigits( n );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXNumericField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ aProp <<= (double) getValue();
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ aProp <<= (double) getMin();
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ aProp <<= (double) getMax();
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ aProp <<= (double) getSpinSize();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+// ----------------------------------------------------
+// class VCLXCurrencyField
+// ----------------------------------------------------
+VCLXCurrencyField::VCLXCurrencyField()
+{
+}
+
+VCLXCurrencyField::~VCLXCurrencyField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXCurrencyField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ {
+ // z.B. 105, 2 Digits => 1,05
+ // ein float 1,05 muss also eine 105 einstellen...
+ pCurrencyFormatter->SetValue(
+ ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
+ }
+}
+
+double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter
+ ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetValue(), pCurrencyFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ pCurrencyFormatter->SetMin(
+ ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter
+ ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMin(), pCurrencyFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ pCurrencyFormatter->SetMax(
+ ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter
+ ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMax(), pCurrencyFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ if ( pCurrencyField )
+ pCurrencyField->SetFirst(
+ ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ return pCurrencyField
+ ? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ if ( pCurrencyField )
+ pCurrencyField->SetLast(
+ ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ return pCurrencyField
+ ? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ if ( pCurrencyField )
+ pCurrencyField->SetSpinSize(
+ ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ return pCurrencyField
+ ? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ {
+ double n = getValue();
+ pCurrencyFormatter->SetDecimalDigits( Value );
+ setValue( n );
+ }
+}
+
+sal_Int16 VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter ? pCurrencyFormatter->GetDecimalDigits() : 0;
+}
+
+void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ if ( bVoid )
+ {
+ ((LongCurrencyField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((LongCurrencyField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ double d;
+ if ( Value >>= d )
+ setValue( d );
+ }
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ double d;
+ if ( Value >>= d )
+ setMin( d );
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ double d;
+ if ( Value >>= d )
+ setMax( d );
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ double d;
+ if ( Value >>= d )
+ setSpinSize( d );
+ }
+ break;
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int16 n;
+ if ( Value >>= n )
+ setDecimalDigits( n );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ aProp <<= (double) getValue();
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ aProp <<= (double) getMin();
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ aProp <<= (double) getMax();
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ aProp <<= (double) getSpinSize();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+// ----------------------------------------------------
+// class VCLXPatternField
+// ----------------------------------------------------
+VCLXPatternField::VCLXPatternField()
+{
+}
+
+VCLXPatternField::~VCLXPatternField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPatternField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPatternField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPatternField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXPatternField::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ {
+ pPatternField->SetMask( ByteString( UniString( EditMask ), RTL_TEXTENCODING_ASCII_US ), LiteralMask );
+ }
+}
+
+void VCLXPatternField::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ {
+ EditMask = String( pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US );
+ LiteralMask = pPatternField->GetLiteralMask();
+ }
+}
+
+void VCLXPatternField::setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ {
+ pPatternField->SetString( Str );
+ }
+}
+
+::rtl::OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aString;
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ aString = pPatternField->GetString();
+ return aString;
+}
+
+void VCLXPatternField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+void VCLXPatternField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_EDITMASK:
+ case BASEPROPERTY_LITERALMASK:
+ {
+ ::rtl::OUString aString;
+ if ( Value >>= aString )
+ {
+ ::rtl::OUString aEditMask, aLiteralMask;
+ getMasks( aEditMask, aLiteralMask );
+ if ( nPropType == BASEPROPERTY_EDITMASK )
+ aEditMask = aString;
+ else
+ aLiteralMask = aString;
+ setMasks( aEditMask, aLiteralMask );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXPatternField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_EDITMASK:
+ case BASEPROPERTY_LITERALMASK:
+ {
+ ::rtl::OUString aEditMask, aLiteralMask;
+ getMasks( aEditMask, aLiteralMask );
+ if ( nPropType == BASEPROPERTY_EDITMASK )
+ aProp <<= aEditMask;
+ else
+ aProp <<= aLiteralMask;
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+
diff --git a/toolkit/source/controls/makefile.mk b/toolkit/source/controls/makefile.mk
new file mode 100644
index 000000000000..e2f5d805655a
--- /dev/null
+++ b/toolkit/source/controls/makefile.mk
@@ -0,0 +1,90 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=controls
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/stdtabcontroller.obj \
+ $(SLO)$/stdtabcontrollermodel.obj \
+ $(SLO)$/unocontrol.obj \
+ $(SLO)$/unocontrolbase.obj \
+ $(SLO)$/unocontrolcontainer.obj \
+ $(SLO)$/unocontrolcontainermodel.obj \
+ $(SLO)$/unocontrolmodel.obj \
+ $(SLO)$/unocontrols.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx
new file mode 100644
index 000000000000..6d36fdd6b567
--- /dev/null
+++ b/toolkit/source/controls/stdtabcontroller.cxx
@@ -0,0 +1,440 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdtabcontroller.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/controls/stdtabcontrollermodel.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <tools/debug.hxx>
+#include <vcl/window.hxx>
+
+#include <unotools/sequence.hxx>
+
+// ----------------------------------------------------
+// class StdTabController
+// ----------------------------------------------------
+StdTabController::StdTabController()
+{
+}
+
+StdTabController::~StdTabController()
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > StdTabController::ImplFindControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rCtrls,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rxCtrlModel ) const
+{
+
+/*
+ // MT: Funktioniert nicht mehr, weil ich nicht mehr bei mir angemeldet bin,
+ // weil DG das abfaengt.
+
+ // #54677# Beim Laden eines HTML-Dokuments wird nach jedem Control ein
+ // activateTabOrder gerufen und jede Menge Zeit in dieser Methode verbraten.
+ // Die Anzahl dieser Schleifendurchlaufe steigt quadratisch, also versuchen
+ // das Control direkt vom Model zu erhalten.
+ // => Wenn genau ein Control als PropertyChangeListener angemeldet ist,
+ // dann muss das auch das richtige sein.
+
+ UnoControlModel* pUnoCtrlModel = UnoControlModel::GetImplementation( rxCtrlModel );
+
+
+ if ( pUnoCtrlModel )
+ {
+ ListenerIterator aIt( pUnoCtrlModel->maPropertiesListeners );
+ while( aIt.hasMoreElements() )
+ {
+ XEventListener* pL = aIt.next();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xC( pL, ::com::sun::star::uno::UNO_QUERY );
+ if ( xC.is() )
+ {
+ if( xC->getContext() == mxControlContainer )
+ {
+ xCtrl = xC;
+ break;
+ }
+ }
+ }
+ }
+ if ( !xCtrl.is() && rxCtrlModel.is())
+*/
+ DBG_ASSERT( rxCtrlModel.is(), "ImplFindControl - welches ?!" );
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pCtrls = rCtrls.getConstArray();
+ sal_uInt32 nCtrls = rCtrls.getLength();
+ for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xModel(pCtrls[n].is() ? pCtrls[n]->getModel() : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ());
+ if ( (::com::sun::star::awt::XControlModel*)xModel.get() == (::com::sun::star::awt::XControlModel*)rxCtrlModel.get() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl( pCtrls[n] );
+ ::utl::removeElementAt( rCtrls, n );
+ return xCtrl;
+ }
+ }
+ return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > ();
+}
+
+sal_Bool StdTabController::ImplCreateComponentSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rModels, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& rComponents, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>* pTabStops, sal_Bool bPeerComponent ) const
+{
+ sal_Bool bOK = sal_True;
+
+ // nur die wirklich geforderten Controls
+ sal_uInt32 nModels = rModels.getLength();
+ if (nModels != rControls.getLength())
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >(nModels);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pModels = rModels.getConstArray();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCurrentModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCurrentControl;
+
+ sal_uInt32 nRealControls = 0;
+ for (sal_uInt32 n = 0; n < nModels; ++n)
+ {
+ xCurrentModel = pModels[n];
+ xCurrentControl = ImplFindControl(rControls, xCurrentModel);
+ if (xCurrentControl.is())
+ aSeq.getArray()[nRealControls++] = xCurrentControl;
+ }
+ aSeq.realloc(nRealControls);
+ rControls = aSeq;
+ }
+
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pControls = rControls.getConstArray();
+ sal_uInt32 nCtrls = rControls.getLength();
+ rComponents = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >( nCtrls );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = rComponents.getArray();
+ ::com::sun::star::uno::Any* pTabs = NULL;
+
+
+ if ( pTabStops )
+ {
+ *pTabStops = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>( nCtrls );
+ pTabs = pTabStops->getArray();
+ }
+
+ for ( sal_uInt32 n = 0; bOK && ( n < nCtrls ); n++ )
+ {
+ // Zum Model passendes Control suchen
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl(pControls[n]);
+ if ( xCtrl.is() )
+ {
+ if (bPeerComponent)
+ pComps[n] = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > (xCtrl->getPeer(), ::com::sun::star::uno::UNO_QUERY);
+ else
+ pComps[n] = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > (xCtrl, ::com::sun::star::uno::UNO_QUERY);
+
+ // TabStop-::com::sun::star::beans::Property
+ if ( pTabs )
+ {
+ // opt: String fuer TabStop als Konstante
+ static const ::rtl::OUString aTabStopName( ::rtl::OUString::createFromAscii( "Tabstop" ) );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( xCtrl->getModel(), ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
+ if( xInfo->hasPropertyByName( aTabStopName ) )
+ pTabs[n] = xPSet->getPropertyValue( aTabStopName );
+ }
+ }
+ else
+ {
+ DBG_TRACE( "ImplCreateComponentSequence: Control not found" );
+ bOK = sal_False;
+ }
+ }
+ return bOK;
+}
+
+void StdTabController::ImplActivateControl( sal_Bool bFirst ) const
+{
+ // HACK wegen #53688#, muss auf ein Interface abgebildet werden, wenn Controls Remote liegen koennen.
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(const_cast< ::cppu::OWeakObject* >(static_cast< const ::cppu::OWeakObject* >(this)), ::com::sun::star::uno::UNO_QUERY);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = xTabController->getControls();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pControls = aCtrls.getConstArray();
+ sal_uInt32 nCount = aCtrls.getLength();
+
+ for ( sal_uInt32 n = bFirst ? 0 : nCount; bFirst ? ( n < nCount ) : n; )
+ {
+ sal_uInt32 nCtrl = bFirst ? n++ : --n;
+ DBG_ASSERT( pControls[nCtrl].is(), "Control nicht im ::com::sun::star::sdbcx::Container!" );
+ if ( pControls[nCtrl].is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xCP = pControls[nCtrl]->getPeer();
+ if ( xCP.is() )
+ {
+ VCLXWindow* pC = VCLXWindow::GetImplementation( xCP );
+ if ( pC && pC->GetWindow() && ( pC->GetWindow()->GetStyle() & WB_TABSTOP ) )
+ {
+ pC->GetWindow()->GrabFocus();
+ break;
+ }
+ }
+ }
+ }
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any StdTabController::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTabController*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( StdTabController )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+void StdTabController::setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& Model ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mxModel = Model;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > StdTabController::getModel( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxModel;
+}
+
+void StdTabController::setContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& Container ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mxControlContainer = Container;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > StdTabController::getContainer( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxControlContainer;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > StdTabController::getControls( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aSeq;
+
+ if ( mxControlContainer.is() )
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aModels = mxModel->getControlModels();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pModels = aModels.getConstArray();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > xCtrls = mxControlContainer->getControls();
+
+ sal_uInt32 nCtrls = aModels.getLength();
+ aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >( nCtrls );
+ for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrlModel = pModels[n];
+ // Zum Model passendes Control suchen
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl = ImplFindControl( xCtrls, xCtrlModel );
+ aSeq.getArray()[n] = xCtrl;
+ }
+ }
+ return aSeq;
+}
+
+void StdTabController::autoTabOrder( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ DBG_ASSERT( mxControlContainer.is(), "autoTabOrder: No ControlContainer!" );
+ if ( !mxControlContainer.is() )
+ return;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = mxModel->getControlModels();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq;
+
+ // vieleicht erhalte ich hier einen TabController,
+ // der schneller die Liste meiner Controls ermittelt
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), ::com::sun::star::uno::UNO_QUERY);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aControls = xTabController->getControls();
+
+ // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im ::com::sun::star::sdbcx::Container,
+ // dann kommt spaeter nochmal ein autoTabOrder...
+ if( !ImplCreateComponentSequence( aControls, aSeq, aCompSeq, NULL, sal_False ) )
+ return;
+
+ sal_uInt32 nCtrls = aCompSeq.getLength();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComponents = aCompSeq.getArray();
+
+ ComponentEntryList aCtrls;
+ sal_uInt32 n;
+ for ( n = 0; n < nCtrls; n++ )
+ {
+ ::com::sun::star::awt::XWindow* pC = (::com::sun::star::awt::XWindow*)pComponents[n].get();
+ ComponentEntry* pE = new ComponentEntry;
+ pE->pComponent = pC;
+ ::com::sun::star::awt::Rectangle aPosSize = pC->getPosSize();
+ pE->aPos.X() = aPosSize.X;
+ pE->aPos.Y() = aPosSize.Y;
+
+ sal_uInt16 nPos;
+ for ( nPos = 0; nPos < aCtrls.Count(); nPos++ )
+ {
+ ComponentEntry* pEntry = aCtrls.GetObject( nPos );
+ if ( pEntry->aPos.Y() >= pE->aPos.Y() )
+ {
+ while ( pEntry && ( pEntry->aPos.Y() == pE->aPos.Y() )
+ && ( pEntry->aPos.X() < pE->aPos.X() ) )
+ {
+ pEntry = aCtrls.GetObject( ++nPos );
+ }
+ break;
+ }
+ }
+ aCtrls.Insert( pE, nPos );
+ }
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aNewSeq( nCtrls );
+ for ( n = 0; n < nCtrls; n++ )
+ {
+ ComponentEntry* pE = aCtrls.GetObject( n );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xUC( pE->pComponent, ::com::sun::star::uno::UNO_QUERY );
+ aNewSeq.getArray()[n] = xUC->getModel();
+ delete pE;
+ }
+ aCtrls.Clear();
+
+ mxModel->setControlModels( aNewSeq );
+}
+
+void StdTabController::activateTabOrder( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Am ::com::sun::star::sdbcx::Container die Tab-Reihenfolge aktivieren...
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xC( mxControlContainer, ::com::sun::star::uno::UNO_QUERY );
+ if ( !xC.is() || !xC->getPeer().is() )
+ return;
+
+ // vieleicht erhalte ich hier einen TabController,
+ // der schneller die Liste meiner Controls ermittelt
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), ::com::sun::star::uno::UNO_QUERY);
+
+ // Flache Liste besorgen...
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = mxModel->getControlModels();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aTabSeq;
+
+ // DG: Aus Optimierungsgruenden werden die Controls mittels getControls() geholt,
+ // dieses hoert sich zwar wiedersinning an, fuehrt aber im konkreten Fall (Forms) zu sichtbaren
+ // Geschwindigkeitsvorteilen
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = xTabController->getControls();
+
+ // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im ::com::sun::star::sdbcx::Container,
+ // dann kommt spaeter nochmal ein activateTabOrder...
+ if( !ImplCreateComponentSequence( aCtrls, aSeq, aCompSeq, &aTabSeq, sal_True ) )
+ return;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer > xVclContainerPeer( xC->getPeer(), ::com::sun::star::uno::UNO_QUERY );
+
+ xVclContainerPeer->setTabOrder( aCompSeq, aTabSeq, mxModel->getGroupControl() );
+
+ // Gruppen...
+ aCtrls = xTabController->getControls();
+
+ ::rtl::OUString aName;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupSeq;
+ sal_uInt32 nGroups = mxModel->getGroupCount();
+ for ( sal_uInt32 nG = 0; nG < nGroups; nG++ )
+ {
+ mxModel->getGroup( nG, aGroupSeq, aName );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aCompSeq;
+ ImplCreateComponentSequence( aCtrls, aGroupSeq, aCompSeq, NULL, sal_True );
+ xVclContainerPeer->setGroup( aCompSeq );
+ }
+}
+
+void StdTabController::activateFirst( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ImplActivateControl( sal_True );
+}
+
+void StdTabController::activateLast( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ImplActivateControl( sal_False );
+}
+
diff --git a/toolkit/source/controls/stdtabcontrollermodel.cxx b/toolkit/source/controls/stdtabcontrollermodel.cxx
new file mode 100644
index 000000000000..4d5661be940c
--- /dev/null
+++ b/toolkit/source/controls/stdtabcontrollermodel.cxx
@@ -0,0 +1,442 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdtabcontrollermodel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
+#include <com/sun/star/io/XMarkableStream.hpp>
+#endif
+
+#include <toolkit/controls/stdtabcontrollermodel.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/property.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <tools/debug.hxx>
+
+#define UNOCONTROL_STREAMVERSION (short)2
+
+// ----------------------------------------------------
+// class UnoControlModelEntryList
+// ----------------------------------------------------
+UnoControlModelEntryList::UnoControlModelEntryList()
+{
+}
+
+UnoControlModelEntryList::~UnoControlModelEntryList()
+{
+ Reset();
+}
+
+void UnoControlModelEntryList::Reset()
+{
+ for ( sal_uInt32 n = Count(); n; )
+ DestroyEntry( --n );
+}
+
+void UnoControlModelEntryList::DestroyEntry( sal_uInt32 nEntry )
+{
+ UnoControlModelEntry* pEntry = GetObject( nEntry );
+
+ if ( pEntry->bGroup )
+ delete pEntry->pGroup;
+ else
+ delete pEntry->pxControl;
+
+ Remove( nEntry );
+ delete pEntry;
+}
+
+// ----------------------------------------------------
+// class StdTabControllerModel
+// ----------------------------------------------------
+StdTabControllerModel::StdTabControllerModel()
+{
+ mbGroupControl = sal_True;
+}
+
+StdTabControllerModel::~StdTabControllerModel()
+{
+}
+
+sal_uInt32 StdTabControllerModel::ImplGetControlCount( const UnoControlModelEntryList& rList ) const
+{
+ sal_uInt32 nCount = 0;
+ sal_uInt32 nEntries = rList.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = rList.GetObject( n );
+ if ( pEntry->bGroup )
+ nCount += ImplGetControlCount( *pEntry->pGroup );
+ else
+ nCount++;
+ }
+ return nCount;
+}
+
+void StdTabControllerModel::ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** ppRefs, const UnoControlModelEntryList& rList ) const
+{
+ sal_uInt32 nEntries = rList.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = rList.GetObject( n );
+ if ( pEntry->bGroup )
+ ImplGetControlModels( ppRefs, *pEntry->pGroup );
+ else
+ {
+ **ppRefs = *pEntry->pxControl;
+ (*ppRefs)++;
+ }
+ }
+}
+
+void StdTabControllerModel::ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const
+{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = Controls.getConstArray();
+ sal_uInt32 nControls = Controls.getLength();
+ for ( sal_uInt32 n = 0; n < nControls; n++ )
+ {
+ UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
+ pNewEntry->bGroup = sal_False;
+ pNewEntry->pxControl = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ;
+ *pNewEntry->pxControl = pRefs[n];
+ rList.Insert( pNewEntry, LIST_APPEND );
+ }
+}
+
+sal_uInt32 StdTabControllerModel::ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const
+{
+ for ( sal_uInt32 n = rList.Count(); n; )
+ {
+ UnoControlModelEntry* pEntry = rList.GetObject( --n );
+ if ( !pEntry->bGroup && ( *pEntry->pxControl == xCtrl ) )
+ return n;
+ }
+ return CONTROLPOS_NOTFOUND;
+}
+
+void ImplWriteControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rCtrls )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
+
+ sal_uInt32 nStoredControls = 0;
+ sal_Int32 nDataBeginMark = xMark->createMark();
+
+ OutStream->writeLong( 0L ); // DataLen
+ OutStream->writeLong( 0L ); // nStoredControls
+
+ sal_uInt32 nCtrls = rCtrls.getLength();
+ for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI = rCtrls.getConstArray()[n];
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xPO( xI, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xPO.is(), "write: Control doesn't support XPersistObject" );
+ if ( xPO.is() )
+ {
+ OutStream->writeObject( xPO );
+ nStoredControls++;
+ }
+ }
+ sal_Int32 nDataLen = xMark->offsetToMark( nDataBeginMark );
+ xMark->jumpToMark( nDataBeginMark );
+ OutStream->writeLong( nDataLen );
+ OutStream->writeLong( nStoredControls );
+ xMark->jumpToFurthest();
+ xMark->deleteMark(nDataBeginMark);
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > ImplReadControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & InStream )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
+
+ sal_Int32 nDataBeginMark = xMark->createMark();
+
+ sal_Int32 nDataLen = InStream->readLong();
+ sal_uInt32 nCtrls = InStream->readLong();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( nCtrls );
+ for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xObj = InStream->readObject();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI( xObj, ::com::sun::star::uno::UNO_QUERY );
+ aSeq.getArray()[n] = xI;
+ }
+
+ // Falls bereits mehr drinsteht als diese Version kennt:
+ xMark->jumpToMark( nDataBeginMark );
+ InStream->skipBytes( nDataLen );
+ xMark->deleteMark(nDataBeginMark);
+ return aSeq;
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any StdTabControllerModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTabControllerModel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( StdTabControllerModel )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+sal_Bool StdTabControllerModel::getGroupControl( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mbGroupControl;
+}
+
+void StdTabControllerModel::setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mbGroupControl = GroupControl;
+}
+
+void StdTabControllerModel::setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maControls.Reset();
+ ImplSetControlModels( maControls, Controls );
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > StdTabControllerModel::getControlModels( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( ImplGetControlCount( maControls ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
+ ImplGetControlModels( &pRefs, maControls );
+ return aSeq;
+}
+
+void StdTabControllerModel::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Die Controls stehen eventuel flach in der Liste und werden jetzt gruppiert.
+ // Verschachtelte Gruppen sind erstmal nicht moeglich...
+ // Das erste Element der Gruppe welches auch schon in der flachen Liste
+ // stand bestimmt die Position der Gruppe.
+
+ UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
+ pNewEntry->bGroup = sal_True;
+ pNewEntry->pGroup = new UnoControlModelEntryList;
+ pNewEntry->pGroup->SetName( GroupName );
+ ImplSetControlModels( *pNewEntry->pGroup, Group );
+
+ sal_Bool bInserted = sal_False;
+ sal_uInt32 nElements = pNewEntry->pGroup->Count();
+ for ( sal_uInt32 n = 0; n < nElements; n++ )
+ {
+ UnoControlModelEntry* pEntry = pNewEntry->pGroup->GetObject( n );
+ if ( !pEntry->bGroup )
+ {
+ sal_uInt32 nPos = ImplGetControlPos( *pEntry->pxControl, maControls );
+ // Eigentlich sollten alle Controls vorher in der flachen Liste stehen
+ DBG_ASSERT( nPos != CONTROLPOS_NOTFOUND, "setGroup - Element not found" );
+ if ( nPos != CONTROLPOS_NOTFOUND )
+ {
+ maControls.DestroyEntry( nPos );
+ if ( !bInserted )
+ {
+ maControls.Insert( pNewEntry, nPos );
+ bInserted = sal_True;
+ }
+ }
+ }
+ }
+ if ( !bInserted )
+ maControls.Insert( pNewEntry, LIST_APPEND );
+}
+
+sal_Int32 StdTabControllerModel::getGroupCount( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // erstmal nur eine Ebene...
+ // Das Model und die Impl-Methoden arbeiten zwar rekursiv, aber das wird
+ // erstmal nich nach aussen gegeben.
+
+ sal_Int32 nGroups = 0;
+ sal_uInt32 nEntries = maControls.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = maControls.GetObject( n );
+ if ( pEntry->bGroup )
+ nGroups++;
+ }
+ return nGroups;
+}
+
+void StdTabControllerModel::getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup, ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq;
+ sal_uInt32 nG = 0;
+ sal_uInt32 nEntries = maControls.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = maControls.GetObject( n );
+ if ( pEntry->bGroup )
+ {
+ if ( nG == nGroup )
+ {
+ sal_uInt32 nCount = ImplGetControlCount( *pEntry->pGroup );
+ aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >( nCount );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
+ ImplGetControlModels( &pRefs, *pEntry->pGroup );
+ rName = pEntry->pGroup->GetName();
+ break;
+ }
+ nG++;
+ }
+ }
+ rGroup = aSeq;
+}
+
+void StdTabControllerModel::getGroupByName( const ::rtl::OUString& rName, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nGroup = 0;
+ sal_uInt32 nEntries = maControls.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = maControls.GetObject( n );
+ if ( pEntry->bGroup )
+ {
+ if ( pEntry->pGroup->GetName() == rName )
+ {
+ ::rtl::OUString Dummy;
+ getGroup( nGroup, rGroup, Dummy );
+ break;
+ }
+ nGroup++;
+ }
+ }
+}
+
+
+// ::com::sun::star::io::XPersistObject
+::rtl::OUString StdTabControllerModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel );
+}
+
+void StdTabControllerModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
+
+ OutStream->writeShort( UNOCONTROL_STREAMVERSION );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrls = getControlModels();
+ ImplWriteControls( OutStream, aCtrls );
+
+ sal_uInt32 nGroups = getGroupCount();
+ OutStream->writeLong( nGroups );
+ for ( sal_uInt32 n = 0; n < nGroups; n++ )
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupCtrls;
+ ::rtl::OUString aGroupName;
+ getGroup( n, aGroupCtrls, aGroupName );
+ OutStream->writeUTF( aGroupName );
+ ImplWriteControls( OutStream, aGroupCtrls );
+ }
+}
+
+void StdTabControllerModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ short nVersion = InStream->readShort();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = ImplReadControls( InStream );
+ setControlModels( aSeq );
+
+ sal_uInt32 nGroups = InStream->readLong();
+ for ( sal_uInt32 n = 0; n < nGroups; n++ )
+ {
+ ::rtl::OUString aGroupName = InStream->readUTF();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrlSeq = ImplReadControls( InStream );
+ setGroup( aCtrlSeq, aGroupName );
+ }
+}
+
+
+
+
+
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
new file mode 100644
index 000000000000..823be57cc4f3
--- /dev/null
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -0,0 +1,916 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrol.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LAN_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#include <toolkit/controls/unocontrol.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <tools/string.hxx>
+#include <tools/table.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+WorkWindow* lcl_GetDefaultWindow()
+{
+ static WorkWindow* pW = NULL;
+ if ( !pW )
+ pW = new WorkWindow( NULL, 0 );
+ return pW;
+}
+
+static ::com::sun::star::uno::Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > & rxModel )
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNames;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xPSInf = rxModel->getPropertySetInfo();
+ DBG_ASSERT( xPSInf.is(), "UpdateFromModel: No PropertySetInfo!" );
+ if ( xPSInf.is() )
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps = xPSInf->getProperties();
+ sal_Int32 nLen = aProps.getLength();
+ aNames = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nLen );
+ ::rtl::OUString* pNames = aNames.getArray() + nLen - 1;
+ const ::com::sun::star::beans::Property* pProps = aProps.getConstArray() + nLen - 1;
+ for ( sal_uInt32 n = nLen; n; --n, --pProps, --pNames)
+ *pNames = pProps->Name;
+ }
+ return aNames;
+}
+
+// ----------------------------------------------------
+// class UnoControl
+// ----------------------------------------------------
+UnoControl::UnoControl()
+ : maDisposeListeners( *this )
+ , maWindowListeners( *this )
+ , maFocusListeners( *this )
+ , maKeyListeners( *this )
+ , maMouseListeners( *this )
+ , maMouseMotionListeners( *this )
+ , maPaintListeners( *this )
+{
+ mbUpdatingModel = sal_False;
+ mbDisposePeer = sal_True;
+ mbRefeshingPeer = sal_False;
+ mbDesignMode = sal_False;
+}
+
+UnoControl::~UnoControl()
+{
+}
+
+::rtl::OUString UnoControl::GetComponentServiceName()
+{
+ return ::rtl::OUString();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP;
+
+ if ( bAcceptExistingPeer )
+ xP = mxPeer;
+
+ if ( !xP.is() )
+ {
+ // Peer unsichtbar erzeugen...
+ sal_Bool bVis = maComponentInfos.bVisible;
+ if( bVis )
+ maComponentInfos.bVisible = sal_False;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xCurrentPeer = mxPeer;
+ mxPeer = NULL;
+
+ // Ueber queryInterface, wegen Aggregation...
+ ::com::sun::star::uno::Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>*)0) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xMe;
+ aAny >>= xMe;
+
+ xMe->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >(), lcl_GetDefaultWindow()->GetComponentInterface( sal_True ) );
+ xP = mxPeer;
+ mxPeer = xCurrentPeer;
+
+ if( bVis )
+ maComponentInfos.bVisible = sal_True;
+ }
+ return xP;
+}
+
+void UnoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->setProperty( rPropName, rVal );
+}
+
+void UnoControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > UnoControl::getParentPeer() const
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xPeer;
+ if( mxContext.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xContComp( mxContext, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = xContComp->getPeer();
+ if ( xP.is() )
+ xP->queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >*)0) ) >>= xPeer;
+ }
+ return xPeer;
+}
+
+void UnoControl::updateFromModel()
+{
+ // Alle standard Properties werden ausgelesen und in das Peer uebertragen
+ if( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > xPropSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
+ xPropSet->firePropertiesChangeEvent( aNames, this );
+ }
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XControl*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XWindow*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, SAL_STATIC_CAST( ::com::sun::star::awt::XControl*, this ) ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XView*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XPropertiesChangeListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoControl )
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+void UnoControl::dispose( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() && mbDisposePeer )
+ {
+ mxPeer->dispose();
+ mxPeer = NULL;
+ }
+
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
+
+ maDisposeListeners.disposeAndClear(aEvt);
+ maWindowListeners.disposeAndClear(aEvt);
+ maFocusListeners.disposeAndClear(aEvt);
+ maKeyListeners.disposeAndClear(aEvt);
+ maMouseListeners.disposeAndClear(aEvt);
+ maMouseMotionListeners.disposeAndClear(aEvt);
+ maPaintListeners.disposeAndClear(aEvt);
+
+ // Model wieder freigeben
+ setModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > () );
+ setContext( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () );
+}
+
+void UnoControl::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maDisposeListeners.addInterface( rxListener );
+}
+
+void UnoControl::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maDisposeListeners.removeInterface( rxListener );
+}
+
+// ::com::sun::star::beans::XPropertiesChangeListener
+void UnoControl::propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // kommt von xModel
+ if( !IsUpdatingModel() && mxPeer.is() )
+ {
+ Table aDependingValues;
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ const ::com::sun::star::beans::PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
+ sal_uInt16 nPType = GetPropertyId( rEvt.PropertyName );
+ if ( nPType && mbDesignMode && mbDisposePeer && !mbRefeshingPeer )
+ {
+ // Im Design-Mode koennen sich Props aendern, die eine
+ // Neuerzeugung der Peer erfordern...
+ if ( ( nPType == BASEPROPERTY_BORDER ) ||
+ ( nPType == BASEPROPERTY_MULTILINE ) ||
+ ( nPType == BASEPROPERTY_DROPDOWN ) ||
+ ( nPType == BASEPROPERTY_HSCROLL ) ||
+ ( nPType == BASEPROPERTY_VSCROLL ) ||
+ ( nPType == BASEPROPERTY_SPIN ) ||
+ ( nPType == BASEPROPERTY_ALIGN ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xParent = getParentPeer();
+ if ( xParent.is() )
+ {
+ // Funktioniert beim Container nicht!
+ mxPeer->dispose();
+ mxPeer = NULL;
+ mbRefeshingPeer = sal_True;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP( xParent, ::com::sun::star::uno::UNO_QUERY );
+ // createPeer ueber Interface rufen, damit aggrigierende Klasse es mitbekommt
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xThis( (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this, ::com::sun::star::uno::UNO_QUERY );
+ xThis->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), xP );
+ mbRefeshingPeer = sal_False;
+ break;
+ }
+ }
+ }
+ if ( nPType && ( nLen > 1 ) && DoesDependOnOthers( nPType ) )
+ {
+ // Properties die von anderen abhaengen erst hinterher einstellen,
+ // weil sie von anderen Properties abhaengig sind, die aber erst spaeter
+ // eingestellt werden, z.B. VALUE nach VALUEMIN/MAX.
+ aDependingValues.Insert( nPType, new ::com::sun::star::uno::Any( rEvt.NewValue ) );
+ }
+ else
+ {
+ ImplSetPeerProperty( rEvt.PropertyName, rEvt.NewValue );
+ }
+ }
+
+ sal_uInt16 nDependings = aDependingValues.Count();
+ if ( nDependings )
+ {
+ for ( sal_uInt16 n = 0; n < nDependings; n++ )
+ {
+ ::com::sun::star::uno::Any* pAny = (::com::sun::star::uno::Any*) aDependingValues.GetObject( n );
+ sal_Int32 nPropId = aDependingValues.GetObjectKey( n );
+ ::rtl::OUString aPropName = GetPropertyName( nPropId );
+ ImplSetPeerProperty( aPropName, *pAny );
+ delete pAny;
+ }
+ }
+ }
+}
+
+void UnoControl::disposing( const ::com::sun::star::lang::EventObject& rEvt ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ // kommt von xModel, bei "Multible Inheritance" nicht unterschiedliche
+ // Typen vergleichen.
+
+ if( mxModel == rEvt.Source )
+ {
+ mxModel = NULL;
+
+ // #62337# Ohne Model wollen wir nicht weiterleben
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xThis = this;
+ xThis->dispose();
+ }
+}
+
+
+// ::com::sun::star::awt::XWindow
+void UnoControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maComponentInfos.nX = X;
+ maComponentInfos.nY = Y;
+ maComponentInfos.nWidth = Width;
+ maComponentInfos.nHeight = Height;
+ maComponentInfos.nFlags = Flags;
+
+ if( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->setPosSize( X, Y, Width, Height, Flags );
+ }
+}
+
+::com::sun::star::awt::Rectangle UnoControl::getPosSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return ::com::sun::star::awt::Rectangle( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight);
+}
+
+void UnoControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Visible status ist Sache der ::com::sun::star::sdbcx::View
+ maComponentInfos.bVisible = bVisible;
+ if( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->setVisible( maComponentInfos.bVisible );
+ }
+}
+
+void UnoControl::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Enable status ist Sache der ::com::sun::star::sdbcx::View
+ maComponentInfos.bEnable = bEnable;
+ if( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->setEnable( maComponentInfos.bEnable );
+ }
+}
+
+void UnoControl::setFocus( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->setFocus();
+ }
+}
+
+void UnoControl::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maWindowListeners.addInterface( rxListener );
+ if( mxPeer.is() && maWindowListeners.getLength() == 1 )
+ {
+ // erster Focus Listener, also am Peer anmelden
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->addWindowListener( &maWindowListeners );
+ }
+}
+
+void UnoControl::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() && maWindowListeners.getLength() == 1 )
+ {
+ // letzter Focus Listener, also am Peer abmelden
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->removeWindowListener( &maWindowListeners );
+ }
+ maWindowListeners.removeInterface( rxListener );
+}
+
+void UnoControl::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maFocusListeners.addInterface( rxListener );
+ if( mxPeer.is() && maFocusListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->addFocusListener( &maFocusListeners );
+ }
+}
+
+void UnoControl::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() && maFocusListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->removeFocusListener( &maFocusListeners );
+ }
+ maFocusListeners.removeInterface( rxListener );
+}
+
+void UnoControl::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maKeyListeners.addInterface( rxListener );
+ if( mxPeer.is() && maKeyListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->addKeyListener( &maKeyListeners);
+ }
+}
+
+void UnoControl::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() && maKeyListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->removeKeyListener( &maKeyListeners);
+ }
+ maKeyListeners.removeInterface( rxListener );
+}
+
+void UnoControl::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maMouseListeners.addInterface( rxListener );
+ if( mxPeer.is() && maMouseListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );;
+ xW->addMouseListener( &maMouseListeners);
+ }
+}
+
+void UnoControl::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() && maMouseListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->removeMouseListener( &maMouseListeners);
+ }
+ maMouseListeners.removeInterface( rxListener );
+}
+
+void UnoControl::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maMouseMotionListeners.addInterface( rxListener );
+ if( mxPeer.is() && maMouseMotionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->addMouseMotionListener( &maMouseMotionListeners);
+ }
+}
+
+void UnoControl::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() && maMouseMotionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->removeMouseMotionListener( &maMouseMotionListeners);
+ }
+ maMouseMotionListeners.removeInterface( rxListener );
+}
+
+void UnoControl::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maPaintListeners.addInterface( rxListener );
+ if( mxPeer.is() && maPaintListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->addPaintListener( &maPaintListeners );
+ }
+}
+
+void UnoControl::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( mxPeer.is() && maPaintListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->removePaintListener( &maPaintListeners );
+ }
+ maPaintListeners.removeInterface( rxListener );
+}
+
+// ::com::sun::star::awt::XView
+sal_Bool UnoControl::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rDevice ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mxGraphics = rDevice;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ if ( xV.is() )
+ xV->setGraphics( mxGraphics );
+ }
+ return sal_True;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > UnoControl::getGraphics( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxGraphics;
+}
+
+::com::sun::star::awt::Size UnoControl::getSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ::com::sun::star::awt::Size( maComponentInfos.nWidth, maComponentInfos.nHeight );
+}
+
+void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( xP, ::com::sun::star::uno::UNO_QUERY );
+ xV->draw( x, y );
+
+ if ( !mxPeer.is() || ( mxPeer != xP ) )
+ xP->dispose();
+ }
+}
+
+void UnoControl::setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maComponentInfos.nZoomX = fZoomX;
+ maComponentInfos.nZoomY = fZoomY;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xV->setZoom( fZoomX, fZoomY );
+ }
+}
+
+// ::com::sun::star::awt::XControl
+void UnoControl::setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxContext ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mxContext = rxContext;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > UnoControl::getContext( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxContext;
+}
+
+void UnoControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParentPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( !mxPeer.is() )
+ {
+ ::com::sun::star::awt::WindowClass eType;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xToolkit = rxToolkit;
+ if( rParentPeer.is() && mxContext.is() )
+ {
+ // kein TopWindow
+ if ( !xToolkit.is() )
+ xToolkit = rParentPeer->getToolkit();
+ ::com::sun::star::uno::Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer>*)0) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xC;
+ aAny >>= xC;
+ if( xC.is() )
+ // Es ist ein Container
+ eType = ::com::sun::star::awt::WindowClass_CONTAINER;
+ else
+ eType = ::com::sun::star::awt::WindowClass_SIMPLE;
+ }
+ else
+ { // Nur richtig, wenn es sich um ein Top Window handelt
+ if( rParentPeer.is() )
+ {
+ if ( !xToolkit.is() )
+ xToolkit = rParentPeer->getToolkit();
+ eType = ::com::sun::star::awt::WindowClass_CONTAINER;
+ }
+ else
+ {
+ if ( !xToolkit.is() )
+ xToolkit = VCLUnoHelper::CreateToolkit();
+ eType = ::com::sun::star::awt::WindowClass_TOP;
+ }
+ }
+ ::com::sun::star::awt::WindowDescriptor aDescr;
+ aDescr.Type = eType;
+ aDescr.WindowServiceName = GetComponentServiceName();
+ aDescr.Parent = rParentPeer;
+ aDescr.Bounds = getPosSize();
+ aDescr.WindowAttributes = 0;
+
+ // ::com::sun::star::sheet::Border
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
+
+ ::com::sun::star::uno::Any aVal;
+ ::rtl::OUString aPropName = GetPropertyName( BASEPROPERTY_BORDER );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Int16 n;
+ if ( aVal >>= n )
+ {
+ if ( n )
+ aDescr.WindowAttributes |= ::com::sun::star::awt::WindowAttribute::BORDER;
+ else
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER;
+ }
+ }
+
+ // Dropdown
+ aPropName = GetPropertyName( BASEPROPERTY_DROPDOWN );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b;
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN;
+ }
+
+ // Spin
+ aPropName = GetPropertyName( BASEPROPERTY_SPIN );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b;
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::SPIN;
+ }
+
+ // HScroll
+ aPropName = GetPropertyName( BASEPROPERTY_HSCROLL );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b;
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL;
+ }
+
+ // VScroll
+ aPropName = GetPropertyName( BASEPROPERTY_VSCROLL );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b;
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL;
+ }
+
+ // Align
+ aPropName = GetPropertyName( BASEPROPERTY_ALIGN );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Int16 n;
+ if ( aVal >>= n )
+ {
+ if ( n == PROPERTY_ALIGN_LEFT )
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::LEFT;
+ else if ( n == PROPERTY_ALIGN_CENTER )
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::CENTER;
+ else
+ aDescr.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT;
+ }
+ }
+
+ // Ableitungen die Moeglichkeit geben die Attribute zu manipulieren
+ PrepareWindowDescriptor(aDescr);
+
+ // Jetzt die Peer erzeugen
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xWP = xToolkit->createWindow( aDescr );
+
+ // mxPeer initialisieren...
+ mxPeer = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >( xWP, ::com::sun::star::uno::UNO_QUERY );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > xV( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xV->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY );
+
+ updateFromModel();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+
+ if( maComponentInfos.bVisible && !mbDesignMode )
+ // Erst nach dem setzen der Daten anzeigen
+ xW->setVisible( maComponentInfos.bVisible );
+
+ if( !maComponentInfos.bEnable )
+ xW->setEnable( maComponentInfos.bEnable );
+
+ if ( maWindowListeners.getLength() )
+ xW->addWindowListener( &maWindowListeners );
+
+ if ( maFocusListeners.getLength() )
+ xW->addFocusListener( &maFocusListeners );
+
+ if ( maKeyListeners.getLength() )
+ xW->addKeyListener( &maKeyListeners );
+
+ if ( maMouseListeners.getLength() )
+ xW->addMouseListener( &maMouseListeners );
+
+ if ( maMouseMotionListeners.getLength() )
+ xW->addMouseMotionListener( &maMouseMotionListeners );
+
+ if ( maPaintListeners.getLength() )
+ xW->addPaintListener( &maPaintListeners );
+
+ xV->setGraphics( mxGraphics );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > UnoControl::getPeer( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxPeer;
+}
+
+sal_Bool UnoControl::setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > xPropSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+
+ if( xPropSet.is() )
+ xPropSet->removePropertiesChangeListener( this );
+
+ mxModel = rxModel;
+ if( mxModel.is() )
+ {
+ xPropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > ( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
+ xPropSet->addPropertiesChangeListener( aNames, this );
+ }
+ }
+ return mxModel.is();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > UnoControl::getModel( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxModel;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > UnoControl::getView( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return (::com::sun::star::awt::XView*)this;
+}
+
+void UnoControl::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mbDesignMode = bOn;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->setVisible( !bOn );
+ }
+}
+
+sal_Bool UnoControl::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mbDesignMode;
+}
+
+sal_Bool UnoControl::isTransparent( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return sal_False;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString UnoControl::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ DBG_ERROR( "This method should be overloaded!" );
+ return ::rtl::OUString();
+}
+
+sal_Bool UnoControl::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == rServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControl::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ DBG_ERROR( "This method should be overloaded!" );
+ return ::com::sun::star::uno::Sequence< ::rtl::OUString >();
+}
+
+
+
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
new file mode 100644
index 000000000000..3bfead451907
--- /dev/null
+++ b/toolkit/source/controls/unocontrolbase.cxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolbase.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#endif
+
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/property.hxx>
+
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class UnoControlBase
+// ----------------------------------------------------
+
+sal_Bool UnoControlBase::ImplHasProperty( const ::rtl::OUString& aPropertyName )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
+ return xInfo->hasPropertyByName( aPropertyName );
+}
+
+void UnoControlBase::ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis )
+{
+ // Model ggf. schon abgemeldet, aber ein Event schlaegt noch zu...
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ if ( !bUpdateThis )
+ StartUpdatingModel();
+ xPSet->setPropertyValue( aPropertyName, aValue );
+ if ( !bUpdateThis )
+ EndUpdatingModel();
+ }
+}
+
+::com::sun::star::uno::Any UnoControlBase::ImplGetPropertyValue( const ::rtl::OUString& aPropertyName )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ return xPSet->getPropertyValue( aPropertyName );
+}
+
+sal_Bool UnoControlBase::ImplGetPropertyValue_BOOL( sal_uInt16 nProp )
+{
+ sal_Bool b = sal_False;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= b;
+ }
+ return b;
+}
+
+sal_Int16 UnoControlBase::ImplGetPropertyValue_INT16( sal_uInt16 nProp )
+{
+ sal_Int16 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+sal_uInt16 UnoControlBase::ImplGetPropertyValue_UINT16( sal_uInt16 nProp )
+{
+ sal_uInt16 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+sal_Int32 UnoControlBase::ImplGetPropertyValue_INT32( sal_uInt16 nProp )
+{
+ sal_Int32 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+sal_uInt32 UnoControlBase::ImplGetPropertyValue_UINT32( sal_uInt16 nProp )
+{
+ sal_uInt32 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
+{
+ double n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+::rtl::OUString UnoControlBase::ImplGetPropertyValue_UString( sal_uInt16 nProp )
+{
+ ::rtl::OUString aStr;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= aStr;
+ }
+ return aStr;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize()
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->getMinimumSize();
+
+ if ( !mxPeer.is() || ( mxPeer != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_getPreferredSize()
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->getPreferredSize();
+
+ if ( !mxPeer.is() || ( mxPeer != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize )
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->calcAdjustedSize( rNewSize );
+
+ if ( !mxPeer.is() || ( mxPeer != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines )
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->getMinimumSize( nCols, nLines );
+
+ if ( !mxPeer.is() || ( mxPeer != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+void UnoControlBase::Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ xL->getColumnsAndLines( nCols, nLines );
+
+ if ( !mxPeer.is() || ( mxPeer != xP ) )
+ xP->dispose();
+ }
+}
+
+
+
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
new file mode 100644
index 000000000000..86041d144d19
--- /dev/null
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolcontainer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+#include <unotools/sequence.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/list.hxx>
+
+// ----------------------------------------------------
+// class UnoControlHolder
+// ----------------------------------------------------
+struct UnoControlHolder
+{
+public:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl;
+ ::rtl::OUString aName;
+
+ UnoControlHolder( const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > & rControl )
+ : aName( rName )
+ {
+ xCtrl = rControl;
+
+ }
+};
+
+DECLARE_LIST( UnoControlHolderList, UnoControlHolder* );
+
+
+// ----------------------------------------------------
+// class UnoControlContainer
+// ----------------------------------------------------
+UnoControlContainer::UnoControlContainer(): maCListeners( *this )
+{
+ mpControls = new UnoControlHolderList;
+}
+
+UnoControlContainer::UnoControlContainer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP )
+ : maCListeners( *this )
+{
+ mxPeer = xP;
+ mbDisposePeer = sal_False;
+ mpControls = new UnoControlHolderList;
+}
+
+UnoControlContainer::~UnoControlContainer()
+{
+ for ( sal_uInt32 n = mpControls->Count(); n; )
+ {
+ UnoControlHolder* pHolder = mpControls->GetObject( --n );
+ delete pHolder;
+ }
+ mpControls->Clear();
+ delete mpControls;
+}
+
+void UnoControlContainer::ImplActivateTabControllers()
+{
+ sal_uInt32 nCount = maTabControllers.getLength();
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
+ {
+ maTabControllers.getArray()[n]->setContainer( this );
+ maTabControllers.getArray()[n]->activateTabOrder();
+ }
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoControlContainer::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XUnoControlContainer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XControlContainer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::container::XContainer*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControl::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoControlContainer )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ),
+ UnoControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::lang::XComponent
+void UnoControlContainer::dispose( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // DG: zuerst der Welt mitteilen, daß der Container wegfliegt. Dieses ist um einiges
+ // schneller wenn die Welt sowohl an den Controls als auch am Container horcht
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
+ maDisposeListeners.disposeAndClear(aEvt);
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = getControls();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pCtrls = aCtrls.getArray();
+ sal_uInt32 nCtrls = aCtrls.getLength();
+
+ // alle Strukturen entfernen
+ sal_uInt32 n;
+ for ( n = mpControls->Count(); n; )
+ delete mpControls->GetObject( --n );
+ mpControls->Clear();
+
+ for( n = 0; n < nCtrls; n++ )
+ {
+ pCtrls[n]->removeEventListener(this);
+
+ // Control wegwerfen
+ pCtrls[n]->dispose();
+ }
+
+ UnoControl::dispose();
+}
+
+void UnoControlContainer::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+}
+
+void UnoControlContainer::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+}
+
+
+// ::com::sun::star::lang::XEventListener
+void UnoControlContainer::disposing( const ::com::sun::star::lang::EventObject& rEvt ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl(rEvt.Source, ::com::sun::star::uno::UNO_QUERY );
+ if (xControl.is())
+ removeControl(xControl);
+}
+
+// ::com::sun::star::container::XContainer
+void UnoControlContainer::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maCListeners.addInterface( rxListener );
+}
+
+void UnoControlContainer::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maCListeners.removeInterface( rxListener );
+}
+
+
+// ::com::sun::star::awt::XControlContainer
+void UnoControlContainer::setStatusText( const ::rtl::OUString& rStatusText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // In der Parenthierarchie nach unten gehen
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xContainer( mxContext, ::com::sun::star::uno::UNO_QUERY );
+ if( xContainer.is() )
+ xContainer->setStatusText( rStatusText );
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > UnoControlContainer::getControls( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nCtrls = mpControls->Count();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aD( nCtrls );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > * pDest = aD.getArray();
+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ UnoControlHolder* pHolder= mpControls->GetObject( n );
+ pDest[n] = pHolder->xCtrl;
+ }
+
+ return aD;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > UnoControlContainer::getControl( const ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xCtrl;
+
+ sal_uInt32 nCtrls = mpControls->Count();
+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ UnoControlHolder* pHolder = mpControls->GetObject( n );
+ if ( pHolder->aName == rName )
+ {
+ xCtrl = pHolder->xCtrl;
+ break;
+ }
+ }
+ return xCtrl;
+}
+
+void UnoControlContainer::addControl( const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rControl ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ UnoControlHolder* pHolder = new UnoControlHolder( rName, rControl );
+ mpControls->Insert( pHolder, LIST_APPEND );
+
+ ::com::sun::star::uno::Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>*)0) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis;
+ aAny >>= xThis;
+ rControl->setContext( xThis );
+ rControl->addEventListener(this);
+
+ if( mxPeer.is() )
+ {
+ // Hat der Container ein Peer, dann auch gleich im Child erzeugen
+ rControl->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), mxPeer );
+ ImplActivateTabControllers();
+ }
+
+ if ( maCListeners.getLength() )
+ {
+ ::com::sun::star::container::ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= rControl;
+ maCListeners.elementInserted( aEvent );
+ }
+}
+
+void UnoControlContainer::removeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rControl ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rControl.is() )
+ {
+ sal_uInt32 nCtrls = mpControls->Count();
+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ UnoControlHolder* pHolder = mpControls->GetObject( n );
+ if ( (::com::sun::star::awt::XControl*)rControl.get() == (::com::sun::star::awt::XControl*)pHolder->xCtrl.get() )
+ {
+ rControl->removeEventListener(this);
+ rControl->setContext( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > () );
+
+ delete pHolder;
+ mpControls->Remove( n );
+ if ( maCListeners.getLength() )
+ {
+ ::com::sun::star::container::ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= rControl;
+ maCListeners.elementRemoved( aEvent );
+ }
+ break;
+ }
+ }
+ }
+}
+
+
+
+// ::com::sun::star::awt::XUnoControlContainer
+void UnoControlContainer::setTabControllers( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > >& TabControllers ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maTabControllers = TabControllers;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > UnoControlContainer::getTabControllers( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return maTabControllers;
+}
+
+void UnoControlContainer::addTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nOldCount = maTabControllers.getLength();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > aNewSeq( nOldCount + 1 );
+ for ( sal_uInt32 n = 0; n < nOldCount; n++ )
+ aNewSeq.getArray()[n] = maTabControllers.getConstArray()[n];
+ aNewSeq.getArray()[nOldCount] = TabController;
+ maTabControllers = aNewSeq;
+}
+
+void UnoControlContainer::removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nCount = maTabControllers.getLength();
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
+ {
+ if( maTabControllers.getConstArray()[n] == TabController )
+ {
+ ::utl::removeElementAt( maTabControllers, n );
+ break;
+ }
+ }
+}
+
+// ::com::sun::star::awt::XControl
+void UnoControlContainer::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( !mxPeer.is() )
+ {
+ sal_Bool bVis = maComponentInfos.bVisible;
+ if( bVis )
+ UnoControl::setVisible( sal_False );
+ // eigenes Peer erzeugen
+ UnoControl::createPeer( rxToolkit, rParent );
+
+ // alle Peers der Childs erzeugen
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > aCtrls = getControls();
+ sal_uInt32 nCtrls = aCtrls.getLength();
+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ aCtrls.getArray()[n]->createPeer( rxToolkit, mxPeer );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer > xC( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+
+ xC->enableDialogControl( sal_True );
+ ImplActivateTabControllers();
+
+ if( bVis )
+ UnoControl::setVisible( sal_True );
+ }
+}
+
+
+// ::com::sun::star::awt::XWindow
+void UnoControlContainer::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ UnoControl::setVisible( bVisible );
+ if( !mxContext.is() && bVisible )
+ // Es ist ein TopWindow, also automatisch anzeigen
+ createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () );
+}
+
+
+
diff --git a/toolkit/source/controls/unocontrolcontainermodel.cxx b/toolkit/source/controls/unocontrolcontainermodel.cxx
new file mode 100644
index 000000000000..3d37e5939c74
--- /dev/null
+++ b/toolkit/source/controls/unocontrolcontainermodel.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolcontainermodel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+
+// ----------------------------------------------------
+// class UnoControlContainerModel
+// ----------------------------------------------------
+UnoControlContainerModel::UnoControlContainerModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+}
+
+::rtl::OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel );
+}
+
+::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ ::com::sun::star::uno::Any aDefault;
+ if ( nPropId == BASEPROPERTY_BORDER )
+ aDefault <<= (sal_Int16) 0;
+ else
+ aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId );
+ return aDefault;
+}
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlContainerModel*)this)->GetMutex() );
+
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+
+
+
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
new file mode 100644
index 000000000000..4c26018cc10c
--- /dev/null
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -0,0 +1,1110 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrolmodel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_
+#include <com/sun/star/awt/FontWidth.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_
+#include <com/sun/star/awt/FontWeight.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_
+#include <com/sun/star/awt/FontSlant.hpp>
+#endif
+
+
+#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
+#include <com/sun/star/io/XMarkableStream.hpp>
+#endif
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <tools/string.hxx>
+#include <tools/table.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/emptyfontdescriptor.hxx>
+
+#include <unotools/sequence.hxx>
+
+#include <vcl/svapp.hxx>
+#include <tools/intn.hxx>
+
+struct ImplPropertyInfo
+{
+private:
+ sal_uInt16 nId;
+ ::com::sun::star::uno::Any aValue;
+
+public:
+ ImplPropertyInfo( sal_uInt16 nT )
+ {
+ nId = nT;
+ }
+
+ ImplPropertyInfo( sal_uInt16 nT, const ::com::sun::star::uno::Any& rValue ) : aValue( rValue )
+ {
+ nId = nT;
+ }
+
+ sal_uInt16 GetId() const { return nId; }
+ const ::com::sun::star::uno::Any& GetValue() const { return aValue; }
+ void SetValue( const ::com::sun::star::uno::Any& rValue ) { aValue = rValue; }
+};
+
+DECLARE_TABLE( ImplPropertyTable, ImplPropertyInfo* );
+
+#define UNOCONTROL_STREAMVERSION (short)2
+
+static void lcl_ImplMergeFontProperty( ::com::sun::star::awt::FontDescriptor& rFD, sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rValue )
+{
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue >>= rFD.Name;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue >>= rFD.StyleName;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue >>= rFD.Family;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue >>= rFD.CharSet;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue >>= rFD.Height;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue >>= rFD.Weight;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue >>= rFD.Slant;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue >>= rFD.Underline;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue >>= rFD.Strikeout;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue >>= rFD.Width;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue >>= rFD.Pitch;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue >>= rFD.CharacterWidth;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue >>= rFD.Orientation;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue >>= rFD.Kerning;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue >>= rFD.WordLineMode;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue >>= rFD.Type;
+ break;
+ default: DBG_ERROR( "FontProperty?!" );
+ }
+}
+
+// ----------------------------------------------------
+// class UnoControlModel
+// ----------------------------------------------------
+UnoControlModel::UnoControlModel()
+ : OPropertySetHelper( BrdcstHelper ), maDisposeListeners( *this )
+{
+ // Die Properties muessen vom Model in die Tabelle gestopft werden,
+ // nur vorhandene Properties sind gueltige Properties, auch wenn VOID.
+ mpData = new ImplPropertyTable;
+}
+
+UnoControlModel::~UnoControlModel()
+{
+ for ( sal_uInt32 n = mpData->Count(); n--; )
+ delete mpData->GetObject( n );
+ delete mpData;
+}
+
+::com::sun::star::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const
+{
+ sal_uInt32 nIDs = mpData->Count();
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs( nIDs );
+ sal_Int32* pIDs = aIDs.getArray();
+ for ( sal_uInt32 n = 0; n < nIDs; n++ )
+ pIDs[n] = mpData->GetObjectKey( n );
+ return aIDs;
+}
+
+sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
+{
+ if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ nPropId = BASEPROPERTY_FONTDESCRIPTOR;
+
+ return mpData->Get( nPropId ) ? sal_True : sal_False;
+}
+
+void UnoControlModel::ImplPropertyChanged( sal_uInt16 nPropId )
+{
+}
+
+::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ ::com::sun::star::uno::Any aDefault;
+
+ if ( ( nPropId == BASEPROPERTY_FONTDESCRIPTOR ) ||
+ ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ {
+ EmptyFontDescriptor aFD;
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_FONTDESCRIPTOR: aDefault <<= aFD; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_NAME: aDefault <<= aFD.Name; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: aDefault <<= aFD.StyleName; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: aDefault <<= aFD.Family; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: aDefault <<= aFD.CharSet; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: aDefault <<= (float)aFD.Height; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: aDefault <<= aFD.Weight; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: aDefault <<= (sal_Int16)aFD.Slant; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: aDefault <<= aFD.Underline; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: aDefault <<= aFD.Strikeout; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: aDefault <<= aFD.Width; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: aDefault <<= aFD.Pitch; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: aDefault <<= aFD.CharacterWidth; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: aDefault <<= aFD.Orientation; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: aDefault <<= aFD.Kerning; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: aDefault <<= aFD.WordLineMode; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: aDefault <<= aFD.Type; break;
+ default: DBG_ERROR( "FontProperty?!" );
+ }
+ }
+ else
+ {
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_TABSTOP:
+ case BASEPROPERTY_TEXTCOLOR:
+ case BASEPROPERTY_DATE:
+ case BASEPROPERTY_DATESHOWCENTURY:
+ case BASEPROPERTY_TIME:
+ case BASEPROPERTY_VALUE_DOUBLE:
+ case BASEPROPERTY_BACKGROUNDCOLOR: break;
+
+ case BASEPROPERTY_MAXTEXTLEN:
+ case BASEPROPERTY_STATE:
+ case BASEPROPERTY_EXTDATEFORMAT:
+ case BASEPROPERTY_EXTTIMEFORMAT:
+ case BASEPROPERTY_ECHOCHAR: aDefault <<= (sal_Int16) 0; break;
+ case BASEPROPERTY_BORDER: aDefault <<= (sal_Int16) 1; break;
+ case BASEPROPERTY_DECIMALACCURACY: aDefault <<= (sal_Int16) 2; break;
+ case BASEPROPERTY_LINECOUNT: aDefault <<= (sal_Int16) 5; break;
+ case BASEPROPERTY_ALIGN: aDefault <<= (sal_Int16) PROPERTY_ALIGN_LEFT; break;
+
+ case BASEPROPERTY_DATEMAX: aDefault <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate(); break;
+ case BASEPROPERTY_DATEMIN: aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate(); break;
+ case BASEPROPERTY_TIMEMAX: aDefault <<= (sal_Int32) Time( 23, 59 ).GetTime(); break;
+ case BASEPROPERTY_TIMEMIN: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE: aDefault <<= (double) 1000000; break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE: aDefault <<= (double) -1000000; break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE: aDefault <<= (double ) 1; break;
+ case BASEPROPERTY_DEFAULTCONTROL: aDefault <<= ((UnoControlModel*)this)->getServiceName(); break;
+
+ case BASEPROPERTY_HSCROLL:
+ case BASEPROPERTY_DEFAULTBUTTON:
+ case BASEPROPERTY_MULTILINE:
+ case BASEPROPERTY_MULTISELECTION:
+ case BASEPROPERTY_TRISTATE:
+ case BASEPROPERTY_DROPDOWN:
+ case BASEPROPERTY_SPIN:
+ case BASEPROPERTY_READONLY:
+ case BASEPROPERTY_VSCROLL:
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ case BASEPROPERTY_STRICTFORMAT:
+ case BASEPROPERTY_HARDLINEBREAKS: aDefault <<= (sal_Bool) sal_False; break;
+
+ case BASEPROPERTY_AUTOCOMPLETE:
+ case BASEPROPERTY_ENABLED:
+ case BASEPROPERTY_PRINTABLE: aDefault <<= (sal_Bool) sal_True; break;
+
+ case BASEPROPERTY_HELPURL:
+ case BASEPROPERTY_IMAGEURL:
+ case BASEPROPERTY_EDITMASK:
+ case BASEPROPERTY_LITERALMASK:
+ case BASEPROPERTY_LABEL:
+ case BASEPROPERTY_TEXT: aDefault <<= ::rtl::OUString(); break;
+
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq;
+ aDefault <<= aStringSeq;
+
+ }
+ break;
+ case BASEPROPERTY_SELECTEDITEMS:
+ {
+ ::com::sun::star::uno::Sequence<sal_Int16> aINT16Seq;
+ aDefault <<= aINT16Seq;
+ }
+ break;
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ XubString aSymbol = Application::GetAppInternational().GetCurrSymbol();
+ aDefault <<= ::rtl::OUString( aSymbol );
+ }
+ break;
+ default: DBG_ERROR( "ImplGetDefaultValue - unknown Property" );
+ }
+ }
+
+ return aDefault;
+}
+
+void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault )
+{
+ ImplPropertyInfo* pProp = new ImplPropertyInfo( nPropId, rDefault );
+ mpData->Insert( nPropId, pProp );
+}
+
+void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
+{
+ ImplRegisterProperty( nPropId, ImplGetDefaultValue( nPropId ) );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoControlModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XControlModel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XPropertyState*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XMultiPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XFastPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( UnoControlModel )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoControlModel )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::lang::XComponent
+void UnoControlModel::dispose( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
+ maDisposeListeners.disposeAndClear( aEvt );
+}
+
+void UnoControlModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maDisposeListeners.addInterface( rxListener );
+}
+
+void UnoControlModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maDisposeListeners.removeInterface( rxListener );
+}
+
+
+// ::com::sun::star::beans::XPropertyState
+::com::sun::star::beans::PropertyState UnoControlModel::getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt16 nPropId = GetPropertyId( PropertyName );
+
+ ::com::sun::star::uno::Any aValue = getPropertyValue( PropertyName );
+ ::com::sun::star::uno::Any aDefault = ImplGetDefaultValue( nPropId );
+
+ return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > UnoControlModel::getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nNames = PropertyNames.getLength();
+ const ::rtl::OUString* pNames = PropertyNames.getConstArray();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > aStates( nNames );
+ ::com::sun::star::beans::PropertyState* pStates = aStates.getArray();
+
+ for ( sal_uInt32 n = 0; n < nNames; n++ )
+ pStates[n] = getPropertyState( pNames[n] );
+
+ return aStates;
+}
+
+void UnoControlModel::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ setPropertyValue( PropertyName, ImplGetDefaultValue( GetPropertyId( PropertyName ) ) );
+}
+
+::com::sun::star::uno::Any UnoControlModel::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return ImplGetDefaultValue( GetPropertyId( rPropertyName ) );
+}
+
+
+// ::com::sun::star::io::XPersistObjec
+::rtl::OUString UnoControlModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ DBG_ERROR( "ServiceName von UnoControlModel ?!" );
+ return ::rtl::OUString();
+}
+
+void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no ::com::sun::star::io::XMarkableStream!" );
+
+ OutStream->writeShort( UNOCONTROL_STREAMVERSION );
+
+ ImplPropertyTable aProps;
+ sal_uInt32 n;
+ for ( n = mpData->Count(); n; )
+ {
+ ImplPropertyInfo* pProp = mpData->GetObject( --n );
+ if ( ( ( GetPropertyAttribs( pProp->GetId() ) & ::com::sun::star::beans::PropertyAttribute::TRANSIENT ) == 0 )
+ && ( getPropertyState( GetPropertyName( pProp->GetId() ) ) != ::com::sun::star::beans::PropertyState_DEFAULT_VALUE ) )
+ {
+ aProps.Insert( pProp->GetId(), pProp );
+ }
+ }
+
+ sal_uInt32 nProps = aProps.Count();
+
+ // FontProperty wegen fehlender Unterscheidung zwischen 5.0 / 5.1
+ // immer im alten Format mitspeichern.
+ OutStream->writeLong( (long) aProps.IsKeyValid( BASEPROPERTY_FONTDESCRIPTOR ) ? ( nProps + 3 ) : nProps );
+ for ( n = 0; n < nProps; n++ )
+ {
+ sal_Int32 nPropDataBeginMark = xMark->createMark();
+ OutStream->writeLong( 0L ); // DataLen
+
+ ImplPropertyInfo* pProp = aProps.GetObject( n );
+ OutStream->writeShort( pProp->GetId() );
+
+ sal_Bool bVoid = pProp->GetValue().getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ OutStream->writeBoolean( bVoid );
+
+ if ( !bVoid )
+ {
+ const ::com::sun::star::uno::Any& rValue = pProp->GetValue();
+ const ::com::sun::star::uno::Type& rType = rValue.getValueType();
+
+ if ( rType == ::getBooleanCppuType() )
+ {
+ sal_Bool b;
+ rValue >>= b;
+ OutStream->writeBoolean( b );
+ }
+ else if ( rType == ::getCppuType((const ::rtl::OUString*)0) )
+ {
+ // #HACK 52041# Pfade relativ speichern
+ ::rtl::OUString aUString;
+ rValue >>= aUString;
+ if ( pProp->GetId() == BASEPROPERTY_IMAGEURL )
+ aUString= INetURLObject::AbsToRel( aUString );
+ OutStream->writeUTF( aUString );
+ }
+ else if ( rType == ::getCppuType((const sal_uInt16*)0) )
+ {
+ sal_uInt16 n;
+ rValue >>= n;
+ OutStream->writeShort( n );
+ }
+ else if ( rType == ::getCppuType((const sal_Int16*)0) )
+ {
+ sal_Int16 n;
+ rValue >>= n;
+ OutStream->writeShort( n );
+ }
+ else if ( rType == ::getCppuType((const sal_uInt32*)0) )
+ {
+ sal_uInt32 n;
+ rValue >>= n;
+ OutStream->writeLong( n );
+ }
+ else if ( rType == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 n;
+ rValue >>= n;
+ OutStream->writeLong( n );
+ }
+ else if ( rType == ::getCppuType((const double*)0) )
+ {
+ double n;
+ rValue >>= n;
+ OutStream->writeDouble( n );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
+ {
+ ::com::sun::star::awt::FontDescriptor aFD;
+ rValue >>= aFD;
+ OutStream->writeUTF( aFD.Name );
+ OutStream->writeShort( aFD.Height );
+ OutStream->writeShort( aFD.Width );
+ OutStream->writeUTF( aFD.StyleName );
+ OutStream->writeShort( aFD.Family );
+ OutStream->writeShort( aFD.CharSet );
+ OutStream->writeShort( aFD.Pitch );
+ OutStream->writeDouble( aFD.CharacterWidth );
+ OutStream->writeDouble( aFD.Weight );
+ OutStream->writeShort( aFD.Slant );
+ OutStream->writeShort( aFD.Underline );
+ OutStream->writeShort( aFD.Strikeout );
+ OutStream->writeDouble( aFD.Orientation );
+ OutStream->writeBoolean( aFD.Kerning );
+ OutStream->writeBoolean( aFD.WordLineMode );
+ OutStream->writeShort( aFD.Type );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ rValue >>= aSeq;
+ long nEntries = aSeq.getLength();
+ OutStream->writeLong( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ OutStream->writeUTF( aSeq.getConstArray()[n] );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
+ {
+ ::com::sun::star::uno::Sequence<sal_uInt16> aSeq;
+ rValue >>= aSeq;
+ long nEntries = aSeq.getLength();
+ OutStream->writeLong( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ OutStream->writeShort( aSeq.getConstArray()[n] );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ rValue >>= aSeq;
+ long nEntries = aSeq.getLength();
+ OutStream->writeLong( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ OutStream->writeShort( aSeq.getConstArray()[n] );
+ }
+ else
+ {
+ DBG_ERROR( "write: unknown Property!" );
+ }
+ }
+
+ sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
+ xMark->jumpToMark( nPropDataBeginMark );
+ OutStream->writeLong( nPropDataLen );
+ xMark->jumpToFurthest();
+ xMark->deleteMark(nPropDataBeginMark);
+ }
+
+ ImplPropertyInfo* pProp = aProps.Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp )
+ {
+ // Solange wir keinen 5.0-Export haben, muss das alte
+ // Format mit rausgeschrieben werden...
+ ::com::sun::star::awt::FontDescriptor aFD;
+ pProp->GetValue() >>= aFD;
+
+ for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ )
+ {
+ sal_Int32 nPropDataBeginMark = xMark->createMark();
+ OutStream->writeLong( 0L ); // DataLen
+ OutStream->writeShort( n ); // PropId
+ OutStream->writeBoolean( sal_False ); // Void
+
+ if ( n == BASEPROPERTY_FONT_TYPE )
+ {
+ OutStream->writeUTF( aFD.Name );
+ OutStream->writeUTF( aFD.StyleName );
+ OutStream->writeShort( aFD.Family );
+ OutStream->writeShort( aFD.CharSet );
+ OutStream->writeShort( aFD.Pitch );
+ }
+ else if ( n == BASEPROPERTY_FONT_SIZE )
+ {
+ OutStream->writeLong( aFD.Width );
+ OutStream->writeLong( aFD.Height );
+ OutStream->writeShort( VCLUnoHelper::ConvertFontWidth( aFD.CharacterWidth ) );
+ }
+ else if ( n == BASEPROPERTY_FONT_ATTRIBS )
+ {
+ OutStream->writeShort( VCLUnoHelper::ConvertFontWeight( aFD.Weight ) );
+ OutStream->writeShort( aFD.Slant );
+ OutStream->writeShort( aFD.Underline );
+ OutStream->writeShort( aFD.Strikeout );
+ OutStream->writeShort( aFD.Orientation * 10 );
+ OutStream->writeBoolean( aFD.Kerning );
+ OutStream->writeBoolean( aFD.WordLineMode );
+ }
+ else
+ {
+ DBG_ERROR( "Property?!" );
+ }
+
+ sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
+ xMark->jumpToMark( nPropDataBeginMark );
+ OutStream->writeLong( nPropDataLen );
+ xMark->jumpToFurthest();
+ xMark->deleteMark(nPropDataBeginMark);
+ }
+ }
+}
+
+void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "read: no ::com::sun::star::io::XMarkableStream!" );
+
+ short nVersion = InStream->readShort();
+ sal_uInt32 nProps = (sal_uInt32)InStream->readLong();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aProps( nProps );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aValues( nProps );
+ sal_Bool bInvalidEntries = sal_False;
+
+ // Dummerweise kein Mark fuer den gesamten Block, es koennen also
+ // nur Properties geaendert werden, es koennen aber nicht spaeter mal Daten
+ // fuer das Model hinter den Properties geschrieben werden.
+
+ // Fuer den Import der alten ::com::sun::star::awt::FontDescriptor-Teile
+ ::com::sun::star::awt::FontDescriptor* pFD = NULL;
+
+ sal_uInt32 n;
+ for ( n = 0; n < nProps; n++ )
+ {
+ sal_Int32 nPropDataBeginMark = xMark->createMark();
+ sal_Int32 nPropDataLen = InStream->readLong();
+
+ sal_uInt16 nPropId = (sal_uInt16)InStream->readShort();
+
+ ::com::sun::star::uno::Any aValue;
+ sal_Bool bIsVoid = InStream->readBoolean();
+ if ( !bIsVoid )
+ {
+ const ::com::sun::star::uno::Type* pType = mpData->Get( nPropId ) ? GetPropertyType( nPropId ) : NULL;
+ if ( pType )
+ {
+ if ( *pType == ::getBooleanCppuType() )
+ {
+ sal_Bool b = InStream->readBoolean();
+ aValue <<= b;
+ }
+ else if ( *pType == ::getCppuType((const ::rtl::OUString*)0) )
+ {
+ ::rtl::OUString aUTF = InStream->readUTF();
+ // #HACK 52041# Pfade relativ speichern
+ if ( nPropId == BASEPROPERTY_IMAGEURL )
+ aUTF = INetURLObject::RelToAbs( aUTF );
+ aValue <<= aUTF;
+ }
+ else if ( *pType == ::getCppuType((const sal_uInt16*)0) )
+ {
+ sal_uInt16 n = InStream->readShort();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const sal_Int16*)0) )
+ {
+ sal_Int16 n = InStream->readShort();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const sal_uInt32*)0) )
+ {
+ sal_uInt32 n = InStream->readLong();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 n = InStream->readLong();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const Double*)0) )
+ {
+ double n = InStream->readDouble();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
+ {
+ ::com::sun::star::awt::FontDescriptor aFD;
+ aFD.Name = InStream->readUTF();
+ aFD.Height = InStream->readShort();
+ aFD.Width = InStream->readShort();
+ aFD.StyleName = InStream->readUTF();
+ aFD.Family = InStream->readShort();
+ aFD.CharSet = InStream->readShort();
+ aFD.Pitch = InStream->readShort();
+ aFD.CharacterWidth = InStream->readDouble();
+ aFD.Weight = InStream->readDouble();
+ aFD.Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
+ aFD.Underline = InStream->readShort();
+ aFD.Strikeout = InStream->readShort();
+ aFD.Orientation = InStream->readDouble();
+ aFD.Kerning = InStream->readBoolean();
+ aFD.WordLineMode = InStream->readBoolean();
+ aFD.Type = InStream->readShort();
+ aValue <<= aFD;
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
+ {
+ long nEntries = InStream->readLong();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ aSeq.getArray()[n] = InStream->readUTF();
+ aValue <<= aSeq;
+
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
+
+ {
+ long nEntries = InStream->readLong();
+ ::com::sun::star::uno::Sequence<sal_uInt16> aSeq( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ aSeq.getArray()[n] = (sal_uInt16)InStream->readShort();
+ aValue <<= aSeq;
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
+ {
+ long nEntries = InStream->readLong();
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ aSeq.getArray()[n] = (sal_Int16)InStream->readShort();
+ aValue <<= aSeq;
+ }
+ }
+ else
+ {
+ // Altes Geraffel aus 5.0
+ if ( nPropId == BASEPROPERTY_FONT_TYPE )
+ {
+ // Sonst ist es nur die redundante Info fuer alte Versionen
+ // Daten werden durch MarkableStream geskippt.
+ if ( nVersion < 2 )
+ {
+ if ( !pFD )
+ {
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp ) // wegen den Defaults...
+ {
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ pProp->GetValue() >>= *pFD;
+ }
+ }
+ pFD->Name = InStream->readUTF();
+ pFD->StyleName = InStream->readUTF();
+ pFD->Family = InStream->readShort();
+ pFD->CharSet = InStream->readShort();
+ pFD->Pitch = InStream->readShort();
+ }
+ }
+ else if ( nPropId == BASEPROPERTY_FONT_SIZE )
+ {
+ if ( nVersion < 2 )
+ {
+ if ( !pFD )
+ {
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp ) // wegen den Defaults...
+ pProp->GetValue() >>= *pFD;
+ }
+ pFD->Width = InStream->readLong();
+ pFD->Height = InStream->readLong();
+ InStream->readShort(); // ::com::sun::star::awt::FontWidth ignorieren - wurde mal falsch geschrieben und wird nicht gebraucht.
+ pFD->CharacterWidth = ::com::sun::star::awt::FontWidth::DONTKNOW;
+ }
+ }
+ else if ( nPropId == BASEPROPERTY_FONT_ATTRIBS )
+ {
+ if ( nVersion < 2 )
+ {
+ if ( !pFD )
+ {
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp ) // wegen den Defaults...
+ pProp->GetValue() >>= *pFD;
+ }
+ pFD->Weight = VCLUnoHelper::ConvertFontWeight( (FontWeight) InStream->readShort() );
+ pFD->Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
+ pFD->Underline = InStream->readShort();
+ pFD->Strikeout = InStream->readShort();
+ pFD->Orientation = ( (double)InStream->readShort() ) / 10;
+ pFD->Kerning = InStream->readBoolean();
+ pFD->WordLineMode = InStream->readBoolean();
+ }
+ }
+ else
+ {
+ DBG_ERROR( "read: unknown Property!" );
+ }
+ }
+ }
+ else // bVoid
+ {
+ if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
+ {
+ EmptyFontDescriptor aFD;
+ aValue <<= aFD;
+ }
+ }
+
+ if ( mpData->Get( nPropId ) )
+ {
+ aProps.getArray()[n] = GetPropertyName( nPropId );
+ aValues.getArray()[n] = aValue;
+ }
+ else
+ {
+ bInvalidEntries = sal_True;
+ }
+
+ // Falls bereits mehr drinsteht als diese Version kennt:
+ xMark->jumpToMark( nPropDataBeginMark );
+ InStream->skipBytes( nPropDataLen );
+ xMark->deleteMark(nPropDataBeginMark);
+ }
+ if ( bInvalidEntries )
+ {
+ for ( n = 0; n < aProps.getLength(); n++ )
+ {
+ if ( !aProps.getConstArray()[n].len() )
+ {
+ ::utl::removeElementAt( aProps, n );
+ ::utl::removeElementAt( aValues, n );
+ n--;
+ }
+ }
+ }
+
+ setPropertyValues( aProps, aValues );
+
+ if ( pFD )
+ {
+ ::com::sun::star::uno::Any aValue;
+ aValue <<= *pFD;
+ setPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ), aValue );
+ delete pFD;
+ }
+}
+
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString UnoControlModel::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_ERROR( "This method should be overloaded!" );
+ return ::rtl::OUString();
+
+}
+
+sal_Bool UnoControlModel::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == rServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControlModel::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ DBG_ERROR( "This method should be overloaded!" );
+ return ::com::sun::star::uno::Sequence< ::rtl::OUString >();
+}
+
+// ::cppu::OPropertySetHelper
+::cppu::IPropertyArrayHelper& UnoControlModel::getInfoHelper()
+{
+ DBG_ERROR( "UnoControlModel::getInfoHelper() not possible!" );
+ return *(::cppu::IPropertyArrayHelper*) NULL;
+}
+
+sal_Bool UnoControlModel::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+ if ( bVoid )
+ {
+ rConvertedValue.clear();
+ }
+ else
+ {
+ const ::com::sun::star::uno::Type* pDestType = GetPropertyType( nPropId );
+ if ( pDestType->getTypeClass() == ::com::sun::star::uno::TypeClass_ANY )
+ {
+ rConvertedValue = rValue;
+ }
+ else
+ {
+ rConvertedValue.setValue( rValue.getValue(), *pDestType );
+ }
+ }
+ getFastPropertyValue( rOldValue, nPropId );
+ return !CompareProperties( rConvertedValue, rOldValue );
+}
+
+void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Fehlt: Die gefakten Einzelproperties des FontDescriptors...
+
+ ImplPropertyInfo* pProp = mpData->Get( nPropId );
+ if ( pProp )
+ {
+ sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ DBG_ASSERT( !bVoid || ( GetPropertyAttribs( nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
+ ImplPropertyChanged( nPropId );
+ pProp->SetValue( rValue );
+ }
+ else
+ {
+ // exception...
+ DBG_ERROR( "SetPropertyValues: Invalid Property!" );
+ }
+}
+
+void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlModel*)this)->GetMutex() );
+
+ ImplPropertyInfo* pProp = mpData->Get( nPropId );
+
+ if ( pProp )
+ rValue = pProp->GetValue();
+ else if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ {
+ pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ ::com::sun::star::awt::FontDescriptor aFD;
+ pProp->GetValue() >>= aFD;
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue <<= aFD.Name;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue <<= aFD.StyleName;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue <<= aFD.Family;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue <<= aFD.CharSet;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue <<= (float)aFD.Height;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue <<= aFD.Weight;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue <<= (sal_Int16)aFD.Slant;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue <<= aFD.Underline;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue <<= aFD.Strikeout;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue <<= aFD.Width;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue <<= aFD.Pitch;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue <<= aFD.CharacterWidth;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue <<= aFD.Orientation;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue <<= aFD.Kerning;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue <<= aFD.WordLineMode;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue <<= aFD.Type;
+ break;
+ default: DBG_ERROR( "FontProperty?!" );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "getFastPropertyValue - invalid Property!" );
+ }
+}
+
+// ::com::sun::star::beans::XPropertySet
+void UnoControlModel::setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nPropId = (sal_Int32) GetPropertyId( rPropertyName );
+ DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" );
+ setFastPropertyValue( nPropId, rValue );
+}
+
+// ::com::sun::star::beans::XFastPropertySet
+void UnoControlModel::setFastPropertyValue( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ {
+ ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ ::com::sun::star::awt::FontDescriptor aFD;
+ pProp->GetValue() >>= aFD;
+ lcl_ImplMergeFontProperty( aFD, nPropId, rValue );
+
+ ::com::sun::star::uno::Any aFDValue;
+ aFDValue <<= aFD;
+ nPropId = BASEPROPERTY_FONTDESCRIPTOR;
+ setFastPropertyValues( 1, &nPropId, &aFDValue, 1 );
+ }
+ else
+ setFastPropertyValues( 1, &nPropId, &rValue, 1 );
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_ERROR( "UnoControlModel::getPropertySetInfo() not possible!" );
+ return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >();
+}
+
+void UnoControlModel::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt16 nProps = rPropertyNames.getLength();
+ sal_Int32* pHandles = new sal_Int32[nProps];
+ const ::com::sun::star::uno::Any* pValues = Values.getConstArray();
+ sal_uInt16 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames );
+
+ if ( nValidHandles )
+ {
+ // Einzelproperties vom ::com::sun::star::awt::FontDescriptor rausfischen...
+ ::com::sun::star::awt::FontDescriptor* pFD = NULL;
+ for ( sal_uInt16 n = 0; n < nProps; n++ )
+ {
+ if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ {
+ if ( !pFD )
+ {
+ ImplPropertyInfo* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ pProp->GetValue() >>= *pFD;
+ }
+ lcl_ImplMergeFontProperty( *pFD, pHandles[n], pValues[n] );
+ pHandles[n] = -1;
+ nValidHandles--;
+ }
+ }
+
+ if ( nValidHandles )
+ setFastPropertyValues( nProps, pHandles, pValues, nValidHandles );
+
+ // FD-Propertie nicht in das Array mergen, weil sortiert...
+ if ( pFD )
+ {
+ ::com::sun::star::uno::Any aValue;
+ aValue <<= *pFD;
+ sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR;
+ setFastPropertyValues( 1, &nHandle, &aValue, 1 );
+ delete pFD;
+ }
+ }
+
+ delete pHandles;
+}
+
+
+
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
new file mode 100644
index 000000000000..561b1b77a0f0
--- /dev/null
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -0,0 +1,3090 @@
+/*************************************************************************
+ *
+ * $RCSfile: unocontrols.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_AWT_XTEXTAREA_HPP_
+#include <com/sun/star/awt/XTextArea.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/unomemorystream.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/macros.hxx>
+
+#include <cppuhelper/typeprovider.hxx>
+
+#include <unotools/processfactory.hxx>
+
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+
+#include <vcl/edit.hxx>
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class UnoControlEditModel
+// ----------------------------------------------------
+UnoControlEditModel::UnoControlEditModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ECHOCHAR );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HARDLINEBREAKS );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_HSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN );
+ ImplRegisterProperty( BASEPROPERTY_MULTILINE );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+}
+
+::rtl::OUString UnoControlEditModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel );
+}
+
+::com::sun::star::uno::Any UnoControlEditModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit );
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlEditModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoEditControl
+// ----------------------------------------------------
+UnoEditControl::UnoEditControl()
+ : maTextListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoEditControl::GetComponentServiceName()
+{
+ ::rtl::OUString aName( ::rtl::OUString::createFromAscii( "Edit" ) );
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_MULTILINE ) );
+ sal_Bool b;
+ if ( ( aVal >>= b ) && b )
+ aName= ::rtl::OUString::createFromAscii( "MultiLineEdit" );
+ return aName;
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoEditControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XTextListener*, this ) ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoEditControl )
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+void UnoEditControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maTextListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoEditControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xText->addTextListener( this );
+}
+
+void UnoEditControl::textChanged(const ::com::sun::star::awt::TextEvent& e) throw(::com::sun::star::uno::RuntimeException)
+{
+ // Neuen Text als ::com::sun::star::beans::Property ins Model treten.
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xText.is(), "TextComponentInterface?" );
+
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= xText->getText();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_False );
+
+ if ( maTextListeners.getLength() )
+ maTextListeners.textChanged( e );
+}
+
+void UnoEditControl::addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maTextListeners.addInterface( l );
+}
+
+void UnoEditControl::removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maTextListeners.removeInterface( l );
+}
+
+void UnoEditControl::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aText;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_True );
+}
+
+void UnoEditControl::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aText;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_True );
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xText->insertText( rSel, aText );
+ }
+}
+
+::rtl::OUString UnoEditControl::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aText;
+ ::rtl::OUString aLineBreakProp( GetPropertyName( BASEPROPERTY_HARDLINEBREAKS ) );
+ if ( mxPeer.is() && ImplHasProperty( aLineBreakProp ) && ImplGetPropertyValue_BOOL( BASEPROPERTY_HARDLINEBREAKS ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextArea > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ aText = xText->getTextLines();
+ }
+ else if ( mxPeer.is() )
+ {
+ // Peer fragen, weil es die ::com::sun::star::beans::Property "Text" nicht geben muss...
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ aText = xText->getText();
+ }
+ else
+ {
+ aText = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
+ }
+
+ return aText;
+}
+
+::rtl::OUString UnoEditControl::getSelectedText( void ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aSelected;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ aSelected = xText->getSelectedText();
+ }
+ return aSelected;
+}
+
+void UnoEditControl::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xText->setSelection( aSelection );
+ }
+}
+
+::com::sun::star::awt::Selection UnoEditControl::getSelection( void ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::Selection aSel;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent > xText( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ aSel = xText->getSelection();
+ }
+ return aSel;
+}
+
+sal_Bool UnoEditControl::isEditable( void ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return !ImplGetPropertyValue_BOOL( BASEPROPERTY_READONLY );
+}
+
+void UnoEditControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Bool)!bEditable;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_READONLY ), aAny, sal_True );
+}
+
+sal_Int16 UnoEditControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
+{
+ return !ImplGetPropertyValue_INT16( BASEPROPERTY_MAXTEXTLEN );
+}
+
+void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Int16)nLen;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MAXTEXTLEN ), aAny, sal_True );
+}
+
+::com::sun::star::awt::Size UnoEditControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+::com::sun::star::awt::Size UnoEditControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+::com::sun::star::awt::Size UnoEditControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+::com::sun::star::awt::Size UnoEditControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize( nCols, nLines );
+}
+
+void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Impl_getColumnsAndLines( nCols, nLines );
+}
+
+// ----------------------------------------------------
+// class UnoControlFormattedFieldModel
+// ----------------------------------------------------
+UnoControlFormattedFieldModel::UnoControlFormattedFieldModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_DEFAULT );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_VALUE );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MAX );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MIN );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_FORMATKEY );
+ ImplRegisterProperty( BASEPROPERTY_FORMATSSUPPLIER );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_SPIN );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+
+ ::com::sun::star::uno::Any aTreatAsNumber;
+ aTreatAsNumber <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_TREATASNUMBER, aTreatAsNumber );
+}
+
+::rtl::OUString UnoControlFormattedFieldModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel );
+}
+
+::com::sun::star::uno::Any UnoControlFormattedFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ ::com::sun::star::uno::Any aReturn;
+ switch (nPropId)
+ {
+ case BASEPROPERTY_DEFAULTCONTROL: aReturn <<= ::rtl::OUString( ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ) );
+
+ case BASEPROPERTY_TREATASNUMBER: aReturn <<= (sal_Bool)sal_True; break;
+
+ case BASEPROPERTY_EFFECTIVE_DEFAULT:
+ case BASEPROPERTY_EFFECTIVE_VALUE:
+ case BASEPROPERTY_EFFECTIVE_MAX:
+ case BASEPROPERTY_EFFECTIVE_MIN:
+ case BASEPROPERTY_FORMATKEY:
+ case BASEPROPERTY_FORMATSSUPPLIER:
+ // (void)
+ break;
+
+ default : aReturn = UnoControlModel::ImplGetDefaultValue( nPropId ); break;
+ }
+
+ return aReturn;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlFormattedFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlFormattedFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoFormattedFieldControl
+// ----------------------------------------------------
+UnoFormattedFieldControl::UnoFormattedFieldControl()
+{
+}
+
+::rtl::OUString UnoFormattedFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "FormattedField" );
+}
+
+void UnoFormattedFieldControl::textChanged(const ::com::sun::star::awt::TextEvent& e) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xPeer(mxPeer, ::com::sun::star::uno::UNO_QUERY);
+ DBG_ASSERT(xPeer.is(), "UnoFormattedFieldControl::textChanged : what kind of peer do I have ?");
+ ::rtl::OUString sEffectiveValue = GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE );
+ ImplSetPropertyValue( sEffectiveValue, xPeer->getProperty( sEffectiveValue ), sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+// ----------------------------------------------------
+// class UnoControlFileControlModel
+// ----------------------------------------------------
+UnoControlFileControlModel::UnoControlFileControlModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlFileControlModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel );
+}
+
+::com::sun::star::uno::Any UnoControlFileControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlFileControlModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlFileControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoFileControl
+// ----------------------------------------------------
+UnoFileControl::UnoFileControl()
+{
+}
+
+::rtl::OUString UnoFileControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "filecontrol" );
+}
+
+// ----------------------------------------------------
+// class UnoControlButtonModel
+// ----------------------------------------------------
+UnoControlButtonModel::UnoControlButtonModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTBUTTON );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlButtonModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel );
+}
+
+::com::sun::star::uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoButtonControl
+// ----------------------------------------------------
+UnoButtonControl::UnoButtonControl()
+ : maActionListeners( *this )
+{
+ maComponentInfos.nWidth = 50;
+ maComponentInfos.nHeight = 14;
+}
+
+::rtl::OUString UnoButtonControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "pushbutton" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoButtonControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XImageConsumer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XImageProducer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoButtonControl )
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer>* ) NULL ),
+getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoButtonControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoButtonControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ if ( maActionListeners.getLength() )
+ xButton->addActionListener( &maActionListeners );
+}
+
+void UnoButtonControl::addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xButton->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoButtonControl::removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xButton->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= rLabel;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+void UnoButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maActionCommand = rCommand;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XButton > xButton( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xButton->setActionCommand( rCommand );
+ }
+}
+
+::com::sun::star::awt::Size UnoButtonControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+::com::sun::star::awt::Size UnoButtonControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+::com::sun::star::awt::Size UnoButtonControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+void UnoButtonControl::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.Init( Width, Height );
+}
+
+void UnoButtonControl::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*)RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask );
+}
+
+void UnoButtonControl::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (const unsigned char*)ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void UnoButtonControl::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*)ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void UnoButtonControl::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.Completed( Status );
+
+ // MT: Controls sollen angemeldet bleiben...
+// Producer->removeConsumer( this );
+
+ ImplUpdateImage( sal_True );
+}
+
+void UnoButtonControl::addConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxImageProducer.is() )
+ mxImageProducer->addConsumer( Consumer );
+}
+
+void UnoButtonControl::removeConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxImageProducer.is() )
+ mxImageProducer->removeConsumer( Consumer );
+}
+
+void UnoButtonControl::startProduction() throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxImageProducer.is() )
+ {
+ UnoMemoryStream* pStrm = new UnoMemoryStream( 0x3FFF, 0x3FFF );
+ (*pStrm) << maBitmap;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xIn = pStrm;
+// mxImageProducer->setImage( xIn );
+ mxImageProducer->startProduction();
+ }
+}
+
+void UnoButtonControl::ImplUpdateImage( sal_Bool bGetNewImage )
+{
+ sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True;
+ if ( bOK && mxPeer.is() && mxImageProducer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > xC( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ addConsumer( xC );
+ startProduction();
+ removeConsumer( xC );
+ }
+}
+
+// ----------------------------------------------------
+// class UnoControlImageControlModel
+// ----------------------------------------------------
+UnoControlImageControlModel::UnoControlImageControlModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+}
+
+::rtl::OUString UnoControlImageControlModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel );
+}
+
+::com::sun::star::uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlImageControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoImageControlControl
+// ----------------------------------------------------
+UnoImageControlControl::UnoImageControlControl()
+ : maActionListeners( *this )
+{
+ // Woher die Defaults nehmen?
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 100;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName_ImageProducer ) );
+ if ( xI.is() )
+ mxImageProducer = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >( xI, ::com::sun::star::uno::UNO_QUERY );
+}
+
+::rtl::OUString UnoImageControlControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "fixedimage" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoImageControlControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XImageConsumer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XImageProducer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoImageControlControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoImageControlControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+sal_Bool UnoImageControlControl::isTransparent() throw(::com::sun::star::uno::RuntimeException)
+{
+ return sal_True;
+}
+
+::com::sun::star::awt::Size UnoImageControlControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+::com::sun::star::awt::Size UnoImageControlControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+::com::sun::star::awt::Size UnoImageControlControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+void UnoImageControlControl::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.Init( Width, Height );
+}
+
+void UnoImageControlControl::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const unsigned long*)RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask );
+}
+
+void UnoImageControlControl::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (const unsigned char*)ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void UnoImageControlControl::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const unsigned long*)ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void UnoImageControlControl::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageProducer > & Producer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maImageConsumer.Completed( Status );
+
+ // MT: Controls sollen angemeldet bleiben...
+// Producer->removeConsumer( this );
+
+ ImplUpdateImage( sal_True );
+}
+
+void UnoImageControlControl::addConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxImageProducer.is() )
+ mxImageProducer->addConsumer( Consumer );
+}
+
+void UnoImageControlControl::removeConsumer( const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > & Consumer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxImageProducer.is() )
+ mxImageProducer->removeConsumer( Consumer );
+}
+
+void UnoImageControlControl::startProduction() throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxImageProducer.is() )
+ {
+ UnoMemoryStream* pStrm = new UnoMemoryStream( 0x3FFF, 0x3FFF );
+ (*pStrm) << maBitmap;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xIn = pStrm;
+// mxImageProducer->setImage( xIn );
+ mxImageProducer->startProduction();
+ }
+}
+
+void UnoImageControlControl::ImplUpdateImage( sal_Bool bGetNewImage )
+{
+ sal_Bool bOK = bGetNewImage ? maImageConsumer.GetData( maBitmap ) : sal_True;
+ if ( bOK && mxPeer.is() && mxImageProducer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XImageConsumer > xC( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ addConsumer( xC );
+ startProduction();
+ removeConsumer( xC );
+ }
+}
+
+// ----------------------------------------------------
+// class UnoControlRadioButtonModel
+// ----------------------------------------------------
+UnoControlRadioButtonModel::UnoControlRadioButtonModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_STATE );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlRadioButtonModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel );
+}
+
+::com::sun::star::uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoRadioButtonControl
+// ----------------------------------------------------
+UnoRadioButtonControl::UnoRadioButtonControl()
+ : maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoRadioButtonControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "radiobutton" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoRadioButtonControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ) ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoRadioButtonControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoRadioButtonControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+
+sal_Bool UnoRadioButtonControl::isTransparent() throw(::com::sun::star::uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void UnoRadioButtonControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XRadioButton > xRadioButton( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xRadioButton->addItemListener( this );
+
+ // Toggle-Verhalten abklemmen, macht DG
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xVclWindowPeer( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Bool)sal_False;
+ xVclWindowPeer->setProperty( GetPropertyName( BASEPROPERTY_AUTOTOGGLE ), aAny );
+}
+
+void UnoRadioButtonControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+}
+
+void UnoRadioButtonControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maItemListeners.removeInterface( l );
+}
+
+void UnoRadioButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= rLabel;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+void UnoRadioButtonControl::setState( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nState = bOn ? 1 : 0;
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= nState;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
+}
+
+sal_Bool UnoRadioButtonControl::getState() throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nState = 0;
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
+ aVal >>= nState;
+ return nState ? sal_True : sal_False;
+}
+
+void UnoRadioButtonControl::itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Int16)rEvent.Selected;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
+
+ if ( maItemListeners.getLength() )
+ maItemListeners.itemStateChanged( rEvent );
+}
+
+::com::sun::star::awt::Size UnoRadioButtonControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+::com::sun::star::awt::Size UnoRadioButtonControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+::com::sun::star::awt::Size UnoRadioButtonControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlCheckBoxModel
+// ----------------------------------------------------
+UnoControlCheckBoxModel::UnoControlCheckBoxModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_STATE );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_TRISTATE );
+}
+
+::rtl::OUString UnoControlCheckBoxModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel );
+}
+
+::com::sun::star::uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoCheckBoxControl
+// ----------------------------------------------------
+UnoCheckBoxControl::UnoCheckBoxControl()
+ : maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoCheckBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "checkbox" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoCheckBoxControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ) ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoCheckBoxControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoCheckBoxControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+sal_Bool UnoCheckBoxControl::isTransparent() throw(::com::sun::star::uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void UnoCheckBoxControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XCheckBox > xCheckBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xCheckBox->addItemListener( this );
+}
+
+void UnoCheckBoxControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+}
+
+void UnoCheckBoxControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maItemListeners.removeInterface( l );
+}
+
+void UnoCheckBoxControl::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= rLabel;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+void UnoCheckBoxControl::setState( short n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Int16)n;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
+}
+
+short UnoCheckBoxControl::getState() throw(::com::sun::star::uno::RuntimeException)
+{
+ short nState = 0;
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
+ aVal >>= nState;
+ return nState;
+}
+
+void UnoCheckBoxControl::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= b;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TRISTATE ), aAny, sal_True );
+}
+
+void UnoCheckBoxControl::itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Int16)rEvent.Selected;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
+
+ if ( maItemListeners.getLength() )
+ maItemListeners.itemStateChanged( rEvent );
+}
+
+::com::sun::star::awt::Size UnoCheckBoxControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+::com::sun::star::awt::Size UnoCheckBoxControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+::com::sun::star::awt::Size UnoCheckBoxControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlFixedTextModel
+// ----------------------------------------------------
+UnoControlFixedTextModel::UnoControlFixedTextModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_MULTILINE );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlFixedTextModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel );
+}
+
+::com::sun::star::uno::Any UnoControlFixedTextModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText );
+ return aAny;
+ }
+ else if ( nPropId == BASEPROPERTY_BORDER )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Int16)0;
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlFixedTextModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoFixedTextControl
+// ----------------------------------------------------
+UnoFixedTextControl::UnoFixedTextControl()
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoFixedTextControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "fixedtext" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoFixedTextControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XFixedText*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoFixedTextControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+sal_Bool UnoFixedTextControl::isTransparent() throw(::com::sun::star::uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void UnoFixedTextControl::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Text;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+::rtl::OUString UnoFixedTextControl::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
+}
+
+void UnoFixedTextControl::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Int16)nAlign;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+short UnoFixedTextControl::getAlignment() throw(::com::sun::star::uno::RuntimeException)
+{
+ short nAlign = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
+ aVal >>= nAlign;
+ }
+ return nAlign;
+}
+
+::com::sun::star::awt::Size UnoFixedTextControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+::com::sun::star::awt::Size UnoFixedTextControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+::com::sun::star::awt::Size UnoFixedTextControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlGroupBoxModel
+// ----------------------------------------------------
+UnoControlGroupBoxModel::UnoControlGroupBoxModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlGroupBoxModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel );
+}
+
+::com::sun::star::uno::Any UnoControlGroupBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlGroupBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoGroupBoxControl
+// ----------------------------------------------------
+UnoGroupBoxControl::UnoGroupBoxControl()
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 100;
+}
+
+::rtl::OUString UnoGroupBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "groupbox" );
+}
+
+sal_Bool UnoGroupBoxControl::isTransparent() throw(::com::sun::star::uno::RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------
+// class UnoControlListBoxModel
+// ----------------------------------------------------
+UnoControlListBoxModel::UnoControlListBoxModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_DROPDOWN );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LINECOUNT );
+ ImplRegisterProperty( BASEPROPERTY_MULTISELECTION );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_SELECTEDITEMS );
+ ImplRegisterProperty( BASEPROPERTY_STRINGITEMLIST );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+}
+
+::rtl::OUString UnoControlListBoxModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
+}
+
+::com::sun::star::uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+void UnoControlListBoxModel::ImplPropertyChanged( sal_uInt16 nPropId )
+{
+ if ( nPropId == BASEPROPERTY_STRINGITEMLIST )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aSeq;
+ setPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny );
+ }
+}
+
+// ----------------------------------------------------
+// class UnoListBoxControl
+// ----------------------------------------------------
+UnoListBoxControl::UnoListBoxControl()
+ : maActionListeners( *this ),
+ maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoListBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "listbox" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoListBoxControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XListBox*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, SAL_STATIC_CAST( ::com::sun::star::awt::XItemListener*, this ) ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoListBoxControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoListBoxControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal )
+{
+ UnoControl::ImplSetPeerProperty( rPropName, rVal );
+
+ // Wenn die SelectedItems vor der StringItemList gesetzt werden,
+ // hat das keine Auswirkung...
+ if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
+ {
+ ::rtl::OUString aSelPropName = GetPropertyName( BASEPROPERTY_SELECTEDITEMS );
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( aSelPropName );
+ if ( !( aVal.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > xW( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xW->setProperty( aSelPropName, aVal );
+ }
+ }
+}
+
+void UnoListBoxControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xListBox->addItemListener( this );
+
+ if ( maActionListeners.getLength() )
+ xListBox->addActionListener( &maActionListeners );
+}
+
+void UnoListBoxControl::addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xListBox->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoListBoxControl::removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xListBox->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoListBoxControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+}
+
+void UnoListBoxControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maItemListeners.removeInterface( l );
+}
+
+void UnoListBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( 1 );
+ aSeq.getArray()[0] = aItem;
+ addItems( aSeq, nPos );
+}
+
+void UnoListBoxControl::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ sal_uInt16 nNewLen = nOldLen + nNewItems;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ ::rtl::OUString* pOldData = aSeq.getArray();
+
+ if ( nPos > nOldLen )
+ nPos = (sal_uInt16) nOldLen;
+
+ sal_uInt16 n;
+ // Items vor der Einfuege-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Neue Items
+ for ( n = 0; n < nNewItems; n++ )
+ pNewData[nPos+n] = aItems.getConstArray()[n];
+
+ // Rest der alten Items
+ for ( n = nPos; n < nOldLen; n++ )
+ pNewData[nNewItems+n] = pOldData[n];
+
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+}
+
+void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ if ( nOldLen && ( nPos < nOldLen ) )
+ {
+ if ( nCount > ( nOldLen-nPos ) )
+ nCount = nOldLen-nPos;
+
+ sal_uInt16 nNewLen = nOldLen - nCount;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ ::rtl::OUString* pOldData = aSeq.getArray();
+
+ sal_uInt16 n;
+ // Items vor der Entfern-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Rest der Items
+ for ( n = nPos; n < (nOldLen-nCount); n++ )
+ pNewData[n] = pOldData[n+nCount];
+
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+ }
+}
+
+sal_Int16 UnoListBoxControl::getItemCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return (sal_Int16)aSeq.getLength();
+}
+
+::rtl::OUString UnoListBoxControl::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aItem;
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ if ( nPos < aSeq.getLength() )
+ aItem = aSeq.getConstArray()[nPos];
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> UnoListBoxControl::getItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return aSeq;
+}
+
+sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 n = -1;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ n = xListBox->getSelectedItemPos();
+ }
+ return n;
+}
+
+::com::sun::star::uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ aSeq = xListBox->getSelectedItemsPos();
+ }
+ return aSeq;
+}
+
+::rtl::OUString UnoListBoxControl::getSelectedItem() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aItem;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ aItem = xListBox->getSelectedItem();
+ }
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> UnoListBoxControl::getSelectedItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ aSeq = xListBox->getSelectedItems();
+ }
+ return aSeq;
+}
+
+void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xListBox->selectItemPos( nPos, bSelect );
+ }
+}
+
+void UnoListBoxControl::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xListBox->selectItemsPos( aPositions, bSelect );
+ }
+}
+
+void UnoListBoxControl::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xListBox->selectItem( aItem, bSelect );
+ }
+}
+
+void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xListBox->makeVisible( nEntry );
+ }
+}
+
+void UnoListBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Int16)nLines;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
+}
+
+sal_Int16 UnoListBoxControl::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
+}
+
+sal_Bool UnoListBoxControl::isMutipleMode() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRINGITEMLIST );
+}
+
+void UnoListBoxControl::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= bMulti;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTISELECTION ), aAny, sal_True );
+}
+
+void UnoListBoxControl::itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
+{
+ // Neue ::com::sun::star::uno::Sequence als ::com::sun::star::beans::Property ins Model treten.
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XListBox > xListBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xListBox.is(), "XListBox?" );
+
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos();
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny, sal_False );
+
+ if ( maItemListeners.getLength() )
+ maItemListeners.itemStateChanged( rEvent );
+}
+
+::com::sun::star::awt::Size UnoListBoxControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+::com::sun::star::awt::Size UnoListBoxControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+::com::sun::star::awt::Size UnoListBoxControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+::com::sun::star::awt::Size UnoListBoxControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return Impl_getMinimumSize( nCols, nLines );
+}
+
+void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Impl_getColumnsAndLines( nCols, nLines );
+}
+
+// ----------------------------------------------------
+// class UnoControlComboBoxModel
+// ----------------------------------------------------
+UnoControlComboBoxModel::UnoControlComboBoxModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_AUTOCOMPLETE );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_DROPDOWN );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LINECOUNT );
+ ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_STRINGITEMLIST );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlComboBoxModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel );
+}
+
+::com::sun::star::uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoComboBoxControl
+// ----------------------------------------------------
+UnoComboBoxControl::UnoComboBoxControl()
+ : maActionListeners( *this ),
+ maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoComboBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "combobox" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoComboBoxControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XComboBox*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoComboBoxControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XComboBox>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoComboBoxControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoComboBoxControl::createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ UnoEditControl::createPeer( rxToolkit, rParentPeer );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ if ( maActionListeners.getLength() )
+ xComboBox->addActionListener( &maActionListeners );
+ if ( maItemListeners.getLength() )
+ xComboBox->addItemListener( &maItemListeners );
+}
+
+void UnoComboBoxControl::addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xComboBox->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoComboBoxControl::removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( mxPeer.is() && maActionListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xComboBox->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoComboBoxControl::addItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+ if( mxPeer.is() && maItemListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xComboBox->addItemListener( &maItemListeners );
+ }
+}
+
+void UnoComboBoxControl::removeItemListener(const ::com::sun::star::uno::Reference < ::com::sun::star::awt::XItemListener > & l) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( mxPeer.is() && maItemListeners.getLength() == 1 )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XComboBox > xComboBox( mxPeer, ::com::sun::star::uno::UNO_QUERY ); // MT: Mal alles so umstellen, schoener als Ref anlegen und query rufen
+ xComboBox->removeItemListener( &maItemListeners );
+ }
+ maItemListeners.removeInterface( l );
+}
+
+void UnoComboBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( 1 );
+ aSeq.getArray()[0] = aItem;
+ addItems( aSeq, nPos );
+}
+
+void UnoComboBoxControl::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ sal_uInt16 nNewLen = nOldLen + nNewItems;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ const ::rtl::OUString* pOldData = aSeq.getConstArray();
+
+ if ( nPos > nOldLen )
+ nPos = (sal_uInt16) nOldLen;
+
+ sal_uInt16 n;
+ // Items vor der Einfuege-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Neue Items
+ for ( n = 0; n < nNewItems; n++ )
+ pNewData[nPos+n] = aItems.getConstArray()[n];
+
+ // Rest der alten Items
+ for ( n = nPos; n < nOldLen; n++ )
+ pNewData[nNewItems+n] = pOldData[n];
+
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+}
+
+void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ if ( nOldLen && ( nPos < nOldLen ) )
+ {
+ if ( nCount > ( nOldLen-nPos ) )
+ nCount = nOldLen-nPos;
+
+ sal_uInt16 nNewLen = nOldLen - nCount;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ ::rtl::OUString* pOldData = aSeq.getArray();
+
+ sal_uInt16 n;
+ // Items vor der Entfern-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Rest der Items
+ for ( n = nPos; n < (nOldLen-nCount); n++ )
+ pNewData[n] = pOldData[n+nCount];
+
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+ }
+}
+
+sal_Int16 UnoComboBoxControl::getItemCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return (sal_Int16)aSeq.getLength();
+}
+
+::rtl::OUString UnoComboBoxControl::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aItem;
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ if ( nPos < aSeq.getLength() )
+ aItem = aSeq.getConstArray()[nPos];
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> UnoComboBoxControl::getItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return aSeq;
+}
+
+void UnoComboBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= nLines;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
+}
+
+sal_Int16 UnoComboBoxControl::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
+}
+
+// ----------------------------------------------------
+// class UnoControlDateFieldModel
+// ----------------------------------------------------
+UnoControlDateFieldModel::UnoControlDateFieldModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DATE );
+ ImplRegisterProperty( BASEPROPERTY_DATEMAX );
+ ImplRegisterProperty( BASEPROPERTY_DATEMIN );
+ ImplRegisterProperty( BASEPROPERTY_DATESHOWCENTURY );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_DROPDOWN );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_EXTDATEFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_SPIN );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlDateFieldModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel );
+}
+
+::com::sun::star::uno::Any UnoControlDateFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlDateFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoDateFieldControl
+// ----------------------------------------------------
+UnoDateFieldControl::UnoDateFieldControl()
+{
+}
+
+::rtl::OUString UnoDateFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "datefield" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoDateFieldControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDateField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoDateFieldControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoDateFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDateField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Any aValue;
+ if ( !xField->isEmpty() )
+ aValue <<= xField->getDate();
+
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aValue, sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoDateFieldControl::setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Date;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aAny, sal_True );
+}
+
+sal_Int32 UnoDateFieldControl::getDate() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_DATE );
+}
+
+void UnoDateFieldControl::setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Date;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), aAny, sal_True );
+}
+
+sal_Int32 UnoDateFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMIN );
+}
+
+void UnoDateFieldControl::setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Date;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), aAny, sal_True );
+}
+
+sal_Int32 UnoDateFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMAX );
+}
+
+void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoDateFieldControl::setFirst not supported" );
+}
+
+sal_Int32 UnoDateFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoDateFieldControl::getFirst not supported" );
+ return 0;
+}
+
+void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoDateFieldControl::setLast not supported" );
+}
+
+sal_Int32 UnoDateFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoDateFieldControl::getLast not supported" );
+ return 0;
+}
+
+void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoDateFieldControl::setLongFormat not supported" );
+}
+
+sal_Bool UnoDateFieldControl::isLongFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoDateFieldControl::getLongFormat not supported" );
+ return sal_False;
+}
+
+void UnoDateFieldControl::setEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDateField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xField->setEmpty();
+ }
+}
+
+sal_Bool UnoDateFieldControl::isEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Bool bEmpty = sal_False;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDateField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ bEmpty = xField->isEmpty();
+ }
+ return bEmpty;
+}
+
+void UnoDateFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoDateFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+// ----------------------------------------------------
+// class UnoControlTimeFieldModel
+// ----------------------------------------------------
+UnoControlTimeFieldModel::UnoControlTimeFieldModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED);
+ ImplRegisterProperty( BASEPROPERTY_EXTTIMEFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_SPIN );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_TIME );
+ ImplRegisterProperty( BASEPROPERTY_TIMEMAX );
+ ImplRegisterProperty( BASEPROPERTY_TIMEMIN );
+}
+
+::rtl::OUString UnoControlTimeFieldModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel );
+}
+
+::com::sun::star::uno::Any UnoControlTimeFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlTimeFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoTimeFieldControl
+// ----------------------------------------------------
+UnoTimeFieldControl::UnoTimeFieldControl()
+{
+}
+
+::rtl::OUString UnoTimeFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "timefield" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoTimeFieldControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTimeField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoTimeFieldControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoTimeFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XTimeField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Any aValue;
+ if ( !xField->isEmpty() )
+ xField->getTime();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aValue, sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoTimeFieldControl::setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Time;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aAny, sal_True );
+}
+
+sal_Int32 UnoTimeFieldControl::getTime() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_TIME );
+}
+
+void UnoTimeFieldControl::setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Time;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), aAny, sal_True );
+}
+
+sal_Int32 UnoTimeFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMIN );
+}
+
+void UnoTimeFieldControl::setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Time;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), aAny, sal_True );
+}
+
+sal_Int32 UnoTimeFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMAX );
+}
+
+void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoTimeFieldControl::setFirst not supported" );
+}
+
+sal_Int32 UnoTimeFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoTimeFieldControl::getFirst not supported" );
+ return 0;
+}
+
+void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoTimeFieldControl::setLast not supported" );
+}
+
+sal_Int32 UnoTimeFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoTimeFieldControl::getLast not supported" );
+ return 0;
+}
+
+void UnoTimeFieldControl::setEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XTimeField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xField->setEmpty();
+ }
+}
+
+sal_Bool UnoTimeFieldControl::isEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ sal_Bool bEmpty = sal_False;
+ if ( mxPeer.is() )
+ {
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XTimeField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ bEmpty = xField->isEmpty();
+ }
+ return bEmpty;
+}
+
+void UnoTimeFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoTimeFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+// ----------------------------------------------------
+// class UnoControlNumericFieldModel
+// ----------------------------------------------------
+UnoControlNumericFieldModel::UnoControlNumericFieldModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DECIMALACCURACY );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_NUMSHOWTHOUSANDSEP );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_SPIN );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_VALUEMAX_DOUBLE );
+ ImplRegisterProperty( BASEPROPERTY_VALUEMIN_DOUBLE );
+ ImplRegisterProperty( BASEPROPERTY_VALUESTEP_DOUBLE );
+ ImplRegisterProperty( BASEPROPERTY_VALUE_DOUBLE );
+}
+
+::rtl::OUString UnoControlNumericFieldModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel );
+}
+
+::com::sun::star::uno::Any UnoControlNumericFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlNumericFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlNumericFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoNumericFieldControl
+// ----------------------------------------------------
+UnoNumericFieldControl::UnoNumericFieldControl()
+{
+}
+
+::rtl::OUString UnoNumericFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "numericfield" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoNumericFieldControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoNumericFieldControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoNumericFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XNumericField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= xField->getValue();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoNumericFieldControl::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
+}
+
+void UnoNumericFieldControl::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
+}
+
+void UnoNumericFieldControl::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
+}
+
+void UnoNumericFieldControl::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoNumericFieldControl::setFirst not supported" );
+}
+
+double UnoNumericFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoNumericFieldControl::getFirst not supported" );
+ return 0;
+}
+
+void UnoNumericFieldControl::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoNumericFieldControl::setLast not supported" );
+}
+
+double UnoNumericFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoNumericFieldControl::getLast not supported" );
+ return 0;
+}
+
+void UnoNumericFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoNumericFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+void UnoNumericFieldControl::setSpinSize( double Digits ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Digits;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
+}
+
+void UnoNumericFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoNumericFieldControl::setDecimalDigits not supported" );
+}
+
+sal_Int16 UnoNumericFieldControl::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoNumericFieldControl::getDecimalDigits not supported" );
+ return 0;
+}
+
+// ----------------------------------------------------
+// class UnoControlCurrencyFieldModel
+// ----------------------------------------------------
+UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_CURRENCYSYMBOL );
+ ImplRegisterProperty( BASEPROPERTY_CURSYM_POSITION );
+ ImplRegisterProperty( BASEPROPERTY_DECIMALACCURACY );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_NUMSHOWTHOUSANDSEP );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_SPIN );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_VALUEMAX_DOUBLE );
+ ImplRegisterProperty( BASEPROPERTY_VALUEMIN_DOUBLE );
+ ImplRegisterProperty( BASEPROPERTY_VALUESTEP_DOUBLE );
+ ImplRegisterProperty( BASEPROPERTY_VALUE_DOUBLE );
+}
+
+::rtl::OUString UnoControlCurrencyFieldModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel );
+}
+
+::com::sun::star::uno::Any UnoControlCurrencyFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField );
+ return aAny;
+ }
+ if ( nPropId == BASEPROPERTY_CURSYM_POSITION )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= (sal_Bool)sal_False;
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlCurrencyFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoCurrencyFieldControl
+// ----------------------------------------------------
+UnoCurrencyFieldControl::UnoCurrencyFieldControl()
+{
+}
+
+::rtl::OUString UnoCurrencyFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "longcurrencyfield" );
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoCurrencyFieldControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoCurrencyFieldControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoCurrencyFieldControl::textChanged( const ::com::sun::star::awt::TextEvent& e ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XCurrencyField > xField( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= xField->getValue();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoCurrencyFieldControl::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoCurrencyFieldControl::setFirst not supported" );
+}
+
+double UnoCurrencyFieldControl::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoCurrencyFieldControl::getFirst not supported" );
+ return 0;
+}
+
+void UnoCurrencyFieldControl::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoCurrencyFieldControl::setLast not supported" );
+}
+
+double UnoCurrencyFieldControl::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoCurrencyFieldControl::getLast not supported" );
+ return 0;
+}
+
+void UnoCurrencyFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoCurrencyFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+void UnoCurrencyFieldControl::setSpinSize( double Digits ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= Digits;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoCurrencyFieldControl::setDecimalDigits not supported" );
+}
+
+sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_WARNING( "UnoCurrencyFieldControl::getDecimalDigits not supported" );
+ return 0;
+}
+
+// ----------------------------------------------------
+// class UnoControlPatternFieldModel
+// ----------------------------------------------------
+UnoControlPatternFieldModel::UnoControlPatternFieldModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_EDITMASK );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LITERALMASK );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+}
+
+::rtl::OUString UnoControlPatternFieldModel::getServiceName() const
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel );
+}
+
+::com::sun::star::uno::Any UnoControlPatternFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlPatternFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlPatternFieldModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoPatternFieldControl
+// ----------------------------------------------------
+UnoPatternFieldControl::UnoPatternFieldControl()
+{
+}
+
+::rtl::OUString UnoPatternFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "patternfield" );
+}
+
+void UnoPatternFieldControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal )
+{
+ sal_uInt16 nType = GetPropertyId( rPropName );
+ if ( ( nType == BASEPROPERTY_TEXT ) || ( nType == BASEPROPERTY_EDITMASK ) || ( nType == BASEPROPERTY_LITERALMASK ) )
+ {
+ // Die Masken koennen nicht nacheinander gesetzt werden.
+ ::rtl::OUString Text = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
+ ::rtl::OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
+ ::rtl::OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::awt::XPatternField > xPF( mxPeer, ::com::sun::star::uno::UNO_QUERY );
+ xPF->setString( Text );
+ xPF->setMasks( EditMask, LiteralMask );
+ }
+ else
+ UnoControl::ImplSetPeerProperty( rPropName, rVal );
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoPatternFieldControl::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPatternField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoPatternFieldControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoPatternFieldControl::setString( const ::rtl::OUString& rString ) throw(::com::sun::star::uno::RuntimeException)
+{
+ setText( rString );
+}
+
+::rtl::OUString UnoPatternFieldControl::getString() throw(::com::sun::star::uno::RuntimeException)
+{
+ return getText();
+}
+
+void UnoPatternFieldControl::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= EditMask;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_EDITMASK ), aAny, sal_True );
+ aAny <<= LiteralMask;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LITERALMASK ), aAny, sal_True );
+}
+
+void UnoPatternFieldControl::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
+ LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
+}
+
+void UnoPatternFieldControl::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoPatternFieldControl::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+
+
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
new file mode 100644
index 000000000000..f96f5945f813
--- /dev/null
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * $RCSfile: listenermultiplexer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+// ----------------------------------------------------
+// class ListenerMultiplexerBase
+// ----------------------------------------------------
+ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject& rSource )
+ : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any ListenerMultiplexerBase::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, this ) );
+}
+
+
+// ----------------------------------------------------
+// class EventListenerMultiplexer
+// ----------------------------------------------------
+EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject& rSource )
+ : ListenerMultiplexerBase( rSource )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any EventListenerMultiplexer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ) );
+ return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XEventListener
+void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException)
+{
+}
+
+// ----------------------------------------------------
+// class FocusListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent )
+
+// ----------------------------------------------------
+// class WindowListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class VclContainerListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowAdded, ::com::sun::star::awt::VclContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowRemoved, ::com::sun::star::awt::VclContainerEvent )
+
+// ----------------------------------------------------
+// class KeyListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent )
+
+// ----------------------------------------------------
+// class MouseListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent )
+
+// ----------------------------------------------------
+// class MouseMotionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent )
+
+// ----------------------------------------------------
+// class PaintListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent )
+
+// ----------------------------------------------------
+// class TopWindowListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class TextListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener, textChanged, ::com::sun::star::awt::TextEvent )
+
+// ----------------------------------------------------
+// class ActionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener, actionPerformed, ::com::sun::star::awt::ActionEvent )
+
+// ----------------------------------------------------
+// class ItemListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener, itemStateChanged, ::com::sun::star::awt::ItemEvent )
+
+// ----------------------------------------------------
+// class ContainerListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementInserted, ::com::sun::star::container::ContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementRemoved, ::com::sun::star::container::ContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementReplaced, ::com::sun::star::container::ContainerEvent )
+
+// ----------------------------------------------------
+// class SpinListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, up, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, down, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, first, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, last, ::com::sun::star::awt::SpinEvent )
+
+// ----------------------------------------------------
+// class AdjustmentListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener, adjustmentValueChanged, ::com::sun::star::awt::AdjustmentEvent )
+
+// ----------------------------------------------------
+// class MenuListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, highlight, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, select, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, activate, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, deactivate, ::com::sun::star::awt::MenuEvent )
+
+
+
diff --git a/toolkit/source/helper/makefile.mk b/toolkit/source/helper/makefile.mk
new file mode 100644
index 000000000000..924801991862
--- /dev/null
+++ b/toolkit/source/helper/makefile.mk
@@ -0,0 +1,90 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=helper
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/listenermultiplexer.obj \
+ $(SLO)$/property.obj \
+ $(SLO)$/registerservices.obj \
+ $(SLO)$/servicenames.obj \
+ $(SLO)$/unomemorystream.obj \
+ $(SLO)$/unopropertyarrayhelper.obj \
+ $(SLO)$/unowrapper.obj \
+ $(SLO)$/vclunohelper.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
new file mode 100644
index 000000000000..613ba62f3ea3
--- /dev/null
+++ b/toolkit/source/helper/property.cxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * $RCSfile: property.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/macros.hxx>
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <stdlib.h> // qsort/bsearch
+#include <tools/debug.hxx>
+
+#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_
+#include <com/sun/star/awt/FontWeight.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_
+#include <com/sun/star/awt/FontSlant.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_CHARSET_HPP_
+#include <com/sun/star/awt/CharSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_
+#include <com/sun/star/awt/FontWidth.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTTYPE_HPP_
+#include <com/sun/star/awt/FontType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTUNDERLINE_HPP_
+#include <com/sun/star/awt/FontUnderline.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTSTRIKEOUT_HPP_
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTPITCH_HPP_
+#include <com/sun/star/awt/FontPitch.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+#include <unotools/types.hxx>
+
+#include <toolkit/helper/property.hxx>
+
+struct ImplPropertyInfo
+{
+ ::rtl::OUString aName;
+ sal_uInt16 nPropId;
+ ::com::sun::star::uno::Type aType;
+ sal_Int16 nAttribs;
+ sal_Bool bDependsOnOthers; // eg. VALUE depends on MIN/MAX and must be set after MIN/MAX.
+
+ ImplPropertyInfo()
+ {
+ nPropId = 0;
+ nAttribs = 0;
+ bDependsOnOthers = sal_False;
+ }
+
+ ImplPropertyInfo( const sal_Unicode* pName, sal_uInt16 nId, const ::com::sun::star::uno::Type& rType,
+ sal_Int16 nAttrs, sal_Bool bDepends = sal_False )
+ : aName( pName )
+ {
+ nPropId = nId;
+ aType = rType;
+ nAttribs = nAttrs;
+ bDependsOnOthers = bDepends;
+ }
+
+};
+
+ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
+{
+ static ImplPropertyInfo* pPropertyInfos = NULL;
+ static sal_uInt16 nElements = 0;
+ if( !pPropertyInfos )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pPropertyInfos )
+ {
+ static ImplPropertyInfo __FAR_DATA aImplPropertyInfos [] =
+ {
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Align" ), BASEPROPERTY_ALIGN, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Autocomplete" ), BASEPROPERTY_AUTOCOMPLETE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "AutoToggle" ), BASEPROPERTY_AUTOTOGGLE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "BackgroundColor" ), BASEPROPERTY_BACKGROUNDCOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Border" ), BASEPROPERTY_BORDER, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "CurrencySymbol" ), BASEPROPERTY_CURRENCYSYMBOL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Date" ), BASEPROPERTY_DATE, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateFormat" ), BASEPROPERTY_EXTDATEFORMAT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateMax" ), BASEPROPERTY_DATEMAX, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateMin" ), BASEPROPERTY_DATEMIN, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DateShowCentury" ), BASEPROPERTY_DATESHOWCENTURY, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DecimalAccuracy" ), BASEPROPERTY_DECIMALACCURACY, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DefaultButton" ), BASEPROPERTY_DEFAULTBUTTON, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "DefaultControl" ), BASEPROPERTY_DEFAULTCONTROL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Dropdown" ), BASEPROPERTY_DROPDOWN, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EchoChar" ), BASEPROPERTY_ECHOCHAR, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EditMask" ), BASEPROPERTY_EDITMASK, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveDefault" ), BASEPROPERTY_EFFECTIVE_DEFAULT, ::getCppuType((const ::com::sun::star::uno::Any*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveMax" ), BASEPROPERTY_EFFECTIVE_MAX, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveMin" ), BASEPROPERTY_EFFECTIVE_MIN, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "EffectiveValue" ), BASEPROPERTY_EFFECTIVE_VALUE, ::getCppuType((const ::com::sun::star::uno::Any*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Enabled" ), BASEPROPERTY_ENABLED, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FillColor" ), BASEPROPERTY_FILLCOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FocusSelectionHide" ), BASEPROPERTY_FOCUSSELECTIONHIDE,::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontDescriptor" ), BASEPROPERTY_FONTDESCRIPTOR, ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+
+ // Teile des ::com::sun::star::awt::FontDescriptor
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontName" ), BASEPROPERTY_FONTDESCRIPTORPART_NAME, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontStyleName" ), BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontFamily" ), BASEPROPERTY_FONTDESCRIPTORPART_FAMILY, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontCharset" ), BASEPROPERTY_FONTDESCRIPTORPART_CHARSET, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontHeight" ), BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontWidth" ), BASEPROPERTY_FONTDESCRIPTORPART_WIDTH, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontPitch" ), BASEPROPERTY_FONTDESCRIPTORPART_PITCH, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontWeight" ), BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontCharWidth" ), BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontOrientation" ), BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION, ::getCppuType((const Float*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontSlant" ), BASEPROPERTY_FONTDESCRIPTORPART_SLANT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontUnderline" ), BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontStrikeout" ), BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontKerning" ), BASEPROPERTY_FONTDESCRIPTORPART_KERNING, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontWordLineMode" ), BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FontType" ), BASEPROPERTY_FONTDESCRIPTORPART_TYPE, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT /*, PropertyState_AMBIGUOUS_VALUE */ ),
+
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FormatKey" ), BASEPROPERTY_FORMATKEY, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEVOID|::com::sun::star::beans::PropertyAttribute::TRANSIENT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "FormatsSupplier" ), BASEPROPERTY_FORMATSSUPPLIER, ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEVOID|::com::sun::star::beans::PropertyAttribute::TRANSIENT ),
+
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "HelpURL" ), BASEPROPERTY_HELPURL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "HScroll" ), BASEPROPERTY_HSCROLL, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "HardLineBreaks" ), BASEPROPERTY_HARDLINEBREAKS, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ImageURL" ), BASEPROPERTY_IMAGEURL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Label" ), BASEPROPERTY_LABEL, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "LineColor" ), BASEPROPERTY_LINECOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "LineCount" ), BASEPROPERTY_LINECOUNT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "LiteralMask" ), BASEPROPERTY_LITERALMASK, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "MaxTextLen" ), BASEPROPERTY_MAXTEXTLEN, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "MultiLine" ), BASEPROPERTY_MULTILINE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "MultiSelection" ), BASEPROPERTY_MULTISELECTION, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "PrependCurrencySymbol" ), BASEPROPERTY_CURSYM_POSITION, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Printable" ), BASEPROPERTY_PRINTABLE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ReadOnly" ), BASEPROPERTY_READONLY, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "SelectedItems" ), BASEPROPERTY_SELECTEDITEMS, ::getCppuType((::com::sun::star::uno::Sequence<sal_Int16>*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ShowThousandsSeparator" ), BASEPROPERTY_NUMSHOWTHOUSANDSEP,::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Spin" ), BASEPROPERTY_SPIN, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "State" ), BASEPROPERTY_STATE, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "StrictFormat" ), BASEPROPERTY_STRICTFORMAT, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "StringItemList" ), BASEPROPERTY_STRINGITEMLIST, ::getCppuType((::com::sun::star::uno::Sequence< ::rtl::OUString >*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Tabstop" ), BASEPROPERTY_TABSTOP, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Text" ), BASEPROPERTY_TEXT, ::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TextColor" ), BASEPROPERTY_TEXTCOLOR, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Time" ), BASEPROPERTY_TIME, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TimeFormat" ), BASEPROPERTY_EXTTIMEFORMAT, ::getCppuType((const sal_Int16*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TimeMax" ), BASEPROPERTY_TIMEMAX, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TimeMin" ), BASEPROPERTY_TIMEMIN, ::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TreatAsNumber" ), BASEPROPERTY_TREATASNUMBER, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::TRANSIENT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "TriState" ), BASEPROPERTY_TRISTATE, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "VScroll" ), BASEPROPERTY_VSCROLL, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "Value" ), BASEPROPERTY_VALUE_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT|::com::sun::star::beans::PropertyAttribute::MAYBEVOID, sal_True ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ValueMax" ), BASEPROPERTY_VALUEMAX_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ValueMin" ), BASEPROPERTY_VALUEMIN_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( "ValueStep" ), BASEPROPERTY_VALUESTEP_DOUBLE, ::getCppuType((const Double*)0), ::com::sun::star::beans::PropertyAttribute::BOUND|::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT ),
+ };
+ pPropertyInfos = aImplPropertyInfos;
+ nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
+ }
+ }
+ rElementCount = nElements;
+ return pPropertyInfos;
+}
+
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+_Optlink
+#endif
+ ImplPropertyInfoCompare( const void* pFirst, const void* pSecond)
+{
+ return ((ImplPropertyInfo*)pFirst)->aName.compareTo( ((ImplPropertyInfo*)pSecond)->aName );
+}
+
+void ImplAssertValidPropertyArray()
+{
+ static sal_Bool bSorted = sal_False;
+ if( !bSorted )
+ {
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ qsort( pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare );
+ bSorted = sal_True;
+ }
+}
+
+sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName )
+{
+ ImplAssertValidPropertyArray();
+
+ ImplPropertyInfo aSearch;
+ aSearch.aName = rPropertyName;
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ ImplPropertyInfo* pInf = (ImplPropertyInfo*)
+ bsearch( &aSearch, pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare );
+
+ return pInf ? pInf->nPropId: 0;
+}
+
+const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId )
+{
+ ImplAssertValidPropertyArray();
+
+ const ImplPropertyInfo* pImplPropertyInfo = NULL;
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ for ( sal_uInt16 n = nElements; n && !pImplPropertyInfo; )
+ {
+ if ( pInfos[--n].nPropId == nPropertyId )
+ pImplPropertyInfo = &pInfos[n];
+ }
+
+ return pImplPropertyInfo;
+}
+
+sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId )
+{
+ ImplAssertValidPropertyArray();
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ for ( sal_uInt16 n = nElements; n; )
+ {
+ if ( pInfos[--n].nPropId == nPropertyId )
+ return n;
+ }
+ return 0xFFFF;
+}
+
+const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo->aName;
+}
+
+const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? &pImplPropertyInfo->aType : NULL;
+}
+
+sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? pImplPropertyInfo->nAttribs : NULL;
+}
+
+sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? pImplPropertyInfo->bDependsOnOthers : sal_False;
+}
+
+sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 )
+{
+ return ::utl::compare( r1, r2 );
+}
+
+
+
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
new file mode 100644
index 000000000000..d56e75df00c9
--- /dev/null
+++ b/toolkit/source/helper/registerservices.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * $RCSfile: registerservices.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#include <cppuhelper/factory.hxx>
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/macros.hxx>
+
+#include <toolkit/awt/vclxtoolkit.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/awt/vclxprinter.hxx>
+
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/controls/stdtabcontrollermodel.hxx>
+
+
+#define REGISTER_SERVICES( ImplName, ServiceName1, ServiceName2 ) \
+ xNewKey = pRegistryKey->createKey( ::rtl::OUString::createFromAscii( "/stardiv.Toolkit." #ImplName "/UNO/SERVICES" ) ); \
+ xNewKey->createKey( ServiceName1 ); \
+ xNewKey->createKey( ServiceName2 );
+
+
+#define IMPL_CREATEINSTANCE( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); }
+
+#define CHECKANDCREATEFACTORY( ImplName, ServiceName1, ServiceName2 ) \
+ if ( rtl_str_compare( sImplementationName, "stardiv.Toolkit." #ImplName ) == 0 ) \
+ { \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames(2); \
+ aServiceNames.getArray()[0] = ServiceName1; \
+ aServiceNames.getArray()[1] = ServiceName2; \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory( ::cppu::createSingleFactory( pServiceManager, \
+ ::rtl::OUString::createFromAscii( sImplementationName ), ImplName##_CreateInstance, aServiceNames ) ); \
+ if ( xFactory.is() ) \
+ { \
+ xFactory->acquire(); \
+ pRet = xFactory.get(); \
+ } \
+ }
+
+
+IMPL_CREATEINSTANCE( VCLXToolkit )
+IMPL_CREATEINSTANCE( StdTabController )
+IMPL_CREATEINSTANCE( StdTabControllerModel )
+IMPL_CREATEINSTANCE( UnoButtonControl )
+IMPL_CREATEINSTANCE( UnoCheckBoxControl )
+IMPL_CREATEINSTANCE( UnoComboBoxControl )
+IMPL_CREATEINSTANCE( UnoControlButtonModel )
+IMPL_CREATEINSTANCE( UnoControlCheckBoxModel )
+IMPL_CREATEINSTANCE( UnoControlComboBoxModel )
+IMPL_CREATEINSTANCE( UnoControlContainer )
+IMPL_CREATEINSTANCE( UnoControlContainerModel )
+IMPL_CREATEINSTANCE( UnoControlCurrencyFieldModel )
+IMPL_CREATEINSTANCE( UnoControlDateFieldModel )
+IMPL_CREATEINSTANCE( UnoControlEditModel )
+IMPL_CREATEINSTANCE( UnoControlFileControlModel )
+IMPL_CREATEINSTANCE( UnoControlFixedTextModel )
+IMPL_CREATEINSTANCE( UnoControlFormattedFieldModel )
+IMPL_CREATEINSTANCE( UnoControlGroupBoxModel )
+IMPL_CREATEINSTANCE( UnoControlImageControlModel )
+IMPL_CREATEINSTANCE( UnoControlListBoxModel )
+IMPL_CREATEINSTANCE( UnoControlNumericFieldModel )
+IMPL_CREATEINSTANCE( UnoControlPatternFieldModel )
+IMPL_CREATEINSTANCE( UnoControlRadioButtonModel )
+IMPL_CREATEINSTANCE( UnoControlTimeFieldModel )
+IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
+IMPL_CREATEINSTANCE( UnoDateFieldControl )
+IMPL_CREATEINSTANCE( UnoEditControl )
+IMPL_CREATEINSTANCE( UnoFileControl )
+IMPL_CREATEINSTANCE( UnoFixedTextControl )
+IMPL_CREATEINSTANCE( UnoFormattedFieldControl )
+IMPL_CREATEINSTANCE( UnoGroupBoxControl )
+IMPL_CREATEINSTANCE( UnoImageControlControl )
+IMPL_CREATEINSTANCE( UnoListBoxControl )
+IMPL_CREATEINSTANCE( UnoNumericFieldControl )
+IMPL_CREATEINSTANCE( UnoPatternFieldControl )
+IMPL_CREATEINSTANCE( UnoRadioButtonControl )
+IMPL_CREATEINSTANCE( UnoTimeFieldControl )
+IMPL_CREATEINSTANCE( VCLXMenuBar )
+IMPL_CREATEINSTANCE( VCLXPointer )
+IMPL_CREATEINSTANCE( VCLXPopupMenu )
+IMPL_CREATEINSTANCE( VCLXPrinterServer )
+
+
+extern "C"
+{
+
+void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, void* _pRegistryKey )
+{
+ if (_pRegistryKey)
+ {
+ ::com::sun::star::registry::XRegistryKey * pRegistryKey = reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( _pRegistryKey );
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xNewKey;
+
+ REGISTER_SERVICES( VCLXToolkit, ::rtl::OUString::createFromAscii( szServiceName_Toolkit ), ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
+ REGISTER_SERVICES( VCLXPopupMenu, ::rtl::OUString::createFromAscii( szServiceName_PopupMenu ), ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu ) );
+ REGISTER_SERVICES( VCLXMenuBar, ::rtl::OUString::createFromAscii( szServiceName_MenuBar ), ::rtl::OUString::createFromAscii( szServiceName2_MenuBar ) );
+ REGISTER_SERVICES( VCLXPointer, ::rtl::OUString::createFromAscii( szServiceName_Pointer ), ::rtl::OUString::createFromAscii( szServiceName2_Pointer ) );
+ REGISTER_SERVICES( UnoControlContainer, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainer ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainer ) );
+ REGISTER_SERVICES( UnoControlContainerModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainerModel ) );
+ REGISTER_SERVICES( StdTabController, ::rtl::OUString::createFromAscii( szServiceName_TabController ), ::rtl::OUString::createFromAscii( szServiceName2_TabController ) );
+ REGISTER_SERVICES( StdTabControllerModel, ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel ), ::rtl::OUString::createFromAscii( szServiceName2_TabControllerModel ) );
+ REGISTER_SERVICES( UnoEditControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEdit ) );
+ REGISTER_SERVICES( UnoControlEditModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ) );
+ REGISTER_SERVICES( UnoDateFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateField ) );
+ REGISTER_SERVICES( UnoControlDateFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel ) );
+ REGISTER_SERVICES( UnoTimeFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeField ) );
+ REGISTER_SERVICES( UnoControlTimeFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel ) );
+ REGISTER_SERVICES( UnoNumericFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericField ) );
+ REGISTER_SERVICES( UnoControlNumericFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel ) );
+ REGISTER_SERVICES( UnoCurrencyFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyField ) );
+ REGISTER_SERVICES( UnoControlCurrencyFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel ) );
+ REGISTER_SERVICES( UnoPatternFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternField ) );
+ REGISTER_SERVICES( UnoControlPatternFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel ) );
+ REGISTER_SERVICES( UnoFormattedFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedField ) );
+ REGISTER_SERVICES( UnoControlFormattedFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ) );
+ REGISTER_SERVICES( UnoFileControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControl ) );
+ REGISTER_SERVICES( UnoControlFileControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel ) );
+ REGISTER_SERVICES( UnoButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButton ) );
+ REGISTER_SERVICES( UnoControlButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel ) );
+ REGISTER_SERVICES( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButton ) );
+ REGISTER_SERVICES( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButtonModel ) );
+ REGISTER_SERVICES( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControl ) );
+ REGISTER_SERVICES( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel ) );
+ REGISTER_SERVICES( UnoRadioButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButton ) );
+ REGISTER_SERVICES( UnoControlRadioButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
+ REGISTER_SERVICES( UnoCheckBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBox ) );
+ REGISTER_SERVICES( UnoControlCheckBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel ) );
+ REGISTER_SERVICES( UnoListBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBox ) );
+ REGISTER_SERVICES( UnoControlListBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel ) );
+ REGISTER_SERVICES( UnoComboBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBox ) );
+ REGISTER_SERVICES( UnoControlComboBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel ) );
+ REGISTER_SERVICES( UnoFixedTextControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedText ) );
+ REGISTER_SERVICES( UnoControlFixedTextModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel ) );
+ REGISTER_SERVICES( UnoGroupBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBox ) );
+ REGISTER_SERVICES( UnoControlGroupBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel ) );
+ REGISTER_SERVICES( VCLXPrinterServer, ::rtl::OUString::createFromAscii( szServiceName_PrinterServer ), ::rtl::OUString::createFromAscii( szServiceName2_PrinterServer ) );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey )
+{
+ void* pRet = 0;
+
+ if ( _pServiceManager )
+ {
+ ::com::sun::star::lang::XMultiServiceFactory* pServiceManager = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
+
+ CHECKANDCREATEFACTORY( VCLXToolkit, ::rtl::OUString::createFromAscii( szServiceName_Toolkit ), ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) )
+ else CHECKANDCREATEFACTORY( VCLXPopupMenu, ::rtl::OUString::createFromAscii( szServiceName_PopupMenu ), ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu ) )
+ else CHECKANDCREATEFACTORY( VCLXMenuBar, ::rtl::OUString::createFromAscii( szServiceName_MenuBar ), ::rtl::OUString::createFromAscii( szServiceName2_MenuBar ) )
+ else CHECKANDCREATEFACTORY( VCLXPointer, ::rtl::OUString::createFromAscii( szServiceName_Pointer ), ::rtl::OUString::createFromAscii( szServiceName2_Pointer ) )
+ else CHECKANDCREATEFACTORY( UnoControlContainer, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainer ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainer ) )
+ else CHECKANDCREATEFACTORY( UnoControlContainerModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlContainerModel ) )
+ else CHECKANDCREATEFACTORY( StdTabController, ::rtl::OUString::createFromAscii( szServiceName_TabController ), ::rtl::OUString::createFromAscii( szServiceName2_TabController ) )
+ else CHECKANDCREATEFACTORY( StdTabControllerModel, ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel ), ::rtl::OUString::createFromAscii( szServiceName2_TabControllerModel ) )
+ else CHECKANDCREATEFACTORY( UnoEditControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEdit ) )
+ else CHECKANDCREATEFACTORY( UnoControlEditModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel ) )
+ else CHECKANDCREATEFACTORY( UnoDateFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateField ) )
+ else CHECKANDCREATEFACTORY( UnoControlDateFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel ) )
+ else CHECKANDCREATEFACTORY( UnoTimeFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeField ) )
+ else CHECKANDCREATEFACTORY( UnoControlTimeFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel ) )
+ else CHECKANDCREATEFACTORY( UnoNumericFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericField ) )
+ else CHECKANDCREATEFACTORY( UnoControlNumericFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel ) )
+ else CHECKANDCREATEFACTORY( UnoCurrencyFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyField ) )
+ else CHECKANDCREATEFACTORY( UnoControlCurrencyFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel ) )
+ else CHECKANDCREATEFACTORY( UnoPatternFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternField ) )
+ else CHECKANDCREATEFACTORY( UnoControlPatternFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel ) )
+ else CHECKANDCREATEFACTORY( UnoFormattedFieldControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedField ) )
+ else CHECKANDCREATEFACTORY( UnoControlFormattedFieldModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel ) )
+ else CHECKANDCREATEFACTORY( UnoFileControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControl ) )
+ else CHECKANDCREATEFACTORY( UnoControlFileControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel ) )
+ else CHECKANDCREATEFACTORY( UnoButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButton ) )
+ else CHECKANDCREATEFACTORY( UnoControlButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel ) )
+ else CHECKANDCREATEFACTORY( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButton ) )
+ else CHECKANDCREATEFACTORY( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageButtonModel ) )
+ else CHECKANDCREATEFACTORY( UnoImageControlControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControl ) )
+ else CHECKANDCREATEFACTORY( UnoControlImageControlModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel ) )
+ else CHECKANDCREATEFACTORY( UnoRadioButtonControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButton ) )
+ else CHECKANDCREATEFACTORY( UnoControlRadioButtonModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) )
+ else CHECKANDCREATEFACTORY( UnoCheckBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBox ) )
+ else CHECKANDCREATEFACTORY( UnoControlCheckBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel ) )
+ else CHECKANDCREATEFACTORY( UnoListBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBox ) )
+ else CHECKANDCREATEFACTORY( UnoControlListBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel ) )
+ else CHECKANDCREATEFACTORY( UnoComboBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBox ) )
+ else CHECKANDCREATEFACTORY( UnoControlComboBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel ) )
+ else CHECKANDCREATEFACTORY( UnoFixedTextControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedText ) )
+ else CHECKANDCREATEFACTORY( UnoControlFixedTextModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel ) )
+ else CHECKANDCREATEFACTORY( UnoGroupBoxControl, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBox ) )
+ else CHECKANDCREATEFACTORY( UnoControlGroupBoxModel, ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel ), ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel ) )
+ else CHECKANDCREATEFACTORY( VCLXPrinterServer, ::rtl::OUString::createFromAscii( szServiceName_PrinterServer ), ::rtl::OUString::createFromAscii( szServiceName2_PrinterServer ) )
+ }
+ return pRet;
+}
+}
+
+
+
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
new file mode 100644
index 000000000000..449878844764
--- /dev/null
+++ b/toolkit/source/helper/servicenames.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: servicenames.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+#include <toolkit/helper/servicenames.hxx>
+
+const sal_Char __FAR_DATA szServiceName_Toolkit[] = "stardiv.vcl.VclToolkit", szServiceName2_Toolkit[] = "com.sun.star.awt.Toolkit";
+const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", szServiceName2_PopupMenu[] = "com.sun.star.awt.PopupMenu";
+const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
+const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
+const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
+const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
+const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
+const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlEdit[] = "stardiv.vcl.control.Edit", szServiceName2_UnoControlEdit[] = "com.sun.star.awt.UnoControlEdit";
+const sal_Char __FAR_DATA szServiceName_UnoControlEditModel[] = "stardiv.vcl.controlmodel.Edit", szServiceName2_UnoControlEditModel[] = "com.sun.star.awt.UnoControlEditModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFileControl[] = "stardiv.vcl.control.FileControl", szServiceName2_UnoControlFileControl[] = "com.sun.star.awt.UnoControlFileControl";
+const sal_Char __FAR_DATA szServiceName_UnoControlFileControlModel[] = "stardiv.vcl.controlmodel.FileControl", szServiceName2_UnoControlFileControlModel[] = "com.sun.star.awt.UnoControlFileControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlButton[] = "stardiv.vcl.control.Button", szServiceName2_UnoControlButton[] = "com.sun.star.awt.UnoControlButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlButtonModel[] = "stardiv.vcl.controlmodel.Button", szServiceName2_UnoControlButtonModel[] = "com.sun.star.awt.UnoControlButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageButton[] = "stardiv.vcl.control.ImageButton", szServiceName2_UnoControlImageButton[] = "com.sun.star.awt.UnoControlImageButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageButtonModel[] = "stardiv.vcl.controlmodel.ImageButton", szServiceName2_UnoControlImageButtonModel[] = "com.sun.star.awt.UnoControlImageButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageControl[] = "stardiv.vcl.control.ImageControl", szServiceName2_UnoControlImageControl[] = "com.sun.star.awt.UnoControlImageControl";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageControlModel[] = "stardiv.vcl.controlmodel.ImageControl", szServiceName2_UnoControlImageControlModel[] = "com.sun.star.awt.UnoControlImageControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlRadioButton[] = "stardiv.vcl.control.RadioButton", szServiceName2_UnoControlRadioButton[] = "com.sun.star.awt.UnoControlRadioButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlRadioButtonModel[] = "stardiv.vcl.controlmodel.RadioButton", szServiceName2_UnoControlRadioButtonModel[] = "com.sun.star.awt.UnoControlRadioButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlCheckBox[] = "stardiv.vcl.control.CheckBox", szServiceName2_UnoControlCheckBox[] = "com.sun.star.awt.UnoControlCheckBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlCheckBoxModel[] = "stardiv.vcl.controlmodel.CheckBox", szServiceName2_UnoControlCheckBoxModel[] = "com.sun.star.awt.UnoControlCheckBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlListBox[] = "stardiv.vcl.control.ListBox", szServiceName2_UnoControlListBox[] = "com.sun.star.awt.UnoControlListBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlListBoxModel[] = "stardiv.vcl.controlmodel.ListBox", szServiceName2_UnoControlListBoxModel[] = "com.sun.star.awt.UnoControlListBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlComboBox[] = "stardiv.vcl.control.ComboBox", szServiceName2_UnoControlComboBox[] = "com.sun.star.awt.UnoControlComboBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlComboBoxModel[] = "stardiv.vcl.controlmodel.ComboBox", szServiceName2_UnoControlComboBoxModel[] = "com.sun.star.awt.UnoControlComboBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedText[] = "stardiv.vcl.control.FixedText", szServiceName2_UnoControlFixedText[] = "com.sun.star.awt.UnoControlFixedText";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedTextModel[] = "stardiv.vcl.controlmodel.FixedText", szServiceName2_UnoControlFixedTextModel[] = "com.sun.star.awt.UnoControlFixedTextModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlGroupBox[] = "stardiv.vcl.control.GroupBox", szServiceName2_UnoControlGroupBox[] = "com.sun.star.awt.UnoControlGroupBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlGroupBoxModel[] = "stardiv.vcl.controlmodel.GroupBox", szServiceName2_UnoControlGroupBoxModel[] = "com.sun.star.awt.UnoControlGroupBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlDateField[] = "stardiv.vcl.control.DateField", szServiceName2_UnoControlDateField[] = "com.sun.star.awt.UnoControlDateField";
+const sal_Char __FAR_DATA szServiceName_UnoControlDateFieldModel[] = "stardiv.vcl.controlmodel.DateField", szServiceName2_UnoControlDateFieldModel[] = "com.sun.star.awt.UnoControlDateFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTimeField[] = "stardiv.vcl.control.TimeField", szServiceName2_UnoControlTimeField[] = "com.sun.star.awt.UnoControlTimeField";
+const sal_Char __FAR_DATA szServiceName_UnoControlTimeFieldModel[] = "stardiv.vcl.controlmodel.TimeField", szServiceName2_UnoControlTimeFieldModel[] = "com.sun.star.awt.UnoControlTimeFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlNumericField[] = "stardiv.vcl.control.NumericField", szServiceName2_UnoControlNumericField[] = "com.sun.star.awt.UnoControlNumericField";
+const sal_Char __FAR_DATA szServiceName_UnoControlNumericFieldModel[] = "stardiv.vcl.controlmodel.NumericField", szServiceName2_UnoControlNumericFieldModel[] = "com.sun.star.awt.UnoControlNumericFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyField[] = "stardiv.vcl.control.CurrencyField", szServiceName2_UnoControlCurrencyField[] = "com.sun.star.awt.UnoControlCurrencyField";
+const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyFieldModel[] = "stardiv.vcl.controlmodel.CurrencyField", szServiceName2_UnoControlCurrencyFieldModel[] = "com.sun.star.awt.UnoControlCurrencyFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlPatternField[] = "stardiv.vcl.control.PatternField", szServiceName2_UnoControlPatternField[] = "com.sun.star.awt.UnoControlPatternField";
+const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[] = "stardiv.vcl.controlmodel.PatternField", szServiceName2_UnoControlPatternFieldModel[] = "com.sun.star.awt.UnoControlPatternFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[] = "stardiv.vcl.control.FormattedField", szServiceName2_UnoControlFormattedField[] = "com.sun.star.awt.UnoControlFormattedField";
+const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[] = "stardiv.vcl.controlmodel.FormattedField", szServiceName2_UnoControlFormattedFieldModel[] = "com.sun.star.awt.UnoControlFormattedFieldModel";
+const sal_Char __FAR_DATA szServiceName_MVCIntrospection[] = "stardiv.vcl.MVCIntrospection", szServiceName2_MVCIntrospection[] = "com.sun.star.awt.MVCIntrospection";
+const sal_Char __FAR_DATA szServiceName_ImageProducer[] = "stardiv.vcl.ImageProducer", szServiceName2_ImageProducer[] = "com.sun.star.awt.ImageProducer";
+const sal_Char __FAR_DATA szServiceName_PrinterServer[] = "stardiv.vcl.PrinterServer", szServiceName2_PrinterServer[] = "com.sun.star.awt.PrinterServer";
+
+
diff --git a/toolkit/source/helper/unomemorystream.cxx b/toolkit/source/helper/unomemorystream.cxx
new file mode 100644
index 000000000000..5550ca2fc03c
--- /dev/null
+++ b/toolkit/source/helper/unomemorystream.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * $RCSfile: unomemorystream.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <toolkit/helper/unomemorystream.hxx>
+
+// ----------------------------------------------------
+// class UnoMemoryStream
+// ----------------------------------------------------
+UnoMemoryStream::UnoMemoryStream( sal_uInt32 nInitSize, sal_uInt32 nResize )
+ : SvMemoryStream( nInitSize, nResize )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoMemoryStream::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::io::XInputStream*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+
+// ::com::sun::star::io::XInputStream
+sal_Int32 UnoMemoryStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nRead = available();
+ if ( nRead > nBytesToRead )
+ nRead = nBytesToRead;
+
+ rData = ::com::sun::star::uno::Sequence< sal_Int8 >( nRead );
+ Read( rData.getArray(), nRead );
+
+ return nRead;
+}
+
+sal_Int32 UnoMemoryStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nAvailable = available();
+ if( nAvailable )
+ {
+ return readBytes( rData, min( nMaxBytesToRead , nAvailable ) );
+ }
+ else
+ {
+ // Not the most effective method, but it sticks to the specification
+ return readBytes( rData, 1 );
+ }
+}
+
+void UnoMemoryStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ SeekRel( nBytesToSkip );
+}
+
+sal_Int32 UnoMemoryStream::available() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nPos = Tell();
+ sal_uInt32 nEnd = Seek( STREAM_SEEK_TO_END );
+ Seek( nPos );
+ return nEnd - nPos;
+}
+
+void UnoMemoryStream::closeInput() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ // nothing to do
+}
+
+
+
+
+
diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx
new file mode 100644
index 000000000000..733b9578cacc
--- /dev/null
+++ b/toolkit/source/helper/unopropertyarrayhelper.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: unopropertyarrayhelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+
+// ----------------------------------------------------
+// class UnoPropertyArrayHelper
+// ----------------------------------------------------
+
+UnoPropertyArrayHelper::UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs )
+{
+ sal_Int32 nIDs = rIDs.getLength();
+ const sal_Int32* pIDs = rIDs.getConstArray();
+ for ( sal_Int32 n = 0; n < nIDs; n++ )
+ maIDs.Insert( pIDs[n], (void*)1L );
+}
+
+sal_Bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const
+{
+ if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ nPropId = BASEPROPERTY_FONTDESCRIPTOR;
+
+ return maIDs.Get( nPropId ) ? sal_True : sal_False;
+}
+
+// ::cppu::IPropertyArrayHelper
+sal_Bool UnoPropertyArrayHelper::fillPropertyMembersByHandle( ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nPropId )
+{
+ sal_Bool bValid = ImplHasProperty( nPropId );
+ if ( bValid )
+ {
+ if ( pPropName )
+ *pPropName = GetPropertyName( nPropId );
+ if ( pAttributes )
+ *pAttributes = GetPropertyAttribs( nPropId );
+ }
+ return bValid;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > UnoPropertyArrayHelper::getProperties()
+{
+ // Sortiert nach Namen...
+
+ Table aSortedPropsIds;
+ sal_uInt32 nProps = maIDs.Count();
+ for ( sal_uInt32 s = 0; s < nProps; s++ )
+ {
+ sal_uInt32 nId = maIDs.GetObjectKey( s );
+ aSortedPropsIds.Insert( 1+GetPropertyOrderNr( nId ), (void*)(sal_uInt32)nId );
+
+ if ( nId == BASEPROPERTY_FONTDESCRIPTOR )
+ {
+ // Einzelproperties...
+ for ( sal_uInt32 i = BASEPROPERTY_FONTDESCRIPTORPART_START; i <= BASEPROPERTY_FONTDESCRIPTORPART_END; i++ )
+ aSortedPropsIds.Insert( 1+GetPropertyOrderNr( i ), (void*)(sal_uInt32)i );
+ }
+ }
+
+ nProps = aSortedPropsIds.Count(); // koennen jetzt mehr sein
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps( nProps );
+ ::com::sun::star::beans::Property* pProps = aProps.getArray();
+
+ for ( sal_uInt32 n = 0; n < nProps; n++ )
+ {
+ sal_uInt16 nId = (sal_uInt16)(sal_uInt32)aSortedPropsIds.GetObject( n );
+ pProps[n].Name = GetPropertyName( nId );
+ pProps[n].Handle = nId;
+ pProps[n].Type = *GetPropertyType( nId );
+ pProps[n].Attributes = GetPropertyAttribs( nId );
+ }
+
+ return aProps;
+}
+
+::com::sun::star::beans::Property UnoPropertyArrayHelper::getPropertyByName(const ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException)
+{
+ ::com::sun::star::beans::Property aProp;
+ sal_uInt16 nId = GetPropertyId( rPropertyName );
+ if ( ImplHasProperty( nId ) )
+ {
+ aProp.Name = rPropertyName;
+ aProp.Handle = -1;
+ aProp.Type = *GetPropertyType( nId );
+ aProp.Attributes = GetPropertyAttribs( nId );
+ }
+
+ return aProp;
+}
+
+sal_Bool UnoPropertyArrayHelper::hasPropertyByName(const ::rtl::OUString& rPropertyName)
+{
+ return ImplHasProperty( GetPropertyId( rPropertyName ) );
+}
+
+sal_Int32 UnoPropertyArrayHelper::getHandleByName( const ::rtl::OUString & rPropertyName )
+{
+ sal_Int32 nId = (sal_Int32 ) GetPropertyId( rPropertyName );
+ return nId ? nId : (-1);
+}
+
+sal_Int32 UnoPropertyArrayHelper::fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames )
+{
+ const ::rtl::OUString* pNames = rPropNames.getConstArray();
+ sal_Int32 nValues = rPropNames.getLength();
+ sal_Int32 nValidHandles = 0;
+
+ for ( sal_Int32 n = 0; n < nValues; n++ )
+ {
+ sal_uInt16 nPropId = GetPropertyId( pNames[n] );
+ if ( nPropId && ImplHasProperty( nPropId ) )
+ {
+ pHandles[n] = nPropId;
+ nValidHandles++;
+ }
+ else
+ {
+ pHandles[n] = -1;
+ }
+ }
+ return nValidHandles;
+}
+
+
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
new file mode 100644
index 000000000000..de1edb563922
--- /dev/null
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * $RCSfile: unowrapper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_
+#include <com/sun/star/awt/WindowEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_
+#include <com/sun/star/awt/KeyEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
+#include <com/sun/star/awt/KeyModifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
+#include <com/sun/star/awt/MouseEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
+#include <com/sun/star/awt/MouseButton.hpp>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#include <toolkit/helper/unowrapper.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/awt/vclxcontainer.hxx>
+#include <toolkit/awt/vclxtopwindow.hxx>
+#include <toolkit/awt/vclxgraphics.hxx>
+
+#include <vcl/svapp.hxx>
+
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class UnoWrapper
+// ----------------------------------------------------
+
+// Mit Out-Parameter besser als Rueckgabewert, wegen Ref-Objekt...
+
+void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pWindow )
+{
+ Point aPos = pWindow->GetPosPixel();
+ Size aSz = pWindow->GetSizePixel();
+
+ rEvent.X = aPos.X();
+ rEvent.Y = aPos.Y();
+
+ rEvent.Width = aSz.Width();
+ rEvent.Height = aSz.Height();
+
+ pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset );
+}
+
+void ImplInitKeyEvent( ::com::sun::star::awt::KeyEvent& rEvent, const KeyEvent& rEvt )
+{
+ rEvent.Modifiers = 0;
+ if ( rEvt.GetKeyCode().IsShift() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
+ if ( rEvt.GetKeyCode().IsMod1() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
+ if ( rEvt.GetKeyCode().IsMod2() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
+
+ rEvent.KeyCode = rEvt.GetKeyCode().GetCode();
+ rEvent.KeyChar = (unsigned char)rEvt.GetCharCode();
+ rEvent.KeyFunc = rEvt.GetKeyCode().GetFunction();
+}
+
+void ImplInitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent, const MouseEvent& rEvt )
+{
+ rEvent.Modifiers = 0;
+ if ( rEvt.IsShift() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
+ if ( rEvt.IsMod1() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
+ if ( rEvt.IsMod2() )
+ rEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
+
+ rEvent.Buttons = 0;
+ if ( rEvt.IsLeft() )
+ rEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT;
+ if ( rEvt.IsRight() )
+ rEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT;
+ if ( rEvt.IsMiddle() )
+ rEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE;
+
+ rEvent.X = rEvt.GetPosPixel().X();
+ rEvent.Y = rEvt.GetPosPixel().Y();
+ rEvent.ClickCount = rEvt.GetClicks();
+ rEvent.PopupTrigger = sal_False;
+}
+
+// ----------------------------------------------------
+// class UnoWrapper
+// ----------------------------------------------------
+
+UnoWrapper::UnoWrapper()
+{
+}
+
+void UnoWrapper::Destroy()
+{
+ delete this;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> UnoWrapper::GetVCLToolkit()
+{
+ if ( !mxToolkit.is() )
+ mxToolkit = VCLUnoHelper::CreateToolkit();
+ return mxToolkit.get();
+}
+
+void UnoWrapper::RegisterUnoServices()
+{
+ // Sollte nicht megr nötig sein!
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> UnoWrapper::GetWindowInterface( Window* pWindow, BOOL bCreate )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
+ if ( !xPeer.is() && bCreate )
+ {
+ ::com::sun::star::awt::XWindowPeer* pPeer = NULL;
+ // Basis-Component erzeugen...
+ WindowType eType = pWindow->GetType();
+ if ( ( eType == WINDOW_TABPAGE ) ||
+ ( eType == WINDOW_WINDOW ) ||
+ ( eType == WINDOW_FLOATINGWINDOW ) )
+ {
+ pPeer = new VCLXContainer;
+ }
+ else if ( ( eType == WINDOW_SYSWINDOW ) || ( eType == WINDOW_WORKWINDOW ) || eType == WINDOW_DOCKINGWINDOW )
+ {
+ pPeer = new VCLXTopWindow;
+ }
+ else if ( ( eType == WINDOW_DIALOG ) || ( eType == WINDOW_MODALDIALOG ) || ( eType == WINDOW_MODELESSDIALOG ) )
+ {
+ pPeer = new VCLXDialog;
+ }
+ else
+ {
+ pPeer = new VCLXWindow;
+ }
+ xPeer = pPeer;
+ SetWindowInterface( pWindow, xPeer );
+ }
+ return xPeer;
+}
+
+void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( xIFace );
+
+ DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
+ if ( pVCLXWindow )
+ {
+ pVCLXWindow->SetWindow( pWindow );
+ pWindow->SetWindowPeer( xIFace, pVCLXWindow );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> UnoWrapper::CreateGraphics( OutputDevice* pOutDev )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> xGrf;
+ VCLXGraphics* pGrf = new VCLXGraphics;
+ xGrf = pGrf;
+ pGrf->Init( pOutDev );
+ return xGrf;
+}
+
+void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev )
+{
+ List* pLst = pOutDev->GetUnoGraphicsList();
+ if ( pLst )
+ {
+ for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
+ {
+ VCLXGraphics* pGrf = (VCLXGraphics*)pLst->GetObject( n );
+ pGrf->SetOutputDevice( NULL );
+ }
+ }
+
+}
+
+// MT: Wurde im Window-CTOR gerufen, damit Container-Listener
+// vom Parent reagieren, aber hat sowieso nicht richtig funktioniert,
+// weil im Window-CTOR das Interface noch nicht da ist!
+// => Nur Listener rufen, wenn ueber das ::com::sun::star::awt::Toolkit erzeugt
+
+/*
+void ImplSmartWindowCreated( Window* pNewWindow )
+{
+ UNOWindowData* pParentUNOData = pNewWindow->GetParent() ?
+ pNewWindow->GetParent()->GetUNOData() : NULL;
+
+ if ( pParentUNOData && pParentUNOData->GetListeners( EL_CONTAINER ) )
+ {
+ UNOWindowData* pUNOData = pNewWindow->GetUNOData();
+ if ( !pUNOData )
+ pUNOData = ImplSmartCreateUNOData( pNewWindow );
+
+ ::com::sun::star::awt::VclContainerEvent aEvent;
+ aEvent.Source = (UsrObject*)pParentUNOData->GetWindowPeer();
+ aEvent.Id = VCLCOMPONENT_ADDED;
+ aEvent.Child = (UsrObject*)pUNOData->GetWindowPeer();
+
+ EventList* pLst = pParentUNOData->GetListeners( EL_CONTAINER );
+ for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * pRef = pLst->GetObject( n );
+ ((::com::sun::star::awt::XVclContainerListener*)(::com::sun::star::lang::XEventListener*)*pRef)->windowAdded( aEvent );
+ }
+ }
+}
+*/
+
+sal_Bool lcl_ImplIsParent( Window* pParentWindow, Window* pPossibleChild )
+{
+ Window* pWindow = pPossibleChild;
+ while ( pWindow && ( pWindow != pParentWindow ) )
+ pWindow = pWindow->GetParent();
+
+ return pWindow ? sal_True : sal_False;
+}
+
+void UnoWrapper::WindowDestroyed( Window* pWindow )
+{
+ // ggf. existieren noch von ::com::sun::star::loader::Java erzeugte Childs, die sonst erst
+ // im Garbage-Collector zerstoert werden...
+ Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ Window* pNextChild = pChild->GetWindow( WINDOW_NEXT );
+
+ Window* pClient = pChild->GetWindow( WINDOW_CLIENT );
+ if ( pClient->GetWindowPeer() )
+ pClient->GetWindowPeer()->dispose();
+
+ pChild = pNextChild;
+ }
+
+ // ::com::sun::star::chaos::System-Windows suchen...
+ Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
+ pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP );
+ while ( pOverlap )
+ {
+ Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
+ Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT );
+
+ if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
+ pClient->GetWindowPeer()->dispose();
+
+ pOverlap = pNextOverlap;
+ }
+
+ Window* pParent = pWindow->GetParent();
+ if ( pParent && pParent->GetWindowPeer() && pParent->GetWindowPeer()->GetContainerListeners().getLength() )
+ {
+ ::com::sun::star::awt::VclContainerEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pParent->GetWindowPeer();
+ aEvent.Child = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ pParent->GetWindowPeer()->GetContainerListeners().windowRemoved( aEvent );
+ }
+
+ if ( pWindow && pWindow->GetWindowPeer() )
+ {
+ pWindow->GetWindowPeer()->SetWindow( NULL );
+ pWindow->SetWindowPeer( NULL, NULL );
+ }
+}
+
+void UnoWrapper::WindowEvent_Move( Window* pWindow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetWindowListeners().getLength() )
+ {
+ ::com::sun::star::awt::WindowEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitWindowEvent( aEvent, pWindow );
+ pWindow->GetWindowPeer()->GetWindowListeners().windowMoved( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Resize( Window* pWindow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetWindowListeners().getLength() )
+ {
+ ::com::sun::star::awt::WindowEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitWindowEvent( aEvent, pWindow );
+ pWindow->GetWindowPeer()->GetWindowListeners().windowResized( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Show( Window* pWindow, sal_Bool bShow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetWindowListeners().getLength() )
+ {
+ ::com::sun::star::awt::WindowEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitWindowEvent( aEvent, pWindow );
+
+ if ( bShow )
+ pWindow->GetWindowPeer()->GetWindowListeners().windowShown( aEvent );
+ else
+ pWindow->GetWindowPeer()->GetWindowListeners().windowHidden( aEvent );
+ }
+
+ // Bei TopWindows hat das die Bedeutung von Opened, Closed...
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+
+ if ( bShow )
+ pWindow->GetWindowPeer()->GetTopWindowListeners().windowOpened( aEvent );
+ else
+ pWindow->GetWindowPeer()->GetTopWindowListeners().windowClosed( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Activate( Window* pWindow, sal_Bool bActivated )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+
+ if ( bActivated )
+ pWindow->GetWindowPeer()->GetTopWindowListeners().windowActivated( aEvent );
+ else
+ pWindow->GetWindowPeer()->GetTopWindowListeners().windowDeactivated( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_MouseButtonDown( Window* pWindow, const MouseEvent& rEvt )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetMouseListeners().getLength() )
+ {
+ ::com::sun::star::awt::MouseEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitMouseEvent( aEvent, rEvt );
+ pWindow->GetWindowPeer()->GetMouseListeners().mousePressed( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_MouseButtonUp( Window* pWindow, const MouseEvent& rEvt )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetMouseListeners().getLength() )
+ {
+ ::com::sun::star::awt::MouseEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitMouseEvent( aEvent, rEvt );
+ pWindow->GetWindowPeer()->GetMouseListeners().mouseReleased( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Command( Window* pWindow, const CommandEvent& rEvt )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetMouseListeners().getLength() &&
+ rEvt.IsMouseEvent() && ( rEvt.GetCommand() == COMMAND_CONTEXTMENU ) )
+ {
+ // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
+ MouseEvent aMEvt( rEvt.GetMousePosPixel(), 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
+ ::com::sun::star::awt::MouseEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitMouseEvent( aEvent, aMEvt );
+ aEvent.PopupTrigger = sal_True;
+ pWindow->GetWindowPeer()->GetMouseListeners().mousePressed( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_MouseMove( Window* pWindow, const MouseEvent& rEvt )
+{
+ if ( pWindow->GetWindowPeer() )
+ {
+ if ( pWindow->GetWindowPeer()->GetMouseListeners().getLength() && ( rEvt.IsEnterWindow() || rEvt.IsLeaveWindow() ) )
+ {
+ ::com::sun::star::awt::MouseEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitMouseEvent( aEvent, rEvt );
+
+ if ( rEvt.IsEnterWindow() )
+ pWindow->GetWindowPeer()->GetMouseListeners().mouseEntered( aEvent );
+ else
+ pWindow->GetWindowPeer()->GetMouseListeners().mouseExited( aEvent );
+ }
+
+ if ( pWindow->GetWindowPeer()->GetMouseMotionListeners().getLength() && !rEvt.IsEnterWindow() && !rEvt.IsLeaveWindow() )
+ {
+ ::com::sun::star::awt::MouseEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitMouseEvent( aEvent, rEvt );
+
+ if ( rEvt.GetMode() & MOUSE_SIMPLEMOVE )
+ pWindow->GetWindowPeer()->GetMouseMotionListeners().mouseMoved( aEvent );
+ else
+ pWindow->GetWindowPeer()->GetMouseMotionListeners().mouseDragged( aEvent );
+ }
+ }
+}
+
+void UnoWrapper::WindowEvent_KeyInput( Window* pWindow, const KeyEvent& rEvt )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetKeyListeners().getLength() )
+ {
+ ::com::sun::star::awt::KeyEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitKeyEvent( aEvent, rEvt );
+ pWindow->GetWindowPeer()->GetKeyListeners().keyPressed( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_KeyUp( Window* pWindow, const KeyEvent& rEvt )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetKeyListeners().getLength() )
+ {
+ ::com::sun::star::awt::KeyEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ ImplInitKeyEvent( aEvent, rEvt );
+ pWindow->GetWindowPeer()->GetKeyListeners().keyReleased( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_GetFocus( Window* pWindow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetFocusListeners().getLength() )
+ {
+ ::com::sun::star::awt::FocusEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ aEvent.FocusFlags = pWindow->GetGetFocusFlags();
+ aEvent.Temporary = sal_False;
+ pWindow->GetWindowPeer()->GetFocusListeners().focusGained( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_LoseFocus( Window* pWindow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetFocusListeners().getLength() )
+ {
+ ::com::sun::star::awt::FocusEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ aEvent.FocusFlags = pWindow->GetGetFocusFlags();
+ aEvent.Temporary = sal_False;
+
+ Window* pNext = Application::GetFocusWindow();
+ if ( pNext )
+ {
+ // Bei zusammengesetzten Controls interessiert sich keiner fuer das Innenleben:
+ Window* pNextC = pNext;
+ while ( pNextC && !pNextC->IsCompoundControl() )
+ pNextC = pNextC->GetParent();
+ if ( pNextC )
+ pNext = pNextC;
+
+ pNext->GetComponentInterface( sal_True );
+ aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer();
+ }
+ pWindow->GetWindowPeer()->GetFocusListeners().focusLost( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Paint( Window* pWindow, const Rectangle& rRect )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetPaintListeners().getLength() )
+ {
+ ::com::sun::star::awt::PaintEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ aEvent.UpdateRect = AWTRectangle( rRect );
+ aEvent.Count = 0;
+ pWindow->GetWindowPeer()->GetPaintListeners().windowPaint( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Close( Window* pWindow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ pWindow->GetWindowPeer()->GetTopWindowListeners().windowClosing( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Minimize( Window* pWindow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ pWindow->GetWindowPeer()->GetTopWindowListeners().windowMinimized( aEvent );
+ }
+}
+
+void UnoWrapper::WindowEvent_Normalize( Window* pWindow )
+{
+ if ( pWindow->GetWindowPeer() && pWindow->GetWindowPeer()->GetTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)pWindow->GetWindowPeer();
+ pWindow->GetWindowPeer()->GetTopWindowListeners().windowNormalized( aEvent );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > UnoWrapper::getNewUnoServiceManager()
+{
+ return ::utl::getProcessServiceFactory();
+}
+
+
+
+
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
new file mode 100644
index 000000000000..9e9108918be1
--- /dev/null
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -0,0 +1,455 @@
+/*************************************************************************
+ *
+ * $RCSfile: vclunohelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define SMART_UNO_GENERATION // Fuer Methoden an der FontMetric
+
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/window.hxx>
+
+#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_
+#include <com/sun/star/awt/XBitmap.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_
+#include <com/sun/star/awt/XDevice.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XPOINTER_HPP_
+#include <com/sun/star/awt/XPointer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_SIMPLEFONTMETRIC_HPP_
+#include <com/sun/star/awt/SimpleFontMetric.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_FONTWEIGHT_HPP_
+#include <com/sun/star/awt/FontWeight.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_FONTWIDTH_HPP_
+#include <com/sun/star/awt/FontWidth.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#pragma hdrstop
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/awt/vclxbitmap.hxx>
+#include <toolkit/awt/vclxregion.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxgraphics.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+
+#include <unotools/processfactory.hxx>
+
+// ----------------------------------------------------
+// class VCLUnoHelper
+// ----------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ExtToolkit" ) );
+ if ( !xI.is() )
+ xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> xToolkit;
+ if ( xI.is() )
+ xToolkit = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>( xI, ::com::sun::star::uno::UNO_QUERY );
+
+ return xToolkit;
+}
+
+BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap )
+{
+ BitmapEx aBmp;
+
+ VCLXBitmap* pVCLBitmap = VCLXBitmap::GetImplementation( rxBitmap );
+ if ( pVCLBitmap )
+ aBmp = pVCLBitmap->GetBitmap();
+ else
+ {
+ Bitmap aDIB, aMask;
+ {
+ ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getDIB();
+ SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
+ aMem >> aDIB;
+ }
+ {
+ ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getMaskDIB();
+ SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
+ aMem >> aMask;
+ }
+ aBmp = BitmapEx( aDIB, aMask );
+ }
+ return aBmp;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> VCLUnoHelper::CreateBitmap( const BitmapEx& rBitmap )
+{
+ VCLXBitmap* pBmp = new VCLXBitmap;
+ pBmp->SetBitmap( rBitmap );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> xBmp = pBmp;
+ return xBmp;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )
+{
+ Region aRegion;
+ VCLXRegion* pVCLRegion = VCLXRegion::GetImplementation( rxRegion );
+ if ( pVCLRegion )
+ aRegion = pVCLRegion->GetRegion();
+ else
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects = rxRegion->getRectangles();
+ sal_Int32 nRects = aRects.getLength();
+ for ( sal_Int32 n = 0; n < nRects; n++ )
+ aRegion.Union( VCLRectangle( aRects.getArray()[n] ) );
+ }
+ return aRegion;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> VCLUnoHelper::GetInterface( Window* pWindow )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetComponentInterface();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> xWin( xPeer, ::com::sun::star::uno::UNO_QUERY );
+ return xWin;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> VCLUnoHelper::CreatePointer()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> xPointer = new VCLXPointer;
+ return xPointer;
+}
+
+OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice )
+{
+ OutputDevice* pOutDev = NULL;
+ VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice );
+ if ( pDev )
+ pOutDev = pDev->GetOutputDevice();
+ return pOutDev;
+}
+
+OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics )
+{
+ OutputDevice* pOutDev = NULL;
+ VCLXGraphics* pGrf = VCLXGraphics::GetImplementation( rxGraphics );
+ if ( pGrf )
+ pOutDev = pGrf->GetOutputDevice();
+ return pOutDev;
+}
+
+Polygon VCLUnoHelper::CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY )
+{
+ sal_uInt32 nLen = DataX.getLength();
+ const sal_Int32* pDataX = DataX.getConstArray();
+ const sal_Int32* pDataY = DataY.getConstArray();
+ Polygon aPoly( (sal_uInt16) nLen );
+ for ( sal_uInt16 n = 0; n < nLen; n++ )
+ {
+ Point aPnt;
+ aPnt.X() = pDataX[n];
+ aPnt.Y() = pDataY[n];
+ aPoly[n] = aPnt;
+ }
+ return aPoly;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> VCLUnoHelper::CreateControlContainer( Window* pWindow )
+{
+ UnoControlContainer* pContainer = new UnoControlContainer( pWindow->GetComponentInterface( sal_True ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer;
+
+ UnoControlModel* pContainerModel = new UnoControlContainerModel;
+ pContainer->setModel( (::com::sun::star::awt::XControlModel*)pContainerModel );
+
+ return x;
+}
+
+float VCLUnoHelper::ConvertFontWidth( FontWidth eWidth )
+{
+ if( eWidth == WIDTH_DONTKNOW )
+ return ::com::sun::star::awt::FontWidth::DONTKNOW;
+ else if( eWidth == WIDTH_ULTRA_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::ULTRACONDENSED;
+ else if( eWidth == WIDTH_EXTRA_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::EXTRACONDENSED;
+ else if( eWidth == WIDTH_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::CONDENSED;
+ else if( eWidth == WIDTH_SEMI_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::SEMICONDENSED;
+ else if( eWidth == WIDTH_NORMAL )
+ return ::com::sun::star::awt::FontWidth::NORMAL;
+ else if( eWidth == WIDTH_SEMI_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::SEMIEXPANDED;
+ else if( eWidth == WIDTH_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::EXPANDED;
+ else if( eWidth == WIDTH_EXTRA_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::EXTRAEXPANDED;
+ else if( eWidth == WIDTH_ULTRA_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::ULTRAEXPANDED;
+
+ DBG_ERROR( "Unknown FontWidth" );
+ return ::com::sun::star::awt::FontWidth::DONTKNOW;
+}
+
+FontWidth VCLUnoHelper::ConvertFontWidth( float f )
+{
+ if( f <= ::com::sun::star::awt::FontWidth::DONTKNOW )
+ return WIDTH_DONTKNOW;
+ else if( f <= ::com::sun::star::awt::FontWidth::ULTRACONDENSED )
+ return WIDTH_ULTRA_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXTRACONDENSED )
+ return WIDTH_EXTRA_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::CONDENSED )
+ return WIDTH_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::SEMICONDENSED )
+ return WIDTH_SEMI_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::NORMAL )
+ return WIDTH_NORMAL;
+ else if( f <= ::com::sun::star::awt::FontWidth::SEMIEXPANDED )
+ return WIDTH_SEMI_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXPANDED )
+ return WIDTH_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXTRAEXPANDED )
+ return WIDTH_EXTRA_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::ULTRAEXPANDED )
+ return WIDTH_ULTRA_EXPANDED;
+
+ DBG_ERROR( "Unknown FontWidth" );
+ return WIDTH_DONTKNOW;
+}
+
+float VCLUnoHelper::ConvertFontWeight( FontWeight eWeight )
+{
+ if( eWeight == WEIGHT_DONTKNOW )
+ return ::com::sun::star::awt::FontWeight::DONTKNOW;
+ else if( eWeight == WEIGHT_THIN )
+ return ::com::sun::star::awt::FontWeight::THIN;
+ else if( eWeight == WEIGHT_ULTRALIGHT )
+ return ::com::sun::star::awt::FontWeight::ULTRALIGHT;
+ else if( eWeight == WEIGHT_LIGHT )
+ return ::com::sun::star::awt::FontWeight::LIGHT;
+ else if( eWeight == WEIGHT_SEMILIGHT )
+ return ::com::sun::star::awt::FontWeight::SEMILIGHT;
+ else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) )
+ return ::com::sun::star::awt::FontWeight::NORMAL;
+ else if( eWeight == WEIGHT_SEMIBOLD )
+ return ::com::sun::star::awt::FontWeight::SEMIBOLD;
+ else if( eWeight == WEIGHT_BOLD )
+ return ::com::sun::star::awt::FontWeight::BOLD;
+ else if( eWeight == WEIGHT_ULTRABOLD )
+ return ::com::sun::star::awt::FontWeight::ULTRABOLD;
+ else if( eWeight == WEIGHT_BLACK )
+ return ::com::sun::star::awt::FontWeight::BLACK;
+
+ DBG_ERROR( "Unknown FontWeigth" );
+ return ::com::sun::star::awt::FontWeight::DONTKNOW;
+}
+
+FontWeight VCLUnoHelper::ConvertFontWeight( float f )
+{
+ if( f <= ::com::sun::star::awt::FontWeight::DONTKNOW )
+ return WEIGHT_DONTKNOW;
+ else if( f <= ::com::sun::star::awt::FontWeight::THIN )
+ return WEIGHT_THIN;
+ else if( f <= ::com::sun::star::awt::FontWeight::ULTRALIGHT )
+ return WEIGHT_ULTRALIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::LIGHT )
+ return WEIGHT_LIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::SEMILIGHT )
+ return WEIGHT_SEMILIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::NORMAL )
+ return WEIGHT_NORMAL;
+ else if( f <= ::com::sun::star::awt::FontWeight::SEMIBOLD )
+ return WEIGHT_SEMIBOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::BOLD )
+ return WEIGHT_BOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::ULTRABOLD )
+ return WEIGHT_ULTRABOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::BLACK )
+ return WEIGHT_BLACK;
+
+ DBG_ERROR( "Unknown FontWeigth" );
+ return WEIGHT_DONTKNOW;
+}
+
+
+::com::sun::star::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const Font& rFont )
+{
+ ::com::sun::star::awt::FontDescriptor aFD;
+ aFD.Name = rFont.GetName();
+ aFD.StyleName = rFont.GetStyleName();
+ aFD.Height = rFont.GetSize().Height();
+ aFD.Width = rFont.GetSize().Width();
+ aFD.Family = rFont.GetFamily();
+ aFD.CharSet = rFont.GetCharSet();
+ aFD.Pitch = rFont.GetPitch();
+ aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() );
+ aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() );
+ aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic();
+ aFD.Underline = rFont.GetUnderline();
+ aFD.Strikeout = rFont.GetStrikeout();
+ aFD.Orientation = rFont.GetOrientation();
+ aFD.Kerning = rFont.IsKerning();
+ aFD.WordLineMode = rFont.IsWordLineMode();
+ aFD.Type = 0; // ??? => Nur an Metric...
+ return aFD;
+}
+
+Font VCLUnoHelper::CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont )
+{
+ Font aFont( rInitFont );
+ if ( rDescr.Name.len() )
+ aFont.SetName( rDescr.Name );
+ if ( rDescr.StyleName.len() )
+ aFont.SetStyleName( rDescr.StyleName );
+ if ( rDescr.Height )
+ aFont.SetSize( Size( rDescr.Width, rDescr.Height ) );
+ if ( (FontFamily)rDescr.Family != FAMILY_DONTKNOW )
+ aFont.SetFamily( (FontFamily)rDescr.Family );
+ if ( (CharSet)rDescr.CharSet != RTL_TEXTENCODING_DONTKNOW )
+ aFont.SetCharSet( (CharSet)rDescr.CharSet );
+ if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW )
+ aFont.SetPitch( (FontPitch)rDescr.Pitch );
+ if ( rDescr.CharacterWidth )
+ aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) );
+ if ( rDescr.Weight )
+ aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) );
+ if ( (FontItalic)rDescr.Slant != ITALIC_DONTKNOW )
+ aFont.SetItalic( (FontItalic)rDescr.Slant );
+ if ( (FontUnderline)rDescr.Underline != UNDERLINE_DONTKNOW )
+ aFont.SetUnderline( (FontUnderline)rDescr.Underline );
+ if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW )
+ aFont.SetStrikeout( (FontStrikeout)rDescr.Strikeout );
+
+ // Kein DONTKNOW
+ aFont.SetOrientation( rDescr.Orientation );
+ aFont.SetKerning( rDescr.Kerning );
+ aFont.SetWordLineMode( rDescr.WordLineMode );
+
+ return aFont;
+}
+
+Font VCLUnoHelper::CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont )
+{
+ Font aFont;
+ VCLXFont* pVCLXFont = VCLXFont::GetImplementation( rxFont );
+ if ( pVCLXFont )
+ aFont = pVCLXFont->GetFont();
+ return aFont;
+}
+
+
+::com::sun::star::awt::SimpleFontMetric VCLUnoHelper::CreateFontMetric( const FontMetric& rFontMetric )
+{
+ ::com::sun::star::awt::SimpleFontMetric aFM;
+ aFM.Ascent = rFontMetric.GetAscent();
+ aFM.Descent = rFontMetric.GetDescent();
+ aFM.Leading = rFontMetric.GetLeading();
+ aFM.Slant = rFontMetric.GetSlant();
+ aFM.FirstChar = rFontMetric.getFirstChar();
+ aFM.LastChar = rFontMetric.getLastChar();
+ return aFM;
+}
+
+sal_Bool VCLUnoHelper::IsZero( ::com::sun::star::awt::Rectangle rRect )
+{
+ return ( !rRect.X && !rRect.Y && !rRect.Width && !rRect.Height );
+}
+
+
+
+
diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk
new file mode 100644
index 000000000000..652409af0725
--- /dev/null
+++ b/toolkit/util/makefile.mk
@@ -0,0 +1,248 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:02:09 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=toolkit
+TARGET=tk
+VERSION=$(UPD)
+USE_LDUMP2=TRUE
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+LDUMP=ldump2.exe
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(depend)" == ""
+
+.IF "$(HEADER)" == ""
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1FILES= $(SLB)$/awt.lib \
+ $(SLB)$/controls.lib \
+ $(SLB)$/helper.lib
+SHL1TARGET= tk$(VERSION)$(DLLPOSTFIX)
+SHL1IMPLIB= itk
+
+SHL1STDLIBS=\
+ $(TOOLSLIB) \
+ $(SOTLIB) \
+ $(VOSLIB) \
+ $(UNOTOOLSLIB) \
+ $(VCLLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1EXPORTFILE= tk.dxp
+
+.IF "$(COM)"=="ICC"
+SHL1OBJS= $(SLO)$/unowrap.obj
+.ENDIF
+
+.IF "$(COM)"=="WTC"
+ALL: $(LIB1TARGET) \
+ $(MISC)$/$(SHL1TARGET).flt \
+ $(MISC)$/$(SHL1TARGET).def \
+ $(BIN)$/$(SHL1TARGET).dll \
+ ALLTAR
+.ELSE
+ALL: \
+ $(LIB1TARGET) \
+ ALLTAR
+.ENDIF
+
+
+# --- W32 ----------------------------------------------------------------
+
+.IF "$(GUI)" == "WNT"
+
+# --- Def-File ---
+
+$(MISC)$/$(SHL1TARGET).def: $(MISC)$/$(SHL1TARGET).flt makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @+-attrib -r defs
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(SHL1TARGET) >$@
+ @echo DESCRIPTION 'TK' >>$@
+.IF "$(COM)"!="ICC"
+ @echo DATA READWRITE NONSHARED >>$@
+.ENDIF
+ @echo EXPORTS >>$@
+.IF "$(COM)"!="BLC"
+.IF "$(COM)"!="ICC"
+ $(LIBMGR) -EXTRACT:/ /OUT:$(TARGET).exp $(LIB1TARGET)
+ @$(LDUMP) -E20 -F$(MISC)$/$(SHL1TARGET).flt $(TARGET).exp >>$@
+ +-del $(TARGET).exp
+.ELSE
+ @$(LDUMP) -E3 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>$@
+.ENDIF
+.ELSE
+ @$(LDUMP) -E3 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>$@
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).dll >>$@
+ @$(LDUMP) -A -E1 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>tmp.def
+ @gawk -f s:\util\exp.awk tmp.def >>$@
+ @+-del tmp.def
+.ENDIF
+
+.ENDIF
+
+# --- OS2 ----------------------------------------------------------------
+
+.IF "$(GUI)" == "OS2"
+
+.IF "$(debug)" != ""
+.IF "$(COM)"=="BLC"
+LIBFLAGS=$(LIBFLAGS) /P512
+.ENDIF
+.ENDIF
+
+# --- Def-File ---
+
+$(MISC)$/$(SHL1TARGET).def: $(MISC)$/$(SHL1TARGET).flt makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+.IF "$(COM)"!="WTC"
+ @echo LIBRARY $(SHL1TARGET) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'VCL' >>$@
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+.IF "$(COM)"!="ICC"
+ @$(LDUMP) -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>$@
+.ELSE
+ @cppfilt /b /p /p /n /o $(LIB1TARGET) >>tmp.cpf
+ @$(LDUMP) -A -E1 -F$(MISC)$/$(SHL1TARGET).flt tmp.cpf >>$@
+ @+-del tmp.cpf
+.ENDIF
+.ELSE
+ @echo option DESCRIPTION 'StarView DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).dll >>$@
+.IF "$(E2P)" != ""
+ @echo export e2_dll_begin_tag_.1 >>$@
+.ENDIF
+ @$(LDUMP) -A -E1 -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>tmp.def
+ @gawk -f s:\util\exp.awk tmp.def >>$@
+ @+-del tmp.def
+.ENDIF
+
+.ENDIF
+
+.IF "$(OS)"=="MACOSX"
+SHL1STDLIBS +=
+.ELIF "$(GUI)"=="UNX"
+SHL1STDLIBS +=\
+ -lX11 -lXt -lXmu
+.ENDIF
+
+# --- Allgemein ----------------------------------------------------------
+
+# --- VCL-Filter-Datei ---
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo > $@
+# @echo Impl > $@
+ @echo Provider>> $@
+ @echo UnoEditControl>> $@
+ @echo UnoControlEditModel>> $@
+ @echo UnoFixedTextControl>> $@
+ @echo UnoControlFixedTextModel>> $@
+ @echo UnoButtonControl>> $@
+ @echo UnoControlButtonModel>> $@
+ @echo UnoListBoxControl>> $@
+ @echo UnoControlListBoxModel>> $@
+ @echo VCLXButton>> $@
+ @echo VCLXCheckBox>> $@
+ @echo VCLXComboBox>> $@
+ @echo VCLXFixedText>> $@
+ @echo VCLXFontMetric>> $@
+ @echo VCLXGraphics>> $@
+ @echo VCLXListBox>> $@
+ @echo VCLXMenu>> $@
+ @echo VCLXMessageBox>> $@
+ @echo VCLXRadioButton>> $@
+ @echo VCLXScrollBar>> $@
+ @echo VCLXVirtualDevice>> $@
+ @echo VCLXPopupMenu>> $@
+ @echo VCLXMenuBar>> $@
+
+
+# --- Targets ------------------------------------------------------------
+
+.ENDIF
+
+.ENDIF
+.INCLUDE : target.mk
diff --git a/toolkit/workben/controls.cxx b/toolkit/workben/controls.cxx
new file mode 100644
index 000000000000..587a1a3c4272
--- /dev/null
+++ b/toolkit/workben/controls.cxx
@@ -0,0 +1,485 @@
+/*************************************************************************
+ *
+ * $RCSfile: controls.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define NOOLDSV
+
+#include <tools/debug.hxx>
+
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+
+
+#include <stardiv/uno/awt/window.hxx>
+#include <stardiv/uno/awt/vclwin.hxx>
+#include <stardiv/uno/awt/printer.hxx>
+#include <stardiv/uno/repos/serinfo.hxx>
+#include <stardiv/uno/lang/factory.hxx>
+
+
+#include <unoctrl.hxx>
+// #include <unoctrl2.hxx>
+
+#include <svtools/unoiface.hxx> // InitExtToolkit
+
+UsrAny UsrAny_UINT16( UINT16 n )
+{
+ UsrAny aVal;
+ aVal.setUINT16( n );
+ return aVal;
+}
+
+// -----------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main();
+};
+
+MyApp aMyApp;
+
+// -----------------------------------------------------------------------
+
+class MyWin : public WorkWindow
+{
+ XControlRef xCtrl;
+ XPropertySetRef xCtrlModel;
+ XControlContainerRef xCont;
+ XPropertySetRef xContModel;
+ XControlRef xDrawCtrl;
+ XGraphicsRef xG;
+
+public:
+ MyWin( Window* pParent, WinBits nWinStyle );
+ ~MyWin();
+
+ void MouseButtonDown( const MouseEvent& rMEvt );
+ void Resize();
+ void Paint( const Rectangle& r );
+};
+
+// -----------------------------------------------------------------------
+
+void MyApp::Main()
+{
+ createAndSetDefaultServiceManager();
+ // !!!
+ InitExtVclToolkit();
+ Application::RegisterUnoServices();
+
+ MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
+ aMainWin.SetText( "Uno-Controls - Workbench" );
+ aMainWin.Show();
+ Execute();
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
+ WorkWindow( pParent, nWinStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+MyWin::~MyWin()
+{
+ XComponentRef xC1( xCont, USR_QUERY );
+ xC1->dispose();
+ XComponentRef xC2( xContModel, USR_QUERY );
+ xC2->dispose();
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( rMEvt.GetClicks() == 2 )
+ {
+ XViewRef xV( xDrawCtrl, USR_QUERY );
+ XWindowRef xC( xDrawCtrl, USR_QUERY );
+ xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
+
+ // Printer Testen...
+/*
+ XServiceManagerRef xProv = getGlobalServiceManager();
+ XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.PrinterServer" );
+ XPrinterServerRef xPrinterServer( xSSI->createInstance(), USR_QUERY );
+
+ Sequence< UString > aPrinterNames = xPrinterServer->getPrinterNames();
+ USHORT nPrinters = aPrinterNames.getLen();
+ String aInfo( "Printers: " );
+ aInfo += nPrinters;
+ if ( nPrinters )
+ {
+ for ( USHORT n = 0; n < nPrinters; n++ )
+ {
+ aInfo += '\n';
+ aInfo += OUStringToString( aPrinterNames.getConstArray()[n], CHARSET_SYSTEM );
+ }
+
+ XPrinterRef xPrinter = xPrinterServer->createPrinter( aPrinterNames.getConstArray()[0] );
+ xPrinter->start( L"UNOPrinterTest", 1, TRUE );
+ XDeviceRef xDev = xPrinter->startPage();
+ XGraphicsRef xGraphics = xDev->createGraphics();
+ xGraphics->drawText( 200, 200, L"Printed with UNO" );
+ xPrinter->endPage();
+ xPrinter->end();
+ }
+ InfoBox( this, aInfo ).Execute();
+*/
+ }
+ else if( rMEvt.GetClicks() == 1 )
+ {
+ if( xContModel )
+ {
+ static INT32 nColor = 0x001788ab;
+ xContModel->setPropertyValue( L"BackgroundColor", UsrAny( nColor ) );
+ nColor += 0x00111111;
+ nColor &= 0xFFFFFF;
+ }
+ else
+ {
+ XServiceManagerRef xProv = getGlobalServiceManager();
+
+ XMultiServiceFactoryRef xMSF = NAMESPACE_USR( getProcessServiceManager )();
+
+ XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.VclToolkit" );
+ XToolkitRef xToolkit( xMSF->createInstance( L"stardiv.vcl.VclToolkit" ), USR_QUERY );
+ DBG_ASSERT( xToolkit, "No Toolkit!" );
+
+ // Uno Container + Model erzeugen
+ XServiceProviderRef xModelProv; // = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ControlContainer" );
+ XInterfaceRef xCMRef( xMSF->createInstance(L"stardiv.vcl.controlmodel.ControlContainer") );
+ xCMRef->queryInterface( XPropertySet::getSmartUik(), xContModel );
+ xContModel->setPropertyValue( L"Border", UsrAny_UINT16( 1 ) );
+ xContModel->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00CCCCCC) );
+
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ControlContainer" );
+ XInterfaceRef xCCRef( xModelProv->createInstance(), USR_QUERY );
+ xCCRef->queryInterface( XControlContainer::getSmartUik(), xCont );
+
+ XControlModelRef xCM( xContModel, USR_QUERY );
+ XControlRef xContControl( xCont, USR_QUERY );
+ xContControl->setModel( xCM );
+ XWindowRef xContComp( xCont, USR_QUERY );
+ xContComp->setPosSize( 0, 0, 500, 600, PosSize_POSSIZE );
+
+ // Zwei EditControls auf einem Model...
+// xModelProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEditModel" );
+ XInterfaceRef xModel( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEditModel") );
+ DBG_ASSERT( xModel, "No Model!" );
+
+ XPropertySetRef xPSet( xModel, USR_QUERY );
+ xPSet->setPropertyValue( L"Text", UsrAny( UString( L"Hallo!" ) ) );
+ xPSet->setPropertyValue( L"FontName", UsrAny( UString( L"Times New Roman" ) ) );
+// xPSet->setPropertyValue( L"FontWeight", UsrAny( 200 ) );
+
+ XServiceProviderRef xEditCtrlProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEdit" );
+ // Edit1
+ XControlRef xEdit1( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
+ xModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xEdit1->setModel( xCM );
+ XWindowRef xEditCmp1( xEdit1, USR_QUERY );
+ xEditCmp1->setPosSize( 50, 50, 100, 60, PosSize_POSSIZE );
+ xCont->addControl( L"", xEdit1 );
+ // Edit2
+ XControlRef xEdit2( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
+ xModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xEdit2->setModel( xCM );
+ XWindowRef xEditCmp2( xEdit2, USR_QUERY );
+ XLayoutConstrainsRef xL( xEdit2, USR_QUERY );
+ if ( xL.is() )
+ {
+ Size aSz = xL->getPreferredSize();
+ xEditCmp2->setPosSize( 100, 180, aSz.Width(), aSz.Height(), PosSize_POSSIZE );
+ }
+ else
+ xEditCmp2->setPosSize( 100, 180, 100, 40, PosSize_POSSIZE );
+ xCont->addControl( L"", xEdit2 );
+
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.NumericField" );
+ XInterfaceRef xNumModel( xModelProv->createInstance(), USR_QUERY );
+ DBG_ASSERT( xNumModel, "No Model!" );
+
+
+ XServiceProviderRef xNumFieldProv = xProv->queryServiceProvider( L"stardiv.vcl.control.NumericField" );
+ XControlRef xNumField( xNumFieldProv->createInstance(), USR_QUERY );
+ xNumModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xNumField->setModel( xCM );
+ XWindowRef xNumFieldWin( xNumField, USR_QUERY );
+ xNumFieldWin->setPosSize( 50, 250, 100, 60, PosSize_POSSIZE );
+ xCont->addControl( L"", xNumField );
+
+ XMultiPropertySetRef xPSet2( xNumModel, USR_QUERY );
+ Sequence<UString> Names( 2 );
+ Names.getArray()[0] = L"Value";
+ Names.getArray()[1] = L"ValueMin";
+ Sequence<UsrAny> Values( 2 );
+ Values.getArray()[0] = UsrAny( -2000000.0 );
+ Values.getArray()[1] = UsrAny( -2000000.0 );
+ xPSet2->setPropertyValues( Names, Values );
+
+
+ // Button...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.Button" );
+ xModelProv->createInstance()->queryInterface( XInterface::getSmartUik(), xModel );
+ DBG_ASSERT( xModel, "No Model!" );
+
+ xModel->queryInterface( XPropertySet::getSmartUik(), xPSet );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Press!" ) );
+
+ XServiceProviderRef xButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.Button" );
+ XControlRef xButton1( xButtonCtrlProv->createInstance(), USR_QUERY );
+ xModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xButton1->setModel( xCM );
+ XWindowRef xButtonCmp1( xButton1, USR_QUERY );
+ xButtonCmp1->setPosSize( 170, 80, 80, 80, PosSize_POSSIZE );
+ // Unsichtbar, nur im MBDown mit DrawRoutine bei Doppel-Klick...
+ xButtonCmp1->setVisible( FALSE );
+ xDrawCtrl = xButton1;
+
+ xCont->addControl( L"", xButton1 );
+
+/*
+
+ // ListBox...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ListBox" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ Sequence<UString> aSeq( 7 );
+ aSeq.getArray()[0] = L"Item1";
+ aSeq.getArray()[1] = L"Item2";
+ aSeq.getArray()[2] = L"Item3";
+ aSeq.getArray()[3] = L"Item4";
+ aSeq.getArray()[4] = L"Item5";
+ aSeq.getArray()[5] = L"Item6";
+ aSeq.getArray()[6] = L"Item7";
+ xPSet->setPropertyValue( L"StringItemList", UsrAny( &aSeq, Sequence<UString>::getReflection() ) );
+ xPSet->setPropertyValue( L"LineCount", UsrAny_UINT16( 4 ) );
+ xPSet->setPropertyValue( L"Dropdown", UsrAny( (BOOL)TRUE ) );
+
+ XServiceProviderRef xListBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ListBox" );
+ XControlRef xListBox1 = (XControl*)xListBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xListBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xListBoxCmp1 = (XWindow*)xListBox1->queryInterface( XWindow::getSmartUik() );
+ xListBoxCmp1->setPosSize( 20, 250, 200, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xListBox1 );
+
+ // FixedText...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.FixedText" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ DBG_ASSERT( xModel, "No Model!" );
+
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Label:" ) );
+ xPSet->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00888888) );
+
+ Font_Attribs aFontAttrs;
+ aFontAttrs.Italic = ITALIC_NORMAL;
+ xPSet->setPropertyValue( L"Font_Attribs", UsrAny( &aFontAttrs, Font_Attribs_getReflection() ) );
+
+ XPropertyStateRef xState = (XPropertyState*)xPSet->queryInterface( XPropertyState::getSmartUik() );
+ xState->getPropertyState( L"Font_Attribs" );
+ xState->getPropertyState( L"Font_Size" );
+
+ XServiceProviderRef xFixedTextCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.FixedText" );
+ XControlRef xFixedText1 = (XControl*)xFixedTextCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ DBG_ASSERT( xFixedText1, "No FixedText!" );
+ xFixedText1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xFixedTextCmp1 = (XWindow*)xFixedText1->queryInterface( XWindow::getSmartUik() );
+ xFixedTextCmp1->setPosSize( 20, 20, 120, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xFixedText1 );
+
+ // TabTest...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.GroupBox" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio-Test:" ) );
+ XServiceProviderRef xGroupBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.GroupBox" );
+ XControlRef xGroupBox1 = (XControl*)xGroupBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xGroupBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xGroupBoxCmp1 = (XWindow*)xGroupBox1->queryInterface( XWindow::getSmartUik() );
+ xGroupBoxCmp1->setPosSize( 30, 410, 100, 130, PosSize_POSSIZE );
+ xCont->addControl( L"", xGroupBox1 );
+
+ XServiceProviderRef xRadioButtonModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.RadioButton" );
+ XServiceProviderRef xRadioButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.RadioButton" );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT1 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC1 = (XWindow*)xT1->queryInterface( XWindow::getSmartUik() );
+ xTC1->setPosSize( 40, 430, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT1 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio1" ) );
+ xPSet->setPropertyValue( L"State", UsrAny_UINT16( 1 ) );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT2 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT2->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC2 = (XWindow*)xT2->queryInterface( XWindow::getSmartUik() );
+ xTC2->setPosSize( 40, 470, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT2 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio2" ) );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT3 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT3->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC3 = (XWindow*)xT3->queryInterface( XWindow::getSmartUik() );
+ xTC3->setPosSize( 40, 510, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT3 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio3" ) );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT4 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT4->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC4 = (XWindow*)xT4->queryInterface( XWindow::getSmartUik() );
+ xTC4->setPosSize( 40, 550, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT4 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio4 - no" ) );
+ xPSet->setPropertyValue( L"Tabstop", UsrAny( (BOOL)TRUE ) );
+
+ // TabController:
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.TabController" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XTabControllerModelRef xTCModel = (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() );
+
+ XServiceProviderRef xTCProv = xProv->queryServiceProvider( L"stardiv.vcl.control.TabController" );
+ XTabControllerRef xTC = (XTabController*)xTCProv->createInstance()->queryInterface( XTabController::getSmartUik() );
+ xTC->setModel( (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() ) );
+ XUnoControlContainerRef xUCC = (XUnoControlContainer*)xCont->queryInterface( XUnoControlContainer::getSmartUik() );
+ xUCC->addTabController( xTC );
+
+ Sequence<XControlModelRef> aControls( 5 );
+ aControls.getArray()[0] = xGroupBox1->getModel();
+ aControls.getArray()[1] = xT1->getModel();
+ aControls.getArray()[2] = xT3->getModel();
+ aControls.getArray()[3] = xT2->getModel();
+ aControls.getArray()[4] = xT4->getModel();
+ xTCModel->setControls( aControls );
+
+ Sequence<XControlModelRef> aGroup( 3 );
+ aGroup.getArray()[0] = xT1->getModel();
+ aGroup.getArray()[1] = xT3->getModel();
+ aGroup.getArray()[2] = xT2->getModel();
+ xTCModel->setGroup( aGroup, L"test" );
+*/
+ // Container anzeigen...
+ // Als Child zu diesem Fenster
+ xContControl->createPeer( XToolkitRef(), GetComponentInterface( TRUE ) );
+
+ XDeviceRef xD( xContControl->getPeer(), USR_QUERY );
+ xG = xD->createGraphics();
+ XViewRef xV ( xDrawCtrl, USR_QUERY );
+ xV->setGraphics( xG );
+
+// ((UnoControl*)(XControl*)xNumField))->updateFromModel();
+
+/*
+ // TEST:
+ WindowDecriptor aDescr;
+ aDescr.ComponentServiceName = "window";
+ aDescr.Type = VCLCOMPONENTTYPE_CONTAINER;
+ aDescr.Parent = GetComponentInterface( TRUE );
+ aDescr.WindowAttributes = WA_SHOW|WA_BORDER;
+ aDescr.Bounds = Rectangle( Point( 500, 50 ), Size( 300, 200 ) );
+ XVclWindowPeerRef xSPWin = xToolkit->createComponent( aDescr );
+
+ WindowDecriptor aDescr2;
+ aDescr2.ComponentServiceName = "scrollbar";
+ aDescr2.Type = VCLCOMPONENTTYPE_SIMPLE;
+ aDescr2.Parent = xSPWin;
+ aDescr2.WindowAttributes = WA_SHOW|WA_BORDER|WA_VSCROLL;
+ aDescr2.Bounds = Rectangle( Point( 250, 0 ), Size( 50, 200 ) );
+ XVclWindowPeerRef xSB = xToolkit->createComponent( aDescr2 );
+*/
+ }
+ return;
+ }
+ WorkWindow::MouseButtonDown( rMEvt );
+}
+
+
+// -----------------------------------------------------------------------
+
+void MyWin::Resize()
+{
+ WorkWindow::Resize();
+}
+
+void MyWin::Paint( const Rectangle& r )
+{
+ // Muss ueber PaintListener geschehen...
+ if ( xDrawCtrl.is() )
+ {
+ XViewRef xV( xDrawCtrl, USR_QUERY );
+ XWindowRef xC( xDrawCtrl, USR_QUERY );
+ xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
+ }
+
+}
+
diff --git a/toolkit/workben/makefile.mk b/toolkit/workben/makefile.mk
new file mode 100644
index 000000000000..ac0844979640
--- /dev/null
+++ b/toolkit/workben/makefile.mk
@@ -0,0 +1,175 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:02:10 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=toolkit
+TARGET=controls
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= controls.cxx \
+ smartvcl.cxx
+
+OBJFILES= $(OBJ)$/controls.obj \
+ $(OBJ)$/smartvcl.obj
+
+
+APP2TARGET= controls
+APP2OBJS= $(OBJ)$/controls.obj
+APP2STDLIBS=$(TOOLSLIB) \
+ $(SOTLIB) \
+ $(SVTOOLLIB) \
+ $(USRLIB) \
+ $(ONELIB) \
+ $(SVLIB)
+APP2DEF= $(MISC)$/controls.def
+
+APP3TARGET= smartvcl
+APP3OBJS= $(OBJ)$/smartvcl.obj
+APP3STDLIBS=$(TOOLSLIB) \
+ $(SOTLIB) \
+ $(SVTOOLLIB) \
+ $(USRLIB) \
+ $(ONELIB) \
+ $(SVLIB)
+APP3DEF= $(MISC)$/smartvcl.def
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+# ------------------------------------------------------------------
+# Windows
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "WIN"
+
+$(MISC)$/controls.def: makefile
+ echo NAME controls >$@
+ echo DESCRIPTION 'StarView - Testprogramm' >>$@
+ echo EXETYPE WINDOWS >>$@
+ echo STUB 'winSTUB.EXE' >>$@
+ echo PROTMODE >>$@
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
+ echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
+
+$(MISC)$/smartvcl.def: makefile
+ echo NAME smartvcl >$@
+ echo DESCRIPTION 'StarView - Testprogramm' >>$@
+ echo EXETYPE WINDOWS >>$@
+ echo STUB 'winSTUB.EXE' >>$@
+ echo PROTMODE >>$@
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
+ echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
+
+# ------------------------------------------------------------------
+# OS2
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/controls.def: makefile
+ echo NAME controls WINDOWAPI >$@
+ echo DESCRIPTION 'StarView - Testprogramm' >>$@
+.IF "$(COM)" != "BLC"
+ echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+.IF "$(COM)"!="MTW"
+ echo EXETYPE OS2 >>$@
+.ENDIF
+ echo PROTMODE >>$@
+ echo CODE LOADONCALL >>$@
+ echo DATA PRELOAD MULTIPLE >>$@
+ echo HEAPSIZE 16384 >>$@
+ echo STACKSIZE 32768 >>$@
+
+$(MISC)$/smartvcl.def: makefile
+ echo NAME smartvcl WINDOWAPI >$@
+ echo DESCRIPTION 'StarView - Testprogramm' >>$@
+.IF "$(COM)" != "BLC"
+ echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+.IF "$(COM)"!="MTW"
+ echo EXETYPE OS2 >>$@
+.ENDIF
+ echo PROTMODE >>$@
+ echo CODE LOADONCALL >>$@
+ echo DATA PRELOAD MULTIPLE >>$@
+ echo HEAPSIZE 16384 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
diff --git a/tools/bootstrp/addexes/makefile.mk b/tools/bootstrp/addexes/makefile.mk
new file mode 100644
index 000000000000..5dfc14eda202
--- /dev/null
+++ b/tools/bootstrp/addexes/makefile.mk
@@ -0,0 +1,128 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:00 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=addexes
+TARGETTYPE=CUI
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+.INCLUDE : static.mk
+
+CDEFS+=-D_TOOLS_STRINGLIST
+
+# --- Files --------------------------------------------------------
+
+LIB1TARGET= $(LB)$/btstrp.lib
+LIB1ARCHIV= $(LB)$/libbtstrp.a
+LIB1FILES= $(LB)$/bootstrp.lib
+
+APP1TARGET= dirsync
+APP1STACK= 16000
+APP1OBJS= $(OBJ)$/dirsync.obj
+APP1STDLIBS=$(STATIC_LIBS)
+APP1LIBS= $(LB)$/bootstrp.lib
+APP1DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP2TARGET= include
+APP2STACK= 16000
+APP2OBJS= $(OBJ)$/include.obj
+APP2STDLIBS=$(STATIC_LIBS)
+APP2LIBS= $(LB)$/bootstrp.lib
+APP2DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP3TARGET= ldump
+APP3STACK= 16000
+APP3OBJS= $(OBJ)$/ldump.obj
+APP3STDLIBS=$(STATIC_LIBS) $(LIBCIMT)
+APP3LIBS= $(LB)$/bootstrp.lib
+APP3DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP4TARGET= readmap
+APP4STACK= 16000
+APP4OBJS= $(OBJ)$/readmap.obj $(OBJ)$/deco.obj
+APP4STDLIBS=$(STATIC_LIBS) $(LIBCIMT)
+APP4LIBS= $(LB)$/bootstrp.lib
+APP4DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP5TARGET= deco
+APP5STACK= 16000
+APP5OBJS= $(OBJ)$/deco.obj $(OBJ)$/deco2.obj
+APP5STDLIBS=$(STATIC_LIBS) $(LIBCIMT)
+APP5LIBS= $(LB)$/bootstrp.lib
+APP5DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP6TARGET= urlconv
+APP6OBJS= $(OBJ)$/urlconv.obj
+APP6STDLIBS=\
+ $(TOOLSLIB) \
+ $(SALLIB)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/bootstrp/addexes2/makefile.mk b/tools/bootstrp/addexes2/makefile.mk
new file mode 100644
index 000000000000..6da12f8ad4f6
--- /dev/null
+++ b/tools/bootstrp/addexes2/makefile.mk
@@ -0,0 +1,100 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:01 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=addexes2
+TARGETTYPE=CUI
+TARGETTHREAD=MT
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+.INCLUDE : ../static.mk
+
+# --- Files --------------------------------------------------------
+
+APP1TARGET= javadep
+APP1OBJS= $(OBJ)$/javadep.obj
+APP1STDLIBS=$(STATIC_LIBS)
+
+.IF "$(GUI)"=="UNX"
+APP2TARGET= checkdll
+APP2OBJS= $(OBJ)$/checkdll.obj
+.ENDIF
+
+APP3TARGET= mkunroll
+APP3OBJS= $(OBJ)$/mkfilt.obj
+APP3STDLIBS=$(STATIC_LIBS)
+.IF "$(OS)"=="LINUX"
+APP3STDLIBS+=-lpthread
+.ENDIF
+APP3LIBS= $(LB)$/bootstrp.lib
+APP3DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+DEPOBJFILES = $(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS) $(APP7OBJS) $(APP8OBJS) $(APP9OBJS)
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/bootstrp/addexes2/mkfilt.cxx b/tools/bootstrp/addexes2/mkfilt.cxx
new file mode 100644
index 000000000000..c6642d9fdca8
--- /dev/null
+++ b/tools/bootstrp/addexes2/mkfilt.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * $RCSfile: mkfilt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#include <tools/string.hxx>
+#include <tools/list.hxx>
+
+class TextFilter
+{
+protected:
+ FILE *pIn, *pOut;
+ virtual void Filter();
+public:
+ TextFilter( ByteString aInFile = "stdin",
+ ByteString aOutFile = "stdout" );
+ virtual ~TextFilter();
+
+ virtual void Execute();
+};
+
+TextFilter::TextFilter( ByteString aInFile, ByteString aOutFile )
+{
+ if ( aInFile == "stdin" )
+ pIn = stdin;
+ else
+ if (( pIn = fopen( aInFile.GetBuffer(), "r" )) == NULL )
+ printf( "Can't read %s\n", aInFile.GetBuffer() );
+
+ if ( aOutFile == "stdout" )
+ pOut = stdout;
+ else
+ if (( pOut = fopen( aOutFile.GetBuffer(), "w" )) == NULL )
+ printf( "Can't write %s\n", aOutFile.GetBuffer() );
+}
+
+TextFilter::~TextFilter()
+{
+ fclose( pOut );
+ fclose( pIn );
+}
+
+void TextFilter::Execute()
+{
+ Filter();
+}
+
+void TextFilter::Filter()
+{
+ char c;
+ while ( (c = fgetc( pIn )) != EOF )
+ fputc( c, pOut );
+}
+
+#define LINE_LEN 2048
+
+class ByteStringList;
+
+class MkLine
+{
+public:
+ ByteString aLine;
+ ByteStringList* pPrivateTnrLst;
+ BOOL bOut;
+ BOOL bHier;
+
+ MkLine();
+};
+
+MkLine::MkLine()
+{
+ bOut = FALSE;
+ bHier = FALSE;
+ pPrivateTnrLst = NULL;
+}
+
+DECLARE_LIST( ByteStringList, MkLine * );
+
+class MkFilter : public TextFilter
+{
+ static ByteString aTnr;
+ ByteStringList *pLst;
+ ByteStringList *pTnrLst;
+protected:
+ virtual void Filter();
+public:
+ MkFilter( ByteString aInFile = "stdin", ByteString aOutFile = "stdout");
+ ~MkFilter();
+};
+
+MkFilter::MkFilter( ByteString aInFile, ByteString aOutFile ) :
+ TextFilter( aInFile, aOutFile )
+{
+ pLst = new ByteStringList;
+ pTnrLst = new ByteStringList;
+}
+
+MkFilter::~MkFilter()
+{
+ delete pTnrLst;
+ delete pLst;
+}
+
+ByteString MkFilter::aTnr="$(TNR)";
+
+void MkFilter::Filter()
+{
+ char aLineBuf[LINE_LEN];
+ int nState = 0;
+ BOOL bNew = TRUE;
+
+ while(( fgets(aLineBuf, LINE_LEN, pIn)) != NULL )
+ {
+ ByteString aLine( aLineBuf );
+ //fprintf(stderr, "aLine :%s\n", aLine.GetBuffer());
+ if ( aLine.Search("mkfilter1" ) != STRING_NOTFOUND )
+ {
+ // Zeilen unterdruecken
+ fprintf( stderr, "mkfilter1\n" );
+ nState = 0;
+ }
+ else if ( aLine.Search("unroll begin" ) != STRING_NOTFOUND )
+ {
+ // Zeilen raus schreiben mit ersetzen von $(TNR) nach int n
+ fprintf( stderr, "\nunroll begin\n" );
+ nState = 1;
+ }
+ ;
+
+ if ( nState == 0 )
+ {
+ fprintf( stderr, "." );
+ MkLine *pMkLine = new MkLine();
+ ByteString *pStr = new ByteString( aLineBuf );
+ pMkLine->aLine = *pStr;
+ pMkLine->bOut = FALSE;
+
+ pLst->Insert( pMkLine, LIST_APPEND );
+ }
+ else if ( nState == 1 )
+ {
+ BOOL bInTnrList = TRUE;
+ fprintf( stderr, ":" );
+ MkLine *pMkLine = new MkLine();
+ if ( aLine.Search("unroll end") != STRING_NOTFOUND )
+ {
+ fprintf( stderr, ";\nunroll end\n" );
+ MkLine *p_MkLine = new MkLine();
+ p_MkLine->bHier = TRUE;
+ ByteString *pByteString = new ByteString("# do not delete this line === mkfilter3i\n");
+ p_MkLine->aLine = *pByteString;
+ p_MkLine->bOut = FALSE;
+ p_MkLine->pPrivateTnrLst = pTnrLst;
+ pTnrLst = new ByteStringList();
+ pLst->Insert( p_MkLine, LIST_APPEND );
+ nState = 0;
+ bInTnrList = FALSE;
+ }
+ ByteString *pStr = new ByteString( aLineBuf );
+ pMkLine->aLine = *pStr;
+ pMkLine->bOut = FALSE;
+
+ if ( bInTnrList )
+ pTnrLst->Insert( pMkLine, LIST_APPEND );
+ }
+ else
+ /* Zeilen ignorieren */;
+ } // End Of File
+ fprintf( stderr, "\n" );
+
+ // das File wieder ausgegeben
+ ULONG nLines = pLst->Count();
+ for ( ULONG j=0; j<nLines; j++ )
+ {
+ MkLine *pLine = pLst->GetObject( j );
+ if ( pLine->bHier )
+ {
+ // die List n - Mal abarbeiten
+ for ( USHORT n=1; n<11; n++)
+ {
+ ULONG nCount = pLine->pPrivateTnrLst->Count();
+ for ( ULONG i=0; i<nCount; i++ )
+ {
+ MkLine *pMkLine = pLine->pPrivateTnrLst->GetObject(i);
+ ByteString aLine = pMkLine->aLine;
+ if ( pMkLine->bOut );
+ {
+ while( aLine.SearchAndReplace( aTnr, ByteString::CreateFromInt32( n )) != (USHORT)-1 );
+ fputs( aLine.GetBuffer(), pOut );
+ fprintf( stderr, "o" );
+ }
+ }
+ }
+ if ( pLine->pPrivateTnrLst != NULL )
+ delete pLine->pPrivateTnrLst;
+ pLine->pPrivateTnrLst = NULL;
+ }
+ if ( pLine->bOut )
+ fputs(pLine->aLine.GetBuffer(), pOut );
+ }
+ fprintf( stderr, "\n" );
+}
+
+int main( int argc, char **argv )
+{
+ int nRet = 0;
+
+ TextFilter *pFlt = new MkFilter();
+ pFlt->Execute();
+ delete pFlt;
+
+ return nRet;
+}
diff --git a/tools/bootstrp/appdef.cxx b/tools/bootstrp/appdef.cxx
new file mode 100644
index 000000000000..417b0f8f8a8f
--- /dev/null
+++ b/tools/bootstrp/appdef.cxx
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * $RCSfile: appdef.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <appdef.hxx>
+
+const char* GetDefStandList()
+{
+ char* pRet;
+ char* pEnv = getenv("STAR_STANDLST");
+ if ( pEnv )
+ {
+ int nLen = strlen( pEnv );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, pEnv );
+ }
+ else
+ {
+ int nLen = strlen( _DEF_STAND_LIST );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, _DEF_STAND_LIST );
+ }
+ return pRet;
+}
+
+
+const char* GetIniRoot()
+{
+ char* pRet;
+ char* pEnv = getenv("STAR_INIROOT");
+ if ( pEnv )
+ {
+ int nLen = strlen( pEnv );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, pEnv );
+ }
+ else
+ {
+ int nLen = strlen( _INIROOT );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, _INIROOT );
+ }
+ return pRet;
+}
+
+const char* GetIniRootOld()
+{
+ char* pRet;
+ char* pEnv = getenv("STAR_INIROOTOLD");
+ if ( pEnv )
+ {
+ int nLen = strlen( pEnv );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, pEnv );
+ }
+ else
+ {
+ int nLen = strlen( _INIROOT_OLD );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, _INIROOT_OLD );
+ }
+ return pRet;
+}
+
+const char* GetSSolarIni()
+{
+ char* pRet;
+ char* pEnv = getenv("STAR_SSOLARINI");
+ if ( pEnv )
+ {
+ int nLen = strlen( pEnv );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, pEnv );
+ }
+ else
+ {
+ int nLen = strlen( _DEF_SSOLARINI );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, _DEF_SSOLARINI );
+ }
+ return pRet;
+}
+
+
+const char* GetSSCommon()
+{
+ char* pRet;
+ char* pEnv = getenv("STAR_SSCOMMON");
+ if ( pEnv )
+ {
+ int nLen = strlen( pEnv );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, pEnv );
+ }
+ else
+ {
+ int nLen = strlen( _DEF_SSCOMMON );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, _DEF_SSCOMMON );
+ }
+ return pRet;
+}
+
+
+const char* GetBServerRoot()
+{
+ char* pRet;
+ char* pEnv = getenv("STAR_BSERVERROOT");
+ if ( pEnv )
+ {
+ int nLen = strlen( pEnv );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, pEnv );
+ }
+ else
+ {
+ int nLen = strlen( B_SERVER_ROOT );
+ pRet = ( char *) malloc( nLen + 1 );
+ (void) strcpy( pRet, B_SERVER_ROOT );
+ }
+ return pRet;
+}
+
+const char* GetEnv( const char *pVar )
+{
+ char *pRet = getenv( pVar );
+ if ( !pRet )
+ pRet = "";
+ return pRet;
+}
+
diff --git a/tools/bootstrp/command.cxx b/tools/bootstrp/command.cxx
new file mode 100644
index 000000000000..abd9d38daa24
--- /dev/null
+++ b/tools/bootstrp/command.cxx
@@ -0,0 +1,716 @@
+/*************************************************************************
+ *
+ * $RCSfile: command.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef SCO
+#define _IOSTREAM_H
+#endif
+
+#ifdef PRECOMPILED
+#include "first.hxx"
+#endif
+
+#pragma hdrstop
+
+#include "fsys.hxx"
+#include "stream.hxx"
+#include "command.hxx"
+#include "debug.hxx"
+
+#include <iostream.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <errno.h>
+
+//#define MH_TEST2 1 // fuers direkte Testen
+
+#if defined (DOS) || defined (WNT) || defined (WIN) || defined(OS2)
+#include <process.h> // for _SPAWN
+#endif
+#ifdef UNX
+#include <sys/types.h>
+#include <unistd.h>
+#if ( defined NETBSD ) || defined (FREEBSD) || defined (AIX) \
+ || defined (HPUX) || defined (MACOSX)
+#include <sys/wait.h>
+#else
+#include <wait.h>
+#endif
+#define P_WAIT 1 // erstmal einen dummz
+#endif
+#ifdef MAC
+#define P_WAIT 1 // erstmal einen dummz
+#endif
+#ifdef WTC
+#define _spawnv spawnv
+#endif
+
+#ifdef OS2
+#include <svpm.h>
+#define _spawnv spawnv
+#endif
+#if defined (WIN) || defined (WNT)
+#include <svwin.h>
+#endif
+
+#if defined( WNT ) || defined ( OS2 ) || defined ( WIN ) || defined (DOS )
+#define cPathSeperator ';'
+#endif
+#ifdef UNX
+#define cPathSeperator ':'
+#endif
+#ifdef MAC
+#define cPathSeperator ','
+#endif
+
+/*****************************************************************************/
+CommandLine::CommandLine(BOOL bWrite)
+/*****************************************************************************/
+ : bTmpWrite(bWrite)
+{
+ CommandBuffer = new char [1];
+ if (CommandBuffer == NULL) {
+ //cout << "Error: nospace" << endl;
+ exit(0);
+ }
+ CommandBuffer[0] = '\0';
+ nArgc = 0;
+ ppArgv = new char * [1];
+ ppArgv[0] = NULL;
+
+ ComShell = new char [128];
+ char* pTemp = getenv("COMMAND_SHELL");
+ if(!pTemp)
+ strcpy(ComShell,COMMAND_SHELL);
+ else
+ strcpy(ComShell,pTemp);
+
+ strcpy(&ComShell[strlen(ComShell)]," -C ");
+}
+
+/*****************************************************************************/
+CommandLine::CommandLine(const char *CommandString, BOOL bWrite)
+/*****************************************************************************/
+ : bTmpWrite(bWrite)
+{
+ CommandBuffer = new char [1];
+ if (CommandBuffer == NULL) {
+ //cout << "Error: nospace" << endl;
+ exit(0);
+ }
+ nArgc = 0;
+ ppArgv = new char * [1];
+ ppArgv[0] = NULL;
+
+ ComShell = new char [128];
+ char* pTemp = getenv("COMMAND_SHELL");
+ if(!pTemp)
+ strcpy(ComShell,COMMAND_SHELL);
+ else
+ strcpy(ComShell,pTemp);
+
+ strcpy(&ComShell[strlen(ComShell)]," -C ");
+
+ BuildCommand(CommandString);
+}
+
+/*****************************************************************************/
+CommandLine::CommandLine(const CommandLine& CCommandLine, BOOL bWrite)
+/*****************************************************************************/
+ : bTmpWrite(bWrite)
+{
+ CommandBuffer = new char [1];
+ if (CommandBuffer == NULL) {
+ //cout << "Error: nospace" << endl;
+ exit(0);
+ }
+ nArgc = 0;
+ ppArgv = new char * [1];
+ ppArgv[0] = NULL;
+
+ ComShell = new char [128];
+ char* pTemp = getenv("COMMAND_SHELL");
+ if(!pTemp)
+ strcpy(ComShell,COMMAND_SHELL);
+ else
+ strcpy(ComShell,pTemp);
+
+ strcpy(&ComShell[strlen(ComShell)]," -C ");
+
+ BuildCommand(CCommandLine.CommandBuffer);
+}
+
+/*****************************************************************************/
+CommandLine::~CommandLine()
+/*****************************************************************************/
+{
+ delete [] CommandBuffer;
+ delete [] ComShell;
+ //for (int i = 0; ppArgv[i] != '\0'; i++) {
+ for (int i = 0; ppArgv[i] != 0; i++) {
+ delete [] ppArgv[i];
+ }
+ delete [] ppArgv;
+
+}
+
+/*****************************************************************************/
+CommandLine& CommandLine::operator=(const CommandLine& CCommandLine)
+/*****************************************************************************/
+{
+ strcpy (CommandBuffer, CCommandLine.CommandBuffer);
+ for (int i = 0; i != nArgc; i++) {
+ delete [] ppArgv[i];
+ }
+ delete [] ppArgv;
+ BuildCommand(CommandBuffer);
+ return *this;
+}
+
+/*****************************************************************************/
+CommandLine& CommandLine::operator=(const char *CommandString)
+/*****************************************************************************/
+{
+ strcpy (CommandBuffer, CommandString);
+ for (int i = 0; i != nArgc; i++) {
+ delete [] ppArgv[i];
+ }
+ delete [] ppArgv;
+ BuildCommand(CommandBuffer);
+
+ return *this;
+}
+
+/*****************************************************************************/
+void CommandLine::Print()
+/*****************************************************************************/
+{
+ //cout << "******* start print *******" << endl;
+ //cout << "nArgc = " << nArgc << endl;
+ //cout << "CommandBuffer = " << CommandBuffer << endl;
+ for (int i = 0; ppArgv[i] != NULL; i++) {
+ //cout << "ppArgv[" << i << "] = " << ppArgv[i] << endl;
+ }
+ //cout << "******** end print ********" << endl;
+}
+
+/*****************************************************************************/
+void CommandLine::BuildCommand(const char *CommandString)
+/*****************************************************************************/
+{
+ int index = 0, pos=0;
+ char buffer[1024];
+ char WorkString[1024];
+
+ strcpy(WorkString,CommandString);
+
+ //falls LogWindow -> in tmpfile schreiben
+ if(bTmpWrite)
+ {
+ strcpy(&WorkString[strlen(WorkString)]," >&");
+ strcpy(&WorkString[strlen(WorkString)],getenv("TMP"));
+ strcpy(&WorkString[strlen(WorkString)],TMPNAME);
+ }
+
+ // delete old memory and get some new memory for CommandBuffer
+
+ delete [] CommandBuffer;
+ CommandBuffer = new char [strlen(ComShell)+strlen(WorkString)+1];
+ if (CommandBuffer == NULL) {
+ //cout << "Error: nospace" << endl;
+ exit(0);
+ }
+ strcpy (CommandBuffer, ComShell);
+ strcpy (&CommandBuffer[strlen(ComShell)], WorkString);
+
+ CommandString = CommandBuffer;
+
+ // get the number of tokens
+ Strtokens(CommandString);
+
+ // delete the space for the old CommandLine
+
+ for (int i = 0; ppArgv[i] != 0; i++) {
+ delete [] ppArgv[i];
+ }
+ delete [] ppArgv;
+
+ /* get space for the new command line */
+
+ ppArgv = (char **) new char * [nArgc+1];
+ if (ppArgv == NULL) {
+ //cout << "Error: no space" << endl;
+ exit(0);
+ }
+
+ // flush the white space
+
+ while ( isspace(*CommandString) )
+ CommandString++;
+
+ index = 0;
+
+ // start the loop to build all the individual tokens
+
+ while (*CommandString != '\0') {
+
+ pos = 0;
+
+ // copy the token until white space is found
+
+ while ( !isspace(*CommandString) && *CommandString != '\0') {
+
+ buffer[pos++] = *CommandString++;
+
+ }
+
+ buffer[pos] = '\0';
+
+ // get space for the individual tokens
+
+ ppArgv[index] = (char *) new char [strlen(buffer)+1];
+ if (ppArgv[index] == NULL) {
+ //cout << "Error: nospace" << endl;
+ exit(0);
+ }
+
+ // copy the token
+
+ strcpy (ppArgv[index++], buffer);
+
+ // flush while space
+
+ while ( isspace(*CommandString) )
+ CommandString++;
+
+ }
+
+ // finish by setting the las pointer to NULL
+ ppArgv[nArgc]= NULL;
+
+}
+
+/*****************************************************************************/
+void CommandLine::Strtokens(const char *CommandString)
+/*****************************************************************************/
+{
+ int count = 0;
+ const char *temp;
+
+ temp = CommandString;
+
+ /* bypass white space */
+
+ while (isspace(*temp)) temp++;
+
+ for (count=0; *temp != '\0'; count++) {
+
+ /* continue until white space of string terminator is found */
+
+ while ((!isspace(*temp)) && (*temp != '\0')) temp++;
+
+ /* bypass white space */
+
+ while (isspace(*temp)) temp++;
+
+ }
+ nArgc = count;
+}
+
+/*****************************************************************************/
+CCommand::CCommand( ByteString &rString )
+/*****************************************************************************/
+{
+ rString.SearchAndReplace( '\t', ' ' );
+ aCommand = rString.GetToken( 0, ' ' );
+ aCommandLine = Search();
+#ifndef UNX
+ aCommandLine += " /c ";
+#else
+ aCommandLine += " -c ";
+#endif
+ aCommandLine += rString;
+ ImplInit();
+}
+
+/*****************************************************************************/
+CCommand::CCommand( const char *pChar )
+/*****************************************************************************/
+{
+ ByteString aString = pChar;
+ aString.SearchAndReplace( '\t', ' ' );
+ aCommand = aString.GetToken( 0, ' ' );
+
+ aCommandLine = Search();
+#ifndef UNX
+ aCommandLine += " /c ";
+#else
+ aCommandLine += " -c ";
+#endif
+ aCommandLine += pChar;
+
+
+ ImplInit();
+}
+
+/*****************************************************************************/
+void CCommand::ImplInit()
+/*****************************************************************************/
+{
+ char pTmpStr[255];
+ size_t *pPtr;
+ char *pChar;
+ int nVoid = sizeof( size_t * );
+ ULONG nPos = 0;
+ nArgc = aCommandLine.GetTokenCount(' ');
+ ULONG nLen = aCommandLine.Len();
+
+ ppArgv = (char **) new char[ (ULONG)(nLen + nVoid * (nArgc +2) + nArgc ) ];
+ pChar = (char *) ppArgv + ( (1+nArgc) * nVoid );
+ pPtr = (size_t *) ppArgv;
+ for ( ULONG i=0; i<nArgc; i++ )
+ {
+ (void) strcpy( pTmpStr, aCommandLine.GetToken(i, ' ' ).GetBuffer() );
+ USHORT nStrLen = strlen( pTmpStr ) + 1;
+ strcpy( pChar, pTmpStr );
+ *pPtr = (unsigned int) pChar;
+ pChar += nStrLen;
+ pPtr += 1;
+#ifdef UNX
+ if ( i == 1 )
+ {
+ USHORT nWo = aCommandLine.Search("csh -c ");
+ if (nWo != STRING_NOTFOUND)
+ aCommandLine.Erase(0, nWo + 7);
+ else
+ aCommandLine.Erase(0, 16);
+ i = nArgc;
+ strcpy( pChar, aCommandLine.GetBuffer() );
+ *pPtr = ( unsigned int ) pChar;
+ pPtr += 1;
+ }
+#endif
+ }
+ *pPtr = 0;
+}
+
+/*****************************************************************************/
+CCommand::operator const int()
+/*****************************************************************************/
+{
+ int nRet;
+#ifndef UNX
+#if defined( WNT ) || defined( DOS ) || defined( WIN )
+ nRet = _spawnv( P_WAIT, ppArgv[0], (const char **) ppArgv );
+#else
+#if defined( UNX ) || defined( OS2 )
+ nRet = _spawnv( P_WAIT, ppArgv[0], ppArgv );
+#endif
+#ifdef MAC
+//Mac-Implem.
+#endif
+#endif
+#else
+#ifdef UNX
+ //fprintf( stderr, "CComand : operator (int) not implemented\n");
+ // **** Unix Implementierung ***************
+ pid_t pid;
+
+ if (( pid = fork()) < 0 )
+ {
+ DBG_ASSERT( FALSE, "fork error" );
+ }
+ else if ( pid == 0 )
+ {
+ if ( execv( ppArgv[0], (char * const *) ppArgv ) < 0 )
+ {
+ DBG_ASSERT( FALSE, "execv failed" );
+ }
+ }
+ //fprintf( stderr, "parent: %s %s\n", ppArgv[0] , ppArgv[1] );
+ if ( nRet = waitpid( pid, NULL, 0 ) < 0 )
+ {
+ DBG_ASSERT( FALSE, "wait error" );
+ }
+#endif
+
+#ifdef MAC
+//Mac_impl
+=======
+#endif
+
+#endif
+
+#ifndef MAC
+ switch ( errno )
+ {
+ case E2BIG :
+ nError = COMMAND_TOOBIG;
+ break;
+ case EINVAL :
+ nError = COMMAND_INVALID;
+ break;
+ case ENOENT:
+ nError = COMMAND_NOTFOUND;
+ break;
+ case ENOEXEC :
+ nError = COMMAND_NOEXEC;
+ break;
+ case ENOMEM :
+ nError = COMMAND_NOMEM;
+ break;
+ default:
+ nError = COMMAND_UNKNOWN;
+ }
+#endif
+
+ if ( nRet )
+ fprintf( stderr, "Program returned with errros\n");
+ return nRet;
+}
+
+/*****************************************************************************/
+ByteString CCommand::Search(ByteString sEnv, ByteString sItem)
+/*****************************************************************************/
+{
+ FILE *fp;
+ ByteString aEntry, sReturn;
+
+ // default wird eine Shell im Path gesucht,
+ // wenn aber compsec gestzt ist holen wir uns die
+ // Shell von dort
+
+ if ( sItem == COMMAND_SHELL )
+ {
+ ByteString aComspec = getenv( "COMSPEC" );
+ if ( aComspec != "" )
+ return aComspec;
+ }
+
+ ByteString sEnvironment = getenv(sEnv.GetBuffer() );
+ ULONG nCount = sEnvironment.GetTokenCount( cPathSeperator );
+ for ( ULONG i=0; i<nCount; i++ )
+ {
+ aEntry = sEnvironment.GetToken(i, cPathSeperator );
+#ifndef UNX
+ aEntry += '\\';
+#else
+ aEntry += '/';
+#endif
+ aEntry += sItem;
+ if (( fp = fopen( aEntry.GetBuffer(), "r" )) != NULL )
+ {
+ sReturn = aEntry;
+ fclose(fp);
+ break;
+ }
+ }
+ if ( sReturn == "" )
+ {
+ sEnv = sEnv.ToUpperAscii();
+ ByteString sEnvironment = getenv(sEnv.GetBuffer() );
+ ULONG nCount = sEnvironment.GetTokenCount( cPathSeperator );
+ for ( ULONG i=0; i<nCount; i++ )
+ {
+ aEntry = sEnvironment.GetToken(i, cPathSeperator );
+#ifndef UNX
+ aEntry += '\\';
+#else
+ aEntry += '/';
+#endif
+ aEntry += sItem;
+ if (( fp = fopen( aEntry.GetBuffer(), "r" )) != NULL )
+ {
+ sReturn = aEntry;
+ fclose(fp);
+ break;
+ }
+ }
+ }
+ if ( sReturn == "" )
+ fprintf(stderr, "WARNING: %s not found in %s\n",
+ sItem.GetBuffer(), sEnv.GetBuffer() );
+ return sReturn;
+}
+
+/*****************************************************************************/
+CCommandd::CCommandd( ByteString &rString, CommandBits nBits )
+/*****************************************************************************/
+ : CCommand( rString ),
+ nFlag( nBits )
+{
+}
+
+
+/*****************************************************************************/
+CCommandd::CCommandd( const char *pChar, CommandBits nBits )
+/*****************************************************************************/
+ : CCommand( pChar ),
+ nFlag( nBits )
+{
+}
+
+/*****************************************************************************/
+CCommandd::operator const int()
+/*****************************************************************************/
+{
+ int nRet = 0;
+
+#ifdef WNT
+ LPCTSTR lpApplicationName = NULL;
+ LPTSTR lpCommandLine = (char *) GetCommandLine_().GetBuffer();
+ LPSECURITY_ATTRIBUTES lpProcessAttributes = NULL;
+ LPSECURITY_ATTRIBUTES lpThreadAttributes = NULL;
+ BOOL bInheritHandles = TRUE;
+
+ // wie wuenschen wir denn gestartet zu werden ??
+ DWORD dwCreationFlags;
+
+ if ( nFlag & COMMAND_EXECUTE_START )
+ DWORD dwCreationFlags = DETACHED_PROCESS;
+ else
+ dwCreationFlags = CREATE_NEW_CONSOLE;
+
+ // wir erben vom Vaterprozess
+ LPVOID lpEnvironment = NULL;
+
+ // das exe im Pfad suchen
+ LPCTSTR lpCurrentDirectory = NULL;
+
+ // in dieser Struktur bekommen wir die erzeugte Processinfo
+ // zurueck
+ PROCESS_INFORMATION aProcessInformation;
+
+ // weiteres Startupinfo anlegen
+ STARTUPINFO aStartupInfo;
+
+ aStartupInfo.cb = sizeof( STARTUPINFO );
+ aStartupInfo.lpReserved = NULL;
+ aStartupInfo.lpDesktop = NULL;
+
+ // das Fenster bekommt den Namen des Exes
+ aStartupInfo.lpTitle = NULL;
+ aStartupInfo.dwX = 100;
+ aStartupInfo.dwY = 100;
+ //aStartupInfo.dwXSize = 400;
+ //aStartupInfo.dwYSize = 400;
+ aStartupInfo.dwXCountChars = 40;
+ aStartupInfo.dwYCountChars = 40;
+
+ // Farben setzen
+ aStartupInfo.dwFillAttribute = FOREGROUND_RED | BACKGROUND_RED |
+ BACKGROUND_BLUE | BACKGROUND_GREEN;
+
+// aStartupInfo.dwFlags = STARTF_USESTDHANDLES;
+ //aStartupInfo.wShowWindow = SW_NORMAL; //SW_SHOWDEFAULT;
+ //aStartupInfo.wShowWindow = SW_HIDE; //SW_SHOWNOACTIVATE;
+ aStartupInfo.wShowWindow = SW_SHOWNOACTIVATE;
+ aStartupInfo.cbReserved2 = NULL;
+ aStartupInfo.lpReserved2 = NULL;
+ //aStartupInfo.hStdInput = stdin;
+ //aStartupInfo.hStdOutput = stdout;
+ //aStartupInfo.hStdError = stderr;
+
+ if ( nFlag & COMMAND_EXECUTE_HIDDEN )
+ {
+ aStartupInfo.wShowWindow = SW_HIDE;
+ aStartupInfo.dwFlags = aStartupInfo.dwFlags | STARTF_USESHOWWINDOW;
+ }
+
+ BOOL bProcess = CreateProcess( lpApplicationName,
+ lpCommandLine, lpProcessAttributes,
+ lpThreadAttributes, bInheritHandles,
+ dwCreationFlags, lpEnvironment, lpCurrentDirectory,
+ &aStartupInfo, &aProcessInformation );
+
+ LPVOID lpMsgBuf;
+
+ if ( bProcess )
+ {
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ NULL );
+
+ ByteString aErrorString = (char *) lpMsgBuf;
+
+ if ( nFlag & COMMAND_EXECUTE_WAIT )
+ {
+ DWORD aProcessState = STILL_ACTIVE;
+ BOOL bTest;
+
+ while(aProcessState == STILL_ACTIVE)
+ {
+ bTest = GetExitCodeProcess(aProcessInformation.hProcess,&aProcessState);
+ }
+ }
+ }
+ else
+ fprintf( stderr, "Can not start Process !" );
+
+#endif
+ return nRet;
+}
diff --git a/tools/bootstrp/cppdep.cxx b/tools/bootstrp/cppdep.cxx
new file mode 100644
index 000000000000..9040917ae393
--- /dev/null
+++ b/tools/bootstrp/cppdep.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * $RCSfile: cppdep.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#ifdef WNT
+#ifdef BOOTSTRAPPER
+#include <glibc/posix/getopt.h>
+#else
+#include <glibc/getopt.h>
+#endif
+#endif
+#ifdef UNX
+#ifdef BOOTSTRAPPER
+#include <glibc/posix/getopt.h>
+#include <glibc/posix/config.h>
+#else
+#ifdef MAC
+#include <glibc/getopt.h>
+#endif
+#include <glibc/config.h>
+#endif
+#include <unistd.h>
+#endif
+#ifndef MAC
+#include <sys/stat.h>
+#else
+#include <stat.h>
+#endif
+
+#include <stream.hxx>
+
+#include "cppdep.hxx"
+
+//#define TEST
+
+CppDep::CppDep( ByteString aFileName )
+{
+ aSourceFile = aFileName;
+
+ pSearchPath = new ByteStringList;
+ pFileList = new ByteStringList;
+}
+
+CppDep::CppDep()
+{
+ pSources = new ByteStringList;
+ pSearchPath = new ByteStringList;
+ pFileList = new ByteStringList;
+}
+
+CppDep::~CppDep()
+{
+ delete pSearchPath;
+ delete pFileList;
+}
+
+void CppDep::Execute()
+{
+ ULONG nCount = pSources->Count();
+ for ( ULONG n=0; n<nCount;n++)
+ {
+ ByteString *pStr = pSources->GetObject(n);
+ Search( *pStr );
+ }
+}
+
+BOOL CppDep::AddSearchPath( const char* aPath )
+{
+ ByteString *pStr = new ByteString( aPath );
+ pSearchPath->Insert( pStr, LIST_APPEND );
+ return FALSE;
+}
+
+BOOL CppDep::AddSource( const char* aSource )
+{
+ ByteString *pStr = new ByteString( aSource );
+ pSources->Insert( pStr, LIST_APPEND );
+ return FALSE;
+}
+
+BOOL CppDep::Search( ByteString aFileName )
+{
+ //fprintf( stderr, "SEARCH : %s\n", aFileName.GetStr());
+ BOOL bRet = FALSE;
+
+ SvFileStream aFile;
+ ByteString aReadLine;
+
+ UniString suFileName( aFileName, gsl_getSystemTextEncoding());
+
+ aFile.Open( suFileName, STREAM_READ );
+ while ( aFile.ReadLine( aReadLine ))
+ {
+ USHORT nPos;
+ if ( nPos = aReadLine.Search( "include" ) != STRING_NOTFOUND )
+ {
+ //fprintf( stderr, "found : %d %s\n", nPos, aReadLine.GetStr() );
+ ByteString aResult = IsIncludeStatement( aReadLine );
+ //fprintf( stderr, "Result : %x\n", aResult.GetStr() );
+
+ ByteString aNewFile;
+ if ( aResult !="")
+ if ( (aNewFile = Exists( aResult )) != "" )
+ {
+ BOOL bFound = FALSE;
+ ULONG nCount = pFileList->Count();
+ for ( ULONG i=0; i<nCount; i++ )
+ {
+ ByteString *pStr = pFileList->GetObject(i);
+ if ( *pStr == aNewFile )
+ bFound = TRUE;
+ }
+ if ( !bFound )
+ {
+ pFileList->Insert( new ByteString( aNewFile ), LIST_APPEND );
+ //fprintf( stderr, " CppDep %s\\\n", aNewFile.GetStr() );
+ Search(aNewFile);
+ }
+ }
+ }
+ }
+ aFile.Close();
+
+ return bRet;
+}
+
+ByteString CppDep::Exists( ByteString aFileName )
+{
+ //fprintf( stderr, "Searching %s \n", aFileName.GetStr() );
+ ByteString aString;
+ ULONG nCount = pSearchPath->Count();
+ for ( ULONG n=0; n<nCount; n++)
+ {
+ struct stat aBuf;
+ ByteString *pPathName = pSearchPath->GetObject(n);
+
+ char *pFullName = new char[1023];
+ strcpy( pFullName, pPathName->GetBuffer());
+ strcat( pFullName, DIR_SEP );
+ strcat( pFullName, aFileName.GetBuffer());
+
+ //fprintf( stderr, "looking for %s\t ", pFullName );
+ if ( stat( pFullName, &aBuf ) == 0 )
+ {
+#ifdef DEBUG_VERBOSE
+ fprintf( stderr, "Got Dependency ", pFullName );
+#endif
+ //fprintf( stderr, "%s \\\n", pFullName );
+
+ return ByteString(pFullName);
+ }
+ delete pFullName;
+ }
+ return aString;
+}
+
+ByteString CppDep::IsIncludeStatement( ByteString aLine )
+{
+ ByteString aRetStr;
+ // WhiteSpacesfressen
+ aLine.EraseAllChars(' ');
+ aLine.EraseAllChars('\t');
+ //fprintf( stderr, "now : %s\n", aLine.GetStr() );
+ // ist der erste Teil ein #include ?
+ ByteString aTmpStr;
+ if ( (aTmpStr = aLine.Erase( 0, 8 )) == "#include" )
+ {
+ USHORT nLen = aLine.Len();
+ aLine.Erase( nLen-1, 1 );
+ aLine.Erase( 0, 1 );
+ //fprintf( stderr, "Gotcha : %s\n", aLine.GetStr() );
+ aRetStr = aLine;
+ }
+ return aRetStr;
+}
+
+#ifdef TEST
+
+int main( int argc, char **argv )
+{
+ CppDep *pDep = new CppDep( "cppdep.cxx" );
+ pDep->AddSearchPath(".");
+ pDep->AddSearchPath("/usr/include");
+ pDep->AddSearchPath("/usr/local/include");
+ pDep->AddSearchPath("/usr/include/sys");
+ pDep->AddSearchPath("/usr/include/X11");
+ pDep->Execute();
+ delete pDep;
+ return 0;
+}
+
+#endif
diff --git a/tools/bootstrp/cppdep.hxx b/tools/bootstrp/cppdep.hxx
new file mode 100644
index 000000000000..4cc92c3da06f
--- /dev/null
+++ b/tools/bootstrp/cppdep.hxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * $RCSfile: cppdep.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if SUPD < 356
+#include <tools.hxx>
+#else
+#include <list.hxx>
+#include <string.hxx>
+#endif
+
+#define PATH_SEP ":"
+#define DIR_SEP "/"
+
+DECLARE_LIST( ByteStringList, ByteString * );
+
+class CppDep
+{
+ ByteString aSourceFile;
+ ByteStringList *pSources;
+ ByteStringList *pSearchPath;
+ ByteStringList *pFileList;
+
+protected:
+ BOOL Search( ByteString aFileName );
+ ByteString Exists( ByteString aFileName );
+
+ ByteString IsIncludeStatement( ByteString aLine );
+public:
+ CppDep( ByteString aFileName );
+ CppDep();
+ ~CppDep();
+ virtual void Execute();
+
+ ByteStringList* GetDepList(){return pFileList;}
+ BOOL AddSearchPath( const char* aPath );
+ BOOL AddSource( const char * aSource );
+};
+
diff --git a/tools/bootstrp/inimgr.cxx b/tools/bootstrp/inimgr.cxx
new file mode 100644
index 000000000000..f2d75d03e258
--- /dev/null
+++ b/tools/bootstrp/inimgr.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * $RCSfile: inimgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#if !defined( UNX ) && !defined( MAC )
+#include <direct.h>
+#else
+#ifndef MAC
+#include <sys/stat.h>
+#else
+#include <stat.h>
+#endif
+#endif
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#include "inimgr.hxx"
+#include "appdef.hxx"
+#include "fattr.hxx"
+
+/****************************************************************************/
+IniManager::IniManager( ByteString &rDir, ByteString &rLocalDir )
+/****************************************************************************/
+ : bUpdate( TRUE )
+{
+ sLocalPath = ByteString( getenv( "LOCALINI" ));
+ if ( !sLocalPath.Len())
+ sLocalPath = rLocalDir;
+
+ sGlobalDir = rDir;
+#if !defined( UNX ) && !defined( MAC )
+ mkdir(( char * ) sLocalPath.GetBuffer());
+#else
+ mkdir( sLocalPath.GetBuffer() ,00777 );
+#endif
+}
+
+/****************************************************************************/
+IniManager::IniManager( ByteString &rDir )
+/****************************************************************************/
+ : bUpdate( TRUE )
+{
+ sLocalPath = GetLocalIni();
+ sGlobalDir = rDir;
+#if !defined( UNX ) && !defined( MAC )
+ mkdir(( char * ) sLocalPath.GetBuffer());
+#else
+ mkdir( sLocalPath.GetBuffer() ,00777 );
+#endif
+}
+
+/****************************************************************************/
+IniManager::IniManager()
+/****************************************************************************/
+ : bUpdate( TRUE )
+{
+ sLocalPath = GetLocalIni();
+
+#if !defined( UNX ) && !defined( MAC )
+ mkdir(( char * ) sLocalPath.GetBuffer());
+#else
+ mkdir( sLocalPath.GetBuffer(), 00777 );
+#endif
+
+ sGlobalDir = ByteString( _INIROOT );
+}
+
+/****************************************************************************/
+ByteString IniManager::ToLocal( ByteString &rPath )
+/****************************************************************************/
+{
+ ByteString sTmp( rPath );
+#if !defined( UNX )
+ ByteString sUnc( _INI_UNC );
+ sUnc.ToUpperAscii();
+ ByteString sOldUnc( _INI_UNC_OLD );
+ sOldUnc.ToUpperAscii();
+ sTmp.ToUpperAscii();
+
+ sTmp.SearchAndReplace( sUnc, _INI_DRV );
+ sTmp.SearchAndReplace( sOldUnc, _INI_DRV );
+ sTmp.ToUpperAscii();
+
+ ByteString sIni( sGlobalDir );
+ sIni.ToUpperAscii();
+
+#ifndef MAC
+ sTmp.SearchAndReplace( sIni, sLocalPath );
+#else
+ sTmp.SearchAndReplace( sIni, GetIniRootOld() );
+#endif
+
+ while ( sTmp.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND );
+#ifdef MAC
+ while ( sTmp.SearchAndReplace( "\\", ":" ) != STRING_NOTFOUND );
+ while ( sTmp.SearchAndReplace( "::", ":" ) != STRING_NOTFOUND );
+#endif
+#else
+ sTmp.SearchAndReplace( sGlobalDir, sLocalPath );
+
+ ByteString sOldGlobalDir( GetIniRootOld() );
+ sTmp.SearchAndReplace( sOldGlobalDir, sLocalPath );
+
+ while ( sTmp.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND );
+#endif
+
+ return sTmp;
+}
+
+/****************************************************************************/
+ByteString IniManager::GetLocalIni()
+/****************************************************************************/
+{
+ ByteString sLocalPath = ByteString( getenv( "LOCALINI" ));
+
+ if ( !sLocalPath.Len()) {
+#ifdef UNX
+ ByteString sLocal( getenv( "HOME" ));
+ sLocal += ByteString( "/localini" );
+#else
+#ifdef MAC
+ ByteString sLocal( getenv( "TEMP" ));
+ sLocal += ByteString( ":localini" );
+#else
+ ByteString sLocal( getenv( "TMP" ));
+ sLocal += ByteString( "\\localini" );
+#endif
+#endif
+
+ sLocalPath = sLocal;
+ }
+
+ return sLocalPath;
+}
+
+/****************************************************************************/
+void IniManager::ForceUpdate()
+/****************************************************************************/
+{
+ UniString sUniGlobalDir( sGlobalDir, gsl_getSystemTextEncoding());
+ DirEntry aPath( UniString( sGlobalDir, gsl_getSystemTextEncoding()));
+ Dir aDir( aPath, FSYS_KIND_DIR | FSYS_KIND_FILE);
+
+#ifndef UNX
+#ifndef MAC
+ sLocalPath.EraseTrailingChars( '\\' );
+ sLocalPath += "\\";
+#else
+ sLocalPath.EraseTrailingChars( ':' );
+ sLocalPath += ":";
+#endif
+#else
+ sLocalPath.EraseTrailingChars( '/' );
+ sLocalPath += "/";
+#endif
+
+ for ( USHORT i=0; i < aDir.Count(); i++ ) {
+ ByteString sEntry( aDir[i].GetName(), gsl_getSystemTextEncoding());
+ if (( sEntry != "." ) &&
+ ( sEntry != ".." ))
+ {
+ if ( !FileStat( aDir[i] ).IsKind( FSYS_KIND_DIR )) {
+ ByteString sSrc( aDir[i].GetFull(), gsl_getSystemTextEncoding());
+ ByteString sDestination( sLocalPath );
+ sDestination += sEntry;
+
+ UniString sUniDestination( sDestination, gsl_getSystemTextEncoding());
+ DirEntry aDestEntry( sUniDestination );
+ FileStat aDestStat( aDestEntry );
+ FileStat aSrcStat( aDir[i] );
+
+ if (( !aDestEntry.Exists() ) ||
+ ( aSrcStat.IsYounger( aDestStat )))
+ {
+ FileCopier aFileCopier( aDir[ i ], aDestEntry );
+ aFileCopier.Execute();
+ BOOL bWorkaround = FALSE;
+
+ while ( !aDestEntry.Exists())
+ aFileCopier.Execute();
+ }
+ }
+ }
+ }
+}
+
+/****************************************************************************/
+void IniManager::Update()
+/****************************************************************************/
+{
+ if ( bUpdate )
+ {
+ ForceUpdate();
+ bUpdate = FALSE;
+ }
+}
diff --git a/tools/bootstrp/iserver.cxx b/tools/bootstrp/iserver.cxx
new file mode 100644
index 000000000000..7a8f12c1adba
--- /dev/null
+++ b/tools/bootstrp/iserver.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: iserver.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "iparser.hxx"
+#include "geninfo.hxx"
+#include "appdef.hxx"
+#include <stdio.h>
+
+
+/*****************************************************************************/
+#ifdef UNX
+int main( int argc, char *argv[] )
+#else
+int _cdecl main( int argc, char *argv[] )
+#endif
+/*****************************************************************************/
+{
+ if ( argc == 1 ) {
+ fprintf( stdout, "\ni_server.exe v2.0 (c) 2000\n\n" );
+ fprintf( stdout, "Syntax: i_server -i accesspath [-l] [-d database] \n" );
+ fprintf( stdout, "Example: - i_server -i vcl364/settings/now\n" );
+ fprintf( stdout, " returns value of settings \"now\" of version \"vcl364\"\n" );
+ fprintf( stdout, " - i_server -i vcl364/settings -l\n" );
+ fprintf( stdout, " returns a list of all settings of version \"vcl364\"\n" );
+ }
+ else {
+ BOOL bError = FALSE;
+ BOOL bList = FALSE;
+ ByteString sInfo( "" );
+ ByteString sDataBase( GetDefStandList());
+
+ BOOL bGetNow = FALSE;
+
+ int nCount = 1;
+ while (( nCount < argc ) &&
+ ( !bError ))
+ {
+ if ( ByteString( argv[nCount] ).ToUpperAscii() == "-I" ) {
+ // requestet info path
+ nCount++;
+ if( nCount < argc ) {
+ sInfo = ByteString( argv[nCount] );
+ nCount++;
+ }
+ else bError = TRUE;
+ }
+ else if ( ByteString( argv[nCount] ).ToUpperAscii() == "-D" ) {
+ // requestet info path
+ nCount++;
+ if( nCount < argc ) {
+ sDataBase = ByteString( argv[nCount] );
+ nCount++;
+ }
+ else bError = TRUE;
+ }
+ else if ( ByteString( argv[nCount] ).ToUpperAscii() == "-L" ) {
+ // request list of childs
+ nCount++;
+ bList = TRUE;
+ }
+ else if ( ByteString( argv[nCount] ).ToUpperAscii() == "-N" ) {
+ // request list of childs
+ nCount++;
+ bGetNow = TRUE;
+ }
+ else {
+ bError = TRUE;
+ }
+ }
+
+ if ( !bError ) {
+ InformationParser aParser( REPLACE_VARIABLES );
+ ByteString sStandList( sDataBase );
+ GenericInformationList *pList = aParser.Execute( String( sStandList, gsl_getSystemTextEncoding()));
+ if ( !pList )
+ return 1;
+
+ if ( sInfo.Len()) {
+ GenericInformation *pInfo = pList->GetInfo( sInfo, TRUE );
+
+ if ( pInfo ) {
+ ByteString sValue( pInfo->GetValue());
+ // show the info and its value
+ fprintf( stdout, "%s %s\n", pInfo->GetBuffer(), sValue.GetBuffer());
+ if ( bList ) {
+ GenericInformationList *pList = pInfo->GetSubList();
+ if ( pList ) {
+ // show whole list of childs and their values
+ for( ULONG i = 0; i < pList->Count(); i++ ) {
+ GenericInformation *pInfo = pList->GetObject( i );
+ ByteString sValue( pInfo->GetValue());
+ fprintf( stdout, " %s %s\n", pInfo->GetBuffer(), sValue.GetBuffer());
+ }
+ }
+ }
+ return 0;
+ }
+ return 1;
+ }
+ else {
+ // show whole list of childs and their values
+ for( ULONG i = 0; i < pList->Count(); i++ ) {
+ GenericInformation *pInfo = pList->GetObject( i );
+ if ( bGetNow ) {
+ ByteString sPath( "settings/now" );
+ GenericInformation *pSubInfo = pInfo->GetSubInfo( sPath, TRUE );
+ if ( pSubInfo && pSubInfo->GetValue() == "_TRUE" )
+ fprintf( stdout, "%s\n", pInfo->GetBuffer());
+ }
+ else {
+ ByteString sValue( pInfo->GetValue());
+ fprintf( stdout, " %s %s\n", pInfo->GetBuffer(), sValue.GetBuffer());
+ }
+ }
+ return 0;
+ }
+ }
+ else
+ fprintf( stderr, "%s: Fehler in der Kommandozeile!", argv[0] );
+ // command line arror !!!
+ }
+
+ return 1;
+}
+
diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk
new file mode 100644
index 000000000000..f49b01b11bd2
--- /dev/null
+++ b/tools/bootstrp/makefile.mk
@@ -0,0 +1,205 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:02:59 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=tools
+TARGET=bootstrp
+TARGETTYPE=CUI
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+.INCLUDE : static.mk
+
+CDEFS+=-D_TOOLS_STRINGLIST
+
+# --- Files --------------------------------------------------------
+
+.IF "$(OS)"=="MACOS"
+dummy:
+ @echo No bootstrp for Mac OS
+.ELSE # "$(OS)"=="MACOS"
+
+OBJFILES= \
+ $(OBJ)$/sstring.obj \
+ $(OBJ)$/appdef.obj \
+ $(OBJ)$/cppdep.obj \
+ $(OBJ)$/command.obj \
+ $(OBJ)$/prj.obj \
+ $(OBJ)$/dlvclass.obj \
+ $(OBJ)$/hashtbl.obj \
+ $(OBJ)$/errdumm.obj \
+ $(OBJ)$/errhdl.obj \
+ $(OBJ)$/hedabu.obj \
+ $(OBJ)$/inimgr.obj \
+ $(OBJ)$/revision.obj \
+ $(OBJ)$/shellprp.obj \
+ $(OBJ)$/minormk.obj \
+ $(OBJ)$/fattr.obj
+
+.IF "$(UPD)" < "590"
+OBJFILES += \
+ $(OBJ)$/geninfo.obj \
+ $(OBJ)$/parser.obj
+.ENDIF
+
+SLOFILES= \
+ $(SLO)$/sstring.obj \
+ $(SLO)$/appdef.obj \
+ $(SLO)$/cppdep.obj \
+ $(SLO)$/command.obj \
+ $(SLO)$/prj.obj \
+ $(SLO)$/dlvclass.obj \
+ $(SLO)$/hashtbl.obj \
+ $(SLO)$/errdumm.obj \
+ $(SLO)$/errhdl.obj \
+ $(SLO)$/hedabu.obj \
+ $(SLO)$/inimgr.obj \
+ $(SLO)$/revision.obj \
+ $(SLO)$/shellprp.obj \
+ $(SLO)$/minormk.obj \
+ $(SLO)$/fattr.obj
+
+.IF "$(UPD)" < "590"
+SLOFILES += \
+ $(SLO)$/geninfo.obj \
+ $(SLO)$/parser.obj
+.ENDIF
+
+LIB1TARGET= $(LB)$/btstrp.lib
+LIB1ARCHIV= $(LB)$/libbtstrp.a
+LIB1FILES= $(LB)$/bootstrp.lib
+
+LIB2TARGET= $(SLB)$/btstrpsh.lib
+LIB2ARCHIV= $(SLB)$/libbtstrpsh.a
+LIB2FILES= $(SLB)$/bootstrp.lib
+
+LIB3TARGET=$(LB)$/bsvermap.lib
+LIB3ARCHIV= $(LB)$/libbsvermap.a
+LIB3OBJFILES=\
+ $(OBJ)$/vermap.obj
+
+APP1TARGET= i_server
+APP1STACK= 16000
+APP1OBJS= $(OBJ)$/iserver.obj
+APP1STDLIBS=$(STATIC_LIBS)
+APP1LIBS= $(LB)$/bootstrp.lib
+APP1DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP2TARGET= copyprj
+APP2OBJS= $(OBJ)$/cprjexe.obj $(OBJ)$/copyprj.obj
+APP2STDLIBS=$(STATIC_LIBS)
+APP2LIBS= $(LB)$/bootstrp.lib
+APP2DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP3TARGET=rscdep
+APP3OBJS= $(OBJ)$/rscdep.obj
+APP3STDLIBS=$(STATIC_LIBS)
+APP3LIBS= $(LB)$/bootstrp.lib
+APP3DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP4TARGET=mkcreate
+APP4OBJS= $(OBJ)$/mkcrexe.obj $(OBJ)$/mkcreate.obj
+APP4STDLIBS=$(STATIC_LIBS)
+APP4LIBS= $(LB)$/bootstrp.lib
+APP4DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP5TARGET= setsolar
+APP5OBJS= $(OBJ)$/setsolar.obj $(OBJ)$/envset.obj $(OBJ)$/vermap.obj
+APP5STDLIBS=$(STATIC_LIBS)
+APP5LIBS= $(LB)$/bootstrp.lib
+APP5DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP6TARGET= build
+APP6OBJS= $(OBJ)$/make.obj $(OBJ)$/updmake.obj $(OBJ)$/allmake.obj
+APP6STDLIBS=$(STATIC_LIBS)
+APP6LIBS= $(LB)$/bootstrp.lib
+APP6DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+APP7TARGET= deliver
+APP7OBJS= $(OBJ)$/deliver.obj
+APP7STDLIBS=$(STATIC_LIBS)
+APP7LIBS= $(LB)$/bootstrp.lib
+APP7DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+APP7STACK= 16384
+
+APP8TARGET= makedepn
+APP8OBJS= $(OBJ)$/makedepn.obj
+APP8STDLIBS=$(STATIC_LIBS)
+APP8DEPN= $(LB)$/atools.lib
+
+APP9TARGET= _mkout
+APP9LINKTYPE=STATIC
+APP9OBJS= $(OBJ)$/mkout.obj
+APP9STDLIBS=$(STATIC_LIBS)
+APP9LIBS= $(LB)$/bootstrp.lib
+APP9DEPN= $(LB)$/atools.lib $(LB)$/bootstrp.lib
+
+DEPOBJFILES = $(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS) $(APP7OBJS) $(APP8OBJS) $(APP9OBJS)
+
+.ENDIF # "$(OS)"=="MACOS"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/bootstrp/mkcreate.cxx b/tools/bootstrp/mkcreate.cxx
new file mode 100644
index 000000000000..f6bd8addb1fc
--- /dev/null
+++ b/tools/bootstrp/mkcreate.cxx
@@ -0,0 +1,1017 @@
+/*************************************************************************
+ *
+ * $RCSfile: mkcreate.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:02:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// global includes
+#include <stdio.h>
+
+// local includes
+#include "mkcreate.hxx"
+#include "inimgr.hxx"
+#include "appdef.hxx"
+#include "geninfo.hxx"
+#include "iparser.hxx"
+#include "prj.hxx"
+
+char *NoBuildProject[] = {
+ "solenv",
+ "EndOf_NoBuildProject"
+};
+
+char *LimitedPath[] = {
+ "jurt\\com\\sun\\star",
+ "r_tools",
+ "setup2",
+ "EndOf_LimitedPath"
+};
+
+//
+// class SourceDirectory
+//
+
+/*****************************************************************************/
+SourceDirectory::SourceDirectory( const ByteString &rDirectoryName,
+ USHORT nOperatingSystem, SourceDirectory *pParentDirectory )
+/*****************************************************************************/
+ : ByteString( rDirectoryName ),
+ pParent( pParentDirectory ),
+ nOSType( nOperatingSystem ),
+ pSubDirectories( NULL ),
+ nDepth( 0 ),
+ pDependencies( NULL ),
+ pCodedDependencies( NULL ),
+ pCodedIdentifier( NULL )
+{
+ if ( pParent ) {
+ if ( !pParent->pSubDirectories )
+ pParent->pSubDirectories = new SourceDirectoryList();
+ pParent->pSubDirectories->InsertSorted( this );
+ nDepth = pParent->nDepth + 1;
+ }
+}
+
+/*****************************************************************************/
+SourceDirectory::~SourceDirectory()
+/*****************************************************************************/
+{
+ delete pSubDirectories;
+}
+
+/*****************************************************************************/
+CodedDependency *SourceDirectory::AddCodedDependency(
+ const ByteString &rCodedIdentifier, USHORT nOperatingSystems )
+/*****************************************************************************/
+{
+ CodedDependency *pReturn = NULL;
+
+ if ( !pCodedDependencies ) {
+ pCodedDependencies = new SByteStringList();
+ pReturn = new CodedDependency( rCodedIdentifier, nOperatingSystems );
+ pCodedDependencies->PutString(( ByteString * ) pReturn );
+ }
+ else {
+ ULONG nPos =
+ pCodedDependencies->IsString( & ( ByteString ) rCodedIdentifier );
+ if ( nPos == NOT_THERE ) {
+ pReturn =
+ new CodedDependency( rCodedIdentifier, nOperatingSystems );
+ pCodedDependencies->PutString(( ByteString * ) pReturn );
+ }
+ else {
+ pReturn =
+ ( CodedDependency * ) pCodedDependencies->GetObject( nPos );
+ pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems );
+ }
+ }
+ return pReturn;
+}
+
+/*****************************************************************************/
+CodedDependency *SourceDirectory::AddCodedIdentifier(
+ const ByteString &rCodedIdentifier, USHORT nOperatingSystems )
+/*****************************************************************************/
+{
+ CodedDependency *pReturn = NULL;
+
+ if ( !pCodedIdentifier ) {
+ pCodedIdentifier = new SByteStringList();
+ pReturn = new CodedDependency( rCodedIdentifier, nOperatingSystems );
+ pCodedIdentifier->PutString(( ByteString * ) pReturn );
+ }
+ else {
+ ULONG nPos =
+ pCodedIdentifier->IsString( & ( ByteString ) rCodedIdentifier );
+ if ( nPos == NOT_THERE ) {
+ pReturn =
+ new CodedDependency( rCodedIdentifier, nOperatingSystems );
+ pCodedIdentifier->PutString(( ByteString * ) pReturn );
+ }
+ else {
+ pReturn =
+ ( CodedDependency * ) pCodedIdentifier->GetObject( nPos );
+ pReturn->TryToMerge( rCodedIdentifier, nOperatingSystems );
+ }
+ }
+ if ( pParent && pParent->nDepth > 1 )
+ pParent->AddCodedIdentifier( rCodedIdentifier, nOperatingSystems );
+
+ return pReturn;
+}
+
+/*****************************************************************************/
+ByteString SourceDirectory::GetFullPath()
+/*****************************************************************************/
+{
+ ByteString sFullPath;
+ if ( pParent ) {
+ sFullPath = pParent->GetFullPath();
+ sFullPath += ByteString( PATH_SEPARATOR );
+ }
+ sFullPath += *this;
+
+ return sFullPath;
+}
+
+/*****************************************************************************/
+SourceDirectory *SourceDirectory::GetRootDirectory()
+/*****************************************************************************/
+{
+ if ( !pParent )
+ return this;
+
+ return pParent->GetRootDirectory();
+}
+
+/*****************************************************************************/
+SourceDirectory *SourceDirectory::GetSubDirectory(
+ const ByteString &rDirectoryPath, USHORT nOperatingSystem )
+/*****************************************************************************/
+{
+ ByteString sSearch;
+
+ BOOL bSubs = TRUE;
+ ULONG nIndex = 0;
+
+ while ( bSubs && ByteString( LimitedPath[ nIndex ]) != "EndOf_LimitedPath" ) {
+ SourceDirectory *pActDir = this;
+ ByteString sLimitation( LimitedPath[ nIndex ]);
+
+ BOOL bBreak = FALSE;
+ for ( ULONG i = sLimitation.GetTokenCount( '\\' ); i > 0 && !bBreak; i-- ) {
+ if ( !pActDir || ( *pActDir != sLimitation.GetToken( i - 1, '\\' )))
+ bBreak = TRUE;
+ else
+ pActDir = pActDir->pParent;
+ }
+ bSubs = bBreak;
+ nIndex++;
+ }
+
+ if ( !bSubs )
+ {
+ sSearch = rDirectoryPath;
+ }
+ else
+ sSearch = rDirectoryPath.GetToken( 0, PATH_SEPARATOR );
+
+ SourceDirectory *pSubDirectory = NULL;
+
+ if ( pSubDirectories )
+ pSubDirectory = pSubDirectories->Search( sSearch );
+
+ if ( !pSubDirectory )
+ pSubDirectory = new SourceDirectory(
+ sSearch, nOperatingSystem, this );
+
+ pSubDirectory->nOSType |= nOperatingSystem;
+
+ if ( sSearch.Len() == rDirectoryPath.Len())
+ return pSubDirectory;
+
+ ByteString sPath = rDirectoryPath.Copy( sSearch.Len() + 1 );
+
+ return pSubDirectory->GetSubDirectory( sPath, nOperatingSystem );
+}
+
+/*****************************************************************************/
+SourceDirectory *SourceDirectory::GetDirectory(
+ const ByteString &rDirectoryName, USHORT nOperatingSystem )
+/*****************************************************************************/
+{
+ ByteString sDirectoryName( rDirectoryName );
+#ifdef UNX
+ sDirectoryName.SearchAndReplaceAll( "\\", "/" );
+#endif
+
+ SourceDirectory *pRoot = GetRootDirectory();
+
+ if ( sDirectoryName.Search( *pRoot ) != 0 )
+ return NULL;
+
+ if ( sDirectoryName.Len() == pRoot->Len())
+ return pRoot;
+
+ if ( sDirectoryName.GetChar( pRoot->Len()) == PATH_SEPARATOR ) {
+ ByteString sSub = sDirectoryName.Copy( pRoot->Len() + 1 );
+ return pRoot->GetSubDirectory( sSub, nOperatingSystem );
+ }
+
+ return NULL;
+}
+
+/*****************************************************************************/
+SourceDirectory *SourceDirectory::Insert( const ByteString &rDirectoryName,
+ USHORT nOperatingSystem )
+/*****************************************************************************/
+{
+ SourceDirectory *pSubDirectory = NULL;
+ if ( pSubDirectories )
+ pSubDirectory = pSubDirectories->Search( rDirectoryName );
+
+ if ( !pSubDirectory )
+ pSubDirectory = new SourceDirectory(
+ rDirectoryName, nOperatingSystem, this );
+
+ return pSubDirectory;
+}
+
+/*****************************************************************************/
+Dependency *SourceDirectory::ResolvesDependency(
+ CodedDependency *pCodedDependency )
+/*****************************************************************************/
+{
+ if ( !pCodedIdentifier )
+ return NULL;
+
+ ULONG nPos = pCodedIdentifier->IsString( pCodedDependency );
+ if ( nPos != NOT_THERE ) {
+ CodedDependency *pIdentifier =
+ ( CodedDependency * ) pCodedIdentifier->GetObject( nPos );
+ USHORT nResult =
+ pIdentifier->GetOperatingSystem() &
+ pCodedDependency->GetOperatingSystem();
+ Dependency *pReturn = new Dependency( *this, nResult );
+ nResult ^= pCodedDependency->GetOperatingSystem();
+ pCodedDependency->SetOperatingSystem( nResult );
+ return pReturn;
+ }
+ return NULL;
+}
+
+
+/*****************************************************************************/
+void SourceDirectory::ResolveDependencies()
+/*****************************************************************************/
+{
+ if ( !pSubDirectories )
+ return;
+
+ for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
+ SourceDirectory *pActDirectory =
+ ( SourceDirectory * ) pSubDirectories->GetObject( i );
+ if ( pActDirectory->pSubDirectories )
+ pActDirectory->ResolveDependencies();
+
+ if ( pActDirectory->pCodedDependencies ) {
+ while ( pActDirectory->pCodedDependencies->Count())
+ {
+ CodedDependency *pCodedDependency = ( CodedDependency * )
+ pActDirectory->pCodedDependencies->GetObject(( ULONG ) 0 );
+
+ for (
+ ULONG k = 0;
+ ( k < pSubDirectories->Count()) &&
+ ( pCodedDependency->GetOperatingSystem() != OS_NONE );
+ k++
+ ) {
+ Dependency *pDependency = NULL;
+ if ( pDependency =
+ (( SourceDirectory * ) pSubDirectories->GetObject( k ))->
+ ResolvesDependency( pCodedDependency ))
+ {
+ if ( !pActDirectory->pDependencies )
+ pActDirectory->pDependencies = new SByteStringList();
+ pActDirectory->pDependencies->PutString( pDependency );
+ }
+ }
+ if ( pCodedDependency->GetOperatingSystem()) {
+ if ( !pCodedDependencies )
+ pCodedDependencies = new SByteStringList();
+ pCodedDependencies->PutString( pCodedDependency );
+ }
+ else
+ delete pCodedDependency;
+ pActDirectory->pCodedDependencies->Remove(( ULONG ) 0 );
+ }
+ }
+ }
+}
+
+/*****************************************************************************/
+ByteString SourceDirectory::GetTarget()
+/*****************************************************************************/
+{
+ ByteString sReturn;
+
+ if ( !pDependencies )
+ return sReturn;
+
+ ULONG k = 0;
+ while ( k < pDependencies->Count()) {
+ if ( *this == *pDependencies->GetObject( k ))
+ delete pDependencies->Remove( k );
+ else
+ k++;
+ }
+
+ if ( !pDependencies->Count()) {
+ delete pDependencies;
+ pDependencies = NULL;
+ return sReturn;
+ }
+
+ BOOL bDependsOnPlatform = FALSE;
+ for ( ULONG i = 0; i < pDependencies->Count(); i++ )
+ if ((( Dependency * ) pDependencies->GetObject( i ))->
+ GetOperatingSystem() != OS_ALL )
+ bDependsOnPlatform = TRUE;
+
+ ByteString sTarget( *this );
+ sTarget.SearchAndReplaceAll( "\\", "$/" );
+ if ( !bDependsOnPlatform ) {
+ sReturn = sTarget;
+ sReturn += " :";
+ for ( ULONG i = 0; i < pDependencies->Count(); i++ ) {
+ ByteString sDependency( *pDependencies->GetObject( i ));
+ sDependency.SearchAndReplaceAll( "\\", "$/" );
+ sReturn += " ";
+ sReturn += sDependency;
+ }
+ }
+ else {
+ ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" );
+ sUNX += sTarget;
+ sUNX += " :";
+ BOOL bUNX = FALSE;
+
+ ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" );
+ sWNT += sTarget;
+ sWNT += " :";
+ BOOL bWNT = FALSE;
+
+// ByteString sWIN( ".IF \"$(GUI)\" == \"WIN\"\n" );
+// sWIN += sTarget;
+// sWIN += " :";
+// BOOL bWIN = FALSE;
+
+ ByteString sMAC( ".IF \"$(GUI)\" == \"MAC\"\n" );
+ sMAC += sTarget;
+ sMAC += " :";
+ BOOL bMAC = FALSE;
+
+ ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" );
+ sOS2 += sTarget;
+ sOS2 += " :";
+ BOOL bOS2 = FALSE;
+
+ for ( ULONG i = 0; i < pDependencies->Count(); i++ ) {
+ Dependency *pDependency =
+ ( Dependency * ) pDependencies->GetObject( i );
+ ByteString sDependency( *pDependency );
+ sDependency.SearchAndReplaceAll( "\\", "$/" );
+
+ if ( pDependency->GetOperatingSystem() & OS_UNX ) {
+ sUNX += " ";
+ sUNX += sDependency;
+ bUNX = TRUE;
+ }
+ if ( pDependency->GetOperatingSystem() & OS_WIN32 ) {
+ sWNT += " ";
+ sWNT += sDependency;
+ bWNT = TRUE;
+ }
+// if ( pDependency->GetOperatingSystem() & OS_WIN16 ) {
+// sWIN += " ";
+// sWIN += sDependency;
+// bWIN = TRUE;
+// }
+ if ( pDependency->GetOperatingSystem() & OS_MAC ) {
+ sMAC += " ";
+ sMAC += sDependency;
+ bMAC = TRUE;
+ }
+ if ( pDependency->GetOperatingSystem() & OS_OS2 ) {
+ sOS2 += " ";
+ sOS2 += sDependency;
+ bOS2 = TRUE;
+ }
+ }
+
+ if ( bUNX ) {
+ sReturn += sUNX;
+ sReturn += "\n.ENDIF\n";
+ }
+ if ( bWNT ) {
+ sReturn += sWNT;
+ sReturn += "\n.ENDIF\n";
+ }
+// if ( bWIN ) {
+// sReturn += sWIN;
+// sReturn += "\n.ENDIF\n";
+// }
+ if ( bMAC ) {
+ sReturn += sMAC;
+ sReturn += "\n.ENDIF\n";
+ }
+ if ( bOS2 ) {
+ sReturn += sOS2;
+ sReturn += "\n.ENDIF\n";
+ }
+ }
+ sReturn.EraseTrailingChars( '\n' );
+ return sReturn;
+}
+
+/*****************************************************************************/
+ByteString SourceDirectory::GetSubDirsTarget()
+/*****************************************************************************/
+{
+ ByteString sReturn;
+
+ if ( pSubDirectories ) {
+ BOOL bDependsOnPlatform = FALSE;
+ for ( ULONG i = 0; i < pSubDirectories->Count(); i++ )
+ if ((( SourceDirectory * ) pSubDirectories->GetObject( i ))->
+ GetOperatingSystems() != OS_ALL )
+ bDependsOnPlatform = TRUE;
+
+ if ( !bDependsOnPlatform ) {
+ sReturn = "RC_SUBDIRS = ";
+
+ for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
+ ByteString sSubDirectory( *pSubDirectories->GetObject( i ));
+ sSubDirectory.SearchAndReplaceAll( "\\", "$/" );
+ sReturn += " \\\n\t";
+ sReturn += sSubDirectory;
+ }
+ sReturn += "\n";
+ }
+ else {
+ ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" );
+ sUNX += "RC_SUBDIRS = ";
+ BOOL bUNX = FALSE;
+
+ ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" );
+ sWNT += "RC_SUBDIRS = ";
+ BOOL bWNT = FALSE;
+
+ // ByteString sWIN( ".IF \"$(GUI)\" == \"WIN\"\n" );
+ // sWIN += "RC_SUBDIRS = ";
+ // BOOL bWIN = FALSE;
+
+ ByteString sMAC( ".IF \"$(GUI)\" == \"MAC\"\n" );
+ sMAC += "RC_SUBDIRS = ";
+ BOOL bMAC = FALSE;
+
+ ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" );
+ sOS2 += "RC_SUBDIRS = ";
+ BOOL bOS2 = FALSE;
+
+ for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
+ SourceDirectory *pDirectory =
+ ( SourceDirectory * ) pSubDirectories->GetObject( i );
+ ByteString sDirectory( *pDirectory );
+ sDirectory.SearchAndReplaceAll( "\\", "$/" );
+
+ if ( pDirectory->GetOperatingSystems() & OS_UNX ) {
+ sUNX += " \\\n\t";
+ sUNX += sDirectory;
+ bUNX = TRUE;
+ }
+ if ( pDirectory->GetOperatingSystems() & OS_WIN32 ) {
+ sWNT += " \\\n\t";
+ sWNT += sDirectory;
+ bWNT = TRUE;
+ }
+ // if ( pDirectory->GetOperatingSystems() & OS_WIN16 ) {
+ // sWIN += " \\\n\t";
+ // sWIN += sDirectory;
+ // bWIN = TRUE;
+ // }
+ if ( pDirectory->GetOperatingSystems() & OS_MAC ) {
+ sMAC += " \\\n\t";
+ sMAC += sDirectory;
+ bMAC = TRUE;
+ }
+ if ( pDirectory->GetOperatingSystems() & OS_OS2 ) {
+ sOS2 += " \\\n\t";
+ sOS2 += sDirectory;
+ bOS2 = TRUE;
+ }
+ }
+ if ( bUNX ) {
+ sReturn += sUNX;
+ sReturn += "\n.ENDIF\n";
+ }
+ if ( bWNT ) {
+ sReturn += sWNT;
+ sReturn += "\n.ENDIF\n";
+ }
+ // if ( bWIN ) {
+ // sReturn += sWIN;
+ // sReturn += "\n.ENDIF\n";
+ // }
+ if ( bMAC ) {
+ sReturn += sMAC;
+ sReturn += "\n.ENDIF\n";
+ }
+ if ( bOS2 ) {
+ sReturn += sOS2;
+ sReturn += "\n.ENDIF\n";
+ }
+ }
+ }
+ return sReturn;
+}
+
+/*****************************************************************************/
+USHORT SourceDirectory::GetOSType( const ByteString &sDependExt )
+/*****************************************************************************/
+{
+ USHORT nOSType = 0;
+ if ( sDependExt == "" )
+ nOSType |= OS_ALL;
+ else if ( sDependExt == "D" )
+ /* nOSType |= OS_WIN16 */;
+ else if ( sDependExt == "W" )
+ nOSType |= OS_WIN32 /* | OS_WIN16 */;
+ else if ( sDependExt == "N" )
+ nOSType |= OS_WIN32;
+ else if ( sDependExt == "U" )
+ nOSType |= OS_UNX;
+ else if ( sDependExt == "P" )
+ nOSType |= OS_OS2;
+ else if ( sDependExt == "M" )
+ nOSType |= OS_MAC;
+ return nOSType;
+}
+
+/*****************************************************************************/
+SourceDirectory *SourceDirectory::CreateRootDirectory(
+ const ByteString &rRoot, const ByteString &rVersion )
+/*****************************************************************************/
+{
+ IniManager aIniManager;
+ aIniManager.Update();
+
+ ByteString sDefLst( GetDefStandList());
+ ByteString sStandLst( aIniManager.ToLocal( sDefLst ));
+ InformationParser aParser;
+ fprintf( stderr,
+ "Reading database %s ...\n", sStandLst.GetBuffer());
+ GenericInformationList *pVerList = aParser.Execute(
+ String( sStandLst, gsl_getSystemTextEncoding()));
+
+ ByteString sPath( rVersion );
+#ifndef UNX
+ sPath += ByteString( "/settings/solarlist" );
+#else
+ sPath += ByteString( "/settings/unxsolarlist" );
+#endif
+ ByteString sSolarList( _SOLARLIST );
+
+ GenericInformation *pInfo = pVerList->GetInfo( sPath, TRUE );
+ if ( pInfo ) {
+ ByteString aIniRoot( GetIniRoot() );
+ DirEntry aIniEntry( String( aIniRoot, RTL_TEXTENCODING_ASCII_US ));
+ aIniEntry += DirEntry( String( pInfo->GetValue(), RTL_TEXTENCODING_ASCII_US )).GetBase( PATH_SEPARATOR );
+ sSolarList = ByteString( aIniEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ }
+
+ sSolarList = aIniManager.ToLocal( sSolarList );
+ fprintf( stderr,
+ "Reading directory information %s ...\n", sSolarList.GetBuffer());
+
+ Star aStar( String( sSolarList, gsl_getSystemTextEncoding()));
+ fprintf( stderr,
+ "Creating virtual directory tree ...\n" );
+
+
+ SourceDirectory *pSourceRoot = new SourceDirectory( rRoot, OS_ALL );
+
+ for ( ULONG i = 0; i < aStar.Count(); i++ ) {
+ Prj *pPrj = aStar.GetObject( i );
+
+ BOOL bBuildable = TRUE;
+ ULONG nIndex = 0;
+
+ while ( bBuildable && ByteString( NoBuildProject[ nIndex ]) != "EndOf_NoBuildProject" ) {
+ bBuildable = ( ByteString( NoBuildProject[ nIndex ]) != pPrj->GetProjectName());
+ nIndex ++;
+ }
+
+ if ( bBuildable ) {
+ SourceDirectory *pProject = pSourceRoot->Insert( pPrj->GetProjectName(), OS_ALL );
+
+ SByteStringList *pPrjDependencies = pPrj->GetDependencies( FALSE );
+ if ( pPrjDependencies )
+ for ( ULONG x = 0; x < pPrjDependencies->Count(); x++ )
+ pProject->AddCodedDependency( *pPrjDependencies->GetObject( x ), OS_ALL );
+
+ pProject->AddCodedIdentifier( pPrj->GetProjectName(), OS_ALL );
+
+ for ( ULONG j = 0; j < pPrj->Count(); j++ ) {
+ CommandData *pData = pPrj->GetObject( j );
+ if ( pData->GetCommandType() == COMMAND_NMAKE ) {
+ ByteString sDirPath( rRoot );
+ sDirPath += ByteString( PATH_SEPARATOR );
+ sDirPath += pData->GetPath();
+ SourceDirectory *pDirectory =
+ pSourceRoot->InsertFull( sDirPath, pData->GetOSType());
+ SByteStringList *pDependencies = pData->GetDependencies();
+ if ( pDependencies ) {
+ for ( ULONG k = 0; k < pDependencies->Count(); k++ ) {
+ ByteString sDependency(*pDependencies->GetObject( k ));
+ ByteString sDependExt(sDependency.GetToken( 1, '.' ));
+ sDependExt.ToUpperAscii();
+ pDirectory->AddCodedDependency(
+ sDependency.GetToken( 0, '.' ), GetOSType( sDependExt ));
+ }
+ }
+ ByteString sIdentifier = pData->GetLogFile();
+ ByteString sIdExt = sIdentifier.GetToken( 1, '.' );
+ sIdExt.ToUpperAscii();
+ pDirectory->AddCodedIdentifier( sIdentifier.GetToken( 0, '.' ), GetOSType( sIdExt ));
+ }
+ }
+ }
+ }
+ delete pVerList;
+ return pSourceRoot;
+}
+
+/*****************************************************************************/
+BOOL SourceDirectory::RemoveDirectoryTreeAndAllDependencies()
+/*****************************************************************************/
+{
+ if ( !pParent )
+ return FALSE;
+
+ SourceDirectoryList *pParentContent = pParent->pSubDirectories;
+ ULONG i = 0;
+ while ( i < pParentContent->Count()) {
+ SourceDirectory *pCandidate =
+ ( SourceDirectory * )pParentContent->GetObject( i );
+ if ( pCandidate == this ) {
+ pParentContent->Remove( i );
+ }
+ else {
+ if ( pCandidate->pDependencies ) {
+ ULONG nPos = pCandidate->pDependencies->IsString( this );
+ if ( nPos != NOT_THERE )
+ delete pCandidate->pDependencies->Remove( nPos );
+ }
+ i++;
+ }
+ }
+ delete this;
+ return TRUE;
+}
+
+/*****************************************************************************/
+BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds )
+/*****************************************************************************/
+{
+ if ( !pSubDirectories )
+ return TRUE;
+
+ fprintf( stdout, "%s", GetFullPath().GetBuffer());
+
+ String aTmpStr( GetFullPath(), gsl_getSystemTextEncoding());
+ DirEntry aEntry( aTmpStr );
+ if ( !aEntry.Exists()) {
+ fprintf( stdout, " ... no directory!n" );
+ return FALSE;
+ }
+
+ ULONG j = 0;
+ while( j < pSubDirectories->Count()) {
+ String sSubDirectory(
+ (( SourceDirectory * ) pSubDirectories->GetObject( j ))->
+ GetFullPath(),
+ gsl_getSystemTextEncoding()
+ );
+ DirEntry aSubDirectory( sSubDirectory );
+ if ( !aSubDirectory.Exists())
+ (( SourceDirectory * ) pSubDirectories->GetObject( j ))->
+ RemoveDirectoryTreeAndAllDependencies();
+ else
+ j++;
+ }
+
+ DirEntry aRCFile( String( "makefile.rc", gsl_getSystemTextEncoding()));
+ DirEntry aRCEntry( aEntry );
+ aRCEntry += aRCFile;
+
+ DirEntry aMKFile( String( "makefile.mk", gsl_getSystemTextEncoding()));
+ DirEntry aMKEntry( aEntry );
+ aMKEntry += aMKFile;
+
+ BOOL bMakefileMk = FALSE;
+ if ( aMKEntry.Exists()) {
+ if ( nDepth == 1 && *this == ByteString( "api" ))
+ fprintf( stdout, " ... makefile.mk exists, ignoring (hack: prj == api)!" );
+ else {
+ fprintf( stdout, " ... makefile.mk exists, including!" );
+ bMakefileMk = TRUE;
+ }
+ }
+
+ SvFileStream aMakefile( aRCEntry.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC );
+ if ( !aMakefile.IsOpen()) {
+ fprintf( stdout, " ... failed!\n" );
+ return FALSE;
+ }
+
+ ByteString sHeader(
+ "#*************************************************************************\n"
+ "#*\n"
+ "#* $Workfile:$\n"
+ "#*\n"
+ "#* generated recursive makefile\n"
+ "#* last change $Author: hr $ $Date: 2000-09-18 17:02:59 $\n"
+ "#* $Revision: 1.1.1.1 $\n"
+ "#*\n"
+ "#* $Logfile:$\n"
+ "#*\n"
+ "#* Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.\n"
+ "#*\n"
+ "#*************************************************************************\n"
+ "\n"
+ );
+ if ( !bMakefileMk ) {
+ if ( nDepth == 0 ) {
+ sHeader += ByteString(
+ "\n"
+ "# \n"
+ "# mark this makefile as a recursive one\n"
+ "# \n"
+ "\n"
+ "MAKEFILERC=yes\n"
+ "\n"
+ "# \n"
+ "# implementation of cvs checkout\n"
+ "# \n"
+ "\n"
+ ".IF \"$(checkout)\"==\"\"\n"
+ "all_target: ALLTAR\n"
+ ".ELSE\t# \"$(checkout)\"==\"\"\n"
+ ".IF \"$(checkout)\"==\"true\"\n"
+ "% : $(NULL)\n"
+ "\t_cvs co $@\n"
+ ".ELSE\t# \"$(checkout)\"==\"true\"\n"
+ "% : $(NULL)\n"
+ "\t_cvs co -r$(checkout) $@\n"
+ ".ENDIF\t# \"$(checkout)\"==\"true\"\n"
+ "all_subdirs : $(RC_SUBDIRS)\n"
+ ".ENDIF\t# \"$(checkout)\"==\"\"\n"
+ );
+ }
+ else {
+ sHeader += ByteString(
+ "\n"
+ "# \n"
+ "# mark this makefile as a recursive one\n"
+ "# \n"
+ "\n"
+ "MAKEFILERC=yes\n"
+ );
+ if ( nDepth == 1 )
+ sHeader += ByteString(
+ ".IF \"$(deliver)\"==\"true\"\n"
+ "all_target:\t\t\\\n"
+ "\tTG_DELIVER\t\\\n"
+ "\tALLTAR\n"
+ ".ELSE # \"$(deliver)\"==\"true\"\n"
+ "all_target: ALLTAR\n"
+ ".ENDIF # \"$(deliver)\"==\"true\"\n"
+ );
+ else
+ sHeader += ByteString(
+ "all_target: ALLTAR\n"
+ );
+ }
+ }
+ else {
+ if ( nDepth == 1 )
+ sHeader += ByteString(
+ ".IF \"$(deliver)\"==\"true\"\n"
+ "all_target:\t\t\\\n"
+ "\tTG_DELIVER\t\\\n"
+ "\tALLTAR\n"
+ ".ELSE # \"$(deliver)\"==\"true\"\n"
+ "all_target: ALLTAR\n"
+ ".ENDIF # \"$(deliver)\"==\"true\"\n"
+ );
+ }
+ sHeader += ByteString(
+ "\n"
+ "# \n"
+ "# macro RC_SUBDIRS handles iteration over\n"
+ "# all mandatory sub directories\n"
+ "# \n"
+ );
+
+ aMakefile.WriteLine( sHeader );
+ aMakefile.WriteLine( GetSubDirsTarget());
+
+ if ( nDepth == 0 ) {
+ ByteString sBootstrapTarget(
+ "# \n"
+ "# bootstrap target\n"
+ "# \n\n"
+ "bootstrap .PHONY :\n"
+ "\t@config_office/bootstrap\n\n"
+ );
+ aMakefile.WriteLine( sBootstrapTarget );
+ ByteString sConfigureTarget(
+ "# \n"
+ "# configure target\n"
+ "# \n\n"
+ "configure .PHONY SETDIR=config_office :\n"
+ "\t@configure\n"
+ );
+ aMakefile.WriteLine( sConfigureTarget );
+ }
+ else if ( nDepth == 1 ) {
+ ByteString sDeliverTarget(
+ "# \n"
+ "# deliver target to handle\n"
+ "# project dependencies\n"
+ "# \n\n"
+ "TG_DELIVER : $(RC_SUBDIRS)\n"
+ "\tdeliver\n"
+ );
+ aMakefile.WriteLine( sDeliverTarget );
+ }
+
+ if ( bMakefileMk ) {
+ ByteString sInclude(
+ "# \n"
+ "# local makefile\n"
+ "# \n"
+ "\n"
+ ".INCLUDE : makefile.mk\n"
+ );
+
+ if ( nDepth != 1 )
+ sInclude += ByteString(
+ "\n"
+ "all_rc_target: ALLTAR\n"
+ );
+
+ aMakefile.WriteLine( sInclude );
+ }
+
+ ByteString sComment(
+ "# \n"
+ "# single directory targets for\n"
+ "# dependency handling between directories\n"
+ "# \n"
+ );
+ aMakefile.WriteLine( sComment );
+
+ for ( ULONG i = 0; i < pSubDirectories->Count(); i++ ) {
+ ByteString sTarget(
+ (( SourceDirectory * )pSubDirectories->GetObject( i ))->
+ GetTarget()
+ );
+ if ( sTarget.Len())
+ aMakefile.WriteLine( sTarget );
+ }
+
+ ByteString sFooter(
+ "\n"
+ );
+ if ( !bMakefileMk ) {
+ sFooter += ByteString(
+ "# \n"
+ "# central target makefile\n"
+ "# \n"
+ "\n"
+ );
+ if ( nDepth != 0 ) {
+ sFooter += ByteString(
+ ".INCLUDE : target.mk\n"
+ );
+ }
+ else {
+ sFooter += ByteString(
+ ".IF \"$(checkout)\"==\"\"\n"
+ ".INCLUDE : target.mk\n"
+ ".ENDIF\t#\"$(checkout)\"==\"\"\n"
+ );
+ }
+ }
+ sFooter += ByteString(
+ "\n"
+ "#*************************************************************************\n"
+ );
+ aMakefile.WriteLine( sFooter );
+
+ aMakefile.Close();
+
+ fprintf( stdout, "\n" );
+
+ BOOL bSuccess = TRUE;
+ if ( bAllChilds )
+ for ( ULONG j = 0; j < pSubDirectories->Count(); j++ )
+ if ( !(( SourceDirectory * ) pSubDirectories->GetObject( j ))->
+ CreateRecursiveMakefile( TRUE ))
+ bSuccess = FALSE;
+
+ return bSuccess;
+}
+
+//
+// class SourceDirectoryList
+//
+
+/*****************************************************************************/
+SourceDirectoryList::~SourceDirectoryList()
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < Count(); i++ )
+ delete GetObject( i );
+}
+
+/*****************************************************************************/
+SourceDirectory *SourceDirectoryList::Search(
+ const ByteString &rDirectoryName )
+/*****************************************************************************/
+{
+ ULONG nPos = IsString( & ( ByteString ) rDirectoryName );
+ if ( nPos != LIST_ENTRY_NOTFOUND )
+ return ( SourceDirectory * ) GetObject( nPos );
+
+ return NULL;
+}
+
+
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
new file mode 100644
index 000000000000..7f1bc3603c22
--- /dev/null
+++ b/tools/bootstrp/prj.cxx
@@ -0,0 +1,1185 @@
+/*************************************************************************
+ *
+ * $RCSfile: prj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdlib.h>
+#include <sstring.hxx>
+
+#include "stream.hxx"
+#include "prj.hxx"
+
+#pragma hdrstop
+
+//#define TEST 1
+
+#ifdef MAC
+#define putenv(x)
+#endif
+
+#if defined(DOS) || defined(WNT) || defined(OS2)
+#define LIST_DELIMETER ';'
+#else
+#ifdef UNX
+#define LIST_DELIMETER ':'
+#else
+#ifdef MAC
+#define LIST_DELIMETER ','
+#endif
+#endif
+#endif
+
+#if defined(DOS) || defined(WNT) || defined(OS2) || defined(WIN)
+#define PATH_DELIMETER '\\'
+#else
+#ifdef UNX
+#define PATH_DELIMETER '/'
+#else
+#ifdef MAC
+#define PATH_DELIMETER ':'
+#endif
+#endif
+#endif
+
+//
+// class SimpleConfig
+//
+
+/*****************************************************************************/
+SimpleConfig::SimpleConfig( UniString aSimpleConfigFileName )
+/*****************************************************************************/
+{
+ nLine = 0;
+ aFileName = aSimpleConfigFileName;
+ aFileStream.Open ( aFileName, STREAM_READ );
+}
+
+/*****************************************************************************/
+SimpleConfig::SimpleConfig( DirEntry& rDirEntry )
+/*****************************************************************************/
+{
+ nLine = 0;
+ aFileName = rDirEntry.GetFull();
+ aFileStream.Open ( aFileName, STREAM_READ );
+}
+
+/*****************************************************************************/
+SimpleConfig::~SimpleConfig()
+/*****************************************************************************/
+{
+ aFileStream.Close ();
+}
+
+/*****************************************************************************/
+ByteString SimpleConfig::GetNext()
+/*****************************************************************************/
+{
+ ByteString aString;
+
+ if ( aStringBuffer =="" )
+ while ((aStringBuffer = GetNextLine()) == "\t"); //solange bis != "\t"
+ if ( aStringBuffer =="" )
+ return ByteString();
+
+ aString = aStringBuffer.GetToken(0,'\t');
+ aStringBuffer.Erase(0, aString.Len()+1);
+
+ aStringBuffer.EraseLeadingChars( '\t' );
+
+ return aString;
+}
+
+/*****************************************************************************/
+ByteString SimpleConfig::GetNextLine()
+/*****************************************************************************/
+{
+ ByteString aSecStr;
+ USHORT iret = 0;
+ nLine++;
+
+ aFileStream.ReadLine ( aTmpStr );
+ if ( aTmpStr.Search( "#" ) == 0 )
+ return "\t";
+ aTmpStr = aTmpStr.EraseLeadingChars();
+ aTmpStr = aTmpStr.EraseTrailingChars();
+ while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND );
+ int nLength = aTmpStr.Len();
+ USHORT nPos = 0;
+ BOOL bFound = FALSE;
+ ByteString aEraseString;
+ for ( USHORT i = 0; i<= nLength; i++)
+ {
+#ifdef MAC
+ if ( aTmpStr.GetChar( i ) == '"')
+ {
+ if ( bFound) bFound = FALSE;
+ else bFound = TRUE;
+ aTmpStr.SetChar( i, '\t' );
+ }
+#endif
+ if ( aTmpStr.GetChar( i ) == 0x20 && !bFound )
+ aTmpStr.SetChar( i, 0x09 );
+ }
+ return aTmpStr;
+}
+
+/*****************************************************************************/
+ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments )
+/*****************************************************************************/
+{
+
+ aFileStream.ReadLine ( aTmpStr );
+ if ( aTmpStr.Search( "#" == 0 ))
+ if (bReadComments )
+ return aTmpStr;
+ else
+ while ( aTmpStr.Search( "#" == 0 ))
+ {
+ aFileStream.ReadLine ( aTmpStr );
+ }
+
+ aTmpStr = aTmpStr.EraseLeadingChars();
+ aTmpStr = aTmpStr.EraseTrailingChars();
+// while ( aTmpStr.SearchAndReplace(String(' '),String('\t') ) != (USHORT)-1 );
+ int nLength = aTmpStr.Len();
+ USHORT nPos = 0;
+ ByteString aEraseString;
+ BOOL bFirstTab = TRUE;
+ for ( USHORT i = 0; i<= nLength; i++)
+ {
+ if ( aTmpStr.GetChar( i ) == 0x20 )
+ aTmpStr.SetChar( i, 0x09 );
+
+ if ( aTmpStr.GetChar( i ) == 0x09 )
+ {
+ if ( bFirstTab )
+ bFirstTab = FALSE;
+ else
+ {
+ aTmpStr.SetChar( i, 0x20 );
+ }
+ }
+ else
+ bFirstTab = TRUE;
+
+ }
+ aTmpStr.EraseAllChars(' ');
+ return aTmpStr;
+
+}
+
+
+//
+// class CommandData
+//
+
+/*****************************************************************************/
+CommandData::CommandData()
+/*****************************************************************************/
+{
+ nOSType = 0;
+ nCommand = 0;
+ pDepList = 0;
+}
+
+/*****************************************************************************/
+CommandData::~CommandData()
+/*****************************************************************************/
+{
+ if ( pDepList )
+ {
+ ByteString *pString = pDepList->First();
+ while ( pString )
+ {
+ delete pString;
+ pString = pDepList->Next();
+ }
+ delete pDepList;
+
+ pDepList = NULL;
+ }
+}
+
+/*****************************************************************************/
+ByteString CommandData::GetOSTypeString()
+/*****************************************************************************/
+{
+ ByteString aRetStr;
+
+ switch (nOSType)
+ {
+ case OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX | OS_MAC :
+ aRetStr = "all";
+ break;
+ case OS_WIN32 | OS_WIN16 :
+ aRetStr = "w";
+ break;
+ case OS_OS2 :
+ aRetStr = "p";
+ break;
+ case OS_UNX :
+ aRetStr = "u";
+ break;
+ case OS_WIN16 :
+ aRetStr = "d";
+ break;
+ case OS_WIN32 :
+ aRetStr = "n";
+ break;
+ case OS_MAC :
+ aRetStr = "m";
+ break;
+ default :
+ aRetStr = "none";
+ }
+
+ return aRetStr;
+}
+
+/*****************************************************************************/
+ByteString CommandData::GetCommandTypeString()
+/*****************************************************************************/
+{
+ ByteString aRetStr;
+
+ switch (nCommand)
+ {
+ case COMMAND_NMAKE :
+ aRetStr = "nmake";
+ break;
+ case COMMAND_GET :
+ aRetStr = "get";
+ break;
+ default :
+ aRetStr = "usr";
+ aRetStr += ByteString( nCommand + 1 - COMMAND_USER_START );
+
+ }
+
+ return aRetStr;
+}
+
+/*****************************************************************************/
+CommandData* Prj::GetDirectoryList ( USHORT nWhatOS, USHORT nCommand )
+/*****************************************************************************/
+{
+ return (CommandData *)NULL;
+}
+
+/*****************************************************************************/
+CommandData* Prj::GetDirectoryData( ByteString aLogFileName )
+/*****************************************************************************/
+{
+ CommandData *pData = NULL;
+ ULONG nCount = Count();
+ for ( ULONG i=0; i<nCount; i++ )
+ {
+ pData = GetObject(i);
+ if ( pData->GetLogFile() == aLogFileName )
+ return pData;
+ }
+ return NULL;
+}
+
+//
+// class Prj
+//
+
+/*****************************************************************************/
+Prj::Prj() :
+ pPrjDepList(0),
+ pPrjInitialDepList(0),
+ bSorted( FALSE ),
+ bHardDependencies( FALSE ),
+ bVisited( FALSE )
+/*****************************************************************************/
+{
+}
+
+/*****************************************************************************/
+Prj::Prj( ByteString aName ) :
+ aProjectName( aName ),
+ pPrjDepList(0),
+ pPrjInitialDepList(0),
+ bSorted( FALSE ),
+ bHardDependencies( FALSE ),
+ bVisited( FALSE )
+/*****************************************************************************/
+{
+}
+
+/*****************************************************************************/
+Prj::~Prj()
+/*****************************************************************************/
+{
+ if ( pPrjDepList )
+ {
+ ByteString *pString = pPrjDepList->First();
+ while ( pString )
+ {
+ delete pString;
+ pString = pPrjDepList->Next();
+ }
+ delete pPrjDepList;
+
+ pPrjDepList = NULL;
+ }
+
+ if ( pPrjInitialDepList )
+ {
+ ByteString *pString = pPrjInitialDepList->First();
+ while ( pString )
+ {
+ delete pString;
+ pString = pPrjInitialDepList->Next();
+ }
+ delete pPrjInitialDepList;
+
+ pPrjInitialDepList = NULL;
+ }
+}
+
+/*****************************************************************************/
+void Prj::AddDependencies( ByteString aStr )
+/*****************************************************************************/
+{
+
+ // needs dirty flag - not expanded
+ if ( !pPrjDepList )
+ pPrjDepList = new SByteStringList;
+
+ pPrjDepList->PutString( new ByteString(aStr) );
+
+ if ( !pPrjInitialDepList )
+ pPrjInitialDepList = new SByteStringList;
+
+ pPrjInitialDepList->PutString( new ByteString(aStr) );
+}
+
+/*****************************************************************************/
+SByteStringList* Prj::GetDependencies( BOOL bExpanded )
+/*****************************************************************************/
+{
+ if ( bExpanded )
+ return pPrjDepList;
+ else
+ return pPrjInitialDepList;
+}
+
+
+
+/*****************************************************************************/
+BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat,
+ USHORT aWhatOS, ByteString aLogFileName,
+ const ByteString &rClientRestriction )
+/*****************************************************************************/
+{
+ CommandData* pData = new CommandData();
+
+ pData->SetPath( aDirName );
+ pData->SetCommandType( aWhat );
+ pData->SetOSType( aWhatOS );
+ pData->SetLogFile( aLogFileName );
+ pData->SetClientRestriction( rClientRestriction );
+
+ Insert( pData );
+
+ return FALSE;
+}
+
+/*****************************************************************************/
+//
+// removes directory and existing dependencies on it
+//
+CommandData* Prj::RemoveDirectory ( ByteString aLogFileName )
+/*****************************************************************************/
+{
+ ULONG nCount = Count();
+ CommandData* pData;
+ CommandData* pDataFound = NULL;
+ SByteStringList* pDataDeps;
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ pData = GetObject( i );
+ if ( pData->GetLogFile() == aLogFileName )
+ pDataFound = pData;
+ else
+ {
+ pDataDeps = pData->GetDependencies();
+ if ( pDataDeps )
+ {
+ ByteString* pString;
+ USHORT nDataDepsCount = pDataDeps->Count();
+ for ( USHORT j = nDataDepsCount; j > 0; j-- )
+ {
+ pString = pDataDeps->GetObject( j - 1 );
+ if ( pString->GetToken( 0, '.') == aLogFileName )
+ pDataDeps->Remove( pString );
+ }
+ }
+ }
+ }
+
+ Remove( pDataFound );
+
+ return pDataFound;
+}
+
+//
+// class Star
+//
+/*****************************************************************************/
+Star::Star()
+/*****************************************************************************/
+{}
+/*****************************************************************************/
+Star::Star(UniString aFileName)
+/*****************************************************************************/
+{
+ ByteString aString;
+
+ SimpleConfig aSolarConfig ( aFileName );
+ while ( (aString = aSolarConfig.GetNext()) != "")
+ InsertToken ( (char *) aString.GetBuffer() );
+
+ // Die gefundenen Abhaengigkeiten rekursiv aufloesen
+ Expand_Impl();
+}
+
+/*****************************************************************************/
+Star::~Star()
+/*****************************************************************************/
+{
+}
+
+/*****************************************************************************/
+void Star::ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj )
+/*****************************************************************************/
+{
+ if ( pDepPrj->bVisited )
+ return;
+
+ pDepPrj->bVisited = TRUE;
+
+ SByteStringList* pPrjLst = pPrj->GetDependencies();
+ SByteStringList* pDepLst = NULL;
+ ByteString* pDepend;
+ ByteString* pPutStr;
+ Prj *pNextPrj = NULL;
+ ULONG i, nRetPos;
+
+ if ( pPrjLst ) {
+ pDepLst = pDepPrj->GetDependencies();
+ if ( pDepLst ) {
+ for ( i = 0; i < pDepLst->Count(); i++ ) {
+ pDepend = pDepLst->GetObject( i );
+ pPutStr = new ByteString( *pDepend );
+ nRetPos = pPrjLst->PutString( pPutStr );
+ if( nRetPos == NOT_THERE )
+ delete pPutStr;
+ pNextPrj = GetPrj( *pDepend );
+ if ( pNextPrj ) {
+ ExpandPrj_Impl( pPrj, pNextPrj );
+ }
+ }
+ }
+ }
+}
+
+/*****************************************************************************/
+void Star::Expand_Impl()
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < Count(); i++ ) {
+ for ( ULONG j = 0; j < Count(); j++ )
+ GetObject( j )->bVisited = FALSE;
+
+ Prj* pPrj = GetObject( i );
+ ExpandPrj_Impl( pPrj, pPrj );
+ }
+}
+
+/*****************************************************************************/
+void Star::InsertToken ( char *yytext )
+/*****************************************************************************/
+{
+ static int i = 0;
+ static ByteString aDirName, aWhat, aWhatOS,
+ sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara;
+ static BOOL bPrjDep = FALSE;
+ static BOOL bHardDep = FALSE;
+ static int nCommandType, nOSType;
+ CommandData* pCmdData;
+ static SByteStringList *pStaticDepList;
+ Prj* pPrj;
+
+ switch (i)
+ {
+ case 0:
+ aPrefix = yytext;
+ pStaticDepList = 0;
+ break;
+ case 1:
+ aDirName = yytext;
+ break;
+ case 2:
+ if ( !strcmp( yytext, ":" ))
+ {
+ bPrjDep = TRUE;
+ bHardDep = FALSE;
+ i = 9;
+ }
+ else if ( !strcmp( yytext, "::" ))
+ {
+ bPrjDep = TRUE;
+ bHardDep = TRUE;
+ i = 9;
+ }
+ else
+ {
+ bPrjDep = FALSE;
+ bHardDep = FALSE;
+
+ aWhat = yytext;
+ if ( aWhat == "nmake" )
+ nCommandType = COMMAND_NMAKE;
+ else if ( aWhat == "get" )
+ nCommandType = COMMAND_GET;
+ else {
+ USHORT nOffset = aWhat.Copy( 3 ).ToInt32();
+ nCommandType = COMMAND_USER_START + nOffset - 1;
+ }
+ }
+ break;
+ case 3:
+ if ( !bPrjDep )
+ {
+ aWhat = yytext;
+ if ( aWhat == "-" )
+ {
+ aCommandPara = ByteString();
+ }
+ else
+ aCommandPara = aWhat;
+ }
+ break;
+ case 4:
+ if ( !bPrjDep )
+ {
+ aWhatOS = yytext;
+ if ( aWhatOS.GetTokenCount( ',' ) > 1 ) {
+ sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 );
+ aWhatOS = aWhatOS.GetToken( 0, ',' );
+ }
+ if ( aWhatOS == "all" )
+ nOSType = ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX | OS_MAC );
+ else if ( aWhatOS == "w" )
+ nOSType = ( OS_WIN16 | OS_WIN32 );
+ else if ( aWhatOS == "p" )
+ nOSType = OS_OS2;
+ else if ( aWhatOS == "u" )
+ nOSType = OS_UNX;
+ else if ( aWhatOS == "d" )
+ nOSType = OS_WIN16;
+ else if ( aWhatOS == "n" )
+ nOSType = OS_WIN32;
+ else if ( aWhatOS == "m" )
+ nOSType = OS_MAC;
+ else
+ nOSType = OS_NONE;
+ }
+ break;
+ case 5:
+ if ( !bPrjDep )
+ {
+ aLogFileName = yytext;
+ }
+ break;
+ default:
+ if ( !bPrjDep )
+ {
+ ByteString aItem = yytext;
+ if ( aItem == "NULL" )
+ {
+ // Liste zu Ende
+ i = -1;
+ }
+ else
+ {
+ // ggfs. Dependency liste anlegen und ergaenzen
+ if ( !pStaticDepList )
+ pStaticDepList = new SByteStringList;
+ pStaticDepList->PutString( new ByteString( aItem ));
+ }
+ }
+ else
+ {
+ ByteString aItem = yytext;
+ if ( aItem == "NULL" )
+ {
+ // Liste zu Ende
+ i = -1;
+ bPrjDep= FALSE;
+ }
+ else
+ {
+ aProjectName = aDirName.GetToken ( 0, 0x5c);
+ if ( HasProject( aProjectName ))
+ {
+ pPrj = GetPrj( aProjectName );
+ // Projekt exist. schon, neue Eintraege anhaengen
+ }
+ else
+ {
+ // neues Project anlegen
+ pPrj = new Prj ( aProjectName );
+ pPrj->SetPreFix( aPrefix );
+ Insert(pPrj,LIST_APPEND);
+ }
+ pPrj->AddDependencies( aItem );
+ pPrj->HasHardDependencies( bHardDep );
+ }
+
+ }
+ break;
+ }
+ /* Wenn dieses Project noch nicht vertreten ist, in die Liste
+ der Solar-Projekte einfuegen */
+ if ( i == -1 )
+ {
+ aProjectName = aDirName.GetToken ( 0, 0x5c);
+ if ( HasProject( aProjectName ))
+ {
+ pPrj = GetPrj( aProjectName );
+ // Projekt exist. schon, neue Eintraege anhaengen
+ }
+ else
+ {
+ // neues Project anlegen
+ pPrj = new Prj ( aProjectName );
+ pPrj->SetPreFix( aPrefix );
+ Insert(pPrj,LIST_APPEND);
+ }
+
+ pCmdData = new CommandData;
+ pCmdData->SetPath( aDirName );
+ pCmdData->SetCommandType( nCommandType );
+ pCmdData->SetCommandPara( aCommandPara );
+ pCmdData->SetOSType( nOSType );
+ pCmdData->SetLogFile( aLogFileName );
+ pCmdData->SetClientRestriction( sClientRestriction );
+ if ( pStaticDepList )
+ pCmdData->SetDependencies( pStaticDepList );
+
+ pStaticDepList = 0;
+ pPrj->Insert ( pCmdData, LIST_APPEND );
+ aDirName ="";
+ aWhat ="";
+ aWhatOS = "";
+ sClientRestriction = "";
+ aLogFileName = "";
+ nCommandType = 0;
+ nOSType = 0;
+ }
+ i++;
+
+ // und wer raeumt die depLst wieder ab ?
+}
+
+/*****************************************************************************/
+BOOL Star::HasProject ( ByteString aProjectName )
+/*****************************************************************************/
+{
+ Prj *pPrj;
+ int nCount;
+
+ nCount = Count();
+
+ for ( int i=0; i<nCount; i++)
+ {
+ pPrj = GetObject(i);
+ if ( pPrj->GetProjectName().ToLowerAscii() == aProjectName.ToLowerAscii() )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*****************************************************************************/
+Prj* Star::GetPrj ( ByteString aProjectName )
+/*****************************************************************************/
+{
+ Prj* pPrj;
+ int nCount = Count();
+ for ( int i=0;i<nCount;i++)
+ {
+ pPrj = GetObject(i);
+ if ( pPrj->GetProjectName().ToLowerAscii() == aProjectName.ToLowerAscii() )
+ return pPrj;
+ }
+// return (Prj*)NULL;
+ return 0L ;
+}
+
+/*****************************************************************************/
+ByteString Star::GetPrjName( DirEntry &aPath )
+/*****************************************************************************/
+{
+ ByteString aRetPrj, aDirName;
+ ByteString aFullPathName = ByteString( aPath.GetFull(), gsl_getSystemTextEncoding());
+
+ USHORT nToken = aFullPathName.GetTokenCount(PATH_DELIMETER);
+ for ( int i=0; i< nToken; i++ )
+ {
+ aDirName = aFullPathName.GetToken( i, PATH_DELIMETER );
+ if ( HasProject( aDirName ))
+ {
+ aRetPrj = aDirName;
+ break;
+ }
+ }
+
+ return aRetPrj;
+}
+
+
+//
+// class StarWriter
+//
+
+/*****************************************************************************/
+StarWriter::StarWriter( UniString aFileName, BOOL bReadComments )
+/*****************************************************************************/
+{
+ Read ( aFileName, bReadComments );
+}
+
+
+/*****************************************************************************/
+void StarWriter::CleanUp()
+{
+ Expand_Impl();
+}
+/*****************************************************************************/
+/*****************************************************************************/
+USHORT StarWriter::Read( UniString aFileName, BOOL bReadComments )
+/*****************************************************************************/
+{
+ ByteString aString;
+
+ SimpleConfig aSolarConfig ( aFileName );
+ while ( (aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "")
+ InsertTokenLine ( aString );
+
+ // Die gefundenen Abhaengigkeiten rekursiv aufloesen
+ Expand_Impl();
+ return 0;
+}
+
+/*****************************************************************************/
+USHORT StarWriter::Write( UniString aFileName )
+/*****************************************************************************/
+{
+ Prj* pPrj = NULL;
+ ByteString aDataString;
+ ByteString aTab('\t');
+ ByteString aSpace(' ');
+ ByteString aEmptyString("");
+
+ CommandData* pCmdData = NULL;
+ SvFileStream aFileStream;
+ SByteStringList* pCmdDepList;
+ SByteStringList* pPrjDepList;
+
+ aFileStream.Open( aFileName, STREAM_WRITE | STREAM_TRUNC);
+
+ if ( Count() > 0 )
+ {
+ pPrj = First();
+ do
+ {
+ if ( pPrj->Count() > 0 )
+ {
+ pCmdData = pPrj->First();
+ if ( pPrjDepList = pPrj->GetDependencies( FALSE ))
+ {
+ aDataString = pPrj->GetPreFix();
+ aDataString += aTab;
+ aDataString += pPrj->GetProjectName();
+ aDataString += aTab;
+ if ( pPrj->HasHardDependencies())
+ aDataString+= ByteString("::");
+ else
+ aDataString+= ByteString(":");
+ aDataString += aTab;
+ for ( USHORT i = 0; i< pPrjDepList->Count(); i++ ) {
+ aDataString += *pPrjDepList->GetObject( i );
+ aDataString += aSpace;
+ }
+ aDataString+= "NULL";
+
+ aFileStream.WriteLine( aDataString );
+
+ pCmdData = pPrj->Next();
+ }
+ if ( pCmdData )
+ do
+ {
+ if (( aDataString = pCmdData->GetComment()) == aEmptyString )
+ {
+ aDataString = pPrj->GetPreFix();
+ aDataString += aTab;
+
+ aDataString+= pCmdData->GetPath();
+ aDataString += aTab;
+ USHORT nPathLen = pCmdData->GetPath().Len();
+ if ( nPathLen < 40 )
+ for ( int i = 0; i < 9 - pCmdData->GetPath().Len() / 4 ; i++ )
+ aDataString += aTab;
+ else
+ for ( int i = 0; i < 12 - pCmdData->GetPath().Len() / 4 ; i++ )
+ aDataString += aTab;
+ aDataString += pCmdData->GetCommandTypeString();
+ aDataString += aTab;
+ if ( pCmdData->GetCommandType() == COMMAND_GET )
+ aDataString += aTab;
+ if ( pCmdData->GetCommandPara() == aEmptyString )
+ aDataString+= ByteString("-");
+ else
+ aDataString+= pCmdData->GetCommandPara();
+ aDataString += aTab;
+ aDataString+= pCmdData->GetOSTypeString();
+ if ( pCmdData->GetClientRestriction().Len()) {
+ aDataString += ByteString( "," );
+ aDataString += pCmdData->GetClientRestriction();
+ }
+ aDataString += aTab;
+ aDataString += pCmdData->GetLogFile();
+ aDataString += aSpace;
+
+ pCmdDepList = pCmdData->GetDependencies();
+ if ( pCmdDepList )
+ for ( USHORT i = 0; i< pCmdDepList->Count(); i++ ) {
+ aDataString += *pCmdDepList->GetObject( i );
+ aDataString += aSpace;
+ }
+ aDataString += "NULL";
+ }
+
+ aFileStream.WriteLine( aDataString );
+
+ pCmdData = pPrj->Next();
+ } while ( pCmdData );
+
+ }
+ pPrj = Next();
+ } while ( pPrj );
+ }
+
+ aFileStream.Close();
+ return 0;
+}
+
+/*****************************************************************************/
+void StarWriter::InsertTokenLine ( ByteString& rString )
+/*****************************************************************************/
+{
+ int i = 0;
+ ByteString aWhat, aWhatOS,
+ sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara;
+ static ByteString aDirName;
+ BOOL bPrjDep = FALSE;
+ BOOL bHardDep = FALSE;
+ int nCommandType, nOSType;
+ CommandData* pCmdData;
+ SByteStringList *pDepList2 = NULL;
+ Prj* pPrj;
+
+ ByteString aEmptyString;
+ ByteString aToken = rString.GetToken( 0, '\t' );
+ ByteString aCommentString;
+
+ const char* yytext = aToken.GetBuffer();
+
+ while ( !( aToken == aEmptyString ) )
+ {
+ switch (i)
+ {
+ case 0:
+ if ( rString.Search( "#" ) == 0 )
+ {
+ i = -1;
+ aCommentString = rString;
+ rString = aEmptyString;
+ if ( Count() == 0 )
+ aDirName = "null_entry" ; //comments at begin of file
+ break;
+ }
+ aPrefix = yytext;
+ pDepList2 = NULL;
+ break;
+ case 1:
+ aDirName = yytext;
+ break;
+ case 2:
+ if ( !strcmp( yytext, ":" ))
+ {
+ bPrjDep = TRUE;
+ bHardDep = FALSE;
+ i = 9;
+ }
+ else if ( !strcmp( yytext, "::" ))
+ {
+ bPrjDep = TRUE;
+ bHardDep = TRUE;
+ i = 9;
+ }
+ else
+ {
+ bPrjDep = FALSE;
+ bHardDep = FALSE;
+
+ aWhat = yytext;
+ if ( aWhat == "nmake" )
+ nCommandType = COMMAND_NMAKE;
+ else if ( aWhat == "get" )
+ nCommandType = COMMAND_GET;
+ else {
+ USHORT nOffset = aWhat.Copy( 3 ).ToInt32();
+ nCommandType = COMMAND_USER_START + nOffset - 1;
+ }
+ }
+ break;
+ case 3:
+ if ( !bPrjDep )
+ {
+ aWhat = yytext;
+ if ( aWhat == "-" )
+ {
+ aCommandPara = ByteString();
+ }
+ else
+ aCommandPara = aWhat;
+ }
+ break;
+ case 4:
+ if ( !bPrjDep )
+ {
+ aWhatOS = yytext;
+ if ( aWhatOS.GetTokenCount( ',' ) > 1 ) {
+ sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 );
+ aWhatOS = aWhatOS.GetToken( 0, ',' );
+ }
+ aWhatOS = aWhatOS.GetToken( 0, ',' );
+ if ( aWhatOS == "all" )
+ nOSType = ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX | OS_MAC );
+ else if ( aWhatOS == "w" )
+ nOSType = ( OS_WIN16 | OS_WIN32 );
+ else if ( aWhatOS == "p" )
+ nOSType = OS_OS2;
+ else if ( aWhatOS == "u" )
+ nOSType = OS_UNX;
+ else if ( aWhatOS == "d" )
+ nOSType = OS_WIN16;
+ else if ( aWhatOS == "n" )
+ nOSType = OS_WIN32;
+ else if ( aWhatOS == "m" )
+ nOSType = OS_MAC;
+ else
+ nOSType = OS_NONE;
+ }
+ break;
+ case 5:
+ if ( !bPrjDep )
+ {
+ aLogFileName = yytext;
+ }
+ break;
+ default:
+ if ( !bPrjDep )
+ {
+ ByteString aItem = yytext;
+ if ( aItem == "NULL" )
+ {
+ // Liste zu Ende
+ i = -1;
+ }
+ else
+ {
+ // ggfs. Dependency liste anlegen und ergaenzen
+ if ( !pDepList2 )
+ pDepList2 = new SByteStringList;
+ pDepList2->PutString( new ByteString( aItem ));
+ }
+ }
+ else
+ {
+ ByteString aItem = yytext;
+ if ( aItem == "NULL" )
+ {
+ // Liste zu Ende
+ i = -1;
+ bPrjDep= FALSE;
+ }
+ else
+ {
+ aProjectName = aDirName.GetToken ( 0, 0x5c);
+ if ( HasProject( aProjectName ))
+ {
+ pPrj = GetPrj( aProjectName );
+ // Projekt exist. schon, neue Eintraege anhaengen
+ }
+ else
+ {
+ // neues Project anlegen
+ pPrj = new Prj ( aProjectName );
+ pPrj->SetPreFix( aPrefix );
+ Insert(pPrj,LIST_APPEND);
+ }
+ pPrj->AddDependencies( aItem );
+ pPrj->HasHardDependencies( bHardDep );
+ }
+
+ }
+ break;
+ }
+ /* Wenn dieses Project noch nicht vertreten ist, in die Liste
+ der Solar-Projekte einfuegen */
+ if ( i == -1 )
+ {
+ aProjectName = aDirName.GetToken ( 0, 0x5c);
+ if ( HasProject( aProjectName ))
+ {
+ pPrj = GetPrj( aProjectName );
+ // Projekt exist. schon, neue Eintraege anhaengen
+ }
+ else
+ {
+ // neues Project anlegen
+ pPrj = new Prj ( aProjectName );
+ pPrj->SetPreFix( aPrefix );
+ Insert(pPrj,LIST_APPEND);
+ }
+
+ pCmdData = new CommandData;
+ pCmdData->SetPath( aDirName );
+ pCmdData->SetCommandType( nCommandType );
+ pCmdData->SetCommandPara( aCommandPara );
+ pCmdData->SetOSType( nOSType );
+ pCmdData->SetLogFile( aLogFileName );
+ pCmdData->SetComment( aCommentString );
+ pCmdData->SetClientRestriction( sClientRestriction );
+ if ( pDepList2 )
+ pCmdData->SetDependencies( pDepList2 );
+
+ pPrj->Insert ( pCmdData, LIST_APPEND );
+
+ }
+ i++;
+
+ rString.Erase(0, aToken.Len()+1);
+ aToken = rString.GetToken( 0, '\t' );
+ yytext = aToken.GetBuffer();
+
+ }
+ // und wer raeumt die depLst wieder ab ?
+}
+
+/*****************************************************************************/
+BOOL StarWriter::InsertProject ( Prj* pNewPrj )
+/*****************************************************************************/
+{
+ return FALSE;
+}
+
+/*****************************************************************************/
+Prj* StarWriter::RemoveProject ( ByteString aProjectName )
+/*****************************************************************************/
+{
+ ULONG nCount = Count();
+ Prj* pPrj;
+ Prj* pPrjFound = NULL;
+ SByteStringList* pPrjDeps;
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ pPrj = GetObject( i );
+ if ( pPrj->GetProjectName() == aProjectName )
+ pPrjFound = pPrj;
+ else
+ {
+ pPrjDeps = pPrj->GetDependencies( FALSE );
+ if ( pPrjDeps )
+ {
+ ByteString* pString;
+ USHORT nPrjDepsCount = pPrjDeps->Count();
+ for ( USHORT j = nPrjDepsCount; j > 0; j-- )
+ {
+ pString = pPrjDeps->GetObject( j - 1 );
+ if ( pString->GetToken( 0, '.') == aProjectName )
+ pPrjDeps->Remove( pString );
+ }
+ }
+ }
+ }
+
+ Remove( pPrjFound );
+
+ return pPrjFound;
+}
+
diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx
new file mode 100644
index 000000000000..1dd7feac98cd
--- /dev/null
+++ b/tools/bootstrp/rscdep.cxx
@@ -0,0 +1,371 @@
+/*************************************************************************
+ *
+ * $RCSfile: rscdep.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+/***************************************************************
+*
+* rscdep.cxx
+*
+* (c) Martin Hollmichel 1998
+*
+***************************************************************/
+
+#ifdef WNT
+#define __STDC__ 1
+#ifdef BOOTSTRAPPER
+#include <glibc/posix/getopt.h>
+#else
+#include <glibc/getopt.h>
+#endif
+#endif
+#ifdef UNX
+#ifdef BOOTSTRAPPER
+#include <glibc/posix/config.h>
+#ifdef MAC
+#include <glibc/posix/getopt.h>
+#endif
+#else
+#include <glibc/config.h>
+#ifdef MAC
+#include <glibc/getopt.h>
+#endif
+#endif
+#endif
+
+#if defined(SOLARIS)
+extern "C" {
+struct option
+{
+ char* name;
+ int has_arg;
+ int* flagl;
+ int val;
+};
+extern int getopt_long( int, char* const*, const char *, const struct option*, int *);
+}
+#endif
+
+#ifdef UNX
+#include <unistd.h>
+#endif
+
+#include <sys/stat.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "prj.hxx"
+
+#if SUPD < 356
+#include <tools.hxx>
+#else
+#include <string.hxx>
+#include <list.hxx>
+#include <fsys.hxx>
+#include <stream.hxx>
+#endif
+
+#include "cppdep.hxx"
+
+class RscHrcDep : public CppDep
+{
+public:
+ RscHrcDep();
+ virtual ~RscHrcDep();
+
+ virtual void Execute();
+};
+
+RscHrcDep::RscHrcDep() :
+ CppDep()
+{
+}
+
+RscHrcDep::~RscHrcDep()
+{
+}
+
+void RscHrcDep::Execute()
+{
+ CppDep::Execute();
+}
+
+static String aDelim = DirEntry::GetAccessDelimiter();
+
+int
+#ifdef WNT
+_cdecl
+#endif
+main( int argc, char **argv )
+{
+ int c;
+ int digit_optind = 0;
+ char aBuf[255];
+ char pOutputFileName[255];
+ String aSrsBaseName;
+ BOOL bSource = FALSE;
+ ByteString aRespArg;
+
+ RscHrcDep *pDep = new RscHrcDep;
+
+ for ( int i=1; i<argc; i++)
+ {
+ strcpy( aBuf, (const char *)argv[i] );
+ if ( aBuf[0] == '-' && aBuf[1] == 'f' && aBuf[2] == 'o' )
+ {
+ strcpy(pOutputFileName, &aBuf[3]);
+ //break;
+ }
+ if ( aBuf[0] == '-' && aBuf[1] == 'f' && aBuf[2] == 'p' )
+ {
+ strcpy(pOutputFileName, &aBuf[3]);
+ String aName( pOutputFileName, gsl_getSystemTextEncoding());
+ USHORT nPos = 0;
+ DirEntry aDest( aName );
+ aSrsBaseName = aDest.GetBase();
+ //break;
+ }
+ if (aBuf[0] == '-' && aBuf[1] == 'i' )
+ {
+ //printf("Include : %s\n", &aBuf[2] );
+ pDep->AddSearchPath( &aBuf[2] );
+ }
+ if (aBuf[0] == '-' && aBuf[1] == 'I' )
+ {
+ //printf("Include : %s\n", &aBuf[2] );
+ pDep->AddSearchPath( &aBuf[2] );
+ }
+ if (aBuf[0] == '@' )
+ {
+ ByteString aToken;
+ String aRespName( &aBuf[1], gsl_getSystemTextEncoding());
+ SimpleConfig aConfig( aRespName );
+ while ( (aToken = aConfig.GetNext()) != "")
+ {
+ char aBuf2[255];
+ (void) strcpy( aBuf2, aToken.GetBuffer());
+ if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'o' )
+ {
+ strcpy(pOutputFileName, &aBuf2[3]);
+ //break;
+ }
+ if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'p' )
+ {
+ strcpy(pOutputFileName, &aBuf2[3]);
+ String aName( pOutputFileName, gsl_getSystemTextEncoding());
+ USHORT nPos = 0;
+ DirEntry aDest( aName );
+ aSrsBaseName = aDest.GetBase();
+ //break;
+ }
+ if (aBuf2[0] == '-' && aBuf2[1] == 'i' )
+ {
+ //printf("Include : %s\n", &aBuf[2] );
+ pDep->AddSearchPath( &aBuf2[2] );
+ }
+ if (aBuf2[0] == '-' && aBuf2[1] == 'I' )
+ {
+ //printf("Include : %s\n", &aBuf[2] );
+ pDep->AddSearchPath( &aBuf2[2] );
+ }
+ if (( aBuf2[0] != '-' ) && ( aBuf2[0] != '@' ))
+ {
+ pDep->AddSource( &aBuf2[0] );
+ aRespArg += " ";
+ aRespArg += &aBuf2[0];
+ bSource = TRUE;
+ }
+ }
+ }
+ }
+
+ while( 1 )
+ {
+ int this_option_optind = optind ? optind : 1;
+ int option_index = 0;
+
+ static struct option long_options[] =
+ {
+ {"add",1,0,0},
+ {0,0,0,0}
+ };
+
+ c = getopt_long( argc, argv,
+ "_abcdefghi:jklmnopqrstuvwxyzABCDEFGHI:JKLMNOPQRSTUVWXYZ1234567890/-+=.\\()\"",
+ long_options, &option_index );
+ if ( c == -1 )
+ break;
+
+ switch( c )
+ {
+ case 0:
+#ifdef DEBUG_VERBOSE
+ printf("option %s", long_options[option_index].name);
+ if ( optarg)
+ printf(" with arg %s", optarg );
+ printf("\n");
+#endif
+ break;
+ case 'a' :
+#ifdef DEBUG_VERBOSE
+ printf("option a\n");
+#endif
+ break;
+
+ case 'l' :
+#ifdef DEBUG_VERBOSE
+ printf("option l with Value %s\n", optarg );
+#endif
+ pDep->AddSource( optarg );
+ break;
+
+ case 'h' :
+ case 'H' :
+ case '?' :
+ printf("RscDep 1.0 (c)2000 StarOffice\n");
+ break;
+
+ default:
+#ifdef DEBUG_VERBOSE
+ printf("Unknown getopt error\n");
+#endif
+ ;
+ }
+ }
+
+
+ DirEntry aEntry(".");
+ aEntry.ToAbs();
+ String aCwd = aEntry.GetName();
+/* USHORT nPos;
+#ifndef UNX
+ while ( (nPos = aCwd.Search('\\') != STRING_NOTFOUND ))
+#else
+ while ( (nPos = aCwd.Search('/') != STRING_NOTFOUND ))
+#endif
+ {
+ String attt = aCwd.Copy( 0, nPos );
+ aCwd.Erase( 0, nPos );
+ } */
+ SvFileStream aOutStream;
+ String aOutputFileName( pOutputFileName, gsl_getSystemTextEncoding());
+ DirEntry aOutEntry( aOutputFileName );
+ String aOutPath = aOutEntry.GetPath().GetFull();
+
+ String aFileName( aOutPath );
+ aFileName += aDelim;
+ aFileName += aCwd;
+ aFileName += String(".", gsl_getSystemTextEncoding());
+ aFileName += aSrsBaseName;
+ aFileName += String(".dpr", gsl_getSystemTextEncoding());
+ //fprintf( stderr, "OutFileName : %s \n",aFileName.GetStr());
+ aOutStream.Open( aFileName, STREAM_WRITE );
+
+ ByteString aString;
+ if ( optind < argc )
+ {
+#ifdef DEBUG_VERBOSE
+ printf("further arguments : ");
+#endif
+ aString = ByteString( pOutputFileName );
+ aString += ByteString(" : " );
+
+ while ( optind < argc )
+ {
+ if (!bSource )
+ {
+ aString += ByteString(" " );
+ aString += ByteString( argv[optind]);
+ pDep->AddSource( argv[optind++]);
+ }
+ else
+ {
+ optind++;
+ }
+ }
+ }
+ aString += aRespArg;
+ pDep->Execute();
+ ByteStringList *pLst = pDep->GetDepList();
+ ULONG nCount = pLst->Count();
+ if ( nCount == 0 )
+ {
+ aOutStream.WriteLine( aString );
+ }
+ else
+ {
+ aString += ByteString( "\\" );
+ aOutStream.WriteLine( aString );
+ }
+
+ for ( ULONG j=0; j<nCount; j++ )
+ {
+ ByteString *pStr = pLst->GetObject(j);
+ if ( j != (nCount-1) )
+ *pStr += ByteString( "\\" );
+ aOutStream.WriteLine( *pStr );
+ }
+ delete pDep;
+ aOutStream.Close();
+
+ return 0;
+}
+
+
+
+
diff --git a/tools/bootstrp/sstring.cxx b/tools/bootstrp/sstring.cxx
new file mode 100644
index 000000000000..4341446629d4
--- /dev/null
+++ b/tools/bootstrp/sstring.cxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * $RCSfile: sstring.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef WTC
+#ifdef _TOOLS_STRINGLIST
+#undef _TOOLS_STRINGLIST
+#endif
+#endif
+
+#define _TOOLS_STRINGLIST
+#include "sstring.hxx"
+
+SByteStringList::SByteStringList()
+{
+}
+
+SByteStringList::~SByteStringList()
+{
+}
+
+ULONG SByteStringList::IsString( ByteString* pStr )
+{
+ ULONG nRet = NOT_THERE;
+ if ( (nRet = GetPrevString( pStr )) != 0 )
+ {
+ ByteString* pString = GetObject( nRet );
+ if ( *pString == *pStr )
+ return nRet;
+ else
+ return NOT_THERE;
+ }
+ else
+ {
+ ByteString* pString = GetObject( 0 );
+ if ( pString && (*pString == *pStr) )
+ return 0;
+ else
+ return NOT_THERE;
+ }
+ return nRet;
+}
+
+ULONG SByteStringList::GetPrevString( ByteString* pStr )
+{
+ ULONG nRet = 0;
+ BOOL bFound = FALSE;
+ ULONG nCount = Count();
+ ULONG nUpper = nCount;
+ ULONG nLower = 0;
+ ULONG nCurrent = nUpper / 2;
+ ULONG nRem = 0;
+ ByteString* pString;
+
+ do
+ {
+ if ( (nCurrent == nLower) || (nCurrent == nUpper) )
+ return nLower;
+ pString = GetObject( nCurrent );
+ ULONG nResult = pStr->CompareTo( *pString );
+ if ( nResult == COMPARE_LESS )
+ {
+ nUpper = nCurrent;
+ nCurrent = (nCurrent + nLower) /2;
+ }
+ else if ( nResult == COMPARE_GREATER )
+ {
+ nLower = nCurrent;
+ nCurrent = (nUpper + nCurrent) /2;
+ }
+ else if ( nResult == COMPARE_EQUAL )
+ return nCurrent;
+ if ( nRem == nCurrent )
+ return nCurrent;
+ nRem = nCurrent;
+ }
+ while ( !bFound );
+ return nRet;
+}
+
+/**************************************************************************
+*
+* Sortiert einen ByteString in die Liste ein und gibt die Position,
+* an der einsortiert wurde, zurueck
+*
+**************************************************************************/
+
+ULONG SByteStringList::PutString( ByteString* pStr )
+{
+ ULONG nPos = GetPrevString ( pStr );
+ if ( Count() )
+ {
+ {
+ ByteString* pString = GetObject( 0 );
+ if ( pString->CompareTo( *pStr ) == COMPARE_GREATER )
+ {
+ Insert( pStr, (ULONG)0 );
+ return (ULONG)0;
+ }
+ }
+ ByteString* pString = GetObject( nPos );
+ if ( *pStr != *pString )
+ {
+ Insert( pStr, nPos+1 );
+ return ( nPos +1 );
+ }
+ }
+ else
+ {
+ Insert( pStr );
+ return (ULONG)0;
+ }
+
+ return NOT_THERE;
+}
+
+ByteString* SByteStringList::RemoveString( const ByteString& rName )
+{
+ ULONG i;
+ ByteString* pReturn;
+
+ for( i = 0 ; i < Count(); i++ )
+ {
+ if ( rName == *GetObject( i ) )
+ {
+ pReturn = GetObject(i);
+ Remove(i);
+ return pReturn;
+ }
+ }
+
+ return NULL;
+}
+
+
+
+
+
+
+
+
+
+SUniStringList::SUniStringList()
+{
+}
+
+SUniStringList::~SUniStringList()
+{
+}
+
+ULONG SUniStringList::IsString( UniString* pStr )
+{
+ ULONG nRet = NOT_THERE;
+ if ( (nRet = GetPrevString( pStr )) != 0 )
+ {
+ UniString* pString = GetObject( nRet );
+ if ( *pString == *pStr )
+ return nRet;
+ else
+ return NOT_THERE;
+ }
+ else
+ {
+ UniString* pString = GetObject( 0 );
+ if ( pString && (*pString == *pStr) )
+ return 0;
+ else
+ return NOT_THERE;
+ }
+ return nRet;
+}
+
+ULONG SUniStringList::GetPrevString( UniString* pStr )
+{
+ ULONG nRet = 0;
+ BOOL bFound = FALSE;
+ ULONG nCount = Count();
+ ULONG nUpper = nCount;
+ ULONG nLower = 0;
+ ULONG nCurrent = nUpper / 2;
+ ULONG nRem = 0;
+ UniString* pString;
+
+ do
+ {
+ if ( (nCurrent == nLower) || (nCurrent == nUpper) )
+ return nLower;
+ pString = GetObject( nCurrent );
+ ULONG nResult = pStr->CompareTo( *pString );
+ if ( nResult == COMPARE_LESS )
+ {
+ nUpper = nCurrent;
+ nCurrent = (nCurrent + nLower) /2;
+ }
+ else if ( nResult == COMPARE_GREATER )
+ {
+ nLower = nCurrent;
+ nCurrent = (nUpper + nCurrent) /2;
+ }
+ else if ( nResult == COMPARE_EQUAL )
+ return nCurrent;
+ if ( nRem == nCurrent )
+ return nCurrent;
+ nRem = nCurrent;
+ }
+ while ( !bFound );
+ return nRet;
+}
+
+/**************************************************************************
+*
+* Sortiert einen UniString in die Liste ein und gibt die Position,
+* an der einsortiert wurde, zurueck
+*
+**************************************************************************/
+
+ULONG SUniStringList::PutString( UniString* pStr )
+{
+ ULONG nPos = GetPrevString ( pStr );
+ if ( Count() )
+ {
+ {
+ UniString* pString = GetObject( 0 );
+ if ( pString->CompareTo( *pStr ) == COMPARE_GREATER )
+ {
+ Insert( pStr, (ULONG)0);
+ return (ULONG)0;
+ }
+ }
+ UniString* pString = GetObject( nPos );
+ if ( *pStr != *pString )
+ {
+ Insert( pStr, nPos+1 );
+ return ( nPos +1 );
+ }
+ }
+ else
+ {
+ Insert( pStr );
+ return (ULONG)0;
+ }
+
+ return NOT_THERE;
+}
+
+UniString* SUniStringList::RemoveString( const UniString& rName )
+{
+ ULONG i;
+ UniString* pReturn;
+
+ for( i = 0 ; i < Count(); i++ )
+ {
+ if ( rName == *GetObject( i ) )
+ {
+ pReturn = GetObject(i);
+ Remove(i);
+ return pReturn;
+ }
+ }
+
+ return NULL;
+}
diff --git a/tools/inc/impcont.hxx b/tools/inc/impcont.hxx
new file mode 100644
index 000000000000..f3efc5ea33e0
--- /dev/null
+++ b/tools/inc/impcont.hxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * $RCSfile: impcont.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _IMPCONT_HXX
+#define _IMPCONT_HXX
+
+#ifndef _TOOLS_H
+#include <tools.h>
+#endif
+
+#ifndef _CONTNR_HXX
+#include <contnr.hxx>
+#endif
+
+typedef void* PVOID;
+
+// ----------
+// - CBlock -
+// ----------
+
+class CBlock
+{
+private:
+ CBlock* pPrev; // Vorheriger Block
+ CBlock* pNext; // Naechster Block
+ USHORT nSize; // Groesse des Blocks
+ USHORT nCount; // Anzahl Pointer
+ void** pNodes; // Pointer auf die Daten
+
+public:
+ // Fuer List-Container
+ CBlock( USHORT nSize, CBlock* pPrev, CBlock* pNext );
+ // Fuer Array-Container
+ CBlock( USHORT nSize, CBlock* pPrev );
+ // Copy-Ctor
+ CBlock( const CBlock& r, CBlock* pPrev );
+ ~CBlock();
+
+ void Insert( void* p, USHORT nIndex, USHORT nReSize );
+ CBlock* Split( void* p, USHORT nIndex, USHORT nReSize );
+ void* Remove( USHORT nIndex, USHORT nReSize );
+ void* Replace( void* pNew, USHORT nIndex );
+
+ void** GetNodes() const { return pNodes; }
+ void** GetObjectPtr( USHORT nIndex );
+ void* GetObject( USHORT nIndex ) const;
+
+ void SetSize( USHORT nNewSize );
+
+ USHORT GetSize() const { return nCount; }
+ USHORT Count() const { return nCount; }
+ void SetPrevBlock( CBlock* p ) { pPrev = p; }
+ void SetNextBlock( CBlock* p ) { pNext = p; }
+ CBlock* GetPrevBlock() const { return pPrev; }
+ CBlock* GetNextBlock() const { return pNext; }
+ void Reset() { nCount = 0; }
+
+private:
+ CBlock( const CBlock& r );
+};
+
+/*************************************************************************
+|*
+|* CBlock::GetObject()
+|*
+|* Beschreibung Gibt einen Pointer aus dem Block zurueck
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+inline void* CBlock::GetObject( USHORT nIndex ) const
+{
+ return pNodes[nIndex];
+}
+
+/*************************************************************************
+|*
+|* Container::ImpGetObject()
+|*
+|* Beschreibung Wir gehen davon aus, das Pointer in der Regel
+|* sich im ersten Block befindet und schalten
+|* deshalb eine Inline-Methode davor
+|* Ersterstellung TH 02.07.93
+|* Letzte Aenderung TH 02.07.93
+|*
+*************************************************************************/
+
+inline void* Container::ImpGetObject( ULONG nIndex ) const
+{
+ if ( pFirstBlock && (nIndex < pFirstBlock->Count()) )
+ // Item innerhalb des gefundenen Blocks zurueckgeben
+ return pFirstBlock->GetObject( (USHORT)nIndex );
+ else
+ return GetObject( nIndex );
+}
+
+/*************************************************************************
+|*
+|* Container::ImpGetOnlyNodes()
+|*
+|* Beschreibung Wenn es nur einen Block gibt, wird davon
+|* das Daten-Array zurueckgegeben
+|* Ersterstellung TH 24.01.96
+|* Letzte Aenderung TH 24.01.96
+|*
+*************************************************************************/
+
+inline void** Container::ImpGetOnlyNodes() const
+{
+ if ( (pFirstBlock == pLastBlock) && pFirstBlock )
+ return pFirstBlock->GetNodes();
+ else
+ return NULL;
+}
+
+#endif // _IMPCONT_HXX
diff --git a/tools/inc/impstrg.hxx b/tools/inc/impstrg.hxx
new file mode 100644
index 000000000000..9f40651cbba4
--- /dev/null
+++ b/tools/inc/impstrg.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: impstrg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _IMPSTRG_HXX
+#define _IMPSTRG_HXX
+
+#ifndef _TOOLS_H
+#include <tools.h>
+#endif
+
+#ifndef _STRING_HXX
+#include <string.hxx>
+#endif
+
+// ------------------------------
+// - Debug-Methoden fuer String -
+// ------------------------------
+
+const char* DbgCheckByteString( const void* pString );
+const char* DbgCheckUniString( const void* pString );
+
+// -------------------------------
+// - Hilfsfunktionen fuer String -
+// -------------------------------
+
+xub_StrLen ImplStringLen( const sal_Char* pStr );
+xub_StrLen ImplStringLen( const sal_Unicode* pStr );
+
+// ------------------------------------
+// - Zugriff fuer International class -
+// ------------------------------------
+
+sal_Unicode* ImplGet1ByteUnicodeTab( rtl_TextEncoding eTextEncoding );
+
+#endif // _IMPSTRG_HXX
diff --git a/tools/inc/toolsin.hxx b/tools/inc/toolsin.hxx
new file mode 100644
index 000000000000..04f6720b66fc
--- /dev/null
+++ b/tools/inc/toolsin.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolsin.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:03 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLSIN_HXX
+#define _TOOLSIN_HXX
+
+#ifndef _TOOLS_H
+#include <tools.h>
+#endif
+
+struct ImplRegisterLanguageData;
+struct ImplRegisterFormatData;
+struct Impl1ByteUnicodeTabData;
+struct Impl1ByteConvertTabData;
+
+// --------------
+// - TOOLSNDATA -
+// --------------
+
+struct TOOLSINDATA
+{
+ ImplRegisterLanguageData* mpFirstLangData;
+ ImplRegisterFormatData* mpFirstFormatData;
+ Impl1ByteUnicodeTabData* mpFirstUniTabData;
+ Impl1ByteConvertTabData* mpFirstConvertTabData;
+};
+
+TOOLSINDATA* ImplGetToolsInData();
+
+#endif // _TOOLSIN_HXX
diff --git a/tools/os2/inc/dll.hxx b/tools/os2/inc/dll.hxx
new file mode 100644
index 000000000000..4313ccb1e739
--- /dev/null
+++ b/tools/os2/inc/dll.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: dll.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DLL_HXX
+#define _DLL_HXX
+
+// MultiThread-Sicherung aktivieren
+void EnterMultiThread( int bEnter );
+int IsMultiThread();
+
+// Um Resourcen wieder freizugeben
+void ImpDeInitOS2Tools();
+
+#endif
diff --git a/tools/os2/source/dll/makefile.mk b/tools/os2/source/dll/makefile.mk
new file mode 100644
index 000000000000..db28e90215f3
--- /dev/null
+++ b/tools/os2/source/dll/makefile.mk
@@ -0,0 +1,83 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:04 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=TOOLS
+TARGET=dll
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= toolsdll.cxx
+
+SLOFILES= $(SLO)$/toolsdll.obj
+
+OBJFILES= $(OBJ)$/toolsdll.obj
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/os2/source/dll/toolsdll.cxx b/tools/os2/source/dll/toolsdll.cxx
new file mode 100644
index 000000000000..9c87637bc2c4
--- /dev/null
+++ b/tools/os2/source/dll/toolsdll.cxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolsdll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SHL_HXX
+#include <shl.hxx>
+#endif
+
+#ifndef _DLL_HXX
+#include <dll.hxx>
+#endif
+
+// =======================================================================
+
+static void* aAppData[SHL_COUNT];
+
+// -----------------------------------------------------------------------
+
+void** GetAppData( USHORT nSharedLib )
+{
+ return &(aAppData[nSharedLib]);
+}
+
+// =======================================================================
+
diff --git a/tools/prj/d.lst b/tools/prj/d.lst
new file mode 100644
index 000000000000..2f42e9fde7d6
--- /dev/null
+++ b/tools/prj/d.lst
@@ -0,0 +1,144 @@
+mkdir: %_DEST%\bin%_EXT%\remote
+mkdir: %_DEST%\inc%_EXT%\bootstrp
+mkdir: %_DEST%\inc%_EXT%\tools
+mkdir: %_DEST%\lib%_EXT%\remote
+
+..\%__SRC%\bin\remote\tl?????.dll %_DEST%\bin%_EXT%\remote\tl?????.dll
+..\%__SRC%\bin\remote\tl?????.sym %_DEST%\bin%_EXT%\remote\tl?????.sym
+..\%__SRC%\bin\soagent.dll %_DEST%\bin%_EXT%\soagent.dll
+..\%__SRC%\bin\symbol.exe %_DEST%\bin%_EXT%\symbol.exe
+..\%__SRC%\bin\tl?????.dll %_DEST%\bin%_EXT%\tl?????.dll
+..\%__SRC%\bin\tl?????.sym %_DEST%\bin%_EXT%\tl?????.sym
+..\%__SRC%\bin\wps?????.dll %_DEST%\bin%_EXT%\wps?????.dll
+..\%__SRC%\lib\atools.lib %_DEST%\lib%_EXT%\atools.lib
+..\%__SRC%\lib\bootstrp.lib %_DEST%\lib%_EXT%\bootstrp.lib
+..\%__SRC%\lib\bsvermap.lib %_DEST%\lib%_EXT%\bsvermap.lib
+..\%__SRC%\lib\itools.lib %_DEST%\lib%_EXT%\itools.lib
+..\%__SRC%\lib\lib*.a %_DEST%\lib%_EXT%\lib*.a
+..\%__SRC%\lib\lib*.sl %_DEST%\lib%_EXT%\lib*.sl
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
+..\%__SRC%\lib\lib*.so.* %_DEST%\lib%_EXT%\lib*.so.*
+..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%\lib*.dylib
+..\%__SRC%\lib\remote\*.so %_DEST%\lib%_EXT%\remote\*.so
+..\%__SRC%\lib\remote\itools.lib %_DEST%\lib%_EXT%\remote\itools.lib
+..\%__SRC%\lib\stdstrm.lib %_DEST%\lib%_EXT%\stdstrm.lib
+..\%__SRC%\lib\tools.lib %_DEST%\lib%_EXT%\tools.lib
+..\%__SRC%\misc\tl?????.map %_DEST%\bin%_EXT%\tl?????.map
+..\%__SRC%\slb\btstrpsh.lib %_DEST%\lib%_EXT%\btstrpsh.lib
+
+hedabu: ..\win\inc\dll.hxx %_DEST%\inc%_EXT%\tools\dll.hxx
+hedabu: ..\%GUIBASE%\inc\dll.hxx %_DEST%\inc%_EXT%\tools\dll.hxx
+hedabu: ..\%__SRC%\inc\dll.hxx %_DEST%\inc%_EXT%\tools\dll.hxx
+hedabu: ..\%__SRC%\inc\svconf.h %_DEST%\inc%_EXT%\tools\svconf.h
+hedabu: ..\%__SRC%\inc\toolerr.hxx %_DEST%\inc%_EXT%\tools\toolerr.hxx
+hedabu: ..\bootstrp\minormk.hxx %_DEST%\inc%_EXT%\bootstrp\minormk.hxx
+hedabu: ..\bootstrp\appdef.hxx %_DEST%\inc%_EXT%\bootstrp\appdef.hxx
+hedabu: ..\bootstrp\bsecode.hxx %_DEST%\inc%_EXT%\bootstrp\bsecode.hxx
+hedabu: ..\bootstrp\command.hxx %_DEST%\inc%_EXT%\bootstrp\command.hxx
+hedabu: ..\bootstrp\copyprj.hxx %_DEST%\inc%_EXT%\bootstrp\copyprj.hxx
+hedabu: ..\bootstrp\deliver.hxx %_DEST%\inc%_EXT%\bootstrp\deliver.hxx
+hedabu: ..\bootstrp\drvmap.hxx %_DEST%\inc%_EXT%\bootstrp\drvmap.hxx
+hedabu: ..\bootstrp\envset.hxx %_DEST%\inc%_EXT%\bootstrp\envset.hxx
+hedabu: ..\bootstrp\errhdl.hxx %_DEST%\inc%_EXT%\bootstrp\errhdl.hxx
+hedabu: ..\bootstrp\fattr.hxx %_DEST%\inc%_EXT%\bootstrp\fattr.hxx
+hedabu: ..\bootstrp\getopt.h %_DEST%\inc%_EXT%\bootstrp\getopt.h
+hedabu: ..\bootstrp\hedabu.hxx %_DEST%\inc%_EXT%\bootstrp\hedabu.hxx
+hedabu: ..\bootstrp\inimgr.hxx %_DEST%\inc%_EXT%\bootstrp\inimgr.hxx
+hedabu: ..\bootstrp\listmacr.hxx %_DEST%\inc%_EXT%\bootstrp\listmacr.hxx
+hedabu: ..\bootstrp\prj.hxx %_DEST%\inc%_EXT%\bootstrp\prj.hxx
+hedabu: ..\bootstrp\revision.hxx %_DEST%\inc%_EXT%\bootstrp\revision.hxx
+hedabu: ..\bootstrp\sstring.hxx %_DEST%\inc%_EXT%\bootstrp\sstring.hxx
+hedabu: ..\bootstrp\static.mk %_DEST%\inc%_EXT%\static.mk
+hedabu: ..\bootstrp\uierr.hxx %_DEST%\inc%_EXT%\bootstrp\uierr.hxx
+hedabu: ..\bootstrp\updmake.hxx %_DEST%\inc%_EXT%\bootstrp\updmake.hxx
+hedabu: ..\bootstrp\vermap.hxx %_DEST%\inc%_EXT%\bootstrp\vermap.hxx
+hedabu: ..\inc\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx
+hedabu: ..\inc\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx
+hedabu: ..\inc\agitem.hxx %_DEST%\inc%_EXT%\tools\agitem.hxx
+hedabu: ..\inc\bcst.hxx %_DEST%\inc%_EXT%\tools\bcst.hxx
+hedabu: ..\inc\bcstdefs.hxx %_DEST%\inc%_EXT%\tools\bcstdefs.hxx
+hedabu: ..\inc\bigint.hxx %_DEST%\inc%_EXT%\tools\bigint.hxx
+hedabu: ..\inc\cachestr.hxx %_DEST%\inc%_EXT%\tools\cachestr.hxx
+hedabu: ..\inc\chapi.hxx %_DEST%\inc%_EXT%\tools\chapi.hxx
+hedabu: ..\inc\color.hxx %_DEST%\inc%_EXT%\tools\color.hxx
+hedabu: ..\inc\contnr.hxx %_DEST%\inc%_EXT%\tools\contnr.hxx
+hedabu: ..\inc\date.hxx %_DEST%\inc%_EXT%\tools\date.hxx
+hedabu: ..\inc\datetime.hxx %_DEST%\inc%_EXT%\tools\datetime.hxx
+hedabu: ..\inc\timestamp.hxx %_DEST%\inc%_EXT%\tools\timestamp.hxx
+hedabu: ..\inc\debug.hxx %_DEST%\inc%_EXT%\tools\debug.hxx
+hedabu: ..\inc\defport.h %_DEST%\inc%_EXT%\tools\defport.h
+hedabu: ..\inc\download.hxx %_DEST%\inc%_EXT%\tools\download.hxx
+hedabu: ..\inc\dynary.hxx %_DEST%\inc%_EXT%\tools\dynary.hxx
+hedabu: ..\inc\errcode.hxx %_DEST%\inc%_EXT%\tools\errcode.hxx
+hedabu: ..\inc\errinf.hxx %_DEST%\inc%_EXT%\tools\errinf.hxx
+hedabu: ..\inc\fract.hxx %_DEST%\inc%_EXT%\tools\fract.hxx
+hedabu: ..\inc\fsys.hxx %_DEST%\inc%_EXT%\tools\fsys.hxx
+hedabu: ..\inc\eacopier.hxx %_DEST%\inc%_EXT%\tools\eacopier.hxx
+hedabu: ..\inc\gen.hxx %_DEST%\inc%_EXT%\tools\gen.hxx
+hedabu: ..\inc\globname.hxx %_DEST%\inc%_EXT%\tools\globname.hxx
+hedabu: ..\inc\inetdef.hxx %_DEST%\inc%_EXT%\tools\inetdef.hxx
+hedabu: ..\inc\inetmime.hxx %_DEST%\inc%_EXT%\tools\inetmime.hxx
+hedabu: ..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\tools\inetmsg.hxx
+hedabu: ..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\tools\inetstrm.hxx
+hedabu: ..\inc\intn.hxx %_DEST%\inc%_EXT%\tools\intn.hxx
+hedabu: ..\inc\isolang.hxx %_DEST%\inc%_EXT%\tools\isolang.hxx
+hedabu: ..\inc\lang.hxx %_DEST%\inc%_EXT%\tools\lang.hxx
+hedabu: ..\inc\link.hxx %_DEST%\inc%_EXT%\tools\link.hxx
+hedabu: ..\inc\list.hxx %_DEST%\inc%_EXT%\tools\list.hxx
+hedabu: ..\inc\mempool.hxx %_DEST%\inc%_EXT%\tools\mempool.hxx
+hedabu: ..\inc\multisel.hxx %_DEST%\inc%_EXT%\tools\multisel.hxx
+hedabu: ..\inc\new.hxx %_DEST%\inc%_EXT%\tools\new.hxx
+hedabu: ..\inc\ownlist.hxx %_DEST%\inc%_EXT%\tools\ownlist.hxx
+hedabu: ..\inc\postsys.h %_DEST%\inc%_EXT%\tools\postsys.h
+hedabu: ..\inc\presys.h %_DEST%\inc%_EXT%\tools\presys.h
+hedabu: ..\inc\pstm.hxx %_DEST%\inc%_EXT%\tools\pstm.hxx
+hedabu: ..\inc\queue.hxx %_DEST%\inc%_EXT%\tools\queue.hxx
+hedabu: ..\inc\rc.h %_DEST%\inc%_EXT%\tools\rc.h
+hedabu: ..\inc\rc.hxx %_DEST%\inc%_EXT%\tools\rc.hxx
+hedabu: ..\inc\rcid.h %_DEST%\inc%_EXT%\tools\rcid.h
+hedabu: ..\inc\ref.hxx %_DEST%\inc%_EXT%\tools\ref.hxx
+hedabu: ..\inc\resid.hxx %_DEST%\inc%_EXT%\tools\resid.hxx
+hedabu: ..\inc\resmgr.hxx %_DEST%\inc%_EXT%\tools\resmgr.hxx
+hedabu: ..\inc\vclrsc.hxx %_DEST%\inc%_EXT%\tools\vclrsc.hxx
+hedabu: ..\inc\rtti.hxx %_DEST%\inc%_EXT%\tools\rtti.hxx
+hedabu: ..\inc\shl.hxx %_DEST%\inc%_EXT%\tools\shl.hxx
+hedabu: ..\inc\simplecm.hxx %_DEST%\inc%_EXT%\tools\simplecm.hxx
+hedabu: ..\inc\simplerm.hxx %_DEST%\inc%_EXT%\tools\simplerm.hxx
+hedabu: ..\inc\solar.h %_DEST%\inc%_EXT%\tools\solar.h
+hedabu: ..\inc\solmath.hxx %_DEST%\inc%_EXT%\tools\solmath.hxx
+hedabu: ..\inc\solver.h %_DEST%\inc%_EXT%\tools\solver.h
+hedabu: ..\inc\stack.hxx %_DEST%\inc%_EXT%\tools\stack.hxx
+hedabu: ..\inc\stdstrm.hxx %_DEST%\inc%_EXT%\tools\stdstrm.hxx
+hedabu: ..\inc\stream.hxx %_DEST%\inc%_EXT%\tools\stream.hxx
+hedabu: ..\inc\string.hxx %_DEST%\inc%_EXT%\tools\string.hxx
+hedabu: ..\inc\svwin.h %_DEST%\inc%_EXT%\tools\svwin.h
+hedabu: ..\inc\table.hxx %_DEST%\inc%_EXT%\tools\table.hxx
+hedabu: ..\inc\time.hxx %_DEST%\inc%_EXT%\tools\time.hxx
+hedabu: ..\inc\tools.h %_DEST%\inc%_EXT%\tools\tools.h
+hedabu: ..\inc\unqid.hxx %_DEST%\inc%_EXT%\tools\unqid.hxx
+hedabu: ..\inc\unqidx.hxx %_DEST%\inc%_EXT%\tools\unqidx.hxx
+hedabu: ..\inc\urlkeys.hxx %_DEST%\inc%_EXT%\tools\urlkeys.hxx
+hedabu: ..\inc\urlobj.hxx %_DEST%\inc%_EXT%\tools\urlobj.hxx
+hedabu: ..\inc\vcompat.hxx %_DEST%\inc%_EXT%\tools\vcompat.hxx
+hedabu: ..\inc\wldcrd.hxx %_DEST%\inc%_EXT%\tools\wldcrd.hxx
+hedabu: ..\inc\zcodec.hxx %_DEST%\inc%_EXT%\tools\zcodec.hxx
+hedabu: ..\inc\tempfile.hxx %_DEST%\inc%_EXT%\tools\tempfile.hxx
+hedabu: ..\os2\inc\svpm.h %_DEST%\inc%_EXT%\tools\svpm.h
+hedabu: ..\win\inc\parser.hxx %_DEST%\inc%_EXT%\tools\parser.hxx
+hedabu: ..\win\inc\postwin.h %_DEST%\inc%_EXT%\tools\postwin.h
+hedabu: ..\win\inc\prewin.h %_DEST%\inc%_EXT%\tools\prewin.h
+hedabu: ..\win\inc\shutil.h %_DEST%\inc%_EXT%\tools\shutil.h
+hedabu: ..\win\inc\winshell.hxx %_DEST%\inc%_EXT%\tools\winshell.hxx
+hedabu: ..\inc\l2txtenc.hxx %_DEST%\inc%_EXT%\tools\l2txtenc.hxx
+hedabu: ..\inc\geninfo.hxx %_DEST%\inc%_EXT%\tools\geninfo.hxx
+hedabu: ..\inc\iparser.hxx %_DEST%\inc%_EXT%\tools\iparser.hxx
+hedabu: ..\inc\siclient.hxx %_DEST%\inc%_EXT%\tools\siclient.hxx
+hedabu: ..\inc\iiclient.hxx %_DEST%\inc%_EXT%\tools\iiclient.hxx
+hedabu: ..\inc\iclient.hxx %_DEST%\inc%_EXT%\tools\iclient.hxx
+hedabu: ..\inc\tcpcon.hxx %_DEST%\inc%_EXT%\tools\tcpcon.hxx
+hedabu: ..\inc\infocom.hxx %_DEST%\inc%_EXT%\tools\infocom.hxx
+hedabu: ..\inc\persbcst.hxx %_DEST%\inc%_EXT%\tools\persbcst.hxx
+hedabu: ..\inc\stcpcon.hxx %_DEST%\inc%_EXT%\tools\stcpcon.hxx
+hedabu: ..\inc\btcpcon.hxx %_DEST%\inc%_EXT%\tools\btcpcon.hxx
+hedabu: ..\inc\sasyncfn.hxx %_DEST%\inc%_EXT%\tools\sasyncfn.hxx
+hedabu: ..\inc\tcpdef.hxx %_DEST%\inc%_EXT%\tools\tcpdef.hxx
diff --git a/tools/source/communi/geninfo.cxx b/tools/source/communi/geninfo.cxx
new file mode 100644
index 000000000000..f817b58b1dc3
--- /dev/null
+++ b/tools/source/communi/geninfo.cxx
@@ -0,0 +1,469 @@
+/*************************************************************************
+ *
+ * $RCSfile: geninfo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "geninfo.hxx"
+#include <stdio.h>
+
+//
+// class GenericInformation
+//
+
+/*****************************************************************************/
+GenericInformation::GenericInformation( const ByteString &rKey,
+ const ByteString &rValue,
+ GenericInformationList *pParentList,
+ GenericInformationList *pSubInfos )
+/*****************************************************************************/
+ : ByteString( rKey ),
+ sValue( rValue ),
+ pParent( pParentList ),
+ pInfoList( pSubInfos )
+{
+ // if a ParentList exists, insert this object into it
+ if ( pParent )
+ pParent->InsertInfo( this );
+ // make myself owner of pInfoList
+ if ( pInfoList )
+ pInfoList->SetOwner( this );
+}
+
+/*****************************************************************************/
+GenericInformation::GenericInformation( const GenericInformation& rInf,
+ BOOL bCopySubs)
+/*****************************************************************************/
+ : ByteString( rInf ),
+ sValue( rInf.sValue ),
+ pParent(NULL),
+ pInfoList( 0L )
+{
+ if(bCopySubs && rInf.pInfoList)
+ pInfoList = new GenericInformationList(*rInf.pInfoList, this);
+}
+
+/*****************************************************************************/
+GenericInformation::~GenericInformation()
+/*****************************************************************************/
+{
+ // remove pInfoList and all childs out of memory
+ delete pInfoList;
+ pInfoList = 0;
+
+ // remove this Info out of ParentList
+ if ( pParent )
+ pParent->RemoveInfo( this );
+}
+
+/*****************************************************************************/
+BOOL GenericInformation::InsertSubInfo( GenericInformation *pInfo )
+/*****************************************************************************/
+{
+ return ( pInfoList && pInfoList->InsertInfo( pInfo ));
+}
+
+/*****************************************************************************/
+BOOL GenericInformation::InsertSubInfo( const ByteString &rPathKey, const ByteString &rValue,
+ BOOL bSearchByPath, BOOL bNewPath )
+/*****************************************************************************/
+{
+ return (pInfoList && pInfoList->InsertInfo( rPathKey, rValue, bSearchByPath, bNewPath ));
+}
+
+/*****************************************************************************/
+void GenericInformation::RemoveSubInfo( GenericInformation *pInfo,
+ BOOL bDelete )
+/*****************************************************************************/
+{
+ pInfoList->RemoveInfo( pInfo, bDelete );
+}
+
+/*****************************************************************************/
+//void GenericInformation::RemoveSelf( BOOL bDelete )
+/*****************************************************************************/
+/*{
+ if ( pParent )
+ pParent->RemoveInfo( this, bDelete ); // loescht sich aus der Liste vom Parent und
+ // bei Bedarf auch mit obiger Methode alle Sublisten
+
+ // loescht sich bei Bedarf auch selbst
+ if ( bDelete )
+ delete this;
+}
+*/
+
+/*****************************************************************************/
+GenericInformation *GenericInformation::GetSubInfo( ByteString &rKey,
+ BOOL bSearchByPath,
+ BOOL bCreatePath )
+/*****************************************************************************/
+{
+ if ( !pInfoList && bCreatePath )
+ pInfoList = new GenericInformationList( this );
+ if ( pInfoList )
+ return pInfoList->GetInfo( rKey, bSearchByPath, bCreatePath );
+ return NULL;
+}
+
+
+//
+// class GenericInformationList
+//
+
+/*****************************************************************************/
+GenericInformationList::GenericInformationList( GenericInformation *pParent )
+/*****************************************************************************/
+ : pOwner( pParent )
+{
+}
+
+/*****************************************************************************/
+GenericInformationList::GenericInformationList(const GenericInformationList& rList,
+ GenericInformation *pParent)
+/*****************************************************************************/
+{
+ USHORT i;
+ GenericInformation* pTemp,*pWork;
+
+ pOwner = pParent;
+
+ for(i=0;i<rList.Count();i++)
+ {
+ pTemp = rList.GetObject(i);
+ pWork = new GenericInformation(*pTemp,TRUE);
+
+ Insert(pWork,LIST_APPEND);
+ }
+}
+
+/*****************************************************************************/
+GenericInformationList::~GenericInformationList()
+/*****************************************************************************/
+{
+ // delete all Informations stored in this List
+ // ### GH: Hier werden dann wohl etwa die Hälfte der Einträge gelöscht
+/* for ( ULONG i = 0; i < Count(); i++ ) {
+ GetObject( i )->ListDeleted();
+ delete GetObject( i );
+ Remove( i );*/
+ // Neue Variante:
+ while ( Count() ) {
+ GetObject( 0 )->ListDeleted();
+ delete GetObject( 0 );
+ Remove( (ULONG)0 );
+ }
+}
+
+/*****************************************************************************/
+GenericInformation *GenericInformationList::Search( ULONG &rPos, ByteString sKey,
+ ULONG nStart, ULONG nEnd )
+/*****************************************************************************/
+{
+ if ( Count() == 0 ) {
+ rPos = 0;
+ return NULL;
+ }
+
+ if ( nStart == nEnd ) {
+ rPos = nStart;
+ ByteString sCandidate = ByteString( *GetObject( nStart ));
+ if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii()) {
+ return GetObject( nStart ); // found !!!
+ }
+ else {
+ // requested key not found
+ return NULL;
+ }
+ }
+
+ // search binary in existing list
+ ULONG nActPos = nStart + (( nEnd - nStart ) / 2 );
+ rPos = nActPos;
+ ByteString sCandidate = ByteString( *GetObject( nActPos ));
+
+ if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii())
+ return GetObject( nActPos ); // found !!!
+
+ // split the list at ActPos
+ if ( sCandidate < sKey )
+ return Search( rPos, sKey, nActPos + 1, nEnd );
+ else
+ return Search( rPos, sKey, nStart, nActPos );
+}
+
+/*****************************************************************************/
+GenericInformation *GenericInformationList::GetInfo( ByteString &rKey,
+ BOOL bSearchByPath,
+ BOOL bCreatePath )
+/*****************************************************************************/
+{
+
+ rKey.EraseLeadingChars( '/' );
+ rKey.EraseTrailingChars( '/' );
+
+ ByteString sKey;
+ if ( bSearchByPath )
+ sKey = rKey.GetToken( 0, '/' );
+ else
+ sKey = rKey;
+
+ ULONG nPos = 0;
+ GenericInformation *pReturnInfo = Search( nPos, sKey, 0, Count() - 1 );
+ /* wenn kein Searchpath gesetzt und kein Returninfo vorhanden,
+ * gib NULL zurueck
+ * wenn Searchpath gesetzt und returninfo vorhanden,
+ * suche weiter nach unten
+ * wenn searchpath gesetzt kein returninfo vorhanden und newpath gesetzt,
+ * mache neues Verzeichniss
+ */
+ USHORT nTokenCount = rKey.GetTokenCount('/');
+ // search for next key of path in next level of tree
+ if ( bSearchByPath && (nTokenCount > 1)) {
+ ByteString sPath = ByteString(rKey.Copy( sKey.Len() + 1 ));
+ if ( !pReturnInfo ) { // wenn kein Return, dann muss man es anlegen
+ if ( !bCreatePath ) // wenn aber kein Create, dann nicht anlegen
+ return NULL;
+ USHORT nTmp = 0;
+ pReturnInfo = new GenericInformation( sKey, "", this, NULL);
+ pReturnInfo->SetSubList( new GenericInformationList( pReturnInfo ));
+ }
+ return pReturnInfo->GetSubInfo( sPath, TRUE, bCreatePath );
+ }
+ if ( !pReturnInfo && bCreatePath ) {
+ pReturnInfo = new GenericInformation ( sKey, "", this, NULL);
+ }
+
+ return pReturnInfo; // kann durchaus NULL sein.
+}
+
+/*****************************************************************************/
+ULONG GenericInformationList::InsertSorted( GenericInformation *pInfo,
+ BOOL bOverwrite,
+ ULONG nStart, ULONG nEnd )
+/*****************************************************************************/
+{
+ if ( Count() == 0 ) {
+ // empty list, so insert at first pos
+ Insert( pInfo, LIST_APPEND );
+ return 0;
+ }
+
+// ### GH: dieser Block schein überflüssig zu sein
+ ByteString sKey( pInfo->GetBuffer());
+ if ( Count() == 1 ) {
+ ByteString sCandidate( *GetObject( 0 ));
+ if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii()) {
+ // key allready exists in list
+ if ( bOverwrite )
+ Replace( pInfo, ULONG(0)); // ### Laut NF scheint hier ein Memory Leak zu sein
+ return 0;
+ }
+ else if ( sCandidate > sKey ) {
+ Insert( pInfo, ULONG(0));
+ return 0;
+ }
+ else {
+ Insert( pInfo, LIST_APPEND );
+ return 1;
+ }
+ }
+// ### GH: /ENDE/ dieser Block schein überflüssig zu sein
+
+ ULONG nActPos = nStart + (( nEnd - nStart ) / 2 );
+ ByteString sCandidate = ByteString( *GetObject( nActPos ));
+
+ if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii()) {
+ // key allready exists in list
+ if ( bOverwrite )
+ Replace( pInfo, nActPos ); // ### Laut NF scheint hier ein Memory Leak zu sein
+ return nActPos;
+ }
+
+ if ( nStart == nEnd ) {
+ // now more ways to search for key -> insert here
+ if ( sCandidate > sKey ) {
+ Insert( pInfo, nStart );
+ return nStart;
+ }
+ else {
+ Insert( pInfo, nStart + 1 );
+ return ( nStart + 1 );
+ }
+ }
+
+ if ( nActPos == Count() - 1 ) {
+ // reached end of list -> insert here
+ Insert( pInfo, LIST_APPEND );
+ return ( nActPos + 1 );
+ }
+
+ ByteString sSecondCand = ByteString( *GetObject( nActPos + 1 ));
+ if (( sCandidate < sKey ) && ( sSecondCand.ToUpperAscii() > sKey )) {
+ // optimal position to insert object
+ Insert( pInfo, nActPos + 1 );
+ return ( nActPos + 1 );
+ }
+
+ if ( sCandidate < sKey )
+ return InsertSorted( pInfo, bOverwrite, nActPos + 1, nEnd );
+ else
+ return InsertSorted( pInfo, bOverwrite, nStart, nActPos );
+}
+
+/*****************************************************************************/
+BOOL GenericInformationList::InsertInfo( GenericInformation *pInfo,
+ BOOL bOverwrite )
+/*****************************************************************************/
+{
+ if ( !pInfo->Len())
+ return FALSE;
+
+ InsertSorted( pInfo, bOverwrite, 0, Count() - 1 );
+ return TRUE;
+}
+
+
+/*****************************************************************************/
+BOOL GenericInformationList::InsertInfo( const ByteString &rPathKey, const ByteString &rValue,
+ BOOL bSearchByPath, BOOL bNewPath )
+/*****************************************************************************/
+{
+ GenericInformation *pInfo;
+ ByteString sPathKey ( rPathKey );
+ sPathKey.EraseLeadingChars( '/' );
+ sPathKey.EraseTrailingChars( '/' );
+
+ pInfo = GetInfo( sPathKey, bSearchByPath, bNewPath );
+
+ if ( pInfo ) {
+ pInfo->SetValue( rValue );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*****************************************************************************
+BOOL GenericInformationList::InsertInfo( const String &rPathKey,
+ const String &rValue,
+ BOOL bNewPath = FALSE)
+/*****************************************************************************
+{
+ GenericInformation *pInfo;
+
+ if ( !pPathKey || '\0'==pPathKey[0] )
+ return FALSE;
+
+ char *pNextItem = strchr( pPathKey, '/' );
+ if ( !pNextItem ) { // kein Token mehr gefunden
+ /* aus dem PathKey kann nun eine GenericInformation gebildet
+ * und eingefuegt werden *
+ pInfo = GetInfo( pPathKey, FALSE );
+ // Object besteht nicht und soll auch nicht nachgebildet werden
+ if ( !pInfo && !bNewPath )
+ return FALSE;
+ // erzeuge neue GI und stopfe sie in die Liste. Fertig !
+ pInfo = new GenericInformation( String( pPathKey ), String( pValue ), 0, 0 );
+ return InsertInfo( pInfo, TRUE );
+ }
+ else { // noch nicht fertig, muss noch tiefer in den Baum gehen
+ // SuchString anfertigen
+ String sSearch ( pPathKey );
+ sSearch.Erase ( USHORT(pNextItem - pPathKey));
+ // suchen..
+ pInfo = GetInfo( sSearch, FALSE );
+ if ( !pInfo && ! bNewPath) // subinfo nicht vorhanden und
+ return FALSE; // ich darf keinen neuen Pfad anlegen
+
+ if ( !pInfo )
+ // neue Subinfo machen und einfuegen
+ pInfo = new GenericInformation ( sSearch , "", this, 0 );
+
+ pNextItem++;
+ return pInfo->InsertSubInfo( pNextItem, pValue, bNewPath );
+ }
+ }
+}
+*/
+
+/*****************************************************************************/
+void GenericInformationList::RemoveInfo( GenericInformation *pInfo,
+ BOOL bDelete )
+/*****************************************************************************/
+{
+ Remove( pInfo );
+ if ( bDelete )
+ delete pInfo;
+ if ( Count() == 0 && pOwner ) // Leere Listen entfernen;
+ {
+ SetOwner( NULL );
+ delete this;
+ }
+}
+
+GenericInformation* GenericInformationList::SetOwner( GenericInformation *pNewOwner )
+{
+ GenericInformation *pOldOwner = pOwner;
+ if ( pOwner ) // bei parent austragen;
+ pOwner->SetSubList( NULL );
+ if ( pNewOwner )
+ pNewOwner->SetSubList( this );
+ pOwner = pNewOwner;
+ return pOldOwner;
+}
+
+
diff --git a/tools/source/communi/makefile.mk b/tools/source/communi/makefile.mk
new file mode 100644
index 000000000000..970f41a6121a
--- /dev/null
+++ b/tools/source/communi/makefile.mk
@@ -0,0 +1,102 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=TOOLS
+TARGET=communi
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= simplecm.cxx bcst.cxx
+
+OBJFILES= $(OBJ)$/simplecm.obj \
+ $(OBJ)$/bcst.obj \
+ $(OBJ)$/persbcst.obj \
+ $(OBJ)$/iiclient.obj \
+ $(OBJ)$/siclient.obj \
+ $(OBJ)$/infocom.obj \
+ $(OBJ)$/bsockcon.obj \
+ $(OBJ)$/ssockcon.obj \
+ $(OBJ)$/parser.obj \
+ $(OBJ)$/geninfo.obj \
+
+SLOFILES= $(SLO)$/simplecm.obj \
+ $(SLO)$/bcst.obj \
+ $(SLO)$/persbcst.obj \
+ $(SLO)$/iiclient.obj \
+ $(SLO)$/siclient.obj \
+ $(SLO)$/infocom.obj \
+ $(SLO)$/bsockcon.obj \
+ $(SLO)$/ssockcon.obj \
+ $(SLO)$/parser.obj \
+ $(SLO)$/geninfo.obj \
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/communi/parser.cxx b/tools/source/communi/parser.cxx
new file mode 100644
index 000000000000..99160560504a
--- /dev/null
+++ b/tools/source/communi/parser.cxx
@@ -0,0 +1,438 @@
+/*************************************************************************
+ *
+ * $RCSfile: parser.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stream.hxx>
+#include <fsys.hxx>
+
+#include "iparser.hxx"
+#include "geninfo.hxx"
+
+
+
+//
+// class InformationParser
+//
+
+const char InformationParser::cKeyLevelChars = '\t';
+
+/*****************************************************************************/
+InformationParser::InformationParser( BOOL bReplace )
+/*****************************************************************************/
+ : pActStream( NULL ),
+ nErrorCode( 0 ),
+ nErrorLine( 0 ),
+ nActLine( 0 ),
+ bRecover( FALSE ),
+ sOldLine( "" ),
+ sErrorText( "" ),
+ bReplaceVariables( bReplace ),
+ nLevel( 0 ),
+ sUPD( "" ),
+ sVersion( "" )
+{
+}
+
+/*****************************************************************************/
+InformationParser::~InformationParser()
+/*****************************************************************************/
+{
+}
+
+/*****************************************************************************/
+ByteString &InformationParser::ReadLine()
+/*****************************************************************************/
+{
+ ByteString sLine;
+ if ( bRecover ) {
+ bRecover = FALSE;
+ }
+ else {
+ pActStream->ReadLine( sLine );
+ sLine.EraseLeadingChars( 0x09 );
+ sLine.EraseLeadingChars( ' ' );
+
+ if ( bReplaceVariables ) {
+ while( sLine.SearchAndReplace( "%UPD", sUPD ) != (USHORT)-1 );
+ while( sLine.SearchAndReplace( "%VERSION", sVersion ) != (USHORT)-1 );
+ }
+
+ sOldLine = sLine;
+ nActLine++;
+ }
+
+ return sOldLine;
+}
+
+/*****************************************************************************/
+GenericInformation *InformationParser::ReadKey(
+ GenericInformationList *pExistingList )
+/*****************************************************************************/
+{
+ // this method has no error handling yet, but it works very fast.
+ // it is used to create whole informations and sub informations in
+ // a simple data format in memory, readed in a configuration file with
+ // following format:
+
+ /*
+
+ key [value]
+ {
+ key [value]
+ key [value]
+ {
+ key [value]
+ ...
+ ...
+ }
+ }
+ key [value]
+ ...
+ ...
+
+ */
+
+ GenericInformation *pInfo = NULL;
+
+ ByteString sLine( ReadLine());
+ ByteString sKey( "" );
+ ByteString sValue( "" );
+
+ // key separated from value by tab?
+ USHORT nWSPos = sLine.Search( ' ' );
+ if ( sLine.Search( '\t' ) < nWSPos ) {
+ nWSPos = sLine.Search( '\t' );
+ sLine.SearchAndReplace( "\t", " " );
+ }
+
+ if ( sLine.GetTokenCount( ' ' ) > 1 ) {
+ sKey = sLine.GetToken( 0, ' ' );
+ sValue = sLine.Copy( sKey.Len() + 1 );
+ while (( sValue.Search( ' ' ) == 0 ) || ( sValue.Search( '\t' ) == 0 )) {
+ sValue.Erase( 0, 1 );
+ }
+ }
+ else
+ sKey=sLine;
+
+ if ( bReplaceVariables && !nLevel ) {
+ sUPD = sKey.Copy( sKey.Len() - 3 );
+ sVersion = sKey;
+ }
+
+ if ( ReadLine() == "{" ) {
+ nLevel++;
+ GenericInformationList *pSubList = new GenericInformationList();
+ while ( ReadLine() != "}" ) {
+ Recover();
+ ReadKey( pSubList );
+ }
+ nLevel--;
+ pInfo = new GenericInformation( sKey, sValue,
+ pExistingList, pSubList );
+ }
+ else {
+ Recover();
+ pInfo = new GenericInformation( sKey, sValue, pExistingList );
+ }
+
+ return pInfo;
+}
+
+/*****************************************************************************/
+void InformationParser::Recover()
+/*****************************************************************************/
+{
+ bRecover = TRUE;
+}
+
+/*****************************************************************************/
+BOOL InformationParser::Save( SvStream &rOutStream,
+ const GenericInformationList *pSaveList,
+ USHORT nLevel )
+/*****************************************************************************/
+{
+ USHORT i;
+ ULONG nInfoListCount;
+ ByteString sTmpStr;
+ GenericInformation *pGenericInfo;
+ GenericInformationList *pGenericInfoList;
+
+ for ( nInfoListCount = 0; nInfoListCount < pSaveList->Count(); nInfoListCount++) {
+ // Key-Value Paare schreiben
+ pGenericInfo = pSaveList->GetObject( nInfoListCount );
+ sTmpStr = "";
+ for( i=0; i<nLevel; i++)
+ sTmpStr += cKeyLevelChars;
+ sTmpStr += pGenericInfo->GetBuffer();
+ sTmpStr += ' ';
+ sTmpStr += pGenericInfo->GetValue();
+ if ( !rOutStream.WriteLine( sTmpStr ) )
+ return FALSE;
+
+ // wenn vorhanden, bearbeite recursive die Sublisten
+ if (( pGenericInfoList = pGenericInfo->GetSubList() ) != 0) {
+ // oeffnende Klammer
+ sTmpStr = "";
+ for( i=0; i<nLevel; i++)
+ sTmpStr += cKeyLevelChars;
+ sTmpStr += '{';
+ if ( !rOutStream.WriteLine( sTmpStr ) )
+ return FALSE;
+ // recursiv die sublist abarbeiten
+ if ( !Save( rOutStream, pGenericInfoList, nLevel+1 ) )
+ return FALSE;
+ // schliessende Klammer
+ sTmpStr = "";
+ for( i=0; i<nLevel; i++)
+ sTmpStr += cKeyLevelChars;
+ sTmpStr += '}';
+ if ( !rOutStream.WriteLine( sTmpStr ) )
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/*****************************************************************************/
+GenericInformationList *InformationParser::Execute(
+ SvStream &rSourceStream,
+ GenericInformationList *pExistingList )
+/*****************************************************************************/
+{
+ GenericInformationList *pList;
+ if ( pExistingList )
+ pList = pExistingList;
+ else
+ pList = new GenericInformationList();
+
+ pActStream = &rSourceStream;
+
+ // read all infos out of current file
+ while( !rSourceStream.IsEof()) {
+ nLevel = 0;
+ ReadKey( pList );
+ }
+
+ return pList;
+}
+
+/*****************************************************************************/
+GenericInformationList *InformationParser::Execute( SvMemoryStream &rSourceStream,
+ GenericInformationList *pExistingList )
+/*****************************************************************************/
+{
+ sStreamName = UniString( "Memory", gsl_getSystemTextEncoding());
+ return Execute( (SvStream &)rSourceStream, pExistingList );
+}
+
+/*****************************************************************************/
+GenericInformationList *InformationParser::Execute(
+ SvFileStream &rSourceStream,
+ GenericInformationList *pExistingList )
+/*****************************************************************************/
+{
+ if ( !rSourceStream.IsOpen())
+ return NULL;
+ sStreamName = rSourceStream.GetFileName();
+ return Execute( (SvStream &)rSourceStream, pExistingList );
+}
+
+/*****************************************************************************/
+GenericInformationList *InformationParser::Execute( UniString &rSourceFile,
+ GenericInformationList *pExistingList )
+/*****************************************************************************/
+{
+ DirEntry aDirEntry( rSourceFile );
+ if ( !aDirEntry.Exists())
+ return NULL;
+
+ GenericInformationList *pList;
+ if ( pExistingList )
+ pList = pExistingList;
+ else
+ pList = new GenericInformationList();
+
+ // reset status
+ nErrorCode = 0;
+ nErrorLine = 0;
+ nActLine = 0;
+
+ SvFileStream aActStream;
+ aActStream.Open( rSourceFile, STREAM_READ );
+ if( aActStream.GetError())
+ return NULL;
+
+ pActStream = &aActStream;
+ if ( !Execute( aActStream, pList )) {
+ delete pList;
+ pList = NULL;
+ }
+
+ // close the stream
+ aActStream.Close();
+ pActStream = NULL;
+
+ if ( !nErrorCode )
+ return pList;
+
+ return NULL;
+}
+
+/*****************************************************************************/
+GenericInformationList *InformationParser::Execute( Dir &rDir,
+ GenericInformationList *pExistingList )
+/*****************************************************************************/
+{
+ GenericInformationList *pList;
+
+ if ( pExistingList )
+ pList = pExistingList;
+ else
+ pList = new GenericInformationList();
+
+ for ( USHORT i = 0; i < rDir.Count(); i++ ) {
+
+ // execute this dir
+ UniString sNextFile( rDir[i].GetFull());
+ GenericInformationList *pSubList = Execute( sNextFile );
+
+ if ( !pSubList ) {
+ // any errors ?
+ delete pList;
+ return NULL;
+ }
+
+ // create new info and insert it into list
+ ByteString sFileKey( rDir[i].GetName(), RTL_TEXTENCODING_UTF8 );
+ GenericInformation *pInfo = new GenericInformation(
+ sFileKey,
+ ByteString( "" ),
+ pList, pSubList );
+ }
+
+ return pList;
+}
+
+/*****************************************************************************/
+BOOL InformationParser::Save( SvFileStream &rSourceStream,
+ const GenericInformationList *pSaveList )
+/*****************************************************************************/
+{
+ if ( !rSourceStream.IsOpen() || !Save( (SvStream &)rSourceStream, pSaveList, 0 ))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*****************************************************************************/
+BOOL InformationParser::Save( SvMemoryStream &rSourceStream,
+ const GenericInformationList *pSaveList )
+/*****************************************************************************/
+{
+ return Save( (SvStream &)rSourceStream, pSaveList, 0 );
+}
+
+/*****************************************************************************/
+BOOL InformationParser::Save( const UniString &rSourceFile,
+ const GenericInformationList *pSaveList )
+/*****************************************************************************/
+{
+ SvFileStream *pOutFile = new SvFileStream( rSourceFile, STREAM_STD_WRITE | STREAM_TRUNC );
+
+ if ( !Save( *pOutFile, pSaveList )) {
+ delete pOutFile;
+ return FALSE;
+ }
+ delete pOutFile;
+ return TRUE;
+}
+
+/*****************************************************************************/
+USHORT InformationParser::GetErrorCode()
+/*****************************************************************************/
+{
+ return nErrorCode;
+}
+
+/*****************************************************************************/
+ByteString &InformationParser::GetErrorText()
+/*****************************************************************************/
+{
+ // sErrorText = pActStream->GetFileName();
+ sErrorText = ByteString( sStreamName, gsl_getSystemTextEncoding());
+ sErrorText += ByteString( " (" );
+ sErrorText += ByteString( nErrorLine );
+ sErrorText += ByteString( "): " );
+
+ switch ( nErrorCode ) {
+ case IP_NO_ERROR:
+ sErrorText += ByteString( "Keine Fehler aufgetereten" );
+ break;
+ case IP_UNEXPECTED_EOF:
+ sErrorText += ByteString( "Ungültiges Dateiende!" );
+ break;
+ }
+
+ return sErrorText;
+}
+
+
diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx
new file mode 100644
index 000000000000..e3cf4a8895fe
--- /dev/null
+++ b/tools/source/datetime/datetime.cxx
@@ -0,0 +1,349 @@
+/*************************************************************************
+ *
+ * $RCSfile: datetime.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <datetime.hxx>
+
+/*************************************************************************
+|*
+|* DateTime::IsBetween()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 18.05.92
+|* Letzte Aenderung TH 18.05.92
+|*
+*************************************************************************/
+
+BOOL DateTime::IsBetween( const DateTime& rFrom,
+ const DateTime& rTo ) const
+{
+ if ( (*this >= rFrom) && (*this <= rTo) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator >()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 18.05.92
+|* Letzte Aenderung TH 18.05.92
+|*
+*************************************************************************/
+
+BOOL DateTime::operator >( const DateTime& rDateTime ) const
+{
+ if ( (Date::operator>( rDateTime )) ||
+ (Date::operator==( rDateTime ) && Time::operator>( rDateTime )) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator <()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 18.05.92
+|* Letzte Aenderung TH 18.05.92
+|*
+*************************************************************************/
+
+BOOL DateTime::operator <( const DateTime& rDateTime ) const
+{
+ if ( (Date::operator<( rDateTime )) ||
+ (Date::operator==( rDateTime ) && Time::operator<( rDateTime )) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator >=()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 18.05.92
+|* Letzte Aenderung TH 18.05.92
+|*
+*************************************************************************/
+
+BOOL DateTime::operator >=( const DateTime& rDateTime ) const
+{
+ if ( (Date::operator>( rDateTime )) ||
+ (Date::operator==( rDateTime ) && Time::operator>=( rDateTime )) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator <=()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 18.05.92
+|* Letzte Aenderung TH 18.05.92
+|*
+*************************************************************************/
+
+BOOL DateTime::operator <=( const DateTime& rDateTime ) const
+{
+ if ( (Date::operator<( rDateTime )) ||
+ (Date::operator==( rDateTime ) && Time::operator<=( rDateTime )) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DateTime::GetSecFromDateTime()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+ULONG DateTime::GetSecFromDateTime( const Date& rDate ) const
+{
+ if ( Date::operator<( rDate ) )
+ return 0;
+ else
+ {
+ ULONG nSec = *this-rDate;
+ nSec *= 24UL*60*60;
+ long nHour = GetHour();
+ long nMin = GetMin();
+ nSec += (nHour*3600)+(nMin*60)+GetSec();
+ return nSec;
+ }
+}
+
+/*************************************************************************
+|*
+|* DateTime::GetSecFromDateTime()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+void DateTime::MakeDateTimeFromSec( const Date& rDate, ULONG nSec )
+{
+ long nDays = nSec / (24UL*60*60);
+ ((Date*)this)->operator=( rDate );
+ nSec -= nDays * (24UL*60*60);
+ USHORT nMin = nSec / 60;
+ nSec -= nMin * 60;
+ ((Time*)this)->operator=( Time( 0, nMin, (USHORT)nSec ) );
+ operator+=( nDays );
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator +=()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+DateTime& DateTime::operator +=( const Time& rTime )
+{
+ Time aTime = *this;
+ aTime += rTime;
+ USHORT nHours = aTime.GetHour();
+ if ( aTime.GetTime() > 0 )
+ {
+ while ( nHours >= 24 )
+ {
+ Date::operator++();
+ nHours -= 24;
+ }
+ aTime.SetHour( nHours );
+ }
+ else if ( aTime.GetTime() != 0 )
+ {
+ while ( nHours >= 24 )
+ {
+ Date::operator--();
+ nHours -= 24;
+ }
+ Date::operator--();
+ aTime = Time( 24, 0, 0 )+aTime;
+ }
+ Time::operator=( aTime );
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator -=()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+DateTime& DateTime::operator -=( const Time& rTime )
+{
+ Time aTime = *this;
+ aTime -= rTime;
+ USHORT nHours = aTime.GetHour();
+ if ( aTime.GetTime() > 0 )
+ {
+ while ( nHours >= 24 )
+ {
+ Date::operator++();
+ nHours -= 24;
+ }
+ aTime.SetHour( nHours );
+ }
+ else if ( aTime.GetTime() != 0 )
+ {
+ while ( nHours >= 24 )
+ {
+ Date::operator--();
+ nHours -= 24;
+ }
+ Date::operator--();
+ aTime = Time( 24, 0, 0 )+aTime;
+ }
+ Time::operator=( aTime );
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator+()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+DateTime operator +( const DateTime& rDateTime, long nDays )
+{
+ DateTime aDateTime( rDateTime );
+ aDateTime += nDays;
+ return aDateTime;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator-()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+DateTime operator -( const DateTime& rDateTime, long nDays )
+{
+ DateTime aDateTime( rDateTime );
+ aDateTime -= nDays;
+ return aDateTime;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator+()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+DateTime operator +( const DateTime& rDateTime, const Time& rTime )
+{
+ DateTime aDateTime( rDateTime );
+ aDateTime += rTime;
+ return aDateTime;
+}
+
+/*************************************************************************
+|*
+|* DateTime::operator-()
+|*
+|* Beschreibung DATETIME.SDW
+|* Ersterstellung TH 02.10.96
+|* Letzte Aenderung TH 02.10.96
+|*
+*************************************************************************/
+
+DateTime operator -( const DateTime& rDateTime, const Time& rTime )
+{
+ DateTime aDateTime( rDateTime );
+ aDateTime -= rTime;
+ return aDateTime;
+}
diff --git a/tools/source/datetime/makefile.mk b/tools/source/datetime/makefile.mk
new file mode 100644
index 000000000000..5a53e0a0039f
--- /dev/null
+++ b/tools/source/datetime/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=datetime
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/tdate.obj \
+ $(SLO)$/ttime.obj \
+ $(SLO)$/datetime.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/tdate.obj \
+ $(OBJ)$/ttime.obj \
+ $(OBJ)$/datetime.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx
new file mode 100644
index 000000000000..72c188944096
--- /dev/null
+++ b/tools/source/datetime/tdate.cxx
@@ -0,0 +1,540 @@
+/*************************************************************************
+ *
+ * $RCSfile: tdate.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if defined( OS2 )
+#include <svpm.h>
+#elif defined( WNT )
+#include <svwin.h>
+#elif defined( WIN ) || defined( DOS )
+#include <dos.h>
+#elif defined( MAC )
+#include "mac_start.h"
+#ifndef __OSUTILS__
+#include "OSUtils.h"
+#endif
+#include "mac_end.h"
+#else
+#include <time.h>
+#endif
+
+#include <debug.hxx>
+#include <date.hxx>
+#ifdef MACOSX
+extern "C" {
+struct tm *localtime_r(const time_t *timep, struct tm *buffer);
+}
+#endif
+
+// =======================================================================
+
+static USHORT aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31 };
+
+#define MAX_DAYS 3636532
+
+// =======================================================================
+
+inline BOOL ImpIsLeapYear( USHORT nYear )
+{
+ return (((nYear % 4) == 0) && ((nYear % 100) != 0) || ((nYear % 400) == 0));
+}
+
+// -----------------------------------------------------------------------
+
+inline USHORT DaysInMonth( USHORT nMonth, USHORT nYear )
+{
+ if ( nMonth != 2 )
+ return aDaysInMonth[nMonth-1];
+ else
+ {
+ if ( ((nYear % 4) == 0) && ((nYear % 100) != 0) ||
+ ((nYear % 400) == 0) )
+ return aDaysInMonth[nMonth-1] + 1;
+ else
+ return aDaysInMonth[nMonth-1];
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static long DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear )
+{
+ long nDays;
+
+ nDays = ((ULONG)nYear-1) * 365;
+ nDays += ((nYear-1) / 4) - ((nYear-1) / 100) + ((nYear-1) / 400);
+ for( USHORT i = 1; i < nMonth; i++ )
+ nDays += DaysInMonth(i,nYear);
+ nDays += nDay;
+ return nDays;
+}
+
+// -----------------------------------------------------------------------
+
+static void DaysToDate( long nDays,
+ USHORT& rDay, USHORT& rMonth, USHORT& rYear )
+{
+ long nTempDays;
+ long i = 0;
+ BOOL bCalc;
+
+ do
+ {
+ nTempDays = (long)nDays;
+ rYear = (USHORT)((nTempDays / 365) - i);
+ nTempDays -= ((ULONG)rYear-1) * 365;
+ nTempDays -= ((rYear-1) / 4) - ((rYear-1) / 100) + ((rYear-1) / 400);
+ bCalc = FALSE;
+ if ( nTempDays < 1 )
+ {
+ i++;
+ bCalc = TRUE;
+ }
+ else
+ {
+ if ( nTempDays > 365 )
+ {
+ if ( (nTempDays != 366) || !ImpIsLeapYear( rYear ) )
+ {
+ i--;
+ bCalc = TRUE;
+ }
+ }
+ }
+ }
+ while ( bCalc );
+
+ rMonth = 1;
+ while ( (ULONG)nTempDays > DaysInMonth( rMonth, rYear ) )
+ {
+ nTempDays -= DaysInMonth( rMonth, rYear );
+ rMonth++;
+ }
+ rDay = (USHORT)nTempDays;
+}
+
+// =======================================================================
+
+Date::Date()
+{
+#if defined( OS2 )
+ DATETIME aDateTime;
+ DosGetDateTime( &aDateTime );
+
+ // Datum zusammenbauen
+ nDate = ((ULONG)aDateTime.day) +
+ (((ULONG)aDateTime.month)*100) +
+ (((ULONG)aDateTime.year)*10000);
+#elif defined( WNT )
+ SYSTEMTIME aDateTime;
+ GetLocalTime( &aDateTime );
+
+ // Datum zusammenbauen
+ nDate = ((ULONG)aDateTime.wDay) +
+ (((ULONG)aDateTime.wMonth)*100) +
+ (((ULONG)aDateTime.wYear)*10000);
+#elif ( defined( WIN ) || defined( DOS )) && !defined( BLC )
+ _dosdate_t aDate;
+ _dos_getdate( &aDate );
+
+ // Datum zusammenbauen
+ nDate = ((ULONG)aDate.day) +
+ (((ULONG)aDate.month)*100) +
+ (((ULONG)aDate.year)*10000);
+#elif ( defined( WIN ) || defined( DOS )) && defined( BLC )
+ dosdate_t aDate;
+ _dos_getdate( &aDate );
+
+ // Datum zusammenbauen
+ nDate = ((ULONG)aDate.day) +
+ (((ULONG)aDate.month)*100) +
+ (((ULONG)aDate.year)*10000);
+#elif defined( MAC )
+ DateTimeRec dt;
+ ::GetTime(&dt);
+ nDate = ((ULONG)dt.day) +
+ (((ULONG)dt.month)*100) +
+ (((ULONG)dt.year )*10000);
+#else
+ time_t nTmpTime;
+ struct tm aTime;
+
+ // Zeit ermitteln
+ nTmpTime = time( 0 );
+
+ // Datum zusammenbauen
+ if ( localtime_r( &nTmpTime, &aTime ) )
+ {
+ nDate = ((ULONG)aTime.tm_mday) +
+ (((ULONG)(aTime.tm_mon+1))*100) +
+ (((ULONG)(aTime.tm_year+1900))*10000);
+ }
+ else
+ nDate = 1 + 100 + (((ULONG)1900)*10000);
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Date::SetDay( USHORT nNewDay )
+{
+ ULONG nMonth = GetMonth();
+ ULONG nYear = GetYear();
+
+ nDate = ((ULONG)(nNewDay%100)) + (nMonth*100) + (nYear*10000);
+}
+
+// -----------------------------------------------------------------------
+
+void Date::SetMonth( USHORT nNewMonth )
+{
+ ULONG nDay = GetDay();
+ ULONG nYear = GetYear();
+
+ nDate = nDay + (((ULONG)(nNewMonth%100))*100) + (nYear*10000);
+}
+
+// -----------------------------------------------------------------------
+
+void Date::SetYear( USHORT nNewYear )
+{
+ ULONG nDay = GetDay();
+ ULONG nMonth = GetMonth();
+
+ nDate = nDay + (nMonth*100) + (((ULONG)(nNewYear%10000))*10000);
+}
+
+// -----------------------------------------------------------------------
+
+DayOfWeek Date::GetDayOfWeek() const
+{
+ return (DayOfWeek)((ULONG)(DateToDays( GetDay(), GetMonth(), GetYear() )-1) % 7);
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Date::GetDayOfYear() const
+{
+ USHORT nDay = GetDay();
+ for( USHORT i = 1; i < GetMonth(); i++ )
+ nDay += ::DaysInMonth( i, GetYear() );
+ return nDay;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Date::GetWeekOfYear( DayOfWeek eStartDay,
+ WeekCountStart eWeekStart ) const
+{
+ short nWeek;
+ short n1WDay = (short)Date( 1, 1, GetYear() ).GetDayOfWeek();
+ short nDayOfYear = (short)GetDayOfYear();
+
+ // Wochentage beginnen bei 0, deshalb einen abziehen
+ nDayOfYear--;
+ // StartDay beruecksichtigen
+ n1WDay = (n1WDay+(7-(short)eStartDay)) % 7;
+
+ if ( eWeekStart == WEEKCOUNT_FIRSTDAY )
+ {
+ nWeek = ((n1WDay+nDayOfYear)/7) + 1;
+ // 53te-Woche nur dann, wenn wir nicht schon in der ersten
+ // Woche des neuen Jahres liegen
+ if ( nWeek == 54 )
+ nWeek = 1;
+ else if ( nWeek == 53 )
+ {
+ short nDaysInYear = (short)GetDaysInYear();
+ short nDaysNextYear = (short)Date( 1, 1, GetYear()+1 ).GetDayOfWeek();
+ nDaysNextYear = (nDaysNextYear+(7-(short)eStartDay)) % 7;
+ if ( nDayOfYear > (nDaysInYear-nDaysNextYear-1) )
+ nWeek = 1;
+ }
+ }
+ else if ( eWeekStart == WEEKCOUNT_FIRSTFULLWEEK )
+ {
+ nWeek = ((n1WDay+nDayOfYear)/7);
+ // Erste Woche eines Jahres entspricht der letzen Woche des
+ // vorherigen Jahres
+ if ( nWeek == 0 )
+ {
+ Date aLastDatePrevYear( 31, 12, GetYear()-1 );
+ nWeek = aLastDatePrevYear.GetWeekOfYear( eStartDay, eWeekStart );
+ }
+ }
+ else // ( eWeekStart == WEEKCOUNT_FIRST4DAYWEEK )
+ {
+ // x_monday - thursday
+ if ( n1WDay < 4 )
+ nWeek = 1;
+ // friday
+ else if ( n1WDay == 4 )
+ nWeek = 53;
+ // saturday
+ else if ( n1WDay == 5 )
+ {
+ // Jahr nach Schaltjahr
+ if ( Date( 1, 1, GetYear()-1 ).IsLeapYear() )
+ nWeek = 53;
+ else
+ nWeek = 52;
+ }
+ // sunday
+ else
+ nWeek = 52;
+
+ if ( (nWeek == 1) || (nDayOfYear + n1WDay > 6) )
+ {
+ if ( nWeek == 1 )
+ nWeek += (nDayOfYear + n1WDay) / 7;
+ else
+ nWeek = (nDayOfYear + n1WDay) / 7;
+ if ( nWeek == 53 )
+ {
+ // naechster x_Sonntag == erster x_Sonntag im neuen Jahr
+ // == noch gleiche Woche
+ long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() );
+ nTempDays += 6 - (GetDayOfWeek()+(7-(short)eStartDay)) % 7;
+ USHORT nDay;
+ USHORT nMonth;
+ USHORT nYear;
+ DaysToDate( nTempDays, nDay, nMonth, nYear );
+ nWeek = Date( nDay, nMonth, nYear ).GetWeekOfYear( eStartDay, eWeekStart );
+ }
+ }
+ }
+
+ return (USHORT)nWeek;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Date::GetDaysInMonth() const
+{
+ return DaysInMonth( GetMonth(), GetYear() );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Date::IsLeapYear() const
+{
+ USHORT nYear = GetYear();
+ return ImpIsLeapYear( nYear );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Date::IsValid() const
+{
+ USHORT nDay = GetDay();
+ USHORT nMonth = GetMonth();
+ USHORT nYear = GetYear();
+
+ if ( !nMonth || (nMonth > 12) )
+ return FALSE;
+ if ( !nDay || (nDay > DaysInMonth( nMonth, nYear )) )
+ return FALSE;
+ else if ( nYear <= 1582 )
+ {
+ if ( nYear < 1582 )
+ return FALSE;
+ else if ( nMonth < 10 )
+ return FALSE;
+ else if ( (nMonth == 10) && (nDay < 15) )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Date& Date::operator +=( long nDays )
+{
+ USHORT nDay;
+ USHORT nMonth;
+ USHORT nYear;
+ long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() );
+
+ nTempDays += nDays;
+ if ( nTempDays > MAX_DAYS )
+ nDate = 31 + (12*100) + (((ULONG)9999)*10000);
+ else if ( nTempDays <= 0 )
+ nDate = 1 + 100;
+ else
+ {
+ DaysToDate( nTempDays, nDay, nMonth, nYear );
+ nDate = ((ULONG)nDay) + (((ULONG)nMonth)*100) + (((ULONG)nYear)*10000);
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+Date& Date::operator -=( long nDays )
+{
+ USHORT nDay;
+ USHORT nMonth;
+ USHORT nYear;
+ long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() );
+
+ nTempDays -= nDays;
+ if ( nTempDays > MAX_DAYS )
+ nDate = 31 + (12*100) + (((ULONG)9999)*10000);
+ else if ( nTempDays <= 0 )
+ nDate = 1 + 100;
+ else
+ {
+ DaysToDate( nTempDays, nDay, nMonth, nYear );
+ nDate = ((ULONG)nDay) + (((ULONG)nMonth)*100) + (((ULONG)nYear)*10000);
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+Date& Date::operator ++()
+{
+ USHORT nDay;
+ USHORT nMonth;
+ USHORT nYear;
+ long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() );
+
+ if ( nTempDays < MAX_DAYS )
+ {
+ nTempDays++;
+ DaysToDate( nTempDays, nDay, nMonth, nYear );
+ nDate = ((ULONG)nDay) + (((ULONG)nMonth)*100) + (((ULONG)nYear)*10000);
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+Date& Date::operator --()
+{
+ USHORT nDay;
+ USHORT nMonth;
+ USHORT nYear;
+ long nTempDays = DateToDays( GetDay(), GetMonth(), GetYear() );
+
+ if ( nTempDays > 1 )
+ {
+ nTempDays--;
+ DaysToDate( nTempDays, nDay, nMonth, nYear );
+ nDate = ((ULONG)nDay) + (((ULONG)nMonth)*100) + (((ULONG)nYear)*10000);
+ }
+ return *this;
+}
+
+#ifndef MPW33
+
+// -----------------------------------------------------------------------
+
+Date Date::operator ++( int )
+{
+ Date aOldDate = *this;
+ Date::operator++();
+ return aOldDate;
+}
+
+// -----------------------------------------------------------------------
+
+Date Date::operator --( int )
+{
+ Date aOldDate = *this;
+ Date::operator--();
+ return aOldDate;
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+Date operator +( const Date& rDate, long nDays )
+{
+ Date aDate( rDate );
+ aDate += nDays;
+ return aDate;
+}
+
+// -----------------------------------------------------------------------
+
+Date operator -( const Date& rDate, long nDays )
+{
+ Date aDate( rDate );
+ aDate -= nDays;
+ return aDate;
+}
+
+// -----------------------------------------------------------------------
+
+long operator -( const Date& rDate1, const Date& rDate2 )
+{
+ ULONG nTempDays1 = DateToDays( rDate1.GetDay(), rDate1.GetMonth(),
+ rDate1.GetYear() );
+ ULONG nTempDays2 = DateToDays( rDate2.GetDay(), rDate2.GetMonth(),
+ rDate2.GetYear() );
+ return nTempDays1 - nTempDays2;
+}
diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx
new file mode 100644
index 000000000000..af1f2ef267e1
--- /dev/null
+++ b/tools/source/datetime/ttime.cxx
@@ -0,0 +1,531 @@
+/*************************************************************************
+ *
+ * $RCSfile: ttime.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TOOLS_TIME_CXX
+
+#if defined( OS2 )
+#define INCL_DOSMISC
+#include <svpm.h>
+#elif defined( WNT )
+#include <svwin.h>
+#elif defined( WIN )
+#include <svwin.h>
+#include <dos.h>
+#elif defined( DOS )
+#include <dos.h>
+#elif defined UNX
+#include <limits.h>
+#ifdef IRIX
+#include <unistd.h>
+#endif
+#include <sys/times.h>
+#elif defined( MAC )
+#include "mac_start.h"
+#ifndef __OSUTILS__
+#include "OSUtils.h"
+#include <MAC_Timer.h>
+#include "mac_end.h"
+#endif
+#endif
+
+#include <time.h>
+#include <time.hxx>
+
+#ifdef UNX
+#include <math.h>
+#endif
+
+#ifndef WNT
+#ifndef localtime_r
+extern "C" {
+struct tm *localtime_r(const time_t *timep, struct tm *buffer);
+}
+#endif
+
+#ifndef gmtime_r
+extern "C" {
+struct tm *gmtime_r(const time_t *timep, struct tm *buffer);
+}
+#endif
+#endif
+
+// =======================================================================
+
+static long TimeToSec100( const Time& rTime )
+{
+ short nSign = (rTime.GetTime() >= 0) ? +1 : -1;
+ long nHour = rTime.GetHour();
+ long nMin = rTime.GetMin();
+ long nSec = rTime.GetSec();
+ long n100Sec = rTime.Get100Sec();
+
+// Wegen Interal Compiler Error bei MSC, etwas komplizierter
+// return (n100Sec + (nSec*100) + (nMin*60*100) + (nHour*60*60*100) * nSign);
+
+ long nRet = n100Sec;
+ nRet += nSec*100;
+ nRet += nMin*60*100;
+ nRet += nHour*60*60*100;
+
+ return (nRet * nSign);
+}
+
+// -----------------------------------------------------------------------
+
+static Time Sec100ToTime( long nSec100 )
+{
+ short nSign;
+ if ( nSec100 < 0 )
+ {
+ nSec100 *= -1;
+ nSign = -1;
+ }
+ else
+ nSign = 1;
+
+ Time aTime( 0, 0, 0, nSec100 );
+ aTime.SetTime( aTime.GetTime() * nSign );
+ return aTime;
+}
+
+// =======================================================================
+
+Time::Time()
+{
+#if defined( OS2 )
+ DATETIME aDateTime;
+ DosGetDateTime( &aDateTime );
+
+ // Zeit zusammenbauen
+ nTime = (((long)aDateTime.hours)*1000000) +
+ (((long)aDateTime.minutes)*10000) +
+ (((long)aDateTime.seconds)*100) +
+ ((long)aDateTime.hundredths);
+#elif defined( WNT )
+ SYSTEMTIME aDateTime;
+ GetLocalTime( &aDateTime );
+
+ // Zeit zusammenbauen
+ nTime = (((long)aDateTime.wHour)*1000000) +
+ (((long)aDateTime.wMinute)*10000) +
+ (((long)aDateTime.wSecond)*100) +
+ ((long)aDateTime.wMilliseconds/10);
+#elif ( defined( WIN ) || defined( DOS ) ) && !defined ( BLC )
+ _dostime_t aTime;
+ _dos_gettime( &aTime );
+
+ // Zeit zusammenbauen
+ nTime = (((long)aTime.hour)*1000000) +
+ (((long)aTime.minute)*10000) +
+ (((long)aTime.second)*100) +
+ ((long)aTime.hsecond);
+#elif ( defined( WIN ) || defined( DOS ) ) && defined ( BLC )
+ dostime_t aTime;
+ _dos_gettime( &aTime );
+
+ // Zeit zusammenbauen
+ nTime = (((long)aTime.hour)*1000000) +
+ (((long)aTime.minute)*10000) +
+ (((long)aTime.second)*100) +
+ ((long)aTime.hsecond);
+#elif defined( MAC )
+ DateTimeRec dt;
+ ::GetTime(&dt);
+ nTime = (((long)dt.hour)*1000000) +
+ (((long)dt.minute)*10000) +
+ (((long)dt.second)*100);
+#else
+ time_t nTmpTime;
+ struct tm aTime;
+
+ // Zeit ermitteln
+ nTmpTime = time( 0 );
+
+ // Zeit zusammenbauen
+ if ( localtime_r( &nTmpTime, &aTime ) )
+ {
+ nTime = (((long)aTime.tm_hour)*1000000) +
+ (((long)aTime.tm_min)*10000) +
+ (((long)aTime.tm_sec)*100);
+ }
+ else
+ nTime = 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+Time::Time( ULONG nHour, ULONG nMin, ULONG nSec, ULONG n100Sec )
+{
+ // Zeit normalisieren
+ nSec += n100Sec / 100;
+ n100Sec = n100Sec % 100;
+ nMin += nSec / 60;
+ nSec = nSec % 60;
+ nHour += nMin / 60;
+ nMin = nMin % 60;
+
+ // Zeit zusammenbauen
+ nTime = (long)(n100Sec + (nSec*100) + (nMin*10000) + (nHour*1000000));
+}
+
+// -----------------------------------------------------------------------
+
+void Time::SetHour( USHORT nNewHour )
+{
+ short nSign = (nTime >= 0) ? +1 : -1;
+ long nMin = GetMin();
+ long nSec = GetSec();
+ long n100Sec = Get100Sec();
+
+ nTime = (n100Sec + (nSec*100) + (nMin*10000) +
+ (((long)nNewHour)*1000000)) * nSign;
+}
+
+// -----------------------------------------------------------------------
+
+void Time::SetMin( USHORT nNewMin )
+{
+ short nSign = (nTime >= 0) ? +1 : -1;
+ long nHour = GetHour();
+ long nSec = GetSec();
+ long n100Sec = Get100Sec();
+
+ // kein Ueberlauf
+ nNewMin = nNewMin % 60;
+
+ nTime = (n100Sec + (nSec*100) + (((long)nNewMin)*10000) +
+ (nHour*1000000)) * nSign;
+}
+
+// -----------------------------------------------------------------------
+
+void Time::SetSec( USHORT nNewSec )
+{
+ short nSign = (nTime >= 0) ? +1 : -1;
+ long nHour = GetHour();
+ long nMin = GetMin();
+ long n100Sec = Get100Sec();
+
+ // kein Ueberlauf
+ nNewSec = nNewSec % 60;
+
+ nTime = (n100Sec + (((long)nNewSec)*100) + (nMin*10000) +
+ (nHour*1000000)) * nSign;
+}
+
+// -----------------------------------------------------------------------
+
+void Time::Set100Sec( USHORT nNew100Sec )
+{
+ short nSign = (nTime >= 0) ? +1 : -1;
+ long nHour = GetHour();
+ long nMin = GetMin();
+ long nSec = GetSec();
+
+ // kein Ueberlauf
+ nNew100Sec = nNew100Sec % 100;
+
+ nTime = (((long)nNew100Sec) + (nSec*100) + (nMin*10000) +
+ (nHour*1000000)) * nSign;
+}
+
+// -----------------------------------------------------------------------
+
+long Time::GetMSFromTime() const
+{
+ short nSign = (nTime >= 0) ? +1 : -1;
+ long nHour = GetHour();
+ long nMin = GetMin();
+ long nSec = GetSec();
+ long n100Sec = Get100Sec();
+
+ return (((nHour*3600000)+(nMin*60000)+(nSec*1000)+(n100Sec*10))*nSign);
+}
+
+// -----------------------------------------------------------------------
+
+void Time::MakeTimeFromMS( long nMS )
+{
+ short nSign;
+ if ( nMS < 0 )
+ {
+ nMS *= -1;
+ nSign = -1;
+ }
+ else
+ nSign = 1;
+
+ Time aTime( 0, 0, 0, nMS/10 );
+ SetTime( aTime.GetTime() * nSign );
+}
+
+// -----------------------------------------------------------------------
+
+Time& Time::operator +=( const Time& rTime )
+{
+ nTime = Sec100ToTime( TimeToSec100( *this ) +
+ TimeToSec100( rTime ) ).GetTime();
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+Time& Time::operator -=( const Time& rTime )
+{
+ nTime = Sec100ToTime( TimeToSec100( *this ) -
+ TimeToSec100( rTime ) ).GetTime();
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+Time operator +( const Time& rTime1, const Time& rTime2 )
+{
+ return Sec100ToTime( TimeToSec100( rTime1 ) +
+ TimeToSec100( rTime2 ) );
+}
+
+// -----------------------------------------------------------------------
+
+Time operator -( const Time& rTime1, const Time& rTime2 )
+{
+ return Sec100ToTime( TimeToSec100( rTime1 ) -
+ TimeToSec100( rTime2 ) );
+}
+
+// -----------------------------------------------------------------------
+
+Time Time::GetUTCOffset()
+{
+#if defined( OS2 )
+#undef timezone
+ DATETIME aDateTime;
+ DosGetDateTime( &aDateTime );
+
+ // Zeit zusammenbauen
+ if ( aDateTime.timezone != -1 )
+ {
+ short nTempTime = (short)Abs( aDateTime.timezone );
+ Time aTime( 0, (USHORT)nTempTime );
+ if ( aDateTime.timezone > 0 )
+ aTime = -aTime;
+ return aTime;
+ }
+ else
+ return Time( 0 );
+#elif defined( WNT )
+ TIME_ZONE_INFORMATION aTimeZone;
+ aTimeZone.Bias = 0;
+ DWORD nTimeZoneRet = GetTimeZoneInformation( &aTimeZone );
+ long nTempTime = aTimeZone.Bias;
+ if ( nTimeZoneRet == TIME_ZONE_ID_STANDARD )
+ nTempTime += aTimeZone.StandardBias;
+ else if ( nTimeZoneRet == TIME_ZONE_ID_DAYLIGHT )
+ nTempTime += aTimeZone.DaylightBias;
+ Time aTime( 0, (USHORT)Abs( nTempTime ) );
+ if ( nTempTime > 0 )
+ aTime = -aTime;
+ return aTime;
+#elif ( defined( WIN ) || defined( DOS ) ) && defined ( BLC )
+ static ULONG nCacheTicks = 0;
+ static long nCacheSecOffset = -1;
+ ULONG nTicks = Time::GetSystemTicks();
+ time_t nTime;
+ tm aTM;
+ long nLocalTime;
+ long nUTC;
+ short nTempTime;
+
+ // Evt. Wert neu ermitteln
+ if ( (nCacheSecOffset == -1) || ((nTicks - nCacheTicks) > 360000) )
+ {
+ nTime = time( 0 );
+ tm aTMTmp;
+ aTM = *localtime_r( &nTime, &aTMTmp);
+ nLocalTime = mktime( &aTM );
+ aTM = *gmtime_r( &nTime, &aTMTmp);
+ nUTC = mktime( &aTM );
+ nCacheTicks = nTicks;
+ nCacheSecOffset = (nLocalTime-nUTC) / 60;
+ }
+
+ nTempTime = (short)Abs( nCacheSecOffset );
+ Time aTime( 0, (USHORT)nTempTime );
+ if ( nCacheSecOffset < 0 )
+ aTime = -aTime;
+ return aTime;
+#else
+ static ULONG nCacheTicks = 0;
+ static long nCacheSecOffset = -1;
+ ULONG nTicks = Time::GetSystemTicks();
+ time_t nTime;
+ tm aTM;
+ long nLocalTime;
+ long nUTC;
+ short nTempTime;
+
+ // Evt. Wert neu ermitteln
+ if ( (nCacheSecOffset == -1) ||
+ ((nTicks - nCacheTicks) > 360000) ||
+ ( nTicks < nCacheTicks ) // handle overflow
+ )
+ {
+ nTime = time( 0 );
+ localtime_r( &nTime, &aTM );
+ nLocalTime = mktime( &aTM );
+#if defined( SOLARIS )
+ // Solaris gmtime_r() seems not to handle daylight saving time
+ // flags correctly
+ nUTC = nLocalTime + ( aTM.tm_isdst == 0 ? timezone : altzone );
+#elif defined( LINUX )
+ // Linux mktime() seems not to handle tm_isdst correctly
+ nUTC = nLocalTime - aTM.tm_gmtoff;
+#else
+ gmtime_r( &nTime, &aTM );
+ nUTC = mktime( &aTM );
+#endif
+ nCacheTicks = nTicks;
+ nCacheSecOffset = (nLocalTime-nUTC) / 60;
+ }
+
+ nTempTime = (short)Abs( nCacheSecOffset );
+ Time aTime( 0, (USHORT)nTempTime );
+ if ( nCacheSecOffset < 0 )
+ aTime = -aTime;
+ return aTime;
+#endif
+}
+
+
+// -----------------------------------------------------------------------
+
+ULONG Time::GetSystemTicks()
+{
+#if defined( WIN ) || defined( WNT )
+ return (ULONG)GetTickCount();
+#elif defined( OS2 )
+ PM_ULONG nClock;
+ DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) );
+ return (ULONG)nClock;
+#elif defined( MAC )
+ long long millisec;
+ Microseconds((UnsignedWide *)&millisec);
+ millisec = ( millisec + 500L ) / 1000L;
+ return (ULONG)millisec;
+#else
+ static ULONG nImplTicksPerSecond = 0;
+ static double dImplTicksPerSecond;
+ static double dImplTicksULONGMAX;
+ struct tms aTms;
+ ULONG nTicks = (ULONG)times( &aTms );
+
+ if ( !nImplTicksPerSecond )
+ {
+ nImplTicksPerSecond = CLK_TCK;
+ dImplTicksPerSecond = nImplTicksPerSecond;
+ dImplTicksULONGMAX = (double)(ULONG)ULONG_MAX;
+ }
+
+ double fTicks = nTicks;
+ fTicks *= 1000;
+ fTicks /= dImplTicksPerSecond;
+ fTicks = fmod (fTicks, dImplTicksULONGMAX);
+
+ return (ULONG)fTicks;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Time::GetProcessTicks()
+{
+#if defined( WIN ) || defined( WNT )
+ return (ULONG)GetTickCount();
+#elif defined( OS2 )
+ PM_ULONG nClock;
+ DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) );
+ return (ULONG)nClock;
+#elif defined( MAC )
+ long long millisec;
+ Microseconds((UnsignedWide *)&millisec);
+ millisec = ( millisec + 500L ) / 1000L;
+ return (ULONG)millisec;
+#else
+ static ULONG nImplTicksPerSecond = 0;
+ static double dImplTicksPerSecond;
+ static double dImplTicksULONGMAX;
+ ULONG nTicks = (ULONG)clock();
+
+ if ( !nImplTicksPerSecond )
+ {
+ nImplTicksPerSecond = CLOCKS_PER_SEC;
+ dImplTicksPerSecond = nImplTicksPerSecond;
+ dImplTicksULONGMAX = (double)(ULONG)ULONG_MAX;
+ }
+
+ double fTicks = nTicks;
+ fTicks *= 1000;
+ fTicks /= dImplTicksPerSecond;
+ fTicks = fmod (fTicks, dImplTicksULONGMAX);
+ return (ULONG)fTicks;
+#endif
+}
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
new file mode 100644
index 000000000000..cfa1ce5dfa1b
--- /dev/null
+++ b/tools/source/debug/debug.cxx
@@ -0,0 +1,1581 @@
+/*************************************************************************
+ *
+ * $RCSfile: debug.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TOOLS_DEBUG_CXX
+
+#ifndef MAC
+#if defined (UNX) || defined (GCC)
+#include <unistd.h>
+#else
+#include <direct.h>
+#endif
+#endif
+
+#include <time.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#ifdef OS2
+#define INCL_DOSSEMAPHORES
+#define INCL_DOSMISC
+#define INCL_WINDIALOGS
+#include <svpm.h>
+#endif
+
+#if defined ( WNT )
+#include <svwin.h>
+#endif
+
+#include <debug.hxx>
+
+// =======================================================================
+
+#ifdef DBG_UTIL
+
+// --- DbgErrors ---
+
+static sal_Char const DbgError_ProfEnd1[] = "DBG_PROF...() without DBG_PROFSTART(): ";
+static sal_Char const DbgError_Xtor1[] = "DBG_DTOR() or DBG_CHKTHIS() without DBG_CTOR(): ";
+
+static sal_Char const DbgError_CtorDtor1[] = "this == NULL in class ";
+static sal_Char const DbgError_CtorDtor2[] = "invalid this-Pointer %p in class ";
+static sal_Char const DbgError_CtorDtor3[] = "Error-Msg from Object %p in class ";
+
+static sal_Char const DbgTrace_EnterCtor[] = "Enter Ctor from class ";
+static sal_Char const DbgTrace_LeaveCtor[] = "Leave Ctor from class ";
+static sal_Char const DbgTrace_EnterDtor[] = "Enter Dtor from class ";
+static sal_Char const DbgTrace_LeaveDtor[] = "Leave Dtor from class ";
+static sal_Char const DbgTrace_EnterMeth[] = "Enter method from class ";
+static sal_Char const DbgTrace_LeaveMeth[] = "Leave method from class ";
+
+// --- PointerList ---
+
+#define PBLOCKCOUNT 1024
+
+struct PBlock
+{
+ void* aData[PBLOCKCOUNT];
+ USHORT nCount;
+ PBlock* pPrev;
+ PBlock* pNext;
+};
+
+class PointerList
+{
+private:
+ PBlock* pFirst;
+ PBlock* pLast;
+ ULONG nCount;
+
+public:
+ PointerList() { pFirst = NULL; pLast = NULL; nCount = 0; }
+ ~PointerList();
+
+ void Add( const void* p );
+ BOOL Remove( const void* p );
+
+ const void* Get( ULONG nPos ) const;
+ BOOL IsIn( const void* p ) const;
+ ULONG Count() const { return nCount; }
+};
+
+// --- Datentypen ---
+
+#define DBG_MAXNAME 28
+
+struct ProfType
+{
+ ULONG nCount;
+ ULONG nTime;
+ ULONG nMinTime;
+ ULONG nMaxTime;
+ ULONG nStart;
+ ULONG nContinueTime;
+ ULONG nContinueStart;
+ sal_Char aName[DBG_MAXNAME+1];
+};
+
+struct XtorType
+{
+ ULONG nCtorCalls;
+ ULONG nDtorCalls;
+ ULONG nMaxCount;
+ ULONG nStatics;
+ sal_Char aName[DBG_MAXNAME+1];
+ BOOL bTest;
+ PointerList aThisList;
+};
+
+struct DebugData
+{
+ DbgData aDbgData;
+ USHORT bInit;
+ DbgPrintLine pDbgPrintMsgBox;
+ DbgPrintLine pDbgPrintWindow;
+ DbgPrintLine pDbgPrintShell;
+ DbgPrintLine pDbgPrintTestTool;
+ PointerList* pProfList;
+ PointerList* pXtorList;
+ DbgTestSolarMutexProc pDbgTestSolarMutex;
+};
+
+#define DBG_TEST_XTOR_EXTRA (DBG_TEST_XTOR_THIS | DBG_TEST_XTOR_FUNC | \
+ DBG_TEST_XTOR_EXIT | DBG_TEST_XTOR_REPORT )
+
+// ------------------------------
+// - statische Verwaltungsdaten -
+// ------------------------------
+
+static DebugData aDebugData =
+{
+ {
+ DBG_TEST_RESOURCE | DBG_TEST_MEM_INIT,
+ TRUE,
+ DBG_OUT_NULL,
+ DBG_OUT_NULL,
+ DBG_OUT_MSGBOX,
+ 0x77,
+ 0x55,
+ 0x33,
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ },
+ FALSE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
+#ifndef MAC
+static sal_Char aCurPath[260];
+#endif
+
+static int bDbgImplInMain = FALSE;
+static sal_Char aBuf[DBG_BUF_MAXLEN];
+static sal_Char aBufOut[DBG_BUF_MAXLEN];
+
+// =======================================================================
+
+#if defined( WNT )
+static CRITICAL_SECTION aImplCritDbgSection;
+#elif defined( OS2 )
+static HMTX hImplCritDbgSection = 0;
+#endif
+static BOOL bImplCritDbgSectionInit = FALSE;
+
+// -----------------------------------------------------------------------
+
+void ImplDbgInitLock()
+{
+#if defined( WNT )
+ InitializeCriticalSection( &aImplCritDbgSection );
+#elif defined( OS2 )
+ DosCreateMutexSem( NULL, &hImplCritDbgSection, 0, FALSE );
+#endif
+ bImplCritDbgSectionInit = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDbgDeInitLock()
+{
+#if defined( WNT )
+ DeleteCriticalSection( &aImplCritDbgSection );
+#elif defined( OS2 )
+ DosCloseMutexSem( hImplCritDbgSection );
+#endif
+ bImplCritDbgSectionInit = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDbgLock()
+{
+ if ( !bImplCritDbgSectionInit )
+ return;
+
+#if defined( WNT )
+ EnterCriticalSection( &aImplCritDbgSection );
+#elif defined( OS2 )
+ DosRequestMutexSem( hImplCritDbgSection, SEM_INDEFINITE_WAIT );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDbgUnlock()
+{
+ if ( !bImplCritDbgSectionInit )
+ return;
+
+#if defined( WNT )
+ LeaveCriticalSection( &aImplCritDbgSection );
+#elif defined( OS2 )
+ DosReleaseMutexSem( hImplCritDbgSection );
+#endif
+}
+
+// =======================================================================
+
+// Aus DBMEM.CXX
+#if (defined( WNT ) || defined( OS2 ) || defined( MAC )) && !defined ( SVX_LIGHT )
+#define SV_MEMMGR
+#endif
+#ifdef SV_MEMMGR
+void DbgImpCheckMemory( void* p = NULL );
+void DbgImpCheckMemoryDeInit();
+void DbgImpMemoryInfo( sal_Char* pBuf );
+#endif
+
+#if defined( OS2 )
+#define FILE_LINEEND "\r\n"
+#else
+#define FILE_LINEEND "\n"
+#endif
+
+// =======================================================================
+
+static BOOL ImplActivateDebugger( const sal_Char* pMsg )
+{
+#if defined( WNT )
+ static sal_Char aImplDbgOutBuf[DBG_BUF_MAXLEN];
+ strcpy( aImplDbgOutBuf, pMsg );
+ strcat( aImplDbgOutBuf, "\r\n" );
+ OutputDebugString( aImplDbgOutBuf );
+ DebugBreak();
+ return TRUE;
+#elif defined( MAC )
+ debugstr( (sal_Char*)pLine );
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplCoreDump( const sal_Char* pMsg )
+{
+#if defined( WNT )
+ DebugBreak();
+#else
+ long* pTemp = 0;
+ *pTemp = 0xCCCC;
+#endif
+ return TRUE;
+}
+
+// =======================================================================
+
+static ULONG ImplGetPerfTime()
+{
+#if defined( WNT )
+ return (ULONG)GetTickCount();
+#elif defined( OS2 )
+ PM_ULONG nClock;
+ DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &nClock, sizeof( nClock ) );
+ return (ULONG)nClock;
+#elif defined( MAC )
+ long long millisec;
+ Microseconds((UnsignedWide *)&millisec);
+ millisec = ( millisec + 500L ) / 1000L;
+ return (ULONG)millisec;
+#else
+ static ULONG nImplTicksPerSecond = 0;
+ static double dImplTicksPerSecond;
+ ULONG nTicks = (ULONG)clock();
+
+ if ( !nImplTicksPerSecond )
+ {
+ nImplTicksPerSecond = CLOCKS_PER_SEC;
+ dImplTicksPerSecond = nImplTicksPerSecond;
+ }
+
+ double fTicks = nTicks;
+ fTicks *= 1000;
+ fTicks /= dImplTicksPerSecond;
+ return (ULONG)fTicks;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#if defined( OS2 )
+
+typedef HFILE FILETYPE;
+
+static FILETYPE FileOpen( const sal_Char* pFileName, const sal_Char* pOpenMode )
+{
+ HFILE hFile = 0;
+ ULONG lAction = 0;
+ ULONG nOpen1 = FILE_OPEN;
+ ULONG nOpen2 = OPEN_SHARE_DENYWRITE | OPEN_ACCESS_READONLY;
+
+ if ( *pOpenMode == 'w' )
+ {
+ nOpen1 = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ nOpen2 = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE;
+ }
+ else if ( *pOpenMode == 'a' )
+ {
+ nOpen1 = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;
+ nOpen2 = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE;
+ }
+
+ APIRET nRet = DosOpen( pFileName, &hFile, &lAction, 0,
+ FILE_NORMAL, nOpen1, nOpen2, 0L );
+
+ if ( nRet )
+ return NULL;
+ else
+ {
+ if ( *pOpenMode == 'a' )
+ {
+ ULONG nTemp;
+ DosSetFilePtr( hFile, 0, FILE_END, &nTemp );
+ }
+
+ return hFile;
+ }
+}
+
+static ULONG FileRead( void* pData, int n1, int n2, FILETYPE pFile )
+{
+ ULONG nRead;
+ DosRead( pFile, pData, n1*n2, &nRead );
+ return nRead;
+}
+
+static ULONG FileWrite( void* pData, int n1, int n2, FILETYPE pFile )
+{
+ ULONG nWritten;
+ DosWrite( pFile, pData, n1*n2, &nWritten );
+ return nWritten;
+}
+
+static void FilePrintF( FILETYPE pFile, const sal_Char* pFStr, ... )
+{
+ static sal_Char aTempBuf[DBG_BUF_MAXLEN];
+
+ va_list pList;
+
+ va_start( pList, pFStr );
+ vsprintf( aTempBuf, pFStr, pList );
+ va_end( pList );
+
+ FileWrite( aTempBuf, strlen( aTempBuf ), 1, pFile );
+}
+
+static void FileClose( FILETYPE pFile )
+{
+ DosClose( pFile );
+}
+
+#else
+
+typedef FILE* FILETYPE;
+#define FileOpen fopen
+#define FileRead fread
+#define FileWrite fwrite
+#define FilePrintF fprintf
+#define FileClose fclose
+
+#endif
+
+// =======================================================================
+
+PointerList::~PointerList()
+{
+ PBlock* pBlock = pFirst;
+ while ( pBlock )
+ {
+ PBlock* pNextBlock = pBlock->pNext;
+ delete pBlock;
+ pBlock = pNextBlock;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PointerList::Add( const void* p )
+{
+ if ( !pFirst )
+ {
+ pFirst = new PBlock;
+ memset( pFirst->aData, 0, PBLOCKCOUNT * sizeof( void* ) );
+ pFirst->nCount = 0;
+ pFirst->pPrev = NULL;
+ pFirst->pNext = NULL;
+ pLast = pFirst;
+ }
+
+ PBlock* pBlock = pFirst;
+ while ( pBlock && (pBlock->nCount == PBLOCKCOUNT) )
+ pBlock = pBlock->pNext;
+
+ if ( !pBlock )
+ {
+ pBlock = new PBlock;
+ memset( pBlock->aData, 0, PBLOCKCOUNT * sizeof( void* ) );
+ pBlock->nCount = 0;
+ pBlock->pPrev = pLast;
+ pBlock->pNext = NULL;
+ pLast->pNext = pBlock;
+ pLast = pBlock;
+ }
+
+ USHORT i = 0;
+ while ( pBlock->aData[i] )
+ i++;
+
+ pBlock->aData[i] = (void*)p;
+ pBlock->nCount++;
+ nCount++;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL PointerList::Remove( const void* p )
+{
+ if ( !p )
+ return FALSE;
+
+ PBlock* pBlock = pFirst;
+ while ( pBlock )
+ {
+ USHORT i = 0;
+ while ( i < PBLOCKCOUNT )
+ {
+ if ( ((ULONG)p) == ((ULONG)pBlock->aData[i]) )
+ {
+ pBlock->aData[i] = NULL;
+ pBlock->nCount--;
+ nCount--;
+
+ if ( !pBlock->nCount )
+ {
+ if ( pBlock->pPrev )
+ pBlock->pPrev->pNext = pBlock->pNext;
+ if ( pBlock->pNext )
+ pBlock->pNext->pPrev = pBlock->pPrev;
+ if ( pBlock == pFirst )
+ pFirst = pBlock->pNext;
+ if ( pBlock == pLast )
+ pLast = pBlock->pPrev;
+ delete pBlock;
+ }
+
+ return TRUE;
+ }
+ i++;
+ }
+
+ pBlock = pBlock->pNext;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+const void* PointerList::Get( ULONG nPos ) const
+{
+ if ( nCount <= nPos )
+ return NULL;
+
+ PBlock* pBlock = pFirst;
+ ULONG nStart = 0;
+ while ( pBlock )
+ {
+ USHORT i = 0;
+ while ( i < PBLOCKCOUNT )
+ {
+ if ( pBlock->aData[i] )
+ {
+ nStart++;
+ if ( (nStart-1) == nPos )
+ return pBlock->aData[i];
+ }
+
+ i++;
+ }
+
+ pBlock = pBlock->pNext;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL PointerList::IsIn( const void* p ) const
+{
+ if ( !p )
+ return FALSE;
+
+ PBlock* pBlock = pFirst;
+ while ( pBlock )
+ {
+ USHORT i = 0;
+ while ( i < PBLOCKCOUNT )
+ {
+ if ( ((ULONG)p) == ((ULONG)pBlock->aData[i]) )
+ return TRUE;
+ i++;
+ }
+
+ pBlock = pBlock->pNext;
+ }
+
+ return FALSE;
+}
+
+
+// =======================================================================
+
+static void DbgGetDbgFileName( sal_Char* pStr )
+{
+#if defined( UNX )
+ const sal_Char* pName = getenv("DBGSV_INIT");
+ if ( !pName )
+ pName = ".dbgsv.init";
+ strcpy( pStr, pName );
+#elif defined( WNT )
+ const sal_Char* pName = getenv("DBGSV_INIT");
+ if ( pName )
+ strcpy( pStr, pName );
+ else
+ GetProfileStringA( "sv", "dbgsv", "dbgsv.ini", pStr, 200 );
+#elif defined( OS2 )
+ PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSV",
+ "dbgsv.ini", (PSZ)pStr, 200 );
+#else
+ strcpy( pStr, "dbgsv.ini" );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void DbgGetLogFileName( sal_Char* pStr )
+{
+#if defined( UNX )
+ const sal_Char* pName = getenv("DBGSV_LOG");
+ if ( !pName )
+ pName = "dbgsv.log";
+ strcpy( pStr, pName );
+#elif defined( WNT )
+ const sal_Char* pName = getenv("DBGSV_LOG");
+ if ( pName )
+ strcpy( pStr, pName );
+ else
+ GetProfileStringA( "sv", "dbgsvlog", "dbgsv.log", pStr, 200 );
+#elif defined( OS2 )
+ PrfQueryProfileString( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGSVLOG",
+ "dbgsv.log", (PSZ)pStr, 200 );
+#else
+ strcpy( pStr, "dbgsv.log" );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static int DbgImplIsAllErrorOut()
+{
+#if defined( WNT )
+ const sal_Char* pName = getenv("UPDATER");
+ if ( pName && (strcmp( pName, "YES" ) == 0) )
+ return TRUE;
+ if ( GetProfileInt( "sv", "dbgallerrorout", 0 ) )
+ return TRUE;
+ else
+ return FALSE;
+#elif defined( OS2 )
+ const sal_Char* pName = getenv("UPDATER");
+ if ( pName && (strcmp( pName, "YES" ) == 0) )
+ return TRUE;
+ if ( PrfQueryProfileInt( HINI_PROFILE, (PSZ)"SV", (PSZ)"DBGALLERROROUT", 0 ) )
+ return TRUE;
+ else
+ return FALSE;
+#else
+ return TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void DbgDebugBeep()
+{
+#if defined( WNT )
+ MessageBeep( MB_ICONHAND );
+#elif defined( OS2 )
+ WinAlarm( HWND_DESKTOP, WA_ERROR );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static DebugData* GetDebugData()
+{
+ if ( !aDebugData.bInit )
+ {
+ aDebugData.bInit = TRUE;
+
+ // Default Debug-Namen setzen
+ DbgGetLogFileName( aDebugData.aDbgData.aDebugName );
+
+ // DEBUG.INI-File
+ FILETYPE pDbgFile;
+ DbgGetDbgFileName( aBuf );
+ if ( (pDbgFile = FileOpen( aBuf, "r" )) != NULL )
+ {
+ FileRead( &(aDebugData.aDbgData), sizeof( DbgData ), 1, pDbgFile );
+ FileClose( pDbgFile );
+ }
+
+#ifndef MAC
+ getcwd( aCurPath, sizeof( aCurPath ) );
+#endif
+
+ // Daten initialisieren
+ if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_XTOR )
+ aDebugData.pXtorList = new PointerList;
+ if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_PROFILING )
+ aDebugData.pProfList = new PointerList;
+ if ( aDebugData.aDbgData.nErrorOut < DBG_OUT_MSGBOX )
+ {
+ if ( !DbgImplIsAllErrorOut() )
+ aDebugData.aDbgData.nErrorOut = DBG_OUT_MSGBOX;
+ }
+ }
+
+ return &aDebugData;
+}
+
+// -----------------------------------------------------------------------
+
+inline DebugData* ImplGetDebugData()
+{
+ if ( !aDebugData.bInit )
+ return GetDebugData();
+ else
+ return &aDebugData;
+}
+
+// -----------------------------------------------------------------------
+
+static FILETYPE ImplDbgInitFile()
+{
+ static BOOL bFileInit = FALSE;
+
+#ifndef MAC
+ getcwd( aBuf, sizeof( aBuf ) );
+ chdir( aCurPath );
+#endif
+
+ DebugData* pData = GetDebugData();
+ FILETYPE pDebugFile;
+
+ if ( !bFileInit )
+ {
+ bFileInit = TRUE;
+
+ if ( pData->aDbgData.bOverwrite )
+ pDebugFile = FileOpen( pData->aDbgData.aDebugName, "w" );
+ else
+ pDebugFile = FileOpen( pData->aDbgData.aDebugName, "a" );
+
+ if ( pDebugFile )
+ {
+ time_t nTime = time( 0 );
+ tm* pTime;
+#ifdef UNX
+ tm aTime;
+ pTime = localtime_r( &nTime, &aTime );
+#else
+ pTime = localtime( &nTime );
+#endif
+
+ // Header ausgeben
+ FilePrintF( pDebugFile, "******************************************************************************%s", FILE_LINEEND );
+ FilePrintF( pDebugFile, "%s%s", pData->aDbgData.aDebugName, FILE_LINEEND );
+ if ( pTime )
+ FilePrintF( pDebugFile, "%s%s", asctime( pTime ), FILE_LINEEND );
+ }
+ }
+ else
+ pDebugFile = FileOpen( pData->aDbgData.aDebugName, "a" );
+
+#ifndef MAC
+ chdir( aBuf );
+#endif
+
+ return pDebugFile;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDbgPrintFile( const sal_Char* pLine )
+{
+ FILETYPE pDebugFile = ImplDbgInitFile();
+
+ if ( pDebugFile )
+ {
+ FilePrintF( pDebugFile, "%s%s", pLine, FILE_LINEEND );
+ FileClose( pDebugFile );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplStrSearch( const sal_Char* pSearchStr, int nSearchLen,
+ const sal_Char* pStr, int nLen )
+{
+ int nPos = 0;
+ while ( nPos+nSearchLen <= nLen )
+ {
+ if ( strncmp( pStr+nPos, pSearchStr, nSearchLen ) == 0 )
+ return 1;
+ nPos++;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplDbgFilter( const sal_Char* pFilter, const sal_Char* pMsg,
+ int bEmpty )
+{
+ int nStrLen = strlen( pFilter );
+ if ( !nStrLen )
+ return bEmpty;
+
+ int nMsgLen = strlen( pMsg );
+ const sal_Char* pTok = pFilter;
+ int nTok = 0;
+ while ( pTok[nTok] )
+ {
+ if ( pTok[nTok] == ';' )
+ {
+ if ( nTok && ImplStrSearch( pTok, nTok, pMsg, nMsgLen ) )
+ return TRUE;
+
+ pTok += nTok+1;
+ nTok = 0;
+ }
+
+ nTok++;
+ }
+
+ if ( nTok && ImplStrSearch( pTok, nTok, pMsg, nMsgLen ) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static void DebugInit()
+{
+ bDbgImplInMain = TRUE;
+ ImplDbgInitLock();
+}
+
+// -----------------------------------------------------------------------
+
+static void DebugDeInit()
+{
+ DebugData* pData = GetDebugData();
+ ULONG i;
+ ULONG nCount;
+ ULONG nOldOut;
+
+ // Statistik-Ausgaben immer in File
+ nOldOut = pData->aDbgData.nTraceOut;
+ pData->aDbgData.nTraceOut = DBG_OUT_FILE;
+
+ // Xtor-Liste ausgeben
+ if ( pData->pXtorList && pData->pXtorList->Count() &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_REPORT) )
+ {
+ DbgOutf( "------------------------------------------------------------------------------" );
+ DbgOutf( "Object Report" );
+ DbgOutf( "------------------------------------------------------------------------------" );
+ DbgOutf( "%-27s : %-9s : %-9s : %-7s : %-3s : %-6s :",
+ "XTor-List", "Ctor", "Dtor", "MaxInst", "St.", "Diff." );
+ DbgOutf( "----------------------------:-----------:-----------:---------:----:---------:" );
+ for( i = 0, nCount = pData->pXtorList->Count(); i < nCount; i++ )
+ {
+ XtorType* pXtorData = (XtorType*)pData->pXtorList->Get( i );
+ if ( pXtorData->bTest )
+ {
+ // Static-Objekte dazurechnen
+ pXtorData->nDtorCalls += pXtorData->nStatics;
+ if ( pXtorData->nStatics && (pXtorData->nDtorCalls > pXtorData->nCtorCalls) )
+ pXtorData->nDtorCalls = pXtorData->nCtorCalls;
+ DbgOutf( "%-27s : %9lu : %9lu : %7lu : %3lu : %4lu %-1s :",
+ pXtorData->aName, pXtorData->nCtorCalls, pXtorData->nDtorCalls,
+ pXtorData->nMaxCount, pXtorData->nStatics,
+ pXtorData->nCtorCalls - pXtorData->nDtorCalls,
+ (pXtorData->nCtorCalls - pXtorData->nDtorCalls) ? "!" : " " );
+ }
+ }
+ DbgOutf( "==============================================================================" );
+ }
+
+ // Aufraeumen
+ if ( pData->pXtorList )
+ {
+ for( i = 0, nCount = pData->pXtorList->Count(); i < nCount; i++ )
+ {
+ XtorType* pXtorData = (XtorType*)pData->pXtorList->Get( i );
+ delete pXtorData;
+ }
+ delete pData->pXtorList;
+ pData->pXtorList = NULL;
+ }
+
+ // Alles auf FALSE setzen, damit globale Variablen nicht das
+ // System zum Abstuerzen bringt. Dabei muessen aber die
+ // Memory-Flags erhalten bleiben, da sonst new/delete in globalen
+ // Variablen abstuerzen, da die Pointeranpassung dann nicht mehr richtig
+ // funktioniert
+ pData->aDbgData.nTraceOut = nOldOut;
+ pData->aDbgData.nTestFlags &= (DBG_TEST_MEM | DBG_TEST_PROFILING);
+ pData->pDbgPrintTestTool = NULL;
+ pData->pDbgPrintShell = NULL;
+ pData->pDbgPrintWindow = NULL;
+ pData->pDbgPrintShell = NULL;
+ ImplDbgDeInitLock();
+}
+
+// -----------------------------------------------------------------------
+
+static void DebugGlobalDeInit()
+{
+ DebugData* pData = GetDebugData();
+ ULONG i;
+ ULONG nCount;
+ ULONG nOldOut;
+
+ // Statistik-Ausgaben immer in File
+ nOldOut = pData->aDbgData.nTraceOut;
+ pData->aDbgData.nTraceOut = DBG_OUT_FILE;
+
+ // Profileliste ausgeben
+ if ( pData->pProfList && pData->pProfList->Count() )
+ {
+ DbgOutf( "------------------------------------------------------------------------------" );
+ DbgOutf( "Profiling Report" );
+ DbgOutf( "------------------------------------------------------------------------------" );
+ DbgOutf( "%-25s : %-9s : %-6s : %-6s : %-6s : %-9s :",
+ "Prof-List (ms)", "Time", "Min", "Max", "Ave", "Count" );
+ DbgOutf( "--------------------------:-----------:--------:--------:--------:-----------:" );
+ for( i = 0, nCount = pData->pProfList->Count(); i < nCount; i++ )
+ {
+ ProfType* pProfData = (ProfType*)pData->pProfList->Get( i );
+ ULONG nAve = pProfData->nTime / pProfData->nCount;
+ DbgOutf( "%-25s : %9lu : %6lu : %6lu : %6lu : %9lu :",
+ pProfData->aName, pProfData->nTime,
+ pProfData->nMinTime, pProfData->nMaxTime, nAve,
+ pProfData->nCount );
+ }
+ DbgOutf( "==============================================================================" );
+ }
+
+ // Aufraeumen
+ if ( pData->pProfList )
+ {
+ for( i = 0, nCount = pData->pProfList->Count(); i < nCount; i++ )
+ {
+ ProfType* pProfData = (ProfType*)pData->pProfList->Get( i );
+ delete pProfData;
+ }
+ delete pData->pProfList;
+ pData->pProfList = NULL;
+ }
+
+#ifdef SV_MEMMGR
+ DbgImpCheckMemoryDeInit();
+#endif
+
+ // Profiling-Flags ausschalten
+ pData->aDbgData.nTraceOut = nOldOut;
+ pData->aDbgData.nTestFlags &= ~DBG_TEST_PROFILING;
+}
+
+// -----------------------------------------------------------------------
+
+void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... )
+{
+ va_list pList;
+
+ va_start( pList, pFStr );
+ vsprintf( aBuf, pFStr, pList );
+ va_end( pList );
+
+ strcat( pBuf, aBuf );
+ strcat( pBuf, "\n" );
+}
+
+// -----------------------------------------------------------------------
+
+static void DebugXTorInfo( sal_Char* pBuf )
+{
+ DebugData* pData = GetDebugData();
+ ULONG i;
+ ULONG nCount;
+
+ // Xtor-Liste ausgeben
+ if ( pData->pXtorList && pData->pXtorList->Count() &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_REPORT) )
+ {
+ ImpDbgOutfBuf( pBuf, "------------------------------------------------------------------------------" );
+ ImpDbgOutfBuf( pBuf, "Object Report" );
+ ImpDbgOutfBuf( pBuf, "------------------------------------------------------------------------------" );
+ ImpDbgOutfBuf( pBuf, "%-27s : %-9s : %-9s : %-7s : %-3s : %-6s :",
+ "XTor-List", "Ctor", "Dtor", "MaxInst", "St.", "Diff." );
+ ImpDbgOutfBuf( pBuf, "----------------------------:-----------:-----------:---------:----:---------:" );
+ for( i = 0, nCount = pData->pXtorList->Count(); i < nCount; i++ )
+ {
+ XtorType* pXtorData = (XtorType*)pData->pXtorList->Get( i );
+ if ( pXtorData->bTest )
+ {
+ ImpDbgOutfBuf( pBuf, "%-27s : %9lu : %9lu : %7lu : %3lu : %6lu :",
+ pXtorData->aName, pXtorData->nCtorCalls, pXtorData->nDtorCalls,
+ pXtorData->nMaxCount, pXtorData->nStatics,
+ pXtorData->nCtorCalls - pXtorData->nDtorCalls );
+ }
+ }
+ ImpDbgOutfBuf( pBuf, "==============================================================================" );
+ ImpDbgOutfBuf( pBuf, "" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void* DbgFunc( USHORT nAction, void* pParam )
+{
+ DebugData* pData = ImplGetDebugData();
+
+ if ( nAction == DBG_FUNC_GETDATA )
+ return (void*)&(pData->aDbgData);
+ else
+ {
+ switch ( nAction )
+ {
+ case DBG_FUNC_DEBUGSTART:
+ DebugInit();
+ break;
+
+ case DBG_FUNC_DEBUGEND:
+ DebugDeInit();
+ break;
+
+ case DBG_FUNC_GLOBALDEBUGEND:
+ DebugGlobalDeInit();
+ break;
+
+ case DBG_FUNC_SETPRINTMSGBOX:
+ pData->pDbgPrintMsgBox = (DbgPrintLine)pParam;
+ break;
+
+ case DBG_FUNC_SETPRINTWINDOW:
+ pData->pDbgPrintWindow = (DbgPrintLine)pParam;
+ break;
+
+ case DBG_FUNC_SETPRINTSHELL:
+ pData->pDbgPrintShell = (DbgPrintLine)pParam;
+ break;
+
+ case DBG_FUNC_SETPRINTTESTTOOL:
+ pData->pDbgPrintTestTool = (DbgPrintLine)pParam;
+ break;
+
+ case DBG_FUNC_SAVEDATA:
+ {
+ FILETYPE pDbgFile;
+ DbgGetDbgFileName( aBuf );
+ if ( (pDbgFile = FileOpen( aBuf, "w" )) != NULL )
+ {
+ FileWrite( pParam, sizeof( DbgData ), 1, pDbgFile );
+ FileClose( pDbgFile );
+ }
+ }
+ break;
+
+ case DBG_FUNC_MEMTEST:
+#ifdef SV_MEMMGR
+ DbgImpCheckMemory( pParam );
+#endif
+ break;
+
+ case DBG_FUNC_XTORINFO:
+ DebugXTorInfo( (sal_Char*)pParam );
+ break;
+
+ case DBG_FUNC_MEMINFO:
+#ifdef SV_MEMMGR
+ DbgImpMemoryInfo( (sal_Char*)pParam );
+#endif
+ break;
+
+ case DBG_FUNC_COREDUMP:
+ ImplCoreDump( NULL );
+ break;
+
+ case DBG_FUNC_ALLERROROUT:
+ return (void*)(ULONG)DbgImplIsAllErrorOut();
+
+ case DBG_FUNC_SETTESTSOLARMUTEX:
+ pData->pDbgTestSolarMutex = (DbgTestSolarMutexProc)pParam;
+ break;
+
+ case DBG_FUNC_TESTSOLARMUTEX:
+ if ( pData->pDbgTestSolarMutex )
+ pData->pDbgTestSolarMutex();
+ break;
+
+ case DBG_FUNC_PRINTFILE:
+ ImplDbgPrintFile( (const sal_Char*)pParam );
+ break;
+ }
+
+ return NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DbgProf( USHORT nAction, DbgDataType* pDbgData )
+{
+ // Ueberhaupt Profiling-Test an
+ DebugData* pData = ImplGetDebugData();
+ ProfType* pProfData = (ProfType*)pDbgData->pData;
+ ULONG nTime;
+
+ if ( !(pData->aDbgData.nTestFlags & DBG_TEST_PROFILING) )
+ return;
+
+ if ( (nAction != DBG_PROF_START) && !pProfData )
+ {
+ strcpy( aBuf, DbgError_ProfEnd1 );
+ strcat( aBuf, pDbgData->pName );
+ DbgError( aBuf );
+ return;
+ }
+
+ switch ( nAction )
+ {
+ case DBG_PROF_START:
+ if ( !pDbgData->pData )
+ {
+ pDbgData->pData = (void*)new ProfType;
+ pProfData = (ProfType*)pDbgData->pData;
+ strncpy( pProfData->aName, pDbgData->pName, DBG_MAXNAME );
+ pProfData->aName[DBG_MAXNAME] = '\0';
+ pProfData->nCount = 0;
+ pProfData->nTime = 0;
+ pProfData->nMinTime = 0xFFFFFFFF;
+ pProfData->nMaxTime = 0;
+ pProfData->nStart = 0xFFFFFFFF;
+ pProfData->nContinueTime = 0;
+ pProfData->nContinueStart = 0xFFFFFFFF;
+ pData->pProfList->Add( (void*)pProfData );
+ }
+
+ if ( pProfData->nStart == 0xFFFFFFFF )
+ {
+ pProfData->nStart = ImplGetPerfTime();
+ pProfData->nCount++;
+ }
+ break;
+
+ case DBG_PROF_STOP:
+ nTime = ImplGetPerfTime();
+
+ if ( pProfData->nStart == 0xFFFFFFFF )
+ {
+ DbgError( DbgError_ProfEnd1 );
+ return;
+ }
+
+ if ( pProfData->nContinueStart != 0xFFFFFFFF )
+ {
+ pProfData->nContinueTime += ImplGetPerfTime() - pProfData->nContinueStart;
+ pProfData->nContinueStart = 0xFFFFFFFF;
+ }
+
+ nTime -= pProfData->nStart;
+ nTime -= pProfData->nContinueTime;
+
+ if ( nTime < pProfData->nMinTime )
+ pProfData->nMinTime = nTime;
+
+ if ( nTime > pProfData->nMaxTime )
+ pProfData->nMaxTime = nTime;
+
+ pProfData->nTime += nTime;
+
+ pProfData->nStart = 0xFFFFFFFF;
+ pProfData->nContinueTime = 0;
+ pProfData->nContinueStart = 0xFFFFFFFF;
+ break;
+
+ case DBG_PROF_CONTINUE:
+ if ( pProfData->nContinueStart != 0xFFFFFFFF )
+ {
+ pProfData->nContinueTime += ImplGetPerfTime() - pProfData->nContinueStart;
+ pProfData->nContinueStart = 0xFFFFFFFF;
+ }
+ break;
+
+ case DBG_PROF_PAUSE:
+ if ( pProfData->nContinueStart == 0xFFFFFFFF )
+ pProfData->nContinueStart = ImplGetPerfTime();
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DbgXtor( DbgDataType* pDbgData, USHORT nAction, const void* pThis,
+ DbgUsr fDbgUsr )
+{
+ DebugData* pData = ImplGetDebugData();
+
+ // Verbindung zu Debug-Memory-Manager testen
+#ifdef SV_MEMMGR
+ if ( pData->aDbgData.nTestFlags & DBG_TEST_MEM_XTOR )
+ DbgImpCheckMemory();
+#endif
+
+ // Schnell-Test
+ if ( !(pData->aDbgData.nTestFlags & DBG_TEST_XTOR) )
+ return;
+
+ XtorType* pXtorData = (XtorType*)pDbgData->pData;
+ if ( !pXtorData )
+ {
+ pDbgData->pData = (void*)new XtorType;
+ pXtorData = (XtorType*)pDbgData->pData;
+ strncpy( pXtorData->aName, pDbgData->pName, DBG_MAXNAME );
+ pXtorData->aName[DBG_MAXNAME] = '\0';
+ pXtorData->nCtorCalls = 0;
+ pXtorData->nDtorCalls = 0;
+ pXtorData->nMaxCount = 0;
+ pXtorData->nStatics = 0;
+ pXtorData->bTest = TRUE;
+ pData->pXtorList->Add( (void*)pXtorData );
+
+ if ( !ImplDbgFilter( pData->aDbgData.aInclClassFilter, pXtorData->aName, TRUE ) )
+ pXtorData->bTest = FALSE;
+ if ( ImplDbgFilter( pData->aDbgData.aExclClassFilter, pXtorData->aName, FALSE ) )
+ pXtorData->bTest = FALSE;
+ }
+ if ( !pXtorData->bTest )
+ return;
+
+ USHORT nAct = nAction & ~DBG_XTOR_DTOROBJ;
+
+ // Trace (Enter)
+ if ( (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE) &&
+ !(nAction & DBG_XTOR_DTOROBJ) )
+ {
+ if ( nAct != DBG_XTOR_CHKOBJ )
+ {
+ if ( nAct == DBG_XTOR_CTOR )
+ strcpy( aBuf, DbgTrace_EnterCtor );
+ else if ( nAct == DBG_XTOR_DTOR )
+ strcpy( aBuf, DbgTrace_EnterDtor );
+ else
+ strcpy( aBuf, DbgTrace_EnterMeth );
+ strcat( aBuf, pDbgData->pName );
+ DbgTrace( aBuf );
+ }
+ }
+
+ // Sind noch Xtor-Tests als Trace an
+ if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXTRA )
+ {
+ // DBG_CTOR-Aufruf vor allen anderen DBG_XTOR-Aufrufen
+ if ( ((nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR) && !pDbgData->pData )
+ {
+ strcpy( aBuf, DbgError_Xtor1 );
+ strcat( aBuf, pDbgData->pName );
+ DbgError( aBuf );
+ return;
+ }
+
+ // Testen, ob This-Pointer gueltig
+ if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_THIS )
+ {
+ if ( (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXIT) ||
+ !(nAction & DBG_XTOR_DTOROBJ) )
+ {
+ // This-Pointer == NULL
+ if ( !pThis )
+ {
+ strcpy( aBuf, DbgError_CtorDtor1 );
+ strcat( aBuf, pDbgData->pName );
+ DbgError( aBuf );
+ return;
+ }
+
+ if ( (nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR )
+ {
+ if ( !pXtorData->aThisList.IsIn( pThis ) )
+ {
+ sprintf( aBuf, DbgError_CtorDtor2, pThis );
+ strcat( aBuf, pDbgData->pName );
+ DbgError( aBuf );
+ }
+ }
+ }
+ }
+
+ // Function-Test durchfuehren und Verwaltungsdaten updaten
+ const sal_Char* pMsg = NULL;
+ switch ( nAction & ~DBG_XTOR_DTOROBJ )
+ {
+ case DBG_XTOR_CTOR:
+ if ( nAction & DBG_XTOR_DTOROBJ )
+ {
+ if ( fDbgUsr &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXIT) &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
+ pMsg = fDbgUsr( pThis );
+ }
+ else
+ {
+ pXtorData->nCtorCalls++;
+ if ( !bDbgImplInMain )
+ pXtorData->nStatics++;
+ if ( (pXtorData->nCtorCalls-pXtorData->nDtorCalls) > pXtorData->nMaxCount )
+ pXtorData->nMaxCount = pXtorData->nCtorCalls - pXtorData->nDtorCalls;
+
+ if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_THIS )
+ pXtorData->aThisList.Add( pThis );
+ }
+ break;
+
+ case DBG_XTOR_DTOR:
+ if ( nAction & DBG_XTOR_DTOROBJ )
+ {
+ pXtorData->nDtorCalls++;
+ if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_THIS )
+ pXtorData->aThisList.Remove( pThis );
+ }
+ else
+ {
+ if ( fDbgUsr &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
+ pMsg = fDbgUsr( pThis );
+ }
+ break;
+
+ case DBG_XTOR_CHKTHIS:
+ case DBG_XTOR_CHKOBJ:
+ if ( nAction & DBG_XTOR_DTOROBJ )
+ {
+ if ( fDbgUsr &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXIT) &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
+ pMsg = fDbgUsr( pThis );
+ }
+ else
+ {
+ if ( fDbgUsr &&
+ (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
+ pMsg = fDbgUsr( pThis );
+ }
+ break;
+ }
+
+ // Gegebenenfalls Fehlermeldung ausgeben
+ if ( pMsg )
+ {
+ sprintf( aBuf, DbgError_CtorDtor3, pThis );
+ strcat( aBuf, pDbgData->pName );
+ strcat( aBuf, ": \n" );
+ strcat( aBuf, pMsg );
+ DbgError( aBuf );
+ }
+ }
+
+ // Trace (Leave)
+ if ( (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE) &&
+ (nAction & DBG_XTOR_DTOROBJ) )
+ {
+ if ( nAct != DBG_XTOR_CHKOBJ )
+ {
+ if ( nAct == DBG_XTOR_CTOR )
+ strcpy( aBuf, DbgTrace_LeaveCtor );
+ else if ( nAct == DBG_XTOR_DTOR )
+ strcpy( aBuf, DbgTrace_LeaveDtor );
+ else
+ strcpy( aBuf, DbgTrace_LeaveMeth );
+ strcat( aBuf, pDbgData->pName );
+ DbgTrace( aBuf );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DbgOut( const sal_Char* pMsg, USHORT nDbgOut, const sal_Char* pFile, USHORT nLine )
+{
+ static BOOL bIn = FALSE;
+ DebugData* pData = GetDebugData();
+ sal_Char* pStr;
+ ULONG nOut;
+ int nBufLen = 0;
+
+ if ( bIn )
+ return;
+ bIn = TRUE;
+
+ if ( nDbgOut == DBG_OUT_ERROR )
+ {
+ nOut = pData->aDbgData.nErrorOut;
+ pStr = "Error: ";
+ if ( pData->aDbgData.nErrorOut == DBG_OUT_FILE )
+ DbgDebugBeep();
+ }
+ else if ( nDbgOut == DBG_OUT_WARNING )
+ {
+ nOut = pData->aDbgData.nWarningOut;
+ pStr = "Warning: ";
+ }
+ else
+ {
+ nOut = pData->aDbgData.nTraceOut;
+ pStr = NULL;
+ }
+
+ if ( nOut == DBG_OUT_NULL )
+ {
+ bIn = FALSE;
+ return;
+ }
+
+ if ( (nDbgOut != DBG_OUT_ERROR) || DbgImplIsAllErrorOut() )
+ {
+ if ( !ImplDbgFilter( pData->aDbgData.aInclFilter, pMsg, TRUE ) )
+ {
+ bIn = FALSE;
+ return;
+ }
+ if ( ImplDbgFilter( pData->aDbgData.aExclFilter, pMsg, FALSE ) )
+ {
+ bIn = FALSE;
+ return;
+ }
+ }
+
+ ImplDbgLock();
+
+ if ( pStr )
+ {
+ strcpy( aBufOut, pStr );
+ nBufLen = strlen( pStr );
+ }
+ else
+ aBufOut[0] = '\0';
+
+ int nMsgLen = strlen( pMsg );
+ if ( nBufLen+nMsgLen > DBG_BUF_MAXLEN )
+ {
+ int nCopyLen = DBG_BUF_MAXLEN-nBufLen-3;
+ strncpy( &(aBufOut[nBufLen]), pMsg, nCopyLen );
+ strcpy( &(aBufOut[nBufLen+nCopyLen]), "..." );
+ }
+ else
+ strcpy( &(aBufOut[nBufLen]), pMsg );
+
+ if ( pFile && nLine && (nBufLen+nMsgLen < DBG_BUF_MAXLEN) )
+ {
+ if ( nOut == DBG_OUT_MSGBOX )
+ strcat( aBufOut, "\n" );
+ else
+ strcat( aBufOut, " " );
+ strcat( aBufOut, "From File " );
+ strcat( aBufOut, pFile );
+ strcat( aBufOut, " at Line " );
+
+ // Line in String umwandeln und dranhaengen
+ sal_Char aLine[9];
+ sal_Char* pLine = &aLine[7];
+ USHORT i;
+ memset( aLine, 0, sizeof( aLine ) );
+ do
+ {
+ i = nLine % 10;
+ pLine--;
+ *(pLine) = (sal_Char)i + 48;
+ nLine /= 10;
+ }
+ while ( nLine );
+ strcat( aBufOut, pLine );
+ }
+
+ if ( nOut == DBG_OUT_COREDUMP )
+ {
+ if ( !ImplCoreDump( aBufOut ) )
+ nOut = DBG_OUT_DEBUGGER;
+ }
+
+ if ( nOut == DBG_OUT_DEBUGGER )
+ {
+ if ( !ImplActivateDebugger( aBufOut ) )
+ nOut = DBG_OUT_TESTTOOL;
+ }
+
+ if ( nOut == DBG_OUT_TESTTOOL )
+ {
+ if ( pData->pDbgPrintTestTool )
+ pData->pDbgPrintTestTool( aBufOut );
+ else
+ nOut = DBG_OUT_MSGBOX;
+ }
+
+ if ( nOut == DBG_OUT_MSGBOX )
+ {
+ if ( pData->pDbgPrintMsgBox )
+ pData->pDbgPrintMsgBox( aBufOut );
+ else
+ nOut = DBG_OUT_SHELL;
+ }
+
+ if ( nOut == DBG_OUT_SHELL )
+ {
+ if ( pData->pDbgPrintShell )
+ pData->pDbgPrintShell( aBufOut );
+ else
+ nOut = DBG_OUT_WINDOW;
+ }
+
+ if ( nOut == DBG_OUT_WINDOW )
+ {
+ if ( pData->pDbgPrintWindow )
+ pData->pDbgPrintWindow( aBufOut );
+ else
+ nOut = DBG_OUT_FILE;
+ }
+
+ if ( nOut == DBG_OUT_FILE )
+ ImplDbgPrintFile( aBufOut );
+
+ ImplDbgUnlock();
+
+ bIn = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void DbgOutTypef( USHORT nDbgOut, const sal_Char* pFStr, ... )
+{
+ va_list pList;
+
+ va_start( pList, pFStr );
+ vsprintf( aBuf, pFStr, pList );
+ va_end( pList );
+
+ DbgOut( aBuf, nDbgOut );
+}
+
+// -----------------------------------------------------------------------
+
+void DbgOutf( const sal_Char* pFStr, ... )
+{
+ va_list pList;
+
+ va_start( pList, pFStr );
+ vsprintf( aBuf, pFStr, pList );
+ va_end( pList );
+
+ DbgOut( aBuf );
+}
+
+// =======================================================================
+
+#else
+
+void* DbgFunc( USHORT, void* ) { return NULL; }
+
+void DbgProf( USHORT, DbgDataType* ) {}
+void DbgXtor( DbgDataType*, USHORT, const void*, DbgUsr ) {}
+
+void DbgOut( const sal_Char*, USHORT, const sal_Char*, USHORT ) {}
+void DbgOutTypef( USHORT, const sal_Char*, ... ) {}
+void DbgOutf( const sal_Char*, ... ) {}
+
+#endif
diff --git a/tools/source/debug/makefile.mk b/tools/source/debug/makefile.mk
new file mode 100644
index 000000000000..c21005fd0331
--- /dev/null
+++ b/tools/source/debug/makefile.mk
@@ -0,0 +1,89 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=debug
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= debug.cxx \
+ stcktree.cxx
+
+SLOFILES= $(SLO)$/debug.obj \
+ $(SLO)$/stcktree.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/debug.obj \
+ $(OBJ)$/stcktree.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/debug/stcktree.cxx b/tools/source/debug/stcktree.cxx
new file mode 100644
index 000000000000..3e58510312df
--- /dev/null
+++ b/tools/source/debug/stcktree.cxx
@@ -0,0 +1,351 @@
+/*************************************************************************
+ *
+ * $RCSfile: stcktree.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#include <debug.hxx>
+
+// -----------------------------------------------------------------------
+
+#if defined( DBG_UTIL ) && defined( WNT ) && defined( INTEL )
+
+struct ImpDbgStackTree
+{
+ ImpDbgStackTree* pLeft_;
+ ImpDbgStackTree* pRight_;
+ ImpDbgStackTree* pCaller_;
+ ImpDbgStackTree* pSub_;
+ ULONG nIP_;
+ ULONG nBytesLeak_;
+ ULONG nBytesPeak_;
+ ULONG nBytes_;
+ ULONG nCountLeak_;
+ ULONG nCountPeak_;
+ ULONG nCount_;
+ ULONG nMax_;
+ ULONG nMin_;
+
+ ImpDbgStackTree( ImpDbgStackTree* pSub, ULONG nIP );
+ ~ImpDbgStackTree();
+
+ ImpDbgStackTree* Add( ULONG nAlloc, ULONG* pBP, ULONG nIP );
+ void Print( int nLevel, ULONG nCount, ULONG nCountLeak );
+ void Print( int nLevel );
+};
+
+static ImpDbgStackTree* pImpDbgStackTreeRoot = NULL;
+static ULONG* pImpDbgStackTreeBP = NULL;
+static ULONG nImpDbgStackTreeMain = 0;
+static int nImpDbgStackTreeSem = 0;
+
+// -----------------------------------------------------------------------
+
+ImpDbgStackTree::ImpDbgStackTree( ImpDbgStackTree* pSub, ULONG nIP )
+{
+ pSub_ = pSub;
+ nIP_ = nIP;
+ pLeft_ = pRight_ = pCaller_ = NULL;
+ nBytesLeak_ = nBytesPeak_ = nBytes_ = 0;
+ nCountLeak_ = nCountPeak_ = nCount_ = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImpDbgStackTree::~ImpDbgStackTree()
+{
+ if ( pLeft_ )
+ delete pLeft_;
+ if ( pRight_ )
+ delete pRight_;
+ if ( pCaller_ )
+ delete pCaller_;
+}
+
+// -----------------------------------------------------------------------
+
+void ImpDbgStackTree::Print( int nLevel, ULONG nCount, ULONG nCountLeak )
+{
+ if ( pLeft_ )
+ pLeft_->Print( nLevel, nCount, nCountLeak );
+
+ if ( nCount_ >= nCount && nCountLeak_ >= nCountLeak )
+ {
+ if ( nMax_ == nMin_ )
+ {
+ ULONG nTemp = nCountLeak_ * nMin_;
+ DbgOutf( "%*c%08lx Count=%lu/%lu/%lu Bytes=%lu/%lu/%lu Size=%lu",
+ nLevel, ' ', nIP_,
+ nCount_, nCountPeak_, nCountLeak_,
+ nBytes_, nBytesPeak_, nTemp,
+ nMin_ );
+ }
+ else
+ {
+ DbgOutf( "%*c%08lx Count=%lu/%lu/%lu Bytes=%lu/%lu/%lu Size=%lu-%lu",
+ nLevel, ' ', nIP_,
+ nCount_, nCountPeak_, nCountLeak_,
+ nBytes_, nBytesPeak_, nBytesLeak_,
+ nMin_, nMax_ );
+ }
+
+ if ( pCaller_ )
+ if( nLevel > 3 && nCountLeak )
+ pCaller_->Print( nLevel + 1, nCount, 1 );
+ else
+ pCaller_->Print( nLevel + 1, nCount, nCountLeak );
+ }
+
+ if ( pRight_ )
+ pRight_->Print( nLevel, nCount, nCountLeak );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpDbgStackTree::Print( int nLevel )
+{
+ if ( pSub_ )
+ pSub_->Print( nLevel + 1 );
+ DbgOutf( "%*c%08lx", nLevel, ' ',nIP_ );
+}
+
+// -----------------------------------------------------------------------
+
+ImpDbgStackTree* ImpDbgStackTree::Add( ULONG nAlloc, ULONG *pBP, ULONG nIP )
+{
+ if ( nIP < nIP_ )
+ {
+ if ( !pLeft_ )
+ pLeft_ = new ImpDbgStackTree( pSub_, nIP );
+ return pLeft_->Add( nAlloc, pBP, nIP );
+ }
+ if ( nIP > nIP_ )
+ {
+ if ( !pRight_ )
+ pRight_ = new ImpDbgStackTree( pSub_, nIP );
+ return pRight_->Add( nAlloc, pBP, nIP );
+ }
+
+ nCount_++;
+ nCountLeak_++;
+ if ( nCountLeak_ > nCountPeak_ )
+ nCountPeak_ = nCountLeak_;
+ nBytes_ += nAlloc;
+ nBytesLeak_ += nAlloc;
+ if ( nBytesLeak_ > nBytesPeak_ )
+ nBytesPeak_ = nBytesLeak_;
+ if ( nCount_ == 1 )
+ nMax_ = nMin_ = nAlloc;
+ else if ( nMax_ < nAlloc )
+ nMax_ = nAlloc;
+ else if ( nMin_ > nAlloc )
+ nMin_ = nAlloc;
+
+ if ( !(pBP[0] & 3) && (ULONG)pBP < pBP[0] && pBP[0] < (ULONG)pImpDbgStackTreeBP )
+ {
+ pBP = (ULONG*)pBP[0];
+ nIP = pBP[1];
+ if ( 0x01100000 <= nIP && nIP < 0x20000000 && nIP != nImpDbgStackTreeMain )
+ {
+ if ( !pCaller_ )
+ pCaller_ = new ImpDbgStackTree( this, nIP );
+ return pCaller_->Add( nAlloc, pBP, nIP );
+ }
+ else
+ return this;
+ }
+
+ return this;
+}
+
+// -----------------------------------------------------------------------
+
+void DbgStartStackTree()
+{
+ if ( !nImpDbgStackTreeMain )
+ {
+ ULONG* pBP;
+ __asm mov pBP, ebp;
+
+ pImpDbgStackTreeBP = (ULONG*)pBP[0];
+ nImpDbgStackTreeMain = pImpDbgStackTreeBP[1];
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DbgEndStackTree()
+{
+ if ( nImpDbgStackTreeMain )
+ {
+ nImpDbgStackTreeMain = 0;
+ if ( pImpDbgStackTreeRoot )
+ {
+ // Ausgaben ins File umleiten
+ DbgData* pData = DbgGetData();
+ ULONG nOldOut = pData->nTraceOut;
+ pData->nTraceOut = DBG_OUT_FILE;
+
+ DbgOutf( "Leak-Report" );
+ DbgOutf( "===========" );
+ DbgOutf( "Mem-StackTree:" );
+ DbgOutf( "{" );
+ pImpDbgStackTreeRoot->Print( 1, 1, 2 );
+ DbgOutf( "}" );
+
+ DbgOutf( "Alloc-Report" );
+ DbgOutf( "===========" );
+ DbgOutf( "Mem-StackTree:" );
+ DbgOutf( "{" );
+ pImpDbgStackTreeRoot->Print( 1, 1000, 0 ); // ???
+ DbgOutf( "}" );
+
+ pData->nTraceOut = nOldOut;
+
+ nImpDbgStackTreeSem++;
+ delete pImpDbgStackTreeRoot;
+ pImpDbgStackTreeRoot = NULL;
+ nImpDbgStackTreeSem--;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void* DbgGetStackTree( ULONG nAlloc )
+{
+ ImpDbgStackTree* pReturn = NULL;
+
+ if ( nImpDbgStackTreeMain && !nImpDbgStackTreeSem )
+ {
+ nImpDbgStackTreeSem++;
+
+ ULONG* pBP;
+ __asm mov pBP, ebp;
+
+ ULONG nIP = pBP[1];
+ if ( !pImpDbgStackTreeRoot )
+ pImpDbgStackTreeRoot = new ImpDbgStackTree( NULL, nIP );
+ pReturn = pImpDbgStackTreeRoot->Add( nAlloc, pBP, nIP );
+ nImpDbgStackTreeSem--;
+ }
+
+ return pReturn;
+}
+
+// -----------------------------------------------------------------------
+
+void DbgFreeStackTree( void* pVoid, ULONG nAlloc )
+{
+ ImpDbgStackTree* p = (ImpDbgStackTree*)pVoid;
+
+ if ( p && nImpDbgStackTreeMain && !nImpDbgStackTreeSem )
+ {
+ if ( nAlloc < p->nMin_ )
+ nAlloc = p->nMin_;
+
+ p->nCountLeak_--;
+ p->nBytesLeak_ -= nAlloc;
+
+ if ( p->nMax_ && 0xFFFFFFFF / p->nMax_ > p->nCountLeak_ )
+ {
+ if ( p->nBytesLeak_ > p->nMax_ * p->nCountLeak_ )
+ {
+ nAlloc += p->nBytesLeak_ - p->nMax_ * p->nCountLeak_;
+ p->nBytesLeak_ = p->nMax_ * p->nCountLeak_;
+ }
+ }
+
+ if ( p->pSub_ )
+ DbgFreeStackTree( (void*)(p->pSub_), nAlloc );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DbgPrintStackTree( void* pVoid )
+{
+ ImpDbgStackTree* p = (ImpDbgStackTree*)pVoid;
+
+ if ( p && nImpDbgStackTreeMain && !nImpDbgStackTreeSem )
+ {
+ // Ausgaben ins File umleiten
+ DbgData* pData = DbgGetData();
+ ULONG nOldOut = pData->nTraceOut;
+ pData->nTraceOut = DBG_OUT_FILE;
+
+ DbgOutf( "Mem-StackTree:" );
+ DbgOutf( "{" );
+ p->Print( 1 );
+ DbgOutf( "}" );
+
+ pData->nTraceOut = nOldOut;
+ }
+}
+
+#else
+
+void DbgStartStackTree() {}
+void DbgEndStackTree() {}
+void* DbgGetStackTree( ULONG ) { return NULL; }
+void DbgFreeStackTree( void*, ULONG nAlloc ) {}
+void DbgPrintStackTree( void* ) {}
+
+#endif
diff --git a/tools/source/fsys/comdep.cxx b/tools/source/fsys/comdep.cxx
new file mode 100644
index 000000000000..4bd8d1cc359a
--- /dev/null
+++ b/tools/source/fsys/comdep.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: comdep.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef MAC
+#define private public
+#define protected public
+#endif
+
+#include "comdep.hxx"
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _LIST_HXX
+#include <list.hxx>
+#endif
+#ifndef _FSYS_HXX
+#include <fsys.hxx>
+#endif
+
+DBG_NAMEEX( DirEntry );
+
+//--------------------------------------------------------------------
+
+#if defined( DOS ) || defined( WIN )
+
+#ifdef MSC
+#include "dosmsc.cxx"
+#endif
+
+#if defined( BLC ) || defined( TCPP )
+#include "dosblc.cxx"
+#endif
+
+#ifdef ZTC
+#include "dosztc.cxx"
+#endif
+
+#else
+
+#if defined( WNT ) && !defined( WTC )
+#include "wntmsc.cxx"
+#endif
+
+#ifdef UNX
+#include "unx.cxx"
+#endif
+
+#ifdef PM2
+#include "os2.cxx"
+#endif
+
+#ifdef MAC
+#include "mac.cxx"
+#endif
+
+#endif
+
diff --git a/tools/source/fsys/comdep.hxx b/tools/source/fsys/comdep.hxx
new file mode 100644
index 000000000000..702548429714
--- /dev/null
+++ b/tools/source/fsys/comdep.hxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * $RCSfile: comdep.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COMDEP_HXX
+#define _COMDEP_HXX
+
+#include "fsys.hxx"
+
+#define ACCESSDELIM(e) ( (e == FSYS_STYLE_MAC) ? ":" : \
+ ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \
+ e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \
+ ? "\\" : "/" )
+#define ACCESSDELIM_C(e)(char)\
+ ( (e == FSYS_STYLE_MAC) ? ':' : \
+ ( ( e == FSYS_STYLE_VFAT || e == FSYS_STYLE_HPFS || \
+ e == FSYS_STYLE_FAT ) || e == FSYS_STYLE_NTFS ) \
+ ? '\\' : '/' )
+#define SEARCHDELIM(e) ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ":" \
+ : ";" )
+#define SEARCHDELIM_C(e)(char)\
+ ( (e == FSYS_STYLE_SYSV || e == FSYS_STYLE_BSD) ? ':' \
+ : ';' )
+#define ACTPARENT(e) ( (e == FSYS_STYLE_MAC) ? ":" : ".." )
+#define ACTCURRENT(e) ( (e == FSYS_STYLE_MAC) ? "" : "." )
+
+#if defined(DOS) || defined(WIN)
+
+#ifdef MSC
+#include "dosmsc.hxx"
+#endif
+
+#if defined(TCPP) || defined(BLC)
+#include "dosblc.hxx"
+#endif
+
+#ifdef ZTC
+#include "dosztc.hxx"
+#endif
+
+#else
+
+#if defined( WNT ) && !defined( WTC )
+#include "wntmsc.hxx"
+#endif
+
+#ifdef UNX
+#include "unx.hxx"
+#endif
+
+#if defined(PM2) || defined(PM2)
+#include "os2.hxx"
+#endif
+
+#ifdef MAC
+#include "mac.hxx"
+#endif
+
+#endif
+
+//--------------------------------------------------------------------
+
+#ifndef LINUX
+DIR *opendir( const char* pPfad );
+dirent *readdir( DIR *pDir );
+int closedir( DIR *pDir );
+char *volumeid( const char* pPfad );
+#endif
+
+//--------------------------------------------------------------------
+
+struct DirReader_Impl
+{
+ Dir* pDir;
+#ifdef MAC
+ union
+ {
+ DIR* pDosDir;
+ dirent* pDosEntry;
+ };
+#else
+ DIR* pDosDir;
+ dirent* pDosEntry;
+#endif
+ DirEntry* pParent;
+ String aPath;
+ ByteString aBypass;
+ BOOL bReady;
+ BOOL bInUse;
+
+ DirReader_Impl( Dir &rDir )
+ : pDir( &rDir ),
+ aPath( GUI2FSYS(rDir.GetFull()) ),
+ pDosEntry( 0 ),
+ pParent( 0 ),
+ bReady ( FALSE ),
+ bInUse( FALSE )
+ {
+#ifndef BOOTSTRAP
+ // Redirection
+ FSysRedirector::DoRedirect( aPath );
+#endif
+
+ // nur den String der Memer-Var nehmen!
+
+#ifdef UNX //for further exlpanation see DirReader_Impl::Read() in unx.cxx
+ pDosDir = NULL;
+#else
+ aBypass = ByteString(aPath, osl_getThreadTextEncoding());
+ pDosDir = opendir( (char*) aBypass.GetBuffer() );
+#endif
+
+ // Parent f"ur die neuen DirEntries ermitteln
+ pParent = pDir->GetFlag() == FSYS_FLAG_NORMAL ||
+ pDir->GetFlag() == FSYS_FLAG_ABSROOT
+ ? pDir
+ : pDir->GetParent();
+
+ }
+
+ ~DirReader_Impl()
+ { if( pDosDir ) closedir( pDosDir ); }
+
+ // die folgenden sind systemabh"angig implementiert
+ USHORT Init(); // initialisiert, liest ggf. devices
+ USHORT Read(); // liest 1 Eintrag, F2ugt ein falls ok
+};
+
+//--------------------------------------------------------------------
+
+struct FileCopier_Impl
+{
+ FSysAction nActions; // was zu tun ist (Copy/Move/recur)
+ Link aErrorLink; // bei Fehlern zu rufen
+ ErrCode eErr; // aktueller Fehlercode im Error-Handler
+ const DirEntry* pErrSource; // fuer Error-Handler falls Source-Fehler
+ const DirEntry* pErrTarget; // fuer Error-Handler falls Target-Fehler
+
+ FileCopier_Impl()
+ : nActions( 0 ), eErr( 0 ),
+ pErrSource( 0 ), pErrTarget( 0 )
+ {}
+ FileCopier_Impl( const FileCopier_Impl &rOrig )
+ : nActions( rOrig.nActions ), eErr( 0 ),
+ pErrSource( 0 ), pErrTarget( 0 )
+ {}
+
+ FileCopier_Impl& operator=( const FileCopier_Impl &rOrig )
+ {
+ nActions = rOrig.nActions;
+ eErr = 0; pErrSource = 0; pErrTarget = 0;
+ return *this;
+ }
+};
+
+//--------------------------------------------------------------------
+
+#if defined(WNT) || defined(OS2)
+BOOL IsRedirectable_Impl( const ByteString &rPath );
+#else
+#define IsRedirectable_Impl( rPath ) TRUE
+#endif
+
+//--------------------------------------------------------------------
+
+
+#endif
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
new file mode 100644
index 000000000000..996be942639e
--- /dev/null
+++ b/tools/source/fsys/dirent.cxx
@@ -0,0 +1,3521 @@
+/*************************************************************************
+ *
+ * $RCSfile: dirent.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#if !defined( MAC ) && !defined( UNX )
+#include <io.h>
+#endif
+
+#if defined UNX
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined (WIN) || defined (MAC)
+#include <time.h>
+#endif
+
+#ifdef PM2
+#include <os2.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _LIST_HXX
+#include <list.hxx>
+#endif
+
+#ifndef _COMDEP_HXX
+#include "comdep.hxx"
+#endif
+#ifndef _FSYS_HXX
+#include "fsys.hxx"
+#endif
+#define _TOOLS_HXX
+#ifndef _URLOBJ_HXX
+#include <urlobj.hxx>
+#endif
+
+#ifdef UNX
+#define _MAX_PATH 260
+#endif
+
+#ifdef MAC_UNIVERSAL
+#ifndef _UNISTD
+#include <unistd.h>
+#endif
+#endif
+#ifdef MAC
+#ifndef __ERRORS__
+#include "Errors.h"
+#endif
+#endif
+
+#ifndef _STREAM_HXX
+#include <stream.hxx>
+#endif
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#include <osl/file.hxx>
+using namespace osl;
+using namespace rtl;
+
+int ApiRet2ToSolarError_Impl( int nApiRet );
+
+//--------------------------------------------------------------------
+int Sys2SolarError_Impl( int nSysErr )
+{
+ switch ( nSysErr )
+ {
+#ifdef WNT
+ case NO_ERROR: return ERRCODE_NONE;
+ case ERROR_INVALID_FUNCTION: return ERRCODE_IO_GENERAL;
+ case ERROR_FILE_NOT_FOUND: return ERRCODE_IO_NOTEXISTS;
+ case ERROR_PATH_NOT_FOUND: return ERRCODE_IO_NOTEXISTSPATH;
+ case ERROR_TOO_MANY_OPEN_FILES: return ERRCODE_IO_TOOMANYOPENFILES;
+ case ERROR_ACCESS_DENIED: return ERRCODE_IO_ACCESSDENIED;
+ case ERROR_INVALID_HANDLE: return ERRCODE_IO_GENERAL;
+ case ERROR_NOT_ENOUGH_MEMORY: return ERRCODE_IO_OUTOFMEMORY;
+ case ERROR_INVALID_BLOCK: return ERRCODE_IO_GENERAL;
+// case ERROR_BAD_ENVIRONMENT: return ERRCODE_IO_;
+ case ERROR_BAD_FORMAT: return ERRCODE_IO_WRONGFORMAT;
+ case ERROR_INVALID_ACCESS: return ERRCODE_IO_ACCESSDENIED;
+// case ERROR_INVALID_DATA: return ERRCODE_IO_;
+ case ERROR_INVALID_DRIVE: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_CURRENT_DIRECTORY: return ERRCODE_IO_CURRENTDIR;
+ case ERROR_NOT_SAME_DEVICE: return ERRCODE_IO_NOTSAMEDEVICE;
+// case ERROR_NO_MORE_FILES: return ERRCODE_IO_;
+ case ERROR_WRITE_PROTECT: return ERRCODE_IO_CANTWRITE;
+ case ERROR_BAD_UNIT: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_NOT_READY: return ERRCODE_IO_DEVICENOTREADY;
+ case ERROR_BAD_COMMAND: return ERRCODE_IO_GENERAL;
+ case ERROR_CRC: return ERRCODE_IO_BADCRC;
+ case ERROR_BAD_LENGTH: return ERRCODE_IO_INVALIDLENGTH;
+ case ERROR_SEEK: return ERRCODE_IO_CANTSEEK;
+ case ERROR_NOT_DOS_DISK: return ERRCODE_IO_WRONGFORMAT;
+ case ERROR_SECTOR_NOT_FOUND: return ERRCODE_IO_GENERAL;
+ case ERROR_WRITE_FAULT: return ERRCODE_IO_CANTWRITE;
+ case ERROR_READ_FAULT: return ERRCODE_IO_CANTREAD;
+ case ERROR_GEN_FAILURE: return ERRCODE_IO_GENERAL;
+ case ERROR_SHARING_VIOLATION: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_LOCK_VIOLATION: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_WRONG_DISK: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_NOT_SUPPORTED: return ERRCODE_IO_NOTSUPPORTED;
+#else
+ case 0: return ERRCODE_NONE;
+ case ENOENT: return ERRCODE_IO_NOTEXISTS;
+ case EACCES: return ERRCODE_IO_ACCESSDENIED;
+ case EEXIST: return ERRCODE_IO_ALREADYEXISTS;
+ case EINVAL: return ERRCODE_IO_INVALIDPARAMETER;
+ case EMFILE: return ERRCODE_IO_TOOMANYOPENFILES;
+ case ENOMEM: return ERRCODE_IO_OUTOFMEMORY;
+ case ENOSPC: return ERRCODE_IO_OUTOFSPACE;
+#endif
+ }
+
+ DBG_TRACE1( "FSys: unknown system error %d occured", nSysErr );
+ return FSYS_ERR_UNKNOWN;
+}
+
+//--------------------------------------------------------------------
+
+#ifndef BOOTSTRAP
+
+#if SUPD>=380
+FSysRedirector* FSysRedirector::_pRedirector = 0;
+BOOL FSysRedirector::_bEnabled = TRUE;
+#ifdef UNX
+BOOL bInRedirection = TRUE;
+#else
+BOOL bInRedirection = FALSE;
+#endif
+static NAMESPACE_VOS( OMutex )* pRedirectMutex = 0;
+
+//========================================================================
+
+FSysRedirector::~FSysRedirector()
+{
+}
+
+//------------------------------------------------------------------------
+void FSysRedirector::Register( FSysRedirector *pRedirector )
+{
+ if ( pRedirector )
+ pRedirectMutex = new NAMESPACE_VOS( OMutex );
+ else
+ DELETEZ( pRedirectMutex );
+ _pRedirector = pRedirector;
+}
+
+//------------------------------------------------------------------------
+
+BOOL FSysRedirector::DoRedirect( String &rPath )
+{
+ ByteString aURL(rPath, osl_getThreadTextEncoding());
+
+ // if redirection is disabled or not even registered do nothing
+ if ( !_bEnabled || !pRedirectMutex )
+ return FALSE;
+
+ // redirect only removable or remote volumes
+ if ( !IsRedirectable_Impl( aURL ) )
+ return FALSE;
+
+ // Redirection is acessible only by one thread per time
+ // dont move the guard behind the !bInRedirection return FALSE!!!
+ // think of nested calls (when called from callback)
+ NAMESPACE_VOS( OGuard ) aGuard( pRedirectMutex );
+
+ // if already in redirection, dont redirect
+ if ( bInRedirection )
+ return FALSE;
+
+ // dont redirect on nested calls
+ bInRedirection = TRUE;
+
+ // convert to URL
+#ifndef UNX
+ for ( char *p = (char *) aURL.GetBuffer(); *p; ++p )
+#ifndef MAC
+ if ( '\\' == *p ) *p = '/';
+ else if ( ':' == *p ) *p = '|';
+#else
+ if ( ':' == *p ) *p = '/';
+#endif
+#endif
+
+ aURL.Insert( "file:///", 0 );
+
+ // do redirection
+ Redirector();
+ BOOL bRedirected = Redirector()->Redirect( String(aURL, osl_getThreadTextEncoding()) );
+
+ // if redirected transform URL to file name
+ if ( bRedirected )
+ {
+ rPath = String(aURL.Copy( 8 ), osl_getThreadTextEncoding());
+ aURL = ByteString(rPath, osl_getThreadTextEncoding());
+#ifndef UNX
+ for ( char *p = (char *) aURL.GetBuffer(); *p; ++p )
+#ifndef MAC
+ if ( '/' == *p ) *p = '\\';
+ else if ( '|' == *p ) *p = ':';
+#else
+ if ( '/' == *p ) *p = ':';
+#endif
+#endif
+ }
+
+ bInRedirection = FALSE;
+ return bRedirected;
+}
+
+//------------------------------------------------------------------------
+
+void FSysRedirector::EnableRedirection( BOOL bEnable )
+{
+ if ( !bEnable && pRedirectMutex)
+ pRedirectMutex->acquire();
+ _bEnabled = bEnable;
+ if ( bEnable && pRedirectMutex)
+ pRedirectMutex->release();
+}
+
+//------------------------------------------------------------------------
+
+BOOL FSysRedirector::Redirect( String &rPath )
+{
+#ifdef DBG_MI
+ if ( rPath.Len() && rPath(1) == ':' &&
+ ( rPath(0) == 'b' || rPath(0) == 'B' ) )
+ {
+ rPath(0) = 'd';
+ rPath.Insert( "\\mi", 2 );
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
+
+//------------------------------------------------------------------------
+
+FSysRedirector* FSysRedirector::Redirector()
+{
+ if ( !_pRedirector )
+ Register( new FSysRedirector );
+ return _pRedirector;
+}
+#endif
+
+#endif // BOOTSTRAP
+
+//--------------------------------------------------------------------
+
+class DirEntryStack: public List
+{
+public:
+ DirEntryStack() {};
+ ~DirEntryStack();
+
+ inline void Push( DirEntry *pEntry );
+ inline DirEntry* Pop();
+ inline DirEntry* Top();
+ inline DirEntry* Bottom();
+};
+
+inline void DirEntryStack::Push( DirEntry *pEntry )
+{
+ List::Insert( pEntry, LIST_APPEND );
+}
+
+inline DirEntry* DirEntryStack::Pop()
+{
+ return (DirEntry*) List::Remove( Count() - 1 );
+}
+
+inline DirEntry* DirEntryStack::Top()
+{
+ return (DirEntry*) List::GetObject( Count() - 1 );
+}
+
+inline DirEntry* DirEntryStack::Bottom()
+{
+ return (DirEntry*) List::GetObject( 0 );
+}
+
+//--------------------------------------------------------------------
+
+DBG_NAME( DirEntry );
+
+/*************************************************************************
+|*
+|* DirEntry::~DirEntryStack()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 04.07.91
+|*
+*************************************************************************/
+
+DirEntryStack::~DirEntryStack()
+{
+ while ( Count() )
+ delete Pop();
+}
+
+/*************************************************************************
+|*
+|* ImpCheckDirEntry()
+|*
+|* Beschreibung Pruefung eines DirEntry fuer DBG_UTIL
+|* Parameter void* p Zeiger auf den DirEntry
+|* Return-Wert char* Fehlermeldungs-TExtension oder NULL
+|* Ersterstellung MI 16.07.91
+|* Letzte Aenderung MI 26.05.93
+|*
+*************************************************************************/
+
+#ifdef DBG_UTIL
+const char* ImpCheckDirEntry( const void* p )
+{
+ DirEntry* p0 = (DirEntry*)p;
+
+ if ( p0->pParent )
+ DBG_CHKOBJ( p0->pParent, DirEntry, ImpCheckDirEntry );
+
+ return NULL;
+}
+#endif
+
+/*************************************************************************
+|*
+|* ImplCutPath()
+|*
+|* Beschreibung Fuegt ... ein, damit maximal nMaxChars lang
+|* Ersterstellung MI 06.04.94
+|* Letzte Aenderung DV 24.06.96
+|*
+*************************************************************************/
+
+ByteString ImplCutPath( const ByteString& rStr, USHORT nMax, char cAccDel )
+{
+ USHORT nMaxPathLen = nMax;
+ ByteString aCutPath( rStr );
+ BOOL bInsertPrefix = FALSE;
+ USHORT nBegin = aCutPath.Search( cAccDel );
+
+ if( nBegin == STRING_NOTFOUND )
+ nBegin = 0;
+ else
+ nMaxPathLen += 2; // fuer Prefix <Laufwerk>:
+
+ while( aCutPath.Len() > nMaxPathLen )
+ {
+ USHORT nEnd = aCutPath.Search( cAccDel, nBegin + 1 );
+ USHORT nCount;
+
+ if ( nEnd != STRING_NOTFOUND )
+ {
+ nCount = nEnd - nBegin;
+ aCutPath.Erase( nBegin, nCount );
+ bInsertPrefix = TRUE;
+ }
+ else
+ break;
+ }
+
+ if ( aCutPath.Len() > nMaxPathLen )
+ {
+ for ( USHORT n = nMaxPathLen; n > nMaxPathLen/2; --n )
+ if ( !ByteString(aCutPath.GetChar(n)).IsAlphaNumericAscii() )
+ {
+ aCutPath.Erase( n );
+ aCutPath += "...";
+ break;
+ }
+ }
+
+ if ( bInsertPrefix )
+ {
+ ByteString aIns( cAccDel );
+ aIns += "...";
+ aCutPath.Insert( aIns, nBegin );
+ }
+
+ return aCutPath;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpParseOs2Name()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 23.06.95
+|*
+*************************************************************************/
+
+FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eStyle )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ // die einzelnen Namen auf einen Stack packen
+ ByteString aPfad( rPfad );
+ DirEntryStack aStack;
+
+ do
+ {
+ // den Namen vor dem ersten "\\" abspalten,
+ // falls '\\' am Anfang, ist der Name '\\',
+ // der Rest immer ohne die fuehrenden '\\'.
+ // ein ":" trennt ebenfalls, gehoert aber zum Namen
+ // den ersten '\\', '/' oder ':' suchen
+ USHORT nPos;
+ for ( nPos = 0;
+ nPos < aPfad.Len() && //?O
+ aPfad.GetChar(nPos) != '\\' && aPfad.GetChar(nPos) != '/' && //?O
+ aPfad.GetChar(nPos) != ':'; //?O
+ nPos++ )
+ /* do nothing */;
+
+ // ist der Name ein UNC Pathname?
+ if ( nPos == 0 && aPfad.Len() > 1 &&
+ ( ( aPfad.GetChar(0) == '\\' && aPfad.GetChar(1) == '\\' ) ||
+ ( aPfad.GetChar(0) == '/' && aPfad.GetChar(1) == '/' ) ) )
+ {
+ for ( nPos = 2; aPfad.Len() > nPos; ++nPos )
+ if ( aPfad.GetChar(nPos) == '\\' || aPfad.GetChar(nPos) == '/' )
+ break;
+ aName = aPfad.Copy( 2, nPos-2 );
+ aStack.Push( new DirEntry( aName, FSYS_FLAG_ABSROOT, eStyle ) );
+ }
+ // ist der Name die Root des aktuellen Drives?
+ else if ( nPos == 0 && aPfad.Len() > 0 &&
+ ( aPfad.GetChar(0) == '\\' || aPfad.GetChar(0) == '/' ) )
+ {
+ // Root-Directory des aktuellen Drives
+ aStack.Push( new DirEntry( FSYS_FLAG_ABSROOT ) );
+ }
+ else
+ {
+ // ist der Name ein Drive?
+ if ( nPos < aPfad.Len() && aPfad.GetChar(nPos) == ':' )
+ {
+ aName = aPfad.Copy( 0, nPos + 1 );
+
+ // ist der Name die Root des Drives
+ if ( (nPos + 1) < aPfad.Len() &&
+ ( aPfad.GetChar(nPos+1) == '\\' || aPfad.GetChar(nPos+1) == '/' ) )
+ {
+ // schon was auf dem Stack?
+ // oder Novell-Format? (not supported wegen URLs)
+ if ( aStack.Count() || aName.Len() > 2 )
+ {
+ aName = rPfad;
+ return FSYS_ERR_MISPLACEDCHAR;
+ }
+ // Root-Directory des Drive
+ aStack.Push( new DirEntry( aName, FSYS_FLAG_ABSROOT, eStyle ) );
+ }
+ else
+ {
+ // liegt ein anderes Drive auf dem Stack?
+ if ( aStack.Count() &&
+ COMPARE_EQUAL != aStack.Bottom()->aName.CompareIgnoreCaseToAscii(aName) )
+ aStack.Clear();
+
+ // liegt jetzt nichts mehr auf dem Stack?
+ if ( !aStack.Count() )
+ aStack.Push( new DirEntry( aName, FSYS_FLAG_RELROOT, eStyle ) );
+ }
+ }
+
+ // es ist kein Drive
+ else
+ {
+ // den Namen ohne Trenner abspalten
+ aName = aPfad.Copy( 0, nPos );
+
+ // stellt der Name die aktuelle Directory dar?
+ if ( aName == "." )
+ /* do nothing */;
+
+ // stellt der Name die Parent-Directory dar?
+ else if ( aName == ".." )
+ {
+ // ist nichts, ein Parent oder eine relative Root
+ // auf dem Stack?
+ if ( ( aStack.Count() == 0 ) ||
+ ( aStack.Top()->eFlag == FSYS_FLAG_PARENT ) ||
+ ( aStack.Top()->eFlag == FSYS_FLAG_RELROOT ) )
+ // fuehrende Parents kommen auf den Stack
+ aStack.Push( new DirEntry( FSYS_FLAG_PARENT ) );
+
+ // ist es eine absolute Root
+ else if ( aStack.Top()->eFlag == FSYS_FLAG_ABSROOT )
+ {
+ // die hat keine Parent-Directory
+ aName = rPfad;
+ return FSYS_ERR_NOTEXISTS;
+ }
+ else
+ // sonst hebt der Parent den TOS auf
+ delete aStack.Pop();
+ }
+
+ else
+ {
+ if ( eStyle == FSYS_STYLE_FAT )
+ {
+ // ist der Name grundsaetzlich ungueltig?
+ int nPunkte = 0;
+ const char *pChar;
+ for ( pChar = aName.GetBuffer();
+ nPunkte < 2 && *pChar != 0;
+ pChar++ )
+ {
+ if ( *pChar == ';' )
+ nPunkte = 0;
+ else
+ nPunkte += ( *pChar == '.' ) ? 1 : 0;
+ }
+ if ( nPunkte > 1 )
+ {
+ aName = rPfad;
+ return FSYS_ERR_MISPLACEDCHAR;
+ }
+ }
+
+ // normalen Entries kommen auf den Stack
+ DirEntry *pNew = new DirEntry( aName, FSYS_FLAG_NORMAL, eStyle );
+ if ( !pNew->IsValid() )
+ {
+ aName = rPfad;
+ ErrCode eErr = pNew->GetError();
+ delete pNew;
+ return eErr;
+ }
+ aStack.Push( pNew );
+ }
+ }
+ }
+
+ // den Restpfad bestimmen
+ aPfad.Erase( 0, nPos + 1 );
+ while ( aPfad.Len() && ( aPfad.GetChar(0) == '\\' || aPfad.GetChar(0) == '/' ) )
+ aPfad.Erase( 0, 1 );
+ }
+ while ( aPfad.Len() );
+
+ ULONG nErr = ERRCODE_NONE;
+ // Haupt-Entry (selbst) zuweisen
+ if ( aStack.Count() == 0 )
+ {
+ eFlag = FSYS_FLAG_CURRENT;
+ aName.Erase();
+ }
+ else
+ {
+ eFlag = aStack.Top()->eFlag;
+ aName = aStack.Top()->aName;
+ nErr = aStack.Top()->nError;
+ delete aStack.Pop();
+ }
+
+ // die Parent-Entries vom Stack holen
+ DirEntry** pTemp = &pParent; // Zeiger auf den Member pParent setzen
+ while ( aStack.Count() )
+ {
+ *pTemp = aStack.Pop();
+
+ // Zeiger auf den Member pParent des eigenen Parent setzen
+ pTemp = &( (*pTemp)->pParent );
+ }
+
+ // wird damit ein Volume beschrieben?
+ if ( !pParent && eFlag == FSYS_FLAG_RELROOT && aName.Len() )
+ eFlag = FSYS_FLAG_VOLUME;
+
+ // bei gesetztem ErrorCode den Namen komplett "ubernehmen
+ if ( nErr )
+ aName = rPfad;
+ return nErr;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpParseName()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.08.91
+|* Letzte Aenderung MI 26.05.93
+|*
+*************************************************************************/
+
+FSysError DirEntry::ImpParseName( const ByteString& rInitName,
+ FSysPathStyle eStyle )
+{
+ if ( eStyle == FSYS_STYLE_HOST )
+ eStyle = DEFSTYLE;
+
+ // KI-Division of FSys
+ if ( eStyle == FSYS_STYLE_DETECT )
+ {
+ char cFirst = rInitName.Copy(0,1).ToLowerAscii().GetChar(0);
+ if ( rInitName.Len() == 2 && rInitName.GetChar(1) == ':' &&
+ cFirst >= 'a' &&
+ cFirst <= 'z' )
+ eStyle = FSYS_STYLE_HPFS;
+ else if ( rInitName.Len() > 2 && rInitName.GetChar(1) == ':' )
+ {
+ if ( rInitName.Search( ':', 2 ) == STRING_NOTFOUND )
+ eStyle = FSYS_STYLE_HPFS;
+ else
+ eStyle = FSYS_STYLE_MAC;
+ }
+ else if ( rInitName.Search( '/' ) != STRING_NOTFOUND )
+ eStyle = FSYS_STYLE_BSD;
+ else if ( rInitName.Search( '\\' ) != STRING_NOTFOUND )
+ eStyle = FSYS_STYLE_HPFS;
+ else if ( rInitName.Search( ':' ) != STRING_NOTFOUND )
+ eStyle = FSYS_STYLE_MAC;
+ else
+ eStyle = FSYS_STYLE_HPFS;
+ }
+
+ switch ( eStyle )
+ {
+ case FSYS_STYLE_FAT:
+ case FSYS_STYLE_VFAT:
+ case FSYS_STYLE_HPFS:
+ case FSYS_STYLE_NTFS:
+ case FSYS_STYLE_NWFS:
+ return ImpParseOs2Name( rInitName, eStyle );
+
+ case FSYS_STYLE_BSD:
+ case FSYS_STYLE_SYSV:
+ return ImpParseUnixName( rInitName, eStyle );
+
+ case FSYS_STYLE_MAC:
+ return ImpParseMacName( rInitName );
+
+ default:
+ return FSYS_ERR_UNKNOWN;
+ }
+}
+
+/*************************************************************************
+|*
+|* GetStyle()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 15.11.91
+|* Letzte Aenderung MI 15.11.91
+|*
+*************************************************************************/
+
+static FSysPathStyle GetStyle( FSysPathStyle eStyle )
+{
+ if ( eStyle == FSYS_STYLE_HOST || eStyle == FSYS_STYLE_DETECT )
+ return DEFSTYLE;
+ else
+ return eStyle;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpTrim()
+|*
+|* Beschreibung bringt den Namen auf Betriebssystem-Norm
+|* z.B. 8.3 lower beim MS-DOS Formatter
+|* wirkt nicht rekursiv
+|* Ersterstellung MI 12.08.91
+|* Letzte Aenderung MI 21.05.92
+|*
+*************************************************************************/
+
+void DirEntry::ImpTrim( FSysPathStyle eStyle )
+{
+ // Wildcards werden nicht geclipt
+ if ( ( aName.Search( '*' ) != STRING_NOTFOUND ) ||
+ ( aName.Search( '?' ) != STRING_NOTFOUND ) ||
+ ( aName.Search( ';' ) != STRING_NOTFOUND ) )
+ return;
+
+ switch ( eStyle )
+ {
+ case FSYS_STYLE_FAT:
+ {
+ USHORT nPunktPos = aName.Search( '.' );
+ if ( nPunktPos == STRING_NOTFOUND )
+ {
+ if ( aName.Len() > 8 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( 8 );
+ }
+ }
+ else
+ {
+ if ( nPunktPos > 8 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( 8, nPunktPos - 8 );
+ nPunktPos = 8;
+ }
+ if ( aName.Len() > nPunktPos + 3 )
+ {
+ if ( aName.Len() - nPunktPos > 4 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( nPunktPos + 4 );
+ }
+ }
+ }
+ aName.ToLowerAscii();
+ break;
+ }
+
+ case FSYS_STYLE_VFAT:
+ case FSYS_STYLE_HPFS:
+ case FSYS_STYLE_NTFS:
+ case FSYS_STYLE_NWFS:
+ if ( aName.Len() > 254 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( 254 );
+ }
+
+ if ( eStyle == FSYS_STYLE_HPFS &&
+ ( eFlag == FSYS_FLAG_ABSROOT || eFlag == FSYS_FLAG_RELROOT ) )
+ aName.ToUpperAscii();
+ break;
+
+ case FSYS_STYLE_SYSV:
+ if ( aName.Len() > 14 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( 14 );
+ }
+ break;
+
+ case FSYS_STYLE_BSD:
+ if ( aName.Len() > 250 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( 250 );
+ }
+ break;
+
+ case FSYS_STYLE_MAC:
+ if ( eFlag & ( FSYS_FLAG_ABSROOT | FSYS_FLAG_VOLUME ) )
+ {
+ if ( aName.Len() > 27 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( 27 );
+ }
+ }
+ else
+ {
+ if ( aName.Len() > 31 )
+ {
+ nError = ERRCODE_IO_MISPLACEDCHAR|ERRCODE_WARNING_MASK;
+ aName.Erase( 31 );
+ }
+ }
+ break;
+
+ default:
+ /* kann nicht sein */;
+ }
+}
+
+/*************************************************************************
+|*
+|* DirEntry::DirEntry()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry::DirEntry( const ByteString& rName, DirEntryFlag eDirFlag,
+ FSysPathStyle eStyle ) :
+#ifdef FEAT_FSYS_DOUBLESPEED
+ pStat( 0 ),
+#endif
+ aName( rName )
+{
+ DBG_CTOR( DirEntry, ImpCheckDirEntry );
+
+ pParent = NULL;
+ eFlag = eDirFlag;
+ nError = FSYS_ERR_OK;
+
+ ImpTrim( eStyle );
+}
+
+/*************************************************************************
+|*
+|* DirEntry::DirEntry()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry::DirEntry( const DirEntry& rOrig ) :
+#ifdef FEAT_FSYS_DOUBLESPEED
+ pStat( rOrig.pStat ? new FileStat(*rOrig.pStat) : 0 ),
+#endif
+ aName( rOrig.aName )
+{
+ DBG_CTOR( DirEntry, ImpCheckDirEntry );
+
+ eFlag = rOrig.eFlag;
+ nError = rOrig.nError;
+
+ if ( rOrig.pParent )
+ {
+ pParent = new DirEntry( *rOrig.pParent );
+ }
+ else
+ {
+ pParent = NULL;
+ }
+}
+
+/*************************************************************************
+|*
+|* DirEntry::DirEntry()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle )
+#ifdef FEAT_FSYS_DOUBLESPEED
+ : pStat( 0 )
+#endif
+{
+ DBG_CTOR( DirEntry, ImpCheckDirEntry );
+
+ pParent = NULL;
+
+ // schnelle Loesung fuer Leerstring
+ if ( !rInitName.Len())
+ {
+ eFlag = FSYS_FLAG_CURRENT;
+ nError = FSYS_ERR_OK;
+ return;
+ }
+
+ ByteString aTmpName(rInitName, osl_getThreadTextEncoding());
+ if( eStyle == FSYS_STYLE_URL || aTmpName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL )
+ {
+#ifndef BOOTSTRAP
+ DBG_WARNING( "File URLs are not permitted but accepted" );
+ aTmpName = ByteString(INetURLObject( rInitName ).PathToFileName(), osl_getThreadTextEncoding());
+ eStyle = FSYS_STYLE_HOST;
+#endif // BOOTSTRAP
+ }
+ else
+ {
+ ::rtl::OUString aTmp;
+ ::rtl::OUString aOInitName;
+ if ( FileBase::normalizePath( OUString( rInitName ), aTmp ) == osl_File_E_None )
+ {
+ FileBase::getSystemPathFromNormalizedPath( aTmp, aOInitName );
+ aTmpName = ByteString( String(aOInitName), osl_getThreadTextEncoding() );
+ }
+
+#ifdef DBG_UTIL
+ // ASF nur bei Default eStyle, nicht z.B. aus MakeShortName()
+ if( eStyle == FSYS_STYLE_HOST &&
+ aTmpName.Search( "://" ) != STRING_NOTFOUND )
+ {
+ ByteString aErr = "DirEntries akzeptieren nur File URLS: ";
+ aErr += aTmpName;
+ DBG_WARNING( aErr.GetBuffer() );
+ }
+#endif
+ }
+
+ nError = ImpParseName( aTmpName, eStyle );
+
+ if ( nError != FSYS_ERR_OK )
+ eFlag = FSYS_FLAG_INVALID;
+}
+
+/*************************************************************************/
+
+DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle )
+#ifdef FEAT_FSYS_DOUBLESPEED
+ : pStat( 0 )
+#endif
+{
+ DBG_CTOR( DirEntry, ImpCheckDirEntry );
+
+ pParent = NULL;
+
+ // schnelle Loesung fuer Leerstring
+ if ( !rInitName.Len() )
+ {
+ eFlag = FSYS_FLAG_CURRENT;
+ nError = FSYS_ERR_OK;
+ return;
+ }
+
+ ByteString aTmpName( rInitName );
+ if( eStyle == FSYS_STYLE_URL || rInitName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL )
+ {
+#ifndef BOOTSTRAP
+ DBG_WARNING( "File URLs are not permitted but accepted" );
+ aTmpName = ByteString(INetURLObject( rInitName ).PathToFileName(), osl_getThreadTextEncoding());
+ eStyle = FSYS_STYLE_HOST;
+#endif
+ }
+#ifdef DBG_UTIL
+ else
+ // ASF nur bei Default eStyle, nicht z.B. aus MakeShortName()
+ if( eStyle == FSYS_STYLE_HOST &&
+ rInitName.Search( "://" ) != STRING_NOTFOUND )
+ {
+ ByteString aErr = "DirEntries akzeptieren nur File URLS: ";
+ aErr += rInitName;
+ DBG_WARNING( aErr.GetBuffer() );
+ }
+#endif
+
+ nError = ImpParseName( aTmpName, eStyle );
+
+ if ( nError != FSYS_ERR_OK )
+ eFlag = FSYS_FLAG_INVALID;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::DirEntry()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry::DirEntry( DirEntryFlag eDirFlag )
+#ifdef FEAT_FSYS_DOUBLESPEED
+ : pStat( 0 )
+#endif
+{
+ DBG_CTOR( DirEntry, ImpCheckDirEntry );
+
+ eFlag = eDirFlag;
+ nError = ( eFlag == FSYS_FLAG_INVALID ) ? FSYS_ERR_UNKNOWN : FSYS_ERR_OK;
+ pParent = NULL;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::~DirEntry()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry::~DirEntry()
+{
+ DBG_DTOR( DirEntry, ImpCheckDirEntry );
+
+ delete pParent;
+#ifdef FEAT_FSYS_DOUBLESPEED
+ delete pStat;
+#endif
+
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpGetTopPtr() const
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+const DirEntry* DirEntry::ImpGetTopPtr() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ const DirEntry *pTemp = this;
+ while ( pTemp->pParent )
+ pTemp = pTemp->pParent;
+
+ return pTemp;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpGetTopPtr()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 13.11.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry* DirEntry::ImpGetTopPtr()
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry *pTemp = this;
+ while ( pTemp->pParent )
+ pTemp = pTemp->pParent;
+
+ return pTemp;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpGetPreTopPtr()
+|*
+|* Beschreibung liefert einen Pointer auf den vorletzten Entry
+|* Ersterstellung MI 01.11.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry* DirEntry::ImpGetPreTopPtr()
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry *pTemp = this;
+ if ( pTemp->pParent )
+ {
+ while ( pTemp->pParent->pParent )
+ pTemp = pTemp->pParent;
+ }
+
+ return pTemp;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpChangeParent()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 21.05.92
+|*
+*************************************************************************/
+
+DirEntry* DirEntry::ImpChangeParent( DirEntry* pNewParent, BOOL bNormalize )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry *pTemp = pParent;
+ if ( bNormalize && pNewParent &&
+ pNewParent->eFlag == FSYS_FLAG_RELROOT && !pNewParent->aName.Len() )
+ {
+ pParent = 0;
+ delete pNewParent;
+ }
+ else
+ pParent = pNewParent;
+
+ return pTemp;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::Exists()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 24.09.91
+|*
+*************************************************************************/
+
+BOOL DirEntry::Exists( FSysAccess nAccess ) const
+{
+#ifndef BOOTSTRAP
+ static NAMESPACE_VOS(OMutex) aLocalMutex;
+ NAMESPACE_VOS(OGuard) aGuard( aLocalMutex );
+#endif
+ if ( !IsValid() )
+ return FALSE;
+
+#if defined(DOS) || defined(WIN) || defined(WNT) || defined(OS2)
+ // spezielle Filenamen sind vom System da
+ if ( ( aName.CompareIgnoreCaseToAscii("CLOCK$") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("CON") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("AUX") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("COM1") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("COM2") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("COM3") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("COM4") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("LPT1") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("LPT2") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("LPT3") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("NUL") == COMPARE_EQUAL ||
+ aName.CompareIgnoreCaseToAscii("PRN") == COMPARE_EQUAL ) )
+ return TRUE;
+#endif
+
+ FSysFailOnErrorImpl();
+ DirEntryKind eKind = FileStat( *this, nAccess ).GetKind();
+ if ( eKind & ( FSYS_KIND_FILE | FSYS_KIND_DIR ) )
+ {
+ return TRUE;
+ }
+
+#if defined(WIN) || defined(DOS) || defined(OS2) || defined(WNT)
+ if ( 0 != ( eKind & FSYS_KIND_DEV ) )
+ {
+ return DRIVE_EXISTS( ImpGetTopPtr()->aName.GetChar(0) );
+ }
+#endif
+
+ return 0 != ( eKind & ( FSYS_KIND_FILE | FSYS_KIND_DIR ) );
+}
+
+/*************************************************************************
+|*
+|* DirEntry::First()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 15.01.92
+|*
+*************************************************************************/
+
+BOOL DirEntry::First()
+{
+ FSysFailOnErrorImpl();
+
+ String aUniPathName( GetPath().GetFull() );
+#ifndef BOOTSTRAP
+ FSysRedirector::DoRedirect( aUniPathName );
+ ByteString aPathName(aUniPathName, osl_getThreadTextEncoding());
+#else
+ ByteString aPathName(aUniPathName, gsl_getSystemTextEncoding());
+#endif
+ aPathName = GUI2FSYS( aPathName );
+
+ DIR *pDir = opendir( (char*) aPathName.GetBuffer() );
+ if ( pDir )
+ {
+#ifndef BOOTSTRAP
+ WildCard aWildeKarte( String(CMP_LOWER( aName ), osl_getThreadTextEncoding()) );
+#else
+ WildCard aWildeKarte( String(CMP_LOWER( aName ), gsl_getSystemTextEncoding()) );
+#endif
+ for ( dirent* pEntry = readdir( pDir );
+ pEntry;
+ pEntry = readdir( pDir ) )
+ {
+ ByteString aFound( FSYS2GUI( ByteString( pEntry->d_name ) ) );
+ if ( aWildeKarte.Matches( String(CMP_LOWER( aFound ), osl_getThreadTextEncoding())))
+ {
+ aName = aFound;
+ closedir( pDir );
+ return TRUE;
+ }
+ }
+ closedir( pDir );
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetFull()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+String DirEntry::GetFull( FSysPathStyle eStyle, BOOL bWithDelimiter,
+ USHORT nMaxChars ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ ByteString aRet;
+ eStyle = GetStyle( eStyle );
+ if ( pParent )
+ {
+ if ( ( pParent->eFlag == FSYS_FLAG_ABSROOT ||
+ pParent->eFlag == FSYS_FLAG_RELROOT ||
+ pParent->eFlag == FSYS_FLAG_VOLUME ) )
+ {
+ aRet = ByteString(pParent->GetName( eStyle ), osl_getThreadTextEncoding());
+ aRet += ByteString(GetName( eStyle ), osl_getThreadTextEncoding());
+ }
+ else
+ {
+ aRet = ByteString(pParent->GetFull( eStyle ), osl_getThreadTextEncoding());
+ aRet += ACCESSDELIM_C(eStyle);
+ aRet += ByteString(GetName( eStyle ), osl_getThreadTextEncoding());
+ }
+ }
+ else
+ {
+ aRet = ByteString(GetName( eStyle ), osl_getThreadTextEncoding());
+ }
+
+ if ( ( eStyle == FSYS_STYLE_MAC ) &&
+ ( ImpGetTopPtr()->eFlag != FSYS_FLAG_VOLUME ) &&
+ ( ImpGetTopPtr()->eFlag != FSYS_FLAG_ABSROOT ) &&
+ ( aRet.GetChar(0) != ':' ) )
+ aRet.Insert( ACCESSDELIM_C(eStyle), 0 );
+
+ //! Hack
+ if ( bWithDelimiter )
+ if ( aRet.GetChar( aRet.Len()-1 ) != ACCESSDELIM_C(eStyle) )
+ aRet += ACCESSDELIM_C(eStyle);
+
+ //! noch ein Hack
+ if ( nMaxChars < STRING_MAXLEN )
+ aRet = ImplCutPath( aRet, nMaxChars, ACCESSDELIM_C(eStyle) );
+
+ return String(aRet, osl_getThreadTextEncoding());
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetPath()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry DirEntry::GetPath() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ if ( pParent )
+ return DirEntry( *pParent );
+
+ return DirEntry();
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetExtension()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+String DirEntry::GetExtension( char cSep ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ const char *p0 = ( aName.GetBuffer() );
+ const char *p1 = p0 + aName.Len() - 1;
+ while ( p1 >= p0 && *p1 != cSep )
+ p1--;
+
+ if ( p1 >= p0 )
+ // es wurde ein cSep an der Position p1 gefunden
+ return String(aName.Copy( p1 - p0 + 1 ), osl_getThreadTextEncoding());
+ return String();
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetBase()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+String DirEntry::GetBase( char cSep ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ const char *p0 = ( aName.GetBuffer() );
+ const char *p1 = p0 + aName.Len() - 1;
+ while ( p1 >= p0 && *p1 != cSep )
+ p1--;
+
+ if ( p1 >= p0 )
+ // es wurde ein cSep an der Position p1 gefunden
+ return String(aName.Copy( 0, p1 - p0 ), osl_getThreadTextEncoding());
+
+ else
+ // es wurde kein cSep gefunden
+ return String(aName, osl_getThreadTextEncoding());
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetName()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91 13:47
+|*
+*************************************************************************/
+
+String DirEntry::GetName( FSysPathStyle eStyle ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ ByteString aRet;
+ eStyle = GetStyle( eStyle );
+
+ switch( eFlag )
+ {
+ case FSYS_FLAG_PARENT:
+ aRet = ACTPARENT(eStyle);
+ break;
+
+ case FSYS_FLAG_ABSROOT:
+ {
+ if ( eStyle == FSYS_STYLE_URL )
+ {
+ aRet = "file:///";
+ aRet += aName;
+
+#ifndef UNX
+ if ( aName.Len())
+ {
+ if ( aName.GetChar(aName.Len()-1) == ':' )
+ {
+ aRet.SetChar(aRet.Len()-1, '|');
+ }
+ else
+ {
+#ifndef MAC
+ aRet.Insert( '/', 5 );
+#endif
+ }
+ aRet += "/";
+ }
+#endif
+ }
+ else if ( eStyle != FSYS_STYLE_MAC &&
+ aName.Len() > 1 && aName.GetChar( 1 ) != ':' )
+ {
+ // UNC-Pathname
+ aRet = ACCESSDELIM_C(eStyle);
+ aRet += ACCESSDELIM_C(eStyle);
+ aRet += aName ;
+ aRet += ACCESSDELIM_C(eStyle);
+ }
+ else
+ {
+ aRet = aName;
+ aRet += ACCESSDELIM_C(eStyle);
+ }
+ break;
+ }
+
+ case FSYS_FLAG_INVALID:
+ case FSYS_FLAG_VOLUME:
+ {
+ if ( eStyle == FSYS_STYLE_URL )
+ {
+ aRet = "file:///";
+ aRet += aName;
+#ifndef UNX
+ if ( aName.Len() && aName.GetChar(aName.Len()-1) == ':' )
+ {
+ aRet.SetChar(aRet.Len()-1, '|');
+ }
+#endif
+ }
+ else
+ {
+ aRet = aName;
+ }
+
+ break;
+ }
+
+ case FSYS_FLAG_RELROOT:
+ if ( !aName.Len() )
+ {
+ aRet = ACTCURRENT(eStyle);
+ break;
+ }
+
+ default:
+ aRet = aName;
+ }
+
+ return String(aRet, osl_getThreadTextEncoding());
+}
+
+/*************************************************************************
+|*
+|* DirEntry::IsAbs()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+BOOL DirEntry::IsAbs() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+#ifdef UNX
+ return ( pParent ? pParent->IsAbs() : eFlag == FSYS_FLAG_ABSROOT );
+#else
+ return ( pParent ? pParent->IsAbs() : eFlag == FSYS_FLAG_ABSROOT && aName.Len() > 0 );
+#endif
+}
+
+/*************************************************************************
+|*
+|* DirEntry::CutName()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+String DirEntry::CutName( FSysPathStyle eStyle )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ eStyle = GetStyle( eStyle );
+
+ String aOldName( GetName( eStyle ) );
+
+ if ( pParent )
+ {
+ DirEntry *pOldParent = pParent;
+ if ( pOldParent )
+ {
+ pParent = pOldParent->pParent;
+ eFlag = pOldParent->eFlag;
+ aName = pOldParent->aName;
+ pOldParent->pParent = NULL;
+ delete pOldParent;
+ }
+ else
+ {
+ eFlag = FSYS_FLAG_CURRENT;
+ aName.Erase();
+ }
+ }
+ else
+ {
+ eFlag = FSYS_FLAG_CURRENT;
+ aName.Erase();
+ delete pParent;
+ pParent = NULL;
+ }
+
+ return aOldName;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::NameCompare
+|*
+|* Beschreibung Vergleich nur die Namen (ohne Pfad, aber mit Gross/Klein)
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+StringCompare DirEntry::NameCompare( const DirEntry &rWith ) const
+{
+ ByteString aThisName;
+ ByteString aParameterName;
+
+#ifdef UNX
+ aThisName = aName;
+ aParameterName = rWith.aName;
+#else
+ aThisName = ByteString(aName).ToLowerAscii();
+ aParameterName = ByteString(rWith.aName).ToLowerAscii();
+#endif
+
+ return aThisName.CompareTo( aParameterName );
+}
+
+
+/*************************************************************************
+|*
+|* DirEntry::operator==()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+BOOL DirEntry::operator==( const DirEntry& rEntry ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ // test wheather the contents are textual the same
+
+ if ( nError && ( nError == rEntry.nError ) )
+ return TRUE;
+ if ( nError || rEntry.nError ||
+ ( eFlag == FSYS_FLAG_INVALID ) ||
+ ( rEntry.eFlag == FSYS_FLAG_INVALID ) )
+ return FALSE;
+
+ const DirEntry *pThis = this;
+ const DirEntry *pWith = &rEntry;
+ while( pThis && pWith && (pThis->eFlag == pWith->eFlag) )
+ {
+ if ( CMP_LOWER(pThis->aName) != CMP_LOWER(pWith->aName) )
+ break;
+ pThis = pThis->pParent;
+ pWith = pWith->pParent;
+ }
+
+ return ( !pThis && !pWith );
+}
+
+/*************************************************************************
+|*
+|* DirEntry::operator=()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry& DirEntry::operator=( const DirEntry& rEntry )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ if ( this == &rEntry )
+ return *this;
+ if ( rEntry.nError != FSYS_ERR_OK ) {
+ DBG_ERROR("Zuweisung mit invalidem DirEntry");
+ nError = rEntry.nError;
+ return *this;
+ }
+
+ // Name und Typ uebernehmen, Refs beibehalten
+ aName = rEntry.aName;
+ eFlag = rEntry.eFlag;
+ nError = FSYS_ERR_OK;
+
+ DirEntry *pOldParent = pParent;
+ if ( rEntry.pParent )
+ pParent = new DirEntry( *rEntry.pParent );
+ else
+ pParent = NULL;
+
+ if ( pOldParent )
+ delete pOldParent;
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::operator+()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry DirEntry::operator+( const DirEntry& rEntry ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+#ifdef DBG_UTIL
+ static BOOL bTested = FALSE;
+ if ( !bTested )
+ {
+ bTested = TRUE;
+ FSysTest();
+ }
+#endif
+
+ const DirEntry *pEntryTop = rEntry.ImpGetTopPtr();
+ const DirEntry *pThisTop = ImpGetTopPtr();
+
+ // "." + irgendwas oder irgendwas + "d:irgendwas"
+/* TPF:org
+ if ( ( eFlag == FSYS_FLAG_RELROOT && !aName ) ||
+ ( pEntryTop->aName.Len() &&
+ ( pEntryTop->eFlag == FSYS_FLAG_ABSROOT ||
+ pEntryTop->eFlag == FSYS_FLAG_RELROOT ||
+ pEntryTop->eFlag == FSYS_FLAG_VOLUME ) ) )
+ return rEntry;
+*/
+
+ if (
+ (eFlag == FSYS_FLAG_RELROOT && !aName.Len()) ||
+ (
+ (pEntryTop->aName.Len() ||
+ ((rEntry.Level()>1)?(rEntry[rEntry.Level()-2].aName.CompareIgnoreCaseToAscii(RFS_IDENTIFIER)==COMPARE_EQUAL):FALSE))
+ &&
+ (pEntryTop->eFlag == FSYS_FLAG_ABSROOT ||
+ pEntryTop->eFlag == FSYS_FLAG_RELROOT ||
+ pEntryTop->eFlag == FSYS_FLAG_VOLUME)
+ )
+ )
+ {
+ return rEntry;
+ }
+
+ // irgendwas + "." (=> pEntryTop == &rEntry)
+ if ( pEntryTop->eFlag == FSYS_FLAG_RELROOT && !pEntryTop->aName.Len() )
+ {
+ DBG_ASSERT( pEntryTop == &rEntry, "DirEntry::op+ buggy" );
+ return *this;
+ }
+
+ // root += ".." (=> unmoeglich)
+ if ( pEntryTop->eFlag == FSYS_FLAG_PARENT && pThisTop == this &&
+ ( eFlag == FSYS_FLAG_ABSROOT ) )
+ return DirEntry( FSYS_FLAG_INVALID );
+
+ // irgendwas += abs (=> nur Device uebernehmen falls vorhanden)
+ if ( pEntryTop->eFlag == FSYS_FLAG_ABSROOT )
+ {
+ ByteString aDevice;
+ if ( pThisTop->eFlag == FSYS_FLAG_ABSROOT )
+ aDevice = pThisTop->aName;
+ DirEntry aRet = rEntry;
+ if ( aDevice.Len() )
+ aRet.ImpGetTopPtr()->aName = aDevice;
+ return aRet;
+ }
+
+ // irgendwas += ".." (=> aufloesen)
+ if ( eFlag == FSYS_FLAG_NORMAL && pEntryTop->eFlag == FSYS_FLAG_PARENT )
+ {
+ String aConcated( GetFull() );
+ aConcated += ACCESSDELIM_C(FSYS_STYLE_HOST);
+ aConcated += rEntry.GetFull();
+ return DirEntry( aConcated );
+ }
+
+ // sonst einfach hintereinander haengen
+ DirEntry aRet( rEntry );
+ DirEntry *pTop = aRet.ImpGetTopPtr();
+ pTop->pParent = new DirEntry( *this );
+
+ return aRet;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::operator+=()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+DirEntry &DirEntry::operator+=( const DirEntry& rEntry )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ return *this = *this + rEntry;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetAccessDelimiter()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 27.05.93
+|* Letzte Aenderung MI 10.06.93
+|*
+*************************************************************************/
+
+String DirEntry::GetAccessDelimiter( FSysPathStyle eFormatter )
+{
+ return String( ACCESSDELIM_C( GetStyle( eFormatter ) ) );
+}
+
+/*************************************************************************
+|*
+|* DirEntry::SetExtension()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 02.08.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+void DirEntry::SetExtension( const String& rExtension, char cSep )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ // do not set extensions for drives
+ if(eFlag == FSYS_FLAG_ABSROOT)
+ {
+ nError = FSYS_ERR_NOTSUPPORTED;
+ return;
+ }
+
+ // cSep im Namen suchen
+ const char *p0 = ( aName.GetBuffer() );
+ const char *p1 = p0 + aName.Len() - 1;
+ while ( p1 >= p0 && *p1 != cSep )
+ p1--;
+ if ( p1 >= p0 )
+ {
+ // es wurde ein cSep an der Position p1 gefunden
+ aName.Erase( p1 - p0 + 1 - ( rExtension.Len() ? 0 : 1 ) );
+ aName += ByteString(rExtension, osl_getThreadTextEncoding());
+ }
+ else if ( rExtension.Len() )
+ {
+ // es wurde kein cSep gefunden
+ aName += cSep;
+ aName += ByteString(rExtension, osl_getThreadTextEncoding());
+ }
+}
+
+/*************************************************************************
+|*
+|* DirEntry::CutExtension()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 23.07.93
+|* Letzte Aenderung MI 23.07.93
+|*
+*************************************************************************/
+
+String DirEntry::CutExtension( char cSep )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ const char *p0 = ( aName.GetBuffer() );
+ const char *p1 = p0 + aName.Len() - 1;
+ while ( p1 >= p0 && *p1 != cSep )
+ p1--;
+
+ if ( p1 >= p0 )
+ {
+ // es wurde ein cSep an der Position p1 gefunden
+ aName.Erase( p1-p0 );
+ return String(p1 + 1, osl_getThreadTextEncoding());
+ }
+
+ return String();
+}
+
+/*************************************************************************
+|*
+|* DirEntry::SetName()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 04.09.93
+|* Letzte Aenderung MI 04.09.93
+|*
+*************************************************************************/
+
+void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ if ( eFormatter == FSYS_STYLE_HOST || eFormatter == FSYS_STYLE_DETECT )
+ eFormatter = DEFSTYLE;
+ ByteString aAccDelim( ACCESSDELIM_C( eFormatter ) );
+
+ if ( (eFlag != FSYS_FLAG_NORMAL) ||
+ (aName.Search( ':' ) != STRING_NOTFOUND) ||
+ (aName.Search( aAccDelim ) != STRING_NOTFOUND) ||
+ (eFormatter == FSYS_STYLE_FAT && (aName.GetTokenCount( '.' ) > 2) ) )
+ {
+ eFlag = FSYS_FLAG_INVALID;
+ }
+ else
+ {
+ aName = ByteString(rName, osl_getThreadTextEncoding());
+ }
+}
+
+/*************************************************************************
+|*
+|* DirEntry::Find()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+#if SUPD<=381
+BOOL DirEntry::Find( const String& rPfad )
+{
+ return Find( rPfad, SEARCHDELIM(DEFSTYLE)[0] );
+}
+#endif
+
+BOOL DirEntry::Find( const String& rPfad, char cDelim )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ if ( ImpGetTopPtr()->eFlag == FSYS_FLAG_ABSROOT )
+ return TRUE;
+
+ BOOL bWild = aName.Search( '*' ) != STRING_NOTFOUND ||
+ aName.Search( '?' ) != STRING_NOTFOUND;
+ if ( !cDelim )
+ cDelim = SEARCHDELIM(DEFSTYLE)[0];
+
+ USHORT nTokenCount = rPfad.GetTokenCount( cDelim );
+ USHORT nIndex = 0;
+#ifndef MAC
+ ByteString aThis = ACCESSDELIM(DEFSTYLE);
+ aThis += ByteString(GetFull(), osl_getThreadTextEncoding());
+#else
+ String aThis(GetFull(), osl_getThreadTextEncoding());
+#endif
+ for ( USHORT nToken = 0; nToken < nTokenCount; ++nToken )
+ {
+ ByteString aPath = ByteString(rPfad, osl_getThreadTextEncoding()).GetToken( 0, cDelim, nIndex );
+#ifdef MAC
+ if (aPath[aPath.Len()-1] == ':')
+ aPath.Cut(aPath.Len()-1);
+#endif
+ aPath += aThis;
+ DirEntry aEntry( String(aPath, osl_getThreadTextEncoding()));
+ if ( aEntry.ToAbs() &&
+ ( ( !bWild && aEntry.Exists() ) || ( bWild && aEntry.First() ) ) )
+ {
+ (*this) = aEntry;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpToRel()
+|*
+|* Beschreibung
+|* Ersterstellung MI 17.06.93
+|* Letzte Aenderung MI 17.06.93
+|*
+*************************************************************************/
+
+BOOL DirEntry::ImpToRel( String aCurStr )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry aThis(*this);
+ aThis.ToAbs();
+ ByteString aThisStr( aThis.GetFull( FSYS_STYLE_HPFS ), osl_getThreadTextEncoding());
+ ByteString bCurStr( aCurStr, osl_getThreadTextEncoding());
+ aThisStr = CMP_LOWER( aThisStr );
+ bCurStr = CMP_LOWER( bCurStr );
+
+ // "Ubereinstimmung pr"ufen
+ USHORT nPos = aThisStr.Match( bCurStr );
+ if ( nPos == STRING_MATCH && aThisStr.Len() != bCurStr.Len() )
+ nPos = Min( aThisStr.Len(), bCurStr.Len() );
+
+ // Sonderfall, die DirEntries sind identisch
+ if ( nPos == STRING_MATCH )
+ {
+ // dann ist der relative Pfad das aktuelle Verzeichnis
+ *this = DirEntry();
+ return TRUE;
+ }
+
+ // Sonderfall, die DirEntries sind total verschieden
+ if ( nPos == 0 )
+ {
+ // dann ist der relativste Pfad absolut
+ *this = aThis;
+ return FALSE;
+ }
+
+ // sonst nehmen wir die identischen Einzelteile vorne weg
+ while ( nPos > 0 && aThisStr.GetChar(nPos) != '\\' )
+ --nPos;
+ aThisStr.Erase( 0, nPos + ( ( aThisStr.GetChar(nPos) == '\\' ) ? 1 : 0 ) );
+ bCurStr.Erase( 0, nPos + ( ( bCurStr.GetChar(nPos) == '\\' ) ? 1 : 0 ) );
+
+ // und fuellen mit dem Level der Directories auf
+ for ( nPos = 0; nPos < bCurStr.Len(); ++nPos )
+ if ( bCurStr.GetChar(nPos) == '\\' )
+ aThisStr.Insert( "..\\", 0 );
+
+ // das ist dann unser relativer Pfad
+ *this = DirEntry( String(aThisStr, osl_getThreadTextEncoding()), FSYS_STYLE_HPFS );
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::CutRelParents()
+|*
+|* Beschreibung
+|* Ersterstellung MI 01.08.95
+|* Letzte Aenderung MI 01.08.95
+|*
+*************************************************************************/
+
+USHORT DirEntry::CutRelParents()
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ // erstes '..' finden
+ DirEntry *pDir = 0;
+ DirEntry *pPar;
+
+ for ( pPar = this;
+ pPar && pPar->eFlag != FSYS_FLAG_PARENT;
+ pPar = pPar->pParent )
+ pDir = pPar;
+
+ // '..' zaehlen
+ USHORT nParCount = 0;
+ while ( pPar && pPar->eFlag == FSYS_FLAG_PARENT )
+ {
+ ++nParCount;
+ pPar = pPar->pParent;
+ }
+
+ // cutten
+ if ( pDir )
+ DELETEZ(pDir->pParent);
+ else
+ eFlag = FSYS_FLAG_CURRENT;
+
+ return nParCount;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ToRel()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.06.93
+|* Letzte Aenderung MI 17.06.93
+|*
+*************************************************************************/
+
+BOOL DirEntry::ToRel()
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry aCur;
+ aCur.ToAbs();
+ return ImpToRel( aCur.GetFull( FSYS_STYLE_HPFS ) );
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ToRel()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+BOOL DirEntry::ToRel( const DirEntry& rStart )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry aStart( rStart );
+ aStart.ToAbs();
+ return ImpToRel( aStart.GetFull( FSYS_STYLE_HPFS ) );
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetDevice()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+#ifndef UNX
+
+DirEntry DirEntry::GetDevice() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ const DirEntry *pTop = ImpGetTopPtr();
+
+ if ( ( pTop->eFlag == FSYS_FLAG_ABSROOT || pTop->eFlag == FSYS_FLAG_RELROOT ) &&
+ pTop->aName.Len() )
+ return DirEntry( pTop->aName, FSYS_FLAG_VOLUME, FSYS_STYLE_HOST );
+ else
+ return DirEntry( ByteString(), FSYS_FLAG_INVALID, FSYS_STYLE_HOST );
+}
+
+#endif
+
+/*************************************************************************
+|*
+|* DirEntry::SetBase()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 23.10.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+void DirEntry::SetBase( const String& rBase, char cSep )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ const char *p0 = ( aName.GetBuffer() );
+ const char *p1 = p0 + aName.Len() - 1;
+ while ( p1 >= p0 && *p1 != cSep )
+ p1--;
+
+ if ( p1 >= p0 )
+ {
+ // es wurde ein cSep an der Position p1 gefunden
+ aName.Erase( 0, p1 - p0 );
+ aName.Insert( ByteString(rBase, osl_getThreadTextEncoding()), 0 );
+ }
+ else
+ aName = ByteString(rBase, osl_getThreadTextEncoding());
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetSearchDelimiter()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 10.06.93
+|* Letzte Aenderung MI 10.06.93
+|*
+*************************************************************************/
+
+String DirEntry::GetSearchDelimiter( FSysPathStyle eFormatter )
+{
+ return String( ByteString(SEARCHDELIM( GetStyle( eFormatter ) ) ), osl_getThreadTextEncoding());
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetMaxNameLen()
+|*
+|* Beschreibung Liefert die maximale Anzahl von Zeichen in
+|* einzelnen Namensteile. Bei FileSystmen mit
+|* fester Extension (FAT) zaehlt diese nicht mit.
+|* Bei unbekannten FileSytemen und FSYS_STYLE_URL
+|* wird USHRT_MAX zurueckgegeben.
+|* Ersterstellung MI 17.06.97
+|* Letzte Aenderung MI 17.06.97
+|*
+*************************************************************************/
+
+USHORT DirEntry::GetMaxNameLen( FSysPathStyle eFormatter )
+{
+ eFormatter = GetStyle( eFormatter );
+ switch ( eFormatter )
+ {
+ case FSYS_STYLE_MAC: return 31;
+
+ case FSYS_STYLE_FAT: return 8;
+
+ case FSYS_STYLE_VFAT:
+ case FSYS_STYLE_NTFS:
+ case FSYS_STYLE_NWFS:
+ case FSYS_STYLE_HPFS: return 255;
+
+
+ case FSYS_STYLE_SYSV: return 14;
+
+ case FSYS_STYLE_BSD: return 250;
+ }
+
+ return USHRT_MAX;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::TempName()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung VB 06.09.93 (im SWG)
+|* Letzte Aenderung MI 06.02.98
+|*
+*************************************************************************/
+
+DirEntry aTempNameBase_Impl;
+
+const DirEntry& DirEntry::SetTempNameBase( const String &rBase )
+{
+ DirEntry aTempDir = DirEntry().TempName().GetPath();
+ aTempDir += DirEntry( rBase );
+#ifdef UNX
+ ByteString aName( aTempDir.GetFull(), osl_getThreadTextEncoding());
+ if ( access( aName.GetBuffer(), W_OK | X_OK | R_OK ) )
+ {
+ aTempDir.MakeDir();
+ chmod( aName.GetBuffer(), S_IRWXU | S_IRWXG | S_IRWXO );
+ }
+#else
+ aTempDir.MakeDir();
+#endif
+ aTempNameBase_Impl = aTempDir.TempName( FSYS_KIND_DIR );
+ return aTempNameBase_Impl;
+}
+
+DirEntry DirEntry::TempName( DirEntryKind eKind ) const
+{
+ // ggf. Base-Temp-Dir verwenden (macht Remote keinen Sinn => vorher)
+ if ( !pParent && FSYS_FLAG_CURRENT != aTempNameBase_Impl.eFlag && FSYS_FLAG_ABSROOT != eFlag )
+
+ {
+ DirEntry aFactory( aTempNameBase_Impl );
+ aFactory += GetName();
+ return aFactory.TempName();
+ }
+
+#ifdef OS2
+ //
+ // resolves long FAT names used by OS2
+ //
+ if (Folder::IsAvailable() && IsLongNameOnFAT())
+ {
+ // in DirEntry mit kurzem Pfad wandeln
+ ItemIDPath aItemIDPath(GetFull());
+ String aString(aItemIDPath.GetHostNotationPath());
+ DirEntry aDirEntry(aString);
+
+ // Aufruf der Methode
+ return aDirEntry.TempName(eKind);
+ }
+#endif
+
+ ByteString aDirName; // hiermit hatte MPW C++ Probleme - immmer noch??
+ char *ret_val;
+ size_t i;
+
+ // dertermine Directory, Prefix and Extension
+ char pfx[6];
+ char ext[5];
+ const char *dir;
+ const char *pWild = strchr( aName.GetBuffer(), '*' );
+ if ( !pWild )
+ pWild = strchr( aName.GetBuffer(), '?' );
+
+ if ( pWild )
+ {
+ if ( pParent )
+ aDirName = ByteString(pParent->GetFull(), osl_getThreadTextEncoding());
+ strncpy( pfx, aName.GetBuffer(), Min( (int)5, (int)(pWild-aName.GetBuffer()) ) );
+ pfx[ pWild-aName.GetBuffer() ] = 0;
+ const char *pExt = strchr( pWild, '.' );
+ if ( pExt )
+ {
+ strncpy( ext, pExt, 4 );
+ ext[4] = 0;
+ }
+ else
+ strcpy( ext, ".tmp" );
+ }
+ else
+ {
+ aDirName = ByteString(GetFull(), osl_getThreadTextEncoding());
+ strcpy( pfx, "sv" );
+ strcpy( ext, ".tmp" );
+ }
+ dir = aDirName.GetBuffer();
+
+ // wurde kein Dir angegeben, dann nehmen wir ein passendes TEMP-Verz.
+ char sBuf[_MAX_PATH];
+ if ( eFlag == FSYS_FLAG_CURRENT || ( !pParent && pWild ) )
+ dir = TempDirImpl(sBuf);
+
+ // ab hier leicht modifizierter Code von VB
+ DirEntry aRet(FSYS_FLAG_INVALID);
+ i = strlen(dir);
+ // need to add ?\\? + prefix + number + .ext + '\0'
+ // please note that number is of length 5 not 3
+# define TMPNAME_SIZE ( 1 + 5 + 5 + 4 + 1 )
+ ret_val = new char[i + TMPNAME_SIZE ];
+ if (ret_val)
+ {
+ strcpy(ret_val,dir);
+
+ /* Make sure directory ends with a separator */
+#if defined(DOS) || defined(PM2) || defined(WIN) || defined(WNT)
+ if ( i>0 && ret_val[i-1] != '\\' && ret_val[i-1] != '/' &&
+ ret_val[i-1] != ':')
+ ret_val[i++] = '\\';
+#elif (UNX)
+ if (i>0 && ret_val[i-1] != '/')
+ ret_val[i++] = '/';
+#elif (MAC)
+ if (i>0 && ret_val[i-1] != ':')
+ ret_val[i++] = ':';
+#else
+#error unknown operating system
+#endif
+
+ strncpy(ret_val + i, pfx, 5);
+ ret_val[i + 5] = '\0'; /* strncpy doesn't put a 0 if more */
+ i = strlen(ret_val); /* than 'n' chars. */
+
+ /* Prefix can have 5 chars, leaving 3 for numbers.
+ 26 ** 3 == 17576
+ */
+#if (defined (MSC) || defined (BLC) || defined(ICC) ) && ( defined (WIN) || defined (WNT))
+ static unsigned long u = GetTickCount();
+#else
+ static unsigned long u = clock();
+#endif
+ for ( unsigned long nOld = u; ++u != nOld; )
+ {
+ u %= (26*26*26);
+ unsigned nTemp = (unsigned)u;
+#if defined(OS2) || defined(WIN) || defined(WNT) || defined(DOS)
+ itoa(nTemp,ret_val + i,26);
+#else
+ // the number needs length 5 not 3 !!!!
+ sprintf(ret_val+i, "%03u", nTemp);
+#endif
+ strcat(ret_val,ext);
+
+ if ( FSYS_KIND_FILE == eKind )
+ {
+ SvFileStream aStream( String( ret_val, osl_getThreadTextEncoding()),
+ STREAM_WRITE|STREAM_SHARE_DENYALL );
+ if ( aStream.IsOpen() )
+ {
+ aStream.Seek( STREAM_SEEK_TO_END );
+ if ( 0 == aStream.Tell() )
+ {
+ aRet = DirEntry( String( ret_val, osl_getThreadTextEncoding()));
+ break;
+ }
+ aStream.Close();
+ }
+ }
+ else
+ {
+ // Redirect
+ String aRetVal(ret_val, osl_getThreadTextEncoding());
+ String aRedirected (aRetVal);
+#ifndef BOOTSTRAP
+ FSysRedirector::DoRedirect( aRedirected );
+#endif
+ if ( FSYS_KIND_DIR == eKind )
+ {
+ if ( 0 == _mkdir( ByteString(aRedirected.GetBuffer(), osl_getThreadTextEncoding()).GetBuffer() ) )
+ {
+ aRet = DirEntry( aRetVal );
+ break;
+ }
+ }
+ else
+ {
+#if defined(MAC)
+ OSErr nErr;
+ FSSpec aFSSpec;
+ FInfo dummyFInfo;
+
+ nErr = FSMakeFSSpec( 0, 0, aRedirected.GetPascalStr(), &aFSSpec );
+ if (nErr == noErr)
+ nErr = FSpGetFInfo(&aFSSpec,&dummyFInfo);
+
+ if (nErr == fnfErr) // File Not Found, das ist was wir wollen ...
+ {
+ aRet = DirEntry( ret_val );
+ break;
+ }
+ else if( nErr != noErr )
+ {
+ DBG_ASSERT( nErr == noErr, "cannot generate TempName" )
+ // keine Chance mehr, etwas zu finden
+ break;
+ }
+#elif defined(PM2)
+#ifdef POWERPC
+ // !!!!! DosQueryPathInfo liefert dezeit (Beta2) immer OK !!!!!
+ APIRET nRet;
+ HFILE hFile = 0;
+ PM_ULONG lAction = 0;
+ nRet = DosOpen( (PSZ)ret_val, &hFile, &lAction, 0,
+ FILE_NORMAL, FILE_OPEN,
+ OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L );
+ if ( !nRet )
+ DosClose( hFile );
+ else
+ {
+ aRet = DirEntry( ret_val );
+ break;
+ }
+#else
+ APIRET nRet;
+ ULONG nCount = 1;
+ HDIR hDirHandle = HDIR_SYSTEM;
+ FILEFINDBUF3 aDirEnt;
+ nRet = DosFindFirst( (PSZ) aRedirected.GetBuffer(),
+ &hDirHandle, 23, (PVOID) &aDirEnt,
+ sizeof( FILEFINDBUF3 ),
+ &nCount, FIL_STANDARD );
+ if( nRet == ERROR_FILE_NOT_FOUND
+ || nRet == ERROR_NO_MORE_FILES )
+ {
+ aRet = DirEntry( String( ret_val ) );
+ break;
+ }
+ else if( nRet != NO_ERROR )
+ {
+ DBG_ASSERT( nRet == NO_ERROR, "cannot generate TempName" )
+ // keine Chance mehr, etwas zu finden
+ break;
+ }
+#endif
+#elif defined UNX
+ if( access( ByteString(aRedirected, osl_getThreadTextEncoding()).GetBuffer(), F_OK ) )
+ {
+ aRet = DirEntry( aRetVal );
+ break;
+ }
+#else
+ struct stat aStat;
+ if ( stat( ByteString(aRedirected, osl_getThreadTextEncoding()).GetBuffer(), &aStat ) )
+ {
+ aRet = DirEntry( aRetVal );
+ break;
+ }
+#endif
+ }
+ }
+ }
+
+ delete ret_val;
+ ret_val = 0;
+ }
+
+ return aRet;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::operator[]()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 03.03.92
+|* Letzte Aenderung MI 03.03.92
+|*
+*************************************************************************/
+
+const DirEntry &DirEntry::operator[]( USHORT nParentLevel ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ //TPF: maybe to be implemented (FastFSys)
+
+ const DirEntry *pRes = this;
+ while ( pRes && nParentLevel-- )
+ pRes = pRes->pParent;
+
+ return *pRes;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpParseUnixName()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 26.05.93
+|*
+*************************************************************************/
+
+FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eStyle )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ // die einzelnen Namen auf einen Stack packen
+ DirEntryStack aStack;
+ ByteString aPfad( rPfad );
+ do
+ {
+ // den Namen vor dem ersten "/" abspalten,
+ // falls '/' am Anfang, ist der Name '/',
+ // der Rest immer ohne die fuehrenden '/'.
+ // den ersten '/' suchen
+ USHORT nPos;
+ for ( nPos = 0;
+ nPos < aPfad.Len() && aPfad.GetChar(nPos) != '/';
+ nPos++ )
+ /* do nothing */;
+
+ // ist der Name die Root des aktuellen Drives?
+ if ( nPos == 0 && aPfad.Len() > 0 && ( aPfad.GetChar(0) == '/' ) )
+ {
+ // Root-Directory des aktuellen Drives
+ aStack.Push( new DirEntry( FSYS_FLAG_ABSROOT ) );
+ }
+ else
+ {
+ // den Namen ohne Trenner abspalten
+ aName = aPfad.Copy( 0, nPos );
+
+ // stellt der Name die aktuelle Directory dar?
+ if ( aName == "." )
+ /* do nothing */;
+
+#ifdef UNX
+ // stellt der Name das User-Dir dar?
+ else if ( aName == "~" )
+ {
+ DirEntry aHome( String( (const char *) getenv( "HOME" ), osl_getThreadTextEncoding()) );
+ for ( USHORT n = aHome.Level(); n; --n )
+ aStack.Push( new DirEntry( aHome[ (USHORT) n-1 ] ) );
+ }
+#endif
+
+ // stellt der Name die Parent-Directory dar?
+ else if ( aName == ".." )
+ {
+ // ist nichts, ein Parent oder eine relative Root
+ // auf dem Stack?
+ if ( ( aStack.Count() == 0 ) ||
+ ( aStack.Top()->eFlag == FSYS_FLAG_PARENT ) )
+ // fuehrende Parents kommen auf den Stack
+ aStack.Push( new DirEntry( ByteString(), FSYS_FLAG_PARENT, eStyle ) );
+
+ // ist es eine absolute Root
+ else if ( aStack.Top()->eFlag == FSYS_FLAG_ABSROOT ) {
+ // die hat keine Parent-Directory
+ return FSYS_ERR_NOTEXISTS;
+ }
+ else
+ // sonst hebt der Parent den TOS auf
+ delete aStack.Pop();
+ }
+ else
+ {
+ DirEntry *pNew = NULL;
+ // normalen Entries kommen auf den Stack
+ pNew = new DirEntry( aName, FSYS_FLAG_NORMAL, eStyle );
+ if ( !pNew->IsValid() )
+ {
+ aName = rPfad;
+ ErrCode eErr = pNew->GetError();
+ delete pNew;
+ return eErr;
+ }
+ aStack.Push( pNew );
+ }
+ }
+
+ // den Restpfad bestimmen
+ aPfad.Erase( 0, nPos + 1 );
+ while ( aPfad.Len() && ( aPfad.GetChar(0) == '/' ) )
+ aPfad.Erase( 0, 1 );
+ }
+ while ( aPfad.Len() );
+
+ // Haupt-Entry (selbst) zuweisen
+ if ( aStack.Count() == 0 )
+ {
+ eFlag = FSYS_FLAG_CURRENT;
+ aName.Erase();
+ }
+ else
+ {
+ eFlag = aStack.Top()->eFlag;
+ aName = aStack.Top()->aName;
+ delete aStack.Pop();
+ }
+
+ // die Parent-Entries vom Stack holen
+ DirEntry** pTemp = &pParent;
+ while ( aStack.Count() )
+ {
+ *pTemp = aStack.Pop();
+ pTemp = &( (*pTemp)->pParent );
+ }
+
+ return FSYS_ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ImpParseMacName()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MA 14.10.91
+|* Letzte Aenderung MI 26.05.93
+|*
+*************************************************************************/
+
+FSysError DirEntry::ImpParseMacName( const ByteString& rPfad )
+{
+#if 0
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntryStack aStack;
+ ByteString aPfad( rPfad );
+
+ //If the Path starts with an ABSROOT ( Volume ) it has to be
+ //pushed. So the Tail can be easier evaluated
+ if ( ( aPfad.Search( ':' ) != STRING_NOTFOUND ) && ( aPfad.GetChar(0) != ':' ) ) {
+ aStack.Push( new DirEntry( aPfad.Cut( 0, aPfad.Search( ':' ) ),
+ FSYS_FLAG_ABSROOT, FSYS_STYLE_MAC ) );
+ aPfad.Erase( 0, 1 );
+ }
+
+ //Purge Current-Directory
+ if ( aPfad(0) == ':' )
+ aPfad.Erase( 0, 1 );
+
+ //Evaluate the Tail
+ while ( aPfad.Len() ) {
+
+ if ( aPfad.GetChar(0) == ':' ) {
+ //PARENT detected
+ if ( aStack.Count() && (aStack.Top()->eFlag == FSYS_FLAG_ABSROOT) ) {
+ //an ABSROOT couldn't have a PARENT
+ return FSYS_ERR_NOTEXISTS;
+ }
+ else {
+ //Nothing or a Parent at the top?
+ if ( ( aStack.Count() == 0 ) ||
+ ( aStack.Top()->eFlag == FSYS_FLAG_PARENT ) ) {
+ //put leading Parents on the Top
+ aStack.Push( new DirEntry( FSYS_FLAG_PARENT ) );
+ aPfad.Erase( 0, 1 );
+ }
+ else {
+ delete aStack.Pop();
+ aPfad.Erase( 0, 1 );
+ }
+ }
+ }
+ else
+ {
+ // Normal entry detected
+ USHORT nSepPos = aPfad.Search( ':' );
+ if ( STRING_NOTFOUND == nSepPos )
+ nSepPos = USHRT_MAX;
+ DirEntry *pNew = new DirEntry( aPfad.Cut( 0, nSepPos ),
+ FSYS_FLAG_NORMAL, FSYS_STYLE_MAC );
+ if ( !pNew->IsValid() )
+ {
+ aName = rPfad;
+ ErrCode eErr = pNew->GetError();
+ delete pNew;
+ return eErr;
+ }
+ aStack.Push( pNew );
+ if ( STRING_NOTFOUND == nSepPos )
+ aPfad.Erase();
+ else
+ aPfad.Erase( 0, 1 );
+ }
+ }
+
+ //assign *this
+ if ( aStack.Count() == 0 ) {
+ eFlag = FSYS_FLAG_CURRENT;
+ aName.Erase();
+ }
+ else {
+ eFlag = aStack.Top()->eFlag;
+ aName = aStack.Top()->aName;
+ delete aStack.Pop();
+ }
+ //assign the Parent-Entries
+ DirEntry** pTemp = &pParent;
+ while ( aStack.Count() ) {
+ *pTemp = aStack.Pop();
+ pTemp = &( (*pTemp)->pParent );
+ }
+#endif
+ return FSYS_ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::MakeShortName()
+|*
+|* Beschreibung
+|* Ersterstellung TLX
+|* Letzte Aenderung PB 21.08.97 (in CreateEntry_Impl())
+|*
+*************************************************************************/
+
+ErrCode CreateEntry_Impl( const DirEntry &rPath, DirEntryKind eKind )
+{
+ // versuchen, anzulegen (ausser bei FSYS_KIND_ALL)
+ ErrCode eErr = ERRCODE_NONE;
+ if ( FSYS_KIND_FILE == eKind )
+ {
+ SvFileStream aStream( rPath.GetFull(), STREAM_STD_WRITE );
+ aStream.WriteLine( "" );
+ eErr = aStream.GetError();
+ }
+ else if ( FSYS_KIND_ALL != eKind )
+ eErr = rPath.MakeDir() ? ERRCODE_NONE : ERRCODE_IO_UNKNOWN;
+
+ // erfolgreich?
+ if ( !rPath.Exists() )
+ eErr = ERRCODE_IO_UNKNOWN; // Doch was schiefgegangen ?
+
+ // ggf. wieder l"oschen
+ if ( FSYS_KIND_NONE == eKind )
+ rPath.Kill();
+
+ // Fehlercode zur?ckliefern
+ return eErr;
+}
+
+BOOL IsValidEntry_Impl( const DirEntry &rPath,
+ const String &rLongName,
+ DirEntryKind eKind,
+ BOOL bIsShortened,
+ BOOL bUseDelim )
+{
+ // Parameter-Pr"uefung
+ DBG_ASSERT( eKind == FSYS_KIND_NONE || eKind == FSYS_KIND_ALL ||
+ eKind == FSYS_KIND_FILE || eKind == FSYS_KIND_DIR,
+ "invalid entry-kind" );
+
+ // Alle von MSDOS erreichbaren FSYS_STYLES muessen den
+ // MSDOS Filenamenanforderungen genuegen. Sonst wird probiert,
+ // ob sich eine Datei des gewuenschten Names anlegen laesst.
+ FSysPathStyle eStyle = DirEntry::GetPathStyle( rPath.GetDevice().GetName() );
+ DirEntry aPath(rPath);
+ DirEntry aName(rLongName, eStyle);
+ if ( !aName.IsValid() || aName.Level() != 1 )
+ return FALSE;
+ aPath += aName;
+ if ( 1 == aPath.Level() )
+ return FALSE;
+ if ( eStyle == FSYS_STYLE_FAT || eStyle == FSYS_STYLE_NWFS ||
+ eStyle == FSYS_STYLE_UNKNOWN )
+ {
+ DirEntry aDosEntry( rLongName, FSYS_STYLE_FAT );
+ if ( !aDosEntry.IsValid() )
+ return FALSE;
+ }
+
+ // Pfad-Trenner sind nicht erlaubt (bei ungek"urzten auch nicht FSYS_SHORTNAME_DELIMITER)
+ char cDelim = bUseDelim == 2 ? FSYS_SHORTNAME_DELIMITER : char(0);
+ if ( rLongName.Search( DirEntry::GetAccessDelimiter() ) != STRING_NOTFOUND ||
+ !bIsShortened && rLongName.Search(cDelim) != STRING_NOTFOUND )
+ return FALSE;
+
+ // MI: Abfrage nach 'CON:' etc. wird jetzt in Exists() mitgemacht
+ if ( aPath.Exists() )
+ return FALSE;
+
+ return (ERRCODE_NONE == CreateEntry_Impl( aPath, eKind ));
+}
+
+//-------------------------------------------------------------------------
+
+#define MAX_EXT_FAT 3
+#define MAX_LEN_FAT 8
+#define INVALID_CHARS_FAT "\\/\"':|^<>[]?* "
+
+#define MAX_EXT_MAC 16 // nur wegen sinnvoller Namensk"rzung
+#define MAX_LEN_MAC 31
+#define INVALID_CHARS_MAC "\":"
+
+#define MAX_EXT_MAX 250
+#define MAX_LEN_MAX 255
+#define INVALID_CHARS_DEF "\\/\"':|^<>?*"
+
+BOOL DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind,
+ BOOL bUseDelim, FSysPathStyle eStyle )
+{
+ String aLongName(rLongName);
+
+ // Alle '#' aus den Dateinamen entfernen, weil das INetURLObject
+ // damit Probleme hat. Siehe auch #51246#
+ aLongName.EraseAllChars( '#' );
+ ByteString bLongName(aLongName, osl_getThreadTextEncoding());
+
+ // Auf Novell-Servern (wegen der rottigen Clients) nur 7bit ASCII
+
+ // HRO: #69627# Weg mit dem Scheiss. Wenn es Client gibt, die so einen
+ // BUG haben, dann muss halt der Client ersetzt werden, aber doch nicht das
+ // Office kastrieren !!!
+
+#if 0
+ if ( FSYS_STYLE_NWFS == GetPathStyle( ImpGetTopPtr()->GetName() ) )
+ {
+ for ( USHORT n = aLongName.Len(); n; --n )
+ {
+ short nChar = aLongName(n-1);
+ if ( nChar < 32 || nChar >= 127 )
+ aLongName.Erase( n-1, 1 );
+ }
+ }
+#endif
+
+ // bei FSYS_KIND_ALL den alten Namen merken und abh"angen (rename)
+ ByteString aOldName;
+ if ( FSYS_KIND_ALL == eKind )
+ {
+ aOldName = ByteString(CutName(), osl_getThreadTextEncoding());
+ aOldName = CMP_LOWER(aOldName);
+ }
+
+ // ist der Langname direkt verwendbar?
+ if ( IsValidEntry_Impl( *this, aLongName, eKind, FALSE, bUseDelim ) )
+ {
+ operator+=( DirEntry(aLongName) );
+ return TRUE;
+ }
+
+ // max L"angen feststellen
+ USHORT nMaxExt, nMaxLen;
+ if ( FSYS_STYLE_DETECT == eStyle )
+ eStyle = DirEntry::GetPathStyle( GetDevice().GetName() );
+ ByteString aInvalidChars;
+ switch ( eStyle )
+ {
+ case FSYS_STYLE_FAT:
+ nMaxExt = MAX_EXT_FAT;
+ nMaxLen = MAX_LEN_FAT;
+ aInvalidChars = INVALID_CHARS_FAT;
+ break;
+
+ case FSYS_STYLE_MAC:
+ nMaxExt = MAX_EXT_MAC;
+ nMaxLen = MAX_LEN_MAC;
+ aInvalidChars = INVALID_CHARS_MAC;
+ break;
+
+ default:
+ nMaxExt = MAX_EXT_MAX;
+ nMaxLen = MAX_LEN_MAX;
+ aInvalidChars = INVALID_CHARS_DEF;
+ }
+
+ // Extension abschneiden und kuerzen
+ ByteString aExt;
+ ByteString aFName = bLongName;
+#if defined(MAC)
+ if ( TRUE )
+#else
+ if ( FSYS_STYLE_MAC != eStyle )
+#endif
+ {
+ DirEntry aUnparsed;
+ aUnparsed.aName = bLongName;
+ aExt = ByteString(aUnparsed.CutExtension(), osl_getThreadTextEncoding());
+ aFName = aUnparsed.aName;
+ if ( aExt.Len() > nMaxExt )
+ {
+ char c = aExt.GetChar( aExt.Len() - 1 );
+ aExt.Erase(nMaxExt-1);
+ aExt += c;
+ }
+ }
+
+ if ( FSYS_STYLE_FAT != eStyle )
+ {
+ // ausser auf einem FAT-System geh"ort die Extension zur
+ // Maxl"ange. Muss also vorher mit dem Punkt abgezogen werden.
+ nMaxLen -= ( aExt.Len() + 1 );
+ }
+
+ // Name k"urzen
+ ByteString aSName;
+ for ( const char *pc = aFName.GetBuffer(); aSName.Len() < nMaxLen && *pc; ++pc )
+ {
+ if ( STRING_NOTFOUND == aInvalidChars.Search( *pc ) &&
+ (unsigned char) *pc >= (unsigned char) 32 &&
+ ( !aSName.Len() || *pc != ' ' || aSName.GetChar(aSName.Len()-1) != ' ' ) )
+ aSName += *pc;
+ }
+ aSName.EraseTrailingChars();
+
+ // HRO: #74246# Also cut leading spaces
+ aSName.EraseLeadingChars();
+
+ if ( !aSName.Len() )
+ aSName = "noname";
+
+ // kommt dabei der alte Name raus?
+ ByteString aNewName = aSName;
+ if ( aExt.Len() )
+ ( aNewName += '.' ) += aExt;
+ operator+=( DirEntry(String(aNewName, osl_getThreadTextEncoding())) );
+ if ( FSYS_KIND_ALL == eKind && CMP_LOWER(aName) == aOldName )
+ if ( FSYS_KIND_ALL == eKind && CMP_LOWER(ByteString(GetName(), osl_getThreadTextEncoding())) == aOldName )
+ return TRUE;
+
+ // kann der gek"urzte Name direkt verwendet werden?
+ if ( !Exists() && (ERRCODE_NONE == CreateEntry_Impl( *this, eKind )) )
+ return TRUE;
+
+ // darf '?##' verwendet werden, um eindeutigen Name zu erzeugen?
+ if ( bUseDelim )
+ {
+ // eindeutigen Namen per '?##' erzeugen
+ aSName.Erase( nMaxLen-3 );
+ if ( bUseDelim != 2 )
+ aSName += FSYS_SHORTNAME_DELIMITER;
+ for ( int n = 1; n < 99; ++n )
+ {
+ // Name zusammensetzen
+ ByteString aTmpStr( aSName );
+ aTmpStr += n;
+ if ( aExt.Len() )
+ ( aTmpStr += '.' ) += aExt;
+
+ // noch nicht vorhanden?
+ SetName( String(aTmpStr, osl_getThreadTextEncoding()) );
+
+ if ( !Exists() )
+ {
+ // Fehler setzen !!!
+ nError = CreateEntry_Impl( *this, eKind );
+ return (ERRCODE_NONE == nError);
+ }
+ }
+ }
+
+ // keine ## mehr frei / ?## soll nicht verwendet werden
+ nError = ERRCODE_IO_ALREADYEXISTS;
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::CreatePath()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+BOOL DirEntry::MakeDir( BOOL bSloppy ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ // Schnellpruefung, ob vorhanden
+ if ( FileStat( *this ).IsKind( FSYS_KIND_DIR ) )
+ return TRUE;
+ if ( bSloppy && pParent )
+ if ( FileStat( *pParent ).IsKind( FSYS_KIND_DIR ) )
+ return TRUE;
+
+ const DirEntry *pNewDir = bSloppy ? pParent : this;
+ if ( pNewDir )
+ {
+ // den Path zum Dir erzeugen
+ if ( pNewDir->pParent && !pNewDir->pParent->MakeDir(FALSE) )
+ return FALSE;
+
+ // das Dir selbst erzeugen
+ if ( pNewDir->eFlag == FSYS_FLAG_ABSROOT ||
+ pNewDir->eFlag == FSYS_FLAG_ABSROOT ||
+ pNewDir->eFlag == FSYS_FLAG_VOLUME )
+ return TRUE;
+ else
+ {
+ //? nError = ???
+ if ( FileStat( *pNewDir ).IsKind( FSYS_KIND_DIR ) )
+ return TRUE;
+ else
+ {
+ FSysFailOnErrorImpl();
+ String aDirName(pNewDir->GetFull());
+#ifndef BOOTSTRAP
+ FSysRedirector::DoRedirect( aDirName );
+#endif
+ ByteString bDirName( aDirName, osl_getThreadTextEncoding() );
+ bDirName = GUI2FSYS( bDirName );
+
+#ifdef WIN32
+ SetLastError(0);
+#endif
+ BOOL bResult = (0 == _mkdir( (char*) bDirName.GetBuffer() ));
+ if ( !bResult )
+ {
+ // Wer hat diese Methode const gemacht ?
+#ifdef WIN32
+ ((DirEntry *)this)->SetError( Sys2SolarError_Impl( GetLastError() ) );
+#else
+ ((DirEntry *)this)->SetError( Sys2SolarError_Impl( errno ) );
+#endif
+ }
+
+ return bResult;
+ }
+ }
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::CopyTo()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 07.08.96
+|*
+*************************************************************************/
+
+FSysError DirEntry::CopyTo( const DirEntry& rDest, FSysAction nActions ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ if ( FSYS_ACTION_COPYFILE != (nActions & FSYS_ACTION_COPYFILE) )
+#ifdef UNX
+ {
+ // Hardlink anlegen
+ HACK(redirection missing)
+ ByteString aThis(GUI2FSYS(GetFull()), osl_getThreadTextEncoding());
+ ByteString aDest(GUI2FSYS(rDest.GetFull()), osl_getThreadTextEncoding());
+ link( aThis.GetBuffer(), aDest.GetBuffer() );
+ return Sys2SolarError_Impl( errno );
+ }
+#else
+ return FSYS_ERR_NOTSUPPORTED;
+#endif
+
+ return FileCopier( *this, rDest ).Execute(nActions);
+}
+
+/*************************************************************************
+|*
+|* DirEntry::MoveTo()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung HRO 24.03.99
+|*
+*************************************************************************/
+
+#if defined(WNT) || defined(DOS) || defined(WIN) || defined(UNX)
+
+FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+/*
+ FileStat aSourceStat(*this);
+ if ( !aSourceStat.IsKind(FSYS_KIND_FILE) )
+ return FSYS_ERR_NOTAFILE;
+*/
+
+ DirEntry aDest(rNewName);
+ FileStat aDestStat(rNewName);
+ if ( aDestStat.IsKind(FSYS_KIND_DIR ) )
+ {
+ aDest += String(aName, osl_getThreadTextEncoding());
+ }
+ if ( aDest.Exists() )
+ {
+ return FSYS_ERR_ALREADYEXISTS;
+ }
+
+#ifdef WIN
+ if ( FileStat(*this).IsKind(FSYS_KIND_DIR) && aDest.GetPath() != GetPath() )
+ {
+ return FSYS_ERR_NOTSUPPORTED;
+ }
+#endif
+
+ FSysFailOnErrorImpl();
+ String aFrom( GetFull() );
+
+#ifndef BOOTSTRAP
+ FSysRedirector::DoRedirect(aFrom);
+#endif
+
+ String aTo( aDest.GetFull() );
+
+#ifndef BOOTSTRAP
+ FSysRedirector::DoRedirect(aTo);
+#endif
+
+ ByteString bFrom(aFrom, osl_getThreadTextEncoding());
+ ByteString bTo(aTo, osl_getThreadTextEncoding());
+ bFrom = GUI2FSYS(bFrom);
+ bTo = GUI2FSYS(bTo);
+
+#ifdef WNT
+ // MoveTo nun atomar
+ SetLastError(0);
+
+ DirEntry aFromDevice(String(bFrom, osl_getThreadTextEncoding()));
+ DirEntry aToDevice(String(bTo,osl_getThreadTextEncoding()));
+ aFromDevice.ToAbs();
+ aToDevice.ToAbs();
+ aFromDevice=aFromDevice.GetDevice();
+ aToDevice=aToDevice.GetDevice();
+
+ //Quelle und Ziel auf gleichem device?
+ if (aFromDevice==aToDevice)
+ {
+ // ja, also intra-device-move mit MoveFile
+ MoveFile( bFrom.GetBuffer(), bTo.GetBuffer() );
+ // MoveFile ist buggy bei cross-device operationen.
+ // Der R?ckgabewert ist auch dann TRUE, wenn nur ein Teil der Operation geklappt hat.
+ // Zudem zeigt MoveFile unterschiedliches Verhalten bei unterschiedlichen NT-Versionen.
+ return Sys2SolarError_Impl( GetLastError() );
+ }
+ else
+ {
+ //nein, also inter-device-move mit copy/delete
+ FSysError nCopyError = CopyTo(rNewName, FSYS_ACTION_COPYFILE);
+
+ DirEntry aKill(String(bTo, osl_getThreadTextEncoding()));
+ FileStat aKillStat(String(bTo, osl_getThreadTextEncoding()));
+ if ( aKillStat.IsKind(FSYS_KIND_DIR ) )
+ {
+ aKill += String(aName, osl_getThreadTextEncoding());
+ }
+
+ if (nCopyError==FSYS_ERR_OK)
+ {
+ if (Kill()==FSYS_ERR_OK)
+ {
+ return FSYS_ERR_OK;
+ }
+ else
+ {
+ aKill.Kill();
+ return FSYS_ERR_ACCESSDENIED;
+ }
+ }
+ else
+ {
+ aKill.Kill();
+ return nCopyError;
+ }
+ }
+#else
+ // #68639#
+ // on some nfs connections rename with from == to
+ // leads to destruction of file
+ if ( ( aFrom != aTo ) && ( 0 != rename( bFrom.GetBuffer(), bTo.GetBuffer() ) ) )
+#ifndef UNX
+#ifdef WIN
+ { // einfaches umbenennen ist fehlgeschlagen, kopieren versuchen
+ FILE *fpIN = fopen(aFrom.GetBuffer(), "rb");
+ if (!fpIN) return Sys2SolarError_Impl(ENOENT); // Quelle kann nicht zum Lesen geoeffnet werden
+ FILE *fpOUT = fopen(aTo, "wb");
+ if (!fpOUT)
+ {
+ fclose(fpIN);
+ return Sys2SolarError_Impl(EACCES); // Ziel kann nicht zum Schreiben geoeffnet werden
+ }
+
+ char pBuf[16384];
+ int nRead, nWrite, nError = 0;
+ while((nRead = fread(pBuf, 1, 16384, fpIN)) && (!nError))
+ {
+ nWrite = fwrite(pBuf, 1, nRead, fpOUT);
+ if (nWrite != nRead) nError = ENOSPC;
+ }
+ fclose( fpIN );
+ fclose( fpOUT );
+ return Sys2SolarError_Impl(nError);
+ }
+#else
+ return Sys2SolarError_Impl( GetLastError() );
+#endif
+#else
+ {
+ if( errno == EXDEV )
+// cross device geht latuernich nicht mit rename
+ {
+ FILE *fpIN = fopen( bFrom.GetBuffer(), "r" );
+ FILE *fpOUT = fopen( bTo.GetBuffer(), "w" );
+ if( fpIN && fpOUT )
+ {
+ char pBuf[ 16384 ];
+ int nBytes, nWritten, nError = 0;
+ errno = 0;
+ while( ( nBytes = fread( pBuf, 1, sizeof(pBuf), fpIN ) ) && ! nError )
+ {
+ nWritten = fwrite( pBuf, 1, nBytes, fpOUT );
+ // Fehler im fwrite ?
+ if( nWritten < nBytes )
+ {
+ nError = errno;
+ break;
+ }
+ }
+ fclose( fpIN );
+ fclose( fpOUT );
+ if ( nError )
+ {
+ unlink( bTo.GetBuffer() );
+ return Sys2SolarError_Impl( nError );
+ }
+ else
+ {
+ unlink( bFrom.GetBuffer() );
+ }
+ }
+ else
+ {
+ return Sys2SolarError_Impl( EXDEV );
+ }
+ }
+ else
+ {
+ return Sys2SolarError_Impl( errno );
+ }
+ }
+#endif
+#endif
+ return ERRCODE_NONE;
+}
+
+#endif
+
+/*************************************************************************
+|*
+|* DirEntry::Kill()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 07.08.96
+|*
+*************************************************************************/
+
+FSysError DirEntry::Kill( FSysAction nActions ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ FSysError eError = FSYS_ERR_OK;
+ FSysFailOnErrorImpl();
+
+ // Name als doppelt 0-terminierter String
+ String aTmpName( GetFull() );
+#ifndef BOOTSTRAP
+ FSysRedirector::DoRedirect( aTmpName );
+#endif
+ ByteString bTmpName( aTmpName, osl_getThreadTextEncoding());
+ bTmpName = GUI2FSYS(bTmpName);
+
+ char *pName = new char[bTmpName.Len()+2];
+ strcpy( pName, bTmpName.GetBuffer() );
+ pName[bTmpName.Len()+1] = (char) 0;
+
+ //read-only files sollen auch geloescht werden koennen
+ BOOL isReadOnly = FileStat::GetReadOnlyFlag(*this);
+ if (isReadOnly)
+ {
+ FileStat::SetReadOnlyFlag(*this, FALSE);
+ }
+
+ // directory?
+ if ( FileStat( *this ).IsKind(FSYS_KIND_DIR) )
+ {
+ // Inhalte recursiv loeschen?
+ if ( FSYS_ACTION_RECURSIVE == (nActions & FSYS_ACTION_RECURSIVE) )
+ {
+ Dir aDir( *this, FSYS_KIND_DIR|FSYS_KIND_FILE );
+ for ( USHORT n = 0; eError == FSYS_ERR_OK && n < aDir.Count(); ++n )
+ {
+ const DirEntry &rSubDir = aDir[n];
+ DirEntryFlag eFlag = rSubDir.GetFlag();
+ if ( eFlag != FSYS_FLAG_CURRENT && eFlag != FSYS_FLAG_PARENT )
+ eError = rSubDir.Kill(nActions);
+ }
+ }
+
+ // das Dir selbst loeschen
+#ifdef WIN32
+ SetLastError(0);
+#endif
+ if ( eError == FSYS_ERR_OK && 0 != _rmdir( (char*) pName ) )
+ //
+ {
+ // falls L"oschen nicht ging, CWD umsetzen
+#ifdef WIN32
+ eError = Sys2SolarError_Impl( GetLastError() );
+#else
+ eError = Sys2SolarError_Impl( errno );
+#endif
+ if ( eError )
+ {
+ GetPath().SetCWD();
+#ifdef WIN32
+ SetLastError(0);
+#endif
+ if (_rmdir( (char*) pName) != 0)
+ {
+#ifdef WIN32
+ eError = Sys2SolarError_Impl( GetLastError() );
+#else
+ eError = Sys2SolarError_Impl( errno );
+#endif
+ }
+ else
+ {
+ eError = FSYS_ERR_OK;
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( FSYS_ACTION_USERECYCLEBIN == (nActions & FSYS_ACTION_USERECYCLEBIN) )
+ {
+#ifdef OS2
+ eError = ApiRet2ToSolarError_Impl( DosDelete( (char*) pName ) );
+#else
+#ifdef WNT
+ SHFILEOPSTRUCT aOp;
+ aOp.hwnd = 0;
+ aOp.wFunc = FO_DELETE;
+ aOp.pFrom = pName;
+ aOp.pTo = 0;
+ aOp.fFlags = FOF_ALLOWUNDO|FOF_SILENT|FOF_NOCONFIRMATION;
+ aOp.hNameMappings = 0;
+ aOp.lpszProgressTitle = 0;
+ eError = Sys2SolarError_Impl( SHFileOperation( &aOp ) );
+#else
+ eError = ERRCODE_IO_NOTSUPPORTED;
+#endif
+#endif
+ }
+ else
+ {
+#ifdef OS2
+ eError = ApiRet2ToSolarError_Impl( DosForceDelete( (PSZ) pName ) );
+#else
+#ifdef WIN32
+ SetLastError(0);
+#endif
+ if ( 0 != _unlink( (char*) pName ) )
+ {
+#ifdef WIN32
+ eError = Sys2SolarError_Impl( GetLastError() );
+#else
+ eError = Sys2SolarError_Impl( errno );
+#endif
+ }
+ else
+ {
+ eError = ERRCODE_NONE;
+ }
+#endif
+ }
+ }
+
+ //falls Fehler, originales read-only flag wieder herstellen
+ if ( isReadOnly && (eError!=ERRCODE_NONE) )
+ {
+ FileStat::SetReadOnlyFlag(*this, isReadOnly);
+ }
+
+ delete pName;
+ return eError;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::Contains()
+|*
+|* Beschreibung ob rSubEntry direkt oder indirect in *this liegt
+|* Ersterstellung MI 20.03.97
+|* Letzte Aenderung MI 20.03.97
+|*
+*************************************************************************/
+
+BOOL DirEntry::Contains( const DirEntry &rSubEntry ) const
+{
+ DBG_ASSERT( IsAbs() && rSubEntry.IsAbs(), "must be absolute entries" );
+
+ USHORT nThisLevel = Level();
+ USHORT nSubLevel = rSubEntry.Level();
+ if ( nThisLevel < nSubLevel )
+ {
+ for ( ; nThisLevel; --nThisLevel, --nSubLevel )
+ if ( (*this)[nThisLevel-1] != rSubEntry[nSubLevel-1] )
+ return FALSE;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::Level()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 03.03.92
+|* Letzte Aenderung MI 03.03.92
+|*
+*************************************************************************/
+
+USHORT DirEntry::Level() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ USHORT nLevel = 0;
+ const DirEntry *pRes = this;
+ while ( pRes )
+ {
+ pRes = pRes->pParent;
+ nLevel++;
+ }
+
+ return nLevel;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ConvertNameToSystem()
+|*
+|* Beschreibung
+|* Ersterstellung DV 29.03.96
+|* Letzte Aenderung DV 29.03.96
+|*
+*************************************************************************/
+
+String DirEntry::ConvertNameToSystem( const String &rName )
+{
+#ifdef MAC
+ return ImpConvertNameToSystem( rName );
+#else
+ return rName;
+#endif
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ConvertSystemToName()
+|*
+|* Beschreibung
+|* Ersterstellung DV 29.03.96
+|* Letzte Aenderung DV 29.03.96
+|*
+*************************************************************************/
+
+String DirEntry::ConvertSystemToName( const String &rName )
+{
+#ifdef MAC
+ return ImpConvertSystemToName( rName );
+#else
+ return rName;
+#endif
+}
+
+/*************************************************************************
+|*
+|* DirEntry::IsValid()
+|*
+|* Beschreibung
+|* Ersterstellung MI 18.09.93
+|* Letzte Aenderung TPF 18.09.98
+|*
+*************************************************************************/
+
+BOOL DirEntry::IsValid() const
+{
+ return (nError == FSYS_ERR_OK);
+}
+
+/*************************************************************************
+|*
+|* DirEntry::IsRFSAvailable()
+|*
+|* Beschreibung
+|* Ersterstellung TPF 21.10.98
+|* Letzte Aenderung TPF 21.10.98
+|*
+*************************************************************************/
+
+BOOL DirEntry::IsRFSAvailable()
+{
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* IsLongNameOnFAT()
+|*
+|* Beschreibung ?berpr?ft , ob das DirEntry einen langen
+|* Filenamen auf einer FAT-Partition enth?lt (EAs).
+|* (eigentlich nur f?r OS2 interessant)
+|* Ersterstellung TPF 02.10.98
+|* Letzte Aenderung TPF 01.03.1999
+|*
+*************************************************************************/
+
+BOOL DirEntry::IsLongNameOnFAT() const
+{
+ // FAT-System?
+ DirEntry aTempDirEntry(*this);
+ aTempDirEntry.ToAbs();
+ if (DirEntry::GetPathStyle(aTempDirEntry.GetDevice().GetName().GetChar(0)) != FSYS_STYLE_FAT)
+ {
+ return FALSE; // nein, also false
+ }
+
+ // DirEntry-Kette auf lange Dateinamen pr?fen
+ for( int iLevel = this->Level(); iLevel > 0; iLevel-- )
+ {
+ const DirEntry& rEntry = (const DirEntry&) (*this)[iLevel-1];
+ String aBase( rEntry.GetBase() );
+ String aExtension( rEntry.GetExtension() );
+
+ if (aBase.Len()>8) // Name > 8?
+ {
+ return TRUE;
+ }
+
+ if (aExtension.Len()>3) // Extension > 3?
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+//========================================================================
+
+#if defined(DBG_UTIL)
+
+void FSysTest()
+{
+}
+
+#endif
+
diff --git a/tools/source/fsys/filecopy.cxx b/tools/source/fsys/filecopy.cxx
new file mode 100644
index 000000000000..6be1822f8991
--- /dev/null
+++ b/tools/source/fsys/filecopy.cxx
@@ -0,0 +1,578 @@
+/*************************************************************************
+ *
+ * $RCSfile: filecopy.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if defined(WIN) || defined(WNT)
+#ifndef _SVWIN_H
+#include <io.h>
+#include <svwin.h>
+#endif
+
+#elif defined(PM2) || defined(DOS)
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <share.h>
+#include <io.h>
+
+#elif defined UNX
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#elif defined MAC
+#include <mac_start.h>
+#include <fcntl.h>
+#include <mac_end.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef PM2
+#include <stdio.h>
+#endif
+
+#ifndef _COMDEP_HXX
+#include "comdep.hxx"
+#endif
+
+#ifndef _FSYS_HXX
+#include "fsys.hxx"
+#endif
+
+#ifndef _STREAM_HXX
+#ifdef UNX
+#define private public
+#endif
+#include "stream.hxx"
+#endif
+
+EA_Copier* EA_Copier::_pCopier = NULL;
+
+//========================================================================
+
+EA_Copier::~EA_Copier()
+{
+}
+
+//------------------------------------------------------------------------
+void EA_Copier::Register( EA_Copier* pCopier )
+{
+ _pCopier = pCopier;
+}
+
+//------------------------------------------------------------------------
+
+EA_Copier* EA_Copier::Get()
+{
+ return _pCopier;
+}
+
+/*************************************************************************
+|*
+|* FileCopier::FileCopier()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 13.04.94
+|* Letzte Aenderung MI 13.04.94
+|*
+*************************************************************************/
+
+FileCopier::FileCopier() :
+
+ nBlockSize ( 4096 ),
+ nBytesTotal ( 0 ),
+ nBytesCopied( 0 ),
+ pImp ( new FileCopier_Impl )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+FileCopier::FileCopier( const DirEntry& rSource, const DirEntry& rTarget ) :
+
+ aSource ( rSource ),
+ aTarget ( rTarget ),
+ nBlockSize ( 4096 ),
+ nBytesTotal ( 0 ),
+ nBytesCopied( 0 ),
+ pImp ( new FileCopier_Impl )
+
+{
+}
+
+// -----------------------------------------------------------------------
+
+FileCopier::FileCopier( const FileCopier& rCopier ) :
+
+ aSource ( rCopier.aSource ),
+ aTarget ( rCopier.aTarget ),
+ nBlockSize ( 4096 ),
+ nBytesTotal ( 0 ),
+ nBytesCopied ( 0 ),
+ aProgressLink ( rCopier.aProgressLink ),
+ pImp ( new FileCopier_Impl )
+
+{
+}
+
+/*************************************************************************
+|*
+|* FileCopier::~FileCopier()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 13.04.94
+|* Letzte Aenderung MI 13.04.94
+|*
+*************************************************************************/
+
+FileCopier::~FileCopier()
+{
+ delete pImp;
+}
+
+/*************************************************************************
+|*
+|* FileCopier::operator =()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 13.04.94
+|* Letzte Aenderung MI 13.04.94
+|*
+*************************************************************************/
+
+FileCopier& FileCopier::operator = ( const FileCopier &rCopier )
+{
+ aSource = rCopier.aSource;
+ aTarget = rCopier.aTarget;
+ nBytesTotal = rCopier.nBytesTotal;
+ nBytesCopied = rCopier.nBytesCopied;
+ nBytesCopied = rCopier.nBytesCopied;
+ nBlockSize = rCopier.nBlockSize;
+ aProgressLink = rCopier.aProgressLink;
+ *pImp = *(rCopier.pImp);
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* FileCopier::Progress()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 13.04.94
+|* Letzte Aenderung MI 13.04.94
+|*
+*************************************************************************/
+
+BOOL FileCopier::Progress()
+{
+ if ( !aProgressLink )
+ return TRUE;
+ else
+ {
+ if ( aProgressLink.Call( this ) )
+ return TRUE;
+ return ( 0 == Error( ERRCODE_ABORT, 0, 0 ) );
+ }
+}
+
+//---------------------------------------------------------------------------
+
+ErrCode FileCopier::Error( ErrCode eErr, const DirEntry* pSource, const DirEntry* pTarget )
+{
+ // kein Fehler oder kein ErrorHandler?
+ if ( !eErr || !pImp->aErrorLink )
+ // => Error beibehalten
+ return eErr;
+
+ // sonst gesetzten ErrorHandler fragen
+ pImp->pErrSource = pSource;
+ pImp->pErrTarget = pTarget;
+ pImp->eErr = eErr;
+ ErrCode eRet = (ErrCode) pImp->aErrorLink.Call( this );
+ pImp->pErrSource = 0;
+ pImp->pErrTarget = 0;
+ return eRet;
+}
+
+//---------------------------------------------------------------------------
+
+const DirEntry* FileCopier::GetErrorSource() const
+{
+ return pImp->pErrSource;
+}
+
+//---------------------------------------------------------------------------
+
+const DirEntry* FileCopier::GetErrorTarget() const
+{
+ return pImp->pErrTarget;
+}
+
+//---------------------------------------------------------------------------
+
+ErrCode FileCopier::GetError() const
+{
+ return pImp->eErr;
+}
+
+//---------------------------------------------------------------------------
+
+void FileCopier::SetErrorHdl( const Link &rLink )
+{
+ pImp->aErrorLink = rLink;
+}
+
+//---------------------------------------------------------------------------
+
+const Link& FileCopier::GetErrorHdl() const
+{
+ return pImp->aErrorLink ;
+}
+
+/*************************************************************************
+|*
+|* FileCopier::Execute()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 13.04.94
+|* Letzte Aenderung PB 16.06.00
+|*
+*************************************************************************/
+
+#ifndef MAC
+
+#ifdef OS2
+BOOL createLongNameEA ( const PCSZ pszPath, ULONG ulAttributes, const String& aLongName );
+#endif
+
+FSysError FileCopier::DoCopy_Impl( const DirEntry &rSource, const DirEntry &rTarget,
+ BOOL bTop )
+{
+ FSysError eRet = FSYS_ERR_OK;
+ ErrCode eWarn = FSYS_ERR_OK;
+
+ // HPFS->FAT?
+ FSysPathStyle eSourceStyle = DirEntry::GetPathStyle( rSource.ImpGetTopPtr()->GetName() );
+ FSysPathStyle eTargetStyle = DirEntry::GetPathStyle( rTarget.ImpGetTopPtr()->GetName() );
+ BOOL bMakeShortNames = ( eSourceStyle == FSYS_STYLE_HPFS && eTargetStyle == FSYS_STYLE_FAT );
+
+ // Zieldateiname ggf. kuerzen
+ DirEntry aTarget;
+ if ( bMakeShortNames )
+ {
+ aTarget = rTarget.GetPath();
+ aTarget.MakeShortName( rTarget.GetName() );
+ }
+ else
+ aTarget = rTarget;
+
+ // kein Move wenn Namen gekuerzt werden muessten
+ if ( bMakeShortNames && FSYS_ACTION_MOVE == ( pImp->nActions & FSYS_ACTION_MOVE ) && aTarget != rTarget )
+ return ERRCODE_IO_NAMETOOLONG;
+
+ // source is directory?
+ FileStat aSourceFileStat( rSource );
+ if ( aSourceFileStat.IsKind( FSYS_KIND_DIR ) )
+ {
+#ifdef OS2
+ CHAR szSource[CCHMAXPATHCOMP];
+ HOBJECT hSourceObject;
+
+ strcpy(szSource, rSource.GetFull().GetStr());
+ hSourceObject = WinQueryObject(szSource);
+
+ if ( hSourceObject )
+ {
+ PSZ pszSourceName;
+ PSZ pszTargetName;
+ CHAR szTarget[CCHMAXPATHCOMP];
+ HOBJECT hTargetObject;
+ HOBJECT hReturn = NULLHANDLE;
+
+ strcpy(szTarget, rTarget.GetFull().GetStr());
+ pszTargetName = strrchr(szTarget, '\\');
+ pszSourceName = strrchr(szSource, '\\');
+
+ hTargetObject = WinQueryObject(szTarget);
+
+ if ( hTargetObject )
+ WinDestroyObject(hTargetObject);
+
+ if ( pszTargetName && pszSourceName )
+ {
+ *pszTargetName = '\0';
+ pszSourceName++;
+ pszTargetName++;
+
+ if(strcmp(pszSourceName, pszTargetName) == 0)
+ {
+ hTargetObject = WinQueryObject(szTarget);
+
+ if(pImp->nActions & FSYS_ACTION_MOVE)
+ {
+ hReturn = WinMoveObject(hSourceObject, hTargetObject, 0);
+ }
+ else
+ {
+ hReturn = WinCopyObject(hSourceObject, hTargetObject, 0);
+ }
+ if ( bMakeShortNames && aTarget.Exists() )
+ aTarget.Kill();
+ return hReturn ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN;
+ }
+ }
+ }
+#endif
+ // recursive copy
+ eRet = Error( aTarget.MakeDir() ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN, 0, &aTarget );
+ Dir aSourceDir( rSource, FSYS_KIND_DIR|FSYS_KIND_FILE );
+ for ( USHORT n = 0; ERRCODE_TOERROR(eRet) == FSYS_ERR_OK && n < aSourceDir.Count(); ++n )
+ {
+ const DirEntry &rSubSource = aSourceDir[n];
+ DirEntryFlag eFlag = rSubSource.GetFlag();
+ if ( eFlag != FSYS_FLAG_CURRENT && eFlag != FSYS_FLAG_PARENT )
+ {
+ DirEntry aSubTarget( aTarget );
+ aSubTarget += rSubSource.GetName();
+ eRet = DoCopy_Impl( rSubSource, aSubTarget, FALSE );
+ if ( eRet && !eWarn )
+ eWarn = eRet;
+ }
+ }
+ }
+ else if ( aSourceFileStat.IsKind(FSYS_KIND_FILE) )
+ {
+ if ( ( FSYS_ACTION_KEEP_EXISTING == ( pImp->nActions & FSYS_ACTION_KEEP_EXISTING ) ) &&
+ aTarget.Exists() )
+ {
+ // Do not overwrite existing file in target folder.
+ return ERRCODE_NONE;
+ }
+
+ // copy file
+ nBytesCopied = 0;
+ nBytesTotal = FileStat( rSource ).GetSize();
+
+ String aFileName( GUI2FSYS( rSource.GetFull() ).GetBuffer() );
+ SvFileStream aSource( aFileName, STREAM_READ|STREAM_NOCREATE|STREAM_SHARE_DENYNONE );
+
+ if ( !aSource.GetError() )
+ {
+#ifdef UNX
+ struct stat buf;
+ if ( fstat( aSource.GetFileHandle(), &buf ) == -1 )
+ eRet = Error( FSYS_ERR_ACCESSDENIED, 0, &aTarget );
+#endif
+ SvFileStream aTargetStream( GUI2FSYS( aTarget.GetFull() ),
+ STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYWRITE );
+ if ( !aTargetStream.GetError() )
+ {
+#ifdef UNX
+ if ( fchmod( aTargetStream.GetFileHandle(), buf.st_mode ) == -1 )
+ eRet = Error( FSYS_ERR_ACCESSDENIED, 0, &aTarget );
+#endif
+ size_t nAllocSize = 0, nSize = 0;
+ char *pBuf = 0;
+ while ( Progress() && nSize == nAllocSize && eRet == FSYS_ERR_OK )
+ {
+ // adjust the block-size
+ if ( nBlockSize > nAllocSize )
+ {
+ delete pBuf;
+ nAllocSize = nBlockSize;
+ pBuf = new char[nAllocSize];
+ }
+
+ // copy one block
+ nSize = aSource.Read( pBuf, nBlockSize );
+ aTargetStream.Write( pBuf, nSize );
+ if ( aTargetStream.GetError() )
+ eRet = Error( aTargetStream.GetError(), 0, &aTarget );
+
+ // adjust counters
+ nBytesCopied += nSize;
+ if ( nBytesCopied > nBytesTotal )
+ nBytesTotal = nBytesCopied;
+ }
+ delete pBuf;
+ }
+ else
+ eRet = Error( aTargetStream.GetError(), 0, &aTarget );
+
+ // ggf. EAs kopieren
+ if ( !eRet && EA_Copier::Get() && !EA_Copier::Get()->Copy( aSource, aTargetStream ) )
+ eRet = FSYS_ERR_UNKNOWN | ERRCODE_WARNING_MASK;
+
+ // unvollstaendiges File wieder loeschen
+ aTargetStream.Close();
+
+ if ( nBytesCopied != nBytesTotal )
+ {
+ aTarget.Kill();
+ }
+#ifdef OS2
+ else
+ {
+ // falls die Source-Target-Filenamen nicht gleich sind und der Target-Filename nicht
+ // 8.3 aber auf FAT ist, dann mu? das EA .longname korrekt gesetzt werden (TPF)
+ // (rSource.GetName()!=rTarget.GetName())
+
+ if ( rTarget.IsLongNameOnFAT() && Folder::IsAvailable() )
+ {
+ createLongNameEA( (const char*)aTargetStream.GetFileName(),
+ FILE_NORMAL, rTarget.GetName() );
+ }
+ }
+#endif
+ }
+ else
+ eRet = Error( aSource.GetError(), &rSource, 0 );
+ }
+ else if ( aSourceFileStat.IsKind(FSYS_KIND_NONE) )
+ eRet = Error( ERRCODE_IO_NOTEXISTS, &rSource, 0 );
+ else
+ eRet = Error( ERRCODE_IO_NOTSUPPORTED, &rSource, 0 );
+
+#ifdef WNT
+ // Set LastWriteTime and Attributes of the target identical with the source
+
+ if ( FSYS_ERR_OK == ERRCODE_TOERROR(eRet) )
+ {
+ WIN32_FIND_DATA fdSource;
+ ByteString aFullSource(aSource.GetFull(), osl_getThreadTextEncoding());
+ ByteString aFullTarget(aTarget.GetFull(), osl_getThreadTextEncoding());
+ HANDLE hFind = FindFirstFile( aFullSource.GetBuffer() , &fdSource );
+ if ( hFind != INVALID_HANDLE_VALUE )
+ {
+ FindClose( hFind );
+
+ HANDLE hFile = CreateFile( aFullTarget.GetBuffer(), GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
+
+ if ( hFile != INVALID_HANDLE_VALUE )
+ {
+ SetFileTime( hFile, NULL, NULL, &fdSource.ftLastWriteTime );
+ CloseHandle( hFile );
+ }
+
+ SetFileAttributes( aFullTarget.GetBuffer(), fdSource.dwFileAttributes );
+ }
+ }
+#endif
+ // bei Move ggf. das File/Dir loeschen
+ if ( FSYS_ERR_OK == ERRCODE_TOERROR(eRet) && ( pImp->nActions & FSYS_ACTION_MOVE ) )
+ {
+ ErrCode eKillErr = Error( rSource.Kill() | ERRCODE_WARNING_MASK, &rSource, 0 );
+ if ( eKillErr != ERRCODE_WARNING_MASK )
+ {
+ if ( rSource.Exists() )
+ // loeschen ging nicht => dann die Kopie wieder loeschen
+ aTarget.Kill( pImp->nActions );
+ if ( !eWarn )
+ eWarn = eKillErr;
+ }
+ }
+
+ return !eRet ? eWarn : eRet;
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+FSysError FileCopier::Execute( FSysAction nActions )
+{
+ return ExecuteExact( nActions );
+}
+
+// -----------------------------------------------------------------------
+
+FSysError FileCopier::ExecuteExact( FSysAction nActions, FSysExact eExact )
+{
+ DirEntry aAbsSource = DirEntry( aSource);
+ DirEntry aAbsTarget = DirEntry( aTarget );
+ pImp->nActions = nActions;
+
+ // check if both pathes are accessible and source and target are different
+ if ( !aAbsTarget.ToAbs() || !aAbsSource.ToAbs() || aAbsTarget == aAbsSource )
+ return FSYS_ERR_ACCESSDENIED;
+
+ // check if copy would be endless recursive into itself
+ if ( FSYS_ACTION_RECURSIVE == ( nActions & FSYS_ACTION_RECURSIVE ) &&
+ aAbsSource.Contains( aAbsTarget ) )
+ return ERRCODE_IO_RECURSIVE;
+
+ // target is directory?
+ if ( eExact == FSYS_NOTEXACT &&
+ FileStat( aAbsTarget ).IsKind(FSYS_KIND_DIR) && FileStat( aAbsSource ).IsKind(FSYS_KIND_FILE) )
+ // append name of source
+ aAbsTarget += aSource.GetName();
+
+ // recursive copy
+ return DoCopy_Impl( aAbsSource, aAbsTarget, TRUE );
+}
+
+
diff --git a/tools/source/fsys/fstat.cxx b/tools/source/fsys/fstat.cxx
new file mode 100644
index 000000000000..bbde14c83208
--- /dev/null
+++ b/tools/source/fsys/fstat.cxx
@@ -0,0 +1,516 @@
+/*************************************************************************
+ *
+ * $RCSfile: fstat.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if defined( WIN)
+#include <stdio.h>
+#include <dos.h>
+#endif
+
+#ifdef UNX
+#include <errno.h>
+#endif
+
+#include <limits.h>
+#include <string.h>
+
+#include "comdep.hxx"
+#include <fsys.hxx>
+
+/*************************************************************************
+|*
+|* FileStat::FileStat()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 11.06.91
+|* Letzte Aenderung MI 11.06.91
+|*
+*************************************************************************/
+
+FileStat::FileStat()
+: // don't use Default-Ctors!
+ aDateCreated( ULONG(0) ),
+ aTimeCreated( ULONG(0) ),
+ aDateModified( ULONG(0) ),
+ aTimeModified( ULONG(0) ),
+ aDateAccessed( ULONG(0) ),
+ aTimeAccessed( ULONG(0) )
+{
+ nSize = 0;
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ nError = FSYS_ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* FileStat::FileStat()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 11.06.91
+|* Letzte Aenderung MI 11.06.91
+|*
+*************************************************************************/
+
+FileStat::FileStat( const DirEntry& rDirEntry, FSysAccess nAccess )
+: // don't use Default-Ctors!
+ aDateCreated( ULONG(0) ),
+ aTimeCreated( ULONG(0) ),
+ aDateModified( ULONG(0) ),
+ aTimeModified( ULONG(0) ),
+ aDateAccessed( ULONG(0) ),
+ aTimeAccessed( ULONG(0) )
+{
+ BOOL bCached = FSYS_ACCESS_CACHED == (nAccess & FSYS_ACCESS_CACHED);
+ BOOL bFloppy = FSYS_ACCESS_FLOPPY == (nAccess & FSYS_ACCESS_FLOPPY);
+
+#ifdef FEAT_FSYS_DOUBLESPEED
+ const FileStat *pStatFromDir = bCached ? rDirEntry.ImpGetStat() : 0;
+ if ( pStatFromDir )
+ {
+ nError = pStatFromDir->nError;
+ nKindFlags = pStatFromDir->nKindFlags;
+ nSize = pStatFromDir->nSize;
+ aCreator = pStatFromDir->aCreator;
+ aType = pStatFromDir->aType;
+ aDateCreated = pStatFromDir->aDateCreated;
+ aTimeCreated = pStatFromDir->aTimeCreated;
+ aDateModified = pStatFromDir->aDateModified;
+ aTimeModified = pStatFromDir->aTimeModified;
+ aDateAccessed = pStatFromDir->aDateAccessed;
+ aTimeAccessed = pStatFromDir->aTimeAccessed;
+ }
+ else
+#endif
+ Update( rDirEntry, bFloppy );
+}
+
+/*************************************************************************
+|*
+|* FileStat::IsYounger()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MA 11.11.91
+|* Letzte Aenderung MA 11.11.91
+|*
+*************************************************************************/
+
+// TRUE wenn die Instanz j"unger als rIsOlder ist.
+// FALSE wenn die Instanz "alter oder gleich alt wie rIsOlder ist.
+
+BOOL FileStat::IsYounger( const FileStat& rIsOlder ) const
+{
+ if ( aDateModified > rIsOlder.aDateModified )
+ return TRUE;
+ if ( ( aDateModified == rIsOlder.aDateModified ) &&
+ ( aTimeModified > rIsOlder.aTimeModified ) )
+ return TRUE;
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* FileStat::IsKind()
+|*
+|* Ersterstellung MA 11.11.91 (?)
+|* Letzte Aenderung KH 16.01.95
+|*
+*************************************************************************/
+
+BOOL FileStat::IsKind( DirEntryKind nKind ) const
+{
+ BOOL bRet = ( ( nKind == FSYS_KIND_UNKNOWN ) &&
+ ( nKindFlags == FSYS_KIND_UNKNOWN ) ) ||
+ ( ( nKindFlags & nKind ) == nKind );
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* FileStat::HasReadOnlyFlag()
+|*
+|* Ersterstellung MI 06.03.97
+|* Letzte Aenderung UT 01.07.98
+|*
+*************************************************************************/
+
+BOOL FileStat::HasReadOnlyFlag()
+{
+#if defined(WNT) || defined(OS2) || defined(UNX)
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+/*************************************************************************
+|*
+|* FileStat::GetReadOnlyFlag()
+|*
+|* Ersterstellung MI 06.03.97
+|* Letzte Aenderung UT 02.07.98
+|*
+*************************************************************************/
+
+BOOL FileStat::GetReadOnlyFlag( const DirEntry &rEntry )
+{
+
+ ByteString aFPath(rEntry.GetFull(), osl_getThreadTextEncoding());
+#ifdef WNT
+ DWORD nRes = GetFileAttributes( (LPCTSTR) aFPath.GetBuffer() );
+ return ULONG_MAX != nRes &&
+ ( FILE_ATTRIBUTE_READONLY & nRes ) == FILE_ATTRIBUTE_READONLY;
+#endif
+
+#ifdef OS2
+ FILESTATUS3 aFileStat;
+ APIRET nRet = DosQueryPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat) );
+ switch ( nRet )
+ {
+ case NO_ERROR:
+ return FILE_READONLY == ( aFileStat.attrFile & FILE_READONLY );
+
+ case ERROR_SHARING_VIOLATION:
+ return ERRCODE_IO_LOCKVIOLATION;
+
+ default:
+ return ERRCODE_IO_NOTEXISTS;
+ }
+#endif
+
+#ifdef UNX
+ /* could we stat the object? */
+ struct stat aBuf;
+ if (stat(aFPath.GetBuffer(), &aBuf))
+ return FALSE;
+ /* jupp, is writable for user? */
+ return((aBuf.st_mode & S_IWUSR) != S_IWUSR);
+#endif
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* FileStat::SetReadOnlyFlag()
+|*
+|* Ersterstellung MI 06.03.97
+|* Letzte Aenderung UT 01.07.98
+|*
+*************************************************************************/
+
+ULONG FileStat::SetReadOnlyFlag( const DirEntry &rEntry, BOOL bRO )
+{
+
+ ByteString aFPath(rEntry.GetFull(), osl_getThreadTextEncoding());
+
+#ifdef WNT
+ DWORD nRes = GetFileAttributes( (LPCTSTR) aFPath.GetBuffer() );
+ if ( ULONG_MAX != nRes )
+ nRes = SetFileAttributes( (LPCTSTR) aFPath.GetBuffer(),
+ ( nRes & ~FILE_ATTRIBUTE_READONLY ) |
+ ( bRO ? FILE_ATTRIBUTE_READONLY : 0 ) );
+ return ( ULONG_MAX == nRes ) ? ERRCODE_IO_UNKNOWN : 0;
+#endif
+
+#ifdef OS2
+ FILESTATUS3 aFileStat;
+ APIRET nRet = DosQueryPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat) );
+ if ( !nRet )
+ {
+ aFileStat.attrFile = ( aFileStat.attrFile & ~FILE_READONLY ) |
+ ( bRO ? FILE_READONLY : 0 );
+ nRet = DosSetPathInfo( (PSZ)aFPath.GetBuffer(), 1, &aFileStat, sizeof(aFileStat), 0 );
+ }
+ switch ( nRet )
+ {
+ case NO_ERROR:
+ return ERRCODE_NONE;
+
+ case ERROR_SHARING_VIOLATION:
+ return ERRCODE_IO_LOCKVIOLATION;
+
+ default:
+ return ERRCODE_IO_NOTEXISTS;
+ }
+#endif
+
+#ifdef UNX
+ /* first, stat the object to get permissions */
+ struct stat aBuf;
+ if (stat(aFPath.GetBuffer(), &aBuf))
+ return ERRCODE_IO_NOTEXISTS;
+ /* set or clear write bit for user */
+ mode_t nMode;
+ if (bRO)
+ {
+ nMode = aBuf.st_mode & ~S_IWUSR;
+ nMode = aBuf.st_mode & ~S_IWGRP;
+ nMode = aBuf.st_mode & ~S_IWOTH;
+ }
+ else
+ nMode = aBuf.st_mode | S_IWUSR;
+ /* change it on fs */
+ if (chmod(aFPath.GetBuffer(), nMode))
+ {
+ switch (errno)
+ {
+ case EPERM :
+ case EROFS :
+ return ERRCODE_IO_ACCESSDENIED;
+ default :
+ return ERRCODE_IO_NOTEXISTS;
+ }
+ }
+ else
+ return ERRCODE_NONE;
+#endif
+ return ERRCODE_IO_NOTSUPPORTED;
+}
+
+/*************************************************************************
+|*
+|* FileStat::SetDateTime
+|*
+|* Ersterstellung PB 27.06.97
+|* Letzte Aenderung
+|*
+*************************************************************************/
+#if defined(WIN) | defined(WNT) | defined(OS2)
+
+void FileStat::SetDateTime( const String& rFileName,
+ const DateTime& rNewDateTime )
+{
+ ByteString aFileName(rFileName, osl_getThreadTextEncoding());
+
+ Date aNewDate = rNewDateTime;
+ Time aNewTime = rNewDateTime;
+#if defined(WIN)
+ unsigned date = 0;
+ unsigned time = 0;
+
+ date = (unsigned) aNewDate.GetDay();
+ date |= (unsigned)(aNewDate.GetMonth() << 5);
+ date |= (unsigned)((aNewDate.GetYear() - 1980) << 9);
+ time = (unsigned)(aNewTime.GetSec() / 2);
+ time |= (unsigned)(aNewTime.GetMin() << 5);
+ time |= (unsigned)(aNewTime.GetHour() << 11);
+
+
+ FILE* pFile = fopen( aFileName.GetBuffer(), "a" );
+
+ if ( pFile != NULL )
+ {
+ _dos_setftime( fileno(pFile), date, time );
+ fclose( pFile );
+ }
+
+#elif defined( WNT )
+
+ TIME_ZONE_INFORMATION aTZI;
+ DWORD dwTZI = GetTimeZoneInformation( &aTZI );
+
+ if ( dwTZI != (DWORD)-1 && dwTZI != TIME_ZONE_ID_UNKNOWN )
+ {
+ // 1. Korrektur der Zeitzone
+ short nDiff = (short)aTZI.Bias;
+ Time aOldTime = aNewTime; // alte Zeit merken
+
+ // 2. evt. Korrektur Sommer-/Winterzeit
+ if ( dwTZI == TIME_ZONE_ID_DAYLIGHT )
+ nDiff += (short)aTZI.DaylightBias;
+
+ Time aDiff( abs( nDiff / 60 /*Min -> Std*/ ), 0 );
+
+ if ( nDiff > 0 )
+ {
+ aNewTime += aDiff; // Stundenkorrektur
+
+ // bei "Uberlauf korrigieren
+ if ( aNewTime >= Time( 24, 0 ) )
+ aNewTime -= Time( 24, 0 );
+
+ // Tages"uberlauf?
+ if ( aOldTime == Time( 0, 0 ) || // 00:00 -> 01:00
+ aNewTime < aOldTime ) // 23:00 -> 00:00 | 01:00 ...
+ aNewDate++;
+ }
+ else if ( nDiff < 0 )
+ {
+ aNewTime -= aDiff; // Stundenkorrektur
+
+ // negative Zeit (-1:00) korrigieren: 23:00
+ if (aNewTime < Time( 0, 0 ) )
+ aNewTime += Time( 24, 0 );
+
+ // Tagesunterlauf ?
+ if ( aOldTime == Time( 0, 0 ) || // 00:00 -> 23:00
+ aNewTime > aOldTime ) // 01:00 -> 23:00 | 22:00 ...
+ aNewDate--;
+ }
+ }
+
+
+ SYSTEMTIME aTime;
+ aTime.wYear = aNewDate.GetYear();
+ aTime.wMonth = aNewDate.GetMonth();
+ aTime.wDayOfWeek = 0;
+ aTime.wDay = aNewDate.GetDay();
+ aTime.wHour = aNewTime.GetHour();
+ aTime.wMinute = aNewTime.GetMin();
+ aTime.wSecond = aNewTime.GetSec();
+ aTime.wMilliseconds = 0;
+ FILETIME aFileTime;
+ SystemTimeToFileTime( &aTime, &aFileTime );
+
+ HANDLE hFile = CreateFile( aFileName.GetBuffer(), GENERIC_WRITE, 0, 0,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
+
+ if ( hFile != INVALID_HANDLE_VALUE )
+ {
+ SetFileTime( hFile, &aFileTime, &aFileTime, &aFileTime );
+ CloseHandle( hFile );
+ }
+
+#endif
+#ifdef OS2
+ // open file
+ ULONG nAction = FILE_EXISTED;
+ HFILE hFile = 0;
+ ULONG nFlags = OPEN_FLAGS_WRITE_THROUGH |
+ OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NO_CACHE |
+ OPEN_FLAGS_RANDOM | OPEN_FLAGS_NOINHERIT |
+ OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE;
+
+ APIRET nRet = DosOpen((PSZ)aFileName.GetBuffer(), &hFile, (PULONG)&nAction,
+ 0/*size*/, FILE_NORMAL,
+ OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
+ nFlags, 0/*ea*/);
+
+ if ( nRet == 0 )
+ {
+ FILESTATUS3 FileInfoBuffer;
+
+ nRet = DosQueryFileInfo(
+ hFile, 1, &FileInfoBuffer, sizeof(FileInfoBuffer));
+
+ if ( nRet == 0 )
+ {
+ FDATE aNewDate;
+ FTIME aNewTime;
+
+ // create date and time words
+ aNewDate.day = rNewDateTime.GetDay();
+ aNewDate.month = rNewDateTime.GetMonth();
+ aNewDate.year = rNewDateTime.GetYear() - 1980;
+ aNewTime.twosecs = rNewDateTime.GetSec() / 2;
+ aNewTime.minutes = rNewDateTime.GetMin();
+ aNewTime.hours = rNewDateTime.GetHour();
+
+ // set file date and time
+ FileInfoBuffer.fdateCreation = aNewDate;
+ FileInfoBuffer.ftimeCreation = aNewTime;
+ FileInfoBuffer.fdateLastAccess = aNewDate;
+ FileInfoBuffer.ftimeLastAccess = aNewTime;
+ FileInfoBuffer.fdateLastWrite = aNewDate;
+ FileInfoBuffer.ftimeLastWrite = aNewTime;
+
+ DosSetFileInfo(hFile, 1, &FileInfoBuffer, sizeof(FileInfoBuffer));
+ }
+ DosClose(hFile);
+ }
+#endif
+}
+
+#endif
+/*
+FileStatMembers *FileStat::GetAllMembers()
+{
+ FileStatMembers *members = new FileStatMembers;
+ members->nError = nError;
+ members->nKindFlags = nKindFlags;
+ members->nSize = nSize;
+ members->aCreator = aCreator;
+ members->aType = aType;
+ members->aDateCreated = aDateCreated.GetDate();
+ members->aTimeCreated = aTimeCreated.GetTime();
+ members->aDateAccessed = aDateAccessed.GetDate();
+ members->aTimeAccessed = aTimeAccessed.GetTime();
+ members->aDateModified = aDateModified.GetDate();
+ members->aTimeModified = aTimeModified.GetTime();
+ return members;
+}
+
+void FileStat::InitMembers(FileStatMembers *members)
+{
+ nError = members->nError;
+ members->nKindFlags = nKindFlags;
+ members->nSize = nSize;
+ members->aCreator = aCreator;
+ members->aType = aType;
+ aDateCreated.SetDate(members->aDateCreated);
+ aTimeCreated.SetTime(members->aTimeCreated);
+ aDateAccessed.SetDate(members->aDateAccessed);
+ aTimeAccessed.SetTime(members->aTimeAccessed);
+ aDateModified.SetDate(members->aDateModified);
+ aTimeModified.SetTime(members->aTimeModified);
+}
+*/
+
+
diff --git a/tools/source/fsys/makefile.mk b/tools/source/fsys/makefile.mk
new file mode 100644
index 000000000000..432ad2a1d8c4
--- /dev/null
+++ b/tools/source/fsys/makefile.mk
@@ -0,0 +1,98 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=fsys
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/tempfile.obj \
+ $(SLO)$/wldcrd.obj \
+ $(SLO)$/fstat.obj \
+ $(SLO)$/comdep.obj \
+ $(SLO)$/filecopy.obj \
+ $(SLO)$/dirent.obj \
+ $(SLO)$/tdir.obj \
+ $(SLO)$/urlobj.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/wldcrd.obj \
+ $(OBJ)$/fstat.obj \
+ $(OBJ)$/comdep.obj \
+ $(OBJ)$/filecopy.obj \
+ $(OBJ)$/dirent.obj \
+ $(OBJ)$/tdir.obj \
+ $(OBJ)$/urlobj.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/fsys/os2.cxx b/tools/source/fsys/os2.cxx
new file mode 100644
index 000000000000..f65956b7926e
--- /dev/null
+++ b/tools/source/fsys/os2.cxx
@@ -0,0 +1,1153 @@
+/*************************************************************************
+ *
+ * $RCSfile: os2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define INCL_DOSEXCEPTIONS
+
+#ifdef __BORLANDC__
+#include <alloc.h>
+#else
+#include <malloc.h>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _LIST_HXX
+#include <list.hxx>
+#endif
+#ifndef _BIGINT_HXX
+#include <bigint.hxx>
+#endif
+#ifndef _FSYS_HXX
+#include <fsys.hxx>
+#endif
+#include "comdep.hxx"
+
+#ifdef OS2
+#ifndef _VOS_MUTEX_HXX //autogen
+#include <vos/mutex.hxx>
+#endif
+#endif
+
+int Sys2SolarError_Impl( int nSysErr );
+
+DECLARE_LIST( DirEntryList, DirEntry* );
+DECLARE_LIST( FSysSortList, FSysSort* );
+DECLARE_LIST( FileStatList, FileStat* );
+
+static char sCaseMap[256];
+static BOOL bCaseMap = FALSE;
+static BOOL bDriveMap = FALSE;
+
+struct DriveMapItem
+{
+ DirEntryKind nKind;
+ char cName;
+ FSysPathStyle nStyle;
+};
+
+void CreateCaseMapImpl();
+void CreateDriveMapImpl();
+
+static DriveMapItem aDriveMap[26];
+
+static String sLastCaseSensitiveDir = "";
+static BOOL bLastCaseSensitive = FALSE;
+
+//====================================================================
+
+int ApiRet2ToSolarError_Impl( int nApiRet )
+{
+ switch ( nApiRet )
+ {
+ case NO_ERROR: return ERRCODE_NONE;
+ case ERROR_FILE_NOT_FOUND: return ERRCODE_IO_NOTEXISTS;
+ case ERROR_PATH_NOT_FOUND: return ERRCODE_IO_NOTEXISTSPATH;
+ case ERROR_TOO_MANY_OPEN_FILES: return ERRCODE_IO_TOOMANYOPENFILES;
+ case ERROR_ACCESS_DENIED: return ERRCODE_IO_ACCESSDENIED;
+ case ERROR_NOT_ENOUGH_MEMORY: return ERRCODE_IO_OUTOFMEMORY;
+ case ERROR_BAD_FORMAT: return ERRCODE_IO_WRONGFORMAT;
+ case ERROR_NOT_SAME_DEVICE: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_WRITE_PROTECT: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_BAD_UNIT: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_CRC: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_NOT_DOS_DISK: return ERRCODE_IO_INVALIDDEVICE;
+ case ERROR_WRITE_FAULT: return ERRCODE_IO_CANTWRITE;
+ case ERROR_READ_FAULT: return ERRCODE_IO_CANTREAD;
+ case ERROR_SHARING_VIOLATION: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_LOCK_VIOLATION: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_WRONG_DISK: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_HANDLE_DISK_FULL: return ERRCODE_IO_OUTOFSPACE;
+ case ERROR_NOT_SUPPORTED: return ERRCODE_IO_NOTSUPPORTED;
+ case ERROR_DUP_NAME: return ERRCODE_IO_ALREADYEXISTS;
+ case ERROR_BAD_NETPATH: return ERRCODE_IO_NOTEXISTSPATH;
+ case ERROR_DEV_NOT_EXIST: return ERRCODE_IO_NOTEXISTS;
+ case ERROR_NETWORK_ACCESS_DENIED: return ERRCODE_IO_ACCESSDENIED;
+ case ERROR_INVALID_PARAMETER: return ERRCODE_IO_INVALIDPARAMETER;
+ case ERROR_NET_WRITE_FAULT: return ERRCODE_IO_CANTWRITE;
+ case ERROR_DEVICE_IN_USE: return ERRCODE_IO_INVALIDPARAMETER;
+ case ERROR_DISK_FULL: return ERRCODE_IO_OUTOFSPACE;
+ case ERROR_BAD_ARGUMENTS: return ERRCODE_IO_INVALIDPARAMETER;
+ case ERROR_BAD_PATHNAME: return ERRCODE_IO_NOTEXISTSPATH;
+ case ERROR_LOCK_FAILED: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_LOCKED: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_DUPLICATE_NAME: return ERRCODE_IO_ALREADYEXISTS;
+ case ERROR_DIRECTORY_IN_CDS: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_CURRENT_DIRECTORY: return ERRCODE_IO_LOCKVIOLATION;
+ case ERROR_FILENAME_EXCED_RANGE: return ERRCODE_IO_NAMETOOLONG;
+ }
+
+ DBG_TRACE1( "FSys: unknown apiret error %d occured", nApiRet );
+ return FSYS_ERR_UNKNOWN;
+}
+
+//--------------------------------------------------------------------
+
+DIR *opendir( const char* pPfad )
+{
+ DIR *pDir = new DIR;
+ if ( pDir )
+ pDir->p = (char*) pPfad;
+ return pDir;
+}
+
+struct dirent *readdir( DIR *pDir )
+{
+ APIRET nRet;
+ ULONG nCount = 1;
+ if ( pDir->p )
+ {
+ char *pBuf = new char[ strlen( pDir->p ) + 5 ];
+ if ( pBuf )
+ {
+ // *.* dahinter, ggf mit "\\" abtrennen (falls nicht schon da)
+ strcpy( pBuf, pDir->p );
+ strcat( pBuf, "\\*.*" + ( *(pBuf + strlen( pBuf ) - 1 ) == '\\' ) );
+ pDir->aDirHdl = HDIR_SYSTEM;
+ nRet = DosFindFirst( (PSZ) pBuf, &pDir->aDirHdl, 23,
+ (PVOID) &pDir->aDirEnt, sizeof( FILEFINDBUF3 ),
+ &nCount, FIL_STANDARD );
+ pDir->p = NULL;
+ delete pBuf;
+ }
+ else
+ nRet = 1;
+ }
+ else
+ {
+ nRet = DosFindNext( pDir->aDirHdl,
+ (PVOID) &pDir->aDirEnt, sizeof( pDir->aDirEnt ),
+ &nCount );
+ }
+
+ return !nRet ? &pDir->aDirEnt : NULL;
+}
+
+int closedir( DIR *pDir )
+{
+ if ( pDir )
+ {
+ if ( !pDir->p )
+ DosFindClose( pDir->aDirHdl );
+ delete pDir;
+ }
+ return (pDir != NULL);
+}
+
+typedef struct _FSInfo
+{
+ ULONG nSerial;
+ BYTE nNameLen;
+ UCHAR sName[40];
+} FSInfo;
+
+char* volumeid( const char* pPfad )
+{
+ static FSInfo aFSInfoBuf;
+
+ ULONG ulFSInfoLevel = FSIL_VOLSER;
+ ULONG nDriveNumber;
+
+ nDriveNumber = toupper(*pPfad) - 'A' + 1;
+
+ if ( nDriveNumber >= 3 )
+ {
+ APIRET rc = DosQueryFSInfo(
+ nDriveNumber, ulFSInfoLevel, &aFSInfoBuf, sizeof(FSInfo) );
+ if ( rc )
+ return 0;
+ return (char*) aFSInfoBuf.sName;
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ToAbs()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91 13:30
+|*
+*************************************************************************/
+
+BOOL DirEntry::ToAbs()
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ if (paVirtualURL)
+ {
+ return TRUE;
+ }
+
+ if ( FSYS_FLAG_VOLUME == eFlag )
+ {
+ eFlag = FSYS_FLAG_ABSROOT;
+ return TRUE;
+ }
+
+ if ( IsAbs() )
+ return TRUE;
+
+ char sBuf[512];
+
+ // Device bestimmen
+ DirEntry* pTop = ImpGetTopPtr();
+ ULONG nDev, nMap;
+ if ( ( pTop->eFlag == FSYS_FLAG_VOLUME || pTop->eFlag == FSYS_FLAG_RELROOT ) &&
+ pTop->aName.Len() )
+ nDev = tolower(aName(0)) - 'a' + 1;
+ else
+ DosQueryCurrentDisk( &nDev, &nMap );
+
+ // das dortige CWD ermitteln;
+ ULONG nLen = sizeof( sBuf ) - 1;
+ DirEntry *pCWD = 0;
+ DosQueryCurrentDir( nDev, (PSZ) sBuf, &nLen );
+ if ( sBuf[0] == 0 )
+ strcpy( sBuf, "\\" );
+ else
+ pCWD = new DirEntry( String( sBuf ) );
+
+ // das Device voranstellen
+ String aTempStr( (char)(nDev + 'a' - 1) );
+ aTempStr += ':';
+ if ( pCWD )
+ pCWD->ImpGetTopPtr()->pParent =
+ new DirEntry( aTempStr, FSYS_FLAG_ABSROOT, DEFSTYLE );
+ else
+ pCWD = new DirEntry( aTempStr, FSYS_FLAG_ABSROOT, DEFSTYLE );
+
+ // die relative Root durch ihr aktuelles Verzeichnis ersetzen
+ if ( pTop == this &&
+ ( pTop->eFlag == FSYS_FLAG_RELROOT || pTop->eFlag == FSYS_FLAG_VOLUME ) )
+ {
+ *pTop = *pCWD;
+ delete pCWD;
+ }
+ else if ( pTop->eFlag == FSYS_FLAG_ABSROOT )
+ {
+ pTop->aName = aTempStr;
+ delete pCWD;
+ }
+ else
+ {
+ // dir\\..-Sequenzen aufloesen
+ while ( (pTop = ImpGetTopPtr())->eFlag == FSYS_FLAG_PARENT &&
+ pTop != this )
+ {
+ pCWD->CutName();
+ ImpGetPreTopPtr()->pParent = 0;
+ delete pTop;
+ }
+
+ // Pfad davorhaengen
+ if ( pTop == this && eFlag == FSYS_FLAG_PARENT )
+ {
+ *this = pCWD->GetPath();
+ delete pCWD;
+ }
+ else
+ ImpGetTopPtr()->pParent = pCWD;
+ }
+
+ return IsAbs();
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetVolume()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 04.03.92
+|* Letzte Aenderung MI 04.03.92
+|*
+*************************************************************************/
+
+String DirEntry::GetVolume() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ const DirEntry *pTop = ImpGetTopPtr();
+
+ if ( pTop->eFlag == FSYS_FLAG_ABSROOT ||
+ pTop->eFlag == FSYS_FLAG_VOLUME )
+ {
+ const char *pVol;
+ pVol = volumeid( (char*) pTop->aName.GetStr() );
+ return FSYS2GUI( String( pVol ? pVol : "" ) );
+ }
+
+ return String();
+}
+
+/*************************************************************************
+|*
+|* DirEntry::SetCWD()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 21.05.92
+|*
+*************************************************************************/
+
+BOOL DirEntry::SetCWD( BOOL bSloppy )
+{
+ if (paVirtualURL)
+ {
+ String aTempString(GetRealPathFromVirtualURL());
+ if (aTempString.Len()==0)
+ {
+ return FALSE;
+ }
+ DirEntry aTempDirEntry(aTempString);
+ return aTempDirEntry.SetCWD(bSloppy);
+ }
+
+ // is the device to be changed?
+ DirEntry *pTop = ImpGetTopPtr();
+ if ( ( pTop->eFlag == FSYS_FLAG_ABSROOT ||
+ pTop->eFlag == FSYS_FLAG_RELROOT || pTop->eFlag == FSYS_FLAG_VOLUME )
+ && pTop->aName.Len() )
+ if ( DosSetDefaultDisk( pTop->aName.Lower()(0)-'a'+1 ) )
+ return FALSE;
+
+ APIRET nRet = DosSetCurrentDir( (PSZ) (const char *) GetFull() );
+ if ( nRet && bSloppy )
+ nRet = DosSetCurrentDir( (PSZ) (const char *) GetPath().GetFull() );
+ return !nRet;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::MoveTo()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91 14:07
+|*
+*************************************************************************/
+
+BOOL createLongNameEA( const PCSZ pszPath, ULONG ulAttributes, const String& aLongName );
+
+FSysError DirEntry::MoveTo( const DirEntry& rDest ) const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry aTmpDest(rDest);
+ FileStat aTmpStat(aTmpDest);
+ if ( aTmpStat.IsKind(FSYS_KIND_DIR) )
+ aTmpDest += DirEntry( GetName() );
+
+ String aSource( GetFull() );
+ String aDest( aTmpDest.GetFull() );
+ String aShortSource("");
+ String aShortDest("");
+
+ if (Folder::IsAvailable())
+ {
+ if (IsLongNameOnFAT())
+ {
+ // in kurzen Pfad wandeln
+ ItemIDPath aItemIDPath(aSource);
+ aShortSource = aItemIDPath.GetHostNotationPath();
+ }
+ if (rDest.IsLongNameOnFAT())
+ {
+ // in kurzen Pfad wandeln
+ ItemIDPath aItemIDPath(aDest);
+ aShortDest = aItemIDPath.GetHostNotationPath();
+ }
+ }
+
+ APIRET nRet = DosMove( aShortSource.Len()>0?(PSZ)aShortSource.GetStr():(PSZ)aSource.GetStr(),
+ aShortDest.Len()>0?(PSZ)aShortDest.GetStr():(PSZ)aDest.GetStr());
+
+ if ( nRet == ERROR_DIRECTORY_IN_CDS ||
+ nRet == ERROR_CURRENT_DIRECTORY )
+ {
+ // 2nd chance with modified CWD
+ DosSetCurrentDir( (PSZ) "\\" );
+ nRet = DosMove( aShortSource.Len()>0?(PSZ)aShortSource.GetStr():(PSZ)aSource.GetStr(),
+ aShortDest.Len()>0?(PSZ)aShortDest.GetStr():(PSZ)aDest.GetStr());
+ }
+ else if ( nRet == ERROR_NOT_SAME_DEVICE )
+ {
+ // other volume => copy+delete
+ FileCopier aMover( *this, rDest );
+ nRet = aMover.Execute( FSYS_ACTION_MOVE|FSYS_ACTION_RECURSIVE );
+ return nRet;
+ }
+
+ if ( (nRet==NO_ERROR) && aShortDest.Len()>0)
+ {
+ createLongNameEA((const char*)aShortDest, FILE_NORMAL, rDest.GetName());
+ }
+
+ return ApiRet2ToSolarError_Impl( nRet );
+}
+
+//-------------------------------------------------------------------------
+
+USHORT DirReader_Impl::Init()
+{
+ USHORT nRead = 0;
+ if ( pDir->eAttrMask & FSYS_KIND_BLOCK )
+ {
+ CreateDriveMapImpl();
+ DirEntry aCurrentDir;
+ aCurrentDir.ToAbs();
+ char sDrive[3] = "?:";
+
+ for ( char c = START_DRV; c <= 'z'; c++ )
+ {
+ sDrive[0] = c;
+ DirEntry* pDrive = new DirEntry( sDrive,
+ FSYS_FLAG_VOLUME, FSYS_STYLE_HOST );
+ if ( aDriveMap[c-'a'].nKind != FSYS_KIND_UNKNOWN &&
+ pDir->aNameMask.Matches( sDrive ) )
+ {
+ if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ {
+ FileStat *pNewStat = new FileStat( *pDrive );
+ pDir->ImpSortedInsert( pDrive, pNewStat );
+ }
+ else
+ pDir->ImpSortedInsert( pDrive, NULL );
+ ++nRead;
+ }
+ else
+ delete pDrive;
+ }
+
+ aCurrentDir.SetCWD();
+
+ }
+
+// OS2 ist beim Directory auslesen nicht threadfest
+#ifdef OS2
+ static NAMESPACE_VOS( OMutex )* pMutex = 0;
+ if( !pMutex ) pMutex = new NAMESPACE_VOS( OMutex );
+ NAMESPACE_VOS( OGuard ) aGuard( pMutex );
+#endif
+ // Workaround: kein async-read, da OS/2 dann nix mehr liefert
+ for ( USHORT nLastRead; nLastRead = Read(); )
+ nRead += nLastRead;
+
+ return nRead;
+}
+
+//-------------------------------------------------------------------------
+
+USHORT DirReader_Impl::Read()
+{
+ // Directories und Files auflisten?
+ if ( ( pDir->eAttrMask & FSYS_KIND_DIR || pDir->eAttrMask & FSYS_KIND_FILE ) &&
+ ( ( pDosEntry = readdir( pDosDir ) ) != NULL ) )
+ {
+ if ( ( ( ( pDir->eAttrMask & FSYS_KIND_DIR ) &&
+ ( pDosEntry->d_type & DOS_DIRECT ) ) ||
+ ( ( pDir->eAttrMask & FSYS_KIND_FILE ) &&
+ !( pDosEntry->d_type & DOS_DIRECT ) ) ) &&
+ pDir->aNameMask.Matches(
+ ToLowerImpl( String( pDosEntry->d_name ) ) ) )
+ {
+ String aName( FSYS2GUI( pDosEntry->d_name ) );
+ DirEntryFlag eFlag =
+ aName == "." ? FSYS_FLAG_CURRENT
+ : aName == ".." ? FSYS_FLAG_PARENT
+ : FSYS_FLAG_NORMAL;
+ DirEntry *pTemp = new DirEntry( String( aName ),
+ eFlag, FSYS_STYLE_NTFS );
+ if ( pParent )
+ pTemp->ImpChangeParent( new DirEntry( *pParent ), FALSE );
+ if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ {
+ FileStat *pNewStat = new FileStat( (void*) pDosDir, (void*) 0 );
+ pDir->ImpSortedInsert( pTemp, pNewStat );
+ }
+ else
+ pDir->ImpSortedInsert( pTemp, NULL );
+ return 1;
+ }
+ }
+ else
+ bReady = TRUE;
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* FileStat::FileStat()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MA 05.11.91
+|* Letzte Aenderung MA 07.11.91
+|*
+*************************************************************************/
+
+FileStat::FileStat( const void *pInfo, // struct dirent
+ const void * ): // dummy
+ aDateCreated(0),
+ aTimeCreated(0),
+ aDateModified(0),
+ aTimeModified(0),
+ aDateAccessed(0),
+ aTimeAccessed(0)
+{
+ paVirtualURL = NULL;
+
+ struct dirent *pDirent = (struct dirent*) pInfo;
+
+ nSize = pDirent->d_size;
+
+ aDateCreated = MsDos2Date( pDirent->d_date );
+ aTimeCreated = MsDos2Time( pDirent->d_time );
+ aDateModified = aDateModified;
+ aTimeModified = aTimeModified;
+ aDateAccessed = aDateModified;
+ aTimeAccessed = aTimeModified;
+
+ nKindFlags = FSYS_KIND_FILE;
+ if ( pDirent->d_type & DOS_DIRECT )
+ nKindFlags = FSYS_KIND_DIR;
+}
+
+/*************************************************************************
+|*
+|* FileStat::Update()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 11.06.91
+|* Letzte Aenderung MA 07.11.91
+|*
+*************************************************************************/
+
+struct _FSYS_FSQBUFFER
+{
+ FSQBUFFER2 aBuf;
+ UCHAR sBuf[256];
+};
+
+BOOL FileStat::Update( const DirEntry& rDirEntry, BOOL bAccessRemovableDevice )
+{
+ paVirtualURL = rDirEntry.paVirtualURL;
+
+ nSize = 0;
+ FSysPathStyle eStyle = FSYS_STYLE_UNKNOWN;
+ aCreator.Erase();
+ aType.Erase();
+ aDateCreated = Date(0);
+ aTimeCreated = Time(0);
+ aDateModified = Date(0);
+ aTimeModified = Time(0);
+ aDateAccessed = Date(0);
+ aTimeAccessed = Time(0);
+
+ if (paVirtualURL)
+ {
+ if (rDirEntry.GetRealPathFromVirtualURL().Len()==0)
+ {
+ // keine reale repräsentation für VirtualURL, also alles setzen,
+ // lediglich dir/file unterscheidbar
+ nKindFlags = FSYS_KIND_ALL;
+
+ if (Folder(ItemIDPath(rDirEntry.GetFull())).IsValid()) //ist dir?
+ {
+ nKindFlags &= ~FSYS_KIND_FILE; //ja, also kein file
+ }
+ else
+ {
+ nKindFlags &= ~FSYS_KIND_DIR; //nein, also kein dir
+ }
+
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+ }
+
+ nError = rDirEntry.IsValid() ? FSYS_ERR_OK : FSYS_ERR_UNKNOWN;
+ if ( nError > FSYS_ERR_OK )
+ return FALSE;
+
+ // Sonderbehandlung falls es sich um eine Wildcard handelt
+ String aTempName( rDirEntry.GetName() );
+ if ( strchr( (char*) (const char*) aTempName, '?' ) ||
+ strchr( (char*) (const char*) aTempName, '*' ) ||
+ strchr( (char*) (const char*) aTempName, ';' ) )
+ {
+ nKindFlags = FSYS_KIND_WILD;
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ // Sonderbehandlung falls es sich um eine Root handelt
+ if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME ||
+ rDirEntry.eFlag == FSYS_FLAG_ABSROOT )
+ {
+ if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME )
+ nKindFlags = FSYS_KIND_DEV;
+ else
+ nKindFlags = FSYS_KIND_DIR;
+
+ if ( rDirEntry.aName.Len() == 2 )
+ {
+ if ( !bDriveMap )
+ CreateDriveMapImpl();
+
+ DriveMapItem &rItem = aDriveMap[toupper(rDirEntry.aName[0]) - 'A'];
+ if ( !rItem.nKind )
+ {
+ nError = ERRCODE_IO_INVALIDDEVICE;
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ return FALSE;
+ }
+ else
+ {
+ if ( rDirEntry.eFlag == FSYS_FLAG_VOLUME )
+ nKindFlags |= FSYS_KIND_BLOCK | rItem.nKind;
+ eStyle = rItem.nStyle;
+ }
+ }
+
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ // disable error-boxes for hard-errors
+ DosError(FERR_DISABLEHARDERR);
+
+ // Statusinformation vom Betriebssystem holen
+ DirEntry aTempDirEntry( rDirEntry );
+ char* p;
+ String aFullName;
+
+ aTempDirEntry.ToAbs();
+ aFullName = aTempDirEntry.GetFull();
+
+ if (aTempDirEntry.paVirtualURL)
+ {
+ aFullName = rDirEntry.GetRealPathFromVirtualURL();
+ }
+
+ if (Folder::IsAvailable() && aTempDirEntry.IsLongNameOnFAT())
+ {
+ // in String mit kurzem Pfad wandeln
+ ItemIDPath aItemIDPath(aTempDirEntry.GetFull());
+ aFullName = aItemIDPath.GetHostNotationPath();
+ }
+
+ p = (char *) aFullName.GetStr();
+
+ FILESTATUS3 filestat;
+ memset( &filestat, 0, sizeof( filestat ) );
+ if( DosQueryPathInfo( (PSZ)p, 1, &filestat, sizeof( filestat ) ) )
+ {
+ nError = FSYS_ERR_NOTEXISTS;
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ return FALSE;
+ }
+
+ nError = FSYS_ERR_OK;
+ nSize = filestat.cbFile;
+
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ if( filestat.attrFile & FILE_DIRECTORY )
+ nKindFlags |= FSYS_KIND_DIR;
+ if ( nKindFlags == FSYS_KIND_UNKNOWN )
+ nKindFlags = nKindFlags | FSYS_KIND_FILE;
+
+ aDateModified = Date( filestat.fdateLastWrite.day,
+ filestat.fdateLastWrite.month,
+ filestat.fdateLastWrite.year + 1980 );
+
+ aTimeModified = Time( filestat.ftimeLastWrite.hours,
+ filestat.ftimeLastWrite.minutes,
+ filestat.ftimeLastWrite.twosecs*2 );
+
+ if ( filestat.fdateCreation.day )
+ {
+ aDateCreated = Date( filestat.fdateCreation.day,
+ filestat.fdateCreation.month,
+ filestat.fdateCreation.year + 1980 );
+
+ aTimeCreated = Time( filestat.ftimeCreation.hours,
+ filestat.ftimeCreation.minutes,
+ filestat.ftimeCreation.twosecs*2 );
+ }
+ else
+ {
+ aDateCreated = aDateModified;
+ aTimeCreated = aTimeModified;
+ }
+
+ if ( filestat.fdateLastAccess.day > 0 )
+ {
+ aDateAccessed = Date( filestat.fdateLastAccess.day,
+ filestat.fdateLastAccess.month,
+ filestat.fdateLastAccess.year + 1980 );
+
+ aTimeAccessed = Time( filestat.ftimeLastAccess.hours,
+ filestat.ftimeLastAccess.minutes,
+ filestat.ftimeLastAccess.twosecs*2 );
+ }
+ else
+ {
+ aDateAccessed = aDateModified;
+ aTimeAccessed = aTimeModified;
+ }
+
+ return TRUE;
+}
+
+#if SUPD>364
+BOOL IsRedirectable_Impl( const String &rPath )
+{
+ if ( rPath.Len() >= 3 && ':' == rPath.GetStr()[1] )
+ {
+ DriveMapItem &rItem = aDriveMap[toupper(rPath[0]) - 'A'];
+ return FSYS_KIND_FIXED != rItem.nKind;
+ }
+ return FALSE;
+}
+#endif
+
+const char* TempDirImpl( char *pBuf )
+{
+#if defined( __BORLANDC__ ) && (__BORLANDC__ < 0x0460)
+ PSZ pVar;
+#else
+ PCSZ pVar;
+#endif
+ USHORT nRet;
+ BOOL bAppendTemp = FALSE; // mu\s noch \\temp angeh"angt werden
+
+ // Erstmal sehen, ob TEMP oder TMP gesetzt sind
+ nRet = DosScanEnv( (PSZ)"TEMP", &pVar );
+ if( nRet )
+ nRet = DosScanEnv( (PSZ)"temp", &pVar );
+ if( nRet )
+ nRet = DosScanEnv( (PSZ)"TMP", &pVar );
+ if( nRet )
+ nRet = DosScanEnv( (PSZ)"tmp", &pVar );
+
+ // falls das geklappt hat, und ein Backslash dranhaengt,
+ // oder falls es bisher nicht geklappt hat,
+ // muessen wir nachher einen Backslash entfernen
+ BOOL bRemoveBS = nRet || *(pVar+strlen(pVar)-1) == '\\';
+
+ // Keine temp-Variable gefunden, dann gehen wir mal auf die Suche
+ // nach dem System-Laufwerk
+ if( nRet )
+ {
+ nRet = DosScanEnv( (PSZ)"USER_INI",&pVar );
+ bAppendTemp = (0 == nRet);
+ }
+ if( nRet )
+ {
+ nRet = DosScanEnv( (PSZ)"SYSTEM_INI", &pVar );
+ bAppendTemp = (0 == nRet);
+ }
+ if( nRet )
+ // Wenn das immer noch nicht reicht nehmen wir eben die Root von C:
+#ifdef __BORLANDC__
+ pVar = (PSZ)"c:\\temp\\";
+#else
+ pVar = (PCSZ)"c:\\temp\\";
+#endif
+ strcpy( pBuf, (const char*)pVar );
+
+ // jetzt haengt ggf. ein Backlash dran, den wir abschneiden,
+ // ggf. inklusive dahinter haengendem Dateinamen
+ if ( bRemoveBS )
+ {
+ char *pTail = pBuf + strlen(pBuf) - 1;
+ for ( char cLast = *pTail; cLast != '\\'; cLast = *(--pTail) )
+ *pTail = 0;
+ }
+
+ if ( bAppendTemp )
+ strcat( pBuf, "\\temp" );
+ DirEntry( pBuf ).MakeDir();
+
+ return pBuf;
+}
+
+#define CURRENT_COUNTRY 0
+#define NLS_CODEPAGE 850
+
+/*====================================================================
+ * CreateCaseMapImpl()
+ * creates a map of each character to convert to lower
+ *--------------------------------------------------------------------*/
+
+void CreateCaseMapImpl()
+{
+ // build a string starting with code 0 as first character upto 255
+ char sTemp[256];
+ for ( USHORT n = 0; n < 256; ++n )
+ sTemp[n] = (char) n;
+
+ // convert string to upper case
+ COUNTRYCODE aCountry;
+ aCountry.country = CURRENT_COUNTRY; /* Country code */
+ aCountry.codepage = NLS_CODEPAGE; /* Code page */
+ DosMapCase( 255, &aCountry, sTemp+1 );
+
+ // fill a global buffer starting with code 0 as first character upto 255
+ for ( n = 0; n < 256; ++n )
+ sCaseMap[n] = (char) n;
+
+ // reorder by upper-code and store in a global buffer
+ for ( n = 255; n > 0; --n )
+ // was this character converted?
+ if ( sTemp[n] != (char) n )
+ // we found a convertion from upper to lower
+ sCaseMap[ (unsigned char) sTemp[n] ] = (char) n;
+
+ bCaseMap = TRUE;
+}
+
+String ToLowerImpl( const String& rSource )
+{
+ if ( !bCaseMap )
+ CreateCaseMapImpl();
+
+ // TH sagt: International ist zu langsam, also mit einer eigenen Map
+ String aLower( rSource );
+ for ( USHORT n = 0; n < aLower.Len(); ++n )
+ aLower[n] = sCaseMap[ (unsigned char) aLower[n] ];
+ return aLower;
+}
+
+/*====================================================================
+ * CreateDriveMapImpl()
+ * creates a map of drive-infos like FileSystem (style) and Kind (remote)
+ *--------------------------------------------------------------------*/
+
+typedef struct _FSQBUFFER_
+{
+ FSQBUFFER2 aBuf;
+ UCHAR sBuf[64];
+} FSQBUFFER_;
+
+void CreateDriveMapImpl()
+{
+#ifdef POWERPC
+ // !!!!! Hack, da der untere Teil mit Beta 2 noch abstuertzt !!!!!
+ BYTE nFloppies = 1;
+ for ( USHORT nDrive = 0; nDrive < 26; ++nDrive )
+ {
+ if ( nDrive < nFloppies )
+ {
+ aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE;
+ aDriveMap[nDrive].nStyle = FSYS_STYLE_FAT;
+ }
+ else
+ {
+ aDriveMap[nDrive].nKind = FSYS_KIND_UNKNOWN;
+ aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN;
+ }
+ }
+
+ aDriveMap[2].nKind = FSYS_KIND_FIXED;
+ aDriveMap[2].nStyle = FSYS_STYLE_FAT;
+#else
+ FSQBUFFER_ aBuf;
+ ULONG nBufLen;
+ APIRET nRet;
+
+ // disable error-boxes for hard-errors
+ DosError(FERR_DISABLEHARDERR);
+
+ // determine number of floppy-drives
+ BYTE nFloppies;
+ nRet = DosDevConfig( (void*) &nFloppies, DEVINFO_FLOPPY );
+
+ // reset the map
+ for ( USHORT nDrive = 0; nDrive < 26; ++nDrive )
+ {
+ if ( nDrive < nFloppies )
+ {
+ aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE;
+ aDriveMap[nDrive].nStyle = FSYS_STYLE_FAT;
+ }
+ else
+ {
+ aDriveMap[nDrive].nKind = FSYS_KIND_UNKNOWN;
+ aDriveMap[nDrive].nStyle = FSYS_STYLE_UNKNOWN;
+ }
+ }
+
+ // determine file-system via DosOpen/DocDevIOCtrl
+ for ( nDrive = 2; nDrive < 26; ++nDrive )
+ {
+ // open drive
+ BOOL bFixed;
+ HFILE nDevHandle;
+ char pDriveName[3] = "#:";
+ pDriveName[0] = nDrive+'a';
+ ULONG nAction;
+ nRet = DosOpen( (PSZ) pDriveName, &nDevHandle,
+ &nAction, 0, 0, OPEN_ACTION_OPEN_IF_EXISTS,
+ OPEN_FLAGS_DASD|OPEN_SHARE_DENYNONE|OPEN_ACCESS_READONLY,
+ 0 );
+
+ // exists?
+ if ( !nRet )
+ {
+ // removeable?
+ BYTE nDriveId = nDrive;
+ ULONG nParaOutLen, nDataOutLen;
+ nRet = DosDevIOCtl(nDevHandle, 8, 0x20,
+ &nDriveId, sizeof(nDriveId), &nParaOutLen,
+ &bFixed, sizeof(bFixed), &nDataOutLen );
+
+ // prepare the drive-map
+ if ( !nRet && !bFixed )
+ aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE;
+
+ // close drive
+ DosClose(nDevHandle);
+ }
+ else if ( nRet == ERROR_NOT_READY )
+ aDriveMap[nDrive].nKind = FSYS_KIND_REMOVEABLE | FSYS_KIND_CDROM;
+ }
+
+ // determine file-system via FSAttach
+ nRet = 0;
+ for ( USHORT n = 3; nRet != ERROR_NO_MORE_ITEMS; ++n )
+ {
+ nBufLen = sizeof( aBuf );
+ nRet = DosQueryFSAttach( 0, n, FSAIL_DRVNUMBER,
+ (_FSQBUFFER2*) &aBuf, &nBufLen );
+ if ( !nRet )
+ {
+ nDrive = toupper(aBuf.aBuf.szName[0]) - 'A';
+
+ if ( aDriveMap[nDrive].nKind == FSYS_KIND_UNKNOWN )
+ aDriveMap[nDrive].nKind =
+ aBuf.aBuf.iType == 3 ? FSYS_KIND_FIXED :
+ aBuf.aBuf.iType == 4 ? FSYS_KIND_REMOTE :
+ FSYS_KIND_UNKNOWN;
+
+ char *pType = (char*)(aBuf.aBuf.szName + aBuf.aBuf.cbName + 1);
+ aDriveMap[nDrive].nStyle =
+ strcmp( pType, "FAT" ) == 0 ? FSYS_STYLE_FAT :
+ strcmp( pType, "HPFS" ) == 0 ? FSYS_STYLE_HPFS :
+ strcmp( pType, "NWFS" ) == 0 ? FSYS_STYLE_NWFS :
+ strcmp( pType, "EXT2" ) == 0 ? FSYS_STYLE_UNX :
+ strcmp( pType, "NFS" ) == 0 ? FSYS_STYLE_UNX :
+ FSYS_STYLE_UNKNOWN;
+ if ( strcmp( pType, "CDFS" ) == 0 )
+ aDriveMap[nDrive].nKind = FSYS_KIND_CDROM|FSYS_KIND_REMOVEABLE;
+ }
+ }
+#endif
+
+ bDriveMap = TRUE;
+}
+
+Time MsDos2Time( const time_t *pTimeT )
+{
+ tm *pTm = localtime( pTimeT );
+ if ( pTm )
+ return Time( pTm->tm_hour, pTm->tm_min, pTm->tm_sec );
+ else
+ return Time(0);
+}
+
+Date MsDos2Date( const time_t *pTimeT )
+{
+ tm *pTm = localtime( pTimeT );
+ if ( pTm )
+ return Date( pTm->tm_mday, pTm->tm_mon + 1, pTm->tm_year );
+ else
+ return Date(0);
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetPathStyle() const
+|*
+|* Beschreibung
+|* Ersterstellung MI 11.05.95
+|* Letzte Aenderung MI 11.05.95
+|*
+*************************************************************************/
+
+FSysPathStyle DirEntry::GetPathStyle( const String &rDevice )
+{
+ // UNC-Pathname?
+ if ( !rDevice || ( rDevice.Len() > 1 && rDevice[ (USHORT) 1] != ':' ) )
+ return FSYS_STYLE_UNKNOWN;
+
+ if ( !bDriveMap )
+ CreateDriveMapImpl();
+ return aDriveMap[toupper(rDevice[0]) - 'A'].nStyle;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::IsCaseSensitive() const
+|*
+|* Beschreibung
+|* Ersterstellung TPF 26.02.1999
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+BOOL DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
+{
+ if (eFormatter==FSYS_STYLE_HOST)
+ {
+ if (GetPathStyle(GetDevice().GetName()) == FSYS_STYLE_UNX)
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ BOOL isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv
+ switch ( eFormatter )
+ {
+ case FSYS_STYLE_MAC:
+ case FSYS_STYLE_FAT:
+ case FSYS_STYLE_VFAT:
+ case FSYS_STYLE_NTFS:
+ case FSYS_STYLE_NWFS:
+ case FSYS_STYLE_HPFS:
+ case FSYS_STYLE_DETECT:
+ {
+ isCaseSensitive = FALSE;
+ break;
+ }
+ case FSYS_STYLE_SYSV:
+ case FSYS_STYLE_BSD:
+ {
+ isCaseSensitive = TRUE;
+ break;
+ }
+ default:
+ {
+ isCaseSensitive = FALSE; // ich bin unter OS2, also ist der default im Zweifelsfall case insensitiv
+ break;
+ }
+ }
+ return isCaseSensitive;
+ }
+}
+
+
+
+
+//=========================================================================
+
+ErrCode FileStat::QueryDiskSpace( const String &rPath,
+ BigInt &rFreeBytes, BigInt &rTotalBytes )
+{
+ FSALLOCATE aFSInfoBuf;
+ String aVolume( DirEntry(rPath).ImpGetTopPtr()->GetName() );
+ ULONG nDriveNumber = toupper( aVolume(0) ) - 'A' + 1;
+
+ APIRET rc = DosQueryFSInfo( nDriveNumber, FSIL_ALLOC,
+ &aFSInfoBuf, sizeof(aFSInfoBuf) );
+ if ( rc )
+ return Sys2SolarError_Impl( rc );
+
+ BigInt aBytesPerCluster( BigInt(aFSInfoBuf.cbSector) *
+ BigInt(aFSInfoBuf.cSectorUnit) );
+ rFreeBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnitAvail);
+ rTotalBytes = aBytesPerCluster * BigInt(aFSInfoBuf.cUnit);
+ return 0;
+}
+
+//=========================================================================
+
+void FSysEnableSysErrorBox( BOOL bEnable )
+{
+ DosError( bEnable ? 0 : FERR_DISABLEHARDERR );
+}
+
diff --git a/tools/source/fsys/os2.hxx b/tools/source/fsys/os2.hxx
new file mode 100644
index 000000000000..bc03d0e21582
--- /dev/null
+++ b/tools/source/fsys/os2.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * $RCSfile: os2.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _os2_hxx
+#define _os2_hxx
+
+#include <string.h>
+
+#include <sys\types.h>
+#include <sys\stat.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#define INCL_DOSEXCEPTIONS
+#define INCL_DOSFILEMGR
+#define INCL_DOSPROCESS
+#define INCL_DOSDEVICES
+#define INCL_DOSERRORS
+#define INCL_DOSMISC
+#define INCL_DOSNLS /* National Language Support values */
+#include <svpm.h>
+
+#include <string.hxx>
+
+#define FSYS_UNIX FALSE
+
+#define DOS_DIRECT 16
+#define setdrive(n,a) dos_setdrive(n,a)
+#define GETDRIVE(n) dos_getdrive(&n)
+
+#define _mkdir(p) DosCreateDir( (PSZ)p, 0 )
+#define _rmdir(p) DosDeleteDir( (PSZ)p )
+#define _unlink(p) DosForceDelete( (PSZ)p )
+#define _chdir chdir
+#define _getcwd getcwd
+#define _access access
+
+const char* TempDirImpl( char *pBuf );
+String ToLowerImpl( const String& );
+
+inline char *getcwd(char *p, ULONG nLen )
+{
+ return DosQueryCurrentDir( 0, (PBYTE)p, &nLen ) ? p : 0;
+}
+
+#define dirent _FILEFINDBUF3
+#define d_name achName
+#define d_type attrFile
+#define d_size cbFile
+#define d_attr attrFile
+#define d_date fdateLastWrite
+#define d_time ftimeLastWrite
+
+typedef struct
+{
+ HDIR aDirHdl;
+ FILEFINDBUF3 aDirEnt;
+ char *p;
+} DIR;
+
+#define DEFSTYLE FSYS_STYLE_OS2
+#define MKDIR( p ) mkdir( (unsigned char*) p )
+#define CMP_LOWER(aString) ToLowerImpl(aString)
+
+#define START_DRV 'a'
+
+inline BOOL DRIVE_EXISTS( char c )
+{
+ ULONG nCur, nMap;
+ APIRET nRet = DosQueryCurrentDisk( &nCur, &nMap );
+ return ( nMap & 1 << (c - 'a') ) != 0;
+}
+
+#include <time.h>
+#include <datetime.hxx>
+
+inline Time MsDos2Time( FTIME aTime )
+{
+ return Time( aTime.hours, aTime.minutes, 2*aTime.twosecs );
+}
+
+inline Date MsDos2Date( FDATE aDate )
+{
+ return Date( aDate.day, aDate.month, aDate.year );
+}
+
+Time MsDos2Time( const time_t *pTimeT );
+
+Date MsDos2Date( const time_t *pTimeT );
+
+#define FSysFailOnErrorImpl()
+
+#endif
diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx
new file mode 100644
index 000000000000..021bed1f196e
--- /dev/null
+++ b/tools/source/fsys/tdir.cxx
@@ -0,0 +1,808 @@
+/*************************************************************************
+ *
+ * $RCSfile: tdir.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _DIR_CXX
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _LIST_HXX
+#include <list.hxx>
+#endif
+
+#ifndef _COMPED_HXX
+#include "comdep.hxx"
+#endif
+#ifndef _FSYS_HXX
+#include <fsys.hxx>
+#endif
+
+
+DBG_NAME( Dir );
+
+DECLARE_LIST( DirEntryList, DirEntry* );
+DECLARE_LIST( FSysSortList, FSysSort* );
+DECLARE_LIST( FileStatList, FileStat* );
+
+#define APPEND (USHORT) 65535
+
+/*************************************************************************
+|*
+|* Dir::InsertPointReached()
+|*
+|* Beschreibung stellt fest, ob eingefuegt werden musz
+|* Ersterstellung MA 05.11.91
+|* Letzte Aenderung MI 05.02.92
+|*
+*************************************************************************/
+
+BOOL Dir::ImpInsertPointReached( const DirEntry& rNewEntry,
+ const FileStat& rNewStat,
+ ULONG nCurPos, ULONG nSortIndex ) const
+{
+#define VALUE( nKindFlags ) \
+ ( ( FSYS_KIND_FILE | FSYS_KIND_DIR | FSYS_KIND_DEV | \
+ FSYS_KIND_CHAR | FSYS_KIND_BLOCK ) & nKindFlags )
+
+ // einfache Dinge erfordern einfache Loesungen
+ if ( !pLst->Count() )
+ return TRUE;
+
+ FSysSort nSort = *( pSortLst->GetObject( nSortIndex ) );
+ FileStat *pOldStat = NULL;
+ DirEntry *pCurLstObj = pLst->GetObject( nCurPos );
+ if ( pStatLst )
+ pOldStat = pStatLst->GetObject( nCurPos );
+
+ switch( nSort )
+ {
+ case FSYS_SORT_NAME:
+ case (FSYS_SORT_NAME | FSYS_SORT_ASCENDING):
+ if ( pCurLstObj->aName > rNewEntry.aName )
+ return TRUE;
+ if ( !(pCurLstObj->aName == rNewEntry.aName) )
+ return FALSE;
+ break;
+ case (FSYS_SORT_NAME | FSYS_SORT_DESCENDING):
+ if ( pCurLstObj->aName < rNewEntry.aName )
+ return TRUE;
+ if ( !(pCurLstObj->aName == rNewEntry.aName) )
+ return FALSE;
+ break;
+
+ case FSYS_SORT_EXT:
+ case (FSYS_SORT_EXT | FSYS_SORT_ASCENDING):
+ {
+ if ( pCurLstObj->GetExtension() > rNewEntry.GetExtension() )
+ return TRUE;
+ if ( !(pCurLstObj->GetExtension() == rNewEntry.GetExtension()) )
+ return FALSE;
+ break;
+ }
+ case (FSYS_SORT_EXT | FSYS_SORT_DESCENDING):
+ {
+ if ( pCurLstObj->GetExtension() < rNewEntry.GetExtension() )
+ return TRUE;
+ if ( !(pCurLstObj->GetExtension() == rNewEntry.GetExtension()) )
+ return FALSE;
+ break;
+ }
+
+ case FSYS_SORT_KIND:
+ case (FSYS_SORT_KIND | FSYS_SORT_ASCENDING ):
+ if ( VALUE(pOldStat->nKindFlags) > VALUE(rNewStat.nKindFlags) )
+ return TRUE;
+ if ( !(VALUE(pOldStat->nKindFlags) == VALUE(rNewStat.nKindFlags)) )
+ return FALSE;
+ break;
+ case (FSYS_SORT_KIND | FSYS_SORT_DESCENDING):
+ if ( VALUE(pOldStat->nKindFlags) < VALUE(rNewStat.nKindFlags) )
+ return TRUE;
+ if ( !(VALUE(pOldStat->nKindFlags) == VALUE(rNewStat.nKindFlags)) )
+ return FALSE;
+ break;
+
+ case FSYS_SORT_SIZE:
+ case (FSYS_SORT_SIZE | FSYS_SORT_ASCENDING):
+ if ( pOldStat->nSize > rNewStat.nSize )
+ return TRUE;
+ if ( !(pOldStat->nSize == rNewStat.nSize) )
+ return FALSE;
+ break;
+ case (FSYS_SORT_SIZE | FSYS_SORT_DESCENDING):
+ if ( pOldStat->nSize < rNewStat.nSize )
+ return TRUE;
+ if ( !(pOldStat->nSize == rNewStat.nSize) )
+ return FALSE;
+ break;
+
+ case FSYS_SORT_MODIFYED:
+ case (FSYS_SORT_MODIFYED | FSYS_SORT_ASCENDING):
+ if ( (pOldStat->aDateModified >= rNewStat.aDateModified) &&
+ (pOldStat->aTimeModified > rNewStat.aTimeModified) )
+ return TRUE;
+ if ( !((pOldStat->aDateModified == rNewStat.aDateModified) &&
+ (pOldStat->aTimeModified == rNewStat.aTimeModified)) )
+ return FALSE;
+ break;
+ case (FSYS_SORT_MODIFYED | FSYS_SORT_DESCENDING):
+ if ( (pOldStat->aDateModified <= rNewStat.aDateModified) &&
+ (pOldStat->aTimeModified < rNewStat.aTimeModified) )
+ return TRUE;
+ if ( !((pOldStat->aDateModified == rNewStat.aDateModified) &&
+ (pOldStat->aTimeModified == rNewStat.aTimeModified)) )
+ return FALSE;
+ break;
+
+ case FSYS_SORT_CREATED:
+ case (FSYS_SORT_CREATED | FSYS_SORT_ASCENDING):
+ if ( (pOldStat->aDateCreated >= rNewStat.aDateCreated) &&
+ (pOldStat->aTimeCreated > rNewStat.aTimeCreated) )
+ return TRUE;
+ if ( !((pOldStat->aDateCreated == rNewStat.aDateCreated) &&
+ (pOldStat->aTimeCreated == rNewStat.aTimeCreated)) )
+ return FALSE;
+ break;
+ case (FSYS_SORT_CREATED | FSYS_SORT_DESCENDING):
+ if ( (pOldStat->aDateCreated <= rNewStat.aDateCreated) &&
+ (pOldStat->aTimeCreated < rNewStat.aTimeCreated) )
+ return TRUE;
+ if ( !((pOldStat->aDateCreated == rNewStat.aDateCreated) &&
+ (pOldStat->aTimeCreated == rNewStat.aTimeCreated)) )
+ return FALSE;
+ break;
+
+ case FSYS_SORT_ACCESSED:
+ case (FSYS_SORT_ACCESSED | FSYS_SORT_ASCENDING):
+ if ( (pOldStat->aDateAccessed >= rNewStat.aDateAccessed) &&
+ (pOldStat->aTimeAccessed > rNewStat.aTimeAccessed) )
+ return TRUE;
+ if ( !((pOldStat->aDateAccessed == rNewStat.aDateAccessed) &&
+ (pOldStat->aTimeAccessed == rNewStat.aTimeAccessed)) )
+ return FALSE;
+ break;
+ case (FSYS_SORT_ACCESSED | FSYS_SORT_DESCENDING):
+ if ( (pOldStat->aDateAccessed <= rNewStat.aDateAccessed) &&
+ (pOldStat->aTimeAccessed < rNewStat.aTimeAccessed) )
+ return TRUE;
+ if ( !((pOldStat->aDateAccessed == rNewStat.aDateAccessed) &&
+ (pOldStat->aTimeAccessed == rNewStat.aTimeAccessed)) )
+ return FALSE;
+ break;
+ default: /* Kann nicht sein */;
+ }
+
+ if ( nSortIndex == ( pSortLst->Count() - 1 ) )
+ return TRUE;
+ else
+ //Rekursion
+ return ImpInsertPointReached( rNewEntry, rNewStat,
+ nCurPos, nSortIndex + 1 );
+#undef VALUE
+}
+
+/*************************************************************************
+|*
+|* Dir::ImpSortedInsert()
+|*
+|* Beschreibung fuegt sortiert ein
+|* Ersterstellung MA 05.11.91
+|* Letzte Aenderung MA 03.12.91
+|*
+*************************************************************************/
+
+void Dir::ImpSortedInsert( const DirEntry *pNewEntry, const FileStat *pNewStat )
+{
+ //Sonderfall, keine Sortierung gewuenscht.
+ if ( !pSortLst ) {
+ pLst->Insert( (DirEntry*)pNewEntry, APPEND );
+ return;
+ }
+
+ pLst->First();
+ do {
+ if ( ImpInsertPointReached( *pNewEntry, *pNewStat, pLst->GetCurPos(),
+ (ULONG)0 ) )
+ {
+ if ( pStatLst )
+ pStatLst->Insert( (FileStat*)pNewStat, pLst->GetCurPos() );
+ pLst->Insert( (DirEntry*)pNewEntry );
+ return;
+ }
+ } while( pLst->Next() );
+
+ if ( pStatLst )
+ pStatLst->Insert( (FileStat*)pNewStat, APPEND );
+ pLst->Insert( (DirEntry*)pNewEntry, APPEND );
+}
+
+/*************************************************************************
+|*
+|* Dir::Construct()
+|*
+|* Beschreibung gemeinsame Implementation der Ctoren
+|* Ersterstellung MI 02.06.93
+|* Letzte Aenderung MI 02.06.93
+|*
+*************************************************************************/
+
+void Dir::Construct( DirEntryKind nKindFlags )
+{
+ pLst = NULL;
+ pSortLst = NULL;
+ pStatLst = NULL;
+ eAttrMask = nKindFlags;
+ ByteString aTempName( GetName(), osl_getThreadTextEncoding() );
+ if ( aTempName.Search( "*" ) != STRING_NOTFOUND ||
+ aTempName.Search( "?" ) != STRING_NOTFOUND )
+#if defined( WNT ) && !defined( WTC )
+ {
+ ByteString aTStr(CutName(), osl_getThreadTextEncoding());
+ char* pBuffer = new char[aTStr.Len()+1];
+ strcpy( pBuffer, aTStr.GetBuffer() );
+ CharLowerBuff( pBuffer, aTStr.Len() );
+ aNameMask = WildCard( String(pBuffer, osl_getThreadTextEncoding()), ';' );
+ delete pBuffer;
+ }
+#else
+ aNameMask = WildCard( CutName(), ';' );
+#endif
+ else
+ aNameMask = String("*", osl_getThreadTextEncoding());
+}
+
+/*************************************************************************
+|*
+|* Dir::Update()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 16.05.91
+|* Letzte Aenderung MI 19.09.96
+|*
+*************************************************************************/
+
+BOOL Dir::Update()
+{
+ Reset();
+ return Scan( USHRT_MAX ) > 0;
+}
+
+/*************************************************************************
+|*
+|* Dir::Reset()
+|*
+|* Beschreibung
+|* Ersterstellung MI 22.10.96
+|* Letzte Aenderung MI 22.10.96
+|*
+*************************************************************************/
+
+void Dir::Reset()
+{
+ // ggf. alten Reader l"oschen
+ if ( pReader && pReader->bInUse )
+ DELETEZ(pReader);
+
+ // alle DirEntries aus der Liste entfernen und deren Speicher freigeben
+ if ( pLst )
+ {
+ DirEntry* pEntry = pLst->First();
+ while (pEntry)
+ {
+ DirEntry* pNext = pLst->Next();
+ delete pEntry;
+ pEntry = pNext;
+ }
+ pLst->Clear();
+ }
+ else
+ pLst = new DirEntryList();
+
+ // Alte File-Stat's Loeschen
+ if ( pStatLst )
+ {
+ //Erstmal die alten Loeschen
+ FileStat* pEntry = pStatLst->First();
+ while (pEntry)
+ {
+ FileStat* pNext = pStatLst->Next();
+ delete pEntry;
+ pEntry = pNext;
+ }
+ pStatLst->Clear();
+ delete pStatLst;
+ }
+
+ // Verlangen die Sortierkriterien FileStat's?
+ if ( pSortLst )
+ {
+ pSortLst->First();
+ do
+ {
+ if ( *( pSortLst->GetCurObject() ) &
+ ( FSYS_SORT_KIND | FSYS_SORT_SIZE |
+ FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_ACCESSED ) )
+ pStatLst = new FileStatList();
+ } while ( !pStatLst && pSortLst->Next() );
+ }
+
+#ifndef BOOTSTRAP
+ // ggf. einen neuen Reader aufsetzen
+ if ( !pReader )
+ pReader = new DirReader_Impl( *this );
+#endif
+
+ // gibt es das zu oeffnende Verzeichnis ueberhaupt?
+#ifndef UNX //explanation: see DirReader_Impl::Read() in unx.cxx
+ if( !pReader->pDosDir )
+ {
+ nError = FSYS_ERR_NOTADIRECTORY;
+ DELETEZ( pReader );
+ return;
+ }
+#endif
+}
+
+/*************************************************************************
+|*
+|* Dir::Scan()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 18.09.96
+|* Letzte Aenderung MI 19.09.96
+|*
+*************************************************************************/
+
+USHORT Dir::Scan( USHORT nCount )
+{
+
+ USHORT nRead = 0; // Anzahl in dieser Runde gelesener Eintr"age
+ FSysFailOnErrorImpl();
+
+ // noch nicht fertig gewesen
+ if ( pReader )
+ {
+ // frischer Reader?
+ if ( !pLst->Count() )
+ {
+ // dann ggf. Laufwerke scannen
+ pReader->bInUse = TRUE;
+ nRead = pReader->Init();
+ }
+
+ // weiterlesen...
+ while ( nRead <= nCount && !pReader->bReady )
+ nRead += pReader->Read();
+
+ // fertig?
+ if ( pReader && pReader->bReady )
+ DELETEZ( pReader );
+ }
+
+ // Anzahl der gelesenen zur"uckgeben
+ return nRead;
+}
+
+/*************************************************************************
+|*
+|* Dir::Dir()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 16.05.91
+|* Letzte Aenderung MI 04.03.92
+|*
+*************************************************************************/
+
+Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags, FSysSort nSort, ... ):
+ DirEntry( rDirEntry ),
+ pReader( 0 )
+{
+ DBG_CTOR( Dir, NULL );
+
+ Construct( nKindFlags );
+
+ va_list pArgs;
+ va_start( pArgs, nSort );
+ ImpSetSort( pArgs, nSort );
+
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Dir::Dir()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 02.06.93
+|* Letzte Aenderung MI 02.06.93
+|*
+*************************************************************************/
+
+Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ):
+ DirEntry( rDirEntry ),
+ pReader( 0 )
+{
+ DBG_CTOR( Dir, NULL );
+
+ Construct( nKindFlags );
+ Reset();
+}
+
+/*************************************************************************
+|*
+|* Dir::Dir()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 16.05.91
+|* Letzte Aenderung MA 04.11.91
+|*
+*************************************************************************/
+
+Dir::Dir():
+ pReader( 0 )
+{
+ DBG_CTOR( Dir, NULL );
+
+ pLst = NULL;
+ pSortLst = NULL;
+ pStatLst = NULL;
+ eAttrMask = FSYS_KIND_ALL;
+ aNameMask = String("*", osl_getThreadTextEncoding());
+}
+
+/*************************************************************************
+|*
+|* Dir::~Dir()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 16.05.91
+|* Letzte Aenderung MA 04.11.91
+|*
+*************************************************************************/
+
+Dir::~Dir()
+{
+ DBG_DTOR( Dir, NULL );
+
+ // alle DirEntries aus der Liste entfernen und deren Speicher freigeben
+ if ( pLst )
+ {
+ DirEntry* pEntry = pLst->First();
+ while (pEntry)
+ {
+ DirEntry* pNext = pLst->Next();
+ delete pEntry;
+ pEntry = pNext;
+ }
+ pLst->Clear();
+
+ delete pLst;
+ }
+
+ // alle Sorts aus der Liste entfernen und deren Speicher freigeben
+ if ( pSortLst )
+ {
+ FSysSort* pEntry = pSortLst->First();
+ while (pEntry)
+ {
+ FSysSort* pNext = pSortLst->Next();
+ delete pEntry;
+ pEntry = pNext;
+ }
+ pSortLst->Clear();
+
+ delete pSortLst;
+ }
+
+ // alle FileStat's aus der Liste entfernen und deren Speicher freigeben
+ if ( pStatLst )
+ {
+ FileStat* pEntry = pStatLst->First();
+ while (pEntry)
+ {
+ FileStat* pNext = pStatLst->Next();
+ delete pEntry;
+ pEntry = pNext;
+ }
+ pStatLst->Clear();
+ delete pStatLst;
+ }
+
+ // ggf. laufenden Reader freigeben
+ delete pReader;
+}
+
+/*************************************************************************
+|*
+|* Dir::ImpSetSort()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MA 04.11.91
+|* Letzte Aenderung MI 05.02.92
+|*
+*************************************************************************/
+
+FSysError Dir::ImpSetSort( va_list pArgs, int nFirstSort )
+{
+ BOOL bLast;
+ FSysSort *pSort;
+ FSysSortList *pNewSortLst = new FSysSortList;
+
+ *( pSort = new FSysSort ) = nFirstSort;
+ do
+ {
+ // letztes Kriterium?
+ bLast = FSYS_SORT_END == (*pSort & FSYS_SORT_END);
+ *pSort &= ~FSYS_SORT_END;
+
+ // Ascending oder Descending?
+ BOOL bAscending = FSYS_SORT_ASCENDING ==
+ ( *pSort & ( FSYS_SORT_ASCENDING | FSYS_SORT_DESCENDING ) );
+ USHORT nSort = *pSort & ~(USHORT)FSYS_SORT_ASCENDING
+ & ~(USHORT)FSYS_SORT_DESCENDING;
+
+ // g"utliges Sortierkriterium?
+ if ( ( nSort == FSYS_SORT_NAME ) ||
+ ( nSort == FSYS_SORT_SIZE ) ||
+ ( nSort == FSYS_SORT_EXT ) ||
+ ( nSort == FSYS_SORT_CREATED ) ||
+ ( nSort == FSYS_SORT_MODIFYED ) ||
+ ( nSort == FSYS_SORT_ACCESSED ) ||
+ ( nSort == FSYS_SORT_KIND ) )
+ {
+ pNewSortLst->Insert( pSort, APPEND );
+ *(pSort = new FSysSort) = va_arg( pArgs, FSysSort );
+ }
+ else
+ { // ungueltiger Sort oder FSYS_SORT_NONE
+ FSysSort* pEntry = pNewSortLst->First();
+ while (pEntry)
+ {
+ FSysSort* pNext = pNewSortLst->Next();
+ delete pEntry;
+ pEntry = pNext;
+ }
+ pNewSortLst->Clear();
+ delete pNewSortLst;
+ if ( *pSort == FSYS_SORT_NONE )
+ {
+ delete pSort;
+ if ( pSortLst )
+ delete pSortLst;
+ return FSYS_ERR_OK;
+ }
+ else
+ {
+ delete pSort;
+ return FSYS_ERR_NOTSUPPORTED;
+ }
+ }
+ } while ( !bLast );
+
+ va_end( pArgs );
+ delete pSort; // JP:6.3.00 - delete the initial pointer
+
+ //Enfernen der alten Sort-Elemente
+ if ( pSortLst )
+ {
+ FSysSort* pEntry = pSortLst->First();
+ while (pEntry)
+ {
+ FSysSort* pNext = pSortLst->Next();
+ delete pEntry;
+ pEntry = pNext;
+ }
+ pSortLst->Clear();
+ delete pSortLst;
+ }
+ pSortLst = pNewSortLst;
+
+ //Jetzt noch neu Sortieren...
+
+ //Wenn keine FileStats da sind, aber nun welche gebraucht werden,
+ //ist der Aufruf von Update() die einfachste Moeglichkeit
+ if ( !pStatLst && pSortLst )
+ {
+ pSortLst->First();
+ do
+ {
+ if ( *(pSortLst->GetCurObject()) &
+ ( FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_SIZE |
+ FSYS_SORT_ACCESSED | FSYS_SORT_KIND ) )
+ {
+ Update();
+ return FSYS_ERR_OK;
+ }
+ } while ( !pStatLst && pSortLst->Next() );
+ }
+
+ if ( pLst ) { //Keine DirEntry's, kein Sort.
+ DirEntryList *pOldLst = pLst; //alte Liste merken
+ pLst = new DirEntryList(); //neue Liste (zu Sortieren)
+
+ FileStatList *pOldStatLst = NULL; //alte StatListe merken
+ if ( pStatLst ) {
+ pOldStatLst = pStatLst;
+ pStatLst = new FileStatList(); //neue StatListe (zu Sortieren)
+ }
+ pOldLst->First();
+ do
+ {
+ //Sortiertes Einfuegen der Elemente aus den gemerkten Listen
+ //in die 'richtigen' Listen
+ if ( pOldStatLst )
+ ImpSortedInsert( pOldLst->GetCurObject(),
+ pOldStatLst->GetObject( pOldLst->GetCurPos() ) );
+ else
+ ImpSortedInsert( pOldLst->GetCurObject(), NULL );
+ } while( pOldLst->Next() );
+
+ delete pOldLst;
+ if ( pOldStatLst )
+ delete pOldStatLst;
+ }
+ return FSYS_ERR_OK;
+}
+
+/*************************************************************************
+|*
+|* Dir::SetSort()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MA 04.11.91
+|* Letzte Aenderung MI 05.02.92
+|*
+*************************************************************************/
+
+FSysError Dir::SetSort( FSysSort nSort, ... )
+{
+ va_list pArgs;
+ va_start( pArgs, nSort );
+ return ImpSetSort( pArgs, nSort );
+}
+
+/*************************************************************************
+|*
+|* Dir::operator[]()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 16.05.91
+|* Letzte Aenderung MI 16.05.91
+|*
+*************************************************************************/
+
+DirEntry& Dir::operator[] ( USHORT nIndex ) const
+{
+ DBG_ASSERT( nIndex < Count(), "Dir::operator[] : nIndex > Count()" );
+
+ DirEntry *pEntry = pLst->GetObject( nIndex );
+ return *pEntry;
+}
+
+/*************************************************************************
+|*
+|* Dir::operator+= ()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 16.05.91
+|* Letzte Aenderung MI 16.05.91
+|*
+*************************************************************************/
+
+Dir& Dir::operator+=( const Dir& rDir )
+{
+ // ggf. erst den Rest lesen
+ if ( pReader )
+ Scan( USHRT_MAX );
+ DBG_ASSERT( !rDir.pReader, "Dir::+= with incomplete Dir" );
+
+ // ggf. initiale Liste erzeugen
+ if ( !pLst )
+ pLst = new DirEntryList();
+
+ //Verlangen die Sortierkriterien FileStat's?
+ BOOL bStat = FALSE;
+ if ( pSortLst ) {
+ pSortLst->First();
+ do {
+ if ( *(pSortLst->GetCurObject()) &
+ ( FSYS_SORT_CREATED | FSYS_SORT_MODIFYED | FSYS_SORT_SIZE |
+ FSYS_SORT_ACCESSED | FSYS_SORT_KIND ) )
+ bStat = TRUE;
+ } while ( !bStat && pSortLst->Next() );
+ }
+ FileStat *pStat = NULL;
+ for ( USHORT nNr = 0; nNr < rDir.Count(); nNr++ ) {
+ if ( bStat )
+ if ( rDir.pStatLst )
+ {
+ pStat = new FileStat( *rDir.pStatLst->GetObject(nNr) );
+ }
+ else
+ pStat = new FileStat( rDir[nNr] );
+ ImpSortedInsert( new DirEntry( rDir[nNr] ), pStat );
+ }
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Dir::Count()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 16.05.91
+|* Letzte Aenderung MI 18.09.96
+|*
+*************************************************************************/
+
+
+USHORT Dir::Count( BOOL bUpdated ) const
+{
+ // ggf. erst den Rest lesen
+ if ( bUpdated && pReader )
+ ((Dir*)this)->Scan( USHRT_MAX );
+
+ return pLst == NULL ? 0 : (USHORT) pLst->Count();
+}
diff --git a/tools/source/fsys/tempfile.cxx b/tools/source/fsys/tempfile.cxx
new file mode 100644
index 000000000000..f920d18dde0f
--- /dev/null
+++ b/tools/source/fsys/tempfile.cxx
@@ -0,0 +1,337 @@
+/*************************************************************************
+ *
+ * $RCSfile: tempfile.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "tempfile.hxx"
+#include "comdep.hxx"
+
+#include <rtl/ustring.hxx>
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+#ifndef _TOOLS_TIME_HXX
+#include <time.hxx>
+#endif
+#include <debug.hxx>
+#include <stdio.h>
+
+#ifdef UNX
+#define _MAX_PATH 260
+#endif
+
+using namespace osl;
+
+static ::rtl::OUString aTempNameBase_Impl;
+
+struct TempFile_Impl
+{
+ String aName;
+ sal_Bool bIsDirectory;
+};
+
+String GetSystemTempDir_Impl()
+{
+ char sBuf[_MAX_PATH];
+ const char *pDir = TempDirImpl(sBuf);
+ ::rtl::OUString aTmp = ::rtl::OUString::createFromAscii( pDir );
+ rtl::OUString aRet;
+ FileBase::normalizePath( aTmp, aRet );
+ String aName = aRet;
+ sal_Int32 i = aName.Len();
+ if( aName.GetChar(i-1) != '/' )
+ aName += '/';
+ return aName;
+}
+
+#define TMPNAME_SIZE ( 1 + 5 + 5 + 4 + 1 )
+String ConstructTempDir_Impl( const String* pParent )
+{
+ String aName;
+ if ( pParent && pParent->Len() )
+ {
+ // if parent given try to use it
+ rtl::OUString aTmp( *pParent );
+ rtl::OUString aRet;
+
+ // test for valid filename
+ if ( FileBase::getNormalizedPathFromFileURL( aTmp, aRet ) == FileBase::E_None )
+ {
+ ::osl::DirectoryItem aItem;
+ sal_Int32 i = aRet.getLength();
+ if ( aRet[i-1] == '/' )
+ i--;
+
+ if ( DirectoryItem::get( ::rtl::OUString( aRet, i ), aItem ) == FileBase::E_None )
+ aName = aRet;
+ }
+ }
+
+ if ( !aName.Len() )
+ {
+ // if no parent or invalid parent : use system directory
+ if ( !aTempNameBase_Impl.getLength() )
+ aTempNameBase_Impl = GetSystemTempDir_Impl();
+ aName = aTempNameBase_Impl;
+ }
+
+ // Make sure that directory ends with a separator
+ sal_Int32 i = aName.Len();
+ if( i>0 && aName.GetChar(i-1) != '/' )
+ aName += '/';
+
+ return aName;
+}
+
+void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_True )
+{
+ // add a suitable tempname
+ // Prefix can have 5 chars, leaving 3 for numbers. 26 ** 3 == 17576
+ // ER 13.07.00 why not radix 36 [0-9A-Z] ?!?
+ const unsigned nRadix = 26;
+ String aName( rName );
+ aName += String::CreateFromAscii( "sv" );
+ sal_Int32 i = aName.Len();
+
+ rName.Erase();
+ static unsigned long u = Time::GetSystemTicks();
+ for ( unsigned long nOld = u; ++u != nOld; )
+ {
+ u %= (nRadix*nRadix*nRadix);
+ String aTmp( aName );
+ aTmp += String::CreateFromInt32( (sal_Int32) (unsigned) u, nRadix );
+ aTmp += String::CreateFromAscii( ".tmp" );
+
+ if ( bDir )
+ {
+ FileBase::RC err = Directory::create( aTmp );
+ if ( err == FileBase::E_None )
+ {
+ // !bKeep: only for creating a name, not a file or directory
+ if ( bKeep || Directory::remove( aTmp ) == FileBase::E_None )
+ rName = aTmp;
+ break;
+ }
+ else if ( err != FileBase::E_EXIST )
+ {
+ // if f.e. name contains invalid chars stop trying to create dirs
+ break;
+ }
+ }
+ else
+ {
+ DBG_ASSERT( bKeep, "Too expensive, use directory for creating name!" );
+ File aFile( aTmp );
+ FileBase::RC err = aFile.open(osl_File_OpenFlag_Create);
+ if ( err == FileBase::E_None )
+ {
+ rName = aTmp;
+ aFile.close();
+ break;
+ }
+ else if ( err != FileBase::E_EXIST )
+ {
+ // if f.e. name contains invalid chars stop trying to create files
+ break;
+ }
+ }
+ }
+}
+
+String TempFile::CreateTempName( const String* pParent )
+{
+ // get correct directory
+ String aName = ConstructTempDir_Impl( pParent );
+
+ // get TempFile name with default naming scheme
+ CreateTempName_Impl( aName, sal_False );
+
+ // convert to file URL
+ rtl::OUString aTmp;
+ if ( aName.Len() )
+ FileBase::getFileURLFromNormalizedPath( aName, aTmp );
+ return aTmp;
+}
+
+TempFile::TempFile( const String* pParent, sal_Bool bDirectory )
+ : pImp( new TempFile_Impl )
+ , bKillingFileEnabled( sal_False )
+{
+ pImp->bIsDirectory = bDirectory;
+
+ // get correct directory
+ pImp->aName = ConstructTempDir_Impl( pParent );
+
+ // get TempFile with default naming scheme
+ CreateTempName_Impl( pImp->aName, sal_True, bDirectory );
+}
+
+TempFile::TempFile( const String& rLeadingChars, const String* pExtension, const String* pParent, sal_Bool bDirectory )
+ : pImp( new TempFile_Impl )
+ , bKillingFileEnabled( sal_False )
+{
+ pImp->bIsDirectory = bDirectory;
+
+ // get correct directory
+ String aName = ConstructTempDir_Impl( pParent );
+
+ // now use special naming scheme ( name takes leading chars and an index counting up from zero
+ aName += rLeadingChars;
+ for ( sal_Int32 i=0;; i++ )
+ {
+ String aTmp( aName );
+ aTmp += String::CreateFromInt32( i );
+ if ( pExtension )
+ aTmp += *pExtension;
+ else
+ aTmp += String::CreateFromAscii( ".tmp" );
+ if ( bDirectory )
+ {
+ FileBase::RC err = Directory::create( aTmp );
+ if ( err == FileBase::E_None )
+ {
+ pImp->aName = aTmp;
+ break;
+ }
+ else if ( err != FileBase::E_EXIST )
+ // if f.e. name contains invalid chars stop trying to create dirs
+ break;
+ }
+ else
+ {
+ File aFile( aTmp );
+ FileBase::RC err = aFile.open(osl_File_OpenFlag_Create);
+ if ( err == FileBase::E_None )
+ {
+ pImp->aName = aTmp;
+ aFile.close();
+ break;
+ }
+ else if ( err != FileBase::E_EXIST )
+ // if f.e. name contains invalid chars stop trying to create dirs
+ break;
+ }
+ }
+}
+
+TempFile::~TempFile()
+{
+ if ( bKillingFileEnabled )
+ {
+ if ( pImp->bIsDirectory )
+ {
+ // at the moment no recursiv algorithm present
+ Directory::remove( pImp->aName );
+ }
+ else
+ {
+ File::remove( pImp->aName );
+ }
+ }
+
+ delete pImp;
+}
+
+sal_Bool TempFile::IsValid() const
+{
+ return pImp->aName.Len() != 0;
+}
+
+String TempFile::GetName() const
+{
+ rtl::OUString aTmp;
+ FileBase::getFileURLFromNormalizedPath( pImp->aName, aTmp );
+ return aTmp;
+}
+
+String TempFile::SetTempNameBaseDirectory( const String &rBaseName )
+{
+// if ( !aTempNameBase_Impl.getLength() )
+// aTempNameBase_Impl = GetSystemTempDir_Impl();
+// String aName( aTempNameBase_Impl );
+// aName += rBaseName;
+
+ String aName( rBaseName );
+
+ FileBase::RC err= Directory::create( aName );
+ if ( err == FileBase::E_None || err == FileBase::E_EXIST )
+ {
+ aTempNameBase_Impl = aName;
+ aTempNameBase_Impl += ::rtl::OUString( '/' );
+
+ TempFile aBase( NULL, sal_True );
+ if ( aBase.IsValid() )
+ aTempNameBase_Impl = aBase.pImp->aName;
+ }
+
+ rtl::OUString aTmp;
+ FileBase::getFileURLFromNormalizedPath( aTempNameBase_Impl, aTmp );
+ return aTmp;
+}
+
+String TempFile::GetTempNameBaseDirectory()
+{
+ if ( !aTempNameBase_Impl.getLength() )
+ aTempNameBase_Impl = GetSystemTempDir_Impl();
+
+ rtl::OUString aTmp;
+ FileBase::getFileURLFromNormalizedPath( aTempNameBase_Impl, aTmp );
+ return aTmp;
+}
+
diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx
new file mode 100644
index 000000000000..245ba9ebad4d
--- /dev/null
+++ b/tools/source/fsys/unx.cxx
@@ -0,0 +1,694 @@
+/*************************************************************************
+ *
+ * $RCSfile: unx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <utime.h>
+#if defined HPUX || defined LINUX || defined IRIX
+#include <mntent.h>
+#define mnttab mntent
+#elif defined SCO
+#include <mnttab.h>
+#elif defined AIX
+#include <sys/mntctl.h>
+#include <sys/vmount.h>
+extern "C" int mntctl( int cmd, size_t size, char* buf );
+#elif defined S390
+#include <sys/mntent.h>
+#define mnttab w_mntent
+#elif defined(NETBSD) || defined(FREEBSD) || defined(MACOSX)
+#elif defined DECUNIX
+struct mnttab
+{
+ char *mnt_dir;
+ char *mnt_fsname;
+};
+#else
+#include <sys/mnttab.h>
+#endif
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
+#endif
+
+#include <debug.hxx>
+#include <list.hxx>
+#include <fsys.hxx>
+#include "comdep.hxx"
+
+DECLARE_LIST( DirEntryList, DirEntry* )
+DECLARE_LIST( FSysSortList, FSysSort* )
+DECLARE_LIST( FileStatList, FileStat* )
+
+#if defined SOLARIS || defined SINIX
+#define MOUNTSPECIAL mnt_special
+#define MOUNTPOINT mnt_mountp
+#define MOUNTOPTS mnt_mntopts
+#define MOUNTFS mnt_fstype
+#elif defined SCO
+#define MNTTAB "/etc/mnttab"
+#define MOUNTSPECIAL mt_dev
+#define MOUNTPOINT mt_filsys
+#elif defined S390
+#define MOUNTSPECIAL mnt_fsname
+#define MOUNTPOINT mnt_mountpoint
+#else
+#define MOUNTSPECIAL mnt_fsname
+#define MOUNTPOINT mnt_dir
+#define MOUNTFS mnt_type
+#endif
+
+static ByteString sLastCaseSensitiveDir = "";
+static BOOL bLastCaseSensitive = FALSE;
+
+struct mymnttab
+{
+ dev_t mountdevice;
+ ByteString mountspecial;
+ ByteString mountpoint;
+ ByteString mymnttab_filesystem;
+ mymnttab() { mountdevice = (dev_t) -1; }
+};
+
+
+#if defined(NETBSD) || defined(FREEBSD) || defined(MACOSX)
+BOOL GetMountEntry(dev_t dev, struct mymnttab *mytab)
+{
+ DBG_WARNING( "Sorry, not implemented: GetMountEntry" );
+ return FALSE;
+}
+
+#elif defined AIX
+BOOL GetMountEntry(dev_t dev, struct mymnttab *mytab)
+{
+ int bufsize;
+ if (mntctl (MCTL_QUERY, sizeof bufsize, (char*) &bufsize))
+ return FALSE;
+
+ char* buffer = (char *)malloc( bufsize * sizeof(char) );
+ if (mntctl (MCTL_QUERY, bufsize, buffer) != -1)
+ for ( char* vmt = buffer;
+ vmt < buffer + bufsize;
+ vmt += ((struct vmount*)vmt)->vmt_length)
+ {
+ struct stat buf;
+ char *mountp = vmt2dataptr((struct vmount*)vmt, VMT_STUB);
+ if ((stat (mountp, &buf) != -1) && (buf.st_dev == dev))
+ {
+ mytab->mountpoint = mountp;
+ mytab->mountspecial
+ = vmt2dataptr((struct vmount*)vmt, VMT_HOSTNAME);
+ if (mytab->mountspecial.Len())
+ mytab->mountspecial += ':';
+ mytab->mountspecial
+ += vmt2dataptr((struct vmount*)vmt, VMT_OBJECT);
+ mytab->mountdevice = dev;
+ free( buffer );
+ return TRUE;
+ }
+ }
+ free( buffer );
+ return FALSE;
+}
+
+#else
+
+
+static BOOL GetMountEntry(dev_t dev, struct mymnttab *mytab)
+{
+#if defined SOLARIS || defined SINIX
+ FILE *fp = fopen (MNTTAB, "r");
+ if (! fp)
+ return FALSE;
+ struct mnttab mnt[1];
+ while (getmntent (fp, mnt) != -1)
+#elif defined SCO
+ FILE *fp = fopen (MNTTAB, "r");
+ if (! fp)
+ return FALSE;
+ struct mnttab mnt[1];
+ while (fread (&mnt, sizeof mnt, 1, fp) > 0)
+#elif defined DECUNIX || defined AIX || defined S390
+ FILE *fp = NULL;
+ if (! fp)
+ return FALSE;
+ struct mnttab mnt[1];
+ while ( 0 )
+#else
+ FILE *fp = setmntent (MOUNTED, "r");
+ if (! fp)
+ return FALSE;
+ struct mnttab *mnt;
+ while ((mnt = getmntent (fp)) != NULL)
+#endif
+ {
+#ifdef SOLARIS
+ char *devopt = NULL;
+ if ( mnt->MOUNTOPTS != NULL )
+ devopt = strstr (mnt->MOUNTOPTS, "dev=");
+ if (devopt)
+ {
+ if (dev != (dev_t) strtoul (devopt+4, NULL, 16))
+ continue;
+ }
+ else
+#endif
+ {
+ struct stat buf;
+ if ((stat (mnt->MOUNTPOINT, &buf) == -1) || (buf.st_dev != dev))
+ continue;
+ }
+# ifdef LINUX
+ /* #61624# File mit setmntent oeffnen und mit fclose schliessen stoesst
+ bei der glibc-2.1 auf wenig Gegenliebe */
+ endmntent( fp );
+# else
+ fclose (fp);
+# endif
+ mytab->mountspecial = mnt->MOUNTSPECIAL;
+ mytab->mountpoint = mnt->MOUNTPOINT;
+ mytab->mountdevice = dev;
+#ifndef SCO
+ mytab->mymnttab_filesystem = mnt->MOUNTFS;
+#else
+ mytab->mymnttab_filesystem = "ext2"; //default ist case sensitiv unter unix
+#endif
+ return TRUE;
+ }
+# ifdef LINUX
+ /* #61624# dito */
+ endmntent( fp );
+# else
+ fclose (fp);
+# endif
+ return FALSE;
+}
+
+#endif
+
+/************************************************************************
+|*
+|* DirEntry::IsCaseSensitive()
+|*
+|* Beschreibung
+|* Ersterstellung TPF 25.02.1999
+|* Letzte Aenderung TPF 25.02.1999
+|*
+*************************************************************************/
+
+BOOL DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
+{
+
+ if (eFormatter==FSYS_STYLE_HOST)
+ {
+#ifdef NETBSD
+ return TRUE;
+#else
+ struct stat buf;
+ DirEntry aPath(*this);
+ aPath.ToAbs();
+
+ while (stat (ByteString(aPath.GetFull(), osl_getThreadTextEncoding()).GetBuffer(), &buf))
+ {
+ if (aPath.Level() == 1)
+ {
+ return TRUE; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv
+ }
+ aPath = aPath [1];
+ }
+
+ struct mymnttab fsmnt;
+ GetMountEntry(buf.st_dev, &fsmnt);
+ if ((fsmnt.mymnttab_filesystem.CompareTo("msdos")==COMPARE_EQUAL) ||
+ (fsmnt.mymnttab_filesystem.CompareTo("umsdos")==COMPARE_EQUAL) ||
+ (fsmnt.mymnttab_filesystem.CompareTo("vfat")==COMPARE_EQUAL) ||
+ (fsmnt.mymnttab_filesystem.CompareTo("hpfs")==COMPARE_EQUAL) ||
+ (fsmnt.mymnttab_filesystem.CompareTo("smb") ==COMPARE_EQUAL) ||
+ (fsmnt.mymnttab_filesystem.CompareTo("ncpfs")==COMPARE_EQUAL))
+ {
+ return FALSE;
+ }
+ else
+ {
+ return TRUE;
+ }
+#endif
+ }
+ else
+ {
+ BOOL isCaseSensitive = TRUE; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv
+ switch ( eFormatter )
+ {
+ case FSYS_STYLE_MAC:
+ case FSYS_STYLE_FAT:
+ case FSYS_STYLE_VFAT:
+ case FSYS_STYLE_NTFS:
+ case FSYS_STYLE_NWFS:
+ case FSYS_STYLE_HPFS:
+ {
+ isCaseSensitive = FALSE;
+ break;
+ }
+ case FSYS_STYLE_SYSV:
+ case FSYS_STYLE_BSD:
+ case FSYS_STYLE_DETECT:
+ {
+ isCaseSensitive = TRUE;
+ break;
+ }
+ default:
+ {
+ isCaseSensitive = TRUE; // ich bin unter UNIX, also ist der default im Zweifelsfall case sensitiv
+ break;
+ }
+ }
+ return isCaseSensitive;
+ }
+}
+
+/************************************************************************
+|*
+|* DirEntry::ToAbs()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91 13:30
+|*
+*************************************************************************/
+
+BOOL DirEntry::ToAbs()
+{
+ if ( FSYS_FLAG_VOLUME == eFlag )
+ {
+ eFlag = FSYS_FLAG_ABSROOT;
+ return TRUE;
+ }
+
+ if ( IsAbs() )
+ return TRUE;
+
+ char sBuf[MAXPATHLEN + 1];
+ *this = DirEntry( String( getcwd( sBuf, MAXPATHLEN ), osl_getThreadTextEncoding() ) ) + *this;
+ return IsAbs();
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetVolume()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 04.03.92
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+static mymnttab mymnt;
+static String aEmptyString;
+
+String DirEntry::GetVolume() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry aPath( *this );
+ aPath.ToAbs();
+
+ struct stat buf;
+ while (stat (ByteString(aPath.GetFull(), osl_getThreadTextEncoding()).GetBuffer(), &buf))
+ {
+ if (aPath.Level() <= 1)
+ return aEmptyString;
+ aPath = aPath [1];
+ }
+
+ return ((buf.st_dev == mymnt.mountdevice ||
+ GetMountEntry(buf.st_dev, &mymnt)) ? String(mymnt.mountspecial, osl_getThreadTextEncoding()) : aEmptyString);
+}
+
+DirEntry DirEntry::GetDevice() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ DirEntry aPath( *this );
+ aPath.ToAbs();
+
+ struct stat buf;
+ while (stat (ByteString(aPath.GetFull(), osl_getThreadTextEncoding()).GetBuffer(), &buf))
+ {
+ if (aPath.Level() <= 1)
+ return aEmptyString;
+ aPath = aPath [1];
+ }
+ return ((buf.st_dev == mymnt.mountdevice ||
+ GetMountEntry(buf.st_dev, &mymnt)) ? String( mymnt.mountpoint, osl_getThreadTextEncoding()) : aEmptyString);
+}
+
+/*************************************************************************
+|*
+|* DirEntry::SetCWD()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung DV 04.11.92
+|*
+*************************************************************************/
+
+BOOL DirEntry::SetCWD( BOOL bSloppy )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+
+ ByteString aPath( GetFull(), osl_getThreadTextEncoding());
+ if ( !chdir( aPath.GetBuffer() ) )
+ {
+ return TRUE;
+ }
+ else
+ {
+ if ( bSloppy && !chdir(aPath.GetBuffer()) )
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
+
+USHORT DirReader_Impl::Init()
+{
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+USHORT DirReader_Impl::Read()
+{
+ if (!pDosDir)
+ {
+ pDosDir = opendir( (char*) ByteString(aPath, osl_getThreadTextEncoding()).GetBuffer() );
+ }
+
+ if (!pDosDir)
+ {
+ bReady = TRUE;
+ return 0;
+ }
+
+ // Directories und Files auflisten?
+ if ( ( pDir->eAttrMask & FSYS_KIND_DIR || pDir->eAttrMask & FSYS_KIND_FILE ) &&
+ ( ( pDosEntry = readdir( pDosDir ) ) != NULL ) )
+ {
+ String aD_Name(pDosEntry->d_name, osl_getThreadTextEncoding());
+ if ( pDir->aNameMask.Matches( aD_Name ) )
+ {
+ DirEntryFlag eFlag =
+ 0 == strcmp( pDosEntry->d_name, "." ) ? FSYS_FLAG_CURRENT
+ : 0 == strcmp( pDosEntry->d_name, ".." ) ? FSYS_FLAG_PARENT
+ : FSYS_FLAG_NORMAL;
+ DirEntry *pTemp = new DirEntry( ByteString(pDosEntry->d_name), eFlag, FSYS_STYLE_UNX );
+ if ( pParent )
+ pTemp->ImpChangeParent( new DirEntry( *pParent ), FALSE);
+ FileStat aStat( *pTemp );
+ if ( ( ( ( pDir->eAttrMask & FSYS_KIND_DIR ) &&
+ ( aStat.IsKind( FSYS_KIND_DIR ) ) ) ||
+ ( ( pDir->eAttrMask & FSYS_KIND_FILE ) &&
+ !( aStat.IsKind( FSYS_KIND_DIR ) ) ) ) &&
+ !( pDir->eAttrMask & FSYS_KIND_VISIBLE &&
+ pDosEntry->d_name[0] == '.' ) )
+ {
+ if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ pDir->ImpSortedInsert( pTemp, new FileStat( aStat ) );
+ else
+ pDir->ImpSortedInsert( pTemp, NULL );;
+ return 1;
+ }
+ else
+ delete pTemp;
+ }
+ }
+ else
+ bReady = TRUE;
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* FileStat::FileStat()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MA 05.11.91
+|* Letzte Aenderung MA 07.11.91
+|*
+*************************************************************************/
+
+FileStat::FileStat( const void *, const void * ):
+ aDateCreated(0),
+ aTimeCreated(0),
+ aDateModified(0),
+ aTimeModified(0),
+ aDateAccessed(0),
+ aTimeAccessed(0)
+{
+}
+
+/*************************************************************************
+|*
+|* FileStat::Update()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 11.06.91
+|* Letzte Aenderung MA 07.11.91
+|*
+*************************************************************************/
+#if SUPD < 345
+BOOL FileStat::Update( const DirEntry& rDirEntry )
+{
+ return Update( rDirEntry, FALSE );
+}
+#endif
+
+BOOL FileStat::Update( const DirEntry& rDirEntry, BOOL bAccessRemovableDevice )
+{
+
+ nSize = 0;
+ nKindFlags = 0;
+ aCreator.Erase();
+ aType.Erase();
+ aDateCreated = Date(0);
+ aTimeCreated = Time(0);
+ aDateModified = Date(0);
+ aTimeModified = Time(0);
+ aDateAccessed = Date(0);
+ aTimeAccessed = Time(0);
+
+ if ( !rDirEntry.IsValid() )
+ {
+ nError = FSYS_ERR_NOTEXISTS;
+ return FALSE;
+ }
+
+ // Sonderbehandlung falls es sich um eine Root handelt
+ if ( rDirEntry.eFlag == FSYS_FLAG_ABSROOT )
+ {
+ nKindFlags = FSYS_KIND_DIR;
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ struct stat aStat;
+ ByteString aPath( rDirEntry.GetFull(), osl_getThreadTextEncoding() );
+ if ( stat( (char*) aPath.GetBuffer(), &aStat ) )
+ {
+ // pl: #67851#
+ // do this here, because an existing filename containing "wildcards"
+ // should be handled as a file, not a wildcard
+ // note that this is not a solution, since filenames containing special characters
+ // are handled badly across the whole Office
+
+ // Sonderbehandlung falls es sich um eine Wildcard handelt
+ ByteString aTempName( rDirEntry.GetName(), osl_getThreadTextEncoding() );
+ if ( strchr( (char*) aTempName.GetBuffer(), '?' ) ||
+ strchr( (char*) aTempName.GetBuffer(), '*' ) ||
+ strchr( (char*) aTempName.GetBuffer(), ';' ) )
+ {
+ nKindFlags = FSYS_KIND_WILD;
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ nError = FSYS_ERR_NOTEXISTS;
+ return FALSE;
+ }
+
+ nError = FSYS_ERR_OK;
+ nSize = aStat.st_size;
+
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ if ( ( aStat.st_mode & S_IFDIR ) == S_IFDIR )
+ nKindFlags = nKindFlags | FSYS_KIND_DIR;
+ if ( ( aStat.st_mode & S_IFREG ) == S_IFREG )
+ nKindFlags = nKindFlags | FSYS_KIND_FILE;
+ if ( ( aStat.st_mode & S_IFCHR ) == S_IFCHR )
+ nKindFlags = nKindFlags | FSYS_KIND_DEV | FSYS_KIND_CHAR;
+ if ( ( aStat.st_mode & S_IFBLK ) == S_IFBLK )
+ nKindFlags = nKindFlags | FSYS_KIND_DEV | FSYS_KIND_BLOCK;
+ if ( nKindFlags == FSYS_KIND_UNKNOWN )
+ nKindFlags = nKindFlags | FSYS_KIND_FILE;
+
+ Unx2DateAndTime( aStat.st_ctime, aTimeCreated, aDateCreated );
+ Unx2DateAndTime( aStat.st_mtime, aTimeModified, aDateModified );
+ Unx2DateAndTime( aStat.st_atime, aTimeAccessed, aDateAccessed );
+
+ return TRUE;
+}
+
+//====================================================================
+
+const char *TempDirImpl( char *pBuf )
+{
+ const char *pValue = getenv( "TEMP" );
+ if ( !pValue )
+ pValue = getenv( "TMP" );
+ if ( pValue )
+ strcpy( pBuf, pValue );
+ else
+ // auf Solaris und Linux ist P_tmpdir vorgesehen
+ strcpy( pBuf, P_tmpdir );
+ // hart auf "/tmp" sollte wohl nur im Notfall verwendet werden
+ //strcpy( pBuf, "/tmp" );
+ return pBuf;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetPathStyle() const
+|*
+|* Beschreibung
+|* Ersterstellung MI 11.05.95
+|* Letzte Aenderung MI 11.05.95
+|*
+*************************************************************************/
+
+FSysPathStyle DirEntry::GetPathStyle( const String &rDevice )
+{
+ return FSYS_STYLE_UNX;
+}
+
+/*************************************************************************
+|*
+|* FileStat::SetDateTime
+|*
+|* Ersterstellung PB 27.06.97
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+void FileStat::SetDateTime( const String& rFileName,
+ const DateTime& rNewDateTime )
+{
+ tm times;
+
+ times.tm_year = rNewDateTime.GetYear() - 1900; // 1997 -> 97
+ times.tm_mon = rNewDateTime.GetMonth() - 1; // 0 == Januar!
+ times.tm_mday = rNewDateTime.GetDay();
+
+ times.tm_hour = rNewDateTime.GetHour();
+ times.tm_min = rNewDateTime.GetMin();
+ times.tm_sec = rNewDateTime.GetSec();
+
+ times.tm_wday = 0;
+ times.tm_yday = 0;
+#ifdef SOLARIS
+ times.tm_isdst = -1;
+#else
+ times.tm_isdst = 0;
+#endif
+
+ time_t time = mktime (&times);
+
+ if (time != (time_t) -1)
+ {
+ struct utimbuf u_time;
+ u_time.actime = time;
+ u_time.modtime = time;
+ utime (ByteString(rFileName, osl_getThreadTextEncoding()).GetBuffer(), &u_time);
+ }
+}
+
+//=========================================================================
+
+ErrCode FileStat::QueryDiskSpace( const String &rPath,
+ BigInt &rFreeBytes, BigInt &rTotalBytes )
+{
+ return ERRCODE_IO_NOTSUPPORTED;
+}
+
+//=========================================================================
+
+void FSysEnableSysErrorBox( BOOL bEnable )
+{
+}
+
diff --git a/tools/source/fsys/unx.hxx b/tools/source/fsys/unx.hxx
new file mode 100644
index 000000000000..2751289b7c2e
--- /dev/null
+++ b/tools/source/fsys/unx.hxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: unx.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _unx_hxx
+#define _unx_hxx
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifndef S390
+#include <sys/param.h>
+#endif
+
+#include <dirent.h>
+#include <unistd.h>
+/* #include <sysent.h> */
+
+#define FSYS_UNIX TRUE
+#define DRIVE_EXISTS(c) ( TRUE )
+
+#define _mkdir(p) mkdir(p, 0777)
+#define _rmdir rmdir
+#define _chdir chdir
+#define _unlink unlink
+#define _getcwd getcwd
+#define _access access
+
+#ifdef SYSV3
+#define DEFSTYLE FSYS_STYLE_SYSV
+#else
+#define DEFSTYLE FSYS_STYLE_BSD
+#endif
+
+#define CMP_LOWER(s) (s)
+#define TEMPNAME() tmpnam(0)
+#define LOWER(aString) (aString.Lower())
+
+#include <time.h>
+#include <datetime.hxx>
+
+#ifndef localtime_r
+extern "C" {
+struct tm *localtime_r(const time_t *timep, struct tm *buffer);
+}
+#endif
+
+inline Time Unx2Time( time_t nTime )
+{
+ tm atm;
+ tm *pTime;
+ pTime = localtime_r( &nTime, &atm );
+ return Time( pTime->tm_hour,
+ pTime->tm_min,
+ pTime->tm_sec );
+}
+
+inline Date Unx2Date( time_t nDate )
+{
+ tm atm;
+ tm *pTime;
+ pTime = localtime_r( &nDate, &atm );
+ return Date( pTime->tm_mday,
+ pTime->tm_mon + 1,
+ pTime->tm_year + 1900 );
+}
+
+inline void Unx2DateAndTime( time_t nDate, Time& rTime, Date& rDate )
+{
+ tm atm;
+ tm *pTime;
+ pTime = localtime_r( &nDate, &atm );
+ rTime = Time( pTime->tm_hour, pTime->tm_min, pTime->tm_sec );
+ rDate = Date( pTime->tm_mday, pTime->tm_mon + 1, pTime->tm_year + 1900 );
+}
+
+const char* TempDirImpl( char *pBuf );
+
+#define FSysFailOnErrorImpl()
+
+#endif
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
new file mode 100644
index 000000000000..e3c937c5a7d4
--- /dev/null
+++ b/tools/source/fsys/urlobj.cxx
@@ -0,0 +1,5021 @@
+/*************************************************************************
+ *
+ * $RCSfile: urlobj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define min min // fool <tools/solar.h>...
+#define max max // fool <tools/solar.h>...
+
+#ifndef _URLOBJ_HXX
+#include <urlobj.hxx>
+#endif
+
+#include <limits>
+
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef TOOLS_INETMIME_HXX
+#include <inetmime.hxx>
+#endif
+#ifndef _TOOLS_INTN_HXX
+#include <intn.hxx>
+#endif
+
+namespace unnamed_tools_urlobj {} using namespace unnamed_tools_urlobj;
+ // unnamed namespaces don't work well yet...
+
+//============================================================================
+//
+// INetURLObject
+//
+//============================================================================
+
+/* The URI grammar (using RFC 2234 conventions).
+
+ Constructs of the form
+ {reference <rule1> using rule2}
+ stand for a rule matching the given rule1 specified in the given reference,
+ encoded to URI syntax using rule2 (as specified in this URI grammar).
+
+
+ ; RFC 1738, RFC 2396, RFC 2732, private
+ login = [user [":" password] "@"] hostport
+ user = *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ";" / "=" / "_" / "~")
+ password = *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ";" / "=" / "_" / "~")
+ hostport = host [":" port]
+ host = incomplete-hostname / hostname / IPv4address / IPv6reference
+ incomplete-hostname = *(domainlabel ".") domainlabel
+ hostname = *(domainlabel ".") toplabel ["."]
+ domainlabel = alphadigit [*(alphadigit / "-") alphadigit]
+ toplabel = ALPHA [*(alphadigit / "-") alphadigit]
+ alphadigit = ALPHA / DIGIT
+ IPv4address = 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
+ IPv6reference = "[" hexpart [":" IPv4address] "]"
+ hexpart = (hexseq ["::" [hexseq]]) / ("::" [hexseq])
+ hexseq = hex4 *(":" hex4)
+ hex4 = 1*4HEXDIG
+ port = *DIGIT
+ escaped = "%" HEXDIG HEXDIG
+ reserved = "$" / "&" / "+" / "," / "/" / ":" / ";" / "=" / "?" / "@" / "[" / "]"
+ mark = "!" / "'" / "(" / ")" / "*" / "-" / "." / "_" / "~"
+ alphanum = ALPHA / DIGIT
+ unreserved = alphanum / mark
+ uric = escaped / reserved / unreserved
+ pchar = escaped / unreserved / "$" / "&" / "+" / "," / ":" / "=" / "@"
+
+
+ ; RFC 1738, RFC 2396
+ ftp-url = "FTP://" login ["/" segment *("/" segment) [";TYPE=" ("A" / "D" / "I")]]
+ segment = *pchar
+
+
+ ; RFC 1738, RFC 2396
+ http-url = "HTTP://" hostport ["/" segment *("/" segment) ["?" *uric]]
+ segment = *(pchar / ";")
+
+
+ ; RFC 1738, RFC 2396
+ file-url = "FILE://" [host / "LOCALHOST"] ["/" segment *("/" segment)]
+ segment = *pchar
+
+
+ ; RFC 2368, RFC 2396
+ mailto-url = "MAILTO:" [to] [headers]
+ to = {RFC 822 <#mailbox> using *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "@" / "_" / "~")}
+ headers = "?" header *("&" header)
+ header = hname "=" hvalue
+ hname = {RFC 822 <field-name> using *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "@" / "_" / "~")} / "BODY"
+ hvalue = {RFC 822 <field-body> using *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "@" / "_" / "~")}
+
+
+ ; private (see RFC 1738)
+ news-url = "NEWS://" login ["/" (group / message)]
+ group = *uric
+ message = "<" *uric ">"
+
+
+ ; private
+ private-url = "PRIVATE:" path ["?" *uric]
+ path = *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~"
+
+
+ ; private
+ https-url = "HTTPS://" hostport ["/" segment *("/" segment) ["?" *uric]]
+ segment = *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~")
+
+
+ ; private
+ slot-url = "SLOT:" path ["?" *uric]
+ path = *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~"
+
+
+ ; private
+ macro-url = "MACRO:" path ["?" *uric]
+ path = *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~"
+
+
+ ; private
+ javascript-url = "JAVASCRIPT:" *uric
+
+
+ ; private (see RFC 2192)
+ imap-url = "IMAP://" user [";AUTH=" auth] "@" hostport "/" segment *("/" segment) ["/;UID=" nz_number]
+ user = 1*{RFC 2060 <CHAR8> using (escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "=" / "_" / "~")}
+ auth = {RFC 2060 <atom> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "+" / "," / "-" / "." / "=" / "_" / "~")}
+ segment = *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / "=" / "@" / "_" / "~")
+ nz_number = {RFC 2060 <nz_number> using *DIGIT}
+
+
+ ; private
+ pop3-url = "POP3://" login ["/" ["<" *uric ">"]]
+
+
+ ; RFC 2397
+ data-url = "DATA:" [mediatype] [";BASE64"] "," *uric
+ mediatype = [type "/" subtype] *(";" attribute "=" value)
+ type = {RFC 2045 <type> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / ":" / "?" / "@" / "_" / "~")}
+ subtype = {RFC 2045 <subtype> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / ":" / "?" / "@" / "_" / "~")}
+ attribute = {RFC 2045 <subtype> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / ":" / "?" / "@" / "_" / "~")}
+ value = {RFC 2045 <subtype> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / ":" / "?" / "@" / "_" / "~")}
+
+
+ ; RFC 2392, RFC 2396
+ cid-url = "CID:" {RFC 822 <addr-spec> using *uric}
+
+
+ ; private
+ out-url = "OUT:///~" name ["/" *uric]
+ name = *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "?" / "@" / "_" / "~"
+
+
+ ; private
+ vim-url = "VIM://" +vimc [":" *vimc] ["/" [("INBOX" message) / ("NEWSGROUPS" ["/" [+vimc message]])]]
+ message = ["/" [+vimc [":" +DIGIT "." +DIGIT "." +DIGIT]]]
+ vimc = ("=" HEXDIG HEXDIG) / ALPHA / DIGIT
+
+
+ ; private
+ uno-url = ".UNO:" *uric
+
+
+ ; private
+ component-url = ".COMPONENT:" path ["?" *uric]
+ path = *(escaped / ALPHA / DIGIT / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~"
+
+
+ ; RFC 2255
+ ldap-url = "LDAP://" [hostport] ["/" [dn ["?" [attrdesct *("," attrdesc)] ["?" ["base" / "one" / "sub"] ["?" [filter] ["?" extension *("," extension)]]]]]]
+ dn = {RFC 2253 <distinguishedName> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~")}
+ attrdesc = {RFC 2251 <AttributeDescription> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~")}
+ filter = {RFC 2254 <filter> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~")}
+ extension = ["!"] ["X-"] extoken ["=" exvalue]
+ extoken = {RFC 2252 <oid> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / "/" / ":" / ";" / "@" / "_" / "~")}
+ exvalue = {RFC 2251 <LDAPString> using *(escaped / ALPHA / DIGIT / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "-" / "." / "/" / ":" / ";" / "=" / "@" / "_" / "~")}
+
+
+ ; private
+ db-url = "DB:" *uric
+ */
+
+//============================================================================
+inline sal_Int32 INetURLObject::SubString::clear()
+{
+ sal_Int32 nDelta = -m_nLength;
+ m_nBegin = STRING_NOTFOUND;
+ m_nLength = 0;
+ return nDelta;
+}
+
+//============================================================================
+inline sal_Int32 INetURLObject::SubString::set(UniString & rString,
+ UniString const & rSubString)
+{
+ DBG_ASSERT(isPresent(), "INetURLObject::SubString::set(): Not present");
+ sal_Int32 nDelta = rSubString.Len() - m_nLength;
+ rString.Replace(m_nBegin, m_nLength, rSubString);
+ m_nLength = rSubString.Len();
+ return nDelta;
+}
+
+//============================================================================
+inline sal_Int32 INetURLObject::SubString::set(UniString & rString,
+ UniString const & rSubString,
+ xub_StrLen nTheBegin)
+{
+ m_nBegin = nTheBegin;
+ return set(rString, rSubString);
+}
+
+//============================================================================
+inline void INetURLObject::SubString::operator +=(sal_Int32 nDelta)
+{
+ if (isPresent())
+ m_nBegin += nDelta;
+}
+
+//============================================================================
+bool INetURLObject::SubString::equals(SubString const & rOther,
+ UniString const & rThisString,
+ UniString const & rOtherString) const
+{
+ if (m_nLength != rOther.m_nLength)
+ return true;
+ sal_Unicode const * p1 = rThisString.GetBuffer() + m_nBegin;
+ sal_Unicode const * p1End = p1 + m_nLength;
+ sal_Unicode const * p2 = rOtherString.GetBuffer() + rOther.m_nBegin;
+ while (p1 != p1End)
+ if (*p1++ != *p2++)
+ return false;
+ return true;
+}
+
+//============================================================================
+struct INetURLObject::SchemeInfo
+{
+ sal_Char const * m_pScheme;
+ sal_Char const * m_pPrefix;
+ sal_uInt16 m_nDefaultPort;
+ bool m_bAuthority;
+ bool m_bUser;
+ bool m_bAuth;
+ bool m_bPassword;
+ bool m_bHost;
+ bool m_bPort;
+ bool m_bHierarchical;
+ bool m_bQuery;
+};
+
+//============================================================================
+struct INetURLObject::PrefixInfo
+{
+ enum Kind { OFFICIAL, EXTERNAL, INTERNAL };
+
+ sal_Char const * m_pPrefix;
+ sal_Char const * m_pTranslatedPrefix;
+ INetProtocol m_eScheme;
+ Kind m_eKind;
+};
+
+//============================================================================
+// static
+
+static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
+ = { { "", "", 0, false, false, false, false, false, false, false,
+ false },
+ { "ftp", "ftp://", 21, true, true, false, true, true, true, true,
+ false },
+ { "http", "http://", 80, true, false, false, false, true, true,
+ true, true },
+ { "file", "file://", 0, true, false, false, false, true, false,
+ true, false },
+ { "mailto", "mailto:", 0, false, false, false, false, false,
+ false, false, true },
+ { 0, 0, 0, false, false, false, false, false, false, false,
+ false },
+ { "news", "news:", 119, true, true, false, true, true, true,
+ false, false },
+ { "private", "private:", 0, false, false, false, false, false,
+ false, false, true },
+ { 0, 0, 0, false, false, false, false, false, false, false,
+ false },
+ { "https", "https://", 443, true, false, false, false, true, true,
+ true, true },
+ { "slot", "slot:", 0, false, false, false, false, false, false,
+ false, true },
+ { "macro", "macro:", 0, false, false, false, false, false, false,
+ false, true },
+ { "javascript", "javascript:", 0, false, false, false, false,
+ false, false, false, false },
+ { "imap", "imap://", 143, true, true, true, false, true, true,
+ true, false },
+ { "pop3", "pop3://", 110, true, true, false, true, true, true,
+ false, false },
+ { "data", "data:", 0, false, false, false, false, false, false,
+ false, false },
+ { "cid", "cid:", 0, false, false, false, false, false, false,
+ false, false },
+ { "out", "out://", 0, true, false, false, false, false, false,
+ false, false },
+ { 0, 0, 0, false, false, false, false, false, false, false,
+ false },
+ { 0, 0, 0, false, false, false, false, false, false, false,
+ false },
+ { "vim", "vim://", 0, true, true, false, true, false, false, true,
+ false },
+ { ".uno", ".uno:", 0, false, false, false, false, false, false,
+ false, false },
+ { ".component", ".component:", 0, false, false, false, false,
+ false, false, false, true },
+ { 0, 0, 0, false, false, false, false, false, false, false,
+ false },
+ { "ldap", "ldap://", 389, true, false, false, false, true, true,
+ false, true },
+ { "db", "db:", 0, false, false, false, false, false, false, false,
+ false },
+ { 0, 0, 0, false, false, false, false, false, false, false,
+ false } };
+
+inline INetURLObject::SchemeInfo const &
+INetURLObject::getSchemeInfo(INetProtocol eTheScheme)
+{
+ return aSchemeInfoMap[eTheScheme];
+};
+
+//============================================================================
+inline INetURLObject::SchemeInfo const & INetURLObject::getSchemeInfo() const
+{
+ return getSchemeInfo(m_eScheme);
+}
+
+//============================================================================
+// static
+inline void INetURLObject::appendEscape(UniString & rTheText,
+ sal_Char cEscapePrefix,
+ sal_uInt32 nOctet)
+{
+ rTheText += cEscapePrefix;
+ rTheText += sal_Unicode(INetMIME::getHexDigit(int(nOctet >> 4)));
+ rTheText += sal_Unicode(INetMIME::getHexDigit(int(nOctet & 15)));
+}
+
+//============================================================================
+// static
+inline void INetURLObject::appendUTF32(UniString & rTheText,
+ sal_uInt32 nUTF32)
+{
+ DBG_ASSERT(nUTF32 <= 0x10FFFF, "INetURLObject::appendUTF32(): Bad char");
+ if (nUTF32 < 0x10000)
+ rTheText += sal_Unicode(nUTF32);
+ else
+ {
+ nUTF32 -= 0x10000;
+ rTheText += sal_Unicode(0xD800 | nUTF32 >> 10);
+ rTheText += sal_Unicode(0xDC00 | nUTF32 & 0x3FF);
+ }
+}
+
+//============================================================================
+namespace unnamed_tools_urlobj {
+
+enum
+{
+ pA = INetURLObject::PART_OBSOLETE_NORMAL,
+ pB = INetURLObject::PART_OBSOLETE_FILE,
+ pC = INetURLObject::PART_OBSOLETE_PARAM,
+ pD = INetURLObject::PART_USER_PASSWORD,
+ pE = INetURLObject::PART_IMAP_ACHAR,
+ pF = INetURLObject::PART_VIM,
+ pG = INetURLObject::PART_HOST_EXTRA,
+ pH = INetURLObject::PART_FPATH,
+ pI = INetURLObject::PART_AUTHORITY,
+ pJ = INetURLObject::PART_PATH_SEGMENTS_EXTRA,
+ pK = INetURLObject::PART_REL_SEGMENT_EXTRA,
+ pL = INetURLObject::PART_URIC,
+ pM = INetURLObject::PART_HTTP_PATH,
+ pN = INetURLObject::PART_FILE_SEGMENT_EXTRA,
+ pO = INetURLObject::PART_MESSAGE_ID,
+ pP = INetURLObject::PART_MESSAGE_ID_PATH,
+ pQ = INetURLObject::PART_MAILTO,
+ pR = INetURLObject::PART_PATH_BEFORE_QUERY,
+ pS = INetURLObject::PART_PCHAR,
+ pT = INetURLObject::PART_FRAGMENT,
+ pU = INetURLObject::PART_VISIBLE,
+ pV = INetURLObject::PART_VISIBLE_NONSPECIAL,
+ pW = INetURLObject::PART_CREATEFRAGMENT,
+ pX = INetURLObject::PART_UNO_PARAM_VALUE,
+ pY = INetURLObject::PART_UNAMBIGUOUS
+};
+static sal_uInt32 const aMustEncodeMap[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,
+/* */ pY,
+/* ! */ pC+pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* " */ pU+pV+pY,
+/* # */ pU,
+/* $ */ pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* % */ pU,
+/* & */ pA+pB+pC+pD+pE+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pR+pS+pT+pU+pV+pW+pX,
+/* ' */ pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* ( */ pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* ) */ pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* * */ pA+pB+pC+pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* + */ pA+pB+pC+pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX,
+/* , */ pA+pB+pC+pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW,
+/* - */ pA+pB+pC+pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* . */ pA+pB+pC+pD+pE+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* / */ pA+pB+pC+pH+pJ+pL+pM+pP+pQ+pR+pT+pU+pV+pX,
+/* 0 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 1 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 2 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 3 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 4 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 5 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 6 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 7 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 8 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* 9 */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* : */ pB+pC+pH+pI+pJ+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX,
+/* ; */ pC+pD+pI+pJ+pK+pL+pM+pO+pP+pQ+pR+pT+pU+pW,
+/* < */ pC+pO+pP+pU+pV+pY,
+/* = */ pA+pB+pC+pD+pE+pH+pI+pJ+pK+pL+pM+pN+pR+pS+pT+pU+pV+pW,
+/* > */ pC+pO+pP+pU+pV+pY,
+/* ? */ pC+pL+pT+pU+pW+pX,
+/* @ */ pC+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* A */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* B */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* C */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* D */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* E */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* F */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* G */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* H */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* I */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* J */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* K */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* L */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* M */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* N */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* O */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* P */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* Q */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* R */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* S */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* T */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* U */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* V */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* W */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* X */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* Y */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* Z */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* [ */ pL+pU+pV+pX,
+/* \ */ pB+pU+pV+pY,
+/* ] */ pL+pU+pV+pX,
+/* ^ */ pU+pV+pY,
+/* _ */ pA+pB+pC+pD+pE +pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* ` */ +pU+pV+pY,
+/* a */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* b */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* c */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* d */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* e */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* f */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* g */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* h */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* i */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* j */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* k */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* l */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* m */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* n */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* o */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* p */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* q */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* r */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* s */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* t */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* u */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* v */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* w */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* x */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* y */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* z */ pA+pB+pC+pD+pE+pF+pG+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* { */ +pU+pV+pY,
+/* | */ pB+pC+pN+pT+pU+pV+pY,
+/* } */ +pU+pV+pY,
+/* ~ */ pA+pB+pC+pD+pE+pH+pI+pJ+pK+pL+pM+pN+pO+pP+pQ+pR+pS+pT+pU+pV+pW+pX+pY,
+/* */ 0 };
+
+inline bool mustEncode(sal_uInt32 nUTF32, INetURLObject::Part ePart)
+{
+ return !INetMIME::isUSASCII(nUTF32) || !(aMustEncodeMap[nUTF32] & ePart);
+}
+
+}
+
+//============================================================================
+void INetURLObject::setInvalid()
+{
+ m_aAbsURIRef.Erase();
+ m_eScheme = INET_PROT_NOT_VALID;
+ m_aUser.clear();
+ m_aAuth.clear();
+ m_aHost.clear();
+ m_aPort.clear();
+ m_aPath.clear();
+ m_aQuery.clear();
+ m_aFragment.clear();
+}
+
+//============================================================================
+
+namespace unnamed_tools_urlobj {
+
+INetURLObject::FSysStyle
+guessFSysStyleByCounting(sal_Unicode const * pBegin,
+ sal_Unicode const * pEnd,
+ INetURLObject::FSysStyle eStyle)
+{
+ DBG_ASSERT(eStyle
+ & (INetURLObject::FSYS_UNX
+ | INetURLObject::FSYS_DOS
+ | INetURLObject::FSYS_MAC),
+ "guessFSysStyleByCounting(): Bad style");
+ DBG_ASSERT(std::numeric_limits< sal_Int32 >::min() < pBegin - pEnd
+ && pEnd - pBegin <= std::numeric_limits< sal_Int32 >::max(),
+ "guessFSysStyleByCounting(): Too big");
+ sal_Int32 nSlashCount
+ = eStyle & INetURLObject::FSYS_UNX ?
+ 0 : std::numeric_limits< sal_Int32 >::min();
+ sal_Int32 nBackslashCount
+ = eStyle & INetURLObject::FSYS_DOS ?
+ 0 : std::numeric_limits< sal_Int32 >::min();
+ sal_Int32 nColonCount
+ = eStyle & INetURLObject::FSYS_MAC ?
+ 0 : std::numeric_limits< sal_Int32 >::min();
+ while (pBegin != pEnd)
+ switch (*pBegin++)
+ {
+ case '/':
+ ++nSlashCount;
+ break;
+
+ case '\\':
+ ++nBackslashCount;
+ break;
+
+ case ':':
+ ++nColonCount;
+ break;
+ }
+ return nSlashCount >= nBackslashCount ?
+ nSlashCount >= nColonCount ?
+ INetURLObject::FSYS_UNX : INetURLObject::FSYS_MAC :
+ nBackslashCount >= nColonCount ?
+ INetURLObject::FSYS_DOS : INetURLObject::FSYS_MAC;
+}
+
+}
+
+bool INetURLObject::setAbsURIRef(UniString const & rTheAbsURIRef,
+ bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ bool bSmart,
+ FSysStyle eStyle)
+{
+ sal_Unicode const * pPos = rTheAbsURIRef.GetBuffer();
+ sal_Unicode const * pEnd = pPos + rTheAbsURIRef.Len();
+
+ setInvalid();
+
+ sal_uInt32 nFragmentDelimiter = '#';
+
+ UniString aSynAbsURIRef;
+
+ // Parse <scheme>:
+ sal_Unicode const * p = pPos;
+ PrefixInfo const * pPrefix = getPrefix(p, pEnd);
+ if (pPrefix)
+ {
+ pPos = p;
+ m_eScheme = pPrefix->m_eScheme;
+ aSynAbsURIRef
+ = UniString::CreateFromAscii(pPrefix->m_eKind
+ == PrefixInfo::EXTERNAL ?
+ pPrefix->m_pTranslatedPrefix :
+ pPrefix->m_pPrefix);
+ }
+ else
+ {
+ if (bSmart)
+ {
+ // For scheme detection, the first (if any) of the following
+ // productions that matches the input string (and for which the
+ // appropriate style bit is set in eStyle, if applicable)
+ // determines the scheme. The productions use the auxiliary rules
+ //
+ // domain = label *("." label)
+ // label = alphanum [*(alphanum / "-") alphanum]
+ // alphanum = ALPHA / DIGIT
+ // IPv6reference = "[" IPv6address "]"
+ // IPv6address = hexpart [":" IPv4address]
+ // IPv4address = 1*3DIGIT 3("." 1*3DIGIT)
+ // hexpart = (hexseq ["::" [hexseq]]) / ("::" [hexseq])
+ // hexseq = hex4 *(":" hex4)
+ // hex4 = 1*4HEXDIG
+ // UCS4 = <any UCS4 character>
+ //
+ // 1st Production (known scheme):
+ // <one of the known schemes, ignoring case> ":" *UCS4
+ //
+ // 2nd Production (mailto):
+ // domain "@" domain
+ //
+ // 3rd Production (ftp):
+ // "ftp" 2*("." label) ["/" *UCS4]
+ //
+ // 4th Production (http):
+ // label 2*("." label) ["/" *UCS4]
+ //
+ // 5th Production (file):
+ // "//" (domain / IPv6reference) ["/" *UCS4]
+ //
+ // 6th Production (Unix file):
+ // "/" *UCS4
+ //
+ // 7th Production (UNC file; FSYS_DOS only):
+ // "\\" domain ["\" *UCS4]
+ //
+ // 8th Production (Unix-like DOS file; FSYS_DOS only):
+ // ALPHA ":/" *UCS4
+ //
+ // 9th Production (DOS file; FSYS_DOS only):
+ // ALPHA ":\" *UCS4
+ //
+ // For the 'non URL' file productions 6--9, the interpretation of
+ // the input as a (degenerate) URI is turned off, i.e., escape
+ // sequences and fragments are never detected as such, but are
+ // taken as literal characters.
+
+ sal_Unicode const * p = pPos;
+ if (eStyle & FSYS_DOS
+ && pEnd - p >= 3
+ && INetMIME::isAlpha(p[0])
+ && p[1] == ':'
+ && (p[2] == '/' || p[2] == '\\'))
+ {
+ m_eScheme = INET_PROT_FILE; // 8th, 9th
+ eMechanism = ENCODE_ALL;
+ nFragmentDelimiter = 0x80000000;
+ }
+ else if (pEnd - p >= 2 && p[0] == '/' && p[1] == '/')
+ {
+ p += 2;
+ if ((scanDomain(p, pEnd) > 0 || scanIPv6reference(p, pEnd))
+ && (p == pEnd || *p == '/'))
+ m_eScheme = INET_PROT_FILE; // 5th
+ }
+ else if (p != pEnd && *p == '/')
+ {
+ m_eScheme = INET_PROT_FILE; // 6th
+ eMechanism = ENCODE_ALL;
+ nFragmentDelimiter = 0x80000000;
+ }
+ else if (eStyle & FSYS_DOS
+ && pEnd - p >= 2
+ && p[0] == '\\'
+ && p[1] == '\\')
+ {
+ p += 2;
+ if (scanDomain(p, pEnd) > 0 && (p == pEnd || *p == '\\'))
+ {
+ m_eScheme = INET_PROT_FILE; // 7th
+ eMechanism = ENCODE_ALL;
+ nFragmentDelimiter = 0x80000000;
+ }
+ }
+ else
+ {
+ sal_Unicode const * pDomainEnd = p;
+ sal_uInt32 nLabels = scanDomain(pDomainEnd, pEnd);
+ if (nLabels > 0 && pDomainEnd != pEnd && *pDomainEnd == '@')
+ {
+ ++pDomainEnd;
+ if (scanDomain(pDomainEnd, pEnd) > 0
+ && pDomainEnd == pEnd)
+ m_eScheme = INET_PROT_MAILTO; // 2nd
+ }
+ else if (nLabels >= 3
+ && (pDomainEnd == pEnd || *pDomainEnd == '/'))
+ m_eScheme
+ = pDomainEnd - p >= 4
+ && p[0] == 'f'
+ && p[1] == 't'
+ && p[2] == 'p'
+ && p[3] == '.' ?
+ INET_PROT_FTP : INET_PROT_HTTP; // 3rd, 4th
+ }
+
+ if (m_eScheme == INET_PROT_NOT_VALID && pPos != pEnd
+ && *pPos != nFragmentDelimiter)
+ m_eScheme = m_eSmartScheme;
+ }
+
+ if (m_eScheme == INET_PROT_NOT_VALID)
+ {
+ setInvalid();
+ return false;
+ }
+
+ aSynAbsURIRef = UniString::CreateFromAscii(getSchemeInfo().m_pScheme);
+ aSynAbsURIRef += ':';
+ }
+
+ sal_Char cEscapePrefix = getEscapePrefix();
+ sal_uInt32 nSegmentDelimiter = '/';
+ sal_uInt32 nAltSegmentDelimiter = 0x80000000;
+ bool bSkippedInitialSlash = false;
+
+ // Parse //<user>;AUTH=<auth>@<host>:<port> or
+ // //<user>:<password>@<host>:<port>
+ if (getSchemeInfo().m_bAuthority)
+ {
+ aSynAbsURIRef.AppendAscii(RTL_CONSTASCII_STRINGPARAM("//"));
+
+ sal_Unicode const * pUserInfoBegin = 0;
+ sal_Unicode const * pUserInfoEnd = 0;
+ sal_Unicode const * pHostPortBegin = 0;
+ sal_Unicode const * pHostPortEnd = 0;
+
+ switch (m_eScheme)
+ {
+ case INET_PROT_FILE:
+ if (bSmart)
+ {
+ // The first of the following seven productions that
+ // matches the rest of the input string (and for which the
+ // appropriate style bit is set in eStyle, if applicable)
+ // determines the used notation. The productions use the
+ // auxiliary rules
+ //
+ // domain = label *("." label)
+ // label = alphanum [*(alphanum / "-") alphanum]
+ // alphanum = ALPHA / DIGIT
+ // IPv6reference = "[" IPv6address "]"
+ // IPv6address = hexpart [":" IPv4address]
+ // IPv4address = 1*3DIGIT 3("." 1*3DIGIT)
+ // hexpart = (hexseq ["::" [hexseq]]) / ("::" [hexseq])
+ // hexseq = hex4 *(":" hex4)
+ // hex4 = 1*4HEXDIG
+ // path = <any UCS4 character except "#">
+ // UCS4 = <any UCS4 character>
+
+ // 1st Production (URL):
+ // "//" [domain / IPv6reference] ["/" *path]
+ // ["#" *UCS4]
+ // becomes
+ // "file://" domain "/" *path ["#" *UCS4]
+ if (pEnd - pPos >= 2 && pPos[0] == '/' && pPos[1] == '/')
+ {
+ sal_Unicode const * p = pPos + 2;
+ if (p == pEnd || *p == nFragmentDelimiter || *p == '/'
+ || (scanDomain(p, pEnd) > 0
+ || scanIPv6reference(p, pEnd))
+ && (p == pEnd || *p == nFragmentDelimiter
+ || *p == '/'))
+ {
+ pHostPortBegin = pPos + 2;
+ pHostPortEnd = p;
+ pPos = p;
+ break;
+ }
+ }
+
+ // 2nd Production (misscounted slashes):
+ // "//" *path ["#" *UCS4]
+ // becomes
+ // "file:///" *path ["#" *UCS4]
+ if (pEnd - pPos >= 2 && pPos[0] == '/' && pPos[1] == '/')
+ {
+ pPos += 2;
+ bSkippedInitialSlash = true;
+ break;
+ }
+
+ // 3rd Production (Unix):
+ // "/" *path ["#" *UCS4]
+ // becomes
+ // "file:///" *path ["#" *UCS4]
+ if (pPos < pEnd && *pPos == '/')
+ break;
+
+ // 4th Production (UNC; FSYS_DOS only):
+ // "\\" domain ["\" *path] ["#" *UCS4]
+ // becomes
+ // "file://" domain "/" *path ["#" *UCS4]
+ // replacing "\" by "/" within <*path>
+ if (eStyle & FSYS_DOS
+ && pEnd - pPos >= 2
+ && pPos[0] == '\\'
+ && pPos[1] == '\\')
+ {
+ sal_Unicode const * p = pPos + 2;
+ if (scanDomain(p, pEnd) > 0
+ && (p == pEnd || *p == nFragmentDelimiter
+ || *p == '\\'))
+ {
+ pHostPortBegin = pPos + 2;
+ pHostPortEnd = p;
+ pPos = p;
+ nSegmentDelimiter = '\\';
+ break;
+ }
+ }
+
+ // 5th Production (Unix-like DOS; FSYS_DOS only):
+ // ALPHA ":/" *path ["#" *UCS4]
+ // becomes
+ // "file:///" ALPHA ":/" *path ["#" *UCS4]
+ // replacing "\" by "/" within <*path>
+ //
+ // 6th Production (DOS; FSYS_DOS only):
+ // ALPHA ":\" *path ["#" *UCS4]
+ // becomes
+ // "file:///" ALPHA ":/" *path ["#" *UCS4]
+ // replacing "\" by "/" within <*path>
+ if (eStyle & FSYS_DOS
+ && pEnd - pPos >= 3
+ && INetMIME::isAlpha(pPos[0])
+ && pPos[1] == ':'
+ && (pPos[2] == '/' || pPos[2] == '\\'))
+ {
+ nAltSegmentDelimiter = '\\';
+ bSkippedInitialSlash = true;
+ break;
+ }
+
+ // 7th Production (any):
+ // *path ["#" *UCS4]
+ // becomes
+ // "file:///" *path ["#" *UCS4]
+ // replacing the delimiter by "/" within <*path>. The
+ // delimiter is that character from the set { "/", "\",
+ // ":" } which appears most often in <*path> (if FSYS_UNX
+ // is not among the style bits, "/" is removed from the
+ // set; if FSYS_DOS is not among the style bits, "\" is
+ // removed from the set; if FSYS_MAC is not among the
+ // style bits, ":" is removed from the set). If two or
+ // more characters appear the same number of times, the
+ // character mentioned first in that set is chosen. If
+ // the first character of <*path> is the delimiter, that
+ // character is not copied.
+ if (eStyle & (FSYS_UNX | FSYS_DOS | FSYS_MAC))
+ {
+ switch (guessFSysStyleByCounting(pPos, pEnd, eStyle))
+ {
+ case FSYS_UNX:
+ nSegmentDelimiter = '/';
+ break;
+
+ case FSYS_DOS:
+ nSegmentDelimiter = '\\';
+ break;
+
+ case FSYS_MAC:
+ nSegmentDelimiter = ':';
+ break;
+
+ default:
+ DBG_ERROR(
+ "INetURLObject::setAbsURIRef():"
+ " Bad guessFSysStyleByCounting");
+ break;
+ }
+ bSkippedInitialSlash
+ = pPos != pEnd && *pPos != nSegmentDelimiter;
+ break;
+ }
+ }
+ default:
+ {
+ if (pEnd - pPos >= 2 && pPos[0] == '/' && pPos[1] == '/')
+ pPos += 2;
+ else if (!bSmart)
+ {
+ setInvalid();
+ return false;
+ }
+
+ sal_Unicode const * pAuthority = pPos;
+ sal_uInt32 c = getSchemeInfo().m_bQuery ? '?' : 0x80000000;
+ while (pPos < pEnd && *pPos != '/' && *pPos != c
+ && *pPos != nFragmentDelimiter)
+ ++pPos;
+ if (getSchemeInfo().m_bUser)
+ if (getSchemeInfo().m_bHost)
+ {
+ sal_Unicode const * p = pAuthority;
+ while (p < pPos && *p != '@')
+ ++p;
+ if (p == pPos)
+ {
+ pHostPortBegin = pAuthority;
+ pHostPortEnd = pPos;
+ }
+ else
+ {
+ pUserInfoBegin = pAuthority;
+ pUserInfoEnd = p;
+ pHostPortBegin = p + 1;
+ pHostPortEnd = pPos;
+ }
+ }
+ else
+ {
+ pUserInfoBegin = pAuthority;
+ pUserInfoEnd = pPos;
+ }
+ else if (getSchemeInfo().m_bHost)
+ {
+ pHostPortBegin = pAuthority;
+ pHostPortEnd = pPos;
+ }
+ else if (pPos != pAuthority)
+ {
+ setInvalid();
+ return false;
+ }
+ break;
+ }
+ }
+
+ if (pUserInfoBegin)
+ {
+ Part ePart = m_eScheme == INET_PROT_IMAP ?
+ PART_IMAP_ACHAR :
+ m_eScheme == INET_PROT_VIM ?
+ PART_VIM :
+ PART_USER_PASSWORD;
+ bool bSupportsPassword = getSchemeInfo().m_bPassword;
+ bool bSupportsAuth
+ = !bSupportsPassword && getSchemeInfo().m_bAuth;
+ bool bHasAuth = false;
+ UniString aSynUser;
+ sal_Unicode const * p = pUserInfoBegin;
+ while (p < pUserInfoEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(p, pUserInfoEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ if (eEscapeType == ESCAPE_NO)
+ if (nUTF32 == ':' && bSupportsPassword)
+ {
+ bHasAuth = true;
+ break;
+ }
+ else if (nUTF32 == ';' && bSupportsAuth
+ && pUserInfoEnd - p
+ > RTL_CONSTASCII_LENGTH("auth=")
+ && INetMIME::equalIgnoreCase(
+ p,
+ p + RTL_CONSTASCII_LENGTH("auth="),
+ "auth="))
+ {
+ p += RTL_CONSTASCII_LENGTH("auth=");
+ bHasAuth = true;
+ break;
+ }
+ appendUCS4(aSynUser, nUTF32, eEscapeType, bOctets, ePart,
+ cEscapePrefix, eCharset, false);
+ }
+ m_aUser.set(aSynAbsURIRef, aSynUser, aSynAbsURIRef.Len());
+ if (bHasAuth)
+ if (bSupportsPassword)
+ {
+ aSynAbsURIRef += ':';
+ UniString aSynAuth;
+ while (p < pUserInfoEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(p, pUserInfoEnd, bOctets,
+ cEscapePrefix,
+ eMechanism, eCharset,
+ eEscapeType);
+ appendUCS4(aSynAuth, nUTF32, eEscapeType, bOctets,
+ ePart, cEscapePrefix, eCharset, false);
+ }
+ m_aAuth.set(aSynAbsURIRef, aSynAuth, aSynAbsURIRef.Len());
+ }
+ else
+ {
+ aSynAbsURIRef.
+ AppendAscii(RTL_CONSTASCII_STRINGPARAM(";AUTH="));
+ UniString aSynAuth;
+ while (p < pUserInfoEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(p, pUserInfoEnd, bOctets,
+ cEscapePrefix,
+ eMechanism, eCharset,
+ eEscapeType);
+ if (!INetMIME::isIMAPAtomChar(nUTF32))
+ {
+ setInvalid();
+ return false;
+ }
+ appendUCS4(aSynAuth, nUTF32, eEscapeType, bOctets,
+ ePart, cEscapePrefix, eCharset, false);
+ }
+ m_aAuth.set(aSynAbsURIRef, aSynAuth, aSynAbsURIRef.Len());
+ }
+ if (pHostPortBegin)
+ aSynAbsURIRef += '@';
+ }
+
+ if (pHostPortBegin)
+ {
+ sal_Unicode const * pPort = pHostPortEnd;
+ if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd)
+ {
+ sal_Unicode const * p = pHostPortEnd - 1;
+ while (p > pHostPortBegin && INetMIME::isDigit(*p))
+ --p;
+ if (*p == ':')
+ pPort = p;
+ }
+ switch (m_eScheme)
+ {
+ case INET_PROT_FILE:
+ // If the host equals "LOCALHOST" (unencoded and ignoring
+ // case), turn it into an empty host:
+ if (INetMIME::equalIgnoreCase(pHostPortBegin, pPort,
+ "localhost"))
+ pHostPortBegin = pPort;
+ break;
+
+ case INET_PROT_LDAP:
+ if (pHostPortBegin == pPort && pPort != pHostPortEnd)
+ {
+ setInvalid();
+ return false;
+ }
+ break;
+
+ default:
+ if (pHostPortBegin == pPort)
+ {
+ setInvalid();
+ return false;
+ }
+ break;
+ }
+ UniString aSynHost;
+ if (pHostPortBegin != pPort
+ && (!parseHost(pHostPortBegin, pPort, bOctets, eMechanism,
+ eCharset, aSynHost)
+ || pHostPortBegin != pPort))
+ {
+ setInvalid();
+ return false;
+ }
+ m_aHost.set(aSynAbsURIRef, aSynHost, aSynAbsURIRef.Len());
+ if (pPort != pHostPortEnd)
+ {
+ aSynAbsURIRef += ':';
+ m_aPort.set(aSynAbsURIRef,
+ UniString(pPort + 1, pHostPortEnd - (pPort + 1)),
+ aSynAbsURIRef.Len());
+ }
+ }
+ }
+
+ // Parse <path>
+ UniString aSynPath;
+ if (!parsePath(&pPos, pEnd, bOctets, eMechanism, eCharset,
+ bSkippedInitialSlash, nSegmentDelimiter,
+ nAltSegmentDelimiter,
+ getSchemeInfo().m_bQuery ? '?' : 0x80000000,
+ nFragmentDelimiter, &aSynPath))
+ {
+ setInvalid();
+ return false;
+ }
+ m_aPath.set(aSynAbsURIRef, aSynPath, aSynAbsURIRef.Len());
+
+ // Parse ?<query>
+ if (getSchemeInfo().m_bQuery && pPos < pEnd && *pPos == '?')
+ {
+ aSynAbsURIRef += '?';
+ UniString aSynQuery;
+ for (++pPos; pPos < pEnd && *pPos != nFragmentDelimiter;)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets, cEscapePrefix,
+ eMechanism, eCharset, eEscapeType);
+ appendUCS4(aSynQuery, nUTF32, eEscapeType, bOctets,
+ PART_URIC, cEscapePrefix, eCharset, true);
+ }
+ m_aQuery.set(aSynAbsURIRef, aSynQuery, aSynAbsURIRef.Len());
+ }
+
+ // Parse #<fragment>
+ if (pPos < pEnd && *pPos == nFragmentDelimiter)
+ {
+ aSynAbsURIRef += nFragmentDelimiter;
+ UniString aSynFragment;
+ for (++pPos; pPos < pEnd;)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets, cEscapePrefix,
+ eMechanism, eCharset, eEscapeType);
+ appendUCS4(aSynFragment, nUTF32, eEscapeType, bOctets, PART_URIC,
+ cEscapePrefix, eCharset, true);
+ }
+ m_aFragment.set(aSynAbsURIRef, aSynFragment, aSynAbsURIRef.Len());
+ }
+
+ if (pPos != pEnd)
+ {
+ setInvalid();
+ return false;
+ }
+
+ m_aAbsURIRef = aSynAbsURIRef;
+
+ return true;
+}
+
+//============================================================================
+// static
+INetURLObject INetURLObject::m_aBaseURIRef;
+
+//============================================================================
+bool INetURLObject::convertRelToAbs(UniString const & rTheRelURIRef,
+ bool bOctets,
+ INetURLObject & rTheAbsURIRef,
+ bool & rWasAbsolute,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ bool bIgnoreFragment, bool bSmart,
+ bool bRelativeNonURIs, FSysStyle eStyle)
+ const
+{
+ sal_Unicode const * p = rTheRelURIRef.GetBuffer();
+ sal_Unicode const * pEnd = p + rTheRelURIRef.Len();
+
+ sal_Unicode const * pPrefixBegin = p;
+ PrefixInfo const * pPrefix = getPrefix(pPrefixBegin, pEnd);
+
+ sal_uInt32 nSegmentDelimiter = '/';
+ sal_uInt32 nQueryDelimiter
+ = !bSmart || getSchemeInfo().m_bQuery ? '?' : 0x80000000;
+ sal_uInt32 nFragmentDelimiter = '#';
+ Part ePart = PART_VISIBLE;
+
+ if (!pPrefix && bSmart)
+ {
+ // If the input matches any of the following productions (for which
+ // the appropriate style bit is set in eStyle), it is assumed to be an
+ // absolute file system path, rather than a relative URI reference.
+ // (This is only a subset of the productions used for scheme detection
+ // in INetURLObject::setAbsURIRef(), because most of those productions
+ // interfere with the syntax of relative URI references.) The
+ // productions use the auxiliary rules
+ //
+ // domain = label *("." label)
+ // label = alphanum [*(alphanum / "-") alphanum]
+ // alphanum = ALPHA / DIGIT
+ // UCS4 = <any UCS4 character>
+ //
+ // 1st Production (UNC file; FSYS_DOS only):
+ // "\\" domain ["\" *UCS4]
+ //
+ // 2nd Production (Unix-like DOS file; FSYS_DOS only):
+ // ALPHA ":/" *UCS4
+ //
+ // 3rd Production (DOS file; FSYS_DOS only):
+ // ALPHA ":\" *UCS4
+ if (eStyle & FSYS_DOS)
+ {
+ bool bFSys = false;
+ sal_Unicode const * q = p;
+ if (pEnd - q >= 3
+ && INetMIME::isAlpha(q[0])
+ && q[1] == ':'
+ && (q[2] == '/' || q[2] == '\\'))
+ bFSys = true; // 2nd, 3rd
+ else if (pEnd - q >= 2 && q[0] == '\\' && q[1] == '\\')
+ {
+ q += 2;
+ if (scanDomain(q, pEnd) > 0 && (q == pEnd || *q == '\\'))
+ bFSys = true; // 1st
+ }
+ if (bFSys)
+ {
+ INetURLObject aNewURI;
+ aNewURI.setAbsURIRef(rTheRelURIRef, bOctets, eMechanism,
+ eCharset, true, eStyle);
+ if (!aNewURI.HasError())
+ {
+ rTheAbsURIRef = aNewURI;
+ rWasAbsolute = true;
+ return true;
+ }
+ }
+ }
+
+ // When the base URL is a file URL, accept relative file system paths
+ // using "\" or ":" as delimiter (and ignoring URI conventions for "%"
+ // and "#"), as well as relative URIs using "/" as delimiter:
+ if (m_eScheme == INET_PROT_FILE)
+ switch (guessFSysStyleByCounting(p, pEnd, eStyle))
+ {
+ case FSYS_UNX:
+ nSegmentDelimiter = '/';
+ break;
+
+ case FSYS_DOS:
+ nSegmentDelimiter = '\\';
+ bRelativeNonURIs = true;
+ break;
+
+ case FSYS_MAC:
+ nSegmentDelimiter = ':';
+ bRelativeNonURIs = true;
+ break;
+
+ default:
+ DBG_ERROR("INetURLObject::convertRelToAbs():"
+ " Bad guessFSysStyleByCounting");
+ break;
+ }
+
+ if (bRelativeNonURIs)
+ {
+ eMechanism = ENCODE_ALL;
+ nQueryDelimiter = 0x80000000;
+ nFragmentDelimiter = 0x80000000;
+ ePart = PART_VISIBLE_NONSPECIAL;
+ }
+ }
+
+ // If the relative URI has the same scheme as the base URI, and that
+ // scheme is hierarchical, then ignore its presence in the relative
+ // URI in order to be backward compatible (cf. RFC 2396 section 5.2
+ // step 3):
+ if (pPrefix && pPrefix->m_eScheme == m_eScheme
+ && getSchemeInfo().m_bHierarchical)
+ {
+ pPrefix = 0;
+ while (p != pEnd && *p++ != ':');
+ }
+ rWasAbsolute = pPrefix != 0;
+
+ // Fast solution for non-relative URIs:
+ if (pPrefix)
+ {
+ INetURLObject aNewURI(rTheRelURIRef, eMechanism, eCharset);
+ if (aNewURI.HasError())
+ {
+ rWasAbsolute = false;
+ return false;
+ }
+
+ if (bIgnoreFragment)
+ aNewURI.clearFragment();
+ rTheAbsURIRef = aNewURI;
+ return true;
+ }
+
+ UniString aSynAbsURIRef(UniString::CreateFromAscii(getSchemeInfo().
+ m_pScheme));
+ aSynAbsURIRef += ':';
+
+ sal_Char cEscapePrefix = getEscapePrefix();
+
+ enum State { STATE_AUTH, STATE_ABS_PATH, STATE_REL_PATH, STATE_FRAGMENT,
+ STATE_DONE };
+ State eState = STATE_AUTH;
+ bool bSameDoc = true;
+
+ if (getSchemeInfo().m_bAuthority)
+ if (pEnd - p >= 2 && p[0] == '/' && p[1] == '/')
+ {
+ aSynAbsURIRef.AppendAscii(RTL_CONSTASCII_STRINGPARAM("//"));
+ p += 2;
+ eState = STATE_ABS_PATH;
+ bSameDoc = false;
+ while (p != pEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32
+ = getUTF32(p, pEnd, bOctets, cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ if (eEscapeType == ESCAPE_NO)
+ if (nUTF32 == nSegmentDelimiter)
+ break;
+ else if (nUTF32 == nFragmentDelimiter)
+ {
+ eState = STATE_FRAGMENT;
+ break;
+ }
+ appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets,
+ PART_VISIBLE, cEscapePrefix, eCharset, true);
+ }
+ }
+ else
+ {
+ SubString aAuthority(getAuthority());
+ aSynAbsURIRef.Append(m_aAbsURIRef.GetBuffer()
+ + aAuthority.getBegin(),
+ aAuthority.getLength());
+ }
+
+ if (eState == STATE_AUTH)
+ if (p == pEnd)
+ eState = STATE_DONE;
+ else if (*p == nFragmentDelimiter)
+ {
+ ++p;
+ eState = STATE_FRAGMENT;
+ }
+ else if (*p == nSegmentDelimiter)
+ {
+ ++p;
+ eState = STATE_ABS_PATH;
+ bSameDoc = false;
+ }
+ else
+ {
+ eState = STATE_REL_PATH;
+ bSameDoc = false;
+ }
+
+ if (eState == STATE_ABS_PATH)
+ {
+ aSynAbsURIRef += '/';
+ eState = STATE_DONE;
+ while (p != pEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32
+ = getUTF32(p, pEnd, bOctets, cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ if (eEscapeType == ESCAPE_NO)
+ if (nUTF32 == nFragmentDelimiter)
+ {
+ eState = STATE_FRAGMENT;
+ break;
+ }
+ else if (nUTF32 == nSegmentDelimiter)
+ nUTF32 = '/';
+ appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, ePart,
+ cEscapePrefix, eCharset, true);
+ }
+ }
+ else if (eState == STATE_REL_PATH)
+ {
+ if (!getSchemeInfo().m_bHierarchical)
+ {
+ rWasAbsolute = false;
+ return false;
+ }
+
+ sal_Unicode const * pBasePathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pBasePathEnd
+ = pBasePathBegin + m_aPath.getLength();
+ while (pBasePathEnd != pBasePathBegin)
+ if (*(--pBasePathEnd) == '/')
+ {
+ ++pBasePathEnd;
+ break;
+ }
+
+ xub_StrLen nPathBegin = aSynAbsURIRef.Len();
+ aSynAbsURIRef.Append(pBasePathBegin, pBasePathEnd - pBasePathBegin);
+ DBG_ASSERT(aSynAbsURIRef.Len() > nPathBegin
+ && aSynAbsURIRef.GetChar(aSynAbsURIRef.Len() - 1) == '/',
+ "INetURLObject::convertRelToAbs(): Bad base path");
+
+ while (p != pEnd && *p != nQueryDelimiter && *p != nFragmentDelimiter)
+ {
+ if (*p == '.')
+ if (pEnd - p == 1
+ || p[1] == nSegmentDelimiter
+ || p[1] == nQueryDelimiter
+ || p[1] == nFragmentDelimiter)
+ {
+ ++p;
+ if (p != pEnd && *p == nSegmentDelimiter)
+ ++p;
+ continue;
+ }
+ else if (pEnd - p >= 2
+ && p[1] == '.'
+ && (pEnd - p == 2
+ || p[2] == nSegmentDelimiter
+ || p[2] == nQueryDelimiter
+ || p[2] == nFragmentDelimiter)
+ && aSynAbsURIRef.Len() - nPathBegin > 1)
+ {
+ p += 2;
+ if (p != pEnd && *p == nSegmentDelimiter)
+ ++p;
+
+ xub_StrLen i = aSynAbsURIRef.Len() - 2;
+ while (i > nPathBegin && aSynAbsURIRef.GetChar(i) != '/')
+ --i;
+ aSynAbsURIRef.Erase(i + 1);
+ DBG_ASSERT(
+ aSynAbsURIRef.Len() > nPathBegin
+ && aSynAbsURIRef.GetChar(aSynAbsURIRef.Len() - 1)
+ == '/',
+ "INetURLObject::convertRelToAbs(): Bad base path");
+ continue;
+ }
+
+ while (p != pEnd
+ && *p != nSegmentDelimiter
+ && *p != nQueryDelimiter
+ && *p != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32
+ = getUTF32(p, pEnd, bOctets, cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, ePart,
+ cEscapePrefix, eCharset, true);
+ }
+ if (p != pEnd && *p == nSegmentDelimiter)
+ {
+ aSynAbsURIRef += '/';
+ ++p;
+ }
+ }
+
+ while (p != pEnd && *p != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32
+ = getUTF32(p, pEnd, bOctets, cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, ePart,
+ cEscapePrefix, eCharset, true);
+ }
+
+ if (p == pEnd)
+ eState = STATE_DONE;
+ else
+ {
+ ++p;
+ eState = STATE_FRAGMENT;
+ }
+ }
+ else if (bSameDoc)
+ {
+ aSynAbsURIRef.Append(m_aAbsURIRef.GetBuffer() + m_aPath.getBegin(),
+ m_aPath.getLength());
+ if (m_aQuery.isPresent())
+ aSynAbsURIRef.Append(m_aAbsURIRef.GetBuffer()
+ + m_aQuery.getBegin() - 1,
+ m_aQuery.getLength() + 1);
+ }
+
+ if (eState == STATE_FRAGMENT && !bIgnoreFragment)
+ {
+ aSynAbsURIRef += '#';
+ while (p != pEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32
+ = getUTF32(p, pEnd, bOctets, cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets,
+ PART_VISIBLE, cEscapePrefix, eCharset, true);
+ }
+ }
+
+ INetURLObject aNewURI(aSynAbsURIRef);
+ if (aNewURI.HasError())
+ {
+ rWasAbsolute = false;
+ return false;
+ }
+
+ rTheAbsURIRef = aNewURI;
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::convertAbsToRel(UniString const & rTheAbsURIRef,
+ bool bOctets, UniString & rTheRelURIRef,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle) const
+{
+ // Check for hierarchical base URL:
+ if (!getSchemeInfo().m_bHierarchical)
+ {
+ rTheRelURIRef
+ = decode(rTheAbsURIRef,
+ getEscapePrefix(CompareProtocolScheme(rTheAbsURIRef)),
+ eDecodeMechanism, eCharset);
+ return false;
+ }
+
+ // Convert the input (absolute URI ref, relative URI ref, file path) to an
+ // absolute URI ref:
+ INetURLObject aSubject;
+ bool bWasAbsolute;
+ if (!convertRelToAbs(rTheAbsURIRef, bOctets, aSubject, bWasAbsolute,
+ eEncodeMechanism, eCharset, false, true, false,
+ eStyle))
+ {
+ rTheRelURIRef
+ = decode(rTheAbsURIRef,
+ getEscapePrefix(CompareProtocolScheme(rTheAbsURIRef)),
+ eDecodeMechanism, eCharset);
+ return false;
+ }
+
+ // Check for differing scheme or authority parts:
+ if (m_eScheme != aSubject.m_eScheme
+ || !m_aUser.equals(aSubject.m_aUser, m_aAbsURIRef,
+ aSubject.m_aAbsURIRef)
+ || !m_aAuth.equals(aSubject.m_aAuth, m_aAbsURIRef,
+ aSubject.m_aAbsURIRef)
+ || !m_aHost.equals(aSubject.m_aHost, m_aAbsURIRef,
+ aSubject.m_aAbsURIRef)
+ || !m_aPort.equals(aSubject.m_aPort, m_aAbsURIRef,
+ aSubject.m_aAbsURIRef))
+ {
+ rTheRelURIRef = aSubject.GetMainURL(eDecodeMechanism, eCharset);
+ return false;
+ }
+
+ sal_Unicode const * pBasePathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pBasePathEnd = pBasePathBegin + m_aPath.getLength();
+ sal_Unicode const * pSubjectPathBegin
+ = aSubject.m_aAbsURIRef.GetBuffer() + aSubject.m_aPath.getBegin();
+ sal_Unicode const * pSubjectPathEnd
+ = pSubjectPathBegin + aSubject.m_aPath.getLength();
+
+ // Make nMatch point past the last matching slash, or past the end of the
+ // paths, in case they are equal:
+ sal_Unicode const * pSlash = 0;
+ sal_Unicode const * p1 = pBasePathBegin;
+ sal_Unicode const * p2 = pSubjectPathBegin;
+ for (;;)
+ {
+ if (p1 == pBasePathEnd || p2 == pSubjectPathEnd)
+ {
+ if (p1 == pBasePathEnd && p2 == pSubjectPathEnd)
+ pSlash = p1;
+ break;
+ }
+
+ sal_Unicode c = *p1++;
+ if (c != *p2++)
+ break;
+ if (c == '/')
+ pSlash = p1;
+ }
+ if (!pSlash)
+ {
+ // One of the paths does not start with '/':
+ rTheRelURIRef = aSubject.GetMainURL(eDecodeMechanism, eCharset);
+ return false;
+ }
+ sal_uInt32 nMatch = pSlash - pBasePathBegin;
+
+ // For file URLs, if the common prefix of the two paths is only "/" (which
+ // covers different DOS volumes like "/a:" and "/b:"), the subject is not
+ // made relative (it could be, but some people don't like that):
+ if (m_eScheme == INET_PROT_FILE && nMatch <= 1)
+ {
+ rTheRelURIRef = aSubject.GetMainURL(eDecodeMechanism, eCharset);
+ return false;
+ }
+
+ // For every slash in the base path after nMatch, a prefix of "../" is
+ // added to the new relative URL (if the common prefix of the two paths is
+ // only "/"---but see handling of file URLs above---, the complete subject
+ // path could go into the new relative URL instead, but some people don't
+ // like that):
+ UniString aSynRelURIRef;
+// if (nMatch <= 1) nMatch = 0; else // see comment above
+ for (sal_Unicode const * p = pBasePathBegin + nMatch; p != pBasePathEnd;
+ ++p)
+ {
+ if (*p == '/')
+ aSynRelURIRef.AppendAscii(RTL_CONSTASCII_STRINGPARAM("../"));
+ }
+
+ // If the new relative URL would start with "//" (i.e., it would be
+ // mistaken for a relative URL starting with an authority part), or if the
+ // new relative URL would neither be empty nor start with <"/"> nor start
+ // with <1*rseg> (i.e., it could be mistaken for an absolute URL starting
+ // with a scheme part), then the new relative URL is prefixed with "./":
+ if (aSynRelURIRef.Len() == 0)
+ if (pSubjectPathEnd - pSubjectPathBegin >= nMatch + 2
+ && pSubjectPathBegin[nMatch] == '/'
+ && pSubjectPathBegin[nMatch + 1] == '/')
+ aSynRelURIRef.AppendAscii(RTL_CONSTASCII_STRINGPARAM("./"));
+ else
+ for (sal_Unicode const * p = pSubjectPathBegin + nMatch;
+ p != pSubjectPathEnd && *p != '/'; ++p)
+ if (mustEncode(*p, PART_REL_SEGMENT_EXTRA))
+ {
+ aSynRelURIRef.
+ AppendAscii(RTL_CONSTASCII_STRINGPARAM("./"));
+ break;
+ }
+
+ // The remainder of the subject path, starting at nMatch, is appended to
+ // the new relative URL:
+ sal_Char cEscapePrefix = getEscapePrefix();
+ aSynRelURIRef += decode(pSubjectPathBegin + nMatch, pSubjectPathEnd,
+ cEscapePrefix, eDecodeMechanism, eCharset);
+
+ // If the subject has defined query or fragment parts, they are appended
+ // to the new relative URL:
+ if (aSubject.m_aQuery.isPresent())
+ {
+ aSynRelURIRef += '?';
+ aSynRelURIRef += aSubject.decode(aSubject.m_aQuery, cEscapePrefix,
+ eDecodeMechanism, eCharset);
+ }
+ if (aSubject.m_aFragment.isPresent())
+ {
+ aSynRelURIRef += '#';
+ aSynRelURIRef += aSubject.decode(aSubject.m_aFragment, cEscapePrefix,
+ eDecodeMechanism, eCharset);
+ }
+
+ rTheRelURIRef = aSynRelURIRef;
+ return true;
+}
+
+//============================================================================
+// static
+bool INetURLObject::convertIntToExt(UniString const & rTheIntURIRef,
+ bool bOctets, UniString & rTheExtURIRef,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset)
+{
+ sal_Char cEscapePrefix
+ = getEscapePrefix(CompareProtocolScheme(rTheIntURIRef));
+ UniString aSynExtURIRef(encodeText(rTheIntURIRef, bOctets, PART_VISIBLE,
+ cEscapePrefix, NOT_CANONIC, eCharset,
+ true));
+ sal_Unicode const * pBegin = aSynExtURIRef.GetBuffer();
+ sal_Unicode const * pEnd = pBegin + aSynExtURIRef.Len();
+ sal_Unicode const * p = pBegin;
+ PrefixInfo const * pPrefix = getPrefix(p, pEnd);
+ bool bConvert = pPrefix && pPrefix->m_eKind == PrefixInfo::INTERNAL;
+ if (bConvert)
+ aSynExtURIRef.
+ Replace(0, p - pBegin,
+ UniString::CreateFromAscii(pPrefix->m_pTranslatedPrefix));
+ rTheExtURIRef = decode(aSynExtURIRef, cEscapePrefix, eDecodeMechanism,
+ eCharset);
+ return bConvert;
+}
+
+//============================================================================
+// static
+bool INetURLObject::convertExtToInt(UniString const & rTheExtURIRef,
+ bool bOctets, UniString & rTheIntURIRef,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset)
+{
+ sal_Char cEscapePrefix
+ = getEscapePrefix(CompareProtocolScheme(rTheExtURIRef));
+ UniString aSynIntURIRef(encodeText(rTheExtURIRef, bOctets, PART_VISIBLE,
+ cEscapePrefix, NOT_CANONIC, eCharset,
+ true));
+ sal_Unicode const * pBegin = aSynIntURIRef.GetBuffer();
+ sal_Unicode const * pEnd = pBegin + aSynIntURIRef.Len();
+ sal_Unicode const * p = pBegin;
+ PrefixInfo const * pPrefix = getPrefix(p, pEnd);
+ bool bConvert = pPrefix && pPrefix->m_eKind == PrefixInfo::EXTERNAL;
+ if (bConvert)
+ aSynIntURIRef.
+ Replace(0, p - pBegin,
+ UniString::CreateFromAscii(pPrefix->m_pTranslatedPrefix));
+ rTheIntURIRef = decode(aSynIntURIRef, cEscapePrefix, eDecodeMechanism,
+ eCharset);
+ return bConvert;
+}
+
+//============================================================================
+// static
+INetURLObject::PrefixInfo const *
+INetURLObject::getPrefix(sal_Unicode const *& rBegin,
+ sal_Unicode const * pEnd)
+{
+ static PrefixInfo const aMap[]
+ = { // dummy entry at front needed, because pLast may point here:
+ { 0, 0, INET_PROT_NOT_VALID, PrefixInfo::INTERNAL },
+ { ".component:", "staroffice.component:", INET_PROT_COMPONENT,
+ PrefixInfo::INTERNAL },
+ { ".uno:", "staroffice.uno:", INET_PROT_UNO,
+ PrefixInfo::INTERNAL },
+ { "cid:", 0, INET_PROT_CID, PrefixInfo::OFFICIAL },
+ { "data:", 0, INET_PROT_DATA, PrefixInfo::OFFICIAL },
+ { "db:", "staroffice.db:", INET_PROT_DB, PrefixInfo::INTERNAL },
+ { "file:", 0, INET_PROT_FILE, PrefixInfo::OFFICIAL },
+ { "ftp:", 0, INET_PROT_FTP, PrefixInfo::OFFICIAL },
+ { "http:", 0, INET_PROT_HTTP, PrefixInfo::OFFICIAL },
+ { "https:", 0, INET_PROT_HTTPS, PrefixInfo::OFFICIAL },
+ { "imap:", 0, INET_PROT_IMAP, PrefixInfo::OFFICIAL },
+ { "javascript:", 0, INET_PROT_JAVASCRIPT, PrefixInfo::OFFICIAL },
+ { "ldap:", 0, INET_PROT_LDAP, PrefixInfo::OFFICIAL },
+ { "macro:", "staroffice.macro:", INET_PROT_MACRO,
+ PrefixInfo::INTERNAL },
+ { "mailto:", 0, INET_PROT_MAILTO, PrefixInfo::OFFICIAL },
+ { "news:", 0, INET_PROT_NEWS, PrefixInfo::OFFICIAL },
+ { "out:", "staroffice.out:", INET_PROT_OUT,
+ PrefixInfo::INTERNAL },
+ { "pop3:", "staroffice.pop3:", INET_PROT_POP3,
+ PrefixInfo::INTERNAL },
+ { "private:", "staroffice.private:", INET_PROT_PRIV_SOFFICE,
+ PrefixInfo::INTERNAL },
+ { "private:factory/", "staroffice.factory:",
+ INET_PROT_PRIV_SOFFICE, PrefixInfo::INTERNAL },
+ { "private:helpid/", "staroffice.helpid:", INET_PROT_PRIV_SOFFICE,
+ PrefixInfo::INTERNAL },
+ { "private:java/", "staroffice.java:", INET_PROT_PRIV_SOFFICE,
+ PrefixInfo::INTERNAL },
+ { "private:searchfolder:", "staroffice.searchfolder:",
+ INET_PROT_PRIV_SOFFICE, PrefixInfo::INTERNAL },
+ { "private:trashcan:", "staroffice.trashcan:",
+ INET_PROT_PRIV_SOFFICE, PrefixInfo::INTERNAL },
+ { "slot:", "staroffice.slot:", INET_PROT_SLOT,
+ PrefixInfo::INTERNAL },
+ { "staroffice.component:", ".component:", INET_PROT_COMPONENT,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.db:", "db:", INET_PROT_DB, PrefixInfo::EXTERNAL },
+ { "staroffice.factory:", "private:factory/",
+ INET_PROT_PRIV_SOFFICE, PrefixInfo::EXTERNAL },
+ { "staroffice.helpid:", "private:helpid/", INET_PROT_PRIV_SOFFICE,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.java:", "private:java/", INET_PROT_PRIV_SOFFICE,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.macro:", "macro:", INET_PROT_MACRO,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.out:", "out:", INET_PROT_OUT,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.pop3:", "pop3:", INET_PROT_POP3,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.private:", "private:", INET_PROT_PRIV_SOFFICE,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.searchfolder:", "private:searchfolder:",
+ INET_PROT_PRIV_SOFFICE, PrefixInfo::EXTERNAL },
+ { "staroffice.slot:", "slot:", INET_PROT_SLOT,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.trashcan:", "private:trashcan:",
+ INET_PROT_PRIV_SOFFICE, PrefixInfo::EXTERNAL },
+ { "staroffice.uno:", ".uno:", INET_PROT_UNO,
+ PrefixInfo::EXTERNAL },
+ { "staroffice.vim:", "vim:", INET_PROT_VIM,
+ PrefixInfo::EXTERNAL },
+ { "staroffice:", "private:", INET_PROT_PRIV_SOFFICE,
+ PrefixInfo::EXTERNAL },
+ { "vim:", "staroffice.vim:", INET_PROT_VIM,
+ PrefixInfo::INTERNAL } };
+ PrefixInfo const * pFirst = aMap + 1;
+ PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1;
+ PrefixInfo const * pMatch = 0;
+ sal_Unicode const * pMatched = rBegin;
+ sal_Unicode const * p = rBegin;
+ xub_StrLen i = 0;
+ for (; pFirst < pLast; ++i)
+ {
+ if (pFirst->m_pPrefix[i] == '\0')
+ {
+ pMatch = pFirst++;
+ pMatched = p;
+ }
+ if (p >= pEnd)
+ break;
+ sal_uInt32 nChar = INetMIME::toLowerCase(*p++);
+ while (pFirst <= pLast && pFirst->m_pPrefix[i] < nChar)
+ ++pFirst;
+ while (pFirst <= pLast && pLast->m_pPrefix[i] > nChar)
+ --pLast;
+ }
+ if (pFirst == pLast)
+ {
+ sal_Char const * q = pFirst->m_pPrefix + i;
+ while (p < pEnd && *q != '\0' && INetMIME::toLowerCase(*p) == *q)
+ {
+ ++p;
+ ++q;
+ }
+ if (*q == '\0')
+ {
+ rBegin = p;
+ return pFirst;
+ }
+ }
+ rBegin = pMatched;
+ return pMatch;
+}
+
+//============================================================================
+INetURLObject::SubString INetURLObject::getAuthority() const
+{
+ DBG_ASSERT(getSchemeInfo().m_bAuthority,
+ "INetURLObject::getAuthority(): Bad scheme");
+
+ xub_StrLen nBegin;
+ if (m_aUser.isPresent())
+ nBegin = m_aUser.getBegin();
+ else if (m_aHost.isPresent())
+ nBegin = m_aHost.getBegin();
+ else
+ nBegin = m_aPath.getBegin();
+ nBegin -= RTL_CONSTASCII_LENGTH("//");
+ DBG_ASSERT(m_aAbsURIRef.GetChar(nBegin) == '/'
+ && m_aAbsURIRef.GetChar(nBegin + 1) == '/',
+ "INetURLObject::getAuthority(): Bad authority");
+
+ xub_StrLen nEnd = m_aPort.isPresent() ? m_aPort.getEnd() :
+ m_aHost.isPresent() ? m_aHost.getEnd() :
+ m_aAuth.isPresent() ? m_aAuth.getEnd() :
+ m_aUser.isPresent() ? m_aUser.getEnd() :
+ nBegin + RTL_CONSTASCII_LENGTH("//");
+ return SubString(nBegin, nEnd - nBegin);
+}
+
+//============================================================================
+bool INetURLObject::setUser(UniString const & rTheUser,
+ bool bOctets, EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ if (!getSchemeInfo().m_bUser
+ || m_eScheme == INET_PROT_IMAP && rTheUser.Len() == 0)
+ return false;
+ UniString aNewUser(encodeText(rTheUser, bOctets,
+ m_eScheme == INET_PROT_IMAP ?
+ PART_IMAP_ACHAR :
+ m_eScheme == INET_PROT_VIM ?
+ PART_VIM :
+ PART_USER_PASSWORD,
+ getEscapePrefix(), eMechanism, eCharset,
+ false));
+ sal_Int32 nDelta;
+ if (m_aUser.isPresent())
+ nDelta = m_aUser.set(m_aAbsURIRef, aNewUser);
+ else if (m_aHost.isPresent())
+ {
+ m_aAbsURIRef.Insert('@', m_aHost.getBegin());
+ nDelta = m_aUser.set(m_aAbsURIRef, aNewUser, m_aHost.getBegin()) + 1;
+ }
+ else if (getSchemeInfo().m_bHost)
+ return false;
+ else
+ nDelta = m_aUser.set(m_aAbsURIRef, aNewUser, m_aPath.getBegin());
+ m_aAuth += nDelta;
+ m_aHost += nDelta;
+ m_aPort += nDelta;
+ m_aPath += nDelta;
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::clearPassword()
+{
+ if (!getSchemeInfo().m_bPassword)
+ return false;
+ if (m_aAuth.isPresent())
+ {
+ m_aAbsURIRef.Erase(m_aAuth.getBegin() - 1, m_aAuth.getLength() + 1);
+ sal_Int32 nDelta = m_aAuth.clear() - 1;
+ m_aHost += nDelta;
+ m_aPort += nDelta;
+ m_aPath += nDelta;
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ }
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::setPassword(UniString const & rThePassword, bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ if (!getSchemeInfo().m_bPassword)
+ return false;
+ UniString aNewAuth(encodeText(rThePassword, bOctets,
+ m_eScheme == INET_PROT_VIM ?
+ PART_VIM : PART_USER_PASSWORD,
+ getEscapePrefix(), eMechanism, eCharset,
+ false));
+ sal_Int32 nDelta;
+ if (m_aAuth.isPresent())
+ nDelta = m_aAuth.set(m_aAbsURIRef, aNewAuth);
+ else if (m_aUser.isPresent())
+ {
+ m_aAbsURIRef.Insert(':', m_aUser.getEnd());
+ nDelta
+ = m_aAuth.set(m_aAbsURIRef, aNewAuth, m_aUser.getEnd() + 1) + 1;
+ }
+ else if (m_aHost.isPresent())
+ {
+ m_aAbsURIRef.InsertAscii(":@", m_aHost.getBegin());
+ m_aUser.set(m_aAbsURIRef, UniString(), m_aHost.getBegin());
+ nDelta
+ = m_aAuth.set(m_aAbsURIRef, aNewAuth, m_aHost.getBegin() + 1) + 2;
+ }
+ else if (getSchemeInfo().m_bHost)
+ return false;
+ else
+ {
+ m_aAbsURIRef.Insert(':', m_aPath.getBegin());
+ m_aUser.set(m_aAbsURIRef, UniString(), m_aPath.getBegin());
+ nDelta
+ = m_aAuth.set(m_aAbsURIRef, aNewAuth, m_aPath.getBegin() + 1) + 1;
+ }
+ m_aHost += nDelta;
+ m_aPort += nDelta;
+ m_aPath += nDelta;
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ return true;
+}
+
+//============================================================================
+// static
+UniString INetURLObject::encodeHostPort(UniString const & rTheHostPort,
+ bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ xub_StrLen nPort = rTheHostPort.Len();
+ if (rTheHostPort.Len() != 0)
+ {
+ xub_StrLen i = rTheHostPort.Len() - 1;
+ while (i != 0 && INetMIME::isDigit(rTheHostPort.GetChar(i)))
+ --i;
+ if (rTheHostPort.GetChar(i) == ':')
+ nPort = i;
+ }
+ UniString aResult(encodeText(rTheHostPort.Copy(0, nPort), bOctets,
+ PART_HOST_EXTRA, '%', eMechanism, eCharset,
+ true));
+ aResult += rTheHostPort.Copy(nPort);
+ return aResult;
+}
+
+//============================================================================
+bool INetURLObject::setHost(UniString const & rTheHost, bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ if (!getSchemeInfo().m_bHost)
+ return false;
+ UniString aSynHost(rTheHost);
+ switch (m_eScheme)
+ {
+ case INET_PROT_FILE:
+ if (aSynHost.EqualsIgnoreCaseAscii("localhost"))
+ aSynHost.Erase();
+ break;
+
+ case INET_PROT_LDAP:
+ if (aSynHost.Len() == 0 && m_aPort.isPresent())
+ return false;
+ break;
+
+ default:
+ if (aSynHost.Len() == 0)
+ return false;
+ break;
+ }
+ if (aSynHost.Len() != 0)
+ {
+ sal_Unicode const * p = aSynHost.GetBuffer();
+ sal_Unicode const * pEnd = p + aSynHost.Len();
+ if (!parseHost(p, pEnd, bOctets, eMechanism, eCharset, aSynHost)
+ || p != pEnd)
+ return false;
+ }
+ sal_Int32 nDelta = m_aHost.set(m_aAbsURIRef, aSynHost);
+ m_aPort += nDelta;
+ m_aPath += nDelta;
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::parsePath(sal_Unicode const ** pBegin,
+ sal_Unicode const * pEnd,
+ bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ bool bSkippedInitialSlash,
+ sal_uInt32 nSegmentDelimiter,
+ sal_uInt32 nAltSegmentDelimiter,
+ sal_uInt32 nQueryDelimiter,
+ sal_uInt32 nFragmentDelimiter,
+ UniString * pSynPath)
+{
+ DBG_ASSERT(pBegin && pSynPath,
+ "INetURLObject::parsePath(): Null output param");
+
+ sal_Char cEscapePrefix = getEscapePrefix();
+
+ sal_Unicode const * pPos = *pBegin;
+ UniString aTheSynPath;
+
+ switch (m_eScheme)
+ {
+ case INET_PROT_NOT_VALID:
+ return false;
+
+ case INET_PROT_FTP:
+ case INET_PROT_IMAP:
+ if (pPos < pEnd && *pPos != '/')
+ {
+ setInvalid();
+ return false;
+ }
+ while (pPos < pEnd && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_HTTP_PATH, cEscapePrefix, eCharset, true);
+ }
+ if (aTheSynPath.Len() == 0)
+ aTheSynPath = '/';
+ break;
+
+ case INET_PROT_HTTP:
+ case INET_PROT_HTTPS:
+ if (pPos < pEnd && *pPos != '/')
+ {
+ setInvalid();
+ return false;
+ }
+ while (pPos < pEnd && *pPos != nQueryDelimiter
+ && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_HTTP_PATH, cEscapePrefix, eCharset, true);
+ }
+ if (aTheSynPath.Len() == 0)
+ aTheSynPath = '/';
+ break;
+
+ case INET_PROT_FILE:
+ {
+ if (bSkippedInitialSlash)
+ aTheSynPath = '/';
+ else if (pPos < pEnd
+ && *pPos != nSegmentDelimiter
+ && *pPos != nAltSegmentDelimiter)
+ {
+ setInvalid();
+ return false;
+ }
+ while (pPos < pEnd && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ if (eEscapeType == ESCAPE_NO)
+ if (nUTF32 == nSegmentDelimiter
+ || nUTF32 == nAltSegmentDelimiter)
+ {
+ aTheSynPath += '/';
+ continue;
+ }
+ else if (nUTF32 == '|'
+ && (pPos == pEnd
+ || *pPos == nFragmentDelimiter
+ || *pPos == nSegmentDelimiter
+ || *pPos == nAltSegmentDelimiter)
+ && aTheSynPath.Len() == 2
+ && INetMIME::isAlpha(aTheSynPath.GetChar(1)))
+ {
+ // A first segment of <ALPHA "|"> is translated to
+ // <ALPHA ":">:
+ aTheSynPath += ':';
+ continue;
+ }
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_PCHAR, cEscapePrefix, eCharset, true);
+ }
+ if (aTheSynPath.Len() == 0)
+ aTheSynPath = '/';
+ break;
+ }
+
+ case INET_PROT_MAILTO:
+ while (pPos < pEnd && *pPos != nQueryDelimiter
+ && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_MAILTO, cEscapePrefix, eCharset, true);
+ }
+ break;
+
+ case INET_PROT_NEWS:
+ case INET_PROT_POP3:
+ while (pPos < pEnd && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_MESSAGE_ID_PATH, cEscapePrefix, eCharset,
+ true);
+ }
+ break;
+
+ case INET_PROT_PRIV_SOFFICE:
+ case INET_PROT_SLOT:
+ case INET_PROT_MACRO:
+ case INET_PROT_COMPONENT:
+ case INET_PROT_LDAP:
+ while (pPos < pEnd && *pPos != nQueryDelimiter
+ && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_PATH_BEFORE_QUERY, cEscapePrefix, eCharset,
+ true);
+ }
+ break;
+
+ case INET_PROT_JAVASCRIPT:
+ case INET_PROT_DATA:
+ case INET_PROT_CID:
+ case INET_PROT_UNO:
+ case INET_PROT_DB:
+ while (pPos < pEnd && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_URIC, cEscapePrefix, eCharset, true);
+ }
+ break;
+
+ case INET_PROT_OUT:
+ if (pEnd - pPos < 2 || *pPos++ != '/' || *pPos++ != '~')
+ {
+ setInvalid();
+ return false;
+ }
+ aTheSynPath.AssignAscii(RTL_CONSTASCII_STRINGPARAM("/~"));
+ while (pPos < pEnd && *pPos != nFragmentDelimiter)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_URIC, cEscapePrefix, eCharset, true);
+ }
+ break;
+
+ case INET_PROT_VIM:
+ {
+ if (m_aUser.isEmpty())
+ {
+ setInvalid();
+ return false;
+ }
+ sal_Unicode const * pPathEnd = pPos;
+ while (pPathEnd < pEnd && *pPathEnd != nFragmentDelimiter)
+ ++pPathEnd;
+ aTheSynPath = '/';
+ if (pPos == pPathEnd)
+ break;
+ else if (*pPos++ != '/')
+ {
+ setInvalid();
+ return false;
+ }
+ if (pPos == pPathEnd)
+ break;
+ while (pPos < pPathEnd && *pPos != '/')
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pPathEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath,
+ eEscapeType == ESCAPE_NO ?
+ INetMIME::toLowerCase(nUTF32) : nUTF32,
+ eEscapeType, bOctets, PART_VIM, cEscapePrefix,
+ eCharset, false);
+ }
+ bool bInbox;
+ if (aTheSynPath.EqualsAscii("/inbox"))
+ bInbox = true;
+ else if (aTheSynPath.EqualsAscii("/newsgroups"))
+ bInbox = false;
+ else
+ {
+ setInvalid();
+ return false;
+ }
+ aTheSynPath += '/';
+ if (pPos == pPathEnd)
+ break;
+ else if (*pPos++ != '/')
+ {
+ setInvalid();
+ return false;
+ }
+ if (!bInbox)
+ {
+ bool bEmpty = true;
+ while (pPos < pPathEnd && *pPos != '/')
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pPathEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_VIM, cEscapePrefix, eCharset, false);
+ bEmpty = false;
+ }
+ if (bEmpty)
+ {
+ setInvalid();
+ return false;
+ }
+ aTheSynPath += '/';
+ if (pPos == pPathEnd)
+ break;
+ else if (*pPos++ != '/')
+ {
+ setInvalid();
+ return false;
+ }
+ }
+ bool bEmpty = true;
+ while (pPos < pPathEnd && *pPos != ':')
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pPathEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets,
+ PART_VIM, cEscapePrefix, eCharset, false);
+ bEmpty = false;
+ }
+ if (bEmpty)
+ {
+ setInvalid();
+ return false;
+ }
+ if (pPos == pPathEnd)
+ break;
+ else if (*pPos++ != ':')
+ {
+ setInvalid();
+ return false;
+ }
+ aTheSynPath += ':';
+ for (int i = 0; i < 3; ++i)
+ {
+ if (i != 0)
+ {
+ if (pPos == pPathEnd || *pPos++ != '.')
+ {
+ setInvalid();
+ return false;
+ }
+ aTheSynPath += '.';
+ }
+ bool bEmpty = true;
+ while (pPos < pPathEnd && *pPos != '.')
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pPos, pPathEnd, bOctets,
+ cEscapePrefix, eMechanism,
+ eCharset, eEscapeType);
+ if (!INetMIME::isDigit(nUTF32))
+ {
+ setInvalid();
+ return false;
+ }
+ aTheSynPath += sal_Unicode(nUTF32);
+ bEmpty = false;
+ }
+ if (bEmpty)
+ {
+ setInvalid();
+ return false;
+ }
+ }
+ if (pPos != pPathEnd)
+ {
+ setInvalid();
+ return false;
+ }
+ break;
+ }
+ }
+
+ *pBegin = pPos;
+ *pSynPath = aTheSynPath;
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::setPath(UniString const & rThePath, bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ UniString aSynPath;
+ sal_Unicode const * p = rThePath.GetBuffer();
+ if (!parsePath(&p, p + rThePath.Len(), bOctets, eMechanism, eCharset,
+ false, '/', 0x80000000, 0x80000000, 0x80000000, &aSynPath))
+ return false;
+ sal_Int32 nDelta = m_aPath.set(m_aAbsURIRef, aSynPath);
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::appendSegment(UniString const & rTheSegment, bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return insertName(rTheSegment, bOctets, false, LAST_SEGMENT, true,
+ eMechanism, eCharset);
+}
+
+//============================================================================
+INetURLObject::SubString INetURLObject::getSegment(sal_Int32 nIndex,
+ bool bIgnoreFinalSlash)
+ const
+{
+ DBG_ASSERT(nIndex >= 0 || nIndex == LAST_SEGMENT,
+ "INetURLObject::getSegment(): Bad index");
+
+ if (!getSchemeInfo().m_bHierarchical)
+ return SubString();
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ if (pPathBegin == pPathEnd || *pPathBegin != '/')
+ return SubString();
+
+ sal_Unicode const * pSegBegin;
+ sal_Unicode const * pSegEnd;
+ if (nIndex == LAST_SEGMENT)
+ {
+ pSegEnd = pPathEnd;
+ if (bIgnoreFinalSlash && pSegEnd[-1] == '/'
+ && pSegEnd != pPathBegin + 1)
+ --pSegEnd;
+ pSegBegin = pSegEnd - 1;
+ while (*pSegBegin != '/')
+ --pSegBegin;
+ }
+ else
+ {
+ pSegBegin = pPathBegin;
+ pSegEnd = pPathEnd;
+ if (bIgnoreFinalSlash && pSegEnd[-1] == '/')
+ --pSegEnd;
+ while (nIndex-- > 0)
+ do
+ {
+ ++pSegBegin;
+ if (pSegBegin >= pSegEnd)
+ return SubString();
+ }
+ while (*pSegBegin != '/');
+ pSegEnd = pSegBegin + 1;
+ while (pSegEnd != pPathEnd && *pSegEnd != '/')
+ ++pSegEnd;
+ }
+
+ return SubString(pSegBegin - m_aAbsURIRef.GetBuffer(),
+ pSegEnd - pSegBegin);
+}
+
+//============================================================================
+bool INetURLObject::insertName(UniString const & rTheName, bool bOctets,
+ bool bAppendFinalSlash, sal_Int32 nIndex,
+ bool bIgnoreFinalSlash,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ DBG_ASSERT(nIndex >= 0 || nIndex == LAST_SEGMENT,
+ "INetURLObject::insertName(): Bad index");
+
+ if (!getSchemeInfo().m_bHierarchical)
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ if (pPathBegin == pPathEnd || *pPathBegin != '/')
+ return false;
+
+ sal_Unicode const * pPrefixEnd;
+ sal_Unicode const * pSuffixBegin;
+ bool bPrefixSlash = true;
+ if (nIndex == LAST_SEGMENT)
+ {
+ pPrefixEnd = pPathEnd;
+ if (bIgnoreFinalSlash && pPrefixEnd[-1] == '/')
+ bPrefixSlash = false;
+ pSuffixBegin = bAppendFinalSlash ? 0 : pPathEnd;
+ }
+ else
+ {
+ pPrefixEnd = pPathBegin;
+ sal_Unicode const * pEnd = pPathEnd;
+ if (bIgnoreFinalSlash && pEnd[-1] == '/')
+ --pEnd;
+ while (nIndex-- > 0)
+ for (;;)
+ {
+ ++pPrefixEnd;
+ if (pPrefixEnd >= pEnd)
+ if (nIndex == 0)
+ {
+ pSuffixBegin = bAppendFinalSlash ? 0 : pPathEnd;
+ break;
+ }
+ else
+ return false;
+ if (*pPrefixEnd == '/')
+ {
+ pSuffixBegin = pPrefixEnd;
+ break;
+ }
+ }
+ }
+
+ UniString aNewPath(pPathBegin, pPrefixEnd - pPathBegin);
+ if (bPrefixSlash)
+ aNewPath += '/';
+ aNewPath += encodeText(rTheName, bOctets, PART_PCHAR, getEscapePrefix(),
+ eMechanism, eCharset, true);
+ if (pSuffixBegin)
+ aNewPath.Append(pSuffixBegin, pPathEnd - pSuffixBegin);
+ else
+ aNewPath += '/';
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+bool INetURLObject::clearQuery()
+{
+ if (HasError())
+ return false;
+ if (m_aQuery.isPresent())
+ {
+ m_aAbsURIRef.Erase(m_aQuery.getBegin() - 1, m_aQuery.getLength() + 1);
+ m_aFragment += m_aQuery.clear() - 1;
+ }
+ return false;
+}
+
+//============================================================================
+bool INetURLObject::setQuery(UniString const & rTheQuery, bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ if (!getSchemeInfo().m_bQuery)
+ return false;
+ UniString aNewQuery(encodeText(rTheQuery, bOctets, PART_URIC,
+ getEscapePrefix(), eMechanism, eCharset,
+ true));
+ sal_Int32 nDelta;
+ if (m_aQuery.isPresent())
+ nDelta = m_aQuery.set(m_aAbsURIRef, aNewQuery);
+ else
+ {
+ m_aAbsURIRef.Insert('?', m_aPath.getEnd());
+ nDelta = m_aQuery.set(m_aAbsURIRef, aNewQuery, m_aPath.getEnd() + 1)
+ + 1;
+ }
+ m_aFragment += nDelta;
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::clearFragment()
+{
+ if (HasError())
+ return false;
+ if (m_aFragment.isPresent())
+ {
+ m_aAbsURIRef.Erase(m_aFragment.getBegin() - 1);
+ m_aFragment.clear();
+ }
+ return true;
+}
+
+//============================================================================
+bool INetURLObject::setFragment(UniString const & rTheFragment, bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ if (HasError())
+ return false;
+ UniString aNewFragment(encodeText(rTheFragment, bOctets, PART_URIC,
+ getEscapePrefix(), eMechanism,
+ eCharset, true));
+ if (m_aFragment.isPresent())
+ m_aFragment.set(m_aAbsURIRef, aNewFragment);
+ else
+ {
+ m_aAbsURIRef.Append('#');
+ m_aFragment.set(m_aAbsURIRef, aNewFragment, m_aAbsURIRef.Len());
+ }
+ return true;
+}
+
+//============================================================================
+INetURLObject::FTPType INetURLObject::getFTPType() const
+{
+ if (m_eScheme == INET_PROT_FTP
+ && m_aPath.getLength() >= RTL_CONSTASCII_LENGTH(";type=") + 1
+ && m_aAbsURIRef.
+ EqualsIgnoreCaseAscii(";type=",
+ m_aPath.getEnd()
+ - (RTL_CONSTASCII_LENGTH(";type=")
+ + 1),
+ RTL_CONSTASCII_LENGTH(";type=")))
+ switch (m_aAbsURIRef.GetChar(m_aPath.getEnd()))
+ {
+ case 'A':
+ case 'a':
+ return FTP_TYPE_A;
+
+ case 'D':
+ case 'd':
+ return FTP_TYPE_D;
+
+ case 'I':
+ case 'i':
+ return FTP_TYPE_I;
+ }
+ return FTP_TYPE_NONE;
+}
+
+//============================================================================
+sal_uInt32 INetURLObject::getIMAPUID() const
+{
+ if (m_eScheme == INET_PROT_IMAP
+ && m_aPath.getLength() >= RTL_CONSTASCII_LENGTH("/;uid=") + 1)
+ {
+ sal_Unicode const * pBegin = m_aAbsURIRef.GetBuffer()
+ + m_aPath.getBegin()
+ + RTL_CONSTASCII_LENGTH("/;uid=");
+ sal_Unicode const * pEnd = pBegin + m_aPath.getLength();
+ sal_Unicode const * p = pEnd;
+ while (p > pBegin && INetMIME::isDigit(p[-1]))
+ --p;
+ if (p < pEnd && *--p != '0'
+ && m_aAbsURIRef.
+ EqualsIgnoreCaseAscii("/;uid=",
+ p - RTL_CONSTASCII_LENGTH("/;uid=")
+ - m_aAbsURIRef.GetBuffer(),
+ RTL_CONSTASCII_LENGTH("/;uid=")))
+ {
+ sal_uInt32 nUID;
+ if (INetMIME::scanUnsigned(p, pEnd, false, nUID))
+ return nUID;
+ }
+ }
+ return 0;
+}
+
+//============================================================================
+// static
+UniString INetURLObject::encodeText(sal_Unicode const * pBegin,
+ sal_Unicode const * pEnd, bool bOctets,
+ Part ePart, sal_Char cEscapePrefix,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ bool bKeepVisibleEscapes)
+{
+ UniString aResult;
+ while (pBegin < pEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pBegin, pEnd, bOctets, cEscapePrefix,
+ eMechanism, eCharset, eEscapeType);
+ appendUCS4(aResult, nUTF32, eEscapeType, bOctets, ePart,
+ cEscapePrefix, eCharset, bKeepVisibleEscapes);
+ }
+ return aResult;
+}
+
+//============================================================================
+// static
+UniString INetURLObject::decode(sal_Unicode const * pBegin,
+ sal_Unicode const * pEnd,
+ sal_Char cEscapePrefix,
+ DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ switch (eMechanism)
+ {
+ case NO_DECODE:
+ return UniString(pBegin, pEnd - pBegin);
+
+ case DECODE_TO_IURI:
+ eCharset = RTL_TEXTENCODING_UTF8;
+ break;
+ }
+ UniString aResult;
+ while (pBegin < pEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(pBegin, pEnd, false, cEscapePrefix,
+ WAS_ENCODED, eCharset, eEscapeType);
+ switch (eEscapeType)
+ {
+ case ESCAPE_NO:
+ aResult += sal_Unicode(nUTF32);
+ break;
+
+ case ESCAPE_OCTET:
+ appendEscape(aResult, cEscapePrefix, nUTF32);
+ break;
+
+ case ESCAPE_UTF32:
+ if (INetMIME::isUSASCII(nUTF32)
+ && (eMechanism == DECODE_TO_IURI
+ || eMechanism == DECODE_UNAMBIGUOUS
+ && mustEncode(nUTF32, PART_UNAMBIGUOUS)))
+ appendEscape(aResult, cEscapePrefix, nUTF32);
+ else
+ aResult += sal_Unicode(nUTF32);
+ break;
+ }
+ }
+ return aResult;
+}
+
+//============================================================================
+UniString INetURLObject::GetURLNoPass(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ INetURLObject aTemp(*this);
+ aTemp.clearPassword();
+ return aTemp.GetMainURL(eMechanism, eCharset);
+}
+
+//============================================================================
+UniString INetURLObject::GetURLNoMark(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ INetURLObject aTemp(*this);
+ aTemp.clearFragment();
+ return aTemp.GetMainURL(eMechanism, eCharset);
+}
+
+//============================================================================
+bool INetURLObject::operator ==(INetURLObject const & rObject) const
+{
+ if (m_eScheme != rObject.m_eScheme)
+ return false;
+ if (m_eScheme == INET_PROT_NOT_VALID)
+ return (m_aAbsURIRef == rObject.m_aAbsURIRef) != false;
+ if (GetUser(NO_DECODE) != rObject.GetUser(NO_DECODE)
+ || GetPass(NO_DECODE) != rObject.GetPass(NO_DECODE)
+ || !GetHost(NO_DECODE).EqualsIgnoreCaseAscii(rObject.
+ GetHost(NO_DECODE))
+ || GetPort() != rObject.GetPort()
+ || HasParam() != rObject.HasParam()
+ || GetParam(NO_DECODE) != rObject.GetParam(NO_DECODE)
+ || GetMsgId(NO_DECODE) != rObject.GetMsgId(NO_DECODE))
+ return false;
+ UniString aPath1(GetURLPath(NO_DECODE));
+ UniString aPath2(rObject.GetURLPath(NO_DECODE));
+ if (m_eScheme == INET_PROT_FILE)
+ {
+ // If the URL paths of two file URLs only differ in that one has a
+ // final '/' and the other has not, take the two paths as equivalent
+ // (this could be usefull for other schemes, too):
+ xub_StrLen nLength = aPath1.Len();
+ switch (sal_Int32(nLength) - sal_Int32(aPath2.Len()))
+ {
+ case -1:
+ if (aPath2.GetChar(nLength) != '/')
+ return false;
+ break;
+
+ case 0:
+ break;
+
+ case 1:
+ if (aPath1.GetChar(--nLength) != '/')
+ return false;
+ break;
+
+ default:
+ return false;
+ }
+ return aPath1.CompareTo(aPath2, nLength) == COMPARE_EQUAL;
+ }
+ else
+ return (aPath1 == aPath2) != false;
+}
+
+//============================================================================
+bool INetURLObject::operator <(INetURLObject const & rObject) const
+{
+ switch (GetScheme(m_eScheme).CompareTo(GetScheme(rObject.m_eScheme)))
+ {
+ case COMPARE_LESS:
+ return true;
+
+ case COMPARE_GREATER:
+ return false;
+ }
+ sal_uInt32 nPort1 = GetPort();
+ sal_uInt32 nPort2 = rObject.GetPort();
+ if (nPort1 < nPort2)
+ return true;
+ else if (nPort1 > nPort2)
+ return false;
+ switch (GetUser(NO_DECODE).CompareTo(rObject.GetUser(NO_DECODE)))
+ {
+ case COMPARE_LESS:
+ return true;
+
+ case COMPARE_GREATER:
+ return false;
+ }
+ switch (GetPass(NO_DECODE).CompareTo(rObject.GetPass(NO_DECODE)))
+ {
+ case COMPARE_LESS:
+ return true;
+
+ case COMPARE_GREATER:
+ return false;
+ }
+ switch (GetHost(NO_DECODE).CompareTo(rObject.GetHost(NO_DECODE)))
+ {
+ case COMPARE_LESS:
+ return true;
+
+ case COMPARE_GREATER:
+ return false;
+ }
+ UniString aPath1(GetURLPath(NO_DECODE));
+ UniString aPath2(rObject.GetURLPath(NO_DECODE));
+ switch (aPath1.CompareTo(aPath2))
+ {
+ case COMPARE_LESS:
+ return true;
+
+ case COMPARE_GREATER:
+ return false;
+ }
+ switch (GetParam(NO_DECODE).CompareTo(rObject.GetParam(NO_DECODE)))
+ {
+ case COMPARE_LESS:
+ return true;
+
+ case COMPARE_GREATER:
+ return false;
+ }
+ return GetMsgId(NO_DECODE).CompareTo(rObject.GetMsgId(NO_DECODE))
+ == COMPARE_LESS;
+}
+
+//============================================================================
+bool INetURLObject::ConcatData(INetProtocol eTheScheme,
+ UniString const & rTheUser,
+ UniString const & rThePassword,
+ UniString const & rTheHost,
+ sal_uInt32 nThePort,
+ UniString const & rThePath,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ setInvalid();
+ m_eScheme = eTheScheme;
+ if (HasError())
+ return false;
+ m_aAbsURIRef.AssignAscii(getSchemeInfo().m_pScheme);
+ m_aAbsURIRef += ':';
+ if (getSchemeInfo().m_bAuthority)
+ {
+ m_aAbsURIRef.AppendAscii(RTL_CONSTASCII_STRINGPARAM("//"));
+ bool bUserInfo = false;
+ if (getSchemeInfo().m_bUser)
+ {
+ if (m_eScheme == INET_PROT_IMAP && rTheUser.Len() == 0)
+ {
+ setInvalid();
+ return false;
+ }
+ if (rTheUser.Len() != 0)
+ {
+ m_aUser.set(m_aAbsURIRef,
+ encodeText(rTheUser, false,
+ m_eScheme == INET_PROT_IMAP ?
+ PART_IMAP_ACHAR :
+ m_eScheme == INET_PROT_VIM ?
+ PART_VIM :
+ PART_USER_PASSWORD,
+ getEscapePrefix(), eMechanism,
+ eCharset, false),
+ m_aAbsURIRef.Len());
+ bUserInfo = true;
+ }
+ }
+ else if (rTheUser.Len() != 0)
+ {
+ setInvalid();
+ return false;
+ }
+ if (rThePassword.Len() != 0)
+ if (getSchemeInfo().m_bPassword)
+ {
+ m_aAbsURIRef += ':';
+ m_aAuth.set(m_aAbsURIRef,
+ encodeText(rThePassword, false,
+ m_eScheme == INET_PROT_VIM ?
+ PART_VIM : PART_USER_PASSWORD,
+ getEscapePrefix(), eMechanism,
+ eCharset, false),
+ m_aAbsURIRef.Len());
+ bUserInfo = true;
+ }
+ else
+ {
+ setInvalid();
+ return false;
+ }
+ if (bUserInfo && getSchemeInfo().m_bHost)
+ m_aAbsURIRef += '@';
+ if (getSchemeInfo().m_bHost)
+ {
+ UniString aSynHost(rTheHost);
+ switch (m_eScheme)
+ {
+ case INET_PROT_FILE:
+ if (aSynHost.EqualsIgnoreCaseAscii("localhost"))
+ aSynHost.Erase();
+ break;
+
+ case INET_PROT_LDAP:
+ if (aSynHost.Len() == 0 && nThePort != 0)
+ {
+ setInvalid();
+ return false;
+ }
+ break;
+
+ default:
+ if (aSynHost.Len() == 0)
+ {
+ setInvalid();
+ return false;
+ }
+ break;
+ }
+ if (aSynHost.Len() != 0)
+ {
+ sal_Unicode const * p = aSynHost.GetBuffer();
+ sal_Unicode const * pEnd = p + aSynHost.Len();
+ if (!parseHost(p, pEnd, false, eMechanism, eCharset, aSynHost)
+ || p != pEnd)
+ {
+ setInvalid();
+ return false;
+ }
+ }
+ m_aHost.set(m_aAbsURIRef, aSynHost, m_aAbsURIRef.Len());
+ if (nThePort != 0)
+ if (getSchemeInfo().m_bPort)
+ {
+ m_aAbsURIRef += ':';
+ m_aPort.set(m_aAbsURIRef,
+ UniString::CreateFromInt64(nThePort),
+ m_aAbsURIRef.Len());
+ }
+ else
+ {
+ setInvalid();
+ return false;
+ }
+ }
+ else if (rTheHost.Len() != 0 || nThePort != 0)
+ {
+ setInvalid();
+ return false;
+ }
+ }
+ UniString aSynPath;
+ if (getSchemeInfo().m_bHierarchical
+ && rThePath.Len() == 0 || rThePath.GetChar(0) != '/')
+ aSynPath = '/';
+ aSynPath += rThePath;
+ m_aPath.set(m_aAbsURIRef,
+ encodeText(aSynPath, false,
+ m_eScheme == INET_PROT_FILE ?
+ PART_PATH_SEGMENTS_EXTRA :
+ m_eScheme == INET_PROT_NEWS
+ || m_eScheme == INET_PROT_POP3 ?
+ PART_MESSAGE_ID_PATH :
+ PART_HTTP_PATH,
+ getEscapePrefix(), eMechanism, eCharset, true),
+ m_aAbsURIRef.Len());
+ return true;
+}
+
+//============================================================================
+namespace unnamed_tools_urlobj {
+
+inline bool isWLetter(International const & rInternational, sal_Unicode c)
+{
+ return rInternational.IsAlphaNumeric(c) || c == '$' || c == '%'
+ || c == '&' || c == '-' || c == '/' || c == '@' || c == '\\';
+}
+
+inline bool checkWChar(International const & rInternational,
+ sal_Unicode const * p, sal_Unicode const *& rEnd,
+ bool bBackslash = false, bool bPipe = false)
+{
+ sal_Unicode c = *p;
+ if (rInternational.IsAlphaNumeric(c) || c == '/'
+ || c == '\\' && bBackslash || c == '|' && bPipe)
+ {
+ rEnd = p + 1;
+ return true;
+ }
+ else
+ return !mustEncode(c, INetURLObject::PART_URIC) || c == '%';
+}
+
+}
+
+// static
+UniString INetURLObject::FindFirstURLInText(UniString const & rText,
+ xub_StrLen & rBegin,
+ xub_StrLen & rEnd,
+ International const &
+ rInternational,
+ UniString const *,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ if (!(rBegin <= rEnd && rEnd <= rText.Len()))
+ return UniString();
+
+ sal_Unicode const * pBegin = rText.GetBuffer() + rBegin;
+ sal_Unicode const * pEnd = rText.GetBuffer() + rEnd;
+
+ // Search for the first (longest possible) substring of [pBegin..pEnd[
+ // that matches any of the following productions. "\W" stands for a word
+ // break, i.e., the begin or end of the block of text, or a character that
+ // is neither a letter nor a digit (according to rInternational). The
+ // productions use the auxiliary rules
+ //
+ // domain = label *("." label)
+ // label = alphanum [*(alphanum / "-") alphanum]
+ // alphanum = ALPHA / DIGIT
+ // IPv6reference = "[" IPv6address "]"
+ // IPv6address = hexpart [":" IPv4address]
+ // IPv4address = 1*3DIGIT 3("." 1*3DIGIT)
+ // hexpart = (hexseq ["::" [hexseq]]) / ("::" [hexseq])
+ // hexseq = hex4 *(":" hex4)
+ // hex4 = 1*4HEXDIG
+ // wchar = <any uric character (ignoring the escaped rule), or "%", or
+ // a letter or digit (according to rInternational)>
+ //
+ // 1st Production (file):
+ // \W "file:" 1*(wchar / "\" / "|") ["#" 1*wchar] \W
+ //
+ // 2nd Production (known scheme):
+ // \W <one of the known schemes, ignoring case> ":" 1*wchar
+ // ["#" 1*wchar] \W
+ //
+ // 3rd Production (mailto):
+ // \W domain "@" domain \W
+ //
+ // 4th Production (ftp):
+ // \W "ftp" 2*("." label) ["/" *wchar] ["#" 1*wchar] \W
+ //
+ // 5th Production (http):
+ // \W label 2*("." label) ["/" *wchar] ["#" 1*wchar] \W
+ //
+ // 6th Production (file):
+ // \W "//" (domain / IPv6reference) ["/" *wchar] ["#" 1*wchar] \W
+ //
+ // 7th Production (Unix file):
+ // \W "/" 1*wchar \W
+ //
+ // 8th Production (UNC file):
+ // \W "\\" domain ["\" *(wchar / "\")] \W
+ //
+ // 9th Production (Unix-like DOS file):
+ // \W ALPHA ":/" *wchar \W
+ //
+ // 10th Production (DOS file):
+ // \W ALPHA ":\" *(wchar / "\") \W
+
+ for (sal_Unicode const * pPos = pBegin; pPos != pEnd;)
+ if ((INetMIME::isAlpha(*pPos) || *pPos == '/' || *pPos == '\\')
+ && (pPos == pBegin || !isWLetter(rInternational, pPos[-1])))
+ {
+ sal_Unicode const * pURIEnd = 0;
+
+ if (INetMIME::isAlpha(*pPos))
+ {
+ sal_Unicode const * p = pPos;
+ sal_Unicode const * pPrefixEnd = p;
+ PrefixInfo const * pPrefix = getPrefix(pPrefixEnd, pEnd);
+ if (pPrefix) // 1st, 2nd
+ {
+ while (*p++ != ':');
+ pPrefixEnd = p;
+ if (pPrefix->m_eScheme == INET_PROT_FILE)
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd, true,
+ true))
+ ++p;
+ else
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd))
+ ++p;
+ if (p != pPrefixEnd && *p == '#')
+ {
+ ++p;
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd))
+ ++p;
+ }
+ }
+ else if (pEnd - p >= 3 && p[1] == ':' && p[2] == '/') // 9th
+ {
+ p += 3;
+ pURIEnd = p;
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd))
+ ++p;
+ }
+ else if (pEnd - p >= 3 && p[1] == ':' && p[2] == '\\') // 10th
+ {
+ p += 3;
+ pURIEnd = p;
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd, true))
+ ++p;
+ }
+ else
+ {
+ sal_uInt32 nLabels = scanDomain(p, pEnd, false);
+ if (nLabels > 0 && p != pEnd && *p == '@') // 3rd
+ {
+ ++p;
+ if (scanDomain(p, pEnd, false) > 0)
+ pURIEnd = p;
+ }
+ else if (nLabels >= 3) // 4th, 5th
+ {
+ pURIEnd = p;
+ if (p != pEnd && *p == '/')
+ {
+ pURIEnd = ++p;
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd))
+ ++p;
+ }
+ if (p != pEnd && *p == '#')
+ {
+ ++p;
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd))
+ ++p;
+ }
+ }
+ }
+ }
+ else if (*pPos == '/')
+ {
+ sal_Unicode const * p = pPos;
+ if (pEnd - p >= 2)
+ if (p[1] == '/') // 6th
+ {
+ p += 2;
+ if (scanDomain(p, pEnd, false) > 0
+ || scanIPv6reference(p, pEnd, false))
+ {
+ pURIEnd = p;
+ if (p != pEnd && *p == '/')
+ {
+ pURIEnd = ++p;
+ while (p != pEnd
+ && checkWChar(rInternational, p,
+ pURIEnd))
+ ++p;
+ }
+ if (p != pEnd && *p == '#')
+ {
+ ++p;
+ while (p != pEnd
+ && checkWChar(rInternational, p,
+ pURIEnd))
+ ++p;
+ }
+ }
+ }
+ else // 7th
+ {
+ ++p;
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd))
+ ++p;
+ }
+ }
+ else if (*pPos == '\\') // 8th
+ {
+ sal_Unicode const * p = pPos;
+ if (pEnd - p >= 2 && p[1] == '\\')
+ {
+ p += 2;
+ if (scanDomain(p, pEnd, false) > 0)
+ {
+ pURIEnd = p;
+ if (p != pEnd && *p == '\\')
+ {
+ pURIEnd = ++p;
+ while (p != pEnd
+ && checkWChar(rInternational, p, pURIEnd,
+ true))
+ ++p;
+ }
+ }
+ }
+ }
+
+ if (pURIEnd
+ && (pURIEnd == pEnd || !isWLetter(rInternational, *pURIEnd)))
+ {
+ INetURLObject aURI(UniString(pPos, pURIEnd - pPos),
+ INET_PROT_HTTP, eMechanism, eCharset);
+ if (!aURI.HasError())
+ {
+ rBegin += pPos - pBegin;
+ rEnd -= pEnd - pURIEnd;
+ return aURI.GetMainURL();
+ }
+ }
+
+ ++pPos;
+ while (pPos != pEnd && isWLetter(rInternational, *pPos))
+ ++pPos;
+ }
+ else
+ ++pPos;
+
+ rBegin = rEnd;
+ return UniString();
+}
+
+//============================================================================
+UniString INetURLObject::getExternalURL(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ UniString aTheExtURIRef;
+ translateToExternal(m_aAbsURIRef, aTheExtURIRef, NOT_CANONIC, eMechanism,
+ eCharset);
+ return aTheExtURIRef;
+}
+
+//============================================================================
+// static
+UniString INetURLObject::GetScheme(INetProtocol eTheScheme)
+{
+ return UniString::CreateFromAscii(getSchemeInfo(eTheScheme).m_pPrefix);
+}
+
+//============================================================================
+// static
+INetProtocol INetURLObject::CompareProtocolScheme(UniString const &
+ rTheAbsURIRef)
+{
+ sal_Unicode const * p = rTheAbsURIRef.GetBuffer();
+ PrefixInfo const * pPrefix = getPrefix(p, p + rTheAbsURIRef.Len());
+ return pPrefix ? pPrefix->m_eScheme : INET_PROT_NOT_VALID;
+}
+
+//============================================================================
+bool INetURLObject::hasPassword() const
+{
+ return m_aAuth.isPresent() && getSchemeInfo().m_bPassword;
+}
+
+//============================================================================
+void INetURLObject::makeAuthCanonic()
+{
+ if (m_eScheme == INET_PROT_IMAP && m_aAuth.getLength() == 1
+ && m_aAbsURIRef.GetChar(m_aAuth.getBegin()) == '*')
+ {
+ m_aAbsURIRef.Erase(m_aAuth.getBegin()
+ - RTL_CONSTASCII_LENGTH(";AUTH="),
+ RTL_CONSTASCII_LENGTH(";AUTH=*"));
+ sal_Int32 nDelta = m_aAuth.clear() - RTL_CONSTASCII_LENGTH(";AUTH=");
+ m_aPath += nDelta;
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ }
+}
+
+//============================================================================
+UniString INetURLObject::GetHostPort(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ UniString aHostPort(decode(m_aHost, getEscapePrefix(), eMechanism,
+ eCharset));
+ if (m_aPort.isPresent())
+ {
+ aHostPort += ':';
+ aHostPort += decode(m_aPort, getEscapePrefix(), eMechanism, eCharset);
+ }
+ return aHostPort;
+}
+
+//============================================================================
+sal_uInt32 INetURLObject::GetPort() const
+{
+ if (m_aPort.isPresent())
+ {
+ sal_Unicode const * p = m_aAbsURIRef.GetBuffer() + m_aPort.getBegin();
+ sal_Unicode const * pEnd = p + m_aPort.getLength();
+ sal_uInt32 nThePort;
+ if (INetMIME::scanUnsigned(p, pEnd, true, nThePort) && p == pEnd)
+ return nThePort;
+ }
+ return 0;
+}
+
+//============================================================================
+bool INetURLObject::SetPort(sal_uInt32 nThePort)
+{
+ if (getSchemeInfo().m_bPort && m_aHost.isPresent())
+ {
+ UniString aNewPort(UniString::CreateFromInt64(nThePort));
+ sal_Int32 nDelta;
+ if (m_aPort.isPresent())
+ nDelta = m_aPort.set(m_aAbsURIRef, aNewPort);
+ else
+ {
+ m_aAbsURIRef.Insert(':', m_aHost.getEnd());
+ nDelta = m_aPort.set(m_aAbsURIRef, aNewPort, m_aHost.getEnd() + 1)
+ + 1;
+ }
+ m_aPath += nDelta;
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ return true;
+ }
+ return false;
+}
+
+//============================================================================
+void INetURLObject::makePortCanonic()
+{
+ if (m_aPort.isPresent())
+ {
+ sal_Unicode const * p = m_aAbsURIRef.GetBuffer() + m_aPort.getBegin();
+ sal_Unicode const * pEnd = p + m_aPort.getLength();
+ sal_uInt32 nThePort;
+ if (INetMIME::scanUnsigned(p, pEnd, true, nThePort) && p == pEnd)
+ {
+ sal_Int32 nDelta;
+ if (nThePort != 0 && nThePort == getSchemeInfo().m_nDefaultPort)
+ {
+ m_aAbsURIRef.Erase(m_aPort.getBegin() - 1,
+ m_aPort.getLength() + 1);
+ nDelta = m_aPort.clear() - 1;
+ }
+ else
+ nDelta = m_aPort.set(m_aAbsURIRef,
+ UniString::CreateFromInt64(nThePort));
+ m_aPath += nDelta;
+ m_aQuery += nDelta;
+ m_aFragment += nDelta;
+ }
+ }
+}
+
+//============================================================================
+// static
+bool INetURLObject::parseHost(sal_Unicode const *& rBegin,
+ sal_Unicode const * pEnd, bool bOctets,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset, UniString & rCanonic)
+{
+ enum State { STATE_INITIAL, STATE_LABEL, STATE_LABEL_HYPHEN,
+ STATE_LABEL_DOT, STATE_TOPLABEL, STATE_TOPLABEL_HYPHEN,
+ STATE_TOPLABEL_DOT, STATE_IP4, STATE_IP4_DOT, STATE_IP6,
+ STATE_IP6_COLON, STATE_IP6_2COLON, STATE_IP6_3COLON,
+ STATE_IP6_HEXSEQ1, STATE_IP6_HEXSEQ1_COLON,
+ STATE_IP6_HEXSEQ1_MAYBE_IP4, STATE_IP6_HEXSEQ2,
+ STATE_IP6_HEXSEQ2_COLON, STATE_IP6_HEXSEQ2_MAYBE_IP4,
+ STATE_IP6_IP4, STATE_IP6_IP4_DOT, STATE_IP6_DONE };
+ UniString aTheCanonic;
+ sal_uInt32 nNumber;
+ int nDigits;
+ int nOctets;
+ State eState = STATE_INITIAL;
+ sal_Unicode const * p = rBegin;
+ for (; p != pEnd; ++p)
+ switch (eState)
+ {
+ case STATE_INITIAL:
+ if (*p == '[')
+ {
+ aTheCanonic = '[';
+ eState = STATE_IP6;
+ }
+ else if (INetMIME::isAlpha(*p))
+ eState = STATE_TOPLABEL;
+ else if (INetMIME::isDigit(*p))
+ {
+ nNumber = INetMIME::getWeight(*p);
+ nDigits = 1;
+ nOctets = 1;
+ eState = STATE_IP4;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_LABEL:
+ if (*p == '.')
+ eState = STATE_LABEL_DOT;
+ else if (*p == '-')
+ eState = STATE_LABEL_HYPHEN;
+ else if (!INetMIME::isAlphanumeric(*p))
+ goto done;
+ break;
+
+ case STATE_LABEL_HYPHEN:
+ if (INetMIME::isAlphanumeric(*p))
+ eState = STATE_LABEL;
+ else if (*p != '-')
+ goto done;
+ break;
+
+ case STATE_LABEL_DOT:
+ if (INetMIME::isAlpha(*p))
+ eState = STATE_TOPLABEL;
+ else if (INetMIME::isDigit(*p))
+ eState = STATE_LABEL;
+ else
+ goto done;
+ break;
+
+ case STATE_TOPLABEL:
+ if (*p == '.')
+ eState = STATE_TOPLABEL_DOT;
+ else if (*p == '-')
+ eState = STATE_TOPLABEL_HYPHEN;
+ else if (!INetMIME::isAlphanumeric(*p))
+ goto done;
+ break;
+
+ case STATE_TOPLABEL_HYPHEN:
+ if (INetMIME::isAlphanumeric(*p))
+ eState = STATE_TOPLABEL;
+ else if (*p != '-')
+ goto done;
+ break;
+
+ case STATE_TOPLABEL_DOT:
+ if (INetMIME::isAlpha(*p))
+ eState = STATE_TOPLABEL;
+ else if (INetMIME::isDigit(*p))
+ eState = STATE_LABEL;
+ else
+ goto done;
+ break;
+
+ case STATE_IP4:
+ if (*p == '.')
+ if (nOctets < 4)
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber);
+ aTheCanonic += '.';
+ ++nOctets;
+ eState = STATE_IP4_DOT;
+ }
+ else
+ eState = STATE_LABEL_DOT;
+ else if (*p == '-')
+ eState = STATE_LABEL_HYPHEN;
+ else if (INetMIME::isAlpha(*p))
+ eState = STATE_LABEL;
+ else if (INetMIME::isDigit(*p))
+ if (nDigits < 3)
+ {
+ nNumber = 10 * nNumber + INetMIME::getWeight(*p);
+ ++nDigits;
+ }
+ else
+ eState = STATE_LABEL;
+ else
+ goto done;
+ break;
+
+ case STATE_IP4_DOT:
+ if (INetMIME::isAlpha(*p))
+ eState = STATE_TOPLABEL;
+ else if (INetMIME::isDigit(*p))
+ {
+ nNumber = INetMIME::getWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP4;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6:
+ if (*p == ':')
+ eState = STATE_IP6_COLON;
+ else if (INetMIME::isHexDigit(*p))
+ {
+ nNumber = INetMIME::getHexWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP6_HEXSEQ1;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_COLON:
+ if (*p == ':')
+ {
+ aTheCanonic.AppendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
+ eState = STATE_IP6_2COLON;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_2COLON:
+ if (*p == ']')
+ eState = STATE_IP6_DONE;
+ else if (*p == ':')
+ {
+ aTheCanonic += ':';
+ eState = STATE_IP6_3COLON;
+ }
+ else if (INetMIME::isHexDigit(*p))
+ {
+ nNumber = INetMIME::getHexWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP6_HEXSEQ2;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_3COLON:
+ if (INetMIME::isDigit(*p))
+ {
+ nNumber = INetMIME::getWeight(*p);
+ nDigits = 1;
+ nOctets = 1;
+ eState = STATE_IP6_IP4;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_HEXSEQ1:
+ if (*p == ']')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ eState = STATE_IP6_DONE;
+ }
+ else if (*p == ':')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ aTheCanonic += ':';
+ eState = STATE_IP6_HEXSEQ1_COLON;
+ }
+ else if (INetMIME::isHexDigit(*p) && nDigits < 4)
+ {
+ nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
+ ++nDigits;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_HEXSEQ1_COLON:
+ if (*p == ':')
+ {
+ aTheCanonic.AppendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
+ eState = STATE_IP6_2COLON;
+ }
+ else if (INetMIME::isDigit(*p))
+ {
+ nNumber = INetMIME::getWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP6_HEXSEQ1_MAYBE_IP4;
+ }
+ else if (INetMIME::isHexDigit(*p))
+ {
+ nNumber = INetMIME::getHexWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP6_HEXSEQ1;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_HEXSEQ1_MAYBE_IP4:
+ if (*p == ']')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ eState = STATE_IP6_DONE;
+ }
+ else if (*p == ':')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ aTheCanonic += ':';
+ eState = STATE_IP6_HEXSEQ1_COLON;
+ }
+ else if (*p == '.')
+ {
+ nNumber = 100 * (nNumber >> 8) + 10 * (nNumber >> 4 & 15)
+ + (nNumber & 15);
+ aTheCanonic += UniString::CreateFromInt32(nNumber);
+ aTheCanonic += '.';
+ nOctets = 2;
+ eState = STATE_IP6_IP4_DOT;
+ }
+ else if (INetMIME::isDigit(*p) && nDigits < 3)
+ {
+ nNumber = 16 * nNumber + INetMIME::getWeight(*p);
+ ++nDigits;
+ }
+ else if (INetMIME::isHexDigit(*p) && nDigits < 4)
+ {
+ nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
+ ++nDigits;
+ eState = STATE_IP6_HEXSEQ1;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_HEXSEQ2:
+ if (*p == ']')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ eState = STATE_IP6_DONE;
+ }
+ else if (*p == ':')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ aTheCanonic += ':';
+ eState = STATE_IP6_HEXSEQ2_COLON;
+ }
+ else if (INetMIME::isHexDigit(*p) && nDigits < 4)
+ {
+ nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
+ ++nDigits;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_HEXSEQ2_COLON:
+ if (INetMIME::isDigit(*p))
+ {
+ nNumber = INetMIME::getWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP6_HEXSEQ2_MAYBE_IP4;
+ }
+ else if (INetMIME::isHexDigit(*p))
+ {
+ nNumber = INetMIME::getHexWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP6_HEXSEQ2;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_HEXSEQ2_MAYBE_IP4:
+ if (*p == ']')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ eState = STATE_IP6_DONE;
+ }
+ else if (*p == ':')
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber, 16);
+ aTheCanonic += ':';
+ eState = STATE_IP6_HEXSEQ2_COLON;
+ }
+ else if (*p == '.')
+ {
+ nNumber = 100 * (nNumber >> 8) + 10 * (nNumber >> 4 & 15)
+ + (nNumber & 15);
+ aTheCanonic += UniString::CreateFromInt32(nNumber);
+ aTheCanonic += '.';
+ nOctets = 2;
+ eState = STATE_IP6_IP4_DOT;
+ }
+ else if (INetMIME::isDigit(*p) && nDigits < 3)
+ {
+ nNumber = 16 * nNumber + INetMIME::getWeight(*p);
+ ++nDigits;
+ }
+ else if (INetMIME::isHexDigit(*p) && nDigits < 4)
+ {
+ nNumber = 16 * nNumber + INetMIME::getHexWeight(*p);
+ ++nDigits;
+ eState = STATE_IP6_HEXSEQ2;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_IP4:
+ if (*p == ']')
+ if (nOctets == 4)
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber);
+ eState = STATE_IP6_DONE;
+ }
+ else
+ goto done;
+ else if (*p == '.')
+ if (nOctets < 4)
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber);
+ aTheCanonic += '.';
+ ++nOctets;
+ eState = STATE_IP6_IP4_DOT;
+ }
+ else
+ goto done;
+ else if (INetMIME::isDigit(*p) && nDigits < 3)
+ {
+ nNumber = 10 * nNumber + INetMIME::getWeight(*p);
+ ++nDigits;
+ }
+ else
+ goto done;
+ break;
+
+ case STATE_IP6_IP4_DOT:
+ if (INetMIME::isDigit(*p))
+ {
+ nNumber = INetMIME::getWeight(*p);
+ nDigits = 1;
+ eState = STATE_IP6_IP4;
+ }
+ else
+ goto done;
+ break;
+ }
+ done:
+ switch (eState)
+ {
+ case STATE_LABEL:
+ case STATE_TOPLABEL:
+ case STATE_TOPLABEL_DOT:
+ aTheCanonic.Assign(rBegin, p - rBegin);
+ rBegin = p;
+ rCanonic = aTheCanonic;
+ return true;
+
+ case STATE_IP4:
+ if (nOctets == 4)
+ {
+ aTheCanonic += UniString::CreateFromInt32(nNumber);
+ rBegin = p;
+ rCanonic = aTheCanonic;
+ return true;
+ }
+ break;
+
+ case STATE_IP6_DONE:
+ aTheCanonic += ']';
+ rBegin = p;
+ rCanonic = aTheCanonic;
+ return true;
+ }
+ return false;
+}
+
+//============================================================================
+sal_Int32 INetURLObject::getSegmentCount(bool bIgnoreFinalSlash) const
+{
+ if (!getSchemeInfo().m_bHierarchical)
+ return 0;
+
+ sal_Unicode const * p = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pEnd = p + m_aPath.getLength();
+ if (p == pEnd || *p != '/')
+ return 0;
+
+ if (bIgnoreFinalSlash && pEnd[-1] == '/')
+ --pEnd;
+
+ sal_Int32 n = 0;
+ while (p != pEnd)
+ if (*p++ == '/')
+ ++n;
+ return n;
+}
+
+//============================================================================
+bool INetURLObject::removeSegment(sal_Int32 nIndex, bool bIgnoreFinalSlash)
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return false;
+
+ UniString aNewPath(m_aAbsURIRef, m_aPath.getBegin(),
+ aSegment.getBegin() - m_aPath.getBegin());
+ if (bIgnoreFinalSlash && aSegment.getEnd() == m_aPath.getEnd())
+ aNewPath += '/';
+ else
+ aNewPath.Append(m_aAbsURIRef.GetBuffer() + aSegment.getEnd(),
+ m_aPath.getEnd() - aSegment.getEnd());
+ if (aNewPath.Len() == 0)
+ aNewPath = '/';
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+UniString INetURLObject::getName(sal_Int32 nIndex, bool bIgnoreFinalSlash,
+ DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return UniString();
+
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ sal_Unicode const * p = pSegBegin;
+ while (p != pSegEnd && *p != ';')
+ ++p;
+
+ return decode(pSegBegin, p, getEscapePrefix(), eMechanism, eCharset);
+}
+
+//============================================================================
+bool INetURLObject::setName(UniString const & rTheName, sal_Int32 nIndex,
+ bool bIgnoreFinalSlash,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ sal_Unicode const * p = pSegBegin;
+ while (p != pSegEnd && *p != ';')
+ ++p;
+
+ UniString aNewPath(pPathBegin, pSegBegin - pPathBegin);
+ aNewPath += encodeText(rTheName, false, PART_PCHAR, getEscapePrefix(),
+ eMechanism, eCharset, true);
+ aNewPath.Append(p, pPathEnd - p);
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+bool INetURLObject::hasExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash)
+ const
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return false;
+
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ for (sal_Unicode const * p = pSegBegin; p != pSegEnd && *p != ';'; ++p)
+ if (*p == '.' && p != pSegBegin)
+ return true;
+ return false;
+}
+
+//============================================================================
+UniString INetURLObject::getBase(sal_Int32 nIndex, bool bIgnoreFinalSlash,
+ DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return UniString();
+
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ sal_Unicode const * pExtension = 0;
+ sal_Unicode const * p = pSegBegin;
+ for (; p != pSegEnd && *p != ';'; ++p)
+ if (*p == '.' && p != pSegBegin)
+ pExtension = p;
+ if (!pExtension)
+ pExtension = p;
+
+ return decode(pSegBegin, pExtension, getEscapePrefix(), eMechanism,
+ eCharset);
+}
+
+//============================================================================
+bool INetURLObject::setBase(UniString const & rTheBase, sal_Int32 nIndex,
+ bool bIgnoreFinalSlash,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ sal_Unicode const * pExtension = 0;
+ sal_Unicode const * p = pSegBegin;
+ for (; p != pSegEnd && *p != ';'; ++p)
+ if (*p == '.' && p != pSegBegin)
+ pExtension = p;
+ if (!pExtension)
+ pExtension = p;
+
+ UniString aNewPath(pPathBegin, pSegBegin - pPathBegin);
+ aNewPath += encodeText(rTheBase, false, PART_PCHAR, getEscapePrefix(),
+ eMechanism, eCharset, true);
+ aNewPath.Append(pExtension, pPathEnd - pExtension);
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+UniString INetURLObject::getExtension(sal_Int32 nIndex,
+ bool bIgnoreFinalSlash,
+ DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return UniString();
+
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ sal_Unicode const * pExtension = 0;
+ sal_Unicode const * p = pSegBegin;
+ for (; p != pSegEnd && *p != ';'; ++p)
+ if (*p == '.' && p != pSegBegin)
+ pExtension = p;
+
+ if (!pExtension)
+ return UniString();
+
+ return decode(pExtension + 1, p, getEscapePrefix(), eMechanism, eCharset);
+}
+
+//============================================================================
+bool INetURLObject::setExtension(UniString const & rTheExtension,
+ sal_Int32 nIndex, bool bIgnoreFinalSlash,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ sal_Unicode const * pExtension = 0;
+ sal_Unicode const * p = pSegBegin;
+ for (; p != pSegEnd && *p != ';'; ++p)
+ if (*p == '.' && p != pSegBegin)
+ pExtension = p;
+ if (!pExtension)
+ pExtension = p;
+
+ UniString aNewPath(pPathBegin, pExtension - pPathBegin);
+ aNewPath += '.';
+ aNewPath += encodeText(rTheExtension, false, PART_PCHAR,
+ getEscapePrefix(), eMechanism, eCharset, true);
+ aNewPath.Append(p, pPathEnd - p);
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+bool INetURLObject::removeExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash)
+{
+ SubString aSegment(getSegment(nIndex, bIgnoreFinalSlash));
+ if (!aSegment.isPresent())
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ sal_Unicode const * pSegBegin
+ = m_aAbsURIRef.GetBuffer() + aSegment.getBegin();
+ sal_Unicode const * pSegEnd = pSegBegin + aSegment.getLength();
+
+ ++pSegBegin;
+ sal_Unicode const * pExtension = 0;
+ sal_Unicode const * p = pSegBegin;
+ for (; p != pSegEnd && *p != ';'; ++p)
+ if (*p == '.' && p != pSegBegin)
+ pExtension = p;
+ if (!pExtension)
+ return true;
+
+ UniString aNewPath(pPathBegin, pExtension - pPathBegin);
+ aNewPath.Append(p, pPathEnd - p);
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+bool INetURLObject::hasFinalSlash() const
+{
+ if (!getSchemeInfo().m_bHierarchical)
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ if (pPathBegin == pPathEnd || *pPathBegin != '/')
+ return false;
+
+ return pPathEnd[-1] == '/';
+}
+
+//============================================================================
+bool INetURLObject::setFinalSlash()
+{
+ if (!getSchemeInfo().m_bHierarchical)
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ if (pPathBegin == pPathEnd || *pPathBegin != '/')
+ return false;
+
+ if (pPathEnd[-1] == '/')
+ return true;
+
+ UniString aNewPath(pPathBegin, pPathEnd - pPathBegin);
+ aNewPath += '/';
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+bool INetURLObject::removeFinalSlash()
+{
+ if (!getSchemeInfo().m_bHierarchical)
+ return false;
+
+ sal_Unicode const * pPathBegin
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pPathEnd = pPathBegin + m_aPath.getLength();
+ if (pPathBegin == pPathEnd || *pPathBegin != '/')
+ return false;
+
+ if (pPathEnd[-1] != '/')
+ return true;
+
+ --pPathEnd;
+ if (pPathEnd == pPathBegin)
+ return false;
+ UniString aNewPath(pPathBegin, pPathEnd - pPathBegin);
+
+ return setPath(aNewPath, false, NOT_CANONIC, RTL_TEXTENCODING_UTF8);
+}
+
+//============================================================================
+// static
+UniString INetURLObject::createFragment(UniString const & rText)
+{
+ UniString aFragment(rText);
+ for (xub_StrLen i = 0; i < aFragment.Len();)
+ {
+ sal_Unicode c = aFragment.GetChar(i);
+ if (mustEncode(aFragment.GetChar(i), PART_CREATEFRAGMENT))
+ aFragment.Erase(i, 1);
+ else
+ ++i;
+ }
+ return aFragment;
+}
+
+//============================================================================
+bool INetURLObject::setFSysPath(UniString const & rFSysPath, FSysStyle eStyle)
+{
+ sal_Unicode const * pFSysBegin = rFSysPath.GetBuffer();
+ sal_Unicode const * pFSysEnd = pFSysBegin + rFSysPath.Len();
+
+ switch ((eStyle & FSYS_VOS ? 1 : 0)
+ + (eStyle & FSYS_UNX ? 1 : 0)
+ + (eStyle & FSYS_DOS ? 1 : 0)
+ + (eStyle & FSYS_MAC ? 1 : 0))
+ {
+ case 0:
+ return false;
+
+ case 1:
+ break;
+
+ default:
+ if (eStyle & FSYS_VOS
+ && pFSysEnd - pFSysBegin >= 2
+ && pFSysBegin[0] == '/'
+ && pFSysBegin[1] == '/')
+ {
+ if (pFSysEnd - pFSysBegin >= 3
+ && pFSysBegin[2] == '.'
+ && (pFSysEnd - pFSysBegin == 3 || pFSysBegin[3] == '/'))
+ {
+ eStyle = FSYS_VOS; // Production T1
+ break;
+ }
+
+ sal_Unicode const * p = pFSysBegin + 2;
+ UniString aHost;
+ if (parseHost(p, pFSysEnd, false, ENCODE_ALL,
+ RTL_TEXTENCODING_UTF8, aHost)
+ && (p == pFSysEnd || *p == '/'))
+ {
+ eStyle = FSYS_VOS; // Production T2
+ break;
+ }
+ }
+
+ if (eStyle & FSYS_DOS
+ && pFSysEnd - pFSysBegin >= 2
+ && pFSysBegin[0] == '\\'
+ && pFSysBegin[1] == '\\')
+ {
+ sal_Unicode const * p = pFSysBegin + 2;
+ UniString aHost;
+ if (parseHost(p, pFSysEnd, false, ENCODE_ALL,
+ RTL_TEXTENCODING_UTF8, aHost)
+ && (p == pFSysEnd || *p == '\\'))
+ {
+ eStyle = FSYS_DOS; // Production T3
+ break;
+ }
+ }
+
+ if (eStyle & FSYS_DOS
+ && pFSysEnd - pFSysBegin >= 3
+ && INetMIME::isAlpha(pFSysBegin[0])
+ && pFSysBegin[1] == ':'
+ && (pFSysBegin[2] == '/' || pFSysBegin[2] == '\\'))
+ {
+ eStyle = FSYS_DOS; // Productions T4, T5
+ break;
+ }
+
+ if (!(eStyle & (FSYS_UNX | FSYS_DOS | FSYS_MAC)))
+ return false;
+
+ eStyle = guessFSysStyleByCounting(pFSysBegin, pFSysEnd, eStyle);
+ // Production T6
+ break;
+ }
+
+ UniString aSynAbsURIRef(RTL_CONSTASCII_USTRINGPARAM("file://"));
+ switch (eStyle)
+ {
+ case FSYS_VOS:
+ {
+ sal_Unicode const * p = pFSysBegin;
+ if (pFSysEnd - p < 2 || *p++ != '/' || *p++ != '/')
+ return false;
+ if (p != pFSysEnd && *p == '.'
+ && (pFSysEnd - p == 1 || p[1] == '/'))
+ ++p;
+ for (; p != pFSysEnd; ++p)
+ switch (*p)
+ {
+ case '#':
+ case '%':
+ appendEscape(aSynAbsURIRef, '%', *p);
+ break;
+
+ default:
+ aSynAbsURIRef += *p;
+ break;
+ }
+ break;
+ }
+
+ case FSYS_UNX:
+ {
+ sal_Unicode const * p = pFSysBegin;
+ if (p != pFSysEnd && *p != '/')
+ return false;
+ for (; p != pFSysEnd; ++p)
+ switch (*p)
+ {
+ case '|':
+ case '#':
+ case '%':
+ appendEscape(aSynAbsURIRef, '%', *p);
+ break;
+
+ default:
+ aSynAbsURIRef += *p;
+ break;
+ }
+ break;
+ }
+
+ case FSYS_DOS:
+ {
+ sal_uInt32 nAltDelimiter = 0x80000000;
+ sal_Unicode const * p = pFSysBegin;
+ if (pFSysEnd - p >= 3 && p[0] == '\\' && p[1] == '\\')
+ p += 2;
+ else
+ {
+ aSynAbsURIRef += '/';
+ if (pFSysEnd - p >= 3 && INetMIME::isAlpha(p[0])
+ && p[1] == ':' && (p[2] == '\\' || p[2] == '/'))
+ nAltDelimiter = '/';
+ }
+ for (; p != pFSysEnd; ++p)
+ if (*p == '\\' || *p == nAltDelimiter)
+ aSynAbsURIRef += '/';
+ else
+ switch (*p)
+ {
+ case '/':
+ case '#':
+ case '%':
+ appendEscape(aSynAbsURIRef, '%', *p);
+ break;
+
+ default:
+ aSynAbsURIRef += *p;
+ break;
+ }
+ break;
+ }
+
+ case FSYS_MAC:
+ aSynAbsURIRef += '/';
+ {for (sal_Unicode const * p = pFSysBegin; p != pFSysEnd; ++p)
+ switch (*p)
+ {
+ case ':':
+ aSynAbsURIRef += '/';
+ break;
+
+ case '/':
+ case '|':
+ case '#':
+ case '%':
+ appendEscape(aSynAbsURIRef, '%', *p);
+ break;
+
+ default:
+ aSynAbsURIRef += *p;
+ break;
+ }
+ }
+ break;
+ }
+
+ INetURLObject aTemp(aSynAbsURIRef, WAS_ENCODED, RTL_TEXTENCODING_UTF8);
+ if (aTemp.HasError())
+ return false;
+
+ *this = aTemp;
+ return true;
+}
+
+//============================================================================
+UniString INetURLObject::getFSysPath(FSysStyle eStyle,
+ sal_Unicode * pDelimiter) const
+{
+ if (m_eScheme != INET_PROT_FILE)
+ return UniString();
+
+ if ((eStyle & FSYS_VOS ? 1 : 0)
+ + (eStyle & FSYS_UNX ? 1 : 0)
+ + (eStyle & FSYS_DOS ? 1 : 0)
+ + (eStyle & FSYS_MAC ? 1 : 0)
+ > 1)
+ {
+ sal_Unicode const * p = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ eStyle = eStyle & FSYS_VOS
+ && m_aHost.isPresent()
+ && m_aHost.getLength() > 0 ?
+ FSYS_VOS :
+ eStyle & FSYS_DOS
+ && (!m_aHost.isPresent() || m_aHost.getLength() == 0)
+ && m_aPath.getLength() >= 3
+ && p[0] == '/'
+ && INetMIME::isAlpha(p[1])
+ && p[2] == ':'
+ && (m_aPath.getLength() == 3 || p[3] == '/') ?
+ FSYS_DOS :
+ eStyle & FSYS_UNX
+ && (!m_aHost.isPresent() || m_aHost.getLength() == 0) ?
+ FSYS_UNX :
+ FSysStyle(0);
+ }
+
+ switch (eStyle)
+ {
+ case FSYS_VOS:
+ {
+ if (pDelimiter)
+ *pDelimiter = '/';
+
+ UniString aSynFSysPath(RTL_CONSTASCII_USTRINGPARAM("//"));
+ if (m_aHost.isPresent() && m_aHost.getLength() > 0)
+ aSynFSysPath += decode(m_aHost, '%', DECODE_WITH_CHARSET,
+ RTL_TEXTENCODING_UTF8);
+ else
+ aSynFSysPath += '.';
+ aSynFSysPath += decode(m_aPath, '%', DECODE_WITH_CHARSET,
+ RTL_TEXTENCODING_UTF8);
+ return aSynFSysPath;
+ }
+
+ case FSYS_UNX:
+ {
+ if (m_aHost.isPresent() && m_aHost.getLength() > 0)
+ return UniString();
+
+ if (pDelimiter)
+ *pDelimiter = '/';
+
+ return decode(m_aPath, '%', DECODE_WITH_CHARSET,
+ RTL_TEXTENCODING_UTF8);
+ }
+
+ case FSYS_DOS:
+ {
+ if (pDelimiter)
+ *pDelimiter = '\\';
+
+ UniString aSynFSysPath;
+ if (m_aHost.isPresent() && m_aHost.getLength() > 0)
+ {
+ aSynFSysPath.AssignAscii(RTL_CONSTASCII_STRINGPARAM("\\\\"));
+ aSynFSysPath += decode(m_aHost, '%', DECODE_WITH_CHARSET,
+ RTL_TEXTENCODING_UTF8);
+ aSynFSysPath += '\\';
+ }
+ sal_Unicode const * p
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pEnd = p + m_aPath.getLength();
+ DBG_ASSERT(p < pEnd && *p == '/',
+ "INetURLObject::getFSysPath(): Bad path");
+ ++p;
+ while (p < pEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(p, pEnd, false, '%', WAS_ENCODED,
+ RTL_TEXTENCODING_UTF8,
+ eEscapeType);
+ if (eEscapeType == ESCAPE_NO && nUTF32 == '/')
+ aSynFSysPath += '\\';
+ else
+ appendUTF32(aSynFSysPath, nUTF32);
+ }
+ return aSynFSysPath;
+ }
+
+ case FSYS_MAC:
+ {
+ if (m_aHost.isPresent() && m_aHost.getLength() > 0)
+ return UniString();
+
+ if (pDelimiter)
+ *pDelimiter = ':';
+
+ UniString aSynFSysPath;
+ sal_Unicode const * p
+ = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pEnd = p + m_aPath.getLength();
+ DBG_ASSERT(p < pEnd && *p == '/',
+ "INetURLObject::getFSysPath(): Bad path");
+ ++p;
+ while (p < pEnd)
+ {
+ EscapeType eEscapeType;
+ sal_uInt32 nUTF32 = getUTF32(p, pEnd, false, '%', WAS_ENCODED,
+ RTL_TEXTENCODING_UTF8,
+ eEscapeType);
+ if (eEscapeType == ESCAPE_NO && nUTF32 == '/')
+ aSynFSysPath += ':';
+ else
+ appendUTF32(aSynFSysPath, nUTF32);
+ }
+ return aSynFSysPath;
+ }
+ }
+
+ return UniString();
+}
+
+//============================================================================
+bool INetURLObject::HasMsgId() const
+{
+ if (m_eScheme != INET_PROT_NEWS && m_eScheme != INET_PROT_POP3)
+ return false;
+ sal_Unicode const * p = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pEnd = p + m_aPath.getLength();
+ for (; p < pEnd; ++p)
+ if (*p == '<')
+ return true;
+ return false;
+}
+
+//============================================================================
+UniString INetURLObject::GetMsgId(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ if (m_eScheme != INET_PROT_NEWS && m_eScheme != INET_PROT_POP3)
+ return UniString();
+ sal_Unicode const * p = m_aAbsURIRef.GetBuffer() + m_aPath.getBegin();
+ sal_Unicode const * pEnd = p + m_aPath.getLength();
+ for (; p < pEnd; ++p)
+ if (*p == '<')
+ return decode(p, pEnd, getEscapePrefix(), eMechanism, eCharset);
+ return UniString();
+}
+
+//============================================================================
+// static
+void INetURLObject::appendUCS4Escape(UniString & rTheText,
+ sal_Char cEscapePrefix, sal_uInt32 nUCS4)
+{
+ DBG_ASSERT(nUCS4 < 0x80000000,
+ "INetURLObject::appendUCS4Escape(): Bad char");
+ if (nUCS4 < 0x80)
+ appendEscape(rTheText, cEscapePrefix, nUCS4);
+ else if (nUCS4 < 0x800)
+ {
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 | 0xC0);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80);
+ }
+ else if (nUCS4 < 0x10000)
+ {
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 | 0xE0);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80);
+ }
+ else if (nUCS4 < 0x200000)
+ {
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 18 | 0xF0);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80);
+ }
+ else if (nUCS4 < 0x4000000)
+ {
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 24 | 0xF8);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 18 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80);
+ }
+ else
+ {
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 30 | 0xFC);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 24 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 18 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80);
+ appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80);
+ }
+}
+
+//============================================================================
+// static
+void INetURLObject::appendUCS4(UniString & rTheText, sal_uInt32 nUCS4,
+ EscapeType eEscapeType, bool bOctets,
+ Part ePart, sal_Char cEscapePrefix,
+ rtl_TextEncoding eCharset,
+ bool bKeepVisibleEscapes)
+{
+ bool bEscape;
+ rtl_TextEncoding eTargetCharset;
+ switch (eEscapeType)
+ {
+ case ESCAPE_NO:
+ if (mustEncode(nUCS4, ePart))
+ {
+ bEscape = true;
+ eTargetCharset = bOctets ? RTL_TEXTENCODING_ISO_8859_1 :
+ RTL_TEXTENCODING_UTF8;
+ }
+ else
+ bEscape = false;
+ break;
+
+ case ESCAPE_OCTET:
+ bEscape = true;
+ eTargetCharset = RTL_TEXTENCODING_ISO_8859_1;
+ break;
+
+ case ESCAPE_UTF32:
+ if (mustEncode(nUCS4, ePart))
+ {
+ bEscape = true;
+ eTargetCharset = eCharset;
+ }
+ else if (bKeepVisibleEscapes && INetMIME::isVisible(nUCS4))
+ {
+ bEscape = true;
+ eTargetCharset = RTL_TEXTENCODING_ASCII_US;
+ }
+ else
+ bEscape = false;
+ break;
+ }
+ if (bEscape)
+ switch (eTargetCharset)
+ {
+ default:
+ DBG_ERROR("INetURLObject::appendUCS4(): Unsupported charset");
+ case RTL_TEXTENCODING_ASCII_US:
+ case RTL_TEXTENCODING_ISO_8859_1:
+ appendEscape(rTheText, cEscapePrefix, nUCS4);
+ break;
+
+ case RTL_TEXTENCODING_UTF8:
+ appendUCS4Escape(rTheText, cEscapePrefix, nUCS4);
+ break;
+ }
+ else
+ rTheText += sal_Unicode(nUCS4);
+}
+
+//============================================================================
+// static
+sal_uInt32 INetURLObject::getUTF32(sal_Unicode const *& rBegin,
+ sal_Unicode const * pEnd, bool bOctets,
+ sal_Char cEscapePrefix,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset,
+ EscapeType & rEscapeType)
+{
+ DBG_ASSERT(rBegin < pEnd, "INetURLObject::getUTF32(): Bad sequence");
+ sal_uInt32 nUTF32 = bOctets ? *rBegin++ :
+ INetMIME::getUTF32Character(rBegin, pEnd);
+ switch (eMechanism)
+ {
+ case ENCODE_ALL:
+ rEscapeType = ESCAPE_NO;
+ break;
+
+ case WAS_ENCODED:
+ {
+ int nWeight1;
+ int nWeight2;
+ if (nUTF32 == cEscapePrefix && rBegin + 1 < pEnd
+ && (nWeight1 = INetMIME::getHexWeight(rBegin[0])) >= 0
+ && (nWeight2 = INetMIME::getHexWeight(rBegin[1])) >= 0)
+ {
+ rBegin += 2;
+ nUTF32 = nWeight1 << 4 | nWeight2;
+ switch (eCharset)
+ {
+ default:
+ DBG_ERROR(
+ "INetURLObject::getUTF32(): Unsupported charset");
+ case RTL_TEXTENCODING_ASCII_US:
+ rEscapeType = INetMIME::isUSASCII(nUTF32) ?
+ ESCAPE_UTF32 : ESCAPE_OCTET;
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_1:
+ rEscapeType = ESCAPE_UTF32;
+ break;
+
+ case RTL_TEXTENCODING_UTF8:
+ if (INetMIME::isUSASCII(nUTF32))
+ rEscapeType = ESCAPE_UTF32;
+ else
+ {
+ if (nUTF32 >= 0xC0 && nUTF32 <= 0xF4)
+ {
+ sal_uInt32 nEncoded;
+ int nShift;
+ sal_uInt32 nMin;
+ if (nUTF32 <= 0xDF)
+ {
+ nEncoded = (nUTF32 & 0x1F) << 6;
+ nShift = 0;
+ nMin = 0x80;
+ }
+ else if (nUTF32 <= 0xEF)
+ {
+ nEncoded = (nUTF32 & 0x0F) << 12;
+ nShift = 6;
+ nMin = 0x800;
+ }
+ else
+ {
+ nEncoded = (nUTF32 & 0x07) << 18;
+ nShift = 12;
+ nMin = 0x10000;
+ }
+ sal_Unicode const * p = rBegin;
+ bool bUTF8 = true;
+ for (;;)
+ {
+ if (pEnd - p < 3
+ || p[0] != cEscapePrefix
+ || (nWeight1
+ = INetMIME::getHexWeight(p[1]))
+ < 8
+ || nWeight1 > 11
+ || (nWeight2
+ = INetMIME::getHexWeight(p[2]))
+ < 0)
+ {
+ bUTF8 = false;
+ break;
+ }
+ p += 3;
+ nEncoded
+ |= ((nWeight1 & 3) << 4 | nWeight2)
+ << nShift;
+ if (nShift == 0)
+ break;
+ nShift -= 6;
+ }
+ if (bUTF8 && nEncoded >= nMin
+ && !INetMIME::isHighSurrogate(nEncoded)
+ && !INetMIME::isLowSurrogate(nEncoded)
+ && nEncoded <= 0x10FFFF)
+ {
+ rBegin = p;
+ nUTF32 = nEncoded;
+ rEscapeType = ESCAPE_UTF32;
+ break;
+ }
+ }
+ rEscapeType = ESCAPE_OCTET;
+ }
+ break;
+ }
+ }
+ else
+ rEscapeType = ESCAPE_NO;
+ break;
+ }
+
+ case NOT_CANONIC:
+ {
+ int nWeight1;
+ int nWeight2;
+ if (nUTF32 == cEscapePrefix && rBegin + 1 < pEnd
+ && ((nWeight1 = INetMIME::getHexWeight(rBegin[0])) >= 0)
+ && ((nWeight2 = INetMIME::getHexWeight(rBegin[1])) >= 0))
+ {
+ rBegin += 2;
+ nUTF32 = nWeight1 << 4 | nWeight2;
+ rEscapeType = ESCAPE_OCTET;
+ }
+ else
+ rEscapeType = ESCAPE_NO;
+ break;
+ }
+ }
+ return nUTF32;
+}
+
+//============================================================================
+// static
+sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin,
+ sal_Unicode const * pEnd,
+ bool bEager)
+{
+ enum State { STATE_DOT, STATE_LABEL, STATE_HYPHEN };
+ State eState = STATE_DOT;
+ xub_StrLen nLabels = 0;
+ sal_Unicode const * pLastAlphanumeric = 0;
+ for (sal_Unicode const * p = rBegin;; ++p)
+ switch (eState)
+ {
+ case STATE_DOT:
+ if (p != pEnd && INetMIME::isAlphanumeric(*p))
+ {
+ ++nLabels;
+ eState = STATE_LABEL;
+ break;
+ }
+ if (bEager || nLabels == 0)
+ return 0;
+ rBegin = p - 1;
+ return nLabels;
+
+ case STATE_LABEL:
+ if (p != pEnd)
+ if (INetMIME::isAlphanumeric(*p))
+ break;
+ else if (*p == '.')
+ {
+ eState = STATE_DOT;
+ break;
+ }
+ else if (*p == '-')
+ {
+ pLastAlphanumeric = p;
+ eState = STATE_HYPHEN;
+ break;
+ }
+ rBegin = p;
+ return nLabels;
+
+ case STATE_HYPHEN:
+ if (p != pEnd)
+ if (INetMIME::isAlphanumeric(*p))
+ {
+ eState = STATE_LABEL;
+ break;
+ }
+ else if (*p == '-')
+ break;
+ if (bEager)
+ return 0;
+ rBegin = pLastAlphanumeric;
+ return nLabels;
+ }
+}
+
+//============================================================================
+// static
+bool INetURLObject::scanIPv6reference(sal_Unicode const *& rBegin,
+ sal_Unicode const * pEnd,
+ bool bEager)
+{
+ return false; //@@@
+}
+
+//============================================================================
+// static
+UniString INetURLObject::RelToAbs(ByteString const & rTheRelURIRef,
+ bool bIgnoreFragment,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle)
+{
+ // Backwards compatibility:
+ if (rTheRelURIRef.Len() == 0 || rTheRelURIRef.GetChar(0) == '#')
+ return extend(rTheRelURIRef);
+
+ INetURLObject aTheAbsURIRef;
+ bool bWasAbsolute;
+ m_aBaseURIRef.convertRelToAbs(extend(rTheRelURIRef), true, aTheAbsURIRef,
+ bWasAbsolute, eEncodeMechanism, eCharset,
+ bIgnoreFragment, false, false, eStyle);
+ return aTheAbsURIRef.GetMainURL(eDecodeMechanism, eCharset);
+}
+
+//============================================================================
+// static
+UniString INetURLObject::RelToAbs(UniString const & rTheRelURIRef,
+ bool bIgnoreFragment,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle)
+{
+ // Backwards compatibility:
+ if (rTheRelURIRef.Len() == 0 || rTheRelURIRef.GetChar(0) == '#')
+ return rTheRelURIRef;
+
+ INetURLObject aTheAbsURIRef;
+ bool bWasAbsolute;
+ return m_aBaseURIRef.convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef,
+ bWasAbsolute, eEncodeMechanism,
+ eCharset, bIgnoreFragment, false,
+ false, eStyle)
+ || eEncodeMechanism != WAS_ENCODED
+ || eDecodeMechanism != DECODE_TO_IURI
+ || eCharset != RTL_TEXTENCODING_UTF8 ?
+ aTheAbsURIRef.GetMainURL(eDecodeMechanism, eCharset) :
+ rTheRelURIRef;
+}
+
+//============================================================================
+// static
+UniString INetURLObject::AbsToRel(ByteString const & rTheAbsURIRef,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle)
+{
+ UniString aTheRelURIRef;
+ m_aBaseURIRef.convertAbsToRel(extend(rTheAbsURIRef), true, aTheRelURIRef,
+ eEncodeMechanism, eDecodeMechanism,
+ eCharset, eStyle);
+ return aTheRelURIRef;
+}
+
+//============================================================================
+// static
+UniString INetURLObject::AbsToRel(UniString const & rTheAbsURIRef,
+ EncodeMechanism eEncodeMechanism,
+ DecodeMechanism eDecodeMechanism,
+ rtl_TextEncoding eCharset,
+ FSysStyle eStyle)
+{
+ UniString aTheRelURIRef;
+ m_aBaseURIRef.convertAbsToRel(rTheAbsURIRef, false, aTheRelURIRef,
+ eEncodeMechanism, eDecodeMechanism,
+ eCharset, eStyle);
+ return aTheRelURIRef;
+}
+
+//============================================================================
+// static
+bool INetURLObject::SetBaseURL(ByteString const & rTheBaseURIRef,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return m_aBaseURIRef.SetURL(rTheBaseURIRef, eMechanism, eCharset);
+}
+
+//============================================================================
+// static
+bool INetURLObject::SetBaseURL(UniString const & rTheBaseURIRef,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return m_aBaseURIRef.SetURL(rTheBaseURIRef, eMechanism, eCharset);
+}
+
+//============================================================================
+// static
+UniString INetURLObject::GetBaseURL(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ return m_aBaseURIRef.GetMainURL(eMechanism, eCharset);
+}
+
+//============================================================================
+UniString INetURLObject::GetPartBeforeLastName(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+ const
+{
+ if (!getSchemeInfo().m_bHierarchical)
+ return UniString();
+ INetURLObject aTemp(*this);
+ aTemp.clearFragment();
+ aTemp.clearQuery();
+ aTemp.removeSegment(LAST_SEGMENT, false);
+ aTemp.setFinalSlash();
+ return aTemp.GetMainURL(eMechanism, eCharset);
+}
+
+//============================================================================
+UniString INetURLObject::GetLastName(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ return getName(LAST_SEGMENT, true, eMechanism, eCharset);
+}
+
+//============================================================================
+UniString INetURLObject::GetFileExtension(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset) const
+{
+ return getExtension(LAST_SEGMENT, false, eMechanism, eCharset);
+}
+
+//============================================================================
+bool INetURLObject::CutLastName()
+{
+ INetURLObject aTemp(*this);
+ aTemp.clearFragment();
+ aTemp.clearQuery();
+ if (!aTemp.removeSegment(LAST_SEGMENT, false))
+ return false;
+ *this = aTemp;
+ return true;
+}
+
+//============================================================================
+UniString INetURLObject::PathToFileName() const
+{
+ if (m_eScheme != INET_PROT_FILE)
+ return UniString();
+ rtl::OUString aNormalizedPath;
+ if (osl::FileBase::getNormalizedPathFromFileURL(
+ decode(m_aAbsURIRef.GetBuffer(),
+ m_aAbsURIRef.GetBuffer() + m_aPath.getEnd(),
+ getEscapePrefix(), NO_DECODE, RTL_TEXTENCODING_UTF8),
+ aNormalizedPath)
+ != osl::FileBase::E_None)
+ return UniString();
+ rtl::OUString aSystemPath;
+ if (osl::FileBase::getSystemPathFromNormalizedPath(aNormalizedPath,
+ aSystemPath)
+ != osl::FileBase::E_None)
+ return UniString();
+ return aSystemPath;
+}
+
+//============================================================================
+UniString INetURLObject::GetFull() const
+{
+ INetURLObject aTemp(*this);
+ aTemp.removeFinalSlash();
+ return aTemp.PathToFileName();
+}
+
+//============================================================================
+UniString INetURLObject::GetPath() const
+{
+ INetURLObject aTemp(*this);
+ aTemp.removeSegment(LAST_SEGMENT, true);
+ aTemp.removeFinalSlash();
+ return aTemp.PathToFileName();
+}
+
+//============================================================================
+void INetURLObject::SetBase(UniString const & rTheBase)
+{
+ setBase(rTheBase, LAST_SEGMENT, true, ENCODE_ALL);
+}
+
+//============================================================================
+UniString INetURLObject::GetBase() const
+{
+ return getBase(LAST_SEGMENT, true, DECODE_WITH_CHARSET);
+}
+
+//============================================================================
+void INetURLObject::SetName(UniString const & rTheName,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ INetURLObject aTemp(*this);
+ if (aTemp.removeSegment(LAST_SEGMENT, true)
+ && aTemp.insertName(rTheName, false, LAST_SEGMENT, true, eMechanism,
+ eCharset))
+ *this = aTemp;
+}
+
+//============================================================================
+UniString INetURLObject::CutName(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ UniString aTheName(getName(LAST_SEGMENT, true, eMechanism, eCharset));
+ return removeSegment(LAST_SEGMENT, true) ? aTheName : UniString();
+}
+
+//============================================================================
+void INetURLObject::SetExtension(UniString const & rTheExtension,
+ EncodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ setExtension(rTheExtension, LAST_SEGMENT, false, eMechanism, eCharset);
+}
+
+//============================================================================
+UniString INetURLObject::CutExtension(DecodeMechanism eMechanism,
+ rtl_TextEncoding eCharset)
+{
+ UniString aTheExtension(getExtension(LAST_SEGMENT, false, eMechanism,
+ eCharset));
+ return removeExtension(LAST_SEGMENT, false) ? aTheExtension : UniString();
+}
+
+//============================================================================
+bool INetURLObject::IsCaseSensitive() const
+{
+ return true;
+}
diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx
new file mode 100644
index 000000000000..8b8bd7c5950b
--- /dev/null
+++ b/tools/source/fsys/wldcrd.cxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * $RCSfile: wldcrd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _WLDCRD_HXX
+#include <wldcrd.hxx>
+#endif
+
+/*************************************************************************
+|*
+|* WildCard::Match()
+|*
+|* Beschreibung WLDCRD.SDW
+|* Ersterstellung MA 19.06.91
+|* Letzte Aenderung MA 03.07.91
+|*
+*************************************************************************/
+
+/* Diese Methode ueberprueft, ob die Wilde Karte in pWild mit dem String
+ * in pStr matscht.
+ * Vertragen sich die beiden, so wird 1 zurueckgegeben, sonst 0.
+ *
+ * ein '*' in pWild bedeutet n beliebige Zeichen, mit n>=0
+ * ein '?' in pWild bedeutet genau ein beliebiges Zeichen
+ *
+ */
+
+USHORT WildCard::ImpMatch( const char *pWild, const char *pStr ) const
+{
+ int pos=0;
+ int flag=0;
+
+ while ( *pWild || flag )
+ {
+ switch (*pWild)
+ {
+ case '?':
+ if ( *pStr == '\0' )
+ return 0;
+ break;
+
+ default:
+ if ( (*pWild == '\\') && ((*(pWild+1)=='?') || (*(pWild+1) == '*')) )
+ pWild++;
+ if ( *pWild != *pStr )
+ if ( !pos )
+ return 0;
+ else
+ pWild += pos;
+ else
+ break; // ACHTUNG laeuft unter bestimmten
+ // Umstaenden in den nachsten case rein!!
+ case '*':
+ while ( *pWild == '*' )
+ pWild++;
+ if ( *pWild == '\0' )
+ return 1;
+ flag = 1;
+ pos = 0;
+ if ( *pStr == '\0' )
+ return ( *pWild == '\0' );
+ while ( *pStr && *pStr != *pWild )
+ {
+ if ( *pWild == '?' ) {
+ pWild++;
+ while ( *pWild == '*' )
+ pWild++;
+ }
+ pStr++;
+ if ( *pStr == '\0' )
+ return ( *pWild == '\0' );
+ }
+ break;
+ }
+ if ( *pWild != '\0' )
+ pWild++;
+ if ( *pStr != '\0' )
+ pStr++;
+ else
+ flag = 0;
+ if ( flag )
+ pos--;
+ }
+ return ( *pStr == '\0' ) && ( *pWild == '\0' );
+}
+
+/*************************************************************************
+|*
+|* WildCard::Matches()
+|*
+|* Beschreibung WLDCRD.SDW
+|* Ersterstellung MA 19.06.91
+|* Letzte Aenderung TH 02.02.96
+|*
+*************************************************************************/
+
+BOOL WildCard::Matches( const String& rString ) const
+{
+ ByteString aTmpWild = aWildString;
+ ByteString aString(rString, osl_getThreadTextEncoding());
+
+ USHORT nSepPos;
+
+ if ( cSepSymbol != '\0' )
+ {
+ while ( (nSepPos = aTmpWild.Search( cSepSymbol )) != STRING_NOTFOUND )
+ {
+ // alle getrennten WildCard's pruefen
+ if ( ImpMatch( aTmpWild.Copy( 0, nSepPos ).GetBuffer(), aString.GetBuffer() ) )
+ return TRUE;
+ aTmpWild.Erase( 0, nSepPos + 1 ); // Trennsymbol entfernen
+ }
+ // und noch den hinter dem letzen Trennsymbol bzw. den einzigen
+ }
+
+ if ( ImpMatch( aTmpWild.GetBuffer(), aString.GetBuffer() ) )
+ return TRUE;
+ else
+ return FALSE;
+}
diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx
new file mode 100644
index 000000000000..b1ae509c6056
--- /dev/null
+++ b/tools/source/fsys/wntmsc.cxx
@@ -0,0 +1,1103 @@
+/*************************************************************************
+ *
+ * $RCSfile: wntmsc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <ctype.h>
+#include <limits.h>
+
+#include "wntmsc.hxx"
+#include "errinf.hxx"
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _LIST_HXX
+#include <list.hxx>
+#endif
+#ifndef _WLDCRD_HXX
+#include <wldcrd.hxx>
+#endif
+#ifndef _FSYS_HXX
+#include <fsys.hxx>
+#endif
+#ifndef _BIGINT_HXX
+#include "bigint.hxx"
+#endif
+
+DECLARE_LIST( DirEntryList, DirEntry* );
+DECLARE_LIST( FSysSortList, FSysSort* );
+DECLARE_LIST( FileStatList, FileStat* );
+
+int Sys2SolarError_Impl( int nSysErr );
+
+static ByteString sLastCaseSensitiveDir = "";
+static BOOL bLastCaseSensitive = FALSE;
+
+//--------------------------------------------------------------------
+
+ByteString Upper_Impl( const ByteString &rStr )
+{
+ ByteString aRet( rStr.GetBuffer() ); // es muss ein neuer String entstehen!
+ CharUpperBuff( (char*) aRet.GetBuffer(), aRet.Len() );
+ return aRet;
+}
+
+//--------------------------------------------------------------------
+
+DIR *opendir( const char* pPfad )
+{
+ DIR *pDir = new DIR;
+ if ( pDir )
+ pDir->p = (char*) pPfad;
+ return pDir;
+}
+
+struct dirent *readdir( DIR *pDir )
+{
+ BOOL bOk = FALSE;
+ if ( pDir->p )
+ {
+ char *pBuf = new char[ strlen( pDir->p ) + 5 ];
+ if ( pBuf )
+ {
+ // *.* dahinter, ggf mit "\\" abtrennen (falls nicht schon da)
+ strcpy( pBuf, pDir->p );
+ strcat( pBuf, "\\*.*" + ( *(pBuf + strlen( pBuf ) - 1 ) == '\\' ) );
+ CharUpperBuff( pBuf, strlen(pBuf) );
+ pDir->h = FindFirstFile( pBuf, &pDir->aDirEnt );
+ bOk = pDir->h != INVALID_HANDLE_VALUE;
+ pDir->p = NULL;
+ delete pBuf;
+ }
+ else
+ pDir->h = INVALID_HANDLE_VALUE;
+ }
+ else
+ {
+ bOk = FindNextFile( pDir->h, &pDir->aDirEnt );
+ }
+
+ return bOk ? &pDir->aDirEnt : NULL;
+}
+
+int closedir( DIR *pDir )
+{
+ BOOL bOk = FALSE;
+ if ( pDir )
+ {
+ bOk = 0 != pDir->p || FindClose( pDir->h );
+ delete pDir;
+ }
+ return bOk;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::GetPathStyle() const
+|*
+|* Beschreibung
+|* Ersterstellung MI 11.05.95
+|* Letzte Aenderung MI 11.05.95
+|*
+*************************************************************************/
+
+ErrCode GetPathStyle_Impl( const String &rDevice, FSysPathStyle &rStyle )
+{
+ ByteString aRootDir(rDevice, osl_getThreadTextEncoding());
+ if ( aRootDir.Len() && aRootDir.GetBuffer()[aRootDir.Len()-1] != '\\' )
+ aRootDir += '\\';
+
+ char sVolumeName[256];
+ char sFileSysName[16];
+ DWORD nSerial[2];
+ DWORD nMaxCompLen[2];
+ DWORD nFlags[2];
+
+ // Windows95 hat VFAT, WindowsNT nicht
+ DWORD nVer = GetVersion();
+ BOOL bW95 = ( nVer & 0xFF ) >= 4;
+
+ FSysFailOnErrorImpl();
+ rStyle = FSYS_STYLE_UNKNOWN;
+ if ( GetVolumeInformation(
+ (char*) aRootDir.GetBuffer(),
+ sVolumeName, 256, (LPDWORD) &nSerial, (LPDWORD) &nMaxCompLen,
+ (LPDWORD) &nFlags, sFileSysName, 16 ) )
+ {
+ // FAT/VFAT?
+ if ( 0 == strcmp( "FAT", sFileSysName ) )
+ rStyle = bW95 ? FSYS_STYLE_VFAT : FSYS_STYLE_FAT;
+
+ // NTFS?
+ else if ( 0 == strcmp( "NTFS", sFileSysName ) )
+ rStyle = FSYS_STYLE_NTFS;
+
+ // HPFS?
+ else if ( 0 == strcmp( "HPFS", sFileSysName ) )
+ rStyle = FSYS_STYLE_HPFS;
+
+ // NWCOMPA/NWFS?
+ else if ( 0 == strncmp( "NW", sFileSysName, 2 ) )
+ rStyle = FSYS_STYLE_NWFS;
+
+ return ERRCODE_NONE;
+ }
+
+ return ERRCODE_IO_INVALIDDEVICE;
+}
+
+FSysPathStyle DirEntry::GetPathStyle( const String &rDevice )
+{
+
+ FSysPathStyle eStyle;
+ GetPathStyle_Impl( rDevice, eStyle );
+ return eStyle;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::IsCaseSensitive()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 10.06.93
+|* Letzte Aenderung TPF 26.02.1999
+|*
+*************************************************************************/
+
+BOOL DirEntry::IsCaseSensitive( FSysPathStyle eFormatter ) const
+{
+
+ if (eFormatter==FSYS_STYLE_HOST)
+ {
+/*
+ DirEntry aRoot(*this);
+ aRoot.ToAbs();
+ aRoot = aRoot[Level()-1];
+ String aRootDir = aRoot.GetFull(FSYS_STYLE_HOST, TRUE);
+
+ char sVolumeName[256];
+ DWORD nVolumeSerial;
+ DWORD nMaxCompLen;
+ DWORD nFlags;
+ char sFileSysName[16];
+
+ if ( GetVolumeInformation( (char*) aRootDir.GetStr(),
+ sVolumeName,
+ 256,
+ (LPDWORD) &nVolumeSerial,
+ (LPDWORD) &nMaxCompLen,
+ (LPDWORD) &nFlags,
+ sFileSysName,
+ 16 ))
+ {
+ return (nFlags & FS_CASE_SENSITIVE) ? TRUE : FALSE;
+ }
+ else
+ {
+ return FALSE;
+ }
+*/
+ //
+ // guter versuch, aber FS_CASE_SENSITIVE ist D?nnsinn in T?ten:
+ //
+ // sFileSysName FS_CASE_SENSITIVE
+ // FAT FALSE
+ // NTFS TRUE !!!
+ // NWCompat FALSE
+ // Samba FALSE
+ //
+ // NT spricht auch NTFS lediglich case preserving an, also ist unter NT alles case insensitiv
+ //
+
+ return FALSE;
+ }
+ else
+ {
+ BOOL isCaseSensitive = FALSE; // ich bin unter win32, also ist der default case insensitiv
+ switch ( eFormatter )
+ {
+ case FSYS_STYLE_MAC:
+ case FSYS_STYLE_FAT:
+ case FSYS_STYLE_VFAT:
+ case FSYS_STYLE_NTFS:
+ case FSYS_STYLE_NWFS:
+ case FSYS_STYLE_HPFS:
+ case FSYS_STYLE_DETECT:
+ {
+ isCaseSensitive = FALSE;
+ break;
+ }
+ case FSYS_STYLE_SYSV:
+ case FSYS_STYLE_BSD:
+ {
+ isCaseSensitive = TRUE;
+ break;
+ }
+ default:
+ {
+ isCaseSensitive = FALSE; // ich bin unter win32, also ist der default case insensitiv
+ break;
+ }
+ }
+ return isCaseSensitive;
+ }
+}
+
+/*************************************************************************
+|*
+|* DirEntry::ToAbs()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MA 02.12.91
+|*
+*************************************************************************/
+
+BOOL DirEntry::ToAbs()
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ if ( FSYS_FLAG_VOLUME == eFlag )
+ {
+ eFlag = FSYS_FLAG_ABSROOT;
+ return TRUE;
+ }
+
+ if ( IsAbs() )
+ {
+ return TRUE;
+ }
+
+
+ char sBuf[256];
+ char *pOld;
+ ByteString aFullName( GetFull(), osl_getThreadTextEncoding() );
+ FSysFailOnErrorImpl();
+ if ( GetFullPathName((char*)aFullName.GetBuffer(),256,sBuf,&pOld) > 511 )
+ return FALSE;
+
+ *this = DirEntry( String(sBuf, osl_getThreadTextEncoding() ));
+ return TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* DirEntry::GetVolume()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 27.08.92
+|* Letzte Aenderung MI 28.08.92
+|*
+*************************************************************************/
+
+String DirEntry::GetVolume() const
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ String aRet;
+ const DirEntry *pTop = ImpGetTopPtr();
+ ByteString aName = ByteString( pTop->aName ).ToLowerAscii();
+
+ if ( ( pTop->eFlag == FSYS_FLAG_ABSROOT ||
+ pTop->eFlag == FSYS_FLAG_RELROOT ||
+ pTop->eFlag == FSYS_FLAG_VOLUME )
+ && aName != "a:" && aName != "b:" && Exists() )
+ {
+ char sFileSysName[256];
+ char sVolumeName[256];
+ DWORD nVolumeNameLen = 256;
+ DWORD nSerial[2];
+ DWORD nMaxCompLen[2];
+ DWORD nFlags[2];
+ ByteString aRootDir = pTop->aName;
+ FSysFailOnErrorImpl();
+
+ // Network-Device zuerst probieren wegen langsamer Samba-Drives
+ if ( !WNetGetConnection( (char*) aRootDir.GetBuffer(),
+ sVolumeName, &nVolumeNameLen ) )
+ aRet = String( sVolumeName, osl_getThreadTextEncoding());
+
+ // dann den VolumeNamen fuer lokale Drives
+ if ( aRet.Len() == 0 )
+ {
+ aRootDir += "\\";
+ if ( GetVolumeInformation( (char*) aRootDir.GetBuffer(),
+ sVolumeName, 256,
+ (LPDWORD) &nSerial, (LPDWORD) &nMaxCompLen,
+ (LPDWORD) &nFlags, sFileSysName, 256 ) )
+ aRet = String( sVolumeName, osl_getThreadTextEncoding());
+ }
+ }
+
+ return aRet;
+}
+
+/*************************************************************************
+|*
+|* DirEntry::SetCWD()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 26.04.91
+|* Letzte Aenderung MI 21.05.92
+|*
+*************************************************************************/
+
+BOOL DirEntry::SetCWD( BOOL bSloppy )
+{
+ DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
+
+ FSysFailOnErrorImpl();
+
+ if ( eFlag == FSYS_FLAG_CURRENT && !aName.Len() )
+ return TRUE;
+
+ if ( SetCurrentDirectory(ByteString(GetFull(), osl_getThreadTextEncoding()).GetBuffer()) )
+ {
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ if ( bSloppy && pParent &&
+ SetCurrentDirectory(ByteString(pParent->GetFull(), osl_getThreadTextEncoding()).GetBuffer()) )
+ {
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ nError = FSYS_ERR_NOTADIRECTORY;
+ return FALSE;
+}
+
+//-------------------------------------------------------------------------
+
+USHORT DirReader_Impl::Init()
+{
+ // Block-Devices auflisten?
+ if ( pDir->eAttrMask & FSYS_KIND_BLOCK )
+ {
+ // CWD merken
+ DirEntry aCurrentDir;
+ aCurrentDir.ToAbs();
+
+ // einzeln auf Existenz und Masken-konformit"at pr"ufen
+ USHORT nRead = 0;
+ char sDrive[3] = { '?', ':', 0 };
+ char sRoot[4] = { '?', ':', '\\', 0 };
+ for ( char c = 'a'; c <= 'z'; c++ )
+ {
+ sDrive[0] = c;
+ sRoot[0] = c;
+ DirEntry* pDrive = new DirEntry( sDrive, FSYS_FLAG_VOLUME, FSYS_STYLE_HOST );
+ if ( pDir->aNameMask.Matches( String( ByteString(sDrive), osl_getThreadTextEncoding())) && GetDriveType( sRoot ) != 1 )
+ {
+ if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ {
+ FileStat *pNewStat = new FileStat( *pDrive );
+ pDir->ImpSortedInsert( pDrive, pNewStat );
+ }
+ else
+ pDir->ImpSortedInsert( pDrive, NULL );
+ ++nRead;
+ }
+ else
+ delete pDrive;
+ }
+
+ // CWD restaurieren
+ aCurrentDir.SetCWD();
+ return nRead;
+ }
+
+ return 0;
+}
+
+//-------------------------------------------------------------------------
+
+USHORT DirReader_Impl::Read()
+{
+ // Directories und Files auflisten?
+ if ( ( pDir->eAttrMask & FSYS_KIND_DIR ||
+ pDir->eAttrMask & FSYS_KIND_FILE ) &&
+ ( ( pDosEntry = readdir( pDosDir ) ) != NULL ) )
+ {
+ // Gross/Kleinschreibung nicht beruecksichtigen
+ ByteString aLowerName = pDosEntry->d_name;
+ CharLowerBuff( (char*) aLowerName.GetBuffer(), aLowerName.Len() );
+
+ // Flags pruefen
+ BOOL bIsDirAndWantsDir =
+ ( ( pDir->eAttrMask & FSYS_KIND_DIR ) &&
+#ifdef ICC
+ ( pDosEntry->d_type & ( strcmp(pDosEntry->d_name,".") ||
+ strcmp(pDosEntry->d_name,"..")) ) );
+#else
+ ( pDosEntry->d_type & DOS_DIRECT ) );
+#endif
+ BOOL bIsFileAndWantsFile =
+ ( ( pDir->eAttrMask & FSYS_KIND_FILE ) &&
+#ifdef ICC
+ !( pDosEntry->d_type & ( strcmp(pDosEntry->d_name,".") ||
+ strcmp(pDosEntry->d_name,"..")) ) &&
+#else
+ !( pDosEntry->d_type & DOS_DIRECT ) &&
+#endif
+ !( pDosEntry->d_type & DOS_VOLUMEID ) );
+ BOOL bIsHidden = pDosEntry->d_type & _A_HIDDEN;
+ BOOL bWantsHidden = 0 == ( pDir->eAttrMask & FSYS_KIND_VISIBLE );
+ if ( ( bIsDirAndWantsDir || bIsFileAndWantsFile ) &&
+ ( bWantsHidden || !bIsHidden ) &&
+ pDir->aNameMask.Matches( String(aLowerName, osl_getThreadTextEncoding()) ) )
+ {
+#ifdef DBG_UTIL
+ DbgOutf( "%s %s flags:%x found",
+ pDosEntry->d_name,
+ bIsFileAndWantsFile ? "file" : "dir",
+ pDosEntry->d_type );
+#endif
+ DirEntryFlag eFlag =
+ 0 == strcmp( pDosEntry->d_name, "." ) ? FSYS_FLAG_CURRENT
+ : 0 == strcmp( pDosEntry->d_name, ".." ) ? FSYS_FLAG_PARENT
+ : FSYS_FLAG_NORMAL;
+ DirEntry *pTemp = new DirEntry( ByteString(pDosEntry->d_name),
+ eFlag, FSYS_STYLE_NTFS );
+#ifdef FEAT_FSYS_DOUBLESPEED
+ pTemp->ImpSetStat( new FileStat( (void*) pDosDir, (void*) 0 ) );
+#endif
+ if ( pParent )
+ pTemp->ImpChangeParent( new DirEntry( *pParent ), FALSE );
+ if ( pDir->pStatLst ) //Status fuer Sort gewuenscht?
+ {
+ FileStat *pNewStat = new FileStat( (void*) pDosDir, (void*) 0 );
+ pDir->ImpSortedInsert( pTemp, pNewStat );
+ }
+ else
+ pDir->ImpSortedInsert( pTemp, NULL );
+ return 1;
+ }
+#ifdef DBG_UTIL
+ else
+ DbgOutf( "%s flags:%x skipped",
+ pDosEntry->d_name,
+ pDosEntry->d_type );
+#endif
+
+ }
+ else
+ bReady = TRUE;
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* InitFileStat()
+|*
+|* Beschreibung gemeinsamer Teil der Ctoren fuer FileStat
+|* Ersterstellung MI 28.08.92
+|* Letzte Aenderung MI 28.08.92
+|*
+*************************************************************************/
+
+void FileStat::ImpInit( void* p )
+{
+ _WIN32_FIND_DATAA *pDirEnt = (_WIN32_FIND_DATAA*) p;
+
+ nError = FSYS_ERR_OK;
+ nSize = pDirEnt->nFileSizeLow;
+
+ SYSTEMTIME aSysTime;
+ FILETIME aLocTime;
+
+ FileTimeToLocalFileTime( &pDirEnt->ftCreationTime, &aLocTime );
+ FileTimeToSystemTime( &aLocTime, &aSysTime );
+ aDateCreated = Date( aSysTime.wDay, aSysTime.wMonth, aSysTime.wYear );
+ aTimeCreated = Time( aSysTime.wHour, aSysTime.wMinute,
+ aSysTime.wSecond, 0 );
+
+ FileTimeToLocalFileTime( &pDirEnt->ftLastWriteTime, &aLocTime );
+ FileTimeToSystemTime( &aLocTime, &aSysTime );
+ aDateModified = Date( aSysTime.wDay, aSysTime.wMonth, aSysTime.wYear );
+ aTimeModified = Time( aSysTime.wHour, aSysTime.wMinute,
+ aSysTime.wSecond, 0 );
+
+ FileTimeToLocalFileTime( &pDirEnt->ftLastAccessTime, &aLocTime );
+ FileTimeToSystemTime( &aLocTime, &aSysTime );
+ aDateAccessed = Date( aSysTime.wDay, aSysTime.wMonth, aSysTime.wYear );
+ aTimeAccessed = Time( aSysTime.wHour, aSysTime.wMinute,
+ aSysTime.wSecond, 0 );
+
+ nKindFlags = FSYS_KIND_FILE;
+ if ( pDirEnt->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
+ nKindFlags = FSYS_KIND_DIR;
+}
+
+/*************************************************************************
+|*
+|* FileStat::FileStat()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 27.08.92
+|* Letzte Aenderung MI 28.08.92
+|*
+*************************************************************************/
+
+FileStat::FileStat( const void *pInfo, // struct dirent
+ const void * ): // dummy
+ aDateCreated(0),
+ aTimeCreated(0),
+ aDateModified(0),
+ aTimeModified(0),
+ aDateAccessed(0),
+ aTimeAccessed(0)
+{
+ ImpInit( ( (dirent*) pInfo ) );
+}
+
+/*************************************************************************
+|*
+|* FileStat::Update()
+|*
+|* Beschreibung FSYS.SDW
+|* Ersterstellung MI 27.08.92
+|* Letzte Aenderung MI 28.08.92
+|*
+*************************************************************************/
+
+#ifdef ENABLEUNICODE
+// #define UNICODE
+#endif
+
+#include <prewin.h>
+#include <shlobj.h>
+#include <postwin.h>
+
+#ifdef UNICODE
+#define lstrchr wcschr
+#define lstrncmp wcsncmp
+#else
+#define lstrchr strchr
+#define lstrncmp strncmp
+#endif
+
+//---------------------------------------------------------------------------
+
+void SHFreeMem( void *p )
+{
+ LPMALLOC pMalloc = NULL;
+
+ if ( SUCCEEDED(SHGetMalloc(&pMalloc)) )
+ {
+ pMalloc->Free( p );
+ pMalloc->Release();
+ }
+}
+
+//---------------------------------------------------------------------------
+
+HRESULT SHGetIDListFromPath( HWND hwndOwner, LPCTSTR pszPath, LPITEMIDLIST *ppidl )
+{
+ if ( IsBadWritePtr(ppidl, sizeof(LPITEMIDLIST)) )
+ return E_INVALIDARG;
+
+ LPSHELLFOLDER pDesktopFolder = NULL;
+
+ HRESULT hResult = SHGetDesktopFolder( &pDesktopFolder );
+ if ( FAILED(hResult) )
+ return hResult;
+
+ ULONG chEaten = lstrlen( pszPath );
+ DWORD dwAttributes = FILE_ATTRIBUTE_DIRECTORY;
+
+#ifdef UNICODE
+ LPOLESTR wszPath = pszPath;
+#else
+ WCHAR wszPath[MAX_PATH];
+ MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszPath, -1, wszPath, MAX_PATH );
+#endif
+
+ hResult = pDesktopFolder->ParseDisplayName( hwndOwner, (LPBC)NULL, wszPath, &chEaten, ppidl, &dwAttributes );
+ pDesktopFolder->Release();
+
+ return hResult;
+}
+
+//---------------------------------------------------------------------------
+
+HRESULT SHGetFolderFromIDList( LPCITEMIDLIST pidl, LPSHELLFOLDER *ppFolder )
+{
+ if ( IsBadWritePtr(ppFolder, sizeof(LPSHELLFOLDER)) )
+ return E_INVALIDARG;
+
+ *ppFolder = NULL;
+
+ LPSHELLFOLDER pDesktopFolder = NULL;
+
+ HRESULT hResult = SHGetDesktopFolder( &pDesktopFolder );
+ if ( FAILED(hResult) )
+ return hResult;
+
+ hResult = pDesktopFolder->BindToObject( pidl, (LPBC)NULL, IID_IShellFolder, (LPVOID *)ppFolder );
+ pDesktopFolder->Release();
+
+ return hResult;
+}
+
+//---------------------------------------------------------------------------
+
+HRESULT SHResolvePath( HWND hwndOwner, LPCTSTR pszPath, LPITEMIDLIST *ppidl )
+{
+ // If hwndOwner is NULL, use the desktop window, because dialogs need a parent
+
+#ifdef BOOTSTRAP
+ return NO_ERROR;
+#else
+ if ( !hwndOwner )
+ hwndOwner = GetDesktopWindow();
+
+ HRESULT hResult = NOERROR;
+ LPTSTR pszPathCopy;
+ LPTSTR pszTrailingPath;
+ TCHAR cBackup;
+
+ // First make a copy of the path
+
+ pszPathCopy = new TCHAR[lstrlen(pszPath) + 1];
+ if ( pszPathCopy )
+ lstrcpy( pszPathCopy, pszPath );
+ else
+ return E_OUTOFMEMORY;
+
+ // Determine the first token
+
+ if ( !lstrncmp( pszPathCopy, "\\\\", 2 ) )
+ pszTrailingPath = lstrchr( pszPathCopy + 2, '\\' );
+ else
+ pszTrailingPath = lstrchr( pszPathCopy, '\\' );
+
+ // Now scan the path tokens
+
+ while ( SUCCEEDED(hResult) )
+ {
+ if ( pszTrailingPath )
+ {
+ cBackup = *(++pszTrailingPath);
+ *pszTrailingPath = 0;
+ }
+
+ LPITEMIDLIST pidl = NULL;
+
+ // Make item ID list from leading path
+
+ hResult = SHGetIDListFromPath( hwndOwner, pszPathCopy, &pidl );
+
+ // if path exists try to open it as folder
+
+ if ( SUCCEEDED(hResult) )
+ {
+ // Only open the folder if it was not the last token
+
+ if ( pszTrailingPath )
+ {
+ LPSHELLFOLDER pFolder;
+
+ // Create a folder instance
+ hResult = SHGetFolderFromIDList( pidl, &pFolder);
+
+ // Is it a folder ?
+ if ( SUCCEEDED(hResult) )
+ {
+ // No try to instantiate an enumerator.
+ // This should popup a login dialog if any
+
+ LPENUMIDLIST pEnum = NULL;
+
+ hResult = pFolder->EnumObjects( hwndOwner,
+ SHCONTF_NONFOLDERS | SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN,
+ &pEnum );
+
+ // Release the enumerator interface
+ if ( SUCCEEDED(hResult) )
+ pEnum->Release();
+
+ // Release the folder interface
+ pFolder->Release();
+ }
+
+ SHFreeMem( pidl );
+ }
+ else // It was the last token
+ {
+ if ( ppidl )
+ *ppidl = pidl;
+ else
+ SHFreeMem( pidl );
+ }
+ }
+
+
+ // Forward to next token
+
+ if ( pszTrailingPath )
+ {
+ *pszTrailingPath = cBackup;
+ pszTrailingPath = lstrchr( pszTrailingPath, '\\' );
+ }
+ else
+ break;
+ }
+
+ // Free the working copy of the path
+ delete pszPathCopy;
+
+ // NOERROR or OLE error code
+ return hResult;
+#endif
+}
+
+//---------------------------------------------------------------------------
+// The Wrapper
+//---------------------------------------------------------------------------
+
+BOOL Exists_Impl( const ByteString & crPath )
+{
+ // We do not know if OLE was initialized for this thread
+
+ CoInitialize( NULL );
+
+ BOOL bSuccess = SUCCEEDED( SHResolvePath(NULL, crPath.GetBuffer(), NULL) );
+
+ CoUninitialize();
+
+ return bSuccess;
+}
+
+//---------------------------------------------------------------------------
+
+BOOL FileStat::Update( const DirEntry& rDirEntry, BOOL bForceAccess )
+{
+ nSize = 0;
+ nKindFlags = 0;
+ aCreator.Erase();
+ aType.Erase();
+ aDateCreated = Date(0);
+ aTimeCreated = Time(0);
+ aDateModified = Date(0);
+ aTimeModified = Time(0);
+ aDateAccessed = Date(0);
+ aTimeAccessed = Time(0);
+
+ if ( !rDirEntry.IsValid() )
+ {
+ nError = FSYS_ERR_UNKNOWN;
+ nKindFlags = 0;
+ return FALSE;
+ }
+
+ // Sonderbehandlung falls es sich um eine Root ohne Laufwerk handelt
+
+ if ( !rDirEntry.aName.Len() && rDirEntry.eFlag == FSYS_FLAG_ABSROOT )
+ {
+ nKindFlags = FSYS_KIND_DIR;
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ // keine Error-Boxen anzeigen
+ FSysFailOnErrorImpl();
+
+ // Redirect
+ String aPath( rDirEntry.GetFull() );
+#ifndef BOOTSTRAP
+ BOOL bRedirected = FSysRedirector::DoRedirect( aPath );
+#endif
+ DirEntry aDirEntry( aPath );
+
+ // ist ein Medium im Laufwerk?
+ HACK("wie?")
+ BOOL bAccess = TRUE;
+ const DirEntry *pTop = aDirEntry.ImpGetTopPtr();
+ ByteString aName = ByteString(pTop->aName).ToLowerAscii();
+ if ( !bForceAccess &&
+ ( pTop->eFlag == FSYS_FLAG_ABSROOT ||
+ pTop->eFlag == FSYS_FLAG_RELROOT ||
+ pTop->eFlag == FSYS_FLAG_VOLUME ) )
+ if ( aName == "a:" || aName == "b:" )
+ bAccess = FALSE;
+ else
+ DBG_TRACE( "FSys: will access removable device!" );
+ if ( bAccess && ( aName == "a:" || aName == "b:" ) )
+ DBG_WARNING( "floppy will clatter" );
+
+ // Sonderbehandlung, falls es sich um ein Volume handelt
+ if ( aDirEntry.eFlag == FSYS_FLAG_VOLUME ||
+ aDirEntry.eFlag == FSYS_FLAG_ABSROOT )
+ {
+ if ( aDirEntry.eFlag == FSYS_FLAG_VOLUME )
+ nKindFlags = FSYS_KIND_DEV | ( aDirEntry.aName.Len() == 2
+ ? FSYS_KIND_BLOCK
+ : FSYS_KIND_CHAR );
+ else
+ nKindFlags = FSYS_KIND_DIR;
+
+ if ( !bAccess )
+ {
+ if ( aDirEntry.eFlag == FSYS_FLAG_VOLUME )
+ nKindFlags |= FSYS_KIND_REMOVEABLE;
+ nError = FSYS_ERR_NOTEXISTS;
+ nKindFlags = 0;
+ return FALSE;
+ }
+
+ ByteString aRootDir = aDirEntry.aName;
+ aRootDir += ByteString( "\\" );
+ USHORT nType = GetDriveType( (char *) aRootDir.GetBuffer() ); //TPF: 2i
+ if ( nType == 1 || nType == 0 )
+ {
+ nError = FSYS_ERR_NOTEXISTS;
+ nKindFlags = 0;
+ return FALSE;
+ }
+
+ if ( aDirEntry.eFlag == FSYS_FLAG_VOLUME )
+ nKindFlags = nKindFlags |
+ ( ( nType == DRIVE_REMOVABLE ) ? FSYS_KIND_REMOVEABLE : 0 ) |
+ ( ( nType == DRIVE_FIXED ) ? FSYS_KIND_FIXED : 0 ) |
+ ( ( nType == DRIVE_REMOTE ) ? FSYS_KIND_REMOTE : 0 ) |
+ ( ( nType == DRIVE_RAMDISK ) ? FSYS_KIND_RAM : 0 ) |
+ ( ( nType == DRIVE_CDROM ) ? FSYS_KIND_CDROM : 0 ) |
+ ( ( nType == 0 ) ? FSYS_KIND_UNKNOWN : 0 );
+
+ nError = ERRCODE_NONE;
+
+ return TRUE;
+ }
+
+ // Statusinformation vom Betriebssystem holen
+ HANDLE h; //()
+ _WIN32_FIND_DATAA aEntry;
+ DirEntry aAbsEntry( aDirEntry );
+ if ( bAccess && aAbsEntry.ToAbs() )
+ {
+ // im Namen k"onnen auch ';*?' als normale Zeichen vorkommen
+ ByteString aFilePath( aAbsEntry.GetFull(), osl_getThreadTextEncoding() );
+
+ // MI: dann gehen Umlaute auf Novell-Servern nicht / wozu ueberhaupt
+ // CharUpperBuff( (char*) aFilePath.GetStr(), aFilePath.Len() );
+ DBG_TRACE1( "FileStat: %s", aFilePath.GetBuffer() );
+ h = aFilePath.Len() < 230
+ // die Win32-API ist hier sehr schwammig
+ ? FindFirstFile( (char *) aFilePath.GetBuffer(), &aEntry )//TPF: 2i
+ : INVALID_HANDLE_VALUE;
+
+ if ( INVALID_HANDLE_VALUE != h )
+ {
+ if ( !( aEntry.dwFileAttributes & 0x40 ) ) // com1: etc. e.g. not encrypted (means normal)
+ {
+ ByteString aUpperName = Upper_Impl(ByteString(aAbsEntry.GetName(), osl_getThreadTextEncoding()));
+
+ // HRO: #74051# Compare also with short alternate filename
+ if ( aUpperName != Upper_Impl( aEntry.cFileName ) && aUpperName != Upper_Impl( aEntry.cAlternateFileName ) )
+ h = INVALID_HANDLE_VALUE;
+ }
+ }
+
+ if ( INVALID_HANDLE_VALUE == h )
+ {
+ DWORD dwError = GetLastError();
+
+ if ( ERROR_BAD_NET_NAME == dwError )
+ {
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ nError = FSYS_ERR_NOTEXISTS;
+ return FALSE;
+ }
+
+ // UNC-Volume?
+ DirEntry *pTop = aAbsEntry.ImpGetTopPtr();
+ if ( pTop->GetFlag() == FSYS_FLAG_ABSROOT &&
+ ( pTop->aName.Len() > 1 && (pTop->aName.GetBuffer()[1] != ':' )) )
+ {
+ if ( bForceAccess )
+ {
+ if ( Exists_Impl( aFilePath ) )
+ {
+ nKindFlags = FSYS_KIND_DIR|FSYS_KIND_REMOTE;
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+ else
+ {
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ nError = FSYS_ERR_NOTEXISTS;
+ return FALSE;
+ }
+ }
+ }
+ }
+ }
+ else
+ h = INVALID_HANDLE_VALUE;
+
+ if ( h == INVALID_HANDLE_VALUE )
+ {
+ // Sonderbehandlung falls es sich um eine Wildcard handelt
+ ByteString aTempName( aDirEntry.GetName(), osl_getThreadTextEncoding() );
+ if ( strchr( aTempName.GetBuffer(), '?' ) ||
+ strchr( aTempName.GetBuffer(), '*' ) ||
+ strchr( aTempName.GetBuffer(), ';' ) )
+ {
+ nKindFlags = FSYS_KIND_WILD;
+ nError = FSYS_ERR_OK;
+ return TRUE;
+ }
+
+ if ( bAccess )
+ {
+ nError = FSYS_ERR_NOTEXISTS;
+ nKindFlags = FSYS_KIND_UNKNOWN;
+ }
+ else
+ nKindFlags = FSYS_KIND_REMOVEABLE;
+ }
+ else
+ {
+ ImpInit( &aEntry );
+ FindClose( h );
+ }
+
+ if ( 0 != nError )
+ nKindFlags = 0;
+
+ return 0 == nError;
+
+}
+
+BOOL IsRedirectable_Impl( const ByteString &rPath )
+{
+ if ( rPath.Len() >= 3 && ':' == rPath.GetBuffer()[1] )
+ {
+ ByteString aVolume = rPath.Copy( 0, 3 );
+ USHORT nType = GetDriveType( (char *) aVolume.GetBuffer() );
+ SetLastError( ERROR_SUCCESS );
+ return DRIVE_FIXED != nType;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* TempDirImpl()
+|*
+|* Beschreibung liefert den Namens des Directories fuer temporaere
+|* Dateien
+|* Ersterstellung MI 16.03.94
+|* Letzte Aenderung MI 16.03.94
+|*
+*************************************************************************/
+
+const char* TempDirImpl( char *pBuf )
+{
+ if ( !GetTempPath( MAX_PATH, pBuf ) &&
+ !GetWindowsDirectory( pBuf, MAX_PATH ) &&
+ !GetEnvironmentVariable( "HOMEPATH", pBuf, MAX_PATH ) )
+ return 0;
+
+ return pBuf;
+}
+
+//=======================================================================
+
+ErrCode FileStat::QueryDiskSpace( const String &rPath,
+ BigInt &rFreeBytes, BigInt &rTotalBytes )
+{
+ DWORD nSectorsPerCluster; /* address of sectors per cluster */
+ DWORD nBytesPerSector; /* address of bytes per sector */
+ DWORD nFreeClusters; /* address of number of free clusters */
+ DWORD nClusters; /* address of total number of clusters */
+
+ ByteString aVol( DirEntry(rPath).ImpGetTopPtr()->GetName(), osl_getThreadTextEncoding());
+ BOOL bOK = GetDiskFreeSpace( aVol.GetBuffer(),
+ &nSectorsPerCluster, &nBytesPerSector,
+ &nFreeClusters, &nClusters );
+ if ( !bOK )
+ return Sys2SolarError_Impl( GetLastError() );
+
+ BigInt aBytesPerCluster( BigInt(nSectorsPerCluster) *
+ BigInt(nBytesPerSector) );
+ rFreeBytes = aBytesPerCluster * BigInt(nFreeClusters);
+ rTotalBytes = aBytesPerCluster * BigInt(nClusters);
+ return 0;
+}
+
+//=========================================================================
+
+void FSysEnableSysErrorBox( BOOL bEnable )
+{ // Preserve other Bits!!
+ sal_uInt32 nErrorMode = SetErrorMode( bEnable ? 0 : SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX );
+ if ( bEnable )
+ nErrorMode &= ~(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+ else
+ nErrorMode |= (SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX);
+ SetErrorMode( nErrorMode );
+}
+
+
+
diff --git a/tools/source/fsys/wntmsc.hxx b/tools/source/fsys/wntmsc.hxx
new file mode 100644
index 000000000000..e51931fc4173
--- /dev/null
+++ b/tools/source/fsys/wntmsc.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * $RCSfile: wntmsc.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _dosmsc_hxx
+#define _dosmsc_hxx
+
+#include <string.h>
+
+#ifndef ICC
+#include <io.h>
+#endif
+#include <sys\types.h>
+#include <sys\stat.h>
+#include <direct.h>
+
+#include <svwin.h>
+#include <winbase.h>
+#include <solar.h>
+#include <string.hxx>
+
+//--------------------------------------------------------------------
+
+#define FSYS_UNIX FALSE
+
+#define DOS_DIRECT _A_SUBDIR
+#define DOS_VOLUMEID 0x08
+#ifndef S_IFBLK
+#define S_IFBLK 0x6000
+#endif
+#define setdrive(n,a) _chdrive(n)
+#define GETDRIVE(n) (n = _getdrive())
+
+#define dirent _WIN32_FIND_DATAA
+#define d_name cFileName
+#define d_type dwFileAttributes
+
+#if defined (TCPP) || defined (tcpp)
+#define _mkdir mkdir
+#define _rmdir rmdir
+#define _chdir chdir
+#define _unlink unlink
+#define _getcwd getcwd
+#define _access access
+#endif
+
+typedef struct
+{
+ _WIN32_FIND_DATAA aDirEnt;
+ HANDLE h;
+ const char *p;
+} DIR;
+
+#define PATHDELIMITER ";"
+#define DEFSTYLE FSYS_STYLE_NTFS
+#define MKDIR( p ) mkdir( p )
+#define CMP_LOWER(s) ( ByteString(s).ToLowerAscii() )
+
+#include <svwin.h>
+#define START_DRV 'a'
+
+inline BOOL DRIVE_EXISTS(char c)
+{
+ ByteString aDriveRoot( c );
+ aDriveRoot += ":\\";
+ return GetDriveType( aDriveRoot.GetBuffer() ) > 1;
+}
+
+const char* TempDirImpl( char *pBuf );
+
+#define FSysFailOnErrorImpl()
+
+#endif
diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
new file mode 100644
index 000000000000..352731311a6c
--- /dev/null
+++ b/tools/source/generic/bigint.cxx
@@ -0,0 +1,1187 @@
+/*************************************************************************
+ *
+ * $RCSfile: bigint.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <math.h>
+#include <tools.h>
+
+#define private public
+#include <bigint.hxx>
+#undef private
+
+#ifndef _STRING_HXX
+#include <string.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+
+#include <string.h>
+#include <ctype.h>
+
+static void SubLong( BigInt& rA, BigInt& rB, BigInt& rErg );
+
+static const long MY_MAXLONG = 0x3fffffff;
+static const long MY_MINLONG = -MY_MAXLONG;
+static const long MY_MAXSHORT = 0x00007fff;
+static const long MY_MINSHORT = -MY_MAXSHORT;
+
+/* Die ganzen Algorithmen zur Addition, Subtraktion, Multiplikation und
+ * Division von langen Zahlen stammen aus SEMINUMERICAL ALGORITHMS von
+ * DONALD E. KNUTH aus der Reihe The Art of Computer Programming. Zu finden
+ * sind diese Algorithmen im Kapitel 4.3.1. The Classical Algorithms.
+ */
+
+// Muss auf UINT16/INT16/UINT32/INT32 umgestellt werden !!! W.P.
+
+// -----------------------------------------------------------------------
+
+static void MakeBigInt( BigInt& rThis, const BigInt& rVal )
+{
+ if ( rVal.bIsBig )
+ {
+ memcpy( (void*)&rThis, (const void*)&rVal, sizeof( BigInt ) );
+ while ( rThis.nLen > 1 && rThis.nNum[rThis.nLen-1] == 0 )
+ rThis.nLen--;
+ }
+ else
+ {
+ long nTmp = rVal.nVal;
+
+ rThis.nVal = rVal.nVal;
+ rThis.bIsBig = TRUE;
+ if ( nTmp < 0 )
+ {
+ rThis.bIsNeg = TRUE;
+ nTmp = -nTmp;
+ }
+ else
+ rThis.bIsNeg = FALSE;
+
+ rThis.nNum[0] = (USHORT)(nTmp & 0xffffL);
+ rThis.nNum[1] = (USHORT)(nTmp >> 16);
+#ifndef _WIN16
+ if ( nTmp & 0xffff0000L )
+#else
+ long l = 0xffff0000L;
+ if ( nTmp & l )
+#endif
+ rThis.nLen = 2;
+ else
+ rThis.nLen = 1;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void Normalize( BigInt& rThis )
+{
+ if ( rThis.bIsBig )
+ {
+ while ( rThis.nLen > 1 && rThis.nNum[rThis.nLen-1] == 0 )
+ rThis.nLen--;
+
+ if ( rThis.nLen < 3 )
+ {
+ if ( rThis.nLen < 2 )
+ rThis.nVal = rThis.nNum[0];
+ else if ( rThis.nNum[1] & 0x8000 )
+ return;
+ else
+ rThis.nVal = ((long)rThis.nNum[1] << 16) + rThis.nNum[0];
+
+ rThis.bIsBig = FALSE;
+
+ if ( rThis.bIsNeg )
+ rThis.nVal = -rThis.nVal;
+ }
+ // else ist nVal undefiniert !!! W.P.
+ }
+ // wozu, nLen ist doch undefiniert ??? W.P.
+ else if ( rThis.nVal & 0xFFFF0000L )
+ rThis.nLen = 2;
+ else
+ rThis.nLen = 1;
+}
+
+// -----------------------------------------------------------------------
+
+static void Mult( BigInt& rThis, const BigInt &rVal, USHORT nMul )
+{
+ USHORT nK = 0;
+ for ( int i = 0; i < rVal.nLen; i++ )
+ {
+ ULONG nTmp = (ULONG)rVal.nNum[i] * (ULONG)nMul + nK;
+ nK = (USHORT)(nTmp >> 16);
+ rThis.nNum[i] = (USHORT)nTmp;
+ }
+
+ if ( nK )
+ {
+ rThis.nNum[rVal.nLen] = nK;
+ rThis.nLen = rVal.nLen + 1;
+ }
+ else
+ rThis.nLen = rVal.nLen;
+
+ rThis.bIsBig = TRUE;
+ rThis.bIsNeg = rVal.bIsNeg;
+}
+
+// -----------------------------------------------------------------------
+
+static void Div( BigInt& rThis, USHORT nDiv, USHORT& rRem )
+{
+ ULONG nK = 0;
+ for ( int i = rThis.nLen - 1; i >= 0; i-- )
+ {
+ ULONG nTmp = (ULONG)rThis.nNum[i] + (nK << 16);
+ rThis.nNum[i] = (USHORT)(nTmp / nDiv);
+ nK = nTmp % nDiv;
+ }
+ rRem = (USHORT)nK;
+
+ if ( rThis.nNum[rThis.nLen-1] == 0 )
+ rThis.nLen -= 1;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL IsLess( const BigInt& rThis, const BigInt& rVal )
+{
+ if ( rVal.nLen < rThis.nLen)
+ return TRUE;
+ if ( rVal.nLen > rThis.nLen )
+ return FALSE;
+
+ int i;
+ for ( i = rThis.nLen - 1; i > 0 && rThis.nNum[i] == rVal.nNum[i]; i-- )
+ {
+ }
+ return rVal.nNum[i] < rThis.nNum[i];
+}
+
+// -----------------------------------------------------------------------
+
+static void AddLong( BigInt& rA, BigInt& rB, BigInt& rErg )
+{
+ if ( rA.bIsNeg == rB.bIsNeg )
+ {
+ int i;
+ char nLen;
+
+ // wenn die Zahlen unterschiedlich lang sind, sollte zunaechst bei
+ // der kleineren Zahl die fehlenden Ziffern mit 0 initialisert werden
+ if (rA.nLen >= rB.nLen)
+ {
+ nLen = rA.nLen;
+ for (i = rB.nLen; i < nLen; i++)
+ rB.nNum[i] = 0;
+ }
+ else
+ {
+ nLen = rB.nLen;
+ for (i = rA.nLen; i < nLen; i++)
+ rA.nNum[i] = 0;
+ }
+
+ // Die Ziffern werden von hinten nach vorne addiert
+ long k;
+ long nZ = 0;
+ for (i = 0, k = 0; i < nLen; i++) {
+ nZ = (long)rA.nNum[i] + (long)rB.nNum[i] + k;
+ if (nZ & 0xff0000L)
+ k = 1;
+ else
+ k = 0;
+ rErg.nNum[i] = (USHORT)(nZ & 0xffffL);
+ }
+ // Trat nach der letzten Addition ein Ueberlauf auf, muss dieser
+ // noch ins Ergebis uebernommen werden
+ if (nZ & 0xff0000L) // oder if(k)
+ {
+ rErg.nNum[i] = 1;
+ nLen++;
+ }
+ // Die Laenge und das Vorzeichen setzen
+ rErg.nLen = nLen;
+ rErg.bIsNeg = rA.bIsNeg && rB.bIsNeg;
+ rErg.bIsBig = TRUE;
+ }
+ // Wenn nur einer der beiden Operanten negativ ist, wird aus der
+ // Addition eine Subtaktion
+ else if (rA.bIsNeg)
+ {
+ rA.bIsNeg = FALSE;
+ SubLong(rB, rA, rErg);
+ rA.bIsNeg = TRUE;
+ }
+ else
+ {
+ rB.bIsNeg = FALSE;
+ SubLong(rA, rB, rErg);
+ rB.bIsNeg = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void SubLong( BigInt& rA, BigInt& rB, BigInt& rErg )
+{
+ if ( rA.bIsNeg == rB.bIsNeg )
+ {
+ int i;
+ char nLen;
+ long nZ, k;
+
+ // wenn die Zahlen unterschiedlich lang sind, sollte zunaechst bei
+ // der kleineren Zahl die fehlenden Ziffern mit 0 initialisert werden
+ if (rA.nLen >= rB.nLen)
+ {
+ nLen = rA.nLen;
+ for (i = rB.nLen; i < nLen; i++)
+ rB.nNum[i] = 0;
+ }
+ else
+ {
+ nLen = rB.nLen;
+ for (i = rA.nLen; i < nLen; i++)
+ rA.nNum[i] = 0;
+ }
+
+ if ( IsLess(rA, rB) )
+ {
+ for (i = 0, k = 0; i < nLen; i++)
+ {
+ nZ = (long)rA.nNum[i] - (long)rB.nNum[i] + k;
+ if (nZ < 0)
+ k = -1;
+ else
+ k = 0;
+ rErg.nNum[i] = (USHORT)(nZ & 0xffffL);
+ }
+ rErg.bIsNeg = rA.bIsNeg;
+ }
+ else
+ {
+ for (i = 0, k = 0; i < nLen; i++)
+ {
+ nZ = (long)rB.nNum[i] - (long)rA.nNum[i] + k;
+ if (nZ < 0)
+ k = -1;
+ else
+ k = 0;
+ rErg.nNum[i] = (USHORT)(nZ & 0xffffL);
+ }
+ // wenn a < b, dann Vorzeichen vom Ergebnis umdrehen
+ rErg.bIsNeg = !rA.bIsNeg;
+ }
+ rErg.nLen = nLen;
+ rErg.bIsBig = TRUE;
+ }
+ // Wenn nur einer der beiden Operanten negativ ist, wird aus der
+ // Subtaktion eine Addition
+ else if (rA.bIsNeg)
+ {
+ rA.bIsNeg = FALSE;
+ AddLong(rA, rB, rErg);
+ rA.bIsNeg = TRUE;
+ rErg.bIsNeg = TRUE;
+ }
+ else
+ {
+ rB.bIsNeg = FALSE;
+ AddLong(rA, rB, rErg);
+ rB.bIsNeg = TRUE;
+ rErg.bIsNeg = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void MultLong( const BigInt& rA, const BigInt& rB, BigInt& rErg )
+{
+ int i, j;
+ ULONG nZ, k;
+
+ rErg.bIsNeg = rA.bIsNeg != rB.bIsNeg;
+ rErg.bIsBig = TRUE;
+ rErg.nLen = rA.nLen + rB.nLen;
+
+ for (i = 0; i < rErg.nLen; i++)
+ rErg.nNum[i] = 0;
+
+ for (j = 0; j < rB.nLen; j++)
+ {
+ for (i = 0, k = 0; i < rA.nLen; i++)
+ {
+ nZ = (ULONG)rA.nNum[i] * (ULONG)rB.nNum[j] +
+ (ULONG)rErg.nNum[i + j] + k;
+ rErg.nNum[i + j] = (USHORT)(nZ & 0xffffUL);
+ k = nZ >> 16;
+ }
+ rErg.nNum[i + j] = (USHORT)k;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void DivLong( const BigInt& rA, const BigInt& rB, BigInt& rErg )
+{
+ int i, j;
+ long nTmp;
+ USHORT nK, nQ, nMult;
+ short nLenB = rB.nLen;
+ short nLenB1 = rB.nLen - 1;
+ BigInt aTmpA, aTmpB;
+
+ nMult = (USHORT)(0x10000L / ((long)rB.nNum[nLenB1] + 1));
+
+ Mult( aTmpA, rA, nMult );
+ if ( aTmpA.nLen == rA.nLen )
+ {
+ aTmpA.nNum[aTmpA.nLen] = 0;
+ aTmpA.nLen++;
+ }
+
+ Mult( aTmpB, rB, nMult );
+
+ for (j = aTmpA.nLen - 1; j >= nLenB; j--)
+ { // Raten des Divisors
+ nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
+ if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
+ nQ = 0xFFFF;
+ else
+ nQ = (USHORT)(((ULONG)nTmp) / aTmpB.nNum[nLenB1]);
+
+ if ( ((ULONG)aTmpB.nNum[nLenB1 - 1] * nQ) >
+ ((((ULONG)nTmp) - aTmpB.nNum[nLenB1] * nQ) << 16) + aTmpA.nNum[j - 2])
+ nQ--;
+ // Und hier faengt das Teilen an
+ nK = 0;
+ nTmp = 0;
+ for (i = 0; i < nLenB; i++)
+ {
+ nTmp = (long)aTmpA.nNum[j - nLenB + i]
+ - ((long)aTmpB.nNum[i] * nQ)
+ - nK;
+ aTmpA.nNum[j - nLenB + i] = (USHORT)nTmp;
+ nK = (USHORT) (nTmp >> 16);
+ if ( nK )
+ nK = (USHORT)(0x10000UL - nK);
+ }
+ aTmpA.nNum[j - nLenB + i] -= nK;
+ if (aTmpA.nNum[j - nLenB + i] == 0)
+ rErg.nNum[j - nLenB] = nQ;
+ else
+ {
+ rErg.nNum[j - nLenB] = nQ - 1;
+ nK = 0;
+ for (i = 0; i < nLenB; i++)
+ {
+ nTmp = aTmpA.nNum[j - nLenB + i] + aTmpB.nNum[i] + nK;
+ aTmpA.nNum[j - nLenB + i] = (USHORT)(nTmp & 0xFFFFL);
+ if (nTmp & 0xFFFF0000L)
+ nK = 1;
+ else
+ nK = 0;
+ }
+ }
+ }
+
+ rErg.bIsNeg = rA.bIsNeg != rB.bIsNeg;
+ rErg.bIsBig = TRUE;
+ rErg.nLen = rA.nLen - rB.nLen + 1;
+}
+
+// -----------------------------------------------------------------------
+
+static void ModLong( const BigInt& rA, const BigInt& rB, BigInt& rErg )
+{
+ short i, j;
+ long nTmp;
+ USHORT nK, nQ, nMult;
+ short nLenB = rB.nLen;
+ short nLenB1 = rB.nLen - 1;
+ BigInt aTmpA, aTmpB;
+
+ nMult = (USHORT)(0x10000L / ((long)rB.nNum[nLenB1] + 1));
+
+ Mult( aTmpA, rA, nMult);
+ if ( aTmpA.nLen == rA.nLen )
+ {
+ aTmpA.nNum[aTmpA.nLen] = 0;
+ aTmpA.nLen++;
+ }
+
+ Mult( aTmpB, rB, nMult);
+
+ for (j = aTmpA.nLen - 1; j >= nLenB; j--)
+ { // Raten des Divisors
+ nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
+ if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
+ nQ = 0xFFFF;
+ else
+ nQ = (USHORT)(((ULONG)nTmp) / aTmpB.nNum[nLenB1]);
+
+ if ( ((ULONG)aTmpB.nNum[nLenB1 - 1] * nQ) >
+ ((((ULONG)nTmp) - aTmpB.nNum[nLenB1] * nQ) << 16) + aTmpA.nNum[j - 2])
+ nQ--;
+ // Und hier faengt das Teilen an
+ nK = 0;
+ nTmp = 0;
+ for (i = 0; i < nLenB; i++)
+ {
+ nTmp = (long)aTmpA.nNum[j - nLenB + i]
+ - ((long)aTmpB.nNum[i] * nQ)
+ - nK;
+ aTmpA.nNum[j - nLenB + i] = (USHORT)nTmp;
+ nK = (USHORT) (nTmp >> 16);
+ if ( nK )
+ nK = (USHORT)(0x10000UL - nK);
+ }
+ aTmpA.nNum[j - nLenB + i] -= nK;
+ if (aTmpA.nNum[j - nLenB + i] == 0)
+ rErg.nNum[j - nLenB] = nQ;
+ else
+ {
+ rErg.nNum[j - nLenB] = nQ - 1;
+ nK = 0;
+ for (i = 0; i < nLenB; i++) {
+ nTmp = aTmpA.nNum[j - nLenB + i] + aTmpB.nNum[i] + nK;
+ aTmpA.nNum[j - nLenB + i] = (USHORT)(nTmp & 0xFFFFL);
+ if (nTmp & 0xFFFF0000L)
+ nK = 1;
+ else
+ nK = 0;
+ }
+ }
+ }
+
+ rErg = aTmpA;
+ Div( rErg, nMult, nQ );
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ABS_IsLess( const BigInt& rA, const BigInt& rB )
+{
+ if (rA.bIsBig || rB.bIsBig)
+ {
+ BigInt nA, nB;
+ MakeBigInt( nA, rA );
+ MakeBigInt( nB, rB );
+ if (nA.nLen == nB.nLen)
+ {
+ int i;
+ for (i = nA.nLen - 1; i > 0 && nA.nNum[i] == nB.nNum[i]; i--)
+ {
+ }
+ return nA.nNum[i] < nB.nNum[i];
+ }
+ else
+ return nA.nLen < nB.nLen;
+ }
+ if ( rA.nVal < 0 )
+ if ( rB.nVal < 0 )
+ return rA.nVal > rB.nVal;
+ else
+ return rA.nVal > -rB.nVal;
+ else
+ if ( rB.nVal < 0 )
+ return rA.nVal < -rB.nVal;
+ else
+ return rA.nVal < rB.nVal;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt::BigInt( const BigInt& rBigInt )
+{
+ if ( rBigInt.bIsBig )
+ memcpy( (void*)this, (const void*)&rBigInt, sizeof( BigInt ) );
+ else
+ {
+ bIsSet = rBigInt.bIsSet;
+ bIsBig = FALSE;
+ nVal = rBigInt.nVal;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BigInt::BigInt( const ByteString& rString )
+{
+ bIsSet = TRUE;
+ bIsNeg = FALSE;
+ bIsBig = FALSE;
+ nVal = 0;
+
+ BOOL bNeg = FALSE;
+ const sal_Char* p = rString.GetBuffer();
+ if ( *p == '-' )
+ {
+ bNeg = TRUE;
+ p++;
+ }
+ while( *p >= '0' && *p <= '9' )
+ {
+ *this *= 10;
+ *this += *p - '0';
+ p++;
+ }
+ if ( bIsBig )
+ bIsNeg = bNeg;
+ else if( bNeg )
+ nVal = -nVal;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt::BigInt( const UniString& rString )
+{
+ bIsSet = TRUE;
+ bIsNeg = FALSE;
+ bIsBig = FALSE;
+ nVal = 0;
+
+ BOOL bNeg = FALSE;
+ const sal_Unicode* p = rString.GetBuffer();
+ if ( *p == '-' )
+ {
+ bNeg = TRUE;
+ p++;
+ }
+ while( *p >= '0' && *p <= '9' )
+ {
+ *this *= 10;
+ *this += *p - '0';
+ p++;
+ }
+ if ( bIsBig )
+ bIsNeg = bNeg;
+ else if( bNeg )
+ nVal = -nVal;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt::BigInt( double nValue )
+{
+ bIsSet = TRUE;
+
+ if ( nValue < 0 )
+ {
+ nValue *= -1;
+ bIsNeg = TRUE;
+ }
+ else
+ {
+ bIsNeg = FALSE;
+ }
+
+ if ( nValue < 1 )
+ {
+ bIsBig = FALSE;
+ nVal = 0;
+ }
+ else
+ {
+ bIsBig = TRUE;
+
+ int i=0;
+
+ while ( ( nValue > 65536.0 ) && ( i < MAX_DIGITS ) )
+ {
+ nNum[i] = (USHORT) fmod( nValue, 65536.0 );
+ nValue -= nNum[i];
+ nValue /= 65536.0;
+ i++;
+ }
+ if ( i < MAX_DIGITS )
+ nNum[i++] = (USHORT) nValue;
+
+ nLen = i;
+
+ if ( i < 3 )
+ Normalize( *this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BigInt::BigInt( ULONG nValue )
+{
+#if __SIZEOFLONG != 4
+ #error sizeof (long) != 4: API auf INTxx umstellen
+#else
+ bIsSet = TRUE;
+ if ( nValue & 0x80000000UL )
+ {
+ bIsBig = TRUE;
+ bIsNeg = FALSE;
+ nNum[0] = (USHORT)(nValue & 0xffffUL);
+ nNum[1] = (USHORT)(nValue >> 16);
+ nLen = 2;
+ }
+ else
+ {
+ bIsBig = FALSE;
+ nVal = nValue;
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BigInt::operator ULONG() const
+{
+ if ( !bIsBig )
+ return (ULONG)nVal;
+ else if ( nLen == 2 )
+ {
+ ULONG nRet;
+ nRet = ((ULONG)nNum[1]) << 16;
+ nRet += nNum[0];
+ return nRet;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt::operator double() const
+{
+ if ( !bIsBig )
+ return (double) nVal;
+ else
+ {
+ int i = nLen-1;
+ double nRet = (double) ((ULONG)nNum[i]);
+
+ while ( i )
+ {
+ nRet *= 65536.0;
+ i--;
+ nRet += (double) ((ULONG)nNum[i]);
+ }
+
+ if ( bIsNeg )
+ nRet *= -1;
+
+ return nRet;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ByteString BigInt::GetByteString() const
+{
+ ByteString aString;
+
+ if ( !bIsBig )
+ aString = nVal;
+ else
+ {
+ BigInt aTmp( *this );
+ BigInt a1000000000( 1000000000L );
+ aTmp.Abs();
+
+ do
+ {
+ BigInt a = aTmp;
+ a %= a1000000000;
+ aTmp /= a1000000000;
+
+ ByteString aStr = aString;
+ if ( a.nVal < 100000000L )
+ { // leading 0s
+ aString = ByteString::CreateFromInt32( a.nVal + 1000000000L );
+ aString.Erase( 0, 1 );
+ }
+ else
+ aString = ByteString::CreateFromInt32( a.nVal );
+ aString += aStr;
+ }
+ while( aTmp.bIsBig );
+
+ ByteString aStr = aString;
+ if ( bIsNeg )
+ aString = ByteString::CreateFromInt32( -aTmp.nVal );
+ else
+ aString = ByteString::CreateFromInt32( aTmp.nVal );
+ aString += aStr;
+ }
+
+ return aString;
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef ENABLEUNICODE
+
+UniString BigInt::GetString() const
+{
+ UniString aString;
+
+ if ( !bIsBig )
+ aString = nVal;
+ else
+ {
+ BigInt aTmp( *this );
+ BigInt a1000000000( 1000000000L );
+ aTmp.Abs();
+
+ do
+ {
+ BigInt a = aTmp;
+ a %= a1000000000;
+ aTmp /= a1000000000;
+
+ UniString aStr = aString;
+ if ( a.nVal < 100000000L )
+ { // leading 0s
+ aString = UniString::CreateFromInt32( a.nVal + 1000000000L );
+ aString.Erase(0,1);
+ }
+ else
+ aString = UniString::CreateFromInt32( a.nVal );
+ aString += aStr;
+ }
+ while( aTmp.bIsBig );
+
+ UniString aStr = aString;
+ if ( bIsNeg )
+ aString = UniString::CreateFromInt32( -aTmp.nVal );
+ else
+ aString = UniString::CreateFromInt32( aTmp.nVal );
+ aString += aStr;
+ }
+
+ return aString;
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+BigInt& BigInt::operator=( const BigInt& rBigInt )
+{
+ if ( rBigInt.bIsBig )
+ memcpy( (void*)this, (const void*)&rBigInt, sizeof( BigInt ) );
+ else
+ {
+ bIsSet = rBigInt.bIsSet;
+ bIsBig = FALSE;
+ nVal = rBigInt.nVal;
+ }
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt& BigInt::operator+=( const BigInt& rVal )
+{
+ if ( !bIsBig && !rVal.bIsBig )
+ {
+ if( nVal <= MY_MAXLONG && rVal.nVal <= MY_MAXLONG
+ && nVal >= MY_MINLONG && rVal.nVal >= MY_MINLONG )
+ { // wir bewegen uns im ungefaehrlichem Bereich
+ nVal += rVal.nVal;
+ return *this;
+ }
+
+ if( (nVal < 0) != (rVal.nVal < 0) )
+ { // wir bewegen uns im ungefaehrlichem Bereich
+ nVal += rVal.nVal;
+ return *this;
+ }
+ }
+
+ BigInt aTmp1, aTmp2;
+ MakeBigInt( aTmp1, *this );
+ MakeBigInt( aTmp2, rVal );
+ AddLong( aTmp1, aTmp2, *this );
+ Normalize( *this );
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt& BigInt::operator-=( const BigInt& rVal )
+{
+ if ( !bIsBig && !rVal.bIsBig )
+ {
+ if ( nVal <= MY_MAXLONG && rVal.nVal <= MY_MAXLONG &&
+ nVal >= MY_MINLONG && rVal.nVal >= MY_MINLONG )
+ { // wir bewegen uns im ungefaehrlichem Bereich
+ nVal -= rVal.nVal;
+ return *this;
+ }
+
+ if ( (nVal < 0) == (rVal.nVal < 0) )
+ { // wir bewegen uns im ungefaehrlichem Bereich
+ nVal -= rVal.nVal;
+ return *this;
+ }
+ }
+
+ BigInt aTmp1, aTmp2;
+ MakeBigInt( aTmp1, *this );
+ MakeBigInt( aTmp2, rVal );
+ SubLong( aTmp1, aTmp2, *this );
+ Normalize( *this );
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt& BigInt::operator*=( const BigInt& rVal )
+{
+ if ( !bIsBig && !rVal.bIsBig
+ && nVal <= MY_MAXSHORT && rVal.nVal <= MY_MAXSHORT
+ && nVal >= MY_MINSHORT && rVal.nVal >= MY_MINSHORT )
+ // nicht optimal !!! W.P.
+ { // wir bewegen uns im ungefaehrlichem Bereich
+ nVal *= rVal.nVal;
+ }
+ else
+ {
+ BigInt aTmp1, aTmp2;
+ MakeBigInt( aTmp1, rVal );
+ MakeBigInt( aTmp2, *this );
+ MultLong(aTmp1, aTmp2, *this);
+ Normalize( *this );
+ }
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt& BigInt::operator/=( const BigInt& rVal )
+{
+ if ( !rVal.bIsBig )
+ {
+ if ( rVal.nVal == 0 )
+ {
+ DBG_ERROR( "BigInt::operator/ --> divide by zero" );
+ return *this;
+ }
+
+ if ( !bIsBig )
+ {
+ // wir bewegen uns im ungefaehrlichem Bereich
+ nVal /= rVal.nVal;
+ return *this;
+ }
+
+ if ( rVal.nVal == 1 )
+ return *this;
+
+ if ( rVal.nVal == -1 )
+ {
+ bIsNeg = !bIsNeg;
+ return *this;
+ }
+
+ if ( rVal.nVal <= (long)0xFFFF && rVal.nVal >= -(long)0xFFFF )
+ {
+ // ein BigInt durch ein USHORT teilen
+ USHORT nTmp;
+ if ( rVal.nVal < 0 )
+ {
+ nTmp = (USHORT) -rVal.nVal;
+ bIsNeg = !bIsNeg;
+ }
+ else
+ nTmp = (USHORT) rVal.nVal;
+
+ Div( *this, nTmp, nTmp );
+ Normalize( *this );
+ return *this;
+ }
+ }
+
+ if ( ABS_IsLess( *this, rVal ) )
+ {
+ *this = BigInt( (long)0 );
+ return *this;
+ }
+
+ // BigInt durch BigInt teilen
+ BigInt aTmp1, aTmp2;
+ MakeBigInt( aTmp1, *this );
+ MakeBigInt( aTmp2, rVal );
+ DivLong(aTmp1, aTmp2, *this);
+ Normalize( *this );
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void BigInt::DivMod( const BigInt& rVal, BigInt& rMod )
+{
+ if ( !rVal.bIsBig )
+ {
+ if ( rVal.nVal == 0 )
+ {
+ DBG_ERROR( "BigInt::operator/ --> divide by zero" );
+ return;
+ }
+
+ if ( !bIsBig )
+ {
+ // wir bewegen uns im ungefaehrlichem Bereich
+ rMod = BigInt( nVal % rVal.nVal );
+ nVal /= rVal.nVal;
+ return;
+ }
+
+ if ( rVal.nVal == 1 )
+ {
+ rMod = BigInt( (long)0 );
+ return;
+ }
+
+ if ( rVal.nVal == -1 )
+ {
+ rMod = BigInt( (long)0 );
+ bIsNeg = !bIsNeg;
+ return;
+ }
+
+ if ( rVal.nVal <= (long)0xFFFF && rVal.nVal >= -(long)0xFFFF )
+ {
+ // ein BigInt durch ein USHORT teilen
+ USHORT nTmp;
+ if ( rVal.nVal < 0 )
+ {
+ nTmp = (USHORT) -rVal.nVal;
+ bIsNeg = !bIsNeg;
+ }
+ else
+ nTmp = (USHORT) rVal.nVal;
+
+ Div( *this, nTmp, nTmp );
+ rMod = BigInt( (long)nTmp );
+ Normalize( *this );
+ return;
+ }
+ }
+
+ if ( ABS_IsLess( *this, rVal ) )
+ {
+ rMod = *this;
+ *this = BigInt( (long)0 );
+ return;
+ }
+
+ // BigInt durch BigInt teilen
+ BigInt aTmp1, aTmp2;
+ MakeBigInt( aTmp1, *this );
+ MakeBigInt( aTmp2, rVal );
+ DivLong(aTmp1, aTmp2, *this);
+ Normalize( *this );
+ ModLong(aTmp1, aTmp2, rMod); // nicht optimal
+ Normalize( rMod );
+}
+
+// -----------------------------------------------------------------------
+
+BigInt& BigInt::operator%=( const BigInt& rVal )
+{
+ if ( !rVal.bIsBig )
+ {
+ if ( rVal.nVal == 0 )
+ {
+ DBG_ERROR( "BigInt::operator/ --> divide by zero" );
+ return *this;
+ }
+
+ if ( !bIsBig )
+ {
+ // wir bewegen uns im ungefaehrlichem Bereich
+ nVal %= rVal.nVal;
+ return *this;
+ }
+
+ if ( rVal.nVal <= (long)0xFFFF && rVal.nVal >= -(long)0xFFFF )
+ {
+ // ein BigInt durch ein short teilen
+ USHORT nTmp;
+ if ( rVal.nVal < 0 )
+ {
+ nTmp = (USHORT) -rVal.nVal;
+ bIsNeg = !bIsNeg;
+ }
+ else
+ nTmp = (USHORT) rVal.nVal;
+
+ Div( *this, nTmp, nTmp );
+ *this = BigInt( (long)nTmp );
+ return *this;
+ }
+ }
+
+ if ( ABS_IsLess( *this, rVal ) )
+ return *this;
+
+ // BigInt durch BigInt teilen
+ BigInt aTmp1, aTmp2;
+ MakeBigInt( aTmp1, *this );
+ MakeBigInt( aTmp2, rVal );
+ ModLong(aTmp1, aTmp2, *this);
+ Normalize( *this );
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL operator==( const BigInt& rVal1, const BigInt& rVal2 )
+{
+ if ( rVal1.bIsBig || rVal2.bIsBig )
+ {
+ BigInt nA, nB;
+ MakeBigInt( nA, rVal1 );
+ MakeBigInt( nB, rVal2 );
+ if ( nA.bIsNeg == nB.bIsNeg )
+ {
+ if ( nA.nLen == nB.nLen )
+ {
+ int i;
+ for ( i = nA.nLen - 1; i > 0 && nA.nNum[i] == nB.nNum[i]; i-- )
+ {
+ }
+
+ return nA.nNum[i] == nB.nNum[i];
+ }
+ return FALSE;
+ }
+ return FALSE;
+ }
+ return rVal1.nVal == rVal2.nVal;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL operator<( const BigInt& rVal1, const BigInt& rVal2 )
+{
+ if ( rVal1.bIsBig || rVal2.bIsBig )
+ {
+ BigInt nA, nB;
+ MakeBigInt( nA, rVal1 );
+ MakeBigInt( nB, rVal2 );
+ if ( nA.bIsNeg == nB.bIsNeg )
+ {
+ if ( nA.nLen == nB.nLen )
+ {
+ int i;
+ for ( i = nA.nLen - 1; i > 0 && nA.nNum[i] == nB.nNum[i]; i-- )
+ {
+ }
+
+ if ( nA.bIsNeg )
+ return nA.nNum[i] > nB.nNum[i];
+ else
+ return nA.nNum[i] < nB.nNum[i];
+ }
+ if ( nA.bIsNeg )
+ return nA.nLen > nB.nLen;
+ else
+ return nA.nLen < nB.nLen;
+ }
+ return !nB.bIsNeg;
+ }
+ return rVal1.nVal < rVal2.nVal;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL operator >(const BigInt& rVal1, const BigInt& rVal2 )
+{
+ if ( rVal1.bIsBig || rVal2.bIsBig )
+ {
+ BigInt nA, nB;
+ MakeBigInt( nA, rVal1 );
+ MakeBigInt( nB, rVal2 );
+ if ( nA.bIsNeg == nB.bIsNeg )
+ {
+ if ( nA.nLen == nB.nLen )
+ {
+ int i;
+ for ( i = nA.nLen - 1; i > 0 && nA.nNum[i] == nB.nNum[i]; i-- )
+ {
+ }
+
+ if ( nA.bIsNeg )
+ return nA.nNum[i] < nB.nNum[i];
+ else
+ return nA.nNum[i] > nB.nNum[i];
+ }
+ if ( nA.bIsNeg )
+ return nA.nLen < nB.nLen;
+ else
+ return nA.nLen > nB.nLen;
+ }
+ return !nA.bIsNeg;
+ }
+
+ return rVal1.nVal > rVal2.nVal;
+}
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
new file mode 100644
index 000000000000..f3ca447bffb5
--- /dev/null
+++ b/tools/source/generic/color.cxx
@@ -0,0 +1,403 @@
+/*************************************************************************
+ *
+ * $RCSfile: color.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdlib.h>
+
+#ifndef _VOS_MACROS_HXX_
+#include <vos/macros.hxx>
+#endif
+
+#ifndef _TOOLS_COLOR_HXX
+#include <color.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <stream.hxx>
+#endif
+
+// -----------
+// - Inlines -
+// -----------
+
+static inline long _FRound( double fVal )
+{
+ return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) );
+}
+
+// ---------
+// - Color -
+// ---------
+
+UINT8 Color::GetColorError( const Color& rCompareColor ) const
+{
+ const long nErrAbs = labs( (long) rCompareColor.GetRed() - GetRed() ) +
+ labs( (long) rCompareColor.GetGreen() - GetGreen() ) +
+ labs( (long) rCompareColor.GetBlue() - GetBlue() );
+
+ return (UINT8) _FRound( nErrAbs * 0.3333333333 );
+}
+
+// -----------------------------------------------------------------------
+
+void Color::IncreaseLuminance( UINT8 cLumInc )
+{
+ SetRed( (UINT8) VOS_BOUND( (long) COLORDATA_RED( mnColor ) + cLumInc, 0L, 255L ) );
+ SetGreen( (UINT8) VOS_BOUND( (long) COLORDATA_GREEN( mnColor ) + cLumInc, 0L, 255L ) );
+ SetBlue( (UINT8) VOS_BOUND( (long) COLORDATA_BLUE( mnColor ) + cLumInc, 0L, 255L ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Color::DecreaseLuminance( UINT8 cLumDec )
+{
+ SetRed( (UINT8) VOS_BOUND( (long) COLORDATA_RED( mnColor ) - cLumDec, 0L, 255L ) );
+ SetGreen( (UINT8) VOS_BOUND( (long) COLORDATA_GREEN( mnColor ) - cLumDec, 0L, 255L ) );
+ SetBlue( (UINT8) VOS_BOUND( (long) COLORDATA_BLUE( mnColor ) - cLumDec, 0L, 255L ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Color::IncreaseContrast( UINT8 cContInc )
+{
+ if( cContInc)
+ {
+ const double fM = 128.0 / ( 128.0 - 0.4985 * cContInc );
+ const double fOff = 128.0 - fM * 128.0;
+
+ SetRed( (UINT8) VOS_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) );
+ SetGreen( (UINT8) VOS_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) );
+ SetBlue( (UINT8) VOS_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Color::DecreaseContrast( UINT8 cContDec )
+{
+ if( cContDec )
+ {
+ const double fM = ( 128.0 - 0.4985 * cContDec ) / 128.0;
+ const double fOff = 128.0 - fM * 128.0;
+
+ SetRed( (UINT8) VOS_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) );
+ SetGreen( (UINT8) VOS_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) );
+ SetBlue( (UINT8) VOS_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Color::Invert()
+{
+ SetRed( ~COLORDATA_RED( mnColor ) );
+ SetGreen( ~COLORDATA_GREEN( mnColor ) );
+ SetBlue( ~COLORDATA_BLUE( mnColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& Color::Read( SvStream& rIStm, BOOL bNewFormat )
+{
+ if ( bNewFormat )
+ rIStm >> mnColor;
+ else
+ rIStm >> *this;
+
+ return rIStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& Color::Write( SvStream& rOStm, BOOL bNewFormat )
+{
+ if ( bNewFormat )
+ rOStm << mnColor;
+ else
+ rOStm << *this;
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+#define COL_NAME_USER ((USHORT)0x8000)
+#define COL_RED_1B ((USHORT)0x0001)
+#define COL_RED_2B ((USHORT)0x0002)
+#define COL_GREEN_1B ((USHORT)0x0010)
+#define COL_GREEN_2B ((USHORT)0x0020)
+#define COL_BLUE_1B ((USHORT)0x0100)
+#define COL_BLUE_2B ((USHORT)0x0200)
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, Color& rColor )
+{
+ DBG_ASSERTWARNING( rIStream.GetVersion(), "Color::>> - Solar-Version not set on rIStream" );
+
+ USHORT nColorName;
+ USHORT nRed;
+ USHORT nGreen;
+ USHORT nBlue;
+
+ rIStream >> nColorName;
+
+ if ( nColorName & COL_NAME_USER )
+ {
+ if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
+ {
+ unsigned char cAry[6];
+ USHORT i = 0;
+
+ nRed = 0;
+ nGreen = 0;
+ nBlue = 0;
+
+ if ( nColorName & COL_RED_2B )
+ i += 2;
+ else if ( nColorName & COL_RED_1B )
+ i++;
+ if ( nColorName & COL_GREEN_2B )
+ i += 2;
+ else if ( nColorName & COL_GREEN_1B )
+ i++;
+ if ( nColorName & COL_BLUE_2B )
+ i += 2;
+ else if ( nColorName & COL_BLUE_1B )
+ i++;
+
+ rIStream.Read( cAry, i );
+ i = 0;
+
+ if ( nColorName & COL_RED_2B )
+ {
+ nRed = cAry[i];
+ nRed <<= 8;
+ i++;
+ nRed |= cAry[i];
+ i++;
+ }
+ else if ( nColorName & COL_RED_1B )
+ {
+ nRed = cAry[i];
+ nRed <<= 8;
+ i++;
+ }
+ if ( nColorName & COL_GREEN_2B )
+ {
+ nGreen = cAry[i];
+ nGreen <<= 8;
+ i++;
+ nGreen |= cAry[i];
+ i++;
+ }
+ else if ( nColorName & COL_GREEN_1B )
+ {
+ nGreen = cAry[i];
+ nGreen <<= 8;
+ i++;
+ }
+ if ( nColorName & COL_BLUE_2B )
+ {
+ nBlue = cAry[i];
+ nBlue <<= 8;
+ i++;
+ nBlue |= cAry[i];
+ i++;
+ }
+ else if ( nColorName & COL_BLUE_1B )
+ {
+ nBlue = cAry[i];
+ nBlue <<= 8;
+ i++;
+ }
+ }
+ else
+ {
+ rIStream >> nRed;
+ rIStream >> nGreen;
+ rIStream >> nBlue;
+ }
+
+ rColor.mnColor = RGB_COLORDATA( nRed>>8, nGreen>>8, nBlue>>8 );
+ }
+ else
+ {
+ static ColorData aColAry[] =
+ {
+ COL_BLACK, // COL_BLACK
+ COL_BLUE, // COL_BLUE
+ COL_GREEN, // COL_GREEN
+ COL_CYAN, // COL_CYAN
+ COL_RED, // COL_RED
+ COL_MAGENTA, // COL_MAGENTA
+ COL_BROWN, // COL_BROWN
+ COL_GRAY, // COL_GRAY
+ COL_LIGHTGRAY, // COL_LIGHTGRAY
+ COL_LIGHTBLUE, // COL_LIGHTBLUE
+ COL_LIGHTGREEN, // COL_LIGHTGREEN
+ COL_LIGHTCYAN, // COL_LIGHTCYAN
+ COL_LIGHTRED, // COL_LIGHTRED
+ COL_LIGHTMAGENTA, // COL_LIGHTMAGENTA
+ COL_YELLOW, // COL_YELLOW
+ COL_WHITE, // COL_WHITE
+ COL_WHITE, // COL_MENUBAR
+ COL_BLACK, // COL_MENUBARTEXT
+ COL_WHITE, // COL_POPUPMENU
+ COL_BLACK, // COL_POPUPMENUTEXT
+ COL_BLACK, // COL_WINDOWTEXT
+ COL_WHITE, // COL_WINDOWWORKSPACE
+ COL_BLACK, // COL_HIGHLIGHT
+ COL_WHITE, // COL_HIGHLIGHTTEXT
+ COL_BLACK, // COL_3DTEXT
+ COL_LIGHTGRAY, // COL_3DFACE
+ COL_WHITE, // COL_3DLIGHT
+ COL_GRAY, // COL_3DSHADOW
+ COL_LIGHTGRAY, // COL_SCROLLBAR
+ COL_WHITE, // COL_FIELD
+ COL_BLACK // COL_FIELDTEXT
+ };
+
+ if ( nColorName < (sizeof( aColAry )/sizeof(ColorData)) )
+ rColor.mnColor = aColAry[nColorName];
+ else
+ rColor.mnColor = COL_BLACK;
+ }
+
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const Color& rColor )
+{
+ DBG_ASSERTWARNING( rOStream.GetVersion(), "Color::<< - Solar-Version not set on rOStream" );
+
+ USHORT nColorName = COL_NAME_USER;
+ USHORT nRed = rColor.GetRed();
+ USHORT nGreen = rColor.GetGreen();
+ USHORT nBlue = rColor.GetBlue();
+ nRed = (nRed<<8) + nRed;
+ nGreen = (nGreen<<8) + nGreen;
+ nBlue = (nBlue<<8) + nBlue;
+
+ if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
+ {
+ unsigned char cAry[6];
+ USHORT i = 0;
+
+ if ( nRed & 0x00FF )
+ {
+ nColorName |= COL_RED_2B;
+ cAry[i] = (unsigned char)(nRed & 0xFF);
+ i++;
+ cAry[i] = (unsigned char)((nRed >> 8) & 0xFF);
+ i++;
+ }
+ else if ( nRed & 0xFF00 )
+ {
+ nColorName |= COL_RED_1B;
+ cAry[i] = (unsigned char)((nRed >> 8) & 0xFF);
+ i++;
+ }
+ if ( nGreen & 0x00FF )
+ {
+ nColorName |= COL_GREEN_2B;
+ cAry[i] = (unsigned char)(nGreen & 0xFF);
+ i++;
+ cAry[i] = (unsigned char)((nGreen >> 8) & 0xFF);
+ i++;
+ }
+ else if ( nGreen & 0xFF00 )
+ {
+ nColorName |= COL_GREEN_1B;
+ cAry[i] = (unsigned char)((nGreen >> 8) & 0xFF);
+ i++;
+ }
+ if ( nBlue & 0x00FF )
+ {
+ nColorName |= COL_BLUE_2B;
+ cAry[i] = (unsigned char)(nBlue & 0xFF);
+ i++;
+ cAry[i] = (unsigned char)((nBlue >> 8) & 0xFF);
+ i++;
+ }
+ else if ( nBlue & 0xFF00 )
+ {
+ nColorName |= COL_BLUE_1B;
+ cAry[i] = (unsigned char)((nBlue >> 8) & 0xFF);
+ i++;
+ }
+
+ rOStream << nColorName;
+ rOStream.Write( cAry, i );
+ }
+ else
+ {
+ rOStream << nColorName;
+ rOStream << nRed;
+ rOStream << nGreen;
+ rOStream << nBlue;
+ }
+
+ return rOStream;
+}
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
new file mode 100644
index 000000000000..6fc728df517f
--- /dev/null
+++ b/tools/source/generic/fract.cxx
@@ -0,0 +1,720 @@
+/*************************************************************************
+ *
+ * $RCSfile: fract.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _LIMITS_H
+#include <limits.h>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+
+#ifndef _FRACT_HXX
+#include <fract.hxx>
+#endif
+
+#define private public
+#define bIsLong bIsBig
+#include <bigint.hxx>
+#include <stream.hxx>
+
+/*************************************************************************
+|*
+|* GetGGT()
+|*
+|* Beschreibung Berechnet den groessten gemeinsamen Teiler von
+|* nVal1 und nVal2
+|* Parameter long nVal1, long nVal2
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 21.12.92
+|*
+*************************************************************************/
+
+// Die Funktion GetGGT berechnet den groessten gemeinsamen Teiler der
+// beiden als Parameter uebergebenen Werte nVal1 und nVal2 nach dem
+// Algorithmus von Euklid. Hat einer der beiden Parameter den Wert 0 oder
+// 1, so wird als Ergebnis der Wert 1 zurŸckgegeben. Da der Algorithmus
+// nur mit positiven Zahlen arbeitet, werden die beiden Parameter
+// entsprechend umgewandelt.
+// Zum Algorithmus: die beiden Parameter werden solange ducheinander
+// geteilt, bis sie beide gleich sind oder bis bei der Division
+// kein Rest bleibt. Der kleinere der beiden Werte ist dann der
+// GGT.
+
+static long GetGGT( long nVal1, long nVal2 )
+{
+ nVal1 = Abs( nVal1 );
+ nVal2 = Abs( nVal2 );
+
+ if ( nVal1 <= 1 || nVal2 <= 1 )
+ return 1;
+
+ while ( nVal1 != nVal2 )
+ {
+ if ( nVal1 > nVal2 )
+ {
+ nVal1 %= nVal2;
+ if ( nVal1 == 0 )
+ return nVal2;
+ }
+ else
+ {
+ nVal2 %= nVal1;
+ if ( nVal2 == 0 )
+ return nVal1;
+ }
+ }
+
+ return nVal1;
+}
+
+static void Reduce( BigInt &rVal1, BigInt &rVal2 )
+{
+ BigInt nA( rVal1 );
+ BigInt nB( rVal2 );
+ nA.Abs();
+ nB.Abs();
+
+ if ( nA.IsOne() || nB.IsOne() || nA.IsZero() || nB.IsZero() )
+ return;
+
+ while ( nA != nB )
+ {
+ if ( nA > nB )
+ {
+ nA %= nB;
+ if ( nA.IsZero() )
+ {
+ rVal1 /= nB;
+ rVal2 /= nB;
+ return;
+ }
+ }
+ else
+ {
+ nB %= nA;
+ if ( nB.IsZero() )
+ {
+ rVal1 /= nA;
+ rVal2 /= nA;
+ return;
+ }
+ }
+ }
+
+ rVal1 /= nA;
+ rVal2 /= nB;
+}
+
+/*************************************************************************
+|*
+|* Fraction::Fraction()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung WP 07.03.97
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+Fraction::Fraction( long nN1, long nN2, long nD1, long nD2 )
+{
+ long n;
+ int i = 1;
+
+ if( nN1 < 0 ) { i = -i; nN1 = -nN1; }
+ if( nN2 < 0 ) { i = -i; nN2 = -nN2; }
+ if( nD1 < 0 ) { i = -i; nD1 = -nD1; }
+ if( nD2 < 0 ) { i = -i; nD2 = -nD2; }
+
+ n = GetGGT( nN1, nD1 ); if( n > 1 ) { nN1 /= n; nD1 /= n; }
+ n = GetGGT( nN1, nD2 ); if( n > 1 ) { nN1 /= n; nD2 /= n; }
+ n = GetGGT( nN2, nD1 ); if( n > 1 ) { nN2 /= n; nD1 /= n; }
+ n = GetGGT( nN2, nD2 ); if( n > 1 ) { nN2 /= n; nD2 /= n; }
+
+ BigInt nN( nN1 );
+ nN *= BigInt( nN2 );
+
+ BigInt nD( nD1 );
+ nD *= BigInt( nD2 );
+
+ while ( nN.bIsLong || nD.bIsLong )
+ {
+ BigInt n1 = 1;
+ BigInt n2 = 2;
+
+ nN += n1;
+ nN /= n2;
+ nD += n1;
+ nD /= n2;
+
+ // Kuerzen ueber Groesste Gemeinsame Teiler
+ Reduce( nN, nD );
+ }
+
+ nNumerator = i * (long)nN;
+ nDenominator = (long)nD;
+}
+
+/*************************************************************************
+|*
+|* Fraction::Fraction()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 21.12.92
+|*
+*************************************************************************/
+
+// Zur Initialisierung eines Bruches wird nNum dem Zaehler und nDen dem
+// Nenner zugewiesen. Da negative Werte des Nenners einen Bruch als
+// ungueltig kennzeichnen, wird bei der Eingabe eines negativen Nenners
+// sowohl das Vorzeichen des Nenners und des Zaehlers invertiert um wieder
+// einen gueltigen Wert fuer den Bruch zu erhalten.
+
+Fraction::Fraction( long nNum, long nDen )
+{
+ nNumerator = nNum;
+ nDenominator = nDen;
+ if ( nDenominator < 0 )
+ {
+ nDenominator = -nDenominator;
+ nNumerator = -nNumerator;
+ }
+
+ // Kuerzen ueber Groesste Gemeinsame Teiler
+ long n = GetGGT( nNumerator, nDenominator );
+ nNumerator /= n;
+ nDenominator /= n;
+}
+
+/*************************************************************************
+|*
+|* Fraction::Fraction()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 21.12.92
+|*
+*************************************************************************/
+
+// Wenn der Wert von dVal groesser ist als LONG_MAX, dann wird der Bruch
+// auf den Wert ungueltig gesetzt, ansonsten werden dVal und der Nenner
+// solange mit 10 multipliziert, bis entweder der Zaehler oder der Nenner
+// groesser als LONG_MAX / 10 ist. Zum Schluss wird der so entstandene Bruch
+// gekuerzt.
+
+Fraction::Fraction( double dVal )
+{
+ long nDen = 1;
+ long nMAX = LONG_MAX / 10;
+
+ if ( dVal > LONG_MAX || dVal < LONG_MIN )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ return;
+ }
+
+ while ( Abs( (long)dVal ) < nMAX && nDen < nMAX )
+ {
+ dVal *= 10;
+ nDen *= 10;
+ }
+ nNumerator = (long)dVal;
+ nDenominator = nDen;
+
+ // Kuerzen ueber Groesste Gemeinsame Teiler
+ long n = GetGGT( nNumerator, nDenominator );
+ nNumerator /= n;
+ nDenominator /= n;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator double()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 14.05.91
+|*
+*************************************************************************/
+
+Fraction::operator double() const
+{
+ if ( nDenominator > 0 )
+ return (double)nNumerator / (double)nDenominator;
+ else
+ return (double)0;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator+=()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 21.12.92
+|*
+*************************************************************************/
+
+// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
+// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
+// ungueltig. Zur Addition werden die beiden Brueche erst durch
+// Erweiterung mit den Nenner des jeweils anderen Bruches auf einen
+// gemeinsamen Nenner gebracht. Anschliessend werden die beiden Zaehler
+// addiert und das Ergebnis gekuerzt (durch Division von Zaehler und
+// Nenner mit nGGT). Innerhalb der Funktion wird mit dem Datentyp SLong
+// gerechnet, um einen Moeglichen Ueberlauf erkennen zu koennen. Bei
+// einem Ueberlauf wird das Ergebnis auf den Wert ungueltig gesetzt.
+
+Fraction& Fraction::operator += ( const Fraction& rVal )
+{
+ if ( !rVal.IsValid() )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ if ( !IsValid() )
+ return *this;
+
+ // (a/b) + (c/d) = ( (a*d) + (c*b) ) / (b*d)
+ BigInt nN( nNumerator );
+ nN *= BigInt( rVal.nDenominator );
+ BigInt nW1Temp( nDenominator );
+ nW1Temp *= BigInt( rVal.nNumerator );
+ nN += nW1Temp;
+
+ BigInt nD( nDenominator );
+ nD *= BigInt( rVal.nDenominator );
+
+ Reduce( nN, nD );
+
+ if ( nN.bIsLong || nD.bIsLong )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ else
+ {
+ nNumerator = (long)nN,
+ nDenominator = (long)nD;
+ }
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator-=()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 21.12.92
+|*
+*************************************************************************/
+
+// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
+// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
+// ungueltig. Zur Subtraktion werden die beiden Brueche erst durch
+// Erweiterung mit den Nenner des jeweils anderen Bruches auf einen
+// gemeinsamen Nenner gebracht. Anschliessend werden die beiden Zaehler
+// subtrahiert und das Ergebnis gekuerzt (durch Division von Zaehler und
+// Nenner mit nGGT). Innerhalb der Funktion wird mit dem Datentyp BigInt
+// gerechnet, um einen Moeglichen Ueberlauf erkennen zu koennen. Bei
+// einem Ueberlauf wird das Ergebnis auf den Wert ungueltig gesetzt.
+
+Fraction& Fraction::operator -= ( const Fraction& rVal )
+{
+ if ( !rVal.IsValid() )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ if ( !IsValid() )
+ return *this;
+
+ // (a/b) - (c/d) = ( (a*d) - (c*b) ) / (b*d)
+ BigInt nN( nNumerator );
+ nN *= BigInt( rVal.nDenominator );
+ BigInt nW1Temp( nDenominator );
+ nW1Temp *= BigInt( rVal.nNumerator );
+ nN -= nW1Temp;
+
+ BigInt nD( nDenominator );
+ nD *= BigInt( rVal.nDenominator );
+
+ Reduce( nN, nD );
+
+ if ( nN.bIsLong || nD.bIsLong )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ else
+ {
+ nNumerator = (long)nN,
+ nDenominator = (long)nD;
+ }
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator*=()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung TH 19.08.92
+|*
+*************************************************************************/
+
+// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
+// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
+// ungueltig. Zur Multiplikation werden jeweils die beiden Zaehler und
+// Nenner miteinander multipliziert. Um Ueberlaufe zu vermeiden, werden
+// vorher jeweils der GGT zwischen dem Zaehler des einen und dem Nenner
+// des anderen Bruches bestimmt und bei der Multiplikation Zaehler und
+// Nenner durch die entsprechenden Werte geteilt.
+// Innerhalb der Funktion wird mit dem Datentyp BigInt gerechnet, um
+// einen Moeglichen Ueberlauf erkennen zu koennen. Bei einem Ueberlauf
+// wird das Ergebnis auf den Wert ungueltig gesetzt.
+
+Fraction& Fraction::operator *= ( const Fraction& rVal )
+{
+ if ( !rVal.IsValid() )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ if ( !IsValid() )
+ return *this;
+
+ long nGGT1 = GetGGT( nNumerator, rVal.nDenominator );
+ long nGGT2 = GetGGT( rVal.nNumerator, nDenominator );
+ BigInt nN( nNumerator / nGGT1 );
+ nN *= BigInt( rVal.nNumerator / nGGT2 );
+ BigInt nD( nDenominator / nGGT2 );
+ nD *= BigInt( rVal.nDenominator / nGGT1 );
+
+ if ( nN.bIsLong || nD.bIsLong )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ else
+ {
+ nNumerator = (long)nN,
+ nDenominator = (long)nD;
+ }
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator/=()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 21.12.92
+|*
+*************************************************************************/
+
+// Zunaechst werden die beiden Parameter auf ihre Gueltigkeit ueberprueft.
+// Ist einer der Parameter ungueltig, dann ist auch des Ergebnis
+// ungueltig.
+// Um den Bruch a durch b zu teilen, wird a mit dem Kehrwert von b
+// multipliziert. Analog zu Multiplikation wird jezt jeweils der Zaehler
+// des einen Bruches mit dem Nenner des anderen multipliziert.
+// Um Ueberlaufe zu vermeiden, werden vorher jeweils der GGT zwischen den
+// beiden Zaehlern und den beiden Nennern bestimmt und bei der
+// Multiplikation Zaehler und Nenner durch die entsprechenden Werte
+// geteilt.
+// Innerhalb der Funktion wird mit dem Datentyp BigInt gerechnet, um
+// einen Moeglichen Ueberlauf erkennen zu koennen. Bei einem Ueberlauf
+// wird das Ergebnis auf den Wert ungueltig gesetzt.
+
+Fraction& Fraction::operator /= ( const Fraction& rVal )
+{
+ if ( !rVal.IsValid() )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ if ( !IsValid() )
+ return *this;
+
+ long nGGT1 = GetGGT( nNumerator, rVal.nNumerator );
+ long nGGT2 = GetGGT( rVal.nDenominator, nDenominator );
+ BigInt nN( nNumerator / nGGT1 );
+ nN *= BigInt( rVal.nDenominator / nGGT2 );
+ BigInt nD( nDenominator / nGGT2 );
+ nD *= BigInt( rVal.nNumerator / nGGT1 );
+
+ if ( nN.bIsLong || nD.bIsLong )
+ {
+ nNumerator = 0;
+ nDenominator = -1;
+ }
+ else
+ {
+ nNumerator = (long)nN,
+ nDenominator = (long)nD;
+ if ( nDenominator < 0 )
+ {
+ nDenominator = -nDenominator;
+ nNumerator = -nNumerator;
+ }
+ }
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Fraction::ReduceInaccurate()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung JOE 17.09.95
+|* Letzte Aenderung JOE 17.09.95
+|*
+*************************************************************************/
+
+// Funktioniert z.Zt. nur fuer 32-Bit Werte !!!
+// Fehlerbehaftetes Kuerzen einer Fraction.
+// nSignificantBits gibt an, wieviele signifikante Binaerstellen
+// in Zaehler/Nenner mindestens erhalten bleiben sollen.
+// Beispiel: ReduceInaccurate(8) hat einen Fehler <1% [1/2^(8-1)]
+// dabei tritt der groesste Fehler bei folgendem Wertepaar auf:
+// Binaer 1000000011111111111111111111111b/1000000000000000000000000000000b
+// = 1082130431/1073741824
+// = ca. 1.007812499
+// Nach ReduceInaccurate( 8 ) wird daraus 1/1.
+
+void Fraction::ReduceInaccurate( unsigned nSignificantBits )
+{
+ if ( !nNumerator || !nDenominator )
+ return;
+
+ // Zaehler und Nenner auf den Stack fuer schnelleren Zugriff
+ UINT32 nMul;
+ UINT32 nDiv;
+ BOOL bNeg;
+ if ( nNumerator >= 0 )
+ {
+ nMul = (UINT32)nNumerator;
+ bNeg = FALSE;
+ }
+ else
+ {
+ nMul = (UINT32)(-nNumerator);
+ bNeg = TRUE;
+ }
+ nDiv=(UINT32)nDenominator;
+
+ UINT32 a=nMul; unsigned nMulZ=0; // Fuehrende Nullen zaehlen
+ while (a<0x00800000) { nMulZ+=8; a<<=8; }
+ while (a<0x80000000) { nMulZ++; a<<=1; }
+ a=nDiv; unsigned nDivZ=0; // Fuehrende Nullen zaehlen
+ while (a<0x00800000) { nDivZ+=8; a<<=8; }
+ while (a<0x80000000) { nDivZ++; a<<=1; }
+ // Anzahl der verwendeten Digits bestimmen
+ // Auch hier gehe ich davon aus, dass es sich um 32Bit-Werte handelt
+ int nMulDigits=32-nMulZ;
+ int nDivDigits=32-nDivZ;
+ // Nun bestimmen, wieviele Stellen hinten weg koennen
+ // Hier koennte man das Ergebnis noch etwas optimieren...
+ int nMulWeg=nMulDigits-nSignificantBits; if (nMulWeg<0) nMulWeg=0;
+ int nDivWeg=nDivDigits-nSignificantBits; if (nDivWeg<0) nDivWeg=0;
+ int nWeg=Min(nMulWeg,nDivWeg);
+ nMul>>=nWeg;
+ nDiv>>=nWeg;
+ if ( !nMul || !nDiv )
+ {
+ DBG_ERROR( "Oups, beim kuerzen einer Fraction hat sich Joe verrechnet." );
+ return;
+ }
+
+ // Nun noch kuerzen ueber GGT
+ long n1=GetGGT( nMul, nDiv );
+ if ( n1!=1 )
+ {
+ nMul/=n1;
+ nDiv/=n1;
+ }
+ if ( !bNeg )
+ nNumerator = (long)nMul;
+ else
+ nNumerator = -(long)nMul;
+ nDenominator = nDiv;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator ==()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung TH 19.08.92
+|*
+*************************************************************************/
+
+BOOL operator == ( const Fraction& rVal1, const Fraction& rVal2 )
+{
+ if ( !rVal1.IsValid() || !rVal2.IsValid() )
+ return FALSE;
+
+ return rVal1.nNumerator == rVal2.nNumerator
+ && rVal1.nDenominator == rVal2.nDenominator;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator <()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung DV 21.12.92
+|*
+*************************************************************************/
+
+// Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und
+// anschliessend zur Sicherheit noch einmal gekuerzt. Um die Brueche
+// (a/b) und (c/d) zu vergleichen, werden sie zunaechst auf einen
+// gemeinsamen Nenner gebracht (b*d), um dann die beiden Zaehler (a*d)
+// und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird
+// zurueckgegeben.
+
+BOOL operator < ( const Fraction& rVal1, const Fraction& rVal2 )
+{
+ if ( !rVal1.IsValid() || !rVal2.IsValid() )
+ return FALSE;
+
+ BigInt nN( rVal1.nNumerator );
+ nN *= BigInt( rVal2.nDenominator );
+ BigInt nD( rVal1.nDenominator );
+ nD *= BigInt( rVal2.nNumerator );
+
+ return nN < nD;
+}
+
+/*************************************************************************
+|*
+|* Fraction::operator >()
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung DV 20.09.90
+|* Letzte Aenderung TH 19.08.92
+|*
+*************************************************************************/
+
+// Beide Operanden werden zunaechst auf ihre Gueltigkeit ueberprueft und
+// anschliessend zur Sicherheit noch einmal gekuerzt. Um die Brueche
+// (a/b) und (c/d) zu vergleichen, werden sie zunaechst auf einen
+// gemeinsamen Nenner gebracht (b*d), um dann die beiden Zaehler (a*d)
+// und (c*b) zu vergleichen. Das Ergebnis dieses Vergleichs wird
+// zurueckgegeben.
+
+BOOL operator > ( const Fraction& rVal1, const Fraction& rVal2 )
+{
+ if ( !rVal1.IsValid() || !rVal2.IsValid() )
+ return FALSE;
+
+ BigInt nN( rVal1.nNumerator );
+ nN *= BigInt( rVal2.nDenominator );
+ BigInt nD( rVal1.nDenominator);
+ nD *= BigInt( rVal2.nNumerator );
+
+ return nN > nD;
+}
+
+/*************************************************************************
+|*
+|* SvStream& operator>>( SvStream& rIStream, Fraction& rFract )
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung MM 08.01.96
+|* Letzte Aenderung MM 08.01.96
+|*
+*************************************************************************/
+SvStream& operator >> ( SvStream& rIStream, Fraction& rFract )
+{
+ rIStream >> rFract.nNumerator;
+ rIStream >> rFract.nDenominator;
+ return rIStream;
+}
+
+/*************************************************************************
+|*
+|* SvStream& operator<<( SvStream& rIStream, Fraction& rFract )
+|*
+|* Beschreibung FRACT.SDW
+|* Ersterstellung MM 08.01.96
+|* Letzte Aenderung MM 08.01.96
+|*
+*************************************************************************/
+SvStream& operator << ( SvStream& rOStream, const Fraction& rFract )
+{
+ rOStream << rFract.nNumerator;
+ rOStream << rFract.nDenominator;
+ return rOStream;
+}
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
new file mode 100644
index 000000000000..3b340a558a3d
--- /dev/null
+++ b/tools/source/generic/gen.cxx
@@ -0,0 +1,699 @@
+/*************************************************************************
+ *
+ * $RCSfile: gen.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _SV_GEN_HXX
+#include <gen.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <stream.hxx>
+#endif
+
+// =======================================================================
+
+SvStream& operator>>( SvStream& rIStream, Pair& rPair )
+{
+ DBG_ASSERTWARNING( rIStream.GetVersion(), "Pair::>> - Solar-Version not set on rIStream" );
+
+ if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
+ {
+ unsigned char cId;
+ unsigned char cAry[8];
+ int i;
+ int i1;
+ int i2;
+ UINT32 nNum;
+
+ rIStream >> cId;
+ i1 = (cId & 0x70) >> 4;
+ i2 = cId & 0x07;
+ rIStream.Read( cAry, i1+i2 );
+
+ nNum = 0;
+ i = i1;
+ while ( i )
+ {
+ i--;
+ nNum <<= 8;
+ nNum |= cAry[i];
+ }
+ if ( cId & 0x80 )
+ nNum ^= 0xFFFFFFFF;
+ rPair.nA = (INT32)nNum;
+
+ nNum = 0;
+ i = i1+i2;
+ while ( i > i1 )
+ {
+ i--;
+ nNum <<= 8;
+ nNum |= cAry[i];
+ }
+ if ( cId & 0x08 )
+ nNum ^= 0xFFFFFFFF;
+ rPair.nB = (INT32)nNum;
+ }
+ else
+ {
+ rIStream >> rPair.nA >> rPair.nB;
+ }
+
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const Pair& rPair )
+{
+ DBG_ASSERTWARNING( rOStream.GetVersion(), "Pair::<< - Solar-Version not set on rOStream" );
+
+ if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
+ {
+ unsigned char cAry[9];
+ int i = 1;
+ UINT32 nNum;
+
+ cAry[0] = 0;
+
+ nNum = (UINT32)(INT32)rPair.nA;
+ if ( rPair.nA < 0 )
+ {
+ cAry[0] |= 0x80;
+ nNum ^= 0xFFFFFFFF;
+ }
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+ cAry[0] |= 0x40;
+ }
+ else
+ cAry[0] |= 0x30;
+ }
+ else
+ cAry[0] |= 0x20;
+ }
+ else
+ cAry[0] |= 0x10;
+ }
+
+ nNum = (UINT32)(INT32)rPair.nB;
+ if ( rPair.nB < 0 )
+ {
+ cAry[0] |= 0x08;
+ nNum ^= 0xFFFFFFFF;
+ }
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+ cAry[0] |= 0x04;
+ }
+ else
+ cAry[0] |= 0x03;
+ }
+ else
+ cAry[0] |= 0x02;
+ }
+ else
+ cAry[0] |= 0x01;
+ }
+
+ rOStream.Write( cAry, i );
+ }
+ else
+ {
+ rOStream << rPair.nA << rPair.nB;
+ }
+
+ return rOStream;
+}
+
+/*************************************************************************
+|*
+|* Rectangle::SetSize()
+|*
+|* Beschreibung GEN.SDW
+|* Ersterstellung DV 29.10.91
+|* Letzte Aenderung MM 21.04.94
+|*
+*************************************************************************/
+
+void Rectangle::SetSize( const Size& rSize )
+{
+ if ( rSize.Width() < 0 )
+ nRight = nLeft + rSize.Width() +1;
+ else if ( rSize.Width() > 0 )
+ nRight = nLeft + rSize.Width() -1;
+ else
+ nRight = RECT_EMPTY;
+
+ if ( rSize.Height() < 0 )
+ nBottom = nTop + rSize.Height() +1;
+ else if ( rSize.Height() > 0 )
+ nBottom = nTop + rSize.Height() -1;
+ else
+ nBottom = RECT_EMPTY;
+}
+
+/*************************************************************************
+|*
+|* Rectangle::Union()
+|*
+|* Beschreibung GEN.SDW
+|* Ersterstellung TH 20.10.92
+|* Letzte Aenderung MM 21.04.94
+|*
+*************************************************************************/
+
+Rectangle& Rectangle::Union( const Rectangle& rRect )
+{
+ if ( rRect.IsEmpty() )
+ return *this;
+
+ if ( IsEmpty() )
+ *this = rRect;
+ else
+ {
+ nLeft = Min( Min( nLeft, rRect.nLeft ), Min( nRight, rRect.nRight ) );
+ nRight = Max( Max( nLeft, rRect.nLeft ), Max( nRight, rRect.nRight ) );
+ nTop = Min( Min( nTop, rRect.nTop ), Min( nBottom, rRect.nBottom ) );
+ nBottom = Max( Max( nTop, rRect.nTop ), Max( nBottom, rRect.nBottom ) );
+ }
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Rectangle::Intersection()
+|*
+|* Beschreibung GEN.SDW
+|* Ersterstellung TH 20.10.92
+|* Letzte Aenderung MM 21.04.94
+|*
+*************************************************************************/
+
+Rectangle& Rectangle::Intersection( const Rectangle& rRect )
+{
+ if ( IsEmpty() )
+ return *this;
+ if ( rRect.IsEmpty() )
+ {
+ *this = Rectangle();
+ return *this;
+ }
+
+ // nicht mit umgedrehten Rechtecken arbeiten
+ Rectangle aTmpRect( rRect );
+ Justify();
+ aTmpRect.Justify();
+
+ // Schnitt bilden
+ nLeft = Max( nLeft, aTmpRect.nLeft );
+ nRight = Min( nRight, aTmpRect.nRight );
+ nTop = Max( nTop, aTmpRect.nTop );
+ nBottom= Min( nBottom, aTmpRect.nBottom );
+
+ // Feststellen ob Schnitt leer
+ if ( nRight < nLeft || nBottom < nTop )
+ *this = Rectangle();
+
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Rectangle::Justify()
+|*
+|* Beschreibung GEN.SDW
+|* Ersterstellung DV 07.03.91
+|* Letzte Aenderung DV 07.03.91
+|*
+*************************************************************************/
+
+void Rectangle::Justify()
+{
+ long nHelp;
+
+ // Abfrage, ob Right kleiner Left
+ if ( (nRight < nLeft) && (nRight != RECT_EMPTY) )
+ {
+ nHelp = nLeft;
+ nLeft = nRight;
+ nRight = nHelp;
+ }
+
+ // Abfrage, ob Bottom kleiner Top
+ if ( (nBottom < nTop) && (nBottom != RECT_EMPTY) )
+ {
+ nHelp = nBottom;
+ nBottom = nTop;
+ nTop = nHelp;
+ }
+}
+
+/*************************************************************************
+|*
+|* Rectangle::IsInside()
+|*
+|* Beschreibung GEN.SDW
+|* Ersterstellung TH 19.03.90
+|* Letzte Aenderung MM 21.04.94
+|*
+*************************************************************************/
+
+BOOL Rectangle::IsInside( const Point& rPoint ) const
+{
+ if ( IsEmpty() )
+ return FALSE;
+
+ BOOL bRet = TRUE;
+ if ( nLeft <= nRight )
+ {
+ if ( (rPoint.X() < nLeft) || (rPoint.X() > nRight) )
+ bRet = FALSE;
+ }
+ else
+ {
+ if ( (rPoint.X() > nLeft) || (rPoint.X() < nRight) )
+ bRet = FALSE;
+ }
+ if ( nTop <= nBottom )
+ {
+ if ( (rPoint.Y() < nTop) || (rPoint.Y() > nBottom) )
+ bRet = FALSE;
+ }
+ else
+ {
+ if ( (rPoint.Y() > nTop) || (rPoint.Y() < nBottom) )
+ bRet = FALSE;
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Rectangle::IsInside()
+|*
+|* Beschreibung GEN.SDW
+|* Ersterstellung TH 19.03.90
+|* Letzte Aenderung MM 21.04.94
+|*
+*************************************************************************/
+
+BOOL Rectangle::IsInside( const Rectangle& rRect ) const
+{
+ if ( IsInside( rRect.TopLeft() ) && IsInside( rRect.BottomRight() ) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Rectangle::IsOver()
+|*
+|* Beschreibung GEN.SDW
+|* Ersterstellung TH 19.03.90
+|* Letzte Aenderung MM 21.04.94
+|*
+*************************************************************************/
+
+BOOL Rectangle::IsOver( const Rectangle& rRect ) const
+{
+ // Wenn sie sich nicht schneiden, ueberlappen sie auch nicht
+ return !GetIntersection( rRect ).IsEmpty();
+}
+
+// =======================================================================
+
+SvStream& operator>>( SvStream& rIStream, Rectangle& rRect )
+{
+ DBG_ASSERTWARNING( rIStream.GetVersion(), "Rectangle::>> - Solar-Version not set on rIStream" );
+
+ if ( rIStream.GetCompressMode() == COMPRESSMODE_FULL )
+ {
+ unsigned char cIdAry[2];
+ unsigned char cAry[16];
+ int i;
+ int iLast;
+ int i1;
+ int i2;
+ int i3;
+ int i4;
+ UINT32 nNum;
+
+ rIStream.Read( cIdAry, 2 );
+ i1 = (cIdAry[0] & 0x70) >> 4;
+ i2 = cIdAry[0] & 0x07;
+ i3 = (cIdAry[1] & 0x70) >> 4;
+ i4 = cIdAry[1] & 0x07;
+ rIStream.Read( cAry, i1+i2+i3+i4 );
+
+ nNum = 0;
+ i = i1;
+ iLast = i;
+ while ( i )
+ {
+ i--;
+ nNum <<= 8;
+ nNum |= cAry[i];
+ }
+ iLast = i1;
+ if ( cIdAry[0] & 0x80 )
+ nNum ^= 0xFFFFFFFF;
+ rRect.nLeft = (INT32)nNum;
+
+ nNum = 0;
+ i = iLast+i2;
+ while ( i > iLast )
+ {
+ i--;
+ nNum <<= 8;
+ nNum |= cAry[i];
+ }
+ iLast += i2;
+ if ( cIdAry[0] & 0x08 )
+ nNum ^= 0xFFFFFFFF;
+ rRect.nTop = (INT32)nNum;
+
+ nNum = 0;
+ i = iLast+i3;
+ while ( i > iLast )
+ {
+ i--;
+ nNum <<= 8;
+ nNum |= cAry[i];
+ }
+ iLast += i3;
+ if ( cIdAry[1] & 0x80 )
+ nNum ^= 0xFFFFFFFF;
+ rRect.nRight = (INT32)nNum;
+
+ nNum = 0;
+ i = iLast+i4;
+ while ( i > iLast )
+ {
+ i--;
+ nNum <<= 8;
+ nNum |= cAry[i];
+ }
+ if ( cIdAry[1] & 0x08 )
+ nNum ^= 0xFFFFFFFF;
+ rRect.nBottom = (INT32)nNum;
+ }
+ else
+ {
+ rIStream >> rRect.nLeft >> rRect.nTop >> rRect.nRight >> rRect.nBottom;
+ }
+
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const Rectangle& rRect )
+{
+ DBG_ASSERTWARNING( rOStream.GetVersion(), "Rectangle::<< - Solar-Version not set on rOStream" );
+
+ if ( rOStream.GetCompressMode() == COMPRESSMODE_FULL )
+ {
+ unsigned char cAry[18];
+ int i = 2;
+ UINT32 nNum;
+
+ cAry[0] = 0;
+ cAry[1] = 0;
+
+ nNum = (UINT32)(INT32)rRect.nLeft;
+ if ( rRect.nLeft < 0 )
+ {
+ cAry[0] |= 0x80;
+ nNum ^= 0xFFFFFFFF;
+ }
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+ cAry[0] |= 0x40;
+ }
+ else
+ cAry[0] |= 0x30;
+ }
+ else
+ cAry[0] |= 0x20;
+ }
+ else
+ cAry[0] |= 0x10;
+ }
+
+ nNum = (UINT32)(INT32)rRect.nTop;
+ if ( rRect.nTop < 0 )
+ {
+ cAry[0] |= 0x08;
+ nNum ^= 0xFFFFFFFF;
+ }
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+ cAry[0] |= 0x04;
+ }
+ else
+ cAry[0] |= 0x03;
+ }
+ else
+ cAry[0] |= 0x02;
+ }
+ else
+ cAry[0] |= 0x01;
+ }
+
+ nNum = (UINT32)(INT32)rRect.nRight;
+ if ( rRect.nRight < 0 )
+ {
+ cAry[1] |= 0x80;
+ nNum ^= 0xFFFFFFFF;
+ }
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+ cAry[1] |= 0x40;
+ }
+ else
+ cAry[1] |= 0x30;
+ }
+ else
+ cAry[1] |= 0x20;
+ }
+ else
+ cAry[1] |= 0x10;
+ }
+
+ nNum = (UINT32)(INT32)rRect.nBottom;
+ if ( rRect.nBottom < 0 )
+ {
+ cAry[1] |= 0x08;
+ nNum ^= 0xFFFFFFFF;
+ }
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+
+ if ( nNum )
+ {
+ cAry[i] = (unsigned char)(nNum & 0xFF);
+ nNum >>= 8;
+ i++;
+ cAry[1] |= 0x04;
+ }
+ else
+ cAry[1] |= 0x03;
+ }
+ else
+ cAry[1] |= 0x02;
+ }
+ else
+ cAry[1] |= 0x01;
+ }
+
+ rOStream.Write( cAry, i );
+ }
+ else
+ {
+ rOStream << rRect.nLeft << rRect.nTop << rRect.nRight << rRect.nBottom;
+ }
+
+ return rOStream;
+}
diff --git a/tools/source/generic/link.cxx b/tools/source/generic/link.cxx
new file mode 100644
index 000000000000..33248d3363cd
--- /dev/null
+++ b/tools/source/generic/link.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * $RCSfile: link.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _LINK_HXX
+#include <link.hxx>
+#endif
+
+/*************************************************************************
+|*
+|* Link::operator==()
+|*
+|* Beschreibung LINK.SDW
+|* Ersterstellung AM 14.02.91
+|* Letzte Aenderung TH 07.11.95
+|*
+*************************************************************************/
+
+BOOL Link::operator==( const Link& rLink ) const
+{
+ if ( pFunc == rLink.pFunc )
+ {
+ if ( pFunc )
+ {
+ if ( pInst == rLink.pInst )
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
diff --git a/tools/source/generic/makefile.mk b/tools/source/generic/makefile.mk
new file mode 100644
index 000000000000..6b6ce0d86eef
--- /dev/null
+++ b/tools/source/generic/makefile.mk
@@ -0,0 +1,98 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=gen
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/toolsin.obj \
+ $(SLO)$/link.obj \
+ $(SLO)$/bigint.obj \
+ $(SLO)$/fract.obj \
+ $(SLO)$/solmath.obj \
+ $(SLO)$/color.obj \
+ $(SLO)$/l2txtenc.obj \
+ $(SLO)$/gen.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/toolsin.obj \
+ $(OBJ)$/link.obj \
+ $(OBJ)$/bigint.obj \
+ $(OBJ)$/fract.obj \
+ $(OBJ)$/solmath.obj \
+ $(OBJ)$/color.obj \
+ $(OBJ)$/l2txtenc.obj \
+ $(OBJ)$/gen.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/generic/toolsin.cxx b/tools/source/generic/toolsin.cxx
new file mode 100644
index 000000000000..b37e14321d9e
--- /dev/null
+++ b/tools/source/generic/toolsin.cxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolsin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TOOLS_TOOLSIN_CXX
+
+#include <string.h>
+
+#ifndef _SHL_HXX
+#include <shl.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _INTNTAB_HXX
+#include <intntab.hxx>
+#endif
+#ifndef _TOOLSIN_HXX
+#include <toolsin.hxx>
+#endif
+
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+#include <dll.hxx>
+#endif
+#ifdef MAC
+void ImpDeInitMemMgr();
+#endif
+
+void ImplDeleteCharTabData();
+
+// =======================================================================
+
+// Hier drin, da DOS bisher kein eigenes TOOLS-Verzeichnis hat
+
+#if defined( DOS )
+
+static void* aAppData[SHL_COUNT];
+
+void** GetAppData( USHORT nSharedLib )
+{
+ return &(aAppData[nSharedLib]);
+}
+
+#endif
+
+// =======================================================================
+
+TOOLSINDATA* ImplGetToolsInData()
+{
+ TOOLSINDATA** ppData = (TOOLSINDATA**)GetAppData( SHL_TOOLS );
+ if ( !(*ppData) )
+ {
+ TOOLSINDATA* pData = new TOOLSINDATA;
+ memset( pData, 0, sizeof( TOOLSINDATA ) );
+ *ppData = pData;
+ }
+
+ return *ppData;
+}
+
+// =======================================================================
+
+void InitTools()
+{
+ DBG_DEBUGSTART();
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitTools()
+{
+ TOOLSINDATA** ppData = (TOOLSINDATA**)GetAppData( SHL_TOOLS );
+ TOOLSINDATA* pData = *ppData;
+
+ if ( pData )
+ {
+ ImplDeleteIntnListData();
+ ImplDeleteCharTabData();
+ delete pData;
+ *ppData = NULL;
+ }
+
+ DBG_DEBUGEND();
+}
+
+// -----------------------------------------------------------------------
+
+void GlobalDeInitTools()
+{
+ DBG_GLOBALDEBUGEND();
+
+#if defined( WIN ) || defined( WNT )
+ ImpDeInitWinTools();
+#endif
+#ifdef OS2
+ ImpDeInitOS2Tools();
+#endif
+#ifdef MAC
+ ImpDeInitMemMgr();
+#endif
+}
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
new file mode 100644
index 000000000000..a1d70a045222
--- /dev/null
+++ b/tools/source/inet/inetmime.cxx
@@ -0,0 +1,4630 @@
+/*************************************************************************
+ *
+ * $RCSfile: inetmime.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <limits>
+
+#ifndef _DATETIME_HXX
+#include <datetime.hxx>
+#endif
+#ifndef TOOLS_INETMIME_HXX
+#include <inetmime.hxx>
+#endif
+
+#undef max // defined by <tools/solar.h>
+#undef min // defined by <tools/solar.h>
+
+namespace unnamed_tools_inetmime {} using namespace unnamed_tools_inetmime;
+ // unnamed namespaces don't work well yet
+
+//============================================================================
+namespace unnamed_tools_inetmime {
+
+class Charset
+{
+ rtl_TextEncoding m_eEncoding;
+ const sal_uInt32 * m_pRanges;
+
+public:
+ inline Charset(rtl_TextEncoding eTheEncoding,
+ const sal_uInt32 * pTheRanges);
+
+ rtl_TextEncoding getEncoding() const { return m_eEncoding; }
+
+ bool contains(sal_uInt32 nChar) const;
+};
+
+inline Charset::Charset(rtl_TextEncoding eTheEncoding,
+ const sal_uInt32 * pTheRanges):
+ m_eEncoding(eTheEncoding),
+ m_pRanges(pTheRanges)
+{
+ DBG_ASSERT(m_pRanges, "Charset::Charset(): Bad ranges");
+}
+
+//============================================================================
+void appendISO88591(UniString & rText, sal_Char const * pBegin,
+ sal_Char const * pEnd);
+
+}
+
+//============================================================================
+class INetMIMECharsetList_Impl
+{
+ struct Node
+ {
+ Charset m_aCharset;
+ bool m_bDisabled;
+ Node * m_pNext;
+
+ inline Node(const Charset & rTheCharset, bool bTheDisabled,
+ Node * pTheNext);
+ };
+
+ Node * m_pFirst;
+
+public:
+ INetMIMECharsetList_Impl(): m_pFirst(0) {}
+
+ ~INetMIMECharsetList_Impl();
+
+ void prepend(const Charset & rCharset)
+ { m_pFirst = new Node(rCharset, false, m_pFirst); }
+
+ void includes(sal_uInt32 nChar);
+
+ rtl_TextEncoding getPreferredEncoding(rtl_TextEncoding eDefault
+ = RTL_TEXTENCODING_DONTKNOW)
+ const;
+
+ void reset();
+};
+
+inline INetMIMECharsetList_Impl::Node::Node(const Charset & rTheCharset,
+ bool bTheDisabled,
+ Node * pTheNext):
+ m_aCharset(rTheCharset),
+ m_bDisabled(bTheDisabled),
+ m_pNext(pTheNext)
+{}
+
+//============================================================================
+namespace unnamed_tools_inetmime {
+
+struct Parameter
+{
+ Parameter * m_pNext;
+ ByteString m_aAttribute;
+ ByteString m_aCharset;
+ ByteString m_aLanguage;
+ ByteString m_aValue;
+ sal_uInt32 m_nSection;
+ bool m_bExtended;
+
+ inline Parameter(Parameter * pTheNext, ByteString const & rTheAttribute,
+ ByteString const & rTheCharset,
+ ByteString const & rTheLanguage,
+ ByteString const & rTheValue, sal_uInt32 nTheSection,
+ bool bTheExtended);
+};
+
+inline Parameter::Parameter(Parameter * pTheNext,
+ ByteString const & rTheAttribute,
+ ByteString const & rTheCharset,
+ ByteString const & rTheLanguage,
+ ByteString const & rTheValue,
+ sal_uInt32 nTheSection, bool bTheExtended):
+ m_pNext(pTheNext),
+ m_aAttribute(rTheAttribute),
+ m_aCharset(rTheCharset),
+ m_aLanguage(rTheLanguage),
+ m_aValue(rTheValue),
+ m_nSection(nTheSection),
+ m_bExtended(bTheExtended)
+{}
+
+//============================================================================
+struct ParameterList
+{
+ Parameter * m_pList;
+
+ ParameterList(): m_pList(0) {}
+
+ inline ~ParameterList();
+
+ Parameter ** find(ByteString const & rAttribute, sal_uInt32 nSection,
+ bool & rPresent);
+};
+
+inline ParameterList::~ParameterList()
+{
+ while (m_pList)
+ {
+ Parameter * pNext = m_pList->m_pNext;
+ delete m_pList;
+ m_pList = pNext;
+ }
+}
+
+//============================================================================
+bool parseParameters(ParameterList const & rInput,
+ INetContentTypeParameterList * pOutput);
+
+}
+
+//============================================================================
+//
+// Charset
+//
+//============================================================================
+
+bool Charset::contains(sal_uInt32 nChar) const
+{
+ for (const sal_uInt32 * p = m_pRanges;;)
+ {
+ if (nChar < *p++)
+ return false;
+ if (nChar <= *p++)
+ return true;
+ }
+}
+
+//============================================================================
+//
+// appendISO88591
+//
+//============================================================================
+
+namespace unnamed_tools_inetmime {
+
+void appendISO88591(UniString & rText, sal_Char const * pBegin,
+ sal_Char const * pEnd)
+{
+ sal_Size nLength = pEnd - pBegin;
+ sal_Unicode * pBuffer = new sal_Unicode[nLength];
+ for (sal_Unicode * p = pBuffer; pBegin != pEnd;)
+ *p++ = sal_uChar(*pBegin++);
+ rText.Append(pBuffer, nLength);
+ delete[] pBuffer;
+}
+
+}
+
+//============================================================================
+//
+// INetMIMECharsetList_Impl
+//
+//============================================================================
+
+INetMIMECharsetList_Impl::~INetMIMECharsetList_Impl()
+{
+ while (m_pFirst)
+ {
+ Node * pRemove = m_pFirst;
+ m_pFirst = m_pFirst->m_pNext;
+ delete pRemove;
+ }
+}
+
+//============================================================================
+void INetMIMECharsetList_Impl::includes(sal_uInt32 nChar)
+{
+ for (Node * p = m_pFirst; p; p = p->m_pNext)
+ if (!(p->m_bDisabled || p->m_aCharset.contains(nChar)))
+ p->m_bDisabled = true;
+}
+
+//============================================================================
+rtl_TextEncoding
+INetMIMECharsetList_Impl::getPreferredEncoding(rtl_TextEncoding eDefault)
+ const
+{
+ for (Node * p = m_pFirst; p; p = p->m_pNext)
+ if (!p->m_bDisabled)
+ return p->m_aCharset.getEncoding();
+ return eDefault;
+}
+
+//============================================================================
+void INetMIMECharsetList_Impl::reset()
+{
+ for (Node * p = m_pFirst; p; p = p->m_pNext)
+ p->m_bDisabled = false;
+}
+
+//============================================================================
+//
+// ParameterList
+//
+//============================================================================
+
+Parameter ** ParameterList::find(ByteString const & rAttribute,
+ sal_uInt32 nSection, bool & rPresent)
+{
+ Parameter ** p = &m_pList;
+ for (; *p; p = &(*p)->m_pNext)
+ {
+ StringCompare eCompare = rAttribute.CompareTo((*p)->m_aAttribute);
+ if (eCompare == COMPARE_GREATER)
+ break;
+ else if (eCompare == COMPARE_EQUAL)
+ if (nSection > (*p)->m_nSection)
+ break;
+ else if (nSection == (*p)->m_nSection)
+ {
+ rPresent = true;
+ return p;
+ }
+ }
+ rPresent = false;
+ return p;
+}
+
+//============================================================================
+//
+// parseParameters
+//
+//============================================================================
+
+namespace unnamed_tools_inetmime {
+
+bool parseParameters(ParameterList const & rInput,
+ INetContentTypeParameterList * pOutput)
+{
+ if (pOutput)
+ pOutput->Clear();
+
+ Parameter * pPrev = 0;
+ for (Parameter * p = rInput.m_pList; p; p = p->m_pNext)
+ {
+ if (p->m_nSection > 0
+ && (!pPrev
+ || pPrev->m_nSection != p->m_nSection - 1
+ || pPrev->m_aAttribute != p->m_aAttribute))
+ return false;
+ pPrev = p;
+ }
+
+ if (pOutput)
+ for (Parameter * p = rInput.m_pList; p;)
+ {
+ bool bCharset = p->m_aCharset.Len() != 0;
+ rtl_TextEncoding eEncoding;
+ if (bCharset)
+ eEncoding
+ = INetMIME::getCharsetEncoding(p->m_aCharset.GetBuffer(),
+ p->m_aCharset.GetBuffer()
+ + rInput.m_pList->
+ m_aCharset.
+ Len());
+ UniString aValue;
+ bool bBadEncoding = false;
+ Parameter * pNext = p;
+ do
+ {
+ sal_Size nSize;
+ sal_Unicode * pUnicode
+ = INetMIME::convertToUnicode(pNext->m_aValue.GetBuffer(),
+ pNext->m_aValue.GetBuffer()
+ + pNext->m_aValue.Len(),
+ bCharset && p->m_bExtended ?
+ eEncoding :
+ RTL_TEXTENCODING_UTF8,
+ nSize);
+ if (!pUnicode && !(bCharset && p->m_bExtended))
+ pUnicode = INetMIME::convertToUnicode(
+ pNext->m_aValue.GetBuffer(),
+ pNext->m_aValue.GetBuffer()
+ + pNext->m_aValue.Len(),
+ RTL_TEXTENCODING_ISO_8859_1, nSize);
+ if (!pUnicode)
+ {
+ bBadEncoding = true;
+ break;
+ }
+ aValue += UniString(pUnicode, nSize);
+ delete[] pUnicode;
+ pNext = pNext->m_pNext;
+ }
+ while (pNext && pNext->m_nSection > 0);
+ if (bBadEncoding)
+ {
+ aValue.Erase();
+ for (pNext = p;;)
+ {
+ if (pNext->m_bExtended)
+ for (xub_StrLen i = 0; i < pNext->m_aValue.Len(); ++i)
+ aValue
+ += sal_Unicode(sal_uChar
+ (pNext->
+ m_aValue.GetChar(i)))
+ | 0xF800;
+ else
+ for (xub_StrLen i = 0; i < pNext->m_aValue.Len(); ++i)
+ aValue
+ += sal_Unicode(sal_uChar
+ (pNext->
+ m_aValue.GetChar(i)));
+ pNext = pNext->m_pNext;
+ if (!pNext || pNext->m_nSection == 0)
+ break;
+ };
+ }
+ pOutput->Insert(new INetContentTypeParameter(p->m_aAttribute,
+ p->m_aCharset,
+ p->m_aLanguage,
+ aValue,
+ !bBadEncoding),
+ LIST_APPEND);
+ p = pNext;
+ }
+ return true;
+}
+
+}
+
+//============================================================================
+//
+// INetMIME
+//
+//============================================================================
+
+// static
+bool INetMIME::isAtomChar(sal_uInt32 nChar)
+{
+ static const bool aMap[128]
+ = { false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, true, false, true, true, true, true, true, // !"#$%&'
+ false, false, true, true, false, true, false, true, //()*+,-./
+ true, true, true, true, true, true, true, true, //01234567
+ true, true, false, false, false, true, false, true, //89:;<=>?
+ false, true, true, true, true, true, true, true, //@ABCDEFG
+ true, true, true, true, true, true, true, true, //HIJKLMNO
+ true, true, true, true, true, true, true, true, //PQRSTUVW
+ true, true, true, false, false, false, true, true, //XYZ[\]^_
+ true, true, true, true, true, true, true, true, //`abcdefg
+ true, true, true, true, true, true, true, true, //hijklmno
+ true, true, true, true, true, true, true, true, //pqrstuvw
+ true, true, true, true, true, true, true, false //xyz{|}~
+ };
+ return isUSASCII(nChar) && aMap[nChar];
+}
+
+//============================================================================
+// static
+bool INetMIME::isTokenChar(sal_uInt32 nChar)
+{
+ static const sal_Char aMap[128]
+ = { false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, true, false, true, true, true, true, true, // !"#$%&'
+ false, false, true, true, false, true, true, false, //()*+,-./
+ true, true, true, true, true, true, true, true, //01234567
+ true, true, false, false, false, false, false, false, //89:;<=>?
+ false, true, true, true, true, true, true, true, //@ABCDEFG
+ true, true, true, true, true, true, true, true, //HIJKLMNO
+ true, true, true, true, true, true, true, true, //PQRSTUVW
+ true, true, true, false, false, false, true, true, //XYZ[\]^_
+ true, true, true, true, true, true, true, true, //`abcdefg
+ true, true, true, true, true, true, true, true, //hijklmno
+ true, true, true, true, true, true, true, true, //pqrstuvw
+ true, true, true, true, true, true, true, false //xyz{|}~
+ };
+ return isUSASCII(nChar) && aMap[nChar];
+}
+
+//============================================================================
+// static
+bool INetMIME::isEncodedWordTokenChar(sal_uInt32 nChar)
+{
+ static const sal_Char aMap[128]
+ = { false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, true, false, true, true, true, true, true, // !"#$%&'
+ false, false, true, true, false, true, false, false, //()*+,-./
+ true, true, true, true, true, true, true, true, //01234567
+ true, true, false, false, false, false, false, false, //89:;<=>?
+ false, true, true, true, true, true, true, true, //@ABCDEFG
+ true, true, true, true, true, true, true, true, //HIJKLMNO
+ true, true, true, true, true, true, true, true, //PQRSTUVW
+ true, true, true, false, false, false, true, true, //XYZ[\]^_
+ true, true, true, true, true, true, true, true, //`abcdefg
+ true, true, true, true, true, true, true, true, //hijklmno
+ true, true, true, true, true, true, true, true, //pqrstuvw
+ true, true, true, true, true, true, true, false //xyz{|}~
+ };
+ return isUSASCII(nChar) && aMap[nChar];
+}
+
+//============================================================================
+// static
+bool INetMIME::isIMAPAtomChar(sal_uInt32 nChar)
+{
+ static const sal_Char aMap[128]
+ = { false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false,
+ false, true, false, true, true, false, true, true, // !"#$%&'
+ false, false, false, true, true, true, true, true, //()*+,-./
+ true, true, true, true, true, true, true, true, //01234567
+ true, true, true, true, true, true, true, true, //89:;<=>?
+ true, true, true, true, true, true, true, true, //@ABCDEFG
+ true, true, true, true, true, true, true, true, //HIJKLMNO
+ true, true, true, true, true, true, true, true, //PQRSTUVW
+ true, true, true, true, false, true, true, true, //XYZ[\]^_
+ true, true, true, true, true, true, true, true, //`abcdefg
+ true, true, true, true, true, true, true, true, //hijklmno
+ true, true, true, true, true, true, true, true, //pqrstuvw
+ true, true, true, false, true, true, true, false //xyz{|}~
+ };
+ return isUSASCII(nChar) && aMap[nChar];
+}
+
+//============================================================================
+// static
+sal_uInt32 INetMIME::getDigit(int nWeight)
+{
+ DBG_ASSERT(nWeight >= 0 && nWeight < 10,
+ "INetMIME::getDigit(): Bad weight");
+
+ static const sal_Char aDigits[16]
+ = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
+ return aDigits[nWeight];
+}
+
+//============================================================================
+// static
+sal_uInt32 INetMIME::getHexDigit(int nWeight)
+{
+ DBG_ASSERT(nWeight >= 0 && nWeight < 16,
+ "INetMIME::getHexDigit(): Bad weight");
+
+ static const sal_Char aDigits[16]
+ = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
+ 'D', 'E', 'F' };
+ return aDigits[nWeight];
+}
+
+//============================================================================
+// static
+sal_uInt32 INetMIME::getBase64Digit(int nWeight)
+{
+ DBG_ASSERT(nWeight >= 0 && nWeight < 64,
+ "INetMIME::getBase64Digit(): Bad weight");
+
+ static const sal_Char aDigits[64]
+ = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
+ return aDigits[nWeight];
+}
+
+//============================================================================
+// static
+bool INetMIME::equalIgnoreCase(const sal_Char * pBegin1,
+ const sal_Char * pEnd1,
+ const sal_Char * pBegin2,
+ const sal_Char * pEnd2)
+{
+ DBG_ASSERT(pBegin1 && pBegin1 <= pEnd1 && pBegin2 && pBegin2 <= pEnd2,
+ "INetMIME::equalIgnoreCase(): Bad sequences");
+
+ if (pEnd1 - pBegin1 != pEnd2 - pBegin2)
+ return false;
+ while (pBegin1 != pEnd1)
+ if (toUpperCase(*pBegin1++) != toUpperCase(*pBegin2++))
+ return false;
+ return true;
+}
+
+//============================================================================
+// static
+bool INetMIME::equalIgnoreCase(const sal_Char * pBegin1,
+ const sal_Char * pEnd1,
+ const sal_Char * pString2)
+{
+ DBG_ASSERT(pBegin1 && pBegin1 <= pEnd1 && pString2,
+ "INetMIME::equalIgnoreCase(): Bad sequences");
+
+ while (*pString2 != 0)
+ if (pBegin1 == pEnd1
+ || toUpperCase(*pBegin1++) != toUpperCase(*pString2++))
+ return false;
+ return pBegin1 == pEnd1;
+}
+
+//============================================================================
+// static
+bool INetMIME::equalIgnoreCase(const sal_Unicode * pBegin1,
+ const sal_Unicode * pEnd1,
+ const sal_Char * pString2)
+{
+ DBG_ASSERT(pBegin1 && pBegin1 <= pEnd1 && pString2,
+ "INetMIME::equalIgnoreCase(): Bad sequences");
+
+ while (*pString2 != 0)
+ if (pBegin1 == pEnd1
+ || toUpperCase(*pBegin1++) != toUpperCase(*pString2++))
+ return false;
+ return pBegin1 == pEnd1;
+}
+
+//============================================================================
+// static
+const sal_Char * INetMIME::skipLinearWhiteSpace(const sal_Char * pBegin,
+ const sal_Char * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipLinearWhiteSpace(): Bad sequence");
+
+ while (pBegin != pEnd)
+ switch (*pBegin)
+ {
+ case '\t':
+ case ' ':
+ ++pBegin;
+ break;
+
+ case 0x0D: // CR
+ if (startsWithLineFolding(pBegin, pEnd))
+ pBegin += 3;
+ else
+ return pBegin;
+ break;
+
+ default:
+ return pBegin;
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Unicode * INetMIME::skipLinearWhiteSpace(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipLinearWhiteSpace(): Bad sequence");
+
+ while (pBegin != pEnd)
+ switch (*pBegin)
+ {
+ case '\t':
+ case ' ':
+ ++pBegin;
+ break;
+
+ case 0x0D: // CR
+ if (startsWithLineFolding(pBegin, pEnd))
+ pBegin += 3;
+ else
+ return pBegin;
+ break;
+
+ default:
+ return pBegin;
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Char * INetMIME::skipComment(const sal_Char * pBegin,
+ const sal_Char * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipComment(): Bad sequence");
+
+ if (pBegin != pEnd && *pBegin == '(')
+ {
+ sal_uInt32 nLevel = 0;
+ for (const sal_Char * p = pBegin; p != pEnd;)
+ switch (*p++)
+ {
+ case '(':
+ ++nLevel;
+ break;
+
+ case ')':
+ if (--nLevel == 0)
+ return p;
+ break;
+
+ case '\\':
+ if (p != pEnd)
+ ++p;
+ break;
+ }
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Unicode * INetMIME::skipComment(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipComment(): Bad sequence");
+
+ if (pBegin != pEnd && *pBegin == '(')
+ {
+ sal_uInt32 nLevel = 0;
+ for (const sal_Unicode * p = pBegin; p != pEnd;)
+ switch (*p++)
+ {
+ case '(':
+ ++nLevel;
+ break;
+
+ case ')':
+ if (--nLevel == 0)
+ return p;
+ break;
+
+ case '\\':
+ if (p != pEnd)
+ ++p;
+ break;
+ }
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Char * INetMIME::skipLinearWhiteSpaceComment(const sal_Char *
+ pBegin,
+ const sal_Char * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipLinearWhiteSpaceComment(): Bad sequence");
+
+ while (pBegin != pEnd)
+ switch (*pBegin)
+ {
+ case '\t':
+ case ' ':
+ ++pBegin;
+ break;
+
+ case 0x0D: // CR
+ if (startsWithLineFolding(pBegin, pEnd))
+ pBegin += 3;
+ else
+ return pBegin;
+ break;
+
+ case '(':
+ {
+ const sal_Char * p = skipComment(pBegin, pEnd);
+ if (p == pBegin)
+ return pBegin;
+ pBegin = p;
+ break;
+ }
+
+ default:
+ return pBegin;
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Unicode * INetMIME::skipLinearWhiteSpaceComment(const sal_Unicode *
+ pBegin,
+ const sal_Unicode *
+ pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipLinearWhiteSpaceComment(): Bad sequence");
+
+ while (pBegin != pEnd)
+ switch (*pBegin)
+ {
+ case '\t':
+ case ' ':
+ ++pBegin;
+ break;
+
+ case 0x0D: // CR
+ if (startsWithLineFolding(pBegin, pEnd))
+ pBegin += 3;
+ else
+ return pBegin;
+ break;
+
+ case '(':
+ {
+ const sal_Unicode * p = skipComment(pBegin, pEnd);
+ if (p == pBegin)
+ return pBegin;
+ pBegin = p;
+ break;
+ }
+
+ default:
+ return pBegin;
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Char * INetMIME::skipQuotedString(const sal_Char * pBegin,
+ const sal_Char * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipQuotedString(): Bad sequence");
+
+ if (pBegin != pEnd && *pBegin == '"')
+ for (const sal_Char * p = pBegin + 1; p != pEnd;)
+ switch (*p++)
+ {
+ case 0x0D: // CR
+ if (pEnd - p < 2 || *p++ != 0x0A // LF
+ || !isWhiteSpace(*p++))
+ return pBegin;
+ break;
+
+ case '"':
+ return p;
+
+ case '\\':
+ if (p != pEnd)
+ ++p;
+ break;
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Unicode * INetMIME::skipQuotedString(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::skipQuotedString(): Bad sequence");
+
+ if (pBegin != pEnd && *pBegin == '"')
+ for (const sal_Unicode * p = pBegin + 1; p != pEnd;)
+ switch (*p++)
+ {
+ case 0x0D: // CR
+ if (pEnd - p < 2 || *p++ != 0x0A // LF
+ || !isWhiteSpace(*p++))
+ return pBegin;
+ break;
+
+ case '"':
+ return p;
+
+ case '\\':
+ if (p != pEnd)
+ ++p;
+ break;
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Char * INetMIME::scanAtom(const sal_Char * pBegin,
+ const sal_Char * pEnd)
+{
+ while (pBegin != pEnd && isAtomChar(*pBegin))
+ ++pBegin;
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Unicode * INetMIME::scanAtom(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd)
+{
+ while (pBegin != pEnd && isAtomChar(*pBegin))
+ ++pBegin;
+ return pBegin;
+}
+
+//============================================================================
+// static
+bool INetMIME::scanUnsigned(const sal_Char *& rBegin, const sal_Char * pEnd,
+ bool bLeadingZeroes, sal_uInt32 & rValue)
+{
+ sal_uInt64 nTheValue = 0;
+ for (const sal_Char * p = rBegin; p != pEnd; ++p)
+ {
+ int nWeight = getWeight(*p);
+ if (nWeight < 0)
+ break;
+ nTheValue = 10 * nTheValue + nWeight;
+ if (nTheValue > std::numeric_limits< sal_uInt32 >::max())
+ return false;
+ }
+ if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1))
+ return false;
+ rBegin = p;
+ rValue = sal_uInt32(nTheValue);
+ return true;
+}
+
+//============================================================================
+// static
+bool INetMIME::scanUnsigned(const sal_Unicode *& rBegin,
+ const sal_Unicode * pEnd, bool bLeadingZeroes,
+ sal_uInt32 & rValue)
+{
+ sal_uInt64 nTheValue = 0;
+ for (const sal_Unicode * p = rBegin; p != pEnd; ++p)
+ {
+ int nWeight = getWeight(*p);
+ if (nWeight < 0)
+ break;
+ nTheValue = 10 * nTheValue + nWeight;
+ if (nTheValue > std::numeric_limits< sal_uInt32 >::max())
+ return false;
+ }
+ if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1))
+ return false;
+ rBegin = p;
+ rValue = sal_uInt32(nTheValue);
+ return true;
+}
+
+//============================================================================
+// static
+bool INetMIME::scanUnsignedHex(const sal_Char *& rBegin,
+ const sal_Char * pEnd, bool bLeadingZeroes,
+ sal_uInt32 & rValue)
+{
+ sal_uInt64 nTheValue = 0;
+ for (const sal_Char * p = rBegin; p != pEnd; ++p)
+ {
+ int nWeight = getHexWeight(*p);
+ if (nWeight < 0)
+ break;
+ nTheValue = nTheValue << 4 | nWeight;
+ if (nTheValue > std::numeric_limits< sal_uInt32 >::max())
+ return false;
+ }
+ if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1))
+ return false;
+ rBegin = p;
+ rValue = sal_uInt32(nTheValue);
+ return true;
+}
+
+//============================================================================
+// static
+bool INetMIME::scanUnsignedHex(const sal_Unicode *& rBegin,
+ const sal_Unicode * pEnd, bool bLeadingZeroes,
+ sal_uInt32 & rValue)
+{
+ sal_uInt64 nTheValue = 0;
+ for (const sal_Unicode * p = rBegin; p != pEnd; ++p)
+ {
+ int nWeight = getHexWeight(*p);
+ if (nWeight < 0)
+ break;
+ nTheValue = nTheValue << 4 | nWeight;
+ if (nTheValue > std::numeric_limits< sal_uInt32 >::max())
+ return false;
+ }
+ if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1))
+ return false;
+ rBegin = p;
+ rValue = sal_uInt32(nTheValue);
+ return true;
+}
+
+//============================================================================
+// static
+const sal_Char * INetMIME::scanQuotedBlock(const sal_Char * pBegin,
+ const sal_Char * pEnd,
+ sal_uInt32 nOpening,
+ sal_uInt32 nClosing,
+ sal_uInt32 & rLength,
+ bool & rModify)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::scanQuotedBlock(): Bad sequence");
+
+ if (pBegin != pEnd && *pBegin == nOpening)
+ {
+ ++rLength;
+ ++pBegin;
+ while (pBegin != pEnd)
+ if (*pBegin == nClosing)
+ {
+ ++rLength;
+ return ++pBegin;
+ }
+ else
+ {
+ sal_uInt32 c = *pBegin++;
+ switch (c)
+ {
+ case 0x0D: // CR
+ if (pBegin != pEnd && *pBegin == 0x0A) // LF
+ if (pEnd - pBegin >= 2 && isWhiteSpace(pBegin[1]))
+ {
+ ++rLength;
+ rModify = true;
+ pBegin += 2;
+ }
+ else
+ {
+ rLength += 3;
+ rModify = true;
+ ++pBegin;
+ }
+ else
+ ++rLength;
+ break;
+
+ case '\\':
+ ++rLength;
+ if (pBegin != pEnd)
+ if (startsWithLineBreak(pBegin, pEnd)
+ && (pEnd - pBegin < 3
+ || !isWhiteSpace(pBegin[2])))
+ {
+ rLength += 3;
+ rModify = true;
+ pBegin += 2;
+ }
+ else
+ ++pBegin;
+ break;
+
+ default:
+ ++rLength;
+ if (!isUSASCII(c))
+ rModify = true;
+ break;
+ }
+ }
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+const sal_Unicode * INetMIME::scanQuotedBlock(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd,
+ sal_uInt32 nOpening,
+ sal_uInt32 nClosing,
+ sal_uInt32 & rLength,
+ bool & rModify)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIME::scanQuotedBlock(): Bad sequence");
+
+ if (pBegin != pEnd && *pBegin == nOpening)
+ {
+ ++rLength;
+ ++pBegin;
+ while (pBegin != pEnd)
+ if (*pBegin == nClosing)
+ {
+ ++rLength;
+ return ++pBegin;
+ }
+ else
+ {
+ sal_uInt32 c = *pBegin++;
+ switch (c)
+ {
+ case 0x0D: // CR
+ if (pBegin != pEnd && *pBegin == 0x0A) // LF
+ if (pEnd - pBegin >= 2 && isWhiteSpace(pBegin[1]))
+ {
+ ++rLength;
+ rModify = true;
+ pBegin += 2;
+ }
+ else
+ {
+ rLength += 3;
+ rModify = true;
+ ++pBegin;
+ }
+ else
+ ++rLength;
+ break;
+
+ case '\\':
+ ++rLength;
+ if (pBegin != pEnd)
+ if (startsWithLineBreak(pBegin, pEnd)
+ && (pEnd - pBegin < 3
+ || !isWhiteSpace(pBegin[2])))
+ {
+ rLength += 3;
+ rModify = true;
+ pBegin += 2;
+ }
+ else
+ ++pBegin;
+ break;
+
+ default:
+ ++rLength;
+ if (!isUSASCII(c))
+ rModify = true;
+ break;
+ }
+ }
+ }
+ return pBegin;
+}
+
+//============================================================================
+// static
+sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin,
+ sal_Char const * pEnd,
+ INetContentTypeParameterList *
+ pParameters)
+{
+ ParameterList aList;
+ sal_Char const * pParameterBegin = pBegin;
+ for (sal_Char const * p = pParameterBegin;; pParameterBegin = p)
+ {
+ pParameterBegin = skipLinearWhiteSpaceComment(p, pEnd);
+ if (pParameterBegin == pEnd || *pParameterBegin != ';')
+ break;
+ p = pParameterBegin + 1;
+
+ sal_Char const * pAttributeBegin = skipLinearWhiteSpaceComment(p,
+ pEnd);
+ sal_Char const * p = pAttributeBegin;
+ bool bDowncaseAttribute = false;
+ while (p != pEnd && isTokenChar(*p) && *p != '*')
+ {
+ bDowncaseAttribute = bDowncaseAttribute || isUpperCase(*p);
+ ++p;
+ }
+ if (p == pAttributeBegin)
+ break;
+ ByteString aAttribute(pAttributeBegin, p - pAttributeBegin);
+ if (bDowncaseAttribute)
+ aAttribute.ToLowerAscii();
+
+ sal_uInt32 nSection = 0;
+ if (p != pEnd && *p == '*')
+ {
+ ++p;
+ if (p != pEnd && isDigit(*p)
+ && !scanUnsigned(p, pEnd, false, nSection))
+ break;
+ }
+
+ bool bPresent;
+ Parameter ** pPos = aList.find(aAttribute, nSection, bPresent);
+ if (bPresent)
+ break;
+
+ bool bExtended = false;
+ if (p != pEnd && *p == '*')
+ {
+ ++p;
+ bExtended = true;
+ }
+
+ p = skipLinearWhiteSpaceComment(p, pEnd);
+
+ if (p == pEnd || *p != '=')
+ break;
+
+ p = skipLinearWhiteSpaceComment(p + 1, pEnd);
+
+ ByteString aCharset;
+ ByteString aLanguage;
+ ByteString aValue;
+ if (bExtended)
+ {
+ if (nSection == 0)
+ {
+ sal_Char const * pCharsetBegin = p;
+ bool bDowncaseCharset = false;
+ while (p != pEnd && isTokenChar(*p) && *p != '\'')
+ {
+ bDowncaseCharset = bDowncaseCharset || isUpperCase(*p);
+ ++p;
+ }
+ if (p == pCharsetBegin)
+ break;
+ if (pParameters)
+ {
+ aCharset = ByteString(pCharsetBegin, p - pCharsetBegin);
+ if (bDowncaseCharset)
+ aCharset.ToLowerAscii();
+ }
+
+ if (p == pEnd || *p != '\'')
+ break;
+ ++p;
+
+ sal_Char const * pLanguageBegin = p;
+ bool bDowncaseLanguage = false;
+ int nLetters = 0;
+ for (; p != pEnd; ++p)
+ if (isAlpha(*p))
+ {
+ if (++nLetters > 8)
+ break;
+ bDowncaseLanguage = bDowncaseLanguage
+ || isUpperCase(*p);
+ }
+ else if (*p == '-')
+ {
+ if (nLetters == 0)
+ break;
+ nLetters = 0;
+ }
+ else
+ break;
+ if (nLetters == 0 || nLetters > 8)
+ break;
+ if (pParameters)
+ {
+ aLanguage = ByteString(pLanguageBegin,
+ p - pLanguageBegin);
+ if (bDowncaseLanguage)
+ aLanguage.ToLowerAscii();
+ }
+
+ if (p == pEnd || *p != '\'')
+ break;
+ ++p;
+ }
+ if (pParameters)
+ while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p)))
+ {
+ if (*p == '%')
+ {
+ if (p + 2 < pEnd)
+ {
+ int nWeight1 = getHexWeight(p[1]);
+ int nWeight2 = getHexWeight(p[2]);
+ if (nWeight1 >= 0 && nWeight2 >= 0)
+ {
+ aValue += sal_Char(nWeight1 << 4 | nWeight2);
+ p += 3;
+ continue;
+ }
+ }
+ }
+ aValue += *p++;
+ }
+ else
+ while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p)))
+ ++p;
+ }
+ else if (p != pEnd && *p == '"')
+ if (pParameters)
+ {
+ bool bInvalid = false;
+ for (++p;;)
+ {
+ if (p == pEnd)
+ {
+ bInvalid = true;
+ break;
+ }
+ else if (*p == '"')
+ {
+ ++p;
+ break;
+ }
+ else if (*p == 0x0D) // CR
+ {
+ if (pEnd - p < 3 || p[1] != 0x0A // LF
+ || !isWhiteSpace(p[2]))
+ {
+ bInvalid = true;
+ break;
+ }
+ p += 2;
+ }
+ else if (*p == '\\' && ++p == pEnd)
+ {
+ bInvalid = true;
+ break;
+ }
+ aValue += *p++;
+ }
+ if (bInvalid)
+ break;
+ }
+ else
+ {
+ sal_Char const * pStringEnd = skipQuotedString(p, pEnd);
+ if (p == pStringEnd)
+ break;
+ p = pStringEnd;
+ }
+ else
+ {
+ sal_Char const * pTokenBegin = p;
+ while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p)))
+ ++p;
+ if (p == pTokenBegin)
+ break;
+ if (pParameters)
+ aValue = ByteString(pTokenBegin, p - pTokenBegin);
+ }
+
+ *pPos = new Parameter(*pPos, aAttribute, aCharset, aLanguage, aValue,
+ nSection, bExtended);
+ }
+ return parseParameters(aList, pParameters) ? pParameterBegin : pBegin;
+}
+
+//============================================================================
+// static
+sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
+ sal_Unicode const * pEnd,
+ INetContentTypeParameterList *
+ pParameters)
+{
+ ParameterList aList;
+ sal_Unicode const * pParameterBegin = pBegin;
+ for (sal_Unicode const * p = pParameterBegin;; pParameterBegin = p)
+ {
+ pParameterBegin = skipLinearWhiteSpaceComment(p, pEnd);
+ if (pParameterBegin == pEnd || *pParameterBegin != ';')
+ break;
+ p = pParameterBegin + 1;
+
+ sal_Unicode const * pAttributeBegin
+ = skipLinearWhiteSpaceComment(p, pEnd);
+ sal_Unicode const * p = pAttributeBegin;
+ bool bDowncaseAttribute = false;
+ while (p != pEnd && isTokenChar(*p) && *p != '*')
+ {
+ bDowncaseAttribute = bDowncaseAttribute || isUpperCase(*p);
+ ++p;
+ }
+ if (p == pAttributeBegin)
+ break;
+ ByteString aAttribute = ByteString(pAttributeBegin,
+ p - pAttributeBegin,
+ RTL_TEXTENCODING_ASCII_US);
+ if (bDowncaseAttribute)
+ aAttribute.ToLowerAscii();
+
+ sal_uInt32 nSection = 0;
+ if (p != pEnd && *p == '*')
+ {
+ ++p;
+ if (p != pEnd && isDigit(*p)
+ && !scanUnsigned(p, pEnd, false, nSection))
+ break;
+ }
+
+ bool bPresent;
+ Parameter ** pPos = aList.find(aAttribute, nSection, bPresent);
+ if (bPresent)
+ break;
+
+ bool bExtended = false;
+ if (p != pEnd && *p == '*')
+ {
+ ++p;
+ bExtended = true;
+ }
+
+ p = skipLinearWhiteSpaceComment(p, pEnd);
+
+ if (p == pEnd || *p != '=')
+ break;
+
+ p = skipLinearWhiteSpaceComment(p + 1, pEnd);
+
+ ByteString aCharset;
+ ByteString aLanguage;
+ ByteString aValue;
+ if (bExtended)
+ {
+ if (nSection == 0)
+ {
+ sal_Unicode const * pCharsetBegin = p;
+ bool bDowncaseCharset = false;
+ while (p != pEnd && isTokenChar(*p) && *p != '\'')
+ {
+ bDowncaseCharset = bDowncaseCharset || isUpperCase(*p);
+ ++p;
+ }
+ if (p == pCharsetBegin)
+ break;
+ if (pParameters)
+ {
+ aCharset = ByteString(pCharsetBegin, p - pCharsetBegin,
+ RTL_TEXTENCODING_ASCII_US);
+ if (bDowncaseCharset)
+ aCharset.ToLowerAscii();
+ }
+
+ if (p == pEnd || *p != '\'')
+ break;
+ ++p;
+
+ sal_Unicode const * pLanguageBegin = p;
+ bool bDowncaseLanguage = false;
+ int nLetters = 0;
+ for (; p != pEnd; ++p)
+ if (isAlpha(*p))
+ {
+ if (++nLetters > 8)
+ break;
+ bDowncaseLanguage = bDowncaseLanguage
+ || isUpperCase(*p);
+ }
+ else if (*p == '-')
+ {
+ if (nLetters == 0)
+ break;
+ nLetters = 0;
+ }
+ else
+ break;
+ if (nLetters == 0 || nLetters > 8)
+ break;
+ if (pParameters)
+ {
+ aLanguage = ByteString(pLanguageBegin, p - pLanguageBegin,
+ RTL_TEXTENCODING_ASCII_US);
+ if (bDowncaseLanguage)
+ aLanguage.ToLowerAscii();
+ }
+
+ if (p == pEnd || *p != '\'')
+ break;
+ ++p;
+ }
+ if (pParameters)
+ {
+ INetMIMEStringOutputSink
+ aSink(0, INetMIMEOutputSink::NO_LINE_LENGTH_LIMIT);
+ while (p != pEnd)
+ {
+ sal_uInt32 nChar = INetMIME::getUTF32Character(p, pEnd);
+ if (isUSASCII(nChar) && !isTokenChar(nChar))
+ break;
+ if (nChar == '%' && p + 1 < pEnd)
+ {
+ int nWeight1 = getHexWeight(p[0]);
+ int nWeight2 = getHexWeight(p[1]);
+ if (nWeight1 >= 0 && nWeight2 >= 0)
+ {
+ aSink << sal_Char(nWeight1 << 4 | nWeight2);
+ p += 2;
+ continue;
+ }
+ }
+ INetMIME::writeUTF8(aSink, nChar);
+ }
+ aValue = aSink.takeBuffer();
+ }
+ else
+ while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p)))
+ ++p;
+ }
+ else if (p != pEnd && *p == '"')
+ if (pParameters)
+ {
+ INetMIMEStringOutputSink
+ aSink(0, INetMIMEOutputSink::NO_LINE_LENGTH_LIMIT);
+ bool bInvalid = false;
+ for (++p;;)
+ {
+ if (p == pEnd)
+ {
+ bInvalid = true;
+ break;
+ }
+ sal_uInt32 nChar = INetMIME::getUTF32Character(p, pEnd);
+ if (nChar == '"')
+ break;
+ else if (nChar == 0x0D) // CR
+ {
+ if (pEnd - p < 2 || *p++ != 0x0A // LF
+ || !isWhiteSpace(*p))
+ {
+ bInvalid = true;
+ break;
+ }
+ nChar = sal_uChar(*p++);
+ }
+ else if (nChar == '\\')
+ {
+ if (p == pEnd)
+ {
+ bInvalid = true;
+ break;
+ }
+ nChar = INetMIME::getUTF32Character(p, pEnd);
+ }
+ INetMIME::writeUTF8(aSink, nChar);
+ }
+ if (bInvalid)
+ break;
+ aValue = aSink.takeBuffer();
+ }
+ else
+ {
+ sal_Unicode const * pStringEnd = skipQuotedString(p, pEnd);
+ if (p == pStringEnd)
+ break;
+ p = pStringEnd;
+ }
+ else
+ {
+ sal_Unicode const * pTokenBegin = p;
+ while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p)))
+ ++p;
+ if (p == pTokenBegin)
+ break;
+ if (pParameters)
+ aValue = ByteString(pTokenBegin, p - pTokenBegin,
+ RTL_TEXTENCODING_UTF8);
+ }
+
+ *pPos = new Parameter(*pPos, aAttribute, aCharset, aLanguage, aValue,
+ nSection, bExtended);
+ }
+ return parseParameters(aList, pParameters) ? pParameterBegin : pBegin;
+}
+
+//============================================================================
+// static
+const sal_Char * INetMIME::getCharsetName(rtl_TextEncoding eEncoding)
+{
+ if (eEncoding < RTL_TEXTENCODING_STD_COUNT)
+ {
+ // The source for the following table is <ftp://ftp.iana.org/in-notes/
+ // iana/assignments/character-sets> as of Jan, 21 2000 12:46:00,
+ // unless otherwise noted:
+ static const sal_Char * aMap[RTL_TEXTENCODING_STD_COUNT]
+ = { 0, // RTL_TEXTENCODING_DONTKNOW
+ 0, // RTL_TEXTENCODING_MS_1252
+ "macintosh", // RTL_TEXTENCODING_APPLE_ROMAN
+ "IBM437", // RTL_TEXTENCODING_IBM_437
+ "IBM850", // RTL_TEXTENCODING_IBM_850
+ "IBM860", // RTL_TEXTENCODING_IBM_860
+ "IBM861", // RTL_TEXTENCODING_IBM_861
+ "IBM863", // RTL_TEXTENCODING_IBM_863
+ "IBM865", // RTL_TEXTENCODING_IBM_865
+ 0, // CHARSET_SYSTEM
+ 0, // RTL_TEXTENCODING_SYMBOL
+ "US-ASCII", // RTL_TEXTENCODING_ASCII_US
+ "ISO-8859-1", // RTL_TEXTENCODING_ISO_8859_1
+ "ISO-8859-2", // RTL_TEXTENCODING_ISO_8859_2
+ "ISO-8859-3", // RTL_TEXTENCODING_ISO_8859_3
+ "ISO-8859-4", // RTL_TEXTENCODING_ISO_8859_4
+ "ISO-8859-5", // RTL_TEXTENCODING_ISO_8859_5
+ "ISO-8859-6", // RTL_TEXTENCODING_ISO_8859_6
+ "ISO-8859-7", // RTL_TEXTENCODING_ISO_8859_7
+ "ISO-8859-8", // RTL_TEXTENCODING_ISO_8859_8
+ "ISO-8859-9", // RTL_TEXTENCODING_ISO_8859_9
+ "ISO-8859-14", // RTL_TEXTENCODING_ISO_8859_14, RFC 2047
+ "ISO_8859-15", // RTL_TEXTENCODING_ISO_8859_15
+ 0, // RTL_TEXTENCODING_IBM_737
+ "IBM775", // RTL_TEXTENCODING_IBM_775
+ "IBM852", // RTL_TEXTENCODING_IBM_852
+ "IBM855", // RTL_TEXTENCODING_IBM_855
+ "IBM857", // RTL_TEXTENCODING_IBM_857
+ "IBM862", // RTL_TEXTENCODING_IBM_862
+ "IBM864", // RTL_TEXTENCODING_IBM_864
+ "IBM866", // RTL_TEXTENCODING_IBM_866
+ "IBM869", // RTL_TEXTENCODING_IBM_869
+ 0, // RTL_TEXTENCODING_MS_874
+ "windows-1250", // RTL_TEXTENCODING_MS_1250
+ "windows-1251", // RTL_TEXTENCODING_MS_1251
+ "windows-1253", // RTL_TEXTENCODING_MS_1253
+ "windows-1254", // RTL_TEXTENCODING_MS_1254
+ "windows-1255", // RTL_TEXTENCODING_MS_1255
+ "windows-1256", // RTL_TEXTENCODING_MS_1256
+ "windows-1257", // RTL_TEXTENCODING_MS_1257
+ "windows-1258", // RTL_TEXTENCODING_MS_1258
+ 0, // RTL_TEXTENCODING_APPLE_ARABIC
+ 0, // RTL_TEXTENCODING_APPLE_CENTEURO
+ 0, // RTL_TEXTENCODING_APPLE_CROATIAN
+ 0, // RTL_TEXTENCODING_APPLE_CYRILLIC
+ 0, // RTL_TEXTENCODING_APPLE_DEVANAGARI
+ 0, // RTL_TEXTENCODING_APPLE_FARSI
+ 0, // RTL_TEXTENCODING_APPLE_GREEK
+ 0, // RTL_TEXTENCODING_APPLE_GUJARATI
+ 0, // RTL_TEXTENCODING_APPLE_GURMUKHI
+ 0, // RTL_TEXTENCODING_APPLE_HEBREW
+ 0, // RTL_TEXTENCODING_APPLE_ICELAND
+ 0, // RTL_TEXTENCODING_APPLE_ROMANIAN
+ 0, // RTL_TEXTENCODING_APPLE_THAI
+ 0, // RTL_TEXTENCODING_APPLE_TURKISH
+ 0, // RTL_TEXTENCODING_APPLE_UKRAINIAN
+ 0, // RTL_TEXTENCODING_APPLE_CHINSIMP
+ 0, // RTL_TEXTENCODING_APPLE_CHINTRAD
+ 0, // RTL_TEXTENCODING_APPLE_JAPANESE
+ 0, // RTL_TEXTENCODING_APPLE_KOREAN
+ 0, // RTL_TEXTENCODING_MS_932
+ 0, // RTL_TEXTENCODING_MS_936
+ 0, // RTL_TEXTENCODING_MS_949
+ 0, // RTL_TEXTENCODING_MS_950
+ "Shift_JIS", // RTL_TEXTENCODING_SHIFT_JIS
+ "GB2312", // RTL_TEXTENCODING_GB_2312
+ 0, // RTL_TEXTENCODING_GBT_12345
+ 0, // RTL_TEXTENCODING_GBK
+ "Big5", // RTL_TEXTENCODING_BIG5
+ "EUC-JP", // RTL_TEXTENCODING_EUC_JP
+ 0, // RTL_TEXTENCODING_EUC_CN
+ 0, // RTL_TEXTENCODING_EUC_TW
+ "ISO-2022-JP", // RTL_TEXTENCODING_ISO_2022_JP
+ "ISO-2022-CN", // RTL_TEXTENCODING_ISO_2022_CN
+ "KOI8-R", // RTL_TEXTENCODING_KOI8_R
+ "UTF-7", // RTL_TEXTENCODING_UTF7
+ "UTF-8", // RTL_TEXTENCODING_UTF8
+ "ISO-8859-10", // RTL_TEXTENCODING_ISO_8859_10, RFC 2047
+ "ISO-8859-13", // RTL_TEXTENCODING_ISO_8859_13, RFC 2047
+ "EUC-KR", // RTL_TEXTENCODING_EUC_KR
+ "ISO-2022-KR" }; // RTL_TEXTENCODING_ISO_2022_KR
+ DBG_ASSERT(aMap[eEncoding],
+ "INetMIME::getCharsetName(): Unsupported encoding");
+ return aMap[eEncoding];
+ }
+ else
+ switch (eEncoding)
+ {
+ case RTL_TEXTENCODING_UCS4:
+ return "ISO-10646-UCS-4";
+
+ case RTL_TEXTENCODING_UCS2:
+ return "ISO-10646-UCS-2";
+
+ default:
+ DBG_ERROR("INetMIME::getCharsetName(): Unsupported encoding");
+ return 0;
+ }
+}
+
+//============================================================================
+namespace unnamed_tools_inetmime {
+
+struct EncodingEntry
+{
+ sal_Char const * m_aName;
+ rtl_TextEncoding m_eEncoding;
+};
+
+//============================================================================
+// The source for the following table is <ftp://ftp.iana.org/in-notes/iana/
+// assignments/character-sets> as of Jan, 21 2000 12:46:00, unless otherwise
+// noted:
+EncodingEntry const aEncodingMap[]
+ = { { "US-ASCII", RTL_TEXTENCODING_ASCII_US },
+ { "ANSI_X3.4-1968", RTL_TEXTENCODING_ASCII_US },
+ { "ISO-IR-6", RTL_TEXTENCODING_ASCII_US },
+ { "ANSI_X3.4-1986", RTL_TEXTENCODING_ASCII_US },
+ { "ISO_646.IRV:1991", RTL_TEXTENCODING_ASCII_US },
+ { "ASCII", RTL_TEXTENCODING_ASCII_US },
+ { "ISO646-US", RTL_TEXTENCODING_ASCII_US },
+ { "US", RTL_TEXTENCODING_ASCII_US },
+ { "IBM367", RTL_TEXTENCODING_ASCII_US },
+ { "CP367", RTL_TEXTENCODING_ASCII_US },
+ { "CSASCII", RTL_TEXTENCODING_ASCII_US },
+ { "ISO-8859-1", RTL_TEXTENCODING_ISO_8859_1 },
+ { "ISO_8859-1:1987", RTL_TEXTENCODING_ISO_8859_1 },
+ { "ISO-IR-100", RTL_TEXTENCODING_ISO_8859_1 },
+ { "ISO_8859-1", RTL_TEXTENCODING_ISO_8859_1 },
+ { "LATIN1", RTL_TEXTENCODING_ISO_8859_1 },
+ { "L1", RTL_TEXTENCODING_ISO_8859_1 },
+ { "IBM819", RTL_TEXTENCODING_ISO_8859_1 },
+ { "CP819", RTL_TEXTENCODING_ISO_8859_1 },
+ { "CSISOLATIN1", RTL_TEXTENCODING_ISO_8859_1 },
+ { "ISO-8859-2", RTL_TEXTENCODING_ISO_8859_2 },
+ { "ISO_8859-2:1987", RTL_TEXTENCODING_ISO_8859_2 },
+ { "ISO-IR-101", RTL_TEXTENCODING_ISO_8859_2 },
+ { "ISO_8859-2", RTL_TEXTENCODING_ISO_8859_2 },
+ { "LATIN2", RTL_TEXTENCODING_ISO_8859_2 },
+ { "L2", RTL_TEXTENCODING_ISO_8859_2 },
+ { "CSISOLATIN2", RTL_TEXTENCODING_ISO_8859_2 },
+ { "ISO-8859-3", RTL_TEXTENCODING_ISO_8859_3 },
+ { "ISO_8859-3:1988", RTL_TEXTENCODING_ISO_8859_3 },
+ { "ISO-IR-109", RTL_TEXTENCODING_ISO_8859_3 },
+ { "ISO_8859-3", RTL_TEXTENCODING_ISO_8859_3 },
+ { "LATIN3", RTL_TEXTENCODING_ISO_8859_3 },
+ { "L3", RTL_TEXTENCODING_ISO_8859_3 },
+ { "CSISOLATIN3", RTL_TEXTENCODING_ISO_8859_3 },
+ { "ISO-8859-4", RTL_TEXTENCODING_ISO_8859_4 },
+ { "ISO_8859-4:1988", RTL_TEXTENCODING_ISO_8859_4 },
+ { "ISO-IR-110", RTL_TEXTENCODING_ISO_8859_4 },
+ { "ISO_8859-4", RTL_TEXTENCODING_ISO_8859_4 },
+ { "LATIN4", RTL_TEXTENCODING_ISO_8859_4 },
+ { "L4", RTL_TEXTENCODING_ISO_8859_4 },
+ { "CSISOLATIN4", RTL_TEXTENCODING_ISO_8859_4 },
+ { "ISO-8859-5", RTL_TEXTENCODING_ISO_8859_5 },
+ { "ISO_8859-5:1988", RTL_TEXTENCODING_ISO_8859_5 },
+ { "ISO-IR-144", RTL_TEXTENCODING_ISO_8859_5 },
+ { "ISO_8859-5", RTL_TEXTENCODING_ISO_8859_5 },
+ { "CYRILLIC", RTL_TEXTENCODING_ISO_8859_5 },
+ { "CSISOLATINCYRILLIC", RTL_TEXTENCODING_ISO_8859_5 },
+ { "ISO-8859-6", RTL_TEXTENCODING_ISO_8859_6 },
+ { "ISO_8859-6:1987", RTL_TEXTENCODING_ISO_8859_6 },
+ { "ISO-IR-127", RTL_TEXTENCODING_ISO_8859_6 },
+ { "ISO_8859-6", RTL_TEXTENCODING_ISO_8859_6 },
+ { "ECMA-114", RTL_TEXTENCODING_ISO_8859_6 },
+ { "ASMO-708", RTL_TEXTENCODING_ISO_8859_6 },
+ { "ARABIC", RTL_TEXTENCODING_ISO_8859_6 },
+ { "CSISOLATINARABIC", RTL_TEXTENCODING_ISO_8859_6 },
+ { "ISO-8859-7", RTL_TEXTENCODING_ISO_8859_7 },
+ { "ISO_8859-7:1987", RTL_TEXTENCODING_ISO_8859_7 },
+ { "ISO-IR-126", RTL_TEXTENCODING_ISO_8859_7 },
+ { "ISO_8859-7", RTL_TEXTENCODING_ISO_8859_7 },
+ { "ELOT_928", RTL_TEXTENCODING_ISO_8859_7 },
+ { "ECMA-118", RTL_TEXTENCODING_ISO_8859_7 },
+ { "GREEK", RTL_TEXTENCODING_ISO_8859_7 },
+ { "GREEK8", RTL_TEXTENCODING_ISO_8859_7 },
+ { "CSISOLATINGREEK", RTL_TEXTENCODING_ISO_8859_7 },
+ { "ISO-8859-8", RTL_TEXTENCODING_ISO_8859_8 },
+ { "ISO_8859-8:1988", RTL_TEXTENCODING_ISO_8859_8 },
+ { "ISO-IR-138", RTL_TEXTENCODING_ISO_8859_8 },
+ { "ISO_8859-8", RTL_TEXTENCODING_ISO_8859_8 },
+ { "HEBREW", RTL_TEXTENCODING_ISO_8859_8 },
+ { "CSISOLATINHEBREW", RTL_TEXTENCODING_ISO_8859_8 },
+ { "ISO-8859-9", RTL_TEXTENCODING_ISO_8859_9 },
+ { "ISO_8859-9:1989", RTL_TEXTENCODING_ISO_8859_9 },
+ { "ISO-IR-148", RTL_TEXTENCODING_ISO_8859_9 },
+ { "ISO_8859-9", RTL_TEXTENCODING_ISO_8859_9 },
+ { "LATIN5", RTL_TEXTENCODING_ISO_8859_9 },
+ { "L5", RTL_TEXTENCODING_ISO_8859_9 },
+ { "CSISOLATIN5", RTL_TEXTENCODING_ISO_8859_9 },
+ { "ISO-8859-14", RTL_TEXTENCODING_ISO_8859_14 }, // RFC 2047
+ { "ISO_8859-15", RTL_TEXTENCODING_ISO_8859_15 },
+ { "ISO-8859-15", RTL_TEXTENCODING_ISO_8859_15 }, // RFC 2047
+ { "MACINTOSH", RTL_TEXTENCODING_APPLE_ROMAN },
+ { "MAC", RTL_TEXTENCODING_APPLE_ROMAN },
+ { "CSMACINTOSH", RTL_TEXTENCODING_APPLE_ROMAN },
+ { "IBM437", RTL_TEXTENCODING_IBM_437 },
+ { "CP437", RTL_TEXTENCODING_IBM_437 },
+ { "437", RTL_TEXTENCODING_IBM_437 },
+ { "CSPC8CODEPAGE437", RTL_TEXTENCODING_IBM_437 },
+ { "IBM850", RTL_TEXTENCODING_IBM_850 },
+ { "CP850", RTL_TEXTENCODING_IBM_850 },
+ { "850", RTL_TEXTENCODING_IBM_850 },
+ { "CSPC850MULTILINGUAL", RTL_TEXTENCODING_IBM_850 },
+ { "IBM860", RTL_TEXTENCODING_IBM_860 },
+ { "CP860", RTL_TEXTENCODING_IBM_860 },
+ { "860", RTL_TEXTENCODING_IBM_860 },
+ { "CSIBM860", RTL_TEXTENCODING_IBM_860 },
+ { "IBM861", RTL_TEXTENCODING_IBM_861 },
+ { "CP861", RTL_TEXTENCODING_IBM_861 },
+ { "861", RTL_TEXTENCODING_IBM_861 },
+ { "CP-IS", RTL_TEXTENCODING_IBM_861 },
+ { "CSIBM861", RTL_TEXTENCODING_IBM_861 },
+ { "IBM863", RTL_TEXTENCODING_IBM_863 },
+ { "CP863", RTL_TEXTENCODING_IBM_863 },
+ { "863", RTL_TEXTENCODING_IBM_863 },
+ { "CSIBM863", RTL_TEXTENCODING_IBM_863 },
+ { "IBM865", RTL_TEXTENCODING_IBM_865 },
+ { "CP865", RTL_TEXTENCODING_IBM_865 },
+ { "865", RTL_TEXTENCODING_IBM_865 },
+ { "CSIBM865", RTL_TEXTENCODING_IBM_865 },
+ { "IBM775", RTL_TEXTENCODING_IBM_775 },
+ { "CP775", RTL_TEXTENCODING_IBM_775 },
+ { "CSPC775BALTIC", RTL_TEXTENCODING_IBM_775 },
+ { "IBM852", RTL_TEXTENCODING_IBM_852 },
+ { "CP852", RTL_TEXTENCODING_IBM_852 },
+ { "852", RTL_TEXTENCODING_IBM_852 },
+ { "CSPCP852", RTL_TEXTENCODING_IBM_852 },
+ { "IBM855", RTL_TEXTENCODING_IBM_855 },
+ { "CP855", RTL_TEXTENCODING_IBM_855 },
+ { "855", RTL_TEXTENCODING_IBM_855 },
+ { "CSIBM855", RTL_TEXTENCODING_IBM_855 },
+ { "IBM857", RTL_TEXTENCODING_IBM_857 },
+ { "CP857", RTL_TEXTENCODING_IBM_857 },
+ { "857", RTL_TEXTENCODING_IBM_857 },
+ { "CSIBM857", RTL_TEXTENCODING_IBM_857 },
+ { "IBM862", RTL_TEXTENCODING_IBM_862 },
+ { "CP862", RTL_TEXTENCODING_IBM_862 },
+ { "862", RTL_TEXTENCODING_IBM_862 },
+ { "CSPC862LATINHEBREW", RTL_TEXTENCODING_IBM_862 },
+ { "IBM864", RTL_TEXTENCODING_IBM_864 },
+ { "CP864", RTL_TEXTENCODING_IBM_864 },
+ { "CSIBM864", RTL_TEXTENCODING_IBM_864 },
+ { "IBM866", RTL_TEXTENCODING_IBM_866 },
+ { "CP866", RTL_TEXTENCODING_IBM_866 },
+ { "866", RTL_TEXTENCODING_IBM_866 },
+ { "CSIBM866", RTL_TEXTENCODING_IBM_866 },
+ { "IBM869", RTL_TEXTENCODING_IBM_869 },
+ { "CP869", RTL_TEXTENCODING_IBM_869 },
+ { "869", RTL_TEXTENCODING_IBM_869 },
+ { "CP-GR", RTL_TEXTENCODING_IBM_869 },
+ { "CSIBM869", RTL_TEXTENCODING_IBM_869 },
+ { "WINDOWS-1250", RTL_TEXTENCODING_MS_1250 },
+ { "WINDOWS-1251", RTL_TEXTENCODING_MS_1251 },
+ { "WINDOWS-1253", RTL_TEXTENCODING_MS_1253 },
+ { "WINDOWS-1254", RTL_TEXTENCODING_MS_1254 },
+ { "WINDOWS-1255", RTL_TEXTENCODING_MS_1255 },
+ { "WINDOWS-1256", RTL_TEXTENCODING_MS_1256 },
+ { "WINDOWS-1257", RTL_TEXTENCODING_MS_1257 },
+ { "WINDOWS-1258", RTL_TEXTENCODING_MS_1258 },
+ { "SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS },
+ { "MS_KANJI", RTL_TEXTENCODING_SHIFT_JIS },
+ { "CSSHIFTJIS", RTL_TEXTENCODING_SHIFT_JIS },
+ { "GB2312", RTL_TEXTENCODING_GB_2312 },
+ { "CSGB2312", RTL_TEXTENCODING_GB_2312 },
+ { "BIG5", RTL_TEXTENCODING_BIG5 },
+ { "CSBIG5", RTL_TEXTENCODING_BIG5 },
+ { "EUC-JP", RTL_TEXTENCODING_EUC_JP },
+ { "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE",
+ RTL_TEXTENCODING_EUC_JP },
+ { "CSEUCPKDFMTJAPANESE", RTL_TEXTENCODING_EUC_JP },
+ { "ISO-2022-JP", RTL_TEXTENCODING_ISO_2022_JP },
+ { "CSISO2022JP", RTL_TEXTENCODING_ISO_2022_JP },
+ { "ISO-2022-CN", RTL_TEXTENCODING_ISO_2022_CN },
+ { "KOI8-R", RTL_TEXTENCODING_KOI8_R },
+ { "CSKOI8R", RTL_TEXTENCODING_KOI8_R },
+ { "UTF-7", RTL_TEXTENCODING_UTF7 },
+ { "UTF-8", RTL_TEXTENCODING_UTF8 },
+ { "ISO-8859-10", RTL_TEXTENCODING_ISO_8859_10 }, // RFC 2047
+ { "ISO-8859-13", RTL_TEXTENCODING_ISO_8859_13 }, // RFC 2047
+ { "EUC-KR", RTL_TEXTENCODING_EUC_KR },
+ { "CSEUCKR", RTL_TEXTENCODING_EUC_KR },
+ { "ISO-2022-KR", RTL_TEXTENCODING_ISO_2022_KR },
+ { "CSISO2022KR", RTL_TEXTENCODING_ISO_2022_KR },
+ { "ISO-10646-UCS-4", RTL_TEXTENCODING_UCS4 },
+ { "CSUCS4", RTL_TEXTENCODING_UCS4 },
+ { "ISO-10646-UCS-2", RTL_TEXTENCODING_UCS2 },
+ { "CSUNICODE", RTL_TEXTENCODING_UCS2 } };
+
+//============================================================================
+template< typename T >
+inline rtl_TextEncoding getCharsetEncoding_Impl(T const * pBegin,
+ T const * pEnd)
+{
+ for (sal_Size i = 0; i < sizeof aEncodingMap / sizeof (EncodingEntry);
+ ++i)
+ if (INetMIME::equalIgnoreCase(pBegin, pEnd, aEncodingMap[i].m_aName))
+ return aEncodingMap[i].m_eEncoding;
+ return RTL_TEXTENCODING_DONTKNOW;
+}
+
+}
+
+//============================================================================
+// static
+rtl_TextEncoding INetMIME::getCharsetEncoding(sal_Char const * pBegin,
+ sal_Char const * pEnd)
+{
+ return getCharsetEncoding_Impl(pBegin, pEnd);
+}
+
+//============================================================================
+// static
+rtl_TextEncoding INetMIME::getCharsetEncoding(sal_Unicode const * pBegin,
+ sal_Unicode const * pEnd)
+{
+ return getCharsetEncoding_Impl(pBegin, pEnd);
+}
+
+//============================================================================
+// static
+INetMIMECharsetList_Impl *
+INetMIME::createPreferredCharsetList(rtl_TextEncoding eEncoding)
+{
+ static const sal_uInt32 aUSASCIIRanges[] = { 0, 0x7F, sal_uInt32(-1) };
+
+ static const sal_uInt32 aISO88591Ranges[] = { 0, 0xFF, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-1.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO88592Ranges[]
+ = { 0, 0xA0, 0xA4, 0xA4, 0xA7, 0xA8, 0xAD, 0xAD, 0xB0, 0xB0,
+ 0xB4, 0xB4, 0xB8, 0xB8, 0xC1, 0xC2, 0xC4, 0xC4, 0xC7, 0xC7,
+ 0xC9, 0xC9, 0xCB, 0xCB, 0xCD, 0xCE, 0xD3, 0xD4, 0xD6, 0xD7,
+ 0xDA, 0xDA, 0xDC, 0xDD, 0xDF, 0xDF, 0xE1, 0xE2, 0xE4, 0xE4,
+ 0xE7, 0xE7, 0xE9, 0xE9, 0xEB, 0xEB, 0xED, 0xEE, 0xF3, 0xF4,
+ 0xF6, 0xF7, 0xFA, 0xFA, 0xFC, 0xFD, 0x102, 0x107, 0x10C, 0x111,
+ 0x118, 0x11B, 0x139, 0x13A, 0x13D, 0x13E, 0x141, 0x144,
+ 0x147, 0x148, 0x150, 0x151, 0x154, 0x155, 0x158, 0x15B,
+ 0x15E, 0x165, 0x16E, 0x171, 0x179, 0x17E, 0x2C7, 0x2C7,
+ 0x2D8, 0x2D9, 0x2DB, 0x2DB, 0x2DD, 0x2DD, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-2.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO88593Ranges[]
+ = { 0, 0xA0, 0xA3, 0xA4, 0xA7, 0xA8, 0xAD, 0xAD, 0xB0, 0xB0,
+ 0xB2, 0xB5, 0xB7, 0xB8, 0xBD, 0xBD, 0xC0, 0xC2, 0xC4, 0xC4,
+ 0xC7, 0xCF, 0xD1, 0xD4, 0xD6, 0xD7, 0xD9, 0xDC, 0xDF, 0xE2,
+ 0xE4, 0xE4, 0xE7, 0xEF, 0xF1, 0xF4, 0xF6, 0xF7, 0xF9, 0xFC,
+ 0x108, 0x10B, 0x11C, 0x121, 0x124, 0x127, 0x130, 0x131,
+ 0x134, 0x135, 0x15C, 0x15F, 0x16C, 0x16D, 0x17B, 0x17C,
+ 0x2D8, 0x2D9, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-3.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO88594Ranges[]
+ = { 0, 0xA0, 0xA4, 0xA4, 0xA7, 0xA8, 0xAD, 0xAD, 0xAF, 0xB0,
+ 0xB4, 0xB4, 0xB8, 0xB8, 0xC1, 0xC6, 0xC9, 0xC9, 0xCB, 0xCB,
+ 0xCD, 0xCE, 0xD4, 0xD8, 0xDA, 0xDC, 0xDF, 0xDF, 0xE1, 0xE6,
+ 0xE9, 0xE9, 0xEB, 0xEB, 0xED, 0xEE, 0xF4, 0xF8, 0xFA, 0xFC,
+ 0x100, 0x101, 0x104, 0x105, 0x10C, 0x10D, 0x110, 0x113,
+ 0x116, 0x119, 0x122, 0x123, 0x128, 0x12B, 0x12E, 0x12F,
+ 0x136, 0x138, 0x13B, 0x13C, 0x145, 0x146, 0x14A, 0x14D,
+ 0x156, 0x157, 0x160, 0x161, 0x166, 0x16B, 0x172, 0x173,
+ 0x17D, 0x17E, 0x2C7, 0x2C7, 0x2D9, 0x2D9, 0x2DB, 0x2DB,
+ sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-4.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO88595Ranges[]
+ = { 0, 0xA0, 0xA7, 0xA7, 0xAD, 0xAD, 0x401, 0x40C, 0x40E, 0x44F,
+ 0x451, 0x45C, 0x45E, 0x45F, 0x2116, 0x2116, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO88596Ranges[]
+ = { 0, 0xA0, 0xA4, 0xA4, 0xAD, 0xAD, 0x60C, 0x60C, 0x61B, 0x61B,
+ 0x61F, 0x61F, 0x621, 0x63A, 0x640, 0x652, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO88597Ranges[]
+ = { 0, 0xA0, 0xA3, 0xA3, 0xA6, 0xA9, 0xAB, 0xAD, 0xB0, 0xB3,
+ 0xB7, 0xB7, 0xBB, 0xBB, 0xBD, 0xBD, 0x384, 0x386, 0x388, 0x38A,
+ 0x38C, 0x38C, 0x38E, 0x3A1, 0x3A3, 0x3CE, 0x2015, 0x2015,
+ 0x2018, 0x2019, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO88598Ranges[]
+ = { 0, 0xA0, 0xA2, 0xA9, 0xAB, 0xB9, 0xBB, 0xBE, 0xD7, 0xD7,
+ 0xF7, 0xF7, 0x5D0, 0x5EA, 0x200E, 0x200F, 0x2017, 0x2017,
+ sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-8.TXT> version
+ // 1.1 of 2000-Jan-03
+
+ static const sal_uInt32 aISO88599Ranges[]
+ = { 0, 0xCF, 0xD1, 0xDC, 0xDF, 0xEF, 0xF1, 0xFC, 0xFF, 0xFF,
+ 0x11E, 0x11F, 0x130, 0x131, 0x15E, 0x15F, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-9.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO885910Ranges[]
+ = { 0, 0xA0, 0xA7, 0xA7, 0xAD, 0xAD, 0xB0, 0xB0, 0xB7, 0xB7,
+ 0xC1, 0xC6, 0xC9, 0xC9, 0xCB, 0xCB, 0xCD, 0xD0, 0xD3, 0xD6,
+ 0xD8, 0xD8, 0xDA, 0xDF, 0xE1, 0xE6, 0xE9, 0xE9, 0xEB, 0xEB,
+ 0xED, 0xF0, 0xF3, 0xF6, 0xF8, 0xF8, 0xFA, 0xFE, 0x100, 0x101,
+ 0x104, 0x105, 0x10C, 0x10D, 0x110, 0x113, 0x116, 0x119,
+ 0x122, 0x123, 0x128, 0x12B, 0x12E, 0x12F, 0x136, 0x138,
+ 0x13B, 0x13C, 0x145, 0x146, 0x14A, 0x14D, 0x160, 0x161,
+ 0x166, 0x16B, 0x172, 0x173, 0x17D, 0x17E, 0x2015, 0x2015,
+ sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-10.TXT> version
+ // 1.1 of 1999 October 11
+
+ static const sal_uInt32 aISO885913Ranges[]
+ = { 0, 0xA0, 0xA2, 0xA4, 0xA6, 0xA7, 0xA9, 0xA9, 0xAB, 0xAE,
+ 0xB0, 0xB3, 0xB5, 0xB7, 0xB9, 0xB9, 0xBB, 0xBE, 0xC4, 0xC6,
+ 0xC9, 0xC9, 0xD3, 0xD3, 0xD5, 0xD8, 0xDC, 0xDC, 0xDF, 0xDF,
+ 0xE4, 0xE6, 0xE9, 0xE9, 0xF3, 0xF3, 0xF5, 0xF8, 0xFC, 0xFC,
+ 0x100, 0x101, 0x104, 0x107, 0x10C, 0x10D, 0x112, 0x113,
+ 0x116, 0x119, 0x122, 0x123, 0x12A, 0x12B, 0x12E, 0x12F,
+ 0x136, 0x137, 0x13B, 0x13C, 0x141, 0x146, 0x14C, 0x14D,
+ 0x156, 0x157, 0x15A, 0x15B, 0x160, 0x161, 0x16A, 0x16B,
+ 0x172, 0x173, 0x179, 0x17E, 0x2019, 0x2019, 0x201C, 0x201E,
+ sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-13.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO885914Ranges[]
+ = { 0, 0xA0, 0xA3, 0xA3, 0xA7, 0xA7, 0xA9, 0xA9, 0xAD, 0xAE,
+ 0xB6, 0xB6, 0xC0, 0xCF, 0xD1, 0xD6, 0xD8, 0xDD, 0xDF, 0xEF,
+ 0xF1, 0xF6, 0xF8, 0xFD, 0xFF, 0xFF, 0x10A, 0x10B, 0x120, 0x121,
+ 0x174, 0x178, 0x1E02, 0x1E03, 0x1E0A, 0x1E0B, 0x1E1E, 0x1E1F,
+ 0x1E40, 0x1E41, 0x1E56, 0x1E57, 0x1E60, 0x1E61, 0x1E6A, 0x1E6B,
+ 0x1E80, 0x1E85, 0x1EF2, 0x1EF3, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-14.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aISO885915Ranges[]
+ = { 0, 0xA3, 0xA5, 0xA5, 0xA7, 0xA7, 0xA9, 0xB3, 0xB5, 0xB7,
+ 0xB9, 0xBB, 0xBF, 0xFF, 0x152, 0x153, 0x160, 0x161, 0x178, 0x178,
+ 0x17D, 0x17E, 0x20AC, 0x20AC, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT> version
+ // 1.0 of 1999 July 27
+
+ static const sal_uInt32 aKOI8RRanges[]
+ = { 0, 0x7F, 0xA0, 0xA0, 0xA9, 0xA9, 0xB0, 0xB0, 0xB2, 0xB2,
+ 0xB7, 0xB7, 0xF7, 0xF7, 0x401, 0x401, 0x410, 0x44F, 0x451, 0x451,
+ 0x2219, 0x221A, 0x2248, 0x2248, 0x2264, 0x2265, 0x2320, 0x2321,
+ 0x2500, 0x2500, 0x2502, 0x2502, 0x250C, 0x250C, 0x2510, 0x2510,
+ 0x2514, 0x2514, 0x2518, 0x2518, 0x251C, 0x251C, 0x2524, 0x2524,
+ 0x252C, 0x252C, 0x2534, 0x2534, 0x253C, 0x253C, 0x2550, 0x256C,
+ 0x2580, 0x2580, 0x2584, 0x2584, 0x2588, 0x2588, 0x258C, 0x258C,
+ 0x2590, 0x2593, 0x25A0, 0x25A0, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT>
+ // version 1.0 of 18 August 1999
+
+ static const sal_uInt32 aWindows1252Ranges[]
+ = { 0, 0x7F, 0xA0, 0xFF, 0x152, 0x153, 0x160, 0x161, 0x178, 0x178,
+ 0x17D, 0x17E, 0x192, 0x192, 0x2C6, 0x2C6, 0x2DC, 0x2DC,
+ 0x2013, 0x2014, 0x2018, 0x201A, 0x201C, 0x201E, 0x2020, 0x2022,
+ 0x2026, 0x2026, 0x2030, 0x2030, 0x2039, 0x203A, 0x20AC, 0x20AC,
+ 0x2122, 0x2122, sal_uInt32(-1) };
+ // <ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/
+ // CP1252.TXT> version 2.01 of 04/15/98
+
+ INetMIMECharsetList_Impl * pList = new INetMIMECharsetList_Impl;
+ switch (eEncoding)
+ {
+ case RTL_TEXTENCODING_MS_1252:
+#if defined WNT
+ pList->prepend(Charset(RTL_TEXTENCODING_MS_1252,
+ aWindows1252Ranges));
+#endif // WNT
+ case RTL_TEXTENCODING_ISO_8859_1:
+ case RTL_TEXTENCODING_UTF7:
+ case RTL_TEXTENCODING_UTF8:
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_2:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_2,
+ aISO88592Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_3:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_3,
+ aISO88593Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_4:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_4,
+ aISO88594Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_5:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_5,
+ aISO88595Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_6:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_6,
+ aISO88596Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_7:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_7,
+ aISO88597Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_8:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_8,
+ aISO88598Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_9:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_9,
+ aISO88599Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_10:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_10,
+ aISO885910Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_13:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_13,
+ aISO885913Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_14:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_14,
+ aISO885914Ranges));
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_15:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_15,
+ aISO885915Ranges));
+ break;
+
+ case RTL_TEXTENCODING_MS_1250:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_2,
+ aISO88592Ranges));
+ break;
+
+ case RTL_TEXTENCODING_MS_1251:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_5,
+ aISO88595Ranges));
+ break;
+
+ case RTL_TEXTENCODING_MS_1253:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_7,
+ aISO88597Ranges));
+ break;
+
+ case RTL_TEXTENCODING_MS_1254:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_9,
+ aISO88599Ranges));
+ break;
+
+ case RTL_TEXTENCODING_MS_1255:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_8,
+ aISO88598Ranges));
+ break;
+
+ case RTL_TEXTENCODING_MS_1256:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_6,
+ aISO88596Ranges));
+ break;
+
+ case RTL_TEXTENCODING_MS_1257:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_4,
+ aISO88594Ranges));
+ break;
+
+ case RTL_TEXTENCODING_KOI8_R:
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_5,
+ aISO88595Ranges));
+ pList->prepend(Charset(RTL_TEXTENCODING_KOI8_R, aKOI8RRanges));
+ break;
+
+ default: //@@@ more cases are missing!
+ DBG_ERROR("INetMIME::createPreferredCharsetList():"
+ " Unsupported encoding");
+ break;
+ }
+ pList->prepend(Charset(RTL_TEXTENCODING_ISO_8859_1, aISO88591Ranges));
+ pList->prepend(Charset(RTL_TEXTENCODING_ASCII_US, aUSASCIIRanges));
+ return pList;
+}
+
+//============================================================================
+// static
+sal_Unicode * INetMIME::convertToUnicode(const sal_Char * pBegin,
+ const sal_Char * pEnd,
+ rtl_TextEncoding eEncoding,
+ sal_Size & rSize)
+{
+ if (eEncoding == RTL_TEXTENCODING_DONTKNOW)
+ return 0;
+ rtl_TextToUnicodeConverter hConverter
+ = rtl_createTextToUnicodeConverter(eEncoding);
+ rtl_TextToUnicodeContext hContext
+ = rtl_createTextToUnicodeContext(hConverter);
+ sal_Unicode * pBuffer;
+ sal_uInt32 nInfo;
+ for (sal_Size nBufferSize = pEnd - pBegin;;
+ nBufferSize += nBufferSize / 3 + 1)
+ {
+ pBuffer = new sal_Unicode[nBufferSize];
+ sal_Size nSrcCvtBytes;
+ rSize = rtl_convertTextToUnicode(
+ hConverter, hContext, pBegin, pEnd - pBegin, pBuffer,
+ nBufferSize,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
+ | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR,
+ &nInfo, &nSrcCvtBytes);
+ if (nInfo != RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL)
+ break;
+ delete[] pBuffer;
+ rtl_resetTextToUnicodeContext(hConverter, hContext);
+ }
+ rtl_destroyTextToUnicodeContext(hConverter, hContext);
+ rtl_destroyTextToUnicodeConverter(hConverter);
+ if (nInfo != 0)
+ {
+ delete[] pBuffer;
+ pBuffer = 0;
+ }
+ return pBuffer;
+}
+
+//============================================================================
+// static
+sal_Char * INetMIME::convertFromUnicode(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd,
+ rtl_TextEncoding eEncoding,
+ sal_Size & rSize)
+{
+ if (eEncoding == RTL_TEXTENCODING_DONTKNOW)
+ return 0;
+ rtl_UnicodeToTextConverter hConverter
+ = rtl_createUnicodeToTextConverter(eEncoding);
+ rtl_UnicodeToTextContext hContext
+ = rtl_createUnicodeToTextContext(hConverter);
+ sal_Char * pBuffer;
+ sal_uInt32 nInfo;
+ for (sal_Size nBufferSize = pEnd - pBegin;;
+ nBufferSize += nBufferSize / 3 + 1)
+ {
+ pBuffer = new sal_Char[nBufferSize];
+ sal_Size nSrcCvtBytes;
+ rSize = rtl_convertUnicodeToText(
+ hConverter, hContext, pBegin, pEnd - pBegin, pBuffer,
+ nBufferSize,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
+ | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
+ | RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE
+ | RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR,
+ &nInfo, &nSrcCvtBytes);
+ if (nInfo != RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)
+ break;
+ delete[] pBuffer;
+ rtl_resetUnicodeToTextContext(hConverter, hContext);
+ }
+ rtl_destroyUnicodeToTextContext(hConverter, hContext);
+ rtl_destroyUnicodeToTextConverter(hConverter);
+ if (nInfo != 0)
+ {
+ delete[] pBuffer;
+ pBuffer = 0;
+ }
+ return pBuffer;
+}
+
+//============================================================================
+// static
+void INetMIME::writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar)
+{
+ // See RFC 2279 for a discussion of UTF-8.
+ DBG_ASSERT(nChar < 0x80000000, "INetMIME::writeUTF8(): Bad char");
+
+ if (nChar < 0x80)
+ rSink << sal_Char(nChar);
+ else if (nChar < 0x800)
+ rSink << sal_Char(nChar >> 6 | 0xC0)
+ << sal_Char(nChar & 0x3F | 0x80);
+ else if (nChar < 0x10000)
+ rSink << sal_Char(nChar >> 12 | 0xE0)
+ << sal_Char(nChar >> 6 & 0x3F | 0x80)
+ << sal_Char(nChar & 0x3F | 0x80);
+ else if (nChar < 0x200000)
+ rSink << sal_Char(nChar >> 18 | 0xF0)
+ << sal_Char(nChar >> 12 & 0x3F | 0x80)
+ << sal_Char(nChar >> 6 & 0x3F | 0x80)
+ << sal_Char(nChar & 0x3F | 0x80);
+ else if (nChar < 0x4000000)
+ rSink << sal_Char(nChar >> 24 | 0xF8)
+ << sal_Char(nChar >> 18 & 0x3F | 0x80)
+ << sal_Char(nChar >> 12 & 0x3F | 0x80)
+ << sal_Char(nChar >> 6 & 0x3F | 0x80)
+ << sal_Char(nChar & 0x3F | 0x80);
+ else
+ rSink << sal_Char(nChar >> 30 | 0xFC)
+ << sal_Char(nChar >> 24 & 0x3F | 0x80)
+ << sal_Char(nChar >> 18 & 0x3F | 0x80)
+ << sal_Char(nChar >> 12 & 0x3F | 0x80)
+ << sal_Char(nChar >> 6 & 0x3F | 0x80)
+ << sal_Char(nChar & 0x3F | 0x80);
+}
+
+//============================================================================
+// static
+void INetMIME::writeUnsigned(INetMIMEOutputSink & rSink, sal_uInt32 nValue,
+ int nMinDigits)
+{
+ sal_Char aBuffer[10];
+ // max unsigned 32 bit value (4294967295) has 10 places
+ sal_Char * p = aBuffer;
+ for (; nValue > 0; nValue /= 10)
+ *p++ = sal_Char(getDigit(nValue % 10));
+ nMinDigits -= p - aBuffer;
+ while (nMinDigits-- > 0)
+ rSink << '0';
+ while (p != aBuffer)
+ rSink << *--p;
+}
+
+//============================================================================
+// static
+void INetMIME::writeDateTime(INetMIMEOutputSink & rSink,
+ const DateTime & rUTC)
+{
+ static const sal_Char aDay[7][3]
+ = { { 'M', 'o', 'n' },
+ { 'T', 'u', 'e' },
+ { 'W', 'e', 'd' },
+ { 'T', 'h', 'u' },
+ { 'F', 'r', 'i' },
+ { 'S', 'a', 't' },
+ { 'S', 'u', 'n' } };
+ const sal_Char * pTheDay = aDay[rUTC.GetDayOfWeek()];
+ rSink.write(pTheDay, pTheDay + 3);
+ rSink << ", ";
+ writeUnsigned(rSink, rUTC.GetDay());
+ rSink << ' ';
+ static const sal_Char aMonth[12][3]
+ = { { 'J', 'a', 'n' },
+ { 'F', 'e', 'b' },
+ { 'M', 'a', 'r' },
+ { 'A', 'p', 'r' },
+ { 'M', 'a', 'y' },
+ { 'J', 'u', 'n' },
+ { 'J', 'u', 'l' },
+ { 'A', 'u', 'g' },
+ { 'S', 'e', 'p' },
+ { 'O', 'c', 't' },
+ { 'N', 'o', 'v' },
+ { 'D', 'e', 'c' } };
+ const sal_Char * pTheMonth = aMonth[rUTC.GetMonth() - 1];
+ rSink.write(pTheMonth, pTheMonth + 3);
+ rSink << ' ';
+ writeUnsigned(rSink, rUTC.GetYear());
+ rSink << ' ';
+ writeUnsigned(rSink, rUTC.GetHour(), 2);
+ rSink << ':';
+ writeUnsigned(rSink, rUTC.GetMin(), 2);
+ rSink << ':';
+ writeUnsigned(rSink, rUTC.GetSec(), 2);
+ rSink << " +0000";
+}
+
+//============================================================================
+// static
+void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
+ HeaderFieldType eType,
+ const ByteString & rBody,
+ rtl_TextEncoding ePreferredEncoding,
+ bool bInitialSpace)
+{
+ writeHeaderFieldBody(rSink, eType,
+ UniString(rBody, RTL_TEXTENCODING_UTF8),
+ ePreferredEncoding);
+}
+
+//============================================================================
+// static
+void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink,
+ HeaderFieldType eType,
+ const UniString & rBody,
+ rtl_TextEncoding ePreferredEncoding,
+ bool bInitialSpace)
+{
+ if (eType == HEADER_FIELD_TEXT)
+ {
+ INetMIMEEncodedWordOutputSink
+ aOutput(rSink, INetMIMEEncodedWordOutputSink::CONTEXT_TEXT,
+ bInitialSpace ?
+ INetMIMEEncodedWordOutputSink::SPACE_ALWAYS :
+ INetMIMEEncodedWordOutputSink::SPACE_NO,
+ ePreferredEncoding);
+ aOutput.write(rBody.GetBuffer(), rBody.GetBuffer() + rBody.Len());
+ aOutput.flush();
+ }
+ else
+ {
+ enum Brackets { BRACKETS_OUTSIDE, BRACKETS_OPENING, BRACKETS_INSIDE };
+ Brackets eBrackets = BRACKETS_OUTSIDE;
+
+ const sal_Unicode * pBodyPtr = rBody.GetBuffer();
+ const sal_Unicode * pBodyEnd = pBodyPtr + rBody.Len();
+ while (pBodyPtr != pBodyEnd)
+ switch (*pBodyPtr)
+ {
+ case '\t':
+ case ' ':
+ // A WSP adds to accumulated space:
+ bInitialSpace = true;
+ ++pBodyPtr;
+ break;
+
+ case '(':
+ {
+ // Write a pending '<' if necessary:
+ if (eBrackets == BRACKETS_OPENING)
+ {
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '<';
+ bInitialSpace = false;
+ eBrackets = BRACKETS_INSIDE;
+ }
+
+ // Write the comment, introducing encoded-words where
+ // necessary:
+ int nLevel = 0;
+ INetMIMEEncodedWordOutputSink
+ aOutput(
+ rSink,
+ INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT,
+ INetMIMEEncodedWordOutputSink::SPACE_NO,
+ ePreferredEncoding);
+ while (pBodyPtr != pBodyEnd)
+ switch (*pBodyPtr)
+ {
+ case '(':
+ aOutput.flush();
+ if (rSink.getColumn()
+ + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '(';
+ bInitialSpace = false;
+ ++nLevel;
+ ++pBodyPtr;
+ break;
+
+ case ')':
+ aOutput.flush();
+ if (rSink.getColumn()
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ rSink << ')';
+ ++pBodyPtr;
+ if (--nLevel == 0)
+ goto comment_done;
+ break;
+
+ case '\\':
+ if (++pBodyPtr == pBodyEnd)
+ break;
+ default:
+ aOutput << *pBodyPtr++;
+ break;
+ }
+ comment_done:
+ break;
+ }
+
+ case '<':
+ // Write an already pending '<' if necessary:
+ if (eBrackets == BRACKETS_OPENING)
+ {
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '<';
+ bInitialSpace = false;
+ }
+
+ // Remember this '<' as pending, and open a bracketed
+ // block:
+ eBrackets = BRACKETS_OPENING;
+ ++pBodyPtr;
+ break;
+
+ case '>':
+ // Write a pending '<' if necessary:
+ if (eBrackets == BRACKETS_OPENING)
+ {
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '<';
+ bInitialSpace = false;
+ }
+
+ // Write this '>', and close any bracketed block:
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '>';
+ bInitialSpace = false;
+ eBrackets = BRACKETS_OUTSIDE;
+ ++pBodyPtr;
+ break;
+
+ case ',':
+ case ':':
+ case ';':
+ case '\\':
+ case ']':
+ // Write a pending '<' if necessary:
+ if (eBrackets == BRACKETS_OPENING)
+ {
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '<';
+ bInitialSpace = false;
+ eBrackets = BRACKETS_INSIDE;
+ }
+
+ // Write this specials:
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << sal_Char(*pBodyPtr++);
+ bInitialSpace = false;
+ break;
+
+ case '\x0D': // CR
+ // A <CRLF WSP> adds to accumulated space, a <CR> not
+ // followed by <LF WSP> starts 'junk':
+ if (startsWithLineFolding(pBodyPtr, pBodyEnd))
+ {
+ bInitialSpace = true;
+ pBodyPtr += 3;
+ break;
+ }
+ default:
+ {
+ // The next token is either one of <"." / "@" / atom /
+ // quoted-string / domain-literal>, or it's 'junk'; if it
+ // is not 'junk', it is either a 'phrase' (i.e., it may
+ // contain encoded-words) or a 'non-phrase' (i.e., it may
+ // not contain encoded-words):
+ enum Entity { ENTITY_JUNK, ENTITY_NON_PHRASE,
+ ENTITY_PHRASE };
+ Entity eEntity;
+ switch (*pBodyPtr)
+ {
+ case '.':
+ case '@':
+ case '[':
+ // A token of <"." / "@" / domain-literal> always
+ // starts a 'non-phrase':
+ eEntity = ENTITY_NON_PHRASE;
+ break;
+
+ default:
+ if (isUSASCII(*pBodyPtr)
+ && !isAtomChar(*pBodyPtr))
+ {
+ eEntity = ENTITY_JUNK;
+ break;
+ }
+ case '"':
+ // A token of <atom / quoted-string> can either be
+ // a 'phrase' or a 'non-phrase':
+ switch (eType)
+ {
+ case HEADER_FIELD_STRUCTURED:
+ eEntity = ENTITY_NON_PHRASE;
+ break;
+
+ case HEADER_FIELD_PHRASE:
+ eEntity = ENTITY_PHRASE;
+ break;
+
+ case HEADER_FIELD_MESSAGE_ID:
+ // A 'phrase' if and only if outside any
+ // bracketed block:
+ eEntity
+ = eBrackets == BRACKETS_OUTSIDE ?
+ ENTITY_PHRASE :
+ ENTITY_NON_PHRASE;
+ break;
+
+ case HEADER_FIELD_ADDRESS:
+ {
+ // A 'non-phrase' if and only if, after
+ // skipping this token and any following
+ // <linear-white-space> and <comment>s,
+ // there is no token left, or the next
+ // token is any of <"." / "@" / ">" / ","
+ // / ";">, or the next token is <":"> and
+ // is within a bracketed block:
+ const sal_Unicode * pLookAhead = pBodyPtr;
+ if (*pLookAhead == '"')
+ {
+ pLookAhead
+ = skipQuotedString(pLookAhead,
+ pBodyEnd);
+ if (pLookAhead == pBodyPtr)
+ pLookAhead = pBodyEnd;
+ }
+ else
+ while (pLookAhead != pBodyEnd
+ && (isAtomChar(*pLookAhead)
+ || !isUSASCII(
+ *pLookAhead)))
+ ++pLookAhead;
+ while (pLookAhead != pBodyEnd)
+ switch (*pLookAhead)
+ {
+ case '\t':
+ case ' ':
+ ++pLookAhead;
+ break;
+
+ case '(':
+ {
+ const sal_Unicode * pPast
+ = skipComment(pLookAhead,
+ pBodyEnd);
+ pLookAhead
+ = pPast == pLookAhead ?
+ pBodyEnd : pPast;
+ break;
+ }
+
+ case ',':
+ case '.':
+ case ';':
+ case '>':
+ case '@':
+ eEntity = ENTITY_NON_PHRASE;
+ goto entity_determined;
+
+ case ':':
+ eEntity
+ = eBrackets
+ == BRACKETS_OUTSIDE ?
+ ENTITY_PHRASE :
+ ENTITY_NON_PHRASE;
+ goto entity_determined;
+
+ case '\x0D': // CR
+ if (startsWithLineFolding(
+ pLookAhead, pBodyEnd))
+ {
+ pLookAhead += 3;
+ break;
+ }
+ default:
+ eEntity = ENTITY_PHRASE;
+ goto entity_determined;
+ }
+ eEntity = ENTITY_NON_PHRASE;
+ entity_determined:
+ break;
+ }
+ }
+
+ // In a 'non-phrase', a non-US-ASCII character
+ // cannot be part of an <atom>, but instead the
+ // whole entity is 'junk' rather than 'non-
+ // phrase':
+ if (eEntity == ENTITY_NON_PHRASE
+ && !isUSASCII(*pBodyPtr))
+ eEntity = ENTITY_JUNK;
+ break;
+ }
+
+ switch (eEntity)
+ {
+ case ENTITY_JUNK:
+ {
+ // Write a pending '<' if necessary:
+ if (eBrackets == BRACKETS_OPENING)
+ {
+ if (rSink.getColumn()
+ + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '<';
+ bInitialSpace = false;
+ eBrackets = BRACKETS_INSIDE;
+ }
+
+ // Calculate the length of in- and output:
+ const sal_Unicode * pStart = pBodyPtr;
+ sal_uInt32 nLength = 0;
+ bool bModify = false;
+ bool bEnd = false;
+ while (pBodyPtr != pBodyEnd && !bEnd)
+ switch (*pBodyPtr)
+ {
+ case '\x0D': // CR
+ if (startsWithLineFolding(pBodyPtr,
+ pBodyEnd))
+ bEnd = true;
+ else if (startsWithLineBreak(
+ pBodyPtr, pBodyEnd))
+ {
+ nLength += 3;
+ bModify = true;
+ pBodyPtr += 2;
+ }
+ else
+ {
+ ++nLength;
+ ++pBodyPtr;
+ }
+ break;
+
+ case '\t':
+ case ' ':
+ bEnd = true;
+ break;
+
+ default:
+ if (isVisible(*pBodyPtr))
+ bEnd = true;
+ else if (isUSASCII(*pBodyPtr))
+ {
+ ++nLength;
+ ++pBodyPtr;
+ }
+ else
+ {
+ nLength += getUTF8OctetCount(
+ *pBodyPtr++);
+ bModify = true;
+ }
+ break;
+ }
+
+ // Write the output:
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ + nLength
+ > rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ bInitialSpace = false;
+ if (bModify)
+ while (pStart != pBodyPtr)
+ if (startsWithLineBreak(pStart, pBodyPtr))
+ {
+ rSink << "\x0D\\\x0A"; // CR, '\', LF
+ pStart += 2;
+ }
+ else
+ writeUTF8(rSink, *pStart++);
+ else
+ rSink.write(pStart, pBodyPtr);
+ break;
+ }
+
+ case ENTITY_NON_PHRASE:
+ {
+ // Calculate the length of in- and output:
+ const sal_Unicode * pStart = pBodyPtr;
+ sal_uInt32 nLength = 0;
+ bool bBracketedBlock = false;
+ bool bSymbol = *pStart != '.' && *pStart != '@';
+ bool bModify = false;
+ bool bEnd = false;
+ while (pBodyPtr != pBodyEnd && !bEnd)
+ switch (*pBodyPtr)
+ {
+ case '\t':
+ case ' ':
+ case '\x0D': // CR
+ {
+ const sal_Unicode * pLookAhead
+ = skipLinearWhiteSpace(pBodyPtr,
+ pBodyEnd);
+ if (pLookAhead < pBodyEnd
+ && (bSymbol ?
+ isAtomChar(*pLookAhead)
+ || *pLookAhead == '"'
+ || *pLookAhead == '[' :
+ *pLookAhead == '.'
+ || *pLookAhead == '@'
+ || *pLookAhead == '>'
+ && eType
+ >= HEADER_FIELD_MESSAGE_ID
+ && eBrackets
+ == BRACKETS_OPENING))
+ {
+ bModify = true;
+ pBodyPtr = pLookAhead;
+ }
+ else
+ bEnd = true;
+ break;
+ }
+
+ case '"':
+ if (bSymbol)
+ {
+ pBodyPtr
+ = scanQuotedBlock(pBodyPtr,
+ pBodyEnd,
+ '"', '"',
+ nLength,
+ bModify);
+ bSymbol = false;
+ }
+ else
+ bEnd = true;
+ break;
+
+ case '[':
+ if (bSymbol)
+ {
+ pBodyPtr
+ = scanQuotedBlock(pBodyPtr,
+ pBodyEnd,
+ '[', ']',
+ nLength,
+ bModify);
+ bSymbol = false;
+ }
+ else
+ bEnd = true;
+ break;
+
+ case '.':
+ case '@':
+ if (bSymbol)
+ bEnd = true;
+ else
+ {
+ ++nLength;
+ bSymbol = true;
+ ++pBodyPtr;
+ }
+ break;
+
+ case '>':
+ if (eBrackets == BRACKETS_OPENING
+ && eType
+ >= HEADER_FIELD_MESSAGE_ID)
+ {
+ ++nLength;
+ bBracketedBlock = true;
+ ++pBodyPtr;
+ }
+ bEnd = true;
+ break;
+
+ default:
+ if (isAtomChar(*pBodyPtr) && bSymbol)
+ {
+ while (pBodyPtr != pBodyEnd
+ && isAtomChar(*pBodyPtr))
+ {
+ ++nLength;
+ ++pBodyPtr;
+ }
+ bSymbol = false;
+ }
+ else
+ {
+ if (!isUSASCII(*pBodyPtr))
+ bModify = true;
+ bEnd = true;
+ }
+ break;
+ }
+
+ // Write a pending '<' if necessary:
+ if (eBrackets == BRACKETS_OPENING
+ && !bBracketedBlock)
+ {
+ if (rSink.getColumn()
+ + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '<';
+ bInitialSpace = false;
+ eBrackets = BRACKETS_INSIDE;
+ }
+
+ // Write the output:
+ if (rSink.getColumn() + (bInitialSpace ? 1 : 0)
+ + nLength
+ > rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ bInitialSpace = false;
+ if (bBracketedBlock)
+ {
+ rSink << '<';
+ eBrackets = BRACKETS_OUTSIDE;
+ }
+ if (bModify)
+ {
+ enum Mode { MODE_PLAIN, MODE_QUOTED_STRING,
+ MODE_DOMAIN_LITERAL };
+ Mode eMode = MODE_PLAIN;
+ while (pStart != pBodyPtr)
+ switch (*pStart)
+ {
+ case '\x0D': // CR
+ if (startsWithLineFolding(
+ pStart, pBodyPtr))
+ {
+ if (eMode != MODE_PLAIN)
+ rSink << sal_Char(
+ pStart[2]);
+ pStart += 3;
+ }
+ else if (startsWithLineBreak(
+ pStart, pBodyPtr))
+ {
+ rSink << "\x0D\\\x0A";
+ // CR, '\', LF
+ pStart += 2;
+ }
+ else
+ {
+ rSink << '\x0D'; // CR
+ ++pStart;
+ }
+ break;
+
+ case '\t':
+ case ' ':
+ if (eMode != MODE_PLAIN)
+ rSink << sal_Char(*pStart);
+ ++pStart;
+ break;
+
+ case '"':
+ if (eMode == MODE_PLAIN)
+ eMode = MODE_QUOTED_STRING;
+ else if (eMode
+ == MODE_QUOTED_STRING)
+ eMode = MODE_PLAIN;
+ rSink << '"';
+ ++pStart;
+ break;
+
+ case '[':
+ if (eMode == MODE_PLAIN)
+ eMode = MODE_DOMAIN_LITERAL;
+ rSink << '[';
+ ++pStart;
+ break;
+
+ case ']':
+ if (eMode == MODE_DOMAIN_LITERAL)
+ eMode = MODE_PLAIN;
+ rSink << ']';
+ ++pStart;
+ break;
+
+ case '\\':
+ rSink << '\\';
+ if (++pStart < pBodyPtr)
+ writeUTF8(rSink, *pStart++);
+ break;
+
+ default:
+ writeUTF8(rSink, *pStart++);
+ break;
+ }
+ }
+ else
+ rSink.write(pStart, pBodyPtr);
+ break;
+ }
+
+ case ENTITY_PHRASE:
+ {
+ // Write a pending '<' if necessary:
+ if (eBrackets == BRACKETS_OPENING)
+ {
+ if (rSink.getColumn()
+ + (bInitialSpace ? 1 : 0)
+ >= rSink.getLineLengthLimit())
+ rSink << INetMIMEOutputSink::endl << ' ';
+ else if (bInitialSpace)
+ rSink << ' ';
+ rSink << '<';
+ bInitialSpace = false;
+ eBrackets = BRACKETS_INSIDE;
+ }
+
+ // Calculate the length of in- and output:
+ const sal_Unicode * pStart = pBodyPtr;
+ bool bQuotedString = false;
+ bool bEnd = false;
+ while (pBodyPtr != pBodyEnd && !bEnd)
+ switch (*pBodyPtr)
+ {
+ case '\t':
+ case ' ':
+ case '\x0D': // CR
+ if (bQuotedString)
+ ++pBodyPtr;
+ else
+ {
+ const sal_Unicode * pLookAhead
+ = skipLinearWhiteSpace(
+ pBodyPtr, pBodyEnd);
+ if (pLookAhead != pBodyEnd
+ && (isAtomChar(*pLookAhead)
+ || !isUSASCII(*pLookAhead)
+ || *pLookAhead == '"'))
+ pBodyPtr = pLookAhead;
+ else
+ bEnd = true;
+ }
+ break;
+
+ case '"':
+ bQuotedString = !bQuotedString;
+ ++pBodyPtr;
+ break;
+
+ case '\\':
+ if (bQuotedString)
+ {
+ if (++pBodyPtr != pBodyEnd)
+ ++pBodyPtr;
+ }
+ else
+ bEnd = true;
+ break;
+
+ default:
+ if (bQuotedString
+ || isAtomChar(*pBodyPtr)
+ || !isUSASCII(*pBodyPtr))
+ ++pBodyPtr;
+ else
+ bEnd = true;
+ break;
+ }
+
+ // Write the phrase, introducing encoded-words
+ // where necessary:
+ INetMIMEEncodedWordOutputSink
+ aOutput(
+ rSink,
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE,
+ bInitialSpace ?
+ INetMIMEEncodedWordOutputSink::SPACE_ALWAYS :
+ INetMIMEEncodedWordOutputSink::SPACE_ENCODED,
+ ePreferredEncoding);
+ while (pStart != pBodyPtr)
+ switch (*pStart)
+ {
+ case '"':
+ ++pStart;
+ break;
+
+ case '\\':
+ if (++pStart != pBodyPtr)
+ aOutput << *pStart++;
+ break;
+
+ case '\x0D': // CR
+ pStart += 2;
+ aOutput << *pStart++;
+ break;
+
+ default:
+ aOutput << *pStart++;
+ break;
+ }
+ bInitialSpace = aOutput.flush();
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+}
+
+//============================================================================
+// static
+bool INetMIME::translateUTF8Char(const sal_Char *& rBegin,
+ const sal_Char * pEnd,
+ rtl_TextEncoding eEncoding,
+ sal_uInt32 & rCharacter)
+{
+ if (rBegin == pEnd || *rBegin < 0x80 || *rBegin >= 0xFE)
+ return false;
+
+ int nCount;
+ sal_uInt32 nMin;
+ sal_uInt32 nUCS4;
+ const sal_Char * p = rBegin;
+ if (*p < 0xE0)
+ {
+ nCount = 1;
+ nMin = 0x80;
+ nUCS4 = *p & 0x1F;
+ }
+ else if (*p < 0xF0)
+ {
+ nCount = 2;
+ nMin = 0x800;
+ nUCS4 = *p & 0xF;
+ }
+ else if (*p < 0xF8)
+ {
+ nCount = 3;
+ nMin = 0x10000;
+ nUCS4 = *p & 7;
+ }
+ else if (*p < 0xFC)
+ {
+ nCount = 4;
+ nMin = 0x200000;
+ nUCS4 = *p & 3;
+ }
+ else
+ {
+ nCount = 5;
+ nMin = 0x4000000;
+ nUCS4 = *p & 1;
+ }
+ ++p;
+
+ for (; nCount-- > 0; ++p)
+ if ((*p & 0xC0) == 0x80)
+ nUCS4 = nUCS4 << 6 | *p & 0x3F;
+ else
+ return false;
+
+ if (nUCS4 < nMin || nUCS4 > 0x10FFFF)
+ return false;
+
+ if (eEncoding >= RTL_TEXTENCODING_UCS4)
+ rCharacter = nUCS4;
+ else
+ {
+ sal_Unicode aUTF16[2];
+ const sal_Unicode * pUTF16End = putUTF32Character(aUTF16, nUCS4);
+ sal_Size nSize;
+ sal_Char * pBuffer = convertFromUnicode(aUTF16, pUTF16End, eEncoding,
+ nSize);
+ if (!pBuffer)
+ return false;
+ DBG_ASSERT(nSize == 1,
+ "INetMIME::translateUTF8Char(): Bad conversion");
+ rCharacter = *pBuffer;
+ delete[] pBuffer;
+ }
+ rBegin = p;
+ return true;
+}
+
+//============================================================================
+// static
+ByteString INetMIME::decodeUTF8(const ByteString & rText,
+ rtl_TextEncoding eEncoding)
+{
+ const sal_Char * p = rText.GetBuffer();
+ const sal_Char * pEnd = p + rText.Len();
+ ByteString sDecoded;
+ while (p != pEnd)
+ {
+ sal_uInt32 nCharacter;
+ if (translateUTF8Char(p, pEnd, eEncoding, nCharacter))
+ sDecoded += sal_Char(nCharacter);
+ else
+ sDecoded += sal_Char(*p++);
+ }
+ return sDecoded;
+}
+
+//============================================================================
+// static
+UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType,
+ const ByteString & rBody)
+{
+ // Due to a bug in INetCoreRFC822MessageStream::ConvertTo7Bit(), old
+ // versions of StarOffice send mails with header fields where encoded
+ // words can be preceded by '=', ',', '.', '"', or '(', and followed by
+ // '=', ',', '.', '"', ')', without any required white space in between.
+ // And there appear to exist some broken mailers that only encode single
+ // letters within words, like "Appel
+ // =?iso-8859-1?Q?=E0?=t=?iso-8859-1?Q?=E9?=moin", so it seems best to
+ // detect encoded words even when not propperly surrounded by white space.
+ //
+ // Non US-ASCII characters in rBody are treated as ISO-8859-1.
+ //
+ // encoded-word = "=?"
+ // 1*(%x21 / %x23-27 / %x2A-2B / %x2D / %30-39 / %x41-5A / %x5E-7E)
+ // ["*" 1*8ALPHA *("-" 1*8ALPHA)] "?"
+ // ("B?" *(4base64) (4base64 / 3base64 "=" / 2base64 "==")
+ // / "Q?" 1*(%x21-3C / %x3E / %x40-7E / "=" 2HEXDIG))
+ // "?="
+ //
+ // base64 = ALPHA / DIGIT / "+" / "/"
+
+ const sal_Char * pBegin = rBody.GetBuffer();
+ const sal_Char * pEnd = pBegin + rBody.Len();
+
+ UniString sDecoded;
+ const sal_Char * pCopyBegin = pBegin;
+
+ /* bool bStartEncodedWord = true; */
+ const sal_Char * pWSPBegin = pBegin;
+ UniString sEncodedText;
+ bool bQuotedEncodedText = false;
+ sal_uInt32 nCommentLevel = 0;
+
+ for (const sal_Char * p = pBegin; p != pEnd;)
+ {
+ if (p != pEnd && *p == '=' /* && bStartEncodedWord */)
+ {
+ const sal_Char * q = p + 1;
+ bool bEncodedWord = q != pEnd && *q++ == '?';
+
+ rtl_TextEncoding eCharsetEncoding;
+ if (bEncodedWord)
+ {
+ const sal_Char * pCharsetBegin = q;
+ const sal_Char * pLanguageBegin = 0;
+ int nAlphaCount;
+ for (bool bDone = false; !bDone;)
+ if (q == pEnd)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ }
+ else
+ {
+ sal_Char cChar = *q++;
+ switch (cChar)
+ {
+ case '*':
+ pLanguageBegin = q - 1;
+ nAlphaCount = 0;
+ break;
+
+ case '-':
+ if (pLanguageBegin != 0)
+ {
+ if (nAlphaCount == 0)
+ pLanguageBegin = 0;
+ else
+ nAlphaCount = 0;
+ }
+ break;
+
+ case '?':
+ if (pCharsetBegin == q - 1)
+ bEncodedWord = false;
+ else
+ {
+ eCharsetEncoding
+ = getCharsetEncoding(
+ pCharsetBegin,
+ pLanguageBegin == 0
+ || nAlphaCount == 0 ?
+ q - 1 : pLanguageBegin);
+ bEncodedWord = isMIMECharsetEncoding(
+ eCharsetEncoding);
+ eCharsetEncoding
+ = translateFromMIME(eCharsetEncoding);
+ }
+ bDone = true;
+ break;
+
+ default:
+ if (pLanguageBegin != 0
+ && (!isAlpha(cChar) || ++nAlphaCount > 8))
+ pLanguageBegin = 0;
+ break;
+ }
+ }
+ }
+
+ bool bEncodingB;
+ if (bEncodedWord)
+ if (q == pEnd)
+ bEncodedWord = false;
+ else
+ switch (*q++)
+ {
+ case 'B':
+ case 'b':
+ bEncodingB = true;
+ break;
+
+ case 'Q':
+ case 'q':
+ bEncodingB = false;
+ break;
+
+ default:
+ bEncodedWord = false;
+ break;
+ }
+
+ bEncodedWord = bEncodedWord && q != pEnd && *q++ == '?';
+
+ ByteString sText;
+ if (bEncodedWord)
+ if (bEncodingB)
+ for (bool bDone = false; !bDone;)
+ {
+ if (pEnd - q < 4)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ }
+ else
+ {
+ bool bFinal = false;
+ int nCount = 3;
+ sal_uInt32 nValue = 0;
+ for (int nShift = 18; nShift >= 0; nShift -= 6)
+ {
+ int nWeight = getBase64Weight(*q++);
+ if (nWeight == -2)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ break;
+ }
+ if (nWeight == -1)
+ {
+ if (!bFinal)
+ {
+ if (nShift >= 12)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ break;
+ }
+ bFinal = true;
+ nCount = nShift == 6 ? 2 : 1;
+ }
+ }
+ else
+ nValue |= nWeight << nShift;
+ }
+ if (bEncodedWord)
+ {
+ for (int nShift = 16; nCount-- > 0;
+ nShift -= 8)
+ sText += sal_Char(nValue >> nShift
+ & 0xFF);
+ if (*q == '?')
+ {
+ ++q;
+ bDone = true;
+ }
+ if (bFinal && !bDone)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ const sal_Char * pEncodedTextBegin = q;
+ const sal_Char * pEncodedTextCopyBegin = q;
+ for (bool bDone = false; !bDone;)
+ if (q == pEnd)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ }
+ else
+ {
+ sal_uInt32 nChar = *q++;
+ switch (nChar)
+ {
+ case '=':
+ {
+ if (pEnd - q < 2)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ break;
+ }
+ int nDigit1 = getHexWeight(q[0]);
+ int nDigit2 = getHexWeight(q[1]);
+ if (nDigit1 < 0 || nDigit2 < 0)
+ {
+ bEncodedWord = false;
+ bDone = true;
+ break;
+ }
+ sText
+ += rBody.
+ Copy(
+ pEncodedTextCopyBegin
+ - pBegin,
+ q - 1
+ - pEncodedTextCopyBegin);
+ sText += sal_Char(nDigit1 << 4 | nDigit2);
+ q += 2;
+ pEncodedTextCopyBegin = q;
+ break;
+ }
+
+ case '?':
+ if (q - pEncodedTextBegin > 1)
+ sText
+ += rBody.
+ Copy(
+ pEncodedTextCopyBegin
+ - pBegin,
+ q - 1
+ - pEncodedTextCopyBegin);
+ else
+ bEncodedWord = false;
+ bDone = true;
+ break;
+
+ case '_':
+ sText
+ += rBody.
+ Copy(
+ pEncodedTextCopyBegin
+ - pBegin,
+ q - 1
+ - pEncodedTextCopyBegin);
+ sText += ' ';
+ pEncodedTextCopyBegin = q;
+ break;
+
+ default:
+ if (!isVisible(nChar))
+ {
+ bEncodedWord = false;
+ bDone = true;
+ }
+ break;
+ }
+ }
+ }
+
+ bEncodedWord = bEncodedWord && q != pEnd && *q++ == '=';
+
+// if (bEncodedWord && q != pEnd)
+// switch (*q)
+// {
+// case '\t':
+// case ' ':
+// case '"':
+// case ')':
+// case ',':
+// case '.':
+// case '=':
+// break;
+//
+// default:
+// bEncodedWord = false;
+// break;
+// }
+
+ sal_Unicode * pUnicodeBuffer;
+ sal_Size nUnicodeSize;
+ if (bEncodedWord)
+ {
+ pUnicodeBuffer
+ = convertToUnicode(sText.GetBuffer(),
+ sText.GetBuffer() + sText.Len(),
+ eCharsetEncoding, nUnicodeSize);
+ if (pUnicodeBuffer == 0)
+ bEncodedWord = false;
+ }
+
+ if (bEncodedWord)
+ {
+ appendISO88591(sDecoded, pCopyBegin, pWSPBegin);
+ if (eType == HEADER_FIELD_TEXT)
+ sDecoded.Append(pUnicodeBuffer, nUnicodeSize);
+ else if (nCommentLevel == 0)
+ {
+ sEncodedText.Append(pUnicodeBuffer, nUnicodeSize);
+ if (!bQuotedEncodedText)
+ {
+ const sal_Unicode * pTextPtr = pUnicodeBuffer;
+ const sal_Unicode * pTextEnd = pTextPtr
+ + nUnicodeSize;
+ for (; pTextPtr != pTextEnd; ++pTextPtr)
+ if (!isEncodedWordTokenChar(*pTextPtr))
+ {
+ bQuotedEncodedText = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ const sal_Unicode * pTextPtr = pUnicodeBuffer;
+ const sal_Unicode * pTextEnd = pTextPtr + nUnicodeSize;
+ for (; pTextPtr != pTextEnd; ++pTextPtr)
+ {
+ switch (*pTextPtr)
+ {
+ case '(':
+ case ')':
+ case '\\':
+ case '\x0D':
+ case '=':
+ sDecoded += '\\';
+ break;
+ }
+ sDecoded += *pTextPtr;
+ }
+ }
+ delete[] pUnicodeBuffer;
+ p = q;
+ pCopyBegin = p;
+
+ pWSPBegin = p;
+ while (p != pEnd && isWhiteSpace(*p))
+ ++p;
+ /* bStartEncodedWord = p != pWSPBegin; */
+ continue;
+ }
+ }
+
+ if (sEncodedText.Len() != 0)
+ {
+ if (bQuotedEncodedText)
+ {
+ sDecoded += '"';
+ const sal_Unicode * pTextPtr = sEncodedText.GetBuffer();
+ const sal_Unicode * pTextEnd = pTextPtr + sEncodedText.Len();
+ for (;pTextPtr != pTextEnd; ++pTextPtr)
+ {
+ switch (*pTextPtr)
+ {
+ case '"':
+ case '\\':
+ case '\x0D':
+ sDecoded += '\\';
+ break;
+ }
+ sDecoded += *pTextPtr;
+ }
+ sDecoded += '"';
+ }
+ else
+ sDecoded += sEncodedText;
+ sEncodedText.Erase();
+ bQuotedEncodedText = false;
+ }
+
+ if (p == pEnd)
+ break;
+
+ switch (*p++)
+ {
+// case '\t':
+// case ' ':
+// case ',':
+// case '.':
+// case '=':
+// bStartEncodedWord = true;
+// break;
+
+ case '"':
+ if (eType != HEADER_FIELD_TEXT && nCommentLevel == 0)
+ {
+ const sal_Char * pQuotedStringEnd
+ = skipQuotedString(p - 1, pEnd);
+ p = pQuotedStringEnd == p - 1 ? pEnd : pQuotedStringEnd;
+ }
+ /* bStartEncodedWord = true; */
+ break;
+
+ case '(':
+ if (eType != HEADER_FIELD_TEXT)
+ ++nCommentLevel;
+ /* bStartEncodedWord = true; */
+ break;
+
+ case ')':
+ if (nCommentLevel > 0)
+ --nCommentLevel;
+ /* bStartEncodedWord = false; */
+ break;
+
+ default:
+ {
+ const sal_Char * pUTF8Begin = p - 1;
+ const sal_Char * pUTF8End = pUTF8Begin;
+ sal_uInt32 nCharacter;
+ if (translateUTF8Char(pUTF8End, pEnd, RTL_TEXTENCODING_UCS4,
+ nCharacter))
+ {
+ appendISO88591(sDecoded, pCopyBegin, p - 1);
+ sal_Unicode aUTF16Buf[2];
+ xub_StrLen nUTF16Len = putUTF32Character(aUTF16Buf,
+ nCharacter)
+ - aUTF16Buf;
+ sDecoded.Append(aUTF16Buf, nUTF16Len);
+ p = pUTF8End;
+ pCopyBegin = p;
+ }
+ /* bStartEncodedWord = false; */
+ break;
+ }
+ }
+ pWSPBegin = p;
+ }
+
+ appendISO88591(sDecoded, pCopyBegin, pEnd);
+ return sDecoded;
+}
+
+//============================================================================
+//
+// INetMIMEOutputSink
+//
+//============================================================================
+
+// virtual
+sal_Size INetMIMEOutputSink::writeSequence(const sal_Char * pSequence)
+{
+ sal_Size nLength = rtl_str_getLength(pSequence);
+ writeSequence(pSequence, pSequence + nLength);
+ return nLength;
+}
+
+//============================================================================
+// virtual
+void INetMIMEOutputSink::writeSequence(const sal_uInt32 * pBegin,
+ const sal_uInt32 * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIMEOutputSink::writeSequence(): Bad sequence");
+
+ sal_Char * pBufferBegin = new sal_Char[pEnd - pBegin];
+ sal_Char * pBufferEnd = pBufferBegin;
+ while (pBegin != pEnd)
+ {
+ DBG_ASSERT(*pBegin < 256,
+ "INetMIMEOutputSink::writeSequence(): Bad octet");
+ *pBufferEnd++ = sal_Char(*pBegin++);
+ }
+ writeSequence(pBufferBegin, pBufferEnd);
+ delete[] pBufferBegin;
+}
+
+//============================================================================
+// virtual
+void INetMIMEOutputSink::writeSequence(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIMEOutputSink::writeSequence(): Bad sequence");
+
+ sal_Char * pBufferBegin = new sal_Char[pEnd - pBegin];
+ sal_Char * pBufferEnd = pBufferBegin;
+ while (pBegin != pEnd)
+ {
+ DBG_ASSERT(*pBegin < 256,
+ "INetMIMEOutputSink::writeSequence(): Bad octet");
+ *pBufferEnd++ = sal_Char(*pBegin++);
+ }
+ writeSequence(pBufferBegin, pBufferEnd);
+ delete[] pBufferBegin;
+}
+
+//============================================================================
+// virtual
+ErrCode INetMIMEOutputSink::getError() const
+{
+ return ERRCODE_NONE;
+}
+
+//============================================================================
+void INetMIMEOutputSink::writeLineEnd()
+{
+ static const sal_Char aCRLF[2] = { 0x0D, 0x0A };
+ writeSequence(aCRLF, aCRLF + 2);
+ m_nColumn = 0;
+}
+
+//============================================================================
+//
+// INetMIMEStringOutputSink
+//
+//============================================================================
+
+// virtual
+void INetMIMEStringOutputSink::writeSequence(const sal_Char * pBegin,
+ const sal_Char * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIMEStringOutputSink::writeSequence(): Bad sequence");
+
+ m_bOverflow = m_bOverflow
+ || pEnd - pBegin > STRING_MAXLEN - m_aBuffer.Len();
+ if (!m_bOverflow)
+ m_aBuffer.Append(pBegin, pEnd - pBegin);
+}
+
+//============================================================================
+// virtual
+ErrCode INetMIMEStringOutputSink::getError() const
+{
+ return m_bOverflow ? ERRCODE_IO_OUTOFMEMORY : ERRCODE_NONE;
+}
+
+//============================================================================
+//
+// INetMIMEUnicodeOutputSink
+//
+//============================================================================
+
+// virtual
+void INetMIMEUnicodeOutputSink::writeSequence(const sal_Char * pBegin,
+ const sal_Char * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIMEUnicodeOutputSink::writeSequence(): Bad sequence");
+
+ sal_Unicode * pBufferBegin = new sal_Unicode[pEnd - pBegin];
+ sal_Unicode * pBufferEnd = pBufferBegin;
+ while (pBegin != pEnd)
+ *pBufferEnd++ = sal_uChar(*pBegin++);
+ writeSequence(pBufferBegin, pBufferEnd);
+ delete[] pBufferBegin;
+}
+
+//============================================================================
+// virtual
+void INetMIMEUnicodeOutputSink::writeSequence(const sal_uInt32 * pBegin,
+ const sal_uInt32 * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIMEUnicodeOutputSink::writeSequence(): Bad sequence");
+
+ sal_Unicode * pBufferBegin = new sal_Unicode[pEnd - pBegin];
+ sal_Unicode * pBufferEnd = pBufferBegin;
+ while (pBegin != pEnd)
+ {
+ DBG_ASSERT(*pBegin < 256,
+ "INetMIMEOutputSink::writeSequence(): Bad octet");
+ *pBufferEnd++ = sal_Unicode(*pBegin++);
+ }
+ writeSequence(pBufferBegin, pBufferEnd);
+ delete[] pBufferBegin;
+}
+
+//============================================================================
+// virtual
+void INetMIMEUnicodeOutputSink::writeSequence(const sal_Unicode * pBegin,
+ const sal_Unicode * pEnd)
+{
+ DBG_ASSERT(pBegin && pBegin <= pEnd,
+ "INetMIMEUnicodeOutputSink::writeSequence(): Bad sequence");
+
+ m_bOverflow = m_bOverflow
+ || pEnd - pBegin > STRING_MAXLEN - m_aBuffer.Len();
+ if (!m_bOverflow)
+ m_aBuffer.Append(pBegin, pEnd - pBegin);
+}
+
+//============================================================================
+// virtual
+ErrCode INetMIMEUnicodeOutputSink::getError() const
+{
+ return m_bOverflow ? ERRCODE_IO_OUTOFMEMORY : ERRCODE_NONE;
+}
+
+//============================================================================
+//
+// INetMIMEEncodedWordOutputSink
+//
+//============================================================================
+
+static const sal_Char aEscape[128]
+ = { INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x00
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x01
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x02
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x03
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x04
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x05
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x06
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x07
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x08
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x09
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x0A
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x0B
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x0C
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x0D
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x0E
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x0F
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x10
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x11
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x12
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x13
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x14
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x15
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x16
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x17
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x18
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x19
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x1A
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x1B
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x1C
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x1D
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x1E
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // 0x1F
+ 0, // ' '
+ 0, // '!'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '"'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '#'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '$'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '%'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '&'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '''
+ INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '('
+ INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // ')'
+ 0, // '*'
+ 0, // '+'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // ','
+ 0, // '-'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '.'
+ 0, // '/'
+ 0, // '0'
+ 0, // '1'
+ 0, // '2'
+ 0, // '3'
+ 0, // '4'
+ 0, // '5'
+ 0, // '6'
+ 0, // '7'
+ 0, // '8'
+ 0, // '9'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // ':'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // ';'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '<'
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '='
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '>'
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '?'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '@'
+ 0, // 'A'
+ 0, // 'B'
+ 0, // 'C'
+ 0, // 'D'
+ 0, // 'E'
+ 0, // 'F'
+ 0, // 'G'
+ 0, // 'H'
+ 0, // 'I'
+ 0, // 'J'
+ 0, // 'K'
+ 0, // 'L'
+ 0, // 'M'
+ 0, // 'N'
+ 0, // 'O'
+ 0, // 'P'
+ 0, // 'Q'
+ 0, // 'R'
+ 0, // 'S'
+ 0, // 'T'
+ 0, // 'U'
+ 0, // 'V'
+ 0, // 'W'
+ 0, // 'X'
+ 0, // 'Y'
+ 0, // 'Z'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '['
+ INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '\'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // ']'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '^'
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '_'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '`'
+ 0, // 'a'
+ 0, // 'b'
+ 0, // 'c'
+ 0, // 'd'
+ 0, // 'e'
+ 0, // 'f'
+ 0, // 'g'
+ 0, // 'h'
+ 0, // 'i'
+ 0, // 'j'
+ 0, // 'k'
+ 0, // 'l'
+ 0, // 'm'
+ 0, // 'n'
+ 0, // 'o'
+ 0, // 'p'
+ 0, // 'q'
+ 0, // 'r'
+ 0, // 's'
+ 0, // 't'
+ 0, // 'u'
+ 0, // 'v'
+ 0, // 'w'
+ 0, // 'x'
+ 0, // 'y'
+ 0, // 'z'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '{'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '|'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '}'
+ INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE, // '~'
+ INetMIMEEncodedWordOutputSink::CONTEXT_TEXT | INetMIMEEncodedWordOutputSink::CONTEXT_COMMENT | INetMIMEEncodedWordOutputSink::CONTEXT_PHRASE }; // DEL
+
+inline bool
+INetMIMEEncodedWordOutputSink::needsEncodedWordEscape(sal_uInt32 nChar) const
+{
+ return !INetMIME::isUSASCII(nChar) || aEscape[nChar] & m_eContext;
+}
+
+//============================================================================
+void INetMIMEEncodedWordOutputSink::finish(bool bWriteTrailer)
+{
+ if (m_eInitialSpace == SPACE_ALWAYS && m_nExtraSpaces == 0)
+ m_nExtraSpaces = 1;
+
+ if (m_eEncodedWordState == STATE_SECOND_EQUALS)
+ {
+ // If the text is already an encoded word, copy it verbatim:
+ sal_uInt32 nSize = m_pBufferEnd - m_pBuffer;
+ switch (m_ePrevCoding)
+ {
+ case CODING_QUOTED:
+ m_rSink << '"';
+ case CODING_NONE:
+ if (m_eInitialSpace == SPACE_ENCODED && m_nExtraSpaces == 0)
+ m_nExtraSpaces = 1;
+ for (; m_nExtraSpaces > 1; --m_nExtraSpaces)
+ {
+ if (m_rSink.getColumn() >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ if (m_nExtraSpaces == 1)
+ {
+ if (m_rSink.getColumn() + nSize
+ >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ break;
+
+ case CODING_ENCODED:
+ {
+ const sal_Char * pCharsetName
+ = INetMIME::getCharsetName(m_ePrevMIMEEncoding);
+ while (m_nExtraSpaces-- > 0)
+ {
+ if (m_rSink.getColumn()
+ > m_rSink.getLineLengthLimit() - 3)
+ m_rSink << "?=" << INetMIMEOutputSink::endl << " =?"
+ << pCharsetName << "?Q?";
+ m_rSink << '_';
+ }
+ m_rSink << "?=";
+ }
+ case CODING_ENCODED_TERMINATED:
+ if (m_rSink.getColumn() + nSize
+ > m_rSink.getLineLengthLimit() - 1)
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ break;
+ }
+ m_rSink.write(m_pBuffer, m_pBufferEnd);
+ m_eCoding = CODING_ENCODED_TERMINATED;
+ }
+ else
+ {
+ // If the text itself is too long to fit into a single line, make it
+ // into multiple encoded words:
+ switch (m_eCoding)
+ {
+ case CODING_NONE:
+ if (m_nExtraSpaces == 0)
+ {
+ DBG_ASSERT(m_ePrevCoding == CODING_NONE
+ || m_pBuffer == m_pBufferEnd,
+ "INetMIMEEncodedWordOutputSink::finish():"
+ " Bad state");
+ if (m_rSink.getColumn() + (m_pBufferEnd - m_pBuffer)
+ > m_rSink.getLineLengthLimit())
+ m_eCoding = CODING_ENCODED;
+ }
+ else if (m_pBufferEnd - m_pBuffer
+ > m_rSink.getLineLengthLimit() - 1)
+ m_eCoding = CODING_ENCODED;
+ break;
+
+ case CODING_QUOTED:
+ if (m_nExtraSpaces == 0)
+ {
+ DBG_ASSERT(m_ePrevCoding == CODING_NONE,
+ "INetMIMEEncodedWordOutputSink::finish():"
+ " Bad state");
+ if (m_rSink.getColumn() + (m_pBufferEnd - m_pBuffer)
+ + m_nQuotedEscaped
+ > m_rSink.getLineLengthLimit() - 2)
+ m_eCoding = CODING_ENCODED;
+ }
+ else if ((m_pBufferEnd - m_pBuffer) + m_nQuotedEscaped
+ > m_rSink.getLineLengthLimit() - 3)
+ m_eCoding = CODING_ENCODED;
+ break;
+ }
+
+ switch (m_eCoding)
+ {
+ case CODING_NONE:
+ switch (m_ePrevCoding)
+ {
+ case CODING_QUOTED:
+ if (m_rSink.getColumn() + m_nExtraSpaces
+ + (m_pBufferEnd - m_pBuffer)
+ < m_rSink.getLineLengthLimit())
+ m_eCoding = CODING_QUOTED;
+ else
+ m_rSink << '"';
+ break;
+
+ case CODING_ENCODED:
+ m_rSink << "?=";
+ break;
+ }
+ for (; m_nExtraSpaces > 1; --m_nExtraSpaces)
+ {
+ if (m_rSink.getColumn() >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ if (m_nExtraSpaces == 1)
+ {
+ if (m_rSink.getColumn() + (m_pBufferEnd - m_pBuffer)
+ >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ m_rSink.write(m_pBuffer, m_pBufferEnd);
+ if (m_eCoding == CODING_QUOTED && bWriteTrailer)
+ {
+ m_rSink << '"';
+ m_eCoding = CODING_NONE;
+ }
+ break;
+
+ case CODING_QUOTED:
+ {
+ bool bInsertLeadingQuote = true;
+ sal_uInt32 nSize = (m_pBufferEnd - m_pBuffer)
+ + m_nQuotedEscaped + 2;
+ switch (m_ePrevCoding)
+ {
+ case CODING_QUOTED:
+ if (m_rSink.getColumn() + m_nExtraSpaces + nSize - 1
+ < m_rSink.getLineLengthLimit())
+ {
+ bInsertLeadingQuote = false;
+ --nSize;
+ }
+ else
+ m_rSink << '"';
+ break;
+
+ case CODING_ENCODED:
+ m_rSink << "?=";
+ break;
+ }
+ for (; m_nExtraSpaces > 1; --m_nExtraSpaces)
+ {
+ if (m_rSink.getColumn() >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ if (m_nExtraSpaces == 1)
+ {
+ if (m_rSink.getColumn() + nSize
+ >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ if (bInsertLeadingQuote)
+ m_rSink << '"';
+ for (const sal_Unicode * p = m_pBuffer; p != m_pBufferEnd;
+ ++p)
+ {
+ if (INetMIME::needsQuotedStringEscape(*p))
+ m_rSink << '\\';
+ m_rSink << sal_Char(*p);
+ }
+ if (bWriteTrailer)
+ {
+ m_rSink << '"';
+ m_eCoding = CODING_NONE;
+ }
+ break;
+ }
+
+ case CODING_ENCODED:
+ {
+ rtl_TextEncoding eCharsetEncoding
+ = m_pEncodingList->
+ getPreferredEncoding(RTL_TEXTENCODING_UTF8);
+ rtl_TextEncoding eMIMEEncoding
+ = INetMIME::translateToMIME(eCharsetEncoding);
+
+ // The non UTF-8 code will only work for stateless single byte
+ // character encodings (see also below):
+ sal_Char * pTargetBuffer;
+ sal_Size nTargetSize;
+ sal_uInt32 nSize;
+ if (eMIMEEncoding == RTL_TEXTENCODING_UTF8)
+ {
+ nSize = 0;
+ for (sal_Unicode const * p = m_pBuffer;
+ p != m_pBufferEnd;)
+ {
+ sal_uInt32 nUTF32
+ = INetMIME::getUTF32Character(p, m_pBufferEnd);
+ nSize += needsEncodedWordEscape(nUTF32) ?
+ 3 * INetMIME::getUTF8OctetCount(nUTF32) :
+ 1;
+ // only US-ASCII characters (that are converted to
+ // a single byte by UTF-8) need no encoded word
+ // escapes...
+ }
+ }
+ else
+ {
+ rtl_UnicodeToTextConverter hConverter
+ = rtl_createUnicodeToTextConverter(eCharsetEncoding);
+ rtl_UnicodeToTextContext hContext
+ = rtl_createUnicodeToTextContext(hConverter);
+ for (sal_Size nBufferSize = m_pBufferEnd - m_pBuffer;;
+ nBufferSize += nBufferSize / 3 + 1)
+ {
+ pTargetBuffer = new sal_Char[nBufferSize];
+ sal_uInt32 nInfo;
+ sal_Size nSrcCvtBytes;
+ nTargetSize
+ = rtl_convertUnicodeToText(
+ hConverter, hContext, m_pBuffer,
+ m_pBufferEnd - m_pBuffer, pTargetBuffer,
+ nBufferSize,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE
+ | RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE,
+ &nInfo, &nSrcCvtBytes);
+ if (!(nInfo
+ & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL))
+ break;
+ delete[] pTargetBuffer;
+ rtl_resetUnicodeToTextContext(hConverter, hContext);
+ }
+ rtl_destroyUnicodeToTextContext(hConverter, hContext);
+ rtl_destroyUnicodeToTextConverter(hConverter);
+
+ nSize = nTargetSize;
+ for (sal_Size k = 0; k < nTargetSize; ++k)
+ if (needsEncodedWordEscape(sal_uChar(
+ pTargetBuffer[k])))
+ nSize += 2;
+ }
+
+ const sal_Char * pCharsetName
+ = INetMIME::getCharsetName(eMIMEEncoding);
+ sal_uInt32 nWrapperSize = rtl_str_getLength(pCharsetName) + 7;
+ // '=?', '?Q?', '?='
+
+ switch (m_ePrevCoding)
+ {
+ case CODING_QUOTED:
+ m_rSink << '"';
+ case CODING_NONE:
+ if (m_eInitialSpace == SPACE_ENCODED
+ && m_nExtraSpaces == 0)
+ m_nExtraSpaces = 1;
+ nSize += nWrapperSize;
+ for (; m_nExtraSpaces > 1; --m_nExtraSpaces)
+ {
+ if (m_rSink.getColumn()
+ >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ if (m_nExtraSpaces == 1)
+ {
+ if (m_rSink.getColumn() + nSize
+ >= m_rSink.getLineLengthLimit())
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << ' ';
+ }
+ m_rSink << "=?" << pCharsetName << "?Q?";
+ break;
+
+ case CODING_ENCODED:
+ if (m_ePrevMIMEEncoding != eMIMEEncoding
+ || m_rSink.getColumn() + m_nExtraSpaces + nSize
+ > m_rSink.getLineLengthLimit() - 2)
+ {
+ m_rSink << "?=";
+ if (m_rSink.getColumn() + nWrapperSize
+ + m_nExtraSpaces + nSize
+ > m_rSink.getLineLengthLimit() - 1)
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << " =?" << pCharsetName << "?Q?";
+ }
+ while (m_nExtraSpaces-- > 0)
+ {
+ if (m_rSink.getColumn()
+ > m_rSink.getLineLengthLimit() - 3)
+ m_rSink << "?=" << INetMIMEOutputSink::endl
+ << " =?" << pCharsetName << "?Q?";
+ m_rSink << '_';
+ }
+ break;
+
+ case CODING_ENCODED_TERMINATED:
+ if (m_rSink.getColumn() + nWrapperSize
+ + m_nExtraSpaces + nSize
+ > m_rSink.getLineLengthLimit() - 1)
+ m_rSink << INetMIMEOutputSink::endl;
+ m_rSink << " =?" << pCharsetName << "?Q?";
+ while (m_nExtraSpaces-- > 0)
+ {
+ if (m_rSink.getColumn()
+ > m_rSink.getLineLengthLimit() - 3)
+ m_rSink << "?=" << INetMIMEOutputSink::endl
+ << " =?" << pCharsetName << "?Q?";
+ m_rSink << '_';
+ }
+ break;
+ }
+
+ // The non UTF-8 code will only work for stateless single byte
+ // character encodings (see also above):
+ if (eMIMEEncoding == RTL_TEXTENCODING_UTF8)
+ {
+ bool bInitial = true;
+ for (sal_Unicode const * p = m_pBuffer;
+ p != m_pBufferEnd;)
+ {
+ sal_uInt32 nUTF32
+ = INetMIME::getUTF32Character(p, m_pBufferEnd);
+ bool bEscape = needsEncodedWordEscape(nUTF32);
+ sal_uInt32 nWidth
+ = bEscape ?
+ 3 * INetMIME::getUTF8OctetCount(nUTF32) : 1;
+ // only US-ASCII characters (that are converted to
+ // a single byte by UTF-8) need no encoded word
+ // escapes...
+ if (!bInitial
+ && m_rSink.getColumn() + nWidth + 2
+ > m_rSink.getLineLengthLimit())
+ m_rSink << "?=" << INetMIMEOutputSink::endl
+ << " =?" << pCharsetName << "?Q?";
+ if (bEscape)
+ {
+ DBG_ASSERT(
+ nUTF32 < 0x10FFFF,
+ "INetMIMEEncodedWordOutputSink::finish():"
+ " Bad char");
+ if (nUTF32 < 0x80)
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32);
+ else if (nUTF32 < 0x800)
+ {
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 >> 6
+ | 0xC0);
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 & 0x3F
+ | 0x80);
+ }
+ else if (nUTF32 < 0x10000)
+ {
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 >> 12
+ | 0xE0);
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 >> 6
+ & 0x3F
+ | 0x80);
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 & 0x3F
+ | 0x80);
+ }
+ else
+ {
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 >> 18
+ | 0xF0);
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 >> 12
+ & 0x3F
+ | 0x80);
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 >> 6
+ & 0x3F
+ | 0x80);
+ INetMIME::writeEscapeSequence(m_rSink,
+ nUTF32 & 0x3F
+ | 0x80);
+ }
+ }
+ else
+ m_rSink << sal_Char(nUTF32);
+ bInitial = false;
+ }
+ }
+ else
+ {
+ for (sal_Size k = 0; k < nTargetSize; ++k)
+ {
+ sal_uInt32 nUCS4 = sal_uChar(pTargetBuffer[k]);
+ bool bEscape = needsEncodedWordEscape(nUCS4);
+ if (k > 0
+ && m_rSink.getColumn() + (bEscape ? 5 : 3)
+ > m_rSink.getLineLengthLimit())
+ m_rSink << "?=" << INetMIMEOutputSink::endl
+ << " =?" << pCharsetName << "?Q?";
+ if (bEscape)
+ INetMIME::writeEscapeSequence(m_rSink, nUCS4);
+ else
+ m_rSink << sal_Char(nUCS4);
+ }
+ delete[] pTargetBuffer;
+ }
+
+ if (bWriteTrailer)
+ {
+ m_rSink << "?=";
+ m_eCoding = CODING_ENCODED_TERMINATED;
+ }
+
+ m_ePrevMIMEEncoding = eMIMEEncoding;
+ break;
+ }
+ }
+ }
+
+ m_eInitialSpace = SPACE_NO;
+ m_nExtraSpaces = 0;
+ m_pEncodingList->reset();
+ m_pBufferEnd = m_pBuffer;
+ m_ePrevCoding = m_eCoding;
+ m_eCoding = CODING_NONE;
+ m_nQuotedEscaped = 0;
+ m_eEncodedWordState = STATE_INITIAL;
+}
+
+//============================================================================
+INetMIMEEncodedWordOutputSink::~INetMIMEEncodedWordOutputSink()
+{
+ rtl_freeMemory(m_pBuffer);
+ delete m_pEncodingList;
+}
+
+//============================================================================
+INetMIMEEncodedWordOutputSink &
+INetMIMEEncodedWordOutputSink::operator <<(sal_uInt32 nChar)
+{
+ if (nChar == ' ')
+ {
+ if (m_pBufferEnd != m_pBuffer)
+ finish(false);
+ ++m_nExtraSpaces;
+ }
+ else
+ {
+ // Check for an already encoded word:
+ switch (m_eEncodedWordState)
+ {
+ case STATE_INITIAL:
+ if (nChar == '=')
+ m_eEncodedWordState = STATE_FIRST_EQUALS;
+ else
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_FIRST_EQUALS:
+ if (nChar == '?')
+ m_eEncodedWordState = STATE_FIRST_EQUALS;
+ else
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_FIRST_QUESTION:
+ if (INetMIME::isEncodedWordTokenChar(nChar))
+ m_eEncodedWordState = STATE_CHARSET;
+ else
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_CHARSET:
+ if (nChar == '?')
+ m_eEncodedWordState = STATE_SECOND_QUESTION;
+ else if (!INetMIME::isEncodedWordTokenChar(nChar))
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_SECOND_QUESTION:
+ if (nChar == 'B' || nChar == 'Q'
+ || nChar == 'b' || nChar == 'q')
+ m_eEncodedWordState = STATE_ENCODING;
+ else
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_ENCODING:
+ if (nChar == '?')
+ m_eEncodedWordState = STATE_THIRD_QUESTION;
+ else
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_THIRD_QUESTION:
+ if (INetMIME::isVisible(nChar) && nChar != '?')
+ m_eEncodedWordState = STATE_ENCODED_TEXT;
+ else
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_ENCODED_TEXT:
+ if (nChar == '?')
+ m_eEncodedWordState = STATE_FOURTH_QUESTION;
+ else if (!INetMIME::isVisible(nChar))
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_FOURTH_QUESTION:
+ if (nChar == '=')
+ m_eEncodedWordState = STATE_SECOND_EQUALS;
+ else
+ m_eEncodedWordState = STATE_BAD;
+ break;
+
+ case STATE_SECOND_EQUALS:
+ m_eEncodedWordState = STATE_BAD;
+ break;
+ }
+
+ // Update encoding:
+ m_pEncodingList->includes(nChar);
+
+ // Update coding:
+ enum { TENQ = 1, // CONTEXT_TEXT, CODING_ENCODED
+ CENQ = 2, // CONTEXT_COMMENT, CODING_ENCODED
+ PQTD = 4, // CONTEXT_PHRASE, CODING_QUOTED
+ PENQ = 8 }; // CONTEXT_PHRASE, CODING_ENCODED
+ static const sal_Char aMinimal[128]
+ = { TENQ | CENQ | PENQ, // 0x00
+ TENQ | CENQ | PENQ, // 0x01
+ TENQ | CENQ | PENQ, // 0x02
+ TENQ | CENQ | PENQ, // 0x03
+ TENQ | CENQ | PENQ, // 0x04
+ TENQ | CENQ | PENQ, // 0x05
+ TENQ | CENQ | PENQ, // 0x06
+ TENQ | CENQ | PENQ, // 0x07
+ TENQ | CENQ | PENQ, // 0x08
+ TENQ | CENQ | PENQ, // 0x09
+ TENQ | CENQ | PENQ, // 0x0A
+ TENQ | CENQ | PENQ, // 0x0B
+ TENQ | CENQ | PENQ, // 0x0C
+ TENQ | CENQ | PENQ, // 0x0D
+ TENQ | CENQ | PENQ, // 0x0E
+ TENQ | CENQ | PENQ, // 0x0F
+ TENQ | CENQ | PENQ, // 0x10
+ TENQ | CENQ | PENQ, // 0x11
+ TENQ | CENQ | PENQ, // 0x12
+ TENQ | CENQ | PENQ, // 0x13
+ TENQ | CENQ | PENQ, // 0x14
+ TENQ | CENQ | PENQ, // 0x15
+ TENQ | CENQ | PENQ, // 0x16
+ TENQ | CENQ | PENQ, // 0x17
+ TENQ | CENQ | PENQ, // 0x18
+ TENQ | CENQ | PENQ, // 0x19
+ TENQ | CENQ | PENQ, // 0x1A
+ TENQ | CENQ | PENQ, // 0x1B
+ TENQ | CENQ | PENQ, // 0x1C
+ TENQ | CENQ | PENQ, // 0x1D
+ TENQ | CENQ | PENQ, // 0x1E
+ TENQ | CENQ | PENQ, // 0x1F
+ 0, // ' '
+ 0, // '!'
+ PQTD , // '"'
+ 0, // '#'
+ 0, // '$'
+ 0, // '%'
+ 0, // '&'
+ 0, // '''
+ CENQ | PQTD , // '('
+ CENQ | PQTD , // ')'
+ 0, // '*'
+ 0, // '+'
+ PQTD , // ','
+ 0, // '-'
+ PQTD , // '.'
+ 0, // '/'
+ 0, // '0'
+ 0, // '1'
+ 0, // '2'
+ 0, // '3'
+ 0, // '4'
+ 0, // '5'
+ 0, // '6'
+ 0, // '7'
+ 0, // '8'
+ 0, // '9'
+ PQTD , // ':'
+ PQTD , // ';'
+ PQTD , // '<'
+ 0, // '='
+ PQTD , // '>'
+ 0, // '?'
+ PQTD , // '@'
+ 0, // 'A'
+ 0, // 'B'
+ 0, // 'C'
+ 0, // 'D'
+ 0, // 'E'
+ 0, // 'F'
+ 0, // 'G'
+ 0, // 'H'
+ 0, // 'I'
+ 0, // 'J'
+ 0, // 'K'
+ 0, // 'L'
+ 0, // 'M'
+ 0, // 'N'
+ 0, // 'O'
+ 0, // 'P'
+ 0, // 'Q'
+ 0, // 'R'
+ 0, // 'S'
+ 0, // 'T'
+ 0, // 'U'
+ 0, // 'V'
+ 0, // 'W'
+ 0, // 'X'
+ 0, // 'Y'
+ 0, // 'Z'
+ PQTD , // '['
+ CENQ | PQTD , // '\'
+ PQTD , // ']'
+ 0, // '^'
+ 0, // '_'
+ 0, // '`'
+ 0, // 'a'
+ 0, // 'b'
+ 0, // 'c'
+ 0, // 'd'
+ 0, // 'e'
+ 0, // 'f'
+ 0, // 'g'
+ 0, // 'h'
+ 0, // 'i'
+ 0, // 'j'
+ 0, // 'k'
+ 0, // 'l'
+ 0, // 'm'
+ 0, // 'n'
+ 0, // 'o'
+ 0, // 'p'
+ 0, // 'q'
+ 0, // 'r'
+ 0, // 's'
+ 0, // 't'
+ 0, // 'u'
+ 0, // 'v'
+ 0, // 'w'
+ 0, // 'x'
+ 0, // 'y'
+ 0, // 'z'
+ 0, // '{'
+ 0, // '|'
+ 0, // '}'
+ 0, // '~'
+ TENQ | CENQ | PENQ }; // DEL
+ Coding eNewCoding = !INetMIME::isUSASCII(nChar) ? CODING_ENCODED :
+ m_eContext == CONTEXT_PHRASE ?
+ Coding(aMinimal[nChar] >> 2) :
+ aMinimal[nChar] & m_eContext ? CODING_ENCODED :
+ CODING_NONE;
+ if (eNewCoding > m_eCoding)
+ m_eCoding = eNewCoding;
+ if (m_eCoding == CODING_QUOTED
+ && INetMIME::needsQuotedStringEscape(nChar))
+ ++m_nQuotedEscaped;
+
+ // Append to buffer:
+ if (sal_uInt32(m_pBufferEnd - m_pBuffer) == m_nBufferSize)
+ {
+ m_pBuffer
+ = static_cast< sal_Unicode * >(
+ rtl_reallocateMemory(m_pBuffer,
+ (m_nBufferSize + BUFFER_SIZE)
+ * sizeof (sal_Unicode)));
+ m_pBufferEnd = m_pBuffer + m_nBufferSize;
+ m_nBufferSize += BUFFER_SIZE;
+ }
+ *m_pBufferEnd++ = sal_Unicode(nChar);
+ }
+ return *this;
+}
+
+//============================================================================
+//
+// INetContentTypeParameterList
+//
+//============================================================================
+
+void INetContentTypeParameterList::Clear()
+{
+ while (Count() > 0)
+ delete static_cast< INetContentTypeParameter * >(Remove(Count() - 1));
+}
+
+//============================================================================
+const INetContentTypeParameter *
+INetContentTypeParameterList::find(const ByteString & rAttribute) const
+{
+ for (ULONG i = 0; i < Count(); ++i)
+ {
+ const INetContentTypeParameter * pParameter = GetObject(i);
+ if (pParameter->m_sAttribute.EqualsIgnoreCaseAscii(rAttribute))
+ return pParameter;
+ }
+ return 0;
+}
+
diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx
new file mode 100644
index 000000000000..d34513f62b6c
--- /dev/null
+++ b/tools/source/inet/inetmsg.cxx
@@ -0,0 +1,2945 @@
+/*************************************************************************
+ *
+ * $RCSfile: inetmsg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _RTL_CHAR_H_
+#include <rtl/char.h>
+#endif
+
+#ifndef _DATETIME_HXX
+#include <datetime.hxx>
+#endif
+#ifndef _TOOLS_INETMIME_HXX
+#include <inetmime.hxx>
+#endif
+#ifndef _TOOLS_INETMSG_HXX
+#include <inetmsg.hxx>
+#endif
+#ifndef _TOOLS_INETSTRM_HXX
+#include <inetstrm.hxx>
+#endif
+
+#include <stdio.h>
+
+/*=======================================================================
+ *
+ * INetMessage Implementation.
+ *
+ *=====================================================================*/
+#define CONSTASCII_STRINGPARAM(a) (a), RTL_TEXTENCODING_ASCII_US
+#define HEADERFIELD INetMessageHeader
+
+/*
+ * ~INetMessage.
+ */
+INetMessage::~INetMessage (void)
+{
+ ListCleanup_Impl();
+}
+
+/*
+ * ListCleanup_Impl.
+ */
+void INetMessage::ListCleanup_Impl (void)
+{
+ // Cleanup.
+ ULONG i, n = m_aHeaderList.Count();
+ for (i = 0; i < n; i++)
+ delete ((HEADERFIELD*)(m_aHeaderList.GetObject(i)));
+ m_aHeaderList.Clear();
+}
+
+/*
+ * ListCopy.
+ */
+void INetMessage::ListCopy (const INetMessage &rMsg)
+{
+ if (!(this == &rMsg))
+ {
+ // Cleanup.
+ ListCleanup_Impl();
+
+ // Copy.
+ ULONG i, n = rMsg.GetHeaderCount();
+ for (i = 0; i < n; i++)
+ {
+ HEADERFIELD *p = (HEADERFIELD*)(rMsg.m_aHeaderList.GetObject(i));
+ m_aHeaderList.Insert (new HEADERFIELD(*p), LIST_APPEND);
+ }
+ }
+}
+
+/*
+ * SetHeaderField_Impl.
+ */
+void INetMessage::SetHeaderField_Impl (
+ INetMIME::HeaderFieldType eType,
+ const ByteString &rName,
+ const UniString &rValue,
+ ULONG &rnIndex)
+{
+ INetMIMEStringOutputSink aSink (0, STRING_MAXLEN);
+ INetMIME::writeHeaderFieldBody (
+ aSink, eType, rValue, gsl_getSystemTextEncoding(), false);
+ SetHeaderField_Impl (
+ INetMessageHeader (rName, aSink.takeBuffer()), rnIndex);
+}
+
+/*
+ * SetHeaderField.
+ */
+ULONG INetMessage::SetHeaderField (
+ const UniString& rName, const UniString& rValue, ULONG nIndex)
+{
+ ULONG nResult = nIndex;
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ ByteString (rName, RTL_TEXTENCODING_ASCII_US), rValue,
+ nResult);
+ return nResult;
+}
+
+/*
+ * SetHeaderField.
+ */
+ULONG INetMessage::SetHeaderField (
+ const INetMessageHeader &rHeader, ULONG nIndex)
+{
+ ULONG nResult = nIndex;
+ SetHeaderField_Impl (rHeader, nResult);
+ return nResult;
+}
+
+
+/*
+ * operator<<
+ */
+SvStream& INetMessage::operator<< (SvStream& rStrm) const
+{
+ rStrm << m_nDocSize;
+ rStrm.WriteByteString (m_aDocName, RTL_TEXTENCODING_UTF8);
+
+ ULONG i, n = m_aHeaderList.Count();
+ rStrm << n;
+
+ for (i = 0; i < n; i++)
+ rStrm << *((HEADERFIELD *)(m_aHeaderList.GetObject(i)));
+
+ return rStrm;
+}
+
+/*
+ * operator>>
+ */
+SvStream& INetMessage::operator>> (SvStream& rStrm)
+{
+ // Cleanup.
+ m_nDocSize = 0;
+ m_xDocLB.Clear();
+ ListCleanup_Impl();
+
+ // Copy.
+ rStrm >> m_nDocSize;
+ rStrm.ReadByteString (m_aDocName, RTL_TEXTENCODING_UTF8);
+
+ ULONG i, n = 0;
+ rStrm >> n;
+
+ for (i = 0; i < n; i++)
+ {
+ HEADERFIELD *p = new HEADERFIELD();
+ rStrm >> *p;
+ m_aHeaderList.Insert (p, LIST_APPEND);
+ }
+
+ // Done.
+ return rStrm;
+}
+
+/*=======================================================================
+ *
+ * INetMessageHeaderIterator Implementation.
+ *
+ *=====================================================================*/
+INetMessageHeaderIterator::INetMessageHeaderIterator (
+ const INetMessage& rMsg, const UniString& rHdrName)
+{
+ ULONG i, n = rMsg.GetHeaderCount();
+ for (i = 0; i < n; i++)
+ {
+ if (rHdrName.CompareIgnoreCaseToAscii (rMsg.GetHeaderName(i)) == 0)
+ {
+ UniString *pValue = new UniString (rMsg.GetHeaderValue(i));
+ aValueList.Insert (pValue, LIST_APPEND);
+ }
+ }
+ nValueCount = aValueList.Count();
+}
+
+INetMessageHeaderIterator::~INetMessageHeaderIterator (void)
+{
+ ULONG i, n = aValueList.Count();
+ for (i = 0; i < n; i++)
+ delete ((UniString*)(aValueList.GetObject(i)));
+ aValueList.Clear();
+}
+
+/*=======================================================================
+ *
+ * INetRFC822Message Implementation.
+ *
+ *=====================================================================*/
+/*
+ * _ImplINetRFC822MessageHeaderData.
+ */
+static const ByteString _ImplINetRFC822MessageHeaderData[] =
+{
+ ByteString ("BCC"),
+ ByteString ("CC"),
+ ByteString ("Comments"),
+ ByteString ("Date"),
+ ByteString ("From"),
+ ByteString ("In-Reply-To"),
+ ByteString ("Keywords"),
+ ByteString ("Message-ID"),
+ ByteString ("References"),
+ ByteString ("Reply-To"),
+ ByteString ("Return-Path"),
+ ByteString ("Subject"),
+ ByteString ("Sender"),
+ ByteString ("To"),
+ ByteString ("X-Mailer"),
+ ByteString ("Return-Receipt-To")
+};
+
+#define HDR(n) _ImplINetRFC822MessageHeaderData[(n)]
+
+/*
+ * _ImplINetRFC822MessageHeaderState.
+ */
+enum _ImplINetRFC822MessageHeaderState
+{
+ INETMSG_RFC822_BEGIN,
+ INETMSG_RFC822_CHECK,
+ INETMSG_RFC822_OK,
+ INETMSG_RFC822_JUNK,
+
+ INETMSG_RFC822_TOKEN_RE,
+ INETMSG_RFC822_TOKEN_RETURNMINUS,
+ INETMSG_RFC822_TOKEN_XMINUS,
+ INETMSG_RFC822_LETTER_C,
+ INETMSG_RFC822_LETTER_S
+};
+
+/*
+ * INetRFC822Message.
+ */
+INetRFC822Message::INetRFC822Message (void)
+ : INetMessage()
+{
+ for (USHORT i = 0; i < INETMSG_RFC822_NUMHDR; i++)
+ m_nIndex[i] = LIST_ENTRY_NOTFOUND;
+}
+
+INetRFC822Message::INetRFC822Message (const INetRFC822Message& rMsg)
+ : INetMessage (rMsg)
+{
+ for (USHORT i = 0; i < INETMSG_RFC822_NUMHDR; i++)
+ m_nIndex[i] = rMsg.m_nIndex[i];
+}
+
+/*
+ * operator=
+ */
+INetRFC822Message& INetRFC822Message::operator= (const INetRFC822Message& rMsg)
+{
+ if (this != &rMsg)
+ {
+ INetMessage::operator= (rMsg);
+
+ for (USHORT i = 0; i < INETMSG_RFC822_NUMHDR; i++)
+ m_nIndex[i] = rMsg.m_nIndex[i];
+ }
+ return *this;
+}
+
+/*
+ * ~INetRFC822Message.
+ */
+INetRFC822Message::~INetRFC822Message (void)
+{
+}
+
+/*
+ * <Generate|Parse>DateField and local helper functions.
+ *
+ * GenerateDateField.
+ * Generates a String from Date and Time objects in format:
+ * Wkd, 00 Mon 0000 00:00:00 [GMT] (rfc822, rfc1123)
+ *
+ * ParseDateField.
+ * Parses a String in (implied) GMT format into class Date and Time objects.
+ * Four formats are accepted:
+ *
+ * [Wkd,] 1*2DIGIT Mon 2*4DIGIT 00:00:00 [GMT] (rfc1123)
+ * [Wkd,] 00 Mon 0000 00:00:00 [GMT]) (rfc822, rfc1123)
+ * Weekday, 00-Mon-00 00:00:00 [GMT] (rfc850, rfc1036)
+ * Wkd Mon 00 00:00:00 0000 [GMT] (ctime)
+ * 1*DIGIT (delta seconds)
+ *
+ */
+
+// Months and Weekdays.
+static const sal_Char *months[12] =
+{
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
+static const sal_Char *wkdays[7] =
+{
+ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"
+};
+
+/*
+ * GenerateDateField.
+ */
+BOOL INetRFC822Message::GenerateDateField (
+ const DateTime& rDateTime, UniString& rDateFieldW)
+{
+ // Check arguments.
+ if (!rDateTime.IsValid() ||
+ (rDateTime.GetSec() > 59) ||
+ (rDateTime.GetMin() > 59) ||
+ (rDateTime.GetHour() > 23) ) return FALSE;
+
+ // Prepare output string.
+ ByteString rDateField;
+
+ // Insert Date.
+ rDateField += wkdays[(USHORT)(rDateTime.GetDayOfWeek())];
+ rDateField += ", ";
+
+ USHORT nNum = rDateTime.GetDay();
+ if (nNum < 10) rDateField += '0';
+ rDateField += nNum;
+ rDateField += ' ';
+
+ rDateField += months[(USHORT)(rDateTime.GetMonth() - 1)];
+ rDateField += ' ';
+
+ rDateField += rDateTime.GetYear();
+ rDateField += ' ';
+
+ // Insert Time.
+ nNum = rDateTime.GetHour();
+ if (nNum < 10) rDateField += '0';
+ rDateField += nNum;
+ rDateField += ':';
+
+ nNum = rDateTime.GetMin();
+ if (nNum < 10) rDateField += '0';
+ rDateField += nNum;
+ rDateField += ':';
+
+ nNum = rDateTime.GetSec();
+ if (nNum < 10) rDateField += '0';
+ rDateField += nNum;
+ rDateField += " GMT";
+
+ // Done.
+ rDateFieldW = UniString (rDateField, RTL_TEXTENCODING_ASCII_US);
+ return TRUE;
+}
+
+/*
+ * ParseDateField and local helper functions.
+ */
+static USHORT ParseNumber (const ByteString& rStr, USHORT& nIndex)
+{
+ USHORT n = nIndex;
+ while ((n < rStr.Len()) && rtl_char_isDigit(rStr.GetChar(n))) n++;
+
+ ByteString aNum (rStr.Copy (nIndex, (n - nIndex)));
+ nIndex = n;
+
+ return (USHORT)(aNum.ToInt32());
+}
+
+static USHORT ParseMonth (const ByteString& rStr, USHORT& nIndex)
+{
+ USHORT n = nIndex;
+ while ((n < rStr.Len()) && rtl_char_isLetter(rStr.GetChar(n))) n++;
+
+ ByteString aMonth (rStr.Copy (nIndex, 3));
+ nIndex = n;
+
+ USHORT i;
+ for (i = 0; i < 12; i++)
+ if (aMonth.CompareIgnoreCaseToAscii (months[i]) == 0) break;
+ return (i + 1);
+}
+
+BOOL INetRFC822Message::ParseDateField (
+ const UniString& rDateFieldW, DateTime& rDateTime)
+{
+ ByteString rDateField (rDateFieldW, RTL_TEXTENCODING_ASCII_US);
+ if (rDateField.Len() == 0) return FALSE;
+
+ if (rDateField.Search (':') != STRING_NOTFOUND)
+ {
+ // Some DateTime format.
+ USHORT nIndex = 0;
+
+ // Skip over <Wkd> or <Weekday>, leading and trailing space.
+ while ((nIndex < rDateField.Len()) &&
+ (rDateField.GetChar(nIndex) == ' '))
+ nIndex++;
+
+ while (
+ (nIndex < rDateField.Len()) &&
+ (rtl_char_isLetter (rDateField.GetChar(nIndex)) ||
+ (rDateField.GetChar(nIndex) == ',') ))
+ nIndex++;
+
+ while ((nIndex < rDateField.Len()) &&
+ (rDateField.GetChar(nIndex) == ' '))
+ nIndex++;
+
+ if (rtl_char_isLetter (rDateField.GetChar(nIndex)))
+ {
+ // Format: ctime().
+ if ((rDateField.Len() - nIndex) < 20) return FALSE;
+
+ rDateTime.SetMonth (ParseMonth (rDateField, nIndex)); nIndex++;
+ rDateTime.SetDay (ParseNumber (rDateField, nIndex)); nIndex++;
+
+ rDateTime.SetHour (ParseNumber (rDateField, nIndex)); nIndex++;
+ rDateTime.SetMin (ParseNumber (rDateField, nIndex)); nIndex++;
+ rDateTime.SetSec (ParseNumber (rDateField, nIndex)); nIndex++;
+ rDateTime.Set100Sec (0);
+
+ USHORT nYear = ParseNumber (rDateField, nIndex);
+ if (nYear < 100) nYear += 1900;
+ rDateTime.SetYear (nYear);
+ }
+ else
+ {
+ // Format: RFC1036 or RFC1123.
+ if ((rDateField.Len() - nIndex) < 17) return FALSE;
+
+ rDateTime.SetDay (ParseNumber (rDateField, nIndex)); nIndex++;
+ rDateTime.SetMonth (ParseMonth (rDateField, nIndex)); nIndex++;
+
+ USHORT nYear = ParseNumber (rDateField, nIndex); nIndex++;
+ if (nYear < 100) nYear += 1900;
+ rDateTime.SetYear (nYear);
+
+ rDateTime.SetHour (ParseNumber (rDateField, nIndex)); nIndex++;
+ rDateTime.SetMin (ParseNumber (rDateField, nIndex)); nIndex++;
+ rDateTime.SetSec (ParseNumber (rDateField, nIndex)); nIndex++;
+ rDateTime.Set100Sec (0);
+
+ if ((rDateField.GetChar(nIndex) == '+') ||
+ (rDateField.GetChar(nIndex) == '-') )
+ {
+ // Offset from GMT: "(+|-)HHMM".
+ BOOL bEast = (rDateField.GetChar(nIndex++) == '+');
+ USHORT nOffset = ParseNumber (rDateField, nIndex);
+ if (nOffset > 0)
+ {
+ Time aDiff;
+ aDiff.SetHour (nOffset / 100);
+ aDiff.SetMin (nOffset % 100);
+ aDiff.SetSec (0);
+ aDiff.Set100Sec (0);
+
+ if (bEast)
+ rDateTime -= aDiff;
+ else
+ rDateTime += aDiff;
+ }
+ }
+ }
+ }
+ else if (rDateField.IsNumericAscii())
+ {
+ // Format: delta seconds.
+ Time aDelta (0);
+ aDelta.SetTime (rDateField.ToInt32() * 100);
+
+ DateTime aNow;
+ aNow += aDelta;
+ aNow.ConvertToUTC();
+
+ rDateTime.SetDate (aNow.GetDate());
+ rDateTime.SetTime (aNow.GetTime());
+ }
+ else
+ {
+ // Junk.
+ return FALSE;
+ }
+
+ return (rDateTime.IsValid() &&
+ !((rDateTime.GetSec() > 59) ||
+ (rDateTime.GetMin() > 59) ||
+ (rDateTime.GetHour() > 23) ));
+}
+
+/*
+ * SetHeaderField.
+ * (Header Field Parser).
+ */
+ULONG INetRFC822Message::SetHeaderField (
+ const INetMessageHeader &rHeader, ULONG nNewIndex)
+{
+ ByteString aName (rHeader.GetName());
+ const sal_Char *pData = aName.GetBuffer();
+ const sal_Char *pStop = pData + aName.Len() + 1;
+ const sal_Char *check = "";
+
+ ULONG nIdx = LIST_APPEND;
+ int eState = INETMSG_RFC822_BEGIN;
+ int eOkState = INETMSG_RFC822_OK;
+
+ while (pData < pStop)
+ {
+ switch (eState)
+ {
+ case INETMSG_RFC822_BEGIN:
+ eState = INETMSG_RFC822_CHECK;
+ eOkState = INETMSG_RFC822_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'b':
+ check = "cc";
+ nIdx = INETMSG_RFC822_BCC;
+ break;
+
+ case 'c':
+ eState = INETMSG_RFC822_LETTER_C;
+ break;
+
+ case 'd':
+ check = "ate";
+ nIdx = INETMSG_RFC822_DATE;
+ break;
+
+ case 'f':
+ check = "rom";
+ nIdx = INETMSG_RFC822_FROM;
+ break;
+
+ case 'i':
+ check = "n-reply-to";
+ nIdx = INETMSG_RFC822_IN_REPLY_TO;
+ break;
+
+ case 'k':
+ check = "eywords";
+ nIdx = INETMSG_RFC822_KEYWORDS;
+ break;
+
+ case 'm':
+ check = "essage-id";
+ nIdx = INETMSG_RFC822_MESSAGE_ID;
+ break;
+
+ case 'r':
+ check = "e";
+ eOkState = INETMSG_RFC822_TOKEN_RE;
+ break;
+
+ case 's':
+ eState = INETMSG_RFC822_LETTER_S;
+ break;
+
+ case 't':
+ check = "o";
+ nIdx = INETMSG_RFC822_TO;
+ break;
+
+ case 'x':
+ check = "-";
+ eOkState = INETMSG_RFC822_TOKEN_XMINUS;
+ break;
+
+ default:
+ eState = INETMSG_RFC822_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_RFC822_TOKEN_RE:
+ eState = INETMSG_RFC822_CHECK;
+ eOkState = INETMSG_RFC822_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'f':
+ check = "erences";
+ nIdx = INETMSG_RFC822_REFERENCES;
+ break;
+
+ case 'p':
+ check = "ly-to";
+ nIdx = INETMSG_RFC822_REPLY_TO;
+ break;
+
+ case 't':
+ check = "urn-";
+ eOkState = INETMSG_RFC822_TOKEN_RETURNMINUS;
+ break;
+
+ default:
+ eState = INETMSG_RFC822_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_RFC822_TOKEN_RETURNMINUS:
+ eState = INETMSG_RFC822_CHECK;
+ eOkState = INETMSG_RFC822_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'p':
+ check = "ath";
+ nIdx = INETMSG_RFC822_RETURN_PATH;
+ break;
+
+ case 'r':
+ check = "eceipt-to";
+ nIdx = INETMSG_RFC822_RETURN_RECEIPT_TO;
+ break;
+
+ default:
+ eState = INETMSG_RFC822_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_RFC822_TOKEN_XMINUS:
+ eState = INETMSG_RFC822_CHECK;
+ eOkState = INETMSG_RFC822_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'm':
+ check = "ailer";
+ nIdx = INETMSG_RFC822_X_MAILER;
+ break;
+
+#if 0 /* NYI */
+ case 'p':
+ check = "riority";
+ eOkState = INETMSG_RFC822_X_PRIORITY;
+ break;
+#endif /* NYI */
+
+ default:
+ eState = INETMSG_RFC822_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_RFC822_LETTER_C:
+ eState = INETMSG_RFC822_CHECK;
+ eOkState = INETMSG_RFC822_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'c':
+ check = "";
+ nIdx = INETMSG_RFC822_CC;
+ break;
+
+ case 'o':
+ check = "mments";
+ nIdx = INETMSG_RFC822_COMMENTS;
+ break;
+
+ default:
+ eState = INETMSG_RFC822_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_RFC822_LETTER_S:
+ eState = INETMSG_RFC822_CHECK;
+ eOkState = INETMSG_RFC822_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'e':
+ check = "nder";
+ nIdx = INETMSG_RFC822_SENDER;
+ break;
+
+ case 'u':
+ check = "bject";
+ nIdx = INETMSG_RFC822_SUBJECT;
+ break;
+
+ default:
+ eState = INETMSG_RFC822_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_RFC822_CHECK:
+ if (*check)
+ {
+ while (*pData && *check &&
+ (rtl_char_toLowerCase (*pData) == *check))
+ {
+ pData++;
+ check++;
+ }
+ }
+ else
+ {
+ check = pData;
+ }
+ eState = (*check == '\0') ? eOkState : INETMSG_RFC822_JUNK;
+ break;
+
+ case INETMSG_RFC822_OK:
+ pData = pStop;
+ SetHeaderField_Impl (
+ HEADERFIELD (HDR(nIdx), rHeader.GetValue()),
+ m_nIndex[nIdx]);
+ nNewIndex = m_nIndex[nIdx];
+ break;
+
+ default: // INETMSG_RFC822_JUNK
+ pData = pStop;
+ nNewIndex = INetMessage::SetHeaderField (rHeader, nNewIndex);
+ break;
+ }
+ }
+ return nNewIndex;
+}
+
+/*
+ * Specific Set-Methods.
+ */
+void INetRFC822Message::SetBCC (const UniString& rBCC)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_BCC), rBCC,
+ m_nIndex[INETMSG_RFC822_BCC]);
+}
+
+void INetRFC822Message::SetCC (const UniString& rCC)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_CC), rCC,
+ m_nIndex[INETMSG_RFC822_CC]);
+}
+
+void INetRFC822Message::SetComments (const UniString& rComments)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HDR(INETMSG_RFC822_COMMENTS), rComments,
+ m_nIndex[INETMSG_RFC822_COMMENTS]);
+}
+
+void INetRFC822Message::SetDate (const UniString& rDate)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_STRUCTURED,
+ HDR(INETMSG_RFC822_DATE), rDate,
+ m_nIndex[INETMSG_RFC822_DATE]);
+}
+
+void INetRFC822Message::SetFrom (const UniString& rFrom)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_FROM), rFrom,
+ m_nIndex[INETMSG_RFC822_FROM]);
+}
+
+void INetRFC822Message::SetInReplyTo (const UniString& rInReplyTo)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS, // ??? MESSAGE_ID ???
+ HDR(INETMSG_RFC822_IN_REPLY_TO), rInReplyTo,
+ m_nIndex[INETMSG_RFC822_IN_REPLY_TO]);
+}
+
+void INetRFC822Message::SetKeywords (const UniString& rKeywords)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_PHRASE,
+ HDR(INETMSG_RFC822_KEYWORDS), rKeywords,
+ m_nIndex[INETMSG_RFC822_KEYWORDS]);
+}
+
+void INetRFC822Message::SetMessageID (const UniString& rMessageID)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_MESSAGE_ID,
+ HDR(INETMSG_RFC822_MESSAGE_ID), rMessageID,
+ m_nIndex[INETMSG_RFC822_MESSAGE_ID]);
+}
+
+void INetRFC822Message::SetReferences (const UniString& rReferences)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_MESSAGE_ID,
+ HDR(INETMSG_RFC822_REFERENCES), rReferences,
+ m_nIndex[INETMSG_RFC822_REFERENCES]);
+}
+
+void INetRFC822Message::SetReplyTo (const UniString& rReplyTo)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_REPLY_TO), rReplyTo,
+ m_nIndex[INETMSG_RFC822_REPLY_TO]);
+}
+
+void INetRFC822Message::SetReturnPath (const UniString& rReturnPath)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_RETURN_PATH), rReturnPath,
+ m_nIndex[INETMSG_RFC822_RETURN_PATH]);
+}
+
+void INetRFC822Message::SetReturnReceiptTo (const UniString& rValue)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_RETURN_RECEIPT_TO), rValue,
+ m_nIndex[INETMSG_RFC822_RETURN_RECEIPT_TO]);
+}
+
+void INetRFC822Message::SetSender (const UniString& rSender)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_SENDER), rSender,
+ m_nIndex[INETMSG_RFC822_SENDER]);
+}
+
+void INetRFC822Message::SetSubject (const UniString& rSubject)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HDR(INETMSG_RFC822_SUBJECT), rSubject,
+ m_nIndex[INETMSG_RFC822_SUBJECT]);
+}
+
+void INetRFC822Message::SetTo (const UniString& rTo)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_ADDRESS,
+ HDR(INETMSG_RFC822_TO), rTo,
+ m_nIndex[INETMSG_RFC822_TO]);
+}
+
+void INetRFC822Message::SetXMailer (const UniString& rXMailer)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HDR(INETMSG_RFC822_X_MAILER), rXMailer,
+ m_nIndex[INETMSG_RFC822_X_MAILER]);
+}
+
+/*
+ * operator<<
+ */
+SvStream& INetRFC822Message::operator<< (SvStream& rStrm) const
+{
+ INetMessage::operator<< (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_RFC822_NUMHDR; i++)
+ rStrm << m_nIndex[i];
+
+ return rStrm;
+}
+
+/*
+ * operator>>
+ */
+SvStream& INetRFC822Message::operator>> (SvStream& rStrm)
+{
+ INetMessage::operator>> (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_RFC822_NUMHDR; i++)
+ rStrm >> m_nIndex[i];
+
+ return rStrm;
+}
+
+/*=======================================================================
+ *
+ * INetMIMEMessage Implementation.
+ *
+ *=====================================================================*/
+/*
+ * _ImplINetMIMEMessageHeaderData.
+ */
+static const ByteString _ImplINetMIMEMessageHeaderData[] =
+{
+ ByteString ("MIME-Version"),
+ ByteString ("Content-Description"),
+ ByteString ("Content-Disposition"),
+ ByteString ("Content-ID"),
+ ByteString ("Content-Type"),
+ ByteString ("Content-Transfer-Encoding")
+};
+
+#define MIMEHDR(n) _ImplINetMIMEMessageHeaderData[(n)]
+
+/*
+ * _ImplINetMIMEMessageHeaderState.
+ */
+enum _ImplINetMIMEMessageHeaderState
+{
+ INETMSG_MIME_BEGIN,
+ INETMSG_MIME_CHECK,
+ INETMSG_MIME_OK,
+ INETMSG_MIME_JUNK,
+
+ INETMSG_MIME_TOKEN_CONTENT,
+ INETMSG_MIME_TOKEN_CONTENT_D,
+ INETMSG_MIME_TOKEN_CONTENT_T
+};
+
+/*
+ * INetMIMEMessage.
+ */
+INetMIMEMessage::INetMIMEMessage (void)
+ : INetRFC822Message (),
+ nNumChildren (0),
+ pParent (NULL),
+ bHeaderParsed (FALSE)
+{
+ for (USHORT i = 0; i < INETMSG_MIME_NUMHDR; i++)
+ m_nIndex[i] = LIST_ENTRY_NOTFOUND;
+}
+
+INetMIMEMessage::INetMIMEMessage (const INetMIMEMessage& rMsg)
+ : INetRFC822Message (rMsg)
+{
+ // Copy.
+ CopyImp (rMsg);
+}
+
+/*
+ * operator=
+ */
+INetMIMEMessage& INetMIMEMessage::operator= (
+ const INetMIMEMessage& rMsg)
+{
+ if (this != &rMsg)
+ {
+ // Assign base.
+ INetRFC822Message::operator= (rMsg);
+
+ // Cleanup.
+ CleanupImp();
+
+ // Copy.
+ CopyImp (rMsg);
+ }
+ return *this;
+}
+
+/*
+ * ~INetMIMEMessage.
+ */
+INetMIMEMessage::~INetMIMEMessage (void)
+{
+ // Cleanup.
+ CleanupImp();
+}
+
+/*
+ * CleanupImp.
+ */
+void INetMIMEMessage::CleanupImp (void)
+{
+ INetMIMEMessage *pChild = NULL;
+ while ((pChild = (INetMIMEMessage *)(aChildren.Remove())) != NULL)
+ if (pChild->pParent == this) delete pChild;
+}
+
+/*
+ * CopyImp.
+ */
+void INetMIMEMessage::CopyImp (const INetMIMEMessage& rMsg)
+{
+ bHeaderParsed = rMsg.bHeaderParsed;
+
+ USHORT i;
+ for (i = 0; i < INETMSG_MIME_NUMHDR; i++)
+ m_nIndex[i] = rMsg.m_nIndex[i];
+
+ m_aBoundary = rMsg.m_aBoundary;
+ nNumChildren = rMsg.nNumChildren;
+
+ for (i = 0; i < rMsg.aChildren.Count(); i++)
+ {
+ INetMIMEMessage *pChild =
+ (INetMIMEMessage *)(rMsg.aChildren.GetObject (i));
+
+ if (pChild->pParent == &rMsg)
+ {
+ pChild = pChild->CreateMessage (*pChild);
+ pChild->pParent = this;
+ }
+ aChildren.Insert (pChild, LIST_APPEND);
+ }
+}
+
+/*
+ * CreateMessage.
+ */
+INetMIMEMessage *INetMIMEMessage::CreateMessage (
+ const INetMIMEMessage& rMsg) const
+{
+ return (new INetMIMEMessage (rMsg));
+}
+
+/*
+ * SetHeaderField.
+ * (Header Field Parser).
+ */
+ULONG INetMIMEMessage::SetHeaderField (
+ const INetMessageHeader &rHeader, ULONG nNewIndex)
+{
+ ByteString aName (rHeader.GetName());
+ const sal_Char *pData = aName.GetBuffer();
+ const sal_Char *pStop = pData + aName.Len() + 1;
+ const sal_Char *check = "";
+
+ ULONG nIdx = LIST_APPEND;
+ int eState = INETMSG_MIME_BEGIN;
+ int eOkState = INETMSG_MIME_OK;
+
+ while (pData < pStop)
+ {
+ switch (eState)
+ {
+ case INETMSG_MIME_BEGIN:
+ eState = INETMSG_MIME_CHECK;
+ eOkState = INETMSG_MIME_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'c':
+ check = "ontent-";
+ eOkState = INETMSG_MIME_TOKEN_CONTENT;
+ break;
+
+ case 'm':
+ check = "ime-version";
+ nIdx = INETMSG_MIME_VERSION;
+ break;
+
+ default:
+ eState = INETMSG_MIME_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_MIME_TOKEN_CONTENT:
+ eState = INETMSG_MIME_CHECK;
+ eOkState = INETMSG_MIME_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'd':
+ eState = INETMSG_MIME_TOKEN_CONTENT_D;
+ break;
+
+ case 'i':
+ check = "d";
+ nIdx = INETMSG_MIME_CONTENT_ID;
+ break;
+
+ case 't':
+ eState = INETMSG_MIME_TOKEN_CONTENT_T;
+ break;
+
+ default:
+ eState = INETMSG_MIME_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_MIME_TOKEN_CONTENT_D:
+ eState = INETMSG_MIME_CHECK;
+ eOkState = INETMSG_MIME_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'e':
+ check = "scription";
+ nIdx = INETMSG_MIME_CONTENT_DESCRIPTION;
+ break;
+
+ case 'i':
+ check = "sposition";
+ nIdx = INETMSG_MIME_CONTENT_DISPOSITION;
+ break;
+
+ default:
+ eState = INETMSG_MIME_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_MIME_TOKEN_CONTENT_T:
+ eState = INETMSG_MIME_CHECK;
+ eOkState = INETMSG_MIME_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'r':
+ check = "ansfer-encoding";
+ nIdx = INETMSG_MIME_CONTENT_TRANSFER_ENCODING;
+ break;
+
+ case 'y':
+ check = "pe";
+ nIdx = INETMSG_MIME_CONTENT_TYPE;
+ break;
+
+ default:
+ eState = INETMSG_MIME_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_MIME_CHECK:
+ if (*check)
+ {
+ while (*pData && *check &&
+ (rtl_char_toLowerCase (*pData) == *check))
+ {
+ pData++;
+ check++;
+ }
+ }
+ else
+ {
+ check = pData;
+ }
+ eState = (*check == '\0') ? eOkState : INETMSG_MIME_JUNK;
+ break;
+
+ case INETMSG_MIME_OK:
+ pData = pStop;
+ SetHeaderField_Impl (
+ HEADERFIELD (MIMEHDR(nIdx), rHeader.GetValue()),
+ m_nIndex[nIdx]);
+ nNewIndex = m_nIndex[nIdx];
+ break;
+
+ default: // INETMSG_MIME_JUNK
+ pData = pStop;
+ nNewIndex = INetRFC822Message::SetHeaderField (
+ rHeader, nNewIndex);
+ break;
+ }
+ }
+ return nNewIndex;
+}
+
+/*
+ * Specific Set-Methods.
+ */
+void INetMIMEMessage::SetMIMEVersion (const UniString& rVersion)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ MIMEHDR(INETMSG_MIME_VERSION), rVersion,
+ m_nIndex[INETMSG_MIME_VERSION]);
+}
+
+void INetMIMEMessage::SetContentDescription (const String& rDescription)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ MIMEHDR(INETMSG_MIME_CONTENT_DESCRIPTION), rDescription,
+ m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]);
+}
+
+void INetMIMEMessage::SetContentDisposition (const String& rDisposition)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ MIMEHDR(INETMSG_MIME_CONTENT_DISPOSITION), rDisposition,
+ m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]);
+}
+
+void INetMIMEMessage::SetContentID (const String& rID)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ MIMEHDR(INETMSG_MIME_CONTENT_ID), rID,
+ m_nIndex[INETMSG_MIME_CONTENT_ID]);
+}
+
+void INetMIMEMessage::SetContentType (const String& rType)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ MIMEHDR(INETMSG_MIME_CONTENT_TYPE), rType,
+ m_nIndex[INETMSG_MIME_CONTENT_TYPE]);
+}
+
+void INetMIMEMessage::SetContentTransferEncoding (
+ const String& rEncoding)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ MIMEHDR(INETMSG_MIME_CONTENT_TRANSFER_ENCODING), rEncoding,
+ m_nIndex[INETMSG_MIME_CONTENT_TRANSFER_ENCODING]);
+}
+
+/*
+ * GetDefaultContentType.
+ */
+void INetMIMEMessage::GetDefaultContentType (String& rContentType)
+{
+ String aDefaultCT (
+ "text/plain; charset=us-ascii", RTL_TEXTENCODING_ASCII_US);
+ if (pParent == NULL)
+ {
+ rContentType = aDefaultCT;
+ }
+ else
+ {
+ String aParentCT (pParent->GetContentType());
+ if (aParentCT.Len() == 0)
+ pParent->GetDefaultContentType (aParentCT);
+
+ if (aParentCT.CompareIgnoreCaseToAscii ("message/", 8) == 0)
+ {
+ rContentType = aDefaultCT;
+ }
+ else if (aParentCT.CompareIgnoreCaseToAscii ("multipart/", 10) == 0)
+ {
+ if (aParentCT.CompareIgnoreCaseToAscii ("multipart/digest") == 0)
+ rContentType.AssignAscii ("message/rfc822");
+ else
+ rContentType = aDefaultCT;
+ }
+ else
+ {
+ rContentType = aDefaultCT;
+ }
+ }
+}
+
+/*
+ * EnableAttachChild.
+ */
+BOOL INetMIMEMessage::EnableAttachChild (INetMessageContainerType eType)
+{
+ // Check context.
+ if (IsContainer())
+ return FALSE;
+
+ // Setup Content-Type header field.
+ ByteString aContentType;
+ switch (eType)
+ {
+ case INETMSG_MESSAGE_RFC822:
+ aContentType = "message/rfc822";
+ break;
+
+ case INETMSG_MULTIPART_ALTERNATIVE:
+ aContentType = "multipart/alternative";
+ break;
+
+ case INETMSG_MULTIPART_DIGEST:
+ aContentType = "multipart/digest";
+ break;
+
+ case INETMSG_MULTIPART_PARALLEL:
+ aContentType = "multipart/parallel";
+ break;
+
+ case INETMSG_MULTIPART_RELATED:
+ aContentType = "multipart/related";
+ break;
+
+ case INETMSG_MULTIPART_FORM_DATA:
+ aContentType = "multipart/form-data";
+ break;
+
+ default:
+ aContentType = "multipart/mixed";
+ break;
+ }
+
+ // Setup boundary for multipart types.
+ if (aContentType.CompareIgnoreCaseToAscii ("multipart/", 10) == 0)
+ {
+ // Generate a unique boundary from current time.
+ sal_Char sTail[16 + 1];
+ Time aCurTime;
+ sprintf (sTail, "%08X%08X", aCurTime.GetTime(), (ULONG)this);
+ m_aBoundary = "------------_4D48";
+ m_aBoundary += sTail;
+
+ // Append boundary as ContentType parameter.
+ aContentType += "; boundary=";
+ aContentType += m_aBoundary;
+ }
+
+ // Set header fields.
+ SetMIMEVersion (String (CONSTASCII_STRINGPARAM("1.0")));
+ SetContentType (String (aContentType, RTL_TEXTENCODING_ASCII_US));
+ SetContentTransferEncoding (String (CONSTASCII_STRINGPARAM("7bit")));
+
+ // Done.
+ return TRUE;
+}
+
+/*
+ * AttachChild.
+ */
+BOOL INetMIMEMessage::AttachChild (
+ INetMIMEMessage& rChildMsg, BOOL bOwner)
+{
+ if (IsContainer() /*&& rChildMsg.GetContentType().Len() */)
+ {
+ if (bOwner) rChildMsg.pParent = this;
+ aChildren.Insert (&rChildMsg, LIST_APPEND);
+ nNumChildren = aChildren.Count();
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*
+ * DetachChild.
+ */
+BOOL INetMIMEMessage::DetachChild (
+ ULONG nIndex, INetMIMEMessage& rChildMsg) const
+{
+ if (IsContainer())
+ {
+ // Check document stream.
+ if (GetDocumentLB() == NULL) return FALSE;
+ SvStream *pDocStrm = new SvStream (GetDocumentLB());
+
+ // Initialize message buffer.
+ char pMsgBuffer[1024];
+ char *pMsgRead, *pMsgWrite;
+ pMsgRead = pMsgWrite = pMsgBuffer;
+
+ // Initialize message parser stream.
+ INetMIMEMessageStream *pMsgStrm = NULL;
+
+ // Check for "multipart/uvw" or "message/xyz".
+ if (IsMultipart())
+ {
+ // Multipart message body. Initialize multipart delimiters.
+ ByteString aDelim ("--");
+ aDelim += GetMultipartBoundary();
+ ByteString aClose = aDelim;
+ aClose += "--";
+
+ // Initialize line buffer.
+ SvMemoryStream aLineBuf;
+
+ // Initialize control variables.
+ INetMessageStreamState eState = INETMSG_EOL_SCR;
+ int nCurIndex = -1;
+
+ // Go!
+ while (nCurIndex < (int)(nIndex + 1))
+ {
+ if ((pMsgRead - pMsgWrite) > 0)
+ {
+ // Bytes still in buffer.
+ if (eState == INETMSG_EOL_FCR)
+ {
+ // Check for 2nd line break character.
+ if ((*pMsgWrite == '\r') || (*pMsgWrite == '\n'))
+ aLineBuf << *pMsgWrite++;
+
+ // Check current index.
+ if (nCurIndex == (int)nIndex)
+ {
+ // Found requested part.
+ if (pMsgStrm == NULL)
+ {
+ // Create message parser stream.
+ pMsgStrm = new INetMIMEMessageStream;
+ pMsgStrm->SetTargetMessage (&rChildMsg);
+ }
+
+ // Put message down-stream.
+ int status = pMsgStrm->Write (
+ (const sal_Char *) aLineBuf.GetData(), aLineBuf.Tell());
+ if (status != INETSTREAM_STATUS_OK)
+ {
+ // Cleanup.
+ delete pDocStrm;
+ delete pMsgStrm;
+
+ // Finish.
+ return (!(status == INETSTREAM_STATUS_OK));
+ }
+ }
+
+ // Reset to <Begin-of-Line>.
+ aLineBuf.Seek (STREAM_SEEK_TO_BEGIN);
+ eState = INETMSG_EOL_SCR;
+ }
+ else if ((*pMsgWrite == '\r') || (*pMsgWrite == '\n'))
+ {
+ /*
+ * Found any line break character.
+ * Compare buffered line with part/close delimiter.
+ * Increment current part index upon match.
+ */
+ USHORT nLen = (USHORT)(aLineBuf.Tell() & 0xffff);
+ if (nLen == aDelim.Len())
+ {
+ if (aDelim.CompareTo ((const sal_Char *) aLineBuf.GetData(), nLen)
+ == COMPARE_EQUAL) nCurIndex++;
+ }
+ else if (nLen == aClose.Len())
+ {
+ if (aClose.CompareTo ((const sal_Char *) aLineBuf.GetData(), nLen)
+ == COMPARE_EQUAL) nCurIndex++;
+ }
+ aLineBuf << *pMsgWrite++;
+ eState = INETMSG_EOL_FCR;
+ }
+ else
+ {
+ // Insert into line buffer.
+ aLineBuf << *pMsgWrite;
+ }
+ }
+ else
+ {
+ // Buffer empty. Reset to <Begin-of-Buffer>.
+ pMsgRead = pMsgWrite = pMsgBuffer;
+
+ // Read document stream.
+ ULONG nRead = pDocStrm->Read (
+ pMsgBuffer, sizeof (pMsgBuffer));
+ if (nRead > 0)
+ {
+ // Set read pointer.
+ pMsgRead += nRead;
+ }
+ else
+ {
+ // Premature end.
+ if (pMsgStrm)
+ {
+ // Assume end of requested part.
+ nCurIndex++;
+ }
+ else
+ {
+ // Requested part not found.
+ delete pDocStrm;
+ return FALSE;
+ }
+ }
+ }
+ } // while (nCurIndex < (nIndex + 1))
+ }
+ else
+ {
+ // Encapsulated message body. Create message parser stream.
+ pMsgStrm = new INetMIMEMessageStream;
+ pMsgStrm->SetTargetMessage (&rChildMsg);
+
+ // Initialize control variables.
+ INetMessageStreamState eState = INETMSG_EOL_BEGIN;
+
+ // Go.
+ while (eState == INETMSG_EOL_BEGIN)
+ {
+ if ((pMsgRead - pMsgWrite) > 0)
+ {
+ // Bytes still in buffer. Put message down-stream.
+ int status = pMsgStrm->Write (
+ pMsgBuffer, (pMsgRead - pMsgWrite), NULL);
+ if (status != INETSTREAM_STATUS_OK)
+ {
+ // Cleanup.
+ delete pDocStrm;
+ delete pMsgStrm;
+
+ // Finish.
+ return (!(status == INETSTREAM_STATUS_ERROR));
+ }
+ pMsgWrite = pMsgBuffer + (pMsgRead - pMsgWrite);
+ }
+ else
+ {
+ // Buffer empty. Reset to <Begin-of-Buffer>.
+ pMsgRead = pMsgWrite = pMsgBuffer;
+
+ // Read document stream.
+ ULONG nRead = pDocStrm->Read (
+ pMsgBuffer, sizeof (pMsgBuffer));
+ if (nRead > 0)
+ {
+ // Set read pointer.
+ pMsgRead += nRead;
+ }
+ else
+ {
+ // Mark we're done.
+ eState = INETMSG_EOL_DONE;
+ }
+ }
+ } // while (eState == INETMSG_EOL_BEGIN)
+ }
+
+ // Done.
+ if (pDocStrm) delete pDocStrm;
+ if (pMsgStrm) delete pMsgStrm;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*
+ * operator<<
+ */
+SvStream& INetMIMEMessage::operator<< (SvStream& rStrm) const
+{
+ INetRFC822Message::operator<< (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_MIME_NUMHDR; i++)
+ rStrm << m_nIndex[i];
+
+#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS
+ rStrm << m_aBoundary;
+#else
+ rStrm.WriteByteString (m_aBoundary);
+#endif
+ rStrm << nNumChildren;
+
+ return rStrm;
+}
+
+/*
+ * operator>>
+ */
+SvStream& INetMIMEMessage::operator>> (SvStream& rStrm)
+{
+ INetRFC822Message::operator>> (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_MIME_NUMHDR; i++)
+ rStrm >> m_nIndex[i];
+
+#ifdef ENABLE_BYTESTRING_STREAM_OPERATORS
+ rStrm >> m_aBoundary;
+#else
+ rStrm.ReadByteString (m_aBoundary);
+#endif
+ rStrm >> nNumChildren;
+
+ return rStrm;
+}
+
+/*=======================================================================
+ *
+ * INetNewsMessage Implementation.
+ *
+ *=====================================================================*/
+/*
+ * _ImplINetNewsMessageHeaderData.
+ */
+static const ByteString _ImplINetNewsMessageHeaderData[] =
+{
+ ByteString ("Approved"),
+ ByteString ("Control"),
+ ByteString ("Distribution"),
+ ByteString ("Expires"),
+ ByteString ("Followup-To"),
+ ByteString ("Lines"),
+ ByteString ("Newsgroups"),
+ ByteString ("Organization"),
+ ByteString ("Path"),
+ ByteString ("Summary"),
+ ByteString ("Xref"),
+ ByteString ("X-Newsreader")
+};
+
+#define NEWSHDR(n) _ImplINetNewsMessageHeaderData[(n)]
+
+/*
+ * _ImplINetNewsMessageHeaderState.
+ */
+enum _ImplINetNewsMessageHeaderState
+{
+ INETMSG_NEWS_BEGIN,
+ INETMSG_NEWS_CHECK,
+ INETMSG_NEWS_OK,
+ INETMSG_NEWS_JUNK,
+
+ INETMSG_NEWS_LETTER_X
+};
+
+/*
+ * INetNewsMessage.
+ */
+INetNewsMessage::INetNewsMessage (void)
+ : INetMIMEMessage ()
+{
+ for (USHORT i = 0; i < INETMSG_NEWS_NUMHDR; i++)
+ m_nIndex[i] = LIST_ENTRY_NOTFOUND;
+}
+
+INetNewsMessage::INetNewsMessage (const INetNewsMessage& rMsg)
+ : INetMIMEMessage (rMsg)
+{
+ for (USHORT i = 0; i < INETMSG_NEWS_NUMHDR; i++)
+ m_nIndex[i] = rMsg.m_nIndex[i];
+}
+
+/*
+ * operator=
+ */
+INetNewsMessage& INetNewsMessage::operator= (const INetNewsMessage& rMsg)
+{
+ if (this != &rMsg)
+ {
+ // Assign base.
+ INetMIMEMessage::operator= (rMsg);
+
+ // Cleanup and copy.
+ for (USHORT i = 0; i < INETMSG_NEWS_NUMHDR; i++)
+ m_nIndex[i] = rMsg.m_nIndex[i];
+ }
+ return *this;
+}
+
+/*
+ * ~INetNewsMessage.
+ */
+INetNewsMessage::~INetNewsMessage (void)
+{
+}
+
+/*
+ * CreateMessage.
+ */
+INetNewsMessage *INetNewsMessage::CreateMessage (
+ const INetNewsMessage& rMsg) const
+{
+ return (new INetNewsMessage (rMsg));
+}
+
+/*
+ * SetHeaderField.
+ * (Header Field Parser).
+ */
+ULONG INetNewsMessage::SetHeaderField (
+ const INetMessageHeader &rHeader, ULONG nNewIndex)
+{
+ ByteString aName (rHeader.GetName());
+ const sal_Char *pData = aName.GetBuffer();
+ const sal_Char *pStop = pData + aName.Len() + 1;
+ const sal_Char *check = "";
+
+ ULONG nIdx = LIST_APPEND;
+ int eState = INETMSG_NEWS_BEGIN;
+ int eOkState = INETMSG_NEWS_OK;
+
+ while (pData < pStop)
+ {
+ switch (eState)
+ {
+ case INETMSG_NEWS_BEGIN:
+ eState = INETMSG_NEWS_CHECK;
+ eOkState = INETMSG_NEWS_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'a':
+ check = "pproved";
+ nIdx = INETMSG_NEWS_APPROVED;
+ break;
+
+ case 'c':
+ check = "ontrol";
+ nIdx = INETMSG_NEWS_CONTROL;
+ break;
+
+ case 'd':
+ check = "istribution";
+ nIdx = INETMSG_NEWS_DISTRIBUTION;
+ break;
+
+ case 'e':
+ check = "xpires";
+ nIdx = INETMSG_NEWS_EXPIRES;
+ break;
+
+ case 'f':
+ check = "ollowup-to";
+ nIdx = INETMSG_NEWS_FOLLOWUP_TO;
+ break;
+
+ case 'l':
+ check = "ines";
+ nIdx = INETMSG_NEWS_LINES;
+ break;
+
+ case 'n':
+ check = "ewsgroups";
+ nIdx = INETMSG_NEWS_NEWSGROUPS;
+ break;
+
+ case 'o':
+ check = "rganization";
+ nIdx = INETMSG_NEWS_ORGANIZATION;
+ break;
+
+ case 'p':
+ check = "ath";
+ nIdx = INETMSG_NEWS_PATH;
+ break;
+
+ case 's':
+ check = "ummary";
+ nIdx = INETMSG_NEWS_SUMMARY;
+ break;
+
+ case 'x':
+ eState = INETMSG_NEWS_LETTER_X;
+ break;
+
+ default:
+ eState = INETMSG_NEWS_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_NEWS_LETTER_X:
+ eState = INETMSG_NEWS_CHECK;
+ eOkState = INETMSG_NEWS_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'r':
+ check = "ef";
+ nIdx = INETMSG_NEWS_XREF;
+ break;
+
+ case '-':
+ check = "newsreader";
+ nIdx = INETMSG_NEWS_X_NEWSREADER;
+ break;
+
+ default:
+ eState = INETMSG_NEWS_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_NEWS_CHECK:
+ if (*check)
+ {
+ while (*pData && *check &&
+ (rtl_char_toLowerCase (*pData) == *check))
+ {
+ pData++;
+ check++;
+ }
+ }
+ else
+ {
+ check = pData;
+ }
+ eState = (*check == '\0') ? eOkState : INETMSG_NEWS_JUNK;
+ break;
+
+ case INETMSG_NEWS_OK:
+ pData = pStop;
+ SetHeaderField_Impl (
+ HEADERFIELD (NEWSHDR(nIdx), rHeader.GetValue()),
+ m_nIndex[nIdx]);
+ nNewIndex = m_nIndex[nIdx];
+ break;
+
+ default: // INETMSG_NEWS_JUNK
+ pData = pStop;
+ nNewIndex = INetMIMEMessage::SetHeaderField (
+ rHeader, nNewIndex);
+ break;
+ }
+ }
+ return nNewIndex;
+}
+
+/*
+ * Specific Set-Methods.
+ */
+void INetNewsMessage::SetApproved (const String& rApproved)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_APPROVED), rApproved,
+ m_nIndex[INETMSG_NEWS_APPROVED]);
+}
+
+void INetNewsMessage::SetControl (const String& rControl)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_CONTROL), rControl,
+ m_nIndex[INETMSG_NEWS_CONTROL]);
+}
+
+void INetNewsMessage::SetDistribution (const String& rDistribution)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_DISTRIBUTION), rDistribution,
+ m_nIndex[INETMSG_NEWS_DISTRIBUTION]);
+}
+
+void INetNewsMessage::SetExpires (const String& rExpires)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_EXPIRES), rExpires,
+ m_nIndex[INETMSG_NEWS_EXPIRES]);
+}
+
+void INetNewsMessage::SetFollowupTo (const String& rFollowupTo)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_FOLLOWUP_TO), rFollowupTo,
+ m_nIndex[INETMSG_NEWS_FOLLOWUP_TO]);
+}
+
+void INetNewsMessage::SetLines (const String& rLines)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_LINES), rLines,
+ m_nIndex[INETMSG_NEWS_LINES]);
+}
+
+void INetNewsMessage::SetNewsgroups (const String& rNewsgroups)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_NEWSGROUPS), rNewsgroups,
+ m_nIndex[INETMSG_NEWS_NEWSGROUPS]);
+}
+
+void INetNewsMessage::SetOrganization (const String& rOrganization)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_ORGANIZATION), rOrganization,
+ m_nIndex[INETMSG_NEWS_ORGANIZATION]);
+}
+
+void INetNewsMessage::SetPath (const String& rPath)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_PATH), rPath,
+ m_nIndex[INETMSG_NEWS_PATH]);
+}
+
+void INetNewsMessage::SetSummary (const String& rSummary)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_SUMMARY), rSummary,
+ m_nIndex[INETMSG_NEWS_SUMMARY]);
+}
+
+void INetNewsMessage::SetXref (const String& rXref)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_XREF), rXref,
+ m_nIndex[INETMSG_NEWS_XREF]);
+}
+
+void INetNewsMessage::SetXNewsreader (const String& rXNewsreader)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ NEWSHDR(INETMSG_NEWS_X_NEWSREADER), rXNewsreader,
+ m_nIndex[INETMSG_NEWS_X_NEWSREADER]);
+}
+
+/*
+ * operator<<
+ */
+SvStream& INetNewsMessage::operator<< (SvStream& rStrm) const
+{
+ INetMIMEMessage::operator<< (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_NEWS_NUMHDR; i++)
+ rStrm << m_nIndex[i];
+
+ return rStrm;
+}
+
+/*
+ * operator>>
+ */
+SvStream& INetNewsMessage::operator>> (SvStream& rStrm)
+{
+ INetMIMEMessage::operator>> (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_NEWS_NUMHDR; i++)
+ rStrm >> m_nIndex[i];
+
+ return rStrm;
+}
+
+/*=======================================================================
+ *
+ * INetHTTPMessage Implementation.
+ *
+ *=====================================================================*/
+/*
+ * _ImplINetHTTPMessageHeaderData.
+ */
+static const ByteString _ImplINetHTTPMessageHeaderData[] =
+{
+ ByteString ("Accept"),
+ ByteString ("Accept-Charset"),
+ ByteString ("Accept-Encoding"),
+ ByteString ("Accept-Language"),
+ ByteString ("Allow"),
+ ByteString ("Authorization"),
+ ByteString ("Cache-Control"),
+ ByteString ("Connection"),
+ ByteString ("Content-Encoding"),
+ ByteString ("Content-Language"),
+ ByteString ("Content-Length"),
+ ByteString ("Content-MD5"),
+ ByteString ("Content-Range"),
+ ByteString ("Content-Version"),
+ ByteString ("Cookie"),
+ ByteString ("Derived-From"),
+ ByteString ("Expires"),
+ ByteString ("Forwarded"),
+ ByteString ("Host"),
+ ByteString ("If-Modified-Since"),
+ ByteString ("Keep-Alive"),
+ ByteString ("Last-Modified"),
+ ByteString ("Link"),
+ ByteString ("Location"),
+ ByteString ("Proxy-Authenticate"),
+ ByteString ("Proxy-Authorization"),
+ ByteString ("Pragma"),
+ ByteString ("Public"),
+ ByteString ("Range"),
+ ByteString ("Referer"),
+ ByteString ("Retry-After"),
+ ByteString ("Server"),
+ ByteString ("Title"),
+ ByteString ("Transfer-Encoding"),
+ ByteString ("Unless"),
+ ByteString ("Upgrade"),
+ ByteString ("URI"),
+ ByteString ("User-Agent"),
+ ByteString ("WWW-Authenticate")
+};
+
+#define HTTPHDR(n) _ImplINetHTTPMessageHeaderData[(n)]
+
+/*
+ * _ImplINetHTTPMessageHeaderState.
+ */
+enum _ImplINetHTTPMessageHeaderState
+{
+ INETMSG_HTTP_BEGIN,
+ INETMSG_HTTP_CHECK,
+ INETMSG_HTTP_OK,
+ INETMSG_HTTP_JUNK,
+
+ INETMSG_HTTP_LETTER_A,
+ INETMSG_HTTP_LETTER_C,
+ INETMSG_HTTP_LETTER_L,
+ INETMSG_HTTP_LETTER_P,
+ INETMSG_HTTP_LETTER_R,
+ INETMSG_HTTP_LETTER_T,
+ INETMSG_HTTP_LETTER_U,
+ INETMSG_HTTP_TOKEN_CON,
+ INETMSG_HTTP_CONTENT,
+ INETMSG_HTTP_PROXY_AUTH
+};
+
+/*
+ * INetHTTPMessage.
+ */
+INetHTTPMessage::INetHTTPMessage (void)
+ : INetMIMEMessage ()
+{
+ for (USHORT i = 0; i < INETMSG_HTTP_NUMHDR; i++)
+ m_nIndex[i] = LIST_ENTRY_NOTFOUND;
+}
+
+INetHTTPMessage::INetHTTPMessage (const INetHTTPMessage& rMsg)
+ : INetMIMEMessage (rMsg)
+{
+ for (USHORT i = 0; i < INETMSG_HTTP_NUMHDR; i++)
+ m_nIndex[i] = rMsg.m_nIndex[i];
+}
+
+/*
+ * operator=
+ */
+INetHTTPMessage& INetHTTPMessage::operator= (const INetHTTPMessage& rMsg)
+{
+ if (this != &rMsg)
+ {
+ // Assign base.
+ INetMIMEMessage::operator= (rMsg);
+
+ // Cleanup and copy.
+ for (USHORT i = 0; i < INETMSG_HTTP_NUMHDR; i++)
+ m_nIndex[i] = rMsg.m_nIndex[i];
+ }
+ return *this;
+}
+
+/*
+ * ~INetHTTPMessage.
+ */
+INetHTTPMessage::~INetHTTPMessage (void)
+{
+}
+
+/*
+ * CreateMessage.
+ */
+INetHTTPMessage *INetHTTPMessage::CreateMessage (
+ const INetHTTPMessage& rMsg) const
+{
+ return (new INetHTTPMessage (rMsg));
+}
+
+/*
+ * SetHeaderField.
+ * (Header Field Parser).
+ */
+ULONG INetHTTPMessage::SetHeaderField (
+ const INetMessageHeader &rHeader, ULONG nNewIndex)
+{
+ ByteString aName (rHeader.GetName());
+ const sal_Char *pData = aName.GetBuffer();
+ const sal_Char *pStop = pData + aName.Len() + 1;
+ const sal_Char *check = "";
+
+ ULONG nIdx = LIST_APPEND;
+ int eState = INETMSG_HTTP_BEGIN;
+ int eOkState = INETMSG_HTTP_OK;
+
+ while (pData < pStop)
+ {
+ switch (eState)
+ {
+ case INETMSG_HTTP_BEGIN:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'a':
+ eState = INETMSG_HTTP_LETTER_A;
+ break;
+
+ case 'c':
+ eState = INETMSG_HTTP_LETTER_C;
+ break;
+
+ case 'd':
+ check = "erived-from";
+ nIdx = INETMSG_HTTP_DERIVED_FROM;
+ break;
+
+ case 'e':
+ check = "xpires";
+ nIdx = INETMSG_HTTP_EXPIRES;
+ break;
+
+ case 'f':
+ check = "orwarded";
+ nIdx = INETMSG_HTTP_FORWARDED;
+ break;
+
+ case 'h':
+ check = "ost";
+ nIdx = INETMSG_HTTP_HOST;
+ break;
+
+ case 'i':
+ check = "f-modified-since";
+ nIdx = INETMSG_HTTP_IF_MODIFIED_SINCE;
+ break;
+
+ case 'k':
+ check = "eep-alive";
+ nIdx = INETMSG_HTTP_KEEP_ALIVE;
+ break;
+
+ case 'l':
+ eState = INETMSG_HTTP_LETTER_L;
+ break;
+
+ case 'p':
+ eState = INETMSG_HTTP_LETTER_P;
+ break;
+
+ case 'r':
+ eState = INETMSG_HTTP_LETTER_R;
+ break;
+
+ case 's':
+ check = "erver";
+ nIdx = INETMSG_HTTP_SERVER;
+ break;
+
+ case 't':
+ eState = INETMSG_HTTP_LETTER_T;
+ break;
+
+ case 'u':
+ eState = INETMSG_HTTP_LETTER_U;
+ break;
+
+ case 'w':
+ check = "ww-authenticate";
+ nIdx = INETMSG_HTTP_WWW_AUTHENTICATE;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_LETTER_A:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'c':
+ if (INetMIME::equalIgnoreCase (
+ pData, pData + 14, "ccept-language"))
+ {
+ nIdx = INETMSG_HTTP_ACCEPT_LANGUAGE;
+ pData += 14;
+ }
+ else if (INetMIME::equalIgnoreCase (
+ pData, pData + 14, "ccept-encoding"))
+ {
+ nIdx = INETMSG_HTTP_ACCEPT_ENCODING;
+ pData += 14;
+ }
+ else if (INetMIME::equalIgnoreCase (
+ pData, pData + 13, "ccept-charset"))
+ {
+ nIdx = INETMSG_HTTP_ACCEPT_CHARSET;
+ pData += 13;
+ }
+ else if (INetMIME::equalIgnoreCase (
+ pData, pData + 5, "ccept"))
+ {
+ nIdx = INETMSG_HTTP_ACCEPT;
+ pData += 5;
+ }
+ else
+ {
+ eState = INETMSG_HTTP_JUNK;
+ }
+ break;
+
+ case 'l':
+ check = "low";
+ nIdx = INETMSG_HTTP_ALLOW;
+ break;
+
+ case 'u':
+ check = "thorization";
+ nIdx = INETMSG_HTTP_AUTHORIZATION;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_LETTER_C:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'a':
+ check = "che-control";
+ nIdx = INETMSG_HTTP_CACHE_CONTROL;
+ break;
+
+ case 'o':
+ if (rtl_char_toLowerCase (*(pData + 1)) == 'n')
+ {
+ eState = INETMSG_HTTP_TOKEN_CON;
+ }
+ else if (rtl_char_toLowerCase (*(pData + 1)) == 'o')
+ {
+ check = "kie";
+ nIdx = INETMSG_HTTP_COOKIE;
+ }
+ else
+ {
+ eState = INETMSG_HTTP_JUNK;
+ }
+ pData++;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_LETTER_L:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'a':
+ check = "st-modified";
+ nIdx = INETMSG_HTTP_LAST_MODIFIED;
+ break;
+
+ case 'i':
+ check = "nk";
+ nIdx = INETMSG_HTTP_LINK;
+ break;
+
+ case 'o':
+ check = "cation";
+ nIdx = INETMSG_HTTP_LOCATION;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_LETTER_P:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'r':
+ switch (rtl_char_toLowerCase (*(pData + 1)))
+ {
+ case 'a':
+ check = "gma";
+ nIdx = INETMSG_HTTP_PRAGMA;
+ break;
+
+ case 'o':
+ check = "xy-auth";
+ eOkState = INETMSG_HTTP_PROXY_AUTH;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case 'u':
+ check = "blic";
+ nIdx = INETMSG_HTTP_PUBLIC;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_LETTER_R:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'a':
+ check = "nge";
+ nIdx = INETMSG_HTTP_RANGE;
+ break;
+
+ case 'e':
+ switch (rtl_char_toLowerCase (*(pData + 1)))
+ {
+ case 'f':
+ check = "erer";
+ nIdx = INETMSG_HTTP_REFERER;
+ break;
+
+ case 't':
+ check = "ry-after";
+ nIdx = INETMSG_HTTP_RETRY_AFTER;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_LETTER_T:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'i':
+ check = "tle";
+ nIdx = INETMSG_HTTP_TITLE;
+ break;
+
+ case 'r':
+ check = "ansfer-encoding";
+ nIdx = INETMSG_HTTP_TRANSFER_ENCODING;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_LETTER_U:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'n':
+ check = "less";
+ nIdx = INETMSG_HTTP_UNLESS;
+ break;
+
+ case 'p':
+ check = "grade";
+ nIdx = INETMSG_HTTP_UPGRADE;
+ break;
+
+ case 'r':
+ check = "i";
+ nIdx = INETMSG_HTTP_URI;
+ break;
+
+ case 's':
+ check = "er-agent";
+ nIdx = INETMSG_HTTP_USER_AGENT;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_TOKEN_CON:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'n':
+ check = "ection";
+ nIdx = INETMSG_HTTP_CONNECTION;
+ break;
+
+ case 't':
+ check = "ent-";
+ eOkState = INETMSG_HTTP_CONTENT;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_CONTENT:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'e':
+ check = "ncoding";
+ nIdx = INETMSG_HTTP_CONTENT_ENCODING;
+ break;
+
+ case 'l':
+ switch (rtl_char_toLowerCase (*(pData + 1)))
+ {
+ case 'a':
+ check = "nguage";
+ nIdx = INETMSG_HTTP_CONTENT_LANGUAGE;
+ break;
+
+ case 'e':
+ check = "ngth";
+ nIdx = INETMSG_HTTP_CONTENT_LENGTH;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case 'm':
+ check = "d5";
+ nIdx = INETMSG_HTTP_CONTENT_MD5;
+ break;
+
+ case 'r':
+ check = "ange";
+ nIdx = INETMSG_HTTP_CONTENT_RANGE;
+ break;
+
+ case 'v':
+ check = "ersion";
+ nIdx = INETMSG_HTTP_CONTENT_VERSION;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_PROXY_AUTH:
+ eState = INETMSG_HTTP_CHECK;
+ eOkState = INETMSG_HTTP_OK;
+
+ switch (rtl_char_toLowerCase (*pData))
+ {
+ case 'e':
+ check = "nticate";
+ nIdx = INETMSG_HTTP_PROXY_AUTHENTICATE;
+ break;
+
+ case 'o':
+ check = "rization";
+ nIdx = INETMSG_HTTP_PROXY_AUTHORIZATION;
+ break;
+
+ default:
+ eState = INETMSG_HTTP_JUNK;
+ break;
+ }
+ pData++;
+ break;
+
+ case INETMSG_HTTP_CHECK:
+ if (*check)
+ {
+ while (*pData && *check &&
+ (rtl_char_toLowerCase (*pData) == *check))
+ {
+ pData++;
+ check++;
+ }
+ }
+ else
+ {
+ check = pData;
+ }
+ eState = (*check == '\0') ? eOkState : INETMSG_HTTP_JUNK;
+ break;
+
+ case INETMSG_HTTP_OK:
+ pData = pStop;
+ SetHeaderField_Impl (
+ HEADERFIELD (HTTPHDR(nIdx), rHeader.GetValue()),
+ m_nIndex[nIdx]);
+ nNewIndex = m_nIndex[nIdx];
+ break;
+
+ default: // INETMSG_HTTP_JUNK
+ pData = pStop;
+ nNewIndex = INetMIMEMessage::SetHeaderField (
+ rHeader, nNewIndex);
+ break;
+ }
+ }
+ return nNewIndex;
+}
+
+/*
+ * Specific Set-Methods.
+ */
+void INetHTTPMessage::SetAccept (const String& rAccept)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_ACCEPT), rAccept,
+ m_nIndex[INETMSG_HTTP_ACCEPT]);
+}
+
+void INetHTTPMessage::SetAcceptCharset (const String& rAcceptCharset)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_ACCEPT_CHARSET), rAcceptCharset,
+ m_nIndex[INETMSG_HTTP_ACCEPT_CHARSET]);
+}
+
+void INetHTTPMessage::SetAcceptEncoding (const String& rAcceptEncoding)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_ACCEPT_ENCODING), rAcceptEncoding,
+ m_nIndex[INETMSG_HTTP_ACCEPT_ENCODING]);
+}
+
+void INetHTTPMessage::SetAcceptLanguage (const String& rAcceptLanguage)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_ACCEPT_LANGUAGE), rAcceptLanguage,
+ m_nIndex[INETMSG_HTTP_ACCEPT_LANGUAGE]);
+}
+
+void INetHTTPMessage::SetAllow (const String& rAllow)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_ALLOW), rAllow,
+ m_nIndex[INETMSG_HTTP_ALLOW]);
+}
+
+void INetHTTPMessage::SetAuthorization (const String& rAuthorization)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_AUTHORIZATION), rAuthorization,
+ m_nIndex[INETMSG_HTTP_AUTHORIZATION]);
+}
+
+void INetHTTPMessage::SetCacheControl (const String& rCacheControl)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CACHE_CONTROL), rCacheControl,
+ m_nIndex[INETMSG_HTTP_CACHE_CONTROL]);
+}
+
+void INetHTTPMessage::SetConnection (const String& rConnection)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CONNECTION), rConnection,
+ m_nIndex[INETMSG_HTTP_CONNECTION]);
+}
+
+void INetHTTPMessage::SetContentEncoding (const String& rContentEncoding)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CONTENT_ENCODING), rContentEncoding,
+ m_nIndex[INETMSG_HTTP_CONTENT_ENCODING]);
+}
+
+void INetHTTPMessage::SetContentLanguage (const String& rContentLanguage)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CONTENT_LANGUAGE), rContentLanguage,
+ m_nIndex[INETMSG_HTTP_CONTENT_LANGUAGE]);
+}
+
+void INetHTTPMessage::SetContentLength (const String& rContentLength)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CONTENT_LENGTH), rContentLength,
+ m_nIndex[INETMSG_HTTP_CONTENT_LENGTH]);
+}
+
+void INetHTTPMessage::SetContentMD5 (const String& rContentMD5)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CONTENT_MD5), rContentMD5,
+ m_nIndex[INETMSG_HTTP_CONTENT_MD5]);
+}
+
+void INetHTTPMessage::SetContentRange (const String& rContentRange)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CONTENT_RANGE), rContentRange,
+ m_nIndex[INETMSG_HTTP_CONTENT_RANGE]);
+}
+
+void INetHTTPMessage::SetContentVersion (const String& rContentVersion)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_CONTENT_VERSION), rContentVersion,
+ m_nIndex[INETMSG_HTTP_CONTENT_VERSION]);
+}
+
+void INetHTTPMessage::SetCookie (const String& rCookie)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_COOKIE), rCookie,
+ m_nIndex[INETMSG_HTTP_COOKIE]);
+}
+
+void INetHTTPMessage::SetDerivedFrom (const String& rDerivedFrom)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_DERIVED_FROM), rDerivedFrom,
+ m_nIndex[INETMSG_HTTP_DERIVED_FROM]);
+}
+
+void INetHTTPMessage::SetExpires (const String& rExpires)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_EXPIRES), rExpires,
+ m_nIndex[INETMSG_HTTP_EXPIRES]);
+}
+
+void INetHTTPMessage::SetForwarded (const String& rForwarded)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_FORWARDED), rForwarded,
+ m_nIndex[INETMSG_HTTP_FORWARDED]);
+}
+
+void INetHTTPMessage::SetHost (const String& rHost)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_HOST), rHost,
+ m_nIndex[INETMSG_HTTP_HOST]);
+}
+
+void INetHTTPMessage::SetIfModifiedSince (const String& rIfModifiedSince)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_IF_MODIFIED_SINCE), rIfModifiedSince,
+ m_nIndex[INETMSG_HTTP_IF_MODIFIED_SINCE]);
+}
+
+void INetHTTPMessage::SetKeepAlive (const String& rKeepAlive)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_KEEP_ALIVE), rKeepAlive,
+ m_nIndex[INETMSG_HTTP_KEEP_ALIVE]);
+}
+
+void INetHTTPMessage::SetLastModified (const String& rLastModified)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_LAST_MODIFIED), rLastModified,
+ m_nIndex[INETMSG_HTTP_LAST_MODIFIED]);
+}
+
+void INetHTTPMessage::SetLink (const String& rLink)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_LINK), rLink,
+ m_nIndex[INETMSG_HTTP_LINK]);
+}
+
+void INetHTTPMessage::SetLocation (const String& rLocation)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_LOCATION), rLocation,
+ m_nIndex[INETMSG_HTTP_LOCATION]);
+}
+
+void INetHTTPMessage::SetProxyAuthenticate (
+ const String& rProxyAuthenticate)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_PROXY_AUTHENTICATE), rProxyAuthenticate,
+ m_nIndex[INETMSG_HTTP_PROXY_AUTHENTICATE]);
+}
+
+void INetHTTPMessage::SetProxyAuthorization (
+ const String& rProxyAuthorization)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_PROXY_AUTHORIZATION), rProxyAuthorization,
+ m_nIndex[INETMSG_HTTP_PROXY_AUTHORIZATION]);
+}
+
+void INetHTTPMessage::SetPragma (const String& rPragma)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_PRAGMA), rPragma,
+ m_nIndex[INETMSG_HTTP_PRAGMA]);
+}
+
+void INetHTTPMessage::SetPublic (const String& rPublic)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_PUBLIC), rPublic,
+ m_nIndex[INETMSG_HTTP_PUBLIC]);
+}
+
+void INetHTTPMessage::SetRange (const String& rRange)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_RANGE), rRange,
+ m_nIndex[INETMSG_HTTP_RANGE]);
+}
+
+void INetHTTPMessage::SetReferer (const String& rReferer)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_REFERER), rReferer,
+ m_nIndex[INETMSG_HTTP_REFERER]);
+}
+
+void INetHTTPMessage::SetRetryAfter (const String& rRetryAfter)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_RETRY_AFTER), rRetryAfter,
+ m_nIndex[INETMSG_HTTP_RETRY_AFTER]);
+}
+
+void INetHTTPMessage::SetServer (const String& rServer)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_SERVER), rServer,
+ m_nIndex[INETMSG_HTTP_SERVER]);
+}
+
+void INetHTTPMessage::SetTitle (const String& rTitle)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_TITLE), rTitle,
+ m_nIndex[INETMSG_HTTP_TITLE]);
+}
+
+void INetHTTPMessage::SetTransferEncoding (
+ const String& rTransferEncoding)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_TRANSFER_ENCODING), rTransferEncoding,
+ m_nIndex[INETMSG_HTTP_TRANSFER_ENCODING]);
+}
+
+void INetHTTPMessage::SetUnless (const String& rUnless)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_UNLESS), rUnless,
+ m_nIndex[INETMSG_HTTP_UNLESS]);
+}
+
+void INetHTTPMessage::SetUpgrade (const String& rUpgrade)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_UPGRADE), rUpgrade,
+ m_nIndex[INETMSG_HTTP_UPGRADE]);
+}
+
+void INetHTTPMessage::SetURI (const String& rURI)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_URI), rURI,
+ m_nIndex[INETMSG_HTTP_URI]);
+}
+
+void INetHTTPMessage::SetUserAgent (const String& rUserAgent)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_USER_AGENT), rUserAgent,
+ m_nIndex[INETMSG_HTTP_USER_AGENT]);
+}
+
+void INetHTTPMessage::SetWWWAuthenticate (const String& rWWWAuthenticate)
+{
+ SetHeaderField_Impl (
+ INetMIME::HEADER_FIELD_TEXT,
+ HTTPHDR(INETMSG_HTTP_WWW_AUTHENTICATE), rWWWAuthenticate,
+ m_nIndex[INETMSG_HTTP_WWW_AUTHENTICATE]);
+}
+
+/*
+ * operator<<
+ */
+SvStream& INetHTTPMessage::operator<< (SvStream& rStrm) const
+{
+ INetMIMEMessage::operator<< (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_HTTP_NUMHDR; i++)
+ rStrm << m_nIndex[i];
+
+ return rStrm;
+}
+
+/*
+ * operator>>
+ */
+SvStream& INetHTTPMessage::operator>> (SvStream& rStrm)
+{
+ INetMIMEMessage::operator>> (rStrm);
+
+ for (USHORT i = 0; i < INETMSG_HTTP_NUMHDR; i++)
+ rStrm >> m_nIndex[i];
+
+ return rStrm;
+}
+
diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx
new file mode 100644
index 000000000000..04072d617642
--- /dev/null
+++ b/tools/source/inet/inetstrm.cxx
@@ -0,0 +1,2059 @@
+/*************************************************************************
+ *
+ * $RCSfile: inetstrm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _RTL_CHAR_H_
+#include <rtl/char.h>
+#endif
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+
+#ifndef _CACHESTR_HXX
+#include <cachestr.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _TOOLS_INETMSG_HXX
+#include <inetmsg.hxx>
+#endif
+#ifndef _TOOLS_INETSTRM_HXX
+#include <inetstrm.hxx>
+#endif
+#ifndef _ZCODEC_HXX
+#include <zcodec.hxx>
+#endif
+
+#include <ctype.h> // toupper
+
+#define CONSTASCII_STRINGPARAM(a) (a), RTL_TEXTENCODING_ASCII_US
+
+/*=======================================================================
+ *
+ * INetMessageEncodeQPStream Interface.
+ * (Quoted-Printable Encoding)
+ *
+ *=====================================================================*/
+class INetMessageEncodeQPStream_Impl : public INetMessageIStream
+{
+ SvStream *pMsgStrm;
+
+ ULONG nMsgBufSiz;
+ sal_Char *pMsgBuffer;
+ sal_Char *pMsgRead;
+ sal_Char *pMsgWrite;
+
+ ULONG nTokBufSiz;
+ sal_Char *pTokBuffer;
+ sal_Char *pTokRead;
+ sal_Char *pTokWrite;
+
+ INetMessageStreamState eState;
+ BOOL bDone;
+
+ virtual int GetMsgLine (
+ sal_Char *pData, ULONG nSize, void *pCtx = NULL);
+
+public:
+ INetMessageEncodeQPStream_Impl (ULONG nMsgBufferSize = 1024);
+ virtual ~INetMessageEncodeQPStream_Impl (void);
+};
+
+/*=====================================================================
+ *
+ * INetMessageDecodeQPStream Interface.
+ * (Quoted-Printable Decoding)
+ *
+ *====================================================================*/
+class INetMessageDecodeQPStream_Impl : public INetMessageOStream
+{
+ INetMessageStreamState eState;
+ SvMemoryStream *pMsgBuffer;
+
+ ULONG nTokBufLen;
+ sal_Char pTokBuffer[4];
+
+ virtual int PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx = NULL);
+
+public:
+ INetMessageDecodeQPStream_Impl (void);
+ virtual ~INetMessageDecodeQPStream_Impl (void);
+};
+
+/*======================================================================
+ *
+ * INetMessageEncode64Stream Interface.
+ * (Base64 Encoding)
+ *
+ *====================================================================*/
+class INetMessageEncode64Stream_Impl : public INetMessageIStream
+{
+ SvStream *pMsgStrm;
+
+ ULONG nMsgBufSiz;
+ sal_uInt8 *pMsgBuffer;
+ sal_uInt8 *pMsgRead;
+ sal_uInt8 *pMsgWrite;
+
+ ULONG nTokBufSiz;
+ sal_Char *pTokBuffer;
+ sal_Char *pTokRead;
+ sal_Char *pTokWrite;
+
+ BOOL bDone;
+
+ virtual int GetMsgLine (
+ sal_Char *pData, ULONG nSize, void *pCtx = NULL);
+
+public:
+ INetMessageEncode64Stream_Impl (ULONG nMsgBufferSize = 2048);
+ virtual ~INetMessageEncode64Stream_Impl (void);
+};
+
+/*======================================================================
+ *
+ * INetMessageDecode64Stream Interface.
+ * (Base64 Decoding)
+ *
+ *====================================================================*/
+class INetMessageDecode64Stream_Impl : public INetMessageOStream
+{
+ INetMessageStreamState eState;
+
+ ULONG nMsgBufSiz;
+ sal_Char *pMsgBuffer;
+ sal_Char *pMsgRead;
+ sal_Char *pMsgWrite;
+
+ virtual int PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx = NULL);
+
+public:
+ INetMessageDecode64Stream_Impl (ULONG nMsgBufferSize = 128);
+ virtual ~INetMessageDecode64Stream_Impl (void);
+};
+
+/*=========================================================================
+ *
+ * INetIStream Implementation.
+ *
+ *=======================================================================*/
+/*
+ * INetIStream.
+ */
+INetIStream::INetIStream (ULONG nIBufferSize)
+{
+}
+
+/*
+ * ~INetIStream.
+ */
+INetIStream::~INetIStream (void)
+{
+}
+
+/*
+ * Read.
+ */
+int INetIStream::Read (sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ return GetData (pData, nSize, pCtx);
+}
+
+/*
+ * Decode64.
+ */
+void INetIStream::Decode64 (SvStream& rIn, SvStream& rOut)
+{
+ INetMessage aMsg;
+ aMsg.SetDocumentLB(new SvAsyncLockBytes(&rOut, FALSE));
+
+ INetMessageDecode64Stream_Impl aStream (8192);
+ aStream.SetTargetMessage (&aMsg);
+
+ sal_Char* pBuf = new sal_Char[8192];
+
+ int nRead = 0;
+ while ((nRead = rIn.Read (pBuf, 8192)) > 0)
+ aStream.Write( pBuf, nRead );
+ aStream.Write ("\r\n", 2);
+
+ delete[] pBuf;
+}
+
+/*
+ * Encode64.
+ */
+void INetIStream::Encode64 (SvStream& rIn, SvStream& rOut)
+{
+ INetMessage aMsg;
+ aMsg.SetDocumentLB (
+ new SvLockBytes (&rIn, FALSE));
+
+ INetMessageEncode64Stream_Impl aStream (8192);
+ aStream.SetSourceMessage (&aMsg);
+
+ sal_Char* pBuf = new sal_Char[8192];
+
+ int nRead = 0;
+ while ((nRead = aStream.Read (pBuf, 8192)) > 0)
+ rOut.Write( pBuf, nRead );
+
+ delete[] pBuf;
+}
+
+/*=========================================================================
+ *
+ * INetOStream Implementation.
+ *
+ *=======================================================================*/
+/*
+ * INetOStream.
+ */
+INetOStream::INetOStream (ULONG nOBufferSize)
+{
+}
+
+/*
+ * ~INetOStream.
+ */
+INetOStream::~INetOStream (void)
+{
+}
+
+/*
+ * Write.
+ */
+int INetOStream::Write (const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ return PutData (pData, nSize, pCtx);
+}
+
+/*=========================================================================
+ *
+ * INetMessageIStream Implementation.
+ *
+ *=======================================================================*/
+/*
+ * INetMessageIStream.
+ */
+INetMessageIStream::INetMessageIStream (ULONG nBufferSize)
+ : INetIStream (0),
+ pSourceMsg (NULL),
+ bHeaderGenerated (FALSE),
+ nBufSiz (nBufferSize),
+ pMsgStrm (NULL),
+ pMsgBuffer (new SvMemoryStream)
+{
+ pMsgBuffer->SetStreamCharSet (RTL_TEXTENCODING_ASCII_US);
+ pBuffer = new sal_Char[nBufSiz];
+ pRead = pWrite = pBuffer;
+}
+
+/*
+ * ~INetMessageIStream.
+ */
+INetMessageIStream::~INetMessageIStream (void)
+{
+ delete [] pBuffer;
+ delete pMsgBuffer;
+ delete pMsgStrm;
+}
+
+/*
+ * GetData.
+ */
+int INetMessageIStream::GetData (sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ if (pSourceMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ sal_Char *pWBuf = pData;
+ sal_Char *pWEnd = pData + nSize;
+
+ while (pWBuf < pWEnd)
+ {
+ // Caller's buffer not yet filled.
+ ULONG n = pRead - pWrite;
+ if (n > 0)
+ {
+ // Bytes still in buffer.
+ ULONG m = pWEnd - pWBuf;
+ if (m < n) n = m;
+ for (ULONG i = 0; i < n; i++) *pWBuf++ = *pWrite++;
+ }
+ else
+ {
+ // Buffer empty. Reset to <Begin-of-Buffer>.
+ pRead = pWrite = pBuffer;
+
+ // Read next message line.
+ int nRead = GetMsgLine (pBuffer, nBufSiz, pCtx);
+ if (nRead > 0)
+ {
+ // Set read pointer.
+ pRead = pBuffer + nRead;
+ }
+ else
+ {
+ if (!bHeaderGenerated)
+ {
+ // Header generated. Insert empty line.
+ bHeaderGenerated = TRUE;
+ *pRead++ = '\r';
+ *pRead++ = '\n';
+ }
+ else
+ {
+ // Body generated.
+ return (pWBuf - pData);
+ }
+ }
+ }
+ }
+ return (pWBuf - pData);
+}
+
+/*
+ * GetMsgLine.
+ */
+int INetMessageIStream::GetMsgLine (sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ if (pSourceMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ sal_Char *pWBuf = pData;
+ sal_Char *pWEnd = pData + nSize;
+
+ if (!bHeaderGenerated)
+ {
+ ULONG i, n;
+
+ if (pMsgBuffer->Tell() == 0)
+ {
+ // Insert formatted header into buffer.
+ n = pSourceMsg->GetHeaderCount();
+ for (i = 0; i < n; i++)
+ {
+ INetMessageHeader aHeader (pSourceMsg->GetHeaderField(i));
+ if (aHeader.GetValue().Len())
+ {
+ // NYI: Folding long lines.
+ *pMsgBuffer << (sal_Char*)(aHeader.GetName().GetBuffer());
+ *pMsgBuffer << ": ";
+ *pMsgBuffer << (sal_Char*)(aHeader.GetValue().GetBuffer());
+ *pMsgBuffer << "\r\n";
+ }
+ }
+
+ pMsgWrite = (sal_Char *)(pMsgBuffer->GetData());
+ pMsgRead = pMsgWrite + pMsgBuffer->Tell();
+ }
+
+ n = pMsgRead - pMsgWrite;
+ if (n > 0)
+ {
+ // Move to caller.
+ if (nSize < n) n = nSize;
+ for (i = 0; i < n; i++) *pWBuf++ = *pMsgWrite++;
+ }
+ else
+ {
+ // Reset buffer.
+ pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN);
+ }
+ }
+ else
+ {
+ if (pSourceMsg->GetDocumentLB())
+ {
+ if (pMsgStrm == NULL)
+ pMsgStrm = new SvStream (pSourceMsg->GetDocumentLB());
+
+ ULONG nRead = pMsgStrm->Read (pWBuf, (pWEnd - pWBuf));
+ pWBuf += nRead;
+ }
+ }
+ return (pWBuf - pData);
+}
+
+/*=========================================================================
+ *
+ * INetMessageOStream Implementation.
+ *
+ *=======================================================================*/
+/*
+ * INetMessageOStream.
+ */
+INetMessageOStream::INetMessageOStream (void)
+ : INetOStream (0),
+ pTargetMsg (NULL),
+ bHeaderParsed (FALSE),
+ eOState (INETMSG_EOL_BEGIN),
+ pMsgBuffer (new SvMemoryStream)
+{
+}
+
+/*
+ * ~INetMessageOStream.
+ */
+INetMessageOStream::~INetMessageOStream (void)
+{
+ if (pMsgBuffer->Tell() > 0)
+ PutMsgLine ((const sal_Char *) pMsgBuffer->GetData(), pMsgBuffer->Tell());
+ delete pMsgBuffer;
+
+ if (pTargetMsg)
+ {
+ SvOpenLockBytes *pLB =
+ PTR_CAST (SvOpenLockBytes, pTargetMsg->GetDocumentLB());
+ if (pLB)
+ {
+ pLB->Flush();
+ pLB->Terminate();
+ }
+ }
+}
+
+/*
+ * PutData.
+ * (Simple Field Parsing (RFC822, Appendix B)).
+ */
+int INetMessageOStream::PutData (
+ const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ if (pTargetMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ const sal_Char *pStop = (pData + nSize);
+
+ while (!bHeaderParsed && (pData < pStop))
+ {
+ if (eOState == INETMSG_EOL_BEGIN)
+ {
+ if ((*pData == '\r') || (*pData == '\n'))
+ {
+ /*
+ * Empty Line. Separates header fields from message body.
+ * Skip this and any 2nd line break character (if any).
+ */
+ pData++;
+ if ((pData < pStop) && ((*pData == '\r') || (*pData == '\n')))
+ pData++;
+
+ // Emit any buffered last header field.
+ if (pMsgBuffer->Tell() > 0)
+ {
+ *pMsgBuffer << '\0';
+ int status = PutMsgLine (
+ (const sal_Char *) pMsgBuffer->GetData(), pMsgBuffer->Tell(), pCtx);
+ if (status != INETSTREAM_STATUS_OK) return status;
+ }
+
+ // Reset to begin.
+ eOState = INETMSG_EOL_BEGIN;
+ pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN);
+
+ // Mark header parsed.
+ bHeaderParsed = TRUE;
+ }
+ else if ((*pData == ' ') || (*pData == '\t'))
+ {
+ // Continuation line. Unfold multi-line field-body.
+ *pMsgBuffer << ' ';
+ pData++;
+ }
+ else
+ {
+ // Begin of new header field.
+ if (pMsgBuffer->Tell() > 0)
+ {
+ // Emit buffered header field now.
+ *pMsgBuffer << '\0';
+ int status = PutMsgLine (
+ (const sal_Char *) pMsgBuffer->GetData(), pMsgBuffer->Tell(), pCtx);
+ if (status != INETSTREAM_STATUS_OK) return status;
+ }
+
+ // Reset to begin of buffer.
+ pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN);
+
+ // Insert current character into buffer.
+ *pMsgBuffer << *pData++;
+ }
+
+ // Search for next line break character.
+ if (!bHeaderParsed) eOState = INETMSG_EOL_SCR;
+ }
+ else if (eOState == INETMSG_EOL_FCR)
+ {
+ // Skip line break character.
+ pData++;
+
+ // Mark begin of line.
+ eOState = INETMSG_EOL_BEGIN;
+ }
+ else if ((*pData == '\r') || (*pData == '\n'))
+ {
+ if (*pData == '\r') pData++;
+ eOState = INETMSG_EOL_FCR;
+ }
+ else if (rtl_char_isWhitespace (*pData & 0x7f))
+ {
+ // Any <LWS> is folded into a single <SP> character.
+ sal_Char c = *((const sal_Char *) pMsgBuffer->GetData() + pMsgBuffer->Tell() - 1);
+ if (!rtl_char_isWhitespace (c & 0x7f)) *pMsgBuffer << ' ';
+
+ // Skip over this <LWS> character.
+ pData++;
+ }
+ else
+ {
+ // Any other character is inserted into line buffer.
+ *pMsgBuffer << *pData++;
+ }
+ }
+
+ if (bHeaderParsed && (pData < pStop))
+ {
+ // Put message body down-stream.
+ return PutMsgLine (pData, (pStop - pData), pCtx);
+ }
+
+ return INETSTREAM_STATUS_OK;
+}
+
+/*
+ * PutMsgLine.
+ */
+int INetMessageOStream::PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ // Check for message container.
+ if (pTargetMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ // Check for header or body.
+ if (!IsHeaderParsed())
+ {
+ ByteString aField (pData);
+ USHORT nPos = aField.Search (':');
+ if (nPos != STRING_NOTFOUND)
+ {
+ ByteString aName (
+ aField.Copy (0, nPos));
+ ByteString aValue (
+ aField.Copy (nPos + 1, aField.Len() - nPos + 1));
+ aValue.EraseLeadingChars (' ');
+
+ pTargetMsg->SetHeaderField (
+ INetMessageHeader (aName, aValue));
+ }
+ }
+ else
+ {
+ SvOpenLockBytes *pLB =
+ PTR_CAST(SvOpenLockBytes, pTargetMsg->GetDocumentLB());
+ if (pLB == NULL)
+ return INETSTREAM_STATUS_WOULDBLOCK;
+
+ ULONG nDocSiz = pTargetMsg->GetDocumentSize();
+ ULONG nWrite = 0;
+
+ ErrCode status = pLB->FillAppend ((sal_Char *)pData, nSize, &nWrite);
+ pTargetMsg->SetDocumentSize (nDocSiz + nWrite);
+
+ if (nWrite < nSize) return INETSTREAM_STATUS_ERROR;
+ }
+ return INETSTREAM_STATUS_OK;
+}
+
+/*=========================================================================
+ *
+ * INetMessageIOStream Implementation.
+ *
+ *=======================================================================*/
+/*
+ * INetMessageIOStream.
+ */
+INetMessageIOStream::INetMessageIOStream (ULONG nBufferSize)
+ : INetMessageIStream (nBufferSize),
+ INetMessageOStream ()
+{
+}
+
+/*
+ * ~INetMessageIOStream.
+ */
+INetMessageIOStream::~INetMessageIOStream (void)
+{
+}
+
+/*=======================================================================
+ *
+ * INetMessageEncodeQPStream_Impl Implementation.
+ * (Quoted-Printable Encoding)
+ *
+ *=====================================================================*/
+static const sal_Char hex2pr[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ 'A', 'B', 'C', 'D', 'E', 'F'
+};
+
+static const sal_Char ebcdic[] = {
+ '!', '"', '#', '$', '@', '[', '\\', ']', '^', '`', '{', '|', '}', '~'
+};
+
+/*
+ * INetMessageEncodeQPStream_Impl.
+ */
+INetMessageEncodeQPStream_Impl::INetMessageEncodeQPStream_Impl (
+ ULONG nMsgBufferSize)
+ : INetMessageIStream (),
+ pMsgStrm (NULL),
+ nMsgBufSiz (nMsgBufferSize),
+ nTokBufSiz (80),
+ eState (INETMSG_EOL_SCR),
+ bDone (FALSE)
+{
+ GenerateHeader (FALSE);
+
+ pMsgBuffer = new sal_Char[nMsgBufSiz];
+ pMsgRead = pMsgWrite = pMsgBuffer;
+
+ pTokBuffer = new sal_Char[nTokBufSiz];
+ pTokRead = pTokWrite = pTokBuffer;
+}
+
+/*
+ * ~INetMessageEncodeQPStream_Impl.
+ */
+INetMessageEncodeQPStream_Impl::~INetMessageEncodeQPStream_Impl (void)
+{
+ delete pMsgStrm;
+ delete [] pMsgBuffer;
+ delete [] pTokBuffer;
+}
+
+/*
+ * GetMsgLine.
+ */
+int INetMessageEncodeQPStream_Impl::GetMsgLine (
+ sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ INetMessage *pMsg = GetSourceMessage ();
+ if (pMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ if (pMsg->GetDocumentLB() == NULL) return 0;
+ if (pMsgStrm == NULL) pMsgStrm = new SvStream (pMsg->GetDocumentLB());
+
+ sal_Char *pWBuf = pData;
+ while (pWBuf < (pData + nSize))
+ {
+ // Caller's buffer not yet filled.
+ if ((pMsgRead - pMsgWrite) > 0)
+ {
+ // Bytes still in message buffer.
+ if ((eState != INETMSG_EOL_BEGIN) &&
+ ((pTokRead - pTokBuffer) < 72))
+ {
+ // Token buffer not yet filled.
+ if (eState == INETMSG_EOL_FCR)
+ {
+ eState = INETMSG_EOL_BEGIN;
+ if (*pMsgWrite != '\n')
+ {
+ // Convert orphant <CR> into <CR><LF> sequence.
+ *pTokRead++ = '\n';
+ }
+ *pTokRead++ = *pMsgWrite++;
+ }
+ else if ((*pMsgWrite == ' ') || (*pMsgWrite == '\t'))
+ {
+ eState = INETMSG_EOL_FSP;
+ *pTokRead++ = *pMsgWrite++;
+ }
+ else if (*pMsgWrite == '\r')
+ {
+ // Found <CR>.
+ if (eState == INETMSG_EOL_FSP)
+ {
+ // Encode last (trailing space) character.
+ sal_uInt8 c = (sal_uInt8)(*(--pTokRead));
+ *pTokRead++ = '=';
+ *pTokRead++ = hex2pr[((c & 0xf0) >> 4)];
+ *pTokRead++ = hex2pr[((c & 0x0f) )];
+ }
+ eState = INETMSG_EOL_FCR;
+ *pTokRead++ = *pMsgWrite++;
+ }
+ else if (*pMsgWrite == '\n')
+ {
+ // Found <LF> only.
+ if (eState == INETMSG_EOL_FSP)
+ {
+ // Encode last (trailing space) character.
+ sal_uInt8 c = (sal_uInt8)(*(--pTokRead));
+ *pTokRead++ = '=';
+ *pTokRead++ = hex2pr[((c & 0xf0) >> 4)];
+ *pTokRead++ = hex2pr[((c & 0x0f) )];
+ }
+ eState = INETMSG_EOL_BEGIN;
+
+ // Convert orphant <LF> into <CR><LF> sequence.
+ *pTokRead++ = '\r';
+ *pTokRead++ = *pMsgWrite++;
+ }
+ else if (*pMsgWrite == '=')
+ {
+ // Escape character itself MUST be encoded, of course.
+ sal_uInt8 c = (sal_uInt8)(*pMsgWrite++);
+ *pTokRead++ = '=';
+ *pTokRead++ = hex2pr[((c & 0xf0) >> 4)];
+ *pTokRead++ = hex2pr[((c & 0x0f) )];
+
+ eState = INETMSG_EOL_SCR;
+ }
+ else if (((sal_uInt8)(*pMsgWrite) > 0x20) &&
+ ((sal_uInt8)(*pMsgWrite) < 0x7f) )
+ {
+ /*
+ * Some printable ASCII character.
+ * (Encode EBCDIC special characters (NYI)).
+ */
+ *pTokRead++ = *pMsgWrite++;
+ eState = INETMSG_EOL_SCR;
+ }
+ else
+ {
+ // Encode any other character.
+ sal_uInt8 c = (sal_uInt8)(*pMsgWrite++);
+ *pTokRead++ = '=';
+ *pTokRead++ = hex2pr[((c & 0xf0) >> 4)];
+ *pTokRead++ = hex2pr[((c & 0x0f) )];
+
+ eState = INETMSG_EOL_SCR;
+ }
+ }
+ else
+ {
+ // Check for maximum line length.
+ if (eState != INETMSG_EOL_BEGIN)
+ {
+ // Insert soft line break.
+ *pTokRead++ = '=';
+ *pTokRead++ = '\r';
+ *pTokRead++ = '\n';
+
+ eState = INETMSG_EOL_BEGIN;
+ }
+
+ // Copy to caller's buffer.
+ if ((pTokRead - pTokWrite) > 0)
+ {
+ // Bytes still in token buffer.
+ *pWBuf++ = *pTokWrite++;
+ }
+ else
+ {
+ // Token buffer empty. Reset to <Begin-of-Buffer>.
+ pTokRead = pTokWrite = pTokBuffer;
+ eState = INETMSG_EOL_SCR;
+ }
+ }
+ }
+ else
+ {
+ // Message buffer empty. Reset to <Begin-of-Buffer>.
+ pMsgRead = pMsgWrite = pMsgBuffer;
+
+ // Read next message block.
+ ULONG nRead = pMsgStrm->Read (pMsgBuffer, nMsgBufSiz);
+ if (nRead > 0)
+ {
+ // Set read pointer.
+ pMsgRead = (pMsgBuffer + nRead);
+ }
+ else
+ {
+ // Nothing more ro read.
+ if (!bDone)
+ {
+ // Append final <CR><LF> and mark we're done.
+ *pTokRead++ = '\r';
+ *pTokRead++ = '\n';
+
+ bDone = TRUE;
+ }
+ else
+ {
+ // Already done all encoding.
+ if ((pTokRead - pTokWrite) > 0)
+ {
+ // Bytes still in token buffer.
+ *pWBuf++ = *pTokWrite++;
+ }
+ else
+ {
+ // Token buffer empty. Reset to <Begin-of-Buffer>.
+ pTokRead = pTokWrite = pTokBuffer;
+
+ // Return.
+ return (pWBuf - pData);
+ }
+ }
+ }
+ }
+ }
+ return (pWBuf - pData);
+}
+
+/*=====================================================================
+ *
+ * INetMessageDecodeQPStream_Impl Implementation.
+ * (Quoted-Printable Decoding)
+ *
+ *====================================================================*/
+static const sal_uInt8 pr2hex[128] = {
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+ 0x08, 0x09, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+
+ 0x10, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10
+};
+
+/*
+ * INetMessageDecodeQPStream_Impl.
+ */
+INetMessageDecodeQPStream_Impl::INetMessageDecodeQPStream_Impl (void)
+ : INetMessageOStream (),
+ eState (INETMSG_EOL_BEGIN),
+ pMsgBuffer (new SvMemoryStream),
+ nTokBufLen (0)
+{
+ ParseHeader (FALSE);
+}
+
+/*
+ * ~INetMessageDecodeQPStream_Impl.
+ */
+INetMessageDecodeQPStream_Impl::~INetMessageDecodeQPStream_Impl (void)
+{
+ delete pMsgBuffer;
+}
+
+/*
+ * PutMsgLine.
+ */
+int INetMessageDecodeQPStream_Impl::PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ INetMessage *pMsg = GetTargetMessage();
+ if (pMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ SvOpenLockBytes * pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB());
+ if (pLB == NULL) return INETSTREAM_STATUS_WOULDBLOCK;
+
+ const sal_Char *pStop = pData + nSize;
+ while (pData < pStop)
+ {
+ if (eState == INETMSG_EOL_FESC)
+ {
+ *(pTokBuffer + nTokBufLen++) = toupper (*pData);
+ pData++;
+ if (nTokBufLen == 2)
+ {
+ if ((*pTokBuffer == '\r') || (*pTokBuffer == '\n'))
+ {
+ // Soft line break (=<CR><LF>). Emit buffer now.
+ eState = INETMSG_EOL_BEGIN;
+ }
+ else
+ {
+ // Decode token.
+ *pMsgBuffer << sal_uInt8 (
+ (pr2hex[(int)(pTokBuffer[0] & 0x7f)] << 4) |
+ (pr2hex[(int)(pTokBuffer[1] & 0x7f)] & 15) );
+
+ // Search for next <CR>.
+ eState = INETMSG_EOL_SCR;
+ }
+
+ // Reset token buffer.
+ nTokBufLen = 0;
+ }
+ }
+ else if (*pData == '=')
+ {
+ // Found escape character.
+ pData++;
+ eState = INETMSG_EOL_FESC;
+ }
+ else if (eState == INETMSG_EOL_FCR)
+ {
+ *pMsgBuffer << *pData++;
+ eState = INETMSG_EOL_BEGIN;
+ }
+ else if (*pData == '\r')
+ {
+ *pMsgBuffer << *pData++;
+ eState = INETMSG_EOL_FCR;
+ }
+ else
+ {
+ *pMsgBuffer << *pData++;
+ }
+
+ if (eState == INETMSG_EOL_BEGIN)
+ {
+ ULONG nRead = pMsgBuffer->Tell();
+ if (nRead > 0)
+ {
+ // Emit buffer.
+ ULONG nDocSiz = pMsg->GetDocumentSize();
+ ULONG nWrite = 0;
+
+ pLB->FillAppend (
+ (sal_Char *)(pMsgBuffer->GetData()), nRead, &nWrite);
+ pMsg->SetDocumentSize (nDocSiz + nWrite);
+
+ if (nWrite < nRead) return INETSTREAM_STATUS_ERROR;
+
+ pMsgBuffer->Seek (STREAM_SEEK_TO_BEGIN);
+ }
+ eState = INETMSG_EOL_SCR;
+ }
+ }
+ return INETSTREAM_STATUS_OK;
+}
+
+/*======================================================================
+ *
+ * INetMessageEncode64Stream_Impl Implementation.
+ * (Base64 Encoding)
+ *
+ *====================================================================*/
+static const sal_Char six2pr[64] = {
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
+};
+
+/*
+ * INetMessageEncode64Stream_Impl.
+ */
+INetMessageEncode64Stream_Impl::INetMessageEncode64Stream_Impl (
+ ULONG nMsgBufferSize)
+ : INetMessageIStream (),
+ pMsgStrm (NULL),
+ nMsgBufSiz (nMsgBufferSize),
+ nTokBufSiz (80),
+ bDone (FALSE)
+{
+ GenerateHeader (FALSE);
+
+ pMsgBuffer = new sal_uInt8[nMsgBufSiz];
+ pMsgRead = pMsgWrite = pMsgBuffer;
+
+ pTokBuffer = new sal_Char[nTokBufSiz];
+ pTokRead = pTokWrite = pTokBuffer;
+}
+
+/*
+ * ~INetMessageEncode64Stream_Impl.
+ */
+INetMessageEncode64Stream_Impl::~INetMessageEncode64Stream_Impl (void)
+{
+ delete pMsgStrm;
+ delete [] pMsgBuffer;
+ delete [] pTokBuffer;
+}
+
+/*
+ * GetMsgLine.
+ */
+int INetMessageEncode64Stream_Impl::GetMsgLine (
+ sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ INetMessage *pMsg = GetSourceMessage ();
+ if (pMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ if (pMsg->GetDocumentLB() == NULL) return 0;
+ if (pMsgStrm == NULL) pMsgStrm = new SvStream (pMsg->GetDocumentLB());
+
+ sal_Char *pWBuf = pData;
+ while (pWBuf < (pData + nSize))
+ {
+ // Caller's buffer not yet filled.
+ if ((pMsgRead - pMsgWrite) > 0)
+ {
+ // Bytes still in message buffer.
+ if ((pTokRead - pTokBuffer) < 72)
+ {
+ // Token buffer not yet filled.
+ switch ((pTokRead - pTokBuffer) % 4)
+ {
+ case 0:
+ *pTokRead++ = six2pr[(int)(*pMsgWrite >> 2)];
+ break;
+
+ case 1:
+ *pTokRead++ = six2pr[
+ (int)(((*pMsgWrite << 4) & 060) |
+ (((*(pMsgWrite + 1)) >> 4) & 017))];
+ pMsgWrite++;
+ break;
+
+ case 2:
+ *pTokRead++ = six2pr[
+ (int)(((*pMsgWrite << 2) & 074) |
+ (((*(pMsgWrite + 1)) >> 6) & 003))];
+ pMsgWrite++;
+ break;
+
+ default: // == case 3
+ *pTokRead++ = six2pr[(int)(*pMsgWrite & 077)];
+ pMsgWrite++;
+ break;
+ }
+ }
+ else if ((pTokRead - pTokBuffer) == 72)
+ {
+ // Maximum line length. Append <CR><LF>.
+ *pTokRead++ = '\r';
+ *pTokRead++ = '\n';
+ }
+ else
+ {
+ if ((pTokRead - pTokWrite) > 0)
+ {
+ // Bytes still in token buffer.
+ *pWBuf++ = *pTokWrite++;
+ }
+ else
+ {
+ // Token buffer empty. Reset to <Begin-of-Buffer>.
+ pTokRead = pTokWrite = pTokBuffer;
+ }
+ }
+ }
+ else
+ {
+ // Message buffer empty. Reset to <Begin-of-Buffer>.
+ pMsgRead = pMsgWrite = pMsgBuffer;
+
+ // Read next message block.
+ ULONG nRead = pMsgStrm->Read (pMsgBuffer, nMsgBufSiz);
+ if (nRead > 0)
+ {
+ // Set read pointer.
+ pMsgRead = (pMsgBuffer + nRead);
+ }
+ else
+ {
+ // Nothing more to read.
+ if (!bDone)
+ {
+ // Append pad character(s) and final <CR><LF>.
+ switch ((pTokRead - pTokBuffer) % 4)
+ {
+ case 2:
+ *pTokRead++ = '=';
+ // Fall through for 2nd pad character.
+
+ case 3:
+ *pTokRead++ = '=';
+ break;
+
+ default:
+ break;
+ }
+ *pTokRead++ = '\r';
+ *pTokRead++ = '\n';
+
+ // Mark we're done.
+ bDone = TRUE;
+ }
+ else
+ {
+ // Already done all encoding.
+ if ((pTokRead - pTokWrite) > 0)
+ {
+ // Bytes still in token buffer.
+ *pWBuf++ = *pTokWrite++;
+ }
+ else
+ {
+ // Token buffer empty. Reset to <Begin-of-Buffer>.
+ pTokRead = pTokWrite = pTokBuffer;
+
+ // Reset done flag, if everything has been done.
+ // if (pWBuf == pData) bDone = FALSE;
+
+ // Return.
+ return (pWBuf - pData);
+ }
+ }
+ }
+ }
+ } // while (pWBuf < (pData + nSize))
+ return (pWBuf - pData);
+}
+
+/*======================================================================
+ *
+ * INetMessageDecode64Stream_Impl Implementation.
+ * (Base64 Decoding)
+ *
+ *====================================================================*/
+static const sal_uInt8 pr2six[256] = {
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x3E, 0x40, 0x40, 0x40, 0x3F,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
+ 0x3C, 0x3D, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+
+ 0x40, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
+ 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
+ 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+ 0x17, 0x18, 0x19, 0x40, 0x40, 0x40, 0x40, 0x40,
+
+ 0x40, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20,
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
+ 0x31, 0x32, 0x33, 0x40, 0x40, 0x40, 0x40, 0x40,
+
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40
+};
+
+/*
+ * INetMessageDecode64Stream_Impl.
+ */
+INetMessageDecode64Stream_Impl::INetMessageDecode64Stream_Impl (
+ ULONG nMsgBufferSize)
+ : INetMessageOStream (),
+ eState (INETMSG_EOL_SCR),
+ nMsgBufSiz (nMsgBufferSize)
+{
+ ParseHeader (FALSE);
+
+ pMsgBuffer = new sal_Char[nMsgBufSiz];
+ pMsgRead = pMsgWrite = pMsgBuffer;
+}
+
+/*
+ * ~INetMessageDecode64Stream_Impl.
+ */
+INetMessageDecode64Stream_Impl::~INetMessageDecode64Stream_Impl (void)
+{
+ delete [] pMsgBuffer;
+}
+
+/*
+ * PutMsgLine.
+ */
+int INetMessageDecode64Stream_Impl::PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ INetMessage *pMsg = GetTargetMessage ();
+ if (pMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ SvOpenLockBytes * pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB());
+ if (pLB == NULL) return INETSTREAM_STATUS_WOULDBLOCK;
+
+ const sal_Char *pStop = (pData + nSize);
+ while (pData < pStop)
+ {
+ if (pr2six[(int)(*pData)] > 63)
+ {
+ /*
+ * Character not in base64 alphabet.
+ * Check for <End-of-Stream> or Junk.
+ */
+ if (*pData == '=')
+ {
+ // Final pad character -> Done.
+ ULONG nDocSiz = pMsg->GetDocumentSize();
+ ULONG nRead = pMsgWrite - pMsgBuffer;
+ ULONG nWrite = 0;
+
+ pLB->FillAppend (pMsgBuffer, nRead, &nWrite);
+ pMsg->SetDocumentSize (nDocSiz + nWrite);
+
+ if (nWrite < nRead)
+ return INETSTREAM_STATUS_ERROR;
+ else
+ return INETSTREAM_STATUS_LOADED;
+ }
+ else if (eState == INETMSG_EOL_FCR)
+ {
+ // Skip any line break character.
+ if ((*pData == '\r') || (*pData == '\n')) pData++;
+
+ // Store decoded message buffer contents.
+ ULONG nDocSiz = pMsg->GetDocumentSize();
+ ULONG nRead = pMsgWrite - pMsgBuffer;
+ ULONG nWrite = 0;
+
+ pLB->FillAppend (pMsgBuffer, nRead, &nWrite);
+ pMsg->SetDocumentSize (nDocSiz + nWrite);
+
+ if (nWrite < nRead) return INETSTREAM_STATUS_ERROR;
+
+ // Reset to <Begin-of-Buffer>.
+ pMsgWrite = pMsgBuffer;
+ eState = INETMSG_EOL_SCR;
+ }
+ else if ((*pData == '\r') || (*pData == '\n'))
+ {
+ // Skip any line break character.
+ pData++;
+ eState = INETMSG_EOL_FCR;
+ }
+ else
+ {
+ // Skip any junk character (may be transmission error).
+ pData++;
+ }
+ }
+ else
+ {
+ // Decode any other character into message buffer.
+ switch ((pMsgRead - pMsgBuffer) % 4)
+ {
+ case 0:
+ *pMsgWrite = (pr2six[(int)(*pData++)] << 2);
+ pMsgRead++;
+ break;
+
+ case 1:
+ *pMsgWrite++ |= (pr2six[(int)(*pData )] >> 4);
+ *pMsgWrite = (pr2six[(int)(*pData++)] << 4);
+ pMsgRead++;
+ break;
+
+ case 2:
+ *pMsgWrite++ |= (pr2six[(int)(*pData )] >> 2);
+ *pMsgWrite = (pr2six[(int)(*pData++)] << 6);
+ pMsgRead++;
+ break;
+
+ default: // == case 3
+ *pMsgWrite++ |= (pr2six[(int)(*pData++)]);
+ pMsgRead = pMsgBuffer;
+ break;
+ } // switch ((pMsgRead - pMsgBuffer) % 4)
+ }
+ } // while (pData < pStop)
+ return INETSTREAM_STATUS_OK;
+}
+
+/*=========================================================================
+ *
+ * INetMIMEMessageStream Implementation.
+ *
+ *=======================================================================*/
+/*
+ * INetMIMEMessageStream.
+ */
+INetMIMEMessageStream::INetMIMEMessageStream (ULONG nBufferSize)
+ : INetMessageIOStream (nBufferSize),
+ eState (INETMSG_EOL_BEGIN),
+ nChildIndex (0),
+ pChildStrm (NULL),
+ eEncoding (INETMSG_ENCODING_BINARY),
+ pEncodeStrm (NULL),
+ pDecodeStrm (NULL),
+ pMsgBuffer (NULL)
+{
+}
+
+/*
+ * ~INetMIMEMessageStream.
+ */
+INetMIMEMessageStream::~INetMIMEMessageStream (void)
+{
+ delete pChildStrm;
+ delete pEncodeStrm;
+ delete pDecodeStrm;
+ delete pMsgBuffer;
+}
+
+/*
+ * GetMsgEncoding.
+ */
+INetMessageEncoding
+INetMIMEMessageStream::GetMsgEncoding (const String& rContentType)
+{
+ if ((rContentType.CompareIgnoreCaseToAscii ("message" , 7) == 0) ||
+ (rContentType.CompareIgnoreCaseToAscii ("multipart", 9) == 0) )
+ return INETMSG_ENCODING_7BIT;
+
+ if (rContentType.CompareIgnoreCaseToAscii ("text", 4) == 0)
+ {
+ if (rContentType.CompareIgnoreCaseToAscii ("text/plain", 10) == 0)
+ {
+ if (rContentType.GetTokenCount ('=') > 1)
+ {
+ String aCharset (rContentType.GetToken (1, '='));
+ aCharset.EraseLeadingChars (' ');
+ aCharset.EraseLeadingChars ('"');
+
+ if (aCharset.CompareIgnoreCaseToAscii ("us-ascii", 8) == 0)
+ return INETMSG_ENCODING_7BIT;
+ else
+ return INETMSG_ENCODING_QUOTED;
+ }
+ else
+ return INETMSG_ENCODING_7BIT;
+ }
+ else
+ return INETMSG_ENCODING_QUOTED;
+ }
+
+ return INETMSG_ENCODING_BASE64;
+}
+
+/*
+ * GetMsgLine.
+ * (Message Generator).
+ */
+int INetMIMEMessageStream::GetMsgLine (
+ sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ // Check for message container.
+ INetMIMEMessage *pMsg = GetSourceMessage();
+ if (pMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ // Check for header or body.
+ if (!IsHeaderGenerated())
+ {
+ if (eState == INETMSG_EOL_BEGIN)
+ {
+ // Prepare special header fields.
+ if (pMsg->GetParent())
+ {
+ String aPCT (pMsg->GetParent()->GetContentType());
+ if (aPCT.CompareIgnoreCaseToAscii ("message/rfc822", 14) == 0)
+ pMsg->SetMIMEVersion (
+ String(CONSTASCII_STRINGPARAM("1.0")));
+ else
+ pMsg->SetMIMEVersion (String());
+ }
+ else
+ {
+ pMsg->SetMIMEVersion (String(CONSTASCII_STRINGPARAM("1.0")));
+ }
+
+ // Check ContentType.
+ String aContentType (pMsg->GetContentType());
+ if (aContentType.Len())
+ {
+ // Determine default Content-Type.
+ String aDefaultType;
+ pMsg->GetDefaultContentType (aDefaultType);
+
+ if (aDefaultType.CompareIgnoreCaseToAscii (
+ aContentType, aContentType.Len()) == 0)
+ {
+ // No need to specify default.
+ pMsg->SetContentType (String());
+ }
+ }
+
+ // Check Encoding.
+ String aEncoding (pMsg->GetContentTransferEncoding());
+ if (aEncoding.Len())
+ {
+ // Use given Encoding.
+ if (aEncoding.CompareIgnoreCaseToAscii (
+ "base64", 6) == 0)
+ eEncoding = INETMSG_ENCODING_BASE64;
+ else if (aEncoding.CompareIgnoreCaseToAscii (
+ "quoted-printable", 16) == 0)
+ eEncoding = INETMSG_ENCODING_QUOTED;
+ else
+ eEncoding = INETMSG_ENCODING_7BIT;
+ }
+ else
+ {
+ // Use default Encoding for (given|default) Content-Type.
+ if (aContentType.Len() == 0)
+ {
+ // Determine default Content-Type.
+ pMsg->GetDefaultContentType (aContentType);
+ }
+ eEncoding = GetMsgEncoding (aContentType);
+ }
+
+ // Set Content-Transfer-Encoding header.
+ if (eEncoding == INETMSG_ENCODING_BASE64)
+ {
+ // Base64.
+ pMsg->SetContentTransferEncoding (
+ String(CONSTASCII_STRINGPARAM("base64")));
+ }
+ else if (eEncoding == INETMSG_ENCODING_QUOTED)
+ {
+ // Quoted-Printable.
+ pMsg->SetContentTransferEncoding (
+ String(CONSTASCII_STRINGPARAM("quoted-printable")));
+ }
+ else
+ {
+ // No need to specify default.
+ pMsg->SetContentTransferEncoding (String());
+ }
+
+ // Mark we're done.
+ eState = INETMSG_EOL_DONE;
+ }
+
+ // Generate the message header.
+ int nRead = INetMessageIOStream::GetMsgLine (pData, nSize, pCtx);
+ if (nRead <= 0)
+ {
+ // Reset state.
+ eState = INETMSG_EOL_BEGIN;
+ }
+ return nRead;
+ }
+ else
+ {
+ // Generate the message body.
+ if (pMsg->IsContainer())
+ {
+ // Encapsulated message body.
+ while (eState == INETMSG_EOL_BEGIN)
+ {
+ if (pChildStrm == NULL)
+ {
+ INetMIMEMessage *pChild = pMsg->GetChild (nChildIndex);
+ if (pChild)
+ {
+ // Increment child index.
+ nChildIndex++;
+
+ // Create child stream.
+ pChildStrm = new INetMIMEMessageStream;
+ pChildStrm->SetSourceMessage (pChild);
+
+ if (pMsg->IsMultipart())
+ {
+ // Insert multipart delimiter.
+ ByteString aDelim ("--");
+ aDelim += pMsg->GetMultipartBoundary();
+ aDelim += "\r\n";
+
+ rtl_copyMemory (
+ pData, aDelim.GetBuffer(), aDelim.Len());
+ return aDelim.Len();
+ }
+ }
+ else
+ {
+ // No more parts. Mark we're done.
+ eState = INETMSG_EOL_DONE;
+ nChildIndex = 0;
+
+ if (pMsg->IsMultipart())
+ {
+ // Insert close delimiter.
+ ByteString aDelim ("--");
+ aDelim += pMsg->GetMultipartBoundary();
+ aDelim += "--\r\n";
+
+ rtl_copyMemory (
+ pData, aDelim.GetBuffer(), aDelim.Len());
+ return aDelim.Len();
+ }
+ }
+ }
+ else
+ {
+ // Read current child stream.
+ int nRead = pChildStrm->Read (pData, nSize, pCtx);
+ if (nRead > 0)
+ {
+ return nRead;
+ }
+ else
+ {
+ // Cleanup exhausted child stream.
+ delete pChildStrm;
+ pChildStrm = NULL;
+ }
+ }
+ }
+ return 0;
+ }
+ else
+ {
+ // Single part message body.
+ if (pMsg->GetDocumentLB() == NULL)
+ {
+ // Empty message body.
+ return 0;
+ }
+ else
+ {
+ // Check whether message body needs to be encoded.
+ if (eEncoding == INETMSG_ENCODING_7BIT)
+ {
+ // No Encoding.
+ return INetMessageIOStream::GetMsgLine (
+ pData, nSize, pCtx);
+ }
+ else
+ {
+ // Apply appropriate Encoding.
+ while (eState == INETMSG_EOL_BEGIN)
+ {
+ if (pEncodeStrm == NULL)
+ {
+ // Create encoder stream.
+ if (eEncoding == INETMSG_ENCODING_QUOTED)
+ {
+ // Quoted-Printable Encoding.
+ pEncodeStrm
+ = new INetMessageEncodeQPStream_Impl;
+ }
+ else
+ {
+ // Base64 Encoding.
+ pEncodeStrm
+ = new INetMessageEncode64Stream_Impl;
+ }
+ pEncodeStrm->SetSourceMessage (pMsg);
+ }
+
+ // Read encoded message.
+ int nRead = pEncodeStrm->Read (pData, nSize, pCtx);
+ if (nRead > 0)
+ {
+ return nRead;
+ }
+ else
+ {
+ // Cleanup exhausted encoder stream.
+ delete pEncodeStrm;
+ pEncodeStrm = NULL;
+
+ // Mark we're done.
+ eState = INETMSG_EOL_DONE;
+ }
+ }
+ return 0;
+ }
+ }
+ }
+ }
+ return INETSTREAM_STATUS_ERROR; // Never reached.
+}
+
+/*
+ * PutMsgLine.
+ * (Message Parser).
+ */
+int INetMIMEMessageStream::PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ // Check for message container.
+ INetMIMEMessage *pMsg = GetTargetMessage();
+ if (pMsg == NULL) return INETSTREAM_STATUS_ERROR;
+
+ // Check for header or body.
+ if (!IsHeaderParsed())
+ {
+ // Parse the message header.
+ int nRet = INetMessageIOStream::PutMsgLine (pData, nSize, pCtx);
+ return nRet;
+ }
+ else
+ {
+ pMsg->SetHeaderParsed();
+ // Parse the message body.
+ if (pMsg->IsContainer())
+ {
+
+ // Content-Transfer-Encoding MUST be "7bit" (RFC1521).
+ if (pMsg->IsMessage())
+ {
+ if( !pChildStrm )
+ {
+ // Encapsulated message.
+ pMsg->SetChildCount( pMsg->GetChildCount() + 1);
+ INetMIMEMessage* pNewMessage = new INetMIMEMessage;
+ pNewMessage->SetDocumentLB (
+ new SvAsyncLockBytes(new SvCacheStream, FALSE));
+ pMsg->AttachChild( *pNewMessage, TRUE );
+
+ // Encapsulated message body. Create message parser stream.
+ pChildStrm = new INetMIMEMessageStream;
+ pChildStrm->SetTargetMessage ( pNewMessage );
+
+ // Initialize control variables.
+ eState = INETMSG_EOL_BEGIN;
+ }
+ if ( nSize > 0)
+ {
+ // Bytes still in buffer. Put message down-stream.
+ int status = pChildStrm->Write(
+ pData, nSize, NULL );
+ if (status != INETSTREAM_STATUS_OK)
+ return status;
+ }
+
+ return INetMessageIOStream::PutMsgLine (
+ pData, nSize, pCtx);
+ }
+ else
+ {
+
+ // Multipart message body. Initialize multipart delimiters.
+ // Multipart message.
+ if (pMsg->GetMultipartBoundary().Len() == 0)
+ {
+ // Determine boundary.
+ ByteString aType (
+ pMsg->GetContentType(), RTL_TEXTENCODING_ASCII_US);
+ ByteString aLowerType (aType);
+ aLowerType.ToLowerAscii();
+
+ USHORT nPos = aLowerType.Search ("boundary=");
+ ByteString aBoundary (aType.Copy (nPos + 9));
+
+ aBoundary.EraseLeadingAndTrailingChars (' ');
+ aBoundary.EraseLeadingAndTrailingChars ('"');
+
+ // Save boundary.
+ pMsg->SetMultipartBoundary (aBoundary);
+ }
+
+ ByteString aPlainDelim (pMsg->GetMultipartBoundary());
+ ByteString aDelim ("--");
+ aDelim += aPlainDelim;
+
+ ByteString aPlainClose (aPlainDelim);
+ aPlainClose += "--";
+
+ ByteString aClose (aDelim);
+ aClose += "--";
+
+ if (pMsgBuffer == NULL) pMsgBuffer = new SvMemoryStream;
+ pMsgBuffer->Write (pData, nSize);
+ ULONG nBufSize = pMsgBuffer->Tell();
+
+ const sal_Char* pChar;
+ const sal_Char* pOldPos;
+ for( pOldPos = pChar = (const sal_Char *) pMsgBuffer->GetData(); nBufSize--;
+ pChar++ )
+ {
+ int status;
+ if( *pChar == '\r' || *pChar == '\n' )
+ {
+ if( aDelim.CompareTo (pOldPos, aDelim.Len())
+ != COMPARE_EQUAL &&
+ aClose.CompareTo (pOldPos, aClose.Len())
+ != COMPARE_EQUAL &&
+ aPlainDelim.CompareTo (pOldPos, aPlainDelim.Len())
+ != COMPARE_EQUAL &&
+ aPlainClose.CompareTo(pOldPos, aPlainClose.Len())
+ != COMPARE_EQUAL )
+ {
+ if( nBufSize &&
+ ( pChar[1] == '\r' || pChar[1] == '\n' ) )
+ nBufSize--, pChar++;
+ if( pChildStrm )
+ {
+ status = pChildStrm->Write(
+ pOldPos, pChar - pOldPos + 1 );
+ if( status != INETSTREAM_STATUS_OK )
+ return status;
+ }
+ else
+ DBG_ERRORFILE( "Die Boundary nicht gefunden" );
+ status = INetMessageIOStream::PutMsgLine(
+ pOldPos, pChar - pOldPos + 1, pCtx );
+ if( status != INETSTREAM_STATUS_OK )
+ return status;
+ pOldPos = pChar + 1;
+ }
+ else
+ {
+ if( nBufSize &&
+ ( pChar[1] == '\r' || pChar[1] == '\n' ) )
+ nBufSize--, pChar++;
+ pOldPos = pChar + 1;
+ DELETEZ( pChildStrm );
+
+ if (aClose.CompareTo (pOldPos, aClose.Len())
+ != COMPARE_EQUAL &&
+ aPlainClose.CompareTo (pOldPos, aClose.Len())
+ != COMPARE_EQUAL )
+ {
+ // Encapsulated message.
+ pMsg->SetChildCount(pMsg->GetChildCount() + 1);
+ INetMIMEMessage* pNewMessage =
+ new INetMIMEMessage;
+ pNewMessage->SetDocumentLB (
+ new SvAsyncLockBytes (
+ new SvCacheStream, FALSE));
+
+ pMsg->AttachChild( *pNewMessage, TRUE );
+
+ // Encapsulated message body. Create message parser stream.
+ pChildStrm = new INetMIMEMessageStream;
+ pChildStrm->SetTargetMessage ( pNewMessage );
+
+ // Initialize control variables.
+ }
+ eState = INETMSG_EOL_BEGIN;
+ status = INetMessageIOStream::PutMsgLine(
+ pOldPos, pChar - pOldPos + 1, pCtx );
+ if( status != INETSTREAM_STATUS_OK )
+ return status;
+ }
+ }
+ }
+ if( pOldPos < pChar )
+ {
+ SvMemoryStream* pNewStream = new SvMemoryStream;
+ pNewStream->Write( pOldPos, pChar - pOldPos );
+ SvMemoryStream* pTmp = pMsgBuffer;
+ pMsgBuffer = pNewStream;
+ delete pTmp;
+ }
+ else
+ {
+ pMsgBuffer->Seek( 0L );
+ pMsgBuffer->SetStreamSize( 0 );
+ }
+ return INETSTREAM_STATUS_OK;
+ }
+ }
+ else
+ {
+ /*
+ * Single part message.
+ * Remove any ContentTransferEncoding.
+ */
+ if (pMsg->GetContentType().Len() == 0)
+ {
+ String aDefaultCT;
+ pMsg->GetDefaultContentType (aDefaultCT);
+ pMsg->SetContentType (aDefaultCT);
+ }
+
+ if (eEncoding == INETMSG_ENCODING_BINARY)
+ {
+ String aEncoding (pMsg->GetContentTransferEncoding());
+ if (aEncoding.CompareIgnoreCaseToAscii (
+ "base64", 6) == COMPARE_EQUAL)
+ eEncoding = INETMSG_ENCODING_BASE64;
+ else if (aEncoding.CompareIgnoreCaseToAscii (
+ "quoted-printable", 16) == COMPARE_EQUAL)
+ eEncoding = INETMSG_ENCODING_QUOTED;
+ else
+ eEncoding = INETMSG_ENCODING_7BIT;
+ }
+
+ if (eEncoding == INETMSG_ENCODING_7BIT)
+ {
+ // No decoding necessary.
+ return INetMessageIOStream::PutMsgLine (
+ pData, nSize, pCtx);
+ }
+ else
+ {
+ if (pDecodeStrm == NULL)
+ {
+ if (eEncoding == INETMSG_ENCODING_QUOTED)
+ pDecodeStrm = new INetMessageDecodeQPStream_Impl;
+ else
+ pDecodeStrm = new INetMessageDecode64Stream_Impl;
+
+ pDecodeStrm->SetTargetMessage (pMsg);
+ }
+ return pDecodeStrm->Write (pData, nSize, pCtx);
+ }
+ }
+ }
+}
+
+/*=========================================================================
+ *
+ * INetMessageDecodeGZStream_Impl Implementation.
+ * (GZIP Decoding).
+ *
+ *=======================================================================*/
+class INetMessageDecodeGZStream_Impl : public INetMessageOStream
+{
+ SvMemoryStream m_aStrm;
+ GZCodec m_aCodec;
+ sal_uInt8 m_pBuffer[1024];
+
+ virtual int PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx = NULL);
+
+public:
+ INetMessageDecodeGZStream_Impl (void);
+};
+
+/*
+ * INetMessageDecodeGZStream_Impl.
+ */
+INetMessageDecodeGZStream_Impl::INetMessageDecodeGZStream_Impl (void)
+ : INetMessageOStream()
+{
+ ParseHeader (FALSE);
+ m_aCodec.BeginCompression();
+}
+
+/*
+ * PutMsgLine.
+ */
+int INetMessageDecodeGZStream_Impl::PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ INetMessage *pMsg = GetTargetMessage();
+ if (pMsg == NULL)
+ return INETSTREAM_STATUS_ERROR;
+
+ SvOpenLockBytes * pLB = PTR_CAST(SvOpenLockBytes, pMsg->GetDocumentLB());
+ if (pLB == NULL)
+ return INETSTREAM_STATUS_WOULDBLOCK;
+
+ m_aStrm.Seek (STREAM_SEEK_TO_BEGIN);
+ m_aStrm.Write (pData, nSize);
+
+ m_aStrm.Seek (STREAM_SEEK_TO_BEGIN);
+ long nRead = 0;
+
+ // Decode into buffer.
+ m_aCodec.SetBreak (nSize);
+ while ((nRead = m_aCodec.Read (m_aStrm, m_pBuffer, sizeof(m_pBuffer))) > 0)
+ {
+ // Emit Buffer.
+ ULONG nDocSize = pMsg->GetDocumentSize();
+ ULONG nWrite = 0;
+
+ pLB->FillAppend (m_pBuffer, nRead, &nWrite);
+ pMsg->SetDocumentSize (nDocSize + nWrite);
+
+ if ((long)nWrite < nRead)
+ return INETSTREAM_STATUS_ERROR;
+ }
+
+ if (m_aCodec.IsFinished())
+ return INETSTREAM_STATUS_LOADED;
+ else if (nRead < 0)
+ return INETSTREAM_STATUS_ERROR;
+ else
+ return INETSTREAM_STATUS_OK;
+}
+
+/*=========================================================================
+ *
+ * INetHTTPMessageStream Implementation.
+ *
+ *=======================================================================*/
+/*
+ * INetHTTPMessageStream.
+ */
+INetHTTPMessageStream::INetHTTPMessageStream (ULONG nBufferSize)
+ : INetMIMEMessageStream (nBufferSize),
+ m_eState (INETMSG_EOL_BEGIN),
+ m_pDecodeStrm (NULL)
+{
+}
+
+/*
+ * ~INetHTTPMessageStream.
+ */
+INetHTTPMessageStream::~INetHTTPMessageStream (void)
+{
+ delete m_pDecodeStrm;
+}
+
+/*
+ * GetMsgLine.
+ * (Message Generator).
+ */
+int INetHTTPMessageStream::GetMsgLine (
+ sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ // Check for header generation.
+ if (!IsHeaderGenerated())
+ {
+ if (m_eState == INETMSG_EOL_BEGIN)
+ {
+ // Check for message container.
+ INetHTTPMessage *pMsg = GetSourceMessage();
+ if (pMsg == NULL)
+ return INETSTREAM_STATUS_ERROR;
+
+ // Set Accept-Encoding header.
+ pMsg->SetAcceptEncoding (
+ String ("gzip", RTL_TEXTENCODING_ASCII_US));
+
+ // Mark done.
+ m_eState = INETMSG_EOL_DONE;
+ }
+ }
+
+ // Initial approximation: Generate as plain message (w/o encoding).
+ return INetMessageIOStream::GetMsgLine (pData, nSize, pCtx);
+}
+
+/*
+ * PutMsgLine.
+ * (Message Parser).
+ */
+int INetHTTPMessageStream::PutMsgLine (
+ const sal_Char *pData, ULONG nSize, void *pCtx)
+{
+ // Check for header or body.
+ if (!IsHeaderParsed())
+ {
+ // Parse the message header.
+ return INetMessageIOStream::PutMsgLine (pData, nSize, pCtx);
+ }
+ else
+ {
+ // Parse the message body.
+ if (m_eState == INETMSG_EOL_BEGIN)
+ {
+ // Check for message container.
+ INetHTTPMessage *pMsg = GetTargetMessage();
+ if (pMsg == NULL)
+ return INETSTREAM_STATUS_ERROR;
+
+ // Obtain ContentEncoding.
+ String aEncoding (pMsg->GetContentEncoding());
+ aEncoding.EraseLeadingChars (' ');
+
+ // Check for supported encoding.
+ if ((aEncoding.CompareIgnoreCaseToAscii ("gzip") == 0) ||
+ (aEncoding.CompareIgnoreCaseToAscii ("x-gzip") == 0) )
+ {
+ // Initialize decode stream.
+ m_pDecodeStrm = new INetMessageDecodeGZStream_Impl;
+ m_pDecodeStrm->SetTargetMessage (pMsg);
+ }
+
+ // Mark done.
+ m_eState = INETMSG_EOL_DONE;
+ }
+
+ // Check for Decode stream.
+ if (m_pDecodeStrm)
+ {
+ // Decode.
+ return m_pDecodeStrm->Write (pData, nSize, pCtx);
+ }
+ else
+ {
+ // No decoding necessary.
+ return INetMessageIOStream::PutMsgLine (pData, nSize, pCtx);
+ }
+ }
+}
+
diff --git a/tools/source/inet/makefile.mk b/tools/source/inet/makefile.mk
new file mode 100644
index 000000000000..74926210cd36
--- /dev/null
+++ b/tools/source/inet/makefile.mk
@@ -0,0 +1,83 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ = ..$/..
+PRJNAME = tools
+TARGET = inet
+
+.INCLUDE: svpre.mk
+.INCLUDE: settings.mk
+.INCLUDE: sv.mk
+
+SLOFILES=\
+ $(SLO)$/inetmime.obj \
+ $(SLO)$/inetmsg.obj \
+ $(SLO)$/inetstrm.obj
+
+.IF "$(UPDATER)" != ""
+OBJFILES=\
+ $(OBJ)$/inetmime.obj \
+ $(OBJ)$/inetmsg.obj \
+ $(OBJ)$/inetstrm.obj
+.ENDIF
+
+.INCLUDE: target.mk
diff --git a/tools/source/makefile.mk b/tools/source/makefile.mk
new file mode 100644
index 000000000000..d340637a4f27
--- /dev/null
+++ b/tools/source/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:05 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+TARGET=source
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(GUI)" == "UNX"
+SUBDIRS+= solar
+.ENDIF
+
+SUBDIRS+= \
+ datetime \
+ timestamp \
+ debug \
+ fsys \
+ generic \
+ intntl \
+ memmgr \
+ memtools \
+ misc \
+ rc \
+ ref \
+ stream \
+ zcodec
+
+
+.INCLUDE : target.mk
+
diff --git a/tools/source/memtools/contnr.cxx b/tools/source/memtools/contnr.cxx
new file mode 100644
index 000000000000..8228ecb4c880
--- /dev/null
+++ b/tools/source/memtools/contnr.cxx
@@ -0,0 +1,1754 @@
+/*************************************************************************
+ *
+ * $RCSfile: contnr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define private public
+#define protected public
+
+#ifndef _LIMITS_H
+#include <limits.h>
+#endif
+
+#ifndef _STRING_H
+#include <string.h>
+#endif
+
+#ifndef _STDIO_H
+#include <stdio.h>
+#endif
+
+#ifndef _SOLAR_H
+#include <solar.h>
+#endif
+
+#ifndef _IMPCONT_HXX
+#include <impcont.hxx>
+#endif
+
+#ifndef _CONTNR_HXX
+#include <contnr.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+
+// -----------------------------------------------------------------------
+
+DBG_NAME( CBlock );
+DBG_NAME( Container );
+
+/*************************************************************************
+|*
+|* DbgCheckCBlock()
+|*
+|* Beschreibung Pruefung eines CBlock fuer Debug-Utilities
+|* Ersterstellung MI 30.01.92
+|* Letzte Aenderung TH 24.01.96
+|*
+*************************************************************************/
+
+#ifdef DBG_UTIL
+const char* DbgCheckCBlock( const void* pBlock )
+{
+ CBlock* p = (CBlock*)pBlock;
+
+ if ( p->nCount > p->nSize )
+ return "nCount > nSize";
+
+ if ( p->nSize && !p->pNodes )
+ return "nSize > 0 && pNodes == NULL";
+
+ return NULL;
+}
+#endif
+
+/*************************************************************************
+|*
+|* CBlock::CBlock()
+|*
+|* Beschreibung Construktor des Verwaltungsblocks
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+CBlock::CBlock( USHORT nInitSize, CBlock* _pPrev, CBlock* _pNext )
+{
+ DBG_CTOR( CBlock, DbgCheckCBlock );
+
+ pPrev = _pPrev;
+ pNext = _pNext;
+ nSize = nInitSize;
+ nCount = 0;
+
+ // Datenpuffer anlegen
+ pNodes = (void**)new PVOID[nSize];
+}
+
+/*************************************************************************
+|*
+|* CBlock::CBlock()
+|*
+|* Beschreibung Construktor des Verwaltungsblocks
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+CBlock::CBlock( USHORT _nSize, CBlock* _pPrev )
+{
+ DBG_CTOR( CBlock, DbgCheckCBlock );
+ DBG_ASSERT( _nSize, "CBlock::CBlock(): nSize == 0" );
+
+ pPrev = _pPrev;
+ pNext = NULL;
+ nSize = _nSize;
+ nCount = _nSize;
+
+ // Datenpuffer anlegen und initialisieren
+ pNodes = (void**)new PVOID[nSize];
+ memset( pNodes, 0, nSize*sizeof(PVOID) );
+}
+
+/*************************************************************************
+|*
+|* CBlock::CBlock()
+|*
+|* Beschreibung Copy-Construktor des Verwaltungsblocks
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+CBlock::CBlock( const CBlock& r, CBlock* _pPrev )
+{
+ DBG_CTOR( CBlock, DbgCheckCBlock );
+ DBG_CHKOBJ( &r, CBlock, DbgCheckCBlock );
+
+ pPrev = _pPrev;
+ pNext = NULL;
+ nSize = r.nSize;
+ nCount = r.nCount;
+
+ // Datenpuffer anlegen und Daten kopieren
+ pNodes = (void**)new PVOID[nSize];
+ memcpy( pNodes, r.pNodes, nCount*sizeof(PVOID) );
+}
+
+/*************************************************************************
+|*
+|* CBlock::~CBlock()
+|*
+|* Beschreibung Destruktor des Verwaltungsblocks
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+inline CBlock::~CBlock()
+{
+ DBG_DTOR( CBlock, DbgCheckCBlock );
+
+ // Daten loeschen
+ delete pNodes;
+}
+
+/*************************************************************************
+|*
+|* CBlock::Insert()
+|*
+|* Beschreibung Fuegt einen Pointer ein
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void CBlock::Insert( void* p, USHORT nIndex, USHORT nReSize )
+{
+ DBG_CHKTHIS( CBlock, DbgCheckCBlock );
+ DBG_ASSERT( nIndex <= nCount, "CBlock::Insert(): Index > nCount" );
+
+ // Muss Block realokiert werden
+ if ( nCount == nSize )
+ {
+ // Neue Daten anlegen
+ nSize += nReSize;
+ void** pNewNodes = (void**)new PVOID[nSize];
+
+ // Wird angehaengt
+ if ( nCount == nIndex )
+ {
+ // Daten kopieren
+ memcpy( pNewNodes, pNodes, nCount*sizeof(PVOID) );
+ }
+ else
+ {
+ // Daten kopieren
+ memcpy( pNewNodes, pNodes, nIndex*sizeof(PVOID) );
+ memcpy( pNewNodes + nIndex + 1,
+ pNodes + nIndex,
+ (nCount-nIndex)*sizeof(PVOID) );
+ }
+
+ // Alte Daten loeschen und neue setzen
+ delete pNodes;
+ pNodes = pNewNodes;
+ }
+ else
+ {
+ if ( nIndex < nCount )
+ {
+ memmove( pNodes + nIndex + 1,
+ pNodes + nIndex,
+ (nCount-nIndex)*sizeof(PVOID) );
+ }
+ }
+
+ // Neuen Pointer setzen und Elementgroesse erhoehen
+ pNodes[nIndex] = p;
+ nCount++;
+}
+
+/*************************************************************************
+|*
+|* CBlock::Split()
+|*
+|* Beschreibung Fuegt einen Pointer ein und splittet den Block
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+CBlock* CBlock::Split( void* p, USHORT nIndex, USHORT nReSize )
+{
+ DBG_CHKTHIS( CBlock, DbgCheckCBlock );
+
+ USHORT nNewSize;
+ USHORT nMiddle;
+ CBlock* pNewBlock;
+
+ nMiddle = nCount/2;
+
+ if ( ( nIndex == nCount ) || ( nIndex == 0 ) )
+ nNewSize = nReSize;
+ else
+ {
+ // Der aktuelle Block wird in der Mitte geteilt
+ nNewSize = (nCount+1) / 2;
+
+ if ( nNewSize < nReSize )
+ nNewSize = nReSize;
+ else
+ {
+ // Neue Groesse muss ein vielfaches von Resize sein
+ if ( nNewSize % nReSize )
+ nNewSize += nReSize - (nNewSize % nReSize);
+ else
+ nNewSize += nReSize;
+ }
+ }
+
+ // Vor oder hinter dem aktuellem Block einfuegen?
+ if ( nIndex > nMiddle )
+ {
+ // Neuen Split-Block anlegen und hinter dem aktuellem Block einfuegen
+ pNewBlock = new CBlock( nNewSize, this, pNext );
+
+ if ( pNext )
+ pNext->pPrev = pNewBlock;
+ pNext = pNewBlock;
+
+ if ( nIndex == nCount )
+ {
+ // Neuen Pointer einfuegen
+ pNewBlock->pNodes[0] = p;
+ pNewBlock->nCount = 1;
+ }
+ else
+ {
+ nIndex -= nMiddle;
+ // Alles von Mitte bis Index kopieren
+ if ( nIndex )
+ memcpy( pNewBlock->pNodes, pNodes+nMiddle, nIndex*sizeof(PVOID) );
+
+ // Neuen Pointer einfuegen
+ pNewBlock->pNodes[nIndex] = p;
+
+ // Alles von Mitte bis Ende hinter Index kopieren
+ memcpy( pNewBlock->pNodes+nIndex+1,
+ pNodes+nMiddle+nIndex,
+ (nCount-nMiddle-nIndex) * sizeof(PVOID) );
+
+ pNewBlock->nCount = (nCount-nMiddle+1);
+ nCount = nMiddle;
+
+ // Den aktuellen Datenbereich auch halbieren
+ if ( nSize != nNewSize )
+ {
+ void** pNewNodes = (void**)new PVOID[nNewSize];
+ memcpy( pNewNodes, pNodes, nCount*sizeof(PVOID) );
+ delete pNodes;
+ pNodes = pNewNodes;
+ nSize = nNewSize;
+ }
+ }
+ }
+ else
+ {
+ // Neuen Split-Block anlegen und vor dem aktuellem Block einfuegen
+ pNewBlock = new CBlock( nNewSize, pPrev, this );
+
+ if ( pPrev )
+ pPrev->pNext = pNewBlock;
+ pPrev = pNewBlock;
+
+ if ( nIndex == 0 )
+ {
+ // Neuen Pointer einfuegen
+ pNewBlock->pNodes[0] = p;
+ pNewBlock->nCount = 1;
+ }
+ else
+ {
+ // Alles von Anfang bis Index kopieren
+ memcpy( pNewBlock->pNodes, pNodes, nIndex*sizeof(PVOID) );
+
+ // Neuen Pointer einfuegen
+ pNewBlock->pNodes[nIndex] = p;
+
+ // Alles von Index bis Mitte hinter Index kopieren
+ if ( nIndex != nMiddle )
+ {
+ memcpy( pNewBlock->pNodes+nIndex+1,
+ pNodes+nIndex,
+ (nMiddle-nIndex) * sizeof(PVOID) );
+ }
+
+ pNewBlock->nCount = nMiddle+1;
+ nCount -= nMiddle;
+
+ // Die zweite Haelfte in einen neuen Block kopieren
+ if ( nSize != nNewSize )
+ {
+ void** pNewNodes = (void**)new PVOID[nNewSize];
+ memcpy( pNewNodes, pNodes+nMiddle, nCount*sizeof(PVOID) );
+ delete pNodes;
+ pNodes = pNewNodes;
+ nSize = nNewSize;
+ }
+ else
+ memmove( pNodes, pNodes+nMiddle, nCount*sizeof(PVOID) );
+ }
+ }
+
+ // Neu angelegten Block zurueckgeben, da gegebenfalls die Blockpointer
+ // im Container angepast werden koennen
+ return pNewBlock;
+}
+
+/*************************************************************************
+|*
+|* CBlock::Remove()
+|*
+|* Beschreibung Entfernt einen Pointer
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* CBlock::Remove( USHORT nIndex, USHORT nReSize )
+{
+ DBG_CHKTHIS( CBlock, DbgCheckCBlock );
+
+ // Alten Pointer sichern
+ void* pOld = pNodes[nIndex];
+
+ // 1 Element weniger
+ nCount--;
+
+ // Block verkleinern (wenn Reallokationsgroesse um 4 unterschritten wird)
+ if ( nCount == (nSize-nReSize-4) )
+ {
+ // Neue Daten anlegen
+ nSize -= nReSize;
+ void** pNewNodes = (void**)new PVOID[nSize];
+
+ // Wird letzter Eintrag geloescht
+ if ( nIndex == nCount )
+ {
+ // Daten kopieren
+ memcpy( pNewNodes, pNodes, nCount*sizeof(PVOID) );
+ }
+ else
+ {
+ // Daten kopieren
+ memcpy( pNewNodes, pNodes, nIndex*sizeof(PVOID) );
+ memcpy( pNewNodes + nIndex, pNodes + nIndex+1,
+ (nCount-nIndex)*sizeof(PVOID) );
+ }
+
+ // Alte Daten loeschen und neue setzen
+ delete pNodes;
+ pNodes = pNewNodes;
+ }
+ else
+ {
+ // Wenn nicht das letzte Element, dann zusammenschieben
+ if ( nIndex < nCount )
+ {
+ memmove( pNodes + nIndex, pNodes + nIndex + 1,
+ (nCount-nIndex)*sizeof(PVOID) );
+ }
+ }
+
+ // Alten Pointer zurueckgeben
+ return pOld;
+}
+
+/*************************************************************************
+|*
+|* CBlock::Replace()
+|*
+|* Beschreibung Ersetzt einen Pointer
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+inline void* CBlock::Replace( void* p, USHORT nIndex )
+{
+ DBG_CHKTHIS( CBlock, DbgCheckCBlock );
+
+ // Alten Pointer sichern, neuen setzen und alten zurueckgeben
+ void* pOld = pNodes[nIndex];
+ pNodes[nIndex] = p;
+ return pOld;
+}
+
+/*************************************************************************
+|*
+|* CBlock::GetObjectPtr()
+|*
+|* Beschreibung Gibt einen Pointer auf den Pointer aus dem Block
+|* zurueck
+|* Ersterstellung TH 26.01.93
+|* Letzte Aenderung TH 26.01.93
+|*
+*************************************************************************/
+
+inline void** CBlock::GetObjectPtr( USHORT nIndex )
+{
+ DBG_CHKTHIS( CBlock, DbgCheckCBlock );
+
+ return &(pNodes[nIndex]);
+}
+
+/*************************************************************************
+|*
+|* CBlock::SetSize()
+|*
+|* Beschreibung Aendert die Groesse des Blocks
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void CBlock::SetSize( USHORT nNewSize )
+{
+ DBG_CHKTHIS( CBlock, DbgCheckCBlock );
+ DBG_ASSERT( nNewSize, "CBlock::SetSize(): nNewSize == 0" );
+
+ // Unterscheidet sich die Groesse
+ if ( nNewSize != nCount )
+ {
+ // Array erweitern
+ void** pNewNodes = new PVOID[nNewSize];
+
+ // Alte Tabelle in die Neue kopieren
+ if ( nNewSize < nCount )
+ memcpy( pNewNodes, pNodes, nNewSize*sizeof(PVOID) );
+ else
+ {
+ memcpy( pNewNodes, pNodes, nCount*sizeof(PVOID) );
+
+ // Array mit 0 initialisieren
+ memset( pNewNodes+nCount, 0, (nNewSize-nCount)*sizeof(PVOID) );
+ }
+
+ // Altes Array loeschen und neue Werte setzen
+ nSize = nNewSize;
+ nCount = nSize;
+ delete pNodes;
+ pNodes = pNewNodes;
+ }
+}
+
+//------------------------------------------------------------------------
+
+/*************************************************************************
+|*
+|* DbgCheckContainer()
+|*
+|* Beschreibung Pruefung eines Container fuer Debug-Utilities
+|* Ersterstellung MI 30.01.92
+|* Letzte Aenderung TH 24.01.96
+|*
+*************************************************************************/
+
+#ifdef DBG_UTIL
+const char* DbgCheckContainer( const void* pCont )
+{
+ Container* p = (Container*)pCont;
+
+ if ( p->nCount && (!p->pFirstBlock || !p->pLastBlock || !p->pCurBlock) )
+ return "nCount > 0 but no CBlocks";
+
+ return NULL;
+}
+#endif
+
+/*************************************************************************
+|*
+|* ImpCopyContainer()
+|*
+|* Beschreibung Kopiert alle Daten des Containers
+|* Ersterstellung TH 24.01.96
+|* Letzte Aenderung TH 24.01.96
+|*
+*************************************************************************/
+
+static void ImpCopyContainer( Container* pCont1, const Container* pCont2 )
+{
+ // Werte vom uebergebenen Container uebernehmen
+ pCont1->nCount = pCont2->nCount;
+ pCont1->nCurIndex = pCont2->nCurIndex;
+ pCont1->nInitSize = pCont2->nInitSize;
+ pCont1->nReSize = pCont2->nReSize;
+ pCont1->nBlockSize = pCont2->nBlockSize;
+
+ // Alle Bloecke kopieren
+ if ( pCont2->nCount )
+ {
+ CBlock* pBlock1;
+ CBlock* pBlock2;
+ CBlock* pTempBlock;
+
+ // Erstmal ersten Block kopieren
+ pBlock2 = pCont2->pFirstBlock;
+ pCont1->pFirstBlock = new CBlock( *pBlock2, NULL );
+ // Ist erster Block der Current-Block, dann Current-Block setzen
+ if ( pBlock2 == pCont2->pCurBlock )
+ pCont1->pCurBlock = pCont1->pFirstBlock;
+ pBlock1 = pCont1->pFirstBlock;
+ pBlock2 = pBlock2->GetNextBlock();
+ while ( pBlock2 )
+ {
+ // Neuen Block anlegen und aus der uebergebenen Liste kopieren
+ pTempBlock = new CBlock( *pBlock2, pBlock1 );
+ pBlock1->SetNextBlock( pTempBlock );
+ pBlock1 = pTempBlock;
+
+ // Current-Block beruecksichtigen
+ if ( pBlock2 == pCont2->pCurBlock )
+ pCont1->pCurBlock = pBlock1;
+
+ // Auf naechsten Block weitersetzen
+ pBlock2 = pBlock2->GetNextBlock();
+ }
+
+ // Letzten Block setzen
+ pCont1->pLastBlock = pBlock1;
+ }
+ else
+ {
+ pCont1->pFirstBlock = NULL;
+ pCont1->pLastBlock = NULL;
+ pCont1->pCurBlock = NULL;
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::Container()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+Container::Container( USHORT _nBlockSize, USHORT _nInitSize, USHORT _nReSize )
+{
+ DBG_CTOR( Container, DbgCheckContainer );
+
+ // BlockSize muss mindestens 4 sein und kleiner als 64 KB
+ if ( _nBlockSize < 4 )
+ nBlockSize = 4;
+ else
+ {
+ if ( _nBlockSize < CONTAINER_MAXBLOCKSIZE )
+ nBlockSize = _nBlockSize;
+ else
+ nBlockSize = CONTAINER_MAXBLOCKSIZE;
+ }
+
+ // ReSize muss mindestens 2 sein und kleiner als BlockSize
+ if ( _nReSize >= nBlockSize )
+ nReSize = nBlockSize;
+ else
+ {
+ if ( _nReSize < 2 )
+ nReSize = 2;
+ else
+ nReSize = _nReSize;
+
+ // BlockSize muss ein vielfaches der Resizegroesse sein
+ if ( nBlockSize % nReSize )
+ nBlockSize -= nReSize - (nBlockSize % nReSize);
+ }
+
+ // InitSize muss groesser gleich ReSize sein und kleiner als BlockSize
+ if ( _nInitSize <= nReSize )
+ nInitSize = nReSize;
+ else
+ {
+ if ( _nInitSize >= nBlockSize )
+ nInitSize = nBlockSize;
+ else
+ {
+ nInitSize = _nInitSize;
+
+ // InitSize muss ein vielfaches der Resizegroesse sein
+ if ( nInitSize % nReSize )
+ nInitSize -= nReSize - (nInitSize % nReSize);
+ }
+ }
+
+ // Werte initialisieren
+ pFirstBlock = NULL;
+ pLastBlock = NULL;
+ pCurBlock = NULL;
+ nCount = 0;
+ nCurIndex = 0;
+}
+
+/*************************************************************************
+|*
+|* Container::Container()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+Container::Container( ULONG nSize )
+{
+ DBG_CTOR( Container, DbgCheckContainer );
+
+ nCount = nSize;
+ nCurIndex = 0;
+ nBlockSize = CONTAINER_MAXBLOCKSIZE;
+ nInitSize = 1;
+ nReSize = 1;
+
+ if ( !nSize )
+ {
+ pFirstBlock = NULL;
+ pLastBlock = NULL;
+ pCurBlock = NULL;
+ }
+ else
+ {
+ // Muss mehr als ein Block angelegt werden
+ if ( nSize <= nBlockSize )
+ {
+ pFirstBlock = new CBlock( (USHORT)nSize, NULL );
+ pLastBlock = pFirstBlock;
+ }
+ else
+ {
+ CBlock* pBlock1;
+ CBlock* pBlock2;
+
+ pFirstBlock = new CBlock( nBlockSize, NULL );
+ pBlock1 = pFirstBlock;
+ nSize -= nBlockSize;
+
+ // Solange die Blockgroesse ueberschritten wird, neue Bloecke anlegen
+ while ( nSize > nBlockSize )
+ {
+ pBlock2 = new CBlock( nBlockSize, pBlock1 );
+ pBlock1->SetNextBlock( pBlock2 );
+ pBlock1 = pBlock2;
+ nSize -= nBlockSize;
+ }
+
+ pLastBlock = new CBlock( (USHORT)nSize, pBlock1 );
+ pBlock1->SetNextBlock( pLastBlock );
+ }
+
+ pCurBlock = pFirstBlock;
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::Container()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+Container::Container( const Container& r )
+{
+ DBG_CTOR( Container, DbgCheckContainer );
+
+ // Daten kopieren
+ ImpCopyContainer( this, &r );
+}
+
+/*************************************************************************
+|*
+|* Container::~Container()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+Container::~Container()
+{
+ DBG_DTOR( Container, DbgCheckContainer );
+
+ // Alle Bloecke loeschen
+ CBlock* pBlock = pFirstBlock;
+ while ( pBlock )
+ {
+ CBlock* pTemp = pBlock->GetNextBlock();
+ delete pBlock;
+ pBlock = pTemp;
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::ImpInsert()
+|*
+|* Beschreibung Interne Methode zum Einfuegen eines Pointers
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung DV 01.07.97
+|*
+*************************************************************************/
+
+void Container::ImpInsert( void* p, CBlock* pBlock, USHORT nIndex )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ if ( !nCount )
+ {
+ if ( !pBlock )
+ {
+ pFirstBlock = new CBlock( nInitSize, NULL, NULL );
+ pLastBlock = pFirstBlock;
+ pCurBlock = pFirstBlock;
+ }
+ pFirstBlock->Insert( p, nIndex, nReSize );
+ }
+ else
+ {
+ // Ist im Block die maximale Blockgroesse erreicht,
+ // dann neuen Block anlegen
+ if ( pBlock->Count() == nBlockSize )
+ {
+ // Block auftrennen
+ CBlock* pNewBlock = pBlock->Split( p, nIndex, nReSize );
+
+ // Wurde Block dahinter angehaegnt
+ if ( pBlock->pNext == pNewBlock )
+ {
+ // Gegebenenfalls LastBlock anpassen
+ if ( pBlock == pLastBlock )
+ pLastBlock = pNewBlock;
+
+ // Current-Position nachfuehren
+ if ( pBlock == pCurBlock )
+ {
+ if ( pBlock->nCount <= nCurIndex )
+ {
+ if ( nIndex <= nCurIndex )
+ nCurIndex++;
+ pCurBlock = pNewBlock;
+ nCurIndex -= pBlock->nCount;
+ }
+ }
+ }
+ else
+ {
+ // Gegebenenfalls FirstBlock anpassen
+ if ( pBlock == pFirstBlock )
+ pFirstBlock = pNewBlock;
+
+ // Current-Position nachfuehren
+ if ( pBlock == pCurBlock )
+ {
+ if ( nIndex <= nCurIndex )
+ nCurIndex++;
+ if ( pNewBlock->nCount <= nCurIndex )
+ nCurIndex -= pNewBlock->nCount;
+ else
+ pCurBlock = pNewBlock;
+ }
+ }
+ }
+ else
+ {
+ // Sonst reicht normales einfuegen in den Block
+ pBlock->Insert( p, nIndex, nReSize );
+
+ // Current-Position nachfuehren
+ if ( (pBlock == pCurBlock) && (nIndex <= nCurIndex) )
+ nCurIndex++;
+ }
+ }
+
+ // Ein neues Item im Container
+ nCount++;
+}
+
+/*************************************************************************
+|*
+|* Container::Insert()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void Container::Insert( void* p )
+{
+ ImpInsert( p, pCurBlock, nCurIndex );
+}
+
+/*************************************************************************
+|*
+|* Container::Insert()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void Container::Insert( void* p, ULONG nIndex )
+{
+ if ( nCount <= nIndex )
+ {
+ if ( pLastBlock )
+ ImpInsert( p, pLastBlock, pLastBlock->Count() );
+ else
+ ImpInsert( p, NULL, 0 );
+ }
+ else
+ {
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ while ( pTemp->Count() < nIndex )
+ {
+ nIndex -= pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ ImpInsert( p, pTemp, (USHORT)nIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::Insert()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void Container::Insert( void* pNew, void* pOld )
+{
+ ULONG nIndex = GetPos( pOld );
+ if ( nIndex != CONTAINER_ENTRY_NOTFOUND )
+ Insert( pNew, nIndex );
+}
+
+/*************************************************************************
+|*
+|* Container::ImpRemove()
+|*
+|* Beschreibung Interne Methode zum Entfernen eines Pointers
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::ImpRemove( CBlock* pBlock, USHORT nIndex )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ void* pOld;
+
+ // Ist Liste danach leer
+ if ( nCount == 1 )
+ {
+ // Block und CurIndex zuruecksetzen
+ pOld = pBlock->GetObject( nIndex );
+ pBlock->Reset();
+ nCurIndex = 0;
+ }
+ else
+ {
+ // Ist Block nach Remove leer
+ if ( pBlock->Count() == 1 )
+ {
+ // dann Block entfernen und Block-Pointer umsetzen
+ if ( pBlock->GetPrevBlock() )
+ (pBlock->GetPrevBlock())->SetNextBlock( pBlock->GetNextBlock() );
+ else
+ pFirstBlock = pBlock->GetNextBlock();
+
+ if ( pBlock->GetNextBlock() )
+ (pBlock->GetNextBlock())->SetPrevBlock( pBlock->GetPrevBlock() );
+ else
+ pLastBlock = pBlock->GetPrevBlock();
+
+ // Current-Position nachfuehren
+ if ( pBlock == pCurBlock )
+ {
+ if ( pBlock->GetNextBlock() )
+ {
+ pCurBlock = pBlock->GetNextBlock();
+ nCurIndex = 0;
+ }
+ else
+ {
+ pCurBlock = pBlock->GetPrevBlock();
+ nCurIndex = pCurBlock->Count()-1;
+ }
+ }
+
+ pOld = pBlock->GetObject( nIndex );
+ delete pBlock;
+ }
+ else
+ {
+ // Sonst Item aus dem Block entfernen
+ pOld = pBlock->Remove( nIndex, nReSize );
+
+ // Current-Position nachfuehren
+ if ( (pBlock == pCurBlock) &&
+ ((nIndex < nCurIndex) || ((nCurIndex == pBlock->Count()) && nCurIndex)) )
+ nCurIndex--;
+ }
+ }
+
+ // Jetzt gibt es ein Item weniger
+ nCount--;
+
+ // Und den Pointer zurueckgeben, der entfernt wurde
+ return pOld;
+}
+
+/*************************************************************************
+|*
+|* Container::Remove()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Remove()
+{
+ // Wenn kein Item vorhanden ist, NULL zurueckgeben
+ if ( !nCount )
+ return NULL;
+ else
+ return ImpRemove( pCurBlock, nCurIndex );
+}
+
+/*************************************************************************
+|*
+|* Container::Remove()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Remove( ULONG nIndex )
+{
+ // Ist Index nicht innerhalb des Containers, dann NULL zurueckgeben
+ if ( nCount <= nIndex )
+ return NULL;
+ else
+ {
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ while ( pTemp->Count() <= nIndex )
+ {
+ nIndex -= pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ return ImpRemove( pTemp, (USHORT)nIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::Replace()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Replace( void* p )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ if ( !nCount )
+ return NULL;
+ else
+ return pCurBlock->Replace( p, nCurIndex );
+}
+
+/*************************************************************************
+|*
+|* Container::Replace()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Replace( void* p, ULONG nIndex )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Index nicht innerhalb des Containers, dann NULL zurueckgeben
+ if ( nCount <= nIndex )
+ return NULL;
+ else
+ {
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ while ( pTemp->Count() <= nIndex )
+ {
+ nIndex -= pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ return pTemp->Replace( p, (USHORT)nIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::SetSize()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void Container::SetSize( ULONG nNewSize )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ if ( nNewSize )
+ {
+ // Unterscheiden sich die Groessen
+ if ( nNewSize != nCount )
+ {
+ CBlock* pTemp;
+ ULONG nTemp;
+
+ // Wird verkleinert
+ if ( nNewSize < nCount )
+ {
+ pTemp = pFirstBlock;
+ nTemp = 0;
+ while ( (nTemp+pTemp->Count()) < nNewSize )
+ {
+ nTemp += pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ // Alle folgenden Bloecke loeschen
+ BOOL bLast = FALSE;
+ CBlock* pDelNext;
+ CBlock* pDelBlock = pTemp->GetNextBlock();
+ while ( pDelBlock )
+ {
+ // Muss CurrentBlock umgesetzt werden
+ if ( pDelBlock == pCurBlock )
+ bLast = TRUE;
+ pDelNext = pDelBlock->GetNextBlock();
+ delete pDelBlock;
+ pDelBlock = pDelNext;
+ }
+
+ // Block in der Groesse anpassen, oder bei Groesse 0 loeschen
+ if ( nNewSize > nTemp )
+ {
+ pLastBlock = pTemp;
+ pTemp->SetNextBlock( NULL );
+ pTemp->SetSize( (USHORT)(nNewSize-nTemp) );
+ }
+ else
+ {
+ pLastBlock = pTemp->GetPrevBlock();
+ pLastBlock->SetNextBlock( NULL );
+ delete pTemp;
+ }
+
+ nCount = nNewSize;
+ if ( bLast )
+ {
+ pCurBlock = pLastBlock;
+ nCurIndex = pCurBlock->Count()-1;
+ }
+ }
+ else
+ {
+ // Auf den letzen Puffer setzen
+ pTemp = pLastBlock;
+ nTemp = nNewSize - nCount;
+
+ if ( !pTemp )
+ {
+ // Muss mehr als ein Block angelegt werden
+ if ( nNewSize <= nBlockSize )
+ {
+ pFirstBlock = new CBlock( (USHORT)nNewSize, NULL );
+ pLastBlock = pFirstBlock;
+ }
+ else
+ {
+ CBlock* pBlock1;
+ CBlock* pBlock2;
+
+ pFirstBlock = new CBlock( nBlockSize, NULL );
+ pBlock1 = pFirstBlock;
+ nNewSize -= nBlockSize;
+
+ // Solange die Blockgroesse ueberschritten wird, neue Bloecke anlegen
+ while ( nNewSize > nBlockSize )
+ {
+ pBlock2 = new CBlock( nBlockSize, pBlock1 );
+ pBlock1->SetNextBlock( pBlock2 );
+ pBlock1 = pBlock2;
+ nNewSize -= nBlockSize;
+ }
+
+ pLastBlock = new CBlock( (USHORT)nNewSize, pBlock1 );
+ pBlock1->SetNextBlock( pLastBlock );
+ }
+
+ pCurBlock = pFirstBlock;
+ }
+ // Reicht es, den letzen Puffer in der Groesse anzupassen
+ else if ( (nTemp+pTemp->Count()) <= nBlockSize )
+ pTemp->SetSize( (USHORT)(nTemp+pTemp->Count()) );
+ else
+ {
+ // Puffer auf max. Blockgroesse setzen
+ nTemp -= nBlockSize - pTemp->GetSize();
+ pTemp->SetSize( nBlockSize );
+
+ CBlock* pTemp2;
+ // Solange die Blockgroesse ueberschritten wird,
+ // neue Bloecke anlegen
+ while ( nTemp > nBlockSize )
+ {
+ pTemp2 = new CBlock( nBlockSize, pTemp );
+ pTemp->SetNextBlock( pTemp2 );
+ pTemp = pTemp2;
+ nTemp -= nBlockSize;
+ }
+
+ // Den letzten Block anlegen
+ if ( nTemp )
+ {
+ pLastBlock = new CBlock( (USHORT)nTemp, pTemp );
+ pTemp->SetNextBlock( pLastBlock );
+ }
+ else
+ pLastBlock = pTemp;
+ }
+
+ nCount = nNewSize;
+ }
+ }
+ }
+ else
+ Clear();
+}
+
+/*************************************************************************
+|*
+|* Container::Clear()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void Container::Clear()
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Erst alle Bloecke loeschen
+ CBlock* pBlock = pFirstBlock;
+ while ( pBlock )
+ {
+ CBlock* pTemp = pBlock->GetNextBlock();
+ delete pBlock;
+ pBlock = pTemp;
+ }
+
+ // Werte zuruecksetzen
+ pFirstBlock = NULL;
+ pLastBlock = NULL;
+ pCurBlock = NULL;
+ nCount = 0;
+ nCurIndex = 0;
+}
+
+/*************************************************************************
+|*
+|* Container::GetCurObject()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::GetCurObject() const
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // NULL, wenn Container leer
+ if ( !nCount )
+ return NULL;
+ else
+ return pCurBlock->GetObject( nCurIndex );
+}
+
+/*************************************************************************
+|*
+|* Container::GetCurPos()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+ULONG Container::GetCurPos() const
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // CONTAINER_ENTRY_NOTFOUND, wenn Container leer
+ if ( !nCount )
+ return CONTAINER_ENTRY_NOTFOUND;
+ else
+ {
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ ULONG nTemp = 0;
+ while ( pTemp != pCurBlock )
+ {
+ nTemp += pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ return nTemp+nCurIndex;
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::GetObjectPtr()
+|*
+|* Beschreibung Interne Methode fuer Referenz-Container
+|* Ersterstellung TH 26.01.93
+|* Letzte Aenderung TH 26.01.93
+|*
+*************************************************************************/
+
+void** Container::GetObjectPtr( ULONG nIndex )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Index nicht innerhalb des Containers, dann NULL zurueckgeben
+ if ( nCount <= nIndex )
+ return NULL;
+ else
+ {
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ while ( pTemp->Count() <= nIndex )
+ {
+ nIndex -= pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ // Item innerhalb des gefundenen Blocks zurueckgeben
+ return pTemp->GetObjectPtr( (USHORT)nIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::GetObject()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::GetObject( ULONG nIndex ) const
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Index nicht innerhalb des Containers, dann NULL zurueckgeben
+ if ( nCount <= nIndex )
+ return NULL;
+ else
+ {
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ while ( pTemp->Count() <= nIndex )
+ {
+ nIndex -= pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ // Item innerhalb des gefundenen Blocks zurueckgeben
+ return pTemp->GetObject( (USHORT)nIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::GetPos()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+ULONG Container::GetPos( const void* p ) const
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ void** pNodes;
+ CBlock* pTemp;
+ ULONG nTemp;
+ USHORT nBlockCount;
+ USHORT i;
+
+ // Block suchen
+ pTemp = pFirstBlock;
+ nTemp = 0;
+ while ( pTemp )
+ {
+ pNodes = pTemp->GetNodes();
+ i = 0;
+ nBlockCount = pTemp->Count();
+ while ( i < nBlockCount )
+ {
+ if ( p == *pNodes )
+ return nTemp+i;
+ pNodes++;
+ i++;
+ }
+ nTemp += nBlockCount;
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ return CONTAINER_ENTRY_NOTFOUND;
+}
+
+/*************************************************************************
+|*
+|* Container::GetPos()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 14.09.94
+|* Letzte Aenderung TH 14.09.94
+|*
+*************************************************************************/
+
+ULONG Container::GetPos( const void* p, ULONG nStartIndex,
+ BOOL bForward ) const
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Index nicht innerhalb des Containers, dann NOTFOUND zurueckgeben
+ if ( nCount <= nStartIndex )
+ return CONTAINER_ENTRY_NOTFOUND;
+ else
+ {
+ void** pNodes;
+ USHORT nBlockCount;
+ USHORT i;
+
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ ULONG nTemp = 0;
+ while ( nTemp+pTemp->Count() <= nStartIndex )
+ {
+ nTemp += pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ // Jetzt den Pointer suchen
+ if ( bForward )
+ {
+ // Alle Bloecke durchrsuchen
+ i = (USHORT)(nStartIndex - nTemp);
+ pNodes = pTemp->GetObjectPtr( i );
+ do
+ {
+ nBlockCount = pTemp->Count();
+ while ( i < nBlockCount )
+ {
+ if ( p == *pNodes )
+ return nTemp+i;
+ pNodes++;
+ i++;
+ }
+ nTemp += nBlockCount;
+ pTemp = pTemp->GetNextBlock();
+ if ( pTemp )
+ {
+ i = 0;
+ pNodes = pTemp->GetNodes();
+ }
+ else
+ break;
+ }
+ while ( TRUE );
+ }
+ else
+ {
+ // Alle Bloecke durchrsuchen
+ i = (USHORT)(nStartIndex-nTemp)+1;
+ pNodes = pTemp->GetObjectPtr( i-1 );
+ do
+ {
+ do
+ {
+ if ( p == *pNodes )
+ return nTemp+i-1;
+ pNodes--;
+ i--;
+ }
+ while ( i );
+ nTemp -= pTemp->Count();
+ pTemp = pTemp->GetPrevBlock();
+ if ( pTemp )
+ {
+ i = pTemp->Count();
+ // Leere Bloecke in der Kette darf es nicht geben. Nur
+ // wenn ein Block existiert, darf dieser leer sein
+ pNodes = pTemp->GetObjectPtr( i-1 );
+ }
+ else
+ break;
+ }
+ while ( TRUE );
+ }
+ }
+
+ return CONTAINER_ENTRY_NOTFOUND;
+}
+
+/*************************************************************************
+|*
+|* Container::Seek()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Seek( ULONG nIndex )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist der Container leer, dann NULL zurueckgeben
+ if ( nCount <= nIndex )
+ return NULL;
+ else
+ {
+ // Block suchen
+ CBlock* pTemp = pFirstBlock;
+ while ( pTemp->Count() <= nIndex )
+ {
+ nIndex -= pTemp->Count();
+ pTemp = pTemp->GetNextBlock();
+ }
+
+ // Item innerhalb des gefundenen Blocks zurueckgeben
+ pCurBlock = pTemp;
+ nCurIndex = (USHORT)nIndex;
+ return pCurBlock->GetObject( nCurIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::First()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::First()
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Container leer, dann NULL zurueckgeben
+ if ( !nCount )
+ return NULL;
+ else
+ {
+ // Block und Index setzen und ersten Pointer zurueckgeben
+ pCurBlock = pFirstBlock;
+ nCurIndex = 0;
+ return pCurBlock->GetObject( nCurIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::Last()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Last()
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Container leer, dann NULL zurueckgeben
+ if ( !nCount )
+ return NULL;
+ else
+ {
+ // Block und Index setzen und ersten Pointer zurueckgeben
+ pCurBlock = pLastBlock;
+ nCurIndex = pCurBlock->Count()-1;
+ return pCurBlock->GetObject( nCurIndex );
+ }
+}
+
+/*************************************************************************
+|*
+|* Container::Next()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Next()
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Container leer, dann NULL zurueckgeben, ansonsten preufen ob
+ // naechste Position noch im aktuellen Block ist. Falls nicht, dann
+ // einen Block weiterschalten (geht ohne Gefahr, da leere Bloecke
+ // nicht vorkommen duerfen, es sein denn, es ist der einzige).
+ if ( !nCount )
+ return NULL;
+ else if ( (nCurIndex+1) < pCurBlock->Count() )
+ return pCurBlock->GetObject( ++nCurIndex );
+ else if ( pCurBlock->GetNextBlock() )
+ {
+ pCurBlock = pCurBlock->GetNextBlock();
+ nCurIndex = 0;
+ return pCurBlock->GetObject( nCurIndex );
+ }
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Container::Prev()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+void* Container::Prev()
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Ist Container leer, dann NULL zurueckgeben, ansonsten preufen ob
+ // vorherige Position noch im aktuellen Block ist. Falls nicht, dann
+ // einen Block zurueckschalten (geht ohne Gefahr, da leere Bloecke
+ // nicht vorkommen duerfen, es sein denn, es ist der einzige).
+ if ( !nCount )
+ return NULL;
+ else if ( nCurIndex )
+ return pCurBlock->GetObject( --nCurIndex );
+ else if ( pCurBlock->GetPrevBlock() )
+ {
+ pCurBlock = pCurBlock->GetPrevBlock();
+ nCurIndex = pCurBlock->Count() - 1;
+ return pCurBlock->GetObject( nCurIndex );
+ }
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* Container::operator =()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+Container& Container::operator =( const Container& r )
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ // Erst alle Bloecke loeschen
+ CBlock* pBlock = pFirstBlock;
+ while ( pBlock )
+ {
+ CBlock* pTemp = pBlock->GetNextBlock();
+ delete pBlock;
+ pBlock = pTemp;
+ }
+
+ // Daten kopieren
+ ImpCopyContainer( this, &r );
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Container::operator ==()
+|*
+|* Beschreibung CONTNR.SDW
+|* Ersterstellung TH 17.09.91
+|* Letzte Aenderung TH 17.09.91
+|*
+*************************************************************************/
+
+BOOL Container::operator ==( const Container& r ) const
+{
+ DBG_CHKTHIS( Container, DbgCheckContainer );
+
+ if ( nCount != r.nCount )
+ return FALSE;
+
+ ULONG i = 0;
+ while ( i < nCount )
+ {
+ if ( GetObject( i ) != r.GetObject( i ) )
+ return FALSE;
+ i++;
+ }
+
+ return TRUE;
+}
diff --git a/tools/source/memtools/makefile.mk b/tools/source/memtools/makefile.mk
new file mode 100644
index 000000000000..bc8e84bf15b1
--- /dev/null
+++ b/tools/source/memtools/makefile.mk
@@ -0,0 +1,92 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=mtools
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/contnr.obj \
+ $(SLO)$/table.obj \
+ $(SLO)$/unqidx.obj \
+ $(SLO)$/mempool.obj \
+ $(SLO)$/multisel.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/contnr.obj \
+ $(OBJ)$/table.obj \
+ $(OBJ)$/unqidx.obj \
+ $(OBJ)$/mempool.obj \
+ $(OBJ)$/multisel.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/memtools/mempool.cxx b/tools/source/memtools/mempool.cxx
new file mode 100644
index 000000000000..25d4149bcdb4
--- /dev/null
+++ b/tools/source/memtools/mempool.cxx
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *
+ * $RCSfile: mempool.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define private public
+
+#include <limits.h>
+
+#include <debug.hxx>
+#include <mempool.hxx>
+
+// -----------------------------------------------------------------------
+
+#if ( __ALIGNMENT8 > 4 )
+#define MEMPOOL_ALIGNMENT __ALIGNMENT8
+#else
+#define MEMPOOL_ALIGNMENT 4
+#endif
+
+// -----------------
+// - FixedMemBlock -
+// -----------------
+
+struct FixedMemBlock
+{
+ USHORT nSize;
+ USHORT nFree;
+ USHORT nFirst;
+ USHORT nDummyAlign1;
+ FixedMemBlock* pNext;
+#if (__SIZEOFPOINTER == 4) && (__ALIGNMENT8 == 8)
+ void* pDummyAlign2;
+#endif
+ char aData[1];
+};
+
+/*************************************************************************
+|*
+|* ImpDbgPoolTest()
+|*
+|* Beschreibung MEMPOOL.SDW
+|* Ersterstellung TH 30.11.94
+|* Letzte Aenderung TH 30.11.94
+|*
+*************************************************************************/
+
+#ifdef DBG_UTIL
+
+static void ImpDbgPoolTest( FixedMemPool* pMemPool )
+{
+ DbgData* pData = DbgGetData();
+
+ if ( !pData )
+ return;
+
+ if ( !(pData->nTestFlags & (DBG_TEST_MEM_OVERWRITE | DBG_TEST_MEM_OVERWRITEFREE)) )
+ return;
+
+ FixedMemBlock* pFirst = pMemPool->pFirst;
+ FixedMemBlock* pBlock = pFirst;
+ while ( pBlock )
+ {
+ if ( pBlock->nFree )
+ {
+ USHORT i = pBlock->nFree;
+ USHORT n = pBlock->nFirst;
+ char* pData = pBlock->aData;
+ while ( i )
+ {
+ if ( !(n < (pBlock->nSize/pMemPool->nTypeSize)) )
+ DbgError( "MemPool: Memory Overwrite" );
+
+ char* pNext = pData+(n*pMemPool->nTypeSize);
+ n = *((USHORT*)pNext);
+ i--;
+ }
+ }
+
+ pBlock = pBlock->pNext;
+ }
+}
+
+#endif
+
+/*************************************************************************
+|*
+|* FixedMemPool::FixedMemPool()
+|*
+|* Beschreibung MEMPOOL.SDW
+|* Ersterstellung TH 02.09.94
+|* Letzte Aenderung TH 02.09.94
+|*
+*************************************************************************/
+
+FixedMemPool::FixedMemPool( USHORT _nTypeSize,
+ USHORT _nInitSize, USHORT _nGrowSize )
+{
+ pFirst = NULL;
+ nInitSize = _nInitSize;
+ nGrowSize = _nGrowSize;
+
+ if ( _nTypeSize > 4 )
+ nTypeSize = (_nTypeSize + (MEMPOOL_ALIGNMENT-1)) & ~(MEMPOOL_ALIGNMENT-1);
+ else if ( _nTypeSize <= 2 )
+ nTypeSize = 2;
+ else
+ nTypeSize = 4;
+
+ DBG_ASSERT( (ULONG)nTypeSize*nInitSize <= USHRT_MAX,
+ "FixedMemPool: TypeSize*nInitSize > USHRT_MAX" );
+ DBG_ASSERT( (ULONG)nTypeSize*nGrowSize <= USHRT_MAX,
+ "FixedMemPool: TypeSize*GrowSize > USHRT_MAX" );
+}
+
+/*************************************************************************
+|*
+|* FixedMemPool::~FixedMemPool()
+|*
+|* Beschreibung MEMPOOL.SDW
+|* Ersterstellung TH 02.09.94
+|* Letzte Aenderung TH 02.09.94
+|*
+*************************************************************************/
+
+FixedMemPool::~FixedMemPool()
+{
+ FixedMemBlock* pBlock = pFirst;
+ while ( pBlock )
+ {
+ FixedMemBlock* pTemp = pBlock;
+ pBlock = pBlock->pNext;
+ delete pTemp;
+ }
+}
+
+/*************************************************************************
+|*
+|* FixedMemPool::Alloc()
+|*
+|* Beschreibung MEMPOOL.SDW
+|* Ersterstellung TH 02.09.94
+|* Letzte Aenderung TH 02.09.94
+|*
+*************************************************************************/
+
+void* FixedMemPool::Alloc()
+{
+#ifdef DBG_UTIL
+ ImpDbgPoolTest( this );
+#endif
+
+ USHORT i;
+ char* pData;
+
+ if ( !pFirst )
+ {
+ pFirst = (FixedMemBlock*)new char[sizeof(FixedMemBlock)-1+(nInitSize*nTypeSize)];
+
+ if ( !pFirst )
+ return NULL;
+
+ pFirst->pNext = NULL;
+ pFirst->nSize = nInitSize*nTypeSize;;
+ pFirst->nFree = nInitSize-1;
+ pFirst->nFirst = 1;
+
+ pData = pFirst->aData;
+ for ( i = 1; i < nInitSize; i++ )
+ {
+ *((USHORT*)pData) = i;
+ pData += nTypeSize;
+ }
+
+ return (void*)(pFirst->aData);
+ }
+
+ FixedMemBlock* pBlock = pFirst;
+ while ( pBlock && !pBlock->nFree )
+ pBlock = pBlock->pNext;
+
+ if ( pBlock )
+ {
+ pData = pBlock->aData;
+ char* pFree = pData+(pBlock->nFirst*nTypeSize);
+ pBlock->nFirst = *((USHORT*)pFree); // UMR, wenn letzter freier Block, ist OK
+ pBlock->nFree--;
+ return (void*)pFree;
+ }
+ else
+ {
+ if ( !nGrowSize )
+ return NULL;
+
+ pBlock = (FixedMemBlock*)new char[sizeof(FixedMemBlock)-1+(nGrowSize*nTypeSize)];
+
+ if ( !pBlock )
+ return NULL;
+
+ pData = pBlock->aData;
+ for ( i = 1; i < nGrowSize; i++ )
+ {
+ *((USHORT*)pData) = i;
+ pData += nTypeSize;
+ }
+
+ pBlock->pNext = pFirst->pNext;
+ pBlock->nSize = nGrowSize*nTypeSize;
+ pBlock->nFree = nGrowSize-1;
+ pBlock->nFirst = 1;
+ pFirst->pNext = pBlock;
+
+ return (void*)(pBlock->aData);
+ }
+}
+
+/*************************************************************************
+|*
+|* FixedMemPool::Free()
+|*
+|* Beschreibung MEMPOOL.SDW
+|* Ersterstellung TH 02.09.94
+|* Letzte Aenderung TH 02.09.94
+|*
+*************************************************************************/
+
+void FixedMemPool::Free( void* pFree )
+{
+ if ( !pFree )
+ return;
+
+#ifdef DBG_UTIL
+ ImpDbgPoolTest( this );
+#endif
+
+ FixedMemBlock* pBlock = pFirst;
+ FixedMemBlock* pPrev = NULL;
+ while ( ((ULONG)pBlock->aData > (ULONG)pFree) ||
+ ((ULONG)pFree >= ((ULONG)pBlock->aData+pBlock->nSize)) )
+ {
+ pPrev = pBlock;
+ pBlock = pBlock->pNext;
+
+#ifdef DBG_UTIL
+ DBG_ASSERT( pBlock, "FixedMemPool - Delete: Wrong Pointer" );
+#endif
+ }
+
+ pBlock->nFree++;
+ *((USHORT*)pFree) = pBlock->nFirst;
+ pBlock->nFirst = (USHORT)(((ULONG)pFree-(ULONG)(pBlock->aData)) / nTypeSize);
+
+ if ( pPrev && (pBlock->nFree*nTypeSize == pBlock->nSize) )
+ {
+ pPrev->pNext = pBlock->pNext;
+ delete pBlock;
+ }
+ else
+ {
+ if ( pPrev )
+ {
+ pPrev->pNext = pBlock->pNext;
+ pBlock->pNext = pFirst->pNext;
+ pFirst->pNext = pBlock;
+ }
+ }
+}
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx
new file mode 100644
index 000000000000..8bd47a028019
--- /dev/null
+++ b/tools/source/memtools/multisel.cxx
@@ -0,0 +1,897 @@
+/*************************************************************************
+ *
+ * $RCSfile: multisel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_MULTISEL_CXX
+
+#ifdef MI_DEBUG
+#define private public
+#include <stdio.h>
+#endif
+
+#include <debug.hxx>
+#include <multisel.hxx>
+
+#pragma hdrstop
+
+#ifdef MI_DEBUG
+#define DBG(x) x
+#else
+#define DBG(x)
+#endif
+
+//==================================================================
+
+#ifdef MI_DEBUG
+
+static void Print( const MultiSelection* pSel )
+{
+ DbgOutf( "TotRange: %4ld-%4ld\n",
+ pSel->aTotRange.Min(), pSel->aTotRange.Max() );
+ if ( pSel->bCurValid )
+ {
+ DbgOutf( "CurSubSel: %4ld\n", pSel->nCurSubSel );
+ DbgOutf( "CurIndex: %4ld\n", pSel->nCurIndex );
+ }
+ DbgOutf( "SelCount: %4ld\n", pSel->nSelCount );
+ DbgOutf( "SubCount: %4ld\n", pSel->aSels.Count() );
+ for ( ULONG nPos = 0; nPos < pSel->aSels.Count(); ++nPos )
+ {
+ DbgOutf( "SubSel #%2ld: %4ld-%4ld\n", nPos,
+ pSel->aSels.GetObject(nPos)->Min(),
+ pSel->aSels.GetObject(nPos)->Max() );
+ }
+ DbgOutf( "\n" );
+ fclose( pFile );
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+void MultiSelection::ImplClear()
+{
+ // no selected indexes
+ nSelCount = 0;
+
+ Range* pRange = aSels.First();
+ while ( pRange )
+ {
+ delete pRange;
+ pRange = aSels.Next();
+ }
+ aSels.Clear();
+}
+
+// -----------------------------------------------------------------------
+
+ULONG MultiSelection::ImplFindSubSelection( long nIndex ) const
+{
+ // iterate through the sub selections
+ ULONG n = 0;
+ for ( ;
+ n < aSels.Count() && nIndex > aSels.GetObject(n)->Max();
+ ++n ) {} /* empty loop */
+ return n;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MultiSelection::ImplMergeSubSelections( ULONG nPos1, ULONG nPos2 )
+{
+ // didn't a sub selection at nPos2 exist?
+ if ( nPos2 >= aSels.Count() )
+ return FALSE;
+
+ // did the sub selections touch each other?
+ if ( (aSels.GetObject(nPos1)->Max() + 1) == aSels.GetObject(nPos2)->Min() )
+ {
+ // merge them
+ aSels.GetObject(nPos1)->Max() = aSels.GetObject(nPos2)->Max();
+ delete aSels.Remove(nPos2);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+MultiSelection::MultiSelection():
+ aTotRange( 0, -1 ),
+ nSelCount(0),
+ nCurSubSel(0),
+ bCurValid(FALSE),
+ bSelectNew(FALSE)
+{
+}
+
+// -----------------------------------------------------------------------
+
+MultiSelection::MultiSelection( const UniString& rString, sal_Unicode cRange, sal_Unicode cSep ):
+ aTotRange(0,RANGE_MAX),
+ nSelCount(0),
+ nCurSubSel(0),
+ bCurValid(FALSE),
+ bSelectNew(FALSE)
+{
+ // Dies ist nur ein Schnellschuss und sollte bald optimiert,
+ // an die verschiedenen Systeme (MAC, UNIX etc.)
+ // und die gewuenschte Eingabe-Syntax angepasst werden.
+
+ UniString aStr( rString );
+ sal_Unicode* pStr = aStr.GetBufferAccess();
+ sal_Unicode* pOld = pStr;
+ BOOL bReady = FALSE;
+ BOOL bUntil = FALSE;
+ xub_StrLen nCut = 0;
+
+ // Hier normieren wir den String, sodass nur Ziffern,
+ // Semikola als Trenn- und Minus als VonBis-Zeichen
+ // uebrigbleiben, z.B. "99-117;55;34;-17;37-43"
+ while ( *pOld )
+ {
+ switch( *pOld )
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ DBG_ASSERT( *pOld != cRange, "digit for range char not allowed" );
+ DBG_ASSERT( *pOld != cSep, "digit for separator not allowed" );
+ if( bReady )
+ {
+ *pStr++ = ';';
+ nCut++;
+ bReady = FALSE;
+ }
+ *pStr++ = *pOld;
+ nCut++;
+ bUntil = FALSE;
+ break;
+
+ case '-':
+ case ':':
+ case '/':
+ if ( *pOld != cSep )
+ {
+ if ( !bUntil )
+ {
+ *pStr++ = '-';
+ nCut++;
+ bUntil = TRUE;
+ }
+ bReady = FALSE;
+ }
+ else
+ bReady = TRUE;
+ break;
+
+ case ' ':
+ DBG_ASSERT( *pOld != cRange, "SPACE for range char not allowed" );
+ DBG_ASSERT( *pOld != cSep, "SPACE for separator not allowed" );
+ bReady = !bUntil;
+ break;
+
+ default:
+ if ( *pOld == cRange )
+ {
+ if ( !bUntil )
+ {
+ *pStr++ = '-';
+ nCut++;
+ bUntil = TRUE;
+ }
+ bReady = FALSE;
+ }
+ else
+ bReady = TRUE;
+ break;
+ }
+
+ pOld++;
+ }
+ aStr.ReleaseBufferAccess( nCut );
+
+ // Jetzt wird der normierte String ausgewertet ..
+ UniString aNumStr;
+ Range aRg( 1, RANGE_MAX );
+ const sal_Unicode* pCStr = aStr.GetBuffer();
+ long nPage = 1;
+ long nNum = 1;
+ bUntil = FALSE;
+ while ( *pCStr )
+ {
+ switch ( *pCStr )
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ aNumStr += *pCStr;
+ break;
+ case ';':
+ nNum = aNumStr.ToInt32();
+ if ( bUntil )
+ {
+ if ( !aNumStr.Len() )
+ nNum = RANGE_MAX;
+ aRg.Min() = nPage;
+ aRg.Max() = nNum;
+ aRg.Justify();
+ Select( aRg );
+ }
+ else
+ Select( nNum );
+ nPage = 0;
+ aNumStr.Erase();
+ bUntil = FALSE;
+ break;
+
+ case '-':
+ nPage = aNumStr.ToInt32();
+ aNumStr.Erase();
+ bUntil = TRUE;
+ break;
+ }
+
+ pCStr++;
+ }
+
+ nNum = aNumStr.ToInt32();
+ if ( bUntil )
+ {
+ if ( !aNumStr.Len() )
+ nNum = RANGE_MAX;
+ aRg.Min() = nPage;
+ aRg.Max() = nNum;
+ aRg.Justify();
+ Select( aRg );
+ }
+ else
+ Select( nNum );
+}
+
+// -----------------------------------------------------------------------
+
+MultiSelection::MultiSelection( const MultiSelection& rOrig ) :
+ aTotRange(rOrig.aTotRange),
+ bCurValid(rOrig.bCurValid),
+ nSelCount(rOrig.nSelCount),
+ bSelectNew(FALSE)
+{
+ if ( bCurValid )
+ {
+ nCurSubSel = rOrig.nCurSubSel;
+ nCurIndex = rOrig.nCurIndex;
+ }
+
+ // copy the sub selections
+ for ( ULONG n = 0; n < rOrig.aSels.Count(); ++n )
+ aSels.Insert( new Range( *rOrig.aSels.GetObject(n) ), LIST_APPEND );
+}
+
+// -----------------------------------------------------------------------
+
+MultiSelection::MultiSelection( const Range& rRange ):
+ aTotRange(rRange),
+ nSelCount(0),
+ nCurSubSel(0),
+ bCurValid(FALSE),
+ bSelectNew(FALSE)
+{
+}
+
+// -----------------------------------------------------------------------
+
+MultiSelection::~MultiSelection()
+{
+ Range* pRange = aSels.First();
+ while ( pRange )
+ {
+ delete pRange;
+ pRange = aSels.Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MultiSelection& MultiSelection::operator= ( const MultiSelection& rOrig )
+{
+ aTotRange = rOrig.aTotRange;
+ bCurValid = rOrig.bCurValid;
+ if ( bCurValid )
+ {
+ nCurSubSel = rOrig.nCurSubSel;
+ nCurIndex = rOrig.nCurIndex;
+ }
+
+ // clear the old and copy the sub selections
+ ImplClear();
+ for ( ULONG n = 0; n < rOrig.aSels.Count(); ++n )
+ aSels.Insert( new Range( *rOrig.aSels.GetObject(n) ), LIST_APPEND );
+ nSelCount = rOrig.nSelCount;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MultiSelection::operator== ( MultiSelection& rWith )
+{
+ if ( aTotRange != rWith.aTotRange || nSelCount != rWith.nSelCount ||
+ aSels.Count() != rWith.aSels.Count() )
+ return FALSE;
+
+ // compare the sub seletions
+ for ( ULONG n = 0; n < aSels.Count(); ++n )
+ if ( *aSels.GetObject(n) != *rWith.aSels.GetObject(n) )
+ return FALSE;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void MultiSelection::SelectAll( BOOL bSelect )
+{
+ DBG(DbgOutf( "::SelectAll(%s)\n", bSelect ? "TRUE" : "FALSE" ));
+
+ ImplClear();
+ if ( bSelect )
+ {
+ aSels.Insert( new Range(aTotRange), LIST_APPEND );
+ nSelCount = aTotRange.Len();
+ }
+
+ DBG(Print( this ));
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MultiSelection::Select( long nIndex, BOOL bSelect )
+{
+ DBG_ASSERT( aTotRange.IsInside(nIndex), "selected index out of range" );
+
+ // out of range?
+ if ( !aTotRange.IsInside(nIndex) )
+ return FALSE;
+
+ // find the virtual target position
+ ULONG nSubSelPos = ImplFindSubSelection( nIndex );
+
+ if ( bSelect )
+ {
+ // is it included in the found sub selection?
+ if ( nSubSelPos < aSels.Count() &&
+ aSels.GetObject(nSubSelPos)->IsInside( nIndex ) )
+ // already selected, nothing to do
+ return FALSE;
+
+ // it will become selected
+ ++nSelCount;
+
+ // is it at the end of the previous sub selection
+ if ( nSubSelPos > 0 &&
+ aSels.GetObject(nSubSelPos-1)->Max() == (nIndex-1) )
+ {
+ // expand the previous sub selection
+ aSels.GetObject(nSubSelPos-1)->Max() = nIndex;
+
+ // try to merge the previous sub selection
+ ImplMergeSubSelections( nSubSelPos-1, nSubSelPos );
+ }
+ // is is at the beginning of the found sub selection
+ else if ( nSubSelPos < aSels.Count() &&
+ aSels.GetObject(nSubSelPos)->Min() == (nIndex+1) )
+ // expand the found sub selection
+ aSels.GetObject(nSubSelPos)->Min() = nIndex;
+ else
+ {
+ // create a new sub selection
+ aSels.Insert( new Range( nIndex, nIndex ), nSubSelPos );
+ if ( bCurValid && nCurSubSel >= nSubSelPos )
+ ++nCurSubSel;
+ }
+ }
+ else
+ {
+ // is it excluded from the found sub selection?
+ if ( nSubSelPos >= aSels.Count() ||
+ !aSels.GetObject(nSubSelPos)->IsInside( nIndex ) )
+ {
+ // not selected, nothing to do
+ DBG(Print( this ));
+ return FALSE;
+ }
+
+ // it will become deselected
+ --nSelCount;
+
+ // is it the only index in the found sub selection?
+ if ( aSels.GetObject(nSubSelPos)->Len() == 1 )
+ {
+ // remove the complete sub selection
+ delete aSels.Remove( nSubSelPos );
+ DBG(Print( this ));
+ return TRUE;
+ }
+
+ // is it at the beginning of the found sub selection?
+ if ( aSels.GetObject(nSubSelPos)->Min() == nIndex )
+ ++aSels.GetObject(nSubSelPos)->Min();
+ // is it at the end of the found sub selection?
+ else if ( aSels.GetObject(nSubSelPos)->Max() == nIndex )
+ --aSels.GetObject(nSubSelPos)->Max();
+ // it is in the middle of the found sub selection?
+ else
+ {
+ // split the sub selection
+ aSels.Insert(
+ new Range( aSels.GetObject(nSubSelPos)->Min(), nIndex-1 ),
+ nSubSelPos );
+ aSels.GetObject(nSubSelPos+1)->Min() = nIndex + 1;
+ }
+ }
+
+ DBG(Print( this ));
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void MultiSelection::Select( const Range& rIndexRange, BOOL bSelect )
+{
+ Range* pRange;
+ long nOld;
+
+ ULONG nTmpMin = rIndexRange.Min();
+ ULONG nTmpMax = rIndexRange.Max();
+ ULONG nCurMin = FirstSelected();
+ ULONG nCurMax = LastSelected();
+ DBG_ASSERT(aTotRange.IsInside(nTmpMax), "selected index out of range" );
+ DBG_ASSERT(aTotRange.IsInside(nTmpMin), "selected index out of range" );
+
+ // gesamte Selektion ersetzen ?
+ if( nTmpMin <= nCurMin && nTmpMax >= nCurMax )
+ {
+ ImplClear();
+ if ( bSelect )
+ {
+ aSels.Insert( new Range(rIndexRange), LIST_APPEND );
+ nSelCount = rIndexRange.Len();
+ }
+ return;
+ }
+ // links erweitern ?
+ if( nTmpMax < nCurMin )
+ {
+ if( bSelect )
+ {
+ // ersten Range erweitern ?
+ if( nCurMin > (nTmpMax+1) )
+ {
+ pRange = new Range( rIndexRange );
+ aSels.Insert( pRange, (ULONG)0 );
+ nSelCount += pRange->Len();
+ }
+ else
+ {
+ pRange = aSels.First();
+ nOld = pRange->Min();
+ pRange->Min() = (long)nTmpMin;
+ nSelCount += ( nOld - nTmpMin );
+ }
+ bCurValid = FALSE;
+ }
+ return;
+ }
+ // rechts erweitern ?
+ else if( nTmpMin > nCurMax )
+ {
+ if( bSelect )
+ {
+ // letzten Range erweitern ?
+ if( nTmpMin > (nCurMax+1) )
+ {
+ pRange = new Range( rIndexRange );
+ aSels.Insert( pRange, LIST_APPEND );
+ nSelCount += pRange->Len();
+ }
+ else
+ {
+ pRange = aSels.Last();
+ nOld = pRange->Max();
+ pRange->Max() = (long)nTmpMax;
+ nSelCount += ( nTmpMax - nOld );
+ }
+ bCurValid = FALSE;
+ }
+ return;
+ }
+
+ //HACK(Hier muss noch optimiert werden)
+ while( nTmpMin <= nTmpMax )
+ {
+ Select( nTmpMin, bSelect );
+ nTmpMin++;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MultiSelection::IsSelected( long nIndex ) const
+{
+ // find the virtual target position
+ ULONG nSubSelPos = ImplFindSubSelection( nIndex );
+
+ return nSubSelPos < aSels.Count() &&
+ aSels.GetObject(nSubSelPos)->IsInside(nIndex);
+}
+
+// -----------------------------------------------------------------------
+
+void MultiSelection::Insert( long nIndex, long nCount )
+{
+ DBG(DbgOutf( "::Insert(%ld, %ld)\n", nIndex, nCount ));
+
+ // find the virtual target position
+ ULONG nSubSelPos = ImplFindSubSelection( nIndex );
+
+ // did we need to shift the sub selections?
+ if ( nSubSelPos < aSels.Count() )
+ {
+ // did we insert an unselected into an existing sub selection?
+ if ( !bSelectNew && aSels.GetObject(nSubSelPos)->Min() != nIndex &&
+ aSels.GetObject(nSubSelPos)->IsInside(nIndex) )
+ {
+ // split the sub selection
+ aSels.Insert(
+ new Range( aSels.GetObject(nSubSelPos)->Min(), nIndex-1 ),
+ nSubSelPos );
+ ++nSubSelPos;
+ aSels.GetObject(nSubSelPos)->Min() = nIndex;
+ }
+
+ // did we append an selected to an existing sub selection?
+ else if ( bSelectNew && nSubSelPos > 0 &&
+ aSels.GetObject(nSubSelPos)->Max() == nIndex-1 )
+ // expand the previous sub selection
+ aSels.GetObject(nSubSelPos-1)->Max() += nCount;
+
+ // did we insert an selected into an existing sub selection?
+ else if ( bSelectNew && aSels.GetObject(nSubSelPos)->Min() == nIndex )
+ {
+ // expand the sub selection
+ aSels.GetObject(nSubSelPos)->Max() += nCount;
+ ++nSubSelPos;
+ }
+
+ // shift the sub selections behind the inserting position
+ for ( ULONG nPos = nSubSelPos; nPos < aSels.Count(); ++nPos )
+ {
+ aSels.GetObject(nPos)->Min() += nCount;
+ aSels.GetObject(nPos)->Max() += nCount;
+ }
+ }
+
+ bCurValid = FALSE;
+ aTotRange.Max() += nCount;
+ if ( bSelectNew )
+ nSelCount += nCount;
+
+ DBG(Print( this ));
+}
+
+// -----------------------------------------------------------------------
+
+void MultiSelection::Remove( long nIndex )
+{
+ DBG(DbgOutf( "::Remove(%ld)\n", nIndex ));
+
+ // find the virtual target position
+ ULONG nSubSelPos = ImplFindSubSelection( nIndex );
+
+ // did we remove from an existing sub selection?
+ if ( nSubSelPos < aSels.Count() &&
+ aSels.GetObject(nSubSelPos)->IsInside(nIndex) )
+ {
+ // does this sub selection only contain the index to be deleted
+ if ( aSels.GetObject(nSubSelPos)->Len() == 1 )
+ // completely remove the sub selection
+ aSels.Remove(nSubSelPos);
+ else
+ // shorten this sub selection
+ --( aSels.GetObject(nSubSelPos++)->Max() );
+
+ // adjust the selected counter
+ --nSelCount;
+ }
+
+ // shift the sub selections behind the removed index
+ for ( ULONG nPos = nSubSelPos; nPos < aSels.Count(); ++nPos )
+ {
+ --( aSels.GetObject(nPos)->Min() );
+ --( aSels.GetObject(nPos)->Max() );
+ }
+
+ bCurValid = FALSE;
+ aTotRange.Max() -= 1;
+
+ DBG(Print( this ));
+}
+
+// -----------------------------------------------------------------------
+
+void MultiSelection::Append( long nCount )
+{
+ long nPrevLast = aTotRange.Max();
+ aTotRange.Max() += nCount;
+ if ( bSelectNew )
+ {
+ nSelCount += nCount;
+ aSels.Insert( new Range( nPrevLast+1, nPrevLast + nCount ),
+ LIST_APPEND );
+ if ( aSels.Count() > 1 )
+ ImplMergeSubSelections( aSels.Count() - 2, aSels.Count() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long MultiSelection::ImplFwdUnselected()
+{
+ if ( !bCurValid )
+ return SFX_ENDOFSELECTION;
+
+ if ( ( nCurSubSel < aSels.Count() ) &&
+ ( aSels.GetObject(nCurSubSel)->Min() <= nCurIndex ) )
+ nCurIndex = aSels.GetObject(nCurSubSel++)->Max() + 1;
+
+ if ( nCurIndex <= aTotRange.Max() )
+ return nCurIndex;
+ else
+ return SFX_ENDOFSELECTION;
+}
+
+// -----------------------------------------------------------------------
+
+long MultiSelection::ImplBwdUnselected()
+{
+ if ( !bCurValid )
+ return SFX_ENDOFSELECTION;
+
+ if ( aSels.GetObject(nCurSubSel)->Max() < nCurIndex )
+ return nCurIndex;
+
+ nCurIndex = aSels.GetObject(nCurSubSel--)->Min() - 1;
+ if ( nCurIndex >= 0 )
+ return nCurIndex;
+ else
+ return SFX_ENDOFSELECTION;
+}
+
+// -----------------------------------------------------------------------
+
+long MultiSelection::FirstSelected( BOOL bInverse )
+{
+ bInverseCur = bInverse;
+ nCurSubSel = 0;
+
+ if ( bInverseCur )
+ {
+ bCurValid = nSelCount < ULONG(aTotRange.Len());
+ if ( bCurValid )
+ {
+ nCurIndex = 0;
+ return ImplFwdUnselected();
+ }
+ }
+ else
+ {
+ bCurValid = aSels.Count() > 0;
+ if ( bCurValid )
+ return nCurIndex = aSels.GetObject(0)->Min();
+ }
+
+ return SFX_ENDOFSELECTION;
+}
+
+// -----------------------------------------------------------------------
+
+long MultiSelection::LastSelected( BOOL bInverse )
+{
+ nCurSubSel = aSels.Count() - 1;
+ bCurValid = aSels.Count() > 0;
+
+ if ( bCurValid )
+ return nCurIndex = aSels.GetObject(nCurSubSel)->Max();
+
+ return SFX_ENDOFSELECTION;
+}
+
+// -----------------------------------------------------------------------
+
+long MultiSelection::NextSelected()
+{
+ if ( !bCurValid )
+ return SFX_ENDOFSELECTION;
+
+ if ( bInverseCur )
+ {
+ ++nCurIndex;
+ return ImplFwdUnselected();
+ }
+ else
+ {
+ // is the next index in the current sub selection too?
+ if ( nCurIndex < aSels.GetObject(nCurSubSel)->Max() )
+ return ++nCurIndex;
+
+ // are there further sub selections?
+ if ( ++nCurSubSel < aSels.Count() )
+ return nCurIndex = aSels.GetObject(nCurSubSel)->Min();
+
+ // we are at the end!
+ return SFX_ENDOFSELECTION;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long MultiSelection::PrevSelected()
+{
+ if ( !bCurValid )
+ return SFX_ENDOFSELECTION;
+
+ if ( bInverseCur )
+ {
+ --nCurIndex;
+ return ImplBwdUnselected();
+ }
+ else
+ {
+ // is the previous index in the current sub selection too?
+ if ( nCurIndex > aSels.GetObject(nCurSubSel)->Min() )
+ return --nCurIndex;
+
+ // are there previous sub selections?
+ if ( nCurSubSel > 0 )
+ {
+ --nCurSubSel;
+ return nCurIndex = aSels.GetObject(nCurSubSel)->Max();
+ }
+
+ // we are at the beginning!
+ return SFX_ENDOFSELECTION;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void MultiSelection::SetTotalRange( const Range& rTotRange )
+{
+ aTotRange = rTotRange;
+
+ // die untere Bereichsgrenze anpassen
+ Range* pRange = aSels.GetObject( 0 );
+ while( pRange )
+ {
+ if( pRange->Max() < aTotRange.Min() )
+ {
+ delete pRange;
+ aSels.Remove( (ULONG)0 );
+ }
+ else if( pRange->Min() < aTotRange.Min() )
+ {
+ pRange->Min() = aTotRange.Min();
+ break;
+ }
+ else
+ break;
+
+ pRange = aSels.GetObject( 0 );
+ }
+
+ // die obere Bereichsgrenze anpassen
+ ULONG nCount = aSels.Count();
+ while( nCount )
+ {
+ pRange = aSels.GetObject( nCount - 1 );
+ if( pRange->Min() > aTotRange.Max() )
+ {
+ delete pRange;
+ aSels.Remove( (ULONG)(nCount - 1) );
+ }
+ else if( pRange->Max() > aTotRange.Max() )
+ {
+ pRange->Max() = aTotRange.Max();
+ break;
+ }
+ else
+ break;
+
+ nCount = aSels.Count();
+ }
+
+ // Selection-Count neu berechnen
+ nSelCount = 0;
+ pRange = aSels.First();
+ while( pRange )
+ {
+ nSelCount += pRange->Len();
+ pRange = aSels.Next();
+ }
+
+ bCurValid = FALSE;
+ nCurIndex = 0;
+}
diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx
new file mode 100644
index 000000000000..d84676f2c052
--- /dev/null
+++ b/tools/source/memtools/table.cxx
@@ -0,0 +1,442 @@
+/*************************************************************************
+ *
+ * $RCSfile: table.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TOOLS_TABLE_CXX
+
+// -----------------------------------------------------------------------
+
+#define protected public
+
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _IMPCONT_HXX
+#include <impcont.hxx>
+#endif
+#ifndef _TOOLS_TABLE_HXX
+#include <table.hxx>
+#endif
+
+// =======================================================================
+
+ULONG Table::ImplGetIndex( ULONG nKey, ULONG* pIndex ) const
+{
+ // Abpruefen, ob der erste Key groesser als der Vergleichskey ist
+ if ( !nCount || (nKey < (ULONG)Container::ImpGetObject(0)) )
+ return TABLE_ENTRY_NOTFOUND;
+
+ ULONG nLow;
+ ULONG nHigh;
+ ULONG nMid;
+ ULONG nCompareKey;
+ void** pNodes = Container::ImpGetOnlyNodes();
+
+ // Binaeres Suchen
+ nLow = 0;
+ nHigh = nCount-1;
+ if ( pNodes )
+ {
+ do
+ {
+ nMid = (nLow + nHigh) / 2;
+ nCompareKey = (ULONG)pNodes[nMid*2];
+ if ( nKey < nCompareKey )
+ nHigh = nMid-1;
+ else
+ {
+ if ( nKey > nCompareKey )
+ nLow = nMid + 1;
+ else
+ return nMid*2;
+ }
+ }
+ while ( nLow <= nHigh );
+ }
+ else
+ {
+ do
+ {
+ nMid = (nLow + nHigh) / 2;
+ nCompareKey = (ULONG)Container::ImpGetObject( nMid*2 );
+ if ( nKey < nCompareKey )
+ nHigh = nMid-1;
+ else
+ {
+ if ( nKey > nCompareKey )
+ nLow = nMid + 1;
+ else
+ return nMid*2;
+ }
+ }
+ while ( nLow <= nHigh );
+ }
+
+ if ( pIndex )
+ {
+ if ( nKey > nCompareKey )
+ *pIndex = (nMid+1)*2;
+ else
+ *pIndex = nMid*2;
+ }
+
+ return TABLE_ENTRY_NOTFOUND;
+}
+
+// =======================================================================
+
+Table::Table( USHORT _nInitSize, USHORT _nReSize ) :
+ Container( CONTAINER_MAXBLOCKSIZE, _nInitSize*2, _nReSize*2 )
+{
+ DBG_ASSERT( _nInitSize <= 32767, "Table::Table(): InitSize > 32767" );
+ DBG_ASSERT( _nReSize <= 32767, "Table::Table(): ReSize > 32767" );
+ nCount = 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Table::Insert( ULONG nKey, void* p )
+{
+ // Tabellenelement einsortieren
+ ULONG i;
+ if ( nCount )
+ {
+ if ( nCount <= 24 )
+ {
+ USHORT n = 0;
+ USHORT nTempCount = (USHORT)nCount * 2;
+ void** pNodes = Container::ImpGetOnlyNodes();
+ ULONG nCompareKey = (ULONG)(*pNodes);
+ while ( nKey > nCompareKey )
+ {
+ n += 2;
+ pNodes += 2;
+ if ( n < nTempCount )
+ nCompareKey = (ULONG)(*pNodes);
+ else
+ {
+ nCompareKey = 0;
+ break;
+ }
+ }
+
+ // Testen, ob sich der Key schon in der Tabelle befindet
+ if ( nKey == nCompareKey )
+ return FALSE;
+
+ i = n;
+ }
+ else
+ {
+ i = 0;
+ if ( ImplGetIndex( nKey, &i ) != TABLE_ENTRY_NOTFOUND )
+ return FALSE;
+ }
+ }
+ else
+ i = 0;
+
+ // Eintrag einfuegen (Key vor Pointer)
+ Container::Insert( (void*)nKey, i );
+ Container::Insert( p, i+1 );
+
+ // Ein neuer Eintrag
+ nCount++;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Remove( ULONG nKey )
+{
+ // Index besorgen
+ ULONG nIndex = ImplGetIndex( nKey );
+
+ // Testen, ob sich der Key in der Tabelle befindet
+ if ( nIndex == TABLE_ENTRY_NOTFOUND )
+ return NULL;
+
+ // Itemanzahl erniedrigen
+ nCount--;
+
+ // Key entfernen
+ Container::Remove( nIndex );
+
+ // Pointer entfernen und zurueckgeben
+ return Container::Remove( nIndex );
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Replace( ULONG nKey, void* p )
+{
+ // Index abfragen
+ ULONG nIndex = ImplGetIndex( nKey );
+
+ // Existiert kein Eintrag mit dem Schluessel
+ if ( nIndex == TABLE_ENTRY_NOTFOUND )
+ return NULL;
+ else
+ return Container::Replace( p, nIndex+1 );
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Get( ULONG nKey ) const
+{
+ // Index besorgen
+ ULONG nIndex = ImplGetIndex( nKey );
+
+ // Testen, ob sich der Key in der Tabelle befindet
+ if ( nIndex == TABLE_ENTRY_NOTFOUND )
+ return NULL;
+ else
+ return Container::ImpGetObject( nIndex+1 );
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::GetCurObject() const
+{
+ return Container::ImpGetObject( Container::GetCurPos()+1 );
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Table::GetKey( const void* p ) const
+{
+ ULONG nIndex = 0;
+
+ // Solange noch Eintraege Vorhanden sind
+ while ( nIndex < nCount )
+ {
+ // Stimmt der Pointer ueberein, wird der Key zurueckgegeben
+ if ( p == Container::ImpGetObject( (nIndex*2)+1 ) )
+ return (ULONG)Container::ImpGetObject( nIndex*2 );
+
+ nIndex++;
+ }
+
+ return TABLE_ENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Table::IsKeyValid( ULONG nKey ) const
+{
+ return (ImplGetIndex( nKey ) != TABLE_ENTRY_NOTFOUND) ? TRUE : FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Table::GetUniqueKey( ULONG nStartKey ) const
+{
+ DBG_ASSERT( (nStartKey > 1) && (nStartKey < 0xFFFFFFFF),
+ "Table::GetUniqueKey() - nStartKey == 0 or nStartKey >= 0xFFFFFFFF" );
+
+ if ( !nCount )
+ return nStartKey;
+
+ ULONG nLastKey = (ULONG)Container::GetObject( (nCount*2)-2 );
+ if ( nLastKey < nStartKey )
+ return nStartKey;
+ else
+ {
+ if ( nLastKey < 0xFFFFFFFE )
+ return nLastKey+1;
+ else
+ {
+ ULONG nPos;
+ ULONG nTempPos = ImplGetIndex( nStartKey, &nPos );
+ if ( nTempPos != TABLE_ENTRY_NOTFOUND )
+ nPos = nTempPos;
+ nLastKey = (ULONG)Container::GetObject( nPos );
+ if ( nStartKey < nLastKey )
+ return nStartKey;
+ while ( nLastKey < 0xFFFFFFFE )
+ {
+ nPos += 2;
+ nLastKey++;
+ if ( nLastKey != (ULONG)Container::GetObject( nPos ) )
+ return nLastKey;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Table::SearchKey( ULONG nKey, ULONG* pPos ) const
+{
+ *pPos = 0;
+ ULONG nPos = ImplGetIndex( nKey, pPos );
+ if ( nPos != TABLE_ENTRY_NOTFOUND )
+ {
+ nPos /= 2;
+ *pPos = nPos;
+ }
+ else
+ *pPos /= 2;
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Seek( ULONG nKey )
+{
+ // Testen, ob ein Eintrag vorhanden ist
+ if ( nCount )
+ {
+ ULONG nIndex = ImplGetIndex( nKey );
+
+ // Ist Key nicht enthalten
+ if ( nIndex == TABLE_ENTRY_NOTFOUND )
+ return NULL;
+ else
+ {
+ // Index setzen
+ Container::Seek( nIndex );
+
+ // Pointer zurueckgeben
+ return Container::ImpGetObject( Container::GetCurPos() + 1 );
+ }
+ }
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Seek( void* p )
+{
+ ULONG nKey = GetKey( p );
+
+ // Ist Key vorhanden, dann als aktuellen Eintrag setzen
+ if ( nKey != TABLE_ENTRY_NOTFOUND )
+ return Seek( nKey );
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::First()
+{
+ // Testen, ob ein Eintrag vorhanden ist
+ if ( nCount )
+ {
+ // Auf ersten Eintag setzen
+ Container::First();
+
+ // Pointer zurueckgeben
+ return Container::ImpGetObject( 1 );
+ }
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Last()
+{
+ // Testen, ob ein Eintrag vorhanden ist
+ if ( nCount )
+ {
+ // Last auf letzten Eintrag setzen
+ void* p = Container::Last();
+ Container::Prev();
+
+ // Pointer zurueckgeben
+ return p;
+ }
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Next()
+{
+ // Ueber den Pointer weiterschalten
+ Container::Next();
+
+ // Nachsten Eintag
+ Container::Next();
+
+ // Pointer vom naechsten Key zurueckgeben
+ return Container::ImpGetObject( Container::GetCurPos() + 1 );
+}
+
+// -----------------------------------------------------------------------
+
+void* Table::Prev()
+{
+ // Ueber den Pointer weiterschalten
+ void* p = Container::Prev();
+
+ // Nachsten Eintag
+ Container::Prev();
+
+ // Pointer vom vorherigen Key zurueckgeben
+ return p;
+}
diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx
new file mode 100644
index 000000000000..435e5fc117be
--- /dev/null
+++ b/tools/source/memtools/unqidx.cxx
@@ -0,0 +1,643 @@
+/*************************************************************************
+ *
+ * $RCSfile: unqidx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define protected public
+
+#ifndef _IMPCONT_HXX
+#include <impcont.hxx>
+#endif
+
+#ifndef _UNQIDX_HXX
+#include <unqidx.hxx>
+#endif
+
+#ifndef _UNQID_HXX
+#include <unqid.hxx>
+#endif
+
+/*************************************************************************
+|*
+|* UniqueIndex::UniqueIndex()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+UniqueIndex::UniqueIndex( ULONG _nStartIndex,
+ ULONG _nInitSize, ULONG _nReSize ) :
+ Container( _nInitSize )
+{
+ nReSize = _nReSize;
+ nStartIndex = _nStartIndex;
+ nUniqIndex = 0;
+ nCount = 0;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::UniqueIndex()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+UniqueIndex::UniqueIndex( const UniqueIndex& rIdx ) :
+ Container( rIdx )
+{
+ nReSize = rIdx.nReSize;
+ nStartIndex = rIdx.nStartIndex;
+ nUniqIndex = rIdx.nUniqIndex;
+ nCount = rIdx.nCount;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Insert()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+ULONG UniqueIndex::Insert( void* p )
+{
+ // NULL-Pointer ist nicht erlaubt
+ if ( !p )
+ return UNIQUEINDEX_ENTRY_NOTFOUND;
+
+ // Ist Array voll, dann expandieren
+ if ( nCount == Container::GetSize() )
+ SetSize( nCount + nReSize );
+
+ // Damit UniqIndex nicht ueberlaeuft, wenn Items geloescht wurden
+ nUniqIndex = nUniqIndex % Container::GetSize();
+
+ // Leeren Eintrag suchen
+ while ( Container::ImpGetObject( nUniqIndex ) != NULL )
+ nUniqIndex = (nUniqIndex+1) % Container::GetSize();
+
+ // Object im Array speichern
+ Container::Replace( p, nUniqIndex );
+
+ // Anzahl der Eintraege erhoehen und Index zurueckgeben
+ nCount++;
+ nUniqIndex++;
+ return ( nUniqIndex + nStartIndex - 1 );
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Insert()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung MM 21.04.96
+|* Letzte Aenderung MM 21.04.96
+|*
+*************************************************************************/
+
+ULONG UniqueIndex::Insert( ULONG nIndex, void* p )
+{
+ // NULL-Pointer ist nicht erlaubt
+ if ( !p )
+ return UNIQUEINDEX_ENTRY_NOTFOUND;
+
+ ULONG nContIndex = nIndex - nStartIndex;
+ // Ist Array voll, dann expandieren
+ if ( nContIndex >= Container::GetSize() )
+ SetSize( nContIndex + nReSize );
+
+ // Object im Array speichern
+ Container::Replace( p, nContIndex );
+
+ // Anzahl der Eintraege erhoehen und Index zurueckgeben
+ nCount++;
+ return nIndex;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Remove()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Remove( ULONG nIndex )
+{
+ // Ist Index zulaessig
+ if ( (nIndex >= nStartIndex) &&
+ (nIndex < (Container::GetSize()+nStartIndex)) )
+ {
+ // Index-Eintrag als leeren Eintrag setzen und Anzahl der
+ // gespeicherten Indexe erniedriegen, wenn Eintrag belegt war
+ void* p = Container::Replace( NULL, nIndex-nStartIndex );
+ if ( p )
+ nCount--;
+ return p;
+ }
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Replace()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Replace( ULONG nIndex, void* p )
+{
+ // NULL-Pointer ist nicht erlaubt
+ if ( !p )
+ return NULL;
+
+ // Ist Index zulaessig
+ if ( IsIndexValid( nIndex ) )
+ {
+ // Index-Eintrag ersetzen und alten zurueckgeben
+ return Container::Replace( p, nIndex-nStartIndex );
+ }
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Get()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Get( ULONG nIndex ) const
+{
+ // Ist Index zulaessig
+ if ( (nIndex >= nStartIndex) &&
+ (nIndex < (Container::GetSize()+nStartIndex)) )
+ return Container::ImpGetObject( nIndex-nStartIndex );
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::GetCurIndex()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+ULONG UniqueIndex::GetCurIndex() const
+{
+ ULONG nPos = Container::GetCurPos();
+
+ // Ist der Current-Index nicht belegt, dann gibt es keinen Current-Index
+ if ( !Container::ImpGetObject( nPos ) )
+ return UNIQUEINDEX_ENTRY_NOTFOUND;
+ else
+ return nPos+nStartIndex;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::GetIndex()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+ULONG UniqueIndex::GetIndex( const void* p ) const
+{
+ // Wird ein NULL-Pointer uebergeben, dann wurde Pointer nicht gefunden
+ if ( !p )
+ return UNIQUEINDEX_ENTRY_NOTFOUND;
+
+ ULONG nIndex = Container::GetPos( p );
+
+ if ( nIndex != CONTAINER_ENTRY_NOTFOUND )
+ return nIndex+nStartIndex;
+ else
+ return UNIQUEINDEX_ENTRY_NOTFOUND;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::IsIndexValid()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+BOOL UniqueIndex::IsIndexValid( ULONG nIndex ) const
+{
+ // Ist Index zulaessig
+ if ( (nIndex >= nStartIndex) &&
+ (nIndex < (Container::GetSize()+nStartIndex)) )
+ {
+ // Index ist nur zulaessig, wenn Eintrag auch belegt ist
+ if ( Container::ImpGetObject( nIndex-nStartIndex ) )
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Seek()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Seek( ULONG nIndex )
+{
+ // Index-Eintrag als aktuellen setzten, wenn er gueltig ist
+ if ( IsIndexValid( nIndex ) )
+ return Container::Seek( nIndex-nStartIndex );
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Seek()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Seek( void* p )
+{
+ // Wird ein NULL-Pointer uebergeben, dann wurde Pointer nicht gefunden
+ if ( !p )
+ return NULL;
+
+ ULONG nIndex = GetIndex( p );
+
+ // Ist Index vorhanden, dann als aktuellen Eintrag setzen
+ if ( nIndex != UNIQUEINDEX_ENTRY_NOTFOUND )
+ return Container::Seek( nIndex-nStartIndex );
+ else
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::First()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::First()
+{
+ void* p = Container::First();
+
+ while ( !p && (Container::GetCurPos() < (Container::GetSize()-1)) )
+ p = Container::Next();
+
+ return p;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Last()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Last()
+{
+ void* p = Container::Last();
+
+ while ( !p && Container::GetCurPos() )
+ p = Container::Prev();
+
+ return p;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Next()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Next()
+{
+ void* p = NULL;
+
+ while ( !p && (Container::GetCurPos() < (Container::GetSize()-1)) )
+ p = Container::Next();
+
+ return p;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::Prev()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+void* UniqueIndex::Prev()
+{
+ void* p = NULL;
+
+ while ( !p && Container::GetCurPos() )
+ p = Container::Prev();
+
+ return p;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::operator =()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+UniqueIndex& UniqueIndex::operator =( const UniqueIndex& rIdx )
+{
+ // Neue Werte zuweisen
+ Container::operator =( rIdx );
+ nReSize = rIdx.nReSize;
+ nStartIndex = rIdx.nStartIndex;
+ nUniqIndex = rIdx.nUniqIndex;
+ nCount = rIdx.nCount;
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* UniqueIndex::operator ==()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung TH 24.09.91
+|* Letzte Aenderung TH 24.09.91
+|*
+*************************************************************************/
+
+BOOL UniqueIndex::operator ==( const UniqueIndex& rIdx ) const
+{
+ // Neue Werte zuweisen
+ if ( (nStartIndex == rIdx.nStartIndex) &&
+ (nCount == rIdx.nCount) &&
+ (Container::operator ==( rIdx )) )
+ return TRUE;
+ else
+ return FALSE;
+}
+/*************************************************************************
+|*
+|* UniqueIdContainer::UniqueIdContainer ()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung MM 29.04.96
+|* Letzte Aenderung MM 29.04.96
+|*
+*************************************************************************/
+
+UniqueIdContainer::UniqueIdContainer( const UniqueIdContainer& rObj )
+ : UniqueIndex( rObj )
+ , nCollectCount( rObj.nCollectCount )
+{
+ ULONG nCur = GetCurIndex();
+
+ ImpUniqueId * pEle = (ImpUniqueId *)First();
+ while( pEle )
+ {
+ pEle->nRefCount++;
+ pEle = (ImpUniqueId *)Next();
+ }
+ Seek( nCur );
+}
+
+/*************************************************************************
+|*
+|* UniqueIdContainer::operator = ()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung MM 01.08.94
+|* Letzte Aenderung MM 01.08.94
+|*
+*************************************************************************/
+
+UniqueIdContainer& UniqueIdContainer::operator = ( const UniqueIdContainer & rObj )
+{
+ UniqueIndex::operator = ( rObj );
+ nCollectCount = rObj.nCollectCount;
+
+ ULONG nCur = GetCurIndex();
+
+ ImpUniqueId * pEle = (ImpUniqueId *)First();
+ while( pEle )
+ {
+ pEle->nRefCount++;
+ pEle = (ImpUniqueId *)Next();
+ }
+ Seek( nCur );
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* UniqueIdContainer::Clear()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung MM 01.08.94
+|* Letzte Aenderung MM 01.08.94
+|*
+*************************************************************************/
+
+void UniqueIdContainer::Clear( BOOL bAll )
+{
+ USHORT nFree = bAll ? 0xFFFF : 1;
+
+ ImpUniqueId* pId = (ImpUniqueId*)Last();
+ BOOL bLast = TRUE;
+ while ( pId )
+ {
+ if ( pId->nRefCount <= nFree )
+ {
+ ((ImpUniqueId *)Remove( pId->nId ))->Release();
+ if( bLast )
+ pId = (ImpUniqueId *)Last();
+ else
+ pId = (ImpUniqueId *)Prev();
+ }
+ else
+ {
+ pId = (ImpUniqueId *)Prev();
+ bLast = FALSE;
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* UniqueIdContainer::CreateId()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung MM 01.08.94
+|* Letzte Aenderung MM 01.08.94
+|*
+*************************************************************************/
+
+UniqueItemId UniqueIdContainer::CreateId()
+{
+ if( nCollectCount > 50 )
+ { // aufraeumen
+ Clear( FALSE );
+ nCollectCount = 0;
+ }
+ nCollectCount++;
+
+ ImpUniqueId * pId = new ImpUniqueId;
+ pId->nRefCount = 1;
+ pId->nId = Insert( pId );
+ return UniqueItemId( pId );
+}
+
+/*************************************************************************
+|*
+|* UniqueIdContainer::CreateIdProt()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung MM 01.08.94
+|* Letzte Aenderung MM 01.08.94
+|*
+*************************************************************************/
+
+UniqueItemId UniqueIdContainer::CreateFreeId( ULONG nId )
+{
+ // Einfach erzeugen, fuer abgeleitete Klasse
+ ImpUniqueId * pId = new ImpUniqueId;
+ pId->nRefCount = 0;
+ pId->nId = nId;
+ return UniqueItemId( pId );
+}
+
+/*************************************************************************
+|*
+|* UniqueIdContainer::CreateIdProt()
+|*
+|* Beschreibung UNQIDX.SDW
+|* Ersterstellung MM 01.08.94
+|* Letzte Aenderung MM 01.08.94
+|*
+*************************************************************************/
+
+UniqueItemId UniqueIdContainer::CreateIdProt( ULONG nId )
+{
+ if ( IsIndexValid( nId ) )
+ return UniqueItemId( (ImpUniqueId *)Get( nId ) );
+
+ ImpUniqueId * pId;
+ do
+ {
+ pId = new ImpUniqueId;
+ pId->nRefCount = 1;
+ pId->nId = Insert( pId );
+ }
+ while( pId->nId != nId );
+ return UniqueItemId( pId );
+}
diff --git a/tools/source/rc/makefile.mk b/tools/source/rc/makefile.mk
new file mode 100644
index 000000000000..8aadfce6a2b0
--- /dev/null
+++ b/tools/source/rc/makefile.mk
@@ -0,0 +1,89 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=rc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= rc.cxx \
+ resmgr.cxx
+
+SLOFILES= $(SLO)$/rc.obj \
+ $(SLO)$/resmgr.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/rc.obj \
+ $(OBJ)$/resmgr.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/rc/rc.cxx b/tools/source/rc/rc.cxx
new file mode 100644
index 000000000000..daa5ffdb71d9
--- /dev/null
+++ b/tools/source/rc/rc.cxx
@@ -0,0 +1,311 @@
+/*************************************************************************
+ *
+ * $RCSfile: rc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TOOLS_RC_CXX
+
+#include <string.h>
+
+#ifndef _DATE_HXX
+#include <date.hxx>
+#endif
+#ifndef _TIME_HXX
+#include <time.hxx>
+#endif
+#ifndef _INTN_HXX
+#include <intn.hxx>
+#endif
+
+#ifndef _TOOLS_RC_HXX
+#include <rc.hxx>
+#endif
+#ifndef _TOOLS_RCID_H
+#include <rcid.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+ImplSVResourceData aResData;
+
+inline ImplSVResourceData* GetResData()
+{
+ //return &ImplGetSVData()->maResourceData;
+ return &aResData;
+}
+
+// =======================================================================
+
+Resource::Resource( const ResId& rResId )
+{
+ GetRes( rResId.SetRT( RSC_RESOURCE ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Resource::GetRes( const ResId& rResId )
+{
+ if ( rResId.GetResMgr() )
+ rResId.GetResMgr()->GetResource( rResId, this );
+ else
+ GetResManager()->GetResource( rResId, this );
+
+ IncrementRes( sizeof( RSHEADER_TYPE ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Resource::TestRes()
+{
+ ImplSVResourceData* pSVInData = GetResData();
+ if( pSVInData->pAppResMgr )
+ GetResManager()->TestStack( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Resource::SetResManager( ResMgr* pNewResMgr )
+{
+ ImplSVResourceData * pSVInData = GetResData();
+ pSVInData->pAppResMgr = pNewResMgr;
+}
+
+// -----------------------------------------------------------------------
+
+ResMgr* Resource::GetResManager()
+{
+ ImplSVResourceData* pSVInData = GetResData();
+
+ return pSVInData->pAppResMgr;
+}
+
+// =======================================================================
+
+#ifndef ENABLEUNICODE
+
+String::String( const ResId& rResId )
+{
+ rResId.SetRT( RSC_STRING );
+ ResMgr* pResMgr = rResId.GetResMgr();
+ if ( !pResMgr )
+ pResMgr = Resource::GetResManager();
+
+ if ( pResMgr->GetResource( rResId ) )
+ {
+ // String laden
+ RSHEADER_TYPE * pResHdr = (RSHEADER_TYPE*)pResMgr->GetClass();
+ USHORT nLen = pResHdr->GetLocalOff() - sizeof( RSHEADER_TYPE );
+
+ USHORT nStringLen = strlen( (char*)(pResHdr+1) );
+ UniString aWString( (const char*)(pResHdr+1), RTL_TEXTENCODING_UTF8,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
+ InitStringRes( aWString );
+
+ USHORT nSize = sizeof( RSHEADER_TYPE ) + nStringLen + 1;
+ nSize += nSize % 2;
+ pResMgr->Increment( nSize );
+ }
+}
+
+#endif
+
+// =======================================================================
+
+UniString::UniString( const ResId& rResId )
+{
+ rResId.SetRT( RSC_STRING );
+ ResMgr* pResMgr = rResId.GetResMgr();
+ if ( !pResMgr )
+ pResMgr = Resource::GetResManager();
+
+ if ( pResMgr->GetResource( rResId ) )
+ {
+ // String laden
+ RSHEADER_TYPE * pResHdr = (RSHEADER_TYPE*)pResMgr->GetClass();
+ USHORT nLen = pResHdr->GetLocalOff() - sizeof( RSHEADER_TYPE );
+
+ USHORT nStringLen = strlen( (char*)(pResHdr+1) );
+ InitStringRes( (const char*)(pResHdr+1), nStringLen );
+
+ USHORT nSize = sizeof( RSHEADER_TYPE ) + nStringLen + 1;
+ nSize += nSize % 2;
+ pResMgr->Increment( nSize );
+ }
+}
+
+// =======================================================================
+
+Time::Time( const ResId& rResId )
+{
+ nTime = 0;
+ rResId.SetRT( RSC_TIME );
+ ResMgr* pResMgr = NULL;
+
+ ResMgr::GetResourceSkipHeader( rResId, &pResMgr );
+
+ USHORT nObjMask = (USHORT)pResMgr->ReadShort();
+
+ if ( 0x01 & nObjMask )
+ SetHour( (USHORT)pResMgr->ReadShort() );
+ if ( 0x02 & nObjMask )
+ SetMin( (USHORT)pResMgr->ReadShort() );
+ if ( 0x04 & nObjMask )
+ SetSec( (USHORT)pResMgr->ReadShort() );
+ if ( 0x08 & nObjMask )
+ Set100Sec( (USHORT)pResMgr->ReadShort() );
+}
+
+// =======================================================================
+
+Date::Date( const ResId& rResId )
+{
+ rResId.SetRT( RSC_DATE );
+ ResMgr* pResMgr = NULL;
+
+ ResMgr::GetResourceSkipHeader( rResId, &pResMgr );
+
+ USHORT nObjMask = (USHORT)pResMgr->ReadShort();
+
+ if ( 0x01 & nObjMask )
+ SetYear( (USHORT)pResMgr->ReadShort() );
+ if ( 0x02 & nObjMask )
+ SetMonth( (USHORT)pResMgr->ReadShort() );
+ if ( 0x04 & nObjMask )
+ SetDay( (USHORT)pResMgr->ReadShort() );
+}
+
+// =======================================================================
+
+International::International( const ResId& rResId )
+{
+ rResId.SetRT( RSC_INTERNATIONAL );
+ ResMgr* pResMgr = NULL;
+
+ ResMgr::GetResourceSkipHeader( rResId, &pResMgr );
+
+ USHORT nObjMask = (USHORT)pResMgr->ReadShort();
+
+ LanguageType eLangType = LANGUAGE_SYSTEM;
+ LanguageType eFormatType = LANGUAGE_SYSTEM;
+
+ if ( 0x0001 & nObjMask )
+ {
+ eLangType = (LanguageType)(USHORT)pResMgr->ReadShort();
+ eFormatType = eLangType;
+ }
+ if ( 0x0002 & nObjMask )
+ eFormatType = (LanguageType)(USHORT)pResMgr->ReadShort();
+ Init( eLangType, eFormatType );
+
+ if ( 0x0004 & nObjMask )
+ SetDateFormat( (DateFormat)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0008 & nObjMask )
+ SetDateDayLeadingZero( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0010 & nObjMask )
+ SetDateMonthLeadingZero( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0020 & nObjMask )
+ SetDateCentury( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0040 & nObjMask )
+ SetLongDateFormat( (DateFormat)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0080 & nObjMask )
+ SetLongDateDayOfWeekFormat( (DayOfWeekFormat)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0100 & nObjMask )
+ SetLongDateDayOfWeekSep( pResMgr->ReadString() );
+ if ( 0x0200 & nObjMask )
+ SetLongDateDayLeadingZero( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0400 & nObjMask )
+ SetLongDateDaySep( pResMgr->ReadString() );
+ if ( 0x0800 & nObjMask )
+ SetLongDateMonthFormat( (MonthFormat)(USHORT)pResMgr->ReadShort() );
+ if ( 0x1000 & nObjMask )
+ SetLongDateMonthSep( pResMgr->ReadString() );
+ if ( 0x2000 & nObjMask )
+ SetLongDateCentury( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x4000 & nObjMask )
+ SetLongDateYearSep( pResMgr->ReadString() );
+ if ( 0x8000 & nObjMask )
+ SetTimeFormat( (TimeFormat)(USHORT)pResMgr->ReadShort() );
+
+ // Zweite Maske holen
+ nObjMask = (USHORT)pResMgr->ReadShort();
+ if ( 0x0001 & nObjMask )
+ SetTimeLeadingZero( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0002 & nObjMask )
+ SetTimeAM( pResMgr->ReadString() );
+ if ( 0x0004 & nObjMask )
+ SetTimePM( pResMgr->ReadString() );
+ if ( 0x0008 & nObjMask )
+ SetNumLeadingZero( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0010 & nObjMask )
+ SetNumDigits( (USHORT)pResMgr->ReadShort() );
+ if ( 0x0020 & nObjMask )
+ SetCurrPositiveFormat( (USHORT)pResMgr->ReadShort() );
+ if ( 0x0040 & nObjMask )
+ SetCurrNegativeFormat( (USHORT)pResMgr->ReadShort() );
+ if ( 0x0080 & nObjMask )
+ SetCurrDigits( (USHORT)pResMgr->ReadShort() );
+ if ( 0x0100 & nObjMask )
+ SetNumTrailingZeros( (BOOL)(USHORT)pResMgr->ReadShort() );
+ if ( 0x0200 & nObjMask )
+ SetMeasurementSystem( (MeasurementSystem)(USHORT)pResMgr->ReadShort() );
+}
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
new file mode 100644
index 000000000000..610f884b9b2b
--- /dev/null
+++ b/tools/source/rc/resmgr.cxx
@@ -0,0 +1,1364 @@
+/*************************************************************************
+ *
+ * $RCSfile: resmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:06 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef _VOS_SIGNAL_HXX_
+#include <vos/signal.hxx>
+#endif
+
+#ifndef _NEW_HXX
+#include <new.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <debug.hxx>
+#endif
+#ifndef _TABLE_HXX
+#include <table.hxx>
+#endif
+#ifndef _FSYS_HXX
+#include <fsys.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <stream.hxx>
+#endif
+#ifndef _INTN_HXX
+#include <intn.hxx>
+#endif
+#ifndef _TOOLS_RESMGR_HXX
+#include <resmgr.hxx>
+#endif
+#ifndef _TOOLS_RC_HXX
+#include <rc.hxx>
+#endif
+#ifndef _TOOLS_RCID_H
+#include <rcid.h>
+#endif
+
+#ifndef _TOOLS_SIMPLERESMGR_HXX_
+#include "simplerm.hxx"
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+extern ImplSVResourceData aResData;
+inline ImplSVResourceData* GetResData()
+{
+ return &aResData;
+}
+
+static List & GetResMgrList()
+{
+ ImplSVResourceData * pRD = GetResData();
+ if ( !pRD->pInternalResMgrList )
+ pRD->pInternalResMgrList = new List();
+ return *pRD->pInternalResMgrList;
+}
+
+struct ImpContent
+{
+ ULONG nTypeAndId;
+ ULONG nOffset;
+};
+
+#if defined( OS2 ) && defined( ICC )
+static int _Optlink Compare( const void * pFirst, const void * pSecond )
+#elif S390
+extern "C" { int Compare( const void * pFirst, const void * pSecond )
+#else
+static int __LOADONCALLAPI Compare( const void * pFirst, const void * pSecond )
+#endif
+{
+ if( ((ImpContent *)pFirst)->nTypeAndId > ((ImpContent *)pSecond)->nTypeAndId )
+ return( 1 );
+ else if( ((ImpContent *)pFirst)->nTypeAndId < ((ImpContent *)pSecond)->nTypeAndId )
+ return( -1 );
+ else
+ return( 0 );
+}
+
+#ifdef S390
+}
+#endif
+
+#if defined( OS2 ) && defined( ICC )
+static int _Optlink Search( const void * nTypeAndId, const void * pSecond )
+#elif S390
+extern "C" { int Search( const void * nTypeAndId, const void * pSecond )
+#else
+static int __LOADONCALLAPI Search( const void * nTypeAndId, const void * pSecond )
+#endif
+{
+ if( (ULONG)nTypeAndId > (((ImpContent *)pSecond)->nTypeAndId) )
+ return( 1 );
+ else if( (ULONG)nTypeAndId < (((ImpContent *)pSecond)->nTypeAndId) )
+ return( -1 );
+ else
+ return( 0 );
+}
+
+#ifdef S390
+}
+#endif
+
+// =======================================================================
+
+SvStream * InternalResMgr::GetBitmapStream( USHORT nId )
+{
+ // Anfang der Strings suchen
+ ImpContent * pFind = (ImpContent *)
+ bsearch( (void *)((ULONG(RT_SYS_BITMAP) << 16) | nId), pContent, nEntries,
+ sizeof( ImpContent ), Search );
+
+ if ( pFind )
+ {
+ pStm->Seek( pFind->nOffset );
+ return pStm;
+ }
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void InternalResMgr::GetResMgrPath( InternalResMgr* pThis,
+ const UniString& rFileName,
+ const UniString* pAppFileName,
+ const UniString* pResourcePath )
+{
+ UniString aResFile;
+ if ( rFileName.Len() )
+ {
+ UniString aResPath;
+ if( pResourcePath )
+ aResPath += *pResourcePath;
+ if ( pAppFileName )
+ {
+ DirEntry aAppDir( *pAppFileName );
+ aAppDir.CutName();
+ UniString aAppPath = aAppDir.GetFull();
+ DirEntry aResSubPath( UniString( RTL_CONSTASCII_USTRINGPARAM( "resource" ) ) );
+ aAppDir += aResSubPath;
+ UniString aAppResPath = aAppDir.GetFull();
+
+ // Default resource path is bin\resource
+ if ( aResPath.Len() )
+ aResPath += DirEntry::GetSearchDelimiter();
+ aResPath += aAppResPath;
+
+ // we a search also in the bin path
+ aResPath += DirEntry::GetSearchDelimiter();
+ aResPath += aAppPath;
+ }
+ const sal_Char* pEnv = getenv( "STAR_RESOURCEPATH" );
+ if( pEnv )
+ {
+ if ( aResPath.Len() )
+ aResPath += DirEntry::GetSearchDelimiter();
+ aResPath.AppendAscii( pEnv );
+ }
+
+ DirEntry aFullName( rFileName );
+ if ( aFullName.Find( aResPath ) )
+ aResFile = aFullName.GetFull();
+ else
+ aResFile = rFileName;
+ }
+ else if ( pAppFileName )
+ {
+ // Default Resourcefile ist die Anwendung
+ aResFile = *pAppFileName;
+#if defined( OS2 ) || defined( WIN ) || defined( WNT )
+ aResFile.Erase( aResFile.Len() - 4 );
+#endif
+ aResFile.AppendAscii( ".res" );
+ }
+
+ if( aResFile.Len() )
+ {
+ DirEntry aEntry = aResFile;
+
+ FileStat aStat( aEntry );
+ if( aStat.IsKind( FSYS_KIND_FILE ) )
+ {
+ pThis->aFileName = aEntry.GetFull();
+ pThis->aShortFileName = aEntry.GetName();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+InternalResMgr::InternalResMgr()
+ : pContent( NULL )
+ , pStringBlock( NULL )
+ , pStm( NULL )
+ , bEqual2Content( TRUE )
+ , nEntries( 0 )
+ , pResUseDump( 0 )
+{
+}
+
+// -----------------------------------------------------------------------
+
+InternalResMgr::~InternalResMgr()
+{
+ SvMemFree(pContent);
+ SvMemFree(pStringBlock);
+ delete pStm;
+
+#ifdef DBG_UTIL
+ if( pResUseDump )
+ {
+ const sal_Char* pLogFile = getenv( "STAR_RESOURCE_LOGGING" );
+ if ( pLogFile )
+ {
+ SvFileStream aStm( UniString( pLogFile, RTL_TEXTENCODING_ASCII_US ), STREAM_WRITE );
+ aStm.Seek( STREAM_SEEK_TO_END );
+ ByteString aLine( "FileName: " );
+ aLine.Append( ByteString( aFileName, RTL_TEXTENCODING_UTF8 ) );
+ aStm.WriteLine( aLine );
+
+ for( ULONG i = 0; i < pResUseDump->Count(); i++ )
+ {
+ ULONG nKeyId = pResUseDump->GetObjectKey( i );
+ aLine.Assign( "Type/Id: " );
+ aLine.Append( ByteString::CreateFromInt32( (nKeyId >> 16) & 0xFFFF ) );
+ aLine.Append( '/' );
+ aLine.Append( ByteString::CreateFromInt32( nKeyId & 0xFFFF ) );
+ aStm.WriteLine( aLine );
+ }
+ }
+ }
+#endif
+
+ delete pResUseDump;
+}
+
+// -----------------------------------------------------------------------
+
+InternalResMgr* InternalResMgr::Create( const UniString& rName,
+ const UniString* pAppName,
+ const UniString* pResPath )
+{
+ InternalResMgr* pThis = new InternalResMgr();
+
+ GetResMgrPath( pThis, rName, pAppName, pResPath );
+
+ if ( pThis->aFileName.Len() && pThis->Create() )
+ return pThis;
+
+ delete pThis;
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL InternalResMgr::Create()
+{
+ BOOL bDone = FALSE;
+
+ pStm = new SvFileStream( aFileName, (STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE) );
+ if( pStm->GetError() == 0 )
+ {
+ INT32 lContLen = 0;
+
+ pStm->Seek( STREAM_SEEK_TO_END );
+ /*
+ if( ( pInternalResMgr->pHead = (RSHEADER_TYPE *)mmap( 0, nResourceFileSize,
+ PROT_READ, MAP_PRIVATE,
+ fRes, 0 ) ) != (RSHEADER_TYPE *)-1)
+ */
+ pStm->SeekRel( - (int)sizeof( lContLen ) );
+ pStm->Read( &lContLen, sizeof( lContLen ) );
+ // is bigendian, swab to the right endian
+ lContLen = ResMgr::GetLong( &lContLen );
+ pStm->SeekRel( -lContLen );
+ pContent = (ImpContent *)SvMemAlloc( lContLen );
+ pStm->Read( pContent, lContLen );
+ // Auf die Anzahl der ImpContent kürzen
+ nEntries = (UINT32)lContLen / sizeof( ImpContent );
+ bEqual2Content = TRUE; // Die Daten der Resourcen liegen
+ // genauso wie das Inhaltsverzeichnis
+ BOOL bSorted = TRUE;
+ if( nEntries )
+ {
+#ifdef DBG_UTIL
+ const sal_Char* pLogFile = getenv( "STAR_RESOURCE_LOGGING" );
+ if ( pLogFile )
+ {
+ pResUseDump = new Table();
+ for( ULONG i = 0; i < nEntries; i++ )
+ pResUseDump->Insert( pContent[i].nTypeAndId, NULL );
+ }
+#endif
+ // swap the content to the right endian
+ pContent[0].nTypeAndId = ResMgr::GetLong( &pContent[0].nTypeAndId );
+ pContent[0].nOffset = ResMgr::GetLong( &pContent[0].nOffset );
+ for( ULONG i = 0; i < nEntries -1; i++ )
+ {
+ // swap the content to the right endian
+ pContent[i+1].nTypeAndId = ResMgr::GetLong( &pContent[i+1].nTypeAndId );
+ pContent[i+1].nOffset = ResMgr::GetLong( &pContent[i+1].nOffset );
+ if( pContent[i].nTypeAndId >= pContent[i +1].nTypeAndId )
+ bSorted = FALSE;
+ if( (pContent[i].nTypeAndId & 0xFFFF0000) == (pContent[i +1].nTypeAndId & 0xFFFF0000)
+ && pContent[i].nOffset >= pContent[i +1].nOffset )
+ bEqual2Content = FALSE;
+ }
+ }
+ DBG_ASSERT( bSorted, "content not sorted" )
+ DBG_ASSERT( bEqual2Content, "resource structure wrong" )
+ if( !bSorted )
+ qsort( pContent, nEntries, sizeof( ImpContent ), Compare );
+
+ bDone = TRUE;
+ }
+
+ return bDone;
+}
+
+// -----------------------------------------------------------------------
+
+InternalResMgr* InternalResMgr::GetInternalResMgr( const UniString& rFileName,
+ const UniString* pAppName,
+ const UniString* pResPath )
+{
+ ImplSVResourceData* pSVInData = GetResData();
+
+ // Nur InternalResMgr's mit FileNamen stehen in der Liste
+ if ( rFileName.Len() )
+ {
+ List& rMgrList = GetResMgrList();
+
+ InternalResMgr* pEle = (InternalResMgr*)rMgrList.First();
+ while( pEle )
+ {
+ if ( rFileName.EqualsIgnoreCaseAscii( pEle->aFileName ) ||
+ rFileName.EqualsIgnoreCaseAscii( pEle->aShortFileName ) )
+ {
+ pEle->AddRef();
+ return pEle;
+ }
+ pEle = (InternalResMgr*)rMgrList.Next();
+ }
+
+#ifdef DBG_UTIL
+ ByteString aTraceStr( "Search/Load-RESDLL:" );
+ aTraceStr += ByteString( rFileName, RTL_TEXTENCODING_UTF8 );
+ DBG_TRACE( aTraceStr.GetBuffer() );
+#endif
+
+ pEle = Create( rFileName, pAppName, pResPath );
+
+ if ( pEle )
+ {
+ pEle->AddRef();
+ rMgrList.Insert( pEle );
+ }
+
+ return pEle;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void InternalResMgr::FreeInternalResMgr( InternalResMgr* pFreeInternalResMgr )
+{
+ // Nur InternalResMgr's mit FileNamen stehen in der Liste und werden vor dem
+ // Programmende freigegeben
+ if( pFreeInternalResMgr->aFileName.Len() )
+ {
+ if( pFreeInternalResMgr->ReleaseRef() == 0 )
+ GetResMgrList().Remove( pFreeInternalResMgr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL InternalResMgr::IsGlobalAvailable( RESOURCE_TYPE nRT, USHORT nId ) const
+{
+ // Anfang der Strings suchen
+ ImpContent * pFind = (ImpContent *)
+ bsearch( (void *)((ULONG(nRT) << 16) | nId), pContent, nEntries,
+ sizeof( ImpContent ), Search );
+ return pFind != NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, USHORT nId,
+ void **pResHandle )
+{
+#ifdef DBG_UTIL
+ if( pResUseDump )
+ pResUseDump->Remove( (ULONG(nRT) << 16) | nId );
+#endif
+ // Anfang der Strings suchen
+ ImpContent * pFind = (ImpContent *)
+ bsearch( (void *)((ULONG(nRT) << 16) | nId), pContent, nEntries,
+ sizeof( ImpContent ), Search );
+ if( nRT == RSC_STRING && bEqual2Content && pFind )
+ {
+ // String Optimierung
+ if( !pStringBlock )
+ {
+ // Anfang der Strings suchen
+ ImpContent * pFirst = pFind;
+ ImpContent * pLast = pFirst;
+ while( pFirst > pContent && ((pFirst -1)->nTypeAndId >> 16) == RSC_STRING )
+ pFirst--;
+ while( pLast < (pContent + nEntries) && (pLast->nTypeAndId >> 16) == RSC_STRING )
+ pLast++;
+ nOffCorrection = pFirst->nOffset;
+ UINT32 nSize;
+ --pLast;
+ pStm->Seek( pLast->nOffset );
+ RSHEADER_TYPE aHdr;
+ pStm->Read( &aHdr, sizeof( aHdr ) );
+ nSize = pLast->nOffset + aHdr.GetGlobOff() - nOffCorrection;
+ pStringBlock = (BYTE*)SvMemAlloc( nSize );
+ pStm->Seek( pFirst->nOffset );
+ pStm->Read( pStringBlock, nSize );
+ }
+ *pResHandle = pStringBlock;
+ return (BYTE*)pStringBlock + pFind->nOffset - nOffCorrection;
+ }
+ *pResHandle = 0;
+ if( pFind )
+ {
+ RSHEADER_TYPE aHeader;
+ pStm->Seek( pFind->nOffset );
+ pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) );
+ void * pRes = new BYTE[ aHeader.GetGlobOff() ];
+ memcpy( pRes, &aHeader, sizeof( RSHEADER_TYPE ) );
+ pStm->Read( (BYTE*)pRes + sizeof( RSHEADER_TYPE ),
+ aHeader.GetGlobOff() - sizeof( RSHEADER_TYPE ) );
+ return pRes;
+ }
+ //Resource holen
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void InternalResMgr::FreeGlobalRes( void * pResHandle, void * pResource )
+{
+ if ( !pResHandle )
+ // REsource wurde extra allokiert
+ delete pResource;
+}
+
+// =======================================================================
+
+#ifdef DBG_UTIL
+
+UniString GetTypeRes_Impl( const ResId& rTypeId )
+{
+ // Funktion verlassen, falls Resourcefehler in dieser Funktion
+ static bInUse = FALSE;
+ UniString aTypStr( rTypeId.GetId() );
+
+ if ( !bInUse )
+ {
+ bInUse = TRUE;
+
+ ResId aResId( RSCVERSION_ID );
+ aResId.SetRT( RSC_VERSIONCONTROL );
+
+ if ( rTypeId.GetResMgr()->GetResource( aResId ) )
+ {
+ rTypeId.SetRT( RSC_STRING );
+ if ( rTypeId.GetResMgr()->IsAvailable( rTypeId ) )
+ {
+ aTypStr = UniString( rTypeId );
+ // Versions Resource Klassenzeiger ans Ende setzen
+ Resource::GetResManager()->Increment( sizeof( RSHEADER_TYPE ) );
+ }
+ }
+ bInUse = FALSE;
+ }
+
+ return aTypStr;
+}
+
+// -----------------------------------------------------------------------
+
+static void RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr,
+ RESOURCE_TYPE nRT, USHORT nId,
+ ImpRCStack* pResStack, short nStackTop )
+{
+ // neuen ResourceMgr erzeugen
+ ResMgr* pNewResMgr = new ResMgr( pResMgr->GetFileName() );
+
+ ByteString aStr = ByteString( pResMgr->GetFileName(), RTL_TEXTENCODING_UTF8 );
+ if ( aStr.Len() )
+ aStr += '\n';
+
+ aStr.Append( "Class: " );
+ aStr.Append( ByteString( GetTypeRes_Impl( ResId( nRT, pNewResMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStr.Append( ", Id: " );
+ aStr.Append( ByteString::CreateFromInt32( (long)nId ) );
+ aStr.Append( ". " );
+ aStr.Append( pMessage );
+
+ aStr.Append( "\nResource Stack\n" );
+ while( nStackTop > 0 )
+ {
+ aStr.Append( "Class: " );
+ aStr.Append( ByteString( GetTypeRes_Impl( ResId( (pResStack + nStackTop)->pResource->GetRT(), pNewResMgr ) ), RTL_TEXTENCODING_UTF8 ) );
+ aStr.Append( ", Id: " );
+ aStr.Append( ByteString::CreateFromInt32( (long)(pResStack + nStackTop)->pResource->GetId() ) );
+ nStackTop--;
+ }
+
+ delete pNewResMgr;
+
+ DBG_ERROR( aStr.GetBuffer() );
+}
+
+#endif
+
+// =======================================================================
+
+static void RscException_Impl()
+{
+ switch ( NAMESPACE_VOS(OSignalHandler)::raise( OSL_SIGNAL_USER_RESOURCEFAILURE, (void*)"" ) )
+ {
+ case NAMESPACE_VOS(OSignalHandler)::TAction_CallNextHandler:
+ abort();
+ break;
+
+ case NAMESPACE_VOS(OSignalHandler)::TAction_Ignore:
+ return;
+ break;
+
+ case NAMESPACE_VOS(OSignalHandler)::TAction_AbortApplication:
+ abort();
+ break;
+
+ case NAMESPACE_VOS(OSignalHandler)::TAction_KillApplication:
+ exit(-1);
+ break;
+ }
+}
+
+// =======================================================================
+
+void ImpRCStack::Init( ResMgr* pMgr, const Resource* pObj, USHORT Id )
+{
+ pResource = NULL;
+ pClassRes = NULL;
+ Flags = RC_NOTYPE;
+ aResHandle = NULL;
+ pResObj = pObj;
+ nId = Id & ~RSC_DONTRELEASE; //TLX: Besser Init aendern
+ pResMgr = pMgr;
+ if ( !(Id & RSC_DONTRELEASE) )
+ Flags |= RC_AUTORELEASE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImpRCStack::Clear()
+{
+ pResource = NULL;
+ pClassRes = NULL;
+ Flags = RC_NOTYPE;
+ aResHandle = NULL;
+ pResObj = NULL;
+ nId = 0;
+ pResMgr = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static RSHEADER_TYPE* LocalResource( const ImpRCStack* pStack,
+ RESOURCE_TYPE nRTType,
+ USHORT nId )
+{
+ // Gibt die Position der Resource zurueck, wenn sie gefunden wurde.
+ // Ansonsten gibt die Funktion Null zurueck.
+ RSHEADER_TYPE* pTmp; // Zeiger auf Kind-Resourceobjekte
+ RSHEADER_TYPE* pEnd; // Zeiger auf das Ende der Resource
+
+ if ( pStack->pResource && pStack->pClassRes )
+ {
+ pTmp = (RSHEADER_TYPE*)
+ ((BYTE*)pStack->pResource + pStack->pResource->GetLocalOff());
+ pEnd = (RSHEADER_TYPE*)
+ ((BYTE*)pStack->pResource + pStack->pResource->GetGlobOff());
+ while ( pTmp != pEnd )
+ {
+ if ( pTmp->GetRT() == nRTType && pTmp->GetId() == nId )
+ return pTmp;
+ pTmp = (RSHEADER_TYPE*)((BYTE*)pTmp + pTmp->GetGlobOff());
+ }
+ }
+
+ return NULL;
+}
+
+// =======================================================================
+
+void ResMgr::DestroyAllResMgr()
+{
+ ImplSVResourceData* pSVInData = GetResData();
+
+ // Da auch von Abort gerufen werden kann, geben wir alle
+ // ResMgr's und alle InternalResMgr's hier frei
+ List* pMgrList = pSVInData->pInternalResMgrList;
+ if ( pMgrList )
+ {
+ InternalResMgr* pEle = (InternalResMgr*)pMgrList->First();
+ while ( pEle )
+ {
+ DBG_WARNING1( "ResMgr's not destroyed: %s",
+ ByteString( pEle->aFileName, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ pEle->ReleaseReference();
+ pEle = (InternalResMgr*)pMgrList->Next();
+ }
+ delete pMgrList;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ResMgr::Init( const UniString& rFileName )
+{
+ if ( !pImpRes )
+ {
+#ifdef DBG_UTIL
+ ByteString aStr( "Resourcefile not found:\n" );
+ aStr += ByteString( rFileName, RTL_TEXTENCODING_UTF8 );
+ DBG_ERROR( aStr.GetBuffer() );
+#endif
+ RscException_Impl();
+ }
+#ifdef DBG_UTIL
+ else
+ {
+ void* aResHandle = 0; // Hilfvariable fuer Resource
+ void* pVoid; // Zeiger auf die Resource
+
+ pVoid = pImpRes->LoadGlobalRes( RSC_VERSIONCONTROL, RSCVERSION_ID,
+ &aResHandle );
+ if ( pVoid )
+ pImpRes->FreeGlobalRes( aResHandle, pVoid );
+ else
+ {
+ ByteString aStr( "Wrong version:\n" );
+ aStr += ByteString( pImpRes->aFileName, RTL_TEXTENCODING_UTF8 );
+ DbgError( aStr.GetBuffer() );
+ }
+ }
+#endif
+
+ nTopRes = 0;
+ aStack[0].Clear();
+}
+
+// -----------------------------------------------------------------------
+
+ResMgr::ResMgr( const UniString& rFileName,
+ const UniString* pAppName,
+ const UniString* pResPath )
+{
+ pImpRes = InternalResMgr::GetInternalResMgr( rFileName, pAppName, pResPath );
+ Init( pImpRes ? (const UniString&)pImpRes->aFileName : rFileName );
+}
+
+// -----------------------------------------------------------------------
+
+ResMgr::ResMgr( InternalResMgr * pImpMgr )
+{
+ pImpRes = pImpMgr;
+ Init( pImpMgr->aFileName );
+}
+
+// -----------------------------------------------------------------------
+
+ResMgr::~ResMgr()
+{
+ InternalResMgr::FreeInternalResMgr( pImpRes );
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+
+void ResMgr::TestStack( const Resource* pResObj )
+{
+ if ( DbgIsResource() )
+ {
+ for( short i = 1; i <= nTopRes; i++ )
+ {
+ if ( aStack[i].pResObj == pResObj )
+ {
+#ifdef DBG_UTIL
+ RscError_Impl( "Resource not freed! ", this,
+ aStack[i].pResource->GetRT(),
+ aStack[i].pResource->GetId(),
+ aStack, i -1 );
+#endif
+ }
+ }
+ }
+}
+
+#else
+
+void ResMgr::TestStack( const Resource* )
+{
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+BOOL ResMgr::IsAvailable( const ResId& rId, const Resource* pResObj ) const
+{
+ BOOL bAvailable = FALSE;
+ RSHEADER_TYPE* pClassRes = rId.GetpResource();
+ RESOURCE_TYPE nRT = rId.GetRT2();
+ USHORT nId = rId.GetId();
+ const ResMgr* pMgr = rId.GetResMgr();
+
+ if ( !pMgr )
+ pMgr = this;
+
+ if ( !pResObj || pResObj == pMgr->aStack[pMgr->nTopRes].pResObj )
+ {
+ if ( !pClassRes )
+ pClassRes = LocalResource( &pMgr->aStack[pMgr->nTopRes], nRT, nId );
+ if ( pClassRes )
+ {
+ if ( pClassRes->GetRT() == nRT )
+ bAvailable = TRUE;
+ }
+ }
+
+ // vieleicht globale Resource
+ if ( !pClassRes )
+ bAvailable = pMgr->pImpRes->IsGlobalAvailable( nRT, nId );
+
+ return bAvailable;
+}
+
+// -----------------------------------------------------------------------
+
+inline ResMgr* GetActualResMgr()
+{
+ return GetResData()->pAppResMgr;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ResMgr::GetResource( const ResId& rId, const Resource* pResObj )
+{
+ DBG_TESTSOLARMUTEX();
+
+ ResMgr* pMgr = rId.GetResMgr();
+ if ( pMgr && (this != pMgr) )
+ return pMgr->GetResource( rId, pResObj );
+
+ RSHEADER_TYPE* pClassRes = rId.GetpResource();
+ RESOURCE_TYPE nRT = rId.GetRT2();
+ USHORT nId = rId.GetId();
+
+ ResMgr* pLastMgr = GetActualResMgr();
+ if ( pLastMgr != this )
+ Resource::SetResManager( this );
+
+ nTopRes++; // Stackzeiger erhoehen
+ ImpRCStack* pTop = &aStack[nTopRes];
+ pTop->Init( pLastMgr, pResObj, nId |
+ (rId.IsAutoRelease() ? 0 : RSC_DONTRELEASE) );
+
+ if ( pClassRes )
+ {
+ if ( pClassRes->GetRT() == nRT )
+ pTop->pClassRes = pClassRes;
+ else
+ {
+#ifdef DBG_UTIL
+ RscError_Impl( "Different class and resource type!",
+ this, nRT, nId, aStack, nTopRes -1 );
+#endif
+ RscException_Impl();
+ nTopRes--;
+ return FALSE;
+ }
+ }
+ else
+ pTop->pClassRes = LocalResource( pTop -1, nRT, nId );
+
+ if ( pTop->pClassRes )
+ // lokale Resource, nicht system Resource
+ pTop->pResource = (RSHEADER_TYPE *)pTop->pClassRes;
+ else
+ {
+ pTop->Flags |= RC_GLOBAL;
+ pTop->pClassRes = pImpRes->LoadGlobalRes( nRT, nId, &pTop->aResHandle );
+ if ( pTop->pClassRes )
+ pTop->pResource = (RSHEADER_TYPE *)pTop->pClassRes;
+ else
+ {
+#ifdef DBG_UTIL
+ RscError_Impl( "Cannot load resource! ",
+ this, nRT, nId, aStack, nTopRes -1 );
+#endif
+ RscException_Impl();
+ ImplSVResourceData * pRD = GetResData();
+ nTopRes--;
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void * ResMgr::GetResourceSkipHeader( const ResId& rResId, ResMgr ** ppResMgr )
+{
+ if ( rResId.GetResMgr() )
+ *ppResMgr = rResId.GetResMgr();
+ else
+ *ppResMgr = Resource::GetResManager();
+ (*ppResMgr)->GetResource( rResId );
+ (*ppResMgr)->Increment( sizeof( RSHEADER_TYPE ) );
+ return (*ppResMgr)->GetClass();
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+void ResMgr::PopContext( const Resource* pResObj )
+#else
+void ResMgr::PopContext( const Resource* )
+#endif
+{
+#ifdef DBG_UTIL
+ if ( DbgIsResource() )
+ {
+ if ( (aStack[nTopRes].pResObj != pResObj) || !nTopRes )
+ {
+ RscError_Impl( "Cannot free resource! ", this,
+ RSC_NOTYPE, 0, aStack, nTopRes );
+ }
+ }
+#endif
+
+ if ( nTopRes )
+ {
+ ImpRCStack* pTop = &aStack[nTopRes];
+#ifdef DBG_UTIL
+ if ( DbgIsResource() )
+ {
+ void* pRes = (BYTE*)pTop->pResource +
+ pTop->pResource->GetLocalOff();
+
+ if ( pTop->pClassRes != pRes )
+ {
+ RscError_Impl( "Classpointer not at the end!",
+ this, pTop->pResource->GetRT(),
+ pTop->pResource->GetId(),
+ aStack, nTopRes -1 );
+ }
+ }
+#endif
+
+ // Resource freigeben
+ if ( pTop->Flags & RC_GLOBAL )
+ // kann auch Fremd-Ressource sein
+ pImpRes->FreeGlobalRes( pTop->aResHandle, pTop->pResource );
+ if ( pTop->pResMgr != this )
+ // wurde durch ResId gesetzt, automatisch zuruecksetzen
+ Resource::SetResManager( pTop->pResMgr );
+ nTopRes--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+RSHEADER_TYPE* ResMgr::CreateBlock( const ResId& rId )
+{
+ RSHEADER_TYPE* pHeader = NULL;
+ if ( GetResource( rId ) )
+ {
+ // Der Zeiger steht am Anfang, deswegen zeigt der Klassen-Pointer
+ // auf den Header und die restliche Groesse ist die Gesammte.
+ pHeader = (RSHEADER_TYPE*)new BYTE[ GetRemainSize() ];
+ memcpy( pHeader, GetClass(), GetRemainSize() );
+ Increment( pHeader->GetLocalOff() ); //ans Ende setzen
+ if ( pHeader->GetLocalOff() != pHeader->GetGlobOff() )
+ // Hat Sub-Ressourcen, deshalb extra freigeben
+ PopContext();
+ }
+
+ return pHeader;
+}
+
+// ------------------------------------------------------------------
+
+INT16 ResMgr::GetShort( void * pShort )
+{
+#ifdef __BIGENDIAN
+ return *(UINT16*)pShort;
+#else
+ return SWAPSHORT( *(UINT16*)pShort );
+#endif
+}
+
+// ------------------------------------------------------------------
+
+INT32 ResMgr::GetLong( void * pLong )
+{
+#ifdef __BIGENDIAN
+ return (long)(((INT32)(*(UINT16*)pLong) << 16) | *(((UINT16*)pLong) + 1));
+#else
+ return ((INT32)(*(BYTE*)pLong) << 24)
+ | ((INT32)(*((BYTE*)pLong +1)) << 16)
+ | ((INT32)(*((BYTE*)pLong +2)) << 8)
+ | (INT32)(*((BYTE*)pLong +3));
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ResMgr::GetString( UniString& rStr, const BYTE* pStr )
+{
+ UniString aString( (sal_Char*)pStr, RTL_TEXTENCODING_UTF8,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
+ rStr = aString;
+ return GetStringSize( pStr );
+}
+
+// ------------------------------------------------------------------
+
+USHORT ResMgr::GetStringSize( const BYTE* pStr )
+{
+ return GetStringSize( strlen( (const char*)pStr ) );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ResMgr::GetRemainSize()
+{
+ return (USHORT)((long)(BYTE *)aStack[nTopRes].pResource +
+ aStack[nTopRes].pResource->GetLocalOff() -
+ (long)(BYTE *)aStack[nTopRes].pClassRes);
+}
+
+// -----------------------------------------------------------------------
+
+void* ResMgr::Increment( USHORT nSize )
+{
+ BYTE* pClassRes = (BYTE*)aStack[nTopRes].pClassRes + nSize;
+
+ aStack[nTopRes].pClassRes = pClassRes;
+
+ RSHEADER_TYPE* pRes = aStack[nTopRes].pResource;
+
+ if ( (pRes->GetGlobOff() == pRes->GetLocalOff()) &&
+ (((char*)pRes + pRes->GetLocalOff()) == aStack[nTopRes].pClassRes) &&
+ (aStack[nTopRes].Flags & RC_AUTORELEASE))
+ {
+ PopContext( aStack[nTopRes].pResObj );
+ }
+
+ return pClassRes;
+}
+
+// -----------------------------------------------------------------------
+
+const char* ResMgr::GetLang( LanguageType& nType, USHORT nPrio )
+{
+ static sal_Char const aDefEng[] = "44";
+ static sal_Char const aDefUSEng[] = "01";
+ static sal_Char const aDefGerman[] = "49";
+ static sal_Char const aDefFrench[] = "33";
+ static sal_Char const aDefPortuguese[] = "03";
+
+ if ( nType == LANGUAGE_SYSTEM || nType == LANGUAGE_DONTKNOW )
+ nType = ::GetSystemLanguage();
+
+ if ( nPrio == 0 )
+ {
+ switch ( nType )
+ {
+ case LANGUAGE_DANISH:
+ return "45";
+
+ case LANGUAGE_DUTCH:
+ case LANGUAGE_DUTCH_BELGIAN:
+ return "31";
+
+ case LANGUAGE_ENGLISH:
+ case LANGUAGE_ENGLISH_UK:
+ case LANGUAGE_ENGLISH_EIRE:
+ case LANGUAGE_ENGLISH_SAFRICA:
+ case LANGUAGE_ENGLISH_JAMAICA:
+ case LANGUAGE_ENGLISH_BELIZE:
+ case LANGUAGE_ENGLISH_TRINIDAD:
+ case LANGUAGE_ENGLISH_ZIMBABWE:
+ case LANGUAGE_ENGLISH_PHILIPPINES:
+ return aDefEng;
+
+ case LANGUAGE_ENGLISH_US:
+ case LANGUAGE_ENGLISH_CAN:
+ return aDefUSEng;
+
+ case LANGUAGE_ENGLISH_AUS:
+ case LANGUAGE_ENGLISH_NZ:
+ return "61";
+
+ case LANGUAGE_FINNISH:
+ return "05";
+
+ case LANGUAGE_FRENCH_CANADIAN:
+ return "02";
+
+ case LANGUAGE_FRENCH:
+ case LANGUAGE_FRENCH_BELGIAN:
+ case LANGUAGE_FRENCH_SWISS:
+ case LANGUAGE_FRENCH_LUXEMBOURG:
+ case LANGUAGE_FRENCH_MONACO:
+ return aDefFrench;
+
+ case LANGUAGE_GERMAN:
+ case LANGUAGE_GERMAN_SWISS:
+ case LANGUAGE_GERMAN_AUSTRIAN:
+ case LANGUAGE_GERMAN_LUXEMBOURG:
+ case LANGUAGE_GERMAN_LIECHTENSTEIN:
+ return aDefGerman;
+
+ case LANGUAGE_ITALIAN:
+ case LANGUAGE_ITALIAN_SWISS:
+ return "39";
+
+ case LANGUAGE_NORWEGIAN:
+ case LANGUAGE_NORWEGIAN_BOKMAL:
+ return "47";
+
+ case LANGUAGE_PORTUGUESE:
+ return aDefPortuguese;
+
+ case LANGUAGE_PORTUGUESE_BRAZILIAN:
+ return "55";
+
+ case LANGUAGE_SPANISH:
+ case LANGUAGE_SPANISH_MEXICAN:
+ case LANGUAGE_SPANISH_MODERN:
+ 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:
+ return "34";
+
+ case LANGUAGE_SWEDISH:
+ return "46";
+
+ case LANGUAGE_POLISH:
+ return "48";
+ case LANGUAGE_CZECH:
+ return "42";
+ case LANGUAGE_HUNGARIAN:
+ return "36";
+ case LANGUAGE_RUSSIAN:
+ return "07";
+ case LANGUAGE_SLOVAK:
+ return "04";
+ case LANGUAGE_GREEK:
+ return "30";
+ case LANGUAGE_TURKISH:
+ return "90";
+
+ case LANGUAGE_CHINESE_SIMPLIFIED:
+ return "86";
+ case LANGUAGE_CHINESE_TRADITIONAL:
+ return "88";
+ case LANGUAGE_JAPANESE:
+ return "81";
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ return "82";
+
+ case LANGUAGE_ARABIC:
+ case LANGUAGE_ARABIC_IRAQ:
+ case LANGUAGE_ARABIC_EGYPT:
+ case LANGUAGE_ARABIC_LIBYA:
+ case LANGUAGE_ARABIC_ALGERIA:
+ case LANGUAGE_ARABIC_MOROCCO:
+ case LANGUAGE_ARABIC_TUNISIA:
+ case LANGUAGE_ARABIC_OMAN:
+ case LANGUAGE_ARABIC_YEMEN:
+ case LANGUAGE_ARABIC_SYRIA:
+ case LANGUAGE_ARABIC_JORDAN:
+ case LANGUAGE_ARABIC_LEBANON:
+ case LANGUAGE_ARABIC_KUWAIT:
+ case LANGUAGE_ARABIC_UAE:
+ case LANGUAGE_ARABIC_BAHRAIN:
+ case LANGUAGE_ARABIC_QATAR:
+ return "96";
+
+ default:
+ return aDefUSEng;
+ }
+ }
+ else if ( nPrio == 1 )
+ {
+ switch ( nType )
+ {
+ case LANGUAGE_FRENCH_CANADIAN:
+ return aDefFrench;
+
+ case LANGUAGE_PORTUGUESE_BRAZILIAN:
+ return aDefPortuguese;
+
+ default:
+ return NULL;
+ }
+ }
+ else if ( nPrio == 2 )
+ return aDefUSEng;
+ else if ( nPrio == 3 )
+ return aDefEng;
+ else
+ return aDefGerman;
+}
+
+// -----------------------------------------------------------------------
+
+ResMgr* ResMgr::CreateResMgr( const sal_Char* pPrefixName,
+ LanguageType nType,
+ const UniString* pAppName,
+ const UniString* pResPath )
+{
+ // Suchreihenfolge festlegen
+ const sal_Char* pLang[5];
+
+ // Resourcefile suchen
+ UniString aName;
+ InternalResMgr* pInternalResMgr = NULL;
+ for ( int i = 0; i < 5; i++ )
+ {
+ pLang[i] = GetLang( nType, i );
+
+ if ( pLang[i] && (i == 0 || pLang[i] != pLang[0]) )
+ {
+ aName.AssignAscii( pPrefixName );
+ aName.AppendAscii( pLang[i] );
+ aName.AppendAscii( ".res" );
+ pInternalResMgr = InternalResMgr::GetInternalResMgr( aName, pAppName, pResPath );
+ if ( pInternalResMgr )
+ break;
+ }
+ }
+
+ if ( pInternalResMgr )
+ return new ResMgr( pInternalResMgr );
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+INT16 ResMgr::ReadShort()
+{
+ INT16 n = GetShort( GetClass() );
+ Increment( sizeof( INT16 ) );
+ return n;
+}
+
+// -----------------------------------------------------------------------
+
+INT32 ResMgr::ReadLong()
+{
+ INT32 n = GetLong( GetClass() );
+ Increment( sizeof( INT32 ) );
+ return n;
+}
+
+// -----------------------------------------------------------------------
+
+UniString ResMgr::ReadString()
+{
+ UniString aRet;
+ Increment( GetString( aRet, (const BYTE*)GetClass() ) );
+ return aRet;
+}
+
+// =======================================================================
+
+SimpleResMgr::SimpleResMgr( const sal_Char* pPrefixName,
+ LanguageType nType,
+ const UniString* pAppName,
+ const UniString* pResPath )
+{
+ // Suchreihenfolge festlegen
+ const sal_Char* pLang[5];
+
+ // Resourcefile suchen
+ UniString aName;
+ for ( int i = 0; i < 5; i++ )
+ {
+ pLang[i] = ResMgr::GetLang( nType, i );
+
+ if ( pLang[i] && (i == 0 || pLang[i] != pLang[0]) )
+ {
+ aName.AssignAscii( pPrefixName );
+ aName.AppendAscii( pLang[i] );
+ aName.AppendAscii( ".res" );
+ m_pResImpl = InternalResMgr::Create( aName, pAppName, pResPath );
+ if ( m_pResImpl )
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SimpleResMgr::~SimpleResMgr()
+{
+ delete m_pResImpl;
+}
+
+// -----------------------------------------------------------------------
+
+UniString SimpleResMgr::ReadString( USHORT nId )
+{
+ NAMESPACE_VOS(OGuard) aGuard(m_aAccessSafety);
+
+ DBG_ASSERT( m_pResImpl, "SimpleResMgr::ReadString : have no impl class !" );
+ // perhaps constructed with an invalid filename ?
+
+ UniString sReturn;
+ if ( !m_pResImpl )
+ return sReturn;
+
+ void* pResHandle = NULL;
+ RSHEADER_TYPE* pResHeader = (RSHEADER_TYPE*)m_pResImpl->LoadGlobalRes( RSC_STRING, nId, &pResHandle );
+ if ( !pResHeader )
+ // no such resource
+ return sReturn;
+
+ USHORT nLen = pResHeader->GetLocalOff() - sizeof(RSHEADER_TYPE);
+ ResMgr::GetString( sReturn, (const BYTE*)(pResHeader+1) );
+
+ // not neccessary with te current implementation which holds the string table permanently, but to be sure ....
+ m_pResImpl->FreeGlobalRes( pResHeader, pResHandle );
+ return sReturn;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SimpleResMgr::ReadBlob( USHORT nId, void** pBuffer )
+{
+ NAMESPACE_VOS(OGuard) aGuard(m_aAccessSafety);
+
+ DBG_ASSERT( m_pResImpl, "SimpleResMgr::ReadBlob : have no impl class !" );
+
+ // perhaps constructed with an invalid filename ?
+ DBG_ASSERT( pBuffer, "SimpleResMgr::ReadBlob : invalid argument !" );
+ *pBuffer = NULL;
+
+ void* pResHandle = NULL;
+ RSHEADER_TYPE* pResHeader = (RSHEADER_TYPE*)m_pResImpl->LoadGlobalRes( RSC_RESOURCE, nId, &pResHandle );
+ DBG_ASSERT( pResHeader, "SimpleResMgr::ReadBlob : couldn't find the resource with the given id !" );
+
+ // no exception handling, this would require the locking of the solar mutex which isn't allowed within this class
+ if ( !pResHeader )
+ return 0;
+
+ DBG_ASSERT( pResHandle == NULL, "SimpleResMgr::ReadBlob : behaviour of LoadGlobalRes changed !" );
+ // if pResHandle is not NULL the FreeBlob wouldn't have to delete the pointer given as pBuffer, but
+ // FreeBlob doesn't know that so it would probably crash ....
+
+ USHORT nRemaining = pResHeader->GetLocalOff() - sizeof(RSHEADER_TYPE);
+ *pBuffer = (void*)(((BYTE*)pResHeader) + sizeof(RSHEADER_TYPE));
+ return nRemaining;
+}
+
+// -----------------------------------------------------------------------
+
+void SimpleResMgr::FreeBlob( void* pBuffer )
+{
+ void* pCompleteBuffer = (void*)(((BYTE*)pBuffer) - sizeof(RSHEADER_TYPE));
+ delete pCompleteBuffer;
+}
diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx
new file mode 100644
index 000000000000..3db59910725c
--- /dev/null
+++ b/tools/source/ref/errinf.cxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * $RCSfile: errinf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <limits.h>
+#include <shl.hxx>
+#include <debug.hxx>
+#include <errinf.hxx>
+#include <string.hxx>
+
+class ErrorHandler;
+
+struct EDcrData
+{
+ public:
+
+ ErrorHandler *pFirstHdl;
+ ErrorContext *pFirstCtx;
+ void *pDsp;
+ BOOL bIsWindowDsp;
+
+
+ DynamicErrorInfo *ppDcr[ERRCODE_DYNAMIC_COUNT];
+ USHORT nNextDcr;
+ EDcrData();
+
+static EDcrData *GetData();
+
+};
+
+class EDcr_Impl
+{
+ ULONG lErrId;
+ USHORT nMask;
+
+ void RegisterEDcr(DynamicErrorInfo *);
+ void UnRegisterEDcr(DynamicErrorInfo *);
+ static ErrorInfo *GetDynamicErrorInfo(ULONG lId);
+
+friend class DynamicErrorInfo;
+friend class ErrorInfo;
+};
+
+
+EDcrData::EDcrData()
+{
+ for(USHORT n=0;n<ERRCODE_DYNAMIC_COUNT;n++)
+ ppDcr[n]=0;
+ nNextDcr=0;
+ pFirstHdl=0;
+ pDsp=0;
+ pFirstCtx=0;
+}
+
+
+EDcrData *EDcrData::GetData()
+{
+#ifdef BOOTSTRAP
+ return 0x0;
+#else
+ EDcrData **ppDat=(EDcrData **)GetAppData(SHL_ERR);
+ if(!*ppDat)
+ {
+ return (*ppDat=new EDcrData);
+ }
+ else
+ return *ppDat;
+#endif
+}
+
+void EDcr_Impl::RegisterEDcr(DynamicErrorInfo *pDcr)
+{
+ //Vergibt eine dynamische Id
+
+ EDcrData* pData=EDcrData::GetData();
+ lErrId= (((ULONG)pData->nNextDcr + 1) << ERRCODE_DYNAMIC_SHIFT) +
+ pDcr->GetErrorCode();
+ DynamicErrorInfo **ppDcr=pData->ppDcr;
+ USHORT nNext=pData->nNextDcr;
+
+ // bei einem Ringbuffer koennen wir uns das ASSERT wohl sparen!
+ // DBG_ASSERT(ppDcr[nNext]==0,"ErrHdl: Alle Errors belegt");
+ if(ppDcr[nNext])
+ {
+ delete ppDcr[nNext];
+ }
+ ppDcr[nNext]=pDcr;
+ if(++pData->nNextDcr>=ERRCODE_DYNAMIC_COUNT)
+ pData->nNextDcr=0;
+}
+
+
+void EDcr_Impl::UnRegisterEDcr(DynamicErrorInfo *pDcr)
+{
+
+ EDcrData* pData=EDcrData::GetData();
+ DynamicErrorInfo **ppDcr=pData->ppDcr;
+ ULONG lIdx=(
+ ((ULONG)(*pDcr) & ERRCODE_DYNAMIC_MASK)>>ERRCODE_DYNAMIC_SHIFT)-1;
+ DBG_ASSERT(ppDcr[lIdx]==pDcr,"ErrHdl: Error nicht gefunden");
+ if(ppDcr[lIdx]==pDcr)
+ ppDcr[lIdx]=0;
+}
+
+TYPEINIT0(ErrorInfo);
+TYPEINIT1(DynamicErrorInfo, ErrorInfo);
+TYPEINIT1(StandardErrorInfo, DynamicErrorInfo);
+TYPEINIT1(StringErrorInfo, DynamicErrorInfo);
+TYPEINIT1(TwoStringErrorInfo, DynamicErrorInfo);
+TYPEINIT1(MessageInfo, DynamicErrorInfo);
+
+
+ErrorInfo *ErrorInfo::GetErrorInfo(ULONG lId)
+{
+ if(lId & ERRCODE_DYNAMIC_MASK)
+ return EDcr_Impl::GetDynamicErrorInfo(lId);
+ else
+ return new ErrorInfo(lId);
+}
+
+DynamicErrorInfo::operator ULONG() const
+{
+ return pImpl->lErrId;
+}
+
+DynamicErrorInfo::DynamicErrorInfo(ULONG lArgUserId, USHORT nMask)
+: ErrorInfo(lArgUserId)
+{
+ pImpl=new EDcr_Impl;
+ pImpl->RegisterEDcr(this);
+ pImpl->nMask=nMask;
+}
+
+DynamicErrorInfo::~DynamicErrorInfo()
+{
+ pImpl->UnRegisterEDcr(this);
+ delete pImpl;
+}
+
+ErrorInfo* EDcr_Impl::GetDynamicErrorInfo(ULONG lId)
+{
+ ULONG lIdx=((lId & ERRCODE_DYNAMIC_MASK)>>ERRCODE_DYNAMIC_SHIFT)-1;
+ DynamicErrorInfo* pDcr=EDcrData::GetData()->ppDcr[lIdx];
+ if(pDcr && (ULONG)(*pDcr)==lId)
+ return pDcr;
+ else
+ return new ErrorInfo(lId & ~ERRCODE_DYNAMIC_MASK);
+}
+
+
+USHORT DynamicErrorInfo::GetDialogMask() const
+{
+ return pImpl->nMask;
+}
+
+
+StandardErrorInfo::StandardErrorInfo(
+ ULONG lUserId, ULONG lArgExtId, USHORT nFlags)
+: DynamicErrorInfo(lUserId, nFlags), lExtId(lArgExtId)
+{
+}
+
+
+StringErrorInfo::StringErrorInfo(
+ ULONG lUserId, const String& aStringP, USHORT nFlags)
+: DynamicErrorInfo(lUserId, nFlags), aString(aStringP)
+{
+}
+
+
+class ErrHdl_Impl
+{
+ public:
+
+ ErrorHandler *pNext;
+ static BOOL CreateString(const ErrorHandler *pStart,
+ const ErrorInfo*, String&, USHORT&);
+};
+
+
+static void aDspFunc(const String &rErr, const String &rAction)
+{
+ ByteString aErr("Aktion: ");
+ aErr+= ByteString( rAction, RTL_TEXTENCODING_ASCII_US );
+ aErr+=" Fehler: ";
+ aErr+= ByteString( rErr, RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR(aErr.GetBuffer());
+}
+
+
+ErrorContext::ErrorContext(Window *pWinP)
+{
+ EDcrData *pData=EDcrData::GetData();
+ ErrorContext *&pHdl=pData->pFirstCtx;
+ pWin=pWinP;
+ pNext=pHdl;
+ pHdl=this;
+}
+
+ErrorContext::~ErrorContext()
+{
+ ErrorContext **ppCtx=&(EDcrData::GetData()->pFirstCtx);
+ while(*ppCtx && *ppCtx!=this)
+ ppCtx=&((*ppCtx)->pNext);
+ if(*ppCtx)
+ *ppCtx=(*ppCtx)->pNext;
+}
+
+ErrorContext *ErrorContext::GetContext()
+{
+ return EDcrData::GetData()->pFirstCtx;
+}
+
+ErrorHandler::ErrorHandler()
+{
+ pImpl=new ErrHdl_Impl;
+ EDcrData *pData=EDcrData::GetData();
+ ErrorHandler *&pHdl=pData->pFirstHdl;
+ pImpl->pNext=pHdl;
+ pHdl=this;
+ if(!pData->pDsp)
+ RegisterDisplay(&aDspFunc);
+}
+
+ErrorHandler::~ErrorHandler()
+{
+ ErrorHandler **ppHdl=&(EDcrData::GetData()->pFirstHdl);
+ while(*ppHdl && *ppHdl!=this)
+ ppHdl=&((*ppHdl)->pImpl->pNext);
+ if(*ppHdl)
+ *ppHdl=(*ppHdl)->pImpl->pNext;
+ delete pImpl;
+}
+
+void ErrorHandler::RegisterDisplay(WindowDisplayErrorFunc *aDsp)
+{
+ EDcrData *pData=EDcrData::GetData();
+ pData->bIsWindowDsp=TRUE;
+ pData->pDsp=(void*)aDsp;
+}
+
+void ErrorHandler::RegisterDisplay(BasicDisplayErrorFunc *aDsp)
+{
+ EDcrData *pData=EDcrData::GetData();
+ pData->bIsWindowDsp=FALSE;
+ pData->pDsp=(void*)aDsp;
+}
+
+USHORT ErrorHandler::HandleError(ULONG lId, USHORT nFlags)
+{
+
+/* [Beschreibung]
+ Handelt einen Fehler ab. lId ist die FehlerId, nFlags sind die
+ ErrorFlags. Werden nFlags nicht abgegeben, so werden die in
+ der DynamicErrorInfo angegebenen Flags bzw. die aus der Resource
+ verwendet.
+
+ Also:
+
+ 1. nFlags,
+ 2. Resource Flags
+ 3. Dynamic Flags
+ 4. Default ERRCODE_BUTTON_OK, ERRCODE_MSG_ERROR
+
+
+ */
+
+ String aErr;
+ String aAction;
+ if(!lId || lId == ERRCODE_ABORT)
+ return 0;
+ EDcrData *pData=EDcrData::GetData();
+ ErrorInfo *pInfo=ErrorInfo::GetErrorInfo(lId);
+ ErrorContext *pCtx=ErrorContext::GetContext();
+ if(pCtx)
+ pCtx->GetString(pInfo->GetErrorCode(), aAction);
+ Window *pParent=0;
+ //Nimm den Parent aus dem Konext
+ for(;pCtx;pCtx=pCtx->pNext)
+ if(pCtx->GetParent())
+ {
+ pParent=pCtx->GetParent();
+ break;
+ }
+
+ USHORT nErrFlags = ERRCODE_BUTTON_DEF_OK | ERRCODE_BUTTON_OK |
+ ERRCODE_MSG_ERROR;
+
+ DynamicErrorInfo* pDynPtr=PTR_CAST(DynamicErrorInfo,pInfo);
+ if(pDynPtr)
+ {
+ USHORT nDynFlags = pDynPtr->GetDialogMask();
+ if( nDynFlags )
+ nErrFlags = nDynFlags;
+ }
+
+ if(ErrHdl_Impl::CreateString(pData->pFirstHdl,pInfo,aErr,nErrFlags))
+ {
+ delete pInfo;
+ if(!pData->pDsp)
+ {
+
+ ByteString aStr("Action: ");
+ aStr += ByteString( aAction, RTL_TEXTENCODING_ASCII_US );
+ aStr += ByteString("\nFehler: ");
+ aStr += ByteString( aErr, RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aStr.GetBuffer() );
+ }
+ else
+ if(!pData->bIsWindowDsp)
+ {
+ (*(BasicDisplayErrorFunc*)pData->pDsp)(aErr,aAction);
+ return 0;
+ }
+ else
+ {
+ if( nFlags != USHRT_MAX )
+ nErrFlags = nFlags;
+ return (*(WindowDisplayErrorFunc*)pData->pDsp)(
+ pParent, nErrFlags, aErr, aAction);
+ }
+ }
+
+ DBG_ERROR("Error nicht behandelt");
+ // Error 1 ist General Error im Sfx
+ if(pInfo->GetErrorCode()!=1)
+ HandleError(1, USHRT_MAX);
+ else
+ DBG_ERROR("Error 1 nicht gehandeled");
+ delete pInfo;
+ return 0;
+}
+
+BOOL ErrorHandler::ForwCreateString(const ErrorInfo* pInfo, String& rStr, USHORT &rFlags) const
+{
+ return ErrHdl_Impl::CreateString(this->pImpl->pNext, pInfo, rStr, rFlags);
+}
+
+BOOL ErrHdl_Impl::CreateString( const ErrorHandler *pStart,
+ const ErrorInfo* pInfo, String& pStr,
+ USHORT &rFlags)
+{
+ for(const ErrorHandler *pHdl=pStart;pHdl;pHdl=pHdl->pImpl->pNext)
+ {
+ if(pHdl->CreateString( pInfo, pStr, rFlags))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL SimpleErrorHandler::CreateString(
+ const ErrorInfo *pInfo, String &rStr, USHORT &) const
+{
+ ULONG nId = pInfo->GetErrorCode();
+ ByteString aStr;
+ aStr="Id ";
+ aStr+=ByteString::CreateFromInt32(nId);
+ aStr+=" only handled by SimpleErrorHandler";
+ aStr+="\nErrorCode: ";
+ aStr+=ByteString::CreateFromInt32(nId & ((1L << ERRCODE_CLASS_SHIFT) - 1 ));
+ aStr+="\nErrorClass: ";
+ aStr+=ByteString::CreateFromInt32((nId & ERRCODE_CLASS_MASK) >> ERRCODE_CLASS_SHIFT);
+ aStr+="\nErrorArea: ";
+ aStr+=ByteString::CreateFromInt32((nId & ERRCODE_ERROR_MASK &
+ ~((1 << ERRCODE_AREA_SHIFT ) -1 ) ) >> ERRCODE_AREA_SHIFT);
+ DynamicErrorInfo *pDyn=PTR_CAST(DynamicErrorInfo,pInfo);
+ if(pDyn)
+ {
+ aStr+="\nDId ";
+ aStr+=ByteString::CreateFromInt32((ULONG)*pDyn);
+ }
+ StandardErrorInfo *pStd=PTR_CAST(StandardErrorInfo,pInfo);
+ if(pStd)
+ {
+ aStr+="\nXId ";
+ aStr+=ByteString::CreateFromInt32(pStd->GetExtendedErrorCode());
+ }
+ rStr = String( aStr, RTL_TEXTENCODING_ASCII_US );
+ return TRUE;
+}
+
+SimpleErrorHandler::SimpleErrorHandler()
+ : ErrorHandler()
+{
+}
+
diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx
new file mode 100644
index 000000000000..f19c0e5fa805
--- /dev/null
+++ b/tools/source/ref/globname.cxx
@@ -0,0 +1,441 @@
+/*************************************************************************
+ *
+ * $RCSfile: globname.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <stream.hxx>
+#include <globname.hxx>
+
+#pragma hdrstop
+
+/************** class ImpSvGlobalName ************************************/
+ImpSvGlobalName::ImpSvGlobalName( const ImpSvGlobalName & rObj )
+{
+ nRefCount = 0;
+ memcpy( szData, rObj.szData, sizeof( szData ) );
+}
+
+/************** class ImpSvGlobalName ************************************/
+ImpSvGlobalName::ImpSvGlobalName( int )
+{
+ nRefCount = 1;
+ memset( szData, 0, sizeof( szData ) );
+}
+
+/*************************************************************************
+|* ImpSvGlobalName::operator ==()
+*************************************************************************/
+BOOL ImpSvGlobalName::operator == ( const ImpSvGlobalName & rObj ) const
+{
+ return !memcmp( szData, rObj.szData, sizeof( szData ) );
+}
+
+/*************************************************************************
+|* SvGlobalName::SvGlobalName()
+*************************************************************************/
+SvGlobalName::SvGlobalName()
+{
+ static ImpSvGlobalName aNoName( 0 );
+
+ pImp = &aNoName;
+ pImp->nRefCount++;
+}
+
+// locker die Struktur von Windows kopiert
+#ifdef WNT
+struct _GUID
+#else
+struct GUID
+#endif
+{
+ UINT32 Data1;
+ UINT16 Data2;
+ UINT16 Data3;
+ BYTE Data4[8];
+};
+SvGlobalName::SvGlobalName( const CLSID & rId )
+{
+ pImp = new ImpSvGlobalName();
+ pImp->nRefCount++;
+ memcpy( pImp->szData, &rId, sizeof( pImp->szData ) );
+}
+
+SvGlobalName::SvGlobalName( UINT32 n1, USHORT n2, USHORT n3,
+ BYTE b8, BYTE b9, BYTE b10, BYTE b11,
+ BYTE b12, BYTE b13, BYTE b14, BYTE b15 )
+{
+ pImp = new ImpSvGlobalName();
+ pImp->nRefCount++;
+
+ *(UINT32 *)pImp->szData = n1;
+ *(USHORT *)&pImp->szData[ 4 ] = n2;
+ *(USHORT *)&pImp->szData[ 6 ] = n3;
+ pImp->szData[ 8 ] = b8;
+ pImp->szData[ 9 ] = b9;
+ pImp->szData[ 10 ] = b10;
+ pImp->szData[ 11 ] = b11;
+ pImp->szData[ 12 ] = b12;
+ pImp->szData[ 13 ] = b13;
+ pImp->szData[ 14 ] = b14;
+ pImp->szData[ 15 ] = b15;
+}
+
+/*************************************************************************
+|* SvGlobalName::~SvGlobalName()
+*************************************************************************/
+SvGlobalName::~SvGlobalName()
+{
+ pImp->nRefCount--;
+ if( !pImp->nRefCount )
+ delete pImp;
+}
+
+/*************************************************************************
+|* SvGlobalName::operator = ()
+*************************************************************************/
+SvGlobalName & SvGlobalName::operator = ( const SvGlobalName & rObj )
+{
+ rObj.pImp->nRefCount++;
+ pImp->nRefCount--;
+ if( !pImp->nRefCount )
+ delete pImp;
+ pImp = rObj.pImp;
+ return *this;
+}
+
+/*************************************************************************
+|* SvGlobalName::NewImp()
+*************************************************************************/
+void SvGlobalName::NewImp()
+{
+ if( pImp->nRefCount > 1 )
+ {
+ pImp->nRefCount--;
+ pImp = new ImpSvGlobalName( *pImp );
+ pImp->nRefCount++;
+ }
+}
+
+/*************************************************************************
+|* SvGlobalName::operator << ()
+|* SvGlobalName::operator >> ()
+*************************************************************************/
+SvStream& operator << ( SvStream& rOStr, const SvGlobalName & rObj )
+{
+ rOStr << *(UINT32 *)rObj.pImp->szData;
+ rOStr << *(USHORT *)&rObj.pImp->szData[ 4 ];
+ rOStr << *(USHORT *)&rObj.pImp->szData[ 6 ];
+ rOStr.Write( (sal_Char *)&rObj.pImp->szData[ 8 ], 8 );
+ return rOStr;
+}
+
+SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj )
+{
+ rObj.NewImp(); // kopieren, falls noetig
+ rStr >> *(UINT32 *)rObj.pImp->szData;
+ rStr >> *(USHORT *)&rObj.pImp->szData[ 4 ];
+ rStr >> *(USHORT *)&rObj.pImp->szData[ 6 ];
+ rStr.Read( (sal_Char *)&rObj.pImp->szData[ 8 ], 8 );
+ return rStr;
+}
+
+
+/*************************************************************************
+|* SvGlobalName::operator < ()
+*************************************************************************/
+BOOL SvGlobalName::operator < ( const SvGlobalName & rObj ) const
+{
+ int n = memcmp( pImp->szData +6, rObj.pImp->szData +6,
+ sizeof( pImp->szData ) -6);
+ if( n < 0 )
+ return TRUE;
+ else if( n > 0 )
+ return FALSE;
+ else if( *(USHORT *)&pImp->szData[ 4 ] < *(USHORT *)&rObj.pImp->szData[ 4 ] )
+ return TRUE;
+ else if( *(USHORT *)&pImp->szData[ 4 ] == *(USHORT *)&rObj.pImp->szData[ 4 ] )
+ return *(UINT32 *)pImp->szData < *(UINT32 *)rObj.pImp->szData;
+ else
+ return FALSE;
+
+}
+
+/*************************************************************************
+|* SvGlobalName::operator +=()
+*************************************************************************/
+SvGlobalName & SvGlobalName::operator += ( UINT32 n )
+{
+ NewImp();
+ UINT32 nOld = (*(UINT32 *)pImp->szData);
+ (*(UINT32 *)pImp->szData) += n;
+ if( nOld > *(UINT32 *)pImp->szData )
+ // ueberlauf
+ (*(USHORT *)&pImp->szData[ 4 ])++;
+ return *this;
+}
+
+/*************************************************************************
+|* SvGlobalName::operator ==()
+*************************************************************************/
+BOOL SvGlobalName::operator == ( const SvGlobalName & rObj ) const
+{
+ return *pImp == *rObj.pImp;
+}
+
+void SvGlobalName::MakeFromMemory( void * pData )
+{
+ NewImp();
+ memcpy( pImp->szData, pData, sizeof( pImp->szData ) );
+}
+
+/*************************************************************************
+|* SvGlobalName::MakeId()
+*************************************************************************/
+BOOL SvGlobalName::MakeId( const String & rIdStr )
+{
+ ByteString aStr( rIdStr, RTL_TEXTENCODING_ASCII_US );
+ sal_Char * pStr = (sal_Char *)aStr.GetBuffer();
+ if( rIdStr.Len() == 36
+ && '-' == pStr[ 8 ] && '-' == pStr[ 13 ]
+ && '-' == pStr[ 18 ] && '-' == pStr[ 23 ] )
+ {
+ UINT32 nFirst = 0;
+ int i = 0;
+ for( i = 0; i < 8; i++ )
+ {
+ if( isxdigit( *pStr ) )
+ if( isdigit( *pStr ) )
+ nFirst = nFirst * 16 + (*pStr - '0');
+ else
+ nFirst = nFirst * 16 + (toupper( *pStr ) - 'A' + 10 );
+ else
+ return FALSE;
+ pStr++;
+ }
+
+ UINT16 nSec = 0;
+ pStr++;
+ for( i = 0; i < 4; i++ )
+ {
+ if( isxdigit( *pStr ) )
+ if( isdigit( *pStr ) )
+ nSec = nSec * 16 + (*pStr - '0');
+ else
+ nSec = nSec * 16 + (toupper( *pStr ) - 'A' + 10 );
+ else
+ return FALSE;
+ pStr++;
+ }
+
+ UINT16 nThird = 0;
+ pStr++;
+ for( i = 0; i < 4; i++ )
+ {
+ if( isxdigit( *pStr ) )
+ if( isdigit( *pStr ) )
+ nThird = nThird * 16 + (*pStr - '0');
+ else
+ nThird = nThird * 16 + (toupper( *pStr ) - 'A' + 10 );
+ else
+ return FALSE;
+ pStr++;
+ }
+
+ BYTE szRemain[ 8 ];
+ memset( szRemain, 0, sizeof( szRemain ) );
+ pStr++;
+ for( i = 0; i < 16; i++ )
+ {
+ if( isxdigit( *pStr ) )
+ if( isdigit( *pStr ) )
+ szRemain[i/2] = szRemain[i/2] * 16 + (*pStr - '0');
+ else
+ szRemain[i/2] = szRemain[i/2] * 16 + (toupper( *pStr ) - 'A' + 10 );
+ else
+ return FALSE;
+ pStr++;
+ if( i == 3 )
+ pStr++;
+ }
+
+ NewImp();
+ *(UINT32 *)pImp->szData = nFirst;
+ *(USHORT *)&pImp->szData[ 4 ] = nSec;
+ *(USHORT *)&pImp->szData[ 6 ] = nThird;
+ memcpy( &pImp->szData[ 8 ], szRemain, 8 );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvGlobalName::GetctorName()
+*************************************************************************/
+String SvGlobalName::GetctorName() const
+{
+ ByteString aRet;
+
+ sal_Char buf[ 20 ];
+ sprintf( buf, "0x%8.8lX", (ULONG)*(UINT32 *)pImp->szData );
+ aRet += buf;
+ USHORT i;
+ for( i = 4; i < 8; i += 2 )
+ {
+ aRet += ',';
+ sprintf( buf, "0x%4.4X", *(USHORT *)&pImp->szData[ i ] );
+ aRet += buf;
+ }
+ for( i = 8; i < 16; i++ )
+ {
+ aRet += ',';
+ sprintf( buf, "0x%2.2x", pImp->szData[ i ] );
+ aRet += buf;
+ }
+ return String( aRet, RTL_TEXTENCODING_ASCII_US );
+}
+
+/*************************************************************************
+|* SvGlobalName::GetHexName()
+*************************************************************************/
+String SvGlobalName::GetHexName() const
+{
+ ByteString aRet;
+
+ sal_Char buf[ 10 ];
+ sprintf( buf, "%8.8lX", (ULONG)*(UINT32 *)pImp->szData );
+ aRet += buf;
+ aRet += '-';
+ USHORT i ;
+ for( i = 4; i < 8; i += 2 )
+ {
+ sprintf( buf, "%4.4X", *(USHORT *)&pImp->szData[ i ] );
+ aRet += buf;
+ aRet += '-';
+ }
+ for( i = 8; i < 10; i++ )
+ {
+ sprintf( buf, "%2.2x", pImp->szData[ i ] );
+ aRet += buf;
+ }
+ aRet += '-';
+ for( i = 10; i < 16; i++ )
+ {
+ sprintf( buf, "%2.2x", pImp->szData[ i ] );
+ aRet += buf;
+ }
+ return String( aRet, RTL_TEXTENCODING_ASCII_US );
+}
+
+/************** SvGlobalNameList ****************************************/
+/************************************************************************/
+/*************************************************************************
+|* SvGlobalNameList::SvGlobalNameList()
+*************************************************************************/
+SvGlobalNameList::SvGlobalNameList()
+ : aList( 1, 1 )
+{
+}
+
+/*************************************************************************
+|* SvGlobalNameList::~SvGlobalNameList()
+*************************************************************************/
+SvGlobalNameList::~SvGlobalNameList()
+{
+ for( ULONG i = Count(); i > 0; i-- )
+ {
+ ImpSvGlobalName * pImp = (ImpSvGlobalName *)aList.GetObject( i -1 );
+ pImp->nRefCount--;
+ if( !pImp->nRefCount )
+ delete pImp;
+ }
+}
+
+/*************************************************************************
+|* SvGlobalNameList::Append()
+*************************************************************************/
+void SvGlobalNameList::Append( const SvGlobalName & rName )
+{
+ rName.pImp->nRefCount++;
+ aList.Insert( rName.pImp, LIST_APPEND );
+}
+
+/*************************************************************************
+|* SvGlobalNameList::GetObject()
+*************************************************************************/
+SvGlobalName SvGlobalNameList::GetObject( ULONG nPos )
+{
+ return SvGlobalName( (ImpSvGlobalName *)aList.GetObject( nPos ) );
+}
+
+/*************************************************************************
+|* SvGlobalNameList::IsEntry()
+*************************************************************************/
+BOOL SvGlobalNameList::IsEntry( const SvGlobalName & rName )
+{
+ for( ULONG i = Count(); i > 0; i-- )
+ {
+ if( *rName.pImp == *(ImpSvGlobalName *)aList.GetObject( i -1 ) )
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/tools/source/ref/makefile.mk b/tools/source/ref/makefile.mk
new file mode 100644
index 000000000000..ad85f0accd62
--- /dev/null
+++ b/tools/source/ref/makefile.mk
@@ -0,0 +1,90 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=ref
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/ref.obj \
+ $(SLO)$/pstm.obj \
+ $(SLO)$/globname.obj \
+ $(SLO)$/errinf.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/ref.obj \
+ $(OBJ)$/pstm.obj \
+ $(OBJ)$/globname.obj \
+ $(OBJ)$/errinf.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx
new file mode 100644
index 000000000000..93ba671a2da1
--- /dev/null
+++ b/tools/source/ref/pstm.cxx
@@ -0,0 +1,945 @@
+/*************************************************************************
+ *
+ * $RCSfile: pstm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <debug.hxx>
+#include <pstm.hxx>
+
+#pragma hdrstop
+
+#define STOR_NO_OPTIMIZE
+
+/***********************************************************************/
+/************************************************************************
+|* SvClassManager::Register()
+*************************************************************************/
+void SvClassManager::Register( USHORT nClassId, SvCreateInstancePersist pFunc )
+{
+#ifdef DBG_UTIL
+ SvCreateInstancePersist p;
+ p = (SvCreateInstancePersist)aAssocTable.Get( nClassId );
+ DBG_ASSERT( !p || p == pFunc, "register class with same id" )
+#endif
+ aAssocTable.Insert( nClassId, (void *)pFunc );
+}
+
+/************************************************************************
+|* SvClassManager::Get()
+*************************************************************************/
+SvCreateInstancePersist SvClassManager::Get( USHORT nClassId )
+{
+ return (SvCreateInstancePersist)aAssocTable.Get( nClassId );
+}
+
+/****************** SvRttiBase *******************************************/
+TYPEINIT0( SvRttiBase );
+
+/****************** SvPersistBaseMemberList ******************************/
+#define inline
+SV_IMPL_REF_LIST(SuperSvPersistBase,SuperSvPersistBase*)
+#undef inline
+
+#define PERSIST_LIST_VER (BYTE)0
+#define PERSIST_LIST_DBGUTIL (BYTE)0x80
+
+/************************************************************************
+|* SvPersistBaseMemberList::WriteOnlyStreamedObjects()
+*************************************************************************/
+void SvPersistBaseMemberList::WriteObjects( SvPersistStream & rStm,
+ BOOL bOnlyStreamed ) const
+{
+#ifdef STOR_NO_OPTIMIZE
+ rStm << (BYTE)(PERSIST_LIST_VER | PERSIST_LIST_DBGUTIL);
+ UINT32 nObjPos = rStm.WriteDummyLen();
+#else
+ BYTE bTmp = PERSIST_LIST_VER;
+ rStm << bTmp;
+#endif
+ UINT32 nCount = Count();
+ ULONG nCountPos = rStm.Tell();
+ UINT32 nWriteCount = 0;
+ rStm << nCount;
+ //bloss die Liste nicht veraendern,
+ //wegen Seiteneffekten beim Save
+ for( ULONG n = 0; n < nCount; n++ )
+ {
+ SvPersistBase * pObj = GetObject( n );
+ if( !bOnlyStreamed || rStm.IsStreamed( pObj ) )
+ { // Objekt soll geschrieben werden
+ rStm << GetObject( n );
+ nWriteCount++;
+ }
+ }
+ if( nWriteCount != nCount )
+ {
+ // nicht alle Objekte geschrieben, Count anpassen
+ ULONG nPos = rStm.Tell();
+ rStm.Seek( nCountPos );
+ rStm << nWriteCount;
+ rStm.Seek( nPos );
+ }
+#ifdef STOR_NO_OPTIMIZE
+ rStm.WriteLen( nObjPos );
+#endif
+}
+
+/************************************************************************
+|* operator << ()
+*************************************************************************/
+SvPersistStream& operator << ( SvPersistStream & rStm,
+ const SvPersistBaseMemberList & rLst )
+{
+ rLst.WriteObjects( rStm );
+ return rStm;
+}
+
+/************************************************************************
+|* operator >> ()
+*************************************************************************/
+SvPersistStream& operator >> ( SvPersistStream & rStm,
+ SvPersistBaseMemberList & rLst )
+{
+ BYTE nVer;
+ rStm >> nVer;
+
+ if( (nVer & ~PERSIST_LIST_DBGUTIL) != PERSIST_LIST_VER )
+ {
+ rStm.SetError( SVSTREAM_GENERALERROR );
+ DBG_ERROR( "persist list, false version" )
+ }
+
+ UINT32 nObjLen, nObjPos;
+ if( nVer & PERSIST_LIST_DBGUTIL )
+ nObjLen = rStm.ReadLen( &nObjPos );
+
+ ULONG nCount;
+ rStm >> nCount;
+ for( ULONG n = 0; n < nCount && rStm.GetError() == SVSTREAM_OK; n++ )
+ {
+ SvPersistBase * pObj;
+ rStm >> pObj;
+ if( pObj )
+ rLst.Append( pObj );
+ }
+#ifdef DBG_UTIL
+ if( nObjLen + nObjPos != rStm.Tell() )
+ {
+ ByteString aStr( "false list len: read = " );
+ aStr += ByteString::CreateFromInt32( (long)(rStm.Tell() - nObjPos) );
+ aStr += ", should = ";
+ aStr += nObjLen;
+ DBG_ERROR( aStr.GetBuffer() )
+ }
+#endif
+ return rStm;
+}
+
+//=========================================================================
+SvPersistStream::SvPersistStream
+(
+ SvClassManager & rMgr, /* Alle Factorys, deren Objekt geladen und
+ gespeichert werdn k"onnen */
+ SvStream * pStream, /* Dieser Stream wird als Medium genommen, auf
+ dem der PersistStream arbeitet */
+ UINT32 nStartIdxP /* Ab diesem Index werden die Id's f"ur
+ die Objekte vergeben, er muss gr"osser
+ als Null sein. */
+)
+ : rClassMgr( rMgr )
+ , pStm( pStream )
+ , aPUIdx( nStartIdxP )
+ , nStartIdx( nStartIdxP )
+ , pRefStm( NULL )
+ , nFlags( 0 )
+/* [Beschreibung]
+
+ Der Konstruktor der Klasse SvPersistStream. Die Objekte rMgr und
+ pStream d"urfen nicht ver"andert werden, solange sie in einem
+ SvPersistStream eingesetzt sind. Eine Aussnahme gibt es f"ur
+ pStream (siehe <SvPersistStream::SetStream>).
+*/
+{
+ DBG_ASSERT( nStartIdx != 0, "zero index not allowed" )
+ bIsWritable = TRUE;
+ if( pStm )
+ {
+ SetVersion( pStm->GetVersion() );
+ SetError( pStm->GetError() );
+ SyncSvStream( pStm->Tell() );
+ }
+}
+
+//=========================================================================
+SvPersistStream::SvPersistStream
+(
+ SvClassManager & rMgr, /* Alle Factorys, deren Objekt geladen und
+ gespeichert werdn k"onnen */
+ SvStream * pStream, /* Dieser Stream wird als Medium genommen, auf
+ dem der PersistStream arbeitet */
+ const SvPersistStream & rPersStm
+ /* Wenn PersistStream's verschachtelt werden,
+ dann ist dies der Parent-Stream. */
+)
+ : rClassMgr( rMgr )
+ , pStm( pStream )
+ // Bereiche nicht ueberschneiden, deshalb nur groessere Indexe
+ , aPUIdx( rPersStm.GetCurMaxIndex() +1 )
+ , nStartIdx( rPersStm.GetCurMaxIndex() +1 )
+ , pRefStm( &rPersStm )
+ , nFlags( 0 )
+/* [Beschreibung]
+
+ Der Konstruktor der Klasse SvPersistStream. Die Objekte rMgr und
+ pStream d"urfen nicht ver"andert werden, solange sie in einem
+ SvPersistStream eingesetzt sind. Eine Aussnahme gibt es f"ur
+ pStream (siehe <SvPersistStream::SetStream>).
+ Durch diesen Konstruktor wird eine Hierarchiebildung unterst"utzt.
+ Alle Objekte aus einer Hierarchie m"ussen erst geladen werden,
+ wenn das erste aus dieser Hierarchie benutzt werden soll.
+*/
+{
+ bIsWritable = TRUE;
+ if( pStm )
+ {
+ SetVersion( pStm->GetVersion() );
+ SetError( pStm->GetError() );
+ SyncSvStream( pStm->Tell() );
+ }
+}
+
+//=========================================================================
+SvPersistStream::~SvPersistStream()
+/* [Beschreibung]
+
+ Der Detruktor ruft die Methode <SvPersistStream::SetStream>
+ mit NULL.
+*/
+{
+ SetStream( NULL );
+}
+
+//=========================================================================
+void SvPersistStream::SetStream
+(
+ SvStream * pStream /* auf diesem Stream arbeitet der PersistStream */
+
+)
+/* [Beschreibung]
+
+ Es wird ein Medium (pStream) eingesetzt, auf dem PersistStream arbeitet.
+ Dieses darf nicht von aussen modifiziert werden, solange es
+ eingesetzt ist. Es sei denn, w"ahrend auf dem Medium gearbeitet
+ wird, wird keine Methode von SvPersistStream gerufen, bevor
+ nicht <SvPersistStream::SetStream> mit demselben Medium gerufen
+ wurde.
+*/
+{
+ if( pStm != pStream )
+ {
+ if( pStm )
+ {
+ SyncSysStream();
+ pStm->SetError( GetError() );
+ }
+ pStm = pStream;
+ }
+ if( pStm )
+ {
+ SetVersion( pStm->GetVersion() );
+ SetError( pStm->GetError() );
+ SyncSvStream( pStm->Tell() );
+ }
+}
+
+//=========================================================================
+USHORT SvPersistStream::IsA() const
+/* [Beschreibung]
+
+ Gibt den Identifier dieses Streamklasse zur"uck.
+
+ [R"uckgabewert]
+
+ USHORT ID_PERSISTSTREAM wird zur"uckgegeben.
+
+
+ [Querverweise]
+
+ <SvStream::IsA>
+*/
+{
+ return ID_PERSISTSTREAM;
+}
+
+
+/*************************************************************************
+|* SvPersistStream::ResetError()
+*************************************************************************/
+void SvPersistStream::ResetError()
+{
+ SvStream::ResetError();
+ DBG_ASSERT( pStm, "stream not set" )
+ pStm->ResetError();
+}
+
+/*************************************************************************
+|* SvPersistStream::GetData()
+*************************************************************************/
+ULONG SvPersistStream::GetData( void* pData, ULONG nSize )
+{
+ DBG_ASSERT( pStm, "stream not set" )
+ ULONG nRet = pStm->Read( pData, nSize );
+ SetError( pStm->GetError() );
+ return nRet;
+}
+
+/*************************************************************************
+|* SvPersistStream::PutData()
+*************************************************************************/
+ULONG SvPersistStream::PutData( const void* pData, ULONG nSize )
+{
+ DBG_ASSERT( pStm, "stream not set" )
+ ULONG nRet = pStm->Write( pData, nSize );
+ SetError( pStm->GetError() );
+ return nRet;
+}
+
+/*************************************************************************
+|* SvPersistStream::Seek()
+*************************************************************************/
+ULONG SvPersistStream::SeekPos( ULONG nPos )
+{
+ DBG_ASSERT( pStm, "stream not set" )
+ ULONG nRet = pStm->Seek( nPos );
+ SetError( pStm->GetError() );
+ return nRet;
+}
+
+/*************************************************************************
+|* SvPersistStream::FlushData()
+*************************************************************************/
+void SvPersistStream::FlushData()
+{
+}
+
+/*************************************************************************
+|* SvPersistStream::GetCurMaxIndex()
+*************************************************************************/
+ULONG SvPersistStream::GetCurMaxIndex( const SvPersistUIdx & rIdx ) const
+{
+ // const bekomme ich nicht den hoechsten Index
+ SvPersistUIdx * p = (SvPersistUIdx *)&rIdx;
+ // alten merken
+ ULONG nCurIdx = p->GetCurIndex();
+ p->Last();
+ // Bereiche nicht ueberschneiden, deshalb nur groessere Indexe
+ ULONG nMaxIdx = p->GetCurIndex();
+ // wieder herstellen
+ p->Seek( nCurIdx );
+ return nMaxIdx;
+}
+
+/*************************************************************************
+|* SvPersistStream::GetIndex()
+*************************************************************************/
+ULONG SvPersistStream::GetIndex( SvPersistBase * pObj ) const
+{
+ ULONG nId = (ULONG)aPTable.Get( (ULONG)pObj );
+ if( !nId && pRefStm )
+ return pRefStm->GetIndex( pObj );
+ return nId;
+}
+
+/*************************************************************************
+|* SvPersistStream::GetObject)
+*************************************************************************/
+SvPersistBase * SvPersistStream::GetObject( ULONG nIdx ) const
+{
+ if( nIdx >= nStartIdx )
+ return aPUIdx.Get( nIdx );
+ else if( pRefStm )
+ return pRefStm->GetObject( nIdx );
+ return NULL;
+}
+
+//=========================================================================
+#define LEN_1 0x80
+#define LEN_2 0x40
+#define LEN_4 0x20
+#define LEN_5 0x10
+UINT32 SvPersistStream::ReadCompressed
+(
+ SvStream & rStm /* Aus diesem Stream werden die komprimierten Daten
+ gelesen */
+)
+/* [Beschreibung]
+
+ Ein im Stream komprimiert abgelegtes Wort wird gelesen. In welchem
+ Format komprimiert wird, siehe <SvPersistStream::WriteCompressed>.
+
+ [R"uckgabewert]
+
+ UINT32 Das nicht komprimierte Wort wird zur"uckgegeben.
+
+ [Querverweise]
+
+*/
+{
+ UINT32 nRet;
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask & LEN_1 )
+ nRet = ~LEN_1 & nMask;
+ else if( nMask & LEN_2 )
+ {
+ nRet = ~LEN_2 & nMask;
+ nRet <<= 8;
+ rStm >> nMask;
+ nRet |= nMask;
+ }
+ else if( nMask & LEN_4 )
+ {
+ nRet = ~LEN_4 & nMask;
+ nRet <<= 8;
+ rStm >> nMask;
+ nRet |= nMask;
+ nRet <<= 16;
+ USHORT n;
+ rStm >> n;
+ nRet |= n;
+ }
+ else if( nMask & LEN_5 )
+ {
+ if( nMask & 0x0F )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "format error" )
+ }
+ rStm >> nRet;
+ }
+ else
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "format error" )
+ }
+ return nRet;
+}
+
+//=========================================================================
+void SvPersistStream::WriteCompressed
+(
+ SvStream & rStm,/* Aus diesem Stream werden die komprimierten Daten
+ gelesen */
+ UINT32 nVal /* Dieser Wert wird komprimiert geschrieben */
+)
+/* [Beschreibung]
+
+ Das "ubergebene Wort wird komprimiert und in den Stream
+ geschrieben. Folgendermassen wir komprimiert.
+ nVal < 0x80 => 0x80 + nVal ist 1 Byte gross.
+ nVal < 0x4000 => 0x4000 + nVal ist 2 Byte gross.
+ nVal < 0x20000000 => 0x20000000 + nVal ist 4 Byte gross.
+ nVal > 0x1FFFFFFF => 0x1000000000+ nVal ist 5 Byte gross.
+
+ [Querverweise]
+
+ <SvPersistStream::ReadCompressed>
+*/
+{
+#ifdef STOR_NO_OPTIMIZE
+ if( nVal < 0x80 )
+ rStm << (BYTE)(LEN_1 | nVal);
+ else if( nVal < 0x4000 )
+ {
+ rStm << (BYTE)(LEN_2 | (nVal >> 8));
+ rStm << (BYTE)nVal;
+ }
+ else if( nVal < 0x20000000 )
+ {
+ // hoechstes BYTE
+ rStm << (BYTE)(LEN_4 | (nVal >> 24));
+ // 2. hoechstes BYTE
+ rStm << (BYTE)(nVal >> 16);
+ rStm << (USHORT)(nVal);
+ }
+ else
+#endif
+ {
+ rStm << (BYTE)LEN_5;
+ rStm << nVal;
+ }
+}
+
+//=========================================================================
+UINT32 SvPersistStream::WriteDummyLen()
+/* [Beschreibung]
+
+ Die Methode schreibt 4 Byte in den Stream und gibt die Streamposition
+ zur"uck.
+
+ [R"uckgabewert]
+
+ UINT32 Die Position hinter der L"angenangabe wird zur"uckgegeben.
+
+ [Beispiel]
+
+ UINT32 nObjPos = rStm.WriteDummyLen();
+ ...
+ // Daten schreiben
+ ...
+ rStm.WriteLen( nObjPos );
+
+ [Querverweise]
+
+ <SvPersistStream::ReadLen>, <SvPersistStream::WriteLen>
+
+*/
+{
+#ifdef DBG_UTIL
+ UINT32 nPos = Tell();
+#endif
+ UINT32 n0 = 0;
+ *this << n0; // wegen Sun sp
+ // keine Assertion bei Streamfehler
+ DBG_ASSERT( GetError() != SVSTREAM_OK
+ || (sizeof( UINT32 ) == Tell() -nPos),
+ "keine 4-Byte fuer Langenangabe" );
+ return Tell();
+}
+
+//=========================================================================
+void SvPersistStream::WriteLen
+(
+ UINT32 nObjPos /* die Position + 4, an der die L"ange geschrieben
+ wird. */
+)
+/* [Beschreibung]
+
+ Die Methode schreibt die Differenz zwischen der aktuellen und
+ nObjPos als UINT32 an die Position nObjPos -4 im Stream. Danach
+ wird der Stream wieder auf die alte Position gestellt.
+
+ [Beispiel]
+
+ Die Differenz enth"alt nicht die L"angenangabe.
+
+ UINT32 nObjPos = rStm.WriteDummyLen();
+ ...
+ // Daten schreiben
+ ...
+ rStm.WriteLen( nObjPos );
+ // weitere Daten schreiben
+
+ [Querverweise]
+
+ <SvPersistStream::ReadLen>, <SvPersistStream::WriteDummyLen>
+*/
+{
+ UINT32 nPos = Tell();
+ UINT32 nLen = nPos - nObjPos;
+ // die Laenge muá im stream 4-Byte betragen
+ Seek( nObjPos - sizeof( UINT32 ) );
+ // Laenge schreiben
+ *this << nLen;
+ Seek( nPos );
+}
+
+//=========================================================================
+UINT32 SvPersistStream::ReadLen
+(
+ UINT32 * pTestPos /* Die Position des Streams, nach dem Lesen der
+ L"ange, wird zur"uckgegeben. Es darf auch NULL
+ "ubergeben werden. */
+)
+/* [Beschreibung]
+
+ Liest die L"ange die vorher mit <SvPersistStream::WriteDummyLen>
+ und <SvPersistStream::WriteLen> geschrieben wurde.
+*/
+{
+ UINT32 nLen;
+ *this >> nLen;
+ if( pTestPos )
+ *pTestPos = Tell();
+ return nLen;
+}
+
+//=========================================================================
+// Dateirormat abw"arts kompatibel
+#ifdef STOR_NO_OPTIMIZE
+#define P_VER (BYTE)0x00
+#else
+#define P_VER (BYTE)0x01
+#endif
+#define P_VER_MASK (BYTE)0x0F
+#define P_ID_0 (BYTE)0x80
+#define P_OBJ (BYTE)0x40
+#define P_DBGUTIL (BYTE)0x20
+#define P_ID (BYTE)0x10
+#ifdef STOR_NO_OPTIMIZE
+#define P_STD P_DBGUTIL
+#else
+#define P_STD 0
+#endif
+
+static void WriteId
+(
+ SvStream & rStm,
+ BYTE nHdr,
+ UINT32 nId,
+ USHORT nClassId
+)
+{
+#ifdef STOR_NO_OPTIMIZE
+ nHdr |= P_ID;
+#endif
+ nHdr |= P_VER;
+ if( nHdr & P_ID )
+ {
+ if( (nHdr & P_OBJ) || nId != 0 )
+ { // Id nur bei Zeiger, oder DBGUTIL
+ rStm << (BYTE)(nHdr);
+ SvPersistStream::WriteCompressed( rStm, nId );
+ }
+ else
+ { // NULL Pointer
+ rStm << (BYTE)(nHdr | P_ID_0);
+ return;
+ }
+ }
+ else
+ rStm << nHdr;
+
+ if( (nHdr & P_DBGUTIL) || (nHdr & P_OBJ) )
+ // Objekte haben immer eine Klasse,
+ // Pointer nur bei DBG_UTIL und != NULL
+ SvPersistStream::WriteCompressed( rStm, nClassId );
+}
+
+//=========================================================================
+static void ReadId
+(
+ SvStream & rStm,
+ BYTE & nHdr,
+ UINT32 & nId,
+ USHORT & nClassId
+)
+{
+ nClassId = 0;
+ rStm >> nHdr;
+ if( nHdr & P_ID_0 )
+ nId = 0;
+ else
+ {
+ if( (nHdr & P_VER_MASK) == 0 )
+ {
+ if( (nHdr & P_DBGUTIL) || !(nHdr & P_OBJ) )
+ nId = SvPersistStream::ReadCompressed( rStm );
+ else
+ nId = 0;
+ }
+ else if( nHdr & P_ID )
+ nId = SvPersistStream::ReadCompressed( rStm );
+
+ if( (nHdr & P_DBGUTIL) || (nHdr & P_OBJ) )
+ nClassId = (USHORT)SvPersistStream::ReadCompressed( rStm );
+ }
+}
+
+//=========================================================================
+void SvPersistStream::WriteObj
+(
+ BYTE nHdr,
+ SvPersistBase * pObj
+)
+{
+#ifdef STOR_NO_OPTIMIZE
+ UINT32 nObjPos;
+ if( nHdr & P_DBGUTIL )
+ // Position fuer Laenge merken
+ nObjPos = WriteDummyLen();
+#endif
+ pObj->Save( *this );
+#ifdef STOR_NO_OPTIMIZE
+ if( nHdr & P_DBGUTIL )
+ WriteLen( nObjPos );
+#endif
+}
+
+//=========================================================================
+SvPersistStream& SvPersistStream::WritePointer
+(
+ SvPersistBase * pObj
+)
+{
+ BYTE nP = P_STD;
+
+ if( pObj )
+ {
+ ULONG nId = GetIndex( pObj );
+ if( nId )
+ nP |= P_ID;
+ else
+ {
+ nId = aPUIdx.Insert( pObj );
+ aPTable.Insert( (ULONG)pObj, (void *)nId );
+ nP |= P_OBJ;
+ }
+ WriteId( *this, nP, nId, pObj->GetClassId() );
+ if( nP & P_OBJ )
+ WriteObj( nP, pObj );
+ }
+ else
+ { // NULL Pointer
+ WriteId( *this, nP | P_ID, 0, 0 );
+ }
+ return *this;
+}
+
+//=========================================================================
+UINT32 SvPersistStream::ReadObj
+(
+ SvPersistBase * & rpObj,
+ BOOL bRegister
+)
+{
+ BYTE nHdr;
+ UINT32 nId = 0;
+ USHORT nClassId;
+
+ rpObj = NULL; // Spezifikation: Im Fehlerfall 0.
+ ReadId( *this, nHdr, nId, nClassId );
+
+ // reine Versionsnummer durch maskieren
+ if( P_VER < (nHdr & P_VER_MASK) )
+ {
+ SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "false version" )
+ }
+
+ if( !(nHdr & P_ID_0) && GetError() == SVSTREAM_OK )
+ {
+ if( P_OBJ & nHdr )
+ { // read object, nId nur bei P_DBGUTIL gesetzt
+ DBG_ASSERT( !(nHdr & P_DBGUTIL) || NULL == aPUIdx.Get( nId ),
+ "object already exist" )
+ SvCreateInstancePersist pFunc = rClassMgr.Get( nClassId );
+
+ UINT32 nObjLen, nObjPos;
+ if( nHdr & P_DBGUTIL )
+ nObjLen = ReadLen( &nObjPos );
+ if( !pFunc )
+ {
+#ifdef DBG_UTIL
+ ByteString aStr( "no class with id: " );
+ aStr += ByteString::CreateFromInt32( nClassId );
+ aStr += " registered";
+ DBG_WARNING( aStr.GetBuffer() );
+#endif
+ SetError( ERRCODE_IO_NOFACTORY );
+ return 0;
+ }
+ pFunc( &rpObj );
+ // Sichern
+ rpObj->AddRef();
+
+ if( bRegister )
+ {
+ // unbedingt erst in Tabelle eintragen
+ ULONG nNewId = aPUIdx.Insert( rpObj );
+ // um den gleichen Zustand, wie nach dem Speichern herzustellen
+ aPTable.Insert( (ULONG)rpObj, (void *)nNewId );
+ DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId,
+ "read write id conflict: not the same" )
+ }
+ // und dann Laden
+ rpObj->Load( *this );
+#ifdef DBG_UTIL
+ if( nObjLen + nObjPos != Tell() )
+ {
+ ByteString aStr( "false object len: read = " );
+ aStr += ByteString::CreateFromInt32( (long)(Tell() - nObjPos) );
+ aStr += ", should = ";
+ aStr += ByteString::CreateFromInt32( nObjLen );
+ DBG_ERROR( aStr.GetBuffer() )
+ }
+#endif
+ rpObj->RestoreNoDelete();
+ rpObj->ReleaseRef();
+ }
+ else
+ {
+ rpObj = GetObject( nId );
+ DBG_ASSERT( rpObj != NULL, "object does not exist" )
+ DBG_ASSERT( rpObj->GetClassId() == nClassId, "class mismatch" )
+ }
+ }
+ return nId;
+}
+
+//=========================================================================
+SvPersistStream& SvPersistStream::ReadPointer
+(
+ SvPersistBase * & rpObj
+)
+{
+ ReadObj( rpObj, TRUE );
+ return *this;
+}
+
+//=========================================================================
+SvPersistStream& operator <<
+(
+ SvPersistStream & rStm,
+ SvPersistBase * pObj
+)
+{
+ return rStm.WritePointer( pObj );
+}
+
+//=========================================================================
+SvPersistStream& operator >>
+(
+ SvPersistStream & rStm,
+ SvPersistBase * & rpObj
+)
+{
+ return rStm.ReadPointer( rpObj );
+}
+
+//=========================================================================
+SvStream& operator <<
+(
+ SvStream & rStm,
+ SvPersistStream & rThis
+)
+{
+ SvStream * pOldStm = rThis.GetStream();
+ rThis.SetStream( &rStm );
+
+ BYTE bTmp = 0;
+ rThis << bTmp; // Version
+ UINT32 nCount = (UINT32)rThis.aPUIdx.Count();
+ rThis << nCount;
+ SvPersistBase * pEle = rThis.aPUIdx.First();
+ for( UINT32 i = 0; i < nCount; i++ )
+ {
+ BYTE nP = P_OBJ | P_ID | P_STD;
+ WriteId( rThis, nP, rThis.aPUIdx.GetCurIndex(),
+ pEle->GetClassId() );
+ rThis.WriteObj( nP, pEle );
+ pEle = rThis.aPUIdx.Next();
+ }
+ rThis.SetStream( pOldStm );
+ return rStm;
+}
+
+//=========================================================================
+SvStream& operator >>
+(
+ SvStream & rStm,
+ SvPersistStream & rThis
+)
+{
+ SvStream * pOldStm = rThis.GetStream();
+ rThis.SetStream( &rStm );
+
+ BYTE nVers;
+ rThis >> nVers; // Version
+ if( 0 == nVers )
+ {
+ UINT32 nCount = 0;
+ rThis >> nCount;
+ for( UINT32 i = 0; i < nCount; i++ )
+ {
+ SvPersistBase * pEle;
+ // Lesen, ohne in die Tabellen einzutragen
+ UINT32 nId = rThis.ReadObj( pEle, FALSE );
+ if( rThis.GetError() )
+ break;
+
+ // Die Id eines Objektes wird nie modifiziert
+ rThis.aPUIdx.Insert( nId, pEle );
+ rThis.aPTable.Insert( (ULONG)pEle, (void *)nId );
+ }
+ }
+ else
+ rThis.SetError( SVSTREAM_FILEFORMAT_ERROR );
+
+ rThis.SetStream( pOldStm );
+ return rStm;
+}
+
+//=========================================================================
+ULONG SvPersistStream::InsertObj( SvPersistBase * pObj )
+{
+ ULONG nId = aPUIdx.Insert( pObj );
+ aPTable.Insert( (ULONG)pObj, (void *)nId );
+ return nId;
+}
+
+//=========================================================================
+ULONG SvPersistStream::RemoveObj( SvPersistBase * pObj )
+{
+ ULONG nIdx = GetIndex( pObj );
+ aPUIdx.Remove( nIdx );
+ aPTable.Remove( (ULONG)pObj );
+ return nIdx;
+}
+
diff --git a/tools/source/ref/ref.cxx b/tools/source/ref/ref.cxx
new file mode 100644
index 000000000000..bfaa76fe9641
--- /dev/null
+++ b/tools/source/ref/ref.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * $RCSfile: ref.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ref.hxx>
+#pragma hdrstop
+
+/****************** SvRefBaseMemberList **********************************/
+#define inline
+SV_IMPL_REF_LIST( SvRefBase,SvRefBase* )
+#undef inline
+
+/**************************************************************************
+#* SvRefBase::~SvRefBase()
+**************************************************************************/
+SvRefBase::~SvRefBase()
+{
+}
+
+/**************************************************************************
+#* SvRefBase::QueryDelete()
+**************************************************************************/
+void SvRefBase::QueryDelete()
+{
+ nRefCount = SV_NO_DELETE_REFCOUNT / 2;
+ delete this;
+}
+
+SvCompatRefBase::~SvCompatRefBase()
+{
+ (*pFunc)( pObj );
+}
+
diff --git a/tools/source/solar/makefile.mk b/tools/source/solar/makefile.mk
new file mode 100644
index 000000000000..f38364e9f623
--- /dev/null
+++ b/tools/source/solar/makefile.mk
@@ -0,0 +1,100 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=mksvconf
+TARGETTYPE=CUI
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CFILES= solar.c
+
+OBJFILES= $(OBJ)$/solar.obj
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJFILES)
+APP1STDLIBS=
+APP1DEPN=
+APP1DEF=
+
+.IF "$(depend)" == ""
+ALL: \
+ $(INCCOM)$/svconf.h \
+ ALLTAR
+
+$(INCCOM)$/svconf.h : $(BIN)$/$(TARGET)
+ $(BIN)$/$(TARGET) $@
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/tools/source/solar/solar.c b/tools/source/solar/solar.c
new file mode 100644
index 000000000000..a119ce84304d
--- /dev/null
+++ b/tools/source/solar/solar.c
@@ -0,0 +1,590 @@
+/*************************************************************************
+ *
+ * $RCSfile: solar.c,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+
+#ifdef UNX
+
+#include <unistd.h>
+#include <sys/types.h>
+
+#ifdef HPUX
+#include <stdlib.h>
+#endif
+
+#define I_STDARG
+#ifdef I_STDARG
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#define NO_USE_FORK_TO_CHECK
+#ifdef USE_FORK_TO_CHECK
+#include <sys/wait.h>
+#else
+#include <signal.h>
+#include <setjmp.h>
+#endif
+
+#else
+#endif
+
+#define printTypeSize(Type,Name) printf( "sizeof(%s)\t= %d\n", Name, sizeof (Type) )
+
+#define isSignedType(Type) (((Type)-1) < 0)
+#define printTypeSign(Type,Name) printf( "%s\t= %s %s\n", Name, ( isSignedType(Type) ? "signed" : "unsigned" ), Name )
+
+
+/*************************************************************************
+|*
+|* IsBigEndian()
+|*
+|* Beschreibung True, wenn CPU BigEndian ist
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int IsBigEndian()
+{
+ long l = 1;
+ return ! *(char*)&l;
+}
+
+/*************************************************************************
+|*
+|* IsStackGrowingDown()
+|*
+|* Beschreibung True, wenn der Stack nach unten waechst
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int IsStackGrowingDown_2( int * pI )
+{
+ int i = 1;
+ return ((unsigned long)&i) < (unsigned long)pI;
+}
+
+int IsStackGrowingDown()
+{
+ int i = 1;
+ return IsStackGrowingDown_2(&i);
+}
+
+/*************************************************************************
+|*
+|* IsStackGrowingDown()
+|*
+|* Beschreibung Alignment von char Parametern, die (hoffentlich)
+|* ueber den Stack uebergeben werden
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int GetStackAlignment_3( char*p, long l, int i, short s, char b, char c, ... )
+{
+ if ( IsStackGrowingDown() )
+ return &c - &b;
+ else
+ return &b - &c;
+}
+
+int GetStackAlignment_2( char*p, long l, int i, short s, char b, char c )
+{
+ if ( IsStackGrowingDown() )
+ return &c - &b;
+ else
+ return &b - &c;
+}
+
+int GetStackAlignment()
+{
+ int nStackAlignment = GetStackAlignment_3(0,1,2,3,4,5);
+ if ( nStackAlignment != GetStackAlignment_2(0,1,2,3,4,5) )
+ printf( "Pascal calling convention\n" );
+ return nStackAlignment;
+}
+
+
+/*************************************************************************
+|*
+|* Typdeclarations for memory access test functions
+|*
+*************************************************************************/
+typedef enum { t_char, t_short, t_int, t_long, t_double } Type;
+typedef int (*TestFunc)( Type, void* );
+
+
+#ifdef UNX
+
+/*************************************************************************
+|*
+|* PrintArgs()
+|*
+|* Beschreibung Testfunktion fuer variable Parameter
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+#ifdef I_STDARG
+void PrintArgs( int p, ... )
+#else
+void PrintArgs( p, va_alist )
+int p;
+va_dcl
+#endif
+{
+ int value;
+ va_list ap;
+
+#ifdef I_STDARG
+ va_start( ap, p );
+#else
+ va_start( ap );
+#endif
+
+ printf( "value = %d", p );
+
+ while ( ( value = va_arg(ap, int) ) != 0 )
+ printf( " %d", value );
+
+ printf( "\n" );
+ va_end(ap);
+}
+
+#ifndef USE_FORK_TO_CHECK
+/*************************************************************************
+|*
+|* SignalHdl()
+|*
+|* Beschreibung faengt SIGBUS und SIGSEGV in check() ab
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+static jmp_buf check_env;
+static int bSignal;
+void SignalHdl( int sig )
+{
+ bSignal = 1;
+ /*
+ fprintf( stderr, "Signal %d caught\n", sig );
+ signal( sig, SignalHdl );
+ /**/
+ longjmp( check_env, sig );
+}
+#endif
+
+/*************************************************************************
+|*
+|* check()
+|*
+|* Beschreibung Testet MemoryZugriff (read/write)
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int check( TestFunc func, Type eT, void* p )
+{
+#ifdef USE_FORK_TO_CHECK
+ pid_t nChild = fork();
+ if ( nChild )
+ {
+ int exitVal;
+ wait( &exitVal );
+ if ( exitVal & 0xff )
+ return -1;
+ else
+ return exitVal >> 8;
+ }
+ else
+ {
+ exit( func( eT, p ) );
+ }
+#else
+ int result;
+
+ bSignal = 0;
+
+ if ( !setjmp( check_env ) )
+ {
+ signal( SIGSEGV, SignalHdl );
+ signal( SIGBUS, SignalHdl );
+ result = func( eT, p );
+ signal( SIGSEGV, SIG_DFL );
+ signal( SIGBUS, SIG_DFL );
+ }
+
+ if ( bSignal )
+ return -1;
+ else
+ return 0;
+#endif
+}
+
+#endif
+
+
+/*************************************************************************
+|*
+|* GetAtAddress()
+|*
+|* Beschreibung memory read access
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int GetAtAddress( Type eT, void* p )
+{
+ switch ( eT )
+ {
+ case t_char: return *((char*)p);
+ case t_short: return *((short*)p);
+ case t_int: return *((int*)p);
+ case t_long: return *((long*)p);
+ case t_double: return *((double*)p);
+ }
+ abort();
+}
+
+/*************************************************************************
+|*
+|* SetAtAddress()
+|*
+|* Beschreibung memory write access
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int SetAtAddress( Type eT, void* p )
+{
+ switch ( eT )
+ {
+ case t_char: return *((char*)p) = 0;
+ case t_short: return *((short*)p) = 0;
+ case t_int: return *((int*)p) = 0;
+ case t_long: return *((long*)p) = 0;
+ case t_double: return *((double*)p)= 0;
+ }
+ abort();
+}
+
+char* TypeName( Type eT )
+{
+ switch ( eT )
+ {
+ case t_char: return "char";
+ case t_short: return "short";
+ case t_int: return "int";
+ case t_long: return "long";
+ case t_double: return "double";
+ }
+ abort();
+}
+
+/*************************************************************************
+|*
+|* Check(Get|Set)Access()
+|*
+|* Beschreibung Testet MemoryZugriff (read/write)
+|* Zugriffsverletzungen werden abgefangen
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int CheckGetAccess( Type eT, void* p )
+{
+ int b;
+ b = -1 != check( (TestFunc)GetAtAddress, eT, p );
+#ifdef DEBUG
+ fprintf( stderr,
+ "%s read %s at %p\n",
+ (b? "can" : "can not" ), TypeName(eT), p );
+#endif
+ return b;
+}
+int CheckSetAccess( Type eT, void* p )
+{
+ int b;
+ b = -1 != check( (TestFunc)SetAtAddress, eT, p );
+#ifdef DEBUG
+ fprintf( stderr,
+ "%s write %s at %p\n",
+ (b? "can" : "can not" ), TypeName(eT), p );
+#endif
+ return b;
+}
+
+/*************************************************************************
+|*
+|* GetAlignment()
+|*
+|* Beschreibung Bestimmt das Alignment verschiedener Typen
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+int GetAlignment( Type eT )
+{
+ char a[ 16*8 ];
+ long p = (long)(void*)a;
+ int i;
+
+ /* clear a[...] to set legal value for double access */
+ for ( i = 0; i < 16*8; i++ )
+ a[i] = 0;
+
+ p = ( p + 0xF ) & ~0xF;
+ for ( i = 1; i < 16; i++ )
+ if ( CheckGetAccess( eT, (void*)(p+i) ) )
+ return i;
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* struct Description
+|*
+|* Beschreibung Beschreibt die Parameter der Architektur
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+struct Description
+{
+ int bBigEndian;
+ int bStackGrowsDown;
+ int nStackAlignment;
+ int nAlignment[3]; /* 2,4,8 */
+};
+
+/*************************************************************************
+|*
+|* Description_Ctor()
+|*
+|* Beschreibung Bestimmt die Parameter der Architektur
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+Description_Ctor( struct Description* pThis )
+{
+ pThis->bBigEndian = IsBigEndian();
+ pThis->bStackGrowsDown = IsStackGrowingDown();
+ pThis->nStackAlignment = GetStackAlignment();
+
+ if ( sizeof(short) != 2 )
+ abort();
+ pThis->nAlignment[0] = GetAlignment( t_short );
+ if ( sizeof(int) != 4 )
+ abort();
+ pThis->nAlignment[1] = GetAlignment( t_int );
+
+ if ( sizeof(long) == 8 )
+ pThis->nAlignment[2] = GetAlignment( t_long );
+ else if ( sizeof(double) == 8 )
+ pThis->nAlignment[2] = GetAlignment( t_double );
+ else
+ abort();
+}
+
+/*************************************************************************
+|*
+|* Description_Print()
+|*
+|* Beschreibung Schreibt die Parameter der Architektur als Header
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+Description_Print( struct Description* pThis, char* name )
+{
+ int i;
+ FILE* f = fopen( name, "w" );
+ fprintf( f, "#define __%s\n",
+ pThis->bBigEndian ? "BIGENDIAN" : "LITTLEENDIAN" );
+ for ( i = 0; i < 3; i++ )
+ fprintf( f, "#define __ALIGNMENT%d\t%d\n",
+ 1 << i+1, pThis->nAlignment[i] );
+ fprintf( f, "#define __STACKALIGNMENT wird nicht benutzt\t%d\n", pThis->nStackAlignment );
+ fprintf( f, "#define __STACKDIRECTION\t%d\n",
+ pThis->bStackGrowsDown ? -1 : 1 );
+ fprintf( f, "#define __SIZEOFCHAR\t%d\n", sizeof( char ) );
+ fprintf( f, "#define __SIZEOFSHORT\t%d\n", sizeof( short ) );
+ fprintf( f, "#define __SIZEOFINT\t%d\n", sizeof( int ) );
+ fprintf( f, "#define __SIZEOFLONG\t%d\n", sizeof( long ) );
+ fprintf( f, "#define __SIZEOFPOINTER\t%d\n", sizeof( void* ) );
+ fprintf( f, "#define __SIZEOFDOUBLE\t%d\n", sizeof( double ) );
+ fprintf( f, "#define __IEEEDOUBLE\n" );
+ fclose( f );
+}
+
+/*************************************************************************
+|*
+|* InfoMemoryAccess()
+|*
+|* Beschreibung Informeller Bytezugriffstest
+|*
+|* Ersterstellung EG 26.06.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+void InfoMemoryAccess( char* p )
+{
+ if ( CheckGetAccess( t_char, p ) )
+ printf( "can read address %p\n", p );
+ else
+ printf( "can not read address %p\n", p );
+
+ if ( CheckSetAccess( t_char, p ) )
+ printf( "can write address %p\n", p );
+ else
+ printf( "can not write address %p\n", p );
+}
+
+/*************************************************************************
+|*
+|* InfoMemoryTypeAccess()
+|*
+|* Beschreibung Informeller Zugriffstest verschiedener Typen
+|*
+|* Ersterstellung EG 15.08.96
+|* Letzte Aenderung
+|*
+*************************************************************************/
+void InfoMemoryTypeAccess( Type eT )
+{
+ char a[64];
+ int i;
+
+ /* clear a[...] to set legal value for double access */
+ for ( i = 0; i < 64; i++ )
+ a[i] = 0;
+
+ for ( i = 56; i >= 7; i >>= 1 )
+ {
+ printf( "Zugriff %s auf %i-Aligned Adresse : ", TypeName( eT ), i / 7 );
+ printf( ( CheckGetAccess( eT, (long*)&a[i] ) ? "OK\n" : "ERROR\n" ) );
+ }
+}
+
+main( int argc, char* argv[] )
+{
+ printTypeSign( char, "char" );
+ printTypeSign( short, "short" );
+ printTypeSign( int, "int" );
+ printTypeSign( long, "long" );
+
+ printTypeSize( char, "char" );
+ printTypeSize( short, "short" );
+ printTypeSize( int, "int" );
+ printTypeSize( long, "long" );
+ printTypeSize( float, "float" );
+ printTypeSize( double, "double" );
+ printTypeSize( void *, "void *" );
+
+ if ( IsBigEndian() )
+ printf( "BIGENDIAN (Sparc, MC680x0, RS6000, IP22, IP32, g3)\n" );
+ else
+ printf( "LITTLEENDIAN (Intel, VAX, PowerPC)\n" );
+
+ if( IsStackGrowingDown() )
+ printf( "Stack waechst nach unten\n" );
+ else
+ printf( "Stack waechst nach oben\n" );
+
+ printf( "STACKALIGNMENT : %d\n", GetStackAlignment() );
+
+ /* PrintArgs( 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 ); */
+
+ if ( argc > 1 )
+ {
+ struct Description description;
+ Description_Ctor( &description );
+ Description_Print( &description, argv[1] );
+ }
+
+ {
+ char* p = NULL;
+ InfoMemoryAccess( p );
+ p = (char*)&p;
+ InfoMemoryAccess( p );
+ InfoMemoryTypeAccess( t_short );
+ InfoMemoryTypeAccess( t_int );
+ InfoMemoryTypeAccess( t_long );
+ InfoMemoryTypeAccess( t_double );
+ }
+
+ exit( 0 );
+}
diff --git a/tools/source/stream/cachestr.cxx b/tools/source/stream/cachestr.cxx
new file mode 100644
index 000000000000..f4533f76515b
--- /dev/null
+++ b/tools/source/stream/cachestr.cxx
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * $RCSfile: cachestr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <debug.hxx>
+#include <stream.hxx>
+#include <cachestr.hxx>
+#include <tempfile.hxx>
+
+/*************************************************************************
+|*
+|* SvCacheStream::SvCacheStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+SvCacheStream::SvCacheStream( ULONG nMaxMemSize )
+{
+ if( !nMaxMemSize )
+#if defined WIN || defined WNT || defined OS2 || defined MAC || defined UNX
+ nMaxMemSize = 20480;
+#else
+ nMaxMemSize = 20480;
+#endif
+ SvStream::bIsWritable = TRUE;
+ nMaxSize = nMaxMemSize;
+ bPersistent = FALSE;
+ pSwapStream = 0;
+ pCurrentStream = new SvMemoryStream( nMaxMemSize );
+ pTempFile = 0;
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::SvCacheStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+SvCacheStream::SvCacheStream( const String &rFileName,
+ ULONG nExpectedSize,
+ ULONG nMaxMemSize )
+{
+ if( !nMaxMemSize )
+#if defined WIN || defined WNT || defined OS2 || defined MAC || defined UNX
+ nMaxMemSize = 20480;
+#else
+ nMaxMemSize = 20480;
+#endif
+
+ if( nExpectedSize > nMaxMemSize )
+ nExpectedSize = nMaxMemSize; // oder gleich in File schreiben
+ else if( !nExpectedSize )
+ nExpectedSize = 4096;
+
+ SvStream::bIsWritable = TRUE;
+ nMaxSize = nMaxMemSize;
+ bPersistent = TRUE;
+ aFileName = rFileName;
+ pSwapStream = 0;
+ pCurrentStream = new SvMemoryStream( nExpectedSize );
+ pTempFile = 0;
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::~SvCacheStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+SvCacheStream::~SvCacheStream()
+{
+ if( pCurrentStream != pSwapStream )
+ delete pSwapStream;
+ delete pCurrentStream;
+
+ if( pSwapStream && !bPersistent && pTempFile )
+ {
+ // temporaeres File loeschen
+ pTempFile->EnableKillingFile( TRUE );
+ }
+
+ delete pTempFile;
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::SwapOut()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+void SvCacheStream::SwapOut()
+{
+ if( pCurrentStream != pSwapStream )
+ {
+ if( !pSwapStream && !aFileName.Len() )
+ {
+ if (aFilenameLinkHdl.IsSet())
+ {
+ // pSwapStream wird zum Schutz gegen Reentranz genutzt
+ pSwapStream = pCurrentStream;
+ Link aLink( aFilenameLinkHdl );
+ aFilenameLinkHdl = Link();
+ aLink.Call(this);
+ // pSwapStream nur zuruecksetzen, wenn nicht ueber
+ // SetSwapStream geaendert
+ if( pSwapStream == pCurrentStream ) pSwapStream = 0;
+ }
+ else
+ {
+ pTempFile = new TempFile;
+ aFileName = pTempFile->GetName();
+ }
+ }
+
+ ULONG nPos = pCurrentStream->Tell();
+ pCurrentStream->Seek( 0 );
+ if( !pSwapStream )
+ pSwapStream = new SvFileStream( aFileName, STREAM_READWRITE | STREAM_TRUNC );
+ *pSwapStream << *pCurrentStream;
+ pSwapStream->Flush();
+ delete pCurrentStream;
+ pCurrentStream = pSwapStream;
+ pCurrentStream->Seek( nPos );
+ }
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::GetData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+ULONG SvCacheStream::GetData( void* pData, ULONG nSize )
+{
+ return pCurrentStream->Read( pData, nSize );
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::PutData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+ULONG SvCacheStream::PutData( const void* pData, ULONG nSize )
+{
+ // lieber unnoetig auslagern als unnoetig umkopieren
+ if( pCurrentStream != pSwapStream
+ && pCurrentStream->Tell() + nSize > nMaxSize )
+ SwapOut();
+ return pCurrentStream->Write( pData, nSize );
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::SeekPos()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+ULONG SvCacheStream::SeekPos( ULONG nPos )
+{
+ return pCurrentStream->Seek( nPos );
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::FlushData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+void SvCacheStream::FlushData()
+{
+ pCurrentStream->Flush();
+ if( pCurrentStream != pSwapStream
+ && ((SvMemoryStream*)pCurrentStream)->GetSize() > nMaxSize )
+ SwapOut();
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::GetStr()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+const void* SvCacheStream::GetBuffer()
+{
+ Flush();
+ if( pCurrentStream != pSwapStream )
+ return ((SvMemoryStream*)pCurrentStream)->GetData();
+ else
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::SetSize()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+void SvCacheStream::SetSize( ULONG nSize )
+{
+ pCurrentStream->SetStreamSize( nSize );
+}
+
+/*************************************************************************
+|*
+|* SvCacheStream::GetSize()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 27.09.94
+|* Letzte Aenderung OV 27.09.94
+|*
+*************************************************************************/
+
+ULONG SvCacheStream::GetSize()
+{
+ // ACHTUNG: SvMemoryStream::GetSize() gibt Groesse
+ // des allozierten Buffers zurueck
+ Flush();
+ ULONG nTemp = Tell();
+ ULONG nLength = Seek( STREAM_SEEK_TO_END );
+ Seek( nTemp );
+ return nLength;
+}
+
+void SvCacheStream::SetFilenameHdl( const Link& rLink)
+{
+ aFilenameLinkHdl = rLink;
+}
+
+const Link& SvCacheStream::GetFilenameHdl() const
+{
+ return aFilenameLinkHdl;
+}
diff --git a/tools/source/stream/makefile.mk b/tools/source/stream/makefile.mk
new file mode 100644
index 000000000000..da71d3c408bc
--- /dev/null
+++ b/tools/source/stream/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=stream
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/stream.obj \
+ $(SLO)$/strmsys.obj \
+ $(SLO)$/cachestr.obj \
+ $(SLO)$/vcompat.obj
+
+.IF "$(UPDATER)" != ""
+.IF "$(GUI)" != "MAC"
+OBJFILES= $(OBJ)$/stdstrm.obj
+.ENDIF
+
+OBJFILES+= $(OBJ)$/stream.obj \
+ $(OBJ)$/strmsys.obj \
+ $(OBJ)$/cachestr.obj \
+ $(OBJ)$/vcompat.obj
+.ENDIF
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(SLO)$/strmsys.obj : \
+ strmos2.cxx \
+ strmwnt.cxx \
+ strmwin.cxx \
+ strmmac.cxx \
+ strmunx.cxx \
+ strmstd.cxx
+
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
new file mode 100644
index 000000000000..adca76dfd39e
--- /dev/null
+++ b/tools/source/stream/stream.cxx
@@ -0,0 +1,2905 @@
+/*************************************************************************
+ *
+ * $RCSfile: stream.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// ToDo:
+// - Read->RefreshBuffer->Auf Aenderungen von nBufActualLen reagieren
+
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h> // isspace
+#include <stdlib.h> // strtol, _crotl
+
+/*
+#if defined( DBG_UTIL ) && defined( DEBUG )
+// prueft Synchronisation des Buffers nach allen Read, Write, Seek
+#define OV_DEBUG
+#endif
+*/
+
+#ifdef WIN
+#include <dll.hxx>
+#include <svwin.h>
+#ifndef SEG
+#define SEG(fp) (*((size_t*)&(fp) + 1))
+#endif
+#include <solar.h>
+#endif
+
+#if defined(BLC)
+#define SWAPNIBBLES(c) c=_crotl(c,4);
+#else
+#define SWAPNIBBLES(c) \
+unsigned char nSwapTmp=c; \
+nSwapTmp <<= 4; \
+c >>= 4; \
+c |= nSwapTmp;
+#endif
+
+#include <new.hxx>
+#include <debug.hxx>
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+#include <stream.hxx>
+#include <osl/thread.h>
+
+// -----------------------------------------------------------------------
+
+DBG_NAME( Stream );
+
+// -----------------------------------------------------------------------
+
+// sprintf Param-Mode
+#define SPECIAL_PARAM_NONE 0 // Format-Str, Number
+#define SPECIAL_PARAM_WIDTH 1 // Format-Str, Width, Number
+#define SPECIAL_PARAM_PRECISION 2 // Format-Str, Precision, Number
+#define SPECIAL_PARAM_BOTH 3 // Format-Str, Width, Precision, Number
+
+#if SUPD <= 344
+#define _CR '\n'
+#define _LF '\r'
+#endif
+
+// -----------------------------------------------------------------------
+
+// !!! Nicht inline, wenn Operatoren <<,>> inline sind
+inline static void SwapUShort( USHORT& r )
+ { r = SWAPSHORT(r); }
+inline static void SwapShort( short& r )
+ { r = SWAPSHORT(r); }
+inline static void SwapInt( int& r )
+ { r = SWAPSHORT(r); }
+inline static void SwapUInt( unsigned int& r )
+ { r = SWAPSHORT(r); }
+inline static void SwapLong( long& r )
+ { r = SWAPLONG(r); }
+inline static void SwapULong( ULONG& r )
+ { r = SWAPLONG(r); }
+inline static void SwapLongInt( int& r )
+ { r = SWAPLONG(r); }
+inline static void SwapLongUInt( unsigned int& r )
+ { r = SWAPLONG(r); }
+#ifdef UNX
+inline static void SwapFloat( float& r )
+ {
+ DBG_ASSERT( FALSE, "SwapFloat noch nicht implementiert!\n" );
+ }
+inline static void SwapDouble( double& r )
+ {
+ if( sizeof(double) != 8 )
+ {
+ DBG_ASSERT( FALSE, "Can only swap 8-Byte-doubles\n" );
+ }
+ else
+ {
+ UINT32* c = (UINT32*)(void*)&r;
+ c[0] ^= c[1]; // zwei 32-Bit-Werte in situ vertauschen
+ c[1] ^= c[0];
+ c[0] ^= c[1];
+ c[0] = SWAPLONG(c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen
+ c[1] = SWAPLONG(c[1]);
+ }
+ }
+
+#elif MAC
+
+inline static void SwapFloat( float& r )
+ {
+ DBG_ASSERT( FALSE, "SwapFloat noch nicht implementiert!\n" );
+ }
+
+inline static void SwapDouble( double& r )
+ {
+#ifdef DBG_UTIL
+ if( sizeof(double) != 8 )
+ DBG_ASSERT( FALSE, "Can only swap 8-Byte-doubles\n" );
+#endif
+
+ UINT32* c = (UINT32*)(void*)&r;
+ UINT32 nHelp;
+ // zwei 32-Bit-Werte in situ vertauschen
+ // und die beiden 32-Bit-Werte selbst in situ drehen
+ nHelp = SWAPLONG(c[0]);
+ c[0] = SWAPLONG(c[1]);
+ c[1] = nHelp;
+ }
+#endif // #ifdef UNX / elif MAC
+
+//SDO
+
+#define READNUMBER_WITHOUT_SWAP(datatype,value) \
+{\
+int tmp = eIOMode; \
+if( (tmp == STREAM_IO_READ) && sizeof(datatype)<=nBufFree) \
+{\
+ for (int i = 0; i < sizeof(datatype); i++)\
+ ((char *)&r)[i] = pBufPos[i];\
+ nBufActualPos += sizeof(datatype);\
+ pBufPos += sizeof(datatype);\
+ nBufFree -= sizeof(datatype);\
+}\
+else\
+ Read( (char*)&value, sizeof(datatype) );\
+}
+
+#define WRITENUMBER_WITHOUT_SWAP(datatype,value) \
+{\
+int tmp = eIOMode; \
+if( (tmp==STREAM_IO_WRITE) && sizeof(datatype) <= nBufFree)\
+{\
+ for (int i = 0; i < sizeof(datatype); i++)\
+ pBufPos[i] = ((char *)&value)[i];\
+ nBufFree -= sizeof(datatype);\
+ nBufActualPos += sizeof(datatype);\
+ if( nBufActualPos > nBufActualLen )\
+ nBufActualLen = nBufActualPos;\
+ pBufPos += sizeof(datatype);\
+ bIsDirty = TRUE;\
+}\
+else\
+ Write( (char*)&value, sizeof(datatype) );\
+}
+
+//============================================================================
+//
+// class SvLockBytes
+//
+//============================================================================
+
+void SvLockBytes::close()
+{
+ if (m_bOwner)
+ delete m_pStream;
+ m_pStream = 0;
+}
+
+//============================================================================
+TYPEINIT0(SvLockBytes);
+
+//============================================================================
+// virtual
+ErrCode SvLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
+ ULONG * pRead) const
+{
+ if (!m_pStream)
+ {
+ DBG_ERROR("SvLockBytes::ReadAt(): Bad stream");
+ return ERRCODE_NONE;
+ }
+
+ m_pStream->Seek(nPos);
+ ULONG nTheRead = m_pStream->Read(pBuffer, nCount);
+ if (pRead)
+ *pRead = nTheRead;
+ return m_pStream->GetErrorCode();
+}
+
+//============================================================================
+// virtual
+ErrCode SvLockBytes::WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount,
+ ULONG * pWritten)
+{
+ if (!m_pStream)
+ {
+ DBG_ERROR("SvLockBytes::WriteAt(): Bad stream");
+ return ERRCODE_NONE;
+ }
+
+ m_pStream->Seek(nPos);
+ ULONG nTheWritten = m_pStream->Write(pBuffer, nCount);
+ if (pWritten)
+ *pWritten = nTheWritten;
+ return m_pStream->GetErrorCode();
+}
+
+//============================================================================
+// virtual
+ErrCode SvLockBytes::Flush() const
+{
+ if (!m_pStream)
+ {
+ DBG_ERROR("SvLockBytes::Flush(): Bad stream");
+ return ERRCODE_NONE;
+ }
+
+ m_pStream->Flush();
+ return m_pStream->GetErrorCode();
+}
+
+//============================================================================
+// virtual
+ErrCode SvLockBytes::SetSize(ULONG nSize)
+{
+ if (!m_pStream)
+ {
+ DBG_ERROR("SvLockBytes::SetSize(): Bad stream");
+ return ERRCODE_NONE;
+ }
+
+ m_pStream->SetStreamSize(nSize);
+ return m_pStream->GetErrorCode();
+}
+
+//============================================================================
+ErrCode SvLockBytes::LockRegion(ULONG, ULONG, LockType)
+{
+ DBG_ERROR("SvLockBytes::LockRegion(): Not implemented");
+ return ERRCODE_NONE;
+}
+
+//============================================================================
+
+ErrCode SvLockBytes::UnlockRegion(ULONG, ULONG, LockType)
+{
+ DBG_ERROR("SvLockBytes::UnlockRegion(): Not implemented");
+ return ERRCODE_NONE;
+}
+
+//============================================================================
+ErrCode SvLockBytes::Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag) const
+{
+ if (!m_pStream)
+ {
+ DBG_ERROR("SvLockBytes::Stat(): Bad stream");
+ return ERRCODE_NONE;
+ }
+
+ if (pStat)
+ {
+ ULONG nPos = m_pStream->Tell();
+ pStat->nSize = m_pStream->Seek(STREAM_SEEK_TO_END);
+ m_pStream->Seek(nPos);
+ }
+ return ERRCODE_NONE;
+}
+
+//============================================================================
+//
+// class SvOpenLockBytes
+//
+//============================================================================
+
+TYPEINIT1(SvOpenLockBytes, SvLockBytes);
+
+//============================================================================
+//
+// class SvAsyncLockBytes
+//
+//============================================================================
+
+TYPEINIT1(SvAsyncLockBytes, SvOpenLockBytes);
+
+//============================================================================
+// virtual
+ErrCode SvAsyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
+ ULONG * pRead) const
+{
+ if (m_bTerminated)
+ return SvOpenLockBytes::ReadAt(nPos, pBuffer, nCount, pRead);
+ else
+ {
+ ULONG nTheCount = min(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
+ ErrCode nError = SvOpenLockBytes::ReadAt(nPos, pBuffer, nTheCount,
+ pRead);
+ return !nCount || nTheCount == nCount || nError ? nError :
+ ERRCODE_IO_PENDING;
+ }
+}
+
+//============================================================================
+// virtual
+ErrCode SvAsyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer,
+ ULONG nCount, ULONG * pWritten)
+{
+ if (m_bTerminated)
+ return SvOpenLockBytes::WriteAt(nPos, pBuffer, nCount, pWritten);
+ else
+ {
+ ULONG nTheCount = min(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
+ ErrCode nError = SvOpenLockBytes::WriteAt(nPos, pBuffer, nTheCount,
+ pWritten);
+ return !nCount || nTheCount == nCount || nError ? nError :
+ ERRCODE_IO_PENDING;
+ }
+}
+
+//============================================================================
+// virtual
+ErrCode SvAsyncLockBytes::FillAppend(const void * pBuffer, ULONG nCount,
+ ULONG * pWritten)
+{
+ ULONG nTheWritten;
+ ErrCode nError = SvOpenLockBytes::WriteAt(m_nSize, pBuffer, nCount,
+ &nTheWritten);
+ if (!nError)
+ m_nSize += nTheWritten;
+ if (pWritten)
+ *pWritten = nTheWritten;
+ return nError;
+}
+
+//============================================================================
+// virtual
+ULONG SvAsyncLockBytes::Seek(ULONG nPos)
+{
+ if (nPos != STREAM_SEEK_TO_END)
+ m_nSize = nPos;
+ return m_nSize;
+}
+
+//============================================================================
+//
+// class SvStream
+//
+//============================================================================
+
+ULONG SvStream::GetData( void* pData, ULONG nSize )
+{
+ if( !GetError() )
+ {
+ DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
+ ULONG nRet;
+ nError = xLockBytes->ReadAt( nActPos, pData, nSize, &nRet );
+ nActPos += nRet;
+ return nRet;
+ }
+ else return 0;
+}
+
+ErrCode SvStream::SetLockBytes( SvLockBytesRef& rLB )
+{
+ xLockBytes = rLB;
+ RefreshBuffer();
+ return ERRCODE_NONE;
+}
+
+//========================================================================
+
+ULONG SvStream::PutData( const void* pData, ULONG nSize )
+{
+ if( !GetError() )
+ {
+ DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
+ ULONG nRet;
+ nError = xLockBytes->WriteAt( nActPos, pData, nSize, &nRet );
+ nActPos += nRet;
+ return nRet;
+ }
+ else return 0;
+}
+
+//========================================================================
+
+ULONG SvStream::SeekPos( ULONG nPos )
+{
+ if( !GetError() && nPos == STREAM_SEEK_TO_END )
+ {
+ DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
+ SvLockBytesStat aStat;
+ xLockBytes->Stat( &aStat, SVSTATFLAG_DEFAULT );
+ nActPos = aStat.nSize;
+ }
+ else
+ nActPos = nPos;
+ return nActPos;
+}
+
+//========================================================================
+
+void SvStream::FlushData()
+{
+ if( !GetError() )
+ {
+ DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
+ nError = xLockBytes->Flush();
+ }
+}
+
+//========================================================================
+
+void SvStream::SetSize( ULONG nSize )
+{
+ DBG_ASSERT( xLockBytes.Is(), "pure virtual function" );
+ nError = xLockBytes->SetSize( nSize );
+}
+
+void SvStream::ImpInit()
+{
+ nActPos = 0;
+ nCompressMode = COMPRESSMODE_NONE;
+ eStreamCharSet = osl_getThreadTextEncoding();
+// eTargetCharSet = osl_getThreadTextEncoding();
+ nCryptMask = 0;
+ bIsEof = FALSE;
+#if defined( MAC )
+ eLineDelimiter = LINEEND_CR; // MAC-Format
+#elif defined( UNX )
+ eLineDelimiter = LINEEND_LF; // UNIX-Format
+#else
+ eLineDelimiter = LINEEND_CRLF; // DOS-Format
+#endif
+
+ SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ nBufFilePos = 0;
+ nBufActualPos = 0;
+ bIsDirty = FALSE;
+ bIsConsistent = TRUE;
+ bIsWritable = TRUE;
+
+ pRWBuf = 0;
+ pBufPos = 0;
+ nBufSize = 0;
+ nBufActualLen = 0;
+ eIOMode = STREAM_IO_DONTKNOW;
+ nBufFree = 0;
+
+ nRadix = 10;
+ nPrecision = 0; // all significant digits
+ nWidth = 0; // default width
+ cFiller = ' ';
+ nJustification = JUSTIFY_RIGHT;
+ eStreamMode = 0;
+ CreateFormatString();
+
+ nVersion = 0;
+
+ ClearError();
+}
+
+/*************************************************************************
+|*
+|* Stream::Stream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+SvStream::SvStream( SvLockBytes* pLockBytesP )
+{
+ DBG_CTOR( Stream, NULL );
+
+ ImpInit();
+ xLockBytes = pLockBytesP;
+ const SvStream* pStrm;
+ if( pLockBytesP && (pStrm = pLockBytesP->GetStream() ) )
+ SetError( pStrm->GetErrorCode() );
+ SetBufferSize( 256 );
+}
+
+SvStream::SvStream()
+{
+ DBG_CTOR( Stream, NULL );
+
+ ImpInit();
+}
+
+/*************************************************************************
+|*
+|* Stream::~Stream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+SvStream::~SvStream()
+{
+ DBG_DTOR( Stream, NULL );
+
+ if ( xLockBytes.Is() )
+ Flush();
+
+ if( pRWBuf )
+ delete pRWBuf;
+}
+
+/*************************************************************************
+|*
+|* Stream::IsA()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+USHORT SvStream::IsA() const
+{
+ return (USHORT)ID_STREAM;
+}
+
+/*************************************************************************
+|*
+|* Stream::ClearError()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::ClearError()
+{
+ bIsEof = FALSE;
+ nError = SVSTREAM_OK;
+}
+
+/*************************************************************************
+|*
+|* Stream::SetError()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::SetError( ULONG nErrorCode )
+{
+ if ( nError == SVSTREAM_OK )
+ nError = nErrorCode;
+}
+
+
+/*************************************************************************
+|*
+|* Stream::SetNumberFormatInt()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::SetNumberFormatInt( USHORT nNewFormat )
+{
+ nNumberFormatInt = nNewFormat;
+ bSwap = FALSE;
+#ifdef __BIGENDIAN
+ if( nNumberFormatInt == NUMBERFORMAT_INT_LITTLEENDIAN )
+ bSwap = TRUE;
+#else
+ if( nNumberFormatInt == NUMBERFORMAT_INT_BIGENDIAN )
+ bSwap = TRUE;
+#endif
+}
+
+/*************************************************************************
+|*
+|* Stream::SetBufferSize()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::SetBufferSize( USHORT nBufferSize )
+{
+ ULONG nActualFilePos = Tell();
+ BOOL bDontSeek = (BOOL)(pRWBuf == 0);
+
+ if( bIsDirty && bIsConsistent && bIsWritable ) // wg. Windows NT: Access denied
+ Flush();
+
+ if( nBufSize )
+ {
+ delete pRWBuf;
+ nBufFilePos += nBufActualPos;
+ }
+
+ pRWBuf = 0;
+ nBufActualLen = 0;
+ nBufActualPos = 0;
+ nBufSize = nBufferSize;
+ if( nBufSize )
+ pRWBuf = new BYTE[ nBufSize ];
+ bIsConsistent = TRUE;
+ pBufPos = pRWBuf;
+ eIOMode = STREAM_IO_DONTKNOW;
+ if( !bDontSeek )
+ SeekPos( nActualFilePos );
+}
+
+/*************************************************************************
+|*
+|* Stream::ClearBuffer()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::ClearBuffer()
+{
+ nBufActualLen = 0;
+ nBufActualPos = 0;
+ nBufFilePos = 0;
+ pBufPos = pRWBuf;
+ bIsDirty = FALSE;
+ bIsConsistent = TRUE;
+ eIOMode = STREAM_IO_DONTKNOW;
+
+ bIsEof = FALSE;
+}
+
+/*************************************************************************
+|*
+|* Stream::ResetError()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::ResetError()
+{
+ ClearError();
+}
+
+/*************************************************************************
+|*
+|* Stream::ReadLine()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+BOOL SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSet )
+{
+ BOOL bRet;
+ ByteString aStr;
+
+ bRet = ReadLine(aStr);
+ rStr = UniString( aStr, eSrcCharSet );
+ return bRet;
+}
+
+BOOL SvStream::ReadLine( ByteString& rStr )
+{
+ sal_Char buf[256+1];
+ BOOL bEnd = FALSE;
+ ULONG nOldFilePos = Tell();
+ sal_Char c = 0;
+
+ rStr.Erase();
+ while( !bEnd && !GetError() ) // !!! nicht auf EOF testen,
+ // !!! weil wir blockweise
+ // !!! lesen
+ {
+ USHORT nLen = (USHORT)Read( buf, sizeof(buf)-1 );
+ if ( !nLen )
+ {
+ if ( rStr.Len() == 0 )
+ {
+ // der allererste Blockread hat fehlgeschlagen -> Abflug
+ bIsEof = TRUE;
+ return FALSE;
+ }
+ else
+ break;
+ }
+
+ for( USHORT n = 0; n < nLen ; n++ )
+ {
+ c = buf[n];
+ if ( c != '\n' && c != '\r' )
+ rStr += c;
+ else
+ {
+ bEnd = TRUE;
+ break;
+ }
+ }
+ }
+
+ if ( !bEnd && !GetError() && rStr.Len() )
+ bEnd = TRUE;
+
+ nOldFilePos += rStr.Len();
+ if( Tell() > nOldFilePos )
+ nOldFilePos++;
+ Seek( nOldFilePos ); // seeken wg. obigem BlockRead!
+
+ if ( bEnd && (c=='\r' || c=='\n') ) // Sonderbehandlung DOS-Dateien
+ {
+ char cTemp;
+ Read((char*)&cTemp , sizeof(cTemp) );
+ if( cTemp == c || (cTemp != '\n' && cTemp != '\r') )
+ Seek( nOldFilePos );
+ }
+
+ if ( bEnd )
+ bIsEof = FALSE;
+ return bEnd;
+}
+
+/*************************************************************************
+|*
+|* Stream::WriteLine()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+BOOL SvStream::WriteByteStringLine( const String& rStr, rtl_TextEncoding eDestCharSet )
+{
+ return WriteLine( ByteString( rStr, eDestCharSet ) );
+}
+
+BOOL SvStream::WriteLine( const ByteString& rStr )
+{
+ Write( rStr.GetBuffer(), rStr.Len() );
+ endl(*this);
+ return nError == SVSTREAM_OK;
+}
+
+/*************************************************************************
+|*
+|* Stream::WriteLines()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 17.07.95
+|* Letzte Aenderung OV 17.07.95
+|*
+*************************************************************************/
+
+BOOL SvStream::WriteByteStringLines( const String& rStr, rtl_TextEncoding eDestCharSet )
+{
+ return WriteLines( ByteString( rStr, eDestCharSet ) );
+}
+
+BOOL SvStream::WriteLines( const ByteString& rStr )
+{
+ ByteString aStr( rStr );
+ aStr.ConvertLineEnd( eLineDelimiter );
+ Write( aStr.GetBuffer(), aStr.Len() );
+ endl( *this );
+ return (BOOL)(nError == SVSTREAM_OK);
+}
+
+/*************************************************************************
+|*
+|* Stream::SeekRel()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+ULONG SvStream::SeekRel( long nPos )
+{
+ ULONG nActualPos = Tell();
+ nActualPos += nPos;
+ pBufPos = pRWBuf + nActualPos;
+ return Seek( nActualPos );
+}
+
+/*************************************************************************
+|*
+|* Stream::operator>>()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+SvStream& SvStream::operator >> ( USHORT& r )
+{
+ READNUMBER_WITHOUT_SWAP(USHORT,r)
+ if( bSwap )
+ SwapUShort(r);
+ return *this;
+}
+
+SvStream& SvStream::operator>> ( ULONG& r)
+{
+#if(__SIZEOFLONG != 4)
+ unsigned int tmp = r;
+ READNUMBER_WITHOUT_SWAP(ULONG,tmp)
+ r = tmp;
+ if( bSwap )
+ SwapULong(r);
+#else
+ READNUMBER_WITHOUT_SWAP(ULONG,r)
+ if( bSwap )
+ SwapULong(r);
+#endif
+ return *this;
+}
+
+SvStream& SvStream::operator >> ( long& r )
+{
+#if(__SIZEOFLONG != 4)
+ unsigned int tmp = r;
+ READNUMBER_WITHOUT_SWAP(long,tmp)
+ r = tmp;
+ if( bSwap )
+ SwapLong(r);
+#else
+ READNUMBER_WITHOUT_SWAP(long,r)
+ if( bSwap )
+ SwapLong(r);
+#endif
+ return *this;
+}
+
+SvStream& SvStream::operator >> ( short& r)
+{
+ READNUMBER_WITHOUT_SWAP(short,r)
+ if( bSwap )
+ SwapShort(r);
+ return *this;
+}
+
+SvStream& SvStream::operator >> ( int& r)
+{
+ READNUMBER_WITHOUT_SWAP(int,r)
+ if( bSwap )
+ {
+#if(__SIZEOFINT == 2)
+ SwapInt(r);
+#else
+ SwapLongInt(r);
+#endif
+ }
+ return *this;
+}
+
+SvStream& SvStream::operator>>( unsigned int& r)
+{
+ READNUMBER_WITHOUT_SWAP(unsigned int,r)
+ if( bSwap )
+ {
+#if(__SIZEOFINT == 2)
+ SwapUInt(r);
+#else
+ SwapLongUInt(r);
+#endif
+ }
+ return *this;
+}
+
+SvStream& SvStream::operator>>( signed char& r)
+{
+ if( (eIOMode == STREAM_IO_READ || !bIsConsistent) &&
+ sizeof(signed char) <= nBufFree )
+ {
+ r = *pBufPos;
+ nBufActualPos += sizeof(signed char);
+ pBufPos += sizeof(signed char);
+ nBufFree -= sizeof(signed char);
+ }
+ else
+ Read( (char*)&r, sizeof(signed char) );
+ return *this;
+}
+
+// Sonderbehandlung fuer Chars wegen PutBack
+
+SvStream& SvStream::operator>>( char& r)
+{
+ if( (eIOMode == STREAM_IO_READ || !bIsConsistent) &&
+ sizeof(char) <= nBufFree )
+ {
+ r = *pBufPos;
+ nBufActualPos += sizeof(char);
+ pBufPos += sizeof(char);
+ nBufFree -= sizeof(char);
+ }
+ else
+ Read( (char*)&r, sizeof(char) );
+ return *this;
+}
+
+SvStream& SvStream::operator>>( unsigned char& r)
+{
+ if( (eIOMode == STREAM_IO_READ || !bIsConsistent) &&
+ sizeof(char) <= nBufFree )
+ {
+ r = *pBufPos;
+ nBufActualPos += sizeof(char);
+ pBufPos += sizeof(char);
+ nBufFree -= sizeof(char);
+ }
+ else
+ Read( (char*)&r, sizeof(char) );
+ return *this;
+}
+
+SvStream& SvStream::operator>>( float& r)
+{
+ // Read( (char*)&r, sizeof(float) );
+ READNUMBER_WITHOUT_SWAP(float,r)
+#ifdef UNX
+ if( bSwap )
+ SwapFloat(r);
+#endif
+ return *this;
+}
+
+SvStream& SvStream::operator>>( double& r)
+{
+ // Read( (char*)&r, sizeof(double) );
+ READNUMBER_WITHOUT_SWAP(double,r)
+#if defined( UNX ) || defined ( MAC )
+ if( bSwap )
+ SwapDouble(r);
+#endif
+ return *this;
+}
+
+SvStream& SvStream::operator>> ( SvStream& rStream )
+{
+ const ULONG cBufLen = 0x8000;
+ char* pBuf = new char[ cBufLen ];
+
+ ULONG nCount;
+ do {
+ nCount = Read( pBuf, cBufLen );
+ rStream.Write( pBuf, nCount );
+ } while( nCount == cBufLen );
+
+ delete pBuf;
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Stream::operator<<()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+SvStream& SvStream::operator<< ( USHORT v )
+{
+ if( bSwap )
+ SwapUShort(v);
+ WRITENUMBER_WITHOUT_SWAP(USHORT,v)
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( ULONG v)
+{
+#if(__SIZEOFLONG != 4)
+ unsigned int tmp = v;
+ if( bSwap )
+ SwapUInt(tmp);
+ WRITENUMBER_WITHOUT_SWAP(unsigned int,tmp)
+#else
+ if( bSwap )
+ SwapULong(v);
+ WRITENUMBER_WITHOUT_SWAP(ULONG,v)
+#endif
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( long v )
+{
+#if(__SIZEOFLONG != 4)
+ int tmp = v;
+ if( bSwap )
+ SwapInt(tmp);
+ WRITENUMBER_WITHOUT_SWAP(int,tmp)
+#else
+ if( bSwap )
+ SwapLong(v);
+ WRITENUMBER_WITHOUT_SWAP(long,v)
+#endif
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( short v)
+{
+ if( bSwap )
+ SwapShort(v);
+ WRITENUMBER_WITHOUT_SWAP(short,v)
+ return *this;
+}
+
+SvStream& SvStream::operator<<( int v)
+{
+ if( bSwap )
+ {
+#if( __SIZEOFINT == 2 )
+ SwapInt( v );
+#else
+ SwapLongInt( v );
+#endif
+ }
+ WRITENUMBER_WITHOUT_SWAP(int,v)
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( signed char v)
+{
+ //SDO
+ int tmp = eIOMode;
+ if(tmp == STREAM_IO_WRITE && sizeof(signed char) <= nBufFree )
+ {
+ *pBufPos = v;
+ pBufPos++; // sizeof(char);
+ nBufActualPos++;
+ if( nBufActualPos > nBufActualLen ) // Append ?
+ nBufActualLen = nBufActualPos;
+ nBufFree--; // = sizeof(char);
+ bIsDirty = TRUE;
+ }
+ else
+ Write( (char*)&v, sizeof(signed char) );
+ return *this;
+}
+
+
+SvStream& SvStream::operator<< ( unsigned int v)
+{
+ if( bSwap )
+ {
+#if( __SIZEOFINT == 2 )
+ SwapUInt( v );
+#else
+ SwapLongUInt( v );
+#endif
+ }
+ WRITENUMBER_WITHOUT_SWAP(int,v)
+ return *this;
+}
+
+// Sonderbehandlung fuer chars wegen PutBack
+
+SvStream& SvStream::operator<< ( char v)
+{
+ //SDO
+ int tmp = eIOMode;
+ if(tmp == STREAM_IO_WRITE && sizeof(char) <= nBufFree )
+ {
+ *pBufPos = v;
+ pBufPos++; // sizeof(char);
+ nBufActualPos++;
+ if( nBufActualPos > nBufActualLen ) // Append ?
+ nBufActualLen = nBufActualPos;
+ nBufFree--; // = sizeof(char);
+ bIsDirty = TRUE;
+ }
+ else
+ Write( (char*)&v, sizeof(char) );
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( unsigned char v)
+{
+//SDO
+ int tmp = eIOMode;
+ if(tmp == STREAM_IO_WRITE && sizeof(char) <= nBufFree )
+ {
+ *(unsigned char*)pBufPos = v;
+ pBufPos++; // = sizeof(char);
+ nBufActualPos++; // = sizeof(char);
+ if( nBufActualPos > nBufActualLen ) // Append ?
+ nBufActualLen = nBufActualPos;
+ nBufFree--;
+ bIsDirty = TRUE;
+ }
+ else
+ Write( (char*)&v, sizeof(char) );
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( float v)
+{
+#ifdef UNX
+ if( bSwap )
+ SwapFloat(v);
+#endif
+ WRITENUMBER_WITHOUT_SWAP(float,v)
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( const double& r)
+{
+// Write( (char*)&r, sizeof( double ) );
+#if defined( UNX ) || defined ( MAC )
+ if( bSwap )
+ {
+ double nHelp = r;
+ SwapDouble(nHelp);
+ WRITENUMBER_WITHOUT_SWAP(double,nHelp)
+ return *this;
+ }
+ else
+#endif
+ WRITENUMBER_WITHOUT_SWAP(double,r)
+
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( const char* pBuf )
+{
+ Write( pBuf, strlen( pBuf ) );
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( const unsigned char* pBuf )
+{
+ Write( (char*)pBuf, strlen( (char*)pBuf ) );
+ return *this;
+}
+
+SvStream& SvStream::operator<< ( SvStream& rStream)
+{
+ const ULONG cBufLen = 0x8000;
+ char* pBuf = new char[ cBufLen ];
+ ULONG nCount;
+ do {
+ nCount = rStream.Read( pBuf, cBufLen );
+ Write( pBuf, nCount );
+ } while( nCount == cBufLen );
+
+ delete pBuf;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvStream::ReadByteString( UniString& rStr, rtl_TextEncoding eSrcCharSet )
+{
+ // read UTF-16 string directly from stream ?
+ if (eSrcCharSet == RTL_TEXTENCODING_UNICODE)
+ {
+ sal_uInt32 nLen;
+ operator>> (nLen);
+ if (nLen)
+ {
+ sal_Unicode *pStr = rStr.AllocBuffer(nLen);
+ Read( pStr, nLen << 1 );
+
+ if (bSwap)
+ for (sal_Unicode *pEnd = pStr + nLen; pStr < pEnd; pStr++)
+ SwapUShort(*pStr);
+ }
+ else
+ rStr.Erase();
+
+ return *this;
+ }
+
+ ByteString aStr;
+ ReadByteString( aStr );
+ rStr = UniString( aStr, eSrcCharSet );
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvStream::ReadByteString( ByteString& rStr )
+{
+ USHORT nLen = 0;
+ operator>>( nLen );
+ if( nLen )
+ {
+ char* pTmp = rStr.AllocBuffer( nLen );
+ nLen = (USHORT)Read( pTmp, nLen );
+ }
+ else
+ rStr.Erase();
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvStream::WriteByteString( const UniString& rStr, rtl_TextEncoding eDestCharSet )
+{
+ // write UTF-16 string directly into stream ?
+ if (eDestCharSet == RTL_TEXTENCODING_UNICODE)
+ {
+ sal_uInt32 nLen = rStr.Len();
+ operator<< (nLen);
+ if (nLen)
+ {
+ if (bSwap)
+ {
+ const sal_Unicode *pStr = rStr.GetBuffer();
+ const sal_Unicode *pEnd = pStr + nLen;
+
+ for (; pStr < pEnd; pStr++)
+ {
+ sal_Unicode c = *pStr;
+ SwapUShort(c);
+ WRITENUMBER_WITHOUT_SWAP(USHORT,c)
+ }
+ }
+ else
+ Write( rStr.GetBuffer(), nLen << 1 );
+ }
+
+ return *this;
+ }
+
+ return WriteByteString(ByteString( rStr, eDestCharSet ));
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& SvStream::WriteByteString( const ByteString& rStr)
+{
+ USHORT nLen = rStr.Len();
+ operator<< ( nLen );
+ if( nLen != 0 )
+ Write( rStr.GetBuffer(), nLen );
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Stream::Read()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+ULONG SvStream::Read( void* pData, ULONG nCount )
+{
+ ULONG nSaveCount = nCount;
+ if( !bIsConsistent )
+ RefreshBuffer();
+
+ if( !pRWBuf )
+ {
+ nCount = GetData( (char*)pData,nCount);
+ if( nCryptMask )
+ EncryptBuffer(pData, nCount);
+ nBufFilePos += nCount;
+ }
+ else
+ {
+ // ist Block komplett im Puffer
+ eIOMode = STREAM_IO_READ;
+ if( nCount <= (ULONG)(nBufActualLen - nBufActualPos ) )
+ {
+ // Ja!
+#ifdef WIN
+ hmemcpy( pData, pBufPos, nCount );
+#else
+ memcpy(pData, pBufPos, (size_t) nCount);
+#endif
+ nBufActualPos += (USHORT)nCount;
+ pBufPos += nCount;
+ nBufFree -= (USHORT)nCount;
+ }
+ else
+ {
+ if( bIsDirty ) // Flushen ?
+ {
+ SeekPos( nBufFilePos );
+ if( nCryptMask )
+ CryptAndWriteBuffer(pRWBuf, nBufActualLen);
+ else
+ PutData( pRWBuf, nBufActualLen );
+ bIsDirty = FALSE;
+ }
+
+ // passt der Datenblock in den Puffer ?
+ if( nCount > nBufSize )
+ {
+ // Nein! Deshalb ohne Umweg ueber den Puffer direkt
+ // in den Zielbereich einlesen
+
+ eIOMode = STREAM_IO_DONTKNOW;
+
+ SeekPos( nBufFilePos + nBufActualPos );
+ nBufActualLen = 0;
+ pBufPos = pRWBuf;
+ nCount = GetData( (char*)pData, nCount );
+ if( nCryptMask )
+ EncryptBuffer(pData, nCount);
+ nBufFilePos += nCount;
+ nBufFilePos += nBufActualPos;
+ nBufActualPos = 0;
+ }
+ else
+ {
+ // Der Datenblock passt komplett in den Puffer. Deshalb
+ // Puffer fuellen und dann die angeforderten Daten in den
+ // Zielbereich kopieren.
+
+ nBufFilePos += nBufActualPos;
+ SeekPos( nBufFilePos );
+
+ // TODO: Typecast vor GetData, USHORT nCountTmp
+ ULONG nCountTmp = GetData( pRWBuf, nBufSize );
+ if( nCryptMask )
+ EncryptBuffer(pRWBuf, nCountTmp);
+ nBufActualLen = (USHORT)nCountTmp;
+ if( nCount > nCountTmp )
+ {
+ nCount = nCountTmp; // zurueckstutzen, Eof siehe unten
+ }
+#ifdef WIN
+ hmemcpy( pData, pRWBuf, nCount );
+#else
+ memcpy( pData, pRWBuf, (size_t)nCount );
+#endif
+ nBufActualPos = (USHORT)nCount;
+ pBufPos = pRWBuf + nCount;
+ }
+ }
+ }
+ bIsEof = FALSE;
+ nBufFree = nBufActualLen - nBufActualPos;
+ if( nCount != nSaveCount && nError != ERRCODE_IO_PENDING )
+ bIsEof = TRUE;
+ if( nCount == nSaveCount && nError == ERRCODE_IO_PENDING )
+ nError = ERRCODE_NONE;
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* Stream::Write()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+ULONG SvStream::Write( const void* pData, ULONG nCount )
+{
+ if( !nCount )
+ return 0;
+ if( !bIsWritable )
+ {
+ SetError( ERRCODE_IO_CANTWRITE );
+ return 0;
+ }
+ if( !bIsConsistent )
+ RefreshBuffer(); // Aenderungen des Puffers durch PutBack loeschen
+
+ if( !pRWBuf )
+ {
+ if( nCryptMask )
+ nCount = CryptAndWriteBuffer( pData, nCount );
+ else
+ nCount = PutData( (char*)pData, nCount );
+ nBufFilePos += nCount;
+ return nCount;
+ }
+
+ eIOMode = STREAM_IO_WRITE;
+ if( nCount <= (ULONG)(nBufSize - nBufActualPos) )
+ {
+#ifdef WIN
+ hmemcpy( pBufPos, pData, nCount );
+#else
+ memcpy( pBufPos, pData, (size_t)nCount );
+#endif
+ nBufActualPos += (USHORT)nCount;
+ // wurde der Puffer erweitert ?
+ if( nBufActualPos > nBufActualLen )
+ nBufActualLen = nBufActualPos;
+
+ pBufPos += nCount;
+ bIsDirty = TRUE;
+ }
+ else
+ {
+ // Flushen ?
+ if( bIsDirty )
+ {
+ SeekPos( nBufFilePos );
+ if( nCryptMask )
+ CryptAndWriteBuffer( pRWBuf, (ULONG)nBufActualLen );
+ else
+ PutData( pRWBuf, nBufActualLen );
+ bIsDirty = FALSE;
+ }
+
+ // passt der Block in den Puffer ?
+ if( nCount > nBufSize )
+ {
+ eIOMode = STREAM_IO_DONTKNOW;
+ nBufFilePos += nBufActualPos;
+ nBufActualLen = 0;
+ nBufActualPos = 0;
+ pBufPos = pRWBuf;
+ SeekPos( nBufFilePos );
+ if( nCryptMask )
+ nCount = CryptAndWriteBuffer( pData, nCount );
+ else
+ nCount = PutData( (char*)pData, nCount );
+ nBufFilePos += nCount;
+ }
+ else
+ {
+ // Block in Puffer stellen
+#ifdef WIN
+ hmemcpy( pRWBuf, pData, nCount );
+#else
+ memcpy( pRWBuf, pData, (size_t)nCount );
+#endif
+ // Reihenfolge!
+ nBufFilePos += nBufActualPos;
+ nBufActualPos = (USHORT)nCount;
+ pBufPos = pRWBuf + nCount;
+ nBufActualLen = (USHORT)nCount;
+ bIsDirty = TRUE;
+ }
+ }
+ nBufFree = nBufSize - nBufActualPos;
+ return nCount;
+}
+
+
+/*************************************************************************
+|*
+|* Stream::Seek()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+ULONG SvStream::Seek( ULONG nFilePos )
+{
+ eIOMode = STREAM_IO_DONTKNOW;
+
+ bIsEof = FALSE;
+ if( !pRWBuf )
+ {
+ nBufFilePos = SeekPos( nFilePos );
+ DBG_ASSERT(Tell()==nBufFilePos,"Out Of Sync!")
+ return nBufFilePos;
+ }
+
+ // Ist Position im Puffer ?
+ if( nFilePos >= nBufFilePos && nFilePos <= (nBufFilePos + nBufActualLen))
+ {
+ nBufActualPos = (USHORT)(nFilePos - nBufFilePos);
+ pBufPos = pRWBuf + nBufActualPos;
+ // nBufFree korrigieren, damit wir nicht von einem
+ // PutBack (ignoriert den StreamMode) getoetet werden
+ nBufFree = nBufActualLen - nBufActualPos;
+ }
+ else
+ {
+ if( bIsDirty && bIsConsistent)
+ {
+ SeekPos( nBufFilePos );
+ if( nCryptMask )
+ CryptAndWriteBuffer( pRWBuf, nBufActualLen );
+ else
+ PutData( pRWBuf, nBufActualLen );
+ bIsDirty = FALSE;
+ }
+ nBufActualLen = 0;
+ nBufActualPos = 0;
+ pBufPos = pRWBuf;
+ nBufFilePos = SeekPos( nFilePos );
+ }
+#ifdef OV_DEBUG
+ {
+ ULONG nDebugTemp = nBufFilePos + nBufActualPos;
+ DBG_ASSERT(Tell()==nDebugTemp,"Sync?")
+ }
+#endif
+ return nBufFilePos + nBufActualPos;
+}
+
+/*************************************************************************
+|*
+|* Stream::Flush()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::Flush()
+{
+ if( bIsDirty && bIsConsistent )
+ {
+ SeekPos( nBufFilePos );
+ if( nCryptMask )
+ CryptAndWriteBuffer( pRWBuf, (ULONG)nBufActualLen );
+ else
+ if( PutData( pRWBuf, nBufActualLen ) != nBufActualLen )
+ SetError( SVSTREAM_WRITE_ERROR );
+ bIsDirty = FALSE;
+ }
+ if( bIsWritable )
+ FlushData();
+}
+
+
+/*************************************************************************
+|*
+|* Stream::PutBack()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 01.08.94
+|* Letzte Aenderung OV 01.08.94
+|*
+*************************************************************************/
+
+/*
+ 4 Faelle :
+
+ 1. Datenzeiger steht mitten im Puffer (nBufActualPos >= 1)
+ 2. Datenzeiger auf Position 0, Puffer ist voll
+ 3. Datenzeiger auf Position 0, Puffer ist teilweise gefuellt
+ 4. Datenzeiger auf Position 0, Puffer ist leer -> Fehler!
+*/
+
+SvStream& SvStream::PutBack( char aCh )
+{
+ // wenn kein Buffer oder Zurueckscrollen nicht moeglich -> Fehler
+ if( !pRWBuf || !nBufActualLen || ( !nBufActualPos && !nBufFilePos ) )
+ {
+ // 4. Fall
+ SetError( SVSTREAM_GENERALERROR );
+ return *this;
+ }
+
+ // Flush() (Phys. Flushen aber nicht notwendig, deshalb selbst schreiben)
+ if( bIsConsistent && bIsDirty )
+ {
+ SeekPos( nBufFilePos );
+ if( nCryptMask )
+ CryptAndWriteBuffer( pRWBuf, nBufActualLen );
+ else
+ PutData( pRWBuf, nBufActualLen );
+ bIsDirty = FALSE;
+ }
+ bIsConsistent = FALSE; // Puffer enthaelt jetzt TRASH
+ if( nBufActualPos )
+ {
+ // 1. Fall
+ nBufActualPos--;
+ pBufPos--;
+ *pBufPos = aCh;
+ nBufFree++;
+ }
+ else // Puffer muss verschoben werden
+ {
+ // Ist Puffer am Anschlag ?
+ if( nBufSize == nBufActualLen )
+ {
+ // 2. Fall
+ memmove( pRWBuf+1, pRWBuf, nBufSize-1 );
+ // nBufFree behaelt den Wert!
+ }
+ else
+ {
+ // 3. Fall -> Puffer vergroessern
+ memmove( pRWBuf+1, pRWBuf, (USHORT)nBufActualLen );
+ nBufActualLen++;
+ nBufFree++;
+ }
+ nBufFilePos--;
+ *pRWBuf = aCh;
+ }
+ eIOMode = STREAM_IO_DONTKNOW;
+ bIsEof = FALSE;
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Stream::EatWhite()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 01.08.94
+|* Letzte Aenderung OV 01.08.94
+|*
+*************************************************************************/
+
+void SvStream::EatWhite()
+{
+ char aCh;
+ Read(&aCh, sizeof(char) );
+ while( !bIsEof && isspace((int)aCh) ) //( aCh == ' ' || aCh == '\t' ) )
+ Read(&aCh, sizeof(char) );
+ if( !bIsEof ) // konnte das letzte Char gelesen werden ?
+ SeekRel( -1L );
+}
+
+/*************************************************************************
+|*
+|* Stream::RefreshBuffer()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 01.08.94
+|* Letzte Aenderung OV 01.08.94
+|*
+*************************************************************************/
+
+void SvStream::RefreshBuffer()
+{
+ if( bIsDirty && bIsConsistent )
+ {
+ SeekPos( nBufFilePos );
+ if( nCryptMask )
+ CryptAndWriteBuffer( pRWBuf, (ULONG)nBufActualLen );
+ else
+ PutData( pRWBuf, nBufActualLen );
+ bIsDirty = FALSE;
+ }
+ SeekPos( nBufFilePos );
+ nBufActualLen = (USHORT)GetData( pRWBuf, nBufSize );
+ if( nBufActualLen && nError == ERRCODE_IO_PENDING )
+ nError = ERRCODE_NONE;
+ if( nCryptMask )
+ EncryptBuffer(pRWBuf, (ULONG)nBufActualLen);
+ bIsConsistent = TRUE;
+ eIOMode = STREAM_IO_DONTKNOW;
+}
+
+
+/*************************************************************************
+|*
+|* Stream::CreateFormatString()
+|*
+|* Beschreibung Baut Formatstring zusammen
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::CreateFormatString()
+{
+ aFormatString = '%';
+ nPrintfParams = SPECIAL_PARAM_NONE;
+
+ if( nJustification )
+ {
+ aFormatString += '-';
+ }
+
+ if( nWidth )
+ {
+ if( cFiller != ' ' )
+ aFormatString += '0';
+ aFormatString += '*';
+ nPrintfParams = SPECIAL_PARAM_WIDTH;
+ }
+
+ if( nPrecision )
+ {
+ aFormatString += ".*";
+ if( nWidth )
+ nPrintfParams = SPECIAL_PARAM_BOTH;
+ else
+ nPrintfParams = SPECIAL_PARAM_PRECISION;
+ }
+}
+
+/*************************************************************************
+|*
+|* Stream::ReadNumber()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+#define BUFSIZE_LONG 21 // log( 2 hoch 64 ) + 1
+
+SvStream& SvStream::ReadNumber( long& rLong )
+{
+ EatWhite();
+ if( bIsEof || nError )
+ {
+ SetError( SVSTREAM_GENERALERROR );
+ return *this;
+ }
+ ULONG nFPtr = Tell();
+ char buf[ BUFSIZE_LONG ];
+ memset( buf, 0, BUFSIZE_LONG );
+ ULONG nTemp = Read( buf, BUFSIZE_LONG-1 );
+ if( !nTemp || nError )
+ {
+ SetError( SVSTREAM_GENERALERROR );
+ return *this;
+ }
+ char *pEndPtr;
+ rLong = strtol( buf, &pEndPtr, (int)nRadix );
+ nFPtr += ( (ULONG)pEndPtr - (ULONG)(&(buf[0])) );
+ Seek( nFPtr );
+ bIsEof = FALSE;
+ return *this;
+}
+
+SvStream& SvStream::ReadNumber( ULONG& rULong )
+{
+ EatWhite();
+ if( bIsEof || nError )
+ {
+ SetError( SVSTREAM_GENERALERROR );
+ return *this;
+ }
+ ULONG nFPtr = Tell();
+ char buf[ BUFSIZE_LONG ];
+ memset( buf, 0, BUFSIZE_LONG );
+ ULONG nTemp = Read( buf, BUFSIZE_LONG-1 );
+ if( !nTemp || nError )
+ {
+ SetError( SVSTREAM_GENERALERROR );
+ return *this;
+ }
+ char *pEndPtr;
+ rULong = strtoul( buf, &pEndPtr, (int)nRadix );
+ nFPtr += ( (ULONG)pEndPtr - (ULONG)buf );
+ Seek( nFPtr );
+ bIsEof = FALSE;
+ return *this;
+}
+
+SvStream& SvStream::ReadNumber( double& rDouble )
+{
+ EatWhite();
+ if( bIsEof || nError )
+ {
+ SetError( SVSTREAM_GENERALERROR );
+ return *this;
+ }
+ ULONG nFPtr = Tell();
+ char buf[ BUFSIZE_LONG ];
+ memset( buf, 0, BUFSIZE_LONG );
+ ULONG nTemp = Read( buf, BUFSIZE_LONG-1 );
+ if( !nTemp || nError )
+ {
+ SetError( SVSTREAM_GENERALERROR );
+ return *this;
+ }
+ char *pEndPtr;
+ rDouble = strtod( buf, &pEndPtr );
+ nFPtr += ( (ULONG)pEndPtr - (ULONG)buf );
+ Seek( nFPtr );
+ bIsEof = FALSE;
+ return *this;
+}
+
+
+/*************************************************************************
+|*
+|* Stream::WriteNumber()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+SvStream& SvStream::WriteNumber( long nLong )
+{
+ char buffer[256+12];
+ char pType[] = "ld"; // Nicht static!
+ if( nRadix == 16 )
+ pType[1] = 'x';
+ else if( nRadix == 8 )
+ pType[1] = 'o';
+ ByteString aFStr( aFormatString);
+ aFStr += pType;
+ int nLen;
+ switch ( nPrintfParams )
+ {
+ case SPECIAL_PARAM_NONE :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nLong );
+ break;
+ case SPECIAL_PARAM_WIDTH :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nLong );
+ break;
+ case SPECIAL_PARAM_PRECISION :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision,nLong);
+ break;
+ default:
+ nLen=sprintf(buffer, aFStr.GetBuffer(),nWidth,nPrecision,nLong);
+ }
+ Write( buffer, (long)nLen );
+ return *this;
+}
+
+SvStream& SvStream::WriteNumber( ULONG nULong )
+{
+ char buffer[256+12];
+ char pType[] = "lu"; // Nicht static!
+ if( nRadix == 16 )
+ pType[1] = 'x';
+ else if( nRadix == 8 )
+ pType[1] = 'o';
+ ByteString aFStr( aFormatString);
+ aFStr += pType;
+ int nLen;
+ switch ( nPrintfParams )
+ {
+ case SPECIAL_PARAM_NONE :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nULong );
+ break;
+ case SPECIAL_PARAM_WIDTH :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, nULong );
+ break;
+ case SPECIAL_PARAM_PRECISION :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision,nULong);
+ break;
+ default:
+ nLen=sprintf(buffer,aFStr.GetBuffer(),nWidth,nPrecision,nULong);
+ }
+ Write( buffer, (long)nLen );
+ return *this;
+}
+
+
+SvStream& SvStream::WriteNumber( const double& rDouble )
+{
+ char buffer[256+24];
+ ByteString aFStr( aFormatString);
+ aFStr += "lf";
+ int nLen;
+ switch ( nPrintfParams )
+ {
+ case SPECIAL_PARAM_NONE :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), rDouble );
+ break;
+ case SPECIAL_PARAM_WIDTH :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nWidth, rDouble );
+ break;
+ case SPECIAL_PARAM_PRECISION :
+ nLen = sprintf( buffer, aFStr.GetBuffer(), nPrecision, rDouble);
+ break;
+ default:
+ nLen=sprintf(buffer, aFStr.GetBuffer(),nWidth,nPrecision,rDouble);
+ }
+ Write( buffer, (long)nLen );
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* Stream::CryptAndWriteBuffer()
+|*
+|* Beschreibung Verschluesseln und Schreiben
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+#define CRYPT_BUFSIZE 1024
+
+ULONG SvStream::CryptAndWriteBuffer( const void* pStart, ULONG nLen)
+{
+ unsigned char* pTemp = new unsigned char[CRYPT_BUFSIZE];
+ unsigned char* pDataPtr = (unsigned char*)pStart;
+ ULONG nCount = 0;
+ ULONG nBufCount;
+ unsigned char nMask = nCryptMask;
+ do
+ {
+ if( nLen >= CRYPT_BUFSIZE )
+ nBufCount = CRYPT_BUFSIZE;
+ else
+ nBufCount = nLen;
+ nLen -= nBufCount;
+ memcpy( pTemp, pDataPtr, (USHORT)nBufCount );
+ // **** Verschluesseln *****
+ for ( USHORT n=0; n < CRYPT_BUFSIZE; n++ )
+ {
+ unsigned char aCh = pTemp[n];
+ aCh ^= nMask;
+ SWAPNIBBLES(aCh)
+ pTemp[n] = aCh;
+ }
+ // *************************
+ nCount += PutData( (char*)pTemp, nBufCount );
+ pDataPtr += nBufCount;
+ }
+ while ( nLen );
+ delete pTemp;
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* Stream::EncryptBuffer()
+|*
+|* Beschreibung Buffer entschluesseln
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+BOOL SvStream::EncryptBuffer(void* pStart, ULONG nLen)
+{
+ unsigned char* pTemp = (unsigned char*)pStart;
+ unsigned char nMask = nCryptMask;
+
+ for ( ULONG n=0; n < nLen; n++, pTemp++ )
+ {
+ unsigned char aCh = *pTemp;
+ SWAPNIBBLES(aCh)
+ aCh ^= nMask;
+ *pTemp = aCh;
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Stream::SetKey()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+unsigned char implGetCryptMask(const sal_Char* pStr, sal_Int32 nLen, long nVersion)
+{
+ unsigned char nCryptMask = 0;
+
+ if (!nLen)
+ return nCryptMask;
+
+ if( nVersion <= SOFFICE_FILEFORMAT_31 )
+ {
+ while( nLen )
+ {
+ nCryptMask ^= *pStr;
+ pStr++;
+ nLen--;
+ }
+ }
+ else // BugFix #25888#
+ {
+ for( USHORT i = 0; i < nLen; i++ ) {
+ nCryptMask ^= pStr[i];
+ if( nCryptMask & 0x80 ) {
+ nCryptMask <<= 1;
+ nCryptMask++;
+ }
+ else
+ nCryptMask <<= 1;
+ }
+ }
+
+ if( !nCryptMask )
+ nCryptMask = 67;
+
+ return nCryptMask;
+}
+
+void SvStream::SetKey( const ByteString& rKey )
+{
+ aKey = rKey;
+ nCryptMask = implGetCryptMask( aKey.GetBuffer(), aKey.Len(), GetVersion() );
+}
+
+/*************************************************************************
+|*
+|* Stream::SyncSvStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::SyncSvStream( ULONG nNewStreamPos )
+{
+ ClearBuffer();
+ SvStream::nBufFilePos = nNewStreamPos;
+}
+
+/*************************************************************************
+|*
+|* Stream::SyncSysStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+void SvStream::SyncSysStream()
+{
+ Flush();
+ SeekPos( Tell() );
+}
+
+/*************************************************************************
+|*
+|* Stream::SetStreamSize()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+BOOL SvStream::SetStreamSize( ULONG nSize )
+{
+#ifdef DBG_UTIL
+ ULONG nFPos = Tell();
+#endif
+ USHORT nBuf = nBufSize;
+ SetBufferSize( 0 );
+ SetSize( nSize );
+ SetBufferSize( nBuf );
+ DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed")
+ return (BOOL)(nError == 0);
+}
+
+//============================================================================
+
+void SvStream::AddMark( ULONG nPos )
+{
+}
+
+//============================================================================
+
+void SvStream::RemoveMark( ULONG nPos )
+{
+}
+
+/*************************************************************************
+|*
+|* endl()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung TH 13.11.96
+|*
+*************************************************************************/
+
+SvStream& endl( SvStream& rStr )
+{
+ LineEnd eDelim = rStr.GetLineDelimiter();
+ if ( eDelim == LINEEND_CR )
+ rStr << _CR;
+ else if( eDelim == LINEEND_LF )
+ rStr << _LF;
+ else
+ rStr << _CR << _LF;
+ return rStr;
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::SvMemoryStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+SvMemoryStream::SvMemoryStream( void* pBuffer, ULONG nBufSize,
+ StreamMode eMode )
+{
+ if( eMode & STREAM_WRITE )
+ bIsWritable = TRUE;
+ else
+ bIsWritable = FALSE;
+ nEndOfData = nBufSize;
+ bOwnsData = FALSE;
+ pBuf = (BYTE *) pBuffer;
+ nResize = 0L;
+ nSize = nBufSize;
+ nPos = 0L;
+ SetBufferSize( 0 );
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::SvMemoryStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+SvMemoryStream::SvMemoryStream( ULONG nInitSize, ULONG nResizeOffset )
+{
+ bIsWritable = TRUE;
+ bOwnsData = TRUE;
+ nEndOfData = 0L;
+ nResize = nResizeOffset;
+ nPos = 0;
+ pBuf = 0;
+ if( nResize != 0 && nResize < 16 )
+ nResize = 16;
+ if( nInitSize && !AllocateMemory( nInitSize ) )
+ {
+ SetError( SVSTREAM_OUTOFMEMORY );
+ nSize = 0;
+ }
+ else
+ nSize = nInitSize;
+ SetBufferSize( 64 );
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::~SvMemoryStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+SvMemoryStream::~SvMemoryStream()
+{
+ if( pBuf )
+ {
+ if( bOwnsData )
+ FreeMemory();
+ else
+ Flush();
+ }
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::IsA()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+USHORT SvMemoryStream::IsA() const
+{
+ return (USHORT)ID_MEMORYSTREAM;
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::SetBuffer()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+void* SvMemoryStream::SetBuffer( void* pNewBuf, ULONG nCount,
+ BOOL bOwnsDat, ULONG nEOF )
+{
+ void* pResult;
+ SetBufferSize( 0 ); // Buffering in der Basisklasse initialisieren
+ Seek( 0 );
+ if( bOwnsData )
+ {
+ pResult = 0;
+ if( pNewBuf != pBuf )
+ FreeMemory();
+ }
+ else
+ pResult = pBuf;
+
+ pBuf = (BYTE *) pNewBuf;
+ nPos = 0;
+ nSize = nCount;
+ nResize = 0;
+ bOwnsData = bOwnsDat;
+
+ if( nEOF > nCount )
+ nEOF = nCount;
+ nEndOfData = nEOF;
+
+ ResetError();
+
+ DBG_ASSERT( nEndOfData<STREAM_SEEK_TO_END,"Invalid EOF");
+ return pResult;
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::GetData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+ULONG SvMemoryStream::GetData( void* pData, ULONG nCount )
+{
+ ULONG nMaxCount = nEndOfData-nPos;
+ if( nCount > nMaxCount )
+ nCount = nMaxCount;
+#ifdef WIN
+ void _huge* pTmp = (void _huge*)((char _huge*)pBuf + nPos);
+ hmemcpy( (void _huge*)pData, pTmp, (long)nCount);
+#else
+ memcpy( pData, pBuf+nPos, (size_t)nCount );
+#endif
+ nPos += nCount;
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::PutData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+ULONG SvMemoryStream::PutData( const void* pData, ULONG nCount )
+{
+ if( GetError() )
+ return 0L;
+
+ ULONG nMaxCount = nSize-nPos;
+
+ // auf Ueberlauf testen
+ if( nCount > nMaxCount )
+ {
+ if( nResize == 0 )
+ {
+ // soviel wie moeglich rueberschaufeln
+ nCount = nMaxCount;
+ SetError( SVSTREAM_OUTOFMEMORY );
+ }
+ else
+ {
+ long nNewResize;
+ if( nSize && nSize > nResize )
+ nNewResize = nSize;
+ else
+ nNewResize = nResize;
+
+ if( (nCount-nMaxCount) < nResize )
+ {
+ // fehlender Speicher ist kleiner als Resize-Offset,
+ // deshalb um Resize-Offset vergroessern
+ if( !ReAllocateMemory( nNewResize) )
+ {
+ nCount = 0;
+ SetError( SVSTREAM_WRITE_ERROR );
+ }
+ }
+ else
+ {
+ // fehlender Speicher ist groesser als Resize-Offset
+ // deshalb um Differenz+ResizeOffset vergroessern
+ if( !ReAllocateMemory( nCount-nMaxCount+nNewResize ) )
+ {
+ nCount = 0;
+ SetError( SVSTREAM_WRITE_ERROR );
+ }
+ }
+ }
+ }
+ DBG_ASSERT(pBuf,"Possibly Reallocate failed");
+#ifdef WIN
+ void _huge* pTmp = (void _huge*)((char _huge*)pBuf + nPos);
+ hmemcpy( pTmp, (void _huge*)pData,(long)nCount);
+#else
+ memcpy( pBuf+nPos, pData, (size_t)nCount);
+#endif
+
+ nPos += nCount;
+ if( nPos > nEndOfData )
+ nEndOfData = nPos;
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::SeekPos()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+// nEndOfData: Erste Position im Stream, die nicht gelesen werden darf
+// nSize: Groesse des allozierten Speichers
+
+ULONG SvMemoryStream::SeekPos( ULONG nNewPos )
+{
+ if( nNewPos < nEndOfData )
+ nPos = nNewPos;
+ else if( nNewPos == STREAM_SEEK_TO_END )
+ nPos = nEndOfData;
+ else
+ {
+ if( nNewPos >= nSize ) // muss Buffer vergroessert werden ?
+ {
+ if( nResize ) // ist vergroeseern erlaubt ?
+ {
+ long nDiff = (long)(nNewPos - nSize + 1);
+ nDiff += (long)nResize;
+ ReAllocateMemory( nDiff );
+ nPos = nNewPos;
+ nEndOfData = nNewPos;
+ }
+ else // vergroessern ist nicht erlaubt -> ans Ende setzen
+ {
+ // SetError( SVSTREAM_OUTOFMEMORY );
+ nPos = nEndOfData;
+ }
+ }
+ else // gueltigen Bereich innerhalb des Buffers vergroessern
+ {
+ nPos = nNewPos;
+ nEndOfData = nNewPos;
+ }
+ }
+ return nPos;
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::FlushData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+void SvMemoryStream::FlushData()
+{
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::ResetError()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+void SvMemoryStream::ResetError()
+{
+ SvStream::ClearError();
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::AllocateMemory()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+BOOL SvMemoryStream::AllocateMemory( ULONG nNewSize )
+{
+ pBuf = (BYTE*)SvMemAlloc( nNewSize, MEM_NOCALLNEWHDL );
+ return( pBuf != 0 );
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::ReAllocateMemory() (Bozo-Algorithmus)
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 20.06.94
+|* Letzte Aenderung OV 20.06.94
+|*
+*************************************************************************/
+
+BOOL SvMemoryStream::ReAllocateMemory( long nDiff )
+{
+ BOOL bRetVal = FALSE;
+ long nTemp = (long)nSize;
+ nTemp += nDiff;
+ ULONG nNewSize = (ULONG)nTemp;
+
+ if( nNewSize )
+ {
+ BYTE* pNewBuf = (BYTE *) SvMemAlloc( nNewSize,MEM_NOCALLNEWHDL );
+
+ if( pNewBuf )
+ {
+ bRetVal = TRUE; // Success!
+ if( nNewSize < nSize ) // Verkleinern ?
+ {
+#ifdef WIN
+ hmemcpy((void _huge*)pNewBuf,(void _huge*)pBuf,(long)nNewSize );
+#else
+ memcpy( pNewBuf, pBuf, (size_t)nNewSize );
+#endif
+ if( nPos > nNewSize )
+ nPos = 0L;
+ if( nEndOfData >= nNewSize )
+ nEndOfData = nNewSize-1L;
+ }
+ else
+ {
+#ifdef WIN
+ hmemcpy( (void _huge*)pNewBuf, (void _huge*)pBuf, (long)nSize );
+#else
+ memcpy( pNewBuf, pBuf, (size_t)nSize );
+#endif
+ }
+
+ FreeMemory();
+
+ pBuf = pNewBuf;
+ nSize = nNewSize;
+ }
+ }
+ else
+ {
+ bRetVal = TRUE;
+ pBuf = 0;
+ nSize = 0;
+ nEndOfData = 0;
+ nPos = 0;
+ }
+
+ return bRetVal;
+}
+
+void SvMemoryStream::FreeMemory()
+{
+ SvMemFree( pBuf );
+}
+
+/*************************************************************************
+|*
+|* SvMemoryStream::SwitchBuffer()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 26.07.94
+|* Letzte Aenderung OV 26.07.94
+|*
+*************************************************************************/
+
+void* SvMemoryStream::SwitchBuffer( ULONG nInitSize, ULONG nResizeOffset)
+{
+ Flush();
+ if( !bOwnsData )
+ return 0;
+ Seek( STREAM_SEEK_TO_BEGIN );
+
+ void* pRetVal = pBuf;
+ pBuf = 0;
+ nEndOfData = 0L;
+ nResize = nResizeOffset;
+ nPos = 0;
+
+ if( nResize != 0 && nResize < 16 )
+ nResize = 16;
+
+ ResetError();
+
+ if( nInitSize && !AllocateMemory(nInitSize) )
+ {
+ SetError( SVSTREAM_OUTOFMEMORY );
+ nSize = 0;
+ }
+ else
+ nSize = nInitSize;
+
+ SetBufferSize( 64 );
+ return pRetVal;
+}
+
+void SvMemoryStream::SetSize( ULONG nNewSize )
+{
+ long nDiff = (long)nNewSize - (long)nSize;
+ ReAllocateMemory( nDiff );
+}
+
+// *********************************************************************
+// Mac implementierung (mit Handles) in StrmMac.cxx
+// *********************************************************************
+
+#ifndef MAC
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::SvSharedMemoryStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+SvSharedMemoryStream::SvSharedMemoryStream( void* pBuffer,ULONG nBufSize,
+ StreamMode eMode ) :
+ SvMemoryStream( (char*)pBuffer, nBufSize, eMode )
+{
+ aHandle = 0;
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::SvSharedMemoryStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+SvSharedMemoryStream::SvSharedMemoryStream( ULONG nInitSize,
+ ULONG nResizeOffset) :
+ SvMemoryStream( (void*)NULL )
+{
+ if( !nInitSize )
+ nInitSize = 1024;
+
+ aHandle = 0;
+ bIsWritable = TRUE;
+ bOwnsData = TRUE;
+ nEndOfData = 0L;
+ nResize = nResizeOffset;
+ nPos = 0;
+ pBuf = 0;
+
+ if( nResize != 0 && nResize < 16 )
+ nResize = 16;
+
+ if( nInitSize && !AllocateMemory( nInitSize ) )
+ {
+ SetError( SVSTREAM_OUTOFMEMORY );
+ nSize = 0;
+ }
+ else
+ nSize = nInitSize;
+
+ SetBufferSize( 64 );
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::~SvSharedMemoryStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+SvSharedMemoryStream::~SvSharedMemoryStream()
+{
+ if( bOwnsData )
+ {
+ FreeMemory();
+ pBuf = 0; // damit der Dtor von SvMemoryStream nicht mehr zuschlaegt
+ }
+ else
+ Flush();
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::GetData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+const void* SvSharedMemoryStream::GetData()
+{
+ Flush();
+ return pBuf;
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::operator const char*()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+SvSharedMemoryStream::operator const void*()
+{
+ Flush();
+ return pBuf;
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::IsA()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+USHORT SvSharedMemoryStream::IsA() const
+{
+ return (USHORT)ID_SHAREDMEMORYSTREAM;
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::SwitchBuffer()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung KH 16.06.95
+|* Letzte Aenderung KH 16.06.95
+|*
+*************************************************************************/
+
+void* SvSharedMemoryStream::SwitchBuffer( ULONG nInitSize, ULONG nResize )
+{
+ return (void*)SvMemoryStream::SwitchBuffer(nInitSize, nResize);
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::SetBuffer()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung KH 16.06.95
+|* Letzte Aenderung KH 16.06.95
+|*
+*************************************************************************/
+
+void* SvSharedMemoryStream::SetBuffer( void* pBuf, ULONG nSize, BOOL bOwnsData,
+ ULONG nEof)
+{
+ return (void*)SvMemoryStream::SetBuffer((char*)pBuf,nSize,bOwnsData,nEof);
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::GetData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung KH 19.06.95
+|* Letzte Aenderung KH 19.06.95
+|*
+*************************************************************************/
+
+ULONG SvSharedMemoryStream::GetData( void* pData, ULONG nCount )
+{
+ return SvMemoryStream::GetData(pData, nCount);
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::PutData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung KH 19.06.95
+|* Letzte Aenderung KH 19.06.95
+|*
+*************************************************************************/
+
+ULONG SvSharedMemoryStream::PutData( const void* pData, ULONG nCount )
+{
+ return SvMemoryStream::PutData(pData, nCount);
+}
+
+
+//
+// Speicherverwaltung (Alloc, Free, Realloc, SetHandle)
+// Standardimplementation DOS & UNIX
+//
+
+#if defined(DOS) || defined(UNX)
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::SetHandle()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 05.10.95
+|* Letzte Aenderung OV 05.10.95
+|*
+*************************************************************************/
+
+void* SvSharedMemoryStream::SetHandle( void* aHandle, ULONG nSize,
+ BOOL bOwnsData, ULONG nEOF)
+{
+ DBG_ERROR("SvSharedMemoryStream::SetHandle not implemented");
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::AllocateMemory()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+BOOL SvSharedMemoryStream::AllocateMemory( ULONG nNewSize )
+{
+ pBuf = new BYTE[ nNewSize ];
+ return( pBuf != 0 );
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::ReAllocateMemory() (Bozo-Algorithmus)
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+BOOL SvSharedMemoryStream::ReAllocateMemory( long nDiff )
+{
+ BOOL bRetVal = FALSE;
+ ULONG nNewSize = nSize + nDiff;
+ if( nNewSize )
+ {
+ BYTE* pNewBuf = new BYTE[ nNewSize ];
+ if( pNewBuf )
+ {
+ bRetVal = TRUE; // Success!
+ if( nNewSize < nSize ) // Verkleinern ?
+ {
+ memcpy( pNewBuf, pBuf, (size_t)nNewSize );
+ if( nPos > nNewSize )
+ nPos = 0L;
+ if( nEndOfData >= nNewSize )
+ nEndOfData = nNewSize-1L;
+ }
+ else
+ memcpy( pNewBuf, pBuf, (size_t)nSize );
+
+ FreeMemory();
+
+ pBuf = pNewBuf;
+ nSize = nNewSize;
+ }
+ }
+ else
+ {
+ FreeMemory();
+ bRetVal = TRUE;
+ pBuf = 0;
+ nSize = 0;
+ nPos = 0;
+ nEndOfData = 0;
+ }
+ return bRetVal;
+}
+
+void SvSharedMemoryStream::FreeMemory()
+{
+ delete pBuf;
+}
+
+
+#endif
+
+#endif
+
+TYPEINIT0 ( SvDataCopyStream )
+
+// --------------------
+
+// Diese Methoden muessen fuer die Win16-Version implementiert werden,
+// da sonst der Compiler Aerger macht. (?)
+/*
+TypeId SvDataCopyStream::Type() const
+{
+ return 0;
+}
+
+BOOL SvDataCopyStream::IsA(TypeId aId) const
+{
+ return FALSE;
+}
+*/
+
+void SvDataCopyStream::Assign( const SvDataCopyStream& rHack)
+{
+}
diff --git a/tools/source/stream/strmos2.cxx b/tools/source/stream/strmos2.cxx
new file mode 100644
index 000000000000..7f96a70ba194
--- /dev/null
+++ b/tools/source/stream/strmos2.cxx
@@ -0,0 +1,870 @@
+/*************************************************************************
+ *
+ * $RCSfile: strmos2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <limits.h>
+
+#define INCL_PM
+#define INCL_DOS
+#include <svpm.h>
+#include <bseerr.h>
+
+#include <debug.hxx>
+#include <fsys.hxx>
+#include <stream.hxx>
+#include <fastfsys.hxx>
+
+// -----------------------------------------------------------------------
+
+// --------------
+// - StreamData -
+// --------------
+
+class StreamData
+{
+public:
+ HFILE hFile;
+ BOOL bIsEof;
+
+ StreamData()
+ {
+ hFile = 0;
+ bIsEof = TRUE;
+ }
+};
+
+// -----------------------------------------------------------------------
+
+ULONG GetSvError( APIRET nPMError )
+{
+ static struct { APIRET pm; ULONG sv; } errArr[] =
+ {
+ { ERROR_FILE_NOT_FOUND, SVSTREAM_FILE_NOT_FOUND },
+ { ERROR_PATH_NOT_FOUND, SVSTREAM_PATH_NOT_FOUND },
+ { ERROR_TOO_MANY_OPEN_FILES, SVSTREAM_TOO_MANY_OPEN_FILES },
+ { ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED },
+ { ERROR_INVALID_ACCESS, SVSTREAM_INVALID_ACCESS },
+ { ERROR_SHARING_VIOLATION, SVSTREAM_SHARING_VIOLATION },
+ { ERROR_SHARING_BUFFER_EXCEEDED,SVSTREAM_SHARE_BUFF_EXCEEDED },
+ { ERROR_CANNOT_MAKE, SVSTREAM_CANNOT_MAKE },
+ { ERROR_INVALID_PARAMETER, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_DRIVE_LOCKED, SVSTREAM_LOCKING_VIOLATION },
+ { ERROR_LOCK_VIOLATION, SVSTREAM_LOCKING_VIOLATION },
+ { ERROR_FILENAME_EXCED_RANGE, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_ATOMIC_LOCK_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_READ_LOCKS_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER },
+
+
+ { 0xFFFF, SVSTREAM_GENERALERROR }
+ };
+
+ ULONG nRetVal = SVSTREAM_GENERALERROR; // Standardfehler
+ int i=0;
+ do
+ {
+ if( errArr[i].pm == nPMError )
+ {
+ nRetVal = errArr[i].sv;
+ break;
+ }
+ i++;
+ }
+ while( errArr[i].pm != 0xFFFF );
+ return nRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode )
+{
+ bIsOpen = FALSE;
+ nLockCounter = 0;
+ bIsWritable = FALSE;
+ pInstanceData = new StreamData;
+
+ SetBufferSize( 8192 );
+ Open( rFileName, nOpenMode );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 22.11.94
+|* Letzte Aenderung OV 22.11.94
+|*
+*************************************************************************/
+
+SvFileStream::SvFileStream()
+{
+ bIsOpen = FALSE;
+ nLockCounter = 0;
+ bIsWritable = FALSE;
+ pInstanceData = new StreamData;
+ SetBufferSize( 8192 );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::~SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 14.06.94
+|* Letzte Aenderung OV 14.06.94
+|*
+*************************************************************************/
+
+SvFileStream::~SvFileStream()
+{
+ Close();
+ if( pInstanceData )
+ delete pInstanceData;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::GetFileHandle()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 14.06.94
+|* Letzte Aenderung OV 14.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::GetFileHandle() const
+{
+ return (ULONG)pInstanceData->hFile;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::IsA()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 14.06.94
+|* Letzte Aenderung OV 14.06.94
+|*
+*************************************************************************/
+
+USHORT SvFileStream::IsA() const
+{
+ return ID_FILESTREAM;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::GetData()
+|*
+|* Beschreibung STREAM.SDW, Prueft nicht Eof; IsEof danach rufbar
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::GetData( char* pData, ULONG nSize )
+{
+#ifdef DBG_UTIL
+ String aTraceStr( "SvFileStream::GetData(): " );
+ aTraceStr += nSize;
+ aTraceStr += " Bytes from ";
+ aTraceStr += aFilename;
+ DBG_TRACE( aTraceStr );
+#endif
+
+ ULONG nCount = 0L;
+ if( IsOpen() )
+ {
+ APIRET nResult;
+ nResult = DosRead( pInstanceData->hFile,(PVOID)pData,nSize,&nCount );
+ if( nResult )
+ SetError(::GetSvError(nResult) );
+ }
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::PutData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::PutData( const char* pData, ULONG nSize )
+{
+#ifdef DBG_UTIL
+ String aTraceStr( "SvFileStrean::PutData: " );
+ aTraceStr += nSize;
+ aTraceStr += " Bytes to ";
+ aTraceStr += aFilename;
+ DBG_TRACE( aTraceStr );
+#endif
+
+ ULONG nCount = 0L;
+ if( IsOpen() )
+ {
+ APIRET nResult;
+ nResult = DosWrite( pInstanceData->hFile,(PVOID)pData,nSize,&nCount );
+ if( nResult )
+ SetError(::GetSvError(nResult) );
+ else if( !nCount )
+ SetError( SVSTREAM_DISK_FULL );
+ }
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SeekPos()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::SeekPos( ULONG nPos )
+{
+ ULONG nNewPos = 0L;
+ if( IsOpen() )
+ {
+ APIRET nResult;
+
+ if( nPos != STREAM_SEEK_TO_END )
+ nResult = DosSetFilePtr( pInstanceData->hFile,(long)nPos,
+ FILE_BEGIN, &nNewPos );
+ else
+ nResult = DosSetFilePtr( pInstanceData->hFile,0L,
+ FILE_END, &nNewPos );
+
+ if( nResult )
+ SetError(::GetSvError(nResult) );
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return nNewPos;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::Tell()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+/*
+ULONG SvFileStream::Tell()
+{
+ ULONG nPos = 0L;
+
+ if( IsOpen() )
+ {
+ APIRET nResult;
+ nResult = DosSetFilePtr(pInstanceData->hFile,0L,FILE_CURRENT,&nPos);
+ if( nResult )
+ SetError(::GetSvError(nResult) );
+ }
+ return nPos;
+}
+*/
+
+/*************************************************************************
+|*
+|* SvFileStream::FlushData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::FlushData()
+{
+ if( IsOpen() )
+ {
+ APIRET nResult;
+ nResult = DosResetBuffer(pInstanceData->hFile );
+ if( nResult )
+ SetError(::GetSvError(nResult) );
+ }
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::LockRange()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::LockRange( ULONG nByteOffset, ULONG nBytes )
+{
+ BOOL bRetVal = FALSE;
+ if( IsOpen() )
+ {
+ APIRET nResult;
+ FILELOCK aLockArea, aUnlockArea;
+ aUnlockArea.lOffset = 0L;
+ aUnlockArea.lRange = 0L;
+ aLockArea.lOffset = (long)nByteOffset;
+ aLockArea.lRange = (long)nBytes;
+
+ nResult = DosSetFileLocks(pInstanceData->hFile,
+ &aUnlockArea, &aLockArea,
+ 1000UL, // Zeit in ms bis Abbruch
+ 0L // kein Atomic-Lock
+ );
+
+ if( nResult )
+ SetError(::GetSvError(nResult) );
+ else
+ bRetVal = TRUE;
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::UnlockRange()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::UnlockRange( ULONG nByteOffset, ULONG nBytes )
+{
+ BOOL bRetVal = FALSE;
+ if( IsOpen() )
+ {
+ APIRET nResult;
+ FILELOCK aLockArea, aUnlockArea;
+ aLockArea.lOffset = 0L;
+ aLockArea.lRange = 0L;
+ aUnlockArea.lOffset = (long)nByteOffset;
+ aUnlockArea.lRange = (long)nBytes;
+
+ nResult = DosSetFileLocks(pInstanceData->hFile,
+ &aUnlockArea, &aLockArea,
+ 1000UL, // Zeit in ms bis Abbruch
+ 0L // kein Atomic-Lock
+ );
+
+ if( nResult )
+ SetError(::GetSvError(nResult) );
+ else
+ bRetVal = TRUE;
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::LockFile()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::LockFile()
+{
+ BOOL bRetVal = FALSE;
+ if( !nLockCounter )
+ {
+ if( LockRange( 0L, LONG_MAX ) )
+ {
+ nLockCounter = 1;
+ bRetVal = TRUE;
+ }
+ }
+ else
+ {
+ nLockCounter++;
+ bRetVal = TRUE;
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::UnlockFile()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::UnlockFile()
+{
+ BOOL bRetVal = FALSE;
+ if( nLockCounter > 0)
+ {
+ if( nLockCounter == 1)
+ {
+ if( UnlockRange( 0L, LONG_MAX ) )
+ {
+ nLockCounter = 0;
+ bRetVal = TRUE;
+ }
+ }
+ else
+ {
+ nLockCounter--;
+ bRetVal = TRUE;
+ }
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::Open()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL createLongNameEA ( const PCSZ pszPath, ULONG ulAttributes, const String& aLongName );
+
+void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
+{
+ String aParsedFilename;
+
+ if ( Folder::IsAvailable() && (rFilename.Search("{") < 9) )
+ {
+ String aVirtualPart;
+ String aRealPart;
+ String aVirtualPath;
+ ItemIDPath aVirtualURL;
+ ULONG nDivider = 0;
+
+ String aVirtualString(rFilename);
+
+ for (int x=aVirtualString.Len(); x>0; x--)
+ {
+ if (aVirtualString.Copy(x,1).Compare("}")==COMPARE_EQUAL)
+ {
+ nDivider = x;
+ break;
+ }
+ }
+
+ aVirtualPart = aVirtualString.Copy(0,nDivider+1);
+ aRealPart = aVirtualString.Copy(nDivider+2);
+
+ aVirtualURL = aVirtualPart;
+ aVirtualPath = aVirtualURL.GetHostNotationPath();
+
+ DirEntry aTempDirEntry(aVirtualPath);
+
+ aTempDirEntry += aRealPart;
+
+ aParsedFilename = aTempDirEntry.GetFull();
+ }
+ else
+ {
+ aParsedFilename = rFilename;
+ }
+
+ Close();
+ SvStream::ClearBuffer();
+
+ ULONG nActionTaken;
+ ULONG nOpenAction = 0L;
+ ULONG nShareBits = 0L;
+ ULONG nReadWriteBits = 0L;
+
+ eStreamMode = nOpenMode;
+ eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten
+
+ nOpenMode |= STREAM_SHARE_DENYNONE; // definierten Zustand garantieren
+
+ // ********* Zugriffsflags ***********
+ if( nOpenMode & STREAM_SHARE_DENYNONE)
+ nShareBits = OPEN_SHARE_DENYNONE;
+
+ if( nOpenMode & STREAM_SHARE_DENYREAD)
+ nShareBits = OPEN_SHARE_DENYREAD;
+
+ if( nOpenMode & STREAM_SHARE_DENYWRITE)
+ nShareBits = OPEN_SHARE_DENYWRITE;
+
+ if( nOpenMode & STREAM_SHARE_DENYALL)
+ nShareBits = OPEN_SHARE_DENYREADWRITE;
+
+ if( (nOpenMode & STREAM_READ) )
+ {
+ if( nOpenMode & STREAM_WRITE )
+ nReadWriteBits |= OPEN_ACCESS_READWRITE;
+ else
+ {
+ nReadWriteBits |= OPEN_ACCESS_READONLY;
+ nOpenMode |= STREAM_NOCREATE;
+ }
+ }
+ else
+ nReadWriteBits |= OPEN_ACCESS_WRITEONLY;
+
+
+ if( nOpenMode & STREAM_NOCREATE )
+ {
+ // Datei nicht erzeugen
+ nOpenAction = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS;
+ }
+ else
+ {
+ // Datei erzeugen, wenn nicht vorhanden
+ nOpenAction = OPEN_ACTION_CREATE_IF_NEW;
+ if( nOpenMode & STREAM_TRUNC )
+ // Auf Nullaenge kuerzen, wenn existiert
+ nOpenAction |= OPEN_ACTION_REPLACE_IF_EXISTS;
+ else
+ // Inhalt der Datei nicht wegwerfen
+ nOpenAction |= OPEN_ACTION_OPEN_IF_EXISTS;
+ }
+
+ //
+ // resolves long FAT names used by OS2
+ //
+ BOOL bIsLongOS2=FALSE;
+ if (Folder::IsAvailable())
+ {
+ DirEntry aDirEntry(rFilename);
+ if (aDirEntry.IsLongNameOnFAT())
+ {
+ // in kurzen Pfad wandeln
+ ItemIDPath aItemIDPath(rFilename);
+ aParsedFilename = aItemIDPath.GetHostNotationPath();
+ bIsLongOS2 = TRUE;
+ }
+ }
+
+ aFilename = aParsedFilename;
+ FSysRedirector::DoRedirect( aFilename );
+
+#ifdef DBG_UTIL
+ String aTraceStr( "SvFileStream::Open(): " );
+ aTraceStr += aFilename;
+ DBG_TRACE( aTraceStr );
+#endif
+
+ APIRET nRet = DosOpen( (const char*)aFilename, &pInstanceData->hFile,
+ &nActionTaken, 0L, FILE_NORMAL, nOpenAction,
+ nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L);
+
+ if( nRet == ERROR_TOO_MANY_OPEN_FILES )
+ {
+ long nToAdd = 10;
+ ULONG nCurMaxFH;
+ nRet = DosSetRelMaxFH( &nToAdd, &nCurMaxFH );
+ nRet = DosOpen( (const char*)aFilename, &pInstanceData->hFile,
+ &nActionTaken, 0L, FILE_NORMAL, nOpenAction,
+ nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L);
+ }
+
+ // Bei Fehler pruefen, ob wir lesen duerfen
+ if( nRet==ERROR_ACCESS_DENIED || nRet==ERROR_SHARING_VIOLATION )
+ {
+ nReadWriteBits = OPEN_ACCESS_READONLY;
+ nRet = DosOpen( (const char*)aFilename, &pInstanceData->hFile,
+ &nActionTaken, 0L, FILE_NORMAL, nOpenAction,
+ nReadWriteBits | nShareBits | OPEN_FLAGS_NOINHERIT, 0L);
+ }
+
+ if( nRet )
+ {
+ bIsOpen = FALSE;
+ SetError(::GetSvError(nRet) );
+ }
+ else
+ {
+ bIsOpen = TRUE;
+ pInstanceData->bIsEof = FALSE;
+ if( nReadWriteBits != OPEN_ACCESS_READONLY )
+ bIsWritable = TRUE;
+ }
+
+ if (bIsOpen && bIsLongOS2)
+ {
+ //file schließen, da sonst createLongName u.U. nicht möglich
+ Close();
+
+ // erzeugtem File langen Namen geben
+ DirEntry aDirEntry(rFilename);
+ createLongNameEA((const char*)aFilename, FILE_NORMAL, aDirEntry.GetName());
+
+ // und wieder oeffnen
+ ReOpen();
+ }
+
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::ReOpen()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::ReOpen()
+{
+ if( !bIsOpen && aFilename.Len() )
+ Open( aFilename, eStreamMode );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::Close()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::Close()
+{
+ if( IsOpen() )
+ {
+#ifdef DBG_UTIL
+ String aTraceStr( "SvFileStream::Close(): " );
+ aTraceStr += aFilename;
+ DBG_TRACE( aTraceStr );
+#endif
+
+ if( nLockCounter )
+ {
+ nLockCounter = 1;
+ UnlockFile();
+ }
+ Flush();
+ DosClose( pInstanceData->hFile );
+ }
+
+ bIsOpen = FALSE;
+ nLockCounter= 0;
+ bIsWritable = FALSE;
+ pInstanceData->bIsEof = TRUE;
+ SvStream::ClearBuffer();
+ SvStream::ClearError();
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::ResetError()
+|*
+|* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::ResetError()
+{
+ SvStream::ClearError();
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SetSize()
+|*
+|* Beschreibung
+|* Ersterstellung OV 19.10.95
+|* Letzte Aenderung OV 19.10.95
+|*
+*************************************************************************/
+
+void SvFileStream::SetSize( ULONG nSize )
+{
+ if( IsOpen() )
+ {
+ APIRET nRet = DosSetFileSize( pInstanceData->hFile, nSize );
+ if( nRet )
+ SetError( ::GetSvError( nRet ) );
+ }
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::AllocateMemory()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+BOOL SvSharedMemoryStream::AllocateMemory( ULONG nNewSize )
+{
+ DBG_ASSERT(aHandle==0,"Keine Handles unter OS/2");
+ DBG_ASSERT(nNewSize,"Cannot allocate zero Bytes");
+ APIRET nRet = DosAllocSharedMem( (void**)&pBuf, (PSZ)NULL, nNewSize,
+ PAG_READ | PAG_WRITE | PAG_COMMIT |
+ OBJ_GIVEABLE | OBJ_GETTABLE );
+ return( nRet == 0 );
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::ReAllocateMemory() (Bozo-Algorithmus)
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+BOOL SvSharedMemoryStream::ReAllocateMemory( long nDiff )
+{
+ DBG_ASSERT(aHandle==0,"Keine Handles unter OS/2");
+ BOOL bRetVal = FALSE;
+ ULONG nNewSize = nSize + nDiff;
+ if( nNewSize )
+ {
+ // neuen Speicher nicht ueber AllocateMemory holen, da wir den
+ // alten Speicher behalten wollen, falls nicht genuegend Platz
+ // fuer den neuen Block da ist
+ char* pNewBuf;
+ APIRET nRet = DosAllocSharedMem( (void**)&pNewBuf,(PSZ)NULL,nNewSize,
+ PAG_READ | PAG_WRITE | PAG_COMMIT |
+ OBJ_GIVEABLE | OBJ_GETTABLE );
+ DBG_ASSERT(!nRet,"DosAllocSharedMem failed");
+
+ if( !nRet )
+ {
+ bRetVal = TRUE; // Success!
+ if( nNewSize < nSize ) // Verkleinern ?
+ {
+ memcpy( pNewBuf, pBuf, (size_t)nNewSize );
+ if( nPos > nNewSize )
+ nPos = 0L;
+ if( nEndOfData >= nNewSize )
+ nEndOfData = nNewSize-1L;
+ }
+ else
+ memcpy( pNewBuf, pBuf, (size_t)nSize );
+
+ FreeMemory(); // den alten Block loeschen ...
+
+ // und den neuen Block in Dienst stellen
+ pBuf = pNewBuf;
+ nSize = nNewSize;
+ }
+ }
+ else
+ {
+ bRetVal = TRUE;
+ FreeMemory();
+ pBuf = 0;
+ nSize = 0;
+ nEndOfData = 0;
+ }
+ return bRetVal;
+}
+
+void SvSharedMemoryStream::FreeMemory()
+{
+ DBG_ASSERT(aHandle==0,"Keine Handles unter OS/2");
+ DosFreeMem( pBuf );
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::SetHandle()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 05.10.95
+|* Letzte Aenderung OV 05.10.95
+|*
+*************************************************************************/
+
+void* SvSharedMemoryStream::SetHandle( void*, ULONG,BOOL, ULONG )
+{
+ DBG_ERROR("OS/2 does not support memory handles");
+ // return SetBuffer(aNewHandle, nSize, bOwnsData, nEOF );
+ return 0;
+}
+
+
diff --git a/tools/source/stream/strmsys.cxx b/tools/source/stream/strmsys.cxx
new file mode 100644
index 000000000000..5639174d3fec
--- /dev/null
+++ b/tools/source/stream/strmsys.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: strmsys.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if defined( OS2 )
+#include "strmos2.cxx"
+#elif defined( WNT )
+#include "strmwnt.cxx"
+#elif defined( WIN )
+#include "strmwin.cxx"
+#elif defined( MAC )
+#include "strmmac.cxx"
+#elif defined( UNX )
+#include "strmunx.cxx"
+#else
+#include "strmstd.cxx"
+#endif
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
new file mode 100644
index 000000000000..cab977989456
--- /dev/null
+++ b/tools/source/stream/strmunx.cxx
@@ -0,0 +1,897 @@
+/*************************************************************************
+ *
+ * $RCSfile: strmunx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <limits.h>
+#include <stdlib.h> // fuer getenv()
+
+#include <debug.hxx>
+#include <fsys.hxx>
+#include <stream.hxx>
+
+#include <vos/mutex.hxx>
+#include <osl/thread.h> // osl_getThreadTextEncoding
+
+// class FileBase
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+using namespace osl;
+
+// -----------------------------------------------------------------------
+
+// ----------------
+// - InternalLock -
+// ----------------
+
+class InternalStreamLock;
+DECLARE_LIST( InternalStreamLockList, InternalStreamLock* );
+
+class InternalStreamLock
+{
+ ULONG m_nStartPos;
+ ULONG m_nEndPos;
+ SvFileStream* m_pStream;
+ struct stat m_aStat;
+
+ static InternalStreamLockList LockList;
+#ifndef BOOTSTRAP
+ static NAMESPACE_VOS(OMutex) LockMutex;
+#endif
+
+ InternalStreamLock( ULONG, ULONG, SvFileStream* );
+ ~InternalStreamLock();
+public:
+ static BOOL LockFile( ULONG nStart, ULONG nEnd, SvFileStream* );
+ static void UnlockFile( ULONG nStart, ULONG nEnd, SvFileStream* );
+};
+
+InternalStreamLockList InternalStreamLock::LockList;
+#ifndef BOOTSTRAP
+NAMESPACE_VOS(OMutex) InternalStreamLock::LockMutex;
+#endif
+
+InternalStreamLock::InternalStreamLock(
+ ULONG nStart,
+ ULONG nEnd,
+ SvFileStream* pStream ) :
+ m_nStartPos( nStart ),
+ m_nEndPos( nEnd ),
+ m_pStream( pStream )
+{
+ ByteString aFileName(m_pStream->GetFileName(), osl_getThreadTextEncoding());
+ stat( aFileName.GetBuffer(), &m_aStat );
+ LockList.Insert( this, LIST_APPEND );
+#ifdef DEBUG
+ fprintf( stderr, "locked %s", aFileName.GetBuffer() );
+ if( m_nStartPos || m_nEndPos )
+ fprintf(stderr, " [ %d ... %d ]", m_nStartPos, m_nEndPos );
+ fprintf( stderr, "\n" );
+#endif
+}
+
+InternalStreamLock::~InternalStreamLock()
+{
+ LockList.Remove( this );
+#ifdef DEBUG
+ ByteString aFileName(m_pStream->GetFileName(), osl_getThreadTextEncoding());
+ fprintf( stderr, "unlocked %s", aFileName.GetBuffer() );
+ if( m_nStartPos || m_nEndPos )
+ fprintf(stderr, " [ %d ... %d ]", m_nStartPos, m_nEndPos );
+ fprintf( stderr, "\n" );
+#endif
+}
+
+BOOL InternalStreamLock::LockFile( ULONG nStart, ULONG nEnd, SvFileStream* pStream )
+{
+#ifndef BOOTSTRAP
+ NAMESPACE_VOS( OGuard ) aGuard( LockMutex );
+#endif
+ ByteString aFileName(pStream->GetFileName(), osl_getThreadTextEncoding());
+ struct stat aStat;
+ if( stat( aFileName.GetBuffer(), &aStat ) )
+ return FALSE;
+
+ if( S_ISDIR( aStat.st_mode ) )
+ return TRUE;
+
+ InternalStreamLock* pLock = NULL;
+ for( int i = 0; i < LockList.Count(); i++ )
+ {
+ pLock = LockList.GetObject( i );
+ if( aStat.st_ino == pLock->m_aStat.st_ino )
+ {
+ BOOL bDenyByOptions = FALSE;
+ StreamMode nLockMode = pLock->m_pStream->GetStreamMode();
+ StreamMode nNewMode = pStream->GetStreamMode();
+
+ if( nLockMode & STREAM_SHARE_DENYALL )
+ bDenyByOptions = TRUE;
+ else if( ( nLockMode & STREAM_SHARE_DENYWRITE ) &&
+ ( nNewMode & STREAM_WRITE ) )
+ bDenyByOptions = TRUE;
+ else if( ( nLockMode & STREAM_SHARE_DENYREAD ) &&
+ ( nNewMode & STREAM_READ ) )
+ bDenyByOptions = TRUE;
+
+ if( bDenyByOptions )
+ {
+ if( pLock->m_nStartPos == 0 && pLock->m_nEndPos == 0 ) // whole file is already locked
+ return FALSE;
+ if( nStart == 0 && nEnd == 0) // cannot lock whole file
+ return FALSE;
+
+ if( ( nStart < pLock->m_nStartPos && nEnd > pLock->m_nStartPos ) ||
+ ( nStart < pLock->m_nEndPos && nEnd > pLock->m_nEndPos ) )
+ return FALSE;
+ }
+ }
+ }
+ pLock = new InternalStreamLock( nStart, nEnd, pStream );
+ return TRUE;
+}
+
+void InternalStreamLock::UnlockFile( ULONG nStart, ULONG nEnd, SvFileStream* pStream )
+{
+#ifndef BOOTSTRAP
+ NAMESPACE_VOS( OGuard ) aGuard( LockMutex );
+#endif
+ InternalStreamLock* pLock = NULL;
+ if( nStart == 0 && nEnd == 0 )
+ {
+ for( int i = 0; i < LockList.Count(); i++ )
+ {
+ if( ( pLock = LockList.GetObject( i ) )->m_pStream == pStream )
+ {
+ delete pLock;
+ i--;
+ }
+ }
+ return;
+ }
+ for( int i = 0; i < LockList.Count(); i++ )
+ {
+ if( ( pLock = LockList.GetObject( i ) )->m_pStream == pStream &&
+ nStart == pLock->m_nStartPos && nEnd == pLock->m_nEndPos )
+ {
+ delete pLock;
+ return;
+ }
+ }
+}
+
+// --------------
+// - StreamData -
+// --------------
+
+class StreamData
+{
+public:
+ int nHandle;
+
+ StreamData() { nHandle = 0; }
+};
+
+// -----------------------------------------------------------------------
+
+static ULONG GetSvError( int nErrno )
+{
+ static struct { int nErr; ULONG sv; } errArr[] =
+ {
+ { 0, SVSTREAM_OK },
+ { EACCES, SVSTREAM_ACCESS_DENIED },
+ { EBADF, SVSTREAM_INVALID_HANDLE },
+#if defined( RS6000 ) || defined( ALPHA ) || defined( HP9000 ) || defined( NETBSD ) || defined( S390 ) || defined(FREEBSD) || defined(MACOSX)
+ { EDEADLK, SVSTREAM_LOCKING_VIOLATION },
+#else
+ { EDEADLOCK, SVSTREAM_LOCKING_VIOLATION },
+#endif
+ { EINVAL, SVSTREAM_INVALID_PARAMETER },
+ { EMFILE, SVSTREAM_TOO_MANY_OPEN_FILES },
+ { ENFILE, SVSTREAM_TOO_MANY_OPEN_FILES },
+ { ENOENT, SVSTREAM_FILE_NOT_FOUND },
+ { EPERM, SVSTREAM_ACCESS_DENIED },
+ { EROFS, SVSTREAM_ACCESS_DENIED },
+ { EAGAIN, SVSTREAM_LOCKING_VIOLATION },
+ { EISDIR, SVSTREAM_PATH_NOT_FOUND },
+ { ELOOP, SVSTREAM_PATH_NOT_FOUND },
+#if ! defined( RS6000 ) && ! defined( ALPHA ) && ! defined( NETBSD ) && ! defined (FREEBSD) && ! defined (MACOSX)
+ { EMULTIHOP, SVSTREAM_PATH_NOT_FOUND },
+ { ENOLINK, SVSTREAM_PATH_NOT_FOUND },
+#endif
+ { ENOTDIR, SVSTREAM_PATH_NOT_FOUND },
+ { ETXTBSY, SVSTREAM_ACCESS_DENIED },
+ { EEXIST, SVSTREAM_CANNOT_MAKE },
+ { ENOSPC, SVSTREAM_DISK_FULL },
+ { (int)0xFFFF, SVSTREAM_GENERALERROR }
+ };
+
+ ULONG nRetVal = SVSTREAM_GENERALERROR; // Standardfehler
+ int i=0;
+ do
+ {
+ if ( errArr[i].nErr == nErrno )
+ {
+ nRetVal = errArr[i].sv;
+ break;
+ }
+ i++;
+ }
+ while( errArr[i].nErr != 0xFFFF );
+ return nRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 08.06.94
+|* Letzte Aenderung OV 08.06.94
+|*
+*************************************************************************/
+
+SvFileStream::SvFileStream( const String& rFileName, StreamMode nOpenMode )
+{
+ bIsOpen = FALSE;
+ nLockCounter = 0;
+ bIsWritable = FALSE;
+ pInstanceData = new StreamData;
+
+ SetBufferSize( 1024 );
+ // convert URL to SystemPath, if necessary
+ ::rtl::OUString aFileName, aNormPath;
+ if ( FileBase::getNormalizedPathFromFileURL( rFileName, aNormPath ) == FileBase::E_None )
+ FileBase::getSystemPathFromNormalizedPath( aNormPath, aFileName );
+ else
+ aFileName = rFileName;
+ Open( aFileName, nOpenMode );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 22.11.94
+|* Letzte Aenderung OV 22.11.94
+|*
+*************************************************************************/
+
+SvFileStream::SvFileStream()
+{
+ bIsOpen = FALSE;
+ nLockCounter = 0;
+ bIsWritable = FALSE;
+ pInstanceData = new StreamData;
+ SetBufferSize( 1024 );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::~SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 22.11.94
+|* Letzte Aenderung OV 22.11.94
+|*
+*************************************************************************/
+
+SvFileStream::~SvFileStream()
+{
+ Close();
+
+ InternalStreamLock::UnlockFile( 0, 0, this );
+
+ if (pInstanceData)
+ delete pInstanceData;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::GetFileHandle()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 22.11.94
+|* Letzte Aenderung OV 22.11.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::GetFileHandle() const
+{
+ return (ULONG)pInstanceData->nHandle;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::IsA()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 14.06.94
+|* Letzte Aenderung OV 14.06.94
+|*
+*************************************************************************/
+
+USHORT SvFileStream::IsA() const
+{
+ return ID_FILESTREAM;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::GetData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::GetData( void* pData, ULONG nSize )
+{
+#ifdef DBG_UTIL
+ ByteString aTraceStr( "SvFileStream::GetData(): " );
+ aTraceStr += nSize;
+ aTraceStr += " Bytes from ";
+ aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding());
+ DBG_TRACE( aTraceStr.GetBuffer() );
+#endif
+
+ int nRead = 0;
+ if ( IsOpen() )
+ {
+ nRead= read(pInstanceData->nHandle,pData,(unsigned)nSize);
+ if ( nRead == -1 )
+ SetError( ::GetSvError( errno ));
+ }
+ return (ULONG)nRead;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::PutData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::PutData( const void* pData, ULONG nSize )
+{
+#ifdef DBG_UTIL
+ ByteString aTraceStr( "SvFileStrean::PutData: " );
+ aTraceStr += nSize;
+ aTraceStr += " Bytes to ";
+ aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding());
+ DBG_TRACE( aTraceStr.GetBuffer() );
+#endif
+
+ int nWrite = 0;
+ if ( IsOpen() )
+ {
+ nWrite= write(pInstanceData->nHandle,pData,(unsigned)nSize);
+ if ( nWrite == -1 )
+ SetError( ::GetSvError( errno ) );
+ else if( !nWrite )
+ SetError( SVSTREAM_DISK_FULL );
+ }
+ return (ULONG)nWrite;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SeekPos()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::SeekPos( ULONG nPos )
+{
+ if ( IsOpen() )
+ {
+ long nNewPos;
+ if ( nPos != STREAM_SEEK_TO_END )
+ nNewPos = lseek( pInstanceData->nHandle, (long)nPos, SEEK_SET );
+ else
+ nNewPos = lseek( pInstanceData->nHandle, 0L, SEEK_END );
+
+ if ( nNewPos == -1 )
+ {
+ SetError( SVSTREAM_SEEK_ERROR );
+ return 0L;
+ }
+ // langsam aber sicherer als return nNewPos
+ return lseek(pInstanceData->nHandle,0L,SEEK_CUR);
+ // return nNewPos;
+ }
+ SetError( SVSTREAM_GENERALERROR );
+ return 0L;
+}
+
+
+/*************************************************************************
+|*
+|* SvFileStream::FlushData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::FlushData()
+{
+// lokal gibt es nicht
+}
+
+static char *pFileLockEnvVar = (char*)1;
+
+/*************************************************************************
+|*
+|* SvFileStream::LockRange()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::LockRange( ULONG nByteOffset, ULONG nBytes )
+{
+ struct flock aflock;
+ aflock.l_start = nByteOffset;
+ aflock.l_whence = SEEK_SET;
+ aflock.l_len = nBytes;
+
+ int nLockMode = 0;
+
+ if ( ! IsOpen() )
+ return FALSE;
+
+ if ( eStreamMode & STREAM_SHARE_DENYALL )
+ if (bIsWritable)
+ nLockMode = F_WRLCK;
+ else
+ nLockMode = F_RDLCK;
+
+ if ( eStreamMode & STREAM_SHARE_DENYREAD )
+ if (bIsWritable)
+ nLockMode = F_WRLCK;
+ else
+ {
+ SetError(SVSTREAM_LOCKING_VIOLATION);
+ return FALSE;
+ }
+
+ if ( eStreamMode & STREAM_SHARE_DENYWRITE )
+ if (bIsWritable)
+ nLockMode = F_WRLCK;
+ else
+ nLockMode = F_RDLCK;
+
+ if (!nLockMode)
+ return TRUE;
+
+ if( ! InternalStreamLock::LockFile( nByteOffset, nByteOffset+nBytes, this ) )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "InternalLock on %s [ %d ... %d ] failed\n",
+ ByteString(aFilename, osl_getThreadTextEncoding()).GetBuffer(), nByteOffset, nByteOffset+nBytes );
+#endif
+ return FALSE;
+ }
+
+ // HACK: File-Locking nur via Environmentvariable einschalten
+ // um einen Haenger im Zusammenspiel mit einem Linux
+ // NFS-2-Server (kein Lockdaemon) zu verhindern.
+ // File-Locking ?ber NFS ist generell ein Performancekiller.
+ // HR, 22.10.1997 fuer SOLARIS
+ // CP, 30.11.1997 fuer HPUX
+ // ER, 18.12.1997 fuer IRIX
+ // HR, 18.05.1998 Environmentvariable
+
+ if ( pFileLockEnvVar == (char*)1 )
+ pFileLockEnvVar = getenv("STAR_ENABLE_FILE_LOCKING");
+ if ( ! pFileLockEnvVar )
+ return TRUE;
+
+ aflock.l_type = nLockMode;
+ if (fcntl(pInstanceData->nHandle, F_GETLK, &aflock) == -1)
+ {
+ #if ( defined HPUX && defined BAD_UNION )
+ #ifdef DBG_UTIL
+ fprintf( stderr, "***** FCNTL(lock):errno = %d\n", errno );
+ #endif
+ if ( errno == EINVAL || errno == ENOSYS )
+ return TRUE;
+ #endif
+ #if defined SINIX
+ if (errno == EINVAL)
+ return TRUE;
+ #endif
+ #if defined SOLARIS
+ if (errno == ENOSYS)
+ return TRUE;
+ #endif
+ SetError( ::GetSvError( errno ));
+ return FALSE;
+ }
+ if (aflock.l_type != F_UNLCK)
+ {
+ SetError(SVSTREAM_LOCKING_VIOLATION);
+ return FALSE;
+ }
+
+ aflock.l_type = nLockMode;
+ if (fcntl(pInstanceData->nHandle, F_SETLK, &aflock) == -1)
+ {
+ SetError( ::GetSvError( errno ));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::UnlockRange()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::UnlockRange( ULONG nByteOffset, ULONG nBytes )
+{
+
+ struct flock aflock;
+ aflock.l_type = F_UNLCK;
+ aflock.l_start = nByteOffset;
+ aflock.l_whence = SEEK_SET;
+ aflock.l_len = nBytes;
+
+ if ( ! IsOpen() )
+ return FALSE;
+
+ InternalStreamLock::UnlockFile( nByteOffset, nByteOffset+nBytes, this );
+
+ if ( ! (eStreamMode &
+ (STREAM_SHARE_DENYALL | STREAM_SHARE_DENYREAD | STREAM_SHARE_DENYWRITE)))
+ return TRUE;
+
+ // wenn File Locking ausgeschaltet, siehe SvFileStream::LockRange
+ if ( ! pFileLockEnvVar )
+ return TRUE;
+
+ if (fcntl(pInstanceData->nHandle, F_SETLK, &aflock) != -1)
+ return TRUE;
+
+#if ( defined HPUX && defined BAD_UNION )
+#ifdef DBG_UTIL
+ fprintf( stderr, "***** FCNTL(unlock):errno = %d\n", errno );
+#endif
+ if ( errno == EINVAL || errno == ENOSYS )
+ return TRUE;
+#endif
+#if ( defined SINIX )
+ if (errno == EINVAL)
+ return TRUE;
+#endif
+
+ SetError( ::GetSvError( errno ));
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::LockFile()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::LockFile()
+{
+ return LockRange( 0UL, 0UL );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::UnlockFile()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::UnlockFile()
+{
+ return UnlockRange( 0UL, 0UL );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::Open()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode )
+{
+ int nAccess, nAccessRW;
+ int nMode;
+ int nHandleTmp;
+ struct stat buf;
+ BOOL bStatValid = FALSE;
+
+ Close();
+ errno = 0;
+ eStreamMode = nOpenMode;
+ eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten
+
+// !!! NoOp: Ansonsten ToAbs() verwendern
+// !!! DirEntry aDirEntry( rFilename );
+// !!! aFilename = aDirEntry.GetFull();
+ aFilename = rFilename;
+#ifndef BOOTSTRAP
+ FSysRedirector::DoRedirect( aFilename );
+#endif
+ ByteString aLocalFilename(aFilename, osl_getThreadTextEncoding());
+
+#ifdef DBG_UTIL
+ ByteString aTraceStr( "SvFileStream::Open(): " );
+ aTraceStr += aLocalFilename;
+ DBG_TRACE( aTraceStr.GetBuffer() );
+#endif
+
+ if ( lstat( aLocalFilename.GetBuffer(), &buf ) == 0 )
+ {
+ bStatValid = TRUE;
+ // SvFileStream soll kein Directory oeffnen
+ if( S_ISDIR( buf.st_mode ) )
+ {
+ SetError( ::GetSvError( EISDIR ) );
+ return;
+ }
+ }
+
+
+ if ( !( nOpenMode & STREAM_WRITE ) )
+ nAccessRW = O_RDONLY;
+ else if ( !( nOpenMode & STREAM_READ ) )
+ nAccessRW = O_WRONLY;
+ else
+ nAccessRW = O_RDWR;
+
+ nAccess = 0;
+ // Fix (MDA, 18.01.95): Bei RD_ONLY nicht mit O_CREAT oeffnen
+ // Wichtig auf Read-Only-Dateisystemen (wie CDROM)
+ if ( (!( nOpenMode & STREAM_NOCREATE )) && ( nAccessRW != O_RDONLY ) )
+ nAccess |= O_CREAT;
+ if ( nOpenMode & STREAM_TRUNC )
+ nAccess |= O_TRUNC;
+
+ nMode = S_IREAD | S_IROTH | S_IRGRP;
+ if ( nOpenMode & STREAM_WRITE)
+ {
+ nMode |= (S_IWRITE | S_IWOTH | S_IWGRP);
+
+ if ( nOpenMode & STREAM_COPY_ON_SYMLINK )
+ {
+ if ( bStatValid && S_ISLNK( buf.st_mode ) < 0 )
+ {
+ char *pBuf = new char[ 1024+1 ];
+ if ( readlink( aLocalFilename.GetBuffer(), pBuf, 1024 ) > 0 )
+ {
+ if ( unlink(aLocalFilename.GetBuffer()) == 0 )
+ {
+#ifdef DBG_UTIL
+ fprintf( stderr,
+ "Copying file on symbolic link (%s).\n",
+ aLocalFilename.GetBuffer() );
+#endif
+ String aTmpString( pBuf, osl_getThreadTextEncoding() );
+ const DirEntry aSourceEntry( aTmpString );
+ const DirEntry aTargetEntry( aFilename );
+ FileCopier aFileCopier( aSourceEntry, aTargetEntry );
+ aFileCopier.Execute();
+ }
+ }
+ delete pBuf;
+ }
+ }
+ }
+
+
+ nHandleTmp = open(aLocalFilename.GetBuffer(),nAccessRW|nAccess, nMode );
+
+ if ( nHandleTmp == -1 )
+ {
+ if ( nAccessRW != O_RDONLY )
+ {
+ // auf Lesen runterschalten
+ nAccessRW = O_RDONLY;
+ nAccess = 0;
+ nMode = S_IREAD | S_IROTH | S_IRGRP;
+ nHandleTmp =open( aLocalFilename.GetBuffer(),
+ nAccessRW|nAccess,
+ nMode );
+ }
+ }
+ if ( nHandleTmp != -1 )
+ {
+ pInstanceData->nHandle = nHandleTmp;
+ bIsOpen = TRUE;
+ if ( nAccessRW != O_RDONLY )
+ bIsWritable = TRUE;
+
+ if ( !LockFile() ) // ganze Datei
+ {
+ close( nHandleTmp );
+ bIsOpen = FALSE;
+ bIsWritable = FALSE;
+ pInstanceData->nHandle = 0;
+ }
+ }
+ else
+ SetError( ::GetSvError( errno ) );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::ReOpen()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::ReOpen()
+{
+ if ( !bIsOpen && aFilename.Len() )
+ Open( aFilename, eStreamMode );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::Close()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::Close()
+{
+ InternalStreamLock::UnlockFile( 0, 0, this );
+
+ if ( IsOpen() )
+ {
+#ifdef DBG_UTIL
+ ByteString aTraceStr( "SvFileStream::Close(): " );
+ aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding());
+ DBG_TRACE( aTraceStr.GetBuffer() );
+#endif
+
+ Flush();
+ close( pInstanceData->nHandle );
+ pInstanceData->nHandle = 0;
+ }
+
+ bIsOpen = FALSE;
+ bIsWritable = FALSE;
+ SvStream::ClearBuffer();
+ SvStream::ClearError();
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::ResetError()
+|*
+|* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::ResetError()
+{
+ SvStream::ClearError();
+}
+
+
+/*************************************************************************
+|*
+|* SvFileStream::SetSize()
+|*
+|* Beschreibung STREAM.SDW;
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::SetSize (ULONG nSize)
+{
+ if ( IsOpen() )
+ {
+ if ( ftruncate ( pInstanceData->nHandle, (off_t) nSize ) == -1 )
+ SetError ( ::GetSvError( errno ));
+ }
+}
+
+
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
new file mode 100644
index 000000000000..3d219a84bfd4
--- /dev/null
+++ b/tools/source/stream/strmwnt.cxx
@@ -0,0 +1,892 @@
+/*************************************************************************
+ *
+ * $RCSfile: strmwnt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/*
+ Todo: StreamMode <-> AllocateMemory
+*/
+
+#include <string.h>
+#include <limits.h>
+
+#include <svwin.h>
+
+#include <debug.hxx>
+#include <fsys.hxx>
+#include <stream.hxx>
+
+// class FileBase
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+using namespace osl;
+
+// -----------------------------------------------------------------------
+
+// --------------
+// - StreamData -
+// --------------
+
+class StreamData
+{
+public:
+ HANDLE hFile;
+
+ StreamData()
+ {
+ hFile = 0;
+ }
+};
+
+// -----------------------------------------------------------------------
+
+static ULONG GetSvError( DWORD nWntError )
+{
+ static struct { DWORD wnt; ULONG sv; } errArr[] =
+ {
+ { ERROR_SUCCESS, SVSTREAM_OK },
+ { ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED },
+ { ERROR_ACCOUNT_DISABLED, SVSTREAM_ACCESS_DENIED },
+ { ERROR_ACCOUNT_EXPIRED, SVSTREAM_ACCESS_DENIED },
+ { ERROR_ACCOUNT_RESTRICTION, SVSTREAM_ACCESS_DENIED },
+ { ERROR_ATOMIC_LOCKS_NOT_SUPPORTED, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_BAD_PATHNAME, SVSTREAM_PATH_NOT_FOUND },
+ // Filename too long
+ { ERROR_BUFFER_OVERFLOW, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_DIRECTORY, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_DRIVE_LOCKED, SVSTREAM_LOCKING_VIOLATION },
+ { ERROR_FILE_NOT_FOUND, SVSTREAM_FILE_NOT_FOUND },
+ { ERROR_FILENAME_EXCED_RANGE, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_INVALID_ACCESS, SVSTREAM_INVALID_ACCESS },
+ { ERROR_INVALID_DRIVE, SVSTREAM_PATH_NOT_FOUND },
+ { ERROR_INVALID_HANDLE, SVSTREAM_INVALID_HANDLE },
+ { ERROR_INVALID_NAME, SVSTREAM_PATH_NOT_FOUND },
+ { ERROR_INVALID_PARAMETER, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_IS_SUBST_PATH, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_IS_SUBST_TARGET, SVSTREAM_INVALID_PARAMETER },
+ { ERROR_LOCK_FAILED, SVSTREAM_LOCKING_VIOLATION },
+ { ERROR_LOCK_VIOLATION, SVSTREAM_LOCKING_VIOLATION },
+ { ERROR_NEGATIVE_SEEK, SVSTREAM_SEEK_ERROR },
+ { ERROR_PATH_NOT_FOUND, SVSTREAM_PATH_NOT_FOUND },
+ { ERROR_READ_FAULT, SVSTREAM_READ_ERROR },
+ { ERROR_SEEK, SVSTREAM_SEEK_ERROR },
+ { ERROR_SEEK_ON_DEVICE, SVSTREAM_SEEK_ERROR },
+ { ERROR_SHARING_BUFFER_EXCEEDED,SVSTREAM_SHARE_BUFF_EXCEEDED },
+ { ERROR_SHARING_PAUSED, SVSTREAM_SHARING_VIOLATION },
+ { ERROR_SHARING_VIOLATION, SVSTREAM_SHARING_VIOLATION },
+ { ERROR_TOO_MANY_OPEN_FILES, SVSTREAM_TOO_MANY_OPEN_FILES },
+ { ERROR_WRITE_FAULT, SVSTREAM_WRITE_ERROR },
+ { ERROR_WRITE_PROTECT, SVSTREAM_ACCESS_DENIED },
+ { ERROR_DISK_FULL, SVSTREAM_DISK_FULL },
+
+ { (DWORD)0xFFFFFFFF, SVSTREAM_GENERALERROR }
+ };
+
+ ULONG nRetVal = SVSTREAM_GENERALERROR; // Standardfehler
+ int i=0;
+ do
+ {
+ if( errArr[i].wnt == nWntError )
+ {
+ nRetVal = errArr[i].sv;
+ break;
+ }
+ i++;
+ } while( errArr[i].wnt != (DWORD)0xFFFFFFFF );
+ return nRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 17.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+SvFileStream::SvFileStream( const String& rFileName, StreamMode nMode )
+{
+ bIsOpen = FALSE;
+ nLockCounter = 0;
+ bIsWritable = FALSE;
+ pInstanceData = new StreamData;
+
+ SetBufferSize( 8192 );
+ // convert URL to SystemPath, if necessary
+ ::rtl::OUString aFileName, aNormPath;
+ if ( FileBase::getNormalizedPathFromFileURL( rFileName, aNormPath ) == FileBase::E_None )
+ FileBase::getSystemPathFromNormalizedPath( aNormPath, aFileName );
+ else
+ aFileName = rFileName;
+ Open( aFileName, nMode );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 22.11.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+SvFileStream::SvFileStream()
+{
+ bIsOpen = FALSE;
+ nLockCounter = 0;
+ bIsWritable = FALSE;
+ pInstanceData = new StreamData;
+
+ SetBufferSize( 8192 );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::~SvFileStream()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 14.06.94
+|* Letzte Aenderung OV 14.06.94
+|*
+*************************************************************************/
+
+SvFileStream::~SvFileStream()
+{
+ Close();
+ if (pInstanceData)
+ delete pInstanceData;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::GetFileHandle()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 14.06.94
+|* Letzte Aenderung OV 14.06.94
+|*
+*************************************************************************/
+
+ULONG SvFileStream::GetFileHandle() const
+{
+ return (ULONG)pInstanceData->hFile;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::IsA()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 14.06.94
+|* Letzte Aenderung OV 14.06.94
+|*
+*************************************************************************/
+
+USHORT SvFileStream::IsA() const
+{
+ return ID_FILESTREAM;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::GetData()
+|*
+|* Beschreibung STREAM.SDW, Prueft nicht Eof; IsEof danach rufbar
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+ULONG SvFileStream::GetData( void* pData, ULONG nSize )
+{
+ DWORD nCount = 0;
+ if( IsOpen() )
+ {
+ BOOL bResult = ReadFile(pInstanceData->hFile,(LPVOID)pData,nSize,&nCount,NULL);
+ if( !bResult )
+ {
+ ULONG nTestError = GetLastError();
+ SetError(::GetSvError( nTestError ) );
+ }
+ }
+ return (DWORD)nCount;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::PutData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+ULONG SvFileStream::PutData( const void* pData, ULONG nSize )
+{
+ DWORD nCount = 0;
+ if( IsOpen() )
+ {
+ if(!WriteFile(pInstanceData->hFile,(LPVOID)pData,nSize,&nCount,NULL))
+ SetError(::GetSvError( GetLastError() ) );
+ }
+ return nCount;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SeekPos()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+ULONG SvFileStream::SeekPos( ULONG nPos )
+{
+ DWORD nNewPos = 0;
+ if( IsOpen() )
+ {
+ if( nPos != STREAM_SEEK_TO_END )
+ // 64-Bit files werden nicht unterstuetzt
+ nNewPos=SetFilePointer(pInstanceData->hFile,nPos,NULL,FILE_BEGIN);
+ else
+ nNewPos=SetFilePointer(pInstanceData->hFile,0L,NULL,FILE_END);
+
+ if( nNewPos == 0xFFFFFFFF )
+ {
+ SetError(::GetSvError( GetLastError() ) );
+ nNewPos = 0L;
+ }
+ }
+ else
+ SetError( SVSTREAM_GENERALERROR );
+ return (ULONG)nNewPos;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::Tell()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+/*
+ULONG SvFileStream::Tell()
+{
+ ULONG nPos = 0L;
+
+ if( IsOpen() )
+ {
+ DWORD nPos;
+ nPos = SetFilePointer(pInstanceData->hFile,0L,NULL,FILE_CURRENT);
+ if( nPos = 0xFFFFFFFF )
+ {
+ SetError( ::GetSvError( GetLastError() ) );
+ nPos = 0L;
+ }
+ }
+ return nPos;
+}
+*/
+
+/*************************************************************************
+|*
+|* SvFileStream::FlushData()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+void SvFileStream::FlushData()
+{
+ if( IsOpen() )
+ {
+ if( !FlushFileBuffers(pInstanceData->hFile) )
+ SetError(::GetSvError(GetLastError()));
+ }
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::LockRange()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+BOOL SvFileStream::LockRange( ULONG nByteOffset, ULONG nBytes )
+{
+ BOOL bRetVal = FALSE;
+ if( IsOpen() )
+ {
+ bRetVal = ::LockFile(pInstanceData->hFile,nByteOffset,0L,nBytes,0L );
+ if( !bRetVal )
+ SetError(::GetSvError(GetLastError()));
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::UnlockRange()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+BOOL SvFileStream::UnlockRange( ULONG nByteOffset, ULONG nBytes )
+{
+ BOOL bRetVal = FALSE;
+ if( IsOpen() )
+ {
+ bRetVal = ::UnlockFile(pInstanceData->hFile,nByteOffset,0L,nBytes,0L );
+ if( !bRetVal )
+ SetError(::GetSvError(GetLastError()));
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::LockFile()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::LockFile()
+{
+ BOOL bRetVal = FALSE;
+ if( !nLockCounter )
+ {
+ if( LockRange( 0L, LONG_MAX ) )
+ {
+ nLockCounter = 1;
+ bRetVal = TRUE;
+ }
+ }
+ else
+ {
+ nLockCounter++;
+ bRetVal = TRUE;
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::UnlockFile()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+BOOL SvFileStream::UnlockFile()
+{
+ BOOL bRetVal = FALSE;
+ if( nLockCounter > 0)
+ {
+ if( nLockCounter == 1)
+ {
+ if( UnlockRange( 0L, LONG_MAX ) )
+ {
+ nLockCounter = 0;
+ bRetVal = TRUE;
+ }
+ }
+ else
+ {
+ nLockCounter--;
+ bRetVal = TRUE;
+ }
+ }
+ return bRetVal;
+}
+
+
+/*************************************************************************
+|*
+|* SvFileStream::Open()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+/*
+ NOCREATE TRUNC NT-Action
+ ----------------------------------------------
+ 0 (Create) 0 OPEN_ALWAYS
+ 0 (Create) 1 CREATE_ALWAYS
+ 1 0 OPEN_EXISTING
+ 1 1 TRUNCATE_EXISTING
+*/
+
+void SvFileStream::Open( const String& rFilename, StreamMode nMode )
+{
+ String aParsedFilename(rFilename);
+
+ SetLastError( ERROR_SUCCESS );
+ Close();
+ SvStream::ClearBuffer();
+
+ eStreamMode = nMode;
+ eStreamMode &= ~STREAM_TRUNC; // beim ReOpen nicht cutten
+
+ // !!! NoOp: Ansonsten ToAbs() verwendern
+ // !!! DirEntry aDirEntry( rFilename );
+ // !!! aFilename = aDirEntry.GetFull();
+ aFilename = aParsedFilename;
+#ifdef BOOTSTRAP
+ ByteString aFileNameA( aFilename, gsl_getSystemTextEncoding());
+#else
+ ByteString aFileNameA( aFilename, osl_getThreadTextEncoding());
+ FSysRedirector::DoRedirect( aFilename );
+#endif
+ SetLastError( ERROR_SUCCESS ); // ggf. durch Redirector geaendert!
+
+ /*
+ #ifdef DBG_UTIL
+ String aTraceStr( "SvFileStream::Open(): " );
+ aTraceStr += aFilename;
+ DBG_TRACE( aTraceStr );
+ #endif
+ */
+
+ DWORD nOpenAction;
+ DWORD nShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
+ DWORD nAccessMode = 0L;
+ UINT nOldErrorMode = SetErrorMode( SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX );
+
+ if( nMode & STREAM_SHARE_DENYREAD)
+ nShareMode &= ~FILE_SHARE_READ;
+
+ if( nMode & STREAM_SHARE_DENYWRITE)
+ nShareMode &= ~FILE_SHARE_WRITE;
+
+ if( nMode & STREAM_SHARE_DENYALL)
+ nShareMode = 0;
+
+ if( (nMode & STREAM_READ) )
+ nAccessMode |= GENERIC_READ;
+ if( (nMode & STREAM_WRITE) )
+ nAccessMode |= GENERIC_WRITE;
+
+ if( nAccessMode == GENERIC_READ ) // ReadOnly ?
+ nMode |= STREAM_NOCREATE; // wenn ja, nicht erzeugen
+
+ // Zuordnung siehe obige Wahrheitstafel
+ if( !(nMode & STREAM_NOCREATE) )
+ {
+ if( nMode & STREAM_TRUNC )
+ nOpenAction = CREATE_ALWAYS;
+ else
+ nOpenAction = OPEN_ALWAYS;
+ }
+ else
+ {
+ if( nMode & STREAM_TRUNC )
+ nOpenAction = TRUNCATE_EXISTING;
+ else
+ nOpenAction = OPEN_EXISTING;
+ }
+
+ pInstanceData->hFile = CreateFile(
+ aFileNameA.GetBuffer(),
+ nAccessMode,
+ nShareMode,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ nOpenAction,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
+ (HANDLE) NULL
+ );
+
+ if( pInstanceData->hFile!=INVALID_HANDLE_VALUE && (
+ // Hat Create Always eine existierende Datei ueberschrieben ?
+ GetLastError() == ERROR_ALREADY_EXISTS ||
+ // Hat Open Always eine neue Datei angelegt ?
+ GetLastError() == ERROR_FILE_NOT_FOUND ))
+ {
+ // wenn ja, dann alles OK
+ if( nOpenAction == OPEN_ALWAYS || nOpenAction == CREATE_ALWAYS )
+ SetLastError( ERROR_SUCCESS );
+ }
+
+ // Bei Fehler pruefen, ob wir lesen duerfen
+ if( (pInstanceData->hFile==INVALID_HANDLE_VALUE) &&
+ (nAccessMode & GENERIC_WRITE))
+ {
+ ULONG nErr = ::GetSvError( GetLastError() );
+ if(nErr==SVSTREAM_ACCESS_DENIED || nErr==SVSTREAM_SHARING_VIOLATION)
+ {
+ nMode &= (~STREAM_WRITE);
+ nAccessMode = GENERIC_READ;
+ // OV, 28.1.97: Win32 setzt die Datei auf 0-Laenge, wenn
+ // die Openaction CREATE_ALWAYS ist!!!!
+ nOpenAction = OPEN_EXISTING;
+ SetLastError( ERROR_SUCCESS );
+ pInstanceData->hFile = CreateFile(
+ aFileNameA.GetBuffer(),
+ GENERIC_READ,
+ nShareMode,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ nOpenAction,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
+ (HANDLE) NULL
+ );
+ if( GetLastError() == ERROR_ALREADY_EXISTS )
+ SetLastError( ERROR_SUCCESS );
+ }
+ }
+
+ if( GetLastError() != ERROR_SUCCESS )
+ {
+ bIsOpen = FALSE;
+ SetError(::GetSvError( GetLastError() ) );
+ }
+ else
+ {
+ bIsOpen = TRUE;
+ // pInstanceData->bIsEof = FALSE;
+ if( nAccessMode & GENERIC_WRITE )
+ bIsWritable = TRUE;
+ }
+ SetErrorMode( nOldErrorMode );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::ReOpen()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::ReOpen()
+{
+ if( !bIsOpen && aFilename.Len() )
+ Open( aFilename, eStreamMode );
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::Close()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+void SvFileStream::Close()
+{
+ if( IsOpen() )
+ {
+ if( nLockCounter )
+ {
+ nLockCounter = 1;
+ UnlockFile();
+ }
+ Flush();
+ CloseHandle( pInstanceData->hFile );
+ }
+ bIsOpen = FALSE;
+ nLockCounter= 0;
+ bIsWritable = FALSE;
+ SvStream::ClearBuffer();
+ SvStream::ClearError();
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::ResetError()
+|*
+|* Beschreibung STREAM.SDW; Setzt Filepointer auf Dateianfang
+|* Ersterstellung OV 15.06.94
+|* Letzte Aenderung OV 15.06.94
+|*
+*************************************************************************/
+
+void SvFileStream::ResetError()
+{
+ SvStream::ClearError();
+}
+
+/*************************************************************************
+|*
+|* SvFileStream::SetSize()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 19.10.95
+|* Letzte Aenderung TPF 15.07.98
+|*
+*************************************************************************/
+
+void SvFileStream::SetSize( ULONG nSize )
+{
+
+ if( IsOpen() )
+ {
+ int bError = FALSE;
+ HANDLE hFile = pInstanceData->hFile;
+ ULONG nOld = SetFilePointer( hFile, 0L, NULL, FILE_CURRENT );
+ if( nOld != 0xffffffff )
+ {
+ if( SetFilePointer(hFile,nSize,NULL,FILE_BEGIN ) != 0xffffffff)
+ {
+ BOOL bSucc = SetEndOfFile( hFile );
+ if( !bSucc )
+ bError = TRUE;
+ }
+ if( SetFilePointer( hFile,nOld,NULL,FILE_BEGIN ) == 0xffffffff)
+ bError = TRUE;
+ }
+ if( bError )
+ SetError(::GetSvError( GetLastError() ) );
+ }
+}
+
+/*************************************************************************
+|*
+|* ImpAlloc()
+|*
+|* Beschreibung Legt SharedMemory an
+|* Ersterstellung OV 28.09.95
+|* Letzte Aenderung OV 28.09.95
+|*
+*************************************************************************/
+
+static BYTE* ImpAlloc( ULONG nSize, HANDLE& rHandle )
+{
+ rHandle = 0;
+ HANDLE aHandle = CreateFileMapping((HANDLE)0xffffffff,
+ (LPSECURITY_ATTRIBUTES)0,PAGE_READWRITE,0,nSize,0);
+ if( !aHandle )
+ return 0;
+ BYTE* pBuf = (BYTE*)MapViewOfFile(aHandle, FILE_MAP_ALL_ACCESS, 0, 0, 0);
+ if( !pBuf )
+ {
+ CloseHandle( aHandle );
+ return 0;
+ }
+ rHandle = aHandle;
+ return pBuf;
+}
+
+/*************************************************************************
+|*
+|* ImpFree()
+|*
+|* Beschreibung Gibt SharedMemory frei
+|* Ersterstellung OV 28.09.95
+|* Letzte Aenderung OV 28.09.95
+|*
+*************************************************************************/
+
+static void ImpFree( BYTE* pBuf, HANDLE aHandle )
+{
+ if( pBuf )
+ {
+ UnmapViewOfFile( pBuf );
+ pBuf = 0;
+ }
+ CloseHandle( aHandle );
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::AllocateMemory()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 28.09.95
+|* Letzte Aenderung OV 28.09.95
+|*
+*************************************************************************/
+
+BOOL SvSharedMemoryStream::AllocateMemory( ULONG nNewSize )
+{
+ HANDLE aWNTHandle;
+ pBuf = ImpAlloc( nNewSize, aWNTHandle );
+ if( !pBuf )
+ return FALSE;
+ aHandle = (void*)aWNTHandle;
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::ReAllocateMemory()
+|*
+|* Beschreibung STREAM.SDW (Bozo-Algorithmus)
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+BOOL SvSharedMemoryStream::ReAllocateMemory( long nDiff )
+{
+ BOOL bRetVal = FALSE;
+ ULONG nNewSize = nSize + nDiff;
+ if( nNewSize )
+ {
+ HANDLE aNewHandle;
+ BYTE* pNewBuf = ImpAlloc( nNewSize, aNewHandle );
+ if( pNewBuf )
+ {
+ bRetVal = TRUE; // Success!
+ if( nNewSize < nSize ) // Verkleinern ?
+ {
+ memcpy( pNewBuf, pBuf, (size_t)nNewSize );
+ if( nPos > nNewSize )
+ nPos = 0L;
+ if( nEndOfData >= nNewSize )
+ nEndOfData = nNewSize-1L;
+ }
+ else
+ memcpy( pNewBuf, pBuf, (size_t)nSize );
+
+ ImpFree( pBuf, (HANDLE)aHandle );
+ pBuf = pNewBuf;
+ nSize = nNewSize;
+ aHandle = (void*)aNewHandle;
+ }
+ }
+ else
+ {
+ FreeMemory();
+ bRetVal = TRUE;
+ pBuf = 0;
+ nSize = 0;
+ nEndOfData = 0;
+ nPos = 0;
+ aHandle = 0;
+ }
+ return bRetVal;
+}
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::FreeMemory()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung CL 05.05.95
+|* Letzte Aenderung CL 05.05.95
+|*
+*************************************************************************/
+
+void SvSharedMemoryStream::FreeMemory()
+{
+ ImpFree( pBuf, (HANDLE)aHandle );
+ aHandle = 0;
+}
+
+
+/*************************************************************************
+|*
+|* SvSharedMemoryStream::SetHandle()
+|*
+|* Beschreibung STREAM.SDW
+|* Ersterstellung OV 05.10.95
+|* Letzte Aenderung OV 05.10.95
+|*
+*************************************************************************/
+
+
+void* SvSharedMemoryStream::SetHandle( void* aNewHandle, ULONG nSize,
+ BOOL bOwnsData, ULONG nEOF )
+{
+ void* pLocalBuf = MapViewOfFile(aNewHandle,FILE_MAP_ALL_ACCESS,0,0,0);
+ if( !pLocalBuf )
+ {
+ SetError( SVSTREAM_OUTOFMEMORY );
+ return 0;
+ }
+ if( aNewHandle == aHandle )
+ {
+ // den aktuellen Handle temporaer auf Null setzen, damit FreeMemory
+ // (wird u.U. von SetBuffer aufgerufen) nicht den Handle schliesst,
+ // sondern nur die View loescht
+ aHandle = 0;
+ }
+ pLocalBuf = SetBuffer( pLocalBuf, nSize, bOwnsData, nEOF );
+ aHandle = aNewHandle;
+ return pLocalBuf;
+}
+
+
diff --git a/tools/source/stream/vcompat.cxx b/tools/source/stream/vcompat.cxx
new file mode 100644
index 000000000000..2e80897db707
--- /dev/null
+++ b/tools/source/stream/vcompat.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: vcompat.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _VCOMPAT_CXX
+
+#ifndef _STREAM_HXX
+#include "stream.hxx"
+#endif
+#ifndef _VCOMPAT_HXX
+#include "vcompat.hxx"
+#endif
+
+// -----------------
+// - VersionCompat -
+// -----------------
+
+VersionCompat::VersionCompat( SvStream& rStm, USHORT nStreamMode, USHORT nVersion ) :
+ mpRWStm ( &rStm ),
+ mnStmMode ( nStreamMode ),
+ mnVersion ( nVersion )
+{
+ if( !mpRWStm->GetError() )
+ {
+ if( STREAM_WRITE == mnStmMode )
+ {
+ *mpRWStm << mnVersion;
+ mnTotalSize = ( mnCompatPos = mpRWStm->Tell() ) + 4UL;
+ mpRWStm->SeekRel( 4L );
+ }
+ else
+ {
+ *mpRWStm >> mnVersion;
+ *mpRWStm >> mnTotalSize;
+ mnCompatPos = mpRWStm->Tell();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+VersionCompat::~VersionCompat()
+{
+ if( STREAM_WRITE == mnStmMode )
+ {
+ const UINT32 nEndPos = mpRWStm->Tell();
+
+ mpRWStm->Seek( mnCompatPos );
+ *mpRWStm << ( nEndPos - mnTotalSize );
+ mpRWStm->Seek( nEndPos );
+ }
+ else
+ {
+ const UINT32 nReadSize = mpRWStm->Tell() - mnCompatPos;
+
+ if( mnTotalSize > nReadSize )
+ mpRWStm->SeekRel( mnTotalSize - nReadSize );
+ }
+}
diff --git a/tools/source/string/makefile.mk b/tools/source/string/makefile.mk
new file mode 100644
index 000000000000..a0005f53cec4
--- /dev/null
+++ b/tools/source/string/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=str
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/tstring.obj \
+ $(SLO)$/tustring.obj \
+ $(SLO)$/charset.obj
+
+.IF "$(UPDATER)"!=""
+OBJFILES= $(OBJ)$/tstring.obj \
+ $(OBJ)$/tustring.obj \
+ $(OBJ)$/charset.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx
new file mode 100644
index 000000000000..9b54b920a2c2
--- /dev/null
+++ b/tools/source/string/strascii.cxx
@@ -0,0 +1,773 @@
+/*************************************************************************
+ *
+ * $RCSfile: strascii.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// =======================================================================
+
+#ifdef DBG_UTIL
+
+static BOOL ImplDbgCheckAsciiStr( const sal_Char* pAsciiStr, xub_StrLen nLen )
+{
+ while ( nLen && *pAsciiStr )
+ {
+ if ( ((unsigned char)*pAsciiStr) > 127 )
+ return FALSE;
+ pAsciiStr++;
+ nLen--;
+ }
+
+ return TRUE;
+}
+
+#endif
+
+// =======================================================================
+
+static void ImplCopyAsciiStr( sal_Unicode* pDest, const sal_Char* pSrc,
+ xub_StrLen nLen )
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pSrc, nLen ),
+ "UniString::CopyAsciiStr() - pAsciiStr include characters > 127" );
+
+ while ( nLen )
+ {
+ *pDest = (unsigned char)*pSrc;
+ pDest++;
+ pSrc++;
+ nLen--;
+ }
+}
+
+// =======================================================================
+
+static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2 )
+{
+ sal_Int32 nRet;
+ while ( ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)((unsigned char)*pStr2))) == 0) &&
+ *pStr2 )
+ {
+ pStr1++;
+ pStr2++;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+ while ( nCount &&
+ ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)((unsigned char)*pStr2))) == 0) &&
+ *pStr2 )
+ {
+ pStr1++;
+ pStr2++;
+ nCount--;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringCompareWithoutZeroAscii( const sal_Unicode* pStr1, const sal_Char* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+ while ( nCount &&
+ ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)((unsigned char)*pStr2))) == 0) )
+ {
+ pStr1++;
+ pStr2++;
+ nCount--;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringICompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2 )
+{
+ sal_Int32 nRet;
+ sal_Unicode c1;
+ sal_Char c2;
+ do
+ {
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+ nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2));
+ if ( nRet != 0 )
+ break;
+
+ pStr1++;
+ pStr2++;
+ }
+ while ( c2 );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringICompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+ sal_Unicode c1;
+ sal_Char c2;
+ do
+ {
+ if ( !nCount )
+ break;
+
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+ nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2));
+ if ( nRet != 0 )
+ break;
+
+ pStr1++;
+ pStr2++;
+ nCount--;
+ }
+ while ( c2 );
+
+ return nRet;
+}
+
+// =======================================================================
+
+UniString UniString::CreateFromAscii( const sal_Char* pAsciiStr )
+{
+ DBG_ASSERT( pAsciiStr, "UniString::CreateFromAscii() - pAsciiStr is NULL" );
+
+ // Stringlaenge ermitteln
+ xub_StrLen nLen = ImplStringLen( pAsciiStr );
+
+ UniString aTempStr;
+ if ( nLen )
+ {
+ if ( nLen > STRING_MAXLEN )
+ nLen = STRING_MAXLEN;
+ ImplCopyAsciiStr( aTempStr.AllocBuffer( nLen ), pAsciiStr, nLen );
+ }
+ return aTempStr;
+}
+
+// -----------------------------------------------------------------------
+
+UniString UniString::CreateFromAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
+{
+ DBG_ASSERT( pAsciiStr, "UniString::CreateFromAscii() - pAsciiStr is NULL" );
+
+ // Stringlaenge ermitteln
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pAsciiStr );
+
+ UniString aTempStr;
+
+ if ( nLen )
+ {
+ if ( nLen > STRING_MAXLEN )
+ nLen = STRING_MAXLEN;
+ ImplCopyAsciiStr( aTempStr.AllocBuffer( nLen ), pAsciiStr, nLen );
+ }
+ return aTempStr;
+}
+
+// -----------------------------------------------------------------------
+
+UniString& UniString::AssignAscii( const sal_Char* pAsciiStr )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( pAsciiStr, "UniString::AssignAscii() - pAsciiStr is NULL" );
+
+ // Stringlaenge ermitteln
+ xub_StrLen nLen = ImplStringLen( pAsciiStr );
+
+ if ( !nLen )
+ {
+ ImplDeleteData( mpData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+ else
+ {
+ // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
+ ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
+ else
+ {
+ // Alte Daten loeschen
+ ImplDeleteData( mpData );
+
+ // Daten initialisieren und String kopieren
+ mpData = ImplAllocData( nLen );
+ ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
+ }
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+UniString& UniString::AssignAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( pAsciiStr, "UniString::AssignAscii() - pAsciiStr is NULL" );
+
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pAsciiStr );
+
+#ifdef DBG_UTIL
+ if ( DbgIsAssert() )
+ {
+ for ( xub_StrLen i = 0; i < nLen; i++ )
+ {
+ if ( !pAsciiStr[i] )
+ {
+ DBG_ERROR( "UniString::AssignAscii() : nLen is wrong" );
+ }
+ }
+ }
+#endif
+
+ if ( !nLen )
+ {
+ ImplDeleteData( mpData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+ else
+ {
+ // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
+ ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
+ else
+ {
+ // Alte Daten loeschen
+ ImplDeleteData( mpData );
+
+ // Daten initialisieren und String kopieren
+ mpData = ImplAllocData( nLen );
+ ImplCopyAsciiStr( mpData->maStr, pAsciiStr, nLen );
+ }
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+UniString& UniString::AppendAscii( const sal_Char* pAsciiStr )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( pAsciiStr, "UniString::AppendAscii() - pAsciiStr is NULL" );
+
+ // Stringlaenge ermitteln
+ xub_StrLen nCopyLen = ImplStringLen( pAsciiStr );
+
+ // Ueberlauf abfangen
+ nCopyLen = ImplGetCopyLen( mpData->mnLen, nCopyLen );
+
+ // Ist es kein leerer String
+ if ( nCopyLen )
+ {
+ // Neue Datenstruktur und neuen String erzeugen
+ UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, mpData->mnLen*sizeof( sal_Unicode ) );
+ ImplCopyAsciiStr( pNewData->maStr+mpData->mnLen, pAsciiStr, nCopyLen );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+UniString& UniString::AppendAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( pAsciiStr, "UniString::AppendAscii() - pAsciiStr is NULL" );
+
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pAsciiStr );
+
+#ifdef DBG_UTIL
+ if ( DbgIsAssert() )
+ {
+ for ( xub_StrLen i = 0; i < nLen; i++ )
+ {
+ if ( !pAsciiStr[i] )
+ {
+ DBG_ERROR( "UniString::AppendAscii() : nLen is wrong" );
+ }
+ }
+ }
+#endif
+
+ // Ueberlauf abfangen
+ xub_StrLen nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen );
+
+ // Ist es kein leerer String
+ if ( nCopyLen )
+ {
+ // Neue Datenstruktur und neuen String erzeugen
+ UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, mpData->mnLen*sizeof( sal_Unicode ) );
+ ImplCopyAsciiStr( pNewData->maStr+mpData->mnLen, pAsciiStr, nCopyLen );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+UniString& UniString::InsertAscii( const char* pAsciiStr, xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( pAsciiStr, "UniString::InsertAscii() - pAsciiStr is NULL" );
+
+ // Stringlaenge ermitteln
+ xub_StrLen nCopyLen = ImplStringLen( pAsciiStr );
+
+ // Ueberlauf abfangen
+ nCopyLen = ImplGetCopyLen( mpData->mnLen, nCopyLen );
+
+ // Ist der einzufuegende String ein Leerstring
+ if ( !nCopyLen )
+ return *this;
+
+ // Index groesser als Laenge
+ if ( nIndex > mpData->mnLen )
+ nIndex = mpData->mnLen;
+
+ // Neue Laenge ermitteln und neuen String anlegen
+ UniStringData* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( sal_Unicode ) );
+ ImplCopyAsciiStr( pNewData->maStr+nIndex, pAsciiStr, nCopyLen );
+ memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex,
+ (mpData->mnLen-nIndex)*sizeof( sal_Unicode ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+UniString& UniString::ReplaceAscii( xub_StrLen nIndex, xub_StrLen nCount,
+ const sal_Char* pAsciiStr, xub_StrLen nStrLen )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( pAsciiStr, "UniString::ReplaceAscii() - pAsciiStr is NULL" );
+
+ // Wenn Index groessergleich Laenge ist, dann ist es ein Append
+ if ( nIndex >= mpData->mnLen )
+ {
+ AppendAscii( pAsciiStr, nStrLen );
+ return *this;
+ }
+
+ // Ist es eine Zuweisung
+ if ( (nIndex == 0) && (nCount >= mpData->mnLen) )
+ {
+ AssignAscii( pAsciiStr, nStrLen );
+ return *this;
+ }
+
+ // Reicht ein Erase
+ if ( nStrLen == STRING_LEN )
+ nStrLen = ImplStringLen( pAsciiStr );
+ if ( !nStrLen )
+ return Erase( nIndex, nCount );
+
+ // nCount darf nicht ueber das Stringende hinnausgehen
+ if ( (ULONG)nIndex+nCount > mpData->mnLen )
+ nCount = mpData->mnLen-nIndex;
+
+ // Reicht eine zeichenweise Zuweisung
+ if ( nCount == nStrLen )
+ {
+ ImplCopyData( this );
+ ImplCopyAsciiStr( mpData->maStr+nIndex, pAsciiStr, nStrLen );
+ return *this;
+ }
+
+ // Ueberlauf abfangen
+ nStrLen = ImplGetCopyLen( mpData->mnLen-nCount, nStrLen );
+
+ // Neue Daten anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount+nStrLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
+ ImplCopyAsciiStr( pNewData->maStr+nIndex, pAsciiStr, nStrLen );
+ memcpy( pNewData->maStr+nIndex+nStrLen, mpData->maStr+nIndex+nCount,
+ (mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr,
+ xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "UniString::CompareToAscii() - pAsciiStr include characters > 127" );
+
+ // String vergleichen
+ sal_Int32 nCompare = ImplStringCompareAscii( mpData->maStr, pAsciiStr, nLen );
+
+ // Rueckgabewert anpassen
+ if ( nCompare == 0 )
+ return COMPARE_EQUAL;
+ else if ( nCompare < 0 )
+ return COMPARE_LESS;
+ else
+ return COMPARE_GREATER;
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare UniString::CompareIgnoreCaseToAscii( const sal_Char* pAsciiStr,
+ xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "UniString::CompareIgnoreCaseToAscii() - pAsciiStr include characters > 127" );
+
+ // String vergleichen
+ sal_Int32 nCompare = ImplStringICompareAscii( mpData->maStr, pAsciiStr, nLen );
+
+ // Rueckgabewert anpassen
+ if ( nCompare == 0 )
+ return COMPARE_EQUAL;
+ else if ( nCompare < 0 )
+ return COMPARE_LESS;
+ else
+ return COMPARE_GREATER;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL UniString::EqualsAscii( const sal_Char* pAsciiStr ) const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "UniString::EqualsAscii() - pAsciiStr include characters > 127" );
+
+ return (ImplStringCompareAscii( mpData->maStr, pAsciiStr ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL UniString::EqualsIgnoreCaseAscii( const sal_Char* pAsciiStr ) const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "UniString::EqualsIgnoreCaseAscii() - pAsciiStr include characters > 127" );
+
+ return (ImplStringICompareAscii( mpData->maStr, pAsciiStr ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL UniString::EqualsAscii( const sal_Char* pAsciiStr,
+ xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "UniString::EqualsAscii() - pAsciiStr include characters > 127" );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (*pAsciiStr == 0);
+
+ return (ImplStringCompareAscii( mpData->maStr+nIndex, pAsciiStr, nLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL UniString::EqualsIgnoreCaseAscii( const sal_Char* pAsciiStr,
+ xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "UniString::EqualsIgnoreCaseAscii() - pAsciiStr include characters > 127" );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (*pAsciiStr == 0);
+
+ return (ImplStringICompareAscii( mpData->maStr+nIndex, pAsciiStr, nLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "UniString::SearchAscii() - pAsciiStr include characters > 127" );
+
+ xub_StrLen nLen = mpData->mnLen;
+ xub_StrLen nStrLen = ImplStringLen( pAsciiStr );
+
+ // Falls die Laenge des uebergebenen Strings 0 ist oder der Index
+ // hinter dem String liegt, dann wurde der String nicht gefunden
+ if ( !nStrLen || (nIndex >= nLen) )
+ return STRING_NOTFOUND;
+
+ const sal_Unicode* pStr = mpData->maStr;
+ pStr += nIndex;
+
+ if ( nStrLen == 1 )
+ {
+ sal_Unicode cSearch = (unsigned char)*pAsciiStr;
+ while ( nIndex < nLen )
+ {
+ if ( *pStr == cSearch )
+ return nIndex;
+ pStr++;
+ nIndex++;
+ }
+ }
+ else
+ {
+ // Nur innerhalb des Strings suchen
+ while ( (ULONG)nIndex+nStrLen <= nLen )
+ {
+ // Stimmt der String ueberein
+ if ( ImplStringCompareWithoutZeroAscii( pStr, pAsciiStr, nStrLen ) == 0 )
+ return nIndex;
+ pStr++;
+ nIndex++;
+ }
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen UniString::SearchAndReplaceAscii( const sal_Char* pAsciiStr, const UniString& rRepStr,
+ xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "UniString::SearchAndReplaceAscii() - pAsciiStr include characters > 127" );
+
+ xub_StrLen nSPos = SearchAscii( pAsciiStr, nIndex );
+ if ( nSPos != STRING_NOTFOUND )
+ Replace( nSPos, ImplStringLen( pAsciiStr ), rRepStr );
+
+ return nSPos;
+}
+
+// -----------------------------------------------------------------------
+
+void UniString::SearchAndReplaceAllAscii( const sal_Char* pAsciiStr, const UniString& rRepStr )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "UniString::SearchAndReplaceAllAscii() - pAsciiStr include characters > 127" );
+
+ xub_StrLen nCharLen = ImplStringLen( pAsciiStr );
+ xub_StrLen nSPos = SearchAscii( pAsciiStr, 0 );
+ while ( nSPos != STRING_NOTFOUND )
+ {
+ Replace( nSPos, nCharLen, rRepStr );
+ nSPos += rRepStr.Len();
+ nSPos = SearchAscii( pAsciiStr, nSPos );
+ }
+}
+
+// =======================================================================
+
+#ifndef ENABLEUNICODE
+
+ByteString ByteString::CreateFromAscii( const sal_Char* pAsciiStr )
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "ByteString::CreateFromAscii() - pAsciiStr include characters > 127" );
+
+ return ByteString( pAsciiStr );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString ByteString::CreateFromAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "ByteString::CreateFromAscii() - pAsciiStr include characters > 127" );
+
+ return ByteString( pAsciiStr, nLen );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString& ByteString::AssignAscii( const sal_Char* pAsciiStr )
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "ByteString::AssignAscii() - pAsciiStr include characters > 127" );
+
+ return Assign( pAsciiStr );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString& ByteString::AssignAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "ByteString::AssignAscii() - pAsciiStr include characters > 127" );
+
+ return Assign( pAsciiStr, nLen );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString& ByteString::AppendAscii( const sal_Char* pAsciiStr, xub_StrLen nLen )
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "ByteString::AppendAscii() - pAsciiStr include characters > 127" );
+
+ return Append( pAsciiStr, nLen );
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare ByteString::CompareToAscii( const sal_Char* pAsciiStr,
+ xub_StrLen nLen ) const
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
+ "ByteString::CompareToAscii() - pAsciiStr include characters > 127" );
+
+ return CompareTo( pAsciiStr, nLen );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ByteString::EqualsAscii( const sal_Char* pAsciiStr ) const
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "ByteString::EqualsAscii() - pAsciiStr include characters > 127" );
+
+ return Equals( pAsciiStr );
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen ByteString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "ByteString::SearchAscii() - pAsciiStr include characters > 127" );
+
+ return Search( pAsciiStr, nIndex );
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen ByteString::SearchAndReplaceAscii( const sal_Char* pAsciiStr, const ByteString& rRepStr,
+ xub_StrLen nIndex )
+{
+ DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
+ "ByteString::SearchAscii() - pAsciiStr include characters > 127" );
+
+ return SearchAndReplace( pAsciiStr, rRepStr, nIndex );
+}
+
+#endif
diff --git a/tools/source/string/strcvt.cxx b/tools/source/string/strcvt.cxx
new file mode 100644
index 000000000000..cd6e84a918c8
--- /dev/null
+++ b/tools/source/string/strcvt.cxx
@@ -0,0 +1,757 @@
+/*************************************************************************
+ *
+ * $RCSfile: strcvt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// =======================================================================
+
+static ByteStringData* ImplGetStringDataFromUniString( const sal_Unicode* pUniStr, sal_Size nUniLen,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_ASSERT( (eTextEncoding != 9) &&
+ (eTextEncoding != RTL_TEXTENCODING_DONTKNOW) &&
+ (eTextEncoding != RTL_TEXTENCODING_UCS2) &&
+ (eTextEncoding != RTL_TEXTENCODING_UCS4),
+ "UniString-->ByteString: Wrong TextEncoding" );
+
+ if ( !nUniLen )
+ {
+ ImplIncRefCount( &aImplEmptyStrData );
+ return &aImplEmptyStrData;
+ }
+
+#ifndef NOOLDSTRING
+ if ( eTextEncoding == CHARSET_SYSTEM )
+ eTextEncoding = GetSystemCharSet();
+#endif
+ nCvtFlags |= RTL_UNICODETOTEXT_FLAGS_FLUSH;
+
+ ByteStringData* pData;
+ rtl_TextEncodingInfo aTextEncInfo;
+ rtl_UnicodeToTextConverter hConverter = rtl_createUnicodeToTextConverter( eTextEncoding );
+ sal_uInt32 nInfo;
+ sal_Size nSrcChars;
+ sal_Size nDestBytes;
+ sal_Size nNewLen;
+
+ // get TextEncodingInfo
+ aTextEncInfo.StructSize = sizeof( aTextEncInfo );
+ rtl_getTextEncodingInfo( eTextEncoding, &aTextEncInfo );
+
+ // Zuerst konvertieren wir mit der wahrscheinlichen Anzahl
+ // der zu konvertierenden Zeichen
+ nNewLen = nUniLen*aTextEncInfo.AverageCharSize;
+ if ( nNewLen > STRING_MAXLEN )
+ nNewLen = STRING_MAXLEN;
+ pData = ImplAllocData( (xub_StrLen)nNewLen );
+ nDestBytes = rtl_convertUnicodeToText( hConverter, 0,
+ pUniStr, nUniLen,
+ (sal_Char*)pData->maStr, nNewLen,
+ nCvtFlags,
+ &nInfo, &nSrcChars );
+ // Solange versuchen zu konvertieren, bis der Buffer ausreicht, oder
+ // die maximale Stringlaenge erreicht ist
+ while ( (nInfo & RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL) &&
+ (nNewLen != STRING_MAXLEN) )
+ {
+ rtl_freeMemory( pData );
+
+ // Dann mit der maximalen Anzahl der Zeichen versuchen
+ // und etwas mehr Overhead geben, falls nicht zu konvertierende
+ // Zeichen durch mehrere Ersatzzeichen ersetzt werden
+ sal_Size nNotConvertedChars = nUniLen-nSrcChars;
+ nNewLen = nDestBytes+(nNotConvertedChars*aTextEncInfo.MaximumCharSize)+
+ nNotConvertedChars+4;
+ if ( nNewLen > STRING_MAXLEN )
+ nNewLen = STRING_MAXLEN;
+ pData = ImplAllocData( (xub_StrLen)nNewLen );
+ nDestBytes = rtl_convertUnicodeToText( hConverter, 0,
+ pUniStr, nUniLen,
+ (sal_Char*)pData->maStr, nNewLen,
+ nCvtFlags,
+ &nInfo, &nSrcChars );
+ }
+
+ // String entsprechend der durch das Konvertieren tatsaechlich
+ // entstehenden Bytes anpassen
+ if ( !nDestBytes )
+ {
+ rtl_freeMemory( pData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ pData = &aImplEmptyStrData;
+ }
+ else if ( nNewLen > nDestBytes+8 )
+ {
+ ByteStringData* pTempData = ImplAllocData( (xub_StrLen)nDestBytes );
+ memcpy( pTempData->maStr, pData->maStr, nDestBytes );
+ rtl_freeMemory( pData );
+ pData = pTempData;
+ }
+ else
+ {
+ pData->mnLen = (xub_StrLen)nDestBytes;
+ pData->maStr[nDestBytes] = '\0';
+ }
+ rtl_destroyUnicodeToTextConverter( hConverter );
+ return pData;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplUpdateStringFromUniString( ByteString* pString,
+ const sal_Unicode* pUniStr, sal_Size nUniLen,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ ByteStringData* pNewStringData;
+ pNewStringData = ImplGetStringDataFromUniString( pUniStr, nUniLen, eTextEncoding, nCvtFlags );
+ ImplDeleteData( pString->mpData );
+ pString->mpData = pNewStringData;
+}
+
+// =======================================================================
+
+#ifndef ENABLEUNICODE
+void ByteString::InitStringRes( const UniString& rUniStr )
+{
+ DBG_CTOR( ByteString, DbgCheckByteString );
+ DBG_CHKOBJ( &rUniStr, UniString, DbgCheckUniString );
+
+ mpData = ImplGetStringDataFromUniString( rUniStr.mpData->maStr, rUniStr.mpData->mnLen,
+ gsl_getSystemTextEncoding(),
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |
+ RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
+ RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE );
+}
+#endif
+
+// =======================================================================
+
+ByteString::ByteString( const UniString& rUniStr, rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( ByteString, DbgCheckByteString );
+ DBG_CHKOBJ( &rUniStr, UniString, DbgCheckUniString );
+
+ mpData = ImplGetStringDataFromUniString( rUniStr.mpData->maStr, rUniStr.mpData->mnLen,
+ eTextEncoding, nCvtFlags );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString::ByteString( const UniString& rUniStr, xub_StrLen nPos, xub_StrLen nLen,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( ByteString, DbgCheckByteString );
+ DBG_CHKOBJ( &rUniStr, UniString, DbgCheckUniString );
+
+ // Stringlaenge ermitteln
+ if ( nPos > rUniStr.mpData->mnLen )
+ nLen = 0;
+ else
+ {
+ // Laenge korrigieren, wenn noetig
+ xub_StrLen nMaxLen = rUniStr.mpData->mnLen-nPos;
+ if ( nLen > nMaxLen )
+ nLen = nMaxLen;
+ }
+
+ mpData = ImplGetStringDataFromUniString( rUniStr.mpData->maStr+nPos, nLen,
+ eTextEncoding, nCvtFlags );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString::ByteString( const sal_Unicode* pUniStr,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( ByteString, DbgCheckByteString );
+ DBG_ASSERT( pUniStr, "ByteString::ByteString() - pUniStr is NULL" );
+
+ mpData = ImplGetStringDataFromUniString( pUniStr, ImplStringLen( pUniStr ),
+ eTextEncoding, nCvtFlags );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString::ByteString( const sal_Unicode* pUniStr, xub_StrLen nLen,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( ByteString, DbgCheckByteString );
+ DBG_ASSERT( pUniStr, "ByteString::ByteString() - pUniStr is NULL" );
+
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pUniStr );
+
+ mpData = ImplGetStringDataFromUniString( pUniStr, nLen,
+ eTextEncoding, nCvtFlags );
+}
+
+// =======================================================================
+
+static sal_uChar aImplByteTab[256] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135,
+ 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 149, 150, 151,
+ 152, 153, 154, 155, 156, 157, 158, 159,
+ 160, 161, 162, 163, 164, 165, 166, 167,
+ 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183,
+ 184, 185, 186, 187, 188, 189, 190, 191,
+ 192, 193, 194, 195, 196, 197, 198, 199,
+ 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 209, 210, 211, 212, 213, 214, 215,
+ 216, 217, 218, 219, 220, 221, 222, 223,
+ 224, 225, 226, 227, 228, 229, 230, 231,
+ 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247,
+ 248, 249, 250, 251, 252, 253, 254, 255
+};
+
+// =======================================================================
+
+struct Impl1ByteUnicodeTabData
+{
+ rtl_TextEncoding meTextEncoding;
+ sal_Unicode maUniTab[256];
+ Impl1ByteUnicodeTabData* mpNext;
+};
+
+// -----------------------------------------------------------------------
+
+struct Impl1ByteConvertTabData
+{
+ rtl_TextEncoding meSrcTextEncoding;
+ rtl_TextEncoding meDestTextEncoding;
+ sal_uChar maConvertTab[256];
+ sal_uChar maRepConvertTab[256];
+ Impl1ByteConvertTabData* mpNext;
+};
+
+// =======================================================================
+
+sal_Unicode* ImplGet1ByteUnicodeTab( rtl_TextEncoding eTextEncoding )
+{
+#ifndef BOOTSTRAP
+ TOOLSINDATA* pToolsData = ImplGetToolsInData();
+#else
+ TOOLSINDATA* pToolsData = 0x0;
+#endif
+ Impl1ByteUnicodeTabData* pTab = pToolsData->mpFirstUniTabData;
+
+ while ( pTab )
+ {
+ if ( pTab->meTextEncoding == eTextEncoding )
+ return pTab->maUniTab;
+ pTab = pTab->mpNext;
+ }
+
+ // get TextEncodingInfo
+ rtl_TextEncodingInfo aTextEncInfo;
+ aTextEncInfo.StructSize = sizeof( aTextEncInfo );
+ rtl_getTextEncodingInfo( eTextEncoding, &aTextEncInfo );
+
+ if ( aTextEncInfo.MaximumCharSize == 1 )
+ {
+ pTab = new Impl1ByteUnicodeTabData;
+ pTab->meTextEncoding = eTextEncoding;
+ pTab->mpNext = pToolsData->mpFirstUniTabData;
+
+ rtl_TextToUnicodeConverter hConverter;
+ sal_uInt32 nInfo;
+ sal_Size nSrcBytes;
+ sal_Size nDestChars;
+ hConverter = rtl_createTextToUnicodeConverter( eTextEncoding );
+ nDestChars = rtl_convertTextToUnicode( hConverter, 0,
+ (const sal_Char*)aImplByteTab, 256,
+ pTab->maUniTab, 256,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT,
+ &nInfo, &nSrcBytes );
+ rtl_destroyTextToUnicodeConverter( hConverter );
+
+ if ( (nSrcBytes != 256) || (nDestChars != 256) )
+ delete pTab;
+ else
+ {
+ pToolsData->mpFirstUniTabData = pTab;
+ return pTab->maUniTab;
+ }
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_uChar* ImplGet1ByteConvertTab( rtl_TextEncoding eSrcTextEncoding,
+ rtl_TextEncoding eDestTextEncoding,
+ BOOL bReplace )
+{
+#ifndef BOOTSTRAP
+ TOOLSINDATA* pToolsData = ImplGetToolsInData();
+#else
+ TOOLSINDATA* pToolsData = 0x0;
+#endif
+ Impl1ByteConvertTabData* pTab = pToolsData->mpFirstConvertTabData;
+
+ while ( pTab )
+ {
+ if ( (pTab->meSrcTextEncoding == eSrcTextEncoding) &&
+ (pTab->meDestTextEncoding == eDestTextEncoding) )
+ {
+ if ( bReplace )
+ return pTab->maRepConvertTab;
+ else
+ return pTab->maConvertTab;
+ }
+ pTab = pTab->mpNext;
+ }
+
+ // get TextEncodingInfo
+ rtl_TextEncodingInfo aTextEncInfo1;
+ aTextEncInfo1.StructSize = sizeof( aTextEncInfo1 );
+ rtl_getTextEncodingInfo( eSrcTextEncoding, &aTextEncInfo1 );
+ rtl_TextEncodingInfo aTextEncInfo2;
+ aTextEncInfo2.StructSize = sizeof( aTextEncInfo2 );
+ rtl_getTextEncodingInfo( eDestTextEncoding, &aTextEncInfo2 );
+
+ if ( (aTextEncInfo1.MaximumCharSize == 1) &&
+ (aTextEncInfo2.MaximumCharSize == 1) )
+ {
+ pTab = new Impl1ByteConvertTabData;
+ pTab->meSrcTextEncoding = eSrcTextEncoding;
+ pTab->meDestTextEncoding = eDestTextEncoding;
+ pTab->mpNext = pToolsData->mpFirstConvertTabData;
+
+ rtl_TextToUnicodeConverter hConverter;
+ rtl_UnicodeToTextConverter hConverter2;
+ sal_uInt32 nInfo;
+ sal_Size nSrcBytes;
+ sal_Size nDestChars;
+ sal_Size nSrcChars;
+ sal_Size nDestBytes;
+ sal_Unicode aTempBuf[256];
+ hConverter = rtl_createTextToUnicodeConverter( eSrcTextEncoding );
+ nDestChars = rtl_convertTextToUnicode( hConverter, 0,
+ (const sal_Char*)aImplByteTab, 256,
+ aTempBuf, 256,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT,
+ &nInfo, &nSrcBytes );
+ rtl_destroyTextToUnicodeConverter( hConverter );
+ if ( (nSrcBytes != 256) || (nDestChars != 256) )
+ delete pTab;
+ else
+ {
+ hConverter2 = rtl_createUnicodeToTextConverter( eDestTextEncoding );
+ nDestBytes = rtl_convertUnicodeToText( hConverter2, 0,
+ aTempBuf, 256,
+ (sal_Char*)pTab->maConvertTab, 256,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT,
+ &nInfo, &nSrcChars );
+ if ( (nDestBytes == 256) || (nSrcChars == 256) )
+ {
+ nDestBytes = rtl_convertUnicodeToText( hConverter2, 0,
+ aTempBuf, 256,
+ (sal_Char*)pTab->maRepConvertTab, 256,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE,
+ &nInfo, &nSrcChars );
+ }
+ rtl_destroyUnicodeToTextConverter( hConverter2 );
+ if ( (nDestBytes != 256) || (nSrcChars != 256) )
+ delete pTab;
+ else
+ {
+ pToolsData->mpFirstConvertTabData = pTab;
+ if ( bReplace )
+ return pTab->maRepConvertTab;
+ else
+ return pTab->maConvertTab;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+// =======================================================================
+
+void ImplDeleteCharTabData()
+{
+#ifndef BOOTSTRAP
+ TOOLSINDATA* pToolsData = ImplGetToolsInData();
+#else
+ TOOLSINDATA* pToolsData = 0x0;
+#endif
+ Impl1ByteUnicodeTabData* pTempUniTab;
+ Impl1ByteUnicodeTabData* pUniTab = pToolsData->mpFirstUniTabData;
+ while ( pUniTab )
+ {
+ pTempUniTab = pUniTab->mpNext;
+ delete pUniTab;
+ pUniTab = pTempUniTab;
+ }
+ pToolsData->mpFirstUniTabData = NULL;
+
+ Impl1ByteConvertTabData* pTempConvertTab;
+ Impl1ByteConvertTabData* pConvertTab = pToolsData->mpFirstConvertTabData;
+ while ( pConvertTab )
+ {
+ pTempConvertTab = pConvertTab->mpNext;
+ delete pConvertTab;
+ pConvertTab = pTempConvertTab;
+ }
+ pToolsData->mpFirstConvertTabData = NULL;
+}
+
+// =======================================================================
+
+static void ImplStringConvert( ByteString* pString,
+ rtl_TextEncoding eSource, rtl_TextEncoding eTarget,
+ BOOL bReplace )
+{
+ sal_uChar* pConvertTab = ImplGet1ByteConvertTab( eSource, eTarget, bReplace );
+ if ( pConvertTab )
+ {
+ char* pStr = pString->mpData->maStr;
+ while ( *pStr )
+ {
+ sal_uChar c = (sal_uChar)*pStr;
+ sal_uChar cConv = pConvertTab[c];
+ if ( c != cConv )
+ {
+ pStr = ImplCopyStringData( pString, pStr );
+ *pStr = (char)cConv;
+ }
+
+ pStr++;
+ }
+ }
+ else
+ {
+ rtl_UnicodeToTextConverter hSrcConverter = rtl_createTextToUnicodeConverter( eSource );
+ sal_uInt32 nInfo;
+ sal_Size nSrcBytes;
+ sal_Size nDestChars;
+ sal_Size nTempLen;
+ sal_Unicode* pTempBuf;
+ nTempLen = pString->mpData->mnLen;
+ pTempBuf = new sal_Unicode[nTempLen];
+ nDestChars = rtl_convertTextToUnicode( hSrcConverter, 0,
+ pString->mpData->maStr, pString->mpData->mnLen,
+ pTempBuf, nTempLen,
+ RTL_TEXTTOUNICODE_FLAGS_FLUSH |
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT,
+ &nInfo, &nSrcBytes );
+ rtl_destroyTextToUnicodeConverter( hSrcConverter );
+ // Hier werten wir bReplace nicht aus, da fuer MultiByte-Textencodings
+ // sowieso keine Ersatzdarstellung moeglich ist. Da sich der String
+ // sowieso in der Laenge aendern kann, nehmen wir auch sonst keine
+ // Ruecksicht darauf, das die Laenge erhalten bleibt.
+ ImplUpdateStringFromUniString( pString, pTempBuf, nDestChars, eTarget,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 |
+ RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
+ RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE );
+ delete pTempBuf;
+ }
+}
+
+// =======================================================================
+
+ByteString& ByteString::Convert( rtl_TextEncoding eSource, rtl_TextEncoding eTarget, BOOL bReplace )
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ // rtl_TextEncoding Dontknow kann nicht konvertiert werden
+ if ( (eSource == RTL_TEXTENCODING_DONTKNOW) || (eTarget == RTL_TEXTENCODING_DONTKNOW) )
+ return *this;
+
+#ifndef NOOLDSTRING
+ if ( eSource == CHARSET_SYSTEM )
+ eSource = GetSystemCharSet();
+ if ( eTarget == CHARSET_SYSTEM )
+ eTarget = GetSystemCharSet();
+#endif
+
+ // Wenn Source und Target gleich sind, muss nicht konvertiert werden
+ if ( eSource == eTarget )
+ return *this;
+
+ // rtl_TextEncoding Symbol nur nach Unicode oder von Unicode wandeln, ansonsten
+ // wollen wir die Zeichencodes beibehalten
+ if ( (eSource == RTL_TEXTENCODING_SYMBOL) &&
+ (eTarget != RTL_TEXTENCODING_UTF7) &&
+ (eTarget != RTL_TEXTENCODING_UTF8) )
+ return *this;
+ if ( (eTarget == RTL_TEXTENCODING_SYMBOL) &&
+ (eSource != RTL_TEXTENCODING_UTF7) &&
+ (eSource != RTL_TEXTENCODING_UTF8) )
+ return *this;
+
+ // Zeichensatz umwandeln
+ ImplStringConvert( this, eSource, eTarget, bReplace );
+
+ return *this;
+}
+
+// =======================================================================
+
+char ByteString::Convert( char c,
+ rtl_TextEncoding eSource, rtl_TextEncoding eTarget,
+ BOOL bReplace )
+{
+ // TextEncoding Dontknow kann nicht konvertiert werden
+ if ( (eSource == RTL_TEXTENCODING_DONTKNOW) || (eTarget == RTL_TEXTENCODING_DONTKNOW) )
+ return '\0';
+
+#ifndef NOOLDSTRING
+ if ( eSource == CHARSET_SYSTEM )
+ eSource = GetSystemCharSet();
+ if ( eTarget == CHARSET_SYSTEM )
+ eTarget = GetSystemCharSet();
+#endif
+
+ // Wenn Source und Target gleich sind, muss nicht konvertiert werden
+ if ( eSource == eTarget )
+ return c;
+
+ // TextEncoding Symbol nur nach Unicode oder von Unicode wandeln, ansonsten
+ // wollen wir die Zeichencodes beibehalten
+ if ( (eSource == RTL_TEXTENCODING_SYMBOL) &&
+ (eTarget != RTL_TEXTENCODING_UTF7) &&
+ (eTarget != RTL_TEXTENCODING_UTF8) )
+ return '\0';
+ if ( (eTarget == RTL_TEXTENCODING_SYMBOL) &&
+ (eSource != RTL_TEXTENCODING_UTF7) &&
+ (eSource != RTL_TEXTENCODING_UTF8) )
+ return '\0';
+
+ sal_uChar* pConvertTab = ImplGet1ByteConvertTab( eSource, eTarget, bReplace );
+ if ( pConvertTab )
+ return (char)pConvertTab[(sal_uChar)c];
+ else
+ return '\0';
+}
+
+// =======================================================================
+
+sal_Unicode ByteString::ConvertToUnicode( char c, rtl_TextEncoding eTextEncoding )
+{
+ sal_Size nLen = 1;
+ return ConvertToUnicode( &c, &nLen, eTextEncoding );
+}
+
+// -----------------------------------------------------------------------
+
+char ByteString::ConvertFromUnicode( sal_Unicode c, rtl_TextEncoding eTextEncoding, BOOL bReplace )
+{
+ sal_Size nLen;
+ char aBuf[30];
+ nLen = ConvertFromUnicode( c, aBuf, sizeof( aBuf ), eTextEncoding, bReplace );
+ if ( nLen == 1 )
+ return aBuf[0];
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Unicode ByteString::ConvertToUnicode( const char* pChar, sal_Size* pLen, rtl_TextEncoding eTextEncoding )
+{
+ // TextEncoding Dontknow wird nicht konvertiert
+ if ( eTextEncoding == RTL_TEXTENCODING_DONTKNOW )
+ return 0;
+#ifndef NOOLDSTRING
+ else if ( eTextEncoding == CHARSET_SYSTEM )
+ eTextEncoding = GetSystemCharSet();
+#endif
+
+ rtl_TextToUnicodeConverter hConverter;
+ sal_uInt32 nInfo;
+ sal_Size nSrcBytes;
+ sal_Size nDestChars;
+ sal_Unicode nConvChar;
+ hConverter = rtl_createTextToUnicodeConverter( eTextEncoding );
+ nDestChars = rtl_convertTextToUnicode( hConverter, 0,
+ (const sal_Char*)pChar, *pLen,
+ &nConvChar, 1,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_FLUSH,
+ &nInfo, &nSrcBytes );
+ rtl_destroyTextToUnicodeConverter( hConverter );
+
+ if ( nDestChars == 1 )
+ {
+ *pLen = nSrcBytes;
+ return nConvChar;
+ }
+ else
+ {
+ *pLen = 0;
+ return 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Size ByteString::ConvertFromUnicode( sal_Unicode c, char* pBuf, sal_Size nBufLen, rtl_TextEncoding eTextEncoding,
+ BOOL bReplace )
+{
+ // TextEncoding Dontknow wird nicht konvertiert
+ if ( eTextEncoding == RTL_TEXTENCODING_DONTKNOW )
+ return '\0';
+#ifndef NOOLDSTRING
+ else if ( eTextEncoding == CHARSET_SYSTEM )
+ eTextEncoding = GetSystemCharSet();
+#endif
+
+ rtl_UnicodeToTextConverter hConverter;
+ sal_uInt32 nInfo;
+ sal_Size nSrcChars;
+ sal_Size nDestBytes;
+ sal_Unicode cUni = c;
+ sal_uInt32 nFlags = RTL_UNICODETOTEXT_FLAGS_NONSPACING_IGNORE |
+ RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE |
+ RTL_UNICODETOTEXT_FLAGS_FLUSH;
+ if ( bReplace )
+ {
+ nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT;
+ nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE;
+ if ( nBufLen > 1 )
+ nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR;
+ }
+ else
+ {
+ nFlags |= RTL_UNICODETOTEXT_FLAGS_UNDEFINED_0 |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_0;
+ }
+
+ hConverter = rtl_createUnicodeToTextConverter( eTextEncoding );
+ nDestBytes = rtl_convertUnicodeToText( hConverter, 0,
+ &cUni, 1,
+ (sal_Char*)pBuf, nBufLen,
+ nFlags,
+ &nInfo, &nSrcChars );
+ rtl_destroyUnicodeToTextConverter( hConverter );
+ return nDestBytes;
+}
+
+// =======================================================================
+
+ByteString::ByteString( const NAMESPACE_RTL(OString)& rStr )
+{
+ DBG_CTOR( ByteString, DbgCheckByteString );
+
+ mpData = (ByteStringData*)rStr.pData;
+ ImplIncRefCount( mpData );
+}
+
+// -----------------------------------------------------------------------
+
+NAMESPACE_RTL(OString)::OString( const ByteString& rStr )
+{
+ pData = (rtl_String*)rStr.mpData;
+ rtl_string_acquire( pData );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString& ByteString::Assign( const NAMESPACE_RTL(OString)& rStr )
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ rtl_string_acquire( rStr.pData );
+ ImplDeleteData( mpData );
+ mpData = (ByteStringData*)rStr.pData;
+ return *this;
+}
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
new file mode 100644
index 000000000000..0b667f14e6c4
--- /dev/null
+++ b/tools/source/string/strimp.cxx
@@ -0,0 +1,2306 @@
+/*************************************************************************
+ *
+ * $RCSfile: strimp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// =======================================================================
+
+// Daten des Strings fuer einen NULL-String
+static STRINGDATA aImplEmptyStrData = { 1, 0, 0 };
+
+// =======================================================================
+
+static sal_Int32 ImplStringCompare( const STRCODE* pStr1, const STRCODE* pStr2 )
+{
+ sal_Int32 nRet;
+#if STRCODE == sal_Unicode
+ while ( ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)*pStr2)) == 0) &&
+ *pStr2 )
+#else
+ while ( ((nRet = ((sal_Int32)((unsigned STRCODE)*pStr1))-((sal_Int32)((unsigned STRCODE)*pStr2))) == 0) &&
+ *pStr2 )
+#endif
+ {
+ pStr1++;
+ pStr2++;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringCompare( const STRCODE* pStr1, const STRCODE* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+#if STRCODE == sal_Unicode
+ while ( nCount &&
+ ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)*pStr2)) == 0) &&
+ *pStr2 )
+#else
+ while ( nCount &&
+ ((nRet = ((sal_Int32)((unsigned STRCODE)*pStr1))-((sal_Int32)((unsigned STRCODE)*pStr2))) == 0) &&
+ *pStr2 )
+#endif
+ {
+ pStr1++;
+ pStr2++;
+ nCount--;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringCompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+#if STRCODE == sal_Unicode
+ while ( nCount &&
+ ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)*pStr2)) == 0) )
+#else
+ while ( nCount &&
+ ((nRet = ((sal_Int32)((unsigned STRCODE)*pStr1))-((sal_Int32)((unsigned STRCODE)*pStr2))) == 0) )
+#endif
+ {
+ pStr1++;
+ pStr2++;
+ nCount--;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2 )
+{
+ sal_Int32 nRet;
+ STRCODE c1;
+ STRCODE c2;
+ do
+ {
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+#if STRCODE == sal_Unicode
+ nRet = ((sal_Int32)c1)-((sal_Int32)c2);
+#else
+ nRet = ((sal_Int32)((unsigned STRCODE)c1))-((sal_Int32)((unsigned STRCODE)c2));
+#endif
+ if ( nRet != 0 )
+ break;
+
+ pStr1++;
+ pStr2++;
+ }
+ while ( c2 );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+ STRCODE c1;
+ STRCODE c2;
+ do
+ {
+ if ( !nCount )
+ break;
+
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+#if STRCODE == sal_Unicode
+ nRet = ((sal_Int32)c1)-((sal_Int32)c2);
+#else
+ nRet = ((sal_Int32)((unsigned STRCODE)c1))-((sal_Int32)((unsigned STRCODE)c2));
+#endif
+ if ( nRet != 0 )
+ break;
+
+ pStr1++;
+ pStr2++;
+ nCount--;
+ }
+ while ( c2 );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringICompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+ STRCODE c1;
+ STRCODE c2;
+ do
+ {
+ if ( !nCount )
+ break;
+
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+#if STRCODE == sal_Unicode
+ nRet = ((sal_Int32)c1)-((sal_Int32)c2);
+#else
+ nRet = ((sal_Int32)((unsigned STRCODE)c1))-((sal_Int32)((unsigned STRCODE)c2));
+#endif
+
+ pStr1++;
+ pStr2++;
+ nCount--;
+ }
+ while ( nRet == 0 );
+
+ return nRet;
+}
+
+// =======================================================================
+
+#ifdef DBG_UTIL
+const char* DBGCHECKSTRING( const void* pString )
+{
+ STRING* p = (STRING*)pString;
+
+ if ( p->mpData->maStr[p->mpData->mnLen] != 0 )
+ return "String damaged: aStr[nLen] != 0";
+
+ return NULL;
+}
+#endif
+
+// =======================================================================
+
+static STRINGDATA* ImplAllocData( xub_StrLen nLen )
+{
+ // Dann kopiere die Daten
+ STRINGDATA* pData = (STRINGDATA*)rtl_allocateMemory( sizeof(STRINGDATA)+(nLen*sizeof( STRCODE )) );
+ pData->mnRefCount = 1;
+ pData->mnLen = nLen;
+ pData->maStr[nLen] = 0;
+ return pData;
+}
+
+// -----------------------------------------------------------------------
+
+static void _ImplDeleteData( STRINGDATA* pStrData )
+{
+ // alle referenzierten Strings koennen zur gleichen Zeit geloescht
+ // wurden sein, somit muss hier noch geprueft werden, ob ich
+ // der letzte gleichzeitig zerstoerte String bin
+ if ( !osl_decrementInterlockedCount(&pStrData->mnRefCount) )
+ {
+ DBG_ASSERT( aImplEmptyStrData.mnRefCount != 0, "String::ImplIncRefCount() - EmptyStr RefCount == 0" );
+ rtl_freeMemory( pStrData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplDeleteData( STRINGDATA* pStrData )
+{
+ DBG_ASSERT( aImplEmptyStrData.mnRefCount != 0, "String::ImplIncRefCount() - EmptyStr RefCount == 0" );
+
+ // Ist der ReferenzCounter groesser 0
+ if ( pStrData->mnRefCount == 1 )
+ rtl_freeMemory( pStrData );
+ else
+ _ImplDeleteData( pStrData );
+}
+
+// -----------------------------------------------------------------------
+
+static STRINGDATA* _ImplCopyData( STRINGDATA* pData )
+{
+ xub_StrLen nSize = sizeof(STRINGDATA)+(pData->mnLen*sizeof( STRCODE ));
+ STRINGDATA* pNewData = (STRINGDATA*)rtl_allocateMemory( nSize );
+ memcpy( pNewData, pData, nSize );
+ pNewData->mnRefCount = 1;
+ _ImplDeleteData( pData );
+ return pNewData;
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplCopyData( STRING* pString )
+{
+ DBG_ASSERT( (pString->mpData->mnRefCount > 0), "String::ImplCopyData() - RefCount == 0" );
+ DBG_ASSERT( aImplEmptyStrData.mnRefCount != 0, "String::ImplIncRefCount() - EmptyStr RefCount == 0" );
+
+ // ist es ein referenzierter String, dann die Daten abkoppeln
+ if ( pString->mpData->mnRefCount != 1 )
+ pString->mpData = _ImplCopyData( pString->mpData );
+}
+
+// -----------------------------------------------------------------------
+
+static STRCODE* _ImplCopyStringData( STRING* pString, STRCODE* pStr )
+{
+ DBG_ASSERT( (pStr >= pString->mpData->maStr) &&
+ ((pStr-pString->mpData->maStr) < pString->mpData->mnLen),
+ "ImplCopyStringData - pStr from other String-Instanz" );
+
+ unsigned int nIndex = (unsigned int)(pStr-pString->mpData->maStr);
+ pString->mpData = _ImplCopyData( pString->mpData );
+ pStr = pString->mpData->maStr + nIndex;
+ return pStr;
+}
+
+// -----------------------------------------------------------------------
+
+inline STRCODE* ImplCopyStringData( STRING* pString, STRCODE* pStr )
+{
+ // Ist der Referenzzaehler groesser 0
+ if ( pString->mpData->mnRefCount != 1 )
+ pStr = _ImplCopyStringData( pString, pStr );
+ return pStr;
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplIncRefCount( STRINGDATA* pData )
+{
+ osl_incrementInterlockedCount( &pData->mnRefCount );
+}
+
+// -----------------------------------------------------------------------
+
+inline xub_StrLen ImplGetCopyLen( xub_StrLen nStrLen, xub_StrLen nCopyLen )
+{
+ if ( (ULONG)nStrLen+nCopyLen > STRING_MAXLEN )
+ nCopyLen = STRING_MAXLEN-nStrLen;
+ return nCopyLen;
+}
+
+// =======================================================================
+
+STRING::STRING()
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+
+ // Leerer String
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+}
+
+// -----------------------------------------------------------------------
+
+STRING::STRING( const STRING& rStr )
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Pointer auf die Daten des uebergebenen Strings setzen und
+ // Referenzzaehler erhoehen
+ ImplIncRefCount( rStr.mpData );
+ mpData = rStr.mpData;
+}
+
+// -----------------------------------------------------------------------
+
+STRING::STRING( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen )
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Stringlaenge ermitteln
+ if ( nPos > rStr.mpData->mnLen )
+ nLen = 0;
+ else
+ {
+ // Laenge korrigieren, wenn noetig
+ xub_StrLen nMaxLen = rStr.mpData->mnLen-nPos;
+ if ( nLen > nMaxLen )
+ nLen = nMaxLen;
+ }
+
+ // Ist es kein leerer String
+ if ( nLen )
+ {
+ // Reicht ein einfaches erhoehen des Referenzcounters
+ if ( (nPos == 0) && (nLen == rStr.mpData->mnLen) )
+ {
+ ImplIncRefCount( rStr.mpData );
+ mpData = rStr.mpData;
+ }
+ else
+ {
+ // Verwaltungsdaten anlegen und String kopieren
+ mpData = ImplAllocData( nLen );
+ memcpy( mpData->maStr, rStr.mpData->maStr+nPos, nLen*sizeof( STRCODE ) );
+ }
+ }
+ else
+ {
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+STRING::STRING( const STRCODE* pCharStr )
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+
+ // Stringlaenge ermitteln
+ // Bei diesem Ctor darf NULL uebergeben werden
+ xub_StrLen nLen;
+ if ( pCharStr )
+ nLen = ImplStringLen( pCharStr );
+ else
+ nLen = 0;
+
+ // Ist es kein leerer String
+ if ( nLen )
+ {
+ if ( nLen > STRING_MAXLEN )
+ nLen = STRING_MAXLEN;
+
+ // Verwaltungsdaten anlegen und String kopieren
+ mpData = ImplAllocData( nLen );
+ memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+ }
+ else
+ {
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+STRING::STRING( const STRCODE* pCharStr, xub_StrLen nLen )
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( pCharStr, "String::String() - pCharStr is NULL" );
+
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pCharStr );
+
+#ifdef DBG_UTIL
+ if ( DbgIsAssert() )
+ {
+ for ( xub_StrLen i = 0; i < nLen; i++ )
+ {
+ if ( !pCharStr[i] )
+ {
+ DBG_ERROR( "String::String() : nLen is wrong" );
+ }
+ }
+ }
+#endif
+
+ // Ist es kein leerer String
+ if ( nLen )
+ {
+ if ( nLen > STRING_MAXLEN )
+ nLen = STRING_MAXLEN;
+
+ // Verwaltungsdaten anlegen und String kopieren
+ mpData = ImplAllocData( nLen );
+ memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+ }
+ else
+ {
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+STRING::STRING( STRCODE c )
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( c, "String::String() - c is 0" );
+
+ // Verwaltungsdaten anlegen und initialisieren
+ mpData = ImplAllocData( 1 );
+ mpData->maStr[0] = c;
+}
+
+// -----------------------------------------------------------------------
+
+STRING::~STRING()
+{
+ DBG_DTOR( STRING, DBGCHECKSTRING );
+
+ // Daten loeschen
+ ImplDeleteData( mpData );
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Assign( const STRING& rStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ ImplIncRefCount( rStr.mpData );
+ ImplDeleteData( mpData );
+ mpData = rStr.mpData;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Assign( const STRCODE* pCharStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( pCharStr, "String::Assign() - pCharStr is NULL" );
+
+ // Stringlaenge ermitteln
+#ifdef NOOLDSTRING
+ xub_StrLen nLen = ImplStringLen( pCharStr );
+#else
+ xub_StrLen nLen;
+ if ( pCharStr )
+ nLen = ImplStringLen( pCharStr );
+ else
+ nLen = 0;
+#endif
+
+ if ( !nLen )
+ {
+ ImplDeleteData( mpData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+ else
+ {
+ // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
+ memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+ else
+ {
+ // Alte Daten loeschen
+ ImplDeleteData( mpData );
+
+ // Daten initialisieren und String kopieren
+ mpData = ImplAllocData( nLen );
+ memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+ }
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Assign( const STRCODE* pCharStr, xub_StrLen nLen )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( pCharStr, "String::Assign() - pCharStr is NULL" );
+
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pCharStr );
+
+#ifdef DBG_UTIL
+ if ( DbgIsAssert() )
+ {
+ for ( xub_StrLen i = 0; i < nLen; i++ )
+ {
+ if ( !pCharStr[i] )
+ {
+ DBG_ERROR( "String::Assign() : nLen is wrong" );
+ }
+ }
+ }
+#endif
+
+ if ( !nLen )
+ {
+ ImplDeleteData( mpData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+ else
+ {
+ // Wenn String genauso lang ist, wie der String, dann direkt kopieren
+ if ( (nLen == mpData->mnLen) && (mpData->mnRefCount == 1) )
+ memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+ else
+ {
+ // Alte Daten loeschen
+ ImplDeleteData( mpData );
+
+ // Daten initialisieren und String kopieren
+ mpData = ImplAllocData( nLen );
+ memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+ }
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Assign( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( c, "String::Assign() - c is 0" );
+
+ // Verwaltungsdaten anlegen und initialisieren
+ ImplDeleteData( mpData );
+ mpData = ImplAllocData( 1 );
+ mpData->maStr[0] = c;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Append( const STRING& rStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Wenn String leer, dann reicht eine Zuweisung
+ xub_StrLen nLen = mpData->mnLen;
+ if ( !nLen )
+ {
+ ImplIncRefCount( rStr.mpData );
+ ImplDeleteData( mpData );
+ mpData = rStr.mpData;
+ }
+ else
+ {
+ // Ueberlauf abfangen
+ xub_StrLen nCopyLen = ImplGetCopyLen( nLen, rStr.mpData->mnLen );
+
+ // Ist der uebergebene String kein Leerstring
+ if ( nCopyLen )
+ {
+ // Neue Datenstruktur und neuen String erzeugen
+ STRINGDATA* pNewData = ImplAllocData( nLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nLen, rStr.mpData->maStr, nCopyLen*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Append( const STRCODE* pCharStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( pCharStr, "String::Append() - pCharStr is NULL" );
+
+ // Stringlaenge ermitteln
+ xub_StrLen nLen = mpData->mnLen;
+#ifdef NOOLDSTRING
+ xub_StrLen nCopyLen = ImplStringLen( pCharStr );
+#else
+ xub_StrLen nCopyLen;
+ if ( pCharStr )
+ nCopyLen = ImplStringLen( pCharStr );
+ else
+ nCopyLen = 0;
+#endif
+
+ // Ueberlauf abfangen
+ nCopyLen = ImplGetCopyLen( nLen, nCopyLen );
+
+ // Ist es kein leerer String
+ if ( nCopyLen )
+ {
+ // Neue Datenstruktur und neuen String erzeugen
+ STRINGDATA* pNewData = ImplAllocData( nLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nLen, pCharStr, nCopyLen*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Append( const STRCODE* pCharStr, xub_StrLen nCharLen )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( pCharStr, "String::Append() - pCharStr is NULL" );
+
+ if ( nCharLen == STRING_LEN )
+ nCharLen = ImplStringLen( pCharStr );
+
+#ifdef DBG_UTIL
+ if ( DbgIsAssert() )
+ {
+ for ( xub_StrLen i = 0; i < nCharLen; i++ )
+ {
+ if ( !pCharStr[i] )
+ {
+ DBG_ERROR( "String::Append() : nLen is wrong" );
+ }
+ }
+ }
+#endif
+
+ // Ueberlauf abfangen
+ xub_StrLen nLen = mpData->mnLen;
+ xub_StrLen nCopyLen = ImplGetCopyLen( nLen, nCharLen );
+
+ // Ist es kein leerer String
+ if ( nCopyLen )
+ {
+ // Neue Datenstruktur und neuen String erzeugen
+ STRINGDATA* pNewData = ImplAllocData( nLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nLen, pCharStr, nCopyLen*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Append( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // kein 0-Character und maximale Stringlaenge nicht ueberschreiten
+ xub_StrLen nLen = mpData->mnLen;
+ if ( c && (nLen < STRING_MAXLEN) )
+ {
+ // Neue Datenstruktur und neuen String erzeugen
+ STRINGDATA* pNewData = ImplAllocData( nLen+1 );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+ pNewData->maStr[nLen] = c;
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SetChar( xub_StrLen nIndex, STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( nIndex < mpData->mnLen, "String::SetChar() - nIndex > String.Len()" );
+
+ // Daten kopieren, wenn noetig und Character zuweisen
+ ImplCopyData( this );
+ mpData->maStr[nIndex] = c;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Insert( const STRING& rStr, xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Ueberlauf abfangen
+ xub_StrLen nCopyLen = ImplGetCopyLen( mpData->mnLen, rStr.mpData->mnLen );
+
+ // Ist der einzufuegende String ein Leerstring
+ if ( !nCopyLen )
+ return *this;
+
+ // Index groesser als Laenge
+ if ( nIndex > mpData->mnLen )
+ nIndex = mpData->mnLen;
+
+ // Neue Laenge ermitteln und neuen String anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr, nCopyLen*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex,
+ (mpData->mnLen-nIndex)*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen,
+ xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Stringlaenge ermitteln
+ if ( nPos > rStr.mpData->mnLen )
+ nLen = 0;
+ else
+ {
+ // Laenge korrigieren, wenn noetig
+ xub_StrLen nMaxLen = rStr.mpData->mnLen-nPos;
+ if ( nLen > nMaxLen )
+ nLen = nMaxLen;
+ }
+
+ // Ueberlauf abfangen
+ xub_StrLen nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen );
+
+ // Ist der einzufuegende String ein Leerstring
+ if ( !nCopyLen )
+ return *this;
+
+ // Index groesser als Laenge
+ if ( nIndex > mpData->mnLen )
+ nIndex = mpData->mnLen;
+
+ // Neue Laenge ermitteln und neuen String anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr+nPos, nCopyLen*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex,
+ (mpData->mnLen-nIndex)*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Insert( const STRCODE* pCharStr, xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( pCharStr, "String::Insert() - pCharStr is NULL" );
+
+ // Stringlaenge ermitteln
+ xub_StrLen nCopyLen = ImplStringLen( pCharStr );
+
+ // Ueberlauf abfangen
+ nCopyLen = ImplGetCopyLen( mpData->mnLen, nCopyLen );
+
+ // Ist der einzufuegende String ein Leerstring
+ if ( !nCopyLen )
+ return *this;
+
+ // Index groesser als Laenge
+ if ( nIndex > mpData->mnLen )
+ nIndex = mpData->mnLen;
+
+ // Neue Laenge ermitteln und neuen String anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex, pCharStr, nCopyLen*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex,
+ (mpData->mnLen-nIndex)*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Insert( STRCODE c, xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Ist es kein 0-Character
+ if ( !c || (mpData->mnLen == STRING_MAXLEN) )
+ return *this;
+
+ // Index groesser als Laenge
+ if ( nIndex > mpData->mnLen )
+ nIndex = mpData->mnLen;
+
+ // Neue Laenge ermitteln und neuen String anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+1 );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
+ pNewData->maStr[nIndex] = c;
+ memcpy( pNewData->maStr+nIndex+1, mpData->maStr+nIndex,
+ (mpData->mnLen-nIndex)*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Replace( xub_StrLen nIndex, xub_StrLen nCount, const STRING& rStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Wenn Index groessergleich Laenge ist, dann ist es ein Append
+ if ( nIndex >= mpData->mnLen )
+ {
+ Append( rStr );
+ return *this;
+ }
+
+ // Ist es eine Zuweisung
+ if ( (nIndex == 0) && (nCount >= mpData->mnLen) )
+ {
+ Assign( rStr );
+ return *this;
+ }
+
+ // Reicht ein Erase
+ xub_StrLen nStrLen = rStr.mpData->mnLen;
+ if ( !nStrLen )
+ return Erase( nIndex, nCount );
+
+ // nCount darf nicht ueber das Stringende hinnausgehen
+ if ( (ULONG)nIndex+nCount > mpData->mnLen )
+ nCount = mpData->mnLen-nIndex;
+
+ // Reicht ein Insert
+ if ( !nCount )
+ return Insert( rStr, nIndex );
+
+ // Reicht eine zeichenweise Zuweisung
+ if ( nCount == nStrLen )
+ {
+ ImplCopyData( this );
+ memcpy( mpData->maStr+nIndex, rStr.mpData->maStr, nCount*sizeof( STRCODE ) );
+ return *this;
+ }
+
+ // Ueberlauf abfangen
+ nStrLen = ImplGetCopyLen( mpData->mnLen-nCount, nStrLen );
+
+ // Neue Daten anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount+nStrLen );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr, nStrLen*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex+nStrLen, mpData->maStr+nIndex+nCount,
+ (mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Erase( xub_StrLen nIndex, xub_StrLen nCount )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Ist der Index ausserhalb des Strings oder ist nCount == 0
+ if ( (nIndex > mpData->mnLen) || !nCount )
+ return *this;
+
+ // nCount darf nicht ueber das Stringende hinnausgehen
+ if ( (ULONG)nIndex+nCount > mpData->mnLen )
+ nCount = mpData->mnLen-nIndex;
+
+ // Ist das Ergebnis kein Leerstring
+ if ( mpData->mnLen - nCount )
+ {
+ // Neue Daten anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) );
+ memcpy( pNewData->maStr+nIndex, mpData->maStr+nIndex+nCount,
+ (mpData->mnLen-nIndex-nCount+1)*sizeof( STRCODE ) );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+ else
+ {
+ // Leerer String
+ ImplDeleteData( mpData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Fill( xub_StrLen nCount, STRCODE cFillChar )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ if ( !nCount )
+ return *this;
+
+ // Ist nCount groesser wie der jetzige String, dann verlaengern
+ if ( nCount > mpData->mnLen )
+ {
+ // Auf max. Laenge beschraenken
+ if ( nCount > STRING_MAXLEN )
+ nCount = STRING_MAXLEN;
+
+ // dann neuen String mit der neuen Laenge anlegen
+ STRINGDATA* pNewData = ImplAllocData( nCount );
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+ else
+ ImplCopyData( this );
+
+ STRCODE* pStr = mpData->maStr;
+ do
+ {
+ *pStr = cFillChar;
+ pStr++;
+ nCount--;
+ }
+ while ( nCount );
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Muss der String erweitert werden
+ xub_StrLen nLen = mpData->mnLen;
+ if ( nCount <= nLen )
+ return *this;
+
+ // Neuen String anlegen
+ STRINGDATA* pNewData = ImplAllocData( nCount );
+
+ // Alten String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+
+ // und initialisieren
+ STRCODE* pStr = pNewData->maStr;
+ pStr += nLen;
+ nCount -= nLen;
+ do
+ {
+ *pStr = cExpandChar;
+ pStr++;
+ nCount--;
+ }
+ while ( nCount );
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::EraseLeadingChars( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ if ( mpData->maStr[0] != c )
+ return *this;
+
+ xub_StrLen nStart = 0;
+ while ( mpData->maStr[nStart] == c )
+ nStart++;
+
+ return Erase( 0, nStart );
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::EraseTrailingChars( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nEnd = mpData->mnLen;
+ while ( nEnd && (mpData->maStr[nEnd-1] == c) )
+ nEnd--;
+
+ if ( nEnd != mpData->mnLen )
+ Erase( nEnd );
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::EraseLeadingAndTrailingChars( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nStart = 0;
+ while ( mpData->maStr[nStart] == c )
+ nStart++;
+ if ( nStart )
+ Erase( 0, nStart );
+
+ xub_StrLen nEnd = mpData->mnLen;
+ while ( nEnd && (mpData->maStr[nEnd-1] == c) )
+ nEnd--;
+ if ( nEnd != mpData->mnLen )
+ Erase( nEnd );
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::EraseAllChars( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nCount = 0;
+ xub_StrLen i = 0;
+ while ( i < mpData->mnLen )
+ {
+ if ( mpData->maStr[i] == c )
+ nCount++;
+ i++;
+ }
+
+ if ( nCount )
+ {
+ if ( nCount == mpData->mnLen )
+ {
+ ImplDeleteData( mpData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+ else
+ {
+ // Neuen String anlegen
+ STRINGDATA* pNewData = ImplAllocData( mpData->mnLen-nCount );
+
+ // Alten String kopieren und initialisieren
+ nCount = 0;
+ for( xub_StrLen i = 0; i < mpData->mnLen; i++ )
+ {
+ if ( mpData->maStr[i] != c )
+ {
+ pNewData->maStr[nCount] = mpData->maStr[i];
+ nCount++;
+ }
+ }
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Reverse()
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ if ( !mpData->mnLen )
+ return *this;
+
+ // Daten kopieren, wenn noetig
+ ImplCopyData( this );
+
+ // Reverse
+ STRCODE cTemp;
+ xub_StrLen nCount = mpData->mnLen / 2;
+ for ( xub_StrLen i = 0; i < nCount; i++ )
+ {
+ cTemp = mpData->maStr[i];
+ mpData->maStr[i] = mpData->maStr[mpData->mnLen-i-1];
+ mpData->maStr[mpData->mnLen-i-1] = cTemp;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::ToLowerAscii()
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = mpData->mnLen;
+ STRCODE* pStr = mpData->maStr;
+ while ( nIndex < nLen )
+ {
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ if ( (*pStr >= 65) && (*pStr <= 90) )
+ {
+ // Daten kopieren, wenn noetig
+ pStr = ImplCopyStringData( this, pStr );
+ *pStr += 32;
+ }
+
+ pStr++;
+ nIndex++;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::ToUpperAscii()
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = mpData->mnLen;
+ STRCODE* pStr = mpData->maStr;
+ while ( nIndex < nLen )
+ {
+ // Ist das Zeichen zwischen 'a' und 'z' dann umwandeln
+ if ( (*pStr >= 97) && (*pStr <= 122) )
+ {
+ // Daten kopieren, wenn noetig
+ pStr = ImplCopyStringData( this, pStr );
+ *pStr -= 32;
+ }
+
+ pStr++;
+ nIndex++;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::ConvertLineEnd( LineEnd eLineEnd )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Zeilenumbrueche ermitteln und neue Laenge berechnen
+ BOOL bConvert = FALSE; // Muss konvertiert werden
+ const STRCODE* pStr = mpData->maStr; // damit es schneller geht
+ xub_StrLen nLineEndLen = (eLineEnd == LINEEND_CRLF) ? 2 : 1;
+ xub_StrLen nLen = 0; // Ziel-Laenge
+ xub_StrLen i = 0; // Source-Zaehler
+
+ while ( i < mpData->mnLen )
+ {
+ // Bei \r oder \n gibt es neuen Zeilenumbruch
+ if ( (pStr[i] == _CR) || (pStr[i] == _LF) )
+ {
+ nLen += nLineEndLen;
+
+ // Wenn schon gesetzt, dann brauchen wir keine aufwendige Abfrage
+ if ( !bConvert )
+ {
+ // Muessen wir Konvertieren
+ if ( ((eLineEnd != LINEEND_LF) && (pStr[i] == _LF)) ||
+ ((eLineEnd == LINEEND_CRLF) && (pStr[i+1] != _LF)) ||
+ ((eLineEnd == LINEEND_LF) &&
+ ((pStr[i] == _CR) || (pStr[i+1] == _CR))) ||
+ ((eLineEnd == LINEEND_CR) &&
+ ((pStr[i] == _LF) || (pStr[i+1] == _LF))) )
+ bConvert = TRUE;
+ }
+
+ // \r\n oder \n\r, dann Zeichen ueberspringen
+ if ( ((pStr[i+1] == _CR) || (pStr[i+1] == _LF)) &&
+ (pStr[i] != pStr[i+1]) )
+ i++;
+ }
+ else
+ nLen++;
+ i++;
+
+ // Wenn String zu lang, dann konvertieren wir nicht
+ if ( nLen >= STRING_MAXLEN )
+ return *this;
+ }
+
+ // Zeilenumbrueche konvertieren
+ if ( bConvert )
+ {
+ // Neuen String anlegen
+ STRINGDATA* pNewData = ImplAllocData( nLen );
+ xub_StrLen j = 0;
+ i = 0;
+ while ( i < mpData->mnLen )
+ {
+ // Bei \r oder \n gibt es neuen Zeilenumbruch
+ if ( (pStr[i] == _CR) || (pStr[i] == _LF) )
+ {
+ if ( eLineEnd == LINEEND_CRLF )
+ {
+ pNewData->maStr[j] = _CR;
+ pNewData->maStr[j+1] = _LF;
+ j += 2;
+ }
+ else
+ {
+ if ( eLineEnd == LINEEND_CR )
+ pNewData->maStr[j] = _CR;
+ else
+ pNewData->maStr[j] = _LF;
+ j++;
+ }
+
+ if ( ((pStr[i+1] == _CR) || (pStr[i+1] == _LF)) &&
+ (pStr[i] != pStr[i+1]) )
+ i++;
+ }
+ else
+ {
+ pNewData->maStr[j] = mpData->maStr[i];
+ j++;
+ }
+
+ i++;
+ }
+
+ // Alte Daten loeschen und Neue zuweisen
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare STRING::CompareTo( const STRING& rStr, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Auf Gleichheit der Pointer testen
+ if ( mpData == rStr.mpData )
+ return COMPARE_EQUAL;
+
+ // Maximale Laenge ermitteln
+ if ( mpData->mnLen < nLen )
+ nLen = mpData->mnLen+1;
+ if ( rStr.mpData->mnLen < nLen )
+ nLen = rStr.mpData->mnLen+1;
+
+ // String vergleichen
+ sal_Int32 nCompare = ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen );
+
+ // Rueckgabewert anpassen
+ if ( nCompare == 0 )
+ return COMPARE_EQUAL;
+ else if ( nCompare < 0 )
+ return COMPARE_LESS;
+ else
+ return COMPARE_GREATER;
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare STRING::CompareTo( const STRCODE* pCharStr, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // String vergleichen
+ sal_Int32 nCompare = ImplStringCompare( mpData->maStr, pCharStr, nLen );
+
+ // Rueckgabewert anpassen
+ if ( nCompare == 0 )
+ return COMPARE_EQUAL;
+ else if ( nCompare < 0 )
+ return COMPARE_LESS;
+ else
+ return COMPARE_GREATER;
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr,
+ xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Auf Gleichheit der Pointer testen
+ if ( mpData == rStr.mpData )
+ return COMPARE_EQUAL;
+
+ // Maximale Laenge ermitteln
+ if ( mpData->mnLen < nLen )
+ nLen = mpData->mnLen+1;
+ if ( rStr.mpData->mnLen < nLen )
+ nLen = rStr.mpData->mnLen+1;
+
+ // String vergleichen
+ sal_Int32 nCompare = ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen );
+
+ // Rueckgabewert anpassen
+ if ( nCompare == 0 )
+ return COMPARE_EQUAL;
+ else if ( nCompare < 0 )
+ return COMPARE_LESS;
+ else
+ return COMPARE_GREATER;
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare STRING::CompareIgnoreCaseToAscii( const STRCODE* pCharStr,
+ xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // String vergleichen
+ sal_Int32 nCompare = ImplStringICompare( mpData->maStr, pCharStr, nLen );
+
+ // Rueckgabewert anpassen
+ if ( nCompare == 0 )
+ return COMPARE_EQUAL;
+ else if ( nCompare < 0 )
+ return COMPARE_LESS;
+ else
+ return COMPARE_GREATER;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::Equals( const STRING& rStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Sind die Daten gleich
+ if ( mpData == rStr.mpData )
+ return TRUE;
+
+ // Gleiche Laenge
+ if ( mpData->mnLen != rStr.mpData->mnLen )
+ return FALSE;
+
+ // String vergleichen
+ return (ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::Equals( const STRCODE* pCharStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ return (ImplStringCompare( mpData->maStr, pCharStr ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::EqualsIgnoreCaseAscii( const STRING& rStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Sind die Daten gleich
+ if ( mpData == rStr.mpData )
+ return TRUE;
+
+ // Gleiche Laenge
+ if ( mpData->mnLen != rStr.mpData->mnLen )
+ return FALSE;
+
+ // String vergleichen
+ return (ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ return (ImplStringICompare( mpData->maStr, pCharStr ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::Equals( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (rStr.mpData->mnLen == 0);
+ xub_StrLen nMaxLen = mpData->mnLen-nIndex;
+ if ( nMaxLen < nLen )
+ {
+ if ( rStr.mpData->mnLen != nMaxLen )
+ return FALSE;
+ nLen = nMaxLen;
+ }
+
+ // String vergleichen
+ return (ImplStringCompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::Equals( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (*pCharStr == 0);
+
+ return (ImplStringCompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::EqualsIgnoreCaseAscii( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (rStr.mpData->mnLen == 0);
+ xub_StrLen nMaxLen = mpData->mnLen-nIndex;
+ if ( nMaxLen < nLen )
+ {
+ if ( rStr.mpData->mnLen != nMaxLen )
+ return FALSE;
+ nLen = nMaxLen;
+ }
+
+ // String vergleichen
+ return (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (*pCharStr == 0);
+
+ return (ImplStringICompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::Match( const STRING& rStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Ist dieser String leer
+ if ( !mpData->mnLen )
+ return STRING_MATCH;
+
+ // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
+ const STRCODE* pStr1 = mpData->maStr;
+ const STRCODE* pStr2 = rStr.mpData->maStr;
+ xub_StrLen i = 0;
+ while ( i < mpData->mnLen )
+ {
+ // Stimmt das Zeichen nicht ueberein, dann abbrechen
+ if ( *pStr1 != *pStr2 )
+ return i;
+ pStr1++;
+ pStr2++;
+ i++;
+ }
+
+ return STRING_MATCH;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::Match( const STRCODE* pCharStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Ist dieser String leer
+ if ( !mpData->mnLen )
+ return STRING_MATCH;
+
+ // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen i = 0;
+ while ( i < mpData->mnLen )
+ {
+ // Stimmt das Zeichen nicht ueberein, dann abbrechen
+ if ( *pStr != *pCharStr )
+ return i;
+ pStr++;
+ pCharStr++;
+ i++;
+ }
+
+ return STRING_MATCH;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::Search( STRCODE c, xub_StrLen nIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nLen = mpData->mnLen;
+ const STRCODE* pStr = mpData->maStr;
+ pStr += nIndex;
+ while ( nIndex < nLen )
+ {
+ if ( *pStr == c )
+ return nIndex;
+ pStr++;
+ nIndex++;
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::Search( const STRING& rStr, xub_StrLen nIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ xub_StrLen nLen = mpData->mnLen;
+ xub_StrLen nStrLen = rStr.mpData->mnLen;
+
+ // Falls die Laenge des uebergebenen Strings 0 ist oder der Index
+ // hinter dem String liegt, dann wurde der String nicht gefunden
+ if ( !nStrLen || (nIndex >= nLen) )
+ return STRING_NOTFOUND;
+
+ const STRCODE* pStr1 = mpData->maStr;
+ pStr1 += nIndex;
+
+ if ( nStrLen == 1 )
+ {
+ STRCODE cSearch = rStr.mpData->maStr[0];
+ while ( nIndex < nLen )
+ {
+ if ( *pStr1 == cSearch )
+ return nIndex;
+ pStr1++;
+ nIndex++;
+ }
+ }
+ else
+ {
+ const STRCODE* pStr2 = rStr.mpData->maStr;
+
+ // Nur innerhalb des Strings suchen
+ while ( (ULONG)nIndex+nStrLen <= nLen )
+ {
+ // Stimmt der String ueberein
+ if ( ImplStringCompareWithoutZero( pStr1, pStr2, nStrLen ) == 0 )
+ return nIndex;
+ pStr1++;
+ nIndex++;
+ }
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::Search( const STRCODE* pCharStr, xub_StrLen nIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nLen = mpData->mnLen;
+ xub_StrLen nStrLen = ImplStringLen( pCharStr );
+
+ // Falls die Laenge des uebergebenen Strings 0 ist oder der Index
+ // hinter dem String liegt, dann wurde der String nicht gefunden
+ if ( !nStrLen || (nIndex >= nLen) )
+ return STRING_NOTFOUND;
+
+ const STRCODE* pStr = mpData->maStr;
+ pStr += nIndex;
+
+ if ( nStrLen == 1 )
+ {
+ STRCODE cSearch = *pCharStr;
+ while ( nIndex < nLen )
+ {
+ if ( *pStr == cSearch )
+ return nIndex;
+ pStr++;
+ nIndex++;
+ }
+ }
+ else
+ {
+ // Nur innerhalb des Strings suchen
+ while ( (ULONG)nIndex+nStrLen <= nLen )
+ {
+ // Stimmt der String ueberein
+ if ( ImplStringCompareWithoutZero( pStr, pCharStr, nStrLen ) == 0 )
+ return nIndex;
+ pStr++;
+ nIndex++;
+ }
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchBackward( STRCODE c, xub_StrLen nIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ if ( nIndex > mpData->mnLen )
+ nIndex = (xub_StrLen)mpData->mnLen;
+
+ const STRCODE* pStr = mpData->maStr;
+ pStr += nIndex;
+
+ while ( nIndex )
+ {
+ nIndex--;
+ pStr--;
+ if ( *pStr == c )
+ return nIndex;
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchChar( const STRCODE* pChars, xub_StrLen nIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nLen = mpData->mnLen;
+ const STRCODE* pStr = mpData->maStr;
+ pStr += nIndex;
+ while ( nIndex < nLen )
+ {
+ STRCODE c = *pStr;
+ const STRCODE* pCompStr = pChars;
+ while ( *pCompStr )
+ {
+ if ( *pCompStr == c )
+ return nIndex;
+ pCompStr++;
+ }
+ pStr++;
+ nIndex++;
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchCharBackward( const STRCODE* pChars, xub_StrLen nIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ if ( nIndex > mpData->mnLen )
+ nIndex = (xub_StrLen)mpData->mnLen;
+
+ const STRCODE* pStr = mpData->maStr;
+ pStr += nIndex;
+
+ while ( nIndex )
+ {
+ nIndex--;
+ pStr--;
+
+ STRCODE c =*pStr;
+ const STRCODE* pCompStr = pChars;
+ while ( *pCompStr )
+ {
+ if ( *pCompStr == c )
+ return nIndex;
+ pCompStr++;
+ }
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchAndReplace( STRCODE c, STRCODE cRep, xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nLen = mpData->mnLen;
+ const STRCODE* pStr = mpData->maStr;
+ pStr += nIndex;
+ while ( nIndex < nLen )
+ {
+ if ( *pStr == c )
+ {
+ ImplCopyData( this );
+ mpData->maStr[nIndex] = cRep;
+ return nIndex;
+ }
+ pStr++;
+ nIndex++;
+ }
+
+ return STRING_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchAndReplace( const STRING& rStr, const STRING& rRepStr,
+ xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
+
+ xub_StrLen nSPos = Search( rStr, nIndex );
+ if ( nSPos != STRING_NOTFOUND )
+ Replace( nSPos, rStr.Len(), rRepStr );
+
+ return nSPos;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchAndReplace( const STRCODE* pCharStr, const STRING& rRepStr,
+ xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
+
+ xub_StrLen nSPos = Search( pCharStr, nIndex );
+ if ( nSPos != STRING_NOTFOUND )
+ Replace( nSPos, ImplStringLen( pCharStr ), rRepStr );
+
+ return nSPos;
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SearchAndReplaceAll( STRCODE c, STRCODE cRep )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ xub_StrLen nLen = mpData->mnLen;
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen nIndex = 0;
+ while ( nIndex < nLen )
+ {
+ if ( *pStr == c )
+ {
+ ImplCopyData( this );
+ mpData->maStr[nIndex] = cRep;
+ }
+ pStr++;
+ nIndex++;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SearchAndReplaceAll( const STRCODE* pCharStr, const STRING& rRepStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
+
+ xub_StrLen nCharLen = ImplStringLen( pCharStr );
+ xub_StrLen nSPos = Search( pCharStr, 0 );
+ while ( nSPos != STRING_NOTFOUND )
+ {
+ Replace( nSPos, nCharLen, rRepStr );
+ nSPos += rRepStr.Len();
+ nSPos = Search( pCharStr, nSPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SearchAndReplaceAll( const STRING& rStr, const STRING& rRepStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
+
+ xub_StrLen nSPos = Search( rStr, 0 );
+ while ( nSPos != STRING_NOTFOUND )
+ {
+ Replace( nSPos, rStr.Len(), rRepStr );
+ nSPos += rRepStr.Len();
+ nSPos = Search( rStr, nSPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::GetTokenCount( STRCODE cTok ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Leerer String: TokenCount per Definition 0
+ if ( !mpData->mnLen )
+ return 0;
+
+ xub_StrLen nTokCount = 1;
+ xub_StrLen nLen = mpData->mnLen;
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen nIndex = 0;
+ while ( nIndex < nLen )
+ {
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( *pStr == cTok )
+ nTokCount++;
+ pStr++;
+ nIndex++;
+ }
+
+ return nTokCount;
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SetToken( xub_StrLen nToken, STRCODE cTok, const STRING& rStr,
+ xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen nLen = (xub_StrLen)mpData->mnLen;
+ xub_StrLen nTok = 0;
+ xub_StrLen nFirstChar = nIndex;
+ xub_StrLen i = nFirstChar;
+
+ // Bestimme die Token-Position und Laenge
+ pStr += i;
+ while ( i < nLen )
+ {
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( *pStr == cTok )
+ {
+ nTok++;
+
+ if ( nTok == nToken )
+ nFirstChar = i+1;
+ else
+ {
+ if ( nTok > nToken )
+ break;
+ }
+ }
+
+ pStr++;
+ i++;
+ }
+
+ if ( nTok >= nToken )
+ Replace( nFirstChar, i-nFirstChar, rStr );
+}
+
+// -----------------------------------------------------------------------
+
+STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, xub_StrLen& rIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen nLen = (xub_StrLen)mpData->mnLen;
+ xub_StrLen nTok = 0;
+ xub_StrLen nFirstChar = rIndex;
+ xub_StrLen i = nFirstChar;
+
+ // Bestimme die Token-Position und Laenge
+ pStr += i;
+ while ( i < nLen )
+ {
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( *pStr == cTok )
+ {
+ nTok++;
+
+ if ( nTok == nToken )
+ nFirstChar = i+1;
+ else
+ {
+ if ( nTok > nToken )
+ break;
+ }
+ }
+
+ pStr++;
+ i++;
+ }
+
+ if ( nTok >= nToken )
+ {
+ if ( i < nLen )
+ rIndex = i+1;
+ else
+ rIndex = STRING_NOTFOUND;
+ return Copy( nFirstChar, i-nFirstChar );
+ }
+ else
+ {
+ rIndex = STRING_NOTFOUND;
+ return STRING();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::GetQuotedTokenCount( const STRING& rQuotedPairs, STRCODE cTok ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING );
+ DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedTokenCount() - QuotedString%2 != 0" );
+ DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedTokenCount() - cTok in QuotedString" );
+
+ // Leerer String: TokenCount per Definition 0
+ if ( !mpData->mnLen )
+ return 0;
+
+ xub_StrLen nTokCount = 1;
+ xub_StrLen nLen = mpData->mnLen;
+ xub_StrLen nQuotedLen = rQuotedPairs.Len();
+ STRCODE cQuotedEndChar = 0;
+ const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr;
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen nIndex = 0;
+ while ( nIndex < nLen )
+ {
+ STRCODE c = *pStr;
+ if ( cQuotedEndChar )
+ {
+ // Ende des Quotes erreicht ?
+ if ( c == cQuotedEndChar )
+ cQuotedEndChar = 0;
+ }
+ else
+ {
+ // Ist das Zeichen ein Quote-Anfang-Zeichen ?
+ xub_StrLen nQuoteIndex = 0;
+ while ( nQuoteIndex < nQuotedLen )
+ {
+ if ( pQuotedStr[nQuoteIndex] == c )
+ {
+ cQuotedEndChar = pQuotedStr[nQuoteIndex+1];
+ break;
+ }
+ else
+ nQuoteIndex += 2;
+ }
+
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( c == cTok )
+ nTokCount++;
+ }
+
+ pStr++;
+ nIndex++;
+ }
+
+ return nTokCount;
+}
+
+// -----------------------------------------------------------------------
+
+STRING STRING::GetQuotedToken( xub_StrLen nToken, const STRING& rQuotedPairs,
+ STRCODE cTok, xub_StrLen& rIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING );
+ DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedToken() - QuotedString%2 != 0" );
+ DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedToken() - cTok in QuotedString" );
+
+ const STRCODE* pStr = mpData->maStr;
+ const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr;
+ STRCODE cQuotedEndChar = 0;
+ xub_StrLen nQuotedLen = rQuotedPairs.Len();
+ xub_StrLen nLen = (xub_StrLen)mpData->mnLen;
+ xub_StrLen nTok = 0;
+ xub_StrLen nFirstChar = rIndex;
+ xub_StrLen i = nFirstChar;
+
+ // Bestimme die Token-Position und Laenge
+ pStr += i;
+ while ( i < nLen )
+ {
+ STRCODE c = *pStr;
+ if ( cQuotedEndChar )
+ {
+ // Ende des Quotes erreicht ?
+ if ( c == cQuotedEndChar )
+ cQuotedEndChar = 0;
+ }
+ else
+ {
+ // Ist das Zeichen ein Quote-Anfang-Zeichen ?
+ xub_StrLen nQuoteIndex = 0;
+ while ( nQuoteIndex < nQuotedLen )
+ {
+ if ( pQuotedStr[nQuoteIndex] == c )
+ {
+ cQuotedEndChar = pQuotedStr[nQuoteIndex+1];
+ break;
+ }
+ else
+ nQuoteIndex += 2;
+ }
+
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( c == cTok )
+ {
+ nTok++;
+
+ if ( nTok == nToken )
+ nFirstChar = i+1;
+ else
+ {
+ if ( nTok > nToken )
+ break;
+ }
+ }
+ }
+
+ pStr++;
+ i++;
+ }
+
+ if ( nTok >= nToken )
+ {
+ if ( i < nLen )
+ rIndex = i+1;
+ else
+ rIndex = STRING_NOTFOUND;
+ return Copy( nFirstChar, i-nFirstChar );
+ }
+ else
+ {
+ rIndex = STRING_NOTFOUND;
+ return STRING();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+STRCODE* STRING::GetBufferAccess()
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Daten kopieren, wenn noetig
+ if ( mpData->mnLen )
+ ImplCopyData( this );
+
+ // Pointer auf den String zurueckgeben
+ return mpData->maStr;
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::ReleaseBufferAccess( xub_StrLen nLen )
+{
+ // Hier ohne Funktionstest, da String nicht konsistent
+ DBG_CHKTHIS( STRING, NULL );
+ DBG_ASSERT( mpData->mnRefCount == 1, "String::ReleaseCharStr() called for String with RefCount" );
+
+ if ( nLen > mpData->mnLen )
+ nLen = ImplStringLen( mpData->maStr );
+
+ if ( !nLen )
+ {
+ ImplDeleteData( mpData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ mpData = &aImplEmptyStrData;
+ }
+ // Bei mehr als 8 Zeichen unterschied, kuerzen wir den Buffer
+ else if ( ((ULONG)nLen)+8 < mpData->mnLen )
+ {
+ STRINGDATA* pNewData = ImplAllocData( nLen );
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+ ImplDeleteData( mpData );
+ mpData = pNewData;
+ }
+ else
+ mpData->mnLen = nLen;
+}
+
+// -----------------------------------------------------------------------
+
+STRCODE* STRING::AllocBuffer( xub_StrLen nLen )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Vorhandene Daten loeschen und neue anlegen
+ ImplDeleteData( mpData );
+ if ( nLen )
+ mpData = ImplAllocData( nLen );
+ else
+ mpData = &aImplEmptyStrData;
+
+ // Pointer auf den angelegten Buffer zurueckgeben
+ return mpData->maStr;
+}
+
+// -----------------------------------------------------------------------
+#ifndef NOOLDSTRING
+STRING operator + ( const STRING& rStr1, const STRING& rStr2 )
+{
+ DBG_CHKOBJ( &rStr1, STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr2, STRING, DBGCHECKSTRING );
+ DBG_WARNING( "String::operator+(): Use String::operator+=() for better performence and smaller code" );
+
+ STRING aTmpStr( rStr1 );
+ aTmpStr += rStr2;
+ return aTmpStr;
+}
+
+// -----------------------------------------------------------------------
+
+STRING operator + ( const STRING& rStr, const STRCODE* pCharStr )
+{
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+ DBG_WARNING( "String::operator+(): Use String::operator+=() for better performence and smaller code" );
+
+ STRING aTmpStr( rStr );
+ aTmpStr += pCharStr;
+ return aTmpStr;
+}
+
+// -----------------------------------------------------------------------
+
+STRING operator + ( const STRCODE* pCharStr, const STRING& rStr )
+{
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+ DBG_WARNING( "String::operator+(): - Use String::operator+=() for better performence and smaller code" );
+
+ STRING aTmpStr( pCharStr );
+ aTmpStr += rStr;
+ return aTmpStr;
+}
+#endif
diff --git a/tools/source/string/strucvt.cxx b/tools/source/string/strucvt.cxx
new file mode 100644
index 000000000000..ab7190c662ff
--- /dev/null
+++ b/tools/source/string/strucvt.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * $RCSfile: strucvt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// =======================================================================
+
+static UniStringData* ImplGetUniStringDataFromString( const char* pStr, sal_Size nLen,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_ASSERT( (eTextEncoding != 9) &&
+ (eTextEncoding != RTL_TEXTENCODING_DONTKNOW) &&
+ (eTextEncoding != RTL_TEXTENCODING_UCS2) &&
+ (eTextEncoding != RTL_TEXTENCODING_UCS4),
+ "ByteString-->UniString: Wrong TextEncoding" );
+
+ if ( !nLen )
+ {
+ ImplIncRefCount( &aImplEmptyStrData );
+ return &aImplEmptyStrData;
+ }
+
+#ifndef NOOLDSTRING
+ if ( eTextEncoding == CHARSET_SYSTEM )
+ eTextEncoding = GetSystemCharSet();
+#endif
+ nCvtFlags |= RTL_TEXTTOUNICODE_FLAGS_FLUSH;
+
+ UniStringData* pData;
+ rtl_TextEncodingInfo aTextEncInfo;
+ rtl_TextToUnicodeConverter hConverter = rtl_createTextToUnicodeConverter( eTextEncoding );
+ sal_uInt32 nInfo;
+ sal_Size nSrcBytes;
+ sal_Size nDestChars;
+ sal_Size nNewLen;
+
+ // get TextEncodingInfo
+ aTextEncInfo.StructSize = sizeof( aTextEncInfo );
+ rtl_getTextEncodingInfo( eTextEncoding, &aTextEncInfo );
+
+ // Zuerst konvertieren wir mit der wahrscheinlichen Anzahl
+ // der zu konvertierenden Zeichen
+ nNewLen = nLen/aTextEncInfo.AverageCharSize;
+ if ( nNewLen > STRING_MAXLEN )
+ nNewLen = STRING_MAXLEN;
+ pData = ImplAllocData( (xub_StrLen)nNewLen );
+ nDestChars = rtl_convertTextToUnicode( hConverter, 0,
+ pStr, nLen,
+ pData->maStr, nNewLen,
+ nCvtFlags,
+ &nInfo, &nSrcBytes );
+
+ // Buffer hat nicht gereicht, dann mit maximaler Buffergroesse
+ if ( (nInfo & RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL) &&
+ (nNewLen != STRING_MAXLEN) )
+ {
+ rtl_freeMemory( pData );
+ nNewLen = nLen;
+ if ( nNewLen > STRING_MAXLEN )
+ nNewLen = STRING_MAXLEN;
+ pData = ImplAllocData( (xub_StrLen)nNewLen );
+ nDestChars = rtl_convertTextToUnicode( hConverter, 0,
+ pStr, nLen,
+ pData->maStr, nNewLen,
+ nCvtFlags,
+ &nInfo, &nSrcBytes );
+ }
+
+ // String entsprechend der durch das Konvertieren tatsaechlich
+ // entstehenden Bytes anpassen
+ if ( !nDestChars )
+ {
+ rtl_freeMemory( pData );
+ ImplIncRefCount( &aImplEmptyStrData );
+ pData = &aImplEmptyStrData;
+ }
+ else if ( nNewLen > nDestChars+8 )
+ {
+ UniStringData* pTempData = ImplAllocData( (xub_StrLen)nDestChars );
+ memcpy( pTempData->maStr, pData->maStr, nDestChars*sizeof( sal_Unicode ) );
+ rtl_freeMemory( pData );
+ pData = pTempData;
+ }
+ else
+ {
+ pData->mnLen = (xub_StrLen)nDestChars;
+ pData->maStr[nDestChars] = '\0';
+ }
+ rtl_destroyTextToUnicodeConverter( hConverter );
+ return pData;
+}
+
+// =======================================================================
+
+void UniString::InitStringRes( const char* pUTF8Str, xub_StrLen nLen )
+{
+ DBG_CTOR( UniString, DbgCheckUniString );
+
+ mpData = ImplGetUniStringDataFromString( pUTF8Str, nLen,
+ RTL_TEXTENCODING_UTF8,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
+}
+
+// =======================================================================
+
+UniString::UniString( const ByteString& rByteStr, rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( UniString, DbgCheckUniString );
+ DBG_CHKOBJ( &rByteStr, ByteString, DbgCheckByteString );
+
+ mpData = ImplGetUniStringDataFromString( rByteStr.mpData->maStr, rByteStr.mpData->mnLen,
+ eTextEncoding, nCvtFlags );
+}
+
+// -----------------------------------------------------------------------
+
+UniString::UniString( const ByteString& rByteStr, xub_StrLen nPos, xub_StrLen nLen,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( UniString, DbgCheckUniString );
+ DBG_CHKOBJ( &rByteStr, ByteString, DbgCheckByteString );
+
+ // Stringlaenge ermitteln
+ if ( nPos > rByteStr.mpData->mnLen )
+ nLen = 0;
+ else
+ {
+ // Laenge korrigieren, wenn noetig
+ xub_StrLen nMaxLen = rByteStr.mpData->mnLen-nPos;
+ if ( nLen > nMaxLen )
+ nLen = nMaxLen;
+ }
+
+ mpData = ImplGetUniStringDataFromString( rByteStr.mpData->maStr+nPos, nLen,
+ eTextEncoding, nCvtFlags );
+}
+
+// -----------------------------------------------------------------------
+
+UniString::UniString( const char* pByteStr,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( UniString, DbgCheckUniString );
+ DBG_ASSERT( pByteStr, "UniString::UniString() - pByteStr is NULL" );
+
+ mpData = ImplGetUniStringDataFromString( pByteStr, ImplStringLen( pByteStr ),
+ eTextEncoding, nCvtFlags );
+}
+
+// -----------------------------------------------------------------------
+
+UniString::UniString( const char* pByteStr, xub_StrLen nLen,
+ rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
+{
+ DBG_CTOR( UniString, DbgCheckUniString );
+ DBG_ASSERT( pByteStr, "UniString::UniString() - pByteStr is NULL" );
+
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pByteStr );
+
+ mpData = ImplGetUniStringDataFromString( pByteStr, nLen,
+ eTextEncoding, nCvtFlags );
+}
+
+// =======================================================================
+
+UniString::UniString( const NAMESPACE_RTL(OUString)& rStr )
+{
+ DBG_CTOR( UniString, DbgCheckUniString );
+
+ mpData = (UniStringData*)rStr.pData;
+ ImplIncRefCount( mpData );
+}
+
+// -----------------------------------------------------------------------
+
+NAMESPACE_RTL(OUString)::OUString( const UniString& rStr )
+{
+ pData = (rtl_uString*)rStr.mpData;
+ rtl_uString_acquire( pData );
+}
+
+// -----------------------------------------------------------------------
+
+UniString& UniString::Assign( const NAMESPACE_RTL(OUString)& rStr )
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+
+ rtl_uString_acquire( rStr.pData );
+ ImplDeleteData( mpData );
+ mpData = (UniStringData*)rStr.pData;
+ return *this;
+}
diff --git a/tools/source/string/tstring.cxx b/tools/source/string/tstring.cxx
new file mode 100644
index 000000000000..9e8cda42b736
--- /dev/null
+++ b/tools/source/string/tstring.cxx
@@ -0,0 +1,304 @@
+/*************************************************************************
+ *
+ * $RCSfile: tstring.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _OSL_INTERLCK_H
+#include <osl/interlck.h>
+#endif
+#ifndef _RTL_ALLOC_H
+#include <rtl/alloc.h>
+#endif
+#ifndef _RTL_MEMORY_H
+#include <rtl/memory.h>
+#endif
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+
+#define private public
+#include <string.hxx>
+#undef private
+#include <impstrg.hxx>
+
+// For shared byte convert tables
+#ifndef _TOOLS_TOOLSIN_HXX
+#include <toolsin.hxx>
+#endif
+
+#include <debug.hxx>
+
+// =======================================================================
+
+DBG_NAME( ByteString );
+DBG_NAMEEX( UniString );
+
+// -----------------------------------------------------------------------
+
+#define STRCODE sal_Char
+#define STRING ByteString
+#define STRINGDATA ByteStringData
+#define DBGCHECKSTRING DbgCheckByteString
+
+// -----------------------------------------------------------------------
+
+xub_StrLen ImplStringLen( const sal_Char* pStr )
+{
+ const sal_Char* pTempStr = pStr;
+ while( *pTempStr )
+ pTempStr++;
+ return (xub_StrLen)(pTempStr-pStr);
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen ImplStringLen( const sal_Unicode* pStr )
+{
+ const sal_Unicode* pTempStr = pStr;
+ while( *pTempStr )
+ pTempStr++;
+ return (xub_StrLen)(pTempStr-pStr);
+}
+
+// -----------------------------------------------------------------------
+
+#include <strimp.cxx>
+#include <strcvt.cxx>
+
+#ifndef NOOLDSTRING
+#include <strold.cxx>
+#endif
+
+// -----------------------------------------------------------------------
+
+ByteString ByteString::CreateFromInt32( sal_Int32 n, sal_Int16 nRadix )
+{
+ sal_Char aBuf[RTL_STR_MAX_VALUEOFINT32];
+ return ByteString( aBuf, rtl_str_valueOfInt32( aBuf, n, nRadix ) );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString ByteString::CreateFromInt64( sal_Int64 n, sal_Int16 nRadix )
+{
+ sal_Char aBuf[RTL_STR_MAX_VALUEOFINT64];
+ return ByteString( aBuf, rtl_str_valueOfInt64( aBuf, n, nRadix ) );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString ByteString::CreateFromFloat( float f )
+{
+ sal_Char aBuf[RTL_STR_MAX_VALUEOFFLOAT];
+ return ByteString( aBuf, rtl_str_valueOfFloat( aBuf, f ) );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString ByteString::CreateFromDouble( double d )
+{
+ sal_Char aBuf[RTL_STR_MAX_VALUEOFDOUBLE];
+ return ByteString( aBuf, rtl_str_valueOfDouble( aBuf, d ) );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Int32 ByteString::ToInt32() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ return atoi( mpData->maStr );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Int64 ByteString::ToInt64() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ return atoi( mpData->maStr );
+}
+
+// -----------------------------------------------------------------------
+
+float ByteString::ToFloat() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+double ByteString::ToDouble() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ByteString::IsLowerAscii() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = mpData->mnLen;
+ const sal_Char* pStr = mpData->maStr;
+ while ( nIndex < nLen )
+ {
+ if ( (*pStr >= 65) && (*pStr <= 90) )
+ return FALSE;
+
+ pStr++;
+ nIndex++;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ByteString::IsUpperAscii() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = mpData->mnLen;
+ const sal_Char* pStr = mpData->maStr;
+ while ( nIndex < nLen )
+ {
+ if ( (*pStr >= 97) && (*pStr <= 122) )
+ return FALSE;
+
+ pStr++;
+ nIndex++;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ByteString::IsAlphaAscii() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = mpData->mnLen;
+ const sal_Char* pStr = mpData->maStr;
+ while ( nIndex < nLen )
+ {
+ if ( !(((*pStr >= 97) && (*pStr <= 122)) ||
+ ((*pStr >= 65) && (*pStr <= 90))) )
+ return FALSE;
+
+ pStr++;
+ nIndex++;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ByteString::IsNumericAscii() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = mpData->mnLen;
+ const sal_Char* pStr = mpData->maStr;
+ while ( nIndex < nLen )
+ {
+ if ( !((*pStr >= 48) && (*pStr <= 57)) )
+ return FALSE;
+
+ pStr++;
+ nIndex++;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ByteString::IsAlphaNumericAscii() const
+{
+ DBG_CHKTHIS( ByteString, DbgCheckByteString );
+
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = mpData->mnLen;
+ const sal_Char* pStr = mpData->maStr;
+ while ( nIndex < nLen )
+ {
+ if ( !(((*pStr >= 97) && (*pStr <= 122)) ||
+ ((*pStr >= 65) && (*pStr <= 90)) ||
+ ((*pStr >= 48) && (*pStr <= 57))) )
+ return FALSE;
+
+ pStr++;
+ nIndex++;
+ }
+
+ return TRUE;
+}
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
new file mode 100644
index 000000000000..22c894063441
--- /dev/null
+++ b/tools/source/string/tustring.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * $RCSfile: tustring.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _OSL_INTERLCK_H
+#include <osl/interlck.h>
+#endif
+#ifndef _RTL_ALLOC_H
+#include <rtl/alloc.h>
+#endif
+#ifndef _RTL_MEMORY_H
+#include <rtl/memory.h>
+#endif
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+
+#define private public
+#include <string.hxx>
+#undef private
+#include <impstrg.hxx>
+
+#include <debug.hxx>
+
+// =======================================================================
+
+DBG_NAME( UniString );
+DBG_NAMEEX( ByteString );
+
+// -----------------------------------------------------------------------
+
+#define STRCODE sal_Unicode
+#define STRING UniString
+#define STRINGDATA UniStringData
+#define DBGCHECKSTRING DbgCheckUniString
+
+// -----------------------------------------------------------------------
+
+#include <strimp.cxx>
+#include <strucvt.cxx>
+#include <strascii.cxx>
+
+#ifndef NOOLDSTRING
+#include <struold.cxx>
+#endif
+
+// -----------------------------------------------------------------------
+
+UniString UniString::CreateFromInt32( sal_Int32 n, sal_Int16 nRadix )
+{
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT32];
+ return UniString( aBuf, rtl_ustr_valueOfInt32( aBuf, n, nRadix ) );
+}
+
+// -----------------------------------------------------------------------
+
+UniString UniString::CreateFromInt64( sal_Int64 n, sal_Int16 nRadix )
+{
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFINT64];
+ return UniString( aBuf, rtl_ustr_valueOfInt64( aBuf, n, nRadix ) );
+}
+
+// -----------------------------------------------------------------------
+
+UniString UniString::CreateFromFloat( float f )
+{
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFFLOAT];
+ return UniString( aBuf, rtl_ustr_valueOfFloat( aBuf, f ) );
+}
+
+// -----------------------------------------------------------------------
+
+UniString UniString::CreateFromDouble( double d )
+{
+ sal_Unicode aBuf[RTL_USTR_MAX_VALUEOFDOUBLE];
+ return UniString( aBuf, rtl_ustr_valueOfDouble( aBuf, d ) );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Int32 UniString::ToInt32() const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+
+ return rtl_ustr_toInt32( mpData->maStr, 10 );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Int64 UniString::ToInt64() const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+
+ return rtl_ustr_toInt64( mpData->maStr, 10 );
+}
+
+// -----------------------------------------------------------------------
+
+float UniString::ToFloat() const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+
+ return rtl_ustr_toFloat( mpData->maStr );
+}
+
+// -----------------------------------------------------------------------
+
+double UniString::ToDouble() const
+{
+ DBG_CHKTHIS( UniString, DbgCheckUniString );
+
+ return rtl_ustr_toDouble( mpData->maStr );
+}
+
diff --git a/tools/source/zcodec/makefile.mk b/tools/source/zcodec/makefile.mk
new file mode 100644
index 000000000000..f7f3fcdf21e3
--- /dev/null
+++ b/tools/source/zcodec/makefile.mk
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:10 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=tools
+TARGET=zcodec
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/zcodec.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
new file mode 100644
index 000000000000..86230b275004
--- /dev/null
+++ b/tools/source/zcodec/zcodec.cxx
@@ -0,0 +1,524 @@
+/*************************************************************************
+ *
+ * $RCSfile: zcodec.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STREAM_HXX
+#include "stream.hxx"
+#endif
+#ifndef _ZLIB_H
+#include "zlib/zlib.h"
+#endif
+#ifndef _ZCODEC_HXX
+#include "zcodec.hxx"
+#endif
+#ifndef _RTL_CRC_H_
+#include <rtl/crc.h>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define PZSTREAM ((z_stream*) mpsC_Stream)
+
+/* gzip flag byte */
+#define GZ_ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
+#define GZ_HEAD_CRC 0x02 /* bit 1 set: header CRC present */
+#define GZ_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
+#define GZ_ORIG_NAME 0x08 /* bit 3 set: original file name present */
+#define GZ_COMMENT 0x10 /* bit 4 set: file comment present */
+#define GZ_RESERVED 0xE0 /* bits 5..7: reserved */
+
+static int gz_magic[2] = { 0x1f, 0x8b }; /* gzip magic header */
+
+
+// ----------
+// - ZCodec -
+// ----------
+
+ZCodec::ZCodec( ULONG nInBufSize, ULONG nOutBufSize, ULONG nMemUsage )
+{
+ mnMemUsage = nMemUsage;
+ mnInBufSize = nInBufSize;
+ mnOutBufSize = nOutBufSize;
+ mpsC_Stream = new z_stream;
+}
+
+ZCodec::ZCodec( void )
+{
+ mnMemUsage = MAX_MEM_USAGE;
+ mnInBufSize = DEFAULT_IN_BUFSIZE;
+ mnOutBufSize = DEFAULT_OUT_BUFSIZE;
+ mpsC_Stream = new z_stream;
+}
+
+// ------------------------------------------------------------------------
+
+ZCodec::~ZCodec()
+{
+ delete (z_stream*) mpsC_Stream;
+}
+
+// ------------------------------------------------------------------------
+
+void ZCodec::BeginCompression( ULONG nCompressMethod )
+{
+ mbInit = 0;
+ mbStatus = TRUE;
+ mbFinish = FALSE;
+ mpIStm = mpOStm = NULL;
+ mnInToRead = 0xffffffff;
+ mpInBuf = mpOutBuf = NULL;
+ PZSTREAM->total_out = PZSTREAM->total_in = 0;
+ mnCompressMethod = nCompressMethod;
+ PZSTREAM->zalloc = ( alloc_func )0;
+ PZSTREAM->zfree = ( free_func )0;
+ PZSTREAM->opaque = ( voidpf )0;
+ PZSTREAM->avail_out = PZSTREAM->avail_in = 0;
+}
+
+// ------------------------------------------------------------------------
+
+long ZCodec::EndCompression()
+{
+ long retvalue;
+
+ if ( mbInit != 0 )
+ {
+ if ( mbInit & 2 ) // 1->decompress, 3->compress
+ {
+ do
+ {
+ ImplWriteBack();
+ }
+ while ( deflate( PZSTREAM, Z_FINISH ) != Z_STREAM_END );
+
+ ImplWriteBack();
+
+ retvalue = PZSTREAM->total_in;
+ deflateEnd( PZSTREAM );
+ }
+ else
+ {
+ retvalue = PZSTREAM->total_out;
+ inflateEnd( PZSTREAM );
+ }
+ delete[] mpOutBuf;
+ delete[] mpInBuf;
+ }
+ return ( mbStatus ) ? retvalue : -1;
+}
+
+
+// ------------------------------------------------------------------------
+
+long ZCodec::Compress( SvStream& rIStm, SvStream& rOStm )
+{
+ char err;
+ long nOldTotal_In = PZSTREAM->total_in;
+
+ if ( mbInit == 0 )
+ {
+ mpIStm = &rIStm;
+ mpOStm = &rOStm;
+ ImplInitBuf( FALSE );
+ mpInBuf = new BYTE[ mnInBufSize ];
+ }
+ while (( PZSTREAM->avail_in = mpIStm->Read( PZSTREAM->next_in = mpInBuf, mnInBufSize )) != 0 )
+ {
+ if ( PZSTREAM->avail_out == 0 )
+ ImplWriteBack();
+ err = deflate( PZSTREAM, Z_NO_FLUSH );
+ if ( err < 0 )
+ {
+ mbStatus = FALSE;
+ break;
+ }
+ };
+ return ( mbStatus ) ? PZSTREAM->total_in - nOldTotal_In : -1;
+}
+
+// ------------------------------------------------------------------------
+
+long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm )
+{
+ char err;
+ ULONG nInToRead;
+ long nOldTotal_Out = PZSTREAM->total_out;
+
+ if ( mbFinish )
+ return PZSTREAM->total_out - nOldTotal_Out;
+
+ if ( mbInit == 0 )
+ {
+ mpIStm = &rIStm;
+ mpOStm = &rOStm;
+ ImplInitBuf( TRUE );
+ PZSTREAM->next_out = mpOutBuf = new BYTE[ PZSTREAM->avail_out = mnOutBufSize ];
+ }
+ do
+ {
+ if ( PZSTREAM->avail_out == 0 ) ImplWriteBack();
+ if ( PZSTREAM->avail_in == 0 && mnInToRead )
+ {
+ nInToRead = ( mnInBufSize > mnInToRead ) ? mnInToRead : mnInBufSize;
+ PZSTREAM->avail_in = mpIStm->Read( PZSTREAM->next_in = mpInBuf, nInToRead );
+ mnInToRead -= nInToRead;
+
+ if ( mnCompressMethod & ZCODEC_UPDATE_CRC )
+ mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
+
+ }
+ err = inflate( PZSTREAM, Z_NO_FLUSH );
+ if ( err < 0 )
+ {
+ mbStatus = FALSE;
+ break;
+ }
+
+ }
+ while ( ( err != Z_STREAM_END) && ( PZSTREAM->avail_in || mnInToRead ) );
+ ImplWriteBack();
+
+ if ( err == Z_STREAM_END )
+ mbFinish = TRUE;
+ return ( mbStatus ) ? PZSTREAM->total_out - nOldTotal_Out : -1;
+}
+
+// ------------------------------------------------------------------------
+
+long ZCodec::Write( SvStream& rOStm, const BYTE* pData, ULONG nSize )
+{
+ if ( mbInit == 0 )
+ {
+ mpOStm = &rOStm;
+ ImplInitBuf( FALSE );
+ }
+
+ PZSTREAM->avail_in = nSize;
+ PZSTREAM->next_in = (unsigned char*)pData;
+
+ while ( PZSTREAM->avail_in || ( PZSTREAM->avail_out == 0 ) )
+ {
+ if ( PZSTREAM->avail_out == 0 )
+ ImplWriteBack();
+
+ if ( deflate( PZSTREAM, Z_NO_FLUSH ) < 0 )
+ {
+ mbStatus = FALSE;
+ break;
+ }
+ }
+ return ( mbStatus ) ? nSize : -1;
+}
+
+// ------------------------------------------------------------------------
+
+long ZCodec::Read( SvStream& rIStm, BYTE* pData, ULONG nSize )
+{
+ char err;
+ ULONG nInToRead;
+
+ if ( mbFinish )
+ return 0; // PZSTREAM->total_out;
+
+ mpIStm = &rIStm;
+ if ( mbInit == 0 )
+ {
+ ImplInitBuf( TRUE );
+ }
+ PZSTREAM->avail_out = nSize;
+ PZSTREAM->next_out = pData;
+ do
+ {
+ if ( PZSTREAM->avail_in == 0 && mnInToRead )
+ {
+ nInToRead = (mnInBufSize > mnInToRead) ? mnInToRead : mnInBufSize;
+ PZSTREAM->avail_in = mpIStm->Read (
+ PZSTREAM->next_in = mpInBuf, nInToRead);
+ mnInToRead -= nInToRead;
+
+ if ( mnCompressMethod & ZCODEC_UPDATE_CRC )
+ mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
+
+ }
+ err = inflate( PZSTREAM, Z_NO_FLUSH );
+ if ( err < 0 )
+ {
+ // Accept Z_BUF_ERROR as EAGAIN or EWOULDBLOCK.
+ mbStatus = (err == Z_BUF_ERROR);
+ break;
+ }
+ }
+ while ( (err != Z_STREAM_END) &&
+ (PZSTREAM->avail_out != 0) &&
+ (PZSTREAM->avail_in || mnInToRead) );
+ if ( err == Z_STREAM_END )
+ mbFinish = TRUE;
+
+ return (mbStatus ? nSize - PZSTREAM->avail_out : -1);
+}
+
+// ------------------------------------------------------------------------
+
+#pragma optimize ("",off)
+
+long ZCodec::ReadAsynchron( SvStream& rIStm, BYTE* pData, ULONG nSize )
+{
+ char err;
+ ULONG nInToRead;
+
+ if ( mbFinish )
+ return 0; // PZSTREAM->total_out;
+
+ if ( mbInit == 0 )
+ {
+ mpIStm = &rIStm;
+ ImplInitBuf( TRUE );
+ }
+ PZSTREAM->avail_out = nSize;
+ PZSTREAM->next_out = pData;
+ do
+ {
+ if ( PZSTREAM->avail_in == 0 && mnInToRead )
+ {
+ nInToRead = (mnInBufSize > mnInToRead) ? mnInToRead : mnInBufSize;
+
+ ULONG nStreamPos = rIStm.Tell();
+ rIStm.Seek( STREAM_SEEK_TO_END );
+ ULONG nMaxPos = rIStm.Tell();
+ rIStm.Seek( nStreamPos );
+ if ( ( nMaxPos - nStreamPos ) < nInToRead )
+ {
+ rIStm.SetError( ERRCODE_IO_PENDING );
+ break;
+ }
+
+ PZSTREAM->avail_in = mpIStm->Read (
+ PZSTREAM->next_in = mpInBuf, nInToRead);
+ mnInToRead -= nInToRead;
+
+ if ( mnCompressMethod & ZCODEC_UPDATE_CRC )
+ mnCRC = UpdateCRC( mnCRC, mpInBuf, nInToRead );
+
+ }
+ err = inflate( PZSTREAM, Z_NO_FLUSH );
+ if ( err < 0 )
+ {
+ // Accept Z_BUF_ERROR as EAGAIN or EWOULDBLOCK.
+ mbStatus = (err == Z_BUF_ERROR);
+ break;
+ }
+ }
+ while ( (err != Z_STREAM_END) &&
+ (PZSTREAM->avail_out != 0) &&
+ (PZSTREAM->avail_in || mnInToRead) );
+ if ( err == Z_STREAM_END )
+ mbFinish = TRUE;
+
+ return (mbStatus ? nSize - PZSTREAM->avail_out : -1);
+}
+
+#pragma optimize ("",on)
+
+// ------------------------------------------------------------------------
+
+void ZCodec::ImplWriteBack()
+{
+ ULONG nAvail = mnOutBufSize - PZSTREAM->avail_out;
+
+ if ( nAvail )
+ {
+ if ( mbInit & 2 && ( mnCompressMethod & ZCODEC_UPDATE_CRC ) )
+ mnCRC = UpdateCRC( mnCRC, mpOutBuf, nAvail );
+ mpOStm->Write( PZSTREAM->next_out = mpOutBuf, nAvail );
+ PZSTREAM->avail_out = mnOutBufSize;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ZCodec::SetBreak( ULONG nInToRead )
+{
+ mnInToRead = nInToRead;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ZCodec::GetBreak( void )
+{
+ return ( mnInToRead + PZSTREAM->avail_in );
+}
+
+// ------------------------------------------------------------------------
+
+void ZCodec::SetCRC( ULONG nCRC )
+{
+ mnCRC = nCRC;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ZCodec::GetCRC()
+{
+ return mnCRC;
+}
+
+// ------------------------------------------------------------------------
+
+void ZCodec::ImplInitBuf ( BOOL nIOFlag )
+{
+ if ( mbInit == 0 )
+ {
+ if ( nIOFlag )
+ {
+ mbInit = 1;
+ if ( mbStatus && ( mnCompressMethod & ZCODEC_GZ_LIB ) )
+ {
+ BYTE n1, n2, j, nMethod, nFlags;
+ for ( int i = 0; i < 2; i++ ) // gz - magic number
+ {
+ *mpIStm >> j;
+ if ( j != gz_magic[ i ] )
+ mbStatus = FALSE;
+ }
+ *mpIStm >> nMethod;
+ *mpIStm >> nFlags;
+ if ( nMethod != Z_DEFLATED )
+ mbStatus = FALSE;
+ if ( ( nFlags & GZ_RESERVED ) != 0 )
+ mbStatus = FALSE;
+ /* Discard time, xflags and OS code: */
+ mpIStm->SeekRel( 6 );
+ /* skip the extra field */
+ if ( nFlags & GZ_EXTRA_FIELD )
+ {
+ *mpIStm >> n1 >> n2;
+ mpIStm->SeekRel( n1 + ( n2 << 8 ) );
+ }
+ /* skip the original file name */
+ if ( nFlags & GZ_ORIG_NAME)
+ {
+ do
+ {
+ *mpIStm >> j;
+ }
+ while ( j && !mpIStm->IsEof() );
+ }
+ /* skip the .gz file comment */
+ if ( nFlags & GZ_COMMENT )
+ {
+ do
+ {
+ *mpIStm >> j;
+ }
+ while ( j && !mpIStm->IsEof() );
+ }
+ /* skip the header crc */
+ if ( nFlags & GZ_HEAD_CRC )
+ mpIStm->SeekRel( 2 );
+ if ( mbStatus )
+ mbStatus = ( inflateInit2( PZSTREAM, -MAX_WBITS) != Z_OK ) ? FALSE : TRUE;
+ }
+ else
+ {
+ mbStatus = ( inflateInit( PZSTREAM ) >= 0 );
+ }
+ mpInBuf = new BYTE[ mnInBufSize ];
+ }
+ else
+ {
+ mbInit = 3;
+
+ mbStatus = ( deflateInit2_( PZSTREAM, mnCompressMethod & 0xff, Z_DEFLATED,
+ MAX_WBITS, mnMemUsage, ( mnCompressMethod >> 8 ) & 0xff,
+ ZLIB_VERSION, sizeof( z_stream ) ) >= 0 );
+
+ PZSTREAM->next_out = mpOutBuf = new BYTE[ PZSTREAM->avail_out = mnOutBufSize ];
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ZCodec::UpdateCRC ( ULONG nLatestCRC, ULONG nNumber )
+{
+
+#ifdef __LITTLEENDIAN
+ nNumber = SWAPLONG( nNumber );
+#endif
+ return rtl_crc32( nLatestCRC, &nNumber, 4 );
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ZCodec::UpdateCRC ( ULONG nLatestCRC, BYTE* pSource, long nDatSize)
+{
+ return rtl_crc32( nLatestCRC, pSource, nDatSize );
+}
+
+// ------------------------------------------------------------------------
+
+void GZCodec::BeginCompression( ULONG nCompressMethod )
+{
+ ZCodec::BeginCompression( nCompressMethod | ZCODEC_GZ_LIB );
+};
+
+
diff --git a/tools/unx/source/dll/makefile.mk b/tools/unx/source/dll/makefile.mk
new file mode 100644
index 000000000000..1144bbd359a2
--- /dev/null
+++ b/tools/unx/source/dll/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:10 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=TOOLS
+TARGET=dll
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= memmgr.cxx \
+ toolsdll.cxx
+
+SLOFILES= $(SLO)$/memmgr.obj \
+ $(SLO)$/toolsdll.obj
+
+OBJFILES= $(OBJ)$/toolsdll.obj \
+ $(OBJ)$/memmgr.obj
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/tools/unx/source/dll/toolsdll.cxx b/tools/unx/source/dll/toolsdll.cxx
new file mode 100644
index 000000000000..d74b8e103c05
--- /dev/null
+++ b/tools/unx/source/dll/toolsdll.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolsdll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SHL_HXX
+#include <shl.hxx>
+#endif
+
+static void* aAppData[SHL_COUNT];
+
+/***************************************************************************
+|*
+|* GetAppData()
+|*
+|* Beschreibung Daten fuer andere Libs abfragen
+|* Ersterstellung TH 19.01.95
+|* Letzte Aenderung TH 19.01.95
+|*
+***************************************************************************/
+
+void** GetAppData( USHORT nSharedLib )
+{
+ return &(aAppData[nSharedLib]);
+}
diff --git a/tools/util/makefile.mk b/tools/util/makefile.mk
new file mode 100644
index 000000000000..e28219e4da06
--- /dev/null
+++ b/tools/util/makefile.mk
@@ -0,0 +1,309 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:10 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=TOOLS
+TARGET=tools
+VERSION=$(UPD)
+
+USE_LDUMP2=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Allgemein ----------------------------------------------------
+
+.IF "$(depend)" == ""
+
+# --- TOOLS.HXX ---
+HXX1FILES= $(INC)$/debug.hxx \
+ $(INC)$/new.hxx \
+ $(INC)$/shl.hxx \
+ $(INC)$/link.hxx \
+ $(INC)$/fract.hxx \
+ $(INC)$/string.hxx \
+ $(INC)$/contnr.hxx \
+ $(INC)$/list.hxx \
+ $(INC)$/table.hxx \
+ $(INC)$/unqidx.hxx \
+ $(INC)$/unqid.hxx \
+ $(INC)$/mempool.hxx \
+ $(INC)$/simplecm.hxx \
+ $(INC)$/stream.hxx \
+ $(INC)$/cachestr.hxx \
+ $(INC)$/errcode.hxx \
+ $(INC)$/lang.hxx \
+ $(INC)$/ref.hxx \
+ $(INC)$/tools.h
+HXX2FILES= $(INC)$/solar.h
+HXX4FILES= $(INC)$/stdstrm.hxx
+HXX5FILES= $(INC)$/ref.hxx
+HXX6FILES= $(INC)$/pstm.hxx \
+ $(INC)$/globname.hxx
+HXX7FILES= $(INC)$/rtti.hxx
+HXX8FILES= $(INC)$/solver.h
+.IF "$(GUIBASE)" == "WIN"
+HXX9FILES= $(INCGUI)$/svwin.h \
+ $(INCGUI)$/postwin.h \
+ $(INCGUI)$/prewin.h
+.ENDIF
+.IF "$(GUI)" == "OS2"
+HXX9FILES= $(INCGUI)$/svpm.h
+.ENDIF
+HXX10FILES= $(INC)$/errinf.hxx $(INC)$/errcode.hxx $(INC)$/string.hxx
+HXX11FILES= $(INC)$/urlobj.hxx
+HXX12FILES= $(INC)$/bigint.hxx
+HXX13FILES= $(INC)$/multisel.hxx
+HXX14FILES= $(INC)$/date.hxx $(INC)$/time.hxx $(INC)$/datetime.hxx $(INC)$/intn.hxx $(INC)$/timestamp.hxx
+HXX15FILES= $(INC)$/wldcrd.hxx $(INC)$/fsys.hxx
+HXX16FILES= $(INC)$/queue.hxx $(INC)$/dynary.hxx $(INC)$/stack.hxx
+HXX17FILES= $(INC)$/stream.hxx $(INC)$/cachestr.hxx
+HXX18FILES= $(HXX1FILES)
+HXX19FILES= $(INC)$/zcodec.hxx
+
+.IF "$(UPDATER)"!=""
+# --- STDSTRM.LIB ---
+LIB3TARGET= $(LB)$/stdstrm.lib
+LIB3ARCHIV= $(LB)$/libstdstrm.a
+LIB3FILES= $(LB)$/stream.lib
+.ENDIF # "$(UPDATER)"!=""
+
+.IF "$(GUI)"!="UNX"
+MEMMGRLIB=$(LB)$/memmgr.lib
+MEMMGRSLB=$(SLB)$/memmgr.lib
+.ELSE
+MEMMGRLIB=
+MEMMGRSLB=
+.ENDIF
+
+.IF "$(UPDATER)"!=""
+
+LIB7TARGET= $(LB)$/a$(TARGET).lib
+LIB7ARCHIV= $(LB)$/liba$(TARGET).a
+LIB7FILES= $(LB)$/gen.lib \
+ $(LB)$/str.lib \
+ $(LB)$/mtools.lib \
+ $(MEMMGRLIB) \
+ $(LB)$/datetime.lib \
+ $(LB)$/timestamp.lib \
+ $(LB)$/intntl.lib \
+ $(LB)$/fsys.lib \
+ $(LB)$/communi.lib \
+ $(LB)$/stream.lib \
+ $(LB)$/ref.lib \
+ $(LB)$/rc.lib \
+ $(LB)$/inet.lib \
+ $(LB)$/debug.lib
+
+
+LIB7FILES+= $(LB)$/dll.lib
+
+.ENDIF # "$(UPDATER)"!=""
+
+# --- TOOLS.LIB ---
+LIB1TARGET:= $(SLB)$/$(TARGET).lib
+LIB1FILES+= \
+ $(MEMMGRSLB) \
+ $(SLB)$/gen.lib \
+ $(SLB)$/str.lib \
+ $(SLB)$/mtools.lib \
+ $(SLB)$/datetime.lib \
+ $(SLB)$/timestamp.lib \
+ $(SLB)$/intntl.lib \
+ $(SLB)$/fsys.lib \
+ $(SLB)$/communi.lib \
+ $(SLB)$/stream.lib \
+ $(SLB)$/ref.lib \
+ $(SLB)$/rc.lib \
+ $(SLB)$/debug.lib \
+ $(SLB)$/zcodec.lib \
+ $(SLB)$/inet.lib
+
+SHL1STDLIBS += $(ZLIB3RDLIB)
+
+LIB1FILES+= $(SLB)$/dll.lib
+
+
+.IF "$(BIG_TOOLS)"!=""
+.IF "$(GUI)"=="WNT"
+#SOLARLIBDIR=$(SOLARVER)\$(UPD)\$(INPATH)\lib
+#SOLARLIBDIR=..\$(INPATH)\lib
+# bei lokalen osl rtl oder vos das SOLARLIBDIR bitte patchen !
+LIB1FILES+= $(SOLARLIBDIR)\xosl.lib \
+ $(SOLARLIBDIR)\xrtl.lib \
+ $(SOLARLIBDIR)\xvos.lib
+SHL1STDLIBS+= wsock32.lib
+.ENDIF
+.ENDIF # "$(BIG_TOOLS)"!=""
+
+# --- TOOLS.DLL ---
+SHL1TARGET= tl$(VERSION)$(DLLPOSTFIX)
+#SHL1TARGET= $(TOOLSDLLPREFIX)$(VERSION)$(DLLPOSTFIX)
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1IMPLIB= itools
+SHL1STDLIBS+= $(SALLIB) $(VOSLIB)
+
+.IF "$(GUI)" == "OS2"
+SHL1OBJS= $(SLO)\memmgr.obj
+.ENDIF
+.IF "$(GUI)"=="WIN"
+SHL1OBJS= $(SLO)\memmgr.obj
+.ENDIF # "$(GUI)"=="WIN"
+
+
+.IF "$(GUI)"=="WNT"
+SHL1STDLIBS+= shell32.lib \
+ mpr.lib \
+ ole32.lib \
+ uuid.lib \
+ advapi32.lib
+.ENDIF
+
+DEF1NAME =$(SHL1TARGET)
+DEF1DEPN = \
+ $(MISC)$/$(SHL1TARGET).flt \
+ $(HXX1FILES) \
+ $(HXX2FILES) \
+ $(HXX3FILES) \
+ $(HXX4FILES) \
+ $(HXX5FILES) \
+ $(HXX6FILES) \
+ $(HXX7FILES) \
+ $(HXX8FILES) \
+ $(HXX9FILES) \
+ $(HXX10FILES) \
+ $(HXX11FILES) \
+ $(HXX12FILES) \
+ $(HXX13FILES) \
+ $(HXX14FILES) \
+ $(HXX15FILES) \
+ $(HXX16FILES) \
+ $(HXX17FILES) \
+ $(HXX18FILES) \
+ $(HXX19FILES) \
+ $(HXX20FILES) \
+ makefile.mk
+
+DEFLIB1NAME =tools
+
+ALL: $(LIB1TARGET) \
+ ALLTAR \
+ $(INCCOM)$/dll.hxx
+
+# --- Targets ------------------------------------------------------
+
+# --- TOOLS.FLT ---
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo Imp>$@
+ @echo PointerList>>$@
+ @echo DbgCheck>>$@
+ @echo DbgName>>$@
+ @echo LabelList>>$@
+ @echo ActionList>>$@
+ @echo CBlock>>$@
+ @echo DirEntryStack>>$@
+ @echo readdir>>$@
+ @echo closedir>>$@
+ @echo opendir>>$@
+ @echo volumeid>>$@
+ @echo MsDos2Time>>$@
+ @echo MsDos2Date>>$@
+ @echo __new_alloc>>$@
+ @echo __CT>>$@
+ @echo unnamed>>$@
+.IF "$(COM)"=="BLC"
+ @echo WEP>>$@
+.ENDIF
+.ENDIF # "$(depend)" == ""
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# --- TOOLS.LIB ---
+$(LB)$/$(TARGET).lib : $(LB)$/itools.lib
+ @echo ------------------------------
+ @echo Making: $@
+ @+$(COPY) $(LB)$/itools.lib $@
+
+
+# --- DLL.HXX ---
+
+.IF "$(GUI)"=="UNX"
+$(INCCOM)$/dll.hxx:
+ @echo ------------------------------
+ @echo Making: $@
+ @echo > $@
+.ELSE
+$(INCCOM)$/dll.hxx: $(INCGUI)$/dll.hxx
+ @echo ------------------------------
+ @echo Making: $@
+ @+$(COPY) $(INCGUI)$/dll.hxx $@
+.ENDIF
+
diff --git a/tools/util/tools.r b/tools/util/tools.r
new file mode 100644
index 000000000000..0d1e8739bd42
--- /dev/null
+++ b/tools/util/tools.r
@@ -0,0 +1,17 @@
+#include "CodeFragmentTypes.r"
+
+resource 'cfrg' (0) {
+ {
+ kPowerPC, /* instruction set architecture */
+ kFullLib, /* base-level library */
+ kNoVersionNum, /* no implementation version number */
+ kNoVersionNum, /* no definition version number */
+ kDefaultStackSize, /* use default stack size */
+ kNoAppSubFolder, /* no library directory */
+ kIsLib, /* fragment is an application */
+ kOnDiskFlat, /* fragment is on disk */
+ kZeroOffset, /* fragment starts at fork start */
+ kWholeFork, /* fragment occupies entire fork */
+ "Tools.pef" /* name of the application */
+ }
+};
diff --git a/tools/win/inc/dll.hxx b/tools/win/inc/dll.hxx
new file mode 100644
index 000000000000..fbcb6478acc2
--- /dev/null
+++ b/tools/win/inc/dll.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * $RCSfile: dll.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _DLL_HXX
+#define _DLL_HXX
+
+#ifdef WIN
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#endif
+
+// ----------------------
+// - Zugriffsfunktionen -
+// ----------------------
+
+struct SVDATA;
+
+extern "C"
+{
+// IN APPDATA.ASM
+SVDATA* FAR PASCAL GetSVData();
+}
+
+// IN TOOLSDLL.CXX
+void SetSVData( SVDATA* pSVData );
+
+#endif
+
+// -------------------------------
+// - Sonstige Funktionen fuer SV -
+// -------------------------------
+
+// MultiThread-Sicherung aktivieren
+void EnterMultiThread( int bEnter );
+int IsMultiThread();
+
+// Um Resourcen wieder freizugeben
+#ifdef WNT
+void ImpDeInitWinTools();
+#else
+inline void ImpDeInitWinTools() {}
+#endif
+
+#endif // _DLL_HXX
diff --git a/tools/win/inc/parser.hxx b/tools/win/inc/parser.hxx
new file mode 100644
index 000000000000..8aeb1db8de05
--- /dev/null
+++ b/tools/win/inc/parser.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: parser.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _PARSER_HXX
+#define _PARSER_HXX
+
+#include <string.hxx>
+#include <winshell.hxx>
+
+void * NewBinaryFromString( const String & rBinStr );
+String CreateStringFromData( const void *pData, ULONG nBytes );
+
+String CreateStringFromItemIDList( const CItemIDList & rIDList );
+
+String GetURLFromHostNotation( const String & rPath );
+String GetHostNotationFromURL( const String & rURL );
+
+CItemIDList MakeIDToken( const String &rToken );
+CItemIDList ParseSpecialURL( const String & rURL );
+
+#endif // _PARSER_HXX
diff --git a/tools/win/inc/shellex.h b/tools/win/inc/shellex.h
new file mode 100644
index 000000000000..46bf91b8eaa0
--- /dev/null
+++ b/tools/win/inc/shellex.h
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * $RCSfile: shellex.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SHELLEX_H_
+#define _SHELLEX_H_
+
+#ifndef _SHLOBJ_H_
+#include <shlobj.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#define WINSHELLCALL inline
+#else
+#define WINSHELLCALL static
+#endif
+
+#define SHChangeNotifyRegister_PROC_STR MAKEINTRESOURCE(2)
+#define SHChangeNotifyDeregister_PROC_STR MAKEINTRESOURCE(4)
+
+#define SHCNF_ACCEPT_INTERRUPTS 0x0001
+#define SHCNF_ACCEPT_NON_INTERRUPTS 0x0002
+#define SHCNF_NO_PROXY 0x8000
+
+#define SHCNF_ACCEPT_ALL (SHCNF_ACCEPT_INTERRUPTS | SHCNF_ACCEPT_NON_INTERRUPTS)
+
+typedef struct tagNOTIFYREGISTER {
+ LPCITEMIDLIST pidlPath;
+ BOOL bWatchSubtree;
+} NOTIFYREGISTER;
+
+typedef NOTIFYREGISTER *LPNOTIFYREGISTER;
+typedef NOTIFYREGISTER const *LPCNOTIFYREGISTER;
+
+typedef HANDLE (WINAPI *SHChangeNotifyRegister_PROC)(
+ HWND hWnd,
+ DWORD dwFlags,
+ LONG wEventMask,
+ UINT uMsg,
+ ULONG cItems,
+ LPCNOTIFYREGISTER lpItems);
+
+
+WINSHELLCALL HANDLE WINAPI SHChangeNotifyRegister(
+ HWND hWnd,
+ DWORD dwFlags,
+ LONG wEventMask,
+ UINT uMsg,
+ ULONG cItems,
+ LPCNOTIFYREGISTER lpItems)
+
+{
+ HMODULE hModule = GetModuleHandle( "SHELL32" );
+ HANDLE hNotify = NULL;
+
+ if ( hModule )
+ {
+ SHChangeNotifyRegister_PROC lpfnSHChangeNotifyRegister = (SHChangeNotifyRegister_PROC)GetProcAddress( hModule, SHChangeNotifyRegister_PROC_STR );
+ if ( lpfnSHChangeNotifyRegister )
+ hNotify = lpfnSHChangeNotifyRegister( hWnd, dwFlags, wEventMask, uMsg, cItems, lpItems );
+ }
+
+ return hNotify;
+}
+
+
+
+typedef BOOL (WINAPI *SHChangeNotifyDeregister_PROC)(
+ HANDLE hNotify);
+
+WINSHELLCALL BOOL WINAPI SHChangeNotifyDeregister( HANDLE hNotify )
+{
+ HMODULE hModule = GetModuleHandle( "SHELL32" );
+ BOOL fSuccess = FALSE;
+
+ if ( hModule )
+ {
+ SHChangeNotifyDeregister_PROC lpfnSHChangeNotifyDeregister = (SHChangeNotifyDeregister_PROC)GetProcAddress( hModule, SHChangeNotifyDeregister_PROC_STR );
+ if ( lpfnSHChangeNotifyDeregister )
+ fSuccess = lpfnSHChangeNotifyDeregister( hNotify );
+ }
+
+ return fSuccess;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/tools/win/inc/shutil.h b/tools/win/inc/shutil.h
new file mode 100644
index 000000000000..379e29495dc7
--- /dev/null
+++ b/tools/win/inc/shutil.h
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * $RCSfile: shutil.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SHUTIL_H_
+#define _SHUTIL_H_
+
+#ifndef _SHOBJ_H
+#include <shlobj.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PROTOCOL_FILE "file:"
+#define MAX_URL (MAX_PATH + sizeof(PROTOCOL_FILE))
+
+#define SHUTIL_TO_DELIVER
+
+//--------------------------------------------------------------------------
+
+void * WINAPI WIN_SHAlloc( ULONG cb );
+void * WINAPI WIN_SHRealloc( void *pv, ULONG cb );
+void WINAPI WIN_SHFree( void *pv );
+
+//--------------------------------------------------------------------------
+
+ULONG WINAPI WIN_SHGetIDListSize( LPCITEMIDLIST pidl );
+BOOL WINAPI WIN_SHCloneIDList( LPCITEMIDLIST pidl, LPITEMIDLIST *ppidl );
+BOOL WINAPI WIN_SHAppendIDList( LPCITEMIDLIST pidl, LPITEMIDLIST *ppidl );
+LONG WINAPI WIN_SHCompareIDList( LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2 );
+
+LONG WINAPI WIN_SHGetIDListTokenCount( LPCITEMIDLIST pidl );
+BOOL WINAPI WIN_SHGetIDListToken( LPCITEMIDLIST pidl, ULONG nToken, LPITEMIDLIST *ppidl );
+
+BOOL WINAPI WIN_SHSplitIDList(
+ LPCITEMIDLIST pidl,
+ LPITEMIDLIST * pidlFolder,
+ LPITEMIDLIST * pidlItem
+ );
+
+BOOL WINAPI WIN_SHSplitIDListEx(
+ LPCITEMIDLIST pidl,
+ LPITEMIDLIST * pidlParent,
+ LPITEMIDLIST * pidlChild,
+ ULONG nLevel
+ );
+
+//--------------------------------------------------------------------------
+
+#define WIN_SHGetSpecialFolderLocation( nFolder, ppidl ) \
+ ((BOOL)(NOERROR == SHGetSpecialFolderLocation( GetFocus(), nFolder, ppidl )))
+
+#define WIN_SHGetPathFromIDList( pidl, pszPath ) \
+ SHGetPathFromIDList( pidl, pszPath )
+
+// #define SHGP_CLSID 0x00000001
+
+// BOOL WINAPI WIN_SHGetPathFromIDListEx( LPCITEMIDLIST pidl, LPSTR pszBuffer, UINT uFlags );
+
+BOOL WINAPI WIN_SHGetIDListFromPath( LPCSTR pszPath, LPITEMIDLIST *ppidl );
+
+BOOL WINAPI WIN_SHGetPathFromURL( LPCSTR pszURL, LPSTR pszPath );
+BOOL WINAPI WIN_SHGetURLFromPath( LPCSTR pszPath, LPSTR pszURL );
+
+BOOL WINAPI WIN_SHGetFolderFromIDList( LPCITEMIDLIST pidl, LPSHELLFOLDER *ppshf );
+BOOL WINAPI WIN_SHGetSpecialFolder( int nFolder, LPSHELLFOLDER *ppshf );
+BOOL WINAPI WIN_SHGetFolderFromPath( LPCSTR pszPath, LPSHELLFOLDER *ppshf );
+
+BOOL WINAPI WIN_SHGetSpecialFolderPath( int nFolder, LPSTR pszPath );
+
+HRESULT WINAPI WIN_SHGetDataFromIDList(
+ LPSHELLFOLDER psf,
+ LPCITEMIDLIST pidl,
+ int nFormat,
+ PVOID pv,
+ int cb
+ );
+
+
+//--------------------------------------------------------------------------
+
+#define SHIC_PIDL 0x00000001
+#define SHIC_NO_UI 0x00000002
+
+#define CMDSTR_OPENA "open"
+#define CMDSTR_EXPLOREA "explore"
+#define CMDSTR_FINDA "find"
+
+#define CMDSTR_OPENW L"open"
+#define CMDSTR_EXPLOREW L"explore"
+#define CMDSTR_FINDW L"find"
+
+#ifdef UNICODE
+#define CMDSTR_OPEN CMDSTR_OPENW
+#define CMDSTR_EXPLORE CMDSTR_EXPLOREW
+#define CMDSTR_FIND CMDSTR_FINDW
+#else
+#define CMDSTR_OPEN CMDSTR_OPENA
+#define CMDSTR_EXPLORE CMDSTR_EXPLOREA
+#define CMDSTR_FIND CMDSTR_FINDA
+#endif
+
+#define CMDSTR_DEFAULT MAKEINTRESOURCE(0x00)
+
+#define CMDSTR_LINK MAKEINTRESOURCE(0x10)
+#define CMDSTR_DELETE MAKEINTRESOURCE(0x11)
+#define CMDSTR_RENAME MAKEINTRESOURCE(0x12)
+#define CMDSTR_PROPERTIES MAKEINTRESOURCE(0x13)
+#define CMDSTR_CUT MAKEINTRESOURCE(0x18)
+#define CMDSTR_COPY MAKEINTRESOURCE(0x19)
+
+BOOL WINAPI WIN_SHInvokeCommand(
+ HWND hwndOwner,
+ DWORD dwFlags,
+ LPCTSTR lpPath,
+ LPCSTR lpVerb,
+ LPCSTR lpParameters,
+ LPCSTR lpDirectory,
+ int nShow
+ );
+
+//--------------------------------------------------------------------------
+
+BOOL WINAPI WIN_SHStrRetToMultiByte(
+ LPCITEMIDLIST pidl,
+ const STRRET * pStr,
+ LPSTR lpMultiByte,
+ int cchMultiByte
+ );
+
+DWORD WIN_SHBuildCRC( LPVOID pBytes, ULONG nBytes );
+
+DWORD WINAPI WIN_GetShellVersion(VOID);
+
+HIMAGELIST WINAPI WIN_SHGetSystemImageList( UINT uFlags );
+
+//--------------------------------------------------------------------------
+
+/*
+
+ULONG WINAPI WIN_CreateStringFromBinary (
+ LPCVOID pv,
+ ULONG cbSize,
+ LPSTR pszString,
+ ULONG cbStringSize
+ );
+
+ULONG WINAPI WIN_CreateBinaryFromString(
+ LPCSTR pszStr,
+ LPVOID pBuffer,
+ ULONG cbSize
+ );
+*/
+
+//--------------------------------------------------------------------------
+
+DWORD WINAPI WIN_SHSetValue(
+ HKEY hKey,
+ LPCTSTR pszSubKey,
+ LPCTSTR pszValue,
+ DWORD dwType,
+ LPCVOID pvData,
+ DWORD cbData
+ );
+
+DWORD WINAPI WIN_SHGetValue(
+ HKEY hKey,
+ LPCTSTR pszSubKey,
+ LPCTSTR pszValue,
+ LPDWORD pdwType,
+ LPVOID pvData,
+ LPDWORD pcbData
+ );
+
+DWORD WINAPI WIN_SHDeleteValue(
+ HKEY hKey,
+ LPCTSTR pszSubKey,
+ LPCTSTR pszValue
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _SHUTIL_H_
+
diff --git a/tools/win/inc/toolsdll.hxx b/tools/win/inc/toolsdll.hxx
new file mode 100644
index 000000000000..adaa01e1f986
--- /dev/null
+++ b/tools/win/inc/toolsdll.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolsdll.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLSDLL_HXX
+#define _TOOLSDLL_HXX
+
+#ifdef WIN
+
+#ifndef _STRING_H
+#include <string.h>
+#endif
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#endif
+
+#ifndef _SOLAR_H
+#include <solar.h>
+#endif
+
+#ifndef _SHL_HXX
+#include <shl.hxx>
+#endif
+
+// ----------------
+// - MemMgr-Daten -
+// ----------------
+
+// Anzahl Freispeicherlisten
+#define MEM_FREELIST_COUNT 15
+
+
+// --------------
+// - Tools-Data -
+// --------------
+
+struct SVDATA;
+struct FreeBlock;
+
+struct MemData
+{
+ FreeBlock* pFirstBlocks[MEM_FREELIST_COUNT]; // Erste Bloecke in Freispeicherlisten
+ void* pNewHandler; // New-Handler
+ int nMultiThread; // MultiThread an/aus
+};
+
+struct ToolsData
+{
+ // !!! SVDATA muss in jedem Fall ganz vorne in der Struktur stehen !!!
+ SVDATA* pSVData; // Pointer auf StarView-Daten
+ HANDLE hMem; // Handler der Tools-Daten
+ MemData aMemD; // Daten der Speicherverwaltung
+ void* aAppData[SHL_COUNT]; // Daten fuer andere Shared Libs
+};
+
+
+// ----------------------
+// - Zugriffsfunktionen -
+// ----------------------
+
+// IN APPDATA.ASM
+extern "C"
+{
+ToolsData* FAR PASCAL ImpGetAppData();
+void FAR PASCAL ImpSetAppData( ToolsData* pData );
+}
+
+// IN TOOLSDLL.CXX
+ToolsData* ImpGetToolsData();
+
+#endif
+
+#endif // _DLL_HXX
diff --git a/tools/win/inc/winshell.hxx b/tools/win/inc/winshell.hxx
new file mode 100644
index 000000000000..f712b56ec7be
--- /dev/null
+++ b/tools/win/inc/winshell.hxx
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * $RCSfile: winshell.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _WINSHELL_HXX
+#define _WINSHELL_HXX
+
+#include <prewin.h>
+#include "shutil.h"
+#include <postwin.h>
+
+#include <string.hxx>
+
+//----------------------------------------------------------------------------
+// CItemIDList
+//----------------------------------------------------------------------------
+
+class CItemIDList
+{
+public:
+ CItemIDList();
+ CItemIDList( const CItemIDList & );
+ CItemIDList( LPCITEMIDLIST );
+ CItemIDList( const String & );
+ CItemIDList( int nFolder );
+ ~CItemIDList();
+
+ CItemIDList & operator = ( const CItemIDList & );
+ CItemIDList & operator += ( const CItemIDList & );
+ CItemIDList operator + ( const CItemIDList & ) const;
+
+ int operator == ( const CItemIDList & ) const;
+ int operator != ( const CItemIDList & rIDList ) const
+ { return ! operator == ( rIDList ); };
+
+ operator LPCITEMIDLIST() const
+ { return m_pidl; };
+
+ int GetTokenCount() const;
+ CItemIDList GetToken( int nIndex ) const;
+ CItemIDList GetParent( int nLevelFromBottom = 1) const;
+ CItemIDList GetChild( int nLevelFromBottom = 1 ) const;
+ void Split( CItemIDList & rParent, CItemIDList & rChild, int nLevelFromBottom = 1 ) const;
+
+ CItemIDList operator []( int nIndex ) const
+ { return GetToken( nIndex ); };
+
+ String GetFilePath() const;
+
+ BOOL IsValid() const
+ { return m_pidl != NULL && m_pidl->mkid.cb != sizeof(USHORT); }
+
+ int GetRootID() const
+ { return m_nFolder; }
+
+protected:
+ ITEMIDLIST *m_pidl;
+ int m_nFolder;
+};
+
+
+inline CItemIDList CItemIDList::operator + ( const CItemIDList & rIDList ) const
+{
+ CItemIDList aCopy( *this );
+ aCopy += rIDList;
+ return aCopy;
+}
+
+//----------------------------------------------------------------------------
+// Types for CShellFolder
+//----------------------------------------------------------------------------
+
+// Notification Events fuer CShellFolder
+
+enum NotificationEvent
+{
+ NotificationEvent_Error,
+ NotificationEvent_Signaled,
+ NotificationEvent_Canceled
+};
+
+// Volume information
+
+typedef struct _WIN32_VOLUME_DATA
+{
+ TCHAR cDeviceName[MAX_PATH];
+ TCHAR cVolumeName[MAX_PATH];
+ TCHAR cFileSystemName[MAX_PATH];
+ DWORD dwSerialNumber;
+ DWORD dwFileSystemFlags;
+ DWORD nMaxComponentLength;
+} WIN32_VOLUME_DATA;
+
+// Bekannte Class-IDs fuer wichtige Ordner
+
+// {871C5380-42A0-1069-A2EA-08002B30309D} Internet Explorer 4.0
+static const GUID CLSID_IE4 =
+{ 0x871C5380, 0x42A0, 0x1069, { 0xA2, 0xEA, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D } };
+
+// {208D2C60-3AEA-1069-A2D7-08002B30309D} Netzwerkumgebung
+static const GUID CLSID_Network =
+{ 0x208D2C60, 0x3AEA, 0x1069, { 0xA2, 0xD7, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D } };
+
+// {645FF040-5081-101B-9F08-00AA002F954E} Papierkorb
+static const GUID CLSID_RecycleBin =
+{ 0x645FF040, 0x5081, 0x101B, { 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E } };
+
+// {20D04FE0-3AEA-1069-A2D8-08002B30309D} Arbeitsplatz
+static const GUID CLSID_MyComputer =
+{ 0x20D04FE0, 0x3AEA, 0x1069, { 0xA2, 0xD8, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D } };
+
+// {D6277990-4C6A-11CF-8D87-00AA0060F5BF} Geplante Vorgänge
+static const GUID CLSID_Tasks =
+{ 0xD6277990, 0x4C6A, 0x11CF, { 0x8D, 0x87, 0x00, 0xAA, 0x00, 0x60, 0xF5, 0xBF } };
+
+// Fehlt im Header
+
+#define SHGDN_INCLUDE_NONFILESYS 0x2000
+
+#define CSIDL_UNKNOWN -1
+#define CSIDL_ROOT -2
+#define CSIDL_SYSTEM -3
+
+// Suchmaske fuer IEnumIDList
+
+#define SHCONTF_ALL (SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN)
+
+// SHITEM Prefix Kinds
+
+#define SHGII_CONTAINER_MASK 0x70
+
+#define SHGII_COMPUTER 0x20
+
+#define SHGII_COMPUTER_REMOVABLE 0x22
+#define SHGII_COMPUTER_FIXED 0x23
+#define SHGII_COMPUTER_REMOTE 0x24
+#define SHGII_COMPUTER_CDROM 0x25
+#define SHGII_COMPUTER_RAMDISK 0x26
+#define SHGII_COMPUTER_FLOPPY525 0x28
+#define SHGII_COMPUTER_FLOPPY35 0x29
+#define SHGII_COMPUTER_NETWORK 0x2A
+#define SHGII_COMPUTER_REGITEM 0x2E
+
+#define SHGII_ROOT 0x10
+#define SHGII_ROOT_REGITEM 0x1F
+
+#define SHGII_NETWORK 0x40
+#define SHGII_NETWORK_TREE 0x47
+#define SHGII_NETWORK_SERVER 0x42
+#define SHGII_NETWORK_DIRECTORY 0x43
+#define SHGII_NETWORK_PRINTER 0x41
+
+#define SHGII_FILESYSTEM 0x30
+#define SHGII_FILESYSTEM_FILE 0x31
+#define SHGII_FILESYSTEM_DIRECTORY 0x32
+
+#define SHGII_ANCESTOR 0x80
+
+#define SHITEMCONTAINER( pidl ) ((pidl)->mkid.abID[0] & SHGII_CONTAINER_MASK)
+#define SHITEMKIND( pidl ) ((pidl)->mkid.abID[0] & 0x7F)
+
+//----------------------------------------------------------------------------
+// CShellFolderData
+//----------------------------------------------------------------------------
+
+class CShellFolderData
+{
+protected:
+ CShellFolderData();
+ virtual ~CShellFolderData();
+
+ IShellFolder *m_pShellFolder;
+ IEnumIDList *m_pEnumIDList;
+ IShellIcon *m_pShellIcon;
+ BOOL m_bIsOpen;
+ HANDLE m_hCancelEvent;
+ DWORD m_dwContentFlags;
+};
+
+//----------------------------------------------------------------------------
+// CShellFolder
+//----------------------------------------------------------------------------
+
+// Ganz "normaler" Ordner basierend auf dem IShellFolder Interface
+
+class CShellFolder : public CShellFolderData
+{
+public:
+ CShellFolder( const CItemIDList & );
+ CShellFolder( const CShellFolder & );
+ CShellFolder( IShellFolder * );
+
+ // Retrieval of Item IDs
+
+ virtual BOOL Reset();
+
+ BOOL GetNextValidID( CItemIDList & );
+
+ virtual BOOL GetNextID( CItemIDList & );
+ virtual BOOL ValidateID( const CItemIDList & );
+
+ // Getting information about Items
+
+ virtual BOOL GetAttributesOf( const CItemIDList &, LPDWORD pdwInOut );
+ virtual BOOL GetNameOf( const CItemIDList &, String & );
+
+ virtual BOOL GetFileInfo( const CItemIDList &, WIN32_FIND_DATA * );
+ virtual BOOL GetVolumeInfo( const CItemIDList & rIDList, WIN32_VOLUME_DATA * );
+
+ // Modifying the folder contents
+
+ virtual BOOL SetNameOf( const CItemIDList &, const String &, CItemIDList & );
+ virtual BOOL DeleteItem( const CItemIDList & );
+
+ // Comparison of IDs
+
+ virtual int CompareIDs( const CItemIDList &, const CItemIDList & );
+
+ // UI Components
+
+ virtual IContextMenu *GetContextMenu( int nItems, const CItemIDList * );
+ virtual String GetIconLocation( const CItemIDList & );
+
+ // Notifications
+
+ virtual NotificationEvent WaitForChanges();
+ virtual void CancelWaitNotifications();
+
+protected:
+ CShellFolder() : CShellFolderData() {};
+
+ void Initialize( IShellFolder *pShellFolder );
+ void Initialize( LPCITEMIDLIST );
+};
+
+//----------------------------------------------------------------------------
+// CFileSystemFolder
+//----------------------------------------------------------------------------
+
+// Reiner !!! Filesystem-Ordner. Benutzt optimierten Notification Mechanismus
+
+class CFileSystemFolder : public CShellFolder
+{
+public:
+ CFileSystemFolder( LPCSTR pszPath );
+
+ virtual NotificationEvent WaitForChanges();
+
+protected:
+ CFileSystemFolder() : CShellFolder() {};
+
+ void Initialize( LPCTSTR pszPath );
+
+ TCHAR m_szPath[MAX_PATH];
+};
+
+//----------------------------------------------------------------------------
+// CSpecialFolder
+//----------------------------------------------------------------------------
+
+// Wie SHellFolder, aber andere Konstruktion ueber definierte Junktion-Points
+
+class CSpecialFolder : public CShellFolder
+{
+public:
+ CSpecialFolder( int nFolder );
+
+protected:
+ CSpecialFolder() : CShellFolder() {};
+
+ void Initialize( int nFolder );
+
+ int m_nFolder;
+};
+
+//----------------------------------------------------------------------------
+// CMyComputerFolder
+//----------------------------------------------------------------------------
+
+// Der MS-Windows "Arbeitsplatz"
+
+class CMyComputerFolder : public CSpecialFolder
+{
+public:
+ CMyComputerFolder() : CSpecialFolder( CSIDL_DRIVES ) {};
+};
+
+//----------------------------------------------------------------------------
+// CVolumesFolder
+//----------------------------------------------------------------------------
+
+// Wie CMyComputersFolder, enthält aber nur die Laufwerke
+
+class CVolumesFolder : public CMyComputerFolder
+{
+public:
+ CVolumesFolder() : CMyComputerFolder() {};
+
+ virtual BOOL ValidateID( const CItemIDList & );
+ virtual NotificationEvent WaitForChanges();
+};
+
+//----------------------------------------------------------------------------
+// CWorkplaceFolder
+//----------------------------------------------------------------------------
+
+// Wie CMyComputersFolder, enthält aber keine!!! Laufwerke
+
+class CWorkplaceFolder : public CMyComputerFolder
+{
+ CWorkplaceFolder() : CMyComputerFolder() {};
+
+ virtual BOOL ValidateID( const CItemIDList & );
+ virtual NotificationEvent WaitForChanges();
+};
+
+//----------------------------------------------------------------------------
+// CDesktopFolder
+//----------------------------------------------------------------------------
+
+// Der MS-Windows Desktop
+
+class CDesktopFolder : public CSpecialFolder
+{
+public:
+ CDesktopFolder() : CSpecialFolder( CSIDL_DESKTOP ) {};
+};
+
+//----------------------------------------------------------------------------
+// CDesktopAncestorsFolder
+//----------------------------------------------------------------------------
+
+// Wie CDesktopFolder, enthält aber nur Arbeitsplatz und Netzwerk
+
+class CDesktopAncestorsFolder : public CDesktopFolder
+{
+public:
+ CDesktopAncestorsFolder() : CDesktopFolder() {};
+
+ virtual BOOL ValidateID( const CItemIDList & );
+ virtual NotificationEvent WaitForChanges();
+};
+
+//----------------------------------------------------------------------------
+// CDesktopContentsFolder
+//----------------------------------------------------------------------------
+
+// Wie CDesktopFolder, aber ohne!!! Arbeitsplatz und Netzwerk
+
+class CDesktopContentsFolder : public CDesktopFolder
+{
+public:
+ CDesktopContentsFolder() : CDesktopFolder() {};
+
+ virtual BOOL ValidateID( const CItemIDList & );
+ virtual NotificationEvent WaitForChanges();
+};
+
+
+#endif // _WINSHELL_HXX
diff --git a/tools/win/source/dll/makefile.mk b/tools/win/source/dll/makefile.mk
new file mode 100644
index 000000000000..06c691cd27f1
--- /dev/null
+++ b/tools/win/source/dll/makefile.mk
@@ -0,0 +1,112 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..\..\..
+
+PRJNAME=TOOLS
+TARGET=dll
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- WNT ----------------------------------------------------------
+
+.IF "$(GUI)" == "WNT"
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= toolsdll.cxx
+
+SLOFILES= $(SLO)$/toolsdll.obj
+
+OBJFILES= $(OBJ)$/toolsdll.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.ELSE # "$(GUI)" == "WNT"
+
+# --- Files --------------------------------------------------------
+
+ASMFILES= appdata.asm
+CXXFILES= toolsdll.cxx
+
+SLOFILES= $(SLO)$/toolsdll.obj \
+ $(SLO)$/appdata.obj
+
+OBJFILES= $(OBJ)$/toolsdll.obj \
+ $(OBJ)$/appdata.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(depend)" == ""
+appdata.asm:
+.ENDIF
+
+.ENDIF # "$(GUI)" == "WNT"
+
diff --git a/tools/win/source/dll/toolsdll.cxx b/tools/win/source/dll/toolsdll.cxx
new file mode 100644
index 000000000000..293544e26136
--- /dev/null
+++ b/tools/win/source/dll/toolsdll.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolsdll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <svwin.h>
+#endif
+
+#ifndef _DLL_HXX
+#include <dll.hxx>
+#endif
+#ifndef _TOOLSDLL_HXX
+#include <toolsdll.hxx>
+#endif
+#ifndef _SHL_HXX
+#include <shl.hxx>
+#endif
+
+// =======================================================================
+
+#ifdef WIN
+
+extern "C" int CALLBACK LibMain( HINSTANCE, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+extern "C" int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+ToolsData* ImpGetToolsData()
+{
+ ToolsData* pData = ImpGetAppData();
+
+ // Tools-Init
+ if ( !pData )
+ {
+ // Speicher anlegen
+ HANDLE hMem = GlobalAlloc( GMEM_MOVEABLE | GMEM_ZEROINIT,
+ (DWORD)sizeof( ToolsData ) );
+
+ if ( !hMem )
+ return NULL;
+
+ pData = (ToolsData*)GlobalLock( hMem );
+
+ if ( !pData )
+ {
+ GlobalFree( hMem );
+ return NULL;
+ }
+
+ // ToolsData setzen
+ ImpSetAppData( pData );
+ }
+
+ return pData;
+}
+
+// -----------------------------------------------------------------------
+
+void** GetAppData( USHORT nSharedLib )
+{
+ ToolsData* pData = ImpGetToolsData();
+ return &(pData->aAppData[nSharedLib]);
+}
+
+// -----------------------------------------------------------------------
+
+void SetSVData( SVDATA* pSVData )
+{
+ ToolsData* pData = ImpGetToolsData();
+ pData->pSVData = pSVData;
+}
+
+// -----------------------------------------------------------------------
+
+void EnterMultiThread( int bEnter )
+{
+ ToolsData* pData = ImpGetToolsData();
+ if ( bEnter )
+ pData->aMemD.nMultiThread++;
+ else if ( pData->aMemD.nMultiThread )
+ pData->aMemD.nMultiThread--;
+}
+
+// -----------------------------------------------------------------------
+
+int IsMultiThread()
+{
+ return (ImpGetToolsData()->aMemD.nMultiThread != 0);
+}
+
+#endif
+
+// =======================================================================
+
+#ifdef WNT
+
+static void* aAppData[SHL_COUNT];
+
+// -----------------------------------------------------------------------
+
+void** GetAppData( USHORT nSharedLib )
+{
+ return &(aAppData[nSharedLib]);
+}
+
+// -----------------------------------------------------------------------
+
+// EnterMultiThread()/IsMultiThread()/... in MEMWNT.CXX, damit inline
+
+#endif
diff --git a/tools/win/source/fastfsys/makefile.mk b/tools/win/source/fastfsys/makefile.mk
new file mode 100644
index 000000000000..9d56b847b90e
--- /dev/null
+++ b/tools/win/source/fastfsys/makefile.mk
@@ -0,0 +1,108 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..\..\..
+
+PRJNAME=TOOLS
+TARGET=fastfsys
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- WNT ----------------------------------------------------------
+
+.IF "$(GUI)" == "WNT"
+
+# --- Files --------------------------------------------------------
+
+
+OBJFILES= $(OBJ)$/shutil.obj \
+ $(OBJ)$/shidl.obj \
+ $(OBJ)$/shmalloc.obj \
+ $(OBJ)$/fffolder.obj \
+ $(OBJ)$/ffmenu.obj \
+ $(OBJ)$/ffitem.obj \
+ $(OBJ)$/fflink.obj \
+ $(OBJ)$/ffparser.obj \
+ $(OBJ)$/wincidl.obj \
+ $(OBJ)$/wincshf.obj
+
+
+SLOFILES= $(SLO)$/shutil.obj \
+ $(SLO)$/shidl.obj \
+ $(SLO)$/shmalloc.obj \
+ $(SLO)$/fffolder.obj \
+ $(SLO)$/ffmenu.obj \
+ $(SLO)$/ffitem.obj \
+ $(SLO)$/fflink.obj \
+ $(SLO)$/ffparser.obj \
+ $(SLO)$/wincidl.obj \
+ $(SLO)$/wincshf.obj
+
+# --- Targets ------------------------------------------------------
+
+.ENDIF
+
+.INCLUDE : target.mk
diff --git a/tools/workben/fstest.cxx b/tools/workben/fstest.cxx
new file mode 100644
index 000000000000..fc5b7a041a53
--- /dev/null
+++ b/tools/workben/fstest.cxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * $RCSfile: fstest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _FSTEST_CXX "$Revision: 1.1.1.1 $"
+
+#ifndef _SOLAR_H
+#include <solar.h>
+#endif
+
+#include <stdio.h>
+
+#ifndef _STREAM_HXX
+#include <stream.hxx>
+#endif
+
+#ifndef _FSYS_HXX
+#include <fsys.hxx>
+#endif
+
+#ifndef _DATE_HXX
+#include <date.hxx>
+#endif
+
+#ifndef _TIME_HXX
+#include <time.hxx>
+#endif
+
+void CheckTimes(DirEntry aDE);
+
+/*
+ * main.
+ */
+int main (int argc, char **argv)
+{
+ DirEntry aDir;
+ if (aDir.Exists())
+ {
+ aDir.ToAbs();
+ String sTmp(aDir.GetFull(FSYS_STYLE_HOST));
+ printf("Directory = %s\n", sTmp.GetStr());
+ CheckTimes(aDir);
+ DirEntry aFile =
+ aDir + DirEntry("testfile.txt", FSYS_STYLE_HOST);
+ SvFileStream aStream;
+ aStream.Open(aFile.GetFull(FSYS_STYLE_HOST), STREAM_WRITE);
+ aStream << "Test";
+ aStream.Close();
+ ULONG i, nWaitFor = 2000 + Time::GetSystemTicks();
+ for (i=Time::GetSystemTicks();
+ i < nWaitFor;
+ i = Time::GetSystemTicks())
+ ;
+ CheckTimes(aDir);
+ nWaitFor = 2000 + Time::GetSystemTicks();
+ for (i=Time::GetSystemTicks();
+ i < nWaitFor;
+ i = Time::GetSystemTicks())
+ ;
+ aFile.Kill();
+ }
+ else
+ puts("MakeDir failed!");
+ return 0;
+}
+
+void CheckTimes(DirEntry aDE)
+{
+ FileStat aDirStat(aDE);
+ aDirStat.Update(aDE);
+ Date aDateCreated(aDirStat.DateCreated());
+ Date aDateModified(aDirStat.DateModified());
+ Time aTimeCreated(aDirStat.TimeCreated());
+ Time aTimeModified(aDirStat.TimeModified());
+ printf(
+ "DirDateCreated = %i, DirTimeCreated = %i\n",
+ aDateCreated.GetDate(), aTimeCreated.GetTime());
+ printf(
+ "DirDateModified = %i, DirTimeModified = %i\n",
+ aDateModified.GetDate(), aTimeModified.GetTime());
+ return;
+}
+
diff --git a/tools/workben/hashtbl.cxx b/tools/workben/hashtbl.cxx
new file mode 100644
index 000000000000..73a5960bac28
--- /dev/null
+++ b/tools/workben/hashtbl.cxx
@@ -0,0 +1,544 @@
+/*************************************************************************
+ *
+ * $RCSfile: hashtbl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tlgen.hxx>
+#include "hashtbl.hxx"
+
+// -------------------------------------------------------------
+// class HashItem
+//
+class HashItem
+{
+ enum ETag { TAG_EMPTY, TAG_USED, TAG_DELETED };
+
+ void* m_pObject;
+ ETag m_Tag;
+ String m_Key;
+
+public:
+ HashItem() { m_Tag = TAG_EMPTY; m_pObject = NULL; }
+
+ BOOL IsDeleted() const
+ { return m_Tag == TAG_DELETED; }
+
+ BOOL IsEmpty() const
+ { return m_Tag == TAG_DELETED || m_Tag == TAG_EMPTY; }
+
+ BOOL IsFree() const
+ { return m_Tag == TAG_EMPTY; }
+
+ BOOL IsUsed() const
+ { return m_Tag == TAG_USED; }
+
+ void Delete()
+ { m_Tag = TAG_DELETED; m_Key = ""; m_pObject = NULL; }
+
+ String const& GetKey() const
+ { return m_Key; }
+
+ void* GetObject() const
+ { return m_pObject; }
+
+ void SetObject(String const Key, void *pObject)
+ { m_Tag = TAG_USED; m_Key = Key; m_pObject = pObject; }
+};
+
+// #define MIN(a,b) (a)<(b)?(a):(b)
+// #define MAX(a,b) (a)>(b)?(a):(b)
+
+// -------------------------------------------------------------
+// class HashTable
+//
+
+/*static*/ double HashTable::m_defMaxLoadFactor = 0.8;
+/*static*/ double HashTable::m_defDefGrowFactor = 2.0;
+
+HashTable::HashTable(ULONG lSize, BOOL bOwner, double dMaxLoadFactor, double dGrowFactor)
+{
+ m_lSize = lSize;
+ m_bOwner = bOwner;
+ m_lElem = 0;
+ m_dMaxLoadFactor = max(0.5,min(1.0,dMaxLoadFactor)); // 0.5 ... 1.0
+ m_dGrowFactor = max(1.3,(5.0,dGrowFactor)); // 1.3 ... 5.0
+ m_pData = new HashItem [lSize];
+
+// Statistik
+#ifdef DBG_UTIL
+ m_aStatistic.m_lSingleHash = 0;
+ m_aStatistic.m_lDoubleHash = 0;
+ m_aStatistic.m_lProbe = 0;
+#endif
+}
+
+HashTable::~HashTable()
+{
+ // Wenn die HashTable der Owner der Objecte ist,
+ // müssen die Destruktoren separat gerufen werden.
+ // Dies geschieht über die virtuelle Methode OnDeleteObject()
+ //
+ // Problem: Virtuelle Funktionen sind im Destructor nicht virtuell!!
+ // Der Code muß deshalb ins Macro
+
+ /*
+ if (m_bOwner)
+ {
+ for (ULONG i=0; i<GetSize(); i++)
+ {
+ void *pObject = GetObjectAt(i);
+
+ if (pObject != NULL)
+ OnDeleteObject(pObject());
+ }
+ }
+ */
+
+ // Speicher für HashItems freigeben
+ delete [] m_pData;
+}
+
+void* HashTable::GetObjectAt(ULONG lPos) const
+// Gibt Objekt zurück, wenn es eines gibt, sonst NULL;
+{
+ DBG_ASSERT(lPos<m_lSize, "HashTable::GetObjectAt()");
+
+ HashItem *pItem = &m_pData[lPos];
+
+ return pItem->IsUsed() ? pItem->GetObject() : NULL;
+}
+
+void HashTable::OnDeleteObject(void*)
+{
+ DBG_ERROR("HashTable::OnDeleteObject(void*) nicht überladen")
+}
+
+ULONG HashTable::Hash(String const& Key) const
+{
+ /*
+ ULONG lHash = 0;
+ ULONG i,n;
+
+ for (i=0,n=Key.Len(); i<n; i++)
+ {
+ lHash *= 256L;
+ lHash += (ULONG)(USHORT)Key.GetStr()[i];
+ lHash %= m_lSize;
+ }
+ return lHash;
+ */
+
+ // Hashfunktion von P.J. Weinberger
+ // aus dem "Drachenbuch" von Aho/Sethi/Ullman
+ ULONG i,n;
+ ULONG h = 0;
+ ULONG g = 0;
+
+ for (i=0,n=Key.Len(); i<n; i++)
+ {
+ h = (h<<4) + (ULONG)(USHORT)Key.GetStr()[i];
+ g = h & 0xf0000000;
+
+ if (g != 0)
+ {
+ h = h ^ (g >> 24);
+ h = h ^ g;
+ }
+ }
+
+ return h % m_lSize;
+}
+
+ULONG HashTable::DHash(String const& Key, ULONG lOldHash) const
+{
+ ULONG lHash = lOldHash;
+ ULONG i,n;
+
+ for (i=0,n=Key.Len(); i<n; i++)
+ {
+ lHash *= 256L;
+ lHash += (ULONG)(USHORT)Key.GetStr()[i];
+ lHash %= m_lSize;
+ }
+ return lHash;
+
+/* return
+ (
+ lHash
+ + (char)Key.GetStr()[0] * 256
+ + (char)Key.GetStr()[Key.Len()-1]
+ + 1
+ )
+ % m_lSize;
+*/
+}
+
+ULONG HashTable::Probe(ULONG lPos) const
+// gibt den Folgewert von lPos zurück
+{
+ lPos++; if (lPos==m_lSize) lPos=0;
+ return lPos;
+}
+
+BOOL HashTable::IsFull() const
+{
+ return m_lElem>=m_lSize;
+}
+
+BOOL HashTable::Insert(String const& Key, void* pObject)
+// pre: Key ist nicht im Dictionary enthalten, sonst return FALSE
+// Dictionary ist nicht voll, sonst return FALSE
+// post: pObject ist unter Key im Dictionary; m_nElem wurde erhöht
+{
+ SmartGrow();
+
+ if (IsFull())
+ {
+ DBG_ERROR("HashTable::Insert() is full");
+ return FALSE;
+ }
+
+ if (FindPos(Key) != NULL )
+ return FALSE;
+
+ ULONG lPos = Hash(Key);
+ HashItem *pItem = &m_pData[lPos];
+
+ // first hashing
+ //
+ if (pItem->IsEmpty())
+ {
+ pItem->SetObject(Key, pObject);
+ m_lElem++;
+
+ #ifdef DBG_UTIL
+ m_aStatistic.m_lSingleHash++;
+ #endif
+
+ return TRUE;
+ }
+
+ // double hashing
+ //
+ lPos = DHash(Key,lPos);
+ pItem = &m_pData[lPos];
+
+ if (pItem->IsEmpty())
+ {
+ pItem->SetObject(Key, pObject);
+ m_lElem++;
+
+ #ifdef DBG_UTIL
+ m_aStatistic.m_lDoubleHash++;
+ #endif
+
+ return TRUE;
+ }
+
+ // linear probing
+ //
+ do
+ {
+ #ifdef DBG_UTIL
+ m_aStatistic.m_lProbe++;
+ #endif
+
+ lPos = Probe(lPos);
+ pItem = &m_pData[lPos];
+ }
+ while(!pItem->IsEmpty());
+
+ pItem->SetObject(Key, pObject);
+ m_lElem++;
+ return TRUE;
+}
+
+HashItem* HashTable::FindPos(String const& Key) const
+// sucht den Key; gibt Refrenz auf den Eintrag (gefunden)
+// oder NULL (nicht gefunden) zurück
+//
+// pre: -
+// post: -
+{
+ // first hashing
+ //
+ ULONG lPos = Hash(Key);
+ HashItem *pItem = &m_pData[lPos];
+
+ if (pItem->IsUsed()
+ && pItem->GetKey() == Key)
+ {
+ return pItem;
+ }
+
+ // double hashing
+ //
+ if (pItem->IsDeleted() || pItem->IsUsed())
+ {
+ lPos = DHash(Key,lPos);
+ pItem = &m_pData[lPos];
+
+ if (pItem->IsUsed()
+ && pItem->GetKey() == Key)
+ {
+ return pItem;
+ }
+
+ // linear probing
+ //
+ if (pItem->IsDeleted() || pItem->IsUsed())
+ {
+ ULONG n = 0;
+ BOOL bFound = FALSE;
+ BOOL bEnd = FALSE;
+
+ do
+ {
+ n++;
+ lPos = Probe(lPos);
+ pItem = &m_pData[lPos];
+
+ bFound = pItem->IsUsed()
+ && pItem->GetKey() == Key;
+
+ bEnd = !(n<m_lSize || pItem->IsFree());
+ }
+ while(!bFound && !bEnd);
+
+ return bFound ? pItem : NULL;
+ }
+ }
+
+ // nicht gefunden
+ //
+ return NULL;
+}
+
+void* HashTable::Find(String const& Key) const
+// Gibt Verweis des Objektes zurück, das unter Key abgespeichert ist,
+// oder NULL wenn nicht vorhanden.
+//
+// pre: -
+// post: -
+{
+ HashItem *pItem = FindPos(Key);
+
+ if (pItem != NULL
+ && pItem->GetKey() == Key)
+ return pItem->GetObject();
+ else
+ return NULL;
+}
+
+void* HashTable::Delete(String const& Key)
+// Löscht Objekt, das unter Key abgespeichert ist und gibt Verweis
+// darauf zurück.
+// Gibt NULL zurück, wenn Key nicht vorhanden ist.
+//
+// pre: -
+// post: Objekt ist nicht mehr enthalten; m_lElem dekrementiert
+// Wenn die HashTable der Owner ist, wurde das Object gelöscht
+{
+ HashItem *pItem = FindPos(Key);
+
+ if (pItem != NULL
+ && pItem->GetKey() == Key)
+ {
+ void* pObject = pItem->GetObject();
+
+ if (m_bOwner)
+ OnDeleteObject(pObject);
+
+ pItem->Delete();
+ m_lElem--;
+ return pObject;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+double HashTable::CalcLoadFactor() const
+// prozentuale Belegung der Hashtabelle berechnen
+{
+ return double(m_lElem) / double(m_lSize);
+}
+
+void HashTable::SmartGrow()
+// Achtung: da die Objekte umkopiert werden, darf die OnDeleteObject-Methode
+// nicht gerufen werden
+{
+ double dLoadFactor = CalcLoadFactor();
+
+ if (dLoadFactor <= m_dMaxLoadFactor)
+ return; // nothing to grow
+
+ ULONG lOldSize = m_lSize; // alte Daten sichern
+ HashItem* pOldData = m_pData;
+
+ m_lSize = ULONG (m_dGrowFactor * m_lSize); // neue Größe
+ m_pData = new HashItem[m_lSize]; // neue Daten holen
+
+ // kein Speicher:
+ // Zustand "Tabelle voll" wird in Insert abgefangen
+ //
+ if (m_pData == NULL)
+ {
+ m_lSize = lOldSize;
+ m_pData = pOldData;
+ return;
+ }
+
+ m_lElem = 0; // noch keine neuen Daten
+
+ // Umkopieren der Daten
+ //
+ for (ULONG i=0; i<lOldSize; i++)
+ {
+ HashItem *pItem = &pOldData[i];
+
+ if (pItem->IsUsed())
+ Insert(pItem->GetKey(),pItem->GetObject());
+ }
+
+ delete [] pOldData;
+}
+
+// Iterator ---------------------------------------------------------
+//
+
+HashTableIterator::HashTableIterator(HashTable const& aTable)
+: m_aTable(aTable)
+{
+ m_lAt = 0;
+}
+
+void* HashTableIterator::GetFirst()
+{
+ m_lAt = 0;
+ return FindValidObject(TRUE /* forward */);
+}
+
+void* HashTableIterator::GetLast()
+{
+ m_lAt = m_aTable.GetSize() -1;
+ return FindValidObject(FALSE /* backward */);
+}
+
+void* HashTableIterator::GetNext()
+{
+ if (m_lAt+1 >= m_aTable.GetSize())
+ return NULL;
+
+ m_lAt++;
+ return FindValidObject(TRUE /* forward */);
+}
+
+void* HashTableIterator::GetPrev()
+{
+ if (m_lAt <= 0)
+ return NULL;
+
+ m_lAt--;
+ return FindValidObject(FALSE /* backward */);
+}
+
+void* HashTableIterator::FindValidObject(BOOL bForward)
+// Sucht nach einem vorhandenen Objekt ab der aktuellen
+// Position.
+//
+// pre: ab inkl. m_lAt soll die Suche beginnen
+// post: if not found then
+// if bForward == TRUE then
+// m_lAt == m_aTable.GetSize() -1
+// else
+// m_lAt == 0
+// else
+// m_lAt ist die gefundene Position
+{
+ void *pObject = m_aTable.GetObjectAt(m_lAt);
+
+ if (pObject != NULL)
+ return pObject;
+
+ while (pObject == NULL
+ && (bForward ? ((m_lAt+1) < m_aTable.GetSize())
+ : m_lAt > 0))
+ {
+ if (bForward)
+ m_lAt++;
+ else
+ m_lAt--;
+
+ pObject = m_aTable.GetObjectAt(m_lAt);
+ }
+
+#ifdef DBG_UTIL
+
+ if (pObject == NULL)
+ {
+ DBG_ASSERT(bForward ? m_lAt == m_aTable.GetSize() -1 : m_lAt == 0,
+ "HashTableIterator::FindValidObject()");
+ }
+
+#endif
+
+ return pObject;
+}
diff --git a/tools/workben/hashtbl.hxx b/tools/workben/hashtbl.hxx
new file mode 100644
index 000000000000..224d9197d6dd
--- /dev/null
+++ b/tools/workben/hashtbl.hxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * $RCSfile: hashtbl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:11 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _HASHTBL_HXX
+#define _HASHTBL_HXX
+
+#include <tlgen.hxx>
+
+// ADT hash table
+//
+// Invariante:
+// 1. m_lElem < m_lSize
+// 2. die Elemente in m_Array wurden double-hashed erzeugt
+//
+class HashItem;
+
+class HashTable
+{
+ ULONG m_lSize;
+ ULONG m_lElem;
+ HashItem *m_pData;
+ double m_dMaxLoadFactor;
+ double m_dGrowFactor;
+ BOOL m_bOwner;
+
+ ULONG Hash(String const& Key) const;
+ ULONG DHash(String const& Key, ULONG lHash) const;
+ ULONG Probe(ULONG lPos) const;
+
+ HashItem* FindPos(String const& Key) const;
+ void SmartGrow();
+ double CalcLoadFactor() const;
+
+// Statistik
+#ifdef DBG_UTIL
+private:
+ struct
+ {
+ ULONG m_lSingleHash;
+ ULONG m_lDoubleHash;
+ ULONG m_lProbe;
+ }
+ m_aStatistic;
+#endif
+
+protected:
+ friend class HashTableIterator;
+
+ virtual void OnDeleteObject(void* pObject);
+
+ void* GetObjectAt(ULONG lPos) const;
+
+// Default-Werte
+public:
+ static double m_defMaxLoadFactor;
+ static double m_defDefGrowFactor;
+
+public:
+ HashTable
+ (
+ ULONG lSize,
+ BOOL bOwner,
+ double dMaxLoadFactor = HashTable::m_defMaxLoadFactor /* 0.8 */,
+ double dGrowFactor = HashTable::m_defDefGrowFactor /* 2.0 */
+ );
+
+ ~HashTable();
+
+ BOOL IsFull() const;
+ ULONG GetSize() const { return m_lSize; }
+
+ void* Find (String const& Key) const;
+ BOOL Insert (String const& Key, void* pObject);
+ void* Delete (String const& Key);
+};
+
+// ADT hash table iterator
+//
+// Invariante: 0 <= m_lAt < m_aTable.GetCount()
+//
+class HashTableIterator
+{
+ ULONG m_lAt;
+ HashTable const& m_aTable;
+
+ void* FindValidObject(BOOL bForward);
+
+protected:
+ void* GetFirst(); // Interation _ohne_ Sortierung
+ void* GetNext();
+ void* GetLast();
+ void* GetPrev();
+
+public:
+ HashTableIterator(HashTable const&);
+};
+
+// typsichere Makros ---------------------------------------------------
+
+#define DECLARE_HASHTABLE_INTERN(ClassName,Owner,KeyType,ObjType) \
+ class ClassName : public HashTable \
+ { \
+ public: \
+ ClassName \
+ ( \
+ ULONG lSize, \
+ double dMaxLoadFactor = HashTable::m_defMaxLoadFactor, \
+ double dGrowFactor = HashTable::m_defDefGrowFactor \
+ ) \
+ : HashTable(lSize,Owner,dMaxLoadFactor,dGrowFactor) {} \
+ \
+ ObjType Find (KeyType const& Key) const \
+ { return (ObjType) HashTable::Find(String(Key)); } \
+ \
+ BOOL Insert (KeyType const& Key, ObjType Object) \
+ { return HashTable::Insert(String(Key), (void*) Object); } \
+ \
+ ObjType Delete (KeyType const&Key) \
+ { return (ObjType) HashTable::Delete (String(Key)); } \
+ };
+
+// HashTable OHNE Owner-Verhalten
+#define DECLARE_HASHTABLE(ClassName,KeyType,ObjType) \
+ DECLARE_HASHTABLE_INTERN(ClassName,FALSE,KeyType,ObjType)
+
+// HashTable MIT Owner-Verhalten
+#define DECLARE_HASHTABLE_OWNER(ClassName,KeyType,ObjType) \
+ DECLARE_HASHTABLE_INTERN(ClassName##2,TRUE,KeyType,ObjType) \
+ class ClassName : public ClassName##2 \
+ { \
+ protected: \
+ virtual void OnDeleteObject(void* pObject); \
+ public: \
+ ClassName \
+ ( \
+ ULONG lSize, \
+ double dMaxLoadFactor = HashTable::m_defMaxLoadFactor, \
+ double dGrowFactor = HashTable::m_defDefGrowFactor \
+ ) \
+ : ClassName##2(lSize,dMaxLoadFactor,dGrowFactor) {} \
+ ~ClassName(); \
+ };
+
+#define IMPLEMENT_HASHTABLE_OWNER(ClassName,KeyType,ObjType) \
+ void ClassName::OnDeleteObject(void* pObject) \
+ { delete (ObjType) pObject; } \
+ \
+ ClassName::~ClassName() \
+ { \
+ for (ULONG i=0; i<GetSize(); i++) \
+ { \
+ void *pObject = GetObjectAt(i); \
+ if (pObject != NULL) \
+ OnDeleteObject(pObject); \
+ } \
+ }
+
+// Iterator-Makros --------------------------------------------------
+
+#define DECLARE_HASHTABLE_ITERATOR(ClassName,ObjType) \
+ class ClassName : public HashTableIterator \
+ { \
+ public: \
+ ClassName(HashTable const& aTable) \
+ : HashTableIterator(aTable) {} \
+ \
+ ObjType GetFirst() \
+ { return (ObjType)HashTableIterator::GetFirst(); } \
+ ObjType GetNext() \
+ { return (ObjType)HashTableIterator::GetNext(); } \
+ ObjType GetLast() \
+ { return (ObjType)HashTableIterator::GetLast(); } \
+ ObjType GetPrev() \
+ { return (ObjType)HashTableIterator::GetPrev(); } \
+ };
+
+
+#endif // _HASHTBL_HXX
+
diff --git a/tools/workben/makefile.mk b/tools/workben/makefile.mk
new file mode 100644
index 000000000000..8f76c20bbfd2
--- /dev/null
+++ b/tools/workben/makefile.mk
@@ -0,0 +1,119 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:12 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=tl
+TARGET=tldem
+LIBTARGET=NO
+TARGETTYPE=CUI
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= tldem.cxx solar.c demostor.cxx fstest.cxx
+
+OBJFILES= $(OBJ)$/tldem.obj $(OBJ)$/solar.obj $(OBJ)$/demostor.obj $(OBJ)$/fstest.obj
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJ)$/tldem.obj
+.IF "$(GUI)" == "UNX"
+APP1LIBS= $(TOOLSLIB)
+.ELSE
+APP1LIBS= $(LB)$/itools.lib
+# APP1DEPN= $(LB)$/$(TOOLSLIB)
+.ENDIF
+
+APP2TARGET= solar
+APP2OBJS= $(OBJ)$/solar.obj
+.IF "$(GUI)" == "UNX"
+APP2STDLIBS= $(TOOLSLIB)
+.ELSE
+APP2LIBS= $(LB)$/itools.lib
+APP2DEPN= $(LB)$/itools.lib
+.ENDIF
+
+APP3TARGET= demostor
+APP3OBJS= $(OBJ)$/demostor.obj
+.IF "$(GUI)" == "UNX"
+APP3STDLIBS= $(TOOLSLIB) $(VOSLIB) $(SALLIB)
+.ELSE
+APP3STDLIBS= $(LB)$/itools.lib ivos.lib isal.lib
+.ENDIF
+
+APP4TARGET= fstest
+APP4OBJS= $(OBJ)$/fstest.obj
+.IF "$(GUI)" == "UNX"
+APP4STDLIBS= $(TOOLSLIB) $(VOSLIB) $(SALLIB)
+.ELSE
+APP4STDLIBS= $(LB)$/itools.lib ivos.lib isal.lib
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/tools/workben/solar.c b/tools/workben/solar.c
new file mode 100644
index 000000000000..f515824ff15b
--- /dev/null
+++ b/tools/workben/solar.c
@@ -0,0 +1,456 @@
+/*************************************************************************
+ *
+ * $RCSfile: solar.c,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef enum { t_char, t_short, t_int, t_long, t_double } Type;
+typedef int (*TestFunc)( Type, void* );
+
+struct Description;
+
+int IsBigEndian(void);
+int IsStackGrowingDown_2( int * pI );
+int IsStackGrowingDown(void);
+int GetStackAlignment_3( char*p, long l, int i, short s, char b, char c, ... );
+int GetStackAlignment_2( char*p, long l, int i, short s, char b, char c );
+int GetStackAlignment(void);
+void PrintArgs( int p, ... );
+int check( TestFunc func, Type eT, void* p );
+
+#if defined (UNX) || defined (WNT)
+
+#ifdef UNX
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+
+#define I_STDARG
+#ifdef I_STDARG
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#define NO_USE_FORK_TO_CHECK
+#ifdef USE_FORK_TO_CHECK
+#include <sys/wait.h>
+#else
+#include <signal.h>
+#include <setjmp.h>
+#endif
+
+#else
+#endif
+
+#define printTypeSize(Type,Name) printf( "sizeof(%s)\t= %d\n", Name, \
+ sizeof (Type) )
+
+#define isSignedType(Type) (((Type)-1) < 0)
+#define printTypeSign(Type,Name) printf( "%s\t= %s %s\n", Name, \
+ ( isSignedType(Type) ? "unsigned" : "signed" ), Name )
+
+
+int IsBigEndian()
+{
+ long l = 1;
+ return ! *(char*)&l;
+}
+
+int IsStackGrowingDown_2( int * pI )
+{
+ int i = 1;
+ return ((unsigned long)&i) < (unsigned long)pI;
+}
+
+int IsStackGrowingDown()
+{
+ int i = 1;
+ return IsStackGrowingDown_2(&i);
+}
+
+int GetStackAlignment_3( char*p, long l, int i, short s, char b, char c, ... )
+{
+ if ( IsStackGrowingDown() )
+ return &c - &b;
+ else
+ return &b - &c;
+}
+
+int GetStackAlignment_2( char*p, long l, int i, short s, char b, char c )
+{
+ if ( IsStackGrowingDown() )
+ return &c - &b;
+ else
+ return &b - &c;
+}
+
+int GetStackAlignment()
+{
+ int nStackAlignment = GetStackAlignment_3(0,1,2,3,4,5);
+ if ( nStackAlignment != GetStackAlignment_2(0,1,2,3,4,5) )
+ printf( "Pascal calling convention\n" );
+ return nStackAlignment;
+}
+
+
+
+
+#if defined (UNX) || defined (WNT)
+
+#ifdef I_STDARG
+void PrintArgs( int p, ... )
+#else
+void PrintArgs( p, va_alist )
+int p;
+va_dcl
+#endif
+{
+ int value;
+ va_list ap;
+
+#ifdef I_STDARG
+ va_start( ap, p );
+#else
+ va_start( ap );
+#endif
+
+ printf( "value = %d", p );
+
+ while ( ( value = va_arg(ap, int) ) != 0 )
+ printf( " %d", value );
+
+ printf( "\n" );
+ va_end(ap);
+}
+
+#ifndef USE_FORK_TO_CHECK
+static jmp_buf check_env;
+static int bSignal;
+#ifdef UNX
+void SignalHandler( int sig )
+#else
+void __cdecl SignalHandler( int sig )
+#endif
+{
+ bSignal = 1;
+ /*
+ fprintf( stderr, "Signal %d caught\n", sig );
+ signal( sig, SignalHandler );
+ /**/
+ longjmp( check_env, sig );
+}
+#endif
+
+int check( TestFunc func, Type eT, void* p )
+{
+#ifdef USE_FORK_TO_CHECK
+ pid_t nChild = fork();
+ if ( nChild )
+ {
+ int exitVal;
+ wait( &exitVal );
+ if ( exitVal & 0xff )
+ return -1;
+ else
+ return exitVal >> 8;
+ }
+ else
+ {
+ exit( func( eT, p ) );
+ }
+#else
+ int result;
+
+ bSignal = 0;
+
+ if ( !setjmp( check_env ) )
+ {
+ signal( SIGSEGV, SignalHandler );
+#ifdef UNX
+ signal( SIGBUS, SignalHandler );
+#else
+#endif
+ result = func( eT, p );
+ signal( SIGSEGV, SIG_DFL );
+#ifdef UNX
+ signal( SIGBUS, SIG_DFL );
+#else
+#endif
+ }
+
+ if ( bSignal )
+ return -1;
+ else
+ return 0;
+#endif
+}
+
+#endif
+
+
+int GetAtAddress( Type eT, void* p )
+{
+ switch ( eT )
+ {
+ case t_char: return *((char*)p);
+ case t_short: return *((short*)p);
+ case t_int: return *((int*)p);
+ case t_long: return *((long*)p);
+ case t_double: return *((double*)p);
+ }
+ abort();
+}
+
+int SetAtAddress( Type eT, void* p )
+{
+ switch ( eT )
+ {
+ case t_char: return *((char*)p) = 0;
+ case t_short: return *((short*)p) = 0;
+ case t_int: return *((int*)p) = 0;
+ case t_long: return *((long*)p) = 0;
+ case t_double: return *((double*)p)= 0;
+ }
+ abort();
+}
+
+char* TypeName( Type eT )
+{
+ switch ( eT )
+ {
+ case t_char: return "char";
+ case t_short: return "short";
+ case t_int: return "int";
+ case t_long: return "long";
+ case t_double: return "double";
+ }
+ abort();
+}
+
+int CheckGetAccess( Type eT, void* p )
+{
+ int b;
+ b = -1 != check( (TestFunc)GetAtAddress, eT, p );
+#ifdef DEBUG
+ fprintf( stderr,
+ "%s read %s at %p\n",
+ (b? "can" : "can not" ), TypeName(eT), p );
+#endif
+ return b;
+}
+int CheckSetAccess( Type eT, void* p )
+{
+ int b;
+ b = -1 != check( (TestFunc)SetAtAddress, eT, p );
+#ifdef DEBUG
+ fprintf( stderr,
+ "%s write %s at %p\n",
+ (b? "can" : "can not" ), TypeName(eT), p );
+#endif
+ return b;
+}
+
+int GetAlignment( Type eT )
+{
+ char a[ 16*8 ];
+ int p = (int)(void*)&a;
+ int i;
+ p = ( p + 0xF ) & ~0xF;
+ for ( i = 1; i < 16; i++ )
+ if ( CheckGetAccess( eT, (void*)(p+i) ) )
+ return i;
+ return 0;
+}
+
+int CheckCharAccess( char* p )
+{
+ if ( CheckGetAccess( t_char, p ) )
+ printf( "can read address %p\n", p );
+ else
+ printf( "can not read address %p\n", p );
+
+ if ( CheckSetAccess( t_char, p ) )
+ printf( "can write address %p\n", p );
+ else
+ printf( "can not write address %p\n", p );
+
+ return 0;
+}
+
+struct Description
+{
+ int bBigEndian;
+ int bStackGrowsDown;
+ int nStackAlignment;
+ int nAlignment[3]; /* 2,4,8 */
+}
+
+Description_Ctor( struct Description* pThis )
+{
+ pThis->bBigEndian = IsBigEndian();
+ pThis->bStackGrowsDown = IsStackGrowingDown();
+ pThis->nStackAlignment = GetStackAlignment();
+
+ if ( sizeof(short) != 2 )
+ abort();
+ pThis->nAlignment[0] = GetAlignment( t_short );
+ if ( sizeof(int) != 4 )
+ abort();
+ pThis->nAlignment[1] = GetAlignment( t_int );
+ if ( sizeof(double) != 8 )
+ abort();
+ pThis->nAlignment[2] = GetAlignment( t_double );
+}
+
+Description_Print( struct Description* pThis, char* name )
+{
+ int i;
+ FILE* f = fopen( name, "w" );
+ fprintf( f, "#define __%s\n",
+ pThis->bBigEndian ? "BIGENDIAN" : "LITTLEENDIAN" );
+ for ( i = 0; i < 3; i++ )
+ fprintf( f, "#define __ALIGNMENT%d\t%d\n",
+ 1 << i+1, pThis->nAlignment[i] );
+ fprintf( f, "#define __STACKALIGNMENT wird nicht benutzt\t%d\n", pThis->nStackAlignment );
+ fprintf( f, "#define __STACKDIRECTION\t%d\n",
+ pThis->bStackGrowsDown ? -1 : 1 );
+ fprintf( f, "#define __SIZEOFCHAR\t%d\n", sizeof( char ) );
+ fprintf( f, "#define __SIZEOFSHORT\t%d\n", sizeof( short ) );
+ fprintf( f, "#define __SIZEOFINT\t%d\n", sizeof( int ) );
+ fprintf( f, "#define __SIZEOFLONG\t%d\n", sizeof( long ) );
+ fprintf( f, "#define __SIZEOFPOINTER\t%d\n", sizeof( void* ) );
+ fprintf( f, "#define __SIZEOFDOUBLE\t%d\n", sizeof( double ) );
+ fprintf( f, "#define __IEEEDOUBLE\n" );
+ fprintf( f, "#define _SOLAR_NODESCRIPTION\n" );
+}
+
+#ifdef WNT
+__cdecl
+#endif
+main( int argc, char* argv[] )
+{
+ printTypeSign( char, "char" );
+ printTypeSign( short, "short" );
+ printTypeSign( int, "int" );
+ printTypeSign( long, "long" );
+
+ printTypeSize( char, "char" );
+ printTypeSize( short, "short" );
+ printTypeSize( int, "int" );
+ printTypeSize( long, "long" );
+ printTypeSize( float, "float" );
+ printTypeSize( double, "double" );
+ printTypeSize( void *, "void *" );
+
+ if ( IsBigEndian() )
+ printf( "BIGENDIAN (Sparc, MC680x0, RS6000)\n" );
+ else
+ printf( "LITTLEENDIAN (Intel, VAX, PowerPC)\n" );
+
+ if( IsStackGrowingDown() )
+ printf( "Stack waechst nach unten\n" );
+ else
+ printf( "Stack waechst nach oben\n" );
+
+ printf( "STACKALIGNMENT : %d\n", GetStackAlignment() );
+
+ PrintArgs( 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 );
+
+ {
+ char a[64];
+ int i = 56;
+ do
+ {
+ printf( "Zugriff long auf %i-Aligned Adresse : ", i / 7 );
+ printf( ( CheckGetAccess( t_long, (long*)&a[i] ) ? "OK\n" : "ERROR\n" ) );
+ i >>= 1;
+ } while( i >= 7 );
+ }
+
+ {
+ char a[64];
+ int i = 56;
+ do
+ {
+ printf( "Zugriff double auf %i-Aligned Adresse : ", i / 7 );
+ printf( ( CheckGetAccess( t_double, (double*)&a[i] ) ? "OK\n" : "ERROR\n" ) );
+ i >>= 1;
+ } while( i >= 7 );
+ }
+
+ {
+ char* p = NULL;
+ CheckCharAccess( p );
+ p = (char*)&p;
+ CheckCharAccess( p );
+ }
+
+ if ( argc > 1 )
+ {
+ struct Description description;
+ Description_Ctor( &description );
+ Description_Print( &description, argv[1] );
+ }
+
+ exit( 0 );
+ return 0;
+}
diff --git a/tools/workben/tldem.cxx b/tools/workben/tldem.cxx
new file mode 100644
index 000000000000..842fe8fef20f
--- /dev/null
+++ b/tools/workben/tldem.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: tldem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:12 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <fsys.hxx>
+#include <stream.hxx>
+#include <sstring.hxx>
+
+int
+#ifdef WNT
+__cdecl
+#endif
+main( int argc, char **argv )
+{
+ String aString;
+ aString = "*.*";
+ Dir aDir(aString);
+ SvFileStream aFile;
+ SvFileStream aSortedFile;
+
+ StringList *pList = new StringList;
+ SStringList *pSortedList = new SStringList;
+ ULONG nCount = aDir.Count();
+
+ for ( ULONG i=0; i<nCount; i++ )
+ {
+ aString = aDir[i].GetName();
+ pList->Insert( new String( aString ), LIST_APPEND );
+ pSortedList->PutString( new String( aString ));
+ }
+
+ aFile.Open( "test.dir", STREAM_WRITE );
+ for ( ULONG j=0; j<nCount; j++ )
+ {
+ aFile.WriteLine( *pList->GetObject(j) );
+ }
+ aFile.Close();
+
+
+ aSortedFile.Open( "stest.dir", STREAM_WRITE );
+ for ( ULONG k=0; k<nCount; k++ )
+ {
+ aSortedFile.WriteLine( *pSortedList->GetObject(k) );
+ }
+ if ( pSortedList->IsString( new String("bloedString")) != NOT_THERE )
+ aSortedFile.WriteLine( "Fehler !" );
+ if ( pSortedList->IsString( new String(".")) == NOT_THERE )
+ aSortedFile.WriteLine( "Fehler ?!?" );
+ aSortedFile.Close();
+
+ delete pList;
+ delete pSortedList;
+ return 0;
+}
+
+
diff --git a/transex3/prj/d.lst b/transex3/prj/d.lst
new file mode 100644
index 000000000000..0b107da0280e
--- /dev/null
+++ b/transex3/prj/d.lst
@@ -0,0 +1,2 @@
+..\%__SRC%\bin\xmlex.exe %_DEST%\bin%_EXT%\xmlex.exe
+..\%__SRC%\bin\xmlex %_DEST%\bin%_EXT%\xmlex
diff --git a/transex3/source/export.cxx b/transex3/source/export.cxx
new file mode 100644
index 000000000000..296124592b8e
--- /dev/null
+++ b/transex3/source/export.cxx
@@ -0,0 +1,2418 @@
+/*************************************************************************
+ *
+ * $RCSfile: export.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <tools/fsys.hxx>
+#include <bootstrp/appdef.hxx>
+#include "export.hxx"
+#include "wrdtrans.hxx"
+#include "tokens.h"
+
+extern "C" { yyerror( char * ); }
+extern "C" { YYWarning( char * ); }
+
+Export *pExport = 0L;
+
+// defines to parse command line
+#define STATE_NON 0x0001
+#define STATE_INPUT 0x0002
+#define STATE_OUTPUT 0x0003
+#define STATE_PRJ 0x0004
+#define STATE_ROOT 0x0005
+#define STATE_MERGESRC 0x0006
+#define STATE_ERRORLOG 0x0007
+#define STATE_BREAKHELP 0x0008
+#define STATE_UNMERGE 0x0009
+
+// set of global variables
+DECLARE_LIST( FileList, ByteString * );
+FileList aInputFileList;
+BOOL bEnableExport;
+BOOL bMergeMode;
+BOOL bErrorLog;
+BOOL bBreakWhenHelpText;
+BOOL bUnmerge;
+ByteString sPrj;
+ByteString sPrjRoot;
+ByteString sActFileName;
+ByteString sOutputFile;
+ByteString sMergeSrc;
+MergeDataFile *pMergeDataFile;
+
+extern "C" {
+// the whole interface to lexer is in this extern "C" section
+
+/*****************************************************************************/
+extern char *GetOutputFile( int argc, char* argv[])
+/*****************************************************************************/
+{
+ bEnableExport = FALSE;
+ bMergeMode = FALSE;
+ bErrorLog = TRUE;
+ bBreakWhenHelpText = FALSE;
+ bUnmerge = FALSE;
+ sPrj = "";
+ sPrjRoot = "";
+ sActFileName = "";
+
+ USHORT nState = STATE_NON;
+ BOOL bInput = FALSE;
+
+ // parse command line
+ for( int i = 1; i < argc; i++ ) {
+ if (( ByteString( argv[ i ]) == "-i" ) || ( argv[ i ] == "-I" )) {
+ nState = STATE_INPUT; // next tokens specifies source files
+ }
+ else if (( ByteString( argv[ i ]) == "-o" ) || ( argv[ i ] == "-O" )) {
+ nState = STATE_OUTPUT; // next token specifies the dest file
+ }
+ else if (( ByteString( argv[ i ]) == "-p" ) || ( argv[ i ] == "-P" )) {
+ nState = STATE_PRJ; // next token specifies the cur. project
+ }
+ else if (( ByteString( argv[ i ]) == "-r" ) || ( argv[ i ] == "-R" )) {
+ nState = STATE_ROOT; // next token specifies path to project root
+ }
+ else if (( ByteString( argv[ i ]) == "-m" ) || ( argv[ i ] == "-M" )) {
+ nState = STATE_MERGESRC; // next token specifies the merge database
+ }
+ else if (( ByteString( argv[ i ]) == "-e" ) || ( argv[ i ] == "-E" )) {
+ nState = STATE_ERRORLOG;
+ bErrorLog = FALSE;
+ }
+ else if (( ByteString( argv[ i ]) == "-b" ) || ( argv[ i ] == "-B" )) {
+ nState = STATE_BREAKHELP;
+ bBreakWhenHelpText = TRUE;
+ }
+ else if (( ByteString( argv[ i ]) == "-u" ) || ( argv[ i ] == "-U" )) {
+ nState = STATE_UNMERGE;
+ bUnmerge = TRUE;
+ bMergeMode = TRUE;
+ }
+ else {
+ switch ( nState ) {
+ case STATE_NON: {
+ return NULL; // no valid command line
+ }
+ break;
+ case STATE_INPUT: {
+ aInputFileList.Insert( new ByteString( argv[ i ]), LIST_APPEND );
+ bInput = TRUE; // min. one source file found
+ }
+ break;
+ case STATE_OUTPUT: {
+ sOutputFile = ByteString( argv[ i ]); // the dest. file
+ }
+ break;
+ case STATE_PRJ: {
+ sPrj = ByteString( argv[ i ]);
+ sPrj.ToLowerAscii(); // the project
+ }
+ break;
+ case STATE_ROOT: {
+ sPrjRoot = ByteString( argv[ i ]); // path to project root
+ }
+ break;
+ case STATE_MERGESRC: {
+ sMergeSrc = ByteString( argv[ i ]);
+ bMergeMode = TRUE; // activate merge mode, cause merge database found
+ }
+ break;
+ }
+ }
+ }
+
+ if ( bInput ) {
+ // command line is valid
+ bEnableExport = TRUE;
+ char *pReturn = new char[ sOutputFile.Len() + 1 ];
+ strcpy( pReturn, sOutputFile.GetBuffer());
+ return pReturn;
+ }
+
+ // command line is not valid
+ return NULL;
+}
+
+/*****************************************************************************/
+int InitExport( char *pOutput )
+/*****************************************************************************/
+{
+ // instanciate Export
+ ByteString sOutput( pOutput );
+
+ if ( bMergeMode && !bUnmerge ) {
+ // merge mode enabled, so read database
+ pExport = new Export(sOutput, bEnableExport, sPrj, sPrjRoot, sMergeSrc);
+ }
+ else
+ // no merge mode, only export
+ pExport = new Export( sOutput, bEnableExport, sPrj, sPrjRoot );
+ return 1;
+}
+
+/*****************************************************************************/
+int EndExport()
+/*****************************************************************************/
+{
+ delete pExport;
+ return 1;
+}
+
+/*****************************************************************************/
+extern FILE *GetNextFile()
+/*****************************************************************************/
+{
+ // look for next valid filename in input file list
+ while ( aInputFileList.Count()) {
+ ByteString sFileName( *(aInputFileList.GetObject( 0 )));
+ delete aInputFileList.GetObject(( ULONG ) 0 );
+ aInputFileList.Remove(( ULONG ) 0 );
+
+ // able to open file?
+ FILE *pFile = fopen( sFileName.GetBuffer(), "r" );
+ if ( !pFile )
+ fprintf( stderr, "Error: Could not open File %s\n",
+ sFileName.GetBuffer());
+ else {
+ // this is a valid file which can be opened, so
+ // create path to project root
+ DirEntry aEntry( String( sFileName, RTL_TEXTENCODING_ASCII_US ));
+ aEntry.ToAbs();
+ ByteString sFullEntry( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US ));
+ aEntry += DirEntry( sPrjRoot );
+ ByteString sPrjEntry( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
+
+ // create file name, beginnig with project root
+ // (e.g.: source\ui\src\menue.src)
+ sActFileName = sFullEntry.Copy( sPrjEntry.Len() + 1 );
+ sActFileName.ToLowerAscii();
+
+ fprintf( stdout, "\nProcessing File %s ...\n", sFileName.GetBuffer());
+ if ( pExport ) {
+ // create instance of class export
+ pExport->Init();
+ }
+ // return the valid file handle
+ return pFile;
+ }
+ }
+ // this means the file could not be opened
+ return NULL;
+}
+
+/*****************************************************************************/
+int WorkOnTokenSet( int nTyp, char *pTokenText )
+/*****************************************************************************/
+{
+ // execute token
+ pExport->Execute( nTyp, pTokenText );
+ return 1;
+}
+}
+
+extern "C" {
+/*****************************************************************************/
+int SetError()
+/*****************************************************************************/
+{
+ // set error at global instance of class Export
+ pExport->SetError();
+ return 1;
+}
+}
+
+extern "C" {
+/*****************************************************************************/
+int GetError()
+/*****************************************************************************/
+{
+ // get error at global instance of class Export
+ if ( pExport->GetError())
+ return 1;
+ return FALSE;
+}
+}
+
+//
+// class ResData
+//
+
+/*****************************************************************************/
+BOOL ResData::SetId( const ByteString &rId, USHORT nLevel )
+/*****************************************************************************/
+{
+ if ( nLevel > nIdLevel )
+ {
+ nIdLevel = nLevel;
+ sId = rId;
+
+ if ( bChild && bChildWithText ) {
+ ByteString sError( "ResId after child definition" );
+ yyerror( sError.GetBufferAccess());
+ sError.ReleaseBufferAccess();
+ SetError();
+ }
+
+ if ( sId.Len() > 255 ) {
+ ByteString sWarning( "LocalId > 255 chars, truncating..." );
+ YYWarning( sWarning.GetBufferAccess());
+ sWarning.ReleaseBufferAccess();
+ sId.Erase( 255 );
+ sId.EraseTrailingChars( ' ' );
+ sId.EraseTrailingChars( '\t' );
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+//
+// class Export
+//
+
+
+/*****************************************************************************/
+const ByteString Export::LangName[ LANGUAGES ] =
+/*****************************************************************************/
+{
+ "language_user1",
+ "english_us",
+ "portuguese",
+ "german_de",
+ "russian",
+ "greek",
+ "dutch",
+ "french",
+ "spanish",
+ "finnish",
+ "hungarian",
+ "italian",
+ "czech",
+ "slovak",
+ "english",
+ "danish",
+ "swedish",
+ "norwegian",
+ "polish",
+ "german",
+ "portuguese_brazilian",
+ "japanese",
+ "korean",
+ "chinese_simplified",
+ "chinese_traditional",
+ "turkish",
+ "arabic",
+ "hebrew"
+};
+
+/*****************************************************************************/
+Export::Export( const ByteString &rOutput, BOOL bWrite,
+ const ByteString &rPrj, const ByteString &rPrjRoot )
+/*****************************************************************************/
+ : nLevel( 0 ),
+ nListIndex( 0 ),
+ bDefine( FALSE ),
+ bNextMustBeDefineEOL( FALSE ),
+ nList( LIST_NON ),
+ bError( FALSE ),
+ bEnableExport( bWrite ),
+ sProject( sPrj ),
+ sRoot( sPrjRoot ),
+ bMergeMode( bUnmerge ),
+ bReadOver( FALSE ),
+ aCharSet( RTL_TEXTENCODING_MS_1252 ),
+ bDontWriteOutput( FALSE ),
+ nListLevel( 0 ),
+ pWordTransformer( NULL )
+{
+ // used when export is enabled
+
+ // open output stream
+ if ( bEnableExport ) {
+ aOutput.Open( String( rOutput, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_WRITE | STREAM_TRUNC );
+ aOutput.SetStreamCharSet( RTL_TEXTENCODING_MS_1252 );
+// aOutput.SetTargetCharSet( RTL_TEXTENCODING_MS_1252 );
+ }
+
+ // looking in environment for given transformation file for german text
+ ByteString sTransformFile( GetEnv( "TRANSEXTRANSFORM" ));
+ if ( sTransformFile.Len()) {
+ pWordTransformer = new WordTransformer();
+ if( !pWordTransformer->LoadWordlist( sTransformFile )) {
+ fprintf( stderr, "ERROR: Wordlist %s does not exist!\n" ,
+ sTransformFile.GetBuffer());
+ delete pWordTransformer;
+ pWordTransformer = NULL;
+ }
+ }
+}
+
+/*****************************************************************************/
+Export::Export( const ByteString &rOutput, BOOL bWrite,
+ const ByteString &rPrj, const ByteString &rPrjRoot,
+ const ByteString &rMergeSource )
+/*****************************************************************************/
+ : nLevel( 0 ),
+ nListIndex( 0 ),
+ bDefine( FALSE ),
+ bNextMustBeDefineEOL( FALSE ),
+ nList( LIST_NON ),
+ bError( FALSE ),
+ bEnableExport( bWrite ),
+ sProject( sPrj ),
+ sRoot( sPrjRoot ),
+ bMergeMode( TRUE ),
+ bReadOver( FALSE ),
+ sMergeSrc( rMergeSource ),
+ aCharSet( RTL_TEXTENCODING_MS_1252 ),
+ bDontWriteOutput( FALSE ),
+ nListLevel( 0 ),
+ pWordTransformer( NULL )
+{
+ // used when merge is enabled
+
+ // open output stream
+ if ( bEnableExport )
+ aOutput.Open( String( rOutput, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_WRITE | STREAM_TRUNC );
+
+ // looking in environment for given transformation file for german text
+ ByteString sTransformFile( GetEnv( "TRANSEXTRANSFORM" ));
+ if ( sTransformFile.Len()) {
+ pWordTransformer = new WordTransformer();
+ if( !pWordTransformer->LoadWordlist( sTransformFile )) {
+ fprintf( stderr, "ERROR: Wordlist %s does not exist!\n" ,
+ sTransformFile.GetBuffer());
+ delete pWordTransformer;
+ pWordTransformer = NULL;
+ }
+ }
+}
+
+/*****************************************************************************/
+void Export::Init()
+/*****************************************************************************/
+{
+ // resets the internal status, used before parseing another file
+ sActPForm = "";
+ bDefine = FALSE;
+ bNextMustBeDefineEOL = FALSE;
+ nLevel = 0;
+ nList = LIST_NON;
+ nListLang = 0;
+ nListIndex = 0;
+ while ( aResStack.Count()) {
+ delete aResStack.GetObject(( ULONG ) 0 );
+ aResStack.Remove(( ULONG ) 0 );
+ }
+}
+
+/*****************************************************************************/
+Export::~Export()
+/*****************************************************************************/
+{
+ // close transformer for german text
+ if ( pWordTransformer )
+ delete pWordTransformer;
+
+ // close output stream
+ if ( bEnableExport )
+ aOutput.Close();
+ while ( aResStack.Count()) {
+ delete aResStack.GetObject(( ULONG ) 0 );
+ aResStack.Remove(( ULONG ) 0 );
+ }
+
+ if ( bMergeMode && !bUnmerge ) {
+ if ( !pMergeDataFile )
+ pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet );
+
+ pMergeDataFile->WriteErrorLog( sActFileName );
+ delete pMergeDataFile;
+ }
+}
+
+/*****************************************************************************/
+int Export::Execute( int nToken, char * pToken )
+/*****************************************************************************/
+{
+ ByteString sToken( pToken );
+ ByteString sOrig( sToken );
+ BOOL bWriteToMerged = bMergeMode;
+
+ if ( nToken == CONDITION ) {
+ ByteString sTestToken( pToken );
+ sTestToken.EraseAllChars( '\t' );
+ sTestToken.EraseAllChars( ' ' );
+ if (( !bReadOver ) && ( sTestToken.Search( "#ifndef__RSC_PARSER" ) == 0 ))
+ bReadOver = TRUE;
+ else if (( bReadOver ) && ( sTestToken.Search( "#endif" ) == 0 ))
+ bReadOver = FALSE;
+ }
+ if ((( nToken < FILTER_LEVEL ) || ( bReadOver )) &&
+ (!(( bNextMustBeDefineEOL ) && ( sOrig == "\n" )))) {
+ // this tokens are not mandatory for parsing, so ignore them ...
+ if ( bMergeMode )
+ WriteToMerged( sOrig ); // ... ore whrite them directly to dest.
+ return 0;
+ }
+
+ ResData *pResData = NULL;
+ if ( nLevel ) {
+ // res. exists at cur. level
+ pResData = aResStack.GetObject( nLevel-1 );
+ }
+ else if (( nToken != RESSOURCE ) &&
+ ( nToken != RESSOURCEEXPR ) &&
+ ( nToken != SMALRESSOURCE ) &&
+ ( nToken != LEVELUP ) &&
+ ( nToken != RSCDEFINE ) &&
+ ( nToken != CONDITION ) &&
+ ( nToken != PRAGMA ))
+ {
+ // no res. exists at cur. level so return
+ if ( bMergeMode )
+ WriteToMerged( sOrig );
+ return 0;
+ }
+
+ if ( bDefine ) {
+ if (( nToken != EMPTYLINE ) && ( nToken != LEVELDOWN ) && ( nToken != LEVELUP )) {
+ // cur. res. defined in macro
+ if ( bNextMustBeDefineEOL ) {
+ if ( nToken != RSCDEFINELEND ) {
+ // end of macro found, so destroy res.
+ bDefine = FALSE;
+ if ( bMergeMode ) {
+ if ( bDontWriteOutput && bUnmerge ) {
+ bDontWriteOutput = FALSE;
+ bNextMustBeDefineEOL = FALSE;
+ bDefine = TRUE;
+ }
+ MergeRest( pResData );
+ }
+ bNextMustBeDefineEOL = FALSE;
+ char *pTkn = "";
+ Execute( LEVELDOWN, pTkn );
+ }
+ else {
+ // next line also in macro definition
+ bNextMustBeDefineEOL = FALSE;
+ if ( bMergeMode )
+ WriteToMerged( sOrig );
+ return 1;
+ }
+ }
+ else if (( nToken != LISTASSIGNMENT ) && ( nToken != UIENTRIES )){
+ // cur. line has macro line end
+ ByteString sTmpLine( sToken );
+ sTmpLine.EraseAllChars( '\t' ); sTmpLine.EraseAllChars( ' ' );
+ if ( sTmpLine.GetChar(( USHORT )( sTmpLine.Len() - 1 )) != '\\' )
+ bNextMustBeDefineEOL = TRUE;
+ }
+ }
+ }
+
+ BOOL bExecuteDown = FALSE;
+ if ( nToken != LEVELDOWN ) {
+ USHORT nOpen = 0;
+ USHORT nClose = 0;
+ BOOL bReadOver = FALSE;
+
+ for ( USHORT i = 0; i < sToken.Len(); i++ ) {
+ if ( sToken.GetChar( i ) == '\"' )
+ bReadOver = !bReadOver;
+ if ( !bReadOver && ( sToken.GetChar( i ) == '{' ))
+ nOpen++;
+ }
+
+ bReadOver = FALSE;
+ for ( i = 0; i < sToken.Len(); i++ ) {
+ if ( sToken.GetChar( i ) == '\"' )
+ bReadOver = !bReadOver;
+ if ( !bReadOver && ( sToken.GetChar( i ) == '}' ))
+ nClose++;
+ }
+
+ if ( nOpen < nClose )
+ bExecuteDown = TRUE;
+ }
+
+ switch ( nToken ) {
+ case RSCDEFINE:
+ bDefine = TRUE; // res. defined in macro
+ case RESSOURCE:
+ case RESSOURCEEXPR: {
+ bDontWriteOutput = FALSE;
+ if ( nToken != RSCDEFINE )
+ bNextMustBeDefineEOL = FALSE;
+ // this is the beginning of a new res.
+ nLevel++;
+ if ( nLevel > 1 ) {
+ aResStack.GetObject( nLevel - 2 )->bChild = TRUE;
+ }
+
+ // create new instance for this res. and fill mandatory fields
+// if ( pResData )
+// pResData->bChild = TRUE;
+
+ pResData = new ResData( sActPForm, FullId());
+ aResStack.Insert( pResData, LIST_APPEND );
+ ByteString sBackup( sToken );
+ sToken.EraseAllChars( '\n' );
+ sToken.EraseAllChars( '{' );
+ while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
+ sToken.EraseTrailingChars( ' ' );
+ pResData->sResTyp = sToken.GetToken( 0, ' ' ).ToLowerAscii();
+ ByteString sId( sToken.Copy( pResData->sResTyp.Len() + 1 ));
+ ByteString sCondition;
+ if ( sId.Search( "#" ) != STRING_NOTFOUND ) {
+ // between ResTyp, Id and paranthes is a precomp. condition
+ sCondition = "#";
+ sCondition += sId.GetToken( 1, '#' );
+ sId = sId.GetToken( 0, '#' );
+ }
+ sId = sId.GetToken( 0, '/' );
+ CleanValue( sId );
+ sId = sId.EraseAllChars( '\t' );
+ pResData->SetId( sId, ID_LEVEL_IDENTIFIER );
+ if ( sCondition.Len()) {
+ ByteString sEmpty( "" );
+ Execute( CONDITION, sEmpty.GetBufferAccess()); // execute the
+ // precomp.
+ // condition
+ sEmpty.ReleaseBufferAccess();
+ }
+ }
+ break;
+ case SMALRESSOURCE: {
+ bDontWriteOutput = FALSE;
+ // this is the beginning of a new res.
+ bNextMustBeDefineEOL = FALSE;
+ USHORT nIndex = 0;
+/* if ( pResData ) {
+ pResData->nChildIndex++;
+ nIndex = pResData->nChildIndex;
+ } */
+ nLevel++;
+ if ( nLevel > 1 ) {
+ aResStack.GetObject( nLevel - 2 )->bChild = TRUE;
+ }
+
+ // create new instance for this res. and fill mandatory fields
+// if ( pResData )
+// pResData->bChild = TRUE;
+
+ pResData = new ResData( sActPForm, FullId());
+ aResStack.Insert( pResData, LIST_APPEND );
+ sToken.EraseAllChars( '\n' );
+ sToken.EraseAllChars( '{' );
+ sToken.EraseAllChars( '\t' );
+ sToken.EraseAllChars( ' ' );
+ sToken.EraseAllChars( '\\' );
+ pResData->sResTyp = sToken.ToLowerAscii();
+/* if ( nIndex )
+ pResData->SetId( nIndex, ID_LEVEL_AUTOID ); */
+ }
+ break;
+ case LEVELUP: {
+ // push
+ if ( nList )
+ nListLevel++;
+ if ( nList )
+ break;
+
+ bDontWriteOutput = FALSE;
+ ByteString sLowerTyp;
+ if ( pResData )
+ sLowerTyp = "unknown";
+ nLevel++;
+ if ( nLevel > 1 ) {
+ aResStack.GetObject( nLevel - 2 )->bChild = TRUE;
+ }
+
+// if ( pResData )
+// pResData->bChild = TRUE;
+
+ ResData *pNewData = new ResData( sActPForm, FullId());
+ pNewData->sResTyp = sLowerTyp;
+ aResStack.Insert( pNewData, LIST_APPEND );
+ }
+ break;
+ case LEVELDOWN: {
+ // pop
+ if ( !nList ) {
+ bDontWriteOutput = FALSE;
+ if ( nLevel ) {
+ if ( bDefine && (nLevel == 1 )) {
+ bDefine = FALSE;
+ bNextMustBeDefineEOL = FALSE;
+ }
+ WriteData( pResData );
+ delete aResStack.GetObject( nLevel - 1 );
+ aResStack.Remove( nLevel - 1 );
+ nLevel--;
+ }
+ }
+ else {
+ if ( !nListLevel ) {
+ if ( bMergeMode )
+ MergeRest( pResData, MERGE_MODE_LIST );
+ nList = LIST_NON;
+ }
+ else
+ nListLevel--;
+ }
+ }
+ break;
+ case ASSIGNMENT: {
+ bDontWriteOutput = FALSE;
+ // interpret different types of assignement
+ ByteString sKey = sToken.GetToken( 0, '=' );
+ sKey.EraseAllChars( ' ' );
+ sKey.EraseAllChars( '\t' );
+ ByteString sValue = sToken.GetToken( 1, '=' );
+ CleanValue( sValue );
+ if ( sKey.ToUpperAscii() == "IDENTIFIER" ) {
+ ByteString sId( sValue.EraseAllChars( '\t' ));
+ pResData->SetId( sId.EraseAllChars( ' ' ), ID_LEVEL_IDENTIFIER );
+ }
+ else if ( sKey == "HELPID" ) {
+ pResData->sHelpId = sValue;
+ }
+ else if ( sKey == "STRINGLIST" ) {
+ if ( bUnmerge )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ pResData->bList = TRUE;
+ nList = LIST_STRING;
+ ByteString sLang( "GERMAN" );
+ nListLang = GetLangIndex( sLang );
+ nListIndex = 0;
+ nListLevel = 0;
+ }
+ else if ( sKey == "FILTERLIST" ) {
+ if ( bUnmerge )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ pResData->bList = TRUE;
+ nList = LIST_FILTER;
+ ByteString sLang( "GERMAN" );
+ nListLang = GetLangIndex( sLang );
+ nListIndex = 0;
+ nListLevel = 0;
+ }
+ else if ( sKey == "UIENTRIES" ) {
+ if ( bUnmerge )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ pResData->bList = TRUE;
+ nList = LIST_UIENTRIES;
+ ByteString sLang( "GERMAN" );
+ nListLang = GetLangIndex( sLang );
+ nListIndex = 0;
+ nListLevel = 0;
+ }
+ if (( sToken.Search( "{" ) != STRING_NOTFOUND ) &&
+ ( sToken.GetTokenCount( '{' ) > sToken.GetTokenCount( '}' )))
+ {
+ char *pTkn = "";
+ WorkOnTokenSet( LEVELUP, pTkn );
+ }
+ if ( bUnmerge && nListLang == GetLangIndex( "GERMAN" ) && ListExists( pResData, nList ))
+ bDontWriteOutput = TRUE;
+ }
+ break;
+ case UIENTRIES:
+ case LISTASSIGNMENT: {
+ bDontWriteOutput = FALSE;
+ if ( sToken.Search( "[" ) == STRING_NOTFOUND ) {
+ if ( bUnmerge )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ ByteString sKey = sToken.GetToken( 0, '=' );
+ sKey.EraseAllChars( ' ' );
+ sKey.EraseAllChars( '\t' );
+ ByteString sValue = sToken.GetToken( 1, '=' );
+ CleanValue( sValue );
+ if ( sKey.ToUpperAscii() == "STRINGLIST" ) {
+ pResData->bList = TRUE;
+ nList = LIST_STRING;
+ ByteString sLang( "GERMAN" );
+ nListLang = GetLangIndex( sLang );
+ nListIndex = 0;
+ nListLevel = 0;
+ }
+ else if ( sKey == "FILTERLIST" ) {
+ pResData->bList = TRUE;
+ nList = LIST_FILTER;
+ ByteString sLang( "GERMAN" );
+ nListLang = GetLangIndex( sLang );
+ nListIndex = 0;
+ nListLevel = 0;
+ }
+ else if ( sKey == "ITEMLIST" ) {
+ pResData->bList = TRUE;
+ nList = LIST_ITEM;
+ ByteString sLang( "GERMAN" );
+ nListLang = GetLangIndex( sLang );
+ nListIndex = 0;
+ nListLevel = 0;
+ }
+ else if ( sKey == "UIENTRIES" ) {
+ pResData->bList = TRUE;
+ nList = LIST_UIENTRIES;
+ ByteString sLang( "GERMAN" );
+ nListLang = GetLangIndex( sLang );
+ nListIndex = 0;
+ nListLevel = 0;
+ }
+ if ( bUnmerge && nListLang == GetLangIndex( "GERMAN" ) && ListExists( pResData, nList ))
+ bDontWriteOutput = TRUE;
+ }
+ else {
+ // new res. is a String- or FilterList
+ ByteString sKey = sToken.GetToken( 0, '[' );
+ sKey.EraseAllChars( ' ' );
+ sKey.EraseAllChars( '\t' );
+ if ( sKey.ToUpperAscii() == "STRINGLIST" )
+ nList = LIST_STRING;
+ else if ( sKey == "FILTERLIST" )
+ nList = LIST_FILTER;
+ else if ( sKey == "ITEMLIST" )
+ nList = LIST_ITEM;
+ else if ( sKey == "UIENTRIES" )
+ nList = LIST_UIENTRIES;
+ if ( nList ) {
+ ByteString sLang=sToken.GetToken( 1, '[' ).GetToken( 0, ']' );
+ CleanValue( sLang );
+ nListLang = GetLangIndex( sLang );
+ if (( bUnmerge ) && ( nListLang != GERMAN_INDEX ) && ( nListLang != ENGLISH_INDEX ))
+ bDontWriteOutput = TRUE;
+ nListIndex = 0;
+ nListLevel = 0;
+ if ( bUnmerge && nListLang == GetLangIndex( "GERMAN" ) && ListExists( pResData, nList ))
+ bDontWriteOutput = TRUE;
+ }
+ }
+ }
+ break;
+ case TEXT:
+ case _LISTTEXT:
+ case LISTTEXT: {
+// bDontWriteOutput = FALSE;
+ // this is an entry for a String- or FilterList
+ if ( nList ) {
+ SetChildWithText();
+ ByteString sEntry( sToken.GetToken( 1, '\"' ));
+ sEntry = sEntry.Convert( aCharSet, RTL_TEXTENCODING_MS_1252 );
+ InsertListEntry( sEntry, sOrig );
+ if ( bMergeMode )
+ PrepareTextToMerge( sOrig, nList, nListLang, pResData );
+ }
+ }
+ break;
+ case LONGTEXTLINE:
+ case TEXTLINE:
+ bDontWriteOutput = FALSE;
+ if ( nLevel ) {
+ CutComment( sToken );
+
+ // this is a text line!!!
+ ByteString sKey = sToken.GetToken( 0, '=' ).GetToken( 0, '[' );
+ sKey.EraseAllChars( ' ' );
+ sKey.EraseAllChars( '\t' );
+ ByteString sText( GetText( sToken, nToken ));
+ if ( !bMergeMode )
+ sText = sText.Convert( aCharSet, RTL_TEXTENCODING_MS_1252 );
+ ByteString sLang( "GERMAN" );
+ if ( sToken.GetToken( 0, '=' ).Search( "[" ) != STRING_NOTFOUND ) {
+ sLang = sToken.GetToken( 0, '=' ).GetToken( 1, '[' ).GetToken( 0, ']' );
+ CleanValue( sLang );
+ }
+ USHORT nLangIndex = GetLangIndex( sLang );
+ ByteString sOrigKey = sKey;
+ if ( sText.Len()) {
+ if (( sKey.ToUpperAscii() == "TEXT" ) ||
+ ( sKey == "MESSAGE" ) ||
+ ( sKey == "CUSTOMUNITTEXT" ) ||
+ ( sKey == "SLOTNAME" ) ||
+ ( sKey == "UINAME" ))
+ {
+ if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ SetChildWithText();
+ if ( nLangIndex == GERMAN_INDEX )
+ pResData->SetId( sText, ID_LEVEL_TEXT );
+ pResData->bText = TRUE;
+ pResData->sTextTyp = sOrigKey;
+ if ( bMergeMode ) {
+ PrepareTextToMerge( sOrig, STRING_TYP_TEXT, nLangIndex, pResData );
+ if ( bUnmerge )
+ pResData->sText[ nLangIndex ] = sText;
+ }
+ else {
+ if ( pResData->sText[ nLangIndex ].Len()) {
+ ByteString sError( "Language " );
+ sError += LangName[ nLangIndex ];
+ sError += " defined twice";
+ YYWarning( sError.GetBufferAccess());
+ sError.ReleaseBufferAccess();
+ }
+ pResData->sText[ nLangIndex ] = sText;
+ }
+ }
+ else if ( sKey == "HELPTEXT" ) {
+ if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ SetChildWithText();
+ pResData->bHelpText = TRUE;
+ if ( bBreakWhenHelpText ) {
+ ByteString sError( "\"HelpText\" found in source\n" );
+ YYWarning( sError.GetBufferAccess());
+ sError.ReleaseBufferAccess();
+ SetError();
+ }
+ if ( bMergeMode )
+ PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, nLangIndex, pResData );
+ if ( bUnmerge )
+ pResData->sHelpText[ nLangIndex ] = sText;
+ else {
+ if ( pResData->sHelpText[ nLangIndex ].Len()) {
+ ByteString sError( "Language " );
+ sError += LangName[ nLangIndex ];
+ sError += " defined twice";
+ YYWarning( sError.GetBufferAccess());
+ sError.ReleaseBufferAccess();
+ }
+ pResData->sHelpText[ nLangIndex ] = sText;
+ }
+ }
+ else if ( sKey == "QUICKHELPTEXT" ) {
+ if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ SetChildWithText();
+ pResData->bQuickHelpText = TRUE;
+ if ( bMergeMode )
+ PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, nLangIndex, pResData );
+ if ( bUnmerge )
+ pResData->sQuickHelpText[ nLangIndex ] = sText;
+ else {
+ if ( pResData->sQuickHelpText[ nLangIndex ].Len()) {
+ ByteString sError( "Language " );
+ sError += LangName[ nLangIndex ];
+ sError += " defined twice";
+ YYWarning( sError.GetBufferAccess());
+ sError.ReleaseBufferAccess();
+ }
+ pResData->sQuickHelpText[ nLangIndex ] = sText;
+ }
+ }
+ else if ( sKey == "TITLE" ) {
+ if ( bUnmerge && sToken.GetToken( 0, '=' ).Search( "[" ) == STRING_NOTFOUND )
+ ( sOrig.SearchAndReplace( "=", "[ GERMAN ] =" ));
+ SetChildWithText();
+ pResData->bTitle = TRUE;
+ if ( bMergeMode )
+ PrepareTextToMerge( sOrig, STRING_TYP_TITLE, nLangIndex, pResData );
+ if ( bUnmerge )
+ pResData->sTitle[ nLangIndex ] = sText;
+ else {
+ if ( pResData->sTitle[ nLangIndex ].Len()) {
+ ByteString sError( "Language " );
+ sError += LangName[ nLangIndex ];
+ sError += " defined twice";
+ YYWarning( sError.GetBufferAccess());
+ sError.ReleaseBufferAccess();
+ }
+ pResData->sTitle[ nLangIndex ] = sText;
+ }
+ }
+ else if ( sKey == "ACCESSPATH" ) {
+ pResData->SetId( sText, ID_LEVEL_ACCESSPATH );
+ }
+ else if ( sKey == "FIELDNAME" ) {
+ pResData->SetId( sText, ID_LEVEL_FIELDNAME );
+ }
+ }
+ }
+ break;
+ case NEWTEXTINRES: {
+ bDontWriteOutput = TRUE;
+ // this means something like // ### Achtung : Neuer Text ...
+ ByteString sLang( "GERMAN" );
+ USHORT nLangIndex = GetLangIndex( sLang );
+ ByteString sText = sToken.GetToken( 2, ':' ).GetToken( 0, '*' );
+ CleanValue( sText );
+ if ( sText.Len())
+ pResData->sText[ nLangIndex ] = sText;
+ }
+ break;
+ case APPFONTMAPPING: {
+ bDontWriteOutput = FALSE;
+ // this is a AppfontMapping, so look if its a definition
+ // of field size
+ ByteString sKey = sToken.GetToken( 0, '=' );
+ sKey.EraseAllChars( ' ' );
+ sKey.EraseAllChars( '\t' );
+ ByteString sMapping = sToken.GetToken( 1, '=' );
+ sMapping = sMapping.GetToken( 1, '(' );
+ sMapping = sMapping.GetToken( 0, ')' );
+ sMapping.EraseAllChars( ' ' );
+ sMapping.EraseAllChars( '\t' );
+ if ( sKey.ToUpperAscii() == "SIZE" ) {
+ pResData->nWidth = sMapping.GetToken( 0, ',' ).ToInt64();
+ }
+ else if ( sKey == "POSSIZE" ) {
+ pResData->nWidth = sMapping.GetToken( 2, ',' ).ToInt64();
+ }
+ }
+ break;
+ case RSCDEFINELEND:
+ bDontWriteOutput = FALSE;
+ break;
+ case CONDITION: {
+ bDontWriteOutput = FALSE;
+ while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
+ while( sToken.SearchAndReplace( " ", " " ) != STRING_NOTFOUND ) {};
+ ByteString sCondition = sToken.GetToken( 0, ' ' );
+ if ( sCondition == "#ifndef" ) {
+ sActPForm = "!defined ";
+ sActPForm += sToken.GetToken( 1, ' ' );
+ }
+ else if ( sCondition == "#ifdef" ) {
+ sActPForm = "defined ";
+ sActPForm += sToken.GetToken( 1, ' ' );
+ }
+ else if ( sCondition == "#if" ) {
+ sActPForm = sToken.Copy( 4 );
+ while ( sActPForm.SearchAndReplace( "||", "\\or" ) != STRING_NOTFOUND ) {};
+ }
+ else if ( sCondition == "#elif" ) {
+ sActPForm = sToken.Copy( 6 );
+ while ( sActPForm.SearchAndReplace( "||", "\\or" ) != STRING_NOTFOUND ) {};
+ }
+ else if ( sCondition == "#else" ) {
+ sActPForm = sCondition;
+ }
+ else if ( sCondition == "#endif" ) {
+ sActPForm = "";
+ }
+ else break;
+ if ( nLevel ) {
+ WriteData( pResData, TRUE );
+ pResData->sPForm = sActPForm;
+ }
+ }
+ break;
+ case EMPTYLINE : {
+ bDontWriteOutput = FALSE;
+ if ( bDefine ) {
+ bNextMustBeDefineEOL = FALSE;
+ bDefine = FALSE;
+ char *pTkn = "";
+ while ( nLevel )
+ WorkOnTokenSet( LEVELDOWN, pTkn );
+ }
+ }
+ break;
+ case PRAGMA : {
+ bDontWriteOutput = FALSE;
+ while( sToken.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
+ while( sToken.SearchAndReplace( " ", " " ) != STRING_NOTFOUND ) {};
+ sToken.EraseLeadingChars( ' ' );
+ sToken.EraseTrailingChars( ' ' );
+
+ ByteString sCharset = sToken.GetToken( 1, ' ' );
+ ByteString sSet = sToken.GetToken( 2, ' ' );
+ if (( sCharset.ToUpperAscii() == "CHARSET_IBMPC" ) ||
+ ( sCharset == "RTL_TEXTENCODING_IBM_850" ) ||
+ (( sCharset == "CHARSET" ) && ( sSet.ToUpperAscii() == "IBMPC" )))
+ {
+ aCharSet = RTL_TEXTENCODING_IBM_850;
+ }
+ else if (( sCharset == "CHARSET_ANSI" ) ||
+ ( sCharset == "RTL_TEXTENCODING_MS_1252" ) ||
+ (( sCharset == "CHARSET" ) && ( sSet.ToUpperAscii() == "ANSI" )))
+ {
+ aCharSet = RTL_TEXTENCODING_MS_1252;
+ }
+ }
+ break;
+ case TEXTREFID : {
+ bDontWriteOutput = TRUE;
+ ByteString sKey = sToken.GetToken( 0, '=' ).EraseAllChars( '\t' ).EraseAllChars( ' ' );
+ USHORT nRefId = sToken.GetToken( 1, '=' ).GetToken( 0, ';' ).EraseAllChars( '\t' ).EraseAllChars( ' ' ).ToInt32();
+ if (( sKey.ToUpperAscii() == "TEXT" ) ||
+ ( sKey == "MESSAGE" ) ||
+ ( sKey == "CUSTOMUNITTEXT" ) ||
+ ( sKey == "SLOTNAME" ) ||
+ ( sKey == "UINAME" ))
+ pResData->nTextRefId = nRefId;
+ else if ( sKey == "HELPTEXT" )
+ pResData->nHelpTextRefId = nRefId;
+ else if ( sKey == "QUICKHELPTEXT" )
+ pResData->nQuickHelpTextRefId = nRefId;
+ else if ( sKey == "TITLE" )
+ pResData->nTitleRefId = nRefId;
+ }
+ }
+ if ( bWriteToMerged ) {
+ // the current token must be written to dest. without merging
+ WriteToMerged( sOrig );
+ }
+
+ if ( bExecuteDown ) {
+ char *pTkn = "";
+ WorkOnTokenSet( LEVELDOWN, pTkn );
+ }
+
+ return 1;
+}
+
+/*****************************************************************************/
+void Export::CutComment( ByteString &rText )
+/*****************************************************************************/
+{
+ if ( rText.Search( "//" ) != STRING_NOTFOUND ) {
+ ByteString sWork( rText );
+ sWork.SearchAndReplaceAll( "\\\"", "XX" );
+ USHORT i = 0;
+ BOOL bInner = FALSE;
+
+ while ( i < sWork.Len() - 1 ) {
+ if ( sWork.GetChar( i ) == '\"' )
+ bInner = !bInner;
+ else if
+ (( sWork.GetChar( i ) == '/' ) &&
+ ( !bInner ) &&
+ ( sWork.GetChar( i + 1 ) == '/' ))
+ {
+ rText.Erase( i );
+ return;
+ }
+ i++;
+ }
+ }
+}
+
+/*****************************************************************************/
+BOOL Export::ListExists( ResData *pResData, USHORT nLst )
+/*****************************************************************************/
+{
+ switch ( nLst ) {
+ case LIST_STRING: return pResData->pStringList != NULL; break;
+ case LIST_FILTER: return pResData->pFilterList != NULL; break;
+ case LIST_ITEM: return pResData->pItemList != NULL; break;
+ case LIST_UIENTRIES: return pResData->pUIEntries != NULL; break;
+ }
+ return FALSE;
+}
+
+/*****************************************************************************/
+USHORT Export::GetLangIndex( const ByteString &rLang )
+/*****************************************************************************/
+{
+ // translation table: LangName <=> Index
+ USHORT nLangIndex = 0;
+ ByteString sLang( rLang );
+
+ if ( sLang.ToUpperAscii() == "LANGUAGE_USER1" )
+ return COMMENT_INDEX;
+ else if ( sLang == "ENGLISH_US" )
+ return ENGLISH_US_INDEX;
+ else if ( sLang == "PORTUGUESE" )
+ return PORTUGUESE_INDEX;
+ else if ( sLang == "RUSSIAN" )
+ return RUSSIAN_INDEX;
+ else if ( sLang == "GREEK" )
+ return GREEK_INDEX;
+ else if ( sLang == "DUTCH" )
+ return DUTCH_INDEX;
+ else if ( sLang == "FRENCH" )
+ return FRENCH_INDEX;
+ else if ( sLang == "SPANISH" )
+ return SPANISH_INDEX;
+ else if ( sLang == "FINNISH" )
+ return FINNISH_INDEX;
+ else if ( sLang == "HUNGARIAN" )
+ return HUNGARIAN_INDEX;
+ else if ( sLang == "ITALIAN" )
+ return ITALIAN_INDEX;
+ else if ( sLang == "CZECH" )
+ return CZECH_INDEX;
+ else if ( sLang == "SLOVAK" )
+ return SLOVAK_INDEX;
+ else if ( sLang == "ENGLISH" )
+ return ENGLISH_INDEX;
+ else if ( sLang == "DANISH" )
+ return DANISH_INDEX;
+ else if ( sLang == "SWEDISH" )
+ return SWEDISH_INDEX;
+ else if ( sLang == "NORWEGIAN" )
+ return NORWEGIAN_INDEX;
+ else if ( sLang == "POLISH" )
+ return POLISH_INDEX;
+ else if ( sLang == "GERMAN" )
+ return GERMAN_INDEX;
+ else if ( sLang == "PORTUGUESE_BRAZILIAN" )
+ return PORTUGUESE_BRAZILIAN_INDEX;
+ else if ( sLang == "JAPANESE" )
+ return JAPANESE_INDEX;
+ else if ( sLang == "KOREAN" )
+ return KOREAN_INDEX;
+ else if ( sLang == "CHINESE_SIMPLIFIED" )
+ return CHINESE_SIMPLIFIED_INDEX;
+ else if ( sLang == "CHINESE_TRADITIONAL" )
+ return CHINESE_TRADITIONAL_INDEX;
+ else if ( sLang == "TURKISH" )
+ return TURKISH_INDEX;
+ else if ( sLang == "ARABIC" )
+ return ARABIC_INDEX;
+ else if ( sLang == "HEBREW" )
+ return HEBREW_INDEX;
+
+ return nLangIndex;
+}
+
+/*****************************************************************************/
+BOOL Export::WriteData( ResData *pResData, BOOL bCreateNew )
+/*****************************************************************************/
+{
+ if ( bMergeMode ) {
+ MergeRest( pResData );
+ return TRUE;
+ }
+
+ if ( bUnmerge )
+ return TRUE;
+// fprintf( stdout, "." );
+
+ // mandatory to export: german and eng. and/or enus
+ if (( pResData->sText[ GERMAN_INDEX ].Len() &&
+ ( pResData->sText[ ENGLISH_US_INDEX ].Len() ||
+ pResData->sText[ ENGLISH_INDEX ].Len())) ||
+ ( pResData->sHelpText[ GERMAN_INDEX ].Len() &&
+ ( pResData->sHelpText[ ENGLISH_US_INDEX ].Len() ||
+ pResData->sHelpText[ ENGLISH_INDEX ].Len())) ||
+ ( pResData->sQuickHelpText[ GERMAN_INDEX ].Len() &&
+ ( pResData->sQuickHelpText[ ENGLISH_US_INDEX ].Len() ||
+ pResData->sQuickHelpText[ ENGLISH_INDEX ].Len()))||
+ ( pResData->sTitle[ GERMAN_INDEX ].Len() &&
+ ( pResData->sTitle[ ENGLISH_US_INDEX ].Len() ||
+ pResData->sTitle[ ENGLISH_INDEX ].Len())))
+ {
+ ByteString sGID = pResData->sGId;
+ ByteString sLID;
+ if ( !sGID.Len())
+ sGID = pResData->sId;
+ else
+ sLID = pResData->sId;
+
+ ByteString sXText;
+ ByteString sXHText;
+ ByteString sXQHText;
+ ByteString sXTitle;
+
+ Time aTime;
+ ByteString sTimeStamp( ByteString::CreateFromInt64( Date().GetDate()));
+ sTimeStamp += " ";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetHour());
+ sTimeStamp += ":";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetMin());
+ sTimeStamp += ":";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetSec());
+
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ if ( LANGUAGE_ALLOWED( i )) {
+ if ( i != COMMENT_INDEX ) {
+ if ( pResData->sText[ i ].Len())
+ sXText = pResData->sText[ i ];
+ else {
+ sXText = pResData->sText[ ENGLISH_US_INDEX ];
+ if ( !sXText.Len())
+ sXText = pResData->sText[ ENGLISH_INDEX ];
+ if ( !sXText.Len())
+ sXText = pResData->sText[ GERMAN_INDEX ];
+ }
+
+ if ( pResData->sHelpText[ i ].Len())
+ sXHText = pResData->sHelpText[ i ];
+ else {
+ sXHText = pResData->sHelpText[ ENGLISH_US_INDEX ];
+ if ( !sXHText.Len())
+ sXHText = pResData->sHelpText[ ENGLISH_INDEX ];
+ if ( !sXText.Len())
+ sXHText = pResData->sHelpText[ GERMAN_INDEX ];
+ }
+
+ if ( pResData->sQuickHelpText[ i ].Len())
+ sXQHText = pResData->sQuickHelpText[ i ];
+ else {
+ sXQHText = pResData->sQuickHelpText[ ENGLISH_US_INDEX ];
+ if ( !sXQHText.Len())
+ sXQHText = pResData->sQuickHelpText[ ENGLISH_INDEX ];
+ if ( !sXQHText.Len())
+ sXQHText = pResData->sQuickHelpText[ GERMAN_INDEX ];
+ }
+
+ if ( pResData->sTitle[ i ].Len())
+ sXTitle = pResData->sTitle[ i ];
+ else {
+ sXTitle = pResData->sTitle[ ENGLISH_US_INDEX ];
+ if ( !sXTitle.Len())
+ sXTitle = pResData->sTitle[ ENGLISH_INDEX ];
+ if ( !sXTitle.Len())
+ sXTitle = pResData->sTitle[ GERMAN_INDEX ];
+ }
+
+ if ( !sXText.Len())
+ sXText = "-";
+
+ if ( !sXHText.Len()) {
+ if ( pResData->sHelpText[ GERMAN_INDEX ].Len())
+ sXHText = pResData->sHelpText[ GERMAN_INDEX ];
+ else if ( pResData->sHelpText[ ENGLISH_US_INDEX ].Len())
+ sXHText = pResData->sHelpText[ ENGLISH_US_INDEX ];
+ else if ( pResData->sHelpText[ ENGLISH_INDEX ].Len())
+ sXHText = pResData->sHelpText[ ENGLISH_INDEX ];
+ }
+ }
+ else
+ sXText = pResData->sText[ i ];
+
+ if ( bEnableExport ) {
+ ByteString sOutput( sProject ); sOutput += "\t";
+ if ( sRoot.Len())
+ sOutput += sActFileName;
+ sOutput += "\t0\t";
+ sOutput += pResData->sResTyp; sOutput += "\t";
+ sOutput += sGID; sOutput += "\t";
+ sOutput += sLID; sOutput += "\t";
+ sOutput += pResData->sHelpId; sOutput += "\t";
+ sOutput += pResData->sPForm; sOutput += "\t";
+ sOutput += ByteString::CreateFromInt64( pResData->nWidth ); sOutput += "\t";
+ sOutput += ByteString::CreateFromInt64( LangId[ i ] ); sOutput += "\t";
+ sOutput += sXText; sOutput += "\t";
+ sOutput += sXHText; sOutput += "\t";
+ sOutput += sXQHText; sOutput += "\t";
+ sOutput += sXTitle; sOutput += "\t";
+ sOutput += sTimeStamp;
+
+ aOutput.WriteLine( sOutput );
+ }
+
+ if ( bCreateNew ) {
+ pResData->sText[ i ] = "";
+ pResData->sHelpText[ i ] = "";
+ pResData->sQuickHelpText[ i ] = "";
+ pResData->sTitle[ i ] = "";
+ }
+ }
+ }
+ }
+ if ( pResData->pStringList ) {
+ ByteString sList( "stringlist" );
+ WriteExportList( pResData, pResData->pStringList, sList, bCreateNew );
+ if ( bCreateNew )
+ pResData->pStringList = 0;
+ }
+ if ( pResData->pFilterList ) {
+ ByteString sList( "filterlist" );
+ WriteExportList( pResData, pResData->pFilterList, sList, bCreateNew );
+ if ( bCreateNew )
+ pResData->pFilterList = 0;
+ }
+ if ( pResData->pItemList ) {
+ ByteString sList( "itemlist" );
+ WriteExportList( pResData, pResData->pItemList, sList, bCreateNew );
+ if ( bCreateNew )
+ pResData->pItemList = 0;
+ }
+ if ( pResData->pUIEntries ) {
+ ByteString sList( "uientries" );
+ WriteExportList( pResData, pResData->pUIEntries, sList, bCreateNew );
+ if ( bCreateNew )
+ pResData->pUIEntries = 0;
+ }
+ return TRUE;
+}
+
+/*****************************************************************************/
+BOOL Export::WriteExportList( ResData *pResData, ExportList *pExportList,
+ const ByteString &rTyp, BOOL bCreateNew )
+/*****************************************************************************/
+{
+ ByteString sGID = pResData->sGId;
+ if ( !sGID.Len())
+ sGID = pResData->sId;
+ else {
+ sGID += ".";
+ sGID += pResData->sId;
+ sGID.EraseTrailingChars( '.' );
+ }
+
+ Time aTime;
+ ByteString sTimeStamp( ByteString::CreateFromInt64( Date().GetDate()));
+ sTimeStamp += " ";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetHour());
+ sTimeStamp += ":";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetMin());
+ sTimeStamp += ":";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetSec());
+
+ for ( ULONG i = 0; i < pExportList->Count(); i++ ) {
+ ByteString sLID( i + 1 );
+ ExportListEntry *pEntry = pExportList->GetObject( i );
+ for ( USHORT j = 0; j < LANGUAGES; j++ ) {
+ if ( LANGUAGE_ALLOWED( j )) {
+ // mandatory for export: german and eng. and/or enus
+ if ((*pEntry)[ GERMAN_INDEX ].Len() &&
+ ((*pEntry)[ ENGLISH_US_INDEX ].Len() ||
+ (*pEntry)[ ENGLISH_INDEX ].Len()))
+ {
+ if ( bEnableExport )
+ {
+ ByteString sText((*pEntry)[ GERMAN_INDEX ] );
+ if ((*pEntry)[ j ].Len())
+ sText = (*pEntry)[ j ];
+
+ ByteString sOutput( sProject ); sOutput += "\t";
+ if ( sRoot.Len())
+ sOutput += sActFileName;
+ sOutput += "\t0\t";
+ sOutput += rTyp; sOutput += "\t";
+ sOutput += sGID; sOutput += "\t";
+ sOutput += sLID; sOutput += "\t\t";
+ sOutput += pResData->sPForm; sOutput += "\t0\t";
+ sOutput += ByteString::CreateFromInt64( LangId[ j ] ); sOutput += "\t";
+ sOutput += sText; sOutput += "\t\t\t\t";
+ sOutput += sTimeStamp;
+
+ aOutput.WriteLine( sOutput );
+ }
+ }
+ }
+ }
+ if ( bCreateNew )
+ delete [] pEntry;
+ }
+ if ( bCreateNew )
+ delete pExportList;
+
+ return TRUE;
+}
+
+/*****************************************************************************/
+ByteString Export::FullId()
+/*****************************************************************************/
+{
+ ByteString sFull;
+ if ( nLevel > 1 ) {
+ sFull = aResStack.GetObject( 0 )->sId;
+ for ( USHORT i = 1; i < nLevel - 1; i++ ) {
+ ByteString sToAdd = aResStack.GetObject( i )->sId;
+ if ( sToAdd.Len()) {
+ sFull += ".";
+ sFull += sToAdd;
+ }
+ }
+ }
+ if ( sFull.Len() > 255 ) {
+ ByteString sError( "GroupId > 255 chars" );
+ yyerror( sError.GetBufferAccess());
+ sError.ReleaseBufferAccess();
+ }
+
+ return sFull;
+}
+
+/*****************************************************************************/
+void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
+/*****************************************************************************/
+{
+ ResData *pResData = aResStack.GetObject( nLevel-1 );
+
+ ExportList *pList = NULL;
+ if ( nList == LIST_STRING ) {
+ pList = pResData->pStringList;
+ if ( !pList ) {
+ pResData->pStringList = new ExportList();
+ pList = pResData->pStringList;
+ nListIndex = 0;
+ }
+ }
+ else if ( nList == LIST_FILTER ) {
+ pList = pResData->pFilterList;
+ if ( !pList ) {
+ pResData->pFilterList = new ExportList();
+ pList = pResData->pFilterList;
+ nListIndex = 0;
+ }
+ }
+ else if ( nList == LIST_ITEM ) {
+ pList = pResData->pItemList;
+ if ( !pList ) {
+ pResData->pItemList = new ExportList();
+ pList = pResData->pItemList;
+ nListIndex = 0;
+ }
+ }
+ else if ( nList == LIST_UIENTRIES ) {
+ pList = pResData->pUIEntries;
+ if ( !pList ) {
+ pResData->pUIEntries = new ExportList();
+ pList = pResData->pUIEntries;
+ nListIndex = 0;
+ }
+ }
+ else
+ return;
+
+ if ( nListIndex + 1 > pList->Count()) {
+ ExportListEntry *pNew = new ExportListEntry[ LANGUAGES + 2];
+ (*pNew)[ LIST_REFID ] = ByteString::CreateFromInt32( REFID_NONE );
+ pList->Insert( pNew, LIST_APPEND );
+ }
+ ExportListEntry *pCurEntry = pList->GetObject( nListIndex );
+ (*pCurEntry)[ nListLang ] = rText;
+ if ( nListLang == GERMAN_INDEX )
+ (*pCurEntry)[ GERMAN_LIST_LINE_INDEX ] = rLine;
+ nListIndex++;
+}
+
+/*****************************************************************************/
+void Export::CleanValue( ByteString &rValue )
+/*****************************************************************************/
+{
+ while ( rValue.Len()) {
+ if (( rValue.GetChar( 0 ) == ' ' ) || ( rValue.GetChar( 0 ) == '\t' ))
+ rValue = rValue.Copy( 1 );
+ else
+ break;
+ }
+
+ if ( rValue.Len()) {
+ for ( USHORT i = rValue.Len() - 1; i > 0; i-- ) {
+ if (( rValue.GetChar( i ) == ' ' ) || ( rValue.GetChar( i ) == '\t' ) ||
+ ( rValue.GetChar( i ) == '\n' ) || ( rValue.GetChar( i ) == ';' ) ||
+ ( rValue.GetChar( i ) == '{' ) || ( rValue.GetChar( i ) == '\\' ))
+ rValue.Erase( i );
+ else
+ break;
+ }
+ }
+}
+
+
+/*****************************************************************************/
+ByteString Export::GetText( const ByteString &rSource, USHORT nToken )
+/*****************************************************************************/
+#define TXT_STATE_NON 0x000
+#define TXT_STATE_TEXT 0x001
+#define TXT_STATE_MACRO 0x002
+{
+ ByteString sReturn;
+ switch ( nToken ) {
+ case TEXTLINE:
+ case LONGTEXTLINE: {
+ ByteString sTmp( rSource.Copy( rSource.Search( "=" )));
+ CleanValue( sTmp );
+ sTmp.EraseAllChars( '\n' );
+
+ while ( sTmp.SearchAndReplace( "\\\\\"", "-=<[BSlashBSlashHKom]>=-\"" )
+ != STRING_NOTFOUND ) {};
+ while ( sTmp.SearchAndReplace( "\\\"", "-=<[Hochkomma]>=-" )
+ != STRING_NOTFOUND ) {};
+ while ( sTmp.SearchAndReplace( "\\", "-=<[0x7F]>=-" )
+ != STRING_NOTFOUND ) {};
+ while ( sTmp.SearchAndReplace( "\\0x7F", "-=<[0x7F]>=-" )
+ != STRING_NOTFOUND ) {};
+
+ USHORT nStart = 0;
+ USHORT nState = TXT_STATE_MACRO;
+// if ( sTmp[( USHORT )0 ] == '\"' ); {
+ nState = TXT_STATE_TEXT;
+ nStart = 1;
+// }
+
+ for ( USHORT i = nStart; i < sTmp.GetTokenCount( '\"' ); i++ ) {
+ ByteString sToken = sTmp.GetToken( i, '\"' );
+ if ( sToken.Len()) {
+ if ( nState == TXT_STATE_TEXT ) {
+ sReturn += sToken;
+ nState = TXT_STATE_MACRO;
+ }
+ else {
+ while( sToken.SearchAndReplace( "\t", " " ) !=
+ STRING_NOTFOUND ) {};
+ while( sToken.SearchAndReplace( " ", " " ) !=
+ STRING_NOTFOUND ) {};
+ sToken.EraseLeadingChars( ' ' );
+ sToken.EraseTrailingChars( ' ' );
+ if ( sToken.Len()) {
+ sReturn += "\\\" ";
+ sReturn += sToken;
+ sReturn += " \\\"";
+ }
+ nState = TXT_STATE_TEXT;
+ }
+ }
+ }
+
+ while ( sReturn.SearchAndReplace( "-=<[0x7F]>=-", "" )
+ != STRING_NOTFOUND ) {};
+ while ( sReturn.SearchAndReplace( "-=<[Hochkomma]>=-", "\"" )
+ != STRING_NOTFOUND ) {};
+ while ( sReturn.SearchAndReplace( "-=<[BSlashBSlashHKom]>=-", "\\\\" )
+ != STRING_NOTFOUND ) {};
+
+ // new
+ while ( sReturn.SearchAndReplace( "\\\\", "-=<[BSlashBSlash]>=-" )
+ != STRING_NOTFOUND ) {};
+ while ( sReturn.SearchAndReplace( "-=<[BSlashBSlash]>=-", "\\" )
+ != STRING_NOTFOUND ) {};
+ // new
+ }
+ break;
+ }
+ return sReturn;
+}
+
+/*****************************************************************************/
+void Export::WriteToMerged( const ByteString &rText )
+/*****************************************************************************/
+{
+ if ( !bDontWriteOutput || !bUnmerge ) {
+ ByteString sText( rText );
+ while ( sText.SearchAndReplace( " \n", "\n" ) != STRING_NOTFOUND ) {};
+ for ( USHORT i = 0; i < sText.Len(); i++ ) {
+ if ( sText.GetChar( i ) != '\n' )
+ aOutput.Write( ByteString( sText.GetChar( i )).GetBuffer(), 1 );
+ else
+ aOutput.WriteLine( ByteString());
+ }
+ }
+}
+
+/*****************************************************************************/
+void Export::ConvertMergeContent( ByteString &rText, USHORT nTyp )
+/*****************************************************************************/
+{
+ BOOL bNoOpen = ( rText.Search( "\\\"" ) != 0 );
+ ByteString sClose( rText.Copy( rText.Len() - 2 ));
+ BOOL bNoClose = ( sClose != "\\\"" );
+
+ ByteString sNew;
+ for ( USHORT i = 0; i < rText.Len(); i++ ) {
+ ByteString sChar( rText.GetChar( i ));
+ if ( sChar == "\\" ) {
+ if (( i + 1 ) < rText.Len()) {
+ ByteString sNext( rText.GetChar( i + 1 ));
+ if ( sNext == "\"" ) {
+ sChar = "\"";
+ i++;
+ }
+ else if ( sNext == "n" ) {
+ sChar = "\\n";
+ i++;
+ }
+ else if ( sNext == "t" ) {
+ sChar = "\\t";
+ i++;
+ }
+ else if ( sNext == "\'" ) {
+ sChar = "\\\'";
+ i++;
+ }
+ else
+ sChar = "\\\\";
+ }
+ else {
+ sChar = "\\\\";
+ }
+ }
+ else if ( sChar == "\"" ) {
+ sChar = "\\\"";
+ }
+ else if ( sChar == "" ) {
+ sChar = "\\0x7F";
+ }
+ sNew += sChar;
+ }
+
+ rText = sNew;
+
+/*
+ while ( rText.SearchAndReplace( "\\\"", "-=<[Hochkomma]>=-" )
+ != STRING_NOTFOUND ) {};
+// while ( rText.SearchAndReplace( "\\\\", "-=<[BSlashBSlash]>=-" )
+// != STRING_NOTFOUND ) {};
+ while ( rText.SearchAndReplace( "\"", "-=<[BSlashHKom}>=-" )
+ != STRING_NOTFOUND ) {};
+ while ( rText.SearchAndReplace( "\0x7F", "-=<[0x7F]>=-" )
+ != STRING_NOTFOUND ) {};
+// new
+ while ( rText.SearchAndReplace( "\\", "-=<[BSlash]>=-" )
+ != STRING_NOTFOUND ) {};
+ while ( rText.SearchAndReplace( "-=<[BSlash]>=-", "\\\\" )
+ != STRING_NOTFOUND ) {};
+// new
+ while ( rText.SearchAndReplace( "-=<[BSlashHKom}>=-", "\\\"" )
+ != STRING_NOTFOUND ) {};
+// while ( rText.SearchAndReplace( "-=<[BSlashBSlash]>=-", "\\\\" )
+// != STRING_NOTFOUND ) {};
+ while ( rText.SearchAndReplace( "-=<[Hochkomma]>=-", "\"" )
+ != STRING_NOTFOUND ) {};
+*/
+
+ if ( bNoOpen ) {
+ ByteString sTmp( rText );
+ rText = "\"";
+ rText += sTmp;
+ }
+ if ( bNoClose )
+ rText += "\"";
+}
+
+/*****************************************************************************/
+BOOL Export::PrepareTextToMerge( ByteString &rText, USHORT nTyp,
+ USHORT nLangIndex, ResData *pResData )
+/*****************************************************************************/
+{
+ // position to merge in:
+ USHORT nStart;
+ USHORT nEnd;
+ ByteString sOldId = pResData->sId;
+ ByteString sOldGId = pResData->sGId;
+ ByteString sOldTyp = pResData->sResTyp;
+
+ ByteString sOrigText( rText );
+
+ switch ( nTyp ) {
+ case LIST_STRING :
+ case LIST_UIENTRIES :
+ case LIST_FILTER :
+ case LIST_ITEM :
+ {
+ if ( bUnmerge )
+ return TRUE;
+
+ ExportList *pList = NULL;
+ switch ( nTyp ) {
+ case LIST_STRING : {
+ pResData->sResTyp = "stringlist";
+ pList = pResData->pStringList;
+ }
+ break;
+ case LIST_UIENTRIES : {
+ pResData->sResTyp = "uientries";
+ pList = pResData->pUIEntries;
+ }
+ break;
+ case LIST_FILTER : {
+ pResData->sResTyp = "filterlist";
+ pList = pResData->pFilterList;
+ }
+ break;
+ case LIST_ITEM : {
+ pResData->sResTyp = "itemlist";
+ pList = pResData->pItemList;
+ }
+ break;
+ }
+ if ( pList ) {
+ ExportListEntry *pCurEntry = pList->GetObject( nListIndex - 1 );
+ if ( pCurEntry ) {
+ rText = (*pCurEntry)[ GERMAN_LIST_LINE_INDEX ];
+ }
+ }
+
+ nStart = rText.Search( "\"" );
+ if ( nStart == STRING_NOTFOUND ) {
+ rText = sOrigText;
+ return FALSE;
+ }
+
+ BOOL bFound = FALSE;
+ for ( nEnd = nStart + 1; nEnd < rText.Len() && !bFound; nEnd++ ) {
+ if ( rText.GetChar( nEnd ) == '\"' )
+ bFound = TRUE;
+ }
+ if ( !bFound ) {
+ rText = sOrigText;
+ return FALSE;
+ }
+
+ nEnd --;
+ sLastListLine = rText;
+ pResData->sId = nListIndex;
+ if ( pResData->sGId.Len())
+ pResData->sGId += ".";
+ pResData->sGId += sOldId;
+ nTyp = STRING_TYP_TEXT;
+ }
+ break;
+ case STRING_TYP_TEXT :
+ case STRING_TYP_HELPTEXT :
+ case STRING_TYP_QUICKHELPTEXT :
+ case STRING_TYP_TITLE :
+ {
+ if ( bUnmerge ) {
+ if (( nLangIndex != GERMAN_INDEX ) &&
+ ( nLangIndex != ENGLISH_INDEX ))
+ {
+ bDontWriteOutput = TRUE;
+ }
+ return TRUE;
+ }
+
+ nStart = rText.Search( "=" );
+ if ( nStart == STRING_NOTFOUND ) {
+ rText = sOrigText;
+ return FALSE;
+ }
+
+ nStart++;
+ BOOL bFound = FALSE;
+ while(( nStart < rText.Len()) && !bFound ) {
+ if (( rText.GetChar( nStart ) != ' ' ) && ( rText.GetChar( nStart ) != '\t' ))
+ bFound = TRUE;
+ else
+ nStart ++;
+ }
+
+ // no start position found
+ if ( !bFound ) {
+ rText = sOrigText;
+ return FALSE;
+ }
+
+ // position to end mergeing in
+ nEnd = rText.Len() - 1;
+ bFound = FALSE;
+
+ while (( nEnd > nStart ) && !bFound ) {
+ if (( rText.GetChar( nEnd ) != ' ' ) && ( rText.GetChar( nEnd ) != '\t' ) &&
+ ( rText.GetChar( nEnd ) != '\n' ) && ( rText.GetChar( nEnd ) != ';' ) &&
+ ( rText.GetChar( nEnd ) != '{' ) && ( rText.GetChar( nEnd ) != '\\' ))
+ {
+ bFound = TRUE;
+ }
+ else
+ nEnd --;
+ }
+ }
+ break;
+ }
+
+ // search for merge data
+ if ( !pMergeDataFile )
+ pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet );
+
+ PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
+ pResData->sId = sOldId;
+ pResData->sGId = sOldGId;
+ pResData->sResTyp = sOldTyp;
+
+ if ( !pEntrys ) {
+ rText = sOrigText;
+ return FALSE; // no data found
+ }
+
+ ByteString sContent;
+ pEntrys->GetText( sContent, nTyp, nLangIndex );
+ if ( !sContent.Len() && ( nLangIndex != GERMAN_INDEX )) {
+ rText = sOrigText;
+ return FALSE; // no data found
+ }
+
+ if ( nLangIndex == GERMAN_INDEX ) {
+ if ( pWordTransformer ) {
+ ByteString sRealContent = rText.Copy( nStart + 1, nEnd - nStart - 1 );
+ ByteString sPostFix( rText.Copy( nEnd ));
+ rText.Erase( nStart + 1 );
+
+ if ( pWordTransformer->Transform( sRealContent ) != WordTransformer::OK ) {
+ ByteString aString;
+ for ( USHORT i = 0; i < pWordTransformer->NrOfErrors(); i++ ) {
+ pWordTransformer->GetError( i, &aString );
+ fprintf( stderr, "%s\n" , aString.GetBuffer());
+ }
+ rText = sOrigText;
+ return FALSE;
+ }
+
+ rText += sRealContent;
+ rText += sPostFix;
+
+ if ( rText != sOrigText )
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ ByteString sPostFix( rText.Copy( ++nEnd ));
+ rText.Erase( nStart );
+
+ ConvertMergeContent( sContent, nTyp );
+
+ // merge new res. in text line
+ rText += sContent;
+ rText += sPostFix;
+
+ return TRUE;
+}
+
+/*****************************************************************************/
+void Export::MergeRest( ResData *pResData, USHORT nMode )
+/*****************************************************************************/
+{
+ if ( bUnmerge ) {
+ CreateRefIds( pResData );
+ switch ( nMode ) {
+ case MERGE_MODE_NORMAL : {
+ if ( pResData->bRestMerged )
+ return;
+ pResData->bRestMerged = TRUE;
+ if ( pResData->bText &&
+ pResData->sText[ GERMAN_INDEX ].Len() &&
+ pResData->sText[ ENGLISH_INDEX ].Len())
+ {
+ BOOL bAddSemikolon = FALSE;
+ ByteString sOutput;
+ if ( bNextMustBeDefineEOL ) {
+ sOutput += "\t\\\n";
+ }
+ if ( bDefine ) {
+ bDefine = FALSE;
+ bNextMustBeDefineEOL = TRUE;
+ }
+ for ( USHORT j = 0; j < nLevel; j++ )
+ sOutput += "\t";
+ sOutput += pResData->sTextTyp;
+ sOutput += " = ";
+ sOutput += ByteString::CreateFromInt32( pResData->nTextRefId );
+ if ( bDefine )
+ sOutput += ";\\\n";
+ else if ( !bNextMustBeDefineEOL )
+ sOutput += ";\n";
+ else
+ bAddSemikolon = TRUE;
+ WriteToMerged( sOutput );
+
+ if ( bAddSemikolon ) {
+ ByteString sOutput( " ;" );
+ WriteToMerged( sOutput );
+ }
+ }
+
+ if ( pResData->bHelpText &&
+ pResData->sHelpText[ GERMAN_INDEX ].Len() &&
+ pResData->sHelpText[ ENGLISH_INDEX ].Len())
+ {
+ BOOL bAddSemikolon = FALSE;
+ ByteString sOutput;
+ if ( bNextMustBeDefineEOL) {
+ sOutput += "\t\\\n";
+ }
+ if ( bDefine ) {
+ bDefine = FALSE;
+ bNextMustBeDefineEOL = TRUE;
+ }
+ for ( USHORT j = 1; j < nLevel; j++ )
+ sOutput += "\t";
+ sOutput += "HelpText";
+ sOutput += " = ";
+ sOutput += ByteString::CreateFromInt32( pResData->nHelpTextRefId );
+ if ( bDefine )
+ sOutput += ";\\\n";
+ else if ( !bNextMustBeDefineEOL )
+ sOutput += ";\n";
+ else
+ bAddSemikolon = TRUE;
+ WriteToMerged( sOutput );
+
+ if ( bAddSemikolon ) {
+ ByteString sOutput( " ;" );
+ WriteToMerged( sOutput );
+ }
+ }
+
+ if ( pResData->bQuickHelpText &&
+ pResData->sQuickHelpText[ GERMAN_INDEX ].Len() &&
+ pResData->sQuickHelpText[ ENGLISH_INDEX ].Len())
+ {
+ BOOL bAddSemikolon = FALSE;
+ ByteString sOutput;
+ if ( bNextMustBeDefineEOL) {
+ sOutput += "\t\\\n";
+ }
+ if ( bDefine ) {
+ bDefine = FALSE;
+ bNextMustBeDefineEOL = TRUE;
+ }
+ for ( USHORT j = 1; j < nLevel; j++ )
+ sOutput += "\t";
+ sOutput += "QuickHelpText";
+ sOutput += " = ";
+ sOutput += ByteString::CreateFromInt32( pResData->nQuickHelpTextRefId );
+ if ( bDefine )
+ sOutput += ";\\\n";
+ else if ( !bNextMustBeDefineEOL )
+ sOutput += ";\n";
+ else
+ bAddSemikolon = TRUE;
+ WriteToMerged( sOutput );
+
+ if ( bAddSemikolon ) {
+ ByteString sOutput( " ;" );
+ WriteToMerged( sOutput );
+ }
+ }
+
+ if ( pResData->bTitle &&
+ pResData->sTitle[ GERMAN_INDEX ].Len() &&
+ pResData->sTitle[ ENGLISH_INDEX ].Len())
+ {
+ BOOL bAddSemikolon = FALSE;
+ ByteString sOutput;
+ if ( bNextMustBeDefineEOL) {
+ sOutput += "\t\\\n";
+ }
+ if ( bDefine ) {
+ bDefine = FALSE;
+ bNextMustBeDefineEOL = TRUE;
+ }
+ for ( USHORT j = 1; j < nLevel; j++ )
+ sOutput += "\t";
+ sOutput += "Title";
+ sOutput += " = ";
+ sOutput += ByteString::CreateFromInt32( pResData->nTitleRefId );
+ if ( bDefine )
+ sOutput += ";\\\n";
+ else if ( !bNextMustBeDefineEOL )
+ sOutput += ";\n";
+ else
+ bAddSemikolon = TRUE;
+ WriteToMerged( sOutput );
+
+ if ( bAddSemikolon ) {
+ ByteString sOutput( " ;" );
+ WriteToMerged( sOutput );
+ }
+ }
+ }
+ if ( pResData->bList ) {
+ ByteString sSpace;
+ for ( USHORT i = 0; i < nLevel-1; i++ )
+ sSpace += "\t";
+ for ( USHORT nT = LIST_STRING; nT <= LIST_UIENTRIES; nT++ ) {
+ ByteString sHead( sSpace );
+ ExportList *pList = NULL;
+ switch ( nT ) {
+ case LIST_STRING : sHead += "StringList "; pList = pResData->pStringList; break;
+ case LIST_FILTER : sHead += "FilterList "; pList = pResData->pFilterList; break;
+ case LIST_ITEM : sHead += "ItemList "; pList = pResData->pItemList; break;
+ case LIST_UIENTRIES : sHead += "UIEntries "; pList = pResData->pUIEntries; break;
+ }
+ if ( pList ) {
+ if ( bDefine ) {
+ sHead += "= \\\n";
+ sHead += sSpace;
+ sHead += "\t{\\\n\t\t";
+ }
+ else {
+ sHead += "= \n";
+ sHead += sSpace;
+ sHead += "\t{\n\t\t";
+ }
+ WriteToMerged( sHead );
+ for ( ULONG i = 0; i < pList->Count(); i++ ) {
+ ByteString sLine(( *pList->GetObject( i ))[ GERMAN_LIST_LINE_INDEX ]);
+ if (( nT != LIST_UIENTRIES ) &&
+ (( sLine.Search( "{" ) == STRING_NOTFOUND ) ||
+ ( sLine.Search( "{" ) >= sLine.Search( "\"" ))) &&
+ (( sLine.Search( "<" ) == STRING_NOTFOUND ) ||
+ ( sLine.Search( "<" ) >= sLine.Search( "\"" ))))
+ {
+ sLine.SearchAndReplace( "\"", "< \"" );
+ }
+
+ USHORT nStart, nEnd;
+ nStart = sLine.Search( "\"" );
+ BOOL bFound = FALSE;
+ for ( nEnd = nStart + 1; nEnd < sLine.Len() && !bFound; nEnd++ ) {
+ if ( sLine.GetChar( nEnd ) == '\"' )
+ bFound = TRUE;
+ }
+ nEnd--;
+ ByteString sPostFix( sLine.Copy( ++nEnd ));
+ sLine.Erase( nStart );
+
+ ByteString sText(( *pList->GetObject( i ))[ LIST_REFID ]);
+
+ // merge new res. in text line
+ sLine += sText;
+ sLine += sPostFix;
+
+ sText = "\t";
+ sText += sLine;
+ if ( bDefine )
+ sText += " ;\\\n";
+ else
+ sText += " ;\n";
+ sText += sSpace;
+ sText += "\t";
+ WriteToMerged( sText );
+ }
+ if ( pList->Count()) {
+ ByteString sFooter( sSpace.Copy( 1 ));
+ if ( !bDefine )
+ sFooter += "};\n\t";
+ else
+ sFooter += "\n\n";
+ WriteToMerged( sFooter );
+ }
+ }
+ }
+ }
+ break;
+ }
+ return;
+ }
+
+ if ( !pMergeDataFile )
+ pMergeDataFile = new MergeDataFile( sMergeSrc, bErrorLog, aCharSet );
+
+ switch ( nMode ) {
+ case MERGE_MODE_NORMAL : {
+ PFormEntrys *pEntry = pMergeDataFile->GetPFormEntrys( pResData );
+ if ( pEntry && pResData->bText ) {
+ BOOL bAddSemikolon = FALSE;
+ BOOL bFirst = TRUE;
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ ByteString sText;
+ BOOL bText = pEntry->GetText( sText, STRING_TYP_TEXT, i, TRUE );
+ if ( bText && sText.Len() && sText != "-" ) {
+ ByteString sOutput;
+ if ( bNextMustBeDefineEOL) {
+ if ( bFirst )
+ sOutput += "\t\\\n";
+ else
+ sOutput += ";\t\\\n";
+ }
+ bFirst=FALSE;
+ sOutput += "\t";
+ sOutput += pResData->sTextTyp;
+ if ( i != GERMAN_INDEX ) {
+ sOutput += "[ ";
+ sOutput += LangName[ i ];
+ sOutput += " ] ";
+ }
+ sOutput += "= ";
+ ConvertMergeContent( sText, STRING_TYP_TEXT );
+ sOutput += sText;
+ if ( bDefine )
+ sOutput += ";\\\n";
+ else if ( !bNextMustBeDefineEOL )
+ sOutput += ";\n";
+ else
+ bAddSemikolon = TRUE;
+ for ( USHORT j = 1; j < nLevel; j++ )
+ sOutput += "\t";
+ WriteToMerged( sOutput );
+ }
+ }
+ if ( bAddSemikolon ) {
+ ByteString sOutput( ";" );
+ WriteToMerged( sOutput );
+ }
+ }
+
+ if ( pEntry && pResData->bQuickHelpText ) {
+ BOOL bAddSemikolon = FALSE;
+ BOOL bFirst = TRUE;
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ ByteString sText;
+ BOOL bText = pEntry->GetText( sText, STRING_TYP_TEXT, i, TRUE );
+ if ( bText && sText.Len() && sText != "-" ) {
+ ByteString sOutput;
+ if ( bNextMustBeDefineEOL) {
+ if ( bFirst )
+ sOutput += "\t\\\n";
+ else
+ sOutput += ";\t\\\n";
+ }
+ bFirst=FALSE;
+ sOutput += "\t";
+ sOutput += "QuickHelpText";
+ if ( i != GERMAN_INDEX ) {
+ sOutput += "[ ";
+ sOutput += LangName[ i ];
+ sOutput += " ] ";
+ }
+ sOutput += "= ";
+ ConvertMergeContent( sText, STRING_TYP_QUICKHELPTEXT );
+ sOutput += sText;
+ if ( bDefine )
+ sOutput += ";\\\n";
+ else if ( !bNextMustBeDefineEOL )
+ sOutput += ";\n";
+ else
+ bAddSemikolon = TRUE;
+ for ( USHORT j = 1; j < nLevel; j++ )
+ sOutput += "\t";
+ WriteToMerged( sOutput );
+ }
+ }
+ if ( bAddSemikolon ) {
+ ByteString sOutput( ";" );
+ WriteToMerged( sOutput );
+ }
+ }
+
+ if ( pEntry && pResData->bTitle ) {
+ BOOL bAddSemikolon = FALSE;
+ BOOL bFirst = TRUE;
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ ByteString sText;
+ BOOL bText = pEntry->GetText( sText, STRING_TYP_TEXT, i, TRUE );
+ if ( bText && sText.Len() && sText != "-" ) {
+ ByteString sOutput;
+ if ( bNextMustBeDefineEOL) {
+ if ( bFirst )
+ sOutput += "\t\\\n";
+ else
+ sOutput += ";\t\\\n";
+ }
+ bFirst=FALSE;
+ sOutput += "\t";
+ sOutput += "Title";
+ if ( i != GERMAN_INDEX ) {
+ sOutput += "[ ";
+ sOutput += LangName[ i ];
+ sOutput += " ] ";
+ }
+ sOutput += "= ";
+ ConvertMergeContent( sText, STRING_TYP_TITLE );
+ sOutput += sText;
+ if ( bDefine )
+ sOutput += ";\\\n";
+ else if ( !bNextMustBeDefineEOL )
+ sOutput += ";\n";
+ else
+ bAddSemikolon = TRUE;
+ for ( USHORT j = 1; j < nLevel; j++ )
+ sOutput += "\t";
+ WriteToMerged( sOutput );
+ }
+ }
+ if ( bAddSemikolon ) {
+ ByteString sOutput( ";" );
+ WriteToMerged( sOutput );
+ }
+ }
+ // looking for left list entrys
+
+ if ( pResData->bList ) {
+ ByteString sOldId = pResData->sId;
+ ByteString sOldGId = pResData->sGId;
+ ByteString sOldTyp = pResData->sResTyp;
+ if ( pResData->sGId.Len())
+ pResData->sGId += ".";
+ pResData->sGId += sOldId;
+ ByteString sSpace;
+ for ( USHORT i = 1; i < nLevel-1; i++ )
+ sSpace += "\t";
+ for ( USHORT nT = LIST_STRING; nT <= LIST_UIENTRIES; nT++ ) {
+ switch ( nT ) {
+ case LIST_STRING : pResData->sResTyp = "stringlist"; break;
+ case LIST_FILTER : pResData->sResTyp = "filterlist"; break;
+ case LIST_UIENTRIES : pResData->sResTyp = "uientries"; break;
+ case LIST_ITEM : pResData->sResTyp = "itemlist"; break;
+ }
+ for ( USHORT nLang = 0; nLang < LANGUAGES; nLang ++ ) {
+ USHORT nIdx = 1;
+ pResData->sId = nIdx;
+ PFormEntrys *pEntrys;
+ while( pEntrys = pMergeDataFile->GetPFormEntrys( pResData )) {
+ ByteString sText;
+ BOOL bText = pEntrys->GetText( sText, STRING_TYP_TEXT, nLang, TRUE );
+ if ( bText && sText.Len()) {
+ if ( nIdx == 1 ) {
+ ByteString sHead( sSpace );
+ switch ( nT ) {
+ case LIST_STRING : sHead += "StringList "; break;
+ case LIST_FILTER : sHead += "FilterList "; break;
+ case LIST_ITEM : sHead += "ItemList "; break;
+ case LIST_UIENTRIES : sHead += "UIEntries "; break;
+ }
+ if ( nIdx != GERMAN_INDEX ) {
+ sHead += "[ ";
+ sHead += LangName[ nLang ];
+ sHead += " ] ";
+ }
+ if ( bDefine ) {
+ sHead += "= \\\n";
+ sHead += sSpace;
+ sHead += "\t{\\\n\t\t";
+ }
+ else {
+ sHead += "= \n";
+ sHead += sSpace;
+ sHead += "\t{\n\t\t";
+ }
+ WriteToMerged( sHead );
+ }
+ ByteString sLine( sLastListLine );
+ if (( nT != LIST_UIENTRIES ) &&
+ (( sLine.Search( "{" ) == STRING_NOTFOUND ) ||
+ ( sLine.Search( "{" ) >= sLine.Search( "\"" ))) &&
+ (( sLine.Search( "<" ) == STRING_NOTFOUND ) ||
+ ( sLine.Search( "<" ) >= sLine.Search( "\"" ))))
+ {
+ sLine.SearchAndReplace( "\"", "< \"" );
+ }
+
+ USHORT nStart, nEnd;
+ nStart = sLine.Search( "\"" );
+ BOOL bFound = FALSE;
+ for ( nEnd = nStart + 1; nEnd < sLine.Len() && !bFound; nEnd++ ) {
+ if ( sLine.GetChar( nEnd ) == '\"' )
+ bFound = TRUE;
+ }
+ nEnd --;
+ ByteString sPostFix( sLine.Copy( ++nEnd ));
+ sLine.Erase( nStart );
+
+ ConvertMergeContent( sText, nT );
+
+ // merge new res. in text line
+ sLine += sText;
+ sLine += sPostFix;
+
+ ByteString sText( "\t" );
+ sText += sLine;
+ if ( bDefine )
+ sText += " ;\\\n";
+ else
+ sText += " ;\n";
+ sText += sSpace;
+ sText += "\t";
+ WriteToMerged( sText );
+ pResData->sId = ++nIdx;
+ }
+ else
+ break;
+ }
+ if ( nIdx > 1 ) {
+ ByteString sFooter( sSpace.Copy( 1 ));
+ if ( !bDefine )
+ sFooter += "};\n\t";
+ else
+ sFooter += "\n\n";
+ WriteToMerged( sFooter );
+ }
+ }
+ }
+
+ pResData->sId = sOldId;
+ pResData->sGId = sOldGId;
+ pResData->sResTyp = sOldTyp;
+ }
+ }
+ break;
+ case MERGE_MODE_LIST : {
+ nListIndex++;
+ ByteString sLine( sLastListLine );
+ if (( nList != LIST_UIENTRIES ) &&
+ (( sLine.Search( "{" ) == STRING_NOTFOUND ) ||
+ ( sLine.Search( "{" ) >= sLine.Search( "\"" ))) &&
+ (( sLine.Search( "<" ) == STRING_NOTFOUND ) ||
+ ( sLine.Search( "<" ) >= sLine.Search( "\"" ))))
+ {
+ sLine.SearchAndReplace( "\"", "< \"" );
+ }
+ while( PrepareTextToMerge( sLine, nList, nListLang, pResData )) {
+ ByteString sText( "\t" );
+ sText += sLine;
+ sText += "\n";
+ for ( USHORT i = 0; i < nLevel; i++ )
+ sText += "\t";
+ WriteToMerged( sText );
+ nListIndex++;
+ sLine = sLastListLine;
+ }
+ }
+ break;
+ }
+}
+
+/*****************************************************************************/
+void Export::SetChildWithText()
+/*****************************************************************************/
+{
+ if ( aResStack.Count() > 1 ) {
+ for ( ULONG i = 0; i < aResStack.Count() - 1; i++ ) {
+ aResStack.GetObject( i )->bChildWithText = TRUE;
+ }
+ }
+}
+
diff --git a/transex3/source/export2.cxx b/transex3/source/export2.cxx
new file mode 100644
index 000000000000..b46d0d1dfc0a
--- /dev/null
+++ b/transex3/source/export2.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * $RCSfile: export2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "export.hxx"
+
+//
+// class ResData();
+//
+
+/*****************************************************************************/
+ResData::~ResData()
+/*****************************************************************************/
+{
+ if ( pStringList ) {
+ // delete existing res. of type StringList
+ for ( ULONG i = 0; i < pStringList->Count(); i++ ) {
+ delete [] pStringList->GetObject( i );
+ }
+ delete pStringList;
+ }
+ if ( pFilterList ) {
+ // delete existing res. of type FilterList
+ for ( ULONG i = 0; i < pFilterList->Count(); i++ ) {
+ delete [] pFilterList->GetObject( i );
+ }
+ delete pFilterList;
+ }
+ if ( pItemList ) {
+ // delete existing res. of type ItemList
+ for ( ULONG i = 0; i < pItemList->Count(); i++ ) {
+ delete [] pItemList->GetObject( i );
+ }
+ delete pItemList;
+ }
+ if ( pUIEntries ) {
+ // delete existing res. of type UIEntries
+ for ( ULONG i = 0; i < pUIEntries->Count(); i++ ) {
+ delete [] pUIEntries->GetObject( i );
+ }
+ delete pUIEntries;
+ }
+}
+
+//
+// class Export
+//
+
+/*****************************************************************************/
+USHORT Export::LangId[ LANGUAGES ] =
+/*****************************************************************************/
+{
+ // translation table: Index <=> LangId
+ COMMENT,
+ ENGLISH_US,
+ PORTUGUESE,
+ GERMAN_DE,
+ RUSSIAN,
+ GREEK,
+ DUTCH,
+ FRENCH,
+ SPANISH,
+ FINNISH,
+ HUNGARIAN,
+ ITALIAN,
+ CZECH,
+ SLOVAK,
+ ENGLISH,
+ DANISH,
+ SWEDISH,
+ NORWEGIAN,
+ POLISH,
+ GERMAN,
+ PORTUGUESE_BRAZILIAN,
+ JAPANESE,
+ KOREAN,
+ CHINESE_SIMPLIFIED,
+ CHINESE_TRADITIONAL,
+ TURKISH,
+ ARABIC,
+ HEBREW
+};
+
+
+/*****************************************************************************/
+USHORT Export::GetLangIndex( USHORT nLangId )
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < LANGUAGES; i++ )
+ if ( nLangId == LangId[ i ] )
+ return i;
+ return 0xFFFF;
+}
+
+/*****************************************************************************/
+CharSet Export::GetCharSet( USHORT nLangId )
+/*****************************************************************************/
+{
+ switch ( nLangId ) {
+ case COMMENT: return RTL_TEXTENCODING_MS_1252;
+ case ENGLISH_US: return RTL_TEXTENCODING_MS_1252;
+ case PORTUGUESE: return RTL_TEXTENCODING_MS_1252;
+ case RUSSIAN: return RTL_TEXTENCODING_MS_1257;
+ case GREEK: return RTL_TEXTENCODING_MS_1253;
+ case DUTCH: return RTL_TEXTENCODING_MS_1252;
+ case FRENCH: return RTL_TEXTENCODING_MS_1252;
+ case SPANISH: return RTL_TEXTENCODING_MS_1252;
+ case FINNISH: return RTL_TEXTENCODING_MS_1252;
+ case HUNGARIAN: return RTL_TEXTENCODING_MS_1250;
+ case ITALIAN: return RTL_TEXTENCODING_MS_1252;
+ case CZECH: return RTL_TEXTENCODING_MS_1250;
+ case SLOVAK: return RTL_TEXTENCODING_MS_1250;
+ case ENGLISH: return RTL_TEXTENCODING_MS_1252;
+ case DANISH: return RTL_TEXTENCODING_MS_1252;
+ case SWEDISH: return RTL_TEXTENCODING_MS_1252;
+ case NORWEGIAN: return RTL_TEXTENCODING_MS_1252;
+ case POLISH: return RTL_TEXTENCODING_MS_1250;
+ case GERMAN: return RTL_TEXTENCODING_MS_1252;
+ case PORTUGUESE_BRAZILIAN: return RTL_TEXTENCODING_MS_1252;
+ case JAPANESE: return RTL_TEXTENCODING_MS_932;
+ case KOREAN: return RTL_TEXTENCODING_MS_949;
+ case CHINESE_SIMPLIFIED: return RTL_TEXTENCODING_MS_936;
+ case CHINESE_TRADITIONAL: return RTL_TEXTENCODING_MS_950;
+ case TURKISH: return RTL_TEXTENCODING_MS_1254;
+ case ARABIC: return RTL_TEXTENCODING_MS_1256;
+ case HEBREW: return RTL_TEXTENCODING_MS_1255;
+ }
+ return 0xFFFF;
+}
+
diff --git a/transex3/source/gsicheck.cxx b/transex3/source/gsicheck.cxx
new file mode 100644
index 000000000000..f838ccdd9181
--- /dev/null
+++ b/transex3/source/gsicheck.cxx
@@ -0,0 +1,475 @@
+/*************************************************************************
+ *
+ * $RCSfile: gsicheck.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <tools/fsys.hxx>
+#include <tools/stream.hxx>
+#include <tools/list.hxx>
+
+// local includes
+#include "utf8conv.hxx"
+#include "tagtest.hxx"
+
+//
+// class GSILine
+//
+
+class GSILine : public ByteString
+{
+private:
+ ULONG nUniqId;
+ ULONG nLineNumber;
+ BOOL bOK;
+
+public:
+ GSILine( const ByteString &rLine, ULONG nLine );
+
+ ULONG GetUniqId() { return nUniqId; }
+ ULONG GetLineNumber() { return nLineNumber; }
+
+ BOOL IsOK() { return bOK; }
+ void NotOK() { bOK = FALSE; }
+};
+
+//
+// class GSIBlock
+//
+
+DECLARE_LIST( GSIBlock_Impl, GSILine * );
+
+class GSIBlock : public GSIBlock_Impl
+{
+private:
+ GSILine *pGermanLine;
+ void PrintList( ParserMessageList &rList, ByteString aPrefix, GSILine *pLine );
+ BOOL bPrintContext;
+
+public:
+ GSIBlock( BOOL PbPrintContext ) : pGermanLine( NULL ), bPrintContext( PbPrintContext ) {};
+ ~GSIBlock();
+ void PrintError( ByteString aMsg, ByteString aPrefix, ByteString aContext, ULONG nLine, ULONG nUniqueId );
+ void InsertLine( const ByteString &rLine, ULONG nLine );
+ BOOL CheckSyntax( ULONG nLine );
+
+ void WriteError( SvStream &aErrOut );
+ void WriteCorrect( SvStream &aOkOut );
+};
+
+//
+// class GSILine
+//
+
+/*****************************************************************************/
+GSILine::GSILine( const ByteString &rLine, ULONG nLine )
+/*****************************************************************************/
+ : ByteString( rLine )
+ , nLineNumber( nLine )
+ , bOK( TRUE )
+{
+ ByteString sTmp( rLine );
+ sTmp.SearchAndReplaceAll( "($$)", "\t" );
+
+ nUniqId = sTmp.GetToken( 0, '\t' ).ToInt32();
+}
+
+//
+// class GSIBlock
+//
+
+/*****************************************************************************/
+GSIBlock::~GSIBlock()
+/*****************************************************************************/
+{
+ delete pGermanLine;
+
+ for ( ULONG i = 0; i < Count(); i++ )
+ delete ( GetObject( i ));
+}
+
+/*****************************************************************************/
+void GSIBlock::InsertLine( const ByteString &rLine, ULONG nLine )
+/*****************************************************************************/
+{
+ GSILine *pLine = new GSILine( rLine, nLine );
+
+ ByteString sTmp( rLine );
+ sTmp.SearchAndReplaceAll( "($$)", "\t" );
+
+ if ( sTmp.GetTokenCount( '\t' ) < 5 )
+ {
+ PrintError( "Unable to determin languge and/or state", "Line format", rLine.Copy( 0,100 ), nLine, 0 );
+ pLine->NotOK();
+ }
+
+ USHORT nLangId = sTmp.GetToken( 2, '\t' ).ToInt32();
+ if ( nLangId == 49 )
+ pGermanLine = pLine;
+ else {
+ ULONG nPos = 0;
+
+ if ( sTmp.GetToken( 3, '\t' ).ToLowerAscii() == "int")
+ {
+ while (( nPos < Count()) &&
+ ( GetObject( nPos )->GetLineNumber() < pLine->GetLineNumber()))
+ nPos++;
+
+ Insert( pLine, nPos );
+ }
+ }
+}
+
+/*****************************************************************************/
+void GSIBlock::PrintError( ByteString aMsg, ByteString aPrefix,
+ ByteString aContext, ULONG nLine, ULONG nUniqueId )
+/*****************************************************************************/
+{
+ fprintf( stdout, "Error: %s, Line %lu", aPrefix.GetBuffer(),
+ nLine );
+ if ( nUniqueId )
+ fprintf( stdout, ", UniqueID %lu", nUniqueId );
+ fprintf( stdout, ": %s", aMsg.GetBuffer() );
+
+ if ( bPrintContext )
+ fprintf( stdout, " \"%s\"", aContext.GetBuffer() );
+ fprintf( stdout, "\n" );
+}
+
+/*****************************************************************************/
+void GSIBlock::PrintList( ParserMessageList &rList, ByteString aPrefix,
+ GSILine *pLine )
+/*****************************************************************************/
+{
+ ULONG i;
+ for ( i = 0 ; i < rList.Count() ; i++ )
+ {
+ ParserMessage *pMsg = rList.GetObject( i );
+ ByteString aContext;
+ if ( bPrintContext )
+ {
+ if ( pMsg->GetTagBegin() == STRING_NOTFOUND )
+ aContext = pLine->Copy( 0, 300 );
+ else
+ aContext = pLine->Copy( pMsg->GetTagBegin()-150, 300 );
+ aContext.EraseTrailingChars(' ');
+ aContext.EraseLeadingChars(' ');
+ }
+
+ PrintError( pMsg->GetErrorText(), aPrefix, aContext, pLine->GetLineNumber(), pLine->GetUniqId() );
+ }
+}
+
+/*****************************************************************************/
+BOOL GSIBlock::CheckSyntax( ULONG nLine )
+/*****************************************************************************/
+{
+ static LingTest aTester;
+
+ if ( !pGermanLine )
+ {
+ PrintError( "No German reference defined!", "File format", "", nLine, 0 );
+ aTester.ReferenceOK( "" );
+ }
+ else
+ {
+ if ( !aTester.ReferenceOK( *pGermanLine ) )
+ {
+ PrintList( aTester.GetReferenceErrors(), "ReferenceString", pGermanLine );
+ pGermanLine->NotOK();
+ }
+ }
+
+ ULONG i;
+ for ( i = 0; i < Count(); i++ )
+ {
+ if ( !aTester.TesteeOK( *GetObject( i ) ) )
+ {
+ GetObject( i )->NotOK();
+ if ( aTester.HasTesteeErrors() )
+ PrintList( aTester.GetTesteeErrors(), "Translation", GetObject( i ) );
+ if ( aTester.HasCompareWarnings() )
+ PrintList( aTester.GetCompareWarnings(), "Translation Tag Missmatch", GetObject( i ) );
+ }
+ }
+
+ return TRUE;
+}
+
+void GSIBlock::WriteError( SvStream &aErrOut )
+{
+ BOOL bHasError = FALSE;
+ BOOL bCopyAll = !pGermanLine || !pGermanLine->IsOK();
+ ULONG i;
+ for ( i = 0; i < Count(); i++ )
+ {
+ if ( !GetObject( i )->IsOK() || bCopyAll )
+ {
+ bHasError = TRUE;
+ aErrOut.WriteLine( *GetObject( i ) );
+ }
+ }
+
+ if ( pGermanLine && ( bHasError || !pGermanLine->IsOK() ) )
+ aErrOut.WriteLine( *pGermanLine );
+}
+
+void GSIBlock::WriteCorrect( SvStream &aOkOut )
+{
+ if ( !pGermanLine )
+ return;
+
+ BOOL bHasOK = FALSE;
+ ULONG i;
+ for ( i = 0; i < Count(); i++ )
+ {
+ if ( GetObject( i )->IsOK() )
+ {
+ bHasOK = TRUE;
+ aOkOut.WriteLine( *GetObject( i ) );
+ }
+ }
+
+ if ( pGermanLine && bHasOK )
+ aOkOut.WriteLine( *pGermanLine );
+}
+
+/*****************************************************************************/
+/*****************************************************************************/
+/*****************************************************************************/
+/*****************************************************************************/
+/*****************************************************************************/
+/*****************************************************************************/
+/*****************************************************************************/
+
+/*****************************************************************************/
+void Help()
+/*****************************************************************************/
+{
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "gsicheck (c)1999 by StarOffice Entwicklungs GmbH\n" );
+ fprintf( stdout, "================================================\n" );
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "gsicheck checks the syntax of tags in GSI-Files (Gutschmitt-Interface)\n" );
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "Syntax: gsicheck [ -c ] [ -we ] [ -wc ] filename\n" );
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "-c Add context to error message\n" );
+ fprintf( stdout, "-we Write GSI-File containing all errors\n" );
+ fprintf( stdout, "-wc Write GSI-File containing all correct parts\n" );
+ fprintf( stdout, "\n" );
+}
+
+/*****************************************************************************/
+ULONG GetUniqId( const ByteString &rLine )
+/*****************************************************************************/
+{
+ ByteString sTmp( rLine );
+ sTmp.SearchAndReplaceAll( "($$)", "\t" );
+
+ return sTmp.GetToken( 0, '\t' ).ToInt64();
+}
+
+/*****************************************************************************/
+#if defined( UNX ) || defined( MAC )
+int main( int argc, char *argv[] )
+#else
+int _cdecl main( int argc, char *argv[] )
+#endif
+/*****************************************************************************/
+{
+
+ BOOL bError = FALSE;
+ BOOL bPrintContext = FALSE;
+ BOOL bWriteError = FALSE;
+ BOOL bWriteCorrect = FALSE;
+ ByteString aFilename;
+ for ( USHORT i = 1 ; i < argc ; i++ )
+ {
+ if ( *argv[ i ] == '-' )
+ {
+ switch (*(argv[ i ]+1))
+ {
+ case 'c':bPrintContext = TRUE;
+ break;
+ case 'w':
+ {
+ if ( (*(argv[ i ]+2)) == 'e' )
+ bWriteError = TRUE;
+ else if ( (*(argv[ i ]+2)) == 'c' )
+ bWriteCorrect = TRUE;
+ else
+ {
+ fprintf( stderr, "\nERROR: Unknown Switch %s!\n\n", argv[ i ] );
+ bError = TRUE;
+ }
+ }
+ break;
+ default:
+ fprintf( stderr, "\nERROR: Unknown Switch %s!\n\n", argv[ i ] );
+ bError = TRUE;
+ }
+ }
+ else
+ {
+ if ( !aFilename.Len() )
+ aFilename = ByteString( argv[ i ] );
+ else
+ {
+ fprintf( stderr, "\nERROR: Only one filename may be specified!\n\n", argv[ i ] );
+ bError = TRUE;
+ }
+ }
+ }
+
+
+ if ( !aFilename.Len() || bError )
+ {
+ Help();
+ exit ( 0 );
+ }
+
+ DirEntry aSource = DirEntry( String( aFilename, RTL_TEXTENCODING_ASCII_US ));
+ if ( !aSource.Exists()) {
+ fprintf( stderr, "\nERROR: GSI-File %s not found!\n\n", aFilename.GetBuffer() );
+ exit ( 2 );
+ }
+
+ SvFileStream aGSI( String( aFilename, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
+ if ( !aGSI.IsOpen()) {
+ fprintf( stderr, "\nERROR: Could not open GSI-File %s!\n\n", aFilename.GetBuffer() );
+ exit ( 3 );
+ }
+
+ SvFileStream aOkOut;
+ String aBaseName = aSource.GetBase();
+ if ( bWriteCorrect )
+ {
+ String sTmpBase( aBaseName );
+ sTmpBase += String( "_ok", RTL_TEXTENCODING_ASCII_US );
+ aSource.SetBase( sTmpBase );
+ aOkOut.Open( aSource.GetFull() , STREAM_STD_WRITE | STREAM_TRUNC );
+ if ( !aOkOut.IsOpen())
+ {
+ fprintf( stderr, "\nERROR: Could not open GSI-File %s!\n\n", ByteString( aSource.GetFull(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
+ exit ( 4 );
+ }
+ }
+
+ SvFileStream aErrOut;
+ if ( bWriteError )
+ {
+ String sTmpBase( aBaseName );
+ sTmpBase += String( "_err", RTL_TEXTENCODING_ASCII_US );
+ aSource.SetBase( sTmpBase );
+ aErrOut.Open( aSource.GetFull() , STREAM_STD_WRITE | STREAM_TRUNC );
+ if ( !aErrOut.IsOpen())
+ {
+ fprintf( stderr, "\nERROR: Could not open GSI-File %s!\n\n", ByteString( aSource.GetFull(), RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
+ exit ( 4 );
+ }
+ }
+
+
+ ByteString sGSILine;
+
+ ULONG nOldId = 0;
+ GSIBlock *pBlock = NULL;
+ ULONG nLine = 0;
+
+ while ( !aGSI.IsEof()) {
+
+ aGSI.ReadLine( sGSILine );
+ nLine++;
+
+ if ( sGSILine.Len()) {
+ ULONG nId = GetUniqId( sGSILine );
+ if ( nId != nOldId ) {
+ if ( pBlock )
+ {
+ pBlock->CheckSyntax( nLine );
+
+ if ( bWriteError )
+ pBlock->WriteError( aErrOut );
+ if ( bWriteCorrect )
+ pBlock->WriteCorrect( aOkOut );
+
+ delete pBlock;
+ }
+ pBlock = new GSIBlock( bPrintContext );
+
+ nOldId = nId;
+ }
+
+ pBlock->InsertLine( sGSILine, nLine );
+ }
+ }
+ if ( pBlock )
+ {
+ pBlock->CheckSyntax( nLine );
+
+ if ( bWriteError )
+ pBlock->WriteError( aErrOut );
+ if ( bWriteCorrect )
+ pBlock->WriteCorrect( aOkOut );
+
+ delete pBlock;
+ }
+ aGSI.Close();
+ return 0;
+}
diff --git a/transex3/source/gsiconv.cxx b/transex3/source/gsiconv.cxx
new file mode 100644
index 000000000000..1967fa66eb5d
--- /dev/null
+++ b/transex3/source/gsiconv.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * $RCSfile: gsiconv.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <tools/fsys.hxx>
+#include <tools/stream.hxx>
+
+// local includes
+#include "utf8conv.hxx"
+
+/*****************************************************************************/
+void Help()
+/*****************************************************************************/
+{
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "gsiconv (c)1999 by StarOffice Entwicklungs GmbH\n" );
+ fprintf( stdout, "===============================================\n" );
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "gsiconv converts strings in GSI-Files (Gutschmitt Interface) from or to UTF-8\n" );
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "Syntax: gsiconv (-t|-f langid charset)|(-p n) filename\n" );
+ fprintf( stdout, "Switches: -t => conversion from charset to UTF-8\n" );
+ fprintf( stdout, " -f => conversion from UTF-8 to charset\n" );
+ fprintf( stdout, " -p n => creates several files with ca. n lines\n" );
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "Allowed charsets:\n" );
+ fprintf( stdout, " MS_932 => Japanese\n" );
+ fprintf( stdout, " MS_936 => Chinese Simplified\n" );
+ fprintf( stdout, " MS_949 => Korean\n" );
+ fprintf( stdout, " MS_950 => Chinese Traditional\n" );
+ fprintf( stdout, " MS_1250 => East Europe\n" );
+ fprintf( stdout, " MS_1251 => Cyrillic\n" );
+ fprintf( stdout, " MS_1252 => West Europe\n" );
+ fprintf( stdout, " MS_1253 => Greek\n" );
+ fprintf( stdout, " MS_1254 => Turkish\n" );
+ fprintf( stdout, " MS_1255 => Hebrew\n" );
+ fprintf( stdout, " MS_1256 => Arabic\n" );
+ fprintf( stdout, " MS_1257 => Russian\n" );
+ fprintf( stdout, "\n" );
+ fprintf( stdout, "Allowed langids:\n" );
+ fprintf( stdout, " 1 => ENGLISH_US\n" );
+ fprintf( stdout, " 3 => PORTUGUESE \n" );
+ fprintf( stdout, " 4 => GERMAN_DE (new german style)\n" );
+ fprintf( stdout, " 7 => RUSSIAN\n" );
+ fprintf( stdout, " 30 => GREEK\n" );
+ fprintf( stdout, " 31 => DUTCH\n" );
+ fprintf( stdout, " 33 => FRENCH\n" );
+ fprintf( stdout, " 34 => SPANISH\n" );
+ fprintf( stdout, " 35 => FINNISH\n" );
+ fprintf( stdout, " 36 => HUNGARIAN\n" );
+ fprintf( stdout, " 39 => ITALIAN\n" );
+ fprintf( stdout, " 42 => CZECH\n" );
+ fprintf( stdout, " 44 => ENGLISH (UK)\n" );
+ fprintf( stdout, " 45 => DANISH\n" );
+ fprintf( stdout, " 46 => SWEDISH\n" );
+ fprintf( stdout, " 47 => NORWEGIAN\n" );
+ fprintf( stdout, " 49 => GERMAN (old german style)\n" );
+ fprintf( stdout, " 55 => PORTUGUESE_BRAZILIAN\n" );
+ fprintf( stdout, " 81 => JAPANESE\n" );
+ fprintf( stdout, " 82 => KOREAN\n" );
+ fprintf( stdout, " 86 => CHINESE_SIMPLIFIED\n" );
+ fprintf( stdout, " 88 => CHINESE_TRADITIONAL\n" );
+ fprintf( stdout, " 90 => TURKISH\n" );
+ fprintf( stdout, " 96 => ARABIC\n" );
+ fprintf( stdout, " 97 => HEBREW\n" );
+ fprintf( stdout, "\n" );
+}
+
+/*****************************************************************************/
+#if defined( UNX ) || defined( MAC )
+int main( int argc, char *argv[] )
+#else
+int _cdecl main( int argc, char *argv[] )
+#endif
+/*****************************************************************************/
+{
+ if (( argc != 5 ) && ( argc != 4 )) {
+ Help();
+ exit ( 0 );
+ }
+
+ if ( argc == 4 ) {
+ if ( ByteString( argv[ 1 ] ) == "-p" ) {
+
+ DirEntry aSource = DirEntry( String( argv[ 3 ], RTL_TEXTENCODING_ASCII_US ));
+ if ( !aSource.Exists()) {
+ fprintf( stderr, "\nERROR: GSI-File %s not found!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
+ exit ( 2 );
+ }
+
+ DirEntry aOutput( aSource );
+
+ String sBase = aOutput.GetBase();
+ String sExt = aOutput.GetExtension();
+
+ String sGSI( argv[ 3 ], RTL_TEXTENCODING_ASCII_US );
+ SvFileStream aGSI( sGSI, STREAM_STD_READ );
+ if ( !aGSI.IsOpen()) {
+ fprintf( stderr, "\nERROR: Could not open GSI-File %s!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
+ exit ( 3 );
+ }
+
+ ULONG nMaxLines = ByteString( argv[ 2 ] ).ToInt64();
+ if ( !nMaxLines ) {
+ fprintf( stderr, "\nERROR: Linecount must be at least 1!\n\n" );
+ exit ( 3 );
+ }
+
+ ByteString sGSILine;
+ ByteString sOldId;
+ ULONG nLine = 0;
+ ULONG nOutputFile = 1;
+
+ String sOutput( sBase );
+ sOutput += String( "_", RTL_TEXTENCODING_ASCII_US );
+ sOutput += String::CreateFromInt64( nOutputFile );
+ if ( sExt.Len()) {
+ sOutput += String( ".", RTL_TEXTENCODING_ASCII_US );
+ sOutput += sExt;
+ }
+ nOutputFile ++;
+
+ aOutput.SetName( sOutput );
+ SvFileStream aOutputStream( aOutput.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC );
+
+ while ( !aGSI.IsEof()) {
+
+ aGSI.ReadLine( sGSILine );
+ ByteString sId( sGSILine );
+ sId.SearchAndReplaceAll( "($$)", "\t" );
+ sId = sId.GetToken( 0, '\t' );
+
+ nLine++;
+
+ if (( nLine >= nMaxLines ) && ( sId != sOldId )) {
+ aOutputStream.Close();
+
+ ByteString sText( aOutput.GetFull(), gsl_getSystemTextEncoding());
+ sText += " with ";
+ sText += ByteString::CreateFromInt64( nLine );
+ sText += " lines written.";
+
+ fprintf( stdout, "%s\n", sText.GetBuffer());
+ String sOutput( sBase );
+ sOutput += String( "_", RTL_TEXTENCODING_ASCII_US );
+ sOutput += String::CreateFromInt64( nOutputFile );
+ if ( sExt.Len()) {
+ sOutput += String( ".", RTL_TEXTENCODING_ASCII_US );
+ sOutput += sExt;
+ }
+ nOutputFile ++;
+
+ aOutput.SetName( sOutput );
+
+ aOutputStream.Open( aOutput.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC );
+ nLine = 0;
+ }
+
+ aOutputStream.WriteLine( sGSILine );
+
+ sOldId = sId;
+ }
+
+ aGSI.Close();
+ aOutputStream.Close();
+
+ ByteString sText( aOutput.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ sText += " with ";
+ sText += ByteString::CreateFromInt64( nLine );
+ sText += " lines written.";
+ }
+ else {
+ Help();
+ exit( 1 );
+ }
+ }
+ else {
+ if ( ByteString( argv[ 1 ] ) == "-t" || ByteString( argv[ 1 ] ) == "-f" ) {
+ rtl_TextEncoding nEncoding;
+
+ ByteString sCurLangId( argv[ 2 ] );
+
+ ByteString sCharset( argv[ 3 ] );
+ sCharset.ToUpperAscii();
+
+ if ( sCharset == "MS_932" ) nEncoding = RTL_TEXTENCODING_MS_932;
+ else if ( sCharset == "MS_936" ) nEncoding = RTL_TEXTENCODING_MS_936;
+ else if ( sCharset == "MS_949" ) nEncoding = RTL_TEXTENCODING_MS_949;
+ else if ( sCharset == "MS_950" ) nEncoding = RTL_TEXTENCODING_MS_950;
+ else if ( sCharset == "MS_1250" ) nEncoding = RTL_TEXTENCODING_MS_1250;
+ else if ( sCharset == "MS_1251" ) nEncoding = RTL_TEXTENCODING_MS_1251;
+ else if ( sCharset == "MS_1252" ) nEncoding = RTL_TEXTENCODING_MS_1252;
+ else if ( sCharset == "MS_1253" ) nEncoding = RTL_TEXTENCODING_MS_1253;
+ else if ( sCharset == "MS_1254" ) nEncoding = RTL_TEXTENCODING_MS_1254;
+ else if ( sCharset == "MS_1255" ) nEncoding = RTL_TEXTENCODING_MS_1255;
+ else if ( sCharset == "MS_1256" ) nEncoding = RTL_TEXTENCODING_MS_1256;
+ else if ( sCharset == "MS_1257" ) nEncoding = RTL_TEXTENCODING_MS_1257;
+
+ else {
+ Help();
+ exit ( 1 );
+ }
+
+ DirEntry aSource = DirEntry( String( argv[ 4 ], RTL_TEXTENCODING_ASCII_US ));
+ if ( !aSource.Exists()) {
+ fprintf( stderr, "\nERROR: GSI-File %s not found!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
+ exit ( 2 );
+ }
+
+ String sGSI( argv[ 4 ], RTL_TEXTENCODING_ASCII_US );
+ SvFileStream aGSI( sGSI, STREAM_STD_READ );
+ if ( !aGSI.IsOpen()) {
+ fprintf( stderr, "\nERROR: Could not open GSI-File %s!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
+ exit ( 3 );
+ }
+
+ ByteString sGSILine;
+ while ( !aGSI.IsEof()) {
+
+ aGSI.ReadLine( sGSILine );
+ ByteString sLangId( sGSILine );
+ sLangId.SearchAndReplaceAll( "($$)", "\t" );
+ sLangId = sLangId.GetToken( 2, '\t' );
+ if ( sLangId == sCurLangId ) {
+ if ( ByteString( argv[ 1 ] ) == "-t" )
+ sGSILine = UTF8Converter::ConvertToUTF8( sGSILine, nEncoding );
+ else
+ sGSILine = UTF8Converter::ConvertFromUTF8( sGSILine, nEncoding );
+ }
+
+ fprintf( stdout, "%s\n", sGSILine.GetBuffer());
+ }
+
+ aGSI.Close();
+ }
+ else {
+ Help();
+ exit( 1 );
+ }
+ }
+ return 0;
+}
diff --git a/transex3/source/lngex.cxx b/transex3/source/lngex.cxx
new file mode 100644
index 000000000000..9e510d686f41
--- /dev/null
+++ b/transex3/source/lngex.cxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * $RCSfile: lngex.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+
+// local includes
+#include "lngmerge.hxx"
+
+// defines to parse command line
+#define STATE_NON 0x0001
+#define STATE_INPUT 0x0002
+#define STATE_OUTPUT 0x0003
+#define STATE_PRJ 0x0004
+#define STATE_ROOT 0x0005
+#define STATE_MERGESRC 0x0006
+#define STATE_ERRORLOG 0x0007
+#define STATE_BREAKHELP 0x0008
+#define STATE_UNMERGE 0x0009
+
+// set of global variables
+ByteString sInputFile;
+BOOL bEnableExport;
+BOOL bMergeMode;
+BOOL bErrorLog;
+ByteString sPrj;
+ByteString sPrjRoot;
+ByteString sOutputFile;
+ByteString sMergeSrc;
+
+/*****************************************************************************/
+BOOL ParseCommandLine( int argc, char* argv[])
+/*****************************************************************************/
+{
+ bEnableExport = FALSE;
+ bMergeMode = FALSE;
+ bErrorLog = TRUE;
+ sPrj = "";
+ sPrjRoot = "";
+
+ USHORT nState = STATE_NON;
+ BOOL bInput = FALSE;
+
+ // parse command line
+ for( int i = 1; i < argc; i++ ) {
+ if (( ByteString( argv[ i ]) == "-i" ) || ( argv[ i ] == "-I" )) {
+ nState = STATE_INPUT; // next tokens specifies source files
+ }
+ else if (( ByteString( argv[ i ]) == "-o" ) || ( argv[ i ] == "-O" )) {
+ nState = STATE_OUTPUT; // next token specifies the dest file
+ }
+ else if (( ByteString( argv[ i ]) == "-p" ) || ( argv[ i ] == "-P" )) {
+ nState = STATE_PRJ; // next token specifies the cur. project
+ }
+ else if (( ByteString( argv[ i ]) == "-r" ) || ( argv[ i ] == "-R" )) {
+ nState = STATE_ROOT; // next token specifies path to project root
+ }
+ else if (( ByteString( argv[ i ]) == "-m" ) || ( argv[ i ] == "-M" )) {
+ nState = STATE_MERGESRC; // next token specifies the merge database
+ }
+ else if (( ByteString( argv[ i ]) == "-e" ) || ( argv[ i ] == "-E" )) {
+ nState = STATE_ERRORLOG;
+ bErrorLog = FALSE;
+ }
+ else {
+ switch ( nState ) {
+ case STATE_NON: {
+ return FALSE; // no valid command line
+ }
+ break;
+ case STATE_INPUT: {
+ sInputFile = argv[ i ];
+ bInput = TRUE; // source file found
+ }
+ break;
+ case STATE_OUTPUT: {
+ sOutputFile = argv[ i ]; // the dest. file
+ }
+ break;
+ case STATE_PRJ: {
+ sPrj = argv[ i ];
+ sPrj.ToLowerAscii(); // the project
+ }
+ break;
+ case STATE_ROOT: {
+ sPrjRoot = argv[ i ]; // path to project root
+ }
+ break;
+ case STATE_MERGESRC: {
+ sMergeSrc = argv[ i ];
+ bMergeMode = TRUE; // activate merge mode, cause merge database found
+ }
+ break;
+ }
+ }
+ }
+
+ if ( bInput ) {
+ // command line is valid
+ bEnableExport = TRUE;
+ return TRUE;
+ }
+
+ // command line is not valid
+ return FALSE;
+}
+
+
+/*****************************************************************************/
+void Help()
+/*****************************************************************************/
+{
+ fprintf( stdout, "Syntax:LNGEX[-p Prj][-r PrjRoot]-i FileIn -o FileOut[-m DataBase][-e][-b][-u]\n" );
+ fprintf( stdout, " Prj: Project\n" );
+ fprintf( stdout, " PrjRoot: Path to project root (..\\.. etc.)\n" );
+ fprintf( stdout, " FileIn: Source file (*.lng)\n" );
+ fprintf( stdout, " FileOut: Destination file (*.*)\n" );
+ fprintf( stdout, " DataBase: Mergedata (*.sdf)\n" );
+ fprintf( stdout, " -e: no function\n" );
+ fprintf( stdout, " -b: no function\n" );
+ fprintf( stdout, " -u: no function\n" );
+}
+
+/*****************************************************************************/
+#if defined( UNX ) || defined( MAC )
+int main( int argc, char *argv[] )
+#else
+int _cdecl main( int argc, char *argv[] )
+#endif
+/*****************************************************************************/
+{
+ fprintf( stdout, "\nLngEx 1 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.\n" );
+ fprintf( stdout, "====================================================================\n" );
+
+ if ( !ParseCommandLine( argc, argv )) {
+ Help();
+ return 1;
+ }
+
+ fprintf( stdout, "\nProcessing File %s ...\n", sInputFile.GetBuffer());
+
+ if ( sOutputFile.Len()) {
+ LngParser aParser( sInputFile );
+ if ( bMergeMode )
+ aParser.Merge( sMergeSrc, sOutputFile );
+ else
+ aParser.CreateSDF( sOutputFile, sPrj, sPrjRoot );
+ }
+
+ fprintf( stdout, "\n=================================================\n\n" );
+
+ return 0;
+}
diff --git a/transex3/source/lngmerge.cxx b/transex3/source/lngmerge.cxx
new file mode 100644
index 000000000000..b381a532d982
--- /dev/null
+++ b/transex3/source/lngmerge.cxx
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * $RCSfile: lngmerge.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <tools/fsys.hxx>
+
+// local includes
+#include "lngmerge.hxx"
+
+//
+// class LngParser
+//
+
+/*****************************************************************************/
+LngParser::LngParser( const ByteString &rLngFile )
+/*****************************************************************************/
+ : sSource( rLngFile ),
+ nError( LNG_OK ),
+ pLines( NULL )
+{
+ pLines = new LngLineList( 100, 100 );
+
+ DirEntry aEntry( String( sSource, RTL_TEXTENCODING_ASCII_US ));
+ if ( aEntry.Exists()) {
+ SvFileStream aStream( String( sSource, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
+ if ( aStream.IsOpen()) {
+ ByteString sLine;
+ while ( !aStream.IsEof()) {
+ aStream.ReadLine( sLine );
+ pLines->Insert( new ByteString( sLine ), LIST_APPEND );
+ }
+ }
+ else
+ nError = LNG_COULD_NOT_OPEN;
+ }
+ else
+ nError = LNG_FILE_NOTFOUND;
+}
+
+/*****************************************************************************/
+LngParser::~LngParser()
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < pLines->Count(); i++ )
+ delete pLines->GetObject( i );
+ delete pLines;
+}
+
+/*****************************************************************************/
+BOOL LngParser::CreateSDF(
+ const ByteString &rSDFFile, const ByteString &rPrj,
+ const ByteString &rRoot )
+/*****************************************************************************/
+{
+ SvFileStream aSDFStream( String( rSDFFile, RTL_TEXTENCODING_ASCII_US ),
+ STREAM_STD_WRITE | STREAM_TRUNC );
+ if ( !aSDFStream.IsOpen()) {
+ nError = SDF_COULD_NOT_OPEN;
+ }
+ nError = SDF_OK;
+
+ DirEntry aEntry( String( sSource, RTL_TEXTENCODING_ASCII_US ));
+ aEntry.ToAbs();
+ String sFullEntry = aEntry.GetFull();
+ aEntry += DirEntry( String( "..", RTL_TEXTENCODING_ASCII_US ));
+ aEntry += DirEntry( rRoot );
+ ByteString sPrjEntry( aEntry.GetFull(), gsl_getSystemTextEncoding());
+ ByteString sActFileName(
+ sFullEntry.Copy( sPrjEntry.Len() + 1 ), gsl_getSystemTextEncoding());
+ sActFileName.ToLowerAscii();
+
+ ULONG nPos = 0;
+ BOOL bGroup = FALSE;
+ ByteString sGroup;
+
+ // seek to next group
+ while ( nPos < pLines->Count() && !bGroup ) {
+ ByteString sLine( *pLines->GetObject( nPos ));
+ sLine.EraseLeadingChars( ' ' );
+ sLine.EraseTrailingChars( ' ' );
+ if (( sLine.GetChar( 0 ) == '[' ) &&
+ ( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
+ {
+ sGroup = sLine.GetToken( 1, '[' ).GetToken( 0, ']' );
+ sGroup.EraseLeadingChars( ' ' );
+ sGroup.EraseTrailingChars( ' ' );
+ bGroup = TRUE;
+ }
+ nPos ++;
+ }
+
+ while ( nPos < pLines->Count()) {
+
+ ByteString Text[ LANGUAGES ];
+ ByteString sID( sGroup );
+
+ // read languages
+ bGroup = FALSE;
+
+ while ( nPos < pLines->Count() && !bGroup ) {
+ ByteString sLine( *pLines->GetObject( nPos ));
+ sLine.EraseLeadingChars( ' ' );
+ sLine.EraseTrailingChars( ' ' );
+ if (( sLine.GetChar( 0 ) == '[' ) &&
+ ( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
+ {
+ sGroup = sLine.GetToken( 1, '[' ).GetToken( 0, ']' );
+ sGroup.EraseLeadingChars( ' ' );
+ sGroup.EraseTrailingChars( ' ' );
+ bGroup = TRUE;
+ }
+ else if ( sLine.GetTokenCount( '=' ) > 1 ) {
+ ByteString sLang = sLine.GetToken( 0, '=' );
+ sLang.EraseLeadingChars( ' ' );
+ sLang.EraseTrailingChars( ' ' );
+ if (( sLang.IsNumericAscii()) &&
+ ( MergeDataFile::GetLangIndex( sLang.ToInt32()) < LANGUAGES ))
+ {
+ // this is a valid text line
+ ByteString sText = sLine.GetToken( 1, '\"' ).GetToken( 0, '\"' );
+ USHORT nIndex = MergeDataFile::GetLangIndex( sLang.ToInt32());
+ Text[ nIndex ] = sText;
+ }
+ }
+ nPos ++;
+ }
+ BOOL bExport = Text[ GERMAN_INDEX ].Len() &&
+ ( Text[ ENGLISH_INDEX ].Len() || Text[ ENGLISH_US_INDEX ].Len());
+ if ( bExport ) {
+
+ Time aTime;
+ ByteString sTimeStamp( ByteString::CreateFromInt64( Date().GetDate()));
+ sTimeStamp += " ";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetHour());
+ sTimeStamp += ":";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetMin());
+ sTimeStamp += ":";
+ sTimeStamp += ByteString::CreateFromInt32( aTime.GetSec());
+
+ for ( ULONG i = 0; i < LANGUAGES; i++ ) {
+ if ( LANGUAGE_ALLOWED( i )) {
+ ByteString sAct = Text[ i ];
+ if ( !sAct.Len() && i )
+ sAct = Text[ GERMAN_INDEX ];
+
+ ByteString sOutput( rPrj ); sOutput += "\t";
+ if ( rRoot.Len())
+ sOutput += sActFileName;
+ sOutput += "\t0\t";
+ sOutput += "LngText\t";
+ sOutput += sID; sOutput += "\t\t\t\t0\t";
+ sOutput += ByteString::CreateFromInt64( Export::LangId[ i ] ); sOutput += "\t";
+ sOutput += sAct; sOutput += "\t\t\t\t";
+ sOutput += sTimeStamp;
+
+ aSDFStream.WriteLine( sOutput );
+ }
+ }
+ }
+ }
+ aSDFStream.Close();
+ return TRUE;
+}
+
+/*****************************************************************************/
+BOOL LngParser::Merge(
+ const ByteString &rSDFFile, const ByteString &rDestinationFile )
+/*****************************************************************************/
+{
+ SvFileStream aDestination(
+ String( rDestinationFile, RTL_TEXTENCODING_ASCII_US ),
+ STREAM_STD_WRITE | STREAM_TRUNC );
+ if ( !aDestination.IsOpen()) {
+ nError = LNG_COULD_NOT_OPEN;
+ }
+ nError = LNG_OK;
+
+ MergeDataFile aMergeDataFile( rSDFFile, FALSE, RTL_TEXTENCODING_MS_1252 );
+
+ ULONG nPos = 0;
+ BOOL bGroup = FALSE;
+ ByteString sGroup;
+
+ // seek to next group
+ while ( nPos < pLines->Count() && !bGroup ) {
+ ByteString sLine( *pLines->GetObject( nPos ));
+ sLine.EraseLeadingChars( ' ' );
+ sLine.EraseTrailingChars( ' ' );
+ if (( sLine.GetChar( 0 ) == '[' ) &&
+ ( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
+ {
+ sGroup = sLine.GetToken( 1, '[' ).GetToken( 0, ']' );
+ sGroup.EraseLeadingChars( ' ' );
+ sGroup.EraseTrailingChars( ' ' );
+ bGroup = TRUE;
+ }
+ nPos ++;
+ }
+
+ while ( nPos < pLines->Count()) {
+
+ ByteString Text[ LANGUAGES ];
+ ByteString sID( sGroup );
+ ULONG nLastLangPos = 0;
+
+ ResData *pResData = new ResData( "", sID );
+ pResData->sResTyp = "lngtext";
+ PFormEntrys *pEntrys = aMergeDataFile.GetPFormEntrys( pResData );
+
+ // read languages
+ bGroup = FALSE;
+
+ while ( nPos < pLines->Count() && !bGroup ) {
+ ByteString sLine( *pLines->GetObject( nPos ));
+ sLine.EraseLeadingChars( ' ' );
+ sLine.EraseTrailingChars( ' ' );
+ if (( sLine.GetChar( 0 ) == '[' ) &&
+ ( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
+ {
+ sGroup = sLine.GetToken( 1, '[' ).GetToken( 0, ']' );
+ sGroup.EraseLeadingChars( ' ' );
+ sGroup.EraseTrailingChars( ' ' );
+ bGroup = TRUE;
+ }
+ else if ( sLine.GetTokenCount( '=' ) > 1 ) {
+ ByteString sLang = sLine.GetToken( 0, '=' );
+ sLang.EraseLeadingChars( ' ' );
+ sLang.EraseTrailingChars( ' ' );
+ if (( sLang.IsNumericAscii()) &&
+ ( MergeDataFile::GetLangIndex( sLang.ToInt32()) < LANGUAGES ) &&
+ ( pEntrys ))
+ {
+ // this is a valid text line
+ USHORT nIndex = MergeDataFile::GetLangIndex( sLang.ToInt32());
+ ByteString sNewText;
+ pEntrys->GetText( sNewText, STRING_TYP_TEXT, nIndex, TRUE );
+ if ( sNewText.Len()) {
+ ByteString *pLine = pLines->GetObject( nPos );
+
+ if ( sLang.ToInt32() != GERMAN ) {
+
+ ByteString sText( sLang );
+ sText += " = \"";
+ sText += sNewText;
+ sText += "\"";
+ *pLine = sText;
+ }
+ Text[ nIndex ] = sNewText;
+ }
+ nLastLangPos = nPos;
+ }
+ }
+ nPos ++;
+ }
+ if ( nLastLangPos ) {
+ for ( USHORT i = 0; i < LANGUAGES; i++ ) {
+ if (( i != GERMAN ) && ( !Text[ i ].Len())) {
+ ByteString sNewText;
+ pEntrys->GetText( sNewText, STRING_TYP_TEXT, i, TRUE );
+ if (( sNewText.Len()) &&
+ !(( i == COMMENT ) && ( sNewText == "-" )))
+ {
+ ByteString sLine;
+ if ( Export::LangId[ i ] < 10 )
+ sLine += "0";
+ sLine += Export::LangId[ i ];
+ sLine += " = \"";
+ sLine += sNewText;
+ sLine += "\"";
+
+ nLastLangPos++;
+ nPos++;
+
+ pLines->Insert( new ByteString( sLine ), nLastLangPos );
+ }
+ }
+ }
+ }
+
+ delete pResData;
+ }
+
+ for ( ULONG i = 0; i < pLines->Count(); i++ )
+ aDestination.WriteLine( *pLines->GetObject( i ));
+
+ aDestination.Close();
+ return TRUE;
+}
diff --git a/transex3/source/makefile.mk b/transex3/source/makefile.mk
new file mode 100644
index 000000000000..6ef52c08cbc0
--- /dev/null
+++ b/transex3/source/makefile.mk
@@ -0,0 +1,140 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=transex
+TARGET=transex3
+TARGETTYPE=CUI
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+.INCLUDE : static.mk
+
+CDEFS+= -DYY_NEVER_INTERACTIVE=1
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= \
+ $(OBJ)$/export.obj \
+ $(OBJ)$/export2.obj \
+ $(OBJ)$/merge.obj \
+ $(OBJ)$/wrdtrans.obj \
+ $(OBJ)$/wtratree.obj \
+ $(OBJ)$/wtranode.obj
+
+
+APP1TARGET= $(TARGET)
+APP1STACK= 16000
+APP1OBJS= $(OBJ)$/src_yy.obj
+APP1STDLIBS+=$(STATIC_LIBS) $(BTSTRPLIB)
+APP1LIBS+= $(LB)$/$(TARGET).lib
+APP1DEPN= $(OBJ)$/src_yy.obj $(LB)$/$(TARGET).lib
+
+#APP2TARGET= termilo
+#APP2STACK= 16000
+#APP2OBJS= $(OBJ)$/termino.obj
+#APP2STDLIBS=$(STATIC_LIBS) $(L)$/bootstrp.lib
+
+APP3TARGET= lngex
+APP3STACK= 16000
+APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj
+APP3STDLIBS=$(STATIC_LIBS)
+
+APP4TARGET= gsiconv
+APP4STACK= 16000
+APP4OBJS= $(OBJ)$/utf8conv.obj $(OBJ)$/gsiconv.obj
+APP4STDLIBS=$(STATIC_LIBS)
+
+APP5TARGET= gsicheck
+APP5STACK= 16000
+APP5OBJS= $(OBJ)$/gsicheck.obj $(OBJ)$/tagtest.obj
+APP5STDLIBS=$(STATIC_LIBS)
+
+APP6TARGET= xmlex
+APP6STACK= 16000
+APP6OBJS= $(OBJ)$/xmlmerge.obj $(OBJ)$/xml_yy.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj
+APP6STDLIBS=$(STATIC_LIBS)
+
+DEPOBJFILES=$(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS)
+
+.IF "$(depend)" == ""
+ALL : $(MISC)$/src_yy.c \
+ $(MISC)$/xml_yy.c \
+ ALLTAR
+.ELSE
+ALL : \
+ ALLTAR
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/src_yy.c : srclex.l
+ +flex -l -8 -o$(MISC)$/src_yy.c srclex.l
+
+$(MISC)$/xml_yy.c : xmllex.l
+ +flex -l -8 -o$(MISC)$/xml_yy.c xmllex.l
diff --git a/transex3/source/merge.cxx b/transex3/source/merge.cxx
new file mode 100644
index 000000000000..28215f6e81e0
--- /dev/null
+++ b/transex3/source/merge.cxx
@@ -0,0 +1,378 @@
+/*************************************************************************
+ *
+ * $RCSfile: merge.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <tools/fsys.hxx>
+#include "export.hxx"
+
+//
+// class PFormEntrys
+//
+
+/*****************************************************************************/
+BOOL PFormEntrys::GetText( ByteString &rReturn,
+ USHORT nTyp, USHORT nLangIndex, BOOL bDel )
+/*****************************************************************************/
+{
+ BOOL bReturn;
+ switch ( nTyp ) {
+ case STRING_TYP_TEXT :
+ rReturn = sText[ nLangIndex ];
+ if ( bDel )
+ sText[ nLangIndex ] = "";
+ bReturn = bTextFirst[ nLangIndex ];
+ bTextFirst[ nLangIndex ] = FALSE;
+ break;
+ case STRING_TYP_HELPTEXT :
+ rReturn = sHelpText;
+ break;
+ case STRING_TYP_QUICKHELPTEXT :
+ rReturn = sQuickHelpText[ nLangIndex ];
+ if ( bDel )
+ sQuickHelpText[ nLangIndex ] = "";
+ bReturn = bQuickHelpTextFirst[ nLangIndex ];
+ bQuickHelpTextFirst[ nLangIndex ] = FALSE;
+ break;
+ case STRING_TYP_TITLE :
+ rReturn = sTitle[ nLangIndex ];
+ if ( bDel )
+ sTitle[ nLangIndex ] = "";
+ bReturn = bTitleFirst[ nLangIndex ];
+ bTitleFirst[ nLangIndex ] = FALSE;
+ break;
+ }
+ return bReturn;
+}
+
+
+//
+// class MergeData
+//
+
+/*****************************************************************************/
+MergeData::~MergeData()
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < Count(); i++ )
+ delete GetObject( i );
+}
+
+/*****************************************************************************/
+PFormEntrys *MergeData::GetPFormEntrys( ResData *pResData )
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < Count(); i++ ) {
+ if ( *GetObject( i ) == pResData->sPForm )
+ return GetObject( i );
+ }
+ return 0;
+}
+
+/*****************************************************************************/
+PFormEntrys *MergeData::InsertEntry( const ByteString &rPForm )
+/*****************************************************************************/
+{
+ PFormEntrys *pEntrys = new PFormEntrys( rPForm );
+ Insert( pEntrys, LIST_APPEND );
+ return pEntrys;
+}
+
+/*****************************************************************************/
+BOOL MergeData::operator==( ResData *pData )
+/*****************************************************************************/
+{
+ return (( pData->sId == sLID ) &&
+ ( pData->sGId == sGID ) &&
+ ( ByteString( pData->sResTyp ).ToUpperAscii() ==
+ ByteString( sTyp ).ToUpperAscii()));
+}
+
+//
+// class MergeDataFile
+//
+
+/*****************************************************************************/
+MergeDataFile::MergeDataFile( const ByteString &rFileName, BOOL bErrLog,
+ CharSet aCharSet )
+/*****************************************************************************/
+ : bErrorLog( bErrLog )
+{
+ SvFileStream aInputStream( String( rFileName, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
+ aInputStream.SetStreamCharSet( aCharSet );
+// aInputStream.SetTargetCharSet( aCharSet );
+
+ ByteString sLine;
+
+ ByteString sTYP;
+ ByteString sGID;
+ ByteString sLID;
+ ByteString sPFO;
+ USHORT nLANG;
+ ByteString sTEXT;
+ ByteString sQHTEXT;
+ ByteString sTITLE;
+
+ fprintf( stdout, "Scanning File %s ...\n", rFileName.GetBuffer());
+ while ( !aInputStream.IsEof()) {
+ aInputStream.ReadLine( sLine );
+ sLine = sLine.Convert( RTL_TEXTENCODING_MS_1252, aCharSet );
+ sTYP = sLine.GetToken( 1, '\t' );
+ sTYP = sTYP.Copy( 1 ); sTYP.Erase( sTYP.Len() - 1 );
+ sGID = sLine.GetToken( 2, '\t' );
+ sGID = sGID.Copy( 1 ); sGID.Erase( sGID.Len() - 1 );
+ sLID = sLine.GetToken( 3, '\t' );
+ sLID = sLID.Copy( 1 ); sLID.Erase( sLID.Len() - 1 );
+ sPFO = sLine.GetToken( 4, '\t' );
+ sPFO = sPFO.Copy( 1 ); sPFO.Erase( sPFO.Len() - 1 );
+ nLANG = sLine.GetToken( 5, '\t' ).ToInt32();
+ sTEXT = sLine.GetToken( 6, '\t' );
+ sTEXT = sTEXT.Copy( 1 ); sTEXT.Erase( sTEXT.Len() - 1 );
+ sQHTEXT = sLine.GetToken( 8, '\t' );
+ sQHTEXT = sQHTEXT.Copy( 1 ); sQHTEXT.Erase( sQHTEXT.Len() - 1 );
+ sTITLE = sLine.GetToken( 9, '\t' );
+ sTITLE = sTITLE.Copy( 1 ); sTITLE.Erase( sTITLE.Len() - 1 );
+
+ // create new res entry
+ if (( nLANG != 49 ) && ( LANGUAGE_ALLOWED( GetLangIndex( nLANG ))))
+ InsertEntry( sTYP, sGID, sLID, sPFO, nLANG, sTEXT, sQHTEXT, sTITLE );
+ }
+ aInputStream.Close();
+ fprintf( stdout, "Merging ...\n" );
+}
+
+/*****************************************************************************/
+MergeDataFile::~MergeDataFile()
+/*****************************************************************************/
+{
+ for ( ULONG i = 0; i < Count(); i++ ) {
+ MergeData *pData = GetObject( i );
+ delete pData;
+ }
+}
+
+/*****************************************************************************/
+void MergeDataFile::WriteErrorLog( const ByteString &rFileName )
+/*****************************************************************************/
+{
+ if ( bErrorLog ) {
+ DirEntry aDirEntry( String( rFileName, RTL_TEXTENCODING_ASCII_US ));
+ aDirEntry.SetExtension( String( "err", RTL_TEXTENCODING_ASCII_US ));
+ sErrorLog = ByteString( aDirEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ }
+ for ( ULONG i = 0; i < Count(); i++ ) {
+ MergeData *pData = GetObject( i );
+
+ for ( ULONG j = 0; j < pData->Count(); j++ ) {
+ PFormEntrys *pEntrys = pData->GetObject( j );
+ for ( USHORT nLangIndex = 0; nLangIndex < LANGUAGES; nLangIndex++ ) {
+ if ( pEntrys->sText[ nLangIndex ].Len() ||
+ pEntrys->sQuickHelpText[ nLangIndex ].Len() ||
+ pEntrys->sTitle[ nLangIndex ].Len())
+ {
+ ByteString sLine( "0\t" );
+ sLine += pData->sTyp; sLine += "\t";
+ sLine += pData->sGID; sLine += "\t";
+ sLine += pData->sLID; sLine += "\t";
+ sLine += Export::LangId[ nLangIndex ]; sLine += "\t";
+ sLine += pEntrys->sText[ nLangIndex ]; sLine += "\t\t";
+ sLine += pEntrys->sQuickHelpText[ nLangIndex ]; sLine += "\t";
+ sLine += pEntrys->sTitle[ nLangIndex ];
+ WriteError( sLine );
+ }
+ }
+ }
+ }
+ if ( aErrLog.IsOpen())
+ aErrLog.Close();
+}
+
+/*****************************************************************************/
+void MergeDataFile::WriteError( const ByteString &rLine )
+/*****************************************************************************/
+{
+ if ( bErrorLog ) {
+ if ( !aErrLog.IsOpen())
+ aErrLog.Open( String( sErrorLog, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_WRITE | STREAM_TRUNC );
+ aErrLog.WriteLine( rLine );
+ }
+ else
+ fprintf( stderr, "%s\n", rLine.GetBuffer());
+}
+
+/*****************************************************************************/
+MergeData *MergeDataFile::GetMergeData( ResData *pResData )
+/*****************************************************************************/
+{
+ ByteString sOldG = pResData->sGId;
+ ByteString sOldL = pResData->sId;
+ ByteString sGID = pResData->sGId;
+ ByteString sLID;
+ if ( !sGID.Len())
+ sGID = pResData->sId;
+ else
+ sLID = pResData->sId;
+ pResData->sGId = sGID;
+ pResData->sId = sLID;
+
+ for ( ULONG i = 0; i < Count(); i++ ) {
+ if ( *GetObject( i ) == pResData ) {
+ pResData->sGId = sOldG;
+ pResData->sId = sOldL;
+ return GetObject( i );
+ }
+ }
+ pResData->sGId = sOldG;
+ pResData->sId = sOldL;
+ return NULL;
+}
+
+/*****************************************************************************/
+PFormEntrys *MergeDataFile::GetPFormEntrys( ResData *pResData )
+/*****************************************************************************/
+{
+ // search for requested PFormEntrys
+ MergeData *pData = GetMergeData( pResData );
+ if ( pData )
+ return pData->GetPFormEntrys( pResData );
+ return NULL;
+}
+
+/*****************************************************************************/
+void MergeDataFile::InsertEntry(
+ const ByteString &rTYP, const ByteString &rGID,
+ const ByteString &rLID, const ByteString &rPFO,
+ USHORT nLANG, const ByteString &rTEXT,
+ const ByteString &rQHTEXT, const ByteString &rTITLE )
+/*****************************************************************************/
+{
+ MergeData *pData;
+ BOOL bFound = FALSE;
+
+ // search for MergeData
+ for ( long int i = Count() - 1; i >= 0 && !bFound; i-- ) {
+ pData = GetObject( i );
+ if (( pData->sLID == rLID ) &&
+ ( pData->sGID == rGID ) &&
+ ( pData->sTyp == rTYP )) bFound = TRUE;
+ }
+
+ if ( !bFound ) {
+ // create new MergeData, cause no one exists with current properties
+ pData = new MergeData( rTYP, rGID, rLID );
+ Insert( pData, LIST_APPEND );
+ }
+
+ bFound = FALSE;
+ PFormEntrys *pFEntrys;
+
+ // search for PFormEntrys
+ for ( i = pData->Count() - 1; i >= 0 && !bFound; i-- ) {
+ pFEntrys = pData->GetObject( i );
+ if ( *pFEntrys == rPFO )
+ bFound = TRUE;
+ }
+
+ if ( !bFound ) {
+ // create new PFormEntrys, cause no one exists with current properties
+ pFEntrys = new PFormEntrys( rPFO );
+ pData->Insert( pFEntrys, LIST_APPEND );
+ }
+
+ // finaly insert the cur string
+ pFEntrys->InsertEntry( GetLangIndex( nLANG ),
+ rTEXT, rQHTEXT, rTITLE );
+
+}
+
+/*****************************************************************************/
+USHORT MergeDataFile::GetLangIndex( USHORT nId )
+/*****************************************************************************/
+{
+ switch ( nId ) {
+ case COMMENT: return COMMENT_INDEX;
+ case ENGLISH_US: return ENGLISH_US_INDEX;
+ case PORTUGUESE: return PORTUGUESE_INDEX;
+ case RUSSIAN: return RUSSIAN_INDEX;
+ case GREEK: return GREEK_INDEX;
+ case DUTCH: return DUTCH_INDEX;
+ case FRENCH: return FRENCH_INDEX;
+ case SPANISH: return SPANISH_INDEX;
+ case FINNISH: return FINNISH_INDEX;
+ case HUNGARIAN: return HUNGARIAN_INDEX;
+ case ITALIAN: return ITALIAN_INDEX;
+ case CZECH: return CZECH_INDEX;
+ case SLOVAK: return SLOVAK_INDEX;
+ case ENGLISH: return ENGLISH_INDEX;
+ case DANISH: return DANISH_INDEX;
+ case SWEDISH: return SWEDISH_INDEX;
+ case NORWEGIAN: return NORWEGIAN_INDEX;
+ case POLISH: return POLISH_INDEX;
+ case GERMAN: return GERMAN_INDEX;
+ case PORTUGUESE_BRAZILIAN: return PORTUGUESE_BRAZILIAN_INDEX;
+ case JAPANESE: return JAPANESE_INDEX;
+ case KOREAN: return KOREAN_INDEX;
+ case CHINESE_SIMPLIFIED: return CHINESE_SIMPLIFIED_INDEX;
+ case CHINESE_TRADITIONAL: return CHINESE_TRADITIONAL_INDEX;
+ case TURKISH: return TURKISH_INDEX;
+ case ARABIC: return ARABIC_INDEX;
+ case HEBREW: return HEBREW_INDEX;
+ }
+ return 0xFFFF;
+}
diff --git a/transex3/source/srclex.l b/transex3/source/srclex.l
new file mode 100644
index 000000000000..d0af23396e27
--- /dev/null
+++ b/transex3/source/srclex.l
@@ -0,0 +1,283 @@
+%{
+/*
+ * lexer for parsing ressource source files (*.src)
+ *
+ */
+
+
+/* enlarge token buffer to tokenize whole strings */
+#undef YYLMAX
+#define YYLMAX 64000
+
+/* to enable debug output define LEXDEBUG */
+#define LEXDEBUG 1
+#ifdef LEXDEBUG
+#define OUTPUT fprintf
+#else
+#define OUTPUT(Par1,Par2);
+#endif
+
+/* table of possible token ids */
+#include "tokens.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+/* external functions (C++ code, declared as extren "C" */
+extern WorkOnTokenSet( int, char* );
+extern InitExport( char * );
+extern EndExport();
+extern SetError();
+extern GetError();
+extern char *GetOutputFile( int argc, char* argv[]);
+extern FILE *GetNextFile();
+
+/* forwards */
+void YYWarning();
+%}
+
+%p 24000
+%e 1200
+%n 500
+
+%%
+
+^[\t ]*"#pragma".* {
+ WorkOnTokenSet( PRAGMA, yytext );
+}
+
+^[ \t]*\n {
+ WorkOnTokenSet( EMPTYLINE, yytext );
+}
+
+[\t ]+ |
+^[\t ]*"#include".* |
+^[\t ]*"#undef".* |
+"//".* |
+";" |
+"<" |
+">" |
+\n {
+ WorkOnTokenSet( IGNOREDTOKENS, yytext );
+}
+"/*" {
+ char c1 = 0, c2 = input();
+ char pChar[2];
+ pChar[1] = 0x00;
+ pChar[0] = c2;
+
+ WorkOnTokenSet( COMMEND, yytext );
+ WorkOnTokenSet( COMMEND, pChar );
+ for(;;) {
+ if ( c2 == EOF )
+ break;
+ if ( c1 == '*' && c2 == '/' )
+ break;
+ c1 = c2;
+ c2 = input();
+ pChar[0] = c2;
+ WorkOnTokenSet( COMMEND, pChar );
+ }
+}
+
+^[\t ]*"#ifndef".+$ |
+^[\t ]*"#ifdef".+$ |
+^[\t ]*"#if".+$ |
+^[\t ]*"#elif".*$ |
+^[\t ]*"#else".*$ |
+^[\t ]*"#endif".*$ {
+ WorkOnTokenSet( CONDITION, yytext );
+}
+
+[a-zA-Z]+[\t ]+[^={\n]+[\t ] {
+/* defined Res */
+ WorkOnTokenSet( DEFINEDRES, yytext );
+}
+
+[a-zA-Z]+[ \t]+[^={;\n]+\n[ \t]*"#".*\n[ \t]*"{" |
+[a-zA-Z]+[ \t]+[^={;\n]+\n{0,1}([ \t]*"//".*\n)*[ \t]*"{" {
+/* RESSOURCE // String TTT_XX ... */
+ WorkOnTokenSet( RESSOURCE, yytext );
+}
+
+^[\t ]*[a-zA-Z_]+[\t ]*"\\"{0,1}[\t ]*\n{0,1}[ \t]*"{"[\t ]*"\\"{0,1} {
+/* SMALRESSOURCE // String ... */
+ WorkOnTokenSet( SMALRESSOURCE, yytext );
+}
+
+[\t ]*[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_]+[ \t]*"]"[ \t]*){0,1}=[ \t]*L{0,1}\".*\".* {
+/* TEXTLINE // TextTyp = "A Text" */
+ WorkOnTokenSet( TEXTLINE, yytext );
+}
+
+[\t ]*[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_]+[ \t]*"]"[ \t]*){0,1}(\n[ \t]*){0,1}=([ \t]*\n){0,1}(([a-zA-Z0-9_]+)|(\".*\")|([ \t\n]*))*\".*\"(([a-zA-Z0-9_]+)|(\".*\")|([ \t\n]*))*; {
+/* LONGTEXTLINE // TextTyp = "A Text" HHH_XXX "A Text" ZZZ_TTT ... */
+ WorkOnTokenSet( LONGTEXTLINE, yytext );
+}
+
+\".*\" {
+/* TEXT // "A Text" */
+ WorkOnTokenSet( TEXT, yytext );
+}
+
+"{" {
+/* LEVELUP */
+ WorkOnTokenSet( LEVELUP, yytext );
+}
+
+"}"[ \t]*; {
+/* LEVELDOWN */
+ WorkOnTokenSet( LEVELDOWN, yytext );
+}
+
+[a-zA-Z0-9_]+[ \t]*"="[ \t]*"MAP_APPFONT"[ \t]*"(".+")".* {
+/* APPFONTMAPPING Typ = MAP_APPFONT( ... ) */
+ WorkOnTokenSet( APPFONTMAPPING, yytext );
+}
+
+[ \t]*[a-zA-Z0-9_]+[ \t]*=[ \t]*[0123456789]{1,5}[ \t]*";"{0,1} {
+/* TEXTREFID // TextTyp = 12345 */
+ WorkOnTokenSet( TEXTREFID, yytext );
+}
+
+[a-zA-Z0-9_]+[ \t]*"="[\t ]*([ \t]*"//".*\n)*.* |
+[a-zA-Z0-9_]+[ \t]*"=".* {
+/* ASSIGNMENT Typ = ... */
+ WorkOnTokenSet( ASSIGNMENT, yytext );
+}
+
+[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_]+[ \t]*"]"[ \t]*){0,1}"="[ \t]*(\\[ \t]*){0,1}\n{0,1}[ \t]*"{"[ \t]*(\\[ \t]*){0,1}\n{0,1}[ \t]*"<" {
+/* LISTASSIGNMENT Typ [ ... ] = ... */
+ WorkOnTokenSet( LISTASSIGNMENT, yytext );
+}
+
+"StringList"+[ \t]*("["[ \t]*[a-zA-Z0-9_]+[ \t]*"]"[ \t]*){0,1}"="[ \t]*(\\[ \t]*){0,1}\n{0,1}[ \t]*"{"[ \t]*(\\[ \t]*){0,1}\n{0,1}[ \t]* {
+/* LISTASSIGNMENT Typ [ ... ] = ... */
+ WorkOnTokenSet( LISTASSIGNMENT, yytext );
+}
+
+"UIEntries"[ \t]*("["[ \t]*[a-zA-Z0-9_]+[ \t]*"]"[ \t]*){0,1}"="[ \t]*(\\[ \t]*){0,1}\n{0,1}[ \t]*"{" {
+/* UIENTRIES */
+ WorkOnTokenSet( UIENTRIES, yytext );
+}
+
+"<"{0,1}[ \t]*L{0,1}\".*\".*">" {
+/* LISTTEXT */
+ WorkOnTokenSet( LISTTEXT, yytext );
+}
+
+[ \t]*"#define"[ \t]+[a-zA-Z0-9_]+.*"\\" {
+/* RSCDEFINE #define ... */
+ WorkOnTokenSet( RSCDEFINE, yytext );
+}
+
+[ \t]*"#define"[ \t]+[a-zA-Z0-9_]+.+ {
+/* #define ... */
+ WorkOnTokenSet( NORMDEFINE, yytext );
+}
+
+"\\" {
+/* RSCDEFINELEND */
+ WorkOnTokenSet( RSCDEFINELEND, yytext );
+}
+
+[a-zA-Z0-9_]+[ \t]*; {
+/* allowed other tokens like "49 ;" or "SFX_... ;" */
+ WorkOnTokenSet( ANYTOKEN, yytext );
+}
+
+. {
+ WorkOnTokenSet( UNKNOWNCHAR, yytext );
+/* YYWarning( "Unknown Char" ); */
+}
+
+"{"{0,1}[ \t]*\".*\"[ \t]*";"[ \t]*"}" {
+/* _LISTTEXT */
+ WorkOnTokenSet( _LISTTEXT, yytext );
+}
+
+%%
+
+/*****************************************************************************/
+int yywrap(void)
+/*****************************************************************************/
+{
+ FILE *pFile;
+ pFile = GetNextFile();
+ if ( pFile ) {
+ yyin = pFile;
+ yylineno = 0;
+ return 0;
+ }
+
+ /* end of input reached */
+ return 1;
+}
+
+/*****************************************************************************/
+void YYWarning( char *s )
+/*****************************************************************************/
+{
+ /* write warning to stderr */
+ fprintf( stderr, "Warning: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext );
+}
+
+/*****************************************************************************/
+void yyerror( char *s )
+/*****************************************************************************/
+{
+ /* write error to stderr */
+ fprintf( stderr, "Error: \"%s\" in line %d: \"%s\"\n", s, yylineno, yytext );
+ SetError();
+}
+
+/*****************************************************************************/
+int
+#ifdef WNT
+_cdecl
+#endif
+main( int argc, char* argv[])
+/*****************************************************************************/
+{
+ /* error level */
+ int nRetValue = 0;
+ char *pOutput;
+ FILE *pFile;
+
+ fprintf( stdout, "\nTransEx 0.9 Copyright 2000 Sun Microsystems, Inc. All Rights Reserved.\n" );
+ fprintf( stdout, "========================================================================\n" );
+
+ pOutput = GetOutputFile( argc, argv );
+ if ( !pOutput ) {
+ fprintf( stdout, "Syntax:TRANSEX[-p Prj][-r PrjRoot]-i FileIn...[-o FileOut][-m DataBase][-e][-b][-u]\n" );
+ fprintf( stdout, " Prj: Project\n" );
+ fprintf( stdout, " PrjRoot: Path to project root (..\\.. etc.)\n" );
+ fprintf( stdout, " FileIn: Source files (*.src)\n" );
+ fprintf( stdout, " FileOut: Destination file (*.*)\n" );
+ fprintf( stdout, " DataBase: Mergedata (*.sdf)\n" );
+ fprintf( stdout, " -e: Disable writing errorlog\n" );
+ fprintf( stdout, " -b: Break when Token \"HelpText\" found in source\n" );
+ fprintf( stdout, " -u: [english] and [german] are allowed, Id is Taken from DataBase \n" );
+ return 1;
+ }
+
+ pFile = GetNextFile();
+ if ( !pFile )
+ return 1;
+
+ yyin = pFile;
+
+ /* create global instance of class Export */
+ InitExport( pOutput );
+
+ /* start parser */
+ yylex();
+
+ /* get error info. and end export */
+ nRetValue = GetError();
+ EndExport();
+
+ fprintf( stdout, "\n===================================\n\n" );
+
+ /* return error level */
+ return nRetValue;
+}
diff --git a/transex3/source/tagtest.cxx b/transex3/source/tagtest.cxx
new file mode 100644
index 000000000000..d02debe5685b
--- /dev/null
+++ b/transex3/source/tagtest.cxx
@@ -0,0 +1,749 @@
+/*************************************************************************
+ *
+ * $RCSfile: tagtest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#include "tagtest.hxx"
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+
+#define HAS_FLAG( nFlags, nFlag ) ( ( nFlags & nFlag ) != 0 )
+#define SET_FLAG( nFlags, nFlag ) ( nFlags |= nFlag )
+#define RESET_FLAG( nFlags, nFlag ) ( nFlags &= ~nFlag ) // ~ = Bitweises NOT
+
+
+struct Tag
+{
+ char* aName;
+ Token nTag;
+};
+
+
+static Tag __READONLY_DATA aKnownTags[] =
+{
+// { "GROUP_FORMAT", TAG_GROUP_FORMAT },
+ { "BOLD", TAG_BOLDON },
+ { "/BOLD", TAG_BOLDOFF },
+ { "ITALIC", TAG_ITALICON },
+ { "/ITALIC", TAG_ITALICOFF },
+ { "UNDER", TAG_UNDERLINEON },
+ { "/UNDER", TAG_UNDERLINEOFF },
+
+// { "GROUP_NOTALLOWED", TAG_GROUP_NOTALLOWED },
+ { "HELPID", TAG_HELPID },
+ { "MODIFY", TAG_MODIFY },
+ { "REFNR", TAG_REFNR },
+
+// { "GROUP_STRUCTURE", TAG_GROUP_STRUCTURE },
+ { "NAME", TAG_NAME },
+ { "HREF", TAG_HREF },
+ { "AVIS", TAG_AVIS },
+ { "AHID", TAG_AHID },
+ { "AEND", TAG_AEND },
+
+ { "TITEL", TAG_TITEL },
+ { "KEY", TAG_KEY },
+ { "INDEX", TAG_INDEX },
+
+// { "GROUP_SYSSWITCH", TAG_GROUP_SYSSWITCH },
+ { "WIN", TAG_WIN },
+ { "UNIX", TAG_UNIX },
+ { "MAC", TAG_MAC },
+ { "OS2", TAG_OS2 },
+
+// { "GROUP_PROGSWITCH", TAG_GROUP_PROGSWITCH },
+ { "WRITER", TAG_WRITER },
+ { "CALC", TAG_CALC },
+ { "DRAW", TAG_DRAW },
+ { "IMPRESS", TAG_IMPRESS },
+ { "SCHEDULE", TAG_SCHEDULE },
+ { "IMAGE", TAG_IMAGE },
+ { "MATH", TAG_MATH },
+ { "CHART", TAG_CHART },
+ { "OFFICE", TAG_OFFICE },
+
+// { "GROUP_MULTI", TAG_GROUP_MULTI },
+ { "END", TAG_END },
+ { "ELSE", TAG_ELSE },
+ { "", TAG_UNKNOWN_TAG },
+};
+
+
+SimpleParser::SimpleParser()
+: nPos( 0 )
+{
+}
+
+void SimpleParser::Parse( ByteString PaSource )
+{
+ aSource = PaSource;
+ nPos = 0;
+ aLastToken = "";
+ aTokenList.Clear();
+};
+
+Token SimpleParser::GetNextToken()
+{
+ aLastToken = GetNextTokenString();
+ if ( aLastToken == "" )
+ return TAG_NOMORETAGS;
+
+ USHORT i = 0;
+ while ( aKnownTags[i].nTag != TAG_UNKNOWN_TAG &&
+ aLastToken != aKnownTags[i].aName )
+ i++;
+
+ aTokenList.Insert( aKnownTags[i].nTag, LIST_APPEND );
+ return aKnownTags[i].nTag;
+}
+
+ByteString SimpleParser::GetTokenText()
+{
+ return aLastToken;
+}
+
+ByteString SimpleParser::GetNextTokenString()
+{
+ USHORT nStartPos = aSource.Search( "<#", nPos );
+ if ( STRING_NOTFOUND == nStartPos )
+ return "";
+ USHORT nEndPos = aSource.Search( ">", nStartPos );
+ nPos = nEndPos;
+ return aSource.Copy( nStartPos+2, nEndPos-nStartPos -2 ).ToUpperAscii();
+}
+
+ByteString SimpleParser::GetLexem( Token aToken )
+{
+ USHORT i = 0;
+ while ( aKnownTags[i].nTag != TAG_UNKNOWN_TAG &&
+ aKnownTags[i].nTag != aToken )
+ i++;
+ ByteString sReturn( "<#" );
+ sReturn += aKnownTags[i].aName;
+ sReturn += ">";
+ return sReturn;
+}
+
+TokenParser::TokenParser()
+{}
+
+void TokenParser::Parse( const ByteString &aCode )
+{
+ while ( aErrorList.Count() )
+ {
+ delete aErrorList.GetCurObject();
+ aErrorList.Remove();
+ }
+
+
+ //Scanner initialisieren
+ aParser.Parse( aCode );
+
+ //erstes Symbol holen
+ nTag = aParser.GetNextToken();
+
+ nPfCaseOptions = 0;
+ nAppCaseOptions = 0;
+ bPfCaseActive = FALSE;
+ bAppCaseActive = FALSE;
+
+ nActiveRefTypes = 0;
+
+ //Ausführen der Start-Produktion
+ Paragraph();
+
+ //Es wurde nicht die ganze Kette abgearbeitet, bisher ist aber
+ //kein Fehler aufgetreten
+ //=> es wurde ein einleitendes Tag vergessen
+ if ( nTag != TAG_NOMORETAGS )
+ {
+ switch ( nTag )
+ {
+ case TAG_END:
+ {
+ ParseError( 3, "Switch or <#HREF> or <#NAME> expected." );
+ }
+ break;
+ case TAG_BOLDOFF:
+ {
+ ParseError( 4, "<#BOLD> expected before <#/BOLD>." );
+ }
+ break;
+ case TAG_ITALICOFF:
+ {
+ ParseError( 5, "<#ITALIC> expected before <#/ITALIC>." );
+ }
+ break;
+ case TAG_UNDERLINEOFF:
+ {
+ ParseError( 17, "<#UNDER> expected before <#/UNDER>." );
+ }
+ break;
+/* case TAG_MISSPARENTHESIS:
+ {
+ ParseError( 14, "missing closing parenthesis '>'" );
+ }
+ break;*/
+ case TAG_AEND:
+ {
+ ParseError( 5, "Switch or <#HREF> or <#NAME> expected." );
+ }
+ break;
+ case TAG_ELSE:
+ {
+ ParseError( 16, "Application-tag or platform-tag expected before <#ELSE>." );
+ }
+ break;
+ default:
+ {
+ ByteString sTmp( "unknown tag: " );
+ sTmp += aParser.GetLexem( nTag );
+ ParseError( 6, sTmp );
+ }
+ }
+ }
+}
+
+void TokenParser::Paragraph()
+{
+ switch ( nTag )
+ {
+ case TAG_AVIS:
+ case TAG_AHID:
+ {
+ // TagPair();
+ // Paragraph();
+ TagRef();
+ Paragraph();
+ }
+ break;
+ case TAG_HELPID:
+ {
+ SimpleTag();
+ Paragraph();
+ }
+ break;
+ case TAG_BOLDON:
+ case TAG_ITALICON:
+ case TAG_UNDERLINEON:
+ {
+ TagPair();
+ Paragraph();
+ }
+ break;
+ case TAG_HREF:
+ case TAG_NAME:
+ case TAG_KEY:
+ case TAG_INDEX:
+ case TAG_TITEL:
+ {
+ TagRef();
+ Paragraph();
+ }
+ break;
+ case TAG_OS2:
+ case TAG_WIN:
+ case TAG_UNIX:
+ case TAG_MAC: //...
+ {
+ if ( ! bPfCaseActive )
+ {
+ //PfCases dürfen nicht verschachtelt sein:
+ bPfCaseActive = TRUE;
+ PfCase();
+
+ //So jetzt kann wieder ein PfCase kommen:
+ bPfCaseActive = FALSE;
+ Paragraph();
+ }
+ }
+ break;
+ case TAG_WRITER:
+ case TAG_CALC:
+ case TAG_DRAW:
+ case TAG_IMPRESS:
+ case TAG_SCHEDULE:
+ case TAG_IMAGE:
+ case TAG_MATH:
+ case TAG_CHART:
+ case TAG_OFFICE:
+ {
+ if ( !bAppCaseActive )
+ {
+ //AppCases dürfen nicht verschachtelt sein:
+ bAppCaseActive = TRUE;
+ AppCase();
+
+ //jetzt können wieder AppCases kommen:
+ bAppCaseActive = FALSE;
+ Paragraph();
+ }
+ }
+ break;
+
+ //Case TAG_BOLDOFF, TAG_ITALICOFF, TAG_BUNDERLINE, TAG_END
+ //nichts tun wg. epsilon-Prod.
+ }
+}
+
+void TokenParser::PfCase()
+{
+
+ //Produktion:
+ //PfCase -> PfCaseBegin Paragraph (PfCase | PfCaseEnd)
+
+ PfCaseBegin();
+
+ //Jetzt ist eine PfCase-Produktion aktiv:
+ Paragraph();
+ switch ( nTag )
+ {
+ case TAG_ELSE:
+ case TAG_END:
+ {
+ CaseEnd();
+ }
+ break;
+ case TAG_OS2:
+ case TAG_WIN:
+ case TAG_UNIX:
+ case TAG_MAC: //First (PfBegin)
+ {
+ PfCase();
+ }
+ break;
+ default:
+ ParseError( 8, "<#ELSE> or <#END> or platform-tag expected." );
+ }
+ //Die gemerkten Tags wieder löschen für nächstes PfCase:
+ nPfCaseOptions = 0;
+}
+
+void TokenParser::PfCaseBegin()
+{
+ switch ( nTag )
+ {
+ case TAG_OS2:
+ case TAG_WIN:
+ case TAG_UNIX:
+ case TAG_MAC:
+ {
+ //Token darf noch nicht vorgekommen sein im
+ //aktuellen Plattform-Case:
+ if ( !HAS_FLAG( nPfCaseOptions, TAG_NOGROUP( nTag ) ) )
+ {
+ SET_FLAG( nPfCaseOptions, TAG_NOGROUP( nTag ) );
+ match( nTag, nTag );
+ }
+ else {
+ ByteString sTmp( aParser.GetLexem( nTag ));
+ sTmp += " defined twice in the same platform-case.";
+ ParseError( 9, sTmp );
+ }
+ }
+ }
+}
+
+void TokenParser::AppCase()
+{
+
+ //Produktion:
+ //AppCase -> AppCaseBegin Paragraph (AppCase | AppCaseEnd)
+
+
+ AppCaseBegin();
+
+ Paragraph();
+
+ switch ( nTag )
+ {
+ case TAG_ELSE:
+ case TAG_END:
+ {
+ CaseEnd();
+ }
+ break;
+ case TAG_WRITER:
+ case TAG_DRAW:
+ case TAG_CALC:
+ case TAG_IMAGE:
+ case TAG_MATH:
+ case TAG_CHART:
+ case TAG_OFFICE:
+ case TAG_IMPRESS:
+ case TAG_SCHEDULE: //First (AppBegin)
+ {
+ AppCase();
+ }
+ break;
+ default:
+ ParseError( 1, "<#ELSE> or <#END> or application-case-tag expected." );
+ }
+
+ //Die gemerkten Tags wieder löschen für nächstes AppCase:
+ nAppCaseOptions = 0;
+}
+
+void TokenParser::AppCaseBegin()
+{
+ switch ( nTag )
+ {
+ case TAG_WRITER:
+ case TAG_DRAW:
+ case TAG_CALC:
+ case TAG_IMAGE:
+ case TAG_MATH:
+ case TAG_CHART:
+ case TAG_OFFICE:
+ case TAG_IMPRESS:
+ case TAG_SCHEDULE:
+ {
+ //Token darf noch nicht vorgekommen sein im
+ //aktuellen Plattform-Case:
+ if ( !HAS_FLAG( nAppCaseOptions, TAG_NOGROUP( nTag ) ) )
+ {
+ SET_FLAG( nAppCaseOptions, TAG_NOGROUP( nTag ) );
+ match( nTag, nTag );
+ }
+ else {
+ ByteString sTmp( aParser.GetLexem( nTag ));
+ sTmp += " defined twice in the same application-case.";
+ ParseError( 13, sTmp );
+ }
+ }
+ }
+}
+
+void TokenParser::CaseEnd()
+{
+ //Produktion:
+ //CaseEnd -> <#ELSE> Paragraph <#END> | <#END>
+
+ switch ( nTag )
+ {
+ case TAG_ELSE:
+ {
+ match( nTag, TAG_ELSE );
+ Paragraph();
+ match( nTag, TAG_END );
+ }
+ break;
+ case TAG_END:
+ {
+ match( nTag, TAG_END );
+ }
+ break;
+ default:
+ ParseError( 2, "<#ELSE> or <#END> expected." );
+ }
+}
+
+void TokenParser::SimpleTag()
+{
+
+ switch ( nTag )
+ {
+ case TAG_HELPID:
+ {
+ match( nTag, TAG_HELPID );
+ }
+ break;
+ default:
+ ParseError( 15, "[<#SimpleTag>] expected." );
+ }
+}
+
+void TokenParser::TagPair()
+{
+ switch ( nTag )
+ {
+ case TAG_BOLDON:
+ {
+ match( nTag, TAG_BOLDON );
+ Paragraph();
+ match( nTag, TAG_BOLDOFF );
+ }
+ break;
+ case TAG_ITALICON:
+ {
+ match( nTag, TAG_ITALICON );
+ Paragraph();
+ match( nTag, TAG_ITALICOFF );
+ }
+ break;
+ case TAG_UNDERLINEON:
+ {
+ match( nTag, TAG_UNDERLINEON );
+ Paragraph();
+ match( nTag, TAG_UNDERLINEOFF );
+ }
+ break;
+ default:
+ ParseError( 10, "<#BOLD>, <#ITALIC>, <#UNDER> expected." );
+ }
+}
+
+
+void TokenParser::TagRef()
+{
+ switch ( nTag )
+ {
+ case TAG_AVIS:
+ case TAG_AHID:
+ {
+ if ( !HAS_FLAG( nActiveRefTypes, TAG_NOGROUP( nTag ) ) )
+ {
+ Token aThisToken = nTag;
+ SET_FLAG( nActiveRefTypes, TAG_NOGROUP( aThisToken ) );
+ match( nTag, nTag );
+ Paragraph();
+ match( nTag, TAG_AEND );
+ RESET_FLAG( nActiveRefTypes, TAG_NOGROUP( aThisToken ) );
+ }
+ else
+ {
+ ParseError( 11, "Nested <#AHID>,<#AVIS> not allowed." );
+ }
+ }
+ break;
+ case TAG_HREF:
+ case TAG_NAME:
+ {
+
+ }
+ // NOBREAK
+ case TAG_KEY:
+ case TAG_INDEX:
+ case TAG_TITEL:
+ {
+ if ( !HAS_FLAG( nActiveRefTypes, TAG_NOGROUP( nTag ) ) )
+ {
+ Token aThisToken = nTag;
+ SET_FLAG( nActiveRefTypes, TAG_NOGROUP( aThisToken ) );
+ match( nTag, nTag );
+ Paragraph();
+ match( nTag, TAG_END );
+ RESET_FLAG( nActiveRefTypes, TAG_NOGROUP( aThisToken ) );
+ }
+ else
+ {
+ ParseError( 11, "Nested <#HREF>,<#NAME> or <#KEY> not allowed." );
+ }
+ }
+ break;
+ default:
+ ParseError( 12, "<#HREF>,<#NAME> or <#KEY> expected." );
+ }
+}
+
+BOOL TokenParser::match( const Token &aCurrentToken, const Token &aExpectedToken )
+{
+ if ( aCurrentToken == aExpectedToken )
+ {
+ nTag = aParser.GetNextToken();
+ return TRUE;
+ }
+ else
+ {
+ ByteString sTmp( "Expected Symbol: " );
+ sTmp += aParser.GetLexem( aExpectedToken );
+ sTmp += ".";
+ ParseError( 7, sTmp );
+ return FALSE;
+ }
+}
+
+
+void TokenParser::ParseError( USHORT nErrNr, const ByteString &aErrMsg )
+{
+ USHORT nTokenLength = aParser.GetTokenText().Len() + 2;
+ aErrorList.Insert( new ParserMessage( nErrNr, aErrMsg, aParser.GetScanningPosition()-nTokenLength, nTokenLength), LIST_APPEND );
+
+ // Das Fehlerhafte Tag überspringen
+ nTag = aParser.GetNextToken();
+}
+
+void LingTest::CheckMandatoryTag( TokenList aReference, TokenList aTestee, ParserMessageList &rErrorList, Token aToken )
+{
+ while ( (aReference.GetPos( aToken ) != LIST_ENTRY_NOTFOUND) && (aTestee.GetPos( aToken ) != LIST_ENTRY_NOTFOUND) )
+ {
+ aReference.Remove( aToken );
+ aTestee.Remove( aToken );
+ }
+ if ( aReference.GetPos( aToken ) != LIST_ENTRY_NOTFOUND )
+ {
+ ByteString sTmp( "Missing Tag in Translation: " );
+ sTmp += SimpleParser::GetLexem( aToken );
+ rErrorList.Insert( new ParserMessage( 18, sTmp ) );
+ aReference.Remove( aToken );
+ }
+ if ( aTestee.GetPos( aToken ) != LIST_ENTRY_NOTFOUND )
+ {
+ ByteString sTmp( "Extra Tag in Translation: " );
+ sTmp += SimpleParser::GetLexem( aToken );
+ rErrorList.Insert( new ParserMessage( 19, sTmp ));
+ aTestee.Remove( aToken );
+ }
+}
+
+void LingTest::CheckTags( TokenList aReference, TokenList aTestee, ParserMessageList &rErrorList )
+{
+ ULONG i=0,j=0;
+ // Clean old Warnings
+ while ( aCompareWarningList.Count() )
+ {
+ delete aCompareWarningList.GetCurObject();
+ aCompareWarningList.Remove();
+ }
+
+ // First check the mandatory Tags
+/* Check below is much stricter allready
+ CheckMandatoryTag( aReference, aTestee, rErrorList, TAG_AVIS );
+ CheckMandatoryTag( aReference, aTestee, rErrorList, TAG_AHID );
+ CheckMandatoryTag( aReference, aTestee, rErrorList, TAG_HREF );
+ CheckMandatoryTag( aReference, aTestee, rErrorList, TAG_NAME );
+*/
+ i=0;
+ while ( i < aReference.Count() )
+ {
+ Token aToken = aReference.GetObject( i );
+ Token aTokenGroup = TAG_GROUP( aToken );
+ if ( TAG_GROUP_PROGSWITCH == aTokenGroup
+ || TAG_NAME == aToken
+ || TAG_HREF == aToken
+ || TAG_AVIS == aToken
+ || TAG_AHID == aToken )
+ i++;
+ else
+ aReference.Remove( i );
+ }
+
+ i=0;
+ while ( i < aTestee.Count() )
+ {
+ Token aToken = aTestee.GetObject( i );
+ Token aTokenGroup = TAG_GROUP( aToken );
+ if ( TAG_GROUP_PROGSWITCH == aTokenGroup
+ || TAG_NAME == aToken
+ || TAG_HREF == aToken
+ || TAG_AVIS == aToken
+ || TAG_AHID == aToken )
+ i++;
+ else
+ aTestee.Remove( i );
+ }
+
+ BOOL bFatal = FALSE;
+ i=0,j=0;
+ while ( ( i < aReference.Count() || j < aTestee.Count() ) && !bFatal )
+ {
+ if ( aReference.GetObject( i ) != aTestee.GetObject( j ) )
+ {
+ ParserMessage *pNewWarning = NULL;
+ if ( j >= aTestee.Count() || aReference.GetObject( i+1 ) == aTestee.GetObject( j )
+ || aReference.GetObject( i+2 ) == aTestee.GetObject( j ) )
+ {
+ ByteString sTmp( "Missing Tag in Translation: " );
+ sTmp += SimpleParser::GetLexem( aReference.GetObject( i ));
+ pNewWarning = new ParserMessage( 20, sTmp );
+ aReference.Remove( i );
+ }
+ else if ( i >= aReference.Count() || aReference.GetObject( i ) == aTestee.GetObject( j+1 )
+ || aReference.GetObject( i ) == aTestee.GetObject( j+2 ) )
+ {
+ ByteString sTmp( "Extra Tag in Translation: " );
+ sTmp += SimpleParser::GetLexem( aTestee.GetObject( j ));
+ pNewWarning = new ParserMessage( 21, sTmp );
+ aTestee.Remove( j );
+ }
+ else
+ {
+ pNewWarning = new ParserMessage( 22, "Tags Differ. Too many differences to be specified" );
+ bFatal = TRUE;
+ }
+
+ if ( pNewWarning )
+ aCompareWarningList.Insert( pNewWarning, LIST_APPEND );
+ }
+ else
+ i++,j++;
+ }
+}
+
+BOOL LingTest::ReferenceOK( const ByteString &aReference )
+{
+ aReferenceParser.Parse( aReference );
+ return !aReferenceParser.HasErrors();
+}
+
+BOOL LingTest::TesteeOK( const ByteString &aTestee )
+{
+ aTesteeParser.Parse( aTestee );
+
+ CheckTags( aReferenceParser.GetTokenList(), aTesteeParser.GetTokenList(), aTesteeParser.GetErrors() );
+
+ return !aTesteeParser.HasErrors() && !HasCompareWarnings();
+}
+
diff --git a/transex3/source/utf8conv.cxx b/transex3/source/utf8conv.cxx
new file mode 100644
index 000000000000..215087654c00
--- /dev/null
+++ b/transex3/source/utf8conv.cxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * $RCSfile: utf8conv.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "utf8conv.hxx"
+
+//
+// class UTF8Converter
+//
+
+#define MAX_CONV_BUFFER_SIZE 0xFF00
+
+#define TO_CVTFLAGS (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE |\
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |\
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT)
+
+#define FROM_CVTFLAGS (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |\
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |\
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0)
+
+/*****************************************************************************/
+void UTF8Converter::Convert( ByteString &rBuffer,
+ rtl_TextEncoding nSourceENC, rtl_TextEncoding nDestENC )
+/*****************************************************************************/
+{
+ String sTemp( rBuffer, nSourceENC );
+ rBuffer = ByteString( sTemp, nDestENC );
+}
+
+/*****************************************************************************/
+ByteString UTF8Converter::ConvertToUTF8(
+ const ByteString &rASCII, rtl_TextEncoding nEncoding )
+/*****************************************************************************/
+{
+ ByteString sReturn( rASCII );
+ Convert( sReturn, nEncoding, RTL_TEXTENCODING_UTF8 );
+ return sReturn;
+}
+
+/*****************************************************************************/
+ByteString UTF8Converter::ConvertFromUTF8(
+ const ByteString &rUTF8, rtl_TextEncoding nEncoding )
+/*****************************************************************************/
+{
+ ByteString sReturn( rUTF8 );
+ Convert( sReturn, RTL_TEXTENCODING_UTF8, nEncoding );
+ return sReturn;
+}
diff --git a/transex3/source/wrdtrans.cxx b/transex3/source/wrdtrans.cxx
new file mode 100644
index 000000000000..adeb00e6aebc
--- /dev/null
+++ b/transex3/source/wrdtrans.cxx
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * $RCSfile: wrdtrans.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include "wrdtrans.hxx"
+
+
+// NOT FULLY DECLARED SERVICES
+ // STL einbinden
+#if STLPORT_VERSION < 321
+#include <tools/presys.h>
+#include <vector.h>
+#include <tools/postsys.h>
+#else
+#include <vector>
+#endif // STLPORT_VERSION < 321
+#include <vos/macros.hxx>
+
+
+#include <tools/stream.hxx>
+#include "wtratree.hxx"
+
+#include <tools/string.hxx>
+
+//************** Declaration WordTrans_ErrorList ******************//
+typedef NAMESPACE_STD(vector)<ByteString> Stl_ByteStringList;
+
+class WordTrans_ErrorList
+{
+ public:
+ // OPERATIONS
+ void AddError(
+ WordTransformer::E_Error
+ i_eType,
+ const char * i_sErrorDescription );
+ void Clear(); /// Empties the list.
+
+ // INQUIRY
+ USHORT NrOfErrors() const;
+ WordTransformer::E_Error
+ GetError(
+ USHORT i_nNr, /// [0 .. NrOfErrors()-1], other values return an empty error.
+ ByteString * o_pErrorText ) const; /// If o_pErrorText != 0, the String is filled with the description of the error.
+ private:
+ // DATA
+ Stl_ByteStringList aErrors;
+};
+
+
+
+//************** Implementation WordTransformer ******************//
+
+
+WordTransformer::WordTransformer()
+ : dpTransformer(0),
+ dpErrors(new WordTrans_ErrorList)
+{
+}
+
+WordTransformer::~WordTransformer()
+{
+ if (dpTransformer != 0)
+ delete dpTransformer;
+ delete dpErrors;
+}
+
+BOOL
+WordTransformer::LoadWordlist( const ByteString & i_sWordlist_Filepath,
+ CharSet i_nWorkingCharSet,
+ CharSet i_nFileCharSet )
+{
+ if (dpTransformer != 0)
+ return FALSE;
+
+ SvFileStream aFile(String(i_sWordlist_Filepath,RTL_TEXTENCODING_ASCII_US),STREAM_STD_READ);
+ if (! aFile.IsOpen())
+ return FALSE;
+ aFile.SetStreamCharSet( i_nFileCharSet ) ;
+// aFile.SetTargetCharSet( i_nWorkingCharSet );
+
+ dpTransformer = new WordTransTree;
+
+ ByteString sTrans;
+ while ( aFile.ReadLine(sTrans) )
+ {
+ dpTransformer->AddWordPair(sTrans.GetToken(0,';'),sTrans.GetToken(1,';'));
+ }
+
+ aFile.Close();
+ return TRUE;
+}
+
+USHORT
+WordTransformer::Transform(ByteString & io_sText)
+{
+ // Initialization and precondition testing:
+ dpErrors->Clear();
+ if (dpTransformer == 0)
+ {
+ dpErrors->AddError(ERROR_NO_WORDLIST,"Error: No wordlist was loaded.");
+ return dpErrors->NrOfErrors();
+ }
+ else if (io_sText.Len() > 63 * 1024)
+ {
+ dpErrors->AddError(ERROR_OUTPUTSTRING_TOO_LONG,"Error: Inputstring was too long (bigger than 63 KB).");
+ return dpErrors->NrOfErrors();
+ }
+ else if (io_sText.Len() == 0)
+ {
+ return 0;
+ }
+
+ // Transform:
+ dpTransformer->InitTransformation(
+ io_sText.GetBuffer(),
+ io_sText.Len() );
+
+ for ( ; !dpTransformer->TextEndReached(); )
+ {
+ if (dpTransformer->TransformNextToken() != WordTransTree::OK)
+ {
+ CreateError();
+ }
+ }
+ io_sText = dpTransformer->Output();
+ return dpErrors->NrOfErrors();
+}
+
+USHORT
+WordTransformer::NrOfErrors() const
+{
+ return dpErrors->NrOfErrors();
+}
+
+WordTransformer::E_Error
+WordTransformer::GetError( USHORT i_nNr,
+ ByteString * o_pErrorText) const
+{
+ return dpErrors->GetError(i_nNr,o_pErrorText);
+}
+
+void
+WordTransformer::CreateError()
+{
+ ByteString sErr;
+
+ switch (dpTransformer->CurResult())
+ {
+ case WordTransTree::OK:
+ break;
+ case WordTransTree::HOTKEY_LOST:
+ sErr = ByteString("Error: By replacement of string ");
+ sErr += dpTransformer->CurReplacedString();
+ sErr += " by ";
+ sErr += dpTransformer->CurReplacingString();
+ sErr += "the hotkey at char '";
+ sErr += dpTransformer->CurHotkey();
+ sErr += "' was lost.";
+ dpErrors->AddError( ERROR_HOTKEY,sErr.GetBufferAccess());
+ sErr.ReleaseBufferAccess();
+ break;
+ case WordTransTree::OUTPUT_OVERFLOW:
+ dpErrors->AddError(ERROR_OUTPUTSTRING_TOO_LONG,"Error: Output buffer overflow.");
+ break;
+ default:
+ dpErrors->AddError(OTHER_ERROR,"Error: Unknown error.");
+ }
+}
+
+//************** Implementation WordTrans_ErrorList ******************//
+
+void
+WordTrans_ErrorList::AddError( WordTransformer::E_Error i_eType,
+ const char * i_sErrorDescription )
+{
+ ByteString sErrorType = "xxx";
+ char * pErrorChars = sErrorType.GetBufferAccess();
+ pErrorChars[0] = char(i_eType / 100 + '0');
+ pErrorChars[1] = char( (i_eType % 100) / 10 + '0');
+ pErrorChars[2] = char(i_eType % 10 + '0');
+ sErrorType += i_sErrorDescription;
+
+ aErrors.push_back(sErrorType);
+ sErrorType.ReleaseBufferAccess();
+}
+
+void
+WordTrans_ErrorList::Clear()
+{
+ aErrors.erase(aErrors.begin(),aErrors.end());
+}
+
+USHORT
+WordTrans_ErrorList::NrOfErrors() const
+{
+ return aErrors.size();
+}
+
+WordTransformer::E_Error
+WordTrans_ErrorList::GetError( USHORT i_nNr,
+ ByteString * o_pErrorText ) const
+{
+ if (0 <= i_nNr && i_nNr < aErrors.size() )
+ {
+ const ByteString & rError = aErrors[i_nNr];
+ const char * pErrorChars = rError.GetBuffer();
+
+ USHORT nError = USHORT( (pErrorChars[0] - '0') ) * 100
+ + (pErrorChars[1] - '0') * 10
+ + pErrorChars[2] - '0';
+
+ if (o_pErrorText != 0)
+ *o_pErrorText = pErrorChars+3;
+
+ return WordTransformer::E_Error(nError);
+ }
+ else
+ {
+ if (o_pErrorText != 0)
+ *o_pErrorText = "";
+ return WordTransformer::OK;
+ }
+}
+
diff --git a/transex3/source/wtranode.cxx b/transex3/source/wtranode.cxx
new file mode 100644
index 000000000000..4609426a7893
--- /dev/null
+++ b/transex3/source/wtranode.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: wtranode.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include "wtranode.hxx"
+
+
+// NOT FULLY DECLARED SERVICES
+
+
+const ByteString sEmptyString("");
+
+
+WTT_Node::WTT_Node( UINT8 i_nValue,
+ WTT_Node * i_pDefaultBranch,
+ WTT_Node * i_pDefaultBranchForAlphas )
+ : nValue(i_nValue),
+ eType(token_to_keep),
+ sReplaceString(sEmptyString),
+ // aBranches,
+ bIsOnDeleting(char(0))
+{
+ int i = 0;
+ for ( ; i < C_BR_ALPHABASE; i++ )
+ {
+ aBranches[i] = i_pDefaultBranch;
+ } // end for
+ for ( ; i < C_NR_OF_BRANCHES; i++ )
+ {
+ aBranches[i] = i_pDefaultBranchForAlphas;
+ }
+}
+
+void
+WTT_Node::SetBranch( UINT8 i_cBranch,
+ WTT_Node * i_pNode )
+{
+ if (i_cBranch < C_NR_OF_BRANCHES)
+ {
+ aBranches[i_cBranch] = i_pNode;
+ }
+}
+
+void
+WTT_Node::SetAsTokenToReplace(const ByteString & i_sReplaceString)
+{
+ sReplaceString = i_sReplaceString;
+ eType = token_to_replace;
+}
+
+WTT_Node::~WTT_Node()
+{
+ // Delete the tree hanging below this node:
+
+ bIsOnDeleting = TRUE; // Avoid double deleting of multiple used nodes.
+
+ for (int i = 0; i < C_NR_OF_BRANCHES; i++)
+ {
+ if (aBranches[i] != 0 ? ! aBranches[i]->IsOnDeleting() : FALSE)
+ {
+ delete aBranches[i];
+ }
+ } // end for
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/transex3/source/wtratree.cxx b/transex3/source/wtratree.cxx
new file mode 100644
index 000000000000..62bcd3bffc0a
--- /dev/null
+++ b/transex3/source/wtratree.cxx
@@ -0,0 +1,449 @@
+/*************************************************************************
+ *
+ * $RCSfile: wtratree.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include "wtratree.hxx"
+
+
+
+/** @ATTENTION
+ For reasons of speed, class WordTransTree works with two simple
+ char arrays, sOutput and sInput, instead of secure containers or
+ streams. So be extremely careful, when changing this code!!!
+**/
+
+
+
+// NOT FULLY DECLARED SERVICES
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+#include "wtranode.hxx"
+
+
+const BRANCH_T BR_END = 0;
+const BRANCH_T BR_NONALPHA = 1;
+const BRANCH_T BR_HOTKEY = 2;
+const BRANCH_T BR_BACKSLASH = 3;
+const BRANCH_T BR_ALPHABASE = 4; /// @ATTENTION All branches not valid for words must be smaller than this value!
+const BRANCH_T BR_AE = 30;
+const BRANCH_T BR_OE = 31;
+const BRANCH_T BR_UE = 32;
+const BRANCH_T BR_SZ = 33;
+const BRANCH_T BR_MAX = 34; /// @ATTENTION Must be updated always!
+
+const BRANCH_T BR_START = 0;
+
+
+
+
+
+WordTransTree::WordTransTree(CharSet i_nWorkingCharSet)
+ : sInput(0),
+ nInputLength(0),
+ pInputEnd(0),
+ sOutput(0),
+ nOutputMaxLength(0),
+ dpParsingTreeTop(0),
+ pUnknownAlpha(0),
+ // cChar2Branch
+ c_AE(u_char('Ä')), c_OE(u_char('Ö')), c_UE(u_char('Ü')),
+ c_ae(u_char('ä')), c_oe(u_char('ö')), c_ue(u_char('ü')),
+ pInputCurTokenStart(0),
+ pInputPosition(0),
+ pOutputPosition(0),
+ pCurParseNode(0),
+ eCurResult(OK),
+ cCurHotkey(0),
+ cCurHotkeySign(u_char('~'))
+{
+ // Initialize parsing tree:
+ pUnknownAlpha = new WTT_Node(BR_ALPHABASE,0,0); // This will be deleted as part of the parsing tree.
+ for ( UINT8 i = BR_ALPHABASE; i < C_NR_OF_BRANCHES; i++)
+ {
+ pUnknownAlpha->SetBranch(i,pUnknownAlpha);
+ } // end for
+
+ dpParsingTreeTop = new WTT_Node(BR_START,0,pUnknownAlpha);
+
+ WTT_Node * dpNonAlpha = new WTT_Node(BR_NONALPHA,0,0);
+
+ dpNonAlpha->SetBranch(BR_NONALPHA,dpNonAlpha);
+ dpParsingTreeTop->SetBranch(BR_NONALPHA,dpNonAlpha);
+
+ WTT_Node * dpBackslash = new WTT_Node(BR_BACKSLASH,dpNonAlpha,dpNonAlpha);
+ dpBackslash->SetBranch(BR_END,0);
+
+ dpParsingTreeTop->SetBranch(BR_BACKSLASH,dpBackslash);
+ dpNonAlpha->SetBranch(BR_BACKSLASH,dpBackslash);
+
+
+ // Initialize character set:
+ SetCharSet(i_nWorkingCharSet);
+
+ if (C_BR_ALPHABASE != BR_ALPHABASE || C_NR_OF_BRANCHES != BR_MAX)
+ {
+ fprintf(stderr, "Assertion failed: file %s line %d.", __FILE__, __LINE__);
+ exit(1);
+ }
+}
+
+void
+WordTransTree::SetCharSet(CharSet i_nWorkingCharSet)
+{
+ ByteString sConvert("ÄÖÜäöüß");
+ const u_char * pConvert = (const u_char * ) ( sConvert.Convert(RTL_TEXTENCODING_MS_1252, i_nWorkingCharSet).GetBuffer() );
+
+ INT16 i = 0;
+ for ( ; i < C_NR_OF_POSSIBLE_CHARS; ++i )
+ {
+ cChar2Branch[i] = BR_NONALPHA;
+ } // end for
+ for ( i = 'a'; i <= 'z'; ++i )
+ {
+ cChar2Branch[i] = BR_ALPHABASE + i - 'a';
+ } // end for
+ for ( i = 'A'; i <= 'Z'; ++i )
+ {
+ cChar2Branch[i] = BR_ALPHABASE + i - 'A';
+ } // end for
+ cChar2Branch[pConvert[0]] = BR_AE;
+ cChar2Branch[pConvert[1]] = BR_OE;
+ cChar2Branch[pConvert[2]] = BR_UE;
+ cChar2Branch[pConvert[3]] = BR_AE;
+ cChar2Branch[pConvert[4]] = BR_OE;
+ cChar2Branch[pConvert[5]] = BR_UE;
+ cChar2Branch[pConvert[6]] = BR_SZ;
+
+ cChar2Branch[u_char('~')] = BR_HOTKEY;
+ cChar2Branch[u_char('&')] = BR_HOTKEY;
+
+
+ c_AE = pConvert[0];
+ c_OE = pConvert[1];
+ c_UE = pConvert[2];
+ c_ae = pConvert[3];
+ c_oe = pConvert[4];
+ c_ue = pConvert[5];
+}
+
+WordTransTree::~WordTransTree()
+{
+ delete dpParsingTreeTop;
+ if (sOutput != 0)
+ delete [] sOutput;
+}
+
+void
+WordTransTree::AddWordPair( const ByteString & i_sOldString,
+ const ByteString & i_sReplaceString )
+{
+ if (i_sOldString.Len() == 0)
+ return;
+
+ pCurParseNode = dpParsingTreeTop;
+ WTT_Node * pBranch = 0;
+ char cBranch = 0;
+
+ for ( constr pOld = i_sOldString.GetBuffer();
+ *pOld != 0;
+ pOld++ )
+ {
+ cBranch = CalculateBranch(*pOld);
+ pBranch = pCurParseNode->GetNextNode(cBranch);
+ if (pBranch == 0 || pBranch == pUnknownAlpha)
+ {
+ pBranch = new WTT_Node(cBranch,0,pUnknownAlpha);
+ pCurParseNode->SetBranch(cBranch,pBranch);
+ }
+ pCurParseNode = pBranch;
+ } // end for
+ pCurParseNode->SetAsTokenToReplace(i_sReplaceString);
+}
+
+void
+WordTransTree::InitTransformation( const char * i_sInput,
+ UINT32 i_nInputLength,
+ UINT32 i_nOutputMaxLength )
+{
+ sInput = (const u_char *)i_sInput;
+ nInputLength = i_nInputLength;
+ pInputEnd = &sInput[i_nInputLength];
+
+ pInputCurTokenStart = sInput;
+ pInputPosition = sInput;
+
+ if (nOutputMaxLength < i_nOutputMaxLength)
+ {
+ if (sOutput != 0)
+ delete [] sOutput;
+ sOutput = new unsigned char[i_nOutputMaxLength];
+ nOutputMaxLength = i_nOutputMaxLength;
+ }
+ pOutputPosition = sOutput;
+}
+
+/** pInputCurTokenStart and CurParseNode are updated just when
+ starting this function. After its end they must not be changed
+ till this functon is called again.
+ Outside this function pInputPositon and pOutputPosition are both
+ on the first not transformed char in their respective array.
+**/
+WordTransTree::E_Result
+WordTransTree::TransformNextToken()
+{
+ pInputCurTokenStart = pInputPosition;
+ pCurParseNode = dpParsingTreeTop;
+ cCurHotkey = 0;
+ eCurResult = OK;
+
+ WTT_Node * pBranch = 0;
+ UINT8 cBranch = 0;
+
+ for ( pCurParseNode = dpParsingTreeTop;
+ pInputPosition != pInputEnd;
+ ++pInputPosition )
+ {
+ cBranch = CalculateBranch(*pInputPosition);
+ pBranch = pCurParseNode->GetNextNode( cBranch );
+ if (pBranch != 0)
+ {
+ pCurParseNode = pBranch;
+ }
+ else
+ {
+ if (cBranch == BR_HOTKEY) // current letter is '~' or '&'.
+ {
+ // Logic of the following. There are 9 possible cases -
+ // A = alphabetic letter, NA = non alphabetic, TB = token begin,
+ // Eot = end of text:
+ // 1. A~A set hotkey to following letter, continue
+ // 2. A~NA token end
+ // 3. A~Eot token end
+ // 4. NA~A token end
+ // 5. NA~NA continue
+ // 6. A~Eof continue
+ // 7. TB~A set hotkey to following letter, continue
+ // 8. TB~NA continue
+ // 9. TB~Eot continue
+
+ // bNext and Prev are true, if there are alphabetic letters:
+ BOOL bNext = pInputPosition + 1 != pInputEnd
+ ? CalculateBranch(pInputPosition[1]) >= BR_ALPHABASE
+ : FALSE;
+ BOOL bPrev = pCurParseNode->Value() >= BR_ALPHABASE;
+
+ if ( bNext && (bPrev || pCurParseNode == dpParsingTreeTop) )
+ { // case 1. and 7.
+ Handle_Hotkey();
+ continue;
+ }
+ else if (!bPrev && !bNext)
+ { // case 5.,6.,8.,9.
+ continue;
+ }
+
+ // Case 2.,3.,4. :
+ // so this should be handled as an end of a token.
+ }
+ if (pCurParseNode->TokenType() == WTT_Node::token_to_keep)
+ {
+ Handle_TokenToKeep();
+ return eCurResult;
+ }
+ else
+ {
+ Handle_TokenToTransform();
+ return eCurResult;
+ } // endif (pCurParseNode->TokenType() == WTT_Node::token_to_keep)
+ } // endif (pBranch == 0) else
+ } // end for
+
+ // If here, the text end is reached
+ if (pCurParseNode->TokenType() == WTT_Node::token_to_keep)
+ {
+ Handle_TokenToKeep();
+ return eCurResult;
+ }
+ else
+ {
+ Handle_TokenToTransform();
+ return eCurResult;
+ }
+}
+
+ByteString
+WordTransTree::CurReplacingString() const
+{
+ return pCurParseNode->ReplaceString();
+}
+
+void
+WordTransTree::Handle_Hotkey()
+{
+ if (cCurHotkey == 0) // Avoid to replace the first found hotkey by
+ // a later one - though this shouldn't happen anyway.
+ {
+ cCurHotkey = (pInputPosition+1) != pInputEnd ? pInputPosition[1] : 0;
+ cCurHotkeySign = *pInputPosition;
+ }
+}
+
+void
+WordTransTree::Handle_TokenToKeep()
+{
+ UINT32 nTokenLength = pInputPosition-pInputCurTokenStart;
+
+ memcpy(pOutputPosition,pInputCurTokenStart,nTokenLength);
+
+ pOutputPosition += nTokenLength;
+ *pOutputPosition = '\0';
+}
+
+void
+WordTransTree::Handle_TokenToTransform()
+{
+ BOOL bHaveHotkey = CalculateBranch(cCurHotkey) >= BR_ALPHABASE;
+ const ByteString & rReplace = pCurParseNode->ReplaceString();
+
+ // Find position of hotkey in replace-string:
+ USHORT nHotkeyPos = bHaveHotkey
+ ? rReplace.Search(char(cCurHotkey))
+ : STRING_NOTFOUND;
+ if (nHotkeyPos == STRING_NOTFOUND && bHaveHotkey)
+ {
+ if (cCurHotkey < 128)
+ {
+ if (islower(cCurHotkey))
+ nHotkeyPos = rReplace.Search(toupper(char(cCurHotkey)));
+ else
+ nHotkeyPos = rReplace.Search(tolower(char(cCurHotkey)));
+ }
+ else // cCurHotkey >= 128
+ {
+ if (cCurHotkey == c_ae)
+ nHotkeyPos = rReplace.Search(char(c_AE));
+ else if (cCurHotkey == c_oe)
+ nHotkeyPos = rReplace.Search(char(c_OE));
+ else if (cCurHotkey == c_ue)
+ nHotkeyPos = rReplace.Search(char(c_UE));
+ else if (cCurHotkey == c_AE)
+ nHotkeyPos = rReplace.Search(char(c_ae));
+ else if (cCurHotkey == c_OE)
+ nHotkeyPos = rReplace.Search(char(c_oe));
+ else if (cCurHotkey == c_UE)
+ nHotkeyPos = rReplace.Search(char(c_ue));
+ } // endif (cCurHotkey < 128) else
+
+ if (nHotkeyPos == STRING_NOTFOUND)
+ {
+ eCurResult = HOTKEY_LOST;
+ bHaveHotkey = FALSE;
+ }
+ } // endif (nHotkeyPos == STRING_NOT_FOUND && bHaveHotkey)
+
+
+ UINT32 nOutputTokenLength = rReplace.Len() + (bHaveHotkey ? 1 : 0);
+
+ if (bHaveHotkey)
+ {
+ memcpy( pOutputPosition,
+ pCurParseNode->ReplaceString().GetBuffer(),
+ nHotkeyPos );
+ *(pOutputPosition + nHotkeyPos) = cCurHotkeySign;
+ memcpy( pOutputPosition + nHotkeyPos + 1,
+ pCurParseNode->ReplaceString().GetBuffer() + nHotkeyPos,
+ nOutputTokenLength - nHotkeyPos - 1);
+ }
+ else
+ {
+ memcpy( pOutputPosition,
+ pCurParseNode->ReplaceString().GetBuffer(),
+ nOutputTokenLength );
+ }
+
+ // Convert first letter into upper if necessary:
+ u_char cInStart = CalculateBranch(*pInputCurTokenStart) == BR_HOTKEY
+ ? pInputCurTokenStart[1]
+ : pInputCurTokenStart[0] ;
+ u_char * pOutStart = nHotkeyPos == 0
+ ? pOutputPosition + 1
+ : pOutputPosition ;
+ if (isupper(cInStart) || cInStart > 127)
+ { // Possibly cInStart is upper character:
+ if (isupper(cInStart) || cInStart == c_AE || cInStart == c_OE || cInStart == c_UE)
+ { // Surely cInStart is upper character:
+ u_char cOutStart = *pOutStart;
+ if (cOutStart < 128)
+ *pOutStart = toupper(cOutStart);
+ else if (cOutStart == c_ae)
+ *pOutStart = c_AE;
+ else if (cOutStart == c_oe)
+ *pOutStart = c_OE;
+ else if (cOutStart == c_ue)
+ *pOutStart = c_UE;
+ }
+ } // endif (isupper(cInStart) || cInStart > 127)
+
+ pOutputPosition += nOutputTokenLength;
+ *pOutputPosition = '\0';
+}
+
diff --git a/ucbhelper/inc/ucbhelper/commandenvironment.hxx b/ucbhelper/inc/ucbhelper/commandenvironment.hxx
new file mode 100644
index 000000000000..683a889651d7
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/commandenvironment.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: commandenvironment.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
+#define _UCBHELPER_COMMANDENVIRONMENT_HXX
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace ucb
+{
+
+struct CommandEnvironment_Impl;
+
+//=========================================================================
+
+/**
+ * This class implements the interface
+ * com::sun::star::ucb::XCommandEnvironement. Instances of this class can
+ * be used to supply environments to commands executed by UCB contents.
+ */
+class CommandEnvironment : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XCommandEnvironment
+{
+ CommandEnvironment_Impl* m_pImpl;
+
+private:
+ CommandEnvironment( const CommandEnvironment& ); // n.i.
+ CommandEnvironment& operator=( const CommandEnvironment& ); // n.i.
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxInteractionHandler is the implementation of an Interaction
+ * Handler or an empty reference.
+ * @param rxProgressHandler is the implementation of a Progress
+ * Handler or an empty reference.
+ */
+ CommandEnvironment(
+ const com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler >&
+ rxInteractionHandler,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler >&
+ rxProgressHandler );
+ /**
+ * Destructor.
+ */
+ virtual ~CommandEnvironment();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XCommandEnvironemnt
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler > SAL_CALL
+ getProgressHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_COMMANDENVIRONMENT_HXX */
diff --git a/ucbhelper/inc/ucbhelper/configureucb.hxx b/ucbhelper/inc/ucbhelper/configureucb.hxx
new file mode 100644
index 000000000000..63873735348d
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/configureucb.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: configureucb.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONFIGUREUCB_HXX_
+#define _UCBHELPER_CONFIGUREUCB_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+ namespace ucb { class XContentProviderManager; }
+ namespace uno { class RuntimeException; }
+} } }
+namespace rtl { class OUString; }
+
+//============================================================================
+/** The keys under which the com.sun.star.ucb.Configuration service's
+ com::sun::star::ucb::XContentProviderConfigurationManager stores the
+ various com::sun::star::ucb::XContentProviderConfigurations.
+ */
+#define UCBHELPER_CONFIGURATION_KEY_STANDARD "ContentProviderServices"
+#define UCBHELPER_CONFIGURATION_KEY_LOCAL "LocalContentProviderServices"
+
+//============================================================================
+namespace ucb {
+
+/** Configure a (newly instantiated) Universal Content Broker.
+
+ @descr This function tries to register at the given UCB all the content
+ provider services supplied by the given
+ com::sun::star::ucb::XContentProviderConfiguration.
+
+ @param rUcb A (newly intantiated) Universal Content Broker.
+
+ @param rFactory A factory through which to obtain the
+ com.sun.star.ucb.Configuration service and the various content provider
+ services.
+
+ @param rConfigurationKey The key under which the given
+ com.sun.star.ucb.Configuration service's
+ com::sun::star::ucb::XContentProviderConfigurationManager stores the
+ desired com::sun::star::ucb::XContentProviderConfiguration.
+
+ @return True if the UCB has successfuly been configured (though not all
+ content providers have necessarily been registered due to conflicts with
+ already registered providers).
+ */
+bool
+configureUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rUcb,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rFactory,
+ rtl::OUString const & rConfigurationKey)
+ throw (com::sun::star::uno::RuntimeException);
+
+}
+
+#endif // _UCBHELPER_CONFIGUREUCB_HXX_
+
diff --git a/ucbhelper/inc/ucbhelper/content.hxx b/ucbhelper/inc/ucbhelper/content.hxx
new file mode 100644
index 000000000000..6c2c4092af17
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/content.hxx
@@ -0,0 +1,760 @@
+/*************************************************************************
+ *
+ * $RCSfile: content.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENT_HXX
+#define _UCBHELPER_CONTENT_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySetInfo;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XActiveDataSink;
+ class XOutputStream;
+ class XInputStream;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace sdbc {
+ class XResultSet;
+ class XRow;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class CommandAbortedException;
+ class XCommandEnvironment;
+ class XCommandInfo;
+ class XContent;
+ class XContentIdentifier;
+ class XDynamicResultSet;
+} } } }
+
+namespace ucb
+{
+
+//=========================================================================
+
+/**
+ * This exception will be thrown from class ucb::Content constructors.
+ */
+class ContentCreationException : public ::com::sun::star::uno::Exception
+{
+public:
+ enum Reason
+ {
+ UNKNOWN,
+ NO_CONTENT_BROKER,
+ NO_IDENTIFIER_FACTORY,
+ IDENTIFIER_CREATION_FAILED,
+ NO_CONTENT_PROVIDER,
+ CONTENT_CREATION_FAILED
+ };
+
+private:
+ Reason m_eReason;
+
+public:
+ ContentCreationException( Reason eReason = UNKNOWN )
+ : m_eReason( eReason ) {}
+
+ const Reason getReason() const { return m_eReason; }
+};
+
+//=========================================================================
+
+/**
+ * These are the possible values for the parameter eMode of method
+ * ucb::Content::createCursor.
+ */
+enum ResultSetInclude
+{
+ INCLUDE_FOLDERS_ONLY,
+ INCLUDE_DOCUMENTS_ONLY,
+ INCLUDE_FOLDERS_AND_DOCUMENTS
+};
+
+//=========================================================================
+
+class Content_Impl;
+
+/**
+ * This class simplifies access to UCB contents by providing a more
+ * convenient API for frequently used functionality then the "raw"
+ * UCB-API does.
+ */
+class Content
+{
+ vos::ORef< Content_Impl > m_xImpl;
+
+public:
+ /**
+ * Constructor.
+ */
+ Content();
+
+ /**
+ * Constructor.
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const rtl::OUString& rURL,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Constructor.
+ *
+ * @param rId is the content identifier of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& rId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Constructor.
+ *
+ * @param rContent is the content object of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent >& rContent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv );
+ /**
+ * Copy Constructor.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content( const Content& rOther );
+
+ /**
+ * Destructor.
+ */
+ ~Content();
+
+ /**
+ * Assignment operator.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content& operator=( const Content& rOther );
+
+ //////////////////////////////////////////////////////////////////////
+ // Direct access to UCB content.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method provides access to the "native" UCB content interface(s).
+ * This is usefull in case the convenience methods provided by this
+ * class are insufficient for your needs. You may obtain all interfaces
+ * supported by the underlying UCB content by calling this method and
+ * after that doing a queryInterface call.
+ *
+ * @return the XContent interface of the underlying UCB content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >
+ get() const;
+
+ //////////////////////////////////////////////////////////////////////
+ // Access to supported commands/properties.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This methods provides access to meta data of the commands supported
+ * by this content.
+ *
+ * @return An XCommandInfo interface implementation, which can be used
+ * to obtain meta data of the commands supported by this content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandInfo >
+ getCommands()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods provides access to meta data of the properties supported
+ * by this content.
+ *
+ * @return An XPropertSetInfo interface implementation, which can be used
+ * to obtain meta data of the properties supported by this content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ getProperties()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // Access to property value(s).
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the value
+ * shall be obtained.
+ * @return the property value.
+ */
+ ::com::sun::star::uno::Any
+ getPropertyValue( const rtl::OUString& rPropertyName )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param nPropertyHande is the handle of the property for that the
+ * value shall be obtained.
+ * @return the property value.
+ */
+ ::com::sun::star::uno::Any
+ getPropertyValue( sal_Int32 nPropertyHandle )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the
+ * value shall be set.
+ */
+ void
+ setPropertyValue( const rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param nPropertyHande is the handle of the property for that the
+ * value shall be set.
+ */
+ void
+ setPropertyValue( const sal_Int32 nPropertyHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values shall be obtained.
+ * @return an XRow interface that can be used to obtain the property
+ * values.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValuesInterface( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values shall be obtained.
+ * @return an XRow interface that can be used to obtain the property
+ * values.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValuesInterface( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that values shall be set.
+ */
+ void
+ setPropertyValues( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that values shall be set.
+ */
+ void
+ setPropertyValues( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // General command execution.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandName is the name of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ */
+ ::com::sun::star::uno::Any
+ executeCommand( const rtl::OUString& rCommandName,
+ const ::com::sun::star::uno::Any& rCommandArgument )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ ::com::sun::star::uno::Any
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandHandle is the handle of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ */
+ executeCommand( sal_Int32 nCommandHandle,
+ const ::com::sun::star::uno::Any& rCommandArgument )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to abort the command currently executed by
+ * a content. Note that a content can only process one command per
+ * thread at a time. The implementation of the content is responsible
+ * for determining the command to abort when this method is called.
+ */
+ void
+ abortCommand();
+ /**
+ * This method returns the command environment of the content.
+ *
+ * @return the command environment.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >
+ getCommandEnvironment();
+
+ //////////////////////////////////////////////////////////////////////
+ // Special commands.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createCursor( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createCursor( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createDynamicCursor( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param nPropertyHandes is a sequence of handles of properties for
+ * that the values should be accessable via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createDynamicCursor( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rSink is the implementation of an XActiveDataSink interface,
+ * which shall be used by the content to deliver the data.
+ */
+ sal_Bool
+ openStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XActiveDataSink >& rSink )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rStream is the implementation of an XOutputStream interface,
+ * which shall be used by the content to deliver the data.
+ */
+ sal_Bool
+ openStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XOutputStream >& rStream )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "insert" at the content.
+ *
+ * @param rStream is the implementation of an XInputStream interface,
+ * which contains the content data to write.
+ * @param bReplaceExisting specifies, whether any existing content data
+ * shall be overwritten.
+ */
+ void
+ writeStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ sal_Bool bReplaceExisting )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param nPropertyHandes is a sequence of handles of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the handles must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property handles.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param nPropertyHandes is a sequence of handles of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the handles must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property handles.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // Required properties.
+ //////////////////////////////////////////////////////////////////////
+
+ /** This method returns the value of the content's property "IsFolder".
+ *
+ * @return true, if the content is a folder ( it can contain other
+ * UCB contents). false, otherwise.
+ */
+ sal_Bool
+ isFolder()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /** This method returns the value of the content's property "IsDocument".
+ *
+ * @return true, if the content is a document ( it has a content stream ).
+ * false, otherwise.
+ */
+ sal_Bool
+ isDocument()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_CONTENT_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentbroker.hxx b/ucbhelper/inc/ucbhelper/contentbroker.hxx
new file mode 100644
index 000000000000..cfdc9876fc4b
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentbroker.hxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentbroker.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#define _UCBHELPER_CONTENTBROKER_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XContentIdentifierFactory;
+ class XContentProvider;
+ class XContentProviderManager;
+} } } }
+
+namespace ucb
+{
+
+class ContentBroker_Impl;
+
+//=========================================================================
+
+/**
+ * This class simplifies access to the Universal Content Broker (UCB).
+ * Currently there can only be one UCB instance per process. This class can
+ * be used to initialize and deinitialize the Broker and to access its
+ * interfaces directly.
+ */
+class ContentBroker
+{
+ ContentBroker_Impl* m_pImpl;
+ // The "one and only" Broker.
+ static ContentBroker* m_pTheBroker;
+
+private:
+ ContentBroker( const ContentBroker& ); // n.i.
+ ContentBroker& operator=( const ContentBroker& ); // n.i.
+
+ /** Constructor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rArguments are the arguments to pass to the
+ * com.sun.star.ucb.UniversalContentBroker service when creating it.
+ * Currently, this must be a sequence containing exactly one
+ * boolean. If this boolean is true, the Broker is automatically
+ * configured (the appropriate content provider services are
+ * registered); if the boolean is false, the Broker is left
+ * unconfigured (no content providers are registered).
+ */
+ ContentBroker( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rArguments );
+
+protected:
+ /**
+ * Destructor.
+ */
+ ~ContentBroker();
+
+public:
+ /** Initialize "the one and only" Broker. This method must be called
+ * exactly once, before the Broker is used in any way.
+ *
+ * @param rSMgr is a factory to create services needed in the Broker's
+ * implementation.
+ *
+ * @param rArguments are the arguments to pass to the
+ * com.sun.star.ucb.UniversalContentBroker service when creating
+ * it. Currently, this must be a sequence containing exactly one
+ * boolean. If this boolean is true, the Broker is automatically
+ * configured (the appropriate content provider services are
+ * registered); if the boolean is false, the Broker is left
+ * unconfigured (no content providers are registered).
+ *
+ * @return True if creation and possible configuration of the Broker
+ * was successful.
+ */
+ static sal_Bool
+ initialize( const::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rArguments );
+
+ /** Deinitialize "the one and only" Broker. Once this method has been
+ * called, the Broker must not be used any longer.
+ */
+ static void
+ deinitialize();
+
+ /**
+ * This method returns the Broker, if it was already initialized.
+ *
+ * @return the Broker or 0, if ContentBroker::initialize() was not yet
+ * called or did fail.
+ */
+ static ContentBroker*
+ get();
+
+ /**
+ * This method returns the Service Manager used to instanciate the Broker.
+ *
+ * @return a Service Manager.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >
+ getServiceManager() const;
+
+ /**
+ * This method returns the XContentIdentifierFactory interface of the
+ * Broker.
+ *
+ * @return a XContentIdentifierFactory interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifierFactory >
+ getContentIdentifierFactoryInterface() const;
+
+ /**
+ * This method returns the XContentProvider interface of the Broker.
+ *
+ * @return a XContentProvider interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentProvider >
+ getContentProviderInterface() const;
+
+ /**
+ * This method returns the XContentProviderManager interface of the Broker.
+ *
+ * @return a XContentProviderManager interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentProviderManager >
+ getContentProviderManagerInterface() const;
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_CONTENTBROKER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contenthelper.hxx b/ucbhelper/inc/ucbhelper/contenthelper.hxx
new file mode 100644
index 000000000000..e0bdf0c0b78d
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contenthelper.hxx
@@ -0,0 +1,577 @@
+/*************************************************************************
+ *
+ * $RCSfile: contenthelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#define _UCBHELPER_CONTENTHELPER_HXX
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HPP_
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGENOTIFIER_HPP_
+#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
+#include <com/sun/star/ucb/XContent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFOCHANGENOTIFIER_HPP_
+#include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFOCHANGENOTIFIER_HPP_
+#include <com/sun/star/ucb/XCommandInfoChangeNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/container/XChild.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XCommandInfo;
+ class XPersistentPropertySet;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySetInfo;
+} } } }
+
+namespace ucb_impl { struct ContentImplHelper_Impl; }
+
+namespace ucb
+{
+
+//=========================================================================
+
+struct PropertyInfoTableEntry
+{
+ const sal_Char* pName;
+ sal_Int32 nHandle;
+ const ::com::sun::star::uno::Type* pType;
+ sal_Int16 nAttributes;
+};
+
+//=========================================================================
+
+struct CommandInfoTableEntry
+{
+ const sal_Char* pName;
+ sal_Int32 nHandle;
+ const ::com::sun::star::uno::Type* pArgType;
+};
+
+//=========================================================================
+
+class ContentProviderImplHelper;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.Content. Implementations derived from this class are
+ * objects provided by implementations derived from
+ * class ucb::ContentProviderImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service com::sun::star::ucb::Content
+ * - all required listener containers
+ * ( XComponent, XPropertiesChangeNotifier, XPropertySetInfoChangeNotifier,
+ * XCommandInfoChangeNotifier )
+ * - XPropertyContainer implementation ( persistence is implemented using
+ * service com.sun.star.ucb.Store )
+ * - complete XPropertySetInfo implementation ( including Additioanl Core
+ * Properties supplied via XPropertyContainer interface )
+ * -> protected method: getPropertySetInfo
+ * - complete XCommandInfo implementation
+ * -> protected method: getCommandInfo
+ */
+class ContentImplHelper :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XComponent,
+ public com::sun::star::ucb::XContent,
+ public com::sun::star::ucb::XCommandProcessor,
+ public com::sun::star::beans::XPropertiesChangeNotifier,
+ public com::sun::star::beans::XPropertyContainer,
+ public com::sun::star::beans::XPropertySetInfoChangeNotifier,
+ public com::sun::star::ucb::XCommandInfoChangeNotifier,
+ public com::sun::star::container::XChild
+{
+ friend class PropertySetInfo;
+ friend class CommandProcessorInfo;
+
+ ucb_impl::ContentImplHelper_Impl* m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >
+ m_xIdentifier;
+ vos::ORef< ContentProviderImplHelper >
+ m_xProvider;
+ sal_uInt32 m_nCommandId;
+
+private:
+ /**
+ * Your implementation of this method must return a table containing
+ * the meta data of the properties supported by the content.
+ * Note: If you wish to provide your own implementation of the interface
+ * XPropertyContainer ( completely override addContent and removeContent
+ * implementation of this base class in this case ), you can supply the
+ * meta data for your Additional Core Properties here to get a fully
+ * featured getPropertySetInfo method ( see below ).
+ *
+ * @return a table containing the property meta data.
+ */
+ virtual const ::ucb::PropertyInfoTableEntry& getPropertyInfoTable() = 0;
+
+ /**
+ * Your implementation of this method must return a table containing
+ * the meta data of the commands supported by the content.
+ *
+ * @return a table containing the command meta data.
+ */
+ virtual const ::ucb::CommandInfoTableEntry& getCommandInfoTable() = 0;
+
+ /**
+ * The implementation of this method shall return the URL of the parent
+ * of your content.
+ *
+ * @return the URL of the parent content or an empty string.
+ * Note that not all contents must have one parent. There may
+ * be contents with no parent. In that case an empty string must
+ * be returned. If your content has more than one parent you may
+ * return the URL of one "preferred" parent or an empty string.
+ */
+ virtual ::rtl::OUString getParentURL() = 0;
+
+protected:
+ /**
+ * This method returns complete meta data for the properties ( including
+ * Additional Core Properties supplied via XPropertyContainer interface )
+ * supported by the content. To implement the required command
+ * "getPropertySetInfo" simply return the return value of this method.
+ *
+ * @return an XPropertySetInfo implementation object containing meta data
+ * for the properties supported by this content.
+ */
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
+ getPropertySetInfo();
+
+ /**
+ * This method returns complete meta data for the commands supported by
+ * the content. To implement the required command "getCommandInfo" simply
+ * return the return value of this method.
+ *
+ * @return an XCommandInfo implementation object containing meta data
+ * for the commands supported by this content.
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
+ getCommandInfo();
+
+ /**
+ * This method can be used to propagate changes of property values.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertiesChange(
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::PropertyChangeEvent >& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the propertyset
+ * info of your content (i.e. this happens if a new property is added
+ * to your content via its XPropertyContainer interface). This base class
+ * automatically generates events when the propertyset info changes. If
+ * you provide your own implementations of addproperty and removeProperty,
+ * then you must call "notifyPropertySetInfoChange" by yourself.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertySetInfoChange(
+ const com::sun::star::beans::PropertySetInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the command info of
+ * your content. This can happen at any time if there shall be a new
+ * command available at a content or a currently present command shall no
+ * longer be present. (i.e. only if the content count of a trash can
+ * object is greater then zero, there will be available a command
+ * "emptyTrash". If there are no objects in the trash can, this command
+ * won't be available.
+ *
+ * @param evt is a sequence of command info change events.
+ */
+ void notifyCommandInfoChange(
+ const com::sun::star::ucb::CommandInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate content events.
+ *
+ * @param evt is a sequence of content events.
+ */
+ void notifyContentEvent(
+ const com::sun::star::ucb::ContentEvent& evt ) const;
+
+ /**
+ * Use this method to announce the insertion of this content at
+ * the end of your implementation of the command "insert". The
+ * implementation of is method propagates a ContentEvent( INSERTED ).
+ */
+ void inserted();
+
+ /**
+ * Use this method to announce the destruction of this content at
+ * the end of your implementation of the command "delete". The
+ * implementation of is method propagates a ContentEvent( DELETED )
+ * and a ContentEvent( REMOVED ) at the parent of the deleted content,
+ * if a parent exists.
+ */
+ void deleted();
+
+ /**
+ * Use this method to change the identity of a content. The implementation
+ * of this method will replace the content identifier of the content and
+ * propagate the appropriate ContentEvent( EXCHANGED ).
+ *
+ * @param rNewId is the new content identifier for the contant.
+ * @return a success indicator.
+ */
+ sal_Bool exchange( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& rNewId );
+
+ /**
+ * Use this method to get access to the Additional Core Properties of
+ * the content ( added using content's XPropertyContainer interface ).
+ * If you supply your own XPropertyContainer implementation, this method
+ * will always return an empty propertyset.
+ *
+ * @param bCreate indicates whether a new propertyset shall be created
+ * if it does not exist.
+ * @return the implementation of the service
+ * com.sun.star.ucb.PersistentPropertySet.
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( sal_Bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool renameAdditionalPropertySet( const ::rtl::OUString& rOldKey,
+ const ::rtl::OUString& rNewKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool removeAdditionalPropertySet( sal_Bool bRecursive );
+
+public:
+ /**
+ * Constructor.
+ *
+ * Note that the implementation of this ctor registers itself at its
+ * content provider. The provider implementation inserts the content
+ * in a hash map. So it easyly can be found and reused when the provider
+ * is asked for a content.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rxProvider is the provider for the content.
+ * @param Identifier is the content identifier for the content.
+ * @param bRegisterAtProvider can be used to create a content that
+ * will not autmatically register itself at its provider. This
+ * can be usefull if creating a content object from inside a
+ * XContentCreator::createNewContent method. That new content
+ * would register at its provider after it has successfully
+ * processed its "insert" command".
+ */
+ ContentImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< ContentProviderImplHelper >& rxProvider,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& Identifier,
+ sal_Bool bRegisterAtProvider = sal_True );
+
+ /**
+ * Destructor.
+ *
+ * Note that the implementation of this dtor deregisters itself from its
+ * content provider. The provider implementation removes the content
+ * from a hash map.
+ */
+ virtual ~ContentImplHelper();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // 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 >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContent
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ getIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getContentType()
+ throw( com::sun::star::uno::RuntimeException ) = 0;
+ virtual void SAL_CALL
+ addContentEventListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeContentEventListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandProcessor
+ virtual sal_Int32 SAL_CALL
+ createCommandIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Any SAL_CALL
+ execute( const com::sun::star::ucb::Command& aCommand,
+ sal_Int32 CommandId,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::uno::Exception,
+ com::sun::star::ucb::CommandAbortedException,
+ com::sun::star::uno::RuntimeException ) = 0;
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId )
+ throw( com::sun::star::uno::RuntimeException ) = 0;
+
+ // XPropertiesChangeNotifier
+ virtual void SAL_CALL
+ addPropertiesChangeListener(
+ const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertiesChangeListener(
+ const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandInfoChangeNotifier
+ virtual void SAL_CALL
+ addCommandInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeCommandInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XPropertyContainer
+
+ /**
+ * This method adds a property to the content according to the interface
+ * specification. The properties will be stored using the service
+ * com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ addProperty( const rtl::OUString& Name,
+ sal_Int16 Attributes,
+ const com::sun::star::uno::Any& DefaultValue )
+ throw( com::sun::star::beans::PropertyExistException,
+ com::sun::star::beans::IllegalTypeException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::uno::RuntimeException );
+
+ /**
+ * This method removes a property from the content according to the
+ * interface specification. The properties will be stored using the
+ * service com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ removeProperty( const rtl::OUString& Name )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::beans::NotRemoveableException,
+ com::sun::star::uno::RuntimeException );
+
+ // XPropertySetInfoChangeNotifier
+ virtual void SAL_CALL
+ addPropertySetInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertySetInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XChild
+
+ /**
+ * This method returns the content representing the parent of a content,
+ * if such a parent exists. The implementation of this method uses your
+ * implementation of getParentURL.
+ */
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface > SAL_CALL
+ getParent()
+ throw( com::sun::star::uno::RuntimeException );
+
+ /**
+ * The implementation of this method always throws a NoSupportException.
+ */
+ virtual void SAL_CALL
+ setParent( const com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface >& Parent )
+ throw( com::sun::star::lang::NoSupportException,
+ com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the provider of the content.
+ *
+ * @return the provider of the content.
+ */
+ const vos::ORef< ContentProviderImplHelper >& getProvider() const
+ { return m_xProvider; }
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_CONTENTHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentidentifier.hxx b/ucbhelper/inc/ucbhelper/contentidentifier.hxx
new file mode 100644
index 000000000000..7886f47118aa
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentidentifier.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentidentifier.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#define _UCBHELPER_CONTENTIDENTIFIER_HXX
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIER_HPP_
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#endif
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace rtl {
+ class OUString;
+}
+
+namespace ucb
+{
+
+struct ContentIdentifier_Impl;
+
+//=========================================================================
+
+/**
+ * This class implements a simple identifier object for UCB contents.
+ * It mainly stores and returns the URL as it was passed to the constructor -
+ * The only difference is that the URL scheme will be lower cased. This can
+ * be done, because URL schemes are never case sensitive.
+ */
+class ContentIdentifier :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XContentIdentifier
+{
+public:
+ ContentIdentifier( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::OUString& rURL );
+ ContentIdentifier( const rtl::OUString& rURL );
+ virtual ~ContentIdentifier();
+
+ // 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( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ release()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContentIdentifier
+ virtual rtl::OUString SAL_CALL
+ getContentIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getContentProviderScheme()
+ throw( com::sun::star::uno::RuntimeException );
+
+private:
+ ContentIdentifier_Impl* m_pImpl;
+};
+
+} /* namespace ucb */
+
+#endif /* !_UCBHELPER_CONTENTIDENTIFIER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentinfo.hxx b/ucbhelper/inc/ucbhelper/contentinfo.hxx
new file mode 100644
index 000000000000..659d662c3cfa
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentinfo.hxx
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentinfo.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTINFO_HXX
+#define _UCBHELPER_CONTENTINFO_HXX
+
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace ucb {
+
+//============================================================================
+//
+// class PropertySetInfo.
+//
+//============================================================================
+
+class ContentImplHelper;
+
+/**
+ * This class provides a propertyset info ( the complete implementation of
+ * the interface XPropertySetInfo ) for an object derived from class
+ * ucb::ContentImplHelper. The implementation takes care about Additional
+ * Core Properties that may have been added to the content.
+ */
+class PropertySetInfo :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::beans::XPropertySetInfo
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Sequence< com::sun::star::beans::Property >*
+ m_pProps;
+ vos::OMutex m_aMutex;
+ ContentImplHelper* m_pContent;
+
+private:
+ sal_Bool queryProperty( const rtl::OUString& rName,
+ com::sun::star::beans::Property& rProp );
+
+public:
+ PropertySetInfo( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent );
+ virtual ~PropertySetInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XPropertySetInfo
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::beans::Property > SAL_CALL
+ getProperties()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::beans::Property SAL_CALL
+ getPropertyByName( const rtl::OUString& aName )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const rtl::OUString& Name )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-Interface methods.
+ void reset();
+};
+
+//============================================================================
+//
+// class CommandProcessorInfo.
+//
+//============================================================================
+
+/**
+ * This class provides a command info ( the complete implementation of
+ * the interface XCommandInfo ) for an object derived from class
+ * ucb::ContentImplHelper.
+ */
+class CommandProcessorInfo :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XCommandInfo
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >*
+ m_pCommands;
+ vos::OMutex m_aMutex;
+ ContentImplHelper* m_pContent;
+
+private:
+ sal_Bool queryCommand( const rtl::OUString& rName,
+ com::sun::star::ucb::CommandInfo& rCommand );
+ sal_Bool queryCommand( sal_Int32 nHandle,
+ com::sun::star::ucb::CommandInfo& rCommand );
+
+public:
+ CommandProcessorInfo( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent );
+ virtual ~CommandProcessorInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XCommandInfo
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::ucb::CommandInfo > SAL_CALL
+ getCommands()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::ucb::CommandInfo SAL_CALL
+ getCommandInfoByName( const rtl::OUString& Name )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::ucb::CommandInfo SAL_CALL
+ getCommandInfoByHandle( sal_Int32 Handle )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasCommandByName( const rtl::OUString& Name )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasCommandByHandle( sal_Int32 Handle )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-Interface methods.
+ void reset();
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_CONTENTINFO_HXX */
diff --git a/ucbhelper/inc/ucbhelper/macros.hxx b/ucbhelper/inc/ucbhelper/macros.hxx
new file mode 100644
index 000000000000..d5f7c201ade8
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/macros.hxx
@@ -0,0 +1,792 @@
+/*************************************************************************
+ *
+ * $RCSfile: macros.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_MACROS_HXX
+#define _UCBHELPER_MACROS_HXX
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAKREF_HXX_
+#include <cppuhelper/weakref.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+
+//=========================================================================
+
+#define CPPU_TYPE( T ) getCppuType( static_cast< T * >( 0 ) )
+#define CPPU_TYPE_REF( T ) CPPU_TYPE( com::sun::star::uno::Reference< T > )
+
+//=========================================================================
+//
+// XInterface decl.
+//
+//=========================================================================
+
+#define XINTERFACE_DECL() \
+ 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( com::sun::star::uno::RuntimeException ); \
+ virtual void SAL_CALL \
+ release() \
+ throw( com::sun::star::uno::RuntimeException );
+
+//=========================================================================
+//
+// XInterface impl. internals.
+//
+//=========================================================================
+
+#define XINTERFACE_COMMON_IMPL( Class ) \
+void SAL_CALL Class::acquire() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ OWeakObject::acquire(); \
+} \
+ \
+void SAL_CALL Class::release() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ OWeakObject::release(); \
+}
+
+#define QUERYINTERFACE_IMPL_START( Class ) \
+com::sun::star::uno::Any SAL_CALL Class::queryInterface( \
+ const com::sun::star::uno::Type & rType ) \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ com::sun::star::uno::Any aRet = cppu::queryInterface( rType,
+
+#define QUERYINTERFACE_IMPL_END \
+ ); \
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); \
+}
+
+//=========================================================================
+//
+// XInterface impl.
+//
+//=========================================================================
+
+// 1 interface implemented
+#define XINTERFACE_IMPL_1( Class, Ifc1 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 2 interfaces implemented
+#define XINTERFACE_IMPL_2( Class, Ifc1, Ifc2 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 3 interfaces implemented
+#define XINTERFACE_IMPL_3( Class, Ifc1, Ifc2, Ifc3 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 4 interfaces implemented
+#define XINTERFACE_IMPL_4( Class, Ifc1, Ifc2, Ifc3, Ifc4 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ), \
+ SAL_STATIC_CAST( Ifc4*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 5 interfaces implemented
+#define XINTERFACE_IMPL_5( Class, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ), \
+ SAL_STATIC_CAST( Ifc4*, this ), \
+ SAL_STATIC_CAST( Ifc5*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 6 interfaces implemented
+#define XINTERFACE_IMPL_6( Class,I1,I2,I3,I4,I5,I6 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 7 interfaces implemented
+#define XINTERFACE_IMPL_7( Class,I1,I2,I3,I4,I5,I6,I7 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 8 interfaces implemented
+#define XINTERFACE_IMPL_8( Class,I1,I2,I3,I4,I5,I6,I7,I8 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 9 interfaces implemented
+#define XINTERFACE_IMPL_9( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 10 interfaces implemented
+#define XINTERFACE_IMPL_10( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 11 interfaces implemented
+#define XINTERFACE_IMPL_11( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 12 interfaces implemented
+#define XINTERFACE_IMPL_12( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 13 interfaces implemented
+#define XINTERFACE_IMPL_13( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 14 interfaces implemented
+#define XINTERFACE_IMPL_14( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ), \
+ SAL_STATIC_CAST( I14*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 15 interfaces implemented
+#define XINTERFACE_IMPL_15( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ), \
+ SAL_STATIC_CAST( I14*, this ), \
+ SAL_STATIC_CAST( I15*, this ) \
+QUERYINTERFACE_IMPL_END
+
+//=========================================================================
+//
+// XTypeProvider decl.
+//
+//=========================================================================
+
+#define XTYPEPROVIDER_DECL() \
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \
+ getImplementationId() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \
+ getTypes() \
+ throw( com::sun::star::uno::RuntimeException );
+
+//=========================================================================
+//
+// XTypeProvider impl. internals
+//
+//=========================================================================
+
+#define XTYPEPROVIDER_COMMON_IMPL( Class ) \
+com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \
+Class::getImplementationId() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ static cppu::OImplementationId* pId = NULL; \
+ if ( !pId ) \
+ { \
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \
+ if ( !pId ) \
+ { \
+ static cppu::OImplementationId id( sal_False ); \
+ pId = &id; \
+ } \
+ } \
+ return (*pId).getImplementationId(); \
+}
+
+#define GETTYPES_IMPL_START( Class ) \
+com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \
+Class::getTypes() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ static cppu::OTypeCollection* pCollection = NULL; \
+ if ( !pCollection ) \
+ { \
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \
+ if ( !pCollection ) \
+ { \
+ static cppu::OTypeCollection collection(
+
+#define GETTYPES_IMPL_END \
+ ); \
+ pCollection = &collection; \
+ } \
+ } \
+ return (*pCollection).getTypes(); \
+}
+
+//=========================================================================
+//
+// XTypeProvider impl.
+//
+//=========================================================================
+
+// 1 interface supported
+#define XTYPEPROVIDER_IMPL_1( Class, I1 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ) \
+GETTYPES_IMPL_END
+
+// 2 interfaces supported
+#define XTYPEPROVIDER_IMPL_2( Class, I1,I2 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ) \
+GETTYPES_IMPL_END
+
+// 3 interfaces supported
+#define XTYPEPROVIDER_IMPL_3( Class, I1,I2,I3 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ) \
+GETTYPES_IMPL_END
+
+// 4 interfaces supported
+#define XTYPEPROVIDER_IMPL_4( Class, I1,I2,I3,I4 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ) \
+GETTYPES_IMPL_END
+
+// 5 interfaces supported
+#define XTYPEPROVIDER_IMPL_5( Class, I1,I2,I3,I4,I5 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ) \
+GETTYPES_IMPL_END
+
+// 6 interfaces supported
+#define XTYPEPROVIDER_IMPL_6( Class, I1,I2,I3,I4,I5,I6 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ) \
+GETTYPES_IMPL_END
+
+// 7 interfaces supported
+#define XTYPEPROVIDER_IMPL_7( Class, I1,I2,I3,I4,I5,I6,I7 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ) \
+GETTYPES_IMPL_END
+
+// 8 interfaces supported
+#define XTYPEPROVIDER_IMPL_8( Class, I1,I2,I3,I4,I5,I6,I7,I8 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ) \
+GETTYPES_IMPL_END
+
+// 9 interfaces supported
+#define XTYPEPROVIDER_IMPL_9( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ) \
+GETTYPES_IMPL_END
+
+// 10 interfaces supported
+#define XTYPEPROVIDER_IMPL_10( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ) \
+GETTYPES_IMPL_END
+
+// 11 interfaces supported
+#define XTYPEPROVIDER_IMPL_11( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ) \
+GETTYPES_IMPL_END
+
+// 12 interfaces supported
+#define XTYPEPROVIDER_IMPL_12( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ) \
+GETTYPES_IMPL_END
+
+// 13 interfaces supported
+#define XTYPEPROVIDER_IMPL_13( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ) \
+GETTYPES_IMPL_END
+
+// 14 interfaces supported
+#define XTYPEPROVIDER_IMPL_14( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ), \
+ CPPU_TYPE_REF( I14 ) \
+GETTYPES_IMPL_END
+
+// 15 interfaces supported
+#define XTYPEPROVIDER_IMPL_15( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ), \
+ CPPU_TYPE_REF( I14 ), \
+ CPPU_TYPE_REF( I15 ) \
+GETTYPES_IMPL_END
+
+//=========================================================================
+//
+// XServiceInfo decl.
+//
+//=========================================================================
+
+#define XSERVICEINFO_NOFACTORY_DECL() \
+ 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 ); \
+ \
+ static rtl::OUString \
+ getImplementationName_Static(); \
+ static com::sun::star::uno::Sequence< rtl::OUString > \
+ getSupportedServiceNames_Static();
+
+#define XSERVICEINFO_DECL() \
+ XSERVICEINFO_NOFACTORY_DECL() \
+ \
+ static com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+ createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr );
+
+//=========================================================================
+//
+// XServiceInfo impl. internals
+//
+//=========================================================================
+
+#define XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+rtl::OUString SAL_CALL Class::getImplementationName() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ return getImplementationName_Static(); \
+} \
+ \
+rtl::OUString Class::getImplementationName_Static() \
+{ \
+ return ImplName; \
+} \
+ \
+sal_Bool SAL_CALL \
+Class::supportsService( const rtl::OUString& ServiceName ) \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNL = \
+ getSupportedServiceNames(); \
+ const rtl::OUString* pArray = aSNL.getArray(); \
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) \
+ { \
+ if( pArray[ i ] == ServiceName ) \
+ return sal_True; \
+ } \
+ \
+ return sal_False; \
+} \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL \
+Class::getSupportedServiceNames() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ return getSupportedServiceNames_Static(); \
+}
+
+#define XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+static com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface > SAL_CALL \
+Class##_CreateInstance( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory> & rSMgr ) \
+ throw( com::sun::star::uno::Exception ) \
+{ \
+ com::sun::star::lang::XServiceInfo* pX = \
+ (com::sun::star::lang::XServiceInfo*)new Class( rSMgr ); \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface >::query( pX ); \
+}
+
+//=========================================================================
+//
+// XServiceInfo impl.
+//
+//=========================================================================
+
+#define ONE_INSTANCE_SERVICE_FACTORY_IMPL( Class ) \
+com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+Class::createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \
+{ \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory >( \
+ cppu::createOneInstanceFactory( \
+ rxServiceMgr, \
+ Class::getImplementationName_Static(), \
+ Class##_CreateInstance, \
+ Class::getSupportedServiceNames_Static() ) ); \
+}
+
+#define SINGLE_SERVICE_FACTORY_IMPL( Class ) \
+com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+Class::createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \
+{ \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory >( \
+ cppu::createSingleFactory( \
+ rxServiceMgr, \
+ Class::getImplementationName_Static(), \
+ Class##_CreateInstance, \
+ Class::getSupportedServiceNames_Static() ) ); \
+}
+
+// Service without service factory.
+
+// Own implementation of getSupportedServiceNames_Static().
+#define XSERVICEINFO_NOFACTORY_IMPL_0( Class, ImplName ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static()
+
+// 1 service name
+#define XSERVICEINFO_NOFACTORY_IMPL_1( Class, ImplName, Service1 ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static() \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \
+ aSNS.getArray()[ 0 ] = Service1; \
+ return aSNS; \
+}
+
+// Service with service factory.
+
+// Own implementation of getSupportedServiceNames_Static().
+#define XSERVICEINFO_IMPL_0( Class, ImplName ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static()
+
+// 1 service name
+#define XSERVICEINFO_IMPL_1( Class, ImplName, Service1 ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static() \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \
+ aSNS.getArray()[ 0 ] = Service1; \
+ return aSNS; \
+}
+
+#endif /* !_UCBHELPER_MACROS_HXX */
diff --git a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
new file mode 100644
index 000000000000..0af670631d35
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * $RCSfile: propertyvalueset.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
+#define _UCBHELPER_PROPERTYVALUESET_HXX
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCOLUMNLOCATE_HPP_
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace script {
+ class XTypeConverter;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct Property;
+ class XPropertySet;
+} } } }
+
+namespace ucb {
+
+class PropertyValues;
+
+//=========================================================================
+
+/**
+ * This class implements the interface XRow. After construction of a valueset
+ * the user can append properties ( incl. its values ) to the set. This class
+ * is useful when implementing the command "getPropertyValues", because the
+ * values to return can easyly appended to a valueset object. That object can
+ * directly be returned by the implementation of the command.
+ */
+class PropertyValueSet :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::sdbc::XRow,
+ public com::sun::star::sdbc::XColumnLocate
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter >
+ m_xTypeConverter;
+ vos::OMutex m_aMutex;
+ PropertyValues* m_pValues;
+ sal_Bool m_bWasNull;
+ sal_Bool m_bTriedToGetTypeConverter;
+
+private:
+ const com::sun::star::uno::Reference<
+ com::sun::star::script::XTypeConverter >&
+ getTypeConverter();
+
+public:
+ PropertyValueSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+ virtual ~PropertyValueSet();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull()
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL
+ getString( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess >& typeMap )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL
+ findColumn( const ::rtl::OUString& columnName )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the number of elements of the value set.
+ *
+ * @return the number of elements of the value set.
+ */
+ sal_Int32 getLength() const;
+
+ /**
+ * This method appends a string to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendString ( const ::com::sun::star::beans::Property& rProp,
+ const ::rtl::OUString& rValue );
+
+ /**
+ * This method appends a boolean to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBoolean ( const ::com::sun::star::beans::Property& rProp,
+ sal_Bool bValue );
+
+ /**
+ * This method appends a byte to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendByte ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int8 nValue );
+
+ /**
+ * This method appends a short to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendShort ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int16 nValue );
+
+ /**
+ * This method appends an int to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendInt ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int32 nValue );
+
+ /**
+ * This method appends a long to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendLong ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int64 nValue );
+
+ /**
+ * This method appends a float to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendFloat ( const ::com::sun::star::beans::Property& rProp,
+ float nValue );
+
+ /**
+ * This method appends a double to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendDouble ( const ::com::sun::star::beans::Property& rProp,
+ double nValue );
+
+ /**
+ * This method appends a byte sequence to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBytes ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& rValue );
+
+ /**
+ * This method appends a date to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendDate ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::Date& rValue );
+
+ /**
+ * This method appends a time to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendTime ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::Time& rValue );
+
+ /**
+ * This method appends a timestamp to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendTimestamp( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::DateTime& rValue );
+
+ /**
+ * This method appends a binary stream to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBinaryStream ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >&
+ rValue );
+
+ /**
+ * This method appends a character stream to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendCharacterStream( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >&
+ rValue );
+
+ /**
+ * This method appends an object ( any ) to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendObject ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Any& rValue );
+
+ /**
+ * This method appends a ref to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendRef ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XRef >& rValue );
+
+ /**
+ * This method appends a blob to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBlob ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XBlob >& rValue );
+
+ /**
+ * This method appends a clob to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendClob ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XClob >& rValue );
+
+ /**
+ * This method appends an array to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendArray ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XArray >& rValue );
+
+ /**
+ * This method appends a void value ( a "hole" ) to the value set. This
+ * is useful, since void values indicate errors, like non-existing
+ * property (-values) etc.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendVoid ( const ::com::sun::star::beans::Property& rProp );
+
+ /**
+ * This method tries to append all property values contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ */
+ void appendPropertySet( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& rSet );
+
+ /** This method tries to append a single property value contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ * @param rProperty is the property for that the value shall be obtained
+ * from the given property set.
+ * @return False, if the property value cannot be obtained from the
+ * given property pet. True, otherwise.
+ */
+ sal_Bool appendPropertySetValue(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& rSet,
+ const ::com::sun::star::beans::Property& rProperty );
+};
+
+}
+
+#endif /* !_UCBHELPER_PROPERTYVALUESET_HXX */
diff --git a/ucbhelper/inc/ucbhelper/providerhelper.hxx b/ucbhelper/inc/ucbhelper/providerhelper.hxx
new file mode 100644
index 000000000000..d77f62142f57
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/providerhelper.hxx
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * $RCSfile: providerhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#define _UCBHELPER_PROVIDERHELPER_HXX
+
+#ifndef __LIST__
+#include <stl/list>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+//=========================================================================
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XPropertySetRegistry;
+ class XPersistentPropertySet;
+} } } }
+
+namespace ucb_impl { struct ContentProviderImplHelper_Impl; }
+
+namespace ucb {
+
+//=========================================================================
+
+class ContentImplHelper;
+typedef vos::ORef< ContentImplHelper >ContentImplHelperRef;
+typedef std::list< ContentImplHelperRef > ContentRefList;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.ContentProvider. It provides contents derived from
+ * class ucb::ContentImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - maintains a set of ContentImplHelper objects, which were created by
+ * the provider implementation. So there will be exactly one object for
+ * one Content Identifier.
+ * - Provides access to the Additional Core PropertySet of a content.
+ * ( These set contains the properties added to a content using its
+ * XPropertyContainer interface )
+ */
+class ContentProviderImplHelper : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::ucb::XContentProvider
+{
+ friend class ContentImplHelper;
+
+ ucb_impl::ContentProviderImplHelper_Impl* m_pImpl;
+
+protected:
+ vos::OMutex m_aMutex;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+
+private:
+ void addContent ( ContentImplHelper* pContent );
+ void removeContent( ContentImplHelper* pContent );
+ void removeContent( const ::rtl::OUString& rURL );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XPropertySetRegistry >
+ getAdditionalPropertySetRegistry();
+
+protected:
+ /**
+ * This method returns a content with the given id, if it already exists.
+ * Use this method in your "queryContent" implementation to ensure unique
+ * objects.
+ *
+ * @param Identifier is the content identifier, for that an existing
+ * content object is requested.
+ * @return the content with the given identifier, if it exists or 0, if it
+ * does not exist.
+ */
+ vos::ORef< ContentImplHelper >
+ queryExistingContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * This method returns a content with the given URL, if it already exists.
+ *
+ * @param rURL is the URL ( content identifier string ), for that an
+ * existing content object is requested.
+ * @return the content with the given URL, if it exists or 0, if it
+ * does not exist.
+ */
+ vos::ORef< ContentImplHelper >
+ queryExistingContent( const ::rtl::OUString& rURL );
+
+public:
+
+ //////////////////////////////////////////////////////////////////////
+ // Contsruction/Destruction
+ //////////////////////////////////////////////////////////////////////
+
+ ContentProviderImplHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ virtual ~ContentProviderImplHelper();
+
+ //////////////////////////////////////////////////////////////////////
+ // XInterface
+ //////////////////////////////////////////////////////////////////////
+
+ XINTERFACE_DECL()
+
+ //////////////////////////////////////////////////////////////////////
+ // XTypeProvider
+ //////////////////////////////////////////////////////////////////////
+
+ XTYPEPROVIDER_DECL()
+
+ //////////////////////////////////////////////////////////////////////
+ // XServiceInfo
+ //////////////////////////////////////////////////////////////////////
+
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ //////////////////////////////////////////////////////////////////////
+ // XContentProvider
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns a content with the requested id.
+ *
+ * The implementation should:
+ *
+ * - Check, whether the Identifier is valid ( URL syntax ).
+ * - Use queryExistingContent(...) to determine, whether there exists
+ * already a content with the given id.
+ * - Return the possibly existing content.Create and return a new
+ * content, otherwise
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent > SAL_CALL
+ queryContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier )
+ throw( ::com::sun::star::ucb::IllegalIdentifierException,
+ ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Int32 SAL_CALL
+ compareContentIds( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Id1,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Id2 )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns a mutex, which protects the content list of the
+ * provider. So you can prevent modifications of that list easyly.
+ *
+ * @return the mutex.
+ */
+ vos::OMutex& getContentListMutex() { return m_aMutex; }
+
+ /**
+ * This method fills a list with all contents existing at calling time.
+ * Note: You may prevent modifications of the content list at any time
+ * by acquiring the content list mutex of the provider.
+ *
+ * @param rContents is the list to fill with the children.
+ */
+ void queryExistingContents( ContentRefList& rContents );
+
+ /**
+ * This method returns the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key for the propertyset.
+ * @param bCreate is a flag indicating whether the propertyset shall
+ * be created in case it does not exist.
+ * @return the propertyset containing the Additional Core Properties.
+ */
+ ::com::sun::star::uno::Reference<
+ com::sun::star::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( const ::rtl::OUString& rKey, sal_Bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool renameAdditionalPropertySet( const ::rtl::OUString& rOldKey,
+ const ::rtl::OUString& rNewKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key of the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool removeAdditionalPropertySet( const ::rtl::OUString& rKey,
+ sal_Bool bRecursive );
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_PROVIDERHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultset.hxx b/ucbhelper/inc/ucbhelper/resultset.hxx
new file mode 100644
index 000000000000..04bf0af9448d
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultset.hxx
@@ -0,0 +1,609 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultset.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSET_HXX
+#define _UCBHELPER_RESULTSET_HXX
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_RESULTSETEXCEPTION_HPP_
+#include <com/sun/star/ucb/ResultSetException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+#ifndef _VOS_REFERNCE_HXX_
+#include <vos/refernce.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace ucb {
+
+//=========================================================================
+
+#define RESULTSET_SERVICE_NAME "com.sun.star.ucb.ContentResultSet"
+
+//=========================================================================
+
+class ResultSetDataSupplier;
+struct ResultSet_Impl;
+
+/**
+ * This is an implementation of the service com.sun.star.ucb.ContentResultSet.
+ * It can be used to implement the method XDynamicResultSet::getStaticResultSet,
+ * which needs to be implemented for instance to implement the command "open"
+ * at folder objects. This class uses a user supplied ResultSetDataSupplier
+ * object to request data on demand.
+ *
+ * @see ResultSetDataSupplier
+ */
+class ResultSet :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XComponent,
+ public com::sun::star::ucb::XContentAccess,
+ public com::sun::star::sdbc::XResultSet,
+ public com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ public com::sun::star::sdbc::XRow,
+ public com::sun::star::sdbc::XCloseable,
+ public com::sun::star::beans::XPropertySet
+{
+ ResultSet_Impl* m_pImpl;
+
+public:
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ */
+ ResultSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::Property >& rProperties,
+ const vos::ORef< ResultSetDataSupplier >& rDataSupplier );
+ virtual ~ResultSet();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_NOFACTORY_DECL()
+
+ // 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 >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContentAccess
+ virtual rtl::OUString SAL_CALL
+ queryContentIdentfierString()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ queryContentIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContent > SAL_CALL
+ queryContent()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XResultSetMetaDataSupplier
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSetMetaData > SAL_CALL
+ getMetaData()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XResultSet
+ virtual sal_Bool SAL_CALL
+ next()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isBeforeFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isAfterLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ beforeFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ afterLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ first()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ last()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getRow()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ absolute( sal_Int32 row )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ relative( sal_Int32 rows )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ previous()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ refreshRow()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowUpdated()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowInserted()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowDeleted()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface > SAL_CALL
+ getStatement()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getString( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XNameAccess >& typeMap )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XCloseable
+ virtual void SAL_CALL
+ close()
+ throw( com::sun::star::sdbc::SQLException,
+ 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 );
+
+ /////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ /////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method propagates property value changes to all registered
+ * listeners.
+ *
+ * @param rEvt is a property change event.
+ */
+ void propertyChanged(
+ const com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were new data obtained from the data source.
+ *
+ * @param nOld is the old count of rows.
+ * @param nnew is the new count of rows.
+ */
+ void rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were all rows obtained from the data source.
+ */
+ void rowCountFinal();
+
+ /**
+ * This method returns a sequence containing all properties ( not the
+ * values! ) of the result set.
+ *
+ * @return a sequence of properties.
+ */
+ const com::sun::star::uno::Sequence< com::sun::star::beans::Property >&
+ getProperties();
+};
+
+//=========================================================================
+
+/**
+ * This is the base class for an object that supplies data to a result set
+ *
+ * @see ResultSet
+ */
+class ResultSetDataSupplier : public vos::OReference
+{
+ friend class ResultSet;
+
+ // No ref, otherwise we get a cyclic reference between supplier and set!
+ // Will be set from ResultSet ctor.
+ ResultSet* m_pResultSet;
+
+public:
+ ResultSetDataSupplier() : m_pResultSet( 0 ) {}
+
+ /**
+ * This method returns the resultset this supplier belongs to.
+ *
+ * @return the resultset for that the supplier supplies data.
+ */
+ vos::ORef< ResultSet > getResultSet() const { return m_pResultSet; }
+
+ /**
+ * This method returns the identifier string of the content at the
+ * specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the content's identifier string.
+ */
+ virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the identifier of the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the content's identifier.
+ */
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >
+ queryContentIdentifier( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the content.
+ */
+ virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
+ queryContent( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns whether there is a content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return true, if there is a content at the given index.
+ */
+ virtual sal_Bool getResult( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the total count of objects in the logical data array
+ * of the supplier. The implementation of this method may be very
+ * "expensive", because it can be necessary to obtain all data in order
+ * to determine the count. Therefor the ResultSet implementation calls
+ * it very seldom.
+ *
+ * @return the total count of objects.
+ */
+ virtual sal_uInt32 totalCount() = 0;
+
+ /**
+ * This method returns the count of objects obtained so far. There is no
+ * for the implemetation to obtain all objects at once. It can obtain
+ * all data on demand.
+ *
+ * The implementation should call m_pResultSet->rowCountChanged(...)
+ * everytime it has inserted a new entry in its logical result array.
+ *
+ * @return the count of objects obtained so far.
+ */
+ virtual sal_uInt32 currentCount() = 0;
+
+ /**
+ * This method returns whether the value returned by currentCount() is
+ * "final". This is the case, if that there was all data obtained by the
+ * supplier and the current count won't increase any more.
+ *
+ * The implementation should call m_pResultSet->rowCountFinal(...) if
+ * it has inserted all entries in its logical result array.
+ *
+ * @return true, if the the value returned by currentCount() won't change
+ anymore.
+ */
+ virtual sal_Bool isCountFinal() = 0;
+
+ /**
+ * This method returns an object for accessing the property values at
+ * the specified index. The implementation may use the helper class
+ * ucb::PropertyValueSet to provide the return value.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the object for accessing the property values.
+ */
+ virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
+ queryPropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method is called to instruct the supplier to release the (possibly
+ * presnt) property values at the given index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ */
+ virtual void releasePropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * to instruct the data supplier to release all resources it has
+ * allocated so far. In case the supplier is collecting data
+ * asynchronously, that process must be stopped.
+ */
+ virtual void close() = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * check, whether an error has occured while collecting data. The
+ * implementation of this method must throw an exception in that case.
+ *
+ * Note: An exception thrown to indicate an error must always be thrown
+ * by the thread that created the data supplier. If the supplier collects
+ * data asynchronously ( i.e. in a separate thread ) and an error
+ * occures, throwing of the appropriate exception must be deferred
+ * until validate() is called by the ResultSet implementation from
+ * inside the main thread.
+ * In case data are obtained synchronously, the ResultSetException can
+ * be thrown directly.
+ *
+ * @exception ResultSetException thrown, if an error has occured
+ */
+ virtual void validate()
+ throw( com::sun::star::ucb::ResultSetException ) = 0;
+};
+
+}
+
+#endif /* !_UCBHELPER_RESULTSET_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultsethelper.hxx b/ucbhelper/inc/ucbhelper/resultsethelper.hxx
new file mode 100644
index 000000000000..6bc07e4018b8
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultsethelper.hxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsethelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSETHELPER_HXX
+#define _UCBHELPER_RESULTSETHELPER_HXX
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP_
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+
+namespace cppu {
+ class OInterfaceContainerHelper;
+}
+
+namespace ucb {
+
+//=========================================================================
+
+#define DYNAMICRESULTSET_SERVICE_NAME \
+ "com.sun.star.ucb.DynamicContentResultSet"
+
+//=========================================================================
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.DynamicResultSet, which is the result of the command
+ * "open" executed at a UCB folder content.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service com::sun::star::ucb::DynamicResultSet
+ */
+class ResultSetImplHelper :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::ucb::XDynamicResultSet
+{
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ sal_Bool m_bStatic;
+ sal_Bool m_bInitDone;
+
+protected:
+ osl::Mutex m_aMutex;
+ com::sun::star::ucb::OpenCommandArgument2 m_aCommand;
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ // Resultset #1
+ com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > m_xResultSet1;
+ // Resultset #2
+ com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > m_xResultSet2;
+ // Resultset changes listener.
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSetListener > m_xListener;
+
+private:
+ void init( sal_Bool bStatic );
+
+ /**
+ * Your implementation of this method has to fill the protected member
+ * m_xResultSet1. This resultset must implement a complete static
+ * resultset ( service com.sun.star.ucb.ContentResultSet ). This method
+ * will be called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "static". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively statically. You may deploy this factum to optimize your
+ * implementation (i.e. "switch off" all changes detection code in
+ * your implementation).
+ * Note that you may use the class ucb::ResultSet to implement the
+ * static resultset, that is required here.
+ */
+ virtual void initStatic() = 0;
+
+ /**
+ * Your implementation of this method has to fill the protected members
+ * m_xResultSet1 and m_xResultSet2 of this base class. Each of these
+ * resultsets must implement a complete static resultset
+ * ( service com.sun.star.ucb.ContentResultSet ). This method will be
+ * called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "dynamic". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively dynamically. This means, it is interested in getting
+ * notifications on changes of data of the resultset contents. ( These
+ * changes are to propagate by your implementation throw the member
+ * m_xListener of this base class ).
+ * If your implementation cannot detect changes of relevant data, you
+ * may fill m_xResultSet1 and m_xResultSet2 with the same static resultset
+ * implementation object. This normally will be the same instance you put
+ * into m_xResultSet1 when initStatic() is called.
+ */
+ virtual void initDynamic() = 0;
+
+public:
+ /**
+ * Construtor.
+ *
+ * @param rxSMgr is a Service Manager.
+ */
+ ResultSetImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+
+ /**
+ * Construtor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rCommand is the paramter for the open command that produces
+ * this resultset.
+ */
+ ResultSetImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::ucb::OpenCommandArgument2& rCommand );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetImplHelper();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_NOFACTORY_DECL()
+
+ // XComponent ( base class of XDynamicResultSet )
+ 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 >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XDynamicResultSet
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > SAL_CALL
+ getStaticResultSet()
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setListener( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSetListener >& Listener )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ connectToCache( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSet > & xCache )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::ucb::AlreadyInitializedException,
+ com::sun::star::ucb::ServiceNotFoundException,
+ com::sun::star::uno::RuntimeException );
+
+ /**
+ * The implemetation of this method always returns 0. Override this
+ * method, if necassary.
+ */
+ virtual sal_Int16 SAL_CALL
+ getCapabilities()
+ throw( com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns, whether the resultset is static or dynamic.
+ * If neither getStatic() nor getDynamic() was called, the type
+ * of the resultset is "dynamic".
+ *
+ * @return true, if the resultset type is "static". False, otherwise.
+ */
+ sal_Bool isStatic() const { return m_bStatic; }
+};
+
+}
+
+#endif /* !_UCBHELPER_RESULTSETHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
new file mode 100644
index 000000000000..4c4745dade77
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsetmetadata.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
+#define _UCBHELPER_RESULTSETMETADATA_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+ namespace beans { struct Property; }
+} } }
+
+namespace ucb
+{
+
+//=========================================================================
+
+struct ResultSetMetaData_Impl;
+
+/**
+ * This is a simple implementation of the interface XResultSetMetaData.
+ * Some methods will simply return standard values. Other calculating the
+ * return values using the property sequence provided to the constructor of
+ * this class.
+ * One can derive from this class, if other implementations of any methods
+ * is needed, but for many cases this implementation should do good guesses
+ * for many use cases.
+ */
+class ResultSetMetaData :
+ public ::cppu::OWeakObject,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::sdbc::XResultSetMetaData
+{
+private:
+ ResultSetMetaData_Impl* m_pImpl;
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property > m_aProps;
+ sal_Bool m_bReadOnly;
+
+public:
+
+ /**
+ * Constructor.
+ *
+ * @param rxSMgr is a Servive Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ * @param bReadOnly is used to specify whether the whole(!) resultset
+ * is read-only.
+ */
+ ResultSetMetaData(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProps,
+ sal_Bool bReadOnly = sal_True );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetMetaData();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XResultSetMetaData
+ /**
+ * @return the length of the property sequence.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnCount()
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isAutoIncrement( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always true.
+ */
+ virtual sal_Bool SAL_CALL
+ isCaseSensitive( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always false.
+ */
+ virtual sal_Bool SAL_CALL
+ isSearchable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always false.
+ */
+ virtual sal_Bool SAL_CALL
+ isCurrency( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always ColumnValue::NULLABLE.
+ */
+ virtual sal_Int32 SAL_CALL
+ isNullable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always false.
+ */
+ virtual sal_Bool SAL_CALL
+ isSigned( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always 16.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnDisplaySize( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the name of the property that corresponds to column.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnLabel( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the name of the property that corresponds to column.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getSchemaName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always -1.
+ */
+ virtual sal_Int32 SAL_CALL
+ getPrecision( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always 0.
+ */
+ virtual sal_Int32 SAL_CALL
+ getScale( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getTableName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ getCatalogName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the type of the property that corresponds to column - mapped
+ * from UNO-Type to SQL-Type.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnType( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnTypeName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isReadOnly( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the inverted value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isWritable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the inverted value of member m_bReadOnly.
+ */
+ virtual sal_Bool SAL_CALL
+ isDefinitelyWritable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return always an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnServiceName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+};
+
+} // namespace ucb
+
+#endif /* !_UCBHELPER_RESULTSETMETADATA_HXX */
diff --git a/ucbhelper/prj/d.lst b/ucbhelper/prj/d.lst
new file mode 100644
index 000000000000..f32f8ced6ba9
--- /dev/null
+++ b/ucbhelper/prj/d.lst
@@ -0,0 +1,24 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
+..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%\lib*.dylib
+..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT%\*.lib
+..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
+..\%__SRC%\misc\*.sym %_DEST%\bin%_EXT%\*.sym
+
+mkdir: %_DEST%\inc%_EXT%\ucbhelper
+..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\configureucb.hxx
+..\inc\ucbhelper\content.hxx %_DEST%\inc%_EXT%\ucbhelper\content.hxx
+..\inc\ucbhelper\contentbroker.hxx %_DEST%\inc%_EXT%\ucbhelper\contentbroker.hxx
+..\inc\ucbhelper\commandenvironment.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironment.hxx
+..\inc\ucbhelper\contentidentifier.hxx %_DEST%\inc%_EXT%\ucbhelper\contentidentifier.hxx
+..\inc\ucbhelper\contenthelper.hxx %_DEST%\inc%_EXT%\ucbhelper\contenthelper.hxx
+..\inc\ucbhelper\contentidentifier.hxx %_DEST%\inc%_EXT%\ucbhelper\contentidentifier.hxx
+..\inc\ucbhelper\contentinfo.hxx %_DEST%\inc%_EXT%\ucbhelper\contentinfo.hxx
+..\inc\ucbhelper\macros.hxx %_DEST%\inc%_EXT%\ucbhelper\macros.hxx
+..\inc\ucbhelper\propertyvalueset.hxx %_DEST%\inc%_EXT%\ucbhelper\propertyvalueset.hxx
+..\inc\ucbhelper\providerhelper.hxx %_DEST%\inc%_EXT%\ucbhelper\providerhelper.hxx
+..\inc\ucbhelper\registerucb.hxx %_DEST%\inc%_EXT%\ucbhelper\registerucb.hxx
+..\inc\ucbhelper\resultset.hxx %_DEST%\inc%_EXT%\ucbhelper\resultset.hxx
+..\inc\ucbhelper\resultsetmetadata.hxx %_DEST%\inc%_EXT%\ucbhelper\resultsetmetadata.hxx
+..\inc\ucbhelper\resultsethelper.hxx %_DEST%\inc%_EXT%\ucbhelper\resultsethelper.hxx
+..\version.mk %_DEST%\inc%_EXT%\ucbhelper\version.mk
diff --git a/ucbhelper/source/client/commandenvironment.cxx b/ucbhelper/source/client/commandenvironment.cxx
new file mode 100644
index 000000000000..feef034704cf
--- /dev/null
+++ b/ucbhelper/source/client/commandenvironment.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * $RCSfile: commandenvironment.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
+#include <ucbhelper/commandenvironment.hxx>
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// struct CommandEnvironment_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+struct CommandEnvironment_Impl
+{
+ Reference< XInteractionHandler > m_xInteractionHandler;
+ Reference< XProgressHandler > m_xProgressHandler;
+
+ CommandEnvironment_Impl(
+ const Reference< XInteractionHandler >& rxInteractionHandler,
+ const Reference< XProgressHandler >& rxProgressHandler )
+ : m_xInteractionHandler( rxInteractionHandler ),
+ m_xProgressHandler( rxProgressHandler ) {}
+};
+
+//=========================================================================
+//=========================================================================
+//
+// CommandEnvironment Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+CommandEnvironment::CommandEnvironment(
+ const Reference< XInteractionHandler >& rxInteractionHandler,
+ const Reference< XProgressHandler >& rxProgressHandler )
+{
+ m_pImpl = new CommandEnvironment_Impl( rxInteractionHandler,
+ rxProgressHandler );
+}
+
+//=========================================================================
+// virtual
+CommandEnvironment::~CommandEnvironment()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( CommandEnvironment,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XTypeProvider methods
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( CommandEnvironment,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XCommandEnvironemnt methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XInteractionHandler > SAL_CALL
+CommandEnvironment::getInteractionHandler()
+ throw ( RuntimeException )
+{
+ return m_pImpl->m_xInteractionHandler;
+}
+
+//=========================================================================
+// virtual
+Reference< XProgressHandler > SAL_CALL
+CommandEnvironment::getProgressHandler()
+ throw ( RuntimeException )
+{
+ return m_pImpl->m_xProgressHandler;
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
new file mode 100644
index 000000000000..7de4a7d38f41
--- /dev/null
+++ b/ucbhelper/source/client/content.cxx
@@ -0,0 +1,1069 @@
+/*************************************************************************
+ *
+ * $RCSfile: content.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_REFERNCE_HXX_
+#include <vos/refernce.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_COMMAND_HPP_
+#include <com/sun/star/ucb/Command.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_COMMANDINFO_HPP_
+#include <com/sun/star/ucb/CommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_INSERTCOMMANDARGUMENT_HPP_
+#include <com/sun/star/ucb/InsertCommandArgument.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_
+#include <com/sun/star/ucb/OpenMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTCREATOR_HPP_
+#include <com/sun/star/ucb/XContentCreator.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP_
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#include <ucbhelper/contentbroker.hxx>
+#endif
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// class Content_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+class Content_Impl : public vos::OReference
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XContent > m_xContent;
+ Reference< XCommandProcessor > m_xCommandProcessor;
+ Reference< XCommandEnvironment > m_xEnv;
+ vos::OMutex m_aMutex;
+ sal_Int32 m_aCommandId;
+
+public:
+ inline Content_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv );
+
+ virtual ~Content_Impl();
+
+ Reference< XContent > getContent() const { return m_xContent; }
+ Reference< XCommandProcessor > getCommandProcessor();
+ sal_Int32 getCommandId();
+
+ Any executeCommand( const Command& rCommand );
+ void abortCommand();
+ Reference< XCommandEnvironment > getEnvironment() const { return m_xEnv; }
+};
+
+//=========================================================================
+inline Content_Impl::Content_Impl(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv )
+: m_xSMgr( rSMgr ),
+ m_xContent( rContent ),
+ m_xEnv( rEnv ),
+ m_aCommandId( 0 )
+{
+}
+
+//=========================================================================
+//=========================================================================
+//
+// Content Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+Content::Content()
+{
+}
+
+//=========================================================================
+Content::Content( const OUString& rURL,
+ const Reference< XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ucb::ContentBroker* pBroker = ucb::ContentBroker::get();
+ if ( !pBroker )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_BROKER );
+
+ VOS_ENSURE( pBroker->getContentProviderManagerInterface()
+ ->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+
+ Reference< XContentIdentifierFactory > xIdFac
+ = pBroker->getContentIdentifierFactoryInterface();
+ if ( !xIdFac.is() )
+ throw ContentCreationException(
+ ContentCreationException::NO_IDENTIFIER_FACTORY );
+
+ Reference< XContentIdentifier > xId
+ = xIdFac->createContentIdentifier( rURL );
+ if ( !xId.is() )
+ throw ContentCreationException(
+ ContentCreationException::IDENTIFIER_CREATION_FAILED );
+
+ Reference< XContentProvider > xProvider
+ = pBroker->getContentProviderInterface();
+ if ( !xProvider.is() )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_PROVIDER );
+
+ Reference< XContent > xContent;
+ try
+ {
+ xContent = xProvider->queryContent( xId );
+ }
+ catch ( IllegalIdentifierException )
+ {
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+ }
+
+ if ( !xContent.is() )
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Reference< XContentIdentifier >& rId,
+ const Reference< XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ucb::ContentBroker* pBroker = ucb::ContentBroker::get();
+ if ( !pBroker )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_BROKER );
+
+ VOS_ENSURE( pBroker->getContentProviderManagerInterface()
+ ->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+
+ Reference< XContentProvider > xProvider
+ = pBroker->getContentProviderInterface();
+ if ( !xProvider.is() )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_PROVIDER );
+
+ Reference< XContent > xContent;
+ try
+ {
+ xContent = xProvider->queryContent( rId );
+ }
+ catch ( IllegalIdentifierException )
+ {
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+ }
+
+ if ( !xContent.is() )
+ throw ContentCreationException(
+ ContentCreationException::CONTENT_CREATION_FAILED );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv )
+{
+ ucb::ContentBroker* pBroker = ucb::ContentBroker::get();
+ if ( !pBroker )
+ throw ContentCreationException(
+ ContentCreationException::NO_CONTENT_BROKER );
+
+ VOS_ENSURE( pBroker->getContentProviderManagerInterface()
+ ->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), rContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Content& rOther )
+{
+ m_xImpl = rOther.m_xImpl;
+}
+
+//=========================================================================
+Content::~Content()
+{
+}
+
+//=========================================================================
+Content& Content::operator=( const Content& rOther )
+{
+ m_xImpl = rOther.m_xImpl;
+ return *this;
+}
+
+//=========================================================================
+Reference< XContent > Content::get() const
+{
+ return m_xImpl->getContent();
+}
+
+//=========================================================================
+Reference< XCommandInfo > Content::getCommands()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getCommandInfo" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = Any();
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XCommandInfo > xInfo;
+ aResult >>= xInfo;
+ return xInfo;
+}
+
+//=========================================================================
+Reference< XPropertySetInfo > Content::getProperties()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getPropertySetInfo" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = Any();
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XPropertySetInfo > xInfo;
+ aResult >>= xInfo;
+ return xInfo;
+}
+
+//=========================================================================
+Any Content::getPropertyValue( const OUString& rPropertyName )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< OUString > aNames( 1 );
+ aNames.getArray()[ 0 ] = rPropertyName;
+
+ Sequence< Any > aRet = getPropertyValues( aNames );
+ return aRet.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+Any Content::getPropertyValue( sal_Int32 nPropertyHandle )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< sal_Int32 > aHandles( 1 );
+ aHandles.getArray()[ 0 ] = nPropertyHandle;
+
+ Sequence< Any > aRet = getPropertyValues( aHandles );
+ return aRet.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+void Content::setPropertyValue( const OUString& rName,
+ const Any& rValue )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< OUString > aNames( 1 );
+ aNames.getArray()[ 0 ] = rName;
+
+ Sequence< Any > aValues( 1 );
+ aValues.getArray()[ 0 ] = rValue;
+
+ setPropertyValues( aNames, aValues );
+}
+
+//=========================================================================
+void Content::setPropertyValue( const sal_Int32 nPropertyHandle,
+ const Any& rValue )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< sal_Int32 > aHandles( 1 );
+ aHandles.getArray()[ 0 ] = nPropertyHandle;
+
+ Sequence< Any > aValues( 1 );
+ aValues.getArray()[ 0 ] = rValue;
+
+ setPropertyValues( aHandles, aValues );
+}
+
+//=========================================================================
+Sequence< Any > Content::getPropertyValues(
+ const Sequence< OUString >& rPropertyNames )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XRow > xRow = getPropertyValuesInterface( rPropertyNames );
+
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Any > aValues( nCount );
+ Any* pValues = aValues.getArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ pValues[ n ] = xRow->getObject( n + 1, Reference< XNameAccess >() );
+
+ return aValues;
+}
+
+//=========================================================================
+Sequence< Any > Content::getPropertyValues(
+ const Sequence< sal_Int32 >& nPropertyHandles )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XRow > xRow = getPropertyValuesInterface( nPropertyHandles );
+
+ sal_Int32 nCount = nPropertyHandles.getLength();
+ Sequence< Any > aValues( nCount );
+ Any* pValues = aValues.getArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ pValues[ n ] = xRow->getObject( n + 1, Reference< XNameAccess >() );
+
+ return aValues;
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValuesInterface(
+ const Sequence< OUString >& rPropertyNames )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+// rProp.Type =
+// rProp.Attributes = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XRow > xRow;
+ aResult >>= xRow;
+ return xRow;
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValuesInterface(
+ const Sequence< sal_Int32 >& nPropertyHandles )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = nPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+
+ const sal_Int32* pHandles = nPropertyHandles.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+// rProp.Type =
+// rProp.Attributes = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "getPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XRow > xRow;
+ aResult >>= xRow;
+ return xRow;
+}
+
+//=========================================================================
+void Content::setPropertyValues(
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rValues )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rPropertyNames.getLength() != rValues.getLength() )
+ throw CommandAbortedException();
+
+ sal_Int32 nCount = rValues.getLength();
+ Sequence< PropertyValue > aProps( nCount );
+ PropertyValue* pProps = aProps.getArray();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ PropertyValue& rProp = pProps[ n ];
+
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ rProp.Value = pValues[ n ];
+// rProp.State = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "setPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+void Content::setPropertyValues(
+ const Sequence< sal_Int32 >& nPropertyHandles,
+ const Sequence< Any >& rValues )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( nPropertyHandles.getLength() != rValues.getLength() )
+ throw CommandAbortedException();
+
+ sal_Int32 nCount = rValues.getLength();
+ Sequence< PropertyValue > aProps( nCount );
+ PropertyValue* pProps = aProps.getArray();
+
+ const sal_Int32* pHandles = nPropertyHandles.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ PropertyValue& rProp = pProps[ n ];
+
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ rProp.Value = pValues[ n ];
+// rProp.State = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "setPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+Any Content::executeCommand( const OUString& rCommandName,
+ const Any& rCommandArgument )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = rCommandName;
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = rCommandArgument;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+Any Content::executeCommand( sal_Int32 nCommandHandle,
+ const Any& rCommandArgument )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = OUString(); // n/a
+ aCommand.Handle = nCommandHandle;
+ aCommand.Argument = rCommandArgument;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+void Content::abortCommand()
+{
+ m_xImpl->abortCommand();
+}
+
+//=========================================================================
+Reference< XCommandEnvironment > Content::getCommandEnvironment()
+{
+ return m_xImpl->getEnvironment();
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createCursor(
+ const Sequence< OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XResultSet >();
+
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const OUString* pNames = rPropertyNames.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XDynamicResultSet > xDynSet;
+ Reference< XResultSet > xStaticSet;
+ if ( aResult >>= xDynSet )
+ xStaticSet = xDynSet->getStaticResultSet();
+
+ VOS_ENSURE( xStaticSet.is(), "Content::createCursor - no cursor!" );
+
+ if ( !xStaticSet.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aResult >>= xStaticSet;
+
+ VOS_ENSURE( !xStaticSet.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return xStaticSet;
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XResultSet >();
+
+ sal_Int32 nCount = rPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const sal_Int32* pHandles = rPropertyHandles.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XDynamicResultSet > xDynSet;
+ Reference< XResultSet > xStaticSet;
+ if ( aResult >>= xDynSet )
+ xStaticSet = xDynSet->getStaticResultSet();
+
+ VOS_ENSURE( xStaticSet.is(), "Content::createCursor - no cursor!" );
+
+ if ( !xStaticSet.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aResult >>= xStaticSet;
+
+ VOS_ENSURE( !xStaticSet.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return xStaticSet;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createDynamicCursor(
+ const Sequence< OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XDynamicResultSet >();
+
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const OUString* pNames = rPropertyNames.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Reference< XDynamicResultSet > xSet;
+ m_xImpl->executeCommand( aCommand ) >>= xSet;
+
+ VOS_ENSURE( xSet.is(), "Content::createDynamicCursor - no cursor!" );
+
+ return xSet;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createDynamicCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isFolder() )
+ return Reference< XDynamicResultSet >();
+
+ sal_Int32 nCount = rPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const sal_Int32* pHandles = rPropertyHandles.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ Reference< XDynamicResultSet > xSet;
+ m_xImpl->executeCommand( aCommand ) >>= xSet;
+
+ VOS_ENSURE( xSet.is(), "Content::createDynamicCursor - no cursor!" );
+
+ return xSet;
+}
+
+//=========================================================================
+sal_Bool Content::openStream( const Reference< XActiveDataSink >& rSink )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return sal_False;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = rSink;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::openStream( const Reference< XOutputStream >& rStream )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return sal_False;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = rStream;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return sal_True;
+}
+
+//=========================================================================
+void Content::writeStream( const Reference< XInputStream >& rStream,
+ sal_Bool bReplaceExisting )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !rStream.is() )
+ return;
+
+ if ( !isDocument() )
+ return;
+
+ InsertCommandArgument aArg;
+ aArg.Data = rStream;
+ aArg.ReplaceExisting = bReplaceExisting;
+
+ Command aCommand;
+ aCommand.Name = OUString::createFromAscii( "insert" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ return insertNewContent( rContentType,
+ rPropertyNames,
+ rPropertyValues,
+ Reference< XInputStream >(),
+ rNewContent );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< sal_Int32 >& nPropertyHandles,
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ return insertNewContent( rContentType,
+ nPropertyHandles,
+ rPropertyValues,
+ Reference< XInputStream >(),
+ rNewContent );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rPropertyValues,
+ const Reference< XInputStream >& rData,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rContentType.getLength() == 0 )
+ return sal_False;
+
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ VOS_ENSURE( xCreator.is(),
+ "Content::insertNewContent - Not a XContentCreator!" );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ ContentInfo aInfo;
+ aInfo.Type = rContentType;
+ aInfo.Attributes = 0;
+
+ Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ if ( !xNew.is() )
+ return sal_False;
+
+ Content aNewContent( xNew, m_xImpl->getEnvironment() );
+ aNewContent.setPropertyValues( rPropertyNames, rPropertyValues );
+ aNewContent.executeCommand( OUString::createFromAscii( "insert" ),
+ makeAny(
+ InsertCommandArgument(
+ rData,
+ sal_False /* ReplaceExisting */ ) ) );
+ rNewContent = aNewContent;
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const OUString& rContentType,
+ const Sequence< sal_Int32 >& nPropertyHandles,
+ const Sequence< Any >& rPropertyValues,
+ const Reference< XInputStream >& rData,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rContentType.getLength() == 0 )
+ return sal_False;
+
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ VOS_ENSURE( xCreator.is(),
+ "Content::insertNewContent - Not a XContentCreator!" );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ ContentInfo aInfo;
+ aInfo.Type = rContentType;
+ aInfo.Attributes = 0;
+
+ Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ if ( !xNew.is() )
+ return sal_False;
+
+ Content aNewContent( xNew, m_xImpl->getEnvironment() );
+ aNewContent.setPropertyValues( nPropertyHandles, rPropertyValues );
+ aNewContent.executeCommand( OUString::createFromAscii( "insert" ),
+ makeAny(
+ InsertCommandArgument(
+ rData,
+ sal_False /* ReplaceExisting */ ) ) );
+ rNewContent = aNewContent;
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::isFolder()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Bool bFolder = sal_False;
+ getPropertyValue( OUString::createFromAscii( "IsFolder" ) ) >>= bFolder;
+ return bFolder;
+}
+
+//=========================================================================
+sal_Bool Content::isDocument()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Bool bDoc = sal_False;
+ getPropertyValue( OUString::createFromAscii( "IsDocument" ) ) >>= bDoc;
+ return bDoc;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// Content_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+// virtual
+Content_Impl::~Content_Impl()
+{
+}
+
+//=========================================================================
+Reference< XCommandProcessor > Content_Impl::getCommandProcessor()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_xCommandProcessor.is() )
+ m_xCommandProcessor
+ = Reference< XCommandProcessor >( m_xContent, UNO_QUERY );
+
+ return m_xCommandProcessor;
+}
+
+//=========================================================================
+sal_Int32 Content_Impl::getCommandId()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( m_aCommandId == 0 )
+ {
+ Reference< XCommandProcessor > xProc = getCommandProcessor();
+ if ( xProc.is() )
+ m_aCommandId = xProc->createCommandIdentifier();
+ }
+
+ return m_aCommandId;
+}
+
+//=========================================================================
+Any Content_Impl::executeCommand( const Command& rCommand )
+{
+ Reference< XCommandProcessor > xProc = getCommandProcessor();
+ if ( !xProc.is() )
+ return Any();
+
+ // Execute command
+ return xProc->execute( rCommand, getCommandId(), m_xEnv );
+}
+
+//=========================================================================
+void Content_Impl::abortCommand()
+{
+ if ( ( m_aCommandId != 0 ) && m_xCommandProcessor.is() )
+ m_xCommandProcessor->abort( m_aCommandId );
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
new file mode 100644
index 000000000000..d6ad6c9f1a18
--- /dev/null
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentbroker.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#include <ucbhelper/contentbroker.hxx>
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// class ContentBroker_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+class ContentBroker_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XContentIdentifierFactory > m_xIdFac;
+ Reference< XContentProvider > m_xProvider;
+ Reference< XContentProviderManager > m_xProviderMgr;
+ Sequence< Any > m_aArguments;
+ vos::OMutex m_aMutex;
+ sal_Bool m_bInitDone;
+
+private:
+ void init() const;
+ void init();
+
+public:
+ ContentBroker_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+ : m_xSMgr( rSMgr ), m_aArguments( rArguments ), m_bInitDone( sal_False )
+ {}
+
+ ~ContentBroker_Impl();
+
+ const Reference< XMultiServiceFactory >& getServiceManager() const
+ { return m_xSMgr; }
+
+ const Reference< XContentIdentifierFactory >& getIdFactory() const
+ { init(); return m_xIdFac; }
+
+ const Reference< XContentProvider >& getProvider() const
+ { init(); return m_xProvider; }
+
+ const Reference< XContentProviderManager >& getProviderManager() const
+ { init(); return m_xProviderMgr; }
+};
+
+//=========================================================================
+//=========================================================================
+//
+// ContentBroker Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+// static member!
+ContentBroker* ContentBroker::m_pTheBroker = 0;
+
+//=========================================================================
+ContentBroker::ContentBroker( const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+{
+ m_pImpl = new ContentBroker_Impl( rSMgr, rArguments );
+}
+
+//=========================================================================
+ContentBroker::~ContentBroker()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+Reference< XMultiServiceFactory > ContentBroker::getServiceManager() const
+{
+ return m_pImpl->getServiceManager();
+}
+
+//=========================================================================
+Reference< XContentIdentifierFactory >
+ ContentBroker::getContentIdentifierFactoryInterface() const
+{
+ return m_pImpl->getIdFactory();
+}
+
+//=========================================================================
+Reference< XContentProvider >
+ ContentBroker::getContentProviderInterface() const
+{
+ return m_pImpl->getProvider();
+}
+
+//=========================================================================
+Reference< XContentProviderManager >
+ ContentBroker::getContentProviderManagerInterface() const
+{
+ return m_pImpl->getProviderManager();
+}
+
+//=========================================================================
+// static
+sal_Bool ContentBroker::initialize(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+{
+ vos::OGuard aGuard( vos::OMutex::getGlobalMutex() );
+
+ VOS_ENSURE( !m_pTheBroker,
+ "ContentBroker::create - already created!" );
+
+ if ( !m_pTheBroker )
+ m_pTheBroker = new ContentBroker( rSMgr, rArguments );
+
+ return m_pTheBroker != 0;
+}
+
+//=========================================================================
+// static
+void ContentBroker::deinitialize()
+{
+ vos::OGuard aGuard( vos::OMutex::getGlobalMutex() );
+
+ delete m_pTheBroker;
+ m_pTheBroker = 0;
+}
+
+//=========================================================================
+// static
+ContentBroker* ContentBroker::get()
+{
+ return m_pTheBroker;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ContentBroker_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentBroker_Impl::~ContentBroker_Impl()
+{
+ Reference< XComponent > xComponent( m_xProvider, UNO_QUERY );
+ if ( xComponent.is() ) // must not exist, if init() was never called.
+ {
+ m_xIdFac = 0;
+ m_xProvider = 0;
+ m_xProviderMgr = 0;
+
+ xComponent->dispose();
+ }
+}
+
+//=========================================================================
+void ContentBroker_Impl::init() const
+{
+ const_cast< ContentBroker_Impl * >( this )->init();
+}
+
+//=========================================================================
+void ContentBroker_Impl::init()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_bInitDone )
+ {
+ m_bInitDone = sal_True;
+
+ Reference< XInterface > xIfc
+ = m_xSMgr->createInstanceWithArguments(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.UniversalContentBroker" ),
+ m_aArguments );
+
+ VOS_ENSURE( xIfc.is(), "Error creating UCB service!" );
+
+ if ( xIfc.is() )
+ {
+ m_xIdFac
+ = Reference< XContentIdentifierFactory >( xIfc, UNO_QUERY );
+
+ VOS_ENSURE( m_xIdFac.is(),
+ "UCB without XContentIdentifierFactory!" );
+
+ m_xProvider
+ = Reference< XContentProvider >( xIfc, UNO_QUERY );
+
+ VOS_ENSURE( m_xProvider.is(),
+ "UCB without XContentProvider!" );
+
+ m_xProviderMgr
+ = Reference< XContentProviderManager >( xIfc, UNO_QUERY );
+
+ VOS_ENSURE( m_xProviderMgr.is(),
+ "UCB without XContentProviderManager!" );
+ }
+ }
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/client/makefile.mk b/ucbhelper/source/client/makefile.mk
new file mode 100644
index 000000000000..2b2079e1c44c
--- /dev/null
+++ b/ucbhelper/source/client/makefile.mk
@@ -0,0 +1,91 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME= ucbhelper
+TARGET= client
+AUTOSEG= TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+SLOFILES=\
+ $(SLO)$/content.obj \
+ $(SLO)$/contentbroker.obj \
+ $(SLO)$/commandenvironment.obj
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/source/provider/configureucb.cxx b/ucbhelper/source/provider/configureucb.cxx
new file mode 100644
index 000000000000..56f16ebe0e99
--- /dev/null
+++ b/ucbhelper/source/provider/configureucb.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * $RCSfile: configureucb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONFIGUREUCB_HXX_
+#include <ucbhelper/configureucb.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_HPP_
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_CONTENTPROVIDERSERVICEINFO2_HPP_
+#include <com/sun/star/ucb/ContentProviderServiceInfo2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_DUPLICATEPROVIDEREXCEPTION_HPP_
+#include <com/sun/star/ucb/DuplicateProviderException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERCONFIGURATION_HPP_
+#include <com/sun/star/ucb/XContentProviderConfiguration.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERCONFIGURATIONMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderConfigurationManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPARAMETERIZEDCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
+#include <com/sun/star/uno/Exception.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
+#include <com/sun/star/uno/RuntimeException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#ifndef _UCBHELPER_REGISTERUCB_HXX_
+#include <ucbhelper/registerucb.hxx>
+#endif
+
+using namespace com::sun;
+using namespace com::sun::star;
+
+//============================================================================
+//
+// configureUcb
+//
+//============================================================================
+
+namespace ucb {
+
+bool
+configureUcb(
+ uno::Reference< star::ucb::XContentProviderManager > const & rUcb,
+ uno::Reference< lang::XMultiServiceFactory > const & rFactory,
+ rtl::OUString const & rConfigurationKey)
+ throw (uno::RuntimeException)
+{
+ if (!(rUcb.is() && rFactory.is()))
+ return false;
+
+ uno::Reference< star::ucb::XContentProviderConfigurationManager >
+ xManager;
+ try
+ {
+ xManager
+ = uno::Reference<
+ star::ucb::XContentProviderConfigurationManager >(
+ rFactory->
+ createInstance(rtl::OUString::createFromAscii(
+ "com.sun.star.ucb.Configuration")),
+ uno::UNO_QUERY);
+ }
+ catch (uno::RuntimeException const &) { throw; }
+ catch (uno::Exception const &) {}
+ if (!xManager.is())
+ return false;
+
+ uno::Reference< star::ucb::XContentProviderConfiguration >
+ xConfiguration(xManager->queryContentProviderConfiguration(
+ rConfigurationKey));
+ if (!xConfiguration.is())
+ return false;
+
+ registerAtUcb(rUcb,
+ rFactory,
+ xConfiguration->
+ queryContentProviderServiceInfo(rtl::OUString()),
+ 0);
+ return true;
+}
+
+}
+
+
diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx
new file mode 100644
index 000000000000..3e5e875ddbe6
--- /dev/null
+++ b/ucbhelper/source/provider/contenthelper.cxx
@@ -0,0 +1,1250 @@
+/*************************************************************************
+ *
+ * $RCSfile: contenthelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __HASH_MAP__
+#include <stl/hash_map>
+#endif
+#ifndef _COM_SUN_STAR_UCB_CONTENTACTION_HPP_
+#include <com/sun/star/ucb/ContentAction.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_COMMANDINFOCHANGE_HPP_
+#include <com/sun/star/ucb/CommandInfoChange.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPERSISTENTPROPERTYSET_HPP_
+#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSETINFOCHANGE_HPP_
+#include <com/sun/star/beans/PropertySetInfoChange.hpp>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTINFO_HXX
+#include <ucbhelper/contentinfo.hxx>
+#endif
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace cppu;
+using namespace rtl;
+using namespace vos;
+using namespace ucb;
+
+namespace ucb_impl
+{
+
+//=========================================================================
+//
+// class PropertyEventSequence.
+//
+//=========================================================================
+
+class PropertyEventSequence
+{
+ Sequence< PropertyChangeEvent > m_aSeq;
+ sal_uInt32 m_nPos;
+
+public:
+ PropertyEventSequence( sal_uInt32 nSize )
+ : m_aSeq( nSize ), m_nPos( 0 ) {};
+
+ void append( const PropertyChangeEvent& rEvt )
+ { m_aSeq.getArray()[ m_nPos ] = rEvt; ++m_nPos; }
+
+ const Sequence< PropertyChangeEvent >& getEvents()
+ { m_aSeq.realloc( m_nPos ); return m_aSeq; }
+};
+
+//=========================================================================
+//
+// PropertiesEventListenerMap.
+//
+//=========================================================================
+
+typedef void* XPropertiesChangeListenerPtr; // -> Compiler problems!
+
+struct equalPtr
+{
+ bool operator()( const XPropertiesChangeListenerPtr& rp1,
+ const XPropertiesChangeListenerPtr& rp2 ) const
+ {
+ return ( rp1 == rp2 );
+ }
+};
+
+struct hashPtr
+{
+ size_t operator()( const XPropertiesChangeListenerPtr& rp ) const
+ {
+ return (size_t)rp;
+ }
+};
+
+typedef std::hash_map
+<
+ XPropertiesChangeListenerPtr,
+ PropertyEventSequence*,
+ hashPtr,
+ equalPtr
+>
+PropertiesEventListenerMap;
+
+//=========================================================================
+//
+// PropertyChangeListenerContainer.
+//
+//=========================================================================
+
+struct equalStr
+{
+ bool operator()( const OUString& s1, const OUString& s2 ) const
+ {
+ return !!( s1 == s2 );
+ }
+};
+
+struct hashStr
+{
+ size_t operator()( const OUString& rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef OMultiTypeInterfaceContainerHelperVar
+<
+ OUString,
+ hashStr,
+ equalStr
+> PropertyChangeListeners;
+
+//=========================================================================
+//
+// struct ContentImplHelper_Impl
+//
+//=========================================================================
+
+struct ContentImplHelper_Impl
+{
+ vos::ORef< PropertySetInfo > m_xPropSetInfo;
+ vos::ORef< CommandProcessorInfo > m_xCommandsInfo;
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ cppu::OInterfaceContainerHelper* m_pContentEventListeners;
+ cppu::OInterfaceContainerHelper* m_pPropSetChangeListeners;
+ cppu::OInterfaceContainerHelper* m_pCommandChangeListeners;
+ PropertyChangeListeners* m_pPropertyChangeListeners;
+
+ ContentImplHelper_Impl()
+ : m_pDisposeEventListeners( 0 ),
+ m_pContentEventListeners( 0 ),
+ m_pPropSetChangeListeners( 0 ),
+ m_pCommandChangeListeners( 0 ),
+ m_pPropertyChangeListeners( 0 ) {}
+
+ ~ContentImplHelper_Impl()
+ {
+ delete m_pDisposeEventListeners;
+ delete m_pContentEventListeners;
+ delete m_pPropSetChangeListeners;
+ delete m_pCommandChangeListeners;
+ delete m_pPropertyChangeListeners;
+ }
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+//=========================================================================
+//=========================================================================
+//
+// ContentImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentImplHelper::ContentImplHelper(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< ContentProviderImplHelper >& rxProvider,
+ const Reference< XContentIdentifier >& Identifier,
+ sal_Bool bRegisterAtProvider )
+: m_pImpl( new ContentImplHelper_Impl ),
+ m_xSMgr( rxSMgr ),
+ m_xProvider( rxProvider ),
+ m_xIdentifier( Identifier ),
+ m_nCommandId( 0 )
+{
+ if ( bRegisterAtProvider )
+ m_xProvider->addContent( this );
+}
+
+//=========================================================================
+// virtual
+ContentImplHelper::~ContentImplHelper()
+{
+ m_xProvider->removeContent( this );
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_10( ContentImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContent,
+ XCommandProcessor,
+ XPropertiesChangeNotifier,
+ XCommandInfoChangeNotifier,
+ XPropertyContainer,
+ XPropertySetInfoChangeNotifier,
+ XChild );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_10( ContentImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContent,
+ XCommandProcessor,
+ XPropertiesChangeNotifier,
+ XCommandInfoChangeNotifier,
+ XPropertyContainer,
+ XPropertySetInfoChangeNotifier,
+ XChild );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+// virtual
+OUString SAL_CALL ContentImplHelper::getImplementationName()
+ throw( RuntimeException )
+{
+}
+
+//=========================================================================
+// virtual
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ContentImplHelper::getSupportedServiceNames()
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ContentImplHelper::supportsService(
+ const OUString& ServiceName )
+ throw( RuntimeException )
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString* pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::dispose()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners &&
+ m_pImpl->m_pDisposeEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XComponent * >( this );
+ m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pContentEventListeners &&
+ m_pImpl->m_pContentEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XContent * >( this );
+ m_pImpl->m_pContentEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XPropertySetInfoChangeNotifier * >( this );
+ m_pImpl->m_pPropSetChangeListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pCommandChangeListeners &&
+ m_pImpl->m_pCommandChangeListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XCommandInfoChangeNotifier * >( this );
+ m_pImpl->m_pCommandChangeListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XPropertiesChangeNotifier * >( this );
+ m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::addEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XContent methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XContentIdentifier > SAL_CALL ContentImplHelper::getIdentifier()
+ throw( RuntimeException )
+{
+ return m_xIdentifier;
+}
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ContentImplHelper::getContentType()
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::addContentEventListener(
+ const Reference< XContentEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pContentEventListeners )
+ m_pImpl->m_pContentEventListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pContentEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeContentEventListener(
+ const Reference< XContentEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pContentEventListeners )
+ m_pImpl->m_pContentEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XCommandProcessor methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL ContentImplHelper::createCommandIdentifier()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ // Just increase counter on every call to generate an identifier.
+ return ++m_nCommandId;
+}
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+//=========================================================================
+// virtual
+Any SAL_CALL ContentImplHelper::execute( const Command& aCommand,
+ sal_Int32 CommandId,
+ const Reference<
+ XCommandEnvironment >& Environment )
+ throw( Exception, CommandAbortedException, RuntimeException )
+{
+ if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< Property > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" )
+ return Any();
+ }
+
+ // Note: GET + empty sequence means "get all property values".
+ }
+ else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // setPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< PropertyValue > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" )
+ return Any();
+ }
+
+ if ( !Properties.getLength() )
+ {
+ VOS_ENSURE( sal_False, "No properties!" )
+ return Any();
+ }
+ }
+ else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertySetInfo
+ //////////////////////////////////////////////////////////////////
+
+ aRet <<= getPropertySetInfo();
+ }
+ else if ( aCommand.Name.compareToAscii( "getCommandInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getCommandInfo
+ //////////////////////////////////////////////////////////////////
+
+ aRet <<= getCommandInfo();
+ }
+ else if ( ( aCommand.Name.compareToAscii( "open" ) == 0 ) &&
+ ( open_command_arg contains no data sink ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // open command for a folder content
+ //////////////////////////////////////////////////////////////////
+
+ Reference< XDynamicResultSet > xSet
+ = new DynamicResultSet( m_xSMgr, this, aCommand, Environment );
+ aRet <<= xSet;
+ }
+ else if ( aCommand.Name.compareToAscii( "search" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // search command
+ //////////////////////////////////////////////////////////////////
+
+ Reference< XDynamicResultSet > xSet
+ = new DynamicResultSet( m_xSMgr, this, aCommand, Environment );
+ aRet <<= xSet;
+ }
+ else
+ {
+ //////////////////////////////////////////////////////////////////
+ // any other command
+ //////////////////////////////////////////////////////////////////
+
+ // Check the command...
+ if ( !aCommand.Name.getLength() && ( aCommand.Handle == -1 ) )
+ {
+ VOS_ENSURE( sal_False, "No command!" )
+ return Any();
+ }
+
+ }
+
+ return aRet;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::abort( sal_Int32 CommandId )
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+//
+// XPropertiesChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addPropertiesChangeListener(
+ const Sequence< OUString >& PropertyNames,
+ const Reference< XPropertiesChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners
+ = new PropertyChangeListeners( m_aMutex );
+
+ sal_Int32 nCount = PropertyNames.getLength();
+ if ( !nCount )
+ {
+ // Note: An empty sequence means a listener for "all" properties.
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ OUString(), Listener );
+ }
+ else
+ {
+ const OUString* pSeq = PropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rName = pSeq[ n ];
+ if ( rName.getLength() )
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ rName, Listener );
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removePropertiesChangeListener(
+ const Sequence< OUString >& PropertyNames,
+ const Reference< XPropertiesChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ sal_Int32 nCount = PropertyNames.getLength();
+ if ( !nCount )
+ {
+ // Note: An empty sequence means a listener for "all" properties.
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ OUString(), Listener );
+ }
+ else
+ {
+ const OUString* pSeq = PropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rName = pSeq[ n ];
+ if ( rName.getLength() )
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ rName, Listener );
+ }
+ }
+}
+
+//=========================================================================
+//
+// XCommandInfoChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addCommandInfoChangeListener(
+ const Reference< XCommandInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pCommandChangeListeners )
+ m_pImpl->m_pCommandChangeListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pCommandChangeListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeCommandInfoChangeListener(
+ const Reference< XCommandInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pCommandChangeListeners )
+ m_pImpl->m_pCommandChangeListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XPropertyContainer methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addProperty(
+ const OUString& Name, sal_Int16 Attributes, const Any& DefaultValue )
+ throw( PropertyExistException,
+ IllegalTypeException,
+ IllegalArgumentException,
+ RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //////////////////////////////////////////////////////////////////////
+ // Make sure a property with the requested name does not already
+ // exist in dynamic and static(!) properties.
+ //////////////////////////////////////////////////////////////////////
+
+ if ( getPropertySetInfo()->hasPropertyByName( Name ) )
+ {
+ // Property does already exist.
+ throw PropertyExistException();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Add a new dynamic property.
+ //////////////////////////////////////////////////////////////////////
+
+ // Open/create persistent property set.
+ Reference< XPersistentPropertySet > xSet(
+ getAdditionalPropertySet( sal_True ) );
+
+ VOS_ENSURE( xSet.is(), "ContentImplHelper::addProperty - No property set!" );
+
+ if ( xSet.is() )
+ {
+ Reference< XPropertyContainer > xContainer( xSet, UNO_QUERY );
+
+ VOS_ENSURE( xContainer.is(),
+ "ContentImplHelper::addProperty - No property container!" );
+
+ if ( xContainer.is() )
+ {
+ // Property is always removeable.
+ Attributes |= PropertyAttribute::REMOVEABLE;
+
+ try
+ {
+ xContainer->addProperty( Name, Attributes, DefaultValue );
+ }
+ catch ( PropertyExistException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Exists!" );
+ throw e;
+ }
+ catch ( IllegalTypeException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Wrong Type!" );
+ throw e;
+ }
+ catch ( IllegalArgumentException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Illegal Arg!" );
+ throw e;
+ }
+
+ // Success!
+
+ if ( m_pImpl->m_xPropSetInfo.isValid() )
+ {
+ // Info cached in propertyset info is invalid now!
+ m_pImpl->m_xPropSetInfo->reset();
+ }
+
+ // Notify propertyset info change listeners.
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ PropertySetInfoChangeEvent evt(
+ static_cast< OWeakObject * >( this ),
+ Name,
+ -1, // No handle available
+ PropertySetInfoChange::PROPERTY_INSERTED );
+ notifyPropertySetInfoChange( evt );
+ }
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeProperty( const OUString& Name )
+ throw( UnknownPropertyException,
+ NotRemoveableException,
+ RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ try
+ {
+ Property aProp = getPropertySetInfo()->getPropertyByName( Name );
+
+ if ( !( aProp.Attributes & PropertyAttribute::REMOVEABLE ) )
+ {
+ // Not removeable!
+ throw NotRemoveableException();
+ }
+ }
+ catch ( UnknownPropertyException& e )
+ {
+ VOS_ENSURE( sal_False, "ContentImplHelper::removeProperty - Unknown!" );
+ throw e;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Try to remove property from dynamic property set.
+ //////////////////////////////////////////////////////////////////////
+
+ // Open persistent property set, if exists.
+ Reference< XPersistentPropertySet > xSet(
+ getAdditionalPropertySet( sal_False ) );
+ if ( xSet.is() )
+ {
+ Reference< XPropertyContainer > xContainer( xSet, UNO_QUERY );
+
+ VOS_ENSURE( xContainer.is(),
+ "ContentImplHelper::removeProperty - No property container!" );
+
+ if ( xContainer.is() )
+ {
+ try
+ {
+ xContainer->removeProperty( Name );
+ }
+ catch ( UnknownPropertyException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::removeProperty - Unknown!" );
+ throw e;
+ }
+ catch ( NotRemoveableException& e )
+ {
+ VOS_ENSURE( sal_False,
+ "ContentImplHelper::removeProperty - Unremoveable!" );
+ throw e;
+ }
+
+ xContainer = 0;
+
+ // Success!
+
+ if ( xSet->getPropertySetInfo()->getProperties().getLength() == 0 )
+ {
+ // Remove empty propertyset from registry.
+ Reference< XPropertySetRegistry > xReg = xSet->getRegistry();
+ if ( xReg.is() )
+ {
+ OUString aKey( xSet->getKey() );
+ xSet = 0;
+ xReg->removePropertySet( aKey );
+ }
+ }
+
+ if ( m_pImpl->m_xPropSetInfo.isValid() )
+ {
+ // Info cached in propertyset info is invalid now!
+ m_pImpl->m_xPropSetInfo->reset();
+ }
+
+ // Notify propertyset info change listeners.
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ PropertySetInfoChangeEvent evt(
+ static_cast< OWeakObject * >( this ),
+ Name,
+ -1, // No handle available
+ PropertySetInfoChange::PROPERTY_REMOVED );
+ notifyPropertySetInfoChange( evt );
+ }
+ }
+ }
+}
+
+//=========================================================================
+//
+// XPropertySetInfoChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addPropertySetInfoChangeListener(
+ const Reference< XPropertySetInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropSetChangeListeners )
+ m_pImpl->m_pPropSetChangeListeners
+ = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pPropSetChangeListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removePropertySetInfoChangeListener(
+ const Reference< XPropertySetInfoChangeListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pPropSetChangeListeners )
+ m_pImpl->m_pPropSetChangeListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XChild methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XInterface > SAL_CALL ContentImplHelper::getParent()
+ throw( RuntimeException )
+{
+ OUString aURL = getParentURL();
+
+ if ( aURL.getLength() )
+ {
+ Reference< XContentIdentifier > xId(
+ new ::ucb::ContentIdentifier( m_xSMgr, aURL ) );
+ return m_xProvider->queryContent( xId );
+ }
+
+ return Reference< XInterface >();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::setParent(
+ const Reference< XInterface >& Parent )
+ throw( NoSupportException, RuntimeException )
+{
+ throw NoSupportException();
+}
+
+//=========================================================================
+//
+// Non-interface methods
+//
+//=========================================================================
+
+Reference< XPersistentPropertySet >
+ ContentImplHelper::getAdditionalPropertySet( sal_Bool bCreate )
+{
+ // Get propertyset from provider.
+ return m_xProvider->getAdditionalPropertySet(
+ m_xIdentifier->getContentIdentifier(), bCreate );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::renameAdditionalPropertySet(
+ const OUString& rOldKey,
+ const OUString& rNewKey,
+ sal_Bool bRecursive )
+{
+ return m_xProvider->renameAdditionalPropertySet(
+ rOldKey, rNewKey, bRecursive );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::removeAdditionalPropertySet( sal_Bool bRecursive )
+{
+ return m_xProvider->removeAdditionalPropertySet(
+ m_xIdentifier->getContentIdentifier(), bRecursive );
+}
+
+//=========================================================================
+void ContentImplHelper::notifyPropertiesChange(
+ const Sequence< PropertyChangeEvent >& evt ) const
+{
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ sal_Int32 nCount = evt.getLength();
+ if ( nCount )
+ {
+ // First, notify listeners interested in changes of every property.
+ OInterfaceContainerHelper* pAllPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( OUString() );
+ if ( pAllPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pAllPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XPropertiesChangeListener > xListener(
+ aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertiesChange( evt );
+ }
+ }
+
+ PropertiesEventListenerMap aListeners;
+
+ const PropertyChangeEvent* pEvents = evt.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const PropertyChangeEvent& rEvent = pEvents[ n ];
+ const OUString& rName = rEvent.PropertyName;
+
+ OInterfaceContainerHelper* pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( rName );
+ if ( pPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ PropertyEventSequence* pEvents = NULL;
+
+ XPropertiesChangeListener* pListener =
+ static_cast< XPropertiesChangeListener * >(
+ aIter.next() );
+ PropertiesEventListenerMap::iterator it =
+ aListeners.find( pListener );
+ if ( it == aListeners.end() )
+ {
+ // Not in map - create and insert new entry.
+ pEvents = new PropertyEventSequence( nCount );
+ aListeners[ pListener ] = pEvents;
+ }
+ else
+ pEvents = (*it).second;
+
+ if ( pEvents )
+ pEvents->append( rEvent );
+ }
+ }
+ }
+
+ // Notify listeners.
+ PropertiesEventListenerMap::iterator it = aListeners.begin();
+ while ( !aListeners.empty() )
+ {
+ XPropertiesChangeListener* pListener =
+ static_cast< XPropertiesChangeListener * >( (*it).first );
+ PropertyEventSequence* pSeq = (*it).second;
+
+ // Remove current element.
+ aListeners.erase( it );
+
+ // Propagate event.
+ pListener->propertiesChange( pSeq->getEvents() );
+
+ delete pSeq;
+
+ it = aListeners.begin();
+ }
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyPropertySetInfoChange(
+ const PropertySetInfoChangeEvent& evt ) const
+{
+ if ( !m_pImpl->m_pPropSetChangeListeners )
+ return;
+
+ // Notify event listeners.
+ OInterfaceIteratorHelper aIter( *m_pImpl->m_pPropSetChangeListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XPropertySetInfoChangeListener >
+ xListener( aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertySetInfoChange( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyCommandInfoChange(
+ const CommandInfoChangeEvent& evt ) const
+{
+ if ( !m_pImpl->m_pCommandChangeListeners )
+ return;
+
+ // Notify event listeners.
+ OInterfaceIteratorHelper aIter( *m_pImpl->m_pCommandChangeListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XCommandInfoChangeListener >
+ xListener( aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->commandInfoChange( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyContentEvent( const ContentEvent& evt ) const
+{
+ if ( !m_pImpl->m_pContentEventListeners )
+ return;
+
+ // Notify event listeners.
+ OInterfaceIteratorHelper aIter( *m_pImpl->m_pContentEventListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ Reference< XContentEventListener > xListener( aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->contentEvent( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::inserted()
+{
+ // Content is not yet registered at provider.
+ m_xProvider->addContent( this );
+
+ // If the parent content is currently not instanciated, there can be
+ // no listeners interested in changes ;-)
+
+ vos::ORef< ContentImplHelper > xParent
+ = m_xProvider->queryExistingContent( getParentURL() );
+
+ if ( xParent.isValid() )
+ {
+ ContentEvent aEvt( static_cast< OWeakObject * >(
+ xParent.getBodyPtr() ), // Source
+ ContentAction::INSERTED, // Action
+ this, // Content
+ xParent->getIdentifier() ); // Id
+ xParent->notifyContentEvent( aEvt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::deleted()
+{
+ Reference< XContent > xThis = this;
+
+ vos::ORef< ContentImplHelper > xParent
+ = m_xProvider->queryExistingContent( getParentURL() );
+
+ if ( xParent.isValid() )
+ {
+ // Let parent notify "REMOVED" event.
+ ContentEvent aEvt( static_cast< OWeakObject * >( xParent.getBodyPtr() ),
+ ContentAction::REMOVED,
+ this,
+ xParent->getIdentifier() );
+ xParent->notifyContentEvent( aEvt );
+ }
+
+ // Notify "DELETED" event.
+ ContentEvent aEvt1( static_cast< OWeakObject * >( this ),
+ ContentAction::DELETED,
+ this,
+ getIdentifier() );
+ notifyContentEvent( aEvt1 );
+
+ m_xProvider->removeContent( this );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::exchange(
+ const Reference< XContentIdentifier >& rNewId )
+{
+ Reference< XContent > xThis = this;
+
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ vos::ORef< ContentImplHelper > xContent
+ = m_xProvider->queryExistingContent( rNewId );
+ if ( xContent.isValid() )
+ {
+ // @@@
+ // Big trouble. Another object with the new identity exists.
+ // How shall I mutate to / merge with the other object?
+ return sal_False;
+ }
+
+ Reference< XContentIdentifier > xOldId = getIdentifier();
+
+ // Re-insert at provider.
+ m_xProvider->removeContent( this );
+ m_xIdentifier = rNewId;
+ m_xProvider->addContent( this );
+
+ aGuard.clear();
+
+ // Notify "EXCHANGED" event.
+ ContentEvent aEvt( static_cast< OWeakObject * >( this ),
+ ContentAction::EXCHANGED,
+ this,
+ xOldId );
+ notifyContentEvent( aEvt );
+ return sal_True;
+}
+
+//=========================================================================
+Reference< XCommandInfo > ContentImplHelper::getCommandInfo()
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xCommandsInfo.isValid() )
+ m_pImpl->m_xCommandsInfo = new CommandProcessorInfo( m_xSMgr, this );
+
+ return Reference< XCommandInfo >( m_pImpl->m_xCommandsInfo.getBodyPtr() );
+}
+
+//=========================================================================
+Reference< XPropertySetInfo > ContentImplHelper::getPropertySetInfo()
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xPropSetInfo.isValid() )
+ m_pImpl->m_xPropSetInfo = new PropertySetInfo( m_xSMgr, this );
+
+ return Reference< XPropertySetInfo >(
+ m_pImpl->m_xPropSetInfo.getBodyPtr() );
+}
+
diff --git a/ucbhelper/source/provider/contentidentifier.cxx b/ucbhelper/source/provider/contentidentifier.cxx
new file mode 100644
index 000000000000..115c44414960
--- /dev/null
+++ b/ucbhelper/source/provider/contentidentifier.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentidentifier.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+
+namespace ucb
+{
+
+//=========================================================================
+//=========================================================================
+//
+// struct ContentIdentifier_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+struct ContentIdentifier_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ OUString m_aContentId;
+ OUString m_aProviderScheme;
+ osl::Mutex m_aMutex;
+
+ ContentIdentifier_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const OUString& rURL );
+};
+
+//=========================================================================
+//
+// ContentIdentifier_Impl Implementation.
+//
+//=========================================================================
+
+ContentIdentifier_Impl::ContentIdentifier_Impl(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const OUString& rURL )
+: m_xSMgr( rSMgr )
+{
+ // Normalize URL scheme ( it's case insensitive ).
+
+ // The content provider scheme is the part before the first ':'
+ // within the content id.
+ sal_Int32 nPos = rURL.indexOf( ':', 0 );
+ if ( nPos != -1 )
+ {
+ OUString aScheme( rURL.copy( 0, nPos ) );
+ m_aProviderScheme = aScheme.toLowerCase();
+ m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
+ }
+}
+
+//=========================================================================
+//
+// ContentIdentifier Implementation.
+//
+//=========================================================================
+
+ContentIdentifier::ContentIdentifier(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const OUString& rURL )
+{
+ m_pImpl = new ContentIdentifier_Impl( rxSMgr, rURL );
+}
+
+//=========================================================================
+ContentIdentifier::ContentIdentifier( const OUString& rURL )
+{
+ m_pImpl = new ContentIdentifier_Impl(
+ Reference< XMultiServiceFactory >(), rURL );
+}
+
+//=========================================================================
+// virtual
+ContentIdentifier::~ContentIdentifier()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentIdentifier::acquire()
+ throw( RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentIdentifier::release()
+ throw( RuntimeException )
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL
+ContentIdentifier::queryInterface( const Type & rType )
+ throw ( RuntimeException )
+{
+ Any aRet = cppu::queryInterface( rType,
+ static_cast< XTypeProvider * >( this ),
+ static_cast< XContentIdentifier * >( this ) );
+
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+ContentIdentifier::getImplementationId()
+ throw( RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+Sequence< com::sun::star::uno::Type > SAL_CALL
+ContentIdentifier::getTypes()
+ throw( RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = NULL;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ Reference < XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ Reference< XContentIdentifier > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XContentIdentifier methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL ContentIdentifier::getContentIdentifier()
+ throw( RuntimeException )
+{
+ return m_pImpl->m_aContentId;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ContentIdentifier::getContentProviderScheme()
+ throw( RuntimeException )
+{
+ return m_pImpl->m_aProviderScheme;
+}
+
+} /* namespace ucb */
+
diff --git a/ucbhelper/source/provider/contentinfo.cxx b/ucbhelper/source/provider/contentinfo.cxx
new file mode 100644
index 000000000000..588eabbf6e22
--- /dev/null
+++ b/ucbhelper/source/provider/contentinfo.cxx
@@ -0,0 +1,475 @@
+/*************************************************************************
+ *
+ * $RCSfile: contentinfo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPROPERTYSETREGISTRY_HPP_
+#include <com/sun/star/ucb/XPropertySetRegistry.hpp>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTINFO_HXX
+#include <ucbhelper/contentinfo.hxx>
+#endif
+
+using namespace rtl;
+using namespace vos;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::ucb;
+using namespace ucb;
+
+//=========================================================================
+//=========================================================================
+//
+// PropertySetInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+PropertySetInfo::PropertySetInfo(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent )
+: m_xSMgr( rxSMgr ),
+ m_pProps( 0 ),
+ m_pContent( pContent )
+{
+}
+
+//=========================================================================
+// virtual
+PropertySetInfo::~PropertySetInfo()
+{
+ delete m_pProps;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XPropertySetInfo methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< Property > SAL_CALL PropertySetInfo::getProperties()
+ throw( RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_pProps )
+ {
+ m_pProps = new Sequence< Property >( 128 );
+ Property* pProps = m_pProps->getArray();
+ sal_Int32 nPos = 0;
+ sal_Int32 nSize = m_pProps->getLength();
+
+ //////////////////////////////////////////////////////////////////
+ // Get info for core ( native) properties.
+ //////////////////////////////////////////////////////////////////
+
+ const ::ucb::PropertyInfoTableEntry& rCoreProps
+ = m_pContent->getPropertyInfoTable();
+ const ::ucb::PropertyInfoTableEntry* pCurr = &rCoreProps;
+ while ( pCurr->pName )
+ {
+ if ( nSize <= nPos )
+ {
+ m_pProps->realloc( 128 );
+ nSize += 128;
+ }
+
+ Property& rProp = pProps[ nPos ];
+
+ VOS_ENSURE( pCurr->pType,
+ "PropertySetInfo::getProperties - No type!" );
+
+ rProp.Name = OUString::createFromAscii( pCurr->pName );
+ rProp.Handle = pCurr->nHandle;
+ rProp.Type = *pCurr->pType;
+ rProp.Attributes = pCurr->nAttributes;
+
+ nPos++;
+ pCurr++;
+ }
+
+ if ( nPos > 0 )
+ {
+ m_pProps->realloc( nPos );
+ nSize = m_pProps->getLength();
+ }
+
+ //////////////////////////////////////////////////////////////////
+ // Get info for additional properties.
+ //////////////////////////////////////////////////////////////////
+
+ Reference< XPersistentPropertySet > xSet (
+ m_pContent->getAdditionalPropertySet( sal_False ) );
+
+ if ( xSet.is() )
+ {
+ // Get property set info.
+ Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
+ if ( xInfo.is() )
+ {
+ const Sequence< Property >& rAddProps = xInfo->getProperties();
+ sal_Int32 nAddProps = rAddProps.getLength();
+ if ( nAddProps > 0 )
+ {
+ m_pProps->realloc( nSize + nAddProps );
+ pProps = m_pProps->getArray();
+
+ const Property* pAddProps = rAddProps.getConstArray();
+ for ( sal_Int32 n = 0; n < nAddProps; ++n, ++nPos )
+ pProps[ nPos ] = pAddProps[ n ];
+ }
+ }
+ }
+ }
+ return *m_pProps;
+}
+
+//=========================================================================
+// virtual
+Property SAL_CALL PropertySetInfo::getPropertyByName( const OUString& aName )
+ throw( UnknownPropertyException, RuntimeException )
+{
+ Property aProp;
+ if ( queryProperty( aName, aProp ) )
+ return aProp;
+
+ throw UnknownPropertyException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName( const OUString& Name )
+ throw( RuntimeException )
+{
+ Property aProp;
+ return queryProperty( Name, aProp );
+}
+
+//=========================================================================
+//
+// Non-Interface methods.
+//
+//=========================================================================
+
+void PropertySetInfo::reset()
+{
+ vos::OGuard aGuard( m_aMutex );
+ delete m_pProps;
+ m_pProps = 0;
+}
+
+//=========================================================================
+sal_Bool PropertySetInfo::queryProperty(
+ const OUString& rName, Property& rProp )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ getProperties();
+
+ const Property* pProps = m_pProps->getConstArray();
+ sal_Int32 nCount = m_pProps->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const Property& rCurrProp = pProps[ n ];
+ if ( rCurrProp.Name == rName )
+ {
+ rProp = rCurrProp;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// CommandProcessorInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+CommandProcessorInfo::CommandProcessorInfo(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ ContentImplHelper* pContent )
+: m_xSMgr( rxSMgr ),
+ m_pCommands( 0 ),
+ m_pContent( pContent )
+{
+}
+
+//=========================================================================
+// virtual
+CommandProcessorInfo::~CommandProcessorInfo()
+{
+ delete m_pCommands;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( CommandProcessorInfo,
+ XTypeProvider,
+ XCommandInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( CommandProcessorInfo,
+ XTypeProvider,
+ XCommandInfo );
+
+//=========================================================================
+//
+// XCommandInfo methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< CommandInfo > SAL_CALL CommandProcessorInfo::getCommands()
+ throw( RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_pCommands )
+ {
+ m_pCommands = new Sequence< CommandInfo >( 128 );
+ CommandInfo* pCommands = m_pCommands->getArray();
+ sal_Int32 nPos = 0;
+ sal_Int32 nSize = m_pCommands->getLength();
+
+ //////////////////////////////////////////////////////////////////
+ // Get info for commands.
+ //////////////////////////////////////////////////////////////////
+
+ const ::ucb::CommandInfoTableEntry& rCommands
+ = m_pContent->getCommandInfoTable();
+ const ::ucb::CommandInfoTableEntry* pCurr = &rCommands;
+ while ( pCurr->pName )
+ {
+ if ( nSize <= nPos )
+ {
+ m_pCommands->realloc( 128 );
+ nSize += 128;
+ }
+
+ CommandInfo& rCommand = pCommands[ nPos ];
+
+ rCommand.Name = OUString::createFromAscii( pCurr->pName );
+ rCommand.Handle = pCurr->nHandle;
+ if ( pCurr->pArgType )
+ rCommand.ArgType = *pCurr->pArgType;
+
+ nPos++;
+ pCurr++;
+ }
+
+ if ( nPos > 0 )
+ m_pCommands->realloc( nPos );
+ }
+ return *m_pCommands;
+}
+
+//=========================================================================
+// virtual
+CommandInfo SAL_CALL CommandProcessorInfo::getCommandInfoByName(
+ const OUString& Name )
+ throw( UnsupportedCommandException, RuntimeException )
+{
+ CommandInfo aInfo;
+ if ( queryCommand( Name, aInfo ) )
+ return aInfo;
+
+ throw UnsupportedCommandException();
+}
+
+//=========================================================================
+// virtual
+CommandInfo SAL_CALL CommandProcessorInfo::getCommandInfoByHandle(
+ sal_Int32 Handle )
+ throw( UnsupportedCommandException, RuntimeException )
+{
+ CommandInfo aInfo;
+ if ( queryCommand( Handle, aInfo ) )
+ return aInfo;
+
+ throw UnsupportedCommandException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByName( const OUString& Name )
+ throw( RuntimeException )
+{
+ CommandInfo aInfo;
+ return queryCommand( Name, aInfo );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle )
+ throw( RuntimeException )
+{
+ CommandInfo aInfo;
+ return queryCommand( Handle, aInfo );
+}
+
+//=========================================================================
+//
+// Non-Interface methods.
+//
+//=========================================================================
+
+void CommandProcessorInfo::reset()
+{
+ vos::OGuard aGuard( m_aMutex );
+ delete m_pCommands;
+ m_pCommands = 0;
+}
+
+
+//=========================================================================
+sal_Bool CommandProcessorInfo::queryCommand( const OUString& rName,
+ CommandInfo& rCommand )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ getCommands();
+
+ const CommandInfo* pCommands = m_pCommands->getConstArray();
+ sal_Int32 nCount = m_pCommands->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const CommandInfo& rCurrCommand = pCommands[ n ];
+ if ( rCurrCommand.Name == rName )
+ {
+ rCommand = rCurrCommand;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+sal_Bool CommandProcessorInfo::queryCommand( sal_Int32 nHandle,
+ CommandInfo& rCommand )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ getCommands();
+
+ const CommandInfo* pCommands = m_pCommands->getConstArray();
+ sal_Int32 nCount = m_pCommands->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const CommandInfo& rCurrCommand = pCommands[ n ];
+ if ( rCurrCommand.Handle == nHandle )
+ {
+ rCommand = rCurrCommand;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
diff --git a/ucbhelper/source/provider/makefile.mk b/ucbhelper/source/provider/makefile.mk
new file mode 100644
index 000000000000..2f76091e63a1
--- /dev/null
+++ b/ucbhelper/source/provider/makefile.mk
@@ -0,0 +1,98 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME= ucbhelper
+TARGET= provider
+AUTOSEG= TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+SLOFILES=\
+ $(SLO)$/configureucb.obj \
+ $(SLO)$/contentidentifier.obj \
+ $(SLO)$/providerhelper.obj \
+ $(SLO)$/contenthelper.obj \
+ $(SLO)$/contentinfo.obj \
+ $(SLO)$/propertyvalueset.obj \
+ $(SLO)$/registerucb.obj \
+ $(SLO)$/resultsetmetadata.obj \
+ $(SLO)$/resultset.obj \
+ $(SLO)$/resultsethelper.obj
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx
new file mode 100644
index 000000000000..db4bdf68f48b
--- /dev/null
+++ b/ucbhelper/source/provider/propertyvalueset.cxx
@@ -0,0 +1,925 @@
+/*************************************************************************
+ *
+ * $RCSfile: propertyvalueset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __VECTOR__
+#include <stl/vector>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_
+#include <com/sun/star/script/XTypeConverter.hpp>
+#endif
+
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+
+#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
+#include <ucbhelper/propertyvalueset.hxx>
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::script;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+using namespace ucb;
+
+namespace ucb_impl
+{
+
+//=========================================================================
+//
+// PropertyValue.
+//
+//=========================================================================
+
+const sal_uInt32 NO_VALUE_SET = 0x00000000;
+const sal_uInt32 STRING_VALUE_SET = 0x00000001;
+const sal_uInt32 BOOLEAN_VALUE_SET = 0x00000002;
+const sal_uInt32 BYTE_VALUE_SET = 0x00000004;
+const sal_uInt32 SHORT_VALUE_SET = 0x00000008;
+const sal_uInt32 INT_VALUE_SET = 0x00000010;
+const sal_uInt32 LONG_VALUE_SET = 0x00000020;
+const sal_uInt32 FLOAT_VALUE_SET = 0x00000040;
+const sal_uInt32 DOUBLE_VALUE_SET = 0x00000080;
+const sal_uInt32 BYTES_VALUE_SET = 0x00000100;
+const sal_uInt32 DATE_VALUE_SET = 0x00000200;
+const sal_uInt32 TIME_VALUE_SET = 0x00000400;
+const sal_uInt32 TIMESTAMP_VALUE_SET = 0x00000800;
+const sal_uInt32 BINARYSTREAM_VALUE_SET = 0x00001000;
+const sal_uInt32 CHARACTERSTREAM_VALUE_SET = 0x00002000;
+const sal_uInt32 REF_VALUE_SET = 0x00004000;
+const sal_uInt32 BLOB_VALUE_SET = 0x00008000;
+const sal_uInt32 CLOB_VALUE_SET = 0x00010000;
+const sal_uInt32 ARRAY_VALUE_SET = 0x00020000;
+const sal_uInt32 OBJECT_VALUE_SET = 0x00040000;
+
+struct PropertyValue
+{
+ Property aProperty;
+
+ sal_uInt32 nPropsSet;
+ sal_uInt32 nOrigValue;
+
+ OUString aString; // getString
+ sal_Bool bBoolean; // getBoolean
+ sal_Int8 nByte; // getByte
+ sal_Int16 nShort; // getShort
+ sal_Int32 nInt; // getInt
+ sal_Int64 nLong; // getLong
+ float nFloat; // getFloat
+ double nDouble; // getDouble
+
+ Sequence< sal_Int8 > aBytes; // getBytes
+ Date aDate; // getDate
+ Time aTime; // getTime
+ DateTime aTimestamp; // getTimestamp
+ Reference< XInputStream > xBinaryStream; // getBinaryStream
+ Reference< XInputStream > xCharacterStream; // getCharacterStream
+ Reference< XRef > xRef; // getRef
+ Reference< XBlob > xBlob; // getBlob
+ Reference< XClob > xClob; // getClob
+ Reference< XArray > xArray; // getArray
+ Any aObject; // getObject
+
+ inline PropertyValue()
+ : nPropsSet( NO_VALUE_SET ), nOrigValue( NO_VALUE_SET ) {}
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+namespace ucb
+{
+
+//=========================================================================
+//
+// class PropertyValues.
+//
+//=========================================================================
+
+typedef std::vector< ucb_impl::PropertyValue > PropertyValuesVector;
+
+class PropertyValues : public PropertyValuesVector {};
+
+} // namespace ucb
+
+//=========================================================================
+//
+// Welcome to the macro hell...
+//
+//=========================================================================
+
+#define GETVALUE_IMPL_TYPE( _type_, _type_name_, _member_name_, _cppu_type_ ) \
+ \
+ vos::OGuard aGuard( m_aMutex ); \
+ \
+ _type_ aValue = _type_(); /* default ctor */ \
+ \
+ m_bWasNull = sal_True; \
+ \
+ if ( ( columnIndex < 1 ) || ( columnIndex > m_pValues->size() ) ) \
+ { \
+ VOS_ENSURE( sal_False, "PropertyValueSet - index out of range!" ); \
+ } \
+ else \
+ { \
+ ucb_impl::PropertyValue& rValue = (*m_pValues)[ columnIndex - 1 ]; \
+ \
+ if ( rValue.nOrigValue != NO_VALUE_SET ) \
+ { \
+ if ( rValue.nPropsSet & _type_name_ ) \
+ { \
+ /* Values is present natively... */ \
+ aValue = rValue._member_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ else \
+ { \
+ if ( !(rValue.nPropsSet & OBJECT_VALUE_SET) ) \
+ { \
+ /* Value is not (yet) available as Any. Create it. */ \
+ getObject( columnIndex, Reference< XNameAccess >() ); \
+ } \
+ \
+ if ( rValue.nPropsSet & OBJECT_VALUE_SET ) \
+ { \
+ /* Value is available as Any. */ \
+ \
+ /* Try to convert into native value. */ \
+ if ( rValue.aObject >>= aValue ) \
+ { \
+ rValue._member_name_ = aValue; \
+ rValue.nPropsSet |= _type_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ else \
+ { \
+ /* Last chance. Try type converter service... */ \
+ \
+ Reference< XTypeConverter > xConverter \
+ = getTypeConverter(); \
+ if ( xConverter.is() ) \
+ { \
+ try \
+ { \
+ Any aConvAny = xConverter->convertTo( \
+ rValue.aObject, \
+ _cppu_type_ ); \
+ \
+ if ( aConvAny >>= aValue ) \
+ { \
+ rValue._member_name_ = aValue; \
+ rValue.nPropsSet |= _type_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ } \
+ catch ( IllegalArgumentException ) \
+ { \
+ } \
+ catch ( CannotConvertException ) \
+ { \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } \
+ return aValue;
+
+#define GETVALUE_IMPL( _type_, _type_name_, _member_name_ ) \
+ GETVALUE_IMPL_TYPE( _type_, \
+ _type_name_, \
+ _member_name_, \
+ getCppuType( static_cast< const _type_ * >( 0 ) ) )
+
+#define SETVALUE_IMPL( _property_, _type_name_, _member_name_, _value_ ) \
+ \
+ vos::OGuard aGuard( m_aMutex ); \
+ \
+ ucb_impl::PropertyValue aNewValue; \
+ aNewValue.aProperty = _property_; \
+ aNewValue.nPropsSet = _type_name_; \
+ aNewValue.nOrigValue = _type_name_; \
+ aNewValue._member_name_ = _value_; \
+ \
+ m_pValues->push_back( aNewValue );
+
+//=========================================================================
+//=========================================================================
+//
+// PropertyValueSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+PropertyValueSet::PropertyValueSet(
+ const Reference< XMultiServiceFactory >& rxSMgr )
+: m_xSMgr( rxSMgr ),
+ m_bWasNull( sal_False ),
+ m_bTriedToGetTypeConverter( sal_False )
+{
+ m_pValues = new PropertyValues;
+}
+
+//=========================================================================
+// virtual
+PropertyValueSet::~PropertyValueSet()
+{
+ delete m_pValues;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_3( PropertyValueSet,
+ XTypeProvider,
+ XRow,
+ XColumnLocate );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( PropertyValueSet,
+ XTypeProvider,
+ XRow,
+ XColumnLocate );
+
+//=========================================================================
+//
+// XRow methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL PropertyValueSet::wasNull()
+ throw( SQLException, RuntimeException )
+{
+ // This method can not be implemented correctly!!! Imagine different
+ // threads doing a getXYZ - wasNull calling sequence on the same
+ // implementation object...
+ return m_bWasNull;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL PropertyValueSet::getString( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( OUString, STRING_VALUE_SET, aString );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertyValueSet::getBoolean( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL_TYPE(
+ sal_Bool, BOOLEAN_VALUE_SET, bBoolean, getCppuBooleanType() );
+}
+
+//=========================================================================
+// virtual
+sal_Int8 SAL_CALL PropertyValueSet::getByte( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int8, BYTE_VALUE_SET, nByte );
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL PropertyValueSet::getShort( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int16, SHORT_VALUE_SET, nShort );
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL PropertyValueSet::getInt( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int32, INT_VALUE_SET, nInt );
+}
+
+//=========================================================================
+// virtual
+sal_Int64 SAL_CALL PropertyValueSet::getLong( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int64, LONG_VALUE_SET, nLong );
+}
+
+//=========================================================================
+// virtual
+float SAL_CALL PropertyValueSet::getFloat( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( float, FLOAT_VALUE_SET, nFloat );
+}
+
+//=========================================================================
+// virtual
+double SAL_CALL PropertyValueSet::getDouble( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( double, DOUBLE_VALUE_SET, nDouble );
+}
+
+//=========================================================================
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+PropertyValueSet::getBytes( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Sequence< sal_Int8 >, BYTES_VALUE_SET, aBytes );
+}
+
+//=========================================================================
+// virtual
+Date SAL_CALL PropertyValueSet::getDate( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Date, DATE_VALUE_SET, aDate );
+}
+
+//=========================================================================
+// virtual
+Time SAL_CALL PropertyValueSet::getTime( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Time, TIME_VALUE_SET, aTime );
+}
+
+//=========================================================================
+// virtual
+DateTime SAL_CALL PropertyValueSet::getTimestamp( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( DateTime, TIMESTAMP_VALUE_SET, aTimestamp );
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+PropertyValueSet::getBinaryStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL(
+ Reference< XInputStream >, BINARYSTREAM_VALUE_SET, xBinaryStream );
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+PropertyValueSet::getCharacterStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL(
+ Reference< XInputStream >, CHARACTERSTREAM_VALUE_SET, xCharacterStream );
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL PropertyValueSet::getObject(
+ sal_Int32 columnIndex,
+ const Reference< XNameAccess >& typeMap )
+ throw( SQLException, RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ Any aValue;
+
+ m_bWasNull = sal_True;
+
+ if ( ( columnIndex < 1 ) || ( columnIndex > m_pValues->size() ) )
+ {
+ VOS_ENSURE( sal_False, "PropertyValueSet - index out of range!" );
+ }
+ else
+ {
+ ucb_impl::PropertyValue& rValue = (*m_pValues)[ columnIndex - 1 ];
+
+ if ( rValue.nPropsSet & OBJECT_VALUE_SET )
+ {
+ // Values is present natively...
+ aValue = rValue.aObject;
+ m_bWasNull = sal_False;
+ }
+ else
+ {
+ // Make Any from original value.
+
+ switch ( rValue.nOrigValue )
+ {
+ case NO_VALUE_SET:
+ break;
+
+ case STRING_VALUE_SET:
+ aValue <<= rValue.aString;
+ break;
+
+ case BOOLEAN_VALUE_SET:
+ aValue <<= rValue.bBoolean;
+ break;
+
+ case BYTE_VALUE_SET:
+ aValue <<= rValue.nByte;
+ break;
+
+ case SHORT_VALUE_SET:
+ aValue <<= rValue.nShort;
+ break;
+
+ case INT_VALUE_SET:
+ aValue <<= rValue.nInt;
+ break;
+
+ case LONG_VALUE_SET:
+ aValue <<= rValue.nLong;
+ break;
+
+ case FLOAT_VALUE_SET:
+ aValue <<= rValue.nFloat;
+ break;
+
+ case DOUBLE_VALUE_SET:
+ aValue <<= rValue.nDouble;
+ break;
+
+ case BYTES_VALUE_SET:
+ aValue <<= rValue.aBytes;
+ break;
+
+ case DATE_VALUE_SET:
+ aValue <<= rValue.aDate;
+ break;
+
+ case TIME_VALUE_SET:
+ aValue <<= rValue.aTime;
+ break;
+
+ case TIMESTAMP_VALUE_SET:
+ aValue <<= rValue.aTimestamp;
+ break;
+
+ case BINARYSTREAM_VALUE_SET:
+ aValue <<= rValue.xBinaryStream;
+ break;
+
+ case CHARACTERSTREAM_VALUE_SET:
+ aValue <<= rValue.xCharacterStream;
+ break;
+
+ case REF_VALUE_SET:
+ aValue <<= rValue.xRef;
+ break;
+
+ case BLOB_VALUE_SET:
+ aValue <<= rValue.xBlob;
+ break;
+
+ case CLOB_VALUE_SET:
+ aValue <<= rValue.xClob;
+ break;
+
+ case ARRAY_VALUE_SET:
+ aValue <<= rValue.xArray;
+ break;
+
+ case OBJECT_VALUE_SET:
+ // Fall-through is intended!
+ default:
+ VOS_ENSURE( sal_False,
+ "PropertyValueSet::getObject - "
+ "Wrong original type" );
+ break;
+ }
+
+ if ( aValue.hasValue() )
+ {
+ rValue.aObject = aValue;
+ rValue.nPropsSet |= OBJECT_VALUE_SET;
+ m_bWasNull = sal_False;
+ }
+ }
+ }
+
+ return aValue;
+}
+
+//=========================================================================
+// virtual
+Reference< XRef > SAL_CALL PropertyValueSet::getRef( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XRef >, REF_VALUE_SET, xRef );
+}
+
+//=========================================================================
+// virtual
+Reference< XBlob > SAL_CALL PropertyValueSet::getBlob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XBlob >, BLOB_VALUE_SET, xBlob );
+}
+
+//=========================================================================
+// virtual
+Reference< XClob > SAL_CALL PropertyValueSet::getClob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XClob >, CLOB_VALUE_SET, xClob );
+}
+
+//=========================================================================
+// virtual
+Reference< XArray > SAL_CALL PropertyValueSet::getArray( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XArray >, ARRAY_VALUE_SET, xArray );
+}
+
+//=========================================================================
+//
+// XColumnLocate methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL PropertyValueSet::findColumn( const OUString& columnName )
+ throw( SQLException, RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( columnName.getLength() )
+ {
+ sal_Int32 nCount = m_pValues->size();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ if ( (*m_pValues)[ n ].aProperty.Name.equals( columnName ) )
+ return sal_Int32( n + 1 ); // Index is 1-based.
+ }
+ }
+ return 0;
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+const Reference< XTypeConverter >& PropertyValueSet::getTypeConverter()
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() )
+ {
+ m_bTriedToGetTypeConverter = sal_True;
+ m_xTypeConverter = Reference< XTypeConverter >(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.script.Converter" ) ),
+ UNO_QUERY );
+
+ VOS_ENSURE( m_xTypeConverter.is(),
+ "PropertyValueSet::getTypeConverter() - "
+ "Service 'com.sun.star.script.Converter' n/a!" );
+ }
+ return m_xTypeConverter;
+}
+
+//=========================================================================
+sal_Int32 PropertyValueSet::getLength() const
+{
+ return m_pValues->size();
+}
+
+//=========================================================================
+void PropertyValueSet::appendString( const Property& rProp,
+ const OUString& rValue )
+{
+ SETVALUE_IMPL( rProp, STRING_VALUE_SET, aString, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBoolean( const Property& rProp,
+ sal_Bool bValue )
+{
+ SETVALUE_IMPL( rProp, BOOLEAN_VALUE_SET, bBoolean, bValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendByte( const Property& rProp,
+ sal_Int8 nValue )
+{
+ SETVALUE_IMPL( rProp, BYTE_VALUE_SET, nByte, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendShort( const Property& rProp,
+ sal_Int16 nValue )
+{
+ SETVALUE_IMPL( rProp, SHORT_VALUE_SET, nShort, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendInt( const Property& rProp,
+ sal_Int32 nValue )
+{
+ SETVALUE_IMPL( rProp, INT_VALUE_SET, nInt, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendLong( const Property& rProp,
+ sal_Int64 nValue )
+{
+ SETVALUE_IMPL( rProp, LONG_VALUE_SET, nLong, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendFloat( const Property& rProp,
+ float nValue )
+{
+ SETVALUE_IMPL( rProp, FLOAT_VALUE_SET, nFloat, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendDouble( const Property& rProp,
+ double nValue )
+{
+ SETVALUE_IMPL( rProp, DOUBLE_VALUE_SET, nDouble, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBytes( const Property& rProp,
+ const Sequence< sal_Int8 >& rValue )
+{
+ SETVALUE_IMPL( rProp, BYTES_VALUE_SET, aBytes, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendDate( const Property& rProp,
+ const Date& rValue )
+{
+ SETVALUE_IMPL( rProp, DATE_VALUE_SET, aDate, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendTime( const Property& rProp,
+ const Time& rValue )
+{
+ SETVALUE_IMPL( rProp, TIME_VALUE_SET, aTime, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendTimestamp( const Property& rProp,
+ const DateTime& rValue )
+{
+ SETVALUE_IMPL( rProp, TIMESTAMP_VALUE_SET, aTimestamp, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBinaryStream(
+ const Property& rProp,
+ const Reference< XInputStream >& rValue )
+{
+ SETVALUE_IMPL( rProp, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendCharacterStream(
+ const Property& rProp,
+ const Reference< XInputStream >& rValue )
+{
+ SETVALUE_IMPL( rProp, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendObject( const Property& rProp,
+ const Any& rValue )
+{
+ SETVALUE_IMPL( rProp, OBJECT_VALUE_SET, aObject, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendRef( const Property& rProp,
+ const Reference< XRef >& rValue )
+{
+ SETVALUE_IMPL( rProp, REF_VALUE_SET, xRef, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBlob( const Property& rProp,
+ const Reference< XBlob >& rValue )
+{
+ SETVALUE_IMPL( rProp, BLOB_VALUE_SET, xBlob, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendClob( const Property& rProp,
+ const Reference< XClob >& rValue )
+{
+ SETVALUE_IMPL( rProp, CLOB_VALUE_SET, xClob, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendArray( const Property& rProp,
+ const Reference< XArray >& rValue )
+{
+ SETVALUE_IMPL( rProp, ARRAY_VALUE_SET, xArray, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendVoid( const Property& rProp )
+{
+ SETVALUE_IMPL( rProp, NO_VALUE_SET, aObject, Any() );
+}
+
+//=========================================================================
+void PropertyValueSet::appendPropertySet(
+ const Reference< XPropertySet >& rxSet )
+{
+ if ( rxSet.is() )
+ {
+ Reference< XPropertySetInfo > xInfo = rxSet->getPropertySetInfo();
+ if ( xInfo.is() )
+ {
+ Sequence< Property > aProps = xInfo->getProperties();
+ const Property* pProps = aProps.getConstArray();
+ sal_Int32 nPropsCount = aProps.getLength();
+
+ Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY );
+ if ( xPropertyAccess.is() )
+ {
+ // Efficient: Get all prop values with one ( remote) call.
+
+ Sequence< ::com::sun::star::beans::PropertyValue > aPropValues
+ = xPropertyAccess->getPropertyValues();
+
+ const ::com::sun::star::beans::PropertyValue* pPropValues
+ = aPropValues.getConstArray();
+
+ sal_Int32 nValuesCount = aPropValues.getLength();
+ for ( sal_Int32 n = 0; n < nValuesCount; ++n )
+ {
+ const ::com::sun::star::beans::PropertyValue& rPropValue
+ = pPropValues[ n ];
+
+ // Find info for current property value.
+ for ( sal_Int32 m = 0; m < nPropsCount; ++m )
+ {
+ const Property& rProp = pProps[ m ];
+ if ( rProp.Name == rPropValue.Name )
+ {
+ // Found!
+ appendObject( rProp, rPropValue.Value );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Get every single prop value with one ( remote) call.
+
+ for ( sal_Int32 n = 0; n < nPropsCount; ++n )
+ {
+ const Property& rProp = pProps[ n ];
+
+ try
+ {
+ Any aValue = rxSet->getPropertyValue( rProp.Name );
+
+ if ( aValue.hasValue() )
+ appendObject( rProp, aValue );
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ }
+ }
+ }
+ }
+}
+
+//=========================================================================
+sal_Bool PropertyValueSet::appendPropertySetValue(
+ const Reference< XPropertySet >& rxSet,
+ const Property& rProperty )
+{
+ if ( rxSet.is() )
+ {
+ try
+ {
+ Any aValue = rxSet->getPropertyValue( rProperty.Name );
+ if ( aValue.hasValue() )
+ {
+ appendObject( rProperty, aValue );
+ return sal_True;
+ }
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ }
+
+ // Error.
+ return sal_False;
+}
+
diff --git a/ucbhelper/source/provider/providerhelper.cxx b/ucbhelper/source/provider/providerhelper.cxx
new file mode 100644
index 000000000000..2d646f2943b8
--- /dev/null
+++ b/ucbhelper/source/provider/providerhelper.cxx
@@ -0,0 +1,614 @@
+/*************************************************************************
+ *
+ * $RCSfile: providerhelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __HASH_MAP__
+#include <stl/hash_map>
+#endif
+#ifndef _OSL_FILE_HXX_
+#include <osl/file.hxx>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
+#include <com/sun/star/container/XNamed.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPROPERTYSETREGISTRYFACTORY_HPP_
+#include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPROPERTYSETREGISTRY_HPP_
+#include <com/sun/star/ucb/XPropertySetRegistry.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_
+#include <com/sun/star/frame/XConfigManager.hpp>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+
+#define PROPSET_REGISTRY_FILE_NAME "dynprops.rdb"
+
+using namespace rtl;
+using namespace com::sun::star::container;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace ucb;
+
+namespace ucb_impl
+{
+
+//=========================================================================
+//
+// Contents.
+//
+//=========================================================================
+
+struct equalString
+{
+ bool operator()( const OUString& rKey11, const OUString& rKey22 ) const
+ {
+ return !!( rKey11 == rKey22 );
+ }
+};
+
+struct hashString
+{
+ size_t operator()( const OUString & rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef std::hash_map
+<
+ OUString,
+ ContentImplHelper*,
+ hashString,
+ equalString
+>
+Contents;
+
+//=========================================================================
+//
+// struct ContentProviderImplHelper_Impl.
+//
+//=========================================================================
+
+struct ContentProviderImplHelper_Impl
+{
+ Reference< XPropertySetRegistry > m_xPropertySetRegistry;
+ Contents m_aContents;
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+//=========================================================================
+//=========================================================================
+//
+// ContentProviderImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentProviderImplHelper::ContentProviderImplHelper(
+ const Reference< XMultiServiceFactory >& rXSMgr )
+: m_xSMgr( rXSMgr ),
+ m_pImpl( new ucb_impl::ContentProviderImplHelper_Impl )
+{
+}
+
+//=========================================================================
+// virtual
+ContentProviderImplHelper::~ContentProviderImplHelper()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_3( ContentProviderImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( ContentProviderImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+// virtual
+OUString SAL_CALL ContentProviderImplHelper::getImplementationName()
+ throw( RuntimeException )
+{
+}
+
+//=========================================================================
+// virtual
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ContentProviderImplHelper::getSupportedServiceNames()
+ throw( RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ContentProviderImplHelper::supportsService(
+ const OUString& ServiceName )
+ throw( RuntimeException )
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString* pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//
+// XContentProvider methods.
+//
+//=========================================================================
+
+/*
+
+ Pure virtual. Must be implemented by derived classes!
+
+// virtual
+Reference< XContent > SAL_CALL ContentProviderImplHelper::queryContent(
+ const Reference< XContentIdentifier >& Identifier )
+ throw( IllegalIdentifierException, RuntimeException )
+{
+}
+
+*/
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ContentProviderImplHelper::compareContentIds(
+ const Reference< XContentIdentifier >& Id1,
+ const Reference< XContentIdentifier >& Id2 )
+ throw( RuntimeException )
+{
+ // Simply do a string compare.
+
+ OUString aURL1( Id1->getContentIdentifier() );
+ OUString aURL2( Id2->getContentIdentifier() );
+
+ return aURL1.compareTo( aURL2 );;
+}
+
+//=========================================================================
+//
+// Non-interface methods
+//
+//=========================================================================
+
+void ContentProviderImplHelper::addContent(
+ ::ucb::ContentImplHelper* pContent )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ const OUString aURL( pContent->getIdentifier()->getContentIdentifier() );
+
+#ifdef _DEBUG
+ Contents::const_iterator it = m_pImpl->m_aContents.find( aURL );
+ VOS_ENSURE( it == m_pImpl->m_aContents.end(),
+ "ContentProviderImplHelper::addContent - Already registered!" );
+#endif
+
+ m_pImpl->m_aContents[ aURL ] = pContent;
+}
+
+//=========================================================================
+void ContentProviderImplHelper::removeContent(
+ ::ucb::ContentImplHelper* pContent )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ const OUString aURL( pContent->getIdentifier()->getContentIdentifier() );
+ removeContent( aURL );
+}
+
+//=========================================================================
+void ContentProviderImplHelper::removeContent( const OUString& rURL )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ Contents::iterator it = m_pImpl->m_aContents.find( rURL );
+
+// VOS_ENSURE( it != m_pImpl->m_aContents.end(),
+// "ContentProviderImplHelper::removeContent - Not registered!" );
+
+ if ( it != m_pImpl->m_aContents.end() )
+ m_pImpl->m_aContents.erase( it );
+}
+
+//=========================================================================
+vos::ORef< ContentImplHelper >
+ContentProviderImplHelper::queryExistingContent(
+ const Reference< XContentIdentifier >& Identifier )
+{
+ return queryExistingContent( Identifier->getContentIdentifier() );
+}
+
+//=========================================================================
+vos::ORef< ContentImplHelper >
+ContentProviderImplHelper::queryExistingContent( const OUString& rURL )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ // Check, if a content with given id already exists...
+
+ Contents::const_iterator it = m_pImpl->m_aContents.find( rURL );
+ if ( it != m_pImpl->m_aContents.end() )
+ {
+ // Already there. Return it.
+ return vos::ORef< ContentImplHelper >( (*it).second );
+ }
+
+ return vos::ORef< ContentImplHelper >();
+}
+
+//=========================================================================
+void ContentProviderImplHelper::queryExistingContents(
+ ContentRefList& rContents )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ Contents::const_iterator it = m_pImpl->m_aContents.begin();
+ Contents::const_iterator end = m_pImpl->m_aContents.end();
+
+ while ( it != end )
+ {
+ rContents.push_back( ContentImplHelperRef( (*it).second ) );
+ ++it;
+ }
+}
+
+//=========================================================================
+Reference< XPropertySetRegistry >
+ContentProviderImplHelper::getAdditionalPropertySetRegistry()
+{
+ // Get propertyset registry.
+
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ Reference< XPropertySetRegistryFactory > xRegFac(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.ucb.Store" ) ),
+ UNO_QUERY );
+
+ VOS_ENSURE( xRegFac.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "No UCB-Store service!" );
+
+ Reference< XSimpleRegistry > xCfgReg(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.config.SpecialConfigManager" ) ),
+ UNO_QUERY );
+
+ VOS_ENSURE( xCfgReg.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "No ConfigManager service!" );
+
+ Reference< XConfigManager > xCfgMgr;
+ if ( xCfgReg.is() )
+ xCfgMgr = Reference< XConfigManager >( xCfgReg, UNO_QUERY );
+
+ VOS_ENSURE( xCfgMgr.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "No XConfigManager!" );
+
+ if ( xRegFac.is() && xCfgReg.is() && xCfgMgr.is() )
+ {
+ OUString aRegURL;
+
+ try
+ {
+ Reference< XRegistryKey > xRegistryKey( xCfgReg->getRootKey() );
+ if ( xRegistryKey.is() )
+ xRegistryKey = xRegistryKey->openKey(
+ OUString::createFromAscii( "Directories/Storage-Dir") );
+
+ if ( xRegistryKey.is() )
+ aRegURL = xRegistryKey->getStringValue();
+ }
+ catch ( InvalidRegistryException& )
+ {
+ }
+
+ aRegURL = xCfgMgr->substituteVariables( aRegURL );
+
+ VOS_ENSURE( aRegURL.getLength(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "Unable to get Store-directory!" );
+
+ if ( aRegURL.getLength() )
+ {
+ // Convert path to a URL.
+ OUString aUNCPath;
+ osl::FileBase::RC
+ eErr = osl::FileBase::normalizePath( aRegURL, aUNCPath );
+
+ if ( eErr == osl::FileBase::E_None )
+ {
+ eErr = osl::FileBase::getFileURLFromNormalizedPath(
+ aUNCPath, aRegURL );
+ if ( eErr == osl::FileBase::E_None )
+ {
+ OUString aLastChar(
+ aRegURL.copy( aRegURL.getLength() - 1 ) );
+ OUString aTmpOWStr = OUString::createFromAscii ( "/" );
+ if ( aLastChar != aTmpOWStr )
+ aRegURL += aTmpOWStr;
+
+ aRegURL += OUString::createFromAscii(
+ PROPSET_REGISTRY_FILE_NAME );
+
+ // Open/create a registry.
+ m_pImpl->m_xPropertySetRegistry
+ = xRegFac->createPropertySetRegistry( aRegURL );
+ }
+ }
+
+ VOS_ENSURE( m_pImpl->m_xPropertySetRegistry.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "Error opening registry!" );
+ }
+ }
+ }
+
+ return m_pImpl->m_xPropertySetRegistry;
+}
+
+
+//=========================================================================
+Reference< XPersistentPropertySet >
+ContentProviderImplHelper::getAdditionalPropertySet( const OUString& rKey,
+ sal_Bool bCreate )
+{
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ // Open/create persistent property set.
+ return Reference< XPersistentPropertySet >(
+ m_pImpl->m_xPropertySetRegistry->openPropertySet(
+ rKey, bCreate ) );
+ }
+
+ return Reference< XPersistentPropertySet >();
+}
+
+//=========================================================================
+sal_Bool ContentProviderImplHelper::renameAdditionalPropertySet(
+ const OUString& rOldKey,
+ const OUString& rNewKey,
+ sal_Bool bRecursive )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( bRecursive )
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ Reference< XNameAccess > xNameAccess(
+ m_pImpl->m_xPropertySetRegistry, UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ Sequence< OUString > aKeys = xNameAccess->getElementNames();
+ sal_Int32 nCount = aKeys.getLength();
+ if ( nCount > 0 )
+ {
+ const OUString* pKeys = aKeys.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rKey = pKeys[ n ];
+ if ( rKey.compareTo(
+ rOldKey, rOldKey.getLength() ) == 0 )
+ {
+ OUString aNewKey
+ = rKey.replaceAt(
+ 0, rOldKey.getLength(), rNewKey );
+ if ( !renameAdditionalPropertySet(
+ rKey, aNewKey, sal_False ) )
+ return sal_False;
+ }
+ }
+ }
+ }
+ else
+ return sal_False;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
+ // Get old property set, if exists.
+ Reference< XPersistentPropertySet > xOldSet
+ = getAdditionalPropertySet( rOldKey, sal_False );
+ if ( xOldSet.is() )
+ {
+ // Rename property set.
+ Reference< XNamed > xNamed( xOldSet, UNO_QUERY );
+ if ( xNamed.is() )
+ {
+ // ??? throws no exceptions and has no return value ???
+ xNamed->setName( rNewKey );
+ }
+ else
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool ContentProviderImplHelper::removeAdditionalPropertySet(
+ const OUString& rKey,
+ sal_Bool bRecursive )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ if ( bRecursive )
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ Reference< XNameAccess > xNameAccess(
+ m_pImpl->m_xPropertySetRegistry, UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ Sequence< OUString > aKeys = xNameAccess->getElementNames();
+ sal_Int32 nCount = aKeys.getLength();
+ if ( nCount > 0 )
+ {
+ const OUString* pKeys = aKeys.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rCurrKey = pKeys[ n ];
+ if ( rCurrKey.compareTo( rKey, rKey.getLength() ) == 0 )
+ {
+ if ( !removeAdditionalPropertySet(
+ rCurrKey, sal_False ) )
+ return sal_False;
+ }
+ }
+ }
+ }
+ else
+ return sal_False;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ m_pImpl->m_xPropertySetRegistry->removePropertySet( rKey );
+ else
+ return sal_False;
+ }
+ return sal_True;
+}
+
diff --git a/ucbhelper/source/provider/registerucb.cxx b/ucbhelper/source/provider/registerucb.cxx
new file mode 100644
index 000000000000..a86aa199427e
--- /dev/null
+++ b/ucbhelper/source/provider/registerucb.cxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * $RCSfile: registerucb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_REGISTERUCB_HXX_
+#include <ucbhelper/registerucb.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_CONTENTPROVIDERSERVICEINFO2_HPP_
+#include <com/sun/star/ucb/ContentProviderServiceInfo2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERMANAGER_HPP_
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPARAMETERIZEDCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDERFACTORY_HPP_
+#include <com/sun/star/ucb/XContentProviderFactory.hpp>
+#endif
+
+using namespace com::sun;
+using namespace com::sun::star;
+
+//============================================================================
+//
+// registerAtUcb
+//
+//============================================================================
+
+namespace ucb {
+
+void
+registerAtUcb(
+ uno::Reference< star::ucb::XContentProviderManager > const & rUcb,
+ uno::Reference< lang::XMultiServiceFactory > const & rFactory,
+ uno::Sequence< star::ucb::ContentProviderServiceInfo2 > const &
+ rProviders,
+ std::vector< ContentProviderRegistrationInfo > * pResults)
+ throw (uno::RuntimeException)
+{
+ uno::Reference< star::ucb::XContentProviderFactory > xFac;
+ try
+ {
+ xFac = uno::Reference< star::ucb::XContentProviderFactory >(
+ rFactory->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.ucb.ContentProviderProxyFactory")),
+ uno::UNO_QUERY);
+ }
+ catch (uno::RuntimeException const &) { throw; }
+ catch (uno::Exception const &) {}
+
+ star::ucb::ContentProviderServiceInfo2 const * pInfo
+ = rProviders.getConstArray();
+ for (sal_Int32 n = rProviders.getLength(); n > 0; --n)
+ {
+ uno::Reference< star::ucb::XContentProvider > xProvider;
+ if (xFac.is())
+ {
+ // Try to instantiate proxy for provider.
+ xProvider = xFac->createContentProvider(pInfo->Service);
+ }
+
+ if (!xProvider.is())
+ {
+ // Try to instantiate provider directly.
+ try
+ {
+ xProvider = uno::Reference< star::ucb::XContentProvider >(
+ rFactory->createInstance(pInfo->Service),
+ uno::UNO_QUERY);
+ }
+ catch (uno::RuntimeException const &) { throw; }
+ catch (uno::Exception const &) {}
+ }
+
+ uno::Reference< star::ucb::XContentProvider >
+ xOriginalProvider(xProvider);
+ uno::Reference< star::ucb::XParameterizedContentProvider >
+ xParameterized(xProvider, uno::UNO_QUERY);
+ if (xParameterized.is())
+ {
+ uno::Reference< star::ucb::XContentProvider > xInstance;
+ try
+ {
+ xInstance
+ = xParameterized->registerInstance(pInfo->Scheme,
+ pInfo->Arguments,
+ pInfo->
+ ReplaceExisting);
+ //@@@ if this call replaces an old instance, the commit-
+ // or-rollback code below will not work
+ }
+ catch (lang::IllegalArgumentException const &) {}
+
+ if (xInstance.is())
+ xProvider = xInstance;
+ }
+
+ if (rUcb.is() && xProvider.is())
+ try
+ {
+ rUcb->registerContentProvider(xProvider, pInfo->Scheme,
+ pInfo->ReplaceExisting);
+ }
+ catch (star::ucb::DuplicateProviderException const &)
+ {
+ if (xParameterized.is())
+ try
+ {
+ xParameterized->deregisterInstance(pInfo->Scheme,
+ pInfo->Arguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+ xOriginalProvider = 0;
+ }
+ catch (...)
+ {
+ if (xParameterized.is())
+ try
+ {
+ xParameterized->deregisterInstance(pInfo->Scheme,
+ pInfo->Arguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+ throw;
+ }
+
+ if (pResults)
+ pResults->
+ push_back(ContentProviderRegistrationInfo(xOriginalProvider,
+ pInfo->Arguments,
+ pInfo->Scheme));
+
+ ++pInfo;
+ }
+}
+
+//============================================================================
+//
+// deregisterFromUcb
+//
+//============================================================================
+
+void
+deregisterFromUcb(
+ uno::Reference< star::ucb::XContentProviderManager > const & rUcb,
+ std::vector< ContentProviderRegistrationInfo > const & rProviders)
+ throw (uno::RuntimeException)
+{
+ std::vector< ContentProviderRegistrationInfo >::const_iterator
+ aEnd(rProviders.end());
+ for (std::vector< ContentProviderRegistrationInfo >::const_iterator
+ aIt(rProviders.begin());
+ aIt != aEnd; ++aIt)
+ {
+ uno::Reference< star::ucb::XContentProvider >
+ xProvider(aIt->m_xProvider);
+ if (xProvider.is())
+ {
+ uno::Reference< star::ucb::XParameterizedContentProvider >
+ xParameterized(xProvider, uno::UNO_QUERY);
+ if (xParameterized.is())
+ {
+ uno::Reference< star::ucb::XContentProvider > xInstance;
+ try
+ {
+ xInstance
+ = xParameterized->
+ deregisterInstance(aIt->m_aTemplate,
+ aIt->m_aArguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+
+ if (xInstance.is())
+ xProvider = xInstance;
+ }
+
+ if (rUcb.is() && xProvider.is())
+ rUcb->deregisterContentProvider(xProvider, aIt->m_aTemplate);
+ //@@@ if this fails, a roll-back of deregisterInstance()
+ // is missing
+ }
+ }
+}
+
+}
+
diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx
new file mode 100644
index 000000000000..38fba0cd09b4
--- /dev/null
+++ b/ucbhelper/source/provider/resultset.cxx
@@ -0,0 +1,1706 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __HASH_MAP__
+#include <stl/hash_map>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _UCBHELPER_RESULTSET_HXX
+#include <ucbhelper/resultset.hxx>
+#endif
+#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
+#include <ucbhelper/resultsetmetadata.hxx>
+#endif
+
+using namespace cppu;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+using namespace ucb;
+
+//=========================================================================
+
+namespace ucb_impl
+{
+
+struct PropertyInfo
+{
+ const char* pName;
+ sal_Int32 nHandle;
+ sal_Int16 nAttributes;
+ const com::sun::star::uno::Type& (*pGetCppuType)();
+};
+
+static const com::sun::star::uno::Type& sal_uInt32_getCppuType()
+{
+ // ! uInt -> Int, because of Java !!!
+ return getCppuType( static_cast< const sal_Int32 * >( 0 ) );
+}
+
+static const com::sun::star::uno::Type& sal_Bool_getCppuType()
+{
+ return getCppuBooleanType();
+}
+
+static PropertyInfo aPropertyTable[] =
+{
+ { "IsRowCountFinal",
+ 1000,
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY,
+ &sal_Bool_getCppuType
+ },
+ { "RowCount",
+ 1001,
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY,
+ &sal_uInt32_getCppuType
+ },
+ { 0,
+ 0,
+ 0,
+ 0
+ }
+};
+
+#define RESULTSET_PROPERTY_COUNT 2
+
+//=========================================================================
+//
+// class PropertySetInfo
+//
+//=========================================================================
+
+class PropertySetInfo :
+ public OWeakObject, public XTypeProvider, public XPropertySetInfo
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Sequence< Property >* m_pProps;
+
+private:
+ sal_Bool queryProperty( const rtl::OUString& aName, Property& rProp );
+
+public:
+ PropertySetInfo( const Reference< XMultiServiceFactory >& rxSMgr,
+ const PropertyInfo* pProps,
+ sal_uInt32 nProps );
+ virtual ~PropertySetInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XPropertySetInfo
+ virtual Sequence< Property > SAL_CALL getProperties()
+ throw( RuntimeException );
+ virtual Property SAL_CALL getPropertyByName( const rtl::OUString& aName )
+ throw( UnknownPropertyException, RuntimeException );
+ virtual sal_Bool SAL_CALL hasPropertyByName( const rtl::OUString& Name )
+ throw( RuntimeException );
+};
+
+//=========================================================================
+//
+// PropertyChangeListenerContainer.
+//
+//=========================================================================
+
+struct equalStr_Impl
+{
+ bool operator()( const OUString& s1, const OUString& s2 ) const
+ {
+ return !!( s1 == s2 );
+ }
+};
+
+struct hashStr_Impl
+{
+ size_t operator()( const OUString& rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef OMultiTypeInterfaceContainerHelperVar
+<
+ OUString,
+ hashStr_Impl,
+ equalStr_Impl
+> PropertyChangeListenerContainer;
+
+//=========================================================================
+//
+// class PropertyChangeListeners.
+//
+//=========================================================================
+
+class PropertyChangeListeners : public PropertyChangeListenerContainer
+{
+public:
+ PropertyChangeListeners( osl::Mutex& rMutex )
+ : PropertyChangeListenerContainer( rMutex ) {}
+};
+
+} // namespace ucb_impl
+
+using namespace ucb_impl;
+
+namespace ucb
+{
+
+//=========================================================================
+//
+// struct ResultSet_Impl.
+//
+//=========================================================================
+
+struct ResultSet_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XPropertySetInfo > m_xPropSetInfo;
+ Reference< XResultSetMetaData > m_xMetaData;
+ Sequence< Property > m_aProperties;
+ vos::ORef< ResultSetDataSupplier > m_xDataSupplier;
+ osl::Mutex m_aMutex;
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ PropertyChangeListeners* m_pPropertyChangeListeners;
+ sal_Int32 m_nPos;
+ sal_Bool m_bWasNull;
+ sal_Bool m_bAfterLast;
+
+ inline ResultSet_Impl( const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProperties,
+ const vos::ORef<
+ ResultSetDataSupplier >& rDataSupplier );
+ inline ~ResultSet_Impl();
+};
+
+} // namespace ucb
+
+inline ResultSet_Impl::ResultSet_Impl(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProperties,
+ const vos::ORef< ResultSetDataSupplier >& rDataSupplier )
+: m_xSMgr( rxSMgr ),
+ m_aProperties( rProperties ),
+ m_xDataSupplier( rDataSupplier ),
+ m_pDisposeEventListeners( 0 ),
+ m_pPropertyChangeListeners( 0 ),
+ m_nPos( 0 ), // Position is one-based. Zero means: before first element.
+ m_bWasNull( sal_False ),
+ m_bAfterLast( sal_False )
+{
+}
+
+//=========================================================================
+inline ResultSet_Impl::~ResultSet_Impl()
+{
+ delete m_pDisposeEventListeners;
+ delete m_pPropertyChangeListeners;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ResultSet::ResultSet( const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProperties,
+ const vos::ORef< ResultSetDataSupplier >& rDataSupplier )
+: m_pImpl( new ResultSet_Impl( rxSMgr, rProperties, rDataSupplier ) )
+{
+ rDataSupplier->m_pResultSet = this;
+}
+
+//=========================================================================
+// virtual
+ResultSet::~ResultSet()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_9( ResultSet,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContentAccess,
+ XResultSet,
+ XResultSetMetaDataSupplier,
+ XRow,
+ XCloseable,
+ XPropertySet );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_9( ResultSet,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent,
+ XContentAccess,
+ XResultSet,
+ XResultSetMetaDataSupplier,
+ XRow,
+ XCloseable,
+ XPropertySet );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+XSERVICEINFO_NOFACTORY_IMPL_1( ResultSet,
+ OUString::createFromAscii( "ResultSet" ),
+ OUString::createFromAscii( RESULTSET_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSet::dispose()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners &&
+ m_pImpl->m_pDisposeEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XComponent * >( this );
+ m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XPropertySet * >( this );
+ m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
+ }
+
+ m_pImpl->m_xDataSupplier->close();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners =
+ new OInterfaceContainerHelper( m_pImpl->m_aMutex );
+
+ m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removeEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XResultSetMetaDataSupplier methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XResultSetMetaData > SAL_CALL ResultSet::getMetaData()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_xMetaData.is() )
+ m_pImpl->m_xMetaData = new ResultSetMetaData( m_pImpl->m_xSMgr,
+ m_pImpl->m_aProperties );
+
+ return m_pImpl->m_xMetaData;
+}
+
+//=========================================================================
+//
+// XResultSet methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ResultSet::next()
+ throw( SQLException, RuntimeException )
+{
+ // Note: Cursor is initially positioned before the first row.
+ // First call to 'next()' moves it to first row.
+
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ // getResult works zero-based!
+ if ( !m_pImpl->m_xDataSupplier->getResult( m_pImpl->m_nPos ) )
+ {
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_nPos++;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isBeforeFirst()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ // getResult works zero-based!
+ if ( !m_pImpl->m_xDataSupplier->getResult( 0 ) )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == 0 );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isAfterLast()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_bAfterLast;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isFirst()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == 1 );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isLast()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( !nCount )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == nCount );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::beforeFirst()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::afterLast()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::first()
+ throw( SQLException, RuntimeException )
+{
+ // getResult works zero-based!
+ if ( m_pImpl->m_xDataSupplier->getResult( 0 ) )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 1;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::last()
+ throw( SQLException, RuntimeException )
+{
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = nCount;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSet::getRow()
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_nPos;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
+ throw( SQLException, RuntimeException )
+{
+/*
+ If the row number is positive, the cursor moves to the given row number
+ with respect to the beginning of the result set. The first row is row 1,
+ the second is row 2, and so on.
+
+ If the given row number is negative, the cursor moves to an absolute row
+ position with respect to the end of the result set. For example, calling
+ absolaute( -1 ) positions the cursor on the last row, absolaute( -2 )
+ indicates the next-to-last row, and so on.
+
+ An attempt to position the cursor beyond the first/last row in the result
+ set leaves the cursor before/after the first/last row, respectively.
+
+ Calling absolute( 1 ) is the same as calling first().
+
+ Calling absolute( -1 ) is the same as calling last().
+*/
+ if ( row < 0 )
+ {
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+
+ if ( ( row * -1 ) > nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ else // |row| <= nCount
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( nCount + row + 1 );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ }
+ else if ( row == 0 )
+ {
+ // @throws SQLException
+ // ... if row is 0 ...
+ throw SQLException();
+ }
+ else // row > 0
+ {
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+
+ if ( row <= nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = row;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else // row > nCount
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+
+ // unreachable...
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
+ throw( SQLException, RuntimeException )
+{
+/*
+ Attempting to move beyond the first/last row in the result set
+ positions the cursor before/after the the first/last row.
+
+ Calling relative( 0 ) is valid, but does not change the cursor position.
+
+ Calling relative( 1 ) is different from calling next() because it makes
+ sense to call next() when there is no current row, for example, when
+ the cursor is positioned before the first row or after the last row of
+ the result set.
+*/
+ if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
+ {
+ // "No current row".
+ throw SQLException();
+ }
+
+ if ( rows < 0 )
+ {
+ if ( ( m_pImpl->m_nPos + rows ) > 0 )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+ else if ( rows == 0 )
+ {
+ // nop.
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else // rows > 0
+ {
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( ( m_pImpl->m_nPos + rows ) <= nCount )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else
+ {
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+
+ // unreachable...
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::previous()
+ throw( SQLException, RuntimeException )
+{
+/*
+ previous() is not the same as relative( -1 ) because it makes sense
+ to call previous() when there is no current row.
+*/
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_bAfterLast = sal_False;
+ sal_uInt32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ m_pImpl->m_nPos = nCount;
+ }
+ else if ( m_pImpl->m_nPos )
+ m_pImpl->m_nPos--;
+
+ if ( m_pImpl->m_nPos )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::refreshRow()
+ throw( SQLException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
+ return;
+
+ m_pImpl->m_xDataSupplier->releasePropertyValues( m_pImpl->m_nPos );
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowUpdated()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowInserted()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowDeleted()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+Reference< XInterface > SAL_CALL ResultSet::getStatement()
+ throw( SQLException, RuntimeException )
+{
+/*
+ returns the Statement that produced this ResultSet object. If the
+ result set was generated some other way, ... this method returns null.
+*/
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XInterface >();
+}
+
+//=========================================================================
+//
+// XRow methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ResultSet::wasNull()
+ throw( SQLException, RuntimeException )
+{
+ // This method can not be implemented correctly!!! Imagine different
+ // threads doing a getXYZ - wasNull calling sequence on the same
+ // implementation object...
+
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->wasNull();
+ }
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_bWasNull;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSet::getString( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getString( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBoolean( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getByte( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getShort( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getInt( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getLong( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getFloat( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+double SAL_CALL ResultSet::getDouble( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getDouble( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+ResultSet::getBytes( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBytes( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Sequence< sal_Int8 >();
+}
+
+//=========================================================================
+// virtual
+Date SAL_CALL ResultSet::getDate( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getDate( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Date();
+}
+
+//=========================================================================
+// virtual
+Time SAL_CALL ResultSet::getTime( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getTime( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Time();
+}
+
+//=========================================================================
+// virtual
+com::sun::star::util::DateTime SAL_CALL
+ResultSet::getTimestamp( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getTimestamp( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return com::sun::star::util::DateTime();
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+ResultSet::getBinaryStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBinaryStream( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XInputStream >();
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+ResultSet::getCharacterStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getCharacterStream( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XInputStream >();
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL ResultSet::getObject( sal_Int32 columnIndex,
+ const Reference< XNameAccess >& typeMap )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getObject( columnIndex, typeMap );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Any();
+}
+
+//=========================================================================
+// virtual
+Reference< XRef > SAL_CALL ResultSet::getRef( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getRef( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XRef >();
+}
+
+//=========================================================================
+// virtual
+Reference< XBlob > SAL_CALL ResultSet::getBlob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBlob( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XBlob >();
+}
+
+//=========================================================================
+// virtual
+Reference< XClob > SAL_CALL ResultSet::getClob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getClob( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XClob >();
+}
+
+//=========================================================================
+// virtual
+Reference< XArray > SAL_CALL ResultSet::getArray( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ Reference< XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getArray( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return Reference< XArray >();
+}
+
+//=========================================================================
+//
+// XCloseable methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSet::close()
+ throw( SQLException, RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->close();
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+//
+// XContentAccess methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL ResultSet::queryContentIdentfierString()
+ throw( RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContentIdentifierString(
+ m_pImpl->m_nPos - 1 );
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+Reference< XContentIdentifier > SAL_CALL ResultSet::queryContentIdentifier()
+ throw( RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContentIdentifier(
+ m_pImpl->m_nPos - 1 );
+
+ return Reference< XContentIdentifier >();
+}
+
+//=========================================================================
+// virtual
+Reference< XContent > SAL_CALL ResultSet::queryContent()
+ throw( RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContent( m_pImpl->m_nPos - 1 );
+
+ return Reference< XContent >();
+}
+
+//=========================================================================
+//
+// XPropertySet methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XPropertySetInfo > SAL_CALL ResultSet::getPropertySetInfo()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_xPropSetInfo.is() )
+ m_pImpl->m_xPropSetInfo
+ = new PropertySetInfo( m_pImpl->m_xSMgr,
+ aPropertyTable,
+ RESULTSET_PROPERTY_COUNT );
+ return m_pImpl->m_xPropSetInfo;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::setPropertyValue( const OUString& aPropertyName,
+ const Any& aValue )
+ throw( UnknownPropertyException,
+ PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ if ( !aPropertyName.getLength() )
+ throw UnknownPropertyException();
+
+ if ( aPropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) )
+ {
+ // property is read-only.
+ throw IllegalArgumentException();
+ }
+ else if ( aPropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ {
+ // property is read-only.
+ throw IllegalArgumentException();
+ }
+ else
+ {
+ throw UnknownPropertyException();
+ }
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL ResultSet::getPropertyValue( const OUString& PropertyName )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ if ( !PropertyName.getLength() )
+ throw UnknownPropertyException();
+
+ Any aValue;
+
+ if ( PropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) )
+ {
+ aValue <<= m_pImpl->m_xDataSupplier->currentCount();
+ }
+ else if ( PropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ {
+ aValue <<= m_pImpl->m_xDataSupplier->isCountFinal();
+ }
+ else
+ {
+ throw UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addPropertyChangeListener(
+ const OUString& aPropertyName,
+ const Reference< XPropertyChangeListener >& xListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ // Note: An empty property name means a listener for "all" properties.
+
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( aPropertyName.getLength() &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ throw UnknownPropertyException();
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners
+ = new PropertyChangeListeners( m_pImpl->m_aMutex );
+
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ aPropertyName, xListener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removePropertyChangeListener(
+ const OUString& aPropertyName,
+ const Reference< XPropertyChangeListener >& xListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( aPropertyName.getLength() &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "RowCount" ) ) &&
+ !aPropertyName.equals(
+ OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ throw UnknownPropertyException();
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ aPropertyName, xListener );
+
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addVetoableChangeListener(
+ const OUString& PropertyName,
+ const Reference< XVetoableChangeListener >& aListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ // No constrained props. at the moment.
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removeVetoableChangeListener(
+ const OUString& PropertyName,
+ const Reference< XVetoableChangeListener >& aListener )
+ throw( UnknownPropertyException,
+ WrappedTargetException,
+ RuntimeException )
+{
+ // No constrained props. at the moment.
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void ResultSet::propertyChanged( const PropertyChangeEvent& rEvt )
+{
+// osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ // Notify listeners interested especially in the changed property.
+ OInterfaceContainerHelper* pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer(
+ rEvt.PropertyName );
+ if ( pPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ Reference< XPropertyChangeListener > xListener(
+ aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertyChange( rEvt );
+ }
+ }
+
+ // Notify listeners interested in all properties.
+ pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( OUString() );
+ if ( pPropsContainer )
+ {
+ OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ Reference< XPropertyChangeListener > xListener(
+ aIter.next(), UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertyChange( rEvt );
+ }
+ }
+}
+
+//=========================================================================
+void ResultSet::rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew )
+{
+ VOS_ENSURE( nOld < nNew, "ResultSet::rowCountChanged - nOld >= nNew!" );
+
+// osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ propertyChanged(
+ PropertyChangeEvent( static_cast< OWeakObject * >( this ),
+ OUString::createFromAscii( "RowCount" ),
+ sal_False,
+ 1001,
+ makeAny( nOld ), // old value
+ makeAny( nNew ) ) ); // new value
+}
+
+//=========================================================================
+void ResultSet::rowCountFinal()
+{
+// osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ propertyChanged(
+ PropertyChangeEvent( static_cast< OWeakObject * >( this ),
+ OUString::createFromAscii( "IsRowCountFinal" ),
+ sal_False,
+ 1000,
+ makeAny( sal_False ), // old value
+ makeAny( sal_True ) ) ); // new value
+}
+
+//=========================================================================
+const Sequence< Property >& ResultSet::getProperties()
+{
+ return m_pImpl->m_aProperties;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// PropertySetInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+PropertySetInfo::PropertySetInfo(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const PropertyInfo* pProps,
+ sal_uInt32 nProps )
+: m_xSMgr( rxSMgr )
+{
+ m_pProps = new Sequence< Property >( nProps );
+
+ if ( nProps )
+ {
+ const PropertyInfo* pEntry = pProps;
+ Property* pProperties = m_pProps->getArray();
+
+ for ( sal_uInt32 n = 0; n < nProps; ++n )
+ {
+ Property& rProp = pProperties[ n ];
+
+ rProp.Name = rtl::OUString::createFromAscii( pEntry->pName );
+ rProp.Handle = pEntry->nHandle;
+ rProp.Type = pEntry->pGetCppuType();
+ rProp.Attributes = pEntry->nAttributes;
+
+ pEntry++;
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+PropertySetInfo::~PropertySetInfo()
+{
+ delete m_pProps;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( PropertySetInfo,
+ XTypeProvider,
+ XPropertySetInfo );
+
+//=========================================================================
+//
+// XPropertySetInfo methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< Property > SAL_CALL PropertySetInfo::getProperties()
+ throw( RuntimeException )
+{
+ return Sequence< Property >( *m_pProps );
+}
+
+//=========================================================================
+// virtual
+Property SAL_CALL PropertySetInfo::getPropertyByName( const OUString& aName )
+ throw( UnknownPropertyException, RuntimeException )
+{
+ Property aProp;
+ if ( queryProperty( aName, aProp ) )
+ return aProp;
+
+ throw UnknownPropertyException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName( const OUString& Name )
+ throw( RuntimeException )
+{
+ Property aProp;
+ return queryProperty( Name, aProp );
+}
+
+//=========================================================================
+sal_Bool PropertySetInfo::queryProperty(
+ const OUString& aName, Property& rProp )
+{
+ sal_uInt32 nCount = m_pProps->getLength();
+ const Property* pProps = m_pProps->getConstArray();
+ for ( sal_uInt32 n = 0; n < nCount; ++n )
+ {
+ const Property& rCurr = pProps[ n ];
+ if ( rCurr.Name == aName )
+ {
+ rProp = rCurr;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
diff --git a/ucbhelper/source/provider/resultsethelper.cxx b/ucbhelper/source/provider/resultsethelper.cxx
new file mode 100644
index 000000000000..eaaad700aaa5
--- /dev/null
+++ b/ucbhelper/source/provider/resultsethelper.cxx
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsethelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - This implementation is far away from completion. It has no interface
+ for changes notifications etc.
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_UCB_LISTACTIONTYPE_HPP_
+#include <com/sun/star/ucb/ListActionType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_WELCOMEDYNAMICRESULTSETSTRUCT_HPP_
+#include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCACHEDDYNAMICRESULTSETSTUBFACTORY_HPP_
+#include <com/sun/star/ucb/XCachedDynamicResultSetStubFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XSOURCEINITIALIZATION_HPP_
+#include <com/sun/star/ucb/XSourceInitialization.hpp>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#ifndef _UCBHELPER_RESULTSETHELPER_HXX
+#include <ucbhelper/resultsethelper.hxx>
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace cppu;
+using namespace rtl;
+using namespace ucb;
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSetImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+#define RESULTSETHELPER_INIT() \
+ m_xSMgr( rxSMgr ), \
+ m_pDisposeEventListeners( 0 ), \
+ m_bInitDone( sal_False ), \
+ m_bStatic( sal_False )
+
+//=========================================================================
+ResultSetImplHelper::ResultSetImplHelper(
+ const Reference< XMultiServiceFactory >& rxSMgr )
+: RESULTSETHELPER_INIT()
+{
+}
+
+//=========================================================================
+ResultSetImplHelper::ResultSetImplHelper(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const OpenCommandArgument2& rCommand )
+: RESULTSETHELPER_INIT(),
+ m_aCommand( rCommand )
+{
+}
+
+//=========================================================================
+// virtual
+ResultSetImplHelper::~ResultSetImplHelper()
+{
+ delete m_pDisposeEventListeners;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_4( ResultSetImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XComponent, /* base of XDynamicResultSet */
+ XDynamicResultSet );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( ResultSetImplHelper,
+ XTypeProvider,
+ XServiceInfo,
+ XDynamicResultSet );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+XSERVICEINFO_NOFACTORY_IMPL_1( ResultSetImplHelper,
+ OUString::createFromAscii( "ResultSetImplHelper" ),
+ OUString::createFromAscii( DYNAMICRESULTSET_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSetImplHelper::dispose()
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
+ {
+ EventObject aEvt;
+ aEvt.Source = static_cast< XComponent * >( this );
+ m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::addEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_pDisposeEventListeners )
+ m_pDisposeEventListeners = new OInterfaceContainerHelper( m_aMutex );
+
+ m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::removeEventListener(
+ const Reference< XEventListener >& Listener )
+ throw( RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_pDisposeEventListeners )
+ m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XDynamicResultSet methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XResultSet > SAL_CALL ResultSetImplHelper::getStaticResultSet()
+ throw( ListenerAlreadySetException, RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_xListener.is() )
+ throw ListenerAlreadySetException();
+
+ init( sal_True );
+ return m_xResultSet1;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::setListener(
+ const Reference< XDynamicResultSetListener >& Listener )
+ throw( ListenerAlreadySetException, RuntimeException )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_bStatic || m_xListener.is() )
+ throw ListenerAlreadySetException();
+
+ m_xListener = Listener;
+
+ //////////////////////////////////////////////////////////////////////
+ // Create "welcome event" and send it to listener.
+ //////////////////////////////////////////////////////////////////////
+
+ // Note: We only have the implementation for a static result set at the
+ // moment (src590). The dynamic result sets passed to the listener
+ // are a fake. This implementation will never call "notify" at the
+ // listener to propagate any changes!!!
+
+ init( sal_False );
+
+ Any aInfo;
+ aInfo <<= WelcomeDynamicResultSetStruct( m_xResultSet1 /* "old" */,
+ m_xResultSet2 /* "new" */ );
+
+ Sequence< ListAction > aActions( 1 );
+ aActions.getArray()[ 0 ] = ListAction( 0, // Position; not used
+ 0, // Count; not used
+ ListActionType::WELCOME,
+ aInfo );
+ aGuard.clear();
+
+ Listener->notify(
+ ListEvent( static_cast< OWeakObject * >( this ), aActions ) );
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL ResultSetImplHelper::getCapabilities()
+ throw( RuntimeException )
+{
+ // ! ContentResultSetCapability::SORTED
+ return 0;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::connectToCache(
+ const Reference< XDynamicResultSet > & xCache )
+ throw( ListenerAlreadySetException,
+ AlreadyInitializedException,
+ ServiceNotFoundException,
+ RuntimeException )
+{
+ if ( m_xListener.is() )
+ throw ListenerAlreadySetException();
+
+ if ( m_bStatic )
+ throw ListenerAlreadySetException();
+
+ Reference< XSourceInitialization > xTarget( xCache, UNO_QUERY );
+ if ( xTarget.is() )
+ {
+ Reference< XCachedDynamicResultSetStubFactory > xStubFactory(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.CachedDynamicResultSetStubFactory" ) ),
+ UNO_QUERY );
+ if ( xStubFactory.is() )
+ {
+ xStubFactory->connectToCache(
+ this, xCache, m_aCommand.SortingInfo, 0 );
+ return;
+ }
+ }
+ throw ServiceNotFoundException();
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void ResultSetImplHelper::init( sal_Bool bStatic )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( !m_bInitDone )
+ {
+ if ( bStatic )
+ {
+ // virtual... derived class fills m_xResultSet1
+ initStatic();
+
+ VOS_ENSURE( m_xResultSet1.is(),
+ "ResultSetImplHelper::init - No 1st result set!" );
+ m_bStatic = sal_True;
+ }
+ else
+ {
+ // virtual... derived class fills m_xResultSet1 and m_xResultSet2
+ initDynamic();
+
+ VOS_ENSURE( m_xResultSet1.is(),
+ "ResultSetImplHelper::init - No 1st result set!" );
+ VOS_ENSURE( m_xResultSet2.is(),
+ "ResultSetImplHelper::init - No 2nd result set!" );
+ m_bStatic = sal_False;
+ }
+ m_bInitDone = sal_True;
+ }
+
+}
+
+/*
+
+pure virtual
+
+//=========================================================================
+// virtual
+void ResultSetImplHelper::initStatic()
+{
+}
+
+//=========================================================================
+// virtual
+void ResultSetImplHelper::initDynamic()
+{
+}
+
+*/
+
diff --git a/ucbhelper/source/provider/resultsetmetadata.cxx b/ucbhelper/source/provider/resultsetmetadata.cxx
new file mode 100644
index 000000000000..8647ea0c60e0
--- /dev/null
+++ b/ucbhelper/source/provider/resultsetmetadata.cxx
@@ -0,0 +1,588 @@
+/*************************************************************************
+ *
+ * $RCSfile: resultsetmetadata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - Search for @@@ in this file to find out what's to do
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XARRAY_HPP_
+#include <com/sun/star/sdbc/XArray.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XBLOB_HPP_
+#include <com/sun/star/sdbc/XBlob.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCLOB_HPP_
+#include <com/sun/star/sdbc/XClob.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XREF_HPP_
+#include <com/sun/star/sdbc/XRef.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_
+#include <com/sun/star/util/Date.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_
+#include <com/sun/star/util/Time.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
+#include <com/sun/star/util/DateTime.hpp>
+#endif
+
+#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
+#include <ucbhelper/resultsetmetadata.hxx>
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+using namespace ucb;
+
+namespace ucb
+{
+
+struct ResultSetMetaData_Impl
+{
+ osl::Mutex m_aMutex;
+ sal_Bool m_bObtainedTypes;
+
+ ResultSetMetaData_Impl() : m_bObtainedTypes( sal_False ) {}
+};
+
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSetMetaData Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ResultSetMetaData::ResultSetMetaData(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProps,
+ sal_Bool bReadOnly )
+: m_pImpl( new ResultSetMetaData_Impl ),
+ m_xSMgr( rxSMgr ),
+ m_aProps( rProps ),
+ m_bReadOnly( bReadOnly )
+{
+}
+
+//=========================================================================
+// virtual
+ResultSetMetaData::~ResultSetMetaData()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( ResultSetMetaData,
+ XTypeProvider,
+ XResultSetMetaData );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( ResultSetMetaData,
+ XTypeProvider,
+ XResultSetMetaData );
+
+//=========================================================================
+//
+// XResultSetMetaData methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnCount()
+ throw( SQLException, RuntimeException )
+{
+ return m_aProps.getLength();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether column is automatically numbered, which makes it
+ read-only.
+ */
+
+ return m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isCaseSensitive( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether the value stored in column can be used in a
+ WHERE clause.
+ */
+
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether column is a cash value.
+ */
+
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether a NULL can be stored in column.
+ Possible values: see com/sun/star/sdbc/ColumnValue.idl
+ */
+
+ // All columns may contain NULL. Think of result sets containing
+ // UCB contents of different types...
+ return ColumnValue::NULLABLE;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether the value stored in column is a signed number.
+ */
+
+ // @@@
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the normal maximum width in characters for column.
+ */
+
+ // @@@
+ return 16;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnLabel( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the suggested column title for column, to be used in print-
+ outs and displays.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_aProps.getConstArray()[ column - 1 ].Name;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the name of column.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_aProps.getConstArray()[ column - 1 ].Name;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the schema name for the table from which column of this
+ result set was derived.
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ For number types, getprecision gets the number of decimal digits
+ in column.
+ For character types, it gets the maximum length in characters for
+ column.
+ For binary types, it gets the maximum length in bytes for column.
+ */
+
+ // @@@
+ return -1;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the number of digits to the right of the decimal point for
+ values in column.
+ */
+
+ // @@@
+ return 0;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getTableName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the name of the table from which column of this result set
+ was derived or "" if there is none (for example, for a join).
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getCatalogName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the catalog name for the table from which column of this
+ result set was derived.
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnType( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the JDBC type for the value stored in column. ... The STRUCT
+ and DISTINCT type codes are always returned for structured and
+ distinct types, regardless of whether the value will be mapped
+ according to the standard mapping or be a custom mapping.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return DataType::SQLNULL;
+
+ if ( m_aProps.getConstArray()[ column - 1 ].Type
+ == getCppuVoidType() )
+ {
+ // No type given. Try UCB's Properties Manager...
+
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_bObtainedTypes )
+ {
+ try
+ {
+ Reference< XPropertySetInfo > xInfo(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.PropertiesManager" ) ),
+ UNO_QUERY );
+ if ( xInfo.is() )
+ {
+#if 0
+ // Convenient...
+
+ sal_Int32 nCount = m_pImpl->m_aProps.getLength();
+ Property* pProps = m_pImpl->m_aProps.getArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ try
+ {
+ Property aProp
+ = xInfo->getPropertyByName( rProp.Name );
+ rProp.Type = aProp.Type;
+ }
+ catch ( UnknownPropertyException& )
+ {
+ // getPropertyByName
+ }
+ }
+#else
+ // Less (remote) calls...
+
+ Sequence< Property > aProps = xInfo->getProperties();
+ const Property* pProps1 = aProps.getConstArray();
+ sal_Int32 nCount1 = aProps.getLength();
+
+ sal_Int32 nCount = m_aProps.getLength();
+ Property* pProps = m_aProps.getArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ for ( sal_Int32 m = 0; m < nCount1; ++m )
+ {
+ const Property& rProp1 = pProps1[ m ];
+ if ( rProp.Name == rProp1.Name )
+ {
+ // Found...
+ rProp.Type = rProp1.Type;
+ break;
+ }
+ }
+ }
+#endif
+ }
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ // createInstance
+ }
+
+ m_pImpl->m_bObtainedTypes = sal_True;
+ }
+ }
+
+ const Type& rType = m_aProps.getConstArray()[ column - 1 ].Type;
+ sal_Int32 nType = DataType::OTHER;
+
+ if ( rType == getCppuType( static_cast< const rtl::OUString * >( 0 ) ) )
+ nType = DataType::VARCHAR; // XRow::getString
+ else if ( rType == getCppuBooleanType() )
+ nType = DataType::BIT; // XRow::getBoolean
+ else if ( rType == getCppuType( static_cast< const sal_Int32 * >( 0 ) ) )
+ nType = DataType::INTEGER; // XRow::getInt
+ else if ( rType == getCppuType( static_cast< const sal_Int64 * >( 0 ) ) )
+ nType = DataType::BIGINT; // XRow::getLong
+ else if ( rType == getCppuType( static_cast< const sal_Int16 * >( 0 ) ) )
+ nType = DataType::SMALLINT; // XRow::getShort
+ else if ( rType == getCppuType( static_cast< const sal_Int8 * >( 0 ) ) )
+ nType = DataType::TINYINT; // XRow::getByte
+ else if ( rType == getCppuType( static_cast< const float * >( 0 ) ) )
+ nType = DataType::REAL; // XRow::getFloat
+ else if ( rType == getCppuType( static_cast< const double * >( 0 ) ) )
+ nType = DataType::DOUBLE; // XRow::getDouble
+ else if ( rType == getCppuType( static_cast< const Sequence< sal_Int8 > * >( 0 ) ) )
+ nType = DataType::VARBINARY;// XRow::getBytes
+ else if ( rType == getCppuType( static_cast< const Date * >( 0 ) ) )
+ nType = DataType::DATE; // XRow::getDate
+ else if ( rType == getCppuType( static_cast< const Time * >( 0 ) ) )
+ nType = DataType::TIME; // XRow::getTime
+ else if ( rType == getCppuType( static_cast< const DateTime * >( 0 ) ) )
+ nType = DataType::TIMESTAMP;// XRow::getTimestamp
+ else if ( rType == getCppuType( static_cast< Reference< XInputStream > * >( 0 ) ) )
+ nType = DataType::LONGVARBINARY; // XRow::getBinaryStream
+// nType = DataType::LONGVARCHAR; // XRow::getCharacterStream
+ else if ( rType == getCppuType( static_cast< Reference< XClob > * >( 0 ) ) )
+ nType = DataType::CLOB; // XRow::getClob
+ else if ( rType == getCppuType( static_cast< Reference< XBlob > * >( 0 ) ) )
+ nType = DataType::BLOB; // XRow::getBlob
+ else if ( rType == getCppuType( static_cast< Reference< XArray > * >( 0 ) ) )
+ nType = DataType::ARRAY;// XRow::getArray
+ else if ( rType == getCppuType( static_cast< Reference< XRef > * >( 0 ) ) )
+ nType = DataType::REF;// XRow::getRef
+ else
+ nType = DataType::OBJECT;// XRow::getObject
+
+ return nType;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the type name used by this particular data source for the
+ values stored in column. If the type code for the type of value
+ stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
+ returns a fully-qualified SQL type name.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ // @@@ According to DG, the type name may be empty.
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // ContentResultSet's are completely read-only.
+ return m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // ContentResultSet's are completely read-only.
+ return !m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ // ContentResultSet's are completely read-only.
+ return !m_bReadOnly;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnServiceName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Returns the fully-qualified name of the service whose instances
+ are manufactured if XResultSet::getObject is called to retrieve
+ a value from the column.
+ */
+
+ return OUString();
+}
+
diff --git a/ucbhelper/util/makefile.mk b/ucbhelper/util/makefile.mk
new file mode 100644
index 000000000000..99cbd547028e
--- /dev/null
+++ b/ucbhelper/util/makefile.mk
@@ -0,0 +1,127 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME= ucbhelper
+TARGET= ucbhelper
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.INCLUDE : ..$/version.mk
+
+# --- Files --------------------------------------------------------
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1FILES= $(SLB)$/client.lib \
+ $(SLB)$/provider.lib
+
+SHL1TARGET= $(TARGET)$(UCBHELPER_MAJOR)$(COM)
+SHL1STDLIBS= $(SALLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB)
+SHL1DEPN=
+SHL1IMPLIB= i$(TARGET)
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+DEFLIB1NAME= $(TARGET)
+DEF1DES= Universal Content Broker - Helpers
+#DEF1EXPORT1= createComponentFactory
+#DEF1EXPORT2= writeComponentInfo
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# --- Filter -----------------------------------------------------------
+
+$(MISC)$/$(SHL1TARGET).flt : ucbhelper.flt
+ @echo ------------------------------
+ @echo Making: $@
+ @+$(TYPE) ucbhelper.flt > $@
+.IF "$(COM)"=="MSC"
+ @echo __CT>>$@
+ @echo ??_5>>$@
+ @echo ??_7>>$@
+ @echo ??_8>>$@
+ @echo ??_9>>$@
+ @echo ??_C>>$@
+ @echo ??_E>>$@
+ @echo ??_F>>$@
+ @echo ??_G>>$@
+ @echo ??_H>>$@
+ @echo ??_I>>$@
+.ENDIF # MSC
+.IF "$(GUI)"=="WNT"
+ @echo ?CreateType@>>$@
+.ENDIF # WNT
+
diff --git a/ucbhelper/util/ucbhelper.flt b/ucbhelper/util/ucbhelper.flt
new file mode 100644
index 000000000000..f28f925efc90
--- /dev/null
+++ b/ucbhelper/util/ucbhelper.flt
@@ -0,0 +1,13 @@
+_Impl
+IMP
+Dbg
+DLL
+getCppuType
+cpp_queryInterface
+cpp_acquire
+cpp_release
+_aType
+unnamed
+?queryInterface@ContentIdentifier@ucb@@WBA@AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z
+?queryInterface@ContentIdentifier@ucb@@WM@AA?AVAny@uno@star@sun@com@@ABVType@4567@@Z
+?queryInterface@cppu@@YA?AVAny@uno@star@sun@com@@ABVType@3456@PAVXTypeProvider@lang@456@PAVXContentIdentifier@ucb@456@@Z
diff --git a/ucbhelper/version.mk b/ucbhelper/version.mk
new file mode 100644
index 000000000000..de31697a55b8
--- /dev/null
+++ b/ucbhelper/version.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# $RCSfile: version.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:36 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+UCBHELPER_TARGET=ucbhelper
+
+# the major
+UCBHELPER_MAJOR=1
+# the minor
+UCBHELPER_MINOR=0
+# the micro
+UCBHELPER_MICRO=0
+
+# this is a c++ compatible library
+UCBHELPER_CPP=1
+
+UCBHELPER=$(UCBHELPER_TARGET)_$(CMPEXT)
+
+LIBUCBHELPER_UNX=lib$(UCBHELPER).a.$(UCBHELPER_MAJOR)
+LIBUCBHELPER_WIN=$(UCBHELPER_TARGET)$(UCBHELPER_MAJOR)$(CMPEXT).dll
diff --git a/ucbhelper/workben/myucp/exports.map b/ucbhelper/workben/myucp/exports.map
new file mode 100644
index 000000000000..14a2531f23ad
--- /dev/null
+++ b/ucbhelper/workben/myucp/exports.map
@@ -0,0 +1,8 @@
+VERS_1_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/ucbhelper/workben/myucp/makefile.mk b/ucbhelper/workben/myucp/makefile.mk
new file mode 100644
index 000000000000..06117e001ed7
--- /dev/null
+++ b/ucbhelper/workben/myucp/makefile.mk
@@ -0,0 +1,132 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+# @@@ UCP Version - Increase, if your UCP libraray becomes incompatible.
+UCP_VERSION=1
+
+# @@@ Name for your UCP. Will become part of the library name (See below).
+UCP_NAME=myucp
+
+# @@@ Relative path to project root.
+PRJ=..$/..
+
+# @@@ Name of the project your UCP code recides it.
+PRJNAME=UCBHELPER
+
+TARGET=ucp$(UCP_NAME)
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+NO_BSYMBOLIC=TRUE
+
+# --- Settings ---------------------------------------------------------
+
+.INCLUDE: svpre.mk
+.INCLUDE: settings.mk
+.INCLUDE: sv.mk
+
+# --- General -----------------------------------------------------
+
+# @@@ Adjust template file names. Add own files here.
+SLOFILES=\
+ $(SLO)$/myucp_services.obj \
+ $(SLO)$/myucp_provider.obj \
+ $(SLO)$/myucp_content.obj \
+ $(SLO)$/myucp_contentcaps.obj
+
+# You need these only if you implement a folder content,
+# which supports the command "open" returning a result set.
+# $(SLO)$/myucp_resultset.obj
+# $(SLO)$/myucp_datasupplier.obj
+
+LIB1TARGET=$(SLB)$/_$(TARGET).lib
+LIB1OBJFILES=$(SLOFILES)
+
+# --- Shared-Library ---------------------------------------------------
+
+SHL1TARGET=$(TARGET)$(UCP_VERSION)
+SHL1IMPLIB=i$(TARGET)
+SHL1VERSIONMAP=exports.map
+
+# @@@ Add additional libs here.
+SHL1STDLIBS=\
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(UCBHELPERLIB)
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+SHL1LIBS=$(LIB1TARGET)
+
+# --- Def-File ---------------------------------------------------------
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# @@@ A description string for you UCP.
+DEF1DES=UCB Content Provider
+
+# --- Targets ----------------------------------------------------------
+
+.INCLUDE: target.mk
+
diff --git a/ucbhelper/workben/myucp/myucp_content.cxx b/ucbhelper/workben/myucp/myucp_content.cxx
new file mode 100644
index 000000000000..938dec90661d
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_content.cxx
@@ -0,0 +1,805 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_content.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPERSISTENTPROPERTYSET_HPP_
+#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
+#endif
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
+#include <ucbhelper/propertyvalueset.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_PROVIDER_HXX
+#include "myucp_provider.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+//#ifndef _MYUCP_RESULTSET_HXX
+//#include "myucp_resultset.hxx"
+//#endif
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace cppu;
+using namespace rtl;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//=========================================================================
+//
+// Content Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+Content::Content( const Reference< XMultiServiceFactory >& rxSMgr,
+ ::ucb::ContentProviderImplHelper* pProvider,
+ const Reference< XContentIdentifier >& Identifier )
+: ContentImplHelper( rxSMgr, pProvider, Identifier )
+{
+ // @@@ Fill m_aProps here or implement lazy evaluation logic for this.
+ // m_aProps.aTitle =
+ // m_aprops.aContentType =
+ // m_aProps.bIsDocument =
+ // m_aProps.bIsFolder =
+}
+
+//=========================================================================
+// virtual
+Content::~Content()
+{
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL Content::acquire()
+ throw( RuntimeException )
+{
+ ContentImplHelper::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL Content::release()
+ throw( RuntimeException )
+{
+ ContentImplHelper::release();
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL Content::queryInterface( const Type & rType )
+ throw ( RuntimeException )
+{
+ Any aRet;
+
+ // @@@ Add support for additional interfaces.
+#if 0
+ aRet = cppu::queryInterface( rType,
+ static_cast< Xxxxxxxxx * >( this ) );
+#endif
+
+ return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_COMMON_IMPL( Content );
+
+//=========================================================================
+// virtual
+Sequence< Type > SAL_CALL Content::getTypes()
+ throw( RuntimeException )
+{
+ // @@@ Add own interfaces.
+
+ static OTypeCollection* pCollection = NULL;
+
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static OTypeCollection aCollection(
+ CPPU_TYPE_REF( XTypeProvider ),
+ CPPU_TYPE_REF( XServiceInfo ),
+ CPPU_TYPE_REF( XComponent ),
+ CPPU_TYPE_REF( XContent ),
+ CPPU_TYPE_REF( XCommandProcessor ),
+ CPPU_TYPE_REF( XPropertiesChangeNotifier ),
+ CPPU_TYPE_REF( XCommandInfoChangeNotifier ),
+ CPPU_TYPE_REF( XPropertyContainer ),
+ CPPU_TYPE_REF( XPropertySetInfoChangeNotifier ),
+ CPPU_TYPE_REF( XChild ) );
+ pCollection = &aCollection;
+ }
+ }
+
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL Content::getImplementationName()
+ throw( RuntimeException )
+{
+ // @@@ Adjust implementation name.
+ return OUString::createFromAscii( "myucp_Content" );
+}
+
+//=========================================================================
+// virtual
+Sequence< OUString > SAL_CALL Content::getSupportedServiceNames()
+ throw( RuntimeException )
+{
+ // @@@ Adjust macro name.
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ]
+ = OUString::createFromAscii( MYUCP_CONTENT_SERVICE_NAME );
+ return aSNS;
+}
+
+//=========================================================================
+//
+// XContent methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL Content::getContentType()
+ throw( RuntimeException )
+{
+ // @@@ Adjust macro name ( def in myucp_provider.hxx ).
+ return OUString::createFromAscii( MYUCP_CONTENT_TYPE );
+}
+
+//=========================================================================
+//
+// XCommandProcessor methods.
+//
+//=========================================================================
+
+// virtual
+Any SAL_CALL Content::execute( const Command& aCommand,
+ sal_Int32 CommandId,
+ const Reference<
+ XCommandEnvironment >& Environment )
+ throw( Exception, CommandAbortedException, RuntimeException )
+{
+ Any aRet;
+
+ if ( aCommand.Name.compareToAscii( "getPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< Property > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" );
+ return Any();
+ }
+
+ aRet <<= getPropertyValues( Properties );
+ }
+ else if ( aCommand.Name.compareToAscii( "setPropertyValues" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // setPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ Sequence< PropertyValue > aProperties;
+ if ( !( aCommand.Argument >>= aProperties ) )
+ {
+ VOS_ENSURE( sal_False, "Wrong argument type!" );
+ return Any();
+ }
+
+ if ( !aProperties.getLength() )
+ {
+ VOS_ENSURE( sal_False, "No properties!" );
+ return Any();
+ }
+
+ setPropertyValues( aProperties );
+ }
+ else if ( aCommand.Name.compareToAscii( "getPropertySetInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertySetInfo
+ //////////////////////////////////////////////////////////////////
+
+ // Note: Implemented by base class.
+ aRet <<= getPropertySetInfo();
+ }
+ else if ( aCommand.Name.compareToAscii( "getCommandInfo" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getCommandInfo
+ //////////////////////////////////////////////////////////////////
+
+ // Note: Implemented by base class.
+ aRet <<= getCommandInfo();
+ }
+#if 0
+ else if ( isFolder() && ( aCommand.Name.compareToAscii( "open" ) == 0 ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // open command for a folder content
+ //////////////////////////////////////////////////////////////////
+
+ OpenCommandArgument2 aOpenCommand;
+ if ( aCommand.Argument >>= aOpenCommand )
+ {
+ Reference< XDynamicResultSet > xSet
+ = new DynamicResultSet( m_xSMgr, this, aOpenCommand );
+ aRet <<= xSet;
+ }
+ else
+ {
+ VOS_ENSURE( sal_False,
+ "Content::execute - invalid parameter!" );
+ throw CommandAbortedException();
+ }
+ }
+ else if ( aCommand.Name.compareToAscii( "insert" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // insert
+ //////////////////////////////////////////////////////////////////
+
+ insert();
+ }
+ else if ( aCommand.Name.compareToAscii( "delete" ) == 0 )
+ {
+ //////////////////////////////////////////////////////////////////
+ // delete
+ //////////////////////////////////////////////////////////////////
+
+ sal_Bool bDeletePhysical = sal_False;
+ aCommand.Argument >>= bDeletePhysical;
+ destroy( bDeletePhysical );
+
+ // Remove own and all childrens(!) persistent data.
+// removeData();
+ }
+#endif
+ else
+ {
+ //////////////////////////////////////////////////////////////////
+ // Unknown command
+ //////////////////////////////////////////////////////////////////
+
+ VOS_ENSURE( sal_False,
+ "Content::execute - unknown command!" );
+ throw CommandAbortedException();
+ }
+
+ return aRet;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL Content::abort( sal_Int32 CommandId )
+ throw( RuntimeException )
+{
+ // @@@ Implement logic to abort running commands, if this makes
+ // sense for your content.
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+// virtual
+OUString Content::getParentURL()
+{
+ OUString aURL = m_xIdentifier->getContentIdentifier();
+
+ // @@@ Assemble URL of parent...
+
+ return OUString();
+}
+
+//=========================================================================
+// static
+Reference< XRow > Content::getPropertyValues(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Property >& rProperties,
+ const ContentProperties& rData,
+ const vos::ORef< ucb::ContentProviderImplHelper >& rProvider,
+ const OUString& rContentId )
+{
+ // Note: Empty sequence means "get values of all supported properties".
+
+ vos::ORef< ::ucb::PropertyValueSet > xRow
+ = new ::ucb::PropertyValueSet( rSMgr );
+
+ sal_Int32 nCount = rProperties.getLength();
+ if ( nCount )
+ {
+ Reference< XPropertySet > xAdditionalPropSet;
+ sal_Bool bTriedToGetAdditonalPropSet = sal_False;
+
+ const Property* pProps = rProperties.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const Property& rProp = pProps[ n ];
+
+ // Process Core properties.
+
+ if ( rProp.Name.compareToAscii( "ContentType" ) == 0 )
+ {
+ xRow->appendString ( rProp, rData.aContentType );
+ }
+ else if ( rProp.Name.compareToAscii( "Title" ) == 0 )
+ {
+ xRow->appendString ( rProp, rData.aTitle );
+ }
+ else if ( rProp.Name.compareToAscii( "IsDocument" ) == 0 )
+ {
+ xRow->appendBoolean( rProp, rData.bIsDocument );
+ }
+ else if ( rProp.Name.compareToAscii( "IsFolder" ) == 0 )
+ {
+ xRow->appendBoolean( rProp, rData.bIsFolder );
+ }
+
+ // @@@ Process other properties supported directly.
+#if 0
+ else if ( rProp.Name.compareToAscii( "xxxxxx" ) == 0 )
+ {
+ }
+#endif
+ else
+ {
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Not a Core Property! Maybe it's an Additional Core Property?!
+
+ if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
+ {
+ xAdditionalPropSet
+ = Reference< XPropertySet >(
+ rProvider->getAdditionalPropertySet( rContentId,
+ sal_False ),
+ UNO_QUERY );
+ bTriedToGetAdditonalPropSet = sal_True;
+ }
+
+ if ( xAdditionalPropSet.is() )
+ {
+ if ( !xRow->appendPropertySetValue(
+ xAdditionalPropSet,
+ rProp ) )
+ {
+ // Append empty entry.
+ xRow->appendVoid( rProp );
+ }
+ }
+ else
+ {
+ // Append empty entry.
+ xRow->appendVoid( rProp );
+ }
+ }
+ }
+ }
+ else
+ {
+ // Append all Core Properties.
+ xRow->appendString (
+ Property( OUString::createFromAscii( "ContentType" ),
+ -1,
+ getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ rData.aContentType );
+ xRow->appendString (
+ Property( OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND ),
+ rData.aTitle );
+ xRow->appendBoolean(
+ Property( OUString::createFromAscii( "IsDocument" ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ rData.bIsDocument );
+ xRow->appendBoolean(
+ Property( OUString::createFromAscii( "IsFolder" ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY ),
+ rData.bIsFolder );
+
+ // @@@ Append other properties supported directly.
+
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Append all Additional Core Properties.
+
+ Reference< XPropertySet > xSet(
+ rProvider->getAdditionalPropertySet( rContentId, sal_False ),
+ UNO_QUERY );
+ xRow->appendPropertySet( xSet );
+ }
+
+ return Reference< XRow >( xRow.getBodyPtr() );
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValues(
+ const Sequence< Property >& rProperties )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ return getPropertyValues( m_xSMgr,
+ rProperties,
+ m_aProps,
+ m_xProvider,
+ m_xIdentifier->getContentIdentifier() );
+}
+
+//=========================================================================
+void Content::setPropertyValues( const Sequence< PropertyValue >& rValues )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ Sequence< PropertyChangeEvent > aChanges( rValues.getLength() );
+ sal_Int32 nChanged = 0;
+
+ PropertyChangeEvent aEvent;
+ aEvent.Source = static_cast< OWeakObject * >( this );
+ aEvent.Further = sal_False;
+// aEvent.PropertyName =
+ aEvent.PropertyHandle = -1;
+// aEvent.OldValue =
+// aEvent.NewValue =
+
+ const PropertyValue* pValues = rValues.getConstArray();
+ sal_Int32 nCount = rValues.getLength();
+
+ Reference< XPersistentPropertySet > xAdditionalPropSet;
+ sal_Bool bTriedToGetAdditonalPropSet = sal_False;
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const PropertyValue& rValue = pValues[ n ];
+
+ if ( rValue.Name.compareToAscii( "ContentType" ) == 0 )
+ {
+ // Read-only property!
+ }
+ else if ( rValue.Name.compareToAscii( "IsDocument" ) == 0 )
+ {
+ // Read-only property!
+ }
+ else if ( rValue.Name.compareToAscii( "IsFolder" ) == 0 )
+ {
+ // Read-only property!
+ }
+ else if ( rValue.Name.compareToAscii( "Title" ) == 0 )
+ {
+ OUString aNewValue;
+ if ( rValue.Value >>= aNewValue )
+ {
+ if ( aNewValue != m_aProps.aTitle )
+ {
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+ m_aProps.aTitle = aNewValue;
+
+ aGuard.clear();
+
+ aEvent.PropertyName = rValue.Name;
+ aEvent.OldValue = makeAny( m_aProps.aTitle );
+ aEvent.NewValue = makeAny( aNewValue );
+
+ aChanges.getArray()[ nChanged ] = aEvent;
+ nChanged++;
+ }
+ }
+ }
+
+ // @@@ Process other properties supported directly.
+#if 0
+ else if ( rValue.Name.compareToAscii( "xxxxx" ) == 0 )
+ {
+ }
+#endif
+ else
+ {
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Not a Core Property! Maybe it's an Additional Core Property?!
+
+ if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
+ {
+ xAdditionalPropSet = getAdditionalPropertySet( sal_False );
+ bTriedToGetAdditonalPropSet = sal_True;
+ }
+
+ if ( xAdditionalPropSet.is() )
+ {
+ try
+ {
+ Any aOldValue = xAdditionalPropSet->getPropertyValue(
+ rValue.Name );
+ xAdditionalPropSet->setPropertyValue(
+ rValue.Name, rValue.Value );
+
+ if ( aOldValue != rValue.Value )
+ {
+ aEvent.PropertyName = rValue.Name;
+ aEvent.OldValue = aOldValue;
+ aEvent.NewValue = rValue.Value;
+
+ aChanges.getArray()[ nChanged ] = aEvent;
+ nChanged++;
+ }
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ catch ( PropertyVetoException )
+ {
+ }
+ catch ( IllegalArgumentException )
+ {
+ }
+ }
+ }
+ }
+
+ if ( nChanged > 0 )
+ {
+ // @@@ Save changes.
+// storeData();
+
+ aGuard.clear();
+ aChanges.realloc( nChanged );
+ notifyPropertiesChange( aChanges );
+ }
+}
+
+#if 0
+//=========================================================================
+void Content::queryChildren( ::myucp::ContentRefList& rChildren )
+{
+ // @@@ Adapt method to your URL scheme...
+
+ // Obtain a list with a snapshot of all currently instanciated contents
+ // from provider and extract the contents which are direct children
+ // of this content.
+
+ ::ucb::ContentRefList aAllContents;
+ m_xProvider->queryExistingContents( aAllContents );
+
+ OUString aURL = m_xIdentifier->getContentIdentifier();
+ sal_Int32 nPos = aURL.lastIndexOf( '/' );
+
+ if ( nPos != ( aURL.getLength() - 1 ) )
+ {
+ // No trailing slash found. Append.
+ aURL += OUString::createFromAscii( "/" );
+ }
+
+ sal_Int32 nLen = aURL.getLength();
+
+ ::ucb::ContentRefList::const_iterator it = aAllContents.begin();
+ ::ucb::ContentRefList::const_iterator end = aAllContents.end();
+
+ while ( it != end )
+ {
+ ::ucb::ContentImplHelperRef xChild = (*it);
+ OUString aChildURL = xChild->getIdentifier()->getContentIdentifier();
+
+ // Is aURL a prefix of aChildURL?
+ if ( ( aChildURL.getLength() > nLen ) &&
+ ( aChildURL.compareTo( aURL, nLen ) == 0 ) )
+ {
+ sal_Int32 nPos = nLen;
+ nPos = aChildURL.indexOf( '/', nPos );
+
+ if ( ( nPos == -1 ) ||
+ ( nPos == ( aChildURL.getLength() - 1 ) ) )
+ {
+ // No further slashes / only a final slash. It's a child!
+ rChildren.push_back(
+ HierarchyContentRef(
+ static_cast< HierarchyContent * >(
+ xChild.getBodyPtr() ) ) );
+ }
+ }
+ ++it;
+ }
+}
+
+//=========================================================================
+void Content::insert()
+ throw( CommandAbortedException )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ // Check, if all required properties were set.
+ if ( m_aProps.xxxx == yyyyy )
+ {
+ VOS_ENSURE( sal_False, "Content::insert - property value missing!" );
+ throw CommandAbortedException();
+ }
+
+ // Assemble new content identifier...
+
+ Reference< XContentIdentifier > xId = ...;
+ if ( !xId.is() )
+ throw CommandAbortedException();
+
+ // Fail, if a content with given id already exists.
+ if ( hasData( xId ) )
+ throw CommandAbortedException();
+
+ m_xIdentifier = xId;
+
+// @@@
+// storeData();
+
+ aGuard.clear();
+ inserted();
+}
+
+//=========================================================================
+void Content::destroy( sal_Bool bDeletePhysical )
+ throw( CommandAbortedException )
+{
+ // @@@ take care about bDeletePhysical -> trashcan support
+
+ Reference< XContent > xThis = this;
+
+ deleted();
+
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ // Process instanciated children...
+
+ ::myucp::ContentRefList aChildren;
+ queryChildren( aChildren );
+
+ ContentRefList::const_iterator it = aChildren.begin();
+ ContentRefList::const_iterator end = aChildren.end();
+
+ while ( it != end )
+ {
+ (*it)->destroy( bDeletePhysical );
+ ++it;
+ }
+}
+#endif
+
diff --git a/ucbhelper/workben/myucp/myucp_content.hxx b/ucbhelper/workben/myucp/myucp_content.hxx
new file mode 100644
index 000000000000..cef039ec6ffa
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_content.hxx
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_content.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_CONTENT_HXX
+#define _MYUCP_CONTENT_HXX
+
+#ifndef __LIST__
+#include <stl/list>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#include <ucbhelper/contenthelper.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct Property;
+ struct PropertyValue;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace sdbc {
+ class XRow;
+} } } }
+
+// @@@ Adjust namespace name.
+namespace myucp
+{
+
+//=========================================================================
+
+// @@@ Adjust service name.
+
+// UNO service name for the content.
+#define MYUCP_CONTENT_SERVICE_NAME \
+ "com.sun.star.ucb.MyContent"
+
+//=========================================================================
+
+struct ContentProperties
+{
+ ::rtl::OUString aTitle; // Title
+ ::rtl::OUString aContentType; // ContentType
+ sal_Bool bIsDocument; // IsDocument
+ sal_Bool bIsFolder; // IsFolder
+
+ // @@@ Add other properties supported by your content.
+
+ ContentProperties()
+ : bIsDocument( sal_False ), bIsFolder( sal_True ) {}
+};
+
+//=========================================================================
+
+class Content : public ::ucb::ContentImplHelper
+{
+ ContentProperties m_aProps;
+
+private:
+ virtual const ::ucb::PropertyInfoTableEntry& getPropertyInfoTable();
+ virtual const ::ucb::CommandInfoTableEntry& getCommandInfoTable();
+ virtual ::rtl::OUString getParentURL();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProperties );
+ void setPropertyValues(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rValues );
+
+// typedef vos::ORef< HierarchyContent > HierarchyContentRef;
+// typedef std::list< HierarchyContentRef > HierarchyContentRefList;
+// void queryChildren( HierarchyContentRefList& rChildren );
+
+// // Command "insert"
+// void insert()
+// throw( ::com::sun::star::ucb::CommandAbortedException );
+
+// // Command "delete"
+// void destroy( sal_Bool bDeletePhysical )
+// throw( ::com::sun::star::ucb::CommandAbortedException );
+
+public:
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ::ucb::ContentProviderImplHelper* pProvider,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier );
+ virtual ~Content();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XContent
+ virtual rtl::OUString SAL_CALL
+ getContentType()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandProcessor
+ virtual com::sun::star::uno::Any SAL_CALL
+ execute( const com::sun::star::ucb::Command& aCommand,
+ sal_Int32 CommandId,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::uno::Exception,
+ com::sun::star::ucb::CommandAbortedException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId )
+ throw( com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
+
+ // Add additional interfaces ( like com::sun:.star::ucb::XContentCreator ).
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ // Called from resultset data supplier.
+ static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValues( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProperties,
+ const ContentProperties& rData,
+ const ::vos::ORef< ::ucb::ContentProviderImplHelper >&
+ rProvider,
+ const ::rtl::OUString& rContentId );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_contentcaps.cxx b/ucbhelper/workben/myucp/myucp_contentcaps.cxx
new file mode 100644
index 000000000000..8feff8e28cda
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_contentcaps.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_contentcaps.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::ucb;
+using namespace rtl;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//
+// Content implementation.
+//
+//=========================================================================
+
+//=========================================================================
+//
+// IMPORTENT: If any property data ( name / type / ... ) are changed, then
+// Content::getPropertyValues(...) must be adapted too!
+//
+//=========================================================================
+
+// virtual
+const ::ucb::PropertyInfoTableEntry& Content::getPropertyInfoTable()
+{
+ // @@@ Add additional properties...
+
+ // @@@ Note: If your data source supports adding/removing properties,
+ // you should implement the interface XPropertyContainer
+ // by yourself and supply your own logic here. The base class
+ // uses the service "com.sun.star.ucb.Store" to maintain
+ // Additional Core properties. But using server functionality
+ // is preferred! In fact you should return a table conatining
+ // even that dynamicly added properties.
+
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //=================================================================
+ //
+ // Supported properties
+ //
+ //=================================================================
+
+ static ::ucb::PropertyInfoTableEntry aPropertyInfoTable[] =
+ {
+ ///////////////////////////////////////////////////////////////
+ // Required properties
+ ///////////////////////////////////////////////////////////////
+ {
+ "ContentType",
+ -1,
+ &getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ },
+ {
+ "IsDocument",
+ -1,
+ &getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ },
+ {
+ "IsFolder",
+ -1,
+ &getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY
+ },
+ {
+ "Title",
+ -1,
+ &getCppuType( static_cast< const OUString * >( 0 ) ),
+ PropertyAttribute::BOUND
+ },
+ ///////////////////////////////////////////////////////////////
+ // Optional standard properties
+ ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // New properties
+ ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // EOT
+ ///////////////////////////////////////////////////////////////
+ {
+ 0, // name
+ 0, // handle
+ 0, // type
+ 0 // attributes
+ }
+ };
+ return *aPropertyInfoTable;
+}
+
+//=========================================================================
+// virtual
+const ::ucb::CommandInfoTableEntry& Content::getCommandInfoTable()
+{
+ // @@@ Add additional commands...
+
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //=================================================================
+ //
+ // Supported commands
+ //
+ //=================================================================
+
+ static ::ucb::CommandInfoTableEntry aCommandInfoTable[] =
+ {
+ ///////////////////////////////////////////////////////////////
+ // Required commands
+ ///////////////////////////////////////////////////////////////
+ {
+ "getCommandInfo",
+ -1,
+ &getCppuVoidType()
+ },
+ {
+ "getPropertySetInfo",
+ -1,
+ &getCppuVoidType()
+ },
+ {
+ "getPropertyValues",
+ -1,
+ &getCppuType( static_cast< Sequence< Property > * >( 0 ) )
+ },
+ {
+ "setPropertyValues",
+ -1,
+ &getCppuType( static_cast< Sequence< PropertyValue > * >( 0 ) )
+ },
+ ///////////////////////////////////////////////////////////////
+ // Optional standard commands
+ ///////////////////////////////////////////////////////////////
+#if 0
+ {
+ "delete",
+ -1,
+ &getCppuBooleanType()
+ },
+ {
+ "insert",
+ -1,
+ &getCppuVoidType()
+ },
+ {
+ "open",
+ -1,
+ &getCppuType( static_cast< OpenCommandArgument2 * >( 0 ) )
+ },
+#endif
+ ///////////////////////////////////////////////////////////////
+ // New commands
+ ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // EOT
+ ///////////////////////////////////////////////////////////////
+ {
+ 0, // name
+ 0, // handle
+ 0 // type
+ }
+ };
+
+ return *aCommandInfoTable;
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.cxx b/ucbhelper/workben/myucp/myucp_datasupplier.cxx
new file mode 100644
index 000000000000..3fc120d1f40d
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_datasupplier.cxx
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_datasupplier.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __VECTOR__
+#include <stl/vector>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_DATASUPPLIER_HXX
+#include "myucp_datasupplier.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::sdbc;
+using namespace rtl;
+using namespace ucb;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+// @@@ Adjust namespace name.
+namespace myucp
+{
+
+//=========================================================================
+//
+// struct ResultListEntry.
+//
+//=========================================================================
+
+struct ResultListEntry
+{
+ OUString aId;
+ Reference< XContentIdentifier > xId;
+ Reference< XContent > xContent;
+ Reference< XRow > xRow;
+ const ContentProperties& rData;
+
+ ResultListEntry( const ContentProperties& rEntry ) : rData( rEntry ) {}
+};
+
+//=========================================================================
+//
+// ResultList.
+//
+//=========================================================================
+
+typedef std::vector< ResultListEntry* > ResultList;
+
+//=========================================================================
+//
+// struct DataSupplier_Impl.
+//
+//=========================================================================
+
+struct DataSupplier_Impl
+{
+ osl::Mutex m_aMutex;
+ ResultList m_aResults;
+ vos::ORef< Content > m_xContent;
+ Reference< XMultiServiceFactory > m_xSMgr;
+// @@@ The data source and an iterator for it
+// HierarchyEntry m_aFolder;
+// HierarchyEntry::iterator m_aIterator;
+ sal_Bool m_bCountFinal;
+
+ DataSupplier_Impl( const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rContent )
+ : m_xContent( rContent ), m_xSMgr( rxSMgr ),
+// m_aFolder( rxSMgr, rContent->getIdentifier()->getContentIdentifier() ),
+ m_bCountFinal( sal_False ) {}
+ ~DataSupplier_Impl();
+};
+
+//=========================================================================
+DataSupplier_Impl::~DataSupplier_Impl()
+{
+ ResultList::const_iterator it = m_aResults.begin();
+ ResultList::const_iterator end = m_aResults.end();
+
+ while ( it != end )
+ {
+ delete (*it);
+ it++;
+ }
+}
+
+}
+
+//=========================================================================
+//=========================================================================
+//
+// DataSupplier Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+DataSupplier::DataSupplier( const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rContent )
+: m_pImpl( new DataSupplier_Impl( rxSMgr, rContent ) )
+{
+}
+
+//=========================================================================
+// virtual
+DataSupplier::~DataSupplier()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+// virtual
+OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
+ if ( aId.getLength() )
+ {
+ // Already cached.
+ return aId;
+ }
+ }
+
+ if ( getResult( nIndex ) )
+ {
+ OUString aId
+ = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
+
+ aId += m_pImpl->m_aResults[ nIndex ]->rData.aTitle;
+
+ m_pImpl->m_aResults[ nIndex ]->aId = aId;
+ return aId;
+ }
+ return OUString();
+}
+
+//=========================================================================
+// virtual
+Reference< XContentIdentifier > DataSupplier::queryContentIdentifier(
+ sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ Reference< XContentIdentifier > xId
+ = m_pImpl->m_aResults[ nIndex ]->xId;
+ if ( xId.is() )
+ {
+ // Already cached.
+ return xId;
+ }
+ }
+
+ OUString aId = queryContentIdentifierString( nIndex );
+ if ( aId.getLength() )
+ {
+ Reference< XContentIdentifier > xId = new ContentIdentifier( aId );
+ m_pImpl->m_aResults[ nIndex ]->xId = xId;
+ return xId;
+ }
+ return Reference< XContentIdentifier >();
+}
+
+//=========================================================================
+// virtual
+Reference< XContent > DataSupplier::queryContent( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ Reference< XContent > xContent
+ = m_pImpl->m_aResults[ nIndex ]->xContent;
+ if ( xContent.is() )
+ {
+ // Already cached.
+ return xContent;
+ }
+ }
+
+ Reference< XContentIdentifier > xId = queryContentIdentifier( nIndex );
+ if ( xId.is() )
+ {
+ try
+ {
+ Reference< XContent > xContent
+ = m_pImpl->m_xContent->getProvider()->queryContent( xId );
+ m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
+ return xContent;
+
+ }
+ catch ( IllegalIdentifierException& )
+ {
+ }
+ }
+ return Reference< XContent >();
+}
+
+//=========================================================================
+// virtual
+sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_aResults.size() > nIndex )
+ {
+ // Result already present.
+ return sal_True;
+ }
+
+ // Result not (yet) present.
+
+ if ( m_pImpl->m_bCountFinal )
+ return sal_False;
+
+ // Try to obtain result...
+
+ sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+ sal_Bool bFound = sal_False;
+ sal_uInt32 nPos = nOldCount;
+
+ // @@@ Obtain data and put it into result list...
+/*
+ while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
+ {
+ m_pImpl->m_aResults.push_back(
+ new ResultListEntry( *m_pImpl->m_aIterator ) );
+
+ if ( nPos == nIndex )
+ {
+ // Result obtained.
+ bFound = sal_True;
+ break;
+ }
+
+ nPos++;
+ }
+*/
+
+ if ( !bFound )
+ m_pImpl->m_bCountFinal = sal_True;
+
+ vos::ORef< ResultSet > xResultSet = getResultSet();
+ if ( xResultSet.isValid() )
+ {
+ // Callbacks follow!
+ aGuard.clear();
+
+ if ( nOldCount < m_pImpl->m_aResults.size() )
+ xResultSet->rowCountChanged(
+ nOldCount, m_pImpl->m_aResults.size() );
+
+ if ( m_pImpl->m_bCountFinal )
+ xResultSet->rowCountFinal();
+ }
+
+ return bFound;
+}
+
+//=========================================================================
+// virtual
+sal_uInt32 DataSupplier::totalCount()
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bCountFinal )
+ return m_pImpl->m_aResults.size();
+
+ sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+
+ // @@@ Obtain data and put it into result list...
+/*
+ while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
+ m_pImpl->m_aResults.push_back(
+ new ResultListEntry( *m_pImpl->m_aIterator ) );
+*/
+ m_pImpl->m_bCountFinal = sal_True;
+
+ vos::ORef< ResultSet > xResultSet = getResultSet();
+ if ( xResultSet.isValid() )
+ {
+ // Callbacks follow!
+ aGuard.clear();
+
+ if ( nOldCount < m_pImpl->m_aResults.size() )
+ xResultSet->rowCountChanged(
+ nOldCount, m_pImpl->m_aResults.size() );
+
+ xResultSet->rowCountFinal();
+ }
+
+ return m_pImpl->m_aResults.size();
+}
+
+//=========================================================================
+// virtual
+sal_uInt32 DataSupplier::currentCount()
+{
+ return m_pImpl->m_aResults.size();
+}
+
+//=========================================================================
+// virtual
+sal_Bool DataSupplier::isCountFinal()
+{
+ return m_pImpl->m_bCountFinal;
+}
+
+//=========================================================================
+// virtual
+Reference< XRow > DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
+ if ( xRow.is() )
+ {
+ // Already cached.
+ return xRow;
+ }
+ }
+
+ if ( getResult( nIndex ) )
+ {
+ Reference< XRow > xRow = Content::getPropertyValues(
+ m_pImpl->m_xSMgr,
+ getResultSet()->getProperties(),
+ m_pImpl->m_aResults[ nIndex ]->rData,
+ m_pImpl->m_xContent->getProvider(),
+ queryContentIdentifierString( nIndex ) );
+ m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
+ return xRow;
+ }
+
+ return Reference< XRow >();
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ m_pImpl->m_aResults[ nIndex ]->xRow = Reference< XRow >();
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::close()
+{
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::validate()
+ throw( ResultSetException )
+{
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.hxx b/ucbhelper/workben/myucp/myucp_datasupplier.hxx
new file mode 100644
index 000000000000..a7337d565d5f
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_datasupplier.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_datasupplier.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_DATASUPPLIER_HXX
+#define _MYUCP_DATASUPPLIER_HXX
+
+#ifndef _UCBHELPER_RESULTSET_HXX
+#include <ucbhelper/resultset.hxx>
+#endif
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+struct DataSupplier_Impl;
+class Content;
+
+class DataSupplier : public ucb::ResultSetDataSupplier
+{
+ DataSupplier_Impl* m_pImpl;
+
+public:
+ DataSupplier( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rContent );
+ virtual ~DataSupplier();
+
+ virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >
+ queryContentIdentifier( sal_uInt32 nIndex );
+ virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
+ queryContent( sal_uInt32 nIndex );
+
+ virtual sal_Bool getResult( sal_uInt32 nIndex );
+
+ virtual sal_uInt32 totalCount();
+ virtual sal_uInt32 currentCount();
+ virtual sal_Bool isCountFinal();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
+ queryPropertyValues( sal_uInt32 nIndex );
+ virtual void releasePropertyValues( sal_uInt32 nIndex );
+
+ virtual void close();
+
+ virtual void validate()
+ throw( com::sun::star::ucb::ResultSetException );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_provider.cxx b/ucbhelper/workben/myucp/myucp_provider.cxx
new file mode 100644
index 000000000000..2e409d46191a
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_provider.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_provider.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _VOS_DIAGNOSE_HXX_
+#include <vos/diagnose.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_PROVIDER_HXX
+#include "myucp_provider.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//=========================================================================
+//
+// ContentProvider Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentProvider::ContentProvider(
+ const Reference< XMultiServiceFactory >& rSMgr )
+: ::ucb::ContentProviderImplHelper( rSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+ContentProvider::~ContentProvider()
+{
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// @@@ Add own interfaces.
+XINTERFACE_IMPL_3( ContentProvider,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// @@@ Add own interfaces.
+XTYPEPROVIDER_IMPL_3( ContentProvider,
+ XTypeProvider,
+ XServiceInfo,
+ XContentProvider );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// @@@ Adjust implementation name and service name.
+XSERVICEINFO_IMPL_1( ContentProvider,
+ OUString::createFromAscii(
+ "myucp_ContentProvider" ),
+ OUString::createFromAscii(
+ MYUCP_CONTENT_PROVIDER_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// Service factory implementation.
+//
+//=========================================================================
+
+ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
+
+//=========================================================================
+//
+// XContentProvider methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XContent > SAL_CALL ContentProvider::queryContent(
+ const Reference< XContentIdentifier >& Identifier )
+ throw( IllegalIdentifierException, RuntimeException )
+{
+ vos::OGuard aGuard( m_aMutex );
+
+ // Check URL scheme...
+
+ OUString aScheme( OUString::createFromAscii( MYUCP_URL_SCHEME ) );
+ if ( !Identifier->getContentProviderScheme().equalsIgnoreCase( aScheme ) )
+ throw IllegalIdentifierException();
+
+ // @@@ Further id checks may go here...
+#if 0
+ if ( id-check-failes )
+ throw IllegalIdentifierException();
+#endif
+
+ // @@@ Id normalization may go here...
+#if 0
+ // Normalize URL and create new Id.
+ OUString aCanonicURL = xxxxx( Identifier->getContentIdentifier() );
+ Reference< XContentIdentifier > xCanonicId =
+ new ::ucb::ContentIdentifier( m_xSMgr, aCanonicURL );
+#else
+ Reference< XContentIdentifier > xCanonicId = Identifier;
+#endif
+
+ // Check, if a content with given id already exists...
+ Reference< XContent > xContent
+ = queryExistingContent( xCanonicId ).getBodyPtr();
+ if ( xContent.is() )
+ return xContent;
+
+ // @@@ Decision, which content implementation to instanciate may be
+ // made here ( in case you have different content classes ).
+
+ // Create a new content. Note that the content will insert itself
+ // into providers content list by calling addContent(...) from it's ctor.
+
+ xContent = new Content( m_xSMgr, this, xCanonicId );
+
+ if ( !xContent->getIdentifier().is() )
+ throw IllegalIdentifierException();
+
+ return xContent;
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_provider.hxx b/ucbhelper/workben/myucp/myucp_provider.hxx
new file mode 100644
index 000000000000..4d52c82fa7e9
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_provider.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_provider.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_PROVIDER_HXX
+#define _MYUCP_PROVIDER_HXX
+
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#include <ucbhelper/providerhelper.hxx>
+#endif
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+//=========================================================================
+
+// @@@ Adjust defines.
+
+// UNO service name for the provider. This name will be used by the UCB to
+// create instances of the provider.
+#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME \
+ "com.sun.star.ucb.MyContentProvider"
+#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 34
+
+// URL scheme. This is the scheme the provider will be able to create
+// contents for. The UCB will select the provider ( i.e. in order to create
+// contents ) according to this scheme.
+#define MYUCP_URL_SCHEME \
+ "vnd.sun.star.myucp"
+#define MYUCP_URL_SCHEME_LENGTH 24
+
+// UCB Content Type.
+#define MYUCP_CONTENT_TYPE \
+ "application/" MYUCP_URL_SCHEME "-content"
+
+//=========================================================================
+
+class ContentProvider : public ::ucb::ContentProviderImplHelper
+{
+public:
+ ContentProvider( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
+ virtual ~ContentProvider();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_DECL()
+
+ // XContentProvider
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent > SAL_CALL
+ queryContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier )
+ throw( ::com::sun::star::ucb::IllegalIdentifierException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_resultset.cxx b/ucbhelper/workben/myucp/myucp_resultset.cxx
new file mode 100644
index 000000000000..07f470972f87
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_resultset.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_resultset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - This implementation is not a dynamic result set!!! It only implements
+ the necessary interfaces, but never recognizes/notifies changes!!!
+
+ *************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_DATASUPPLIER_HXX
+#include "myucp_datasupplier.hxx"
+#endif
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_RESULTSET_HXX
+#include "myucp_resultset.hxx"
+#endif
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//=========================================================================
+//
+// DynamicResultSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+DynamicResultSet::DynamicResultSet(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rxContent,
+ const OpenCommandArgument2& rCommand )
+: ResultSetImplHelper( rxSMgr, rCommand ),
+ m_xContent( rxContent )
+{
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void DynamicResultSet::initStatic()
+{
+ m_xResultSet1
+ = new ::ucb::ResultSet( m_xSMgr,
+ m_aCommand.Properties,
+ new ResultSetDataSupplier( m_xSMgr,
+ m_xContent ) );
+}
+
+//=========================================================================
+void DynamicResultSet::initDynamic()
+{
+ m_xResultSet1
+ = new ::ucb::ResultSet( m_xSMgr,
+ m_aCommand.Properties,
+ new ResultSetDataSupplier( m_xSMgr,
+ m_xContent ) );
+ m_xResultSet2 = m_xResultSet1;
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_resultset.hxx b/ucbhelper/workben/myucp/myucp_resultset.hxx
new file mode 100644
index 000000000000..e6899a26c319
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_resultset.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_resultset.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_RESULTSET_HXX
+#define _MYUCP_RESULTSET_HXX
+
+#ifndef _UCBHELPER_RESULTSETHELPER_HXX
+#include <ucbhelper/resultsethelper.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_CONTENT_HXX
+#include "myucp_content.hxx"
+#endif
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+class DynamicResultSet : public ::ucb::ResultSetImplHelper
+{
+ vos::ORef< Content > m_xContent;
+
+private:
+ virtual void initStatic();
+ virtual void initDynamic();
+
+public:
+ DynamicResultSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const vos::ORef< Content >& rxContent,
+ const com::sun::star::ucb::OpenCommandArgument2& rCommand );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_services.cxx b/ucbhelper/workben/myucp/myucp_services.cxx
new file mode 100644
index 000000000000..0659725a3a72
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_services.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * $RCSfile: myucp_services.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+// @@@ Adjust multi-include-protection-ifdef and header file name.
+#ifndef _MYUCP_PROVIDER_HXX
+#include "myucp_provider.hxx"
+#endif
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+
+//=========================================================================
+static sal_Bool writeInfo( void * pRegistryKey,
+ const OUString & rImplementationName,
+ Sequence< OUString > const & rServiceNames )
+{
+ OUString aKeyName( OUString::createFromAscii( "/" ) );
+ aKeyName += rImplementationName;
+ aKeyName += OUString::createFromAscii( "/UNO/SERVICES" );
+
+ Reference< XRegistryKey > xKey;
+ try
+ {
+ xKey = static_cast< XRegistryKey * >(
+ pRegistryKey )->createKey( aKeyName );
+ }
+ catch ( InvalidRegistryException const & )
+ {
+ }
+
+ if ( !xKey.is() )
+ return sal_False;
+
+ sal_Bool bSuccess = sal_True;
+
+ for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n )
+ {
+ try
+ {
+ xKey->createKey( rServiceNames[ n ] );
+ }
+ catch ( InvalidRegistryException const & )
+ {
+ bSuccess = sal_False;
+ break;
+ }
+ }
+ return bSuccess;
+}
+
+//=========================================================================
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//=========================================================================
+extern "C" sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ return pRegistryKey &&
+
+ //////////////////////////////////////////////////////////////////////
+ // Write info into registry.
+ //////////////////////////////////////////////////////////////////////
+
+ // @@@ Adjust namespace names.
+ writeInfo( pRegistryKey,
+ ::myucp::ContentProvider::getImplementationName_Static(),
+ ::myucp::ContentProvider::getSupportedServiceNames_Static() );
+}
+
+//=========================================================================
+extern "C" void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pRet = 0;
+
+ Reference< XMultiServiceFactory > xSMgr(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
+ Reference< XSingleServiceFactory > xFactory;
+
+ //////////////////////////////////////////////////////////////////////
+ // Create factory, if implementation name matches.
+ //////////////////////////////////////////////////////////////////////
+
+ // @@@ Adjust namespace names.
+ if ( ::myucp::ContentProvider::getImplementationName_Static().
+ compareToAscii( pImplName ) == 0 )
+ {
+ xFactory = ::myucp::ContentProvider::createServiceFactory( xSMgr );
+ }
+
+ //////////////////////////////////////////////////////////////////////
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
+
diff --git a/ucbhelper/workben/ucbexplorer/bmp/document.bmp b/ucbhelper/workben/ucbexplorer/bmp/document.bmp
new file mode 100644
index 000000000000..63baf47eca46
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/document.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/bmp/fldclose.bmp b/ucbhelper/workben/ucbexplorer/bmp/fldclose.bmp
new file mode 100644
index 000000000000..c0f26b337f7a
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/fldclose.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/bmp/fldopen.bmp b/ucbhelper/workben/ucbexplorer/bmp/fldopen.bmp
new file mode 100644
index 000000000000..f38643510e78
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/fldopen.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/bmp/link.bmp b/ucbhelper/workben/ucbexplorer/bmp/link.bmp
new file mode 100644
index 000000000000..0269a76d98d0
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/link.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/makefile.mk b/ucbhelper/workben/ucbexplorer/makefile.mk
new file mode 100644
index 000000000000..ea3ebcc2afc8
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/makefile.mk
@@ -0,0 +1,111 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=UCBEXPLORER
+TARGET=ucbexplorer
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings ---
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files ---
+
+.IF "$(depend)" != ""
+
+OBJFILES=$(OBJ)$/$(TARGET).obj
+
+.ENDIF # depend
+
+SRCFILES=$(TARGET).src
+
+#
+# UCBEXPLORER
+#
+
+APP1TARGET=$(TARGET)
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+
+APP1OBJS=$(OBJ)$/$(TARGET).obj
+APP1RES=$(RES)$/$(TARGET).res
+
+APP1STDLIBS=$(SALLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(TOOLSLIB) \
+ $(SVTOOLLIB) \
+ $(UNOTOOLSLIB) \
+ $(UCBHELPERLIB) \
+ $(SVLIB)
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
new file mode 100644
index 000000000000..8e72263ee671
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
@@ -0,0 +1,1293 @@
+/*************************************************************************
+ *
+ * $RCSfile: ucbexplorer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
+#include <cppuhelper/servicefactory.hxx>
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTCREATOR_HPP_
+#include <com/sun/star/ucb/XContentCreator.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_COMMANDABORTEDEXCEPTION_HPP_
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_CONTENTINFOATTRIBUTE_HPP_
+#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
+#endif
+
+#ifndef _VOS_PROCESS_HXX_
+#include <vos/process.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#include <ucbhelper/contentbroker.hxx>
+#endif
+#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
+#include <ucbhelper/commandenvironment.hxx>
+#endif
+#ifndef _SVTREEBOX_HXX
+#include <svtools/svtreebx.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <vcl/wrkwin.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_MENU_HXX
+#include <vcl/menu.hxx>
+#endif
+#ifndef _SV_DIALOG_HXX
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _SV_FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _SV_GROUP_HXX
+#include <vcl/group.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+
+#ifndef _UCBEXPLORER_HRC
+#include "ucbexplorer.hrc"
+#endif
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+using namespace vos;
+
+//=========================================================================
+//
+// class TestDataSink.
+//
+//=========================================================================
+
+class TestDataSink : public cppu::OWeakObject, public XActiveDataSink
+{
+ Reference< XInputStream > m_xStream;
+
+public:
+// TestDataSink() {}
+// virtual ~TestDataSink();
+
+ // XInterface methods
+ virtual Any SAL_CALL queryInterface( const Type & rType )
+ throw( RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw ( RuntimeException );
+ virtual void SAL_CALL release()
+ throw ( RuntimeException );
+
+ // XActiveDataSink methods.
+ virtual void SAL_CALL setInputStream(
+ const Reference< XInputStream >& aStream )
+ throw( RuntimeException );
+ virtual Reference< XInputStream > SAL_CALL getInputStream()
+ throw( RuntimeException );
+};
+
+//=========================================================================
+//
+// class StringInputDialog.
+//
+//=========================================================================
+
+class StringInputDialog : public ModalDialog
+{
+private:
+ FixedText m_aNameText;
+ Edit m_aNameEdit;
+ GroupBox m_aNameGroup;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ DECL_LINK( OKHdl, Button * );
+ DECL_LINK( NameHdl, Edit * );
+
+public:
+ StringInputDialog( const String& rTitle,
+ const String& rDefaultText,
+ String* pGroupName = 0 );
+ String GetValue() const { return m_aNameEdit.GetText(); }
+ void SetValue( const String& rNewName ) { m_aNameEdit.SetText( rNewName ); }
+};
+
+//=========================================================================
+//
+// class UcbExplorerListBoxEntry.
+//
+//=========================================================================
+
+class UcbExplorerListBoxEntry : public SvLBoxEntry
+{
+ friend class UcbExplorerTreeListBox;
+
+ enum EntryType { FOLDER, DOCUMENT, LINK };
+
+ ::ucb::Content m_aContent;
+ EntryType m_eType;
+
+public:
+ UcbExplorerListBoxEntry();
+ virtual ~UcbExplorerListBoxEntry();
+
+ BOOL createNewContent( const ContentInfo& rInfo,
+ ::ucb::Content& rNewContent );
+};
+
+//=========================================================================
+//
+// class UcbExplorerTreeListBox.
+//
+//=========================================================================
+
+class UcbExplorerTreeListBox : public SvTreeListBox
+{
+ Bitmap m_aFolderClosed;
+ Bitmap m_aFolderOpened;
+ Bitmap m_aDocument;
+ Bitmap m_aLink;
+
+private:
+ virtual SvLBoxEntry* CreateEntry() const;
+ virtual void RequestingChilds( SvLBoxEntry* pParent );
+
+public:
+ UcbExplorerTreeListBox( Window* pParent, WinBits nWinStyle = 0 );
+ virtual ~UcbExplorerTreeListBox();
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ UcbExplorerListBoxEntry*
+ InsertEntry( ::ucb::Content& rContent, SvLBoxEntry* pParent );
+ UcbExplorerListBoxEntry*
+ InsertEntry( const String& rURL, SvLBoxEntry* pParent = 0 );
+};
+
+//=========================================================================
+//
+// class UcbExplorerWindow.
+//
+//=========================================================================
+
+class UcbExplorerWindow : public WorkWindow
+{
+ friend class MyApp;
+
+ UcbExplorerTreeListBox m_aTree;
+
+public:
+ UcbExplorerWindow( Window *pParent, WinBits nWinStyle );
+ virtual ~UcbExplorerWindow();
+
+ virtual void Resize();
+};
+
+//=========================================================================
+//
+// class MyApp.
+//
+//=========================================================================
+
+class MyApp : public Application
+{
+public:
+ virtual void Main();
+};
+
+//=========================================================================
+//
+// TestDataSink implementation.
+//
+//=========================================================================
+
+// virtual
+Any SAL_CALL TestDataSink::queryInterface( const Type & rType )
+ throw( RuntimeException )
+{
+ Any aRet = cppu::queryInterface(
+ rType,
+ static_cast< XActiveDataSink * >( this ) );
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL TestDataSink::acquire()
+ throw( RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL TestDataSink::release()
+ throw( RuntimeException )
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL TestDataSink::setInputStream(
+ const Reference< XInputStream >& aStream )
+ throw( RuntimeException )
+{
+ m_xStream = aStream;
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL TestDataSink::getInputStream()
+ throw( RuntimeException )
+{
+ return m_xStream;
+}
+
+//=========================================================================
+//
+// StringInputDialog implementation.
+//
+//=========================================================================
+
+StringInputDialog::StringInputDialog( const String& rTitle,
+ const String& rDefaultText,
+ String* pGroupName )
+: ModalDialog( GetpApp()->GetDefModalDialogParent(), ResId( DLG_STRINGINPUT ) ),
+ m_aNameText ( this, ResId( FT_STRINGINPUT_DLG_NAME ) ),
+ m_aNameEdit ( this, ResId( ED_STRINGINPUT_DLG_NAME ) ),
+ m_aNameGroup( this, ResId( GB_STRINGINPUT_DLG_NAME ) ),
+ m_aOKBtn ( this, ResId( BT_STRINGINPUT_DLG_OK ) ),
+ m_aCancelBtn( this, ResId( BT_STRINGINPUT_DLG_CANCEL ) ),
+ m_aHelpBtn ( this, ResId( BT_STRINGINPUT_DLG_HELP ) )
+{
+ FreeResource();
+ SetText( rTitle );
+ m_aNameEdit.SetText( rDefaultText );
+ m_aOKBtn.SetClickHdl( LINK( this, StringInputDialog, OKHdl ) );
+ m_aNameEdit.SetModifyHdl( LINK( this, StringInputDialog, NameHdl ) );
+
+ if ( pGroupName )
+ m_aNameGroup.SetText( *pGroupName );
+};
+
+//=========================================================================
+IMPL_LINK( StringInputDialog, OKHdl, Button *, EMPTYARG )
+{
+ // trim the strings
+ m_aNameEdit.SetText(
+ m_aNameEdit.GetText().EraseLeadingChars().EraseTrailingChars() );
+ EndDialog( RET_OK );
+ return 1;
+}
+
+//=========================================================================
+IMPL_LINK( StringInputDialog, NameHdl, Edit *, EMPTYARG )
+{
+ // trim the strings
+ String aName = m_aNameEdit.GetText();
+ aName.EraseLeadingChars().EraseTrailingChars();
+ if ( aName.Len() )
+ {
+ if ( !m_aOKBtn.IsEnabled() )
+ m_aOKBtn.Enable( TRUE );
+ }
+ else
+ {
+ if ( m_aOKBtn.IsEnabled() )
+ m_aOKBtn.Enable( FALSE );
+ }
+ return 0;
+}
+
+//=========================================================================
+//
+// UcbExplorerListBoxEntry implementation.
+//
+//=========================================================================
+
+UcbExplorerListBoxEntry::UcbExplorerListBoxEntry()
+{
+}
+
+//=========================================================================
+// virtual
+UcbExplorerListBoxEntry::~UcbExplorerListBoxEntry()
+{
+}
+
+//=========================================================================
+BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
+ ::ucb::Content& rNewContent )
+{
+ sal_Int32 nCount = rInfo.Properties.getLength();
+ Sequence< Any > aPropValues( nCount );
+ Sequence< OUString > aPropNames( nCount );
+
+ if ( nCount > 0 )
+ {
+ // Collect property values.
+
+ Any* pValues = aPropValues.getArray();
+ const Property* pProps = rInfo.Properties.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rName = pProps[ n ].Name;
+ StringInputDialog* pDlg = new StringInputDialog( rName, rName );
+ USHORT nRet = pDlg->Execute();
+ if ( nRet == RET_OK )
+ {
+ OUString aValue( pDlg->GetValue() );
+
+ // Convert value according to supplied type info...
+
+ const Type& rType = pProps[ n ].Type;
+
+ if ( rType == getCppuType(
+ static_cast< const OUString * >( 0 ) ) )
+ {
+ // string
+ pValues[ n ] <<= aValue;
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int32 * >( 0 ) ) )
+ {
+ // long
+ pValues[ n ] <<= aValue.toInt32();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int16 * >( 0 ) ) )
+ {
+ // short
+ pValues[ n ] <<= sal_Int16( aValue.toInt32() ) ;
+ }
+ else if ( rType == getCppuBooleanType() )
+ {
+ // boolean
+ pValues[ n ] <<= sal_Bool( aValue.toChar() ) ;
+ }
+ else if ( rType == getCppuCharType() )
+ {
+ // char
+ pValues[ n ] <<= aValue.toChar();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int8 * >( 0 ) ) )
+ {
+ // byte
+ pValues[ n ] <<= sal_Int8( aValue.toChar() ) ;
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int64 * >( 0 ) ) )
+ {
+ // hyper
+ pValues[ n ] <<= aValue.toInt64();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const float * >( 0 ) ) )
+ {
+ // float
+ pValues[ n ] <<= aValue.toFloat();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const double * >( 0 ) ) )
+ {
+ // double
+ pValues[ n ] <<= aValue.toDouble();
+ }
+ else
+ {
+ // See com/sun/star/ucb/ContentInfo.idl
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "Invlid type for bootstrap property!" );
+ }
+ }
+
+ delete pDlg;
+
+ if ( nRet != RET_OK )
+ return FALSE;
+
+ aPropNames[ n ] = rName;
+ }
+ }
+
+ Reference< XInputStream > xData;
+
+ if ( rInfo.Attributes & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM )
+ {
+ // Let the user specify the URL of a content containing the
+ // data to supply to the new content.
+
+ StringInputDialog* pDlg = new StringInputDialog(
+ OUString::createFromAscii(
+ "Document Data Source URL" ),
+ OUString() );
+ USHORT nRet = pDlg->Execute();
+ if ( nRet == RET_OK )
+ {
+ // Create a content object for the given URL.
+
+ OUString aSourceURL( pDlg->GetValue() );
+ if ( aSourceURL.getLength() == 0 )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "No document data URL!" );
+ return FALSE;
+ }
+
+ try
+ {
+ Reference< XCommandEnvironment > xEnv;
+
+ ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ if ( pBroker )
+ {
+ Reference< XInteractionHandler > xInteractionHandler(
+ pBroker->getServiceManager()->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.uui.InteractionHandler" ) ),
+ UNO_QUERY );
+
+ Reference< XProgressHandler > xProgressHandler
+ /* = new ProgressHandler( *pBroker ) */ ;
+
+ xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
+ }
+
+ ::ucb::Content aSourceContent( aSourceURL, xEnv );
+
+ // Get source data.
+ vos::ORef< TestDataSink > xSourceData = new TestDataSink;
+ aSourceContent.openStream( xSourceData.getBodyPtr() );
+ xData = xSourceData->getInputStream();
+ }
+ catch ( ::ucb::ContentCreationException& )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "No content for document data!" );
+ return FALSE;
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "CommandAbortedException!" );
+ return FALSE;
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "Exception!" );
+ return FALSE;
+ }
+ }
+
+ delete pDlg;
+
+ if ( nRet != RET_OK )
+ return FALSE;
+ }
+
+ // Create new content.
+
+ ULONG n = Application::ReleaseSolarMutex();
+ BOOL bRet = sal_False;
+
+ try
+ {
+ bRet = m_aContent.insertNewContent(
+ rInfo.Type, aPropNames, aPropValues, xData, rNewContent );
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "CommandAbortedException!" );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "Exception!" );
+ }
+
+ Application::AcquireSolarMutex( n );
+ return bRet;
+}
+
+//=========================================================================
+//
+// UcbExplorerTreeListBox implementation.
+//
+//=========================================================================
+
+UcbExplorerTreeListBox::UcbExplorerTreeListBox(
+ Window* pParent, WinBits nWinStyle )
+: SvTreeListBox( pParent, nWinStyle ),
+ m_aFolderClosed( ResId( BMP_FOLDER_CLOSED ) ),
+ m_aFolderOpened( ResId( BMP_FOLDER_OPENED ) ),
+ m_aDocument( ResId( BMP_DOCUMENT ) ),
+ m_aLink( ResId( BMP_LINK ) )
+{
+}
+
+//=========================================================================
+// virtual
+UcbExplorerTreeListBox::~UcbExplorerTreeListBox()
+{
+}
+
+//=========================================================================
+// virtual
+SvLBoxEntry* UcbExplorerTreeListBox::CreateEntry() const
+{
+ return new UcbExplorerListBoxEntry();
+}
+
+//=========================================================================
+// virtual
+void UcbExplorerTreeListBox::RequestingChilds( SvLBoxEntry* pParent )
+{
+ UcbExplorerListBoxEntry* pEntry
+ = static_cast< UcbExplorerListBoxEntry * >( pParent );
+ if ( !pEntry->HasChilds() )
+ {
+ switch ( pEntry->m_eType )
+ {
+ case UcbExplorerListBoxEntry::FOLDER:
+ {
+ ULONG n = Application::ReleaseSolarMutex();
+
+ try
+ {
+ Sequence< OUString > aPropertyNames( 0 );
+// OUString* pNames = aPropertyNames.getArray();
+// pNames[ 0 ] = OUString::createFromAscii( "Title" );
+
+ Reference< XResultSet > xResultSet
+ = pEntry->m_aContent.createCursor(
+ aPropertyNames,
+ ::ucb::INCLUDE_FOLDERS_AND_DOCUMENTS );
+ Reference< XContentAccess > xContentAccess(
+ xResultSet, UNO_QUERY );
+
+ if ( xResultSet.is() && xContentAccess.is() )
+ {
+ while ( xResultSet->next() )
+ {
+ Application::AcquireSolarMutex( n );
+
+ InsertEntry(
+ xContentAccess->queryContentIdentfierString(),
+ pParent );
+
+ n = Application::ReleaseSolarMutex();
+ }
+ }
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR(
+ "UcbExplorerTreeListBox::RequestingChilds - "
+ "CommandAbortedException!" );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR(
+ "UcbExplorerTreeListBox::RequestingChilds - "
+ "Exception!" );
+ }
+ Application::AcquireSolarMutex( n );
+ break;
+ }
+
+ case UcbExplorerListBoxEntry::DOCUMENT:
+ break;
+
+ case UcbExplorerListBoxEntry::LINK:
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ const Point& rPos = rCEvt.GetMousePosPixel();
+ UcbExplorerListBoxEntry* pEntry
+ = static_cast< UcbExplorerListBoxEntry * >(
+ GetEntry( rPos, TRUE ) );
+ if ( pEntry )
+ {
+ PopupMenu* pMenu = new PopupMenu( ResId( MENU_POPUP ) );
+ PopupMenu* pNewMenu = 0;
+
+// pMenu->SetSelectHdl( LINK( this,
+// SfxCommonTemplateDialog_Impl,
+// MenuSelectHdl ) );
+
+ //////////////////////////////////////////////////////////////
+ // Configure "New"
+ //////////////////////////////////////////////////////////////
+
+ Reference< XContentCreator > xCreator(
+ pEntry->m_aContent.get(), UNO_QUERY );
+ Sequence< ContentInfo > aInfo;
+ BOOL bCanCreate = xCreator.is();
+ if ( bCanCreate )
+ {
+ aInfo = xCreator->queryCreatableContentsInfo();
+ const ContentInfo* pInfo = aInfo.getConstArray();
+ sal_Int32 nCount = aInfo.getLength();
+ bCanCreate = ( nCount > 0 );
+
+ pNewMenu = new PopupMenu;
+ pMenu->SetPopupMenu( MENU_NEW, pNewMenu );
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const ContentInfo& rInfo = pInfo[ n ];
+ pNewMenu->InsertItem( 20000 + n + 1, rInfo.Type );
+ }
+ }
+
+ pMenu->EnableItem( MENU_NEW, bCanCreate );
+
+ //////////////////////////////////////////////////////////////
+ // Configure "Rename"
+ //////////////////////////////////////////////////////////////
+
+ sal_Bool bEnable = sal_False;
+
+ try
+ {
+ Property aProp =
+ pEntry->m_aContent.getProperties()->getPropertyByName(
+ OUString::createFromAscii( "Title" ) );
+ bEnable = !( aProp.Attributes & PropertyAttribute::READONLY );
+ }
+ catch( UnknownPropertyException& )
+ {
+ // getPropertyByName
+ bEnable = sal_False;
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "CommandAbortedException!" );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "Exception!" );
+ }
+
+ pMenu->EnableItem( MENU_RENAME, bEnable );
+
+ //////////////////////////////////////////////////////////////
+ // Configure "Delete"
+ //////////////////////////////////////////////////////////////
+
+ try
+ {
+ pMenu->EnableItem( MENU_DELETE,
+ pEntry->m_aContent
+ .getCommands()->hasCommandByName(
+ OUString::createFromAscii(
+ "delete" ) ) );
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "CommandAbortedException!" );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "Exception!" );
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Execute menu.
+ //////////////////////////////////////////////////////////////
+
+ USHORT nSelected = pMenu->Execute( this, rPos );
+ switch ( nSelected )
+ {
+// case MENU_NEW:
+// break;
+
+ case MENU_RENAME:
+ {
+ OUString aNewTitle;
+
+ try
+ {
+ pEntry->m_aContent.getPropertyValue(
+ OUString::createFromAscii( "Title" ) )
+ >>= aNewTitle;
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "CommandAbortedException!" );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "Exception!" );
+ }
+
+ StringInputDialog* pDlg
+ = new StringInputDialog(
+ OUString::createFromAscii( "Title" ),
+ aNewTitle );
+
+ USHORT nRet = pDlg->Execute();
+
+ Any aValue;
+
+ if ( nRet == RET_OK )
+ {
+ aNewTitle = pDlg->GetValue();
+ aValue <<= aNewTitle;
+ }
+
+ delete pDlg;
+
+ if ( nRet != RET_OK )
+ break;
+
+ sal_Bool bOK = sal_False;
+
+ ULONG n = Application::ReleaseSolarMutex();
+
+ try
+ {
+ pEntry->m_aContent.setPropertyValue(
+ OUString::createFromAscii( "Title" ),
+ aValue );
+ bOK = sal_True;
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "CommandAbortedException!" );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR( "UcbExplorerTreeListBox::Command - "
+ "Exception!" );
+ }
+
+ Application::AcquireSolarMutex( n );
+
+ if ( bOK )
+ {
+ OUString aText( aNewTitle );
+ OUString aTargetURL;
+ try
+ {
+ pEntry->m_aContent.getPropertyValue(
+ OUString::createFromAscii( "TargetURL" ) )
+ >>= aTargetURL;
+ }
+ catch ( CommandAbortedException& )
+ {
+ // The property is optional!
+ }
+
+ if ( aTargetURL.getLength() > 0 )
+ {
+ // Insert link.
+ aText += OUString::createFromAscii( " --> " );
+ aText += aTargetURL;
+ }
+
+ SetEntryText( pEntry, aText );
+ }
+ break;
+ }
+
+ case MENU_DELETE:
+ {
+ ULONG n = Application::ReleaseSolarMutex();
+ sal_Bool bOK = sal_True;
+
+ try
+ {
+ pEntry->m_aContent.executeCommand(
+ OUString::createFromAscii( "delete" ),
+ makeAny( sal_True ) );
+ }
+ catch ( CommandAbortedException& )
+ {
+ DBG_ERROR(
+ "UcbExplorerTreeListBox::Command - "
+ "CommandAbortedException!" );
+ bOK = sal_False;
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR(
+ "UcbExplorerTreeListBox::Command - "
+ "Exception!" );
+ bOK = sal_False;
+ }
+
+ Application::AcquireSolarMutex( n );
+
+ if ( bOK )
+ RemoveSelection();
+
+ break;
+ }
+
+ default:
+ {
+ if ( ( nSelected > 20000 ) &&
+ ( ( nSelected - 20000 ) <= aInfo.getLength() ) )
+ {
+ // New-menu entry selected.
+
+ ::ucb::Content aNewContent;
+ if ( pEntry->createNewContent(
+ aInfo.getConstArray()[ nSelected - 20001 ],
+ aNewContent ) )
+ {
+ if ( !IsExpanded( pEntry ) )
+ Expand( pEntry );
+ else
+ InsertEntry( aNewContent, pEntry );
+ }
+ }
+ break;
+ }
+ }
+
+ delete pMenu;
+ delete pNewMenu;
+ return;
+ }
+ }
+
+ SvTreeListBox::Command( rCEvt );
+}
+
+//=========================================================================
+UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
+ ::ucb::Content& rContent,
+ SvLBoxEntry* pParent )
+{
+ try
+ {
+ OUString aTitle;
+ rContent.getPropertyValue(
+ OUString::createFromAscii( "Title" ) ) >>= aTitle;
+ if ( !aTitle.getLength() )
+ aTitle = OUString::createFromAscii( "/" );
+
+ UcbExplorerListBoxEntry* pEntry = 0;
+
+ if ( rContent.isFolder() )
+ {
+ // Insert folder.
+ pEntry = static_cast< UcbExplorerListBoxEntry * >(
+ SvTreeListBox::InsertEntry( aTitle,
+ m_aFolderOpened,
+ m_aFolderClosed,
+ pParent,
+ TRUE ) );
+ pEntry->m_eType = UcbExplorerListBoxEntry::FOLDER;
+ }
+ else
+ {
+ OUString aTargetURL;
+ try
+ {
+ rContent.getPropertyValue(
+ OUString::createFromAscii( "TargetURL" ) ) >>= aTargetURL;
+ }
+ catch ( CommandAbortedException& )
+ {
+ // The property is optional!
+ }
+
+ if ( aTargetURL.getLength() > 0 )
+ {
+ // Insert link.
+ aTitle += OUString::createFromAscii( " --> " );
+ aTitle += aTargetURL;
+ pEntry = static_cast< UcbExplorerListBoxEntry * >(
+ SvTreeListBox::InsertEntry( aTitle,
+ m_aLink,
+ m_aLink,
+ pParent,
+ TRUE ) );
+ pEntry->m_eType = UcbExplorerListBoxEntry::LINK;
+ }
+ else
+ {
+ // Insert Document
+ pEntry = static_cast< UcbExplorerListBoxEntry * >(
+ SvTreeListBox::InsertEntry( aTitle,
+ m_aDocument,
+ m_aDocument,
+ pParent,
+ TRUE ) );
+ pEntry->m_eType = UcbExplorerListBoxEntry::DOCUMENT;
+ }
+ }
+
+ pEntry->m_aContent = rContent;
+ return pEntry;
+ }
+ catch ( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERROR(
+ "UcbExplorerTreeListBox::InsertEntry - CommandAbortedException!" );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERROR(
+ "UcbExplorerTreeListBox::InsertEntry - Exception!" );
+ }
+
+ return 0;
+}
+
+//=========================================================================
+UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
+ const String& rURL,
+ SvLBoxEntry* pParent )
+{
+ try
+ {
+ Reference< XCommandEnvironment > xEnv;
+
+ ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ if ( pBroker )
+ {
+ Reference< XInteractionHandler > xInteractionHandler(
+ pBroker->getServiceManager()->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.uui.InteractionHandler" ) ),
+ UNO_QUERY );
+
+ Reference< XProgressHandler > xProgressHandler
+ /* = new ProgressHandler( *pBroker ) */ ;
+
+ xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
+ }
+
+ ::ucb::Content aContent( rURL, xEnv );
+ return InsertEntry( aContent, pParent );
+ }
+ catch ( ::ucb::ContentCreationException& )
+ {
+ DBG_ERROR(
+ "UcbExplorerTreeListBox::InsertEntry - ContentCreationException!" );
+ }
+
+ return 0;
+}
+
+//=========================================================================
+//
+// UcbExplorerWindow implementation.
+//
+//=========================================================================
+
+UcbExplorerWindow::UcbExplorerWindow( Window *pParent, WinBits nWinStyle )
+: WorkWindow( pParent, nWinStyle ),
+ m_aTree( this, WB_HSCROLL )
+{
+ Font aTreeFont( m_aTree.GetFont() );
+ aTreeFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM("Courier") ) );
+ aTreeFont.SetFamily( FAMILY_MODERN );
+ aTreeFont.SetPitch( PITCH_FIXED );
+ aTreeFont.SetSize( Size( 0, 12 ) );
+
+ m_aTree.SetFont( aTreeFont );
+ m_aTree.SetIndent( 20 );
+ m_aTree.SetPosPixel( Point( 0, 0 ) );
+
+ m_aTree.Show();
+}
+
+//-------------------------------------------------------------------------
+// virtual
+UcbExplorerWindow::~UcbExplorerWindow()
+{
+}
+
+//-------------------------------------------------------------------------
+// virtual
+void UcbExplorerWindow::Resize()
+{
+ m_aTree.SetSizePixel( GetOutputSizePixel() );
+}
+
+//=========================================================================
+//
+// MyApp implementation.
+//
+//=========================================================================
+
+// virtual
+void MyApp::Main()
+{
+ //////////////////////////////////////////////////////////////////////
+ // Initialize local Service Manager and basic services.
+ //////////////////////////////////////////////////////////////////////
+
+ OStartupInfo aInfo;
+ OUString aExeName;
+ if ( aInfo.getExecutableFile( aExeName )
+ != OStartupInfo::E_None )
+ {
+ DBG_ERROR( "Error getting Executable file name!" );
+ return;
+ }
+
+ OUString aReadOnlyRegFile
+ = aExeName.copy( 0, aExeName.lastIndexOf( '/' ) + 1 );
+ OUString aWritableRegFile
+ = aReadOnlyRegFile;
+ aReadOnlyRegFile += OUString::createFromAscii( "applicat.rdb" );
+ aWritableRegFile += OUString::createFromAscii( "ucbexplorer.rdb" );
+
+ Reference< XMultiServiceFactory > xFac;
+ try
+ {
+ xFac = cppu::createRegistryServiceFactory(
+ aWritableRegFile, aReadOnlyRegFile );
+ }
+ catch ( com::sun::star::uno::Exception )
+ {
+ DBG_ERROR( "Error creating RegistryServiceFactory!" );
+ return;
+ }
+
+ utl::setProcessServiceFactory( xFac );
+
+ Reference< XComponent > xComponent( xFac, UNO_QUERY );
+
+ //////////////////////////////////////////////////////////////////////
+ // Create UCB.
+ //////////////////////////////////////////////////////////////////////
+
+ Sequence< Any > aArgs(1);
+ aArgs[0] <<= sal_True;
+ sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFac, aArgs );
+
+ if ( !bSuccess )
+ {
+ DBG_ERROR( "Error creating UCB!" );
+ return;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Create/init/show app window.
+ //////////////////////////////////////////////////////////////////////
+
+ ResMgr* pMgr = ResMgr::CreateResMgr(
+ CREATEVERSIONRESMGR_NAME( ucbexplorer ) );
+ Resource::SetResManager( pMgr );
+
+ UcbExplorerWindow aAppWin( 0, WB_APP | WB_STDWORK );
+
+ MenuBar aMBMain( ResId( MENU_MAIN ) );
+
+ // Check for command line params
+#if 0
+ for ( int i = 0; i < GetCommandLineParamCount(); ++i )
+ {
+ String aPara = GetCommandLineParam( i );
+ }
+#endif
+
+ String aRootURL = GetCommandLineParam( 0 );
+ if ( aRootURL.Len() == 0 )
+ aRootURL = UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.hier:/" ) );
+
+ String aTitle( ResId( TEXT_TITLEBAR ) );
+ aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ) );
+ aTitle += aRootURL;
+
+ aAppWin.SetText( aTitle );
+
+ aAppWin.SetPosSizePixel( 0, 0, 500, 750 );
+
+ aAppWin.Show();
+
+ aAppWin.m_aTree.InsertEntry( aRootURL );
+
+ //////////////////////////////////////////////////////////////////////
+ // Execute app.
+ //////////////////////////////////////////////////////////////////////
+
+ Execute();
+
+ //////////////////////////////////////////////////////////////////////
+ // Cleanup.
+ //////////////////////////////////////////////////////////////////////
+
+ // m_aTree holds UCB contents!
+ aAppWin.m_aTree.Clear();
+
+ ::ucb::ContentBroker::deinitialize();
+
+ if ( xComponent.is() )
+ xComponent->dispose();
+}
+
+//=========================================================================
+//
+// The Application.
+//
+//=========================================================================
+
+MyApp aMyApp;
+
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.hrc b/ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
new file mode 100644
index 000000000000..0d8ab2b5c60d
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * $RCSfile: ucbexplorer.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//=========================================================================
+//
+// UCB Explorer ( resource identifiers )
+//
+// (C) 2000 StarOffice Entwicklungs GmbH, Hamburg, Germany
+//
+// $Author: hr $ $Date: 2000-09-18 17:03:38 $Revision: 1.4 $
+//
+//=========================================================================
+
+#ifndef _UCBEXPLORER_HRC
+#define _UCBEXPLORER_HRC
+
+#define MENU_MAIN 1000
+#define MENU_FILE 100
+#define MENU_EXIT 10
+
+#define MENU_POPUP 1001
+#define MENU_NEW 10
+#define MENU_RENAME 11
+#define MENU_DELETE 12
+
+#define TEXT_TITLEBAR 5000
+
+#define BMP_FOLDER_CLOSED 6001
+#define BMP_FOLDER_OPENED 6002
+#define BMP_DOCUMENT 6003
+#define BMP_LINK 6004
+
+#define DLG_STRINGINPUT 7000
+#define FT_STRINGINPUT_DLG_NAME 10
+#define ED_STRINGINPUT_DLG_NAME 11
+#define GB_STRINGINPUT_DLG_NAME 12
+#define BT_STRINGINPUT_DLG_OK 13
+#define BT_STRINGINPUT_DLG_CANCEL 14
+#define BT_STRINGINPUT_DLG_HELP 15
+
+
+#endif /* !_UCBEXPLORER_HRC */
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.src b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
new file mode 100644
index 000000000000..a29fa31bec19
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * $RCSfile: ucbexplorer.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//=========================================================================
+//
+// UCB Explorer ( resources )
+//
+// (C) 2000 StarOffice Entwicklungs GmbH, Hamburg, Germany
+//
+// $Author: hr $ $Date: 2000-09-18 17:03:38 $Revision: 1.4 $
+//
+//=========================================================================
+
+#include "ucbexplorer.hrc"
+
+Menu MENU_MAIN
+{
+ ItemList =
+
+ {
+ MenuItem
+ {
+ Identifier = MENU_FILE ;
+ Text = "~File" ;
+ SubMenu = Menu
+ {
+ ItemList =
+
+ {
+ MenuItem
+ {
+ Identifier = MENU_EXIT ;
+ Text = "~Exit" ;
+ Text [ English ] = "~Exit" ;
+ AccelKey = KeyCode
+ {
+ Function = KEYFUNC_QUIT ;
+ };
+ };
+ };
+ };
+ };
+ };
+};
+
+Menu MENU_POPUP
+{
+ ItemList =
+
+ {
+ MenuItem
+ {
+ Identifier = MENU_NEW ;
+ Text = "~New" ;
+ };
+ MenuItem
+ {
+ Identifier = MENU_RENAME ;
+ Text = "~Rename" ;
+ };
+ MenuItem
+ {
+ Identifier = MENU_DELETE ;
+ Text = "~Delete" ;
+ };
+ };
+};
+
+Bitmap BMP_FOLDER_CLOSED
+{
+ File = "bmp/fldclose.bmp" ;
+};
+Bitmap BMP_FOLDER_OPENED
+{
+ File = "bmp/fldopen.bmp" ;
+};
+Bitmap BMP_DOCUMENT
+{
+ File = "bmp/document.bmp" ;
+};
+Bitmap BMP_LINK
+{
+ File = "bmp/link.bmp" ;
+};
+
+ModalDialog DLG_STRINGINPUT
+{
+//! HelpId = ;
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+// Text = "" ;
+ Size = MAP_APPFONT ( 218 , 44 ) ;
+ FixedText FT_STRINGINPUT_DLG_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 18 ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text = "~Value" ;
+ };
+ Edit ED_STRINGINPUT_DLG_NAME
+ {
+ Pos = MAP_APPFONT ( 40 , 16 ) ;
+ Size = MAP_APPFONT ( 110 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ };
+ GroupBox GB_STRINGINPUT_DLG_NAME
+ {
+ Group = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 150 , 36 ) ;
+// Text = "" ;
+ };
+ OKButton BT_STRINGINPUT_DLG_OK
+ {
+ Pos = MAP_APPFONT ( 162 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_STRINGINPUT_DLG_CANCEL
+ {
+ Pos = MAP_APPFONT ( 162 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BT_STRINGINPUT_DLG_HELP
+ {
+ Pos = MAP_APPFONT ( 162 , 200 ) ;
+ /*sic!*/
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+String TEXT_TITLEBAR
+{
+ Text = "UCB Explorer" ;
+};
+
diff --git a/unotools/inc/unotools/charclass.hxx b/unotools/inc/unotools/charclass.hxx
new file mode 100644
index 000000000000..1cd1b3da19ac
--- /dev/null
+++ b/unotools/inc/unotools/charclass.hxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * $RCSfile: charclass.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#define _UNOTOOLS_CHARCLASS_HXX
+
+#include <ctype.h> // isdigit(), isalpha()
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_KCHARACTERTYPE_HPP_
+#include <com/sun/star/lang/KCharacterType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_KPARSETOKENS_HPP_
+#include <com/sun/star/lang/KParseTokens.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_KPARSETYPE_HPP_
+#include <com/sun/star/lang/KParseType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_PARSERESULT_HPP_
+#include <com/sun/star/lang/ParseResult.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCHARACTERCLASSIFICATION_HPP_
+#include <com/sun/star/lang/XCharacterClassification.hpp>
+#endif
+
+class String;
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+}}}
+
+const sal_Int32 nCharClassAlphaType =
+ ::com::sun::star::lang::KCharacterType::UPPER |
+ ::com::sun::star::lang::KCharacterType::LOWER |
+ ::com::sun::star::lang::KCharacterType::TITLE_CASE;
+
+const sal_Int32 nCharClassAlphaTypeMask =
+ nCharClassAlphaType |
+ ::com::sun::star::lang::KCharacterType::PRINTABLE |
+ ::com::sun::star::lang::KCharacterType::BASE_FORM;
+
+const sal_Int32 nCharClassLetterType =
+ nCharClassAlphaType |
+ ::com::sun::star::lang::KCharacterType::LETTER;
+
+const sal_Int32 nCharClassLetterTypeMask =
+ nCharClassAlphaTypeMask |
+ ::com::sun::star::lang::KCharacterType::LETTER;
+
+class CharClass
+{
+ ::com::sun::star::lang::Locale aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XCharacterClassification > xCC;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+
+ // not implemented, prevent usage
+ CharClass( const CharClass& );
+ CharClass& operator=( const CharClass& );
+
+ // instantiate component somehow
+ void getComponentInstance();
+
+public:
+ /// Preferred ctor with service manager specified
+ CharClass(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
+ const ::com::sun::star::lang::Locale& rLocale
+ );
+
+ /// Depricated ctor, tries to get a process service manager or to load the
+ /// library directly.
+ CharClass(
+ const ::com::sun::star::lang::Locale& rLocale
+ );
+
+ ~CharClass();
+
+ /// set a new Locale
+ void setLocale( const ::com::sun::star::lang::Locale& rLocale );
+
+ /// get current Locale
+ const ::com::sun::star::lang::Locale& getLocale() const { return aLocale; }
+
+
+ /// isdigit() on ascii values
+ static inline sal_Bool isAsciiDigit( sal_Unicode c )
+ { return c < 128 ? (isdigit( (unsigned char) c ) != 0) : 0; }
+
+ /// isalpha() on ascii values
+ static inline sal_Bool isAsciiAlpha( sal_Unicode c )
+ { return c < 128 ? (isalpha( (unsigned char) c ) != 0) : 0; }
+
+ /// isalnum() on ascii values
+ static inline sal_Bool isAsciiAlphaNumeric( sal_Unicode c )
+ { return c < 128 ? (isalnum( (unsigned char) c ) != 0) : 0; }
+
+ /// isdigit() on ascii values of entire string
+ static sal_Bool isAsciiNumeric( const String& rStr );
+
+ /// isalpha() on ascii values of entire string
+ static sal_Bool isAsciiAlpha( const String& rStr );
+
+ /// isalnum() on ascii values of entire string
+ static sal_Bool isAsciiAlphaNumeric( const String& rStr );
+
+ /// whether type is pure alpha or not, e.g. return of getStringType
+ static inline sal_Bool isAlphaType( sal_Int32 nType )
+ {
+ return ((nType & nCharClassAlphaType) != 0) &&
+ (nType & ~(nCharClassAlphaTypeMask) == 0);
+ }
+
+ /// whether type is pure numeric or not, e.g. return of getStringType
+ static inline sal_Bool isNumericType( sal_Int32 nType )
+ {
+ return ((nType &
+ ::com::sun::star::lang::KCharacterType::DIGIT) != 0) &&
+ ((nType & ~(::com::sun::star::lang::KCharacterType::DIGIT |
+ ::com::sun::star::lang::KCharacterType::PRINTABLE)) == 0);
+ }
+
+ /// whether type is pure alphanumeric or not, e.g. return of getStringType
+ static inline sal_Bool isAlphaNumericType( sal_Int32 nType )
+ {
+ return ((nType & (nCharClassAlphaType |
+ ::com::sun::star::lang::KCharacterType::DIGIT)) != 0) &&
+ ((nType & ~(nCharClassAlphaTypeMask |
+ ::com::sun::star::lang::KCharacterType::DIGIT)) == 0);
+ }
+
+ /// whether type is pure letter or not, e.g. return of getStringType
+ static inline sal_Bool isLetterType( sal_Int32 nType )
+ {
+ return ((nType & nCharClassLetterType) != 0) &&
+ (nType & ~(nCharClassLetterTypeMask) == 0);
+ }
+
+ /// whether type is pure letternumeric or not, e.g. return of getStringType
+ static inline sal_Bool isLetterNumericType( sal_Int32 nType )
+ {
+ return ((nType & (nCharClassLetterType |
+ ::com::sun::star::lang::KCharacterType::DIGIT)) != 0) &&
+ ((nType & ~(nCharClassLetterTypeMask |
+ ::com::sun::star::lang::KCharacterType::DIGIT)) == 0);
+ }
+
+
+ // Wrapper implementations of class CharacterClassification
+
+ String toUpper( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+ String toLower( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+ String toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+
+ sal_Int16 getType( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int16 getCharacterDirection( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int16 getScript( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int32 getCharacterType( const String& rStr, xub_StrLen nPos ) const;
+ sal_Int32 getStringType( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const;
+
+ ::com::sun::star::lang::ParseResult parseAnyToken(
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const;
+
+ ::com::sun::star::lang::ParseResult parsePredefinedToken(
+ sal_Int32 nTokenType,
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const;
+
+
+ // Functionality of class International methods
+
+ sal_Bool isAlpha( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isLetter( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isDigit( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isLetterNumeric( const String& rStr, xub_StrLen nPos ) const;
+ sal_Bool isAlpha( const String& rStr ) const;
+ sal_Bool isLetter( const String& rStr ) const;
+ sal_Bool isNumeric( const String& rStr ) const;
+ sal_Bool isAlphaNumeric( const String& rStr ) const;
+ sal_Bool isLetterNumeric( const String& rStr ) const;
+
+ void toUpper( String& rStr ) const
+ { rStr = toUpper( rStr, 0, rStr.Len() ); }
+ void toLower( String& rStr ) const
+ { rStr = toLower( rStr, 0, rStr.Len() ); }
+ inline String upper( const String& rStr ) const
+ { return toUpper( rStr, 0, rStr.Len() ); }
+ inline String lower( const String& rStr ) const
+ { return toLower( rStr, 0, rStr.Len() ); }
+};
+
+
+
+#endif // _UNOTOOLS_CHARCLASS_HXX
diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx
new file mode 100644
index 000000000000..827fa8558a9f
--- /dev/null
+++ b/unotools/inc/unotools/configitem.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: configitem.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UTL_CONFIGITEM_HXX_
+#define _UTL_CONFIGITEM_HXX_
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+//-----------------------------------------------------------------------------
+namespace com{ namespace sun{ namespace star{
+ namespace uno{
+ class Any;
+ }
+ namespace beans{
+ class XMultiPropertySet;
+ struct PropertyValue;
+ }
+ namespace container{
+ class XHierarchicalNameAccess;
+ }
+ namespace util{
+ class XChangesListener;
+ }
+}}}
+//-----------------------------------------------------------------------------
+namespace utl
+{
+ class ConfigChangeListener_Impl;
+ class ConfigManager;
+ class ConfigItem
+ {
+ friend class ConfigChangeListener_Impl;
+
+ const rtl::OUString sSubTree;
+ com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet>
+ xMultPrSet;
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess>
+ xHierarchyAccess;
+ com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
+ xChangeLstnr;
+ utl::ConfigManager* pManager;
+ sal_Bool bIsModified : 1; //
+ sal_Bool bInPutValues : 1; //prevent notification of own change actions
+ sal_Bool bHasChangedProperties : 1; //call XChangesBatch::Commit() if any changes were notified
+
+ ConfigItem();//
+ void RemoveListener();
+ void CallNotify(
+ const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+
+ protected:
+ ConfigItem(const rtl::OUString rSubTree);
+
+ void SetModified() {bIsModified = sal_True;}
+
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any>
+ GetProperties(const com::sun::star::uno::Sequence< rtl::OUString >& rNames);
+
+ sal_Bool PutProperties(
+ const com::sun::star::uno::Sequence< rtl::OUString >& rNames,
+ const com::sun::star::uno::Sequence< com::sun::star::uno::Any>& rValues);
+
+ sal_Bool EnableNotification(com::sun::star::uno::Sequence< rtl::OUString >& rNames);
+
+ //returns all members of a node
+ com::sun::star::uno::Sequence< rtl::OUString >
+ GetNodeNames(rtl::OUString& rNode);
+ // remove all members of a set
+ sal_Bool ClearNodeSet(rtl::OUString& rNode);
+ // change or add members to a set
+ sal_Bool SetSetProperties(rtl::OUString& rNode, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues);
+ // remove, change or add members of a set
+ sal_Bool ReplaceSetProperties(rtl::OUString& rNode, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > rValues);
+
+ public:
+ virtual ~ConfigItem();
+
+ /** is called from the ConfigManager before application ends of from the
+ PropertyChangeListener if the sub tree broadcasts changes. */
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+
+ /** is called from the ConfigManager if it is destroyed before the ConfigItem. */
+ void ReleaseConfigMgr();
+
+ const rtl::OUString& GetSubTreeName() const {return sSubTree;}
+
+ sal_Bool IsModified() const {return bIsModified;}
+
+ /** writes the changed values into the sub tree. Always called in the Dtor of the derived class. */
+ virtual void Commit();
+
+ };
+}//namespace utl
+#endif //_UTL_CONFIGITEM_HXX_
diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx
new file mode 100644
index 000000000000..1c65d68d9b47
--- /dev/null
+++ b/unotools/inc/unotools/configmgr.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: configmgr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UTL_CONFIGMGR_HXX_
+#define _UTL_CONFIGMGR_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+//-----------------------------------------------------------------------------
+namespace com{ namespace sun{ namespace star{
+ namespace lang{
+ class XMultiServiceFactory;
+ }
+ namespace beans{
+ class XMultiPropertySet;
+ }
+}}}
+
+//-----------------------------------------------------------------------------
+namespace utl
+{
+ struct ConfigMgr_Impl;
+ class ConfigItem;
+ class ConfigManager
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ xConfigurationProvider;
+ ConfigMgr_Impl* pMgrImpl;
+
+ static ConfigManager* pConfigManager;
+ public:
+ ConfigManager();
+ ~ConfigManager();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ GetConfigurationProvider();
+
+ com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet>
+ AddConfigItem(utl::ConfigItem& rCfgItem);
+
+ void RemoveConfigItem(utl::ConfigItem& rCfgItem);
+
+ void StoreConfigItems();
+
+ static ConfigManager* GetConfigManager();
+ static void RemoveConfigManager();
+ static rtl::OUString GetConfigBaseURL();
+ };
+}//namespace utl
+#endif //_UTL_CONFIGMGR_HXX_
diff --git a/unotools/inc/unotools/datetime.hxx b/unotools/inc/unotools/datetime.hxx
new file mode 100644
index 000000000000..b1c070ea145d
--- /dev/null
+++ b/unotools/inc/unotools/datetime.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: datetime.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//= conversions UNO3.TimeClass <-> Tools.TimeClass (Date/Time/DateTime)
+
+#ifndef _UNOTOOLS_DATETIME_HXX_
+#define _UNOTOOLS_DATETIME_HXX_
+
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+class Date;
+class Time;
+class DateTime;
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+ namespace starutil = ::com::sun::star::util;
+
+ //-------------------------------------------------------------------------
+ /** compare two DateTime's
+ */
+ sal_Bool operator ==(const starutil::DateTime& _rLeft, const starutil::DateTime& _rRight);
+ inline sal_Bool operator !=(const starutil::DateTime& _rLeft, const starutil::DateTime& _rRight)
+ { return !(_rLeft == _rRight); }
+
+ //-------------------------------------------------------------------------
+ /** compare two Date's
+ */
+ sal_Bool operator ==(const starutil::Date& _rLeft, const starutil::Date& _rRight);
+ inline sal_Bool operator !=(const starutil::Date& _rLeft, const starutil::Date& _rRight)
+ { return !(_rLeft == _rRight); }
+
+ //-------------------------------------------------------------------------
+ /** compare two Time's
+ */
+ sal_Bool operator ==(const starutil::Time& _rLeft, const starutil::Time& _rRight);
+ inline sal_Bool operator !=(const starutil::Time& _rLeft, const starutil::Time& _rRight)
+ { return !(_rLeft == _rRight); }
+
+ void typeConvert(const Time& _rTime, starutil::Time& _rOut);
+ void typeConvert(const starutil::Time& _rTime, Time& _rOut);
+
+ void typeConvert(const Date& _rDate, starutil::Date& _rOut);
+ void typeConvert(const starutil::Date& _rDate, Date& _rOut);
+
+ void typeConvert(const DateTime& _rDateTime, starutil::DateTime& _rOut);
+ void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut);
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
+#endif // _UNOTOOLS_DATETIME_HXX_
+
diff --git a/unotools/inc/unotools/idhelper.hxx b/unotools/inc/unotools/idhelper.hxx
new file mode 100644
index 000000000000..b757984eb6d4
--- /dev/null
+++ b/unotools/inc/unotools/idhelper.hxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * $RCSfile: idhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_ID_HELPER_HXX_
+#define _UNOTOOLS_ID_HELPER_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _UTL_STLTYPES_HXX_
+#include <unotools/stl_types.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+//=========================================================================
+// to shorten some lines ...
+typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > TypeSequence;
+
+// compare to Sequences of Types
+struct TypeSequenceLess : public ::std::binary_function<TypeSequence, TypeSequence, bool>
+{
+public:
+ inline bool operator() (const TypeSequence& lhs, const TypeSequence& rhs) const
+ {
+ sal_Int32 nLengthLeft = lhs.getLength();
+ sal_Int32 nLengthRight = rhs.getLength();
+
+ // first check the two lengths
+ if (nLengthLeft < nLengthRight)
+ return sal_True;
+ if (nLengthLeft > nLengthRight)
+ return sal_False;
+
+ // both sequences have the same length -> check the type names
+ const ::com::sun::star::uno::Type* pTypesLeft = lhs.getConstArray();
+ const ::com::sun::star::uno::Type* pTypesRight = rhs.getConstArray();
+ for (sal_Int32 i=0; i<nLengthLeft; ++i, ++pTypesLeft, ++pTypesRight)
+ {
+ sal_Int32 nTypeNameCompare = pTypesLeft->getTypeName().compareTo(pTypesRight->getTypeName());
+ if (nTypeNameCompare < 0)
+ return sal_True;
+ if (nTypeNameCompare > 0)
+ return sal_False;
+ }
+
+ // both sequences are equal ...
+ return sal_False;
+ }
+};
+
+// declare the map
+DECLARE_STL_MAP ( TypeSequence,
+ ::cppu::OImplementationId,
+ TypeSequenceLess,
+ MapType2Id
+ );
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
+//=========================================================================
+/** defines a helper class for implementing the XTypeProvider::getImplementationId.
+ it maps sequences of ::com::sun::star::uno::Type to implementation ids
+ (which means sequences of bytes).<BR>
+ As there is no possibility to determine the time where the id's are no longer
+ needed (e.g. because the last instance of the class using this mechanism died)
+ the helper is "refcounted", i.e. there are acquire and release methods.
+ To simplify this there is a class classname##Ref which you may want to
+ use as an member of your classes.
+ <BR><BR>
+ As we don't want a global helper class which handles implementation id's
+ of components from all over the office (supposing somebody want's to use this :)
+ this is only a define. Wherever you have a "closed" area (which is small enough
+ and large enough :), see below) where diffenrent components want to use an id helper,
+ define your own one with this macro.<BR>
+ The more classes use this helper, the later redundant map entries will be
+ cleared. The less classes use it, the earlier map entries which may have
+ been reused will be cleared.
+*/
+#define DECLARE_IMPLEMENTATIONID_HELPER(_namespace, classname) \
+namespace _namespace { \
+class classname \
+{ \
+ friend class classname##Ref; \
+ \
+ static sal_Int32 s_nReferenced; \
+ static void* s_pMap; \
+ \
+ static ::osl::Mutex s_aMutex; \
+ \
+public: \
+ static void acquire(); \
+ static void release(); \
+ \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getImplementationId( \
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >& _rxProvider); \
+ \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getImplementationId( \
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >& _rTypes); \
+ \
+private: \
+ static void implCreateMap(); \
+ \
+ classname() { } \
+}; \
+ \
+/*=======================================================================*/ \
+class classname##Ref \
+{ \
+public: \
+ classname##Ref() { classname::acquire(); } \
+ ~classname##Ref() { classname::release(); } \
+}; \
+ \
+} /* _namespace */ \
+ \
+
+/*************************************************************************
+**************************************************************************
+*************************************************************************/
+
+/** implement an id helper
+*/
+#define IMPLEMENT_IMPLEMENTATIONID_HELPER(_namespace, classname) \
+namespace _namespace { \
+ \
+/*=======================================================================*/ \
+ \
+sal_Int32 classname::s_nReferenced(0); \
+void* classname::s_pMap = NULL; \
+::osl::Mutex classname::s_aMutex; \
+ \
+/*-----------------------------------------------------------------------*/ \
+void classname::acquire() \
+{ \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ ++s_nReferenced; \
+} \
+ \
+/*-----------------------------------------------------------------------*/ \
+void classname::release() \
+{ \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ if (!--s_nReferenced) \
+ { \
+ delete s_pMap; \
+ s_pMap = NULL; \
+ } \
+} \
+ \
+/*-----------------------------------------------------------------------*/ \
+::com::sun::star::uno::Sequence< sal_Int8 > classname::getImplementationId( \
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider >& _rxProvider) \
+{ \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ if (_rxProvider.is()) \
+ return getImplementationId(_rxProvider->getTypes()); \
+ return ::com::sun::star::uno::Sequence< sal_Int8 >(); \
+} \
+ \
+/*-----------------------------------------------------------------------*/ \
+::com::sun::star::uno::Sequence< sal_Int8 > classname::getImplementationId( \
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >& _rTypes) \
+{ \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ DBG_ASSERT(s_nReferenced, \
+ "classname::getImplementationId : you need to hold a reference to this class in order to use it !"); \
+ /* give the calling class a member of type classname##Ref and all is fine .... */ \
+ \
+ implCreateMap(); \
+ \
+ ::utl::MapType2Id* pMap = reinterpret_cast< ::utl::MapType2Id *>(s_pMap); \
+ \
+ ::cppu::OImplementationId& rId = (*pMap)[_rTypes]; \
+ /* this will create an entry for the given type sequence, if neccessary */ \
+ \
+ return rId.getImplementationId(); \
+} \
+ \
+/*-----------------------------------------------------------------------*/ \
+void classname::implCreateMap() \
+{ \
+ if (s_pMap) \
+ return; \
+ s_pMap = new ::utl::MapType2Id(); \
+} \
+ \
+ \
+} /* _namespace */ \
+ \
+
+
+#endif // _UNOTOOLS_ID_HELPER_HXX_
+
diff --git a/unotools/inc/unotools/processfactory.hxx b/unotools/inc/unotools/processfactory.hxx
new file mode 100644
index 000000000000..5f67d473fd64
--- /dev/null
+++ b/unotools/inc/unotools/processfactory.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: processfactory.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#define _UNOTOOLS_PROCESSFACTORY_HXX_
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace utl
+{
+
+/**
+ * This function set the process service factory.
+ *
+ * @author Juergen Schmidt
+ */
+void setProcessServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr);
+
+/**
+ * This function get the process service factory. If no service factory is set the function returns
+ * a null interface.
+ *
+ * @author Juergen Schmidt
+ */
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getProcessServiceFactory();
+
+}
+
+#endif // _UNOTOOLS_PROCESSFACTORY_HXX_
+
diff --git a/unotools/inc/unotools/querydeep.hxx b/unotools/inc/unotools/querydeep.hxx
new file mode 100644
index 000000000000..c5f76cff6935
--- /dev/null
+++ b/unotools/inc/unotools/querydeep.hxx
@@ -0,0 +1,526 @@
+/*************************************************************************
+ *
+ * $RCSfile: querydeep.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_QUERYDEEPINTERFACE_HXX
+#define _UNOTOOLS_QUERYDEEPINTERFACE_HXX
+
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_
+#include <com/sun/star/uno/Type.hxx>
+#endif
+
+/** */ //for docpp
+namespace utl
+{
+
+//--------------------------------------------------------------------------------------------------------
+/**
+ * Inspect interfaces types whether they are related by inheritance.
+ *<BR>
+ * @return true if rType is derived from rBaseType
+ * @param rBaseType a <type>Type</type> of an interface.
+ * @param rType a <type>Type</type> of an interface.
+ */
+sal_Bool isDerivedFrom(
+ const ::com::sun::star::uno::Type & rBaseType,
+ const ::com::sun::star::uno::Type & rType );
+
+//--------------------------------------------------------------------------------------------------------
+/**
+ * Inspect interface types whether they are related by inheritance.
+ *<BR>
+ * @return true if p is of a type derived from rBaseType
+ * @param rBaseType a <type>Type</type> of an interface.
+ * @param p a pointer to an interface.
+ */
+template <class Interface>
+inline sal_Bool isDerivedFrom(
+ const ::com::sun::star::uno::Type& rBaseType,
+ Interface* /*p*/)
+{
+ return isDerivedFrom(
+ rBaseType,
+ ::getCppuType(static_cast<const ::com::sun::star::uno::Reference<Interface> *>(0)));
+}
+
+//--------------------------------------------------------------------------------------------------------
+// possible optimization ?
+// Any aRet(::cppu::queryInterface(rType, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12));
+// if (aRet.hasValue())
+// return aRet;
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ */
+template< class Interface1 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ */
+template< class Interface1, class Interface2 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface10 > *>(0))))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ * @param p11 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface10 > *>(0))))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface11 > *>(0))))
+ return ::com::sun::star::uno::Any( &p11, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Inspect types and choose return proper interface.
+ *<BR>
+ * @param p1 a pointer to an interface.
+ * @param p2 a pointer to an interface.
+ * @param p3 a pointer to an interface.
+ * @param p4 a pointer to an interface.
+ * @param p5 a pointer to an interface.
+ * @param p6 a pointer to an interface.
+ * @param p7 a pointer to an interface.
+ * @param p8 a pointer to an interface.
+ * @param p9 a pointer to an interface.
+ * @param p10 a pointer to an interface.
+ * @param p11 a pointer to an interface.
+ * @param p12 a pointer to an interface.
+ */
+template< class Interface1, class Interface2, class Interface3, class Interface4, class Interface5,
+ class Interface6, class Interface7, class Interface8, class Interface9, class Interface10,
+ class Interface11, class Interface12 >
+inline ::com::sun::star::uno::Any queryDeepInterface(
+ const ::com::sun::star::uno::Type & rType,
+ Interface1 * p1, Interface2 * p2, Interface3 * p3, Interface4 * p4, Interface5 * p5,
+ Interface6 * p6, Interface7 * p7, Interface8 * p8, Interface9 * p9, Interface10 * p10,
+ Interface11 * p11, Interface12 * p12 )
+{
+ if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface1 > *>(0))))
+ return ::com::sun::star::uno::Any( &p1, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface2 > *>(0))))
+ return ::com::sun::star::uno::Any( &p2, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface3 > *>(0))))
+ return ::com::sun::star::uno::Any( &p3, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface4 > *>(0))))
+ return ::com::sun::star::uno::Any( &p4, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface5 > *>(0))))
+ return ::com::sun::star::uno::Any( &p5, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface6 > *>(0))))
+ return ::com::sun::star::uno::Any( &p6, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface7 > *>(0))))
+ return ::com::sun::star::uno::Any( &p7, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface8 > *>(0))))
+ return ::com::sun::star::uno::Any( &p8, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface9 > *>(0))))
+ return ::com::sun::star::uno::Any( &p9, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface10 > *>(0))))
+ return ::com::sun::star::uno::Any( &p10, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface11 > *>(0))))
+ return ::com::sun::star::uno::Any( &p11, rType );
+ else if (isDerivedFrom(rType, ::getCppuType(static_cast<const ::com::sun::star::uno::Reference< Interface12 > *>(0))))
+ return ::com::sun::star::uno::Any( &p12, rType );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+} // namespace utl
+
+#endif // _UNOTOOLS_QUERYDEEPINTERFACE_HXX
+
diff --git a/unotools/inc/unotools/regpathhelper.hxx b/unotools/inc/unotools/regpathhelper.hxx
new file mode 100644
index 000000000000..33ce3eb2e28c
--- /dev/null
+++ b/unotools/inc/unotools/regpathhelper.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * $RCSfile: regpathhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_REGPATHHELPER_HXX_
+#define _UNOTOOLS_REGPATHHELPER_HXX_
+
+#ifndef _RTL_OUSTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+namespace utl
+{
+
+/**
+ * This function returns a path to the user registry file.
+ * Search for the user registry using the following rules:
+ * <dl>
+ * <dt> 1. (for further use) search in sversion.ini (.sversionrc) for an entry
+ * REGISTRY_VERSION_STRING (example: UserRegistry 5.0/505=test.rdb) in the section
+ * [Registry]. If found, then take this value instead of the name "user.rdb".
+ * <dt> 2. Search in the config directory of the user for a file "user.rdb". If
+ * found return the full path and name of the file. If not found, retry this
+ * step with a dot before ".user.rdb".
+ * <dt> 3. If not found a new user registry with name "user.rdb" will be created in the user
+ * config directory.
+ * </dl>
+ *<BR>
+ * @author Juergen Schmidt
+ */
+::rtl::OUString getPathToUserRegistry();
+
+/**
+ * This function returns a path to the system registry file.
+ * The system registry will always be searched in the same directory of the
+ * executable. The name of the system registry is "applicat.rdb". If the system
+ * registry was not found, then the environment variable STAR_REGISTRY will be checked.
+ * If this variable was set, it must contain a full path to a valid system registry.
+ * Search for the user registry using the following rules:
+ *
+ *<BR>
+ * @author Juergen Schmidt
+ */
+
+::rtl::OUString getPathToSystemRegistry();
+
+}
+
+#endif
+
diff --git a/unotools/inc/unotools/servicehelper.hxx b/unotools/inc/unotools/servicehelper.hxx
new file mode 100644
index 000000000000..735dccf58f51
--- /dev/null
+++ b/unotools/inc/unotools/servicehelper.hxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: servicehelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UTL_SERVICEHELPER_HXX_
+#define _UTL_SERVICEHELPER_HXX_
+
+/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
+ that gives access to your implementation for a given interface reference,
+ if possible.
+
+ Example:
+ MyClass* pClass = MyClass::getImplementation( xRef );
+
+ Usage:
+ Put a UNO3_GETIMPLEMENTATION_DECL( classname ) inside your class
+ definitian and UNO3_GETIMPLEMENTATION_IMPL( classname ) inside
+ your cxx file. Your class must inherit ::com::sun::star::uno::XUnoTunnel
+ and export it with queryInterface. Implementation of XUnoTunnel is
+ done by this macro.
+*/
+#define UNO3_GETIMPLEMENTATION_DECL( classname ) \
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); \
+ static classname* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt ) throw(); \
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
+const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
+{ \
+ 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; \
+} \
+\
+classname* classname::getImplementation( uno::Reference< uno::XInterface > xInt ) throw() \
+{ \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY ); \
+ if( xUT.is() ) \
+ return (classname*)xUT->getSomething( classname::getUnoTunnelId() ); \
+ else \
+ return NULL; \
+}
+
+#define UNO3_GETIMPLEMENTATION_IMPL( classname )\
+UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
+sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), \
+ rId.getConstArray(), 16 ) ) \
+ { \
+ return (sal_Int64)this; \
+ } \
+ return 0; \
+}
+
+#define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
+UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
+sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), \
+ rId.getConstArray(), 16 ) ) \
+ { \
+ return (sal_Int64)this; \
+ } \
+ else \
+ { \
+ return baseclass::getSomething( rId ); \
+ } \
+}
+
+
+#endif _UTL_SERVICEHELPER_HXX_
+
diff --git a/unotools/inc/unotools/streamhelper.hxx b/unotools/inc/unotools/streamhelper.hxx
new file mode 100644
index 000000000000..77f2503ccd4e
--- /dev/null
+++ b/unotools/inc/unotools/streamhelper.hxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_STREAMHELPER_HXX_
+#define _UNOTOOLS_STREAMHELPER_HXX_
+
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_
+#include <com/sun/star/io/XSeekable.hpp>
+#endif
+#ifndef _OSL_MUTEX_HXX_ //autogen wg. ::osl::Mutex
+#include <osl/mutex.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+namespace utl
+{
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+/**
+ * The helper implementation for a using input streams based on SvLockBytes.
+ *
+ * @author Dirk Grobler
+ * @since 00/28/03
+ */
+ typedef ::cppu::WeakImplHelper2<stario::XInputStream, stario::XSeekable> InputStreamHelper_Base;
+ // needed for some compilers
+class OInputStreamHelper : public InputStreamHelper_Base
+{
+ ::osl::Mutex m_aMutex;
+ SvLockBytesRef m_xLockBytes;
+ sal_uInt32 m_nActPos;
+ sal_Int32 m_nAvailable; // this is typically the chunk(buffer) size
+
+public:
+ OInputStreamHelper(const SvLockBytesRef& _xLockBytes,
+ sal_uInt32 _nAvailable,
+ sal_uInt32 _nPos = 0)
+ :m_xLockBytes(_xLockBytes)
+ ,m_nActPos(_nPos)
+ ,m_nAvailable(_nAvailable){}
+
+// staruno::XInterface
+ virtual void SAL_CALL acquire() throw (staruno::RuntimeException);
+ virtual void SAL_CALL release() throw (staruno::RuntimeException);
+
+// stario::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes( staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available( ) throw(stario::NotConnectedException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL closeInput( ) throw (stario::NotConnectedException, stario::IOException, staruno::RuntimeException);
+
+ 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);
+};
+
+/**
+ * The helper implementation for a using output streams based on SvLockBytes.
+ *
+ * @author Dirk Grobler
+ * @since 00/28/03
+ */
+typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamHelper_Base;
+ // needed for some compilers
+class OOutputStreamHelper : public OutputStreamHelper_Base
+{
+ ::osl::Mutex m_aMutex;
+ SvLockBytesRef m_xLockBytes;
+ sal_uInt32 m_nActPos;
+
+public:
+ OOutputStreamHelper(const SvLockBytesRef& _xLockBytes, sal_uInt32 _nPos = 0)
+ :m_xLockBytes(_xLockBytes)
+ ,m_nActPos(_nPos){}
+
+// staruno::XInterface
+ virtual void SAL_CALL acquire() throw (staruno::RuntimeException);
+ virtual void SAL_CALL release() throw (staruno::RuntimeException);
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes( const staruno::Sequence< sal_Int8 >& aData ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL flush( ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput( ) throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException);
+};
+
+} // namespace utl
+
+
+#endif // _UNOTOOLS_STREAM_WRAPPER_HXX_
+
diff --git a/unotools/inc/unotools/streamsection.hxx b/unotools/inc/unotools/streamsection.hxx
new file mode 100644
index 000000000000..3229a5f8267d
--- /dev/null
+++ b/unotools/inc/unotools/streamsection.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamsection.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_STREAMSECTION_HXX_
+#define _UNOTOOLS_STREAMSECTION_HXX_
+
+#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
+#include <com/sun/star/io/XMarkableStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XDATAINPUTSTREAM_HPP_
+#include <com/sun/star/io/XDataInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XDATAOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XDataOutputStream.hpp>
+#endif
+
+namespace utl
+{
+
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+/** implements handling for compatibly reading/writing data from/into an input/output stream.
+ data written in a block secured by this class should be readable by older versions which
+ use the same mechanism.
+
+ @author Frank Schoenheit
+ @since 00/26/05
+*/
+
+class OStreamSection
+{
+ staruno::Reference< stario::XMarkableStream > m_xMarkStream;
+ staruno::Reference< stario::XDataInputStream > m_xInStream;
+ staruno::Reference< stario::XDataOutputStream > m_xOutStream;
+
+ sal_Int32 m_nBlockStart;
+ sal_Int32 m_nBlockLen;
+
+public:
+ /** starts reading of a "skippable" section of data within the given input stream<BR>
+ @param _rxInput the stream to read from. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ */
+ OStreamSection(const staruno::Reference< stario::XDataInputStream >& _rxInput);
+
+ /** starts writing of a "skippable" section of data into the given output stream
+ @param _rxOutput the stream the stream to write to. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ @param _nPresumedLength estimation for the length of the upcoming section. If greater 0, this
+ value will be written as section length and corrected (in the dtor) only if
+ needed. If you know how much bytes you are about to write, you may
+ want to use this param, saving some stream operations this way.
+ */
+ OStreamSection(const staruno::Reference< stario::XDataOutputStream >& _rxOutput, sal_Int32 _nPresumedLength = 0);
+
+ /** dtor. <BR>If constructed for writing, the section "opened" by this object will be "closed".<BR>
+ If constructed for reading, any remaining bytes 'til the end of the section will be skipped.
+ */
+ ~OStreamSection();
+};
+
+} // namespace utl
+
+#endif // _UNOTOOLS_STREAMSECTION_HXX_
+
+
diff --git a/unotools/inc/unotools/streamwrap.hxx b/unotools/inc/unotools/streamwrap.hxx
new file mode 100644
index 000000000000..ff67671612a7
--- /dev/null
+++ b/unotools/inc/unotools/streamwrap.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamwrap.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _UTL_STREAM_WRAPPER_HXX_
+#define _UTL_STREAM_WRAPPER_HXX_
+
+#ifndef _OSL_MUTEX_HXX_ //autogen wg. ::osl::Mutex
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+#ifndef _UTL_UNO3_HXX_
+#include <unotools/uno3.hxx>
+#endif
+
+class SvStream;
+
+namespace utl
+{
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+//==================================================================
+// FmUnoIOStream,
+// stream zum schreiben un lesen von Daten, basieren auf svstream
+//==================================================================
+ typedef ::cppu::WeakImplHelper1<stario::XInputStream> InputStreamWrapper_Base;
+ // needed for some compilers
+class OInputStreamWrapper : public InputStreamWrapper_Base
+{
+ ::osl::Mutex m_aMutex;
+ SvStream* m_pSvStream;
+ sal_Bool m_bSvStreamOwner : 1;
+
+public:
+ OInputStreamWrapper(SvStream& _rStream);
+ OInputStreamWrapper(SvStream* pStream, sal_Bool bOwner=sal_False);
+ virtual ~OInputStreamWrapper();
+
+// UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(OInputStreamWrapper, InputStreamWrapper_Base);
+
+// stario::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw(stario::NotConnectedException, staruno::RuntimeException);
+ virtual void SAL_CALL closeInput() throw(stario::NotConnectedException, staruno::RuntimeException);
+};
+
+//==================================================================
+// FmUnoOutStream,
+// Datensenke fuer SvStreams
+//==================================================================
+typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamWrapper_Base;
+ // needed for some compilers
+class OOutputStreamWrapper : public OutputStreamWrapper_Base
+{
+ SvStream& rStream;
+
+public:
+ OOutputStreamWrapper(SvStream& _rStream) :rStream(_rStream) { }
+
+// UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(OOutputStreamWrapper, OutputStreamWrapper_Base);
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+};
+
+} // namespace utl
+
+
+#endif // _UTL_STREAM_WRAPPER_HXX_
+
diff --git a/unotools/inc/unotools/unotunnelhelper.hxx b/unotools/inc/unotools/unotunnelhelper.hxx
new file mode 100644
index 000000000000..31db05e8bdfc
--- /dev/null
+++ b/unotools/inc/unotools/unotunnelhelper.hxx
@@ -0,0 +1,240 @@
+/*************************************************************************
+ *
+ * $RCSfile: unotunnelhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_UNOTUNNELHLP_HXX
+#define _UNOTOOLS_UNOTUNNELHLP_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+
+namespace utl
+{
+namespace staruno = ::com::sun::star::uno;
+namespace starlang = ::com::sun::star::lang;
+
+//-----------------------------------------------------------------------------------------------------------
+// to use the following, define
+// sal_Bool getTunneledImplementation(Classname*& pObjImpl, staruno::Reference<starlang::XUnoTunnel> const& xObj);
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, staruno::Reference<starlang::XUnoTunnel> const& xTunnel)
+ throw(staruno::RuntimeException)
+{
+ if (xTunnel.is())
+ return getTunneledImplementation(pImpl, xTunnel);
+
+ pImpl = 0;
+ return sal_False;
+}
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, staruno::Reference<staruno::XInterface> const& xObj)
+ throw(staruno::RuntimeException)
+{
+ staruno::Reference<starlang::XUnoTunnel> xTunnel(xObj,staruno::UNO_QUERY);
+ if (xTunnel.is())
+ return getTunneledImplementation(pImpl, xTunnel);
+
+ pImpl = 0;
+ return sal_False;
+}
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, staruno::Any const& aObj)
+ throw(staruno::RuntimeException)
+{
+ staruno::Reference<starlang::XUnoTunnel> xTunnel;
+ if (cppu::extractInterface(xTunnel, aObj))
+ getTunneledImplementation(pImpl, xTunnel);
+
+ pImpl = 0;
+ return sal_False;
+}
+
+template <class Classname>
+sal_Bool getImplementation(Classname*& pImpl, starlang::XUnoTunnel* pObj)
+ throw(staruno::RuntimeException)
+{
+ if (pObj)
+ {
+ staruno::Reference<starlang::XUnoTunnel> xTunnel(pObj);
+ return getTunneledImplementation(pImpl, xTunnel);
+ }
+
+ pImpl = 0;
+ return sal_False;
+}
+
+//-----------------------------------------------------------------------------------------------------------
+
+class UnoTunnelId
+{
+ sal_Int8 tunnelId[16];
+public:
+ UnoTunnelId(sal_Bool bUseMAC = sal_True) throw()
+ {
+ rtl_createUuid(reinterpret_cast<sal_uInt8*>(tunnelId),0,bUseMAC);
+ }
+
+ staruno::Sequence<sal_Int8> getId() const throw(staruno::RuntimeException)
+ {
+ return staruno::Sequence<sal_Int8>(tunnelId, sizeof(tunnelId));
+ }
+
+ sal_Bool equalTo(staruno::Sequence<sal_Int8> const& rIdentifier) throw()
+ {
+ return rIdentifier.getLength() == sizeof(tunnelId) &&
+ rtl_compareMemory(tunnelId, rIdentifier.getConstArray(), sizeof(tunnelId)) == 0;
+ }
+
+ sal_Int8 const (&getIdBytes() const)[16] { return tunnelId; }
+};
+
+//-----------------------------------------------------------------------------------------------------------
+template<class Classname>
+class UnoTunnelImplBase
+{
+protected:
+ Classname* ThisImplementation() throw() { return static_cast<Classname*>(this); }
+
+ sal_Int64 makeUnoSomething() throw()
+ {
+ return reinterpret_cast<sal_Int64>(static_cast<void*>(ThisImplementation()));
+ }
+
+ static Classname* extractUnoSomething(sal_Int64 nSomething) throw()
+ {
+ if (nSomething != sal_Int64())
+ return static_cast<Classname*>(reinterpret_cast<void*>(nSomething));
+
+ return NULL;
+ }
+#ifdef LINUX
+public:
+#endif
+ static Classname*
+ extractUnoSomething(
+ staruno::Reference<starlang::XUnoTunnel> const& xObj,
+ staruno::Sequence<sal_Int8> const& rMyTunnelId
+ )
+ throw(staruno::RuntimeException)
+ {
+ return xObj.is() ? extractUnoSomething(xObj->getSomething(rMyTunnelId)) : NULL;
+ }
+};
+//-----------------------------------------------------------------------------------------------------------
+
+
+template<class Classname>
+class UnoTunnelHelper : public UnoTunnelImplBase<Classname>
+{
+protected:
+ static UnoTunnelId s_aTunnelId;
+
+ sal_Int64 getSomething(staruno::Sequence<sal_Int8> const& rTunnelId) throw()
+ {
+ if (s_aTunnelId.equalTo(rTunnelId))
+ return makeUnoSomething();
+ else
+ return sal_Int64();
+ }
+public:
+ static staruno::Sequence<sal_Int8> getImplementationTunnelId()
+ throw(staruno::RuntimeException)
+ {
+ return s_aTunnelId.getId();
+ }
+#ifndef LINUX
+ friend sal_Bool getTunneledImplementation(Classname*& pImpl, staruno::Reference<starlang::XUnoTunnel> const& xObj)
+ throw(staruno::RuntimeException)
+ {
+ pImpl = UnoTunnelHelper<Classname>::UnoTunnelHelper<Classname>::extractUnoSomething( xObj, UnoTunnelHelper<Classname>::getImplementationTunnelId() );
+
+ return pImpl != 0;
+ }
+#endif
+};
+template<class Classname>
+UnoTunnelId UnoTunnelHelper<Classname>::s_aTunnelId;
+
+
+//-----------------------------------------------------------------------------------------------------------
+} // namespace utl
+
+#endif // _UNOTOOLS_UNOTUNNELHLP_HXX
+
diff --git a/unotools/prj/d.lst b/unotools/prj/d.lst
new file mode 100644
index 000000000000..9879e4356e37
--- /dev/null
+++ b/unotools/prj/d.lst
@@ -0,0 +1,11 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT%\*.lib
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
+..\%__SRC%\inc\*.bin %_DEST%\bin%_EXT%\*.bin
+
+mkdir: %_DEST%\inc%_EXT%\unotools
+..\inc\unotools\*.mk %_DEST%\inc%_EXT%\unotools\*.mk
+..\inc\unotools\*.hxx %_DEST%\inc%_EXT%\unotools\*.hxx
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
new file mode 100644
index 000000000000..d4544d9753a5
--- /dev/null
+++ b/unotools/source/config/configitem.cxx
@@ -0,0 +1,623 @@
+/*************************************************************************
+ *
+ * $RCSfile: configitem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _UTL_CONFIGITEM_HXX_
+#include "unotools/configitem.hxx"
+#endif
+#ifndef _UTL_CONFIGMGR_HXX_
+#include "unotools/configmgr.hxx"
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCHANGESLISTENER_HPP_
+#include <com/sun/star/util/XChangesListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCHANGESNOTIFIER_HPP_
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
+#include <com/sun/star/container/XHierarchicalNameAccess.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 _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UTIL_XCHANGESBATCH_HPP_
+#include <com/sun/star/util/XChangesBatch.hpp>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+
+namespace utl{
+ class ConfigChangeListener_Impl : public cppu::WeakImplHelper1
+ <
+ com::sun::star::util::XChangesListener
+ >
+ {
+ ConfigItem* pParent;
+ public:
+ ConfigChangeListener_Impl(ConfigItem& rItem);
+ ~ConfigChangeListener_Impl();
+
+ //XChangesListener
+ virtual void SAL_CALL changesOccurred( const ChangesEvent& Event ) throw(RuntimeException);
+
+ //XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
+
+ };
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigChangeListener_Impl::ConfigChangeListener_Impl(ConfigItem& rItem) :
+ pParent(&rItem)
+{
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigChangeListener_Impl::~ConfigChangeListener_Impl()
+{
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) throw(RuntimeException)
+{
+ const ElementChange* pElementChanges = rEvent.Changes.getConstArray();
+
+ Sequence<OUString> aChangedNames(rEvent.Changes.getLength());
+ OUString* pNames = aChangedNames.getArray();
+
+ const sal_Int32 nBaseTreeLen = ConfigManager::GetConfigBaseURL().getLength() +
+ pParent->GetSubTreeName().getLength() + 1;
+ for(int i = 0; i < aChangedNames.getLength(); i++)
+ {
+ pElementChanges[i].Accessor >>= pNames[i];
+ DBG_ASSERT(nBaseTreeLen < pNames[i].getLength(),"property name incorrect");
+ pNames[i] = pNames[i].copy(nBaseTreeLen);
+ }
+ pParent->CallNotify(aChangedNames);
+}
+/* -----------------------------29.08.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigChangeListener_Impl::disposing( const EventObject& Source ) throw(RuntimeException)
+{
+ DBG_ERROR("ConfigChangeListener_Impl::disposing")
+}
+/* -----------------------------29.08.00 12:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigItem::ConfigItem(const rtl::OUString rSubTree ) :
+ pManager(ConfigManager::GetConfigManager()),
+ sSubTree(rSubTree),
+ bIsModified(sal_False),
+ bInPutValues(sal_False),
+ bHasChangedProperties(sal_False)
+{
+ xMultPrSet = pManager->AddConfigItem(*this);
+ xHierarchyAccess = Reference<XHierarchicalNameAccess>(xMultPrSet, UNO_QUERY);
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigItem::~ConfigItem()
+{
+ if(pManager)
+ {
+ if(bHasChangedProperties && xMultPrSet.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ xBatch->commitChanges();
+ }
+ RemoveListener();
+ pManager->RemoveConfigItem(*this);
+ }
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::Commit()
+{
+ DBG_ERROR("Base class called")
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::ReleaseConfigMgr()
+{
+ if(bHasChangedProperties && xMultPrSet.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ xBatch->commitChanges();
+ bHasChangedProperties = FALSE;
+ }
+ RemoveListener();
+ DBG_ASSERT(pManager, "ConfigManager already released")
+ pManager = 0;
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<rtl::OUString>& rPropertyNames )
+{
+ if(!bInPutValues)
+ Notify(rPropertyNames);
+ else
+ bHasChangedProperties = TRUE;
+}
+/* -----------------------------29.08.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& rPropertyNames)
+{
+ DBG_ERROR("Base class called")
+}
+/* -----------------------------29.08.00 15:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Any > ConfigItem::GetProperties(const Sequence< OUString >& rNames)
+{
+ Sequence< Any > aRet(rNames.getLength());
+ const OUString* pNames = rNames.getConstArray();
+ Any* pRet = aRet.getArray();
+ if(xHierarchyAccess.is())
+ {
+ for(int i = 0; i < rNames.getLength(); i++)
+ {
+ try
+ {
+ pRet[i] = xHierarchyAccess->getByHierarchicalName(pNames[i]);
+ }
+ #ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("Exception from XHierarchicalNameAccess: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ }
+ }
+ return aRet;
+}
+/* -----------------------------29.08.00 17:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::PutProperties( const Sequence< OUString >& rNames,
+ const Sequence< Any>& rValues)
+{
+ bInPutValues = sal_True;
+ Reference<XPropertySet> xPropSet(xMultPrSet, UNO_QUERY);
+ sal_Bool bRet = xHierarchyAccess.is() && xPropSet.is();
+ if(bRet)
+ {
+ const OUString* pNames = rNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+ for(int i = 0; i < rNames.getLength(); i++)
+ {
+ try
+ {
+ sal_Int32 nLastIndex = pNames[i].lastIndexOf( '/', pNames[i].getLength());
+
+ if(nLastIndex > 0)
+ {
+ OUString sNode = pNames[i].copy( 0, nLastIndex );
+ OUString sProperty = pNames[i].copy( nLastIndex + 1, pNames[i].getLength() - nLastIndex - 1 );
+ Any aNode = xHierarchyAccess->getByHierarchicalName(sNode);
+ Reference<XNameAccess> xNodeAcc;
+ aNode >>= xNodeAcc;
+ Reference<XNameReplace> xNodeReplace(xNodeAcc, UNO_QUERY);
+ if(xNodeReplace.is())
+ {
+ xNodeReplace->replaceByName(sProperty, pValues[i]);
+ }
+ else
+ bRet = FALSE;
+ }
+ else //direct value
+ {
+ xPropSet->setPropertyValue(pNames[i], pValues[i]);
+ }
+ }
+#ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("Exception from PutProperties: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ }
+#if SUPD<605
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ xBatch->commitChanges();
+
+#else
+ DBG_ERROR("does setPropertyValue work correctly now?")
+#endif
+ }
+
+ bInPutValues = sal_False;
+ return bRet;
+}
+/* -----------------------------29.08.00 16:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::EnableNotification(com::sun::star::uno::Sequence< rtl::OUString >& rNames)
+{
+ Reference<XChangesNotifier> xChgNot(xMultPrSet, UNO_QUERY);
+ if(!xChgNot.is())
+ return FALSE;
+ BOOL bRet = TRUE;
+
+ try
+ {
+ xChangeLstnr = new ConfigChangeListener_Impl(*this);
+ xChgNot->addChangesListener( xChangeLstnr );
+ }
+ catch(RuntimeException& )
+ {
+ bRet = FALSE;
+ }
+ return bRet;
+}
+/* -----------------------------29.08.00 16:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigItem::RemoveListener()
+{
+ Reference<XChangesNotifier> xChgNot(xMultPrSet, UNO_QUERY);
+ if(xChgNot.is() && xChangeLstnr.is())
+ {
+ try
+ {
+ xChgNot->removeChangesListener( xChangeLstnr );
+ xMultPrSet = 0;
+ }
+ catch(Exception & )
+ {
+ }
+ }
+}
+/* -----------------------------15.09.00 12:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > ConfigItem::GetNodeNames(rtl::OUString& rNode)
+{
+ Sequence< OUString > aRet;
+ if(xHierarchyAccess.is())
+ {
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(xCont.is())
+ {
+ aRet = xCont->getElementNames();
+ }
+ }
+#ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ }
+ return aRet;
+}
+/* -----------------------------15.09.00 15:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::ClearNodeSet(OUString& rNode)
+{
+ sal_Bool bRet;
+ if(xHierarchyAccess.is())
+ {
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(!xCont.is())
+ return sal_False;
+ Sequence< OUString > aNames = xCont->getElementNames();
+ const OUString* pNames = aNames.getConstArray();
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ for(sal_Int32 i = 0; i < aNames.getLength(); i++)
+ {
+ xCont->removeByName(pNames[i]);
+ xBatch->commitChanges();
+ }
+ }
+ catch(Exception& rEx)
+ {
+#ifdef DBG_UTIL
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+#endif
+ bRet = FALSE;
+ }
+ }
+ return bRet;
+}
+/* -----------------------------15.09.00 15:52--------------------------------
+ add or change properties
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::SetSetProperties(
+ OUString& rNode, Sequence< PropertyValue > rValues)
+{
+ sal_Bool bRet;
+ if(xHierarchyAccess.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(!xCont.is())
+ return sal_False;
+ const PropertyValue* pProperties = rValues.getConstArray();
+ Sequence< OUString > aSubNodeNames(rValues.getLength());
+ OUString* pSubNodeNames = aSubNodeNames.getArray();
+ sal_Int32 nNodeLength = rNode.getLength() + 1;
+ OUString sLastSubNode;
+ sal_Int32 nSubIndex = 0;
+
+ for(sal_Int32 i = 0; i < rValues.getLength(); i++)
+ {
+ OUString sSubNode = pProperties[i].Name.copy(nNodeLength);
+ sSubNode = sSubNode.copy(0, sSubNode.indexOf('/'));
+ if(sLastSubNode != sSubNode)
+ {
+ pSubNodeNames[nSubIndex++] = sSubNode;
+ }
+ sLastSubNode = sSubNode;
+ }
+ aSubNodeNames.realloc(nSubIndex);
+ pSubNodeNames = aSubNodeNames.getArray();
+
+ Reference<XSingleServiceFactory> xFac(xCont, UNO_QUERY);
+ for(sal_Int32 j = 0; j < nSubIndex; j++)
+ {
+ if(!xCont->hasByName(pSubNodeNames[j]))
+ {
+ //create if not available
+ if(!xFac.is())
+ return FALSE;
+ Reference<XInterface> xInst = xFac->createInstance();
+ Any aVal; aVal <<= xInst;
+ xCont->insertByName(pSubNodeNames[j], aVal);
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ }
+ //set values
+ }
+ Sequence< OUString > aSetNames(rValues.getLength());
+ OUString* pSetNames = aSetNames.getArray();
+ Sequence< Any> aSetValues(rValues.getLength());
+ Any* pSetValues = aSetValues.getArray();
+ for(sal_Int32 k = 0; k < rValues.getLength(); k++)
+ {
+ pSetNames[k] = pProperties[k].Name;
+ pSetValues[k] = pProperties[k].Value;
+ }
+
+ xBatch->commitChanges();
+ bRet = PutProperties(aSetNames, aSetValues);
+
+ }
+ catch(Exception& rEx)
+ {
+#ifdef DBG_UTIL
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+#endif
+ bRet = FALSE;
+ }
+ }
+ return bRet;
+}
+/* -----------------------------15.09.00 15:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool ConfigItem::ReplaceSetProperties(
+ OUString& rNode, Sequence< PropertyValue > rValues)
+{
+ sal_Bool bRet;
+ if(xHierarchyAccess.is())
+ {
+ Reference<XChangesBatch> xBatch(xMultPrSet, UNO_QUERY);
+ try
+ {
+ Any aNode = xHierarchyAccess->getByHierarchicalName(rNode);
+ Reference<XNameContainer> xCont;
+ aNode >>= xCont;
+ if(!xCont.is())
+ return sal_False;
+ const PropertyValue* pProperties = rValues.getConstArray();
+ //remove unknown members first
+
+ Sequence< OUString > aSubNodeNames(rValues.getLength());
+ OUString* pSubNodeNames = aSubNodeNames.getArray();
+ sal_Int32 nNodeLength = rNode.getLength() + 1;
+ OUString sLastSubNode;
+ sal_Int32 nSubIndex = 0;
+
+ for(sal_Int32 i = 0; i < rValues.getLength(); i++)
+ {
+ OUString sSubNode = pProperties[i].Name.copy(nNodeLength);
+ sSubNode = sSubNode.copy(0, sSubNode.indexOf('/'));
+ if(sLastSubNode != sSubNode)
+ {
+ pSubNodeNames[nSubIndex++] = sSubNode;
+ }
+ sLastSubNode = sSubNode;
+ }
+ aSubNodeNames.realloc(nSubIndex);
+ pSubNodeNames = aSubNodeNames.getArray();
+
+ Sequence<OUString> aContainerSubNodes = xCont->getElementNames();
+ const OUString* pContainerSubNodes = aContainerSubNodes.getConstArray();
+ for(sal_Int32 nContSub = 0; nContSub < aContainerSubNodes.getLength(); nContSub++)
+ {
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 j = 0; j < nSubIndex; j++)
+ if(pSubNodeNames[j] == pContainerSubNodes[nContSub])
+ {
+ bFound = sal_True;
+ break;
+ }
+ if(!bFound)
+ {
+ xCont->removeByName(pContainerSubNodes[nContSub]);
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ }
+ }
+
+ Reference<XSingleServiceFactory> xFac(xCont, UNO_QUERY);
+ for(sal_Int32 j = 0; j < nSubIndex; j++)
+ {
+ if(!xCont->hasByName(pSubNodeNames[j]))
+ {
+ //create if not available
+ if(!xFac.is())
+ return FALSE;
+ Reference<XInterface> xInst = xFac->createInstance();
+ Any aVal; aVal <<= xInst;
+ xCont->insertByName(pSubNodeNames[j], aVal);
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ }
+ //set values
+ }
+ Sequence< OUString > aSetNames(rValues.getLength());
+ OUString* pSetNames = aSetNames.getArray();
+ Sequence< Any> aSetValues(rValues.getLength());
+ Any* pSetValues = aSetValues.getArray();
+ for(sal_Int32 k = 0; k < rValues.getLength(); k++)
+ {
+ pSetNames[k] = pProperties[k].Name;
+ pSetValues[k] = pProperties[k].Value;
+ }
+
+ //node changes must be commited before values can be changed
+ xBatch->commitChanges();
+ bRet = PutProperties(aSetNames, aSetValues);
+
+ }
+ catch(Exception& rEx)
+ {
+#ifdef DBG_UTIL
+ ByteString sMsg("Exception from GetNodeNames: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+#endif
+ bRet = FALSE;
+ }
+ }
+ return bRet;
+}
+
+
+
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
new file mode 100644
index 000000000000..de24bfa59791
--- /dev/null
+++ b/unotools/source/config/configmgr.cxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * $RCSfile: configmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UTL_CONFIGMGR_HXX_
+#include "unotools/configmgr.hxx"
+#endif
+#ifndef _UTL_CONFIGITEM_HXX_
+#include "unotools/configitem.hxx"
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+#include <list>
+
+//-----------------------------------------------------------------------------
+
+using namespace utl;
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+//-----------------------------------------------------------------------------
+const char* cConfigBaseURL = "/org.openoffice.";
+//const char* cConfigBaseURL = "/com.sun.star.";
+const char* cAccessSrvc = "com.sun.star.configuration.ConfigurationUpdateAccess";
+
+//-----------------------------------------------------------------------------
+struct ConfigItemListEntry_Impl
+{
+ ConfigItem* pConfigItem;
+
+ ConfigItemListEntry_Impl(ConfigItem* pItem ) :
+ pConfigItem(pItem){}
+};
+typedef std::list<ConfigItemListEntry_Impl> ConfigItemList;
+struct utl::ConfigMgr_Impl
+{
+ ConfigItemList aItemList;
+};
+
+/* -----------------------------28.08.00 15:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigManager::ConfigManager() :
+ pMgrImpl(new utl::ConfigMgr_Impl)
+{
+}
+/* -----------------------------28.08.00 15:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigManager::~ConfigManager()
+{
+ //check list content -> should be empty!
+ DBG_ASSERT(pMgrImpl->aItemList.empty(), "some ConfigItems are still alive")
+ if(!pMgrImpl->aItemList.empty())
+ {
+ ConfigItemList::iterator aListIter;
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ rEntry.pConfigItem->ReleaseConfigMgr();
+ }
+ pMgrImpl->aItemList.erase(pMgrImpl->aItemList.begin(), pMgrImpl->aItemList.end());
+ }
+ delete pMgrImpl;
+
+}
+/* -----------------------------28.08.00 16:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XMultiServiceFactory > ConfigManager::GetConfigurationProvider()
+{
+ if(!xConfigurationProvider.is())
+ {
+ Reference< XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ xConfigurationProvider = Reference< XMultiServiceFactory >
+ (xMSF->createInstance(
+ C2U("com.sun.star.configuration.ConfigurationProvider")),
+ UNO_QUERY);
+ }
+ return xConfigurationProvider;
+}
+/* -----------------------------29.08.00 12:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XMultiPropertySet> ConfigManager::AddConfigItem(utl::ConfigItem& rCfgItem)
+{
+ ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
+#ifdef DBG_UTIL
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ if(rEntry.pConfigItem == &rCfgItem)
+ DBG_ERROR("AddConfigItem: already inserted!")
+ }
+#endif
+ OUString sPath = C2U(cConfigBaseURL);
+ sPath += rCfgItem.GetSubTreeName();
+ Sequence< Any > aArgs(1);
+ aArgs[0] <<= sPath;
+
+ Reference< XMultiServiceFactory > xCfgProvider = GetConfigurationProvider();
+ Reference< XInterface > xIFace;
+ try
+ {
+ xIFace = xCfgProvider->createInstanceWithArguments(
+ C2U(cAccessSrvc),
+ aArgs);
+ pMgrImpl->aItemList.insert(aListIter, ConfigItemListEntry_Impl(&rCfgItem));
+#ifdef DEBUG
+ Reference<XNameAccess> xNA(xIFace, UNO_QUERY);
+ Sequence<OUString> aNames = xNA->getElementNames();
+ const OUString* pNames = aNames.getConstArray();
+#endif
+ }
+#ifdef DBG_UTIL
+ catch(Exception& rEx)
+ {
+ ByteString sMsg("CreateInstance exception: ");
+ sMsg += ByteString(String(rEx.Message), RTL_TEXTENCODING_ASCII_US);
+ DBG_ERROR(sMsg.GetBuffer())
+ }
+#else
+ catch(Exception&){}
+#endif
+ return Reference<XMultiPropertySet>(xIFace, UNO_QUERY);
+}
+/* -----------------------------29.08.00 12:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigManager::RemoveConfigItem(utl::ConfigItem& rCfgItem)
+{
+ DBG_ASSERT(!pMgrImpl->aItemList.empty(), "no ConfigItems available")
+ ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ if(rEntry.pConfigItem == &rCfgItem)
+ {
+ pMgrImpl->aItemList.erase(aListIter);
+ break;
+ }
+ }
+}
+/* -----------------------------30.08.00 15:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigManager::StoreConfigItems()
+{
+ if(!pMgrImpl->aItemList.empty())
+ {
+ ConfigItemList::iterator aListIter = pMgrImpl->aItemList.begin();
+ for(aListIter = pMgrImpl->aItemList.begin(); aListIter != pMgrImpl->aItemList.end(); ++aListIter)
+ {
+ ConfigItemListEntry_Impl& rEntry = *aListIter;
+ if(rEntry.pConfigItem->IsModified())
+ rEntry.pConfigItem->Commit();
+ }
+ }
+}
+ConfigManager* ConfigManager::pConfigManager = 0;
+/* -----------------------------07.09.00 11:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ConfigManager* ConfigManager::GetConfigManager()
+{
+ if(!pConfigManager)
+ {
+ pConfigManager = new ConfigManager();
+ }
+ return pConfigManager;
+}
+/* -----------------------------07.09.00 11:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConfigManager::RemoveConfigManager()
+{
+ if(pConfigManager)
+ {
+ delete pConfigManager;
+ pConfigManager = 0;
+ }
+}
+/* -----------------------------08.09.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+rtl::OUString ConfigManager::GetConfigBaseURL()
+{
+ return C2U(cConfigBaseURL);
+}
+
diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk
new file mode 100644
index 000000000000..30f5f4c7872b
--- /dev/null
+++ b/unotools/source/config/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=config
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.container.XEnumeration \
+
+
+# --- Files -------------------------------------
+
+SLOFILES=\
+ $(SLO)$/configitem.obj \
+ $(SLO)$/configmgr.obj \
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
new file mode 100644
index 000000000000..c9c68d04da8d
--- /dev/null
+++ b/unotools/source/i18n/charclass.cxx
@@ -0,0 +1,575 @@
+/*************************************************************************
+ *
+ * $RCSfile: charclass.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <unotools/charclass.hxx>
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _UNOTOOLS_COMPONENTFACTORY_HXX_
+#include <unotools/componentfactory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#pragma hdrstop
+
+
+#define CHARCLASS_LIBRARYNAME "int"
+#define CHARCLASS_SERVICENAME "com.sun.star.lang.CharacterClassification"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+
+CharClass::CharClass(
+ const Reference< XMultiServiceFactory > & xSF,
+ const Locale& rLocale
+ )
+ :
+ xSMgr( xSF )
+{
+ setLocale( rLocale );
+ if ( xSMgr.is() )
+ {
+ try
+ {
+ xCC = Reference< XCharacterClassification > ( xSMgr->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHARCLASS_SERVICENAME ) ) ),
+ uno::UNO_QUERY );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "CharClass ctor: Exception caught!" );
+ }
+ }
+ else
+ { // try to get an instance somehow
+ getComponentInstance();
+ }
+}
+
+
+CharClass::CharClass(
+ const ::com::sun::star::lang::Locale& rLocale )
+{
+ setLocale( rLocale );
+ getComponentInstance();
+}
+
+
+CharClass::~CharClass()
+{
+}
+
+
+void CharClass::getComponentInstance()
+{
+ try
+ {
+ // CharClass may be needed by "small tools" like the Setup
+ // => maybe no service manager => loadLibComponentFactory
+ Reference < XInterface > xI = ::utl::getComponentInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LLCF_LIBNAME( CHARCLASS_LIBRARYNAME ) ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHARCLASS_SERVICENAME ) ) );
+ if ( xI.is() )
+ {
+ Any x = xI->queryInterface( ::getCppuType((const Reference< XCharacterClassification >*)0) );
+ x >>= xCC;
+ }
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getComponentInstance: Exception caught!" );
+ }
+}
+
+
+void CharClass::setLocale( const ::com::sun::star::lang::Locale& rLocale )
+{
+ aLocale.Language = rLocale.Language;
+ aLocale.Country = rLocale.Country;
+ aLocale.Variant = rLocale.Variant;
+}
+
+
+// static
+sal_Bool CharClass::isAsciiNumeric( const String& rStr )
+{
+ if ( !rStr.Len() )
+ return sal_False;
+ register const sal_Unicode* p = rStr.GetBuffer();
+ register const sal_Unicode* const pStop = p + rStr.Len();
+ do
+ {
+ if ( !isAsciiDigit( *p ) )
+ return sal_False;
+ } while ( ++p < pStop );
+ return sal_True;
+}
+
+
+// static
+sal_Bool CharClass::isAsciiAlpha( const String& rStr )
+{
+ if ( !rStr.Len() )
+ return sal_False;
+ register const sal_Unicode* p = rStr.GetBuffer();
+ register const sal_Unicode* const pStop = p + rStr.Len();
+ do
+ {
+ if ( !isAsciiAlpha( *p ) )
+ return sal_False;
+ } while ( ++p < pStop );
+ return sal_True;
+}
+
+
+// static
+sal_Bool CharClass::isAsciiAlphaNumeric( const String& rStr )
+{
+ if ( !rStr.Len() )
+ return sal_False;
+ register const sal_Unicode* p = rStr.GetBuffer();
+ register const sal_Unicode* const pStop = p + rStr.Len();
+ do
+ {
+ if ( !isAsciiAlphaNumeric( *p ) )
+ return sal_False;
+ } while ( ++p < pStop );
+ return sal_True;
+}
+
+
+sal_Bool CharClass::isAlpha( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ nCharClassAlphaType) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlpha: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isAlpha( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isAlphaType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlpha: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetter( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ nCharClassLetterType) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetter: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetter( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isLetterType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetter: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isDigit( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ KCharacterType::DIGIT) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isDigit: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isNumeric( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isNumericType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ (nCharClassAlphaType | KCharacterType::DIGIT)) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlphaNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isAlphaNumeric( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isAlphaNumericType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isAlphaNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetterNumeric( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return (xCC->getCharacterType( rStr, nPos, aLocale ) &
+ (nCharClassLetterType | KCharacterType::DIGIT)) != 0;
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetterNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+sal_Bool CharClass::isLetterNumeric( const String& rStr ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.Len(), aLocale ) );
+ else
+ return sal_False;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "isLetterNumeric: Exception caught!" );
+ return sal_False;
+ }
+}
+
+
+String CharClass::toUpper( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->toUpper( rStr, nPos, nCount, aLocale );
+ else
+ return rStr.Copy( nPos, nCount );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "toUpper: Exception caught!" );
+ return rStr.Copy( nPos, nCount );
+ }
+}
+
+
+String CharClass::toLower( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->toLower( rStr, nPos, nCount, aLocale );
+ else
+ return rStr.Copy( nPos, nCount );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "toLower: Exception caught!" );
+ return rStr.Copy( nPos, nCount );
+ }
+}
+
+
+String CharClass::toTitle( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->toTitle( rStr, nPos, nCount, aLocale );
+ else
+ return rStr.Copy( nPos, nCount );
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "toTitle: Exception caught!" );
+ return rStr.Copy( nPos, nCount );
+ }
+}
+
+
+sal_Int16 CharClass::getType( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getType( rStr, nPos );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getType: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int16 CharClass::getCharacterDirection( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getCharacterDirection( rStr, nPos );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getCharacterDirection: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int16 CharClass::getScript( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getScript( rStr, nPos );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getScript: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int32 CharClass::getCharacterType( const String& rStr, xub_StrLen nPos ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getCharacterType( rStr, nPos, aLocale );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getCharacterType: Exception caught!" );
+ return 0;
+ }
+}
+
+
+sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_StrLen nCount ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->getStringType( rStr, nPos, nCount, aLocale );
+ else
+ return 0;
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "getStringType: Exception caught!" );
+ return 0;
+ }
+}
+
+
+::com::sun::star::lang::ParseResult CharClass::parseAnyToken(
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->parseAnyToken( rStr, nPos, aLocale,
+ nStartCharFlags, userDefinedCharactersStart,
+ nContCharFlags, userDefinedCharactersCont );
+ else
+ return ParseResult();
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "parseAnyToken: Exception caught!" );
+ return ParseResult();
+ }
+}
+
+
+::com::sun::star::lang::ParseResult CharClass::parsePredefinedToken(
+ sal_Int32 nTokenType,
+ const String& rStr,
+ sal_Int32 nPos,
+ sal_Int32 nStartCharFlags,
+ const String& userDefinedCharactersStart,
+ sal_Int32 nContCharFlags,
+ const String& userDefinedCharactersCont ) const
+{
+ try
+ {
+ if ( xCC.is() )
+ return xCC->parsePredefinedToken( nTokenType, rStr, nPos, aLocale,
+ nStartCharFlags, userDefinedCharactersStart,
+ nContCharFlags, userDefinedCharactersCont );
+ else
+ return ParseResult();
+ }
+ catch ( Exception& )
+ {
+ DBG_ERRORFILE( "parsePredefinedToken: Exception caught!" );
+ return ParseResult();
+ }
+}
+
+
+
diff --git a/unotools/source/i18n/makefile.mk b/unotools/source/i18n/makefile.mk
new file mode 100644
index 000000000000..373c83d063de
--- /dev/null
+++ b/unotools/source/i18n/makefile.mk
@@ -0,0 +1,102 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=i18n
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.lang.XCharacterClassification
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/charclass.obj
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
new file mode 100644
index 000000000000..c756c6cb2442
--- /dev/null
+++ b/unotools/source/misc/datetime.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: datetime.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOTOOLS_DATETIME_HXX_
+#include <unotools/datetime.hxx>
+#endif
+
+#ifndef _DATE_HXX
+#include <tools/date.hxx>
+#endif
+#ifndef _TOOLS_TIME_HXX
+#include <tools/time.hxx>
+#endif
+#ifndef _DATETIME_HXX
+#include <tools/datetime.hxx>
+#endif
+
+//.........................................................................
+namespace utl
+{
+//.........................................................................
+
+//------------------------------------------------------------------
+void typeConvert(const Time& _rTime, starutil::Time& _rOut)
+{
+ _rOut.Hours = _rTime.GetHour();
+ _rOut.Minutes = _rTime.GetMin();
+ _rOut.Seconds = _rTime.GetSec();
+ _rOut.HundredthSeconds = _rTime.Get100Sec();
+}
+
+//------------------------------------------------------------------
+void typeConvert(const starutil::Time& _rTime, Time& _rOut)
+{
+ _rOut = Time(_rTime.Hours, _rTime.Minutes, _rTime.Seconds, _rTime.HundredthSeconds);
+}
+
+//------------------------------------------------------------------
+void typeConvert(const Date& _rDate, starutil::Date& _rOut)
+{
+ _rOut.Day = _rDate.GetDay();
+ _rOut.Month = _rDate.GetMonth();
+ _rOut.Year = _rDate.GetYear();
+}
+
+//------------------------------------------------------------------
+void typeConvert(const starutil::Date& _rDate, Date& _rOut)
+{
+ _rOut = Date(_rDate.Day, _rDate.Month, _rDate.Year);
+}
+
+//------------------------------------------------------------------
+void typeConvert(const DateTime& _rDateTime, starutil::DateTime& _rOut)
+{
+ _rOut.Year = _rDateTime.GetYear();
+ _rOut.Month = _rDateTime.GetMonth();
+ _rOut.Day = _rDateTime.GetDay();
+ _rOut.Hours = _rDateTime.GetHour();
+ _rOut.Minutes = _rDateTime.GetMin();
+ _rOut.Seconds = _rDateTime.GetSec();
+ _rOut.HundredthSeconds = _rDateTime.Get100Sec();
+}
+
+//------------------------------------------------------------------
+void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut)
+{
+ Date aDate(_rDateTime.Day, _rDateTime.Month, _rDateTime.Year);
+ Time aTime(_rDateTime.Hours, _rDateTime.Minutes, _rDateTime.Seconds, _rDateTime.HundredthSeconds);
+ _rOut = DateTime(aDate, aTime);
+}
+
+//-------------------------------------------------------------------------
+sal_Bool operator ==(const starutil::DateTime& _rLeft, const starutil::DateTime& _rRight)
+{
+ return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
+ ( _rLeft.Seconds == _rRight.Seconds) &&
+ ( _rLeft.Minutes == _rRight.Minutes) &&
+ ( _rLeft.Hours == _rRight.Hours) &&
+ ( _rLeft.Day == _rRight.Day) &&
+ ( _rLeft.Month == _rRight.Month) &&
+ ( _rLeft.Year == _rRight.Year) ;
+}
+
+//-------------------------------------------------------------------------
+sal_Bool operator ==(const starutil::Date& _rLeft, const starutil::Date& _rRight)
+{
+ return ( _rLeft.Day == _rRight.Day) &&
+ ( _rLeft.Month == _rRight.Month) &&
+ ( _rLeft.Year == _rRight.Year) ;
+}
+
+//-------------------------------------------------------------------------
+sal_Bool operator ==(const starutil::Time& _rLeft, const starutil::Time& _rRight)
+{
+ return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
+ ( _rLeft.Seconds == _rRight.Seconds) &&
+ ( _rLeft.Minutes == _rRight.Minutes) &&
+ ( _rLeft.Hours == _rRight.Hours) ;
+}
+
+//.........................................................................
+} // namespace utl
+//.........................................................................
+
diff --git a/unotools/source/misc/makefile.mk b/unotools/source/misc/makefile.mk
new file mode 100644
index 000000000000..474d193111e4
--- /dev/null
+++ b/unotools/source/misc/makefile.mk
@@ -0,0 +1,112 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=misc
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.util.XNumberFormatTypes \
+# com.sun.star.awt.FontDescriptor \
+# com.sun.star.awt.FontUnderline \
+# com.sun.star.awt.FontStrikeout \
+# com.sun.star.awt.FontSlant \
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/types.obj \
+ $(SLO)$/datetime.obj \
+ $(SLO)$/numbers.obj \
+ $(SLO)$/guarding.obj \
+ $(SLO)$/sequence.obj \
+ $(SLO)$/querydeep.obj \
+ $(SLO)$/regpathhelper.obj \
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/processfactory/componentfactory.cxx b/unotools/source/processfactory/componentfactory.cxx
new file mode 100644
index 000000000000..98c648d48d12
--- /dev/null
+++ b/unotools/source/processfactory/componentfactory.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * $RCSfile: componentfactory.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <unotools/componentfactory.hxx>
+#include <unotools/processfactory.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HDL_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#include <cppuhelper/factory.hxx>
+
+#include <uno/environment.h>
+#include <uno/mapping.hxx>
+
+#include <rtl/ustring.hxx>
+#include <osl/module.h>
+
+
+#pragma hdrstop
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::rtl;
+
+
+namespace utl
+{
+
+Reference< XInterface > getComponentInstance(
+ const OUString & rLibraryName,
+ const OUString & rImplementationName
+ )
+{
+ Reference< XInterface > xI;
+ Reference< XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ if ( xMSF.is() )
+ xI = xMSF->createInstance( rImplementationName );
+ if( !xI.is() )
+ {
+ Reference< XSingleServiceFactory > xSSF =
+ loadLibComponentFactory( rLibraryName, rImplementationName,
+ Reference< XMultiServiceFactory >(), Reference< XRegistryKey >() );
+ xI = xSSF->createInstance();
+ }
+ return xI;
+}
+
+
+Reference< XSingleServiceFactory > loadLibComponentFactory(
+ const OUString & rLibName,
+ const OUString & rImplName,
+ const Reference< XMultiServiceFactory > & xSF,
+ const Reference< XRegistryKey > & xKey
+ )
+{
+ Reference< XSingleServiceFactory > xRet;
+
+ oslModule lib = osl_loadModule( rLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+ if (lib)
+ {
+ void * pSym;
+
+ // ========================= LATEST VERSION =========================
+ OUString aGetEnvName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETENV) );
+ if (pSym = osl_getSymbol( lib, aGetEnvName.pData ))
+ {
+ uno_Environment * pCurrentEnv = 0;
+ uno_Environment * pEnv = 0;
+ const sal_Char * pEnvTypeName = 0;
+ (*((component_getImplementationEnvironmentFunc)pSym))( &pEnvTypeName, &pEnv );
+
+ sal_Bool bNeedsMapping =
+ (pEnv || 0 != rtl_str_compare( pEnvTypeName, CPPU_CURRENT_LANGUAGE_BINDING_NAME ));
+
+ OUString aEnvTypeName( OUString::createFromAscii( pEnvTypeName ) );
+
+ if (bNeedsMapping)
+ {
+ if (! pEnv)
+ uno_getEnvironment( &pEnv, aEnvTypeName.pData, 0 );
+ if (pEnv)
+ {
+ OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
+ uno_getEnvironment( &pCurrentEnv, aCppEnvTypeName.pData, 0 );
+ if (pCurrentEnv)
+ bNeedsMapping = (pEnv != pCurrentEnv);
+ }
+ }
+
+ OUString aGetFactoryName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETFACTORY) );
+ if (pSym = osl_getSymbol( lib, aGetFactoryName.pData ))
+ {
+ OString aImplName( OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
+
+ if (bNeedsMapping)
+ {
+ if (pEnv && pCurrentEnv)
+ {
+ Mapping aCurrent2Env( pCurrentEnv, pEnv );
+ Mapping aEnv2Current( pEnv, pCurrentEnv );
+
+ if (aCurrent2Env.is() && aEnv2Current.is())
+ {
+ void * pSMgr = aCurrent2Env.mapInterface(
+ xSF.get(), ::getCppuType( (const Reference< XMultiServiceFactory > *)0 ) );
+ void * pKey = aCurrent2Env.mapInterface(
+ xKey.get(), ::getCppuType( (const Reference< XRegistryKey > *)0 ) );
+
+ void * pSSF = (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), pSMgr, pKey );
+
+ if (pKey)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pKey );
+ if (pSMgr)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSMgr );
+
+ if (pSSF)
+ {
+ aEnv2Current.mapInterface(
+ reinterpret_cast< void ** >( &xRet ),
+ pSSF, ::getCppuType( (const Reference< XSingleServiceFactory > *)0 ) );
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSSF );
+ }
+ }
+ }
+ }
+ else
+ {
+ XSingleServiceFactory * pRet = (XSingleServiceFactory *)
+ (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), xSF.get(), xKey.get() );
+ if (pRet)
+ {
+ xRet = pRet;
+ pRet->release();
+ }
+ }
+ }
+
+ if (pEnv)
+ (*pEnv->release)( pEnv );
+ if (pCurrentEnv)
+ (*pCurrentEnv->release)( pCurrentEnv );
+ }
+
+
+ if (! xRet.is())
+ osl_unloadModule( lib );
+ }
+
+ return xRet;
+}
+
+} // namespace utl
diff --git a/unotools/source/processfactory/makefile.mk b/unotools/source/processfactory/makefile.mk
new file mode 100644
index 000000000000..a0e4baf2567b
--- /dev/null
+++ b/unotools/source/processfactory/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=procfact
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+#UNOTYPES+= \
+# com.sun.star.uno.TypeClass \
+# com.sun.star.lang.XMultiServiceFactory
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/processfactory.obj \
+ $(SLO)$/componentfactory.obj
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/processfactory/processfactory.cxx b/unotools/source/processfactory/processfactory.cxx
new file mode 100644
index 000000000000..42ca1ae1f25d
--- /dev/null
+++ b/unotools/source/processfactory/processfactory.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * $RCSfile: processfactory.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace osl;
+
+namespace utl
+{
+
+/*
+ This function preserves only that the xProcessFactory variable will not be create when
+ the library is loaded.
+*/
+Reference< XMultiServiceFactory > localProcessFactory( const Reference< XMultiServiceFactory >& xSMgr, sal_Bool bSet )
+{
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+
+ static Reference< XMultiServiceFactory > xProcessFactory;
+ if ( bSet )
+ {
+ xProcessFactory = xSMgr;
+ }
+
+ return xProcessFactory;
+}
+
+
+void setProcessServiceFactory(const Reference< XMultiServiceFactory >& xSMgr)
+{
+ localProcessFactory( xSMgr, sal_True );
+}
+
+Reference< XMultiServiceFactory > getProcessServiceFactory()
+{
+ return localProcessFactory( Reference< XMultiServiceFactory >(), sal_False );
+}
+
+} // namesapce utl
+
diff --git a/unotools/source/property/makefile.mk b/unotools/source/property/makefile.mk
new file mode 100644
index 000000000000..88de50a1b134
--- /dev/null
+++ b/unotools/source/property/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=property
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/property.obj \
+ $(SLO)$/propmultiplex.obj \
+ $(SLO)$/propstate.obj \
+ $(SLO)$/propagg.obj \
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/streaming/makefile.mk b/unotools/source/streaming/makefile.mk
new file mode 100644
index 000000000000..7b9fbcb8d21a
--- /dev/null
+++ b/unotools/source/streaming/makefile.mk
@@ -0,0 +1,106 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJINC=..$/..$/inc
+PRJNAME=unotools
+TARGET=streaming
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings common for the whole project -----
+
+#UNOTYPES=
+#.INCLUDE : $(PRJINC)$/unotools$/unotools.mk
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Types -------------------------------------
+
+
+#UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+#UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+#UNOUCROUT=$(OUT)$/inc
+#INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+#UNOTYPES+= \
+# com.sun.star.awt.FontDescriptor \
+
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/basicio.obj \
+ $(SLO)$/streamsection.obj \
+ $(SLO)$/streamhelper.obj \
+ $(SLO)$/streamwrap.obj \
+ $(SLO)$/seqstream.obj \
+ $(SLO)$/oslfile2streamwrap.obj
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/unotools/source/streaming/streamhelper.cxx b/unotools/source/streaming/streamhelper.cxx
new file mode 100644
index 000000000000..ebbdd783ff21
--- /dev/null
+++ b/unotools/source/streaming/streamhelper.cxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamhelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <unotools/streamhelper.hxx>
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+namespace utl
+{
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::acquire() throw (staruno::RuntimeException)
+{
+ InputStreamHelper_Base::acquire();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::release() throw (staruno::RuntimeException)
+{
+ InputStreamHelper_Base::release();
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamHelper::readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
+ throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nBytesToRead < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ aData.realloc(nBytesToRead);
+
+ sal_uInt32 nRead;
+ ErrCode nError = m_xLockBytes->ReadAt(m_nActPos, (void*)aData.getArray(), nBytesToRead, &nRead);
+ m_nActPos += nRead;
+
+ if (nError != ERRCODE_NONE)
+ throw stario::IOException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ // adjust sequence if data read is lower than the desired data
+ if (nRead < (sal_uInt32)nBytesToRead)
+ aData.realloc( nRead );
+
+ return nRead;
+}
+
+void SAL_CALL OInputStreamHelper::seek( sal_Int64 location ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_nActPos = location;
+}
+
+sal_Int64 SAL_CALL OInputStreamHelper::getPosition( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ return m_nActPos;
+}
+
+sal_Int64 SAL_CALL OInputStreamHelper::getLength( ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ if (!m_xLockBytes.Is())
+ return 0;
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ SvLockBytesStat aStat;
+ m_xLockBytes->Stat( &aStat, SVSTATFLAG_DEFAULT );
+ m_nActPos = aStat.nSize;
+ return m_nActPos;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamHelper::readSomeBytes(staruno::Sequence< sal_Int8 >& aData,
+ sal_Int32 nMaxBytesToRead)
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ // read all data desired
+ return readBytes(aData, nMaxBytesToRead);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::skipBytes(sal_Int32 nBytesToSkip)
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nBytesToSkip < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_nActPos += nBytesToSkip;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamHelper::available()
+ throw (stario::NotConnectedException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ return m_nAvailable;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamHelper::closeInput()
+ throw (stario::NotConnectedException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_xLockBytes = NULL;
+}
+
+/*************************************************************************/
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::acquire() throw (staruno::RuntimeException)
+{
+ OutputStreamHelper_Base::acquire();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::release() throw (staruno::RuntimeException)
+{
+ OutputStreamHelper_Base::release();
+}
+// stario::XOutputStream
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::writeBytes(const staruno::Sequence< sal_Int8 >& aData)
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ ULONG nWritten;
+ ErrCode nError = m_xLockBytes->WriteAt( m_nActPos, aData.getConstArray(), aData.getLength(), &nWritten );
+ m_nActPos += nWritten;
+
+ if (nError != ERRCODE_NONE ||
+ nWritten != aData.getLength())
+ {
+ throw stario::IOException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::flush()
+ throw (stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ ErrCode nError = m_xLockBytes->Flush();
+ if (nError != ERRCODE_NONE)
+ throw stario::IOException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamHelper::closeOutput( )
+ throw(stario::NotConnectedException, stario::BufferSizeExceededException, stario::IOException, staruno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_xLockBytes.Is())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_xLockBytes = NULL;
+}
+
+} // namespace utl
+
+
diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx
new file mode 100644
index 000000000000..399e78e328e1
--- /dev/null
+++ b/unotools/source/streaming/streamwrap.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * $RCSfile: streamwrap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UTL_STREAM_WRAPPER_HXX_
+#include <unotools/streamwrap.hxx>
+#endif
+
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+namespace utl
+{
+
+DBG_NAME(OInputStreamWrapper)
+//------------------------------------------------------------------
+OInputStreamWrapper::OInputStreamWrapper( SvStream& _rStream )
+ :m_pSvStream(&_rStream)
+ ,m_bSvStreamOwner(sal_False)
+{
+ DBG_CTOR(OInputStreamWrapper,NULL);
+
+}
+
+//------------------------------------------------------------------
+OInputStreamWrapper::OInputStreamWrapper( SvStream* pStream, sal_Bool bOwner )
+ :m_pSvStream( pStream )
+ ,m_bSvStreamOwner( bOwner )
+{
+ DBG_CTOR(OInputStreamWrapper,NULL);
+
+}
+
+//------------------------------------------------------------------
+OInputStreamWrapper::~OInputStreamWrapper()
+{
+ if( m_bSvStreamOwner )
+ delete m_pSvStream;
+
+ DBG_DTOR(OInputStreamWrapper,NULL);
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead)
+ throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nBytesToRead < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ aData.realloc(nBytesToRead);
+
+ sal_uInt32 nRead = m_pSvStream->Read((void*)aData.getArray(), nBytesToRead);
+ if (m_pSvStream->SvStream::GetError() != ERRCODE_NONE)
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ // Wenn gelesene Zeichen < MaxLength, staruno::Sequence anpassen
+ if (nRead < (sal_uInt32)nBytesToRead)
+ aData.realloc( nRead );
+
+ return nRead;
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamWrapper::readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (nMaxBytesToRead < 0)
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ if (m_pSvStream->IsEof())
+ {
+ aData.realloc(0);
+ return 0;
+ }
+ else
+ return readBytes(aData, nMaxBytesToRead);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+#ifdef DBG_UTIL
+ sal_uInt32 nCurrentPos = m_pSvStream->Tell();
+#endif
+
+ m_pSvStream->SeekRel(nBytesToSkip);
+ if (m_pSvStream->SvStream::GetError() != ERRCODE_NONE)
+ {
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+ }
+
+#ifdef DBG_UTIL
+ nCurrentPos = m_pSvStream->Tell();
+#endif
+}
+
+//------------------------------------------------------------------------------
+sal_Int32 SAL_CALL OInputStreamWrapper::available() throw( stario::NotConnectedException, staruno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ sal_uInt32 nPos = m_pSvStream->Tell();
+ if (m_pSvStream->SvStream::GetError())
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ m_pSvStream->Seek(STREAM_SEEK_TO_END);
+ if (m_pSvStream->SvStream::GetError())
+ throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+
+ sal_Int32 nAvailable = (sal_Int32)m_pSvStream->Tell() - nPos;
+ m_pSvStream->Seek(nPos);
+ if (m_pSvStream->SvStream::GetError())
+ throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+ return nAvailable;
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OInputStreamWrapper::closeInput() throw( stario::NotConnectedException, staruno::RuntimeException )
+{
+ if (!m_pSvStream)
+ throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
+
+ if (m_bSvStreamOwner)
+ delete m_pSvStream;
+
+ m_pSvStream = NULL;
+}
+
+/*************************************************************************/
+// stario::XOutputStream
+//------------------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ sal_uInt32 nWritten = rStream.Write(aData.getConstArray(),aData.getLength());
+ ErrCode err = rStream.GetError();
+ if (err != ERRCODE_NONE || nWritten != aData.getLength())
+ {
+ throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+ }
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::flush() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+ rStream.Flush();
+ if (rStream.GetError() != ERRCODE_NONE)
+ throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
+}
+
+//------------------------------------------------------------------
+void SAL_CALL OOutputStreamWrapper::closeOutput() throw( stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException )
+{
+}
+
+} // namespace utl
+
+
diff --git a/unotools/util/makefile.mk b/unotools/util/makefile.mk
new file mode 100644
index 000000000000..c3b5ff7702fa
--- /dev/null
+++ b/unotools/util/makefile.mk
@@ -0,0 +1,149 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:03:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+PRJNAME=unotools
+TARGET=utl
+TARGETTYPE=CUI
+USE_LDUMP2=TRUE
+
+USE_DEFFILE=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+LDUMP=ldump2.exe
+
+# --- Library -----------------------------------
+
+LIB1TARGET=$(SLB)$/untools.lib
+LIB1FILES=\
+ $(SLB)$/i18n.lib \
+ $(SLB)$/misc.lib \
+ $(SLB)$/property.lib \
+ $(SLB)$/streaming.lib \
+ $(SLB)$/database.lib \
+ $(SLB)$/evtattmgr.lib \
+ $(SLB)$/config.lib \
+ $(SLB)$/container.lib \
+ $(SLB)$/procfact.lib
+
+# NETBSD: somewhere we have to instantiate the static data members.
+# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work.
+# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX"
+LIB1OBJFILES+=$(OBJ)$/staticmb.obj
+.ENDIF
+
+SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX)
+
+SHL1IMPLIB=iutl
+
+SHL1STDLIBS= \
+ $(SALLIB) \
+ $(OSLLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(TOOLSLIB)
+
+SHL1LIBS=$(LIB1TARGET)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1EXPORTFILE=$(TARGET).dxp
+
+SHL1DEPN=$(LIB1TARGET)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
+# === .def file ==========================================================
+# --- W32 ----------------------------------------------------------------
+
+.IF "$(GUI)" == "WNT"
+
+$(MISC)$/$(SHL1TARGET).def: $(MISC)$/$(SHL1TARGET).flt makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo LIBRARY $(SHL1TARGET) >$@
+ @echo DESCRIPTION 'UTL' >>$@
+ @echo DATA READWRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ $(LIBMGR) -EXTRACT:/ /OUT:$(TARGET).exp $(LIB1TARGET)
+ @$(LDUMP) -E20 -F$(MISC)$/$(SHL1TARGET).flt $(TARGET).exp >>$@
+ +-del $(TARGET).exp
+
+.ENDIF
+
+
+# --- Allgemein ----------------------------------------------------------
+
+# --- Filter-Datei ---
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo CLEAR_THE_FILE > $@
+ @echo _TI >> $@
+ @echo _real >> $@
+
diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx
new file mode 100644
index 000000000000..8ccec7410fcf
--- /dev/null
+++ b/vcl/aqua/inc/saldata.hxx
@@ -0,0 +1,362 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldata.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALDATA_HXX
+#define _SV_SALDATA_HXX
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+
+class AutoTimer;
+class SalInstance;
+class SalObject;
+class SalFrame;
+class SalVirtualDevice;
+class SalPrinter;
+class Font;
+struct HDCCache;
+
+// --------------------
+// - Standard-Defines -
+// --------------------
+
+#define MAX_STOCKPEN 4
+#define MAX_STOCKBRUSH 4
+#define SAL_CLIPRECT_COUNT 16
+
+// -----------
+// - SalData -
+// -----------
+
+struct SalData
+{
+ HINSTANCE mhInst; // default instance handle
+ HINSTANCE mhPrevInst; // previous instance handle
+ int mnCmdShow; // default frame show style
+ // Erst hier koennen Daten kompatible eingefuegt werden, da die
+ // oberen Daten in salmain.cxx modifiziert werden
+ HPALETTE mhDitherPal; // dither palette
+ HGLOBAL mhDitherDIB; // dither memory handle
+ BYTE* mpDitherDIB; // dither memory
+ BYTE* mpDitherDIBData; // beginning of DIB data
+ long* mpDitherDiff; // Dither mapping table
+ BYTE* mpDitherLow; // Dither mapping table
+ BYTE* mpDitherHigh; // Dither mapping table
+ ULONG mnTimerMS; // Current Time (in MS) of the Timer
+ ULONG mnTimerOrgMS; // Current Original Time (in MS)
+ UINT mnTimerId; // windows timer id
+ SALTIMERPROC mpTimerProc; // timer callback proc
+ HHOOK mhSalObjMsgHook; // hook um SalObject relevante Message mitzubekommen
+ HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message
+ AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test
+ SalInstance* mpFirstInstance; // pointer of first instance
+ SalFrame* mpFirstFrame; // pointer of first frame
+ SalObject* mpFirstObject; // pointer of first object window
+ SalVirtualDevice* mpFirstVD; // first VirDev
+ SalPrinter* mpFirstPrinter; // first printing printer
+ HDCCache* mpHDCCache; // Cache for three DC's
+ HBITMAP mh50Bmp; // 50% Bitmap
+ HBRUSH mh50Brush; // 50% Brush
+ COLORREF maStockPenColorAry[MAX_STOCKPEN];
+ COLORREF maStockBrushColorAry[MAX_STOCKBRUSH];
+ HPEN mhStockPenAry[MAX_STOCKPEN];
+ HBRUSH mhStockBrushAry[MAX_STOCKBRUSH];
+ USHORT mnStockPenCount; // Anzahl statischer Pens
+ USHORT mnStockBrushCount; // Anzahl statischer Brushes
+ WPARAM mnSalObjWantKeyEvt; // KeyEvent, welcher vom SalObj-Hook verarbeitet werden soll
+ BOOL mbObjClassInit; // Ist SALOBJECTCLASS initialised
+ BOOL mbInPalChange; // is in WM_QUERYNEWPALETTE
+ DWORD mnAppThreadId; // Id from Applikation-Thread
+ WIN_BOOL mbScrSvrEnabled; // ScreenSaver enabled
+ int mnSageStatus; // Status der Sage-DLL (DISABLE_AGENT == nicht vorhanden)
+ HINSTANCE mhSageInst; // Instance-Handle zur Sage-DLL
+ SysAgt_Enable_PROC mpSageEnableProc; // Funktion zum deaktivieren des Systemagenten
+};
+
+inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
+inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
+inline SalData* GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
+
+// --------------
+// - SalShlData -
+// --------------
+
+struct SalShlData
+{
+ HINSTANCE mhInst; // Instance of SAL-DLL
+ UINT mnVKAdd; // VK-Code von KEY_ADD
+ UINT mnVKSubtract; // VK-Code von KEY_SUBTRACT
+ UINT mnVKMultiply; // VK-Code von KEY_MULTIPLY
+ UINT mnVKDivide; // VK-Code von KEY_DIVIDE
+ UINT mnVKPoint; // VK-Code von KEY_POINT
+ UINT mnVKComma; // VK-Code von KEY_KOMMA
+ UINT mnVKLess; // VK-Code von KEY_LESS
+ UINT mnVKGreater; // VK-Code von KEY_GREATER
+ UINT mnVKEqual; // VK-Code von KEY_EQUAL
+ UINT mnWheelScrollLines; // WheelScrollLines
+ UINT mnWheelMsgId; // Wheel-Message-Id fuer W95
+};
+
+extern SalShlData aSalShlData;
+
+// ------------
+// - GDICache -
+// ------------
+
+#define CACHESIZE_HDC 3
+#define CACHED_HDC_1 0
+#define CACHED_HDC_2 1
+#define CACHED_HDC_DRAW 2
+#define CACHED_HDC_DEFEXT 64
+
+struct HDCCache
+{
+ HDC mhDC;
+ HPALETTE mhDefPal;
+ HBITMAP mhDefBmp;
+ HBITMAP mhSelBmp;
+ HBITMAP mhActBmp;
+};
+
+void ImplClearHDCCache( SalData* pData );
+HDC ImplGetCachedDC( ULONG nID, HBITMAP hBmp = 0 );
+void ImplReleaseCachedDC( ULONG nID );
+
+// ------------------------------------------------------
+// - salshl.cxx - Funktionen fuer DLL-Resource-Zugriffe -
+// ------------------------------------------------------
+
+HCURSOR ImplLoadSalCursor( int nId );
+HBITMAP ImplLoadSalBitmap( int nId );
+BOOL ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon );
+
+void ImplInitSalGDI();
+void ImplFreeSalGDI();
+
+// --------------
+// - Prototypes -
+// --------------
+
+void ImplSalYieldMutexAcquireWithWait();
+BOOL ImplSalYieldMutexTryToAcquire();
+void ImplSalYieldMutexAcquire();
+void ImplSalYieldMutexRelease();
+ULONG ImplSalReleaseYieldMutex();
+void ImplSalAcquireYieldMutex( ULONG nCount );
+
+LRESULT CALLBACK SalFrameWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+void CALLBACK SalTimerProc( HWND hWnd, UINT nMsg, UINT nId, DWORD nTime );
+
+void SalTestMouseLeave();
+
+long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam );
+BOOL ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult );
+
+SalObject* ImplFindSalObject( HWND hWndChild );
+#ifdef WIN
+BOOL ImplSalPreDispatchMsg( MSG* pMsg );
+void ImplSalPostDispatchMsg( MSG* pMsg, LRESULT nDispatchResult );
+
+void ImplSalLogFontToFontA( const LOGFONTA& rLogFont, Font& rFont );
+void ImplSalLogFontToFontW( const LOGFONTW& rLogFont, Font& rFont );
+#endif
+
+rtl_TextEncoding ImplSalGetSystemEncoding();
+ByteString ImplSalGetWinAnsiString( const UniString& rStr, BOOL bFileName = FALSE );
+UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen = STRING_LEN );
+int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 );
+
+// -----------
+// - Defines -
+// -----------
+
+#define SAL_FRAME_WNDEXTRA sizeof( DWORD )
+#define SAL_FRAME_THIS 0
+#define SAL_FRAME_CLASSNAMEA "SALFRAME"
+#define SAL_FRAME_CLASSNAMEW L"SALFRAME"
+#define SAL_FRAME_CLASSNAME_SBA "SALFRAMESB"
+#define SAL_FRAME_CLASSNAME_SBW L"SALFRAMESB"
+#define SAL_OBJECT_WNDEXTRA sizeof( DWORD )
+#define SAL_OBJECT_THIS 0
+#define SAL_OBJECT_CLASSNAMEA "SALOBJECT"
+#define SAL_OBJECT_CLASSNAMEW L"SALOBJECT"
+#define SAL_OBJECT_CHILDCLASSNAMEA "SALOBJECTCHILD"
+#define SAL_OBJECT_CHILDCLASSNAMEW L"SALOBJECTCHILD"
+#define SAL_COM_CLASSNAMEA "SALCOMWND"
+#define SAL_COM_CLASSNAMEW L"SALCOMWND"
+
+#define SAL_MOUSELEAVE_TIMEOUT 300
+
+// wParam == hDC; lParam == 0
+#define SAL_MSG_PRINTABORTJOB (WM_USER+110)
+// wParam == bWait; lParam == 0
+#define SAL_MSG_THREADYIELD (WM_USER+111)
+// wParam == 0; lParam == 0
+#define SAL_MSG_RELEASEWAITYIELD (WM_USER+112)
+// wParam == 0; lParam == nMS
+#define SAL_MSG_STARTTIMER (WM_USER+113)
+// wParam == nFrameStyle; lParam == pParent; lResult == pFrame
+#define SAL_MSG_CREATEFRAME (WM_USER+114)
+// wParam == 0; lParam == 0
+#define SAL_MSG_DESTROYFRAME (WM_USER+115)
+// wParam == 0; lParam == pParent; lResult == pObject
+#define SAL_MSG_CREATEOBJECT (WM_USER+116)
+// wParam == 0; lParam == pObject;
+#define SAL_MSG_DESTROYOBJECT (WM_USER+117)
+// wParam == 0; lParam == this; lResult == bRet
+#define SAL_MSG_CREATESOUND (WM_USER+118)
+// wParam == 0; lParam == this
+#define SAL_MSG_DESTROYSOUND (WM_USER+119)
+
+// wParam == 0; lParam == pData
+#define SAL_MSG_USEREVENT (WM_USER+130)
+// wParam == 0; lParam == MousePosition relativ to upper left of screen
+#define SAL_MSG_MOUSELEAVE (WM_USER+131)
+// NULL-Message, soll nicht verarbeitet werden
+#define SAL_MSG_DUMMY (WM_USER+132)
+// wParam == 0; lParam == 0
+#define SAL_MSG_POSTFOCUS (WM_USER+133)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTQUERYNEWPAL (WM_USER+134)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTPALCHANGED (WM_USER+135)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTMOVE (WM_USER+136)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTCALLSIZE (WM_USER+137)
+// wParam == pRECT
+#define SAL_MSG_POSTPAINT (WM_USER+138)
+// wParam == 0; lParam == pFrame; lResult 0
+#define SAL_MSG_FORCEPALETTE (WM_USER+139)
+// wParam == 0; lParam == 0;
+#define SAL_MSG_CAPTUREMOUSE (WM_USER+140)
+// wParam == 0; lParam == 0
+#define SAL_MSG_RELEASEMOUSE (WM_USER+141)
+// wParam == nFlags; lParam == 0
+#define SAL_MSG_TOTOP (WM_USER+142)
+// wParam == bVisible; lParam == 0
+#define SAL_MSG_SHOW (WM_USER+143)
+
+// SysChild-ToTop; wParam = 0; lParam = 0
+#define SALOBJ_MSG_TOTOP (WM_USER+160)
+// POSTFOCUS-Message; wParam == bFocus; lParam == 0
+#define SALOBJ_MSG_POSTFOCUS (WM_USER+161)
+
+// -----------------
+// - Helpfunctions -
+// -----------------
+
+// A/W-Wrapper
+#ifdef WIN
+LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong );
+LONG ImplGetWindowLong( HWND hWnd, int nIndex );
+WIN_BOOL ImplPostMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
+WIN_BOOL ImplSendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
+WIN_BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax );
+WIN_BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg );
+LONG ImplDispatchMessage( const MSG *lpMsg );
+#endif
+
+inline void SetWindowPtr( HWND hWnd, SalFrame* pThis )
+{
+#ifdef WIN
+ ImplSetWindowLong( hWnd, SAL_FRAME_THIS, (LONG)pThis );
+#endif
+}
+
+inline SalFrame* GetWindowPtr( HWND hWnd )
+{
+#ifdef WIN
+ return (SalFrame*)ImplGetWindowLong( hWnd, SAL_FRAME_THIS );
+#else
+ return NULL;
+#endif
+}
+
+inline void SetSalObjWindowPtr( HWND hWnd, SalObject* pThis )
+{
+#ifdef WIN
+ ImplSetWindowLong( hWnd, SAL_OBJECT_THIS, (LONG)pThis );
+#endif
+}
+
+inline SalObject* GetSalObjWindowPtr( HWND hWnd )
+{
+#ifdef WIN
+ return (SalObject*)ImplGetWindowLong( hWnd, SAL_OBJECT_THIS );
+#else
+ return NULL;
+#endif
+}
+
+#endif // _SV_SALDATA_HXX
diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h
new file mode 100644
index 000000000000..48afb6522265
--- /dev/null
+++ b/vcl/aqua/inc/salframe.h
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALFRAME_H
+#define _SV_SALFRAME_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+// ----------------
+// - SalFrameData -
+// ----------------
+
+class SalFrameData
+{
+public:
+ HWND mhWnd; // Window handle
+ HCURSOR mhCursor; // cursor handle
+ HIMC mhDefIMEContext; // default IME-Context
+ SalGraphics* mpGraphics; // current frame graphics
+ SalFrame* mpNextFrame; // pointer to next frame
+ void* mpInst; // instance handle for callback
+ SALFRAMEPROC mpProc; // callback proc
+ SystemEnvData maSysData; // system data
+ SalFrameState maState; // frame state
+ int mnShowState; // show state
+ long mnWidth; // client width in pixeln
+ long mnHeight; // client height in pixeln
+ RECT maFullScreenRect; // fullscreen rect
+ int mnFullScreenShowState; // fullscreen restore show state
+ UINT mnInputLang; // current Input Language
+ UINT mnInputCodePage; // current Input CodePage
+ USHORT mnStyle; // style
+ BOOL mbGraphics; // is Graphics used
+ BOOL mbCaption; // has window a caption
+ BOOL mbBorder; // has window a border
+ BOOL mbSizeBorder; // has window a sizeable border
+ BOOL mbFullScreen; // TRUE: in full screen mode
+ BOOL mbPresentation; // TRUE: Presentation Mode running
+ BOOL mbInShow; // innerhalb eines Show-Aufrufs
+ BOOL mbRestoreMaximize; // Restore-Maximize
+ BOOL mbInMoveMsg; // Move-Message wird verarbeitet
+ BOOL mbInSizeMsg; // Size-Message wird verarbeitet
+ BOOL mbFullScreenToolWin; // WS_EX_TOOLWINDOW reset in FullScreenMode
+ BOOL mbDefPos; // default-position
+ BOOL mbOverwriteState; // TRUE: WindowState darf umgesetzt werden
+ BOOL mbIME; // TRUE: We are in IME Mode
+ BOOL mbHandleIME; // TRUE: Wir handeln die IME-Messages
+ BOOL mbSpezIME; // TRUE: Spez IME
+ BOOL mbAtCursorIME; // TRUE: Wir behandeln nur einige IME-Messages
+ BOOL mbCompositionMode; // TRUE: Wir befinden uns im Composition-Modus
+ BOOL mbCandidateMode; // TRUE: Wir befinden uns im Candidate-Modus
+};
+
+#endif // _SV_SALFRAME_H
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
new file mode 100644
index 000000000000..0ce9eb842cb5
--- /dev/null
+++ b/vcl/aqua/inc/salgdi.h
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:25 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALGDI_H
+#define _SV_SALGDI_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000)
+#define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff)
+
+// -------------------
+// - SalGraphicsData -
+// -------------------
+
+class SalGraphicsData
+{
+public:
+ HDC mhDC; // HDC
+ HWND mhWnd; // Window-Handle, when Window-Graphics
+ HPEN mhPen; // Pen
+ HBRUSH mhBrush; // Brush
+ HFONT mhFont; // Font
+ HRGN mhRegion; // Region Handle
+ HPEN mhDefPen; // DefaultPen
+ HBRUSH mhDefBrush; // DefaultBrush
+ HFONT mhDefFont; // DefaultFont
+ HPALETTE mhDefPal; // DefaultPalette
+ COLORREF mnPenColor; // PenColor
+ COLORREF mnBrushColor; // BrushColor
+ COLORREF mnTextColor; // TextColor
+#ifdef WIN
+ RGNDATA* mpClipRgnData; // ClipRegion-Data
+ RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data
+#endif
+ RECT* mpNextClipRect; // Naechstes ClipRegion-Rect
+ BOOL mbFirstClipRect; // Flag for first cliprect to insert
+#ifdef WIN
+ LOGFONTA* mpLogFont; // LOG-Font which is currently selected (only W9x)
+#endif
+ BYTE* mpFontCharSets; // All Charsets for the current font
+ BYTE mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried
+#ifdef WIN
+ KERNINGPAIR* mpFontKernPairs; // Kerning Pairs of the current Font
+#endif
+ ULONG mnFontKernPairCount;// Number of Kerning Pairs of the current Font
+ BOOL mbFontKernInit; // FALSE: FontKerns must be queried
+ int mnFontOverhang; // Font-Overhang
+ int mnPenWidth; // Linienbreite
+ BOOL mbStockPen; // is Pen a stockpen
+ BOOL mbStockBrush; // is Brush a stcokbrush
+ BOOL mbPen; // is Pen (FALSE == NULL_PEN)
+ BOOL mbBrush; // is Brush (FALSE == NULL_BRUSH)
+ BOOL mbPrinter; // is Printer
+ BOOL mbVirDev; // is VirDev
+ BOOL mbWindow; // is Window
+ BOOL mbScreen; // is Screen compatible
+ BOOL mbXORMode; // _every_ output with RasterOp XOR
+ BOOL mbCalcOverhang; // calc overhang
+};
+
+// Init/Deinit Graphics
+void ImplSalInitGraphics( SalGraphicsData* mpData );
+void ImplSalDeInitGraphics( SalGraphicsData* mpData );
+void ImplUpdateSysColorEntries();
+int ImplIsSysColorEntry( SalColor nSalColor );
+
+// -----------
+// - Defines -
+// -----------
+
+#define MAX_64KSALPOINTS ((((USHORT)0xFFFF)-4)/sizeof(POINT))
+
+#endif // _SV_SALGDI_H
diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h
new file mode 100644
index 000000000000..77ce94a3461b
--- /dev/null
+++ b/vcl/aqua/inc/salinst.h
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALINST_H
+#define _SV_SALINST_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+#ifdef _VOS_NO_NAMESPACE
+class OMutex;
+#else
+namespace vos { class OMutex; }
+#endif
+class SalYieldMutex;
+class SalInstance;
+class SalFrame;
+class SalObject;
+
+// -------------------
+// - SalInstanceData -
+// -------------------
+
+class SalInstanceData
+{
+public:
+ HINSTANCE mhInst; // Instance Handle
+ HWND mhComWnd; // window, for communication (between threads and the main thread)
+ void* mpFilterInst;
+ void* mpFilterCallback;
+ SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex
+#ifdef _VOS_NO_NAMESPACE
+ OMutex* mpSalWaitMutex; // Sal-Wait-Mutex
+#else
+ vos::OMutex* mpSalWaitMutex; // Sal-Wait-Mutex
+#endif
+ USHORT mnYieldWaitCount; // Wait-Count
+};
+
+// --------------
+// - Prototypen -
+// --------------
+
+SalFrame* ImplSalCreateFrame( SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle );
+SalObject* ImplSalCreateObject( SalInstance* pInst, SalFrame* pParent );
+void ImplSalStartTimer( ULONG nMS, BOOL bMutex = FALSE );
+void ImplSalPrinterAbortJobAsync( HDC hPrnDC );
+
+#endif // _SV_SALINST_H
diff --git a/vcl/aqua/inc/salobj.h b/vcl/aqua/inc/salobj.h
new file mode 100644
index 000000000000..07cba9defb49
--- /dev/null
+++ b/vcl/aqua/inc/salobj.h
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALOBJ_H
+#define _SV_SALOBJ_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+// -----------------
+// - SalObjectData -
+// -----------------
+
+class SalObjectData
+{
+public:
+ HWND mhWnd; // Window handle
+ HWND mhWndChild; // Child Window handle
+ HWND mhLastFocusWnd; // Child-Window, welches als letztes den Focus hatte
+ SystemChildData maSysData; // SystemEnvData
+#ifdef WIN
+ RGNDATA* mpClipRgnData; // ClipRegion-Data
+ RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data
+#endif
+ RECT* mpNextClipRect; // Naechstes ClipRegion-Rect
+ BOOL mbFirstClipRect; // Flag for first cliprect to insert
+ SalObject* mpNextObject; // pointer to next object
+ void* mpInst; // instance handle for callback
+ SALOBJECTPROC mpProc; // callback proc
+};
+
+#endif // _SV_SALOBJ_H
diff --git a/vcl/aqua/inc/salprn.h b/vcl/aqua/inc/salprn.h
new file mode 100644
index 000000000000..483d351fd8fa
--- /dev/null
+++ b/vcl/aqua/inc/salprn.h
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: salprn.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALPRN_H
+#define _SV_SALPRN_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalGraphics;
+class SalInfoPrinter;
+
+// -----------------
+// - SalDriverData -
+// -----------------
+
+// WNT3
+#define SAL_DRIVERDATA_SYSSIGN ((ULONG)0x574E5433)
+#define SAL_DRIVERDATA_VERSION 1
+#define SAL_DEVMODE( pSetupData ) ((LPDEVMODE)((pSetupData->mpDriverData) + (((SalDriverData*)(pSetupData->mpDriverData))->mnDriverOffset)))
+
+#pragma pack( 1 )
+
+struct SalDriverData
+{
+ ULONG mnSysSignature;
+ USHORT mnVersion;
+ USHORT mnDriverOffset;
+ BYTE maDriverData[1];
+};
+
+#pragma pack()
+
+// -------------------
+// - SalSysQueueData -
+// -------------------
+
+struct SalSysQueueData
+{
+ XubString maDriverName; // printer driver name
+ XubString maDeviceName; // printer device name
+ XubString maPortName; // printer port name
+ ByteString maDriverNameA; // printer driver name
+ ByteString maDeviceNameA; // printer device name
+ ByteString maPortNameA; // printer port name
+ BOOL mbAnsi; // TRUE - use A functions
+};
+
+// ----------------------
+// - SalInfoPrinterData -
+// ----------------------
+
+class SalInfoPrinterData
+{
+public:
+ SalGraphics* mpGraphics; // current Printer graphics
+ XubString maDriverName; // printer driver name
+ XubString maDeviceName; // printer device name
+ XubString maPortName; // printer port name
+ ByteString maDriverNameA; // printer driver name
+ ByteString maDeviceNameA; // printer device name
+ ByteString maPortNameA; // printer port name
+ HDC mhDC; // printer hdc
+ BOOL mbGraphics; // is Graphics used
+ BOOL mbAnsi;
+};
+
+// ------------------
+// - SalPrinterData -
+// ------------------
+
+class SalPrinterData
+{
+public:
+ SalGraphics* mpGraphics; // current Printer graphics
+ SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter
+ SalPrinter* mpNextPrinter; // next printing printer
+ HDC mhDC; // printer hdc
+ ULONG mnError; // Error Code
+ ULONG mnCopies; // Kopien
+ BOOL mbCollate; // Sortierte Kopien
+ BOOL mbAbort; // Job Aborted
+};
+
+#endif // _SV_SALPRN_H
diff --git a/vcl/aqua/inc/salsys.h b/vcl/aqua/inc/salsys.h
new file mode 100644
index 000000000000..3660ee45051f
--- /dev/null
+++ b/vcl/aqua/inc/salsys.h
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALSYS_H
+#define _SV_SALSYS_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalFrame;
+
+// -----------------
+// - SalSystemData -
+// -----------------
+
+class SalSystemData
+{
+};
+
+#endif // _SV_SALSYS_H
diff --git a/vcl/aqua/inc/salvd.h b/vcl/aqua/inc/salvd.h
new file mode 100644
index 000000000000..e6eea8235698
--- /dev/null
+++ b/vcl/aqua/inc/salvd.h
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALVD_H
+#define _SV_SALVD_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalGraphics;
+class SalVirtualDevice;
+
+// -----------------
+// - SalVirDevData -
+// -----------------
+
+class SalVirDevData
+{
+public:
+ HDC mhDC; // HDC or 0 for Cache Device
+ HBITMAP mhBmp; // Memory Bitmap
+ HBITMAP mhDefBmp; // Default Bitmap
+ SalGraphics* mpGraphics; // current VirDev graphics
+ SalVirtualDevice* mpNext; // next VirDev
+ USHORT mnBitCount; // BitCount (0 or 1)
+ BOOL mbGraphics; // is Graphics used
+};
+
+#endif // _SV_SALVD_H
diff --git a/vcl/aqua/inc/svsys.h b/vcl/aqua/inc/svsys.h
new file mode 100644
index 000000000000..6391751656c7
--- /dev/null
+++ b/vcl/aqua/inc/svsys.h
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: svsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVSYS_H
+#define _SV_SVSYS_H
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#endif // _SV_SVSYS_H
diff --git a/vcl/aqua/source/app/makefile.mk b/vcl/aqua/source/app/makefile.mk
new file mode 100644
index 000000000000..abb29cc745bb
--- /dev/null
+++ b/vcl/aqua/source/app/makefile.mk
@@ -0,0 +1,113 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salapp
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(OS)"!="MACOSX"
+
+dummy:
+ @echo "Nothing to build for this platform"
+
+.ELSE # "$(OS)"!="MACOSX"
+
+.IF "$(remote)"==""
+OBJFILES=\
+ $(OBJ)$/salmain.obj
+
+SLOFILES= $(SLO)$/salshl.obj \
+ $(SLO)$/saldata.obj \
+ $(SLO)$/salinst.obj \
+ $(SLO)$/saltimer.obj \
+ $(SLO)$/salsound.obj \
+ $(SLO)$/salinfo.obj \
+ $(SLO)$/salsys.obj
+
+.ELSE
+SLOFILES=\
+ $(SLO)$/salmain.obj
+.ENDIF
+
+.IF "$(remote)"!=""
+EXCEPTIONSFILES=$(SLO)$/salmain.obj \
+ $(OBJ)$/salmain.obj
+.ENDIF
+
+.ENDIF # "$(OS)"!="MACOSX"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/vcl/aqua/source/app/saldata.cxx b/vcl/aqua/source/app/saldata.cxx
new file mode 100644
index 000000000000..39c8b22e342c
--- /dev/null
+++ b/vcl/aqua/source/app/saldata.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALDATA_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+// =======================================================================
+
+rtl_TextEncoding ImplSalGetSystemEncoding()
+{
+ static UINT nOldAnsiCodePage = 0;
+ static rtl_TextEncoding eEncoding = RTL_TEXTENCODING_MS_1252;
+
+#ifdef WIN
+ UINT nAnsiCodePage = GetACP();
+ if ( nAnsiCodePage != nOldAnsiCodePage )
+ {
+ switch ( nAnsiCodePage )
+ {
+ case 1252:
+ eEncoding = RTL_TEXTENCODING_MS_1252;
+ break;
+ case 1250:
+ eEncoding = RTL_TEXTENCODING_MS_1250;
+ break;
+ case 1251:
+ eEncoding = RTL_TEXTENCODING_MS_1251;
+ break;
+ case 1253:
+ eEncoding = RTL_TEXTENCODING_MS_1253;
+ break;
+ case 1254:
+ eEncoding = RTL_TEXTENCODING_MS_1254;
+ break;
+ case 1255:
+ eEncoding = RTL_TEXTENCODING_MS_1255;
+ break;
+ case 1256:
+ eEncoding = RTL_TEXTENCODING_MS_1256;
+ break;
+ case 1257:
+ eEncoding = RTL_TEXTENCODING_MS_1257;
+ break;
+ case 1258:
+ eEncoding = RTL_TEXTENCODING_MS_1258;
+ break;
+ case 874:
+ eEncoding = RTL_TEXTENCODING_MS_874;
+ break;
+ case 932:
+ eEncoding = RTL_TEXTENCODING_MS_932;
+ break;
+ case 936:
+ eEncoding = RTL_TEXTENCODING_MS_936;
+ break;
+ case 949:
+ eEncoding = RTL_TEXTENCODING_MS_949;
+ break;
+ case 950:
+ eEncoding = RTL_TEXTENCODING_MS_950;
+ break;
+// case 1381:
+// eEncoding = RTL_TEXTENCODING_MS_1381;
+// break;
+ }
+ }
+#endif
+
+ return eEncoding;
+}
+
+// -----------------------------------------------------------------------
+
+ByteString ImplSalGetWinAnsiString( const UniString& rStr, BOOL bFileName )
+{
+ rtl_TextEncoding eEncoding = ImplSalGetSystemEncoding();
+ if ( bFileName )
+ {
+ return ByteString( rStr, eEncoding,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
+ }
+ else
+ {
+ return ByteString( rStr, eEncoding,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen )
+{
+ return UniString( pStr, nLen, ImplSalGetSystemEncoding(),
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
+}
+
+// =======================================================================
+
+int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 )
+{
+ int nRet;
+ wchar_t c1;
+ char c2;
+ do
+ {
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+ nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2));
+ if ( nRet != 0 )
+ break;
+
+ pStr1++;
+ pStr2++;
+ }
+ while ( c2 );
+
+ return nRet;
+}
+
+// =======================================================================
+
+#ifdef WIN
+LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong )
+{
+ return SetWindowLongA( hWnd, nIndex, dwNewLong );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+LONG ImplGetWindowLong( HWND hWnd, int nIndex )
+{
+ return GetWindowLongA( hWnd, nIndex );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+WIN_BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ return PostMessageA( hWnd, nMsg, wParam, lParam );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+WIN_BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ return SendMessageA( hWnd, nMsg, wParam, lParam );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+WIN_BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax )
+{
+ return GetMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+WIN_BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg )
+{
+ return PeekMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+LONG ImplDispatchMessage( const MSG *lpMsg )
+{
+ return DispatchMessageA( lpMsg );
+}
+#endif
+
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
new file mode 100644
index 000000000000..8dc10e7e565b
--- /dev/null
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -0,0 +1,918 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <tools/svwin.h>
+#ifdef WNT
+#include <process.h>
+#endif
+
+#define _SV_SALINST_CXX
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+#ifndef _SV_SALSOUND_HXX
+#include <salsound.hxx>
+#endif
+#ifndef _SV_SALATYPE_HXX
+#include <salatype.hxx>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+
+// =======================================================================
+
+void SalAbort( const XubString& rErrorText )
+{
+ ImplFreeSalGDI();
+
+#ifdef WIN
+ if ( !rErrorText.Len() )
+ FatalAppExit( 0, "Application Error" );
+ else
+ {
+ ByteString aErrorText( ImplSalGetWinAnsiString( rErrorText ) );
+ FatalAppExit( 0, aErrorText.GetBuffer() );
+ }
+#endif
+}
+
+// =======================================================================
+
+LRESULT CALLBACK SalComWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+
+// =======================================================================
+
+class SalYieldMutex : public NAMESPACE_VOS(OMutex)
+{
+public: // for ImplSalYield()
+ SalInstanceData* mpInstData;
+ ULONG mnCount;
+ DWORD mnThreadId;
+
+public:
+ SalYieldMutex( SalInstanceData* pInstData );
+
+ virtual void SAL_CALL acquire();
+ virtual void SAL_CALL release();
+ virtual sal_Bool SAL_CALL tryToAcquire();
+
+ ULONG GetAcquireCount( ULONG nThreadId );
+};
+
+// -----------------------------------------------------------------------
+
+SalYieldMutex::SalYieldMutex( SalInstanceData* pInstData )
+{
+ mpInstData = pInstData;
+ mnCount = 0;
+ mnThreadId = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL SalYieldMutex::acquire()
+{
+ OMutex::acquire();
+ mnCount++;
+#ifdef WIN
+ mnThreadId = GetCurrentThreadId();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL SalYieldMutex::release()
+{
+#ifdef WIN
+ DWORD nThreadId = GetCurrentThreadId();
+ if ( mnThreadId != nThreadId )
+ OMutex::release();
+ else
+ {
+ // If we don't call these message, the Output from the
+ // Java clients doesn't come in the right order
+ GdiFlush();
+
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mnAppThreadId != nThreadId )
+ {
+ if ( mnCount == 1 )
+ {
+ mpInstData->mpSalWaitMutex->acquire();
+ if ( mpInstData->mnYieldWaitCount )
+ ImplPostMessage( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
+ mnThreadId = 0;
+ mnCount--;
+ OMutex::release();
+ mpInstData->mpSalWaitMutex->release();
+ }
+ else
+ {
+ mnCount--;
+ OMutex::release();
+ }
+ }
+ else
+ {
+ if ( mnCount == 1 )
+ mnThreadId = 0;
+ mnCount--;
+ OMutex::release();
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SAL_CALL SalYieldMutex::tryToAcquire()
+{
+ if( OMutex::tryToAcquire() )
+ {
+ mnCount++;
+#ifdef WIN
+ mnThreadId = GetCurrentThreadId();
+#endif
+ return True;
+ }
+ else
+ return False;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalYieldMutex::GetAcquireCount( ULONG nThreadId )
+{
+ if ( nThreadId == mnThreadId )
+ return mnCount;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexAcquireWithWait()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( !pInst )
+ return;
+
+ // If we are the main thread, then we must wait with wait, because
+ // in if we don't reschedule, then we create deadlocks if a Windows
+ // Function is called from another thread. If we arn't the main thread,
+ // than we call qcquire directly.
+#ifdef WIN
+ DWORD nThreadId = GetCurrentThreadId();
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mnAppThreadId == nThreadId )
+ {
+ // Wenn wir den Mutex nicht bekommen, muessen wir solange
+ // warten, bis wir Ihn bekommen
+ BOOL bAcquire = FALSE;
+ do
+ {
+ if ( pInst->maInstData.mpSalYieldMutex->tryToAcquire() )
+ bAcquire = TRUE;
+ else
+ {
+ pInst->maInstData.mpSalWaitMutex->acquire();
+ if ( pInst->maInstData.mpSalYieldMutex->tryToAcquire() )
+ {
+ bAcquire = TRUE;
+ pInst->maInstData.mpSalWaitMutex->release();
+ }
+ else
+ {
+ pInst->maInstData.mnYieldWaitCount++;
+ pInst->maInstData.mpSalWaitMutex->release();
+ MSG aTmpMsg;
+ ImplGetMessage( &aTmpMsg, pInst->maInstData.mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD );
+ pInst->maInstData.mnYieldWaitCount--;
+ if ( pInst->maInstData.mnYieldWaitCount )
+ ImplPostMessage( pInst->maInstData.mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
+ }
+ }
+ }
+ while ( !bAcquire );
+ }
+ else
+#endif
+ pInst->maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplSalYieldMutexTryToAcquire()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst )
+ return pInst->maInstData.mpSalYieldMutex->tryToAcquire();
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexAcquire()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst )
+ pInst->maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexRelease()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst )
+ pInst->maInstData.mpSalYieldMutex->release();
+}
+
+// -----------------------------------------------------------------------
+
+ULONG ImplSalReleaseYieldMutex()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( !pInst )
+ return 0;
+
+#ifdef WIN
+ SalYieldMutex* pYieldMutex = pInst->maInstData.mpSalYieldMutex;
+ ULONG nCount = pYieldMutex->GetAcquireCount( GetCurrentThreadId() );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+
+ return nCount;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalAcquireYieldMutex( ULONG nCount )
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( !pInst )
+ return;
+
+ SalYieldMutex* pYieldMutex = pInst->maInstData.mpSalYieldMutex;
+ while ( nCount )
+ {
+ pYieldMutex->acquire();
+ nCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+
+void ImplDbgTestSolarMutex()
+{
+#ifdef WIN
+ SalData* pSalData = GetSalData();
+ DWORD nCurThreadId = GetCurrentThreadId();
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" );
+ }
+ }
+ }
+ else
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked in the main thread" );
+ }
+ }
+ }
+#endif
+}
+
+#endif
+
+// =======================================================================
+
+static void InitSalShlData()
+{
+#ifdef WIN
+ aSalShlData.mnVKAdd = LOWORD( VkKeyScan( '+' ) );
+ aSalShlData.mnVKSubtract = LOWORD( VkKeyScan( '-' ) );
+ aSalShlData.mnVKMultiply = LOWORD( VkKeyScan( '*' ) );
+ aSalShlData.mnVKDivide = LOWORD( VkKeyScan( '/' ) );
+ aSalShlData.mnVKPoint = LOWORD( VkKeyScan( '.' ) );
+ aSalShlData.mnVKComma = LOWORD( VkKeyScan( ',' ) );
+ aSalShlData.mnVKLess = LOWORD( VkKeyScan( '<' ) );
+ aSalShlData.mnVKGreater = LOWORD( VkKeyScan( '>' ) );
+ aSalShlData.mnVKEqual = LOWORD( VkKeyScan( '=' ) );
+#endif
+}
+
+// =======================================================================
+
+void InitSalData()
+{
+ SalData* pSalData = new SalData;
+ memset( pSalData, 0, sizeof( SalData ) );
+ SetSalData( pSalData );
+#ifdef WIN
+ CoInitialize(0);
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitSalData()
+{
+#ifdef WIN
+ CoUninitialize();
+#endif
+ SalData* pSalData = GetSalData();
+ delete pSalData;
+ SetSalData( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SetFilterCallback( void* pCallback, void* pInst )
+{
+ SalData* pSalData = GetSalData();
+
+ pSalData->mpFirstInstance->maInstData.mpFilterCallback = pCallback;
+ pSalData->mpFirstInstance->maInstData.mpFilterInst = pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance* CreateSalInstance()
+{
+ SalData* pSalData = GetSalData();
+
+#ifdef WIN
+ // determine the windows version
+ WORD nVer = (WORD)GetVersion();
+ aSalShlData.mnVersion = (((WORD)LOBYTE(nVer)) * 100) + HIBYTE(nVer);
+ if ( aSalShlData.mnVersion >= W95_VERSION )
+ aSalShlData.mbW40 = 1;
+ WORD nVer = (WORD)GetVersion();
+ OSVERSIONINFO aVerInfo;
+ aVerInfo.dwOSVersionInfoSize = sizeof( aVerInfo );
+ if ( GetVersionEx( &aVerInfo ) )
+ {
+ if ( aVerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
+ aSalShlData.mbWNT = 1;
+ }
+
+ pSalData->mnAppThreadId = GetCurrentThreadId();
+#endif
+
+ // register frame class
+ if ( !pSalData->mhPrevInst )
+ {
+#ifdef WIN
+ WNDCLASSEXA aWndClassEx;
+ aWndClassEx.cbSize = sizeof( aWndClassEx );
+ aWndClassEx.style = CS_OWNDC;
+ aWndClassEx.lpfnWndProc = SalFrameWndProcA;
+ aWndClassEx.cbClsExtra = 0;
+ aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA;
+ aWndClassEx.hInstance = pSalData->mhInst;
+ aWndClassEx.hCursor = 0;
+ aWndClassEx.hbrBackground = 0;
+ aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEA;
+ ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm );
+ if ( !RegisterClassExA( &aWndClassEx ) )
+ return NULL;
+ aWndClassEx.style |= CS_SAVEBITS;
+ aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAME_SBA;
+ if ( !RegisterClassExA( &aWndClassEx ) )
+ return NULL;
+
+ aWndClassEx.style = 0;
+ aWndClassEx.lpfnWndProc = SalComWndProcA;
+ aWndClassEx.cbWndExtra = 0;
+ aWndClassEx.hIcon = 0;
+ aWndClassEx.hIconSm = 0;
+ aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEA;
+ if ( !RegisterClassExA( &aWndClassEx ) )
+ return NULL;
+#endif
+ }
+
+ HWND hComWnd;
+#ifdef WIN
+ hComWnd = CreateWindowExA( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEA,
+ "", WS_POPUP, 0, 0, 0, 0, 0, 0,
+ pSalData->mhInst, NULL );
+#endif
+ if ( !hComWnd )
+ return NULL;
+
+ SalInstance* pInst = new SalInstance;
+
+ // init shl data
+ InitSalShlData();
+
+ // init instance (only one instance in this version !!!)
+ pSalData->mpFirstInstance = pInst;
+ pInst->maInstData.mhInst = pSalData->mhInst;
+ pInst->maInstData.mhComWnd = hComWnd;
+
+ // init static GDI Data
+ ImplInitSalGDI();
+
+ return pInst;
+}
+
+// -----------------------------------------------------------------------
+
+void DestroySalInstance( SalInstance* pInst )
+{
+ SalData* pSalData = GetSalData();
+
+ // (only one instance in this version !!!)
+
+ ImplFreeSalGDI();
+
+ // reset instance
+ if ( pSalData->mpFirstInstance == pInst )
+ pSalData->mpFirstInstance = NULL;
+
+ delete pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::SalInstance()
+{
+ maInstData.mhComWnd = 0;
+ maInstData.mpFilterCallback = NULL;
+ maInstData.mpFilterInst = NULL;
+ maInstData.mpSalYieldMutex = new SalYieldMutex( &maInstData );
+ maInstData.mpSalWaitMutex = new NAMESPACE_VOS(OMutex);
+ maInstData.mnYieldWaitCount = 0;
+ maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::~SalInstance()
+{
+ maInstData.mpSalYieldMutex->release();
+ delete maInstData.mpSalYieldMutex;
+ delete maInstData.mpSalWaitMutex;
+#ifdef WIN
+ DestroyWindow( maInstData.mhComWnd );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef _VOS_NO_NAMESPACE
+IMutex* SalInstance::GetYieldMutex()
+#else
+vos::IMutex* SalInstance::GetYieldMutex()
+#endif
+{
+ return maInstData.mpSalYieldMutex;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInstance::ReleaseYieldMutex()
+{
+ return ImplSalReleaseYieldMutex();
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::AcquireYieldMutex( ULONG nCount )
+{
+ ImplSalAcquireYieldMutex( nCount );
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+static void ImplSalDispatchMessage( MSG* pMsg )
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstObject )
+ {
+ if ( ImplSalPreDispatchMsg( pMsg ) )
+ return;
+ }
+ LRESULT lResult = ImplDispatchMessage( pMsg );
+ if ( pSalData->mpFirstObject )
+ ImplSalPostDispatchMsg( pMsg, lResult );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+void ImplSalYield( BOOL bWait )
+{
+#ifdef WIN
+ MSG aMsg;
+
+ if ( bWait )
+ {
+ if ( ImplGetMessage( &aMsg, 0, 0, 0 ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplSalDispatchMessage( &aMsg );
+ }
+ }
+ else
+ {
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplSalDispatchMessage( &aMsg );
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::Yield( BOOL bWait )
+{
+#ifdef WIN
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ SalData* pSalData = GetSalData();
+ DWORD nCurThreadId = GetCurrentThreadId();
+ ULONG nCount = pYieldMutex->GetAcquireCount( nCurThreadId );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ ImplSendMessage( maInstData.mhComWnd, SAL_MSG_THREADYIELD, (WPARAM)bWait, (LPARAM)0 );
+ n = nCount;
+ while ( n )
+ {
+ pYieldMutex->acquire();
+ n--;
+ }
+ }
+ else
+ {
+ ImplSalYield( bWait );
+
+ n = nCount;
+ while ( n )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ n--;
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ LRESULT nRet = 0;
+
+#ifdef WIN
+ switch ( nMsg )
+ {
+ case SAL_MSG_PRINTABORTJOB:
+ ImplSalPrinterAbortJobAsync( (HDC)wParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_THREADYIELD:
+ ImplSalYield( (BOOL)wParam );
+ rDef = FALSE;
+ break;
+ // If we get this message, because another GetMessage() call
+ // has recieved this message, we must post this message to
+ // us again, because in the other case we wait forever.
+ case SAL_MSG_RELEASEWAITYIELD:
+ {
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst && pInst->maInstData.mnYieldWaitCount )
+ ImplPostMessage( hWnd, SAL_MSG_RELEASEWAITYIELD, wParam, lParam );
+ }
+ rDef = FALSE;
+ break;
+ case SAL_MSG_STARTTIMER:
+ ImplSalStartTimer( (ULONG) lParam, FALSE );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_CREATEFRAME:
+ nRet = (LRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (HWND)lParam, (ULONG)wParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_DESTROYFRAME:
+ delete (SalFrame*)lParam;
+ rDef = FALSE;
+ break;
+ case SAL_MSG_CREATEOBJECT:
+ nRet = (LRESULT)ImplSalCreateObject( GetSalData()->mpFirstInstance, (SalFrame*)lParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_DESTROYOBJECT:
+ delete (SalObject*)lParam;
+ rDef = FALSE;
+ break;
+ case SAL_MSG_CREATESOUND:
+ nRet = ((SalSound*)lParam)->ImplCreate();
+ rDef = FALSE;
+ break;
+ case SAL_MSG_DESTROYSOUND:
+ ((SalSound*)lParam)->ImplDestroy();
+ rDe
+ break;
+ }
+#endif
+
+ return nRet;
+}
+
+#ifdef WIN
+LRESULT CALLBACK SalComWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalComWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ {
+ if ( !ImplHandleGlobalMsg( hWnd, nMsg, wParam, lParam, nRet ) )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ }
+ return nRet;
+}
+#endif
+
+#ifdef WIN
+LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalComWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ {
+ if ( !ImplHandleGlobalMsg( hWnd, nMsg, wParam, lParam, nRet ) )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ }
+ return nRet;
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+BOOL SalInstance::AnyInput( USHORT nType )
+{
+#ifdef WIN
+ MSG aMsg;
+
+ if ( (nType & (INPUT_ANY)) == (INPUT_ANY) )
+ {
+ // Any Input
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+ else
+ {
+ if ( nType & INPUT_MOUSE )
+ {
+ // Test auf Mouseinput
+ if ( ImplPeekMessage( &aMsg, 0, WM_MOUSEFIRST, WM_MOUSELAST,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_KEYBOARD )
+ {
+ // Test auf Keyinput
+#ifdef WIN
+ if ( ImplPeekMessage( &aMsg, 0, WM_KEYDOWN, WM_KEYDOWN,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ {
+ if ( (aMsg.wParam == VK_SHIFT) ||
+ (aMsg.wParam == VK_CONTROL) ||
+ (aMsg.wParam == VK_MENU) )
+ return FALSE;
+ else
+ return TRUE;
+ }
+#endif
+ }
+
+ if ( nType & INPUT_PAINT )
+ {
+ // Test auf Paintinput
+ if ( ImplPeekMessage( &aMsg, 0, WM_PAINT, WM_PAINT,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_TIMER )
+ {
+ // Test auf Timerinput
+ if ( ImplPeekMessage( &aMsg, 0, WM_TIMER, WM_TIMER,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_OTHER )
+ {
+ // Test auf sonstigen Input
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+ }
+#endif
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Start( ULONG nMS )
+{
+ // Um auf Main-Thread umzuschalten
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ {
+#ifdef WIN
+ if ( pSalData->mnAppThreadId != GetCurrentThreadId() )
+ ImplPostMessage( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS );
+ else
+ ImplSendMessage( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS );
+#endif
+ }
+ else
+ ImplSalStartTimer( nMS, FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* SalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle )
+{
+ // Um auf Main-Thread umzuschalten
+#ifdef WIN
+ return (SalFrame*)ImplSendMessage( maInstData.mhComWnd, SAL_MSG_CREATEFRAME, nSalFrameStyle, (LPARAM)pSystemParentData->hWnd );
+#else
+ return NULL;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* SalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle )
+{
+ // Um auf Main-Thread umzuschalten
+ HWND hWndParent;
+ if ( pParent )
+ hWndParent = pParent->maFrameData.mhWnd;
+ else
+ hWndParent = 0;
+#ifdef WIN
+ return (SalFrame*)ImplSendMessage( maInstData.mhComWnd, SAL_MSG_CREATEFRAME, nSalFrameStyle, (LPARAM)hWndParent );
+#else
+ return NULL;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyFrame( SalFrame* pFrame )
+{
+#ifdef WIN
+ ImplSendMessage( maInstData.mhComWnd, SAL_MSG_DESTROYFRAME, 0, (LPARAM)pFrame );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+SalObject* SalInstance::CreateObject( SalFrame* pParent )
+{
+ // Um auf Main-Thread umzuschalten
+#ifdef WIN
+ return (SalObject*)ImplSendMessage( maInstData.mhComWnd, SAL_MSG_CREATEOBJECT, 0, (LPARAM)pParent );
+#else
+ return NULL;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyObject( SalObject* pObject )
+{
+#ifdef WIN
+ ImplSendMessage( maInstData.mhComWnd, SAL_MSG_DESTROYOBJECT, 0, (LPARAM)pObject );
+#endif
+}
diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx
new file mode 100644
index 000000000000..be5914ba7d9e
--- /dev/null
+++ b/vcl/aqua/source/app/salsys.cxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#define _SV_SALSYS_CXX
+
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+
+#ifndef _SV_KEYCOES_HXX
+#include <keycodes.hxx>
+#endif
+
+// =======================================================================
+
+SalSystem* SalInstance::CreateSystem()
+{
+ return new SalSystem();
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroySystem( SalSystem* pSystem )
+{
+ delete pSystem;
+}
+
+// =======================================================================
+
+SalSystem::SalSystem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SalSystem::~SalSystem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::StartProcess( SalFrame* pFrame, const XubString& rFileName,
+ const XubString& rParam, const XubString& rWorkDir )
+{
+ return FALSE;
+ // !!! UNICODE Was ist ... --> Mit HRO nach seinem Urlaub klaeren
+/*
+ XubString aParam = rParam;
+ XubString aFileName = rFileName;
+
+ // HRO: #75283#
+ // Hack for Office2000 Links
+ // We can only start the lnk-file, so we packed it within the arguments
+ xub_StrLen nIndex = aParam.Search( (sal_Unicode)0x07 );
+ if ( nIndex != STRING_NOTFOUND )
+ {
+ aFileName = aParam.Copy( nIndex + 1 );
+ aParam.Erase( nIndex );
+ }
+
+ BOOL bSuccess;
+ if ( aSalShlData.mbWNT )
+ {
+ LPCWSTR pszWorkDir = NULL;
+ if ( rWorkDir.Len() )
+ pszWorkDir = rWorkDir.GetBuffer();
+ bSuccess = SHInvokeCommandW( pFrame->maFrameData.mhWnd, 0,
+ aFileName.GetBuffer(),
+ CMDSTR_DEFAULT,
+ aParam.GetBuffer(), pszWorkDir,
+ SW_SHOWNORMAL );
+ }
+ else
+ {
+ ByteString aFileNameA = ImplSalGetWinAnsiString( aFileName, TRUE );
+ ByteString aParamA = ImplSalGetWinAnsiString( aParam, TRUE );
+ ByteString aWorkDirA = ImplSalGetWinAnsiString( rWorkDir, TRUE );
+ LPCSTR pszWorkDir = NULL;
+ if ( aWorkDirA.Len() )
+ pszWorkDir = aWorkDirA.GetBuffer();
+ bSuccess = SHInvokeCommandA( pFrame->maFrameData.mhWnd, 0,
+ aFileNameA.GetBuffer(),
+ CMDSTR_DEFAULT,
+ aParamA.GetBuffer(), pszWorkDir,
+ SW_SHOWNORMAL );
+ }
+*/
+/*
+ // HRO: Tasks #62485# #64619#
+ // Weil ein paar Naddels jeden Scheiss hier reinstopfen und sich nicht
+ // entscheiden koennen, was sie wie und wann aufrufen, darf ich
+ // um die BUGs drumrumkurven. GRRRRR !!!
+
+ if ( !bSuccess )
+ {
+ ItemIDPath aIDPath( aFileName );
+
+ if ( aIDPath.GetTokenCount() )
+ bSuccess = WIN_SHInvokeCommand( pFrame->maFrameData.mhWnd, SHIC_PIDL,
+ (LPCTSTR)aIDPath.GetDataPtr(), CMDSTR_DEFAULT, aParam.GetStr(),
+ pszWorkDir, SW_SHOWNORMAL );
+ }
+*/
+// return bSuccess;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::AddRecentDoc( SalFrame*, const XubString& rFileName )
+{
+ return FALSE;
+ // !!! UNICODE Was ist ... --> Mit HRO nach seinem Urlaub klaeren
+/*
+ if ( aSalShlData.mbWNT )
+ SHAddToRecentDocsW( SHARD_PATH, (LPCVOID)rFileName.GetBuffer() );
+ else
+ {
+ ByteString aFileNameA = ImplSalGetWinAnsiString( rFileName, TRUE );
+ SHAddToRecentDocsA( SHARD_PATH, (LPCVOID)aFileNameA.GetBuffer() );
+ }
+ return TRUE;
+*/
+}
diff --git a/vcl/aqua/source/app/saltimer.cxx b/vcl/aqua/source/app/saltimer.cxx
new file mode 100644
index 000000000000..f55bbc77d34e
--- /dev/null
+++ b/vcl/aqua/source/app/saltimer.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * $RCSfile: saltimer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALTIMER_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+
+// =======================================================================
+
+// Maximale Periode
+#define MAX_SYSPERIOD 65533
+
+// =======================================================================
+
+void ImplSalStartTimer( ULONG nMS, BOOL bMutex )
+{
+ SalData* pSalData = GetSalData();
+
+ // Remenber the time of the timer
+ pSalData->mnTimerMS = nMS;
+ if ( !bMutex )
+ pSalData->mnTimerOrgMS = nMS;
+
+ // Periode darf nicht zu gross sein, da Windows mit USHORT arbeitet
+ if ( nMS > MAX_SYSPERIOD )
+ nMS = MAX_SYSPERIOD;
+
+#ifdef WIN
+ // Gibt es einen Timer, dann zerstoren
+ if ( pSalData->mnTimerId )
+ KillTimer( 0, pSalData->mnTimerId );
+
+ // Make a new timer with new period
+ pSalData->mnTimerId = SetTimer( 0, 0, (UINT)nMS, SalTimerProc );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Stop()
+{
+ SalData* pSalData = GetSalData();
+
+#ifdef WIN
+ // If we have a timer, than
+ if ( pSalData->mnTimerId )
+ {
+ KillTimer( 0, pSalData->mnTimerId );
+ pSalData->mnTimerId = 0;
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::SetCallback( SALTIMERPROC pProc )
+{
+ SalData* pSalData = GetSalData();
+ pSalData->mpTimerProc = pProc;
+}
+
+// -----------------------------------------------------------------------
+
+void CALLBACK SalTimerProc( HWND, UINT, UINT, DWORD )
+{
+ SalData* pSalData = GetSalData();
+
+ // Test for MouseLeave
+ SalTestMouseLeave();
+
+ if ( pSalData->mpTimerProc )
+ {
+ // Try to aquire the mutex. If we don't get the mutex then we
+ // try this a short time later again.
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSalData->mpTimerProc();
+ ImplSalYieldMutexRelease();
+
+ // Run the timer in the correct time, if we start this
+ // with a small timeout, because we don't get the mutex
+ if ( pSalData->mnTimerId &&
+ (pSalData->mnTimerMS != pSalData->mnTimerOrgMS) )
+ ImplSalStartTimer( pSalData->mnTimerOrgMS, FALSE );
+ }
+ else
+ ImplSalStartTimer( 10, TRUE );
+ }
+}
diff --git a/vcl/aqua/source/gdi/makefile.mk b/vcl/aqua/source/gdi/makefile.mk
new file mode 100644
index 000000000000..b05c6a5db9a2
--- /dev/null
+++ b/vcl/aqua/source/gdi/makefile.mk
@@ -0,0 +1,113 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salgdi
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(OS)"!="MACOSX"
+
+dummy:
+ @echo "Nothing to build for this platform"
+
+.ELSE # "$(OS)"!="MACOSX"
+
+.IF "$(remote)"==""
+
+SLOFILES= $(SLO)$/salgdi.obj \
+ $(SLO)$/salgdi2.obj \
+ $(SLO)$/salgdi3.obj \
+ $(SLO)$/salvd.obj \
+ $(SLO)$/salprn.obj \
+ $(SLO)$/salbmp.obj \
+ $(SLO)$/salogl.obj
+
+.IF "$(UPDATER)"=="YES"
+OBJFILES= $(OBJ)$/salgdi.obj \
+ $(OBJ)$/salgdi2.obj \
+ $(OBJ)$/salgdi3.obj \
+ $(OBJ)$/salvd.obj \
+ $(OBJ)$/salprn.obj \
+ $(OBJ)$/salbmp.obj \
+ $(OBJ)$/salogl.obj
+.ENDIF
+
+.ENDIF
+
+.ENDIF # "$(OS)"!="MACOSX"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx
new file mode 100644
index 000000000000..7802fb20e132
--- /dev/null
+++ b/vcl/aqua/source/gdi/salbmp.cxx
@@ -0,0 +1,686 @@
+/*************************************************************************
+ *
+ * $RCSfile: salbmp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALBMP_CXX
+
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#include <string.h>
+
+#ifdef WIN
+#define BI_BITFIELDS 3
+#endif
+
+// -----------
+// - Inlines -
+// -----------
+
+inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex )
+{
+ BYTE& rByte = pScanline[ nX >> 1 ];
+
+ ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( cIndex & 0x0f ) ) :
+ ( rByte &= 0x0f, rByte |= ( cIndex << 4 ) );
+}
+
+// -------------
+// - SalBitmap -
+// -------------
+
+SalBitmap::SalBitmap() :
+ mhDIB ( 0 ),
+ mhDDB ( 0 ),
+ mnBitCount ( 0 )
+{
+}
+
+// ------------------------------------------------------------------
+
+SalBitmap::~SalBitmap()
+{
+ Destroy();
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( HANDLE hBitmap, BOOL bDIB, BOOL bCopyHandle )
+{
+ BOOL bRet = TRUE;
+
+ if( bDIB )
+ mhDIB = (HGLOBAL) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, TRUE ) : hBitmap );
+ else
+ mhDDB = (HBITMAP) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, FALSE ) : hBitmap );
+
+#ifdef WIN
+ if( mhDIB )
+ {
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) GlobalLock( mhDIB );
+
+ maSize = Size( pBIH->biWidth, pBIH->biHeight );
+ mnBitCount = pBIH->biBitCount;
+
+ if( mnBitCount )
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 : ( mnBitCount <= 4 ) ? 4 : ( mnBitCount <= 8 ) ? 8 : 24;
+
+ GlobalUnlock( mhDIB );
+ }
+ else if( mhDDB )
+ {
+ BITMAP aDDBInfo;
+
+ if( WIN_GetObject( mhDDB, sizeof( BITMAP ), &aDDBInfo ) )
+ {
+ maSize = Size( aDDBInfo.bmWidth, aDDBInfo.bmHeight );
+ mnBitCount = aDDBInfo.bmPlanes * aDDBInfo.bmBitsPixel;
+
+ if( mnBitCount )
+ {
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 :
+ ( mnBitCount <= 4 ) ? 4 :
+ ( mnBitCount <= 8 ) ? 8 : 24;
+ }
+ }
+ else
+ {
+ mhDDB = 0;
+ bRet = FALSE;
+ }
+ }
+ else
+#endif
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
+{
+ BOOL bRet = FALSE;
+
+ mhDIB = ImplCreateDIB( rSize, nBitCount, rPal );
+
+ if( mhDIB )
+ {
+ maSize = rSize;
+ mnBitCount = nBitCount;
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBitmap )
+{
+ BOOL bRet = FALSE;
+
+ if ( rSalBitmap.mhDIB || rSalBitmap.mhDDB )
+ {
+ HANDLE hNewHdl = ImplCopyDIBOrDDB( rSalBitmap.mhDIB ? rSalBitmap.mhDIB : rSalBitmap.mhDDB,
+ rSalBitmap.mhDIB != 0 );
+
+ if ( hNewHdl )
+ {
+ if( rSalBitmap.mhDIB )
+ mhDIB = (HGLOBAL) hNewHdl;
+ else if( rSalBitmap.mhDDB )
+ mhDDB = (HBITMAP) hNewHdl;
+
+ maSize = rSalBitmap.maSize;
+ mnBitCount = rSalBitmap.mnBitCount;
+
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics )
+{
+ BOOL bRet = FALSE;
+
+ if( rSalBmp.mhDIB )
+ {
+#ifdef WIN
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( rSalBmp.mhDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+ HDC hDC = pGraphics->maGraphicsData.mhDC;
+ HBITMAP hNewDDB;
+ BITMAP aDDBInfo;
+ PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
+ ImplGetDIBColorCount( rSalBmp.mhDIB ) * sizeof( RGBQUAD );
+
+ if( pBIH->biBitCount == 1 )
+ {
+ hNewDDB = CreateBitmap( pBIH->biWidth, pBIH->biHeight, 1, 1, NULL );
+
+ if( hNewDDB )
+ SetDIBits( hDC, hNewDDB, 0, pBIH->biHeight, pBits, pBI, DIB_RGB_COLORS );
+ }
+ else
+ hNewDDB = CreateDIBitmap( hDC, (PBITMAPINFOHEADER) pBI, CBM_INIT, pBits, pBI, DIB_RGB_COLORS );
+
+ GlobalUnlock( rSalBmp.mhDIB );
+
+ if( hNewDDB && WIN_GetObject( hNewDDB, sizeof( BITMAP ), &aDDBInfo ) )
+ {
+ mhDDB = hNewDDB;
+ maSize = Size( aDDBInfo.bmWidth, aDDBInfo.bmHeight );
+ mnBitCount = aDDBInfo.bmPlanes * aDDBInfo.bmBitsPixel;
+
+ if( mnBitCount )
+ {
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 :
+ ( mnBitCount <= 4 ) ? 4 :
+ ( mnBitCount <= 8 ) ? 8 : 24;
+ }
+
+ bRet = TRUE;
+ }
+ else if( hNewDDB )
+ DeleteObject( hNewDDB );
+#endif
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount )
+{
+ BOOL bRet = FALSE;
+
+ if( rSalBmp.mhDDB )
+ {
+ mhDIB = ImplCreateDIB( rSalBmp.maSize, nNewBitCount, BitmapPalette() );
+
+ if( mhDIB )
+ {
+#ifdef WIN
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ const int nLines = (int) rSalBmp.maSize.Height();
+ HDC hDC = GetDC( 0 );
+ PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
+ ImplGetDIBColorCount( mhDIB ) * sizeof( RGBQUAD );
+ SalData* pSalData = GetSalData();
+ HPALETTE hOldPal = 0;
+
+ if ( pSalData->mhDitherPal )
+ {
+ hOldPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( hDC );
+ }
+
+ if( GetDIBits( hDC, rSalBmp.mhDDB, 0, nLines, pBits, pBI, DIB_RGB_COLORS ) == nLines )
+ {
+ GlobalUnlock( mhDIB );
+ maSize = rSalBmp.maSize;
+ mnBitCount = nNewBitCount;
+ bRet = TRUE;
+ }
+ else
+ {
+ GlobalUnlock( mhDIB );
+ GlobalFree( mhDIB );
+ mhDIB = 0;
+ }
+
+ if( hOldPal )
+ SelectPalette( hDC, hOldPal, TRUE );
+
+ ReleaseDC( 0, hDC );
+#endif
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::Destroy()
+{
+#ifdef WIN
+ if( mhDIB )
+ GlobalFree( mhDIB );
+ else if( mhDDB )
+ DeleteObject( mhDDB );
+#endif
+
+ maSize = Size();
+ mnBitCount = 0;
+}
+
+// ------------------------------------------------------------------
+
+USHORT SalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB )
+{
+ USHORT nColors = 0;
+
+ if( hDIB )
+ {
+#ifdef WIN
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+
+ if ( pBIH->biSize != sizeof( BITMAPCOREHEADER ) )
+ {
+ if( pBIH->biBitCount <= 8 )
+ {
+ if ( pBIH->biClrUsed )
+ nColors = (USHORT) pBIH->biClrUsed;
+ else
+ nColors = 1 << pBIH->biBitCount;
+ }
+ }
+ else if( ( (PBITMAPCOREHEADER) pBI )->bcBitCount <= 8 )
+ nColors = 1 << ( (PBITMAPCOREHEADER) pBI )->bcBitCount;
+
+ GlobalUnlock( hDIB );
+#endif
+ }
+
+ return nColors;
+}
+
+// ------------------------------------------------------------------
+
+HGLOBAL SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const BitmapPalette& rPal )
+{
+ DBG_ASSERT( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24, "Unsupported BitCount!" );
+
+ HGLOBAL hDIB = 0;
+
+ if ( rSize.Width() && rSize.Height() && ( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24 ) )
+ {
+#ifdef WIN
+ const ULONG nImageSize = AlignedWidth4Bytes( nBits * rSize.Width() ) * rSize.Height();
+ const USHORT nColors = ( nBits <= 8 ) ? ( 1 << nBits ) : 0;
+
+ hDIB = GlobalAlloc( GHND, sizeof( BITMAPINFOHEADER ) + nColors * sizeof( RGBQUAD ) + nImageSize );
+
+ if( hDIB )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+
+ pBIH->biSize = sizeof( BITMAPINFOHEADER );
+ pBIH->biWidth = rSize.Width();
+ pBIH->biHeight = rSize.Height();
+ pBIH->biPlanes = 1;
+ pBIH->biBitCount = nBits;
+ pBIH->biCompression = BI_RGB;
+ pBIH->biSizeImage = nImageSize;
+ pBIH->biXPelsPerMeter = 0;
+ pBIH->biYPelsPerMeter = 0;
+ pBIH->biClrUsed = 0;
+ pBIH->biClrImportant = 0;
+
+ if ( nColors )
+ {
+ const USHORT nMinCount = Min( nColors, rPal.GetEntryCount() );
+
+ if( nMinCount )
+ HMEMCPY( pBI->bmiColors, rPal.ImplGetColorBuffer(), nMinCount * sizeof( RGBQUAD ) );
+ }
+
+ GlobalUnlock( hDIB );
+ }
+#endif
+ }
+
+ return hDIB;
+}
+
+// ------------------------------------------------------------------
+
+HANDLE SalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, BOOL bDIB )
+{
+ HANDLE hCopy = 0;
+
+#ifdef WIN
+ if ( bDIB && hHdl )
+ {
+ const ULONG nSize = GlobalSize( hHdl );
+
+ if ( hCopy = GlobalAlloc( GHND, nSize ) )
+ {
+ HMEMCPY( (LPSTR) GlobalLock( hCopy ), (LPSTR) GlobalLock( hHdl ), nSize );
+
+ GlobalUnlock( hCopy );
+ GlobalUnlock( hHdl );
+ }
+ }
+ else if ( hHdl )
+ {
+ BITMAP aBmp;
+
+ // Source-Bitmap nach Groesse befragen
+ WIN_GetObject( hHdl, sizeof( BITMAP ), (LPSTR) &aBmp );
+
+ // Destination-Bitmap erzeugen
+ if ( hCopy = CreateBitmapIndirect( &aBmp ) )
+ {
+ HDC hBmpDC = CreateCompatibleDC( 0 );
+ HBITMAP hBmpOld = (HBITMAP) SelectObject( hBmpDC, hHdl );
+ HDC hCopyDC = CreateCompatibleDC( hBmpDC );
+ HBITMAP hCopyOld = (HBITMAP) SelectObject( hCopyDC, hCopy );
+
+ BitBlt( hCopyDC, 0, 0, aBmp.bmWidth, aBmp.bmHeight, hBmpDC, 0, 0, SRCCOPY );
+
+ SelectObject( hCopyDC, hCopyOld );
+ DeleteDC( hCopyDC );
+
+ SelectObject( hBmpDC, hBmpOld );
+ DeleteDC( hBmpDC );
+ }
+ }
+#endif
+
+ return hCopy;
+}
+
+// ------------------------------------------------------------------
+
+BitmapBuffer* SalBitmap::AcquireBuffer( BOOL bReadOnly )
+{
+ BitmapBuffer* pBuffer = NULL;
+
+ if( mhDIB )
+ {
+#ifdef WIN
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+
+ if( ( pBIH->biCompression == BI_RLE4 ) || ( pBIH->biCompression == BI_RLE8 ) )
+ {
+ Size aSizePix( pBIH->biWidth, pBIH->biHeight );
+ HGLOBAL hNewDIB = ImplCreateDIB( aSizePix, pBIH->biBitCount, BitmapPalette() );
+
+ if( hNewDIB )
+ {
+ PBITMAPINFO pNewBI = (PBITMAPINFO) GlobalLock( hNewDIB );
+ PBITMAPINFOHEADER pNewBIH = (PBITMAPINFOHEADER) pNewBI;
+ const USHORT nColorCount = ImplGetDIBColorCount( hNewDIB );
+ const ULONG nOffset = *(DWORD*) pBI + nColorCount * sizeof( RGBQUAD );
+ BYTE* pOldBits = (PBYTE) pBI + nOffset;
+ BYTE* pNewBits = (PBYTE) pNewBI + nOffset;
+
+ HMEMCPY( pNewBI, pBI, nOffset );
+ pNewBIH->biCompression = 0;
+ ImplDecodeRLEBuffer( pOldBits, pNewBits, aSizePix, pBIH->biCompression == BI_RLE4 );
+
+ GlobalUnlock( mhDIB );
+ GlobalFree( mhDIB );
+ mhDIB = hNewDIB;
+ pBI = pNewBI;
+ pBIH = pNewBIH;
+ }
+ }
+
+ if( pBIH->biPlanes == 1 )
+ {
+ pBuffer = new BitmapBuffer;
+
+ pBuffer->mnFormat = BMP_FORMAT_BOTTOM_UP |
+ ( pBIH->biBitCount == 1 ? BMP_FORMAT_1BIT_MSB_PAL :
+ pBIH->biBitCount == 4 ? BMP_FORMAT_4BIT_MSN_PAL :
+ pBIH->biBitCount == 8 ? BMP_FORMAT_8BIT_PAL :
+ pBIH->biBitCount == 16 ? BMP_FORMAT_16BIT_TC_MASK :
+ pBIH->biBitCount == 24 ? BMP_FORMAT_24BIT_TC_BGR :
+ pBIH->biBitCount == 32 ? BMP_FORMAT_32BIT_TC_MASK : 0UL );
+
+ if( BMP_SCANLINE_FORMAT( pBuffer->mnFormat ) )
+ {
+ pBuffer->mnWidth = maSize.Width();
+ pBuffer->mnHeight = maSize.Height();
+ pBuffer->mnScanlineSize = AlignedWidth4Bytes( maSize.Width() * pBIH->biBitCount );
+ pBuffer->mnBitCount = (USHORT) pBIH->biBitCount;
+
+ if( pBuffer->mnBitCount <= 8 )
+ {
+ const USHORT nPalCount = ImplGetDIBColorCount( mhDIB );
+
+ pBuffer->maPalette.SetEntryCount( nPalCount );
+ HMEMCPY( pBuffer->maPalette.ImplGetColorBuffer(), pBI->bmiColors, nPalCount * sizeof( RGBQUAD ) );
+ pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI + nPalCount * sizeof( RGBQUAD );
+ }
+ else if( ( pBIH->biBitCount == 16 ) || ( pBIH->biBitCount == 32 ) )
+ {
+ ULONG nOffset = 0UL;
+
+ if( pBIH->biCompression == BI_BITFIELDS )
+ {
+ nOffset = 3 * sizeof( RGBQUAD );
+ pBuffer->maColorMask = ColorMask( *(UINT32*) &pBI->bmiColors[ 0 ],
+ *(UINT32*) &pBI->bmiColors[ 1 ],
+ *(UINT32*) &pBI->bmiColors[ 2 ] );
+ }
+ else if( pBIH->biCompression == 16 )
+ pBuffer->maColorMask = ColorMask( 0x00007c00UL, 0x000003e0UL, 0x0000001fUL );
+ else
+ pBuffer->maColorMask = ColorMask( 0x00ff0000UL, 0x0000ff00UL, 0x000000ffUL );
+
+ pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI + nOffset;
+ }
+ else
+ pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI;
+ }
+ else
+ {
+ GlobalUnlock( mhDIB );
+ delete pBuffer;
+ pBuffer = NULL;
+ }
+ }
+ else
+ GlobalUnlock( mhDIB );
+#endif
+ }
+
+ return pBuffer;
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly )
+{
+ if( pBuffer )
+ {
+ if( mhDIB )
+ {
+#ifdef WIN
+ if( !bReadOnly && !!pBuffer->maPalette )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ const USHORT nCount = pBuffer->maPalette.GetEntryCount();
+
+ HMEMCPY( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGBQUAD ) );
+ GlobalUnlock( mhDIB );
+ }
+
+ GlobalUnlock( mhDIB );
+#endif
+ }
+
+ delete pBuffer;
+ }
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf,
+ const Size& rSizePixel, BOOL bRLE4 )
+{
+ HPBYTE pRLE = (HPBYTE) pSrcBuf;
+ HPBYTE pDIB = (HPBYTE) pDstBuf;
+ HPBYTE pRow = (HPBYTE) pDstBuf;
+ ULONG nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) );
+ HPBYTE pLast = pDIB + rSizePixel.Height() * nWidthAl - 1;
+ ULONG nCountByte;
+ ULONG nRunByte;
+ ULONG nX = 0;
+ ULONG i;
+ BYTE cTmp;
+ BOOL bEndDecoding = FALSE;
+
+ if( pRLE && pDIB )
+ {
+ do
+ {
+ if( !( nCountByte = *pRLE++ ) )
+ {
+ nRunByte = *pRLE++;
+
+ if( nRunByte > 2UL )
+ {
+ if( bRLE4 )
+ {
+ nCountByte = nRunByte >> 1UL;
+
+ for( i = 0; i < nCountByte; i++ )
+ {
+ cTmp = *pRLE++;
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ ImplSetPixel4( pDIB, nX++, cTmp & 0x0f );
+ }
+
+ if( nRunByte & 1 )
+ ImplSetPixel4( pDIB, nX++, *pRLE++ >> 4 );
+
+ if( ( ( nRunByte + 1 ) >> 1 ) & 1 )
+ pRLE++;
+ }
+ else
+ {
+ HMEMCPY( &pDIB[ nX ], pRLE, nRunByte );
+ pRLE += nRunByte;
+ nX += nRunByte;
+
+ if( nRunByte & 1 )
+ pRLE++;
+ }
+ }
+ else if( !nRunByte )
+ {
+ pDIB = ( pRow += nWidthAl );
+ nX = 0UL;
+ }
+ else if( nRunByte == 1 )
+ bEndDecoding = TRUE;
+ else
+ {
+ nX += *pRLE++;
+ pDIB = ( pRow += ( *pRLE++ ) * nWidthAl );
+ }
+ }
+ else
+ {
+ cTmp = *pRLE++;
+
+ if( bRLE4 )
+ {
+ nRunByte = nCountByte >> 1;
+
+ for( i = 0; i < nRunByte; i++ )
+ {
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ ImplSetPixel4( pDIB, nX++, cTmp & 0x0f );
+ }
+
+ if( nCountByte & 1 )
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ }
+ else
+ {
+ for( i = 0; i < nCountByte; i++ )
+ pDIB[ nX++ ] = cTmp;
+ }
+ }
+ }
+ while( !bEndDecoding && ( pDIB <= pLast ) );
+ }
+}
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
new file mode 100644
index 000000000000..18e82f845f0f
--- /dev/null
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -0,0 +1,1536 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+#define _SV_SALGDI_CXX
+
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// =======================================================================
+
+#define DITHER_PAL_DELTA 51
+#define DITHER_PAL_STEPS 6
+#define DITHER_PAL_COUNT (DITHER_PAL_STEPS*DITHER_PAL_STEPS*DITHER_PAL_STEPS)
+#define DITHER_MAX_SYSCOLOR 16
+#define DITHER_EXTRA_COLORS 1
+#define DMAP( _def_nVal, _def_nThres ) ((pDitherDiff[_def_nVal]>(_def_nThres))?pDitherHigh[_def_nVal]:pDitherLow[_def_nVal])
+
+// =======================================================================
+
+struct SysColorEntry
+{
+ DWORD nRGB;
+ SysColorEntry* pNext;
+};
+
+// =======================================================================
+
+static SysColorEntry* pFirstSysColor = NULL;
+static SysColorEntry* pActSysColor = NULL;
+
+// -----------------------------------------------------------------------------
+
+// Blue7
+#ifdef WIN
+static PALETTEENTRY aImplExtraColor1 =
+{
+ 0, 184, 255, 0
+};
+#endif
+
+// -----------------------------------------------------------------------------
+
+#ifdef WIN
+static PALETTEENTRY aImplSalSysPalEntryAry[ DITHER_MAX_SYSCOLOR ] =
+{
+{ 0, 0, 0, 0 },
+{ 0, 0, 0x80, 0 },
+{ 0, 0x80, 0, 0 },
+{ 0, 0x80, 0x80, 0 },
+{ 0x80, 0, 0, 0 },
+{ 0x80, 0, 0x80, 0 },
+{ 0x80, 0x80, 0, 0 },
+{ 0x80, 0x80, 0x80, 0 },
+{ 0xC0, 0xC0, 0xC0, 0 },
+{ 0, 0, 0xFF, 0 },
+{ 0, 0xFF, 0, 0 },
+{ 0, 0xFF, 0xFF, 0 },
+{ 0xFF, 0, 0, 0 },
+{ 0xFF, 0, 0xFF, 0 },
+{ 0xFF, 0xFF, 0, 0 },
+{ 0xFF, 0xFF, 0xFF, 0 }
+};
+#endif
+
+// -----------------------------------------------------------------------------
+
+static BYTE aOrdDither8Bit[8][8] =
+{
+ 0, 38, 9, 48, 2, 40, 12, 50,
+ 25, 12, 35, 22, 28, 15, 37, 24,
+ 6, 44, 3, 41, 8, 47, 5, 44,
+ 32, 19, 28, 16, 34, 21, 31, 18,
+ 1, 40, 11, 49, 0, 39, 10, 48,
+ 27, 14, 36, 24, 26, 13, 36, 23,
+ 8, 46, 4, 43, 7, 45, 4, 42,
+ 33, 20, 30, 17, 32, 20, 29, 16
+};
+
+// -----------------------------------------------------------------------------
+
+static BYTE aOrdDither16Bit[8][8] =
+{
+ 0, 6, 1, 7, 0, 6, 1, 7,
+ 4, 2, 5, 3, 4, 2, 5, 3,
+ 1, 7, 0, 6, 1, 7, 0, 6,
+ 5, 3, 4, 2, 5, 3, 4, 2,
+ 0, 6, 1, 7, 0, 6, 1, 7,
+ 4, 2, 5, 3, 4, 2, 5, 3,
+ 1, 7, 0, 6, 1, 7, 0, 6,
+ 5, 3, 4, 2, 5, 3, 4, 2
+};
+
+// =======================================================================
+
+// Pens muessen wir mit 1 Pixel-Breite erzeugen, da ansonsten die S3-Karte
+// viele Paintprobleme hat, wenn Polygone/PolyLines gezeichnet werden und
+// eine komplexe ClipRegion gesetzt ist
+#define GSL_PEN_WIDTH 1
+
+// =======================================================================
+
+#define SAL_POLYPOLYCOUNT_STACKBUF 8
+#define SAL_POLYPOLYPOINTS_STACKBUF 64
+
+// =======================================================================
+
+void ImplInitSalGDI()
+{
+ SalData* pSalData = GetSalData();
+
+#ifdef WIN
+ // init stock brushes
+ pSalData->maStockPenColorAry[0] = PALETTERGB( 0, 0, 0 );
+ pSalData->maStockPenColorAry[1] = PALETTERGB( 0xFF, 0xFF, 0xFF );
+ pSalData->maStockPenColorAry[2] = PALETTERGB( 0xC0, 0xC0, 0xC0 );
+ pSalData->maStockPenColorAry[3] = PALETTERGB( 0x80, 0x80, 0x80 );
+ pSalData->mhStockPenAry[0] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[0] );
+ pSalData->mhStockPenAry[1] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[1] );
+ pSalData->mhStockPenAry[2] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[2] );
+ pSalData->mhStockPenAry[3] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[3] );
+ pSalData->mnStockPenCount = 4;
+
+ pSalData->maStockBrushColorAry[0] = PALETTERGB( 0, 0, 0 );
+ pSalData->maStockBrushColorAry[1] = PALETTERGB( 0xFF, 0xFF, 0xFF );
+ pSalData->maStockBrushColorAry[2] = PALETTERGB( 0xC0, 0xC0, 0xC0 );
+ pSalData->maStockBrushColorAry[3] = PALETTERGB( 0x80, 0x80, 0x80 );
+ pSalData->mhStockBrushAry[0] = CreateSolidBrush( pSalData->maStockBrushColorAry[0] );
+ pSalData->mhStockBrushAry[1] = CreateSolidBrush( pSalData->maStockBrushColorAry[1] );
+ pSalData->mhStockBrushAry[2] = CreateSolidBrush( pSalData->maStockBrushColorAry[2] );
+ pSalData->mhStockBrushAry[3] = CreateSolidBrush( pSalData->maStockBrushColorAry[3] );
+ pSalData->mnStockBrushCount = 4;
+#endif
+
+ // DC-Cache aufbauen
+ pSalData->mpHDCCache = new HDCCache[ CACHESIZE_HDC ];
+ memset( pSalData->mpHDCCache, 0, CACHESIZE_HDC * sizeof( HDCCache ) );
+
+#ifdef WIN
+ // Nur bei 256 Farben Displays, die Paletten unterstuetzen
+ HDC hDC = GetDC( 0 );
+ int nBitsPixel = GetDeviceCaps( hDC, BITSPIXEL );
+ int nPlanes = GetDeviceCaps( hDC, PLANES );
+ int nRasterCaps = GetDeviceCaps( hDC, RASTERCAPS );
+ int nBitCount = nBitsPixel * nPlanes;
+
+ if ( (nBitCount > 8) && (nBitCount < 24) )
+ {
+ // test, if we have to dither
+ HDC hMemDC = ::CreateCompatibleDC( hDC );
+ HBITMAP hMemBmp = ::CreateCompatibleBitmap( hDC, 8, 8 );
+ HBITMAP hBmpOld = (HBITMAP) ::SelectObject( hMemDC, hMemBmp );
+ HBRUSH hMemBrush = ::CreateSolidBrush( PALETTERGB( 175, 171, 169 ) );
+ HBRUSH hBrushOld = (HBRUSH) ::SelectObject( hMemDC, hMemBrush );
+ BOOL bDither16 = TRUE;
+
+ ::PatBlt( hMemDC, 0, 0, 8, 8, PATCOPY );
+ const COLORREF aCol( ::GetPixel( hMemDC, 0, 0 ) );
+
+ for( int nY = 0; ( nY < 8 ) && bDither16; nY++ )
+ for( int nX = 0; ( nX < 8 ) && bDither16; nX++ )
+ if( ::GetPixel( hMemDC, nX, nY ) != aCol )
+ bDither16 = FALSE;
+
+ ::SelectObject( hMemDC, hBrushOld ), ::DeleteObject( hMemBrush );
+ ::SelectObject( hMemDC, hBmpOld ), ::DeleteObject( hMemBmp );
+ ::DeleteDC( hMemDC );
+
+ if( bDither16 )
+ {
+ // create DIBPattern for 16Bit dithering
+ long n;
+
+ pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, sizeof( BITMAPINFOHEADER ) + 192 );
+ pSalData->mpDitherDIB = (BYTE*) GlobalLock( pSalData->mhDitherDIB );
+ pSalData->mpDitherDiff = new long[ 256 ];
+ pSalData->mpDitherLow = new BYTE[ 256 ];
+ pSalData->mpDitherHigh = new BYTE[ 256 ];
+ pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER );
+ memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
+
+ BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) pSalData->mpDitherDIB;
+
+ pBIH->biSize = sizeof( BITMAPINFOHEADER );
+ pBIH->biWidth = 8;
+ pBIH->biHeight = 8;
+ pBIH->biPlanes = 1;
+ pBIH->biBitCount = 24;
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherDiff[ n ] = n - ( n & 248L );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherLow[ n ] = (BYTE) ( n & 248 );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherHigh[ n ] = (BYTE) Min( pSalData->mpDitherLow[ n ] + 8L, 255L );
+ }
+ }
+ else if ( (nRasterCaps & RC_PALETTE) && (nBitCount == 8) )
+ {
+ BYTE nRed, nGreen, nBlue;
+ BYTE nR, nG, nB;
+ PALETTEENTRY* pPalEntry;
+ LOGPALETTE* pLogPal;
+ const USHORT nDitherPalCount = DITHER_PAL_COUNT;
+ ULONG nTotalCount = DITHER_MAX_SYSCOLOR + nDitherPalCount + DITHER_EXTRA_COLORS;
+
+ // create logical palette
+ pLogPal = (LOGPALETTE*) new char[ sizeof( LOGPALETTE ) + ( nTotalCount * sizeof( PALETTEENTRY ) ) ];
+ pLogPal->palVersion = 0x0300;
+ pLogPal->palNumEntries = (USHORT) nTotalCount;
+ pPalEntry = pLogPal->palPalEntry;
+
+ // Standard colors
+ memcpy( pPalEntry, aImplSalSysPalEntryAry, DITHER_MAX_SYSCOLOR * sizeof( PALETTEENTRY ) );
+ pPalEntry += DITHER_MAX_SYSCOLOR;
+
+ // own palette (6/6/6)
+ for( nB=0, nBlue=0; nB < DITHER_PAL_STEPS; nB++, nBlue += DITHER_PAL_DELTA )
+ {
+ for( nG=0, nGreen=0; nG < DITHER_PAL_STEPS; nG++, nGreen += DITHER_PAL_DELTA )
+ {
+ for( nR=0, nRed=0; nR < DITHER_PAL_STEPS; nR++, nRed += DITHER_PAL_DELTA )
+ {
+ pPalEntry->peRed = nRed;
+ pPalEntry->peGreen = nGreen;
+ pPalEntry->peBlue = nBlue;
+ pPalEntry->peFlags = 0;
+ pPalEntry++;
+ }
+ }
+ }
+
+ // insert special 'Blue' as standard drawing color
+ *pPalEntry++ = aImplExtraColor1;
+
+ // create palette
+ pSalData->mhDitherPal = CreatePalette( pLogPal );
+ delete[] (char*) pLogPal;
+
+ if( pSalData->mhDitherPal )
+ {
+ // create DIBPattern for 8Bit dithering
+ long nSize = sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) ) + 64;
+ long n;
+
+ pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, nSize );
+ pSalData->mpDitherDIB = (BYTE*) GlobalLock( pSalData->mhDitherDIB );
+ pSalData->mpDitherDiff = new long[ 256 ];
+ pSalData->mpDitherLow = new BYTE[ 256 ];
+ pSalData->mpDitherHigh = new BYTE[ 256 ];
+ pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) );
+ memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
+
+ BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) pSalData->mpDitherDIB;
+ short* pColors = (short*) ( pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) );
+
+ pBIH->biSize = sizeof( BITMAPINFOHEADER );
+ pBIH->biWidth = 8;
+ pBIH->biHeight = 8;
+ pBIH->biPlanes = 1;
+ pBIH->biBitCount = 8;
+
+ for( n = 0; n < nDitherPalCount; n++ )
+ pColors[ n ] = (short)( n + DITHER_MAX_SYSCOLOR );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherDiff[ n ] = n % 51L;
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherLow[ n ] = (BYTE) ( n / 51L );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherHigh[ n ] = Min( pSalData->mpDitherLow[ n ] + 1, 5 );
+ }
+
+ // get system color entries
+ ImplUpdateSysColorEntries();
+ }
+
+ ReleaseDC( 0, hDC );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFreeSalGDI()
+{
+ SalData* pSalData = GetSalData();
+ USHORT i;
+
+ // destroy stock objects
+ for ( i = 0; i < pSalData->mnStockPenCount; i++ )
+ DeletePen( pSalData->mhStockPenAry[i] );
+ for ( i = 0; i < pSalData->mnStockBrushCount; i++ )
+ DeleteBrush( pSalData->mhStockBrushAry[i] );
+
+ // 50% Brush loeschen
+ if ( pSalData->mh50Brush )
+ {
+ DeleteBrush( pSalData->mh50Brush );
+ pSalData->mh50Brush = 0;
+ }
+
+ // 50% Bitmap loeschen
+ if ( pSalData->mh50Bmp )
+ {
+ DeleteBitmap( pSalData->mh50Bmp );
+ pSalData->mh50Bmp = 0;
+ }
+
+ ImplClearHDCCache( pSalData );
+ delete[] pSalData->mpHDCCache;
+
+ // Ditherpalette loeschen, wenn vorhanden
+ if ( pSalData->mhDitherPal )
+ {
+#ifdef WIN
+ DeleteObject( pSalData->mhDitherPal );
+#endif
+ pSalData->mhDitherPal = 0;
+ }
+
+ // delete buffers for dithering DIB patterns, if neccessary
+ if ( pSalData->mhDitherDIB )
+ {
+#ifdef WIN
+ GlobalUnlock( pSalData->mhDitherDIB );
+ GlobalFree( pSalData->mhDitherDIB );
+#endif
+ pSalData->mhDitherDIB = 0;
+ delete[] pSalData->mpDitherDiff;
+ delete[] pSalData->mpDitherLow;
+ delete[] pSalData->mpDitherHigh;
+ }
+
+ // delete SysColorList
+ SysColorEntry* pEntry = pFirstSysColor;
+ while( pEntry )
+ {
+ SysColorEntry* pTmp = pEntry->pNext;
+ delete pEntry;
+ pEntry = pTmp;
+ }
+ pFirstSysColor = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplIsPaletteEntry( BYTE nRed, BYTE nGreen, BYTE nBlue )
+{
+ // dither color?
+ if ( !(nRed % DITHER_PAL_DELTA) && !(nGreen % DITHER_PAL_DELTA) && !(nBlue % DITHER_PAL_DELTA) )
+ return TRUE;
+
+#ifdef WIN
+ PALETTEENTRY* pPalEntry = aImplSalSysPalEntryAry;
+
+ // standard palette color?
+ for ( USHORT i = 0; i < DITHER_MAX_SYSCOLOR; i++, pPalEntry++ )
+ {
+ if( pPalEntry->peRed == nRed && pPalEntry->peGreen == nGreen && pPalEntry->peBlue == nBlue )
+ return TRUE;
+ }
+
+ // extra color?
+ if ( aImplExtraColor1.peRed == nRed &&
+ aImplExtraColor1.peGreen == nGreen &&
+ aImplExtraColor1.peBlue == nBlue )
+ {
+ return TRUE;
+ }
+
+#endif
+ return FALSE;
+}
+
+// =======================================================================
+
+int ImplIsSysColorEntry( SalColor nSalColor )
+{
+ SysColorEntry* pEntry = pFirstSysColor;
+#ifdef WIN
+ const DWORD nTestRGB = (DWORD)RGB( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ while ( pEntry )
+ {
+ if ( pEntry->nRGB == nTestRGB )
+ return TRUE;
+ pEntry = pEntry->pNext;
+ }
+#endif
+
+ return FALSE;
+}
+
+// =======================================================================
+
+static void ImplInsertSysColorEntry( int nSysIndex )
+{
+#ifdef WIN
+ const DWORD nRGB = GetSysColor( nSysIndex );
+
+ if ( !ImplIsPaletteEntry( GetRValue( nRGB ), GetGValue( nRGB ), GetBValue( nRGB ) ) )
+ {
+ if ( !pFirstSysColor )
+ {
+ pActSysColor = pFirstSysColor = new SysColorEntry;
+ pFirstSysColor->nRGB = nRGB;
+ pFirstSysColor->pNext = NULL;
+ }
+ else
+ {
+ pActSysColor = pActSysColor->pNext = new SysColorEntry;
+ pActSysColor->nRGB = nRGB;
+ pActSysColor->pNext = NULL;
+ }
+ }
+#endif
+}
+
+// =======================================================================
+
+void ImplUpdateSysColorEntries()
+{
+ // delete old SysColorList
+ SysColorEntry* pEntry = pFirstSysColor;
+ while( pEntry )
+ {
+ SysColorEntry* pTmp = pEntry->pNext;
+ delete pEntry;
+ pEntry = pTmp;
+ }
+ pActSysColor = pFirstSysColor = NULL;
+
+#ifdef WIN
+ // create new sys color list
+ ImplInsertSysColorEntry( COLOR_ACTIVEBORDER );
+ ImplInsertSysColorEntry( COLOR_INACTIVEBORDER );
+ if( aSalShlData.mnVersion >= 410 )
+ {
+ ImplInsertSysColorEntry( COLOR_GRADIENTACTIVECAPTION );
+ ImplInsertSysColorEntry( COLOR_GRADIENTINACTIVECAPTION );
+ }
+ ImplInsertSysColorEntry( COLOR_3DFACE );
+ ImplInsertSysColorEntry( COLOR_3DHILIGHT );
+ ImplInsertSysColorEntry( COLOR_3DLIGHT );
+ ImplInsertSysColorEntry( COLOR_3DSHADOW );
+ ImplInsertSysColorEntry( COLOR_3DDKSHADOW );
+ ImplInsertSysColorEntry( COLOR_INFOBK );
+ ImplInsertSysColorEntry( COLOR_INFOTEXT );
+ ImplInsertSysColorEntry( COLOR_BTNTEXT );
+ ImplInsertSysColorEntry( COLOR_WINDOW );
+ ImplInsertSysColorEntry( COLOR_WINDOWTEXT );
+ ImplInsertSysColorEntry( COLOR_HIGHLIGHT );
+ ImplInsertSysColorEntry( COLOR_HIGHLIGHTTEXT );
+ ImplInsertSysColorEntry( COLOR_MENU );
+ ImplInsertSysColorEntry( COLOR_MENUTEXT );
+ ImplInsertSysColorEntry( COLOR_ACTIVECAPTION );
+ ImplInsertSysColorEntry( COLOR_CAPTIONTEXT );
+ ImplInsertSysColorEntry( COLOR_INACTIVECAPTION );
+ ImplInsertSysColorEntry( COLOR_INACTIVECAPTIONTEXT );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static SalColor ImplGetROPSalColor( SalROPColor nROPColor )
+{
+ SalColor nSalColor;
+ if ( nROPColor == SAL_ROP_0 )
+ nSalColor = MAKE_SALCOLOR( 0, 0, 0 );
+ else
+ nSalColor = MAKE_SALCOLOR( 255, 255, 255 );
+ return nSalColor;
+}
+
+// =======================================================================
+
+void ImplSalInitGraphics( SalGraphicsData* pData )
+{
+#ifdef WIN
+ // Beim Printer berechnen wir die minimale Linienstaerke
+ if ( pData->mbPrinter )
+ {
+ int nDPIX = GetDeviceCaps( pData->mhDC, LOGPIXELSX );
+ if ( nDPIX <= 300 )
+ pData->mnPenWidth = 0;
+ else
+ pData->mnPenWidth = nDPIX/300;
+ }
+
+ ::SetTextAlign( pData->mhDC, TA_BASELINE | TA_LEFT | TA_NOUPDATECP );
+ ::SetBkMode( pData->mhDC, TRANSPARENT );
+ ::SetROP2( pData->mhDC, R2_COPYPEN );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalDeInitGraphics( SalGraphicsData* pData )
+{
+ // Default Objekte selektieren
+ if ( pData->mhDefPen )
+ SelectPen( pData->mhDC, pData->mhDefPen );
+ if ( pData->mhDefBrush )
+ SelectBrush( pData->mhDC, pData->mhDefBrush );
+ if ( pData->mhDefFont )
+ SelectFont( pData->mhDC, pData->mhDefFont );
+}
+
+// =======================================================================
+
+HDC ImplGetCachedDC( ULONG nID, HBITMAP hBmp )
+{
+ SalData* pSalData = GetSalData();
+ HDCCache* pC = &pSalData->mpHDCCache[ nID ];
+
+#ifdef WIN
+ if( !pC->mhDC )
+ {
+ HDC hDC = GetDC( 0 );
+
+ // neuen DC mit DefaultBitmap anlegen
+ pC->mhDC = CreateCompatibleDC( hDC );
+
+ if( pSalData->mhDitherPal )
+ {
+ pC->mhDefPal = SelectPalette( pC->mhDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( pC->mhDC );
+ }
+
+ pC->mhSelBmp = CreateCompatibleBitmap( hDC, CACHED_HDC_DEFEXT, CACHED_HDC_DEFEXT );
+ pC->mhDefBmp = (HBITMAP) SelectObject( pC->mhDC, pC->mhSelBmp );
+
+ ReleaseDC( 0, hDC );
+ }
+
+ if ( hBmp )
+ SelectObject( pC->mhDC, pC->mhActBmp = hBmp );
+ else
+#endif
+ pC->mhActBmp = 0;
+
+ return pC->mhDC;
+}
+
+// =======================================================================
+
+void ImplReleaseCachedDC( ULONG nID )
+{
+ SalData* pSalData = GetSalData();
+ HDCCache* pC = &pSalData->mpHDCCache[ nID ];
+
+#ifdef WIN
+ if ( pC->mhActBmp )
+ SelectObject( pC->mhDC, pC->mhSelBmp );
+#endif
+}
+
+// =======================================================================
+
+void ImplClearHDCCache( SalData* pData )
+{
+ for( ULONG i = 0; i < CACHESIZE_HDC; i++ )
+ {
+ HDCCache* pC = &pData->mpHDCCache[ i ];
+
+#ifdef WIN
+ if( pC->mhDC )
+ {
+ SelectObject( pC->mhDC, pC->mhDefBmp );
+
+ if( pC->mhDefPal )
+ SelectPalette( pC->mhDC, pC->mhDefPal, TRUE );
+
+ DeleteDC( pC->mhDC );
+ DeleteObject( pC->mhSelBmp );
+ }
+#endif
+ }
+}
+
+// =======================================================================
+
+SalGraphics::SalGraphics()
+{
+ maGraphicsData.mhDC = 0;
+ maGraphicsData.mhPen = 0;
+ maGraphicsData.mhBrush = 0;
+ maGraphicsData.mhFont = 0;
+ maGraphicsData.mhRegion = 0;
+ maGraphicsData.mhDefPen = 0;
+ maGraphicsData.mhDefBrush = 0;
+ maGraphicsData.mhDefFont = 0;
+ maGraphicsData.mhDefPal = 0;
+#ifdef WIN
+ maGraphicsData.mpStdClipRgnData = NULL;
+ maGraphicsData.mpLogFont = NULL;
+#endif
+ maGraphicsData.mpFontCharSets = NULL;
+ maGraphicsData.mnFontCharSetCount = 0;
+#ifdef WIN
+ maGraphicsData.mpFontKernPairs = NULL;
+#endif
+ maGraphicsData.mnFontKernPairCount = 0;
+ maGraphicsData.mbFontKernInit = FALSE;
+ maGraphicsData.mnFontOverhang = 0;
+ maGraphicsData.mbXORMode = FALSE;
+ maGraphicsData.mnPenWidth = GSL_PEN_WIDTH;
+ maGraphicsData.mbCalcOverhang = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics::~SalGraphics()
+{
+ // Objekte zerstoeren
+ if ( maGraphicsData.mhPen )
+ {
+ if ( !maGraphicsData.mbStockPen )
+ DeletePen( maGraphicsData.mhPen );
+ }
+ if ( maGraphicsData.mhBrush )
+ {
+ if ( !maGraphicsData.mbStockBrush )
+ DeleteBrush( maGraphicsData.mhBrush );
+ }
+ if ( maGraphicsData.mhFont )
+ DeleteFont( maGraphicsData.mhFont );
+
+ if ( maGraphicsData.mhRegion )
+ {
+ DeleteRegion( maGraphicsData.mhRegion );
+ maGraphicsData.mhRegion = 0;
+ }
+
+ // Cache-Daten zerstoeren
+#ifdef WIN
+ if ( maGraphicsData.mpStdClipRgnData )
+ delete maGraphicsData.mpStdClipRgnData;
+
+ if ( maGraphicsData.mpLogFont )
+ delete maGraphicsData.mpLogFont;
+#endif
+
+ if ( maGraphicsData.mpFontCharSets )
+ delete maGraphicsData.mpFontCharSets;
+
+#ifdef WIN
+ if ( maGraphicsData.mpFontKernPairs )
+ delete maGraphicsData.mpFontKernPairs;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetResolution( long& rDPIX, long& rDPIY )
+{
+#ifdef WIN
+ rDPIX = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSX );
+ rDPIY = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSY );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY )
+{
+#ifdef WIN
+ rDPIX = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSX );
+ rDPIY = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSY );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalGraphics::GetBitCount()
+{
+#ifdef WIN
+ return (USHORT)GetDeviceCaps( maGraphicsData.mhDC, BITSPIXEL );
+#else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::ResetClipRegion()
+{
+ if ( maGraphicsData.mhRegion )
+ {
+ DeleteRegion( maGraphicsData.mhRegion );
+ maGraphicsData.mhRegion = 0;
+ }
+
+#ifdef WIN
+ SelectClipRgn( maGraphicsData.mhDC, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::BeginSetClipRegion( ULONG nRectCount )
+{
+ if ( maGraphicsData.mhRegion )
+ {
+ DeleteRegion( maGraphicsData.mhRegion );
+ maGraphicsData.mhRegion = 0;
+ }
+
+ ULONG nRectBufSize = sizeof(RECT)*nRectCount;
+#ifdef WIN
+ if ( nRectCount < SAL_CLIPRECT_COUNT )
+ {
+ if ( !maGraphicsData.mpStdClipRgnData )
+ maGraphicsData.mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
+ maGraphicsData.mpClipRgnData = maGraphicsData.mpStdClipRgnData;
+ }
+ else
+ maGraphicsData.mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ maGraphicsData.mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
+ maGraphicsData.mpClipRgnData->rdh.iType = RDH_RECTANGLES;
+ maGraphicsData.mpClipRgnData->rdh.nCount = nRectCount;
+ maGraphicsData.mpClipRgnData->rdh.nRgnSize = nRectBufSize;
+ SetRectEmpty( &(maGraphicsData.mpClipRgnData->rdh.rcBound) );
+ maGraphicsData.mpNextClipRect = (RECT*)(&(maGraphicsData.mpClipRgnData->Buffer));
+ maGraphicsData.mbFirstClipRect = TRUE;
+#endif
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+#ifdef WIN
+ if ( nWidth && nHeight )
+ {
+ RECT* pRect = maGraphicsData.mpNextClipRect;
+ RECT* pBoundRect = &(maGraphicsData.mpClipRgnData->rdh.rcBound);
+ long nRight = nX + nWidth;
+ long nBottom = nY + nHeight;
+
+ if ( maGraphicsData.mbFirstClipRect )
+ {
+ pBoundRect->left = nX;
+ pBoundRect->top = nY;
+ pBoundRect->right = nRight;
+ pBoundRect->bottom = nBottom;
+ maGraphicsData.mbFirstClipRect = FALSE;
+ }
+ else
+ {
+ if ( nX < pBoundRect->left )
+ pBoundRect->left = (int)nX;
+
+ if ( nY < pBoundRect->top )
+ pBoundRect->top = (int)nY;
+
+ if ( nRight > pBoundRect->right )
+ pBoundRect->right = (int)nRight;
+
+ if ( nBottom > pBoundRect->bottom )
+ pBoundRect->bottom = (int)nBottom;
+ }
+
+ pRect->left = (int)nX;
+ pRect->top = (int)nY;
+ pRect->right = (int)nRight;
+ pRect->bottom = (int)nBottom;
+ maGraphicsData.mpNextClipRect++;
+ }
+ else
+ {
+ maGraphicsData.mpClipRgnData->rdh.nCount--;
+ maGraphicsData.mpClipRgnData->rdh.nRgnSize -= sizeof( RECT );
+ }
+#endif
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::EndSetClipRegion()
+{
+#ifdef WIN
+ // Aus den Region-Daten muessen wir jetzt eine ClipRegion erzeugen
+ if ( maGraphicsData.mpClipRgnData->rdh.nCount == 1 )
+ {
+ RECT* pRect = &(maGraphicsData.mpClipRgnData->rdh.rcBound);
+ maGraphicsData.mhRegion = CreateRectRgn( pRect->left, pRect->top,
+ pRect->right, pRect->bottom );
+ }
+ else
+ {
+ ULONG nSize = maGraphicsData.mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
+ maGraphicsData.mhRegion = ExtCreateRegion( NULL, nSize, maGraphicsData.mpClipRgnData );
+
+ // if ExtCreateRegion(...) is not supported
+ if( !maGraphicsData.mhRegion )
+ {
+ RGNDATAHEADER* pHeader = (RGNDATAHEADER*) maGraphicsData.mpClipRgnData;
+
+ if( pHeader->nCount )
+ {
+ RECT* pRect = (RECT*) maGraphicsData.mpClipRgnData->Buffer;
+ maGraphicsData.mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
+ pRect++;
+
+ for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ )
+ {
+ HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
+ CombineRgn( maGraphicsData.mhRegion, maGraphicsData.mhRegion, hRgn, RGN_OR );
+ DeleteRegion( hRgn );
+ }
+ }
+ }
+
+ if ( maGraphicsData.mpClipRgnData != maGraphicsData.mpStdClipRgnData )
+ delete maGraphicsData.mpClipRgnData;
+ }
+
+ SelectClipRgn( maGraphicsData.mhDC, maGraphicsData.mhRegion );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetLineColor()
+{
+#ifdef WIN
+ // create and select new pen
+ HPEN hNewPen = GetStockPen( NULL_PEN );
+ HPEN hOldPen = SelectPen( maGraphicsData.mhDC, hNewPen );
+
+ // destory or save old pen
+ if ( maGraphicsData.mhPen )
+ {
+ if ( !maGraphicsData.mbStockPen )
+ DeletePen( maGraphicsData.mhPen );
+ }
+ else
+ maGraphicsData.mhDefPen = hOldPen;
+
+ // set new data
+ maGraphicsData.mhPen = hNewPen;
+ maGraphicsData.mbPen = FALSE;
+ maGraphicsData.mbStockPen = TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetLineColor( SalColor nSalColor )
+{
+#ifdef WIN
+ COLORREF nPenColor = PALETTERGB( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+ HPEN hNewPen = 0;
+ BOOL bStockPen;
+
+ // search for stock pen (only screen, because printer have problems,
+ // when we use stock objects)
+ if ( !maGraphicsData.mbPrinter )
+ {
+ SalData* pSalData = GetSalData();
+ for ( USHORT i = 0; i < pSalData->mnStockPenCount; i++ )
+ {
+ if ( nPenColor == pSalData->maStockPenColorAry[i] )
+ {
+ hNewPen = pSalData->mhStockPenAry[i];
+ bStockPen = TRUE;
+ break;
+ }
+ }
+ }
+
+ // create new pen
+ if ( !hNewPen )
+ {
+ if ( !maGraphicsData.mbPrinter )
+ {
+ if ( GetSalData()->mhDitherPal && ImplIsSysColorEntry( nSalColor ) )
+ nPenColor = PALRGB_TO_RGB( nPenColor );
+ }
+
+ hNewPen = CreatePen( PS_SOLID, maGraphicsData.mnPenWidth, nPenColor );
+ bStockPen = FALSE;
+ }
+
+ // select new pen
+ HPEN hOldPen = SelectPen( maGraphicsData.mhDC, hNewPen );
+
+ // destory or save old pen
+ if ( maGraphicsData.mhPen )
+ {
+ if ( !maGraphicsData.mbStockPen )
+ DeletePen( maGraphicsData.mhPen );
+ }
+ else
+ maGraphicsData.mhDefPen = hOldPen;
+
+ // set new data
+ maGraphicsData.mnPenColor = nPenColor;
+ maGraphicsData.mhPen = hNewPen;
+ maGraphicsData.mbPen = TRUE;
+ maGraphicsData.mbStockPen = bStockPen;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetFillColor()
+{
+ // create and select new brush
+#ifdef WIN
+ HBRUSH hNewBrush = GetStockBrush( NULL_BRUSH );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hNewBrush );
+#endif
+
+ // destory or save old brush
+ if ( maGraphicsData.mhBrush )
+ {
+ if ( !maGraphicsData.mbStockBrush )
+ DeleteBrush( maGraphicsData.mhBrush );
+ }
+#ifdef WIN
+ else
+ maGraphicsData.mhDefBrush = hOldBrush;
+
+ // set new data
+ maGraphicsData.mhBrush = hNewBrush;
+#endif
+ maGraphicsData.mbBrush = FALSE;
+ maGraphicsData.mbStockBrush = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetFillColor( SalColor nSalColor )
+{
+#ifdef WIN
+ SalData* pSalData = GetSalData();
+ BYTE nRed = SALCOLOR_RED( nSalColor );
+ BYTE nGreen = SALCOLOR_GREEN( nSalColor );
+ BYTE nBlue = SALCOLOR_BLUE( nSalColor );
+ COLORREF nBrushColor = PALETTERGB( nRed, nGreen, nBlue );
+ HBRUSH hNewBrush = 0;
+ BOOL bStockBrush;
+
+ // search for stock brush (only screen, because printer have problems,
+ // when we use stock objects)
+ if ( !maGraphicsData.mbPrinter )
+ {
+ for ( USHORT i = 0; i < pSalData->mnStockBrushCount; i++ )
+ {
+ if ( nBrushColor == pSalData->maStockBrushColorAry[ i ] )
+ {
+ hNewBrush = pSalData->mhStockBrushAry[i];
+ bStockBrush = TRUE;
+ break;
+ }
+ }
+ }
+
+ // create new brush
+ if ( !hNewBrush )
+ {
+ if ( maGraphicsData.mbPrinter || !pSalData->mhDitherDIB )
+ hNewBrush = CreateSolidBrush( nBrushColor );
+ else
+ {
+ if ( 24 == ((BITMAPINFOHEADER*)pSalData->mpDitherDIB)->biBitCount )
+ {
+ BYTE* pTmp = pSalData->mpDitherDIBData;
+ long* pDitherDiff = pSalData->mpDitherDiff;
+ BYTE* pDitherLow = pSalData->mpDitherLow;
+ BYTE* pDitherHigh = pSalData->mpDitherHigh;
+
+ for( long nY = 0L; nY < 8L; nY++ )
+ {
+ for( long nX = 0L; nX < 8L; nX++ )
+ {
+ const long nThres = aOrdDither16Bit[ nY ][ nX ];
+ *pTmp++ = DMAP( nBlue, nThres );
+ *pTmp++ = DMAP( nGreen, nThres );
+ *pTmp++ = DMAP( nRed, nThres );
+ }
+ }
+
+ hNewBrush = CreateDIBPatternBrush( pSalData->mhDitherDIB, DIB_RGB_COLORS );
+ }
+ else if ( ImplIsSysColorEntry( nSalColor ) )
+ {
+ nBrushColor = PALRGB_TO_RGB( nBrushColor );
+ hNewBrush = CreateSolidBrush( nBrushColor );
+ }
+ else if ( ImplIsPaletteEntry( nRed, nGreen, nBlue ) )
+ hNewBrush = CreateSolidBrush( nBrushColor );
+ else
+ {
+ BYTE* pTmp = pSalData->mpDitherDIBData;
+ long* pDitherDiff = pSalData->mpDitherDiff;
+ BYTE* pDitherLow = pSalData->mpDitherLow;
+ BYTE* pDitherHigh = pSalData->mpDitherHigh;
+
+ for ( long nY = 0L; nY < 8L; nY++ )
+ {
+ for ( long nX = 0L; nX < 8L; nX++ )
+ {
+ const long nThres = aOrdDither8Bit[ nY ][ nX ];
+ *pTmp = DMAP( nRed, nThres ) + DMAP( nGreen, nThres ) * 6 + DMAP( nBlue, nThres ) * 36;
+ pTmp++;
+ }
+ }
+
+ hNewBrush = CreateDIBPatternBrush( pSalData->mhDitherDIB, DIB_PAL_COLORS );
+ }
+ }
+
+ bStockBrush = FALSE;
+ }
+
+ // select new brush
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hNewBrush );
+
+ // destory or save old brush
+ if ( maGraphicsData.mhBrush )
+ {
+ if ( !maGraphicsData.mbStockBrush )
+ DeleteBrush( maGraphicsData.mhBrush );
+ }
+ else
+ maGraphicsData.mhDefBrush = hOldBrush;
+
+ // set new data
+ maGraphicsData.mnBrushColor = nBrushColor;
+ maGraphicsData.mhBrush = hNewBrush;
+ maGraphicsData.mbBrush = FALSE;
+ maGraphicsData.mbStockBrush = bStockBrush;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetXORMode( BOOL bSet )
+{
+ maGraphicsData.mbXORMode = bSet;
+#ifdef WIn
+ ::SetROP2( maGraphicsData.mhDC, bSet ? R2_XORPEN : R2_COPYPEN );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetROPLineColor( SalROPColor nROPColor )
+{
+ SetLineColor( ImplGetROPSalColor( nROPColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetROPFillColor( SalROPColor nROPColor )
+{
+ SetFillColor( ImplGetROPSalColor( nROPColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPixel( long nX, long nY )
+{
+#ifdef WIN
+ if ( maGraphicsData.mbXORMode )
+ {
+ HBRUSH hBrush = CreateSolidBrush( maGraphicsData.mnPenColor );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hBrush );
+ PatBlt( maGraphicsData.mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ DeleteBrush( hBrush );
+ }
+ else
+ SetPixel( maGraphicsData.mhDC, (int)nX, (int)nY, maGraphicsData.mnPenColor );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor )
+{
+#ifdef WIN
+ COLORREF nCol = PALETTERGB( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ if ( !maGraphicsData.mbPrinter &&
+ GetSalData()->mhDitherPal &&
+ ImplIsSysColorEntry( nSalColor ) )
+ nCol = PALRGB_TO_RGB( nCol );
+
+ if ( maGraphicsData.mbXORMode )
+ {
+ HBRUSH hBrush = CreateSolidBrush( nCol );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hBrush );
+ PatBlt( maGraphicsData.mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ DeleteBrush( hBrush );
+ }
+ else
+ ::SetPixel( maGraphicsData.mhDC, (int)nX, (int)nY, nCol );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2 )
+{
+#ifdef WIN
+ MoveToEx( maGraphicsData.mhDC, (int)nX1, (int)nY1, NULL );
+#endif
+
+ // we must paint the endpoint
+ int bPaintEnd = TRUE;
+ if ( nX1 == nX2 )
+ {
+ bPaintEnd = FALSE;
+ if ( nY1 <= nY2 )
+ nY2++;
+ else
+ nY2--;
+ }
+ if ( nY1 == nY2 )
+ {
+ bPaintEnd = FALSE;
+ if ( nX1 <= nX2 )
+ nX2++;
+ else
+ nX2--;
+ }
+
+#ifdef WIN
+ LineTo( maGraphicsData.mhDC, (int)nX2, (int)nY2 );
+#endif
+
+ if ( bPaintEnd && !maGraphicsData.mbPrinter )
+ {
+#ifdef WIN
+ if ( maGraphicsData.mbXORMode )
+ {
+ HBRUSH hBrush = CreateSolidBrush( maGraphicsData.mnPenColor );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hBrush );
+ PatBlt( maGraphicsData.mhDC, (int)nX2, (int)nY2, (int)1, (int)1, PATINVERT );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ DeleteBrush( hBrush );
+ }
+ else
+ SetPixel( maGraphicsData.mhDC, (int)nX2, (int)nY2, maGraphicsData.mnPenColor );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight )
+{
+ if ( !maGraphicsData.mbPen )
+ {
+ if ( !maGraphicsData.mbPrinter )
+ {
+#ifdef WIN
+ PatBlt( maGraphicsData.mhDC, (int)nX, (int)nY, (int)nWidth, (int)nHeight, maGraphicsData.mbXORMode ? PATINVERT : PATCOPY );
+#endif
+ }
+ else
+ {
+ RECT aWinRect;
+ aWinRect.left = nX;
+ aWinRect.top = nY;
+ aWinRect.right = nX+nWidth;
+ aWinRect.bottom = nY+nHeight;
+#ifdef WIN
+ ::FillRect( maGraphicsData.mhDC, &aWinRect, maGraphicsData.mhBrush );
+#endif
+ }
+ }
+#ifdef WIN
+ else
+ WIN_Rectangle( maGraphicsData.mhDC, (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry )
+{
+ // Unter NT koennen wir das Array direkt weiterreichen
+ DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
+ "SalGraphics::DrawPolyLine(): POINT != SalPoint" );
+
+ POINT* pWinPtAry = (POINT*)pPtAry;
+ // Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl
+ // von Punkten
+#ifdef WIN
+ if ( !Polyline( maGraphicsData.mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+ Polyline( maGraphicsData.mhDC, pWinPtAry, MAX_64KSALPOINTS );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry )
+{
+ // Unter NT koennen wir das Array direkt weiterreichen
+ DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
+ "SalGraphics::DrawPolygon(): POINT != SalPoint" );
+
+ POINT* pWinPtAry = (POINT*)pPtAry;
+#ifdef WIN
+ // Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl
+ // von Punkten
+ if ( !WIN_Polygon( maGraphicsData.mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+ WIN_Polygon( maGraphicsData.mhDC, pWinPtAry, MAX_64KSALPOINTS );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolyPolygon( ULONG nPoly, const ULONG* pPoints,
+ PCONSTSALPOINT* pPtAry )
+{
+ UINT aWinPointAry[SAL_POLYPOLYCOUNT_STACKBUF];
+ UINT* pWinPointAry;
+ UINT nPolyPolyPoints = 0;
+ UINT nPoints;
+ UINT i;
+
+ if ( nPoly <= SAL_POLYPOLYCOUNT_STACKBUF )
+ pWinPointAry = aWinPointAry;
+ else
+ pWinPointAry = new UINT[nPoly];
+
+ for ( i = 0; i < (UINT)nPoly; i++ )
+ {
+ nPoints = (UINT)pPoints[i]+1;
+ pWinPointAry[i] = nPoints;
+ nPolyPolyPoints += nPoints;
+ }
+
+ POINT aWinPointAryAry[SAL_POLYPOLYPOINTS_STACKBUF];
+ POINT* pWinPointAryAry;
+ if ( nPolyPolyPoints <= SAL_POLYPOLYPOINTS_STACKBUF )
+ pWinPointAryAry = aWinPointAryAry;
+ else
+ pWinPointAryAry = new POINT[nPolyPolyPoints];
+ // Unter NT koennen wir das Array direkt weiterreichen
+ DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
+ "SalGraphics::DrawPolyPolygon(): POINT != SalPoint" );
+ const SalPoint* pPolyAry;
+ UINT n = 0;
+ for ( i = 0; i < (UINT)nPoly; i++ )
+ {
+ nPoints = pWinPointAry[i];
+ pPolyAry = pPtAry[i];
+ memcpy( pWinPointAryAry+n, pPolyAry, (nPoints-1)*sizeof(POINT) );
+ pWinPointAryAry[n+nPoints-1] = pWinPointAryAry[n];
+ n += nPoints;
+ }
+
+#ifdef WIN
+ if ( !WIN_PolyPolygon( maGraphicsData.mhDC, pWinPointAryAry, (int*)pWinPointAry, (UINT)nPoly ) &&
+ (nPolyPolyPoints > MAX_64KSALPOINTS) )
+ {
+ nPolyPolyPoints = 0;
+ nPoly = 0;
+ do
+ {
+ nPolyPolyPoints += pWinPointAry[(UINT)nPoly];
+ nPoly++;
+ }
+ while ( nPolyPolyPoints < MAX_64KSALPOINTS );
+ nPoly--;
+ if ( pWinPointAry[(UINT)nPoly] > MAX_64KSALPOINTS )
+ pWinPointAry[(UINT)nPoly] = MAX_64KSALPOINTS;
+ if ( nPoly == 1 )
+ WIN_Polygon( maGraphicsData.mhDC, pWinPointAryAry, *pWinPointAry );
+ else
+ WIN_PolyPolygon( maGraphicsData.mhDC, pWinPointAryAry, (int*)pWinPointAry, nPoly );
+ }
+#endif
+
+ if ( pWinPointAry != aWinPointAry )
+ delete pWinPointAry;
+ if ( pWinPointAryAry != aWinPointAryAry )
+ delete pWinPointAryAry;
+}
+
+
+// -----------------------------------------------------------------------
+
+#define POSTSCRIPT_BUFSIZE 0x4000 // MAXIMUM BUFSIZE EQ 0xFFFF
+#define POSTSCRIPT_BOUNDINGSEARCH 0x1000 // we only try to get the BoundingBox
+ // in the first 4096 bytes
+
+static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ for ( ULONG i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize )
+{
+ BOOL bRetValue = FALSE;
+ ULONG nBytesRead;
+
+ if ( nSize < 256 ) // we assume that the file is greater than 256 bytes
+ return FALSE;
+
+ if ( nSize < POSTSCRIPT_BOUNDINGSEARCH )
+ nBytesRead = nSize;
+ else
+ nBytesRead = POSTSCRIPT_BOUNDINGSEARCH;
+
+ BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nBytesRead, 14 );
+ if ( pDest )
+ {
+ int nSecurityCount = 100; // only 100 bytes following the bounding box will be checked
+ nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
+ pDest += 14;
+ for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
+ {
+ int nDivision = 1;
+ BOOL bDivision = FALSE;
+ BOOL bNegative = FALSE;
+ BOOL bValid = TRUE;
+
+ while ( ( --nSecurityCount ) && ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) pDest++;
+ BYTE nByte = *pDest;
+ while ( nSecurityCount && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) )
+ {
+ switch ( nByte )
+ {
+ case '.' :
+ if ( bDivision )
+ bValid = FALSE;
+ else
+ bDivision = TRUE;
+ break;
+ case '-' :
+ bNegative = TRUE;
+ break;
+ default :
+ if ( ( nByte < '0' ) || ( nByte > '9' ) )
+ nSecurityCount = 1; // error parsing the bounding box values
+ else if ( bValid )
+ {
+ if ( bDivision )
+ nDivision*=10;
+ nNumb[i] *= 10;
+ nNumb[i] += nByte - '0';
+ }
+ break;
+ }
+ nSecurityCount--;
+ nByte = *(++pDest);
+ }
+ if ( bNegative )
+ nNumb[i] = -nNumb[i];
+ if ( bDivision && ( nDivision != 1 ) )
+ nNumb[i] /= nDivision;
+ }
+ if ( nSecurityCount)
+ bRetValue = TRUE;
+ }
+ return bRetValue;
+}
+
+inline void ImplWriteDouble( BYTE** pBuf, double nNumb )
+{
+ *pBuf += sprintf( (char*)*pBuf, "%f", nNumb );
+ *(*pBuf)++ = ' ';
+}
+
+inline void ImplWriteString( BYTE** pBuf, const char* sString )
+{
+ strcpy( (char*)*pBuf, sString );
+ *pBuf += strlen( sString );
+}
+
+BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize )
+{
+ BOOL bRetValue = FALSE;
+
+ if ( maGraphicsData.mbPrinter )
+ {
+#ifdef WIN
+ int nEscape = POSTSCRIPT_PASSTHROUGH;
+
+ if ( Escape( maGraphicsData.mhDC, QUERYESCSUPPORT, sizeof( int ), ( LPSTR )&nEscape, 0 ) )
+ {
+ BYTE* pBuf = new BYTE[ POSTSCRIPT_BUFSIZE ];
+
+ double nBoundingBox[4];
+
+ if ( pBuf && ImplGetBoundingBox( nBoundingBox, (BYTE*)pPtr, nSize ) )
+ {
+ double dM11 = nWidth / ( nBoundingBox[2] - nBoundingBox[0] );
+ double dM22 = nHeight / (nBoundingBox[1] - nBoundingBox[3] );
+ BYTE* pTemp = pBuf + 2; // +2 because we want to insert the size later
+ ImplWriteString( &pTemp, "\n\nsave\n[ " );
+ ImplWriteDouble( &pTemp, dM11 );
+ ImplWriteDouble( &pTemp, 0 );
+ ImplWriteDouble( &pTemp, 0 );
+ ImplWriteDouble( &pTemp, dM22 );
+ ImplWriteDouble( &pTemp, nX - ( dM11 * nBoundingBox[0] ) );
+ ImplWriteDouble( &pTemp, nY - ( dM22 * nBoundingBox[3] ) );
+ ImplWriteString( &pTemp, "] concat /showpage {} def\n" );
+ ImplWriteString( &pTemp, "%%BeginDocument:\n" );
+ *((USHORT*)pBuf) = (USHORT)( pTemp - pBuf - 2 );
+ Escape ( maGraphicsData.mhDC, nEscape, pTemp - pBuf, (LPTSTR)((BYTE*)pBuf), 0 );
+
+ ULONG nToDo = nSize;
+ ULONG nDoNow;
+ while ( nToDo )
+ {
+ nDoNow = nToDo;
+ if ( nToDo > POSTSCRIPT_BUFSIZE - 2 )
+ nDoNow = POSTSCRIPT_BUFSIZE - 2;
+ *((USHORT*)pBuf) = (USHORT)nDoNow;
+ memcpy( pBuf + 2, (BYTE*)pPtr + nSize - nToDo, nDoNow );
+ ULONG nResult = Escape ( maGraphicsData.mhDC, nEscape, nDoNow + 2, (LPTSTR)((BYTE*)pBuf), 0 );
+ if (!nResult )
+ break;
+ nToDo -= nResult;
+ }
+ pTemp = pBuf + 2;
+ ImplWriteString( &pTemp, "%%EndDocument\n" );
+ ImplWriteString( &pTemp, "restore\n\n" );
+ *((USHORT*)pBuf) = (USHORT)( pTemp - pBuf - 2 );
+ Escape ( maGraphicsData.mhDC, nEscape, pTemp - pBuf, (LPTSTR)((BYTE*)pBuf), 0 );
+ bRetValue = TRUE;
+ }
+ delete pBuf;
+ }
+#endif
+ }
+
+ return bRetValue;
+}
diff --git a/vcl/aqua/source/gdi/salogl.cxx b/vcl/aqua/source/gdi/salogl.cxx
new file mode 100644
index 000000000000..dc6cb109f5fa
--- /dev/null
+++ b/vcl/aqua/source/gdi/salogl.cxx
@@ -0,0 +1,351 @@
+/*************************************************************************
+ *
+ * $RCSfile: salogl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALOGL_CXX
+
+#ifndef _SV_SALOGL_HXX
+#include <salogl.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+
+// -------------------------------
+// - Additional typedefs for init.
+// -------------------------------
+
+typedef HGLRC ( *OGLFncCreateContext )( HDC hDC );
+typedef BOOL ( *OGLFncDeleteContext )( HGLRC hContext );
+typedef HGLRC ( *OGLFncGetCurrentContext )( void );
+typedef void ( *OGLFncMakeCurrent )( HDC hDC, HGLRC hContext );
+
+// ------------
+// - Lib-Name -
+// ------------
+
+#ifdef WIN
+#define OGL_LIBNAME "OPENGL32.DLL"
+#endif
+
+// ----------
+// - Macros -
+// ----------
+
+#ifdef WIN
+#define INIT_OGLFNC_WGL( FncName ) static OGLFnc##FncName pImplOpenWGLFnc##FncName = NULL;
+#define GET_OGLFNC_WGL( FncName ) \
+pImplOpenWGLFnc##FncName = (OGLFnc##FncName##) GetProcAddress( hImplOGLLib, "wgl" #FncName ); \
+if( !pImplOpenWGLFnc##FncName ) bRet = FALSE;
+#endif
+
+// -----------------
+// - Statics init. -
+// -----------------
+
+// Members
+static HINSTANCE hImplOGLLib;
+HGLRC SalOpenGL::mhOGLContext = 0;
+HDC SalOpenGL::mhOGLLastDC = 0;
+ULONG SalOpenGL::mnOGLState = OGL_STATE_UNLOADED;
+
+#ifdef
+INIT_OGLFNC_WGL( CreateContext );
+INIT_OGLFNC_WGL( DeleteContext );
+INIT_OGLFNC_WGL( GetCurrentContext );
+INIT_OGLFNC_WGL( MakeCurrent );
+#endif
+
+// -----------
+// - WndProc -
+// -----------
+
+#ifdef WIN
+LRESULT CALLBACK OpenGLWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
+{
+ return DefWindowProc( hWnd, nMsg, nPar1, nPar2 );
+}
+#endif
+
+// -------------
+// - SalOpenGL -
+// -------------
+
+SalOpenGL::SalOpenGL( SalGraphics* pGraphics )
+{
+ // Set mhOGLLastDC only the first time a
+ // SalOpenGL object is created; we need
+ // this DC in SalOpenGL::Create();
+ if ( OGL_STATE_UNLOADED == mnOGLState )
+ mhOGLLastDC = pGraphics->maGraphicsData.mhDC;
+}
+
+// ------------------------------------------------------------------------
+
+SalOpenGL::~SalOpenGL()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::Create()
+{
+ BOOL bRet = FALSE;
+
+ if ( OGL_STATE_UNLOADED == mnOGLState )
+ {
+ if( ImplInitLib() )
+ {
+#ifdef WIN
+ USHORT nBitCount = GetDeviceCaps( mhOGLLastDC, BITSPIXEL );
+ PIXELFORMATDESCRIPTOR pfd =
+ {
+ sizeof( PIXELFORMATDESCRIPTOR ),
+ 1,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL,
+ PFD_TYPE_RGBA,
+ (BYTE) nBitCount,
+ 0, 0, 0, 0, 0, 0,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0, 0,
+ 16,
+ 0,
+ 0,
+ PFD_MAIN_PLANE,
+ 0,
+ 0, 0, 0
+ };
+
+ const int nIndex = ChoosePixelFormat( mhOGLLastDC, &pfd );
+
+ if( nIndex && SetPixelFormat( mhOGLLastDC, nIndex, &pfd ) )
+ {
+ if ( (nBitCount > 8) && ImplInit() &&
+ (mhOGLContext = pImplOpenWGLFncCreateContext( mhOGLLastDC )) != 0 )
+ {
+ WNDCLASS aWc;
+ HWND hDummyWnd;
+
+ SaveDC( mhOGLLastDC );
+ SelectClipRgn( mhOGLLastDC, NULL );
+ pImplOpenWGLFncMakeCurrent( mhOGLLastDC, mhOGLContext );
+ RestoreDC( mhOGLLastDC, -1 );
+ mnOGLState = OGL_STATE_VALID;
+ bRet = TRUE;
+
+ memset( &aWc, 0, sizeof( aWc ) );
+ aWc.hInstance = GetModuleHandle( NULL );
+ aWc.lpfnWndProc = OpenGLWndProc;
+ aWc.lpszClassName = "OpenGLWnd";
+ RegisterClass( &aWc );
+ hDummyWnd = CreateWindow( aWc.lpszClassName, NULL, WS_OVERLAPPED, 0, -50, 1, 1, HWND_DESKTOP, NULL, aWc.hInstance, 0 );
+ ShowWindow( hDummyWnd, SW_SHOW );
+ DestroyWindow( hDummyWnd );
+ UnregisterClass( aWc.lpszClassName, aWc.hInstance );
+ }
+ else
+ {
+ ImplFreeLib();
+ mnOGLState = OGL_STATE_INVALID;
+ }
+ }
+ else
+ mnOGLState = OGL_STATE_INVALID;
+#endif
+ }
+ else
+ mnOGLState = OGL_STATE_INVALID;
+ }
+ else if( OGL_STATE_VALID == mnOGLState )
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::Release()
+{
+ ImplFreeLib();
+}
+
+// ------------------------------------------------------------------------
+
+void* SalOpenGL::GetOGLFnc( const char* pFncName )
+{
+#ifdef WIN
+ if ( hImplOGLLib )
+ return (void*)GetProcAddress( hImplOGLLib, pFncName );
+ else
+#endif
+ return NULL;
+}
+
+// ------------------------------------------------------------------------
+
+#ifdef WIN
+typedef BOOL (WINAPI *MyFuncType)(HDC, HGLRC);
+#endif
+
+void SalOpenGL::OGLEntry( SalGraphics* pGraphics )
+{
+ if ( pGraphics->maGraphicsData.mhDC != mhOGLLastDC )
+ {
+#ifdef WIN
+ PIXELFORMATDESCRIPTOR pfd =
+ {
+ sizeof( PIXELFORMATDESCRIPTOR ),
+ 1,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL,
+ PFD_TYPE_RGBA,
+ GetDeviceCaps( pGraphics->maGraphicsData.mhDC, BITSPIXEL ),
+ 0, 0, 0, 0, 0, 0,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0, 0,
+ 16,
+ 0,
+ 0,
+ PFD_MAIN_PLANE,
+ 0,
+ 0, 0, 0
+ };
+
+ const int nIndex = ChoosePixelFormat( pGraphics->maGraphicsData.mhDC, &pfd );
+ if ( nIndex && SetPixelFormat( pGraphics->maGraphicsData.mhDC, nIndex, &pfd ) )
+ {
+ WNDCLASS aWc;
+ HWND hDummyWnd;
+
+ pImplOpenWGLFncDeleteContext( mhOGLContext );
+ mhOGLLastDC = pGraphics->maGraphicsData.mhDC;
+ mhOGLContext = pImplOpenWGLFncCreateContext( mhOGLLastDC );
+
+ SaveDC( mhOGLLastDC );
+ SelectClipRgn( mhOGLLastDC, NULL );
+ pImplOpenWGLFncMakeCurrent( mhOGLLastDC, mhOGLContext );
+ RestoreDC( mhOGLLastDC, -1 );
+
+ memset( &aWc, 0, sizeof( aWc ) );
+ aWc.hInstance = GetModuleHandle( NULL );
+ aWc.lpfnWndProc = OpenGLWndProc;
+ aWc.lpszClassName = "OpenGLWnd";
+ RegisterClass( &aWc );
+ hDummyWnd = CreateWindow( aWc.lpszClassName, NULL, WS_OVERLAPPED, 0, -50, 1, 1, HWND_DESKTOP, NULL, aWc.hInstance, 0 );
+ ShowWindow( hDummyWnd, SW_SHOW );
+ DestroyWindow( hDummyWnd );
+ UnregisterClass( aWc.lpszClassName, aWc.hInstance );
+ }
+#endif
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::OGLExit( SalGraphics* pGraphics )
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::ImplInitLib()
+{
+#ifdef WIN
+ return ((hImplOGLLib = LoadLibrary( OGL_LIBNAME )) != NULL);
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::ImplFreeLib()
+{
+ if ( hImplOGLLib )
+ {
+#ifdef WIN
+ FreeLibrary( hImplOGLLib );
+#endif
+ hImplOGLLib = NULL;
+ mnOGLState = OGL_STATE_UNLOADED;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::ImplInit()
+{
+ BOOL bRet = TRUE;
+
+#ifdef WIN
+ // Internal use
+ GET_OGLFNC_WGL( CreateContext );
+ GET_OGLFNC_WGL( DeleteContext );
+ GET_OGLFNC_WGL( GetCurrentContext );
+ GET_OGLFNC_WGL( MakeCurrent );
+#endif
+
+ return bRet;
+}
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
new file mode 100644
index 000000000000..522c9ef18e91
--- /dev/null
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -0,0 +1,1487 @@
+/*************************************************************************
+ *
+ * $RCSfile: salprn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALPRN_CXX
+
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALPTYPE_HXX
+#include <salptype.hxx>
+#endif
+#ifndef _SV_SALPRN_HXX
+#include <salprn.hxx>
+#endif
+
+#ifndef _NEW_HXX
+#include <tools/new.hxx>
+#endif
+
+#ifndef _SV_PRINT_H
+#include <print.h>
+#endif
+#ifndef _SV_JOBSET_H
+#include <jobset.h>
+#endif
+
+// =======================================================================
+
+static char aImplWindows[] = "windows";
+static char aImplDevices[] = "devices";
+static char aImplDevice[] = "device";
+
+// =======================================================================
+
+static ULONG ImplWinQueueStatusToSal( DWORD nWinStatus )
+{
+ ULONG nStatus = 0;
+#ifdef WIN
+ if ( nWinStatus & PRINTER_STATUS_PAUSED )
+ nStatus |= QUEUE_STATUS_PAUSED;
+ if ( nWinStatus & PRINTER_STATUS_ERROR )
+ nStatus |= QUEUE_STATUS_ERROR;
+ if ( nWinStatus & PRINTER_STATUS_PENDING_DELETION )
+ nStatus |= QUEUE_STATUS_PENDING_DELETION;
+ if ( nWinStatus & PRINTER_STATUS_PAPER_JAM )
+ nStatus |= QUEUE_STATUS_PAPER_JAM;
+ if ( nWinStatus & PRINTER_STATUS_PAPER_OUT )
+ nStatus |= QUEUE_STATUS_PAPER_OUT;
+ if ( nWinStatus & PRINTER_STATUS_MANUAL_FEED )
+ nStatus |= QUEUE_STATUS_MANUAL_FEED;
+ if ( nWinStatus & PRINTER_STATUS_PAPER_PROBLEM )
+ nStatus |= QUEUE_STATUS_PAPER_PROBLEM;
+ if ( nWinStatus & PRINTER_STATUS_OFFLINE )
+ nStatus |= QUEUE_STATUS_OFFLINE;
+ if ( nWinStatus & PRINTER_STATUS_IO_ACTIVE )
+ nStatus |= QUEUE_STATUS_IO_ACTIVE;
+ if ( nWinStatus & PRINTER_STATUS_BUSY )
+ nStatus |= QUEUE_STATUS_BUSY;
+ if ( nWinStatus & PRINTER_STATUS_PRINTING )
+ nStatus |= QUEUE_STATUS_PRINTING;
+ if ( nWinStatus & PRINTER_STATUS_OUTPUT_BIN_FULL )
+ nStatus |= QUEUE_STATUS_OUTPUT_BIN_FULL;
+ if ( nWinStatus & PRINTER_STATUS_WAITING )
+ nStatus |= QUEUE_STATUS_WAITING;
+ if ( nWinStatus & PRINTER_STATUS_PROCESSING )
+ nStatus |= QUEUE_STATUS_PROCESSING;
+ if ( nWinStatus & PRINTER_STATUS_INITIALIZING )
+ nStatus |= QUEUE_STATUS_INITIALIZING;
+ if ( nWinStatus & PRINTER_STATUS_WARMING_UP )
+ nStatus |= QUEUE_STATUS_WARMING_UP;
+ if ( nWinStatus & PRINTER_STATUS_TONER_LOW )
+ nStatus |= QUEUE_STATUS_TONER_LOW;
+ if ( nWinStatus & PRINTER_STATUS_NO_TONER )
+ nStatus |= QUEUE_STATUS_NO_TONER;
+ if ( nWinStatus & PRINTER_STATUS_PAGE_PUNT )
+ nStatus |= QUEUE_STATUS_PAGE_PUNT;
+ if ( nWinStatus & PRINTER_STATUS_USER_INTERVENTION )
+ nStatus |= QUEUE_STATUS_USER_INTERVENTION;
+ if ( nWinStatus & PRINTER_STATUS_OUT_OF_MEMORY )
+ nStatus |= QUEUE_STATUS_OUT_OF_MEMORY;
+ if ( nWinStatus & PRINTER_STATUS_DOOR_OPEN )
+ nStatus |= QUEUE_STATUS_DOOR_OPEN;
+ if ( nWinStatus & PRINTER_STATUS_SERVER_UNKNOWN )
+ nStatus |= QUEUE_STATUS_SERVER_UNKNOWN;
+ if ( nWinStatus & PRINTER_STATUS_POWER_SAVE )
+ nStatus |= QUEUE_STATUS_POWER_SAVE;
+ if ( !nStatus && !(nWinStatus & PRINTER_STATUS_NOT_AVAILABLE) )
+ nStatus |= QUEUE_STATUS_READY;
+#endif
+ return nStatus;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
+{
+// !!! UNICODE - NT Optimierung !!!
+ DWORD i;
+ DWORD n;
+ DWORD nBytes = 0;
+// DWORD nInfoRet;
+ DWORD nInfoPrn2;
+ BOOL bFound = FALSE;
+#ifdef WIN
+ PRINTER_INFO_2* pWinInfo2 = NULL;
+ PRINTER_INFO_2* pGetInfo2;
+ EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoPrn2 );
+#endif
+ if ( nBytes )
+ {
+#ifdef WIN
+ pWinInfo2 = (PRINTER_INFO_2*)new BYTE[nBytes];
+ if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoPrn2 ) )
+ {
+ pGetInfo2 = pWinInfo2;
+ for ( i = 0; i < nInfoPrn2; i++ )
+ {
+ SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
+ pInfo->maPrinterName = ImplSalGetUniString( pGetInfo2->pPrinterName );
+ pInfo->maDriver = ImplSalGetUniString( pGetInfo2->pDriverName );
+ XubString aPortName;
+ if ( pGetInfo2->pPortName )
+ aPortName = ImplSalGetUniString( pGetInfo2->pPortName );
+ // pLocation can be 0 (the Windows docu doesn't describe this)
+ if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) )
+ pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation );
+ else
+ pInfo->maLocation = aPortName;
+ // pComment can be 0 (the Windows docu doesn't describe this)
+ if ( pGetInfo2->pComment )
+ pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment );
+ pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status );
+ pInfo->mnJobs = pGetInfo2->cJobs;
+ pInfo->mpSysData = new XubString( aPortName );
+ pList->Add( pInfo );
+ pGetInfo2++;
+ }
+
+ bFound = TRUE;
+ }
+#endif
+ }
+
+/* Siehe Kommentar unten !!!
+ EnumPrinters( PRINTER_ENUM_NETWORK | PRINTER_ENUM_REMOTE, NULL, 1, NULL, 0, &nBytes, &nInfoRet );
+ if ( nBytes )
+ {
+ PRINTER_INFO_1* pWinInfo1 = (PRINTER_INFO_1*)new BYTE[nBytes];
+ if ( EnumPrinters( PRINTER_ENUM_NETWORK | PRINTER_ENUM_REMOTE, NULL, 1, (LPBYTE)pWinInfo1, nBytes, &nBytes, &nInfoRet ) )
+ {
+ PRINTER_INFO_1* pGetInfo1 = pWinInfo1;
+ for ( i = 0; i < nInfoRet; i++ )
+ {
+ // Feststellen, ob Printer durch erste Abfrage schon gefunden
+ // wurde
+ BOOL bAdd = TRUE;
+#ifdef WIN
+ if ( pWinInfo2 )
+ {
+ pGetInfo2 = pWinInfo2;
+ for ( n = 0; n < nInfoPrn2; n++ )
+ {
+ if ( strcmp( pGetInfo1->pName, pGetInfo2->pPrinterName ) == 0 )
+ {
+ bAdd = FALSE;
+ break;
+ }
+ pGetInfo2++;
+ }
+ }
+#endif
+ // Wenn neuer Printer, dann aufnehmen
+ if ( bAdd )
+ {
+ SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
+ XubString aPrnName( pGetInfo1->pName );
+ pInfo->maPrinterName = aPrnName;
+ pInfo->maDriver = "winspool";
+ pInfo->maComment = pGetInfo1->pComment;
+ pInfo->mnStatus = 0;
+ pInfo->mnJobs = QUEUE_JOBS_DONTKNOW;
+ pInfo->mpSysData = new String();
+ pList->Add( pInfo );
+ }
+ pGetInfo1++;
+ }
+
+ bFound = TRUE;
+ }
+
+ delete pWinInfo1;
+ }
+*/
+
+// if ( bFound )
+// return;
+
+#ifdef WIN
+// !!! UNICODE - NT Optimierung !!!
+ // Drucker aus WIN.INI lesen
+ UINT nSize = 4096;
+ char* pBuf = new char[nSize];
+ UINT nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize );
+ while ( nRead >= nSize-2 )
+ {
+ nSize += 2048;
+ delete pBuf;
+ pBuf = new char[nSize];
+ nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize );
+ }
+
+ // Druckernamen aus Buffer extrahieren und Liste aufbauen
+ char* pName = pBuf;
+ while ( *pName )
+ {
+ char* pPortName;
+ char* pTmp;
+ char aPortBuf[256];
+ GetProfileStringA( aImplDevices, pName, "", aPortBuf, sizeof( aPortBuf ) );
+
+ pPortName = aPortBuf;
+
+ // Namen anlegen
+ xub_StrLen nNameLen = strlen( pName );
+ XubString aName( ImplSalGetUniString( pName, nNameLen ) );
+
+ // Treibernamen rausfischen
+ pTmp = pPortName;
+ while ( *pTmp != ',' )
+ pTmp++;
+ XubString aDriver( ImplSalGetUniString( pPortName, (USHORT)(pTmp-pPortName) ) );
+ pPortName = pTmp;
+
+ // Alle Portnamen raussuchen
+ do
+ {
+ pPortName++;
+ pTmp = pPortName;
+ while ( *pTmp && (*pTmp != ',') )
+ pTmp++;
+
+ String aPortName( ImplSalGetUniString( pPortName, (USHORT)(pTmp-pPortName) ) );
+
+ // Neuen Eintrag anlegen
+ // !!! Da ich zu bloeb bin, die Netzwerk-Printer zur 5.0
+ // !!! richtig zu integrieren, gehen wir zusaetzlich
+ // !!! noch ueber das W16-Interface, da uns dort die
+ // !!! Drucker noch einfach und schnell geliefert werden
+ // !!! ohne das wir jetzt zu grossen Aufwand treiben muessen.
+ // !!! Somit sollten wir dann jedenfalls nicht schlechter sein
+ // !!! als in einer 4.0 SP2.
+ // Feststellen, ob Printer durch erste Abfrage schon gefunden
+ // wurde
+ BOOL bAdd = TRUE;
+ if ( pWinInfo2 )
+ {
+ pGetInfo2 = pWinInfo2;
+ for ( n = 0; n < nInfoPrn2; n++ )
+ {
+ if ( aName.EqualsIgnoreCaseAscii( pGetInfo2->pPrinterName ) )
+ {
+ bAdd = FALSE;
+ break;
+ }
+ pGetInfo2++;
+ }
+ }
+ // Wenn neuer Printer, dann aufnehmen
+ if ( bAdd )
+ {
+ SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
+ pInfo->maPrinterName = aName;
+ pInfo->maDriver = aDriver;
+ pInfo->maLocation = aPortName;
+ pInfo->mnStatus = 0;
+ pInfo->mnJobs = QUEUE_JOBS_DONTKNOW;
+ pInfo->mpSysData = new XubString( aPortName );
+ pList->Add( pInfo );
+ }
+ }
+ while ( *pTmp == ',' );
+
+ pName += nNameLen + 1;
+ }
+
+ delete pBuf;
+ delete pWinInfo2;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo )
+{
+// !!! UNICODE - NT Optimierung !!!
+ DWORD nBytes = 0;
+ DWORD nInfoRet;
+#ifdef WIN
+ PRINTER_INFO_2* pWinInfo2;
+ EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoRet );
+#endif
+ if ( nBytes )
+ {
+#ifdef WIN
+ pWinInfo2 = (PRINTER_INFO_2*)new BYTE[nBytes];
+ if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoRet ) )
+ {
+ PRINTER_INFO_2* pGetInfo2 = pWinInfo2;
+ for ( DWORD i = 0; i < nInfoRet; i++ )
+ {
+ if ( pInfo->maPrinterName.EqualsAscii( pGetInfo2->pPrinterName ) &&
+ pInfo->maDriver.EqualsAscii( pGetInfo2->pDriverName ) )
+ {
+ if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) )
+ pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation );
+ else
+ pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pPortName );
+ pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status );
+ pInfo->mnJobs = pGetInfo2->cJobs;
+ break;
+ }
+
+ pGetInfo2++;
+ }
+ }
+
+ delete pWinInfo2;
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
+{
+ delete (String*)(pInfo->mpSysData);
+ delete pInfo;
+}
+
+// -----------------------------------------------------------------------
+
+// !!! UNICODE - NT Optimierung !!!
+XubString SalInstance::GetDefaultPrinter()
+{
+ // Default-Printer-String aus win.ini holen
+ char szBuffer[256];
+#ifdef WIN
+ GetProfileStringA( aImplWindows, aImplDevice, "", szBuffer, sizeof( szBuffer ) );
+#endif
+ if ( szBuffer[0] )
+ {
+ // Printername suchen
+ char* pBuf = szBuffer;
+ char* pTmp = pBuf;
+ while ( *pTmp && (*pTmp != ',') )
+ pTmp++;
+ return ImplSalGetUniString( pBuf, (xub_StrLen)(pTmp-pBuf) );
+ }
+ else
+ return XubString();
+}
+
+// =======================================================================
+
+static DWORD ImplDeviceCaps( SalInfoPrinter* pPrinter, WORD nCaps,
+ LPTSTR pOutput, const ImplJobSetup* pSetupData )
+{
+#ifdef WIN
+ DEVMODE* pDevMode;
+ if ( !pSetupData || !pSetupData->mpDriverData )
+ pDevMode = NULL;
+ else
+ pDevMode = SAL_DEVMODE( pSetupData );
+
+// !!! UNICODE - NT Optimierung !!!
+ return DeviceCapabilitiesA( ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ ImplSalGetWinAnsiString( pPrinter->maPrinterData.maPortName, TRUE ).GetBuffer(),
+ nCaps, (LPSTR)pOutput, pDevMode );
+#else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplTestSalJobSetup( SalInfoPrinter* pPrinter,
+ ImplJobSetup* pSetupData, BOOL bDelete )
+{
+ if ( pSetupData && pSetupData->mpDriverData )
+ {
+ // Signature und Groesse muss uebereinstimmen, damit wir keine
+ // JobSetup's von anderen Systemen setzen
+ if ( (pSetupData->mnSystem == JOBSETUP_SYSTEM_WINDOWS) &&
+ (pSetupData->mnDriverDataLen > sizeof( SalDriverData )) &&
+ (((SalDriverData*)(pSetupData->mpDriverData))->mnSysSignature == SAL_DRIVERDATA_SYSSIGN) )
+ return TRUE;
+ else if ( bDelete )
+ {
+ delete pSetupData->mpDriverData;
+ pSetupData->mpDriverData = NULL;
+ pSetupData->mnDriverDataLen = 0;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplUpdateSalJobSetup( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData,
+ BOOL bIn, SalFrame* pVisibleDlgParent )
+{
+#ifdef WIN
+ HANDLE hPrn;
+// !!! UNICODE - NT Optimierung !!!
+ if ( !OpenPrinterA( (LPSTR)ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(), &hPrn, NULL ) )
+ return FALSE;
+
+ LONG nRet;
+ LONG nSysJobSize;
+ HWND hWnd = 0;
+ DWORD nMode = DM_OUT_BUFFER;
+ ULONG nDriverDataLen = 0;
+ SalDriverData* pOutBuffer = NULL;
+ DEVMODE* pInDevBuffer = NULL;
+ DEVMODE* pOutDevBuffer = NULL;
+
+// !!! UNICODE - NT Optimierung !!!
+ nSysJobSize = DocumentPropertiesA( hWnd, hPrn,
+ (LPSTR)ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ NULL, NULL, 0 );
+ if ( nSysJobSize < 0 )
+ {
+ ClosePrinter( hPrn );
+ return FALSE;
+ }
+
+ // Outputbuffer anlegen
+ nDriverDataLen = sizeof(SalDriverData)+nSysJobSize-1;
+ pOutBuffer = (SalDriverData*)SvMemAlloc( nDriverDataLen );
+ memset( pOutBuffer, 0, nDriverDataLen );
+ pOutDevBuffer = (LPDEVMODE)(pOutBuffer->maDriverData);
+ pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN;
+ pOutBuffer->mnVersion = SAL_DRIVERDATA_VERSION;
+ pOutBuffer->mnDriverOffset = (USHORT)(((SalDriverData*)NULL)->maDriverData);
+
+ // Testen, ob wir einen geeigneten Inputbuffer haben
+ if ( bIn && ImplTestSalJobSetup( pPrinter, pSetupData, FALSE ) )
+ {
+ pInDevBuffer = SAL_DEVMODE( pSetupData );
+ nMode |= DM_IN_BUFFER;
+ }
+
+ // Testen, ob Dialog angezeigt werden soll
+ if ( pVisibleDlgParent )
+ {
+ hWnd = pVisibleDlgParent->maFrameData.mhWnd;
+ nMode |= DM_IN_PROMPT;
+ }
+
+// !!! UNICODE - NT Optimierung !!!
+ // Release mutex, in the other case we don't get paints and so on
+ ULONG nMutexCount = ImplSalReleaseYieldMutex();
+ nRet = DocumentPropertiesA( hWnd, hPrn,
+ (LPSTR)ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ pOutDevBuffer, pInDevBuffer, nMode );
+ ImplSalAcquireYieldMutex( nMutexCount );
+ ClosePrinter( hPrn );
+
+ if ( (nRet < 0) || (pVisibleDlgParent && (nRet == IDCANCEL)) )
+ {
+ SvMemFree( pOutBuffer );
+ return FALSE;
+ }
+
+ // String-Buffer am Ende immer mit 0 initialisieren, damit
+ // die JobSetups nach Moeglichkeit bei memcmp immer
+ // identisch sind
+ if ( pOutDevBuffer->dmSize >= 32 )
+ {
+ USHORT nLen = strlen( (const char*)pOutDevBuffer->dmDeviceName );
+ if ( nLen < sizeof( pOutDevBuffer->dmDeviceName ) )
+ memset( pOutDevBuffer->dmDeviceName+nLen, 0, sizeof( pOutDevBuffer->dmDeviceName )-nLen );
+ }
+ if ( pOutDevBuffer->dmSize >= 102 )
+ {
+ USHORT nLen = strlen( (const char*)pOutDevBuffer->dmFormName );
+ if ( nLen < sizeof( pOutDevBuffer->dmFormName ) )
+ memset( pOutDevBuffer->dmFormName+nLen, 0, sizeof( pOutDevBuffer->dmFormName )-nLen );
+ }
+
+ // Daten updaten
+ if ( pSetupData->mpDriverData )
+ delete pSetupData->mpDriverData;
+ pSetupData->mnDriverDataLen = nDriverDataLen;
+ pSetupData->mpDriverData = (BYTE*)pOutBuffer;
+ pSetupData->mnSystem = JOBSETUP_SYSTEM_WINDOWS;
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDevModeToJobSetup( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, ULONG nFlags )
+{
+#ifdef WIN
+ if ( !pSetupData || !pSetupData->mpDriverData )
+ return;
+
+ DEVMODE* pDevMode = SAL_DEVMODE( pSetupData );
+
+ // Orientation
+ if ( nFlags & SAL_JOBSET_ORIENTATION )
+ {
+ if ( pDevMode->dmOrientation == DMORIENT_PORTRAIT )
+ pSetupData->meOrientation = ORIENTATION_PORTRAIT;
+ else if ( pDevMode->dmOrientation == DMORIENT_LANDSCAPE )
+ pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
+ }
+
+ // PaperBin
+ if ( nFlags & SAL_JOBSET_PAPERBIN )
+ {
+ ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
+
+ if ( nCount && (nCount != ((ULONG)-1)) )
+ {
+ WORD* pBins = new WORD[nCount];
+ memset( (BYTE*)pBins, 0, nCount*sizeof(WORD) );
+ ImplDeviceCaps( pPrinter, DC_BINS, (LPTSTR)pBins, pSetupData );
+ pSetupData->mnPaperBin = 0;
+
+ // search the right bin and assign index to mnPaperBin
+ for( ULONG i = 0; i < nCount; i++ )
+ {
+ if( pDevMode->dmDefaultSource == pBins[ i ] )
+ {
+ pSetupData->mnPaperBin = (USHORT)i;
+ break;
+ }
+ }
+
+ delete[] pBins;
+ }
+ }
+
+ // PaperSize
+ if ( nFlags & SAL_JOBSET_PAPERSIZE )
+ {
+ pSetupData->mnPaperWidth = pDevMode->dmPaperWidth*10;
+ pSetupData->mnPaperHeight = pDevMode->dmPaperLength*10;
+ switch( pDevMode->dmPaperSize )
+ {
+ case( DMPAPER_A3 ):
+ pSetupData->mePaperFormat = PAPER_A3;
+ break;
+ case( DMPAPER_A4 ):
+ pSetupData->mePaperFormat = PAPER_A4;
+ break;
+ case( DMPAPER_A5 ):
+ pSetupData->mePaperFormat = PAPER_A5;
+ break;
+ case( DMPAPER_B4 ):
+ pSetupData->mePaperFormat = PAPER_B4;
+ break;
+ case( DMPAPER_B5 ):
+ pSetupData->mePaperFormat = PAPER_B5;
+ break;
+ case( DMPAPER_LETTER ):
+ pSetupData->mePaperFormat = PAPER_LETTER;
+ break;
+ case( DMPAPER_LEGAL ):
+ pSetupData->mePaperFormat = PAPER_LEGAL;
+ break;
+ case( DMPAPER_TABLOID ):
+ pSetupData->mePaperFormat = PAPER_TABLOID;
+ break;
+ default:
+ pSetupData->mePaperFormat = PAPER_USER;
+ break;
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplPaperSizeEqual( short nPaperWidth1, short nPaperHeight1,
+ short nPaperWidth2, short nPaperHeight2 )
+{
+ return (((nPaperWidth1 >= nPaperWidth2-1) && (nPaperWidth1 <= nPaperWidth2+1)) &&
+ ((nPaperHeight1 >= nPaperHeight2-1) && (nPaperHeight1 <= nPaperHeight2+1)));
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplJobSetupToDevMode( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, ULONG nFlags )
+{
+#ifdef WIN
+ if ( !pSetupData || !pSetupData->mpDriverData )
+ return;
+
+ DEVMODE* pDevMode = SAL_DEVMODE( pSetupData );
+
+ // Orientation
+ if ( nFlags & SAL_JOBSET_ORIENTATION )
+ {
+ pDevMode->dmFields |= DM_ORIENTATION;
+ if ( pSetupData->meOrientation == ORIENTATION_PORTRAIT )
+ pDevMode->dmOrientation = DMORIENT_PORTRAIT;
+ else
+ pDevMode->dmOrientation = DMORIENT_LANDSCAPE;
+ }
+
+ // PaperBin
+ if ( nFlags & SAL_JOBSET_PAPERBIN )
+ {
+ ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
+
+ if ( nCount && (nCount != ((ULONG)-1)) )
+ {
+ WORD* pBins = new WORD[nCount];
+ memset( pBins, 0, nCount*sizeof(WORD) );
+ ImplDeviceCaps( pPrinter, DC_BINS, (LPTSTR)pBins, pSetupData );
+ pDevMode->dmFields |= DM_DEFAULTSOURCE;
+ pDevMode->dmDefaultSource = pBins[ pSetupData->mnPaperBin ];
+ delete[] pBins;
+ }
+ }
+
+ // PaperSize
+ if ( nFlags & SAL_JOBSET_PAPERSIZE )
+ {
+ pDevMode->dmFields |= DM_PAPERSIZE;
+ pDevMode->dmPaperWidth = 0;
+ pDevMode->dmPaperLength = 0;
+
+ switch( pDevMode->dmPaperSize )
+ {
+ case( PAPER_A3 ):
+ pDevMode->dmPaperSize = DMPAPER_A3;
+ break;
+ case( PAPER_A4 ):
+ pDevMode->dmPaperSize = DMPAPER_A4;
+ break;
+ case( PAPER_A5 ):
+ pDevMode->dmPaperSize = DMPAPER_A5;
+ break;
+ case( PAPER_B4 ):
+ pDevMode->dmPaperSize = DMPAPER_B4;
+ break;
+ case( PAPER_B5 ):
+ pDevMode->dmPaperSize = DMPAPER_B5;
+ break;
+ case( PAPER_LETTER ):
+ pDevMode->dmPaperSize = DMPAPER_LETTER;
+ break;
+ case( PAPER_LEGAL ):
+ pDevMode->dmPaperSize = DMPAPER_LEGAL;
+ break;
+ case( PAPER_TABLOID ):
+ pDevMode->dmPaperSize = DMPAPER_TABLOID;
+ break;
+ default:
+ {
+ short nPaper = 0;
+ ULONG nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData );
+ WORD* pPapers = NULL;
+ ULONG nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData );
+ POINT* pPaperSizes = NULL;
+ if ( nPaperCount && (nPaperCount != ((ULONG)-1)) )
+ {
+ pPapers = new WORD[nPaperCount];
+ memset( pPapers, 0, nPaperCount*sizeof(WORD) );
+ ImplDeviceCaps( pPrinter, DC_PAPERS, (LPTSTR)pPapers, pSetupData );
+ }
+ if ( nPaperSizeCount && (nPaperSizeCount != ((ULONG)-1)) )
+ {
+ pPaperSizes = new POINT[nPaperSizeCount];
+ memset( pPaperSizes, 0, nPaperSizeCount*sizeof(POINT) );
+ ImplDeviceCaps( pPrinter, DC_PAPERSIZE, (LPTSTR)pPaperSizes, pSetupData );
+ }
+ if ( (nPaperSizeCount == nPaperCount) && pPapers && pPaperSizes )
+ {
+ // Alle Papierformate vergleichen und ein passendes
+ // raussuchen
+ for ( ULONG i = 0; i < nPaperCount; i++ )
+ {
+ if ( ImplPaperSizeEqual( (short)(pSetupData->mnPaperWidth/10),
+ (short)(pSetupData->mnPaperHeight/10),
+ (short)pPaperSizes[i].x,
+ (short)pPaperSizes[i].y ) )
+ {
+ nPaper = pPapers[i];
+ break;
+ }
+ }
+ }
+ if ( pPapers )
+ delete pPapers;
+ if ( pPaperSizes )
+ delete pPaperSizes;
+
+ if ( nPaper )
+ pDevMode->dmPaperSize = nPaper;
+ else
+ {
+ pDevMode->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH;
+ pDevMode->dmPaperSize = DMPAPER_USER;
+ pDevMode->dmPaperWidth = pSetupData->mnPaperWidth/10;
+ pDevMode->dmPaperLength = pSetupData->mnPaperHeight/10;
+ }
+ }
+ break;
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static HDC ImplCreateSalPrnIC( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData )
+{
+#ifdef WIN
+ LPDEVMODE pDevMode;
+ if ( pSetupData && pSetupData->mpDriverData )
+ pDevMode = SAL_DEVMODE( pSetupData );
+ else
+ pDevMode = NULL;
+// !!! UNICODE - NT Optimierung !!!
+ HDC hDC = CreateICA( ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDriverName, TRUE ).GetBuffer(),
+ ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ 0,
+ (LPDEVMODE)pDevMode );
+ return hDC;
+#else
+ return NULL;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static SalGraphics* ImplCreateSalPrnGraphics( HDC hDC )
+{
+ SalGraphics* pGraphics = new SalGraphics;
+ pGraphics->maGraphicsData.mhDC = hDC;
+ pGraphics->maGraphicsData.mhWnd = 0;
+ pGraphics->maGraphicsData.mbPrinter = TRUE;
+ pGraphics->maGraphicsData.mbVirDev = FALSE;
+ pGraphics->maGraphicsData.mbWindow = FALSE;
+ pGraphics->maGraphicsData.mbScreen = FALSE;
+ ImplSalInitGraphics( &(pGraphics->maGraphicsData) );
+ return pGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplUpdateSalPrnIC( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData )
+{
+ HDC hNewDC = ImplCreateSalPrnIC( pPrinter, pSetupData );
+ if ( !hNewDC )
+ return FALSE;
+
+ if ( pPrinter->maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(pPrinter->maPrinterData.mpGraphics->maGraphicsData) );
+#ifdef WIN
+ DeleteDC( pPrinter->maPrinterData.mpGraphics->maGraphicsData.mhDC );
+#endif
+ delete pPrinter->maPrinterData.mpGraphics;
+ }
+
+ SalGraphics* pGraphics = ImplCreateSalPrnGraphics( hNewDC );
+ pPrinter->maPrinterData.mhDC = hNewDC;
+ pPrinter->maPrinterData.mpGraphics = pGraphics;
+
+ return TRUE;
+}
+
+// =======================================================================
+
+SalInfoPrinter* SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
+ ImplJobSetup* pSetupData )
+{
+ SalInfoPrinter* pPrinter = new SalInfoPrinter;
+ pPrinter->maPrinterData.maDriverName = pQueueInfo->maDriver;
+ pPrinter->maPrinterData.maDeviceName = pQueueInfo->maPrinterName;
+ pPrinter->maPrinterData.maPortName = *(String*)(pQueueInfo->mpSysData);
+
+ // Testen, ob Setupdaten zum Drucker gehoeren (erst aufrufen, nachdem
+ // die Member gesetzt sind, da diese in dieser Routine abgefragt werden)
+ ImplTestSalJobSetup( pPrinter, pSetupData, TRUE );
+
+ HDC hDC = ImplCreateSalPrnIC( pPrinter, pSetupData );
+ if ( !hDC )
+ {
+ delete pPrinter;
+ return NULL;
+ }
+
+ SalGraphics* pGraphics = ImplCreateSalPrnGraphics( hDC );
+ pPrinter->maPrinterData.mhDC = hDC;
+ pPrinter->maPrinterData.mpGraphics = pGraphics;
+ if ( !pSetupData->mpDriverData )
+ ImplUpdateSalJobSetup( pPrinter, pSetupData, FALSE, NULL );
+ ImplDevModeToJobSetup( pPrinter, pSetupData, SAL_JOBSET_ALL );
+ pSetupData->mnSystem = JOBSETUP_SYSTEM_WINDOWS;
+
+ return pPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+// =======================================================================
+
+SalInfoPrinter::SalInfoPrinter()
+{
+ maPrinterData.mhDC = 0;
+ maPrinterData.mpGraphics = NULL;
+ maPrinterData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SalInfoPrinter::~SalInfoPrinter()
+{
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+#ifdef WIN
+ DeleteDC( maPrinterData.mpGraphics->maGraphicsData.mhDC );
+#endif
+ delete maPrinterData.mpGraphics;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalInfoPrinter::GetGraphics()
+{
+ if ( maPrinterData.mbGraphics )
+ return NULL;
+
+ if ( maPrinterData.mpGraphics )
+ maPrinterData.mbGraphics = TRUE;
+
+ return maPrinterData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInfoPrinter::ReleaseGraphics( SalGraphics* )
+{
+ maPrinterData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
+{
+ if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, pFrame ) )
+ {
+ ImplDevModeToJobSetup( this, pSetupData, SAL_JOBSET_ALL );
+ return ImplUpdateSalPrnIC( this, pSetupData );
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
+{
+ if ( !ImplTestSalJobSetup( this, pSetupData, FALSE ) )
+ return FALSE;
+ return ImplUpdateSalPrnIC( this, pSetupData );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
+{
+ ImplJobSetupToDevMode( this, pSetupData, nFlags );
+ if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, NULL ) )
+ {
+ ImplDevModeToJobSetup( this, pSetupData, nFlags );
+ return ImplUpdateSalPrnIC( this, pSetupData );
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData )
+{
+#ifdef WIN
+ DWORD nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return nRet;
+ else
+#endif
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin )
+{
+// !!! UNICODE - NT Optimierung !!!
+ XubString aPaperBinName;
+
+#ifdef WIN
+ DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, NULL, pSetupData );
+ if ( (nPaperBin < nBins) && (nBins != ((ULONG)-1)) )
+ {
+ char* pBuffer = new char[nBins*24];
+ DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, pBuffer, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ aPaperBinName = ImplSalGetUniString( (const char*)(pBuffer + (nPaperBin*24)) );
+ delete pBuffer;
+ }
+#endif
+
+ return aPaperBinName;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType )
+{
+#ifdef WIN
+ DWORD nRet;
+
+ switch ( nType )
+ {
+ case PRINTER_CAPABILITIES_SUPPORTDIALOG:
+ return TRUE;
+ case PRINTER_CAPABILITIES_COPIES:
+ nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return nRet;
+ return 0;
+ case PRINTER_CAPABILITIES_COLLATECOPIES:
+ nRet = ImplDeviceCaps( this, DC_COLLATE, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ {
+ nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return nRet;
+ }
+ return 0;
+
+ case PRINTER_CAPABILITIES_SETORIENTATION:
+ nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return TRUE;
+ return FALSE;
+
+ case PRINTER_CAPABILITIES_SETPAPERBIN:
+ nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return TRUE;
+ return FALSE;
+
+ case PRINTER_CAPABILITIES_SETPAPERSIZE:
+ case PRINTER_CAPABILITIES_SETPAPER:
+ nRet = ImplDeviceCaps( this, DC_PAPERS, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return TRUE;
+ return FALSE;
+ }
+#endif
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInfoPrinter::GetPageInfo( const ImplJobSetup*,
+ long& rOutWidth, long& rOutHeight,
+ long& rPageOffX, long& rPageOffY,
+ long& rPageWidth, long& rPageHeight )
+{
+ HDC hDC = maPrinterData.mhDC;
+
+#ifdef WIN
+ rOutWidth = GetDeviceCaps( hDC, HORZRES );
+ rOutHeight = GetDeviceCaps( hDC, VERTRES );
+
+ rPageOffX = GetDeviceCaps( hDC, PHYSICALOFFSETX );
+ rPageOffY = GetDeviceCaps( hDC, PHYSICALOFFSETY );
+ rPageWidth = GetDeviceCaps( hDC, PHYSICALWIDTH );
+ rPageHeight = GetDeviceCaps( hDC, PHYSICALHEIGHT );
+#endif
+}
+
+// =======================================================================
+
+SalPrinter* SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
+{
+ SalPrinter* pPrinter = new SalPrinter;
+ pPrinter->maPrinterData.mpInfoPrinter = pInfoPrinter;
+ return pPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyPrinter( SalPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+// =======================================================================
+
+WIN_BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ )
+{
+ SalData* pSalData = GetSalData();
+ SalPrinter* pPrinter;
+ BOOL bWhile = TRUE;
+ int i = 0;
+
+ do
+ {
+#ifdef WIN
+ // Messages verarbeiten
+ MSG aMsg;
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplDispatchMessage( &aMsg );
+ i++;
+ if ( i > 15 )
+ bWhile = FALSE;
+ }
+ else
+#endif
+ bWhile = FALSE;
+
+ pPrinter = pSalData->mpFirstPrinter;
+ while ( pPrinter )
+ {
+ if( pPrinter->maPrinterData.mhDC == hPrnDC )
+ break;
+
+ pPrinter = pPrinter->maPrinterData.mpNextPrinter;
+ }
+
+ if ( !pPrinter || pPrinter->maPrinterData.mbAbort )
+ return FALSE;
+ }
+ while ( bWhile );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+static LPDEVMODE ImplSalSetCopies( LPDEVMODE pDevMode, ULONG nCopies, BOOL bCollate )
+{
+ LPDEVMODE pNewDevMode = pDevMode;
+ if ( pDevMode && (nCopies > 1) )
+ {
+ if ( nCopies > 32765 )
+ nCopies = 32765;
+ ULONG nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra;
+ pNewDevMode = (LPDEVMODE)new BYTE[nDevSize];
+ memcpy( pNewDevMode, pDevMode, nDevSize );
+ pDevMode = pNewDevMode;
+ pDevMode->dmFields |= DM_COPIES;
+ pDevMode->dmCopies = (short)(USHORT)nCopies;
+ if ( aSalShlData.mbW40 )
+ {
+ pDevMode->dmFields |= DM_COLLATE;
+ if ( bCollate )
+ pDevMode->dmCollate = DMCOLLATE_TRUE;
+ else
+ pDevMode->dmCollate = DMCOLLATE_FALSE;
+ }
+ }
+
+ return pNewDevMode;
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+SalPrinter::SalPrinter()
+{
+ SalData* pSalData = GetSalData();
+
+ maPrinterData.mhDC = 0;
+ maPrinterData.mpGraphics = NULL;
+ maPrinterData.mbAbort = FALSE;
+ maPrinterData.mnCopies = 0;
+ maPrinterData.mbCollate = FALSE;
+
+ // insert frame in framelist
+ maPrinterData.mpNextPrinter = pSalData->mpFirstPrinter;
+ pSalData->mpFirstPrinter = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalPrinter::~SalPrinter()
+{
+ SalData* pSalData = GetSalData();
+
+ // DC freigeben, wenn er noch durch ein AbortJob existiert
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC )
+ {
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ }
+
+#ifdef WIN
+ DeleteDC( hDC );
+#endif
+ }
+
+ // remove printer from printerlist
+ if ( this == pSalData->mpFirstPrinter )
+ pSalData->mpFirstPrinter = maPrinterData.mpNextPrinter;
+ else
+ {
+ SalPrinter* pTempPrinter = pSalData->mpFirstPrinter;
+
+ while( pTempPrinter->maPrinterData.mpNextPrinter != this )
+ pTempPrinter = pTempPrinter->maPrinterData.mpNextPrinter;
+
+ pTempPrinter->maPrinterData.mpNextPrinter = maPrinterData.mpNextPrinter;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::StartJob( const XubString* pFileName,
+ const XubString& rJobName,
+ const XubString&,
+ ULONG nCopies, BOOL bCollate,
+ ImplJobSetup* pSetupData )
+{
+#ifdef WIN
+ maPrinterData.mnError = 0;
+ maPrinterData.mbAbort = FALSE;
+ maPrinterData.mnCopies = nCopies;
+ maPrinterData.mbCollate = bCollate;
+
+ LPDEVMODE pOrgDevMode = NULL;
+ LPDEVMODE pDevMode;
+ BOOL bOwnDevMode = FALSE;
+ if ( pSetupData && pSetupData->mpDriverData )
+ {
+ pOrgDevMode = SAL_DEVMODE( pSetupData );
+ pDevMode = ImplSalSetCopies( pOrgDevMode, nCopies, bCollate );
+ }
+ else
+ pDevMode = NULL;
+
+// !!! UNICODE - NT Optimierung !!!
+ HDC hDC = CreateDCA( ImplSalGetWinAnsiString( maPrinterData.mpInfoPrinter->maPrinterData.maDriverName, TRUE ).GetBuffer(),
+ ImplSalGetWinAnsiString( maPrinterData.mpInfoPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ 0,
+ (LPDEVMODEA)pDevMode );
+
+ if ( pDevMode != pOrgDevMode )
+ delete pDevMode;
+
+ if ( !hDC )
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+
+ if ( SetAbortProc( hDC, SalPrintAbortProc ) <= 0 )
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+
+ maPrinterData.mnError = 0;
+ maPrinterData.mbAbort = FALSE;
+
+// !!! UNICODE - NT Optimierung !!!
+ // Both strings must be exist, if StartJob() is called
+ ByteString aJobName( ImplSalGetWinAnsiString( rJobName, TRUE ) );
+ ByteString aFileName;
+
+ DOCINFO aInfo;
+ memset( &aInfo, 0, sizeof( DOCINFO ) );
+ aInfo.cbSize = sizeof( aInfo );
+ aInfo.lpszDocName = (LPCSTR)aJobName.GetBuffer();
+ if ( pFileName )
+ {
+ if ( pFileName->Len() )
+ {
+ aFileName = ImplSalGetWinAnsiString( *pFileName, TRUE );
+ aInfo.lpszOutput = (LPCSTR)aFileName.GetBuffer();
+ }
+ else
+ aInfo.lpszOutput = "FILE:";
+ }
+ else
+ aInfo.lpszOutput = NULL;
+
+ // Wegen Telocom Balloon Fax-Treiber, der uns unsere Messages
+ // ansonsten oefters schickt, versuchen wir vorher alle
+ // zu verarbeiten und dann eine Dummy-Message reinstellen
+ BOOL bWhile = TRUE;
+ int i = 0;
+ do
+ {
+ // Messages verarbeiten
+ MSG aMsg;
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplDispatchMessage( &aMsg );
+ i++;
+ if ( i > 15 )
+ bWhile = FALSE;
+ }
+ else
+ bWhile = FALSE;
+ }
+ while ( bWhile );
+ ImplPostMessage( GetSalData()->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_DUMMY, 0, 0 );
+
+ // Job starten
+ int nRet = ::StartDoc( hDC, &aInfo );
+ if ( nRet <= 0 )
+ {
+ if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (GetLastError() == ERROR_PRINT_CANCELLED) )
+ maPrinterData.mnError = SAL_PRINTER_ERROR_ABORT;
+ else
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+
+ maPrinterData.mhDC = hDC;
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::EndJob()
+{
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC )
+ {
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ maPrinterData.mpGraphics = NULL;
+ }
+
+#ifdef WIN
+ ::EndDoc( hDC );
+ DeleteDC( hDC );
+#endif
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::AbortJob()
+{
+ maPrinterData.mbAbort = TRUE;
+
+ // Abort asyncron ausloesen
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC )
+ {
+ SalData* pSalData = GetSalData();
+#ifdef WIN
+ ImplPostMessage( pSalData->mpFirstInstance->maInstData.mhComWnd,
+ SAL_MSG_PRINTABORTJOB, (WPARAM)hDC, 0 );
+#endif
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalPrinterAbortJobAsync( HDC hPrnDC )
+{
+ SalData* pSalData = GetSalData();
+ SalPrinter* pPrinter = pSalData->mpFirstPrinter;
+
+ // Feststellen, ob Printer noch existiert
+ while ( pPrinter )
+ {
+ if ( pPrinter->maPrinterData.mhDC == hPrnDC )
+ break;
+
+ pPrinter = pPrinter->maPrinterData.mpNextPrinter;
+ }
+
+ // Wenn Printer noch existiert, dann den Job abbrechen
+ if ( pPrinter )
+ {
+ HDC hDC = pPrinter->maPrinterData.mhDC;
+ if ( hDC )
+ {
+ if ( pPrinter->maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(pPrinter->maPrinterData.mpGraphics->maGraphicsData) );
+ delete pPrinter->maPrinterData.mpGraphics;
+ pPrinter->maPrinterData.mpGraphics = NULL;
+ }
+
+#ifdef WIN
+ ::AbortDoc( hDC );
+ DeleteDC( hDC );
+#endif
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData )
+{
+ HDC hDC = maPrinterData.mhDC;
+#ifdef WIN
+ if ( pSetupData && pSetupData->mpDriverData && bNewJobData )
+ {
+ LPDEVMODE pOrgDevMode;
+ LPDEVMODE pDevMode;
+ pOrgDevMode = SAL_DEVMODE( pSetupData );
+ pDevMode = ImplSalSetCopies( pOrgDevMode, maPrinterData.mnCopies, maPrinterData.mbCollate );
+ ResetDC( hDC, pDevMode );
+ if ( pDevMode != pOrgDevMode )
+ delete pDevMode;
+ }
+ int nRet = ::StartPage( hDC );
+ if ( nRet <= 0 )
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return NULL;
+ }
+
+ // Hack, damit alte PS-Treiber Leerseiten nicht wegoptimieren
+ HPEN hTempPen = SelectPen( hDC, GetStockPen( NULL_PEN ) );
+ HBRUSH hTempBrush = SelectBrush( hDC, GetStockBrush( NULL_BRUSH ) );
+ WIN_Rectangle( hDC, -8000, -8000, -7999, -7999 );
+ SelectPen( hDC, hTempPen );
+ SelectBrush( hDC, hTempBrush );
+#endif
+
+ SalGraphics* pGraphics = new SalGraphics;
+ pGraphics->maGraphicsData.mhDC = hDC;
+ pGraphics->maGraphicsData.mhWnd = 0;
+ pGraphics->maGraphicsData.mbPrinter = TRUE;
+ pGraphics->maGraphicsData.mbVirDev = FALSE;
+ pGraphics->maGraphicsData.mbWindow = FALSE;
+ pGraphics->maGraphicsData.mbScreen = FALSE;
+ ImplSalInitGraphics( &(pGraphics->maGraphicsData) );
+ maPrinterData.mpGraphics = pGraphics;
+ return pGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::EndPage()
+{
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC && maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ maPrinterData.mpGraphics = NULL;
+ }
+#ifdef WIN
+ int nRet = ::EndPage( hDC );
+ if ( nRet > 0 )
+ return TRUE;
+ else
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+#else
+ return FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalPrinter::GetErrorCode()
+{
+ return maPrinterData.mnError;
+}
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx
new file mode 100644
index 000000000000..f0c33af6d17e
--- /dev/null
+++ b/vcl/aqua/source/gdi/salvd.cxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALVD_CXX
+
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+
+// =======================================================================
+
+static HBITMAP ImplCreateVirDevBitmap( HDC hDC, long nDX, long nDY,
+ USHORT nBitCount )
+{
+ HBITMAP hBitmap;
+
+#ifdef WIN
+ if ( nBitCount == 1 )
+ hBitmap = CreateBitmap( (int)nDX, (int)nDY, 1, 1, NULL );
+ else
+ hBitmap = CreateCompatibleBitmap( hDC, (int)nDX, (int)nDY );
+#endif
+
+ return hBitmap;
+}
+
+// =======================================================================
+
+SalVirtualDevice* SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
+ long nDX, long nDY,
+ USHORT nBitCount )
+{
+#ifdef WIN
+ HDC hDC = CreateCompatibleDC( pGraphics->maGraphicsData.mhDC );
+ HBITMAP hBmp = ImplCreateVirDevBitmap( pGraphics->maGraphicsData.mhDC,
+ nDX, nDY, nBitCount );
+
+ if ( hDC && hBmp )
+ {
+ SalVirtualDevice* pVDev = new SalVirtualDevice;
+ SalData* pSalData = GetSalData();
+ SalGraphics* pVirGraphics = new SalGraphics;
+ pVirGraphics->maGraphicsData.mhDC = hDC;
+ pVirGraphics->maGraphicsData.mhWnd = 0;
+ pVirGraphics->maGraphicsData.mbPrinter = FALSE;
+ pVirGraphics->maGraphicsData.mbVirDev = TRUE;
+ pVirGraphics->maGraphicsData.mbWindow = FALSE;
+ pVirGraphics->maGraphicsData.mbScreen = pGraphics->maGraphicsData.mbScreen;
+ if ( pSalData->mhDitherPal && pVirGraphics->maGraphicsData.mbScreen )
+ {
+ pVirGraphics->maGraphicsData.mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( hDC );
+ }
+ ImplSalInitGraphics( &(pVirGraphics->maGraphicsData) );
+
+ pVDev->maVirDevData.mhDC = hDC;
+ pVDev->maVirDevData.mhBmp = hBmp;
+ pVDev->maVirDevData.mhDefBmp = SelectBitmap( hDC, hBmp );
+ pVDev->maVirDevData.mpGraphics = pVirGraphics;
+ pVDev->maVirDevData.mnBitCount = nBitCount;
+ pVDev->maVirDevData.mbGraphics = FALSE;
+
+ // insert VirDev in VirDevList
+ pVDev->maVirDevData.mpNext = pSalData->mpFirstVD;
+ pSalData->mpFirstVD = pVDev;
+
+ return pVDev;
+ }
+ else
+ {
+ if ( hDC )
+ DeleteDC( hDC );
+ if ( hBmp )
+ DeleteBitmap( hBmp );
+ return NULL;
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice )
+{
+ delete pDevice;
+}
+
+// =======================================================================
+
+SalVirtualDevice::SalVirtualDevice()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SalVirtualDevice::~SalVirtualDevice()
+{
+ SalData* pSalData = GetSalData();
+
+#ifdef WIN
+ // destroy saved DC
+ if ( maVirDevData.mpGraphics->maGraphicsData.mhDefPal )
+ SelectPalette( maVirDevData.mpGraphics->maGraphicsData.mhDC, maVirDevData.mpGraphics->maGraphicsData.mhDefPal, TRUE );
+#endif
+ ImplSalDeInitGraphics( &(maVirDevData.mpGraphics->maGraphicsData) );
+ SelectBitmap( maVirDevData.mpGraphics->maGraphicsData.mhDC, maVirDevData.mhDefBmp );
+#ifdef WIN
+ DeleteDC( maVirDevData.mpGraphics->maGraphicsData.mhDC );
+#endif
+ DeleteBitmap( maVirDevData.mhBmp );
+ delete maVirDevData.mpGraphics;
+
+ // remove VirDev from VirDevList
+ if ( this == pSalData->mpFirstVD )
+ pSalData->mpFirstVD = maVirDevData.mpNext;
+ else
+ {
+ SalVirtualDevice* pTempVD = pSalData->mpFirstVD;
+ while ( pTempVD->maVirDevData.mpNext != this )
+ pTempVD = pTempVD->maVirDevData.mpNext;
+
+ pTempVD->maVirDevData.mpNext = maVirDevData.mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalVirtualDevice::GetGraphics()
+{
+ if ( maVirDevData.mbGraphics )
+ return NULL;
+
+ if ( maVirDevData.mpGraphics )
+ maVirDevData.mbGraphics = TRUE;
+
+ return maVirDevData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalVirtualDevice::ReleaseGraphics( SalGraphics* )
+{
+ maVirDevData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalVirtualDevice::SetSize( long nDX, long nDY )
+{
+ HBITMAP hNewBmp = ImplCreateVirDevBitmap( maVirDevData.mhDC, nDX, nDY,
+ maVirDevData.mnBitCount );
+ if ( hNewBmp )
+ {
+ SelectBitmap( maVirDevData.mhDC, hNewBmp );
+ DeleteBitmap( maVirDevData.mhBmp );
+ maVirDevData.mhBmp = hNewBmp;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
diff --git a/vcl/aqua/source/window/makefile.mk b/vcl/aqua/source/window/makefile.mk
new file mode 100644
index 000000000000..9f4791709673
--- /dev/null
+++ b/vcl/aqua/source/window/makefile.mk
@@ -0,0 +1,104 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salwin
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(OS)"!="MACOSX"
+
+dummy:
+ @echo "Nothing to build for this platform"
+
+.ELSE # "$(OS)"!="MACOSX"
+
+.IF "$(remote)"==""
+
+SLOFILES= \
+ $(SLO)/salframe.obj $(SLO)/salobj.obj
+
+.IF "$(UPDATER)"=="YES"
+OBJFILES= \
+ $(OBJ)/salframe.obj $(OBJ)/salobj.obj
+.ENDIF
+
+.ENDIF
+
+.ENDIF # "$(OS)"!="MACOSX"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
new file mode 100644
index 000000000000..2fb84cbfa02f
--- /dev/null
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -0,0 +1,3991 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <limits.h>
+
+#ifdef DBG_UTIL
+#include <stdio.h>
+#endif
+
+#ifndef _SVWIN_HXX
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALFRAME_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#define private public
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_KEYCOES_HXX
+#include <keycodes.hxx>
+#endif
+
+// =======================================================================
+
+// Wegen Fehler in Windows-Headerfiles
+#ifndef IMN_OPENCANDIDATE
+#define IMN_OPENCANDIDATE 0x0005
+#endif
+#ifndef IMN_CLOSECANDIDATE
+#define IMN_CLOSECANDIDATE 0x0004
+#endif
+
+// =======================================================================
+
+static void ImplSaveFrameState( SalFrame* pFrame )
+{
+#ifdef WIN
+ // Position, Groesse und Status fuer GetWindowState() merken
+ if ( !pFrame->maFrameData.mbFullScreen )
+ {
+ BOOL bVisible = (GetWindowStyle( pFrame->maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( IsIconic( pFrame->maFrameData.mhWnd ) )
+ {
+ pFrame->maFrameData.maState.mnState |= SAL_FRAMESTATE_MINIMIZED;
+ if ( bVisible )
+ pFrame->maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ }
+ else if ( IsZoomed( pFrame->maFrameData.mhWnd ) )
+ {
+ pFrame->maFrameData.maState.mnState &= ~SAL_FRAMESTATE_MINIMIZED;
+ pFrame->maFrameData.maState.mnState |= SAL_FRAMESTATE_MAXIMIZED;
+ if ( bVisible )
+ pFrame->maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ pFrame->maFrameData.mbRestoreMaximize = TRUE;
+ }
+ else
+ {
+ RECT aRect;
+ GetWindowRect( pFrame->maFrameData.mhWnd, &aRect );
+ pFrame->maFrameData.maState.mnState &= ~(SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED);
+ pFrame->maFrameData.maState.mnX = aRect.left;
+ pFrame->maFrameData.maState.mnY = aRect.top;
+ pFrame->maFrameData.maState.mnWidth = aRect.right-aRect.left;
+ pFrame->maFrameData.maState.mnHeight = aRect.bottom-aRect.top;
+ if ( bVisible )
+ pFrame->maFrameData.mnShowState = SW_SHOWNORMAL;
+ pFrame->maFrameData.mbRestoreMaximize = FALSE;
+ }
+ }
+#endif
+}
+
+// =======================================================================
+
+SalFrame* ImplSalCreateFrame( SalInstance* pInst,
+ HWND hWndParent, ULONG nSalFrameStyle )
+{
+ SalFrame* pFrame = new SalFrame;
+#ifdef WIN
+ HWND hWnd;
+ DWORD nSysStyle = 0;
+ DWORD nExSysStyle = 0;
+ BOOL bSaveBits = FALSE;
+
+ // determine creation data
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_CHILD )
+ nSysStyle |= WS_CHILD;
+ else if ( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT )
+ {
+ pFrame->maFrameData.mbCaption = TRUE;
+ nSysStyle |= WS_OVERLAPPED;
+ nExSysStyle |= WS_EX_APPWINDOW;
+ }
+ else
+ nSysStyle |= WS_POPUP;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE )
+ {
+ pFrame->maFrameData.mbSizeBorder = TRUE;
+ nSysStyle |= WS_THICKFRAME | WS_SYSMENU;
+ }
+ else if ( nSalFrameStyle & SAL_FRAME_STYLE_BORDER )
+ {
+ pFrame->maFrameData.mbBorder = TRUE;
+ nSysStyle |= WS_BORDER;
+ }
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE )
+ {
+ pFrame->maFrameData.mbCaption = TRUE;
+ nSysStyle |= WS_CAPTION | WS_SYSMENU;
+ }
+ else
+ nExSysStyle |= WS_EX_TOOLWINDOW;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MINABLE )
+ nSysStyle |= WS_MINIMIZEBOX | WS_SYSMENU;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MAXABLE )
+ nSysStyle |= WS_MAXIMIZEBOX | WS_SYSMENU;
+
+ // init frame data
+ pFrame->maFrameData.mnStyle = nSalFrameStyle;
+
+ // determine show style
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT )
+ {
+ SalData* pSalData = GetSalData();
+ pFrame->maFrameData.mnShowState = pSalData->mnCmdShow;
+ if ( (pFrame->maFrameData.mnShowState != SW_SHOWMINIMIZED) &&
+ (pFrame->maFrameData.mnShowState != SW_MINIMIZE) &&
+ (pFrame->maFrameData.mnShowState != SW_SHOWMINNOACTIVE) )
+ {
+ if ( (pFrame->maFrameData.mnShowState == SW_SHOWMAXIMIZED) ||
+ (pFrame->maFrameData.mnShowState == SW_MAXIMIZE) )
+ pFrame->maFrameData.mbOverwriteState = FALSE;
+ pFrame->maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ }
+ else
+ pFrame->maFrameData.mbOverwriteState = FALSE;
+ }
+ else
+ pFrame->maFrameData.mnShowState = SW_SHOWNORMAL;
+
+ // create frame
+ LPCSTR pClassName;
+ if ( bSaveBits )
+ pClassName = SAL_FRAME_CLASSNAME_SBA;
+ else
+ pClassName = SAL_FRAME_CLASSNAMEA;
+ hWnd = CreateWindowExA( nExSysStyle, pClassName, "", nSysStyle,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
+ hWndParent, 0, pInst->maInstData.mhInst, (void*)pFrame );
+ }
+ if ( !hWnd )
+ {
+ delete pFrame;
+ return NULL;
+ }
+
+ // disable close
+ if ( !(nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) )
+ {
+ HMENU hSysMenu = GetSystemMenu( hWnd, FALSE );
+ if ( hSysMenu )
+ EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
+ }
+
+ // reset input context
+#ifdef WIN
+ pFrame->maFrameData.mhDefIMEContext = ImmAssociateContext( hWnd, 0 );
+#endif
+
+ // determine output size and state
+ RECT aRect;
+ GetClientRect( hWnd, &aRect );
+ pFrame->maFrameData.mnWidth = aRect.right;
+ pFrame->maFrameData.mnHeight = aRect.bottom;
+ ImplSaveFrameState( pFrame );
+ pFrame->maFrameData.mbDefPos = TRUE;
+
+ // CreateHDC in the main thread
+ pFrame->ReleaseGraphics( pFrame->GetGraphics() );
+#endif
+
+ return pFrame;
+}
+
+// =======================================================================
+
+// Uebersetzungstabelle von System-Keycodes in StarView-Keycodes
+#define KEY_TAB_SIZE 146
+
+static USHORT aImplTranslateKeyTab[KEY_TAB_SIZE] =
+{
+ // StarView-Code System-Code Index
+ 0, // 0
+ 0, // VK_LBUTTON 1
+ 0, // VK_RBUTTON 2
+ 0, // VK_CANCEL 3
+ 0, // VK_MBUTTON 4
+ 0, // 5
+ 0, // 6
+ 0, // 7
+ KEY_BACKSPACE, // VK_BACK 8
+ KEY_TAB, // VK_TAB 9
+ 0, // 10
+ 0, // 11
+ 0, // VK_CLEAR 12
+ KEY_RETURN, // VK_RETURN 13
+ 0, // 14
+ 0, // 15
+ 0, // VK_SHIFT 16
+ 0, // VK_CONTROL 17
+ 0, // VK_MENU 18
+ 0, // VK_PAUSE 19
+ 0, // VK_CAPITAL 20
+ 0, // 21
+ 0, // 22
+ 0, // 23
+ 0, // 24
+ 0, // 25
+ 0, // 26
+ KEY_ESCAPE, // VK_ESCAPE 27
+ 0, // 28
+ 0, // 29
+ 0, // 30
+ 0, // 31
+ KEY_SPACE, // VK_SPACE 32
+ KEY_PAGEUP, // VK_PRIOR 33
+ KEY_PAGEDOWN, // VK_NEXT 34
+ KEY_END, // VK_END 35
+ KEY_HOME, // VK_HOME 36
+ KEY_LEFT, // VK_LEFT 37
+ KEY_UP, // VK_UP 38
+ KEY_RIGHT, // VK_RIGHT 39
+ KEY_DOWN, // VK_DOWN 40
+ 0, // VK_SELECT 41
+ 0, // VK_PRINT 42
+ 0, // VK_EXECUTE 43
+ 0, // VK_SNAPSHOT 44
+ KEY_INSERT, // VK_INSERT 45
+ KEY_DELETE, // VK_DELETE 46
+ KEY_HELP, // VK_HELP 47
+ KEY_0, // 48
+ KEY_1, // 49
+ KEY_2, // 50
+ KEY_3, // 51
+ KEY_4, // 52
+ KEY_5, // 53
+ KEY_6, // 54
+ KEY_7, // 55
+ KEY_8, // 56
+ KEY_9, // 57
+ 0, // 58
+ 0, // 59
+ 0, // 60
+ 0, // 61
+ 0, // 62
+ 0, // 63
+ 0, // 64
+ KEY_A, // 65
+ KEY_B, // 66
+ KEY_C, // 67
+ KEY_D, // 68
+ KEY_E, // 69
+ KEY_F, // 70
+ KEY_G, // 71
+ KEY_H, // 72
+ KEY_I, // 73
+ KEY_J, // 74
+ KEY_K, // 75
+ KEY_L, // 76
+ KEY_M, // 77
+ KEY_N, // 78
+ KEY_O, // 79
+ KEY_P, // 80
+ KEY_Q, // 81
+ KEY_R, // 82
+ KEY_S, // 83
+ KEY_T, // 84
+ KEY_U, // 85
+ KEY_V, // 86
+ KEY_W, // 87
+ KEY_X, // 88
+ KEY_Y, // 89
+ KEY_Z, // 90
+ 0, // VK_LWIN 91
+ 0, // VK_RWIN 92
+ KEY_CONTEXTMENU, // VK_APPS 93
+ 0, // 94
+ 0, // 95
+ KEY_0, // VK_NUMPAD0 96
+ KEY_1, // VK_NUMPAD1 97
+ KEY_2, // VK_NUMPAD2 98
+ KEY_3, // VK_NUMPAD3 99
+ KEY_4, // VK_NUMPAD4 100
+ KEY_5, // VK_NUMPAD5 101
+ KEY_6, // VK_NUMPAD6 102
+ KEY_7, // VK_NUMPAD7 103
+ KEY_8, // VK_NUMPAD8 104
+ KEY_9, // VK_NUMPAD9 105
+ KEY_MULTIPLY, // VK_MULTIPLY 106
+ KEY_ADD, // VK_ADD 107
+ KEY_COMMA, // VK_SEPARATOR 108
+ KEY_SUBTRACT, // VK_SUBTRACT 109
+ KEY_POINT, // VK_DECIMAL 110
+ KEY_DIVIDE, // VK_DIVIDE 111
+ KEY_F1, // VK_F1 112
+ KEY_F2, // VK_F2 113
+ KEY_F3, // VK_F3 114
+ KEY_F4, // VK_F4 115
+ KEY_F5, // VK_F5 116
+ KEY_F6, // VK_F6 117
+ KEY_F7, // VK_F7 118
+ KEY_F8, // VK_F8 119
+ KEY_F9, // VK_F9 120
+ KEY_F10, // VK_F10 121
+ KEY_F11, // VK_F11 122
+ KEY_F12, // VK_F12 123
+ KEY_F13, // VK_F13 124
+ KEY_F14, // VK_F14 125
+ KEY_F15, // VK_F15 126
+ KEY_F16, // VK_F16 127
+ KEY_F17, // VK_F17 128
+ KEY_F18, // VK_F18 129
+ KEY_F19, // VK_F19 130
+ KEY_F20, // VK_F20 131
+ KEY_F21, // VK_F21 132
+ KEY_F22, // VK_F22 133
+ KEY_F23, // VK_F23 134
+ KEY_F24, // VK_F24 135
+ 0, // 136
+ 0, // 137
+ 0, // 138
+ 0, // 139
+ 0, // 140
+ 0, // 141
+ 0, // 142
+ 0, // 143
+ 0, // NUMLOCK 144
+ 0 // SCROLLLOCK 145
+};
+
+// =======================================================================
+
+long ImplSalCallbackDummy( void*, SalFrame*, USHORT, const void* )
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static UINT ImplSalGetWheelScrollLines()
+{
+ UINT nScrLines = 0;
+#ifdef WIN
+ HWND hWndMsWheel = WIN_FindWindow( MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE );
+ if ( hWndMsWheel )
+ {
+ UINT nGetScrollLinesMsgId = RegisterWindowMessage( MSH_SCROLL_LINES );
+ nScrLines = (UINT)ImplSendMessage( hWndMsWheel, nGetScrollLinesMsgId, 0, 0 );
+ }
+
+ if ( !nScrLines )
+ nScrLines = SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &nScrLines, 0 );
+
+ if ( !nScrLines )
+ nScrLines = 3;
+#endif
+
+ return nScrLines;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalCalcFullScreenSize( const SalFrame* pFrame,
+ int& rX, int& rY, int& rDX, int& rDY )
+{
+#ifdef WIN
+ // set window to screen size
+ int nFrameX;
+ int nFrameY;
+ int nCaptionY;
+ int nScreenDX;
+ int nScreenDY;
+
+ if ( pFrame->maFrameData.mbSizeBorder )
+ {
+ nFrameX = GetSystemMetrics( SM_CXFRAME );
+ nFrameY = GetSystemMetrics( SM_CYFRAME );
+ }
+ else if ( pFrame->maFrameData.mbBorder )
+ {
+ nFrameX = GetSystemMetrics( SM_CXBORDER );
+ nFrameY = GetSystemMetrics( SM_CYBORDER );
+ }
+ else
+ {
+ nFrameX = 0;
+ nFrameY = 0;
+ }
+ if ( pFrame->maFrameData.mbCaption )
+ nCaptionY = GetSystemMetrics( SM_CYCAPTION );
+ else
+ nCaptionY = 0;
+
+ nScreenDX = GetSystemMetrics( SM_CXSCREEN );
+ nScreenDY = GetSystemMetrics( SM_CYSCREEN );
+
+ rX = -nFrameX;
+ rY = -(nFrameY+nCaptionY);
+ rDX = nScreenDX+(nFrameX*2);
+ rDY = nScreenDY+(nFrameY*2)+nCaptionY;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalFrameFullScreenPos( SalFrame* pFrame, BOOL bAlways = FALSE )
+{
+#ifdef WIN
+ if ( bAlways || !IsIconic( pFrame->maFrameData.mhWnd ) )
+ {
+ // set window to screen size
+ int nX;
+ int nY;
+ int nWidth;
+ int nHeight;
+ ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight );
+ SetWindowPos( pFrame->maFrameData.mhWnd, 0,
+ nX, nY, nWidth, nHeight,
+ SWP_NOZORDER | SWP_NOACTIVATE );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame::SalFrame()
+{
+ SalData* pSalData = GetSalData();
+
+ maFrameData.mhWnd = 0;
+#ifdef WIN
+ maFrameData.mhCursor = LoadCursor( 0, IDC_ARROW );
+#endif
+ maFrameData.mhDefIMEContext = 0;
+ maFrameData.mpGraphics = NULL;
+ maFrameData.mpInst = NULL;
+ maFrameData.mpProc = ImplSalCallbackDummy;
+ maFrameData.mnInputLang = 0;
+ maFrameData.mnInputCodePage = 0;
+ maFrameData.mbGraphics = FALSE;
+ maFrameData.mbCaption = FALSE;
+ maFrameData.mbBorder = FALSE;
+ maFrameData.mbSizeBorder = FALSE;
+ maFrameData.mbFullScreen = FALSE;
+ maFrameData.mbPresentation = FALSE;
+ maFrameData.mbInShow = FALSE;
+ maFrameData.mbRestoreMaximize = FALSE;
+ maFrameData.mbInMoveMsg = FALSE;
+ maFrameData.mbInSizeMsg = FALSE;
+ maFrameData.mbFullScreenToolWin = FALSE;
+ maFrameData.mbDefPos = TRUE;
+ maFrameData.mbOverwriteState = TRUE;
+ maFrameData.mbIME = FALSE;
+ maFrameData.mbHandleIME = FALSE;
+ maFrameData.mbSpezIME = FALSE;
+ maFrameData.mbAtCursorIME = FALSE;
+ maFrameData.mbCompositionMode = FALSE;
+ maFrameData.mbCandidateMode = FALSE;
+ memset( &maFrameData.maState, 0, sizeof( SalFrameState ) );
+ maFrameData.maSysData.nSize = sizeof( SystemEnvData );
+
+ // Daten ermitteln, wenn erster Frame angelegt wird
+ if ( !pSalData->mpFirstFrame )
+ {
+#ifdef WIN
+ if ( !aSalShlData.mnWheelMsgId )
+ aSalShlData.mnWheelMsgId = RegisterWindowMessage( MSH_MOUSEWHEEL );
+#endif
+ if ( !aSalShlData.mnWheelScrollLines )
+ aSalShlData.mnWheelScrollLines = ImplSalGetWheelScrollLines();
+ }
+
+ // insert frame in framelist
+ maFrameData.mpNextFrame = pSalData->mpFirstFrame;
+ pSalData->mpFirstFrame = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame::~SalFrame()
+{
+ SalData* pSalData = GetSalData();
+
+ // destroy saved DC
+ if ( maFrameData.mpGraphics )
+ {
+#ifdef WIN
+ if ( maFrameData.mpGraphics->maGraphicsData.mhDefPal )
+ SelectPalette( maFrameData.mpGraphics->maGraphicsData.mhDC, maFrameData.mpGraphics->maGraphicsData.mhDefPal, TRUE );
+#endif
+ ImplSalDeInitGraphics( &(maFrameData.mpGraphics->maGraphicsData) );
+#ifdef WIN
+ ReleaseDC( maFrameData.mhWnd, maFrameData.mpGraphics->maGraphicsData.mhDC );
+#endif
+ delete maFrameData.mpGraphics;
+ }
+
+ if ( maFrameData.mhWnd )
+ {
+ // reset mouse leave data
+ if ( pSalData->mhWantLeaveMsg == maFrameData.mhWnd )
+ {
+ pSalData->mhWantLeaveMsg = 0;
+ if ( pSalData->mpMouseLeaveTimer )
+ {
+ delete pSalData->mpMouseLeaveTimer;
+ pSalData->mpMouseLeaveTimer = NULL;
+ }
+ }
+
+#ifdef WIN
+ // destroy system frame
+ if ( !DestroyWindow( maFrameData.mhWnd ) )
+ SetWindowPtr( maFrameData.mhWnd, 0 );
+#endif
+ }
+
+ // remove frame from framelist
+ if ( this == pSalData->mpFirstFrame )
+ pSalData->mpFirstFrame = maFrameData.mpNextFrame;
+ else
+ {
+ SalFrame* pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame->maFrameData.mpNextFrame != this )
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+
+ pTempFrame->maFrameData.mpNextFrame = maFrameData.mpNextFrame;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalFrame::GetGraphics()
+{
+ if ( maFrameData.mbGraphics )
+ return NULL;
+
+ if ( !maFrameData.mpGraphics )
+ {
+#ifdef WIN
+ HDC hDC = GetDC( maFrameData.mhWnd );
+ if ( hDC )
+ {
+ SalData* pSalData = GetSalData();
+ maFrameData.mpGraphics = new SalGraphics;
+ maFrameData.mpGraphics->maGraphicsData.mhDC = hDC;
+ maFrameData.mpGraphics->maGraphicsData.mhWnd = maFrameData.mhWnd;
+ maFrameData.mpGraphics->maGraphicsData.mbPrinter = FALSE;
+ maFrameData.mpGraphics->maGraphicsData.mbVirDev = FALSE;
+ maFrameData.mpGraphics->maGraphicsData.mbWindow = TRUE;
+ maFrameData.mpGraphics->maGraphicsData.mbScreen = TRUE;
+ if ( pSalData->mhDitherPal )
+ {
+ maFrameData.mpGraphics->maGraphicsData.mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( hDC );
+ }
+ ImplSalInitGraphics( &(maFrameData.mpGraphics->maGraphicsData) );
+ maFrameData.mbGraphics = TRUE;
+ }
+#endif
+ }
+ else
+ maFrameData.mbGraphics = TRUE;
+
+ return maFrameData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ReleaseGraphics( SalGraphics* )
+{
+ maFrameData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalFrame::PostEvent( void* pData )
+{
+#ifdef WIN
+ return (BOOL)ImplPostMessage( maFrameData.mhWnd, SAL_MSG_USEREVENT, 0, (LPARAM)pData );
+#else
+ return FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetTitle( const XubString& rTitle )
+{
+ DBG_ASSERT( sizeof( wchar_t ) == sizeof( xub_Unicode ), "SalFrame::SetTitle(): wchar_t != sal_Unicode" );
+
+#ifdef WIN
+ if ( !SetWindowTextW( maFrameData.mhWnd, rTitle.GetBuffer() ) )
+ {
+ ByteString aAnsiTitle = ImplSalGetWinAnsiString( rTitle );
+ SetWindowTextA( maFrameData.mhWnd, aAnsiTitle.GetBuffer() );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetIcon( USHORT nIcon )
+{
+// ImplSendMessage( maFrameData.mhWnd, WM_SETICON, FALSE, hSmIcon );
+// ImplSendMessage( maFrameData.mhWnd, WM_SETICON, TRUE, hIcon );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalShow( HWND hWnd, BOOL bVisible )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return;
+
+ if ( bVisible )
+ {
+ pFrame->maFrameData.mbDefPos = FALSE;
+ pFrame->maFrameData.mbOverwriteState = TRUE;
+ pFrame->maFrameData.mbInShow = TRUE;
+#ifdef WIN
+ ShowWindow( hWnd, pFrame->maFrameData.mnShowState );
+#endif
+ // Damit Taskleiste unter W98 auch gleich ausgeblendet wird
+ if ( pFrame->maFrameData.mbPresentation )
+ {
+#ifdef WIN
+ HWND hWndParent = ::GetParent( hWnd );
+ if ( hWndParent )
+ SetForegroundWindow( hWndParent );
+ SetForegroundWindow( hWnd );
+#endif
+ }
+#ifdef WIN
+ pFrame->maFrameData.mnShowState = SW_SHOW;
+ pFrame->maFrameData.mbInShow = FALSE;
+ UpdateWindow( hWnd );
+#endif
+ }
+ else
+ {
+#ifdef WIN
+ if ( pFrame->maFrameData.mbFullScreen &&
+ pFrame->maFrameData.mbPresentation &&
+ !::GetParent( hWnd ) )
+ {
+ // Damit im Impress-Player in der Taskleiste nicht durch
+ // einen Windows-Fehler hin- und wieder mal ein leerer
+ // Button stehen bleibt, muessen wir hier die Taskleiste
+ // etwas austricksen. Denn wenn wir im FullScreenMode sind
+ // und das Fenster hiden kommt Windows anscheinend etwas aus
+ // dem tritt und somit minimieren wir das Fenster damit es
+ // nicht flackert
+ ANIMATIONINFO aInfo;
+ aInfo.cbSize = sizeof( aInfo );
+ SystemParametersInfo( SPI_GETANIMATION, 0, &aInfo, 0 );
+ if ( aInfo.iMinAnimate )
+ {
+ int nOldAni = aInfo.iMinAnimate;
+ aInfo.iMinAnimate = 0;
+ SystemParametersInfo( SPI_SETANIMATION, 0, &aInfo, 0 );
+ ShowWindow( pFrame->maFrameData.mhWnd, SW_SHOWMINNOACTIVE );
+ aInfo.iMinAnimate = nOldAni;
+ SystemParametersInfo( SPI_SETANIMATION, 0, &aInfo, 0 );
+ }
+ else
+ ShowWindow( hWnd, SW_SHOWMINNOACTIVE );
+ ShowWindow( hWnd, SW_HIDE );
+ }
+ else
+ ShowWindow( hWnd, SW_HIDE );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Show( BOOL bVisible )
+{
+#ifdef WIN
+ // Send this Message to the window, because this only works
+ // in the thread of the window, which has create this window
+ ImplSendMessage( maFrameData.mhWnd, SAL_MSG_SHOW, bVisible, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Enable( BOOL bEnable )
+{
+#ifdef WIN
+ EnableWindow( maFrameData.mhWnd, bEnable );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetMinClientSize( long nWidth, long nHeight )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetClientSize( long nWidth, long nHeight )
+{
+#ifdef WIN
+ BOOL bVisible = (GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( !bVisible )
+ maFrameData.mnShowState = SW_SHOWNORMAL;
+ else
+ {
+ if ( IsIconic( maFrameData.mhWnd ) || IsZoomed( maFrameData.mhWnd ) )
+ ShowWindow( maFrameData.mhWnd, SW_RESTORE );
+ }
+
+ // Fenstergroesse berechnen
+ RECT aWinRect;
+ aWinRect.left = 0;
+ aWinRect.right = (int)nWidth-1;
+ aWinRect.top = 0;
+ aWinRect.bottom = (int)nHeight-1;
+ AdjustWindowRectEx( &aWinRect,
+ GetWindowStyle( maFrameData.mhWnd ),
+ FALSE,
+ GetWindowExStyle( maFrameData.mhWnd ) );
+ nWidth = aWinRect.right - aWinRect.left + 1;
+ nHeight = aWinRect.bottom - aWinRect.top + 1;
+
+ // Position so berechnen, das Fenster zentiert auf dem Desktop
+ // angezeigt wird
+ int nX;
+ int nY;
+ int nScreenX;
+ int nScreenY;
+ int nScreenWidth;
+ int nScreenHeight;
+
+ RECT aRect;
+ SystemParametersInfo( SPI_GETWORKAREA, 0, &aRect, 0 );
+ nScreenX = aRect.left;
+ nScreenY = aRect.top;
+ nScreenWidth = aRect.right-aRect.left;
+ nScreenHeight = aRect.bottom-aRect.top;
+
+ if ( maFrameData.mbDefPos )
+ {
+ nX = (nScreenWidth-nWidth)/2 + nScreenX;
+ nY = (nScreenHeight-nHeight)/2 + nScreenY;
+ if ( bVisible )
+ maFrameData.mbDefPos = FALSE;
+ }
+ else
+ {
+ RECT aWinRect;
+ GetWindowRect( maFrameData.mhWnd, &aWinRect );
+ nX = aWinRect.left;
+ nY = aWinRect.top;
+ if ( nX+nWidth > nScreenX+nScreenWidth )
+ nX = (nScreenX+nScreenWidth) - nWidth;
+ if ( nY+nHeight > nScreenY+nScreenHeight )
+ nY = (nScreenY+nScreenHeight) - nHeight;
+ if ( nX < nScreenX )
+ nX = nScreenX;
+ if ( nY < nScreenY )
+ nY = nScreenY;
+ }
+
+ SetWindowPos( maFrameData.mhWnd, 0, nX, nY, (int)nWidth, (int)nHeight, SWP_NOZORDER | SWP_NOACTIVATE );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::GetClientSize( long& rWidth, long& rHeight )
+{
+ rWidth = maFrameData.mnWidth;
+ rHeight = maFrameData.mnHeight;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetWindowState( const SalFrameState* pState )
+{
+#ifdef WIN
+ // Wir testen, ob das Fenster ueberhaupt auf den Bildschirm passt, damit
+ // nicht wenn die Bildschirm-Aufloesung geaendert wurde, das Fenster aus
+ // diesem herausragt
+ int nX;
+ int nY;
+ int nWidth;
+ int nHeight;
+ int nScreenX;
+ int nScreenY;
+ int nScreenWidth;
+ int nScreenHeight;
+
+ RECT aRect;
+ SystemParametersInfo( SPI_GETWORKAREA, 0, &aRect, 0 );
+ nScreenX = aRect.left;
+ nScreenY = aRect.top;
+ nScreenWidth = aRect.right-aRect.left;
+ nScreenHeight = aRect.bottom-aRect.top;
+
+ // Fenster-Position/Groesse in den Bildschirm einpassen
+ nX = (int)pState->mnX;
+ nY = (int)pState->mnY;
+ nWidth = (int)pState->mnWidth;
+ nHeight = (int)pState->mnHeight;
+ if ( nX < nScreenX )
+ nX = nScreenX;
+ if ( nY < nScreenY )
+ nY = nScreenY;
+ if ( nScreenWidth < nWidth )
+ nWidth = nScreenWidth;
+ if ( nScreenHeight < nHeight )
+ nHeight = nScreenHeight;
+
+ // Restore-Position setzen
+ WINDOWPLACEMENT aPlacement;
+ aPlacement.length = sizeof( aPlacement );
+ GetWindowPlacement( maFrameData.mhWnd, &aPlacement );
+
+ // Status setzen
+ BOOL bVisible = (GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( !bVisible )
+ {
+ aPlacement.showCmd = SW_HIDE;
+
+ if ( maFrameData.mbOverwriteState )
+ {
+ if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED )
+ maFrameData.mnShowState = SW_SHOWMINIMIZED;
+ else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED )
+ maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ else
+ maFrameData.mnShowState = SW_SHOWNORMAL;
+ }
+ }
+ else
+ {
+ if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED )
+ {
+ if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED )
+ aPlacement.flags |= WPF_RESTORETOMAXIMIZED;
+ aPlacement.showCmd = SW_SHOWMINIMIZED;
+ }
+ else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED )
+ aPlacement.showCmd = SW_SHOWMAXIMIZED;
+ else
+ aPlacement.showCmd = SW_RESTORE;
+ }
+
+ // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch
+ // umgesetzt werden muss, dann SetWindowPos() benutzen, da
+ // SetWindowPlacement() die TaskBar mit einrechnet
+ if ( !IsIconic( maFrameData.mhWnd ) && !IsZoomed( maFrameData.mhWnd ) &&
+ (!bVisible || (aPlacement.showCmd == SW_RESTORE)) )
+ {
+ SetWindowPos( maFrameData.mhWnd, 0,
+ nX, nY, nWidth, nHeight,
+ SWP_NOZORDER | SWP_NOACTIVATE );
+ }
+ else
+ {
+ aPlacement.rcNormalPosition.left = nX-nScreenX;
+ aPlacement.rcNormalPosition.top = nY-nScreenY;
+ aPlacement.rcNormalPosition.right = nX+nWidth-nScreenX;
+ aPlacement.rcNormalPosition.bottom = nY+nHeight-nScreenY;
+ SetWindowPlacement( maFrameData.mhWnd, &aPlacement );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalFrame::GetWindowState( SalFrameState* pState )
+{
+ if ( maFrameData.maState.mnWidth && maFrameData.maState.mnHeight )
+ {
+ *pState = maFrameData.maState;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ShowFullScreen( BOOL bFullScreen )
+{
+ if ( maFrameData.mbFullScreen == bFullScreen )
+ return;
+
+ maFrameData.mbFullScreen = bFullScreen;
+#ifdef WIN
+ if ( bFullScreen )
+ {
+ // Damit Taskleiste von Windows ausgeblendet wird
+ DWORD nExStyle = GetWindowExStyle( maFrameData.mhWnd );
+ if ( nExStyle & WS_EX_TOOLWINDOW )
+ {
+ maFrameData.mbFullScreenToolWin = TRUE;
+ nExStyle &= ~WS_EX_TOOLWINDOW;
+ SetWindowExStyle( maFrameData.mhWnd, nExStyle );
+ }
+
+ // save old position
+ GetWindowRect( maFrameData.mhWnd, &maFrameData.maFullScreenRect );
+
+ // save show state
+ maFrameData.mnFullScreenShowState = maFrameData.mnShowState;
+ if ( !(GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) )
+ maFrameData.mnShowState = SW_SHOW;
+
+ // set window to screen size
+ ImplSalFrameFullScreenPos( this, TRUE );
+ }
+ else
+ {
+ // wenn ShowState wieder hergestellt werden muss, hiden wir zuerst
+ // das Fenster, damit es nicht so sehr flackert
+ BOOL bVisible = (GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( bVisible && (maFrameData.mnShowState != maFrameData.mnFullScreenShowState) )
+ ShowWindow( maFrameData.mhWnd, SW_HIDE );
+
+ if ( maFrameData.mbFullScreenToolWin )
+ SetWindowExStyle( maFrameData.mhWnd, GetWindowExStyle( maFrameData.mhWnd ) | WS_EX_TOOLWINDOW );
+ maFrameData.mbFullScreenToolWin = FALSE;
+
+ SetWindowPos( maFrameData.mhWnd, 0,
+ maFrameData.maFullScreenRect.left,
+ maFrameData.maFullScreenRect.top,
+ maFrameData.maFullScreenRect.right-maFrameData.maFullScreenRect.left,
+ maFrameData.maFullScreenRect.bottom-maFrameData.maFullScreenRect.top,
+ SWP_NOZORDER | SWP_NOACTIVATE );
+
+ // restore show state
+ if ( maFrameData.mnShowState != maFrameData.mnFullScreenShowState )
+ {
+ maFrameData.mnShowState = maFrameData.mnFullScreenShowState;
+ if ( bVisible )
+ {
+ maFrameData.mbInShow = TRUE;
+ ShowWindow( maFrameData.mhWnd, maFrameData.mnShowState );
+ maFrameData.mbInShow = FALSE;
+ UpdateWindow( maFrameData.mhWnd );
+ }
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::StartPresentation( BOOL bStart )
+{
+#ifdef WIN
+ if ( maFrameData.mbPresentation == bStart )
+ return;
+
+ maFrameData.mbPresentation = bStart;
+
+ SalData* pSalData = GetSalData();
+ if ( bStart )
+ {
+ if ( !pSalData->mpSageEnableProc )
+ {
+ if ( pSalData->mnSageStatus != DISABLE_AGENT )
+ {
+ OFSTRUCT aOS;
+ OpenFile( "SAGE.DLL", &aOS, OF_EXIST );
+
+ if ( !aOS.nErrCode )
+ {
+ pSalData->mhSageInst = LoadLibrary( aOS.szPathName );
+ pSalData->mpSageEnableProc = (SysAgt_Enable_PROC)GetProcAddress( pSalData->mhSageInst, "System_Agent_Enable" );
+ }
+ else
+ pSalData->mnSageStatus = DISABLE_AGENT;
+ }
+ }
+
+ if ( pSalData->mpSageEnableProc )
+ {
+ pSalData->mnSageStatus = pSalData->mpSageEnableProc( GET_AGENT_STATUS );
+ if ( pSalData->mnSageStatus == ENABLE_AGENT )
+ pSalData->mpSageEnableProc( DISABLE_AGENT );
+ }
+
+ // Bildschirmschoner ausschalten, wenn Praesentation laueft
+ SystemParametersInfo( SPI_GETSCREENSAVEACTIVE, 0,
+ &(pSalData->mbScrSvrEnabled), 0 );
+ if ( pSalData->mbScrSvrEnabled )
+ SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0 );
+ }
+ else
+ {
+ // Bildschirmschoner wieder einschalten
+ if ( pSalData->mbScrSvrEnabled )
+ SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, pSalData->mbScrSvrEnabled, 0, 0 );
+
+ // Systemagenten wieder aktivieren
+ if ( pSalData->mnSageStatus == ENABLE_AGENT )
+ pSalData->mpSageEnableProc( pSalData->mnSageStatus );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetAlwaysOnTop( BOOL bOnTop )
+{
+#ifdef WIN
+ HWND hWnd;
+ if ( bOnTop )
+ hWnd = HWND_TOPMOST;
+ else
+ hWnd = HWND_NOTOPMOST;
+ SetWindowPos( maFrameData.mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalToTop( HWND hWnd, USHORT nFlags )
+{
+#ifdef WIN
+ if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK )
+ SetForegroundWindow( hWnd );
+ if ( !IsIconic( hWnd ) )
+ {
+ SetFocus( hWnd );
+
+ // Windows behauptet oefters mal, das man den Focus hat, obwohl
+ // man diesen nicht hat. Wenn dies der Fall ist, dann versuchen
+ // wir diesen auch ganz richtig zu bekommen.
+ if ( ::GetFocus() == hWnd )
+ SetForegroundWindow( hWnd );
+ }
+ else
+ {
+ if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
+ {
+ if ( GetWindowPtr( hWnd )->maFrameData.mbRestoreMaximize )
+ ShowWindow( hWnd, SW_MAXIMIZE );
+ else
+ ShowWindow( hWnd, SW_RESTORE );
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ToTop( USHORT nFlags )
+{
+#ifdef WIN
+ // Send this Message to the window, because SetFocus() only work
+ // in the thread of the window, which has create this window
+ ImplSendMessage( maFrameData.mhWnd, SAL_MSG_TOTOP, nFlags, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetPointer( PointerStyle ePointerStyle )
+{
+#ifdef WIN
+ struct ImplPtrData
+ {
+ HCURSOR mhCursor;
+ LPCSTR mnSysId;
+ UINT mnOwnId;
+ };
+
+ static ImplPtrData aImplPtrTab[POINTER_COUNT] =
+ {
+ { 0, IDC_ARROW, 0 }, // POINTER_ARROW
+ { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL
+ { 0, IDC_WAIT, 0 }, // POINTER_WAIT
+ { 0, IDC_IBEAM, 0 }, // POINTER_TEXT
+ { 0, 0, SAL_RESID_POINTER_HELP }, // POINTER_HELP
+ { 0, 0, SAL_RESID_POINTER_CROSS }, // POINTER_CROSS
+ { 0, 0, SAL_RESID_POINTER_MOVE }, // POINTER_MOVE
+ { 0, IDC_SIZENS, 0 }, // POINTER_NSIZE
+ { 0, IDC_SIZENS, 0 }, // POINTER_SSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_WSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_ESIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_NWSIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_NESIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_SWSIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_SESIZE
+ { 0, IDC_SIZENS, 0 }, // POINTER_WINDOW_NSIZE
+ { 0, IDC_SIZENS, 0 }, // POINTER_WINDOW_SSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE
+ { 0, 0, SAL_RESID_POINTER_HSPLIT }, // POINTER_HSPLIT
+ { 0, 0, SAL_RESID_POINTER_VSPLIT }, // POINTER_VSPLIT
+ { 0, 0, SAL_RESID_POINTER_HSIZEBAR }, // POINTER_HSIZEBAR
+ { 0, 0, SAL_RESID_POINTER_VSIZEBAR }, // POINTER_VSIZEBAR
+ { 0, 0, SAL_RESID_POINTER_HAND }, // POINTER_HAND
+ { 0, 0, SAL_RESID_POINTER_REFHAND }, // POINTER_REFHAND
+ { 0, 0, SAL_RESID_POINTER_PEN }, // POINTER_PEN
+ { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY
+ { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL
+ { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE
+ { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR
+ { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR
+ { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR
+ { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK
+ { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP
+ { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT
+ { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT
+ { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA
+ { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA
+ { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA
+ { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK
+ { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK
+ { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE
+ { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE
+ { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE
+ { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK
+ { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK
+ { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES
+ { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES
+ { 0, 0, SAL_RESID_POINTER_NOTALLOWED }, // POINTER_NOTALLOWED
+ { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE
+ { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT
+ { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON
+ { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER
+ { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC
+ { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE
+ { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT
+ { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE
+ { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND
+ { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT
+ { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT
+ { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION
+ { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART
+ { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE
+ { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL
+ { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW
+ { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD
+ { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN
+ { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED
+ { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE
+ { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE
+ { 0, 0, SAL_RESID_POINTER_AIRBRUSH } // POINTER_AIRBRUSH
+ };
+
+#if POINTER_COUNT != 86
+#error New Pointer must be defined!
+#endif
+
+ // Mousepointer loaded ?
+ if ( !aImplPtrTab[ePointerStyle].mhCursor )
+ {
+ if ( aImplPtrTab[ePointerStyle].mnOwnId )
+ aImplPtrTab[ePointerStyle].mhCursor = ImplLoadSalCursor( aImplPtrTab[ePointerStyle].mnOwnId );
+ else
+ aImplPtrTab[ePointerStyle].mhCursor = LoadCursor( 0, aImplPtrTab[ePointerStyle].mnSysId );
+ }
+
+ // Unterscheidet sich der Mauspointer, dann den neuen setzen
+ if ( maFrameData.mhCursor != aImplPtrTab[ePointerStyle].mhCursor )
+ {
+ maFrameData.mhCursor = aImplPtrTab[ePointerStyle].mhCursor;
+ SetCursor( maFrameData.mhCursor );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::CaptureMouse( BOOL bCapture )
+{
+#ifdef WIN
+ // Send this Message to the window, because CaptureMouse() only work
+ // in the thread of the window, which has create this window
+ int nMsg;
+ if ( bCapture )
+ nMsg = SAL_MSG_CAPTUREMOUSE;
+ else
+ nMsg = SAL_MSG_RELEASEMOUSE;
+ ImplSendMessage( maFrameData.mhWnd, nMsg, 0, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetPointerPos( long nX, long nY )
+{
+ POINT aPt;
+ aPt.x = (int)nX;
+ aPt.y = (int)nY;
+#ifdef WIN
+ ClientToScreen( maFrameData.mhWnd, &aPt );
+ SetCursorPos( aPt.x, aPt.y );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Flush()
+{
+#ifdef WIN
+ GdiFlush();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Sync()
+{
+#ifdef WIN
+ GdiFlush();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetInputContext( SalInputContext* pContext )
+{
+ BOOL bIME = pContext->mnOptions != 0;
+ if ( bIME == maFrameData.mbIME )
+ return;
+
+ maFrameData.mbIME = bIME;
+ if ( !bIME )
+ {
+#ifdef WIN
+ ImmAssociateContext( maFrameData.mhWnd, 0 );
+#endif
+ maFrameData.mbHandleIME = FALSE;
+ }
+ else
+ {
+ if ( maFrameData.mhDefIMEContext )
+ {
+#ifdef WIN
+ ImmAssociateContext( maFrameData.mhWnd, maFrameData.mhDefIMEContext );
+ UINT nImeProps = ImmGetProperty( GetKeyboardLayout( 0 ), IGP_PROPERTY );
+ maFrameData.mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0;
+ maFrameData.mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0;
+ maFrameData.mbHandleIME = !maFrameData.mbSpezIME;
+#endif
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::UpdateExtTextInputArea()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::EndExtTextInput( USHORT nFlags )
+{
+#ifdef WIN
+ HWND hWnd = maFrameData.mhWnd;
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ DWORD nIndex;
+ if ( nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE )
+ nIndex = CPS_COMPLETE;
+ else
+ nIndex = CPS_CANCEL;
+
+ ImmNotifyIME( hIMC, NI_COMPOSITIONSTR, nIndex, 0 );
+ ImmReleaseContext( hWnd, hIMC );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf,
+ UINT& rCount, UINT nMaxSize,
+ const sal_Char* pReplace )
+{
+#ifdef WIN
+ DBG_ASSERT( sizeof( wchar_t ) == sizeof( xub_Unicode ), "SalFrame::ImplGetKeyNameTextW(): wchar_t != sal_Unicode" );
+
+ wchar_t aKeyBuf[350];
+ int nKeyLen = 0;
+ if ( lParam )
+ {
+ nKeyLen = GetKeyNameTextW( lParam, aKeyBuf, sizeof( aKeyBuf ) / sizeof( sal_Unicode ) );
+ if ( nKeyLen > 0 )
+ {
+ // Convert name, so that the keyname start with an upper
+ // char and the rest of the word are in lower chars
+ CharLowerBuffW( aKeyBuf, nKeyLen );
+ CharUpperBuffW( aKeyBuf, 1 );
+ wchar_t cTempChar;
+ wchar_t* pKeyBuf = aKeyBuf;
+ while ( (cTempChar = *pKeyBuf) != 0 )
+ {
+ if ( (cTempChar == '+') || (cTempChar == '-') ||
+ (cTempChar == ' ') || (cTempChar == '.') )
+ CharUpperBuffW( pKeyBuf+1, 1 );
+ pKeyBuf++;
+ }
+ }
+ else
+ {
+ sal_Char aAnsiKeyBuf[250];
+ int nAnsiKeyLen = GetKeyNameTextA( lParam, aAnsiKeyBuf, sizeof( aAnsiKeyBuf ) / sizeof( sal_Char ) );
+ if ( nAnsiKeyLen )
+ {
+ // Convert name, so that the keyname start with an upper
+ // char and the rest of the word are in lower chars
+ CharLowerBuffA( aAnsiKeyBuf, nAnsiKeyLen );
+ CharUpperBuffA( aAnsiKeyBuf, 1 );
+ sal_Char cTempChar;
+ sal_Char* pAnsiKeyBuf = aAnsiKeyBuf;
+ while ( (cTempChar = *pAnsiKeyBuf) != 0 )
+ {
+ if ( (cTempChar == '+') || (cTempChar == '-') ||
+ (cTempChar == ' ') || (cTempChar == '.') )
+ CharUpperBuffA( pAnsiKeyBuf+1, 1 );
+ pAnsiKeyBuf++;
+ }
+
+ // Convert to Unicode and copy the data in the Unicode Buffer
+ nKeyLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, aAnsiKeyBuf, nAnsiKeyLen, aKeyBuf, sizeof( aKeyBuf ) / sizeof( sal_Unicode ) );
+ }
+ }
+ }
+
+ if ( (nKeyLen > 0) || pReplace )
+ {
+ if ( rCount )
+ {
+ pBuf[rCount] = '+';
+ rCount++;
+ }
+
+ if ( nKeyLen )
+ {
+ memcpy( pBuf+rCount, aKeyBuf, nKeyLen*sizeof( sal_Unicode ) );
+ rCount += nKeyLen;
+ }
+ else
+ {
+ while ( *pReplace )
+ {
+ pBuf[rCount] = *pReplace;
+ rCount++;
+ pReplace++;
+ }
+ }
+ }
+ else
+ rCount = 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalFrame::GetKeyName( USHORT nKeyCode )
+{
+ XubString aKeyCode;
+#ifdef WIN
+ sal_Unicode aKeyBuf[350];
+ UINT nKeyBufLen = 0;
+ UINT nSysCode;
+
+ if ( nKeyCode & KEY_MOD2 )
+ {
+ nSysCode = MapVirtualKey( VK_MENU, 0 );
+ nSysCode = (nSysCode << 16) | (((ULONG)1) << 25);
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ "Alt" );
+ }
+
+ if ( nKeyCode & KEY_MOD1 )
+ {
+ nSysCode = MapVirtualKey( VK_CONTROL, 0 );
+ nSysCode = (nSysCode << 16) | (((ULONG)1) << 25);
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ "Ctrl" );
+ }
+
+ if ( nKeyCode & KEY_SHIFT )
+ {
+ nSysCode = MapVirtualKey( VK_SHIFT, 0 );
+ nSysCode = (nSysCode << 16) | (((ULONG)1) << 25);
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ "Shift" );
+ }
+
+ USHORT nCode = nKeyCode & 0x0FFF;
+ ULONG nSysCode2 = 0;
+ sal_Char* pReplace = NULL;
+ sal_Unicode cSVCode = 0;
+ sal_Char aFBuf[4];
+ nSysCode = 0;
+
+ if ( (nCode >= KEY_0) && (nCode <= KEY_9) )
+ cSVCode = '0' + (nCode - KEY_0);
+ else if ( (nCode >= KEY_A) && (nCode <= KEY_Z) )
+ cSVCode = 'A' + (nCode - KEY_A);
+ else if ( (nCode >= KEY_F1) && (nCode <= KEY_F26) )
+ {
+ nSysCode = VK_F1 + (nCode - KEY_F1);
+ aFBuf[0] = 'F';
+ if ( (nCode >= KEY_F1) && (nCode <= KEY_F9) )
+ {
+ aFBuf[1] = '1' + (nCode - KEY_F1);
+ aFBuf[2] = 0;
+ }
+ else if ( (nCode >= KEY_F10) && (nCode <= KEY_F19) )
+ {
+ aFBuf[1] = '1';
+ aFBuf[2] = '0' + (nCode - KEY_F10);
+ aFBuf[3] = 0;
+ }
+ else
+ {
+ aFBuf[1] = '2';
+ aFBuf[2] = '0' + (nCode - KEY_F20);
+ aFBuf[3] = 0;
+ }
+ pReplace = aFBuf;
+ }
+ else
+ {
+ switch ( nCode )
+ {
+ case KEY_DOWN:
+ nSysCode = VK_DOWN;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Down";
+ break;
+ case KEY_UP:
+ nSysCode = VK_UP;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Up";
+ break;
+ case KEY_LEFT:
+ nSysCode = VK_LEFT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Left";
+ break;
+ case KEY_RIGHT:
+ nSysCode = VK_RIGHT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Right";
+ break;
+ case KEY_HOME:
+ nSysCode = VK_HOME;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Home";
+ break;
+ case KEY_END:
+ nSysCode = VK_END;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "End";
+ break;
+ case KEY_PAGEUP:
+ nSysCode = VK_PRIOR;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Page Up";
+ break;
+ case KEY_PAGEDOWN:
+ nSysCode = VK_NEXT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Page Down";
+ break;
+ case KEY_RETURN:
+ nSysCode = VK_RETURN;
+ pReplace = "Enter";
+ break;
+ case KEY_ESCAPE:
+ nSysCode = VK_ESCAPE;
+ pReplace = "Escape";
+ break;
+ case KEY_TAB:
+ nSysCode = VK_TAB;
+ pReplace = "Tab";
+ break;
+ case KEY_BACKSPACE:
+ nSysCode = VK_BACK;
+ pReplace = "Backspace";
+ break;
+ case KEY_SPACE:
+ nSysCode = VK_SPACE;
+ pReplace = "Space";
+ break;
+ case KEY_INSERT:
+ nSysCode = VK_INSERT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Insert";
+ break;
+ case KEY_DELETE:
+ nSysCode = VK_DELETE;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Delete";
+ break;
+
+ case KEY_ADD:
+ cSVCode = '+';
+ break;
+ case KEY_SUBTRACT:
+ cSVCode = '-';
+ break;
+ case KEY_MULTIPLY:
+ cSVCode = '*';
+ break;
+ case KEY_DIVIDE:
+ cSVCode = '/';
+ break;
+ case KEY_POINT:
+ cSVCode = '.';
+ break;
+ case KEY_COMMA:
+ cSVCode = ',';
+ break;
+ case KEY_LESS:
+ cSVCode = '<';
+ break;
+ case KEY_GREATER:
+ cSVCode = '>';
+ break;
+ case KEY_EQUAL:
+ cSVCode = '=';
+ break;
+ }
+ }
+
+ if ( nSysCode )
+ {
+ nSysCode = MapVirtualKey( (UINT)nSysCode, 0 );
+ if ( nSysCode )
+ nSysCode = (nSysCode << 16) | nSysCode2;
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ pReplace );
+ }
+ else
+ {
+ if ( cSVCode )
+ {
+ if ( !nKeyBufLen )
+ {
+ aKeyBuf[0] = cSVCode;
+ nKeyBufLen = 1;
+ }
+ else
+ {
+ aKeyBuf[nKeyBufLen] = '+';
+ nKeyBufLen++;
+ aKeyBuf[nKeyBufLen] = cSVCode;
+ nKeyBufLen++;
+ }
+ }
+ }
+
+ if ( nKeyBufLen )
+ aKeyCode.Assign( (const sal_Unicode*)aKeyBuf, nKeyBufLen );
+#endif
+
+ return aKeyCode;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode )
+{
+ return GetKeyName( nKeyCode );
+}
+
+// -----------------------------------------------------------------------
+
+inline Color ImplWinColorToSal( COLORREF nColor )
+{
+#ifdef WIN
+ return Color( GetRValue( nColor ), GetGValue( nColor ), GetBValue( nColor ) );
+#else
+ return NULL;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+static void ImplSalUpdateStyleFontA( const LOGFONTA& rLogFont, Font& rFont,
+ BOOL bOverwriteSystemCharSet )
+{
+ ImplSalLogFontToFontA( rLogFont, rFont );
+ if ( bOverwriteSystemCharSet && (rFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL) )
+ rFont.SetCharSet( gsl_getSystemTextEncoding() );
+ // Da bei einigen Windows-Einstellungen 6 Punkt eingetragen ist,
+ // obwohl im Dialog 8 Punkt angezeigt werden (da MS Sans Serif
+ // nicht skalierbar ist) vergroessern wir hier das als Hack, da
+ // ansonsten in russisch Symbolunterschriften nicht lesbar sind
+ if ( (rFont.GetName().EqualsIgnoreCaseAscii( "MS Sans Serif" ) ) &&
+ (rFont.GetHeight() < 8) )
+ rFont.SetHeight( 8 );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+static void ImplSalUpdateStyleFontW( const LOGFONTW& rLogFont, Font& rFont,
+ BOOL bOverwriteSystemCharSet )
+{
+ ImplSalLogFontToFontW( rLogFont, rFont );
+ if ( bOverwriteSystemCharSet && (rFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL) )
+ rFont.SetCharSet( gsl_getSystemTextEncoding() );
+ // Da bei einigen Windows-Einstellungen 6 Punkt eingetragen ist,
+ // obwohl im Dialog 8 Punkt angezeigt werden (da MS Sans Serif
+ // nicht skalierbar ist) vergroessern wir hier das als Hack, da
+ // ansonsten in russisch Symbolunterschriften nicht lesbar sind
+ if ( (rFont.GetName().EqualsIgnoreCaseAscii( "MS Sans Serif" ) ) &&
+ (rFont.GetHeight() < 8) )
+ rFont.SetHeight( 8 );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+static long ImplA2I( const BYTE* pStr )
+{
+ long n = 0;
+ int nSign = 1;
+
+ if ( *pStr == '-' )
+ {
+ nSign = -1;
+ pStr++;
+ }
+
+ while( (*pStr >= 48) && (*pStr <= 57) )
+ {
+ n *= 10;
+ n += ((*pStr) - 48);
+ pStr++;
+ }
+
+ n *= nSign;
+
+ return n;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::UpdateSettings( AllSettings& rSettings )
+{
+#ifdef WIN
+ MouseSettings aMouseSettings = rSettings.GetMouseSettings();
+ aMouseSettings.SetDoubleClickTime( GetDoubleClickTime() );
+ aMouseSettings.SetDoubleClickWidth( GetSystemMetrics( SM_CXDOUBLECLK ) );
+ aMouseSettings.SetDoubleClickHeight( GetSystemMetrics( SM_CYDOUBLECLK ) );
+ long nDragWidth = GetSystemMetrics( SM_CXDRAG );
+ long nDragHeight = GetSystemMetrics( SM_CYDRAG );
+ if ( nDragWidth )
+ aMouseSettings.SetStartDragWidth( nDragWidth );
+ if ( nDragHeight )
+ aMouseSettings.SetStartDragHeight( nDragHeight );
+ HKEY hRegKey;
+ if ( RegOpenKey( HKEY_CURRENT_USER,
+ "Control Panel\\Desktop",
+ &hRegKey ) == ERROR_SUCCESS )
+ {
+ BYTE aValueBuf[10];
+ DWORD nValueSize = sizeof( aValueBuf );
+ DWORD nType;
+ if ( RegQueryValueEx( hRegKey, "MenuShowDelay", 0,
+ &nType, aValueBuf, &nValueSize ) == ERROR_SUCCESS )
+ {
+ if ( nType == REG_SZ )
+ aMouseSettings.SetMenuDelay( (ULONG)ImplA2I( aValueBuf ) );
+ }
+
+ RegCloseKey( hRegKey );
+ }
+
+ StyleSettings aStyleSettings = rSettings.GetStyleSettings();
+ BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0;
+ aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) );
+ aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) );
+ aStyleSettings.SetCursorBlinkTime( GetCaretBlinkTime() );
+ if ( bCompBorder )
+ {
+ aStyleSettings.SetFloatTitleHeight( GetSystemMetrics( SM_CYSMCAPTION ) );
+ aStyleSettings.SetTitleHeight( GetSystemMetrics( SM_CYCAPTION ) );
+ aStyleSettings.SetActiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVEBORDER ) ) );
+ aStyleSettings.SetDeactiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVEBORDER ) ) );
+ if ( aSalShlData.mnVersion >= 410 )
+ {
+ aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) );
+ aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) );
+ }
+ aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( COLOR_3DFACE ) ) );
+ aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( COLOR_3DHILIGHT ) ) );
+ aStyleSettings.SetLightBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DLIGHT ) ) );
+ aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) );
+ aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DDKSHADOW ) ) );
+ }
+ aStyleSettings.SetHelpColor( ImplWinColorToSal( GetSysColor( COLOR_INFOBK ) ) );
+ aStyleSettings.SetHelpTextColor( ImplWinColorToSal( GetSysColor( COLOR_INFOTEXT ) ) );
+ aStyleSettings.SetDialogColor( aStyleSettings.GetFaceColor() );
+ aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() );
+ aStyleSettings.SetButtonTextColor( ImplWinColorToSal( GetSysColor( COLOR_BTNTEXT ) ) );
+ aStyleSettings.SetRadioCheckTextColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOWTEXT ) ) );
+ aStyleSettings.SetGroupTextColor( aStyleSettings.GetRadioCheckTextColor() );
+ aStyleSettings.SetLabelTextColor( aStyleSettings.GetRadioCheckTextColor() );
+ aStyleSettings.SetInfoTextColor( aStyleSettings.GetRadioCheckTextColor() );
+ aStyleSettings.SetWindowColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOW ) ) );
+ aStyleSettings.SetWindowTextColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOWTEXT ) ) );
+ aStyleSettings.SetFieldColor( aStyleSettings.GetWindowColor() );
+ aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() );
+ aStyleSettings.SetHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHT ) ) );
+ aStyleSettings.SetHighlightTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) );
+ aStyleSettings.SetMenuHighlightColor( aStyleSettings.GetHighlightColor() );
+ aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetHighlightTextColor() );
+ if ( bCompBorder )
+ {
+ aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) );
+ aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) );
+ aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) );
+ aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) );
+ aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) );
+ aStyleSettings.SetDeactiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ) );
+ }
+ // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht
+ if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY )
+ aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
+ else
+ {
+ // Checked-Color berechnen
+ Color aColor1 = aStyleSettings.GetFaceColor();
+ Color aColor2 = aStyleSettings.GetLightColor();
+ BYTE nRed = (BYTE)(((USHORT)aColor1.GetRed() + (USHORT)aColor2.GetRed())/2);
+ BYTE nGreen = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2);
+ BYTE nBlue = (BYTE)(((USHORT)aColor1.GetBlue() + (USHORT)aColor2.GetBlue())/2);
+ aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) );
+ }
+
+ // Query Fonts
+ int bOverwriteSystemCharSet = getenv("LC_CHARSET") != 0;
+ Font aMenuFont = aStyleSettings.GetMenuFont();
+ Font aTitleFont = aStyleSettings.GetTitleFont();
+ Font aFloatTitleFont = aStyleSettings.GetFloatTitleFont();
+ Font aHelpFont = aStyleSettings.GetHelpFont();
+ Font aAppFont = aStyleSettings.GetAppFont();
+ Font aIconFont = aStyleSettings.GetIconFont();
+ if ( aSalShlData.mbWNT )
+ {
+ NONCLIENTMETRICSW aNonClientMetrics;
+ aNonClientMetrics.cbSize = sizeof( aNonClientMetrics );
+ if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) )
+ {
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfMenuFont, aMenuFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfCaptionFont, aTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfStatusFont, aHelpFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfMessageFont, aAppFont, bOverwriteSystemCharSet );
+
+ LOGFONTW aLogFont;
+ if ( SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) )
+ ImplSalUpdateStyleFontW( aLogFont, aIconFont, bOverwriteSystemCharSet );
+ }
+ }
+ else
+ {
+ NONCLIENTMETRICSA aNonClientMetrics;
+ aNonClientMetrics.cbSize = sizeof( aNonClientMetrics );
+ if ( SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) )
+ {
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfMenuFont, aMenuFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfCaptionFont, aTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfStatusFont, aHelpFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfMessageFont, aAppFont, bOverwriteSystemCharSet );
+
+ LOGFONTA aLogFont;
+ if ( SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) )
+ ImplSalUpdateStyleFontA( aLogFont, aIconFont, bOverwriteSystemCharSet );
+ }
+ }
+ aStyleSettings.SetMenuFont( aMenuFont );
+ aStyleSettings.SetTitleFont( aTitleFont );
+ aStyleSettings.SetFloatTitleFont( aFloatTitleFont );
+ aStyleSettings.SetHelpFont( aHelpFont );
+ aStyleSettings.SetIconFont( aIconFont );
+ // We prefer Arial in the russian version, because MS Sans Serif
+ // is to wide for the dialogs
+ if ( rSettings.GetInternational().GetLanguage() == LANGUAGE_RUSSIAN )
+ {
+ XubString aFontName = aAppFont.GetName();
+ XubString aFirstName = aFontName.GetToken( 0, ';' );
+ if ( aFirstName.EqualsIgnoreCaseAscii( "MS Sans Serif" ) )
+ {
+ aFontName.InsertAscii( "Arial;", 0 );
+ aAppFont.SetName( aFontName );
+ }
+ }
+ aStyleSettings.SetAppFont( aAppFont );
+ aStyleSettings.SetGroupFont( aAppFont );
+ aStyleSettings.SetLabelFont( aAppFont );
+ aStyleSettings.SetRadioCheckFont( aAppFont );
+ aStyleSettings.SetPushButtonFont( aAppFont );
+ aStyleSettings.SetFieldFont( aAppFont );
+ if ( aAppFont.GetWeight() > WEIGHT_NORMAL )
+ aAppFont.SetWeight( WEIGHT_NORMAL );
+ aStyleSettings.SetInfoFont( aAppFont );
+ aStyleSettings.SetToolFont( aAppFont );
+
+ WIN_BOOL bDragFull;
+ if ( SystemParametersInfo( SPI_GETDRAGFULLWINDOWS, 0, &bDragFull, 0 ) )
+ {
+ ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions();
+ if ( bDragFull )
+ nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT;
+ else
+ nDragFullOptions &= ~(DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT);
+ aStyleSettings.SetDragFullOptions( nDragFullOptions );
+ }
+
+ aStyleSettings.SetIconHorzSpace( GetSystemMetrics( SM_CXICONSPACING ) );
+ aStyleSettings.SetIconVertSpace( GetSystemMetrics( SM_CYICONSPACING ) );
+ if ( RegOpenKey( HKEY_CURRENT_USER,
+ "Control Panel\\International\\Calendars\\TwoDigitYearMax",
+ &hRegKey ) == ERROR_SUCCESS )
+ {
+ BYTE aValueBuf[10];
+ DWORD nValue;
+ DWORD nValueSize = sizeof( aValueBuf );
+ DWORD nType;
+ if ( RegQueryValueEx( hRegKey, "1", 0,
+ &nType, aValueBuf, &nValueSize ) == ERROR_SUCCESS )
+ {
+ if ( nType == REG_SZ )
+ {
+ nValue = (ULONG)ImplA2I( aValueBuf );
+ if ( (nValue > 1000) && (nValue < 10000) )
+ {
+ MiscSettings aMiscSettings = rSettings.GetMiscSettings();
+ aMiscSettings.SetTwoDigitYearStart( (USHORT)(nValue-99) );
+ rSettings.SetMiscSettings( aMiscSettings );
+ }
+ }
+ }
+
+ RegCloseKey( hRegKey );
+ }
+
+ rSettings.SetMouseSettings( aMouseSettings );
+ rSettings.SetStyleSettings( aStyleSettings );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+const SystemEnvData* SalFrame::GetSystemData() const
+{
+ return &maFrameData.maSysData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Beep( SoundType eSoundType )
+{
+#ifdef WIN
+ static UINT aImplSoundTab[5] =
+ {
+ 0, // SOUND_DEFAULT
+ MB_ICONASTERISK, // SOUND_INFO
+ MB_ICONEXCLAMATION, // SOUND_WARNING
+ MB_ICONHAND, // SOUND_ERROR
+ MB_ICONQUESTION // SOUND_QUERY
+ };
+
+#if SOUND_COUNT != 5
+#error New Sound must be defined!
+#endif
+
+ MessageBeep( aImplSoundTab[eSoundType] );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetCallback( void* pInst, SALFRAMEPROC pProc )
+{
+ maFrameData.mpInst = pInst;
+ if ( pProc )
+ maFrameData.mpProc = pProc;
+ else
+ maFrameData.mpProc = ImplSalCallbackDummy;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ SalMouseEvent aMouseEvt;
+ long nRet;
+#ifdef WIN
+ USHORT nEvent;
+ BOOL bCall = TRUE;
+
+ aMouseEvt.mnX = (short)LOWORD( lParam );
+ aMouseEvt.mnY = (short)HIWORD( lParam );
+ aMouseEvt.mnCode = 0;
+ aMouseEvt.mnTime = GetMessageTime();
+
+ // Wegen (Logitech-)MouseTreiber ueber GetKeyState() gehen, die auf
+ // mittlerer Maustaste Doppelklick simulieren und den KeyStatus nicht
+ // beruecksichtigen
+
+ if ( GetKeyState( VK_LBUTTON ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_LEFT;
+ if ( GetKeyState( VK_MBUTTON ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_MIDDLE;
+ if ( GetKeyState( VK_RBUTTON ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_RIGHT;
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_MOD2;
+
+ switch ( nMsg )
+ {
+ case WM_MOUSEMOVE:
+ {
+ // Da bei Druecken von Modifier-Tasten die MouseEvents
+ // nicht zusammengefast werden (da diese durch KeyEvents
+ // unterbrochen werden), machen wir dieses hier selber
+ if ( aMouseEvt.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) )
+ {
+ MSG aTempMsg;
+ if ( ImplPeekMessage( &aTempMsg, hWnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE | PM_NOYIELD ) )
+ {
+ if ( (aTempMsg.message == WM_MOUSEMOVE) &&
+ (aTempMsg.wParam == wParam) )
+ return 1;
+ }
+ }
+
+ SalData* pSalData = GetSalData();
+ // Test for MouseLeave
+ if ( pSalData->mhWantLeaveMsg && (pSalData->mhWantLeaveMsg != hWnd) )
+ ImplSendMessage( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, GetMessagePos() );
+ pSalData->mhWantLeaveMsg = hWnd;
+ // Start MouseLeave-Timer
+ if ( !pSalData->mpMouseLeaveTimer )
+ {
+ pSalData->mpMouseLeaveTimer = new AutoTimer;
+ pSalData->mpMouseLeaveTimer->SetTimeout( SAL_MOUSELEAVE_TIMEOUT );
+ pSalData->mpMouseLeaveTimer->Start();
+ // We dont need to set a timeout handler, because we test
+ // for mouseleave in the timeout callback
+ }
+ aMouseEvt.mnButton = 0;
+ nEvent = SALEVENT_MOUSEMOVE;
+ }
+ break;
+
+ case WM_NCMOUSEMOVE:
+ case SAL_MSG_MOUSELEAVE:
+ {
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mhWantLeaveMsg == hWnd )
+ {
+ pSalData->mhWantLeaveMsg = 0;
+ if ( pSalData->mpMouseLeaveTimer )
+ {
+ delete pSalData->mpMouseLeaveTimer;
+ pSalData->mpMouseLeaveTimer = NULL;
+ }
+ // Mouse-Coordinaates are relativ to the screen
+ POINT aPt;
+ aPt.x = (short)LOWORD( lParam );
+ aPt.y = (short)HIWORD( lParam );
+ ScreenToClient( hWnd, &aPt );
+ aMouseEvt.mnX = aPt.x;
+ aMouseEvt.mnY = aPt.y;
+ aMouseEvt.mnButton = 0;
+ nEvent = SALEVENT_MOUSELEAVE;
+ }
+ else
+ bCall = FALSE;
+ }
+ break;
+
+ case WM_LBUTTONDOWN:
+ aMouseEvt.mnButton = MOUSE_LEFT;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ break;
+
+ case WM_MBUTTONDOWN:
+ aMouseEvt.mnButton = MOUSE_MIDDLE;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ break;
+
+ case WM_RBUTTONDOWN:
+ aMouseEvt.mnButton = MOUSE_RIGHT;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ break;
+
+ case WM_LBUTTONUP:
+ aMouseEvt.mnButton = MOUSE_LEFT;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+
+ case WM_MBUTTONUP:
+ aMouseEvt.mnButton = MOUSE_MIDDLE;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+
+ case WM_RBUTTONUP:
+ aMouseEvt.mnButton = MOUSE_RIGHT;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+ }
+
+ if ( bCall )
+ {
+ if ( nEvent == SALEVENT_MOUSEBUTTONDOWN )
+ UpdateWindow( hWnd );
+
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nEvent, &aMouseEvt );
+ if ( nMsg == WM_MOUSEMOVE )
+ SetCursor( pFrame->maFrameData.mhCursor );
+ }
+ else
+ nRet = 0;
+
+ return nRet;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleMouseActivateMsg( HWND hWnd )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ SalMouseActivateEvent aMouseActivateEvt;
+ POINT aPt;
+#ifdef WIN
+ GetCursorPos( &aPt );
+ ScreenToClient( hWnd, &aPt );
+#endif
+ aMouseActivateEvt.mnX = aPt.x;
+ aMouseActivateEvt.mnY = aPt.y;
+ return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_MOUSEACTIVATE, &aMouseActivateEvt );
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleWheelMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ ImplSalYieldMutexAcquireWithWait();
+
+ long nRet = 0;
+#ifdef WIN
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ WORD nWinModCode = LOWORD( wParam );
+ POINT aWinPt;
+ aWinPt.x = (short)LOWORD( lParam );
+ aWinPt.y = (short)HIWORD( lParam );
+ ScreenToClient( hWnd, &aWinPt );
+
+ SalWheelMouseEvent aWheelEvt;
+ aWheelEvt.mnTime = GetMessageTime();
+ aWheelEvt.mnX = aWinPt.x;
+ aWheelEvt.mnY = aWinPt.y;
+ aWheelEvt.mnCode = 0;
+ aWheelEvt.mnDelta = (short)HIWORD( wParam );
+ aWheelEvt.mnNotchDelta = aWheelEvt.mnDelta/WHEEL_DELTA;
+ if ( aSalShlData.mnWheelScrollLines == WHEEL_PAGESCROLL )
+ aWheelEvt.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
+ else
+ aWheelEvt.mnScrollLines = aSalShlData.mnWheelScrollLines;
+ aWheelEvt.mbHorz = FALSE;
+
+ if ( nWinModCode & MK_SHIFT )
+ aWheelEvt.mnCode |= KEY_SHIFT;
+ if ( nWinModCode & MK_CONTROL )
+ aWheelEvt.mnCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ aWheelEvt.mnCode |= KEY_MOD2;
+
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_WHEELMOUSE, &aWheelEvt );
+ }
+
+ ImplSalYieldMutexRelease();
+#endif
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplSalGetKeyCode( WPARAM wParam )
+{
+ USHORT nKeyCode;
+
+ // convert KeyCode
+ if ( wParam < KEY_TAB_SIZE )
+ nKeyCode = aImplTranslateKeyTab[wParam];
+ else if ( wParam == aSalShlData.mnVKAdd )
+ nKeyCode = KEY_ADD;
+ else if ( wParam == aSalShlData.mnVKSubtract )
+ nKeyCode = KEY_SUBTRACT;
+ else if ( wParam == aSalShlData.mnVKMultiply )
+ nKeyCode = KEY_MULTIPLY;
+ else if ( wParam == aSalShlData.mnVKDivide )
+ nKeyCode = KEY_DIVIDE;
+ else if ( wParam == aSalShlData.mnVKPoint )
+ nKeyCode = KEY_POINT;
+ else if ( wParam == aSalShlData.mnVKComma )
+ nKeyCode = KEY_COMMA;
+ else if ( wParam == aSalShlData.mnVKLess )
+ nKeyCode = KEY_LESS;
+ else if ( wParam == aSalShlData.mnVKGreater )
+ nKeyCode = KEY_GREATER;
+ else if ( wParam == aSalShlData.mnVKEqual )
+ nKeyCode = KEY_EQUAL;
+ else
+ nKeyCode = 0;
+
+ return nKeyCode;
+}
+
+// -----------------------------------------------------------------------
+
+static UINT ImplStrToNum( const sal_Char* pStr )
+{
+ USHORT n = 0;
+
+ // Solange es sich um eine Ziffer handelt, String umwandeln
+ while( (*pStr >= 48) && (*pStr <= 57) )
+ {
+ n *= 10;
+ n += ((*pStr) - 48);
+ pStr++;
+ }
+
+ return n;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Unicode ImplGetCharCode( SalFrame* pFrame, WPARAM nCharCode )
+{
+#ifdef WIN
+ UINT nLang = LOWORD( GetKeyboardLayout( 0 ) );
+ if ( !nLang )
+ {
+ pFrame->maFrameData.mnInputLang = 0;
+ pFrame->maFrameData.mnInputCodePage = GetACP();
+ }
+ else if ( nLang != pFrame->maFrameData.mnInputLang )
+ {
+ pFrame->maFrameData.mnInputLang = nLang;
+ sal_Char aBuf[10];
+ if ( GetLocaleInfoA( MAKELCID( nLang, SORT_DEFAULT ), LOCALE_IDEFAULTANSICODEPAGE,
+ aBuf, sizeof(aBuf) ) > 0 )
+ {
+ pFrame->maFrameData.mnInputCodePage = ImplStrToNum( aBuf );
+ if ( !pFrame->maFrameData.mnInputCodePage )
+ pFrame->maFrameData.mnInputCodePage = GetACP();
+ }
+ else
+ pFrame->maFrameData.mnInputCodePage = GetACP();
+ }
+
+ sal_Char aCharBuf[2];
+ int nCharLen;
+ wchar_t c;
+ if ( nCharCode > 0xFF )
+ {
+ aCharBuf[0] = (sal_Char)(nCharCode>>8);
+ aCharBuf[1] = (sal_Char)nCharCode;
+ nCharLen = 2;
+ }
+ else
+ {
+ aCharBuf[0] = (sal_Char)nCharCode;
+ nCharLen = 1;
+ }
+ if ( ::MultiByteToWideChar( pFrame->maFrameData.mnInputCodePage,
+ MB_PRECOMPOSED,
+ aCharBuf, nCharLen, &c, 1 ) )
+ return (sal_Unicode)c;
+ else
+#endif
+ return (sal_Unicode)nCharCode;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+#ifdef WIN
+ static BOOL bIgnoreCharMsg = FALSE;
+ static WPARAM nDeadChar = 0;
+ static WPARAM nLastVKChar = 0;
+ static USHORT nLastChar = 0;
+ USHORT nRepeat = LOWORD( lParam )-1;
+ USHORT nModCode = 0;
+
+ // Key wurde evtl. durch SysChild an uns weitergeleitet und
+ // darf somit dann nicht doppelt verarbeitet werden
+ GetSalData()->mnSalObjWantKeyEvt = 0;
+
+ if ( nMsg == WM_DEADCHAR )
+ {
+ nDeadChar = wParam;
+ return 0;
+ }
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ // Wir restaurieren den Background-Modus bei jeder Texteingabe,
+ // da einige Tools wie RichWin uns diesen hin- und wieder umsetzen
+ if ( pFrame->maFrameData.mpGraphics &&
+ pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC )
+ SetBkMode( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC, TRANSPARENT );
+
+ // determine modifiers
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ {
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) &&
+ ((nMsg == WM_SYSKEYDOWN) || (nMsg == WM_SYSKEYUP)) )
+ nModCode |= KEY_CONTROLMOD;
+ }
+
+ if ( (nMsg == WM_CHAR) || (nMsg == WM_SYSCHAR) )
+ {
+ nDeadChar = 0;
+
+ if ( bIgnoreCharMsg )
+ {
+ bIgnoreCharMsg = FALSE;
+ return 0;
+ }
+
+ // Backspace ignorieren wir als eigenstaendige Taste,
+ // damit wir keine Probleme in Kombination mit einem
+ // DeadKey bekommen
+ if ( wParam == 0x08 ) // BACKSPACE
+ return 0;
+
+ // Hier kommen nur "freifliegende" WM_CHAR Message an, die durch
+ // eintippen einer ALT-NUMPAD Kombination erzeugt wurden
+ SalKeyEvent aKeyEvt;
+
+ if ( (wParam >= '0') && (wParam <= '9') )
+ aKeyEvt.mnCode = KEYGROUP_NUM + wParam - '0';
+ else if ( (wParam >= 'A') && (wParam <= 'Z') )
+ aKeyEvt.mnCode = KEYGROUP_ALPHA + wParam - 'A';
+ else if ( (wParam >= 'a') && (wParam <= 'z') )
+ aKeyEvt.mnCode = KEYGROUP_ALPHA + wParam - 'a';
+ else if ( wParam == 0x0D ) // RETURN
+ aKeyEvt.mnCode = KEY_RETURN;
+ else if ( wParam == 0x1B ) // ESCAPE
+ aKeyEvt.mnCode = KEY_ESCAPE;
+ else if ( wParam == 0x09 ) // TAB
+ aKeyEvt.mnCode = KEY_TAB;
+ else if ( wParam == 0x20 ) // SPACE
+ aKeyEvt.mnCode = KEY_SPACE;
+ else
+ aKeyEvt.mnCode = 0;
+
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnCharCode = ImplGetCharCode( pFrame, wParam );
+ aKeyEvt.mnRepeat = nRepeat;
+ nLastChar = 0;
+ nLastVKChar = 0;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return nRet;
+ }
+ else
+ {
+ // Bei Shift, Control und Menu schicken wir einen KeyModChange-Event
+ if ( (wParam == VK_SHIFT) || (wParam == VK_CONTROL) || (wParam == VK_MENU) )
+ {
+ SalKeyModEvent aModEvt;
+ aModEvt.mnTime = GetMessageTime();
+ aModEvt.mnCode = nModCode;
+ return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYMODCHANGE, &aModEvt );
+ }
+ else
+ {
+ SalKeyEvent aKeyEvt;
+ USHORT nEvent;
+ MSG aCharMsg;
+ WIN_BOOL bCharPeek = FALSE;
+ UINT nCharMsg = WM_CHAR;
+ BOOL bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP);
+
+ aKeyEvt.mnCode = ImplSalGetKeyCode( wParam );
+ if ( !bKeyUp )
+ {
+ // check for charcode
+ // Mit Hilfe von PeekMessage holen wir uns jetzt die
+ // zugehoerige WM_CHAR Message, wenn vorhanden.
+ // Diese WM_CHAR Message steht immer am Anfang der
+ // Messagequeue. Ausserdem ist sichergestellt, dass immer
+ // nur eine WM_CHAR Message in der Queue steht.
+ bCharPeek = ImplPeekMessage( &aCharMsg, hWnd,
+ WM_CHAR, WM_CHAR, PM_NOREMOVE | PM_NOYIELD );
+ if ( bCharPeek && (nDeadChar == aCharMsg.wParam) )
+ {
+ bCharPeek = FALSE;
+ nDeadChar = 0;
+
+ if ( wParam == VK_BACK )
+ {
+ ImplPeekMessage( &aCharMsg, hWnd,
+ nCharMsg, nCharMsg, PM_REMOVE | PM_NOYIELD );
+ return 0;
+ }
+ }
+ else
+ {
+ if ( !bCharPeek )
+ {
+ bCharPeek = ImplPeekMessage( &aCharMsg, hWnd,
+ WM_SYSCHAR, WM_SYSCHAR, PM_NOREMOVE | PM_NOYIELD );
+ nCharMsg = WM_SYSCHAR;
+ }
+ }
+ if ( bCharPeek )
+ aKeyEvt.mnCharCode = ImplGetCharCode( pFrame, aCharMsg.wParam );
+ else
+ aKeyEvt.mnCharCode = 0;
+
+ nLastChar = aKeyEvt.mnCharCode;
+ nLastVKChar = wParam;
+ }
+ else
+ {
+ if ( wParam == nLastVKChar )
+ {
+ aKeyEvt.mnCharCode = nLastChar;
+ nLastChar = 0;
+ nLastVKChar = 0;
+ }
+ }
+
+ if ( aKeyEvt.mnCode || aKeyEvt.mnCharCode )
+ {
+ if ( bKeyUp )
+ nEvent = SALEVENT_KEYUP;
+ else
+ nEvent = SALEVENT_KEYINPUT;
+
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnRepeat = nRepeat;
+ bIgnoreCharMsg = bCharPeek;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nEvent, &aKeyEvt );
+ bIgnoreCharMsg = FALSE;
+
+ // char-message, than remove or ignore
+ if ( bCharPeek )
+ {
+ nDeadChar = 0;
+ if ( nRet )
+ {
+ ImplPeekMessage( &aCharMsg, hWnd,
+ nCharMsg, nCharMsg, PM_REMOVE | PM_NOYIELD );
+ }
+ else
+ bIgnoreCharMsg = TRUE;
+ }
+
+ return nRet;
+ }
+ else
+ return 0;
+ }
+ }
+#else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+#ifdef WIN
+ if ( (nMsg == WM_KEYDOWN) || (nMsg == WM_KEYUP) )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ USHORT nRepeat = LOWORD( lParam )-1;
+ USHORT nModCode = 0;
+
+ // determine modifiers
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ {
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) )
+ nModCode |= KEY_CONTROLMOD;
+ }
+
+ if ( (wParam != VK_SHIFT) && (wParam != VK_CONTROL) && (wParam != VK_MENU) )
+ {
+ SalKeyEvent aKeyEvt;
+ USHORT nEvent;
+ BOOL bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP);
+
+ // convert KeyCode
+ aKeyEvt.mnCode = ImplSalGetKeyCode( wParam );
+ aKeyEvt.mnCharCode = 0;
+
+ if ( aKeyEvt.mnCode )
+ {
+ if ( bKeyUp )
+ nEvent = SALEVENT_KEYUP;
+ else
+ nEvent = SALEVENT_KEYINPUT;
+
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnRepeat = nRepeat;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nEvent, &aKeyEvt );
+ return nRet;
+ }
+ else
+ return 0;
+ }
+ }
+#endif
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+#ifdef WIN
+ USHORT nRepeat = LOWORD( lParam )-1;
+ USHORT nModCode = 0;
+ USHORT cKeyCode = (USHORT)wParam;
+
+ // determine modifiers
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) )
+ nModCode |= KEY_CONTROLMOD;
+
+ // KeyEvent zusammenbauen
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnTime = GetMessageTime();
+ if ( (cKeyCode >= 48) && (cKeyCode <= 57) )
+ aKeyEvt.mnCode = KEY_0+(cKeyCode-48);
+ else if ( (cKeyCode >= 65) && (cKeyCode <= 90) )
+ aKeyEvt.mnCode = KEY_A+(cKeyCode-65);
+ else if ( (cKeyCode >= 97) && (cKeyCode <= 122) )
+ aKeyEvt.mnCode = KEY_A+(cKeyCode-97);
+ else
+ aKeyEvt.mnCode = 0;
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnCharCode = ImplGetCharCode( pFrame, cKeyCode );
+ aKeyEvt.mnRepeat = nRepeat;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return nRet;
+#else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandlePaintMsg( HWND hWnd )
+{
+ // Clip-Region muss zurueckgesetzt werden, da wir sonst kein
+ // ordentliches Bounding-Rectangle bekommen
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mpGraphics )
+ {
+#ifdef WIN
+ if ( pFrame->maFrameData.mpGraphics->maGraphicsData.mhRegion )
+ SelectClipRgn( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC, 0 );
+#endif
+ }
+ ImplSalYieldMutexRelease();
+ }
+
+#ifdef WIN
+ // Laut Window-Doku soll man erst abfragen, ob ueberhaupt eine
+ // Paint-Region anliegt
+ if ( !GetUpdateRect( hWnd, NULL, FALSE ) )
+ return;
+
+ // BeginPaint
+ PAINTSTRUCT aPs;
+ BeginPaint( hWnd, &aPs );
+
+ // Paint
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ // ClipRegion wieder herstellen
+ if ( pFrame->maFrameData.mpGraphics )
+ {
+ if ( pFrame->maFrameData.mpGraphics->maGraphicsData.mhRegion )
+ {
+#ifdef WIN
+ SelectClipRgn( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC,
+ pFrame->maFrameData.mpGraphics->maGraphicsData.mhRegion );
+#endif
+ }
+ }
+
+ SalPaintEvent aPEvt;
+ aPEvt.mnBoundX = aPs.rcPaint.left;
+ aPEvt.mnBoundY = aPs.rcPaint.top;
+ aPEvt.mnBoundWidth = aPs.rcPaint.right-aPs.rcPaint.left;
+ aPEvt.mnBoundHeight = aPs.rcPaint.bottom-aPs.rcPaint.top;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_PAINT, &aPEvt );
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else
+ {
+ RECT* pRect = new RECT;
+ *pRect = aPs.rcPaint;
+ ImplPostMessage( hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0 );
+ }
+
+ // EndPaint
+ EndPaint( hWnd, &aPs );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect )
+{
+ // Paint
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ SalPaintEvent aPEvt;
+ aPEvt.mnBoundX = pRect->left;
+ aPEvt.mnBoundY = pRect->top;
+ aPEvt.mnBoundWidth = pRect->right-pRect->left;
+ aPEvt.mnBoundHeight = pRect->bottom-pRect->top;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_PAINT, &aPEvt );
+ }
+ ImplSalYieldMutexRelease();
+ delete pRect;
+ }
+#ifdef WIN
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleMoveMsg( HWND hWnd )
+{
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+#ifdef WIN
+ if ( GetWindowStyle( hWnd ) & WS_VISIBLE )
+ pFrame->maFrameData.mbDefPos = FALSE;
+#endif
+
+ // Gegen moegliche Rekursionen sichern
+ if ( !pFrame->maFrameData.mbInMoveMsg )
+ {
+ // Fenster im FullScreenModus wieder einpassen
+ pFrame->maFrameData.mbInMoveMsg = TRUE;
+ if ( pFrame->maFrameData.mbFullScreen )
+ ImplSalFrameFullScreenPos( pFrame );
+ pFrame->maFrameData.mbInMoveMsg = FALSE;
+ }
+
+ // Status merken
+ ImplSaveFrameState( pFrame );
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+#ifdef WIN
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTMOVE, 0, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCallSizeHdl( HWND hWnd )
+{
+ // Da Windows diese Messages auch senden kann, muss hier auch die
+ // Solar-Semaphore beruecksichtigt werden
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_RESIZE, 0 );
+#ifdef WIN
+ // Um doppelte Paints von VCL und SAL zu vermeiden
+ if ( IsWindowVisible( hWnd ) && !pFrame->maFrameData.mbInShow )
+ UpdateWindow( hWnd );
+#endif
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+#ifdef WIN
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTCALLSIZE, 0, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleSizeMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+#ifdef WIN
+ if ( (wParam != SIZE_MAXSHOW) && (wParam != SIZE_MAXHIDE) )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mnWidth = (int)LOWORD(lParam);
+ pFrame->maFrameData.mnHeight = (int)HIWORD(lParam);
+ // Status merken
+ ImplSaveFrameState( pFrame );
+ // Call Hdl
+ ImplCallSizeHdl( hWnd );
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleFocusMsg( HWND hWnd )
+{
+#ifdef WIN
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ // Query the actual status
+ if ( ::GetFocus() == hWnd )
+ {
+ if ( IsWindowVisible( hWnd ) && !pFrame->maFrameData.mbInShow )
+ UpdateWindow( hWnd );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_GETFOCUS, 0 );
+ }
+ else
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_LOSEFOCUS, 0 );
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTFOCUS, 0, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleCloseMsg( HWND hWnd )
+{
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_CLOSE, 0 );
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+#ifdef WIN
+ else
+ ImplPostMessage( hWnd, WM_CLOSE, 0, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleShutDownMsg( HWND hWnd )
+{
+ ImplSalYieldMutexAcquireWithWait();
+ long nRet = 0;
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_SHUTDOWN, 0 );
+ }
+ ImplSalYieldMutexRelease();
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+#ifdef WIN
+ USHORT nSalEvent = SALEVENT_SETTINGSCHANGED;
+
+ if ( nMsg == WM_DEVMODECHANGE )
+ nSalEvent = SALEVENT_PRINTERCHANGED;
+ else if ( nMsg == WM_DISPLAYCHANGE )
+ nSalEvent = SALEVENT_DISPLAYCHANGED;
+ else if ( nMsg == WM_FONTCHANGE )
+ nSalEvent = SALEVENT_FONTCHANGED;
+ else if ( nMsg == WM_TIMECHANGE )
+ nSalEvent = SALEVENT_DATETIMECHANGED;
+ else if ( nMsg == WM_WININICHANGE )
+ {
+ if ( lParam )
+ {
+ if ( aSalShlData.mbWNT )
+ {
+ if ( ImplSalWICompareAscii( (const wchar_t*)lParam, "devices" ) == 0 )
+ nSalEvent = SALEVENT_PRINTERCHANGED;
+ }
+ else
+ {
+ if ( stricmp( (const char*)lParam, "devices" ) == 0 )
+ nSalEvent = SALEVENT_PRINTERCHANGED;
+ }
+ }
+ }
+
+ if ( nMsg == WM_SETTINGCHANGE )
+ {
+ if ( wParam == SPI_SETWHEELSCROLLLINES )
+ aSalShlData.mnWheelScrollLines = ImplSalGetWheelScrollLines();
+ }
+
+ if ( WM_SYSCOLORCHANGE == nMsg && GetSalData()->mhDitherPal )
+ ImplUpdateSysColorEntries();
+
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ if ( (nMsg == WM_DISPLAYCHANGE) || (nMsg == WM_WININICHANGE) )
+ {
+ if ( pFrame->maFrameData.mbFullScreen )
+ ImplSalFrameFullScreenPos( pFrame );
+ }
+
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nSalEvent, 0 );
+ }
+
+ ImplSalYieldMutexRelease();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleUserEvent( HWND hWnd, LPARAM lParam )
+{
+ ImplSalYieldMutexAcquireWithWait();
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_USEREVENT, (void*)lParam );
+ }
+ ImplSalYieldMutexRelease();
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleForcePalette( HWND hWnd )
+{
+ SalData* pSalData = GetSalData();
+ HPALETTE hPal = pSalData->mhDitherPal;
+ if ( hPal )
+ {
+ if ( !ImplSalYieldMutexTryToAcquire() )
+ {
+#ifdef WIN
+ ImplPostMessage( hWnd, SAL_MSG_FORCEPALETTE, 0, 0 );
+#endif
+ return;
+ }
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mpGraphics )
+ {
+ SalGraphics* pGraphics = pFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+#ifdef WIN
+ SelectPalette( pGraphics->maGraphicsData.mhDC, hPal, FALSE );
+ if ( RealizePalette( pGraphics->maGraphicsData.mhDC ) )
+ {
+ InvalidateRect( hWnd, NULL, FALSE );
+ UpdateWindow( hWnd );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_DISPLAYCHANGED, 0 );
+ }
+#endif
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static LRESULT ImplHandlePalette( BOOL bFrame, HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ SalData* pSalData = GetSalData();
+ HPALETTE hPal = pSalData->mhDitherPal;
+ if ( !hPal )
+ return 0;
+
+ rDef = FALSE;
+ if ( pSalData->mbInPalChange )
+ return 0;
+#ifdef WIN
+ if ( (nMsg == WM_PALETTECHANGED) || (nMsg == SAL_MSG_POSTPALCHANGED) )
+ {
+ if ( (HWND)wParam == hWnd )
+ return 0;
+ }
+
+ BOOL bReleaseMutex = FALSE;
+ if ( (nMsg == WM_QUERYNEWPALETTE) || (nMsg == WM_PALETTECHANGED) )
+ {
+ // Da Windows diese Messages auch sendet, muss hier auch die
+ // Solar-Semaphore beruecksichtigt werden
+ if ( ImplSalYieldMutexTryToAcquire() )
+ bReleaseMutex = TRUE;
+ else if ( nMsg == WM_QUERYNEWPALETTE )
+ ImplPostMessage( hWnd, SAL_MSG_POSTQUERYNEWPAL, wParam, lParam );
+ else /* ( nMsg == WM_PALETTECHANGED ) */
+ ImplPostMessage( hWnd, SAL_MSG_POSTPALCHANGED, wParam, lParam );
+ }
+
+ SalVirtualDevice* pTempVD;
+ SalFrame* pTempFrame;
+ SalGraphics* pGraphics;
+ HDC hDC;
+ HPALETTE hOldPal;
+ UINT nCols;
+ BOOL bStdDC;
+ BOOL bUpdate;
+
+ pSalData->mbInPalChange = TRUE;
+
+ // Alle Paletten in VirDevs und Frames zuruecksetzen
+ pTempVD = pSalData->mpFirstVD;
+ while ( pTempVD )
+ {
+ pGraphics = pTempVD->maVirDevData.mpGraphics;
+ if ( pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC,
+ pGraphics->maGraphicsData.mhDefPal,
+ TRUE );
+ }
+ pTempVD = pTempVD->maVirDevData.mpNext;
+ }
+ pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame )
+ {
+ pGraphics = pTempFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC,
+ pGraphics->maGraphicsData.mhDefPal,
+ TRUE );
+ }
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+ }
+
+ // Palette neu realizen
+ SalFrame* pFrame = NULL;
+ if ( bFrame )
+ pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mpGraphics )
+ {
+ hDC = pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC;
+ bStdDC = TRUE;
+ }
+ else
+ {
+ hDC = GetDC( hWnd );
+ bStdDC = FALSE;
+ }
+ UnrealizeObject( hPal );
+ hOldPal = SelectPalette( hDC, hPal, TRUE );
+ nCols = RealizePalette( hDC );
+ bUpdate = nCols != 0;
+ if ( !bStdDC )
+ {
+ SelectPalette( hDC, hOldPal, TRUE );
+ ReleaseDC( hWnd, hDC );
+ }
+
+ // Alle Paletten in VirDevs und Frames neu setzen
+ pTempVD = pSalData->mpFirstVD;
+ while ( pTempVD )
+ {
+ pGraphics = pTempVD->maVirDevData.mpGraphics;
+ if ( pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC, hPal, TRUE );
+ RealizePalette( pGraphics->maGraphicsData.mhDC );
+ }
+ pTempVD = pTempVD->maVirDevData.mpNext;
+ }
+ pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame )
+ {
+ if ( pTempFrame != pFrame )
+ {
+ pGraphics = pTempFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC, hPal, TRUE );
+ if ( RealizePalette( pGraphics->maGraphicsData.mhDC ) )
+ bUpdate = TRUE;
+ }
+ }
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+ }
+
+ // Wenn sich Farben geaendert haben, dann die Fenster updaten
+ if ( bUpdate )
+ {
+ pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame )
+ {
+ pGraphics = pTempFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+ InvalidateRect( pTempFrame->maFrameData.mhWnd, NULL, FALSE );
+ UpdateWindow( pTempFrame->maFrameData.mhWnd );
+ pTempFrame->maFrameData.mpProc( pTempFrame->maFrameData.mpInst, pTempFrame,
+ SALEVENT_DISPLAYCHANGED, 0 );
+ }
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+ }
+ }
+
+ pSalData->mbInPalChange = FALSE;
+
+ if ( bReleaseMutex )
+ ImplSalYieldMutexRelease();
+
+ if ( nMsg == WM_PALETTECHANGED )
+ return 0;
+ else
+ return nCols;
+#else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplHandleMinMax( HWND hWnd, LPARAM lParam )
+{
+ int bRet = FALSE;
+
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ if ( pFrame->maFrameData.mbFullScreen )
+ {
+#ifdef WIN
+ MINMAXINFO* pMinMax = (MINMAXINFO*)lParam;
+ int nX;
+ int nY;
+ int nDX;
+ int nDY;
+ ImplSalCalcFullScreenSize( pFrame, nX, nY, nDX, nDY );
+
+ if ( pMinMax->ptMaxPosition.x > nX )
+ pMinMax->ptMaxPosition.x = nX;
+ if ( pMinMax->ptMaxPosition.y > nY )
+ pMinMax->ptMaxPosition.y = nY;
+
+ if ( pMinMax->ptMaxSize.x < nDX )
+ pMinMax->ptMaxSize.x = nDX;
+ if ( pMinMax->ptMaxSize.y < nDY )
+ pMinMax->ptMaxSize.y = nDY;
+ if ( pMinMax->ptMaxTrackSize.x < nDX )
+ pMinMax->ptMaxTrackSize.x = nDX;
+ if ( pMinMax->ptMaxTrackSize.y < nDY )
+ pMinMax->ptMaxTrackSize.y = nDY;
+
+ pMinMax->ptMinTrackSize.x = nDX;
+ pMinMax->ptMinTrackSize.y = nDY;
+
+ bRet = TRUE;
+#endif
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ WPARAM nCommand = wParam & 0xFFF0;
+
+#ifdef WIN
+ if ( pFrame->maFrameData.mbFullScreen )
+ {
+ WIN_BOOL bMaximize = IsZoomed( pFrame->maFrameData.mhWnd );
+ WIN_BOOL bMinimize = IsIconic( pFrame->maFrameData.mhWnd );
+ if ( (nCommand == SC_SIZE) ||
+ (!bMinimize && (nCommand == SC_MOVE)) ||
+ (!bMaximize && (nCommand == SC_MAXIMIZE)) ||
+ (bMaximize && (nCommand == SC_RESTORE)) )
+ {
+ MessageBeep( 0 );
+ return TRUE;
+ }
+ }
+
+ if ( nCommand == SC_KEYMENU )
+ {
+ // Hier verarbeiten wir nur KeyMenu-Events fuer Alt um
+ // den MenuBar zu aktivieren, oder wenn ein SysChild-Fenster
+ // den Focus hat, da diese Alt+Tasten-Kombinationen nur
+ // ueber diesen Event verarbeitet werden
+ if ( !LOWORD( lParam ) )
+ {
+ // Nur ausloesen, wenn keine weitere Taste gedrueckt ist. Im
+ // Gegensatz zur Doku wird in der X-Koordinaate der CharCode
+ // geliefert, der zusaetzlich gedrueckt ist
+ // Also 32 fuer Space, 99 fuer c, 100 fuer d, ...
+ // Da dies nicht dokumentiert ist, fragen wir vorsichtshalber
+ // auch den Status der Space-Taste ab
+ if ( GetKeyState( VK_SPACE ) & 0x8000 )
+ return 0;
+
+ // Damit nicht bei Alt+Maustaste auch der MenuBar aktiviert wird
+ if ( (GetKeyState( VK_LBUTTON ) & 0x8000) ||
+ (GetKeyState( VK_RBUTTON ) & 0x8000) ||
+ (GetKeyState( VK_MBUTTON ) & 0x8000) )
+ return 1;
+
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode = KEY_MENU;
+ aKeyEvt.mnCharCode = 0;
+ aKeyEvt.mnRepeat = 0;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return (nRet != 0);
+ }
+ else
+ {
+ // Testen, ob ein SysChild den Focus hat
+ HWND hFocusWnd = ::GetFocus();
+ if ( hFocusWnd && ImplFindSalObject( hFocusWnd ) )
+ {
+ char cKeyCode = (char)(unsigned char)LOWORD( lParam );
+ // LowerCase
+ if ( (cKeyCode >= 65) && (cKeyCode <= 90) )
+ cKeyCode += 32;
+ // Wir nehmen nur 0-9 und A-Z, alle anderen Tasten muessen durch
+ // den Hook vom SalObj verarbeitet werden
+ if ( ((cKeyCode >= 48) && (cKeyCode <= 57)) ||
+ ((cKeyCode >= 97) && (cKeyCode <= 122)) )
+ {
+ USHORT nModCode = 0;
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) )
+ nModCode |= KEY_CONTROLMOD;
+
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnTime = GetMessageTime();
+ if ( (cKeyCode >= 48) && (cKeyCode <= 57) )
+ aKeyEvt.mnCode = KEY_0+(cKeyCode-48);
+ else
+ aKeyEvt.mnCode = KEY_A+(cKeyCode-97);
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnCharCode = cKeyCode;
+ aKeyEvt.mnRepeat = 0;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return (nRet != 0);
+ }
+ }
+ }
+ }
+#endif
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleInputLangChange( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ ImplSalYieldMutexAcquireWithWait();
+
+ // Feststellen, ob wir IME unterstuetzen
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbIME && pFrame->maFrameData.mhDefIMEContext )
+ {
+#ifdef WIN
+ HWND hWnd = pFrame->maFrameData.mhWnd;
+ HKL hKL = (HKL)lParam;
+ UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY );
+
+ pFrame->maFrameData.mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0;
+ pFrame->maFrameData.mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0;
+ pFrame->maFrameData.mbHandleIME = !pFrame->maFrameData.mbSpezIME;
+#endif
+ }
+
+ ImplSalYieldMutexRelease();
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplHandleIMEStartComposition( HWND hWnd )
+{
+ BOOL bDef = TRUE;
+
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ if ( pFrame->maFrameData.mbHandleIME )
+ {
+#ifdef WIN
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ // Cursor-Position ermitteln und aus der die Default-Position fuer
+ // das Composition-Fenster berechnen
+ SalCursorPosEvent aCursorPosEvt;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame, SALEVENT_CURSORPOS, (void*)&aCursorPosEvt );
+ COMPOSITIONFORM aForm;
+ memset( &aForm, 0, sizeof( aForm ) );
+ if ( !aCursorPosEvt.mnWidth || !aCursorPosEvt.mnHeight )
+ aForm.dwStyle |= CFS_DEFAULT;
+ else
+ {
+ aForm.dwStyle |= CFS_POINT;
+ aForm.ptCurrentPos.x = aCursorPosEvt.mnX;
+ aForm.ptCurrentPos.y = aCursorPosEvt.mnY;
+ }
+ ImmSetCompositionWindow( hIMC, &aForm );
+
+ // Den InputContect-Font ermitteln und diesem dem Composition-Fenster
+ // bekannt machen
+
+ ImmReleaseContext( hWnd, hIMC );
+ }
+
+ pFrame->maFrameData.mbCompositionMode = TRUE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_STARTEXTTEXTINPUT, (void*)NULL );
+ if ( pFrame->maFrameData.mbAtCursorIME )
+ bDef = FALSE;
+#endif
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+
+ return bDef;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplHandleIMEComposition( HWND hWnd, LPARAM lParam )
+{
+ BOOL bDef = TRUE;
+#ifdef WIN
+ if ( lParam & (GCS_RESULTSTR | GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS) )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbHandleIME &&
+ (pFrame->maFrameData.mbCompositionMode || !(lParam & GCS_RESULTSTR)) )
+ {
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ SalExtTextInputEvent aEvt;
+ aEvt.mnTime = GetMessageTime();
+ aEvt.mpTextAttr = NULL;
+ aEvt.mnCursorPos = 0;
+ aEvt.mnDeltaStart = 0;
+ aEvt.mbOnlyCursor = FALSE;
+ aEvt.mbCursorVisible = !pFrame->maFrameData.mbCandidateMode;
+
+ LONG nTextLen;
+ xub_Unicode* pTextBuf = NULL;
+ LONG nAttrLen;
+ WIN_BYTE* pAttrBuf = NULL;
+ BOOL bLastCursor = FALSE;
+ if ( lParam & GCS_RESULTSTR )
+ {
+ nTextLen = ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, 0, 0 ) / sizeof( wchar_t );
+ if ( nTextLen >= 0 )
+ {
+ pTextBuf = new xub_Unicode[nTextLen];
+ ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf, nTextLen*sizeof( wchar_t ) );
+ }
+
+ bLastCursor = TRUE;
+ aEvt.mbCursorVisible = TRUE;
+ bDef = FALSE;
+ }
+ else if ( pFrame->maFrameData.mbAtCursorIME )
+ {
+ bDef = FALSE;
+ if ( lParam & (GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS) )
+ {
+ nTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 ) / sizeof( wchar_t );
+ if ( nTextLen >= 0 )
+ {
+ pTextBuf = new xub_Unicode[nTextLen];
+ ImmGetCompositionStringW( hIMC, GCS_COMPSTR, pTextBuf, nTextLen*sizeof( wchar_t ) );
+ }
+
+ nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, 0, 0 );
+ if ( nAttrLen >= 0 )
+ {
+ pAttrBuf = new WIN_BYTE[nAttrLen];
+ ImmGetCompositionStringW( hIMC, GCS_COMPATTR, pAttrBuf, nAttrLen );
+ }
+
+ aEvt.mnCursorPos = LOWORD( ImmGetCompositionStringW( hIMC, GCS_CURSORPOS, 0, 0 ) );
+ aEvt.mnDeltaStart = LOWORD( ImmGetCompositionStringW( hIMC, GCS_DELTASTART, 0, 0 ) );
+
+ if ( lParam == GCS_CURSORPOS )
+ aEvt.mbOnlyCursor = TRUE;
+ }
+ }
+
+ USHORT* pSalAttrAry = NULL;
+ if ( pTextBuf )
+ {
+ aEvt.maText = XubString( pTextBuf, (USHORT)nTextLen );
+ delete pTextBuf;
+ if ( pAttrBuf )
+ {
+ xub_StrLen nTextLen = aEvt.maText.Len();
+ if ( nTextLen )
+ {
+ pSalAttrAry = new USHORT[nTextLen];
+ memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) );
+ for ( xub_StrLen i = 0; (i < nTextLen) && (i < nAttrLen); i++ )
+ {
+ WIN_BYTE nWinAttr = pAttrBuf[i];
+ USHORT nSalAttr;
+ if ( nWinAttr == ATTR_TARGET_CONVERTED )
+ {
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETCONVERTED | SAL_EXTTEXTINPUT_ATTR_UNDERLINE | SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT;
+ aEvt.mbCursorVisible = FALSE;
+ }
+ else if ( nWinAttr == ATTR_CONVERTED )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_CONVERTED | SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
+ else if ( nWinAttr == ATTR_TARGET_NOTCONVERTED )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETNOTCONVERTED | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ else if ( nWinAttr == ATTR_INPUT_ERROR )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUTERROR | SAL_EXTTEXTINPUT_ATTR_REDTEXT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ else /* ( nWinAttr == ATTR_INPUT ) */
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ pSalAttrAry[i] = nSalAttr;
+ }
+ aEvt.mpTextAttr = pSalAttrAry;
+ }
+ delete pAttrBuf;
+ }
+ if ( bLastCursor )
+ aEvt.mnCursorPos = aEvt.maText.Len();
+ }
+
+ ImmReleaseContext( hWnd, hIMC );
+
+ // Handler rufen und wenn wir ein Attribute-Array haben, danach
+ // wieder zerstoeren
+ if ( !bDef )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_EXTTEXTINPUT, (void*)&aEvt );
+ }
+ if ( pSalAttrAry )
+ delete pSalAttrAry;
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ }
+#endif
+
+ return bDef;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplHandleIMEEndComposition( HWND hWnd )
+{
+ BOOL bDef = TRUE;
+
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbHandleIME )
+ {
+#ifdef WIN
+ // Wir restaurieren den Background-Modus bei jeder Texteingabe,
+ // da einige Tools wie RichWin uns diesen hin- und wieder umsetzen
+ if ( pFrame->maFrameData.mpGraphics &&
+ pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC )
+ SetBkMode( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC, TRANSPARENT );
+
+ pFrame->maFrameData.mbCompositionMode = FALSE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_ENDEXTTEXTINPUT, (void*)NULL );
+ if ( pFrame->maFrameData.mbAtCursorIME )
+ bDef = FALSE;
+#endif
+ }
+
+ ImplSalYieldMutexRelease();
+
+ return bDef;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam )
+{
+ if ( wParam == (WPARAM)IMN_OPENCANDIDATE )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbHandleIME &&
+ pFrame->maFrameData.mbAtCursorIME )
+ {
+#ifdef WIN
+ // Wir wollen den Cursor hiden
+ pFrame->maFrameData.mbCandidateMode = TRUE;
+ ImplHandleIMEComposition( hWnd, GCS_CURSORPOS );
+
+ HWND hWnd = pFrame->maFrameData.mhWnd;
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ LONG nBufLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 );
+ if ( nBufLen >= 1 )
+ {
+ USHORT nCursorPos = LOWORD( ImmGetCompositionStringW( hIMC, GCS_CURSORPOS, 0, 0 ) );
+ SalExtTextInputPosEvent aEvt;
+ aEvt.mnTime = GetMessageTime();
+ aEvt.mnFirstPos = nCursorPos;
+ aEvt.mnChars = nBufLen/sizeof(sal_Unicode) - nCursorPos;
+ aEvt.mpPosAry = new SalExtCharPos[aEvt.mnChars];
+ memset( aEvt.mpPosAry, 0, aEvt.mnChars*sizeof(SalExtCharPos) );
+
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_EXTTEXTINPUTPOS, (void*)&aEvt );
+
+ long nMinLeft = aEvt.mpPosAry[0].mnX;
+ long nMinTop = aEvt.mpPosAry[0].mnY;
+ long nMaxBottom = aEvt.mpPosAry[0].mnY+aEvt.mpPosAry[0].mnHeight;
+ long nMaxRight = nMinLeft;
+ USHORT i = 0;
+ while ( i < aEvt.mnChars )
+ {
+ // Solange wir uns auf der gleichen Zeile bewegen,
+ // ermitteln wir die Rechteck-Grenzen
+ if ( !aEvt.mpPosAry[i].mnHeight ||
+ (aEvt.mpPosAry[i].mnY < nMaxBottom-1) )
+ {
+ if ( aEvt.mpPosAry[i].mnX < nMinLeft )
+ nMinLeft = aEvt.mpPosAry[i].mnX;
+ if ( aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth > nMaxRight )
+ nMaxRight = aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth;
+ if ( aEvt.mpPosAry[i].mnY < nMinTop )
+ nMinTop = aEvt.mpPosAry[i].mnY;
+ i++;
+ }
+ else
+ break;
+ }
+
+ CANDIDATEFORM aForm;
+ aForm.dwIndex = 0;
+ aForm.dwStyle = CFS_EXCLUDE;
+ aForm.ptCurrentPos.x = aEvt.mpPosAry[0].mnX;
+ aForm.ptCurrentPos.y = nMaxBottom+1;
+ aForm.rcArea.left = nMinLeft;
+ aForm.rcArea.top = nMinTop;
+ aForm.rcArea.right = nMaxRight+1;
+ aForm.rcArea.bottom = nMaxBottom+1;
+ ImmSetCandidateWindow( hIMC, &aForm );
+
+ delete aEvt.mpPosAry;
+ }
+
+ ImmReleaseContext( hWnd, hIMC );
+ }
+#endif
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else if ( wParam == (WPARAM)IMN_CLOSECANDIDATE )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ pFrame->maFrameData.mbCandidateMode = FALSE;
+ ImplSalYieldMutexRelease();
+ }
+}
+
+
+// -----------------------------------------------------------------------
+
+void SalTestMouseLeave()
+{
+ SalData* pSalData = GetSalData();
+
+#ifdef WIN
+ if ( pSalData->mhWantLeaveMsg && !::GetCapture() )
+ {
+ POINT aPt;
+ GetCursorPos( &aPt );
+ if ( pSalData->mhWantLeaveMsg != WindowFromPoint( aPt ) )
+ ImplSendMessage( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MAKELPARAM( aPt.x, aPt.y ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplSalWheelMousePos( HWND hWnd, UINT nMsg, WPARAM wParam,
+ LPARAM lParam, LRESULT& rResult )
+{
+#ifdef WIN
+ POINT aPt;
+ POINT aScreenPt;
+ aScreenPt.x = (short)LOWORD( lParam );
+ aScreenPt.y = (short)HIWORD( lParam );
+ // Child-Fenster suchen, welches an der entsprechenden
+ // Position liegt
+ HWND hChildWnd;
+ HWND hWheelWnd = hWnd;
+ do
+ {
+ hChildWnd = hWheelWnd;
+ aPt = aScreenPt;
+ ScreenToClient( hChildWnd, &aPt );
+ hWheelWnd = ChildWindowFromPointEx( hChildWnd, aPt, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT );
+ }
+ while ( hWheelWnd && (hWheelWnd != hChildWnd) );
+ if ( hWheelWnd && (hWheelWnd != hWnd) &&
+ (hWheelWnd != ::GetFocus()) && IsWindowEnabled( hWheelWnd ) )
+ {
+ rResult = ImplSendMessage( hWheelWnd, nMsg, wParam, lParam );
+ return FALSE;
+ }
+#endif
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ LRESULT nRet = 0;
+#ifdef WIN
+ static int bInWheelMsg = FALSE;
+
+ // By WM_CRETAE we connect the frame with the window handle
+ if ( nMsg == WM_CREATE )
+ {
+ // Window-Instanz am Windowhandle speichern
+ // Can also be used for the W-Version, because the struct
+ // to access lpCreateParams is the same structure
+ CREATESTRUCTA* pStruct = (CREATESTRUCTA*)lParam;
+ SalFrame* pFrame = (SalFrame*)pStruct->lpCreateParams;
+ SetWindowPtr( hWnd, pFrame );
+ // HWND schon hier setzen, da schon auf den Instanzdaten
+ // gearbeitet werden kann, wenn Messages waehrend
+ // CreateWindow() gesendet werden
+ pFrame->maFrameData.mhWnd = hWnd;
+ pFrame->maFrameData.maSysData.hWnd = hWnd;
+ return 0;
+ }
+
+ switch( nMsg )
+ {
+ case WM_MOUSEMOVE:
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_NCMOUSEMOVE:
+ case SAL_MSG_MOUSELEAVE:
+ ImplSalYieldMutexAcquireWithWait();
+ rDef = !ImplHandleMouseMsg( hWnd, nMsg, wParam, lParam );
+ ImplSalYieldMutexRelease();
+ break;
+
+ case WM_MOUSEACTIVATE:
+ if ( LOWORD( lParam ) == HTCLIENT )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ nRet = ImplHandleMouseActivateMsg( hWnd );
+ ImplSalYieldMutexRelease();
+ if ( nRet )
+ {
+ nRet = MA_NOACTIVATE;
+ rDef = FALSE;
+ }
+ }
+ break;
+
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ case WM_DEADCHAR:
+ case WM_CHAR:
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+ case WM_SYSCHAR:
+ ImplSalYieldMutexAcquireWithWait();
+ rDef = !ImplHandleKeyMsg( hWnd, nMsg, wParam, lParam );
+ ImplSalYieldMutexRelease();
+ break;
+
+ case WM_MOUSEWHEEL:
+ // Gegen Rekursion absichern, falls wir vom IE oder dem externen
+ // Fenster die Message wieder zurueckbekommen
+ if ( !bInWheelMsg )
+ {
+ bInWheelMsg++;
+ rDef = !ImplHandleWheelMsg( hWnd, wParam, lParam );
+ // Wenn wir die Message nicht ausgewertet haben, schauen wir
+ // noch einmal nach, ob dort ein geplugtes Fenster steht,
+ // welches wir dann benachrichtigen
+ if ( rDef )
+ rDef = ImplSalWheelMousePos( hWnd, nMsg, wParam, lParam, nRet );
+ bInWheelMsg--;
+ }
+ break;
+
+ case WM_SYSCOMMAND:
+ ImplSalYieldMutexAcquireWithWait();
+ nRet = ImplHandleSysCommand( hWnd, wParam, lParam );
+ ImplSalYieldMutexRelease();
+ if ( nRet )
+ rDef = FALSE;
+ break;
+
+ case WM_MOVE:
+ case SAL_MSG_POSTMOVE:
+ ImplHandleMoveMsg( hWnd );
+ rDef = FALSE;
+ break;
+ case WM_SIZE:
+ ImplHandleSizeMsg( hWnd, wParam, lParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_POSTCALLSIZE:
+ ImplCallSizeHdl( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_GETMINMAXINFO:
+ if ( ImplHandleMinMax( hWnd, lParam ) )
+ rDef = FALSE;
+ break;
+
+ case WM_ERASEBKGND:
+ nRet = 1;
+ rDef = FALSE;
+ break;
+ case WM_PAINT:
+ ImplHandlePaintMsg( hWnd );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_POSTPAINT:
+ ImplHandlePaintMsg2( hWnd, (RECT*)wParam );
+ rDef = FALSE;
+ break;
+
+ case SAL_MSG_FORCEPALETTE:
+ ImplHandleForcePalette( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_QUERYNEWPALETTE:
+ case SAL_MSG_POSTQUERYNEWPAL:
+ nRet = ImplHandlePalette( TRUE, hWnd, nMsg, wParam, lParam, rDef );
+ break;
+
+ case WM_ACTIVATE:
+ // Wenn wir aktiviert werden, dann wollen wir auch unsere
+ // Palette setzen. Wir machen dieses in Activate,
+ // damit andere externe Child-Fenster auch unsere Palette
+ // ueberschreiben koennen. So wird unsere jedenfalls nur einmal
+ // gesetzt und nicht immer rekursiv, da an allen anderen Stellen
+ // diese nur als Background-Palette gesetzt wird
+ if ( LOWORD( wParam ) != WA_INACTIVE )
+ ImplSendMessage( hWnd, SAL_MSG_FORCEPALETTE, 0, 0 );
+ break;
+
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ case SAL_MSG_POSTFOCUS:
+ ImplHandleFocusMsg( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_CLOSE:
+ ImplHandleCloseMsg( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_QUERYENDSESSION:
+ nRet = !ImplHandleShutDownMsg( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_DISPLAYCHANGE:
+ case WM_SETTINGCHANGE:
+ case WM_DEVMODECHANGE:
+ case WM_FONTCHANGE:
+ case WM_SYSCOLORCHANGE:
+ case WM_TIMECHANGE:
+ ImplHandleSettingsChangeMsg( hWnd, nMsg, wParam, lParam );
+ break;
+
+ case SAL_MSG_USEREVENT:
+ ImplHandleUserEvent( hWnd, lParam );
+ rDef = FALSE;
+ break;
+
+ case SAL_MSG_CAPTUREMOUSE:
+ SetCapture( hWnd );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_RELEASEMOUSE:
+ if ( ::GetCapture() == hWnd )
+ ReleaseCapture();
+ rDef = FALSE;
+ break;
+ case SAL_MSG_TOTOP:
+ ImplSalToTop( hWnd, (USHORT)wParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_SHOW:
+ ImplSalShow( hWnd, (BOOL)wParam );
+ rDef = FALSE;
+ break;
+
+ case WM_INPUTLANGCHANGE:
+ ImplHandleInputLangChange( hWnd, wParam, lParam );
+ break;
+
+ case WM_IME_STARTCOMPOSITION:
+ rDef = ImplHandleIMEStartComposition( hWnd );
+ break;
+
+ case WM_IME_COMPOSITION:
+ rDef = ImplHandleIMEComposition( hWnd, lParam );
+ break;
+
+ case WM_IME_ENDCOMPOSITION:
+ rDef = ImplHandleIMEEndComposition( hWnd );
+ break;
+
+ case WM_IME_NOTIFY:
+ ImplHandleIMENotify( hWnd, wParam );
+ break;
+ }
+
+ // WheelMouse-Message abfangen
+ if ( rDef && (nMsg == aSalShlData.mnWheelMsgId) && aSalShlData.mnWheelMsgId )
+ {
+ // Gegen Rekursion absichern, falls wir vom IE oder dem externen
+ // Fenster die Message wieder zurueckbekommen
+ if ( !bInWheelMsg )
+ {
+ bInWheelMsg++;
+ // Zuerst wollen wir die Message dispatchen und dann darf auch
+ // das SystemWindow drankommen
+ WORD nKeyState = 0;
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nKeyState |= MK_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nKeyState |= MK_CONTROL;
+ // Mutex handling is inside from this call
+ rDef = !ImplHandleWheelMsg( hWnd, MAKEWPARAM( nKeyState, (WORD)wParam ), lParam );
+ if ( rDef )
+ {
+ HWND hWheelWnd = ::GetFocus();
+ if ( hWheelWnd && (hWheelWnd != hWnd) )
+ {
+ nRet = ImplSendMessage( hWheelWnd, nMsg, wParam, lParam );
+ rDef = FALSE;
+ }
+ else
+ rDef = ImplSalWheelMousePos( hWnd, nMsg, wParam, lParam, nRet );
+ }
+ bInWheelMsg--;
+ }
+ }
+#endif
+
+ return nRet;
+}
+
+#ifdef WIN
+LRESULT CALLBACK SalFrameWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalFrameWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+#endif
+
+#ifdef WIN
+LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalFrameWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+BOOL ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult )
+{
+#ifdef WIN
+ // Hier verarbeiten wir alle Messages, die fuer alle Frame-Fenster gelten,
+ // damit diese nur einmal verarbeitet werden
+ // Must work for Unicode and none Unicode
+ if ( (nMsg == WM_PALETTECHANGED) || (nMsg == SAL_MSG_POSTPALCHANGED) )
+ {
+ int bDef = TRUE;
+ rlResult = ImplHandlePalette( FALSE, hWnd, nMsg, wParam, lParam, bDef );
+ return (bDef != 0);
+ }
+ else
+#endif
+ return FALSE;
+}
diff --git a/vcl/aqua/source/window/salobj.cxx b/vcl/aqua/source/window/salobj.cxx
new file mode 100644
index 000000000000..69d98b87bbd2
--- /dev/null
+++ b/vcl/aqua/source/window/salobj.cxx
@@ -0,0 +1,858 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _SVWIN_HXX
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALOBJ_CXX
+
+#ifndef _SV_SALAQUA_HXX
+#include <salaqua.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// =======================================================================
+
+static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild )
+{
+ if ( hWndParent == hWndChild )
+ return TRUE;
+
+#ifdef WIN
+ HWND hTempWnd = ::GetParent( hWndChild );
+ while ( hTempWnd )
+ {
+ // Ab nicht Child-Fenstern hoeren wir auf zu suchen
+ if ( !(GetWindowStyle( hTempWnd ) & WS_CHILD) )
+ return FALSE;
+ if ( hTempWnd == hWndParent )
+ return TRUE;
+ hTempWnd = ::GetParent( hTempWnd );
+ }
+#endif
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SalObject* ImplFindSalObject( HWND hWndChild )
+{
+ SalData* pSalData = GetSalData();
+ SalObject* pObject = pSalData->mpFirstObject;
+ while ( pObject )
+ {
+ if ( ImplIsSysWindowOrChild( pObject->maObjectData.mhWndChild, hWndChild ) )
+ return pObject;
+
+ pObject = pObject->maObjectData.mpNextObject;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* ImplFindSalObjectFrame( HWND hWnd )
+{
+ SalFrame* pFrame = NULL;
+ SalObject* pObject = ImplFindSalObject( hWnd );
+ if ( pObject )
+ {
+#ifdef WIN
+ // Dazugehoerenden Frame suchen
+ HWND hWnd = ::GetParent( pObject->maObjectData.mhWnd );
+ pFrame = GetSalData()->mpFirstFrame;
+ while ( pFrame )
+ {
+ if ( pFrame->maFrameData.mhWnd == hWnd )
+ break;
+
+ pFrame = pFrame->maFrameData.mpNextFrame;
+ }
+#endif
+ }
+
+ return pFrame;
+}
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
+{
+ // Used for Unicode and none Unicode
+ SalData* pSalData = GetSalData();
+
+#ifdef WIN
+ if ( (nCode >= 0) && lParam )
+ {
+ CWPSTRUCT* pData = (CWPSTRUCT*)lParam;
+ if ( (pData->message != WM_KEYDOWN) &&
+ (pData->message != WM_KEYUP) )
+ pSalData->mnSalObjWantKeyEvt = 0;
+
+ // Testen, ob wir Daten fuer ein SalObject-Fenster behandeln
+ // muessen
+ SalObject* pObject;
+ if ( pData->message == WM_SETFOCUS )
+ {
+ pObject = ImplFindSalObject( pData->hwnd );
+ if ( pObject )
+ {
+ pObject->maObjectData.mhLastFocusWnd = pData->hwnd;
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pObject->maObjectData.mpProc( pObject->maObjectData.mpInst, pObject,
+ SALOBJ_EVENT_GETFOCUS, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( pObject->maObjectData.mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 );
+ }
+ }
+ else if ( pData->message == WM_KILLFOCUS )
+ {
+ pObject = ImplFindSalObject( pData->hwnd );
+ if ( pObject && !ImplFindSalObject( (HWND)pData->wParam ) )
+ {
+ // LoseFocus nur rufen, wenn wirklich kein ChildFenster
+ // den Focus bekommt
+ if ( !pData->wParam || !ImplFindSalObject( (HWND)pData->wParam ) )
+ {
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pObject->maObjectData.mpProc( pObject->maObjectData.mpInst, pObject,
+ SALOBJ_EVENT_LOSEFOCUS, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( pObject->maObjectData.mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 );
+ }
+ else
+ pObject->maObjectData.mhLastFocusWnd = (HWND)pData->wParam;
+ }
+ }
+ }
+
+ return CallNextHookEx( pSalData->mhSalObjMsgHook, nCode, wParam, lParam );
+#else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+BOOL ImplSalPreDispatchMsg( MSG* pMsg )
+{
+ // Used for Unicode and none Unicode
+ SalData* pSalData = GetSalData();
+ SalObject* pObject;
+
+ if ( (pMsg->message == WM_LBUTTONDOWN) ||
+ (pMsg->message == WM_RBUTTONDOWN) ||
+ (pMsg->message == WM_MBUTTONDOWN) )
+
+ ImplSalYieldMutexAcquireWithWait();
+ pObject = ImplFindSalObject( pMsg->hwnd );
+ if ( pObject )
+ ImplPostMessage( pObject->maObjectData.mhWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ ImplSalYieldMutexRelease();
+ }
+
+ if ( (pMsg->message == WM_KEYDOWN) ||
+ (pMsg->message == WM_KEYUP) )
+ {
+ // KeyEvents wollen wir nach Moeglichkeit auch abarbeiten,
+ // wenn das Control diese nicht selber auswertet
+ // SysKeys werden als WM_SYSCOMMAND verarbeitet
+ // Char-Events verarbeiten wir nicht, da wir nur
+ // Accelerator relevante Keys verarbeiten wollen
+ BOOL bWantedKeyCode = FALSE;
+ // A-Z, 0-9 nur in Verbindung mit Control-Taste
+ if ( ((pMsg->wParam >= 65) && (pMsg->wParam <= 90)) ||
+ ((pMsg->wParam >= 48) && (pMsg->wParam <= 57)) )
+ {
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ bWantedKeyCode = TRUE;
+ }
+ else if ( ((pMsg->wParam >= VK_F1) && (pMsg->wParam <= VK_F24)) ||
+ ((pMsg->wParam >= VK_SPACE) && (pMsg->wParam <= VK_HELP)) ||
+ (pMsg->wParam == VK_BACK) || (pMsg->wParam == VK_TAB) ||
+ (pMsg->wParam == VK_CLEAR) || (pMsg->wParam == VK_RETURN) ||
+ (pMsg->wParam == VK_ESCAPE) )
+ bWantedKeyCode = TRUE;
+ if ( bWantedKeyCode )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ pObject = ImplFindSalObject( pMsg->hwnd );
+ if ( pObject )
+ pSalData->mnSalObjWantKeyEvt = pMsg->wParam;
+ ImplSalYieldMutexRelease();
+ }
+ }
+ // Hier WM_SYSCHAR abfangen, um mit Alt+Taste evtl. Menu zu aktivieren
+ else if ( pMsg->message == WM_SYSCHAR )
+ {
+ pSalData->mnSalObjWantKeyEvt = 0;
+
+ USHORT nKeyCode = LOWORD( pMsg->wParam );
+ // Nur 0-9 und A-Z
+ if ( ((nKeyCode >= 48) && (nKeyCode <= 57)) ||
+ ((nKeyCode >= 65) && (nKeyCode <= 90)) ||
+ ((nKeyCode >= 97) && (nKeyCode <= 122)) )
+ {
+ BOOL bRet = FALSE;
+ ImplSalYieldMutexAcquireWithWait();
+ pObject = ImplFindSalObject( pMsg->hwnd );
+ if ( pObject )
+ {
+ if ( pMsg->hwnd == ::GetFocus() )
+ {
+ SalFrame* pFrame = ImplFindSalObjectFrame( pMsg->hwnd );
+ if ( pFrame )
+ {
+ if ( ImplHandleSalObjSysCharMsg( pFrame->maFrameData.mhWnd, pMsg->wParam, pMsg->lParam ) )
+ bRet = TRUE;
+ }
+ }
+ }
+ ImplSalYieldMutexRelease();
+ if ( bRet )
+ return TRUE;
+ }
+ }
+ else
+ pSalData->mnSalObjWantKeyEvt = 0;
+
+ return FALSE;
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifdef WIN
+void ImplSalPostDispatchMsg( MSG* pMsg, LRESULT /* nDispatchResult */ )
+{
+ // Used for Unicode and none Unicode
+ SalData* pSalData = GetSalData();
+ SalFrame* pFrame;
+
+ if ( (pMsg->message == WM_KEYDOWN) || (pMsg->message == WM_KEYUP) )
+ {
+ if ( pSalData->mnSalObjWantKeyEvt == pMsg->wParam )
+ {
+ pSalData->mnSalObjWantKeyEvt = 0;
+ if ( pMsg->hwnd == ::GetFocus() )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ pFrame = ImplFindSalObjectFrame( pMsg->hwnd );
+ if ( pFrame )
+ ImplHandleSalObjKeyMsg( pFrame->maFrameData.mhWnd, pMsg->message, pMsg->wParam, pMsg->lParam );
+ ImplSalYieldMutexRelease();
+ }
+ }
+ }
+
+ pSalData->mnSalObjWantKeyEvt = 0;
+}
+#endif
+
+// =======================================================================
+
+LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ SalObject* pSysObj;
+ LRESULT nRet = 0;
+
+#ifdef WIN
+ switch( nMsg )
+ {
+ case WM_ERASEBKGND:
+ nRet = 1;
+ rDef = FALSE;
+ break;
+ case WM_PAINT:
+ {
+ PAINTSTRUCT aPs;
+ BeginPaint( hWnd, &aPs );
+ EndPaint( hWnd, &aPs );
+ rDef = FALSE;
+ }
+ break;
+
+ case WM_PARENTNOTIFY:
+ {
+ UINT nNotifyMsg = LOWORD( wParam );
+ if ( (nNotifyMsg == WM_LBUTTONDOWN) ||
+ (nNotifyMsg == WM_RBUTTONDOWN) ||
+ (nNotifyMsg == WM_MBUTTONDOWN) )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ if ( pSysObj )
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj, SALOBJ_EVENT_TOTOP, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ }
+ break;
+
+ case WM_MOUSEACTIVATE:
+ ImplPostMessage( hWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ break;
+
+ case SALOBJ_MSG_TOTOP:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj,
+ SALOBJ_EVENT_TOTOP, 0 );
+ ImplSalYieldMutexRelease();
+ rDef = FALSE;
+ }
+ else
+ ImplPostMessage( hWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ break;
+
+ case SALOBJ_MSG_POSTFOCUS:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ HWND hFocusWnd = ::GetFocus();
+ USHORT nEvent;
+ if ( hFocusWnd && ImplIsSysWindowOrChild( hWnd, hFocusWnd ) )
+ nEvent = SALOBJ_EVENT_GETFOCUS;
+ else
+ nEvent = SALOBJ_EVENT_LOSEFOCUS;
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj,
+ nEvent, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( hWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 );
+ rDef = FALSE;
+ break;
+
+ case WM_SIZE:
+ {
+ HWND hWndChild = GetWindow( hWnd, GW_CHILD );
+ if ( hWndChild )
+ {
+ SetWindowPos( hWndChild,
+ 0, 0, 0, (int)LOWORD( lParam ), (int)HIWORD( lParam ),
+ SWP_NOZORDER | SWP_NOACTIVATE );
+ }
+ }
+ rDef = FALSE;
+ break;
+
+ case WM_CREATE:
+ {
+ // Window-Instanz am Windowhandle speichern
+ // Can also be used for the W-Version, because the struct
+ // to access lpCreateParams is the same structure
+ CREATESTRUCTA* pStruct = (CREATESTRUCTA*)lParam;
+ pSysObj = (SalObject*)pStruct->lpCreateParams;
+ SetSalObjWindowPtr( hWnd, pSysObj );
+ // HWND schon hier setzen, da schon auf den Instanzdaten
+ // gearbeitet werden kann, wenn Messages waehrend
+ // CreateWindow() gesendet werden
+ pSysObj->maObjectData.mhWnd = hWnd;
+ rDef = FALSE;
+ }
+ break;
+ }
+#endif
+
+ return nRet;
+}
+
+#ifdef WIN
+LRESULT CALLBACK SalSysObjWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+#endif
+
+#ifdef WIN
+LRESULT CALLBACK SalSysObjWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalSysObjChildWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ LRESULT nRet = 0;
+
+#ifdef WIN
+ switch( nMsg )
+ {
+ // Wegen PlugIn's loeschen wir erstmal den Hintergrund
+ case WM_ERASEBKGND:
+ nRet = 1;
+ rDef = FALSE;
+ break;
+ case WM_PAINT:
+ {
+ PAINTSTRUCT aPs;
+ BeginPaint( hWnd, &aPs );
+ EndPaint( hWnd, &aPs );
+ rDef = FALSE;
+ }
+ break;
+ }
+#endif
+
+ return nRet;
+}
+
+#ifdef WIN
+LRESULT CALLBACK SalSysObjChildWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjChildWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+#endif
+
+#ifdef WIN
+LRESULT CALLBACK SalSysObjChildWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjChildWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+#endif
+
+// =======================================================================
+
+SalObject* ImplSalCreateObject( SalInstance* pInst, SalFrame* pParent )
+{
+ SalData* pSalData = GetSalData();
+
+#ifdef WIN
+ // Hook installieren, wenn es das erste SalObject ist
+ if ( !pSalData->mpFirstObject )
+ {
+ pSalData->mhSalObjMsgHook = SetWindowsHookExA( WH_CALLWNDPROC,
+ SalSysMsgProc,
+ pSalData->mhInst,
+ pSalData->mnAppThreadId );
+ }
+
+ if ( !pSalData->mbObjClassInit )
+ {
+ WNDCLASSEXA aWndClassEx;
+ aWndClassEx.cbSize = sizeof( aWndClassEx );
+ aWndClassEx.style = 0;
+ aWndClassEx.lpfnWndProc = SalSysObjWndProcA;
+ aWndClassEx.cbClsExtra = 0;
+ aWndClassEx.cbWndExtra = SAL_OBJECT_WNDEXTRA;
+ aWndClassEx.hInstance = pSalData->mhInst;
+ aWndClassEx.hIcon = 0;
+ aWndClassEx.hIconSm = 0;
+ aWndClassEx.hCursor = LoadCursor( 0, IDC_ARROW );
+ aWndClassEx.hbrBackground = 0;
+ aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.lpszClassName = SAL_OBJECT_CLASSNAMEA;
+ if ( RegisterClassExA( &aWndClassEx ) )
+ {
+ // Wegen PlugIn's loeschen wir erstmal den Hintergrund
+ aWndClassEx.cbWndExtra = 0;
+ aWndClassEx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ aWndClassEx.lpfnWndProc = SalSysObjChildWndProcA;
+ aWndClassEx.lpszClassName = SAL_OBJECT_CHILDCLASSNAMEA;
+ if ( RegisterClassExA( &aWndClassEx ) )
+ pSalData->mbObjClassInit = TRUE;
+ }
+ }
+#endif
+
+ if ( pSalData->mbObjClassInit )
+ {
+#ifdef WIN
+ SalObject* pObject = new SalObject;
+ HWND hWnd;
+ HWND hWndChild = 0;
+ hWnd = CreateWindowExA( 0, SAL_OBJECT_CLASSNAMEA, "", WS_CHILD, 0, 0, 0, 0, pParent->maFrameData.mhWnd, 0, pInst->maInstData.mhInst, (void*)pObject );
+ if ( hWnd )
+ {
+ hWndChild = CreateWindowExA( 0, SAL_OBJECT_CHILDCLASSNAMEA, "", WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, 0, 0, 0, 0, hWnd, 0, pInst->maInstData.mhInst, NULL );
+ }
+ }
+ if ( !hWndChild )
+ {
+ delete pObject;
+ return NULL;
+ }
+
+ if ( hWnd )
+ {
+ pObject->maObjectData.mhWnd = hWnd;
+ pObject->maObjectData.mhWndChild = hWndChild;
+ pObject->maObjectData.maSysData.hWnd = hWndChild;
+ return pObject;
+ }
+#endif
+ }
+
+ return NULL;
+}
+
+// =======================================================================
+
+long ImplSalObjCallbackDummy( void*, SalObject*, USHORT, const void* )
+{
+ return 0;
+}
+
+// =======================================================================
+
+SalObject::SalObject()
+{
+ SalData* pSalData = GetSalData();
+
+ maObjectData.mhWnd = 0;
+ maObjectData.mhWndChild = 0;
+ maObjectData.mhLastFocusWnd = 0;
+ maObjectData.maSysData.nSize = sizeof( SystemEnvData );
+ maObjectData.mpInst = NULL;
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+#ifdef WIN
+ maObjectData.mpStdClipRgnData = NULL;
+#endif
+
+ // Insert object in objectlist
+ maObjectData.mpNextObject = pSalData->mpFirstObject;
+ pSalData->mpFirstObject = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalObject::~SalObject()
+{
+ SalData* pSalData = GetSalData();
+
+ // remove frame from framelist
+ if ( this == pSalData->mpFirstObject )
+ {
+ pSalData->mpFirstObject = maObjectData.mpNextObject;
+
+#ifdef WIN
+ // Wenn letztes SalObject, dann Hook wieder entfernen
+ if ( !pSalData->mpFirstObject )
+ UnhookWindowsHookEx( pSalData->mhSalObjMsgHook );
+#endif
+ }
+ else
+ {
+ SalObject* pTempObject = pSalData->mpFirstObject;
+ while ( pTempObject->maObjectData.mpNextObject != this )
+ pTempObject = pTempObject->maObjectData.mpNextObject;
+
+ pTempObject->maObjectData.mpNextObject = maObjectData.mpNextObject;
+ }
+
+#ifdef WIN
+ // Cache-Daten zerstoeren
+ if ( maObjectData.mpStdClipRgnData )
+ delete maObjectData.mpStdClipRgnData;
+
+ HWND hWndParent = ::GetParent( maObjectData.mhWnd );
+
+ if ( maObjectData.mhWndChild )
+ DestroyWindow( maObjectData.mhWndChild );
+ if ( maObjectData.mhWnd )
+ DestroyWindow( maObjectData.mhWnd );
+
+ // Palette wieder zuruecksetzen, wenn kein externes Child-Fenster
+ // mehr vorhanden ist, da diese unsere Palette ueberschrieben haben
+ // koennen
+ if ( hWndParent &&
+ ::GetActiveWindow() == hWndParent &&
+ !GetWindow( hWndParent, GW_CHILD ) )
+ ImplSendMessage( hWndParent, SAL_MSG_FORCEPALETTE, 0, 0 );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::ResetClipRegion()
+{
+#ifdef WIN
+ SetWindowRgn( maObjectData.mhWnd, 0, TRUE );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalObject::GetClipRegionType()
+{
+ return SAL_OBJECT_CLIP_INCLUDERECTS;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::BeginSetClipRegion( ULONG nRectCount )
+{
+#ifdef WIN
+ ULONG nRectBufSize = sizeof(RECT)*nRectCount;
+ if ( nRectCount < SAL_CLIPRECT_COUNT )
+ {
+ if ( !maObjectData.mpStdClipRgnData )
+ maObjectData.mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
+ maObjectData.mpClipRgnData = maObjectData.mpStdClipRgnData;
+ }
+ else
+ maObjectData.mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ maObjectData.mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
+ maObjectData.mpClipRgnData->rdh.iType = RDH_RECTANGLES;
+ maObjectData.mpClipRgnData->rdh.nCount = nRectCount;
+ maObjectData.mpClipRgnData->rdh.nRgnSize = nRectBufSize;
+ SetRectEmpty( &(maObjectData.mpClipRgnData->rdh.rcBound) );
+ maObjectData.mpNextClipRect = (RECT*)(&(maObjectData.mpClipRgnData->Buffer));
+ maObjectData.mbFirstClipRect = TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+#ifdef WIN
+ RECT* pRect = maObjectData.mpNextClipRect;
+ RECT* pBoundRect = &(maObjectData.mpClipRgnData->rdh.rcBound);
+ long nRight = nX + nWidth;
+ long nBottom = nY + nHeight;
+
+ if ( maObjectData.mbFirstClipRect )
+ {
+ pBoundRect->left = nX;
+ pBoundRect->top = nY;
+ pBoundRect->right = nRight;
+ pBoundRect->bottom = nBottom;
+ maObjectData.mbFirstClipRect = FALSE;
+ }
+ else
+ {
+ if ( nX < pBoundRect->left )
+ pBoundRect->left = (int)nX;
+
+ if ( nY < pBoundRect->top )
+ pBoundRect->top = (int)nY;
+
+ if ( nRight > pBoundRect->right )
+ pBoundRect->right = (int)nRight;
+
+ if ( nBottom > pBoundRect->bottom )
+ pBoundRect->bottom = (int)nBottom;
+ }
+
+ pRect->left = (int)nX;
+ pRect->top = (int)nY;
+ pRect->right = (int)nRight;
+ pRect->bottom = (int)nBottom;
+ maObjectData.mpNextClipRect++;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::EndSetClipRegion()
+{
+#ifdef WIN
+ HRGN hRegion;
+
+ // Aus den Region-Daten muessen wir jetzt eine ClipRegion erzeugen
+ if ( maObjectData.mpClipRgnData->rdh.nCount == 1 )
+ {
+ RECT* pRect = &(maObjectData.mpClipRgnData->rdh.rcBound);
+ hRegion = CreateRectRgn( pRect->left, pRect->top,
+ pRect->right, pRect->bottom );
+ }
+ else
+ {
+ ULONG nSize = maObjectData.mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
+ hRegion = ExtCreateRegion( NULL, nSize, maObjectData.mpClipRgnData );
+ if ( maObjectData.mpClipRgnData != maObjectData.mpStdClipRgnData )
+ delete maObjectData.mpClipRgnData;
+ }
+
+ DBG_ASSERT( hRegion, "SalObject::EndSetClipRegion() - Can't create ClipRegion" );
+ SetWindowRgn( maObjectData.mhWnd, hRegion, TRUE );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
+{
+#ifdef WIN
+ ULONG nStyle = 0;
+ BOOL bVisible = (GetWindowStyle( maObjectData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( bVisible )
+ {
+ ShowWindow( maObjectData.mhWnd, SW_HIDE );
+ nStyle |= SWP_SHOWWINDOW;
+ }
+ SetWindowPos( maObjectData.mhWnd, 0,
+ (int)nX, (int)nY, (int)nWidth, (int)nHeight,
+ SWP_NOZORDER | SWP_NOACTIVATE | nStyle );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::Show( BOOL bVisible )
+{
+#ifdef WIN
+ if ( bVisible )
+ ShowWindow( maObjectData.mhWnd, SW_SHOWNORMAL );
+ else
+ ShowWindow( maObjectData.mhWnd, SW_HIDE );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::Enable( BOOL bEnable )
+{
+#ifdef WIN
+ EnableWindow( maObjectData.mhWnd, bEnable );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::GrabFocus()
+{
+#ifdef WIN
+ if ( maObjectData.mhLastFocusWnd &&
+ IsWindow( maObjectData.mhLastFocusWnd ) &&
+ ImplIsSysWindowOrChild( maObjectData.mhWndChild, maObjectData.mhLastFocusWnd ) )
+ ::SetFocus( maObjectData.mhLastFocusWnd );
+ else
+ ::SetFocus( maObjectData.mhWndChild );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground( SalColor nSalColor )
+{
+}
+
+// -----------------------------------------------------------------------
+
+const SystemEnvData* SalObject::GetSystemData() const
+{
+ return &maObjectData.maSysData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc )
+{
+ maObjectData.mpInst = pInst;
+ if ( pProc )
+ maObjectData.mpProc = pProc;
+ else
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+}
diff --git a/vcl/os2/inc/saldata.hxx b/vcl/os2/inc/saldata.hxx
new file mode 100644
index 000000000000..fb835f8a45cd
--- /dev/null
+++ b/vcl/os2/inc/saldata.hxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldata.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALDATA_HXX
+#define _SV_SALDATA_HXX
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+
+class SalFrame;
+class SalObject;
+
+// --------------
+// - SalIMEData -
+// --------------
+
+#define ENABLE_IME
+
+#ifdef ENABLE_IME
+
+struct SalIMEData;
+
+#ifdef OS2IM_INCLUDED
+
+typedef APIRET (APIENTRY ImAssociateInstanceFunc)( HWND hwnd, HIMI himi, PHIMI phimiPrev );
+typedef APIRET (APIENTRY ImGetInstanceFunc)( HWND hwnd, PHIMI phimi );
+typedef APIRET (APIENTRY ImReleaseInstanceFunc)( HWND hwnd, HIMI himi );
+typedef APIRET (APIENTRY ImSetConversionFontFunc)( HIMI himi, PFATTRS pFontAttrs );
+typedef APIRET (APIENTRY ImSetConversionFontSizeFunc)( HIMI himi, PSIZEF psizfxBox );
+typedef APIRET (APIENTRY ImGetConversionStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen );
+typedef APIRET (APIENTRY ImGetResultStringFunc)( HIMI himi, ULONG ulIndex, PVOID pBuf, PULONG pulBufLen );
+typedef APIRET (APIENTRY ImSetCandidateWindowPosFunc)( HIMI himi, PCANDIDATEPOS pCandidatePos );
+typedef APIRET (APIENTRY ImQueryIMEPropertyFunc)( HIMI himi, ULONG ulIndex, PULONG pulProp );
+typedef APIRET (APIENTRY ImRequestIMEFunc)( HIMI himi, ULONG ulAction, ULONG ulIndex, ULONG ulValue );
+typedef APIRET (APIENTRY ImSetIMModeFunc)( HIMI himi, ULONG ulInputMode, ULONG ulConversionMode );
+typedef APIRET (APIENTRY ImQueryIMModeFunc)( HIMI himi, PULONG pulInputMode, PULONG pulConversionMode );
+
+struct SalIMEData
+{
+ HMODULE mhModIME;
+ ImAssociateInstanceFunc* mpAssocIME;
+ ImGetInstanceFunc* mpGetIME;
+ ImReleaseInstanceFunc* mpReleaseIME;
+ ImSetConversionFontFunc* mpSetConversionFont;
+ ImSetConversionFontSizeFunc* mpSetConversionFontSize;
+ ImGetConversionStringFunc* mpGetConversionString;
+ ImGetResultStringFunc* mpGetResultString;
+ ImSetCandidateWindowPosFunc* mpSetCandidateWin;
+ ImQueryIMEPropertyFunc* mpQueryIMEProperty;
+ ImRequestIMEFunc* mpRequestIME;
+ ImSetIMModeFunc* mpSetIMEMode;
+ ImQueryIMModeFunc* mpQueryIMEMode;
+};
+
+#endif
+
+#endif
+
+// -----------
+// - SalData -
+// -----------
+
+struct SalData
+{
+ HAB mhAB; // anchor block handle
+ HMQ mhMQ; // handle of os2 message queue
+ int mnArgc; // commandline param count
+ char** mpArgv; // commandline
+ ULONG mnNewTimerMS; // Neue Zeit, mit dem der Timer gestartet werden soll
+ PM_ULONG mnTimerId; // os2 timer id
+ SALTIMERPROC mpTimerProc; // timer callback proc
+ HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message
+ AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test
+ SalInstance* mpFirstInstance; // pointer of first instance
+ SalFrame* mpFirstFrame; // pointer of first frame
+ SalFrame* mpDummyFrame; // Dummy-Frame
+ SalFrame* mpCreateFrame; // Create-Frame for WM_CREATE
+ SalFrame* mpDefaultFrame; // Default-Frame (App-Fenster)
+ SalObject* mpFirstObject; // pointer of first object window
+ ULONG mnAppThreadId; // Id from Applikation-Thread
+ ULONG mnFontMetricCount; // number of entries in the font list
+ PFONTMETRICS mpFontMetrics; // cached font list
+ BOOL mbObjClassInit; // Ist SALOBJECTCLASS initialised
+#ifdef ENABLE_IME
+ SalIMEData* mpIMEData; // SalIME-Data
+ BOOL mbIMEInit; // SalIME-Data-Init
+#endif
+};
+
+inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
+inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
+inline SalData* GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
+
+// --------------
+// - SalShlData -
+// --------------
+
+#define OS2_VER_211 211
+#define OS2_VER_WARP3 230
+#define OS2_VER_WARP4 240
+
+struct SalShlData
+{
+ HMODULE mhMod; // Module handle of SAL-DLL
+ USHORT mnVersion; // 211 = OS2 2.11; 230 = OS2 3.0; 240 = OS2 4.0
+ PFNWP mpOldFrameProc; // old frame proc
+};
+
+extern SalShlData aSalShlData;
+
+BOOL SalImplHandleProcessMenu( HWND hWnd, PM_ULONG nMsg, MPARAM nMP1, MPARAM nMP2 );
+
+// SALSHL.CXX - Funktionen fuer DLL-Resource-Zugriffe
+HPOINTER ImplLoadPointer( ULONG nId );
+
+// --------------
+// - Prototypes -
+// --------------
+
+// \\OS2\SOURCE\APP\SALINST.CXX
+ULONG ImplSalGetCurrentThreadId();
+BOOL ImplSalYieldMutexTryToAcquire();
+void ImplSalYieldMutexAcquire();
+void ImplSalYieldMutexRelease();
+
+// \\OS2\SOURCE\WINDOW\SALFRAME.CXX
+MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, PM_ULONG nMsg, MPARAM nMP1, MPARAM nMP2 );
+MRESULT EXPENTRY SalFrameFrameProc( HWND hWnd, PM_ULONG nMsg, MPARAM nMP1, MPARAM nMP2 );
+
+// \\OS2\SOURCE\WINDOW\SALFRAME.CXX
+// return Frame for Message-Handling
+SalFrame* GetSalDefaultFrame();
+
+// \\OS2\SOURCE\WINDOW\SALFRAME.CXX
+// IME-Daten wieder freigeben
+#ifdef ENABLE_IME
+void ImplReleaseSALIMEData();
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define SAL_PROFILE_APPNAME ((PSZ)"StarOffice")
+#define SAL_PROFILE_USEDJP ((PSZ)"UseDJP")
+#define SAL_PROFILE_PRINTDJP ((PSZ)"PrintDJP")
+#define SAL_PROFILE_PRINTRAW ((PSZ)"PrintRAW")
+
+#define SAL_FRAME_WNDEXTRA sizeof(PM_ULONG)
+#define SAL_FRAME_THIS 0
+#define SAL_FRAME_CLASSNAME "SALFRAME"
+#define SAL_OBJECT_WNDEXTRA sizeof(PM_ULONG)
+#define SAL_OBJECT_THIS 0
+#define SAL_OBJECT_CLASSNAME "SALOBJECT"
+#define SAL_OBJECT_CHILDCLASSNAME "SALOBJECTCHILD"
+#define SAL_OBJECT_CLIPCLASSNAME "SALOBJECTCLIP"
+#define SAL_COM_CLASSNAME "SALCOMWND"
+
+#define SAL_MOUSELEAVE_TIMEOUT 300
+
+// MP1 == 0; MP2 == pData
+#define SAL_MSG_USEREVENT (WM_USER+111)
+// MP1 == 0; MP2 == MousePosition relativ to upper left of screen
+#define SAL_MSG_MOUSELEAVE (WM_USER+112)
+// MP1 == hDC; MP2 == 0
+#define SAL_MSG_PRINTABORTJOB (WM_USER+113)
+// MP1 == 0; MP2 == 0
+#define SAL_MSG_STARTTIMER (WM_USER+114)
+// MP1 == nFrameStyle; MP2 == pParent; lResult pFrame
+#define SAL_MSG_CREATEFRAME (WM_USER+115)
+// MP1 == 0; MP2 == pParent; lResult pObject
+#define SAL_MSG_CREATEOBJECT (WM_USER+116)
+// MP1 == bWait; MP2 == pMutex
+#define SAL_MSG_THREADYIELD (WM_USER+117)
+// MP1 == 0; MP2 == 0
+#define SAL_MSG_RELEASEWAITYIELD (WM_USER+118)
+// MP1 == 0; MP2 == pData
+#define SAL_MSG_SYSPROCESSMENU (WM_USER+119)
+// POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0)
+#define SAL_MSG_POSTFOCUS (WM_USER+120)
+// POSTSIZE-Message; MP1 == nMP1; MP2 == nMP2
+#define SAL_MSG_POSTSIZE (WM_USER+121)
+
+// SysChild-ToTop; nMP1 = 0; nMP2 = 0
+#define SALOBJ_MSG_TOTOP (WM_USER+150)
+// POSTFOCUS-Message; MP1 == nMP1; MP2 == nMP2 (SHORT1( bFocus ), 0)
+#define SALOBJ_MSG_POSTFOCUS (WM_USER+151)
+
+// -----------------
+// - Helpfunctions -
+// -----------------
+
+inline void SetWindowPtr( HWND hWnd, SalFrame* pThis )
+{
+ WinSetWindowULong( hWnd, SAL_FRAME_THIS, (PM_ULONG)pThis );
+}
+
+inline SalFrame* GetWindowPtr( HWND hWnd )
+{
+ return (SalFrame*)WinQueryWindowULong( hWnd, SAL_FRAME_THIS );
+}
+
+inline void SetSalObjWindowPtr( HWND hWnd, SalObject* pThis )
+{
+ WinSetWindowULong( hWnd, SAL_OBJECT_THIS, (PM_ULONG)pThis );
+}
+
+inline SalObject* GetSalObjWindowPtr( HWND hWnd )
+{
+ return (SalObject*)WinQueryWindowULong( hWnd, SAL_OBJECT_THIS );
+}
+
+#endif // _SV_SALDATA_HXX
diff --git a/vcl/os2/inc/salframe.h b/vcl/os2/inc/salframe.h
new file mode 100644
index 000000000000..6d71e5c457d4
--- /dev/null
+++ b/vcl/os2/inc/salframe.h
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALFRAME_H
+#define _SV_SALFRAME_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+class SalFrame;
+
+// ----------------
+// - SalFrameData -
+// ----------------
+
+class SalFrameData
+{
+public:
+ HWND mhWndFrame; // HWND-Frame
+ HWND mhWndClient; // HWND-Client
+ HAB mhAB; // HAB
+ HPOINTER mhPointer; // Current MousePointer
+ void* mpInst; // VCL-Instance
+ SALFRAMEPROC mpProc; // VCL-Proc
+ SalGraphics* mpGraphics; // current frame graphics
+ SalFrame* mpNextFrame; // pointer to next frame
+ SalFrameState maState; // frame state
+ SystemEnvData maSysData; // system data
+ ULONG mnStyle; // SalFrameStyle
+ PM_ULONG mnOS2Style; // OS2-CreationFrameStyle
+ long mnWidth; // Window-Witdth
+ long mnHeight; // Window-Height
+ SWP maFullScreenRect; // WindowRect befor FullScreenMode
+ BOOL mbFullScreen; // is in fullscreenmode
+ BOOL mbGraphics; // is Graphics used
+ BOOL mbAllwayOnTop; // Allways on top modus
+ BOOL mbVisible; // Visible Show/Hide-Status
+ BOOL mbMinHide; // hide called from OS2
+ BOOL mbInShow; // innerhalb eines Show/Hide-Aufrufs
+ BOOL mbRestoreMaximize; // Restore-Maximize
+ BOOL mbInMoveMsg; // Move-Message wird verarbeitet
+ BOOL mbInSizeMsg; // Size-Message wird verarbeitet
+ BOOL mbDefPos; // default-position
+ BOOL mbOverwriteState; // TRUE: WindowState darf umgesetzt werden
+ BOOL mbHandleIME; // TRUE: Wir handeln die IME-Messages
+ BOOL mbConversionMode; // TRUE: Wir befinden uns im Conversion-Modus
+ BOOL mbCandidateMode; // TRUE: Wir befinden uns im Candidate-Modus
+};
+
+#endif // _SV_SALFRAME_H
diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h
new file mode 100644
index 000000000000..b2afac448744
--- /dev/null
+++ b/vcl/os2/inc/salgdi.h
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALGDI_H
+#define _SV_SALGDI_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+// -------------------
+// - SalGraphicsData -
+// -------------------
+
+class SalGraphicsData
+{
+public:
+ HPS mhPS; // HPS
+ HDC mhDC; // HDC
+ HWND mhWnd; // HWND
+ LONG mnHeight; // Height of frame Window
+ ULONG mnClipElementCount; // number of clip rects in clip rect array
+ RECTL* mpClipRectlAry; // clip rect array
+ ULONG mnFontMetricCount; // number of entries in the font list
+ PFONTMETRICS mpFontMetrics; // cached font list
+ LONG mnOrientationX; // X-Font orientation
+ LONG mnOrientationY; // Y-Font orientation
+ BOOL mbFontIsOutline; // is outline font
+ BOOL mbFontIsFixed; // is fixed font
+ BOOL mbLine; // draw lines
+ BOOL mbFill; // fill areas
+ BOOL mbPrinter; // is Printer
+ BOOL mbVirDev; // is VirDev
+ BOOL mbWindow; // is Window
+ BOOL mbScreen; // is Screen compatible
+ BOOL mbXORMode; // _every_ output with RasterOp XOR
+};
+
+// Init/Deinit Graphics
+void ImplSalInitGraphics( SalGraphicsData* mpData );
+void ImplSalDeInitGraphics( SalGraphicsData* mpData );
+
+// -----------
+// - Defines -
+// -----------
+
+#define RGBCOLOR(r,g,b) ((ULONG)(((BYTE)(b)|((USHORT)(g)<<8))|(((ULONG)(BYTE)(r))<<16)))
+#define TY( y ) (maGraphicsData.mnHeight-(y)-1)
+
+#endif // _SV_SALGDI_H
diff --git a/vcl/os2/inc/salids.hrc b/vcl/os2/inc/salids.hrc
new file mode 100644
index 000000000000..0a04771edd9a
--- /dev/null
+++ b/vcl/os2/inc/salids.hrc
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * $RCSfile: salids.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALIDS_HRC
+#define _SV_SALIDS_HRC
+
+// Pointer
+#define SAL_RESID_POINTER_NULL 10000
+#define SAL_RESID_POINTER_HELP 10001
+#define SAL_RESID_POINTER_CROSS 10002
+#define SAL_RESID_POINTER_MOVE 10003
+#define SAL_RESID_POINTER_HSPLIT 10004
+#define SAL_RESID_POINTER_VSPLIT 10005
+#define SAL_RESID_POINTER_HSIZEBAR 10006
+#define SAL_RESID_POINTER_VSIZEBAR 10007
+#define SAL_RESID_POINTER_HAND 10008
+#define SAL_RESID_POINTER_REFHAND 10009
+#define SAL_RESID_POINTER_PEN 10010
+#define SAL_RESID_POINTER_MAGNIFY 10011
+#define SAL_RESID_POINTER_FILL 10012
+#define SAL_RESID_POINTER_ROTATE 10013
+#define SAL_RESID_POINTER_HSHEAR 10014
+#define SAL_RESID_POINTER_VSHEAR 10015
+#define SAL_RESID_POINTER_MIRROR 10016
+#define SAL_RESID_POINTER_CROOK 10017
+#define SAL_RESID_POINTER_CROP 10018
+#define SAL_RESID_POINTER_MOVEPOINT 10019
+#define SAL_RESID_POINTER_MOVEBEZIERWEIGHT 10020
+#define SAL_RESID_POINTER_MOVEDATA 10021
+#define SAL_RESID_POINTER_COPYDATA 10022
+#define SAL_RESID_POINTER_LINKDATA 10023
+#define SAL_RESID_POINTER_MOVEDATALINK 10024
+#define SAL_RESID_POINTER_COPYDATALINK 10025
+#define SAL_RESID_POINTER_MOVEFILE 10026
+#define SAL_RESID_POINTER_COPYFILE 10027
+#define SAL_RESID_POINTER_LINKFILE 10028
+#define SAL_RESID_POINTER_MOVEFILELINK 10029
+#define SAL_RESID_POINTER_COPYFILELINK 10030
+#define SAL_RESID_POINTER_MOVEFILES 10031
+#define SAL_RESID_POINTER_COPYFILES 10032
+#define SAL_RESID_POINTER_DRAW_LINE 10033
+#define SAL_RESID_POINTER_DRAW_RECT 10034
+#define SAL_RESID_POINTER_DRAW_POLYGON 10035
+#define SAL_RESID_POINTER_DRAW_BEZIER 10036
+#define SAL_RESID_POINTER_DRAW_ARC 10037
+#define SAL_RESID_POINTER_DRAW_PIE 10038
+#define SAL_RESID_POINTER_DRAW_CIRCLECUT 10039
+#define SAL_RESID_POINTER_DRAW_ELLIPSE 10040
+#define SAL_RESID_POINTER_DRAW_FREEHAND 10041
+#define SAL_RESID_POINTER_DRAW_CONNECT 10042
+#define SAL_RESID_POINTER_DRAW_TEXT 10043
+#define SAL_RESID_POINTER_DRAW_CAPTION 10044
+#define SAL_RESID_POINTER_CHART 10045
+#define SAL_RESID_POINTER_DETECTIVE 10046
+#define SAL_RESID_POINTER_PIVOT_COL 10047
+#define SAL_RESID_POINTER_PIVOT_ROW 10048
+#define SAL_RESID_POINTER_PIVOT_FIELD 10049
+#define SAL_RESID_POINTER_CHAIN 10050
+#define SAL_RESID_POINTER_CHAIN_NOTALLOWED 10051
+#define SAL_RESID_POINTER_TIMEEVENT_MOVE 10052
+#define SAL_RESID_POINTER_TIMEEVENT_SIZE 10053
+#define SAL_RESID_POINTER_AUTOSCROLL_N 10054
+#define SAL_RESID_POINTER_AUTOSCROLL_S 10055
+#define SAL_RESID_POINTER_AUTOSCROLL_W 10056
+#define SAL_RESID_POINTER_AUTOSCROLL_E 10057
+#define SAL_RESID_POINTER_AUTOSCROLL_NW 10058
+#define SAL_RESID_POINTER_AUTOSCROLL_NE 10059
+#define SAL_RESID_POINTER_AUTOSCROLL_SW 10060
+#define SAL_RESID_POINTER_AUTOSCROLL_SE 10061
+#define SAL_RESID_POINTER_AUTOSCROLL_NS 10062
+#define SAL_RESID_POINTER_AUTOSCROLL_WE 10063
+#define SAL_RESID_POINTER_AUTOSCROLL_NSWE 10064
+
+#define SAL_RESID_ICON_SD 12000
+
+#endif // _SV_SALIDS_HRC
diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h
new file mode 100644
index 000000000000..cae8cb62c3ee
--- /dev/null
+++ b/vcl/os2/inc/salinst.h
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALINST_H
+#define _SV_SALINST_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+#ifdef _VOS_NO_NAMESPACE
+class OMutex;
+#else
+namespace vos { class OMutex; }
+#endif
+class SalYieldMutex;
+class SalInstance;
+class SalFrame;
+class SalObject;
+
+// -------------------
+// - SalInstanceData -
+// -------------------
+
+#define SAL_COMMANDLINENOINIT ((USHORT)0xFFFF)
+#define SAL_MAXPARAM 40
+
+class SalInstanceData
+{
+public:
+ HAB mhAB; // anchor block handle
+ HMQ mhMQ; // handle of os2 message queue
+ HPOINTER mhAppIcon; // app icon
+ int mnArgc; // commandline param count
+ char** mpArgv; // commandline
+ HWND mhComWnd; // window, for communication (between threads and the main thread)
+ void* mpFilterInst; // hack for clipboard
+ void* mpFilterCallback; // hack for clipboard
+ SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex
+#ifdef _VOS_NO_NAMESPACE
+ OMutex* mpSalWaitMutex; // Sal-Wait-Mutex
+#else
+ vos::OMutex* mpSalWaitMutex; // Sal-Wait-Mutex
+#endif
+};
+
+SalFrame* ImplSalCreateFrame( SalInstance* pInst, SalFrame* pParent, ULONG nSalFrameStyle );
+SalObject* ImplSalCreateObject( SalInstance* pInst, SalFrame* pParent );
+void ImplSalStartTimer();
+
+#endif // _SV_SALINST_H
diff --git a/vcl/os2/inc/sallang.hxx b/vcl/os2/inc/sallang.hxx
new file mode 100644
index 000000000000..736613e59ec3
--- /dev/null
+++ b/vcl/os2/inc/sallang.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * $RCSfile: sallang.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SALLANG_HXX
+#define _SALLANG_HXX
+
+#ifndef _TOOLS_LANG_HXX
+#include <tools/lang.hxx>
+#endif
+
+// --------------------
+// - Language Strings -
+// --------------------
+
+// --- Key-Namen ---
+#define LSTR_KEY_SHIFT 0
+#define LSTR_KEY_CTRL 1
+#define LSTR_KEY_ALT 2
+#define LSTR_KEY_UP 3
+#define LSTR_KEY_DOWN 4
+#define LSTR_KEY_LEFT 5
+#define LSTR_KEY_RIGHT 6
+#define LSTR_KEY_HOME 7
+#define LSTR_KEY_END 8
+#define LSTR_KEY_PAGEUP 9
+#define LSTR_KEY_PAGEDOWN 10
+#define LSTR_KEY_RETURN 11
+#define LSTR_KEY_ESC 12
+#define LSTR_KEY_TAB 13
+#define LSTR_KEY_BACKSPACE 14
+#define LSTR_KEY_SPACE 15
+#define LSTR_KEY_INSERT 16
+#define LSTR_KEY_DELETE 17
+
+// --- Anzahl der Texte ---
+
+#define LSTR_COUNT 18
+
+// --------------------------------------------
+// - Methoden zum Abfragen der Sprach-Strings -
+// --------------------------------------------
+
+const char** ImplGetLangTab( LanguageType eLang );
+
+#endif // _SALLANG_HXX
diff --git a/vcl/os2/inc/salobj.h b/vcl/os2/inc/salobj.h
new file mode 100644
index 000000000000..a8c80f474e88
--- /dev/null
+++ b/vcl/os2/inc/salobj.h
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALOBJ_H
+#define _SV_SALOBJ_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+// -----------------
+// - SalObjectData -
+// -----------------
+
+class SalObjectData
+{
+public:
+ HWND mhWnd; // Window handle
+ HWND mhWndChild; // Child Window handle
+ HWND mhLastFocusWnd; // Child-Window, welches als letztes den Focus hatte
+ SystemChildData maSysData; // SystemEnvData
+ HWND mhLastClipWnd; // LastClip-Window
+ HWND mhOldLastClipWnd; // LastClip-Window befor BeginSetClipRegion
+ long mnHeight; // Fenster-Hoehe fuer Positionsumrechnung
+ SalObject* mpNextObject; // pointer to next object
+ void* mpInst; // instance handle for callback
+ SALOBJECTPROC mpProc; // callback proc
+};
+
+#endif // _SV_SALOBJ_H
diff --git a/vcl/os2/inc/salprn.h b/vcl/os2/inc/salprn.h
new file mode 100644
index 000000000000..1b151ad1ae2e
--- /dev/null
+++ b/vcl/os2/inc/salprn.h
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * $RCSfile: salprn.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALPRN_H
+#define _SV_SALPRN_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalGraphics;
+class SalInfoPrinter;
+
+struct ImplFormInfo;
+typedef ImplFormInfo* PIMPLFORMINFO;
+struct ImplTrayInfo;
+typedef ImplTrayInfo* PIMPLTRAYINFO;
+
+// ----------------------
+// - SalInfoPrinterData -
+// ----------------------
+
+class SalInfoPrinterData
+{
+public:
+ SalGraphics* mpGraphics; // Graphics
+ HDC mhDC; // printer hdc
+ HPS mhPS; // printer hps
+ String maPrinterName; // pszPrinters
+ String maName; // pszName bzw. LogAdress
+ String maDriverName; // pszDriverName nach .
+ String maDeviceName; // pszDriverName bis .
+ String maJobSetupDeviceName; // DeviceName aus pDriverData
+ PIMPLFORMINFO* mpFormArray; // PaperForm-Names
+ USHORT mnFormCount; // PaperForm-Count
+ PIMPLTRAYINFO* mpTrayArray; // PaperTray-Names
+ USHORT mnTrayCount; // PaperTray-Count
+ BOOL mbDJPSupported; // is driver DJP enabled
+ BOOL mbGraphics; // is Graphics used
+};
+
+// ------------------
+// - SalPrinterData -
+// ------------------
+
+class SalPrinterData
+{
+public:
+ SalGraphics* mpGraphics; // current Printer graphics
+ SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter
+ HDC mhDC; // printer hdc
+ HPS mhPS; // printer hps
+ ULONG mnError; // Error Code
+ BOOL mbFirstPage; // IsFirstPage
+ BOOL mbAbort; // JobAborted
+ BOOL mbPrintDJPSupported; // is driver PrintDJP enabled (DEVESC_NEWFRAME_WPROP)
+ char maCommentBuf[33]; // Comment
+ char maCopyBuf[10]; // Kopien
+};
+
+#endif // _SV_SALPRN_H
diff --git a/vcl/os2/inc/salsound.hxx b/vcl/os2/inc/salsound.hxx
new file mode 100644
index 000000000000..e766d8df869f
--- /dev/null
+++ b/vcl/os2/inc/salsound.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsound.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALSOUND_HXX
+#define _SV_SALSOUND_HXX
+
+#ifndef _GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOTYPE_HXX
+#include <salstype.hxx>
+#endif
+
+// ------------
+// - SalSound -
+// ------------
+
+class SalSound
+{
+private:
+
+ static HMODULE mhMCILib;
+ static ULONG mnSoundState;
+ static void* mpMCIFnc;
+ SALSOUNDPROC mpProc;
+ void* mpInst;
+ ULONG mnStartTime;
+ ULONG mnPlayLen;
+ HWND mhSoundWnd;
+ USHORT mnDeviceId;
+ BOOL mbLoop;
+ BOOL mbPaused;
+
+public:
+
+ void ImplSetError( ULONG nMciErr );
+ void ImplNotify( SoundNotification eNotification, ULONG nError );
+
+public:
+
+ SalSound();
+ ~SalSound();
+
+ BOOL Create();
+ static void Release();
+ static BOOL IsValid() { return( SOUND_STATE_VALID == SalSound::mnSoundState ); }
+
+ BOOL Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen );
+ BOOL Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen );
+ void Play( ULONG nStartTime, ULONG nPlayTime, BOOL bLoop );
+ void Stop();
+ void Pause();
+
+ void SetNotifyProc( void* pInst, SALSOUNDPROC pProc )
+ { mpInst = pInst; mpProc = pProc; }
+};
+
+#endif // _SV_SALSOUND_HXX
diff --git a/vcl/os2/inc/salsys.h b/vcl/os2/inc/salsys.h
new file mode 100644
index 000000000000..49f5e0659f58
--- /dev/null
+++ b/vcl/os2/inc/salsys.h
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALSYS_H
+#define _SV_SALSYS_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalFrame;
+
+// -----------------
+// - SalSystemData -
+// -----------------
+
+class SalSystemData
+{
+};
+
+#endif // _SV_SALSYS_H
diff --git a/vcl/os2/inc/salvd.h b/vcl/os2/inc/salvd.h
new file mode 100644
index 000000000000..e95248eec69e
--- /dev/null
+++ b/vcl/os2/inc/salvd.h
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALVD_H
+#define _SV_SALVD_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalGraphics;
+
+// -----------------
+// - SalVirDevData -
+// -----------------
+
+class SalVirDevData
+{
+public:
+ HPS mhPS; // HPS
+ HDC mhDC; // HDC
+ HBITMAP mhBmp; // Memory Bitmap
+ HBITMAP mhDefBmp; // Default Bitmap
+ SalGraphics* mpGraphics; // current VirDev graphics
+ USHORT mnBitCount; // BitCount (0 or 1)
+ BOOL mbGraphics; // is Graphics used
+};
+
+// Help-Functions
+HBITMAP ImplCreateVirDevBitmap( HDC hDC, HPS hPS, long nDX, long nDY,
+ USHORT nBitCount );
+
+#endif // _SV_SALVD_H
diff --git a/vcl/os2/inc/svsys.h b/vcl/os2/inc/svsys.h
new file mode 100644
index 000000000000..23f834d48550
--- /dev/null
+++ b/vcl/os2/inc/svsys.h
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: svsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVSYS_H
+#define _SV_SVSYS_H
+
+#ifndef _SVPM_H
+#include <tools/svpm.h>
+#endif
+
+#endif // _SV_SVSYS_H
diff --git a/vcl/os2/source/app/makefile.mk b/vcl/os2/source/app/makefile.mk
new file mode 100644
index 000000000000..e83b8f3a4f11
--- /dev/null
+++ b/vcl/os2/source/app/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SV
+TARGET=salapp
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= salmain.cxx \
+ salshl.cxx \
+ salinst.cxx \
+ sallang.cxx \
+ saltimer.cxx \
+ salsound.cxx \
+ salsys.cxx
+
+OBJFILES= $(OBJ)$/salmain.obj
+
+SLOFILES= $(SLO)$/salshl.obj \
+ $(SLO)$/salinst.obj \
+ $(SLO)$/sallang.obj \
+ $(SLO)$/saltimer.obj \
+ $(SLO)$/salsound.obj \
+ $(SLO)$/salsys.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx
new file mode 100644
index 000000000000..8a3ef0d1315f
--- /dev/null
+++ b/vcl/os2/source/app/salinst.cxx
@@ -0,0 +1,754 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define INCL_DOSMISC
+#define INCL_DOSMODULEMGR
+#define INCL_DOSPROCESS
+
+#include <string.h>
+#include <tools/svpm.h>
+#include <process.h>
+
+#define _SV_SALINST_CXX
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+
+#define SVMODULENAME "VCL" MAKE_NUMSTR( SUPD ) __DLLEXTENSION
+
+// =======================================================================
+
+void SalSetExceptionHandler( SALEXCEPTIONPROC pProc )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalAbort( const XubString& rErrorText )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ULONG ImplSalGetCurrentThreadId()
+{
+ PTIB pptib = NULL;
+ PPIB pppib = NULL;
+
+ DosGetInfoBlocks( &pptib, &pppib );
+ return pptib->tib_ptib2->tib2_ultid;
+}
+
+// =======================================================================
+
+class SalYieldMutex : public NAMESPACE_VOS(OMutex)
+{
+public:
+ SalInstanceData* mpInstData;
+ ULONG mnCount;
+ ULONG mnWaitCount;
+ ULONG mnThreadId;
+
+public:
+ SalYieldMutex( SalInstanceData* pInstData );
+
+ virtual void acquire();
+ virtual void release();
+ virtual Boolean tryToAcquire();
+
+ ULONG GetAcquireCount( ULONG nThreadId );
+};
+
+// -----------------------------------------------------------------------
+
+SalYieldMutex::SalYieldMutex( SalInstanceData* pInstData )
+{
+ mpInstData = pInstData;
+ mnCount = 0;
+ mnThreadId = 0;
+ mnWaitCount = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SalYieldMutex::acquire()
+{
+ OMutex::acquire();
+ mnCount++;
+ mnThreadId = ImplSalGetCurrentThreadId();
+}
+
+// -----------------------------------------------------------------------
+
+void SalYieldMutex::release()
+{
+ ULONG nThreadId = ImplSalGetCurrentThreadId();
+ if ( mnThreadId != nThreadId )
+ OMutex::release();
+ else
+ {
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mnAppThreadId != nThreadId )
+ {
+ NAMESPACE_VOS(OGuard) aGuard( mpInstData->mpSalWaitMutex );
+ if ( mnCount == 1 )
+ {
+ if ( mnWaitCount && WinPostMsg( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 ) )
+ mnWaitCount--;
+ mnThreadId = 0;
+ }
+ mnCount--;
+ OMutex::release();
+ }
+ else
+ {
+ if ( mnCount == 1 )
+ mnThreadId = 0;
+ mnCount--;
+ OMutex::release();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Boolean SalYieldMutex::tryToAcquire()
+{
+ if ( OMutex::tryToAcquire() )
+ {
+ mnCount++;
+ mnThreadId = ImplSalGetCurrentThreadId();
+ return True;
+ }
+ else
+ return False;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalYieldMutex::GetAcquireCount( ULONG nThreadId )
+{
+ if ( nThreadId == mnThreadId )
+ return mnCount;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplSalYieldMutexTryToAcquire()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ return pSalData->mpFirstInstance->maInstData.mpSalYieldMutex->tryToAcquire();
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexAcquire()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ pSalData->mpFirstInstance->maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexRelease()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ pSalData->mpFirstInstance->maInstData.mpSalYieldMutex->release();
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+
+void ImplDbgTestSolarMutex()
+{
+ SalData* pSalData = GetSalData();
+ ULONG nCurThreadId = ImplSalGetCurrentThreadId();
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" );
+ }
+ }
+ }
+ else
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked in the main thread" );
+ }
+ }
+ }
+}
+
+#endif
+
+// =======================================================================
+
+void InitSalSystemData()
+{
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalYield( BOOL bWait, BOOL bMainThread, SalYieldMutex* pYieldMutex )
+{
+ QMSG aMsg;
+ QMSG aTmpMsg;
+ BOOL bDispatch = FALSE;
+ USHORT nPostReleaseWait = 0;
+ static QMSG* pMsg = NULL;
+ SalData* pSalData = GetSalData();
+
+ do
+ {
+ if ( !pMsg )
+ {
+ BOOL bQuit = FALSE;
+ if ( bWait )
+ {
+ if ( WinGetMsg( pSalData->mhAB, &aMsg, 0, 0, 0 ) )
+ pMsg = &aMsg;
+ else
+ bQuit = TRUE;
+ }
+ else
+ {
+ if ( WinPeekMsg( pSalData->mhAB, &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ if ( aMsg.msg == WM_QUIT )
+ bQuit = TRUE;
+ else
+ pMsg = &aMsg;
+ }
+ }
+
+ // ShutDown-Event ausloesen (ist immer dann der Fall,
+ // wenn wir eine Quit-Message bekommen)
+ if ( bQuit && pSalData->mpDefaultFrame )
+ {
+ SalFrame* pDefaultFrame = pSalData->mpDefaultFrame;
+ if ( pDefaultFrame->maFrameData.mpProc( pDefaultFrame->maFrameData.mpInst, pDefaultFrame,
+ SALEVENT_SHUTDOWN, 0 ) )
+ WinCancelShutdown( pSalData->mhAB, FALSE );
+ }
+
+ // ReleaseWaitYield ignorieren wir, da diese fuer andere
+ // Yield-Aufrufe gedacht sind
+ if ( pMsg )
+ {
+ if ( pMsg->msg == SAL_MSG_RELEASEWAITYIELD )
+ {
+ nPostReleaseWait++;
+ pMsg = NULL;
+ continue;
+ }
+ }
+ }
+
+ if ( pMsg )
+ {
+ // Darf ich die Message dispatchen
+ pYieldMutex->mpInstData->mpSalWaitMutex->acquire();
+ if ( pYieldMutex->tryToAcquire() )
+ {
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ bDispatch = TRUE;
+ }
+ else
+ {
+ pYieldMutex->mnWaitCount++;
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ WinGetMsg( pSalData->mhAB, &aTmpMsg, pYieldMutex->mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD );
+ if ( !pMsg )
+ bDispatch = TRUE;
+ }
+ }
+ else
+ bDispatch = TRUE;
+ }
+ while( !bDispatch );
+
+ if ( pMsg )
+ {
+ // acquire ist nicht notwendig, da dies schon in der oberen
+ // Schleife bei tryToAcquire() gemacht wurde
+ QMSG* pTmpMsg = pMsg;
+ pMsg = NULL;
+ WinDispatchMsg( pSalData->mhAB, pTmpMsg );
+ pYieldMutex->release();
+ }
+
+ while ( nPostReleaseWait )
+ {
+ WinPostMsg( pYieldMutex->mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
+ nPostReleaseWait--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MRESULT EXPENTRY SalComWndProc( HWND hWnd, PM_ULONG nMsg,
+ MPARAM nMP1, MPARAM nMP2 )
+{
+ switch ( nMsg )
+ {
+ case SAL_MSG_STARTTIMER:
+ ImplSalStartTimer();
+ return 0;
+ case SAL_MSG_CREATEFRAME:
+ return (MRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (SalFrame*)(ULONG)nMP2, (ULONG)nMP1 );
+ case SAL_MSG_CREATEOBJECT:
+ return (MRESULT)ImplSalCreateObject( GetSalData()->mpFirstInstance, (SalFrame*)(ULONG)nMP2 );
+ case SAL_MSG_THREADYIELD:
+ ImplSalYield( (BOOL)(LONG)nMP1, FALSE, (SalYieldMutex*)(LONG)nMP2 );
+ return 0;
+ }
+
+ return WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 );
+}
+
+// =======================================================================
+
+void InitSalData()
+{
+ SalData* pSalData = new SalData;
+ memset( pSalData, 0, sizeof( SalData ) );
+ SetSalData( pSalData );
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitSalData()
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFontMetrics )
+ delete pSalData->mpFontMetrics;
+ delete pSalData;
+ SetSalData( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SetFilterCallback( void* pCallback, void* pInst )
+{
+ SalData* pSalData = GetSalData();
+ pSalData->mpFirstInstance->maInstData.mpFilterCallback = pCallback;
+ pSalData->mpFirstInstance->maInstData.mpFilterInst = pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance* CreateSalInstance()
+{
+ SalData* pSalData = GetSalData();
+ SalInstance* pInst = new SalInstance;
+
+ // determine Module-Handle for SVDLL
+ DosQueryModuleHandle( (PSZ)SVMODULENAME, &aSalShlData.mhMod );
+
+ // determine the os2 version
+ PM_ULONG nMayor;
+ PM_ULONG nMinor;
+ DosQuerySysInfo( QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &nMayor, sizeof( nMayor ) );
+ DosQuerySysInfo( QSV_VERSION_MINOR, QSV_VERSION_MINOR, &nMinor, sizeof( nMinor ) );
+ aSalShlData.mnVersion = (USHORT)(nMayor*10 + nMinor);
+
+ pSalData->mnAppThreadId = ImplSalGetCurrentThreadId();
+
+ // register frame class
+ if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_FRAME_CLASSNAME,
+ (PFNWP)SalFrameWndProc, CS_HITTEST | CS_MOVENOTIFY,
+ SAL_FRAME_WNDEXTRA ) )
+ {
+ delete pInst;
+ return NULL;
+ }
+
+ // register frame class
+ if ( !WinRegisterClass( pSalData->mhAB, (PSZ)SAL_COM_CLASSNAME,
+ (PFNWP)SalComWndProc, 0, 0 ))
+ {
+ delete pInst;
+ return NULL;
+ }
+
+ HWND hComWnd = WinCreateWindow( HWND_OBJECT, (PSZ)SAL_COM_CLASSNAME,
+ "", 0, 0, 0, 0, 0,
+ HWND_OBJECT, HWND_TOP,
+ 222, NULL, NULL);
+
+ // init system data
+ InitSalSystemData();
+
+ // init instance (only one instance in this version !!!)
+ pSalData->mpFirstInstance = pInst;
+ pInst->maInstData.mhAB = pSalData->mhAB;
+ pInst->maInstData.mhMQ = pSalData->mhMQ;
+ pInst->maInstData.mnArgc = pSalData->mnArgc;
+ pInst->maInstData.mpArgv = pSalData->mpArgv;
+ pInst->maInstData.mhComWnd = hComWnd;
+
+ // AppIcon ermitteln
+ pInst->maInstData.mhAppIcon = WinLoadPointer( HWND_DESKTOP, pSalData->mhAB, 1 );
+ if ( !pInst->maInstData.mhAppIcon )
+ pInst->maInstData.mhAppIcon = ImplLoadPointer( SAL_RESID_ICON_SD );
+
+ return pInst;
+}
+
+// -----------------------------------------------------------------------
+
+void DestroySalInstance( SalInstance* pInst )
+{
+ SalData* pSalData = GetSalData();
+
+ // (only one instance in this version !!!)
+
+#ifdef ENABLE_IME
+ // IME-Daten freigeben
+ if ( pSalData->mpIMEData )
+ ImplReleaseSALIMEData();
+#endif
+
+ // Destroy Dummy Frame
+ if ( pSalData->mpDummyFrame )
+ pInst->DestroyFrame( pSalData->mpDummyFrame );
+
+ // reset instance
+ if ( pSalData->mpFirstInstance == pInst )
+ pSalData->mpFirstInstance = NULL;
+
+ delete pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::SalInstance()
+{
+ maInstData.mpFilterCallback = NULL;
+ maInstData.mpFilterInst = NULL;
+
+ maInstData.mpSalWaitMutex = new NAMESPACE_VOS(OMutex);
+ maInstData.mpSalYieldMutex = new SalYieldMutex( &maInstData );
+ maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::~SalInstance()
+{
+ maInstData.mpSalYieldMutex->release();
+ delete maInstData.mpSalYieldMutex;
+ delete maInstData.mpSalWaitMutex;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInstance::AnyInput( USHORT nType )
+{
+ SalData* pSalData = GetSalData();
+ QMSG aQMSG;
+
+ if ( (nType & (INPUT_ANY)) == INPUT_ANY )
+ {
+ // Any Input
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) )
+ return TRUE;
+ }
+ else
+ {
+ if ( nType & INPUT_MOUSE )
+ {
+ // Test auf Mouseinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_KEYBOARD )
+ {
+ // Test auf Keyinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_CHAR, WM_CHAR, PM_NOREMOVE ) )
+ return !(SHORT1FROMMP( aQMSG.mp1 ) & KC_KEYUP);
+ }
+
+ if ( nType & INPUT_PAINT )
+ {
+ // Test auf Paintinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_PAINT, WM_PAINT, PM_NOREMOVE ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_TIMER )
+ {
+ // Test auf Timerinput
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0,
+ WM_TIMER, WM_TIMER, PM_NOREMOVE ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_OTHER )
+ {
+ // Test auf sonstigen Input
+ if ( WinPeekMsg( pSalData->mhAB, &aQMSG, 0, 0, 0, PM_NOREMOVE ) )
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::Yield( BOOL bWait )
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ SalData* pSalData = GetSalData();
+ ULONG nCurThreadId = ImplSalGetCurrentThreadId();
+ ULONG nCount = pYieldMutex->GetAcquireCount( nCurThreadId );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ WinSendMsg( maInstData.mhComWnd, SAL_MSG_THREADYIELD,
+ (MPARAM)bWait, (MPARAM)(void*)pYieldMutex );
+
+ n = nCount;
+ while ( n )
+ {
+ pYieldMutex->acquire();
+ n--;
+ }
+ }
+ else
+ {
+ ImplSalYield( bWait, TRUE, pYieldMutex );
+
+ n = nCount;
+ while ( n )
+ {
+ // Wenn wir den Mutex nicht bekommen, muessen wir solange
+ // warten, bis wir Ihn bekommen
+ pYieldMutex->mpInstData->mpSalWaitMutex->acquire();
+ if ( pYieldMutex->tryToAcquire() )
+ {
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ n--;
+ }
+ else
+ {
+ pYieldMutex->mnWaitCount++;
+ pYieldMutex->mpInstData->mpSalWaitMutex->release();
+ QMSG aTmpMsg;
+ WinGetMsg( pSalData->mhAB, &aTmpMsg, maInstData.mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInstance::GetFileName()
+{
+ String aFileName( maInstData.mpArgv[0] );
+ return aFileName;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalInstance::GetCommandLineParamCount()
+{
+ return maInstData.mnArgc-1;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInstance::GetCommandLineParam( USHORT nParam )
+{
+ if ( nParam < maInstData.mnArgc-1 )
+ {
+ String aParam( maInstData.mpArgv[nParam+1] );
+ return aParam;
+ }
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef _VOS_NO_NAMESPACE
+IMutex* SalInstance::GetYieldMutex()
+#else
+vos::IMutex* SalInstance::GetYieldMutex()
+#endif
+{
+ return maInstData.mpSalYieldMutex;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInstance::ReleaseYieldMutex()
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ ULONG nCount = pYieldMutex->GetAcquireCount( ImplSalGetCurrentThreadId() );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+
+ return nCount;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::AcquireYieldMutex( ULONG nCount )
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ while ( nCount )
+ {
+ pYieldMutex->acquire();
+ nCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* SalInstance::CreateFrame( SalFrame* pParent, USHORT nSalFrameStyle )
+{
+ // Um auf Main-Thread umzuschalten
+ return (SalFrame*)WinSendMsg( maInstData.mhComWnd, SAL_MSG_CREATEFRAME, (MPARAM)nSalFrameStyle, (MPARAM)pParent );
+}
+
+// -----------------------------------------------------------------------
+
+SalObject* SalInstance::CreateObject( SalFrame* pParent )
+{
+ // Um auf Main-Thread umzuschalten
+ return (SalObject*)WinSendMsg( maInstData.mhComWnd, SAL_MSG_CREATEOBJECT, 0, (MPARAM)pParent );
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Start( ULONG nMS )
+{
+ // Um auf Main-Thread umzuschalten
+ SalData* pSalData = GetSalData();
+ pSalData->mnNewTimerMS = nMS;
+ if ( pSalData->mpFirstInstance )
+ {
+ if ( pSalData->mnAppThreadId != ImplSalGetCurrentThreadId() )
+ WinPostMsg( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, 0 );
+ else
+ WinSendMsg( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, 0 );
+ }
+ else
+ ImplSalStartTimer();
+}
diff --git a/vcl/os2/source/app/sallang.cxx b/vcl/os2/source/app/sallang.cxx
new file mode 100644
index 000000000000..ba8be275ec4b
--- /dev/null
+++ b/vcl/os2/source/app/sallang.cxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * $RCSfile: sallang.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_INTN_HXX
+#include <tools/intn.hxx>
+#endif
+
+#ifndef _SALLANG_HXX
+#include <sallang.hxx>
+#endif
+
+// =======================================================================
+
+// -----------------------------------------------------------------------
+// Danish
+
+static const char* aImplLangDanishTab[LSTR_COUNT] =
+{
+ "Skift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Op", // LSTR_KEY_UP
+ "Ned", // LSTR_KEY_DOWN
+ "Venstre", // LSTR_KEY_LEFT
+ "H›jre", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Tilbage", // LSTR_KEY_BACKSPACE
+ "Mellemrum", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Dutch (Netherland/Belgian)
+
+static const char* aImplLangDutchTab[LSTR_COUNT] =
+{
+ "Shift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Boven", // LSTR_KEY_UP
+ "Onder", // LSTR_KEY_DOWN
+ "Links", // LSTR_KEY_LEFT
+ "Links", // LSTR_KEY_RIGHT
+ "Pos1", // LSTR_KEY_HOME
+ "Einde", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Return", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Spatiebalk", // LSTR_KEY_SPACE
+ "Ins", // LSTR_KEY_INSERT
+ "Verwijderen", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// English (US/UK/AUS/CAN/NZ/EIRE/SAFRICA/JAMAICA/CARRIBEAN)
+
+static const char* aImplLangEnglishTab[LSTR_COUNT] =
+{
+ "Shift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Up", // LSTR_KEY_UP
+ "Down", // LSTR_KEY_DOWN
+ "Left", // LSTR_KEY_LEFT
+ "Right", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Space", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Del", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Finnish
+
+static const char* aImplLangFinnishTab[LSTR_COUNT] =
+{
+ "Vaihton„ppain", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Yl„", // LSTR_KEY_UP
+ "Ala", // LSTR_KEY_DOWN
+ "Vasen", // LSTR_KEY_LEFT
+ "Oikea", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Sarkain", // LSTR_KEY_TAB
+ "Askelpalautin", // LSTR_KEY_BACKSPACE
+ "V„lin„pp„in", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// French (French/Belgian/Canadian/Swiss/Luxenbourg)
+
+static const char* aImplLangFrenchTab[LSTR_COUNT] =
+{
+ "Maj", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Haut", // LSTR_KEY_UP
+ "Bas", // LSTR_KEY_DOWN
+ "Gauche", // LSTR_KEY_LEFT
+ "Droite", // LSTR_KEY_RIGHT
+ "Origine", // LSTR_KEY_HOME
+ "Fin", // LSTR_KEY_END
+ "Pg. Pr‚c", // LSTR_KEY_PAGEUP
+ "Pg. Suiv", // LSTR_KEY_PAGEDOWN
+ "Entr‚e", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Ret. Arr", // LSTR_KEY_BACKSPACE
+ "Espace", // LSTR_KEY_SPACE
+ "Ins‚rer", // LSTR_KEY_INSERT
+ "Suppr", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// German (German/Swiss/Austrian/Luxembourg/Liechtenstein)
+
+static const char* aImplLangGermanTab[LSTR_COUNT] =
+{
+ "Umschalt", // LSTR_KEY_SHIFT
+ "Strg", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Nach-Oben", // LSTR_KEY_UP
+ "Nach-Unten", // LSTR_KEY_DOWN
+ "Nach-Links", // LSTR_KEY_LEFT
+ "Nach-Rechts", // LSTR_KEY_RIGHT
+ "Pos1", // LSTR_KEY_HOME
+ "Ende", // LSTR_KEY_END
+ "Bild-Nach-Oben", // LSTR_KEY_PAGEUP
+ "Bild-Nach-Unten", // LSTR_KEY_PAGEDOWN
+ "Eingabe", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Rck", // LSTR_KEY_BACKSPACE
+ "Leer", // LSTR_KEY_SPACE
+ "Einfg", // LSTR_KEY_INSERT
+ "Entf", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Italian (Italian/Swiss)
+
+static const char* aImplLangItalianTab[LSTR_COUNT] =
+{
+ "Maiusc", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Sposta verso l'alto", // LSTR_KEY_UP
+ "Sposta verso il basso", // LSTR_KEY_DOWN
+ "A sinistra", // LSTR_KEY_LEFT
+ "A destra", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "Fine", // LSTR_KEY_END
+ "PgSu", // LSTR_KEY_PAGEUP
+ "PgGi—", // LSTR_KEY_PAGEDOWN
+ "Invio", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Spaziatrice", // LSTR_KEY_SPACE
+ "Ins", // LSTR_KEY_INSERT
+ "Canc", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Norwegian (Bokmal)
+
+static const char* aImplLangNorwegianTab[LSTR_COUNT] =
+{
+ "Skift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Opp", // LSTR_KEY_UP
+ "Ned", // LSTR_KEY_DOWN
+ "Venstre", // LSTR_KEY_LEFT
+ "H›yre", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Tilbake", // LSTR_KEY_BACKSPACE
+ "Mellomrom", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Portuguse (Portuguse/Brazilian)
+
+static const char* aImplLangPortugueseTab[LSTR_COUNT] =
+{
+ "Shift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Acima", // LSTR_KEY_UP
+ "Abaixo", // LSTR_KEY_DOWN
+ "Esquerda", // LSTR_KEY_LEFT
+ "Direita", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Enter", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backspace", // LSTR_KEY_BACKSPACE
+ "Space", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Spanish (Spanish/Mexican/Modern/Guatemala/Costarica/Panama/Dominican/
+// Venezuela/Colombia/Peru/Argentina/Ecuador/Chile/Uruguay/
+// Paraguay/Bolivia)
+
+static const char* aImplLangSpanishTab[LSTR_COUNT] =
+{
+ "May—s", // LSTR_KEY_SHIFT
+ "Control", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Hacia arriba", // LSTR_KEY_UP
+ "Hacia abajo", // LSTR_KEY_DOWN
+ "Hacia la izquierda", // LSTR_KEY_LEFT
+ "Hacia la derecha", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "Fin", // LSTR_KEY_END
+ "ReP g", // LSTR_KEY_PAGEUP
+ "AvP g", // LSTR_KEY_PAGEDOWN
+ "Entrada", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Ret", // LSTR_KEY_BACKSPACE
+ "Espacio", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Supr", // LSTR_KEY_DELETE
+};
+
+// -----------------------------------------------------------------------
+// Swedish
+
+static const char* aImplLangSwedishTab[LSTR_COUNT] =
+{
+ "Skift", // LSTR_KEY_SHIFT
+ "Ctrl", // LSTR_KEY_CTRL
+ "Alt", // LSTR_KEY_ALT
+ "Up", // LSTR_KEY_UP
+ "Ned", // LSTR_KEY_DOWN
+ "V„nster", // LSTR_KEY_LEFT
+ "H”ger", // LSTR_KEY_RIGHT
+ "Home", // LSTR_KEY_HOME
+ "End", // LSTR_KEY_END
+ "PageUp", // LSTR_KEY_PAGEUP
+ "PageDown", // LSTR_KEY_PAGEDOWN
+ "Retur", // LSTR_KEY_RETURN
+ "Esc", // LSTR_KEY_ESC
+ "Tab", // LSTR_KEY_TAB
+ "Backsteg", // LSTR_KEY_BACKSPACE
+ "Blank", // LSTR_KEY_SPACE
+ "Insert", // LSTR_KEY_INSERT
+ "Delete", // LSTR_KEY_DELETE
+};
+
+// =======================================================================
+
+const char** ImplGetLangTab( LanguageType eLang )
+{
+ // Sprachtabelle ermitteln
+ const char** pLangTab;
+ switch ( International::GetNeutralLanguage( eLang ) )
+ {
+ case LANGUAGE_DANISH:
+ pLangTab = aImplLangDanishTab;
+ break;
+
+ case LANGUAGE_DUTCH:
+ case LANGUAGE_DUTCH_BELGIAN:
+ pLangTab = aImplLangDutchTab;
+ break;
+
+ case LANGUAGE_FINNISH:
+ pLangTab = aImplLangFinnishTab;
+ break;
+
+ case LANGUAGE_FRENCH:
+ pLangTab = aImplLangFrenchTab;
+ break;
+
+ case LANGUAGE_GERMAN:
+ pLangTab = aImplLangGermanTab;
+ break;
+
+ case LANGUAGE_ITALIAN:
+ pLangTab = aImplLangItalianTab;
+ break;
+
+ case LANGUAGE_NORWEGIAN:
+ case LANGUAGE_NORWEGIAN_BOKMAL:
+ pLangTab = aImplLangNorwegianTab;
+ break;
+
+ case LANGUAGE_PORTUGUESE:
+ case LANGUAGE_PORTUGUESE_BRAZILIAN:
+ pLangTab = aImplLangPortugueseTab;
+ break;
+
+ case LANGUAGE_SPANISH:
+ pLangTab = aImplLangSpanishTab;
+ break;
+
+ case LANGUAGE_SWEDISH:
+ pLangTab = aImplLangSwedishTab;
+ break;
+
+ default:
+ pLangTab = aImplLangEnglishTab;
+ break;
+ }
+
+ return pLangTab;
+}
diff --git a/vcl/os2/source/app/salshl.cxx b/vcl/os2/source/app/salshl.cxx
new file mode 100644
index 000000000000..c81cee1c67f1
--- /dev/null
+++ b/vcl/os2/source/app/salshl.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * $RCSfile: salshl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/svpm.h>
+
+#define _SV_SALSHL_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// =======================================================================
+
+SalShlData aSalShlData;
+
+// =======================================================================
+
+HPOINTER ImplLoadPointer( ULONG nId )
+{
+ return WinLoadPointer( HWND_DESKTOP, aSalShlData.mhMod, nId );
+}
+
diff --git a/vcl/os2/source/app/salsound.cxx b/vcl/os2/source/app/salsound.cxx
new file mode 100644
index 000000000000..45bf1ee67153
--- /dev/null
+++ b/vcl/os2/source/app/salsound.cxx
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsound.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALSOUND_CXX
+
+// ------------
+// - Includes -
+// ------------
+
+#include <string.h>
+
+#define INCL_DOSMODULEMGR
+#include <tools/svpm.h>
+
+#ifndef _SV_SALSOUND_HXX
+#include <salsound.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+#define INCL_MCIOS2
+#include <os2me.h>
+
+// ---------
+// - Names -
+// ---------
+
+#define SOUND_LIBNAME "MDM"
+#define SOUND_PROCNAME "mciSendCommand"
+
+// ------------
+// - Fnc cast -
+// ------------
+
+typedef ULONG (_cdecl *SALMCIPROC)( USHORT nDeviceId, USHORT nMessage, ULONG nFlags, void* pParam, USHORT );
+#define MCIFNC ( (SALMCIPROC) SalSound::mpMCIFnc )
+
+// -----------------
+// - Statics init. -
+// -----------------
+
+HMODULE SalSound::mhMCILib = 0;
+ULONG SalSound::mnSoundState = SOUND_STATE_UNLOADED;
+void* SalSound::mpMCIFnc = NULL;
+
+// -------------------
+// - Window-Callback -
+// -------------------
+
+MRESULT EXPENTRY SoundWndProc( HWND hWnd, ULONG nMsg, MPARAM nPar1, MPARAM nPar2 )
+{
+ if( MM_MCINOTIFY == nMsg )
+ {
+ USHORT nNotify = (USHORT)(ULONG) nPar1;
+ SoundNotification eNotification;
+ BOOL bNotify = TRUE;
+
+ switch( nNotify )
+ {
+ case( MCI_NOTIFY_SUCCESSFUL ):
+ eNotification = SOUND_NOTIFY_SUCCESS;
+ break;
+
+ case( MCI_NOTIFY_ABORTED ):
+ eNotification = SOUND_NOTIFY_ABORTED;
+ break;
+
+ case( MCI_NOTIFY_SUPERSEDED ):
+ bNotify = FALSE;
+ break;
+
+ default:
+ eNotification = SOUND_NOTIFY_ERROR;
+ break;
+ }
+
+ if( bNotify )
+ ( (SalSound*) WinQueryWindowULong( hWnd, 0 ) )->ImplNotify( eNotification, 0 );
+ }
+
+ return WinDefWindowProc( hWnd, nMsg, nPar1, nPar2 );
+}
+
+// ------------
+// - SalSound -
+// ------------
+
+SalSound::SalSound() :
+ mpProc ( NULL ),
+ mhSoundWnd ( 0 ),
+ mnDeviceId ( 0 ),
+ mbLoop ( FALSE ),
+ mbPaused ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+SalSound::~SalSound()
+{
+ Stop();
+
+ if( mnDeviceId )
+ {
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ MCIFNC( mnDeviceId, MCI_CLOSE, MCI_WAIT, &aGenericParams, 0 );
+ }
+
+ if( mhSoundWnd )
+ WinDestroyWindow( mhSoundWnd );
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::ImplSetError( ULONG nMciErr )
+{
+ struct aMapper { DWORD nMci; ULONG nSv; };
+
+ ULONG nError = SOUNDERR_GENERAL_ERROR;
+ static aMapper aErrArr[] =
+ {
+ { 0, SOUNDERR_SUCCESS },
+ { MCIERR_CANNOT_LOAD_DRIVER, SOUNDERR_CANNOT_LOAD_DRIVER },
+ { MCIERR_DEVICE_LOCKED, SOUNDERR_DEVICE_LOCKED },
+ { MCIERR_DEVICE_NOT_READY, SOUNDERR_DEVICE_NOT_READY },
+ { MCIERR_DEVICE_TYPE_REQUIRED, SOUNDERR_DEVICE_NOT_FOUND },
+ { MCIERR_DRIVER, SOUNDERR_CANNOT_LOAD_DRIVER },
+ { MCIERR_DRIVER_INTERNAL, SOUNDERR_CANNOT_LOAD_DRIVER },
+ { MCIERR_EXTENSION_NOT_FOUND, SOUNDERR_SOUND_NOT_FOUND },
+ { MCIERR_FILE_NOT_FOUND, SOUNDERR_SOUND_NOT_FOUND },
+ { MCIERR_HARDWARE, SOUNDERR_HARDWARE_ERROR },
+ { MCIERR_INVALID_DEVICE_NAME, SOUNDERR_DEVICE_NOT_FOUND },
+ { MCIERR_OUT_OF_MEMORY, SOUNDERR_OUT_OF_MEMORY },
+ { MCIERR_UNSUPPORTED_FUNCTION, SOUNDERR_UNSUPPORTED_FUNCTION }
+ };
+
+ for( USHORT n=0; n < (sizeof( aErrArr ) / sizeof( aMapper ) ); n++ )
+ {
+ if( aErrArr[ n ].nMci == nMciErr )
+ {
+ nError = aErrArr[ n ].nSv;
+ break;
+ }
+ }
+
+ if( nError )
+ ImplNotify( SOUND_NOTIFY_ERROR, nError );
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::ImplNotify( SoundNotification eNotification, ULONG nError )
+{
+ if( mbLoop && ( SOUND_NOTIFY_SUCCESS == eNotification ) && !nError )
+ Play( mnStartTime, mnPlayLen, TRUE );
+
+ if( mpProc && mpInst )
+ mpProc( mpInst, eNotification, nError );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalSound::Create()
+{
+ SalData* pData = GetSalData();
+ BOOL bRet = FALSE;
+
+ if( SOUND_STATE_UNLOADED == SalSound::mnSoundState )
+ {
+ if( DosLoadModule( 0, 0, SOUND_LIBNAME, &SalSound::mhMCILib ) == 0 &&
+ DosQueryProcAddr( SalSound::mhMCILib, 0, SOUND_PROCNAME, (PFN*) &SalSound::mpMCIFnc ) == 0 )
+ {
+ char* pszClassName = "SoundWin";
+ PFNWP pWindowProc = SoundWndProc;
+
+ WinRegisterClass( pData->mhAB, pszClassName, pWindowProc, 0L, 4 );
+ SalSound::mnSoundState = SOUND_STATE_VALID;
+ bRet = TRUE;
+ }
+ else
+ {
+ if( SalSound::mhMCILib )
+ DosFreeModule( SalSound::mhMCILib );
+
+ SalSound::mnSoundState = SOUND_STATE_INVALID;
+ ImplNotify( SOUND_NOTIFY_ERROR, SOUNDERR_CANNOT_LOAD_DRIVER );
+ }
+ }
+ else if( SOUND_STATE_VALID == SalSound::mnSoundState )
+ bRet = TRUE;
+
+ if( bRet )
+ {
+ mhSoundWnd = WinCreateWindow( HWND_OBJECT, "SoundWin", "Sound", 0, 0, 0, 0, 0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 );
+ WinSetWindowULong( mhSoundWnd, 0, (ULONG) this );
+ }
+ else
+ mhSoundWnd = 0;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Release()
+{
+ if( SalSound::mhMCILib )
+ DosFreeModule( SalSound::mhMCILib );
+
+ SalSound::mnSoundState = SOUND_STATE_UNLOADED;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalSound::Init( SalFrame* pFrame, const String& rSoundName, ULONG& rSoundLen )
+{
+ MCI_OPEN_PARMS aOpenParams;
+ ULONG nMciErr = 0;
+
+ rSoundLen = 0;
+
+ // clear old device
+ if( mnDeviceId )
+ {
+ Stop();
+
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ nMciErr = MCIFNC( mnDeviceId, MCI_CLOSE, MCI_WAIT, &aGenericParams, 0 );
+ mnDeviceId = 0;
+ }
+
+ if( rSoundName.Len() )
+ {
+ // init new device with sound name
+ memset( &aOpenParams, 0, sizeof( aOpenParams ) );
+ aOpenParams.pszElementName = (char*) rSoundName.GetStr();
+ aOpenParams.hwndCallback = mhSoundWnd;
+ nMciErr = MCIFNC( 0, MCI_OPEN, MCI_WAIT | MCI_OPEN_ELEMENT, &aOpenParams, 0 );
+
+ if( !nMciErr )
+ {
+ // set time format
+ MCI_SET_PARMS aSetParams;
+ memset( &aSetParams, 0, sizeof( aSetParams ) );
+ mnDeviceId = aOpenParams.usDeviceID;
+ aSetParams.ulTimeFormat = MCI_FORMAT_MILLISECONDS;
+ nMciErr = MCIFNC( mnDeviceId, MCI_SET, MCI_WAIT | MCI_SET_TIME_FORMAT, &aSetParams, 0 );
+
+ if( !nMciErr )
+ {
+ // get length of sound
+ MCI_STATUS_PARMS aStatus;
+ memset( &aStatus, 0, sizeof( aStatus ) );
+ aStatus.ulItem = MCI_STATUS_LENGTH;
+ MCIFNC( mnDeviceId, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &aStatus, 0 );
+ rSoundLen = (ULONG) aStatus.ulReturn;
+ }
+ }
+ }
+
+ if( nMciErr )
+ ImplSetError( nMciErr );
+
+ return( nMciErr ? FALSE : TRUE );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalSound::Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen )
+{
+ rSoundLen = 0UL;
+ ImplSetError( MCIERR_FILE_NOT_FOUND );
+
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Play( ULONG nStartTime, ULONG nPlayLen, BOOL bLoop )
+{
+ if( mnDeviceId )
+ {
+ ULONG nMciErr = 0;
+
+ if( !mbPaused )
+ {
+ MCI_SEEK_PARMS aSeekParams;
+ memset( &aSeekParams, 0, sizeof( aSeekParams ) );
+ aSeekParams.hwndCallback = mhSoundWnd;
+ aSeekParams.ulTo = 0;
+ nMciErr = MCIFNC( mnDeviceId, MCI_SEEK,MCI_WAIT | MCI_TO, &aSeekParams, 0 );
+ }
+
+ mnStartTime = nStartTime;
+ mnPlayLen = nPlayLen;
+ mbLoop = bLoop;
+ mbPaused = FALSE;
+
+ if( !nMciErr )
+ {
+ MCI_PLAY_PARMS aPlayParams;
+ DWORD nFlags = MCI_NOTIFY;
+
+ memset( &aPlayParams, 0, sizeof( aPlayParams ) );
+ aPlayParams.hwndCallback = mhSoundWnd;
+
+ if( nStartTime )
+ {
+ aPlayParams.ulFrom = nStartTime;
+ nFlags |= MCI_FROM;
+ }
+
+ if( nPlayLen != SOUND_PLAYALL )
+ {
+ aPlayParams.ulTo = nStartTime + nPlayLen;
+ nFlags |= MCI_TO;
+ }
+
+ nMciErr = MCIFNC( mnDeviceId, MCI_PLAY, nFlags, &aPlayParams, 0 );
+
+ if( !nMciErr )
+ mbPaused = FALSE;
+ }
+
+ if( nMciErr )
+ ImplSetError( nMciErr );
+ }
+ else
+ ImplSetError( MCIERR_EXTENSION_NOT_FOUND );
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Stop()
+{
+ if( mnDeviceId )
+ {
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ mbLoop = mbPaused = FALSE;
+ MCIFNC( mnDeviceId, MCI_STOP, MCI_WAIT, &aGenericParams, 0 );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SalSound::Pause()
+{
+ if( mnDeviceId )
+ {
+ MCI_GENERIC_PARMS aGenericParams;
+ memset( &aGenericParams, 0, sizeof( aGenericParams ) );
+ aGenericParams.hwndCallback = mhSoundWnd;
+ mbPaused = TRUE;
+ MCIFNC( mnDeviceId, MCI_PAUSE, MCI_WAIT, &aGenericParams, 0 );
+ }
+}
diff --git a/vcl/os2/source/app/salsys.cxx b/vcl/os2/source/app/salsys.cxx
new file mode 100644
index 000000000000..54244723be33
--- /dev/null
+++ b/vcl/os2/source/app/salsys.cxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALSYS_CXX
+
+#include <string.h>
+
+#define INCL_DOS
+#define INCL_DOSERRORS
+#ifndef _SVPM_H
+#include <tools/svpm.h>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _VOS_PROCESS_HXX
+#include <vos/process.hxx>
+#endif
+#ifndef _TOOLS_FASTFSYS_HXX
+#include <tools/fastfsys.hxx>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+// =======================================================================
+
+SalSystem* SalInstance::CreateSystem()
+{
+ return new SalSystem();
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroySystem( SalSystem* pSystem )
+{
+ delete pSystem;
+}
+
+// -----------------------------------------------------------------------
+
+SalSystem::SalSystem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SalSystem::~SalSystem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::StartProcess( SalFrame* pFrame, const XubString& rFileName,
+ const XubString& rParam,
+ const XubString& rWorkingDirectory )
+{
+ ItemIDPath aFile(rFileName);
+
+ //
+ // first check if item has a context menu with open command
+ //
+
+ ItemIDPath aParent, aChild;
+
+ if(aFile.Split(aParent, aChild))
+ {
+ IfcContextMenu *pConMenu = Folder(aParent).GetContextMenu(1, &aChild);
+
+ if(pConMenu)
+ {
+ UINT32 nCount = pConMenu->GetItemCount();
+
+ for(UINT32 n = 0; n < nCount; n++)
+ {
+ MenuItem aMenuItem;
+
+ if(pConMenu->GetMenuItem(n, aMenuItem) &&
+ aMenuItem.aVerb.Compare("open") == COMPARE_EQUAL)
+ {
+ return pConMenu->ExecuteCommand(aMenuItem.aCommand);
+ }
+ }
+ }
+ }
+
+ // Dateinamen mit Wildcards lehnen wir ab
+ if ( (rFileName.Search( '*' ) != STRING_NOTFOUND) ||
+ (rFileName.Search( '?' ) != STRING_NOTFOUND) )
+ return FALSE;
+
+ XubString aFileName = aFile.GetHostNotationPath();
+ char* aStdExtAry[] = { "exe", "com", "cmd", "bat" };
+ const char* pStdExt;
+ const xub_Unicode* pFileName = aFileName.GetStr();
+ const xub_Unicode* pParam = rParam.GetStr();
+ XubString aSearchFileName;
+ XubString aExt;
+ BOOL bExe = FALSE;
+ BOOL bProcess = FALSE;
+ BOOL bRet = FALSE;
+ BOOL bExtension;
+ int i;
+
+ // Parameter und Extension ermitteln
+ if ( !rParam.Len() )
+ pParam = NULL;
+ // Wenn keine Extension, dann versuchen wir eine zu ermitteln,
+ // indem wir nach EXE-, COM-, CMD- oder BAT-Dateien suchen.
+ bExtension = ImplSalGetExtension( aFileName, aExt );
+ if ( !bExtension )
+ {
+ i = 0;
+ do
+ {
+ pStdExt = aStdExtAry[i];
+ aSearchFileName = aFileName;
+ aSearchFileName += '.';
+ aSearchFileName += pStdExt;
+ if ( ImplSalFindFile( aSearchFileName.GetStr(), aSearchFileName ) )
+ {
+ pFileName = aSearchFileName.GetStr();
+ bExtension = ImplSalGetExtension( aSearchFileName, aExt );
+ break;
+ }
+ i++;
+ }
+ while ( i < 4 );
+ }
+ else
+ {
+ // Ansonsten Filename im Pfad suchen
+ if ( ImplSalFindFile( pFileName, aSearchFileName ) )
+ {
+ pFileName = aSearchFileName.GetStr();
+ bExtension = ImplSalGetExtension( aSearchFileName, aExt );
+ }
+ }
+ // Wenn wir eine Extension haben, testen wir, ob es eine
+ // Standard-Extension ist, womit wir einen Process starten koennen
+ if ( bExtension )
+ {
+ aExt.ToLower();
+ i = 0;
+ do
+ {
+ if ( aExt == aStdExtAry[i] )
+ {
+ bExe = TRUE;
+ break;
+ }
+ i++;
+ }
+ while ( i < 4 );
+ }
+
+ // change to path of executable if no working dir set
+ XubString aWorkingDir(rWorkingDirectory);
+
+ if(aWorkingDir.Len() == 0)
+ {
+ USHORT nIndex;
+
+ aWorkingDir = pFileName;
+ nIndex = aWorkingDir.SearchCharBackward("\\/:");
+
+ if(nIndex == STRING_NOTFOUND)
+ nIndex = 0;
+ else if(aWorkingDir.GetChar(nIndex) == ':')
+ aWorkingDir[nIndex++] = '\\';
+
+ aWorkingDir.Erase(nIndex);
+ }
+
+ // start executables with process execute
+ if ( bExe )
+ {
+ NAMESPACE_VOS( OProcess )::TProcessError nProcessError;
+ NAMESPACE_VOS( OProcess ) aProcess( pFileName, pParam );
+
+ aProcess.setDirectory(aWorkingDir.GetStr());
+
+ nProcessError = aProcess.execute( (NAMESPACE_VOS(OProcess)::TProcessOption)
+ (NAMESPACE_VOS(OProcess)::TOption_Detached) );
+ bRet = nProcessError == NAMESPACE_VOS( OProcess )::E_None;
+ }
+
+ // when not startet, start programm with WPS
+ if ( !bRet )
+ {
+ HOBJECT hObject = WinQueryObject( pFileName );
+ if ( hObject )
+ {
+ if ( WinOpenObject( hObject, 0, FALSE ) )
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::AddRecentDoc( SalFrame* pFrame, const XubString& rFileName )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+String SalSystem::GetSummarySystemInfos( ULONG nFlags )
+{
+ return String();
+}
+
diff --git a/vcl/os2/source/app/saltimer.cxx b/vcl/os2/source/app/saltimer.cxx
new file mode 100644
index 000000000000..284c987c4250
--- /dev/null
+++ b/vcl/os2/source/app/saltimer.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: saltimer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/svpm.h>
+
+#define _SV_SALTIMER_CXX
+
+#ifndef _SV_SALINST_H
+#include <salinst.h>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+
+// =======================================================================
+
+// Maximale Periode
+#define MAX_SYSPERIOD 65533
+
+// =======================================================================
+
+void ImplSalStartTimer()
+{
+ SalData* pSalData = GetSalData();
+ SalFrame* pSalFrame = GetSalDefaultFrame();
+
+ // Periode darf nicht zu gross sein, da OS2 2.11 mit USHORT arbeitet
+ ULONG nMS = pSalData->mnNewTimerMS;
+ if ( nMS > MAX_SYSPERIOD )
+ nMS = MAX_SYSPERIOD;
+
+ // Gibt es einen Timer, dann zerstoren
+ if ( pSalData->mnTimerId )
+ WinStopTimer( pSalData->mhAB, pSalFrame->maFrameData.mhWndClient, pSalData->mnTimerId );
+
+ // Make a new timer with new period
+ pSalData->mnTimerId = WinStartTimer( pSalData->mhAB, pSalFrame->maFrameData.mhWndClient, 10, nMS );
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Stop()
+{
+ SalData* pSalData = GetSalData();
+ SalFrame* pSalFrame = GetSalDefaultFrame();
+
+ // Exitstiert ein Timer, dann diesen zerstoeren
+ if ( pSalData->mnTimerId )
+ WinStopTimer( pSalData->mhAB, pSalFrame->maFrameData.mhWndClient, pSalData->mnTimerId );
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::SetCallback( SALTIMERPROC pProc )
+{
+ SalData* pSalData = GetSalData();
+ pSalData->mpTimerProc = pProc;
+}
diff --git a/vcl/os2/source/gdi/makefile.mk b/vcl/os2/source/gdi/makefile.mk
new file mode 100644
index 000000000000..e3a50cad9c94
--- /dev/null
+++ b/vcl/os2/source/gdi/makefile.mk
@@ -0,0 +1,94 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SV
+TARGET=salgdi
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= salgdi.cxx \
+ salgdi2.cxx \
+ salgdi3.cxx \
+ salvd.cxx \
+ salprn.cxx \
+ salbmp.cxx \
+ salogl.cxx
+
+SLOFILES= $(SLO)$/salgdi.obj \
+ $(SLO)$/salgdi2.obj \
+ $(SLO)$/salgdi3.obj \
+ $(SLO)$/salvd.obj \
+ $(SLO)$/salprn.obj \
+ $(SLO)$/salbmp.obj \
+ $(SLO)$/salogl.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/os2/source/gdi/salbmp.cxx b/vcl/os2/source/gdi/salbmp.cxx
new file mode 100644
index 000000000000..d53814a481a5
--- /dev/null
+++ b/vcl/os2/source/gdi/salbmp.cxx
@@ -0,0 +1,760 @@
+/*************************************************************************
+ *
+ * $RCSfile: salbmp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/svpm.h>
+
+#define _SV_SALBMP_CXX
+
+#ifndef _RTL_ALLOC_H_
+#include <rtl/alloc.h>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#include <string.h>
+
+// -----------
+// - Inlines -
+// -----------
+
+inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex )
+{
+ BYTE& rByte = pScanline[ nX >> 1 ];
+
+ ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( cIndex & 0x0f ) ) :
+ ( rByte &= 0x0f, rByte |= ( cIndex << 4 ) );
+}
+
+// -------------
+// - SalBitmap -
+// -------------
+
+SalBitmap::SalBitmap() :
+ mhDIB ( 0 ),
+ mhDIB1Subst ( 0 ),
+ mhDDB ( 0 ),
+ mnBitCount ( 0 )
+{
+}
+
+// ------------------------------------------------------------------
+
+SalBitmap::~SalBitmap()
+{
+ Destroy();
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( HANDLE hBitmap, BOOL bDIB, BOOL bCopyHandle )
+{
+ BOOL bRet = TRUE;
+
+ if( bDIB )
+ mhDIB = (HANDLE) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, TRUE ) : hBitmap );
+ else
+ mhDDB = (HBITMAP) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, FALSE ) : hBitmap );
+
+ if( mhDIB )
+ {
+ // bitmap-header is the beginning of memory block
+ PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) mhDIB;
+
+ maSize = Size( pBIH->cx, pBIH->cy );
+ mnBitCount = pBIH->cBitCount;
+
+ if( mnBitCount )
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 : ( mnBitCount <= 4 ) ? 4 : ( mnBitCount <= 8 ) ? 8 : 24;
+ }
+ else if( mhDDB )
+ {
+ BITMAPINFOHEADER2 aDDBInfoHeader;
+
+ aDDBInfoHeader.cbFix = sizeof( aDDBInfoHeader );
+
+ if( GpiQueryBitmapInfoHeader( mhDDB, &aDDBInfoHeader ) )
+ {
+ maSize = Size( aDDBInfoHeader.cx, aDDBInfoHeader.cy );
+ mnBitCount = aDDBInfoHeader.cPlanes * aDDBInfoHeader.cBitCount;
+
+ if( mnBitCount )
+ {
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 :
+ ( mnBitCount <= 4 ) ? 4 :
+ ( mnBitCount <= 8 ) ? 8 : 24;
+ }
+ }
+ else
+ {
+ mhDDB = 0;
+ bRet = FALSE;
+ }
+
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
+{
+ BOOL bRet = FALSE;
+
+ mhDIB = ImplCreateDIB( rSize, nBitCount, rPal );
+
+ if( mhDIB )
+ {
+ maSize = rSize;
+ mnBitCount = nBitCount;
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBitmap )
+{
+ BOOL bRet = FALSE;
+
+ if ( rSalBitmap.mhDIB || rSalBitmap.mhDDB )
+ {
+ HANDLE hNewHdl = ImplCopyDIBOrDDB( rSalBitmap.mhDIB ? rSalBitmap.mhDIB : rSalBitmap.mhDDB,
+ rSalBitmap.mhDIB != 0 );
+
+ if( hNewHdl )
+ {
+ if( rSalBitmap.mhDIB )
+ mhDIB = (HANDLE) hNewHdl;
+ else if( rSalBitmap.mhDDB )
+ mhDDB = (HBITMAP) hNewHdl;
+
+ maSize = rSalBitmap.maSize;
+ mnBitCount = rSalBitmap.mnBitCount;
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics )
+{
+ BOOL bRet = FALSE;
+
+ if( rSalBmp.mhDIB )
+ {
+ HPS hPS = pGraphics->maGraphicsData.mhPS;
+ HBITMAP hNewDDB;
+ BITMAPINFOHEADER2 aInfoHeader;
+ const Size aSize( rSalBmp.GetSize() );
+ long nFormat[ 2 ];
+
+ memset( &aInfoHeader, 0, sizeof( aInfoHeader ) );
+ aInfoHeader.cbFix = 16;
+ aInfoHeader.cx = aSize.Width();
+ aInfoHeader.cy = aSize.Height();
+
+ GpiQueryDeviceBitmapFormats( hPS, 2L, (PLONG) &nFormat );
+ aInfoHeader.cPlanes = nFormat[ 0 ];
+ aInfoHeader.cBitCount = nFormat[ 1 ];
+
+ // ! wegen Postscript-Treiber
+ if( !aInfoHeader.cBitCount )
+ aInfoHeader.cBitCount = 24;
+ else if( ( aInfoHeader.cPlanes == 1 ) && ( aInfoHeader.cBitCount == 1 ) )
+ aInfoHeader.cBitCount = 4;
+
+ // BitCount == 1 ist wegen aller moeglichen Treiberfehler nicht moeglich
+ if( rSalBmp.GetBitCount() == 1 )
+ {
+ HANDLE hTmp = ImplCreateDIB4FromDIB1( rSalBmp.mhDIB );
+ PBYTE pBits = (PBYTE) hTmp + *(ULONG*) hTmp + ImplGetDIBColorCount( hTmp ) * sizeof( RGB2 );
+
+ hNewDDB = GpiCreateBitmap( hPS, &aInfoHeader, CBM_INIT, pBits, (PBITMAPINFO2) hTmp );
+ rtl_freeMemory( hTmp );
+ }
+ else
+ {
+ PBYTE pBits = (PBYTE) rSalBmp.mhDIB + *(ULONG*) rSalBmp.mhDIB + ImplGetDIBColorCount( rSalBmp.mhDIB ) * sizeof( RGB2 );
+ hNewDDB = GpiCreateBitmap( hPS, &aInfoHeader, CBM_INIT, pBits, (PBITMAPINFO2) rSalBmp.mhDIB );
+ }
+
+ aInfoHeader.cbFix = sizeof( aInfoHeader );
+
+ if( hNewDDB && GpiQueryBitmapInfoHeader( hNewDDB, &aInfoHeader ) )
+ {
+ mhDDB = hNewDDB;
+ maSize = Size( aInfoHeader.cx, aInfoHeader.cy );
+ mnBitCount = aInfoHeader.cPlanes * aInfoHeader.cBitCount;
+
+ if( mnBitCount )
+ {
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 :
+ ( mnBitCount <= 4 ) ? 4 :
+ ( mnBitCount <= 8 ) ? 8 : 24;
+ }
+
+ bRet = TRUE;
+ }
+ else if( hNewDDB )
+ GpiDeleteBitmap( hNewDDB );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount )
+{
+ BOOL bRet = FALSE;
+
+ if( rSalBmp.mhDDB )
+ {
+ mhDIB = ImplCreateDIB( rSalBmp.maSize, nNewBitCount, BitmapPalette() );
+
+ if( mhDIB )
+ {
+ // bitmap-header is the beginning of memory block
+ PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB;
+ const int nLines = (int) rSalBmp.maSize.Height();
+ PBYTE pBits = (PBYTE) pBI + *(ULONG*) pBI + ImplGetDIBColorCount( mhDIB ) * sizeof( RGB2 );
+ SIZEL aSizeL = { rSalBmp.maSize.Width(), nLines };
+ HAB hAB = GetSalData()->mhAB;
+ DEVOPENSTRUC aDevOpenStruc = { NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+ HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 );
+ HPS hMemPS = GpiCreatePS( hAB, hMemDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS );
+ HBITMAP hMemOld = (HBITMAP) GpiSetBitmap( hMemPS, rSalBmp.mhDDB );
+
+ if( GpiQueryBitmapBits( hMemPS, 0, nLines, pBits, pBI ) == nLines )
+ {
+ maSize = rSalBmp.maSize;
+ mnBitCount = nNewBitCount;
+ bRet = TRUE;
+ }
+ else
+ {
+ rtl_freeMemory( mhDIB );
+ mhDIB = 0;
+ }
+
+ GpiSetBitmap( hMemPS, hMemOld );
+ GpiDestroyPS( hMemPS );
+ DevCloseDC( hMemDC );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::Destroy()
+{
+ if( mhDIB )
+ rtl_FreeMemory( mhDIB );
+ else if( mhDDB )
+ GpiDeleteBitmap( mhDDB );
+
+ if( mhDIB1Subst )
+ {
+ rtl_FreeMemory( mhDIB1Subst );
+ mhDIB1Subst = NULL;
+ }
+
+ maSize = Size();
+ mnBitCount = 0;
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::ImplReplacehDIB1Subst( HANDLE hDIB1Subst )
+{
+ if( mhDIB1Subst )
+ rtl_FreeMemory( mhDIB1Subst );
+
+ mhDIB1Subst = hDIB1Subst;
+}
+
+// ------------------------------------------------------------------
+
+USHORT SalBitmap::ImplGetDIBColorCount( HANDLE hDIB )
+{
+ USHORT nColors = 0;
+
+ if( hDIB )
+ {
+ // bitmap infos can be found at the beginning of the memory
+ PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) hDIB;
+
+ if( pBIH->cBitCount <= 8 )
+ {
+ if( pBIH->cclrUsed )
+ nColors = (USHORT) pBIH->cclrUsed;
+ else
+ nColors = 1 << pBIH->cBitCount;
+ }
+ }
+
+ return nColors;
+}
+
+// ------------------------------------------------------------------
+
+HANDLE SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const BitmapPalette& rPal )
+{
+ DBG_ASSERT( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24, "Unsupported BitCount!" );
+
+ HANDLE hDIB = 0;
+
+ if ( rSize.Width() && rSize.Height() && ( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24 ) )
+ {
+ const ULONG nImageSize = AlignedWidth4Bytes( nBits * rSize.Width() ) * rSize.Height();
+ const USHORT nColors = ( nBits <= 8 ) ? ( 1 << nBits ) : 0;
+
+ hDIB = (HANDLE) rtl_allocateZeroMemory( sizeof( BITMAPINFOHEADER2 ) + nColors * sizeof( RGB2 ) + nImageSize );
+
+ if( hDIB )
+ {
+ // bitmap infos can be found at the beginning of the memory
+ PBITMAPINFO2 pBI = (PBITMAPINFO2) hDIB;
+ PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI;
+
+ pBIH->cbFix = sizeof( BITMAPINFOHEADER2 );
+ pBIH->cx = rSize.Width();
+ pBIH->cy = rSize.Height();
+ pBIH->cPlanes = 1;
+ pBIH->cBitCount = nBits;
+ pBIH->ulCompression = BCA_UNCOMP; // BI_RGB;
+ pBIH->cbImage = nImageSize;
+ pBIH->cxResolution = 0;
+ pBIH->cyResolution = 0;
+ pBIH->cclrUsed = 0;
+ pBIH->cclrImportant = 0;
+
+ // Rest auf 0 setzen
+ memset( (PBYTE) &pBIH->usUnits, 0, (PBYTE) pBI->argbColor - (PBYTE) &pBIH->usUnits );
+
+ if( nColors )
+ {
+ const USHORT nMinCount = Min( nColors, rPal.GetEntryCount() );
+
+ if( nMinCount )
+ HMEMCPY( pBI->argbColor, rPal.ImplGetColorBuffer(), nMinCount * sizeof( RGB2 ) );
+ }
+ }
+ }
+
+ return hDIB;
+}
+
+// ------------------------------------------------------------------
+
+HANDLE SalBitmap::ImplCreateDIB4FromDIB1( HANDLE hDIB1 )
+{
+ PBITMAPINFO2 pBI = (PBITMAPINFO2) hDIB1;
+ PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI;
+ PBYTE pBits = (PBYTE) pBI + *(ULONG*) pBIH + SalBitmap::ImplGetDIBColorCount( hDIB1 ) * sizeof( RGB2 );
+ ULONG nWidth = pBIH->cx, nHeight = pBIH->cy;
+ ULONG nAligned = AlignedWidth4Bytes( nWidth );
+ ULONG nAligned4 = AlignedWidth4Bytes( nWidth << 2 );
+ ULONG nSize4 = sizeof( BITMAPINFOHEADER2 ) + ( sizeof( RGB2 ) << 4 ) + nAligned4 * nHeight;
+ PBYTE pDIB4 = (PBYTE) rtl_allocateZeroMemory( nSize4 );
+ PBITMAPINFO2 pBI4 = (PBITMAPINFO2) pDIB4;
+ PBITMAPINFOHEADER2 pBIH4 = (PBITMAPINFOHEADER2) pBI4;
+ BYTE aMap[ 4 ] = { 0x00, 0x01, 0x10, 0x11 };
+
+ memset( pBIH4, 0, sizeof( BITMAPINFOHEADER2 ) );
+ pBIH4->cbFix = sizeof( BITMAPINFOHEADER2 );
+ pBIH4->cx = nWidth;
+ pBIH4->cy = nHeight;
+ pBIH4->cPlanes = 1;
+ pBIH4->cBitCount = 4;
+
+ // die ersten beiden Eintraege der 1Bit-Farbtabelle kopieren
+ memcpy( pBI4->argbColor, pBI->argbColor, sizeof( RGB2 ) << 1 );
+
+ PBYTE pBits4 = (PBYTE) pBI4 + *(ULONG*) pBIH4 + ( sizeof( RGB2 ) << 4 );
+
+ // 4Bit-DIB-Bilddaten setzen
+ for( ULONG nY = 0UL; nY < nHeight; nY++ )
+ {
+ PBYTE pTmp = pBits; pBits += nAligned;
+ PBYTE pTmp4 = pBits4; pBits4 += nAligned4;
+
+ for( ULONG nX = 0UL; nX < nWidth; nX += 8UL )
+ {
+ *pTmp4++ = aMap[ ( *pTmp >> 6 ) & 3 ];
+ *pTmp4++ = aMap[ ( *pTmp >> 4 ) & 3 ];
+ *pTmp4++ = aMap[ ( *pTmp >> 2 ) & 3 ];
+ *pTmp4++ = aMap[ *pTmp++ & 3 ];
+ }
+ }
+
+ return (HANDLE) pDIB4;
+}
+
+// ------------------------------------------------------------------
+
+HANDLE SalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, BOOL bDIB )
+{
+ HANDLE hCopy = 0;
+
+ if( bDIB && hHdl )
+ {
+ PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) hHdl;
+ const ULONG nSize = sizeof( BITMAPINFOHEADER2 )
+ + ImplGetDIBColorCount( hHdl ) * sizeof( RGB2 ) +
+ ( pBIH->cbImage ? pBIH->cbImage : AlignedWidth4Bytes( pBIH->cx * pBIH->cBitCount ) );
+
+ BYTE* pCopy = rtl_allocateZeroMemory( nSize );
+ memcpy( pCopy, (BYTE*) hHdl, nSize );
+ hCopy = (HANDLE) pCopy;
+ }
+ else if( hHdl )
+ {
+ HAB hAB = GetSalData()->mhAB;
+ HDC hSrcMemDC;
+ HDC hDestMemDC;
+ HPS hSrcMemPS;
+ HPS hDestMemPS;
+ HBITMAP hCopyBitmap;
+ BITMAPINFOHEADER2 aInfoHeader;
+ DEVOPENSTRUC aDevOpenStruc;
+ SIZEL size;
+
+ aInfoHeader.cbFix = sizeof( BITMAPINFOHEADER2 );
+ GpiQueryBitmapInfoHeader( hHdl, &aInfoHeader );
+ size.cx = aInfoHeader.cx;
+ size.cy = aInfoHeader.cy;
+
+ // Memory DCs erzeugen
+ aDevOpenStruc.pszLogAddress = 0;
+ aDevOpenStruc.pszDriverName = (PSZ)"DISPLAY";
+
+ hSrcMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 2, (PDEVOPENDATA)&aDevOpenStruc, 0 );
+ hDestMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 2, (PDEVOPENDATA)&aDevOpenStruc, 0 );
+
+ // Memory PSs erzeugen
+ hSrcMemPS = GpiCreatePS( hAB, hSrcMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS );
+ hDestMemPS = GpiCreatePS( hAB, hDestMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS );
+
+ GpiSetBitmap( hSrcMemPS, hHdl );
+
+ if( !hHdl )
+ {
+ memset( &aInfoHeader, 0, sizeof( BITMAPINFOHEADER2 ) );
+ aInfoHeader.cbFix = sizeof( BITMAPINFOHEADER2 );
+ aInfoHeader.cx = 0;
+ aInfoHeader.cy = 0;
+ aInfoHeader.cPlanes = 1;
+ aInfoHeader.cBitCount = 1;
+ }
+
+ hCopy = GpiCreateBitmap( hDestMemPS, &aInfoHeader, 0, NULL, NULL );
+ GpiSetBitmap( hDestMemPS, hCopy );
+
+ POINTL pts[3];
+
+ pts[0].x = 0;
+ pts[0].y = 0;
+ pts[1].x = size.cx;
+ pts[1].y = size.cy;
+ pts[2].x = 0;
+ pts[2].y = 0;
+
+ GpiBitBlt( hDestMemPS, hSrcMemPS, 3, pts, ROP_SRCCOPY, BBO_IGNORE );
+
+ GpiSetBitmap( hSrcMemPS, (HBITMAP)0L);
+ GpiSetBitmap( hDestMemPS, (HBITMAP)0L);
+ GpiAssociate( hSrcMemPS, NULLHANDLE );
+ GpiAssociate( hDestMemPS, NULLHANDLE );
+ GpiDestroyPS( hSrcMemPS );
+ GpiDestroyPS( hDestMemPS );
+ DevCloseDC( hSrcMemDC );
+ DevCloseDC( hDestMemDC );
+ }
+
+ return hCopy;
+}
+
+// ------------------------------------------------------------------
+
+BitmapBuffer* SalBitmap::AcquireBuffer( BOOL bReadOnly )
+{
+ BitmapBuffer* pBuffer = NULL;
+
+ if( mhDIB )
+ {
+ // bitmap infos can be found at the beginning of the memory
+ PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB;
+ PBITMAPINFOHEADER2 pBIH = (PBITMAPINFOHEADER2) pBI;
+
+ if( ( pBIH->ulCompression == BCA_RLE4 ) || ( pBIH->ulCompression == BCA_RLE8 ) )
+ {
+ Size aSizePix( pBIH->cx, pBIH->cy );
+ HANDLE hNewDIB = ImplCreateDIB( aSizePix, pBIH->cBitCount, BitmapPalette() );
+
+ if( hNewDIB )
+ {
+ // bitmap infos can be found at the beginning of the memory
+ PBITMAPINFO2 pNewBI = (PBITMAPINFO2) hNewDIB;
+ PBITMAPINFOHEADER2 pNewBIH = (PBITMAPINFOHEADER2) pNewBI;
+ const USHORT nColorCount = ImplGetDIBColorCount( hNewDIB );
+ const ULONG nOffset = *(ULONG*) pBI + nColorCount * sizeof( RGB2 );
+ BYTE* pOldBits = (BYTE*) pBI + nOffset;
+ BYTE* pNewBits = (BYTE*) pNewBI + nOffset;
+
+ memcpy( pNewBI, pBI, nOffset );
+ pNewBIH->ulCompression = 0;
+ ImplDecodeRLEBuffer( pOldBits, pNewBits, aSizePix, pBIH->ulCompression == BCA_RLE4 );
+
+ rtl_freeMemory( mhDIB );
+
+ mhDIB = hNewDIB;
+ pBI = pNewBI;
+ pBIH = pNewBIH;
+ }
+ }
+
+ if( pBIH->cPlanes == 1 )
+ {
+ pBuffer = new BitmapBuffer;
+
+ pBuffer->mnFormat = BMP_FORMAT_BOTTOM_UP |
+ ( pBIH->cBitCount == 1 ? BMP_FORMAT_1BIT_MSB_PAL :
+ pBIH->cBitCount == 4 ? BMP_FORMAT_4BIT_MSN_PAL :
+ pBIH->cBitCount == 8 ? BMP_FORMAT_8BIT_PAL :
+ pBIH->cBitCount == 16 ? BMP_FORMAT_16BIT_TC_MASK :
+ pBIH->cBitCount == 24 ? BMP_FORMAT_24BIT_TC_BGR :
+ pBIH->cBitCount == 32 ? BMP_FORMAT_32BIT_TC_MASK : 0UL );
+
+ if( BMP_SCANLINE_FORMAT( pBuffer->mnFormat ) )
+ {
+ pBuffer->mnWidth = maSize.Width();
+ pBuffer->mnHeight = maSize.Height();
+ pBuffer->mnScanlineSize = AlignedWidth4Bytes( maSize.Width() * pBIH->cBitCount );
+ pBuffer->mnBitCount = (USHORT) pBIH->cBitCount;
+
+ if( pBuffer->mnBitCount <= 8 )
+ {
+ const USHORT nPalCount = ImplGetDIBColorCount( mhDIB );
+
+ pBuffer->maPalette.SetEntryCount( nPalCount );
+
+ if( nPalCount )
+ memcpy( pBuffer->maPalette.ImplGetColorBuffer(), pBI->argbColor, nPalCount * sizeof( RGB2 ) );
+
+ pBuffer->mpBits = (BYTE*) pBI + *(ULONG*) pBI + nPalCount * sizeof( RGB2 );
+ }
+ else
+ pBuffer->mpBits = (BYTE*) pBI + *(ULONG*) pBI;
+ }
+ else
+ {
+ delete pBuffer;
+ pBuffer = NULL;
+ }
+ }
+ }
+
+ if( pBuffer && mhDIB1Subst )
+ {
+ rtl_FreeMemory( mhDIB1Subst );
+ mhDIB1Subst = 0;
+ }
+
+ return pBuffer;
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly )
+{
+ if( pBuffer )
+ {
+ if( mhDIB )
+ {
+ if( !bReadOnly && !!pBuffer->maPalette )
+ {
+ // bitmap infos can be found at the beginning of the memory
+ PBITMAPINFO2 pBI = (PBITMAPINFO2) mhDIB;
+ const USHORT nCount = pBuffer->maPalette.GetEntryCount();
+
+ if( nCount )
+ memcpy( pBI->argbColor, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGB2 ) );
+ }
+ }
+
+ delete pBuffer;
+ }
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf,
+ const Size& rSizePixel, BOOL bRLE4 )
+{
+ HPBYTE pRLE = (HPBYTE) pSrcBuf;
+ HPBYTE pDIB = (HPBYTE) pDstBuf;
+ HPBYTE pRow = (HPBYTE) pDstBuf;
+ ULONG nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) );
+ HPBYTE pLast = pDIB + rSizePixel.Height() * nWidthAl - 1;
+ ULONG nCountByte;
+ ULONG nRunByte;
+ ULONG nX = 0;
+ ULONG i;
+ BYTE cTmp;
+ BOOL bEndDecoding = FALSE;
+
+ if( pRLE && pDIB )
+ {
+ do
+ {
+ if( !( nCountByte = *pRLE++ ) )
+ {
+ nRunByte = *pRLE++;
+
+ if( nRunByte > 2UL )
+ {
+ if( bRLE4 )
+ {
+ nCountByte = nRunByte >> 1UL;
+
+ for( i = 0; i < nCountByte; i++ )
+ {
+ cTmp = *pRLE++;
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ ImplSetPixel4( pDIB, nX++, cTmp & 0x0f );
+ }
+
+ if( nRunByte & 1 )
+ ImplSetPixel4( pDIB, nX++, *pRLE++ >> 4 );
+
+ if( ( ( nRunByte + 1 ) >> 1 ) & 1 )
+ pRLE++;
+ }
+ else
+ {
+ HMEMCPY( &pDIB[ nX ], pRLE, nRunByte );
+ pRLE += nRunByte;
+ nX += nRunByte;
+
+ if( nRunByte & 1 )
+ pRLE++;
+ }
+ }
+ else if( !nRunByte )
+ {
+ pDIB = ( pRow += nWidthAl );
+ nX = 0UL;
+ }
+ else if( nRunByte == 1 )
+ bEndDecoding = TRUE;
+ else
+ {
+ nX += *pRLE++;
+ pDIB = ( pRow += ( *pRLE++ ) * nWidthAl );
+ }
+ }
+ else
+ {
+ cTmp = *pRLE++;
+
+ if( bRLE4 )
+ {
+ nRunByte = nCountByte >> 1;
+
+ for( i = 0; i < nRunByte; i++ )
+ {
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ ImplSetPixel4( pDIB, nX++, cTmp & 0x0f );
+ }
+
+ if( nCountByte & 1 )
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ }
+ else
+ {
+ for( i = 0; i < nCountByte; i++ )
+ pDIB[ nX++ ] = cTmp;
+ }
+ }
+ }
+ while( !bEndDecoding && ( pDIB <= pLast ) );
+ }
+}
diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx
new file mode 100644
index 000000000000..f501f8da303e
--- /dev/null
+++ b/vcl/os2/source/gdi/salgdi.cxx
@@ -0,0 +1,852 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <tools/svpm.h>
+
+#define _SV_SALGDI_CXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+// ClipRegions funktionieren immer noch nicht auf allen getesteten Druckern
+#define SAL_PRINTER_CLIPPATH 1
+// #define SAL_PRINTER_POLYPATH 1
+
+// =======================================================================
+
+void ImplInitSalGDI()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFreeSalGDI()
+{
+}
+
+// =======================================================================
+
+void ImplSalInitGraphics( SalGraphicsData* pData )
+{
+ GpiCreateLogColorTable( pData->mhPS, LCOL_RESET, LCOLF_RGB, 0, 0, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalDeInitGraphics( SalGraphicsData* pData )
+{
+}
+
+// =======================================================================
+
+SalGraphics::SalGraphics()
+{
+ maGraphicsData.mhPS = 0;
+ maGraphicsData.mhDC = 0;
+ maGraphicsData.mbLine = FALSE;
+ maGraphicsData.mbFill = FALSE;
+ maGraphicsData.mbXORMode = FALSE;
+ maGraphicsData.mbFontIsOutline = FALSE;
+ maGraphicsData.mbFontIsFixed = FALSE;
+ maGraphicsData.mnFontMetricCount = 0;
+ maGraphicsData.mpFontMetrics = NULL;
+ maGraphicsData.mpClipRectlAry = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics::~SalGraphics()
+{
+ if ( maGraphicsData.mpFontMetrics )
+ delete maGraphicsData.mpFontMetrics;
+}
+
+// -----------------------------------------------------------------------
+
+static SalColor ImplGetROPSalColor( SalROPColor nROPColor )
+{
+ SalColor nSalColor;
+
+ switch( nROPColor )
+ {
+ case SAL_ROP_0:
+ nSalColor = MAKE_SALCOLOR( 0, 0, 0 );
+ break;
+
+ case SAL_ROP_1:
+ case SAL_ROP_INVERT:
+ nSalColor = MAKE_SALCOLOR( 255, 255, 255 );
+ break;
+ }
+
+ return nSalColor;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetResolution( long& rDPIX, long& rDPIY )
+{
+ long nResolution;
+
+ // convert resolution from pels per meter to pels per inch
+ DevQueryCaps( maGraphicsData.mhDC, CAPS_HORIZONTAL_RESOLUTION, 1, &nResolution );
+ rDPIX = (nResolution * 100) / 3937;
+
+ // convert resolution from pels per meter to pels per inch
+ DevQueryCaps( maGraphicsData.mhDC, CAPS_VERTICAL_RESOLUTION, 1, &nResolution );
+ rDPIY = (nResolution * 100) / 3937;
+
+ if ( rDPIY < 96 )
+ {
+ rDPIX = (rDPIX*96) / rDPIY;
+ rDPIY = 96;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY )
+{
+ DevQueryCaps( maGraphicsData.mhDC, CAPS_HORIZONTAL_FONT_RES, 1, &rDPIX );
+ DevQueryCaps( maGraphicsData.mhDC, CAPS_VERTICAL_FONT_RES, 1, &rDPIY );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalGraphics::GetBitCount()
+{
+ LONG nBitCount;
+ DevQueryCaps( maGraphicsData.mhDC, CAPS_COLOR_BITCOUNT, 1, &nBitCount );
+ return (USHORT)nBitCount;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::ResetClipRegion()
+{
+#ifdef SAL_PRINTER_CLIPPATH
+ if ( maGraphicsData.mbPrinter )
+ GpiSetClipPath( maGraphicsData.mhPS, 0, SCP_RESET );
+ else
+#endif
+ {
+ HRGN hOldRegion;
+
+ GpiSetClipRegion( maGraphicsData.mhPS, NULL, &hOldRegion );
+ if ( hOldRegion )
+ GpiDestroyRegion( maGraphicsData.mhPS, hOldRegion );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::BeginSetClipRegion( ULONG nCount )
+{
+ maGraphicsData.mpClipRectlAry = new RECTL[ nCount ];
+ maGraphicsData.mnClipElementCount = 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+ RECTL* pClipRect = &maGraphicsData.mpClipRectlAry[ maGraphicsData.mnClipElementCount ];
+ pClipRect->xLeft = nX;
+ pClipRect->yTop = maGraphicsData.mnHeight - nY;
+ pClipRect->xRight = nX + nWidth;
+ pClipRect->yBottom = maGraphicsData.mnHeight - (nY + nHeight);
+ maGraphicsData.mnClipElementCount++;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::EndSetClipRegion()
+{
+#ifdef SAL_PRINTER_CLIPPATH
+ if ( maGraphicsData.mbPrinter )
+ {
+ GpiSetClipPath( maGraphicsData.mhPS, 0, SCP_RESET );
+ GpiBeginPath( maGraphicsData.mhPS, 1L );
+
+ for( int i = 0; i < maGraphicsData.mnClipElementCount; i++ )
+ {
+ POINTL aPt;
+ RECTL* pClipRect = &maGraphicsData.mpClipRectlAry[ i ];
+
+ aPt.x = pClipRect->xLeft;
+ aPt.y = pClipRect->yTop-1;
+ GpiMove( maGraphicsData.mhPS, &aPt );
+
+ aPt.x = pClipRect->xRight-1;
+ aPt.y = pClipRect->yBottom;
+
+ GpiBox( maGraphicsData.mhPS, DRO_OUTLINE, &aPt, 0, 0 );
+ }
+
+ GpiEndPath( maGraphicsData.mhPS );
+ GpiSetClipPath( maGraphicsData.mhPS, 1L, SCP_ALTERNATE | SCP_AND );
+ }
+ else
+#endif
+ {
+ HRGN hClipRegion = GpiCreateRegion( maGraphicsData.mhPS,
+ maGraphicsData.mnClipElementCount,
+ maGraphicsData.mpClipRectlAry );
+ HRGN hOldRegion;
+
+ GpiSetClipRegion( maGraphicsData.mhPS, hClipRegion, &hOldRegion );
+ if( hOldRegion )
+ GpiDestroyRegion( maGraphicsData.mhPS, hOldRegion );
+ }
+
+ delete [] maGraphicsData.mpClipRectlAry;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetLineColor()
+{
+ // don't draw line!
+ maGraphicsData.mbLine = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetLineColor( SalColor nSalColor )
+{
+ LINEBUNDLE lb;
+
+ // set color
+ lb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_LINE,
+ LBB_COLOR,
+ 0,
+ &lb );
+
+ // draw line!
+ maGraphicsData.mbLine = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetFillColor()
+{
+ // don't fill area!
+ maGraphicsData.mbFill = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetFillColor( SalColor nSalColor )
+{
+ AREABUNDLE ab;
+
+ // set color
+ ab.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_AREA,
+ ABB_COLOR,
+ 0,
+ &ab );
+
+ // fill area!
+ maGraphicsData.mbFill = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetXORMode( BOOL bSet )
+{
+ maGraphicsData.mbXORMode = bSet;
+ LONG nMixMode = bSet ? FM_XOR : FM_OVERPAINT;
+
+ // set mix mode for lines
+ LINEBUNDLE lb;
+ lb.usMixMode = nMixMode;
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_LINE,
+ LBB_MIX_MODE,
+ 0,
+ &lb );
+
+ // set mix mode for areas
+ AREABUNDLE ab;
+ ab.usMixMode = nMixMode;
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_AREA,
+ ABB_MIX_MODE,
+ 0,
+ &ab );
+
+ // set mix mode for text
+ CHARBUNDLE cb;
+ cb.usMixMode = nMixMode;
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_CHAR,
+ CBB_MIX_MODE,
+ 0,
+ &cb );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetROPLineColor( SalROPColor nROPColor )
+{
+ SetLineColor( ImplGetROPSalColor( nROPColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetROPFillColor( SalROPColor nROPColor )
+{
+ SetFillColor( ImplGetROPSalColor( nROPColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPixel( long nX, long nY )
+{
+ POINTL aPt;
+
+ aPt.x = nX;
+ aPt.y = TY( nY );
+
+ // set color
+ GpiSetPel( maGraphicsData.mhPS, &aPt );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor )
+{
+ // save old color
+ LINEBUNDLE oldLb;
+ GpiQueryAttrs( maGraphicsData.mhPS,
+ PRIM_LINE,
+ LBB_COLOR,
+ &oldLb );
+
+ // set new color
+ LINEBUNDLE lb;
+ lb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_LINE,
+ LBB_COLOR,
+ 0,
+ &lb );
+
+ // set color of pixel
+ POINTL aPt;
+ aPt.x = nX;
+ aPt.y = TY( nY );
+ GpiSetPel( maGraphicsData.mhPS, &aPt );
+
+ // restore old color
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_LINE,
+ LBB_COLOR,
+ 0,
+ &oldLb );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2 )
+{
+ // OS2 zeichnet den Endpunkt mit
+ POINTL aPt;
+ aPt.x = nX1;
+ aPt.y = TY( nY1 );
+ GpiMove( maGraphicsData.mhPS, &aPt );
+ aPt.x = nX2;
+ aPt.y = TY( nY2 );
+ GpiLine( maGraphicsData.mhPS, &aPt );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight )
+{
+ POINTL aPt;
+ long lControl;
+
+ if ( maGraphicsData.mbFill )
+ {
+ if ( maGraphicsData.mbLine )
+ lControl = DRO_OUTLINEFILL;
+ else
+ lControl = DRO_FILL;
+ }
+ else
+ {
+ if ( maGraphicsData.mbLine )
+ lControl = DRO_OUTLINE;
+ else
+ return;
+ }
+
+ aPt.x = nX;
+ aPt.y = TY( nY );
+ GpiMove( maGraphicsData.mhPS, &aPt );
+ aPt.x = nX + nWidth - 1;
+ aPt.y = TY( nY + nHeight - 1 );
+ GpiBox( maGraphicsData.mhPS, lControl, &aPt, 0, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry )
+{
+ // convert all points to sys orientation
+ POINTL* pOS2PtAry = new POINTL[ nPoints ];
+ POINTL* pTempOS2PtAry = pOS2PtAry;
+ const SalPoint* pTempPtAry = pPtAry;
+ ULONG nTempPoints = nPoints;
+ long nHeight = maGraphicsData.mnHeight - 1;
+
+ while( nTempPoints-- )
+ {
+ (*pTempOS2PtAry).x = (*pTempPtAry).mnX;
+ (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY;
+ pTempOS2PtAry++;
+ pTempPtAry++;
+ }
+
+ GpiMove( maGraphicsData.mhPS, pOS2PtAry );
+ GpiPolyLine( maGraphicsData.mhPS, nPoints, pOS2PtAry );
+ delete [] pOS2PtAry;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry )
+{
+ POLYGON aPolygon;
+
+ // create polygon
+ aPolygon.aPointl = new POINTL[ nPoints ];
+ aPolygon.ulPoints = nPoints;
+
+ // convert all points to sys orientation
+ POINTL* pTempOS2PtAry = aPolygon.aPointl;
+ const SalPoint* pTempPtAry = pPtAry;
+ ULONG nTempPoints = nPoints;
+ long nHeight = maGraphicsData.mnHeight - 1;
+
+ while( nTempPoints-- )
+ {
+ (*pTempOS2PtAry).x = (*pTempPtAry).mnX;
+ (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY;
+ pTempOS2PtAry++;
+ pTempPtAry++;
+ }
+
+ // Innenleben zeichnen
+ if ( maGraphicsData.mbFill )
+ {
+#ifdef SAL_PRINTER_POLYPATH
+ if ( maGraphicsData.mbPrinter )
+ {
+ GpiBeginPath( maGraphicsData.mhPS, 1 );
+ GpiMove( maGraphicsData.mhPS, aPolygon.aPointl );
+ GpiPolyLine( maGraphicsData.mhPS, aPolygon.ulPoints, aPolygon.aPointl );
+ GpiEndPath( maGraphicsData.mhPS );
+ GpiFillPath( maGraphicsData.mhPS, 1, 0 );
+
+ if ( maGraphicsData.mbLine )
+ {
+ GpiMove( maGraphicsData.mhPS, aPolygon.aPointl );
+ GpiPolyLine( maGraphicsData.mhPS, aPolygon.ulPoints, aPolygon.aPointl );
+ }
+ }
+ else
+#endif
+ {
+ ULONG nOptions = POLYGON_ALTERNATE;
+
+ if ( maGraphicsData.mbLine )
+ nOptions |= POLYGON_BOUNDARY;
+ else
+ nOptions |= POLYGON_NOBOUNDARY;
+
+ GpiMove( maGraphicsData.mhPS, aPolygon.aPointl );
+ GpiPolygons( maGraphicsData.mhPS, 1, &aPolygon, nOptions, POLYGON_EXCL );
+ }
+ }
+ else
+ {
+ if ( maGraphicsData.mbLine )
+ {
+ GpiMove( maGraphicsData.mhPS, aPolygon.aPointl );
+ GpiPolyLine( maGraphicsData.mhPS, nPoints, aPolygon.aPointl );
+ }
+ }
+
+ delete [] aPolygon.aPointl;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolyPolygon( ULONG nPoly, const ULONG* pPoints,
+ PCONSTSALPOINT* pPtAry )
+{
+ ULONG i;
+ long nHeight = maGraphicsData.mnHeight - 1;
+ POLYGON* aPolygonAry = new POLYGON[ nPoly ];
+
+ for( i = 0; i < nPoly; i++ )
+ {
+ const SalPoint * pTempPtAry = (const SalPoint*)pPtAry[ i ];
+
+ // create polygon
+ ULONG nTempPoints = pPoints[ i ];
+ POINTL * pTempOS2PtAry = new POINTL[ nTempPoints ];
+
+ // convert all points to sys orientation
+ aPolygonAry[ i ].ulPoints = nTempPoints;
+ aPolygonAry[ i ].aPointl = pTempOS2PtAry;
+
+ while( nTempPoints-- )
+ {
+ (*pTempOS2PtAry).x = (*pTempPtAry).mnX;
+ (*pTempOS2PtAry).y = nHeight - (*pTempPtAry).mnY;
+ pTempOS2PtAry++;
+ pTempPtAry++;
+ }
+ }
+
+ // Innenleben zeichnen
+ if ( maGraphicsData.mbFill )
+ {
+#ifdef SAL_PRINTER_POLYPATH
+ if ( maGraphicsData.mbPrinter )
+ {
+ GpiBeginPath( maGraphicsData.mhPS, 1 );
+ for ( i = 0; i < nPoly; i++ )
+ {
+ GpiMove( maGraphicsData.mhPS, aPolygonAry[i].aPointl );
+ GpiPolyLine( maGraphicsData.mhPS, aPolygonAry[i].ulPoints, aPolygonAry[i].aPointl );
+ }
+ GpiEndPath( maGraphicsData.mhPS );
+ GpiFillPath( maGraphicsData.mhPS, 1, 0 );
+ }
+ else
+#endif
+ {
+ ULONG nOptions = POLYGON_ALTERNATE;
+
+ if ( maGraphicsData.mbLine )
+ nOptions |= POLYGON_BOUNDARY;
+ else
+ nOptions |= POLYGON_NOBOUNDARY;
+
+ GpiMove( maGraphicsData.mhPS, aPolygonAry[ 0 ].aPointl );
+ GpiPolygons( maGraphicsData.mhPS, nPoly, aPolygonAry, nOptions, POLYGON_EXCL );
+ }
+ }
+ else
+ {
+ if ( maGraphicsData.mbLine )
+ {
+ for( i = 0; i < nPoly; i++ )
+ {
+ GpiMove( maGraphicsData.mhPS, aPolygonAry[ i ].aPointl );
+ GpiPolyLine( maGraphicsData.mhPS, aPolygonAry[ i ].ulPoints, aPolygonAry[ i ].aPointl );
+ }
+ }
+ }
+
+ // cleanup
+ for( i = 0; i < nPoly; i++ )
+ delete [] aPolygonAry[ i ].aPointl;
+ delete [] aPolygonAry;
+}
+
+// =======================================================================
+
+// MAXIMUM BUFSIZE EQ 0xFFFF
+#define POSTSCRIPT_BUFSIZE 0x1024
+// we only try to get the BoundingBox in the first 4096 bytes
+#define POSTSCRIPT_BOUNDINGSEARCH 0x1000
+
+static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ for ( ULONG i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+
+static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize )
+{
+ BOOL bRetValue = FALSE;
+ ULONG nBytesRead;
+
+ if ( nSize < 256 ) // we assume that the file is greater than 256 bytes
+ return FALSE;
+
+ if ( nSize < POSTSCRIPT_BOUNDINGSEARCH )
+ nBytesRead = nSize;
+ else
+ nBytesRead = POSTSCRIPT_BOUNDINGSEARCH;
+
+ BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nBytesRead, 14 );
+ if ( pDest )
+ {
+ int nSecurityCount = 100; // only 100 bytes following the bounding box will be checked
+ nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
+ pDest += 14;
+ for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
+ {
+ int nDivision = 1;
+ BOOL bDivision = FALSE;
+ BOOL bNegative = FALSE;
+ BOOL bValid = TRUE;
+
+ while ( ( --nSecurityCount ) && ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) pDest++;
+ BYTE nByte = *pDest;
+ while ( nSecurityCount && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) )
+ {
+ switch ( nByte )
+ {
+ case '.' :
+ if ( bDivision )
+ bValid = FALSE;
+ else
+ bDivision = TRUE;
+ break;
+ case '-' :
+ bNegative = TRUE;
+ break;
+ default :
+ if ( ( nByte < '0' ) || ( nByte > '9' ) )
+ nSecurityCount = 1; // error parsing the bounding box values
+ else if ( bValid )
+ {
+ if ( bDivision )
+ nDivision*=10;
+ nNumb[i] *= 10;
+ nNumb[i] += nByte - '0';
+ }
+ break;
+ }
+ nSecurityCount--;
+ nByte = *(++pDest);
+ }
+ if ( bNegative )
+ nNumb[i] = -nNumb[i];
+ if ( bDivision && ( nDivision != 1 ) )
+ nNumb[i] /= nDivision;
+ }
+ if ( nSecurityCount)
+ bRetValue = TRUE;
+ }
+ return bRetValue;
+}
+
+static void ImplWriteDouble( BYTE** pBuf, double nNumber )
+{
+// *pBuf += sprintf( (char*)*pBuf, "%f", nNumber );
+
+ if ( nNumber < 0 )
+ {
+ *(*pBuf)++ = (BYTE)'-';
+ nNumber = -nNumber;
+ }
+ ULONG nTemp = (ULONG)nNumber;
+ const String aNumber1( nTemp );
+ ULONG nLen = aNumber1.Len();
+
+ for ( USHORT n = 0; n < nLen; n++ )
+ *(*pBuf)++ = aNumber1[ n ];
+
+ nTemp = (ULONG)( ( nNumber - nTemp ) * 100000 );
+ if ( nTemp )
+ {
+ *(*pBuf)++ = (BYTE)'.';
+ const String aNumber2( nTemp );
+
+ ULONG nLen = aNumber2.Len();
+ if ( nLen < 8 )
+ {
+ for ( n = 0; n < ( 5 - nLen ); n++ )
+ {
+ *(*pBuf)++ = (BYTE)'0';
+ }
+ }
+ for ( USHORT n = 0; n < nLen; n++ )
+ {
+ *(*pBuf)++ = aNumber2[ n ];
+ }
+ }
+ *(*pBuf)++ = ' ';
+}
+
+inline void ImplWriteString( BYTE** pBuf, const char* sString )
+{
+ strcpy( (char*)*pBuf, sString );
+ *pBuf += strlen( sString );
+}
+
+BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize )
+{
+ if ( !maGraphicsData.mbPrinter )
+ return FALSE;
+
+ BOOL bRet = FALSE;
+ LONG nLong = 0;
+ if ( !(DevQueryCaps( maGraphicsData.mhDC, CAPS_TECHNOLOGY, 1, &nLong ) &&
+ (CAPS_TECH_POSTSCRIPT == nLong)) )
+ return FALSE;
+
+ BYTE* pBuf = new BYTE[ POSTSCRIPT_BUFSIZE ];
+ double nBoundingBox[4];
+
+ if ( pBuf && ImplGetBoundingBox( nBoundingBox, (BYTE*)pPtr, nSize ) )
+ {
+ LONG pOS2DXAry[4]; // hack -> print always 2 white space
+ POINTL aPt;
+ aPt.x = 0;
+ aPt.y = 0;
+ PCH pStr = " ";
+ for( long i = 0; i < 4; i++ )
+ pOS2DXAry[i] = i;
+ GpiCharStringPosAt( maGraphicsData.mhPS, &aPt, NULL, 0, 2, (PCH)pStr,(PLONG)&pOS2DXAry[0] );
+
+ double dM11 = nWidth / ( nBoundingBox[2] - nBoundingBox[0] );
+ double dM22 = - ( nHeight / (nBoundingBox[1] - nBoundingBox[3] ) );
+
+ BYTE* pTemp = pBuf;
+ ImplWriteString( &pTemp, "save\n[ " );
+ ImplWriteDouble( &pTemp, dM11 );
+ ImplWriteDouble( &pTemp, 0 );
+ ImplWriteDouble( &pTemp, 0 );
+ ImplWriteDouble( &pTemp, dM22 );
+ ImplWriteDouble( &pTemp, nX - ( dM11 * nBoundingBox[0] ) );
+ ImplWriteDouble( &pTemp, maGraphicsData.mnHeight - nY - ( dM22 * nBoundingBox[3] ) );
+ ImplWriteString( &pTemp, "] concat /showpage {} def\n" );
+
+ if ( DevEscape( maGraphicsData.mhDC, DEVESC_RAWDATA, pTemp - pBuf,
+ (PBYTE)pBuf, 0, NULL ) == DEV_OK )
+ {
+ UINT32 nToDo = nSize;
+ UINT32 nDoNow;
+ bRet = TRUE;
+ while( nToDo && bRet )
+ {
+ nDoNow = 0x4000;
+ if ( nToDo < nDoNow )
+ nDoNow = nToDo;
+
+ if ( DevEscape( maGraphicsData.mhDC, DEVESC_RAWDATA, nDoNow, (PBYTE)pPtr + nSize - nToDo,
+ 0, NULL ) == -1 )
+ bRet = FALSE;
+ nToDo -= nDoNow;
+ }
+
+ if ( bRet )
+ {
+ strcpy ( (char*)pBuf, "\nrestore\n" );
+ if ( DevEscape( maGraphicsData.mhDC, DEVESC_RAWDATA, 9, (PBYTE)pBuf,
+ 0, NULL ) == DEV_OK ) bRet = TRUE;
+ }
+ }
+ }
+ delete pBuf;
+ return bRet;
+}
+
diff --git a/vcl/os2/source/gdi/salgdi2.cxx b/vcl/os2/source/gdi/salgdi2.cxx
new file mode 100644
index 000000000000..ccc966d13aa3
--- /dev/null
+++ b/vcl/os2/source/gdi/salgdi2.cxx
@@ -0,0 +1,786 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <tools/svpm.h>
+
+#define _SV_SALGDI2_CXX
+
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+
+BOOL bFastTransparent = FALSE;
+
+// -----------
+// - Defines -
+// -----------
+
+#define RGBCOLOR( r, g, b ) ((ULONG)(((BYTE)(b)|((USHORT)(g)<<8))|(((ULONG)(BYTE)(r))<<16)))
+#define TY( y ) (maGraphicsData.mnHeight-(y)-1)
+
+// ---------------
+// - SalGraphics -
+// ---------------
+
+void SalGraphics::CopyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics )
+{
+ HPS hSrcPS;
+ POINTL thePoints[4];
+ long nSrcHeight;
+
+ if ( pSrcGraphics )
+ {
+ hSrcPS = pSrcGraphics->maGraphicsData.mhPS;
+ nSrcHeight = pSrcGraphics->maGraphicsData.mnHeight;
+ }
+ else
+ {
+ hSrcPS = maGraphicsData.mhPS;
+ nSrcHeight = maGraphicsData.mnHeight;
+ }
+
+ // lower-left corner of target
+ thePoints[0].x = pPosAry->mnDestX;
+ thePoints[0].y = TY( pPosAry->mnDestY + pPosAry->mnDestHeight - 1 );
+
+ // upper-right corner of target
+ thePoints[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth;
+ thePoints[1].y = TY( pPosAry->mnDestY - 1 );
+
+ // lower-left corner of source
+ thePoints[2].x = pPosAry->mnSrcX;
+ thePoints[2].y = nSrcHeight - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight );
+
+ if ( ( pPosAry->mnDestWidth != pPosAry->mnSrcWidth ) || ( pPosAry->mnDestHeight != pPosAry->mnSrcHeight ) )
+ {
+ // upper-right corner of Source
+ thePoints[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth;
+ thePoints[3].y = nSrcHeight - pPosAry->mnSrcY + pPosAry->mnSrcHeight;
+
+ GpiBitBlt( maGraphicsData.mhPS, hSrcPS, 4, thePoints,
+ maGraphicsData.mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE );
+ }
+ else
+ {
+ GpiBitBlt( maGraphicsData.mhPS, hSrcPS, 3, thePoints,
+ maGraphicsData.mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::CopyArea( long nDestX, long nDestY,
+ long nSrcX, long nSrcY,
+ long nSrcWidth, long nSrcHeight,
+ USHORT nFlags )
+{
+ POINTL thePoints[3];
+
+ // lower-left corner of target
+ thePoints[0].x = nDestX;
+ thePoints[0].y = TY( nDestY + nSrcHeight - 1 );
+
+ // upper-right corner of target
+ thePoints[1].x = nDestX + nSrcWidth;
+ thePoints[1].y = TY( nDestY - 1 );
+
+ // lower-left corner of source
+ thePoints[2].x = nSrcX;
+ thePoints[2].y = TY( nSrcY + nSrcHeight - 1);
+
+ GpiBitBlt( maGraphicsData.mhPS, maGraphicsData.mhPS, 3, thePoints,
+ ROP_SRCCOPY, BBO_IGNORE );
+
+ if ( (nFlags & SAL_COPYAREA_WINDOWINVALIDATE) && maGraphicsData.mbWindow )
+ {
+ // Overlap-Bereich berechnen und invalidieren
+ Point aVCLSrcPos( nSrcX, nSrcY );
+ Size aVCLSrcSize( nSrcWidth, nSrcHeight );
+ Rectangle aVCLSrcRect( aVCLSrcPos, aVCLSrcSize );
+ Rectangle aVCLClipRect;
+ SWP aSWP;
+
+ WinQueryWindowPos( maGraphicsData.mhWnd, &aSWP );
+ aVCLClipRect.Right() = aSWP.cx-1;
+ aVCLClipRect.Bottom() = aSWP.cy-1;
+ if ( !aVCLSrcRect.Intersection( aVCLClipRect ).IsEmpty() )
+ {
+ RECTL aSrcRect;
+ RECTL aTempRect;
+ HRGN hInvalidateRgn;
+ HRGN hTempRgn;
+ HWND hWnd;
+ long nRgnType;
+
+ long nVCLScrHeight = aVCLSrcRect.GetHeight();
+ aSrcRect.xLeft = aVCLSrcRect.Left();
+ aSrcRect.yBottom = TY( aVCLSrcRect.Top()+nVCLScrHeight-1 );
+ aSrcRect.xRight = aSrcRect.xLeft+aVCLSrcRect.GetWidth();
+ aSrcRect.yTop = aSrcRect.yBottom+nVCLScrHeight;
+
+ // Rechteck in Screen-Koordinaaten umrechnen
+ POINTL aPt;
+ long nScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
+ long nScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
+ aPt.x = 0;
+ aPt.y = 0;
+ WinMapWindowPoints( maGraphicsData.mhWnd, HWND_DESKTOP, &aPt, 1 );
+ aSrcRect.xLeft += aPt.x;
+ aSrcRect.yTop += aPt.y;
+ aSrcRect.xRight += aPt.x;
+ aSrcRect.yBottom += aPt.y;
+ hInvalidateRgn = 0;
+ // Bereiche ausserhalb des sichtbaren Bereiches berechnen
+ if ( aSrcRect.xLeft < 0 )
+ {
+ if ( !hInvalidateRgn )
+ hInvalidateRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aSrcRect );
+ aTempRect.xLeft = -31999;
+ aTempRect.yBottom = 0;
+ aTempRect.xRight = 0;
+ aTempRect.yTop = 31999;
+ hTempRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aTempRect );
+ GpiCombineRegion( maGraphicsData.mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF );
+ GpiDestroyRegion( maGraphicsData.mhPS, hTempRgn );
+ }
+ if ( aSrcRect.yBottom < 0 )
+ {
+ if ( !hInvalidateRgn )
+ hInvalidateRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aSrcRect );
+ aTempRect.xLeft = 0;
+ aTempRect.yBottom = -31999;
+ aTempRect.xRight = 31999;
+ aTempRect.yTop = 0;
+ hTempRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aTempRect );
+ GpiCombineRegion( maGraphicsData.mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF );
+ GpiDestroyRegion( maGraphicsData.mhPS, hTempRgn );
+ }
+ if ( aSrcRect.xRight > nScreenDX )
+ {
+ if ( !hInvalidateRgn )
+ hInvalidateRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aSrcRect );
+ aTempRect.xLeft = nScreenDX;
+ aTempRect.yBottom = 0;
+ aTempRect.xRight = 31999;
+ aTempRect.yTop = 31999;
+ hTempRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aTempRect );
+ GpiCombineRegion( maGraphicsData.mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF );
+ GpiDestroyRegion( maGraphicsData.mhPS, hTempRgn );
+ }
+ if ( aSrcRect.yTop > nScreenDY )
+ {
+ if ( !hInvalidateRgn )
+ hInvalidateRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aSrcRect );
+ aTempRect.xLeft = 0;
+ aTempRect.yBottom = nScreenDY;
+ aTempRect.xRight = 31999;
+ aTempRect.yTop = 31999;
+ hTempRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aTempRect );
+ GpiCombineRegion( maGraphicsData.mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF );
+ GpiDestroyRegion( maGraphicsData.mhPS, hTempRgn );
+ }
+
+ // Bereiche die von anderen Fenstern ueberlagert werden berechnen
+ HWND hWndParent = WinQueryWindow( maGraphicsData.mhWnd, QW_PARENT );
+ hWnd = WinQueryWindow( HWND_DESKTOP, QW_TOP );
+ aVCLSrcRect = Rectangle( aSrcRect.xLeft, aSrcRect.yBottom, aSrcRect.xRight, aSrcRect.yTop );
+ while ( hWnd )
+ {
+ if ( hWnd == hWndParent )
+ break;
+ if ( WinIsWindowVisible( hWnd ) )
+ {
+ WinQueryWindowPos( hWnd, &aSWP );
+ if ( !(aSWP.fl & SWP_MINIMIZE) )
+ {
+ aVCLClipRect = Rectangle( Point( aSWP.x, aSWP.y ), Size( aSWP.cx, aSWP.cy ) );
+ if ( aVCLSrcRect.IsOver( aVCLClipRect ) )
+ {
+ if ( !hInvalidateRgn )
+ hInvalidateRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aSrcRect );
+ aTempRect.xLeft = aSWP.x;
+ aTempRect.yBottom = aSWP.y;
+ aTempRect.xRight = aTempRect.xLeft+aSWP.cx;
+ aTempRect.yTop = aTempRect.yBottom+aSWP.cy;
+ hTempRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aTempRect );
+ GpiCombineRegion( maGraphicsData.mhPS, hInvalidateRgn, hInvalidateRgn, hTempRgn, CRGN_DIFF );
+ GpiDestroyRegion( maGraphicsData.mhPS, hTempRgn );
+ }
+ }
+ }
+ hWnd = WinQueryWindow( hWnd, QW_NEXT );
+ }
+
+ if ( hInvalidateRgn )
+ {
+ hTempRgn = GpiCreateRegion( maGraphicsData.mhPS, 1, &aSrcRect );
+ nRgnType = GpiCombineRegion( maGraphicsData.mhPS, hInvalidateRgn, hTempRgn, hInvalidateRgn, CRGN_DIFF );
+ GpiDestroyRegion( maGraphicsData.mhPS, hTempRgn );
+ if ( (nRgnType != RGN_ERROR) && (nRgnType != RGN_NULL) )
+ {
+ long nOffX = (nDestX-nSrcX);
+ long nOffY = (nSrcY-nDestY);
+ aPt.x = nOffX-aPt.x;
+ aPt.y = nOffY-aPt.y;
+ GpiOffsetRegion( maGraphicsData.mhPS, hInvalidateRgn, &aPt );
+ WinInvalidateRegion( maGraphicsData.mhWnd, hInvalidateRgn, TRUE );
+ // Hier loesen wir nur ein Update aus, wenn es der
+ // MainThread ist, damit es beim Bearbeiten der
+ // Paint-Message keinen Deadlock gibt, da der
+ // SolarMutex durch diesen Thread schon gelockt ist
+ SalData* pSalData = GetSalData();
+ ULONG nCurThreadId = ImplSalGetCurrentThreadId();
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ WinUpdateWindow( maGraphicsData.mhWnd );
+ }
+ GpiDestroyRegion( maGraphicsData.mhPS, hInvalidateRgn );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDrawBitmap( HPS hPS, long nScreenHeight,
+ const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,
+ BOOL bPrinter, int nDrawMode )
+{
+ if( hPS )
+ {
+ HANDLE hDrawDIB;
+ HBITMAP hDrawDDB = rSalBitmap.ImplGethDDB();
+ SalBitmap* pTmpSalBmp = NULL;
+ BOOL bPrintDDB = ( bPrinter && hDrawDDB );
+ BOOL bDrawDDB1 = ( ( rSalBitmap.GetBitCount() == 1 ) && hDrawDDB );
+
+ if( bPrintDDB || bDrawDDB1 )
+ {
+ pTmpSalBmp = new SalBitmap;
+ pTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() );
+ hDrawDIB = pTmpSalBmp->ImplGethDIB();
+ }
+ else
+ hDrawDIB = rSalBitmap.ImplGethDIB();
+
+ if( hDrawDIB )
+ {
+ HANDLE hSubst = rSalBitmap.ImplGethDIB1Subst();
+ POINTL pts[ 4 ];
+ BITMAPINFO2* pBI = (BITMAPINFO2*) hDrawDIB;
+ BITMAPINFOHEADER2* pBIH = (BITMAPINFOHEADER2*) pBI;
+ const long nHeight = pBIH->cy;
+ long nInfoSize = *(ULONG*) pBI + rSalBitmap.ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGB2 );
+ BYTE* pBits = (BYTE*) pBI + nInfoSize;
+
+ pts[0].x = pPosAry->mnDestX;
+ pts[0].y = nScreenHeight - pPosAry->mnDestY - pPosAry->mnDestHeight;
+ pts[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth - 1;
+ pts[1].y = nScreenHeight - pPosAry->mnDestY - 1;
+
+ pts[2].x = pPosAry->mnSrcX;
+ pts[2].y = nHeight - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight );
+ pts[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth;
+ pts[3].y = nHeight - pPosAry->mnSrcY;
+
+ // if we've got a 1Bit DIB, we create a 4Bit substitute
+ if( ( pBIH->cBitCount == 1 ) && !hSubst )
+ {
+ // create 4Bit substitute
+ hSubst = SalBitmap::ImplCreateDIB4FromDIB1( hDrawDIB );
+
+ // replace substitute only, if it is no temporary SalBitmap
+ if( !( bPrintDDB || bDrawDDB1 ) )
+ ( (SalBitmap&) rSalBitmap ).ImplReplacehDIB1Subst( hSubst );
+ }
+
+ if( hSubst )
+ {
+ pBI = (BITMAPINFO2*) hSubst;
+ pBIH = (BITMAPINFOHEADER2*) pBI;
+ nInfoSize = *(ULONG*) pBI + rSalBitmap.ImplGetDIBColorCount( hSubst ) * sizeof( RGB2 );
+ pBits = (BYTE*) pBI + nInfoSize;
+ }
+
+ if( bPrinter )
+ {
+ BYTE* pDummy;
+
+ // expand 8Bit-DIB's to 24Bit-DIB's, because some printer drivers
+ // have problems to print these DIB's (strange)
+ if( pBIH->cBitCount == 8 && pBIH->ulCompression == BCA_UNCOMP )
+ {
+ const long nWidth = pBIH->cx;
+ const long nHeight = pBIH->cy;
+ const long nWidthAl8 = AlignedWidth4Bytes( nWidth * 8 );
+ const long nWidthAl24 = AlignedWidth4Bytes( nWidth * 24 );
+ const long nNewImageSize = nHeight * nWidthAl24;
+ BITMAPINFOHEADER2* pNewInfo;
+
+ pDummy = new BYTE[ sizeof( BITMAPINFO2 ) + nNewImageSize ];
+ memset( pDummy, 0, sizeof( BITMAPINFO2 ) );
+
+ pNewInfo = (BITMAPINFOHEADER2*) pDummy;
+ pNewInfo->cbFix = sizeof( BITMAPINFOHEADER2 );
+ pNewInfo->cx = nWidth;
+ pNewInfo->cy = nHeight;
+ pNewInfo->cPlanes = 1;
+ pNewInfo->cBitCount = 24;
+ pNewInfo->ulCompression = BCA_UNCOMP;
+ pNewInfo->cbImage = nNewImageSize;
+
+ BYTE* pBitsSrc = (BYTE*) pBIH + nInfoSize;
+ BYTE* pBitsDst = pDummy + sizeof( BITMAPINFO2 );
+
+ for( long nY = 0UL; nY < nHeight; nY++ )
+ {
+ BYTE* pSrcLine = pBitsSrc + nY * nWidthAl8;
+ BYTE* pDstLine = pBitsDst + nY * nWidthAl24;
+
+ for( long nX = 0UL; nX < nWidth; nX++ )
+ {
+ const RGB2& rQuad = pBI->argbColor[ *pSrcLine++ ];
+
+ *pDstLine++ = rQuad.bBlue;
+ *pDstLine++ = rQuad.bGreen;
+ *pDstLine++ = rQuad.bRed;
+ }
+ }
+
+ nInfoSize = sizeof( BITMAPINFO2 );
+ }
+ else
+ {
+ const long nImageSize = ( pBIH->cbImage ? pBIH->cbImage : ( pBIH->cy * AlignedWidth4Bytes( pBIH->cx * pBIH->cBitCount ) ) );
+ const long nTotalSize = nInfoSize + nImageSize;
+
+ pDummy = new BYTE[ nTotalSize ];
+ memcpy( pDummy, pBI, nTotalSize );
+ }
+
+ GpiDrawBits( hPS, pDummy + nInfoSize, (BITMAPINFO2*) pDummy, 4L, pts, nDrawMode, BBO_IGNORE );
+ delete[] pDummy;
+ }
+ else
+ GpiDrawBits( hPS, pBits, pBI, 4L, pts, nDrawMode, BBO_IGNORE );
+ }
+ else if( hDrawDDB && !bPrintDDB )
+ {
+ POINTL pts[ 4 ];
+
+ pts[0].x = pPosAry->mnDestX;
+ pts[0].y = nScreenHeight - pPosAry->mnDestY - pPosAry->mnDestHeight;
+ pts[1].x = pPosAry->mnDestX + pPosAry->mnDestWidth - 1;
+ pts[1].y = nScreenHeight - pPosAry->mnDestY - 1;
+
+ pts[2].x = pPosAry->mnSrcX;
+ pts[2].y = rSalBitmap.GetSize().Height() - ( pPosAry->mnSrcY + pPosAry->mnSrcHeight );
+ pts[3].x = pPosAry->mnSrcX + pPosAry->mnSrcWidth;
+ pts[3].y = rSalBitmap.GetSize().Height() - pPosAry->mnSrcY;
+
+ GpiWCBitBlt( hPS, hDrawDDB, 4L, pts, nDrawMode, BBO_IGNORE );
+/*
+ HPS hDrawPS = ImplGetCachedPS( CACHED_HPS_DRAW, hDrawDDB );
+ GpiBitBlt( hPS, hDrawPS, 4, pts, nDrawMode, BBO_IGNORE );
+ ImplReleaseCachedPS( CACHED_HPS_DRAW );
+*/
+ }
+
+ if( bPrintDDB || bDrawDDB1 )
+ delete pTmpSalBmp;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap )
+{
+ ImplDrawBitmap( maGraphicsData.mhPS, maGraphicsData.mnHeight,
+ pPosAry, rSalBitmap,
+ maGraphicsData.mbPrinter,
+ maGraphicsData.mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ SalColor nTransparentColor )
+{
+ // an FM: kann erst einmal unberuecksichtigt bleiben
+ DrawBitmap( pPosAry, rSalBitmap );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ const SalBitmap& rTransparentBitmap )
+{
+ if( bFastTransparent )
+ {
+ ImplDrawBitmap( maGraphicsData.mhPS, maGraphicsData.mnHeight, pPosAry, rTransparentBitmap, FALSE, ROP_SRCAND );
+ ImplDrawBitmap( maGraphicsData.mhPS, maGraphicsData.mnHeight, pPosAry, rSalBitmap, FALSE, ROP_SRCPAINT );
+ }
+ else
+ {
+ SalTwoRect aPosAry = *pPosAry;
+ int nDstX = (int) aPosAry.mnDestX;
+ int nDstY = (int) aPosAry.mnDestY;
+ int nDstWidth = (int) aPosAry.mnDestWidth;
+ int nDstHeight = (int) aPosAry.mnDestHeight;
+ HAB hAB = GetSalData()->mhAB;
+ HPS hPS = maGraphicsData.mhPS;
+ DEVOPENSTRUC aDevOpenStruc = { NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+ SIZEL aSizeL = { nDstWidth, nDstHeight };
+ POINTL aPtL[ 3 ];
+
+ HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 );
+ HPS hMemPS = GpiCreatePS( hAB, hMemDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS );
+ HBITMAP hMemBitmap = ImplCreateVirDevBitmap( hMemDC, hMemPS, nDstWidth, nDstHeight, 0 );
+ HBITMAP hMemOld = (HBITMAP) GpiSetBitmap( hMemPS, hMemBitmap );
+ HDC hMaskDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 );
+ HPS hMaskPS = GpiCreatePS( hAB, hMaskDC, &aSizeL, GPIT_MICRO | GPIA_ASSOC | PU_PELS );
+ HBITMAP hMaskBitmap = ImplCreateVirDevBitmap( hMaskDC, hMaskPS, nDstWidth, nDstHeight, 0 );
+ HBITMAP hMaskOld = (HBITMAP) GpiSetBitmap( hMaskPS, hMaskBitmap );
+/*
+ HPS hMemPS = ImplGetCachedPS( CACHED_HPS_1, 0 );
+ HPS hMaskPS = ImplGetCachedPS( CACHED_HPS_2, 0 );
+*/
+ aPosAry.mnDestX = aPosAry.mnDestY = 0L;
+
+ aPtL[ 0 ].x = 0;
+ aPtL[ 0 ].y = 0;
+ aPtL[ 1 ].x = nDstWidth;
+ aPtL[ 1 ].y = nDstHeight;
+ aPtL[ 2 ].x = nDstX;
+ aPtL[ 2 ].y = TY( nDstY + nDstHeight - 1 );
+
+ GpiBitBlt( hMemPS, hPS, 3, aPtL, ROP_SRCCOPY, BBO_IGNORE );
+ ImplDrawBitmap( hMaskPS, nDstHeight, &aPosAry, rTransparentBitmap, FALSE, ROP_SRCCOPY );
+
+ aPtL[ 2 ].x = 0;
+ aPtL[ 2 ].y = 0;
+
+ GpiBitBlt( hMemPS, hMaskPS, 3, aPtL, ROP_SRCAND, BBO_IGNORE );
+ ImplDrawBitmap( hMaskPS, nDstHeight, &aPosAry, rSalBitmap, FALSE, ROP_SRCERASE );
+ GpiBitBlt( hMemPS, hMaskPS, 3, aPtL, ROP_SRCPAINT, BBO_IGNORE );
+
+ aPtL[ 0 ].x = nDstX;
+ aPtL[ 0 ].y = TY( nDstY + nDstHeight - 1 );
+ aPtL[ 1 ].x = nDstX + nDstWidth;
+ aPtL[ 1 ].y = TY( nDstY - 1 );
+
+ GpiBitBlt( hPS, hMemPS, 3, aPtL, ROP_SRCCOPY, BBO_IGNORE );
+
+ GpiSetBitmap( hMaskPS, hMaskOld );
+ GpiDestroyPS( hMaskPS );
+ DevCloseDC( hMaskDC );
+ GpiDeleteBitmap( hMaskBitmap );
+
+ GpiSetBitmap( hMemPS, hMemOld );
+ GpiDestroyPS( hMemPS );
+ DevCloseDC( hMemDC );
+ GpiDeleteBitmap( hMemBitmap );
+
+/*
+ ImplReleaseCachedPS( CACHED_HPS_1 );
+ ImplReleaseCachedPS( CACHED_HPS_2 );
+*/
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawMask( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ SalColor nMaskColor )
+{
+ SalTwoRect aPosAry = *pPosAry;
+ HPS hPS = maGraphicsData.mhPS;
+ IMAGEBUNDLE aBundle, aOldBundle;
+ AREABUNDLE aAreaBundle, aOldAreaBundle;
+ const ULONG nColor = RGBCOLOR( SALCOLOR_RED( nMaskColor ),
+ SALCOLOR_GREEN( nMaskColor ),
+ SALCOLOR_BLUE( nMaskColor ) );
+
+ GpiQueryAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, &aOldBundle );
+ aBundle.lColor = RGBCOLOR( 0, 0, 0 );
+ aBundle.lBackColor = RGBCOLOR( 0xFF, 0xFF, 0xFF );
+ GpiSetAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, 0, &aBundle );
+
+ GpiQueryAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL |
+ ABB_MIX_MODE | ABB_BACK_MIX_MODE, &aOldAreaBundle );
+ aAreaBundle.lColor = nColor;
+ aAreaBundle.lBackColor = nColor;
+ aAreaBundle.usSymbol = PATSYM_SOLID;
+ aAreaBundle.usMixMode = FM_OVERPAINT;
+ aAreaBundle.usBackMixMode = BM_OVERPAINT;
+ GpiSetAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL |
+ ABB_MIX_MODE | ABB_BACK_MIX_MODE, 0, &aAreaBundle );
+
+ ImplDrawBitmap( hPS, maGraphicsData.mnHeight, &aPosAry, rSalBitmap, FALSE, 0x00B8L );
+
+ GpiSetAttrs( hPS, PRIM_IMAGE, IBB_COLOR | IBB_BACK_COLOR, 0, &aOldBundle );
+ GpiSetAttrs( hPS, PRIM_AREA, ABB_COLOR | ABB_BACK_COLOR | ABB_SYMBOL |
+ ABB_MIX_MODE | ABB_BACK_MIX_MODE, 0, &aOldAreaBundle );
+}
+
+// -----------------------------------------------------------------------
+
+SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nDX, long nDY )
+{
+ HAB hAB = GetSalData()->mhAB;
+ SIZEL size = { nDX, nDY };
+ SalBitmap* pSalBitmap = NULL;
+
+ // create device context (at this time allways display compatible)
+ DEVOPENSTRUC aDevOpenStruc = { NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+ HDC hMemDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5L, (PDEVOPENDATA)&aDevOpenStruc, 0 );
+ HPS hMemPS = GpiCreatePS( hAB, hMemDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS );
+ HBITMAP hMemBmp = ImplCreateVirDevBitmap( hMemDC, hMemPS, nDX, nDY, 0 );
+ HBITMAP hMemOld = GpiSetBitmap( hMemPS, hMemBmp );
+
+ // creation successfull?
+ if( hMemDC && hMemPS && hMemBmp )
+ {
+ POINTL thePoints[ 3 ];
+
+ // lower-left corner of target
+ thePoints[ 0 ].x = 0;
+ thePoints[ 0 ].y = 0;
+
+ // upper-right corner of target
+ thePoints[ 1 ].x = nDX;
+ thePoints[ 1 ].y = nDY;
+
+ // lower-left corner of source
+ thePoints[ 2 ].x = nX;
+ thePoints[ 2 ].y = TY( nY + nDY - 1 );
+
+ long lHits = GpiBitBlt( hMemPS, maGraphicsData.mhPS, 3, thePoints,
+ maGraphicsData.mbXORMode ? ROP_SRCINVERT : ROP_SRCCOPY, BBO_IGNORE );
+
+ if( hMemPS )
+ {
+ GpiSetBitmap( hMemPS, hMemOld );
+ GpiDestroyPS( hMemPS );
+ }
+
+ if( hMemDC )
+ DevCloseDC( hMemDC );
+
+ if( lHits == GPI_OK )
+ {
+ pSalBitmap = new SalBitmap;
+
+ if( !pSalBitmap->Create( hMemBmp, FALSE, FALSE ) )
+ {
+ delete pSalBitmap;
+ pSalBitmap = NULL;
+ }
+ }
+ }
+
+ if( !pSalBitmap )
+ GpiDeleteBitmap( hMemBmp );
+
+ // return pointer to SAL-Bitmap
+ return pSalBitmap;
+}
+
+// -----------------------------------------------------------------------
+
+SalColor SalGraphics::GetPixel( long nX, long nY )
+{
+ POINTL aPt = { nX, TY( nY ) };
+ LONG nColor = GpiQueryPel( maGraphicsData.mhPS, &aPt );
+
+ return MAKE_SALCOLOR( (BYTE) ( nColor >> 16 ), (BYTE) ( nColor >> 8 ), (BYTE) nColor );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags )
+{
+ if( nFlags & SAL_INVERT_TRACKFRAME )
+ {
+ // save old vylues
+ LINEBUNDLE oldLb;
+ LINEBUNDLE lb;
+ GpiQueryAttrs( maGraphicsData.mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, &oldLb );
+
+ // set linetype to short dash
+ lb.lColor = RGBCOLOR( 255, 255, 255 );
+ lb.usMixMode = FM_XOR;
+ lb.usType = LINETYPE_ALTERNATE;
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &lb );
+
+ // draw inverted box
+ POINTL aPt;
+
+ aPt.x = nX;
+ aPt.y = TY( nY );
+
+ GpiMove( maGraphicsData.mhPS, &aPt );
+
+ aPt.x = nX + nWidth - 1;
+ aPt.y = TY( nY + nHeight - 1 );
+
+ GpiBox( maGraphicsData.mhPS, DRO_OUTLINE, &aPt, 0, 0 );
+
+ // restore old values
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &oldLb );
+
+ }
+ else
+ {
+ // save old values
+ AREABUNDLE oldAb;
+ AREABUNDLE ab;
+
+ GpiQueryAttrs( maGraphicsData.mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, &oldAb );
+
+ // set fill color to black
+ ab.lColor = RGBCOLOR( 255, 255, 255 );
+ ab.usMixMode = FM_XOR;
+ ab.usSymbol = (nFlags & SAL_INVERT_50) ? PATSYM_DENSE5 : PATSYM_SOLID;
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &ab );
+
+ // draw inverted box
+ POINTL aPt;
+
+ aPt.x = nX;
+ aPt.y = TY( nY );
+
+ GpiMove( maGraphicsData.mhPS, &aPt );
+
+ aPt.x = nX + nWidth - 1;
+ aPt.y = TY( nY + nHeight - 1 );
+
+ GpiBox( maGraphicsData.mhPS, DRO_FILL, &aPt, 0, 0 );
+
+ // restore old values
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &oldAb );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags )
+{
+ if( nFlags & SAL_INVERT_TRACKFRAME )
+ {
+ // save old vylues
+ LINEBUNDLE oldLb;
+ LINEBUNDLE lb;
+ GpiQueryAttrs( maGraphicsData.mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, &oldLb );
+
+ // set linetype to short dash
+ lb.lColor = RGBCOLOR( 255, 255, 255 );
+ lb.usMixMode = FM_XOR;
+ lb.usType = LINETYPE_ALTERNATE;
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &lb );
+
+ // Draw Polyline
+ DrawPolyLine( nPoints, pPtAry );
+
+ // restore old values
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_LINE, LBB_MIX_MODE | LBB_TYPE | LBB_COLOR, 0, &oldLb );
+ }
+ else
+ {
+ // save old values
+ AREABUNDLE oldAb;
+ AREABUNDLE ab;
+
+ GpiQueryAttrs( maGraphicsData.mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, &oldAb );
+
+ // set fill color to black
+ ab.lColor = RGBCOLOR( 255, 255, 255 );
+ ab.usMixMode = FM_XOR;
+ ab.usSymbol = (nFlags & SAL_INVERT_50) ? PATSYM_DENSE5 : PATSYM_SOLID;
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &ab );
+
+ // Draw Polyline
+ DrawPolygon( nPoints, pPtAry );
+
+ // restore old values
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_AREA, ABB_COLOR | ABB_MIX_MODE | ABB_SYMBOL, 0, &oldAb );
+ }
+}
+
diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx
new file mode 100644
index 000000000000..0876f5c4f606
--- /dev/null
+++ b/vcl/os2/source/gdi/salgdi3.cxx
@@ -0,0 +1,780 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define INCL_GRE_STRINGS
+
+#include <string.h>
+#include <stdlib.h>
+#include <math.h>
+#include <tools/svpm.h>
+
+#define _SV_SALGDI3_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define SAL_DRAWTEXT_STACKBUF 128
+
+#define FONTTAB_FACTOR_PRINTER 18
+#define FONTTAB_FACTOR_DISPLAY 9
+static unsigned char aFontCharTab32[32] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
+};
+
+// =======================================================================
+
+static PM_USHORT ImplSalToCharSet( CharSet eCharSet )
+{
+ // !!! Fuer DBCS-Systeme muss dieser Code auskommentiert werden und 0
+ // !!! zurueckgegeben werden, solange die DBCS-Charsets nicht
+ // !!! durchgereicht werden
+
+ switch ( eCharSet )
+ {
+ case CHARSET_IBMPC_437:
+ return 437;
+
+ case CHARSET_IBMPC_850:
+ return 850;
+
+ case CHARSET_IBMPC_860:
+ return 860;
+
+ case CHARSET_IBMPC_861:
+ return 861;
+
+ case CHARSET_IBMPC_863:
+ return 863;
+
+ case CHARSET_IBMPC_865:
+ return 865;
+
+ case CHARSET_ANSI:
+ return 1004;
+
+ case CHARSET_SYMBOL:
+ return 65400;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static CharSet ImplCharSetToSal( PM_USHORT usCodePage )
+{
+ switch ( usCodePage )
+ {
+ case 437:
+ return CHARSET_IBMPC_437;
+
+ case 850:
+ return CHARSET_IBMPC_850;
+
+ case 860:
+ return CHARSET_IBMPC_860;
+
+ case 861:
+ return CHARSET_IBMPC_861;
+
+ case 863:
+ return CHARSET_IBMPC_863;
+
+ case 865:
+ return CHARSET_IBMPC_865;
+
+ case 1004:
+ return CHARSET_ANSI;
+
+ case 65400:
+ return CHARSET_SYMBOL;
+
+ }
+
+ return CHARSET_DONTKNOW;
+}
+
+// -----------------------------------------------------------------------
+
+static FontWeight ImplWeightToSal( PM_USHORT nWeight )
+{
+ // Falls sich jemand an die alte Doku gehalten hat
+ if ( nWeight > 999 )
+ nWeight /= 1000;
+
+ switch ( nWeight )
+ {
+ case 1:
+ return WEIGHT_THIN;
+
+ case 2:
+ return WEIGHT_ULTRALIGHT;
+
+ case 3:
+ return WEIGHT_LIGHT;
+
+ case 4:
+ return WEIGHT_SEMILIGHT;
+
+ case 5:
+ return WEIGHT_NORMAL;
+
+ case 6:
+ return WEIGHT_SEMIBOLD;
+
+ case 7:
+ return WEIGHT_BOLD;
+
+ case 8:
+ return WEIGHT_ULTRABOLD;
+
+ case 9:
+ return WEIGHT_BLACK;
+ }
+
+ return WEIGHT_DONTKNOW;
+}
+
+// -----------------------------------------------------------------------
+
+static XubString ImpStyleNameToSal( const xub_Unicode* pFamilyName,
+ const xub_Unicode* pFaceName,
+ USHORT nLen )
+{
+ if ( !nLen )
+ nLen = WSstrlen( pFamilyName );
+
+ // FamilyName gegebenenfalls abschneiden
+ if ( WSstrncmp( pFamilyName, pFaceName, nLen ) == 0 )
+ {
+ USHORT nFaceLen = (USHORT)WSstrlen( pFaceName+nLen );
+ // Ist Facename laenger, schneiden wir den FamilyName ab
+ if ( nFaceLen > 1 )
+ return XubString( pFaceName+(nLen+1), nFaceLen-1 );
+ else
+ return XubString();
+ }
+ else
+ return XubString( pFaceName );
+}
+
+// =======================================================================
+
+void SalGraphics::SetTextColor( SalColor nSalColor )
+{
+ CHARBUNDLE cb;
+
+ cb.lColor = RGBCOLOR( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ // set default color attributes
+ GpiSetAttrs( maGraphicsData.mhPS,
+ PRIM_CHAR,
+ CBB_COLOR,
+ 0,
+ &cb );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalGraphics::SetFont( ImplFontSelectData* pFont )
+{
+ ImplFontData* pFontData = pFont->mpFontData;
+ FATTRS aFAttrs;
+ BOOL bOutline;
+
+ memset( &aFAttrs, 0, sizeof( FATTRS ) );
+ aFAttrs.usRecordLength = sizeof( FATTRS );
+
+ aFAttrs.usCodePage = ImplSalToCharSet( pFont->meCharSet );
+ aFAttrs.lMaxBaselineExt = pFont->mnHeight;
+ aFAttrs.lAveCharWidth = pFont->mnWidth;
+
+ // do we have a pointer to the FONTMETRICS of the selected font? -> use it!
+ if ( pFontData )
+ {
+ PFONTMETRICS pFontMetric = (PFONTMETRICS)pFontData->mpSysData;
+ strcpy( (char*)(aFAttrs.szFacename), pFontMetric->szFacename );
+ aFAttrs.lMatch = pFontMetric->lMatch;
+ aFAttrs.idRegistry = pFontMetric->idRegistry;
+
+ bOutline = (pFontMetric->fsDefn & FM_DEFN_OUTLINE) != 0;
+ maGraphicsData.mbFontIsFixed = (pFontMetric->fsType & FM_TYPE_FIXED) != 0;
+
+ if ( bOutline )
+ {
+ aFAttrs.fsFontUse |= FATTR_FONTUSE_OUTLINE;
+ if ( pFont->mnOrientation )
+ aFAttrs.fsFontUse |= FATTR_FONTUSE_TRANSFORMABLE;
+ }
+ else
+ {
+ aFAttrs.lMaxBaselineExt = pFontData->mnHeight;
+ aFAttrs.lAveCharWidth = pFontData->mnWidth;
+ }
+
+ if ( (pFont->mpFontData->meItalic == ITALIC_NONE) && (pFont->meItalic != ITALIC_NONE) )
+ aFAttrs.fsSelection |= FATTR_SEL_ITALIC;
+ if ( ((short)pFont->meWeight - (short)pFont->mpFontData->meWeight >= 2) )
+ aFAttrs.fsSelection |= FATTR_SEL_BOLD;
+ }
+ else
+ {
+ String aName = pFont->maName.GetToken( 0 );
+ strncpy( (char*)(aFAttrs.szFacename), aName, sizeof( aFAttrs.szFacename ) );
+
+ bOutline = FALSE;
+ maGraphicsData.mbFontIsFixed = FALSE;
+
+ if ( pFont->meItalic != ITALIC_NONE )
+ aFAttrs.fsSelection |= FATTR_SEL_ITALIC;
+ if ( pFont->meWeight > WEIGHT_MEDIUM )
+ aFAttrs.fsSelection |= FATTR_SEL_BOLD;
+ }
+
+ if ( GpiCreateLogFont( maGraphicsData.mhPS, NULL, 10, &aFAttrs ) == GPI_ERROR )
+ return SAL_SETFONT_REMOVEANDMATCHNEW;
+
+ CHARBUNDLE aBundle;
+
+ PM_ULONG nAttrsDefault = 0;
+ PM_ULONG nAttrs = CBB_SET;
+ aBundle.usSet = 10;
+
+ nAttrs |= CBB_BOX;
+ if ( bOutline )
+ {
+ aBundle.sizfxCell.cy = MAKEFIXED( pFont->mnHeight, 0 );
+
+ if ( !pFont->mnWidth )
+ {
+ LONG nXFontRes;
+ LONG nYFontRes;
+ LONG nHeight;
+
+ // Auf die Aufloesung achten, damit das Ergebnis auch auf
+ // Drucken mit 180*360 DPI stimmt. Ausserdem muss gerundet
+ // werden, da auf meinem OS2 beispielsweise als
+ // Bildschirmaufloesung 3618*3622 PixelPerMeter zurueck-
+ // gegeben wird
+ DevQueryCaps( maGraphicsData.mhDC, CAPS_HORIZONTAL_RESOLUTION, 1, &nXFontRes );
+ DevQueryCaps( maGraphicsData.mhDC, CAPS_VERTICAL_RESOLUTION, 1, &nYFontRes );
+ nHeight = pFont->mnHeight;
+ nHeight *= nXFontRes;
+ nHeight += nYFontRes/2;
+ nHeight /= nYFontRes;
+ aBundle.sizfxCell.cx = MAKEFIXED( nHeight, 0 );
+ }
+ else
+ aBundle.sizfxCell.cx = MAKEFIXED( pFont->mnWidth, 0 );
+ }
+ else
+ nAttrsDefault |= CBB_BOX;
+
+ // set orientation for outlinefonts
+ nAttrs |= CBB_ANGLE;
+ if ( pFont->mnOrientation )
+ {
+ if ( bOutline )
+ {
+ double alpha = (double)(pFont->mnOrientation);
+ alpha *= 0.0017453292; // *PI / 1800
+ maGraphicsData.mnOrientationY = (long) (1000.0 * sin( alpha ));
+ maGraphicsData.mnOrientationX = (long) (1000.0 * cos( alpha ));
+ aBundle.ptlAngle.x = maGraphicsData.mnOrientationX;
+ aBundle.ptlAngle.y = maGraphicsData.mnOrientationY;
+ }
+ else
+ {
+ nAttrsDefault |= CBB_ANGLE;
+ maGraphicsData.mnOrientationX = 1;
+ maGraphicsData.mnOrientationY = 0;
+ }
+ }
+ else
+ {
+ nAttrsDefault |= CBB_ANGLE;
+ maGraphicsData.mnOrientationX = 1;
+ maGraphicsData.mnOrientationY = 0;
+ }
+
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_CHAR,
+ nAttrs,
+ nAttrsDefault,
+ &aBundle );
+
+ // save info about font
+ maGraphicsData.mbFontIsOutline = bOutline;
+
+ return SAL_SETFONT_USEDRAWTEXTARRAY;
+}
+
+// -----------------------------------------------------------------------
+
+long SalGraphics::GetCharWidth( USHORT nChar1, USHORT nChar2, long* pWidthAry )
+{
+ POINTL aNullPt = { 0, 0 };
+ POINTL aFontCharPtBuf[33];
+ unsigned char aFontCharTabBuf[FONTTAB_FACTOR_PRINTER];
+ long nFontTabFactor = maGraphicsData.mbPrinter
+ ? FONTTAB_FACTOR_PRINTER
+ : FONTTAB_FACTOR_DISPLAY;
+
+ // Orientation? -> rotate to 0 degree!
+ if ( (maGraphicsData.mnOrientationY != 0) && (maGraphicsData.mnOrientationX != 1) )
+ {
+ CHARBUNDLE aBundle;
+ aBundle.ptlAngle.x = 1;
+ aBundle.ptlAngle.y = 0;
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_CHAR, CBB_ANGLE, 0, &aBundle );
+ }
+
+ // Fixed-Font und Fontbreitentabelle bestimmen
+ // Wir benutzen GpiQueryCharStringPos() (und nicht GpiQueryWidthTable())
+ // um die Genauigkeit zu erhoehen. In dem String stehen bis auf die
+ // ersten 32-Zeichen FONTATB_FACTOR* in der Tabelle um die Genauigkeit
+ // um den Faktor FONTTAB_FACTOR (9 bzw. 18) zu steigern. Dies muessen wir tun,
+ // da auf einen ganzen String die Genauigkeit der Zeichenbreiten
+ // groesser als Pixel ist. Somit muessen die Werte, die in der Tabelle
+ // abgefragt werden durch FONTTAB_FACTOR dividiert werden.
+ USHORT i = 0;
+ if ( maGraphicsData.mbFontIsFixed )
+ {
+ // Bei FixedFonts brauchen wir nicht soviele Zeichen
+ // uebergeben, da alle gleich breit sind
+ memset( aFontCharTabBuf, 'x', nFontTabFactor );
+ GpiQueryCharStringPosAt( maGraphicsData.mhPS, &aNullPt, 0, nFontTabFactor,
+ (PCH)aFontCharTabBuf, NULL, aFontCharPtBuf );
+
+ long nWidth = aFontCharPtBuf[nFontTabFactor].x - aFontCharPtBuf[0].x;
+ long nFontTabFactor2 = nFontTabFactor/2;
+ // Breite auf ganze Pixel alignen, damit Schriftbild besser aussieht
+ nWidth = (nWidth+nFontTabFactor2)/nFontTabFactor;
+ for ( ; i < 256; i++ )
+ pWidthAry[i] = nWidth;
+ nFontTabFactor = 1;
+ }
+ else
+ {
+ // Die ersten 32 Zeichen haben nur eine einfache Genauigkeit, damit
+ // wir nicht soviele Werte abfragen muessen
+ GpiQueryCharStringPosAt( maGraphicsData.mhPS, &aNullPt, 0, 32,
+ (PCH)aFontCharTab32, NULL, aFontCharPtBuf );
+ for ( ; i < 32; i++ )
+ pWidthAry[ i ] = (aFontCharPtBuf[i+1].x - aFontCharPtBuf[i].x) * nFontTabFactor;
+
+ // Die restlichen Zeichen mit (fast) genauer Aufloesung
+ for ( ; i < 256; i++ )
+ {
+ memset( aFontCharTabBuf, i, nFontTabFactor );
+ GpiQueryCharStringPosAt( maGraphicsData.mhPS, &aNullPt, 0, nFontTabFactor,
+ (PCH)aFontCharTabBuf, NULL, aFontCharPtBuf );
+ pWidthAry[ i ] = aFontCharPtBuf[nFontTabFactor].x - aFontCharPtBuf[0].x;
+ }
+ }
+
+ // Orientation? -> rotate back!
+ if ( (maGraphicsData.mnOrientationY != 0) && (maGraphicsData.mnOrientationX != 1) )
+ {
+ CHARBUNDLE aBundle;
+ aBundle.ptlAngle.x = maGraphicsData.mnOrientationX;
+ aBundle.ptlAngle.y = maGraphicsData.mnOrientationY;
+ GpiSetAttrs( maGraphicsData.mhPS, PRIM_CHAR, CBB_ANGLE, 0, &aBundle );
+ }
+
+ return nFontTabFactor;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+{
+ FONTMETRICS aOS2Metric;
+ GpiQueryFontMetrics( maGraphicsData.mhPS, sizeof( aOS2Metric ), &aOS2Metric );
+
+ pMetric->maName = aOS2Metric.szFamilyname;
+ pMetric->maStyleName = ImpStyleNameToSal( aOS2Metric.szFamilyname,
+ aOS2Metric.szFacename,
+ strlen( aOS2Metric.szFamilyname ) );
+
+ pMetric->meCharSet = ImplCharSetToSal( aOS2Metric.usCodePage );
+ pMetric->meWeight = ImplWeightToSal( aOS2Metric.usWeightClass );
+
+ if ( aOS2Metric.panose.bFamilyType == 3 )
+ pMetric->meFamily = FAMILY_SCRIPT;
+ else
+ pMetric->meFamily = FAMILY_DONTKNOW;
+
+ if ( aOS2Metric.fsType & FM_TYPE_FIXED )
+ pMetric->mePitch = PITCH_FIXED;
+ else
+ pMetric->mePitch = PITCH_VARIABLE;
+
+ if ( aOS2Metric.fsSelection & FM_SEL_ITALIC )
+ pMetric->meItalic = ITALIC_NORMAL;
+ else
+ pMetric->meItalic = ITALIC_NONE;
+
+ if ( aOS2Metric.fsDefn & FM_DEFN_OUTLINE )
+ {
+ pMetric->meType = TYPE_SCALABLE;
+ pMetric->mnWidth = aOS2Metric.lEmInc;
+ }
+ else
+ {
+ pMetric->meType = TYPE_RASTER;
+ pMetric->mnWidth = aOS2Metric.lAveCharWidth;
+ pMetric->mnOrientation = 0;
+ }
+
+ if ( aOS2Metric.fsDefn & FM_DEFN_GENERIC )
+ pMetric->mbDevice = FALSE;
+ else
+ pMetric->mbDevice = TRUE;
+
+ pMetric->mnAscent = aOS2Metric.lMaxAscender;
+ pMetric->mnDescent = aOS2Metric.lMaxDescender;
+ pMetric->mnLeading = aOS2Metric.lInternalLeading;
+ pMetric->mnSlant = 0;
+ pMetric->mnFirstChar = aOS2Metric.sFirstChar;
+ pMetric->mnLastChar = aOS2Metric.sLastChar;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs )
+{
+ if ( !nPairs || !pKernPairs )
+ {
+ FONTMETRICS aOS2Metric;
+ GpiQueryFontMetrics( maGraphicsData.mhPS, sizeof( aOS2Metric ), &aOS2Metric );
+ return aOS2Metric.sKerningPairs;
+ }
+
+ DBG_ASSERT( sizeof( KERNINGPAIRS ) == sizeof( ImplKernPairData ),
+ "SalGraphics::GetKernPairs(): KERNINGPAIRS != ImplKernPairData" );
+ // Einige Treiber liefern weniger Kerning-Paare, als wir mit
+ // GpiQueryFontMetrics() ermittelt haben. Deshalb hier den Rueckgabewert
+ // anpassen, damit der unabhaengige Teil entsprechend darauf reagieren
+ // kann
+ nPairs = GpiQueryKerningPairs( maGraphicsData.mhPS, nPairs, (KERNINGPAIRS*)pKernPairs );
+ return nPairs;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetDevFontList( ImplDevFontList* pList )
+{
+ PFONTMETRICS pFontMetrics;
+ ULONG nFontMetricCount;
+ SalData* pSalData;
+
+ if ( !maGraphicsData.mbPrinter )
+ {
+ // Bei Bildschirm-Devices cachen wir die Liste global, da
+ // dies im unabhaengigen Teil auch so gemacht wird und wir
+ // ansonsten auf geloeschten Systemdaten arbeiten koennten
+ pSalData = GetSalData();
+ nFontMetricCount = pSalData->mnFontMetricCount;
+ pFontMetrics = pSalData->mpFontMetrics;
+ // Bei Bildschirm-Devices holen wir uns die Fontliste jedesmal neu
+ if ( pFontMetrics )
+ {
+ delete pFontMetrics;
+ pFontMetrics = NULL;
+ nFontMetricCount = 0;
+ }
+ }
+ else
+ {
+ nFontMetricCount = maGraphicsData.mnFontMetricCount;
+ pFontMetrics = maGraphicsData.mpFontMetrics;
+ }
+
+ // do we have to create the cached font list first?
+ if ( !pFontMetrics )
+ {
+ // query the number of fonts available
+ LONG nTemp = 0;
+ nFontMetricCount = GpiQueryFonts( maGraphicsData.mhPS,
+ QF_PUBLIC | QF_PRIVATE,
+ NULL, &nTemp,
+ sizeof( FONTMETRICS ), NULL );
+
+ // procede only if at least one is available!
+ if ( nFontMetricCount )
+ {
+ // allocate memory for font list
+ pFontMetrics = new FONTMETRICS[nFontMetricCount];
+
+ // query font list
+ GpiQueryFonts( maGraphicsData.mhPS,
+ QF_PUBLIC | QF_PRIVATE,
+ NULL,
+ (PLONG)&nFontMetricCount,
+ (LONG) sizeof( FONTMETRICS ),
+ pFontMetrics );
+ }
+
+ if ( !maGraphicsData.mbPrinter )
+ {
+ pSalData->mnFontMetricCount = nFontMetricCount;
+ pSalData->mpFontMetrics = pFontMetrics;
+ }
+ else
+ {
+ maGraphicsData.mnFontMetricCount = nFontMetricCount;
+ maGraphicsData.mpFontMetrics = pFontMetrics;
+ }
+ }
+
+ // copy data from the font list
+ for( ULONG i = 0; i < nFontMetricCount; i++ )
+ {
+ PFONTMETRICS pFontMetric = &pFontMetrics[i];
+
+ // Bildschirm-Bitmap-Font's werden nicht fuer den Drucker angeboten
+ if ( maGraphicsData.mbPrinter )
+ {
+ if ( (pFontMetric->fsDefn & (FM_DEFN_OUTLINE | FM_DEFN_GENERIC)) == FM_DEFN_GENERIC )
+ // Font nicht aufnehmen
+ continue;
+ }
+
+ // create new font list element
+ ImplFontData* pData = new ImplFontData;
+ pData->maName = pFontMetric->szFamilyname;
+ pData->maStyleName = ImpStyleNameToSal( pFontMetric->szFamilyname,
+ pFontMetric->szFacename,
+ strlen( pFontMetric->szFamilyname) );
+ pData->mpSysData = (void*)pFontMetric;
+ pData->meCharSet = ImplCharSetToSal( pFontMetric->usCodePage );
+ pData->meWeight = ImplWeightToSal( pFontMetric->usWeightClass );
+ pData->meWidthType = WIDTH_DONTKNOW;
+ if ( pFontMetric->panose.bFamilyType == 3 )
+ pData->meFamily = FAMILY_SCRIPT;
+ else
+ pData->meFamily = FAMILY_DONTKNOW;
+ if ( pFontMetric->fsType & FM_TYPE_FIXED )
+ pData->mePitch = PITCH_FIXED;
+ else
+ pData->mePitch = PITCH_VARIABLE;
+ if ( pFontMetric->fsSelection & FM_SEL_ITALIC )
+ pData->meItalic = ITALIC_NORMAL;
+ else
+ pData->meItalic = ITALIC_NONE;
+ if ( pFontMetric->fsDefn & FM_DEFN_OUTLINE )
+ pData->meType = TYPE_SCALABLE;
+ else
+ pData->meType = TYPE_RASTER;
+ if ( pFontMetric->fsDefn & FM_DEFN_GENERIC )
+ pData->mbDevice = FALSE;
+ else
+ pData->mbDevice = TRUE;
+ if ( pData->meType != TYPE_RASTER )
+ {
+ pData->mnWidth = 0;
+ pData->mnHeight = 0;
+ pData->mbOrientation = TRUE;
+ }
+ else
+ {
+ pData->mnWidth = pFontMetric->lAveCharWidth;
+ pData->mnHeight = pFontMetric->lMaxBaselineExt;
+ pData->mbOrientation = FALSE;
+ }
+ pData->mnQuality = 0;
+
+ // add font list element to font list
+ pList->Add( pData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawText( long nX, long nY, const xub_Unicode* pStr, USHORT nLen )
+{
+ DBG_ERROR( "SalGraphics::DrawText called!" );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawTextArray( long nX, long nY,
+ const xub_Unicode* pStr, USHORT nLen,
+ const long* pDXAry )
+{
+ POINTL aPt;
+ LONG aStackAry[ SAL_DRAWTEXT_STACKBUF ];
+ LONG* pOS2DXAry;
+
+ if ( nLen <= SAL_DRAWTEXT_STACKBUF )
+ pOS2DXAry = aStackAry;
+ else
+ pOS2DXAry = new LONG[nLen];
+
+ aPt.x = nX;
+ aPt.y = maGraphicsData.mnHeight - nY;
+
+ pOS2DXAry[0] = (LONG)pDXAry[0];
+ for ( USHORT i = 1; i < nLen-1; i++ )
+ pOS2DXAry[i] = (LONG)pDXAry[i]-pDXAry[i-1];
+ pOS2DXAry[nLen-1] = 0;
+
+ // OS2 kann max. 512-Zeichen lange Strings ausgeben, deshalb kuerzen
+ // wir den String auf eine Laenge von 512-Zeichen
+ if ( nLen > 512 )
+ {
+ // Wir versuchen links die Zeichen zu ueberspringen, die evtl. im
+ // nicht sichtbaren Bereich liegen
+ LONG nWidth = 0;
+ LONG nCharWidth;
+ while ( nLen > 512 )
+ {
+ nCharWidth = *pOS2DXAry;
+ if ( (aPt.x+nWidth+nCharWidth) >= -999 )
+ break;
+ nWidth += nCharWidth;
+ pStr++;
+ pOS2DXAry++;
+ nLen--;
+ }
+
+ if ( nLen > 512 )
+ nLen = 512;
+
+ aPt.x = aPt.x + nWidth;
+ }
+
+ GpiCharStringPosAt( maGraphicsData.mhPS, &aPt, NULL, CHS_VECTOR, nLen, (PCH)pStr, pOS2DXAry );
+
+ if ( pOS2DXAry != aStackAry )
+ delete pOS2DXAry;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalGraphics::GetGlyphBoundRect( xub_Unicode cChar, long* pX, long* pY,
+ long* pWidth, long* pHeight )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+///---------------------------- PUBLIC ROUTINE -------------------------------
+// Using the following macro in PMDDIM.H you can use a GRE call to get the char outline
+// of system outline fonts. This call does not work for system bitmap fonts or device fonts.
+// Truetype fonts should also work however the data returned for truetype fonts will be mostly
+// scanline data until you install the latest fixpak ("31 or 32" I Think). The fix pak will improve
+// the data returned for truetype fonts to include curves. This call was
+// implemented in merlin and should be in fix pak 26 for Warp as well.
+//
+// #define GreQueryCharOutline(a,b,c,d,e)
+// (LONG)Gre32Entry7((HDC)(a),(ULONG)(b),(ULONG)(PBYTE)(c),(ULONG)(d),(ULONG)(e),0L,0x00004256L)
+// #define NGreQueryCharOutline 0x00004256L
+//
+// LONG APIENTRY QueryCharOutline32 (HDC hdc, ULONG ulCode, PBYTE pBuffer,
+// ULONG ulLen, ULONG fl, ULONG hddc,
+// ULONG ulFunN)
+//
+// This function returns outline data information of the specified
+// character glyph
+//
+// Parameters: hdc Device context handle
+// ulCode Code point
+// pBuffer Pointer to outline data to be returned
+// ulLen Length in bytes of pBuffer
+// fl Options flags
+// QCO_FORMAT_GOCA
+// QCO_FORMAT_IFI
+// QCO_NO_TRANSFORM
+// hddc
+// ulFunN
+// Returns:
+// The number of bytes needed to store character outline
+// GPI_ALTERROR
+//
+
+// -----------------------------------------------------------------------
+
+ULONG SalGraphics::GetGlyphOutline( xub_Unicode cChar, USHORT** ppPolySizes,
+ SalPoint** ppPoints, BYTE** ppFlags )
+{
+ return 0;
+}
diff --git a/vcl/os2/source/gdi/salogl.cxx b/vcl/os2/source/gdi/salogl.cxx
new file mode 100644
index 000000000000..bae6bc3f8222
--- /dev/null
+++ b/vcl/os2/source/gdi/salogl.cxx
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * $RCSfile: salogl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <malloc.h>
+#define INCL_DOSMODULEMGR
+#include <tools/svpm.h>
+#define _SV_SALOGL_CXX
+#ifndef _SV_SALOGL_HXX
+#include <salogl.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+// ------------
+// - Typedefs -
+// ------------
+
+typedef VISUALCONFIG* PCFG;
+
+// ------------
+// - Lib-Name -
+// ------------
+
+#define OGL_LIBNAME "OPENGL"
+
+// ----------
+// - Macros -
+// ----------
+
+#define GET_OGLFNC_PGL( FncName ) \
+ nResult = DosQueryProcAddr( mhOGLLib, 0, "pgl" #FncName, (PFN*)&pFnc##FncName ); \
+if( nResult != 0 ) \
+ bRet = FALSE;
+
+// ------------------------------------------------------------------------
+
+#define GET_OGLFNC_GL( FncName ) \
+ nResult = DosQueryProcAddr( mhOGLLib, 0, "gl" #FncName, (PFN*)&pFnc##FncName ); \
+if( nResult != 0 ) \
+ bRet = FALSE;
+
+// -----------------
+// - Statics init. -
+// -----------------
+
+// Members
+HMODULE SalOpenGL::mhOGLLib = 0;
+HGC SalOpenGL::mhOGLContext = 0;
+HDC SalOpenGL::mhOGLLastDC = 0;
+ULONG SalOpenGL::mnOGLState = OGL_STATE_UNLOADED;
+
+// Internal use
+INIT_OGLFNC( SalOpenGL, ChooseConfig );
+INIT_OGLFNC( SalOpenGL, QueryConfigs );
+INIT_OGLFNC( SalOpenGL, CreateContext );
+INIT_OGLFNC( SalOpenGL, DestroyContext );
+INIT_OGLFNC( SalOpenGL, GetCurrentContext );
+INIT_OGLFNC( SalOpenGL, MakeCurrent );
+INIT_OGLFNC( SalOpenGL, QueryCapability );
+
+// -------------
+// - SalOpenGL -
+// -------------
+
+SalOpenGL::SalOpenGL( SalGraphics* pGraphics )
+{
+ // Set mhOGLLastDC only the first time a
+ // SalOpenGL object is created; we need
+ // this DC in SalOpenGL::Create();
+ if( OGL_STATE_UNLOADED == mnOGLState )
+ mhOGLLastDC = pGraphics->maGraphicsData.mhDC;
+}
+
+// ------------------------------------------------------------------------
+
+SalOpenGL::~SalOpenGL()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::Create()
+{
+ BOOL bRet = FALSE;
+
+ if( OGL_STATE_UNLOADED == mnOGLState )
+ {
+ if( ImplInitLib() )
+ {
+/*
+ if( ImplInit() )
+ {
+ HAB hAB = GetSalData()->mhAB;
+ VISUALCONFIG aCfg = { PGL_RGBA, PGL_RED_SIZE, 4, PGL_GREEN_SIZE, 4,PGL_BLUE_SIZE, 4, PGL_DOUBLEBUFFER, 0 };
+ PCFG* ppCfgs = pFncQueryConfigs( hAB );
+
+ if( *ppCfgs )
+ {
+ if( ( mhOGLContext = pFncCreateContext( hAB, *ppCfgs, NULL, FALSE ) ) != 0 )
+ {
+ pFncMakeCurrent( hAB, mhOGLContext, WinWindowFromDC( mhOGLLastDC ) );
+ mnOGLState = OGL_STATE_VALID;
+ bRet = TRUE;
+ }
+ }
+ }
+*/
+
+ if( !bRet )
+ {
+ ImplFreeLib();
+ mnOGLState = OGL_STATE_INVALID;
+ }
+ }
+ else
+ mnOGLState = OGL_STATE_INVALID;
+ }
+ else if( OGL_STATE_VALID == mnOGLState )
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::Release()
+{
+ ImplFreeLib();
+}
+
+// ------------------------------------------------------------------------
+
+void* SalOpenGL::GetOGLFnc( const String& rFncName )
+{
+ void* pRet;
+
+ if( mhOGLLib )
+ {
+ APIRET rc;
+ PFN pFunction;
+
+ rc = DosQueryProcAddr( mhOGLLib, 0, rFncName, &pFunction );
+ pRet = rc == NULL ? pFunction : NULL;
+ }
+ else
+ pRet = NULL;
+
+ return pRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::OGLEntry( SalGraphics* pGraphics )
+{
+ if( pGraphics->maGraphicsData.mhDC != mhOGLLastDC )
+ {
+ mhOGLLastDC = pGraphics->maGraphicsData.mhDC;
+ pFncMakeCurrent( GetSalData()->mhAB, mhOGLContext, WinWindowFromDC( mhOGLLastDC ) );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::OGLExit( SalGraphics* pGraphics )
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::ImplInitLib()
+{
+ DosLoadModule ((PSZ)0, 0, OGL_LIBNAME, &mhOGLLib );
+ return( mhOGLLib != NULL );
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::ImplFreeLib()
+{
+ if( mhOGLLib )
+ DosFreeModule( mhOGLLib );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::ImplInit()
+{
+ ULONG nResult;
+ BOOL bRet = TRUE;
+
+ // Internal use
+ GET_OGLFNC_PGL( ChooseConfig );
+ GET_OGLFNC_PGL( QueryConfigs );
+ GET_OGLFNC_PGL( CreateContext );
+ GET_OGLFNC_PGL( DestroyContext );
+ GET_OGLFNC_PGL( GetCurrentContext );
+ GET_OGLFNC_PGL( MakeCurrent );
+ GET_OGLFNC_PGL( QueryCapability );
+
+ return bRet;
+}
diff --git a/vcl/os2/source/gdi/salprn.cxx b/vcl/os2/source/gdi/salprn.cxx
new file mode 100644
index 000000000000..95e6baa2d6fb
--- /dev/null
+++ b/vcl/os2/source/gdi/salprn.cxx
@@ -0,0 +1,1878 @@
+/*************************************************************************
+ *
+ * $RCSfile: salprn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// use this define to disable the DJP support
+// #define NO_DJP
+
+#define INCL_DOSMODULEMGR
+#define INCL_DEV
+#define INCL_SPL
+#define INCL_SPLDOSPRINT
+#define INCL_DEVDJP
+
+#define BOOL PM_BOOL
+#define BYTE PM_BYTE
+#define USHORT PM_USHORT
+#define ULONG PM_ULONG
+
+#define INCL_PM
+#include <os2.h>
+#include "pmdjp.h"
+
+#undef BOOL
+#undef BYTE
+#undef USHORT
+#undef ULONG
+
+#include <string.h>
+
+#define _SV_SALPRN_CXX
+
+#ifndef _NEW_HXX
+#include <tools/new.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALPTYPE_HXX
+#include <salptype.hxx>
+#endif
+#ifndef _SV_SALPRN_HXX
+#include <salprn.hxx>
+#endif
+
+#ifndef _SV_PRINT_H
+#include <print.h>
+#endif
+#ifndef _SV_JOBSET_H
+#include <jobset.h>
+#endif
+
+// =======================================================================
+
+// -----------------------
+// - struct ImplFormInfo -
+// -----------------------
+
+struct ImplFormInfo
+{
+ long mnPaperWidth;
+ long mnPaperHeight;
+ DJPT_PAPERSIZE mnId;
+};
+
+// =======================================================================
+
+// -----------------------
+// - struct ImplTrayInfo -
+// -----------------------
+
+struct ImplTrayInfo
+{
+ XubString maName;
+ XubString maDisplayName;
+ DJPT_TRAYTYPE mnId;
+
+ ImplTrayInfo( const char* pTrayName,
+ const char* pTrayDisplayName ) :
+ maName( pTrayName ),
+ maDisplayName( pTrayDisplayName )
+ {}
+};
+
+// =======================================================================
+
+struct ImplQueueSalSysData
+{
+ String maPrinterName; // pszPrinters
+ String maName; // pszName bzw. LogAddress
+ String maOrgDriverName; // pszDriverName (maDriverName.maDeviceName)
+ String maDriverName; // pszDriverName bis .
+ String maDeviceName; // pszDriverName nach .
+ PDRIVDATA mpDrivData;
+
+ ImplQueueSalSysData( const String& rPrinterName,
+ const String& rName,
+ const String& rDriverName,
+ const String& rDeviceName,
+ const String& rOrgDriverName,
+ PDRIVDATA pDrivData );
+ ~ImplQueueSalSysData();
+};
+
+// -----------------------------------------------------------------------
+
+ImplQueueSalSysData::ImplQueueSalSysData( const String& rPrinterName,
+ const String& rName,
+ const String& rOrgDriverName,
+ const String& rDriverName,
+ const String& rDeviceName,
+ PDRIVDATA pDrivData ) :
+ maPrinterName( rPrinterName ),
+ maName( rName ),
+ maOrgDriverName( rName ),
+ maDriverName( rDriverName ),
+ maDeviceName( rDeviceName )
+{
+ if ( pDrivData )
+ {
+ mpDrivData = (PDRIVDATA)new BYTE[pDrivData->cb];
+ memcpy( mpDrivData, pDrivData, pDrivData->cb );
+ }
+ else
+ mpDrivData = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplQueueSalSysData::~ImplQueueSalSysData()
+{
+ delete mpDrivData;
+}
+
+// =======================================================================
+
+static ULONG ImplPMQueueStatusToSal( PM_USHORT nPMStatus )
+{
+ ULONG nStatus = 0;
+ if ( nPMStatus & PRQ3_PAUSED )
+ nStatus |= QUEUE_STATUS_PAUSED;
+ if ( nPMStatus & PRQ3_PENDING )
+ nStatus |= QUEUE_STATUS_PENDING_DELETION;
+ if ( !nStatus )
+ nStatus |= QUEUE_STATUS_READY;
+ return nStatus;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
+{
+ APIRET rc;
+ ULONG nNeeded;
+ ULONG nReturned;
+ ULONG nTotal;
+
+ // query needed size of the buffer for the QueueInfo
+ rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL );
+ if( nNeeded == 0 )
+ return;
+
+ // create the buffer for the QueueInfo
+ PCHAR pQueueData = new CHAR[nNeeded];
+
+ // query QueueInfos
+ rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL );
+
+ PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData;
+ for ( int i = 0; i < nReturned; i++ )
+ {
+ // create entry for the QueueInfo array
+ SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
+
+ String aOrgDriverName( pPrqInfo->pszDriverName );
+ String aName( pPrqInfo->pszName );
+ pInfo->maDriver = aOrgDriverName;
+ pInfo->maPrinterName = pPrqInfo->pszComment;
+ pInfo->maLocation = aName;
+ pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus );
+ pInfo->mnJobs = pPrqInfo->cJobs;
+ // pInfo->maComment = !!!
+
+ // Feststellen, ob Name doppelt
+ PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData;
+ for ( int j = 0; j < nReturned; j++ )
+ {
+ // Wenn Name doppelt, erweitern wir diesen um die Location
+ if ( (j != i) &&
+ (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) )
+ {
+ pInfo->maPrinterName += ';';
+ pInfo->maPrinterName += pInfo->maLocation;
+ }
+ pTempPrqInfo++;
+ }
+
+ // pszDriver in DriverName (bis .) und DeviceName (nach .) aufsplitten
+ PSZ pDriverName;
+ PSZ pDeviceName;
+ if ( (pDriverName = strchr( pPrqInfo->pszDriverName, '.' )) != 0 )
+ {
+ *pDriverName = 0;
+ pDeviceName = pDriverName + 1;
+ }
+ else
+ pDeviceName = NULL;
+
+ // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit
+ // ein memcmp vom JobSetup auch funktioniert
+ if ( pPrqInfo->pDriverData &&
+ (pPrqInfo->pDriverData->cb >= sizeof( pPrqInfo->pDriverData )) )
+ {
+ int nDeviceNameLen = strlen( pPrqInfo->pDriverData->szDeviceName );
+ memset( pPrqInfo->pDriverData->szDeviceName+nDeviceNameLen,
+ 0,
+ sizeof( pPrqInfo->pDriverData->szDeviceName )-nDeviceNameLen );
+ }
+
+ // save driver data and driver names
+ String aPrinterName( pPrqInfo->pszPrinters );
+ String aDriverName( pPrqInfo->pszDriverName );
+ String aDeviceName;
+ if ( pDeviceName )
+ aDeviceName = pDeviceName;
+ pInfo->mpSysData = new ImplQueueSalSysData( aPrinterName, aName,
+ aOrgDriverName,
+ aDriverName, aDeviceName,
+ pPrqInfo->pDriverData );
+
+ // add queue to the list
+ pList->Add( pInfo );
+
+ // increment to next element of the QueueInfo array
+ pPrqInfo++;
+ }
+
+ delete [] pQueueData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo )
+{
+ APIRET rc;
+ ULONG nNeeded;
+ ULONG nReturned;
+ ULONG nTotal;
+
+ // query needed size of the buffer for the QueueInfo
+ rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL );
+ if( nNeeded == 0 )
+ return;
+
+ // create the buffer for the QueueInfo
+ PCHAR pQueueData = new CHAR[nNeeded];
+
+ // query QueueInfos
+ rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL );
+
+ PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData;
+ for ( int i = 0; i < nReturned; i++ )
+ {
+ ImplQueueSalSysData* pSysData = (ImplQueueSalSysData*)(pInfo->mpSysData);
+ if ( (strcmp( pSysData->maPrinterName, pPrqInfo->pszPrinters ) == 0) &&
+ (strcmp( pSysData->maName, pPrqInfo->pszName ) == 0) &&
+ (strcmp( pSysData->maOrgDriverName, pPrqInfo->pszDriverName ) == 0) )
+ {
+ pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus );
+ pInfo->mnJobs = pPrqInfo->cJobs;
+ break;
+ }
+
+ // increment to next element of the QueueInfo array
+ pPrqInfo++;
+ }
+
+ delete [] pQueueData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
+{
+ delete ((ImplQueueSalSysData*)(pInfo->mpSysData));
+ delete pInfo;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInstance::GetDefaultPrinter()
+{
+ APIRET rc;
+ ULONG nNeeded;
+ ULONG nReturned;
+ ULONG nTotal;
+ char szQueueName[255];
+ XubString aDefaultName;
+
+ // query default queue
+ if ( !PrfQueryProfileString( HINI_PROFILE, SPL_INI_SPOOLER, "QUEUE", 0, szQueueName, sizeof( szQueueName ) ) )
+ return aDefaultName;
+
+ // extract first queue name
+ PSZ pStr;
+ if ( (pStr = strchr( szQueueName, ';' )) != 0 )
+ *pStr = 0;
+
+ // query needed size of the buffer for the QueueInfo
+ rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL );
+ if ( nNeeded == 0 )
+ return aDefaultName;
+
+ // create the buffer for the QueueInfo
+ PCHAR pQueueData = new CHAR[ nNeeded ];
+
+ // query QueueInfos
+ rc = SplEnumQueue ((PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL );
+
+ // find printer name for default queue
+ PPRQINFO3 pPrqInfo = (PPRQINFO3) pQueueData;
+ for ( int i = 0; i < nReturned; i++ )
+ {
+ if ( strcmp( pPrqInfo->pszName, szQueueName ) == 0 )
+ {
+ aDefaultName = pPrqInfo->pszComment;
+
+ // Feststellen, ob Name doppelt
+ PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData;
+ for ( int j = 0; j < nReturned; j++ )
+ {
+ // Wenn Name doppelt, erweitern wir diesen um die Location
+ if ( (j != i) &&
+ (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) )
+ {
+ aDefaultName += ';';
+ aDefaultName += pPrqInfo->pszName;
+ }
+ pTempPrqInfo++;
+ }
+ break;
+ }
+
+ // increment to next element of the QueueInfo array
+ pPrqInfo++;
+ }
+
+ delete [] pQueueData;
+
+ return aDefaultName;
+}
+
+// =======================================================================
+
+static void* ImplAllocPrnMemory( size_t n )
+{
+ PVOID pVoid = 0;
+
+ if ( DosAllocMem( &pVoid, n, PAG_COMMIT | PAG_READ | PAG_WRITE ) )
+ return 0;
+
+ return pVoid;
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplFreePrnMemory( void* p )
+{
+ DosFreeMem( p );
+}
+
+// -----------------------------------------------------------------------
+
+static PDRIVDATA ImplPrnDrivData( const ImplJobSetup* pSetupData )
+{
+ // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf
+ // unseren Daten arbeiten, da es durch Konfigurationsprobleme
+ // sein kann, das der Druckertreiber bei uns Daten ueberschreibt.
+ // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw.
+ // sind dadurch leichter zu finden
+
+ if ( !pSetupData->mpDriverData )
+ return NULL;
+
+ DBG_ASSERT( ((PRIVDATA)(pSetupData->mpDriverData))->cb == pSetupData->mnDriverDataLen,
+ "ImplPrnDrivData() - SetupDataLen != DriverDataLen" );
+
+ PDRIVDATA pDrivData = (PDRIVDATA)ImplAllocPrnMemory( pSetupData->mnDriverDataLen );
+ memcpy( pDrivData, pSetupData->mpDriverData, pSetupData->mnDriverDataLen );
+ return pDrivData;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplUpdateSetupData( const PDRIVDATA pDrivData, ImplJobSetup* pSetupData )
+{
+ // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf
+ // unseren Daten arbeiten, da es durch Konfigurationsprobleme
+ // sein kann, das der Druckertreiber bei uns Daten ueberschreibt.
+ // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw.
+ // sind dadurch leichter zu finden
+
+ if ( !pDrivData || !pDrivData->cb )
+ {
+ if ( pSetupData->mpDriverData )
+ delete pSetupData->mpDriverData;
+ pSetupData->mnDriverDataLen = 0;
+ }
+ else
+ {
+ // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit
+ // ein memcmp vom JobSetup auch funktioniert
+ if ( pDrivData->cb >= sizeof( pDrivData ) )
+ {
+ int nDeviceNameLen = strlen( pDrivData->szDeviceName );
+ memset( pDrivData->szDeviceName+nDeviceNameLen,
+ 0,
+ sizeof( pDrivData->szDeviceName )-nDeviceNameLen );
+ }
+
+ if ( pSetupData->mpDriverData )
+ {
+ if ( pSetupData->mnDriverDataLen != pDrivData->cb )
+ delete pSetupData->mpDriverData;
+ pSetupData->mpDriverData = new BYTE[pDrivData->cb];
+ }
+ else
+ pSetupData->mpDriverData = new BYTE[pDrivData->cb];
+ pSetupData->mnDriverDataLen = pDrivData->cb;
+ memcpy( pSetupData->mpDriverData, pDrivData, pDrivData->cb );
+ }
+
+ if ( pDrivData )
+ ImplFreePrnMemory( pDrivData );
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplPaperSizeEqual( long nPaperWidth1, long nPaperHeight1,
+ long nPaperWidth2, long nPaperHeight2 )
+{
+ return (((nPaperWidth1 >= nPaperWidth2-1) && (nPaperWidth1 <= nPaperWidth2+1)) &&
+ ((nPaperHeight1 >= nPaperHeight2-1) && (nPaperHeight1 <= nPaperHeight2+1)));
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplIsDriverDJPEnabled( HDC hDC )
+{
+#ifdef NO_DJP
+ return FALSE;
+#else
+ // Ueber OS2-Ini kann DJP disablte werden
+ if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_USEDJP, 1 ) )
+ return FALSE;
+
+ // Testen, ob DJP-Interface am Drucker vorhanden
+ LONG lQuery;
+ APIRET rc;
+
+ lQuery = DEVESC_QUERYSIZE;
+ rc = DevEscape( hDC,
+ DEVESC_QUERYESCSUPPORT,
+ sizeof( lQuery ),
+ (PBYTE)&lQuery,
+ 0,
+ (PBYTE)NULL );
+ if ( DEV_OK != rc )
+ return FALSE;
+
+ lQuery = DEVESC_QUERYJOBPROPERTIES;
+ rc = DevEscape( hDC,
+ DEVESC_QUERYESCSUPPORT,
+ sizeof( lQuery ),
+ (PBYTE)&lQuery,
+ 0,
+ (PBYTE)NULL );
+ if ( DEV_OK != rc )
+ return FALSE;
+
+ lQuery = DEVESC_SETJOBPROPERTIES;
+ rc = DevEscape( hDC,
+ DEVESC_QUERYESCSUPPORT,
+ sizeof( lQuery ),
+ (PBYTE)&lQuery,
+ 0,
+ (PBYTE)NULL );
+ if ( DEV_OK != rc )
+ return FALSE;
+
+ return TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplFormatInputList( PDJP_ITEM pDJP, PQUERYTUPLE pTuple )
+{
+ // Loop through the query elements
+ BOOL fContinue = TRUE;
+ do
+ {
+ pDJP->cb = sizeof (DJP_ITEM);
+ pDJP->ulProperty = pTuple->ulProperty;
+ pDJP->lType = pTuple->lType;
+ pDJP->ulNumReturned = 0;
+ pDJP->ulValue = DJP_NONE;
+
+ // at EOL?
+ fContinue = DJP_NONE != pTuple->ulProperty;
+
+ // Move to next item structure and tuplet
+ pDJP++;
+ pTuple++;
+ }
+ while ( fContinue );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplFreeFormAndTrayList( SalInfoPrinter* pSalInfoPrinter )
+{
+ if ( pSalInfoPrinter->maPrinterData.mnFormCount )
+ {
+ for ( USHORT i = 0; i < pSalInfoPrinter->maPrinterData.mnFormCount; i++ )
+ delete pSalInfoPrinter->maPrinterData.mpFormArray[i];
+ delete [] pSalInfoPrinter->maPrinterData.mpFormArray;
+ pSalInfoPrinter->maPrinterData.mnFormCount = 0;
+ }
+
+ if ( pSalInfoPrinter->maPrinterData.mnTrayCount )
+ {
+ for ( USHORT i = 0; i < pSalInfoPrinter->maPrinterData.mnTrayCount; i++ )
+ delete pSalInfoPrinter->maPrinterData.mpTrayArray[i];
+ delete [] pSalInfoPrinter->maPrinterData.mpTrayArray;
+ pSalInfoPrinter->maPrinterData.mnTrayCount = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplGetFormAndTrayList( SalInfoPrinter* pSalInfoPrinter, const ImplJobSetup* pSetupData )
+{
+ ImplFreeFormAndTrayList( pSalInfoPrinter );
+
+ LONG alQuery[] =
+ {
+ 0, 0, // First two members of QUERYSIZE
+ DJP_CJ_FORM, DJP_ALL,
+ DJP_CJ_TRAYNAME, DJP_ALL,
+ DJP_NONE, DJP_NONE // EOL marker
+ };
+
+ APIRET rc;
+ PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery;
+ PBYTE pBuffer = NULL;
+ LONG nAlloc = 0;
+ PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData );
+ LONG nDrivDataSize = pCopyDrivData->cb;
+ PBYTE pDrivData = (PBYTE)pCopyDrivData;
+
+ // find out how many bytes to allocate
+ pQuerySize->cb = sizeof( alQuery );
+ rc = DevEscape( pSalInfoPrinter->maPrinterData.mhDC,
+ DEVESC_QUERYSIZE,
+ sizeof( alQuery ),
+ (PBYTE)pQuerySize,
+ &nDrivDataSize,
+ pDrivData );
+ if ( DEV_OK != rc )
+ {
+ ImplFreePrnMemory( pCopyDrivData );
+ return;
+ }
+
+ // allocate the memory
+ nAlloc = pQuerySize->ulSizeNeeded;
+ pBuffer = (PBYTE)new BYTE[nAlloc];
+
+ // set up the input
+ PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
+ ImplFormatInputList( pDJP, pQuerySize->aTuples );
+
+ // do it!
+ rc = DevEscape( pSalInfoPrinter->maPrinterData.mhDC,
+ DEVESC_QUERYJOBPROPERTIES,
+ nAlloc,
+ pBuffer,
+ &nDrivDataSize,
+ pDrivData );
+ ImplFreePrnMemory( pCopyDrivData );
+
+ if ( (DEV_OK == rc) || (DEV_WARNING == rc) )
+ {
+ // Loop through the query elements
+ PQUERYTUPLE pTuple = pQuerySize->aTuples;
+ while ( DJP_NONE != pTuple->ulProperty )
+ {
+ if ( pDJP->ulProperty == DJP_CJ_FORM )
+ {
+ if ( pDJP->ulNumReturned )
+ {
+ PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM );
+
+ pSalInfoPrinter->maPrinterData.mnFormCount = pDJP->ulNumReturned;
+ pSalInfoPrinter->maPrinterData.mpFormArray = new PIMPLFORMINFO[pSalInfoPrinter->maPrinterData.mnFormCount];
+ for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ )
+ {
+ ImplFormInfo* pInfo = new ImplFormInfo;
+ pInfo->mnPaperWidth = pElm->hcInfo.cx;
+ pInfo->mnPaperHeight = pElm->hcInfo.cy;
+ pInfo->mnId = pElm->djppsFormID;
+ pSalInfoPrinter->maPrinterData.mpFormArray[i] = pInfo;
+ }
+ }
+ }
+ else if ( pDJP->ulProperty == DJP_CJ_TRAYNAME )
+ {
+ if ( pDJP->ulNumReturned )
+ {
+ PDJPT_TRAYNAME pElm = DJP_ELEMENTP( *pDJP, DJPT_TRAYNAME );
+
+ pSalInfoPrinter->maPrinterData.mnTrayCount = pDJP->ulNumReturned;
+ pSalInfoPrinter->maPrinterData.mpTrayArray = new PIMPLTRAYINFO[pSalInfoPrinter->maPrinterData.mnTrayCount];
+ for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ )
+ {
+ ImplTrayInfo* pInfo = new ImplTrayInfo( pElm->szTrayname, pElm->szDisplayTrayname );
+ pInfo->mnId = pElm->djpttTrayID;
+ pSalInfoPrinter->maPrinterData.mpTrayArray[i] = pInfo;
+ }
+ }
+ }
+
+ pDJP = DJP_NEXT_STRUCTP( pDJP );
+ pTuple++;
+ }
+ }
+
+ delete [] pBuffer;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplGetCurrentSettings( SalInfoPrinter* pSalInfoPrinter, ImplJobSetup* pSetupData )
+{
+ // Um den aktuellen Tray zu ermitteln, brauchen wir auch die Listen dazu
+ if ( !pSalInfoPrinter->maPrinterData.mnFormCount )
+ ImplGetFormAndTrayList( pSalInfoPrinter, pSetupData );
+
+ LONG alQuery[] =
+ {
+ 0, 0, // First two members of QUERYSIZE
+ DJP_SJ_ORIENTATION, DJP_CURRENT,
+ DJP_CJ_FORM, DJP_CURRENT,
+ DJP_NONE, DJP_NONE // EOL marker
+ };
+
+ APIRET rc;
+ PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery;
+ PBYTE pBuffer = NULL;
+ LONG nAlloc = 0;
+ PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData );
+ LONG nDrivDataSize = pCopyDrivData->cb;
+ PBYTE pDrivData = (PBYTE)pCopyDrivData;
+ BOOL bResult;
+
+ // find out how many bytes to allocate
+ pQuerySize->cb = sizeof( alQuery );
+ rc = DevEscape( pSalInfoPrinter->maPrinterData.mhDC,
+ DEVESC_QUERYSIZE,
+ sizeof( alQuery ),
+ (PBYTE)pQuerySize,
+ &nDrivDataSize,
+ pDrivData );
+ if ( DEV_OK != rc )
+ {
+ ImplFreePrnMemory( pCopyDrivData );
+ return FALSE;
+ }
+
+ // allocate the memory
+ nAlloc = pQuerySize->ulSizeNeeded;
+ pBuffer = (PBYTE)new BYTE[nAlloc];
+
+ // set up the input
+ PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
+ ImplFormatInputList( pDJP, pQuerySize->aTuples );
+
+ rc = DevEscape( pSalInfoPrinter->maPrinterData.mhDC,
+ DEVESC_QUERYJOBPROPERTIES,
+ nAlloc,
+ pBuffer,
+ &nDrivDataSize,
+ pDrivData );
+ if ( (DEV_OK == rc) || (DEV_WARNING == rc) )
+ {
+ // aktuelle Setup-Daten uebernehmen
+ ImplUpdateSetupData( pCopyDrivData, pSetupData );
+
+ // Loop through the query elements
+ PQUERYTUPLE pTuple = pQuerySize->aTuples;
+ while ( DJP_NONE != pTuple->ulProperty )
+ {
+ if ( pDJP->ulProperty == DJP_SJ_ORIENTATION )
+ {
+ if ( pDJP->ulNumReturned )
+ {
+ PDJPT_ORIENTATION pElm = DJP_ELEMENTP( *pDJP, DJPT_ORIENTATION );
+ if ( (DJP_ORI_PORTRAIT == *pElm) || (DJP_ORI_REV_PORTRAIT == *pElm) )
+ pSetupData->meOrientation = ORIENTATION_PORTRAIT;
+ else
+ pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
+ }
+ }
+ else if ( pDJP->ulProperty == DJP_CJ_FORM )
+ {
+ if ( pDJP->ulNumReturned )
+ {
+ PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM );
+
+ pSetupData->mnPaperWidth = pElm->hcInfo.cx*100;
+ pSetupData->mnPaperHeight = pElm->hcInfo.cy*100;
+ switch( pElm->djppsFormID )
+ {
+ case DJP_PSI_A3:
+ pSetupData->mePaperFormat = PAPER_A3;
+ break;
+
+ case DJP_PSI_A4:
+ pSetupData->mePaperFormat = PAPER_A4;
+ break;
+
+ case DJP_PSI_A5:
+ pSetupData->mePaperFormat = PAPER_A5;
+ break;
+
+ case DJP_PSI_B4:
+ pSetupData->mePaperFormat = PAPER_B4;
+ break;
+
+ case DJP_PSI_B5:
+ pSetupData->mePaperFormat = PAPER_B5;
+ break;
+
+ case DJP_PSI_LETTER:
+ pSetupData->mePaperFormat = PAPER_LETTER;
+ break;
+
+ case DJP_PSI_LEGAL:
+ pSetupData->mePaperFormat = PAPER_LEGAL;
+ break;
+
+ case DJP_PSI_TABLOID:
+ pSetupData->mePaperFormat = PAPER_TABLOID;
+ break;
+
+ default:
+ pSetupData->mePaperFormat = PAPER_USER;
+ break;
+ }
+
+ // Wir suchen zuerst ueber den Namen/Id und dann ueber die Id
+ BOOL bTrayFound = FALSE;
+ USHORT j;
+ for ( j = 0; j < pSalInfoPrinter->maPrinterData.mnTrayCount; j++ )
+ {
+ if ( (pSalInfoPrinter->maPrinterData.mpTrayArray[j]->mnId == pElm->djpttTrayID) &&
+ (pSalInfoPrinter->maPrinterData.mpTrayArray[j]->maName == pElm->szTrayname) )
+ {
+ pSetupData->mnPaperBin = j;
+ bTrayFound = TRUE;
+ break;
+ }
+ }
+ if ( !bTrayFound )
+ {
+ for ( j = 0; j < pSalInfoPrinter->maPrinterData.mnTrayCount; j++ )
+ {
+ if ( pSalInfoPrinter->maPrinterData.mpTrayArray[j]->mnId == pElm->djpttTrayID )
+ {
+ pSetupData->mnPaperBin = j;
+ bTrayFound = TRUE;
+ break;
+ }
+ }
+ }
+ // Wenn wir Ihn immer noch nicht gefunden haben, setzen
+ // wir ihn auf DontKnow
+ if ( !bTrayFound )
+ pSetupData->mnPaperBin = 0xFFFF;
+ }
+ }
+
+ pDJP = DJP_NEXT_STRUCTP( pDJP );
+ pTuple++;
+ }
+
+ bResult = TRUE;
+ }
+ else
+ {
+ ImplFreePrnMemory( pCopyDrivData );
+ bResult = FALSE;
+ }
+
+ delete [] pBuffer;
+
+ return bResult;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData,
+ Orientation eOrientation )
+{
+ LONG alQuery[] =
+ {
+ 0, 0, // First two members of QUERYSIZE
+ DJP_SJ_ORIENTATION, DJP_CURRENT,
+ DJP_NONE, DJP_NONE // EOL marker
+ };
+
+ APIRET rc;
+ PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery;
+ PBYTE pBuffer = NULL;
+ LONG nAlloc = 0;
+ LONG nDrivDataSize = pDriverData->cb;
+
+ // find out how many bytes to allocate
+ pQuerySize->cb = sizeof( alQuery );
+ rc = DevEscape( hPrinterDC,
+ DEVESC_QUERYSIZE,
+ sizeof( alQuery ),
+ (PBYTE)pQuerySize,
+ &nDrivDataSize,
+ (PBYTE)pDriverData );
+ if ( DEV_OK != rc )
+ return FALSE;
+
+ // allocate the memory
+ nAlloc = pQuerySize->ulSizeNeeded;
+ pBuffer = (PBYTE)new BYTE[nAlloc];
+
+ // set up the input
+ PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
+ ImplFormatInputList( pDJP, pQuerySize->aTuples );
+
+ pDJP->cb = sizeof( DJP_ITEM );
+ pDJP->ulProperty = DJP_SJ_ORIENTATION;
+ pDJP->lType = DJP_CURRENT;
+ pDJP->ulValue = (eOrientation == ORIENTATION_PORTRAIT)
+ ? DJP_ORI_PORTRAIT
+ : DJP_ORI_LANDSCAPE;
+
+ // do it!
+ rc = DevEscape( hPrinterDC,
+ DEVESC_SETJOBPROPERTIES,
+ nAlloc,
+ pBuffer,
+ &nDrivDataSize,
+ (PBYTE)pDriverData );
+
+ delete [] pBuffer;
+
+ return ((DEV_OK == rc) || (DEV_WARNING == rc));
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplSetPaperSize( HDC hPrinterDC, PDRIVDATA pDriverData,
+ DJPT_PAPERSIZE nOS2PaperFormat )
+{
+ LONG alQuery[] =
+ {
+ 0, 0, // First two members of QUERYSIZE
+ DJP_SJ_PAPERSIZE, DJP_CURRENT,
+ DJP_NONE, DJP_NONE // EOL marker
+ };
+
+ APIRET rc;
+ PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery;
+ PBYTE pBuffer = NULL;
+ LONG nAlloc = 0;
+ LONG nDrivDataSize = pDriverData->cb;
+
+ // find out how many bytes to allocate
+ pQuerySize->cb = sizeof( alQuery );
+ rc = DevEscape( hPrinterDC,
+ DEVESC_QUERYSIZE,
+ sizeof( alQuery ),
+ (PBYTE)pQuerySize,
+ &nDrivDataSize,
+ (PBYTE)pDriverData );
+ if ( DEV_OK != rc )
+ return FALSE;
+
+ // allocate the memory
+ nAlloc = pQuerySize->ulSizeNeeded;
+ pBuffer = (PBYTE)new BYTE[nAlloc];
+
+ // set up the input
+ PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
+ PDJP_ITEM pStartDJP = pDJP;
+ ImplFormatInputList( pDJP, pQuerySize->aTuples );
+
+ // Neue Daten zuweisen
+ pDJP->cb = sizeof( DJP_ITEM );
+ pDJP->ulProperty = DJP_SJ_PAPERSIZE;
+ pDJP->lType = DJP_CURRENT;
+ pDJP->ulValue = nOS2PaperFormat;
+
+ // und setzen
+ rc = DevEscape( hPrinterDC,
+ DEVESC_SETJOBPROPERTIES,
+ nAlloc,
+ pBuffer,
+ &nDrivDataSize,
+ (PBYTE)pDriverData );
+
+ delete [] pBuffer;
+
+ return ((DEV_OK == rc) || (DEV_WARNING == rc));
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplSetPaperBin( HDC hPrinterDC, PDRIVDATA pDriverData,
+ ImplTrayInfo* pTrayInfo )
+{
+ LONG alQuery[] =
+ {
+ 0, 0, // First two members of QUERYSIZE
+ DJP_SJ_TRAYTYPE, DJP_CURRENT,
+ DJP_NONE, DJP_NONE // EOL marker
+ };
+
+ APIRET rc;
+ PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery;
+ PBYTE pBuffer = NULL;
+ LONG nAlloc = 0;
+ LONG nDrivDataSize = pDriverData->cb;
+
+ // find out how many bytes to allocate
+ pQuerySize->cb = sizeof( alQuery );
+ rc = DevEscape( hPrinterDC,
+ DEVESC_QUERYSIZE,
+ sizeof( alQuery ),
+ (PBYTE)pQuerySize,
+ &nDrivDataSize,
+ (PBYTE)pDriverData );
+ if ( DEV_OK != rc )
+ return FALSE;
+
+ // allocate the memory
+ nAlloc = pQuerySize->ulSizeNeeded;
+ pBuffer = (PBYTE)new BYTE[nAlloc];
+
+ // set up the input
+ PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer;
+ ImplFormatInputList( pDJP, pQuerySize->aTuples );
+
+ // Neue Daten zuweisen
+ pDJP->cb = sizeof( DJP_ITEM );
+ pDJP->ulProperty = DJP_SJ_TRAYTYPE;
+ pDJP->lType = DJP_CURRENT;
+ pDJP->ulValue = pTrayInfo->mnId;
+
+ // und setzen
+ rc = DevEscape( hPrinterDC,
+ DEVESC_SETJOBPROPERTIES,
+ nAlloc,
+ pBuffer,
+ &nDrivDataSize,
+ (PBYTE)pDriverData );
+
+ delete [] pBuffer;
+
+ return ((DEV_OK == rc) || (DEV_WARNING == rc));
+}
+
+// =======================================================================
+
+static BOOL ImplSalCreateInfoPrn( SalInfoPrinter* pPrinter, PDRIVDATA pDriverData,
+ HDC& rDC, HPS& rPS )
+{
+ SalData* pSalData = GetSalData();
+
+ // create info context
+ DEVOPENSTRUC devOpenStruc;
+ memset( &devOpenStruc, 0, sizeof( devOpenStruc ) );
+ devOpenStruc.pszLogAddress = (char*)(const char*)pPrinter->maPrinterData.maName;
+ devOpenStruc.pszDriverName = (char*)(const char*)pPrinter->maPrinterData.maDriverName;
+ devOpenStruc.pdriv = pDriverData;
+ devOpenStruc.pszDataType = "PM_Q_STD";
+
+ HDC hDC = DevOpenDC( pSalData->mhAB, OD_INFO, "*",
+ 4, (PDEVOPENDATA)&devOpenStruc, (HDC)NULL);
+ if ( !hDC )
+ return FALSE;
+
+ // create presentation space
+ SIZEL sizel;
+ sizel.cx = 0;
+ sizel.cy = 0;
+ HPS hPS = GpiCreatePS( pSalData->mhAB, hDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS );
+ if ( !hPS )
+ {
+ DevCloseDC( hDC );
+ return FALSE;
+ }
+
+ rDC = hDC;
+ rPS = hPS;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalDestroyInfoPrn( SalInfoPrinter* pPrinter )
+{
+ ImplSalDeInitGraphics( &(pPrinter->maPrinterData.mpGraphics->maGraphicsData) );
+ GpiAssociate( pPrinter->maPrinterData.mhPS, 0 );
+ GpiDestroyPS( pPrinter->maPrinterData.mhPS );
+ DevCloseDC( pPrinter->maPrinterData.mhDC );
+}
+
+// =======================================================================
+
+SalInfoPrinter* SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
+ ImplJobSetup* pSetupData )
+{
+ ImplQueueSalSysData* pSysQueueData = (ImplQueueSalSysData*)(pQueueInfo->mpSysData);
+ SalInfoPrinter* pPrinter = new SalInfoPrinter;
+ pPrinter->maPrinterData.maPrinterName = pSysQueueData->maPrinterName;
+ pPrinter->maPrinterData.maName = pSysQueueData->maName;
+ pPrinter->maPrinterData.maDriverName = pSysQueueData->maDriverName;
+ pPrinter->maPrinterData.maDeviceName = pSysQueueData->maDeviceName;
+
+ // Nur Setup-Daten uebernehmen, wenn Treiber und Laenge der Treiberdaten
+ // uebereinstimmt
+ PDRIVDATA pDriverData;
+ BOOL bUpdateDriverData;
+ if ( pSetupData->mpDriverData && pSysQueueData->mpDrivData &&
+ (pSetupData->mnSystem == JOBSETUP_SYSTEM_OS2) &&
+ (pSetupData->mnDriverDataLen == pSysQueueData->mpDrivData->cb) &&
+ (strcmp( ((PDRIVDATA)pSetupData->mpDriverData)->szDeviceName,
+ pSysQueueData->mpDrivData->szDeviceName ) == 0) )
+ {
+ pDriverData = PDRIVDATA( pSetupData->mpDriverData );
+ bUpdateDriverData = FALSE;
+ }
+ else
+ {
+ pDriverData = pSysQueueData->mpDrivData;
+ bUpdateDriverData = TRUE;
+ }
+ if ( pDriverData )
+ pPrinter->maPrinterData.maJobSetupDeviceName = pDriverData->szDeviceName;
+
+ if ( !ImplSalCreateInfoPrn( pPrinter, pDriverData,
+ pPrinter->maPrinterData.mhDC,
+ pPrinter->maPrinterData.mhPS ) )
+ {
+ delete pPrinter;
+ return NULL;
+ }
+
+ // create graphics object for output
+ SalGraphics* pGraphics = new SalGraphics;
+ pGraphics->maGraphicsData.mhDC = pPrinter->maPrinterData.mhDC;
+ pGraphics->maGraphicsData.mhPS = pPrinter->maPrinterData.mhPS;
+ pGraphics->maGraphicsData.mhWnd = 0;
+ pGraphics->maGraphicsData.mbPrinter = TRUE;
+ pGraphics->maGraphicsData.mbVirDev = FALSE;
+ pGraphics->maGraphicsData.mbWindow = FALSE;
+ pGraphics->maGraphicsData.mbScreen = FALSE;
+
+ ImplSalInitGraphics( &(pGraphics->maGraphicsData) );
+ pPrinter->maPrinterData.mpGraphics = pGraphics;
+
+ // check printer driver for DJP support
+ pPrinter->maPrinterData.mbDJPSupported = ImplIsDriverDJPEnabled( pPrinter->maPrinterData.mhDC );
+
+ if ( bUpdateDriverData )
+ {
+ if ( pSetupData->mpDriverData )
+ delete pSetupData->mpDriverData;
+ pSetupData->mpDriverData = new BYTE[pDriverData->cb];
+ memcpy( pSetupData->mpDriverData, pDriverData, pDriverData->cb );
+ pSetupData->mnDriverDataLen = pDriverData->cb;
+ }
+
+ // retrieve current settings from printer driver and store them to system independend data!
+ if ( pPrinter->maPrinterData.mbDJPSupported )
+ ImplGetCurrentSettings( pPrinter, pSetupData );
+ pSetupData->mnSystem = JOBSETUP_SYSTEM_OS2;
+
+ return pPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+// =======================================================================
+
+SalInfoPrinter::SalInfoPrinter()
+{
+ maPrinterData.mhDC = 0;
+ maPrinterData.mhPS = 0;
+ maPrinterData.mpGraphics = NULL;
+ maPrinterData.mbGraphics = FALSE;
+ maPrinterData.mbDJPSupported = FALSE;
+ maPrinterData.mnFormCount = 0;
+ maPrinterData.mpFormArray = NULL;
+ maPrinterData.mnTrayCount = 0;
+ maPrinterData.mpTrayArray = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+SalInfoPrinter::~SalInfoPrinter()
+{
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDestroyInfoPrn( this );
+ delete maPrinterData.mpGraphics;
+ }
+
+ ImplFreeFormAndTrayList( this );
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalInfoPrinter::GetGraphics()
+{
+ if ( maPrinterData.mbGraphics )
+ return NULL;
+
+ if ( maPrinterData.mpGraphics )
+ maPrinterData.mbGraphics = TRUE;
+
+ return maPrinterData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInfoPrinter::ReleaseGraphics( SalGraphics* )
+{
+ maPrinterData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
+{
+ PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData );
+ if ( !pDrivData )
+ return FALSE;
+
+ APIRET rc = DevPostDeviceModes( GetSalData()->mhAB, pDrivData,
+ maPrinterData.maDriverName.GetStr(),
+ maPrinterData.maDeviceName.GetStr(),
+ maPrinterData.maPrinterName.GetStr(),
+ DPDM_POSTJOBPROP );
+ if ( rc == DEV_OK )
+ {
+ ImplUpdateSetupData( pDrivData, pSetupData );
+
+ // update DC and PS
+ HDC hDC;
+ HPS hPS;
+ if ( !ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) )
+ return FALSE;
+
+ // Alten Printer DC/PS zerstoeren
+ ImplSalDestroyInfoPrn( this );
+
+ // Neue Daten setzen und initialisieren
+ maPrinterData.mhDC = hDC;
+ maPrinterData.mhPS = hPS;
+ maPrinterData.mpGraphics->maGraphicsData.mhDC = maPrinterData.mhDC;
+ maPrinterData.mpGraphics->maGraphicsData.mhPS = maPrinterData.mhPS;
+ ImplSalInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+
+ // retrieve current settings from printer driver and store them to system independend data!
+ ImplFreeFormAndTrayList( this );
+ if ( maPrinterData.mbDJPSupported )
+ ImplGetCurrentSettings( this, pSetupData );
+
+ return TRUE;
+ }
+ else
+ {
+ ImplFreePrnMemory( pDrivData );
+ return FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
+{
+ // Wir koennen nur Treiberdaten von OS2 setzen
+ if ( pSetupData->mnSystem != JOBSETUP_SYSTEM_OS2 )
+ return FALSE;
+
+ PDRIVDATA pNewDrivData = (PDRIVDATA)(pSetupData->mpDriverData);
+ if ( !pNewDrivData )
+ return FALSE;
+
+ // Testen, ob Printerdaten fuer den gleichen Printer uebergeben werden,
+ // da einige Treiber zu Abstuerzen neigen, wenn Daten von einem anderen
+ // Printer gesetzt werden
+ if ( strcmp( maPrinterData.maJobSetupDeviceName, pNewDrivData->szDeviceName ) != 0 )
+ return FALSE;
+
+ // update DC and PS
+ HDC hDC;
+ HPS hPS;
+ if ( !ImplSalCreateInfoPrn( this, pNewDrivData, hDC, hPS ) )
+ return FALSE;
+
+ // Alten Printer DC/PS zerstoeren
+ ImplSalDestroyInfoPrn( this );
+
+ // Neue Daten setzen und initialisieren
+ maPrinterData.mhDC = hDC;
+ maPrinterData.mhPS = hPS;
+ maPrinterData.mpGraphics->maGraphicsData.mhDC = maPrinterData.mhDC;
+ maPrinterData.mpGraphics->maGraphicsData.mhPS = maPrinterData.mhPS;
+ ImplSalInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+
+ // retrieve current settings from printer driver and store them to system independend data!
+ ImplFreeFormAndTrayList( this );
+ if ( maPrinterData.mbDJPSupported )
+ ImplGetCurrentSettings( this, pSetupData );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
+{
+ // needs DJP support
+ if ( !maPrinterData.mbDJPSupported )
+ return FALSE;
+
+ PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData );
+
+ if ( !pDrivData )
+ return FALSE;
+
+ BOOL bOK = FALSE;
+
+ // set orientation
+ if ( nFlags & SAL_JOBSET_ORIENTATION )
+ {
+ if ( ImplSetOrientation( maPrinterData.mhDC, pDrivData, pSetupData->meOrientation ) )
+ bOK = TRUE;
+ }
+
+ // set paper size
+ if ( nFlags & SAL_JOBSET_PAPERSIZE )
+ {
+ // Papierformat ermitteln
+ DJPT_PAPERSIZE nOS2PaperFormat;
+ switch ( pSetupData->mePaperFormat )
+ {
+ case PAPER_A3:
+ nOS2PaperFormat = DJP_PSI_A3;
+ break;
+
+ case PAPER_A4:
+ nOS2PaperFormat = DJP_PSI_A4;
+ break;
+
+ case PAPER_A5:
+ nOS2PaperFormat = DJP_PSI_A5;
+ break;
+
+ case PAPER_B4:
+ nOS2PaperFormat = DJP_PSI_B4;
+ break;
+
+ case PAPER_B5:
+ nOS2PaperFormat = DJP_PSI_B5;
+ break;
+
+ case PAPER_LETTER:
+ nOS2PaperFormat = DJP_PSI_LETTER;
+ break;
+
+ case PAPER_LEGAL:
+ nOS2PaperFormat = DJP_PSI_LEGAL;
+ break;
+
+ case PAPER_TABLOID:
+ nOS2PaperFormat = DJP_PSI_TABLOID;
+ break;
+
+ default:
+ {
+ nOS2PaperFormat = DJP_PSI_NONE;
+ // OS2 rechnet in Millimetern
+ long nPaperWidth = pSetupData->mnPaperWidth / 100;
+ long nPaperHeight = pSetupData->mnPaperHeight / 100;
+ // Ansonsten ueber die Papiergroesse suchen
+ for( int i = 0; i < maPrinterData.mnFormCount; i++ )
+ {
+ ImplFormInfo* pFormInfo = maPrinterData.mpFormArray[i];
+ if ( ImplPaperSizeEqual( nPaperWidth, nPaperHeight,
+ pFormInfo->mnPaperWidth, pFormInfo->mnPaperHeight ) )
+ {
+ nOS2PaperFormat = pFormInfo->mnId;
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ if ( nOS2PaperFormat != DJP_PSI_NONE )
+ {
+ if ( ImplSetPaperSize( maPrinterData.mhDC, pDrivData, nOS2PaperFormat ) )
+ bOK = TRUE;
+ }
+ }
+
+ // set paper tray
+ if ( (nFlags & SAL_JOBSET_PAPERBIN) && (pSetupData->mnPaperBin < maPrinterData.mnTrayCount) )
+ {
+ if ( ImplSetPaperBin( maPrinterData.mhDC, pDrivData,
+ maPrinterData.mpTrayArray[pSetupData->mnPaperBin] ) )
+ bOK = TRUE;
+ }
+
+ if ( bOK )
+ {
+ ImplUpdateSetupData( pDrivData, pSetupData );
+
+ // query current driver settings
+ ImplFreeFormAndTrayList( this );
+ if ( ImplGetCurrentSettings( this, pSetupData ) )
+ {
+ // update DC and PS
+ HDC hDC;
+ HPS hPS;
+ if ( ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) )
+ {
+ // Alten Printer DC/PS zerstoeren
+ ImplSalDestroyInfoPrn( this );
+
+ // Neue Daten setzen und initialisieren
+ maPrinterData.mhDC = hDC;
+ maPrinterData.mhPS = hPS;
+ maPrinterData.mpGraphics->maGraphicsData.mhDC = maPrinterData.mhDC;
+ maPrinterData.mpGraphics->maGraphicsData.mhPS = maPrinterData.mhPS;
+ ImplSalInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ }
+ else
+ bOK = FALSE;
+ }
+ else
+ bOK = FALSE;
+ }
+
+ return bOK;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup )
+{
+ if ( !maPrinterData.mbDJPSupported )
+ return 1;
+
+ // init paperbinlist if empty
+ if ( !maPrinterData.mnTrayCount )
+ ImplGetFormAndTrayList( this, pJobSetup );
+
+ // Wir haben immer einen PaperTray und wenn, das eben einen ohne
+ // Namen
+ if ( !maPrinterData.mnTrayCount )
+ return 1;
+ else
+ return maPrinterData.mnTrayCount;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup,
+ ULONG nPaperBin )
+{
+ XubString aPaperBinName;
+
+ if ( maPrinterData.mbDJPSupported )
+ {
+ // init paperbinlist if empty
+ if ( !maPrinterData.mnTrayCount )
+ ImplGetFormAndTrayList( this, pJobSetup );
+
+ if ( nPaperBin < maPrinterData.mnTrayCount )
+ aPaperBinName = maPrinterData.mpTrayArray[nPaperBin]->maDisplayName;
+ }
+
+ return aPaperBinName;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInfoPrinter::GetCapabilities( const ImplJobSetup*, USHORT nType )
+{
+ switch ( nType )
+ {
+ case PRINTER_CAPABILITIES_SUPPORTDIALOG:
+ return TRUE;
+ case PRINTER_CAPABILITIES_COPIES:
+ return 0xFFFF;
+ case PRINTER_CAPABILITIES_COLLATECOPIES:
+ return 0;
+ case PRINTER_CAPABILITIES_SETORIENTATION:
+ case PRINTER_CAPABILITIES_SETPAPERBIN:
+ case PRINTER_CAPABILITIES_SETPAPERSIZE:
+ case PRINTER_CAPABILITIES_SETPAPER:
+ return maPrinterData.mbDJPSupported;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInfoPrinter::GetPageInfo( const ImplJobSetup*,
+ long& rOutWidth, long& rOutHeight,
+ long& rPageOffX, long& rPageOffY,
+ long& rPageWidth, long& rPageHeight )
+{
+ HDC hDC = maPrinterData.mhDC;
+
+ // search current form
+ HCINFO aInfo;
+ int nForms = DevQueryHardcopyCaps( hDC, 0, 0, &aInfo );
+ for( int i = 0; i < nForms; i++ )
+ {
+ if ( DevQueryHardcopyCaps( hDC, i, 1, &aInfo ) >= 0 )
+ {
+ if ( aInfo.flAttributes & HCAPS_CURRENT )
+ {
+ // query resolution
+ long nXResolution;
+ long nYResolution;
+ DevQueryCaps( hDC, CAPS_HORIZONTAL_RESOLUTION, 1, &nXResolution );
+ DevQueryCaps( hDC, CAPS_VERTICAL_RESOLUTION, 1, &nYResolution );
+ rPageOffX = aInfo.xLeftClip * nXResolution / 1000;
+ rPageOffY = (aInfo.cy-aInfo.yTopClip) * nYResolution / 1000;
+ rPageWidth = aInfo.cx * nXResolution / 1000;
+ rPageHeight = aInfo.cy * nYResolution / 1000;
+ rOutWidth = aInfo.xPels;
+ rOutHeight = aInfo.yPels;
+ return;
+ }
+ }
+ }
+
+ // use device caps if no form selected/found
+ long lCapsWidth = 0;
+ long lCapsHeight = 0;
+ DevQueryCaps( hDC, CAPS_WIDTH, 1L, &lCapsWidth );
+ DevQueryCaps( hDC, CAPS_HEIGHT, 1L, &lCapsHeight );
+ rPageOffX = 0;
+ rPageOffY = 0;
+ rOutWidth = lCapsWidth;
+ rOutHeight = lCapsHeight;
+ rPageWidth = rOutWidth;
+ rPageHeight = rOutHeight;
+}
+
+// =======================================================================
+
+static BOOL ImplIsDriverPrintDJPEnabled( HDC hDC )
+{
+#ifdef NO_DJP
+ return FALSE;
+#else
+ // Ueber OS2-Ini kann DJP disablte werden
+ if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTDJP, 1 ) )
+ return FALSE;
+
+ // Testen, ob DJP-Interface am Drucker vorhanden
+ LONG lQuery;
+ APIRET rc;
+
+ lQuery = DEVESC_QUERYSIZE;
+ rc = DevEscape( hDC,
+ DEVESC_QUERYESCSUPPORT,
+ sizeof( lQuery ),
+ (PBYTE)&lQuery,
+ 0,
+ (PBYTE)NULL );
+ if ( DEV_OK != rc )
+ return FALSE;
+
+ return TRUE;
+#endif
+}
+
+// =======================================================================
+
+SalPrinter* SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
+{
+ SalPrinter* pPrinter = new SalPrinter;
+ pPrinter->maPrinterData.mpInfoPrinter = pInfoPrinter;
+ return pPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyPrinter( SalPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+// =======================================================================
+
+SalPrinter::SalPrinter()
+{
+ maPrinterData.mhDC = 0;
+ maPrinterData.mhPS = 0;
+ maPrinterData.mpGraphics = NULL;
+ maPrinterData.mbAbort = FALSE;
+ maPrinterData.mbPrintDJPSupported = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SalPrinter::~SalPrinter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::StartJob( const XubString* pFileName,
+ const XubString& rJobName,
+ const XubString& rAppName,
+ ULONG nCopies, BOOL bCollate,
+ ImplJobSetup* pSetupData )
+{
+ DEVOPENSTRUC aDevOpenStruc;
+ LONG lType;
+ APIRET rc;
+
+ // prepare queue information
+ memset( &aDevOpenStruc, 0, sizeof( aDevOpenStruc ) );
+ aDevOpenStruc.pszDriverName = (PSZ)(maPrinterData.mpInfoPrinter->maPrinterData.maDriverName.GetStr());
+
+ // print into file?
+ if ( pFileName )
+ {
+ aDevOpenStruc.pszLogAddress = (PSZ)pFileName->GetStr();
+ aDevOpenStruc.pszDataType = "PM_Q_RAW";
+ lType = OD_DIRECT;
+ }
+ else
+ {
+ aDevOpenStruc.pszLogAddress = (PSZ)(maPrinterData.mpInfoPrinter->maPrinterData.maName.GetStr());
+ if ( PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTRAW, 0 ) )
+ aDevOpenStruc.pszDataType = "PM_Q_RAW";
+ else
+ aDevOpenStruc.pszDataType = "PM_Q_STD";
+ lType = OD_QUEUED;
+ }
+
+ // Set comment (AppName nur bis zum 1. Space-Zeichen nehmen)
+ const xub_Unicode* pComment = rAppName;
+ USHORT nCommentLen = 0;
+ memset( maPrinterData.maCommentBuf, 0, sizeof( maPrinterData.maCommentBuf ) );
+ while ( (nCommentLen < 32) &&
+ (((*pComment >= 'a') && (*pComment <= 'z')) ||
+ ((*pComment >= 'A') && (*pComment <= 'Z')) ||
+ ((*pComment >= '0') && (*pComment <= '9')) ||
+ (*pComment == '-')))
+ {
+ maPrinterData.maCommentBuf[nCommentLen] = (char)(*pComment);
+ nCommentLen++;
+ pComment++;
+ }
+ aDevOpenStruc.pszComment = (PSZ)maPrinterData.maCommentBuf;
+
+ // Kopien
+ if ( nCopies > 1 )
+ {
+ // OS2 kann maximal 999 Kopien
+ if ( nCopies > 999 )
+ nCopies = 999;
+ String aCopyStr( nCopies );
+ strcpy( maPrinterData.maCopyBuf, "COP=" );
+ strcat( maPrinterData.maCopyBuf+4, aCopyStr.GetStr() );
+ aDevOpenStruc.pszQueueProcParams = (PSZ)maPrinterData.maCopyBuf;
+ }
+
+ // open device context
+ SalData* pSalData = GetSalData();
+ HAB hAB = pSalData->mhAB;
+ aDevOpenStruc.pdriv = (PDRIVDATA)pSetupData->mpDriverData;
+ maPrinterData.mhDC = DevOpenDC( hAB,
+ lType,
+ "*",
+ 7,
+ (PDEVOPENDATA)&aDevOpenStruc,
+ 0 );
+ if ( maPrinterData.mhDC == 0 )
+ {
+ ERRORID nLastError = WinGetLastError( hAB );
+ if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT )
+ maPrinterData.mnError = SAL_PRINTER_ERROR_ABORT;
+ else
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+
+ // open presentation space
+ SIZEL sizel;
+ sizel.cx = 0;
+ sizel.cy = 0;
+ maPrinterData.mhPS = GpiCreatePS( hAB, maPrinterData.mhDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS );
+ if ( !maPrinterData.mhPS )
+ {
+ DevCloseDC( maPrinterData.mhDC );
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return NULL;
+ }
+
+ // Can we print with DJP
+ maPrinterData.mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( maPrinterData.mhDC );
+
+ // JobName ermitteln und Job starten
+ PSZ pszJobName = NULL;
+ int nJobNameLen = 0;
+ if ( rJobName.Len() > 0 )
+ {
+ pszJobName = (PSZ)rJobName.GetStr();
+ nJobNameLen = rJobName.Len();
+ }
+ rc = DevEscape( maPrinterData.mhDC,
+ DEVESC_STARTDOC,
+ nJobNameLen, pszJobName,
+ 0, NULL );
+
+ if ( rc != DEV_OK )
+ {
+ ERRORID nLastError = WinGetLastError( hAB );
+ if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT )
+ maPrinterData.mnError = SAL_PRINTER_ERROR_ABORT;
+ else
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ GpiAssociate( maPrinterData.mhPS, NULL );
+ GpiDestroyPS( maPrinterData.mhPS );
+ DevCloseDC( maPrinterData.mhDC );
+ return FALSE;
+ }
+
+ // init for first page
+ maPrinterData.mbFirstPage = TRUE;
+ maPrinterData.mnError = 0;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::EndJob()
+{
+ APIRET rc;
+ rc = DevEscape( maPrinterData.mhDC,
+ DEVESC_ENDDOC,
+ 0, NULL,
+ 0, NULL);
+
+ // destroy presentation space and device context
+ GpiAssociate( maPrinterData.mhPS, NULL );
+ GpiDestroyPS( maPrinterData.mhPS );
+ DevCloseDC( maPrinterData.mhDC );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::AbortJob()
+{
+ APIRET rc;
+
+ rc = DevEscape( maPrinterData.mhDC,
+ DEVESC_ABORTDOC,
+ 0, NULL,
+ 0, NULL );
+
+ // destroy SalGraphics
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ maPrinterData.mpGraphics = NULL;
+ }
+
+ // destroy presentation space and device context
+ GpiAssociate( maPrinterData.mhPS, NULL );
+ GpiDestroyPS( maPrinterData.mhPS );
+ DevCloseDC( maPrinterData.mhDC );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobSetup )
+{
+ APIRET rc;
+
+ if ( maPrinterData.mbFirstPage )
+ maPrinterData.mbFirstPage = FALSE;
+ else
+ {
+ PBYTE pJobData;
+ LONG nJobDataSize;
+ LONG nEscape;
+ if ( maPrinterData.mbPrintDJPSupported && bNewJobSetup )
+ {
+ nEscape = DEVESC_NEWFRAME_WPROP;
+ nJobDataSize = ((PDRIVDATA)(pSetupData->mpDriverData))->cb;
+ pJobData = (PBYTE)(pSetupData->mpDriverData);
+ }
+ else
+ {
+ nEscape = DEVESC_NEWFRAME;
+ nJobDataSize = 0;
+ pJobData = NULL;
+ }
+ rc = DevEscape( maPrinterData.mhDC,
+ nEscape,
+ 0, NULL,
+ &nJobDataSize, pJobData );
+
+ if ( rc != DEV_OK )
+ {
+ DevEscape( maPrinterData.mhDC, DEVESC_ENDDOC, 0, NULL, 0, NULL);
+ GpiAssociate( maPrinterData.mhPS, NULL );
+ GpiDestroyPS( maPrinterData.mhPS );
+ DevCloseDC( maPrinterData.mhDC );
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return NULL;
+ }
+ }
+
+ // create SalGraphics with copy of hPS
+ SalGraphics* pGraphics = new SalGraphics;
+ pGraphics->maGraphicsData.mhDC = maPrinterData.mhDC;
+ pGraphics->maGraphicsData.mhPS = maPrinterData.mhPS;
+ pGraphics->maGraphicsData.mhWnd = 0;
+ pGraphics->maGraphicsData.mbPrinter = TRUE;
+ pGraphics->maGraphicsData.mbVirDev = FALSE;
+ pGraphics->maGraphicsData.mbWindow = FALSE;
+ pGraphics->maGraphicsData.mbScreen = FALSE;
+ pGraphics->maGraphicsData.mnHeight = 0;
+ // search current form for actual page height
+ HCINFO aInfo;
+ int nForms = DevQueryHardcopyCaps( maPrinterData.mhDC, 0, 0, &aInfo );
+ for( int i = 0; i < nForms; i++ )
+ {
+ if ( DevQueryHardcopyCaps( maPrinterData.mhDC, i, 1, &aInfo ) >= 0 )
+ {
+ if ( aInfo.flAttributes & HCAPS_CURRENT )
+ pGraphics->maGraphicsData.mnHeight = aInfo.yPels;
+ }
+ }
+ // use device caps if no form selected/found
+ if ( !pGraphics->maGraphicsData.mnHeight )
+ DevQueryCaps( maPrinterData.mhDC, CAPS_HEIGHT, 1L, &pGraphics->maGraphicsData.mnHeight );
+
+ ImplSalInitGraphics( &(pGraphics->maGraphicsData) );
+ maPrinterData.mpGraphics = pGraphics;
+
+ return pGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::EndPage()
+{
+ if ( maPrinterData.mpGraphics )
+ {
+ // destroy SalGraphics
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ maPrinterData.mpGraphics = NULL;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalPrinter::GetErrorCode()
+{
+ return maPrinterData.mnError;
+}
diff --git a/vcl/os2/source/gdi/salvd.cxx b/vcl/os2/source/gdi/salvd.cxx
new file mode 100644
index 000000000000..9014913f7415
--- /dev/null
+++ b/vcl/os2/source/gdi/salvd.cxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#include <tools/svpm.h>
+
+#define _SV_SALVD_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+
+// =======================================================================
+
+HBITMAP ImplCreateVirDevBitmap( HDC hDC, HPS hPS, long nDX, long nDY,
+ USHORT nBitCount )
+{
+ if( !nBitCount )
+ {
+ LONG nDevBitCount;
+ DevQueryCaps( hDC, CAPS_COLOR_BITCOUNT, 1, &nDevBitCount );
+ nBitCount = nDevBitCount;
+ }
+
+ LONG nPlanes;
+ DevQueryCaps( hDC, CAPS_COLOR_PLANES, 1, &nPlanes );
+
+ // entsprechende Bitmap zum OutputDevice erzeugen
+ HBITMAP hBitmap;
+ BITMAPINFOHEADER2 aBitmapInfo;
+ memset( &aBitmapInfo, 0, sizeof( BITMAPINFOHEADER2 ) );
+ aBitmapInfo.cbFix = sizeof( BITMAPINFOHEADER2 );
+ aBitmapInfo.cx = nDX;
+ aBitmapInfo.cy = nDY;
+ aBitmapInfo.cPlanes = nPlanes;
+ aBitmapInfo.cBitCount = (nBitCount < 4) ? 4 : nBitCount;
+ hBitmap = GpiCreateBitmap( hPS, &aBitmapInfo, 0, NULL, NULL );
+ return hBitmap;
+}
+
+// -----------------------------------------------------------------------
+
+SalVirtualDevice* SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
+ long nDX, long nDY,
+ USHORT nBitCount )
+{
+ HAB hAB = GetSalData()->mhAB;
+ SIZEL size;
+
+ // create device context (at this time allways display compatible)
+ DEVOPENSTRUC aDevOpenStruc = { NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+ HDC hDC = DevOpenDC( hAB, OD_MEMORY, (PSZ)"*", 5, (PDEVOPENDATA)&aDevOpenStruc, 0 );
+ if ( !hDC )
+ return NULL;
+
+ // create presentation space
+ size.cx = nDX;
+ size.cy = nDY;
+ HPS hPS = GpiCreatePS( hAB, hDC, &size, GPIT_MICRO | GPIA_ASSOC | PU_PELS );
+ if ( !hPS )
+ {
+ DevCloseDC( hDC );
+ return NULL;
+ }
+
+ // create bitmap for the virtual device
+ HBITMAP hBmp = ImplCreateVirDevBitmap( hDC, hPS, nDX, nDY, nBitCount );
+ if ( !hBmp )
+ {
+ GpiDestroyPS( hPS );
+ DevCloseDC( hDC );
+ return NULL;
+ }
+
+ // init data
+ SalVirtualDevice* pVDev = new SalVirtualDevice;
+ SalGraphics* pVirGraphics = new SalGraphics;
+
+ pVirGraphics->maGraphicsData.mhDC = hDC;
+ pVirGraphics->maGraphicsData.mhPS = hPS;
+ pVirGraphics->maGraphicsData.mhWnd = 0;
+ pVirGraphics->maGraphicsData.mnHeight = nDY;
+ pVirGraphics->maGraphicsData.mbPrinter = FALSE;
+ pVirGraphics->maGraphicsData.mbVirDev = TRUE;
+ pVirGraphics->maGraphicsData.mbWindow = FALSE;
+ pVirGraphics->maGraphicsData.mbScreen = pGraphics->maGraphicsData.mbScreen;
+ ImplSalInitGraphics( &(pVirGraphics->maGraphicsData) );
+
+ pVDev->maVirDevData.mhDC = hDC;
+ pVDev->maVirDevData.mhPS = hPS;
+ pVDev->maVirDevData.mhBmp = hBmp;
+ pVDev->maVirDevData.mhDefBmp = GpiSetBitmap( hPS, hBmp );
+ pVDev->maVirDevData.mpGraphics = pVirGraphics;
+ pVDev->maVirDevData.mnBitCount = nBitCount;
+ pVDev->maVirDevData.mbGraphics = FALSE;
+ return pVDev;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice )
+{
+ delete pDevice;
+}
+
+// =======================================================================
+
+SalVirtualDevice::SalVirtualDevice()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SalVirtualDevice::~SalVirtualDevice()
+{
+ ImplSalDeInitGraphics( &(maVirDevData.mpGraphics->maGraphicsData) );
+
+ GpiSetBitmap( maVirDevData.mpGraphics->maGraphicsData.mhPS, maVirDevData.mhDefBmp );
+ GpiDeleteBitmap( maVirDevData.mhBmp );
+ GpiDestroyPS( maVirDevData.mpGraphics->maGraphicsData.mhPS );
+ DevCloseDC( maVirDevData.mpGraphics->maGraphicsData.mhDC );
+ delete maVirDevData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalVirtualDevice::GetGraphics()
+{
+ if ( maVirDevData.mbGraphics )
+ return NULL;
+
+ if ( maVirDevData.mpGraphics )
+ maVirDevData.mbGraphics = TRUE;
+
+ return maVirDevData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalVirtualDevice::ReleaseGraphics( SalGraphics* )
+{
+ maVirDevData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalVirtualDevice::SetSize( long nDX, long nDY )
+{
+ HBITMAP hNewBmp = ImplCreateVirDevBitmap( maVirDevData.mhDC,
+ maVirDevData.mhPS, nDX, nDY,
+ maVirDevData.mnBitCount );
+ if ( hNewBmp )
+ {
+ GpiSetBitmap( maVirDevData.mhPS, hNewBmp );
+ GpiDeleteBitmap( maVirDevData.mhBmp );
+ maVirDevData.mhBmp = hNewBmp;
+ maVirDevData.mpGraphics->maGraphicsData.mnHeight = nDY;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
diff --git a/vcl/os2/source/src/makefile.mk b/vcl/os2/source/src/makefile.mk
new file mode 100644
index 000000000000..f9c8e73f40af
--- /dev/null
+++ b/vcl/os2/source/src/makefile.mk
@@ -0,0 +1,147 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SV
+TARGET=salsrc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+RCDEPN= nullptr.ptr \
+ help.ptr \
+ cross.ptr \
+ move.ptr \
+ hsplit.ptr \
+ vsplit.ptr \
+ hsizebar.ptr \
+ vsizebar.ptr \
+ hand.ptr \
+ refhand.ptr \
+ pen.ptr \
+ magnify.ptr \
+ fill.ptr \
+ rotate.ptr \
+ hshear.ptr \
+ vshear.ptr \
+ mirror.ptr \
+ crook.ptr \
+ crop.ptr \
+ movept.ptr \
+ movebw.ptr \
+ movedata.ptr \
+ copydata.ptr \
+ linkdata.ptr \
+ movedlnk.ptr \
+ copydlnk.ptr \
+ movef.ptr \
+ copyf.ptr \
+ linkf.ptr \
+ moveflnk.ptr \
+ copyflnk.ptr \
+ movef2.ptr \
+ copyf2.ptr \
+ dline.ptr \
+ drect.ptr \
+ dpolygon.ptr \
+ dbezier.ptr \
+ darc.ptr \
+ dpie.ptr \
+ dcirccut.ptr \
+ dellipse.ptr \
+ dfree.ptr \
+ dconnect.ptr \
+ dtext.ptr \
+ dcapt.ptr \
+ chart.ptr \
+ detectiv.ptr \
+ pivotcol.ptr \
+ pivotrow.ptr \
+ pivotfld.ptr \
+ chain.ptr \
+ chainnot.ptr \
+ timemove.ptr \
+ timesize.ptr \
+ asn.ptr \
+ ass.ptr \
+ asw.ptr \
+ ase.ptr \
+ asnw.ptr \
+ asne.ptr \
+ assw.ptr \
+ asse.ptr \
+ asns.ptr \
+ aswe.ptr \
+ asnswe.ptr \
+ sd.ico
+
+RCFILES= salsrc.rc
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/os2/source/src/salsrc.rc b/vcl/os2/source/src/salsrc.rc
new file mode 100644
index 000000000000..26b936bd4e44
--- /dev/null
+++ b/vcl/os2/source/src/salsrc.rc
@@ -0,0 +1,134 @@
+/*************************************************************************
+*
+* $RCSfile: salsrc.rc,v $
+*
+* $Revision: 1.1.1.1 $
+*
+* last change: $Author: hr $ $Date: 2000-09-18 17:05:34 $
+*
+* The Contents of this file are made available subject to the terms of
+* either of the following licenses
+*
+* - GNU Lesser General Public License Version 2.1
+* - Sun Industry Standards Source License Version 1.1
+*
+* Sun Microsystems Inc., October, 2000
+*
+* GNU Lesser General Public License Version 2.1
+* =============================================
+* Copyright 2000 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
+*
+*
+* Sun Industry Standards Source License Version 1.1
+* =================================================
+* The contents of this file are subject to the Sun Industry Standards
+* Source License Version 1.1 (the "License"); You may not use this file
+* except in compliance with the License. You may obtain a copy of the
+* License at http://www.openoffice.org/license.html.
+*
+* Software provided under this License is provided on an "AS IS" basis,
+* WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+* WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+* See the License for the specific provisions governing your rights and
+* obligations concerning the Software.
+*
+* The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+*
+* Copyright: 2000 by Sun Microsystems, Inc.
+*
+* All Rights Reserved.
+*
+* Contributor(s): _______________________________________
+*
+*
+*
+**************************************************************************/
+
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+
+POINTER SAL_RESID_POINTER_NULL NULLPTR.PTR
+POINTER SAL_RESID_POINTER_HELP HELP.PTR
+POINTER SAL_RESID_POINTER_CROSS CROSS.PTR
+POINTER SAL_RESID_POINTER_MOVE MOVE.PTR
+POINTER SAL_RESID_POINTER_HSPLIT HSPLIT.PTR
+POINTER SAL_RESID_POINTER_VSPLIT VSPLIT.PTR
+POINTER SAL_RESID_POINTER_HSIZEBAR HSIZEBAR.PTR
+POINTER SAL_RESID_POINTER_VSIZEBAR VSIZEBAR.PTR
+POINTER SAL_RESID_POINTER_HAND HAND.PTR
+POINTER SAL_RESID_POINTER_REFHAND REFHAND.PTR
+POINTER SAL_RESID_POINTER_PEN PEN.PTR
+POINTER SAL_RESID_POINTER_MAGNIFY MAGNIFY.PTR
+POINTER SAL_RESID_POINTER_FILL FILL.PTR
+POINTER SAL_RESID_POINTER_ROTATE ROTATE.PTR
+POINTER SAL_RESID_POINTER_HSHEAR HSHEAR.PTR
+POINTER SAL_RESID_POINTER_VSHEAR VSHEAR.PTR
+POINTER SAL_RESID_POINTER_MIRROR MIRROR.PTR
+POINTER SAL_RESID_POINTER_CROOK CROOK.PTR
+POINTER SAL_RESID_POINTER_CROP CROP.PTR
+POINTER SAL_RESID_POINTER_MOVEPOINT MOVEPT.PTR
+POINTER SAL_RESID_POINTER_MOVEBEZIERWEIGHT MOVEBW.PTR
+POINTER SAL_RESID_POINTER_MOVEDATA MOVEDATA.PTR
+POINTER SAL_RESID_POINTER_COPYDATA COPYDATA.PTR
+POINTER SAL_RESID_POINTER_LINKDATA LINKDATA.PTR
+POINTER SAL_RESID_POINTER_MOVEDATALINK MOVEDLNK.PTR
+POINTER SAL_RESID_POINTER_COPYDATALINK COPYDLNK.PTR
+POINTER SAL_RESID_POINTER_MOVEFILE MOVEF.PTR
+POINTER SAL_RESID_POINTER_COPYFILE COPYF.PTR
+POINTER SAL_RESID_POINTER_LINKFILE LINKF.PTR
+POINTER SAL_RESID_POINTER_MOVEFILELINK MOVEFLNK.PTR
+POINTER SAL_RESID_POINTER_COPYFILELINK COPYFLNK.PTR
+POINTER SAL_RESID_POINTER_MOVEFILES MOVEF2.PTR
+POINTER SAL_RESID_POINTER_COPYFILES COPYF2.PTR
+POINTER SAL_RESID_POINTER_DRAW_LINE DLINE.PTR
+POINTER SAL_RESID_POINTER_DRAW_RECT DRECT.PTR
+POINTER SAL_RESID_POINTER_DRAW_POLYGON DPOLYGON.PTR
+POINTER SAL_RESID_POINTER_DRAW_BEZIER DBEZIER.PTR
+POINTER SAL_RESID_POINTER_DRAW_ARC DARC.PTR
+POINTER SAL_RESID_POINTER_DRAW_PIE DPIE.PTR
+POINTER SAL_RESID_POINTER_DRAW_CIRCLECUT DCIRCCUT.PTR
+POINTER SAL_RESID_POINTER_DRAW_ELLIPSE DELLIPSE.PTR
+POINTER SAL_RESID_POINTER_DRAW_FREEHAND DFREE.PTR
+POINTER SAL_RESID_POINTER_DRAW_CONNECT DCONNECT.PTR
+POINTER SAL_RESID_POINTER_DRAW_TEXT DTEXT.PTR
+POINTER SAL_RESID_POINTER_DRAW_CAPTION DCAPT.PTR
+POINTER SAL_RESID_POINTER_CHART CHART.PTR
+POINTER SAL_RESID_POINTER_DETECTIVE DETECTIV.PTR
+POINTER SAL_RESID_POINTER_PIVOT_COL PIVOTCOL.PTR
+POINTER SAL_RESID_POINTER_PIVOT_ROW PIVOTROW.PTR
+POINTER SAL_RESID_POINTER_PIVOT_FIELD PIVOTFLD.PTR
+POINTER SAL_RESID_POINTER_CHAIN CHAIN.PTR
+POINTER SAL_RESID_POINTER_CHAIN_NOTALLOWED CHAINNOT.PTR
+POINTER SAL_RESID_POINTER_TIMEEVENT_MOVE TIMEMOVE.PTR
+POINTER SAL_RESID_POINTER_TIMEEVENT_SIZE TIMESIZE.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_N ASN.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_S ASS.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_W ASW.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_E ASE.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_NW ASNW.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_NE ASNE.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_SW ASSW.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_SE ASSE.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_NS ASNS.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_WE ASWE.PTR
+POINTER SAL_RESID_POINTER_AUTOSCROLL_NSWE ASNSWE.PTR
+
+ICON SAL_RESID_ICON_SD SD.ICO
+
diff --git a/vcl/os2/source/window/makefile b/vcl/os2/source/window/makefile
new file mode 100644
index 000000000000..4b811da766cd
--- /dev/null
+++ b/vcl/os2/source/window/makefile
@@ -0,0 +1,40 @@
+#*************************************************************************
+#*
+#* $Workfile: makefile $
+#*
+#* Ersterstellung TH 01.04.97
+#* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 17:05:35 $
+#* $Revision: 1.1.1.1 $
+#*
+#* $Logfile: T:/vcl/os2/source/window/makefile.__v $
+#*
+#* Copyright (c) 1990 - 1998, STAR DIVISION
+#*
+#*************************************************************************
+
+PRJ=..\..\..
+
+PRJNAME=SV
+TARGET=salwin
+
+# --- Settings -----------------------------------------------------
+
+!INCLUDE <svpre.mak>
+!INCLUDE <settings.mak>
+!INCLUDE <sv.mak>
+
+!IF "$(COM)"=="ICC"
+ENVCFLAGS=$(ENVCFLAGS) -D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE
+!ENDIF
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= salframe.cxx \
+ salobj.cxx
+
+SLOFILES= $(SLO)\salframe.obj \
+ $(SLO)\salobj.obj
+
+# --- Targets ------------------------------------------------------
+
+!INCLUDE <target.mak>
diff --git a/vcl/os2/source/window/makefile.mk b/vcl/os2/source/window/makefile.mk
new file mode 100644
index 000000000000..71f60055e8ef
--- /dev/null
+++ b/vcl/os2/source/window/makefile.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=SV
+TARGET=salwin
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= salframe.cxx \
+ salobj.cxx
+
+SLOFILES= $(SLO)$/salframe.obj \
+ $(SLO)$/salobj.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx
new file mode 100644
index 000000000000..f17d3c5ecd8c
--- /dev/null
+++ b/vcl/os2/source/window/salframe.cxx
@@ -0,0 +1,2762 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __ZTC__
+#define _Seg16 _far16
+#define _Far16 _far16
+#define _System _syscall
+#define _Pascal _pascal
+#define _Cdecl _cdecl
+#endif
+
+#define BOOL PM_BOOL
+#define BYTE PM_BYTE
+#define USHORT PM_USHORT
+#define ULONG PM_ULONG
+
+#define INCL_DOS
+#define INCL_PM
+#include <os2.h>
+#include <os2im.h>
+
+#undef BOOL
+#undef BYTE
+#undef USHORT
+#undef ULONG
+
+#ifdef __cplusplus
+}
+#endif
+
+// =======================================================================
+
+#define _SV_SALFRAME_CXX
+
+#ifndef DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#define private public
+
+#ifndef _SV_SALLANG_HXX
+#include <sallang.hxx>
+#endif
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_KEYCOES_HXX
+#include <keycodes.hxx>
+#endif
+
+// =======================================================================
+
+// Toolkit4 defines
+#ifndef SV_FULLWINDOWDRAG
+#define SV_FULLWINDOWDRAG 99
+#endif
+
+// =======================================================================
+
+static eImplKeyboardLanguage = LANGUAGE_DONTKNOW;
+
+// =======================================================================
+
+#ifdef ENABLE_IME
+
+struct ImplSalIMEProc
+{
+ ULONG nOrd;
+ PFN* pProc;
+};
+
+#define SAL_IME_PROC_COUNT 12
+
+// -----------------------------------------------------------------------
+
+static SalIMEData* GetSalIMEData()
+{
+ SalData* pSalData = GetSalData();
+
+ if ( !pSalData->mbIMEInit )
+ {
+ pSalData->mbIMEInit = TRUE;
+
+ HMODULE hMod = 0;
+ if ( 0 == DosLoadModule( NULL, 0, "OS2IM", &hMod ) )
+ {
+ SalIMEData* pIMEData = new SalIMEData;
+ BOOL bError = FALSE;
+ ImplSalIMEProc aProcAry[SAL_IME_PROC_COUNT] =
+ {
+ { 101, (PFN*)&(pIMEData->mpAssocIME) },
+ { 104, (PFN*)&(pIMEData->mpGetIME) },
+ { 106, (PFN*)&(pIMEData->mpReleaseIME) },
+ { 117, (PFN*)&(pIMEData->mpSetConversionFont) },
+ { 144, (PFN*)&(pIMEData->mpSetConversionFontSize) },
+ { 118, (PFN*)&(pIMEData->mpGetConversionString) },
+ { 122, (PFN*)&(pIMEData->mpGetResultString) },
+ { 115, (PFN*)&(pIMEData->mpSetCandidateWin) },
+ { 130, (PFN*)&(pIMEData->mpQueryIMEProperty) },
+ { 131, (PFN*)&(pIMEData->mpRequestIME) },
+ { 128, (PFN*)&(pIMEData->mpSetIMEMode) },
+ { 127, (PFN*)&(pIMEData->mpQueryIMEMode) }
+ };
+
+ pIMEData->mhModIME = hMod;
+ for ( USHORT i = 0; i < SAL_IME_PROC_COUNT; i++ )
+ {
+ if ( 0 != DosQueryProcAddr( pIMEData->mhModIME, aProcAry[i].nOrd, 0, aProcAry[i].pProc ) )
+ {
+ bError = TRUE;
+ break;
+ }
+ }
+
+ if ( bError )
+ {
+ DosFreeModule( pIMEData->mhModIME );
+ delete pIMEData;
+ }
+ else
+ pSalData->mpIMEData = pIMEData;
+ }
+ }
+
+ return pSalData->mpIMEData;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplReleaseSALIMEData()
+{
+ SalData* pSalData = GetSalData();
+
+ if ( pSalData->mpIMEData )
+ {
+ DosFreeModule( pSalData->mpIMEData->mhModIME );
+ delete pSalData->mpIMEData;
+ }
+}
+
+#endif
+
+// =======================================================================
+
+static void ImplSaveFrameState( SalFrame* pFrame )
+{
+ if ( !pFrame->maFrameData.mbFullScreen )
+ {
+ SWP aSWP;
+
+ // Query actual state
+ WinQueryWindowPos( pFrame->maFrameData.mhWndFrame, &aSWP );
+
+ if ( aSWP.fl & SWP_MINIMIZE )
+ pFrame->maFrameData.maState.mnState |= SAL_FRAMESTATE_MINIMIZED;
+ else if ( aSWP.fl & SWP_MAXIMIZE )
+ {
+ pFrame->maFrameData.maState.mnState &= ~SAL_FRAMESTATE_MINIMIZED;
+ pFrame->maFrameData.maState.mnState |= SAL_FRAMESTATE_MAXIMIZED;
+ pFrame->maFrameData.mbRestoreMaximize = TRUE;
+ }
+ else
+ {
+ pFrame->maFrameData.maState.mnState &= ~(SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED);
+ pFrame->maFrameData.maState.mnX = aSWP.x;
+ pFrame->maFrameData.maState.mnY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN )-(aSWP.y+aSWP.cy);
+ pFrame->maFrameData.maState.mnWidth = aSWP.cx;
+ pFrame->maFrameData.maState.mnHeight = aSWP.cy;
+ pFrame->maFrameData.mbRestoreMaximize = FALSE;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ImplSalCallbackDummy( void*, SalFrame*, USHORT, const void* )
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* GetSalDefaultFrame()
+{
+ SalData* pSalData = GetSalData();
+
+ // Wenn kein Dummy-Frame existiert, dann legen wir uns einen an
+ if ( !pSalData->mpDummyFrame )
+ pSalData->mpDummyFrame = pSalData->mpFirstInstance->CreateFrame( NULL, 0 );
+
+ return pSalData->mpDummyFrame;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalCalcFrameSize( const SalFrame* pFrame,
+ LONG& rFrameX, LONG& rFrameY, LONG& rCaptionY )
+{
+ if ( pFrame->maFrameData.mnOS2Style & FCF_SIZEBORDER )
+ {
+ rFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXSIZEBORDER );
+ rFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER );
+ }
+ else if ( pFrame->maFrameData.mnOS2Style & FCF_DLGBORDER )
+ {
+ rFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXDLGFRAME );
+ rFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME );
+ }
+ else if ( pFrame->maFrameData.mnOS2Style & FCF_BORDER )
+ {
+ rFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXBORDER );
+ rFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER );
+ }
+ else
+ {
+ rFrameX = 0;
+ rFrameY = 0;
+ }
+ if ( pFrame->maFrameData.mnOS2Style & (FCF_TITLEBAR | FCF_SYSMENU) )
+ rCaptionY = WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR );
+ else
+ rCaptionY = 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalCalcFullScreenSize( const SalFrame* pFrame,
+ LONG& rX, LONG& rY, LONG& rDX, LONG& rDY )
+{
+ // set window to screen size
+ LONG nFrameX;
+ LONG nFrameY;
+ LONG nCaptionY;
+ LONG nScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
+ LONG nScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
+
+ // Framegroessen berechnen
+ ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY );
+
+ rX = -nFrameX;
+ rY = -nFrameY;
+ rDX = nScreenDX+(nFrameX*2);
+ rDY = nScreenDY+(nFrameY*2)+nCaptionY;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalFrameFullScreenPos( SalFrame* pFrame, BOOL bAlways = FALSE )
+{
+ SWP aSWP;
+ WinQueryWindowPos( pFrame->maFrameData.mhWndFrame, &aSWP );
+ if ( bAlways || !(aSWP.fl & SWP_MINIMIZE) )
+ {
+ // set window to screen size
+ LONG nX;
+ LONG nY;
+ LONG nWidth;
+ LONG nHeight;
+ ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight );
+ WinSetWindowPos( pFrame->maFrameData.mhWndFrame, 0,
+ nX, nY, nWidth, nHeight,
+ SWP_MOVE | SWP_SIZE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+// Uebersetzungstabelle von System-Keycodes in StarView-Keycodes
+#define KEY_TAB_SIZE (VK_ENDDRAG+1)
+
+static USHORT TranslateKey[KEY_TAB_SIZE] =
+{
+ // StarView-Code System-Code Index
+ 0, // 0x00
+ 0, // VK_BUTTON1 0x01
+ 0, // VK_BUTTON2 0x02
+ 0, // VK_BUTTON3 0x03
+ 0, // VK_BREAK 0x04
+ KEY_BACKSPACE, // VK_BACKSPACE 0x05
+ KEY_TAB, // VK_TAB 0x06
+ KEY_TAB, // VK_BACKTAB 0x07
+ KEY_RETURN, // VK_NEWLINE 0x08
+ 0, // VK_SHIFT 0x09
+ 0, // VK_CTRL 0x0A
+ 0, // VK_ALT 0x0B
+ 0, // VK_ALTGRAF 0x0C
+ 0, // VK_PAUSE 0x0D
+ 0, // VK_CAPSLOCK 0x0E
+ KEY_ESCAPE, // VK_ESC 0x0F
+ KEY_SPACE, // VK_SPACE 0x10
+ KEY_PAGEUP, // VK_PAGEUP 0x11
+ KEY_PAGEDOWN, // VK_PAGEDOWN 0x12
+ KEY_END, // VK_END 0x13
+ KEY_HOME, // VK_HOME 0x14
+ KEY_LEFT, // VK_LEFT 0x15
+ KEY_UP, // VK_UP 0x16
+ KEY_RIGHT, // VK_RIGHT 0x17
+ KEY_DOWN, // VK_DOWN 0x18
+ 0, // VK_PRINTSCRN 0x19
+ KEY_INSERT, // VK_INSERT 0x1A
+ KEY_DELETE, // VK_DELETE 0x1B
+ 0, // VK_SCRLLOCK 0x1C
+ 0, // VK_NUMLOCK 0x1D
+ KEY_RETURN, // VK_ENTER 0x1E
+ 0, // VK_SYSRQ 0x1F
+ KEY_F1, // VK_F1 0x20
+ KEY_F2, // VK_F2 0x21
+ KEY_F3, // VK_F3 0x22
+ KEY_F4, // VK_F4 0x23
+ KEY_F5, // VK_F5 0x24
+ KEY_F6, // VK_F6 0x25
+ KEY_F7, // VK_F7 0x26
+ KEY_F8, // VK_F8 0x27
+ KEY_F9, // VK_F9 0x28
+ KEY_F10, // VK_F10 0x29
+ KEY_F11, // VK_F11 0x2A
+ KEY_F12, // VK_F12 0x2B
+ KEY_F13, // VK_F13 0x2C
+ KEY_F14, // VK_F14 0x2D
+ KEY_F15, // VK_F15 0x2E
+ KEY_F16, // VK_F16 0x2F
+ KEY_F17, // VK_F17 0x30
+ KEY_F18, // VK_F18 0x31
+ KEY_F19, // VK_F19 0x32
+ KEY_F20, // VK_F20 0x33
+ KEY_F21, // VK_F21 0x34
+ KEY_F22, // VK_F22 0x35
+ KEY_F23, // VK_F23 0x36
+ KEY_F24, // VK_F24 0x37
+ 0 // VK_ENDDRAG 0x38
+};
+
+// =======================================================================
+
+SalFrame* ImplSalCreateFrame( SalInstance* pInst, SalFrame* pParent, ULONG nSalFrameStyle )
+{
+ SalData* pSalData = GetSalData();
+ SalFrame* pFrame = new SalFrame;
+ HWND hWndFrame;
+ HWND hWndClient;
+ PM_ULONG nFrameFlags = FCF_NOBYTEALIGN | FCF_NOMOVEWITHOWNER | FCF_SCREENALIGN;
+ PM_ULONG nFrameStyle = 0;
+ PM_ULONG nClientStyle = WS_CLIPSIBLINGS;
+
+ // determine creation data (bei Moveable nehmen wir DLG-Border, damit
+ // es besser aussieht)
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE )
+ nFrameFlags |= FCF_SIZEBORDER | FCF_SYSMENU;
+ else if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE )
+ nFrameFlags |= FCF_DLGBORDER;
+ else if ( nSalFrameStyle & SAL_FRAME_STYLE_BORDER )
+ nFrameFlags |= FCF_BORDER;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE )
+ nFrameFlags |= FCF_TITLEBAR | FCF_SYSMENU;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MINABLE )
+ nFrameFlags |= FCF_MINBUTTON | FCF_SYSMENU;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MAXABLE )
+ nFrameFlags |= FCF_MAXBUTTON | FCF_SYSMENU;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT )
+ nFrameFlags |= FCF_TASKLIST;
+
+ // create frame
+ pSalData->mpCreateFrame = pFrame;
+ hWndFrame = WinCreateStdWindow( HWND_DESKTOP, nFrameStyle, &nFrameFlags,
+ (PSZ)SAL_FRAME_CLASSNAME, (PSZ)"",
+ nClientStyle, 0, 0, &hWndClient );
+
+ if ( !hWndFrame )
+ {
+ delete pFrame;
+ return NULL;
+ }
+
+ // Parent setzen (Owner)
+ if ( pParent )
+ WinSetOwner( hWndFrame, pParent->maFrameData.mhWndClient );
+
+ // Icon setzen
+ if ( nFrameFlags & FCF_MINBUTTON )
+ WinSendMsg( hWndFrame, WM_SETICON, (MPARAM)pInst->maInstData.mhAppIcon, (MPARAM)0 );
+
+ // Frames subclassen, da wir auch dort die eine oder andere Message
+ // abfangen wollen oder anders behandeln wollen
+ aSalShlData.mpOldFrameProc = WinSubclassWindow( hWndFrame, SalFrameFrameProc );
+
+ // init frame data
+ pFrame->maFrameData.mhWndFrame = hWndFrame;
+ pFrame->maFrameData.mhWndClient = hWndClient;
+ pFrame->maFrameData.mhAB = pInst->maInstData.mhAB;
+ pFrame->maFrameData.mnStyle = nSalFrameStyle;
+ pFrame->maFrameData.mnOS2Style = nFrameFlags;
+ pFrame->maFrameData.maSysData.hWnd = hWndClient;
+
+ // determine show style
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT )
+ {
+ pSalData->mpDefaultFrame = pFrame;
+
+ // restore saved position
+ SWP aSWP;
+ memset( &aSWP, 0, sizeof( aSWP ) );
+ WinQueryTaskSizePos( pInst->maInstData.mhAB, 0, &aSWP );
+ WinSetWindowPos( hWndFrame, HWND_TOP,
+ aSWP.x, aSWP.y, aSWP.cx, aSWP.cy,
+ SWP_ZORDER | SWP_MOVE | SWP_SIZE |
+ (aSWP.fl & (SWP_RESTORE | SWP_MINIMIZE | SWP_MAXIMIZE)) );
+ if ( aSWP.fl & (SWP_MINIMIZE | SWP_MAXIMIZE) )
+ pFrame->maFrameData.mbOverwriteState = FALSE;
+ if ( !(aSWP.fl & SWP_MINIMIZE) )
+ WinSetWindowPos( hWndFrame, 0, 0, 0, 0, 0, SWP_MAXIMIZE );
+ }
+ else
+ {
+ SWP aSWP;
+ RECTL rectl;
+ memset( &aSWP, 0, sizeof( aSWP ) );
+ WinQueryWindowRect( HWND_DESKTOP, &rectl );
+ aSWP.x = rectl.xLeft + 10;
+ aSWP.y = rectl.yBottom + 10;
+ aSWP.cx = rectl.xRight - rectl.xLeft - 20;
+ aSWP.cy = rectl.yTop - rectl.yBottom - 20;
+ WinSetWindowPos( hWndFrame, HWND_TOP,
+ aSWP.x, aSWP.y, aSWP.cx, aSWP.cy,
+ SWP_MOVE | SWP_SIZE | SWP_ZORDER );
+ }
+
+ // disable close
+ if ( !(nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) )
+ {
+ HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU );
+ if ( hSysMenu )
+ {
+ WinSendMsg( hSysMenu,
+ MM_SETITEMATTR,
+ MPFROM2SHORT( SC_CLOSE, TRUE ),
+ MPFROM2SHORT( MIA_DISABLED, MIA_DISABLED ) );
+ }
+ }
+
+#ifdef ENABLE_IME
+/*
+ // Input-Context einstellen
+ SalIMEData* pIMEData = GetSalIMEData();
+ if ( pIMEData )
+ {
+ pFrame->maFrameData.mhIMEContext = 0;
+ if ( 0 != pIMEData->mpAssocIME( hWndClient, pFrame->maFrameData.mhIMEContext, &pFrame->maFrameData.mhDefIMEContext ) )
+ pFrame->maFrameData.mhDefIMEContext = 0;
+ }
+ else
+ {
+ pFrame->maFrameData.mhIMEContext = 0;
+ pFrame->maFrameData.mhDefIMEContext = 0;
+ }
+*/
+#endif
+
+ ImplSaveFrameState( pFrame );
+ pFrame->maFrameData.mbDefPos = TRUE;
+
+ return pFrame;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyFrame( SalFrame* pFrame )
+{
+ delete pFrame;
+}
+
+// =======================================================================
+
+SalFrame::SalFrame()
+{
+ SalData* pSalData = GetSalData();
+
+ maFrameData.mbGraphics = NULL;
+ maFrameData.mhPointer = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE );
+ maFrameData.mpGraphics = NULL;
+ maFrameData.mpInst = NULL;
+ maFrameData.mpProc = ImplSalCallbackDummy;
+ maFrameData.mbFullScreen = FALSE;
+ maFrameData.mbAllwayOnTop = FALSE;
+ maFrameData.mbVisible = FALSE;
+ maFrameData.mbMinHide = FALSE;
+ maFrameData.mbInShow = FALSE;
+ maFrameData.mbRestoreMaximize = FALSE;
+ maFrameData.mbInMoveMsg = FALSE;
+ maFrameData.mbInSizeMsg = FALSE;
+ maFrameData.mbDefPos = TRUE;
+ maFrameData.mbOverwriteState = TRUE;
+ maFrameData.mbHandleIME = FALSE;
+ maFrameData.mbConversionMode = FALSE;
+ maFrameData.mbCandidateMode = FALSE;
+ memset( &maFrameData.maState, 0, sizeof( SalFrameState ) );
+ maFrameData.maSysData.nSize = sizeof( SystemEnvData );
+
+ // insert frame in framelist
+ maFrameData.mpNextFrame = pSalData->mpFirstFrame;
+ pSalData->mpFirstFrame = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame::~SalFrame()
+{
+ SalData* pSalData = GetSalData();
+
+ // destroy DC
+ if ( maFrameData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maFrameData.mpGraphics->maGraphicsData) );
+ WinReleasePS( maFrameData.mpGraphics->maGraphicsData.mhPS );
+ delete maFrameData.mpGraphics;
+ }
+
+ // destroy system frame
+ WinDestroyWindow( maFrameData.mhWndFrame );
+
+ // reset default and dummy frame
+ if ( pSalData->mpDefaultFrame == this )
+ pSalData->mpDefaultFrame = 0;
+ if ( pSalData->mpDummyFrame == this )
+ pSalData->mpDummyFrame = 0;
+
+ // remove frame from framelist
+ if ( this == pSalData->mpFirstFrame )
+ pSalData->mpFirstFrame = maFrameData.mpNextFrame;
+ else
+ {
+ SalFrame* pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame->maFrameData.mpNextFrame != this )
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+
+ pTempFrame->maFrameData.mpNextFrame = maFrameData.mpNextFrame;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static HDC ImplWinGetDC( HWND hWnd )
+{
+ HDC hDC = WinQueryWindowDC( hWnd );
+ if ( !hDC )
+ hDC = WinOpenWindowDC( hWnd );
+ return hDC;
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalFrame::GetGraphics()
+{
+ if ( maFrameData.mbGraphics )
+ return NULL;
+
+ if ( !maFrameData.mpGraphics )
+ {
+ SalData* pSalData = GetSalData();
+ maFrameData.mpGraphics = new SalGraphics;
+ maFrameData.mpGraphics->maGraphicsData.mhPS = WinGetPS( maFrameData.mhWndClient );
+ maFrameData.mpGraphics->maGraphicsData.mhDC = ImplWinGetDC( maFrameData.mhWndClient );
+ maFrameData.mpGraphics->maGraphicsData.mhWnd = maFrameData.mhWndClient;
+ maFrameData.mpGraphics->maGraphicsData.mnHeight = maFrameData.mnHeight;
+ maFrameData.mpGraphics->maGraphicsData.mbPrinter = FALSE;
+ maFrameData.mpGraphics->maGraphicsData.mbVirDev = FALSE;
+ maFrameData.mpGraphics->maGraphicsData.mbWindow = TRUE;
+ maFrameData.mpGraphics->maGraphicsData.mbScreen = TRUE;
+ ImplSalInitGraphics( &(maFrameData.mpGraphics->maGraphicsData) );
+ maFrameData.mbGraphics = TRUE;
+ }
+ else
+ maFrameData.mbGraphics = TRUE;
+
+ return maFrameData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ReleaseGraphics( SalGraphics* )
+{
+ maFrameData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalFrame::PostEvent( void* pData )
+{
+ return (BOOL)WinPostMsg( maFrameData.mhWndClient, SAL_MSG_USEREVENT, 0, (MPARAM)pData );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetTitle( const XubString& rTitle )
+{
+ // set window title
+ WinSetWindowText( maFrameData.mhWndFrame, (PSZ)(const char*)rTitle );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Show( BOOL bVisible )
+{
+ maFrameData.mbVisible = bVisible;
+ if ( bVisible )
+ {
+ maFrameData.mbOverwriteState = TRUE;
+ maFrameData.mbInShow = TRUE;
+ WinSetWindowPos( maFrameData.mhWndFrame, 0, 0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE );
+ maFrameData.mbInShow = FALSE;
+ WinUpdateWindow( maFrameData.mhWndClient );
+ }
+ else
+ {
+ maFrameData.mbInShow = TRUE;
+ WinSetWindowPos( maFrameData.mhWndFrame, 0, 0, 0, 0, 0, SWP_HIDE );
+ maFrameData.mbInShow = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetClientSize( long nWidth, long nHeight )
+{
+ // calculation frame size
+ LONG nX;
+ LONG nY;
+ LONG nFrameX;
+ LONG nFrameY;
+ LONG nCaptionY;
+ LONG nScreenWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
+ LONG nScreenHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
+
+ // Framegroessen berechnen
+ ImplSalCalcFrameSize( this, nFrameX, nFrameY, nCaptionY );
+
+ // adjust give size
+ nWidth += 2*nFrameX;
+ nHeight += 2*nFrameY + nCaptionY;
+
+ // Default-Position, dann zentrieren, ansonsten Position beibehalten
+ if ( maFrameData.mbDefPos )
+ {
+ // calculate bottom left corner of frame
+ nX = (nScreenWidth-nWidth)/2;
+ nY = (nScreenHeight-nHeight)/2;
+ maFrameData.mbDefPos = FALSE;
+ }
+ else
+ {
+ SWP aSWP;
+ WinQueryWindowPos( maFrameData.mhWndFrame, &aSWP );
+
+ nX = aSWP.x;
+ nY = aSWP.y+(aSWP.cy-nHeight);
+
+ // Fenster einpassen
+ if ( nX + nWidth > nScreenWidth )
+ nX = nScreenWidth - nWidth;
+ if ( nY < 0 )
+ nY = 0;
+ }
+
+ // Fenster einpassen
+ if ( nX < 0 )
+ nX = 0;
+ if ( nY > nScreenHeight-nHeight )
+ nY = nScreenHeight-nHeight;
+
+ // set new position
+ WinSetWindowPos( maFrameData.mhWndFrame,
+ 0,
+ nX, nY,
+ nWidth, nHeight,
+ SWP_MOVE | SWP_SIZE | SWP_RESTORE );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::GetClientSize( long& rWidth, long& rHeight )
+{
+ // Wenn wir von aussen gehidet werden (beispielsweise Hide-Button)
+ // muessen wir eine Groesse von 0,0 vorgaukeln, damit Dialoge noch
+ // als System-Fenster angezeigt werden
+ if ( maFrameData.mbMinHide )
+ {
+ rWidth = 0;
+ rHeight = 0;
+ }
+ else
+ {
+ rWidth = maFrameData.mnWidth;
+ rHeight = maFrameData.mnHeight;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetWindowState( const SalFrameState* pState )
+{
+ LONG nX = pState->mnX;
+ LONG nY = pState->mnY;
+ LONG nCX = pState->mnWidth;
+ LONG nCY = pState->mnHeight;
+
+ // Fenster-Position/Groesse in den Bildschirm einpassen
+ LONG nScreenWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
+ LONG nScreenHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
+ if ( nCX > nScreenWidth )
+ {
+ nX = 0;
+ nCX = nScreenWidth;
+ }
+ if ( nCY > nScreenHeight )
+ {
+ nY = 0;
+ nCY = nScreenHeight;
+ }
+
+ // Y is under OS2 bottom align
+ nY = nScreenHeight-(nY+nCY);
+
+ if ( !maFrameData.mbOverwriteState ||
+ (pState->mnState & (SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED)) )
+ {
+ if ( maFrameData.mbOverwriteState )
+ {
+ PM_ULONG nSizeStyle;
+ if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED )
+ nSizeStyle = SWP_MINIMIZE;
+ else
+ nSizeStyle = SWP_MAXIMIZE;
+ WinSetWindowPos( maFrameData.mhWndFrame, 0, 0, 0, 0, 0, nSizeStyle );
+ }
+
+ WinSetWindowUShort( maFrameData.mhWndFrame, QWS_XRESTORE, nX );
+ WinSetWindowUShort( maFrameData.mhWndFrame, QWS_YRESTORE, nY );
+ WinSetWindowUShort( maFrameData.mhWndFrame, QWS_CXRESTORE, nCX );
+ WinSetWindowUShort( maFrameData.mhWndFrame, QWS_CYRESTORE, nCY );
+ }
+ else
+ {
+ PM_ULONG nSizeStyle = SWP_MOVE | SWP_SIZE | SWP_RESTORE;
+ WinSetWindowPos( maFrameData.mhWndFrame, 0, nX, nY, nCX, nCY, nSizeStyle );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalFrame::GetWindowState( SalFrameState* pState )
+{
+ if ( maFrameData.maState.mnWidth && maFrameData.maState.mnHeight )
+ {
+ *pState = maFrameData.maState;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ShowFullScreen( BOOL bFullScreen )
+{
+ if ( maFrameData.mbFullScreen == bFullScreen )
+ return;
+
+ maFrameData.mbFullScreen = bFullScreen;
+ if ( bFullScreen )
+ {
+ // save old position
+ memset( &maFrameData.maFullScreenRect, 0, sizeof( SWP ) );
+ WinQueryWindowPos( maFrameData.mhWndFrame, &maFrameData.maFullScreenRect );
+
+ // set window to screen size
+ ImplSalFrameFullScreenPos( this, TRUE );
+ }
+ else
+ {
+ WinSetWindowPos( maFrameData.mhWndFrame,
+ 0,
+ maFrameData.maFullScreenRect.x, maFrameData.maFullScreenRect.y,
+ maFrameData.maFullScreenRect.cx, maFrameData.maFullScreenRect.cy,
+ SWP_MOVE | SWP_SIZE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::StartPresentation( BOOL bStart )
+{
+ // SysSetObjectData("<WP_DESKTOP>","Autolockup=no"); oder OS2.INI: PM_Lockup
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetAlwaysOnTop( BOOL bOnTop )
+{
+ maFrameData.mbAllwayOnTop = bOnTop;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ToTop( USHORT nFlags )
+{
+ PM_ULONG nStyle = 0;
+ SWP aSWP;
+ WinQueryWindowPos( maFrameData.mhWndFrame, &aSWP );
+ if ( aSWP.fl & SWP_MINIMIZE )
+ {
+ if ( !(nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN) )
+ return;
+
+ if ( maFrameData.mbRestoreMaximize )
+ nStyle |= SWP_MAXIMIZE;
+ else
+ nStyle |= SWP_RESTORE;
+ }
+
+ WinSetWindowPos( maFrameData.mhWndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER | nStyle );
+ WinSetFocus( HWND_DESKTOP, maFrameData.mhWndClient );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetPointer( PointerStyle ePointerStyle )
+{
+ struct ImplPtrData
+ {
+ HPOINTER mhPointer;
+ PM_ULONG mnSysId;
+ PM_ULONG mnOwnId;
+ };
+
+ static ImplPtrData aImplPtrTab[POINTER_COUNT] =
+ {
+ { 0, SPTR_ARROW, 0 }, // POINTER_ARROW
+ { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL
+ { 0, SPTR_WAIT, 0 }, // POINTER_WAIT
+ { 0, SPTR_TEXT, 0 }, // POINTER_BEAM
+ { 0, 0, SAL_RESID_POINTER_HELP }, // POINTER_HELP
+ { 0, 0, SAL_RESID_POINTER_CROSS }, // POINTER_CROSS
+ { 0, 0, SAL_RESID_POINTER_MOVE }, // POINTER_MOVE
+ { 0, SPTR_SIZENS, 0 }, // POINTER_NSIZE
+ { 0, SPTR_SIZENS, 0 }, // POINTER_SSIZE
+ { 0, SPTR_SIZEWE, 0 }, // POINTER_WSIZE
+ { 0, SPTR_SIZEWE, 0 }, // POINTER_ESIZE
+ { 0, SPTR_SIZENWSE, 0 }, // POINTER_NWSIZE
+ { 0, SPTR_SIZENESW, 0 }, // POINTER_NESIZE
+ { 0, SPTR_SIZENESW, 0 }, // POINTER_SWSIZE
+ { 0, SPTR_SIZENWSE, 0 }, // POINTER_SESIZE
+ { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_NSIZE
+ { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_SSIZE
+ { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE
+ { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE
+ { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE
+ { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE
+ { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE
+ { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE
+ { 0, 0, SAL_RESID_POINTER_HSPLIT }, // POINTER_HSPLIT
+ { 0, 0, SAL_RESID_POINTER_VSPLIT }, // POINTER_VSPLIT
+ { 0, 0, SAL_RESID_POINTER_HSIZEBAR }, // POINTER_HSIZEBAR
+ { 0, 0, SAL_RESID_POINTER_VSIZEBAR }, // POINTER_VSIZEBAR
+ { 0, 0, SAL_RESID_POINTER_HAND }, // POINTER_HAND
+ { 0, 0, SAL_RESID_POINTER_REFHAND }, // POINTER_REFHAND
+ { 0, 0, SAL_RESID_POINTER_PEN }, // POINTER_PEN
+ { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY
+ { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL
+ { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE
+ { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR
+ { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR
+ { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR
+ { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK
+ { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP
+ { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT
+ { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT
+ { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA
+ { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA
+ { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA
+ { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK
+ { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK
+ { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE
+ { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE
+ { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE
+ { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK
+ { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK
+ { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES
+ { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES
+ { 0, SPTR_ILLEGAL, 0 }, // POINTER_NOTALLOWED
+ { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE
+ { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT
+ { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON
+ { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER
+ { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC
+ { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE
+ { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT
+ { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE
+ { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND
+ { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT
+ { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT
+ { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION
+ { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART
+ { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE
+ { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL
+ { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW
+ { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD
+ { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN
+ { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED
+ { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE
+ { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE } // POINTER_AUTOSCROLL_NSWE
+ };
+
+#if POINTER_COUNT != 85
+#error New Pointer must be defined!
+#endif
+
+ // Mousepointer loaded ?
+ if ( !aImplPtrTab[ePointerStyle].mhPointer )
+ {
+ if ( aImplPtrTab[ePointerStyle].mnOwnId )
+ aImplPtrTab[ePointerStyle].mhPointer = ImplLoadPointer( aImplPtrTab[ePointerStyle].mnOwnId );
+ else
+ aImplPtrTab[ePointerStyle].mhPointer = WinQuerySysPointer( HWND_DESKTOP, aImplPtrTab[ePointerStyle].mnSysId, FALSE );
+ }
+
+ // Unterscheidet sich der Mauspointer, dann den neuen setzen
+ if ( maFrameData.mhPointer != aImplPtrTab[ePointerStyle].mhPointer )
+ {
+ maFrameData.mhPointer = aImplPtrTab[ePointerStyle].mhPointer;
+ WinSetPointer( HWND_DESKTOP, maFrameData.mhPointer );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::CaptureMouse( BOOL bCapture )
+{
+ if ( bCapture )
+ WinSetCapture( HWND_DESKTOP, maFrameData.mhWndClient );
+ else
+ WinSetCapture( HWND_DESKTOP, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetPointerPos( long nX, long nY )
+{
+ POINTL aPt;
+ aPt.x = nX;
+ aPt.y = maFrameData.mnHeight - nY - 1; // convert sal coords to sys
+ WinMapWindowPoints( maFrameData.mhWndClient, HWND_DESKTOP, &aPt, 1 );
+ WinSetPointerPos( HWND_DESKTOP, aPt.x, aPt.y );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Flush()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Sync()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetInputContext( SalInputContext* pContext )
+{
+#ifdef ENABLE_IME
+ SalIMEData* pIMEData = GetSalIMEData();
+ if ( pIMEData )
+ {
+ HWND hWnd = maFrameData.mhWndClient;
+ HIMI hIMI = 0;
+ pIMEData->mpGetIME( hWnd, &hIMI );
+ if ( hIMI )
+ {
+ PM_ULONG nInputMode;
+ PM_ULONG nConversionMode;
+ if ( 0 == pIMEData->mpQueryIMEMode( hIMI, &nInputMode, &nConversionMode ) )
+ {
+ if ( pContext->mnOptions & SAL_INPUTCONTEXT_TEXT )
+ {
+ nInputMode &= ~IMI_IM_IME_DISABLE;
+ if ( pContext->mnOptions & SAL_INPUTCONTEXT_EXTTEXTINPUT_OFF )
+ nInputMode &= ~IMI_IM_IME_ON;
+// !!! Da derzeit ueber das OS2-IME-UI der IME-Mode nicht einschaltbar ist !!!
+// if ( SAL_INPUTCONTEXT_EXTTEXTINPUT_ON )
+ nInputMode |= IMI_IM_IME_ON;
+ }
+ else
+ nInputMode |= IMI_IM_IME_DISABLE;
+ pIMEData->mpSetIMEMode( hIMI, nInputMode, nConversionMode );
+ }
+
+ pIMEData->mpReleaseIME( hWnd, hIMI );
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::UpdateExtTextInputArea()
+{
+#ifdef ENABLE_IME
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::EndExtTextInput( USHORT nFlags )
+{
+#ifdef ENABLE_IME
+ SalIMEData* pIMEData = GetSalIMEData();
+ if ( pIMEData )
+ {
+ HWND hWnd = maFrameData.mhWndClient;
+ HIMI hIMI = 0;
+ pIMEData->mpGetIME( hWnd, &hIMI );
+ if ( hIMI )
+ {
+ PM_ULONG nIndex;
+ if ( nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE )
+ nIndex = CNV_COMPLETE;
+ else
+ nIndex = CNV_CANCEL;
+
+ pIMEData->mpRequestIME( hIMI, REQ_CONVERSIONSTRING, nIndex, 0 );
+ pIMEData->mpReleaseIME( hWnd, hIMI );
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalFrame::GetKeyName( USHORT nCode )
+{
+ if ( eImplKeyboardLanguage == LANGUAGE_DONTKNOW )
+ eImplKeyboardLanguage = GetSystemLanguage();
+
+ XubString aKeyCode;
+ XubString aCode;
+ const char** pLangTab = ImplGetLangTab( eImplKeyboardLanguage );
+
+ if ( nCode & KEY_SHIFT )
+ aKeyCode = pLangTab[LSTR_KEY_SHIFT];
+
+ if ( nCode & KEY_MOD1 )
+ {
+ if ( !aKeyCode )
+ aKeyCode = pLangTab[LSTR_KEY_CTRL];
+ else
+ {
+ aKeyCode += '+';
+ aKeyCode += pLangTab[LSTR_KEY_CTRL];
+ }
+ }
+
+ if ( nCode & KEY_MOD2 )
+ {
+ if ( !aKeyCode )
+ aKeyCode = pLangTab[LSTR_KEY_ALT];
+ else
+ {
+ aKeyCode += '+';
+ aKeyCode += pLangTab[LSTR_KEY_ALT];
+ }
+ }
+
+ USHORT nKeyCode = nCode & 0x0FFF;
+ switch ( nKeyCode )
+ {
+ case KEY_0:
+ case KEY_1:
+ case KEY_2:
+ case KEY_3:
+ case KEY_4:
+ case KEY_5:
+ case KEY_6:
+ case KEY_7:
+ case KEY_8:
+ case KEY_9:
+ aCode += (char)('0' + (nKeyCode - KEY_0));
+ break;
+
+ case KEY_A:
+ case KEY_B:
+ case KEY_C:
+ case KEY_D:
+ case KEY_E:
+ case KEY_F:
+ case KEY_G:
+ case KEY_H:
+ case KEY_I:
+ case KEY_J:
+ case KEY_K:
+ case KEY_L:
+ case KEY_M:
+ case KEY_N:
+ case KEY_O:
+ case KEY_P:
+ case KEY_Q:
+ case KEY_R:
+ case KEY_S:
+ case KEY_T:
+ case KEY_U:
+ case KEY_V:
+ case KEY_W:
+ case KEY_X:
+ case KEY_Y:
+ case KEY_Z:
+ aCode += (char)('A' + (nKeyCode - KEY_A));
+ break;
+
+ case KEY_F1:
+ case KEY_F2:
+ case KEY_F3:
+ case KEY_F4:
+ case KEY_F5:
+ case KEY_F6:
+ case KEY_F7:
+ case KEY_F8:
+ case KEY_F9:
+ case KEY_F10:
+ case KEY_F11:
+ case KEY_F12:
+ case KEY_F13:
+ case KEY_F14:
+ case KEY_F15:
+ case KEY_F16:
+ case KEY_F17:
+ case KEY_F18:
+ case KEY_F19:
+ case KEY_F20:
+ case KEY_F21:
+ case KEY_F22:
+ case KEY_F23:
+ case KEY_F24:
+ case KEY_F25:
+ case KEY_F26:
+ aCode += 'F';
+ aCode += (USHORT)nKeyCode - KEY_F1 + 1;
+ break;
+
+ case KEY_DOWN:
+ aCode = pLangTab[LSTR_KEY_DOWN];
+ break;
+ case KEY_UP:
+ aCode = pLangTab[LSTR_KEY_UP];
+ break;
+ case KEY_LEFT:
+ aCode = pLangTab[LSTR_KEY_LEFT];
+ break;
+ case KEY_RIGHT:
+ aCode = pLangTab[LSTR_KEY_RIGHT];
+ break;
+ case KEY_HOME:
+ aCode = pLangTab[LSTR_KEY_HOME];
+ break;
+ case KEY_END:
+ aCode = pLangTab[LSTR_KEY_END];
+ break;
+ case KEY_PAGEUP:
+ aCode = pLangTab[LSTR_KEY_PAGEUP];
+ break;
+ case KEY_PAGEDOWN:
+ aCode = pLangTab[LSTR_KEY_PAGEDOWN];
+ break;
+ case KEY_RETURN:
+ aCode = pLangTab[LSTR_KEY_RETURN];
+ break;
+ case KEY_ESCAPE:
+ aCode = pLangTab[LSTR_KEY_ESC];
+ break;
+ case KEY_TAB:
+ aCode = pLangTab[LSTR_KEY_TAB];
+ break;
+ case KEY_BACKSPACE:
+ aCode = pLangTab[LSTR_KEY_BACKSPACE];
+ break;
+ case KEY_SPACE:
+ aCode = pLangTab[LSTR_KEY_SPACE];
+ break;
+ case KEY_INSERT:
+ aCode = pLangTab[LSTR_KEY_INSERT];
+ break;
+ case KEY_DELETE:
+ aCode = pLangTab[LSTR_KEY_DELETE];
+ break;
+
+ case KEY_ADD:
+ aCode += '+';
+ break;
+ case KEY_SUBTRACT:
+ aCode += '-';
+ break;
+ case KEY_MULTIPLY:
+ aCode += '*';
+ break;
+ case KEY_DIVIDE:
+ aCode += '/';
+ break;
+ case KEY_POINT:
+ aCode += '.';
+ break;
+ case KEY_COMMA:
+ aCode += ',';
+ break;
+ case KEY_LESS:
+ aCode += '<';
+ break;
+ case KEY_GREATER:
+ aCode += '>';
+ break;
+ case KEY_EQUAL:
+ aCode += '=';
+ break;
+ }
+
+ if ( aCode.Len() )
+ {
+ if ( !aKeyCode )
+ aKeyCode = aCode;
+ else
+ {
+ aKeyCode += '+';
+ aKeyCode += aCode;
+ }
+ }
+
+ return aKeyCode;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode )
+{
+ return GetKeyName( nKeyCode );
+}
+
+// -----------------------------------------------------------------------
+
+inline long ImplOS2ColorToSal( long nOS2Color )
+{
+ return MAKE_SALCOLOR( (BYTE)( nOS2Color>>16), (BYTE)(nOS2Color>>8), (BYTE)nOS2Color );
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplMouseSysValueToSAL( int iSysValue, USHORT& rCode, USHORT& rClicks, BOOL& rDown )
+{
+ LONG lValue = WinQuerySysValue( HWND_DESKTOP, iSysValue );
+
+ rCode = 0;
+ rClicks = 1;
+ rDown = TRUE;
+
+ switch ( lValue & 0xFFFF )
+ {
+ case WM_BUTTON1UP:
+ case WM_BUTTON1CLICK:
+ rCode = MOUSE_LEFT;
+ rDown = FALSE;
+ break;
+ case WM_BUTTON1DOWN:
+ case WM_BUTTON1MOTIONSTART:
+ rCode = MOUSE_LEFT;
+ break;
+ case WM_BUTTON1DBLCLK:
+ rCode = MOUSE_LEFT;
+ rClicks = 2;
+ break;
+
+ case WM_BUTTON2UP:
+ case WM_BUTTON2CLICK:
+ rCode = MOUSE_RIGHT;
+ rDown = FALSE;
+ break;
+ case WM_BUTTON2DOWN:
+ case WM_BUTTON2MOTIONSTART:
+ rCode = MOUSE_RIGHT;
+ break;
+ case WM_BUTTON2DBLCLK:
+ rCode = MOUSE_RIGHT;
+ rClicks = 2;
+ break;
+
+ case WM_BUTTON3UP:
+ case WM_BUTTON3CLICK:
+ rCode = MOUSE_MIDDLE;
+ rDown = FALSE;
+ break;
+ case WM_BUTTON3DOWN:
+ case WM_BUTTON3MOTIONSTART:
+ rCode = MOUSE_MIDDLE;
+ break;
+ case WM_BUTTON3DBLCLK:
+ rCode = MOUSE_MIDDLE;
+ rClicks = 2;
+ break;
+ }
+
+ if ( !rCode )
+ return FALSE;
+
+ lValue = (lValue & 0xFFFF0000) >> 16;
+ if ( lValue != 0xFFFF )
+ {
+ if ( lValue & KC_SHIFT )
+ rCode |= KEY_SHIFT;
+ if ( lValue & KC_CTRL )
+ rCode |= KEY_MOD1;
+ if ( lValue & KC_ALT )
+ rCode |= KEY_MOD2;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplSalIsSameColor( const Color& rColor1, const Color& rColor2 )
+{
+ ULONG nWrong = 0;
+ nWrong += Abs( (short)rColor1.GetRed()-(short)rColor2.GetRed() );
+ nWrong += Abs( (short)rColor1.GetGreen()-(short)rColor2.GetGreen() );
+ nWrong += Abs( (short)rColor1.GetBlue()-(short)rColor2.GetBlue() );
+ return (nWrong < 30);
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplOS2NameFontToVCLFont( const char* pFontName, Font& rFont )
+{
+ char aNumBuf[10];
+ int nNumBufLen = 0;
+
+ while ( *pFontName && (*pFontName != '.') &&
+ (nNumBufLen < sizeof(aNumBuf)-1) )
+ {
+ aNumBuf[nNumBufLen] = *pFontName;
+ nNumBufLen++;
+ pFontName++;
+ }
+ aNumBuf[nNumBufLen] = '\0';
+
+ pFontName++;
+ while ( *pFontName == ' ' )
+ pFontName++;
+
+ int nFontHeight = atoi( aNumBuf );
+ int nFontNameLen = strlen( pFontName );
+ if ( nFontHeight && nFontNameLen )
+ {
+ rFont.SetName( pFontName );
+ rFont.SetSize( Size( 0, nFontHeight ) );
+ rFont.SetFamily( FAMILY_DONTKNOW );
+ rFont.SetWeight( WEIGHT_NORMAL );
+ rFont.SetItalic( ITALIC_NONE );
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::UpdateSettings( AllSettings& rSettings )
+{
+ static char aControlPanel[] = "PM_ControlPanel";
+ static char aSystemFonts[] = "PM_SystemFonts";
+ char aDummyStr[] = "";
+
+ // --- Mouse setting ---
+ USHORT nCode;
+ USHORT nClicks;
+ BOOL bDown;
+ MouseSettings aMouseSettings = rSettings.GetMouseSettings();
+ aMouseSettings.SetDoubleClickTime( WinQuerySysValue( HWND_DESKTOP, SV_DBLCLKTIME ) );
+ if ( ImplMouseSysValueToSAL( SV_BEGINDRAG, nCode, nClicks, bDown ) )
+ aMouseSettings.SetStartDragCode( nCode );
+ if ( ImplMouseSysValueToSAL( SV_CONTEXTMENU, nCode, nClicks, bDown ) )
+ {
+ aMouseSettings.SetContextMenuCode( nCode );
+ aMouseSettings.SetContextMenuClicks( nClicks );
+ aMouseSettings.SetContextMenuDown( bDown );
+ }
+ aMouseSettings.SetButtonStartRepeat( WinQuerySysValue( HWND_DESKTOP, SV_FIRSTSCROLLRATE ) );
+ aMouseSettings.SetButtonRepeat( WinQuerySysValue( HWND_DESKTOP, SV_SCROLLRATE ) );
+ rSettings.SetMouseSettings( aMouseSettings );
+
+ // --- Style settings ---
+ StyleSettings aStyleSettings = rSettings.GetStyleSettings();
+ BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0;
+
+ // General settings
+ LONG nDisplayTime = PrfQueryProfileInt( HINI_PROFILE, (PSZ)aControlPanel, (PSZ)"LogoDisplayTime", -1 );
+ ULONG nSalDisplayTime;
+ if ( nDisplayTime < 0 )
+ nSalDisplayTime = LOGO_DISPLAYTIME_STARTTIME;
+ else if ( !nDisplayTime )
+ nSalDisplayTime = LOGO_DISPLAYTIME_NOLOGO;
+ else
+ nSalDisplayTime = (ULONG)nDisplayTime;
+ aStyleSettings.SetLogoDisplayTime( nSalDisplayTime );
+
+ aStyleSettings.SetCursorBlinkTime( WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE ) );
+ ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions();
+ if ( WinQuerySysValue( HWND_DESKTOP, SV_FULLWINDOWDRAG ) )
+ nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT;
+ else
+ nDragFullOptions &= ~(DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT);
+ aStyleSettings.SetDragFullOptions( nDragFullOptions );
+
+ // Size settings
+ aStyleSettings.SetScrollBarSize( WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL ) );
+ if ( bCompBorder )
+ {
+ aStyleSettings.SetTitleHeight( WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) );
+ }
+
+ // Color settings
+ if ( bCompBorder )
+ {
+ aStyleSettings.SetFaceColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) );
+ aStyleSettings.SetLightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0 ) ) );
+ aStyleSettings.SetLightBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) );
+ aStyleSettings.SetShadowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0 ) ) );
+ aStyleSettings.SetDarkShadowColor( Color( COL_BLACK ) );
+ aStyleSettings.SetDialogColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0 ) ) );
+ aStyleSettings.SetButtonTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) );
+ aStyleSettings.SetActiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLE, 0 ) ) );
+ aStyleSettings.SetActiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLETEXT, 0 ) ) );
+ aStyleSettings.SetActiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVEBORDER, 0 ) ) );
+ aStyleSettings.SetDeactiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLE, 0 ) ) );
+ aStyleSettings.SetDeactiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLETEXT, 0 ) ) );
+ aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) );
+ aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) );
+ aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) );
+ }
+ aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() );
+ aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() );
+ aStyleSettings.SetGroupTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWSTATICTEXT, 0 ) ) );
+ aStyleSettings.SetLabelTextColor( aStyleSettings.GetGroupTextColor() );
+ aStyleSettings.SetInfoTextColor( aStyleSettings.GetGroupTextColor() );
+ aStyleSettings.SetWindowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOW, 0 ) ) );
+ aStyleSettings.SetWindowTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWTEXT, 0 ) ) );
+ aStyleSettings.SetFieldColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ENTRYFIELD, 0 ) ) );
+ aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() );
+ aStyleSettings.SetDisableColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUDISABLEDTEXT, 0 ) ) );
+ aStyleSettings.SetHighlightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEBACKGROUND, 0 ) ) );
+ aStyleSettings.SetHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEFOREGROUND, 0 ) ) );
+ Color aMenuHighColor = ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITEBGND, 0 ) );
+ if ( ImplSalIsSameColor( aMenuHighColor, aStyleSettings.GetMenuColor() ) )
+ {
+ if ( bCompBorder )
+ {
+ aStyleSettings.SetMenuHighlightColor( Color( COL_BLUE ) );
+ aStyleSettings.SetMenuHighlightTextColor( Color( COL_WHITE ) );
+ }
+ }
+ else
+ {
+ aStyleSettings.SetMenuHighlightColor( aMenuHighColor );
+ aStyleSettings.SetMenuHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITE, 0 ) ) );
+ }
+ // Checked-Color berechnen
+ Color aColor1 = aStyleSettings.GetFaceColor();
+ Color aColor2 = aStyleSettings.GetLightColor();
+ BYTE nRed = (BYTE)(((USHORT)aColor1.GetRed() + (USHORT)aColor2.GetRed())/2);
+ BYTE nGreen = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2);
+ BYTE nBlue = (BYTE)(((USHORT)aColor1.GetBlue() + (USHORT)aColor2.GetBlue())/2);
+ aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) );
+
+ // Fonts updaten
+ Font aFont;
+ char aFontNameBuf[255];
+ aFont = aStyleSettings.GetMenuFont();
+ if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"Menus", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 )
+ {
+ if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) )
+ aStyleSettings.SetMenuFont( aFont );
+ }
+ aFont = aStyleSettings.GetIconFont();
+ if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"IconText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 )
+ {
+ if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) )
+ aStyleSettings.SetIconFont( aFont );
+ }
+ aFont = aStyleSettings.GetTitleFont();
+ if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowTitles", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 )
+ {
+ if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) )
+ {
+ aStyleSettings.SetTitleFont( aFont );
+ aStyleSettings.SetFloatTitleFont( aFont );
+ }
+ }
+ aFont = aStyleSettings.GetAppFont();
+ if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 )
+ {
+ if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) )
+ {
+ Font aHelpFont = aFont;
+ aHelpFont.SetName( "Helv;WarpSans" );
+ aHelpFont.SetSize( Size( 0, 8 ) );
+ aHelpFont.SetWeight( WEIGHT_NORMAL );
+ aHelpFont.SetItalic( ITALIC_NONE );
+ aStyleSettings.SetHelpFont( aHelpFont );
+
+ // Bei System mappen wir direkt auf WarpSans/Helv, da diese
+ // unserer Meinung besser aussehen
+ if ( aFont.GetName().Search( "System" ) != STRING_NOTFOUND )
+ {
+ XubString aFontName = aFont.GetName();
+ aFontName.Insert( "WarpSans;Helv;" );
+ aFont.SetName( aFontName );
+ aFont.SetSize( Size( 0, 9 ) );
+ }
+ aStyleSettings.SetAppFont( aFont );
+ aStyleSettings.SetToolFont( aFont );
+ aStyleSettings.SetLabelFont( aFont );
+ aStyleSettings.SetInfoFont( aFont );
+ aStyleSettings.SetRadioCheckFont( aFont );
+ aStyleSettings.SetPushButtonFont( aFont );
+ aStyleSettings.SetFieldFont( aFont );
+ aStyleSettings.SetGroupFont( aFont );
+ }
+ }
+
+ rSettings.SetStyleSettings( aStyleSettings );
+}
+
+// -----------------------------------------------------------------------
+
+const SystemEnvData* SalFrame::GetSystemData() const
+{
+ return &maFrameData.maSysData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Beep( SoundType eSoundType )
+{
+ static PM_ULONG aImplSoundTab[5] =
+ {
+ WA_NOTE, // SOUND_DEFAULT
+ WA_NOTE, // SOUND_INFO
+ WA_WARNING, // SOUND_WARNING
+ WA_ERROR, // SOUND_ERROR
+ WA_NOTE // SOUND_QUERY
+ };
+
+#if SOUND_COUNT != 5
+#error New Sound must be defined!
+#endif
+
+ WinAlarm( HWND_DESKTOP, aImplSoundTab[eSoundType] );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetCallback( void* pInst, SALFRAMEPROC pProc )
+{
+ if( pProc == NULL )
+ maFrameData.mpProc = ImplSalCallbackDummy;
+ else
+ {
+ maFrameData.mpInst = pInst;
+ maFrameData.mpProc = pProc;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void SalTestMouseLeave()
+{
+ SalData* pSalData = GetSalData();
+
+ if ( pSalData->mhWantLeaveMsg && !::WinQueryCapture( HWND_DESKTOP ) )
+ {
+ POINTL aPt;
+ WinQueryPointerPos( HWND_DESKTOP, &aPt );
+ if ( pSalData->mhWantLeaveMsg != WinWindowFromPoint( HWND_DESKTOP, &aPt, TRUE ) )
+ WinSendMsg( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MPFROM2SHORT( aPt.x, aPt.y ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleMouseMsg( SalFrame* pFrame,
+ UINT nMsg, MPARAM nMP1, MPARAM nMP2 )
+{
+ SalMouseEvent aMouseEvt;
+ long nRet;
+ USHORT nEvent;
+ BOOL bRetTRUE = FALSE;
+ BOOL bCall = TRUE;
+ BOOL bActivate = FALSE;
+ USHORT nFlags = SHORT2FROMMP( nMP2 );
+
+ aMouseEvt.mnX = (short)SHORT1FROMMP( nMP1 );
+ aMouseEvt.mnY = pFrame->maFrameData.mnHeight - (short)SHORT2FROMMP( nMP1 ) - 1;
+ aMouseEvt.mnCode = 0;
+ aMouseEvt.mnTime = WinQueryMsgTime( pFrame->maFrameData.mhAB );
+
+ // MausModus feststellen und setzen
+ if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_LEFT;
+ if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_RIGHT;
+ if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_MIDDLE;
+ // Modifier-Tasten setzen
+ if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_SHIFT;
+ if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_MOD1;
+ if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_MOD2;
+
+ switch ( nMsg )
+ {
+ case WM_MOUSEMOVE:
+ {
+ SalData* pSalData = GetSalData();
+
+ // Da bei Druecken von Modifier-Tasten die MouseEvents
+ // nicht zusammengefast werden (da diese durch KeyEvents
+ // unterbrochen werden), machen wir dieses hier selber
+ if ( aMouseEvt.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) )
+ {
+ QMSG aTempMsg;
+ if ( WinPeekMsg( pSalData->mhAB, &aTempMsg,
+ pFrame->maFrameData.mhWndClient,
+ WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) )
+ {
+ if ( (aTempMsg.msg == WM_MOUSEMOVE) &&
+ (aTempMsg.mp2 == nMP2) )
+ return 1;
+ }
+ }
+
+ // Test for MouseLeave
+ if ( pSalData->mhWantLeaveMsg &&
+ (pSalData->mhWantLeaveMsg != pFrame->maFrameData.mhWndClient) )
+ {
+ POINTL aMousePoint;
+ WinQueryMsgPos( pFrame->maFrameData.mhAB, &aMousePoint );
+ WinSendMsg( pSalData->mhWantLeaveMsg,
+ SAL_MSG_MOUSELEAVE,
+ 0, MPFROM2SHORT( aMousePoint.x, aMousePoint.y ) );
+ }
+ pSalData->mhWantLeaveMsg = pFrame->maFrameData.mhWndClient;
+ // Start MouseLeave-Timer
+ if ( !pSalData->mpMouseLeaveTimer )
+ {
+ pSalData->mpMouseLeaveTimer = new AutoTimer;
+ pSalData->mpMouseLeaveTimer->SetTimeout( SAL_MOUSELEAVE_TIMEOUT );
+ pSalData->mpMouseLeaveTimer->Start();
+ // We dont need to set a timeout handler, because we test
+ // for mouseleave in the timeout callback
+ }
+ aMouseEvt.mnButton = 0;
+ nEvent = SALEVENT_MOUSEMOVE;
+ }
+ break;
+
+ case SAL_MSG_MOUSELEAVE:
+ {
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mhWantLeaveMsg == pFrame->maFrameData.mhWndClient )
+ {
+ pSalData->mhWantLeaveMsg = 0;
+ if ( pSalData->mpMouseLeaveTimer )
+ {
+ delete pSalData->mpMouseLeaveTimer;
+ pSalData->mpMouseLeaveTimer = NULL;
+ }
+
+ // Mouse-Coordinaates are relativ to the screen
+ POINTL aPt;
+ aPt.x = (short)SHORT1FROMMP( nMP2 );
+ aPt.y = (short)SHORT2FROMMP( nMP2 );
+ WinMapWindowPoints( HWND_DESKTOP, pFrame->maFrameData.mhWndClient, &aPt, 1 );
+ aPt.y = pFrame->maFrameData.mnHeight - aPt.y - 1;
+ aMouseEvt.mnX = aPt.x;
+ aMouseEvt.mnY = aPt.y;
+ aMouseEvt.mnButton = 0;
+ nEvent = SALEVENT_MOUSELEAVE;
+ }
+ else
+ bCall = FALSE;
+ }
+ break;
+
+ case WM_BUTTON1DBLCLK:
+ case WM_BUTTON1DOWN:
+ aMouseEvt.mnButton = MOUSE_LEFT;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ bActivate = TRUE;
+ break;
+
+ case WM_BUTTON2DBLCLK:
+ case WM_BUTTON2DOWN:
+ aMouseEvt.mnButton = MOUSE_RIGHT;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ bActivate = TRUE;
+ break;
+
+ case WM_BUTTON3DBLCLK:
+ case WM_BUTTON3DOWN:
+ aMouseEvt.mnButton = MOUSE_MIDDLE;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ bActivate = TRUE;
+ break;
+
+ case WM_BUTTON1UP:
+ aMouseEvt.mnButton = MOUSE_LEFT;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+
+ case WM_BUTTON2UP:
+ aMouseEvt.mnButton = MOUSE_RIGHT;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+
+ case WM_BUTTON3UP:
+ aMouseEvt.mnButton = MOUSE_MIDDLE;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+ }
+
+ // Vorsichtshalber machen wir dies hier noch und gehen ueber
+ // den neuen SAL-Event. Eigentlich muesste dies immer durch
+ // den unabhaengigen Teil ausgeloest werden!
+ if ( bActivate )
+ {
+ SalMouseActivateEvent aMouseActivateEvt;
+ aMouseActivateEvt.mnX = aMouseEvt.mnX;
+ aMouseActivateEvt.mnY = aMouseEvt.mnY;
+ if ( !pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_MOUSEACTIVATE, &aMouseActivateEvt ) )
+ WinSetWindowPos( pFrame->maFrameData.mhWndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER );
+ else
+ bRetTRUE = TRUE;
+ }
+
+ if ( bCall )
+ {
+ if ( nEvent == SALEVENT_MOUSEBUTTONDOWN )
+ WinUpdateWindow( pFrame->maFrameData.mhWndClient );
+
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nEvent, &aMouseEvt );
+ if ( nMsg == WM_MOUSEMOVE )
+ {
+ WinSetPointer( HWND_DESKTOP, pFrame->maFrameData.mhPointer );
+ nRet = TRUE;
+ }
+ }
+ else
+ nRet = 0;
+
+ if ( bRetTRUE )
+ nRet = TRUE;
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplConvertKey( MPARAM aMP1, MPARAM aMP2, USHORT& rSVCode, xub_Unicode& rSVCharCode )
+{
+ USHORT nKeyFlags = SHORT1FROMMP( aMP1 );
+ UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 );
+ USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 );
+
+ // Ist virtueller KeyCode gesetzt und befindet sich der KeyCode in der
+ // Tabelle, dann mappen
+ if ( (nKeyFlags & KC_VIRTUALKEY) && (nKeyCode < KEY_TAB_SIZE) )
+ rSVCode = TranslateKey[nKeyCode];
+
+ // Ist Character-Code gesetzt
+ // !!! Bei CTRL/ALT ist KC_CHAR nicht gesetzt, jedoch moechten wir
+ // !!! dann auch einen CharCode und machen die Behandlung deshalb
+ // !!! selber
+ if ( (nKeyFlags & KC_CHAR) || (nKeyFlags & KC_CTRL) || (nKeyFlags & KC_ALT) )
+ rSVCharCode = (xub_Unicode)nCharCode;
+
+ // Bei KeyUp muessen wir ein paar andere Ausnahmen machen, da
+ // uns in den meisten Faellen kein KeyCode geliefert wird, aber
+ // dafuer ein CharCode, wo jedoch nicht KC_CHAR gesetzt ist.
+ if ( nKeyFlags & KC_KEYUP )
+ {
+ if ( !rSVCode )
+ {
+ // Hier nur CharCode zuweisen, der KeyCode wird im unteren
+ // Teil dieser Function dann aus dem CharCode ermittelt
+ if ( !rSVCharCode && nCharCode )
+ rSVCharCode = (xub_Unicode)nCharCode;
+ }
+ }
+
+ // Wenn kein KeyCode ermittelt werden konnte, versuchen wir aus dem
+ // CharCode einen zu erzeugen
+ if ( !rSVCode && rSVCharCode )
+ {
+ // Bei 0-9, a-z und A-Z auch KeyCode setzen
+ if ( (rSVCharCode >= '0') && (rSVCharCode <= '9') && (!rSVCode || !(nKeyFlags & KC_SHIFT)) )
+ rSVCode = KEY_0 + (rSVCharCode-'0');
+ else if ( (rSVCharCode >= 'a') && (rSVCharCode <= 'z') )
+ rSVCode = KEY_A + (rSVCharCode-'a');
+ else if ( (rSVCharCode >= 'A') && (rSVCharCode <= 'Z') )
+ rSVCode = KEY_A + (rSVCharCode-'A');
+ else
+ {
+ switch ( rSVCharCode )
+ {
+ case '+':
+ rSVCode = KEY_ADD;
+ break;
+ case '-':
+ rSVCode = KEY_SUBTRACT;
+ break;
+ case '*':
+ rSVCode = KEY_MULTIPLY;
+ break;
+ case '/':
+ rSVCode = KEY_DIVIDE;
+ break;
+ case '.':
+ rSVCode = KEY_POINT;
+ break;
+ case ',':
+ rSVCode = KEY_COMMA;
+ break;
+ case '<':
+ rSVCode = KEY_LESS;
+ break;
+ case '>':
+ rSVCode = KEY_GREATER;
+ break;
+ case '=':
+ rSVCode = KEY_EQUAL;
+ break;
+ }
+ }
+ }
+
+ // "Numlock-Hack": we want to get correct keycodes from the numpad
+ if ( (rSVCharCode >= '0') && (rSVCharCode <= '9') )
+ rSVCode = KEY_0 + (rSVCharCode-'0');
+ if ( rSVCharCode == ',' )
+ rSVCode = KEY_COMMA;
+ if ( rSVCharCode == '.' )
+ rSVCode = KEY_POINT;
+
+ if ( nKeyFlags & KC_CTRL )
+ {
+ // Ist CTRL-Taste gedrueckt, dann Char-Code korrigieren
+ if ( (rSVCharCode >= 'a') && (rSVCharCode <= 'z') )
+ rSVCharCode -= ('a' - 1);
+
+ // Ist CTRL-Taste gedrueckt, dann Char-Code auf 0 setzen, wenn
+ // der CharCode nicht < 32 ist
+ if ( ((unsigned char)rSVCharCode) >= 32 )
+ rSVCharCode = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleKeyMsg( SalFrame* pFrame,
+ UINT nMsg, MPARAM nMP1, MPARAM nMP2 )
+{
+ static USHORT nLastOS2KeyChar = 0;
+ static xub_Unicode nLastChar = 0;
+ USHORT nRepeat = CHAR3FROMMP( nMP1 ) - 1;
+ SHORT nFlags = SHORT1FROMMP( nMP1 );
+ USHORT nModCode = 0;
+ USHORT nSVCode = 0;
+ USHORT nOS2KeyCode = (UCHAR)SHORT2FROMMP( nMP2 );
+ xub_Unicode nSVCharCode = 0;
+ long nRet = 0;
+
+ // determine modifiers
+ if ( nFlags & KC_SHIFT )
+ nModCode |= KEY_SHIFT;
+ if ( nFlags & KC_CTRL )
+ nModCode |= KEY_MOD1;
+ if ( nFlags & KC_ALT )
+ {
+ nModCode |= KEY_MOD2;
+ // Nur wenn nicht Control und kein auswertbarer CharCode
+ // Wegen AltGr (vorallem wegen 122-Tastaturen auch KC_CHAR testen)
+ if ( !(nModCode & KEY_MOD1) && !(nFlags & KC_CHAR) )
+ nModCode |= KEY_CONTROLMOD;
+ }
+
+ // Bei Shift, Control und Alt schicken wir einen KeyModChange-Event
+ if ( (nOS2KeyCode == VK_SHIFT) || (nOS2KeyCode == VK_CTRL) ||
+ (nOS2KeyCode == VK_ALT) || (nOS2KeyCode == VK_ALTGRAF) )
+ {
+ SalKeyModEvent aModEvt;
+ aModEvt.mnTime = WinQueryMsgTime( pFrame->maFrameData.mhAB );
+ aModEvt.mnCode = nModCode;
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYMODCHANGE, &aModEvt );
+ }
+ else
+ {
+ ImplConvertKey( nMP1, nMP2, nSVCode, nSVCharCode );
+
+ // Fuer Java muessen wir bei KeyUp einen CharCode liefern
+ if ( nFlags & KC_KEYUP )
+ {
+ if ( !nSVCharCode )
+ {
+ if ( nLastOS2KeyChar == nOS2KeyCode )
+ {
+ nSVCharCode = nLastChar;
+ nLastOS2KeyChar = 0;
+ nLastChar = 0;
+ }
+ }
+ else
+ {
+ nLastOS2KeyChar = 0;
+ nLastChar = 0;
+ }
+ }
+ else
+ {
+ nLastOS2KeyChar = nOS2KeyCode;
+ nLastChar = nSVCharCode;
+ }
+
+ if ( nSVCode || nSVCharCode )
+ {
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnCode = nSVCode;
+ aKeyEvt.mnTime = WinQueryMsgTime( pFrame->maFrameData.mhAB );
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnCharCode = nSVCharCode;
+ aKeyEvt.mnRepeat = nRepeat;
+
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ (nFlags & KC_KEYUP) ? SALEVENT_KEYUP : SALEVENT_KEYINPUT,
+ &aKeyEvt );
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandlePaintMsg( SalFrame* pFrame )
+{
+ HPS hPS;
+ RECTL aRect;
+
+ hPS = WinBeginPaint( pFrame->maFrameData.mhWndClient, NULLHANDLE, &aRect );
+
+ // convert rectangle sys -> sal
+ aRect.yTop = pFrame->maFrameData.mnHeight - aRect.yTop;
+ aRect.yBottom = pFrame->maFrameData.mnHeight - aRect.yBottom;
+
+ // Paint
+ SalPaintEvent aPEvt;
+ aPEvt.mnBoundX = aRect.xLeft;
+ aPEvt.mnBoundY = aRect.yTop;
+ aPEvt.mnBoundWidth = aRect.xRight - aRect.xLeft;
+ aPEvt.mnBoundHeight = aRect.yBottom - aRect.yTop;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_PAINT, &aPEvt );
+
+ WinEndPaint( hPS );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleMoveMsg( SalFrame* pFrame )
+{
+ pFrame->maFrameData.mbDefPos = FALSE;
+
+ // Gegen moegliche Rekursionen sichern
+ if ( !pFrame->maFrameData.mbInMoveMsg )
+ {
+ // Fenster im FullScreenModus wieder einpassen
+ pFrame->maFrameData.mbInMoveMsg = TRUE;
+ if ( pFrame->maFrameData.mbFullScreen )
+ ImplSalFrameFullScreenPos( pFrame );
+ pFrame->maFrameData.mbInMoveMsg = FALSE;
+ }
+
+ // Status merken
+ ImplSaveFrameState( pFrame );
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleSizeMsg( SalFrame* pFrame, MPARAM nMP2 )
+{
+ pFrame->maFrameData.mbDefPos = FALSE;
+ pFrame->maFrameData.mnWidth = (short)SHORT1FROMMP( nMP2 );
+ pFrame->maFrameData.mnHeight = (short)SHORT2FROMMP( nMP2 );
+ if ( pFrame->maFrameData.mpGraphics )
+ pFrame->maFrameData.mpGraphics->maGraphicsData.mnHeight = (int)SHORT2FROMMP(nMP2);
+ // Status merken
+ ImplSaveFrameState( pFrame );
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_RESIZE, 0 );
+ if ( WinIsWindowVisible( pFrame->maFrameData.mhWndFrame ) && !pFrame->maFrameData.mbInShow )
+ WinUpdateWindow( pFrame->maFrameData.mhWndClient );
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleShowMsg( SalFrame* pFrame, MPARAM nMP1 )
+{
+ if ( !pFrame->maFrameData.mbInShow )
+ {
+ // Wenn wir von aussen gehidet/geshowed werden (beispielsweise
+ // Hide-Button oder Taskleiste), loesen wir einen Resize mit 0,0 aus,
+ // damit Dialoge trotzdem als System-Fenster angezeigt werden, oder
+ // lehnen das Show ab
+ if ( SHORT1FROMMP( nMP1 ) )
+ {
+ // Show ablehen, wenn wir garnicht sichtbar sind
+ if ( !pFrame->maFrameData.mbVisible )
+ {
+ pFrame->maFrameData.mbInShow = TRUE;
+ WinSetWindowPos( pFrame->maFrameData.mhWndFrame, 0, 0, 0, 0, 0, SWP_HIDE );
+ pFrame->maFrameData.mbInShow = FALSE;
+ }
+ else
+ {
+ // Resize ausloesen, damit alter Status wieder
+ // hergestellt wird
+ pFrame->maFrameData.mbMinHide = FALSE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_RESIZE, 0 );
+ }
+ }
+ else
+ {
+ // Resize ausloesen, damit VCL mitbekommt, das Fenster
+ // gehidet ist, bzw. keine Groesse mehr hat
+ pFrame->maFrameData.mbMinHide = TRUE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_RESIZE, 0 );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleFocusMsg( SalFrame* pFrame, MPARAM nMP2 )
+{
+ if ( SHORT1FROMMP( nMP2 ) )
+ {
+ if ( WinIsWindowVisible( pFrame->maFrameData.mhWndFrame ) && !pFrame->maFrameData.mbInShow )
+ WinUpdateWindow( pFrame->maFrameData.mhWndClient );
+ return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_GETFOCUS, 0 );
+ }
+ else
+ {
+ return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_LOSEFOCUS, 0 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline long ImplHandleCloseMsg( SalFrame* pFrame )
+{
+ return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_CLOSE, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplHandleUserEvent( SalFrame* pFrame, MPARAM nMP2 )
+{
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_USEREVENT, (void*)nMP2 );
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef ENABLE_IME
+
+static long ImplHandleIMEStartConversion( SalFrame* pFrame )
+{
+ long nRet = FALSE;
+ SalIMEData* pIMEData = GetSalIMEData();
+ if ( pIMEData )
+ {
+ HWND hWnd = pFrame->maFrameData.mhWndClient;
+ HIMI hIMI = 0;
+ pIMEData->mpGetIME( hWnd, &hIMI );
+ if ( hIMI )
+ {
+ PM_ULONG nProp;
+ if ( 0 != pIMEData->mpQueryIMEProperty( hIMI, QIP_PROPERTY, &nProp ) )
+ pFrame->maFrameData.mbHandleIME = FALSE;
+ else
+ {
+ pFrame->maFrameData.mbHandleIME = !(nProp & PRP_SPECIALUI);
+
+ }
+ if ( pFrame->maFrameData.mbHandleIME )
+ {
+/* Windows-Code, der noch nicht angepasst wurde !!!
+ // Cursor-Position ermitteln und aus der die Default-Position fuer
+ // das Composition-Fenster berechnen
+ SalCursorPosEvent aCursorPosEvt;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_CURSORPOS, (void*)&aCursorPosEvt );
+ COMPOSITIONFORM aForm;
+ memset( &aForm, 0, sizeof( aForm ) );
+ if ( !aCursorPosEvt.mnWidth || !aCursorPosEvt.mnHeight )
+ aForm.dwStyle |= CFS_DEFAULT;
+ else
+ {
+ aForm.dwStyle |= CFS_POINT;
+ aForm.ptCurrentPos.x = aCursorPosEvt.mnX;
+ aForm.ptCurrentPos.y = aCursorPosEvt.mnY;
+ }
+ ImmSetCompositionWindow( hIMC, &aForm );
+
+ // Den InputContect-Font ermitteln und diesem dem Composition-Fenster
+ // bekannt machen
+*/
+
+ pFrame->maFrameData.mbConversionMode = TRUE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_STARTEXTTEXTINPUT, (void*)NULL );
+ nRet = TRUE;
+ }
+
+ pIMEData->mpReleaseIME( hWnd, hIMI );
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleIMEConversion( SalFrame* pFrame, MPARAM nMP2Param )
+{
+ long nRet = FALSE;
+ SalIMEData* pIMEData = GetSalIMEData();
+ if ( pIMEData )
+ {
+ HWND hWnd = pFrame->maFrameData.mhWndClient;
+ HIMI hIMI = 0;
+ PM_ULONG nMP2 = (PM_ULONG)nMP2Param;
+ pIMEData->mpGetIME( hWnd, &hIMI );
+ if ( hIMI )
+ {
+ if ( nMP2 & (IMR_RESULT_RESULTSTRING |
+ IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR |
+ IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) )
+ {
+ SalExtTextInputEvent aEvt;
+ aEvt.mnTime = WinQueryMsgTime( pFrame->maFrameData.mhAB );
+ aEvt.mpTextAttr = NULL;
+ aEvt.mnCursorPos = 0;
+ aEvt.mnDeltaStart = 0;
+ aEvt.mbOnlyCursor = FALSE;
+ aEvt.mbCursorVisible = TRUE;
+
+ PM_ULONG nBufLen = 0;
+ xub_Unicode* pBuf = NULL;
+ PM_ULONG nAttrBufLen = 0;
+ PM_BYTE* pAttrBuf = NULL;
+ BOOL bLastCursor = FALSE;
+ if ( nMP2 & IMR_RESULT_RESULTSTRING )
+ {
+ pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, 0, &nBufLen );
+ if ( nBufLen > 0 )
+ {
+ pBuf = new xub_Unicode[nBufLen];
+ pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, pBuf, &nBufLen );
+ }
+
+ bLastCursor = TRUE;
+ aEvt.mbCursorVisible = TRUE;
+ }
+ else if ( nMP2 & (IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR |
+ IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) )
+ {
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen );
+ if ( nBufLen > 0 )
+ {
+ pBuf = new xub_Unicode[nBufLen];
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, pBuf, &nBufLen );
+ }
+
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, 0, &nAttrBufLen );
+ if ( nAttrBufLen > 0 )
+ {
+ pAttrBuf = new PM_BYTE[nAttrBufLen];
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, pAttrBuf, &nAttrBufLen );
+ }
+
+/* !!! Wir bekommen derzeit nur falsche Daten, deshalb zeigen wir derzeit
+ !!! auch keine Cursor an
+ PM_ULONG nTempBufLen;
+ PM_ULONG nCursorPos = 0;
+ PM_ULONG nCursorAttr = 0;
+ PM_ULONG nChangePos = 0;
+ nTempBufLen = sizeof( PM_ULONG );
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen );
+ nTempBufLen = sizeof( PM_ULONG );
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORATTR, &nCursorAttr, &nTempBufLen );
+ nTempBufLen = sizeof( PM_ULONG );
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CHANGESTART, &nChangePos, &nTempBufLen );
+
+ aEvt.mnCursorPos = nCursorPos;
+ aEvt.mnDeltaStart = nChangePos;
+ if ( nCursorAttr & CP_CURSORATTR_INVISIBLE )
+ aEvt.mbCursorVisible = FALSE;
+*/
+ aEvt.mnCursorPos = 0;
+ aEvt.mnDeltaStart = 0;
+ aEvt.mbCursorVisible = FALSE;
+
+ if ( (nMP2 == IMR_CONV_CURSORPOS) ||
+ (nMP2 == IMR_CONV_CURSORATTR) )
+ aEvt.mbOnlyCursor = TRUE;
+ }
+
+ USHORT* pSalAttrAry = NULL;
+ if ( pBuf )
+ {
+ aEvt.maText = XubString( pBuf, (USHORT)nBufLen );
+ delete pBuf;
+ if ( pAttrBuf )
+ {
+ USHORT nTextLen = aEvt.maText.Len();
+ if ( nTextLen )
+ {
+ pSalAttrAry = new USHORT[nTextLen];
+ memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) );
+ for ( USHORT i = 0; (i < nTextLen) && (i < nAttrBufLen); i++ )
+ {
+ PM_BYTE nOS2Attr = pAttrBuf[i];
+ USHORT nSalAttr;
+ if ( nOS2Attr == CP_ATTR_TARGET_CONVERTED )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETCONVERTED | SAL_EXTTEXTINPUT_ATTR_UNDERLINE | SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT;
+ else if ( nOS2Attr == CP_ATTR_CONVERTED )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_CONVERTED | SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
+ else if ( nOS2Attr == CP_ATTR_TARGET_NOTCONVERTED )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETNOTCONVERTED | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ else if ( nOS2Attr == CP_ATTR_INPUT_ERROR )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUTERROR | SAL_EXTTEXTINPUT_ATTR_REDTEXT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ else /* ( nOS2Attr == CP_ATTR_INPUT ) */
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ pSalAttrAry[i] = nSalAttr;
+ }
+ aEvt.mpTextAttr = pSalAttrAry;
+ }
+ delete pAttrBuf;
+ }
+ if ( bLastCursor )
+ aEvt.mnCursorPos = aEvt.maText.Len();
+ }
+
+ pIMEData->mpReleaseIME( hWnd, hIMI );
+
+ // Handler rufen und wenn wir ein Attribute-Array haben, danach
+ // wieder zerstoeren
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_EXTTEXTINPUT, (void*)&aEvt );
+ if ( pSalAttrAry )
+ delete pSalAttrAry;
+ }
+ else
+ pIMEData->mpReleaseIME( hWnd, hIMI );
+ }
+
+ nRet = TRUE;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+inline long ImplHandleIMEEndConversion( SalFrame* pFrame )
+{
+ pFrame->maFrameData.mbConversionMode = FALSE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_ENDEXTTEXTINPUT, (void*)NULL );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleIMEOpenCandidate( SalFrame* pFrame )
+{
+ pFrame->maFrameData.mbCandidateMode = TRUE;
+
+ long nRet = FALSE;
+ SalIMEData* pIMEData = GetSalIMEData();
+ if ( pIMEData )
+ {
+ HWND hWnd = pFrame->maFrameData.mhWndClient;
+ HIMI hIMI = 0;
+ pIMEData->mpGetIME( hWnd, &hIMI );
+ if ( hIMI )
+ {
+ PM_ULONG nBufLen = 0;
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen );
+ if ( nBufLen > 0 )
+ {
+/* !!! Wir bekommen derzeit nur falsche Daten steht der Cursor immer bei 0
+ PM_ULONG nTempBufLen = sizeof( PM_ULONG );
+ PM_ULONG nCursorPos = 0;
+ pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen );
+*/
+ PM_ULONG nCursorPos = 0;
+
+ SalExtTextInputPosEvent aEvt;
+ aEvt.mnTime = WinQueryMsgTime( pFrame->maFrameData.mhAB );
+ aEvt.mnFirstPos = nCursorPos;
+ aEvt.mnChars = nBufLen-nCursorPos;
+ aEvt.mpPosAry = new SalExtCharPos[aEvt.mnChars];
+ memset( aEvt.mpPosAry, 0, aEvt.mnChars*sizeof(SalExtCharPos) );
+
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_EXTTEXTINPUTPOS, (void*)&aEvt );
+
+ long nMinLeft = aEvt.mpPosAry[0].mnX;
+ long nMinTop = aEvt.mpPosAry[0].mnY;
+ long nMaxBottom = aEvt.mpPosAry[0].mnY+aEvt.mpPosAry[0].mnHeight;
+ long nMaxRight = nMinLeft;
+ USHORT i = 0;
+ while ( i < aEvt.mnChars )
+ {
+ // Solange wir uns auf der gleichen Zeile bewegen,
+ // ermitteln wir die Rechteck-Grenzen
+ if ( !aEvt.mpPosAry[i].mnHeight ||
+ (aEvt.mpPosAry[i].mnY < nMaxBottom-1) )
+ {
+ if ( aEvt.mpPosAry[i].mnX < nMinLeft )
+ nMinLeft = aEvt.mpPosAry[i].mnX;
+ if ( aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth > nMaxRight )
+ nMaxRight = aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth;
+ if ( aEvt.mpPosAry[i].mnY < nMinTop )
+ nMinTop = aEvt.mpPosAry[i].mnY;
+ i++;
+ }
+ else
+ break;
+ }
+
+ CANDIDATEPOS aForm;
+ aForm.ulIndex = 0;
+ aForm.ulStyle = CPS_EXCLUDE;
+ aForm.ptCurrentPos.x = aEvt.mpPosAry[0].mnX;
+ aForm.ptCurrentPos.y = pFrame->maFrameData.mnHeight - (nMaxBottom+1) - 1;
+ aForm.rcArea.xLeft = nMinLeft;
+ aForm.rcArea.yBottom = pFrame->maFrameData.mnHeight - nMaxBottom - 1;
+ aForm.rcArea.xRight = nMaxRight+1;
+ aForm.rcArea.yTop = pFrame->maFrameData.mnHeight - nMinTop - 1;
+ pIMEData->mpSetCandidateWin( hIMI, &aForm );
+
+ delete aEvt.mpPosAry;
+ }
+
+ pIMEData->mpReleaseIME( hWnd, hIMI );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplHandleIMECloseCandidate( SalFrame* pFrame )
+{
+ pFrame->maFrameData.mbCandidateMode = FALSE;
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, PM_ULONG nMsg,
+ MPARAM nMP1, MPARAM nMP2 )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ MRESULT nRet = (MRESULT)0;
+ BOOL bDef = TRUE;
+
+ switch( nMsg )
+ {
+ case WM_MOUSEMOVE:
+ case WM_BUTTON1DOWN:
+ case WM_BUTTON2DOWN:
+ case WM_BUTTON3DOWN:
+ case WM_BUTTON1DBLCLK:
+ case WM_BUTTON2DBLCLK:
+ case WM_BUTTON3DBLCLK:
+ case WM_BUTTON1UP:
+ case WM_BUTTON2UP:
+ case WM_BUTTON3UP:
+ case SAL_MSG_MOUSELEAVE:
+ // ButtonUp/Down nie an die WinDefWindowProc weiterleiten, weil sonst
+ // die Message an den Owner weitergeleitet wird
+ bDef = !ImplHandleMouseMsg( pFrame, nMsg, nMP1, nMP2 );
+ break;
+
+ case WM_CHAR:
+ if ( pFrame->maFrameData.mbConversionMode )
+ bDef = FALSE;
+ else
+ bDef = !ImplHandleKeyMsg( pFrame, nMsg, nMP1, nMP2 );
+ break;
+
+ case WM_ERASEBACKGROUND:
+ nRet = (MRESULT)FALSE;
+ bDef = FALSE;
+ break;
+
+ case WM_PAINT:
+ ImplSalYieldMutexAcquire();
+ ImplHandlePaintMsg( pFrame );
+ ImplSalYieldMutexRelease();
+ bDef = FALSE;
+ break;
+
+ case WM_TIMER:
+ {
+ SalData* pSalData = GetSalData();
+ // Test for MouseLeave
+ SalTestMouseLeave();
+ if ( pSalData->mnTimerId == SHORT1FROMMP( nMP1 ) )
+ pSalData->mpTimerProc();
+ }
+ break;
+
+ case WM_MOVE:
+ ImplHandleMoveMsg( pFrame );
+ bDef = FALSE;
+ break;
+
+ case WM_SIZE:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ ImplHandleSizeMsg( pFrame, nMP2 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ WinPostMsg( hWnd, SAL_MSG_POSTSIZE, nMP1, nMP2 );
+ break;
+ case SAL_MSG_POSTSIZE:
+ ImplHandleSizeMsg( pFrame, nMP2 );
+ break;
+
+ case WM_CALCVALIDRECTS:
+ return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP);
+
+ case WM_SETFOCUS:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ ImplHandleFocusMsg( pFrame, nMP2 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ WinPostMsg( hWnd, SAL_MSG_POSTFOCUS, 0, nMP2 );
+ break;
+ case SAL_MSG_POSTFOCUS:
+ ImplHandleFocusMsg( pFrame, nMP2 );
+ break;
+
+ case WM_TRANSLATEACCEL:
+ {
+ // Da uns OS/2 zu viele Tasten abfaegnt, unternehmen wir etwas,
+ // damit wir Shift+F1, Shift+F10 und Shift+Enter bekommen
+ PQMSG pMsg = (PQMSG)nMP1;
+ USHORT nKeyFlags = SHORT1FROMMP( pMsg->mp1 );
+ USHORT nKeyCode = (UCHAR)SHORT2FROMMP( pMsg->mp2 );
+
+ if ( !(nKeyFlags & KC_KEYUP) && (nKeyFlags & KC_VIRTUALKEY) &&
+ (nKeyFlags & KC_SHIFT) && (nKeyCode != VK_ESC) )
+ return (MRESULT)FALSE;
+
+ if ( nKeyCode == VK_F1 )
+ return (MRESULT)FALSE;
+ }
+ break;
+
+ case WM_CREATE:
+ {
+ SalData* pSalData = GetSalData();
+ // Window-Instanz am Windowhandle speichern
+ pFrame = pSalData->mpCreateFrame;
+ pSalData->mpCreateFrame = NULL;
+ SetWindowPtr( hWnd, pFrame );
+ }
+ break;
+
+ case WM_CLOSE:
+ ImplSalYieldMutexAcquire();
+ ImplHandleCloseMsg( pFrame );
+ ImplSalYieldMutexRelease();
+ bDef = FALSE;
+ break;
+
+ case WM_SYSVALUECHANGED:
+ if ( pFrame->maFrameData.mbFullScreen )
+ ImplSalFrameFullScreenPos( pFrame );
+ // kein break, da der Rest auch noch verarbeitet werden soll
+ case PL_ALTERED:
+ case WM_SYSCOLORCHANGE:
+ ImplSalYieldMutexAcquire();
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_SETTINGSCHANGED, 0 );
+ ImplSalYieldMutexRelease();
+ break;
+
+ case SAL_MSG_USEREVENT:
+ ImplHandleUserEvent( pFrame, nMP2 );
+ bDef = FALSE;
+ break;
+
+ case WM_COMMAND:
+ case SAL_MSG_SYSPROCESSMENU:
+ if ( SalImplHandleProcessMenu( hWnd, nMsg, nMP1, nMP2 ) )
+ {
+ bDef = FALSE;
+ nRet = (MRESULT)1;
+ }
+ break;
+
+#ifdef ENABLE_IME
+ case WM_IMEREQUEST:
+ if ( (PM_ULONG)nMP1 == IMR_CONVRESULT )
+ {
+ if ( pFrame->maFrameData.mbHandleIME )
+ {
+ // Nur im Conversionmodus akzeptieren wir den IME-Input
+ if ( pFrame->maFrameData.mbConversionMode )
+ {
+ ImplSalYieldMutexAcquire();
+ if ( ImplHandleIMEConversion( pFrame, nMP2 ) )
+ {
+ bDef = FALSE;
+ nRet = (MRESULT)TRUE;
+ }
+ ImplSalYieldMutexRelease();
+ }
+ }
+ }
+ else if ( (PM_ULONG)nMP1 == IMR_CANDIDATE )
+ {
+ if ( pFrame->maFrameData.mbHandleIME )
+ {
+ ImplSalYieldMutexAcquire();
+ if ( (PM_ULONG)nMP2 & IMR_CANDIDATE_SHOW )
+ ImplHandleIMEOpenCandidate( pFrame );
+ else if ( (PM_ULONG)nMP2 & IMR_CANDIDATE_HIDE )
+ ImplHandleIMECloseCandidate( pFrame );
+ ImplSalYieldMutexRelease();
+ }
+ }
+ break;
+
+ case WM_IMENOTIFY:
+ if ( (PM_ULONG)nMP1 == IMN_STARTCONVERSION )
+ {
+ ImplSalYieldMutexAcquire();
+ if ( ImplHandleIMEStartConversion( pFrame ) )
+ {
+ bDef = FALSE;
+ nRet = (MRESULT)TRUE;
+ }
+ ImplSalYieldMutexRelease();
+ }
+ else if ( (PM_ULONG)nMP1 == IMN_ENDCONVERSION )
+ {
+ if ( pFrame->maFrameData.mbHandleIME )
+ {
+ ImplSalYieldMutexAcquire();
+ if ( ImplHandleIMEEndConversion( pFrame ) )
+ {
+ bDef = FALSE;
+ nRet = (MRESULT)TRUE;
+ }
+ ImplSalYieldMutexRelease();
+ }
+ }
+ break;
+#endif
+ }
+
+ if ( bDef )
+ nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+MRESULT EXPENTRY SalFrameFrameProc( HWND hWnd, PM_ULONG nMsg,
+ MPARAM nMP1, MPARAM nMP2 )
+{
+ if ( nMsg == WM_SYSCOMMAND )
+ {
+ HWND hWndClient = WinWindowFromID( hWnd, FID_CLIENT );
+ if( hWndClient )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWndClient );
+ if ( pFrame )
+ {
+ USHORT nCmd = SHORT1FROMMP( nMP1 );
+ if ( pFrame->maFrameData.mbFullScreen )
+ {
+ if ( (nCmd == SC_SIZE) || (nCmd == SC_MOVE) ||
+ (nCmd == SC_RESTORE) ||
+ (nCmd == SC_MINIMIZE) || (nCmd == SC_MAXIMIZE) )
+ {
+ WinAlarm( HWND_DESKTOP, WA_NOTE );
+ return 0;
+ }
+ }
+
+ if ( nCmd == SC_APPMENU )
+ {
+ // KeyInput mit MENU-Key rufen
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnTime = WinQueryMsgTime( pFrame->maFrameData.mhAB );
+ aKeyEvt.mnCode = KEY_MENU;
+ aKeyEvt.mnCharCode = 0;
+ aKeyEvt.mnRepeat = 0;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ if ( nRet )
+ return (MRESULT)0;
+ }
+ }
+ }
+ }
+ else if ( nMsg == WM_SHOW )
+ {
+ HWND hWndClient = WinWindowFromID( hWnd, FID_CLIENT );
+ if( hWndClient )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWndClient );
+ if ( pFrame )
+ ImplHandleShowMsg( pFrame, nMP1 );
+ }
+ }
+
+ return aSalShlData.mpOldFrameProc( hWnd, nMsg, nMP1, nMP2 );
+}
diff --git a/vcl/os2/source/window/salobj.cxx b/vcl/os2/source/window/salobj.cxx
new file mode 100644
index 000000000000..a5023e3e4301
--- /dev/null
+++ b/vcl/os2/source/window/salobj.cxx
@@ -0,0 +1,605 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/svpm.h>
+
+#define _SV_SALOBJ_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+
+// =======================================================================
+
+static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild )
+{
+ if ( hWndParent == hWndChild )
+ return TRUE;
+
+ HWND hTempWnd = WinQueryWindow( hWndChild, QW_PARENT );
+ while ( hTempWnd )
+ {
+ if ( hTempWnd == hWndParent )
+ return TRUE;
+ hTempWnd = WinQueryWindow( hTempWnd, QW_PARENT );
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static SalObject* ImplFindSalObject( HWND hWndChild )
+{
+ SalData* pSalData = GetSalData();
+ SalObject* pObject = pSalData->mpFirstObject;
+ while ( pObject )
+ {
+ if ( ImplIsSysWindowOrChild( pObject->maObjectData.mhWndChild, hWndChild ) )
+ return pObject;
+
+ pObject = pObject->maObjectData.mpNextObject;
+ }
+
+ return NULL;
+}
+
+// =======================================================================
+
+PM_BOOL EXPENTRY SalSysMsgProc( HAB /* hAB */, QMSG* pMsg, PM_ULONG /* fs */ )
+{
+ if ( (pMsg->msg == WM_BUTTON1DOWN) ||
+ (pMsg->msg == WM_BUTTON2DOWN) ||
+ (pMsg->msg == WM_BUTTON3DOWN) )
+ {
+ SalData* pSalData = GetSalData();
+ SalObject* pObject = ImplFindSalObject( pMsg->hwnd );
+ if ( pObject )
+ WinPostMsg( pObject->maObjectData.mhWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ }
+
+ // Focus fangen wir hier nicht ab, da wir erstmal davon ausgehen,
+ // das unser SalObject-Fenster immer eine WM_FOCUSCHANGE-Message
+ // bekommt.
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+MRESULT EXPENTRY SalSysObjWndProc( HWND hWnd, PM_ULONG nMsg,
+ MPARAM nMP1, MPARAM nMP2 )
+{
+ SalObject* pSysObj;
+ MRESULT nRet = 0;
+ int bDef = TRUE;
+
+ switch( nMsg )
+ {
+ case WM_ERASEBACKGROUND:
+ nRet = (MRESULT)FALSE;
+ bDef = FALSE;
+ break;
+ case WM_PAINT:
+ {
+ HPS hPS;
+ RECTL aRect;
+ hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect );
+ WinEndPaint( hPS );
+ bDef = FALSE;
+ }
+ bDef = FALSE;
+ break;
+
+ case WM_BUTTON1DOWN:
+ case WM_BUTTON2DOWN:
+ case WM_BUTTON3DOWN:
+ case SALOBJ_MSG_TOTOP:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj,
+ SALOBJ_EVENT_TOTOP, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ WinPostMsg( hWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ break;
+
+ case WM_FOCUSCHANGE:
+ case SALOBJ_MSG_POSTFOCUS:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ if ( SHORT1FROMMP( nMP2 ) )
+ {
+ pSysObj->maObjectData.mhLastFocusWnd = WinQueryFocus( HWND_DESKTOP );
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj,
+ SALOBJ_EVENT_GETFOCUS, 0 );
+ }
+ else
+ {
+ HWND hWndFocus = HWNDFROMMP( nMP1 );
+ if ( !hWndFocus || !ImplIsSysWindowOrChild( hWnd, hWndFocus ) )
+ {
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj,
+ SALOBJ_EVENT_LOSEFOCUS, 0 );
+ }
+ }
+ ImplSalYieldMutexRelease();
+ }
+ else
+ WinPostMsg( hWnd, SALOBJ_MSG_POSTFOCUS, nMP1, nMP2 );
+ break;
+
+ case WM_SIZE:
+ {
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ pSysObj->maObjectData.mnHeight = (short)SHORT2FROMMP( nMP2 );
+ WinSetWindowPos( pSysObj->maObjectData.mhWndChild, 0,
+ 0, 0,
+ (short)SHORT1FROMMP( nMP2 ), (short)SHORT2FROMMP( nMP2 ),
+ SWP_SIZE | SWP_MOVE );
+ bDef = FALSE;
+ }
+ break;
+
+ case WM_CREATE:
+ {
+ // Window-Instanz am Windowhandle speichern
+ CREATESTRUCT* pStruct = (CREATESTRUCT*)nMP2;
+ pSysObj = (SalObject*)pStruct->pPresParams;
+ SetSalObjWindowPtr( hWnd, pSysObj );
+ bDef = FALSE;
+ }
+ break;
+ }
+
+ if ( bDef )
+ nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 );
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+MRESULT EXPENTRY SalSysObjChildWndProc( HWND hWnd, PM_ULONG nMsg,
+ MPARAM nMP1, MPARAM nMP2 )
+{
+ MRESULT nRet = 0;
+ int bDef = TRUE;
+
+ switch( nMsg )
+ {
+ case WM_ERASEBACKGROUND:
+ // Wegen PlugIn's loeschen wir erstmal den Hintergrund
+/*
+ nRet = (MRESULT)FALSE;
+ bDef = FALSE;
+*/
+ break;
+ case WM_PAINT:
+ {
+ HPS hPS;
+ RECTL aRect;
+ hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect );
+ WinEndPaint( hPS );
+ bDef = FALSE;
+ }
+ break;
+ }
+
+ if ( bDef )
+ nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 );
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+MRESULT EXPENTRY SalSysObjClipWndProc( HWND hWnd, PM_ULONG nMsg,
+ MPARAM nMP1, MPARAM nMP2 )
+{
+ MRESULT nRet = 0;
+ int bDef = TRUE;
+
+ switch( nMsg )
+ {
+ case WM_MOUSEMOVE:
+ case WM_BUTTON1DOWN:
+ case WM_BUTTON2DOWN:
+ case WM_BUTTON3DOWN:
+ case WM_BUTTON1DBLCLK:
+ case WM_BUTTON2DBLCLK:
+ case WM_BUTTON3DBLCLK:
+ case WM_BUTTON1UP:
+ case WM_BUTTON2UP:
+ case WM_BUTTON3UP:
+ {
+ // Alle Events an den Frame weiterreichen, da diese Bereiche
+ // dem Frame gehoeren. Dazu muessen die Mouse-Koordinaaten
+ // entsprechend umgerechnet werden
+ HWND hWndParent = WinQueryWindow( hWnd, QW_PARENT ); // ergibt SysChild-Fenster
+ hWndParent = WinQueryWindow( hWndParent, QW_PARENT );
+ short nX = (short)SHORT1FROMMP( nMP1 );
+ short nY = (short)SHORT2FROMMP( nMP1 );
+ POINTL aPos;
+ aPos.x = nX;
+ aPos.y = nY;
+ WinMapWindowPoints( hWnd, hWndParent, &aPos, 1 );
+ nMP1 = MPFROM2SHORT( (short)aPos.x, (short)aPos.y );
+ bDef = FALSE;
+ nRet = WinSendMsg( hWndParent, nMsg, nMP1, nMP2 );
+ }
+ break;
+
+ case WM_HITTEST:
+ // Damit im disablten Zustand die MouseKlicks immer noch
+ // an den Frame geschickt werden
+ // Dieser Code reicht leider nicht aus, deshalb wir unter
+ // OS2 immer das Child-Fenster disablen, im Gegensatz
+ // zu Windows, wo immer der Parent disablte wird, da
+ // sich das Fenster evtl. anders Darstellen koennte,
+ // wenn es disablte wird. Da dieser Fall uns bisher
+ // nicht bekannt ist, ignorieren wir das.
+ nRet = HT_NORMAL;
+ bDef = FALSE;
+ break;
+
+ case WM_ERASEBACKGROUND:
+ nRet = (MRESULT)FALSE;
+ bDef = FALSE;
+ break;
+ case WM_PAINT:
+ {
+ HPS hPS;
+ RECTL aRect;
+ hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect );
+ WinEndPaint( hPS );
+ bDef = FALSE;
+ }
+ break;
+ }
+
+ if ( bDef )
+ nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 );
+ return nRet;
+}
+
+// =======================================================================
+
+void ImplDestroyAllClipWindows( HWND hWndLast )
+{
+ if ( hWndLast == HWND_TOP )
+ return;
+
+ HWND hWndPrev;
+ while ( hWndLast )
+ {
+ hWndPrev = WinQueryWindow( hWndLast, QW_PREV );
+ WinDestroyWindow( hWndLast );
+ hWndLast = hWndPrev;
+ }
+}
+
+// =======================================================================
+
+SalObject* ImplSalCreateObject( SalInstance* pInst, SalFrame* pParent )
+{
+ SalData* pSalData = GetSalData();
+
+ if ( !pSalData->mbObjClassInit )
+ {
+ if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLASSNAME,
+ (PFNWP)SalSysObjWndProc, CS_MOVENOTIFY,
+ SAL_OBJECT_WNDEXTRA ) )
+ {
+ if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLIPCLASSNAME,
+ (PFNWP)SalSysObjClipWndProc, CS_HITTEST | CS_MOVENOTIFY, 0 ) )
+ {
+ if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CHILDCLASSNAME,
+ (PFNWP)SalSysObjChildWndProc, CS_HITTEST | CS_MOVENOTIFY, 32 ) )
+ pSalData->mbObjClassInit = TRUE;
+ }
+ }
+ }
+
+ if ( pSalData->mbObjClassInit )
+ {
+ SalObject* pObject = new SalObject;
+ HWND hWnd = WinCreateWindow( pParent->maFrameData.mhWndClient, SAL_OBJECT_CLASSNAME, "",
+ 0,
+ 0, 0, 0, 0,
+ pParent->maFrameData.mhWndClient, HWND_TOP,
+ 0, NULL, (void*)pObject );
+ HWND hWndChild = WinCreateWindow( hWnd, SAL_OBJECT_CHILDCLASSNAME, "",
+ WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
+ 0, 0, 0, 0,
+ hWnd, HWND_TOP,
+ 0, NULL, NULL );
+
+ if ( !hWndChild )
+ {
+ if ( hWnd )
+ WinDestroyWindow( hWnd );
+ delete pObject;
+ return NULL;
+ }
+
+ if ( hWnd )
+ {
+ pObject->maObjectData.mhWnd = hWnd;
+ pObject->maObjectData.mhWndChild = hWndChild;
+ pObject->maObjectData.maSysData.hWnd = hWndChild;
+ return pObject;
+ }
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyObject( SalObject* pObject )
+{
+ delete pObject;
+}
+
+// =======================================================================
+
+long ImplSalObjCallbackDummy( void*, SalObject*, USHORT, const void* )
+{
+ return 0;
+}
+
+// =======================================================================
+
+SalObject::SalObject()
+{
+ SalData* pSalData = GetSalData();
+
+ maObjectData.mhLastClipWnd = HWND_TOP;
+
+ maObjectData.mhWnd = 0;
+ maObjectData.mhWndChild = 0;
+ maObjectData.mhLastFocusWnd = 0;
+ maObjectData.maSysData.nSize = sizeof( SystemEnvData );
+ maObjectData.mnHeight = 0;
+ maObjectData.mpInst = NULL;
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+
+ // Hook installieren, wenn es das erste SalObject ist
+ if ( !pSalData->mpFirstObject )
+ {
+ WinSetHook( pSalData->mhAB, pSalData->mhMQ,
+ HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 );
+ }
+
+ // Insert object in objectlist
+ maObjectData.mpNextObject = pSalData->mpFirstObject;
+ pSalData->mpFirstObject = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalObject::~SalObject()
+{
+ SalData* pSalData = GetSalData();
+
+ // remove frame from framelist
+ if ( this == pSalData->mpFirstObject )
+ {
+ pSalData->mpFirstObject = maObjectData.mpNextObject;
+
+ // Wenn letztes SalObject, dann Hook wieder entfernen
+ if ( !pSalData->mpFirstObject )
+ {
+ WinReleaseHook( pSalData->mhAB, pSalData->mhMQ,
+ HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 );
+ }
+ }
+ else
+ {
+ SalObject* pTempObject = pSalData->mpFirstObject;
+ while ( pTempObject->maObjectData.mpNextObject != this )
+ pTempObject = pTempObject->maObjectData.mpNextObject;
+
+ pTempObject->maObjectData.mpNextObject = maObjectData.mpNextObject;
+ }
+
+ // Cache-Daten zerstoeren
+ ImplDestroyAllClipWindows( maObjectData.mhLastClipWnd );
+
+ if ( maObjectData.mhWndChild )
+ WinDestroyWindow( maObjectData.mhWndChild );
+ if ( maObjectData.mhWnd )
+ WinDestroyWindow( maObjectData.mhWnd );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::ResetClipRegion()
+{
+ ImplDestroyAllClipWindows( maObjectData.mhLastClipWnd );
+ maObjectData.mhLastClipWnd = HWND_TOP;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalObject::GetClipRegionType()
+{
+ return SAL_OBJECT_CLIP_EXCLUDERECTS;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::BeginSetClipRegion( ULONG nRectCount )
+{
+ maObjectData.mhOldLastClipWnd = maObjectData.mhLastClipWnd;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+ HWND hClipWnd = WinCreateWindow( maObjectData.mhWnd, SAL_OBJECT_CLIPCLASSNAME, "",
+ WS_VISIBLE,
+ nX, maObjectData.mnHeight-(nY+nHeight), nWidth, nHeight,
+ maObjectData.mhWnd, maObjectData.mhLastClipWnd,
+ 0, NULL, NULL );
+ maObjectData.mhLastClipWnd = hClipWnd;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::EndSetClipRegion()
+{
+ ImplDestroyAllClipWindows( maObjectData.mhOldLastClipWnd );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
+{
+ PM_ULONG nStyle = 0;
+ PM_BOOL bVisible = WinIsWindowVisible( maObjectData.mhWnd );
+ if ( bVisible )
+ {
+ WinShowWindow( maObjectData.mhWnd, FALSE );
+ nStyle |= SWP_SHOW;
+ }
+ SWP aParentSWP;
+ WinQueryWindowPos( WinQueryWindow( maObjectData.mhWnd, QW_PARENT ), &aParentSWP );
+ WinSetWindowPos( maObjectData.mhWnd, 0, nX, aParentSWP.cy-(nY+nHeight), nWidth, nHeight,
+ SWP_MOVE | SWP_SIZE | nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::Show( BOOL bVisible )
+{
+ WinShowWindow( maObjectData.mhWnd, bVisible );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::Enable( BOOL bEnable )
+{
+ // Im Gegensatz zu Windows disablen wir das Childfenster,
+ // da ansonsten unser Clippen nicht mehr funktioniert, da
+ // wir keine Events mehr bekommen. Dadurch kann sich evtl.
+ // das Fenster anders darstellen, was wir eigentlich nicht
+ // wollen. Aber da uns bisher kein Fall bekannt ist,
+ // ignorieren wir dies. Ansonsten muss ein Fenster dazwischen
+ // gezogen werden oder getestet werden, wie wir die
+ // Maustransparenz erreichen, wenn maObjectData.mhWnd
+ // disablte wird.
+ WinEnableWindow( maObjectData.mhWndChild, bEnable );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::GrabFocus()
+{
+ if ( maObjectData.mhLastFocusWnd &&
+ WinIsWindow( GetSalData()->mhAB, maObjectData.mhLastFocusWnd ) &&
+ ImplIsSysWindowOrChild( maObjectData.mhWndChild, maObjectData.mhLastFocusWnd ) )
+ WinSetFocus( HWND_DESKTOP, maObjectData.mhLastFocusWnd );
+ else
+ WinSetFocus( HWND_DESKTOP, maObjectData.mhWndChild );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground( SalColor nSalColor )
+{
+}
+
+// -----------------------------------------------------------------------
+
+const SystemChildData* SalObject::GetSystemData() const
+{
+ return &maObjectData.maSysData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc )
+{
+ maObjectData.mpInst = pInst;
+ if ( pProc )
+ maObjectData.mpProc = pProc;
+ else
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+}
diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst
new file mode 100644
index 000000000000..d66650014ace
--- /dev/null
+++ b/vcl/prj/d.lst
@@ -0,0 +1,186 @@
+mkdir: %_DEST%\bin%_EXT%\remote
+mkdir: %_DEST%\idl%_EXT%\stardiv\remote
+mkdir: %_DEST%\idl%_EXT%\stardiv\system
+mkdir: %_DEST%\inc%_EXT%\sv
+mkdir: %_DEST%\inc%_EXT%\tools
+mkdir: %_DEST%\inc%_EXT%\uno
+mkdir: %_DEST%\inc%_EXT%\uno\awt
+mkdir: %_DEST%\inc%_EXT%\vcl
+mkdir: %_DEST%\inc%_EXT%\vcl\unx
+mkdir: %_DEST%\ucr%_EXT%
+mkdir: %_DEST%\ucr%_EXT%\vcl
+
+..\%__SRC%\bin\remote\vcl%upd%??.dll %_DEST%\bin%_EXT%\remote\vcl?????.dll
+..\%__SRC%\bin\vcl%UPD%??.res %_DEST%\bin%_EXT%\vcl%upd%??.res
+..\%__SRC%\bin\vcl%upd%??.dll %_DEST%\bin%_EXT%\vcl?????.dll
+..\%__SRC%\bin\vcl%upd%??.sym %_DEST%\bin%_EXT%\vcl?????.sym
+..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\lib\*.so.* %_DEST%\lib%_EXT%\*.so.*
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\lib\app16.lib %_DEST%\lib%_EXT%\app16.lib
+..\%__SRC%\lib\gdi16.lib %_DEST%\lib%_EXT%\gdi16.lib
+..\%__SRC%\lib\isv.lib %_DEST%\lib%_EXT%\isv.lib
+..\%__SRC%\lib\ivcl.lib %_DEST%\lib%_EXT%\ivcl.lib
+..\%__SRC%\lib\remote\*.so %_DEST%\bin%_EXT%\remote\*.so
+..\%__SRC%\lib\remote\*.so %_DEST%\lib%_EXT%\remote\*.so
+..\%__SRC%\lib\vcl.lib %_DEST%\lib%_EXT%\vcl.lib
+..\%__SRC%\misc\vcl%upd%??.map %_DEST%\bin%_EXT%\vcl?????.map
+..\%__SRC%\obj\main.obj %_DEST%\lib%_EXT%\xsvmain.obj
+..\%__SRC%\obj\salmain.obj %_DEST%\lib%_EXT%\salmain.obj
+..\%__SRC%\obj\svapp.obj %_DEST%\lib%_EXT%\xsvapp.obj
+..\%__SRC%\res\svsrc.res %_DEST%\res%_EXT%\svsrc.res
+..\%__SRC%\slb\sv.lib %_DEST%\lib%_EXT%\xsv.lib
+..\%__SRC%\slo\salmain.o %_DEST%\lib%_EXT%\salmain.o
+..\%__SRC%\slo\svdll.obj %_DEST%\lib%_EXT%\xsvdll.obj
+..\%__SRC%\ucr\*.ucr %_DEST%\ucr%_EXT%\vcl\*.ucr
+
+hedabu: ..\%__SRC%\inc\*.h %_DEST%\inc%_EXT%\vcl\*.h
+hedabu: ..\%__SRC%\inc\*.hxx %_DEST%\inc%_EXT%\vcl\*.hxx
+hedabu: ..\%__SRC%\inc\convert.hxx %_DEST%\inc%_EXT%\vcl\convert.hxx
+hedabu: ..\inc\accel.hxx %_DEST%\inc%_EXT%\vcl\accel.hxx
+hedabu: ..\inc\access.hxx %_DEST%\inc%_EXT%\vcl\access.hxx
+hedabu: ..\inc\accmgr.hxx %_DEST%\inc%_EXT%\vcl\accmgr.hxx
+hedabu: ..\inc\alpha.hxx %_DEST%\inc%_EXT%\vcl\alpha.hxx
+hedabu: ..\inc\animate.hxx %_DEST%\inc%_EXT%\vcl\animate.hxx
+hedabu: ..\inc\apptypes.hxx %_DEST%\inc%_EXT%\vcl\apptypes.hxx
+hedabu: ..\inc\bitmap.hxx %_DEST%\inc%_EXT%\vcl\bitmap.hxx
+hedabu: ..\inc\bitmap.inl %_DEST%\inc%_EXT%\vcl\bitmap.inl
+hedabu: ..\inc\bitmapex.hxx %_DEST%\inc%_EXT%\vcl\bitmapex.hxx
+hedabu: ..\inc\bmpacc.hxx %_DEST%\inc%_EXT%\vcl\bmpacc.hxx
+hedabu: ..\inc\btndlg.hxx %_DEST%\inc%_EXT%\vcl\btndlg.hxx
+hedabu: ..\inc\button.hxx %_DEST%\inc%_EXT%\vcl\button.hxx
+hedabu: ..\inc\button.hxx %_DEST%\inc%_EXT%\vcl\imagebtn.hxx
+hedabu: ..\inc\clip.hxx %_DEST%\inc%_EXT%\vcl\clip.hxx
+hedabu: ..\inc\cmdevt.h %_DEST%\inc%_EXT%\vcl\cmdevt.h
+hedabu: ..\inc\cmdevt.hxx %_DEST%\inc%_EXT%\vcl\cmdevt.hxx
+hedabu: ..\inc\color.hxx %_DEST%\inc%_EXT%\vcl\color.hxx
+hedabu: ..\inc\combobox.h %_DEST%\inc%_EXT%\vcl\combobox.h
+hedabu: ..\inc\combobox.hxx %_DEST%\inc%_EXT%\vcl\combobox.hxx
+hedabu: ..\inc\config.hxx %_DEST%\inc%_EXT%\vcl\config.hxx
+hedabu: ..\inc\ctrl.hxx %_DEST%\inc%_EXT%\vcl\ctrl.hxx
+hedabu: ..\inc\cursor.hxx %_DEST%\inc%_EXT%\vcl\cursor.hxx
+hedabu: ..\inc\cvtgrf.hxx %_DEST%\inc%_EXT%\vcl\cvtgrf.hxx
+hedabu: ..\inc\cvtsvm.hxx %_DEST%\inc%_EXT%\vcl\cvtsvm.hxx
+hedabu: ..\inc\decoview.hxx %_DEST%\inc%_EXT%\vcl\decoview.hxx
+hedabu: ..\inc\dialog.hxx %_DEST%\inc%_EXT%\vcl\dialog.hxx
+hedabu: ..\inc\dockwin.hxx %_DEST%\inc%_EXT%\vcl\dockwin.hxx
+hedabu: ..\inc\drag.hxx %_DEST%\inc%_EXT%\vcl\drag.hxx
+hedabu: ..\inc\edit.hxx %_DEST%\inc%_EXT%\vcl\edit.hxx
+hedabu: ..\inc\event.hxx %_DEST%\inc%_EXT%\vcl\event.hxx
+hedabu: ..\inc\exchange.hxx %_DEST%\inc%_EXT%\vcl\exchange.hxx
+hedabu: ..\inc\field.hxx %_DEST%\inc%_EXT%\vcl\field.hxx
+hedabu: ..\inc\fildlg.hxx %_DEST%\inc%_EXT%\vcl\fildlg.hxx
+hedabu: ..\inc\filedlg.hxx %_DEST%\inc%_EXT%\vcl\filedlg.hxx
+hedabu: ..\inc\fixbrd.hxx %_DEST%\inc%_EXT%\vcl\fixbrd.hxx
+hedabu: ..\inc\fixed.hxx %_DEST%\inc%_EXT%\vcl\fixed.hxx
+hedabu: ..\inc\fldunit.hxx %_DEST%\inc%_EXT%\vcl\fldunit.hxx
+hedabu: ..\inc\floatwin.hxx %_DEST%\inc%_EXT%\vcl\floatwin.hxx
+hedabu: ..\inc\font.hxx %_DEST%\inc%_EXT%\vcl\font.hxx
+hedabu: ..\inc\fonttype.hxx %_DEST%\inc%_EXT%\vcl\fonttype.hxx
+hedabu: ..\inc\gdimtf.hxx %_DEST%\inc%_EXT%\vcl\gdimtf.hxx
+hedabu: ..\inc\gdiobj.hxx %_DEST%\inc%_EXT%\vcl\gdiobj.hxx
+hedabu: ..\inc\gen.hxx %_DEST%\inc%_EXT%\vcl\gen.hxx
+hedabu: ..\inc\gfxlink.hxx %_DEST%\inc%_EXT%\vcl\gfxlink.hxx
+hedabu: ..\inc\gradient.hxx %_DEST%\inc%_EXT%\vcl\gradient.hxx
+hedabu: ..\inc\graph.h %_DEST%\inc%_EXT%\vcl\graph.h
+hedabu: ..\inc\graph.hxx %_DEST%\inc%_EXT%\vcl\graph.hxx
+hedabu: ..\inc\group.hxx %_DEST%\inc%_EXT%\vcl\group.hxx
+hedabu: ..\inc\hatch.hxx %_DEST%\inc%_EXT%\vcl\hatch.hxx
+hedabu: ..\inc\hdltab.hxx %_DEST%\inc%_EXT%\vcl\hdltab.hxx
+hedabu: ..\inc\help.hxx %_DEST%\inc%_EXT%\vcl\help.hxx
+hedabu: ..\inc\image.hxx %_DEST%\inc%_EXT%\vcl\image.hxx
+hedabu: ..\inc\imagebtn.hxx %_DEST%\inc%_EXT%\vcl\imagebtn.hxx
+hedabu: ..\inc\imgcons.hxx %_DEST%\inc%_EXT%\vcl\imgcons.hxx
+hedabu: ..\inc\imgctrl.hxx %_DEST%\inc%_EXT%\vcl\imgctrl.hxx
+hedabu: ..\inc\inputctx.hxx %_DEST%\inc%_EXT%\vcl\inputctx.hxx
+hedabu: ..\inc\jobset.hxx %_DEST%\inc%_EXT%\vcl\jobset.hxx
+hedabu: ..\inc\keycod.hxx %_DEST%\inc%_EXT%\vcl\keycod.hxx
+hedabu: ..\inc\keycodes.hxx %_DEST%\inc%_EXT%\vcl\keycodes.hxx
+hedabu: ..\inc\line.hxx %_DEST%\inc%_EXT%\vcl\line.hxx
+hedabu: ..\inc\lineinfo.hxx %_DEST%\inc%_EXT%\vcl\lineinfo.hxx
+hedabu: ..\inc\longcurr.hxx %_DEST%\inc%_EXT%\vcl\longcurr.hxx
+hedabu: ..\inc\lstbox.h %_DEST%\inc%_EXT%\vcl\lstbox.h
+hedabu: ..\inc\lstbox.hxx %_DEST%\inc%_EXT%\vcl\lstbox.hxx
+hedabu: ..\inc\mapmod.hxx %_DEST%\inc%_EXT%\vcl\mapmod.hxx
+hedabu: ..\inc\mapunit.hxx %_DEST%\inc%_EXT%\vcl\mapunit.hxx
+hedabu: ..\inc\menu.hxx %_DEST%\inc%_EXT%\vcl\menu.hxx
+hedabu: ..\inc\menubtn.hxx %_DEST%\inc%_EXT%\vcl\menubtn.hxx
+hedabu: ..\inc\metaact.hxx %_DEST%\inc%_EXT%\vcl\metaact.hxx
+hedabu: ..\inc\metric.hxx %_DEST%\inc%_EXT%\vcl\metric.hxx
+hedabu: ..\inc\morebtn.hxx %_DEST%\inc%_EXT%\vcl\morebtn.hxx
+hedabu: ..\inc\msgbox.hxx %_DEST%\inc%_EXT%\vcl\msgbox.hxx
+hedabu: ..\inc\octree.hxx %_DEST%\inc%_EXT%\vcl\octree.hxx
+hedabu: ..\inc\opengl.hxx %_DEST%\inc%_EXT%\vcl\opengl.hxx
+hedabu: ..\inc\outdev.hxx %_DEST%\inc%_EXT%\vcl\outdev.hxx
+hedabu: ..\inc\outdev3d.hxx %_DEST%\inc%_EXT%\vcl\outdev3d.hxx
+hedabu: ..\inc\pal.hxx %_DEST%\inc%_EXT%\vcl\pal.hxx
+hedabu: ..\inc\pointr.hxx %_DEST%\inc%_EXT%\vcl\pointr.hxx
+hedabu: ..\inc\poly.hxx %_DEST%\inc%_EXT%\vcl\poly.hxx
+hedabu: ..\inc\ppdparser.hxx %_DEST%\inc%_EXT%\vcl\ppdparser.hxx
+hedabu: ..\inc\print.hxx %_DEST%\inc%_EXT%\vcl\print.hxx
+hedabu: ..\inc\prndlg.hxx %_DEST%\inc%_EXT%\vcl\prndlg.hxx
+hedabu: ..\inc\prntypes.hxx %_DEST%\inc%_EXT%\vcl\prntypes.hxx
+hedabu: ..\inc\ptrstyle.hxx %_DEST%\inc%_EXT%\vcl\ptrstyle.hxx
+hedabu: ..\inc\rc.h %_DEST%\inc%_EXT%\vcl\rc.h
+hedabu: ..\inc\rc.hxx %_DEST%\inc%_EXT%\vcl\rc.hxx
+hedabu: ..\inc\rcid.h %_DEST%\inc%_EXT%\vcl\rcid.h
+hedabu: ..\inc\rcown.hxx %_DEST%\inc%_EXT%\vcl\rcown.hxx
+hedabu: ..\inc\regband.hxx %_DEST%\inc%_EXT%\vcl\regband.hxx
+hedabu: ..\inc\region.hxx %_DEST%\inc%_EXT%\vcl\region.hxx
+hedabu: ..\inc\resary.hxx %_DEST%\inc%_EXT%\vcl\resary.hxx
+hedabu: ..\inc\resid.hxx %_DEST%\inc%_EXT%\vcl\resid.hxx
+hedabu: ..\inc\resmgr.hxx %_DEST%\inc%_EXT%\vcl\resmgr.hxx
+hedabu: ..\inc\rversion.h %_DEST%\inc%_EXT%\vcl\rversion.h
+hedabu: ..\inc\salbtype.hxx %_DEST%\inc%_EXT%\vcl\salbtype.hxx
+hedabu: ..\inc\salctype.hxx %_DEST%\inc%_EXT%\vcl\salctype.hxx
+hedabu: ..\inc\salgtype.hxx %_DEST%\inc%_EXT%\vcl\salgtype.hxx
+hedabu: ..\inc\salotype.hxx %_DEST%\inc%_EXT%\vcl\salotype.hxx
+hedabu: ..\inc\salstype.hxx %_DEST%\inc%_EXT%\vcl\salstype.hxx
+hedabu: ..\inc\scrbar.hxx %_DEST%\inc%_EXT%\vcl\scrbar.hxx
+hedabu: ..\inc\seleng.hxx %_DEST%\inc%_EXT%\vcl\seleng.hxx
+hedabu: ..\inc\settings.hxx %_DEST%\inc%_EXT%\vcl\settings.hxx
+hedabu: ..\inc\slider.hxx %_DEST%\inc%_EXT%\vcl\slider.hxx
+hedabu: ..\inc\sndstyle.hxx %_DEST%\inc%_EXT%\vcl\sndstyle.hxx
+hedabu: ..\inc\sound.hxx %_DEST%\inc%_EXT%\vcl\sound.hxx
+hedabu: ..\inc\spin.h %_DEST%\inc%_EXT%\vcl\spin.h
+hedabu: ..\inc\spin.hxx %_DEST%\inc%_EXT%\vcl\spin.hxx
+hedabu: ..\inc\spinfld.hxx %_DEST%\inc%_EXT%\vcl\spinfld.hxx
+hedabu: ..\inc\split.hxx %_DEST%\inc%_EXT%\vcl\split.hxx
+hedabu: ..\inc\splitwin.hxx %_DEST%\inc%_EXT%\vcl\splitwin.hxx
+hedabu: ..\inc\status.hxx %_DEST%\inc%_EXT%\vcl\status.hxx
+hedabu: ..\inc\stdtext.hxx %_DEST%\inc%_EXT%\vcl\stdtext.hxx
+hedabu: ..\inc\strhelper.hxx %_DEST%\inc%_EXT%\vcl\strhelper.hxx
+hedabu: ..\inc\sv.h %_DEST%\inc%_EXT%\vcl\sv.h
+hedabu: ..\inc\svapp.hxx %_DEST%\inc%_EXT%\vcl\svapp.hxx
+hedabu: ..\inc\svsys.h %_DEST%\inc%_EXT%\vcl\svsys.h
+hedabu: ..\inc\symbol.hxx %_DEST%\inc%_EXT%\vcl\symbol.hxx
+hedabu: ..\inc\syschild.hxx %_DEST%\inc%_EXT%\vcl\syschild.hxx
+hedabu: ..\inc\sysdata.hxx %_DEST%\inc%_EXT%\vcl\sysdata.hxx
+hedabu: ..\inc\sysdlg.hxx %_DEST%\inc%_EXT%\vcl\sysdlg.hxx
+hedabu: ..\inc\system.hxx %_DEST%\inc%_EXT%\vcl\system.hxx
+hedabu: ..\inc\syswin.hxx %_DEST%\inc%_EXT%\vcl\syswin.hxx
+hedabu: ..\inc\tab.hxx %_DEST%\inc%_EXT%\vcl\tab.hxx
+hedabu: ..\inc\tabctrl.hxx %_DEST%\inc%_EXT%\vcl\tabctrl.hxx
+hedabu: ..\inc\tabdlg.hxx %_DEST%\inc%_EXT%\vcl\tabdlg.hxx
+hedabu: ..\inc\tabpage.hxx %_DEST%\inc%_EXT%\vcl\tabpage.hxx
+hedabu: ..\inc\timer.hxx %_DEST%\inc%_EXT%\vcl\timer.hxx
+hedabu: ..\inc\toolbox.hxx %_DEST%\inc%_EXT%\vcl\toolbox.hxx
+hedabu: ..\inc\uniqid.hxx %_DEST%\inc%_EXT%\vcl\uniqid.hxx
+hedabu: ..\inc\unowrap.hxx %_DEST%\inc%_EXT%\vcl\unowrap.hxx
+hedabu: ..\inc\vclenum.hxx %_DEST%\inc%_EXT%\vcl\vclenum.hxx
+hedabu: ..\inc\vector2d.hxx %_DEST%\inc%_EXT%\vcl\vector2d.hxx
+hedabu: ..\inc\virdev.hxx %_DEST%\inc%_EXT%\vcl\virdev.hxx
+hedabu: ..\inc\waitobj.hxx %_DEST%\inc%_EXT%\vcl\waitobj.hxx
+hedabu: ..\inc\wall.hxx %_DEST%\inc%_EXT%\vcl\wall.hxx
+hedabu: ..\inc\winbit.hxx %_DEST%\inc%_EXT%\vcl\winbit.hxx
+hedabu: ..\inc\window.hxx %_DEST%\inc%_EXT%\vcl\window.hxx
+hedabu: ..\inc\wintypes.hxx %_DEST%\inc%_EXT%\vcl\wintypes.hxx
+hedabu: ..\inc\wrkwin.hxx %_DEST%\inc%_EXT%\vcl\wrkwin.hxx
+hedabu: ..\inc\atom.hxx %_DEST%\inc%_EXT%\vcl\atom.hxx
+hedabu: ..\inc\threadex.hxx %_DEST%\inc%_EXT%\vcl\threadex.hxx
+hedabu: ..\inc\evntpost.hxx %_DEST%\inc%_EXT%\vcl\evntpost.hxx
+hedabu: ..\inc\unohelp.hxx %_DEST%\inc%_EXT%\vcl\unohelp.hxx
+hedabu: ..\unx\inc\salconfig.hxx %_DEST%\inc%_EXT%\vcl\unx\salconfig.hxx
+
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
new file mode 100644
index 000000000000..024f3cdd5191
--- /dev/null
+++ b/vcl/source/app/dbggui.cxx
@@ -0,0 +1,1884 @@
+/*************************************************************************
+ *
+ * $RCSfile: dbggui.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifdef DBG_UTIL
+
+#define _SV_DBGGUI_CXX
+
+#include "svdata.hxx"
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include <svsys.h>
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_LSTBOX_HXX
+#include <lstbox.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+#ifndef _SV_EDIT_HXX
+#include <edit.hxx>
+#endif
+#ifndef _SV_FIXED_HXX
+#include <fixed.hxx>
+#endif
+#ifndef _SV_GROUP_HXX
+#include <group.hxx>
+#endif
+#ifndef _SV_FIELD_HXX
+#include <field.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <msgbox.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_SYSTEM_HXX
+#include <system.hxx>
+#endif
+
+#ifndef _SV_DBGGUI_HXX
+#include <dbggui.hxx>
+#endif
+
+// =======================================================================
+
+static sal_Char* pDbgHelpText[] =
+{
+"Object Test\n",
+"------------------------------------------\n",
+"\n",
+"--- Macros ---\n",
+"DBG_NAME( aName )\n",
+"Definiert die Verwaltungsdaten fuer eine Klasse. Dieses Makro darf nur in "
+"einem Source-File mit dem gleichen Namen benutzt werden.\n",
+"\n",
+"DBG_NAMEEX( aName )\n",
+"Wie DBG_NAME, nur fuer weitere Source-Files.\n",
+"\n",
+"DBG_CTOR( aName, fTest )\n",
+"Muss in allen Konstruktoren einer Klasse benutzt werden (auch beim "
+"CopyCtor). Als erster Paramter muss der registrierte Name (am besten der "
+"Klassenname) uebergeben werden und als zweiter Parameter die Testfunktion "
+"oder 0.\n",
+"\n",
+"DBG_DTOR( aName, fTest )\n",
+"Muss im Destruktor der Klasse benutzt werden. Als erster Paramter muss "
+"der registrierte Name uebergeben werden und als zweiter Parameter die "
+"Testfunktion oder 0.\n",
+"\n",
+"DBG_CHKTHIS( aName, fTest )\n",
+"Kann in Methoden einer Klasse benutzt werden, wo die Konstruktoren und "
+"der Destruktor der Klasse mit den entsprechenden Makros ausgestattet sind. "
+"Als erster Paramter muss der registrierte Name uebergeben werden und als "
+"zweiter Parameter die Testfunktion oder 0.\n",
+"\n",
+"DBG_CHKOBJ( pObj, aName, fTest )\n",
+"Kann auf Instanzen einer Klasse angewendet werden, wo die Konstruktoren und "
+"der Destruktor der Klasse mit den entsprechenden Makros ausgestattet sind. "
+"Als erster Paramter muss die Adresse des zu testenden Objects uebergeben "
+"werden, als zweiter Parameter der registrierte Name und als dritter "
+"Parameter die Testfunktion oder 0.\n",
+"\n",
+"Damit die Makros Wirkung haben, muss DBG_UTIL defniert sein.\n",
+"\n",
+#ifndef CFRONT
+"--- Optionen ---\n",
+"This\n",
+"Es wird auf gueltigen This-Pointer getestet. Dadurch kann man erreichen, "
+"das bei allen Objekten die damit ausgestattet sind, geprueft wird, ob "
+"mit einem existierenden Objekt gearbeitet wird. Dadurch findet man zum "
+"Beispiel schneller Fehler durch falsche Mehrfachvererbung, Alignment oder "
+"Compilerfehler. Da fast alle Standard-Klassen von SV (String, List, Pen, "
+"Brush, Polygon, ...) mit DBG_CHKTHIS() ausgestattet sind, werden viele "
+"Fehler gefunden, jedoch kostet dadurch dieser Test auch entsprechend viel "
+"Performence.\n",
+"\n",
+"Function\n",
+"Wenn eine Funktion bei den Macros uebergeben wird, wird sie gerufen.\n",
+"\n",
+"Exit\n",
+"This- und Func-Test wird auch beim Funktionsaustritt durchgefuehrt.\n",
+"\n",
+"Report\n",
+"Am Programmende wird die Anzahl der angelegten Objekte ausgegeben. "
+"Da alle wichtigen SV-Klassen zumindest mit DBG_CTOR()/DBG_DTOR() "
+"ausgestattet sind, kann man damit feststellen, ob man die sogenannten "
+"Resource-Leaks hat (Systemobjekte, die nicht freigegeben werden). Dazu "
+"gehoehren OutputDevice, Window, VirtualDevice, Printer und Menu. Achtung: "
+"Dtor-Aufrufe von statischen Objekten werden nicht beruecksichtigt. Deshalb "
+"bleiben bei jedem SV-Programm auch 2 Strings und eine Bitmap nach.\n",
+"\n",
+"Trace\n",
+"Erzeugung, Zerstoerung und Benutzung der mit DBG_XTOR ausgestatteten "
+"Objekte wird protokoliert.\n",
+"\n",
+"\n",
+"Memory Test\n",
+"------------------------------------------\n",
+"\n",
+"--- Macros ---\n",
+"DBG_MEMTEST()\n",
+"Fuehrt die eingestellten Memory Tests durch.\n",
+"\n",
+"DBG_MEMTEST_PTR( p )\n",
+"Fuehrt die eingestellten Memory Tests durch und zusaetzlich wird der "
+"uebergebene Pointer auf Gueltigkeit geprueft, wenn Pointer Test an ist.\n",
+"\n",
+"--- Optionen ---\n",
+"Initilize\n",
+"Allokierter Speicher wird mit 0x77 und freier oder freigegebener Speicher "
+"wird mit 0x33 initialisiert. Diese Option kostet (fast) keine Performence "
+"und sollte deshalb waehrend der Entwicklung fast immer an sein. Denn "
+"dadurch erreicht man auch, das Abstuerze oefters reproduzierbarer "
+"auftreten.\n",
+"\n",
+"Overwrite\n",
+"Es wird getestet, ob vor/hinter die Bloecke geschrieben wird. Vor und "
+"hinter dem Block wird der Speicher mit 0x55 initialisiert. Diese Option "
+"kostet Performence, sollte jedoch auch mal eingesetzt werden um die "
+"haeufigsten Speicherueberschreiber (+-1-Fehler) zu testen. Diese Option "
+"sollte auch eingeschaltet werden, wenn das Programm im new oder "
+"delete-Operator abstuerzt.\n",
+"\n",
+"Free\n",
+"Es wird getestet, ob freier Speicher ueberschrieben wird. Diese Option "
+"kostet eine ganze Menge Performence und sollte deshalb nur gelegentlich "
+"eingesetzt werden um Speicherueberschreiber zu testen. Diese Option "
+"sollte evt. auch eingeschaltet werden, wenn das Programm im new oder "
+"delete-Operator abstuerzt.\n",
+"\n",
+"Pointer\n",
+"Bei delete und DBG_MEMTEST_PTR() wird der Zeiger getestet, ob er auch mit "
+"new oder SvMemAlloc() angelegt wurde. Wenn diese Option eingeschaltet ist, "
+"werden Fehler wie doppeltes delete und delete auf Stack-Objekte oder "
+"ungueltige Zeiger gefunden. Diese Option kostet Performence und sollte "
+"deshalb nicht immer eingeschaltet sein. Jedoch sollte auch ab und zu mit "
+"dieser Option getestet werden, da der Memory-Manager nicht immer bei delete "
+"und ungueltigem Zeiger abstuerzt. Diese Option sollte auch eingeschaltet "
+"werden, wenn das Programm im new oder delete-Operator abstuerzt.\n",
+"\n",
+"Report\n",
+"Am Programmende wird eine kleine Statistik und der nicht freigegebene "
+"Speicher ausgegeben. Achtung: Speicher der von globalen Objekten noch "
+"freigegeben wird, taucht auch in der Leak-Liste auf.\n",
+"\n",
+"Trace\n",
+"Allokation und Freigeben von Speicher wird protokoliert.\n",
+"\n",
+"Leak-Report\n",
+"Gibt unter WNT beim Programmende eine Liste der Memory-Leaks mit "
+"Stack-Trace aus. Dabei werden nur Bloecke beruecksichtigt, die innerhalb "
+"von Application::Execute() angelegt und freigegeben werden. Wenn diese "
+"Option und Overwrite gesetzt ist, wird bei einem Speicherueberschreiber "
+"auch noch versucht den Stack auszugeben, wo der Block angelegt wurde. "
+"Diese Ausgabe erfolgt erst nach Ausgabe der Fehlermeldung in die "
+"Log-Datei.\n"
+"\n",
+"New/Delete\n",
+"Memory-Tests werden auf den gesammten Speicher bei jedem new/delete "
+"durchgefuhert. Achtung: Diese Option macht die Programme sehr langsam "
+"und sollte nur eingeschaltet werden, wenn ein Speicherueberschreiber "
+"eingegrenzt werden soll. Ansonsten reicht es, die einzelnen Optionen "
+"einzuschalten, da (kein Leak vorrausgesetzt) jeder zu erkennende "
+"Speicherueberschreiber waehrend der Laufzeit eines Programms gefunden "
+"werden sollte.\n",
+"\n",
+"Object Test\n",
+"Memory-Tests werden auf den gesammten Speicher bei jedem Object-Test "
+"durchgefuhert. Achtung: Diese Option macht die Programme sehr langsam "
+"und sollte nur eingeschaltet werden, wenn ein Speicherueberschreiber "
+"eingegrenzt werden soll. Ansonsten reicht es, die einzelnen Optionen "
+"einzuschalten, da (kein Leak vorrausgesetzt) jeder zu erkennende "
+"Speicherueberschreiber waehrend der Laufzeit eines Programms gefunden "
+"werden sollte.\n",
+"\n",
+"SysAlloc\n",
+"Wenn dieses Flag gesetzt ist, wird Speicher mit direkten Systemfunktionen"
+"angefordert und der Memory-Manager von SV umgangen. Dadurch ist es moeglich"
+"leistungsfaehigere Memory-Test-Tools einzusetzen. Es ist jedoch darauf zu"
+"achten, das nicht auf jedem System die Memory-Funktionen vom Compiler"
+"gerufen werden, sondern die Systemfunktionen. Dadurch ist man unter"
+"Windows 16-Bit auf ca. 4000 news begrenzt und unter OS2 werden immer"
+"4096 KB Bloecke angefordert.\n",
+"\n",
+"Windows 16-Bit und Debug-Tests\n",
+"Achtung: Wenn Memory-Tests an sind (ausser Initilize) wird niemals "
+"(auch nicht bei >= 64 KB) Speicher mit Offset 0 zurueckgeben. Falls man "
+"darauf angewiesen ist, muessen die Tests mit 32-Bit-Versionen der "
+"Programme durchgefuehrt werden. Teilweise reicht es aber auch schon aus, "
+"wenn man statt 64 KB nur 64 KB - 64-Bytes anlegt, da es dann nicht zu "
+"einem Segmentueberlauf kommt.\n",
+"Ausserdem sollten die Memory- genauso wie die Object-Tests nur dann "
+"eingesetzt werden, wenn nur eine SV-Applikation gleichzeitig laeuft. "
+"Ansonsten kann es zu unkontrolierten Fehlern kommen. Hier hilft dann auch "
+"nur ein ausweichen auf 32-Bit-Programme."
+"\n",
+"\n",
+"\nWeitere Test's und Makros\n",
+"------------------------------------------\n",
+"\n",
+"Profiling\n",
+"DBG_PROFSTART() / DBG_PROFSTOP() / DBG_PROFCONTINUE() / DBG_PROFPAUSE() "
+"werden ausgewertet und beim Programmende wird die Anzahl der Durchlaeufe "
+"und die dazu benoetigte Zeit (inklusive der Childaufrufe) in "
+"Millisekunden ausgegeben. Diese Macros koennen dann eingesetzt werden, wenn "
+"die gleichen Funktionsablaeufe ueber die gesammte Entwicklungszeit "
+"beobachtet werden sollen, wie zum Beispiel die Startup-Zeiten. Bei den "
+"Makros muss der registrierte Name uebergeben werden, der mit DBG_NAME() "
+"registriert wurde.\n",
+"\n",
+"Resourcen\n",
+"Bei Resource-Fehlern gibt es einen Fehler-Dialog, bevor der "
+"Exception-Handler gerufen wird.\n",
+"\n",
+"Dialog\n",
+"Es werden FixedTexte, CheckBoxen, TriStateBoxen und RadioButtons mit "
+"einer anderen Hintergrundfarbe versehen, damit man feststellen kann, wie "
+"Gross die Controls sind. Ausserdem wird getestet, ob sich Controls "
+"ueberschneiden, die Tabreihenfolge in Ordnung ist und die Mnemonischen "
+"Zeichen ordentlich vergeben wurden. Bei Dialogen wird auch angemahnt, "
+"wenn kein DefPushButton oder kein OK-/CancelButton vorhanden ist. "
+"Diese Tests sind nicht 100% (es wird evt. zuviel angemahnt) und "
+"erfuellen auch keine Garantie, das alle Problemfaelle festgestellt "
+"werden, da zum Beispiel nur initial und dann nur die sichtbaren Controls "
+"getestet werden. Es werden somit keine Fehler gefunden, die waehrend der "
+"Benutzung des Dialoges auftreten.\n",
+"\n",
+"Bold AppFont\n",
+"Es wird der Applikationsfont auf Fett gesetzt, damit man feststellen kann, "
+"ob der Platz fuer die Texte auf anderen Systemen oder bei anderer "
+"Systemeinstellung ausreicht. Denn bei schmalen Fonts werden die Dialoge "
+"kuenstlich breiter gemacht, da diese ansonsten zu schmal aussehen.\n",
+"\n",
+"Trace-Ausgaben\n",
+"DBG_TRACE() kann verwendet werden, wenn man TRACE-Ausgaben haben moechte. "
+"DBG_TRACEFILE() gibt zu der Meldung auch noch die Datei und die Zeilennummer "
+"aus, an der das Makro steht. DBG_TRACE1() bis DBG_TRACE5() koennen "
+"verwendet werden, wenn man eine formatierte Ausgabe (printf-Formatstring) "
+"haben moechte. Die Trace-Ausgaben werden aktiviert, in dem man in der "
+"DropDown-ListBox eine entsprechende Ausgabe waehlt.\n"
+"\n",
+"Warnings\n",
+"DBG_WARNING() kann verwendet werden, wenn man Warnungen ausgeben moechte. "
+"DBG_WARNINGFILE() gibt zu der Warnung auch noch die Datei und die "
+"Zeilennummer aus, an der das Makro steht. DBG_WARNING1() bis DBG_WARNING5() "
+"koennen verwendet werden, wenn man eine formatierte Ausgabe "
+"(printf-Formatstring) haben moechte. Wenn man die Warnung von einer "
+"Bedingung abhaengig machen moechte, kann man DBG_ASSERTWARNING() "
+"benutzen. Die Warning wird ausgegeben, wenn die Bedingung nicht erfuellt "
+"wurde. Als erster Parameter muss die zu testende Bedingung und als zweiter "
+"Parameter die auszugebene Meldung uebergeben werden. Die Warnungen werden "
+"aktiviert, in dem man in der DropDown-ListBox eine entsprechende Ausgabe "
+"waehlt. Wenn None gewaehlt ist, wird auch die Bedingung bei "
+"DBG_ASSERTWARNING() nicht ausgewertet.\n",
+"\n",
+"Errors\n",
+"DBG_ERROR() kann verwendet werden, wenn man Fehlermeldungen ausgeben "
+"moechte. DBG_ERRORFILE() gibt zu dem Fehler auch noch die Datei und die "
+"Zeilennummer aus, an der das Makro steht. DBG_ERROR1() bis DBG_ERROR5() "
+"koennen verwendet werden, wenn man eine formatierte Ausgabe "
+"(printf-Formatstring) haben moechte. Wenn man die Fehlerausgabe von einer "
+"Bedingung abhaengig machen moechte, kann man DBG_ASSERT() benutzen. Der "
+"Fehler wird ausgegeben, wenn die Bedingung nicht erfuellt wurde. Als erster "
+"Parameter muss die zu testende Bedingung und als zweiter Parameter die "
+"auszugebene Meldung uebergeben werden. Die Fehlermeldungen werden "
+"aktiviert, in dem man in der DropDown-ListBox eine entsprechende Ausgabe "
+"waehlt. Wenn None gewaehlt ist, wird auch die Bedingung bei "
+"DBG_ASSERT() nicht ausgewertet.\n",
+"\n",
+"\n",
+"Output\n",
+"------------------------------------------\n",
+"\n",
+"Overwrite - CheckBox\n",
+"Bei jedem neuen Programmstart wird das Log-File ueberschrieben, wenn "
+"eine Ausgabe stattgefunden hat.\n",
+"\n",
+"Include-ObjectTest-Filter\n",
+"Es werden nur die Klassen bei Object-Test ausgewertet, die einen der "
+"angegebenen Filter enthalten. Die Filter werden mit ';' getrennt und "
+"sind casesensitiv. Wildcards werden nicht unterstuetzt. Wenn kein Text "
+"angegeben wird, ist der Filter nicht aktiv.\n",
+"\n",
+"Exclude-ObjectTest-Filter\n",
+"Es werden die Klassen bei Object-Test ausgewertet, die einen der "
+"angegebenen Filter nicht enthalten. Die Filter werden mit ';' getrennt "
+"und sind casesensitiv. Wildcards werden nicht unterstuetzt. Wenn kein "
+"Text angegeben wird, ist der Filter nicht aktiv.\n",
+"\n",
+"Include-Filter\n",
+"Es werden nur die Texte ausgegeben, die einen der angegebenen Filter "
+"enthalten. Die Filter werden mit ';' getrennt und sind casesensitiv. "
+"Wildcards werden nicht unterstuetzt. Der Filter gilt fuer alle Ausgaben "
+"(jedoch nicht fuer Errors). Wenn kein Text angegeben wird, ist der Filter "
+"nicht aktiv.\n",
+"\n",
+"Exclude-Filter\n",
+"Es werden nur die Texte ausgegeben, die einen der angegebenen Filter "
+"nicht enthalten. Die Filter werden mit ';' getrennt und sind casesensitiv. "
+"Wildcards werden nicht unterstuetzt. Der Filter gilt fuer alle Ausgaben "
+"(jedoch nicht fuer Errors). Wenn kein Text angegeben wird, ist der Filter "
+"nicht aktiv.\n",
+"\n",
+"Ausserdem kann eingestellt werden, wohin die Daten ausgegeben werden "
+"sollen:\n",
+"\n",
+"None\n",
+"Ausgabe wird unterdrueckt.\n",
+"\n",
+"File\n",
+"Ausgabe ins Debug-File. Dateiname kann im Editfeld eingegeben werden.\n",
+"\n",
+"Window\n",
+"Ausgabe in ein kleines Debug-Window. Die Fenstergroesse wird gespeichert, "
+"wenn man den Debug-Dialog mit OK beendet und das Fenster sichtbar ist.\n",
+"\n",
+"Shell\n",
+"Ausgabe in ein Debug-System (Windows Debug-Window) wenn vorhanden oder "
+"unter Unix ins Shell-Fenster. Ansonsten das gleiche wie Window.\n",
+"\n",
+"MessageBox\n",
+"Ausgabe in MessageBox. In dieser hat man dann die Auswahl, ob das Programm "
+"fortgesetzt, beendet (Application::Abort) oder mit CoreDump abgebrochen "
+"werden soll. Da eine MessageBox weitere Event-Verarbeitung zulaest koennen "
+"jeweils weitere Fehler zum Beispiel durch Paints, Activate/Deactivate, "
+"GetFocus/LoseFocus die Ausgabe der Meldung oder weitere und falsche "
+"Fehler und Meldungen ausloesen. Deshalb sollte bei Problemen die Meldungen "
+"evt. auch in ein File/Debugger geleitet werden um die (richtigen) Fehlermeldungen "
+"zu erhalten.\n",
+"\n",
+"TestTool\n",
+"Wenn das TestTool laeuft, werden die Meldungen in das TestTool umgeleitet.\n",
+"\n",
+"Debugger\n",
+"Versucht den Debugger zu aktivieren und dort die Meldung auszugeben, "
+"so das man im Debugger dann immer auch den dazugehoerenden Stacktrace "
+"erhaellt.\n",
+"\n",
+"CoreDump\n",
+"Erzeugt einen Absturz\n",
+"\n",
+"\n",
+"Einstellungen\n",
+"------------------------------------------\n",
+"\n",
+"Wo standardmaessig das INI-File und LOG-File gelesen und geschrieben "
+"wird, kann folgendermassen eingestellt werden:\n",
+"\n",
+"WIN/WNT (WIN.INI, Gruppe SV, Default: dbgsv.ini und dbgsv.log):\n",
+"INI: dbgsv\n",
+"LOG: dbgsvlog\n",
+"\n",
+"OS2 (OS2.INI, Application SV, Default: dbgsv.ini und dbgsv.log):\n",
+"INI: DBGSV\n",
+"LOG: DBGSVLOG\n",
+"\n",
+"UNIX (Environment-Variable, Default: .dbgsv.init und dbgsv.log):\n",
+"INI: DBGSV_INIT\n",
+"LOG: DBGSV_LOG\n",
+"\n",
+"MAC (Default: dbgsv.ini und dbgsv.log):\n",
+"INI: keine Moeglichkeit\n",
+"LOG: nur Debug-Dialogeinstellung\n",
+"\n",
+"Es muss jeweils Pfad und Dateiname angegeben werden. Der Name der "
+"Log-Datei, der im Debug-Dialog eintragen wurde, hat immer vorrang.\n",
+"\n",
+"\n",
+"Beispiel\n",
+"------------------------------------------\n",
+"\n",
+"DBG_NAME( String );\n",
+"\n",
+"#ifdef DBG_UTIL\n",
+"const sal_Char* DbgCheckString( const void* pString )\n",
+"{\n",
+" String* p = (String*)pString;\n",
+"\n",
+" if ( p->mpData->maStr[p->mpData->mnLen] != 0 )\n",
+" return \"String damaged: aStr[nLen] != 0\";\n",
+"\n",
+" return NULL;\n",
+"}\n",
+"#endif\n",
+"\n",
+"String::String()\n",
+"{\n",
+" DBG_CTOR( String, DbgCheckString );\n",
+" // ...\n",
+"}\n",
+"\n",
+"String::~String()\n",
+"{\n",
+" DBG_DTOR( String, DbgCheckString );\n",
+" //...\n",
+"}\n",
+"\n",
+"char& String::operator [] ( USHORT nIndex )\n",
+"{\n",
+" DBG_CHKTHIS( String, DbgCheckString );\n",
+" DBG_ASSERT( nIndex <= pData->nLen, \"String::[] : nIndex > Len\" );\n",
+"\n",
+" //...\n",
+"}\n",
+"\n",
+"USHORT String::Search( const String& rStr, USHORT nIndex ) const\n",
+"{\n",
+" DBG_CHKTHIS( String, DbgCheckString );\n",
+" DBG_CHKOBJ( &rStr, String, DbgCheckString );\n",
+"\n",
+" //...\n",
+"}",
+"\n",
+#endif
+NULL
+};
+
+// =======================================================================
+
+// -------------
+// - DbgWindow -
+// -------------
+
+#define DBGWIN_MAXLINES 100
+
+class DbgWindow : public WorkWindow
+{
+private:
+ ListBox maLstBox;
+
+public:
+ DbgWindow();
+
+ virtual BOOL Close();
+ virtual void Resize();
+ void InsertLine( const XubString& rLine );
+ void Update() { WorkWindow::Update(); maLstBox.Update(); }
+};
+
+// -----------------
+// - DbgInfoDialog -
+// -----------------
+
+class DbgInfoDialog : public ModalDialog
+{
+private:
+ ListBox maListBox;
+ OKButton maOKButton;
+ BOOL mbHelpText;
+
+public:
+ DbgInfoDialog( Window* pParent, BOOL bHelpText = FALSE );
+
+ void SetInfoText( const XubString& rStr );
+};
+
+// -------------
+// - DbgDialog -
+// -------------
+
+class DbgDialog : public ModalDialog
+{
+private:
+ CheckBox maXtorThis;
+ CheckBox maXtorFunc;
+ CheckBox maXtorExit;
+ CheckBox maXtorReport;
+ CheckBox maXtorTrace;
+ GroupBox maBox1;
+
+ CheckBox maMemInit;
+ CheckBox maMemOverwrite;
+ CheckBox maMemOverwriteFree;
+ CheckBox maMemPtr;
+ CheckBox maMemReport;
+ CheckBox maMemTrace;
+ CheckBox maMemLeakReport;
+ CheckBox maMemNewDel;
+ CheckBox maMemXtor;
+ CheckBox maMemSysAlloc;
+ GroupBox maBox2;
+
+ CheckBox maProf;
+ CheckBox maRes;
+ CheckBox maDialog;
+ CheckBox maBoldAppFont;
+ GroupBox maBox3;
+
+ Edit maDebugName;
+ CheckBox maOverwrite;
+ FixedText maInclClassText;
+ Edit maInclClassFilter;
+ FixedText maExclClassText;
+ Edit maExclClassFilter;
+ FixedText maInclText;
+ Edit maInclFilter;
+ FixedText maExclText;
+ Edit maExclFilter;
+ FixedText maTraceText;
+ ListBox maTraceBox;
+ FixedText maWarningText;
+ ListBox maWarningBox;
+ FixedText maErrorText;
+ ListBox maErrorBox;
+ GroupBox maBox4;
+
+ OKButton maOKButton;
+ CancelButton maCancelButton;
+ PushButton maInfoButton;
+ HelpButton maHelpButton;
+ USHORT mnErrorOff;
+
+public:
+ DbgDialog();
+
+ DECL_LINK( ClickHdl, Button* );
+ void RequestHelp( const HelpEvent& rHEvt );
+};
+
+// =======================================================================
+
+static sal_Char aDbgInfoBuf[12288];
+static sal_Char aDbgOutBuf[DBG_BUF_MAXLEN];
+
+// =======================================================================
+
+DbgWindow::DbgWindow() :
+ WorkWindow( NULL, WB_STDWORK ),
+ maLstBox( this, WB_AUTOHSCROLL )
+{
+ DbgData* pData = DbgGetData();
+
+ maLstBox.Show();
+ maLstBox.SetPosPixel( Point( 0, 0 ) );
+
+ SetOutputSizePixel( Size( 250, 400 ) );
+ if ( pData->aDbgWinState )
+ {
+ ByteString aState( pData->aDbgWinState );
+ SetWindowState( aState );
+ }
+
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "StarView Debug Window" ) ) );
+ Show();
+ Update();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DbgWindow::Close()
+{
+ delete this;
+ ImplGetSVData()->maWinData.mpDbgWin = NULL;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void DbgWindow::Resize()
+{
+ maLstBox.SetSizePixel( GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void DbgWindow::InsertLine( const XubString& rLine )
+{
+ XubString aStr = rLine;
+ aStr.ConvertLineEnd( LINEEND_LF );
+ xub_StrLen nPos = aStr.Search( _LF );
+ while ( nPos != STRING_NOTFOUND )
+ {
+ if ( maLstBox.GetEntryCount() >= DBGWIN_MAXLINES )
+ maLstBox.RemoveEntry( 0 );
+ maLstBox.InsertEntry( aStr.Copy( 0, nPos ) );
+ aStr.Erase( 0, nPos+1 );
+ nPos = aStr.Search( _LF );
+ }
+ if ( maLstBox.GetEntryCount() >= DBGWIN_MAXLINES )
+ maLstBox.RemoveEntry( 0 );
+ maLstBox.InsertEntry( aStr );
+ maLstBox.SetTopEntry( DBGWIN_MAXLINES-1 );
+ maLstBox.Update();
+}
+
+// =======================================================================
+
+DbgDialog::DbgDialog() :
+ ModalDialog( Application::GetAppWindow(), WB_STDMODAL | WB_SYSTEMWINDOW ),
+ maXtorThis( this ),
+ maXtorFunc( this ),
+ maXtorExit( this ),
+ maXtorReport( this ),
+ maXtorTrace( this ),
+ maBox1( this ),
+ maMemInit( this ),
+ maMemOverwrite( this ),
+ maMemOverwriteFree( this ),
+ maMemPtr( this ),
+ maMemReport( this ),
+ maMemTrace( this ),
+ maMemLeakReport( this ),
+ maMemNewDel( this ),
+ maMemXtor( this ),
+ maMemSysAlloc( this ),
+ maBox2( this ),
+ maProf( this ),
+ maRes( this ),
+ maDialog( this ),
+ maBoldAppFont( this ),
+ maBox3( this ),
+ maDebugName( this ),
+ maOverwrite( this ),
+ maInclClassText( this ),
+ maInclClassFilter( this ),
+ maExclClassText( this ),
+ maExclClassFilter( this ),
+ maInclText( this ),
+ maInclFilter( this ),
+ maExclText( this ),
+ maExclFilter( this ),
+ maTraceText( this ),
+ maTraceBox( this, WB_DROPDOWN ),
+ maWarningText( this ),
+ maWarningBox( this, WB_DROPDOWN ),
+ maErrorText( this ),
+ maErrorBox( this, WB_DROPDOWN ),
+ maBox4( this ),
+ maOKButton( this, WB_DEFBUTTON ),
+ maCancelButton( this ),
+ maInfoButton( this ),
+ maHelpButton( this )
+{
+ DbgData* pData = DbgGetData();
+ MapMode aAppMap( MAP_APPFONT );
+ Size aButtonSize = LogicToPixel( Size( 60, 12 ), aAppMap );
+
+ {
+ maXtorThis.Show();
+ maXtorThis.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "T~his" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_XTOR_THIS )
+ maXtorThis.Check( TRUE );
+ maXtorThis.SetPosSizePixel( LogicToPixel( Point( 10, 15 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maXtorFunc.Show();
+ maXtorFunc.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Function" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_XTOR_FUNC )
+ maXtorFunc.Check( TRUE );
+ maXtorFunc.SetPosSizePixel( LogicToPixel( Point( 75, 15 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maXtorExit.Show();
+ maXtorExit.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "E~xit" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_XTOR_EXIT )
+ maXtorExit.Check( TRUE );
+ maXtorExit.SetPosSizePixel( LogicToPixel( Point( 140, 15 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maXtorReport.Show();
+ maXtorReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_XTOR_REPORT )
+ maXtorReport.Check( TRUE );
+ maXtorReport.SetPosSizePixel( LogicToPixel( Point( 205, 15 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maXtorTrace.Show();
+ maXtorTrace.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_XTOR_TRACE )
+ maXtorTrace.Check( TRUE );
+ maXtorTrace.SetPosSizePixel( LogicToPixel( Point( 270, 15 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maBox1.Show();
+ maBox1.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Object Tests" ) ) );
+ maBox1.SetPosSizePixel( LogicToPixel( Point( 5, 5 ), aAppMap ),
+ LogicToPixel( Size( 330, 30 ), aAppMap ) );
+ }
+
+ {
+ maMemInit.Show();
+ maMemInit.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Initilize" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_INIT )
+ maMemInit.Check( TRUE );
+ maMemInit.SetPosSizePixel( LogicToPixel( Point( 10, 50 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemOverwrite.Show();
+ maMemOverwrite.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Overwrite" )) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_OVERWRITE )
+ maMemOverwrite.Check( TRUE );
+ maMemOverwrite.SetPosSizePixel( LogicToPixel( Point( 75, 50 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemOverwriteFree.Show();
+ maMemOverwriteFree.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Free" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_OVERWRITEFREE )
+ maMemOverwriteFree.Check( TRUE );
+ maMemOverwriteFree.SetPosSizePixel( LogicToPixel( Point( 140, 50 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemPtr.Show();
+ maMemPtr.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Pointer" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_POINTER )
+ maMemPtr.Check( TRUE );
+ maMemPtr.SetPosSizePixel( LogicToPixel( Point( 205, 50 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemReport.Show();
+ maMemReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Report" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_REPORT )
+ maMemReport.Check( TRUE );
+ maMemReport.SetPosSizePixel( LogicToPixel( Point( 270, 50 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemTrace.Show();
+ maMemTrace.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_TRACE )
+ maMemTrace.Check( TRUE );
+ maMemTrace.SetPosSizePixel( LogicToPixel( Point( 10, 65 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemLeakReport.Show();
+ maMemLeakReport.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Leak-Report" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_LEAKREPORT )
+ maMemLeakReport.Check( TRUE );
+ maMemLeakReport.SetPosSizePixel( LogicToPixel( Point( 75, 65 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemNewDel.Show();
+ maMemNewDel.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~New/Delete" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_NEWDEL )
+ maMemNewDel.Check( TRUE );
+ maMemNewDel.SetPosSizePixel( LogicToPixel( Point( 140, 65 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemXtor.Show();
+ maMemXtor.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Ob~ject Test" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_XTOR )
+ maMemXtor.Check( TRUE );
+ maMemXtor.SetPosSizePixel( LogicToPixel( Point( 205, 65 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maMemSysAlloc.Show();
+ maMemSysAlloc.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "System ~Alloc" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_MEM_SYSALLOC )
+ {
+ maMemSysAlloc.Check( TRUE );
+ ClickHdl( &maMemSysAlloc );
+ }
+ maMemSysAlloc.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
+ maMemSysAlloc.SetPosSizePixel( LogicToPixel( Point( 270, 65 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maBox2.Show();
+ maBox2.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Memory Tests" ) ) );
+ maBox2.SetPosSizePixel( LogicToPixel( Point( 5, 40 ), aAppMap ),
+ LogicToPixel( Size( 330, 40 ), aAppMap ) );
+ }
+
+ {
+ maProf.Show();
+ maProf.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Profiling" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_PROFILING )
+ maProf.Check( TRUE );
+ maProf.SetPosSizePixel( LogicToPixel( Point( 10, 95 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maRes.Show();
+ maRes.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Resourcen" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_RESOURCE )
+ maRes.Check( TRUE );
+ maRes.SetPosSizePixel( LogicToPixel( Point( 75, 95 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maDialog.Show();
+ maDialog.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Dialog" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_DIALOG )
+ maDialog.Check( TRUE );
+ maDialog.SetPosSizePixel( LogicToPixel( Point( 140, 95 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maBoldAppFont.Show();
+ maBoldAppFont.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Bold AppFont" ) ) );
+ if ( pData->nTestFlags & DBG_TEST_BOLDAPPFONT )
+ maBoldAppFont.Check( TRUE );
+ maBoldAppFont.SetPosSizePixel( LogicToPixel( Point( 205, 95 ), aAppMap ),
+ aButtonSize );
+ maBoldAppFont.SaveValue();
+ }
+
+ {
+ maBox3.Show();
+ maBox3.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Test Options" ) ) );
+ maBox3.SetPosSizePixel( LogicToPixel( Point( 5, 85 ), aAppMap ),
+ LogicToPixel( Size( 330, 30 ), aAppMap ) );
+ }
+
+ {
+ maDebugName.Show();
+ maDebugName.SetText( XubString( pData->aDebugName, RTL_TEXTENCODING_UTF8 ) );
+ maDebugName.SetMaxTextLen( sizeof( pData->aDebugName ) );
+ maDebugName.SetPosSizePixel( LogicToPixel( Point( 10, 130 ), aAppMap ),
+ LogicToPixel( Size( 185, 14 ), aAppMap ) );
+ }
+
+ {
+ maOverwrite.Show();
+ maOverwrite.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Overwrite ~File" ) ) );
+ if ( pData->bOverwrite )
+ maOverwrite.Check( TRUE );
+ maOverwrite.SetPosSizePixel( LogicToPixel( Point( 205, 130 ), aAppMap ),
+ aButtonSize );
+ }
+
+ {
+ maInclClassText.Show();
+ maInclClassText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Include-ObjectTest-Filter" ) ) );
+ maInclClassText.SetPosSizePixel( LogicToPixel( Point( 10, 150 ), aAppMap ),
+ LogicToPixel( Size( 95, 9 ), aAppMap ) );
+ }
+
+ {
+ maInclClassFilter.Show();
+ maInclClassFilter.SetText( XubString( pData->aInclClassFilter, RTL_TEXTENCODING_UTF8 ) );
+ maInclClassFilter.SetMaxTextLen( sizeof( pData->aInclClassFilter ) );
+ maInclClassFilter.SetPosSizePixel( LogicToPixel( Point( 10, 160 ), aAppMap ),
+ LogicToPixel( Size( 95, 14 ), aAppMap ) );
+ }
+
+ {
+ maExclClassText.Show();
+ maExclClassText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exclude-ObjectTest-Filter" ) ) );
+ maExclClassText.SetPosSizePixel( LogicToPixel( Point( 115, 150 ), aAppMap ),
+ LogicToPixel( Size( 95, 9 ), aAppMap ) );
+ }
+
+ {
+ maExclClassFilter.Show();
+ maExclClassFilter.SetText( XubString( pData->aExclClassFilter, RTL_TEXTENCODING_UTF8 ) );
+ maExclClassFilter.SetMaxTextLen( sizeof( pData->aExclClassFilter ) );
+ maExclClassFilter.SetPosSizePixel( LogicToPixel( Point( 115, 160 ), aAppMap ),
+ LogicToPixel( Size( 95, 14 ), aAppMap ) );
+ }
+
+ {
+ maInclText.Show();
+ maInclText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Include-Filter" ) ) );
+ maInclText.SetPosSizePixel( LogicToPixel( Point( 10, 180 ), aAppMap ),
+ LogicToPixel( Size( 95, 9 ), aAppMap ) );
+ }
+
+ {
+ maInclFilter.Show();
+ maInclFilter.SetText( XubString( pData->aInclFilter, RTL_TEXTENCODING_UTF8 ) );
+ maInclFilter.SetMaxTextLen( sizeof( pData->aInclFilter ) );
+ maInclFilter.SetPosSizePixel( LogicToPixel( Point( 10, 190 ), aAppMap ),
+ LogicToPixel( Size( 95, 14 ), aAppMap ) );
+ }
+
+ {
+ maExclText.Show();
+ maExclText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Exclude-Filter" ) ) );
+ maExclText.SetPosSizePixel( LogicToPixel( Point( 115, 180 ), aAppMap ),
+ LogicToPixel( Size( 95, 9 ), aAppMap ) );
+ }
+
+ {
+ maExclFilter.Show();
+ maExclFilter.SetText( XubString( pData->aExclFilter, RTL_TEXTENCODING_UTF8 ) );
+ maExclFilter.SetMaxTextLen( sizeof( pData->aExclFilter ) );
+ maExclFilter.SetPosSizePixel( LogicToPixel( Point( 115, 190 ), aAppMap ),
+ LogicToPixel( Size( 95, 14 ), aAppMap ) );
+ }
+
+ {
+ maTraceText.Show();
+ maTraceText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Trace" ) ) );
+ maTraceText.SetPosSizePixel( LogicToPixel( Point( 10, 210 ), aAppMap ),
+ LogicToPixel( Size( 95, 9 ), aAppMap ) );
+ }
+
+ {
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
+ maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
+ maTraceBox.SelectEntryPos( (USHORT)pData->nTraceOut );
+ maTraceBox.Show();
+ maTraceBox.SetPosSizePixel( LogicToPixel( Point( 10, 220 ), aAppMap ),
+ LogicToPixel( Size( 95, 80 ), aAppMap ) );
+ }
+
+ {
+ maWarningText.Show();
+ maWarningText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Warning" ) ) );
+ maWarningText.SetPosSizePixel( LogicToPixel( Point( 115, 210 ), aAppMap ),
+ LogicToPixel( Size( 95, 9 ), aAppMap ) );
+ }
+
+ {
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
+ maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
+ maWarningBox.SelectEntryPos( (USHORT)pData->nWarningOut );
+ maWarningBox.Show();
+ maWarningBox.SetPosSizePixel( LogicToPixel( Point( 115, 220 ), aAppMap ),
+ LogicToPixel( Size( 95, 80 ), aAppMap ) );
+ }
+
+ {
+ maErrorText.Show();
+ maErrorText.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Error" ) ) );
+ maErrorText.SetPosSizePixel( LogicToPixel( Point( 220, 210 ), aAppMap ),
+ LogicToPixel( Size( 95, 9 ), aAppMap ) );
+ }
+
+ {
+ if ( DbgIsAllErrorOut() )
+ {
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) );
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Window" ) ) );
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Shell" ) ) );
+ mnErrorOff = 0;
+ }
+ else
+ mnErrorOff = 4;
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
+ maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
+ maErrorBox.SelectEntryPos( (USHORT)pData->nErrorOut-mnErrorOff );
+ maErrorBox.Show();
+ maErrorBox.SetPosSizePixel( LogicToPixel( Point( 220, 220 ), aAppMap ),
+ LogicToPixel( Size( 95, 80 ), aAppMap ) );
+ }
+
+ {
+ maBox4.Show();
+ maBox4.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Output" ) ) );
+ maBox4.SetPosSizePixel( LogicToPixel( Point( 5, 120 ), aAppMap ),
+ LogicToPixel( Size( 330, 120 ), aAppMap ) );
+ }
+
+ {
+ maOKButton.Show();
+ maOKButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
+ maOKButton.SetPosSizePixel( LogicToPixel( Point( 10, 245 ), aAppMap ),
+ LogicToPixel( Size( 50, 15 ), aAppMap ) );
+ }
+ {
+ maCancelButton.Show();
+ maCancelButton.SetPosSizePixel( LogicToPixel( Point( 70, 245 ), aAppMap ),
+ LogicToPixel( Size( 50, 15 ), aAppMap ) );
+ }
+ {
+ maInfoButton.Show();
+ maInfoButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
+ maInfoButton.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Info..." ) ) );
+ maInfoButton.SetPosSizePixel( LogicToPixel( Point( 130, 245 ), aAppMap ),
+ LogicToPixel( Size( 50, 15 ), aAppMap ) );
+ }
+ {
+ maHelpButton.Show();
+ maHelpButton.SetPosSizePixel( LogicToPixel( Point( 190, 245 ), aAppMap ),
+ LogicToPixel( Size( 50, 15 ), aAppMap ) );
+ }
+
+ {
+#ifdef REMOTE_APPSERVER
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL Debug Options (Server)" ) ) );
+#else
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL Debug Options" ) ) );
+#endif
+ SetOutputSizePixel( LogicToPixel( Size( 340, 265 ), aAppMap ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
+{
+ if ( pButton == &maOKButton )
+ {
+ DbgData aData;
+
+ memcpy( &aData, DbgGetData(), sizeof( DbgData ) );
+ aData.nTestFlags = 0;
+
+ aData.nTraceOut = maTraceBox.GetSelectEntryPos();
+ aData.nWarningOut = maWarningBox.GetSelectEntryPos();
+ aData.nErrorOut = maErrorBox.GetSelectEntryPos()+mnErrorOff;
+
+ strncpy( aData.aDebugName, ByteString( maDebugName.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aDebugName ) );
+ strncpy( aData.aInclClassFilter, ByteString( maInclClassFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aInclClassFilter ) );
+ strncpy( aData.aExclClassFilter, ByteString( maExclClassFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aExclClassFilter ) );
+ strncpy( aData.aInclFilter, ByteString( maInclFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aInclFilter ) );
+ strncpy( aData.aExclFilter, ByteString( maExclFilter.GetText(), RTL_TEXTENCODING_UTF8 ).GetBuffer(), sizeof( aData.aExclFilter ) );
+ aData.aDebugName[sizeof( aData.aDebugName )-1] = '\0';
+ aData.aInclClassFilter[sizeof( aData.aInclClassFilter )-1] = '\0';
+ aData.aExclClassFilter[sizeof( aData.aExclClassFilter )-1] = '\0';
+ aData.aInclFilter[sizeof( aData.aInclFilter )-1] = '\0';
+ aData.aExclFilter[sizeof( aData.aExclFilter )-1] = '\0';
+
+ if ( maOverwrite.IsChecked() )
+ aData.bOverwrite = TRUE;
+ else
+ aData.bOverwrite = FALSE;
+
+ if ( maXtorThis.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_XTOR_THIS;
+
+ if ( maXtorFunc.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_XTOR_FUNC;
+
+ if ( maXtorExit.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_XTOR_EXIT;
+
+ if ( maXtorReport.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_XTOR_REPORT;
+
+ if ( maXtorTrace.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_XTOR_TRACE;
+
+ if ( maMemInit.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_INIT;
+
+ if ( maMemOverwrite.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_OVERWRITE;
+
+ if ( maMemOverwriteFree.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_OVERWRITEFREE;
+
+ if ( maMemPtr.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_POINTER;
+
+ if ( maMemReport.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_REPORT;
+
+ if ( maMemTrace.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_TRACE;
+
+ if ( maMemLeakReport.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_LEAKREPORT;
+
+ if ( maMemNewDel.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_NEWDEL;
+
+ if ( maMemXtor.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_XTOR;
+
+ if ( maMemSysAlloc.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_MEM_SYSALLOC;
+
+ if ( maProf.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_PROFILING;
+
+ if ( maRes.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_RESOURCE;
+
+ if ( maDialog.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_DIALOG;
+
+ if ( maBoldAppFont.IsChecked() )
+ aData.nTestFlags |= DBG_TEST_BOLDAPPFONT;
+
+ // Fensterposition mit abspeichern
+ DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
+ if ( pDbgWindow )
+ {
+ ByteString aState = pDbgWindow->GetWindowState();
+ if ( aState.Len() < sizeof( aData.aDbgWinState ) )
+ memcpy( aData.aDbgWinState, aState.GetBuffer(), aState.Len() );
+ }
+
+ // Daten speichern
+ DbgSaveData( aData );
+
+ // Umschalten der Laufzeitwerte
+ DBG_INSTOUTTRACE( aData.nTraceOut );
+ DBG_INSTOUTWARNING( aData.nWarningOut );
+ DBG_INSTOUTERROR( aData.nErrorOut );
+
+ DbgData* pData = DbgGetData();
+ pData->nTestFlags &= ~(DBG_TEST_XTOR_TRACE | DBG_TEST_MEM_INIT | DBG_TEST_RESOURCE | DBG_TEST_DIALOG | DBG_TEST_BOLDAPPFONT);
+ pData->nTestFlags |= aData.nTestFlags & (DBG_TEST_XTOR_TRACE | DBG_TEST_MEM_INIT | DBG_TEST_RESOURCE | DBG_TEST_DIALOG | DBG_TEST_BOLDAPPFONT);
+ strcpy( pData->aInclClassFilter, aData.aInclClassFilter );
+ strcpy( pData->aExclClassFilter, aData.aExclClassFilter );
+ strcpy( pData->aInclFilter, aData.aInclFilter );
+ strcpy( pData->aExclFilter, aData.aExclFilter );
+ if ( maBoldAppFont.GetSavedValue() != maBoldAppFont.IsChecked() )
+ {
+ AllSettings aSettings = Application::GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetAppFont();
+ if ( maBoldAppFont.IsChecked() )
+ aFont.SetWeight( WEIGHT_BOLD );
+ else
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aStyleSettings.SetAppFont( aFont );
+ aSettings.SetStyleSettings( aStyleSettings );
+ Application::SetSettings( aSettings );
+ }
+ EndDialog( TRUE );
+ }
+ else if ( pButton == &maInfoButton )
+ {
+ DbgInfoDialog aInfoDialog( this );
+ aDbgInfoBuf[0] = '\0';
+ DbgMemInfo( aDbgInfoBuf );
+ DbgXtorInfo( aDbgInfoBuf );
+ XubString aInfoText( aDbgInfoBuf, RTL_TEXTENCODING_UTF8 );
+ aInfoDialog.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug InfoReport" ) ) );
+ aInfoDialog.SetInfoText( aInfoText );
+ aInfoDialog.Execute();
+ }
+ else if ( pButton == &maMemSysAlloc )
+ {
+ BOOL bEnable = maMemSysAlloc.IsChecked() == 0;
+ maMemInit.Enable( bEnable );
+ maMemOverwrite.Enable( bEnable );
+ maMemOverwriteFree.Enable( bEnable );
+ maMemPtr.Enable( bEnable );
+ maMemReport.Enable( bEnable );
+ maMemTrace.Enable( bEnable );
+ maMemLeakReport.Enable( bEnable );
+ maMemNewDel.Enable( bEnable );
+ maMemXtor.Enable( bEnable );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void DbgDialog::RequestHelp( const HelpEvent& rHEvt )
+{
+ if ( rHEvt.GetMode() & HELPMODE_CONTEXT )
+ {
+ DbgInfoDialog aInfoDialog( this, TRUE );
+ XubString aHelpText;
+ sal_Char** pHelpStrs = pDbgHelpText;
+ while ( *pHelpStrs )
+ {
+ aHelpText.AppendAscii( *pHelpStrs );
+ pHelpStrs++;
+ }
+ aInfoDialog.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug Hilfe" ) ) );
+ aInfoDialog.SetInfoText( aHelpText );
+ aInfoDialog.Execute();
+ }
+}
+
+// =======================================================================
+
+DbgInfoDialog::DbgInfoDialog( Window* pParent, BOOL bHelpText ) :
+ ModalDialog( pParent, WB_STDMODAL ),
+ maListBox( this, WB_BORDER | WB_AUTOHSCROLL ),
+ maOKButton( this, WB_DEFBUTTON )
+{
+ mbHelpText = bHelpText;
+
+ if ( !bHelpText )
+ {
+ Font aFont = System::GetStandardFont( STDFONT_FIXED );
+ aFont.SetHeight( 8 );
+ aFont.SetPitch( PITCH_FIXED );
+ maListBox.SetControlFont( aFont );
+ }
+ maListBox.SetPosSizePixel( Point( 5, 5 ), Size( 630, 380 ) );
+ maListBox.Show();
+
+ maOKButton.SetPosSizePixel( Point( 290, 390 ), Size( 60, 25 ) );
+ maOKButton.Show();
+
+ SetOutputSizePixel( Size( 640, 420 ) );
+}
+
+// -----------------------------------------------------------------------
+
+void DbgInfoDialog::SetInfoText( const XubString& rStr )
+{
+ maListBox.SetUpdateMode( FALSE );
+ maListBox.Clear();
+ XubString aStr = rStr;
+ aStr.ConvertLineEnd( LINEEND_LF );
+ USHORT nIndex = 0;
+ USHORT nFoundIndex;
+ do
+ {
+ nFoundIndex = aStr.Search( _LF, nIndex );
+ XubString aTextParagraph = aStr.Copy( nIndex, nFoundIndex-nIndex );
+ if ( mbHelpText )
+ {
+ long nMaxWidth = maListBox.GetOutputSizePixel().Width()-30;
+ USHORT nLastIndex = 0;
+ USHORT nIndex = aTextParagraph.Search( ' ' );
+ while ( nIndex != STRING_NOTFOUND )
+ {
+ if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
+ {
+ if ( !nLastIndex )
+ nLastIndex = nIndex+1;
+ XubString aTempStr = aTextParagraph.Copy( 0, nLastIndex );
+ aTextParagraph.Erase( 0, nLastIndex );
+ maListBox.InsertEntry( aTempStr );
+ nLastIndex = 0;
+ }
+ else
+ nLastIndex = nIndex+1;
+ nIndex = aTextParagraph.Search( ' ', nLastIndex );
+ }
+
+ if ( maListBox.GetTextWidth( aTextParagraph, 0, nIndex ) > nMaxWidth )
+ {
+ if ( !nLastIndex )
+ nLastIndex = nIndex+1;
+ XubString aTempStr = aTextParagraph.Copy( 0, nLastIndex );
+ aTextParagraph.Erase( 0, nLastIndex );
+ maListBox.InsertEntry( aTempStr );
+ }
+ }
+ maListBox.InsertEntry( aTextParagraph );
+ nIndex = nFoundIndex+1;
+ }
+ while ( nFoundIndex != STRING_NOTFOUND );
+ maListBox.SetUpdateMode( TRUE );
+}
+
+// =======================================================================
+
+void DbgDialogTest( Window* pWindow )
+{
+ BOOL aAccelBuf[65536];
+ USHORT nChildCount = pWindow->GetChildCount();
+ Window* pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ Window* pChild;
+ Point aTabPos;
+
+ if ( !pGetChild )
+ return;
+
+ Rectangle* pRectAry = (Rectangle*)new long[(sizeof(Rectangle)*nChildCount)/sizeof(long)];
+ memset( aAccelBuf, 0, sizeof( aAccelBuf ) );
+ memset( pRectAry, 0, sizeof(Rectangle)*nChildCount );
+
+ if ( pWindow->IsDialog() )
+ {
+ BOOL bOKCancelButton = FALSE;
+ BOOL bDefPushButton = FALSE;
+ BOOL bButton = FALSE;
+ pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pGetChild )
+ {
+ pChild = pGetChild->ImplGetWindow();
+
+ if ( pChild->ImplIsPushButton() )
+ {
+ bButton = TRUE;
+ if ( (pChild->GetType() == WINDOW_OKBUTTON) || (pChild->GetType() == WINDOW_CANCELBUTTON) )
+ bOKCancelButton = TRUE;
+ if ( pChild->GetStyle() & WB_DEFBUTTON )
+ bDefPushButton = TRUE;
+ }
+
+ pGetChild = pGetChild->GetWindow( WINDOW_NEXT );
+ }
+
+ if ( bButton )
+ {
+ if ( !bOKCancelButton )
+ DbgError( "Dialogs should have a OK- or CancelButton" );
+ if ( !bDefPushButton )
+ DbgError( "Dialogs should have a Button with WB_DEFBUTTON" );
+ }
+ }
+
+ USHORT i = 0;
+ pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pGetChild )
+ {
+ pChild = pGetChild->ImplGetWindow();
+
+ if ( (pChild->GetType() != WINDOW_TABCONTROL) &&
+ (pChild->GetType() != WINDOW_TABPAGE) &&
+ (pChild->GetType() != WINDOW_GROUPBOX) )
+ {
+ XubString aText = pChild->GetText();
+ USHORT nAccelPos;
+ xub_Unicode cAccel = 0;
+ if ( aText.Len() )
+ {
+ nAccelPos = aText.Search( '~' );
+ if ( nAccelPos != STRING_NOTFOUND )
+ {
+ const International& rIntn = Application::GetSettings().GetInternational();
+ XubString aUpperText = rIntn.Upper( aText );
+ cAccel = aUpperText.GetChar( nAccelPos+1 );
+ if ( pChild->IsVisible() )
+ {
+ if ( aAccelBuf[cAccel] )
+ DbgOutTypef( DBG_OUT_ERROR, "Double mnemonic char: %c", cAccel );
+ else
+ aAccelBuf[cAccel] = TRUE;
+ }
+ }
+ }
+
+ if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
+ (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
+ (pChild->GetType() == WINDOW_CHECKBOX) ||
+ (pChild->GetType() == WINDOW_TRISTATEBOX) ||
+ (pChild->GetType() == WINDOW_PUSHBUTTON) )
+ {
+ if ( !cAccel && aText.Len() && !aText.EqualsAscii( "..." ) )
+ {
+ const char* pClass;
+ if ( pChild->GetType() == WINDOW_RADIOBUTTON )
+ pClass = "RadioButton";
+ else if ( pChild->GetType() == WINDOW_IMAGERADIOBUTTON )
+ pClass = "ImageRadioButton";
+ else if ( pChild->GetType() == WINDOW_CHECKBOX )
+ pClass = "CheckBox";
+ else if ( pChild->GetType() == WINDOW_TRISTATEBOX )
+ pClass = "TriStateBox";
+ else if ( pChild->GetType() == WINDOW_PUSHBUTTON )
+ pClass = "PushButton";
+ else
+ pClass = "Dontknow";
+ DbgOutTypef( DBG_OUT_ERROR,
+ "%s should have a mnemonic char (~): %s",
+ pClass,
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+ }
+
+ if ( pChild->GetType() == WINDOW_FIXEDTEXT )
+ {
+ if ( (pChild->GetSizePixel().Height() >= pChild->GetTextHeight()*2) &&
+ !(pChild->GetStyle() & WB_WORDBREAK) )
+ {
+ DbgOutTypef( DBG_OUT_ERROR,
+ "FixedText greater than one line, but WordBreak is not set: %s",
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+
+ if ( (i+1 < nChildCount) && aText.Len() )
+ {
+ Window* pTempChild = pGetChild->GetWindow( WINDOW_NEXT )->ImplGetWindow();
+ if ( (pTempChild->GetType() == WINDOW_EDIT) ||
+ (pTempChild->GetType() == WINDOW_MULTILINEEDIT) ||
+ (pTempChild->GetType() == WINDOW_SPINFIELD) ||
+ (pTempChild->GetType() == WINDOW_PATTERNFIELD) ||
+ (pTempChild->GetType() == WINDOW_NUMERICFIELD) ||
+ (pTempChild->GetType() == WINDOW_METRICFIELD) ||
+ (pTempChild->GetType() == WINDOW_CURRENCYFIELD) ||
+ (pTempChild->GetType() == WINDOW_DATEFIELD) ||
+ (pTempChild->GetType() == WINDOW_TIMEFIELD) ||
+ (pTempChild->GetType() == WINDOW_LISTBOX) ||
+ (pTempChild->GetType() == WINDOW_MULTILISTBOX) ||
+ (pTempChild->GetType() == WINDOW_COMBOBOX) ||
+ (pTempChild->GetType() == WINDOW_PATTERNBOX) ||
+ (pTempChild->GetType() == WINDOW_NUMERICBOX) ||
+ (pTempChild->GetType() == WINDOW_METRICBOX) ||
+ (pTempChild->GetType() == WINDOW_CURRENCYBOX) ||
+ (pTempChild->GetType() == WINDOW_DATEBOX) ||
+ (pTempChild->GetType() == WINDOW_TIMEBOX) )
+ {
+ if ( !cAccel )
+ {
+ DbgOutTypef( DBG_OUT_ERROR,
+ "Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+ if ( !pTempChild->IsEnabled() && pChild->IsEnabled() )
+ {
+ DbgOutTypef( DBG_OUT_ERROR,
+ "Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+ }
+ }
+ }
+
+ if ( pChild->GetType() == WINDOW_MULTILINEEDIT )
+ {
+ if ( !(pChild->GetStyle() & WB_IGNORETAB) )
+ {
+ DbgOutTypef( DBG_OUT_ERROR,
+ "MultiLineEdits in Dialogs should have the Style WB_IGNORETAB: %s",
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+ }
+
+ if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
+ (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
+ (pChild->GetType() == WINDOW_CHECKBOX) ||
+ (pChild->GetType() == WINDOW_TRISTATEBOX) ||
+ (pChild->GetType() == WINDOW_FIXEDTEXT) )
+ {
+ pChild->SetBackground( Wallpaper( Color( COL_LIGHTGREEN ) ) );
+ }
+
+ if ( pChild->IsVisible() )
+ {
+ BOOL bMaxWarning = FALSE;
+ if ( pChild->GetType() == WINDOW_NUMERICFIELD )
+ {
+ NumericField* pField = (NumericField*)pChild;
+ if ( pField->GetMax() == LONG_MAX )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_METRICFIELD )
+ {
+ MetricField* pField = (MetricField*)pChild;
+ if ( pField->GetMax() == LONG_MAX )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_CURRENCYFIELD )
+ {
+ CurrencyField* pField = (CurrencyField*)pChild;
+ if ( pField->GetMax() == LONG_MAX )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_TIMEFIELD )
+ {
+ TimeField* pField = (TimeField*)pChild;
+ if ( pField->GetMax() == Time( 23, 59, 59, 99 ) )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_DATEFIELD )
+ {
+ DateField* pField = (DateField*)pChild;
+ if ( pField->GetMax() == Date( 31, 12, 9999 ) )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_NUMERICBOX )
+ {
+ NumericBox* pBox = (NumericBox*)pChild;
+ if ( pBox->GetMax() == LONG_MAX )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_METRICBOX )
+ {
+ MetricBox* pBox = (MetricBox*)pChild;
+ if ( pBox->GetMax() == LONG_MAX )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_CURRENCYBOX )
+ {
+ CurrencyBox* pBox = (CurrencyBox*)pChild;
+ if ( pBox->GetMax() == LONG_MAX )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_TIMEBOX )
+ {
+ TimeBox* pBox = (TimeBox*)pChild;
+ if ( pBox->GetMax() == Time( 23, 59, 59, 99 ) )
+ bMaxWarning = TRUE;
+ }
+ else if ( pChild->GetType() == WINDOW_DATEBOX )
+ {
+ DateBox* pBox = (DateBox*)pChild;
+ if ( pBox->GetMax() == Date( 31, 12, 9999 ) )
+ bMaxWarning = TRUE;
+ }
+ if ( bMaxWarning )
+ {
+ DbgOutTypef( DBG_OUT_ERROR,
+ "No Max-Value is set: %s",
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+
+ if ( (pChild->GetType() == WINDOW_RADIOBUTTON) ||
+ (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) ||
+ (pChild->GetType() == WINDOW_CHECKBOX) ||
+ (pChild->GetType() == WINDOW_TRISTATEBOX) ||
+ (pChild->GetType() == WINDOW_PUSHBUTTON) ||
+ (pChild->GetType() == WINDOW_OKBUTTON) ||
+ (pChild->GetType() == WINDOW_CANCELBUTTON) ||
+ (pChild->GetType() == WINDOW_HELPBUTTON) ||
+ (pChild->GetType() == WINDOW_IMAGEBUTTON) ||
+ (pChild->GetType() == WINDOW_FIXEDTEXT) ||
+ (pChild->GetType() == WINDOW_EDIT) ||
+ (pChild->GetType() == WINDOW_MULTILINEEDIT) ||
+ (pChild->GetType() == WINDOW_SPINFIELD) ||
+ (pChild->GetType() == WINDOW_PATTERNFIELD) ||
+ (pChild->GetType() == WINDOW_NUMERICFIELD) ||
+ (pChild->GetType() == WINDOW_METRICFIELD) ||
+ (pChild->GetType() == WINDOW_CURRENCYFIELD) ||
+ (pChild->GetType() == WINDOW_DATEFIELD) ||
+ (pChild->GetType() == WINDOW_TIMEFIELD) ||
+ (pChild->GetType() == WINDOW_LISTBOX) ||
+ (pChild->GetType() == WINDOW_MULTILISTBOX) ||
+ (pChild->GetType() == WINDOW_COMBOBOX) ||
+ (pChild->GetType() == WINDOW_PATTERNBOX) ||
+ (pChild->GetType() == WINDOW_NUMERICBOX) ||
+ (pChild->GetType() == WINDOW_METRICBOX) ||
+ (pChild->GetType() == WINDOW_CURRENCYBOX) ||
+ (pChild->GetType() == WINDOW_DATEBOX) ||
+ (pChild->GetType() == WINDOW_TIMEBOX) )
+ {
+ Point aNewPos = pChild->GetPosPixel();
+ Rectangle aChildRect( aNewPos, pChild->GetSizePixel() );
+
+ if ( cAccel || (pChild->GetStyle() & WB_TABSTOP) ||
+ (pChild->GetType() == WINDOW_RADIOBUTTON) ||
+ (pChild->GetType() == WINDOW_IMAGERADIOBUTTON) )
+ {
+ if ( (aNewPos.X() <= aTabPos.X()) && (aNewPos.Y() <= aTabPos.Y()) )
+ {
+ DbgOutTypef( DBG_OUT_ERROR,
+ "Possible wrong childorder for dialogcontrol: %s",
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+ aTabPos = aNewPos;
+ }
+
+ for ( USHORT j = 0; j < i; j++ )
+ {
+ if ( ((pRectAry[j].Right() != 0) || (pRectAry[j].Bottom() != 0)) &&
+ aChildRect.IsOver( pRectAry[j] ) )
+ {
+ DbgOutTypef( DBG_OUT_ERROR,
+ "Window overlaps with sibling window: %s",
+ ByteString( aText, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+ }
+ }
+ pRectAry[i] = aChildRect;
+ }
+ }
+ }
+
+ pGetChild = pGetChild->GetWindow( WINDOW_NEXT );
+ i++;
+ }
+
+ delete pRectAry;
+}
+
+// =======================================================================
+
+void DbgPrintMsgBox( const char* pLine )
+{
+ if ( Application::IsDialogCancelEnabled() )
+ {
+#if defined( WNT )
+ if ( GetSystemMetrics( SM_DEBUG ) )
+ {
+ strcpy( aDbgOutBuf, pLine );
+ strcat( aDbgOutBuf, "\r\n" );
+ OutputDebugString( aDbgOutBuf );
+ return;
+ }
+#endif
+#ifdef UNX
+ fprintf( stderr, "%s\n", pLine );
+ return;
+#else
+ DbgPrintFile( pLine );
+ return;
+#endif
+ }
+
+ strcpy( aDbgOutBuf, pLine );
+ strcat( aDbgOutBuf, "\nAbort ? (Yes=abort / No=ignore / Cancel=core dump)" );
+
+ // Tracking beenden und Mouse freigeben, damit die Boxen nicht haengen
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maWinData.mpTrackWin )
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ if ( pSVData->maWinData.mpCaptureWin )
+ pSVData->maWinData.mpCaptureWin->ReleaseMouse();
+
+#ifndef REMOTE_APPSERVER
+#if defined( WNT )
+ BOOL bOldCallTimer = pSVData->mbNoCallTimer;
+ pSVData->mbNoCallTimer = TRUE;
+ short nRet = (short)MessageBox( 0, (LPSTR)aDbgOutBuf, "Debug Output",
+ MB_TASKMODAL | MB_YESNOCANCEL |
+ MB_DEFBUTTON2 | MB_ICONSTOP );
+ MessageBeep( MB_ICONHAND );
+ pSVData->mbNoCallTimer = bOldCallTimer;
+ switch ( nRet )
+ {
+ case IDYES:
+ nRet = RET_YES;
+ break;
+ case IDNO:
+ nRet = RET_NO;
+ break;
+ case IDCANCEL:
+ nRet = RET_CANCEL;
+ break;
+ }
+#elif defined( OS2 )
+ BOOL bOldCallTimer = pSVData->mbNoCallTimer;
+ pSVData->mbNoCallTimer = TRUE;
+ PM_ULONG nRet = WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
+ (PSZ)aDbgOutBuf, (PSZ)"Debug Output", 0,
+ MB_APPLMODAL | MB_MOVEABLE |
+ MB_YESNOCANCEL | MB_DEFBUTTON2 |
+ MB_ERROR );
+ pSVData->mbNoCallTimer = bOldCallTimer;
+ switch ( nRet )
+ {
+ case MBID_YES:
+ nRet = RET_YES;
+ break;
+ case MBID_NO:
+ nRet = RET_NO;
+ break;
+ case MBID_CANCEL:
+ nRet = RET_CANCEL;
+ break;
+ }
+#else
+ USHORT nOldMode = Application::GetSystemWindowMode();
+ Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
+ ErrorBox aBox( Application::GetAppWindow(), WB_YES_NO_CANCEL | WB_DEF_NO,
+ UniString( aDbgOutBuf, RTL_TEXTENCODING_UTF8 ) );
+ aBox.SetText( String( RTL_CONSTASCII_USTRINGPARAM("Debug Output") ) );
+ Application::SetSystemWindowMode( nOldMode );
+ short nRet = aBox.Execute();
+#endif
+#else
+ USHORT nOldMode = Application::GetSystemWindowMode();
+ Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
+ ErrorBox aBox( Application::GetAppWindow(), WB_YES_NO_CANCEL | WB_DEF_NO,
+ UniString( aDbgOutBuf, RTL_TEXTENCODING_UTF8 ) );
+ aBox.SetText( String( RTL_CONSTASCII_USTRINGPARAM("Debug Output (Server)") ) );
+ Application::SetSystemWindowMode( nOldMode );
+ short nRet = aBox.Execute();
+#endif
+
+ if ( nRet == RET_YES )
+ GetpApp()->Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debug-Utilities-Error" ) ) );
+ else if ( nRet == RET_CANCEL )
+ DbgCoreDump();
+}
+
+// -----------------------------------------------------------------------
+
+void DbgPrintWindow( const char* pLine )
+{
+ static BOOL bIn = FALSE;
+
+ // keine rekursiven Traces
+ if ( bIn )
+ return;
+ bIn = TRUE;
+
+ DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
+ if ( !pDbgWindow )
+ {
+ pDbgWindow = new DbgWindow;
+ ImplGetSVData()->maWinData.mpDbgWin = pDbgWindow;
+ }
+
+ pDbgWindow->InsertLine( XubString( pLine, RTL_TEXTENCODING_UTF8 ) );
+
+ bIn = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void DbgPrintShell( const char* pLine )
+{
+#if defined( WNT )
+ if ( GetSystemMetrics( SM_DEBUG ) )
+ {
+ strcpy( aDbgOutBuf, pLine );
+ strcat( aDbgOutBuf, "\r\n" );
+ OutputDebugString( aDbgOutBuf );
+ return;
+ }
+#endif
+#ifdef UNX
+ fprintf( stderr, "%s\n", pLine );
+ return;
+#endif
+
+ DbgPrintWindow( pLine );
+}
+
+// =======================================================================
+
+#if defined( REMOTE_APPSERVER ) || defined( WNT ) || defined( OS2 )
+void ImplDbgTestSolarMutex();
+#endif
+
+// =======================================================================
+
+void DbgGUIInit()
+{
+ DbgSetPrintMsgBox( DbgPrintMsgBox );
+ DbgSetPrintWindow( DbgPrintWindow );
+ DbgSetPrintShell( DbgPrintShell );
+#if defined( REMOTE_APPSERVER ) || defined( WNT ) || defined( OS2 )
+ DbgSetTestSolarMutex( ImplDbgTestSolarMutex );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void DbgGUIDeInit()
+{
+ DbgSetPrintMsgBox( NULL );
+ DbgSetPrintWindow( NULL );
+ DbgSetPrintShell( NULL );
+#if defined( REMOTE_APPSERVER ) || defined( WNT ) || defined( OS2 )
+ DbgSetTestSolarMutex( NULL );
+#endif
+
+ DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
+ if ( pDbgWindow )
+ delete pDbgWindow;
+}
+
+// -----------------------------------------------------------------------
+
+void DbgGUIStart()
+{
+ DbgData* pData = DbgGetData();
+
+ if ( pData )
+ {
+ DbgDialog* pDialog = new DbgDialog;
+ // Fuer den Debug-Dialog schalten wir Dialogtests aus
+ ULONG nOldFlags = pData->nTestFlags;
+ pData->nTestFlags &= ~DBG_TEST_DIALOG;
+ if ( !pDialog->Execute() )
+ pData->nTestFlags |= (nOldFlags & DBG_TEST_DIALOG);
+ delete pDialog;
+ }
+ else
+ {
+ ErrorBox( 0, WB_OK,
+ XubString( RTL_CONSTASCII_USTRINGPARAM( "TOOLS Library has no Debug-Routines" ) ) ).Execute();
+ }
+}
+
+#endif // DBG_UTIL
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
new file mode 100644
index 000000000000..91343819c168
--- /dev/null
+++ b/vcl/source/app/help.cxx
@@ -0,0 +1,686 @@
+/*************************************************************************
+ *
+ * $RCSfile: help.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_HELP_CXX
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_HELPWIN_HXX
+#include <helpwin.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define HELPWINSTYLE_QUICK 0
+#define HELPWINSTYLE_BALLOON 1
+
+#define HELPTEXTMARGIN_QUICK 3
+#define HELPTEXTMARGIN_BALLOON 6
+
+#define HELPDELAY_NORMAL 1
+#define HELPDELAY_SHORT 2
+#define HELPDELAY_NONE 3
+
+// =======================================================================
+
+Help::Help()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::Start( ULONG )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::Start( const XubString& )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+XubString Help::GetHelpText( ULONG nHelpId )
+{
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void Help::EnableContextHelp()
+{
+ ImplGetSVData()->maHelpData.mbContextHelp = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::DisableContextHelp()
+{
+ ImplGetSVData()->maHelpData.mbContextHelp = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::IsContextHelpEnabled()
+{
+ return ImplGetSVData()->maHelpData.mbContextHelp;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::StartContextHelp()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maHelpData.mbContextHelp )
+ {
+ Window* pWindow = pSVData->maWinData.mpFocusWin;
+ if ( pWindow )
+ {
+ Point aMousePos = pWindow->OutputToScreenPixel( pWindow->GetPointerPosPixel() );
+ HelpEvent aHelpEvent( aMousePos, HELPMODE_CONTEXT );
+ pWindow->RequestHelp( aHelpEvent );
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::EnableExtHelp()
+{
+ ImplGetSVData()->maHelpData.mbExtHelp = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::DisableExtHelp()
+{
+ ImplGetSVData()->maHelpData.mbExtHelp = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::IsExtHelpEnabled()
+{
+ return ImplGetSVData()->maHelpData.mbExtHelp;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::StartExtHelp()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maHelpData.mbExtHelp && !pSVData->maHelpData.mbExtHelpMode )
+ {
+ pSVData->maHelpData.mbExtHelpMode = TRUE;
+ pSVData->maHelpData.mbOldBalloonMode = pSVData->maHelpData.mbBalloonHelp;
+ pSVData->maHelpData.mbBalloonHelp = TRUE;
+ if ( pSVData->maWinData.mpAppWin )
+ pSVData->maWinData.mpAppWin->ImplGenerateMouseMove();
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::EndExtHelp()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maHelpData.mbExtHelp && pSVData->maHelpData.mbExtHelpMode )
+ {
+ pSVData->maHelpData.mbExtHelpMode = FALSE;
+ pSVData->maHelpData.mbBalloonHelp = pSVData->maHelpData.mbOldBalloonMode;
+ if ( pSVData->maWinData.mpAppWin )
+ pSVData->maWinData.mpAppWin->ImplGenerateMouseMove();
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::IsExtHelpActive()
+{
+ return ImplGetSVData()->maHelpData.mbExtHelpMode;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::EnableBalloonHelp()
+{
+ ImplGetSVData()->maHelpData.mbBalloonHelp = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::DisableBalloonHelp()
+{
+ ImplGetSVData()->maHelpData.mbBalloonHelp = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::IsBalloonHelpEnabled()
+{
+ return ImplGetSVData()->maHelpData.mbBalloonHelp;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::ShowBalloon( Window* pParent,
+ const Point& rScreenPos,
+ const XubString& rHelpText )
+{
+ ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0,
+ rHelpText, ImplGetSVEmptyStr(), rScreenPos );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::ShowBalloon( Window* pParent,
+ const Point& rScreenPos, const Rectangle& rRect,
+ const XubString& rHelpText )
+{
+ ImplShowHelpWindow( pParent, HELPWINSTYLE_BALLOON, 0,
+ rHelpText, ImplGetSVEmptyStr(), rScreenPos, &rRect );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::EnableQuickHelp()
+{
+ ImplGetSVData()->maHelpData.mbQuickHelp = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::DisableQuickHelp()
+{
+ ImplGetSVData()->maHelpData.mbQuickHelp = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::IsQuickHelpEnabled()
+{
+ return ImplGetSVData()->maHelpData.mbQuickHelp;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Help::ShowQuickHelp( Window* pParent,
+ const Rectangle& rScreenRect,
+ const XubString& rHelpText,
+ const XubString& rLongHelpText,
+ USHORT nStyle )
+{
+ ImplShowHelpWindow( pParent, HELPWINSTYLE_QUICK, nStyle,
+ rHelpText, rLongHelpText,
+ pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rScreenRect );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Help::ShowTip( Window* pParent, const Rectangle& rRect,
+ const XubString& rText, USHORT nStyle )
+{
+ USHORT nHelpWinStyle = HELPWINSTYLE_QUICK;
+ HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle );
+
+ Size aSz = pHelpWin->CalcOutSize();
+ pHelpWin->SetOutputSizePixel( aSz );
+ ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle,
+ pParent->OutputToScreenPixel( pParent->GetPointerPosPixel() ), &rRect );
+ pHelpWin->ShowHelp( HELPDELAY_NONE );
+ return (ULONG)pHelpWin;
+}
+
+// -----------------------------------------------------------------------
+
+void Help::HideTip( ULONG nId )
+{
+ HelpTextWindow* pHelpWin = (HelpTextWindow*)nId;
+ Window* pFrameWindow = pHelpWin->ImplGetFrameWindow();
+ pHelpWin->Hide();
+ // Update ausloesen, damit ein Paint sofort ausgeloest wird, da
+ // wir den Hintergrund nicht sichern
+ pFrameWindow->ImplUpdateAll();
+ delete pHelpWin;
+}
+
+// =======================================================================
+
+HelpTextWindow::HelpTextWindow( Window* pParent, const XubString& rText, USHORT nHelpWinStyle, USHORT nStyle ) :
+ FloatingWindow( pParent->ImplGetFrameWindow(), 0 ),
+ maHelpText( rText )
+{
+ ImplSetMouseTransparent( TRUE );
+ mnHelpWinStyle = nHelpWinStyle;
+ mnStyle = nStyle;
+
+ EnableAlwaysOnTop();
+ EnableSaveBackground();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetPointFont( rStyleSettings.GetHelpFont() );
+ SetTextColor( rStyleSettings.GetHelpTextColor() );
+ SetTextAlign( ALIGN_TOP );
+ SetBackground( Wallpaper( rStyleSettings.GetHelpColor() ) );
+ SetLineColor( COL_BLACK );
+ SetFillColor();
+
+ if ( mnHelpWinStyle == HELPWINSTYLE_QUICK )
+ {
+ Size aSize;
+ aSize.Height() = GetTextHeight();
+ if ( mnStyle & QUICKHELP_CTRLTEXT )
+ aSize.Width() = GetCtrlTextWidth( maHelpText );
+ else
+ aSize.Width() = GetTextWidth( maHelpText );
+ maTextRect = Rectangle( Point( HELPTEXTMARGIN_QUICK, HELPTEXTMARGIN_QUICK ), aSize );
+ }
+ else // HELPWINSTYLE_BALLOON
+ {
+ Point aTmpPoint;
+ USHORT nCharsInLine = 35 + ((maHelpText.Len()/100)*5);
+ XubString aXXX;
+ aXXX.Fill( nCharsInLine, 'x' ); // Durchschnittliche Breite, damit nicht jedes Fenster anders.
+ long nWidth = GetTextWidth( aXXX );
+ Size aTmpSize( nWidth, 0x7FFFFFFF );
+ Rectangle aTry1( aTmpPoint, aTmpSize );
+ USHORT nDrawFlags = TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK |
+ TEXT_DRAW_LEFT | TEXT_DRAW_TOP;
+ if ( mnStyle & QUICKHELP_CTRLTEXT )
+ nDrawFlags |= TEXT_DRAW_MNEMONIC;
+ Rectangle aTextRect = GetTextRect( aTry1, maHelpText, nDrawFlags );
+
+ // Spaeter mal eine geeignete Breite ermitteln...
+ maTextRect = aTextRect;
+
+ // Sicherheitsabstand...
+ maTextRect.SetPos( Point( HELPTEXTMARGIN_BALLOON, HELPTEXTMARGIN_BALLOON ) );
+ }
+
+ const HelpSettings& rHelpSettings = GetSettings().GetHelpSettings();
+ maShowTimer.SetTimeoutHdl( LINK( this, HelpTextWindow, TimerHdl ) );
+ maHideTimer.SetTimeoutHdl( LINK( this, HelpTextWindow, TimerHdl ) );
+ maHideTimer.SetTimeout( rHelpSettings.GetTipTimeout() );
+}
+
+// -----------------------------------------------------------------------
+
+HelpTextWindow::~HelpTextWindow()
+{
+ maShowTimer.Stop();
+ maHideTimer.Stop();
+
+ if ( maStatusText.Len() )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->mpApp->HideHelpStatusText();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HelpTextWindow::ImplShow()
+{
+ if ( maStatusText.Len() )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->mpApp->ShowHelpStatusText( maStatusText );
+ }
+ Show();
+ Update();
+}
+
+// -----------------------------------------------------------------------
+
+void HelpTextWindow::Paint( const Rectangle& )
+{
+ // Border zeichen
+ // .....
+
+ if ( mnHelpWinStyle == HELPWINSTYLE_QUICK )
+ {
+ if ( mnStyle & QUICKHELP_CTRLTEXT )
+ DrawCtrlText( maTextRect.TopLeft(), maHelpText );
+ else
+ DrawText( maTextRect.TopLeft(), maHelpText );
+ }
+ else // HELPWINSTYLE_BALLOON
+ {
+ USHORT nDrawFlags = TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK|
+ TEXT_DRAW_LEFT|TEXT_DRAW_TOP;
+ if ( mnStyle & QUICKHELP_CTRLTEXT )
+ nDrawFlags |= TEXT_DRAW_MNEMONIC;
+ DrawText( maTextRect, maHelpText, nDrawFlags );
+ }
+
+ // Umrandung
+ Size aSz = GetOutputSizePixel();
+ DrawRect( Rectangle( Point(), aSz ) );
+ if ( mnHelpWinStyle == HELPWINSTYLE_BALLOON )
+ {
+ aSz.Width() -= 2;
+ aSz.Height() -= 2;
+ Color aColor( GetLineColor() );
+ SetLineColor( ( COL_GRAY ) );
+ DrawRect( Rectangle( Point( 1, 1 ), aSz ) );
+ SetLineColor( aColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void HelpTextWindow::ShowHelp( USHORT nDelayMode )
+{
+ ULONG nTimeout = 0;
+ if ( nDelayMode != HELPDELAY_NONE )
+ {
+ // Im ExtendedHelp-Fall die Hilfe schneller anzeigen
+ if ( ImplGetSVData()->maHelpData.mbExtHelpMode )
+ nTimeout = 15;
+ else
+ {
+ const HelpSettings& rHelpSettings = GetSettings().GetHelpSettings();
+ if ( mnHelpWinStyle == HELPWINSTYLE_QUICK )
+ nTimeout = rHelpSettings.GetTipDelay();
+ else
+ nTimeout = rHelpSettings.GetBalloonDelay();
+ }
+
+ if ( nDelayMode == HELPDELAY_SHORT )
+ nTimeout /= 3;
+ }
+
+ maShowTimer.SetTimeout( nTimeout );
+ maShowTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( HelpTextWindow, TimerHdl, Timer*, pTimer)
+{
+ if ( pTimer == &maShowTimer )
+ {
+ ImplShow();
+ if ( mnHelpWinStyle == HELPWINSTYLE_QUICK )
+ {
+ // Auto-Hide nicht bei einem Tip-Fenster (ShowTip)
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( this == pSVData->maHelpData.mpHelpWin )
+ maHideTimer.Start();
+ }
+ }
+ else
+ {
+ Hide();
+ ImplDestroyHelpWindow();
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+Size HelpTextWindow::CalcOutSize() const
+{
+ Size aSz = maTextRect.GetSize();
+ aSz.Width() += 2*maTextRect.Left();
+ aSz.Height() += 2*maTextRect.Top();
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+void HelpTextWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ // Nur damit nicht von Window::RequestHelp() ein
+ // ShowQuickHelp/ShowBalloonHelp am HelpTextWindow aufgerufen wird.
+}
+
+// =======================================================================
+
+
+void ImplShowHelpWindow( Window* pParent, USHORT nHelpWinStyle, USHORT nStyle,
+ const XubString& rHelpText, const XubString& rStatusText,
+ const Point& rScreenPos, const Rectangle* pHelpArea )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
+ USHORT nDelayMode = HELPDELAY_NORMAL;
+ if ( pHelpWin )
+ {
+ DBG_ASSERT( pHelpWin != pParent, "HelpInHelp ?!" );
+
+ if ( ( pHelpWin->GetHelpText() != rHelpText ) ||
+ ( pHelpWin->GetWinStyle() != nHelpWinStyle ) ||
+ ( pHelpArea && ( pHelpWin->GetHelpArea() != *pHelpArea ) ) )
+ {
+ // Fenster wegnehmen wenn kein HelpText oder anderer HelpText oder
+ // anderer Modus.
+ if ( pHelpWin->IsVisible() )
+ nDelayMode = HELPDELAY_SHORT; // Wenn schon vorher Quick-Hilfe, dann jetzt auch schnell
+ pHelpWin = NULL;
+ ImplDestroyHelpWindow();
+ }
+ else if ( !pHelpWin->IsVisible() )
+ {
+ // Dann die Position der Maus annaehren...
+ ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, pHelpArea );
+ }
+ }
+
+ if ( !pHelpWin && rHelpText.Len() )
+ {
+ DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" );
+ pHelpWin = new HelpTextWindow( pParent, rHelpText, nHelpWinStyle, nStyle );
+ pSVData->maHelpData.mpHelpWin = pHelpWin;
+ pHelpWin->SetStatusText( rStatusText );
+ if ( pHelpArea )
+ pHelpWin->SetHelpArea( *pHelpArea );
+
+// Positionieren...
+ Size aSz = pHelpWin->CalcOutSize();
+ pHelpWin->SetOutputSizePixel( aSz );
+ ImplSetHelpWindowPos( pHelpWin, nHelpWinStyle, nStyle, rScreenPos, pHelpArea );
+ // Wenn nicht aus Window::RequestHelp, dann ohne Delay...
+ if ( !pSVData->maHelpData.mbRequestingHelp )
+ nDelayMode = HELPDELAY_NONE;
+ pHelpWin->ShowHelp( nDelayMode );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDestroyHelpWindow( BOOL bUpdate )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ HelpTextWindow* pHelpWin = pSVData->maHelpData.mpHelpWin;
+ if ( pHelpWin )
+ {
+ pSVData->maHelpData.mpHelpWin = NULL;
+ pHelpWin->Hide();
+ if ( bUpdate )
+ {
+ // Update ausloesen, damit ein Paint sofort ausgeloest wird, da
+ // wir den Hintergrund nicht sichern
+ Window* pFrameWindow = pHelpWin->ImplGetFrameWindow();
+ pFrameWindow->ImplUpdateAll();
+ }
+ delete pHelpWin;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSetHelpWindowPos( Window* pHelpWin, USHORT nHelpWinStyle, USHORT nStyle,
+ const Point& rPos, const Rectangle* pHelpArea )
+{
+ Point aPos = rPos;
+ Size aSz = pHelpWin->GetSizePixel();
+ Rectangle aScreenRect = pHelpWin->ImplGetFrameWindow()->GetDesktopRectPixel();
+ if ( nHelpWinStyle == HELPWINSTYLE_QUICK )
+ {
+ if ( !(nStyle & QUICKHELP_NOAUTOPOS) )
+ {
+ long nScreenHeight = aScreenRect.GetHeight();
+ aPos.X() -= 4;
+ if ( aPos.Y() > aScreenRect.Top()+nScreenHeight-(nScreenHeight/4) )
+ aPos.Y() -= aSz.Height()+4;
+ else
+ aPos.Y() += 21;
+ }
+ }
+ else
+ {
+ // Wenn es die Maus-Position ist, dann Fenster leicht versetzt
+ // anzeigen, damit MousePointer nicht das Hilfe-Fenster verdeckt
+ if ( aPos == pHelpWin->OutputToScreenPixel( pHelpWin->GetPointerPosPixel() ) )
+ {
+ aPos.X() += 12;
+ aPos.Y() += 16;
+ }
+ }
+
+ if ( nStyle & QUICKHELP_NOAUTOPOS )
+ {
+ if ( pHelpArea )
+ {
+ // Welche Position vom Rechteck?
+ aPos = pHelpArea->Center();
+
+ if ( nStyle & QUICKHELP_LEFT )
+ aPos.X() = pHelpArea->Left();
+ else if ( nStyle & QUICKHELP_RIGHT )
+ aPos.X() = pHelpArea->Right();
+
+ if ( nStyle & QUICKHELP_TOP )
+ aPos.Y() = pHelpArea->Top();
+ else if ( nStyle & QUICKHELP_BOTTOM )
+ aPos.Y() = pHelpArea->Bottom();
+ }
+
+ // Welche Richtung?
+ if ( nStyle & QUICKHELP_LEFT )
+ ;
+ else if ( nStyle & QUICKHELP_RIGHT )
+ aPos.X() -= aSz.Width();
+ else
+ aPos.X() -= aSz.Width()/2;
+
+ if ( nStyle & QUICKHELP_TOP )
+ ;
+ else if ( nStyle & QUICKHELP_BOTTOM )
+ aPos.Y() -= aSz.Height();
+ else
+ aPos.Y() -= aSz.Height()/2;
+ }
+
+ if ( aPos.X() < aScreenRect.Left() )
+ aPos.X() = aScreenRect.Left();
+ else if ( ( aPos.X() + aSz.Width() ) > aScreenRect.Right() )
+ aPos.X() = aScreenRect.Right() - aSz.Width();
+ if ( aPos.Y() < aScreenRect.Top() )
+ aPos.Y() = aScreenRect.Top();
+ else if ( ( aPos.Y() + aSz.Height() ) > aScreenRect.Bottom() )
+ aPos.Y() = aScreenRect.Bottom() - aSz.Height();
+
+ pHelpWin->SetPosPixel( aPos );
+}
diff --git a/vcl/source/app/idlemgr.cxx b/vcl/source/app/idlemgr.cxx
new file mode 100644
index 000000000000..e597d2680c1a
--- /dev/null
+++ b/vcl/source/app/idlemgr.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * $RCSfile: idlemgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IDLEMGR_CXX
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+
+#ifndef _SV_IDLEMGR_HXX
+#include <idlemgr.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+// =======================================================================
+
+struct ImplIdleData
+{
+ Link maIdleHdl;
+ USHORT mnPriority;
+ BOOL mbTimeout;
+};
+
+DECLARE_LIST( ImplIdleList, ImplIdleData* );
+
+#define IMPL_IDLETIMEOUT 350
+
+// =======================================================================
+
+ImplIdleMgr::ImplIdleMgr()
+{
+ mpIdleList = new ImplIdleList( 8, 8, 8 );
+
+ maTimer.SetTimeout( IMPL_IDLETIMEOUT );
+ maTimer.SetTimeoutHdl( LINK( this, ImplIdleMgr, TimeoutHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+ImplIdleMgr::~ImplIdleMgr()
+{
+ // Liste loeschen
+ ImplIdleData* pIdleData = mpIdleList->First();
+ while ( pIdleData )
+ {
+ delete pIdleData;
+ pIdleData = mpIdleList->Next();
+ }
+
+ delete mpIdleList;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplIdleMgr::InsertIdleHdl( const Link& rLink, USHORT nPriority )
+{
+ ULONG nPos = LIST_APPEND;
+ ImplIdleData* pIdleData = mpIdleList->First();
+ while ( pIdleData )
+ {
+ // Wenn Link schon existiert, dann gebe FALSE zurueck
+ if ( pIdleData->maIdleHdl == rLink )
+ return FALSE;
+
+ // Nach Prioritaet sortieren
+ if ( nPriority <= pIdleData->mnPriority )
+ nPos = mpIdleList->GetCurPos();
+
+ // Schleife nicht beenden, da noch
+ // geprueft werden muss, ob sich der Link
+ // schon in der Liste befindet
+
+ pIdleData = mpIdleList->Next();
+ }
+
+ pIdleData = new ImplIdleData;
+ pIdleData->maIdleHdl = rLink;
+ pIdleData->mnPriority = nPriority;
+ pIdleData->mbTimeout = FALSE;
+ mpIdleList->Insert( pIdleData, nPos );
+
+ // Wenn Timer noch nicht gestartet ist, dann starten
+ if ( !maTimer.IsActive() )
+ maTimer.Start();
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplIdleMgr::RemoveIdleHdl( const Link& rLink )
+{
+ ImplIdleData* pIdleData = mpIdleList->First();
+ while ( pIdleData )
+ {
+ if ( pIdleData->maIdleHdl == rLink )
+ {
+ mpIdleList->Remove();
+ delete pIdleData;
+ break;
+ }
+
+ pIdleData = mpIdleList->Next();
+ }
+
+ // keine Handdler mehr da
+ if ( !mpIdleList->Count() )
+ maTimer.Stop();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ImplIdleMgr, TimeoutHdl, Timer*, EMPTYARG )
+{
+ ImplIdleData* pIdleData = mpIdleList->First();
+ while ( pIdleData )
+ {
+ if ( !pIdleData->mbTimeout )
+ {
+ pIdleData->mbTimeout = TRUE;
+ pIdleData->maIdleHdl.Call( GetpApp() );
+ // Kann im Handler entfernt worden sein
+ if ( mpIdleList->GetPos( pIdleData ) != LIST_ENTRY_NOTFOUND )
+ pIdleData->mbTimeout = FALSE;
+ }
+
+ pIdleData = mpIdleList->Next();
+ }
+
+ return 0;
+}
diff --git a/vcl/source/app/makefile.mk b/vcl/source/app/makefile.mk
new file mode 100644
index 000000000000..ef981b4c4c1c
--- /dev/null
+++ b/vcl/source/app/makefile.mk
@@ -0,0 +1,123 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=vcl
+TARGET=app
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+CDEFS+=-DDLLSUFFIX=$(DLLSUFFIX)
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/access.obj \
+ $(SLO)$/config.obj \
+ $(SLO)$/dbggui.obj \
+ $(SLO)$/help.obj \
+ $(SLO)$/idlemgr.obj \
+ $(SLO)$/oldsv.obj \
+ $(SLO)$/resary.obj \
+ $(SLO)$/resmgr.obj \
+ $(SLO)$/settings.obj \
+ $(SLO)$/sound.obj \
+ $(SLO)$/stdtext.obj \
+ $(SLO)$/svapp.obj \
+ $(SLO)$/svdata.obj \
+ $(SLO)$/svmain.obj \
+ $(SLO)$/system.obj \
+ $(SLO)$/timer.obj \
+ $(SLO)$/unohelp.obj
+
+.IF "$(remote)"!=""
+EXCEPTIONSFILES= \
+ $(SLO)$/svapp.obj \
+ $(SLO)$/access.obj \
+ $(SLO)$/config.obj \
+ $(SLO)$/oldsv.obj \
+ $(SLO)$/help.obj \
+ $(SLO)$/resmgr.obj \
+ $(SLO)$/sound.obj \
+ $(SLO)$/svapp.obj \
+ $(SLO)$/svmain.obj \
+ $(SLO)$/system.obj \
+ $(SLO)$/idlemgr.obj \
+ $(SLO)$/timer.obj \
+ $(SLO)$/unohelp.obj
+.ELSE
+EXCEPTIONSFILES= $(SLO)$/svapp.obj \
+EXCEPTIONSFILES= $(SLO)$/unohelp.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
new file mode 100644
index 000000000000..663a2fe387f5
--- /dev/null
+++ b/vcl/source/app/settings.cxx
@@ -0,0 +1,1857 @@
+/*************************************************************************
+ *
+ * $RCSfile: settings.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SETTINGS_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
+
+#pragma hdrstop
+
+BOOL ImplCompareLocales( const ::com::sun::star::lang::Locale& L1, const ::com::sun::star::lang::Locale& L2 )
+{
+ return ( ( L1.Language == L2.Language ) &&
+ ( L1.Country == L2.Country ) &&
+ ( L1.Variant == L2.Variant ) );
+}
+
+// =======================================================================
+
+DBG_NAME( AllSettings );
+
+// =======================================================================
+
+#define STDSYS_STYLE (STYLE_OPTION_SCROLLARROW | \
+ STYLE_OPTION_SPINARROW | \
+ STYLE_OPTION_SPINUPDOWN | \
+ STYLE_OPTION_NOMNEMONICS)
+
+// =======================================================================
+
+ImplMachineData::ImplMachineData()
+{
+ mnRefCount = 1;
+ mnOptions = 0;
+ mnScreenOptions = 0;
+ mnPrintOptions = 0;
+ mnScreenRasterFontDeviation = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplMachineData::ImplMachineData( const ImplMachineData& rData )
+{
+ mnRefCount = 1;
+ mnOptions = rData.mnOptions;
+ mnScreenOptions = rData.mnScreenOptions;
+ mnPrintOptions = rData.mnPrintOptions;
+ mnScreenRasterFontDeviation = rData.mnScreenRasterFontDeviation;
+}
+
+// -----------------------------------------------------------------------
+
+MachineSettings::MachineSettings()
+{
+ mpData = new ImplMachineData();
+}
+
+// -----------------------------------------------------------------------
+
+MachineSettings::MachineSettings( const MachineSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "MachineSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+MachineSettings::~MachineSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const MachineSettings& MachineSettings::operator =( const MachineSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "MachineSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void MachineSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplMachineData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MachineSettings::operator ==( const MachineSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnOptions == rSet.mpData->mnOptions) &&
+ (mpData->mnScreenOptions == rSet.mpData->mnScreenOptions) &&
+ (mpData->mnPrintOptions == rSet.mpData->mnPrintOptions) &&
+ (mpData->mnScreenRasterFontDeviation == rSet.mpData->mnScreenRasterFontDeviation) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, MachineSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const MachineSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplMouseData::ImplMouseData()
+{
+ mnRefCount = 1;
+ mnOptions = 0;
+ mnDoubleClkTime = 500;
+ mnDoubleClkWidth = 2;
+ mnDoubleClkHeight = 2;
+ mnStartDragWidth = 2;
+ mnStartDragHeight = 2;
+ mnStartDragCode = MOUSE_LEFT;
+ mnDragMoveCode = 0;
+ mnDragCopyCode = KEY_MOD1;
+ mnDragLinkCode = KEY_SHIFT | KEY_MOD1;
+ mnContextMenuCode = MOUSE_RIGHT;
+ mnContextMenuClicks = 1;
+ mbContextMenuDown = FALSE;
+ mnScrollRepeat = 100;
+ mnButtonStartRepeat = 370;
+ mnButtonRepeat = 90;
+ mnActionDelay = 250;
+ mnMenuDelay = 150;
+ mnFollow = MOUSE_FOLLOW_MENU | MOUSE_FOLLOW_DDLIST;
+}
+
+// -----------------------------------------------------------------------
+
+ImplMouseData::ImplMouseData( const ImplMouseData& rData )
+{
+ mnRefCount = 1;
+ mnOptions = rData.mnOptions;
+ mnDoubleClkTime = rData.mnDoubleClkTime;
+ mnDoubleClkWidth = rData.mnDoubleClkWidth;
+ mnDoubleClkHeight = rData.mnDoubleClkHeight;
+ mnStartDragWidth = rData.mnStartDragWidth;
+ mnStartDragHeight = rData.mnStartDragHeight;
+ mnStartDragCode = rData.mnStartDragCode;
+ mnDragMoveCode = rData.mnDragMoveCode;
+ mnDragCopyCode = rData.mnDragCopyCode;
+ mnDragLinkCode = rData.mnDragLinkCode;
+ mnContextMenuCode = rData.mnContextMenuCode;
+ mnContextMenuClicks = rData.mnContextMenuClicks;
+ mbContextMenuDown = rData.mbContextMenuDown;
+ mnScrollRepeat = rData.mnScrollRepeat;
+ mnButtonStartRepeat = rData.mnButtonStartRepeat;
+ mnButtonRepeat = rData.mnButtonRepeat;
+ mnActionDelay = rData.mnActionDelay;
+ mnMenuDelay = rData.mnMenuDelay;
+ mnFollow = rData.mnFollow;
+}
+
+// -----------------------------------------------------------------------
+
+MouseSettings::MouseSettings()
+{
+ mpData = new ImplMouseData();
+}
+
+// -----------------------------------------------------------------------
+
+MouseSettings::MouseSettings( const MouseSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "MouseSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+MouseSettings::~MouseSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const MouseSettings& MouseSettings::operator =( const MouseSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "MouseSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void MouseSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplMouseData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MouseSettings::operator ==( const MouseSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnOptions == rSet.mpData->mnOptions) &&
+ (mpData->mnDoubleClkTime == rSet.mpData->mnDoubleClkTime) &&
+ (mpData->mnDoubleClkWidth == rSet.mpData->mnDoubleClkWidth) &&
+ (mpData->mnDoubleClkHeight == rSet.mpData->mnDoubleClkHeight) &&
+ (mpData->mnStartDragWidth == rSet.mpData->mnStartDragWidth) &&
+ (mpData->mnStartDragHeight == rSet.mpData->mnStartDragHeight) &&
+ (mpData->mnStartDragCode == rSet.mpData->mnStartDragCode) &&
+ (mpData->mnDragMoveCode == rSet.mpData->mnDragMoveCode) &&
+ (mpData->mnDragCopyCode == rSet.mpData->mnDragCopyCode) &&
+ (mpData->mnDragLinkCode == rSet.mpData->mnDragLinkCode) &&
+ (mpData->mnContextMenuCode == rSet.mpData->mnContextMenuCode) &&
+ (mpData->mnContextMenuClicks == rSet.mpData->mnContextMenuClicks) &&
+ (mpData->mbContextMenuDown == rSet.mpData->mbContextMenuDown) &&
+ (mpData->mnScrollRepeat == rSet.mpData->mnScrollRepeat) &&
+ (mpData->mnButtonStartRepeat == rSet.mpData->mnButtonStartRepeat) &&
+ (mpData->mnButtonRepeat == rSet.mpData->mnButtonRepeat) &&
+ (mpData->mnActionDelay == rSet.mpData->mnActionDelay) &&
+ (mpData->mnMenuDelay == rSet.mpData->mnMenuDelay) &&
+ (mpData->mnFollow == rSet.mpData->mnFollow) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, MouseSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const MouseSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplKeyboardData::ImplKeyboardData()
+{
+ mnRefCount = 1;
+ mnOptions = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplKeyboardData::ImplKeyboardData( const ImplKeyboardData& rData )
+{
+ mnRefCount = 1;
+ mnOptions = rData.mnOptions;
+}
+
+// -----------------------------------------------------------------------
+
+KeyboardSettings::KeyboardSettings()
+{
+ mpData = new ImplKeyboardData();
+}
+
+// -----------------------------------------------------------------------
+
+KeyboardSettings::KeyboardSettings( const KeyboardSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "KeyboardSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+KeyboardSettings::~KeyboardSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const KeyboardSettings& KeyboardSettings::operator =( const KeyboardSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "KeyboardSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void KeyboardSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplKeyboardData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL KeyboardSettings::operator ==( const KeyboardSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnOptions == rSet.mpData->mnOptions) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, KeyboardSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const KeyboardSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplStyleData::ImplStyleData()
+{
+ mnRefCount = 1;
+ mnScrollBarSize = 16;
+ mnSplitSize = 3;
+ mnSpinSize = 16;
+ mnIconHorzSpace = 50;
+ mnIconVertSpace = 40;
+ mnCursorSize = 2;
+#ifdef REMOTE_APPSERVER
+ mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME;
+#else
+ mnCursorBlinkTime = 500;
+#endif
+ mnScreenZoom = 100;
+ mnScreenFontZoom = 100;
+ mnRadioButtonStyle = 0;
+ mnCheckBoxStyle = 0;
+ mnPushButtonStyle = 0;
+ mnTabControlStyle = 0;
+ mnLogoDisplayTime = LOGO_DISPLAYTIME_STARTTIME;
+ mnDragFullOptions = 0;
+ mnAnimationOptions = 0;
+ mnSelectionOptions = 0;
+ mnOptions = 0;
+
+ SetStandardStyles();
+}
+
+// -----------------------------------------------------------------------
+
+ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
+ maFaceColor( rData.maFaceColor ),
+ maCheckedColor( rData.maCheckedColor ),
+ maLightColor( rData.maLightColor ),
+ maLightBorderColor( rData.maLightBorderColor ),
+ maShadowColor( rData.maShadowColor ),
+ maDarkShadowColor( rData.maDarkShadowColor ),
+ maButtonTextColor( rData.maButtonTextColor ),
+ maRadioCheckTextColor( rData.maRadioCheckTextColor ),
+ maGroupTextColor( rData.maGroupTextColor ),
+ maLabelTextColor( rData.maLabelTextColor ),
+ maInfoTextColor( rData.maInfoTextColor ),
+ maWindowColor( rData.maWindowColor ),
+ maWindowTextColor( rData.maWindowTextColor ),
+ maDialogColor( rData.maDialogColor ),
+ maDialogTextColor( rData.maDialogTextColor ),
+ maWorkspaceColor( rData.maWorkspaceColor ),
+ maFieldColor( rData.maFieldColor ),
+ maFieldTextColor( rData.maFieldTextColor ),
+ maActiveColor( rData.maActiveColor ),
+ maActiveColor2( rData.maActiveColor2 ),
+ maActiveTextColor( rData.maActiveTextColor ),
+ maActiveBorderColor( rData.maActiveBorderColor ),
+ maDeactiveColor( rData.maDeactiveColor ),
+ maDeactiveColor2( rData.maDeactiveColor2 ),
+ maDeactiveTextColor( rData.maDeactiveTextColor ),
+ maDeactiveBorderColor( rData.maDeactiveBorderColor ),
+ maMenuColor( rData.maMenuColor ),
+ maMenuTextColor( rData.maMenuTextColor ),
+ maMenuHighlightColor( rData.maMenuHighlightColor ),
+ maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
+ maHighlightColor( rData.maHighlightColor ),
+ maHighlightTextColor( rData.maHighlightTextColor ),
+ maDisableColor( rData.maDisableColor ),
+ maHelpColor( rData.maHelpColor ),
+ maHelpTextColor( rData.maHelpTextColor ),
+ maLinkColor( rData.maLinkColor ),
+ maVisitedLinkColor( rData.maLinkColor ),
+ maHighlightLinkColor( rData.maLinkColor ),
+ maAppFont( rData.maAppFont ),
+ maHelpFont( rData.maAppFont ),
+ maTitleFont( rData.maTitleFont ),
+ maFloatTitleFont( rData.maFloatTitleFont ),
+ maMenuFont( rData.maMenuFont ),
+ maToolFont( rData.maToolFont ),
+ maGroupFont( rData.maGroupFont ),
+ maLabelFont( rData.maLabelFont ),
+ maInfoFont( rData.maInfoFont ),
+ maRadioCheckFont( rData.maRadioCheckFont ),
+ maPushButtonFont( rData.maPushButtonFont ),
+ maFieldFont( rData.maFieldFont ),
+ maIconFont( rData.maIconFont )
+{
+ mnRefCount = 1;
+ mnBorderSize = rData.mnBorderSize;
+ mnTitleHeight = rData.mnTitleHeight;
+ mnFloatTitleHeight = rData.mnFloatTitleHeight;
+ mnTearOffTitleHeight = rData.mnTearOffTitleHeight;
+ mnMenuBarHeight = rData.mnMenuBarHeight;
+ mnScrollBarSize = rData.mnScrollBarSize;
+ mnSplitSize = rData.mnSplitSize;
+ mnSpinSize = rData.mnSpinSize;
+ mnIconHorzSpace = rData.mnIconHorzSpace;
+ mnIconVertSpace = rData.mnIconVertSpace;
+ mnCursorSize = rData.mnCursorSize;
+ mnCursorBlinkTime = rData.mnCursorBlinkTime;
+ mnScreenZoom = rData.mnScreenZoom;
+ mnScreenFontZoom = rData.mnScreenFontZoom;
+ mnRadioButtonStyle = rData.mnRadioButtonStyle;
+ mnCheckBoxStyle = rData.mnCheckBoxStyle;
+ mnPushButtonStyle = rData.mnPushButtonStyle;
+ mnTabControlStyle = rData.mnTabControlStyle;
+ mnLogoDisplayTime = rData.mnLogoDisplayTime;
+ mnDragFullOptions = rData.mnDragFullOptions;
+ mnAnimationOptions = rData.mnAnimationOptions;
+ mnSelectionOptions = rData.mnSelectionOptions;
+ mnOptions = rData.mnOptions;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStyleData::SetStandardStyles()
+{
+ Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
+ aStdFont.SetCharSet( gsl_getSystemTextEncoding() );
+ aStdFont.SetWeight( WEIGHT_NORMAL );
+ aStdFont.SetName( XubString( RTL_CONSTASCII_USTRINGPARAM( "MS Sans Serif;Geneva;Helv;WarpSans;Tahoma;Arial Unicode MS;Dialog;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Arial;Times;Times New Roman;Interface System" ) ) );
+ maAppFont = aStdFont;
+ maHelpFont = aStdFont;
+ maMenuFont = aStdFont;
+ maToolFont = aStdFont;
+ maGroupFont = aStdFont;
+ maLabelFont = aStdFont;
+ maInfoFont = aStdFont;
+ maRadioCheckFont = aStdFont;
+ maPushButtonFont = aStdFont;
+ maFieldFont = aStdFont;
+ maIconFont = aStdFont;
+ maFloatTitleFont = aStdFont;
+ aStdFont.SetWeight( WEIGHT_BOLD );
+ aStdFont.SetName( XubString( RTL_CONSTASCII_USTRINGPARAM( "MS Sans Serif;Charcoal;Chicago;Geneva;Helv;WarpSans;Tahoma;Arial Unicode MS;Dialog;Lucida;Helvetica;MS Sans Serif;Arial;Times;Times New Roman;Interface System" ) ) );
+ maTitleFont = aStdFont;
+
+ maFaceColor = Color( COL_LIGHTGRAY );
+ maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
+ maLightColor = Color( COL_WHITE );
+ maLightBorderColor = Color( COL_LIGHTGRAY );
+ maShadowColor = Color( COL_GRAY );
+ maDarkShadowColor = Color( COL_BLACK );
+ maButtonTextColor = Color( COL_BLACK );
+ maRadioCheckTextColor = Color( COL_BLACK );
+ maGroupTextColor = Color( COL_BLACK );
+ maLabelTextColor = Color( COL_BLACK );
+ maInfoTextColor = Color( COL_BLACK );
+ maWindowColor = Color( COL_WHITE );
+ maWindowTextColor = Color( COL_BLACK );
+ maDialogColor = Color( COL_LIGHTGRAY );
+ maDialogTextColor = Color( COL_BLACK );
+ maWorkspaceColor = Color( COL_GRAY );
+ maFieldColor = Color( COL_WHITE );
+ maFieldTextColor = Color( COL_BLACK );
+ maActiveColor = Color( COL_BLUE );
+ maActiveColor2 = Color( COL_BLACK );
+ maActiveTextColor = Color( COL_WHITE );
+ maActiveBorderColor = Color( COL_LIGHTGRAY );
+ maDeactiveColor = Color( COL_GRAY );
+ maDeactiveColor2 = Color( COL_BLACK );
+ maDeactiveTextColor = Color( COL_LIGHTGRAY );
+ maDeactiveBorderColor = Color( COL_LIGHTGRAY );
+ maMenuColor = Color( COL_LIGHTGRAY );
+ maMenuTextColor = Color( COL_BLACK );
+ maMenuHighlightColor = Color( COL_BLUE );
+ maMenuHighlightTextColor = Color( COL_WHITE );
+ maHighlightColor = Color( COL_BLUE );
+ maHighlightTextColor = Color( COL_WHITE );
+ maDisableColor = Color( COL_GRAY );
+ maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
+ maHelpTextColor = Color( COL_BLACK );
+ maLinkColor = Color( COL_BLUE );
+ maVisitedLinkColor = Color( COL_RED );
+ maHighlightLinkColor = Color( COL_LIGHTBLUE );
+
+ mnRadioButtonStyle &= ~STYLE_RADIOBUTTON_STYLE;
+ mnCheckBoxStyle &= ~STYLE_CHECKBOX_STYLE;
+ mnPushButtonStyle &= ~STYLE_PUSHBUTTON_STYLE;
+ mnTabControlStyle = 0;
+
+ mnOptions &= ~(STYLE_OPTION_SYSTEMSTYLE | STDSYS_STYLE);
+ mnBorderSize = 1;
+ mnTitleHeight = 18;
+ mnFloatTitleHeight = 13;
+ mnTearOffTitleHeight = 8;
+ mnMenuBarHeight = 14;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStyleData::SetStandardWinStyles()
+{
+ SetStandardStyles();
+
+ mnRadioButtonStyle &= ~STYLE_RADIOBUTTON_STYLE;
+ mnRadioButtonStyle |= STYLE_RADIOBUTTON_WIN;
+ mnCheckBoxStyle &= ~STYLE_CHECKBOX_STYLE;
+ mnCheckBoxStyle |= STYLE_CHECKBOX_WIN;
+ mnPushButtonStyle &= ~STYLE_PUSHBUTTON_STYLE;
+ mnPushButtonStyle |= STYLE_PUSHBUTTON_WIN;
+ mnTabControlStyle = 0;
+
+ mnOptions &= ~(STYLE_OPTION_SYSTEMSTYLE | STDSYS_STYLE);
+ mnOptions |= STYLE_OPTION_WINSTYLE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStyleData::SetStandardOS2Styles()
+{
+ Font aStdFont( FAMILY_SWISS, Size( 0, 9 ) );
+ aStdFont.SetCharSet( gsl_getSystemTextEncoding() );
+ aStdFont.SetWeight( WEIGHT_NORMAL );
+ aStdFont.SetName( XubString( RTL_CONSTASCII_USTRINGPARAM( "WarpSans;MS Sans Serif;Geneva;Helv;Tahoma;Arial Unicode MS;Dialog;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Arial;Times;Times New Roman;Interface System" ) ) );
+ maAppFont = aStdFont;
+ maHelpFont = aStdFont;
+ maToolFont = aStdFont;
+ maGroupFont = aStdFont;
+ maLabelFont = aStdFont;
+ maInfoFont = aStdFont;
+ maRadioCheckFont = aStdFont;
+ maPushButtonFont = aStdFont;
+ maFieldFont = aStdFont;
+ maIconFont = aStdFont;
+ maFloatTitleFont = aStdFont;
+ aStdFont.SetWeight( WEIGHT_BOLD );
+ aStdFont.SetName( XubString( RTL_CONSTASCII_USTRINGPARAM( "WarpSans;MS Sans Serif;Charcoal;Chicago;Geneva;Helv;Tahoma;Arial Unicode MS;Dialog;Lucida;Helvetica;MS Sans Serif;Arial;Times;Times New Roman;Interface System" ) ) );
+ maMenuFont = aStdFont;
+ maTitleFont = aStdFont;
+
+ maFaceColor = Color( COL_LIGHTGRAY );
+ maCheckedColor = Color( 0xCC, 0xCC, 0xCC );
+ maLightColor = Color( COL_WHITE );
+ maLightBorderColor = Color( COL_LIGHTGRAY );
+ maShadowColor = Color( COL_GRAY );
+ maDarkShadowColor = Color( COL_BLACK );
+ maButtonTextColor = Color( COL_BLACK );
+ maRadioCheckTextColor = Color( COL_BLACK );
+ maGroupTextColor = Color( COL_BLACK );
+ maLabelTextColor = Color( COL_BLACK );
+ maInfoTextColor = Color( COL_BLACK );
+ maWindowColor = Color( COL_WHITE );
+ maWindowTextColor = Color( COL_BLACK );
+ maDialogColor = Color( COL_LIGHTGRAY );
+ maDialogTextColor = Color( COL_BLACK );
+ maWorkspaceColor = Color( COL_GRAY );
+ maFieldColor = Color( COL_WHITE );
+ maFieldTextColor = Color( COL_BLACK );
+ maActiveColor = Color( COL_BLUE );
+ maActiveColor2 = Color( COL_BLACK );
+ maActiveTextColor = Color( COL_WHITE );
+ maActiveBorderColor = Color( COL_LIGHTGRAY );
+ maDeactiveColor = Color( COL_GRAY );
+ maDeactiveColor2 = Color( COL_BLACK );
+ maDeactiveTextColor = Color( COL_LIGHTGRAY );
+ maDeactiveBorderColor = Color( COL_LIGHTGRAY );
+ maMenuColor = Color( COL_LIGHTGRAY );
+ maMenuTextColor = Color( COL_BLACK );
+ maMenuHighlightColor = Color( COL_BLUE );
+ maMenuHighlightTextColor = Color( COL_WHITE );
+ maHighlightColor = Color( COL_GRAY );
+ maHighlightTextColor = Color( COL_WHITE );
+ maDisableColor = Color( COL_GRAY );
+ maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
+ maHelpTextColor = Color( COL_BLACK );
+
+ mnRadioButtonStyle &= ~STYLE_RADIOBUTTON_STYLE;
+ mnRadioButtonStyle |= STYLE_RADIOBUTTON_OS2;
+ mnCheckBoxStyle &= ~STYLE_CHECKBOX_STYLE;
+ mnCheckBoxStyle |= STYLE_CHECKBOX_OS2;
+ mnPushButtonStyle &= ~STYLE_PUSHBUTTON_STYLE;
+ mnPushButtonStyle |= STYLE_PUSHBUTTON_OS2;
+ mnTabControlStyle = STYLE_TABCONTROL_SINGLELINE |
+ STYLE_TABCONTROL_COLOR;
+
+ mnOptions &= ~(STYLE_OPTION_SYSTEMSTYLE | STDSYS_STYLE);
+ mnOptions |= STYLE_OPTION_OS2STYLE | STYLE_OPTION_SPINARROW;
+ mnBorderSize = 1;
+ mnTitleHeight = 18;
+ mnFloatTitleHeight = 13;
+ mnTearOffTitleHeight = 8;
+ mnMenuBarHeight = 14;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStyleData::SetStandardMacStyles()
+{
+ Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) );
+ aStdFont.SetCharSet( gsl_getSystemTextEncoding() );
+ aStdFont.SetWeight( WEIGHT_NORMAL );
+ aStdFont.SetName( XubString( RTL_CONSTASCII_USTRINGPARAM( "Geneva;MS Sans Serif;Helv;Tahoma;Arial Unicode MS;WarpSans;Dialog;Lucida;Helvetica;Charcoal;Chicago;MS Sans Serif;Arial;Times;Times New Roman;Interface System" ) ) );
+ maAppFont = aStdFont;
+ maHelpFont = aStdFont;
+ maToolFont = aStdFont;
+ maPushButtonFont = aStdFont;
+ maGroupFont = aStdFont;
+ maLabelFont = aStdFont;
+ maInfoFont = aStdFont;
+ maRadioCheckFont = aStdFont;
+ maFieldFont = aStdFont;
+ maIconFont = aStdFont;
+ maFloatTitleFont = aStdFont;
+ aStdFont.SetName( XubString( RTL_CONSTASCII_USTRINGPARAM( "Charcoal;Chicago;Geneva;MS Sans Serif;Helv;Tahoma;Arial Unicode MS;WarpSans;Dialog;Lucida;Helvetica;MS Sans Serif;Arial;Times;Times New Roman;Interface System" ) ) );
+// aStdFont.SetWeight( WEIGHT_BOLD );
+ maMenuFont = aStdFont;
+ maTitleFont = aStdFont;
+// maPushButtonFont = aStdFont;
+// maGroupFont = aStdFont;
+// maLabelFont = aStdFont;
+
+ maFaceColor = Color( COL_LIGHTGRAY );
+ maCheckedColor = Color( 0x99, 0x99, 0x99 );
+ maLightColor = Color( COL_WHITE );
+ maLightBorderColor = Color( COL_LIGHTGRAY );
+ maShadowColor = Color( COL_GRAY );
+ maDarkShadowColor = Color( COL_BLACK );
+ maButtonTextColor = Color( COL_BLACK );
+ maRadioCheckTextColor = Color( COL_BLACK );
+ maGroupTextColor = Color( COL_BLACK );
+ maLabelTextColor = Color( COL_BLACK );
+ maInfoTextColor = Color( COL_BLACK );
+ maWindowColor = Color( COL_WHITE );
+ maWindowTextColor = Color( COL_BLACK );
+ maDialogColor = Color( COL_LIGHTGRAY );
+ maDialogTextColor = Color( COL_BLACK );
+ maWorkspaceColor = Color( COL_GRAY );
+ maFieldColor = Color( COL_WHITE );
+ maFieldTextColor = Color( COL_BLACK );
+ maActiveColor = Color( COL_LIGHTGRAY );
+ maActiveColor2 = Color( COL_LIGHTGRAY );
+ maActiveTextColor = Color( COL_BLACK );
+ maActiveBorderColor = Color( COL_LIGHTGRAY );
+ maDeactiveColor = Color( COL_LIGHTGRAY );
+ maDeactiveColor2 = Color( COL_LIGHTGRAY );
+ maDeactiveTextColor = Color( COL_GRAY );
+ maDeactiveBorderColor = Color( COL_LIGHTGRAY );
+ maMenuColor = Color( COL_LIGHTGRAY );
+ maMenuTextColor = Color( COL_BLACK );
+ maMenuHighlightColor = Color( COL_BLUE );
+ maMenuHighlightTextColor = Color( COL_WHITE );
+ maHighlightColor = Color( COL_BLUE );
+ maHighlightTextColor = Color( COL_WHITE );
+ maDisableColor = Color( COL_GRAY );
+ maHelpColor = Color( 0xFF, 0xFF, 0xE0 );
+ maHelpTextColor = Color( COL_BLACK );
+
+ mnRadioButtonStyle &= ~STYLE_RADIOBUTTON_STYLE;
+ mnRadioButtonStyle |= STYLE_RADIOBUTTON_MAC;
+ mnCheckBoxStyle &= ~STYLE_CHECKBOX_STYLE;
+ mnCheckBoxStyle |= STYLE_CHECKBOX_MAC;
+ mnPushButtonStyle &= ~STYLE_PUSHBUTTON_STYLE;
+ mnPushButtonStyle |= STYLE_PUSHBUTTON_MAC;
+ mnTabControlStyle = 0;
+
+ mnOptions &= ~(STYLE_OPTION_SYSTEMSTYLE | STDSYS_STYLE);
+ mnOptions |= STYLE_OPTION_MACSTYLE | STYLE_OPTION_NOMNEMONICS | STYLE_OPTION_SPINUPDOWN;
+ mnBorderSize = 2;
+ mnTitleHeight = 16;
+ mnFloatTitleHeight = 12;
+ mnTearOffTitleHeight = 7;
+ mnMenuBarHeight = 14;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStyleData::SetStandardUnixStyles()
+{
+ SetStandardStyles();
+
+ maActiveColor = Color( 182, 77, 121 );
+ maActiveColor2 = Color( 182, 77, 121 );
+ maActiveTextColor = Color( COL_WHITE );
+ maActiveBorderColor = Color( 182, 77, 121 );
+ maDeactiveColor = Color( 174, 178, 199 );
+ maDeactiveColor2 = Color( 174, 178, 199 );
+ maDeactiveTextColor = Color( COL_BLACK );
+ maDeactiveBorderColor = Color( 174, 178, 199 );
+
+ mnRadioButtonStyle &= ~STYLE_RADIOBUTTON_STYLE;
+ mnRadioButtonStyle |= STYLE_RADIOBUTTON_UNIX;
+ mnCheckBoxStyle &= ~STYLE_CHECKBOX_STYLE;
+ mnCheckBoxStyle |= STYLE_CHECKBOX_UNIX;
+ mnPushButtonStyle &= ~STYLE_PUSHBUTTON_STYLE;
+ mnPushButtonStyle |= STYLE_PUSHBUTTON_UNIX;
+ mnTabControlStyle = 0;
+
+ mnOptions &= ~(STYLE_OPTION_SYSTEMSTYLE | STDSYS_STYLE);
+ mnOptions |= STYLE_OPTION_UNIXSTYLE;
+
+ mnBorderSize = 3;
+}
+
+// -----------------------------------------------------------------------
+
+StyleSettings::StyleSettings()
+{
+ mpData = new ImplStyleData();
+}
+
+// -----------------------------------------------------------------------
+
+StyleSettings::StyleSettings( const StyleSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "StyleSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+StyleSettings::~StyleSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+void StyleSettings::Set3DColors( const Color& rColor )
+{
+ CopyData();
+ mpData->maFaceColor = rColor;
+ mpData->maLightBorderColor = rColor;
+ mpData->maDarkShadowColor = Color( COL_BLACK );
+ if ( rColor != Color( COL_LIGHTGRAY ) )
+ {
+ mpData->maLightColor = rColor;
+ mpData->maShadowColor = rColor;
+ mpData->maLightColor.IncreaseLuminance( 64 );
+ mpData->maShadowColor.DecreaseLuminance( 64 );
+ ULONG nRed = mpData->maLightColor.GetRed();
+ ULONG nGreen = mpData->maLightColor.GetGreen();
+ ULONG nBlue = mpData->maLightColor.GetBlue();
+ nRed += (ULONG)(mpData->maShadowColor.GetRed());
+ nGreen += (ULONG)(mpData->maShadowColor.GetGreen());
+ nBlue += (ULONG)(mpData->maShadowColor.GetBlue());
+ mpData->maCheckedColor = Color( (BYTE)(nRed/2), (BYTE)(nGreen/2), (BYTE)(nBlue/2) );
+ }
+ else
+ {
+ mpData->maCheckedColor = Color( 0x99, 0x99, 0x99 );
+ mpData->maLightColor = Color( COL_WHITE );
+ mpData->maShadowColor = Color( COL_GRAY );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StyleSettings::SetStandardStyles()
+{
+ CopyData();
+ mpData->SetStandardStyles();
+}
+
+// -----------------------------------------------------------------------
+
+void StyleSettings::SetStandardWinStyles()
+{
+ CopyData();
+ mpData->SetStandardWinStyles();
+}
+
+// -----------------------------------------------------------------------
+
+void StyleSettings::SetStandardOS2Styles()
+{
+ CopyData();
+ mpData->SetStandardOS2Styles();
+}
+
+// -----------------------------------------------------------------------
+
+void StyleSettings::SetStandardMacStyles()
+{
+ CopyData();
+ mpData->SetStandardMacStyles();
+}
+
+// -----------------------------------------------------------------------
+
+void StyleSettings::SetStandardUnixStyles()
+{
+ CopyData();
+ mpData->SetStandardUnixStyles();
+}
+
+// -----------------------------------------------------------------------
+
+const StyleSettings& StyleSettings::operator =( const StyleSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "StyleSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void StyleSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplStyleData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnOptions == rSet.mpData->mnOptions) &&
+ (mpData->mnLogoDisplayTime == rSet.mpData->mnLogoDisplayTime) &&
+ (mpData->mnDragFullOptions == rSet.mpData->mnDragFullOptions) &&
+ (mpData->mnAnimationOptions == rSet.mpData->mnAnimationOptions) &&
+ (mpData->mnSelectionOptions == rSet.mpData->mnSelectionOptions) &&
+ (mpData->mnCursorSize == rSet.mpData->mnCursorSize) &&
+ (mpData->mnCursorBlinkTime == rSet.mpData->mnCursorBlinkTime) &&
+ (mpData->mnBorderSize == rSet.mpData->mnBorderSize) &&
+ (mpData->mnTitleHeight == rSet.mpData->mnTitleHeight) &&
+ (mpData->mnFloatTitleHeight == rSet.mpData->mnFloatTitleHeight) &&
+ (mpData->mnTearOffTitleHeight == rSet.mpData->mnTearOffTitleHeight) &&
+ (mpData->mnMenuBarHeight == rSet.mpData->mnMenuBarHeight) &&
+ (mpData->mnScrollBarSize == rSet.mpData->mnScrollBarSize) &&
+ (mpData->mnSplitSize == rSet.mpData->mnSplitSize) &&
+ (mpData->mnSpinSize == rSet.mpData->mnSpinSize) &&
+ (mpData->mnIconHorzSpace == rSet.mpData->mnIconHorzSpace) &&
+ (mpData->mnIconVertSpace == rSet.mpData->mnIconVertSpace) &&
+ (mpData->mnScreenZoom == rSet.mpData->mnScreenZoom) &&
+ (mpData->mnScreenFontZoom == rSet.mpData->mnScreenFontZoom) &&
+ (mpData->mnRadioButtonStyle == rSet.mpData->mnRadioButtonStyle) &&
+ (mpData->mnCheckBoxStyle == rSet.mpData->mnCheckBoxStyle) &&
+ (mpData->mnPushButtonStyle == rSet.mpData->mnPushButtonStyle) &&
+ (mpData->mnTabControlStyle == rSet.mpData->mnTabControlStyle) &&
+ (mpData->maFaceColor == rSet.mpData->maFaceColor) &&
+ (mpData->maCheckedColor == rSet.mpData->maCheckedColor) &&
+ (mpData->maLightColor == rSet.mpData->maLightColor) &&
+ (mpData->maLightBorderColor == rSet.mpData->maLightBorderColor) &&
+ (mpData->maShadowColor == rSet.mpData->maShadowColor) &&
+ (mpData->maDarkShadowColor == rSet.mpData->maDarkShadowColor) &&
+ (mpData->maButtonTextColor == rSet.mpData->maButtonTextColor) &&
+ (mpData->maRadioCheckTextColor == rSet.mpData->maRadioCheckTextColor) &&
+ (mpData->maGroupTextColor == rSet.mpData->maGroupTextColor) &&
+ (mpData->maLabelTextColor == rSet.mpData->maLabelTextColor) &&
+ (mpData->maInfoTextColor == rSet.mpData->maInfoTextColor) &&
+ (mpData->maWindowColor == rSet.mpData->maWindowColor) &&
+ (mpData->maWindowTextColor == rSet.mpData->maWindowTextColor) &&
+ (mpData->maDialogColor == rSet.mpData->maDialogColor) &&
+ (mpData->maDialogTextColor == rSet.mpData->maDialogTextColor) &&
+ (mpData->maWorkspaceColor == rSet.mpData->maWorkspaceColor) &&
+ (mpData->maFieldColor == rSet.mpData->maFieldColor) &&
+ (mpData->maFieldTextColor == rSet.mpData->maFieldTextColor) &&
+ (mpData->maActiveColor == rSet.mpData->maActiveColor) &&
+ (mpData->maActiveColor2 == rSet.mpData->maActiveColor2) &&
+ (mpData->maActiveTextColor == rSet.mpData->maActiveTextColor) &&
+ (mpData->maActiveBorderColor == rSet.mpData->maActiveBorderColor) &&
+ (mpData->maDeactiveColor == rSet.mpData->maDeactiveColor) &&
+ (mpData->maDeactiveColor2 == rSet.mpData->maDeactiveColor2) &&
+ (mpData->maDeactiveTextColor == rSet.mpData->maDeactiveTextColor) &&
+ (mpData->maDeactiveBorderColor == rSet.mpData->maDeactiveBorderColor) &&
+ (mpData->maMenuColor == rSet.mpData->maMenuColor) &&
+ (mpData->maMenuTextColor == rSet.mpData->maMenuTextColor) &&
+ (mpData->maMenuHighlightColor == rSet.mpData->maMenuHighlightColor) &&
+ (mpData->maMenuHighlightTextColor == rSet.mpData->maMenuHighlightTextColor) &&
+ (mpData->maHighlightColor == rSet.mpData->maHighlightColor) &&
+ (mpData->maHighlightTextColor == rSet.mpData->maHighlightTextColor) &&
+ (mpData->maDisableColor == rSet.mpData->maDisableColor) &&
+ (mpData->maHelpColor == rSet.mpData->maHelpColor) &&
+ (mpData->maHelpTextColor == rSet.mpData->maHelpTextColor) &&
+ (mpData->maLinkColor == rSet.mpData->maLinkColor) &&
+ (mpData->maVisitedLinkColor == rSet.mpData->maVisitedLinkColor) &&
+ (mpData->maHighlightLinkColor == rSet.mpData->maHighlightLinkColor) &&
+ (mpData->maAppFont == rSet.mpData->maAppFont) &&
+ (mpData->maHelpFont == rSet.mpData->maHelpFont) &&
+ (mpData->maTitleFont == rSet.mpData->maTitleFont) &&
+ (mpData->maFloatTitleFont == rSet.mpData->maFloatTitleFont) &&
+ (mpData->maMenuFont == rSet.mpData->maMenuFont) &&
+ (mpData->maToolFont == rSet.mpData->maToolFont) &&
+ (mpData->maGroupFont == rSet.mpData->maGroupFont) &&
+ (mpData->maLabelFont == rSet.mpData->maLabelFont) &&
+ (mpData->maInfoFont == rSet.mpData->maInfoFont) &&
+ (mpData->maRadioCheckFont == rSet.mpData->maRadioCheckFont) &&
+ (mpData->maPushButtonFont == rSet.mpData->maPushButtonFont) &&
+ (mpData->maFieldFont == rSet.mpData->maFieldFont) &&
+ (mpData->maIconFont == rSet.mpData->maIconFont) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, StyleSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const StyleSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplMiscData::ImplMiscData()
+{
+ mnRefCount = 1;
+ mnTwoDigitYearStart = 1930;
+}
+
+// -----------------------------------------------------------------------
+
+ImplMiscData::ImplMiscData( const ImplMiscData& rData )
+{
+ mnRefCount = 1;
+ mnTwoDigitYearStart = rData.mnTwoDigitYearStart;
+}
+
+// -----------------------------------------------------------------------
+
+MiscSettings::MiscSettings()
+{
+ mpData = new ImplMiscData();
+}
+
+// -----------------------------------------------------------------------
+
+MiscSettings::MiscSettings( const MiscSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "MiscSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+MiscSettings::~MiscSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const MiscSettings& MiscSettings::operator =( const MiscSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "MiscSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void MiscSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplMiscData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MiscSettings::operator ==( const MiscSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnTwoDigitYearStart == rSet.mpData->mnTwoDigitYearStart ) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, MiscSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const MiscSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplSoundData::ImplSoundData()
+{
+ mnRefCount = 1;
+ mnOptions = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplSoundData::ImplSoundData( const ImplSoundData& rData )
+{
+ mnRefCount = 1;
+ mnOptions = rData.mnOptions;
+}
+
+// -----------------------------------------------------------------------
+
+SoundSettings::SoundSettings()
+{
+ mpData = new ImplSoundData();
+}
+
+// -----------------------------------------------------------------------
+
+SoundSettings::SoundSettings( const SoundSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "SoundSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+SoundSettings::~SoundSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const SoundSettings& SoundSettings::operator =( const SoundSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "SoundSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void SoundSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplSoundData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SoundSettings::operator ==( const SoundSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnOptions == rSet.mpData->mnOptions) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, SoundSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const SoundSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplNotificationData::ImplNotificationData()
+{
+ mnRefCount = 1;
+ mnOptions = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplNotificationData::ImplNotificationData( const ImplNotificationData& rData )
+{
+ mnRefCount = 1;
+ mnOptions = rData.mnOptions;
+}
+
+// -----------------------------------------------------------------------
+
+NotificationSettings::NotificationSettings()
+{
+ mpData = new ImplNotificationData();
+}
+
+// -----------------------------------------------------------------------
+
+NotificationSettings::NotificationSettings( const NotificationSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "NotificationSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+NotificationSettings::~NotificationSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const NotificationSettings& NotificationSettings::operator =( const NotificationSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "NotificationSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void NotificationSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplNotificationData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL NotificationSettings::operator ==( const NotificationSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnOptions == rSet.mpData->mnOptions) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, NotificationSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const NotificationSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplHelpData::ImplHelpData()
+{
+ mnRefCount = 1;
+ mnOptions = 0;
+ mnTipDelay = 500;
+ mnTipTimeout = 3000;
+ mnBalloonDelay = 1500;
+}
+
+// -----------------------------------------------------------------------
+
+ImplHelpData::ImplHelpData( const ImplHelpData& rData )
+{
+ mnRefCount = 1;
+ mnOptions = rData.mnOptions;
+ mnTipDelay = rData.mnTipDelay;
+ mnTipTimeout = rData.mnTipTimeout;
+ mnBalloonDelay = rData.mnBalloonDelay;
+}
+
+// -----------------------------------------------------------------------
+
+HelpSettings::HelpSettings()
+{
+ mpData = new ImplHelpData();
+}
+
+// -----------------------------------------------------------------------
+
+HelpSettings::HelpSettings( const HelpSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "HelpSettings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+HelpSettings::~HelpSettings()
+{
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const HelpSettings& HelpSettings::operator =( const HelpSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "HelpSettings: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void HelpSettings::CopyData()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplHelpData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL HelpSettings::operator ==( const HelpSettings& rSet ) const
+{
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->mnOptions == rSet.mpData->mnOptions ) &&
+ (mpData->mnTipDelay == rSet.mpData->mnTipDelay ) &&
+ (mpData->mnTipTimeout == rSet.mpData->mnTipTimeout ) &&
+ (mpData->mnBalloonDelay == rSet.mpData->mnBalloonDelay ) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, HelpSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const HelpSettings& rSet )
+{
+ return rOStream;
+}
+
+// =======================================================================
+
+ImplAllSettingsData::ImplAllSettingsData()
+{
+ mnRefCount = 1;
+ mnSystemUpdate = SETTINGS_ALLSETTINGS;
+ mnWindowUpdate = SETTINGS_ALLSETTINGS;
+}
+
+// -----------------------------------------------------------------------
+
+ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
+ maMouseSettings( rData.maMouseSettings ),
+ maKeyboardSettings( rData.maKeyboardSettings ),
+ maStyleSettings( rData.maStyleSettings ),
+ maMiscSettings( rData.maMiscSettings ),
+ maSoundSettings( rData.maSoundSettings ),
+ maNotificationSettings( rData.maNotificationSettings ),
+ maHelpSettings( rData.maHelpSettings ),
+ maInternational( rData.maInternational )
+{
+ mnRefCount = 1;
+ mnSystemUpdate = rData.mnSystemUpdate;
+ mnWindowUpdate = rData.mnWindowUpdate;
+}
+
+// -----------------------------------------------------------------------
+
+AllSettings::AllSettings()
+{
+ DBG_CTOR( AllSettings, NULL );
+
+ mpData = new ImplAllSettingsData();
+}
+
+// -----------------------------------------------------------------------
+
+AllSettings::AllSettings( const AllSettings& rSet )
+{
+ DBG_CTOR( AllSettings, NULL );
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "Settings: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpData = rSet.mpData;
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+AllSettings::~AllSettings()
+{
+ DBG_DTOR( AllSettings, NULL );
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+const AllSettings& AllSettings::operator =( const AllSettings& rSet )
+{
+ DBG_ASSERT( rSet.mpData->mnRefCount < 0xFFFE, "AllSettings: RefCount overflow" );
+ DBG_CHKTHIS( AllSettings, NULL );
+ DBG_CHKOBJ( &rSet, AllSettings, NULL );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rSet.mpData->mnRefCount++;
+
+ // Daten loeschen, wenn letzte Referenz
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+
+ mpData = rSet.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+void AllSettings::CopyData()
+{
+ DBG_CHKTHIS( AllSettings, NULL );
+
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplAllSettingsData( *mpData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet )
+{
+ DBG_CHKTHIS( AllSettings, NULL );
+ DBG_CHKOBJ( &rSet, AllSettings, NULL );
+
+ ULONG nChangeFlags = 0;
+
+ if ( nFlags & SETTINGS_MACHINE )
+ {
+ if ( mpData->maMachineSettings != rSet.mpData->maMachineSettings )
+ {
+ CopyData();
+ mpData->maMachineSettings = rSet.mpData->maMachineSettings;
+ nChangeFlags |= SETTINGS_MACHINE;
+ }
+ }
+
+ if ( nFlags & SETTINGS_MOUSE )
+ {
+ if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings )
+ {
+ CopyData();
+ mpData->maMouseSettings = rSet.mpData->maMouseSettings;
+ nChangeFlags |= SETTINGS_MOUSE;
+ }
+ }
+
+ if ( nFlags & SETTINGS_KEYBOARD )
+ {
+ if ( mpData->maKeyboardSettings != rSet.mpData->maKeyboardSettings )
+ {
+ CopyData();
+ mpData->maKeyboardSettings = rSet.mpData->maKeyboardSettings;
+ nChangeFlags |= SETTINGS_KEYBOARD;
+ }
+ }
+
+ if ( nFlags & SETTINGS_STYLE )
+ {
+ if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings )
+ {
+ CopyData();
+ mpData->maStyleSettings = rSet.mpData->maStyleSettings;
+ nChangeFlags |= SETTINGS_STYLE;
+ }
+ }
+
+ if ( nFlags & SETTINGS_MISC )
+ {
+ if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings )
+ {
+ CopyData();
+ mpData->maMiscSettings = rSet.mpData->maMiscSettings;
+ nChangeFlags |= SETTINGS_MISC;
+ }
+ }
+
+ if ( nFlags & SETTINGS_SOUND )
+ {
+ if ( mpData->maSoundSettings != rSet.mpData->maSoundSettings )
+ {
+ CopyData();
+ mpData->maSoundSettings = rSet.mpData->maSoundSettings;
+ nChangeFlags |= SETTINGS_SOUND;
+ }
+ }
+
+ if ( nFlags & SETTINGS_NOTIFICATION )
+ {
+ if ( mpData->maNotificationSettings != rSet.mpData->maNotificationSettings )
+ {
+ CopyData();
+ mpData->maNotificationSettings = rSet.mpData->maNotificationSettings;
+ nChangeFlags |= SETTINGS_NOTIFICATION;
+ }
+ }
+
+ if ( nFlags & SETTINGS_HELP )
+ {
+ if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings )
+ {
+ CopyData();
+ mpData->maHelpSettings = rSet.mpData->maHelpSettings;
+ nChangeFlags |= SETTINGS_HELP;
+ }
+ }
+
+ if ( nFlags & SETTINGS_INTERNATIONAL )
+ {
+ if ( mpData->maInternational != rSet.mpData->maInternational )
+ {
+ CopyData();
+ mpData->maInternational = rSet.mpData->maInternational;
+ nChangeFlags |= SETTINGS_INTERNATIONAL;
+ // Will be calculated in GetLocale();
+ mpData->maLocale = ::com::sun::star::lang::Locale();
+ }
+
+ // Da System-International-Klassen intern in der
+ // International-Klasse automatisch bei Systemaenderungen geaendert
+ // werden, wird der Status innerhalb einer System-International-
+ // Aenderung anders ermittelt, da ansonsten die App nicht
+ // mitbekommt, das sich etwas geaendert hat
+ if ( (mpData->maInternational.GetLanguage() == LANGUAGE_SYSTEM) ||
+ (mpData->maInternational.GetFormatLanguage() == LANGUAGE_SYSTEM) )
+ {
+ if ( ImplGetSVData()->maAppData.mbIntnChanged )
+ nChangeFlags |= SETTINGS_INTERNATIONAL;
+ }
+ }
+
+ if ( nFlags & SETTINGS_LOCALE )
+ {
+ if ( !ImplCompareLocales( mpData->maLocale, rSet.mpData->maLocale ) )
+ {
+ CopyData();
+ mpData->maLocale = rSet.mpData->maLocale;
+ nChangeFlags |= SETTINGS_LOCALE;
+ }
+ }
+
+ return nChangeFlags;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const
+{
+ DBG_CHKTHIS( AllSettings, NULL );
+ DBG_CHKOBJ( &rSet, AllSettings, NULL );
+
+ ULONG nChangeFlags = 0;
+
+ if ( mpData->maMachineSettings != rSet.mpData->maMachineSettings )
+ nChangeFlags |= SETTINGS_MACHINE;
+
+ if ( mpData->maMouseSettings != rSet.mpData->maMouseSettings )
+ nChangeFlags |= SETTINGS_MOUSE;
+
+ if ( mpData->maKeyboardSettings != rSet.mpData->maKeyboardSettings )
+ nChangeFlags |= SETTINGS_KEYBOARD;
+
+ if ( mpData->maStyleSettings != rSet.mpData->maStyleSettings )
+ nChangeFlags |= SETTINGS_STYLE;
+
+ if ( mpData->maMiscSettings != rSet.mpData->maMiscSettings )
+ nChangeFlags |= SETTINGS_MISC;
+
+ if ( mpData->maSoundSettings != rSet.mpData->maSoundSettings )
+ nChangeFlags |= SETTINGS_SOUND;
+
+ if ( mpData->maNotificationSettings != rSet.mpData->maNotificationSettings )
+ nChangeFlags |= SETTINGS_NOTIFICATION;
+
+ if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings )
+ nChangeFlags |= SETTINGS_HELP;
+
+ if ( mpData->maInternational != rSet.mpData->maInternational )
+ nChangeFlags |= SETTINGS_INTERNATIONAL;
+
+ // Da System-International-Klassen intern in der
+ // International-Klasse automatisch bei Systemaenderungen geaendert
+ // werden, wird der Status innerhalb einer System-International-
+ // Aenderung anders ermittelt, da ansonsten die App nicht
+ // mitbekommt, das sich etwas geaendert hat
+ if ( (mpData->maInternational.GetLanguage() == LANGUAGE_SYSTEM) ||
+ (mpData->maInternational.GetFormatLanguage() == LANGUAGE_SYSTEM) )
+ {
+ if ( ImplGetSVData()->maAppData.mbIntnChanged )
+ nChangeFlags |= SETTINGS_INTERNATIONAL;
+ }
+
+ return nChangeFlags;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL AllSettings::operator ==( const AllSettings& rSet ) const
+{
+ DBG_CHKTHIS( AllSettings, NULL );
+ DBG_CHKOBJ( &rSet, AllSettings, NULL );
+
+ if ( mpData == rSet.mpData )
+ return TRUE;
+
+ if ( (mpData->maMachineSettings == rSet.mpData->maMachineSettings) &&
+ (mpData->maMouseSettings == rSet.mpData->maMouseSettings) &&
+ (mpData->maKeyboardSettings == rSet.mpData->maKeyboardSettings) &&
+ (mpData->maStyleSettings == rSet.mpData->maStyleSettings) &&
+ (mpData->maMiscSettings == rSet.mpData->maMiscSettings) &&
+ (mpData->maSoundSettings == rSet.mpData->maSoundSettings) &&
+ (mpData->maNotificationSettings == rSet.mpData->maNotificationSettings) &&
+ (mpData->maHelpSettings == rSet.mpData->maHelpSettings) &&
+ (mpData->maInternational == rSet.mpData->maInternational) &&
+ (mpData->mnSystemUpdate == rSet.mpData->mnSystemUpdate) &&
+ (mpData->mnWindowUpdate == rSet.mpData->mnWindowUpdate) )
+ {
+ // special treatment for Locale, because maLocale is only
+ // initialized after first call of GetLocale().
+ ::com::sun::star::lang::Locale aEmptyLocale;
+ if ( ( ImplCompareLocales( mpData->maLocale, aEmptyLocale ) && ImplCompareLocales( rSet.mpData->maLocale, aEmptyLocale ) )
+ || ImplCompareLocales( GetLocale(), rSet.GetLocale() ) )
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const
+{
+ if ( !mpData->maLocale.Language.getLength() )
+ {
+ String aLanguage, aCountry;
+ ConvertLanguageToIsoNames( mpData->maInternational.GetLanguage(), aLanguage, aCountry );
+ ((AllSettings*)this)->mpData->maLocale.Language = aLanguage;
+ ((AllSettings*)this)->mpData->maLocale.Country = aCountry;
+ }
+ return mpData->maLocale;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, AllSettings& rSet )
+{
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const AllSettings& rSet )
+{
+ return rOStream;
+}
diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx
new file mode 100644
index 000000000000..c055f95fdd50
--- /dev/null
+++ b/vcl/source/app/sound.cxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * $RCSfile: sound.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SOUND_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALSOUND_HXX
+#include <salsound.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#else
+#include <rmwindow.hxx>
+#include <rmsound.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _NEW_HXX
+#include <tools/new.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_SALSOUND_HXX
+#include <salsound.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_SOUND_HXX
+#include <sound.hxx>
+#endif
+
+#pragma hdrstop
+
+// ----------------------
+// - SalSound-Callback -
+// ----------------------
+
+#ifndef REMOTE_APPSERVER
+
+void SalSoundProc( void* pInst, SoundNotification eNotification, ULONG nError )
+{
+ ( (Sound*) pInst )->ImplNotify( eNotification, nError );
+}
+
+#endif
+
+// ---------
+// - Sound -
+// ---------
+
+Sound::Sound( Window* pWindow ) :
+ mpWindow ( pWindow ),
+ mpSoundData ( NULL ),
+ mnDataLen ( 0UL ),
+ mnSoundLen ( 0UL ),
+ mnStartTime ( 0UL ),
+ mnPlayTime ( SOUND_PLAYALL ),
+ mnErrorCode ( 0UL ),
+ meNotification ( SOUND_NOTIFY_SUCCESS ),
+ mbPlaying ( FALSE ),
+ mbLoopMode ( FALSE )
+{
+#ifndef REMOTE_APPSERVER
+
+ mpSound = new SalSound;
+ mpSound->Create();
+
+ if( mpSound->IsValid() )
+ mpSound->SetNotifyProc( this, SalSoundProc );
+
+#else
+
+ mpSound = new RMSound;
+ mpSound->Create( this );
+
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+Sound::~Sound()
+{
+ if( mpSoundData )
+ SvMemFree( mpSoundData );
+
+ delete mpSound;
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::ImplNotify( SoundNotification eNotification, ULONG nError )
+{
+ meNotification = eNotification;
+ mbPlaying = FALSE;
+
+ if( SOUND_NOTIFY_ERROR == meNotification )
+ mnErrorCode = nError;
+
+ Notify();
+
+ if( maNotifyHdl.IsSet() )
+ maNotifyHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::Notify()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Sound::SetSoundName( const XubString& rSoundName )
+{
+ BOOL bRet;
+
+ if( !rSoundName.Len() )
+ {
+ mnDataLen = 0UL;
+ mnSoundLen = 0UL;
+ mnStartTime = 0UL;
+ mnPlayTime = SOUND_PLAYALL;
+ mnErrorCode = 0UL;
+ meNotification = SOUND_NOTIFY_SUCCESS;
+ mbPlaying = FALSE;
+ mbLoopMode = FALSE;
+ bRet = TRUE;
+
+#ifdef REMOTE_APPSERVER
+ if( mpSoundData )
+ {
+ SvMemFree( mpSoundData );
+ mpSoundData = NULL;
+ }
+
+ // if IFace is init., destroy it and create a new one
+ if( maSoundName.Len() )
+ {
+ delete mpSound;
+ mpSound = new RMSound;
+ mpSound->Create( this );
+ }
+#else
+ mpSound->Init( NULL, rSoundName, mnSoundLen );
+#endif
+ }
+ else if( mpSound->IsValid() )
+ bRet = mpSound->Init( NULL, rSoundName, mnSoundLen );
+ else
+ bRet = FALSE;
+
+ maSoundName = rSoundName;
+
+ // if sound could not be initialized, but we've gotten _no_
+ // notification ==> create common error notification
+ if( !bRet && !mnErrorCode )
+ ImplNotify( SOUND_NOTIFY_ERROR, SOUNDERR_GENERAL_ERROR );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Sound::SetSoundData( const BYTE* pSoundData, ULONG nDataLen )
+{
+ BOOL bRet;
+
+ if( mpSoundData )
+ SvMemFree( mpSoundData );
+
+ mpSoundData = (BYTE*) SvMemAlloc( mnDataLen = nDataLen );
+ HMEMCPY( mpSoundData, pSoundData, nDataLen );
+
+ if( mpSound->IsValid() )
+ bRet = mpSound->Init( NULL, mpSoundData, mnDataLen, mnSoundLen );
+ else
+ bRet = FALSE;
+
+ // if sound could not be initialized, but we've gotten _no_
+ // notification ==> create common error notification
+ if( !bRet && !mnErrorCode )
+ ImplNotify( SOUND_NOTIFY_ERROR, SOUNDERR_GENERAL_ERROR );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::SetStartTime( ULONG nStartTime )
+{
+ mnStartTime = nStartTime;
+
+#ifdef REMOTE_APPSERVER
+ mpSound->SetStartTime( nStartTime );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::SetPlayTime( ULONG nPlayTime )
+{
+ mnPlayTime = nPlayTime;
+
+#ifdef REMOTE_APPSERVER
+ mpSound->SetStartTime( nPlayTime );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::SetLoopMode( BOOL bLoop )
+{
+ mbLoopMode = bLoop;
+
+#ifdef REMOTE_APPSERVER
+ mpSound->SetStartTime( bLoop );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::ClearError()
+{
+ mnErrorCode = 0;
+
+#ifdef REMOTE_APPSERVER
+ mpSound->ClearError();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::Play()
+{
+ BOOL bRet;
+
+ if( mpSound->IsValid() && !mnErrorCode )
+ {
+#ifndef REMOTE_APPSERVER
+ mpSound->Play( mnStartTime, mnPlayTime, mbLoopMode );
+#else
+ mpSound->Play();
+#endif
+
+ mbPlaying = TRUE;
+ }
+ else
+ bRet = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::Stop()
+{
+ mbPlaying = FALSE;
+
+ if( mpSound->IsValid() )
+ mpSound->Stop();
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::Pause()
+{
+ mbPlaying = FALSE;
+
+ if( mpSound->IsValid() )
+ mpSound->Pause();
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::Beep( SoundType eType, Window* pWindow )
+{
+ if( !pWindow )
+ ImplGetDefaultWindow()->ImplGetFrame()->Beep( eType );
+ else
+ pWindow->ImplGetFrame()->Beep( eType );
+}
+
+// -----------------------------------------------------------------------
+
+void Sound::SetSoundPath( const XubString& rSoundPath )
+{
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& Sound::GetSoundPath()
+{
+ return ImplGetSVEmptyStr();
+}
diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx
new file mode 100644
index 000000000000..8eafc26e474f
--- /dev/null
+++ b/vcl/source/app/stdtext.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdtext.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_STDTEXT_CXX
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <msgbox.hxx>
+#endif
+#ifndef _VCL_STDTEXT_HXX
+#include <stdtext.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+XubString GetStandardText( USHORT nStdText )
+{
+ XubString aText( ResId( nStdText-STANDARD_TEXT_FIRST+SV_STDTEXT_FIRST, ImplGetResMgr() ) );
+ return aText;
+}
+
+// =======================================================================
+
+void ShowServiceNotAvailableError( Window* pParent,
+ const XubString& rServiceName, BOOL bError )
+{
+ XubString aText( GetStandardText( STANDARD_TEXT_SERVICE_NOT_AVAILABLE ) );
+ aText.SearchAndReplaceAscii( "%s", rServiceName );
+ if ( bError )
+ {
+ ErrorBox aBox( pParent, WB_OK | WB_DEF_OK, aText );
+ aBox.Execute();
+ }
+ else
+ {
+ WarningBox aBox( pParent, WB_OK | WB_DEF_OK, aText );
+ aBox.Execute();
+ }
+}
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
new file mode 100644
index 000000000000..459653156f73
--- /dev/null
+++ b/vcl/source/app/svapp.cxx
@@ -0,0 +1,1770 @@
+/*************************************************************************
+ *
+ * $RCSfile: svapp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_APP_CXX
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#else
+#include "rvp.hxx"
+#include <rmwindow.hxx>
+#include <rmevents.hxx>
+#include <vos/thread.hxx>
+#include <unobrok.hxx>
+#ifndef _SV_MSGBOX_HXX
+#include <msgbox.hxx>
+#endif
+#endif
+
+#ifndef _VOS_PROCESS_HXX
+#include <vos/process.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+#ifndef _DLL_HXX
+#include <tools/dll.hxx>
+#endif
+#endif
+#ifndef _TOOLS_H
+#include <tools/tools.h>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _ACCMGR_HXX
+#include <accmgr.hxx>
+#endif
+#ifndef _SV_KEYCOD_HXX
+#include <keycod.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_WINDATA_HXX
+#include <windata.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_IDLEMGR_HXX
+#include <idlemgr.hxx>
+#endif
+#ifndef _SV_DRAG_HXX
+#include <drag.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_CVTGRF_HXX
+#include <cvtgrf.hxx>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+#ifndef _VCL_UNOWRAP_HXX
+#include <unowrap.hxx>
+#endif
+
+#include <com/sun/star/awt/XToolkit.hpp>
+
+// #include <usr/refl.hxx>
+class Reflection;
+
+#pragma hdrstop
+
+// =======================================================================
+
+// --------------
+// - ImplHotKey -
+// --------------
+
+struct ImplHotKey
+{
+ ImplHotKey* mpNext;
+ void* mpUserData;
+ KeyCode maKeyCode;
+ Link maLink;
+};
+
+// =======================================================================
+
+// -----------------
+// - ImplEventHook -
+// -----------------
+
+struct ImplEventHook
+{
+ ImplEventHook* mpNext;
+ void* mpUserData;
+ VCLEventHookProc mpProc;
+};
+
+// =======================================================================
+
+Application* GetpApp()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData )
+ return NULL;
+ return pSVData->mpApp;
+}
+
+// -----------------------------------------------------------------------
+
+Application::Application()
+{
+ ImplInitSVData();
+ ImplGetSVData()->mpApp = this;
+#ifndef REMOTE_APPSERVER
+ InitSalData();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+Application::~Application()
+{
+ ImplDeInitSVData();
+#ifndef REMOTE_APPSERVER
+ DeInitSalData();
+#endif
+ ImplGetSVData()->mpApp = NULL;
+ ImplDestroySVData();
+ GlobalDeInitTools();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::InitAppRes( const ResId& rResId )
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::QueryExit()
+{
+ WorkWindow* pAppWin = ImplGetSVData()->maWinData.mpAppWin;
+
+ // Aufruf des Close-Handlers des Applikationsfensters
+ if ( pAppWin )
+ return pAppWin->Close();
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::UserEvent( ULONG, void* )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::ShowStatusText( const XubString& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::ShowHelpStatusText( const XubString& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::ActivateExtHelp()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::DeactivateExtHelp()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::HideStatusText()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::HideHelpStatusText()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::FocusChanged()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::DataChanged( const DataChangedEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Application::GetCommandLineParamCount()
+{
+ NAMESPACE_VOS( OStartupInfo ) aStartInfo;
+ return (USHORT)aStartInfo.getCommandArgCount();
+}
+
+// -----------------------------------------------------------------------
+
+XubString Application::GetCommandLineParam( USHORT nParam )
+{
+ NAMESPACE_VOS( OStartupInfo ) aStartInfo;
+ NAMESPACE_RTL( OUString ) aParam;
+ aStartInfo.getCommandArg( nParam, aParam );
+ return XubString( aParam );
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& Application::GetAppFileName()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ DBG_ASSERT( pSVData->maAppData.mpAppFileName, "AppFileName vor SVMain ?!" );
+ if ( pSVData->maAppData.mpAppFileName )
+ return *pSVData->maAppData.mpAppFileName;
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Application::Exception( USHORT nError )
+{
+ switch ( nError & EXC_MAJORTYPE )
+ {
+ // Bei System machen wir nichts und lassen dem System den
+ // vortritt
+ case EXC_SYSTEM:
+ return 0;
+
+ case EXC_DISPLAY:
+ case EXC_REMOTE:
+ return 0;
+
+#ifdef DBG_UTIL
+ case EXC_RSCNOTLOADED:
+ Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "Resource not loaded" ) ) );
+ break;
+ case EXC_SYSOBJNOTCREATED:
+ Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "System Object not created" ) ) );
+ break;
+ default:
+ Abort( XubString( RTL_CONSTASCII_USTRINGPARAM( "Unknown Error" ) ) );
+ break;
+#else
+ default:
+ Abort( ImplGetSVEmptyStr() );
+ break;
+#endif
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::Abort( const XubString& rErrorText )
+{
+#ifndef REMOTE_APPSERVER
+ SalAbort( rErrorText );
+#else
+ ErrorBox aErrorBox( NULL, WB_OK, rErrorText );
+ aErrorBox.Execute();
+ exit(-1);
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef REMOTE_APPSERVER
+
+ImplRemoteYieldMutex::ImplRemoteYieldMutex()
+{
+ mnCount = 0;
+ mnMainThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnThreadId = 0;
+}
+
+void SAL_CALL ImplRemoteYieldMutex::acquire()
+{
+ OMutex::acquire();
+ mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnCount++;
+}
+
+void SAL_CALL ImplRemoteYieldMutex::release()
+{
+ if ( mnThreadId == NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ if ( mnCount == 1 )
+ mnThreadId = 0;
+ mnCount--;
+ }
+ OMutex::release();
+}
+
+sal_Bool SAL_CALL ImplRemoteYieldMutex::tryToAcquire()
+{
+ if ( OMutex::tryToAcquire() )
+ {
+ mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnCount++;
+ return True;
+ }
+ else
+ return False;
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+
+void ImplDbgTestSolarMutex()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maAppData.mpSolarMutex->GetMainThreadId() !=
+ NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ if ( pSVData->maAppData.mpSolarMutex->GetThreadId() !=
+ NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" );
+ }
+ }
+ else
+ {
+ if ( pSVData->maAppData.mpSolarMutex->GetThreadId() !=
+ NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ DBG_ERROR( "SolarMutex not locked in the main thread" );
+ }
+ }
+}
+
+#endif
+
+
+NAMESPACE_VOS(OThreadData)* getThreadLocalEnvironment();
+
+static void ImplRemoteDispatch( BOOL bWait )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Yield-Semaphore freigeben
+ ULONG nAcquireCount;
+ ULONG i;
+ if ( pSVData->maAppData.mpSolarMutex->GetThreadId() ==
+ ::vos::OThread::getCurrentIdentifier() )
+ {
+ nAcquireCount = pSVData->maAppData.mpSolarMutex->GetAcquireCount();
+ for ( i = 0; i < nAcquireCount; i++ )
+ pSVData->maAppData.mpSolarMutex->release();
+ }
+ else
+ nAcquireCount = 0;
+
+ RmEvent* pEvent = pSVData->mpRmEventQueue->GetNextEvent( bWait );
+
+ // Yield-Semaphore wieder holen
+ while ( nAcquireCount )
+ {
+ pSVData->maAppData.mpSolarMutex->acquire();
+ nAcquireCount--;
+ }
+
+ if ( pEvent )
+ ImplDispatchEvent( (ExtRmEvent*)pEvent );
+ else
+ ::vos::OThread::yield();
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+void Application::Execute()
+{
+ DBG_STARTAPPEXECUTE();
+
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maAppData.mbInAppExecute = TRUE;
+
+ while ( !pSVData->maAppData.mbAppQuit )
+ Application::Yield();
+
+ pSVData->maAppData.mbInAppExecute = FALSE;
+
+ DBG_ENDAPPEXECUTE();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::Reschedule()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Restliche Timer abarbeitet
+ while ( pSVData->mbNotAllTimerCalled )
+ ImplTimerCallbackProc();
+
+ pSVData->maAppData.mnDispatchLevel++;
+#ifndef REMOTE_APPSERVER
+ pSVData->mpDefInst->Yield( FALSE );
+#else
+ ImplRemoteDispatch( FALSE );
+#endif
+ pSVData->maAppData.mnDispatchLevel--;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::Yield()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Restliche Timer abarbeitet
+ while ( pSVData->mbNotAllTimerCalled )
+ ImplTimerCallbackProc();
+
+ // Wenn Application schon beendet wurde, warten wir nicht mehr auf
+ // Messages, sondern verarbeiten nur noch welche, wenn noch welche
+ // vorliegen
+ pSVData->maAppData.mnDispatchLevel++;
+#ifndef REMOTE_APPSERVER
+ pSVData->mpDefInst->Yield( !pSVData->maAppData.mbAppQuit );
+#else
+ ImplRemoteDispatch( TRUE );
+#endif
+ pSVData->maAppData.mnDispatchLevel--;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void*, EMPTYARG )
+{
+ ImplGetSVData()->maAppData.mbAppQuit = TRUE;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::Quit()
+{
+ Application::PostUserEvent( STATIC_LINK( NULL, ImplSVAppData, ImplQuitMsg ) );
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef _VOS_NO_NAMESPACE
+IMutex& Application::GetSolarMutex()
+#else
+vos::IMutex& Application::GetSolarMutex()
+#endif
+{
+#ifndef REMOTE_APPSERVER
+ ImplSVData* pSVData = ImplGetSVData();
+ return *(pSVData->mpDefInst->GetYieldMutex());
+#else
+ return *(ImplGetSVData()->maAppData.mpSolarMutex);
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef _VOS_NO_NAMESPACE
+OThread::TThreadIdentifier Application::GetMainThreadIdentifier()
+#else
+vos::OThread::TThreadIdentifier Application::GetMainThreadIdentifier()
+#endif
+{
+ return ImplGetSVData()->mnMainThreadId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Application::ReleaseSolarMutex()
+{
+#ifndef REMOTE_APPSERVER
+ ImplSVData* pSVData = ImplGetSVData();
+ return pSVData->mpDefInst->ReleaseYieldMutex();
+#else
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Wenn wir gelockt haben, dann freigeben
+ if ( pSVData->maAppData.mpSolarMutex->GetThreadId() ==
+ NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ ULONG nCount = pSVData->maAppData.mpSolarMutex->GetAcquireCount();
+ ULONG n = nCount;
+ while ( n )
+ {
+ pSVData->maAppData.mpSolarMutex->release();
+ n--;
+ }
+
+ return nCount;
+ }
+ else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Application::AcquireSolarMutex( ULONG nCount )
+{
+#ifndef REMOTE_APPSERVER
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->mpDefInst->AcquireYieldMutex( nCount );
+#else
+ ImplSVData* pSVData = ImplGetSVData();
+ while ( nCount )
+ {
+ pSVData->maAppData.mpSolarMutex->acquire();
+ nCount--;
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsInMain()
+{
+ return ImplGetSVData()->maAppData.mbInAppMain;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsInExecute()
+{
+ return ImplGetSVData()->maAppData.mbInAppExecute;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsShutDown()
+{
+ return ImplGetSVData()->maAppData.mbAppQuit;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsInModalMode()
+{
+ return (ImplGetSVData()->maAppData.mnModalMode != 0);
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Application::GetDispatchLevel()
+{
+ return ImplGetSVData()->maAppData.mnDispatchLevel;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::AnyInput( USHORT nType )
+{
+#ifndef REMOTE_APPSERVER
+ return SalInstance::AnyInput( nType );
+#else
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if( ( nType & ( INPUT_ANY ) ) == ( INPUT_ANY ) )
+ {
+ return( pSVData->mpRmEventQueue->HasMouseEvent() ||
+ pSVData->mpRmEventQueue->HasKeyEvent() ||
+ pSVData->mpRmEventQueue->HasPaintEvent() ||
+ pSVData->mpRmEventQueue->HasTimerEvent() ||
+ pSVData->mpRmEventQueue->HasOtherEvent() );
+ }
+ else if( ( nType & ( INPUT_MOUSEANDKEYBOARD ) ) == ( INPUT_MOUSEANDKEYBOARD ) )
+ {
+ return( pSVData->mpRmEventQueue->HasMouseEvent() ||
+ pSVData->mpRmEventQueue->HasKeyEvent() );
+ }
+ else
+ {
+ if( nType & INPUT_MOUSE )
+ return pSVData->mpRmEventQueue->HasMouseEvent();
+
+ if( nType & INPUT_KEYBOARD )
+ return pSVData->mpRmEventQueue->HasKeyEvent();
+
+ if( nType & INPUT_PAINT )
+ return pSVData->mpRmEventQueue->HasPaintEvent();
+
+ if( nType & INPUT_TIMER )
+ return pSVData->mpRmEventQueue->HasTimerEvent();
+
+ if( nType & INPUT_OTHER )
+ return pSVData->mpRmEventQueue->HasOtherEvent();
+ }
+
+ return FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Application::GetLastInputInterval()
+{
+ return (Time::GetSystemTicks()-ImplGetSVData()->maAppData.mnLastInputTime);
+}
+
+// -----------------------------------------------------------------------
+
+extern int nImplSysDialog;
+
+BOOL Application::IsUICaptured()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ // Wenn Mouse gecaptured, oder im TrackingModus oder im Auswahlmodus
+ // eines FloatingWindows (wie Menus, Aufklapp-ToolBoxen) soll kein
+ // weiteres Fenster aufgezogen werden
+ if ( pSVData->maWinData.mpCaptureWin || pSVData->maWinData.mpTrackWin ||
+ pSVData->maWinData.mpFirstFloat || DragManager::GetDragManager() ||
+ nImplSysDialog )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsUserActive( USHORT nTest )
+{
+ if ( nTest & (USERACTIVE_MOUSEDRAG | USERACTIVE_INPUT) )
+ {
+ if ( IsUICaptured() )
+ return TRUE;
+ }
+
+ if ( nTest & USERACTIVE_INPUT )
+ {
+ if ( GetLastInputInterval() < 500 )
+ return TRUE;
+
+ if ( AnyInput( INPUT_KEYBOARD ) )
+ return TRUE;
+ }
+
+ if ( nTest & USERACTIVE_MODALDIALOG )
+ {
+ if ( ImplGetSVData()->maAppData.mnModalDialog )
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SystemSettingsChanging( AllSettings& rSettings,
+ Window* pFrame )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Application::MergeSystemSettings( AllSettings& rSettings )
+{
+#ifndef REMOTE_APPSERVER
+ ImplGetDefaultWindow()->ImplGetFrame()->UpdateSettings( rSettings );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetSettings( const AllSettings& rSettings )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maAppData.mpSettings )
+ {
+ pSVData->maAppData.mpSettings = new AllSettings();
+ *pSVData->maAppData.mpSettings = rSettings;
+ }
+ else
+ {
+ AllSettings aOldSettings = *pSVData->maAppData.mpSettings;
+ *pSVData->maAppData.mpSettings = rSettings;
+ ULONG nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings );
+ if ( nChangeFlags )
+ {
+ DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags );
+ GetpApp()->DataChanged( aDCEvt );
+
+ // Update all windows
+ Window* pFirstFrame = pSVData->maWinData.mpFirstFrame;
+ // Daten, die neu berechnet werden muessen, zuruecksetzen
+ long nOldDPIX;
+ long nOldDPIY;
+ if ( pFirstFrame )
+ {
+ nOldDPIX = pFirstFrame->mnDPIX;
+ nOldDPIY = pFirstFrame->mnDPIY;
+ pSVData->maGDIData.mnAppFontX = 0;
+ }
+ Window* pFrame = pFirstFrame;
+ while ( pFrame )
+ {
+ // AppFont-Cache-Daten zuruecksetzen
+ pFrame->mpFrameData->meMapUnit = MAP_PIXEL;
+
+ // UpdateSettings am ClientWindow aufrufen, damit
+ // die Daten nicht doppelt geupdatet werden
+ Window* pClientWin = pFrame;
+ while ( pClientWin->ImplGetClientWindow() )
+ pClientWin = pClientWin->ImplGetClientWindow();
+ pClientWin->UpdateSettings( rSettings, TRUE );
+
+ Window* pTempWin = pFrame->mpFrameData->mpFirstOverlap;
+ while ( pTempWin )
+ {
+ // UpdateSettings am ClientWindow aufrufen, damit
+ // die Daten nicht doppelt geupdatet werden
+ pClientWin = pTempWin;
+ while ( pClientWin->ImplGetClientWindow() )
+ pClientWin = pClientWin->ImplGetClientWindow();
+ pClientWin->UpdateSettings( rSettings, TRUE );
+ pTempWin = pTempWin->mpNextOverlap;
+ }
+
+ pFrame = pFrame->mpFrameData->mpNextFrame;
+ }
+
+ // Wenn sich die DPI-Aufloesung fuer Screen-Ausgaben
+ // geaendert hat, setzen wir auch bei allen
+ // Screen-Kompatiblen VirDev's die neue Aufloesung
+ pFirstFrame = pSVData->maWinData.mpFirstFrame;
+ if ( pFirstFrame )
+ {
+ if ( (pFirstFrame->mnDPIX != nOldDPIX) ||
+ (pFirstFrame->mnDPIY != nOldDPIY) )
+ {
+ VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev;
+ while ( pVirDev )
+ {
+ if ( pVirDev->mbScreenComp &&
+ (pVirDev->mnDPIX == nOldDPIX) &&
+ (pVirDev->mnDPIY == nOldDPIY) )
+ {
+ pVirDev->mnDPIX = pFirstFrame->mnDPIX;
+ pVirDev->mnDPIY = pFirstFrame->mnDPIY;
+ if ( pVirDev->IsMapMode() )
+ {
+ MapMode aMapMode = pVirDev->GetMapMode();
+ pVirDev->SetMapMode();
+ pVirDev->SetMapMode( aMapMode );
+ }
+ }
+
+ pVirDev = pVirDev->mpNext;
+ }
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const AllSettings& Application::GetSettings()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maAppData.mpSettings )
+ pSVData->maAppData.mpSettings = new AllSettings();
+ return *(pSVData->maAppData.mpSettings);
+}
+
+// -----------------------------------------------------------------------
+
+void Application::NotifyAllWindows( DataChangedEvent& rDCEvt )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ Window* pFrame = pSVData->maWinData.mpFirstFrame;
+ while ( pFrame )
+ {
+ pFrame->NotifyAllChilds( rDCEvt );
+
+ Window* pSysWin = pFrame->mpFrameData->mpFirstOverlap;
+ while ( pSysWin )
+ {
+ pSysWin->NotifyAllChilds( rDCEvt );
+ pSysWin = pSysWin->mpNextOverlap;
+ }
+
+ pFrame = pFrame->mpFrameData->mpNextFrame;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Application::PostUserEvent( ULONG nEvent, void* pEventData )
+{
+ ULONG nEventId;
+ PostUserEvent( nEventId, nEvent, pEventData );
+ return nEventId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Application::PostUserEvent( const Link& rLink, void* pCaller )
+{
+ ULONG nEventId;
+ PostUserEvent( nEventId, rLink, pCaller );
+ return nEventId;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData )
+{
+ ImplSVEvent* pSVEvent = new ImplSVEvent;
+ pSVEvent->mnEvent = nEvent;
+ pSVEvent->mpData = pEventData;
+ pSVEvent->mpLink = NULL;
+ pSVEvent->mpWindow = NULL;
+ pSVEvent->mbCall = TRUE;
+ rEventId = (ULONG)pSVEvent;
+#ifndef REMOTE_APPSERVER
+ if ( ImplGetDefaultWindow()->ImplGetFrame()->PostEvent( pSVEvent ) )
+ return TRUE;
+ else
+ {
+ rEventId = 0;
+ delete pSVEvent;
+ return FALSE;
+ }
+#else
+ ExtRmEvent* pEvt = new ExtRmEvent( RMEVENT_USEREVENT, NULL, pSVEvent );
+ ImplPostEvent( pEvt );
+ return TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller )
+{
+ ImplSVEvent* pSVEvent = new ImplSVEvent;
+ pSVEvent->mnEvent = 0;
+ pSVEvent->mpData = pCaller;
+ pSVEvent->mpLink = new Link( rLink );
+ pSVEvent->mpWindow = NULL;
+ pSVEvent->mbCall = TRUE;
+ rEventId = (ULONG)pSVEvent;
+#ifndef REMOTE_APPSERVER
+ if ( ImplGetDefaultWindow()->ImplGetFrame()->PostEvent( pSVEvent ) )
+ return TRUE;
+ else
+ {
+ rEventId = 0;
+ delete pSVEvent;
+ return FALSE;
+ }
+#else
+ ExtRmEvent* pEvt = new ExtRmEvent( RMEVENT_USEREVENT, NULL, pSVEvent );
+ ImplPostEvent( pEvt );
+ return TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RemoveUserEvent( ULONG nUserEvent )
+{
+ ImplSVEvent* pSVEvent = (ImplSVEvent*)nUserEvent;
+
+ DBG_ASSERT( !pSVEvent->mpWindow,
+ "Application::RemoveUserEvent(): Event is send to a window" );
+ DBG_ASSERT( pSVEvent->mbCall,
+ "Application::RemoveUserEvent(): Event is already removed" );
+
+ if ( pSVEvent->mpWindow )
+ {
+ pSVEvent->mpWindow->ImplRemoveDel( &(pSVEvent->maDelData) );
+ pSVEvent->mpWindow = NULL;
+ }
+
+ pSVEvent->mbCall = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::InsertIdleHdl( const Link& rLink, USHORT nPrio )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Falls er noch nicht existiert, dann anlegen
+ if ( !pSVData->maAppData.mpIdleMgr )
+ pSVData->maAppData.mpIdleMgr = new ImplIdleMgr;
+
+ return pSVData->maAppData.mpIdleMgr->InsertIdleHdl( rLink, nPrio );
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RemoveIdleHdl( const Link& rLink )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maAppData.mpIdleMgr )
+ pSVData->maAppData.mpIdleMgr->RemoveIdleHdl( rLink );
+}
+
+// -----------------------------------------------------------------------
+
+WorkWindow* Application::GetAppWindow()
+{
+ return ImplGetSVData()->maWinData.mpAppWin;
+}
+
+// -----------------------------------------------------------------------
+
+Window* Application::GetFocusWindow()
+{
+ return ImplGetSVData()->maWinData.mpFocusWin;
+}
+
+// -----------------------------------------------------------------------
+
+OutputDevice* Application::GetDefaultDevice()
+{
+ return ImplGetDefaultWindow();
+}
+
+// -----------------------------------------------------------------------
+
+Window* Application::GetFirstTopLevelWindow()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ return pSVData->maWinData.mpFirstFrame;
+}
+
+// -----------------------------------------------------------------------
+
+Window* Application::GetNextTopLevelWindow( Window* pWindow )
+{
+ return pWindow->mpFrameData->mpNextFrame;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetAppName( const XubString& rUniqueName )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Falls er noch nicht existiert, dann anlegen
+ if ( !pSVData->maAppData.mpAppName )
+ pSVData->maAppData.mpAppName = new XubString( rUniqueName );
+ else
+ *(pSVData->maAppData.mpAppName) = rUniqueName;
+}
+
+// -----------------------------------------------------------------------
+
+XubString Application::GetAppName()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maAppData.mpAppName )
+ return *(pSVData->maAppData.mpAppName);
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetDisplayName( const UniString& rName )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Falls er noch nicht existiert, dann anlegen
+ if ( !pSVData->maAppData.mpDisplayName )
+ pSVData->maAppData.mpDisplayName = new UniString( rName );
+ else
+ *(pSVData->maAppData.mpDisplayName) = rName;
+}
+
+// -----------------------------------------------------------------------
+
+UniString Application::GetDisplayName()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maAppData.mpDisplayName )
+ return *(pSVData->maAppData.mpDisplayName);
+ else if ( pSVData->maWinData.mpAppWin )
+ return pSVData->maWinData.mpAppWin->GetText();
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::InsertAccel( Accelerator* pAccel )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( !pSVData->maAppData.mpAccelMgr )
+ pSVData->maAppData.mpAccelMgr = new ImplAccelManager();
+ return pSVData->maAppData.mpAccelMgr->InsertAccel( pAccel );
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RemoveAccel( Accelerator* pAccel )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maAppData.mpAccelMgr )
+ pSVData->maAppData.mpAccelMgr->RemoveAccel( pAccel );
+}
+
+// -----------------------------------------------------------------------
+
+void Application::FlushAccel()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maAppData.mpAccelMgr )
+ pSVData->maAppData.mpAccelMgr->FlushAccel();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetHelp( Help* pHelp )
+{
+ ImplGetSVData()->maAppData.mpHelp = pHelp;
+}
+
+// -----------------------------------------------------------------------
+
+Help* Application::GetHelp()
+{
+ return ImplGetSVData()->maAppData.mpHelp;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::EnableAutoHelpId( BOOL bEnabled )
+{
+ ImplGetSVData()->maHelpData.mbAutoHelpId = bEnabled;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsAutoHelpIdEnabled()
+{
+ return ImplGetSVData()->maHelpData.mbAutoHelpId;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::EnableAutoMnemonic( BOOL bEnabled )
+{
+ ImplGetSVData()->maAppData.mbAutoMnemonics = bEnabled;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsAutoMnemonicEnabled()
+{
+ return ImplGetSVData()->maAppData.mbAutoMnemonics;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetDialogScaleX( short nScale )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maAppData.mnDialogScaleX = nScale;
+ pSVData->maGDIData.mnAppFontX = pSVData->maGDIData.mnRealAppFontX;
+ if ( nScale )
+ pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*nScale)/100;
+}
+
+// -----------------------------------------------------------------------
+
+short Application::GetDialogScaleX()
+{
+ return ImplGetSVData()->maAppData.mnDialogScaleX;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetDefDialogParent( Window* pWindow )
+{
+ ImplGetSVData()->maWinData.mpDefDialogParent = pWindow;
+}
+
+// -----------------------------------------------------------------------
+
+Window* Application::GetDefDialogParent()
+{
+ return ImplGetSVData()->maWinData.mpDefDialogParent;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::EnableDialogCancel( BOOL bDialogCancel )
+{
+ ImplGetSVData()->maAppData.mbDialogCancel = bDialogCancel;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsDialogCancelEnabled()
+{
+ return ImplGetSVData()->maAppData.mbDialogCancel;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetSystemWindowMode( USHORT nMode )
+{
+ ImplGetSVData()->maAppData.mnSysWinMode = nMode;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Application::GetSystemWindowMode()
+{
+ return ImplGetSVData()->maAppData.mnSysWinMode;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetResourcePath( const XubString& rPath )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Falls er noch nicht existiert, dann anlegen
+ if ( !pSVData->maAppData.mpResPath )
+ pSVData->maAppData.mpResPath = new XubString( rPath );
+ else
+ *(pSVData->maAppData.mpResPath) = rPath;
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& Application::GetResourcePath()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maAppData.mpResPath )
+ return *(pSVData->maAppData.mpResPath);
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::EnterMultiThread( BOOL bEnter )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+ ::EnterMultiThread( bEnter );
+#endif
+
+ if ( bEnter )
+ {
+ pSVData->mnThreadCount++;
+
+#ifndef REMOTE_APPSERVER
+ // Unser DefaultWindow muss vor einem Thread-Starten erzeugt werden,
+ // damit dieses im Hauptthread laeuft
+ ImplGetDefaultWindow();
+#endif
+ }
+ else
+ pSVData->mnThreadCount--;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsMultiThread()
+{
+ return (ImplGetSVData()->mnThreadCount != 0);
+}
+
+// -----------------------------------------------------------------------
+
+UniqueItemId Application::CreateUniqueId()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( !pSVData->maAppData.mpUniqueIdCont )
+ pSVData->maAppData.mpUniqueIdCont = new UniqueIdContainer( UNIQUEID_SV_BEGIN );
+ return pSVData->maAppData.mpUniqueIdCont->CreateId();
+}
+
+// -----------------------------------------------------------------------
+
+SystemInfoType Application::GetClientSystem()
+{
+#ifndef REMOTE_APPSERVER
+ return GetServerSystem();
+#else
+ static SystemInfoType nImplClientSystemInfo = 0;
+ if ( !nImplClientSystemInfo )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->mxStatus.is() )
+ nImplClientSystemInfo = (SystemInfoType)pSVData->mxStatus->GetSystemType();
+ }
+
+ return nImplClientSystemInfo;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+SystemInfoType Application::GetServerSystem()
+{
+#if defined( WIN )
+ return SYSTEMINFO_SYSTEM_WINDOWS | SYSTEMINFO_SYSTEMBASE_DOS;
+#elif defined( WNT )
+ return SYSTEMINFO_SYSTEM_WINDOWS | SYSTEMINFO_SYSTEMBASE_NT;
+#elif defined( OS2 )
+ return SYSTEMINFO_SYSTEM_OS2;
+#elif defined( MAC )
+ return SYSTEMINFO_SYSTEM_MAC;
+#elif defined( UNX )
+#if defined( LINUX )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_LINUX;
+#elif defined( SOLARIS )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_SOLARIS;
+#elif defined( SCO )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_SCO;
+#elif defined( NETBSD )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_NETBSD;
+#elif defined( AIX )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_AIX;
+#elif defined( IRIX )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_IRIX;
+#elif defined( HPUX )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_HPUX;
+#elif defined( FREEBSD )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_FREEBSD;
+#elif defined( MACOSX )
+ return SYSTEMINFO_SYSTEM_UNIX | SYSTEMINFO_SYSTEMBASE_MACOSX;
+#else
+#error Unknown Unix-System, new SystemBase must be defined!
+#endif
+#else
+#error Unknown System, new System must be defined!
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::IsRemoteServer()
+{
+#ifndef REMOTE_APPSERVER
+ return FALSE;
+#else
+ return TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void* Application::GetRemoteEnvironment()
+{
+#ifndef REMOTE_APPSERVER
+ return NULL;
+#else
+ return ImplGetSVData()->mhRemoteEnv;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > Application::GetVCLToolkit()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > xT;
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ if ( pWrapper )
+ xT = pWrapper->GetVCLToolkit();
+ return xT;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RegisterUnoServices()
+{
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ if ( pWrapper )
+ pWrapper->RegisterUnoServices();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetUnoWrapper( UnoWrapperBase* pWrapper )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ DBG_ASSERT( !pSVData->mpUnoWrapper, "SetUnoWrapper: Wrapper allready exists" );
+ pSVData->mpUnoWrapper = pWrapper;
+}
+
+// -----------------------------------------------------------------------
+
+UnoWrapperBase* Application::GetUnoWrapper()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ return pSVData->mpUnoWrapper;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetFilterHdl( const Link& rLink )
+{
+ ImplGetSVData()->maGDIData.mpGrfConverter->SetFilterHdl( rLink );
+}
+
+// -----------------------------------------------------------------------
+
+const Link& Application::GetFilterHdl()
+{
+ return ImplGetSVData()->maGDIData.mpGrfConverter->GetFilterHdl();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::AccessNotify( const AccessNotification& rNotification )
+{
+ GetFirstAccessHdl().Call( (void*) &rNotification );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Application::GenerateAccessEvent( ULONG nAccessEvent,
+ long nData1,
+ long nData2,
+ long nData3 )
+{
+ BOOL bRet = FALSE;
+
+ switch( nAccessEvent )
+ {
+ case( ACCESS_EVENT_DLGCONTROLS ):
+ {
+ if( IsInModalMode() )
+ {
+ Window* pDlgWin = GetFocusWindow();
+ BOOL bFound = FALSE;
+
+ // find modal dialog
+ while( pDlgWin && !bFound )
+ {
+ switch( pDlgWin->GetType() )
+ {
+ case( WINDOW_MESSBOX ):
+ case( WINDOW_INFOBOX ):
+ case( WINDOW_WARNINGBOX ):
+ case( WINDOW_ERRORBOX ):
+ case( WINDOW_QUERYBOX ):
+ case( WINDOW_MODALDIALOG ):
+ case( WINDOW_PATHDIALOG ):
+ case( WINDOW_FILEDIALOG ):
+ case( WINDOW_PRINTERSETUPDIALOG ):
+ case( WINDOW_PRINTDIALOG ):
+ case( WINDOW_COLORDIALOG ):
+ case( WINDOW_FONTDIALOG ):
+ case( WINDOW_TABDIALOG ):
+ case( WINDOW_BUTTONDIALOG ):
+ bFound = TRUE;
+ break;
+
+ default:
+ pDlgWin = pDlgWin->GetWindow( WINDOW_PARENT );
+ break;
+ }
+ }
+
+ if( pDlgWin )
+ {
+ AccessNotify( AccessNotification( ACCESS_EVENT_DLGCONTROLS, pDlgWin ) );
+ bRet = TRUE;
+ }
+ }
+ }
+ break;
+
+ case( ACCESS_EVENT_KEY ):
+ AccessNotify( AccessNotification( ACCESS_EVENT_KEY, nData1, nData2, nData3 ) );
+ break;
+
+ default:
+ break;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::AddAccessHdl( const Link& rLink )
+{
+ if( !ImplGetSVData()->maAppData.mpAccessList )
+ ImplGetSVData()->maAppData.mpAccessList = new List;
+
+ List* pList = ImplGetSVData()->maAppData.mpAccessList;
+ BOOL bInserted = FALSE;
+
+ for( void* pLink = pList->First(); pLink; pLink = pList->Next() )
+ {
+ if( *(Link*) pLink == rLink )
+ {
+ bInserted = TRUE;
+ break;
+ }
+ }
+
+ if( !bInserted )
+ {
+ ImplGetSVData()->maAppData.mnAccessCount++;
+ pList->Insert( new Link( rLink ), LIST_APPEND );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RemoveAccessHdl( const Link& rLink )
+{
+ List* pList = ImplGetSVData()->maAppData.mpAccessList;
+
+ if( pList )
+ {
+ for( void* pLink = pList->First(); pLink; pLink = pList->Next() )
+ {
+ if( *(Link*) pLink == rLink )
+ {
+ ImplGetSVData()->maAppData.mnAccessCount--;
+ delete (Link*) pList->Remove( pLink );
+ break;
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Application::GetAccessHdlCount()
+{
+ return ImplGetSVData()->maAppData.mnAccessCount;
+}
+
+// -----------------------------------------------------------------------
+
+Link Application::GetFirstAccessHdl()
+{
+ List* pList = ImplGetSVData()->maAppData.mpAccessList;
+
+ if( pList && pList->Count() )
+ return *(Link*) pList->First();
+ else
+ return Link();
+}
+
+// -----------------------------------------------------------------------
+
+void Application::CallNextAccessHdl( AccessNotification* pData )
+{
+ List* pList = ImplGetSVData()->maAppData.mpAccessList;
+
+ if( pList )
+ {
+ Link* pNext = (Link*) pList->Next();
+
+ if( pNext )
+ pNext->Call( pData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplCallHotKey( const KeyCode& rKeyCode )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
+ while ( pHotKeyData )
+ {
+ if ( pHotKeyData->maKeyCode.IsDefinedKeyCodeEqual( rKeyCode ) )
+ {
+ pHotKeyData->maLink.Call( pHotKeyData->mpUserData );
+ return TRUE;
+ }
+
+ pHotKeyData = pHotKeyData->mpNext;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFreeHotKeyData()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplHotKey* pTempHotKeyData;
+ ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
+ while ( pHotKeyData )
+ {
+ pTempHotKeyData = pHotKeyData->mpNext;
+ delete pHotKeyData;
+ pHotKeyData = pTempHotKeyData;
+ }
+
+ pSVData->maAppData.mpFirstHotKey = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Application::AddHotKey( const KeyCode& rKeyCode, const Link& rLink, void* pData )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplHotKey* pHotKeyData = new ImplHotKey;
+ pHotKeyData->mpUserData = pData;
+ pHotKeyData->maKeyCode = rKeyCode;
+ pHotKeyData->maLink = rLink;
+ pHotKeyData->mpNext = pSVData->maAppData.mpFirstHotKey;
+ pSVData->maAppData.mpFirstHotKey = pHotKeyData;
+ return (ULONG)pHotKeyData;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RemoveHotKey( ULONG nId )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplHotKey* pFindHotKeyData = (ImplHotKey*)nId;
+ ImplHotKey* pPrevHotKeyData = NULL;
+ ImplHotKey* pHotKeyData = pSVData->maAppData.mpFirstHotKey;
+ while ( pHotKeyData )
+ {
+ if ( pHotKeyData == pFindHotKeyData )
+ {
+ if ( pPrevHotKeyData )
+ pPrevHotKeyData->mpNext = pFindHotKeyData->mpNext;
+ else
+ pSVData->maAppData.mpFirstHotKey = pFindHotKeyData->mpNext;
+ delete pFindHotKeyData;
+ break;
+ }
+
+ pPrevHotKeyData = pHotKeyData;
+ pHotKeyData = pHotKeyData->mpNext;
+ }
+
+ DBG_ASSERT( pHotKeyData, "Application::RemoveHotKey() - HotKey is not added" );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFreeEventHookData()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplEventHook* pTempEventHookData;
+ ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
+ while ( pEventHookData )
+ {
+ pTempEventHookData = pEventHookData->mpNext;
+ delete pEventHookData;
+ pEventHookData = pTempEventHookData;
+ }
+
+ pSVData->maAppData.mpFirstEventHook = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Application::AddEventHook( VCLEventHookProc pProc, void* pData )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplEventHook* pEventHookData = new ImplEventHook;
+ pEventHookData->mpUserData = pData;
+ pEventHookData->mpProc = pProc;
+ pEventHookData->mpNext = pSVData->maAppData.mpFirstEventHook;
+ pSVData->maAppData.mpFirstEventHook = pEventHookData;
+ return (ULONG)pEventHookData;
+}
+
+// -----------------------------------------------------------------------
+
+void Application::RemoveEventHook( ULONG nId )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplEventHook* pFindEventHookData = (ImplEventHook*)nId;
+ ImplEventHook* pPrevEventHookData = NULL;
+ ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
+ while ( pEventHookData )
+ {
+ if ( pEventHookData == pFindEventHookData )
+ {
+ if ( pPrevEventHookData )
+ pPrevEventHookData->mpNext = pFindEventHookData->mpNext;
+ else
+ pSVData->maAppData.mpFirstEventHook = pFindEventHookData->mpNext;
+ delete pFindEventHookData;
+ break;
+ }
+
+ pPrevEventHookData = pEventHookData;
+ pEventHookData = pEventHookData->mpNext;
+ }
+
+ DBG_ASSERT( pEventHookData, "Application::RemoveEventHook() - EventHook is not added" );
+}
+
+// -----------------------------------------------------------------------
+
+long Application::CallEventHooks( NotifyEvent& rEvt )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ long nRet = 0;
+ ImplEventHook* pTempEventHookData;
+ ImplEventHook* pEventHookData = pSVData->maAppData.mpFirstEventHook;
+ while ( pEventHookData )
+ {
+ pTempEventHookData = pEventHookData->mpNext;
+ nRet = pEventHookData->mpProc( rEvt, pEventHookData->mpUserData );
+ if ( nRet )
+ break;
+ pEventHookData = pTempEventHookData;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+long Application::CallPreNotify( NotifyEvent& rEvt )
+{
+ return ImplCallPreNotify( rEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long Application::CallEvent( NotifyEvent& rEvt )
+{
+ return ImplCallEvent( rEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Application::SetAppInternational( const International& rIntn )
+{
+ AllSettings aSettings = GetSettings();
+ aSettings.SetInternational( rIntn );
+ SetSettings( aSettings );
+}
+
+// -----------------------------------------------------------------------
+
+const International& Application::GetAppInternational()
+{
+ return GetSettings().GetInternational();
+}
+
+// =======================================================================
+
+void InitVCL()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitVCL()
+{
+}
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
new file mode 100644
index 000000000000..7b7e1c38b2ed
--- /dev/null
+++ b/vcl/source/app/svdata.cxx
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * $RCSfile: svdata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#define _SV_SVDATA_CXX
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#endif
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#define private public
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+
+#ifndef _VCL_UNOWRAP_HXX
+#include <unowrap.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+// static Empty-SV-String
+static XubString aImplSVEmptyStr;
+XubString& rImplSVEmptyStr = aImplSVEmptyStr;
+#ifdef ENABLEUNICODE
+static ByteString aImplSVEmptyByteStr;
+ByteString& rImplSVEmptyByteStr = aImplSVEmptyByteStr;
+#endif
+
+#ifndef WIN
+ImplSVData private_aImplSVData;
+// static SV-Data
+ImplSVData* pImplSVData = &private_aImplSVData;
+#endif
+
+// static SharedLib SV-Data
+ImplSVShlData aImplSVShlData;
+
+// =======================================================================
+
+void ImplInitSVData()
+{
+#ifndef WIN
+ ImplSVData* pSVData = pImplSVData;
+ ImplSVData** ppSVData = (ImplSVData**)GetAppData( SHL_SV );
+ *ppSVData = &private_aImplSVData;
+#else
+ // alloc global instance data
+ ImplSVData* pSVData = new ImplSVData;
+ ImplSVData** ppSVData = (ImplSVData**)GetAppData( SHL_SV );
+ *ppSVData = pSVData;
+#endif
+
+ // init global sharedlib data
+ // ...
+
+ // init global instance data
+ memset( pSVData, 0, sizeof( ImplSVData ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDeInitSVData()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // delete global instance data
+
+ if ( pSVData->mpUnoWrapper )
+ {
+ pSVData->mpUnoWrapper->Destroy();
+ pSVData->mpUnoWrapper = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDestroySVData()
+{
+ ImplSVData** ppSVData = (ImplSVData**)GetAppData( SHL_SV );
+ ImplSVData* pSVData = *ppSVData;
+#ifdef WIN
+ delete pSVData;
+#endif
+
+ // delete global sharedlib data
+ // ...
+
+ *ppSVData = NULL;
+#ifndef WIN
+ pImplSVData = NULL;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+Window* ImplGetDefaultWindow()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maWinData.mpAppWin )
+ return pSVData->maWinData.mpAppWin;
+
+ if ( !pSVData->mpDefaultWin )
+ {
+ DBG_WARNING( "ImplGetDefaultWindow(): No AppWindow" );
+ Application::GetSolarMutex().acquire();
+ pSVData->mpDefaultWin = new WorkWindow( 0, 0 );
+ Application::GetSolarMutex().release();
+ }
+
+ return pSVData->mpDefaultWin;
+}
+
+// -----------------------------------------------------------------------
+
+#define VCL_CREATERESMGR_NAME( Name ) #Name MAKE_NUMSTR( SUPD )
+#define VCL_CREATERESMGR( Name ) ResMgr::CreateResMgr( VCL_CREATERESMGR_NAME( Name ) )
+
+ResMgr* ImplGetResMgr()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->mpResMgr )
+ pSVData->mpResMgr = VCL_CREATERESMGR( vcl );
+ return pSVData->mpResMgr;
+}
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+
+Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ Window* pFrameWindow = pSVData->maWinData.mpFirstFrame;
+ while ( pFrameWindow )
+ {
+ if ( pFrameWindow->ImplGetFrame() == pFrame )
+ {
+ Window* pWindow = pFrameWindow->ImplFindWindow( rSalFramePos );
+ if ( !pWindow )
+ pWindow = pFrameWindow->ImplGetWindow();
+ rSalFramePos = pWindow->ImplFrameToOutput( rSalFramePos );
+ return pWindow;
+ }
+ pFrameWindow = pFrameWindow->mpFrameData->mpNextFrame;
+ }
+
+ return NULL;
+}
+
+#endif
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
new file mode 100644
index 000000000000..2b7d389a5aeb
--- /dev/null
+++ b/vcl/source/app/svmain.cxx
@@ -0,0 +1,714 @@
+/*************************************************************************
+ *
+ * $RCSfile: svmain.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SVMAIN_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALSOUND_HXX
+#include <salsound.hxx>
+#endif
+#ifndef _SV_SALOGL_HXX
+#include <salogl.hxx>
+#endif
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+#ifndef _OSL_UTIL_H
+#include <osl/util.h>
+#endif
+#ifndef _VOS_SIGNAL_HXX
+#include <vos/signal.hxx>
+#endif
+#ifndef _VOS_CHANNEL_HXX
+#include <vos/channel.hxx>
+#endif
+#ifndef _VOS_SOCKET_HXX
+#include <vos/socket.hxx>
+#endif
+#ifndef _TOOLS_H
+#include <tools/tools.h>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _UNIQID_HXX
+#include <tools/unqid.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_DBGGUI_HXX
+#include <dbggui.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_CVTGRF_HXX
+#include <cvtgrf.hxx>
+#endif
+#ifndef _SV_IMAGE_HXX
+#include <image.hxx>
+#endif
+#ifndef _SV_RESMGR_HXX
+#include <resmgr.hxx>
+#endif
+#ifndef _SV_ACCMGR_HXX
+#include <accmgr.hxx>
+#endif
+#ifndef _SV_IDLEMGR_HXX
+#include <idlemgr.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+#ifndef _SV_PRINT_H
+#include <print.h>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+// HACK: Only for Exception-Hack
+#ifndef _SV_SYSEXCHG_HXX
+#include <sysexchg.hxx>
+#endif
+
+#include <vos/process.hxx>
+#include <osl/file.hxx>
+
+#ifdef REMOTE_APPSERVER
+#include <config.hxx>
+#include <ooffice.hxx>
+#include <rversion.h>
+#include <xevthdl.hxx>
+#include <rmevents.hxx>
+#include <rmprint.hxx>
+#include <outdev.h>
+#include <vos/mutex.hxx>
+#include <vos/timer.hxx>
+#include <unobrok.hxx>
+#include "rvp.hxx"
+#include <atom.hxx>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <unotools/processfactory.hxx>
+#include <unotools/regpathhelper.hxx>
+
+#include <com/sun/star/portal/client/XRmStatus.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::portal::client;
+using namespace ::cppu;
+using namespace ::rtl;
+
+#ifdef UNX
+class SalData
+{
+ void Init (int *pIPointer, char *pCPointer[] );
+};
+void SalData::Init (int *pIPointer, char *pCPointer[] )
+{};
+#endif /* UNX */
+
+#endif /* REMOTE_APPSERVER */
+
+#pragma hdrstop
+
+// =======================================================================
+
+class ImplVCLExceptionHandler : public ::vos::OSignalHandler
+{
+public:
+ virtual ::vos::OSignalHandler::TSignalAction SAL_CALL signal( ::vos::OSignalHandler::TSignalInfo* pInfo );
+};
+
+// -----------------------------------------------------------------------
+
+::vos::OSignalHandler::TSignalAction SAL_CALL ImplVCLExceptionHandler::signal( ::vos::OSignalHandler::TSignalInfo* pInfo )
+{
+ static BOOL bIn = FALSE;
+
+ // Wenn wir nocheinmal abstuerzen, verabschieden wir uns gleich
+ if ( !bIn )
+ {
+ USHORT nVCLException = 0;
+
+ // UAE
+ if ( (pInfo->Signal == TSignal_AccessViolation) ||
+ (pInfo->Signal == TSignal_IntegerDivideByZero) ||
+ (pInfo->Signal == TSignal_FloatDivideByZero) ||
+ (pInfo->Signal == TSignal_DebugBreak) )
+ nVCLException = EXC_SYSTEM;
+
+ // RC
+ if ((pInfo->Signal == TSignal_SignalUser) &&
+ (pInfo->UserSignal == OSL_SIGNAL_USER_RESOURCEFAILURE) )
+ nVCLException = EXC_RSCNOTLOADED;
+
+ // DISPLAY-Unix
+ if ((pInfo->Signal == TSignal_SignalUser) &&
+ (pInfo->UserSignal == OSL_SIGNAL_USER_X11SUBSYSTEMERROR) )
+ nVCLException = EXC_DISPLAY;
+
+ // Remote-Client
+ if ((pInfo->Signal == TSignal_SignalUser) &&
+ (pInfo->UserSignal == OSL_SIGNAL_USER_RVPCONNECTIONERROR) )
+ nVCLException = EXC_REMOTE;
+
+ if ( nVCLException )
+ {
+ bIn = TRUE;
+ // Timer nicht mehr anhalten, da ansonsten die UAE-Box
+ // auch nicht mehr gepaintet wird
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->mpApp )
+ {
+ USHORT nOldMode = Application::GetSystemWindowMode();
+ Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
+ pSVData->mpApp->Exception( nVCLException );
+ Application::SetSystemWindowMode( nOldMode );
+ }
+ bIn = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ return NAMESPACE_VOS(OSignalHandler)::TAction_CallNextHandler;
+#else
+ return NAMESPACE_VOS(OSignalHandler)::TAction_KillApplication;
+#endif
+ }
+ }
+
+ return NAMESPACE_VOS(OSignalHandler)::TAction_CallNextHandler;
+}
+
+BOOL SVMain()
+{
+ osl_setSUPD( SUPD );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+
+ DBG_ASSERT( pSVData->mpApp, "no instance of class Application" );
+
+ // SV bei den Tools anmelden
+ InitTools();
+
+ // Main-Thread-Id merken
+ pSVData->mnMainThreadId = ::vos::OThread::getCurrentIdentifier();
+
+ NAMESPACE_VOS( OStartupInfo ) aStartInfo;
+ NAMESPACE_RTL( OUString ) aExeFileName;
+
+#ifdef REMOTE_APPSERVER
+ // create a readonly applicat rdb.
+ // NOTE : This is a hack, a servicemanager is needed before SFX, so
+ // there is created one with the readonly registry. There
+ // now exists 2 Servicemanager
+
+ Application::EnterMultiThread( TRUE );
+
+ Reference< XMultiServiceFactory > rSMgr = createServiceFactory();
+ Reference< XInterface > x = rSMgr->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.registry.SimpleRegistry" ) ) );
+ Reference< XSimpleRegistry > rSimple( x , UNO_QUERY );
+ rSimple->open( ::utl::getPathToSystemRegistry() , sal_True , sal_False );
+ if( rSimple->isValid() )
+ {
+ Reference < XInitialization > rInit( rSMgr , UNO_QUERY );
+ Any a;
+ a <<= rSimple;
+ Sequence< Any > seq( &a , 1 );
+ rInit->initialize( seq );
+ }
+ // servicemanager up -> copy user installation
+ Any aAny;
+ Reference <XInterface> xRef = rSMgr->createInstanceWithArguments(
+ OUString::createFromAscii( "com.sun.star.portal.InstallUser" ),
+ Sequence<Any>( &aAny, 1 ) );
+
+
+ // OSL_ENSURE( 0 , "Office is waiting ....\n" );
+
+
+// sal_Bool bStandAloneMode = sal_False;
+// sal_Bool bStartDesktop = sal_True;
+
+ OUString conDcp;
+
+ // Anderes Flag setzen, wenn der Server von Hand gestartet wird...
+ USHORT nArgs = Application::GetCommandLineParamCount();
+ for( USHORT n = 0; n < nArgs; n++ )
+ {
+ XubString aParam = Application::GetCommandLineParam( n );
+ if ( (aParam.GetChar( 0 ) == '/') || (aParam.GetChar( 0 ) == '-') )
+ {
+ aParam.SetChar( 0 , (sal_Unicode)'-' );
+ if ( aParam.EqualsIgnoreCaseAscii( "-appserver" ) )
+ ; //bStandAloneMode = sal_True;
+
+ else if ( aParam.EqualsIgnoreCaseAscii( "-bean" ) )
+ ; //bStartDesktop = sal_False;
+
+ else if(aParam.Copy(0, 8).EqualsIgnoreCaseAscii("-accept="))
+ {
+// ++ n;
+// conDcp = Application::GetCommandLineParam(n);
+ conDcp = aParam.Copy(8);
+
+#ifdef DEBUG
+ OString tmp = OUStringToOString(conDcp, RTL_TEXTENCODING_ASCII_US);
+ OSL_TRACE("svmain.cxx: -accept with %s", tmp.getStr());
+#endif
+ }
+ }
+ }
+
+// ::vos::OThread *pUnoBroker = 0;
+
+// if (bStandAloneMode)
+// {
+ Config aCfg( UniString::CreateFromAscii( "remote.ini" ) );
+ aCfg.SetGroup( ByteString("Remote" ) );
+ ByteString s = aCfg.ReadKey( "ROffice" );
+ OUString aROffice = OUString::createFromAscii( s.GetBuffer() );
+ aROffice.trim();
+ if ( ! aROffice.getLength() )
+ aROffice = OUString(
+ RTL_CONSTASCII_USTRINGPARAM("socket,host=localhost,port=8125;urp;"));
+
+
+ if(conDcp.getLength() > 0)
+ aROffice = conDcp;
+
+ // create condition now to avoid race
+ pSVData->mpStartUpCond = new NAMESPACE_VOS(OCondition);
+
+ pSVData->mpUserInfo = new UserOnPrintServer;
+
+ // accept incoming connections
+ if(!vcl_accept::accept(aROffice, rSMgr))
+ return sal_False;
+
+// pUnoBroker = new vcl_AcceptorThread(
+// rSMgr ,
+// NULL, /*rInitialObject ,*/
+// aROffice );
+// }
+// else
+// pUnoBroker = new UnoBrokerThread( rSMgr , NULL /*rInitialObject*/);
+
+
+ pSVData->mpRmEventQueue = new RmEventQueue;
+ pSVData->mpRemotePrinterList = new RemotePrinterList( rSMgr );
+ pSVData->mpWindowObjectMutex = new VOS_NAMESPACE(OMutex,vos);
+ pSVData->maAppData.mpSolarMutex = new ImplRemoteYieldMutex;
+
+ pSVData->maGDIData.mpScreenFontList = new ImplDevFontList;
+ pSVData->maGDIData.mpScreenFontCache = new ImplFontCache( FALSE );
+
+
+// pUnoBroker->create();
+ pSVData->mpStartUpCond->wait();
+ delete pSVData->mpStartUpCond;
+ pSVData->mpStartUpCond = NULL;
+
+ if( pSVData->mxClientFactory.is() )
+ {
+ pSVData->mpAtoms = new ::vcl::AtomClient(
+ Reference< ::com::sun::star::portal::client::XAtomServer >(
+ pSVData->mxClientFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "ClientAtomServer.stardiv.de" ) ) ), UNO_QUERY ) );
+
+ Reference< XInterface > rX = pSVData->mxClientFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "OfficeStatus.stardiv.de" ) ) );
+
+ pSVData->mxStatus = Reference < ::com::sun::star::portal::client::XRmStatus > ( rX , UNO_QUERY );
+ if( pSVData->mxStatus->GetRemoteVersion() != REMOTE_VCLVERSION )
+ {
+ pSVData->mxStatus->ShowError(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Wrong Office-Version")), 0 );
+ pSVData->mxStatus->Quit();
+ return sal_False;
+ }
+ }
+ else
+ {
+ return sal_False;
+ }
+
+ // add client printers
+ REF( NMSP_CLIENT::XRmPrinterEnvironment ) xClientPrinterEnvironment(
+ pSVData->mxClientFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OfficePrinterEnvironment.stardiv.de" ) ) ), NMSP_UNO::UNO_QUERY );
+ if( xClientPrinterEnvironment.is() )
+ {
+ ::rtl::OUString aDefPrinter = xClientPrinterEnvironment->GetDefaultPrinterName();
+ NMSP_UNO::Sequence< ::rtl::OUString > aPrinters;
+ xClientPrinterEnvironment->GetPrinterNames( aPrinters );
+ int nPrinters = aPrinters.getLength();
+ if( nPrinters )
+ {
+ while( nPrinters-- )
+ {
+ ImplAddRemotePrinter(
+ aPrinters.getConstArray()[nPrinters],
+ String::CreateFromAscii( RVP_CLIENT_SERVER_NAME ),
+ aDefPrinter == aPrinters.getConstArray()[nPrinters] ? TRUE : FALSE,
+ FALSE
+ );
+ }
+ }
+ }
+
+ // add printers on print servers
+ ::rtl::OUString aValue;
+ if( aStartInfo.getEnvironment( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SOFFICE_PRINTER_URL" ) ), aValue ) ==
+ NAMESPACE_VOS( OStartupInfo ) :: E_None )
+ {
+ String aPrinterEnv = aValue;
+ if( aPrinterEnv.Len() > 0 )
+ {
+ USHORT nPrinters = aPrinterEnv.GetTokenCount( ';' );
+ for ( USHORT n = 0; n < nPrinters; n++ )
+ {
+ String aPrinterInfo = aPrinterEnv.GetToken( n, ';' );
+
+ String aServer = aPrinterInfo.GetToken( 0, '@' );
+ String aPrinter = aPrinterInfo.GetToken( 1, '@' );
+ BOOL bSetDef = aPrinterInfo.GetToken( 2, '@' ).EqualsAscii( "1" );
+ ImplAddRemotePrinter( aPrinter, aServer, bSetDef, FALSE );
+ }
+ }
+ }
+
+ pSVData->maAppData.mpSolarMutex->acquire();
+
+
+#endif
+
+ // Sal initialisieren
+#ifndef REMOTE_APPSERVER
+ pSVData->mpDefInst = CreateSalInstance();
+ if ( !pSVData->mpDefInst )
+ return FALSE;
+#endif
+
+ // Den AppFileName gleich holen und absolut machen, bevor das
+ // WorkingDirectory sich aendert...
+ aStartInfo.getExecutableFile( aExeFileName );
+
+ // convert path to native file format
+ rtl::OUString aNativeFileName;
+ osl::FileBase::getSystemPathFromNormalizedPath(aExeFileName, aNativeFileName);
+
+ pSVData->maAppData.mpAppFileName = new String( aNativeFileName );
+
+ // Initialize global data
+ pSVData->maGDIData.mpScreenFontList = new ImplDevFontList;
+ pSVData->maGDIData.mpScreenFontCache = new ImplFontCache( FALSE );
+ pSVData->maGDIData.mpGrfConverter = new GraphicConverter;
+
+ // Exception-Handler setzen
+ // HACK: Hier SystemExchange initialisieren, damit Exception-Handler unter Windows funktioniert
+ CreateSystemExchange();
+ ImplVCLExceptionHandler aExceptionHandler;
+
+ // Debug-Daten initialisieren
+ DBGGUI_INIT();
+
+ // Application-Main rufen
+ pSVData->maAppData.mbInAppMain = TRUE;
+ pSVData->mpApp->Main();
+ pSVData->maAppData.mbInAppMain = FALSE;
+
+ // Debug Daten zuruecksetzen
+ DBGGUI_DEINIT();
+
+// #ifdef REMOTE_APPSERVER
+// if( pUnoBroker )
+// pUnoBroker->terminate();
+// #endif
+
+ // Access list
+ List* pList = pSVData->maAppData.mpAccessList;
+ if( pList )
+ {
+ for( void* pLink = pList->First(); pLink; pLink = pList->Next() )
+ delete (Link*) pLink;
+ delete pList;
+ pSVData->maAppData.mpAccessList = NULL;
+ }
+
+ // globale daten wieder freigeben
+#ifndef REMOTE_APPSERVER
+ SalSound::Release();
+ SalOpenGL::Release();
+#endif
+
+ // free global data
+ delete pSVData->maGDIData.mpGrfConverter;
+
+ if ( pSVData->maAppData.mpIdleMgr )
+ delete pSVData->maAppData.mpIdleMgr;
+ ImplDeInitTimer();
+
+ if ( pSVData->maWinData.mpMsgBoxImgList )
+ {
+ delete pSVData->maWinData.mpMsgBoxImgList;
+ pSVData->maWinData.mpMsgBoxImgList = NULL;
+ }
+ if ( pSVData->maCtrlData.mpCheckImgList )
+ {
+ delete pSVData->maCtrlData.mpCheckImgList;
+ pSVData->maCtrlData.mpCheckImgList = NULL;
+ }
+ if ( pSVData->maCtrlData.mpRadioImgList )
+ {
+ delete pSVData->maCtrlData.mpRadioImgList;
+ pSVData->maCtrlData.mpRadioImgList = NULL;
+ }
+ if ( pSVData->maCtrlData.mpPinImgList )
+ {
+ delete pSVData->maCtrlData.mpPinImgList;
+ pSVData->maCtrlData.mpPinImgList = NULL;
+ }
+ if ( pSVData->maCtrlData.mpSplitHPinImgList )
+ {
+ delete pSVData->maCtrlData.mpSplitHPinImgList;
+ pSVData->maCtrlData.mpSplitHPinImgList = NULL;
+ }
+ if ( pSVData->maCtrlData.mpSplitVPinImgList )
+ {
+ delete pSVData->maCtrlData.mpSplitVPinImgList;
+ pSVData->maCtrlData.mpSplitVPinImgList = NULL;
+ }
+ if ( pSVData->maCtrlData.mpSplitHArwImgList )
+ {
+ delete pSVData->maCtrlData.mpSplitHArwImgList;
+ pSVData->maCtrlData.mpSplitHArwImgList = NULL;
+ }
+ if ( pSVData->maCtrlData.mpSplitVArwImgList )
+ {
+ delete pSVData->maCtrlData.mpSplitVArwImgList;
+ pSVData->maCtrlData.mpSplitVArwImgList = NULL;
+ }
+ if ( pSVData->mpDefaultWin )
+ {
+ delete pSVData->mpDefaultWin;
+ pSVData->mpDefaultWin = NULL;
+ }
+ if ( pSVData->mpResMgr )
+ {
+ delete pSVData->mpResMgr;
+ pSVData->mpResMgr = NULL;
+ }
+
+#ifdef REMOTE_APPSERVER
+ if( pSVData->mpUserInfo )
+ {
+ try
+ {
+ delete pSVData->mpUserInfo;
+ }
+ catch(...)
+ {
+ }
+ pSVData->mpUserInfo = NULL;
+ }
+ if( pSVData->mpRemotePrinterList )
+ {
+ try
+ {
+ delete pSVData->mpRemotePrinterList;
+ }
+ catch(...)
+ {
+ }
+ pSVData->mpRemotePrinterList = NULL;
+ }
+ if( pSVData->mxClientFactory.is() )
+ {
+ try
+ {
+ pSVData->mxClientFactory = Reference < XMultiServiceFactory >();
+ }
+ catch(...)
+ {
+ }
+ }
+
+ if( pSVData->mxMultiFactory.is() )
+ {
+ try
+ {
+ pSVData->mxMultiFactory.clear();
+ }
+ catch(...)
+ {
+ }
+
+ }
+ CORmStarOffice::eraseRemoteCaches();
+ if( pSVData->mxStatus.is() )
+ {
+ try
+ {
+ pSVData->mxStatus->Quit();
+ pSVData->mxStatus = Reference < ::com::sun::star::portal::client::XRmStatus >();
+ }
+ catch(...)
+ {
+ }
+
+ }
+
+ pSVData->maAppData.mpSolarMutex->release();
+ delete pSVData->maAppData.mpSolarMutex;
+ pSVData->maAppData.mpSolarMutex = NULL;
+ pSVData->mpOTimer->release();
+ pSVData->mpOTimer = NULL;
+ delete pSVData->mpRmEventQueue;
+ pSVData->mpRmEventQueue = NULL;
+ delete pSVData->mpWindowObjectMutex;
+ pSVData->mpWindowObjectMutex = NULL;
+
+ if ( pSVData->mpKeyNames )
+ {
+ for( String* pObj = pSVData->mpKeyNames->First(); pObj; pObj = pSVData->mpKeyNames->Next() )
+ delete pObj;
+ delete pSVData->mpKeyNames;
+ }
+ delete pSVData->mpAtoms;
+#endif
+
+ if ( pSVData->maAppData.mpSettings )
+ {
+ delete pSVData->maAppData.mpSettings;
+ pSVData->maAppData.mpSettings = NULL;
+ }
+ if ( pSVData->maAppData.mpAccelMgr )
+ {
+ delete pSVData->maAppData.mpAccelMgr;
+ pSVData->maAppData.mpAccelMgr = NULL;
+ }
+ if ( pSVData->maAppData.mpUniqueIdCont )
+ {
+ delete pSVData->maAppData.mpUniqueIdCont;
+ pSVData->maAppData.mpUniqueIdCont = NULL;
+ }
+ if ( pSVData->maAppData.mpAppFileName )
+ {
+ delete pSVData->maAppData.mpAppFileName;
+ pSVData->maAppData.mpAppFileName = NULL;
+ }
+ if ( pSVData->maAppData.mpAppName )
+ {
+ delete pSVData->maAppData.mpAppName;
+ pSVData->maAppData.mpAppName = NULL;
+ }
+ if ( pSVData->maAppData.mpDisplayName )
+ {
+ delete pSVData->maAppData.mpDisplayName;
+ pSVData->maAppData.mpDisplayName = NULL;
+ }
+ if ( pSVData->maAppData.mpResPath )
+ {
+ delete pSVData->maAppData.mpResPath;
+ pSVData->maAppData.mpResPath = NULL;
+ }
+
+ if ( pSVData->maAppData.mpFirstHotKey )
+ ImplFreeHotKeyData();
+ if ( pSVData->maAppData.mpFirstEventHook )
+ ImplFreeEventHookData();
+
+ ImplDeletePrnQueueList();
+ delete pSVData->maGDIData.mpScreenFontList;
+ pSVData->maGDIData.mpScreenFontList = NULL;
+ delete pSVData->maGDIData.mpScreenFontCache;
+ pSVData->maGDIData.mpScreenFontCache = NULL;
+ ImplFreeOutDevFontData();
+
+ ResMgr::DestroyAllResMgr();
+
+ // Sal deinitialisieren
+#ifndef REMOTE_APPSERVER
+ DestroySalInstance( pSVData->mpDefInst );
+#endif
+
+ DeInitTools();
+
+ return TRUE;
+
+ return FALSE;
+}
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
new file mode 100644
index 000000000000..78235032e919
--- /dev/null
+++ b/vcl/source/app/timer.cxx
@@ -0,0 +1,490 @@
+/*************************************************************************
+ *
+ * $RCSfile: timer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_TIMER_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+#else
+#include <rmevents.hxx>
+#endif
+
+#ifndef _TIME_HXX
+#include <tools/time.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+#define protected public
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#undef protected
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define MAX_TIMER_PERIOD ((ULONG)0xFFFFFFFF)
+
+// ---------------------
+// - TimeManager-Types -
+// ---------------------
+
+struct ImplTimerData
+{
+ ImplTimerData* mpNext; // Pointer to the next Instance
+ Timer* mpSVTimer; // Pointer to SV Timer instance
+ ULONG mnUpdateTime; // Last Update Time
+ ULONG mnTimerUpdate; // TimerCallbackProcs on stack
+ BOOL mbDelete; // Wurde Timer waehren Update() geloescht
+ BOOL mbInTimeout; // Befinden wir uns im Timeout-Handler
+};
+
+// =======================================================================
+
+void ImplDeInitTimer()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplTimerData* pTimerData = pSVData->mpFirstTimerData;
+
+ if ( pTimerData )
+ {
+ do
+ {
+ ImplTimerData* pTempTimerData = pTimerData;
+ if ( pTimerData->mpSVTimer )
+ {
+ pTimerData->mpSVTimer->mbActive = FALSE;
+ pTimerData->mpSVTimer->mpTimerData = NULL;
+ }
+ pTimerData = pTimerData->mpNext;
+ delete pTempTimerData;
+ }
+ while ( pTimerData );
+
+ pSVData->mpFirstTimerData = NULL;
+ pSVData->mnTimerPeriod = 0;
+#ifndef REMOTE_APPSERVER
+ SalTimer::Stop();
+#else
+ if ( pSVData->mpOTimer )
+ pSVData->mpOTimer->StopTimer();
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplStartTimer( ImplSVData* pSVData, ULONG nMS )
+{
+ if ( !nMS )
+ nMS = 1;
+
+#ifndef REMOTE_APPSERVER
+ if ( nMS != pSVData->mnTimerPeriod )
+ {
+ pSVData->mnTimerPeriod = nMS;
+ SalTimer::Start( nMS );
+ }
+#else
+ pSVData->mnTimerPeriod = nMS;
+ if ( !pSVData->mpOTimer )
+ {
+ pSVData->mpOTimer = new VclOTimer;
+ pSVData->mpOTimer->acquire();
+ }
+ else
+ pSVData->mpOTimer->StopTimer();
+ pSVData->mpOTimer->setRemainingTime( nMS, 0 );
+ pSVData->mpOTimer->StartTimer();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTimerCallbackProc()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplTimerData* pTimerData;
+ ImplTimerData* pPrevTimerData;
+ ULONG nMinPeriod = MAX_TIMER_PERIOD;
+ ULONG nDeltaTime;
+ ULONG nTime = Time::GetSystemTicks();
+
+ if ( pSVData->mbNoCallTimer )
+ return;
+
+ pSVData->mnTimerUpdate++;
+ pSVData->mbNotAllTimerCalled = TRUE;
+
+ // Suche Timer raus, wo der Timeout-Handler gerufen werden muss
+ pTimerData = pSVData->mpFirstTimerData;
+ while ( pTimerData )
+ {
+ // Wenn Timer noch nicht neu ist und noch nicht geloescht wurde
+ // und er sich nicht im Timeout-Handler befindet,
+ // dann den Handler rufen, wenn die Zeit abgelaufen ist
+ if ( (pTimerData->mnTimerUpdate < pSVData->mnTimerUpdate) &&
+ !pTimerData->mbDelete && !pTimerData->mbInTimeout )
+ {
+ // Zeit abgelaufen
+ if ( (pTimerData->mnUpdateTime+pTimerData->mpSVTimer->mnTimeout) <= nTime )
+ {
+ // Neue Updatezeit setzen
+ pTimerData->mnUpdateTime = nTime;
+
+ // kein AutoTimer, dann anhalten
+ if ( !pTimerData->mpSVTimer->mbAuto )
+ {
+ pTimerData->mpSVTimer->mbActive = FALSE;
+ pTimerData->mbDelete = TRUE;
+ }
+
+ // call Timeout
+ pTimerData->mbInTimeout = TRUE;
+ pTimerData->mpSVTimer->Timeout();
+ pTimerData->mbInTimeout = FALSE;
+ }
+ }
+
+ pTimerData = pTimerData->mpNext;
+ }
+
+ // Neue Zeit ermitteln
+ ULONG nNewTime = Time::GetSystemTicks();
+ pPrevTimerData = NULL;
+ pTimerData = pSVData->mpFirstTimerData;
+ while ( pTimerData )
+ {
+ // Befindet sich Timer noch im Timeout-Handler, dann ignorieren
+ if ( pTimerData->mbInTimeout )
+ {
+ pPrevTimerData = pTimerData;
+ pTimerData = pTimerData->mpNext;
+ }
+ // Wurde Timer zwischenzeitlich zerstoert ?
+ else if ( pTimerData->mbDelete )
+ {
+ if ( pPrevTimerData )
+ pPrevTimerData->mpNext = pTimerData->mpNext;
+ else
+ pSVData->mpFirstTimerData = pTimerData->mpNext;
+ if ( pTimerData->mpSVTimer )
+ pTimerData->mpSVTimer->mpTimerData = NULL;
+ ImplTimerData* pTempTimerData = pTimerData;
+ pTimerData = pTimerData->mpNext;
+ delete pTempTimerData;
+ }
+ else
+ {
+ pTimerData->mnTimerUpdate = 0;
+ // kleinste Zeitspanne ermitteln
+ if ( pTimerData->mnUpdateTime == nTime )
+ {
+ nDeltaTime = pTimerData->mpSVTimer->mnTimeout;
+ if ( nDeltaTime < nMinPeriod )
+ nMinPeriod = nDeltaTime;
+ }
+ else
+ {
+ nDeltaTime = pTimerData->mnUpdateTime + pTimerData->mpSVTimer->mnTimeout;
+ if ( nDeltaTime < nNewTime )
+ nMinPeriod = 1;
+ else
+ {
+ nDeltaTime -= nNewTime;
+ if ( nDeltaTime < nMinPeriod )
+ nMinPeriod = nDeltaTime;
+ }
+ }
+ pPrevTimerData = pTimerData;
+ pTimerData = pTimerData->mpNext;
+ }
+ }
+
+ // Wenn keine Timer mehr existieren, dann Clock loeschen
+ if ( !pSVData->mpFirstTimerData )
+ {
+#ifndef REMOTE_APPSERVER
+ SalTimer::Stop();
+#else
+ if ( pSVData->mpOTimer )
+ pSVData->mpOTimer->StopTimer();
+#endif
+ pSVData->mnTimerPeriod = MAX_TIMER_PERIOD;
+ }
+ else
+ ImplStartTimer( pSVData, nMinPeriod );
+
+ pSVData->mnTimerUpdate--;
+ pSVData->mbNotAllTimerCalled = FALSE;
+}
+
+// =======================================================================
+
+#ifdef REMOTE_APPSERVER
+
+VclOTimer::VclOTimer() :
+ maTimeoutHdl( LINK( this, VclOTimer, Timeout ) )
+{
+ mbSend = FALSE;
+}
+
+void SAL_CALL VclOTimer::onShot()
+{
+ stop(); // start wird durch ImplTimerCallbackProc() gerufen
+ if ( !mbSend )
+ {
+ mbSend = TRUE;
+ if ( !Application::PostUserEvent( maTimeoutHdl ) )
+ {
+ mbSend = FALSE;
+ start();
+ }
+ }
+}
+
+IMPL_LINK( VclOTimer, Timeout, void*, EMPTYARG )
+{
+ mbSend = FALSE;
+ ImplTimerCallbackProc();
+ return 0;
+}
+
+void VclOTimer::StartTimer()
+{
+ start();
+}
+
+void VclOTimer::StopTimer()
+{
+ stop();
+}
+
+#endif
+
+// =======================================================================
+
+Timer::Timer()
+{
+ mpTimerData = NULL;
+ mnTimeout = 1;
+ mbAuto = FALSE;
+ mbActive = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Timer::Timer( const Timer& rTimer )
+{
+ mpTimerData = NULL;
+ mnTimeout = rTimer.mnTimeout;
+ mbAuto = FALSE;
+ mbActive = FALSE;
+ maTimeoutHdl = rTimer.maTimeoutHdl;
+
+ if ( rTimer.IsActive() )
+ Start();
+}
+
+// -----------------------------------------------------------------------
+
+Timer::~Timer()
+{
+ if ( mpTimerData )
+ {
+ mpTimerData->mbDelete = TRUE;
+ mpTimerData->mpSVTimer = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Timer::Timeout()
+{
+ maTimeoutHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Timer::SetTimeout( ULONG nNewTimeout )
+{
+ mnTimeout = nNewTimeout;
+
+ // Wenn Timer aktiv, dann Clock erneuern
+ if ( mbActive )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->mnTimerUpdate && (mnTimeout < pSVData->mnTimerPeriod) )
+ ImplStartTimer( pSVData, mnTimeout );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Timer::Start()
+{
+ mbActive = TRUE;
+
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !mpTimerData )
+ {
+ if ( !pSVData->mpFirstTimerData )
+ {
+ pSVData->mnTimerPeriod = MAX_TIMER_PERIOD;
+#ifndef REMOTE_APPSERVER
+ SalTimer::SetCallback( ImplTimerCallbackProc );
+#endif
+ }
+
+ // insert timer and start
+ mpTimerData = new ImplTimerData;
+ mpTimerData->mpSVTimer = this;
+ mpTimerData->mnUpdateTime = Time::GetSystemTicks();
+ mpTimerData->mnTimerUpdate = pSVData->mnTimerUpdate;
+ mpTimerData->mbDelete = FALSE;
+ mpTimerData->mbInTimeout = FALSE;
+
+ // !!!!! Wegen SFX hinten einordnen !!!!!
+ ImplTimerData* pPrev = NULL;
+ ImplTimerData* pData = pSVData->mpFirstTimerData;
+ while ( pData )
+ {
+ pPrev = pData;
+ pData = pData->mpNext;
+ }
+ mpTimerData->mpNext = NULL;
+ if ( pPrev )
+ pPrev->mpNext = mpTimerData;
+ else
+ pSVData->mpFirstTimerData = mpTimerData;
+
+ if ( mnTimeout < pSVData->mnTimerPeriod )
+ ImplStartTimer( pSVData, mnTimeout );
+ }
+ else
+ {
+ mpTimerData->mnUpdateTime = Time::GetSystemTicks();
+ mpTimerData->mnTimerUpdate = pSVData->mnTimerUpdate;
+ mpTimerData->mbDelete = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Timer::Stop()
+{
+ mbActive = FALSE;
+
+ if ( mpTimerData )
+ mpTimerData->mbDelete = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Timer& Timer::operator=( const Timer& rTimer )
+{
+ if ( IsActive() )
+ Stop();
+
+ mbActive = FALSE;
+ mnTimeout = rTimer.mnTimeout;
+ maTimeoutHdl = rTimer.maTimeoutHdl;
+
+ if ( rTimer.IsActive() )
+ Start();
+
+ return *this;
+}
+
+// =======================================================================
+
+AutoTimer::AutoTimer()
+{
+ mbAuto = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+AutoTimer::AutoTimer( const AutoTimer& rTimer ) : Timer( rTimer )
+{
+ mbAuto = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer )
+{
+ Timer::operator=( rTimer );
+ return *this;
+}
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx
new file mode 100644
index 000000000000..c01deefc4897
--- /dev/null
+++ b/vcl/source/app/unohelp.cxx
@@ -0,0 +1,275 @@
+/*************************************************************************
+ *
+ * $RCSfile: unohelp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include <unohelp.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <cppuhelper/factory.hxx>
+
+#include <uno/environment.h>
+#include <uno/mapping.hxx>
+#include <rtl/ustring.hxx>
+#include <osl/module.h>
+
+#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_
+#include <com/sun/star/text/XBreakIterator.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCHARACTERCLASSIFICATION_HPP_
+#include <com/sun/star/lang/XCharacterClassification.hpp>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::rtl;
+
+#define DOSTRING( x ) #x
+#define STRING( x ) DOSTRING( x )
+
+#define DOCONCAT4( x, y, z, a ) x##y##z##a
+#define CONCAT4( x, y, z, a ) DOCONCAT4(x,y,z,a)
+#define DOCONCAT5( x, y, z, a, b ) x##y##z##a##b
+#define CONCAT5( x, y, z, a, b ) DOCONCAT5(x,y,z,a,b)
+
+#ifdef UNX
+#define LIBNAME(name) STRING(CONCAT5(lib,name,SUPD, DLLSUFFIX,.so))
+#else
+#define LIBNAME(name) STRING(CONCAT4( name, SUPD, DLLSUFFIX, .dll))
+#endif
+
+Reference< XSingleServiceFactory > ImplLoadLibComponentFactory(
+ const OUString & rLibName, const OUString & rImplName,
+ const Reference< XMultiServiceFactory > & xSF, const Reference< XRegistryKey > & xKey )
+{
+ Reference< XSingleServiceFactory > xRet;
+
+ oslModule lib = osl_loadModule( rLibName.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
+ if (lib)
+ {
+ void * pSym;
+
+ // ========================= LATEST VERSION =========================
+ OUString aGetEnvName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETENV) );
+ if (pSym = osl_getSymbol( lib, aGetEnvName.pData ))
+ {
+ uno_Environment * pCurrentEnv = 0;
+ uno_Environment * pEnv = 0;
+ const sal_Char * pEnvTypeName = 0;
+ (*((component_getImplementationEnvironmentFunc)pSym))( &pEnvTypeName, &pEnv );
+
+ sal_Bool bNeedsMapping =
+ (pEnv || 0 != rtl_str_compare( pEnvTypeName, CPPU_CURRENT_LANGUAGE_BINDING_NAME ));
+
+ OUString aEnvTypeName( OUString::createFromAscii( pEnvTypeName ) );
+
+ if (bNeedsMapping)
+ {
+ if (! pEnv)
+ uno_getEnvironment( &pEnv, aEnvTypeName.pData, 0 );
+ if (pEnv)
+ {
+ OUString aCppEnvTypeName( RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME) );
+ uno_getEnvironment( &pCurrentEnv, aCppEnvTypeName.pData, 0 );
+ if (pCurrentEnv)
+ bNeedsMapping = (pEnv != pCurrentEnv);
+ }
+ }
+
+ OUString aGetFactoryName( RTL_CONSTASCII_USTRINGPARAM(COMPONENT_GETFACTORY) );
+ if (pSym = osl_getSymbol( lib, aGetFactoryName.pData ))
+ {
+ OString aImplName( OUStringToOString( rImplName, RTL_TEXTENCODING_ASCII_US ) );
+
+ if (bNeedsMapping)
+ {
+ if (pEnv && pCurrentEnv)
+ {
+ Mapping aCurrent2Env( pCurrentEnv, pEnv );
+ Mapping aEnv2Current( pEnv, pCurrentEnv );
+
+ if (aCurrent2Env.is() && aEnv2Current.is())
+ {
+ void * pSMgr = aCurrent2Env.mapInterface(
+ xSF.get(), ::getCppuType( (const Reference< XMultiServiceFactory > *)0 ) );
+ void * pKey = aCurrent2Env.mapInterface(
+ xKey.get(), ::getCppuType( (const Reference< XRegistryKey > *)0 ) );
+
+ void * pSSF = (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), pSMgr, pKey );
+
+ if (pKey)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pKey );
+ if (pSMgr)
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSMgr );
+
+ if (pSSF)
+ {
+ aEnv2Current.mapInterface(
+ reinterpret_cast< void ** >( &xRet ),
+ pSSF, ::getCppuType( (const Reference< XSingleServiceFactory > *)0 ) );
+ (*pEnv->pExtEnv->releaseInterface)( pEnv->pExtEnv, pSSF );
+ }
+ }
+ }
+ }
+ else
+ {
+ XSingleServiceFactory * pRet = (XSingleServiceFactory *)
+ (*((component_getFactoryFunc)pSym))(
+ aImplName.getStr(), xSF.get(), xKey.get() );
+ if (pRet)
+ {
+ xRet = pRet;
+ pRet->release();
+ }
+ }
+ }
+
+ if (pEnv)
+ (*pEnv->release)( pEnv );
+ if (pCurrentEnv)
+ (*pCurrentEnv->release)( pCurrentEnv );
+ }
+
+
+ if (! xRet.is())
+ osl_unloadModule( lib );
+ }
+
+ return xRet;
+}
+
+uno::Reference < text::XBreakIterator > vcl::unohelper::CreateBreakIterator()
+{
+ uno::Reference < text::XBreakIterator > xB;
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ if ( xMSF.is() )
+ {
+ uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.text.BreakIterator" ) );
+ if ( xI.is() )
+ {
+ uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< text::XBreakIterator >*)0) );
+ x >>= xB;
+ }
+ }
+ if( !xB.is() )
+ {
+ uno::Reference< lang::XSingleServiceFactory > xSSF = ImplLoadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( LIBNAME( int ) ) ), OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.BreakIterator" ) ),
+ Reference< XMultiServiceFactory >(), Reference< XRegistryKey >() );
+
+ uno::Reference < uno::XInterface > xI = xSSF->createInstance();
+ if ( xI.is() )
+ {
+ uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< text::XBreakIterator >*)0) );
+ x >>= xB;
+ }
+ }
+ return xB;
+}
+
+uno::Reference < lang::XCharacterClassification > vcl::unohelper::CreateCharacterClassification()
+{
+ uno::Reference < lang::XCharacterClassification > xB;
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::utl::getProcessServiceFactory();
+ if ( xMSF.is() )
+ {
+ uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.lang.CharacterClassification" ) );
+ if ( xI.is() )
+ {
+ uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< lang::XCharacterClassification >*)0) );
+ x >>= xB;
+ }
+ }
+ if( !xB.is() )
+ {
+ uno::Reference< lang::XSingleServiceFactory > xSSF = ImplLoadLibComponentFactory(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( LIBNAME( int ) ) ), OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.lang.CharacterClassification" ) ),
+ Reference< XMultiServiceFactory >(), Reference< XRegistryKey >() );
+
+ uno::Reference < uno::XInterface > xI = xSSF->createInstance();
+ if ( xI.is() )
+ {
+ uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< lang::XCharacterClassification >*)0) );
+ x >>= xB;
+ }
+ }
+ return xB;
+}
+
+
+
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
new file mode 100644
index 000000000000..1ac338e26755
--- /dev/null
+++ b/vcl/source/control/button.cxx
@@ -0,0 +1,3010 @@
+/*************************************************************************
+ *
+ * $RCSfile: button.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BUTTON_CXX
+
+#include <tools/debug.hxx>
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_IAMGE_HXX
+#include <image.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_BITMAPEX_HXX
+#include <bitmapex.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_DIALOG_HXX
+#include <dialog.hxx>
+#endif
+#ifndef _SV_FIXED_HXX
+#include <fixed.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define PUSHBUTTON_VIEW_STYLE (WB_3DLOOK | \
+ WB_LEFT | WB_CENTER | WB_RIGHT | \
+ WB_TOP | WB_VCENTER | WB_BOTTOM | \
+ WB_WORDBREAK | WB_NOLABEL | \
+ WB_DEFBUTTON | WB_NOLIGHTBORDER | \
+ WB_RECTSTYLE | WB_SMALLSTYLE)
+#define RADIOBUTTON_VIEW_STYLE (WB_3DLOOK | \
+ WB_LEFT | WB_CENTER | WB_RIGHT | \
+ WB_TOP | WB_VCENTER | WB_BOTTOM | \
+ WB_WORDBREAK | WB_NOLABEL)
+#define CHECKBOX_VIEW_STYLE (WB_3DLOOK | \
+ WB_LEFT | WB_CENTER | WB_RIGHT | \
+ WB_TOP | WB_VCENTER | WB_BOTTOM | \
+ WB_WORDBREAK | WB_NOLABEL)
+
+// =======================================================================
+
+Button::Button( WindowType nType ) :
+ Control( nType )
+{
+}
+
+// -----------------------------------------------------------------------
+
+Button::Button( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_BUTTON )
+{
+ ImplInit( pParent, nStyle, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+Button::Button( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_BUTTON )
+{
+ rResId.SetRT( RSC_BUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle, NULL );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void Button::Click()
+{
+ maClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+XubString Button::GetStandardText( StandardButtonType eButton )
+{
+ static USHORT aResIdAry[BUTTON_COUNT] =
+ {
+ SV_BUTTONTEXT_OK,
+ SV_BUTTONTEXT_CANCEL,
+ SV_BUTTONTEXT_YES,
+ SV_BUTTONTEXT_NO,
+ SV_BUTTONTEXT_RETRY,
+ SV_BUTTONTEXT_HELP,
+ SV_BUTTONTEXT_CLOSE,
+ SV_BUTTONTEXT_MORE
+ };
+
+ ResId aResId( aResIdAry[(USHORT)eButton], ImplGetResMgr() );
+ XubString aText( aResId );
+ return aText;
+}
+
+// -----------------------------------------------------------------------
+
+XubString Button::GetStandardHelpText( StandardButtonType /* eButton */ )
+{
+ XubString aHelpText;
+ return aHelpText;
+}
+
+// =======================================================================
+
+void PushButton::ImplInitData()
+{
+ mbPushButton = TRUE;
+
+ meSymbol = SYMBOL_NOSYMBOL;
+ meImageAlign = IMAGEALIGN_TOP;
+ meState = STATE_NOCHECK;
+ meSaveValue = STATE_NOCHECK;
+ mnDDStyle = 0;
+ mnButtonState = 0;
+ mbPressed = FALSE;
+ mbInUserDraw = FALSE;
+ mpBitmapEx = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle );
+ Button::ImplInit( pParent, nStyle, NULL );
+
+ if ( nStyle & WB_NOLIGHTBORDER )
+ mnButtonState |= BUTTON_DRAW_NOLIGHTBORDER;
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits PushButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) &&
+ (!pPrevWindow ||
+ ((pPrevWindow->GetType() != WINDOW_PUSHBUTTON) &&
+ (pPrevWindow->GetType() != WINDOW_OKBUTTON) &&
+ (pPrevWindow->GetType() != WINDOW_CANCELBUTTON) &&
+ (pPrevWindow->GetType() != WINDOW_HELPBUTTON)) ) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetPushButtonFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ SetBackground();
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::ImplDrawPushButtonFrame( Window* pDev,
+ Rectangle& rRect, USHORT nStyle )
+{
+ if ( !(pDev->GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) )
+ {
+ StyleSettings aStyleSettings = pDev->GetSettings().GetStyleSettings();
+ if ( pDev->IsControlBackground() )
+ aStyleSettings.Set3DColors( pDev->GetControlBackground() );
+
+ USHORT nPushButtonSysStyle = aStyleSettings.GetPushButtonStyle() & STYLE_PUSHBUTTON_STYLE;
+ if ( nPushButtonSysStyle == STYLE_PUSHBUTTON_MAC )
+ {
+ pDev->SetLineColor();
+ pDev->SetFillColor( aStyleSettings.GetFaceColor() );
+ pDev->DrawRect( rRect );
+
+ if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
+ (pDev->GetOutDevType() == OUTDEV_PRINTER) )
+ nStyle |= BUTTON_DRAW_MONO;
+
+ if ( nStyle & BUTTON_DRAW_DEFAULT )
+ {
+ if ( nStyle & BUTTON_DRAW_MONO )
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ else
+ pDev->SetLineColor( aStyleSettings.GetDarkShadowColor() );
+
+ pDev->DrawLine( Point( rRect.Left()+3, rRect.Top() ),
+ Point( rRect.Right()-3, rRect.Top() ) );
+ pDev->DrawLine( Point( rRect.Left()+3, rRect.Bottom() ),
+ Point( rRect.Right()-3, rRect.Bottom() ) );
+ pDev->DrawLine( Point( rRect.Left(), rRect.Top()+3 ),
+ Point( rRect.Left(), rRect.Bottom()-3 ) );
+ pDev->DrawLine( Point( rRect.Right(), rRect.Top()+3 ),
+ Point( rRect.Right(), rRect.Bottom()-3 ) );
+ pDev->DrawPixel( Point( rRect.Left()+2, rRect.Top()+1 ) );
+ pDev->DrawPixel( Point( rRect.Left()+1, rRect.Top()+2 ) );
+ pDev->DrawPixel( Point( rRect.Right()-2, rRect.Top()+1 ) );
+ pDev->DrawPixel( Point( rRect.Right()-1, rRect.Top()+2 ) );
+ pDev->DrawPixel( Point( rRect.Left()+2, rRect.Bottom()-1 ) );
+ pDev->DrawPixel( Point( rRect.Left()+1, rRect.Bottom()-2 ) );
+ pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-1 ) );
+ pDev->DrawPixel( Point( rRect.Right()-1, rRect.Bottom()-2 ) );
+
+ if ( nStyle & BUTTON_DRAW_MONO )
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ else
+ pDev->SetLineColor( aStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( rRect.Left()+3, rRect.Bottom()-1 ),
+ Point( rRect.Right()-3, rRect.Bottom()-1 ) );
+ pDev->DrawLine( Point( rRect.Right()-1, rRect.Top()+3 ),
+ Point( rRect.Right()-1, rRect.Bottom()-3 ) );
+ pDev->DrawPixel( Point( rRect.Right()-3, rRect.Bottom()-2 ) );
+ pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-2 ) );
+ pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-3 ) );
+ }
+
+ rRect.Left() += 2;
+ rRect.Top() += 2;
+ rRect.Right() -= 2;
+ rRect.Bottom() -= 2;
+
+ if ( nStyle & BUTTON_DRAW_MONO )
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ else
+ pDev->SetLineColor( aStyleSettings.GetDarkShadowColor() );
+
+ pDev->DrawLine( Point( rRect.Left()+2, rRect.Top() ),
+ Point( rRect.Right()-2, rRect.Top() ) );
+ pDev->DrawLine( Point( rRect.Left()+2, rRect.Bottom() ),
+ Point( rRect.Right()-2, rRect.Bottom() ) );
+ pDev->DrawLine( Point( rRect.Left(), rRect.Top()+2 ),
+ Point( rRect.Left(), rRect.Bottom()-2 ) );
+ pDev->DrawLine( Point( rRect.Right(), rRect.Top()+2 ),
+ Point( rRect.Right(), rRect.Bottom()-2 ) );
+ pDev->DrawPixel( Point( rRect.Left()+1, rRect.Top()+1 ) );
+ pDev->DrawPixel( Point( rRect.Right()-1, rRect.Top()+1 ) );
+ pDev->DrawPixel( Point( rRect.Left()+1, rRect.Bottom()-1 ) );
+ pDev->DrawPixel( Point( rRect.Right()-1, rRect.Bottom()-1 ) );
+
+ pDev->SetLineColor();
+ if ( nStyle & BUTTON_DRAW_CHECKED )
+ pDev->SetFillColor( aStyleSettings.GetCheckedColor() );
+ else
+ pDev->SetFillColor( aStyleSettings.GetFaceColor() );
+ pDev->DrawRect( Rectangle( rRect.Left()+2, rRect.Top()+2, rRect.Right()-2, rRect.Bottom()-2 ) );
+
+ if ( !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED)) )
+ {
+ if ( nStyle & BUTTON_DRAW_MONO )
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ else
+ pDev->SetLineColor( aStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( rRect.Left()+2, rRect.Bottom()-1 ),
+ Point( rRect.Right()-2, rRect.Bottom()-1 ) );
+ pDev->DrawLine( Point( rRect.Right()-1, rRect.Top()+2 ),
+ Point( rRect.Right()-1, rRect.Bottom()-2 ) );
+ pDev->DrawPixel( Point( rRect.Right()-2, rRect.Bottom()-2 ) );
+ pDev->SetLineColor( aStyleSettings.GetLightColor() );
+ }
+ else
+ pDev->SetLineColor( aStyleSettings.GetShadowColor() );
+
+ if ( !(nStyle & BUTTON_DRAW_MONO) )
+ {
+ pDev->DrawLine( Point( rRect.Left()+2, rRect.Top()+1 ),
+ Point( rRect.Right()-2, rRect.Top()+1 ) );
+ pDev->DrawLine( Point( rRect.Left()+1, rRect.Top()+2 ),
+ Point( rRect.Left()+1, rRect.Bottom()-2 ) );
+ pDev->DrawPixel( Point( rRect.Top()+2, rRect.Right()+2 ) );
+ }
+
+ rRect.Left() += 2;
+ rRect.Top() += 2;
+ rRect.Right() -= 2;
+ rRect.Bottom() -= 2;
+
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ rRect.Left()++;
+ rRect.Top()++;
+ rRect.Right()++;
+ rRect.Bottom()++;
+ }
+
+ return;
+ }
+ }
+
+ DecorationView aDecoView( pDev );
+ if ( pDev->IsControlBackground() )
+ {
+ AllSettings aSettings = pDev->GetSettings();
+ AllSettings aOldSettings = aSettings;
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.Set3DColors( pDev->GetControlBackground() );
+ aSettings.SetStyleSettings( aStyleSettings );
+ ((OutputDevice*)pDev)->SetSettings( aSettings );
+ rRect = aDecoView.DrawButton( rRect, nStyle );
+ ((OutputDevice*)pDev)->SetSettings( aOldSettings );
+ }
+ else
+ rRect = aDecoView.DrawButton( rRect, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL PushButton::ImplHitTestPushButton( Window* pDev,
+ const Point& rPos, USHORT nStyle )
+{
+ Point aTempPoint;
+ Rectangle aTestRect( aTempPoint, pDev->GetOutputSizePixel() );
+
+ if ( !(pDev->GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) )
+ {
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+
+ USHORT nPushButtonSysStyle = rStyleSettings.GetPushButtonStyle() & STYLE_PUSHBUTTON_STYLE;
+ if ( nPushButtonSysStyle == STYLE_PUSHBUTTON_MAC )
+ {
+ aTestRect.Left() += 2;
+ aTestRect.Top() += 2;
+ aTestRect.Right() -= 2;
+ aTestRect.Bottom() -= 2;
+ }
+ }
+
+ return aTestRect.IsInside( rPos );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT PushButton::ImplGetTextStyle() const
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ USHORT nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_MULTILINE | TEXT_DRAW_ENDELLIPSIS;
+
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
+ nTextStyle |= TEXT_DRAW_MONO;
+ if ( GetStyle() & WB_WORDBREAK )
+ nTextStyle |= TEXT_DRAW_WORDBREAK;
+ if ( GetStyle() & WB_NOLABEL )
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ nTextStyle |= TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER;
+
+ return nTextStyle;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawBtnDropDownArrow( OutputDevice* pDev,
+ long nX, long nY,
+ Color& rColor, BOOL bBlack )
+{
+ Color aOldLineColor = pDev->GetLineColor();
+ Color aOldFillColor = pDev->GetFillColor();
+
+ pDev->SetLineColor();
+ if ( bBlack )
+ pDev->SetFillColor( Color( COL_BLACK ) );
+ else
+ pDev->SetFillColor( rColor );
+ pDev->DrawRect( Rectangle( nX+0, nY+0, nX+6, nY+0 ) );
+ pDev->DrawRect( Rectangle( nX+1, nY+1, nX+5, nY+1 ) );
+ pDev->DrawRect( Rectangle( nX+2, nY+2, nX+4, nY+2 ) );
+ pDev->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) );
+ if ( bBlack )
+ {
+ pDev->SetFillColor( rColor );
+ pDev->DrawRect( Rectangle( nX+2, nY+1, nX+4, nY+1 ) );
+ pDev->DrawRect( Rectangle( nX+3, nY+2, nX+3, nY+2 ) );
+ }
+ pDev->SetLineColor( aOldLineColor );
+ pDev->SetFillColor( aOldFillColor );
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags,
+ const Rectangle& rRect, Rectangle& rTextRect )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aInRect = rRect;
+ Color aColor = rStyleSettings.GetButtonTextColor();
+ XubString aText = PushButton::GetText(); // PushButton:: wegen MoreButton
+ USHORT nTextStyle;
+ USHORT nStyle;
+
+ if ( nDrawFlags & WINDOW_DRAW_MONO )
+ aColor = Color( COL_BLACK );
+ else
+ {
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ }
+
+ rTextRect = aInRect;
+ if ( mnDDStyle == PUSHBUTTON_DROPDOWN_MENUBUTTON )
+ {
+ if ( aText.Len() )
+ {
+ // Symbol- und Textrect ermitteln
+ long nSymbolSize = pDev->GetTextHeight();
+ aInRect.Right() -= 5;
+ rTextRect.Left() += 2;
+ rTextRect.Right() = aInRect.Right()-nSymbolSize;
+ aInRect.Left() = rTextRect.Right();
+
+ nTextStyle = ImplGetTextStyle();
+ if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC )
+ {
+ if ( nTextStyle & TEXT_DRAW_MNEMONIC )
+ {
+ aText = GetNonMnemonicString( aText );
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ }
+ }
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ }
+ nTextStyle &= ~(TEXT_DRAW_RIGHT | TEXT_DRAW_CENTER);
+ nTextStyle |= TEXT_DRAW_LEFT;
+ rTextRect = pDev->GetTextRect( rTextRect, aText, nTextStyle );
+ pDev->SetTextColor( aColor );
+ pDev->DrawText( rTextRect, aText, nTextStyle );
+ }
+ else
+ ImplCalcSymbolRect( aInRect );
+
+ nStyle = 0;
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nStyle |= SYMBOL_DRAW_DISABLE;
+ }
+
+ DecorationView aDecoView( pDev );
+ aDecoView.DrawSymbol( aInRect, SYMBOL_SPIN_DOWN, aColor, nStyle );
+ }
+ else
+ {
+ if ( aText.Len() )
+ {
+ nTextStyle = ImplGetTextStyle();
+ if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC )
+ {
+ if ( nTextStyle & TEXT_DRAW_MNEMONIC )
+ {
+ aText = GetNonMnemonicString( aText );
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ }
+ }
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ }
+ rTextRect = pDev->GetTextRect( aInRect, aText, nTextStyle );
+ }
+
+ if ( IsSymbol() )
+ {
+ ImplCalcSymbolRect( aInRect );
+
+ nStyle = 0;
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nStyle |= SYMBOL_DRAW_DISABLE;
+ }
+
+ DecorationView aDecoView( pDev );
+ aDecoView.DrawSymbol( aInRect, meSymbol, aColor, nStyle );
+ }
+
+ if ( aText.Len() )
+ {
+ pDev->SetTextColor( aColor );
+ pDev->DrawText( rTextRect, aText, nTextStyle );
+ }
+
+ // Den Fall Text+Image erstmal ignoriert, TH ignoriert auch Text+Symbol
+ if ( IsImage() )
+ {
+ // Image zentrieren...
+ Size aImageSize( maImage.GetSizePixel() );
+ aImageSize.Width() = CalcZoom( aImageSize.Width() );
+ aImageSize.Height() = CalcZoom( aImageSize.Height() );
+ if ( mpBitmapEx && ( pDev->GetOutDevType() == OUTDEV_PRINTER ) )
+ {
+ // Die Groesse richtet sich nach dem Bildschirm, soll auf
+ // dem Drucker genau so aussehen...
+ aImageSize = PixelToLogic( aImageSize, MAP_100TH_MM );
+ aImageSize = pDev->LogicToPixel( aImageSize, MAP_100TH_MM );
+ }
+
+ Point aImagePos( rRect.Left()+((aInRect.GetWidth()-aImageSize.Width())/2),
+ rRect.Top()+((aInRect.GetHeight()-aImageSize.Height())/2) );
+ nStyle = 0;
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nStyle |= IMAGE_DRAW_DISABLE;
+ }
+ if ( mpBitmapEx && ( pDev->GetOutDevType() == OUTDEV_PRINTER ) )
+ {
+ // Fuer die BitmapEx ueberlegt sich KA noch, wie man die disablete
+ // Darstellung hinbekommt...
+ aImageSize = pDev->PixelToLogic( aImageSize );
+ mpBitmapEx->Draw( pDev, aImagePos, aImageSize /*, nStyle*/ );
+ }
+ else
+ {
+ if ( IsZoom() )
+ pDev->DrawImage( aImagePos, aImageSize, maImage, nStyle );
+ else
+ pDev->DrawImage( aImagePos, maImage, nStyle );
+ }
+ }
+
+ if ( mnDDStyle == PUSHBUTTON_DROPDOWN_TOOLBOX )
+ {
+ BOOL bBlack = FALSE;
+ Color aArrowColor( COL_BLACK );
+ if ( !(nDrawFlags & WINDOW_DRAW_MONO) )
+ {
+ if ( !IsEnabled() )
+ aArrowColor = rStyleSettings.GetShadowColor();
+ else
+ {
+ aArrowColor = Color( COL_LIGHTGREEN );
+ bBlack = TRUE;
+ }
+ }
+
+ ImplDrawBtnDropDownArrow( pDev, aInRect.Right()-6, aInRect.Top()+1,
+ aArrowColor, bBlack );
+ }
+ }
+
+ UserDrawEvent aUDEvt( this, aInRect, 0 );
+ UserDraw( aUDEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::UserDraw( const UserDrawEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::ImplDrawPushButton()
+{
+ HideFocus();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ USHORT nButtonStyle = mnButtonState;
+ Point aPoint;
+ Size aOutSz( GetOutputSizePixel() );
+ Rectangle aRect( aPoint, aOutSz );
+ Rectangle aInRect = aRect;
+ Rectangle aTextRect;
+
+ // Wenn Button gedrueckt gezeichnet werden soll, dann Pressed dazuordern
+ if ( mbPressed )
+ nButtonStyle |= BUTTON_DRAW_PRESSED;
+
+ // PushButtonFrame ausgeben
+ ImplDrawPushButtonFrame( this, aInRect, nButtonStyle );
+
+ // PushButton-Inhalt ausgeben
+ ImplDrawPushButtonContent( this, 0, aInRect, aTextRect );
+
+ maFocusRect = aTextRect;
+ maFocusRect.Left()--;
+ maFocusRect.Top()--;
+ maFocusRect.Right()++;
+ maFocusRect.Bottom()++;
+ if ( HasFocus() )
+ ShowFocus( maFocusRect );
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::ImplSetDefButton( BOOL bSet )
+{
+ if ( bSet )
+ mnButtonState |= BUTTON_DRAW_DEFAULT;
+ else
+ mnButtonState &= ~BUTTON_DRAW_DEFAULT;
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL PushButton::ImplIsDefButton() const
+{
+ return (mnButtonState & BUTTON_DRAW_DEFAULT) != 0;
+}
+
+// -----------------------------------------------------------------------
+
+PushButton::PushButton( WindowType nType ) :
+ Button( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+PushButton::PushButton( Window* pParent, WinBits nStyle ) :
+ Button( WINDOW_PUSHBUTTON )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+PushButton::PushButton( Window* pParent, const ResId& rResId ) :
+ Button( WINDOW_PUSHBUTTON )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_PUSHBUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+PushButton::~PushButton()
+{
+ delete mpBitmapEx;
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() &&
+ ImplHitTestPushButton( this, rMEvt.GetPosPixel(), mnButtonState ) )
+ {
+ USHORT nTrackFlags = 0;
+
+ if ( GetStyle() & WB_REPEAT )
+ nTrackFlags |= STARTTRACK_BUTTONREPEAT;
+
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawPushButton();
+ StartTracking( nTrackFlags );
+
+ if ( GetStyle() & WB_REPEAT )
+ Click();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ if ( !(GetStyle() & WB_NOPOINTERFOCUS) && !rTEvt.IsTrackingCanceled() )
+ GrabFocus();
+
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawPushButton();
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ if ( !(GetStyle() & WB_REPEAT) )
+ Click();
+ }
+ }
+ }
+ else
+ {
+ if ( ImplHitTestPushButton( this, rTEvt.GetMouseEvent().GetPosPixel(), mnButtonState ) )
+ {
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ if ( rTEvt.IsTrackingRepeat() && (GetStyle() & WB_REPEAT) )
+ Click();
+ }
+ else
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawPushButton();
+ }
+ }
+ else
+ {
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawPushButton();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if ( !aKeyCode.GetModifier() &&
+ ((aKeyCode.GetCode() == KEY_RETURN) || (aKeyCode.GetCode() == KEY_SPACE)) )
+ {
+ if ( !(mnButtonState & BUTTON_DRAW_PRESSED) )
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawPushButton();
+ }
+
+ if ( GetStyle() & WB_REPEAT )
+ Click();
+ }
+ else if ( (mnButtonState & BUTTON_DRAW_PRESSED) && (aKeyCode.GetCode() == KEY_ESCAPE) )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawPushButton();
+ }
+ else
+ Button::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::KeyUp( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if ( (mnButtonState & BUTTON_DRAW_PRESSED) &&
+ ((aKeyCode.GetCode() == KEY_RETURN) || (aKeyCode.GetCode() == KEY_SPACE)) )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawPushButton();
+
+ if ( !(GetStyle() & WB_REPEAT) )
+ Click();
+ }
+ else
+ Button::KeyUp( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::Paint( const Rectangle& rRect )
+{
+ ImplDrawPushButton();
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Rectangle aRect( aPos, aSize );
+ Rectangle aTextRect;
+ Font aFont = GetDrawPixelFont( pDev );
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ if ( nFlags & WINDOW_DRAW_MONO )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ pDev->SetTextColor( GetTextColor() );
+ pDev->SetTextFillColor();
+
+ DecorationView aDecoView( pDev );
+ USHORT nButtonStyle = 0;
+ if ( nFlags & WINDOW_DRAW_MONO )
+ nButtonStyle |= BUTTON_DRAW_MONO;
+ if ( IsChecked() )
+ nButtonStyle |= BUTTON_DRAW_CHECKED;
+ aRect = aDecoView.DrawButton( aRect, nButtonStyle );
+
+ ImplDrawPushButtonContent( pDev, nFlags, aRect, aTextRect );
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::GetFocus()
+{
+ ShowFocus( maFocusRect );
+ SetInputContext( InputContext( GetFont() ) );
+ Button::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::LoseFocus()
+{
+ EndSelection();
+ HideFocus();
+ Button::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::StateChanged( StateChangedType nType )
+{
+ Button::StateChanged( nType );
+
+ if ( (nType == STATE_CHANGE_ENABLE) ||
+ (nType == STATE_CHANGE_TEXT) ||
+ (nType == STATE_CHANGE_IMAGE) ||
+ (nType == STATE_CHANGE_DATA) ||
+ (nType == STATE_CHANGE_STATE) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+
+ if ( nType == STATE_CHANGE_STATE )
+ Toggle();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetWindow( WINDOW_PREV ), GetStyle() ) );
+
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( (GetPrevStyle() & PUSHBUTTON_VIEW_STYLE) !=
+ (GetStyle() & PUSHBUTTON_VIEW_STYLE) )
+ Invalidate();
+ }
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Button::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::Toggle()
+{
+ maToggleHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::SetSymbol( SymbolType eSymbol )
+{
+ if ( meSymbol != eSymbol )
+ {
+ meSymbol = eSymbol;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::SetImage( const Image& rImage )
+{
+ delete mpBitmapEx;
+ mpBitmapEx = NULL;
+ if ( rImage != maImage )
+ {
+ maImage = rImage;
+ meSymbol = SYMBOL_IMAGE;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::SetBitmap( const BitmapEx& rBmp )
+{
+ SetImage( rBmp );
+ DBG_ASSERT( !mpBitmapEx, "BitmapEx nach SetImage?!" );
+ mpBitmapEx = new BitmapEx( rBmp );
+}
+
+// -----------------------------------------------------------------------
+
+BitmapEx PushButton::GetBitmap() const
+{
+ BitmapEx aBmp;
+ if ( mpBitmapEx )
+ aBmp = *mpBitmapEx;
+ return aBmp;
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::SetImageAlign( ImageAlign eAlign )
+{
+ if ( meImageAlign != eAlign )
+ {
+ meImageAlign = eAlign;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::SetDropDown( USHORT nStyle )
+{
+ if ( mnDDStyle != nStyle )
+ {
+ mnDDStyle = nStyle;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::SetState( TriState eState )
+{
+ if ( meState != eState )
+ {
+ meState = eState;
+ if ( meState == STATE_NOCHECK )
+ mnButtonState &= ~(BUTTON_DRAW_CHECKED | BUTTON_DRAW_DONTKNOW);
+ else if ( meState == STATE_CHECK )
+ {
+ mnButtonState &= ~BUTTON_DRAW_DONTKNOW;
+ mnButtonState |= BUTTON_DRAW_CHECKED;
+ }
+ else // STATE_DONTKNOW
+ {
+ mnButtonState &= ~BUTTON_DRAW_CHECKED;
+ mnButtonState |= BUTTON_DRAW_DONTKNOW;
+ }
+
+ StateChanged( STATE_CHANGE_STATE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::SetPressed( BOOL bPressed )
+{
+ if ( mbPressed != bPressed )
+ {
+ mbPressed = bPressed;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PushButton::EndSelection()
+{
+ EndTracking( ENDTRACK_CANCEL );
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ if ( !mbPressed )
+ ImplDrawPushButton();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size PushButton::CalcMinimumSize( long nMaxWidth ) const
+{
+ Size aSize;
+
+ if ( IsSymbol() )
+ aSize = Size( 12, 12 );
+ else if ( IsImage() )
+ aSize = maImage.GetSizePixel();
+ else if ( PushButton::GetText().Len() )
+ {
+ aSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ),
+ PushButton::GetText(), ImplGetTextStyle() ).GetSize();
+ }
+
+ return CalcWindowSize( aSize );
+}
+
+// =======================================================================
+
+void OKButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ PushButton::ImplInit( pParent, nStyle );
+
+ SetText( Button::GetStandardText( BUTTON_OK ) );
+ SetHelpText( Button::GetStandardHelpText( BUTTON_OK ) );
+}
+
+// -----------------------------------------------------------------------
+
+OKButton::OKButton( Window* pParent, WinBits nStyle ) :
+ PushButton( WINDOW_OKBUTTON )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+OKButton::OKButton( Window* pParent, const ResId& rResId ) :
+ PushButton( WINDOW_OKBUTTON )
+{
+ rResId.SetRT( RSC_OKBUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void OKButton::Click()
+{
+ // Ist kein Link gesetzt, dann schliesse Parent
+ if ( !GetClickHdl() )
+ {
+ Window* pParent = GetParent();
+ if ( pParent->IsSystemWindow() )
+ {
+ if ( pParent->IsDialog() )
+ {
+ // gegen rekursive Aufrufe schuetzen
+ if ( !((Dialog*)pParent)->IsInClose() )
+ {
+ if ( ((Dialog*)pParent)->IsInExecute() )
+ ((Dialog*)pParent)->EndDialog( TRUE );
+ else if ( pParent->GetStyle() & WB_CLOSEABLE )
+ ((Dialog*)pParent)->Close();
+ }
+ }
+ else
+ {
+ if ( pParent->GetStyle() & WB_CLOSEABLE )
+ ((SystemWindow*)pParent)->Close();
+ }
+ }
+ }
+ else
+ PushButton::Click();
+}
+
+// =======================================================================
+
+void CancelButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ PushButton::ImplInit( pParent, nStyle );
+
+ SetText( Button::GetStandardText( BUTTON_CANCEL ) );
+ SetHelpText( Button::GetStandardHelpText( BUTTON_CANCEL ) );
+}
+
+// -----------------------------------------------------------------------
+
+CancelButton::CancelButton( Window* pParent, WinBits nStyle ) :
+ PushButton( WINDOW_CANCELBUTTON )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+CancelButton::CancelButton( Window* pParent, const ResId& rResId ) :
+ PushButton( WINDOW_CANCELBUTTON )
+{
+ rResId.SetRT( RSC_CANCELBUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void CancelButton::Click()
+{
+ // Ist kein Link gesetzt, dann schliesse Parent
+ if ( !GetClickHdl() )
+ {
+ Window* pParent = GetParent();
+ if ( pParent->IsSystemWindow() )
+ {
+ if ( pParent->IsDialog() )
+ {
+ // gegen rekursive Aufrufe schuetzen
+ if ( !((Dialog*)pParent)->IsInClose() )
+ {
+ if ( ((Dialog*)pParent)->IsInExecute() )
+ ((Dialog*)pParent)->EndDialog( FALSE );
+ else if ( pParent->GetStyle() & WB_CLOSEABLE )
+ ((Dialog*)pParent)->Close();
+ }
+ }
+ else
+ {
+ if ( pParent->GetStyle() & WB_CLOSEABLE )
+ ((SystemWindow*)pParent)->Close();
+ }
+ }
+ }
+ else
+ PushButton::Click();
+}
+
+// =======================================================================
+
+void HelpButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ PushButton::ImplInit( pParent, nStyle | WB_NOPOINTERFOCUS );
+
+ SetText( Button::GetStandardText( BUTTON_HELP ) );
+ SetHelpText( Button::GetStandardHelpText( BUTTON_HELP ) );
+}
+
+// -----------------------------------------------------------------------
+
+HelpButton::HelpButton( Window* pParent, WinBits nStyle ) :
+ PushButton( WINDOW_HELPBUTTON )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+HelpButton::HelpButton( Window* pParent, const ResId& rResId ) :
+ PushButton( WINDOW_HELPBUTTON )
+{
+ rResId.SetRT( RSC_HELPBUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void HelpButton::Click()
+{
+ // Ist kein Link gesetzt, loese Hilfe aus
+ if ( !GetClickHdl() )
+ {
+ Window* pFocusWin = Application::GetFocusWindow();
+ if ( !pFocusWin )
+ pFocusWin = this;
+
+ HelpEvent aEvt( pFocusWin->GetPointerPosPixel(), HELPMODE_CONTEXT );
+ pFocusWin->RequestHelp( aEvt );
+ }
+ else
+ PushButton::Click();
+}
+
+// =======================================================================
+
+void RadioButton::ImplInitData()
+{
+ mnButtonState = 0;
+ mbChecked = FALSE;
+ mbSaveValue = FALSE;
+ mbRadioCheck = TRUE;
+ mbStateChanged = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle );
+ Button::ImplInit( pParent, nStyle, NULL );
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits RadioButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOGROUP) &&
+ (!pPrevWindow || (pPrevWindow->GetType() != WINDOW_RADIOBUTTON)) )
+ nStyle |= WB_GROUP;
+ if ( !(nStyle & WB_NOTABSTOP) )
+ {
+ if ( IsChecked() )
+ nStyle |= WB_TABSTOP;
+ else
+ nStyle &= ~WB_TABSTOP;
+ }
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetRadioCheckFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetRadioCheckTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplDrawRadioButtonState()
+{
+ USHORT nStyle = 0;
+
+ // kein Image-RadioButton
+ if ( !maImage )
+ {
+ USHORT nStyle = mnButtonState;
+ if ( !IsEnabled() )
+ nStyle |= BUTTON_DRAW_DISABLED;
+ if ( mbChecked )
+ nStyle |= BUTTON_DRAW_CHECKED;
+ Image aImage = GetRadioImage( GetSettings(), nStyle );
+ if ( IsZoom() )
+ DrawImage( maStateRect.TopLeft(), maStateRect.GetSize(), aImage );
+ else
+ DrawImage( maStateRect.TopLeft(), aImage );
+ }
+ else
+ {
+ HideFocus();
+
+ DecorationView aDecoView( this );
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aImageRect = maStateRect;
+ Size aImageSize = maImage.GetSizePixel();
+ BOOL bEnabled = IsEnabled();
+
+ aImageSize.Width() = CalcZoom( aImageSize.Width() );
+ aImageSize.Height() = CalcZoom( aImageSize.Height() );
+
+ // Border und Selektionsstatus ausgeben
+ nStyle = FRAME_DRAW_DOUBLEIN;
+ aImageRect = aDecoView.DrawFrame( aImageRect, nStyle );
+ if ( (mnButtonState & BUTTON_DRAW_PRESSED) || !bEnabled )
+ SetFillColor( rStyleSettings.GetFaceColor() );
+ else
+ SetFillColor( rStyleSettings.GetFieldColor() );
+ SetLineColor();
+ DrawRect( aImageRect );
+
+ // Image ausgeben
+ nStyle = 0;
+ if ( !bEnabled )
+ nStyle |= IMAGE_DRAW_DISABLE;
+ Point aImagePos( aImageRect.TopLeft() );
+ aImagePos.X() += (aImageRect.GetWidth()-aImageSize.Width())/2;
+ aImagePos.Y() += (aImageRect.GetHeight()-aImageSize.Height())/2;
+ if ( IsZoom() )
+ DrawImage( aImagePos, aImageSize, maImage, nStyle );
+ else
+ DrawImage( aImagePos, maImage, nStyle );
+
+ aImageRect.Left()++;
+ aImageRect.Top()++;
+ aImageRect.Right()--;
+ aImageRect.Bottom()--;
+
+ maFocusRect = aImageRect;
+
+ if ( mbChecked )
+ {
+ SetLineColor( rStyleSettings.GetHighlightColor() );
+ SetFillColor();
+ if ( (aImageSize.Width() >= 20) || (aImageSize.Height() >= 20) )
+ {
+ aImageRect.Left()++;
+ aImageRect.Top()++;
+ aImageRect.Right()--;
+ aImageRect.Bottom()--;
+ }
+ DrawRect( aImageRect );
+ aImageRect.Left()++;
+ aImageRect.Top()++;
+ aImageRect.Right()--;
+ aImageRect.Bottom()--;
+ DrawRect( aImageRect );
+ }
+
+ if ( HasFocus() )
+ ShowFocus( maFocusRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
+ const Point& rPos, const Size& rSize,
+ const Size& rImageSize, long nImageSep,
+ Rectangle& rStateRect,
+ Rectangle& rMouseRect,
+ Rectangle& rFocusRect )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ WinBits nWinStyle = GetStyle();
+ XubString aText( GetText() );
+ Rectangle aRect( rPos, rSize );
+
+ // kein Image-RadioButton
+ if ( !maImage )
+ {
+ if ( aText.Len() )
+ {
+ USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle );
+ if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC )
+ {
+ if ( nTextStyle & TEXT_DRAW_MNEMONIC )
+ {
+ aText = GetNonMnemonicString( aText );
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ }
+ }
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ }
+ if ( (nDrawFlags & WINDOW_DRAW_MONO) ||
+ (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ nTextStyle |= TEXT_DRAW_MONO;
+
+ aRect.Left() += rImageSize.Width()+nImageSep;
+ rMouseRect = pDev->GetTextRect( aRect, aText, nTextStyle );
+
+ pDev->DrawText( aRect, aText, nTextStyle );
+ rFocusRect = rMouseRect;
+ rFocusRect.Left()--;
+ rFocusRect.Right()++;
+
+ rMouseRect.Left() = rPos.X();
+ rStateRect.Left() = rPos.X();
+ rStateRect.Top() = rMouseRect.Top();
+ long nTextHeight = GetTextHeight();
+ if ( nTextHeight > rImageSize.Height() )
+ rStateRect.Top() += (nTextHeight-rImageSize.Height())/2;
+ rStateRect.Right() = rStateRect.Left()+rImageSize.Width()-1;
+ rStateRect.Bottom() = rStateRect.Top()+rImageSize.Height()-1;
+ if ( rStateRect.Bottom() > rMouseRect.Bottom() )
+ rMouseRect.Bottom() = rStateRect.Bottom();
+ }
+ else
+ {
+ if ( nWinStyle & WB_CENTER )
+ rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2);
+ else if ( nWinStyle & WB_RIGHT )
+ rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width(); //-1;
+ else
+ rStateRect.Left() = rPos.X(); //+1;
+ if ( nWinStyle & WB_VCENTER )
+ rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2);
+ else if ( nWinStyle & WB_BOTTOM )
+ rStateRect.Top() = rPos.Y()+rSize.Height()-rImageSize.Height(); //-1;
+ else
+ rStateRect.Top() = rPos.Y(); //+1;
+ rStateRect.Right() = rStateRect.Left()+rImageSize.Width()-1;
+ rStateRect.Bottom() = rStateRect.Top()+rImageSize.Height()-1;
+ rMouseRect = rStateRect;
+ rFocusRect = Rectangle();
+/* und oben -1, da CalcSize() auch Focus-Rechteck nicht mit einrechnet,
+da im Writer ansonsten die Images noch weiter oben haengen
+ rFocusRect = rStateRect;
+ rFocusRect.Left()--;
+ rFocusRect.Top()--;
+ rFocusRect.Right()++;
+ rFocusRect.Bottom()++;
+*/
+ }
+ }
+ else
+ {
+ BOOL bTopImage = (nWinStyle & WB_TOP) != 0;
+ Size aImageSize = maImage.GetSizePixel();
+ Rectangle aImageRect( rPos, rSize );
+ long nTextHeight = pDev->GetTextHeight();
+ long nTextWidth = pDev->GetCtrlTextWidth( aText );
+
+ // Positionen und Groessen berechnen
+ if ( aText.Len() )
+ {
+ Size aTmpSize( (aImageSize.Width()+8), (aImageSize.Height()+8) );
+ if ( bTopImage )
+ {
+ aImageRect.Left() = (rSize.Width()-aTmpSize.Width())/2;
+ aImageRect.Top() = (rSize.Height()-(aTmpSize.Height()+nTextHeight+6))/2;
+ }
+ else
+ aImageRect.Top() = (rSize.Height()-aTmpSize.Height())/2;
+
+ aImageRect.Right() = aImageRect.Left()+aTmpSize.Width();
+ aImageRect.Bottom() = aImageRect.Top()+aTmpSize.Height();
+ }
+
+ // Text ausgeben
+ if ( aText.Len() )
+ {
+ Point aTxtPos = rPos;
+ if ( bTopImage )
+ {
+ aTxtPos.X() += (rSize.Width()-nTextWidth)/2;
+ aTxtPos.Y() += aImageRect.Bottom()+6;
+ }
+ else
+ {
+ aTxtPos.X() += aImageRect.Right()+8;
+ aTxtPos.Y() += (rSize.Height()-nTextHeight)/2;
+ }
+ pDev->DrawCtrlText( aTxtPos, aText );
+ }
+
+ rMouseRect = aImageRect;
+ rStateRect = aImageRect;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplDrawRadioButton()
+{
+ HideFocus();
+
+ Size aImageSize;
+ if ( !maImage )
+ aImageSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel();
+ else
+ aImageSize = maImage.GetSizePixel();
+ aImageSize.Width() = CalcZoom( aImageSize.Width() );
+ aImageSize.Height() = CalcZoom( aImageSize.Height() );
+
+ ImplDraw( this, 0, Point(), GetOutputSizePixel(),
+ aImageSize, IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, maFocusRect );
+
+ if ( !maImage )
+ {
+ if ( HasFocus() && !maFocusRect.IsEmpty() )
+ ShowFocus( maFocusRect );
+ }
+ ImplDrawRadioButtonState();
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplUncheckAllOther()
+{
+ mnStyle |= WB_TABSTOP;
+
+ // Gruppe mit RadioButtons durchgehen und die gecheckten Buttons
+ Window* pWindow;
+ WinBits nStyle;
+ if ( !(GetStyle() & WB_GROUP) )
+ {
+ pWindow = GetWindow( WINDOW_PREV );
+ while ( pWindow )
+ {
+ nStyle = pWindow->GetStyle();
+
+ if ( pWindow->GetType() == WINDOW_RADIOBUTTON )
+ {
+ if ( ((RadioButton*)pWindow)->IsChecked() )
+ {
+ ImplDelData aDelData;
+ pWindow->ImplAddDel( &aDelData );
+ ((RadioButton*)pWindow)->SetState( FALSE );
+ if ( aDelData.IsDelete() )
+ return;
+ pWindow->ImplRemoveDel( &aDelData );
+ }
+ // Um falsch gesetzt WB_TABSTOPS immer zu entfernen, nicht
+ // innerhalb der if-Abfrage
+ pWindow->mnStyle &= ~WB_TABSTOP;
+ }
+
+ if ( nStyle & WB_GROUP )
+ break;
+
+ pWindow = pWindow->GetWindow( WINDOW_PREV );
+ }
+ }
+
+ pWindow = GetWindow( WINDOW_NEXT );
+ while ( pWindow )
+ {
+ nStyle = pWindow->GetStyle();
+
+ if ( nStyle & WB_GROUP )
+ break;
+
+ if ( pWindow->GetType() == WINDOW_RADIOBUTTON )
+ {
+ if ( ((RadioButton*)pWindow)->IsChecked() )
+ {
+ ImplDelData aDelData;
+ pWindow->ImplAddDel( &aDelData );
+ ((RadioButton*)pWindow)->SetState( FALSE );
+ if ( aDelData.IsDelete() )
+ return;
+ pWindow->ImplRemoveDel( &aDelData );
+ }
+ // Um falsch gesetzt WB_TABSTOPS immer zu entfernen, nicht
+ // innerhalb der if-Abfrage
+ pWindow->mnStyle &= ~WB_TABSTOP;
+ }
+
+ pWindow = pWindow->GetWindow( WINDOW_NEXT );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplCallClick( BOOL bGrabFocus, USHORT nFocusFlags )
+{
+ mbStateChanged = !mbChecked;
+ mbChecked = TRUE;
+ mnStyle |= WB_TABSTOP;
+ ImplDrawRadioButtonState();
+ ImplDelData aDelData;
+ ImplAddDel( &aDelData );
+ if ( mbRadioCheck )
+ ImplUncheckAllOther();
+ if ( aDelData.IsDelete() )
+ return;
+ if ( bGrabFocus )
+ ImplGrabFocus( nFocusFlags );
+ if ( aDelData.IsDelete() )
+ return;
+ if ( mbStateChanged )
+ Toggle();
+ if ( aDelData.IsDelete() )
+ return;
+ Click();
+ if ( aDelData.IsDelete() )
+ return;
+ ImplRemoveDel( &aDelData );
+ mbStateChanged = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+RadioButton::RadioButton( Window* pParent, WinBits nStyle ) :
+ Button( WINDOW_RADIOBUTTON )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+RadioButton::RadioButton( Window* pParent, const ResId& rResId ) :
+ Button( WINDOW_RADIOBUTTON )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_RADIOBUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::ImplLoadRes( const ResId& rResId )
+{
+ Button::ImplLoadRes( rResId );
+
+ //anderer Wert als Default ?
+ USHORT nChecked = ReadShortRes();
+ if ( nChecked )
+ SetState( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+RadioButton::~RadioButton()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && maMouseRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawRadioButtonState();
+ StartTracking();
+ return;
+ }
+
+ Button::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ if ( !(GetStyle() & WB_NOPOINTERFOCUS) && !rTEvt.IsTrackingCanceled() )
+ GrabFocus();
+
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ ImplCallClick();
+ else
+ ImplDrawRadioButtonState();
+ }
+ }
+ else
+ {
+ if ( maMouseRect.IsInside( rTEvt.GetMouseEvent().GetPosPixel() ) )
+ {
+ if ( !(mnButtonState & BUTTON_DRAW_PRESSED) )
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawRadioButtonState();
+ }
+ }
+ else
+ {
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawRadioButtonState();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if ( !aKeyCode.GetModifier() && (aKeyCode.GetCode() == KEY_SPACE) )
+ {
+ if ( !(mnButtonState & BUTTON_DRAW_PRESSED) )
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawRadioButtonState();
+ }
+ }
+ else if ( (mnButtonState & BUTTON_DRAW_PRESSED) && (aKeyCode.GetCode() == KEY_ESCAPE) )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawRadioButtonState();
+ }
+ else
+ Button::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::KeyUp( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if ( (mnButtonState & BUTTON_DRAW_PRESSED) && (aKeyCode.GetCode() == KEY_SPACE) )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplCallClick();
+ }
+ else
+ Button::KeyUp( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::Paint( const Rectangle& rRect )
+{
+ ImplDrawRadioButton();
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ if ( !maImage )
+ {
+ MapMode aResMapMode( MAP_100TH_MM );
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Size aImageSize = pDev->LogicToPixel( Size( 300, 300 ), aResMapMode );
+ Size aBrd1Size = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode );
+ Size aBrd2Size = pDev->LogicToPixel( Size( 60, 60 ), aResMapMode );
+ Font aFont = GetDrawPixelFont( pDev );
+ Rectangle aStateRect;
+ Rectangle aMouseRect;
+ Rectangle aFocusRect;
+
+ aImageSize.Width() = CalcZoom( aImageSize.Width() );
+ aImageSize.Height() = CalcZoom( aImageSize.Height() );
+ aBrd1Size.Width() = CalcZoom( aBrd1Size.Width() );
+ aBrd1Size.Height() = CalcZoom( aBrd1Size.Height() );
+ aBrd2Size.Width() = CalcZoom( aBrd2Size.Width() );
+ aBrd2Size.Height() = CalcZoom( aBrd2Size.Height() );
+
+ if ( !aBrd1Size.Width() )
+ aBrd1Size.Width() = 1;
+ if ( !aBrd1Size.Height() )
+ aBrd1Size.Height() = 1;
+ if ( !aBrd2Size.Width() )
+ aBrd2Size.Width() = 1;
+ if ( !aBrd2Size.Height() )
+ aBrd2Size.Height() = 1;
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ if ( nFlags & WINDOW_DRAW_MONO )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ pDev->SetTextColor( GetTextColor() );
+ pDev->SetTextFillColor();
+
+ ImplDraw( pDev, nFlags, aPos, aSize,
+ aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ),
+ aStateRect, aMouseRect, aFocusRect );
+
+ Point aCenterPos = aStateRect.Center();
+ long nRadX = aImageSize.Width()/2;
+ long nRadY = aImageSize.Height()/2;
+
+ pDev->SetLineColor();
+ pDev->SetFillColor( Color( COL_BLACK ) );
+ pDev->DrawPolygon( Polygon( aCenterPos, nRadX, nRadY ) );
+ nRadX -= aBrd1Size.Width();
+ nRadY -= aBrd1Size.Height();
+ pDev->SetFillColor( Color( COL_WHITE ) );
+ pDev->DrawPolygon( Polygon( aCenterPos, nRadX, nRadY ) );
+ if ( mbChecked )
+ {
+ nRadX -= aBrd1Size.Width();
+ nRadY -= aBrd1Size.Height();
+ if ( !nRadX )
+ nRadX = 1;
+ if ( !nRadY )
+ nRadY = 1;
+ pDev->SetFillColor( Color( COL_BLACK ) );
+ pDev->DrawPolygon( Polygon( aCenterPos, nRadX, nRadY ) );
+ }
+
+ pDev->Pop();
+ }
+ else
+ {
+ DBG_ERROR( "RadioButton::Draw() - not implemented for RadioButton with Image" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::GetFocus()
+{
+ ShowFocus( maFocusRect );
+ SetInputContext( InputContext( GetFont() ) );
+ Button::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::LoseFocus()
+{
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawRadioButtonState();
+ }
+
+ HideFocus();
+ Button::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::StateChanged( StateChangedType nType )
+{
+ Button::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_STATE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( HasPaintEvent() )
+ Invalidate( maStateRect );
+ else
+ ImplDrawRadioButtonState();
+ }
+ Toggle();
+ }
+ else if ( (nType == STATE_CHANGE_ENABLE) ||
+ (nType == STATE_CHANGE_TEXT) ||
+ (nType == STATE_CHANGE_IMAGE) ||
+ (nType == STATE_CHANGE_DATA) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetWindow( WINDOW_PREV ), GetStyle() ) );
+
+ if ( (GetPrevStyle() & RADIOBUTTON_VIEW_STYLE) !=
+ (GetStyle() & RADIOBUTTON_VIEW_STYLE) )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Button::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::Toggle()
+{
+ maToggleHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::SetImage( const Image& rImage )
+{
+ if ( rImage != maImage )
+ {
+ maImage = rImage;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::SetState( BOOL bCheck )
+{
+ // TabStop-Flag richtig mitfuehren
+ if ( bCheck )
+ mnStyle |= WB_TABSTOP;
+ else
+ mnStyle &= ~WB_TABSTOP;
+
+ if ( mbChecked != bCheck )
+ {
+ mbChecked = bCheck;
+ StateChanged( STATE_CHANGE_STATE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void RadioButton::Check( BOOL bCheck )
+{
+ // TabStop-Flag richtig mitfuehren
+ if ( bCheck )
+ mnStyle |= WB_TABSTOP;
+ else
+ mnStyle &= ~WB_TABSTOP;
+
+ if ( mbChecked != bCheck )
+ {
+ mbChecked = bCheck;
+ ImplDelData aDelData;
+ ImplAddDel( &aDelData );
+ StateChanged( STATE_CHANGE_STATE );
+ if ( aDelData.IsDelete() )
+ return;
+ ImplRemoveDel( &aDelData );
+ if ( bCheck && mbRadioCheck )
+ ImplUncheckAllOther();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image RadioButton::GetRadioImage( const AllSettings& rSettings, USHORT nFlags )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ const StyleSettings& rStyleSettings = rSettings.GetStyleSettings();
+ USHORT nStyle = rStyleSettings.GetRadioButtonStyle() & STYLE_RADIOBUTTON_STYLE;
+
+ if ( !pSVData->maCtrlData.mpRadioImgList ||
+ (pSVData->maCtrlData.mnRadioStyle != nStyle) ||
+ (pSVData->maCtrlData.mnLastRadioFColor != rStyleSettings.GetFaceColor().GetColor()) ||
+ (pSVData->maCtrlData.mnLastRadioWColor != rStyleSettings.GetWindowColor().GetColor()) ||
+ (pSVData->maCtrlData.mnLastRadioLColor != rStyleSettings.GetLightColor().GetColor()) )
+ {
+ if ( pSVData->maCtrlData.mpRadioImgList )
+ delete pSVData->maCtrlData.mpRadioImgList;
+
+ pSVData->maCtrlData.mnLastRadioFColor = rStyleSettings.GetFaceColor().GetColor();
+ pSVData->maCtrlData.mnLastRadioWColor = rStyleSettings.GetWindowColor().GetColor();
+ pSVData->maCtrlData.mnLastRadioLColor = rStyleSettings.GetLightColor().GetColor();
+
+ long aTempAry1[(6*sizeof(Color))/sizeof(long)];
+ long aTempAry2[(6*sizeof(Color))/sizeof(long)];
+ Color* pColorAry1 = (Color*)aTempAry1;
+ Color* pColorAry2 = (Color*)aTempAry2;
+ pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );
+ pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );
+ pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );
+ pColorAry1[3] = Color( 0x80, 0x80, 0x80 );
+ pColorAry1[4] = Color( 0x00, 0x00, 0x00 );
+ pColorAry1[5] = Color( 0x00, 0xFF, 0x00 );
+ pColorAry2[0] = rStyleSettings.GetFaceColor();
+ pColorAry2[1] = rStyleSettings.GetWindowColor();
+ pColorAry2[2] = rStyleSettings.GetLightColor();
+ pColorAry2[3] = rStyleSettings.GetShadowColor();
+ pColorAry2[4] = rStyleSettings.GetDarkShadowColor();
+ pColorAry2[5] = rStyleSettings.GetWindowTextColor();
+
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_RADIO+nStyle, ImplGetResMgr() ) );
+ aBmp.Replace( pColorAry1, pColorAry2, 6, NULL );
+ pSVData->maCtrlData.mpRadioImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 6 );
+ pSVData->maCtrlData.mnRadioStyle = nStyle;
+ }
+
+ USHORT nId;
+ if ( nFlags & BUTTON_DRAW_DISABLED )
+ {
+ if ( nFlags & BUTTON_DRAW_CHECKED )
+ nId = 6;
+ else
+ nId = 5;
+ }
+ else if ( nFlags & BUTTON_DRAW_PRESSED )
+ {
+ if ( nFlags & BUTTON_DRAW_CHECKED )
+ nId = 4;
+ else
+ nId = 3;
+ }
+ else
+ {
+ if ( nFlags & BUTTON_DRAW_CHECKED )
+ nId = 2;
+ else
+ nId = 1;
+ }
+ return pSVData->maCtrlData.mpRadioImgList->GetImage( nId );
+}
+
+// -----------------------------------------------------------------------
+
+Size RadioButton::CalcMinimumSize( long nMaxWidth ) const
+{
+ Size aSize;
+ if ( !maImage )
+ aSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel();
+ else
+ aSize = maImage.GetSizePixel();
+
+ XubString aText = GetText();
+ if ( aText.Len() )
+ {
+ Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ),
+ aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize();
+ aSize.Width() += IMPL_SEP_BUTTON_IMAGE;
+ aSize.Width() += aTextSize.Width();
+ if ( aSize.Height() < aTextSize.Height() )
+ aSize.Height() = aTextSize.Height();
+ }
+ else if ( !maImage )
+ {
+/* da ansonsten im Writer die Control zu weit oben haengen
+ aSize.Width() += 2;
+ aSize.Height() += 2;
+*/
+ }
+
+ return CalcWindowSize( aSize );
+}
+
+// =======================================================================
+
+void CheckBox::ImplInitData()
+{
+ mnButtonState = 0;
+ meState = STATE_NOCHECK;
+ meSaveValue = STATE_NOCHECK;
+ mbTriState = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( pParent->GetWindow( WINDOW_LASTCHILD ), nStyle );
+ Button::ImplInit( pParent, nStyle, NULL );
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits CheckBox::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) &&
+ (!pPrevWindow || (pPrevWindow->GetType() != WINDOW_CHECKBOX)) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetRadioCheckFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetRadioCheckTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::ImplLoadRes( const ResId& rResId )
+{
+ Button::ImplLoadRes( rResId );
+
+ if ( rResId.GetRT() != RSC_TRISTATEBOX )
+ {
+ USHORT nChecked = ReadShortRes();
+ //anderer Wert als Default ?
+ if( nChecked )
+ Check( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::ImplDrawCheckBoxState()
+{
+ USHORT nStyle = mnButtonState;
+ if ( !IsEnabled() )
+ nStyle |= BUTTON_DRAW_DISABLED;
+ if ( meState == STATE_DONTKNOW )
+ nStyle |= BUTTON_DRAW_DONTKNOW;
+ else if ( meState == STATE_CHECK )
+ nStyle |= BUTTON_DRAW_CHECKED;
+ Image aImage = GetCheckImage( GetSettings(), nStyle );
+ if ( IsZoom() )
+ DrawImage( maStateRect.TopLeft(), maStateRect.GetSize(), aImage );
+ else
+ DrawImage( maStateRect.TopLeft(), aImage );
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
+ const Point& rPos, const Size& rSize,
+ const Size& rImageSize, long nImageSep,
+ Rectangle& rStateRect,
+ Rectangle& rMouseRect,
+ Rectangle& rFocusRect )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ WinBits nWinStyle = GetStyle();
+ XubString aText( GetText() );
+ Rectangle aRect( rPos, rSize );
+
+ if ( aText.Len() )
+ {
+ USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle );
+ if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC )
+ {
+ if ( nTextStyle & TEXT_DRAW_MNEMONIC )
+ {
+ aText = GetNonMnemonicString( aText );
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ }
+ }
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ }
+ if ( (nDrawFlags & WINDOW_DRAW_MONO) ||
+ (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ nTextStyle |= TEXT_DRAW_MONO;
+
+ aRect.Left() += rImageSize.Width()+nImageSep;
+ rMouseRect = pDev->GetTextRect( aRect, aText, nTextStyle );
+
+ pDev->DrawText( aRect, aText, nTextStyle );
+ rFocusRect = rMouseRect;
+ rFocusRect.Left()--;
+ rFocusRect.Right()++;
+
+ rMouseRect.Left() = rPos.X();
+ rStateRect.Left() = rPos.X();
+ rStateRect.Top() = rMouseRect.Top();
+ long nTextHeight = GetTextHeight();
+ if ( nTextHeight > rImageSize.Height() )
+ rStateRect.Top() += (nTextHeight-rImageSize.Height())/2;
+ rStateRect.Right() = rStateRect.Left()+rImageSize.Width()-1;
+ rStateRect.Bottom() = rStateRect.Top()+rImageSize.Height()-1;
+ if ( rStateRect.Bottom() > rMouseRect.Bottom() )
+ rMouseRect.Bottom() = rStateRect.Bottom();
+ }
+ else
+ {
+ if ( nWinStyle & WB_CENTER )
+ rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2);
+ else if ( nWinStyle & WB_RIGHT )
+ rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width(); //-1;
+ else
+ rStateRect.Left() = rPos.X(); //+1;
+ if ( nWinStyle & WB_VCENTER )
+ rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2);
+ else if ( nWinStyle & WB_BOTTOM )
+ rStateRect.Top() = rPos.Y()+rSize.Height()-rImageSize.Height(); //-1;
+ else
+ rStateRect.Top() = rPos.Y(); //+1;
+ rStateRect.Right() = rStateRect.Left()+rImageSize.Width()-1;
+ rStateRect.Bottom() = rStateRect.Top()+rImageSize.Height()-1;
+ rMouseRect = rStateRect;
+ rFocusRect = Rectangle();
+/* und oben -1, da CalcSize() auch Focus-Rechteck nicht mit einrechnet,
+da im Writer ansonsten die Images noch weiter oben haengen
+ rFocusRect = rStateRect;
+ rFocusRect.Left()--;
+ rFocusRect.Top()--;
+ rFocusRect.Right()++;
+ rFocusRect.Bottom()++;
+*/
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::ImplDrawCheckBox()
+{
+ Size aImageSize = GetCheckImage( GetSettings(), 0 ).GetSizePixel();
+ aImageSize.Width() = CalcZoom( aImageSize.Width() );
+ aImageSize.Height() = CalcZoom( aImageSize.Height() );
+
+ HideFocus();
+ ImplDraw( this, 0, Point(), GetOutputSizePixel(),
+ aImageSize, IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, maFocusRect );
+ if ( HasFocus() && !maFocusRect.IsEmpty() )
+ ShowFocus( maFocusRect );
+ ImplDrawCheckBoxState();
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::ImplCheck()
+{
+ TriState eNewState;
+ if ( meState == STATE_NOCHECK )
+ eNewState = STATE_CHECK;
+ else if ( !mbTriState )
+ eNewState = STATE_NOCHECK;
+ else if ( meState == STATE_CHECK )
+ eNewState = STATE_DONTKNOW;
+ else
+ eNewState = STATE_NOCHECK;
+ meState = eNewState;
+ ImplDrawCheckBoxState();
+ Toggle();
+ Click();
+}
+
+// -----------------------------------------------------------------------
+
+CheckBox::CheckBox( Window* pParent, WinBits nStyle ) :
+ Button( WINDOW_CHECKBOX )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+CheckBox::CheckBox( Window* pParent, const ResId& rResId ) :
+ Button( WINDOW_CHECKBOX )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_CHECKBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() && maMouseRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawCheckBoxState();
+ StartTracking();
+ return;
+ }
+
+ Button::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ if ( !(GetStyle() & WB_NOPOINTERFOCUS) && !rTEvt.IsTrackingCanceled() )
+ GrabFocus();
+
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ ImplCheck();
+ else
+ ImplDrawCheckBoxState();
+ }
+ }
+ else
+ {
+ if ( maMouseRect.IsInside( rTEvt.GetMouseEvent().GetPosPixel() ) )
+ {
+ if ( !(mnButtonState & BUTTON_DRAW_PRESSED) )
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawCheckBoxState();
+ }
+ }
+ else
+ {
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawCheckBoxState();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if ( !aKeyCode.GetModifier() && (aKeyCode.GetCode() == KEY_SPACE) )
+ {
+ if ( !(mnButtonState & BUTTON_DRAW_PRESSED) )
+ {
+ mnButtonState |= BUTTON_DRAW_PRESSED;
+ ImplDrawCheckBoxState();
+ }
+ }
+ else if ( (mnButtonState & BUTTON_DRAW_PRESSED) && (aKeyCode.GetCode() == KEY_ESCAPE) )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawCheckBoxState();
+ }
+ else
+ Button::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::KeyUp( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ if ( (mnButtonState & BUTTON_DRAW_PRESSED) && (aKeyCode.GetCode() == KEY_SPACE) )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplCheck();
+ }
+ else
+ Button::KeyUp( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::Paint( const Rectangle& rRect )
+{
+ ImplDrawCheckBox();
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ MapMode aResMapMode( MAP_100TH_MM );
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Size aImageSize = pDev->LogicToPixel( Size( 300, 300 ), aResMapMode );
+ Size aBrd1Size = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode );
+ Size aBrd2Size = pDev->LogicToPixel( Size( 30, 30 ), aResMapMode );
+ long nCheckWidth = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode ).Width();
+ Font aFont = GetDrawPixelFont( pDev );
+ Rectangle aStateRect;
+ Rectangle aMouseRect;
+ Rectangle aFocusRect;
+
+ aImageSize.Width() = CalcZoom( aImageSize.Width() );
+ aImageSize.Height() = CalcZoom( aImageSize.Height() );
+ aBrd1Size.Width() = CalcZoom( aBrd1Size.Width() );
+ aBrd1Size.Height() = CalcZoom( aBrd1Size.Height() );
+ aBrd2Size.Width() = CalcZoom( aBrd2Size.Width() );
+ aBrd2Size.Height() = CalcZoom( aBrd2Size.Height() );
+
+ if ( !aBrd1Size.Width() )
+ aBrd1Size.Width() = 1;
+ if ( !aBrd1Size.Height() )
+ aBrd1Size.Height() = 1;
+ if ( !aBrd2Size.Width() )
+ aBrd2Size.Width() = 1;
+ if ( !aBrd2Size.Height() )
+ aBrd2Size.Height() = 1;
+ if ( !nCheckWidth )
+ nCheckWidth = 1;
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ if ( nFlags & WINDOW_DRAW_MONO )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ pDev->SetTextColor( GetTextColor() );
+ pDev->SetTextFillColor();
+
+ ImplDraw( pDev, nFlags, aPos, aSize,
+ aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ),
+ aStateRect, aMouseRect, aFocusRect );
+
+ pDev->SetLineColor();
+ pDev->SetFillColor( Color( COL_BLACK ) );
+ pDev->DrawRect( aStateRect );
+ aStateRect.Left() += aBrd1Size.Width();
+ aStateRect.Top() += aBrd1Size.Height();
+ aStateRect.Right() -= aBrd1Size.Width();
+ aStateRect.Bottom() -= aBrd1Size.Height();
+ if ( meState == STATE_DONTKNOW )
+ pDev->SetFillColor( Color( COL_LIGHTGRAY ) );
+ else
+ pDev->SetFillColor( Color( COL_WHITE ) );
+ pDev->DrawRect( aStateRect );
+
+ if ( meState == STATE_CHECK )
+ {
+ aStateRect.Left() += aBrd2Size.Width();
+ aStateRect.Top() += aBrd2Size.Height();
+ aStateRect.Right() -= aBrd2Size.Width();
+ aStateRect.Bottom() -= aBrd2Size.Height();
+ Point aPos11( aStateRect.TopLeft() );
+ Point aPos12( aStateRect.BottomRight() );
+ Point aPos21( aStateRect.TopRight() );
+ Point aPos22( aStateRect.BottomLeft() );
+ Point aTempPos11( aPos11 );
+ Point aTempPos12( aPos12 );
+ Point aTempPos21( aPos21 );
+ Point aTempPos22( aPos22 );
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ long nDX = 0;
+ for ( long i = 0; i < nCheckWidth; i++ )
+ {
+ if ( !(i % 2) )
+ {
+ aTempPos11.X() = aPos11.X()+nDX;
+ aTempPos12.X() = aPos12.X()+nDX;
+ aTempPos21.X() = aPos21.X()+nDX;
+ aTempPos22.X() = aPos22.X()+nDX;
+ }
+ else
+ {
+ nDX++;
+ aTempPos11.X() = aPos11.X()-nDX;
+ aTempPos12.X() = aPos12.X()-nDX;
+ aTempPos21.X() = aPos21.X()-nDX;
+ aTempPos22.X() = aPos22.X()-nDX;
+ }
+ pDev->DrawLine( aTempPos11, aTempPos12 );
+ pDev->DrawLine( aTempPos21, aTempPos22 );
+ }
+ }
+
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::GetFocus()
+{
+ ShowFocus( maFocusRect );
+ SetInputContext( InputContext( GetFont() ) );
+ Button::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::LoseFocus()
+{
+ if ( mnButtonState & BUTTON_DRAW_PRESSED )
+ {
+ mnButtonState &= ~BUTTON_DRAW_PRESSED;
+ ImplDrawCheckBoxState();
+ }
+
+ HideFocus();
+ Button::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::StateChanged( StateChangedType nType )
+{
+ Button::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_STATE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( HasPaintEvent() )
+ Invalidate( maStateRect );
+ else
+ ImplDrawCheckBoxState();
+ }
+ Toggle();
+ }
+ else if ( (nType == STATE_CHANGE_ENABLE) ||
+ (nType == STATE_CHANGE_TEXT) ||
+ (nType == STATE_CHANGE_IMAGE) ||
+ (nType == STATE_CHANGE_DATA) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetWindow( WINDOW_PREV ), GetStyle() ) );
+
+ if ( (GetPrevStyle() & CHECKBOX_VIEW_STYLE) !=
+ (GetStyle() & CHECKBOX_VIEW_STYLE) )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Button::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::Toggle()
+{
+ maToggleHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::SetState( TriState eState )
+{
+ if ( !mbTriState && (eState == STATE_DONTKNOW) )
+ eState = STATE_NOCHECK;
+
+ if ( meState != eState )
+ {
+ meState = eState;
+ StateChanged( STATE_CHANGE_STATE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void CheckBox::EnableTriState( BOOL bTriState )
+{
+ if ( mbTriState != bTriState )
+ {
+ mbTriState = bTriState;
+
+ if ( !bTriState && (meState == STATE_DONTKNOW) )
+ SetState( STATE_NOCHECK );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image CheckBox::GetCheckImage( const AllSettings& rSettings, USHORT nFlags )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ const StyleSettings& rStyleSettings = rSettings.GetStyleSettings();
+ USHORT nStyle = rStyleSettings.GetCheckBoxStyle() & STYLE_CHECKBOX_STYLE;
+
+ if ( !pSVData->maCtrlData.mpCheckImgList ||
+ (pSVData->maCtrlData.mnCheckStyle != nStyle) ||
+ (pSVData->maCtrlData.mnLastCheckFColor != rStyleSettings.GetFaceColor().GetColor()) ||
+ (pSVData->maCtrlData.mnLastCheckWColor != rStyleSettings.GetWindowColor().GetColor()) ||
+ (pSVData->maCtrlData.mnLastCheckLColor != rStyleSettings.GetLightColor().GetColor()) )
+ {
+ if ( pSVData->maCtrlData.mpCheckImgList )
+ delete pSVData->maCtrlData.mpCheckImgList;
+
+ pSVData->maCtrlData.mnLastCheckFColor = rStyleSettings.GetFaceColor().GetColor();
+ pSVData->maCtrlData.mnLastCheckWColor = rStyleSettings.GetWindowColor().GetColor();
+ pSVData->maCtrlData.mnLastCheckLColor = rStyleSettings.GetLightColor().GetColor();
+
+ long aTempAry1[(6*sizeof(Color))/sizeof(long)];
+ long aTempAry2[(6*sizeof(Color))/sizeof(long)];
+ Color* pColorAry1 = (Color*)aTempAry1;
+ Color* pColorAry2 = (Color*)aTempAry2;
+ pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );
+ pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );
+ pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );
+ pColorAry1[3] = Color( 0x80, 0x80, 0x80 );
+ pColorAry1[4] = Color( 0x00, 0x00, 0x00 );
+ pColorAry1[5] = Color( 0x00, 0xFF, 0x00 );
+ pColorAry2[0] = rStyleSettings.GetFaceColor();
+ pColorAry2[1] = rStyleSettings.GetWindowColor();
+ pColorAry2[2] = rStyleSettings.GetLightColor();
+ pColorAry2[3] = rStyleSettings.GetShadowColor();
+ pColorAry2[4] = rStyleSettings.GetDarkShadowColor();
+ pColorAry2[5] = rStyleSettings.GetWindowTextColor();
+
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_CHECK+nStyle, ImplGetResMgr() ) );
+ aBmp.Replace( pColorAry1, pColorAry2, 6, NULL );
+ pSVData->maCtrlData.mpCheckImgList = new ImageList( aBmp, 9 );
+ pSVData->maCtrlData.mnCheckStyle = nStyle;
+ }
+
+ USHORT nId;
+ if ( nFlags & BUTTON_DRAW_DISABLED )
+ {
+ if ( nFlags & BUTTON_DRAW_DONTKNOW )
+ nId = 9;
+ else if ( nFlags & BUTTON_DRAW_CHECKED )
+ nId = 6;
+ else
+ nId = 5;
+ }
+ else if ( nFlags & BUTTON_DRAW_PRESSED )
+ {
+ if ( nFlags & BUTTON_DRAW_DONTKNOW )
+ nId = 8;
+ else if ( nFlags & BUTTON_DRAW_CHECKED )
+ nId = 4;
+ else
+ nId = 3;
+ }
+ else
+ {
+ if ( nFlags & BUTTON_DRAW_DONTKNOW )
+ nId = 7;
+ else if ( nFlags & BUTTON_DRAW_CHECKED )
+ nId = 2;
+ else
+ nId = 1;
+ }
+ return pSVData->maCtrlData.mpCheckImgList->GetImage( nId );
+}
+
+// -----------------------------------------------------------------------
+
+Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
+{
+ Size aSize = GetCheckImage( GetSettings(), 0 ).GetSizePixel();
+
+ XubString aText = GetText();
+ if ( aText.Len() )
+ {
+ Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ),
+ aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize();
+ aSize.Width() += IMPL_SEP_BUTTON_IMAGE;
+ aSize.Width() += aTextSize.Width();
+ if ( aSize.Height() < aTextSize.Height() )
+ aSize.Height() = aTextSize.Height();
+ }
+ else
+ {
+/* da ansonsten im Writer die Control zu weit oben haengen
+ aSize.Width() += 2;
+ aSize.Height() += 2;
+*/
+ }
+
+ return CalcWindowSize( aSize );
+}
+
+// =======================================================================
+
+ImageButton::ImageButton( WindowType nType ) :
+ PushButton( nType )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImageButton::ImageButton( Window* pParent, WinBits nStyle ) :
+ PushButton( pParent, nStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImageButton::ImageButton( Window* pParent, const ResId& rResId ) :
+ PushButton( pParent, rResId.SetRT( RSC_IMAGEBUTTON ) )
+{
+ USHORT nObjMask = ReadShortRes();
+
+ if ( RSC_IMAGEBUTTON_IMAGE & nObjMask )
+ {
+ SetImage( Image( ResId( (RSHEADER_TYPE*)GetClassRes() ) ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+
+ if ( RSC_IMAGEBUTTON_SYMBOL & nObjMask )
+ SetSymbol( (SymbolType)ReadShortRes() );
+
+ if ( RSC_IMAGEBUTTON_STATE & nObjMask )
+ SetState( (TriState)ReadShortRes() );
+}
+
+// -----------------------------------------------------------------------
+
+ImageButton::~ImageButton()
+{
+}
+
+// =======================================================================
+
+ImageRadioButton::ImageRadioButton( Window* pParent, WinBits nStyle ) :
+ RadioButton( pParent, nStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImageRadioButton::ImageRadioButton( Window* pParent, const ResId& rResId ) :
+ RadioButton( pParent, rResId.SetRT( RSC_IMAGERADIOBUTTON ) )
+{
+ USHORT nObjMask = ReadShortRes();
+
+ if ( RSC_IMAGERADIOBUTTON_IMAGE & nObjMask )
+ {
+ SetImage( Image( ResId( (RSHEADER_TYPE*)GetClassRes() ) ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImageRadioButton::~ImageRadioButton()
+{
+}
+
+// =======================================================================
+
+TriStateBox::TriStateBox( Window* pParent, WinBits nStyle ) :
+ CheckBox( pParent, nStyle )
+{
+ EnableTriState( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+TriStateBox::TriStateBox( Window* pParent, const ResId& rResId ) :
+ CheckBox( pParent, rResId.SetRT( RSC_TRISTATEBOX ) )
+{
+ EnableTriState( TRUE );
+
+ USHORT nTriState = ReadShortRes();
+ USHORT bDisableTriState = ReadShortRes();
+ //anderer Wert als Default ?
+ if ( (TriState)nTriState != STATE_NOCHECK )
+ SetState( (TriState)nTriState );
+ if ( bDisableTriState )
+ EnableTriState( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+TriStateBox::~TriStateBox()
+{
+}
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
new file mode 100644
index 000000000000..1d5ab2dd8eab
--- /dev/null
+++ b/vcl/source/control/combobox.cxx
@@ -0,0 +1,1242 @@
+/*************************************************************************
+ *
+ * $RCSfile: combobox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_COMBOBOX_CXX
+
+#ifndef _TOOLS_TABLE_HXX
+#include <tools/table.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_ILSTBOX_HXX
+#include <ilstbox.hxx>
+#endif
+#ifndef _SV_LSTBOX_H
+#include <lstbox.h>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+#ifndef _SV_SUBEDIT_HXX
+#include <subedit.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_COMBOBOX_HXX
+#include <combobox.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+inline ULONG ImplCreateKey( USHORT nPos )
+{
+ // Key = Pos+1, wegen Pos 0
+ return nPos+1;
+}
+
+// -----------------------------------------------------------------------
+
+static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText, xub_Unicode cTokenSep, const ImplEntryList* pEntryList )
+{
+ for( xub_StrLen n = rText.GetTokenCount( cTokenSep ); n; )
+ {
+ XubString aToken = rText.GetToken( --n, cTokenSep );
+ aToken.EraseLeadingAndTrailingChars( ' ' );
+ USHORT nPos = pEntryList->FindEntry( aToken );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ rSelectedPos.Insert( ImplCreateKey( nPos ), (void*)1L );
+ }
+}
+
+// =======================================================================
+
+ComboBox::ComboBox( WindowType nType ) :
+ Edit( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+ComboBox::ComboBox( Window* pParent, WinBits nStyle ) :
+ Edit( WINDOW_COMBOBOX )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ComboBox::ComboBox( Window* pParent, const ResId& rResId ) :
+ Edit( WINDOW_COMBOBOX )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_COMBOBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+ComboBox::~ComboBox()
+{
+ SetSubEdit( NULL );
+ delete mpSubEdit;
+
+ delete mpImplLB;
+ mpImplLB = NULL;
+
+ delete mpFloatWin;
+ delete mpBtn;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::ImplInitData()
+{
+ mpSubEdit = NULL;
+ mpBtn = NULL;
+ mpImplLB = NULL;
+ mpFloatWin = NULL;
+
+ mnDDHeight = 0;
+ mbDDAutoSize = TRUE;
+ mbSyntheticModify = FALSE;
+ mbMatchCase = FALSE;
+ mcMultiSep = ';';
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::ImplCalcEditHeight()
+{
+ long nLeft, nTop, nRight, nBottom;
+ GetBorder( nLeft, nTop, nRight, nBottom );
+ mnDDHeight = (USHORT)(mpSubEdit->GetTextHeight() + nTop + nBottom + 4);
+ if ( !IsDropDownBox() )
+ mnDDHeight += 4;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::ImplInit( Window* pParent, WinBits nStyle )
+{
+ ImplInitStyle( nStyle );
+
+ BOOL bNoBorder = ( nStyle & WB_NOBORDER ) ? TRUE : FALSE;
+ if ( !(nStyle & WB_DROPDOWN) )
+ {
+ nStyle &= ~WB_BORDER;
+ nStyle |= WB_NOBORDER;
+ }
+ else
+ {
+ if ( !bNoBorder )
+ nStyle |= WB_BORDER;
+ }
+
+ Edit::ImplInit( pParent, nStyle );
+ SetBackground();
+
+ // DropDown ?
+ WinBits nEditStyle = 0;
+ WinBits nListStyle = nStyle;
+ if( nStyle & WB_DROPDOWN )
+ {
+ mpFloatWin = new ImplListBoxFloatingWindow( this );
+ mpFloatWin->SetAutoWidth( TRUE );
+ mpFloatWin->SetPopupModeEndHdl( LINK( this, ComboBox, ImplPopupModeEndHdl ) );
+
+ mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
+ ImplInitDropDownButton( mpBtn );
+ mpBtn->SetMBDownHdl( LINK( this, ComboBox, ImplClickBtnHdl ) );
+ mpBtn->Show();
+
+ nEditStyle |= WB_NOBORDER;
+ nListStyle &= ~WB_BORDER;
+ nListStyle |= WB_NOBORDER;
+ }
+ else
+ {
+ if ( !bNoBorder )
+ {
+ nEditStyle |= WB_BORDER;
+ nListStyle &= ~WB_NOBORDER;
+ nListStyle |= WB_BORDER;
+ }
+ }
+
+ mpSubEdit = new Edit( this, nEditStyle );
+ SetSubEdit( mpSubEdit );
+ mpSubEdit->SetPosPixel( Point() );
+ EnableAutocomplete( TRUE );
+ mpSubEdit->Show();
+
+ Window* pLBParent = this;
+ if ( mpFloatWin )
+ pLBParent = mpFloatWin;
+ mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE );
+ mpImplLB->SetPosPixel( Point() );
+ mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) );
+ mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) );
+ mpImplLB->SetDoubleClickHdl( LINK( this, ComboBox, ImplDoubleClickHdl ) );
+ mpImplLB->SetUserDrawHdl( LINK( this, ComboBox, ImplUserDrawHdl ) );
+ mpImplLB->SetSelectionChangedHdl( LINK( this, ComboBox, ImplSelectionChangedHdl ) );
+ mpImplLB->Show();
+
+ if ( mpFloatWin )
+ mpFloatWin->SetImplListBox( mpImplLB );
+// else
+// mpImplLB->GetMainWindow()->AllowGrabFocus( TRUE );
+
+ ImplCalcEditHeight();
+
+ SetCompoundControl( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits ComboBox::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::ImplLoadRes( const ResId& rResId )
+{
+ Edit::ImplLoadRes( rResId );
+
+ USHORT nNumber = ReadShortRes();
+
+ if( nNumber )
+ {
+ for( USHORT i = 0; i < nNumber; i++ )
+ {
+ InsertEntry( ReadStringRes(), LISTBOX_APPEND );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::EnableAutocomplete( BOOL bEnable, BOOL bMatchCase )
+{
+ mbMatchCase = bMatchCase;
+
+ if ( bEnable )
+ mpSubEdit->SetAutocompleteHdl( LINK( this, ComboBox, ImplAutocompleteHdl ) );
+ else
+ mpSubEdit->SetAutocompleteHdl( Link() );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ComboBox::IsAutocompleteEnabled() const
+{
+ return mpSubEdit->GetAutocompleteHdl().IsSet();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplClickBtnHdl, void*, EMPTYARG )
+{
+ mpSubEdit->GrabFocus();
+ if ( !mpImplLB->GetEntryList()->GetMRUCount() )
+ ImplUpdateFloatSelection();
+ else
+ mpImplLB->SelectEntry( 0 , TRUE );
+ mpBtn->SetPressed( TRUE );
+ mpFloatWin->StartFloat( TRUE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplPopupModeEndHdl, void*, p )
+{
+ mpBtn->SetPressed( FALSE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplAutocompleteHdl, Edit*, pEdit )
+{
+ Selection aSel = pEdit->GetSelection();
+ AutocompleteAction eAction = pEdit->GetAutocompleteAction();
+
+ // Wenn keine Selection vorhanden ist, wird bei Tab/Shift+Tab auch
+ // keine AutoCompletion durchgefuehrt, da man ansonsten nicht in
+ // das naechste Feld kommt und der Text wieder mit etwas AutoExpandiert
+ // wird, was man nicht haben moechte.
+ if ( aSel.Len() ||
+ ((eAction != AUTOCOMPLETE_TABFORWARD) && (eAction != AUTOCOMPLETE_TABBACKWARD)) )
+ {
+ XubString aFullText = pEdit->GetText();
+ XubString aStartText = aFullText.Copy( 0, (xub_StrLen)aSel.Max() );
+ USHORT nStart = mpImplLB->GetCurrentPos();
+
+ if ( nStart == LISTBOX_ENTRY_NOTFOUND )
+ nStart = 0;
+
+ BOOL bForward = TRUE;
+ if ( eAction == AUTOCOMPLETE_TABFORWARD )
+ nStart++;
+ else if ( eAction == AUTOCOMPLETE_TABBACKWARD )
+ {
+ bForward = FALSE;
+ nStart = nStart ? (nStart--) : mpImplLB->GetEntryList()->GetEntryCount()-1;
+ }
+ MatchMode eMatchMode = mbMatchCase ? MATCH_CASE : MATCH_BEST;
+ USHORT nPos = mpImplLB->GetEntryList()->FindEntry( aStartText, eMatchMode, aStartText.Len(), nStart, bForward );
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = mpImplLB->GetEntryList()->FindEntry( aStartText, eMatchMode, aStartText.Len(), bForward ? 0 : (mpImplLB->GetEntryList()->GetEntryCount()-1), bForward );
+
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XubString aText = mpImplLB->GetEntryList()->GetEntryText( nPos );
+ Selection aSel( aText.Len(), aStartText.Len() );
+ pEdit->SetText( aText, aSel );
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
+{
+ BOOL bPopup = IsInDropDown();
+ if ( bPopup && !mpImplLB->IsTravelSelect() &&
+ ( !IsMultiSelectionEnabled() || !mpImplLB->GetSelectModifier() ) )
+ {
+ mpFloatWin->EndPopupMode();
+ GrabFocus();
+ }
+
+ if ( mpImplLB->IsSelectionChanged() || bPopup )
+ {
+ XubString aText;
+ if ( IsMultiSelectionEnabled() )
+ {
+ aText = mpSubEdit->GetText();
+
+ // Alle Eintraege entfernen, zu denen es einen Entry gibt, der aber nicht selektiert ist.
+ xub_StrLen nIndex = 0;
+ while ( nIndex != STRING_NOTFOUND )
+ {
+ xub_StrLen nPrevIndex = nIndex;
+ XubString aToken = aText.GetToken( 0, mcMultiSep, nIndex );
+ xub_StrLen nTokenLen = aToken.Len();
+ aToken.EraseLeadingAndTrailingChars( ' ' );
+ USHORT nP = mpImplLB->GetEntryList()->FindEntry( aToken );
+ if ( (nP != LISTBOX_ENTRY_NOTFOUND) && (!mpImplLB->GetEntryList()->IsEntryPosSelected( nP )) )
+ {
+ aText.Erase( nPrevIndex, nTokenLen );
+ nIndex -= nTokenLen;
+ if ( (nPrevIndex < aText.Len()) && (aText.GetChar( nPrevIndex ) == mcMultiSep) )
+ {
+ aText.Erase( nPrevIndex, 1 );
+ nIndex--;
+ }
+ }
+ aText.EraseLeadingAndTrailingChars( ' ' );
+ }
+
+ // Fehlende Eintraege anhaengen...
+ Table aSelInText;
+ lcl_GetSelectedEntries( aSelInText, aText, mcMultiSep, mpImplLB->GetEntryList() );
+ USHORT nSelectedEntries = mpImplLB->GetEntryList()->GetSelectEntryCount();
+ for ( USHORT n = 0; n < nSelectedEntries; n++ )
+ {
+ USHORT nP = mpImplLB->GetEntryList()->GetSelectEntryPos( n );
+ if ( !aSelInText.IsKeyValid( ImplCreateKey( nP ) ) )
+ {
+ if ( aText.Len() && (aText.GetChar( aText.Len()-1 ) != mcMultiSep) )
+ aText += mcMultiSep;
+ if ( aText.Len() )
+ aText += ' '; // etwas auflockern
+ aText += mpImplLB->GetEntryList()->GetEntryText( nP );
+ aText += mcMultiSep;
+ }
+ }
+ if ( aText.Len() && (aText.GetChar( aText.Len()-1 ) == mcMultiSep) )
+ aText.Erase( aText.Len()-1, 1 );
+ }
+ else
+ {
+ aText = mpImplLB->GetEntryList()->GetSelectEntry( 0 );
+ }
+
+ mpSubEdit->SetText( aText );
+
+ Selection aNewSelection( 0, aText.Len() );
+ if ( IsMultiSelectionEnabled() )
+ aNewSelection.Min() = aText.Len();
+ mpSubEdit->SetSelection( aNewSelection );
+
+ mpSubEdit->SetModifyFlag();
+ mbSyntheticModify = TRUE;
+ Modify();
+ mbSyntheticModify = FALSE;
+ Select();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplCancelHdl, void*, EMPTYARG )
+{
+ if( IsInDropDown() )
+ mpFloatWin->EndPopupMode();
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplSelectionChangedHdl, void*, n )
+{
+ if ( !mpImplLB->IsTrackingSelect() )
+ {
+ USHORT nChanged = (USHORT)(ULONG)n;
+ if ( !mpSubEdit->IsReadOnly() && mpImplLB->GetEntryList()->IsEntryPosSelected( nChanged ) )
+ mpSubEdit->SetText( mpImplLB->GetEntryList()->GetEntryText( nChanged ) );
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplDoubleClickHdl, void*, EMPTYARG )
+{
+ DoubleClick();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::EnableAutoSize( BOOL bAuto )
+{
+ mbDDAutoSize = bAuto;
+ if ( mpFloatWin )
+ {
+ if ( bAuto && !mpFloatWin->GetDropDownLineCount() )
+ mpFloatWin->SetDropDownLineCount( 5 );
+ else if ( !bAuto )
+ mpFloatWin->SetDropDownLineCount( 0 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetDropDownLineCount( USHORT nLines )
+{
+ if ( mpFloatWin )
+ mpFloatWin->SetDropDownLineCount( nLines );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::GetDropDownLineCount() const
+{
+ USHORT nLines = 0;
+ if ( mpFloatWin )
+ nLines = mpFloatWin->GetDropDownLineCount();
+ return nLines;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight,
+ USHORT nFlags )
+{
+ if( IsDropDownBox() && ( nFlags & WINDOW_POSSIZE_SIZE ) )
+ {
+ Size aPrefSz = mpFloatWin->GetPrefSize();
+ if ( ( nFlags & WINDOW_POSSIZE_HEIGHT ) && ( nHeight > mnDDHeight ) )
+ aPrefSz.Height() = nHeight-mnDDHeight;
+ if ( nFlags & WINDOW_POSSIZE_WIDTH )
+ aPrefSz.Width() = nWidth;
+ mpFloatWin->SetPrefSize( aPrefSz );
+
+ if ( IsAutoSizeEnabled() )
+ nHeight = mnDDHeight;
+ }
+
+ Edit::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::Resize()
+{
+ Size aOutSz = GetOutputSizePixel();
+ if( IsDropDownBox() )
+ {
+ long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSBWidth = CalcZoom( nSBWidth );
+ mpSubEdit->SetSizePixel( Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) );
+ mpBtn->SetPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() );
+ }
+ else
+ {
+ mpSubEdit->SetSizePixel( Size( aOutSz.Width(), mnDDHeight ) );
+ mpImplLB->SetPosSizePixel( 0, mnDDHeight, aOutSz.Width(), aOutSz.Height() - mnDDHeight );
+ if ( GetText().Len() )
+ ImplUpdateFloatSelection();
+ }
+
+ // FloatingWindow-Groesse auch im unsichtbare Zustand auf Stand halten,
+ // weil KEY_PGUP/DOWN ausgewertet wird...
+ if ( mpFloatWin )
+ mpFloatWin->SetSizePixel( mpFloatWin->CalcFloatSize() );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::StateChanged( StateChangedType nType )
+{
+ Edit::StateChanged( nType );
+
+ if ( ( nType == STATE_CHANGE_ENABLE ) || ( nType == STATE_CHANGE_READONLY ) )
+ {
+ mpImplLB->SetReadOnly( IsReadOnly() );
+ if ( mpBtn )
+ mpBtn->Enable( IsEnabled() && !IsReadOnly() );
+ }
+ else if ( nType == STATE_CHANGE_ENABLE )
+ {
+ mpSubEdit->Enable( IsEnabled() );
+ mpImplLB->Enable( IsEnabled() && !IsReadOnly() );
+ if ( mpBtn )
+ mpBtn->Enable( IsEnabled() && !IsReadOnly() );
+ Invalidate();
+ }
+ else if( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ mpImplLB->SetUpdateMode( IsUpdateMode() );
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ mpImplLB->SetZoom( GetZoom() );
+ mpSubEdit->SetZoom( GetZoom() );
+ ImplCalcEditHeight();
+ Resize();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ mpImplLB->SetControlFont( GetControlFont() );
+ mpSubEdit->SetControlFont( GetControlFont() );
+ ImplCalcEditHeight();
+ Resize();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ mpImplLB->SetControlForeground( GetControlForeground() );
+ mpSubEdit->SetControlForeground( GetControlForeground() );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ mpImplLB->SetControlBackground( GetControlBackground() );
+ mpSubEdit->SetControlBackground( GetControlBackground() );
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ if ( mpBtn )
+ {
+ mpBtn->SetSettings( GetSettings() );
+ ImplInitDropDownButton( mpBtn );
+ }
+ Resize();
+ mpImplLB->Resize(); // Wird nicht durch ComboBox::Resize() gerufen, wenn sich die ImplLB nicht aendert.
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ComboBox::PreNotify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+
+ if( ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow() ) )
+ {
+ mpSubEdit->GrabFocus();
+ }
+
+ return nDone ? nDone : Edit::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long ComboBox::Notify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+ if( ( rNEvt.GetType() == EVENT_KEYINPUT ) && ( rNEvt.GetWindow() == mpSubEdit )
+ && !IsReadOnly() )
+ {
+ KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
+ USHORT nKeyCode = aKeyEvt.GetKeyCode().GetCode();
+ switch( nKeyCode )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ {
+ ImplUpdateFloatSelection();
+ if( ( nKeyCode == KEY_DOWN ) && mpFloatWin && !mpFloatWin->IsInPopupMode() && aKeyEvt.GetKeyCode().IsMod2() )
+ {
+ mpBtn->SetPressed( TRUE );
+ if ( mpImplLB->GetEntryList()->GetMRUCount() )
+ mpImplLB->SelectEntry( 0 , TRUE );
+ mpFloatWin->StartFloat( FALSE );
+ nDone = 1;
+ }
+ else if( ( nKeyCode == KEY_UP ) && mpFloatWin && mpFloatWin->IsInPopupMode() && aKeyEvt.GetKeyCode().IsMod2() )
+ {
+ mpFloatWin->EndPopupMode();
+ nDone = 1;
+ }
+ else
+ nDone = mpImplLB->ProcessKeyInput( aKeyEvt );
+ }
+ break;
+
+ case KEY_RETURN:
+ {
+ if( ( rNEvt.GetWindow() == mpSubEdit ) && IsInDropDown() )
+ {
+ mpImplLB->ProcessKeyInput( aKeyEvt );
+ nDone = 1;
+ }
+ }
+ break;
+ }
+ }
+ else if ( (rNEvt.GetType() == EVENT_LOSEFOCUS) && mpFloatWin )
+ {
+ if( mpFloatWin->HasChildPathFocus() )
+ mpSubEdit->GrabFocus();
+ else if ( mpFloatWin->IsInPopupMode() && !HasChildPathFocus( TRUE ) )
+ mpFloatWin->EndPopupMode();
+ }
+ else if( (rNEvt.GetType() == EVENT_COMMAND) &&
+ (rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) &&
+ (rNEvt.GetWindow() == mpSubEdit) )
+ {
+ nDone = mpImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
+ }
+
+ return nDone ? nDone : Edit::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetText( const XubString& rStr )
+{
+ Edit::SetText( rStr );
+ ImplUpdateFloatSelection();
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetText( const XubString& rStr, const Selection& rNewSelection )
+{
+ Edit::SetText( rStr, rNewSelection );
+ ImplUpdateFloatSelection();
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::Modify()
+{
+ if ( !mbSyntheticModify )
+ ImplUpdateFloatSelection();
+
+ Edit::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::ImplUpdateFloatSelection()
+{
+ // Text in der ListBox in den sichtbaren Bereich bringen
+ mpImplLB->SetCallSelectionChangedHdl( FALSE );
+ if ( !IsMultiSelectionEnabled() )
+ {
+ XubString aSearchStr( mpSubEdit->GetText() );
+ USHORT nSelect = LISTBOX_ENTRY_NOTFOUND;
+ BOOL bSelect = TRUE;
+
+ if ( mpImplLB->GetCurrentPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ XubString aCurrent = mpImplLB->GetEntryList()->GetEntryText( mpImplLB->GetCurrentPos() );
+ if ( aCurrent == aSearchStr )
+ nSelect = mpImplLB->GetCurrentPos();
+ }
+
+ if ( nSelect == LISTBOX_ENTRY_NOTFOUND )
+ nSelect = mpImplLB->GetEntryList()->FindEntry( aSearchStr, MATCH_CASE, STRING_LEN );
+ if ( nSelect == LISTBOX_ENTRY_NOTFOUND )
+ {
+ nSelect = mpImplLB->GetEntryList()->FindEntry( aSearchStr, MATCH_BEST, aSearchStr.Len() );
+ bSelect = FALSE;
+ }
+
+ if( nSelect != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if ( !mpImplLB->IsVisible( nSelect ) )
+ mpImplLB->SetTopEntry( nSelect );
+ mpImplLB->SelectEntry( nSelect, bSelect );
+ }
+ else
+ {
+ nSelect = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 );
+ if( nSelect != LISTBOX_ENTRY_NOTFOUND )
+ mpImplLB->SelectEntry( nSelect, FALSE );
+ mpImplLB->SetTopEntry( 0 );
+ mpImplLB->ResetCurrentPos();
+ }
+ }
+ else
+ {
+ Table aSelInText;
+ lcl_GetSelectedEntries( aSelInText, mpSubEdit->GetText(), mcMultiSep, mpImplLB->GetEntryList() );
+ for ( USHORT n = 0; n < mpImplLB->GetEntryList()->GetEntryCount(); n++ )
+ mpImplLB->SelectEntry( n, aSelInText.IsKeyValid( ImplCreateKey( n ) ) );
+ }
+ mpImplLB->SetCallSelectionChangedHdl( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::InsertEntry( const XubString& rStr, USHORT nPos )
+{
+ USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr );
+ nRealPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nRealPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::InsertEntry( const XubString& rStr, const Image& rImage, USHORT nPos )
+{
+ USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage );
+ nRealPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nRealPos;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::RemoveEntry( const XubString& rStr )
+{
+ RemoveEntry( GetEntryPos( rStr ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::RemoveEntry( USHORT nPos )
+{
+ mpImplLB->RemoveEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::Clear()
+{
+ mpImplLB->Clear();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::GetEntryPos( const XubString& rStr ) const
+{
+ USHORT nPos = mpImplLB->GetEntryList()->FindEntry( rStr, MATCH_CASE, STRING_LEN, mpImplLB->GetEntryList()->GetMRUCount() );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ nPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::GetEntryPos( const void* pData ) const
+{
+ USHORT nPos = mpImplLB->GetEntryList()->FindEntry( pData );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ nPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+XubString ComboBox::GetEntry( USHORT nPos ) const
+{
+ return mpImplLB->GetEntryList()->GetEntryText( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::GetEntryCount() const
+{
+ return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ComboBox::IsTravelSelect() const
+{
+ return mpImplLB->IsTravelSelect();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ComboBox::IsInDropDown() const
+{
+ return mpFloatWin && mpFloatWin->IsInPopupMode();
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::EnableMultiSelection( BOOL bMulti )
+{
+ mpImplLB->EnableMultiSelection( bMulti );
+ mpImplLB->SetMultiSelectionSimpleMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ComboBox::IsMultiSelectionEnabled() const
+{
+ return mpImplLB->IsMultiSelectionEnabled();
+}
+
+// -----------------------------------------------------------------------
+
+long ComboBox::CalcWindowSizePixel( USHORT nLines ) const
+{
+ return mpImplLB->GetEntryHeight() * nLines;
+}
+
+// -----------------------------------------------------------------------
+
+Size ComboBox::CalcMinimumSize() const
+{
+ Size aSz;
+ if ( !IsDropDownBox() )
+ {
+ aSz = mpImplLB->CalcSize( mpImplLB->GetEntryList()->GetEntryCount() );
+ aSz.Height() += mnDDHeight;
+ }
+ else
+ {
+ aSz.Height() = mpImplLB->CalcSize( 1 ).Height();
+ aSz.Width() = mpImplLB->GetMaxEntryWidth();
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ }
+
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Size ComboBox::CalcAdjustedSize( const Size& rPrefSize ) const
+{
+ Size aSz = rPrefSize;
+ long nLeft, nTop, nRight, nBottom;
+ ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
+ aSz.Height() -= nTop+nBottom;
+ if ( !IsDropDownBox() )
+ {
+ long nEntryHeight = CalcSize( 1, 1 ).Height();
+ long nLines = aSz.Height() / nEntryHeight;
+ if ( nLines < 1 )
+ nLines = 1;
+ aSz.Height() = nLines * nEntryHeight;
+ aSz.Height() += mnDDHeight;
+ }
+ else
+ {
+ aSz.Height() = mnDDHeight;
+ }
+ aSz.Height() += nTop+nBottom;
+
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Size ComboBox::CalcSize( USHORT nColumns, USHORT nLines ) const
+{
+ // ggf. werden ScrollBars eingeblendet
+ Size aMinSz = CalcMinimumSize();
+ Size aSz;
+
+ // Hoehe
+ if ( nLines )
+ {
+ if ( !IsDropDownBox() )
+ aSz.Height() = mpImplLB->CalcSize( nLines ).Height() + mnDDHeight;
+ else
+ aSz.Height() = mnDDHeight;
+ }
+ else
+ aSz.Height() = aMinSz.Height();
+
+ // Breite
+ if ( nColumns )
+ aSz.Width() = nColumns * GetTextWidth( UniString( 'X' ) );
+ else
+ aSz.Width() = aMinSz.Width();
+
+ if ( IsDropDownBox() )
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+
+ if ( !IsDropDownBox() )
+ {
+ if ( aSz.Width() < aMinSz.Width() )
+ aSz.Height() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ if ( aSz.Height() < aMinSz.Height() )
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ }
+
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const
+{
+ long nCharWidth = GetTextWidth( UniString( 'x' ) );
+ if ( !IsDropDownBox() )
+ {
+ Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel();
+ rnCols = (USHORT)(aOutSz.Width()/nCharWidth);
+ rnLines = (USHORT)(aOutSz.Height()/mpImplLB->GetEntryHeight());
+ }
+ else
+ {
+ Size aOutSz = mpSubEdit->GetOutputSizePixel();
+ rnCols = (USHORT)(aOutSz.Width()/nCharWidth);
+ rnLines = 1;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ mpImplLB->GetMainWindow()->ImplInitSettings( TRUE, TRUE, TRUE );
+
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
+ OutDevType eOutDevType = pDev->GetOutDevType();
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ pDev->SetTextFillColor();
+
+ // Border/Background
+ pDev->SetLineColor();
+ pDev->SetFillColor();
+ BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER);
+ BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground();
+ if ( bBorder || bBackground )
+ {
+ Rectangle aRect( aPos, aSize );
+ // aRect.Top() += nEditHeight;
+ if ( bBorder )
+ {
+ DecorationView aDecoView( pDev );
+ aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+ }
+ if ( bBackground )
+ {
+ pDev->SetFillColor( GetControlBackground() );
+ pDev->DrawRect( aRect );
+ }
+ }
+
+ // Inhalt
+ if ( IsDropDownBox() )
+ {
+ mpSubEdit->Draw( pDev, aPos, aSize, nFlags );
+ // DD-Button ?
+ }
+ else
+ {
+ long nOnePixel = GetDrawPixel( pDev, 1 );
+ long nTextHeight = pDev->GetTextHeight();
+ long nEditHeight = nTextHeight + 6*nOnePixel;
+
+ mpSubEdit->Draw( pDev, aPos, Size( aSize.Width(), nEditHeight ), nFlags );
+
+ if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
+ {
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ }
+ else
+ {
+ if ( !(nFlags & WINDOW_DRAW_NODISABLE ) && !IsEnabled() )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ pDev->SetTextColor( rStyleSettings.GetDisableColor() );
+ }
+ else
+ {
+ pDev->SetTextColor( GetTextColor() );
+ }
+ }
+
+ Rectangle aClip( aPos, aSize );
+ pDev->IntersectClipRegion( aClip );
+ USHORT nLines = (USHORT) ( (aSize.Height()-nEditHeight) / nTextHeight );
+ if ( !nLines )
+ nLines = 1;
+ USHORT nTEntry = IsReallyVisible() ? mpImplLB->GetTopEntry() : 0;
+ for ( USHORT n = 0; n < nLines; n++ )
+ pDev->DrawText( Point( aPos.X() + 3*nOnePixel, aPos.Y() + n*nTextHeight + nEditHeight + nOnePixel ), mpImplLB->GetEntryList()->GetEntryText( n+nTEntry ) );
+ }
+
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ComboBox, ImplUserDrawHdl, UserDrawEvent*, pEvent )
+{
+ UserDraw( *pEvent );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::UserDraw( const UserDrawEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetUserItemSize( const Size& rSz )
+{
+ mpImplLB->GetMainWindow()->SetUserItemSize( rSz );
+}
+
+// -----------------------------------------------------------------------
+
+const Size& ComboBox::GetUserItemSize() const
+{
+ return mpImplLB->GetMainWindow()->GetUserItemSize();
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::EnableUserDraw( BOOL bUserDraw )
+{
+ mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ComboBox::IsUserDrawEnabled() const
+{
+ return mpImplLB->GetMainWindow()->IsUserDrawEnabled();
+}
+
+// -----------------------------------------------------------------------
+
+#if SUPD < 593
+void ComboBox::DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText )
+{
+ DBG_ASSERT( rEvt.GetDevice() == mpImplLB->GetMainWindow(), "DrawEntry?!" );
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText );
+}
+#endif
+
+void ComboBox::DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos )
+{
+ DBG_ASSERT( rEvt.GetDevice() == mpImplLB->GetMainWindow(), "DrawEntry?!" );
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetSeparatorPos( USHORT n )
+{
+ mpImplLB->SetSeparatorPos( n );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetSeparatorPos()
+{
+ mpImplLB->SetSeparatorPos( LISTBOX_ENTRY_NOTFOUND );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::GetSeparatorPos() const
+{
+ return mpImplLB->GetSeparatorPos();
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
+{
+ mpImplLB->SetMRUEntries( rEntries, cSep );
+}
+
+// -----------------------------------------------------------------------
+
+XubString ComboBox::GetMRUEntries( xub_Unicode cSep ) const
+{
+ return mpImplLB->GetMRUEntries( cSep );
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetMaxMRUCount( USHORT n )
+{
+ mpImplLB->SetMaxMRUCount( n );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ComboBox::GetMaxMRUCount() const
+{
+ return mpImplLB->GetMaxMRUCount();
+}
+
+// -----------------------------------------------------------------------
+
+void ComboBox::SetEntryData( USHORT nPos, void* pNewData )
+{
+ mpImplLB->SetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount(), pNewData );
+}
+
+// -----------------------------------------------------------------------
+
+void* ComboBox::GetEntryData( USHORT nPos ) const
+{
+ return mpImplLB->GetEntryList()->GetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
new file mode 100644
index 000000000000..b325b75451bf
--- /dev/null
+++ b/vcl/source/control/ctrl.cxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * $RCSfile: ctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_CTRL_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_CTRL_HXX
+#include <ctrl.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+void Control::ImplInitData()
+{
+ mbHasFocus = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Control::Control( WindowType nType ) :
+ Window( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+Control::Control( Window* pParent, WinBits nStyle ) :
+ Window( WINDOW_CONTROL )
+{
+ ImplInitData();
+ Window::ImplInit( pParent, nStyle, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+Control::Control( Window* pParent, const ResId& rResId ) :
+ Window( WINDOW_CONTROL )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_CONTROL );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle, NULL );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void Control::GetFocus()
+{
+ Window::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void Control::LoseFocus()
+{
+ Window::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+long Control::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ {
+ if ( !mbHasFocus )
+ {
+ mbHasFocus = TRUE;
+ maGetFocusHdl.Call( this );
+ }
+ }
+ else
+ {
+ if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ Window* pFocusWin = Application::GetFocusWindow();
+ if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) )
+ {
+ mbHasFocus = FALSE;
+ maLoseFocusHdl.Call( this );
+ }
+ }
+ }
+
+ return Window::Notify( rNEvt );
+}
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
new file mode 100644
index 000000000000..a93ef960b91b
--- /dev/null
+++ b/vcl/source/control/edit.cxx
@@ -0,0 +1,2200 @@
+/*************************************************************************
+ *
+ * $RCSfile: edit.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_EDIT_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_CURSOR_HXX
+#include <cursor.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_CLIP_HXX
+#include <clip.hxx>
+#endif
+#ifndef _SV_DRAG_HXX
+#include <drag.hxx>
+#endif
+#ifndef _SV_TRANSFER_HXX
+#include <transfer.hxx>
+#endif
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+#ifndef _SV_MENU_HXX
+#include <menu.hxx>
+#endif
+#ifndef _VCL_CMDEVT_H
+#include <cmdevt.h>
+#endif
+#ifndef _SV_SUBEDIT_HXX
+#include <subedit.hxx>
+#endif
+#ifndef _SV_EDIT_HXX
+#include <edit.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_
+#include <com/sun/star/text/XBreakIterator.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_CHARACTERITERATORMODE_HPP_
+#include <com/sun/star/text/CharacterIteratorMode.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_WORDTYPE_HPP_
+#include <com/sun/star/text/WordType.hpp>
+#endif
+
+#include <unohelp.hxx>
+
+
+#pragma hdrstop
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::rtl;
+
+// - Redo
+// - Bei Tracking-Cancel DefaultSelection wieder herstellen
+
+// =======================================================================
+
+static FncGetSpecialChars pImplFncGetSpecialChars = NULL;
+
+// =======================================================================
+
+#define EDIT_ALIGN_LEFT 1
+#define EDIT_ALIGN_CENTER 2
+#define EDIT_ALIGN_RIGHT 3
+
+#define EDIT_DEL_LEFT 1
+#define EDIT_DEL_RIGHT 2
+
+#define EDIT_DELMODE_SIMPLE 11
+#define EDIT_DELMODE_RESTOFWORD 12
+#define EDIT_DELMODE_RESTOFCONTENT 13
+
+// =======================================================================
+
+uno::Reference < text::XBreakIterator > ImplGetBreakIterator()
+{
+ static uno::Reference < text::XBreakIterator > xB;
+ if ( !xB.is() )
+ xB = vcl::unohelper::CreateBreakIterator();
+ return xB;
+}
+
+// =======================================================================
+
+struct DDInfo
+{
+ Cursor aCursor;
+ xub_StrLen nDropPos;
+ BOOL bStarterOfDD;
+ BOOL bDroppedInMe;
+ BOOL bVisCursor;
+
+ DDInfo()
+ {
+ aCursor.SetStyle( CURSOR_SHADOW );
+ nDropPos = 0;
+ bStarterOfDD = FALSE;
+ bDroppedInMe = FALSE;
+ bVisCursor = FALSE;
+ }
+};
+
+// =======================================================================
+
+struct Impl_IMEInfos
+{
+ USHORT* pAttribs;
+ xub_StrLen nPos;
+ xub_StrLen nLen;
+ BOOL bCursor;
+
+ Impl_IMEInfos( xub_StrLen nPos );
+ ~Impl_IMEInfos();
+
+ void CopyAttribs( const xub_StrLen* pA, xub_StrLen nL );
+ void DestroyAttribs();
+};
+
+// -----------------------------------------------------------------------
+
+Impl_IMEInfos::Impl_IMEInfos( xub_StrLen nP )
+{
+ nPos = nP;
+ nLen = 0;
+ bCursor = TRUE;
+ pAttribs = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+Impl_IMEInfos::~Impl_IMEInfos()
+{
+ delete pAttribs;
+}
+
+// -----------------------------------------------------------------------
+
+void Impl_IMEInfos::CopyAttribs( const xub_StrLen* pA, xub_StrLen nL )
+{
+ nLen = nL;
+ delete pAttribs;
+ pAttribs = new USHORT[ nL ];
+ memcpy( pAttribs, pA, nL*sizeof(USHORT) );
+}
+
+// -----------------------------------------------------------------------
+
+void Impl_IMEInfos::DestroyAttribs()
+{
+ delete pAttribs;
+ pAttribs = NULL;
+}
+
+// =======================================================================
+
+Edit::Edit( WindowType nType ) :
+ Control( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+Edit::Edit( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_EDIT )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+Edit::Edit( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_EDIT )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_EDIT );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+Edit::~Edit()
+{
+ delete mpDDInfo;
+ Cursor* pCursor = GetCursor();
+ if ( pCursor )
+ {
+ SetCursor( NULL );
+ delete pCursor;
+ }
+
+ delete mpIMEInfos;
+
+ if ( mpUpdateDataTimer )
+ delete mpUpdateDataTimer;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplInitData()
+{
+ mpSubEdit = NULL;
+ mpUpdateDataTimer = NULL;
+ mnXOffset = 0;
+ mnAlign = EDIT_ALIGN_LEFT;
+ mnMaxTextLen = EDIT_NOLIMIT;
+ meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
+ mbModified = FALSE;
+ mbInternModified = FALSE;
+ mbReadOnly = FALSE;
+ mbInsertMode = TRUE;
+ mbClickedInSelection = FALSE;
+ mbActivePopup = FALSE;
+ mbIsSubEdit = FALSE;
+ mbInMBDown = FALSE;
+ mpDDInfo = NULL;
+ mpIMEInfos = NULL;
+ mcEchoChar = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( nStyle );
+ if ( !(nStyle & (WB_CENTER | WB_RIGHT)) )
+ nStyle |= WB_LEFT;
+
+ Control::ImplInit( pParent, nStyle, NULL );
+
+ mbReadOnly = (nStyle & WB_READONLY) != 0;
+
+ mnAlign = EDIT_ALIGN_LEFT;
+ if ( nStyle & WB_RIGHT )
+ mnAlign = EDIT_ALIGN_RIGHT;
+ else if ( nStyle & WB_CENTER )
+ mnAlign = EDIT_ALIGN_CENTER;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
+ SetFillColor( rStyleSettings.GetFieldColor() );
+ SetCursor( new Cursor );
+
+ SetPointer( Pointer( POINTER_TEXT ) );
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits Edit::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Edit::IsCharInput( const KeyEvent& rKeyEvent )
+{
+ // In the future we must use new Unicode functions for this
+ xub_Unicode cCharCode = rKeyEvent.GetCharCode();
+ return ((cCharCode >= 32) && (cCharCode != 127) &&
+ !rKeyEvent.GetKeyCode().IsControlMod());
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplModified()
+{
+ mbModified = TRUE;
+ Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetFieldFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bFont || bForeground )
+ {
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if ( IsControlForeground() )
+ aTextColor = GetControlForeground();
+ SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if( IsControlBackground() )
+ {
+ SetBackground( GetControlBackground() );
+ SetFillColor( GetControlBackground() );
+ }
+ else
+ {
+ SetBackground( rStyleSettings.GetFieldColor() );
+ SetFillColor( rStyleSettings.GetFieldColor() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString Edit::ImplGetText() const
+{
+ if ( mcEchoChar || (GetStyle() & WB_PASSWORD) )
+ {
+ XubString aText;
+ xub_Unicode cEchoChar;
+ if ( mcEchoChar )
+ cEchoChar = mcEchoChar;
+ else
+ cEchoChar = '*';
+ aText.Fill( maText.Len(), cEchoChar );
+ return aText;
+ }
+ else
+ return maText;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd )
+{
+ if ( !IsReallyVisible() )
+ return;
+
+ XubString aText = ImplGetText();
+ if ( nStart >= aText.Len() )
+ return;
+
+ if ( nEnd > aText.Len() )
+ nEnd = aText.Len();
+
+ Cursor* pCursor = GetCursor();
+ BOOL bVisCursor = pCursor ? pCursor->IsVisible() : FALSE;
+ if ( pCursor )
+ pCursor->Hide();
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( IsEnabled() )
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ else
+ SetTextColor( rStyleSettings.GetDisableColor() );
+
+ SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
+
+ // In der Hoehe zentrieren
+ long nH = GetOutputSize().Height();
+ long nTH = GetTextHeight();
+ Point aPos( mnXOffset, (nH-nTH)/2 );
+
+ BOOL bDrawSelection = maSelection.Len() && ( HasFocus() || ( GetStyle() & WB_NOHIDESELECTION ) || mbActivePopup );
+
+ if ( !bDrawSelection && !mpIMEInfos )
+ {
+ aPos.X() = GetTextWidth( aText, 0, nStart ) + mnXOffset;
+ DrawText( aPos, aText, nStart, nEnd - nStart );
+ }
+ else
+ {
+ Selection aTmpSel( maSelection );
+ aTmpSel.Justify();
+
+ xub_StrLen nIndex = nStart;
+ while ( nIndex < nEnd )
+ {
+ xub_StrLen nTmpEnd = nEnd;
+ USHORT nAttr = 0;
+ if ( mpIMEInfos && mpIMEInfos->pAttribs )
+ {
+ xub_StrLen nIMEEnd = mpIMEInfos->nPos+mpIMEInfos->nLen;
+ if ( (nIndex < mpIMEInfos->nPos) && (nTmpEnd > mpIMEInfos->nPos) )
+ {
+ nTmpEnd = mpIMEInfos->nPos;
+ }
+ else if ( (nIndex >= mpIMEInfos->nPos) && (nIndex < nIMEEnd) )
+ {
+ // Attributweise ausgeben...
+ nTmpEnd = nIndex + 1;
+ if ( (nIndex >= mpIMEInfos->nPos) && (nIndex < (mpIMEInfos->nPos+mpIMEInfos->nLen)) )
+ {
+ nAttr = mpIMEInfos->pAttribs[nIndex-mpIMEInfos->nPos];
+ xub_StrLen nMax = mpIMEInfos->nPos+mpIMEInfos->nLen;
+ while ( ( nTmpEnd < nMax ) && ( mpIMEInfos->pAttribs[ nTmpEnd - mpIMEInfos->nPos ] == nAttr ) )
+ nTmpEnd++;
+ }
+ }
+ }
+ else if ( bDrawSelection )
+ {
+ if ( ( nIndex < aTmpSel.Min() ) && ( nTmpEnd > aTmpSel.Min() ) )
+ nTmpEnd = (xub_StrLen)aTmpSel.Min();
+ else if ( ( nIndex >= aTmpSel.Min() ) && ( nIndex < aTmpSel.Max() ) && ( nTmpEnd > aTmpSel.Max() ) )
+ nTmpEnd = (xub_StrLen)aTmpSel.Max();
+ }
+
+ aPos.X() = GetTextWidth( aText, 0, nIndex ) + mnXOffset;
+ ImplInitSettings( mpIMEInfos ? TRUE : FALSE, TRUE, FALSE );
+ BOOL bSelected = bDrawSelection && ((xub_StrLen)aTmpSel.Min() <= nIndex ) && ((xub_StrLen)aTmpSel.Max() > nIndex );
+ if ( bSelected || ( nAttr & EXTTEXTINPUT_ATTR_HIGHLIGHT) )
+ {
+ SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ SetTextFillColor( rStyleSettings.GetHighlightColor() );
+ }
+ else
+ {
+ SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
+ }
+
+ if ( nAttr )
+ {
+ Font aFont = GetFont();
+ if ( nAttr & EXTTEXTINPUT_ATTR_UNDERLINE )
+ aFont.SetUnderline( UNDERLINE_SINGLE );
+ else if ( nAttr & EXTTEXTINPUT_ATTR_BOLDUNDERLINE )
+ aFont.SetUnderline( UNDERLINE_BOLD );
+ else if ( nAttr & EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE )
+ aFont.SetUnderline( UNDERLINE_DOTTED );
+ else if ( nAttr & EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE )
+ aFont.SetUnderline( UNDERLINE_DOTTED );
+ else if ( nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE )
+ {
+ aFont.SetUnderline( UNDERLINE_WAVE );
+ SetTextLineColor( Color( COL_LIGHTGRAY ) );
+ }
+ SetFont( aFont );
+
+ if ( nAttr & EXTTEXTINPUT_ATTR_REDTEXT )
+ SetTextColor( Color( COL_RED ) );
+ }
+ DrawText( aPos, aText, nIndex, nTmpEnd - nIndex );
+ nIndex = nTmpEnd;
+ }
+ }
+
+ if ( bVisCursor && ( !mpIMEInfos || mpIMEInfos->bCursor ) )
+ pCursor->Show();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode )
+{
+ XubString aText = ImplGetText();
+
+ // loeschen moeglich?
+ if ( !rSelection.Len() &&
+ (((rSelection.Min() == 0) && (nDirection == EDIT_DEL_LEFT)) ||
+ ((rSelection.Max() == aText.Len()) && (nDirection == EDIT_DEL_RIGHT))) )
+ return;
+
+ long nOldWidth = GetTextWidth( aText );
+ Selection aSelection( rSelection );
+ aSelection.Justify();
+
+ if ( !aSelection.Len() )
+ {
+ uno::Reference < text::XBreakIterator > xBI = ImplGetBreakIterator();
+ if ( nDirection == EDIT_DEL_LEFT )
+ {
+ if ( nMode == EDIT_DELMODE_RESTOFWORD )
+ {
+ text::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Min(), GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
+ if ( aBoundary.startPos == aSelection.Min() )
+ aBoundary = xBI->previousWord( maText, aSelection.Min(), GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aSelection.Min() = aBoundary.startPos;
+ }
+ else if ( nMode == EDIT_DELMODE_RESTOFCONTENT )
+ {
+ aSelection.Min() = 0;
+ }
+ else
+ {
+ sal_Int32 nCount = 1;
+ aSelection.Min() = xBI->previousCharacters( maText, aSelection.Min(), GetSettings().GetLocale(), text::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
+ }
+ }
+ else
+ {
+ if ( nMode == EDIT_DELMODE_RESTOFWORD )
+ {
+ text::Boundary aBoundary = xBI->nextWord( maText, aSelection.Max(), GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aSelection.Max() = aBoundary.startPos;
+ }
+ else if ( nMode == EDIT_DELMODE_RESTOFCONTENT )
+ {
+ aSelection.Max() = aText.Len();
+ }
+ else
+ {
+ sal_Int32 nCount = 1;
+ aSelection.Max() = xBI->nextCharacters( maText, aSelection.Max(), GetSettings().GetLocale(), text::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );;
+ }
+ }
+ }
+
+ maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() );
+ maSelection.Min() = aSelection.Min();
+ maSelection.Max() = aSelection.Min();
+ ImplAlignAndPaint( (xub_StrLen)aSelection.Min(), nOldWidth );
+ mbInternModified = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel )
+{
+ Selection aSelection( maSelection );
+ aSelection.Justify();
+
+ XubString aNewText( rStr );
+ aNewText.EraseAllChars( _LF );
+ aNewText.EraseAllChars( _CR );
+ aNewText.SearchAndReplaceAll( '\t', ' ' );
+
+ if ( (maText.Len() + aNewText.Len() - aSelection.Len()) > mnMaxTextLen )
+ return;
+
+ long nOldWidth = GetTextWidth( ImplGetText() );
+
+ if ( aSelection.Len() )
+ maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() );
+ else if ( !mbInsertMode && (aSelection.Max() < maText.Len()) )
+ maText.Erase( (xub_StrLen)aSelection.Max(), 1 );
+
+ if ( aNewText.Len() )
+ maText.Insert( aNewText, (xub_StrLen)aSelection.Min() );
+
+ if ( !pNewSel )
+ {
+ maSelection.Min() = aSelection.Min() + aNewText.Len();
+ maSelection.Max() = maSelection.Min();
+ }
+ else
+ {
+ maSelection = *pNewSel;
+ if ( maSelection.Min() > maText.Len() )
+ maSelection.Min() = maText.Len();
+ if ( maSelection.Max() > maText.Len() )
+ maSelection.Max() = maText.Len();
+ }
+
+ ImplAlignAndPaint( (xub_StrLen)aSelection.Min(), nOldWidth );
+ mbInternModified = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection )
+{
+ // Der Text wird dadurch geloescht das der alte Text komplett 'selektiert'
+ // wird, dann InsertText, damit flackerfrei.
+ if ( (rText != maText) || (pNewSelection && (*pNewSelection != maSelection)) )
+ {
+ maSelection.Min() = 0;
+ maSelection.Max() = maText.Len();
+ if ( mnXOffset || HasPaintEvent() )
+ {
+ mnXOffset = 0;
+ maText = rText;
+
+ if ( pNewSelection )
+ ImplSetSelection( *pNewSelection, FALSE );
+
+ if ( mnXOffset && !pNewSelection )
+ maSelection.Max() = 0;
+
+ ImplAlign();
+ Invalidate();
+ }
+ else
+ ImplInsertText( rText, pNewSelection );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplClearBackground( long nXStart, long nXEnd )
+{
+ Point aTmpPoint;
+ Rectangle aRect( aTmpPoint, GetOutputSizePixel() );
+ aRect.Left() = nXStart;
+ aRect.Right() = nXEnd;
+
+ Cursor* pCursor = HasFocus() ? GetCursor() : NULL;
+
+ if ( pCursor )
+ pCursor->Hide();
+
+ Erase( aRect );
+
+ if ( pCursor )
+ pCursor->Show();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplShowCursor( BOOL bOnlyIfVisible )
+{
+ if ( !IsUpdateMode() || ( bOnlyIfVisible && !IsReallyVisible() ) )
+ return;
+
+ Cursor* pCursor = GetCursor();
+ XubString aText = ImplGetText();
+ long nTextWidth = GetTextWidth( aText, 0, (xub_StrLen)maSelection.Max() );
+
+ long nCursorWidth = 0;
+ if ( !mbInsertMode && !maSelection.Len() && (maSelection.Max() < aText.Len()) )
+ nCursorWidth = GetTextWidth( aText, (xub_StrLen)maSelection.Max(), 1 );
+ long nCursorPosX = nTextWidth + mnXOffset;
+
+ // Cursor muss im sichtbaren Bereich landen:
+ Size aOutSize = GetOutputSizePixel();
+ if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.Width()) )
+ {
+ long nOldXOffset = mnXOffset;
+
+ if ( nCursorPosX < 0 )
+ {
+ mnXOffset = - nTextWidth;
+ long nMaxX = 0;
+ mnXOffset += aOutSize.Width() / 5;
+ if ( mnXOffset > nMaxX )
+ mnXOffset = nMaxX;
+ }
+ else
+ {
+ mnXOffset = aOutSize.Width() - nTextWidth;
+ // Etwas mehr?
+ if ( aOutSize.Width() < nTextWidth )
+ {
+ long nMaxNegX = aOutSize.Width() - GetTextWidth( aText );
+ mnXOffset -= aOutSize.Width() / 5;
+ if ( mnXOffset < nMaxNegX ) // beides negativ...
+ mnXOffset = nMaxNegX;
+ }
+ }
+
+ nCursorPosX = nTextWidth + mnXOffset;
+ if ( nCursorPosX == aOutSize.Width() ) // dann nicht sichtbar...
+ nCursorPosX--;
+
+ if ( mnXOffset != nOldXOffset )
+ ImplRepaint();
+ }
+
+ long nTextHeight = GetTextHeight();
+ long nCursorPosY = (aOutSize.Height()-nTextHeight) / 2;
+ pCursor->SetPos( Point( nCursorPosX, nCursorPosY ) );
+ pCursor->SetSize( Size( nCursorWidth, nTextHeight ) );
+ pCursor->Show();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplAlign()
+{
+ if ( mnAlign == EDIT_ALIGN_LEFT )
+ return;
+
+ long nTextWidth = GetTextWidth( ImplGetText() );
+ long nOutWidth = GetOutputSizePixel().Width();
+
+ if ( mnAlign == EDIT_ALIGN_RIGHT )
+ {
+ long nMinXOffset = nOutWidth - nTextWidth;
+ if ( mnXOffset < nMinXOffset )
+ mnXOffset = nMinXOffset;
+ }
+ else if( mnAlign == EDIT_ALIGN_CENTER )
+ {
+ // Mit Abfrage schoener, wenn gescrollt, dann aber nicht zentriert im gescrollten Zustand...
+// if ( nTextWidth < nOutWidth )
+ mnXOffset = (nOutWidth - nTextWidth) / 2;
+ }
+}
+
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplAlignAndPaint( xub_StrLen nChangedFrom, long nOldWidth )
+{
+ long nNewWidth = GetTextWidth( ImplGetText() );
+ xub_StrLen nPaintStart = nChangedFrom;
+
+ ImplAlign();
+ if ( mnAlign == EDIT_ALIGN_LEFT )
+ {
+ if ( nOldWidth > nNewWidth )
+ ImplClearBackground( nNewWidth+mnXOffset, nOldWidth+mnXOffset );
+ }
+ else if ( mnAlign == EDIT_ALIGN_RIGHT )
+ {
+ nPaintStart = 0;
+ ImplClearBackground( GetOutputSizePixel().Width()-Max( nOldWidth, nNewWidth )-1, mnXOffset+1 );
+ }
+ else // EDIT_ALIGN_CENTER
+ {
+ nPaintStart = 0;
+ ImplClearBackground( 0, mnXOffset + 1 );
+ ImplClearBackground( mnXOffset+nNewWidth-1, GetOutputSizePixel().Width() );
+ }
+
+ ImplRepaint( nPaintStart, STRING_LEN );
+ ImplShowCursor();
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen Edit::ImplGetCharPos( const Point& rWindowPos )
+{
+ return GetTextBreak( ImplGetText(), rWindowPos.X() - mnXOffset );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplSetCursorPos( xub_StrLen nChar, BOOL bSelect )
+{
+ Selection aSelection( maSelection );
+ aSelection.Max() = nChar;
+ if ( !bSelect )
+ aSelection.Min() = aSelection.Max();
+ ImplSetSelection( aSelection );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ xub_StrLen nTextLength = ReadShortRes();
+ if ( nTextLength )
+ SetMaxTextLen( nTextLength );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( mpSubEdit )
+ {
+ Control::MouseButtonDown( rMEvt );
+ return;
+ }
+
+ xub_StrLen nChar = ImplGetCharPos( rMEvt.GetPosPixel() );
+ Selection aSelection( maSelection );
+ aSelection.Justify();
+
+ if ( rMEvt.GetClicks() < 4 )
+ {
+ mbClickedInSelection = FALSE;
+ if ( rMEvt.GetClicks() == 3 )
+ ImplSetSelection( Selection( 0, 0xFFFF ) );
+ else if ( rMEvt.GetClicks() == 2 )
+ {
+ uno::Reference < text::XBreakIterator > xBI = ImplGetBreakIterator();
+ text::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Max(), GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
+ ImplSetSelection( Selection( aBoundary.startPos, aBoundary.endPos ) );
+ }
+ else if ( !rMEvt.IsShift() && HasFocus() && aSelection.IsInside( nChar ) )
+ mbClickedInSelection = TRUE;
+ else if ( rMEvt.IsLeft() )
+ ImplSetCursorPos( nChar, rMEvt.IsShift() );
+
+ if ( !mbClickedInSelection && rMEvt.IsLeft() && ( rMEvt.GetClicks() == 1 ) )
+ StartTracking( STARTTRACK_SCROLLREPEAT );
+ }
+
+ mbInMBDown = TRUE; // Dann im GetFocus nicht alles selektieren
+ GrabFocus();
+ mbInMBDown = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( mbClickedInSelection && rMEvt.IsLeft() )
+ {
+ xub_StrLen nChar = ImplGetCharPos( rMEvt.GetPosPixel() );
+ ImplSetCursorPos( nChar, FALSE );
+ mbClickedInSelection = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( mbClickedInSelection )
+ {
+ xub_StrLen nChar = ImplGetCharPos( rTEvt.GetMouseEvent().GetPosPixel() );
+ ImplSetCursorPos( nChar, FALSE );
+ mbClickedInSelection = FALSE;
+ }
+ }
+ else
+ {
+ if( !mbClickedInSelection )
+ {
+ xub_StrLen nChar = ImplGetCharPos( rTEvt.GetMouseEvent().GetPosPixel() );
+ ImplSetCursorPos( nChar, TRUE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
+{
+ BOOL bDone = FALSE;
+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
+ KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
+
+ mbInternModified = FALSE;
+
+ if ( eFunc != KEYFUNC_DONTKNOW )
+ {
+ switch ( eFunc )
+ {
+ case KEYFUNC_CUT:
+ {
+ if ( !mbReadOnly && maSelection.Len() && !(GetStyle() & WB_PASSWORD) )
+ {
+ Cut();
+ ImplModified();
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEYFUNC_COPY:
+ {
+ if ( !(GetStyle() & WB_PASSWORD) )
+ {
+ Copy();
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEYFUNC_PASTE:
+ {
+ if ( !mbReadOnly )
+ {
+ Paste();
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEYFUNC_UNDO:
+ {
+ if ( !mbReadOnly )
+ {
+ Undo();
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ default: // wird dann evtl. unten bearbeitet.
+ eFunc = KEYFUNC_DONTKNOW;
+ }
+ }
+
+ if ( eFunc == KEYFUNC_DONTKNOW )
+ {
+ switch ( nCode )
+ {
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_HOME:
+ case KEY_END:
+ {
+ if ( !rKEvt.GetKeyCode().IsMod2() )
+ {
+ uno::Reference < text::XBreakIterator > xBI = ImplGetBreakIterator();
+
+ Selection aSel( maSelection );
+ BOOL bWord = rKEvt.GetKeyCode().IsMod1();
+ // Range wird in ImplSetSelection geprueft...
+ if ( ( nCode == KEY_LEFT ) && aSel.Max() )
+ {
+ if ( bWord )
+ {
+ text::Boundary aBoundary = xBI->getWordBoundary( maText, aSel.Max(), GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
+ if ( aBoundary.startPos == aSel.Max() )
+ aBoundary = xBI->previousWord( maText, aSel.Max(), GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aSel.Max() = aBoundary.startPos;
+ }
+ else
+ {
+ sal_Int32 nCount = 1;
+ aSel.Max() = xBI->previousCharacters( maText, aSel.Max(), GetSettings().GetLocale(), text::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
+ }
+ }
+ else if ( ( nCode == KEY_RIGHT ) && ( aSel.Max() < maText.Len() ) )
+ {
+ if ( bWord )
+ {
+ text::Boundary aBoundary = xBI->nextWord( maText, aSel.Max(), GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ aSel.Max() = aBoundary.startPos;
+ }
+ else
+ {
+ sal_Int32 nCount = 1;
+ aSel.Max() = xBI->nextCharacters( maText, aSel.Max(), GetSettings().GetLocale(), text::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
+ }
+ }
+ else if ( nCode == KEY_HOME )
+ aSel.Max() = 0;
+ else if ( nCode == KEY_END )
+ aSel.Max() = 0xFFFF;
+
+ if ( !rKEvt.GetKeyCode().IsShift() )
+ aSel.Min() = aSel.Max();
+
+ ImplSetSelection( aSel );
+
+ if ( (nCode == KEY_END) && maAutocompleteHdl.IsSet() && !rKEvt.GetKeyCode().GetModifier() )
+ {
+ if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.Len()) )
+ {
+ meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
+ maAutocompleteHdl.Call( this );
+ }
+ }
+
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_BACKSPACE:
+ case KEY_DELETE:
+ {
+ if ( !mbReadOnly && !rKEvt.GetKeyCode().IsMod2() )
+ {
+ BYTE nDel = (nCode == KEY_DELETE) ? EDIT_DEL_RIGHT : EDIT_DEL_LEFT;
+ BYTE nMode = rKEvt.GetKeyCode().IsMod1() ? EDIT_DELMODE_RESTOFWORD : EDIT_DELMODE_SIMPLE;
+ if ( (nMode == EDIT_DELMODE_RESTOFWORD) && rKEvt.GetKeyCode().IsShift() )
+ nMode = EDIT_DELMODE_RESTOFCONTENT;
+ xub_StrLen nOldLen = maText.Len();
+ ImplDelete( maSelection, nDel, nMode );
+ if ( maText.Len() != nOldLen )
+ ImplModified();
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_INSERT:
+ {
+ if ( !mbReadOnly && !rKEvt.GetKeyCode().IsMod2() )
+ {
+ SetInsertMode( !mbInsertMode );
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_TAB:
+ {
+ if ( !mbReadOnly && maAutocompleteHdl.IsSet() &&
+ maSelection.Min() && (maSelection.Min() == maText.Len()) &&
+ !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2() )
+ {
+ // Kein Autocomplete wenn alles Selektiert oder Edit leer, weil dann
+ // keine vernuenftige Tab-Steuerung!
+ if ( rKEvt.GetKeyCode().IsShift() )
+ meAutocompleteAction = AUTOCOMPLETE_TABBACKWARD;
+ else
+ meAutocompleteAction = AUTOCOMPLETE_TABFORWARD;
+
+ maAutocompleteHdl.Call( this );
+
+ // Wurde nichts veraendert, dann TAB fuer DialogControl
+ if ( GetSelection().Len() )
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ default:
+ {
+ if ( IsCharInput( rKEvt ) )
+ {
+ bDone = TRUE; // Auch bei ReadOnly die Zeichen schlucken.
+ if ( !mbReadOnly )
+ {
+ ImplInsertText( rKEvt.GetCharCode() );
+ if ( maAutocompleteHdl.IsSet() )
+ {
+ if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.Len()) )
+ {
+ meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
+ maAutocompleteHdl.Call( this );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if ( !bDone && rKEvt.GetKeyCode().IsMod1() )
+ {
+ if ( nCode == KEY_A )
+ {
+ ImplSetSelection( Selection( 0, maText.Len() ) );
+ bDone = TRUE;
+ }
+ else if ( rKEvt.GetKeyCode().IsShift() && (nCode == KEY_S) )
+ {
+ if ( pImplFncGetSpecialChars )
+ {
+ Selection aSaveSel = GetSelection(); // Falls jemand in Get/LoseFocus die Selektion verbiegt, z.B. URL-Zeile...
+ XubString aChars = pImplFncGetSpecialChars( this, GetFont() );
+ SetSelection( aSaveSel );
+ if ( aChars.Len() )
+ {
+ ImplInsertText( aChars );
+ ImplModified();
+ }
+ bDone = TRUE;
+ }
+ }
+ }
+
+ if ( mbInternModified )
+ ImplModified();
+
+ return bDone;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( mpSubEdit || !ImplHandleKeyEvent( rKEvt ) )
+ Control::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Paint( const Rectangle& )
+{
+ if ( !mpSubEdit )
+ ImplRepaint();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Resize()
+{
+ if ( !mpSubEdit && IsReallyVisible() )
+ {
+ // Wegen vertikaler Zentrierung...
+ mnXOffset = 0;
+ ImplAlign();
+ Invalidate();
+ ImplShowCursor();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ ImplInitSettings( TRUE, TRUE, TRUE );
+
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Font aFont = GetDrawPixelFont( pDev );
+ OutDevType eOutDevType = pDev->GetOutDevType();
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ pDev->SetTextFillColor();
+
+ // Border/Background
+ pDev->SetLineColor();
+ pDev->SetFillColor();
+ BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER);
+ BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground();
+ if ( bBorder || bBackground )
+ {
+ Rectangle aRect( aPos, aSize );
+ if ( bBorder )
+ {
+ DecorationView aDecoView( pDev );
+ aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+ }
+ if ( bBackground )
+ {
+ pDev->SetFillColor( GetControlBackground() );
+ pDev->DrawRect( aRect );
+ }
+ }
+
+ // Inhalt
+ if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ {
+ if ( !(nFlags & WINDOW_DRAW_NODISABLE ) && !IsEnabled() )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ pDev->SetTextColor( rStyleSettings.GetDisableColor() );
+ }
+ else
+ {
+ pDev->SetTextColor( GetTextColor() );
+ }
+ }
+
+ XubString aText = ImplGetText();
+ long nTextHeight = pDev->GetTextHeight();
+ long nTextWidth = pDev->GetTextWidth( aText );
+ long nOnePixel = GetDrawPixel( pDev, 1 );
+ long nOffX = 3*nOnePixel;
+ long nOffY = (aSize.Height() - nTextHeight) / 2;
+
+ if ( GetStyle() & WB_CENTER )
+ {
+ aPos.X() += (aSize.Width() - nTextWidth) / 2;
+ nOffX = 0;
+ }
+ else if ( GetStyle() & WB_RIGHT )
+ {
+ aPos.X() += aSize.Width() - nTextWidth;
+ nOffX = -nOffX;
+ }
+
+ // Clipping?
+ if ( (nOffY < 0) ||
+ ((nOffY+nTextHeight) > aSize.Height()) ||
+ ((nOffX+nTextWidth) > aSize.Width()) )
+ {
+ Rectangle aClip( aPos, aSize );
+ if ( nTextHeight > aSize.Height() )
+ aClip.Bottom() += nTextHeight-aSize.Height()+1; // Damit HP-Drucker nicht 'weg-optimieren'
+ pDev->IntersectClipRegion( aClip );
+ }
+
+ pDev->DrawText( Point( aPos.X() + nOffX, aPos.Y() + nOffY ), aText );
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::GetFocus()
+{
+ if ( mpSubEdit )
+ mpSubEdit->ImplGrabFocus( GetGetFocusFlags() );
+ else if ( !mbActivePopup )
+ {
+ maUndoText = maText;
+
+ ULONG nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions();
+ if ( !( GetStyle() & (WB_NOHIDESELECTION|WB_READONLY) )
+ && ( GetGetFocusFlags() & (GETFOCUS_INIT|GETFOCUS_TAB|GETFOCUS_CURSOR|GETFOCUS_MNEMONIC) ) )
+ {
+ if ( nSelOptions & SELECTION_OPTION_SHOWFIRST )
+ {
+ maSelection.Min() = maText.Len();
+ maSelection.Max() = 0;
+ }
+ else
+ {
+ maSelection.Min() = 0;
+ maSelection.Max() = maText.Len();
+ }
+ }
+
+ ImplShowCursor();
+
+ if ( maSelection.Len() )
+ {
+ // Selektion malen
+ if ( !HasPaintEvent() )
+ ImplRepaint();
+ else
+ Invalidate();
+ }
+
+ SetInputContext( InputContext( GetFont(), TRUE ) );
+ }
+
+ Control::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::LoseFocus()
+{
+ if ( !mpSubEdit )
+ {
+ if ( !mbActivePopup && !( GetStyle() & WB_NOHIDESELECTION ) && maSelection.Len() )
+ ImplRepaint(); // Selektion malen
+ }
+
+ Control::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Command( const CommandEvent& rCEvt )
+{
+ if ( (rCEvt.GetCommand() == COMMAND_STARTDRAG) &&
+ !IsTracking() && maSelection.Len() &&
+ !(GetStyle() & WB_PASSWORD) &&
+ (!mpDDInfo || mpDDInfo->bStarterOfDD == FALSE) ) // Kein Mehrfach D&D
+ {
+ Selection aSel( maSelection );
+ aSel.Justify();
+
+ // Nur wenn Maus in der Selektion...
+ xub_StrLen nChar = ImplGetCharPos( rCEvt.GetMousePosPixel() );
+ if ( (nChar >= aSel.Min()) && (nChar < aSel.Max()) )
+ {
+ if ( !mpDDInfo )
+ mpDDInfo = new DDInfo;
+
+ mpDDInfo->bStarterOfDD = TRUE;
+
+ Region* pDDRegion = NULL;
+ Cursor* pCursor = GetCursor();
+ if ( pCursor )
+ pCursor->Hide();
+
+ SotDataObjectRef xData = new StringDataObject( GetSelected() );
+ if ( IsTracking() )
+ EndTracking(); // Vor D&D Tracking ausschalten
+ DropAction aAction = DragManager::ExecuteDrag( xData, DRAG_ALL );
+
+ if ( aAction == DROP_MOVE )
+ {
+ if ( mpDDInfo->bDroppedInMe )
+ {
+ if ( aSel.Max() > mpDDInfo->nDropPos )
+ {
+ long nLen = aSel.Len();
+ aSel.Min() += nLen;
+ aSel.Max() += nLen;
+ }
+ }
+ ImplDelete( aSel, EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
+ ImplModified();
+ }
+
+ ImplHideDDCursor();
+ delete mpDDInfo;
+ mpDDInfo = 0;
+ }
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ PopupMenu* pPopup = Edit::CreatePopupMenu();
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED )
+ pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES );
+
+ if ( !maSelection.Len() )
+ {
+ pPopup->EnableItem( SV_MENU_EDIT_CUT, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_COPY, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_DELETE, FALSE );
+ }
+
+ if ( IsReadOnly() )
+ {
+ pPopup->EnableItem( SV_MENU_EDIT_CUT, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_PASTE, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_DELETE, FALSE );
+ pPopup->EnableItem( SV_MENU_EDIT_INSERTSYMBOL, FALSE );
+ }
+ else
+ {
+ // Paste nur, wenn Text im Clipboard
+ if ( !VclClipboard::HasFormat( FORMAT_STRING ) )
+ pPopup->EnableItem( SV_MENU_EDIT_PASTE, FALSE );
+ }
+
+ if ( maUndoText == maText )
+ pPopup->EnableItem( SV_MENU_EDIT_UNDO, FALSE );
+ if ( ( maSelection.Min() == 0 ) && ( maSelection.Max() == maText.Len() ) )
+ pPopup->EnableItem( SV_MENU_EDIT_SELECTALL, FALSE );
+ if ( !pImplFncGetSpecialChars )
+ {
+ USHORT nPos = pPopup->GetItemPos( SV_MENU_EDIT_INSERTSYMBOL );
+ pPopup->RemoveItem( nPos );
+ pPopup->RemoveItem( nPos-1 );
+ }
+
+ mbActivePopup = TRUE;
+ Selection aSaveSel = GetSelection(); // Falls jemand in Get/LoseFocus die Selektion verbiegt, z.B. URL-Zeile...
+ Point aPos = rCEvt.GetMousePosPixel();
+ if ( !rCEvt.IsMouseEvent() )
+ {
+ // !!! Irgendwann einmal Menu zentriert in der Selektion anzeigen !!!
+ Size aSize = GetOutputSizePixel();
+ aPos = Point( aSize.Width()/2, aSize.Height()/2 );
+ }
+ USHORT n = pPopup->Execute( this, aPos );
+ Edit::DeletePopupMenu( pPopup );
+ SetSelection( aSaveSel );
+ switch ( n )
+ {
+ case SV_MENU_EDIT_UNDO:
+ Undo();
+ ImplModified();
+ break;
+ case SV_MENU_EDIT_CUT:
+ Cut();
+ ImplModified();
+ break;
+ case SV_MENU_EDIT_COPY:
+ Copy();
+ break;
+ case SV_MENU_EDIT_PASTE:
+ Paste();
+ ImplModified();
+ break;
+ case SV_MENU_EDIT_DELETE:
+ DeleteSelected();
+ ImplModified();
+ break;
+ case SV_MENU_EDIT_SELECTALL:
+ ImplSetSelection( Selection( 0, maText.Len() ) );
+ break;
+ case SV_MENU_EDIT_INSERTSYMBOL:
+ {
+ XubString aChars = pImplFncGetSpecialChars( this, GetFont() );
+ SetSelection( aSaveSel );
+ if ( aChars.Len() )
+ {
+ ImplInsertText( aChars );
+ ImplModified();
+ }
+ }
+ break;
+ }
+ mbActivePopup = FALSE;
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_VOICE )
+ {
+ const CommandVoiceData* pData = rCEvt.GetVoiceData();
+ if ( pData->GetType() == VOICECOMMANDTYPE_DICTATION )
+ {
+ switch ( pData->GetCommand() )
+ {
+ case DICTATIONCOMMAND_UNKNOWN:
+ {
+ ReplaceSelected( pData->GetText() );
+ }
+ break;
+ case DICTATIONCOMMAND_LEFT:
+ {
+ ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1 ) ) );
+ }
+ break;
+ case DICTATIONCOMMAND_RIGHT:
+ {
+ ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_RIGHT, KEY_MOD1 ) ) );
+ }
+ break;
+ case DICTATIONCOMMAND_UNDO:
+ {
+ Undo();
+ }
+ break;
+ case DICTATIONCOMMAND_DEL:
+ {
+ ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1|KEY_SHIFT ) ) );
+ DeleteSelected();
+ }
+ break;
+ }
+ }
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT )
+ {
+ DeleteSelected();
+ delete mpIMEInfos;
+ mpIMEInfos = new Impl_IMEInfos( (xub_StrLen)maSelection.Max() );
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT )
+ {
+ delete mpIMEInfos;
+ mpIMEInfos = NULL;
+ // Font wieder ohne Attribute einstellen, wird jetzt im Repaint nicht
+ // mehr neu initialisiert
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT )
+ {
+ const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData();
+
+ maText.Erase( mpIMEInfos->nPos, mpIMEInfos->nLen );
+ maText.Insert( pData->GetText(), mpIMEInfos->nPos );
+
+ if ( pData->GetTextAttr() )
+ {
+ mpIMEInfos->CopyAttribs( pData->GetTextAttr(), pData->GetText().Len() );
+ mpIMEInfos->bCursor = pData->IsCursorVisible();
+ }
+ else
+ {
+ mpIMEInfos->DestroyAttribs();
+ }
+
+ Invalidate(); // Erstmal einfach zum Testen
+ xub_StrLen nCursorPos = mpIMEInfos->nPos + pData->GetCursorPos();
+ SetSelection( Selection( nCursorPos, nCursorPos ) );
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUTPOS )
+ {
+ XubString aText( maText, mpIMEInfos->nPos, mpIMEInfos->nLen );
+ if ( aText.Len() )
+ {
+ const CommandExtTextInputPosData* pData = rCEvt.GetExtTextInputPosData();
+
+ xub_StrLen nChars = aText.Len();
+ Rectangle* pRects = new Rectangle[nChars];
+ long* pDXArr = new long[nChars];
+ long nTextHeight = GetTextHeight();
+ long nTop = (GetOutputSize().Height()-nTextHeight)/2;
+ long nBottom = nTop + nTextHeight;
+ long nX = mnXOffset;
+
+ GetTextArray( aText, pDXArr );
+ if ( mpIMEInfos->nPos )
+ nX += GetTextWidth( XubString( maText, 0, mpIMEInfos->nPos ) );
+
+ for ( xub_StrLen n = 0; n < nChars; n++ )
+ {
+ pRects[n].Top() = nTop;
+ pRects[n].Bottom() = nBottom;
+ pRects[n].Left() = nX + (n ? pDXArr[ n-1 ] : 0);
+ pRects[n].Right() = nX + pDXArr[n];
+ }
+ SetExtTextInputPos( 0, nChars, pRects );
+ delete pRects;
+ delete pDXArr;
+ }
+ else
+ SetExtTextInputPos( 0, 0, NULL );
+ }
+ else
+ Control::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ if ( !mpSubEdit )
+ {
+ mnXOffset = 0; // Falls vorher GrabFocus, als Groesse noch falsch.
+ ImplAlign();
+ if ( !mpSubEdit )
+ ImplShowCursor( FALSE );
+ }
+ }
+ else if ( nType == STATE_CHANGE_ENABLE )
+ {
+ if ( !mpSubEdit )
+ {
+ // Es aendert sich nur die Textfarbe...
+ ImplRepaint( 0, 0xFFFF );
+ }
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ WinBits nStyle = ImplInitStyle( GetStyle() );
+ SetStyle( nStyle );
+
+ USHORT nOldAlign = mnAlign;
+ mnAlign = EDIT_ALIGN_LEFT;
+ if ( nStyle & WB_RIGHT )
+ mnAlign = EDIT_ALIGN_RIGHT;
+ else if ( nStyle & WB_CENTER )
+ mnAlign = EDIT_ALIGN_CENTER;
+ if ( maText.Len() && ( mnAlign != nOldAlign ) )
+ {
+ ImplAlign();
+ Invalidate();
+ }
+
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ if ( !mpSubEdit )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ ImplShowCursor( TRUE );
+ Invalidate();
+ }
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ if ( !mpSubEdit )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ ImplShowCursor();
+ Invalidate();
+ }
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ if ( !mpSubEdit )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ if ( !mpSubEdit )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+ }
+
+ Control::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ if ( !mpSubEdit )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ ImplShowCursor( TRUE );
+ Invalidate();
+ }
+ }
+
+ Control::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplShowDDCursor()
+{
+ if ( !mpDDInfo->bVisCursor )
+ {
+ long nTextWidth = GetTextWidth( maText, 0, mpDDInfo->nDropPos );
+ long nTextHeight = GetTextHeight();
+ Rectangle aCursorRect( Point( nTextWidth + mnXOffset, (GetOutputSize().Height()-nTextHeight)/2 ), Size( 2, nTextHeight ) );
+ mpDDInfo->aCursor.SetWindow( this );
+ mpDDInfo->aCursor.SetPos( aCursorRect.TopLeft() );
+ mpDDInfo->aCursor.SetSize( aCursorRect.GetSize() );
+ mpDDInfo->aCursor.Show();
+ mpDDInfo->bVisCursor = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplHideDDCursor()
+{
+ if ( mpDDInfo && mpDDInfo->bVisCursor )
+ {
+ mpDDInfo->aCursor.Hide();
+ mpDDInfo->bVisCursor = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Edit::QueryDrop( DropEvent& rDEvt )
+{
+ if ( rDEvt.IsLeaveWindow() )
+ {
+ ImplHideDDCursor();
+ return FALSE;
+ }
+
+ // Daten holen
+ SotDataObjectRef xDataObj = ((DropEvent&)rDEvt).GetData();
+ BOOL bString = xDataObj.Is() && NULL != xDataObj->GetTypeList().Get( FORMAT_STRING );
+
+ BOOL bDrop = FALSE;
+ if ( !mbReadOnly && bString &&
+ ( ( rDEvt.GetAction() == DROP_COPY ) || ( rDEvt.GetAction() == DROP_MOVE ) || ( rDEvt.GetAction() == DROP_LINK ) ) )
+ {
+ if ( !mpDDInfo )
+ mpDDInfo = new DDInfo;
+
+ Point aMousePos( rDEvt.GetPosPixel() );
+
+ xub_StrLen nPrevDropPos = mpDDInfo->nDropPos;
+ mpDDInfo->nDropPos = ImplGetCharPos( aMousePos );
+
+ Size aOutSize = GetOutputSizePixel();
+ if ( ( aMousePos.X() < 0 ) || ( aMousePos.X() > aOutSize.Width() ) )
+ {
+ // Scrollen ?
+ }
+
+ Selection aSel( maSelection );
+ aSel.Justify();
+
+ // Nicht in Selektion droppen:
+ if ( aSel.IsInside( mpDDInfo->nDropPos ) )
+ {
+ ImplHideDDCursor();
+ return FALSE;
+ }
+
+ // Alten Cursor wegzeichnen...
+ if ( !mpDDInfo->bVisCursor || ( nPrevDropPos != mpDDInfo->nDropPos ) )
+ {
+ ImplHideDDCursor();
+ ImplShowDDCursor();
+ }
+ bDrop = TRUE;
+ }
+
+ return bDrop;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Edit::Drop( const DropEvent& rDEvt )
+{
+ mbInternModified = FALSE;
+
+ BOOL bDone = TRUE;
+ if ( !mbReadOnly && mpDDInfo )
+ {
+ ImplHideDDCursor();
+ Point aMousePos( rDEvt.GetPosPixel() );
+
+ Selection aSel( maSelection );
+ aSel.Justify();
+
+ if ( aSel.Len() && !mpDDInfo->bStarterOfDD )
+ ImplDelete( aSel, EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
+
+ mpDDInfo->bDroppedInMe = TRUE;
+
+ aSel.Min() = mpDDInfo->nDropPos;
+ aSel.Max() = mpDDInfo->nDropPos;
+ ImplSetSelection( aSel );
+
+ // Daten holen
+ SotDataObjectRef xDataObj = ((DropEvent&)rDEvt).GetData();
+ SvData aData( FORMAT_STRING );
+ if( xDataObj->GetData( &aData ) )
+ {
+ XubString aStr;
+ aData.GetData( aStr );
+ ImplInsertText( aStr );
+ }
+
+ if ( !mpDDInfo->bStarterOfDD )
+ {
+ delete mpDDInfo;
+ mpDDInfo = 0;
+ }
+ }
+
+ if ( mbInternModified )
+ ImplModified();
+
+ return bDone;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Modify()
+{
+ if ( mbIsSubEdit )
+ {
+ ((Edit*)GetParent())->Modify();
+ }
+ else
+ {
+ if ( mpUpdateDataTimer )
+ mpUpdateDataTimer->Start();
+
+ maModifyHdl.Call( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::UpdateData()
+{
+ maUpdateDataHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Edit, ImplUpdateDataHdl, Timer*, EMPTYARG )
+{
+ UpdateData();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::EnableUpdateData( ULONG nTimeout )
+{
+ if ( !nTimeout )
+ DisableUpdateData();
+ else
+ {
+ if ( !mpUpdateDataTimer )
+ {
+ mpUpdateDataTimer = new Timer;
+ mpUpdateDataTimer->SetTimeoutHdl( LINK( this, Edit, ImplUpdateDataHdl ) );
+ }
+
+ mpUpdateDataTimer->SetTimeout( nTimeout );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetEchoChar( xub_Unicode c )
+{
+ mcEchoChar = c;
+ if ( mpSubEdit )
+ mpSubEdit->SetEchoChar( c );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetReadOnly( BOOL bReadOnly )
+{
+ if ( mbReadOnly != bReadOnly )
+ {
+ mbReadOnly = bReadOnly;
+ if ( mpSubEdit )
+ mpSubEdit->SetReadOnly( bReadOnly );
+
+ StateChanged( STATE_CHANGE_READONLY );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetAutocompleteHdl( const Link& rHdl )
+{
+ maAutocompleteHdl = rHdl;
+ if ( mpSubEdit )
+ mpSubEdit->SetAutocompleteHdl( rHdl );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetInsertMode( BOOL bInsert )
+{
+ if ( bInsert != mbInsertMode )
+ {
+ mbInsertMode = bInsert;
+ if ( mpSubEdit )
+ mpSubEdit->SetInsertMode( bInsert );
+ else
+ ImplShowCursor();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Edit::IsInsertMode() const
+{
+ if ( mpSubEdit )
+ return mpSubEdit->IsInsertMode();
+ else
+ return mbInsertMode;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetMaxTextLen( xub_StrLen nMaxLen )
+{
+ mnMaxTextLen = nMaxLen ? nMaxLen : EDIT_NOLIMIT;
+
+ if ( mpSubEdit )
+ mpSubEdit->SetMaxTextLen( nMaxLen );
+ else
+ {
+ if ( maText.Len() > nMaxLen )
+ ImplDelete( Selection( nMaxLen, maText.Len() ), EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetSelection( const Selection& rSelection )
+{
+ // Wenn von aussen z.B. im MouseButtonDown die Selektion geaendert wird,
+ // soll nicht gleich ein Tracking() zuschlagen und die Selektion aendern.
+ if ( IsTracking() )
+ EndTracking();
+ else if ( mpSubEdit && mpSubEdit->IsTracking() )
+ mpSubEdit->EndTracking();
+
+ ImplSetSelection( rSelection );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ImplSetSelection( const Selection& rSelection, BOOL bPaint )
+{
+ if ( mpSubEdit )
+ mpSubEdit->ImplSetSelection( rSelection );
+ else
+ {
+ if ( rSelection != maSelection )
+ {
+ Selection aOld( maSelection );
+ Selection aNew( rSelection );
+
+ if ( aNew.Min() > maText.Len() )
+ aNew.Min() = maText.Len();
+ if ( aNew.Max() > maText.Len() )
+ aNew.Max() = maText.Len();
+ if ( aNew.Min() < 0 )
+ aNew.Min() = 0;
+ if ( aNew.Max() < 0 )
+ aNew.Max() = 0;
+
+ if ( aNew != maSelection )
+ {
+ maSelection = aNew;
+
+ if ( bPaint && ( aOld.Len() || aNew.Len() ) )
+ {
+ aOld.Justify();
+ aNew.Justify();
+ xub_StrLen nStart = (xub_StrLen)Min( aOld.Min(), aNew.Min() );
+ xub_StrLen nEnd = (xub_StrLen)Max( aOld.Max(), aNew.Max() );
+ ImplRepaint( nStart, nEnd );
+ }
+ ImplShowCursor();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const Selection& Edit::GetSelection() const
+{
+ if ( mpSubEdit )
+ return mpSubEdit->GetSelection();
+ else
+ return maSelection;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ReplaceSelected( const XubString& rStr )
+{
+ if ( mpSubEdit )
+ mpSubEdit->ReplaceSelected( rStr );
+ else
+ ImplInsertText( rStr );
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::DeleteSelected()
+{
+ if ( mpSubEdit )
+ mpSubEdit->DeleteSelected();
+ else
+ {
+ if ( maSelection.Len() )
+ ImplDelete( maSelection, EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString Edit::GetSelected() const
+{
+ if ( mpSubEdit )
+ return mpSubEdit->GetSelected();
+ else
+ {
+ Selection aSelection( maSelection );
+ aSelection.Justify();
+ return maText.Copy( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Cut()
+{
+ if ( !(GetStyle() & WB_PASSWORD ) )
+ {
+ Copy();
+ ReplaceSelected( ImplGetSVEmptyStr() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Copy()
+{
+ if ( !(GetStyle() & WB_PASSWORD ) )
+ {
+ SotDataObjectRef xData = new StringDataObject( GetSelected() );
+ VclClipboard::Copy( xData );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Paste()
+{
+ // Daten holen
+ SotDataObjectRef xDataObj = VclClipboard::Paste();
+ SvData aData( FORMAT_STRING );
+ if( xDataObj.Is() && xDataObj->GetData( &aData ) )
+ {
+ XubString aStr;
+ aData.GetData( aStr );
+ ReplaceSelected( aStr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::Undo()
+{
+ if ( mpSubEdit )
+ mpSubEdit->Undo();
+ else
+ {
+ XubString aText( maText );
+ ImplDelete( Selection( 0, aText.Len() ), EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
+ ImplInsertText( maUndoText );
+ ImplSetSelection( Selection( 0, maUndoText.Len() ) );
+ maUndoText = aText;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetText( const XubString& rStr )
+{
+ if ( mpSubEdit )
+ mpSubEdit->SetText( rStr ); // Nicht direkt ImplSetText, falls SetText ueberladen
+ else
+ {
+ Selection aNewSel( 0, 0 ); // Damit nicht gescrollt wird
+ ImplSetText( rStr, &aNewSel );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetText( const XubString& rStr, const Selection& rSelection )
+{
+ if ( mpSubEdit )
+ mpSubEdit->SetText( rStr, rSelection );
+ else
+ ImplSetText( rStr, &rSelection );
+}
+
+// -----------------------------------------------------------------------
+
+XubString Edit::GetText() const
+{
+ if ( mpSubEdit )
+ return mpSubEdit->GetText();
+ else
+ return maText;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetModifyFlag()
+{
+ if ( mpSubEdit )
+ mpSubEdit->mbModified = TRUE;
+ else
+ mbModified = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::ClearModifyFlag()
+{
+ if ( mpSubEdit )
+ mpSubEdit->mbModified = FALSE;
+ else
+ mbModified = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetSubEdit( Edit* pEdit )
+{
+ mpSubEdit = pEdit;
+ if ( mpSubEdit )
+ {
+ SetPointer( POINTER_ARROW ); // Nur das SubEdit hat den BEAM...
+ mpSubEdit->mbIsSubEdit = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size Edit::CalcMinimumSize() const
+{
+ Size aSz( GetTextWidth( GetText() ), GetTextHeight() );
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Size Edit::CalcSize( xub_StrLen nChars ) const
+{
+ // Breite fuer n Zeichen, unabhaengig vom Inhalt.
+ // Funktioniert nur bei FixedFont richtig, sonst Mittelwert.
+ Size aSz( GetTextWidth( XubString( 'x' ) ), GetTextHeight() );
+ aSz.Width() *= nChars;
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen Edit::GetMaxVisChars() const
+{
+ const Window* pW = mpSubEdit ? mpSubEdit : this;
+ long nOutWidth = pW->GetOutputSizePixel().Width();
+ long nCharWidth = GetTextWidth( XubString( 'x' ) );
+ return nCharWidth ? (xub_StrLen)(nOutWidth/nCharWidth) : 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::SetGetSpecialCharsFunction( FncGetSpecialChars fn )
+{
+ pImplFncGetSpecialChars = fn;
+}
+
+// -----------------------------------------------------------------------
+
+FncGetSpecialChars Edit::GetGetSpecialCharsFunction()
+{
+ return pImplFncGetSpecialChars;
+}
+
+// -----------------------------------------------------------------------
+
+PopupMenu* Edit::CreatePopupMenu()
+{
+ PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, ImplGetResMgr() ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, FALSE, TRUE, FALSE ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, TRUE, TRUE, FALSE ) );
+ return pPopup;
+}
+
+// -----------------------------------------------------------------------
+
+void Edit::DeletePopupMenu( PopupMenu* pMenu )
+{
+ delete pMenu;
+}
+
+ImplSubEdit::ImplSubEdit( Edit* pParent, WinBits nStyle ) :
+ Edit( pParent, nStyle )
+{
+ pParent->SetSubEdit( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSubEdit::Modify()
+{
+ GetParent()->Modify();
+}
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
new file mode 100644
index 000000000000..42a30ffd1b5f
--- /dev/null
+++ b/vcl/source/control/field.cxx
@@ -0,0 +1,2330 @@
+/*************************************************************************
+ *
+ * $RCSfile: field.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _TOOLS_BIGINT
+#define _SV_FIELD_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _BIGINT_HXX
+#include <tools/bigint.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#include <field.hxx>
+#include <event.hxx>
+#include <svapp.hxx>
+#include <svdata.hxx>
+
+#pragma hdrstop
+
+// -----------------------------------------------------------------------
+
+#define FORMAT_NUMERIC 1
+#define FORMAT_METRIC 2
+#define FORMAT_CURRENCY 3
+
+// -----------------------------------------------------------------------
+
+static long ImplPower10( USHORT n )
+{
+ USHORT i;
+ long nValue = 1;
+
+ for ( i=0; i < n; i++ )
+ nValue *= 10;
+
+ return nValue;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt,
+ BOOL bStrictFormat,
+ const International& rInter )
+{
+ if ( !bStrictFormat )
+ return FALSE;
+ else
+ {
+ xub_Unicode cChar = rKEvt.GetCharCode();
+ USHORT nGroup = rKEvt.GetKeyCode().GetGroup();
+
+ if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
+ (nGroup == KEYGROUP_MISC) ||
+ ((cChar >= '0') && (cChar <= '9')) ||
+ (rInter.IsNumThousandSep() && (cChar == rInter.GetNumThousandSep())) ||
+ (cChar == rInter.GetNumDecimalSep()) ||
+ (cChar == '-') )
+ return FALSE;
+ else
+ return TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue,
+ USHORT nDecDigits, const International& rInter,
+ BOOL bCurrency = FALSE )
+{
+ XubString aStr = rStr;
+ XubString aStr1;
+ XubString aStr2;
+ BOOL bNegative = FALSE;
+ xub_StrLen nDecPos;
+ xub_StrLen i;
+
+ // Reaktion auf leeren String
+ if ( !rStr.Len() )
+ return FALSE;
+
+ // Fuehrende und nachfolgende Leerzeichen entfernen
+ aStr.EraseLeadingAndTrailingChars( ' ' );
+
+ // Position des Dezimalpunktes suchen
+ nDecPos = aStr.Search( rInter.GetNumDecimalSep() );
+ if ( nDecPos != STRING_NOTFOUND )
+ {
+ aStr1 = aStr.Copy( 0, nDecPos );
+ aStr2 = aStr.Copy( nDecPos+1 );
+ }
+ else
+ aStr1 = aStr;
+
+ // Negativ ?
+ if ( bCurrency )
+ {
+ if ( (aStr.GetChar( 0 ) == '(') && (aStr.GetChar( aStr.Len()-1 ) == ')') )
+ bNegative = TRUE;
+ if ( !bNegative )
+ {
+ for ( i=0; i < aStr.Len(); i++ )
+ {
+ if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
+ break;
+ else if ( aStr.GetChar( i ) == '-' )
+ {
+ bNegative = TRUE;
+ break;
+ }
+ }
+ }
+ if ( !bNegative && bCurrency && aStr.Len() )
+ {
+ USHORT nFormat = rInter.GetCurrNegativeFormat();
+ if ( (nFormat == 3) || (nFormat == 6) ||
+ (nFormat == 7) || (nFormat == 10) )
+ {
+ for ( i = (xub_StrLen)(aStr.Len()-1); i > 0; i++ )
+ {
+ if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
+ break;
+ else if ( aStr.GetChar( i ) == '-' )
+ {
+ bNegative = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( aStr1.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ }
+
+ // Alle unerwuenschten Zeichen rauswerfen
+ for ( i=0; i < aStr1.Len(); )
+ {
+ if ( (aStr1.GetChar( i ) >= '0') && (aStr1.GetChar( i ) <= '9') )
+ i++;
+ else
+ aStr1.Erase( i, 1 );
+ }
+ for ( i=0; i < aStr2.Len(); )
+ {
+ if ( (aStr2.GetChar( i ) >= '0') && (aStr2.GetChar( i ) <= '9') )
+ i++;
+ else
+ aStr2.Erase( i, 1 );
+ }
+
+ if ( !aStr1.Len() && !aStr2.Len() )
+ return FALSE;
+
+ if ( !aStr1.Len() )
+ aStr1.Insert( '0' );
+ if ( bNegative )
+ aStr1.Insert( '-', 0 );
+
+ // Nachkommateil zurechtstutzen und dabei runden
+ BOOL bRound = FALSE;
+ if ( aStr2.Len() > nDecDigits )
+ {
+ if ( aStr2.GetChar( nDecDigits ) >= '5' )
+ bRound = TRUE;
+ aStr2.Erase( nDecDigits );
+ }
+ if ( aStr2.Len() < nDecDigits )
+ aStr2.Expand( nDecDigits, '0' );
+
+ aStr = aStr1;
+ aStr += aStr2;
+
+ // Bereichsueberpruefung
+ double nValue = aStr.ToDouble();
+ if ( bRound )
+ {
+ if ( !bNegative )
+ nValue++;
+ else
+ nValue--;
+ }
+
+ rValue = nValue;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+FormatterBase::FormatterBase( Edit* pField )
+{
+ mpField = pField;
+ mpInternational = NULL;
+ mbReformat = FALSE;
+ mbStrictFormat = FALSE;
+ mbEmptyFieldValue = FALSE;
+ mbEmptyFieldValueEnabled = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+FormatterBase::~FormatterBase()
+{
+ delete mpInternational;
+}
+
+// -----------------------------------------------------------------------
+
+void FormatterBase::Reformat()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FormatterBase::ReformatAll()
+{
+ Reformat();
+};
+
+// -----------------------------------------------------------------------
+
+void FormatterBase::SetStrictFormat( BOOL bStrict )
+{
+ if ( bStrict != mbStrictFormat )
+ {
+ mbStrictFormat = bStrict;
+ if ( mbStrictFormat )
+ ReformatAll();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FormatterBase::SetInternational( const International& rInternational )
+{
+ delete mpInternational;
+ mpInternational = new International( rInternational );
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+const International& FormatterBase::GetInternational() const
+{
+ if ( !mpInternational )
+ {
+ if ( mpField )
+ return mpField->GetSettings().GetInternational();
+ else
+ return Application::GetSettings().GetInternational();
+ }
+
+ return *mpInternational;
+}
+
+// -----------------------------------------------------------------------
+
+const AllSettings& FormatterBase::GetFieldSettings() const
+{
+ if ( mpField )
+ return mpField->GetSettings();
+ else
+ return Application::GetSettings();
+}
+
+// -----------------------------------------------------------------------
+
+void FormatterBase::SetFieldText( const XubString& rText, BOOL bKeepSelection )
+{
+ if ( mpField )
+ {
+ Selection aNewSelection( 0xFFFF, 0xFFFF );
+ if ( bKeepSelection )
+ aNewSelection = mpField->GetSelection();
+
+ ImplSetText( rText, &aNewSelection );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FormatterBase::ImplSetText( const XubString& rText, Selection* pNewSelection )
+{
+ if ( mpField )
+ {
+ // !!! TH-18.2.99: Wenn wir Zeit haben sollte mal geklaert werden,
+ // !!! warum SetText() intern bei gleichem Text nicht ImplSetSelection
+ // !!! aufruft, sondern etwas anders macht, denn sehr haeufig kommt
+ // !!! hier der gleiche Text an.
+
+ // ggf. bleibt der Text gleich, aber die Selektion wird geaendert...
+ BOOL bTextChanged = (mpField->GetText() != rText);
+
+ if ( pNewSelection )
+ mpField->SetText( rText, *pNewSelection );
+ else
+ {
+ Selection aSel = mpField->GetSelection();
+ aSel.Min() = aSel.Max();
+ mpField->SetText( rText, aSel );
+ }
+
+ // !!! TH-18.2.99: Wenn wir Zeit haben sollte mal geklaert werden,
+ // !!! warum hier der Modify-Handler gerufen wird !!!
+
+ // !!! MT-8.7.99: Erstmal auskommentiert, koentest recht haben,
+ // !!! Modify wird zu oft gerufen.
+// if ( MustBeReformatted() && bTextChanged )
+// mpField->Edit::Modify(); // Nur damit Modify-Hdl gerufen wird.
+
+ MarkToBeReformatted( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FormatterBase::SetEmptyFieldValue()
+{
+ if ( mpField )
+ mpField->SetText( ImplGetSVEmptyStr() );
+ mbEmptyFieldValue = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL FormatterBase::IsEmptyFieldValue() const
+{
+ return (!mpField || !mpField->GetText().Len());
+}
+
+// -----------------------------------------------------------------------
+
+BOOL NumericFormatter::ImplNumericReformat( const XubString& rStr, double& rValue,
+ XubString& rOutStr )
+{
+ if ( !ImplNumericGetValue( rStr, rValue, GetDecimalDigits(), GetInternational() ) )
+ return TRUE;
+ else
+ {
+ double nTempVal = rValue;
+ if ( nTempVal > mnMax )
+ nTempVal = mnMax;
+ else if ( nTempVal < mnMin )
+ nTempVal = mnMin;
+
+ if ( GetErrorHdl().IsSet() && (rValue != nTempVal) )
+ {
+ mnCorrectedValue = (long)nTempVal;
+ if ( !GetErrorHdl().Call( this ) )
+ {
+ mnCorrectedValue = 0;
+ return FALSE;
+ }
+ else
+ mnCorrectedValue = 0;
+ }
+
+ rOutStr = CreateFieldText( (long)nTempVal );
+ return TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::ImplInit()
+{
+ mnFieldValue = 0;
+ mnLastValue = 0;
+ mnMin = 0;
+ mnMax = 0x7FFFFFFF;
+ mnCorrectedValue = 0;
+ mnType = FORMAT_NUMERIC;
+
+ // Fuer Felder...
+ mnSpinSize = 1;
+ mnFirst = mnMin;
+ mnLast = mnMax;
+
+ SetDecimalDigits( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+NumericFormatter::NumericFormatter()
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::ImplLoadRes( const ResId& rResId )
+{
+ ResMgr* pMgr = Resource::GetResManager();
+ USHORT nMask;
+
+ nMask = pMgr->ReadShort();
+
+ if ( NUMERICFORMATTER_MIN & nMask )
+ mnMin = pMgr->ReadLong();
+
+ if ( NUMERICFORMATTER_MAX & nMask )
+ mnMax = pMgr->ReadLong();
+
+ if ( NUMERICFORMATTER_STRICTFORMAT & nMask )
+ SetStrictFormat( (BOOL)pMgr->ReadShort() );
+
+ if ( NUMERICFORMATTER_I12 & nMask )
+ {
+ SetInternational( International( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ }
+ if ( NUMERICFORMATTER_DECIMALDIGITS & nMask )
+ SetDecimalDigits( pMgr->ReadShort() );
+
+ if ( NUMERICFORMATTER_VALUE & nMask )
+ {
+ mnFieldValue = pMgr->ReadLong();
+ if ( mnFieldValue > mnMax )
+ mnFieldValue = mnMax;
+ else if ( mnFieldValue < mnMin )
+ mnFieldValue = mnMin;
+ mnLastValue = mnFieldValue;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+NumericFormatter::~NumericFormatter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::SetMin( long nNewMin )
+{
+ mnMin = nNewMin;
+ if ( !IsEmptyFieldValue() )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::SetMax( long nNewMax )
+{
+ mnMax = nNewMax;
+ if ( !IsEmptyFieldValue() )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::SetDecimalDigits( USHORT nDigits )
+{
+ International aInter( GetInternational() );
+ aInter.SetCurrDigits( nDigits );
+ SetInternational( aInter );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT NumericFormatter::GetDecimalDigits() const
+{
+ return GetInternational().GetCurrDigits();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::SetValue( long nNewValue )
+{
+ SetUserValue( nNewValue );
+ mnFieldValue = mnLastValue;
+ ImplGetEmptyFieldValue() = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+XubString NumericFormatter::CreateFieldText( long nValue ) const
+{
+ return GetInternational().GetNum( nValue, GetDecimalDigits() );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::ImplSetUserValue( long nNewValue, Selection* pNewSelection )
+{
+ if ( nNewValue > mnMax )
+ nNewValue = mnMax;
+ else if ( nNewValue < mnMin )
+ nNewValue = mnMin;
+ mnLastValue = nNewValue;
+
+ if ( GetField() )
+ ImplSetText( CreateFieldText( nNewValue ), pNewSelection );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::SetUserValue( long nNewValue )
+{
+ ImplSetUserValue( nNewValue );
+}
+
+// -----------------------------------------------------------------------
+
+long NumericFormatter::GetValue() const
+{
+ if ( !GetField() )
+ return 0;
+
+ double nTempValue;
+
+ if ( ImplNumericGetValue( GetField()->GetText(), nTempValue,
+ GetDecimalDigits(), GetInternational() ) )
+ {
+ if ( nTempValue > mnMax )
+ nTempValue = mnMax;
+ else if ( nTempValue < mnMin )
+ nTempValue = mnMin;
+ return (long)nTempValue;
+ }
+ else
+ return mnLastValue;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL NumericFormatter::IsValueModified() const
+{
+ if ( ImplGetEmptyFieldValue() )
+ return !IsEmptyFieldValue();
+ else if ( GetValue() != mnFieldValue )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Fraction NumericFormatter::ConvertToFraction( long nValue )
+{
+ return Fraction( nValue, ImplPower10( GetDecimalDigits() ) );
+}
+
+// -----------------------------------------------------------------------
+
+long NumericFormatter::ConvertToLong( const Fraction& rValue )
+{
+ Fraction aFract = rValue;
+ aFract *= Fraction( ImplPower10( GetDecimalDigits() ) );
+ return (long)aFract;
+}
+
+// -----------------------------------------------------------------------
+
+long NumericFormatter::Normalize( long nValue ) const
+{
+ return (nValue * ImplPower10( GetDecimalDigits() ) );
+}
+
+// -----------------------------------------------------------------------
+
+long NumericFormatter::Denormalize( long nValue ) const
+{
+ long nFactor = ImplPower10( GetDecimalDigits() );
+ if( nValue < 0 )
+ return ((nValue-(nFactor/2)) / nFactor );
+ else
+ return ((nValue+(nFactor/2)) / nFactor );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::Reformat()
+{
+ if ( !GetField() )
+ return;
+
+ if ( !GetField()->GetText().Len() && ImplGetEmptyFieldValue() )
+ return;
+
+ XubString aStr;
+ double nTemp = mnLastValue;
+ BOOL bOK = ImplNumericReformat( GetField()->GetText(), nTemp, aStr );
+ mnLastValue = (long)nTemp;
+ if ( !bOK )
+ return;
+
+ if ( aStr.Len() )
+ ImplSetText( aStr );
+ else
+ SetValue( mnLastValue );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::FieldUp()
+{
+ long nValue = GetValue();
+ nValue += mnSpinSize;
+ if ( nValue > mnMax )
+ nValue = mnMax;
+
+ ImplNewFieldValue( nValue );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::FieldDown()
+{
+ long nValue = GetValue();
+ nValue -= mnSpinSize;
+ if ( nValue < mnMin )
+ nValue = mnMin;
+
+ ImplNewFieldValue( nValue );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::FieldFirst()
+{
+ ImplNewFieldValue( mnFirst );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::FieldLast()
+{
+ ImplNewFieldValue( mnLast );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericFormatter::ImplNewFieldValue( long nNewValue )
+{
+ if ( GetField() )
+ {
+ // !!! TH-18.2.99: Wenn wir Zeit haben sollte mal geklaert werden,
+ // !!! warum nicht bei ImplSetUserValue() geprueft wird, ob
+ // !!! sich der Wert aendert. Denn auch hier muesste dieses
+ // !!! gemacht werden, da ansonsten der Modify-Aufruf
+ // !!! nicht gemacht werden duerfte. Jedenfalls sollten die
+ // !!! Wege von ImplNewFieldValue, ImplSetUserValue und
+ // !!! ImplSetText ueberprueft und klarer gestalltet (mit Kommentar)
+ // !!! werden, damit wir mal wissen, was dort ablaeuft!!!
+
+ Selection aSelection = GetField()->GetSelection();
+ aSelection.Justify();
+ XubString aText = GetField()->GetText();
+ // Wenn bis ans Ende selektiert war, soll das auch so bleiben...
+ if ( (xub_StrLen)aSelection.Max() == aText.Len() )
+ {
+ if ( !aSelection.Len() )
+ aSelection.Min() = SELECTION_MAX;
+ aSelection.Max() = SELECTION_MAX;
+ }
+
+ long nOldLastValue = mnLastValue;
+ ImplSetUserValue( nNewValue, &aSelection );
+ mnLastValue = nOldLastValue;
+
+ // Modify am Edit wird nur bei KeyInput gesetzt...
+ if ( GetField()->GetText() != aText )
+ {
+ GetField()->SetModifyFlag();
+ GetField()->Modify();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+NumericField::NumericField( Window* pParent, WinBits nWinStyle ) :
+ SpinField( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+NumericField::NumericField( Window* pParent, const ResId& rResId ) :
+ SpinField( WINDOW_NUMERICFIELD )
+{
+ rResId.SetRT( RSC_NUMERICFIELD );
+ WinBits nStyle = ImplInitRes( rResId ) ;
+ SpinField::ImplInit( pParent, nStyle );
+ SetField( this );
+ ImplLoadRes( rResId );
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericField::ImplLoadRes( const ResId& rResId )
+{
+ SpinField::ImplLoadRes( rResId );
+ NumericFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+
+ USHORT nMask = ReadShortRes();
+
+ if ( NUMERICFIELD_FIRST & nMask )
+ mnFirst = ReadLongRes();
+
+ if ( NUMERICFIELD_LAST & nMask )
+ mnLast = ReadLongRes();
+
+ if ( NUMERICFIELD_SPINSIZE & nMask )
+ mnSpinSize = ReadLongRes();
+}
+
+// -----------------------------------------------------------------------
+
+NumericField::~NumericField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long NumericField::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplNumericProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return SpinField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long NumericField::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return SpinField::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericField::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SpinField::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericField::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ SpinField::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericField::Up()
+{
+ FieldUp();
+ SpinField::Up();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericField::Down()
+{
+ FieldDown();
+ SpinField::Down();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericField::First()
+{
+ FieldFirst();
+ SpinField::First();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericField::Last()
+{
+ FieldLast();
+ SpinField::Last();
+}
+
+// -----------------------------------------------------------------------
+
+NumericBox::NumericBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+NumericBox::NumericBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( WINDOW_NUMERICBOX )
+{
+ rResId.SetRT( RSC_NUMERICBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ComboBox::ImplInit( pParent, nStyle );
+ SetField( this );
+ ComboBox::ImplLoadRes( rResId );
+ NumericFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+NumericBox::~NumericBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long NumericBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplNumericProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long NumericBox::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return ComboBox::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ComboBox::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericBox::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ ComboBox::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void NumericBox::ReformatAll()
+{
+ double nValue;
+ XubString aStr;
+ SetUpdateMode( FALSE );
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT i=0; i < nEntryCount; i++ )
+ {
+ ImplNumericReformat( GetEntry( i ), nValue, aStr );
+ RemoveEntry( i );
+ InsertEntry( aStr, i );
+ }
+ NumericFormatter::Reformat();
+ SetUpdateMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericBox::InsertValue( long nValue, USHORT nPos )
+{
+ ComboBox::InsertEntry( CreateFieldText( nValue ), nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void NumericBox::RemoveValue( long nValue )
+{
+ ComboBox::RemoveEntry( CreateFieldText( nValue ) );
+}
+
+// -----------------------------------------------------------------------
+
+long NumericBox::GetValue( USHORT nPos ) const
+{
+ double nValue = 0;
+ ImplNumericGetValue( ComboBox::GetEntry( nPos ), nValue,
+ GetDecimalDigits(), GetInternational() );
+ return (long)nValue;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT NumericBox::GetValuePos( long nValue ) const
+{
+ return ComboBox::GetEntryPos( CreateFieldText( nValue ) );
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplMetricProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
+ BOOL, const International& rInter )
+{
+ // Es gibt hier kein sinnvolles StrictFormat, also alle
+ // Zeichen erlauben
+ return ImplNumericProcessKeyInput( pEdit, rKEvt, FALSE, rInter );
+}
+
+// -----------------------------------------------------------------------
+
+static XubString ImplMetricGetUnitText( const XubString& rStr )
+{
+ // Einheitentext holen
+ XubString aStr;
+ for ( short i = rStr.Len()-1; i >= 0; i-- )
+ {
+ xub_Unicode c = rStr.GetChar( i );
+ if ( ((c >= 'A') && (c <= 'Z')) ||
+ ((c >= 'a') && (c <= 'z')) ||
+ (c == '\'') || (c == '\"') || (c == '%' ) )
+ aStr.Insert( c, 0 );
+ else
+ {
+ if ( aStr.Len() )
+ break;
+ }
+ }
+
+ return aStr;
+}
+
+// -----------------------------------------------------------------------
+
+static FieldUnit ImplMetricGetUnit( const XubString& rStr )
+{
+ XubString aStr = ImplMetricGetUnitText( rStr );
+ aStr.ToLowerAscii();
+
+ if ( aStr.EqualsAscii( "mm" ) ) // Milimeter
+ return FUNIT_MM;
+ else if ( aStr.EqualsAscii( "cm" ) ) // Centimeter
+ return FUNIT_CM;
+ else if ( aStr.EqualsAscii( "m" ) ) // Meter
+ return FUNIT_M;
+ else if ( aStr.EqualsAscii( "km" ) ) // Km
+ return FUNIT_KM;
+ else if ( aStr.EqualsAscii( "twip" ) ) // Twips
+ return FUNIT_TWIP;
+ else if ( aStr.EqualsAscii( "twips" ) ) // Twips
+ return FUNIT_TWIP;
+ else if ( aStr.EqualsAscii( "pt" ) ) // Point
+ return FUNIT_POINT;
+ else if ( aStr.EqualsAscii( "pi" ) ) // Pica
+ return FUNIT_PICA;
+ else if ( aStr.EqualsAscii( "\"" ) ) // Inch
+ return FUNIT_INCH;
+ else if ( aStr.EqualsAscii( "in" ) ) // Inch
+ return FUNIT_INCH;
+ else if ( aStr.EqualsAscii( "inch" ) ) // Inch
+ return FUNIT_INCH;
+ else if ( aStr.EqualsAscii( "'" ) ) // Foot
+ return FUNIT_FOOT;
+ else if ( aStr.EqualsAscii( "ft" ) ) // Foot
+ return FUNIT_FOOT;
+ else if ( aStr.EqualsAscii( "foot" ) ) // Foot
+ return FUNIT_FOOT;
+ else if ( aStr.EqualsAscii( "feet" ) ) // Foot
+ return FUNIT_FOOT;
+ else if ( aStr.EqualsAscii( "mile" ) ) // Mile
+ return FUNIT_MILE;
+ else if ( aStr.EqualsAscii( "miles" ) ) // Mile
+ return FUNIT_MILE;
+ else if ( aStr.EqualsAscii( "%" ) ) // Percent
+ return FUNIT_PERCENT;
+ else
+ return FUNIT_NONE;
+}
+
+#define K *1000L
+#define M *1000000L
+#define X *5280L
+
+static const long aImplFactor[FUNIT_MILE+1][FUNIT_MILE+1] =
+{ /*
+mm/100 mm cm m km twip point pica inch foot mile */
+{ 1, 100, 1 K, 100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X },
+{ 1, 1, 10, 1 K, 1 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X },
+{ 1, 1, 1, 100, 100 K, 254, 254, 254, 254, 254*12, 254*12 X },
+{ 1, 1, 1, 1, 1 K, 254, 254, 254, 254, 254*12, 254*12 X },
+{ 1, 1, 1, 1, 1, 0, 254, 254, 254, 254*12, 254*12 X },
+{ 1440,144 K,144 K,14400 K, 0, 1, 20, 240, 1440,1440*12,1440*12 X },
+{ 72, 7200, 7200, 720 K, 720 M, 1, 1, 12, 72, 72*12, 72*12 X },
+{ 6, 600, 600, 60 K, 60 M, 1, 1, 1, 6, 6*12, 6*12 X },
+{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 12, 12 X },
+{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 X },
+{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 }
+};
+
+#undef X
+#undef M
+#undef K
+// twip in km 254/14400 M
+
+static FieldUnit eDefaultUnit = FUNIT_NONE;
+
+FieldUnit MetricField::GetDefaultUnit() { return eDefaultUnit; }
+void MetricField::SetDefaultUnit( FieldUnit meUnit ) { eDefaultUnit = meUnit; }
+
+static FieldUnit ImplMap2FieldUnit( MapUnit meUnit, long& nDecDigits )
+{
+ switch( meUnit )
+ {
+ case MAP_100TH_MM :
+ nDecDigits -= 2;
+ return FUNIT_MM;
+ case MAP_10TH_MM :
+ nDecDigits -= 1;
+ return FUNIT_MM;
+ case MAP_MM :
+ return FUNIT_MM;
+ case MAP_CM :
+ return FUNIT_CM;
+ case MAP_1000TH_INCH :
+ nDecDigits -= 3;
+ return FUNIT_INCH;
+ case MAP_100TH_INCH :
+ nDecDigits -= 2;
+ return FUNIT_INCH;
+ case MAP_10TH_INCH :
+ nDecDigits -= 1;
+ return FUNIT_INCH;
+ case MAP_INCH :
+ return FUNIT_INCH;
+ case MAP_POINT :
+ return FUNIT_POINT;
+ case MAP_TWIP :
+ return FUNIT_TWIP;
+ default:
+ DBG_ERROR( "default eInUnit" );
+ break;
+ }
+ return FUNIT_NONE;
+}
+
+// -----------------------------------------------------------------------
+
+long MetricField::ConvertValue( long nValue, long mnBaseValue, USHORT nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit )
+{
+ return (long)ConvertDoubleValue( nValue, mnBaseValue, nDecDigits,
+ eInUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricField::ConvertValue( long nValue, USHORT nDigits,
+ MapUnit eInUnit, FieldUnit eOutUnit )
+{
+ return (long)ConvertDoubleValue( nValue, nDigits, eInUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricField::ConvertValue( long nValue, USHORT nDigits,
+ FieldUnit eInUnit, MapUnit eOutUnit )
+{
+ return (long)ConvertValue( nValue, nDigits, eInUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+double MetricField::ConvertDoubleValue( double nValue, long mnBaseValue, USHORT nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit )
+{
+ if ( eInUnit != eOutUnit )
+ {
+ long nMult, nDiv;
+
+ if ( eInUnit == FUNIT_PERCENT )
+ {
+ if ( (mnBaseValue <= 0) || (nValue <= 0) )
+ return nValue;
+ nDiv = 100;
+ for ( USHORT i=0; i < nDecDigits; i++ )
+ nDiv *= 10;
+
+ nMult = mnBaseValue;
+ }
+ else if ( eOutUnit == FUNIT_PERCENT ||
+ eOutUnit == FUNIT_CUSTOM ||
+ eOutUnit == FUNIT_NONE ||
+ eInUnit == FUNIT_CUSTOM ||
+ eInUnit == FUNIT_NONE )
+ return nValue;
+ else
+ {
+ if ( eOutUnit == FUNIT_100TH_MM )
+ eOutUnit = FUNIT_NONE;
+ if ( eInUnit == FUNIT_100TH_MM )
+ eInUnit = FUNIT_NONE;
+
+ nDiv = aImplFactor[eInUnit][eOutUnit];
+ nMult = aImplFactor[eOutUnit][eInUnit];
+
+ DBG_ASSERT( nMult > 0, "illegal *" );
+ DBG_ASSERT( nDiv > 0, "illegal /" );
+ }
+
+ if ( nMult != 1 )
+ nValue *= nMult;
+ if ( nDiv != 1 )
+ {
+ nValue += ( nValue < 0 ) ? (-nDiv/2) : (nDiv/2);
+ nValue /= nDiv;
+ }
+ }
+
+ return nValue;
+}
+
+// -----------------------------------------------------------------------
+
+double MetricField::ConvertDoubleValue( double nValue, USHORT nDigits,
+ MapUnit eInUnit, FieldUnit eOutUnit )
+{
+ if ( eOutUnit == FUNIT_PERCENT ||
+ eOutUnit == FUNIT_CUSTOM ||
+ eOutUnit == FUNIT_NONE ||
+ eInUnit == MAP_PIXEL ||
+ eInUnit == MAP_SYSFONT ||
+ eInUnit == MAP_APPFONT ||
+ eInUnit == MAP_RELATIVE )
+ {
+ DBG_ERROR( "invalid parameters" );
+ return nValue;
+ }
+
+ long nDecDigits = nDigits;
+ FieldUnit eFieldUnit = ImplMap2FieldUnit( eInUnit, nDecDigits );
+
+ if ( (long)nDecDigits < 0 )
+ {
+ while ( nDecDigits )
+ {
+ nValue += 5;
+ nValue /= 10;
+ nDecDigits++;
+ }
+ }
+ else
+ {
+ while ( nDecDigits )
+ {
+ nValue *= 10;
+ nDecDigits--;
+ }
+ }
+
+ if ( eFieldUnit != eOutUnit )
+ {
+ long nDiv = aImplFactor[eFieldUnit][eOutUnit];
+ long nMult = aImplFactor[eOutUnit][eFieldUnit];
+
+ if ( nMult != 1 )
+ nValue *= nMult;
+ if ( nDiv != 1 )
+ {
+ nValue += (nValue < 0) ? (-nDiv/2) : (nDiv/2);
+ nValue /= nDiv;
+ }
+ }
+ return nValue;
+}
+
+// -----------------------------------------------------------------------
+
+double MetricField::ConvertDoubleValue( double nValue, USHORT nDigits,
+ FieldUnit eInUnit, MapUnit eOutUnit )
+{
+ if ( eInUnit == FUNIT_PERCENT ||
+ eInUnit == FUNIT_CUSTOM ||
+ eInUnit == FUNIT_NONE ||
+ eOutUnit == MAP_PIXEL ||
+ eOutUnit == MAP_SYSFONT ||
+ eOutUnit == MAP_APPFONT ||
+ eOutUnit == MAP_RELATIVE )
+ {
+ DBG_ERROR( "invalid parameters" );
+ return nValue;
+ }
+
+ long nDecDigits = nDigits;
+ FieldUnit eFieldUnit = ImplMap2FieldUnit( eOutUnit, nDecDigits );
+
+ if ( (long)nDecDigits < 0 )
+ {
+ while ( nDecDigits )
+ {
+ nValue *= 10;
+ nDecDigits++;
+ }
+ }
+ else
+ {
+ while ( nDecDigits )
+ {
+ nValue += 5;
+ nValue /= 10;
+ nDecDigits--;
+ }
+ }
+
+ if ( eFieldUnit != eInUnit )
+ {
+ long nDiv = aImplFactor[eInUnit][eFieldUnit];
+ long nMult = aImplFactor[eFieldUnit][eInUnit];
+
+ if( nMult != 1 )
+ nValue *= nMult;
+ if( nDiv != 1 )
+ {
+ nValue += (nValue < 0) ? (-nDiv/2) : (nDiv/2);
+ nValue /= nDiv;
+ }
+ }
+ return nValue;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplMetricGetValue( const XubString& rStr, double& rValue, long nBaseValue,
+ USHORT nDecDigits,
+ const International& rInter, FieldUnit eUnit )
+{
+ // Zahlenwert holen
+ if ( !ImplNumericGetValue( rStr, rValue, nDecDigits, rInter ) )
+ return FALSE;
+
+ // Einheit rausfinden
+ FieldUnit eEntryUnit = ImplMetricGetUnit( rStr );
+
+ // Einheiten umrechnen
+ rValue = MetricField::ConvertDoubleValue( rValue, nBaseValue, nDecDigits, eEntryUnit, eUnit );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MetricFormatter::ImplMetricReformat( const XubString& rStr, double& rValue, XubString& rOutStr )
+{
+ if ( !ImplMetricGetValue( rStr, rValue, mnBaseValue, GetDecimalDigits(), GetInternational(), meUnit ) )
+ return TRUE;
+ else
+ {
+ double nTempVal = rValue;
+ if ( nTempVal > GetMax() )
+ nTempVal = GetMax();
+ else if ( nTempVal < GetMin())
+ nTempVal = GetMin();
+
+ if ( GetErrorHdl().IsSet() && (rValue != nTempVal) )
+ {
+ mnCorrectedValue = (long)nTempVal;
+ if ( !GetErrorHdl().Call( this ) )
+ {
+ mnCorrectedValue = 0;
+ return FALSE;
+ }
+ else
+ mnCorrectedValue = 0;
+ }
+
+ rOutStr = CreateFieldText( (long)nTempVal );
+ return TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline void MetricFormatter::ImplInit()
+{
+ mnBaseValue = 0;
+ meUnit = MetricField::GetDefaultUnit();
+ mnType = FORMAT_METRIC;
+}
+
+// -----------------------------------------------------------------------
+
+MetricFormatter::MetricFormatter()
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::ImplLoadRes( const ResId& rResId )
+{
+ NumericFormatter::ImplLoadRes( rResId );
+
+ ResMgr* pMgr = Resource::GetResManager();
+ USHORT nMask = pMgr->ReadShort();
+
+ if ( METRICFORMATTER_UNIT & nMask )
+ meUnit = (FieldUnit)pMgr->ReadShort();
+
+ if ( METRICFORMATTER_CUSTOMUNITTEXT & nMask )
+ maCustomUnitText = pMgr->ReadString();
+}
+
+// -----------------------------------------------------------------------
+
+MetricFormatter::~MetricFormatter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::SetUnit( FieldUnit eNewUnit )
+{
+ if ( eNewUnit == FUNIT_100TH_MM )
+ {
+ SetDecimalDigits( GetDecimalDigits() + 2 );
+ meUnit = FUNIT_MM;
+ }
+ else
+ meUnit = eNewUnit;
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::SetCustomUnitText( const XubString& rStr )
+{
+ maCustomUnitText = rStr;
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::SetValue( long nNewValue, FieldUnit eInUnit )
+{
+ SetUserValue( nNewValue, eInUnit );
+ mnFieldValue = mnLastValue;
+}
+
+// -----------------------------------------------------------------------
+
+XubString MetricFormatter::CreateFieldText( long nValue ) const
+{
+ XubString aStr = NumericFormatter::CreateFieldText( nValue );
+
+ // Einheit dranhaengen
+ switch ( meUnit )
+ {
+ case FUNIT_MM:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "mm" ) );
+ break;
+ case FUNIT_CM:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "cm" ) );
+ break;
+ case FUNIT_M:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "m" ) );
+ break;
+ case FUNIT_KM:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "km" ) );
+ break;
+ case FUNIT_TWIP:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "twips" ) );
+ break;
+ case FUNIT_POINT:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "pt" ) );
+ break;
+ case FUNIT_PICA:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "pi" ) );
+ break;
+ case FUNIT_INCH:
+ aStr.Append( '"' );
+ break;
+ case FUNIT_FOOT:
+ aStr.Append( '\'' );
+ break;
+ case FUNIT_MILE:
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "miles" ) );
+ break;
+ case FUNIT_CUSTOM:
+ aStr += maCustomUnitText;
+ break;
+ default:
+ break;
+ }
+
+ return aStr;
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::SetUserValue( long nNewValue, FieldUnit eInUnit )
+{
+ // Umrechnen auf eingestellte Einheiten
+ nNewValue = MetricField::ConvertValue( nNewValue, mnBaseValue, GetDecimalDigits(), eInUnit, meUnit );
+ NumericFormatter::SetUserValue( nNewValue );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricFormatter::GetValue( FieldUnit eOutUnit ) const
+{
+ if ( !GetField() )
+ return 0;
+
+ double nTempValue;
+ if ( !ImplMetricGetValue( GetField()->GetText(), nTempValue, mnBaseValue, GetDecimalDigits(),
+ GetInternational(), meUnit ) )
+ nTempValue = mnLastValue;
+
+ if ( nTempValue > mnMax )
+ nTempValue = mnMax;
+ else if ( nTempValue < mnMin )
+ nTempValue = mnMin;
+
+ // Umrechnen auf gewuenschte Einheiten
+ return MetricField::ConvertValue( (long)nTempValue, mnBaseValue, GetDecimalDigits(), meUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::SetMin( long nNewMin, FieldUnit eInUnit )
+{
+ // Umrechnen auf gewuenschte Einheiten
+ NumericFormatter::SetMin( MetricField::ConvertValue( nNewMin, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit ) );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricFormatter::GetMin( FieldUnit eOutUnit ) const
+{
+ // Umrechnen auf gewuenschte Einheiten
+ return MetricField::ConvertValue( NumericFormatter::GetMin(), mnBaseValue,
+ GetDecimalDigits(), meUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::SetMax( long nNewMax, FieldUnit eInUnit )
+{
+ // Umrechnen auf gewuenschte Einheiten
+ NumericFormatter::SetMax( MetricField::ConvertValue( nNewMax, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit ) );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricFormatter::GetMax( FieldUnit eOutUnit ) const
+{
+ // Umrechnen auf gewuenschte Einheiten
+ return MetricField::ConvertValue( NumericFormatter::GetMax(), mnBaseValue,
+ GetDecimalDigits(), meUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::SetBaseValue( long nNewBase, FieldUnit eInUnit )
+{
+ mnBaseValue = MetricField::ConvertValue( nNewBase, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricFormatter::GetBaseValue( FieldUnit eOutUnit ) const
+{
+ // Umrechnen auf gewuenschte Einheiten
+ return MetricField::ConvertValue( mnBaseValue, mnBaseValue, GetDecimalDigits(),
+ meUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricFormatter::Reformat()
+{
+ if ( !GetField() )
+ return;
+
+ XubString aText = GetField()->GetText();
+ if ( meUnit == FUNIT_CUSTOM )
+ maCurUnitText = ImplMetricGetUnitText( aText );
+
+ XubString aStr;
+ double nTemp = mnLastValue;
+ BOOL bOK = ImplMetricReformat( aText, nTemp, aStr );
+ mnLastValue = (long)nTemp;
+
+ if ( !bOK )
+ return;
+
+ if ( aStr.Len() )
+ {
+ ImplSetText( aStr );
+ if ( meUnit == FUNIT_CUSTOM )
+ CustomConvert();
+ }
+ else
+ SetValue( mnLastValue );
+ maCurUnitText.Erase();
+}
+
+// -----------------------------------------------------------------------
+
+long MetricFormatter::GetCorrectedValue( FieldUnit eOutUnit ) const
+{
+ // Umrechnen auf gewuenschte Einheiten
+ return MetricField::ConvertValue( mnCorrectedValue, mnBaseValue, GetDecimalDigits(),
+ meUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+MetricField::MetricField( Window* pParent, WinBits nWinStyle ) :
+ SpinField( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+MetricField::MetricField( Window* pParent, const ResId& rResId ) :
+ SpinField( WINDOW_METRICFIELD )
+{
+ rResId.SetRT( RSC_METRICFIELD );
+ WinBits nStyle = ImplInitRes( rResId ) ;
+ SpinField::ImplInit( pParent, nStyle );
+ SetField( this );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::ImplLoadRes( const ResId& rResId )
+{
+ SpinField::ImplLoadRes( rResId );
+ MetricFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+
+ USHORT nMask = ReadShortRes();
+
+ if ( METRICFIELD_FIRST & nMask )
+ mnFirst = ReadLongRes();
+
+ if ( METRICFIELD_LAST & nMask )
+ mnLast = ReadLongRes();
+
+ if ( METRICFIELD_SPINSIZE & nMask )
+ mnSpinSize = ReadLongRes();
+
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+MetricField::~MetricField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::SetFirst( long nNewFirst, FieldUnit eInUnit )
+{
+ // Umrechnen
+ nNewFirst = MetricField::ConvertValue( nNewFirst, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit );
+ mnFirst = nNewFirst;
+}
+
+// -----------------------------------------------------------------------
+
+long MetricField::GetFirst( FieldUnit eOutUnit ) const
+{
+ // Umrechnen
+ return MetricField::ConvertValue( mnFirst, mnBaseValue, GetDecimalDigits(),
+ meUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::SetLast( long nNewLast, FieldUnit eInUnit )
+{
+ // Umrechnen
+ nNewLast = MetricField::ConvertValue( nNewLast, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit );
+ mnLast = nNewLast;
+}
+
+// -----------------------------------------------------------------------
+
+long MetricField::GetLast( FieldUnit eOutUnit ) const
+{
+ // Umrechnen
+ return MetricField::ConvertValue( mnLast, mnBaseValue, GetDecimalDigits(),
+ meUnit, eOutUnit );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricField::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplMetricProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return SpinField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricField::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return SpinField::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SpinField::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ SpinField::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::Up()
+{
+ FieldUp();
+ SpinField::Up();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::Down()
+{
+ FieldDown();
+ SpinField::Down();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::First()
+{
+ FieldFirst();
+ SpinField::First();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::Last()
+{
+ FieldLast();
+ SpinField::Last();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricField::CustomConvert()
+{
+ maCustomConvertLink.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+MetricBox::MetricBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+MetricBox::MetricBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( WINDOW_METRICBOX )
+{
+ rResId.SetRT( RSC_METRICBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ComboBox::ImplInit( pParent, nStyle );
+ SetField( this );
+ Reformat();
+ ComboBox::ImplLoadRes( rResId );
+ MetricFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+MetricBox::~MetricBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long MetricBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplMetricProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricBox::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return ComboBox::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ComboBox::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricBox::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ ComboBox::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void MetricBox::ReformatAll()
+{
+ double nValue;
+ XubString aStr;
+ SetUpdateMode( FALSE );
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT i=0; i < nEntryCount; i++ )
+ {
+ ImplMetricReformat( GetEntry( i ), nValue, aStr );
+ RemoveEntry( i );
+ InsertEntry( aStr, i );
+ }
+ MetricFormatter::Reformat();
+ SetUpdateMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricBox::CustomConvert()
+{
+ maCustomConvertLink.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricBox::InsertValue( long nValue, FieldUnit eInUnit, USHORT nPos )
+{
+ // Umrechnen auf eingestellte Einheiten
+ nValue = MetricField::ConvertValue( nValue, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit );
+ ComboBox::InsertEntry( CreateFieldText( nValue ), nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void MetricBox::RemoveValue( long nValue, FieldUnit eInUnit )
+{
+ // Umrechnen auf eingestellte Einheiten
+ nValue = MetricField::ConvertValue( nValue, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit );
+ ComboBox::RemoveEntry( CreateFieldText( nValue ) );
+}
+
+// -----------------------------------------------------------------------
+
+long MetricBox::GetValue( USHORT nPos, FieldUnit eOutUnit ) const
+{
+ double nValue = 0;
+ ImplMetricGetValue( ComboBox::GetEntry( nPos ), nValue, mnBaseValue,
+ GetDecimalDigits(), GetInternational(), meUnit );
+
+ // Umrechnen auf eingestellte Einheiten
+ long nRetValue = MetricField::ConvertValue( (long)nValue, mnBaseValue, GetDecimalDigits(),
+ meUnit, eOutUnit );
+
+ return nRetValue;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT MetricBox::GetValuePos( long nValue, FieldUnit eInUnit ) const
+{
+ // Umrechnen auf eingestellte Einheiten
+ nValue = MetricField::ConvertValue( nValue, mnBaseValue, GetDecimalDigits(),
+ eInUnit, meUnit );
+ return ComboBox::GetEntryPos( CreateFieldText( nValue ) );
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
+ BOOL, const International& rInter )
+{
+ // Es gibt hier kein sinnvolles StrictFormat, also alle
+ // Zeichen erlauben
+ return ImplNumericProcessKeyInput( pEdit, rKEvt, FALSE, rInter );
+}
+
+// -----------------------------------------------------------------------
+
+inline BOOL ImplCurrencyGetValue( const XubString& rStr, double& rValue,
+ USHORT nDecDigits, const International& rInter )
+{
+ // Zahlenwert holen
+ return ImplNumericGetValue( rStr, rValue, nDecDigits, rInter, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL CurrencyFormatter::ImplCurrencyReformat( const XubString& rStr,
+ XubString& rOutStr )
+{
+ double nValue;
+ if ( !ImplNumericGetValue( rStr, nValue, GetDecimalDigits(), GetInternational(), TRUE ) )
+ return TRUE;
+ else
+ {
+ double nTempVal = nValue;
+ if ( nTempVal > GetMax() )
+ nTempVal = GetMax();
+ else if ( nTempVal < GetMin())
+ nTempVal = GetMin();
+
+ if ( GetErrorHdl().IsSet() && (nValue != nTempVal) )
+ {
+ mnCorrectedValue = (long)nTempVal;
+ if ( !GetErrorHdl().Call( this ) )
+ {
+ mnCorrectedValue = 0;
+ return FALSE;
+ }
+ else
+ mnCorrectedValue = 0;
+ }
+
+ rOutStr = GetInternational().GetCurr( (long)nTempVal );
+ return TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline void CurrencyFormatter::ImplInit()
+{
+ mnType = FORMAT_CURRENCY;
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyFormatter::CurrencyFormatter()
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyFormatter::~CurrencyFormatter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyFormatter::SetValue( long nNewValue )
+{
+ SetUserValue( nNewValue );
+ mnFieldValue = mnLastValue;
+ ImplGetEmptyFieldValue() = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+XubString CurrencyFormatter::CreateFieldText( long nValue ) const
+{
+ return GetInternational().GetCurr( nValue, GetDecimalDigits() );
+}
+
+// -----------------------------------------------------------------------
+
+long CurrencyFormatter::GetValue() const
+{
+ if ( !GetField() )
+ return 0;
+
+ double nTempValue;
+ if ( ImplCurrencyGetValue( GetField()->GetText(), nTempValue, GetDecimalDigits(),
+ GetInternational() ) )
+ {
+ if ( nTempValue > mnMax )
+ nTempValue = mnMax;
+ else if ( nTempValue < mnMin )
+ nTempValue = mnMin;
+ return (long)nTempValue;
+ }
+ else
+ return mnLastValue;
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyFormatter::Reformat()
+{
+ if ( !GetField() )
+ return;
+
+ XubString aStr;
+ BOOL bOK = ImplCurrencyReformat( GetField()->GetText(), aStr );
+ if ( !bOK )
+ return;
+
+ if ( aStr.Len() )
+ {
+ ImplSetText( aStr );
+ double nTemp = mnLastValue;
+ ImplCurrencyGetValue( aStr, nTemp, GetDecimalDigits(), GetInternational() );
+ mnLastValue = (long)nTemp;
+ }
+ else
+ SetValue( mnLastValue );
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyField::CurrencyField( Window* pParent, WinBits nWinStyle ) :
+ SpinField( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyField::CurrencyField( Window* pParent, const ResId& rResId ) :
+ SpinField( WINDOW_CURRENCYFIELD )
+{
+ rResId.SetRT( RSC_CURRENCYFIELD );
+ WinBits nStyle = ImplInitRes( rResId );
+ SpinField::ImplInit( pParent, nStyle);
+ SetField( this );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyField::ImplLoadRes( const ResId& rResId )
+{
+ SpinField::ImplLoadRes( rResId );
+ CurrencyFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+
+ USHORT nMask = ReadShortRes();
+
+ if ( CURRENCYFIELD_FIRST & nMask )
+ mnFirst = ReadLongRes();
+
+ if ( CURRENCYFIELD_LAST & nMask )
+ mnLast = ReadLongRes();
+
+ if ( CURRENCYFIELD_SPINSIZE & nMask )
+ mnSpinSize = ReadLongRes();
+
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyField::~CurrencyField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long CurrencyField::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplCurrencyProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return SpinField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long CurrencyField::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return SpinField::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyField::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SpinField::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyField::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ SpinField::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyField::Up()
+{
+ FieldUp();
+ SpinField::Up();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyField::Down()
+{
+ FieldDown();
+ SpinField::Down();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyField::First()
+{
+ FieldFirst();
+ SpinField::First();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyField::Last()
+{
+ FieldLast();
+ SpinField::Last();
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyBox::CurrencyBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyBox::CurrencyBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( WINDOW_CURRENCYBOX )
+{
+ rResId.SetRT( RSC_CURRENCYBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ComboBox::ImplInit( pParent, nStyle );
+ CurrencyFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ SetField( this );
+ ComboBox::ImplLoadRes( rResId );
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+CurrencyBox::~CurrencyBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long CurrencyBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplCurrencyProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long CurrencyBox::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return ComboBox::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ComboBox::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyBox::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ ComboBox::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyBox::ReformatAll()
+{
+ XubString aStr;
+ SetUpdateMode( FALSE );
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT i=0; i < nEntryCount; i++ )
+ {
+ ImplCurrencyReformat( GetEntry( i ), aStr );
+ RemoveEntry( i );
+ InsertEntry( aStr, i );
+ }
+ CurrencyFormatter::Reformat();
+ SetUpdateMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyBox::InsertValue( long nValue, USHORT nPos )
+{
+ ComboBox::InsertEntry( CreateFieldText( nValue ), nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void CurrencyBox::RemoveValue( long nValue )
+{
+ ComboBox::RemoveEntry( CreateFieldText( nValue ) );
+}
+
+// -----------------------------------------------------------------------
+
+long CurrencyBox::GetValue( USHORT nPos ) const
+{
+ double nValue = 0;
+ ImplCurrencyGetValue( ComboBox::GetEntry( nPos ), nValue,
+ GetDecimalDigits(), GetInternational() );
+ return (long)nValue;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT CurrencyBox::GetValuePos( long nValue ) const
+{
+ return ComboBox::GetEntryPos( CreateFieldText( nValue ) );
+}
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
new file mode 100644
index 000000000000..5a598c72e3cb
--- /dev/null
+++ b/vcl/source/control/field2.cxx
@@ -0,0 +1,3245 @@
+/*************************************************************************
+ *
+ * $RCSfile: field2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_FIELD2_CXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <field.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_SYSTEM_HXX
+#include <system.hxx>
+#endif
+#ifndef _SV_SOUND_HXX
+#include <sound.hxx>
+#endif
+#ifndef _SV_FIELD_HXX
+#include <field.hxx>
+#endif
+
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
+
+#include <unohelp.hxx>
+
+#include <com/sun/star/lang/Locale.hpp>
+
+#ifndef _COM_SUN_STAR_LANG_XCHARACTERCLASSIFICATION_HPP_
+#include <com/sun/star/lang/XCharacterClassification.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_KCHARACTERTYPE_HPP_
+#include <com/sun/star/lang/KCharacterType.hpp>
+#endif
+
+#pragma hdrstop
+
+using namespace ::com::sun::star;
+
+// =======================================================================
+
+#define EDITMASK_LITERAL 'L'
+#define EDITMASK_ALPHA 'a'
+#define EDITMASK_UPPERALPHA 'A'
+#define EDITMASK_ALPHANUM 'c'
+#define EDITMASK_UPPERALPHANUM 'C'
+#define EDITMASK_NUM 'N'
+#define EDITMASK_NUMSPACE 'n'
+#define EDITMASK_ALLCHAR 'x'
+#define EDITMASK_UPPERALLCHAR 'X'
+
+
+
+const sal_Int32 nCharClassAlphaType =
+ ::com::sun::star::lang::KCharacterType::UPPER |
+ ::com::sun::star::lang::KCharacterType::LOWER |
+ ::com::sun::star::lang::KCharacterType::TITLE_CASE;
+
+const sal_Int32 nCharClassAlphaTypeMask =
+ nCharClassAlphaType |
+ ::com::sun::star::lang::KCharacterType::PRINTABLE |
+ ::com::sun::star::lang::KCharacterType::BASE_FORM;
+
+inline sal_Bool isAlphaType( sal_Int32 nType )
+{
+ return ((nType & nCharClassAlphaType) != 0) && (nType & ~(nCharClassAlphaTypeMask) == 0);
+}
+
+lang::Locale CreateLocale( const International& rInt )
+{
+ String aLanguage, aCountry;
+ ConvertLanguageToIsoNames( rInt.GetLanguage(), aLanguage, aCountry );
+ lang::Locale aLocale;
+ aLocale.Language = aLanguage;
+ aLocale.Country = aCountry;
+
+ return aLocale;
+}
+
+uno::Reference< lang::XCharacterClassification > ImplGetCharClass()
+{
+ static uno::Reference< lang::XCharacterClassification > xCharClass;
+ if ( !xCharClass.is() )
+ xCharClass = vcl::unohelper::CreateCharacterClassification();
+
+ return xCharClass;
+}
+
+
+// -----------------------------------------------------------------------
+
+static int ImplIsPatternChar( xub_Unicode cChar, sal_Char cEditMask )
+{
+ if ( (cEditMask == EDITMASK_ALPHA) || (cEditMask == EDITMASK_UPPERALPHA) )
+ {
+ if ( ((cChar < 'A') || (cChar > 'Z')) &&
+ ((cChar < 'a') || (cChar > 'z')) )
+ return FALSE;
+ }
+ else if ( (cEditMask == EDITMASK_ALPHANUM) || (cEditMask == EDITMASK_UPPERALPHANUM) )
+ {
+ if ( ((cChar < 'A') || (cChar > 'Z')) &&
+ ((cChar < 'a') || (cChar > 'z')) &&
+ ((cChar < '0') || (cChar > '9')) )
+ return FALSE;
+ }
+ else if ( (cEditMask == EDITMASK_ALLCHAR) || (cEditMask == EDITMASK_UPPERALLCHAR) )
+ {
+ if ( cChar < 32 )
+ return FALSE;
+ }
+ else if ( cEditMask == EDITMASK_NUM )
+ {
+ if ( (cChar < '0') || (cChar > '9') )
+ return FALSE;
+ }
+ else if ( cEditMask == EDITMASK_NUMSPACE )
+ {
+ if ( ((cChar < '0') || (cChar > '9')) && (cChar != ' ') )
+ return FALSE;
+ }
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+static xub_Unicode ImplPatternChar( xub_Unicode cChar, sal_Char cEditMask )
+{
+ if ( ImplIsPatternChar( cChar, cEditMask ) )
+ {
+ if ( (cEditMask == EDITMASK_UPPERALPHA) ||
+ (cEditMask == EDITMASK_UPPERALPHANUM) )
+ {
+ if ( (cChar >= 'a') && (cChar <= 'z') )
+ cChar = (cChar - 'a') + 'A';
+ }
+ else if ( cEditMask == EDITMASK_UPPERALLCHAR )
+ {
+ cChar = ImplGetCharClass()->toUpper( String(cChar),0,1,Application::GetSettings().GetLocale() )[0];
+ }
+
+ return cChar;
+ }
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplKommaPointCharEqual( xub_Unicode c1, xub_Unicode c2 )
+{
+ if ( c1 == c2 )
+ return TRUE;
+ else if ( ((c1 == '.') || (c1 == ',')) &&
+ ((c2 == '.') || (c2 == ',')) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static XubString ImplPatternReformat( const XubString& rStr,
+ const ByteString& rEditMask,
+ const XubString& rLiteralMask,
+ USHORT nFormatFlags )
+{
+ if ( !rEditMask.Len() )
+ return rStr;
+
+ XubString aStr = rStr;
+ XubString aOutStr = rLiteralMask;
+ xub_Unicode cTempChar;
+ xub_Unicode cChar;
+ xub_Unicode cLiteral;
+ sal_Char cMask;
+ xub_StrLen nStrIndex = 0;
+ xub_StrLen i = 0;
+ xub_StrLen n;
+
+ while ( i < rEditMask.Len() )
+ {
+ if ( nStrIndex >= aStr.Len() )
+ break;
+
+ cChar = aStr.GetChar(nStrIndex);
+ cLiteral = rLiteralMask.GetChar(i);
+ cMask = rEditMask.GetChar(i);
+
+ // Aktuelle Position ein Literal
+ if ( cMask == EDITMASK_LITERAL )
+ {
+ // Wenn es das Literal-Zeichen ist, uebernehmen, ansonsten
+ // ignorieren, da es das naechste gueltige Zeichen vom String
+ // sein kann
+ if ( ImplKommaPointCharEqual( cChar, cLiteral ) )
+ nStrIndex++;
+ else
+ {
+ // Ansonsten testen wir, ob es ein ungueltiges Zeichen ist.
+ // Dies ist dann der Fall, wenn es nicht in das Muster
+ // des naechsten nicht Literal-Zeichens passt
+ n = i+1;
+ while ( n < rEditMask.Len() )
+ {
+ if ( rEditMask.GetChar(n) != EDITMASK_LITERAL )
+ {
+ if ( !ImplIsPatternChar( cChar, rEditMask.GetChar(n) ) )
+ nStrIndex++;
+ break;
+ }
+
+ n++;
+ }
+ }
+ }
+ else
+ {
+ // Gueltiges Zeichen an der Stelle
+ cTempChar = ImplPatternChar( cChar, cMask );
+ if ( cTempChar )
+ {
+ // dann Zeichen uebernehmen
+ aOutStr.SetChar( i, cTempChar );
+ nStrIndex++;
+ }
+ else
+ {
+ // Wenn es das Literalzeichen ist, uebernehmen
+ if ( cLiteral == cChar )
+ nStrIndex++;
+ else
+ {
+ // Wenn das ungueltige Zeichen das naechste Literalzeichen
+ // sein kann, dann springen wir bis dahin vor, ansonten
+ // das Zeichen ignorieren
+ // Nur machen, wenn leere Literale erlaubt sind
+ if ( nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS )
+ {
+ n = i;
+ while ( n < rEditMask.Len() )
+ {
+ if ( rEditMask.GetChar( n ) == EDITMASK_LITERAL )
+ {
+ if ( ImplKommaPointCharEqual( cChar, rLiteralMask.GetChar( n ) ) )
+ i = n+1;
+
+ break;
+ }
+
+ n++;
+ }
+ }
+
+ nStrIndex++;
+ continue;
+ }
+ }
+ }
+
+ i++;
+ }
+
+ return aOutStr;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplPatternMaxPos( const XubString rStr, const ByteString& rEditMask,
+ USHORT nFormatFlags, BOOL bSameMask,
+ USHORT nCursorPos, USHORT& rPos )
+{
+
+ // Letzte Position darf nicht groesser als der enthaltene String sein
+ xub_StrLen nMaxPos = rStr.Len();
+
+ // Wenn keine leeren Literale erlaubt sind, auch Leerzeichen
+ // am Ende ignorieren
+ if ( bSameMask && !(nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS) )
+ {
+ while ( nMaxPos )
+ {
+ if ( (rEditMask.GetChar(nMaxPos-1) != EDITMASK_LITERAL) &&
+ (rStr.GetChar(nMaxPos-1) != ' ') )
+ break;
+ nMaxPos--;
+ }
+
+ // Wenn wir vor einem Literal stehen, dann solange weitersuchen,
+ // bis erste Stelle nach Literal
+ xub_StrLen nTempPos = nMaxPos;
+ while ( nTempPos < rEditMask.Len() )
+ {
+ if ( rEditMask.GetChar(nTempPos) != EDITMASK_LITERAL )
+ {
+ nMaxPos = nTempPos;
+ break;
+ }
+ nTempPos++;
+ }
+ }
+
+ if ( rPos > nMaxPos )
+ rPos = nMaxPos;
+ // Zeichen sollte nicht nach links wandern
+ if ( rPos < nCursorPos )
+ rPos = nCursorPos;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplPatternProcessStrictModify( Edit* pEdit,
+ const ByteString& rEditMask,
+ const XubString& rLiteralMask,
+ USHORT nFormatFlags, BOOL bSameMask )
+{
+ XubString aText = pEdit->GetText();
+
+ // Leerzeichen am Anfang entfernen
+ if ( bSameMask && !(nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS) )
+ {
+ xub_StrLen i = 0;
+ xub_StrLen nMaxLen = aText.Len();
+ while ( i < nMaxLen )
+ {
+ if ( (rEditMask.GetChar( i ) != EDITMASK_LITERAL) &&
+ (aText.GetChar( i ) != ' ') )
+ break;
+
+ i++;
+ }
+ // Alle Literalzeichen beibehalten
+ while ( i && (rEditMask.GetChar( i ) == EDITMASK_LITERAL) )
+ i--;
+ aText.Erase( 0, i );
+ }
+
+ XubString aNewText = ImplPatternReformat( aText, rEditMask, rLiteralMask, nFormatFlags );
+ if ( aNewText != aText )
+ {
+ // Selection so anpassen, das diese wenn sie vorher am Ende
+ // stand, immer noch am Ende steht
+ Selection aSel = pEdit->GetSelection();
+ ULONG nMaxSel = Max( aSel.Min(), aSel.Max() );
+ if ( nMaxSel >= aText.Len() )
+ {
+ xub_StrLen nMaxPos = aNewText.Len();
+ ImplPatternMaxPos( aNewText, rEditMask, nFormatFlags, bSameMask, (xub_StrLen)nMaxSel, nMaxPos );
+ if ( aSel.Min() == aSel.Max() )
+ {
+ aSel.Min() = nMaxPos;
+ aSel.Max() = aSel.Min();
+ }
+ else if ( aSel.Min() > aSel.Max() )
+ aSel.Min() = nMaxPos;
+ else
+ aSel.Max() = nMaxPos;
+ }
+ pEdit->SetText( aNewText, aSel );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static xub_StrLen ImplPatternLeftPos( const ByteString& rEditMask, xub_StrLen nCursorPos )
+{
+ // Vorheriges Zeichen suchen, was kein Literal ist
+ xub_StrLen nNewPos = nCursorPos;
+ xub_StrLen nTempPos = nNewPos;
+ while ( nTempPos )
+ {
+ if ( rEditMask.GetChar(nTempPos-1) != EDITMASK_LITERAL )
+ {
+ nNewPos = nTempPos-1;
+ break;
+ }
+ nTempPos--;
+ }
+ return nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+static xub_StrLen ImplPatternRightPos( const XubString& rStr, const ByteString& rEditMask,
+ USHORT nFormatFlags, BOOL bSameMask,
+ xub_StrLen nCursorPos )
+{
+ // Naechstes Zeichen suchen, was kein Literal ist
+ xub_StrLen nNewPos = nCursorPos;
+ xub_StrLen nTempPos = nNewPos;
+ while ( nTempPos < rEditMask.Len() )
+ {
+ if ( rEditMask.GetChar(nTempPos+1) != EDITMASK_LITERAL )
+ {
+ nNewPos = nTempPos+1;
+ break;
+ }
+ nTempPos++;
+ }
+ ImplPatternMaxPos( rStr, rEditMask, nFormatFlags, bSameMask, nCursorPos, nNewPos );
+ return nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplPatternProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
+ const ByteString& rEditMask,
+ const XubString& rLiteralMask,
+ BOOL bStrictFormat,
+ USHORT nFormatFlags,
+ BOOL bSameMask,
+ BOOL& rbInKeyInput )
+{
+ if ( !rEditMask.Len() || !bStrictFormat )
+ return FALSE;
+
+ Selection aOldSel = pEdit->GetSelection();
+ KeyCode aCode = rKEvt.GetKeyCode();
+ xub_Unicode cChar = rKEvt.GetCharCode();
+ USHORT nKeyCode = aCode.GetCode();
+ BOOL bShift = aCode.IsShift();
+ xub_StrLen nCursorPos = (xub_StrLen)aOldSel.Max();
+ xub_StrLen nNewPos;
+ xub_StrLen nTempPos;
+
+ if ( nKeyCode && !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ if ( nKeyCode == KEY_LEFT )
+ {
+ Selection aSel( ImplPatternLeftPos( rEditMask, nCursorPos ) );
+ if ( bShift )
+ aSel.Min() = aOldSel.Min();
+ pEdit->SetSelection( aSel );
+ return TRUE;
+ }
+ else if ( nKeyCode == KEY_RIGHT )
+ {
+ // Hier nehmen wir Selectionsanfang als minimum, da falls durch
+ // Focus alles selektiert ist, ist eine kleine Position schon
+ // erlaubt.
+ Selection aSel( aOldSel );
+ aSel.Justify();
+ nCursorPos = (xub_StrLen)aSel.Min();
+ aSel.Max() = ImplPatternRightPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos );
+ if ( bShift )
+ aSel.Min() = aOldSel.Min();
+ else
+ aSel.Min() = aSel.Max();
+ pEdit->SetSelection( aSel );
+ return TRUE;
+ }
+ else if ( nKeyCode == KEY_HOME )
+ {
+ // Home ist Position des ersten nicht literalen Zeichens
+ nNewPos = 0;
+ while ( (nNewPos < rEditMask.Len()) &&
+ (rEditMask.GetChar(nNewPos) == EDITMASK_LITERAL) )
+ nNewPos++;
+ // Home sollte nicht nach rechts wandern
+ if ( nCursorPos < nNewPos )
+ nNewPos = nCursorPos;
+ Selection aSel( nNewPos );
+ if ( bShift )
+ aSel.Min() = aOldSel.Min();
+ pEdit->SetSelection( aSel );
+ return TRUE;
+ }
+ else if ( nKeyCode == KEY_END )
+ {
+ // End ist die Position des letzten nicht literalen Zeichens
+ nNewPos = rEditMask.Len();
+ while ( nNewPos &&
+ (rEditMask.GetChar(nNewPos-1) == EDITMASK_LITERAL) )
+ nNewPos--;
+ // Hier nehmen wir Selectionsanfang als minimum, da falls durch
+ // Focus alles selektiert ist, ist eine kleine Position schon
+ // erlaubt.
+ Selection aSel( aOldSel );
+ aSel.Justify();
+ nCursorPos = (xub_StrLen)aSel.Min();
+ ImplPatternMaxPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nCursorPos, nNewPos );
+ aSel.Max() = nNewPos;
+ if ( bShift )
+ aSel.Min() = aOldSel.Min();
+ else
+ aSel.Min() = aSel.Max();
+ pEdit->SetSelection( aSel );
+ return TRUE;
+ }
+ else if ( (nKeyCode == KEY_BACKSPACE) || (nKeyCode == KEY_DELETE) )
+ {
+ XubString aStr( pEdit->GetText() );
+ XubString aOldStr = aStr;
+ Selection aSel = aOldSel;
+
+ aSel.Justify();
+ nNewPos = (xub_StrLen)aSel.Min();
+
+ // Wenn Selection, dann diese Loeschen
+ if ( aSel.Len() )
+ {
+ if ( bSameMask )
+ aStr.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() );
+ else
+ {
+ XubString aRep = rLiteralMask.Copy( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() );
+ aStr.Replace( (xub_StrLen)aSel.Min(), aRep.Len(), aRep );
+ }
+ }
+ else
+ {
+ if ( nKeyCode == KEY_BACKSPACE )
+ {
+ nTempPos = nNewPos;
+ nNewPos = ImplPatternLeftPos( rEditMask, nTempPos );
+ }
+ else
+ nTempPos = ImplPatternRightPos( aStr, rEditMask, nFormatFlags, bSameMask, nNewPos );
+
+ if ( nNewPos != nTempPos )
+ {
+ if ( bSameMask )
+ {
+ if ( rEditMask.GetChar( nNewPos ) != EDITMASK_LITERAL )
+ aStr.Erase( nNewPos, 1 );
+ }
+ else
+ {
+ XubString aTempStr = rLiteralMask.Copy( nNewPos, 1 );
+ aStr.Replace( nNewPos, aTempStr.Len(), aTempStr );
+ }
+ }
+ }
+
+ if ( aOldStr != aStr )
+ {
+ if ( bSameMask )
+ aStr = ImplPatternReformat( aStr, rEditMask, rLiteralMask, nFormatFlags );
+ rbInKeyInput = TRUE;
+ pEdit->SetText( aStr, Selection( nNewPos ) );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ rbInKeyInput = FALSE;
+ }
+ else
+ pEdit->SetSelection( Selection( nNewPos ) );
+
+ return TRUE;
+ }
+ else if ( nKeyCode == KEY_INSERT )
+ {
+ // InsertModus kann man beim PatternField nur einstellen,
+ // wenn Maske an jeder Eingabeposition die gleiche
+ // ist
+ if ( !bSameMask )
+ {
+ Sound::Beep();
+ return TRUE;
+ }
+ }
+ }
+
+ if ( aCode.IsControlMod() || (cChar < 32) || (cChar == 127) )
+ return FALSE;
+
+ Selection aSel = aOldSel;
+ aSel.Justify();
+ nNewPos = (xub_StrLen)aSel.Min();
+
+ if ( nNewPos < rEditMask.Len() )
+ {
+ xub_Unicode cPattChar = ImplPatternChar( cChar, rEditMask.GetChar(nNewPos) );
+ if ( cPattChar )
+ cChar = cPattChar;
+ else
+ {
+ // Wenn kein gueltiges Zeichen, dann testen wir, ob der
+ // Anwender zum naechsten Literal springen wollte. Dies machen
+ // wir nur, wenn er hinter einem Zeichen steht, damit
+ // eingebene Literale die automatisch uebersprungenen wurden
+ // nicht dazu fuehren, das der Anwender dann da steht, wo
+ // er nicht stehen wollte.
+ if ( nNewPos &&
+ (rEditMask.GetChar(nNewPos-1) != EDITMASK_LITERAL) &&
+ !aSel.Len() )
+ {
+ // Naechstes Zeichen suchen, was kein Literal ist
+ nTempPos = nNewPos;
+ while ( nTempPos < rEditMask.Len() )
+ {
+ if ( rEditMask.GetChar(nTempPos) == EDITMASK_LITERAL )
+ {
+ // Gilt nur, wenn ein Literalzeichen vorhanden
+ if ( (rEditMask.GetChar(nTempPos+1) != EDITMASK_LITERAL ) &&
+ ImplKommaPointCharEqual( cChar, rLiteralMask.GetChar(nTempPos) ) )
+ {
+ nTempPos++;
+ ImplPatternMaxPos( pEdit->GetText(), rEditMask, nFormatFlags, bSameMask, nNewPos, nTempPos );
+ if ( nTempPos > nNewPos )
+ {
+ pEdit->SetSelection( Selection( nTempPos ) );
+ return TRUE;
+ }
+ }
+ break;
+ }
+ nTempPos++;
+ }
+ }
+
+ cChar = 0;
+ }
+ }
+ else
+ cChar = 0;
+ if ( cChar )
+ {
+ XubString aStr = pEdit->GetText();
+ BOOL bError = FALSE;
+ if ( bSameMask && pEdit->IsInsertMode() )
+ {
+ // Text um Spacezeichen und Literale am Ende kuerzen, bis zur
+ // aktuellen Position
+ xub_StrLen n = aStr.Len();
+ while ( n && (n > nNewPos) )
+ {
+ if ( (aStr.GetChar( n-1 ) != ' ') &&
+ ((n > rEditMask.Len()) || (rEditMask.GetChar(n-1) != EDITMASK_LITERAL)) )
+ break;
+
+ n--;
+ }
+ aStr.Erase( n );
+
+ if ( aSel.Len() )
+ aStr.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() );
+
+ if ( aStr.Len() < rEditMask.Len() )
+ {
+ // String evtl. noch bis Cursor-Position erweitern
+ if ( aStr.Len() < nNewPos )
+ aStr += rLiteralMask.Copy( aStr.Len(), nNewPos-aStr.Len() );
+ if ( nNewPos < aStr.Len() )
+ aStr.Insert( cChar, nNewPos );
+ else if ( nNewPos < rEditMask.Len() )
+ aStr += cChar;
+ aStr = ImplPatternReformat( aStr, rEditMask, rLiteralMask, nFormatFlags );
+ }
+ else
+ bError = TRUE;
+ }
+ else
+ {
+ if ( aSel.Len() )
+ {
+ // Selection loeschen
+ XubString aRep = rLiteralMask.Copy( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() );
+ aStr.Replace( (xub_StrLen)aSel.Min(), aRep.Len(), aRep );
+ }
+
+ if ( nNewPos < aStr.Len() )
+ aStr.SetChar( nNewPos, cChar );
+ else if ( nNewPos < rEditMask.Len() )
+ aStr += cChar;
+ }
+
+ if ( bError )
+ Sound::Beep();
+ else
+ {
+ rbInKeyInput = TRUE;
+ Selection aNewSel( ImplPatternRightPos( aStr, rEditMask, nFormatFlags, bSameMask, nNewPos ) );
+ pEdit->SetText( aStr, aNewSel );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ rbInKeyInput = FALSE;
+ }
+ }
+ else
+ Sound::Beep();
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void PatternFormatter::ImplSetMask( const ByteString& rEditMask,
+ const XubString& rLiteralMask )
+{
+ maEditMask = rEditMask;
+ maLiteralMask = rLiteralMask;
+ mbSameMask = TRUE;
+
+ if ( maEditMask.Len() != maLiteralMask.Len() )
+ {
+ if ( maEditMask.Len() < maLiteralMask.Len() )
+ maLiteralMask.Erase( maEditMask.Len() );
+ else
+ maLiteralMask.Expand( maEditMask.Len(), ' ' );
+ }
+
+ // StrictModus erlaubt nur Input-Mode, wenn als Maske nur
+ // gleiche Zeichen zugelassen werden und als Vorgabe nur
+ // Spacezeichen vorgegeben werden, die durch die Maske
+ // nicht zugelassen sind
+ xub_StrLen i = 0;
+ sal_Char c = 0;
+ while ( i < rEditMask.Len() )
+ {
+ sal_Char cTemp = rEditMask.GetChar( i );
+ if ( cTemp != EDITMASK_LITERAL )
+ {
+ if ( (cTemp == EDITMASK_ALLCHAR) ||
+ (cTemp == EDITMASK_UPPERALLCHAR) ||
+ (cTemp == EDITMASK_NUMSPACE) )
+ {
+ mbSameMask = FALSE;
+ break;
+ }
+ if ( i < rLiteralMask.Len() )
+ {
+ if ( rLiteralMask.GetChar( i ) != ' ' )
+ {
+ mbSameMask = FALSE;
+ break;
+ }
+ }
+ if ( !c )
+ c = cTemp;
+ if ( cTemp != c )
+ {
+ mbSameMask = FALSE;
+ break;
+ }
+ }
+ i++;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+PatternFormatter::PatternFormatter()
+{
+ mnFormatFlags = 0;
+ mbSameMask = TRUE;
+ mbInPattKeyInput = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void PatternFormatter::ImplLoadRes( const ResId& rResId )
+{
+ ByteString aEditMask;
+ XubString aLiteralMask;
+ ResMgr* pMgr = Resource::GetResManager();
+ USHORT nMask = pMgr->ReadShort();
+
+ if ( PATTERNFORMATTER_STRICTFORMAT & nMask )
+ SetStrictFormat( (BOOL)pMgr->ReadShort() );
+
+ if ( PATTERNFORMATTER_EDITMASK & nMask )
+ aEditMask = ByteString( pMgr->ReadString(), RTL_TEXTENCODING_ASCII_US );
+
+ if ( PATTERNFORMATTER_LITTERALMASK & nMask )
+ aLiteralMask = pMgr->ReadString();
+
+ if ( (PATTERNFORMATTER_EDITMASK | PATTERNFORMATTER_LITTERALMASK) & nMask )
+ ImplSetMask( aEditMask, aLiteralMask );
+}
+
+// -----------------------------------------------------------------------
+
+PatternFormatter::~PatternFormatter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void PatternFormatter::SetMask( const ByteString& rEditMask,
+ const XubString& rLiteralMask )
+{
+ ImplSetMask( rEditMask, rLiteralMask );
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void PatternFormatter::SetString( const XubString& rStr )
+{
+ maFieldString = rStr;
+ if ( GetField() )
+ {
+ GetField()->SetText( rStr );
+ MarkToBeReformatted( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString PatternFormatter::GetString() const
+{
+ if ( !GetField() )
+ return ImplGetSVEmptyStr();
+ else
+ return ImplPatternReformat( GetField()->GetText(), maEditMask, maLiteralMask, mnFormatFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void PatternFormatter::Reformat()
+{
+ if ( GetField() )
+ {
+ ImplSetText( ImplPatternReformat( GetField()->GetText(), maEditMask, maLiteralMask, mnFormatFlags ) );
+ if ( !mbSameMask && IsStrictFormat() && !GetField()->IsReadOnly() )
+ GetField()->SetInsertMode( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void PatternFormatter::SelectFixedFont()
+{
+ if ( GetField() )
+ {
+ Font aFont = System::GetStandardFont( STDFONT_FIXED );
+ Font aControlFont;
+ aControlFont.SetName( aFont.GetName() );
+ aControlFont.SetFamily( aFont.GetFamily() );
+ aControlFont.SetPitch( aFont.GetPitch() );
+ GetField()->SetControlFont( aControlFont );
+ }
+}
+
+ // -----------------------------------------------------------------------
+
+PatternField::PatternField( Window* pParent, WinBits nWinStyle ) :
+ SpinField( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+PatternField::PatternField( Window* pParent, const ResId& rResId ) :
+ SpinField( WINDOW_PATTERNFIELD )
+{
+ rResId.SetRT( RSC_PATTERNFIELD );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ SetField( this );
+ SpinField::ImplLoadRes( rResId );
+ PatternFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+PatternField::~PatternField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long PatternField::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplPatternProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
+ IsStrictFormat(), GetFormatFlags(),
+ ImplIsSameMask(), ImplGetInPattKeyInput() ) )
+ return 1;
+ }
+
+ return SpinField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long PatternField::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return SpinField::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void PatternField::Modify()
+{
+ if ( !ImplGetInPattKeyInput() )
+ {
+ if ( IsStrictFormat() )
+ ImplPatternProcessStrictModify( GetField(), GetEditMask(), GetLiteralMask(), GetFormatFlags(), ImplIsSameMask() );
+ else
+ MarkToBeReformatted( TRUE );
+ }
+
+ SpinField::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+PatternBox::PatternBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+PatternBox::PatternBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( WINDOW_PATTERNBOX )
+{
+ rResId.SetRT( RSC_PATTERNBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+
+ SetField( this );
+ ComboBox::ImplLoadRes( rResId );
+ PatternFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+PatternBox::~PatternBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long PatternBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplPatternProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), GetEditMask(), GetLiteralMask(),
+ IsStrictFormat(), GetFormatFlags(),
+ ImplIsSameMask(), ImplGetInPattKeyInput() ) )
+ return 1;
+ }
+
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long PatternBox::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return ComboBox::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void PatternBox::Modify()
+{
+ if ( !ImplGetInPattKeyInput() )
+ {
+ if ( IsStrictFormat() )
+ ImplPatternProcessStrictModify( GetField(), GetEditMask(), GetLiteralMask(), GetFormatFlags(), ImplIsSameMask() );
+ else
+ MarkToBeReformatted( TRUE );
+ }
+
+ ComboBox::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void PatternBox::ReformatAll()
+{
+ XubString aStr;
+ SetUpdateMode( FALSE );
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT i=0; i < nEntryCount; i++ )
+ {
+ aStr = ImplPatternReformat( GetEntry( i ), GetEditMask(), GetLiteralMask(), GetFormatFlags() );
+ RemoveEntry( i );
+ InsertEntry( aStr, i );
+ }
+ PatternFormatter::Reformat();
+ SetUpdateMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void PatternBox::InsertString( const XubString& rStr, USHORT nPos )
+{
+ ComboBox::InsertEntry( ImplPatternReformat( rStr, GetEditMask(), GetLiteralMask(), GetFormatFlags() ), nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void PatternBox::RemoveString( const XubString& rStr )
+{
+ ComboBox::RemoveEntry( ImplPatternReformat( rStr, GetEditMask(), GetLiteralMask(), GetFormatFlags() ) );
+}
+
+// -----------------------------------------------------------------------
+
+XubString PatternBox::GetString( USHORT nPos ) const
+{
+ return ImplPatternReformat( ComboBox::GetEntry( nPos ), GetEditMask(), GetLiteralMask(), GetFormatFlags() );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT PatternBox::GetStringPos( const XubString& rStr ) const
+{
+ return ComboBox::GetEntryPos( ImplPatternReformat( rStr, GetEditMask(), GetLiteralMask(), GetFormatFlags() ) );
+}
+
+// =======================================================================
+
+static BOOL ImplNeed4DigitYear( USHORT nYear, const AllSettings& rSettings )
+{
+ USHORT nTwoDigitYearStart = rSettings.GetMiscSettings().GetTwoDigitYearStart();
+
+ // Wenn Jahr nicht im 2stelligen Grenzbereich liegt,
+ if ( (nYear < nTwoDigitYearStart) || (nYear >= nTwoDigitYearStart+100) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplCutDayFromString( XubString& rStr, const International& )
+{
+ // Nach Zahl suchen
+ while ( rStr.Len() && !(rStr.GetChar( 0 ) >= '0' && rStr.GetChar( 0 ) <= '9') )
+ rStr.Erase( 0, 1 );
+ if ( !rStr.Len() )
+ return 0;
+ XubString aNumStr;
+ while ( rStr.Len() && (rStr.GetChar( 0 ) >= '0' && rStr.GetChar( 0 ) <= '9') )
+ {
+ aNumStr.Insert( rStr.GetChar( 0 ) );
+ rStr.Erase( 0, 1 );
+ }
+ return (USHORT)aNumStr.ToInt32();
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplCutMonthFromString( XubString& rStr, const International& rInter )
+{
+ USHORT nPos;
+
+ //Nach Monatsnamen suchen
+ for ( USHORT i=1; i <= 12; i++ )
+ {
+ const XubString& rMonthName = rInter.GetMonthText( i );
+ // Voller Monatsname ?
+ nPos = rStr.Search( rMonthName );
+ if ( nPos != STRING_NOTFOUND )
+ {
+ rStr.Erase( 0, nPos + rMonthName.Len() );
+ return i;
+ }
+ // Kurzer Monatsname ?
+ const XubString& rAbbrevMonthName = rInter.GetAbbrevMonthText( i );
+ nPos = rStr.Search( rAbbrevMonthName );
+ if ( nPos != STRING_NOTFOUND )
+ {
+ rStr.Erase( 0, nPos + rAbbrevMonthName.Len() );
+ return i;
+ }
+ }
+
+ // Nach Zahl suchen
+ while ( rStr.Len() && !(rStr.GetChar( 0 ) >= '0' && rStr.GetChar( 0 ) <= '9') )
+ rStr.Erase( 0, 1 );
+ if ( !rStr.Len() )
+ return 0;
+ XubString aNumStr;
+ while ( rStr.Len() && (rStr.GetChar( 0 ) >= '0' && rStr.GetChar( 0 ) <= '9') )
+ {
+ aNumStr.Insert( rStr.GetChar( 0 ) );
+ rStr.Erase( 0, 1 );
+ }
+ return (USHORT)aNumStr.ToInt32();
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplCutYearFromString( XubString& rStr, const International& )
+{
+ // Nach Zahl suchen
+ while ( rStr.Len() && !(rStr.GetChar( 0 ) >= '0' && rStr.GetChar( 0 ) <= '9') )
+ rStr.Erase( 0, 1 );
+ if ( !rStr.Len() )
+ return 0;
+ XubString aNumStr;
+ while ( rStr.Len() && (rStr.GetChar( 0 ) >= '0' && rStr.GetChar( 0 ) <= '9') )
+ {
+ aNumStr.Insert( rStr.GetChar( 0 ) );
+ aNumStr.Erase( 0, 1 );
+ }
+ return (USHORT)aNumStr.ToInt32();
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt,
+ BOOL bStrictFormat, BOOL bLongFormat,
+ const International& rInter )
+{
+ xub_Unicode cChar = rKEvt.GetCharCode();
+
+ if ( !bStrictFormat || bLongFormat )
+ return FALSE;
+ else
+ {
+ USHORT nGroup = rKEvt.GetKeyCode().GetGroup();
+ if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
+ (nGroup == KEYGROUP_MISC)||
+ ((cChar >= '0') && (cChar <= '9')) ||
+ (cChar == rInter.GetDateSep()) )
+ return FALSE;
+ else
+ return TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate,
+ BOOL bLongFormat, const International& rInter,
+ const AllSettings& rSettings )
+{
+ XubString aStr = rStr;
+ BOOL bStrLongFormat = FALSE;
+ xub_StrLen nSep1Pos;
+ xub_StrLen nSep2Pos;
+ USHORT mnFirst;
+ USHORT nSecond;
+ USHORT nThird;
+ Date aDate( 0, 0, 0 );
+ DateFormat eDateFormat;
+
+ if ( !rStr.Len() )
+ return FALSE;
+
+ if ( bLongFormat )
+ eDateFormat = rInter.GetLongDateFormat();
+ else
+ eDateFormat = rInter.GetDateFormat();
+
+ // Sind da Buchstaben drin ?
+
+ bStrLongFormat = isAlphaType( ImplGetCharClass()->getStringType( aStr, 0, aStr.Len(), CreateLocale(rInter) ) );
+
+ // Bei enthaltenen Buchstaben gehen wir davon aus, das ein langes
+ // Datumsformat eingegeben wurde
+ if ( bStrLongFormat )
+ {
+ switch( eDateFormat )
+ {
+ case MDY:
+ mnFirst = ImplCutMonthFromString( aStr, rInter );
+ nSecond = ImplCutDayFromString( aStr, rInter );
+ nThird = ImplCutYearFromString( aStr, rInter );
+ break;
+ case DMY:
+ mnFirst = ImplCutDayFromString( aStr, rInter );
+ nSecond = ImplCutMonthFromString( aStr, rInter );
+ nThird = ImplCutYearFromString( aStr, rInter );
+ break;
+ case YMD:
+ default:
+ mnFirst = ImplCutYearFromString( aStr, rInter );
+ nSecond = ImplCutMonthFromString( aStr, rInter );
+ nThird = ImplCutDayFromString( aStr, rInter );
+ break;
+ }
+ }
+ else
+ {
+ // Nach Separatoren suchen
+ XubString aSepStr( RTL_CONSTASCII_USTRINGPARAM( ",.;:-/" ) );
+
+ // Die obigen Zeichen durch das Separatorzeichen ersetzen
+ for ( xub_StrLen i = 0; i < aSepStr.Len(); i++ )
+ {
+ if ( aSepStr.GetChar( i ) == rInter.GetDateSep() )
+ continue;
+ for ( xub_StrLen j = 0; j < aStr.Len(); j++ )
+ {
+ if ( aStr.GetChar( j ) == aSepStr.GetChar( i ) )
+ aStr.SetChar( j, rInter.GetDateSep() );
+ }
+ }
+
+ nSep1Pos = aStr.Search( rInter.GetDateSep() );
+ if ( nSep1Pos == STRING_NOTFOUND )
+ return FALSE;
+ nSep2Pos = aStr.Search( rInter.GetDateSep(), nSep1Pos+1 );
+
+ // Kein Jahr eingegeben ?
+ if ( nSep2Pos == STRING_NOTFOUND )
+ {
+ switch( eDateFormat )
+ {
+ case DMY:
+ case MDY:
+ nSep2Pos = aStr.Len();
+ aStr += rInter.GetDateSep();
+ aStr += aDate.GetYear();
+ break;
+ default:
+ case YMD:
+ {
+ nSep2Pos = nSep1Pos;
+ XubString aYearStr( aDate.GetYear() );
+ nSep2Pos = aYearStr.Len();
+ aStr.Insert( rInter.GetDateSep(), 0 );
+ aStr.Insert( aYearStr, 0 );
+ }
+ break;
+ }
+ }
+
+ mnFirst = (USHORT)aStr.Copy( 0, nSep1Pos ).ToInt32();
+ aStr.Erase( 0, nSep1Pos+1 );
+ nSecond = (USHORT)aStr.Copy( 0, nSep2Pos-nSep1Pos-1 ).ToInt32();
+ aStr.Erase( 0, nSep2Pos-nSep1Pos-1+1 );
+ nThird = (USHORT)aStr.ToInt32();
+ }
+
+ switch ( eDateFormat )
+ {
+ case MDY:
+ if ( !nSecond || !mnFirst )
+ return FALSE;
+ aDate = Date( nSecond, mnFirst, nThird );
+ break;
+ case DMY:
+ if ( !mnFirst || !nSecond )
+ return FALSE;
+ aDate = Date( mnFirst, nSecond, nThird );
+ break;
+ default:
+ case YMD:
+ if ( !nSecond || !nThird )
+ return FALSE;
+ aDate = Date( nThird, nSecond, mnFirst );
+ break;
+ }
+
+ DateFormatter::ExpandCentury( aDate, rSettings.GetMiscSettings().GetTwoDigitYearStart() );
+ if ( (aDate.GetDay() > 31) || (aDate.GetMonth() > 12) )
+ return FALSE;
+ if ( !aDate.IsValid() )
+ return FALSE;
+ rDate = aDate;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr,
+ const AllSettings& rSettings )
+{
+ Date aDate( 0, 0, 0 );
+ if ( !ImplDateGetValue( rStr, aDate, mbLongFormat, GetInternational(), GetFieldSettings() ) )
+ return TRUE;
+
+ Date aTempDate = aDate;
+ if ( aTempDate > GetMax() )
+ aTempDate = GetMax();
+ else if ( aTempDate < GetMin() )
+ aTempDate = GetMin();
+
+ if ( GetErrorHdl().IsSet() && (aDate != aTempDate) )
+ {
+ maCorrectedDate = aTempDate;
+ if( !GetErrorHdl().Call( this ) )
+ {
+ maCorrectedDate = Date();
+ return FALSE;
+ }
+ else
+ maCorrectedDate = Date();
+ }
+
+ rOutStr = ImplGetDateAsText( aTempDate, rSettings );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+XubString DateFormatter::ImplGetDateAsText( const Date& rDate,
+ const AllSettings& rSettings ) const
+{
+ XubString aDateAsText;
+
+ International aIntn = GetInternational();
+ BOOL b4DigitYear = ImplNeed4DigitYear( rDate.GetYear(), rSettings );
+ if ( mbLongFormat )
+ {
+ if ( b4DigitYear && !aIntn.IsLongDateCentury() )
+ aIntn.SetLongDateCentury( TRUE );
+ aDateAsText = aIntn.GetLongDate( rDate );
+ }
+ else
+ {
+ if ( b4DigitYear && !aIntn.IsDateCentury() )
+ aIntn.SetDateCentury( TRUE );
+ aDateAsText = aIntn.GetDate( rDate );
+ }
+
+ return aDateAsText;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDateIncrementDay( Date& rDate, BOOL bUp )
+{
+ DateFormatter::ExpandCentury( rDate );
+
+ if ( bUp )
+ {
+ if ( (rDate.GetDay() != 31) || (rDate.GetMonth() != 12) || (rDate.GetYear() != 9999) )
+ rDate++;
+ }
+ else
+ {
+ if ( (rDate.GetDay() != 1 ) || (rDate.GetMonth() != 1) || (rDate.GetYear() != 0) )
+ rDate--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDateIncrementMonth( Date& rDate, BOOL bUp )
+{
+ DateFormatter::ExpandCentury( rDate );
+
+ USHORT nMonth = rDate.GetMonth();
+ USHORT nYear = rDate.GetYear();
+ if ( bUp )
+ {
+ if ( (nMonth == 12) && (nYear < 9999) )
+ {
+ rDate.SetMonth( 1 );
+ rDate.SetYear( nYear + 1 );
+ }
+ else
+ {
+ if ( nMonth < 12 )
+ rDate.SetMonth( nMonth + 1 );
+ }
+ }
+ else
+ {
+ if ( (nMonth == 1) && (nYear > 0) )
+ {
+ rDate.SetMonth( 12 );
+ rDate.SetYear( nYear - 1 );
+ }
+ else
+ {
+ if ( nMonth > 1 )
+ rDate.SetMonth( nMonth - 1 );
+ }
+ }
+
+ USHORT nDaysInMonth = rDate.GetDaysInMonth();
+ if ( rDate.GetDay() > nDaysInMonth )
+ rDate.SetDay( nDaysInMonth );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDateIncrementYear( Date& rDate, BOOL bUp )
+{
+ DateFormatter::ExpandCentury( rDate );
+
+ USHORT nYear = rDate.GetYear();
+ if ( bUp )
+ {
+ if ( nYear < 9999 )
+ rDate.SetYear( nYear + 1 );
+ }
+ else
+ {
+ if ( nYear > 0 )
+ rDate.SetYear( nYear - 1 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::ImplDateSpinArea( BOOL bUp )
+{
+ // Wenn alles selektiert ist, Tage hochzaehlen
+ if ( GetField() )
+ {
+ Date aDate( GetDate() );
+ Selection aSelection = GetField()->GetSelection();
+ aSelection.Justify();
+ XubString aText( GetText() );
+ if ( (xub_StrLen)aSelection.Len() == aText.Len() )
+ ImplDateIncrementDay( aDate, bUp );
+ else
+ {
+ xub_StrLen nDateArea = 0;
+
+ DateFormat eFormat;
+ if ( IsLongFormat() )
+ eFormat = GetInternational().GetLongDateFormat();
+ else
+ eFormat = GetInternational().GetDateFormat();
+
+ if ( !IsLongFormat() )
+ {
+ // Area suchen
+ xub_StrLen nPos = 0;
+ for ( xub_StrLen i = 1; i <= 3; i++ )
+ {
+ nPos = aText.Search( GetInternational().GetDateSep(), nPos );
+ if ( nPos >= (USHORT)aSelection.Max() )
+ {
+ nDateArea = i;
+ break;
+ }
+ else
+ nPos++;
+ }
+ }
+ else
+ nDateArea = 1;
+
+ switch( eFormat )
+ {
+ case MDY:
+ switch( nDateArea )
+ {
+ case 1: ImplDateIncrementMonth( aDate, bUp );
+ break;
+ case 2: ImplDateIncrementDay( aDate, bUp );
+ break;
+ case 3: ImplDateIncrementYear( aDate, bUp );
+ break;
+ }
+ break;
+ case DMY:
+ switch( nDateArea )
+ {
+ case 1: ImplDateIncrementDay( aDate, bUp );
+ break;
+ case 2: ImplDateIncrementMonth( aDate, bUp );
+ break;
+ case 3: ImplDateIncrementYear( aDate, bUp );
+ break;
+ }
+ break;
+ case YMD:
+ switch( nDateArea )
+ {
+ case 1: ImplDateIncrementYear( aDate, bUp );
+ break;
+ case 2: ImplDateIncrementMonth( aDate, bUp );
+ break;
+ case 3: ImplDateIncrementDay( aDate, bUp );
+ break;
+ }
+ break;
+ }
+ }
+
+ ImplNewFieldValue( aDate );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::ImplInit()
+{
+ mbLongFormat = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+DateFormatter::DateFormatter() :
+ maMin( 1, 1, 1900 ),
+ maMax( 31, 12, 2200 ),
+ maFieldDate( 0 ),
+ maLastDate( 0 )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::ImplLoadRes( const ResId& )
+{
+ ResMgr* pMgr = Resource::GetResManager();
+ USHORT nMask = pMgr->ReadShort();
+
+ if ( DATEFORMATTER_MIN & nMask )
+ {
+ maMin = Date( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE*)pMgr->GetClass() ) );
+ }
+ if ( DATEFORMATTER_MAX & nMask )
+ {
+ maMax = Date( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE*)pMgr->GetClass() ) );
+ }
+ if ( DATEFORMATTER_LONGFORMAT & nMask )
+ mbLongFormat = (BOOL)pMgr->ReadShort();
+
+ if ( DATEFORMATTER_STRICTFORMAT & nMask )
+ SetStrictFormat( (BOOL)pMgr->ReadShort() );
+
+ if ( DATEFORMATTER_I12 & nMask )
+ {
+ SetInternational( International( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE*)pMgr->GetClass() ) );
+ }
+ if ( DATEFORMATTER_VALUE & nMask )
+ {
+ maFieldDate = Date( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE*)pMgr->GetClass() ) );
+ if ( maFieldDate > maMax )
+ maFieldDate = maMax;
+ if ( maFieldDate < maMin )
+ maFieldDate = maMin;
+ maLastDate = maFieldDate;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+DateFormatter::~DateFormatter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::ReformatAll()
+{
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::SetMin( const Date& rNewMin )
+{
+ maMin = rNewMin;
+ if ( !IsEmptyFieldValue() )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::SetMax( const Date& rNewMax )
+{
+ maMax = rNewMax;
+ if ( !IsEmptyFieldValue() )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::SetLongFormat( BOOL bLong )
+{
+ mbLongFormat = bLong;
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::SetDate( const Date& rNewDate )
+{
+ SetUserDate( rNewDate );
+ maFieldDate = maLastDate;
+ maLastDate = GetDate();
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::SetUserDate( const Date& rNewDate )
+{
+ ImplSetUserDate( rNewDate );
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::ImplSetUserDate( const Date& rNewDate, Selection* pNewSelection )
+{
+ Date aNewDate = rNewDate;
+ if ( aNewDate > maMax )
+ aNewDate = maMax;
+ else if ( aNewDate < maMin )
+ aNewDate = maMin;
+ maLastDate = aNewDate;
+
+ if ( GetField() )
+ ImplSetText( ImplGetDateAsText( aNewDate, GetFieldSettings() ), pNewSelection );
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::ImplNewFieldValue( const Date& rDate )
+{
+ if ( GetField() )
+ {
+ Selection aSelection = GetField()->GetSelection();
+ aSelection.Justify();
+ XubString aText = GetField()->GetText();
+ // Wenn bis ans Ende selektiert war, soll das auch so bleiben...
+ if ( (xub_StrLen)aSelection.Max() == aText.Len() )
+ {
+ if ( !aSelection.Len() )
+ aSelection.Min() = SELECTION_MAX;
+ aSelection.Max() = SELECTION_MAX;
+ }
+
+ Date aOldLastDate = maLastDate;
+ ImplSetUserDate( rDate, &aSelection );
+ maLastDate = aOldLastDate;
+
+ // Modify am Edit wird nur bei KeyInput gesetzt...
+ if ( GetField()->GetText() != aText )
+ {
+ GetField()->SetModifyFlag();
+ GetField()->Modify();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Date DateFormatter::GetDate() const
+{
+ Date aDate( 0, 0, 0 );
+
+ if ( GetField() )
+ {
+ if ( ImplDateGetValue( GetField()->GetText(), aDate,
+ mbLongFormat, GetInternational(),
+ GetFieldSettings() ) )
+ {
+ if ( aDate > maMax )
+ aDate = maMax;
+ else if ( aDate < maMin )
+ aDate = maMin;
+ }
+ else
+ {
+ // !!! TH-18.2.99: Wenn wir Zeit haben sollte einmal
+ // !!! geklaert werden, warum dieses beim Datum gegenueber
+ // !!! allen anderen Feldern anders behandelt wird.
+ // !!! Siehe dazu Bug: 52304
+
+ if ( maLastDate.GetDate() )
+ aDate = maLastDate;
+ else if ( !IsEmptyFieldValueEnabled() )
+ aDate = Date();
+ }
+ }
+
+ return aDate;
+}
+
+// -----------------------------------------------------------------------
+
+Date DateFormatter::GetRealDate() const
+{
+ // !!! TH-18.2.99: Wenn wir Zeit haben sollte dieses auch einmal
+ // !!! fuer die Numeric-Klassen eingebaut werden.
+
+ Date aDate( 0, 0, 0 );
+
+ if ( GetField() )
+ {
+ ImplDateGetValue( GetField()->GetText(), aDate,
+ mbLongFormat, GetInternational(),
+ GetFieldSettings() );
+ }
+
+ return aDate;
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::SetEmptyDate()
+{
+ FormatterBase::SetEmptyFieldValue();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DateFormatter::IsEmptyDate() const
+{
+ BOOL bEmpty = FormatterBase::IsEmptyFieldValue();
+
+ if ( GetField() && MustBeReformatted() && IsEmptyFieldValueEnabled() )
+ {
+ if ( !GetField()->GetText().Len() )
+ {
+ bEmpty = TRUE;
+ }
+ else if ( !maLastDate.GetDate() )
+ {
+ Date aDate;
+ bEmpty = !ImplDateGetValue( GetField()->GetText(), aDate,
+ mbLongFormat, GetInternational(),
+ GetFieldSettings() );
+ }
+ }
+ return bEmpty;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DateFormatter::IsDateModified() const
+{
+ if ( ImplGetEmptyFieldValue() )
+ return !IsEmptyDate();
+ else if ( GetDate() != maFieldDate )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::Reformat()
+{
+ if ( !GetField() )
+ return;
+
+ if ( !GetField()->GetText().Len() && ImplGetEmptyFieldValue() )
+ return;
+
+ XubString aStr;
+ BOOL bOK = ImplDateReformat( GetField()->GetText(), aStr, GetFieldSettings() );
+ if( !bOK )
+ return;
+
+ if ( aStr.Len() )
+ {
+ ImplSetText( aStr );
+ ImplDateGetValue( aStr, maLastDate, mbLongFormat,
+ GetInternational(), GetFieldSettings() );
+ }
+ else
+ {
+ if ( maLastDate.GetDate() )
+ SetDate( maLastDate );
+ else if ( !IsEmptyFieldValueEnabled() )
+ SetDate( Date() );
+ else
+ {
+ ImplSetText( ImplGetSVEmptyStr() );
+ ImplGetEmptyFieldValue() = TRUE;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::ExpandCentury( Date& rDate )
+{
+ ExpandCentury( rDate, Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart() );
+}
+
+// -----------------------------------------------------------------------
+
+void DateFormatter::ExpandCentury( Date& rDate, USHORT nTwoDigitYearStart )
+{
+ USHORT nDateYear = rDate.GetYear();
+ if ( nDateYear < 100 )
+ {
+ USHORT nCentury = nTwoDigitYearStart / 100;
+ if ( nDateYear < (nTwoDigitYearStart % 100) )
+ nCentury++;
+ rDate.SetYear( nDateYear + (nCentury*100) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+DateField::DateField( Window* pParent, WinBits nWinStyle ) :
+ SpinField( pParent, nWinStyle ),
+ maFirst( GetMin() ),
+ maLast( GetMax() )
+{
+ SetField( this );
+ SetText( GetInternational().GetDate( ImplGetFieldDate() ) );
+ Reformat();
+ ResetLastDate();
+}
+
+// -----------------------------------------------------------------------
+
+DateField::DateField( Window* pParent, const ResId& rResId ) :
+ SpinField( WINDOW_DATEFIELD ),
+ maFirst( GetMin() ),
+ maLast( GetMax() )
+{
+ rResId.SetRT( RSC_DATEFIELD );
+ WinBits nStyle = ImplInitRes( rResId );
+ SpinField::ImplInit( pParent, nStyle );
+ SetField( this );
+ SetText( GetInternational().GetDate( ImplGetFieldDate() ) );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+
+ ResetLastDate();
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::ImplLoadRes( const ResId& rResId )
+{
+ SpinField::ImplLoadRes( rResId );
+ DateFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+
+ USHORT nMask = ReadShortRes();
+
+ if ( DATEFIELD_FIRST & nMask )
+ {
+ maFirst = Date( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+ if ( DATEFIELD_LAST & nMask )
+ {
+ maLast = Date( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+DateField::~DateField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long DateField::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsLongFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return SpinField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long DateField::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() )
+ {
+ // !!! TH-18.2.99: Wenn wir Zeit haben sollte einmal
+ // !!! geklaert werden, warum dieses beim Datum gegenueber
+ // !!! allen anderen Feldern anders behandelt wird.
+ // !!! Siehe dazu Bug: 52304
+
+ BOOL bTextLen = GetText().Len() != 0;
+ if ( bTextLen || !IsEmptyFieldValueEnabled() )
+ Reformat();
+ else if ( !bTextLen && IsEmptyFieldValueEnabled() )
+ {
+ ResetLastDate();
+ ImplGetEmptyFieldValue() = TRUE;
+ }
+ }
+ }
+
+ return SpinField::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SpinField::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & (SETTINGS_INTERNATIONAL | SETTINGS_MISC)) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ SpinField::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::Up()
+{
+ ImplDateSpinArea( TRUE );
+ SpinField::Up();
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::Down()
+{
+ ImplDateSpinArea( FALSE );
+ SpinField::Down();
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::First()
+{
+ ImplNewFieldValue( maFirst );
+ SpinField::First();
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::Last()
+{
+ ImplNewFieldValue( maLast );
+ SpinField::Last();
+}
+
+// -----------------------------------------------------------------------
+
+void DateField::SetExtFormat( ExtDateFieldFormat eFormat )
+{
+ Date aDate = GetDate();
+ International aInt( Application::GetAppInternational() );
+
+ BOOL bLongFormat = FALSE; // immer bis auf XTDATEF_SYSTEM_LONG
+
+ switch ( eFormat )
+ {
+ case XTDATEF_SYSTEM_SHORT:
+ {
+ }
+ break;
+ case XTDATEF_SYSTEM_SHORT_YY:
+ {
+ aInt.SetDateCentury( FALSE );
+ }
+ break;
+ case XTDATEF_SYSTEM_SHORT_YYYY:
+ {
+ aInt.SetDateCentury( TRUE );
+ }
+ break;
+ case XTDATEF_SYSTEM_LONG:
+ {
+ bLongFormat = TRUE;
+ }
+ break;
+ case XTDATEF_SHORT_DDMMYY:
+ {
+ aInt.SetDateCentury( FALSE );
+ aInt.SetDateFormat( DMY );
+ }
+ break;
+ case XTDATEF_SHORT_MMDDYY:
+ {
+ aInt.SetDateCentury( FALSE );
+ aInt.SetDateFormat( MDY );
+ }
+ break;
+ case XTDATEF_SHORT_YYMMDD:
+ {
+ aInt.SetDateCentury( FALSE );
+ aInt.SetDateFormat( YMD );
+ }
+ break;
+ case XTDATEF_SHORT_DDMMYYYY:
+ {
+ aInt.SetDateCentury( TRUE );
+ aInt.SetDateFormat( DMY );
+ }
+ break;
+ case XTDATEF_SHORT_MMDDYYYY:
+ {
+ aInt.SetDateCentury( TRUE );
+ aInt.SetDateFormat( MDY );
+ }
+ break;
+ case XTDATEF_SHORT_YYYYMMDD:
+ {
+ aInt.SetDateCentury( TRUE );
+ aInt.SetDateFormat( YMD );
+ }
+ break;
+ case XTDATEF_SHORT_YYMMDD_DIN5008:
+ {
+ aInt.SetDateCentury( FALSE );
+ aInt.SetDateSep( '-' );
+ aInt.SetDateFormat( YMD );
+ }
+ break;
+ case XTDATEF_SHORT_YYYYMMDD_DIN5008:
+ {
+ aInt.SetDateCentury( TRUE );
+ aInt.SetDateSep( '-' );
+ aInt.SetDateFormat( YMD );
+ }
+ break;
+ default: DBG_ERROR( "ExtDateFieldFormat unknown!" );
+ }
+
+ SetInternational( aInt );
+ SetLongFormat( bLongFormat );
+ if ( GetField() && GetField()->GetText().Len() )
+ SetUserDate( aDate );
+}
+
+// -----------------------------------------------------------------------
+
+DateBox::DateBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+ SetField( this );
+ SetText( GetInternational().GetDate( ImplGetFieldDate() ) );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+DateBox::DateBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( WINDOW_DATEBOX )
+{
+ rResId.SetRT( RSC_DATEBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ComboBox::ImplInit( pParent, nStyle );
+ SetField( this );
+ SetText( GetInternational().GetDate( ImplGetFieldDate() ) );
+ ComboBox::ImplLoadRes( rResId );
+ DateFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ Reformat();
+
+ if ( !( nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+DateBox::~DateBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long DateBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplDateProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), IsLongFormat(), GetInternational() ) )
+ return 1;
+ }
+
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void DateBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ComboBox::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+long DateBox::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() )
+ {
+ BOOL bTextLen = GetText().Len() != 0;
+ if ( bTextLen || !IsEmptyFieldValueEnabled() )
+ Reformat();
+ else if ( !bTextLen && IsEmptyFieldValueEnabled() )
+ {
+ ResetLastDate();
+ ImplGetEmptyFieldValue() = TRUE;
+ }
+ }
+ }
+
+ return ComboBox::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void DateBox::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ ComboBox::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void DateBox::ReformatAll()
+{
+ XubString aStr;
+ SetUpdateMode( FALSE );
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT i=0; i < nEntryCount; i++ )
+ {
+ ImplDateReformat( GetEntry( i ), aStr, GetFieldSettings() );
+ RemoveEntry( i );
+ InsertEntry( aStr, i );
+ }
+ DateFormatter::Reformat();
+ SetUpdateMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void DateBox::InsertDate( const Date& rDate, USHORT nPos )
+{
+ Date aDate = rDate;
+ if ( aDate > GetMax() )
+ aDate = GetMax();
+ else if ( aDate < GetMin() )
+ aDate = GetMin();
+
+ ComboBox::InsertEntry( ImplGetDateAsText( aDate, GetFieldSettings() ), nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void DateBox::RemoveDate( const Date& rDate )
+{
+ ComboBox::RemoveEntry( ImplGetDateAsText( rDate, GetFieldSettings() ) );
+}
+
+// -----------------------------------------------------------------------
+
+Date DateBox::GetDate( USHORT nPos ) const
+{
+ Date aDate( 0, 0, 0 );
+ ImplDateGetValue( ComboBox::GetEntry( nPos ), aDate, IsLongFormat(),
+ GetInternational(), GetSettings() );
+ return aDate;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT DateBox::GetDatePos( const Date& rDate ) const
+{
+ XubString aStr;
+ if ( IsLongFormat() )
+ aStr = GetInternational().GetLongDate( rDate );
+ else
+ aStr = GetInternational().GetDate( rDate );
+ return ComboBox::GetEntryPos( aStr );
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplTimeProcessKeyInput( Edit*, const KeyEvent& rKEvt,
+ BOOL bStrictFormat, BOOL bDuration,
+ TimeFieldFormat eFormat,
+ const International& rInter )
+{
+ xub_Unicode cChar = rKEvt.GetCharCode();
+
+ if ( !bStrictFormat )
+ return FALSE;
+ else
+ {
+ USHORT nGroup = rKEvt.GetKeyCode().GetGroup();
+ if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
+ (nGroup == KEYGROUP_MISC) ||
+ ((cChar >= '0') && (cChar <= '9')) ||
+ (cChar == rInter.GetTimeSep()) ||
+ ((eFormat == TIMEF_100TH_SEC) && (cChar == rInter.GetTime100SecSep())) ||
+ ((eFormat == TIMEF_SEC_CS) && (cChar == rInter.GetTime100SecSep())) ||
+ (bDuration && (cChar == '-')) )
+ return FALSE;
+ else
+ return TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplTimeGetValue( const XubString& rStr, Time& rTime,
+ TimeFieldFormat eTimeFormat, BOOL bDuration,
+ const International& rInter )
+{
+ XubString aStr = rStr;
+ short nHour = 0;
+ short nMinute = 0;
+ short nSecond = 0;
+ short n100Sec = 0;
+ Time aTime( 0, 0, 0 );
+
+ if ( !rStr.Len() )
+ return FALSE;
+
+ // Nach Separatoren suchen
+ XubString aSepStr( RTL_CONSTASCII_USTRINGPARAM( ",.;:/" ) );
+ if ( !bDuration )
+ aSepStr.Append( '-' );
+
+ // Die obigen Zeichen durch das Separatorzeichen ersetzen
+ for ( xub_StrLen i = 0; i < aSepStr.Len(); i++ )
+ {
+ if ( aSepStr.GetChar( i ) == rInter.GetTimeSep() )
+ continue;
+ for ( xub_StrLen j = 0; j < aStr.Len(); j++ )
+ {
+ if ( aStr.GetChar( j ) == aSepStr.GetChar( i ) )
+ aStr.SetChar( j, rInter.GetTimeSep() );
+ }
+ }
+
+ BOOL bNegative = FALSE;
+ xub_StrLen nSepPos = aStr.Search( rInter.GetTimeSep() );
+ if ( aStr.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ if ( eTimeFormat != TIMEF_SEC_CS )
+ {
+ if ( nSepPos == STRING_NOTFOUND )
+ return FALSE;
+ nHour = (short)aStr.Copy( 0, nSepPos ).ToInt32();
+ aStr.Erase( 0, nSepPos+1 );
+
+ nSepPos = aStr.Search( rInter.GetTimeSep() );
+ if ( aStr.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ if ( nSepPos != STRING_NOTFOUND )
+ {
+ nMinute = (short)aStr.Copy( 0, nSepPos ).ToInt32();
+ aStr.Erase( 0, nSepPos+1 );
+
+ nSepPos = aStr.Search( rInter.GetTimeSep() );
+ if ( aStr.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ if ( nSepPos != STRING_NOTFOUND )
+ {
+ nSecond = (short)aStr.Copy( 0, nSepPos ).ToInt32();
+ aStr.Erase( 0, nSepPos+1 );
+ if ( aStr.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ n100Sec = (short)aStr.ToInt32();
+ }
+ else
+ nSecond = (short)aStr.ToInt32();
+ }
+ else
+ nMinute = (short)aStr.ToInt32();
+ }
+ else if ( nSepPos == STRING_NOTFOUND )
+ {
+ nSecond = (short)aStr.ToInt32();
+ nMinute += nSecond / 60;
+ nSecond %= 60;
+ nHour += nMinute / 60;
+ nMinute %= 60;
+ }
+ else
+ {
+ nSecond = (short)aStr.Copy( 0, nSepPos ).ToInt32();
+ aStr.Erase( 0, nSepPos+1 );
+
+ nSepPos = aStr.Search( rInter.GetTimeSep() );
+ if ( aStr.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ if ( nSepPos != STRING_NOTFOUND )
+ {
+ nMinute = nSecond;
+ nSecond = (short)aStr.Copy( 0, nSepPos ).ToInt32();
+ aStr.Erase( 0, nSepPos+1 );
+
+ nSepPos = aStr.Search( rInter.GetTimeSep() );
+ if ( aStr.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ if ( nSepPos != STRING_NOTFOUND )
+ {
+ nHour = nMinute;
+ nMinute = nSecond;
+ nSecond = (short)aStr.Copy( 0, nSepPos ).ToInt32();
+ aStr.Erase( 0, nSepPos+1 );
+ }
+ else
+ {
+ nHour += nMinute / 60;
+ nMinute %= 60;
+ }
+ }
+ else
+ {
+ nMinute += nSecond / 60;
+ nSecond %= 60;
+ nHour += nMinute / 60;
+ nMinute %= 60;
+ }
+ n100Sec = (short)aStr.ToInt32();
+
+ if ( n100Sec )
+ {
+ xub_StrLen nLen = 1; // mindestens eine Ziffer, weil sonst n100Sec==0
+
+ while ( aStr.GetChar(nLen) >= '0' && aStr.GetChar(nLen) <= '9' )
+ nLen++;
+
+ if ( nLen > 2 )
+ {
+ while( nLen > 3 )
+ {
+ n100Sec = n100Sec / 10;
+ nLen--;
+ }
+ // Rundung bei negativen Zahlen???
+ n100Sec = (n100Sec + 5) / 10;
+ }
+ else
+ {
+ while( nLen < 2 )
+ {
+ n100Sec = n100Sec * 10;
+ nLen++;
+ }
+ }
+ }
+ }
+
+ if ( (nMinute > 59) || (nSecond > 59) || (n100Sec > 100) )
+ return FALSE;
+
+ if ( eTimeFormat == TIMEF_NONE )
+ nSecond = n100Sec = 0;
+ else if ( eTimeFormat == TIMEF_SEC )
+ n100Sec = 0;
+
+ if ( !bDuration )
+ {
+ if ( bNegative || (nHour < 0) || (nMinute < 0) ||
+ (nSecond < 0) || (n100Sec < 0) )
+ return FALSE;
+
+ aStr.ToUpperAscii();
+ XubString aAM( rInter.GetTimeAM() );
+ XubString aPM( rInter.GetTimePM() );
+ aAM.ToUpperAscii();
+ aPM.ToUpperAscii();
+
+ if ( (aStr.Search( aPM ) != STRING_NOTFOUND) && (nHour < 12) )
+ nHour += 12;
+ if ( (aStr.Search( aAM ) != STRING_NOTFOUND) && (nHour == 12) )
+ nHour = 0;
+
+ aTime = Time( (USHORT)nHour, (USHORT)nMinute, (USHORT)nSecond,
+ (USHORT)n100Sec );
+ }
+ else
+ {
+ if ( bNegative || (nHour < 0) || (nMinute < 0) ||
+ (nSecond < 0) || (n100Sec < 0) )
+ {
+ bNegative = TRUE;
+ nHour = nHour < 0 ? -nHour : nHour;
+ nMinute = nMinute < 0 ? -nMinute : nMinute;
+ nSecond = nSecond < 0 ? -nSecond : nSecond;
+ n100Sec = n100Sec < 0 ? -n100Sec : n100Sec;
+ }
+
+ aTime = Time( (USHORT)nHour, (USHORT)nMinute, (USHORT)nSecond,
+ (USHORT)n100Sec );
+ if ( bNegative )
+ aTime = -aTime;
+ }
+
+ rTime = aTime;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TimeFormatter::ImplTimeReformat( const XubString& rStr, XubString& rOutStr )
+{
+ Time aTime( 0, 0, 0 );
+ if ( !ImplTimeGetValue( rStr, aTime, meFormat, mbDuration, GetInternational() ) )
+ return TRUE;
+
+ Time aTempTime = aTime;
+ if ( aTempTime > GetMax() )
+ aTempTime = GetMax() ;
+ else if ( aTempTime < GetMin() )
+ aTempTime = GetMin();
+
+ if ( GetErrorHdl().IsSet() && (aTime != aTempTime) )
+ {
+ maCorrectedTime = aTempTime;
+ if ( !GetErrorHdl().Call( this ) )
+ {
+ maCorrectedTime = Time();
+ return FALSE;
+ }
+ else
+ maCorrectedTime = Time();
+ }
+
+ BOOL bSecond = FALSE;
+ BOOL b100Sec = FALSE;
+ if ( meFormat != TIMEF_NONE )
+ bSecond = TRUE;
+ if ( meFormat == TIMEF_100TH_SEC )
+ b100Sec = TRUE;
+
+ if ( meFormat == TIMEF_SEC_CS )
+ {
+ ULONG n = aTempTime.GetHour() * 3600L;
+ n += aTempTime.GetMin() * 60L;
+ n += aTempTime.GetSec();
+ rOutStr = String::CreateFromInt32( n );
+ rOutStr += GetInternational().GetTime100SecSep();
+ if ( aTempTime.Get100Sec() < 10 )
+ rOutStr += '0';
+ rOutStr += String::CreateFromInt32( aTempTime.Get100Sec() );
+ }
+ else if ( mbDuration )
+ rOutStr = GetInternational().GetDuration( aTempTime, bSecond, b100Sec );
+ else
+ rOutStr = GetInternational().GetTime( aTempTime, bSecond, b100Sec );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::ImplTimeSpinArea( BOOL bUp )
+{
+ if ( GetField() )
+ {
+ xub_StrLen nTimeArea = 0;
+ xub_StrLen nPos;
+
+ Time aTime( GetTime() );
+ XubString aText( GetText() );
+ Selection aSelection( GetField()->GetSelection() );
+
+ // Area suchen
+ if ( meFormat != TIMEF_SEC_CS )
+ {
+ for ( xub_StrLen i = 1, nPos = 0; i <= 4; i++ )
+ {
+ xub_StrLen nPos1 = aText.Search( GetInternational().GetTimeSep(), nPos );
+ xub_StrLen nPos2 = aText.Search( GetInternational().GetTime100SecSep(), nPos );
+ nPos = nPos1 < nPos2 ? nPos1 : nPos2;
+ if ( nPos >= (xub_StrLen)aSelection.Max() )
+ {
+ nTimeArea = i;
+ break;
+ }
+ else
+ nPos++;
+ }
+ }
+ else
+ {
+ nPos = aText.Search( GetInternational().GetTime100SecSep() );
+ if ( nPos == STRING_NOTFOUND || nPos >= (xub_StrLen)aSelection.Max() )
+ nTimeArea = 3;
+ else
+ nTimeArea = 4;
+ }
+
+ if ( nTimeArea )
+ {
+ Time aAddTime( 0, 0, 0 );
+ if ( nTimeArea == 1 )
+ aAddTime = Time( 1, 0 );
+ else if ( nTimeArea == 2 )
+ aAddTime = Time( 0, 1 );
+ else if ( nTimeArea == 3 )
+ aAddTime = Time( 0, 0, 1 );
+ else if ( nTimeArea == 4 )
+ aAddTime = Time( 0, 0, 0, 1 );
+
+ if ( !bUp )
+ aAddTime = -aAddTime;
+
+ aTime += aAddTime;
+ if ( !mbDuration )
+ {
+ Time aAbsMaxTime( 23, 59, 59, 99 );
+ if ( aTime > aAbsMaxTime )
+ aTime = aAbsMaxTime;
+ Time aAbsMinTime( 0, 0 );
+ if ( aTime < aAbsMinTime )
+ aTime = aAbsMinTime;
+ }
+ ImplNewFieldValue( aTime );
+ }
+
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::ImplInit()
+{
+ meFormat = TIMEF_NONE;
+ mbDuration = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+TimeFormatter::TimeFormatter() :
+ maMin( 0, 0 ),
+ maMax( 23, 59, 59, 99 ),
+ maFieldTime( 0, 0 ),
+ maLastTime( 0, 0 )
+{
+ ImplInit();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::ImplLoadRes( const ResId& )
+{
+ ResMgr* pMgr = Resource::GetResManager();
+ USHORT nMask = pMgr->ReadShort();
+
+ if ( TIMEFORMATTER_MIN & nMask )
+ {
+ SetMin( Time( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ }
+
+ if ( TIMEFORMATTER_MAX & nMask )
+ {
+ SetMax( Time( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ }
+
+ if ( TIMEFORMATTER_TIMEFIELDFORMAT & nMask )
+ meFormat = (TimeFieldFormat)pMgr->ReadShort();
+
+ if ( TIMEFORMATTER_DURATION & nMask )
+ mbDuration = (BOOL)pMgr->ReadShort();
+
+ if ( TIMEFORMATTER_STRICTFORMAT & nMask )
+ SetStrictFormat( (BOOL)pMgr->ReadShort() );
+
+ if ( TIMEFORMATTER_I12 & nMask )
+ {
+ SetInternational( International( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ }
+
+ if ( TIMEFORMATTER_VALUE & nMask )
+ {
+ maFieldTime = Time( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ if ( maFieldTime > GetMax() )
+ maFieldTime = GetMax();
+ if ( maFieldTime < GetMin() )
+ maFieldTime = GetMin();
+ maLastTime = maFieldTime;
+
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+TimeFormatter::~TimeFormatter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::ReformatAll()
+{
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::SetMin( const Time& rNewMin )
+{
+ maMin = rNewMin;
+ if ( !IsEmptyFieldValue() )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::SetMax( const Time& rNewMax )
+{
+ maMax = rNewMax;
+ if ( !IsEmptyFieldValue() )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::SetFormat( TimeFieldFormat eNewFormat )
+{
+ meFormat = eNewFormat;
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::SetDuration( BOOL bNewDuration )
+{
+ mbDuration = bNewDuration;
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::SetTime( const Time& rNewTime )
+{
+ SetUserTime( rNewTime );
+ maFieldTime = maLastTime;
+ ImplGetEmptyFieldValue() = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::ImplNewFieldValue( const Time& rTime )
+{
+ if ( GetField() )
+ {
+ Selection aSelection = GetField()->GetSelection();
+ aSelection.Justify();
+ XubString aText = GetField()->GetText();
+ // Wenn bis ans Ende selektiert war, soll das auch so bleiben...
+ if ( (xub_StrLen)aSelection.Max() == aText.Len() )
+ {
+ if ( !aSelection.Len() )
+ aSelection.Min() = SELECTION_MAX;
+ aSelection.Max() = SELECTION_MAX;
+ }
+
+ Time aOldLastTime = maLastTime;
+ ImplSetUserTime( rTime, &aSelection );
+ maLastTime = aOldLastTime;
+
+ // Modify am Edit wird nur bei KeyInput gesetzt...
+ if ( GetField()->GetText() != aText )
+ {
+ GetField()->SetModifyFlag();
+ GetField()->Modify();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::ImplSetUserTime( const Time& rNewTime, Selection* pNewSelection )
+{
+ Time aNewTime = rNewTime;
+ if ( aNewTime > GetMax() )
+ aNewTime = GetMax();
+ else if ( aNewTime < GetMin() )
+ aNewTime = GetMin();
+ maLastTime = aNewTime;
+
+ if ( GetField() )
+ {
+ XubString aStr;
+ BOOL bSec = FALSE;
+ BOOL b100Sec = FALSE;
+ if ( meFormat != TIMEF_NONE )
+ bSec = TRUE;
+ if ( meFormat == TIMEF_100TH_SEC || meFormat == TIMEF_SEC_CS )
+ b100Sec = TRUE;
+ if ( meFormat == TIMEF_SEC_CS )
+ {
+ ULONG n = aNewTime.GetHour() * 3600L;
+ n += aNewTime.GetMin() * 60L;
+ n += aNewTime.GetSec();
+ aStr = String::CreateFromInt32( n );
+ aStr += GetInternational().GetTime100SecSep();
+ if ( aNewTime.Get100Sec() < 10 )
+ aStr += '0';
+ aStr += String::CreateFromInt32( aNewTime.Get100Sec() );
+ }
+ else if ( mbDuration )
+ aStr = GetInternational().GetDuration( aNewTime, bSec, b100Sec );
+ else
+ aStr = GetInternational().GetTime( aNewTime, bSec, b100Sec );
+
+ ImplSetText( aStr, pNewSelection );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::SetUserTime( const Time& rNewTime )
+{
+ ImplSetUserTime( rNewTime );
+}
+
+// -----------------------------------------------------------------------
+
+Time TimeFormatter::GetTime() const
+{
+ Time aTime( 0, 0, 0 );
+
+ if ( GetField() )
+ {
+ if ( ImplTimeGetValue( GetField()->GetText(), aTime,
+ meFormat, mbDuration, GetInternational() ) )
+ {
+ if ( aTime > GetMax() )
+ aTime = GetMax();
+ else if ( aTime < GetMin() )
+ aTime = GetMin();
+ }
+ else
+ aTime = maLastTime;
+ }
+
+ return aTime;
+}
+
+// -----------------------------------------------------------------------
+
+Time TimeFormatter::GetRealTime() const
+{
+ Time aTime( 0, 0, 0 );
+
+ if ( GetField() )
+ {
+ ImplTimeGetValue( GetField()->GetText(), aTime,
+ meFormat, mbDuration, GetInternational() );
+ }
+
+ return aTime;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TimeFormatter::IsTimeModified() const
+{
+ if ( ImplGetEmptyFieldValue() )
+ return !IsEmptyTime();
+ else if ( GetTime() != maFieldTime )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void TimeFormatter::Reformat()
+{
+ if ( !GetField() )
+ return;
+
+ if ( !GetField()->GetText().Len() && ImplGetEmptyFieldValue() )
+ return;
+
+ XubString aStr;
+ BOOL bOK = ImplTimeReformat( GetField()->GetText(), aStr );
+ if ( !bOK )
+ return;
+
+ if ( aStr.Len() )
+ {
+ ImplSetText( aStr );
+ ImplTimeGetValue( aStr, maLastTime, meFormat, mbDuration, GetInternational() );
+ }
+ else
+ SetTime( maLastTime );
+}
+
+// -----------------------------------------------------------------------
+
+TimeField::TimeField( Window* pParent, WinBits nWinStyle ) :
+ SpinField( pParent, nWinStyle ),
+ maFirst( GetMin() ),
+ maLast( GetMax() )
+{
+ SetField( this );
+ SetText( GetInternational().GetTime( maFieldTime, FALSE, FALSE ) );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+TimeField::TimeField( Window* pParent, const ResId& rResId ) :
+ SpinField( WINDOW_TIMEFIELD ),
+ maFirst( GetMin() ),
+ maLast( GetMax() )
+{
+ rResId.SetRT( RSC_TIMEFIELD );
+ WinBits nStyle = ImplInitRes( rResId );
+ SpinField::ImplInit( pParent, nStyle );
+ SetField( this );
+ SetText( GetInternational().GetTime( maFieldTime, FALSE, FALSE ) );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::ImplLoadRes( const ResId& rResId )
+{
+ SpinField::ImplLoadRes( rResId );
+ TimeFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+
+ USHORT nMask = ReadShortRes();
+
+ if ( TIMEFIELD_FIRST & nMask )
+ {
+ maFirst = Time( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+ if ( TIMEFIELD_LAST & nMask )
+ {
+ maLast = Time( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+TimeField::~TimeField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long TimeField::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplTimeProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), mbDuration, meFormat, GetInternational() ) )
+ return 1;
+ }
+
+ return SpinField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long TimeField::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return SpinField::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SpinField::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ SpinField::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::Up()
+{
+ ImplTimeSpinArea( TRUE );
+ SpinField::Up();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::Down()
+{
+ ImplTimeSpinArea( FALSE );
+ SpinField::Down();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::First()
+{
+ ImplNewFieldValue( maFirst );
+ SpinField::First();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::Last()
+{
+ ImplNewFieldValue( maLast );
+ SpinField::Last();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeField::SetExtFormat( ExtTimeFieldFormat eFormat )
+{
+ Time aTime = GetTime();
+ International aInt( Application::GetAppInternational() );
+
+ switch ( eFormat )
+ {
+ case EXTTIMEF_24H_SHORT:
+ {
+ aInt.SetTimeFormat( HOUR_24 );
+ SetDuration( FALSE );
+ SetFormat( TIMEF_NONE );
+ }
+ break;
+ case EXTTIMEF_24H_LONG:
+ {
+ aInt.SetTimeFormat( HOUR_24 );
+ SetDuration( FALSE );
+ SetFormat( TIMEF_SEC );
+ }
+ break;
+ case EXTTIMEF_12H_SHORT:
+ {
+ aInt.SetTimeFormat( HOUR_12 );
+ SetDuration( FALSE );
+ SetFormat( TIMEF_NONE );
+ }
+ break;
+ case EXTTIMEF_12H_LONG:
+ {
+ aInt.SetTimeFormat( HOUR_12 );
+ SetDuration( FALSE );
+ SetFormat( TIMEF_SEC );
+ }
+ break;
+ case EXTTIMEF_DURATION_SHORT:
+ {
+ SetDuration( TRUE );
+ SetFormat( TIMEF_NONE );
+ }
+ break;
+ case EXTTIMEF_DURATION_LONG:
+ {
+ SetDuration( TRUE );
+ SetFormat( TIMEF_SEC );
+ }
+ break;
+ default: DBG_ERROR( "ExtTimeFieldFormat unknown!" );
+ }
+
+ SetInternational( aInt );
+ if ( GetField() && GetField()->GetText().Len() )
+ SetUserTime( aTime );
+}
+
+// -----------------------------------------------------------------------
+
+TimeBox::TimeBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+ SetField( this );
+ SetText( GetInternational().GetTime( maFieldTime, FALSE, FALSE ) );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+TimeBox::TimeBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( WINDOW_TIMEBOX )
+{
+ rResId.SetRT( RSC_TIMEBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ComboBox::ImplInit( pParent, nStyle );
+ SetField( this );
+ SetText( GetInternational().GetTime( maFieldTime, FALSE, FALSE ) );
+ ComboBox::ImplLoadRes( rResId );
+ TimeFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+TimeBox::~TimeBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long TimeBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) &&
+ !rNEvt.GetKeyEvent()->GetKeyCode().IsControlMod() )
+ {
+ if ( ImplTimeProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), mbDuration, meFormat, GetInternational() ) )
+ return 1;
+ }
+
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long TimeBox::Notify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == EVENT_GETFOCUS )
+ MarkToBeReformatted( FALSE );
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() && (GetText().Len() || !IsEmptyFieldValueEnabled()) )
+ Reformat();
+ }
+
+ return ComboBox::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TimeBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ ComboBox::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_INTERNATIONAL) )
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeBox::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ ComboBox::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void TimeBox::ReformatAll()
+{
+ XubString aStr;
+ SetUpdateMode( FALSE );
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT i=0; i < nEntryCount; i++ )
+ {
+ ImplTimeReformat( GetEntry( i ), aStr );
+ RemoveEntry( i );
+ InsertEntry( aStr, i );
+ }
+ TimeFormatter::Reformat();
+ SetUpdateMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void TimeBox::InsertTime( const Time& rTime, USHORT nPos )
+{
+ Time aTime = rTime;
+ if ( aTime > GetMax() )
+ aTime = GetMax();
+ else if ( aTime < GetMin() )
+ aTime = GetMin();
+
+ BOOL bSec = FALSE;
+ BOOL b100Sec = FALSE;
+ if ( meFormat == TIMEF_SEC )
+ bSec = TRUE;
+ if ( meFormat == TIMEF_100TH_SEC || meFormat == TIMEF_SEC_CS )
+ bSec = b100Sec = TRUE;
+ ComboBox::InsertEntry( GetInternational().GetTime( aTime, bSec, b100Sec ), nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void TimeBox::RemoveTime( const Time& rTime )
+{
+ BOOL bSec = FALSE;
+ BOOL b100Sec = FALSE;
+ if ( meFormat == TIMEF_SEC )
+ bSec = TRUE;
+ if ( meFormat == TIMEF_100TH_SEC || TIMEF_SEC_CS )
+ bSec = b100Sec = TRUE;
+ ComboBox::RemoveEntry( GetInternational().GetTime( rTime, bSec, b100Sec ) );
+}
+
+// -----------------------------------------------------------------------
+
+Time TimeBox::GetTime( USHORT nPos ) const
+{
+ Time aTime( 0, 0, 0 );
+ ImplTimeGetValue( ComboBox::GetEntry( nPos ), aTime,
+ meFormat, mbDuration, GetInternational() );
+ return aTime;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TimeBox::GetTimePos( const Time& rTime ) const
+{
+ BOOL bSec = FALSE;
+ BOOL b100Sec = FALSE;
+ if ( meFormat == TIMEF_SEC )
+ bSec = TRUE;
+ if ( meFormat == TIMEF_100TH_SEC || TIMEF_SEC_CS )
+ bSec = b100Sec = TRUE;
+ return ComboBox::GetEntryPos( GetInternational().GetTime( rTime, bSec, b100Sec ) );
+}
diff --git a/vcl/source/control/fixbrd.cxx b/vcl/source/control/fixbrd.cxx
new file mode 100644
index 000000000000..e7ca718c2537
--- /dev/null
+++ b/vcl/source/control/fixbrd.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * $RCSfile: fixbrd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_FIXBRD_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_FIXBRD_HXX
+#include <fixbrd.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+void FixedBorder::ImplInit( Window* pParent, WinBits nStyle )
+{
+ mnType = FIXEDBORDER_TYPE_DOUBLEOUT;
+ mbTransparent = TRUE;
+
+ nStyle = ImplInitStyle( nStyle );
+ Control::ImplInit( pParent, nStyle, NULL );
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+WinBits FixedBorder::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::ImplInitSettings()
+{
+ Window* pParent = GetParent();
+ if ( (pParent->IsChildTransparentModeEnabled() ||
+ !(pParent->GetStyle() & WB_CLIPCHILDREN) ) &&
+ !IsControlBackground() && mbTransparent )
+ {
+ SetMouseTransparent( TRUE );
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ SetMouseTransparent( FALSE );
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+FixedBorder::FixedBorder( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_FIXEDBORDER )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+FixedBorder::FixedBorder( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_FIXEDBORDER )
+{
+ rResId.SetRT( RSC_CONTROL );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+FixedBorder::~FixedBorder()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
+ const Point& rPos, const Size& rSize )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aRect( rPos, rSize );
+ USHORT nBorderStyle = mnType;
+
+ if ( (nDrawFlags & WINDOW_DRAW_MONO) ||
+ (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ nBorderStyle |= FRAME_DRAW_MONO;
+
+ DecorationView aDecoView( pDev );
+ aDecoView.DrawFrame( aRect, nBorderStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::Paint( const Rectangle& rRect )
+{
+ ImplDraw( this, 0, Point(), GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+
+ pDev->Push();
+ pDev->SetMapMode();
+ ImplDraw( pDev, nFlags, aPos, aSize );
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( (nType == STATE_CHANGE_DATA) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::SetTransparent( BOOL bTransparent )
+{
+ if ( mbTransparent != bTransparent )
+ {
+ mbTransparent = bTransparent;
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBorder::SetBorderType( USHORT nType )
+{
+ if ( mnType != nType )
+ {
+ mnType = nType;
+ Invalidate();
+ }
+}
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
new file mode 100644
index 000000000000..54cab781ebe2
--- /dev/null
+++ b/vcl/source/control/fixed.cxx
@@ -0,0 +1,1051 @@
+/*************************************************************************
+ *
+ * $RCSfile: fixed.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_FIXED_CXX
+
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_FIXED_HXX
+#include <fixed.hxx>
+#endif
+
+#include <rc.h>
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define FIXEDLINE_BORDER 12
+#define FIXEDLINE_TEXT_BORDER 2
+
+#define FIXEDTEXT_VIEW_STYLE (WB_3DLOOK | \
+ WB_LEFT | WB_CENTER | WB_RIGHT | \
+ WB_TOP | WB_VCENTER | WB_BOTTOM | \
+ WB_WORDBREAK | WB_NOLABEL | \
+ WB_INFO | WB_PATHELLIPSIS)
+#define FIXEDLINE_VIEW_STYLE (WB_3DLOOK | WB_NOLABEL)
+#define FIXEDBITMAP_VIEW_STYLE (WB_3DLOOK | \
+ WB_LEFT | WB_CENTER | WB_RIGHT | \
+ WB_TOP | WB_VCENTER | WB_BOTTOM | \
+ WB_SCALE)
+#define FIXEDIMAGE_VIEW_STYLE (WB_3DLOOK | \
+ WB_LEFT | WB_CENTER | WB_RIGHT | \
+ WB_TOP | WB_VCENTER | WB_BOTTOM | \
+ WB_SCALE)
+
+// =======================================================================
+
+static Point ImplCalcPos( WinBits nStyle, const Point& rPos,
+ const Size& rObjSize, const Size& rWinSize )
+{
+ long nX;
+ long nY;
+
+ if ( nStyle & WB_LEFT )
+ nX = 0;
+ else if ( nStyle & WB_RIGHT )
+ nX = rWinSize.Width()-rObjSize.Width();
+ else
+ nX = (rWinSize.Width()-rObjSize.Width())/2;
+
+ if ( nStyle & WB_TOP )
+ nY = 0;
+ else if ( nStyle & WB_BOTTOM )
+ nX = rWinSize.Height()-rObjSize.Height();
+ else
+ nY = (rWinSize.Height()-rObjSize.Height())/2;
+
+ if ( nStyle & WB_TOPLEFTVISIBLE )
+ {
+ if ( nX < 0 )
+ nX = 0;
+ if ( nY < 0 )
+ nY = 0;
+ }
+
+ Point aPos( nX+rPos.X(), nY+rPos.Y() );
+ return aPos;
+}
+
+// =======================================================================
+
+void FixedText::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( nStyle );
+ Control::ImplInit( pParent, nStyle, NULL );
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits FixedText::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void FixedText::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont;
+ if ( GetStyle() & WB_INFO )
+ aFont = rStyleSettings.GetInfoFont();
+ else
+ aFont = rStyleSettings.GetLabelFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ {
+ if ( GetStyle() & WB_INFO )
+ aColor = rStyleSettings.GetInfoTextColor();
+ else
+ aColor = rStyleSettings.GetLabelTextColor();
+ }
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+FixedText::FixedText( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_FIXEDTEXT )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+FixedText::FixedText( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_FIXEDTEXT )
+{
+ rResId.SetRT( RSC_TEXT );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT FixedText::ImplGetTextStyle( WinBits nWinStyle )
+{
+ USHORT nTextStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_MULTILINE | TEXT_DRAW_ENDELLIPSIS;
+
+ if ( nWinStyle & WB_RIGHT )
+ nTextStyle |= TEXT_DRAW_RIGHT;
+ else if ( nWinStyle & WB_CENTER )
+ nTextStyle |= TEXT_DRAW_CENTER;
+ else
+ nTextStyle |= TEXT_DRAW_LEFT;
+ if ( nWinStyle & WB_BOTTOM )
+ nTextStyle |= TEXT_DRAW_BOTTOM;
+ else if ( nWinStyle & WB_VCENTER )
+ nTextStyle |= TEXT_DRAW_VCENTER;
+ else
+ nTextStyle |= TEXT_DRAW_TOP;
+ if ( nWinStyle & WB_WORDBREAK )
+ nTextStyle |= TEXT_DRAW_WORDBREAK;
+ if ( nWinStyle & WB_NOLABEL )
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+
+ return nTextStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
+ const Point& rPos, const Size& rSize )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ WinBits nWinStyle = GetStyle();
+ XubString aText( GetText() );
+ USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle );
+
+ if ( nWinStyle & WB_PATHELLIPSIS )
+ {
+ nTextStyle &= ~(TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK);
+ nTextStyle |= TEXT_DRAW_PATHELLIPSIS;
+ }
+ if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC )
+ {
+ if ( nTextStyle & TEXT_DRAW_MNEMONIC )
+ {
+ aText = GetNonMnemonicString( aText );
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ }
+ }
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ }
+ if ( (nDrawFlags & WINDOW_DRAW_MONO) ||
+ (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ nTextStyle |= TEXT_DRAW_MONO;
+
+ pDev->DrawText( Rectangle( rPos, rSize ), aText, nTextStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void FixedText::Paint( const Rectangle& rRect )
+{
+ ImplDraw( this, 0, Point(), GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void FixedText::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Font aFont = GetDrawPixelFont( pDev );
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ if ( nFlags & WINDOW_DRAW_MONO )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ pDev->SetTextColor( GetTextColor() );
+ pDev->SetTextFillColor();
+
+ // Border
+ if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) )
+ {
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ pDev->SetFillColor();
+ pDev->DrawRect( Rectangle( aPos, aSize ) );
+ }
+
+ ImplDraw( pDev, nFlags, aPos, aSize );
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedText::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedText::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( (nType == STATE_CHANGE_ENABLE) ||
+ (nType == STATE_CHANGE_TEXT) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ if ( (GetPrevStyle() & FIXEDTEXT_VIEW_STYLE) !=
+ (GetStyle() & FIXEDTEXT_VIEW_STYLE) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedText::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size FixedText::CalcMinimumSize( long nMaxWidth ) const
+{
+ USHORT nStyle = ImplGetTextStyle( GetStyle() );
+ if ( !( GetStyle() & WB_NOLABEL ) )
+ nStyle |= TEXT_DRAW_MNEMONIC;
+
+ Size aSize = GetTextRect( Rectangle( Point(), Size( (nMaxWidth ? nMaxWidth : 0x7fffffff)-FIXEDLINE_BORDER, 0x7fffffff ) ),
+ GetText(), nStyle ).GetSize();
+
+ // GetTextRect verkraftet keinen leeren String:
+ if ( aSize.Width() < 0 )
+ aSize.Width() = 0;
+ if ( aSize.Height() <= 0 )
+ aSize.Height() = GetTextHeight();
+
+ return CalcWindowSize( aSize );
+}
+
+
+// =======================================================================
+
+void FixedLine::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( nStyle );
+ Control::ImplInit( pParent, nStyle, NULL );
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits FixedLine::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void FixedLine::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetGroupFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetGroupTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+FixedLine::FixedLine( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_FIXEDLINE )
+{
+ ImplInit( pParent, nStyle );
+ SetSizePixel( Size( 2, 2 ) );
+}
+
+// -----------------------------------------------------------------------
+
+FixedLine::FixedLine( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_FIXEDLINE )
+{
+ rResId.SetRT( RSC_FIXEDLINE );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedLine::Paint( const Rectangle& rRect )
+{
+ Size aOutSize = GetOutputSizePixel();
+ String aText = GetText();
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ WinBits nWinStyle = GetStyle();
+
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
+ SetLineColor( Color( COL_BLACK ) );
+ else
+ SetLineColor( rStyleSettings.GetShadowColor() );
+
+ if ( !aText.Len() || (nWinStyle & WB_VERT) )
+ {
+ long nX;
+ long nY;
+
+ if ( nWinStyle & WB_VERT )
+ {
+ nX = (aOutSize.Width()-1)/2;
+ DrawLine( Point( nX, 0 ), Point( nX, aOutSize.Height()-1 ) );
+ }
+ else
+ {
+ nY = (aOutSize.Height()-1)/2;
+ DrawLine( Point( 0, nY ), Point( aOutSize.Width()-1, nY ) );
+ }
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ SetLineColor( rStyleSettings.GetLightColor() );
+ if ( nWinStyle & WB_VERT )
+ DrawLine( Point( nX+1, 0 ), Point( nX+1, aOutSize.Height()-1 ) );
+ else
+ DrawLine( Point( 0, nY+1 ), Point( aOutSize.Width()-1, nY+1 ) );
+ }
+ }
+ else
+ {
+ USHORT nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS;
+ Rectangle aRect( FIXEDLINE_BORDER, 0, aOutSize.Width()-FIXEDLINE_BORDER, aOutSize.Height() );
+
+ if ( !IsEnabled() )
+ nStyle |= TEXT_DRAW_DISABLE;
+ if ( GetStyle() & WB_NOLABEL )
+ nStyle &= ~TEXT_DRAW_MNEMONIC;
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
+ nStyle |= TEXT_DRAW_MONO;
+
+ aRect = GetTextRect( aRect, aText, nStyle );
+ long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2);
+
+ DrawLine( Point( 0, nTop ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop ) );
+ DrawLine( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ) );
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( 0, nTop+1 ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop+1 ) );
+ DrawLine( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop+1 ), Point( aOutSize.Width()-1, nTop+1 ) );
+ }
+
+ DrawText( aRect, aText, nStyle );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedLine::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FixedLine::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedLine::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( (nType == STATE_CHANGE_ENABLE) ||
+ (nType == STATE_CHANGE_TEXT) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ if ( (GetPrevStyle() & FIXEDLINE_VIEW_STYLE) !=
+ (GetStyle() & FIXEDLINE_VIEW_STYLE) )
+ Invalidate();
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_STYLE) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedLine::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// =======================================================================
+
+void FixedBitmap::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( nStyle );
+ Control::ImplInit( pParent, nStyle, NULL );
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+WinBits FixedBitmap::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::ImplInitSettings()
+{
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ USHORT nObjMask = ReadShortRes();
+
+ if ( RSC_FIXEDBITMAP_BITMAP & nObjMask )
+ {
+ maBitmap = Bitmap( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+FixedBitmap::FixedBitmap( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_FIXEDBITMAP )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+FixedBitmap::FixedBitmap( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_FIXEDBITMAP )
+{
+ rResId.SetRT( RSC_FIXEDBITMAP );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+FixedBitmap::~FixedBitmap()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::ImplDraw( OutputDevice* pDev, ULONG /* nDrawFlags */,
+ const Point& rPos, const Size& rSize )
+{
+ // Haben wir ueberhaupt eine Bitmap
+ if ( !(!maBitmap) )
+ {
+ if ( GetStyle() & WB_SCALE )
+ pDev->DrawBitmap( rPos, rSize, maBitmap );
+ else
+ {
+ Point aPos = ImplCalcPos( GetStyle(), rPos, maBitmap.GetSizePixel(), rSize );
+ pDev->DrawBitmap( aPos, maBitmap );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::Paint( const Rectangle& rRect )
+{
+ ImplDraw( this, 0, Point(), GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Rectangle aRect( aPos, aSize );
+
+ pDev->Push();
+ pDev->SetMapMode();
+
+ // Border
+ if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) )
+ {
+ DecorationView aDecoView( pDev );
+ aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+ }
+ pDev->IntersectClipRegion( aRect );
+ ImplDraw( pDev, nFlags, aRect.TopLeft(), aRect.GetSize() );
+
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( (nType == STATE_CHANGE_DATA) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ if ( (GetPrevStyle() & FIXEDBITMAP_VIEW_STYLE) !=
+ (GetStyle() & FIXEDBITMAP_VIEW_STYLE) )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedBitmap::SetBitmap( const Bitmap& rBitmap )
+{
+ maBitmap = rBitmap;
+ StateChanged( STATE_CHANGE_DATA );
+}
+
+// =======================================================================
+
+void FixedImage::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( nStyle );
+ mbInUserDraw = FALSE;
+ Control::ImplInit( pParent, nStyle, NULL );
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+WinBits FixedImage::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::ImplInitSettings()
+{
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ USHORT nObjMask = ReadShortRes();
+
+ if ( RSC_FIXEDIMAGE_IMAGE & nObjMask )
+ {
+ maImage = Image( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+FixedImage::FixedImage( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_FIXEDIMAGE )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+FixedImage::FixedImage( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_FIXEDIMAGE )
+{
+ rResId.SetRT( RSC_FIXEDIMAGE );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+FixedImage::~FixedImage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
+ const Point& rPos, const Size& rSize )
+{
+ USHORT nStyle = 0;
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nStyle |= IMAGE_DRAW_DISABLE;
+ }
+
+ // Haben wir ueberhaupt ein Image
+ if ( !(!maImage) )
+ {
+ if ( GetStyle() & WB_SCALE )
+ pDev->DrawImage( rPos, rSize, maImage, nStyle );
+ else
+ {
+ Point aPos = ImplCalcPos( GetStyle(), rPos, maImage.GetSizePixel(), rSize );
+ pDev->DrawImage( aPos, maImage, nStyle );
+ }
+ }
+
+ mbInUserDraw = TRUE;
+ UserDrawEvent aUDEvt( pDev, Rectangle( rPos, rSize ), 0, nStyle );
+ UserDraw( aUDEvt );
+ mbInUserDraw = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::Paint( const Rectangle& rRect )
+{
+ ImplDraw( this, 0, Point(), GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::UserDraw( const UserDrawEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Rectangle aRect( aPos, aSize );
+
+ pDev->Push();
+ pDev->SetMapMode();
+
+ // Border
+ if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) )
+ {
+ DecorationView aDecoView( pDev );
+ aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+ }
+ pDev->IntersectClipRegion( aRect );
+ ImplDraw( pDev, nFlags, aRect.TopLeft(), aRect.GetSize() );
+
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( (nType == STATE_CHANGE_ENABLE) ||
+ (nType == STATE_CHANGE_DATA) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ if ( (GetPrevStyle() & FIXEDIMAGE_VIEW_STYLE) !=
+ (GetStyle() & FIXEDIMAGE_VIEW_STYLE) )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FixedImage::SetImage( const Image& rImage )
+{
+ if ( rImage != maImage )
+ {
+ maImage = rImage;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Point FixedImage::CalcImagePos( const Point& rPos,
+ const Size& rObjSize, const Size& rWinSize )
+{
+ return ImplCalcPos( GetStyle(), rPos, rObjSize, rWinSize );
+}
diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx
new file mode 100644
index 000000000000..2124a2cf6012
--- /dev/null
+++ b/vcl/source/control/group.cxx
@@ -0,0 +1,349 @@
+/*************************************************************************
+ *
+ * $RCSfile: group.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_GROUP_CXX
+
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_GROUP_HXX
+#include <group.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define GROUP_BORDER 12
+#define GROUP_TEXT_BORDER 2
+
+#define GROUP_VIEW_STYLE (WB_3DLOOK | WB_NOLABEL)
+
+// =======================================================================
+
+void GroupBox::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( nStyle );
+ Control::ImplInit( pParent, nStyle, NULL );
+ SetMouseTransparent( TRUE );
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits GroupBox::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void GroupBox::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetGroupFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetGroupTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Window* pParent = GetParent();
+ if ( (pParent->IsChildTransparentModeEnabled() ||
+ !(pParent->GetStyle() & WB_CLIPCHILDREN) ) &&
+ !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+GroupBox::GroupBox( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_GROUPBOX )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+GroupBox::GroupBox( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_GROUPBOX )
+{
+ rResId.SetRT( RSC_GROUPBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
+ const Point& rPos, const Size& rSize )
+{
+ long nTop;
+ long nTextOff;
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ XubString aText( GetText() );
+ Rectangle aRect( rPos, rSize );
+ USHORT nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_MNEMONIC;
+
+ if ( GetStyle() & WB_NOLABEL )
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ if ( nDrawFlags & WINDOW_DRAW_NOMNEMONIC )
+ {
+ if ( nTextStyle & TEXT_DRAW_MNEMONIC )
+ {
+ aText = GetNonMnemonicString( aText );
+ nTextStyle &= ~TEXT_DRAW_MNEMONIC;
+ }
+ }
+ if ( !(nDrawFlags & WINDOW_DRAW_NODISABLE) )
+ {
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ }
+ if ( (nDrawFlags & WINDOW_DRAW_MONO) ||
+ (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ nTextStyle |= TEXT_DRAW_MONO;
+ nDrawFlags |= WINDOW_DRAW_MONO;
+ }
+
+ if ( !aText.Len() )
+ {
+ nTop = rPos.Y();
+ nTextOff = 0;
+ }
+ else
+ {
+ aRect.Left() += GROUP_BORDER;
+ aRect.Right() -= GROUP_BORDER;
+ aRect = pDev->GetTextRect( aRect, aText, nTextStyle );
+ nTop = rPos.Y();
+ nTop += aRect.GetHeight() / 2;
+ nTextOff = GROUP_TEXT_BORDER;
+ }
+
+ if ( nDrawFlags & WINDOW_DRAW_MONO )
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ else
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+
+ if ( !aText.Len() )
+ pDev->DrawLine( Point( rPos.X(), nTop ), Point( rPos.X()+rSize.Width()-2, nTop ) );
+ else
+ {
+ pDev->DrawLine( Point( rPos.X(), nTop ), Point( aRect.Left()-nTextOff, nTop ) );
+ pDev->DrawLine( Point( aRect.Right()+nTextOff, nTop ), Point( rPos.X()+rSize.Width()-2, nTop ) );
+ }
+ pDev->DrawLine( Point( rPos.X(), nTop ), Point( rPos.X(), rPos.Y()+rSize.Height()-2 ) );
+ pDev->DrawLine( Point( rPos.X(), rPos.Y()+rSize.Height()-2 ), Point( rPos.X()+rSize.Width()-2, rPos.Y()+rSize.Height()-2 ) );
+ pDev->DrawLine( Point( rPos.X()+rSize.Width()-2, rPos.Y()+rSize.Height()-2 ), Point( rPos.X()+rSize.Width()-2, nTop ) );
+
+ if ( !(nDrawFlags & WINDOW_DRAW_MONO) )
+ {
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ if ( !aText.Len() )
+ pDev->DrawLine( Point( rPos.X()+1, nTop+1 ), Point( rPos.X()+rSize.Width()-3, nTop+1 ) );
+ else
+ {
+ pDev->DrawLine( Point( rPos.X()+1, nTop+1 ), Point( aRect.Left()-nTextOff, nTop+1 ) );
+ pDev->DrawLine( Point( aRect.Right()+nTextOff, nTop+1 ), Point( rPos.X()+rSize.Width()-3, nTop+1 ) );
+ }
+ pDev->DrawLine( Point( rPos.X()+1, nTop+1 ), Point( rPos.X()+1, rPos.Y()+rSize.Height()-3 ) );
+ pDev->DrawLine( Point( rPos.X(), rPos.Y()+rSize.Height()-1 ), Point( rPos.X()+rSize.Width()-1, rPos.Y()+rSize.Height()-1 ) );
+ pDev->DrawLine( Point( rPos.X()+rSize.Width()-1, rPos.Y()+rSize.Height()-1 ), Point( rPos.X()+rSize.Width()-1, nTop ) );
+ }
+
+ pDev->DrawText( aRect, aText, nTextStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void GroupBox::Paint( const Rectangle& )
+{
+ ImplDraw( this, 0, Point(), GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void GroupBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
+ ULONG nFlags )
+{
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Font aFont = GetDrawPixelFont( pDev );
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ if ( nFlags & WINDOW_DRAW_MONO )
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ else
+ pDev->SetTextColor( GetTextColor() );
+ pDev->SetTextFillColor();
+
+ ImplDraw( pDev, nFlags, aPos, aSize );
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void GroupBox::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void GroupBox::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( (nType == STATE_CHANGE_ENABLE) ||
+ (nType == STATE_CHANGE_TEXT) ||
+ (nType == STATE_CHANGE_UPDATEMODE) )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ if ( (GetPrevStyle() & GROUP_VIEW_STYLE) !=
+ (GetStyle() & GROUP_VIEW_STYLE) )
+ Invalidate();
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void GroupBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
new file mode 100644
index 000000000000..3f1b977e7eab
--- /dev/null
+++ b/vcl/source/control/ilstbox.cxx
@@ -0,0 +1,2387 @@
+/*************************************************************************
+ *
+ * $RCSfile: ilstbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_ILSTBOX_CXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SCRBAR_HXX
+#include <scrbar.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+
+#ifndef _SV_LSTBOX_H
+#include <lstbox.h>
+#endif
+#ifndef _SV_ILSTBOX_HXX
+#include <ilstbox.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+void ImplInitFieldSettings( Window* pWin, BOOL bFont, BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetFieldFont();
+ if ( pWin->IsControlFont() )
+ aFont.Merge( pWin->GetControlFont() );
+ pWin->SetZoomedPointFont( aFont );
+ }
+
+ if ( bFont || bForeground )
+ {
+ Color aTextColor = rStyleSettings.GetFieldTextColor();
+ if ( pWin->IsControlForeground() )
+ aTextColor = pWin->GetControlForeground();
+ pWin->SetTextColor( aTextColor );
+ }
+
+ if ( bBackground )
+ {
+ if( pWin->IsControlBackground() )
+ pWin->SetBackground( pWin->GetControlBackground() );
+ else
+ pWin->SetBackground( rStyleSettings.GetFieldColor() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplInitDropDownButton( PushButton* pButton )
+{
+ if ( pButton->GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN )
+ pButton->SetSymbol( SYMBOL_SPIN_UPDOWN );
+ else
+ pButton->SetSymbol( SYMBOL_SPIN_DOWN );
+}
+
+// =======================================================================
+
+ImplEntryList::ImplEntryList()
+{
+ mnLastSelected = LISTBOX_ENTRY_NOTFOUND;
+ mnSelectionAnchor = LISTBOX_ENTRY_NOTFOUND;
+ mnImages = 0;
+ mbCallSelectionChangedHdl = TRUE;
+
+ mnMRUCount = 0;
+ mnMaxMRUCount = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplEntryList::~ImplEntryList()
+{
+ Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplEntryList::Clear()
+{
+ mnImages = 0;
+ for ( USHORT n = GetEntryCount(); n; )
+ {
+ ImplEntryType* pImplEntry = GetEntry( --n );
+ delete pImplEntry;
+ }
+ List::Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplEntryList::SelectEntry( USHORT nPos, BOOL bSelect )
+{
+ ImplEntryType* pImplEntry = GetEntry( nPos );
+ if ( pImplEntry && ( pImplEntry->mbIsSelected != bSelect ) )
+ {
+ pImplEntry->mbIsSelected = bSelect;
+ if ( mbCallSelectionChangedHdl )
+ maSelectionChangedHdl.Call( (void*)nPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplEntryList::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL bSort )
+{
+ if ( !!pNewEntry->maImage )
+ mnImages++;
+
+ if ( !bSort || !Count() )
+ {
+ Insert( pNewEntry, nPos );
+ }
+ else
+ {
+ const XubString& rStr = pNewEntry->maStr;
+ ULONG nLow, nHigh, nMid;
+
+ nHigh = Count();
+
+ const International& rIntl = Application::GetSettings().GetInternational();
+ ImplEntryType* pTemp = GetEntry( (USHORT)(nHigh-1) );
+ StringCompare eComp = rIntl.Compare( rStr, pTemp->maStr );
+
+ // Schnelles Einfuegen bei sortierten Daten
+ if ( eComp != COMPARE_LESS )
+ {
+ Insert( pNewEntry, LIST_APPEND );
+ }
+ else
+ {
+ nLow = mnMRUCount;
+ pTemp = (ImplEntryType*)GetEntry( (USHORT)nLow );
+ eComp = rIntl.Compare( rStr, pTemp->maStr );
+ if ( eComp != COMPARE_GREATER )
+ {
+ Insert( pNewEntry, (ULONG)0 );
+ }
+ else
+ {
+ // Binaeres Suchen
+ nHigh--;
+ do
+ {
+ nMid = (nLow + nHigh) / 2;
+ pTemp = (ImplEntryType*)GetObject( nMid );
+ eComp = rIntl.Compare( rStr, pTemp->maStr );
+
+ if ( eComp == COMPARE_LESS )
+ nHigh = nMid-1;
+ else
+ {
+ if ( eComp == COMPARE_GREATER )
+ nLow = nMid + 1;
+ else
+ break;
+ }
+ }
+ while ( nLow <= nHigh );
+
+ if ( eComp != COMPARE_LESS )
+ nMid++;
+
+ Insert( pNewEntry, nMid );
+ }
+ }
+ }
+
+ return (USHORT)GetPos( pNewEntry );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplEntryList::RemoveEntry( USHORT nPos )
+{
+ ImplEntryType* pImplEntry = (ImplEntryType*)List::Remove( nPos );
+ if ( pImplEntry )
+ {
+ if ( !!pImplEntry->maImage )
+ mnImages--;
+
+ delete pImplEntry;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplEntryList::FindEntry( const XubString& rStr, MatchMode nMatchMode, USHORT nMatchLen, USHORT nStart, BOOL bForward ) const
+{
+ BOOL bEqual;
+ USHORT nPos = LISTBOX_ENTRY_NOTFOUND;
+ USHORT nEntryCount = GetEntryCount();
+ if ( !bForward )
+ nStart++; // wird sofort dekrementiert
+ for ( USHORT n = nStart; bForward ? ( n < nEntryCount ) : n; )
+ {
+ if ( !bForward )
+ n--;
+
+ ImplEntryType* pImplEntry = GetEntry( n );
+ if ( nMatchMode == MATCH_CASE )
+ bEqual = pImplEntry->maStr.Equals( rStr, 0, nMatchLen );
+ else
+ bEqual = pImplEntry->maStr.EqualsIgnoreCaseAscii( rStr, 0, nMatchLen );
+ if ( bEqual )
+ {
+ // Wenn Case-Insensitiv matching, dann einen Eintrag bevorzugen,
+ // der trotzdem case-sensitiv matched.
+ if ( (nMatchMode == MATCH_CASE) ||
+ ((nMatchMode == MATCH_BEST) && (pImplEntry->maStr.Equals( rStr, 0, nMatchLen ))) )
+ {
+ nPos = n;
+ break;
+ }
+ else if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = n; // Bei Case-Insensitiv gewinnt der erste, wenn keiner 100%
+ }
+
+ if ( bForward )
+ n++;
+ }
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplEntryList::FindEntry( const void* pData ) const
+{
+ USHORT nPos = LISTBOX_ENTRY_NOTFOUND;
+ for ( USHORT n = GetEntryCount(); n; )
+ {
+ ImplEntryType* pImplEntry = GetEntry( --n );
+ if ( pImplEntry->mpUserData == pData )
+ {
+ nPos = n;
+ break;
+ }
+ }
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+XubString ImplEntryList::GetEntryText( USHORT nPos ) const
+{
+ XubString aEntryText;
+ ImplEntryType* pImplEntry = GetEntry( nPos );
+ if ( pImplEntry )
+ aEntryText = pImplEntry->maStr;
+ return aEntryText;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplEntryList::HasEntryImage( USHORT nPos ) const
+{
+ BOOL bImage = FALSE;
+ ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos );
+ if ( pImplEntry )
+ bImage = !!pImplEntry->maImage;
+ return bImage;
+}
+
+// -----------------------------------------------------------------------
+
+Image ImplEntryList::GetEntryImage( USHORT nPos ) const
+{
+ Image aImage;
+ ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos );
+ if ( pImplEntry )
+ aImage = pImplEntry->maImage;
+ return aImage;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplEntryList::SetEntryData( USHORT nPos, void* pNewData )
+{
+ ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos );
+ if ( pImplEntry )
+ pImplEntry->mpUserData = pNewData;
+}
+
+// -----------------------------------------------------------------------
+
+void* ImplEntryList::GetEntryData( USHORT nPos ) const
+{
+ ImplEntryType* pImplEntry = (ImplEntryType*)List::GetObject( nPos );
+ return pImplEntry ? pImplEntry->mpUserData : NULL;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplEntryList::GetSelectEntryCount() const
+{
+ USHORT nSelCount = 0;
+ for ( USHORT n = GetEntryCount(); n; )
+ {
+ ImplEntryType* pImplEntry = GetEntry( --n );
+ if ( pImplEntry->mbIsSelected )
+ nSelCount++;
+ }
+ return nSelCount;
+}
+
+// -----------------------------------------------------------------------
+
+XubString ImplEntryList::GetSelectEntry( USHORT nIndex ) const
+{
+ return GetEntryText( GetSelectEntryPos( nIndex ) );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplEntryList::GetSelectEntryPos( USHORT nIndex ) const
+{
+ USHORT nSelEntryPos = LISTBOX_ENTRY_NOTFOUND;
+ USHORT nSel = 0;
+ USHORT nEntryCount = GetEntryCount();
+
+ for ( USHORT n = 0; n < nEntryCount; n++ )
+ {
+ ImplEntryType* pImplEntry = GetEntry( n );
+ if ( pImplEntry->mbIsSelected )
+ {
+ if ( nSel == nIndex )
+ {
+ nSelEntryPos = n;
+ break;
+ }
+ nSel++;
+ }
+ }
+
+ return nSelEntryPos;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplEntryList::IsEntrySelected( const XubString& rStr ) const
+{
+ return IsEntryPosSelected( FindEntry( rStr ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplEntryList::IsEntryPosSelected( USHORT nIndex ) const
+{
+ ImplEntryType* pImplEntry = GetEntry( nIndex );
+ return pImplEntry ? pImplEntry->mbIsSelected : FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplEntryList::SetNoSelection()
+{
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT n = 0; n < nEntryCount; n++ )
+ SelectEntry( n, FALSE );
+}
+
+// =======================================================================
+
+ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, 0 )
+{
+ mpEntryList = new ImplEntryList;
+
+ mnTop = 0;
+ mnLeft = 0;
+ mnBorder = 1;
+ mnSelectModifier = 0;
+ mnUserDrawEntry = LISTBOX_ENTRY_NOTFOUND;
+ mbTrack = FALSE;
+ mbImgsDiffSz = FALSE;
+ mbTravelSelect = FALSE;
+ mbTrackingSelect = FALSE;
+ mbSelectionChanged = FALSE;
+ mbMouseMoveSelect = FALSE;
+ mbMulti = FALSE;
+ mbGrabFocus = FALSE;
+ mbUserDrawEnabled = FALSE;
+ mbInUserDraw = FALSE;
+ mbReadOnly = FALSE;
+ mbSimpleMode = ( nWinStyle & WB_SIMPLEMODE ) ? TRUE : FALSE;
+ mbSort = ( nWinStyle & WB_SORT ) ? TRUE : FALSE;
+
+ mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
+ mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND;
+ mnSeparatorPos = LISTBOX_ENTRY_NOTFOUND;
+
+ SetLineColor();
+ SetTextFillColor();
+ SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
+
+ maSearchTimeout.SetTimeout( 500 );
+ maSearchTimeout.SetTimeoutHdl( LINK( this, ImplListBoxWindow, SearchStringTimeout ) );
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ ImplCalcMetrics();
+}
+
+// -----------------------------------------------------------------------
+
+ImplListBoxWindow::~ImplListBoxWindow()
+{
+ maSearchTimeout.Stop();
+ delete mpEntryList;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground )
+{
+ ImplInitFieldSettings( this, bFont, bForeground, bBackground );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::ImplCalcMetrics()
+{
+ mnMaxWidth = 0;
+ mnMaxTxtWidth = 0;
+ mnMaxImgWidth = 0;
+ mnMaxImgTxtWidth= 0;
+ mnMaxImgHeight = 0;
+
+ mnTextHeight = (USHORT)GetTextHeight();
+ mnMaxTxtHeight = mnTextHeight + mnBorder;
+ mnMaxHeight = mnMaxTxtHeight;
+
+ if ( maUserItemSize.Height() > mnMaxHeight )
+ mnMaxHeight = (USHORT) maUserItemSize.Height();
+ if ( maUserItemSize.Width() > mnMaxWidth )
+ mnMaxWidth= (USHORT) maUserItemSize.Width();
+
+ for ( USHORT n = mpEntryList->GetEntryCount(); n; )
+ {
+ const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( --n );
+ ImplCalcEntryMetrics( *pEntry, TRUE );
+ }
+
+ Size aSz( GetOutputSizePixel().Width(), mnMaxHeight );
+ maFocusRect.SetSize( aSz );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ImplListBoxWindow, SearchStringTimeout, Timer*, EMPTYARG )
+{
+ maSearchStr.Erase();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::Clear()
+{
+ mpEntryList->Clear();
+
+ mnMaxHeight = mnMaxTxtHeight;
+ mnMaxWidth = 0;
+ mnMaxTxtWidth = 0;
+ mnMaxImgTxtWidth= 0;
+ mnMaxImgWidth = 0;
+ mnMaxImgHeight = 0;
+ mnTop = 0;
+ mnLeft = 0;
+ mbImgsDiffSz = FALSE;
+
+ Invalidate();
+}
+
+void ImplListBoxWindow::SetUserItemSize( const Size& rSz )
+{
+ maUserItemSize = rSz;
+ ImplCalcMetrics();
+}
+
+// -----------------------------------------------------------------------
+
+struct ImplEntryMetrics
+{
+ BOOL bText;
+ BOOL bImage;
+ USHORT nEntryWidth;
+ USHORT nEntryHeight;
+ USHORT nTextWidth;
+ USHORT nImgWidth;
+ USHORT nImgHeight;
+};
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::ImplCalcEntryMetrics( const ImplEntryType& rEntry, BOOL bUpdateMetrics )
+{
+ // bUpdateMetrics: Wenn Entry groesser als Max-Wert, dann uebernehmen
+
+ // Diese Methode war mal auch fuer RemoveRentry gedacht, deshalb die
+ // ImplEntryMetrics-Struktur, damit die Werte zurueckgegeben werden.
+ // Jetzt werden die aktuellen Metriken aber doch immer angepasst, weil
+ // bei RemoveEntry einmal komplett durchgegangen wird.
+
+ ImplEntryMetrics aMetrics;
+ aMetrics.bText = rEntry.maStr.Len() ? TRUE : FALSE;
+ aMetrics.bImage = !!rEntry.maImage;
+ aMetrics.nEntryWidth = 0;
+ aMetrics.nEntryHeight = 0;
+ aMetrics.nTextWidth = 0;
+ aMetrics.nImgWidth = 0;
+ aMetrics.nImgHeight = 0;
+
+ if ( aMetrics.bText )
+ {
+ aMetrics.nTextWidth = (USHORT)GetTextWidth( rEntry.maStr );
+ if( bUpdateMetrics && ( aMetrics.nTextWidth > mnMaxTxtWidth ) )
+ mnMaxTxtWidth = aMetrics.nTextWidth;
+ aMetrics.nEntryWidth = mnMaxTxtWidth;
+ }
+ if ( aMetrics.bImage )
+ {
+ Size aImgSz = rEntry.maImage.GetSizePixel();
+ aMetrics.nImgWidth = (USHORT) CalcZoom( aImgSz.Width() );
+ aMetrics.nImgHeight = (USHORT) CalcZoom( aImgSz.Height() );
+
+ if ( bUpdateMetrics )
+ {
+ if( mnMaxImgWidth && ( aMetrics.nImgWidth != mnMaxImgWidth ) )
+ mbImgsDiffSz = TRUE;
+ else if ( mnMaxImgHeight && ( aMetrics.nImgHeight != mnMaxImgHeight ) )
+ mbImgsDiffSz = TRUE;
+
+ if( aMetrics.nImgWidth > mnMaxImgWidth )
+ mnMaxImgWidth = aMetrics.nImgWidth;
+ if( aMetrics.nImgHeight > mnMaxImgHeight )
+ mnMaxImgHeight = aMetrics.nImgHeight;
+
+ mnMaxImgTxtWidth = Max( mnMaxImgTxtWidth, aMetrics.nTextWidth );
+ }
+ }
+ if ( IsUserDrawEnabled() || aMetrics.bImage )
+ {
+ aMetrics.nEntryWidth = Max( aMetrics.nImgWidth, (USHORT)maUserItemSize.Width() );
+ if ( aMetrics.bText )
+ aMetrics.nEntryWidth += aMetrics.nTextWidth + IMG_TXT_DISTANCE;
+ aMetrics.nEntryHeight = Max( mnMaxImgHeight, (USHORT)maUserItemSize.Height() ) + 2;
+ }
+
+ if ( bUpdateMetrics )
+ {
+ if ( aMetrics.nEntryWidth > mnMaxWidth )
+ mnMaxWidth = aMetrics.nEntryWidth;
+ if ( aMetrics.nEntryHeight > mnMaxHeight )
+ mnMaxHeight = aMetrics.nEntryHeight;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::ImplCallSelect()
+{
+ if ( !IsTravelSelect() && GetEntryList()->GetMaxMRUCount() )
+ {
+ // Insert the selected entry as MRU, if not allready first MRU
+ USHORT nSelected = GetEntryList()->GetSelectEntryPos( 0 );
+ USHORT nMRUCount = GetEntryList()->GetMRUCount();
+ String aSelected = GetEntryList()->GetEntryText( nSelected );
+ USHORT nFirstMatchingEntryPos = GetEntryList()->FindEntry( aSelected );
+ if ( nFirstMatchingEntryPos || !nMRUCount )
+ {
+ BOOL bSelectNewEntry = FALSE;
+ if ( nFirstMatchingEntryPos < nMRUCount )
+ {
+ RemoveEntry( nFirstMatchingEntryPos );
+ nMRUCount--;
+ if ( nFirstMatchingEntryPos == nSelected )
+ bSelectNewEntry = TRUE;
+ }
+ else if ( nMRUCount == GetEntryList()->GetMaxMRUCount() )
+ {
+ RemoveEntry( nMRUCount - 1 );
+ nMRUCount--;
+ }
+
+ ImplEntryType* pNewEntry = new ImplEntryType( aSelected );
+ pNewEntry->mbIsSelected = bSelectNewEntry;
+ GetEntryList()->InsertEntry( 0, pNewEntry, FALSE );
+ GetEntryList()->SetMRUCount( ++nMRUCount );
+ SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
+ maMRUChangedHdl.Call( NULL );
+ }
+ }
+
+ maSelectHdl.Call( NULL );
+ mbSelectionChanged = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry )
+{
+ USHORT nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort );
+
+ ImplCalcEntryMetrics( *pNewEntry, TRUE );
+ return nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::RemoveEntry( USHORT nPos )
+{
+ mpEntryList->RemoveEntry( nPos );
+ ImplCalcMetrics();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ mbMouseMoveSelect = FALSE; // Nur bis zum ersten MouseButtonDown
+
+ if ( !IsReadOnly() )
+ {
+ if( rMEvt.GetClicks() == 1 )
+ {
+ USHORT nSelect = (USHORT) ( ( rMEvt.GetPosPixel().Y() + mnBorder ) / mnMaxHeight ) + (USHORT) mnTop;
+ if( nSelect < mpEntryList->GetEntryCount() )
+ {
+ if ( !mbMulti && GetEntryList()->GetSelectEntryCount() )
+ mnTrackingSaveSelection = GetEntryList()->GetSelectEntryPos( 0 );
+ else
+ mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND;
+
+ mnCurrentPos = nSelect;
+ mbTrackingSelect = TRUE;
+ SelectEntries( nSelect, LET_MBDOWN, rMEvt.IsShift(), rMEvt.IsMod1() );
+ mbTrackingSelect = FALSE;
+ if ( mbGrabFocus )
+ GrabFocus();
+
+ StartTracking( STARTTRACK_SCROLLREPEAT );
+ }
+ }
+ if( rMEvt.GetClicks() == 2 )
+ {
+ maDoubleClickHdl.Call( this );
+ }
+ }
+ else // if ( mbGrabFocus )
+ {
+ GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( !mbMulti && mbMouseMoveSelect && mpEntryList->GetEntryCount() && !rMEvt.IsLeaveWindow() )
+ {
+ Point aPoint;
+ Rectangle aRect( aPoint, GetOutputSizePixel() );
+ if( aRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ USHORT nSelect = (USHORT) ( ( rMEvt.GetPosPixel().Y() + mnBorder ) / mnMaxHeight ) + (USHORT) mnTop;
+ nSelect = Min( nSelect, (USHORT) ( mnTop + mnMaxVisibleEntries ) );
+ nSelect = Min( nSelect, (USHORT) ( mpEntryList->GetEntryCount() - 1 ) );
+ if ( ( nSelect != mnCurrentPos ) || !GetEntryList()->GetSelectEntryCount() || ( nSelect != GetEntryList()->GetSelectEntryPos( 0 ) ) )
+ {
+ mbTrackingSelect = TRUE;
+ SelectEntries( nSelect, LET_TRACKING, FALSE, FALSE );
+ mbTrackingSelect = FALSE;
+ }
+
+ // Falls der DD-Button gedrueckt wurde und jemand mit gedrueckter
+ // Maustaste in die ListBox faehrt...
+ if ( rMEvt.IsLeft() && !rMEvt.IsSynthetic() )
+ {
+ if ( !mbMulti && GetEntryList()->GetSelectEntryCount() )
+ mnTrackingSaveSelection = GetEntryList()->GetSelectEntryPos( 0 );
+ else
+ mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND;
+ StartTracking( STARTTRACK_SCROLLREPEAT );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect )
+{
+ if ( mpEntryList->IsEntryPosSelected( nPos ) != bSelect )
+ {
+ HideFocus();
+ if( bSelect )
+ {
+ if( !mbMulti )
+ {
+ // Selektierten Eintrag deselektieren
+ USHORT nDeselect = GetEntryList()->GetSelectEntryPos( 0 );
+ if( nDeselect != LISTBOX_ENTRY_NOTFOUND )
+ {
+ //SelectEntryPos( nDeselect, FALSE );
+ GetEntryList()->SelectEntry( nDeselect, FALSE );
+ if ( IsUpdateMode() && IsReallyVisible() )
+ ImplPaint( nDeselect, TRUE );
+ }
+ }
+ mpEntryList->SelectEntry( nPos, TRUE );
+ mnCurrentPos = nPos;
+ if ( ( nPos != LISTBOX_ENTRY_NOTFOUND ) && IsUpdateMode() )
+ {
+ ImplPaint( nPos );
+ if ( !IsVisible( nPos ) )
+ SetTopEntry( nPos );
+ }
+ }
+ else
+ {
+ mpEntryList->SelectEntry( nPos, FALSE );
+ ImplPaint( nPos, TRUE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL bShift, BOOL bCtrl )
+{
+ BOOL bFocusChanged = FALSE;
+ BOOL bSelectionChanged = FALSE;
+
+ if( IsEnabled() )
+ {
+ // Hier (Single-ListBox) kann nur ein Eintrag deselektiert werden
+ if( !mbMulti )
+ {
+ USHORT nDeselect = mpEntryList->GetSelectEntryPos( 0 );
+ if( nSelect != nDeselect )
+ {
+ SelectEntry( nSelect, TRUE );
+ mpEntryList->SetLastSelected( nSelect );
+ bFocusChanged = TRUE;
+ bSelectionChanged = TRUE;
+ }
+ }
+ // MultiListBox ohne Modifier
+ else if( mbSimpleMode && !bCtrl && !bShift )
+ {
+ USHORT nEntryCount = mpEntryList->GetEntryCount();
+ for ( USHORT nPos = 0; nPos < nEntryCount; nPos++ )
+ {
+ BOOL bSelect = nPos == nSelect;
+ if ( mpEntryList->IsEntryPosSelected( nPos ) != bSelect )
+ {
+ SelectEntry( nPos, bSelect );
+ bFocusChanged = TRUE;
+ bSelectionChanged = TRUE;
+ }
+ }
+ mpEntryList->SetLastSelected( nSelect );
+ mpEntryList->SetSelectionAnchor( nSelect );
+ }
+ // MultiListBox nur mit CTRL/SHIFT oder nicht im SimpleMode
+ else if( ( !mbSimpleMode /* && !bShift */ ) || ( mbSimpleMode && ( bCtrl || bShift ) ) )
+ {
+ // Space fuer Selektionswechsel
+ if( !bShift && ( ( eLET == LET_KEYSPACE ) || ( eLET == LET_MBDOWN ) ) )
+ {
+ SelectEntry( nSelect, !mpEntryList->IsEntryPosSelected( nSelect ) );
+ mpEntryList->SetLastSelected( nSelect );
+ mpEntryList->SetSelectionAnchor( nSelect );
+ if ( !mpEntryList->IsEntryPosSelected( nSelect ) )
+ mpEntryList->SetSelectionAnchor( LISTBOX_ENTRY_NOTFOUND );
+ bFocusChanged = TRUE;
+ bSelectionChanged = TRUE;
+ }
+ else if( ( ( eLET == LET_TRACKING ) && ( nSelect != mnCurrentPos ) ) ||
+ ( bShift && ( ( eLET == LET_KEYMOVE ) || ( eLET == LET_MBDOWN ) ) ) )
+ {
+ mnCurrentPos = nSelect;
+ bFocusChanged = TRUE;
+
+ USHORT nAnchor = mpEntryList->GetSelectionAnchor();
+ if( ( nAnchor == LISTBOX_ENTRY_NOTFOUND ) && ( mpEntryList->GetSelectEntryCount() ) )
+ {
+ nAnchor = mpEntryList->GetSelectEntryPos( mpEntryList->GetSelectEntryCount() - 1 );
+ }
+ if( nAnchor != LISTBOX_ENTRY_NOTFOUND )
+ {
+ // Alle Eintraege vom Anchor bis nSelect muessen selektiert sein
+ USHORT nStart = Min( nSelect, nAnchor );
+ USHORT nEnd = Max( nSelect, nAnchor );
+ for ( USHORT n = nStart; n <= nEnd; n++ )
+ {
+ if ( !mpEntryList->IsEntryPosSelected( n ) )
+ {
+ SelectEntry( n, TRUE );
+ bSelectionChanged = TRUE;
+ }
+ }
+
+ // Ggf. muss noch was deselektiert werden...
+ USHORT nLast = mpEntryList->GetLastSelected();
+ if ( nLast != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if ( ( nLast > nSelect ) && ( nLast > nAnchor ) )
+ {
+ for ( USHORT n = nSelect+1; n <= nLast; n++ )
+ {
+ if ( mpEntryList->IsEntryPosSelected( n ) )
+ {
+ SelectEntry( n, FALSE );
+ bSelectionChanged = TRUE;
+ }
+ }
+ }
+ else if ( ( nLast < nSelect ) && ( nLast < nAnchor ) )
+ {
+ for ( USHORT n = nLast; n < nSelect; n++ )
+ {
+ if ( mpEntryList->IsEntryPosSelected( n ) )
+ {
+ SelectEntry( n, FALSE );
+ bSelectionChanged = TRUE;
+ }
+ }
+ }
+ }
+ mpEntryList->SetLastSelected( nSelect );
+ }
+ }
+ else if( eLET != LET_TRACKING )
+ {
+ HideFocus();
+ ImplPaint( nSelect, TRUE );
+ bFocusChanged = TRUE;
+ }
+ }
+ else if( bShift )
+ {
+ bFocusChanged = TRUE;
+ }
+
+ if( bSelectionChanged )
+ mbSelectionChanged = TRUE;
+
+ if( bFocusChanged )
+ {
+ maFocusRect.SetPos( Point( 0, ( nSelect - mnTop ) * mnMaxHeight ) );
+ if( HasFocus() )
+ ShowFocus( maFocusRect );
+ }
+ }
+ return bSelectionChanged;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt )
+{
+ Point aPoint;
+ Rectangle aRect( aPoint, GetOutputSizePixel() );
+ BOOL bInside = aRect.IsInside( rTEvt.GetMouseEvent().GetPosPixel() );
+
+ if( rTEvt.IsTrackingCanceled() || rTEvt.IsTrackingEnded() ) // MouseButtonUp
+ {
+ if ( bInside && !rTEvt.IsTrackingCanceled() )
+ {
+ mnSelectModifier = rTEvt.GetMouseEvent().GetModifier();
+ ImplCallSelect();
+ }
+ else
+ {
+ maCancelHdl.Call( NULL );
+ if ( !mbMulti )
+ {
+ mbTrackingSelect = TRUE;
+ SelectEntry( mnTrackingSaveSelection, TRUE );
+ mbTrackingSelect = FALSE;
+ if ( mnTrackingSaveSelection != LISTBOX_ENTRY_NOTFOUND )
+ {
+ maFocusRect.SetPos( Point( 0, ( mnCurrentPos - mnTop ) * mnMaxHeight ) );
+ ShowFocus( maFocusRect );
+ }
+ }
+ }
+
+ mbTrack = FALSE;
+ }
+ else
+ {
+ BOOL bTrackOrQuickClick = mbTrack;
+ if( !mbTrack )
+ {
+ if ( bInside )
+ {
+ mbTrack = TRUE;
+ }
+
+ // Folgender Fall tritt nur auf, wenn man ganz kurz die Maustaste drueckt
+ if( rTEvt.IsTrackingEnded() && mbTrack )
+ {
+ bTrackOrQuickClick = TRUE;
+ mbTrack = FALSE;
+ }
+ }
+
+ if( bTrackOrQuickClick )
+ {
+ MouseEvent aMEvt = rTEvt.GetMouseEvent();
+ Point aPt( aMEvt.GetPosPixel() );
+ BOOL bShift = aMEvt.IsShift();
+ BOOL bCtrl = aMEvt.IsMod1();
+
+ USHORT nSelect = LISTBOX_ENTRY_NOTFOUND;
+ if( aPt.Y() < 0 )
+ {
+ nSelect = mnCurrentPos ? ( mnCurrentPos - 1 ) : 0;
+ if( nSelect < mnTop )
+ SetTopEntry( mnTop-1 );
+ }
+ else if( aPt.Y() > GetOutputSizePixel().Height() )
+ {
+ nSelect = Min( (USHORT)(mnCurrentPos+1), (USHORT)(mpEntryList->GetEntryCount()-1) );
+ if( nSelect >= mnTop + mnMaxVisibleEntries )
+ SetTopEntry( mnTop+1 );
+ }
+ else
+ {
+ nSelect = (USHORT) ( ( aPt.Y() + mnBorder ) / mnMaxHeight ) + (USHORT) mnTop;
+ nSelect = Min( nSelect, (USHORT) ( mnTop + mnMaxVisibleEntries ) );
+ nSelect = Min( nSelect, (USHORT) ( mpEntryList->GetEntryCount() - 1 ) );
+ }
+
+ if ( bInside )
+ {
+ if ( ( nSelect != mnCurrentPos ) || !GetEntryList()->GetSelectEntryCount() )
+ {
+ mbTrackingSelect = TRUE;
+ SelectEntries( nSelect, LET_TRACKING, bShift, bCtrl );
+ mbTrackingSelect = FALSE;
+ }
+ }
+ else
+ {
+ if ( !mbMulti && GetEntryList()->GetSelectEntryCount() )
+ {
+ mbTrackingSelect = TRUE;
+ SelectEntry( GetEntryList()->GetSelectEntryPos( 0 ), FALSE );
+ mbTrackingSelect = FALSE;
+ }
+ }
+ mnCurrentPos = nSelect;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::KeyInput( const KeyEvent& rKEvt )
+{
+ if( !ProcessKeyInput( rKEvt ) )
+ Control::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
+{
+ // zu selektierender Eintrag
+ USHORT nSelect = LISTBOX_ENTRY_NOTFOUND;
+ LB_EVENT_TYPE eLET = LET_KEYMOVE;
+
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+ BOOL bShift = aKeyCode.IsShift();
+ BOOL bCtrl = aKeyCode.IsMod1();
+ BOOL bMod2 = aKeyCode.IsMod2();
+ BOOL bDone = FALSE;
+
+ switch( aKeyCode.GetCode() )
+ {
+ case KEY_UP:
+ {
+ if ( IsReadOnly() )
+ {
+ if ( GetTopEntry() )
+ SetTopEntry( GetTopEntry()-1 );
+ }
+ else if ( !bMod2 )
+ {
+ if( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND )
+ nSelect = mpEntryList->GetEntryCount() ? 0 : LISTBOX_ENTRY_NOTFOUND;
+ else if ( mnCurrentPos )
+ nSelect = mnCurrentPos - 1;
+
+ if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect < mnTop ) )
+ SetTopEntry( mnTop-1 );
+
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_DOWN:
+ {
+ if ( IsReadOnly() )
+ {
+ SetTopEntry( GetTopEntry()+1 );
+ }
+ else if ( !bMod2 )
+ {
+ if( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND )
+ nSelect = mpEntryList->GetEntryCount() ? 0 : LISTBOX_ENTRY_NOTFOUND;
+ else if ( (mnCurrentPos+1) < mpEntryList->GetEntryCount() )
+ nSelect = mnCurrentPos+1;
+
+ if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect >= ( mnTop + mnMaxVisibleEntries ) ) )
+ SetTopEntry( mnTop+1 );
+
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_PAGEUP:
+ {
+ if ( IsReadOnly() )
+ {
+ SetTopEntry( ( mnTop > mnMaxVisibleEntries ) ?
+ (mnTop-mnMaxVisibleEntries) : 0 );
+ }
+ else if ( !bCtrl && !bMod2 )
+ {
+ if( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND )
+ nSelect = mpEntryList->GetEntryCount() ? 0 : LISTBOX_ENTRY_NOTFOUND;
+ else if ( mnCurrentPos )
+ {
+ if( mnCurrentPos == mnTop )
+ SetTopEntry( ( mnTop > mnMaxVisibleEntries ) ?
+ ( mnTop-mnMaxVisibleEntries+1 ) : 0 );
+ nSelect = mnTop;
+ }
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_PAGEDOWN:
+ {
+ if ( IsReadOnly() )
+ {
+ SetTopEntry( mnTop + mnMaxVisibleEntries );
+ }
+ else if ( !bCtrl && !bMod2 )
+ {
+ if( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND )
+ nSelect = mpEntryList->GetEntryCount() ? 0 : LISTBOX_ENTRY_NOTFOUND;
+ else if ( (mnCurrentPos+1) < mpEntryList->GetEntryCount() )
+ {
+ USHORT nCount = mpEntryList->GetEntryCount();
+ USHORT nTmp = Min( mnMaxVisibleEntries, nCount );
+ nTmp += mnTop - 1;
+ if( mnCurrentPos == nTmp && mnCurrentPos != nCount - 1 )
+ {
+ long nTmp2 = Min( (long)(nCount-mnMaxVisibleEntries), (long)((long)mnTop+(long)mnMaxVisibleEntries-1) );
+ nTmp2 = Max( (long)0 , nTmp2 );
+ nTmp = (USHORT)(nTmp2+(mnMaxVisibleEntries-1) );
+ SetTopEntry( (USHORT)nTmp2 );
+ }
+ nSelect = nTmp;
+ }
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_HOME:
+ {
+ if ( IsReadOnly() )
+ {
+ SetTopEntry( 0 );
+ }
+ else if ( !bCtrl && !bMod2 )
+ {
+ if ( mnCurrentPos )
+ {
+ nSelect = mpEntryList->GetEntryCount() ? 0 : LISTBOX_ENTRY_NOTFOUND;
+ if( mnTop != 0 )
+ SetTopEntry( 0 );
+
+ bDone = TRUE;
+ }
+ }
+ }
+ break;
+
+ case KEY_END:
+ {
+ if ( IsReadOnly() )
+ {
+ SetTopEntry( 0xFFFF );
+ }
+ else if ( !bCtrl && !bMod2 )
+ {
+ if( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND )
+ nSelect = mpEntryList->GetEntryCount() ? 0 : LISTBOX_ENTRY_NOTFOUND;
+ else if ( (mnCurrentPos+1) < mpEntryList->GetEntryCount() )
+ {
+ USHORT nCount = mpEntryList->GetEntryCount();
+ nSelect = nCount - 1;
+ if( nCount > mnMaxVisibleEntries )
+ SetTopEntry( nCount - mnMaxVisibleEntries );
+ }
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_LEFT:
+ {
+ if ( !bCtrl && !bMod2 )
+ {
+ ScrollHorz( -HORZ_SCROLL );
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_RIGHT:
+ {
+ if ( !bCtrl && !bMod2 )
+ {
+ ScrollHorz( HORZ_SCROLL );
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ case KEY_RETURN:
+ {
+ if ( !bMod2 && !IsReadOnly() )
+ {
+ mnSelectModifier = rKEvt.GetKeyCode().GetModifier();
+ ImplCallSelect();
+ bDone = FALSE; // RETURN nicht abfangen.
+ }
+ }
+ break;
+
+ case KEY_SPACE:
+ {
+ if ( !bMod2 && !IsReadOnly() )
+ {
+ if( mbMulti && ( !mbSimpleMode || ( mbSimpleMode && bCtrl && !bShift ) ) )
+ {
+ nSelect = mnCurrentPos;
+ eLET = LET_KEYSPACE;
+ }
+ bDone = TRUE;
+ }
+ }
+ break;
+
+ default:
+ {
+ xub_Unicode c = rKEvt.GetCharCode();
+
+ if ( !IsReadOnly() && (c >= 32) && (c != 127) &&
+ !rKEvt.GetKeyCode().IsControlMod() )
+ {
+ maSearchStr += c;
+ XubString aTmpSearch( maSearchStr );
+
+ nSelect = mpEntryList->FindEntry( aTmpSearch, MATCH_IGNORECASE, aTmpSearch.Len(), mnCurrentPos );
+ if ( (nSelect == LISTBOX_ENTRY_NOTFOUND) && (aTmpSearch.Len() > 1) )
+ {
+ // Wenn alles die gleichen Buchstaben, dann anderer Such-Modus
+ BOOL bAllEqual = TRUE;
+ for ( USHORT n = aTmpSearch.Len(); n && bAllEqual; )
+ bAllEqual = aTmpSearch.GetChar( --n ) == c;
+ if ( bAllEqual )
+ {
+ aTmpSearch = c;
+ nSelect = mpEntryList->FindEntry( aTmpSearch, MATCH_IGNORECASE, aTmpSearch.Len(), mnCurrentPos+1 );
+ }
+ }
+ if ( nSelect == LISTBOX_ENTRY_NOTFOUND )
+ nSelect = mpEntryList->FindEntry( aTmpSearch, MATCH_IGNORECASE, aTmpSearch.Len(), 0 );
+
+ if ( nSelect != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if( nSelect < mnTop )
+ SetTopEntry( nSelect );
+ else if( nSelect >= (mnTop + mnMaxVisibleEntries) )
+ SetTopEntry( nSelect - mnMaxVisibleEntries + 1 );
+
+ if ( nSelect == mnCurrentPos )
+ nSelect = LISTBOX_ENTRY_NOTFOUND;
+
+ maSearchTimeout.Start();
+ }
+ else
+ maSearchStr.Erase();
+ bDone = TRUE;
+ }
+ }
+ }
+
+ if ( (nSelect != LISTBOX_ENTRY_NOTFOUND) &&
+ ((nSelect != mnCurrentPos ) || ( eLET == LET_KEYSPACE)) )
+ {
+ DBG_ASSERT( (nSelect != mnCurrentPos) || mbMulti, "ImplListBox: Selecting same Entry" );
+ mnCurrentPos = nSelect;
+ if ( SelectEntries( nSelect, eLET, bShift, bCtrl ) )
+ {
+ mbTravelSelect = TRUE;
+ mnSelectModifier = rKEvt.GetKeyCode().GetModifier();
+ ImplCallSelect();
+ mbTravelSelect = FALSE;
+ }
+ }
+
+ return bDone;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ long nWidth = GetOutputSizePixel().Width();
+ long nY = ( nPos - mnTop ) * mnMaxHeight;
+ Rectangle aRect( Point( 0, nY ), Size( nWidth, mnMaxHeight ) );
+
+ if( IsEnabled() )
+ {
+ if( mpEntryList->IsEntryPosSelected( nPos ) )
+ {
+ SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ SetFillColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( aRect );
+ }
+ else
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ if( bErase )
+ Erase( aRect );
+ }
+ }
+ else // Disabled
+ {
+ SetTextColor( rStyleSettings.GetDisableColor() );
+ //SetFillColor( rStyleSettings.Get???Color() );
+ //DrawRect( aRect );
+ if( bErase )
+ Erase( aRect );
+ }
+
+ if ( IsUserDrawEnabled() )
+ {
+ mbInUserDraw = TRUE;
+ mnUserDrawEntry = nPos;
+ aRect.Left() -= mnLeft;
+ if ( nPos < GetEntryList()->GetMRUCount() )
+ nPos = GetEntryList()->FindEntry( GetEntryList()->GetEntryText( nPos ), MATCH_CASE, STRING_LEN, GetEntryList()->GetMRUCount() );
+ nPos -= GetEntryList()->GetMRUCount();
+ UserDrawEvent aUDEvt( this, aRect, nPos, 0 );
+ maUserDrawHdl.Call( &aUDEvt );
+ mbInUserDraw = FALSE;
+ }
+ else
+ {
+ DrawEntry( nPos, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos )
+{
+ // Bei Aenderungen in dieser Methode ggf. auch ImplWin::DrawEntry() anpassen.
+
+ if ( mbInUserDraw )
+ nPos = mnUserDrawEntry; // real entry, not the matching entry from MRU
+
+ long nY = ( nPos - mnTop ) * mnMaxHeight;
+
+ if( bDrawImage && mpEntryList->HasImages() )
+ {
+ Image aImage = mpEntryList->GetEntryImage( nPos );
+ if( !!aImage )
+ {
+ Size aImgSz = aImage.GetSizePixel();
+ Point aPtImg( mnBorder - mnLeft, nY + ( ( mnMaxHeight - aImgSz.Height() ) / 2 ) );
+
+ if ( !IsZoom() )
+ {
+ DrawImage( aPtImg, aImage );
+ }
+ else
+ {
+ aImgSz.Width() = CalcZoom( aImgSz.Width() );
+ aImgSz.Height() = CalcZoom( aImgSz.Height() );
+ DrawImage( aPtImg, aImgSz, aImage );
+ }
+ }
+ }
+
+ if( bDrawText )
+ {
+ XubString aStr( mpEntryList->GetEntryText( nPos ) );
+ if ( aStr.Len() )
+ {
+ Point aPtTxt( mnBorder - mnLeft, nY + ( ( mnMaxHeight - mnMaxTxtHeight ) / 2 ) );
+ if( !bDrawTextAtImagePos && ( mpEntryList->HasEntryImage(nPos) || IsUserDrawEnabled() ) )
+ {
+ USHORT nMaxWidth = Max( mnMaxImgWidth, (USHORT)maUserItemSize.Width() );
+ aPtTxt.X() += nMaxWidth + IMG_TXT_DISTANCE;
+ }
+ DrawText( aPtTxt, aStr );
+ }
+ }
+
+ if ( ( mnSeparatorPos != LISTBOX_ENTRY_NOTFOUND ) &&
+ ( ( nPos == mnSeparatorPos ) || ( nPos == mnSeparatorPos+1 ) ) )
+ {
+ Color aOldLineColor( GetLineColor() );
+ SetLineColor( ( GetBackground().GetColor() != COL_LIGHTGRAY ) ? COL_LIGHTGRAY : COL_GRAY );
+ Point aStartPos( 0, nY );
+ if ( nPos == mnSeparatorPos )
+ aStartPos.Y() += mnMaxHeight-1;
+ Point aEndPos( aStartPos );
+ aEndPos.X() = GetOutputSizePixel().Width();
+ DrawLine( aStartPos, aEndPos );
+ SetLineColor( aOldLineColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::Paint( const Rectangle& rRect )
+{
+ USHORT nCount = mpEntryList->GetEntryCount();
+
+ if( HasFocus() )
+ HideFocus();
+
+ long nY = 0; // + mnBorder;
+ long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + mnBorder;
+
+ for( USHORT i = (USHORT)mnTop; i < nCount && nY < nHeight + mnMaxHeight; i++ )
+ {
+ if( nY + mnMaxHeight >= rRect.Top() &&
+ nY <= rRect.Bottom() + mnMaxHeight )
+ {
+ ImplPaint( i );
+ }
+ nY += mnMaxHeight;
+ }
+
+ maFocusRect.SetPos( Point( 0, ( mnCurrentPos - mnTop ) * mnMaxHeight ) );
+ if( HasFocus() )
+ ShowFocus( maFocusRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::Resize()
+{
+ Size aSz( GetOutputSizePixel().Width(), mnMaxHeight );
+ maFocusRect.SetSize( aSz );
+ mnMaxVisibleEntries = (USHORT) ( GetOutputSizePixel().Height() / mnMaxHeight );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::GetFocus()
+{
+ USHORT nPos = mnCurrentPos;
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = 0;
+ maFocusRect.SetPos( Point( 0, ( nPos - mnTop ) * mnMaxHeight ) );
+ ShowFocus( maFocusRect );
+ Control::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::LoseFocus()
+{
+ HideFocus();
+ Control::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+/*
+void ImplListBoxWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), String() );
+
+ Window::RequestHelp( rHEvt );
+}
+*/
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::SetTopEntry( USHORT nTop )
+{
+ USHORT nMaxTop = 0;
+ if ( GetEntryList()->GetEntryCount() > mnMaxVisibleEntries )
+ nMaxTop = GetEntryList()->GetEntryCount() - mnMaxVisibleEntries;
+ nTop = Min( nTop, nMaxTop );
+ if ( nTop != mnTop )
+ {
+ HideFocus();
+ long nDiff = ( mnTop - nTop ) * mnMaxHeight;
+ mnTop = nTop;
+ Scroll( 0, nDiff );
+ maFocusRect.Top() += nDiff;
+ maFocusRect.Bottom() += nDiff;
+ if( HasFocus() )
+ ShowFocus( maFocusRect );
+ maScrollHdl.Call( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::SetLeftIndent( USHORT n )
+{
+ ScrollHorz( n - mnLeft );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::ScrollHorz( short n )
+{
+ short nDiff = 0;
+ if ( n > 0 )
+ {
+ long nWidth = GetOutputSizePixel().Width();
+ if( ( mnMaxWidth - mnLeft + n ) > nWidth )
+ nDiff = n;
+ }
+ else if ( n < 0 )
+ {
+ if( mnLeft )
+ {
+ USHORT nAbs = -n;
+ nDiff = - ( ( mnLeft > nAbs ) ? nAbs : mnLeft );
+ }
+ }
+
+ if ( nDiff )
+ {
+ HideFocus();
+ mnLeft += nDiff;
+ Scroll( -nDiff, 0 );
+ if( HasFocus() )
+ ShowFocus( maFocusRect );
+ maScrollHdl.Call( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size ImplListBoxWindow::CalcSize( USHORT nMaxLines ) const
+{
+ Size aSz;
+// USHORT nL = Min( nMaxLines, mpEntryList->GetEntryCount() );
+ aSz.Height() = nMaxLines * mnMaxHeight;
+ aSz.Width() = mnMaxWidth + 2*mnBorder;
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_ZOOM )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ ImplCalcMetrics();
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsUpdateMode() && IsReallyVisible() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ ImplCalcMetrics();
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ ImplCalcMetrics();
+ Invalidate();
+ }
+}
+
+// =======================================================================
+
+ImplListBox::ImplListBox( Window* pParent, WinBits nWinStyle ) :
+ Control( pParent, nWinStyle ),
+ maLBWindow( this, nWinStyle&(~WB_BORDER) )
+{
+ mpVScrollBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG );
+ mpHScrollBar = new ScrollBar( this, WB_HSCROLL | WB_DRAG );
+ mpScrollBarBox = new ScrollBarBox( this );
+
+ Link aLink( LINK( this, ImplListBox, ScrollBarHdl ) );
+ mpVScrollBar->SetScrollHdl( aLink );
+ mpHScrollBar->SetScrollHdl( aLink );
+
+ mbVScroll = FALSE;
+ mbHScroll = FALSE;
+ mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL ) ? TRUE : FALSE;
+
+ maLBWindow.SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) );
+ maLBWindow.SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) );
+ maLBWindow.Show();
+}
+
+// -----------------------------------------------------------------------
+
+ImplListBox::~ImplListBox()
+{
+ delete mpHScrollBar;
+ delete mpVScrollBar;
+ delete mpScrollBarBox;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::Clear()
+{
+ maLBWindow.Clear();
+ if ( GetEntryList()->GetMRUCount() )
+ {
+ maLBWindow.GetEntryList()->SetMRUCount( 0 );
+ maLBWindow.SetSeparatorPos( LISTBOX_ENTRY_NOTFOUND );
+ }
+ mpVScrollBar->SetThumbPos( 0 );
+ mpHScrollBar->SetThumbPos( 0 );
+ StateChanged( STATE_CHANGE_DATA );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplListBox::InsertEntry( USHORT nPos, const XubString& rStr )
+{
+ ImplEntryType* pNewEntry = new ImplEntryType( rStr );
+ USHORT nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
+ StateChanged( STATE_CHANGE_DATA );
+ return nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplListBox::InsertEntry( USHORT nPos, const Image& rImage )
+{
+ ImplEntryType* pNewEntry = new ImplEntryType( rImage );
+ USHORT nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
+ StateChanged( STATE_CHANGE_DATA );
+ return nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplListBox::InsertEntry( USHORT nPos, const XubString& rStr, const Image& rImage )
+{
+ ImplEntryType* pNewEntry = new ImplEntryType( rStr, rImage );
+ USHORT nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
+ StateChanged( STATE_CHANGE_DATA );
+ return nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::RemoveEntry( USHORT nPos )
+{
+ maLBWindow.RemoveEntry( nPos );
+ StateChanged( STATE_CHANGE_DATA );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::SelectEntry( USHORT nPos, BOOL bSelect )
+{
+ maLBWindow.SelectEntry( nPos, bSelect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::SetNoSelection()
+{
+ USHORT nSelected = GetEntryList()->GetSelectEntryCount();
+ for ( USHORT n = 0; n < nSelected; n++ )
+ {
+ USHORT nS = GetEntryList()->GetSelectEntryPos( n );
+ SelectEntry( nS, FALSE );
+ }
+ maLBWindow.GetEntryList()->SetNoSelection();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::GetFocus()
+{
+ maLBWindow.GrabFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::Resize()
+{
+ ImplResizeControls();
+ ImplCheckScrollBars();
+}
+
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ImplListBox, MRUChanged, void*, EMPTYARG )
+{
+ StateChanged( STATE_CHANGE_DATA );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ImplListBox, LBWindowScrolled, void*, EMPTYARG )
+{
+ mpVScrollBar->SetThumbPos( GetTopEntry() );
+ mpHScrollBar->SetThumbPos( GetLeftIndent() );
+
+ maScrollHdl.Call( this );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ImplListBox, ScrollBarHdl, ScrollBar*, pSB )
+{
+ USHORT nPos = (USHORT) pSB->GetThumbPos();
+ if( pSB == mpVScrollBar )
+ SetTopEntry( nPos );
+ else if( pSB == mpHScrollBar )
+ SetLeftIndent( nPos );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::ImplCheckScrollBars()
+{
+ BOOL bArrange = FALSE;
+
+ Size aOutSz = GetOutputSizePixel();
+ USHORT nEntries = GetEntryList()->GetEntryCount();
+ USHORT nMaxVisEntries = (USHORT) (aOutSz.Height() / GetEntryHeight());
+
+ // vert. ScrollBar
+ if( nEntries > nMaxVisEntries )
+ {
+ if( !mbVScroll )
+ bArrange = TRUE;
+ mbVScroll = TRUE;
+
+ // Ueberpruefung des rausgescrollten Bereichs
+ SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft...
+ }
+ else
+ {
+ if( mbVScroll )
+ bArrange = TRUE;
+ mbVScroll = FALSE;
+ SetTopEntry( 0 );
+ }
+
+ // horz. ScrollBar
+ if( mbAutoHScroll )
+ {
+ long nWidth = (USHORT) aOutSz.Width();
+ if ( mbVScroll )
+ nWidth -= mpVScrollBar->GetSizePixel().Width();
+
+ long nMaxWidth = GetMaxEntryWidth();
+ if( nWidth < nMaxWidth )
+ {
+ if( !mbHScroll )
+ bArrange = TRUE;
+ mbHScroll = TRUE;
+
+ if ( !mbVScroll ) // ggf. brauchen wir jetzt doch einen
+ {
+ nMaxVisEntries = (USHORT) ( ( aOutSz.Height() - mpHScrollBar->GetSizePixel().Height() ) / GetEntryHeight() );
+ if( nEntries > nMaxVisEntries )
+ {
+ bArrange = TRUE;
+ mbVScroll = TRUE;
+
+ // Ueberpruefung des rausgescrollten Bereichs
+ SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft...
+ }
+ }
+
+ // Ueberpruefung des rausgescrollten Bereichs
+ USHORT nMaxLI = (USHORT) (nMaxWidth - nWidth);
+ if ( nMaxLI < GetLeftIndent() )
+ SetLeftIndent( nMaxLI );
+ }
+ else
+ {
+ if( mbHScroll )
+ bArrange = TRUE;
+ mbHScroll = FALSE;
+ SetLeftIndent( 0 );
+ }
+ }
+
+ if( bArrange )
+ ImplResizeControls();
+
+ ImplInitScrollBars();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::ImplInitScrollBars()
+{
+ Size aOutSz = maLBWindow.GetOutputSizePixel();
+
+ if ( mbVScroll )
+ {
+ USHORT nEntries = GetEntryList()->GetEntryCount();
+ USHORT nVisEntries = (USHORT) (aOutSz.Height() / GetEntryHeight());
+ mpVScrollBar->SetRangeMax( nEntries );
+ mpVScrollBar->SetVisibleSize( nVisEntries );
+ mpVScrollBar->SetPageSize( nVisEntries - 1 );
+ }
+
+ if ( mbHScroll )
+ {
+ mpHScrollBar->SetRangeMax( GetMaxEntryWidth() + HORZ_SCROLL );
+ mpHScrollBar->SetVisibleSize( (USHORT)aOutSz.Width() );
+ mpHScrollBar->SetLineSize( HORZ_SCROLL );
+ mpHScrollBar->SetPageSize( aOutSz.Width() - HORZ_SCROLL );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::ImplResizeControls()
+{
+ // Hier werden die Controls nur angeordnet, ob die Scrollbars
+ // sichtbar sein sollen wird bereits in ImplCheckScrollBars ermittelt.
+
+ Size aOutSz = GetOutputSizePixel();
+ long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSBWidth = CalcZoom( nSBWidth );
+
+ Size aInnerSz( aOutSz );
+ if ( mbVScroll )
+ aInnerSz.Width() -= nSBWidth;
+ if ( mbHScroll )
+ aInnerSz.Height() -= nSBWidth;
+
+ maLBWindow.SetPosSizePixel( Point(), aInnerSz );
+
+ // ScrollBarBox
+ if( mbVScroll && mbHScroll )
+ {
+ mpScrollBarBox->SetPosSizePixel( Point( aInnerSz.Width(), aInnerSz.Height() ),
+ Size( nSBWidth, nSBWidth ) );
+ mpScrollBarBox->Show();
+ }
+ else
+ {
+ mpScrollBarBox->Hide();
+ }
+
+ // vert. ScrollBar
+ if( mbVScroll )
+ {
+ mpVScrollBar->SetPosSizePixel( Point( aOutSz.Width()-nSBWidth, 0 ),
+ Size( nSBWidth, aInnerSz.Height() ) );
+ mpVScrollBar->Show();
+ }
+ else
+ {
+ mpVScrollBar->Hide();
+ SetTopEntry( 0 );
+ }
+
+ // horz. ScrollBar
+ if( mbHScroll )
+ {
+ mpHScrollBar->SetPosSizePixel( Point( 0, aOutSz.Height()-nSBWidth ),
+ Size( aInnerSz.Width(), nSBWidth ) );
+ mpHScrollBar->Show();
+ }
+ else
+ {
+ mpHScrollBar->Hide();
+ SetLeftIndent( 0 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ ImplCheckScrollBars();
+ }
+ else if ( ( nType == STATE_CHANGE_UPDATEMODE ) || ( nType == STATE_CHANGE_DATA ) )
+ {
+ BOOL bUpdate = IsUpdateMode();
+ maLBWindow.SetUpdateMode( bUpdate );
+// mpHScrollBar->SetUpdateMode( bUpdate );
+// mpVScrollBar->SetUpdateMode( bUpdate );
+ if ( bUpdate && IsReallyVisible() )
+ ImplCheckScrollBars();
+ }
+ else if( nType == STATE_CHANGE_ENABLE )
+ {
+ mpHScrollBar->Enable( IsEnabled() );
+ mpVScrollBar->Enable( IsEnabled() );
+ mpScrollBarBox->Enable( IsEnabled() );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ maLBWindow.SetZoom( GetZoom() );
+ Resize();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ maLBWindow.SetControlFont( GetControlFont() );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ maLBWindow.SetControlForeground( GetControlForeground() );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ maLBWindow.SetControlBackground( GetControlBackground() );
+ }
+
+ Control::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+// if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+// (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+// {
+// maLBWindow.SetSettings( GetSettings() );
+// Resize();
+// }
+// else
+ Control::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long ImplListBox::Notify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ nDone = HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar );
+ }
+ }
+ }
+
+ return nDone ? nDone : Window::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplListBox::HandleWheelAsCursorTravel( const CommandEvent& rCEvt )
+{
+ BOOL bDone = FALSE;
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ USHORT nKey = ( pData->GetDelta() < 0 ) ? KEY_DOWN : KEY_UP;
+ KeyEvent aKeyEvent( 0, KeyCode( nKey ) );
+ bDone = ProcessKeyInput( aKeyEvent );
+ }
+ }
+ return bDone;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
+{
+ BOOL bChanges = GetEntryList()->GetMRUCount() ? TRUE : FALSE;
+
+ // Remove old MRU entries
+ for ( USHORT n = GetEntryList()->GetMRUCount();n; )
+ maLBWindow.RemoveEntry( --n );
+
+ USHORT nMRUCount = 0;
+ USHORT nEntries = rEntries.GetTokenCount( cSep );
+ for ( USHORT nEntry = 0; nEntry < nEntries; nEntry++ )
+ {
+ XubString aEntry = rEntries.GetToken( nEntry, cSep );
+ // Accept only existing entries
+ if ( GetEntryList()->FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ ImplEntryType* pNewEntry = new ImplEntryType( aEntry );
+ maLBWindow.GetEntryList()->InsertEntry( nMRUCount++, pNewEntry, FALSE );
+ bChanges = TRUE;
+ }
+ }
+
+ if ( bChanges )
+ {
+ maLBWindow.GetEntryList()->SetMRUCount( nMRUCount );
+ SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString ImplListBox::GetMRUEntries( xub_Unicode cSep ) const
+{
+ String aEntries;
+ for ( USHORT n = 0; n < GetEntryList()->GetMRUCount(); n++ )
+ {
+ aEntries += GetEntryList()->GetEntryText( n );
+ if( n < ( GetEntryList()->GetMRUCount() - 1 ) )
+ aEntries += cSep;
+ }
+ return aEntries;
+}
+
+// =======================================================================
+
+ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) :
+ Control ( pParent, nWinStyle )
+{
+ SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
+ mbInUserDraw = FALSE;
+ mbUserDrawEnabled = FALSE;
+ mnItemPos = LISTBOX_ENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWin::MBDown()
+{
+ if( IsEnabled() )
+ maMBDownHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( IsEnabled() )
+ {
+// Control::MouseButtonDown( rMEvt );
+ MBDown();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWin::Paint( const Rectangle& rRect )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if( IsEnabled() )
+ {
+ if( HasFocus() )
+ {
+ SetTextColor( rStyleSettings.GetHighlightTextColor() );
+ SetFillColor( rStyleSettings.GetHighlightColor() );
+ DrawRect( maFocusRect );
+ }
+ else
+ {
+ Color aColor = rStyleSettings.GetFieldTextColor();
+ if( IsControlForeground() )
+ aColor = GetControlForeground();
+ SetTextColor( aColor );
+ Erase( maFocusRect );
+ }
+ }
+ else // Disabled
+ {
+ SetTextColor( rStyleSettings.GetDisableColor() );
+ Erase( maFocusRect );
+ }
+
+ if ( IsUserDrawEnabled() )
+ {
+ mbInUserDraw = TRUE;
+ UserDrawEvent aUDEvt( this, maFocusRect, mnItemPos, 0 );
+ maUserDrawHdl.Call( &aUDEvt );
+ mbInUserDraw = FALSE;
+ }
+ else
+ {
+ DrawEntry( TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos )
+{
+ long nBorder = 1;
+ Size aOutSz = GetOutputSizePixel();
+
+ BOOL bImage = !!maImage;
+ if( bDrawImage && bImage )
+ {
+ Size aImgSz = maImage.GetSizePixel();
+ Point aPtImg( nBorder, ( ( aOutSz.Height() - aImgSz.Height() ) / 2 ) );
+
+ if ( !IsZoom() )
+ {
+ DrawImage( aPtImg, maImage );
+ }
+ else
+ {
+ aImgSz.Width() = CalcZoom( aImgSz.Width() );
+ aImgSz.Height() = CalcZoom( aImgSz.Height() );
+ DrawImage( aPtImg, aImgSz, maImage );
+ }
+ }
+
+ if( bDrawText && maString.Len() )
+ {
+ long nTextHeight = GetTextHeight();
+ Point aPtTxt( nBorder, (aOutSz.Height()-nTextHeight)/2 );
+ if ( !bDrawTextAtImagePos && ( bImage || IsUserDrawEnabled() ) )
+ {
+ long nMaxWidth = Max( maImage.GetSizePixel().Width(), maUserItemSize.Width() );
+ aPtTxt.X() += nMaxWidth + IMG_TXT_DISTANCE;
+ }
+ DrawText( aPtTxt, maString );
+ }
+
+ if( HasFocus() )
+ ShowFocus( maFocusRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWin::Resize()
+{
+ maFocusRect.SetSize( GetOutputSizePixel() );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWin::GetFocus()
+{
+ ShowFocus( maFocusRect );
+ Invalidate();
+ Control::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWin::LoseFocus()
+{
+ HideFocus();
+ Invalidate();
+ Control::LoseFocus();
+}
+
+// =======================================================================
+
+ImplBtn::ImplBtn( Window* pParent, WinBits nWinStyle ) :
+ PushButton( pParent, nWinStyle ),
+ mbDown ( FALSE )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBtn::MBDown()
+{
+ if( IsEnabled() )
+ maMBDownHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBtn::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ //PushButton::MouseButtonDown( rMEvt );
+ if( IsEnabled() )
+ {
+ MBDown();
+ mbDown = TRUE;
+ }
+}
+
+// =======================================================================
+
+ImplListBoxFloatingWindow::ImplListBoxFloatingWindow( Window* pParent ) :
+ FloatingWindow( pParent, WB_NOBORDER )
+{
+ mpImplLB = NULL;
+ mnDDLineCount = 0;
+ mbAutoWidth = FALSE;
+
+ EnableSaveBackground();
+}
+
+// -----------------------------------------------------------------------
+
+long ImplListBoxFloatingWindow::PreNotify( NotifyEvent& rNEvt )
+{
+ if( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if( !GetParent()->HasChildPathFocus( TRUE ) )
+ EndPopupMode();
+ }
+
+ return FloatingWindow::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxFloatingWindow::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, USHORT nFlags )
+{
+ FloatingWindow::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
+
+ // Fix #60890# ( MBA ): um auch im aufgeklappten Zustand der Listbox die Gr"o\se einfach zu einen
+ // Aufruf von Resize() "andern zu k"onnen, wird die Position hier ggf. angepa\t
+ if ( IsReallyVisible() && ( nFlags & WINDOW_POSSIZE_HEIGHT ) )
+ {
+ Point aPos = GetParent()->GetPosPixel();
+ aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos );
+
+ if ( nFlags & WINDOW_POSSIZE_X )
+ aPos.X() = nX;
+
+ if ( nFlags & WINDOW_POSSIZE_Y )
+ aPos.Y() = nY;
+
+ USHORT nIndex;
+ SetPosPixel( ImplCalcPos( this, Rectangle( aPos, GetParent()->GetSizePixel() ), FLOATWIN_POPUPMODE_DOWN, nIndex ) );
+ }
+
+// if( !IsReallyVisible() )
+ {
+ // Die ImplListBox erhaelt kein Resize, weil nicht sichtbar.
+ // Die Fenster muessen aber ein Resize() erhalten, damit die
+ // Anzahl der sichtbaren Eintraege fuer PgUp/PgDown stimmt.
+ // Die Anzahl kann auch nicht von List/Combobox berechnet werden,
+ // weil hierfuer auch die ggf. vorhandene vertikale Scrollbar
+ // beruecksichtigt werden muss.
+ mpImplLB->SetSizePixel( GetOutputSizePixel() );
+ ((Window*)mpImplLB)->Resize();
+ ((Window*)mpImplLB->GetMainWindow())->Resize();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size ImplListBoxFloatingWindow::CalcFloatSize()
+{
+ Size aFloatSz( maPrefSz );
+
+ long nLeft, nTop, nRight, nBottom;
+ GetBorder( nLeft, nTop, nRight, nBottom );
+
+ USHORT nLines = mpImplLB->GetEntryList()->GetEntryCount();
+ if ( mnDDLineCount && ( nLines > mnDDLineCount ) )
+ nLines = mnDDLineCount;
+
+ Size aSz = mpImplLB->CalcSize( nLines );
+ long nMaxHeight = aSz.Height() + nTop + nBottom;
+
+ if ( mnDDLineCount )
+ aFloatSz.Height() = nMaxHeight;
+
+ if( mbAutoWidth )
+ {
+ // AutoSize erstmal nur fuer die Breite...
+
+ aFloatSz.Width() = aSz.Width() + nLeft + nRight;
+ aFloatSz.Width() += nRight; // etwas mehr Platz sieht besser aus...
+
+ if ( aFloatSz.Height() < nMaxHeight )
+ {
+ // dann wird noch der vertikale Scrollbar benoetigt
+ long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ aFloatSz.Width() += nSBWidth;
+ }
+ }
+
+ if ( aFloatSz.Height() > nMaxHeight )
+ aFloatSz.Height() = nMaxHeight;
+
+ // Minimale Hoehe, falls Hoehe nicht auf Float-Hoehe eingestellt wurde.
+ // Der Parent vom FloatWin muss die DropDown-Combo/Listbox sein.
+ Size aParentSz = GetParent()->GetSizePixel();
+ if( aFloatSz.Height() < aParentSz.Height() )
+ aFloatSz.Height() = aParentSz.Height();
+
+ // Nicht schmaler als der Parent werden...
+ if( aFloatSz.Width() < aParentSz.Width() )
+ aFloatSz.Width() = aParentSz.Width();
+
+ // Hoehe auf Entries alignen...
+ long nInnerHeight = aFloatSz.Height() - nTop - nBottom;
+ long nEntryHeight = mpImplLB->GetEntryHeight();
+ if ( nInnerHeight % nEntryHeight )
+ {
+ nInnerHeight /= nEntryHeight;
+ nInnerHeight++;
+ nInnerHeight *= nEntryHeight;
+ aFloatSz.Height() = nInnerHeight + nTop + nBottom;
+ }
+
+ return aFloatSz;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking )
+{
+ if( !IsInPopupMode() )
+ {
+ Size aFloatSz = CalcFloatSize();
+
+ SetSizePixel( aFloatSz );
+ mpImplLB->SetSizePixel( GetOutputSizePixel() );
+
+ Size aSz = GetParent()->GetSizePixel();
+ Point aPos = GetParent()->GetPosPixel();
+ aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos );
+ Rectangle aRect( aPos, aSz );
+ StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN );
+
+ USHORT nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 );
+ if( nPos != LISTBOX_ENTRY_NOTFOUND )
+ mpImplLB->SetTopEntry( nPos );
+
+ if( bStartTracking )
+ mpImplLB->GetMainWindow()->EnableMouseMoveSelect( TRUE );
+
+ if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() )
+ mpImplLB->GetMainWindow()->GrabFocus();
+ }
+}
+
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx
new file mode 100644
index 000000000000..ac1758e8e27d
--- /dev/null
+++ b/vcl/source/control/imgctrl.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: imgctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IMGCTRL_CXX
+
+#include <imgctrl.hxx>
+
+// -----------------------------------------------------------------------
+
+ImageControl::ImageControl( Window* pParent, WinBits nStyle ) :
+ FixedImage( pParent, nStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ImageControl::Resize()
+{
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ImageControl::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ maBmp.Draw( rUDEvt.GetDevice(),
+ rUDEvt.GetRect().TopLeft(),
+ rUDEvt.GetRect().GetSize() );
+}
+
+// -----------------------------------------------------------------------
+
+void ImageControl::SetBitmap( const BitmapEx& rBmp )
+{
+ maBmp = rBmp;
+ StateChanged( STATE_CHANGE_DATA );
+}
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx
new file mode 100644
index 000000000000..2fe137dda52f
--- /dev/null
+++ b/vcl/source/control/longcurr.cxx
@@ -0,0 +1,873 @@
+/*************************************************************************
+ *
+ * $RCSfile: longcurr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define VCL_LONGCURR_CXX
+
+#include <sot/object.hxx>
+#define _TOOLS_BIGINT
+#include <sot/factory.hxx>
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _BIGINT_HXX
+#include <tools/bigint.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#include <event.hxx>
+#include <svapp.hxx>
+#include <svdata.hxx>
+#include <longcurr.hxx>
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define FORMAT_LONGCURRENCY 4
+
+// =======================================================================
+
+static BigInt ImplPower10( USHORT n )
+{
+ USHORT i;
+ BigInt nValue = 1;
+
+ for ( i=0; i < n; i++ )
+ nValue *= 10;
+
+ return nValue;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplNumericProcessKeyInput( Edit*, const KeyEvent& rKEvt,
+ BOOL bStrictFormat,
+ const International& rInter )
+{
+ if ( !bStrictFormat )
+ return FALSE;
+ else
+ {
+ sal_Unicode cChar = rKEvt.GetCharCode();
+ USHORT nGroup = rKEvt.GetKeyCode().GetGroup();
+
+ if ( (nGroup == KEYGROUP_FKEYS) || (nGroup == KEYGROUP_CURSOR) ||
+ (nGroup == KEYGROUP_MISC) ||
+ ((cChar >= '0') && (cChar <= '9')) ||
+ (rInter.IsNumThousandSep() && (cChar == rInter.GetNumThousandSep())) ||
+ (cChar == rInter.GetNumDecimalSep()) ||
+ (cChar == '-') )
+ return FALSE;
+ else
+ return TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplNumericGetValue( const XubString& rStr, BigInt& rValue,
+ USHORT nDecDigits, const International& rInter,
+ BOOL bCurrency = FALSE )
+{
+ XubString aStr = rStr;
+ XubString aStr1;
+ XubString aStr2;
+ USHORT nDecPos;
+ BOOL bNegative = FALSE;
+ xub_StrLen i;
+
+ // Reaktion auf leeren String
+ if ( !rStr.Len() )
+ return FALSE;
+
+ // Fuehrende und nachfolgende Leerzeichen entfernen
+ aStr.EraseLeadingAndTrailingChars( ' ' );
+
+ // Position des Dezimalpunktes suchen
+ nDecPos = aStr.Search( rInter.GetNumDecimalSep() );
+
+ if ( nDecPos != STRING_NOTFOUND )
+ {
+ aStr1 = aStr.Copy( 0, nDecPos );
+ aStr2 = aStr.Copy( nDecPos+1 );
+ }
+ else
+ aStr1 = aStr;
+
+ // Negativ ?
+ if ( bCurrency )
+ {
+ if ( (aStr.GetChar( 0 ) == '(') && (aStr.GetChar( aStr.Len()-1 ) == ')') )
+ bNegative = TRUE;
+ if ( !bNegative )
+ {
+ for ( i=0; i < aStr.Len(); i++ )
+ {
+ if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
+ break;
+ else if ( aStr.GetChar( i ) == '-' )
+ {
+ bNegative = TRUE;
+ break;
+ }
+ }
+ }
+ if ( !bNegative && bCurrency && aStr.Len() )
+ {
+ USHORT nFormat = rInter.GetCurrNegativeFormat();
+ if ( (nFormat == 3) || (nFormat == 6) ||
+ (nFormat == 7) || (nFormat == 10) )
+ {
+ for ( i = (USHORT)(aStr.Len()-1); i > 0; i++ )
+ {
+ if ( (aStr.GetChar( i ) >= '0') && (aStr.GetChar( i ) <= '9') )
+ break;
+ else if ( aStr.GetChar( i ) == '-' )
+ {
+ bNegative = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( aStr1.GetChar( 0 ) == '-' )
+ bNegative = TRUE;
+ }
+
+ // Alle unerwuenschten Zeichen rauswerfen
+ for ( i=0; i < aStr1.Len(); )
+ {
+ if ( (aStr1.GetChar( i ) >= '0') && (aStr1.GetChar( i ) <= '9') )
+ i++;
+ else
+ aStr1.Erase( i, 1 );
+ }
+ for ( i=0; i < aStr2.Len(); )
+ {
+ if ( (aStr2.GetChar( i ) >= '0') && (aStr2.GetChar( i ) <= '9') )
+ i++;
+ else
+ aStr2.Erase( i, 1 );
+ }
+
+ if ( !aStr1.Len() && !aStr2.Len() )
+ return FALSE;
+
+ if ( !aStr1.Len() )
+ aStr1.Insert( '0' );
+ if ( bNegative )
+ aStr1.Insert( '-', 0 );
+
+ // Nachkommateil zurechtstutzen und dabei runden
+ BOOL bRound = FALSE;
+ if ( aStr2.Len() > nDecDigits )
+ {
+ if ( aStr2.GetChar( nDecDigits ) >= '5' )
+ bRound = TRUE;
+ aStr2.Erase( nDecDigits );
+ }
+ if ( aStr2.Len() < nDecDigits )
+ aStr2.Expand( nDecDigits, '0' );
+
+ aStr = aStr1;
+ aStr += aStr2;
+
+ // Bereichsueberpruefung
+ BigInt nValue( aStr );
+ if ( bRound )
+ {
+ if ( !bNegative )
+ nValue+=1;
+ else
+ nValue-=1;
+ }
+
+ rValue = nValue;
+
+ return TRUE;
+}
+
+// =======================================================================
+
+static BOOL ImplLongCurrencyProcessKeyInput( Edit* pEdit, const KeyEvent& rKEvt,
+ BOOL, const International& rInter )
+{
+ // Es gibt hier kein sinnvolles StrictFormat, also alle
+ // Zeichen erlauben
+ return ImplNumericProcessKeyInput( pEdit, rKEvt, FALSE, rInter );
+}
+
+// -----------------------------------------------------------------------
+
+inline XubString ImplLongCurrencySetValue( BigInt nValue, USHORT nDecDigits,
+ const International& rInter )
+{
+ // Umwandeln in einen Waehrungsstring
+ return rInter.GetCurr( nValue, nDecDigits ); // ???
+}
+
+// -----------------------------------------------------------------------
+
+inline BOOL ImplLongCurrencyGetValue( const XubString& rStr, BigInt& rValue,
+ USHORT nDecDigits, const International& rInter )
+{
+ // Zahlenwert holen
+ return ImplNumericGetValue( rStr, rValue, nDecDigits, rInter, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplLongCurrencyReformat( const XubString& rStr, BigInt nMin, BigInt nMax,
+ USHORT nDecDigits,
+ const International& rInter, String& rOutStr,
+ LongCurrencyFormatter& rFormatter )
+{
+ BigInt nValue;
+ if ( !ImplNumericGetValue( rStr, nValue, nDecDigits, rInter, TRUE ) )
+ return TRUE;
+ else
+ {
+ BigInt nTempVal = nValue;
+ if ( nTempVal > nMax )
+ nTempVal = nMax;
+ else if ( nTempVal < nMin )
+ nTempVal = nMin;
+
+ if ( rFormatter.GetErrorHdl().IsSet() && (nValue != nTempVal) )
+ {
+ rFormatter.mnCorrectedValue = nTempVal;
+ if ( !rFormatter.GetErrorHdl().Call( &rFormatter ) )
+ {
+ rFormatter.mnCorrectedValue = 0;
+ return FALSE;
+ }
+ else
+ rFormatter.mnCorrectedValue = 0;
+ }
+
+ rOutStr = rInter.GetCurr( nTempVal, nDecDigits );
+ return TRUE;
+ }
+}
+
+// =======================================================================
+
+void LongCurrencyFormatter::ImpInit()
+{
+ mnFieldValue = 0;
+ mnLastValue = 0;
+ mnMin = 0;
+ mnMax = 0x7FFFFFFF;
+ mnMax *= 0x7FFFFFFF;
+ mnCorrectedValue = 0;
+ mnType = FORMAT_LONGCURRENCY;
+ SetDecimalDigits( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+LongCurrencyFormatter::LongCurrencyFormatter()
+{
+ ImpInit();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::ImplLoadRes( const ResId& rResId )
+{
+ ImpInit();
+
+ ResMgr* pMgr = Resource::GetResManager();
+ USHORT nMask = pMgr->ReadShort();
+
+ if ( NUMERICFORMATTER_MIN & nMask )
+ mnMin = pMgr->ReadLong();
+
+ if ( NUMERICFORMATTER_MAX & nMask )
+ mnMax = pMgr->ReadLong();
+
+ if ( NUMERICFORMATTER_STRICTFORMAT & nMask )
+ SetStrictFormat( (BOOL)pMgr->ReadShort() );
+
+ if ( NUMERICFORMATTER_I12 & nMask )
+ {
+ SetInternational( International( ResId( (RSHEADER_TYPE *)pMgr->GetClass() ) ) );
+ pMgr->Increment( pMgr->GetObjSize( (RSHEADER_TYPE *)pMgr->GetClass() ) );
+ }
+ if ( NUMERICFORMATTER_DECIMALDIGITS & nMask )
+ SetDecimalDigits( pMgr->ReadShort() );
+
+ if ( NUMERICFORMATTER_VALUE & nMask )
+ {
+ mnFieldValue = pMgr->ReadLong();
+ if ( mnFieldValue > mnMax )
+ mnFieldValue = mnMax;
+ else if ( mnFieldValue < mnMin )
+ mnFieldValue = mnMin;
+ mnLastValue = mnFieldValue;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+LongCurrencyFormatter::~LongCurrencyFormatter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::SetValue( BigInt nNewValue )
+{
+ SetUserValue( nNewValue );
+ mnFieldValue = mnLastValue;
+ ImplGetEmptyFieldValue() = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::SetUserValue( BigInt nNewValue )
+{
+ if ( nNewValue > mnMax )
+ nNewValue = mnMax;
+ else if ( nNewValue < mnMin )
+ nNewValue = mnMin;
+ mnLastValue = nNewValue;
+
+ if ( !GetField() )
+ return;
+
+ XubString aStr = ImplLongCurrencySetValue( nNewValue, GetDecimalDigits(), GetInternational() );
+ if ( GetField()->HasFocus() )
+ {
+ Selection aSelection = GetField()->GetSelection();
+ GetField()->SetText( aStr );
+ GetField()->SetSelection( aSelection );
+ }
+ else
+ GetField()->SetText( aStr );
+ MarkToBeReformatted( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+BigInt LongCurrencyFormatter::GetValue() const
+{
+ if ( !GetField() )
+ return 0;
+
+ BigInt nTempValue;
+ if ( ImplLongCurrencyGetValue( GetField()->GetText(), nTempValue, GetDecimalDigits(),
+ GetInternational() ) )
+ {
+ if ( nTempValue > mnMax )
+ nTempValue = mnMax;
+ else if ( nTempValue < mnMin )
+ nTempValue = mnMin;
+ return nTempValue;
+ }
+ else
+ return mnLastValue;
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::Reformat()
+{
+ if ( !GetField() )
+ return;
+
+ if ( !GetField()->GetText().Len() && ImplGetEmptyFieldValue() )
+ return;
+
+ XubString aStr;
+ BOOL bOK = ImplLongCurrencyReformat( GetField()->GetText(), mnMin, mnMax,
+ GetDecimalDigits(), GetInternational(), aStr, *this );
+ if ( !bOK )
+ return;
+
+ if ( aStr.Len() )
+ {
+ GetField()->SetText( aStr );
+ MarkToBeReformatted( FALSE );
+ ImplLongCurrencyGetValue( aStr, mnLastValue, GetDecimalDigits(), GetInternational() );
+ }
+ else
+ SetValue( mnLastValue );
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::ReformatAll()
+{
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::SetMin( BigInt nNewMin )
+{
+ mnMin = nNewMin;
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::SetMax( BigInt nNewMax )
+{
+ mnMax = nNewMax;
+ ReformatAll();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::SetDecimalDigits( USHORT nDigits )
+{
+ International aInter( GetInternational() );
+ aInter.SetCurrDigits( nDigits );
+ SetInternational( aInter );
+
+// ReformatAll(); // macht SetInternational()
+}
+
+// -----------------------------------------------------------------------
+
+USHORT LongCurrencyFormatter::GetDecimalDigits() const
+{
+ return GetInternational().GetCurrDigits();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL LongCurrencyFormatter::IsValueModified() const
+{
+ if ( ImplGetEmptyFieldValue() )
+ return !IsEmptyValue();
+ else if ( GetValue() != mnFieldValue )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyFormatter::SetEmptyValue()
+{
+ GetField()->SetText( ImplGetSVEmptyStr() );
+ ImplGetEmptyFieldValue() = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BigInt LongCurrencyFormatter::Normalize( BigInt nValue ) const
+{
+ return (nValue * ImplPower10( GetDecimalDigits() ) );
+}
+
+// -----------------------------------------------------------------------
+
+BigInt LongCurrencyFormatter::Denormalize( BigInt nValue ) const
+{
+ BigInt nFactor = ImplPower10( GetDecimalDigits() );
+ BigInt nTmp = nFactor;
+ nTmp /= 2;
+ nTmp += nValue;
+ nTmp /= nFactor;
+ return nTmp;
+}
+
+// =======================================================================
+
+void ImplNewLongCurrencyFieldValue( LongCurrencyField* pField, BigInt nNewValue )
+{
+ Selection aSelect = pField->GetSelection();
+ aSelect.Justify();
+ XubString aText = pField->GetText();
+ BOOL bLastSelected = ((xub_StrLen)aSelect.Max() == aText.Len()) ? TRUE : FALSE;
+
+ BigInt nOldLastValue = pField->mnLastValue;
+ pField->SetUserValue( nNewValue );
+ pField->mnLastValue = nOldLastValue;
+
+ if ( bLastSelected )
+ {
+ if ( !aSelect.Len() )
+ aSelect.Min() = SELECTION_MAX;
+ aSelect.Max() = SELECTION_MAX;
+ }
+ pField->SetSelection( aSelect );
+ pField->SetModifyFlag();
+ pField->Modify();
+}
+
+// =======================================================================
+
+LongCurrencyField::LongCurrencyField( Window* pParent, WinBits nWinStyle ) :
+ SpinField( pParent, nWinStyle )
+{
+ SetField( this );
+ mnSpinSize = 1;
+ mnFirst = mnMin;
+ mnLast = mnMax;
+
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+LongCurrencyField::LongCurrencyField( Window* pParent, const ResId& rResId ) :
+ SpinField( WINDOW_NUMERICFIELD )
+{
+ rResId.SetRT( RSC_NUMERICFIELD );
+ WinBits nStyle = ImplInitRes( rResId ) ;
+ SpinField::ImplInit( pParent, nStyle );
+
+ SetField( this );
+ mnSpinSize = 1;
+ mnFirst = mnMin;
+ mnLast = mnMax;
+
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyField::ImplLoadRes( const ResId& rResId )
+{
+ SpinField::ImplLoadRes( rResId );
+ LongCurrencyFormatter::ImplLoadRes( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+
+ USHORT nMask = ReadShortRes();
+ if ( CURRENCYFIELD_FIRST & nMask )
+ mnFirst = ReadLongRes();
+
+ if ( CURRENCYFIELD_LAST & nMask )
+ mnLast = ReadLongRes();
+
+ if ( CURRENCYFIELD_SPINSIZE & nMask )
+ mnSpinSize = ReadLongRes();
+}
+
+// -----------------------------------------------------------------------
+
+LongCurrencyField::~LongCurrencyField()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long LongCurrencyField::PreNotify( NotifyEvent& rNEvt )
+{
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ if ( ImplLongCurrencyProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+ return SpinField::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long LongCurrencyField::Notify( NotifyEvent& rNEvt )
+{
+ if( rNEvt.GetType() == EVENT_GETFOCUS )
+ {
+ MarkToBeReformatted( FALSE );
+ }
+ else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() )
+ {
+ Reformat();
+ SpinField::Modify();
+ }
+ }
+ return SpinField::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyField::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ SpinField::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyField::Up()
+{
+ BigInt nValue = GetValue();
+ nValue += mnSpinSize;
+ if ( nValue > mnMax )
+ nValue = mnMax;
+
+ ImplNewLongCurrencyFieldValue( this, nValue );
+ SpinField::Up();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyField::Down()
+{
+ BigInt nValue = GetValue();
+ nValue -= mnSpinSize;
+ if ( nValue < mnMin )
+ nValue = mnMin;
+
+ ImplNewLongCurrencyFieldValue( this, nValue );
+ SpinField::Down();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyField::First()
+{
+ ImplNewLongCurrencyFieldValue( this, mnFirst );
+ SpinField::First();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyField::Last()
+{
+ ImplNewLongCurrencyFieldValue( this, mnLast );
+ SpinField::Last();
+}
+
+// =======================================================================
+
+LongCurrencyBox::LongCurrencyBox( Window* pParent, WinBits nWinStyle ) :
+ ComboBox( pParent, nWinStyle )
+{
+ SetField( this );
+ Reformat();
+}
+
+// -----------------------------------------------------------------------
+
+LongCurrencyBox::LongCurrencyBox( Window* pParent, const ResId& rResId ) :
+ ComboBox( WINDOW_NUMERICFIELD )
+{
+ SetField( this );
+ WinBits nStyle = ImplInitRes( rResId ) ;
+ ComboBox::ImplLoadRes( rResId );
+ LongCurrencyFormatter::ImplLoadRes( rResId );
+ Reformat();
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+LongCurrencyBox::~LongCurrencyBox()
+{
+}
+
+// -----------------------------------------------------------------------
+
+long LongCurrencyBox::PreNotify( NotifyEvent& rNEvt )
+{
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ if ( ImplLongCurrencyProcessKeyInput( GetField(), *rNEvt.GetKeyEvent(), IsStrictFormat(), GetInternational() ) )
+ return 1;
+ }
+ return ComboBox::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long LongCurrencyBox::Notify( NotifyEvent& rNEvt )
+{
+ if( rNEvt.GetType() == EVENT_GETFOCUS )
+ {
+ MarkToBeReformatted( FALSE );
+ }
+ else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( MustBeReformatted() )
+ {
+ Reformat();
+ ComboBox::Modify();
+ }
+ }
+ return ComboBox::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyBox::Modify()
+{
+ MarkToBeReformatted( TRUE );
+ ComboBox::Modify();
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyBox::ReformatAll()
+{
+ XubString aStr;
+ SetUpdateMode( FALSE );
+ USHORT nEntryCount = GetEntryCount();
+ for ( USHORT i=0; i < nEntryCount; i++ )
+ {
+ ImplLongCurrencyReformat( GetEntry( i ), mnMin, mnMax,
+ GetDecimalDigits(), GetInternational(),
+ aStr, *this );
+ RemoveEntry( i );
+ InsertEntry( aStr, i );
+ }
+ LongCurrencyFormatter::Reformat();
+ SetUpdateMode( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyBox::InsertValue( BigInt nValue, USHORT nPos )
+{
+ XubString aStr = ImplLongCurrencySetValue( nValue, GetDecimalDigits(), GetInternational() );
+ ComboBox::InsertEntry( aStr, nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void LongCurrencyBox::RemoveValue( BigInt nValue )
+{
+ XubString aStr = ImplLongCurrencySetValue( nValue, GetDecimalDigits(), GetInternational() );
+ ComboBox::RemoveEntry( aStr );
+}
+
+// -----------------------------------------------------------------------
+
+BigInt LongCurrencyBox::GetValue( USHORT nPos ) const
+{
+ BigInt nValue = 0;
+ ImplLongCurrencyGetValue( ComboBox::GetEntry( nPos ), nValue,
+ GetDecimalDigits(), GetInternational() );
+ return nValue;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT LongCurrencyBox::GetValuePos( BigInt nValue ) const
+{
+ XubString aStr = ImplLongCurrencySetValue( nValue, GetDecimalDigits(), GetInternational() );
+ return ComboBox::GetEntryPos( aStr );
+}
+
+// =======================================================================
+
+XubString International::GetCurr( const BigInt &rNumber, USHORT nDigits ) const
+{
+ DBG_ASSERT( nDigits < 10, "LongCurrency duerfen nur maximal 9 Nachkommastellen haben" );
+
+ if ( rNumber.IsZero() || (long)rNumber )
+ return GetCurr( (long)rNumber, nDigits );
+
+ BigInt aTmp( ImplPower10( nDigits ) );
+ BigInt aInteger( rNumber );
+ aInteger.Abs();
+ aInteger /= aTmp;
+ BigInt aFraction( rNumber );
+ aFraction.Abs();
+ aFraction %= aTmp;
+ if ( !aInteger.IsZero() )
+ {
+ aFraction += aTmp;
+ aTmp = 1000000000L;
+ }
+ if ( rNumber.IsNeg() )
+ aFraction *= -1;
+
+ XubString aTemplate = GetCurr( (long)aFraction, nDigits );
+ while( !aInteger.IsZero() )
+ {
+ aFraction = aInteger;
+ aFraction %= aTmp;
+ aInteger /= aTmp;
+ if( !aInteger.IsZero() )
+ aFraction += aTmp;
+
+ XubString aFractionStr = GetNum( (long)aFraction, 0 );
+
+ xub_StrLen nSPos = aTemplate.Search( '1' );
+ if ( aFractionStr.Len() == 1 )
+ aTemplate.SetChar( nSPos, aFractionStr.GetChar( 0 ) );
+ else
+ {
+ aTemplate.Erase( nSPos, 1 );
+ aTemplate.Insert( aFractionStr, nSPos );
+ }
+ }
+
+ return aTemplate;
+}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
new file mode 100644
index 000000000000..f1e6eaadef8b
--- /dev/null
+++ b/vcl/source/control/lstbox.cxx
@@ -0,0 +1,1242 @@
+/*************************************************************************
+ *
+ * $RCSfile: lstbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_LSTBOX_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SCRBAR_HXX
+#include <scrbar.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+#ifndef _SV_EDIT_HXX
+#include <edit.hxx>
+#endif
+#ifndef _SV_SUBEDIT_HXX
+#include <subedit.hxx>
+#endif
+#ifndef _SV_ILSTBOX_HXX
+#include <ilstbox.hxx>
+#endif
+#ifndef _SV_LSTBOX_HXX
+#include <lstbox.hxx>
+#endif
+#ifndef _SV_COMBOBOX_HXX
+#include <combobox.hxx>
+#endif
+
+#pragma hdrstop
+
+ // =======================================================================
+
+ListBox::ListBox( WindowType nType ) : Control( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+ListBox::ListBox( Window* pParent, WinBits nStyle ) : Control( WINDOW_LISTBOX )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ListBox::ListBox( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_LISTBOX )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_LISTBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+ListBox::~ListBox()
+{
+ delete mpImplLB;
+
+ // Beim zerstoeren des FloatWins macht TH ein GrabFocus auf den Parent,
+ // also diese ListBox => PreNotify()...
+ mpImplLB = NULL;
+
+ delete mpFloatWin;
+ delete mpImplWin;
+ delete mpBtn;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::ImplInitData()
+{
+ mpFloatWin = NULL;
+ mpImplWin = NULL;
+ mpBtn = NULL;
+
+ mnDDHeight = 0;
+ mbDDAutoSize = TRUE;
+ mnSaveValue = LISTBOX_ENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::ImplInit( Window* pParent, WinBits nStyle )
+{
+ nStyle = ImplInitStyle( nStyle );
+ if ( !(nStyle & WB_NOBORDER) && ( nStyle & WB_DROPDOWN ) )
+ nStyle |= WB_BORDER;
+
+ Control::ImplInit( pParent, nStyle, NULL );
+ SetBackground();
+
+ if( nStyle & WB_DROPDOWN )
+ {
+ long nLeft, nTop, nRight, nBottom;
+ GetBorder( nLeft, nTop, nRight, nBottom );
+ mnDDHeight = (USHORT)(GetTextHeight() + nTop + nBottom + 4);
+
+ mpFloatWin = new ImplListBoxFloatingWindow( this );
+ mpFloatWin->SetAutoWidth( TRUE );
+ mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) );
+
+ mpImplWin = new ImplWin( this, WB_NOBORDER );
+ mpImplWin->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
+ mpImplWin->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
+ mpImplWin->Show();
+
+ mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE );
+ ImplInitDropDownButton( mpBtn );
+ mpBtn->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
+ mpBtn->Show();
+
+ }
+
+ Window* pLBParent = this;
+ if ( mpFloatWin )
+ pLBParent = mpFloatWin;
+ mpImplLB = new ImplListBox( pLBParent, nStyle&(~WB_BORDER) );
+ mpImplLB->SetSelectHdl( LINK( this, ListBox, ImplSelectHdl ) );
+ mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) );
+ mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) );
+ mpImplLB->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
+ mpImplLB->SetPosPixel( Point() );
+ mpImplLB->Show();
+
+ if ( mpFloatWin )
+ {
+ mpFloatWin->SetImplListBox( mpImplLB );
+ mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) );
+ }
+ else
+ mpImplLB->GetMainWindow()->AllowGrabFocus( TRUE );
+
+ SetCompoundControl( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+WinBits ListBox::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ USHORT nSelPos = ReadShortRes();
+ USHORT nNumber = ReadShortRes();
+
+ for( USHORT i = 0; i < nNumber; i++ )
+ {
+ USHORT nPos = InsertEntry( ReadStringRes(), LISTBOX_APPEND );
+
+ long nId = ReadLongRes();
+ if( nId )
+ SetEntryData( nPos, (void *)nId ); // ID als UserData
+ }
+
+ if( nSelPos < nNumber )
+ SelectEntryPos( nSelPos );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ListBox, ImplSelectHdl, void*, EMPTYARG )
+{
+ BOOL bPopup = IsInDropDown();
+ if( IsDropDownBox() )
+ {
+ if( !mpImplLB->IsTravelSelect() )
+ {
+ mpFloatWin->EndPopupMode();
+ mpImplWin->GrabFocus();
+ }
+
+ mpImplWin->SetItemPos( GetSelectEntryPos() );
+ mpImplWin->SetString( GetSelectEntry() );
+ if( mpImplLB->GetEntryList()->HasImages() )
+ {
+ Image aImage = mpImplLB->GetEntryList()->GetEntryImage( GetSelectEntryPos() );
+ mpImplWin->SetImage( aImage );
+ }
+ mpImplWin->Invalidate();
+ }
+
+ if ( mpImplLB->IsSelectionChanged() || ( bPopup && !IsMultiSelectionEnabled() ) )
+ Select();
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ListBox, ImplCancelHdl, void*, EMPTYARG )
+{
+ if( IsInDropDown() )
+ mpFloatWin->EndPopupMode();
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ListBox, ImplSelectionChangedHdl, void*, n )
+{
+ if ( !mpImplLB->IsTrackingSelect() )
+ {
+ USHORT nChanged = (USHORT)(ULONG)n;
+ const ImplEntryList* pEntryList = mpImplLB->GetEntryList();
+ if ( pEntryList->IsEntryPosSelected( nChanged ) )
+ {
+ // Sollte mal ein ImplPaintEntry werden...
+ if ( nChanged < pEntryList->GetMRUCount() )
+ nChanged = pEntryList->FindEntry( pEntryList->GetEntryText( nChanged ), MATCH_CASE, STRING_LEN, pEntryList->GetMRUCount() );
+ mpImplWin->SetItemPos( nChanged );
+ mpImplWin->SetString( mpImplLB->GetEntryList()->GetEntryText( nChanged ) );
+ if( mpImplLB->GetEntryList()->HasImages() )
+ {
+ Image aImage = mpImplLB->GetEntryList()->GetEntryImage( nChanged );
+ mpImplWin->SetImage( aImage );
+ }
+ mpImplWin->Invalidate();
+ }
+ }
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ListBox, ImplDoubleClickHdl, void*, p )
+{
+ DoubleClick();
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ListBox, ImplClickBtnHdl, void*, EMPTYARG )
+{
+ if( !mpFloatWin->IsInPopupMode() )
+ {
+ mpImplWin->GrabFocus();
+ mpBtn->SetPressed( TRUE );
+ mpFloatWin->StartFloat( TRUE );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ListBox, ImplPopupModeEndHdl, void*, p )
+{
+ mpBtn->SetPressed( FALSE );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ mpImplLB->GetMainWindow()->ImplInitSettings( TRUE, TRUE, TRUE );
+
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
+ OutDevType eOutDevType = pDev->GetOutDevType();
+
+ pDev->Push();
+ pDev->SetMapMode();
+ pDev->SetFont( aFont );
+ pDev->SetTextFillColor();
+
+ // Border/Background
+ pDev->SetLineColor();
+ pDev->SetFillColor();
+ BOOL bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER);
+ BOOL bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground();
+ if ( bBorder || bBackground )
+ {
+ Rectangle aRect( aPos, aSize );
+ if ( bBorder )
+ {
+ DecorationView aDecoView( pDev );
+ aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+ }
+ if ( bBackground )
+ {
+ pDev->SetFillColor( GetControlBackground() );
+ pDev->DrawRect( aRect );
+ }
+ }
+
+ // Inhalt
+ if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
+ {
+ pDev->SetTextColor( Color( COL_BLACK ) );
+ }
+ else
+ {
+ if ( !(nFlags & WINDOW_DRAW_NODISABLE ) && !IsEnabled() )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ pDev->SetTextColor( rStyleSettings.GetDisableColor() );
+ }
+ else
+ {
+ pDev->SetTextColor( GetTextColor() );
+ }
+ }
+
+ long nOnePixel = GetDrawPixel( pDev, 1 );
+ if ( IsDropDownBox() )
+ {
+ XubString aText = GetSelectEntry();
+ long nTextHeight = pDev->GetTextHeight();
+ long nTextWidth = pDev->GetTextWidth( aText );
+ long nOffX = 3*nOnePixel;
+ long nOffY = (aSize.Height()-nTextHeight) / 2;
+
+ // Clipping?
+ if ( (nOffY < 0) ||
+ ((nOffY+nTextHeight) > aSize.Height()) ||
+ ((nOffX+nTextWidth) > aSize.Width()) )
+ {
+ Rectangle aClip( aPos, aSize );
+ if ( nTextHeight > aSize.Height() )
+ aClip.Bottom() += nTextHeight-aSize.Height()+1; // Damit HP-Drucker nicht 'weg-optimieren'
+ pDev->IntersectClipRegion( aClip );
+ }
+
+ pDev->DrawText( Point( aPos.X()+nOffX, aPos.Y()+nOffY ), aText );
+ }
+ else
+ {
+ long nTextHeight = pDev->GetTextHeight();
+ USHORT nLines = (USHORT)(aSize.Height() / nTextHeight);
+ Rectangle aClip( aPos, aSize );
+ pDev->IntersectClipRegion( aClip );
+ if ( !nLines )
+ nLines = 1;
+ for ( USHORT n = 0; n < nLines; n++ )
+ {
+ USHORT nEntry = n+mpImplLB->GetTopEntry();
+ BOOL bSelected = mpImplLB->GetEntryList()->IsEntryPosSelected( nEntry );
+ if ( bSelected )
+ {
+ pDev->SetFillColor( COL_BLACK );
+ pDev->DrawRect( Rectangle( Point( aPos.X(), aPos.Y() + n*nTextHeight ),
+ Point( aPos.X() + aSize.Width(), aPos.Y() + (n+1)*nTextHeight + 2*nOnePixel ) ) );
+ pDev->SetFillColor();
+ pDev->SetTextColor( COL_WHITE );
+ }
+ pDev->DrawText( Point( aPos.X() + 3*nOnePixel, aPos.Y() + n*nTextHeight + nOnePixel ), mpImplLB->GetEntryList()->GetEntryText( nEntry ) );
+ if ( bSelected )
+ pDev->SetTextColor( COL_BLACK );
+ }
+ }
+
+ pDev->Pop();
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::GetFocus()
+{
+ if ( mpImplLB )
+ {
+ if( IsDropDownBox() )
+ mpImplWin->GrabFocus();
+ else
+ mpImplLB->GrabFocus();
+ }
+
+ Control::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::LoseFocus()
+{
+ if( IsDropDownBox() )
+ mpImplWin->HideFocus();
+ else
+ mpImplLB->HideFocus();
+
+ Control::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ Resize();
+ mpImplLB->Resize(); // Wird nicht durch ListBox::Resize() gerufen, wenn sich die ImplLB nicht aendert.
+
+ if ( mpImplWin )
+ {
+ mpImplWin->SetSettings( GetSettings() ); // Falls noch nicht eingestellt...
+ ImplInitFieldSettings( mpImplWin, TRUE, TRUE, TRUE );
+
+ mpBtn->SetSettings( GetSettings() );
+ ImplInitDropDownButton( mpBtn );
+ }
+
+
+ if ( IsDropDownBox() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::EnableAutoSize( BOOL bAuto )
+{
+ mbDDAutoSize = bAuto;
+ if ( mpFloatWin )
+ {
+ if ( bAuto && !mpFloatWin->GetDropDownLineCount() )
+ mpFloatWin->SetDropDownLineCount( 5 );
+ else if ( !bAuto )
+ mpFloatWin->SetDropDownLineCount( 0 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetDropDownLineCount( USHORT nLines )
+{
+ if ( mpFloatWin )
+ mpFloatWin->SetDropDownLineCount( nLines );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetDropDownLineCount() const
+{
+ USHORT nLines = 0;
+ if ( mpFloatWin )
+ nLines = mpFloatWin->GetDropDownLineCount();
+ return nLines;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetPosSizePixel( long nX, long nY, long nWidth, long nHeight, USHORT nFlags )
+{
+ if( IsDropDownBox() && ( nFlags & WINDOW_POSSIZE_SIZE ) )
+ {
+ Size aPrefSz = mpFloatWin->GetPrefSize();
+ if ( ( nFlags & WINDOW_POSSIZE_HEIGHT ) && ( nHeight > mnDDHeight ) )
+ aPrefSz.Height() = nHeight-mnDDHeight;
+ if ( nFlags & WINDOW_POSSIZE_WIDTH )
+ aPrefSz.Width() = nWidth;
+ mpFloatWin->SetPrefSize( aPrefSz );
+
+ if ( IsAutoSizeEnabled() )
+ nHeight = mnDDHeight;
+ }
+
+ Control::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::Resize()
+{
+ Size aOutSz = GetOutputSizePixel();
+ if( IsDropDownBox() )
+ {
+ long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSBWidth = CalcZoom( nSBWidth );
+ mpImplWin->SetPosSizePixel( 0, 0, aOutSz.Width() - nSBWidth, aOutSz.Height() );
+ mpBtn->SetPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() );
+ }
+ else
+ {
+ mpImplLB->SetSizePixel( aOutSz );
+ }
+
+ // FloatingWindow-Groesse auch im unsichtbare Zustand auf Stand halten,
+ // weil KEY_PGUP/DOWN ausgewertet wird...
+ if ( mpFloatWin )
+ mpFloatWin->SetSizePixel( mpFloatWin->CalcFloatSize() );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::StateChanged( StateChangedType nType )
+{
+ if( nType == STATE_CHANGE_READONLY )
+ {
+ if( mpImplWin )
+ mpImplWin->Enable( !IsReadOnly() );
+ if( mpBtn )
+ mpBtn->Enable( !IsReadOnly() );
+ }
+ else if( nType == STATE_CHANGE_ENABLE )
+ {
+ mpImplLB->Enable( IsEnabled() );
+ if( mpImplWin )
+ {
+ mpImplWin->Enable( IsEnabled() );
+ mpImplWin->Invalidate();
+ }
+ if( mpBtn )
+ mpBtn->Enable( IsEnabled() );
+ }
+ else if( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ mpImplLB->SetUpdateMode( IsUpdateMode() );
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ mpImplLB->SetZoom( GetZoom() );
+ if ( mpImplWin )
+ {
+ mpImplWin->SetZoom( GetZoom() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
+ mpImplWin->Invalidate();
+ }
+ Resize();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ mpImplLB->SetControlFont( GetControlFont() );
+ if ( mpImplWin )
+ {
+ mpImplWin->SetControlFont( GetControlFont() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
+ mpImplWin->Invalidate();
+ }
+ Resize();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ mpImplLB->SetControlForeground( GetControlForeground() );
+ if ( mpImplWin )
+ {
+ mpImplWin->SetControlForeground( GetControlForeground() );
+ mpImplWin->SetTextColor( GetControlForeground() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
+ mpImplWin->Invalidate();
+ }
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ mpImplLB->SetControlBackground( GetControlBackground() );
+ if ( mpImplWin )
+ {
+ mpImplWin->SetBackground( mpImplLB->GetMainWindow()->GetControlBackground() );
+ mpImplWin->SetControlBackground( mpImplLB->GetMainWindow()->GetControlBackground() );
+ mpImplWin->SetFont( mpImplLB->GetMainWindow()->GetFont() );
+ mpImplWin->Invalidate();
+ }
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE );
+ }
+
+ Control::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+long ListBox::PreNotify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+ if ( mpImplLB )
+ {
+ if( ( rNEvt.GetType() == EVENT_KEYINPUT ) && ( rNEvt.GetWindow() == mpImplWin ) )
+ {
+ KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
+ switch( aKeyEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_DOWN:
+ {
+ if( mpFloatWin && !mpFloatWin->IsInPopupMode() &&
+ aKeyEvt.GetKeyCode().IsMod2() )
+ {
+ mpBtn->SetPressed( TRUE );
+ mpFloatWin->StartFloat( FALSE );
+ nDone = 1;
+ }
+ else
+ {
+ nDone = mpImplLB->ProcessKeyInput( aKeyEvt );
+ }
+ }
+ break;
+ case KEY_UP:
+ {
+ if( mpFloatWin && mpFloatWin->IsInPopupMode() &&
+ aKeyEvt.GetKeyCode().IsMod2() )
+ {
+ mpFloatWin->EndPopupMode();
+ nDone = 1;
+ }
+ else
+ {
+ nDone = mpImplLB->ProcessKeyInput( aKeyEvt );
+ }
+ }
+ break;
+ case KEY_RETURN:
+ {
+ if( IsInDropDown() )
+ {
+ mpImplLB->ProcessKeyInput( aKeyEvt );
+ nDone = 1;
+ }
+ }
+ break;
+
+ default:
+ nDone = mpImplLB->ProcessKeyInput( aKeyEvt );
+ }
+ }
+ else if ( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ if ( IsInDropDown() && !HasChildPathFocus( TRUE ) )
+ mpFloatWin->EndPopupMode();
+ }
+ else if ( (rNEvt.GetType() == EVENT_COMMAND) &&
+ (rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) &&
+ (rNEvt.GetWindow() == mpImplWin) )
+ {
+ nDone = mpImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
+ }
+ }
+
+ return nDone ? nDone : Control::PreNotify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::Clear()
+{
+ mpImplLB->Clear();
+ if( IsDropDownBox() )
+ {
+ mpImplWin->SetItemPos( LISTBOX_ENTRY_NOTFOUND );
+ mpImplWin->SetString( ImplGetSVEmptyStr() );
+ Image aImage;
+ mpImplWin->SetImage( aImage );
+ mpImplWin->Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetNoSelection()
+{
+ mpImplLB->SetNoSelection();
+ if( IsDropDownBox() )
+ {
+ mpImplWin->SetItemPos( LISTBOX_ENTRY_NOTFOUND );
+ mpImplWin->SetString( ImplGetSVEmptyStr() );
+ Image aImage;
+ mpImplWin->SetImage( aImage );
+ mpImplWin->Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::InsertEntry( const XubString& rStr, USHORT nPos )
+{
+ USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr );
+ nRealPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nRealPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::InsertEntry( const Image& rImage, USHORT nPos )
+{
+ USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rImage );
+ nRealPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nRealPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::InsertEntry( const XubString& rStr, const Image& rImage, USHORT nPos )
+{
+ USHORT nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), rStr, rImage );
+ nRealPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nRealPos;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::RemoveEntry( const XubString& rStr )
+{
+ RemoveEntry( GetEntryPos( rStr ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::RemoveEntry( USHORT nPos )
+{
+ mpImplLB->RemoveEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetEntryPos( const XubString& rStr ) const
+{
+ USHORT nPos = mpImplLB->GetEntryList()->FindEntry( rStr, MATCH_CASE, STRING_LEN, mpImplLB->GetEntryList()->GetMRUCount() );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ nPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetEntryPos( const void* pData ) const
+{
+ USHORT nPos = mpImplLB->GetEntryList()->FindEntry( pData );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ nPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+XubString ListBox::GetEntry( USHORT nPos ) const
+{
+ return mpImplLB->GetEntryList()->GetEntryText( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetEntryCount() const
+{
+ return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount();
+}
+
+// -----------------------------------------------------------------------
+
+XubString ListBox::GetSelectEntry( USHORT nIndex ) const
+{
+ return GetEntry( GetSelectEntryPos( nIndex ) );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetSelectEntryCount() const
+{
+ return mpImplLB->GetEntryList()->GetSelectEntryCount();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetSelectEntryPos( USHORT nIndex ) const
+{
+ USHORT nPos = mpImplLB->GetEntryList()->GetSelectEntryPos( nIndex );
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() )
+ nPos = mpImplLB->GetEntryList()->FindEntry( mpImplLB->GetEntryList()->GetEntryText( nPos ), MATCH_CASE, STRING_LEN, mpImplLB->GetEntryList()->GetMRUCount() );
+ nPos -= mpImplLB->GetEntryList()->GetMRUCount();
+ }
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ListBox::IsEntrySelected( const XubString& rStr ) const
+{
+ return IsEntryPosSelected( GetEntryPos( rStr ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ListBox::IsEntryPosSelected( USHORT nPos ) const
+{
+ return mpImplLB->GetEntryList()->IsEntryPosSelected( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SelectEntry( const XubString& rStr, BOOL bSelect )
+{
+ SelectEntryPos( GetEntryPos( rStr ), bSelect );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SelectEntryPos( USHORT nPos, BOOL bSelect )
+{
+ if ( nPos < mpImplLB->GetEntryList()->GetEntryCount() )
+ mpImplLB->SelectEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), bSelect );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetEntryData( USHORT nPos, void* pNewData )
+{
+ mpImplLB->SetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount(), pNewData );
+}
+
+// -----------------------------------------------------------------------
+
+void* ListBox::GetEntryData( USHORT nPos ) const
+{
+ return mpImplLB->GetEntryList()->GetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetTopEntry( USHORT nPos )
+{
+ mpImplLB->SetTopEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetTopEntry() const
+{
+ USHORT nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND;
+ if ( nPos < mpImplLB->GetEntryList()->GetMRUCount() )
+ nPos = 0;
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ListBox::IsTravelSelect() const
+{
+ return mpImplLB->IsTravelSelect();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ListBox::IsInDropDown() const
+{
+ return mpFloatWin && mpFloatWin->IsInPopupMode();
+}
+
+// -----------------------------------------------------------------------
+
+long ListBox::CalcWindowSizePixel( USHORT nLines ) const
+{
+ return mpImplLB->GetEntryHeight() * nLines;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::EnableMultiSelection( BOOL bMulti )
+{
+ mpImplLB->EnableMultiSelection( bMulti );
+
+ // WB_SIMPLEMODE:
+ // Die MultiListBox verhält sich wie eine normale ListBox.
+ // Die Mehrfachselektion kann nur über entsprechende Zusatztasten erfolgen.
+
+ BOOL bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) ? TRUE : FALSE;
+ mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
+
+ // ohne Focus ist das Traveln in einer MultiSelection nicht zu sehen:
+ if ( mpFloatWin )
+ mpImplLB->GetMainWindow()->AllowGrabFocus( bMulti );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ListBox::IsMultiSelectionEnabled() const
+{
+ return mpImplLB->IsMultiSelectionEnabled();
+}
+
+// -----------------------------------------------------------------------
+
+Size ListBox::CalcMinimumSize() const
+{
+ Size aSz;
+ if ( !IsDropDownBox() )
+ {
+ aSz = mpImplLB->CalcSize( mpImplLB->GetEntryList()->GetEntryCount() );
+ }
+ else
+ {
+ aSz.Height() = mpImplLB->CalcSize( 1 ).Height();
+ aSz.Width() = mpImplLB->GetMaxEntryWidth();
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ }
+
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Size ListBox::CalcAdjustedSize( const Size& rPrefSize ) const
+{
+ Size aSz = rPrefSize;
+ long nLeft, nTop, nRight, nBottom;
+ ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
+ aSz.Height() -= nTop+nBottom;
+ if ( !IsDropDownBox() )
+ {
+ long nEntryHeight = CalcSize( 1, 1 ).Height();
+ long nLines = aSz.Height() / nEntryHeight;
+ if ( nLines < 1 )
+ nLines = 1;
+ aSz.Height() = nLines * nEntryHeight;
+ }
+ else
+ {
+ aSz.Height() = mnDDHeight;
+ }
+ aSz.Height() += nTop+nBottom;
+
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Size ListBox::CalcSize( USHORT nColumns, USHORT nLines ) const
+{
+ // ggf. werden ScrollBars eingeblendet
+ Size aMinSz = CalcMinimumSize();
+// aMinSz = ImplCalcOutSz( aMinSz );
+
+ Size aSz;
+
+ // Hoehe
+ if ( nLines )
+ {
+ if ( !IsDropDownBox() )
+ aSz.Height() = mpImplLB->CalcSize( nLines ).Height();
+ else
+ aSz.Height() = mnDDHeight;
+ }
+ else
+ aSz.Height() = aMinSz.Height();
+
+ // Breite
+ if ( nColumns )
+ aSz.Width() = nColumns * GetTextWidth( XubString( 'X' ) );
+ else
+ aSz.Width() = aMinSz.Width();
+
+ if ( IsDropDownBox() )
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+
+ if ( !IsDropDownBox() )
+ {
+ if ( aSz.Width() < aMinSz.Width() )
+ aSz.Height() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ if ( aSz.Height() < aMinSz.Height() )
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ }
+
+ aSz = CalcWindowSize( aSz );
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const
+{
+ long nCharWidth = GetTextWidth( UniString( 'x' ) );
+ if ( !IsDropDownBox() )
+ {
+ Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel();
+ rnCols = (USHORT) (aOutSz.Width()/nCharWidth);
+ rnLines = (USHORT) (aOutSz.Height()/mpImplLB->GetEntryHeight());
+ }
+ else
+ {
+ Size aOutSz = mpImplWin->GetOutputSizePixel();
+ rnCols = (USHORT) (aOutSz.Width()/nCharWidth);
+ rnLines = 1;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ListBox, ImplUserDrawHdl, UserDrawEvent*, pEvent )
+{
+ UserDraw( *pEvent );
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::UserDraw( const UserDrawEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+#if SUPD < 593
+void ListBox::DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText )
+{
+ if ( rEvt.GetDevice() == mpImplLB->GetMainWindow() )
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText );
+ else if ( rEvt.GetDevice() == mpImplWin )
+ mpImplWin->DrawEntry( bDrawImage, bDrawText );
+}
+#endif
+
+void ListBox::DrawEntry( const UserDrawEvent& rEvt, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos )
+{
+ if ( rEvt.GetDevice() == mpImplLB->GetMainWindow() )
+ mpImplLB->GetMainWindow()->DrawEntry( rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos );
+ else if ( rEvt.GetDevice() == mpImplWin )
+ mpImplWin->DrawEntry( bDrawImage, bDrawText, bDrawTextAtImagePos );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetUserItemSize( const Size& rSz )
+{
+ mpImplLB->GetMainWindow()->SetUserItemSize( rSz );
+ if ( mpImplWin )
+ mpImplWin->SetUserItemSize( rSz );
+}
+
+// -----------------------------------------------------------------------
+
+const Size& ListBox::GetUserItemSize() const
+{
+ return mpImplLB->GetMainWindow()->GetUserItemSize();
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::EnableUserDraw( BOOL bUserDraw )
+{
+ mpImplLB->GetMainWindow()->EnableUserDraw( bUserDraw );
+ if ( mpImplWin )
+ mpImplWin->EnableUserDraw( bUserDraw );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ListBox::IsUserDrawEnabled() const
+{
+ return mpImplLB->GetMainWindow()->IsUserDrawEnabled();
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetReadOnly( BOOL bReadOnly )
+{
+ if ( mpImplLB->IsReadOnly() != bReadOnly )
+ {
+ mpImplLB->SetReadOnly( bReadOnly );
+ StateChanged( STATE_CHANGE_READONLY );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ListBox::IsReadOnly() const
+{
+ return mpImplLB->IsReadOnly();
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetSeparatorPos( USHORT n )
+{
+ mpImplLB->SetSeparatorPos( n );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetSeparatorPos()
+{
+ mpImplLB->SetSeparatorPos( LISTBOX_ENTRY_NOTFOUND );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetSeparatorPos() const
+{
+ return mpImplLB->GetSeparatorPos();
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetMRUEntries( const XubString& rEntries, xub_Unicode cSep )
+{
+ mpImplLB->SetMRUEntries( rEntries, cSep );
+}
+
+// -----------------------------------------------------------------------
+
+XubString ListBox::GetMRUEntries( xub_Unicode cSep ) const
+{
+ return mpImplLB->GetMRUEntries( cSep );
+}
+
+// -----------------------------------------------------------------------
+
+void ListBox::SetMaxMRUCount( USHORT n )
+{
+ mpImplLB->SetMaxMRUCount( n );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ListBox::GetMaxMRUCount() const
+{
+ return mpImplLB->GetMaxMRUCount();
+}
+
+// =======================================================================
+
+MultiListBox::MultiListBox( Window* pParent, WinBits nStyle ) :
+ ListBox( WINDOW_MULTILISTBOX )
+{
+ ImplInit( pParent, nStyle );
+ EnableMultiSelection( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+MultiListBox::MultiListBox( Window* pParent, const ResId& rResId ) :
+ ListBox( WINDOW_MULTILISTBOX )
+{
+ rResId.SetRT( RSC_MULTILISTBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE ) )
+ Show();
+ EnableMultiSelection( TRUE );
+}
diff --git a/vcl/source/control/makefile.mk b/vcl/source/control/makefile.mk
new file mode 100644
index 000000000000..ba03559c2b71
--- /dev/null
+++ b/vcl/source/control/makefile.mk
@@ -0,0 +1,119 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=vcl
+TARGET=ctrl
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(COM)"=="ICC"
+CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/button.obj \
+ $(SLO)$/ctrl.obj \
+ $(SLO)$/combobox.obj \
+ $(SLO)$/edit.obj \
+ $(SLO)$/field.obj \
+ $(SLO)$/field2.obj \
+ $(SLO)$/fixbrd.obj \
+ $(SLO)$/fixed.obj \
+ $(SLO)$/group.obj \
+ $(SLO)$/ilstbox.obj \
+ $(SLO)$/imgctrl.obj \
+ $(SLO)$/longcurr.obj \
+ $(SLO)$/lstbox.obj \
+ $(SLO)$/morebtn.obj \
+ $(SLO)$/menubtn.obj \
+ $(SLO)$/scrbar.obj \
+ $(SLO)$/slider.obj \
+ $(SLO)$/spinfld.obj \
+ $(SLO)$/spinbtn.obj \
+ $(SLO)$/tabctrl.obj
+
+.IF "$(remote)"!=""
+EXCEPTIONSFILES= \
+ $(SLO)$/button.obj \
+ $(SLO)$/ctrl.obj \
+ $(SLO)$/edit.obj \
+ $(SLO)$/field.obj \
+ $(SLO)$/field2.obj \
+ $(SLO)$/longcurr.obj \
+ $(SLO)$/ilstbox.obj \
+ $(SLO)$/tabctrl.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
new file mode 100644
index 000000000000..6891577b0b54
--- /dev/null
+++ b/vcl/source/control/menubtn.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * $RCSfile: menubtn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_MENUBTN_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_MENU_HXX
+#include <menu.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_MENUBTN_HXX
+#include <menubtn.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define IMAGEBUTTON_BORDER_OFF1 11
+#define IMAGEBUTTON_BORDER_OFF2 16
+
+// =======================================================================
+
+void MenuButton::ImplInitData()
+{
+ mnDDStyle = PUSHBUTTON_DROPDOWN_MENUBUTTON;
+
+ mpMenuTimer = NULL;
+ mpMenu = NULL;
+ mpOwnMenu = NULL;
+ mnCurItemId = 0;
+ mnMenuMode = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+
+ PushButton::ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::ImplExecuteMenu()
+{
+ Activate();
+
+ if ( mpMenu )
+ {
+ Point aPos( 0, 1 );
+ Size aSize = GetSizePixel();
+ Rectangle aRect( aPos, aSize );
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( !((GetStyle() & (WB_RECTSTYLE | WB_SMALLSTYLE)) ||
+ !(rStyleSettings.GetOptions() & STYLE_OPTION_MACSTYLE)) )
+ {
+ aRect.Left() += 2;
+ aRect.Top() += 2;
+ aRect.Right() -= 2;
+ aRect.Bottom() -= 2;
+ }
+ SetPressed( TRUE );
+ EndSelection();
+ mnCurItemId = mpMenu->Execute( this, aRect, POPUPMENU_EXECUTE_DOWN );
+ SetPressed( FALSE );
+ if ( mnCurItemId )
+ {
+ Select();
+ mnCurItemId = 0;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MenuButton::MenuButton( Window* pParent, WinBits nWinBits ) :
+ PushButton( WINDOW_MENUBUTTON )
+{
+ ImplInitData();
+ ImplInit( pParent, nWinBits );
+}
+
+// -----------------------------------------------------------------------
+
+MenuButton::MenuButton( Window* pParent, const ResId& rResId ) :
+ PushButton( WINDOW_MENUBUTTON )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_MENUBUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ USHORT nObjMask = ReadShortRes();
+
+ if ( RSCMENUBUTTON_MENU & nObjMask )
+ {
+ mpOwnMenu = new PopupMenu( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ SetPopupMenu( mpOwnMenu );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MenuButton::~MenuButton()
+{
+ if ( mpMenuTimer )
+ delete mpMenuTimer;
+ if ( mpOwnMenu )
+ delete mpOwnMenu;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MenuButton, ImplMenuTimeoutHdl, Timer*, EMPTYARG )
+{
+ // Abfragen, ob Button-Benutzung noch aktiv ist, da diese ja auch
+ // vorher abgebrochen wurden sein koennte
+ if ( IsTracking() )
+ {
+ if ( !(GetStyle() & WB_NOPOINTERFOCUS) )
+ GrabFocus();
+ ImplExecuteMenu();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( mnMenuMode & MENUBUTTON_MENUMODE_TIMED )
+ {
+ if ( !mpMenuTimer )
+ {
+ mpMenuTimer = new Timer;
+ mpMenuTimer->SetTimeoutHdl( LINK( this, MenuButton, ImplMenuTimeoutHdl ) );
+ }
+
+ mpMenuTimer->SetTimeout( GetSettings().GetMouseSettings().GetActionDelay() );
+ mpMenuTimer->Start();
+
+ PushButton::MouseButtonDown( rMEvt );
+ }
+ else
+ {
+ if ( PushButton::ImplHitTestPushButton( this, rMEvt.GetPosPixel(), 0 ) )
+ {
+ if ( !(GetStyle() & WB_NOPOINTERFOCUS) )
+ GrabFocus();
+ ImplExecuteMenu();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+ USHORT nCode = aKeyCode.GetCode();
+ if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() )
+ ImplExecuteMenu();
+ else if ( !(mnMenuMode & MENUBUTTON_MENUMODE_TIMED) &&
+ !aKeyCode.GetModifier() &&
+ ((nCode == KEY_RETURN) || (nCode == KEY_SPACE)) )
+ ImplExecuteMenu();
+ else
+ PushButton::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::Activate()
+{
+ maActivateHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::SetMenuMode( USHORT nMode )
+{
+ // Fuer die 5.1-Auslieferung besser noch nicht inline, ansonsten kann
+ // diese Funktion zur 6.0 inline werden
+ mnMenuMode = nMode;
+}
+
+// -----------------------------------------------------------------------
+
+void MenuButton::SetPopupMenu( PopupMenu* pNewMenu )
+{
+ // Fuer die 5.1-Auslieferung besser noch nicht inline, ansonsten kann
+ // diese Funktion zur 6.0 inline werden
+ mpMenu = pNewMenu;
+}
diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
new file mode 100644
index 000000000000..6712e2e20399
--- /dev/null
+++ b/vcl/source/control/morebtn.cxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: morebtn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_MOREBTN_CXX
+
+#ifndef _SV_MOREBTN_HXX
+#include <morebtn.hxx>
+#endif
+
+#ifndef _SV_RD_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+// Muss mit der Laenge der folgenden Texte uebereinstimmen
+#define EXTRA_TEXTLEN 3
+
+static sal_Char const aImplMoreOpen[] = " >>";
+static sal_Char const aImplMoreClose[] = " <<";
+
+DECLARE_LIST( ImplMoreWindowList, Window* );
+
+// =======================================================================
+
+void MoreButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ mpItemList = NULL;
+ mnDelta = 0;
+ meUnit = MAP_PIXEL;
+ mbState = FALSE;
+
+ PushButton::ImplInit( pParent, nStyle );
+
+ SetText( Button::GetStandardText( BUTTON_MORE ) );
+ SetHelpText( Button::GetStandardHelpText( BUTTON_MORE ) );
+}
+
+// -----------------------------------------------------------------------
+
+MoreButton::MoreButton( Window* pParent, WinBits nStyle ) :
+ PushButton( WINDOW_MOREBUTTON )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+MoreButton::MoreButton( Window* pParent, const ResId& rResId ) :
+ PushButton( WINDOW_MOREBUTTON )
+{
+ rResId.SetRT( RSC_MOREBUTTON );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void MoreButton::ImplLoadRes( const ResId& rResId )
+{
+ PushButton::ImplLoadRes( rResId );
+
+ USHORT nObjMask = ReadShortRes();
+
+ if ( nObjMask & RSC_MOREBUTTON_STATE )
+ {
+ // Nicht Methode rufen, da Dialog nicht umgeschaltet werden soll
+ mbState = (BOOL)ReadShortRes();
+ SetText( GetText() );
+ }
+ if ( nObjMask & RSC_MOREBUTTON_MAPUNIT )
+ meUnit = (MapUnit)ReadShortRes();
+ if ( nObjMask & RSC_MOREBUTTON_DELTA )
+ // Groesse fuer Erweitern des Dialogs
+ mnDelta = ReadShortRes();
+}
+
+// -----------------------------------------------------------------------
+
+MoreButton::~MoreButton()
+{
+ if ( mpItemList )
+ delete mpItemList;
+}
+
+// -----------------------------------------------------------------------
+
+void MoreButton::Click()
+{
+ Window* pParent = GetParent();
+ Size aSize( pParent->GetSizePixel() );
+ Window* pWindow = (mpItemList) ? mpItemList->First() : NULL;
+ long nDeltaPixel = LogicToPixel( Size( 0, mnDelta ), meUnit ).Height();
+
+ // Status aendern
+ XubString aText = GetText();
+ mbState = !mbState;
+ SetText( aText );
+
+ // Hier den Click-Handler rufen, damit vorher die Controls initialisiert
+ // werden koennen
+ PushButton::Click();
+
+ // Je nach Status die Fenster updaten
+ if ( mbState )
+ {
+ // Fenster anzeigen
+ while ( pWindow )
+ {
+ pWindow->Show();
+ pWindow = mpItemList->Next();
+ }
+
+ // Dialogbox anpassen
+ Point aPos( pParent->GetPosPixel() );
+ Rectangle aDeskRect( pParent->ImplGetFrameWindow()->GetDesktopRectPixel() );
+
+ aSize.Height() += nDeltaPixel;
+ if ( (aPos.Y()+aSize.Height()) > aDeskRect.Bottom() )
+ {
+ aPos.Y() = aDeskRect.Bottom()-aSize.Height();
+
+ if ( aPos.Y() < aDeskRect.Top() )
+ aPos.Y() = aDeskRect.Top();
+
+ pParent->SetPosSizePixel( aPos, aSize );
+ }
+ else
+ pParent->SetSizePixel( aSize );
+ }
+ else
+ {
+ // Dialogbox anpassen
+ aSize.Height() -= nDeltaPixel;
+ pParent->SetSizePixel( aSize );
+
+ // Fenster nicht mehr anzeigen
+ while ( pWindow )
+ {
+ pWindow->Hide();
+ pWindow = mpItemList->Next();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void MoreButton::AddWindow( Window* pWindow )
+{
+ if ( !mpItemList )
+ mpItemList = new ImplMoreWindowList( 1024, 16, 16 );
+
+ mpItemList->Insert( pWindow, LIST_APPEND );
+
+ if ( mbState )
+ pWindow->Show();
+ else
+ pWindow->Hide();
+}
+
+// -----------------------------------------------------------------------
+
+void MoreButton::RemoveWindow( Window* pWindow )
+{
+ if ( mpItemList )
+ mpItemList->Remove( pWindow );
+}
+
+// -----------------------------------------------------------------------
+
+void MoreButton::SetText( const XubString& rText )
+{
+ XubString aText = rText;
+
+ if ( !mbState )
+ aText.AppendAscii( aImplMoreOpen );
+ else
+ aText.AppendAscii( aImplMoreClose );
+
+ PushButton::SetText( aText );
+}
+
+// -----------------------------------------------------------------------
+
+XubString MoreButton::GetText() const
+{
+ XubString aText = PushButton::GetText();
+
+ XubString aSubText = aText.Copy( aText.Len()-EXTRA_TEXTLEN, EXTRA_TEXTLEN );
+ if ( !mbState )
+ {
+ if ( aSubText.EqualsAscii( aImplMoreOpen ) )
+ aText.Erase( aText.Len()-EXTRA_TEXTLEN, EXTRA_TEXTLEN );
+ }
+ else
+ {
+ if ( aSubText.EqualsAscii( aImplMoreClose ) )
+ aText.Erase( aText.Len()-EXTRA_TEXTLEN, EXTRA_TEXTLEN );
+ }
+
+ return aText;
+}
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
new file mode 100644
index 000000000000..e070b607dd74
--- /dev/null
+++ b/vcl/source/control/scrbar.cxx
@@ -0,0 +1,1245 @@
+/*************************************************************************
+ *
+ * $RCSfile: scrbar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SCRBAR_CXX
+
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SOUND_HXX
+#include <sound.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_SCRBAR_HXX
+#include <scrbar.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+static long ImplMulDiv( long nNumber, long nNumerator, long nDenominator )
+{
+ double n = ((double)nNumber * (double)nNumerator) / (double)nDenominator;
+ return (long)n;
+}
+
+// =======================================================================
+
+#define SCRBAR_DRAW_BTN1 ((USHORT)0x0001)
+#define SCRBAR_DRAW_BTN2 ((USHORT)0x0002)
+#define SCRBAR_DRAW_PAGE1 ((USHORT)0x0004)
+#define SCRBAR_DRAW_PAGE2 ((USHORT)0x0008)
+#define SCRBAR_DRAW_THUMB ((USHORT)0x0010)
+#define SCRBAR_DRAW_ALL (SCRBAR_DRAW_BTN1 | SCRBAR_DRAW_BTN2 | \
+ SCRBAR_DRAW_PAGE1 | SCRBAR_DRAW_PAGE2 |\
+ SCRBAR_DRAW_THUMB)
+
+#define SCRBAR_STATE_BTN1_DOWN ((USHORT)0x0001)
+#define SCRBAR_STATE_BTN1_DISABLE ((USHORT)0x0002)
+#define SCRBAR_STATE_BTN2_DOWN ((USHORT)0x0004)
+#define SCRBAR_STATE_BTN2_DISABLE ((USHORT)0x0008)
+#define SCRBAR_STATE_PAGE1_DOWN ((USHORT)0x0010)
+#define SCRBAR_STATE_PAGE2_DOWN ((USHORT)0x0020)
+#define SCRBAR_STATE_THUMB_DOWN ((USHORT)0x0040)
+
+#define SCRBAR_MIN_THUMB 8
+
+#define SCRBAR_VIEW_STYLE (WB_3DLOOK | WB_HORZ | WB_VERT)
+
+// =======================================================================
+
+void ScrollBar::ImplInit( Window* pParent, WinBits nStyle )
+{
+ mpDDScrollTimer = NULL;
+ mnThumbPixRange = 0;
+ mnThumbPixPos = 0;
+ mnThumbPixSize = 0;
+ mnMinRange = 0;
+ mnMaxRange = 100;
+ mnThumbPos = 0;
+ mnVisibleSize = 0;
+ mnLineSize = 1;
+ mnPageSize = 1;
+ mnDelta = 0;
+ mnDragDraw = 0;
+ mnStateFlags = 0;
+ meScrollType = SCROLL_DONTKNOW;
+ meDDScrollType = SCROLL_DONTKNOW;
+ mbCalcSize = TRUE;
+ mbFullDrag = 0;
+ mbDDScroll = FALSE;
+
+ ImplInitStyle( nStyle );
+ Control::ImplInit( pParent, nStyle, NULL );
+
+ long nScrollSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+ SetSizePixel( Size( nScrollSize, nScrollSize ) );
+ SetBackground();
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::ImplInitStyle( WinBits nStyle )
+{
+ if ( nStyle & WB_DRAG )
+ mbFullDrag = TRUE;
+ else
+ mbFullDrag = (GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL) != 0;
+}
+
+// -----------------------------------------------------------------------
+
+ScrollBar::ScrollBar( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_SCROLLBAR )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ScrollBar::ScrollBar( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_SCROLLBAR )
+{
+ rResId.SetRT( RSC_SCROLLBAR );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+ScrollBar::~ScrollBar()
+{
+ if ( mpDDScrollTimer )
+ {
+ delete mpDDScrollTimer;
+ mpDDScrollTimer = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ INT16 nMin = ReadShortRes();
+ INT16 nMax = ReadShortRes();
+ INT16 nThumbPos = ReadShortRes();
+ INT16 nPage = ReadShortRes();
+ INT16 nStep = ReadShortRes();
+ INT16 nVisibleSize = ReadShortRes();
+
+ SetRange( Range( nMin, nMax ) );
+ SetLineSize( nStep );
+ SetPageSize( nPage );
+ SetVisibleSize( nVisibleSize );
+ SetThumbPos( nThumbPos );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ScrollBar::ImplUpdateThumbRect( const Rectangle& rOldRect )
+{
+ Size aThumbRectSize = rOldRect.GetSize();
+/* !!! Wegen ueberlappenden Fenstern ... !!!
+ if ( aThumbRectSize == maThumbRect.GetSize() )
+ {
+ DrawOutDev( maThumbRect.TopLeft(), aThumbRectSize,
+ rOldRect.TopLeft(), aThumbRectSize );
+ return TRUE;
+ }
+ else
+*/
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::ImplUpdateRects( BOOL bUpdate )
+{
+ USHORT nOldStateFlags = mnStateFlags;
+ Rectangle aOldPage1Rect = maPage1Rect;
+ Rectangle aOldPage2Rect = maPage2Rect;
+ Rectangle aOldThumbRect = maThumbRect;
+
+ mnStateFlags &= ~SCRBAR_STATE_BTN1_DISABLE;
+ mnStateFlags &= ~SCRBAR_STATE_BTN2_DISABLE;
+
+ if ( mnThumbPixRange )
+ {
+ if ( GetStyle() & WB_HORZ )
+ {
+ maThumbRect.Left() = maBtn1Rect.Right()+1+mnThumbPixPos;
+ maThumbRect.Right() = maThumbRect.Left()+mnThumbPixSize-1;
+ if ( !mnThumbPixPos )
+ maPage1Rect.Right() = RECT_EMPTY;
+ else
+ maPage1Rect.Right() = maThumbRect.Left()-1;
+ if ( mnThumbPixPos >= (mnThumbPixRange-mnThumbPixSize) )
+ maPage2Rect.Right() = RECT_EMPTY;
+ else
+ {
+ maPage2Rect.Left() = maThumbRect.Right()+1;
+ maPage2Rect.Right() = maBtn2Rect.Left()-1;
+ }
+ }
+ else
+ {
+ maThumbRect.Top() = maBtn1Rect.Bottom()+1+mnThumbPixPos;
+ maThumbRect.Bottom() = maThumbRect.Top()+mnThumbPixSize-1;
+ if ( !mnThumbPixPos )
+ maPage1Rect.Bottom() = RECT_EMPTY;
+ else
+ maPage1Rect.Bottom() = maThumbRect.Top()-1;
+ if ( mnThumbPixPos >= (mnThumbPixRange-mnThumbPixSize) )
+ maPage2Rect.Bottom() = RECT_EMPTY;
+ else
+ {
+ maPage2Rect.Top() = maThumbRect.Bottom()+1;
+ maPage2Rect.Bottom() = maBtn2Rect.Top()-1;
+ }
+ }
+ }
+
+ if ( mnThumbPos == mnMinRange )
+ mnStateFlags |= SCRBAR_STATE_BTN1_DISABLE;
+ if ( mnThumbPos >= (mnMaxRange-mnVisibleSize) )
+ mnStateFlags |= SCRBAR_STATE_BTN2_DISABLE;
+
+ if ( bUpdate )
+ {
+ USHORT nDraw = 0;
+ if ( (nOldStateFlags & SCRBAR_STATE_BTN1_DISABLE) !=
+ (mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
+ nDraw |= SCRBAR_DRAW_BTN1;
+ if ( (nOldStateFlags & SCRBAR_STATE_BTN2_DISABLE) !=
+ (mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
+ nDraw |= SCRBAR_DRAW_BTN2;
+ if ( aOldPage1Rect != maPage1Rect )
+ nDraw |= SCRBAR_DRAW_PAGE1;
+ if ( aOldPage2Rect != maPage2Rect )
+ nDraw |= SCRBAR_DRAW_PAGE2;
+ if ( aOldThumbRect != maThumbRect )
+ {
+ if ( !ImplUpdateThumbRect( aOldThumbRect ) )
+ nDraw |= SCRBAR_DRAW_THUMB;
+ }
+ ImplDraw( nDraw );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ScrollBar::ImplCalcThumbPos( long nPixPos )
+{
+ // Position berechnen
+ long nCalcThumbPos;
+ nCalcThumbPos = ImplMulDiv( nPixPos, mnMaxRange-mnVisibleSize-mnMinRange,
+ mnThumbPixRange-mnThumbPixSize );
+ nCalcThumbPos += mnMinRange;
+ return nCalcThumbPos;
+}
+
+// -----------------------------------------------------------------------
+
+long ScrollBar::ImplCalcThumbPosPix( long nPos )
+{
+ long nCalcThumbPos;
+
+ // Position berechnen
+ nCalcThumbPos = ImplMulDiv( nPos-mnMinRange, mnThumbPixRange-mnThumbPixSize,
+ mnMaxRange-mnVisibleSize-mnMinRange );
+
+ // Am Anfang und Ende des ScrollBars versuchen wir die Anzeige korrekt
+ // anzuzeigen
+ if ( !nCalcThumbPos && (mnThumbPos > mnMinRange) )
+ nCalcThumbPos = 1;
+ if ( nCalcThumbPos &&
+ ((nCalcThumbPos+mnThumbPixSize) >= mnThumbPixRange) &&
+ (mnThumbPos < (mnMaxRange-mnVisibleSize)) )
+ nCalcThumbPos--;
+
+ return nCalcThumbPos;
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::ImplCalc( BOOL bUpdate )
+{
+ if ( mbCalcSize )
+ {
+ Size aSize = GetOutputSizePixel();
+ Size aBtnSize;
+
+ if ( GetStyle() & WB_HORZ )
+ {
+ if ( aSize.Height()*2 > aSize.Width()-SCRBAR_MIN_THUMB )
+ {
+ mnThumbPixRange = 0;
+ maBtn1Rect.Bottom() = aSize.Height()-1;
+ maBtn1Rect.Right() = aSize.Width()/2;
+ maBtn2Rect.Bottom() = maBtn1Rect.Bottom();
+ maBtn2Rect.Left() = maBtn1Rect.Right()+1;
+ maBtn2Rect.Right() = aSize.Width()-1;
+ }
+ else
+ {
+ mnThumbPixRange = aSize.Width()-(aSize.Height()*2);
+ aBtnSize = Size( aSize.Height(), aSize.Height() );
+ maBtn2Rect.Left() = aSize.Width()-aSize.Height();
+ maBtn1Rect.SetSize( aBtnSize );
+ maBtn2Rect.SetSize( aBtnSize );
+ maPage1Rect.Left() = maBtn1Rect.Right()+1;
+ maPage1Rect.Bottom() = maBtn1Rect.Bottom();
+ maPage2Rect.Bottom() = maBtn1Rect.Bottom();
+ maThumbRect.Bottom() = maBtn1Rect.Bottom();
+ }
+ }
+ else
+ {
+ if ( aSize.Width()*2 > aSize.Height()-SCRBAR_MIN_THUMB )
+ {
+ mnThumbPixRange = 0;
+ maBtn1Rect.Right() = aSize.Width()-1;
+ maBtn1Rect.Bottom() = aSize.Height()/2;
+ maBtn2Rect.Right() = maBtn1Rect.Right();
+ maBtn2Rect.Top() = maBtn1Rect.Bottom()+1;
+ maBtn2Rect.Bottom() = aSize.Height()-1;
+ }
+ else
+ {
+ mnThumbPixRange = aSize.Height()-(aSize.Width()*2);
+ aBtnSize = Size( aSize.Width(), aSize.Width() );
+ maBtn2Rect.Top() = aSize.Height()-aSize.Width();
+ maBtn1Rect.SetSize( aBtnSize );
+ maBtn2Rect.SetSize( aBtnSize );
+ maPage1Rect.Top() = maBtn1Rect.Bottom()+1;
+ maPage1Rect.Right() = maBtn1Rect.Right();
+ maPage2Rect.Right() = maBtn1Rect.Right();
+ maThumbRect.Right() = maBtn1Rect.Right();
+ }
+ }
+
+ if ( !mnThumbPixRange )
+ {
+ maPage1Rect.SetEmpty();
+ maPage2Rect.SetEmpty();
+ maThumbRect.SetEmpty();
+ }
+
+ mbCalcSize = FALSE;
+ }
+
+ if ( mnThumbPixRange )
+ {
+ // Werte berechnen
+ if ( (mnVisibleSize >= (mnMaxRange-mnMinRange)) ||
+ ((mnMaxRange-mnMinRange) <= 0) )
+ {
+ mnThumbPos = mnMinRange;
+ mnThumbPixPos = 0;
+ mnThumbPixSize = mnThumbPixRange;
+ }
+ else
+ {
+ if ( mnVisibleSize )
+ mnThumbPixSize = ImplMulDiv( mnThumbPixRange, mnVisibleSize, mnMaxRange-mnMinRange );
+ else
+ {
+ if ( GetStyle() & WB_HORZ )
+ mnThumbPixSize = maThumbRect.GetHeight();
+ else
+ mnThumbPixSize = maThumbRect.GetWidth();
+ }
+ if ( mnThumbPixSize < SCRBAR_MIN_THUMB )
+ mnThumbPixSize = SCRBAR_MIN_THUMB;
+ if ( mnThumbPixSize > mnThumbPixRange )
+ mnThumbPixSize = mnThumbPixRange;
+ mnThumbPixPos = ImplCalcThumbPosPix( mnThumbPos );
+ }
+ }
+
+ // Wenn neu ausgegeben werden soll und wir schon ueber eine
+ // Aktion einen Paint-Event ausgeloest bekommen haben, dann
+ // geben wir nicht direkt aus, sondern invalidieren nur alles
+ if ( bUpdate && HasPaintEvent() )
+ {
+ Invalidate();
+ bUpdate = FALSE;
+ }
+ ImplUpdateRects( bUpdate );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::ImplDraw( USHORT nDrawFlags )
+{
+ DecorationView aDecoView( this );
+ Rectangle aTempRect;
+ USHORT nStyle;
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SymbolType eSymbolType;
+ BOOL bEnabled = IsEnabled();
+
+ // Evt. noch offene Berechnungen nachholen
+ if ( mbCalcSize )
+ ImplCalc( FALSE );
+
+ if ( nDrawFlags & SCRBAR_DRAW_BTN1 )
+ {
+ nStyle = BUTTON_DRAW_NOLIGHTBORDER;
+ if ( mnStateFlags & SCRBAR_STATE_BTN1_DOWN )
+ nStyle |= BUTTON_DRAW_PRESSED;
+ aTempRect = aDecoView.DrawButton( maBtn1Rect, nStyle );
+ ImplCalcSymbolRect( aTempRect );
+ nStyle = 0;
+ if ( (mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) || !bEnabled )
+ nStyle |= SYMBOL_DRAW_DISABLE;
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_SCROLLARROW )
+ {
+ if ( GetStyle() & WB_HORZ )
+ eSymbolType = SYMBOL_ARROW_LEFT;
+ else
+ eSymbolType = SYMBOL_ARROW_UP;
+ }
+ else
+ {
+ if ( GetStyle() & WB_HORZ )
+ eSymbolType = SYMBOL_SPIN_LEFT;
+ else
+ eSymbolType = SYMBOL_SPIN_UP;
+ }
+ aDecoView.DrawSymbol( aTempRect, eSymbolType, rStyleSettings.GetButtonTextColor(), nStyle );
+ }
+
+ if ( nDrawFlags & SCRBAR_DRAW_BTN2 )
+ {
+ nStyle = BUTTON_DRAW_NOLIGHTBORDER;
+ if ( mnStateFlags & SCRBAR_STATE_BTN2_DOWN )
+ nStyle |= BUTTON_DRAW_PRESSED;
+ aTempRect = aDecoView.DrawButton( maBtn2Rect, nStyle );
+ ImplCalcSymbolRect( aTempRect );
+ nStyle = 0;
+ if ( (mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) || !bEnabled )
+ nStyle |= SYMBOL_DRAW_DISABLE;
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_SCROLLARROW )
+ {
+ if ( GetStyle() & WB_HORZ )
+ eSymbolType = SYMBOL_ARROW_RIGHT;
+ else
+ eSymbolType = SYMBOL_ARROW_DOWN;
+ }
+ else
+ {
+ if ( GetStyle() & WB_HORZ )
+ eSymbolType = SYMBOL_SPIN_RIGHT;
+ else
+ eSymbolType = SYMBOL_SPIN_DOWN;
+ }
+ aDecoView.DrawSymbol( aTempRect, eSymbolType, rStyleSettings.GetButtonTextColor(), nStyle );
+ }
+
+ SetLineColor();
+
+ if ( nDrawFlags & SCRBAR_DRAW_THUMB )
+ {
+ if ( !maThumbRect.IsEmpty() )
+ {
+ if ( bEnabled )
+ {
+ nStyle = BUTTON_DRAW_NOLIGHTBORDER;
+ if ( mnStateFlags & SCRBAR_STATE_THUMB_DOWN )
+ nStyle |= BUTTON_DRAW_PRESSED;
+ aTempRect = aDecoView.DrawButton( maThumbRect, nStyle );
+ // Im OS2-Look geben wir auch ein Muster auf dem Thumb aus
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_OS2STYLE )
+ {
+ if ( GetStyle() & WB_HORZ )
+ {
+ if ( aTempRect.GetWidth() > 6 )
+ {
+ long nX = aTempRect.Center().X();
+ nX -= 6;
+ if ( nX < aTempRect.Left() )
+ nX = aTempRect.Left();
+ for ( int i = 0; i < 6; i++ )
+ {
+ if ( nX > aTempRect.Right()-1 )
+ break;
+
+ SetLineColor( rStyleSettings.GetButtonTextColor() );
+ DrawLine( Point( nX, aTempRect.Top()+1 ),
+ Point( nX, aTempRect.Bottom()-1 ) );
+ nX++;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( nX, aTempRect.Top()+1 ),
+ Point( nX, aTempRect.Bottom()-1 ) );
+ nX++;
+ }
+ }
+ }
+ else
+ {
+ if ( aTempRect.GetHeight() > 6 )
+ {
+ long nY = aTempRect.Center().Y();
+ nY -= 6;
+ if ( nY < aTempRect.Top() )
+ nY = aTempRect.Top();
+ for ( int i = 0; i < 6; i++ )
+ {
+ if ( nY > aTempRect.Bottom()-1 )
+ break;
+
+ SetLineColor( rStyleSettings.GetButtonTextColor() );
+ DrawLine( Point( aTempRect.Left()+1, nY ),
+ Point( aTempRect.Right()-1, nY ) );
+ nY++;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( aTempRect.Left()+1, nY ),
+ Point( aTempRect.Right()-1, nY ) );
+ nY++;
+ }
+ }
+ }
+ SetLineColor();
+ }
+ }
+ else
+ {
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ DrawRect( maThumbRect );
+ }
+ }
+ }
+
+ if ( nDrawFlags & SCRBAR_DRAW_PAGE1 )
+ {
+ if ( mnStateFlags & SCRBAR_STATE_PAGE1_DOWN )
+ SetFillColor( rStyleSettings.GetShadowColor() );
+ else
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ DrawRect( maPage1Rect );
+ }
+ if ( nDrawFlags & SCRBAR_DRAW_PAGE2 )
+ {
+ if ( mnStateFlags & SCRBAR_STATE_PAGE2_DOWN )
+ SetFillColor( rStyleSettings.GetShadowColor() );
+ else
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ DrawRect( maPage2Rect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ScrollBar::ImplScroll( long nNewPos, BOOL bCallEndScroll )
+{
+ long nOldPos = mnThumbPos;
+ SetThumbPos( nNewPos );
+ long nDelta = mnThumbPos-nOldPos;
+ if ( nDelta )
+ {
+ mnDelta = nDelta;
+ Scroll();
+ if ( bCallEndScroll )
+ EndScroll();
+ mnDelta = 0;
+ }
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+long ScrollBar::ImplDoAction( BOOL bCallEndScroll )
+{
+ long nDelta = 0;
+
+ switch ( meScrollType )
+ {
+ case SCROLL_LINEUP:
+ nDelta = ImplScroll( mnThumbPos-mnLineSize, bCallEndScroll );
+ break;
+
+ case SCROLL_LINEDOWN:
+ nDelta = ImplScroll( mnThumbPos+mnLineSize, bCallEndScroll );
+ break;
+
+ case SCROLL_PAGEUP:
+ nDelta = ImplScroll( mnThumbPos-mnPageSize, bCallEndScroll );
+ break;
+
+ case SCROLL_PAGEDOWN:
+ nDelta = ImplScroll( mnThumbPos+mnPageSize, bCallEndScroll );
+ break;
+ }
+
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction )
+{
+ USHORT nOldStateFlags = mnStateFlags;
+ BOOL bAction = FALSE;
+
+ switch ( meScrollType )
+ {
+ case SCROLL_LINEUP:
+ if ( maBtn1Rect.IsInside( rMousePos ) )
+ {
+ bAction = bCallAction;
+ mnStateFlags |= SCRBAR_STATE_BTN1_DOWN;
+ }
+ else
+ mnStateFlags &= ~SCRBAR_STATE_BTN1_DOWN;
+ break;
+
+ case SCROLL_LINEDOWN:
+ if ( maBtn2Rect.IsInside( rMousePos ) )
+ {
+ bAction = bCallAction;
+ mnStateFlags |= SCRBAR_STATE_BTN2_DOWN;
+ }
+ else
+ mnStateFlags &= ~SCRBAR_STATE_BTN2_DOWN;
+ break;
+
+ case SCROLL_PAGEUP:
+ if ( maPage1Rect.IsInside( rMousePos ) )
+ {
+ bAction = bCallAction;
+ mnStateFlags |= SCRBAR_STATE_PAGE1_DOWN;
+ }
+ else
+ mnStateFlags &= ~SCRBAR_STATE_PAGE1_DOWN;
+ break;
+
+ case SCROLL_PAGEDOWN:
+ if ( maPage2Rect.IsInside( rMousePos ) )
+ {
+ bAction = bCallAction;
+ mnStateFlags |= SCRBAR_STATE_PAGE2_DOWN;
+ }
+ else
+ mnStateFlags &= ~SCRBAR_STATE_PAGE2_DOWN;
+ break;
+ }
+
+ if ( nOldStateFlags != mnStateFlags )
+ ImplDraw( mnDragDraw );
+ if ( bAction )
+ ImplDoAction( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScrollBar, ImplTimerHdl, Timer*, pTimer )
+{
+ pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() );
+ DoScroll( meDDScrollType );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ const Point& rMousePos = rMEvt.GetPosPixel();
+ USHORT nTrackFlags = 0;
+
+ if ( maBtn1Rect.IsInside( rMousePos ) )
+ {
+ if ( !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
+ {
+ nTrackFlags = STARTTRACK_BUTTONREPEAT;
+ meScrollType = SCROLL_LINEUP;
+ mnDragDraw = SCRBAR_DRAW_BTN1;
+ }
+ else
+ Sound::Beep( SOUND_DISABLE, this );
+ }
+ else if ( maBtn2Rect.IsInside( rMousePos ) )
+ {
+ if ( !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
+ {
+ nTrackFlags = STARTTRACK_BUTTONREPEAT;
+ meScrollType = SCROLL_LINEDOWN;
+ mnDragDraw = SCRBAR_DRAW_BTN2;
+ }
+ else
+ Sound::Beep( SOUND_DISABLE, this );
+ }
+ else if ( maThumbRect.IsInside( rMousePos ) )
+ {
+ if ( mnVisibleSize < mnMaxRange-mnMinRange )
+ {
+ nTrackFlags = 0;
+ meScrollType = SCROLL_DRAG;
+ mnDragDraw = SCRBAR_DRAW_THUMB;
+
+ // Zusaetzliche Daten berechnen
+ if ( GetStyle() & WB_HORZ )
+ mnMouseOff = rMousePos.X()-maThumbRect.Left();
+ else
+ mnMouseOff = rMousePos.Y()-maThumbRect.Top();
+
+ // Im OS2-Look geben wir den Thumb gedrueck aus
+ if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_OS2STYLE )
+ {
+ mnStateFlags |= SCRBAR_STATE_THUMB_DOWN;
+ ImplDraw( mnDragDraw );
+ }
+ }
+ else
+ Sound::Beep( SOUND_DISABLE, this );
+ }
+ else
+ {
+ nTrackFlags = STARTTRACK_BUTTONREPEAT;
+
+ if ( maPage1Rect.IsInside( rMousePos ) )
+ {
+ meScrollType = SCROLL_PAGEUP;
+ mnDragDraw = SCRBAR_DRAW_PAGE1;
+ }
+ else
+ {
+ meScrollType = SCROLL_PAGEDOWN;
+ mnDragDraw = SCRBAR_DRAW_PAGE2;
+ }
+ }
+
+ // Soll Tracking gestartet werden
+ if ( meScrollType != SCROLL_DONTKNOW )
+ {
+ // Startposition merken fuer Abbruch und EndScroll-Delta
+ mnStartPos = mnThumbPos;
+ ImplDoMouseAction( rMousePos );
+ StartTracking( nTrackFlags );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ // Button und PageRect-Status wieder herstellen
+ USHORT nOldStateFlags = mnStateFlags;
+ mnStateFlags &= ~(SCRBAR_STATE_BTN1_DOWN | SCRBAR_STATE_BTN2_DOWN |
+ SCRBAR_STATE_PAGE1_DOWN | SCRBAR_STATE_PAGE2_DOWN |
+ SCRBAR_STATE_THUMB_DOWN);
+ if ( nOldStateFlags != mnStateFlags )
+ ImplDraw( mnDragDraw );
+ mnDragDraw = 0;
+
+ // Bei Abbruch, die alte ThumbPosition wieder herstellen
+ if ( rTEvt.IsTrackingCanceled() )
+ {
+ long nOldPos = mnThumbPos;
+ SetThumbPos( mnStartPos );
+ mnDelta = mnThumbPos-nOldPos;
+ Scroll();
+ }
+
+ if ( meScrollType == SCROLL_DRAG )
+ {
+ // Wenn gedragt wurde, berechnen wir den Thumb neu, damit
+ // er wieder auf einer gerundeten ThumbPosition steht
+ ImplCalc();
+
+ if ( !mbFullDrag && (mnStartPos != mnThumbPos) )
+ {
+ mnDelta = mnThumbPos-mnStartPos;
+ Scroll();
+ mnDelta = 0;
+ }
+ }
+
+ mnDelta = mnThumbPos-mnStartPos;
+ EndScroll();
+ mnDelta = 0;
+ meScrollType = SCROLL_DONTKNOW;
+ }
+ else
+ {
+ const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+
+ // Dragging wird speziell behandelt
+ if ( meScrollType == SCROLL_DRAG )
+ {
+ long nMovePix;
+ if ( GetStyle() & WB_HORZ )
+ nMovePix = rMousePos.X()-(maThumbRect.Left()+mnMouseOff);
+ else
+ nMovePix = rMousePos.Y()-(maThumbRect.Top()+mnMouseOff);
+ // Nur wenn sich Maus in die Scrollrichtung bewegt, muessen
+ // wir etwas tun
+ if ( nMovePix )
+ {
+ mnThumbPixPos += nMovePix;
+ if ( mnThumbPixPos < 0 )
+ mnThumbPixPos = 0;
+ if ( mnThumbPixPos > (mnThumbPixRange-mnThumbPixSize) )
+ mnThumbPixPos = mnThumbPixRange-mnThumbPixSize;
+ long nOldPos = mnThumbPos;
+ mnThumbPos = ImplCalcThumbPos( mnThumbPixPos );
+ ImplUpdateRects();
+ if ( mbFullDrag && (nOldPos != mnThumbPos) )
+ {
+ mnDelta = mnThumbPos-nOldPos;
+ Scroll();
+ mnDelta = 0;
+ }
+ }
+ }
+ else
+ ImplDoMouseAction( rMousePos, rTEvt.IsTrackingRepeat() );
+
+ // Wenn ScrollBar-Werte so umgesetzt wurden, das es nichts
+ // mehr zum Tracking gibt, dann berechen wir hier ab
+ if ( !IsVisible() || (mnVisibleSize >= (mnMaxRange-mnMinRange)) )
+ EndTracking();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( !rKEvt.GetKeyCode().GetModifier() )
+ {
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_HOME:
+ DoScroll( 0 );
+ break;
+
+ case KEY_END:
+ DoScroll( GetRangeMax() );
+ break;
+
+ case KEY_LEFT:
+ case KEY_UP:
+ DoScrollAction( SCROLL_LINEUP );
+ break;
+
+ case KEY_RIGHT:
+ case KEY_DOWN:
+ DoScrollAction( SCROLL_LINEDOWN );
+ break;
+
+ case KEY_PAGEUP:
+ DoScrollAction( SCROLL_PAGEUP );
+ break;
+
+ case KEY_PAGEDOWN:
+ DoScrollAction( SCROLL_PAGEDOWN );
+ break;
+
+ default:
+ Control::KeyInput( rKEvt );
+ break;
+ }
+ }
+ else
+ Control::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::Paint( const Rectangle& rRect )
+{
+ ImplDraw( SCRBAR_DRAW_ALL );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::Resize()
+{
+ mbCalcSize = TRUE;
+ if ( IsReallyVisible() )
+ ImplCalc( FALSE );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ScrollBar::QueryDrop( DropEvent& rDEvt )
+{
+ if ( mbDDScroll )
+ DDScroll( rDEvt );
+ return Control::QueryDrop( rDEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ ImplCalc( FALSE );
+ else if ( nType == STATE_CHANGE_DATA )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ ImplCalc( TRUE );
+ }
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ ImplCalc( FALSE );
+ Invalidate();
+ }
+ }
+ else if ( nType == STATE_CHANGE_ENABLE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ ImplInitStyle( GetStyle() );
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( (GetPrevStyle() & SCRBAR_VIEW_STYLE) !=
+ (GetStyle() & SCRBAR_VIEW_STYLE) )
+ {
+ mbCalcSize = TRUE;
+ ImplCalc( FALSE );
+ Invalidate();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::Scroll()
+{
+ maScrollHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::EndScroll()
+{
+ maEndScrollHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+long ScrollBar::DoScroll( long nNewPos )
+{
+ if ( meScrollType != SCROLL_DONTKNOW )
+ return 0;
+
+ meScrollType = SCROLL_DRAG;
+ long nDelta = ImplScroll( nNewPos, TRUE );
+ meScrollType = SCROLL_DONTKNOW;
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+long ScrollBar::DoScrollAction( ScrollType eScrollType )
+{
+ if ( (meScrollType != SCROLL_DONTKNOW) ||
+ (eScrollType == SCROLL_DONTKNOW) ||
+ (eScrollType == SCROLL_DRAG) )
+ return 0;
+
+ meScrollType = eScrollType;
+ long nDelta = ImplDoAction( TRUE );
+ meScrollType = SCROLL_DONTKNOW;
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::DDScroll( const DropEvent& rDEvt )
+{
+ if ( rDEvt.IsLeaveWindow() )
+ meDDScrollType = SCROLL_DONTKNOW;
+ else
+ {
+ const Point& rMousePos = rDEvt.GetPosPixel();
+ if ( maBtn1Rect.IsInside( rMousePos ) )
+ {
+ if ( !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
+ meDDScrollType = SCROLL_LINEUP;
+ }
+ else if ( maBtn2Rect.IsInside( rMousePos ) )
+ {
+ if ( !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
+ meDDScrollType = SCROLL_LINEDOWN;
+ }
+ else if ( maThumbRect.IsInside( rMousePos ) )
+ meDDScrollType = SCROLL_DONTKNOW;
+ else
+ {
+ if ( maPage1Rect.IsInside( rMousePos ) )
+ meDDScrollType = SCROLL_PAGEUP;
+ else
+ meDDScrollType = SCROLL_PAGEDOWN;
+ }
+ }
+
+ if ( meDDScrollType == SCROLL_DONTKNOW )
+ {
+ if ( mpDDScrollTimer )
+ {
+ delete mpDDScrollTimer;
+ mpDDScrollTimer = NULL;
+ meDDScrollType = SCROLL_DONTKNOW;
+ }
+ }
+ else
+ {
+ if ( !mpDDScrollTimer )
+ {
+ mpDDScrollTimer = new Timer;
+ mpDDScrollTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() );
+ mpDDScrollTimer->SetTimeoutHdl( LINK( this, ScrollBar, ImplTimerHdl ) );
+ mpDDScrollTimer->Start();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::SetRangeMin( long nNewRange )
+{
+ SetRange( Range( nNewRange, GetRangeMax() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::SetRangeMax( long nNewRange )
+{
+ SetRange( Range( GetRangeMin(), nNewRange ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::SetRange( const Range& rRange )
+{
+ // Range einpassen
+ Range aRange = rRange;
+ aRange.Justify();
+ long nNewMinRange = aRange.Min();
+ long nNewMaxRange = aRange.Max();
+
+ // Wenn Range sich unterscheidet, dann neuen setzen
+ if ( (mnMinRange != nNewMinRange) ||
+ (mnMaxRange != nNewMaxRange) )
+ {
+ mnMinRange = nNewMinRange;
+ mnMaxRange = nNewMaxRange;
+
+ // Thumb einpassen
+ if ( mnThumbPos > mnMaxRange-mnVisibleSize )
+ mnThumbPos = mnMaxRange-mnVisibleSize;
+ if ( mnThumbPos < mnMinRange )
+ mnThumbPos = mnMinRange;
+
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::SetThumbPos( long nNewThumbPos )
+{
+ if ( nNewThumbPos > mnMaxRange-mnVisibleSize )
+ nNewThumbPos = mnMaxRange-mnVisibleSize;
+ if ( nNewThumbPos < mnMinRange )
+ nNewThumbPos = mnMinRange;
+
+ if ( mnThumbPos != nNewThumbPos )
+ {
+ mnThumbPos = nNewThumbPos;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBar::SetVisibleSize( long nNewSize )
+{
+ if ( mnVisibleSize != nNewSize )
+ {
+ mnVisibleSize = nNewSize;
+
+ // Thumb einpassen
+ if ( mnThumbPos > mnMaxRange-mnVisibleSize )
+ mnThumbPos = mnMaxRange-mnVisibleSize;
+ if ( mnThumbPos < mnMinRange )
+ mnThumbPos = mnMinRange;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// =======================================================================
+
+void ScrollBarBox::ImplInit( Window* pParent, WinBits nStyle )
+{
+ Window::ImplInit( pParent, nStyle, NULL );
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ long nScrollSize = rStyleSettings.GetScrollBarSize();
+ SetSizePixel( Size( nScrollSize, nScrollSize ) );
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+ScrollBarBox::ScrollBarBox( Window* pParent, WinBits nStyle ) :
+ Window( WINDOW_SCROLLBARBOX )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ScrollBarBox::ScrollBarBox( Window* pParent, const ResId& rResId ) :
+ Window( WINDOW_SCROLLBARBOX )
+{
+ rResId.SetRT( RSC_SCROLLBAR );
+ ImplInit( pParent, ImplInitRes( rResId ) );
+ ImplLoadRes( rResId );
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBarBox::ImplInitSettings()
+{
+ // Hack, damit man auch DockingWindows ohne Hintergrund bauen kann
+ // und noch nicht alles umgestellt ist
+ if ( IsBackground() )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else
+ aColor = GetSettings().GetStyleSettings().GetFaceColor();
+ SetBackground( aColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBarBox::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScrollBarBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
new file mode 100644
index 000000000000..3d8fca3c2501
--- /dev/null
+++ b/vcl/source/control/slider.cxx
@@ -0,0 +1,1024 @@
+/*************************************************************************
+ *
+ * $RCSfile: slider.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SLIDER_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_SLIDER_HXX
+#include <slider.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+static long ImplMulDiv( long nNumber, long nNumerator, long nDenominator )
+{
+ double n = ((double)nNumber * (double)nNumerator) / (double)nDenominator;
+ return (long)n;
+}
+
+// =======================================================================
+
+#define SLIDER_DRAW_THUMB ((USHORT)0x0001)
+#define SLIDER_DRAW_CHANNEL1 ((USHORT)0x0002)
+#define SLIDER_DRAW_CHANNEL2 ((USHORT)0x0004)
+#define SLIDER_DRAW_CHANNEL (SLIDER_DRAW_CHANNEL1 | SLIDER_DRAW_CHANNEL2)
+#define SLIDER_DRAW_ALL (SLIDER_DRAW_THUMB | SLIDER_DRAW_CHANNEL)
+
+#define SLIDER_STATE_CHANNEL1_DOWN ((USHORT)0x0001)
+#define SLIDER_STATE_CHANNEL2_DOWN ((USHORT)0x0002)
+#define SLIDER_STATE_THUMB_DOWN ((USHORT)0x0004)
+
+#define SLIDER_THUMB_SIZE 9
+#define SLIDER_THUMB_HALFSIZE 4
+#define SLIDER_CHANNEL_OFFSET 0
+#define SLIDER_CHANNEL_SIZE 4
+#define SLIDER_CHANNEL_HALFSIZE 2
+
+#define SLIDER_HEIGHT 16
+
+#define SLIDER_VIEW_STYLE (WB_3DLOOK | WB_HORZ | WB_VERT)
+
+// =======================================================================
+
+void Slider::ImplInit( Window* pParent, WinBits nStyle )
+{
+ mnThumbPixOffset = 0;
+ mnThumbPixRange = 0;
+ mnThumbPixPos = 0; // between mnThumbPixOffset and mnThumbPixOffset+mnThumbPixRange
+ mnChannelPixOffset = 0;
+ mnChannelPixRange = 0;
+ mnChannelPixTop = 0;
+ mnChannelPixBottom = 0;
+
+ mnMinRange = 0;
+ mnMaxRange = 100;
+ mnThumbPos = 0;
+ mnLineSize = 1;
+ mnPageSize = 1;
+ mnDelta = 0;
+ mnDragDraw = 0;
+ mnStateFlags = 0;
+ meScrollType = SCROLL_DONTKNOW;
+ mbCalcSize = TRUE;
+ mbFullDrag = TRUE;
+
+ ImplInitStyle( nStyle );
+ Control::ImplInit( pParent, nStyle, NULL );
+
+ ImplInitSettings();
+ SetSizePixel( CalcWindowSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::ImplInitStyle( WinBits nStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+
+Slider::Slider( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_SLIDER )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+Slider::Slider( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_SLIDER )
+{
+ rResId.SetRT( RSC_SCROLLBAR );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ INT16 nMin = ReadShortRes();
+ INT16 nMax = ReadShortRes();
+ INT16 nThumbPos = ReadShortRes();
+ INT16 nPage = ReadShortRes();
+ INT16 nStep = ReadShortRes();
+ INT16 nVisibleSize = ReadShortRes();
+
+ SetRange( Range( nMin, nMax ) );
+ SetLineSize( nStep );
+ SetPageSize( nPage );
+ SetThumbPos( nThumbPos );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::ImplInitSettings()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::ImplUpdateRects( BOOL bUpdate )
+{
+ Rectangle aOldThumbRect = maThumbRect;
+
+ if ( mnThumbPixRange )
+ {
+ if ( GetStyle() & WB_HORZ )
+ {
+ maThumbRect.Left() = mnThumbPixPos-SLIDER_THUMB_HALFSIZE;
+ maThumbRect.Right() = maThumbRect.Left()+SLIDER_THUMB_SIZE-1;
+ if ( mnChannelPixOffset < maThumbRect.Left() )
+ {
+ maChannel1Rect.Left() = mnChannelPixOffset;
+ maChannel1Rect.Right() = maThumbRect.Left()-1;
+ maChannel1Rect.Top() = mnChannelPixTop;
+ maChannel1Rect.Bottom() = mnChannelPixBottom;
+ }
+ else
+ maChannel1Rect.SetEmpty();
+ if ( mnChannelPixOffset+mnChannelPixRange-1 > maThumbRect.Right() )
+ {
+ maChannel2Rect.Left() = maThumbRect.Right()+1;
+ maChannel2Rect.Right() = mnChannelPixOffset+mnChannelPixRange-1;
+ maChannel2Rect.Top() = mnChannelPixTop;
+ maChannel2Rect.Bottom() = mnChannelPixBottom;
+ }
+ else
+ maChannel2Rect.SetEmpty();
+ }
+ else
+ {
+ maThumbRect.Top() = mnThumbPixPos-SLIDER_THUMB_HALFSIZE;
+ maThumbRect.Bottom() = maThumbRect.Top()+SLIDER_THUMB_SIZE-1;
+ if ( mnChannelPixOffset < maThumbRect.Top() )
+ {
+ maChannel1Rect.Top() = mnChannelPixOffset;
+ maChannel1Rect.Bottom() = maThumbRect.Top()-1;
+ maChannel1Rect.Left() = mnChannelPixTop;
+ maChannel1Rect.Right() = mnChannelPixBottom;
+ }
+ else
+ maChannel1Rect.SetEmpty();
+ if ( mnChannelPixOffset+mnChannelPixRange-1 > maThumbRect.Bottom() )
+ {
+ maChannel2Rect.Top() = maThumbRect.Bottom()+1;
+ maChannel2Rect.Bottom() = mnChannelPixOffset+mnChannelPixRange-1;
+ maChannel2Rect.Left() = mnChannelPixTop;
+ maChannel2Rect.Right() = mnChannelPixBottom;
+ }
+ else
+ maChannel2Rect.SetEmpty();
+ }
+ }
+ else
+ {
+ maChannel1Rect.SetEmpty();
+ maChannel2Rect.SetEmpty();
+ maThumbRect.SetEmpty();
+ }
+
+ if ( bUpdate )
+ {
+ if ( aOldThumbRect != maThumbRect )
+ {
+ Region aInvalidRegion( aOldThumbRect );
+ aInvalidRegion.Union( maThumbRect );
+ Invalidate( aInvalidRegion );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long Slider::ImplCalcThumbPos( long nPixPos )
+{
+ // Position berechnen
+ long nCalcThumbPos;
+ nCalcThumbPos = ImplMulDiv( nPixPos-mnThumbPixOffset, mnMaxRange-mnMinRange, mnThumbPixRange-1 );
+ nCalcThumbPos += mnMinRange;
+ return nCalcThumbPos;
+}
+
+// -----------------------------------------------------------------------
+
+long Slider::ImplCalcThumbPosPix( long nPos )
+{
+ // Position berechnen
+ long nCalcThumbPos;
+ nCalcThumbPos = ImplMulDiv( nPos-mnMinRange, mnThumbPixRange-1, mnMaxRange-mnMinRange );
+ // Am Anfang und Ende des Sliders versuchen wir die Anzeige korrekt
+ // anzuzeigen
+ if ( !nCalcThumbPos && (mnThumbPos > mnMinRange) )
+ nCalcThumbPos = 1;
+ if ( nCalcThumbPos &&
+ (nCalcThumbPos == mnThumbPixRange-1) &&
+ (mnThumbPos < mnMaxRange) )
+ nCalcThumbPos--;
+ return nCalcThumbPos+mnThumbPixOffset;
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::ImplCalc( BOOL bUpdate )
+{
+ BOOL bInvalidateAll = FALSE;
+
+ if ( mbCalcSize )
+ {
+ long nOldChannelPixOffset = mnChannelPixOffset;
+ long nOldChannelPixRange = mnChannelPixRange;
+ long nOldChannelPixTop = mnChannelPixTop;
+ long nOldChannelPixBottom = mnChannelPixBottom;
+ long nCalcWidth;
+ long nCalcHeight;
+
+ maChannel1Rect.SetEmpty();
+ maChannel2Rect.SetEmpty();
+ maThumbRect.SetEmpty();
+
+ Size aSize = GetOutputSizePixel();
+ if ( GetStyle() & WB_HORZ )
+ {
+ nCalcWidth = aSize.Width();
+ nCalcHeight = aSize.Height();
+ maThumbRect.Top() = 0;
+ maThumbRect.Bottom()= aSize.Height()-1;
+ }
+ else
+ {
+ nCalcWidth = aSize.Height();
+ nCalcHeight = aSize.Width();
+ maThumbRect.Left() = 0;
+ maThumbRect.Right() = aSize.Width()-1;
+ }
+
+ if ( nCalcWidth >= SLIDER_THUMB_SIZE )
+ {
+ mnThumbPixOffset = SLIDER_THUMB_HALFSIZE;
+ mnThumbPixRange = nCalcWidth-(SLIDER_THUMB_HALFSIZE*2);
+ mnThumbPixPos = 0;
+ mnChannelPixOffset = SLIDER_CHANNEL_OFFSET;
+ mnChannelPixRange = nCalcWidth-(SLIDER_CHANNEL_OFFSET*2);
+ mnChannelPixTop = (nCalcHeight/2)-SLIDER_CHANNEL_HALFSIZE;
+ mnChannelPixBottom = mnChannelPixTop+SLIDER_CHANNEL_SIZE-1;
+ }
+ else
+ {
+ mnThumbPixRange = 0;
+ mnChannelPixRange = 0;
+ }
+
+ if ( (nOldChannelPixOffset != mnChannelPixOffset) ||
+ (nOldChannelPixRange != mnChannelPixRange) ||
+ (nOldChannelPixTop != mnChannelPixTop) ||
+ (nOldChannelPixBottom != mnChannelPixBottom) )
+ bInvalidateAll = TRUE;
+
+ mbCalcSize = FALSE;
+ }
+
+ if ( mnThumbPixRange )
+ mnThumbPixPos = ImplCalcThumbPosPix( mnThumbPos );
+
+ if ( bUpdate && bInvalidateAll )
+ {
+ Invalidate();
+ bUpdate = FALSE;
+ }
+ ImplUpdateRects( bUpdate );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::ImplDraw( USHORT nDrawFlags )
+{
+ DecorationView aDecoView( this );
+ USHORT nStyle;
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ BOOL bEnabled = IsEnabled();
+
+ // Evt. noch offene Berechnungen nachholen
+ if ( mbCalcSize )
+ ImplCalc( FALSE );
+
+ if ( (nDrawFlags & SLIDER_DRAW_CHANNEL1) && !maChannel1Rect.IsEmpty() )
+ {
+ long nRectSize;
+ Rectangle aRect = maChannel1Rect;
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ if ( GetStyle() & WB_HORZ )
+ {
+ DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom()-1 ) );
+ DrawLine( aRect.TopLeft(), aRect.TopRight() );
+ }
+ else
+ {
+ DrawLine( aRect.TopLeft(), Point( aRect.Right()-1, aRect.Top() ) );
+ DrawLine( aRect.TopLeft(), aRect.BottomLeft() );
+ }
+ SetLineColor( rStyleSettings.GetLightColor() );
+ if ( GetStyle() & WB_HORZ )
+ {
+ DrawLine( aRect.BottomLeft(), aRect.BottomRight() );
+ nRectSize = aRect.GetWidth();
+ }
+ else
+ {
+ DrawLine( aRect.TopRight(), aRect.BottomRight() );
+ nRectSize = aRect.GetHeight();
+ }
+
+ if ( nRectSize > 1 )
+ {
+ aRect.Left()++;
+ aRect.Top()++;
+ if ( GetStyle() & WB_HORZ )
+ aRect.Bottom()--;
+ else
+ aRect.Right()--;
+ SetLineColor();
+ if ( mnStateFlags & SLIDER_STATE_CHANNEL1_DOWN )
+ SetFillColor( rStyleSettings.GetShadowColor() );
+ else
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ DrawRect( aRect );
+ }
+ }
+
+ if ( (nDrawFlags & SLIDER_DRAW_CHANNEL2) && !maChannel2Rect.IsEmpty() )
+ {
+ long nRectSize;
+ Rectangle aRect = maChannel2Rect;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ if ( GetStyle() & WB_HORZ )
+ {
+ DrawLine( aRect.TopRight(), aRect.BottomRight() );
+ DrawLine( aRect.BottomLeft(), aRect.BottomRight() );
+ nRectSize = aRect.GetWidth();
+ }
+ else
+ {
+ DrawLine( aRect.BottomLeft(), aRect.BottomRight() );
+ DrawLine( aRect.TopRight(), aRect.BottomRight() );
+ nRectSize = aRect.GetHeight();
+ }
+
+ if ( nRectSize > 1 )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ if ( GetStyle() & WB_HORZ )
+ DrawLine( aRect.TopLeft(), Point( aRect.Right()-1, aRect.Top() ) );
+ else
+ DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom()-1 ) );
+
+ aRect.Right()--;
+ aRect.Bottom()--;
+ if ( GetStyle() & WB_HORZ )
+ aRect.Top()++;
+ else
+ aRect.Left()++;
+ SetLineColor();
+ if ( mnStateFlags & SLIDER_STATE_CHANNEL2_DOWN )
+ SetFillColor( rStyleSettings.GetShadowColor() );
+ else
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ DrawRect( aRect );
+ }
+ }
+
+ if ( nDrawFlags & SLIDER_DRAW_THUMB )
+ {
+ if ( !maThumbRect.IsEmpty() )
+ {
+ if ( bEnabled )
+ {
+ nStyle = 0;
+ if ( mnStateFlags & SLIDER_STATE_THUMB_DOWN )
+ nStyle |= BUTTON_DRAW_PRESSED;
+ aDecoView.DrawButton( maThumbRect, nStyle );
+ }
+ else
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ DrawRect( maThumbRect );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Slider::ImplIsPageUp( const Point& rPos )
+{
+ Size aSize = GetOutputSizePixel();
+ Rectangle aRect = maChannel1Rect;
+ if ( GetStyle() & WB_HORZ )
+ {
+ aRect.Top() = 0;
+ aRect.Bottom() = aSize.Height()-1;
+ }
+ else
+ {
+ aRect.Left() = 0;
+ aRect.Right() = aSize.Width()-1;
+ }
+ return aRect.IsInside( rPos );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Slider::ImplIsPageDown( const Point& rPos )
+{
+ Size aSize = GetOutputSizePixel();
+ Rectangle aRect = maChannel2Rect;
+ if ( GetStyle() & WB_HORZ )
+ {
+ aRect.Top() = 0;
+ aRect.Bottom() = aSize.Height()-1;
+ }
+ else
+ {
+ aRect.Left() = 0;
+ aRect.Right() = aSize.Width()-1;
+ }
+ return aRect.IsInside( rPos );
+}
+
+// -----------------------------------------------------------------------
+
+long Slider::ImplSlide( long nNewPos, BOOL bCallEndSlide )
+{
+ long nOldPos = mnThumbPos;
+ SetThumbPos( nNewPos );
+ long nDelta = mnThumbPos-nOldPos;
+ if ( nDelta )
+ {
+ mnDelta = nDelta;
+ Slide();
+ if ( bCallEndSlide )
+ EndSlide();
+ mnDelta = 0;
+ }
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+long Slider::ImplDoAction( BOOL bCallEndSlide )
+{
+ long nDelta = 0;
+
+ switch ( meScrollType )
+ {
+ case SCROLL_LINEUP:
+ nDelta = ImplSlide( mnThumbPos-mnLineSize, bCallEndSlide );
+ break;
+
+ case SCROLL_LINEDOWN:
+ nDelta = ImplSlide( mnThumbPos+mnLineSize, bCallEndSlide );
+ break;
+
+ case SCROLL_PAGEUP:
+ nDelta = ImplSlide( mnThumbPos-mnPageSize, bCallEndSlide );
+ break;
+
+ case SCROLL_PAGEDOWN:
+ nDelta = ImplSlide( mnThumbPos+mnPageSize, bCallEndSlide );
+ break;
+ }
+
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::ImplDoMouseAction( const Point& rMousePos, BOOL bCallAction )
+{
+ USHORT nOldStateFlags = mnStateFlags;
+ BOOL bAction = FALSE;
+
+ switch ( meScrollType )
+ {
+ case SCROLL_PAGEUP:
+ if ( ImplIsPageUp( rMousePos ) )
+ {
+ bAction = bCallAction;
+ mnStateFlags |= SLIDER_STATE_CHANNEL1_DOWN;
+ }
+ else
+ mnStateFlags &= ~SLIDER_STATE_CHANNEL1_DOWN;
+ break;
+
+ case SCROLL_PAGEDOWN:
+ if ( ImplIsPageDown( rMousePos ) )
+ {
+ bAction = bCallAction;
+ mnStateFlags |= SLIDER_STATE_CHANNEL2_DOWN;
+ }
+ else
+ mnStateFlags &= ~SLIDER_STATE_CHANNEL2_DOWN;
+ break;
+ }
+
+ if ( bAction )
+ {
+ if ( ImplDoAction( FALSE ) )
+ {
+ // Update the channel complete
+ if ( mnDragDraw & SLIDER_DRAW_CHANNEL )
+ {
+ Update();
+ ImplDraw( mnDragDraw );
+ }
+ }
+ }
+ else if ( nOldStateFlags != mnStateFlags )
+ ImplDraw( mnDragDraw );
+}
+
+// -----------------------------------------------------------------------
+
+long Slider::ImplDoSlide( long nNewPos )
+{
+ if ( meScrollType != SCROLL_DONTKNOW )
+ return 0;
+
+ meScrollType = SCROLL_DRAG;
+ long nDelta = ImplSlide( nNewPos, TRUE );
+ meScrollType = SCROLL_DONTKNOW;
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+long Slider::ImplDoSlideAction( ScrollType eScrollType )
+{
+ if ( (meScrollType != SCROLL_DONTKNOW) ||
+ (eScrollType == SCROLL_DONTKNOW) ||
+ (eScrollType == SCROLL_DRAG) )
+ return 0;
+
+ meScrollType = eScrollType;
+ long nDelta = ImplDoAction( TRUE );
+ meScrollType = SCROLL_DONTKNOW;
+ return nDelta;
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ const Point& rMousePos = rMEvt.GetPosPixel();
+ USHORT nTrackFlags = 0;
+
+ if ( maThumbRect.IsInside( rMousePos ) )
+ {
+ nTrackFlags = 0;
+ meScrollType = SCROLL_DRAG;
+ mnDragDraw = SLIDER_DRAW_THUMB;
+
+ // Zusaetzliche Daten berechnen
+ Point aCenterPos = maThumbRect.Center();
+ if ( GetStyle() & WB_HORZ )
+ mnMouseOff = rMousePos.X()-aCenterPos.X();
+ else
+ mnMouseOff = rMousePos.Y()-aCenterPos.Y();
+
+ // Im OS2-Look geben wir den Thumb gedrueckt aus
+ if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_OS2STYLE )
+ {
+ mnStateFlags |= SLIDER_STATE_THUMB_DOWN;
+ ImplDraw( SLIDER_DRAW_THUMB );
+ }
+ }
+ else if ( ImplIsPageUp( rMousePos ) )
+ {
+ nTrackFlags = STARTTRACK_BUTTONREPEAT;
+ meScrollType = SCROLL_PAGEUP;
+ mnDragDraw = SLIDER_DRAW_CHANNEL;
+ }
+ else if ( ImplIsPageDown( rMousePos ) )
+ {
+ nTrackFlags = STARTTRACK_BUTTONREPEAT;
+ meScrollType = SCROLL_PAGEDOWN;
+ mnDragDraw = SLIDER_DRAW_CHANNEL;
+ }
+
+ // Soll Tracking gestartet werden
+ if ( meScrollType != SCROLL_DONTKNOW )
+ {
+ // Startposition merken fuer Abbruch und EndScroll-Delta
+ mnStartPos = mnThumbPos;
+ ImplDoMouseAction( rMousePos );
+ Update();
+ StartTracking( nTrackFlags );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ // Button und PageRect-Status wieder herstellen
+ USHORT nOldStateFlags = mnStateFlags;
+ mnStateFlags &= ~(SLIDER_STATE_CHANNEL1_DOWN | SLIDER_STATE_CHANNEL2_DOWN |
+ SLIDER_STATE_THUMB_DOWN);
+ if ( nOldStateFlags != mnStateFlags )
+ ImplDraw( mnDragDraw );
+ mnDragDraw = 0;
+
+ // Bei Abbruch, die alte ThumbPosition wieder herstellen
+ if ( rTEvt.IsTrackingCanceled() )
+ {
+ long nOldPos = mnThumbPos;
+ SetThumbPos( mnStartPos );
+ mnDelta = mnThumbPos-nOldPos;
+ Slide();
+ }
+
+ if ( meScrollType == SCROLL_DRAG )
+ {
+ // Wenn gedragt wurde, berechnen wir den Thumb neu, damit
+ // er wieder auf einer gerundeten ThumbPosition steht
+ ImplCalc();
+ Update();
+
+ if ( !mbFullDrag && (mnStartPos != mnThumbPos) )
+ {
+ mnDelta = mnThumbPos-mnStartPos;
+ Slide();
+ mnDelta = 0;
+ }
+ }
+
+ mnDelta = mnThumbPos-mnStartPos;
+ EndSlide();
+ mnDelta = 0;
+ meScrollType = SCROLL_DONTKNOW;
+ }
+ else
+ {
+ const Point rMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+
+ // Dragging wird speziell behandelt
+ if ( meScrollType == SCROLL_DRAG )
+ {
+ long nMovePix;
+ Point aCenterPos = maThumbRect.Center();
+ if ( GetStyle() & WB_HORZ )
+ nMovePix = rMousePos.X()-(aCenterPos.X()+mnMouseOff);
+ else
+ nMovePix = rMousePos.Y()-(aCenterPos.Y()+mnMouseOff);
+ // Nur wenn sich Maus in die Scrollrichtung bewegt, muessen
+ // wir etwas tun
+ if ( nMovePix )
+ {
+ mnThumbPixPos += nMovePix;
+ if ( mnThumbPixPos < mnThumbPixOffset )
+ mnThumbPixPos = mnThumbPixOffset;
+ if ( mnThumbPixPos > (mnThumbPixOffset+mnThumbPixRange-1) )
+ mnThumbPixPos = mnThumbPixOffset+mnThumbPixRange-1;
+ long nOldPos = mnThumbPos;
+ mnThumbPos = ImplCalcThumbPos( mnThumbPixPos );
+ if ( nOldPos != mnThumbPos )
+ {
+ ImplUpdateRects();
+ Update();
+ if ( mbFullDrag && (nOldPos != mnThumbPos) )
+ {
+ mnDelta = mnThumbPos-nOldPos;
+ Slide();
+ mnDelta = 0;
+ }
+ }
+ }
+ }
+ else
+ ImplDoMouseAction( rMousePos, rTEvt.IsTrackingRepeat() );
+
+ // Wenn Slider-Werte so umgesetzt wurden, das es nichts
+ // mehr zum Tracking gibt, dann berechen wir hier ab
+ if ( !IsVisible() )
+ EndTracking();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( !rKEvt.GetKeyCode().GetModifier() )
+ {
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_HOME:
+ ImplDoSlide( GetRangeMin() );
+ break;
+ case KEY_END:
+ ImplDoSlide( GetRangeMax() );
+ break;
+
+ case KEY_LEFT:
+ case KEY_UP:
+ ImplDoSlideAction( SCROLL_LINEUP );
+ break;
+
+ case KEY_RIGHT:
+ case KEY_DOWN:
+ ImplDoSlideAction( SCROLL_LINEDOWN );
+ break;
+
+ case KEY_PAGEUP:
+ ImplDoSlideAction( SCROLL_PAGEUP );
+ break;
+
+ case KEY_PAGEDOWN:
+ ImplDoSlideAction( SCROLL_PAGEDOWN );
+ break;
+
+ default:
+ Control::KeyInput( rKEvt );
+ break;
+ }
+ }
+ else
+ Control::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::Paint( const Rectangle& rRect )
+{
+ ImplDraw( SLIDER_DRAW_ALL );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::Resize()
+{
+ mbCalcSize = TRUE;
+ if ( IsReallyVisible() )
+ ImplCalc( FALSE );
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::RequestHelp( const HelpEvent& rHEvt )
+{
+ Control::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ ImplCalc( FALSE );
+ else if ( nType == STATE_CHANGE_DATA )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ ImplCalc( TRUE );
+ }
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ ImplCalc( FALSE );
+ Invalidate();
+ }
+ }
+ else if ( nType == STATE_CHANGE_ENABLE )
+ {
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ ImplInitStyle( GetStyle() );
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( (GetPrevStyle() & SLIDER_VIEW_STYLE) !=
+ (GetStyle() & SLIDER_VIEW_STYLE) )
+ {
+ mbCalcSize = TRUE;
+ ImplCalc( FALSE );
+ Invalidate();
+ }
+ }
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::Slide()
+{
+ maSlideHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::EndSlide()
+{
+ maEndSlideHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::SetRangeMin( long nNewRange )
+{
+ SetRange( Range( nNewRange, GetRangeMax() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::SetRangeMax( long nNewRange )
+{
+ SetRange( Range( GetRangeMin(), nNewRange ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::SetRange( const Range& rRange )
+{
+ // Range einpassen
+ Range aRange = rRange;
+ aRange.Justify();
+ long nNewMinRange = aRange.Min();
+ long nNewMaxRange = aRange.Max();
+
+ // Wenn Range sich unterscheidet, dann neuen setzen
+ if ( (mnMinRange != nNewMinRange) ||
+ (mnMaxRange != nNewMaxRange) )
+ {
+ mnMinRange = nNewMinRange;
+ mnMaxRange = nNewMaxRange;
+
+ // Thumb einpassen
+ if ( mnThumbPos > mnMaxRange )
+ mnThumbPos = mnMaxRange;
+ if ( mnThumbPos < mnMinRange )
+ mnThumbPos = mnMinRange;
+
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Slider::SetThumbPos( long nNewThumbPos )
+{
+ if ( nNewThumbPos < mnMinRange )
+ nNewThumbPos = mnMinRange;
+ if ( nNewThumbPos > mnMaxRange )
+ nNewThumbPos = mnMaxRange;
+
+ if ( mnThumbPos != nNewThumbPos )
+ {
+ mnThumbPos = nNewThumbPos;
+ StateChanged( STATE_CHANGE_DATA );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size Slider::CalcWindowSizePixel()
+{
+ long nWidth = mnMaxRange-mnMinRange+(SLIDER_THUMB_HALFSIZE*2)+1;
+ long nHeight = SLIDER_HEIGHT;
+ Size aSize;
+ if ( GetStyle() & WB_HORZ )
+ {
+ aSize.Width() = nWidth;
+ aSize.Height() = nHeight;
+ }
+ else
+ {
+ aSize.Height() = nWidth;
+ aSize.Width() = nHeight;
+ }
+ return aSize;
+}
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
new file mode 100644
index 000000000000..d2d91f1158c4
--- /dev/null
+++ b/vcl/source/control/spinbtn.cxx
@@ -0,0 +1,313 @@
+/*************************************************************************
+ *
+ * $RCSfile: spinbtn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SPIN_CXX
+
+#ifndef _SV_RCID_H
+#include <rcid.h>
+#endif
+#ifndef _SV_SPIN_H
+#include <spin.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SPIN_HXX
+#include <spin.hxx>
+#endif
+
+// =======================================================================
+
+void SpinButton::ImplInit( Window* pParent, WinBits nStyle )
+{
+ mbUpperIn = FALSE;
+ mbLowerIn = FALSE;
+ mbInitialUp = FALSE;
+ mbInitialDown = FALSE;
+
+ if ( nStyle & WB_REPEAT )
+ {
+ mbRepeat = TRUE;
+
+ maRepeatTimer.SetTimeout( SPIN_DELAY );
+ maRepeatTimer.SetTimeoutHdl( LINK( this, SpinButton, ImplTimeout ) );
+ }
+ else
+ mbRepeat = FALSE;
+
+ if ( nStyle & WB_HSCROLL )
+ mbHorz = TRUE;
+ else
+ mbHorz = FALSE;
+
+ Control::ImplInit( pParent, nStyle, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+SpinButton::SpinButton( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_SPINBUTTON )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+SpinButton::SpinButton( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_SPINBUTTON )
+{
+ rResId.SetRT( RSC_SPINBUTTON );
+ ImplInit( pParent, ImplInitRes( rResId ) );
+ ImplLoadRes( rResId );
+ Resize();
+}
+
+// -----------------------------------------------------------------------
+
+SpinButton::~SpinButton()
+{
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SpinButton, ImplTimeout, Timer*, pTimer )
+{
+ if ( pTimer->GetTimeout() == SPIN_DELAY )
+ {
+ pTimer->SetTimeout( SPIN_SPEED );
+ pTimer->Start();
+ }
+ else
+ {
+ if ( mbInitialUp )
+ Up();
+ else
+ Down();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::Up()
+{
+ maUpHdlLink.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::Down()
+{
+ maDownHdlLink.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::Resize()
+{
+ Size aSize( GetOutputSizePixel() );
+ Point aTmpPoint;
+ Rectangle aRect( aTmpPoint, aSize );
+ if ( mbHorz )
+ {
+ maUpperRect = Rectangle( 0, 0, aSize.Width()/2, aSize.Height()-1 );
+ maLowerRect = Rectangle( maUpperRect.TopRight(), aRect.BottomRight() );
+ }
+ else
+ {
+ maUpperRect = Rectangle( 0, 0, aSize.Width()-1, aSize.Height()/2 );
+ maLowerRect = Rectangle( maUpperRect.BottomLeft(), aRect.BottomRight() );
+ }
+
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::Paint( const Rectangle& )
+{
+ BOOL bEnable = IsEnabled();
+ ImplDrawSpinButton( this, maUpperRect, maLowerRect, mbUpperIn, mbLowerIn,
+ bEnable, bEnable, mbHorz );
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ mbUpperIn = TRUE;
+ mbInitialUp = TRUE;
+ Invalidate( maUpperRect );
+ }
+ else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ mbLowerIn = TRUE;
+ mbInitialDown = TRUE;
+ Invalidate( maLowerRect );
+ }
+
+ if ( mbUpperIn || mbLowerIn )
+ {
+ Update();
+ CaptureMouse();
+ if ( mbRepeat )
+ maRepeatTimer.Start();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::MouseButtonUp( const MouseEvent& )
+{
+ ReleaseMouse();
+
+ if ( mbUpperIn )
+ {
+ mbUpperIn = FALSE;
+ Invalidate( maUpperRect );
+ Update();
+ Up();
+ }
+ else if ( mbLowerIn )
+ {
+ mbLowerIn = FALSE;
+ Invalidate( maLowerRect );
+ Update();
+ Down();
+ }
+
+ mbInitialUp = mbInitialDown = FALSE;
+
+ if ( mbRepeat )
+ {
+ maRepeatTimer.Stop();
+ maRepeatTimer.SetTimeout( SPIN_DELAY );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( !rMEvt.IsLeft() || (!mbInitialUp && !mbInitialDown) )
+ return;
+
+ if ( !maUpperRect.IsInside( rMEvt.GetPosPixel() ) &&
+ mbUpperIn && mbInitialUp )
+ {
+ mbUpperIn = FALSE;
+ maRepeatTimer.Stop();
+ Invalidate( maUpperRect );
+ Update();
+ }
+ else if ( !maLowerRect.IsInside( rMEvt.GetPosPixel() ) &&
+ mbLowerIn & mbInitialDown )
+ {
+ mbLowerIn = FALSE;
+ maRepeatTimer.Stop();
+ Invalidate( maLowerRect );
+ Update();
+ }
+ else if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) &&
+ !mbUpperIn && mbInitialUp )
+ {
+ mbUpperIn = TRUE;
+ if ( mbRepeat )
+ maRepeatTimer.Start();
+ Invalidate( maUpperRect );
+ Update();
+ }
+ else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) &&
+ !mbLowerIn && mbInitialDown )
+ {
+ mbLowerIn = TRUE;
+ if ( mbRepeat )
+ maRepeatTimer.Start();
+ Invalidate( maLowerRect );
+ Update();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::KeyInput( const KeyEvent& rKEvt )
+{
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if ( aCode.GetCode() == KEY_UP )
+ Up();
+ else if( aCode.GetCode() == KEY_DOWN )
+ Down();
+ else
+ Control::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SpinButton::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_ENABLE )
+ Invalidate();
+ Control::StateChanged( nType );
+}
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
new file mode 100644
index 000000000000..d87d20865726
--- /dev/null
+++ b/vcl/source/control/spinfld.cxx
@@ -0,0 +1,791 @@
+/*************************************************************************
+ *
+ * $RCSfile: spinfld.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SPINFLD_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_SPIN_H
+#include <spin.h>
+#endif
+#ifndef _SV_SPINFLD_HXX
+#include <spinfld.hxx>
+#endif
+
+// =======================================================================
+
+void ImplDrawSpinButton( OutputDevice* pOutDev,
+ const Rectangle& rUpperRect,
+ const Rectangle& rLowerRect,
+ BOOL bUpperIn, BOOL bLowerIn,
+ BOOL bUpperEnabled, BOOL bLowerEnabled, BOOL bHorz )
+{
+ DecorationView aDecoView( pOutDev );
+
+ USHORT nStyle = BUTTON_DRAW_NOLEFTLIGHTBORDER;
+ USHORT nSymStyle = 0;
+
+ SymbolType eType1, eType2;
+
+ const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings();
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_SPINARROW )
+ {
+ if ( bHorz )
+ {
+ eType1 = SYMBOL_ARROW_LEFT;
+ eType2 = SYMBOL_ARROW_RIGHT;
+ }
+ else
+ {
+ eType1 = SYMBOL_ARROW_UP;
+ eType2 = SYMBOL_ARROW_DOWN;
+ }
+ }
+ else
+ {
+ if ( bHorz )
+ {
+ eType1 = SYMBOL_SPIN_LEFT;
+ eType2 = SYMBOL_SPIN_RIGHT;
+ }
+ else
+ {
+ eType1 = SYMBOL_SPIN_UP;
+ eType2 = SYMBOL_SPIN_DOWN;
+ }
+ }
+
+ // Oberen/linken Button malen
+ USHORT nTempStyle = nStyle;
+ if ( bUpperIn )
+ nTempStyle |= BUTTON_DRAW_PRESSED;
+ Rectangle aUpRect = aDecoView.DrawButton( rUpperRect, nTempStyle );
+
+ // Unteren/rechten Button malen
+ if ( bLowerIn )
+ nStyle |= BUTTON_DRAW_PRESSED;
+ Rectangle aLowRect = aDecoView.DrawButton( rLowerRect, nStyle );
+
+ // Zusaetzliche Default-Kante wollen wir auch ausnutzen
+ aUpRect.Left()--;
+ aUpRect.Top()--;
+ aUpRect.Right()++;
+ aUpRect.Bottom()++;
+ aLowRect.Left()--;
+ aLowRect.Top()--;
+ aLowRect.Right()++;
+ aLowRect.Bottom()++;
+
+ // Wir malen auch in die Kante rein, damit man etwas erkennen kann,
+ // wenn das Rechteck zu klein ist
+ if ( aUpRect.GetHeight() < 4 )
+ {
+ aUpRect.Right()++;
+ aUpRect.Bottom()++;
+ aLowRect.Right()++;
+ aLowRect.Bottom()++;
+ }
+
+ // Symbolgroesse berechnen
+ long nTempSize1 = aUpRect.GetWidth();
+ long nTempSize2 = aLowRect.GetWidth();
+ if ( Abs( nTempSize1-nTempSize2 ) == 1 )
+ {
+ if ( nTempSize1 > nTempSize2 )
+ aUpRect.Left()++;
+ else
+ aLowRect.Left()++;
+ }
+ nTempSize1 = aUpRect.GetHeight();
+ nTempSize2 = aLowRect.GetHeight();
+ if ( Abs( nTempSize1-nTempSize2 ) == 1 )
+ {
+ if ( nTempSize1 > nTempSize2 )
+ aUpRect.Top()++;
+ else
+ aLowRect.Top()++;
+ }
+
+ nTempStyle = nSymStyle;
+ if ( !bUpperEnabled )
+ nTempStyle |= SYMBOL_DRAW_DISABLE;
+ aDecoView.DrawSymbol( aUpRect, eType1, rStyleSettings.GetButtonTextColor(), nTempStyle );
+
+ if ( !bLowerEnabled )
+ nSymStyle |= SYMBOL_DRAW_DISABLE;
+ aDecoView.DrawSymbol( aLowRect, eType2, rStyleSettings.GetButtonTextColor(), nSymStyle );
+}
+
+// =======================================================================
+
+void SpinField::ImplInitData()
+{
+ mpEdit = NULL;
+ mbSpin = FALSE;
+ mbRepeat = FALSE;
+ mbUpperIn = FALSE;
+ mbLowerIn = FALSE;
+ mbInitialUp = FALSE;
+ mbInitialDown = FALSE;
+ mbNoSelect = FALSE;
+ mbInDropDown = FALSE;
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::ImplInit( Window* pParent, WinBits nWinStyle )
+{
+ Edit::ImplInit( pParent, nWinStyle );
+
+ if ( nWinStyle & (WB_SPIN|WB_DROPDOWN) )
+ {
+ mbSpin = TRUE;
+ mpEdit = new Edit( this, WB_NOBORDER );
+ mpEdit->SetPosPixel( Point() );
+ mpEdit->Show();
+ SetSubEdit( mpEdit );
+
+ maRepeatTimer.SetTimeoutHdl( LINK( this, SpinField, ImplTimeout ) );
+ maRepeatTimer.SetTimeout( SPIN_DELAY );
+ if ( nWinStyle & WB_REPEAT )
+ mbRepeat = TRUE;
+
+ SetCompoundControl( TRUE );
+ }
+}
+
+// --------------------------------------------------------------------
+
+SpinField::SpinField( WindowType nTyp ) :
+ Edit( nTyp )
+{
+ ImplInitData();
+}
+
+// --------------------------------------------------------------------
+
+SpinField::SpinField( Window* pParent, WinBits nWinStyle ) :
+ Edit( WINDOW_SPINFIELD )
+{
+ ImplInitData();
+ ImplInit( pParent, nWinStyle );
+}
+
+// --------------------------------------------------------------------
+
+SpinField::SpinField( Window* pParent, const ResId& rResId ) :
+ Edit( WINDOW_SPINFIELD )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_SPINFIELD );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// --------------------------------------------------------------------
+
+SpinField::~SpinField()
+{
+ delete mpEdit;
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::Up()
+{
+ maUpHdlLink.Call( this );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::Down()
+{
+ maDownHdlLink.Call( this );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::First()
+{
+ maFirstHdlLink.Call( this );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::Last()
+{
+ maLastHdlLink.Call( this );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( !HasFocus() && ( !mpEdit || !mpEdit->HasFocus() ) )
+ {
+ mbNoSelect = TRUE;
+ GrabFocus();
+ }
+
+ if ( !IsReadOnly() )
+ {
+ if ( maUpperRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ mbUpperIn = TRUE;
+ mbInitialUp = TRUE;
+ Invalidate( maUpperRect );
+ }
+ else if ( maLowerRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ mbLowerIn = TRUE;
+ mbInitialDown = TRUE;
+ Invalidate( maLowerRect );
+ }
+ else if ( maDropDownRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ // Rechts daneben liegt der DropDownButton:
+ mbInDropDown = ShowDropDown( mbInDropDown ? FALSE : TRUE );
+ Paint( Rectangle( Point(), GetOutputSizePixel() ) );
+ }
+
+ if ( mbUpperIn || mbLowerIn )
+ {
+ Update();
+ CaptureMouse();
+ if ( mbRepeat )
+ maRepeatTimer.Start();
+ return;
+ }
+ }
+
+ Edit::MouseButtonDown( rMEvt );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ ReleaseMouse();
+ mbInitialUp = mbInitialDown = FALSE;
+ maRepeatTimer.Stop();
+ maRepeatTimer.SetTimeout( SPIN_DELAY );
+
+ if ( mbUpperIn )
+ {
+ mbUpperIn = FALSE;
+ Invalidate( maUpperRect );
+ Update();
+ Up();
+ }
+ else if ( mbLowerIn )
+ {
+ mbLowerIn = FALSE;
+ Invalidate( maLowerRect );
+ Update();
+ Down();
+ }
+
+ Edit::MouseButtonUp( rMEvt );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ {
+ if ( mbInitialUp )
+ {
+ BOOL bNewUpperIn = maUpperRect.IsInside( rMEvt.GetPosPixel() );
+ if ( bNewUpperIn != mbUpperIn )
+ {
+ if ( bNewUpperIn )
+ {
+ if ( mbRepeat )
+ maRepeatTimer.Start();
+ }
+ else
+ maRepeatTimer.Stop();
+
+ mbUpperIn = bNewUpperIn;
+ Invalidate( maUpperRect );
+ Update();
+ }
+ }
+ else if ( mbInitialDown )
+ {
+ BOOL bNewLowerIn = maLowerRect.IsInside( rMEvt.GetPosPixel() );
+ if ( bNewLowerIn != mbLowerIn )
+ {
+ if ( bNewLowerIn )
+ {
+ if ( mbRepeat )
+ maRepeatTimer.Start();
+ }
+ else
+ maRepeatTimer.Stop();
+
+ mbLowerIn = bNewLowerIn;
+ Invalidate( maLowerRect );
+ Update();
+ }
+ }
+ }
+
+ Edit::MouseMove( rMEvt );
+}
+
+// --------------------------------------------------------------------
+
+long SpinField::Notify( NotifyEvent& rNEvt )
+{
+ long nDone = 0;
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent& rKEvt = *rNEvt.GetKeyEvent();
+ if ( !IsReadOnly() )
+ {
+ USHORT nMod = rKEvt.GetKeyCode().GetModifier();
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_UP:
+ {
+ if ( !nMod )
+ {
+ Up();
+ nDone = 1;
+ }
+ }
+ break;
+ case KEY_DOWN:
+ {
+ if ( !nMod )
+ {
+ Down();
+ nDone = 1;
+ }
+ else if ( ( nMod == KEY_MOD2 ) && !mbInDropDown && ( GetStyle() & WB_DROPDOWN ) )
+ {
+ mbInDropDown = ShowDropDown( TRUE );
+ Paint( Rectangle( Point(), GetOutputSizePixel() ) );
+ nDone = 1;
+ }
+ }
+ break;
+ case KEY_PAGEUP:
+ {
+ if ( !nMod )
+ {
+ Last();
+ nDone = 1;
+ }
+ }
+ break;
+ case KEY_PAGEDOWN:
+ {
+ if ( !nMod )
+ {
+ First();
+ nDone = 1;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ if ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ if ( pData->GetDelta() < 0L )
+ Down();
+ else
+ Up();
+ nDone = 1;
+ }
+ }
+ }
+
+ return nDone ? nDone : Edit::Notify( rNEvt );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::Command( const CommandEvent& rCEvt )
+{
+ Edit::Command( rCEvt );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::Paint( const Rectangle& rRect )
+{
+ if ( mbSpin )
+ {
+ BOOL bEnable = IsEnabled();
+ ImplDrawSpinButton( this, maUpperRect, maLowerRect,
+ mbUpperIn, mbLowerIn, bEnable, bEnable );
+ }
+
+ if ( GetStyle() & WB_DROPDOWN )
+ {
+ DecorationView aView( this );
+
+ USHORT nStyle = BUTTON_DRAW_NOLIGHTBORDER;
+ if ( mbInDropDown )
+ nStyle |= BUTTON_DRAW_PRESSED;
+ Rectangle aInnerRect = aView.DrawButton( maDropDownRect, nStyle );
+
+ SymbolType eSymbol = SYMBOL_SPIN_DOWN;
+ if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN )
+ eSymbol = SYMBOL_SPIN_UPDOWN;
+
+ nStyle = IsEnabled() ? 0 : SYMBOL_DRAW_DISABLE;
+ aView.DrawSymbol( aInnerRect, eSymbol, GetSettings().GetStyleSettings().GetButtonTextColor(), nStyle );
+ }
+
+ Edit::Paint( rRect );
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rectangle& rDDArea, Rectangle& rSpinUpArea, Rectangle& rSpinDownArea )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Size aSize = rOutSz;
+ Size aDropDownSize;
+
+ if ( GetStyle() & WB_DROPDOWN )
+ {
+ long nW = rStyleSettings.GetScrollBarSize();
+ nW = GetDrawPixel( pDev, nW );
+ aDropDownSize = Size( CalcZoom( nW ), aSize.Height() );
+ aSize.Width() -= aDropDownSize.Width();
+ rDDArea = Rectangle( Point( aSize.Width(), 0 ), aDropDownSize );
+ rDDArea.Top()--;
+ }
+ else
+ rDDArea.SetEmpty();
+
+ // Je nach Hoehe, die groessen Berechnen
+ if ( GetStyle() & WB_SPIN )
+ {
+ long nBottom1 = aSize.Height()/2;
+ long nTop2 = nBottom1;
+ if ( !(aSize.Height() & 0x01) )
+ nBottom1--;
+
+ aSize.Width() -= CalcZoom( GetDrawPixel( pDev, rStyleSettings.GetSpinSize() ) );
+ rSpinUpArea = Rectangle( aSize.Width(), 0, rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 );
+ rSpinDownArea = Rectangle( rSpinUpArea.Left(), nTop2, rSpinUpArea.Right(), aSize.Height()-1 );
+ }
+ else
+ {
+ rSpinUpArea.SetEmpty();
+ rSpinDownArea.SetEmpty();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SpinField::Resize()
+{
+ if ( mbSpin )
+ {
+ Size aSize = GetOutputSizePixel();
+
+ if ( GetStyle() & (WB_SPIN|WB_DROPDOWN) )
+ {
+ ImplCalcButtonAreas( this, aSize, maDropDownRect, maUpperRect, maLowerRect );
+ aSize.Width() -= maDropDownRect.GetWidth();
+ aSize.Width() -= maUpperRect.GetWidth();
+ }
+
+ mpEdit->SetSizePixel( aSize );
+
+ if ( GetStyle() & WB_SPIN )
+ Invalidate( Rectangle( maUpperRect.TopLeft(), maLowerRect.BottomRight() ) );
+ if ( GetStyle() & WB_DROPDOWN )
+ Invalidate( maDropDownRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SpinField::StateChanged( StateChangedType nType )
+{
+ Edit::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_ENABLE )
+ {
+ if ( mbSpin || ( GetStyle() & WB_DROPDOWN ) )
+ {
+ mpEdit->Enable( IsEnabled() );
+
+ if ( mbSpin )
+ {
+ Invalidate( maLowerRect );
+ Invalidate( maUpperRect );
+ }
+ if ( GetStyle() & WB_DROPDOWN )
+ Invalidate( maDropDownRect );
+ }
+ }
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ if ( GetStyle() & WB_REPEAT )
+ mbRepeat = TRUE;
+ else
+ mbRepeat = FALSE;
+ }
+ else if ( nType == STATE_CHANGE_ZOOM )
+ {
+ Resize();
+ if ( mpEdit )
+ mpEdit->SetZoom( GetZoom() );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFONT )
+ {
+ if ( mpEdit )
+ mpEdit->SetControlFont( GetControlFont() );
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ if ( mpEdit )
+ mpEdit->SetControlForeground( GetControlForeground() );
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ if ( mpEdit )
+ mpEdit->SetControlBackground( GetControlBackground() );
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SpinField::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Edit::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Resize();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SpinField::EndDropDown()
+{
+ mbInDropDown = FALSE;
+ Paint( Rectangle( Point(), GetOutputSizePixel() ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SpinField::ShowDropDown( BOOL bShow )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Size SpinField::CalcMinimumSize() const
+{
+ Size aSz = Edit::CalcMinimumSize();
+
+ if ( GetStyle() & WB_DROPDOWN )
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ if ( GetStyle() & WB_SPIN )
+ aSz.Width() += GetSettings().GetStyleSettings().GetSpinSize();
+
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Size SpinField::CalcSize( USHORT nChars ) const
+{
+ Size aSz = Edit::CalcSize( nChars );
+
+ if ( GetStyle() & WB_DROPDOWN )
+ aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
+ if ( GetStyle() & WB_SPIN )
+ aSz.Width() += GetSettings().GetStyleSettings().GetSpinSize();
+
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SpinField::GetMaxVisChars() const
+{
+ long nOutWidth = mpEdit->GetOutputSizePixel().Width();
+ long nCharWidth = GetTextWidth( XubString( 'x' ) );
+ return nCharWidth ? (USHORT)(nOutWidth/nCharWidth) : 0;
+}
+
+// --------------------------------------------------------------------
+
+IMPL_LINK( SpinField, ImplTimeout, Timer*, pTimer )
+{
+ if ( pTimer->GetTimeout() == SPIN_DELAY )
+ {
+ pTimer->SetTimeout( SPIN_SPEED );
+ pTimer->Start();
+ }
+ else
+ {
+ if ( mbInitialUp )
+ Up();
+ else
+ Down();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags )
+{
+ Edit::Draw( pDev, rPos, rSize, nFlags );
+
+ WinBits nStyle = GetStyle();
+ if ( !(nFlags & WINDOW_DRAW_NOCONTROLS ) && ( nStyle & (WB_SPIN|WB_DROPDOWN) ) )
+ {
+ Point aPos = pDev->LogicToPixel( rPos );
+ Size aSize = pDev->LogicToPixel( rSize );
+ OutDevType eOutDevType = pDev->GetOutDevType();
+ AllSettings aOldSettings = pDev->GetSettings();
+
+ pDev->Push();
+ pDev->SetMapMode();
+
+ if ( eOutDevType == OUTDEV_PRINTER )
+ {
+ StyleSettings aStyleSettings = aOldSettings.GetStyleSettings();
+ aStyleSettings.SetFaceColor( COL_LIGHTGRAY );
+ aStyleSettings.SetButtonTextColor( COL_BLACK );
+ AllSettings aSettings( aOldSettings );
+ aSettings.SetStyleSettings( aStyleSettings );
+ pDev->SetSettings( aSettings );
+ }
+
+ Rectangle aDD, aUp, aDown;
+ ImplCalcButtonAreas( pDev, aSize, aDD, aUp, aDown );
+ aDD.Move( aPos.X(), aPos.Y() );
+ aUp.Move( aPos.X(), aPos.Y() );
+ aUp.Top()++;
+ aDown.Move( aPos.X(), aPos.Y() );
+
+ Color aButtonTextColor;
+ if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
+ aButtonTextColor = Color( COL_BLACK );
+ else
+ aButtonTextColor = GetSettings().GetStyleSettings().GetButtonTextColor();
+
+ if ( GetStyle() & WB_DROPDOWN )
+ {
+ DecorationView aView( pDev );
+ USHORT nStyle = BUTTON_DRAW_NOLIGHTBORDER;
+ Rectangle aInnerRect = aView.DrawButton( aDD, nStyle );
+ SymbolType eSymbol = SYMBOL_SPIN_DOWN;
+ if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_SPINUPDOWN )
+ eSymbol = SYMBOL_SPIN_UPDOWN;
+
+ nStyle = ( IsEnabled() || ( nFlags & WINDOW_DRAW_NODISABLE ) ) ? 0 : SYMBOL_DRAW_DISABLE;
+ aView.DrawSymbol( aInnerRect, eSymbol, aButtonTextColor, nStyle );
+ }
+
+ if ( GetStyle() & WB_SPIN )
+ {
+ ImplDrawSpinButton( pDev, aUp, aDown, FALSE, FALSE, TRUE, TRUE );
+ }
+
+ pDev->Pop();
+ pDev->SetSettings( aOldSettings );
+ }
+}
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
new file mode 100644
index 000000000000..5165acb84e8a
--- /dev/null
+++ b/vcl/source/control/tabctrl.cxx
@@ -0,0 +1,1772 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_TABCTRL_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_APP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+#ifndef _SV_MENU_HXX
+#include <menu.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+#ifndef _SV_TABPAGE_HXX
+#include <tabpage.hxx>
+#endif
+#ifndef _SV_TABCTRL_HXX
+#include <tabctrl.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+struct ImplTabCtrlData
+{
+ PushButton* mpLeftBtn;
+ PushButton* mpRightBtn;
+};
+
+// -----------------------------------------------------------------------
+
+struct ImplTabItem
+{
+ USHORT mnId;
+ USHORT mnTabPageResId;
+ TabPage* mpTabPage;
+ String maText;
+ String maFormatText;
+ String maHelpText;
+ ULONG mnHelpId;
+ Rectangle maRect;
+ USHORT mnLine;
+ BOOL mbFullVisible;
+};
+
+DECLARE_LIST( ImplTabItemList, ImplTabItem* );
+
+// -----------------------------------------------------------------------
+
+#define TABCOLORCOUNT 10
+
+static ColorData aImplTabColorAry[TABCOLORCOUNT] =
+{
+ RGB_COLORDATA( 80, 216, 248 ),
+ RGB_COLORDATA( 128, 216, 168 ),
+ RGB_COLORDATA( 128, 144, 248 ),
+ RGB_COLORDATA( 208, 180, 168 ),
+ RGB_COLORDATA( 248, 252, 168 ),
+ RGB_COLORDATA( 168, 144, 168 ),
+ RGB_COLORDATA( 248, 144, 80 ),
+ RGB_COLORDATA( 248, 216, 80 ),
+ RGB_COLORDATA( 248, 180, 168 ),
+ RGB_COLORDATA( 248, 216, 168 )
+};
+
+// -----------------------------------------------------------------------
+
+#define TAB_OFFSET 3
+#define TAB_TABOFFSET_X 3
+#define TAB_TABOFFSET_Y 3
+#define TAB_BORDER_LEFT 1
+#define TAB_BORDER_TOP 1
+#define TAB_BORDER_RIGHT 2
+#define TAB_BORDER_BOTTOM 2
+
+// Fuer die Ermittlung von den Tab-Positionen
+#define TAB_PAGERECT 0xFFFF
+
+// =======================================================================
+
+void TabControl::ImplInit( Window* pParent, WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+ if ( !(nStyle & WB_NODIALOGCONTROL) )
+ nStyle |= WB_DIALOGCONTROL;
+
+ Control::ImplInit( pParent, nStyle, NULL );
+
+ mpItemList = new ImplTabItemList( 8, 8 );
+ mpTabCtrlData = NULL;
+ mnLastWidth = 0;
+ mnLastHeight = 0;
+ mnBtnSize = 0;
+ mnMaxPageWidth = 0;
+ mnActPageId = 0;
+ mnCurPageId = 0;
+ mnFirstPagePos = 0;
+ mnLastFirstPagePos = 0;
+ mbFormat = TRUE;
+ mbRestoreHelpId = FALSE;
+ mbRestoreUnqId = FALSE;
+ mbSingleLine = FALSE;
+ mbScroll = FALSE;
+ mbColored = FALSE;
+
+ if ( GetSettings().GetStyleSettings().GetTabControlStyle() & STYLE_TABCONTROL_SINGLELINE )
+ mbSingleLine = TRUE;
+
+ if ( mbSingleLine )
+ {
+ mpTabCtrlData = new ImplTabCtrlData;
+ mpTabCtrlData->mpLeftBtn = NULL;
+ mpTabCtrlData->mpRightBtn = NULL;
+ }
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetAppFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else
+ aColor = rStyleSettings.GetButtonTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+ }
+
+ // Sollen TabReiter farbig dargestellt werden
+ mbColored = (rStyleSettings.GetTabControlStyle() & STYLE_TABCONTROL_COLOR) != 0;
+ ImplScrollBtnsColor();
+}
+
+// -----------------------------------------------------------------------
+
+TabControl::TabControl( Window* pParent, WinBits nStyle ) :
+ Control( WINDOW_TABCONTROL )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+TabControl::TabControl( Window* pParent, const ResId& rResId ) :
+ Control( WINDOW_TABCONTROL )
+{
+ rResId.SetRT( RSC_TABCONTROL );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplLoadRes( const ResId& rResId )
+{
+ Control::ImplLoadRes( rResId );
+
+ USHORT nObjMask = ReadShortRes();
+
+ if ( nObjMask & RSC_TABCONTROL_ITEMLIST )
+ {
+ USHORT nEle = ReadShortRes();
+
+ // Item hinzufuegen
+ for( USHORT i = 0; i < nEle; i++ )
+ {
+ InsertPage( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+TabControl::~TabControl()
+{
+ // Alle Items loeschen
+ ImplTabItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Itemlist loeschen
+ delete mpItemList;
+
+ // TabCtrl-Daten loeschen
+ if ( mpTabCtrlData )
+ {
+ if ( mpTabCtrlData->mpLeftBtn )
+ delete mpTabCtrlData->mpLeftBtn;
+ if ( mpTabCtrlData->mpRightBtn )
+ delete mpTabCtrlData->mpRightBtn;
+ delete mpTabCtrlData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImplTabItem* TabControl::ImplGetItem( USHORT nId ) const
+{
+ ImplTabItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nId )
+ return pItem;
+
+ pItem = mpItemList->Next();
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplScrollBtnsColor()
+{
+ if ( mpTabCtrlData && mpTabCtrlData->mpLeftBtn )
+ {
+ if ( mbColored )
+ {
+ Color aScrollBtnColor( COL_LIGHTBLUE );
+ mpTabCtrlData->mpLeftBtn->SetControlForeground( aScrollBtnColor );
+ mpTabCtrlData->mpRightBtn->SetControlForeground( aScrollBtnColor );
+ }
+ else
+ {
+ mpTabCtrlData->mpLeftBtn->SetControlForeground();
+ mpTabCtrlData->mpRightBtn->SetControlForeground();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplSetScrollBtnsState()
+{
+ if ( mbScroll )
+ {
+ mpTabCtrlData->mpLeftBtn->Enable( mnFirstPagePos != 0 );
+ mpTabCtrlData->mpRightBtn->Enable( mnFirstPagePos < mnLastFirstPagePos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplPosScrollBtns()
+{
+ if ( mbScroll )
+ {
+ if ( !mpTabCtrlData->mpLeftBtn )
+ {
+ mpTabCtrlData->mpLeftBtn = new PushButton( this, WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOPOINTERFOCUS | WB_REPEAT );
+ mpTabCtrlData->mpLeftBtn->SetSymbol( SYMBOL_PREV );
+ mpTabCtrlData->mpLeftBtn->SetClickHdl( LINK( this, TabControl, ImplScrollBtnHdl ) );
+ }
+ if ( !mpTabCtrlData->mpRightBtn )
+ {
+ mpTabCtrlData->mpRightBtn = new PushButton( this, WB_RECTSTYLE | WB_SMALLSTYLE | WB_NOPOINTERFOCUS | WB_REPEAT );
+ mpTabCtrlData->mpRightBtn->SetSymbol( SYMBOL_NEXT );
+ mpTabCtrlData->mpRightBtn->SetClickHdl( LINK( this, TabControl, ImplScrollBtnHdl ) );
+ }
+
+ Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
+ aRect.Left() -= TAB_OFFSET;
+ aRect.Top() -= TAB_OFFSET;
+ aRect.Right() += TAB_OFFSET;
+ aRect.Bottom() += TAB_OFFSET;
+ long nX = aRect.Right()-mnBtnSize+1;
+ long nY = aRect.Top()-mnBtnSize;
+ mpTabCtrlData->mpRightBtn->SetPosSizePixel( nX, nY, mnBtnSize, mnBtnSize );
+ nX -= mnBtnSize;
+ mpTabCtrlData->mpLeftBtn->SetPosSizePixel( nX, nY, mnBtnSize, mnBtnSize );
+ ImplScrollBtnsColor();
+ ImplSetScrollBtnsState();
+ mpTabCtrlData->mpLeftBtn->Show();
+ mpTabCtrlData->mpRightBtn->Show();
+ }
+ else
+ {
+ if ( mpTabCtrlData )
+ {
+ if ( mpTabCtrlData->mpLeftBtn )
+ mpTabCtrlData->mpLeftBtn->Hide();
+ if ( mpTabCtrlData->mpRightBtn )
+ mpTabCtrlData->mpRightBtn->Hide();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) const
+{
+ pItem->maFormatText = pItem->maText;
+ Size aSize( GetCtrlTextWidth( pItem->maFormatText ), GetTextHeight() );
+ aSize.Width() += TAB_TABOFFSET_X*2;
+ aSize.Height() += TAB_TABOFFSET_Y*2;
+
+ // Evt. den Text kuerzen
+ if ( aSize.Width()+4 >= nMaxWidth )
+ {
+ XubString aAppendStr( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ pItem->maFormatText += aAppendStr;
+ do
+ {
+ pItem->maFormatText.Erase( pItem->maFormatText.Len()-aAppendStr.Len()-1, 1 );
+ aSize.Width() = GetCtrlTextWidth( pItem->maFormatText );
+ aSize.Width() += TAB_TABOFFSET_X*2;
+ }
+ while ( (aSize.Width()+4 >= nMaxWidth) && (pItem->maFormatText.Len() > aAppendStr.Len()) );
+ if ( aSize.Width()+4 >= nMaxWidth )
+ {
+ pItem->maFormatText.Assign( '.' );
+ aSize.Width() = 1;
+ }
+ }
+
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle TabControl::ImplGetTabRect( USHORT nPos, long nWidth, long nHeight )
+{
+ Size aWinSize = Control::GetOutputSizePixel();
+ if ( nWidth == -1 )
+ nWidth = aWinSize.Width();
+ if ( nHeight == -1 )
+ nHeight = aWinSize.Height();
+
+ if ( !mpItemList->Count() )
+ {
+ return Rectangle( Point( TAB_OFFSET, TAB_OFFSET ),
+ Size( nWidth-TAB_OFFSET*2, nHeight-TAB_OFFSET*2 ) );
+ }
+
+ if ( nPos == TAB_PAGERECT )
+ {
+ USHORT nLastPos;
+ if ( mbSingleLine )
+ nLastPos = mnFirstPagePos;
+ else
+ {
+ if ( mnCurPageId )
+ nLastPos = GetPagePos( mnCurPageId );
+ else
+ nLastPos = 0;
+ }
+ Rectangle aRect = ImplGetTabRect( nLastPos, nWidth, nHeight );
+ aRect = Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET ),
+ Size( nWidth-TAB_OFFSET*2,
+ nHeight-aRect.Bottom()-TAB_OFFSET*2 ) );
+ return aRect;
+ }
+
+ nWidth -= 1;
+
+ if ( (nWidth <= 0) || (nHeight <= 0) )
+ return Rectangle();
+
+ Font aFont = GetFont();
+ FontWeight eWeight = aFont.GetWeight();
+ if ( eWeight != WEIGHT_BOLD )
+ aFont.SetWeight( WEIGHT_BOLD );
+ if ( !aFont.IsTransparent() )
+ aFont.SetTransparent( TRUE );
+
+ if ( mbFormat || (mnLastWidth != nWidth) || (mnLastHeight != nHeight) )
+ {
+ if ( eWeight != WEIGHT_BOLD )
+ SetFont( aFont );
+
+ ImplTabItem* pItem;
+ Size aSize;
+ long nX = 2;
+ long nY = 2;
+ long nMaxWidth = nWidth;
+ USHORT nPos = 0;
+
+ if ( (mnMaxPageWidth > 0) && (mnMaxPageWidth < nMaxWidth) )
+ nMaxWidth = mnMaxPageWidth;
+
+ mbScroll = FALSE;
+ if ( mbSingleLine )
+ {
+ // Zuerst ermitteln wir, ob wir scrollen muessen
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ aSize = ImplGetItemSize( pItem, nMaxWidth );
+ pItem->maRect = Rectangle( Point( nX, nY ), aSize );
+ pItem->mnLine = 1;
+ pItem->mbFullVisible = TRUE;
+ nX += aSize.Width();
+
+ if ( (nX > nWidth-2) && (nWidth > 4) )
+ mbScroll = TRUE;
+
+ pItem = mpItemList->Next();
+ }
+
+ // Wenn wir Scrollen muessen, dann muessen die Reiter
+ // entsprechend angeordnet werden
+ if ( mbScroll )
+ {
+ // Zuerst ermitteln wir den letzten TabReiter, bei dem
+ // die restlichen noch sichtbar bleiben und passen
+ // gegebenenfalls den ersten sichtbaren Writer an
+ mnBtnSize = GetTextHeight()+(TAB_TABOFFSET_Y*2);
+ long nMaxWidth = nWidth-(mnBtnSize*2);
+ long nTempWidth = 0;
+ USHORT nPageCount = GetPageCount();
+ mnLastFirstPagePos = nPageCount;
+ pItem = mpItemList->Last();
+ while ( pItem )
+ {
+ nTempWidth += pItem->maRect.GetSize().Width();
+ if ( nTempWidth > nMaxWidth )
+ break;
+
+ mnLastFirstPagePos--;
+ pItem = mpItemList->Prev();
+ }
+ if ( mnLastFirstPagePos > nPageCount-1 )
+ mnLastFirstPagePos = nPageCount-1;
+ if ( mnFirstPagePos > mnLastFirstPagePos )
+ mnFirstPagePos = mnLastFirstPagePos;
+
+ // Jetzt die TabReiter anordnen und die Reiter ausblenden,
+ // die nicht zu sehen sind
+ nPos = 0;
+ nX = 2;
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( (nPos < mnFirstPagePos) ||
+ ((nX > nWidth-2) && (nWidth > 4)) )
+ {
+ pItem->mbFullVisible = FALSE;
+ pItem->maRect.SetEmpty();
+ }
+ else
+ {
+ aSize = pItem->maRect.GetSize();
+ pItem->maRect = Rectangle( Point( nX, nY ), aSize );
+ nX += aSize.Width();
+ }
+
+ if ( nX > nMaxWidth )
+ pItem->mbFullVisible = FALSE;
+
+ pItem = mpItemList->Next();
+ nPos++;
+ }
+ }
+ else
+ mnFirstPagePos = 0;
+ }
+ else
+ {
+ USHORT nLines = 0;
+ USHORT nCurLine = 0;
+ long nLineWidthAry[100];
+ USHORT nLinePosAry[100];
+
+ nLineWidthAry[0] = 0;
+ nLinePosAry[0] = 0;
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ aSize = ImplGetItemSize( pItem, nMaxWidth );
+
+ if ( ((nX+aSize.Width()) > nWidth-2) && (nWidth > 4) )
+ {
+ if ( nLines == 99 )
+ break;
+
+ nX = 2;
+ nY += aSize.Height();
+ nLines++;
+ nLineWidthAry[nLines] = 0;
+ nLinePosAry[nLines] = nPos;
+ }
+
+ pItem->maRect = Rectangle( Point( nX, nY ), aSize );
+ pItem->mnLine = nLines;
+ pItem->mbFullVisible = TRUE;
+
+ nLineWidthAry[nLines] += aSize.Width();
+ nX += aSize.Width();
+
+ if ( pItem->mnId == mnCurPageId )
+ nCurLine = nLines;
+
+ pItem = mpItemList->Next();
+ nPos++;
+ }
+
+ if ( nLines )
+ {
+ long nDX;
+ long nModDX;
+ long nIDX;
+ USHORT i;
+ USHORT n;
+ long nLineHeightAry[100];
+ long nIH = mpItemList->GetObject( 0 )->maRect.Bottom()-2;
+
+ i = 0;
+ while ( i < nLines+1 )
+ {
+ if ( i <= nCurLine )
+ nLineHeightAry[i] = nIH*(nLines-(nCurLine-i));
+ else
+ nLineHeightAry[i] = nIH*(i-nCurLine-1);
+ i++;
+ }
+
+ i = 0;
+ n = 0;
+ nLinePosAry[nLines+1] = (USHORT)mpItemList->Count();
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( i == nLinePosAry[n] )
+ {
+ if ( n == nLines+1 )
+ break;
+
+ nIDX = 0;
+ nDX = (nWidth-2-nLineWidthAry[n]) / (nLinePosAry[n+1]-i);
+ nModDX = (nWidth-2-nLineWidthAry[n]) % (nLinePosAry[n+1]-i);
+ n++;
+ }
+
+ pItem->maRect.Left() += nIDX;
+ pItem->maRect.Right() += nIDX+nDX;
+ pItem->maRect.Top() = nLineHeightAry[n-1];
+ pItem->maRect.Bottom() = nLineHeightAry[n-1]+nIH;
+ nIDX += nDX;
+
+ if ( nModDX )
+ {
+ nIDX++;
+ pItem->maRect.Right()++;
+ nModDX--;
+ }
+
+ pItem = mpItemList->Next();
+ i++;
+ }
+ }
+ }
+
+ mnLastWidth = nWidth;
+ mnLastHeight = nHeight;
+ mbFormat = FALSE;
+
+ ImplPosScrollBtns();
+ }
+
+ return mpItemList->GetObject( nPos )->maRect;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
+{
+ ImplTabItem* pOldItem = ImplGetItem( nOldId );
+ ImplTabItem* pItem = ImplGetItem( nId );
+ TabPage* pOldPage = (pOldItem) ? pOldItem->mpTabPage : NULL;
+ TabPage* pPage = (pItem) ? pItem->mpTabPage : NULL;
+ Window* pCtrlParent = GetParent();
+
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ USHORT nPos = GetPagePos( nId );
+ Rectangle aRect = ImplGetTabRect( nPos );
+
+ if ( !pOldItem || (pOldItem->mnLine != pItem->mnLine) )
+ {
+ aRect.Left() = 0;
+ aRect.Top() = 0;
+ aRect.Right() = Control::GetOutputSizePixel().Width();
+ }
+ else
+ {
+ aRect.Left() -= 3;
+ aRect.Top() -= 2;
+ aRect.Right() += 3;
+ Invalidate( aRect );
+ nPos = GetPagePos( nOldId );
+ aRect = ImplGetTabRect( nPos );
+ aRect.Left() -= 3;
+ aRect.Top() -= 2;
+ aRect.Right() += 3;
+ }
+ Invalidate( aRect );
+ }
+
+ if ( pOldPage == pPage )
+ return;
+
+ Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
+
+ if ( pOldPage )
+ {
+ if ( mbRestoreHelpId )
+ pCtrlParent->SetHelpId( 0 );
+ if ( mbRestoreUnqId )
+ pCtrlParent->SetUniqueId( 0 );
+ pOldPage->DeactivatePage();
+ }
+
+ if ( pPage )
+ {
+ pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+
+ // Hier Page aktivieren, damit die Controls entsprechend umgeschaltet
+ // werden koennen und HilfeId gegebenenfalls beim Parent umsetzen
+ if ( !GetHelpId() )
+ {
+ mbRestoreHelpId = TRUE;
+ pCtrlParent->SetHelpId( pPage->GetHelpId() );
+ }
+ if ( !pCtrlParent->GetUniqueId() )
+ {
+ mbRestoreUnqId = TRUE;
+ pCtrlParent->SetUniqueId( pPage->GetUniqueId() );
+ }
+
+ pPage->ActivatePage();
+
+ if ( pOldPage && pOldPage->HasChildPathFocus() )
+ {
+ USHORT n = 0;
+ Window* pFirstChild = pPage->ImplGetDlgWindow( n, DLGWINDOW_FIRST );
+ if ( pFirstChild )
+ pFirstChild->ImplControlFocus( GETFOCUS_INIT );
+ else
+ GrabFocus();
+ }
+
+ pPage->Show();
+
+ if( Application::GetAccessHdlCount() && pPage->IsReallyVisible() )
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_DLGCONTROLS, GetParent() ) );
+ }
+
+ if ( pOldPage )
+ pOldPage->Hide();
+
+ Invalidate( aRect );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL TabControl::ImplPosCurTabPage()
+{
+ // Aktuelle TabPage resizen/positionieren
+ ImplTabItem* pItem = ImplGetItem( GetCurPageId() );
+ if ( pItem && pItem->mpTabPage )
+ {
+ Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
+ pItem->mpTabPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplActivateTabPage( BOOL bNext )
+{
+ USHORT nCurPos = GetPagePos( GetCurPageId() );
+
+ if ( bNext )
+ nCurPos = (nCurPos + 1) % GetPageCount();
+ else
+ {
+ if ( !nCurPos )
+ nCurPos = GetPageCount()-1;
+ else
+ nCurPos--;
+ }
+
+ SelectTabPage( GetPageId( nCurPos ) );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplSetFirstPagePos( USHORT nPagePos )
+{
+ if ( !mbSingleLine )
+ return;
+
+ if ( mbFormat )
+ mnFirstPagePos = nPagePos;
+ else
+ {
+ if ( nPagePos > mnLastFirstPagePos )
+ nPagePos = mnLastFirstPagePos;
+
+ if ( nPagePos != mnFirstPagePos )
+ {
+ // Neu auszugebene Rechteck berechnen
+ Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
+ aRect.Bottom() = aRect.Top();
+ aRect.Left() = 0;
+ aRect.Top() = 0;
+ aRect.Right() = Control::GetOutputSizePixel().Width();
+
+ mbFormat = TRUE;
+ mnFirstPagePos = nPagePos;
+ Invalidate( aRect, INVALIDATE_NOCHILDREN );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplShowFocus()
+{
+ if ( !GetPageCount() )
+ return;
+
+ USHORT nCurPos = GetPagePos( mnCurPageId );
+ Rectangle aRect = ImplGetTabRect( nCurPos );
+ ImplTabItem* pItem = mpItemList->GetObject( nCurPos );
+ Size aTabSize = aRect.GetSize();
+ long nTextHeight = GetTextHeight();
+ long nTextWidth = GetCtrlTextWidth( pItem->maFormatText );
+ USHORT nOff;
+
+ if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_MONO) )
+ nOff = 1;
+ else
+ nOff = 0;
+
+ aRect.Left() = aRect.Left()+((aTabSize.Width()-nTextWidth)/2)-nOff-1-1;
+ aRect.Top() = aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-1-1;
+ aRect.Right() = aRect.Left()+nTextWidth+2;
+ aRect.Bottom() = aRect.Top()+nTextHeight+2;
+ ShowFocus( aRect );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect )
+{
+ if ( pItem->maRect.IsEmpty() )
+ return;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aRect = pItem->maRect;
+ long nLeftBottom = aRect.Bottom();
+ long nRightBottom = aRect.Bottom();
+ BOOL bLeftBorder = TRUE;
+ BOOL bRightBorder = TRUE;
+ USHORT nOff;
+
+ USHORT nOff2 = 0;
+ USHORT nOff3 = 0;
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ nOff = 1;
+ else
+ nOff = 0;
+
+ // Wenn wir die aktuelle Page sind, muessen wir etwas mehr zeichnen
+ if ( pItem->mnId == mnCurPageId )
+ {
+ nOff2 = 2;
+ nOff3 = 1;
+ }
+ else
+ {
+ Point aLeftTestPos = aRect.BottomLeft();
+ Point aRightTestPos = aRect.BottomRight();
+ if ( aLeftTestPos.Y() == rCurRect.Bottom() )
+ {
+ aLeftTestPos.X() -= 2;
+ if ( rCurRect.IsInside( aLeftTestPos ) )
+ bLeftBorder = FALSE;
+ aRightTestPos.X() += 2;
+ if ( rCurRect.IsInside( aRightTestPos ) )
+ bRightBorder = FALSE;
+ }
+ else
+ {
+ if ( rCurRect.IsInside( aLeftTestPos ) )
+ nLeftBottom -= 2;
+ if ( rCurRect.IsInside( aRightTestPos ) )
+ nRightBottom -= 2;
+ }
+ }
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ if ( mbColored )
+ {
+ USHORT nPos = (USHORT)mpItemList->GetPos( pItem );
+ Color aOldFillColor = GetFillColor();
+ SetLineColor();
+ SetFillColor( aImplTabColorAry[nPos%TABCOLORCOUNT] );
+ Rectangle aColorRect;
+ aColorRect.Left() = aRect.Left()-nOff2+1;
+ aColorRect.Top() = aRect.Top()-nOff2+1;
+ aColorRect.Right() = aRect.Right()+nOff2-3;
+ aColorRect.Bottom() = nLeftBottom;
+ if ( pItem->mnId != mnCurPageId )
+ aColorRect.Bottom()--;
+ DrawRect( aColorRect );
+ SetFillColor( aOldFillColor );
+ }
+
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawPixel( Point( aRect.Left()+1-nOff2, aRect.Top()+1-nOff2 ) );
+ if ( bLeftBorder )
+ {
+ DrawLine( Point( aRect.Left()-nOff2, aRect.Top()+2-nOff2 ),
+ Point( aRect.Left()-nOff2, nLeftBottom-1 ) );
+ }
+ DrawLine( Point( aRect.Left()+2-nOff2, aRect.Top()-nOff2 ),
+ Point( aRect.Right()+nOff2-3, aRect.Top()-nOff2 ) );
+
+ if ( bRightBorder )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( aRect.Right()+nOff2-2, aRect.Top()+1-nOff2 ),
+ Point( aRect.Right()+nOff2-2, nRightBottom-1 ) );
+
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ DrawLine( Point( aRect.Right()+nOff2-1, aRect.Top()+3-nOff2 ),
+ Point( aRect.Right()+nOff2-1, nRightBottom-1 ) );
+ }
+ }
+ else
+ {
+ SetLineColor( Color( COL_BLACK ) );
+ DrawPixel( Point( aRect.Left()+1-nOff2, aRect.Top()+1-nOff2 ) );
+ DrawPixel( Point( aRect.Right()+nOff2-2, aRect.Top()+1-nOff2 ) );
+ if ( bLeftBorder )
+ {
+ DrawLine( Point( aRect.Left()-nOff2, aRect.Top()+2-nOff2 ),
+ Point( aRect.Left()-nOff2, nLeftBottom-1 ) );
+ }
+ DrawLine( Point( aRect.Left()+2-nOff2, aRect.Top()-nOff2 ),
+ Point( aRect.Right()-3, aRect.Top()-nOff2 ) );
+ if ( bRightBorder )
+ {
+ DrawLine( Point( aRect.Right()+nOff2-1, aRect.Top()+2-nOff2 ),
+ Point( aRect.Right()+nOff2-1, nRightBottom-1 ) );
+ }
+ }
+
+ Size aTabSize = aRect.GetSize();
+ long nTextHeight = GetTextHeight();
+ long nTextWidth = GetCtrlTextWidth( pItem->maFormatText );
+ DrawCtrlText( Point( aRect.Left()+((aTabSize.Width()-nTextWidth)/2)-nOff-nOff3,
+ aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-nOff3 ),
+ pItem->maFormatText );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( TabControl, ImplScrollBtnHdl, PushButton*, pBtn )
+{
+ if ( pBtn == mpTabCtrlData->mpRightBtn )
+ ImplSetFirstPagePos( mnFirstPagePos+1 );
+ else
+ ImplSetFirstPagePos( mnFirstPagePos-1 );
+ ImplSetScrollBtnsState();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
+ SelectTabPage( GetPageId( rMEvt.GetPosPixel() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( GetPageCount() > 1 )
+ {
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( (nKeyCode == KEY_LEFT) || (nKeyCode == KEY_RIGHT) )
+ {
+ BOOL bNext = (nKeyCode == KEY_RIGHT);
+ ImplActivateTabPage( bNext );
+ }
+ }
+
+ Control::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::Paint( const Rectangle& rRect )
+{
+ HideFocus();
+
+ // Hier wird gegebenenfalls auch neu formatiert
+ Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
+
+ // Fonts entsprechend setzen
+ Font aFont( GetFont() );
+ Font aLightFont = aFont;
+ aFont.SetTransparent( TRUE );
+ aFont.SetWeight( WEIGHT_BOLD );
+ aLightFont.SetTransparent( TRUE );
+ aLightFont.SetWeight( WEIGHT_LIGHT );
+
+ // Aktuelles Item ermitteln
+ ImplTabItem* pPrevCurItem = NULL;
+ ImplTabItem* pCurItem = NULL;
+ ImplTabItem* pItem = mpItemList->First();
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == mnCurPageId )
+ {
+ pCurItem = pItem;
+ break;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ // Border um TabPage zeichnen
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aCurRect;
+ long nTopOff = 1;
+ aRect.Left() -= TAB_OFFSET;
+ aRect.Top() -= TAB_OFFSET;
+ aRect.Right() += TAB_OFFSET;
+ aRect.Bottom() += TAB_OFFSET;
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ SetLineColor( rStyleSettings.GetLightColor() );
+ else
+ SetLineColor( Color( COL_BLACK ) );
+ if ( pCurItem && !pCurItem->maRect.IsEmpty() )
+ {
+ aCurRect = pCurItem->maRect;
+ DrawLine( aRect.TopLeft(), Point( aCurRect.Left()-2, aRect.Top() ) );
+ if ( aCurRect.Right()+1 < aRect.Right() )
+ DrawLine( Point( aCurRect.Right(), aRect.Top() ), aRect.TopRight() );
+ else
+ nTopOff = 0;
+ }
+ else
+ DrawLine( aRect.TopLeft(), aRect.TopRight() );
+ DrawLine( aRect.TopLeft(), aRect.BottomLeft() );
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( 1, aRect.Bottom()-1 ),
+ Point( aRect.Right()-1, aRect.Bottom()-1 ) );
+ DrawLine( Point( aRect.Right()-1, aRect.Top()+nTopOff ),
+ Point( aRect.Right()-1, aRect.Bottom()-1 ) );
+ SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ DrawLine( Point( 0, aRect.Bottom() ),
+ Point( aRect.Right(), aRect.Bottom() ) );
+ DrawLine( Point( aRect.Right(), aRect.Top()+nTopOff ),
+ Point( aRect.Right(), aRect.Bottom() ) );
+ }
+ else
+ {
+ DrawLine( aRect.TopRight(), aRect.BottomRight() );
+ DrawLine( aRect.BottomLeft(), aRect.BottomRight() );
+ }
+
+ // Alle Items bis auf das aktuelle Zeichnen (nicht fett)
+ SetFont( aLightFont );
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem != pCurItem )
+ ImplDrawItem( pItem, aCurRect );
+ pItem = mpItemList->Next();
+ }
+
+ // aktuelles Item zeichnen wir fett
+ SetFont( aFont );
+ if ( pCurItem )
+ ImplDrawItem( pCurItem, aCurRect );
+
+ if ( HasFocus() )
+ ImplShowFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::Resize()
+{
+ if ( !IsReallyShown() )
+ return;
+
+ mbFormat = TRUE;
+
+ // Aktuelle TabPage resizen/positionieren
+ BOOL bTabPage = ImplPosCurTabPage();
+ // Feststellen, was invalidiert werden muss
+ Size aNewSize = Control::GetOutputSizePixel();
+ long nWidthTest = aNewSize.Width();
+ BOOL bSmallInvalidate = TRUE;
+ BOOL bWidthChanged = (nWidthTest != mnLastWidth);
+ if ( mbScroll )
+ bSmallInvalidate = FALSE;
+ else if ( bWidthChanged )
+ {
+ if ( mnLastWidth < nWidthTest )
+ nWidthTest = mnLastWidth;
+
+ ImplTabItem* pItem;
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( !pItem->mbFullVisible ||
+ (pItem->maRect.Right()-2 >= nWidthTest) )
+ {
+ bSmallInvalidate = FALSE;
+ break;
+ }
+
+ pItem = mpItemList->Next();
+ }
+ }
+
+ if ( bSmallInvalidate )
+ {
+ Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
+ aRect.Left() -= TAB_OFFSET+TAB_BORDER_LEFT;
+ aRect.Top() -= TAB_OFFSET+TAB_BORDER_TOP;
+ aRect.Right() += TAB_OFFSET+TAB_BORDER_RIGHT;
+ aRect.Bottom() += TAB_OFFSET+TAB_BORDER_BOTTOM;
+ if ( bTabPage )
+ Invalidate( aRect, INVALIDATE_NOCHILDREN );
+ else
+ Invalidate( aRect );
+ }
+ else
+ {
+ if ( bTabPage )
+ Invalidate( INVALIDATE_NOCHILDREN );
+ else
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::GetFocus()
+{
+ ImplShowFocus();
+ SetInputContext( InputContext( GetFont() ) );
+ Control::GetFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::LoseFocus()
+{
+ HideFocus();
+ Control::LoseFocus();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nItemId = GetPageId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+
+ if ( nItemId )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ {
+ XubString aStr = GetHelpText( nItemId );
+ if ( aStr.Len() )
+ {
+ Rectangle aItemRect = ImplGetTabRect( GetPagePos( nItemId ) );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
+ return;
+ }
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
+ {
+ ULONG nHelpId = GetHelpId( nItemId );
+ if ( nHelpId )
+ {
+ // Wenn eine Hilfe existiert, dann ausloesen
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pHelp->Start( nHelpId );
+ return;
+ }
+ }
+
+ // Bei Quick- oder Ballloon-Help zeigen wir den Text an,
+ // wenn dieser abgeschnitten ist
+ if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) )
+ {
+ ImplTabItem* pItem = ImplGetItem( nItemId );
+ const XubString& rStr = pItem->maText;
+ if ( rStr != pItem->maFormatText )
+ {
+ Rectangle aItemRect = ImplGetTabRect( GetPagePos( nItemId ) );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ if ( rStr.Len() )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, rStr );
+ else
+ Help::ShowQuickHelp( this, aItemRect, rStr );
+ return;
+ }
+ }
+ }
+ }
+
+ Control::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::Command( const CommandEvent& rCEvt )
+{
+ if ( (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) )
+ {
+ Point aMenuPos;
+ BOOL bMenu;
+ if ( rCEvt.IsMouseEvent() )
+ {
+ aMenuPos = rCEvt.GetMousePosPixel();
+ bMenu = GetPageId( aMenuPos ) != 0;
+ }
+ else
+ {
+ aMenuPos = ImplGetTabRect( GetPagePos( mnCurPageId ) ).Center();
+ bMenu = TRUE;
+ }
+
+ if ( bMenu )
+ {
+ PopupMenu aMenu;
+ ImplTabItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ aMenu.InsertItem( pItem->mnId, pItem->maText, MIB_CHECKABLE | MIB_RADIOCHECK );
+ if ( pItem->mnId == mnCurPageId )
+ aMenu.CheckItem( pItem->mnId );
+ aMenu.SetHelpId( pItem->mnId, pItem->mnHelpId );
+ pItem = mpItemList->Next();
+ }
+
+ USHORT nId = aMenu.Execute( this, aMenuPos );
+ if ( nId && (nId != mnCurPageId) )
+ SelectTabPage( nId );
+ return;
+ }
+ }
+
+ Control::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::StateChanged( StateChangedType nType )
+{
+ Control::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ ImplPosCurTabPage();
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Control::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long TabControl::Notify( NotifyEvent& rNEvt )
+{
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) && (GetPageCount() > 1) )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( aKeyCode.IsMod1() )
+ {
+ if ( aKeyCode.IsShift() || (nKeyCode == KEY_PAGEUP) )
+ {
+ if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEUP) )
+ {
+ ImplActivateTabPage( FALSE );
+ return TRUE;
+ }
+ }
+ else
+ {
+ if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEDOWN) )
+ {
+ ImplActivateTabPage( TRUE );
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return Control::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::ActivatePage()
+{
+ maActivateHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+long TabControl::DeactivatePage()
+{
+ if ( maDeactivateHdl.IsSet() )
+ return maDeactivateHdl.Call( this );
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetTabPageSizePixel( const Size& rSize )
+{
+ Size aNewSize( rSize );
+ aNewSize.Width() += TAB_OFFSET*2;
+ Rectangle aRect = ImplGetTabRect( TAB_PAGERECT,
+ aNewSize.Width(), aNewSize.Height() );
+ aNewSize.Height() += aRect.Top()+TAB_OFFSET;
+ Window::SetOutputSizePixel( aNewSize );
+}
+
+// -----------------------------------------------------------------------
+
+Size TabControl::GetTabPageSizePixel() const
+{
+ Rectangle aRect = ((TabControl*)this)->ImplGetTabRect( TAB_PAGERECT );
+ return aRect.GetSize();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::InsertPage( const ResId& rResId, USHORT nPos )
+{
+ GetRes( rResId.SetRT( RSC_TABCONTROLITEM ) );
+
+ USHORT nObjMask = ReadShortRes();
+ USHORT nItemId = 1;
+
+ // ID
+ if ( nObjMask & RSC_TABCONTROLITEM_ID )
+ nItemId = ReadShortRes();
+
+ // Text
+ XubString aTmpStr;
+ if( nObjMask & RSC_TABCONTROLITEM_TEXT )
+ aTmpStr = ReadStringRes();
+ InsertPage( nItemId, aTmpStr, nPos );
+
+ // PageResID
+ if ( nObjMask & RSC_TABCONTROLITEM_PAGERESID )
+ {
+ ImplTabItem* pItem = mpItemList->GetObject( GetPagePos( nItemId ) );
+ pItem->mnTabPageResId = ReadShortRes();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::InsertPage( USHORT nPageId, const XubString& rText,
+ USHORT nPos )
+{
+ DBG_ASSERT( nPageId, "TabControl::InsertPage(): PageId == 0" );
+ DBG_ASSERT( GetPagePos( nPageId ) == TAB_PAGE_NOTFOUND,
+ "TabControl::InsertPage(): PageId already exists" );
+
+ // CurPageId gegebenenfalls setzen
+ if ( !mnCurPageId )
+ mnCurPageId = nPageId;
+
+ // PageItem anlegen
+ ImplTabItem* pItem = new ImplTabItem;
+ pItem->mnId = nPageId;
+ pItem->mpTabPage = NULL;
+ pItem->mnTabPageResId = 0;
+ pItem->mnHelpId = 0;
+ pItem->maText = rText;
+ pItem->mbFullVisible = FALSE;
+
+ // In die StarView-Liste eintragen
+ mpItemList->Insert( pItem, nPos );
+
+ mbFormat = TRUE;
+ if ( IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::RemovePage( USHORT nPageId )
+{
+ USHORT nPos = GetPagePos( nPageId );
+
+ // Existiert Item
+ if ( nPos != TAB_PAGE_NOTFOUND )
+ {
+ // Item-Daten loeschen und Windows-Item entfernen
+ ImplTabItem* pItem = mpItemList->Remove( nPos );
+ if ( pItem->mnId == mnCurPageId )
+ mnCurPageId = 0;
+ delete pItem;
+
+ mbFormat = TRUE;
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::Clear()
+{
+ // Alle Items loeschen
+ ImplTabItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Item-Daten loeschen
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Items aus der Liste loeschen
+ mpItemList->Clear();
+ mnCurPageId = 0;
+
+ mbFormat = TRUE;
+ if ( IsUpdateMode() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabControl::GetPageCount() const
+{
+ return (USHORT)mpItemList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabControl::GetPageId( USHORT nPos ) const
+{
+ ImplTabItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem )
+ return pItem->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabControl::GetPagePos( USHORT nPageId ) const
+{
+ ImplTabItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nPageId )
+ return (USHORT)mpItemList->GetCurPos();
+
+ pItem = mpItemList->Next();
+ }
+
+ return TAB_PAGE_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabControl::GetPageId( const Point& rPos ) const
+{
+ USHORT i = 0;
+ while ( i < mpItemList->Count() )
+ {
+ if ( ((TabControl*)this)->ImplGetTabRect( i ).IsInside( rPos ) )
+ return mpItemList->GetObject( i )->mnId;
+ i++;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetCurPageId( USHORT nPageId )
+{
+ if ( nPageId == mnCurPageId )
+ {
+ if ( mnActPageId )
+ mnActPageId = nPageId;
+ return;
+ }
+
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+ if ( pItem )
+ {
+ if ( mnActPageId )
+ mnActPageId = nPageId;
+ else
+ {
+ if ( pItem->maRect.IsEmpty() || !pItem->mbFullVisible )
+ SetFirstPageId( nPageId );
+ mbFormat = TRUE;
+ USHORT nOldId = mnCurPageId;
+ mnCurPageId = nPageId;
+ ImplChangeTabPage( nPageId, nOldId );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabControl::GetCurPageId() const
+{
+ if ( mnActPageId )
+ return mnActPageId;
+ else
+ return mnCurPageId;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetFirstPageId( USHORT nPageId )
+{
+ USHORT nPos = GetPagePos( nPageId );
+ if ( (nPos != TAB_PAGE_NOTFOUND) && (nPos != mnFirstPagePos) )
+ ImplSetFirstPagePos( nPos );
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SelectTabPage( USHORT nPageId )
+{
+ if ( nPageId && (nPageId != mnCurPageId) )
+ {
+ if ( DeactivatePage() )
+ {
+ mnActPageId = nPageId;
+ ActivatePage();
+ // Page koennte im Activate-Handler umgeschaltet wurden sein
+ nPageId = mnActPageId;
+ mnActPageId = 0;
+ SetCurPageId( nPageId );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetTabPage( USHORT nPageId, TabPage* pTabPage )
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem && (pItem->mpTabPage != pTabPage) )
+ {
+ if ( pTabPage )
+ {
+ DBG_ASSERT( !pTabPage->IsVisible(), "TabControl::SetTabPage() - Page is visible" );
+
+ if ( IsDefaultSize() )
+ SetTabPageSizePixel( pTabPage->GetSizePixel() );
+
+ // Erst hier setzen, damit Resize nicht TabPage umpositioniert
+ pItem->mpTabPage = pTabPage;
+ if ( pItem->mnId == mnCurPageId )
+ ImplChangeTabPage( pItem->mnId, 0 );
+ }
+ else
+ pItem->mpTabPage = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+TabPage* TabControl::GetTabPage( USHORT nPageId ) const
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ return pItem->mpTabPage;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT TabControl::GetTabPageResId( USHORT nPageId ) const
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ return pItem->mnTabPageResId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetPageText( USHORT nPageId, const XubString& rText )
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ {
+ pItem->maText = rText;
+ mbFormat = TRUE;
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString TabControl::GetPageText( USHORT nPageId ) const
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ return pItem->maText;
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetHelpText( USHORT nPageId, const XubString& rText )
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ pItem->maHelpText = rText;
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& TabControl::GetHelpText( USHORT nPageId ) const
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ {
+ if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
+ {
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId );
+ }
+
+ return pItem->maHelpText;
+ }
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void TabControl::SetHelpId( USHORT nPageId, ULONG nHelpId )
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ pItem->mnHelpId = nHelpId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG TabControl::GetHelpId( USHORT nPageId ) const
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+
+ if ( pItem )
+ return pItem->mnHelpId;
+ else
+ return 0;
+}
diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx
new file mode 100644
index 000000000000..9e00d0044787
--- /dev/null
+++ b/vcl/source/gdi/alpha.cxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * $RCSfile: alpha.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_ALPHA_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_COLOR_HXX
+#include <color.hxx>
+#endif
+#ifndef _SV_ALPHA_HXX
+#include <alpha.hxx>
+#endif
+
+// -------------
+// - AlphaMask -
+// -------------
+
+AlphaMask::AlphaMask()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+AlphaMask::AlphaMask( const Bitmap& rBitmap ) :
+ Bitmap( rBitmap )
+{
+ if( !!rBitmap )
+ Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
+}
+
+// -----------------------------------------------------------------------------
+
+AlphaMask::AlphaMask( const AlphaMask& rAlphaMask ) :
+ Bitmap( rAlphaMask )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+AlphaMask::AlphaMask( const Size& rSizePixel, BYTE* pEraseTransparency ) :
+ Bitmap( rSizePixel, 8, &Bitmap::GetGreyPalette( 256 ) )
+{
+ if( pEraseTransparency )
+ Bitmap::Erase( Color( *pEraseTransparency, *pEraseTransparency, *pEraseTransparency ) );
+}
+
+// -----------------------------------------------------------------------------
+
+AlphaMask::~AlphaMask()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+AlphaMask& AlphaMask::operator=( const Bitmap& rBitmap )
+{
+ *(Bitmap*) this = rBitmap;
+
+ if( !!rBitmap )
+ Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+
+const Bitmap& AlphaMask::ImplGetBitmap() const
+{
+ return( (const Bitmap&) *this );
+}
+
+// -----------------------------------------------------------------------------
+
+void AlphaMask::ImplSetBitmap( const Bitmap& rBitmap )
+{
+ *(Bitmap*) this = rBitmap;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Crop( const Rectangle& rRectPixel )
+{
+ return Bitmap::Crop( rRectPixel );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Expand( ULONG nDX, ULONG nDY, BYTE* pInitTransparency )
+{
+ Color aColor;
+
+ if( pInitTransparency )
+ aColor = Color( *pInitTransparency, *pInitTransparency, *pInitTransparency );
+
+ return Bitmap::Expand( nDX, nDY, pInitTransparency ? &aColor : NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Erase( BYTE cTransparency )
+{
+ return Bitmap::Erase( Color( cTransparency, cTransparency, cTransparency ) );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Invert()
+{
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pAcc && pAcc->GetBitCount() == 8 )
+ {
+ BitmapColor aCol( 0 );
+ const long nWidth = pAcc->Width(), nHeight = pAcc->Height();
+ BYTE* pMap = new BYTE[ 256 ];
+
+ for( long i = 0; i < 256; i++ )
+ pMap[ i ] = ~(BYTE) i;
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aCol.SetIndex( pMap[ pAcc->GetPixel( nY, nX ).GetIndex() ] );
+ pAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+
+ delete[] pMap;
+ bRet = TRUE;
+ }
+
+ if( pAcc )
+ ReleaseAccess( pAcc );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Mirror( ULONG nMirrorFlags )
+{
+ return Bitmap::Mirror( nMirrorFlags );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Scale( const Size& rNewSize, ULONG nScaleFlag )
+{
+ BOOL bRet = Bitmap::Scale( rNewSize, nScaleFlag );
+
+ if( bRet && ( nScaleFlag == BMP_SCALE_INTERPOLATE ) )
+ Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag )
+{
+ BOOL bRet = Bitmap::Scale( rScaleX, rScaleY, nScaleFlag );
+
+ if( bRet && ( nScaleFlag == BMP_SCALE_INTERPOLATE ) )
+ Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Rotate( long nAngle10, BYTE cFillTransparency )
+{
+ return Bitmap::Rotate( nAngle10, Color( cFillTransparency, cFillTransparency, cFillTransparency ) );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Replace( const Bitmap& rMask, BYTE cReplaceTransparency )
+{
+ BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess();
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pMaskAcc && pAcc )
+ {
+ const BitmapColor aReplace( cReplaceTransparency );
+ const long nWidth = Min( pMaskAcc->Width(), pAcc->Width() );
+ const long nHeight = Min( pMaskAcc->Height(), pAcc->Height() );
+ const BitmapColor aMaskWhite( pMaskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite )
+ pAcc->SetPixel( nY, nX, aReplace );
+ }
+
+ ( (Bitmap&) rMask ).ReleaseAccess( pMaskAcc );
+ ReleaseAccess( pAcc );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Replace( BYTE cSearchTransparency, BYTE cReplaceTransparency, ULONG nTol )
+{
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ DBG_ASSERT( !nTol, "AlphaMask::Replace: nTol not used yet" );
+
+ if( pAcc && pAcc->GetBitCount() == 8 )
+ {
+ const long nWidth = pAcc->Width(), nHeight = pAcc->Height();
+
+ if( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ Scanline pScan = pAcc->GetScanline( nY );
+
+ for( long nX = 0L; nX < nWidth; nX++, pScan++ )
+ {
+ if( *pScan == cSearchTransparency )
+ *pScan = cReplaceTransparency;
+ }
+ }
+ }
+ else
+ {
+ BitmapColor aReplace( cReplaceTransparency );
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pAcc->GetPixel( nY, nX ).GetIndex() == cSearchTransparency )
+ pAcc->SetPixel( nY, nX, aReplace );
+ }
+ }
+ }
+
+ bRet = TRUE;
+ }
+
+ if( pAcc )
+ ReleaseAccess( pAcc );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL AlphaMask::Replace( BYTE* pSearchTransparencies, BYTE* pReplaceTransparencies,
+ ULONG nColorCount, ULONG* pTols )
+{
+ Color* pSearchColors = new Color[ nColorCount ];
+ Color* pReplaceColors = new Color[ nColorCount ];
+ BOOL bRet;
+
+ for( ULONG i = 0; i < nColorCount; i++ )
+ {
+ const BYTE cSearchTransparency = pSearchTransparencies[ i ];
+ const BYTE cReplaceTransparency = pReplaceTransparencies[ i ];
+
+ pSearchColors[ i ] = Color( cSearchTransparency, cSearchTransparency, cSearchTransparency );
+ pReplaceColors[ i ] = Color( cReplaceTransparency, cReplaceTransparency, cReplaceTransparency );
+ }
+
+ bRet = Bitmap::Replace( pSearchColors, pReplaceColors, nColorCount, pTols ) &&
+ Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ delete[] pSearchColors;
+ delete[] pReplaceColors;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void AlphaMask::ReleaseAccess( BitmapReadAccess* pAccess )
+{
+ if( pAccess )
+ {
+ Bitmap::ReleaseAccess( pAccess );
+ Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
+ }
+}
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
new file mode 100644
index 000000000000..2a1c7e26ad2b
--- /dev/null
+++ b/vcl/source/gdi/animate.cxx
@@ -0,0 +1,992 @@
+/*************************************************************************
+ *
+ * $RCSfile: animate.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_ANIMATE_CXX
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _RTL_CRC_H_
+#include <rtl/crc.h>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_IMPANMVW_HXX
+#include <impanmvw.hxx>
+#endif
+#ifndef _SV_ANIMATE_HXX
+#include <animate.hxx>
+#endif
+
+DBG_NAME( Animation );
+
+// -----------
+// - Defines -
+// -----------
+
+#define MIN_TIMEOUT 2L
+#define INC_TIMEOUT 0L
+
+// -----------
+// - statics -
+// -----------
+
+ULONG Animation::mnAnimCount = 0UL;
+
+// -------------------
+// - AnimationBitmap -
+// -------------------
+
+ULONG AnimationBitmap::GetChecksum() const
+{
+ sal_uInt32 nCrc = aBmpEx.GetChecksum();
+ SVBT32 aBT32;
+
+ LongToSVBT32( aPosPix.X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( aPosPix.Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( aSizePix.Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( aSizePix.Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( (long) nWait, aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( (long) eDisposal, aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( (long) bUserInput, aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ return nCrc;
+}
+
+// -------------
+// - Animation -
+// -------------
+
+Animation::Animation() :
+ mbIsInAnimation ( FALSE ),
+ meCycleMode ( CYCLE_NORMAL ),
+ mnLoopCount ( 0 ),
+ mnLoops ( 0 ),
+ mnPos ( 0 ),
+ mbLoopTerminated ( FALSE ),
+ mbIsWaiting ( FALSE )
+{
+ DBG_CTOR( Animation, NULL );
+ maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) );
+ mpViewList = new List;
+}
+
+// -----------------------------------------------------------------------
+
+Animation::Animation( const Animation& rAnimation ) :
+ maGlobalSize ( rAnimation.maGlobalSize ),
+ maBitmapEx ( rAnimation.maBitmapEx ),
+ meCycleMode ( rAnimation.meCycleMode ),
+ mbIsInAnimation ( FALSE ),
+ mnLoopCount ( rAnimation.mnLoopCount ),
+ mnPos ( rAnimation.mnPos ),
+ mbLoopTerminated ( rAnimation.mbLoopTerminated ),
+ mbIsWaiting ( rAnimation.mbIsWaiting )
+{
+ DBG_CTOR( Animation, NULL );
+
+ for( long i = 0, nCount = rAnimation.maList.Count(); i < nCount; i++ )
+ maList.Insert( new AnimationBitmap( *(AnimationBitmap*) rAnimation.maList.GetObject( i ) ), LIST_APPEND );
+
+ maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) );
+ mpViewList = new List;
+ mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
+}
+
+// -----------------------------------------------------------------------
+
+Animation::~Animation()
+{
+ DBG_DTOR( Animation, NULL );
+
+ if( mbIsInAnimation )
+ Stop();
+
+ for( void* pStepBmp = maList.First(); pStepBmp; pStepBmp = maList.Next() )
+ delete (AnimationBitmap*) pStepBmp;
+
+ for( void* pView = mpViewList->First(); pView; pView = mpViewList->Next() )
+ delete (ImplAnimView*) pView;
+
+ delete mpViewList;
+}
+
+// -----------------------------------------------------------------------
+
+Animation& Animation::operator=( const Animation& rAnimation )
+{
+ Clear();
+
+ for( long i = 0, nCount = rAnimation.maList.Count(); i < nCount; i++ )
+ maList.Insert( new AnimationBitmap( *(AnimationBitmap*) rAnimation.maList.GetObject( i ) ), LIST_APPEND );
+
+ maGlobalSize = rAnimation.maGlobalSize;
+ maBitmapEx = rAnimation.maBitmapEx;
+ meCycleMode = rAnimation.meCycleMode;
+ mnLoopCount = rAnimation.mnLoopCount;
+ mnPos = rAnimation.mnPos;
+ mbLoopTerminated = rAnimation.mbLoopTerminated;
+ mbIsWaiting = rAnimation.mbIsWaiting;
+ mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::operator==( const Animation& rAnimation ) const
+{
+ const ULONG nCount = maList.Count();
+ BOOL bRet = FALSE;
+
+ if( rAnimation.maList.Count() == nCount &&
+ rAnimation.maBitmapEx == maBitmapEx &&
+ rAnimation.maGlobalSize == maGlobalSize &&
+ rAnimation.meCycleMode == meCycleMode )
+ {
+ bRet = TRUE;
+
+ for( ULONG n = 0; n < nCount; n++ )
+ {
+ if( ( *(AnimationBitmap*) maList.GetObject( n ) ) !=
+ ( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) )
+ {
+ bRet = FALSE;
+ break;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Animation::IsEqual( const Animation& rAnimation ) const
+{
+ const ULONG nCount = maList.Count();
+ BOOL bRet = FALSE;
+
+ if( rAnimation.maList.Count() == nCount &&
+ rAnimation.maBitmapEx.IsEqual( maBitmapEx ) &&
+ rAnimation.maGlobalSize == maGlobalSize &&
+ rAnimation.meCycleMode == meCycleMode )
+ {
+ for( ULONG n = 0; ( n < nCount ) && !bRet; n++ )
+ if( ( (AnimationBitmap*) maList.GetObject( n ) )->IsEqual( *(AnimationBitmap*) rAnimation.maList.GetObject( n ) ) )
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Animation::IsEmpty() const
+{
+ return( maBitmapEx.IsEmpty() && !maList.Count() );
+}
+
+// ------------------------------------------------------------------
+
+void Animation::SetEmpty()
+{
+ maTimer.Stop();
+ mbIsInAnimation = FALSE;
+ maGlobalSize = Size();
+ maBitmapEx.SetEmpty();
+
+ for( void* pStepBmp = maList.First(); pStepBmp; pStepBmp = maList.Next() )
+ delete (AnimationBitmap*) pStepBmp;
+ maList.Clear();
+
+ for( void* pView = mpViewList->First(); pView; pView = mpViewList->Next() )
+ delete (ImplAnimView*) pView;
+ mpViewList->Clear();
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::Clear()
+{
+ SetEmpty();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::IsTransparent() const
+{
+ Point aPoint;
+ Rectangle aRect( aPoint, maGlobalSize );
+ BOOL bRet = FALSE;
+
+ // Falls irgendein 'kleines' Bildchen durch den Hintergrund
+ // ersetzt werden soll, muessen wir 'transparent' sein, um
+ // richtig dargestellt zu werden, da die Appl. aus Optimierungsgruenden
+ // kein Invalidate auf nicht-transp. Grafiken ausfuehren
+ for( long i = 0, nCount = maList.Count(); i < nCount; i++ )
+ {
+ const AnimationBitmap* pAnimBmp = (AnimationBitmap*) maList.GetObject( i );
+
+ if( DISPOSE_BACK == pAnimBmp->eDisposal && Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect )
+ {
+ bRet = TRUE;
+ break;
+ }
+ }
+
+ if( !bRet )
+ bRet = maBitmapEx.IsTransparent();
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Animation::GetSizeBytes() const
+{
+ ULONG nSizeBytes = GetBitmapEx().GetSizeBytes();
+
+ for( long i = 0, nCount = maList.Count(); i < nCount; i++ )
+ {
+ const AnimationBitmap* pAnimBmp = (AnimationBitmap*) maList.GetObject( i );
+ nSizeBytes += pAnimBmp->aBmpEx.GetSizeBytes();
+ }
+
+ return nSizeBytes;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Animation::GetChecksum() const
+{
+ SVBT32 aBT32;
+ sal_uInt32 nCrc = GetBitmapEx().GetChecksum();
+
+ LongToSVBT32( maList.Count(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( maGlobalSize.Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( maGlobalSize.Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( (long) meCycleMode, aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ for( long i = 0, nCount = maList.Count(); i < nCount; i++ )
+ {
+ LongToSVBT32( ( (AnimationBitmap*) maList.GetObject( i ) )->GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+
+ return nCrc;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Start( OutputDevice* pOut, const Point& rDestPt, long nExtraData,
+ OutputDevice* pFirstFrameOutDev )
+{
+ return Start( pOut, rDestPt, pOut->PixelToLogic( maGlobalSize ), nExtraData, pFirstFrameOutDev );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Start( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz, long nExtraData,
+ OutputDevice* pFirstFrameOutDev )
+{
+ BOOL bRet = FALSE;
+
+ if( maList.Count() )
+ {
+ if( ( pOut->GetOutDevType() == OUTDEV_WINDOW ) && !mbLoopTerminated &&
+ ( ANIMATION_TIMEOUT_ON_CLICK != ( (AnimationBitmap*) maList.GetObject( mnPos ) )->nWait ) )
+ {
+ ImplAnimView* pView;
+ ImplAnimView* pMatch = NULL;
+
+ for( pView = (ImplAnimView*) mpViewList->First(); pView; pView = (ImplAnimView*) mpViewList->Next() )
+ {
+ if( pView->ImplMatches( pOut, nExtraData ) )
+ {
+ if( pView->ImplGetOutPos() == rDestPt &&
+ pView->ImplGetOutSizePix() == pOut->LogicToPixel( rDestSz ) )
+ {
+ pView->ImplRepaint();
+ pMatch = pView;
+ }
+ else
+ {
+ delete (ImplAnimView*) mpViewList->Remove( pView );
+ pView = NULL;
+ }
+
+ break;
+ }
+ }
+
+ if( !mpViewList->Count() )
+ {
+ maTimer.Stop();
+ mbIsInAnimation = FALSE;
+ mnPos = 0UL;
+ }
+
+ if( !pMatch )
+ mpViewList->Insert( new ImplAnimView( this, pOut, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev ), LIST_APPEND );
+
+ if( !mbIsInAnimation )
+ {
+ ImplRestartTimer( ( (AnimationBitmap*) maList.GetObject( mnPos ) )->nWait );
+ mbIsInAnimation = TRUE;
+ }
+ }
+ else
+ Draw( pOut, rDestPt, rDestSz );
+
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::Stop( OutputDevice* pOut, long nExtraData )
+{
+ ImplAnimView* pView = (ImplAnimView*) mpViewList->First();
+
+ while( pView )
+ {
+ if( pView->ImplMatches( pOut, nExtraData ) )
+ {
+ delete (ImplAnimView*) mpViewList->Remove( pView );
+ pView = (ImplAnimView*) mpViewList->GetCurObject();
+ }
+ else
+ pView = (ImplAnimView*) mpViewList->Next();
+ }
+
+ if( !mpViewList->Count() )
+ {
+ maTimer.Stop();
+ mbIsInAnimation = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::Draw( OutputDevice* pOut, const Point& rDestPt ) const
+{
+ Draw( pOut, rDestPt, pOut->PixelToLogic( maGlobalSize ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::Draw( OutputDevice* pOut, const Point& rDestPt, const Size& rDestSz ) const
+{
+ const ULONG nCount = maList.Count();
+
+ if( nCount )
+ {
+ AnimationBitmap* pObj = (AnimationBitmap*) maList.GetObject( Min( mnPos, (long) nCount - 1L ) );
+
+ if( pOut->GetConnectMetaFile() || ( pOut->GetOutDevType() == OUTDEV_PRINTER ) )
+ ( (AnimationBitmap*) maList.GetObject( 0 ) )->aBmpEx.Draw( pOut, rDestPt, rDestSz );
+ else if( ANIMATION_TIMEOUT_ON_CLICK == pObj->nWait )
+ pObj->aBmpEx.Draw( pOut, rDestPt, rDestSz );
+ else
+ {
+ const ULONG nOldPos = mnPos;
+ ( (Animation*) this )->mnPos = mbLoopTerminated ? ( nCount - 1UL ) : mnPos;
+ delete new ImplAnimView( (Animation*) this, pOut, rDestPt, rDestSz, 0 );
+ ( (Animation*) this )->mnPos = nOldPos;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::ImplRestartTimer( ULONG nTimeout )
+{
+#ifdef REMOTE_APPSERVER
+ nTimeout = nTimeout > 40 ? nTimeout : 40;
+#endif
+ maTimer.SetTimeout( Max( nTimeout, MIN_TIMEOUT + ( mnAnimCount - 1 ) * INC_TIMEOUT ) * 10L );
+ maTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, pTimer )
+{
+ const ULONG nAnimCount = maList.Count();
+
+ if( nAnimCount )
+ {
+ ImplAnimView* pView;
+ BOOL bGlobalPause = TRUE;
+
+ if( maNotifyLink.IsSet() )
+ {
+ AInfo* pAInfo;
+
+ // create AInfo-List
+ for( pView = (ImplAnimView*) mpViewList->First(); pView; pView = (ImplAnimView*) mpViewList->Next() )
+ maAInfoList.Insert( pView->ImplCreateAInfo() );
+
+ maNotifyLink.Call( this );
+
+ // set view state from AInfo structure
+ for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() )
+ {
+ if( !pAInfo->pViewData )
+ {
+ pView = new ImplAnimView( this, pAInfo->pOutDev,
+ pAInfo->aStartOrg, pAInfo->aStartSize, pAInfo->nExtraData );
+
+ mpViewList->Insert( pView, LIST_APPEND );
+ }
+ else
+ pView = (ImplAnimView*) pAInfo->pViewData;
+
+ pView->ImplPause( pAInfo->bPause );
+ pView->ImplSetMarked( TRUE );
+ }
+
+ // delete AInfo structures
+ for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() )
+ delete (AInfo*) pAInfo;
+ maAInfoList.Clear();
+
+ // delete all unmarked views and reset marked state
+ pView = (ImplAnimView*) mpViewList->First();
+ while( pView )
+ {
+ if( !pView->ImplIsMarked() )
+ {
+ delete (ImplAnimView*) mpViewList->Remove( pView );
+ pView = (ImplAnimView*) mpViewList->GetCurObject();
+ }
+ else
+ {
+ if( !pView->ImplIsPause() )
+ bGlobalPause = FALSE;
+
+ pView->ImplSetMarked( FALSE );
+ pView = (ImplAnimView*) mpViewList->Next();
+ }
+ }
+ }
+ else
+ bGlobalPause = FALSE;
+
+ if( !mpViewList->Count() )
+ Stop();
+ else if( bGlobalPause )
+ ImplRestartTimer( 10 );
+ else
+ {
+ AnimationBitmap* pStepBmp = (AnimationBitmap*) maList.GetObject( ++mnPos );
+
+ if( !pStepBmp )
+ {
+ if( mnLoops == 1 )
+ {
+ Stop();
+ mbLoopTerminated = TRUE;
+ mnPos = nAnimCount - 1UL;
+ maBitmapEx = ( (AnimationBitmap*) maList.GetObject( mnPos ) )->aBmpEx;
+ return 0L;
+ }
+ else
+ {
+ if( mnLoops )
+ mnLoops--;
+
+ mnPos = 0;
+ pStepBmp = (AnimationBitmap*) maList.GetObject( mnPos );
+ }
+ }
+
+ // Paint all views; after painting check, if view is
+ // marked; in this case remove view, because area of output
+ // lies out of display area of window; mark state is
+ // set from view itself
+ pView = (ImplAnimView*) mpViewList->First();
+ while( pView )
+ {
+ pView->ImplDraw( mnPos );
+
+ if( pView->ImplIsMarked() )
+ {
+ delete (ImplAnimView*) mpViewList->Remove( pView );
+ pView = (ImplAnimView*) mpViewList->GetCurObject();
+ }
+ else
+ pView = (ImplAnimView*) mpViewList->Next();
+ }
+
+ // stop or restart timer
+ if( !mpViewList->Count() )
+ Stop();
+ else
+ ImplRestartTimer( pStepBmp->nWait );
+ }
+ }
+ else
+ Stop();
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Insert( const AnimationBitmap& rStepBmp )
+{
+ BOOL bRet = FALSE;
+
+ if( !IsInAnimation() )
+ {
+ Point aPoint;
+ Rectangle aGlobalRect( aPoint, maGlobalSize );
+
+ maGlobalSize = aGlobalRect.Union( Rectangle( rStepBmp.aPosPix, rStepBmp.aSizePix ) ).GetSize();
+ maList.Insert( new AnimationBitmap( rStepBmp ), LIST_APPEND );
+
+ // zunaechst nehmen wir die erste BitmapEx als Ersatz-BitmapEx
+ if( maList.Count() == 1 )
+ maBitmapEx = rStepBmp.aBmpEx;
+
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+const AnimationBitmap& Animation::Get( USHORT nAnimation ) const
+{
+ DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" );
+ return *(AnimationBitmap*) maList.GetObject( nAnimation );
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::Replace( const AnimationBitmap& rNewAnimationBitmap, USHORT nAnimation )
+{
+ DBG_ASSERT( ( nAnimation < maList.Count() ), "No object at this position" );
+
+ delete (AnimationBitmap*) maList.Replace( new AnimationBitmap( rNewAnimationBitmap ), nAnimation );
+
+ // Falls wir an erster Stelle einfuegen,
+ // muessen wir natuerlich auch,
+ // auch die Ersatzdarstellungs-BitmapEx
+ // aktualisieren;
+ if ( ( !nAnimation && ( !mbLoopTerminated || ( maList.Count() == 1 ) ) ) ||
+ ( ( nAnimation == maList.Count() - 1 ) && mbLoopTerminated ) )
+ {
+ maBitmapEx = rNewAnimationBitmap.aBmpEx;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::SetLoopCount( const ULONG nLoopCount )
+{
+ mnLoopCount = nLoopCount;
+ ResetLoopCount();
+}
+
+// -----------------------------------------------------------------------
+
+void Animation::ResetLoopCount()
+{
+ mnLoops = mnLoopCount;
+ mbLoopTerminated = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Convert( BmpConversion eConversion )
+{
+ DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" );
+
+ BOOL bRet;
+
+ if( !IsInAnimation() && maList.Count() )
+ {
+ bRet = TRUE;
+
+ for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() )
+ bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Convert( eConversion );
+
+ maBitmapEx.Convert( eConversion );
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::ReduceColors( USHORT nNewColorCount, BmpReduce eReduce )
+{
+ DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" );
+
+ BOOL bRet;
+
+ if( !IsInAnimation() && maList.Count() )
+ {
+ bRet = TRUE;
+
+ for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() )
+ bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.ReduceColors( nNewColorCount, eReduce );
+
+ maBitmapEx.ReduceColors( nNewColorCount, eReduce );
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Invert()
+{
+ DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" );
+
+ BOOL bRet;
+
+ if( !IsInAnimation() && maList.Count() )
+ {
+ bRet = TRUE;
+
+ for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() )
+ bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Invert();
+
+ maBitmapEx.Invert();
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Mirror( ULONG nMirrorFlags )
+{
+ DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" );
+
+ BOOL bRet;
+
+ if( !IsInAnimation() && maList.Count() )
+ {
+ bRet = TRUE;
+
+ if( nMirrorFlags )
+ {
+ for( AnimationBitmap* pStepBmp = (AnimationBitmap*) maList.First();
+ pStepBmp && bRet;
+ pStepBmp = (AnimationBitmap*) maList.Next() )
+ {
+ if( ( bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags ) ) == TRUE )
+ {
+ if( nMirrorFlags & BMP_MIRROR_HORZ )
+ pStepBmp->aPosPix.X() = maGlobalSize.Width() - pStepBmp->aPosPix.X() - pStepBmp->aSizePix.Width();
+
+ if( nMirrorFlags & BMP_MIRROR_VERT )
+ pStepBmp->aPosPix.Y() = maGlobalSize.Height() - pStepBmp->aPosPix.Y() - pStepBmp->aSizePix.Height();
+ }
+ }
+
+ maBitmapEx.Mirror( nMirrorFlags );
+ }
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Dither( ULONG nDitherFlags, const BitmapPalette* pDitherPal )
+{
+ DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" );
+
+ BOOL bRet;
+
+ if( !IsInAnimation() && maList.Count() )
+ {
+ bRet = TRUE;
+
+ for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() )
+ bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Dither( nDitherFlags, pDitherPal );
+
+ maBitmapEx.Dither( nDitherFlags, pDitherPal );
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Adjust( short nLuminancePercent, short nContrastPercent,
+ short nChannelRPercent, short nChannelGPercent, short nChannelBPercent,
+ double fGamma, BOOL bInvert )
+{
+ DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" );
+
+ BOOL bRet;
+
+ if( !IsInAnimation() && maList.Count() )
+ {
+ bRet = TRUE;
+
+ for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() )
+ {
+ bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Adjust( nLuminancePercent, nContrastPercent,
+ nChannelRPercent, nChannelGPercent, nChannelBPercent,
+ fGamma, bInvert );
+ }
+
+ maBitmapEx.Adjust( nLuminancePercent, nContrastPercent,
+ nChannelRPercent, nChannelGPercent, nChannelBPercent,
+ fGamma, bInvert );
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ DBG_ASSERT( !IsInAnimation(), "Animation modified while it is animated" );
+
+ BOOL bRet;
+
+ if( !IsInAnimation() && maList.Count() )
+ {
+ bRet = TRUE;
+
+ for( void* pStepBmp = maList.First(); pStepBmp && bRet; pStepBmp = maList.Next() )
+ bRet = ( ( AnimationBitmap*) pStepBmp )->aBmpEx.Filter( eFilter, pFilterParam, pProgress );
+
+ maBitmapEx.Filter( eFilter, pFilterParam, pProgress );
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation )
+{
+ const USHORT nCount = rAnimation.Count();
+
+ if( nCount )
+ {
+ const ByteString aDummyStr;
+ const UINT32 nDummy32 = 0UL;
+
+ // Falls keine BitmapEx gesetzt wurde, schreiben wir
+ // einfach die erste Bitmap der Animation
+ if( !rAnimation.GetBitmapEx().GetBitmap() )
+ rOStm << rAnimation.Get( 0 ).aBmpEx;
+ else
+ rOStm << rAnimation.GetBitmapEx();
+
+ // Kennung schreiben ( SDANIMA1 )
+ rOStm << (UINT32) 0x5344414e << (UINT32) 0x494d4931;
+
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ const AnimationBitmap& rAnimBmp = rAnimation.Get( i );
+ const UINT16 nRest = nCount - i - 1;
+
+ // AnimationBitmap schreiben
+ rOStm << rAnimBmp.aBmpEx;
+ rOStm << rAnimBmp.aPosPix;
+ rOStm << rAnimBmp.aSizePix;
+ rOStm << rAnimation.maGlobalSize;
+ rOStm << (UINT16) ( ( ANIMATION_TIMEOUT_ON_CLICK == rAnimBmp.nWait ) ? 65535 : rAnimBmp.nWait );
+ rOStm << (UINT16) rAnimBmp.eDisposal;
+ rOStm << (BYTE) rAnimBmp.bUserInput;
+ rOStm << (UINT32) rAnimation.mnLoopCount;
+ rOStm << nDummy32; // unbenutzt
+ rOStm << nDummy32; // unbenutzt
+ rOStm << nDummy32; // unbenutzt
+ rOStm << aDummyStr; // unbenutzt
+ rOStm << nRest; // Anzahl der Strukturen, die noch _folgen_
+ }
+ }
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, Animation& rAnimation )
+{
+ Bitmap aBmp;
+ ULONG nStmPos = rIStm.Tell();
+ UINT32 nAnimMagic1, nAnimMagic2;
+ USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ BOOL bReadAnimations = FALSE;
+
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ nStmPos = rIStm.Tell();
+ rIStm >> nAnimMagic1 >> nAnimMagic2;
+
+ rAnimation.Clear();
+
+ // Wenn die BitmapEx am Anfang schon gelesen
+ // wurde ( von Graphic ), koennen wir direkt die Animationsbitmaps einlesen
+ if( ( nAnimMagic1 == 0x5344414e ) && ( nAnimMagic2 == 0x494d4931 ) && !rIStm.GetError() )
+ bReadAnimations = TRUE;
+ // ansonsten versuchen wir erstmal die Bitmap(-Ex) zu lesen
+ else
+ {
+ rIStm.Seek( nStmPos );
+ rIStm >> rAnimation.maBitmapEx;
+ nStmPos = rIStm.Tell();
+ rIStm >> nAnimMagic1 >> nAnimMagic2;
+
+ if( ( nAnimMagic1 == 0x5344414e ) && ( nAnimMagic2 == 0x494d4931 ) && !rIStm.GetError() )
+ bReadAnimations = TRUE;
+ else
+ rIStm.Seek( nStmPos );
+ }
+
+ // ggf. Animationsbitmaps lesen
+ if( bReadAnimations )
+ {
+ AnimationBitmap aAnimBmp;
+ BitmapEx aBmpEx;
+ ByteString aDummyStr;
+ Point aPoint;
+ Size aSize;
+ UINT32 nTmp32;
+ UINT16 nTmp16;
+ BYTE cTmp;
+
+ do
+ {
+ rIStm >> aAnimBmp.aBmpEx;
+ rIStm >> aAnimBmp.aPosPix;
+ rIStm >> aAnimBmp.aSizePix;
+ rIStm >> rAnimation.maGlobalSize;
+ rIStm >> nTmp16; aAnimBmp.nWait = ( ( 65535 == nTmp16 ) ? ANIMATION_TIMEOUT_ON_CLICK : nTmp16 );
+ rIStm >> nTmp16; aAnimBmp.eDisposal = ( Disposal) nTmp16;
+ rIStm >> cTmp; aAnimBmp.bUserInput = (BOOL) cTmp;
+ rIStm >> nTmp32; rAnimation.mnLoopCount = (USHORT) nTmp32;
+ rIStm >> nTmp32; // unbenutzt
+ rIStm >> nTmp32; // unbenutzt
+ rIStm >> nTmp32; // unbenutzt
+ rIStm >> aDummyStr; // unbenutzt
+ rIStm >> nTmp16; // Rest zu lesen
+
+ rAnimation.Insert( aAnimBmp );
+ }
+ while( nTmp16 && !rIStm.GetError() );
+
+ rAnimation.ResetLoopCount();
+ }
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+
+ return rIStm;
+}
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
new file mode 100644
index 000000000000..d5016647cfca
--- /dev/null
+++ b/vcl/source/gdi/bitmap.cxx
@@ -0,0 +1,1980 @@
+/*************************************************************************
+ *
+ * $RCSfile: bitmap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BITMAP_CXX
+
+#ifndef _RTL_CRC_H_
+#include <rtl/crc.h>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_IMPBMP_HXX
+#include <impbmp.hxx>
+#endif
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_ALPHA_HXX
+#include <alpha.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+// ------------------------------------------------------------------
+
+Bitmap::Bitmap() :
+ mpImpBmp( NULL )
+{
+}
+
+// ------------------------------------------------------------------
+
+Bitmap::Bitmap( const ResId& rResId ) :
+ mpImpBmp( NULL )
+{
+ ResMgr * pResMgr = NULL;
+
+ ResMgr::GetResourceSkipHeader( rResId.SetRT( RSC_BITMAP ), &pResMgr );
+
+ USHORT nBitmapType;
+ USHORT nBitmapId;
+ nBitmapType = pResMgr->ReadShort();
+ nBitmapId = pResMgr->ReadShort();
+
+ SvStream* pBmpStream = pResMgr->pImpRes->GetBitmapStream( nBitmapId );
+ if( pBmpStream )
+ *pBmpStream >> *this;
+ // pop filename
+ String aDummy = pResMgr->ReadString();
+}
+
+// ------------------------------------------------------------------
+
+Bitmap::Bitmap( const Bitmap& rBitmap ) :
+ maPrefMapMode ( rBitmap.maPrefMapMode ),
+ maPrefSize ( rBitmap.maPrefSize )
+{
+ mpImpBmp = rBitmap.mpImpBmp;
+
+ if ( mpImpBmp )
+ mpImpBmp->ImplIncRefCount();
+}
+
+// ------------------------------------------------------------------
+
+Bitmap::Bitmap( const Size& rSizePixel, USHORT nBitCount, const BitmapPalette* pPal )
+{
+ if( rSizePixel.Width() && rSizePixel.Height() )
+ {
+ BitmapPalette aPal;
+ BitmapPalette* pRealPal = NULL;
+
+ if( nBitCount <= 8 )
+ {
+ if( !pPal )
+ {
+ if( 1 == nBitCount )
+ {
+ aPal.SetEntryCount( 2 );
+ aPal[ 0 ] = Color( COL_BLACK );
+ aPal[ 1 ] = Color( COL_WHITE );
+ }
+ else if( ( 4 == nBitCount ) || ( 8 == nBitCount ) )
+ {
+ aPal.SetEntryCount( 1 << nBitCount );
+ aPal[ 0 ] = Color( COL_BLACK );
+ aPal[ 1 ] = Color( COL_BLUE );
+ aPal[ 2 ] = Color( COL_GREEN );
+ aPal[ 3 ] = Color( COL_CYAN );
+ aPal[ 4 ] = Color( COL_RED );
+ aPal[ 5 ] = Color( COL_MAGENTA );
+ aPal[ 6 ] = Color( COL_BROWN );
+ aPal[ 7 ] = Color( COL_GRAY );
+ aPal[ 8 ] = Color( COL_LIGHTGRAY );
+ aPal[ 9 ] = Color( COL_LIGHTBLUE );
+ aPal[ 10 ] = Color( COL_LIGHTGREEN );
+ aPal[ 11 ] = Color( COL_LIGHTCYAN );
+ aPal[ 12 ] = Color( COL_LIGHTRED );
+ aPal[ 13 ] = Color( COL_LIGHTMAGENTA );
+ aPal[ 14 ] = Color( COL_YELLOW );
+ aPal[ 15 ] = Color( COL_WHITE );
+
+ // Dither-Palette erzeugen
+ if( 8 == nBitCount )
+ {
+ USHORT nActCol = 16;
+
+ for( USHORT nB = 0; nB < 256; nB += 51 )
+ for( USHORT nG = 0; nG < 256; nG += 51 )
+ for( USHORT nR = 0; nR < 256; nR += 51 )
+ aPal[ nActCol++ ] = BitmapColor( (BYTE) nR, (BYTE) nG, (BYTE) nB );
+
+ // Standard-Office-Farbe setzen
+ aPal[ nActCol++ ] = BitmapColor( 0, 184, 255 );
+ }
+ }
+ }
+ else
+ pRealPal = (BitmapPalette*) pPal;
+ }
+
+ mpImpBmp = new ImpBitmap;
+ mpImpBmp->ImplCreate( rSizePixel, nBitCount, pRealPal ? *pRealPal : aPal );
+ }
+ else
+ mpImpBmp = NULL;
+}
+
+// ------------------------------------------------------------------
+
+Bitmap::~Bitmap()
+{
+ ImplReleaseRef();
+}
+
+// ------------------------------------------------------------------
+
+const BitmapPalette& Bitmap::GetGreyPalette( USHORT nEntries )
+{
+ static BitmapPalette aGreyPalette2;
+ static BitmapPalette aGreyPalette4;
+ static BitmapPalette aGreyPalette16;
+ static BitmapPalette aGreyPalette256;
+
+ // create greyscale palette with 2, 4, 16 or 256 entries
+ if( 2 == nEntries || 4 == nEntries || 16 == nEntries || 256 == nEntries )
+ {
+ if( 2 == nEntries )
+ {
+ if( !aGreyPalette2.GetEntryCount() )
+ {
+ aGreyPalette2.SetEntryCount( 2 );
+ aGreyPalette2[ 0 ] = BitmapColor( 0, 0, 0 );
+ aGreyPalette2[ 1 ] = BitmapColor( 255, 255, 255 );
+ }
+
+ return aGreyPalette2;
+ }
+ else if( 4 == nEntries )
+ {
+ if( !aGreyPalette4.GetEntryCount() )
+ {
+ aGreyPalette4.SetEntryCount( 4 );
+ aGreyPalette4[ 0 ] = BitmapColor( 0, 0, 0 );
+ aGreyPalette4[ 1 ] = BitmapColor( 85, 85, 85 );
+ aGreyPalette4[ 2 ] = BitmapColor( 170, 170, 170 );
+ aGreyPalette4[ 3 ] = BitmapColor( 255, 255, 255 );
+ }
+
+ return aGreyPalette4;
+ }
+ else if( 16 == nEntries )
+ {
+ if( !aGreyPalette16.GetEntryCount() )
+ {
+ BYTE cGrey = 0, cGreyInc = 17;
+
+ aGreyPalette16.SetEntryCount( 16 );
+
+ for( USHORT i = 0; i < 16; i++, cGrey += cGreyInc )
+ aGreyPalette16[ i ] = BitmapColor( cGrey, cGrey, cGrey );
+ }
+
+ return aGreyPalette16;
+ }
+ else
+ {
+ if( !aGreyPalette256.GetEntryCount() )
+ {
+ aGreyPalette256.SetEntryCount( 256 );
+
+ for( USHORT i = 0; i < 256; i++ )
+ aGreyPalette256[ i ] = BitmapColor( (BYTE) i, (BYTE) i, (BYTE) i );
+ }
+
+ return aGreyPalette256;
+ }
+ }
+ else
+ {
+ DBG_ERROR( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" );
+ return aGreyPalette2;
+ }
+}
+
+// ------------------------------------------------------------------
+
+Bitmap& Bitmap::operator=( const Bitmap& rBitmap )
+{
+ maPrefSize = rBitmap.maPrefSize;
+ maPrefMapMode = rBitmap.maPrefMapMode;
+
+ if ( rBitmap.mpImpBmp )
+ rBitmap.mpImpBmp->ImplIncRefCount();
+
+ ImplReleaseRef();
+ mpImpBmp = rBitmap.mpImpBmp;
+
+ return *this;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::IsEqual( const Bitmap& rBmp ) const
+{
+ return( IsSameInstance( rBmp ) ||
+ ( rBmp.GetSizePixel() == GetSizePixel() &&
+ rBmp.GetBitCount() == GetBitCount() &&
+ rBmp.GetChecksum() == GetChecksum() ) );
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::SetEmpty()
+{
+ maPrefMapMode = MapMode();
+ maPrefSize = Size();
+
+ ImplReleaseRef();
+ mpImpBmp = NULL;
+}
+
+// ------------------------------------------------------------------
+
+Size Bitmap::GetSizePixel() const
+{
+ return( mpImpBmp ? mpImpBmp->ImplGetSize() : Size() );
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::SetSizePixel( const Size& rNewSize )
+{
+ Scale( rNewSize );
+}
+
+// ------------------------------------------------------------------
+
+USHORT Bitmap::GetBitCount() const
+{
+ return( mpImpBmp ? mpImpBmp->ImplGetBitCount() : 0 );
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::HasGreyPalette() const
+{
+ const USHORT nBitCount = GetBitCount();
+ BOOL bRet = FALSE;
+
+ if( 1 == nBitCount )
+ bRet = TRUE;
+ else if( 4 == nBitCount || 8 == nBitCount )
+ {
+ BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess();
+
+ if( pRAcc )
+ {
+ if( pRAcc->HasPalette() && ( (BitmapPalette&) pRAcc->GetPalette() == GetGreyPalette( 1 << nBitCount ) ) )
+ bRet = TRUE;
+
+ ( (Bitmap*) this )->ReleaseAccess( pRAcc );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+ULONG Bitmap::GetChecksum() const
+{
+ ULONG nRet = 0UL;
+
+ if( mpImpBmp )
+ {
+ nRet = mpImpBmp->ImplGetChecksum();
+
+ if( !nRet )
+ {
+ BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess();
+
+ if( pRAcc && pRAcc->Width() && pRAcc->Height() )
+ {
+ sal_uInt32 nCrc = 0;
+ SVBT32 aBT32;
+
+ pRAcc->ImplZeroInitUnusedBits();
+
+ LongToSVBT32( pRAcc->Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pRAcc->Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pRAcc->GetBitCount(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pRAcc->GetColorMask().GetRedMask(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pRAcc->GetColorMask().GetGreenMask(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pRAcc->GetColorMask().GetBlueMask(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ if( pRAcc->HasPalette() )
+ {
+ nCrc = rtl_crc32( nCrc, pRAcc->GetPalette().ImplGetColorBuffer(),
+ pRAcc->GetPaletteEntryCount() * sizeof( BitmapColor ) );
+ }
+
+ nCrc = rtl_crc32( nCrc, pRAcc->GetBuffer(), pRAcc->GetScanlineSize() * pRAcc->Height() );
+
+ ( (Bitmap*) this )->ReleaseAccess( pRAcc );
+
+ mpImpBmp->ImplSetChecksum( nRet = nCrc );
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplReleaseRef()
+{
+ if( mpImpBmp )
+ {
+ if( mpImpBmp->ImplGetRefCount() > 1UL )
+ mpImpBmp->ImplDecRefCount();
+ else
+ {
+ delete mpImpBmp;
+ mpImpBmp = NULL;
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplMakeUnique()
+{
+ if( mpImpBmp && mpImpBmp->ImplGetRefCount() > 1UL )
+ {
+ ImpBitmap* pOldImpBmp = mpImpBmp;
+
+ pOldImpBmp->ImplDecRefCount();
+
+ mpImpBmp = new ImpBitmap;
+ mpImpBmp->ImplCreate( *pOldImpBmp );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplAssignWithSize( const Bitmap& rBitmap )
+{
+ const Size aOldSizePix( GetSizePixel() );
+ const Size aNewSizePix( rBitmap.GetSizePixel() );
+ const MapMode aOldMapMode( maPrefMapMode );
+ Size aNewPrefSize;
+
+ if( ( aOldSizePix != aNewSizePix ) && aOldSizePix.Width() && aOldSizePix.Height() )
+ {
+ aNewPrefSize.Width() = FRound( maPrefSize.Width() * aNewSizePix.Width() / aOldSizePix.Width() );
+ aNewPrefSize.Height() = FRound( maPrefSize.Height() * aNewSizePix.Height() / aOldSizePix.Height() );
+ }
+ else
+ aNewPrefSize = maPrefSize;
+
+ *this = rBitmap;
+
+ maPrefSize = aNewPrefSize;
+ maPrefMapMode = aOldMapMode;
+}
+
+// ------------------------------------------------------------------
+
+ImpBitmap* Bitmap::ImplGetImpBitmap() const
+{
+ return mpImpBmp;
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplSetImpBitmap( ImpBitmap* pImpBmp )
+{
+ if( pImpBmp != mpImpBmp )
+ {
+ ImplReleaseRef();
+ mpImpBmp = pImpBmp;
+ }
+}
+
+// ------------------------------------------------------------------
+
+BitmapReadAccess* Bitmap::AcquireReadAccess()
+{
+#ifdef REMOTE_APPSERVER
+ BOOL bGottenFromServer = FALSE;
+ if( mpImpBmp && mpImpBmp->ImplIsGetPrepared() )
+ mpImpBmp->ImplResolveGet(), bGottenFromServer = TRUE;
+#endif
+
+ BitmapReadAccess* pReadAccess = new BitmapReadAccess( *this );
+
+ if( !*pReadAccess )
+ {
+ delete pReadAccess;
+ pReadAccess = NULL;
+ }
+
+#ifdef REMOTE_APPSERVER
+ if( pReadAccess && mpImpBmp && bGottenFromServer )
+ mpImpBmp->ImplReleaseRemoteBmp();
+#endif
+
+ return pReadAccess;
+}
+
+// ------------------------------------------------------------------
+
+BitmapWriteAccess* Bitmap::AcquireWriteAccess()
+{
+#ifdef REMOTE_APPSERVER
+ if( mpImpBmp && mpImpBmp->ImplIsGetPrepared() )
+ mpImpBmp->ImplResolveGet();
+#endif
+
+ BitmapWriteAccess* pWriteAccess = new BitmapWriteAccess( *this );
+
+ if( !*pWriteAccess )
+ {
+ delete pWriteAccess;
+ pWriteAccess = NULL;
+ }
+
+#ifdef REMOTE_APPSERVER
+ if( pWriteAccess && mpImpBmp )
+ mpImpBmp->ImplReleaseRemoteBmp();
+#endif
+
+ return pWriteAccess;
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ReleaseAccess( BitmapReadAccess* pBitmapAccess )
+{
+ delete pBitmapAccess;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Erase( const Color& rFillColor )
+{
+ BitmapWriteAccess* pWriteAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pWriteAcc )
+ {
+ const ULONG nFormat = pWriteAcc->GetScanlineFormat();
+ BYTE cIndex;
+ BOOL bFast;
+
+ switch( nFormat )
+ {
+ case( BMP_FORMAT_1BIT_MSB_PAL ):
+ case( BMP_FORMAT_1BIT_LSB_PAL ):
+ {
+ cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor );
+ cIndex = ( cIndex ? 255 : 0 );
+ bFast = TRUE;
+ }
+ break;
+
+ case( BMP_FORMAT_4BIT_MSN_PAL ):
+ case( BMP_FORMAT_4BIT_LSN_PAL ):
+ {
+ cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor );
+ cIndex = cIndex | ( cIndex << 4 );
+ bFast = TRUE;
+ }
+ break;
+
+ case( BMP_FORMAT_8BIT_PAL ):
+ {
+ cIndex = (BYTE) pWriteAcc->GetBestPaletteIndex( rFillColor );
+ bFast = TRUE;
+ }
+ break;
+
+ case( BMP_FORMAT_24BIT_TC_BGR ):
+ case( BMP_FORMAT_24BIT_TC_RGB ):
+ {
+ if( ( rFillColor.GetRed() == rFillColor.GetGreen() ) &&
+ ( rFillColor.GetRed() == rFillColor.GetBlue() ) )
+ {
+ cIndex = rFillColor.GetRed();
+ bFast = TRUE;
+ }
+ else
+ bFast = FALSE;
+ }
+ break;
+
+ default:
+ bFast = FALSE;
+ break;
+ }
+
+ if( bFast )
+ {
+ const ULONG nBufSize = pWriteAcc->GetScanlineSize() * pWriteAcc->Height();
+ HMEMSET( pWriteAcc->GetBuffer(), cIndex, nBufSize );
+ }
+ else
+ {
+ Point aTmpPoint;
+ const Rectangle aRect( aTmpPoint, Size( pWriteAcc->Width(), pWriteAcc->Height() ) );
+ pWriteAcc->SetFillColor( rFillColor );
+ pWriteAcc->FillRect( aRect );
+ }
+
+ ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Invert()
+{
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pAcc )
+ {
+ if( pAcc->HasPalette() )
+ {
+ BitmapPalette aBmpPal( pAcc->GetPalette() );
+ const USHORT nCount = aBmpPal.GetEntryCount();
+
+ for( USHORT i = 0; i < nCount; i++ )
+ aBmpPal[ i ].Invert();
+
+ pAcc->SetPalette( aBmpPal );
+ }
+ else
+ {
+ const long nWidth = pAcc->Width();
+ const long nHeight = pAcc->Height();
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ for( long nY = 0L; nY < nHeight; nY++ )
+ pAcc->SetPixel( nY, nX, pAcc->GetPixel( nY, nX ).Invert() );
+ }
+
+ ReleaseAccess( pAcc );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Mirror( ULONG nMirrorFlags )
+{
+ BOOL bHorz = ( ( nMirrorFlags & BMP_MIRROR_HORZ ) == BMP_MIRROR_HORZ );
+ BOOL bVert = ( ( nMirrorFlags & BMP_MIRROR_VERT ) == BMP_MIRROR_VERT );
+ BOOL bRet = FALSE;
+
+ if( bHorz && !bVert )
+ {
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ const long nWidth = pAcc->Width();
+ const long nHeight = pAcc->Height();
+ const long nWidth1 = nWidth - 1L;
+ const long nWidth_2 = nWidth >> 1L;
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L, nOther = nWidth1; nX < nWidth_2; nX++, nOther-- )
+ {
+ const BitmapColor aTemp( pAcc->GetPixel( nY, nX ) );
+
+ pAcc->SetPixel( nY, nX, pAcc->GetPixel( nY, nOther ) );
+ pAcc->SetPixel( nY, nOther, aTemp );
+ }
+ }
+
+ ReleaseAccess( pAcc );
+ bRet = TRUE;
+ }
+ }
+ else if( bVert && !bHorz )
+ {
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ const long nScanSize = pAcc->GetScanlineSize();
+ BYTE* pBuffer = new BYTE[ nScanSize ];
+ const long nHeight = pAcc->Height();
+ const long nHeight1 = nHeight - 1L;
+ const long nHeight_2 = nHeight >> 1L;
+
+ for( long nY = 0L, nOther = nHeight1; nY < nHeight_2; nY++, nOther-- )
+ {
+ HMEMCPY( pBuffer, pAcc->GetScanline( nY ), nScanSize );
+ HMEMCPY( pAcc->GetScanline( nY ), pAcc->GetScanline( nOther ), nScanSize );
+ HMEMCPY( pAcc->GetScanline( nOther ), pBuffer, nScanSize );
+ }
+
+ delete[] pBuffer;
+ ReleaseAccess( pAcc );
+ bRet = TRUE;
+ }
+ }
+ else if( bHorz && bVert )
+ {
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ const long nWidth = pAcc->Width();
+ const long nWidth1 = nWidth - 1L;
+ const long nHeight = pAcc->Height();
+ long nHeight_2 = nHeight >> 1;
+
+ for( long nY = 0L, nOtherY = nHeight - 1L; nY < nHeight_2; nY++, nOtherY-- )
+ {
+ for( long nX = 0L, nOtherX = nWidth1; nX < nWidth; nX++, nOtherX-- )
+ {
+ const BitmapColor aTemp( pAcc->GetPixel( nY, nX ) );
+
+ pAcc->SetPixel( nY, nX, pAcc->GetPixel( nOtherY, nOtherX ) );
+ pAcc->SetPixel( nOtherY, nOtherX, aTemp );
+ }
+ }
+
+ // ggf. noch mittlere Zeile horizontal spiegeln
+ if( nHeight & 1 )
+ {
+ for( long nX = 0L, nOtherX = nWidth1, nWidth_2 = nWidth >> 1; nX < nWidth_2; nX++, nOtherX-- )
+ {
+ const BitmapColor aTemp( pAcc->GetPixel( nHeight_2, nX ) );
+ pAcc->SetPixel( nHeight_2, nX, pAcc->GetPixel( nHeight_2, nOtherX ) );
+ pAcc->SetPixel( nHeight_2, nOtherX, aTemp );
+ }
+ }
+
+ ReleaseAccess( pAcc );
+ bRet = TRUE;
+ }
+ }
+ else
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Rotate( long nAngle10, const Color& rFillColor )
+{
+ BOOL bRet = FALSE;
+
+ nAngle10 %= 3600L;
+ nAngle10 = ( nAngle10 < 0L ) ? ( 3599L + nAngle10 ) : nAngle10;
+
+ if( !nAngle10 )
+ bRet = TRUE;
+ else if( 1800L == nAngle10 )
+ bRet = Mirror( BMP_MIRROR_HORZ | BMP_MIRROR_VERT );
+ else
+ {
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ Bitmap aRotatedBmp;
+
+ if( pReadAcc )
+ {
+ const Size aSizePix( GetSizePixel() );
+
+ if( ( 900L == nAngle10 ) || ( 2700L == nAngle10 ) )
+ {
+ const Size aNewSizePix( aSizePix.Height(), aSizePix.Width() );
+ Bitmap aNewBmp( aNewSizePix, GetBitCount(), &pReadAcc->GetPalette() );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nWidth = aSizePix.Width();
+ const long nWidth1 = nWidth - 1L;
+ const long nHeight = aSizePix.Height();
+ const long nHeight1 = nHeight - 1L;
+ const long nNewWidth = aNewSizePix.Width();
+ const long nNewHeight = aNewSizePix.Height();
+
+ if( 900L == nAngle10 )
+ {
+ for( long nY = 0L, nOtherX = nWidth1; nY < nNewHeight; nY++, nOtherX-- )
+ for( long nX = 0L, nOtherY = 0L; nX < nNewWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nOtherY++, nOtherX ) );
+ }
+ else if( 2700L == nAngle10 )
+ {
+ for( long nY = 0L, nOtherX = 0L; nY < nNewHeight; nY++, nOtherX++ )
+ for( long nX = 0L, nOtherY = nHeight1; nX < nNewWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nOtherY--, nOtherX ) );
+ }
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ }
+
+ aRotatedBmp = aNewBmp;
+ }
+ else
+ {
+ Point aTmpPoint;
+ Rectangle aTmpRectangle( aTmpPoint, aSizePix );
+ Polygon aPoly( aTmpRectangle );
+ aPoly.Rotate( aTmpPoint, (USHORT) nAngle10 );
+
+ Rectangle aNewBound( aPoly.GetBoundRect() );
+ const Size aNewSizePix( aNewBound.GetSize() );
+ Bitmap aNewBmp( aNewSizePix, GetBitCount(), &pReadAcc->GetPalette() );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const BitmapColor aFillColor( pWriteAcc->GetBestMatchingColor( rFillColor ) );
+ const double fCosAngle = cos( nAngle10 * F_PI1800 );
+ const double fSinAngle = sin( nAngle10 * F_PI1800 );
+ const double fXMin = aNewBound.Left();
+ const double fYMin = aNewBound.Top();
+ const long nWidth = aSizePix.Width();
+ const long nHeight = aSizePix.Height();
+ const long nNewWidth = aNewSizePix.Width();
+ const long nNewHeight = aNewSizePix.Height();
+ long nX;
+ long nY;
+ long nRotX;
+ long nRotY;
+ long nSinY;
+ long nCosY;
+ long* pCosX = new long[ nNewWidth ];
+ long* pSinX = new long[ nNewWidth ];
+ long* pCosY = new long[ nNewHeight ];
+ long* pSinY = new long[ nNewHeight ];
+
+ for ( nX = 0; nX < nNewWidth; nX++ )
+ {
+ const double fTmp = ( fXMin + nX ) * 64.;
+
+ pCosX[ nX ] = FRound( fCosAngle * fTmp );
+ pSinX[ nX ] = FRound( fSinAngle * fTmp );
+ }
+
+ for ( nY = 0; nY < nNewHeight; nY++ )
+ {
+ const double fTmp = ( fYMin + nY ) * 64.;
+
+ pCosY[ nY ] = FRound( fCosAngle * fTmp );
+ pSinY[ nY ] = FRound( fSinAngle * fTmp );
+ }
+
+ for( nY = 0L; nY < nNewHeight; nY++ )
+ {
+ nSinY = pSinY[ nY ];
+ nCosY = pCosY[ nY ];
+
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ {
+ nRotX = ( pCosX[ nX ] - nSinY ) >> 6;
+ nRotY = ( pSinX[ nX ] + nCosY ) >> 6;
+
+ if ( ( nRotX > -1L ) && ( nRotX < nWidth ) && ( nRotY > -1L ) && ( nRotY < nHeight ) )
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nRotY, nRotX ) );
+ else
+ pWriteAcc->SetPixel( nY, nX, aFillColor );
+ }
+ }
+
+ delete[] pSinX;
+ delete[] pCosX;
+ delete[] pSinY;
+ delete[] pCosY;
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ }
+
+ aRotatedBmp = aNewBmp;
+ }
+
+ ReleaseAccess( pReadAcc );
+ }
+
+ if( ( bRet = !!aRotatedBmp ) == TRUE )
+ ImplAssignWithSize( aRotatedBmp );
+ }
+
+ return bRet;
+};
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Crop( const Rectangle& rRectPixel )
+{
+ const Size aSizePix( GetSizePixel() );
+ Rectangle aRect( rRectPixel );
+ BOOL bRet = FALSE;
+
+ aRect.Intersection( Rectangle( Point(), aSizePix ) );
+
+ if( !aRect.IsEmpty() )
+ {
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+
+ if( pReadAcc )
+ {
+ Point aTmpPoint;
+ const Rectangle aNewRect( aTmpPoint, aRect.GetSize() );
+ Bitmap aNewBmp( aNewRect.GetSize(), GetBitCount(), &pReadAcc->GetPalette() );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nOldX = aRect.Left();
+ const long nOldY = aRect.Top();
+ const long nNewWidth = aNewRect.GetWidth();
+ const long nNewHeight = aNewRect.GetHeight();
+
+ for( long nY = 0, nY2 = nOldY; nY < nNewHeight; nY++, nY2++ )
+ for( long nX = 0, nX2 = nOldX; nX < nNewWidth; nX++, nX2++ )
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nY2, nX2 ) );
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ ImplAssignWithSize( aNewBmp );
+ }
+ }
+
+ return bRet;
+};
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::CopyPixel( const Rectangle& rRectDst,
+ const Rectangle& rRectSrc, const Bitmap* pBmpSrc )
+{
+ const Size aSizePix( GetSizePixel() );
+ Rectangle aRectDst( rRectDst );
+ BOOL bRet = FALSE;
+
+ aRectDst.Intersection( Rectangle( Point(), aSizePix ) );
+
+ if( !aRectDst.IsEmpty() )
+ {
+ if( pBmpSrc && ( *pBmpSrc != *this ) )
+ {
+ Bitmap* pSrc = (Bitmap*) pBmpSrc;
+ const Size aCopySizePix( pSrc->GetSizePixel() );
+ Rectangle aRectSrc( rRectSrc );
+ const USHORT nSrcBitCount = pBmpSrc->GetBitCount();
+ const USHORT nDstBitCount = GetBitCount();
+
+ if( nSrcBitCount > nDstBitCount )
+ {
+ long nNextIndex = 0L;
+
+ if( ( nSrcBitCount == 24 ) && ( nDstBitCount < 24 ) )
+ Convert( BMP_CONVERSION_24BIT );
+ else if( ( nSrcBitCount == 8 ) && ( nDstBitCount < 8 ) )
+ {
+ Convert( BMP_CONVERSION_8BIT_COLORS );
+ nNextIndex = 16;
+ }
+ else if( ( nSrcBitCount == 4 ) && ( nDstBitCount < 4 ) )
+ {
+ Convert( BMP_CONVERSION_4BIT_COLORS );
+ nNextIndex = 2;
+ }
+
+ if( nNextIndex )
+ {
+ BitmapReadAccess* pSrcAcc = pSrc->AcquireReadAccess();
+ BitmapWriteAccess* pDstAcc = AcquireWriteAccess();
+
+ if( pSrcAcc && pDstAcc )
+ {
+ const long nSrcCount = pDstAcc->GetPaletteEntryCount();
+ const long nDstCount = 1 << nDstBitCount;
+ BOOL bFound;
+
+ for( long i = 0L; ( i < nSrcCount ) && ( nNextIndex < nSrcCount ); i++ )
+ {
+ const BitmapColor& rSrcCol = pSrcAcc->GetPaletteColor( (USHORT) i );
+
+ bFound = FALSE;
+
+ for( long j = 0L; j < nDstCount; j++ )
+ {
+ if( rSrcCol == pDstAcc->GetPaletteColor( (USHORT) j ) )
+ {
+ bFound = TRUE;
+ break;
+ }
+ }
+
+ if( !bFound )
+ pDstAcc->SetPaletteColor( (USHORT) nNextIndex++, rSrcCol );
+ }
+ }
+
+ if( pSrcAcc )
+ pSrc->ReleaseAccess( pSrcAcc );
+
+ if( pDstAcc )
+ ReleaseAccess( pDstAcc );
+ }
+ }
+
+ aRectSrc.Intersection( Rectangle( Point(), aCopySizePix ) );
+
+ if( !aRectSrc.IsEmpty() )
+ {
+ BitmapReadAccess* pReadAcc = pSrc->AcquireReadAccess();
+
+ if( pReadAcc )
+ {
+ BitmapWriteAccess* pWriteAcc = AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nWidth = Min( aRectSrc.GetWidth(), aRectDst.GetWidth() );
+ const long nHeight = Min( aRectSrc.GetHeight(), aRectDst.GetHeight() );
+ const long nSrcEndX = aRectSrc.Left() + nWidth;
+ const long nSrcEndY = aRectSrc.Top() + nHeight;
+ long nDstY = aRectDst.Top();
+
+ if( pReadAcc->HasPalette() && pWriteAcc->HasPalette() )
+ {
+ const USHORT nCount = pReadAcc->GetPaletteEntryCount();
+ BYTE* pMap = new BYTE[ nCount ];
+
+ // Index-Map fuer Farbtabelle
+ // aufbauen, da das Bild ja (relativ) farbgenau
+ // kopiert werden soll
+ for( USHORT i = 0; i < nCount; i++ )
+ pMap[ i ] = (BYTE) pWriteAcc->GetBestPaletteIndex( pReadAcc->GetPaletteColor( i ) );
+
+ for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
+ for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
+ pWriteAcc->SetPixel( nDstY, nDstX, pMap[ pReadAcc->GetPixel( nSrcY, nSrcX ).GetIndex() ] );
+
+ delete[] pMap;
+ }
+ else if( pReadAcc->HasPalette() )
+ {
+ }
+ else
+ for( long nSrcY = aRectSrc.Top(); nSrcY < nSrcEndY; nSrcY++, nDstY++ )
+ for( long nSrcX = aRectSrc.Left(), nDstX = aRectDst.Left(); nSrcX < nSrcEndX; nSrcX++, nDstX++ )
+ pWriteAcc->SetPixel( nDstY, nDstX, pReadAcc->GetPixel( nSrcY, nSrcX ) );
+
+ ReleaseAccess( pWriteAcc );
+ bRet = ( nWidth > 0L ) && ( nHeight > 0L );
+ }
+
+ pSrc->ReleaseAccess( pReadAcc );
+ }
+ }
+ }
+ else
+ {
+ Rectangle aRectSrc( rRectSrc );
+
+ aRectSrc.Intersection( Rectangle( Point(), aSizePix ) );
+
+ if( !aRectSrc.IsEmpty() && ( aRectSrc != aRectDst ) )
+ {
+ BitmapWriteAccess* pWriteAcc = AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nWidth = Min( aRectSrc.GetWidth(), aRectDst.GetWidth() );
+ const long nHeight = Min( aRectSrc.GetHeight(), aRectDst.GetHeight() );
+ const long nSrcX = aRectSrc.Left();
+ const long nSrcY = aRectSrc.Top();
+ const long nSrcEndX1 = nSrcX + nWidth - 1L;
+ const long nSrcEndY1 = nSrcY + nHeight - 1L;
+ const long nDstX = aRectDst.Left();
+ const long nDstY = aRectDst.Top();
+ const long nDstEndX1 = nDstX + nWidth - 1L;
+ const long nDstEndY1 = nDstY + nHeight - 1L;
+
+ if( ( nDstX <= nSrcX ) && ( nDstY <= nSrcY ) )
+ {
+ for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
+ for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
+ pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
+ else if( ( nDstX <= nSrcX ) && ( nDstY >= nSrcY ) )
+ {
+ for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
+ for( long nX = nSrcX, nXN = nDstX; nX <= nSrcEndX1; nX++, nXN++ )
+ pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
+ else if( ( nDstX >= nSrcX ) && ( nDstY <= nSrcY ) )
+ {
+ for( long nY = nSrcY, nYN = nDstY; nY <= nSrcEndY1; nY++, nYN++ )
+ for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
+ pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
+ else
+ {
+ for( long nY = nSrcEndY1, nYN = nDstEndY1; nY >= nSrcY; nY--, nYN-- )
+ for( long nX = nSrcEndX1, nXN = nDstEndX1; nX >= nSrcX; nX--, nXN-- )
+ pWriteAcc->SetPixel( nYN, nXN, pWriteAcc->GetPixel( nY, nX ) );
+ }
+
+ ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor )
+{
+ BOOL bRet = FALSE;
+
+ if( nDX || nDY )
+ {
+ const Size aSizePixel( GetSizePixel() );
+ const long nWidth = aSizePixel.Width();
+ const long nHeight = aSizePixel.Height();
+ const Size aNewSize( nWidth + nDX, nHeight + nDY );
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+
+ if( pReadAcc )
+ {
+// Was soll den das ?
+// BitmapPalette aBmpPal( pReadAcc ? pReadAcc->GetPalette() : BitmapPalette() );
+ BitmapPalette aBmpPal( pReadAcc->GetPalette() );
+ Bitmap aNewBmp( aNewSize, GetBitCount(), &aBmpPal );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ BitmapColor aColor;
+ const ULONG nScanlineSize = pReadAcc->GetScanlineSize();
+ const long nNewX = nWidth;
+ const long nNewY = nHeight;
+ const long nNewWidth = pWriteAcc->Width();
+ const long nNewHeight = pWriteAcc->Height();
+ long nX;
+ long nY;
+
+ if( pInitColor )
+ aColor = pWriteAcc->GetBestMatchingColor( *pInitColor );
+
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ pWriteAcc->CopyScanline( nY, *pReadAcc );
+
+ if( pInitColor && nDX )
+ for( nX = nNewX; nX < nNewWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, aColor );
+ }
+
+ if( pInitColor && nDY )
+ for( nY = nNewY; nY < nNewHeight; nY++ )
+ for( nX = nNewX; nX < nNewWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, aColor );
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ ImplAssignWithSize( aNewBmp );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+Bitmap Bitmap::CreateMask( const Color& rTransColor, ULONG nTol ) const
+{
+ Bitmap aNewBmp( GetSizePixel(), 1 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pWriteAcc )
+ {
+ BitmapReadAccess* pReadAcc = ( (Bitmap*) this )->AcquireReadAccess();
+
+ if( pReadAcc )
+ {
+ const long nWidth = pReadAcc->Width();
+ const long nHeight = pReadAcc->Height();
+ const BitmapColor aBlack( pWriteAcc->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ if( !nTol )
+ {
+ const BitmapColor aTest( pReadAcc->GetBestMatchingColor( rTransColor ) );
+ long nX, nY, nShift;
+
+ if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_MSN_PAL ||
+ pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_LSN_PAL )
+ {
+ // optimized for 4Bit-MSN/LSN source palette
+ const BYTE cTest = aTest.GetIndex();
+ const long nShiftInit = ( ( pReadAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_MSN_PAL ) ? 4 : 0 );
+
+ if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
+ aWhite.GetIndex() == 1 )
+ {
+ // optimized for 1Bit-MSB destination palette
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ Scanline pSrc = pReadAcc->GetScanline( nY );
+ Scanline pDst = pWriteAcc->GetScanline( nY );
+ for( nX = 0L, nShift = nShiftInit; nX < nWidth; nX++, nShift ^= 4 )
+ {
+ if( cTest == ( ( pSrc[ nX >> 1 ] >> nShift ) & 0x0f ) )
+ pDst[ nX >> 3 ] |= 1 << ( 7 - ( nX & 7 ) );
+ else
+ pDst[ nX >> 3 ] &= ~( 1 << ( 7 - ( nX & 7 ) ) );
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ Scanline pSrc = pReadAcc->GetScanline( nY );
+ for( nX = 0L, nShift = nShiftInit; nX < nWidth; nX++, nShift ^= 4 )
+ {
+ if( cTest == ( ( pSrc[ nX >> 1 ] >> nShift ) & 0x0f ) )
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+ }
+ else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ {
+ // optimized for 8Bit source palette
+ const BYTE cTest = aTest.GetIndex();
+
+ if( pWriteAcc->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
+ aWhite.GetIndex() == 1 )
+ {
+ // optimized for 1Bit-MSB destination palette
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ Scanline pSrc = pReadAcc->GetScanline( nY );
+ Scanline pDst = pWriteAcc->GetScanline( nY );
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ if( cTest == pSrc[ nX ] )
+ pDst[ nX >> 3 ] |= 1 << ( 7 - ( nX & 7 ) );
+ else
+ pDst[ nX >> 3 ] &= ~( 1 << ( 7 - ( nX & 7 ) ) );
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ Scanline pSrc = pReadAcc->GetScanline( nY );
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ if( cTest == pSrc[ nX ] )
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+ }
+ else
+ {
+ // not optimized
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ if( aTest == pReadAcc->GetPixel( nY, nX ) )
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+ }
+ else
+ {
+ BitmapColor aCol;
+ long nR, nG, nB;
+ const long nMinR = MinMax( (long) rTransColor.GetRed() - nTol, 0, 255 );
+ const long nMaxR = MinMax( (long) rTransColor.GetRed() + nTol, 0, 255 );
+ const long nMinG = MinMax( (long) rTransColor.GetGreen() - nTol, 0, 255 );
+ const long nMaxG = MinMax( (long) rTransColor.GetGreen() + nTol, 0, 255 );
+ const long nMinB = MinMax( (long) rTransColor.GetBlue() - nTol, 0, 255 );
+ const long nMaxB = MinMax( (long) rTransColor.GetBlue() + nTol, 0, 255 );
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aCol = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) );
+ nR = aCol.GetRed();
+ nG = aCol.GetGreen();
+ nB = aCol.GetBlue();
+
+ if( nMinR <= nR && nMaxR >= nR &&
+ nMinG <= nG && nMaxG >= nG &&
+ nMinB <= nB && nMaxB >= nB )
+ {
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ }
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aCol = pReadAcc->GetPixel( nY, nX );
+ nR = aCol.GetRed();
+ nG = aCol.GetGreen();
+ nB = aCol.GetBlue();
+
+ if( nMinR <= nR && nMaxR >= nR &&
+ nMinG <= nG && nMaxG >= nG &&
+ nMinB <= nB && nMaxB >= nB )
+ {
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ }
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+ }
+
+ ( (Bitmap*) this )->ReleaseAccess( pReadAcc );
+ bRet = TRUE;
+ }
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ }
+
+ if( bRet )
+ {
+ aNewBmp.maPrefSize = maPrefSize;
+ aNewBmp.maPrefMapMode = maPrefMapMode;
+ }
+ else
+ aNewBmp = Bitmap();
+
+ return aNewBmp;
+}
+
+// ------------------------------------------------------------------
+
+Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect ) const
+{
+ Region aRegion;
+ Rectangle aRect( rRect );
+ BitmapReadAccess* pReadAcc = ( (Bitmap*) this )->AcquireReadAccess();
+
+ aRect.Intersection( Rectangle( Point(), GetSizePixel() ) );
+ aRect.Justify();
+
+ if( pReadAcc )
+ {
+ Rectangle aSubRect;
+ const long nLeft = aRect.Left();
+ const long nTop = aRect.Top();
+ const long nRight = aRect.Right();
+ const long nBottom = aRect.Bottom();
+ const BitmapColor aMatch( pReadAcc->GetBestMatchingColor( rColor ) );
+
+ aRegion.ImplBeginAddRect();
+
+ for( long nY = nTop; nY <= nBottom; nY++ )
+ {
+ aSubRect.Top() = aSubRect.Bottom() = nY;
+
+ for( long nX = nLeft; nX <= nRight; )
+ {
+ while( ( nX <= nRight ) && ( aMatch != pReadAcc->GetPixel( nY, nX ) ) )
+ nX++;
+
+ if( nX <= nRight )
+ {
+ aSubRect.Left() = nX;
+
+ while( ( nX <= nRight ) && ( aMatch == pReadAcc->GetPixel( nY, nX ) ) )
+ nX++;
+
+ aSubRect.Right() = nX - 1L;
+ aRegion.ImplAddRect( aSubRect );
+ }
+ }
+ }
+
+ aRegion.ImplEndAddRect();
+ ( (Bitmap*) this )->ReleaseAccess( pReadAcc );
+ }
+ else
+ aRegion = aRect;
+
+ return aRegion;
+}
+
+//fuer WIN16 Borland
+#ifdef WIN
+#pragma codeseg BITMAP_SEG1
+#endif
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Replace( const Bitmap& rMask, const Color& rReplaceColor )
+{
+ BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess();
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pMaskAcc && pAcc )
+ {
+ const long nWidth = Min( pMaskAcc->Width(), pAcc->Width() );
+ const long nHeight = Min( pMaskAcc->Height(), pAcc->Height() );
+ const BitmapColor aMaskWhite( pMaskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+ BitmapColor aReplace;
+
+ if( pAcc->HasPalette() )
+ {
+ const USHORT nActColors = pAcc->GetPaletteEntryCount();
+ const USHORT nMaxColors = 1 << pAcc->GetBitCount();
+
+ // erst einmal naechste Farbe nehmen
+ aReplace = pAcc->GetBestMatchingColor( rReplaceColor );
+
+ // falls Palettenbild, und die zu setzende Farbe ist nicht
+ // in der Palette, suchen wir nach freien Eintraegen (teuer)
+ if( pAcc->GetPaletteColor( (BYTE) aReplace ) != BitmapColor( rReplaceColor ) )
+ {
+ // erst einmal nachsehen, ob wir unsere ReplaceColor
+ // nicht auf einen freien Platz am Ende der Palette
+ // setzen koennen
+ if( nActColors < nMaxColors )
+ {
+ pAcc->SetPaletteEntryCount( nActColors + 1 );
+ pAcc->SetPaletteColor( nActColors, rReplaceColor );
+ aReplace = BitmapColor( (BYTE) nActColors );
+ }
+ else
+ {
+ BOOL* pFlags = new BOOL[ nMaxColors ];
+
+ // alle Eintraege auf 0 setzen
+ memset( pFlags, 0, nMaxColors );
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pFlags[ (BYTE) pAcc->GetPixel( nY, nX ) ] = TRUE;
+
+ for( USHORT i = 0UL; i < nMaxColors; i++ )
+ {
+ // Hurra, wir haben einen unbenutzten Eintrag
+ if( !pFlags[ i ] )
+ {
+ pAcc->SetPaletteColor( (USHORT) i, rReplaceColor );
+ aReplace = BitmapColor( (BYTE) i );
+ }
+ }
+
+ delete[] pFlags;
+ }
+ }
+ }
+ else
+ aReplace = rReplaceColor;
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ if( pMaskAcc->GetPixel( nY, nX ) == aMaskWhite )
+ pAcc->SetPixel( nY, nX, aReplace );
+ }
+
+ ( (Bitmap&) rMask ).ReleaseAccess( pMaskAcc );
+ ReleaseAccess( pAcc );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Replace( const AlphaMask& rAlpha, const Color& rMergeColor )
+{
+ Bitmap aNewBmp( GetSizePixel(), 24 );
+ BitmapReadAccess* pAcc = AcquireReadAccess();
+ BitmapReadAccess* pAlphaAcc = ( (AlphaMask&) rAlpha ).AcquireReadAccess();
+ BitmapWriteAccess* pNewAcc = aNewBmp.AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pAcc && pAlphaAcc && pNewAcc )
+ {
+ BitmapColor aCol;
+ const long nWidth = Min( pAlphaAcc->Width(), pAcc->Width() );
+ const long nHeight = Min( pAlphaAcc->Height(), pAcc->Height() );
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aCol = pAcc->GetColor( nY, nX );
+ pNewAcc->SetPixel( nY, nX, aCol.Merge( rMergeColor, 255 - (BYTE) pAlphaAcc->GetPixel( nY, nX ) ) );
+ }
+ }
+
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pAcc );
+ ( (AlphaMask&) rAlpha ).ReleaseAccess( pAlphaAcc );
+ aNewBmp.ReleaseAccess( pNewAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol )
+{
+ // Bitmaps with 1 bit color depth can cause problems
+ // if they have other entries than black/white in their palette
+ if( 1 == GetBitCount() )
+ Convert( BMP_CONVERSION_4BIT_COLORS );
+
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pAcc )
+ {
+ const long nMinR = MinMax( (long) rSearchColor.GetRed() - nTol, 0, 255 );
+ const long nMaxR = MinMax( (long) rSearchColor.GetRed() + nTol, 0, 255 );
+ const long nMinG = MinMax( (long) rSearchColor.GetGreen() - nTol, 0, 255 );
+ const long nMaxG = MinMax( (long) rSearchColor.GetGreen() + nTol, 0, 255 );
+ const long nMinB = MinMax( (long) rSearchColor.GetBlue() - nTol, 0, 255 );
+ const long nMaxB = MinMax( (long) rSearchColor.GetBlue() + nTol, 0, 255 );
+
+ if( pAcc->HasPalette() )
+ {
+ for( USHORT i = 0, nPalCount = pAcc->GetPaletteEntryCount(); i < nPalCount; i++ )
+ {
+ const BitmapColor& rCol = pAcc->GetPaletteColor( i );
+
+ if( nMinR <= rCol.GetRed() && nMaxR >= rCol.GetRed() &&
+ nMinG <= rCol.GetGreen() && nMaxG >= rCol.GetGreen() &&
+ nMinB <= rCol.GetBlue() && nMaxB >= rCol.GetBlue() )
+ {
+ pAcc->SetPaletteColor( i, rReplaceColor );
+ }
+ }
+ }
+ else
+ {
+ BitmapColor aCol;
+ const BitmapColor aReplace( pAcc->GetBestMatchingColor( rReplaceColor ) );
+
+ for( long nY = 0L, nHeight = pAcc->Height(); nY < nHeight; nY++ )
+ {
+ for( long nX = 0L, nWidth = pAcc->Width(); nX < nWidth; nX++ )
+ {
+ aCol = pAcc->GetPixel( nY, nX );
+
+ if( nMinR <= aCol.GetRed() && nMaxR >= aCol.GetRed() &&
+ nMinG <= aCol.GetGreen() && nMaxG >= aCol.GetGreen() &&
+ nMinB <= aCol.GetBlue() && nMaxB >= aCol.GetBlue() )
+ {
+ pAcc->SetPixel( nY, nX, aReplace );
+ }
+ }
+ }
+ }
+
+ ReleaseAccess( pAcc );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Replace( const Color* pSearchColors, const Color* pReplaceColors,
+ ULONG nColorCount, ULONG* _pTols )
+{
+ // Bitmaps with 1 bit color depth can cause problems
+ // if they have other entries than black/white in their palette
+ if( 1 == GetBitCount() )
+ Convert( BMP_CONVERSION_4BIT_COLORS );
+
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pAcc )
+ {
+ long* pMinR = new long[ nColorCount ];
+ long* pMaxR = new long[ nColorCount ];
+ long* pMinG = new long[ nColorCount ];
+ long* pMaxG = new long[ nColorCount ];
+ long* pMinB = new long[ nColorCount ];
+ long* pMaxB = new long[ nColorCount ];
+ long* pTols;
+ ULONG i;
+
+ if( !_pTols )
+ {
+ pTols = new long[ nColorCount ];
+ memset( pTols, 0, nColorCount * sizeof( long ) );
+ }
+ else
+ pTols = (long*) _pTols;
+
+ for( i = 0UL; i < nColorCount; i++ )
+ {
+ const Color& rCol = pSearchColors[ i ];
+ const long nTol = pTols[ i ];
+
+ pMinR[ i ] = MinMax( (long) rCol.GetRed() - nTol, 0, 255 );
+ pMaxR[ i ] = MinMax( (long) rCol.GetRed() + nTol, 0, 255 );
+ pMinG[ i ] = MinMax( (long) rCol.GetGreen() - nTol, 0, 255 );
+ pMaxG[ i ] = MinMax( (long) rCol.GetGreen() + nTol, 0, 255 );
+ pMinB[ i ] = MinMax( (long) rCol.GetBlue() - nTol, 0, 255 );
+ pMaxB[ i ] = MinMax( (long) rCol.GetBlue() + nTol, 0, 255 );
+ }
+
+ if( pAcc->HasPalette() )
+ {
+ for( USHORT nEntry = 0, nPalCount = pAcc->GetPaletteEntryCount(); nEntry < nPalCount; nEntry++ )
+ {
+ const BitmapColor& rCol = pAcc->GetPaletteColor( nEntry );
+
+ for( i = 0UL; i < nColorCount; i++ )
+ {
+ if( pMinR[ i ] <= rCol.GetRed() && pMaxR[ i ] >= rCol.GetRed() &&
+ pMinG[ i ] <= rCol.GetGreen() && pMaxG[ i ] >= rCol.GetGreen() &&
+ pMinB[ i ] <= rCol.GetBlue() && pMaxB[ i ] >= rCol.GetBlue() )
+ {
+ pAcc->SetPaletteColor( (USHORT)nEntry, pReplaceColors[ i ] );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ BitmapColor aCol;
+ BitmapColor* pReplaces = new BitmapColor[ nColorCount ];
+
+ for( i = 0UL; i < nColorCount; i++ )
+ pReplaces[ i ] = pAcc->GetBestMatchingColor( pReplaceColors[ i ] );
+
+ for( long nY = 0L, nHeight = pAcc->Height(); nY < nHeight; nY++ )
+ {
+ for( long nX = 0L, nWidth = pAcc->Width(); nX < nWidth; nX++ )
+ {
+ aCol = pAcc->GetPixel( nY, nX );
+
+ for( i = 0UL; i < nColorCount; i++ )
+ {
+ if( pMinR[ i ] <= aCol.GetRed() && pMaxR[ i ] >= aCol.GetRed() &&
+ pMinG[ i ] <= aCol.GetGreen() && pMaxG[ i ] >= aCol.GetGreen() &&
+ pMinB[ i ] <= aCol.GetBlue() && pMaxB[ i ] >= aCol.GetBlue() )
+ {
+ pAcc->SetPixel( nY, nX, pReplaces[ i ] );
+ break;
+ }
+ }
+ }
+ }
+
+ delete[] pReplaces;
+ }
+
+ if( !_pTols )
+ delete[] pTols;
+
+ delete[] pMinR;
+ delete[] pMaxR;
+ delete[] pMinG;
+ delete[] pMaxG;
+ delete[] pMinB;
+ delete[] pMaxB;
+ ReleaseAccess( pAcc );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+Bitmap Bitmap::CreateDisplayBitmap( OutputDevice* pDisplay )
+{
+ Bitmap aDispBmp( *this );
+
+#ifndef REMOTE_APPSERVER
+ if( mpImpBmp && ( pDisplay->mpGraphics || pDisplay->ImplGetGraphics() ) )
+ {
+ ImpBitmap* pImpDispBmp = new ImpBitmap;
+
+ if( pImpDispBmp->ImplCreate( *mpImpBmp, pDisplay->mpGraphics ) )
+ aDispBmp.ImplSetImpBitmap( pImpDispBmp );
+ else
+ delete pImpDispBmp;
+ }
+#endif
+
+ return aDispBmp;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
+{
+ BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess();
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pMaskAcc && pAcc )
+ {
+ const long nWidth = Min( pMaskAcc->Width(), pAcc->Width() );
+ const long nHeight = Min( pMaskAcc->Height(), pAcc->Height() );
+ const Color aColBlack( COL_BLACK );
+ BitmapColor aPixel;
+ BitmapColor aMaskPixel;
+ const BitmapColor aWhite( pAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+ const BitmapColor aBlack( pAcc->GetBestMatchingColor( aColBlack ) );
+ const BitmapColor aMaskBlack( pMaskAcc->GetBestMatchingColor( aColBlack ) );
+
+ switch( eCombine )
+ {
+ case( BMP_COMBINE_COPY ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pMaskAcc->GetPixel( nY, nX ) == aMaskBlack )
+ pAcc->SetPixel( nY, nX, aBlack );
+ else
+ pAcc->SetPixel( nY, nX, aWhite );
+ }
+ }
+ break;
+
+ case( BMP_COMBINE_INVERT ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pAcc->GetPixel( nY, nX ) == aBlack )
+ pAcc->SetPixel( nY, nX, aWhite );
+ else
+ pAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ break;
+
+ case( BMP_COMBINE_AND ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack && pAcc->GetPixel( nY, nX ) != aBlack )
+ pAcc->SetPixel( nY, nX, aWhite );
+ else
+ pAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ break;
+
+ case( BMP_COMBINE_NAND ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack && pAcc->GetPixel( nY, nX ) != aBlack )
+ pAcc->SetPixel( nY, nX, aBlack );
+ else
+ pAcc->SetPixel( nY, nX, aWhite );
+ }
+ }
+ break;
+
+ case( BMP_COMBINE_OR ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack || pAcc->GetPixel( nY, nX ) != aBlack )
+ pAcc->SetPixel( nY, nX, aWhite );
+ else
+ pAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ break;
+
+ case( BMP_COMBINE_NOR ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pMaskAcc->GetPixel( nY, nX ) != aMaskBlack || pAcc->GetPixel( nY, nX ) != aBlack )
+ pAcc->SetPixel( nY, nX, aBlack );
+ else
+ pAcc->SetPixel( nY, nX, aWhite );
+ }
+ }
+ break;
+
+ case( BMP_COMBINE_XOR ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aPixel = pAcc->GetPixel( nY, nX );
+ aMaskPixel = pMaskAcc->GetPixel( nY, nX );
+
+ if( ( aMaskPixel != aMaskBlack && aPixel == aBlack ) ||
+ ( aMaskPixel == aMaskBlack && aPixel != aBlack ) )
+ {
+ pAcc->SetPixel( nY, nX, aWhite );
+ }
+ else
+ pAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ break;
+
+ case( BMP_COMBINE_NXOR ):
+ {
+ for( long nY = 0L; nY < nHeight; nY++ ) for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aPixel = pAcc->GetPixel( nY, nX );
+ aMaskPixel = pMaskAcc->GetPixel( nY, nX );
+
+ if( ( aMaskPixel != aMaskBlack && aPixel == aBlack ) ||
+ ( aMaskPixel == aMaskBlack && aPixel != aBlack ) )
+ {
+ pAcc->SetPixel( nY, nX, aBlack );
+ }
+ else
+ pAcc->SetPixel( nY, nX, aWhite );
+ }
+ }
+ break;
+ }
+ }
+
+ ( (Bitmap&) rMask ).ReleaseAccess( pMaskAcc );
+ ReleaseAccess( pAcc );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+#ifdef REMOTE_APPSERVER
+
+void Bitmap::ImplDrawRemote( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz ) const
+{
+ if( mpImpBmp )
+ {
+ if( !mpImpBmp->ImplGetRemoteBmp() )
+ mpImpBmp->ImplCreateRemoteBmp( *this );
+
+ mpImpBmp->ImplDrawRemoteBmp( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplDrawRemoteEx( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz,
+ const Bitmap& rMask ) const
+{
+ if( mpImpBmp )
+ {
+ if( !mpImpBmp->ImplGetRemoteBmp() )
+ mpImpBmp->ImplCreateRemoteBmp( *this );
+
+ mpImpBmp->ImplDrawRemoteBmpEx( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, rMask );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplDrawRemoteAlpha( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz,
+ const AlphaMask& rAlpha ) const
+{
+ if( mpImpBmp )
+ {
+ if( !mpImpBmp->ImplGetRemoteBmp() )
+ mpImpBmp->ImplCreateRemoteBmp( *this );
+
+ mpImpBmp->ImplDrawRemoteBmpAlpha( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, rAlpha );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplDrawRemoteMask( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz,
+ const Color& rColor ) const
+{
+ if( mpImpBmp )
+ {
+ if( !mpImpBmp->ImplGetRemoteBmp() )
+ mpImpBmp->ImplCreateRemoteBmp( *this );
+
+ mpImpBmp->ImplDrawRemoteBmpMask( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, rColor );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplGetRemoteBmp( OutputDevice* pOut, const Point& rPt, const Size& rSz )
+{
+ DBG_ASSERT( !mpImpBmp, "Bitmap::ImplGetRemoteBmp???" );
+
+ mpImpBmp = new ImpBitmap;
+ mpImpBmp->ImplCreateRemoteBmp( *this, pOut, rPt, rSz );
+}
+
+#endif
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx
new file mode 100644
index 000000000000..e4e4c407fc18
--- /dev/null
+++ b/vcl/source/gdi/bitmap2.cxx
@@ -0,0 +1,1269 @@
+/*************************************************************************
+ *
+ * $RCSfile: bitmap2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef WIN
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#endif
+
+#define _SV_BITMAP_CXX
+
+#include <tools/zcodec.hxx>
+#ifndef _TOOLS_NEW_HXX
+#include <tools/new.hxx>
+#endif
+#ifndef _TOOLS_STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+
+#define USE_ZCODEC
+
+// -----------
+// - Defines -
+// -----------
+
+#define DIBCOREHEADERSIZE ( 12UL )
+#define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) )
+#define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 );
+
+// ----------------------
+// - Compression defines
+// ----------------------
+
+#define COMPRESS_OWN ('S'|('D'<<8UL))
+#define COMPRESS_NONE ( 0UL )
+#define RLE_8 ( 1UL )
+#define RLE_4 ( 2UL )
+#define BITFIELDS ( 3UL )
+#define ZCOMPRESS ( COMPRESS_OWN | 0x01000000UL ) /* == 'SD01' (binary) */
+
+// -----------------
+// - DIBInfoHeader -
+// -----------------
+
+struct DIBInfoHeader
+{
+ UINT32 nSize;
+ UINT32 nWidth;
+ UINT32 nHeight;
+ UINT16 nPlanes;
+ UINT16 nBitCount;
+ UINT32 nCompression;
+ UINT32 nSizeImage;
+ UINT32 nXPelsPerMeter;
+ UINT32 nYPelsPerMeter;
+ UINT32 nColsUsed;
+ UINT32 nColsImportant;
+
+ DIBInfoHeader() :
+ nSize( 0UL ),
+ nWidth( 0UL ),
+ nHeight( 0UL ),
+ nPlanes( 0 ),
+ nBitCount( 0 ),
+ nCompression( 0UL ),
+ nSizeImage( 0UL ),
+ nXPelsPerMeter( 0UL ),
+ nYPelsPerMeter( 0UL ),
+ nColsUsed( 0UL ),
+ nColsImportant( 0UL ) {}
+
+ ~DIBInfoHeader() {}
+};
+
+// ----------
+// - Bitmap -
+// ----------
+
+SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap )
+{
+ rBitmap.Read( rIStm, TRUE );
+ return rIStm;
+}
+
+// ------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap )
+{
+ rBitmap.Write( rOStm, FALSE, TRUE );
+ return rOStm;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
+{
+ const USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ const ULONG nOldPos = rIStm.Tell();
+ ULONG nOffset = 0UL;
+ BOOL bRet = FALSE;
+
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ if( bFileHeader )
+ {
+ if( ImplReadDIBFileHeader( rIStm, nOffset ) )
+ bRet = ImplReadDIB( rIStm, *this, nOffset );
+ }
+ else
+ bRet = ImplReadDIB( rIStm, *this, nOffset );
+
+ if( !bRet )
+ {
+ if( !rIStm.GetError() )
+ rIStm.SetError( SVSTREAM_GENERALERROR );
+
+ rIStm.Seek( nOldPos );
+ }
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset )
+{
+ DIBInfoHeader aHeader;
+ const ULONG nStmPos = rIStm.Tell();
+ BitmapPalette* pPalette = NULL;
+ BOOL bHeaderRead = FALSE;
+ BOOL bRet = FALSE;
+
+ if( ImplReadDIBInfoHeader( rIStm, aHeader ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
+ {
+ USHORT nBitCount = ( aHeader.nBitCount <= 1 ) ? 1 :
+ ( aHeader.nBitCount <= 4 ) ? 4 :
+ ( aHeader.nBitCount <= 8 ) ? 8 : 24;
+
+ const Size aSizePixel( aHeader.nWidth, aHeader.nHeight );
+ BitmapPalette aDummyPal;
+ Bitmap aNewBmp( aSizePixel, nBitCount, &aDummyPal );
+ BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ USHORT nColors;
+ SvStream* pIStm;
+ SvMemoryStream* pMemStm = NULL;
+ BYTE* pData = NULL;
+
+ if( nBitCount <= 8 )
+ {
+ if( aHeader.nColsUsed )
+ nColors = (USHORT) aHeader.nColsUsed;
+ else
+ nColors = ( 1 << aHeader.nBitCount );
+ }
+ else
+ nColors = 0;
+
+#ifdef USE_ZCODEC
+ if( ZCOMPRESS == aHeader.nCompression )
+ {
+ ZCodec aCodec;
+ ULONG nCodedSize, nUncodedSize;
+ ULONG nCodedPos;
+
+ // read coding information
+ rIStm >> nCodedSize >> nUncodedSize >> aHeader.nCompression;
+ pData = (BYTE*) SvMemAlloc( nUncodedSize );
+
+ // decode buffer
+ nCodedPos = rIStm.Tell();
+ aCodec.BeginCompression();
+ aCodec.Read( rIStm, pData, nUncodedSize );
+ aCodec.EndCompression();
+
+ // skip unread bytes from coded buffer
+ rIStm.SeekRel( nCodedSize - ( rIStm.Tell() - nCodedPos ) );
+
+ // set decoded bytes to memory stream,
+ // from which we will read the bitmap data
+ pIStm = pMemStm = new SvMemoryStream;
+ pMemStm->SetBuffer( (char*) pData, nUncodedSize, FALSE, nUncodedSize );
+ nOffset = 0;
+ }
+ else
+#endif // USE_ZCODEC
+ pIStm = &rIStm;
+
+ // read palette
+ if( nColors )
+ {
+ pAcc->SetPaletteEntryCount( nColors );
+ ImplReadDIBPalette( *pIStm, *pAcc, aHeader.nSize != DIBCOREHEADERSIZE );
+ }
+
+ // read bits
+ if( !pIStm->GetError() )
+ {
+ if( nOffset )
+ pIStm->SeekRel( nOffset - ( pIStm->Tell() - nStmPos ) );
+
+ bRet = ImplReadDIBBits( *pIStm, aHeader, *pAcc );
+
+ if( bRet && aHeader.nXPelsPerMeter && aHeader.nYPelsPerMeter )
+ {
+ MapMode aMapMode( MAP_MM, Point(),
+ Fraction( 1000, aHeader.nXPelsPerMeter ),
+ Fraction( 1000, aHeader.nYPelsPerMeter ) );
+
+ aNewBmp.SetPrefMapMode( aMapMode );
+ aNewBmp.SetPrefSize( Size( aHeader.nWidth, aHeader.nHeight ) );
+ }
+ }
+
+ if( pData )
+ SvMemFree( pData );
+
+ delete pMemStm;
+ aNewBmp.ReleaseAccess( pAcc );
+
+ if( bRet )
+ rBmp = aNewBmp;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset )
+{
+ UINT32 nTmp32;
+ UINT16 nTmp16;
+ BOOL bRet = FALSE;
+
+ rIStm >> nTmp16;
+
+ if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
+ {
+ if ( 0x4142 == nTmp16 )
+ {
+ rIStm.SeekRel( 12L );
+ rIStm >> nTmp16;
+ rIStm.SeekRel( 8L );
+ rIStm >> nTmp32;
+ rOffset = nTmp32 - 28UL;;
+ bRet = ( 0x4D42 == nTmp16 );
+ }
+ else
+ {
+ rIStm.SeekRel( 8L );
+ rIStm >> nTmp32;
+ rOffset = nTmp32 - 14UL;
+ bRet = ( rIStm.GetError() == 0UL );
+ }
+ }
+ else
+ rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader )
+{
+ // BITMAPINFOHEADER or BITMAPCOREHEADER
+ rIStm >> rHeader.nSize;
+
+ // BITMAPCOREHEADER
+ if ( rHeader.nSize == DIBCOREHEADERSIZE )
+ {
+ UINT16 nTmp16;
+
+ rIStm >> nTmp16; rHeader.nWidth = nTmp16;
+ rIStm >> nTmp16; rHeader.nHeight = nTmp16;
+ rIStm >> nTmp16; rHeader.nPlanes = nTmp16;
+ rIStm >> nTmp16; rHeader.nBitCount = nTmp16;
+ }
+ else
+ {
+ // unknown Header
+ if( rHeader.nSize < DIBINFOHEADERSIZE )
+ {
+ ULONG nUnknownSize = sizeof( rHeader.nSize );
+
+ rIStm >> rHeader.nWidth; nUnknownSize += sizeof( rHeader.nWidth );
+ rIStm >> rHeader.nHeight; nUnknownSize += sizeof( rHeader.nHeight );
+ rIStm >> rHeader.nPlanes; nUnknownSize += sizeof( rHeader.nPlanes );
+ rIStm >> rHeader.nBitCount; nUnknownSize += sizeof( rHeader.nBitCount );
+
+ if( nUnknownSize < rHeader.nSize )
+ {
+ rIStm >> rHeader.nCompression;
+ nUnknownSize += sizeof( rHeader.nCompression );
+
+ if( nUnknownSize < rHeader.nSize )
+ {
+ rIStm >> rHeader.nSizeImage;
+ nUnknownSize += sizeof( rHeader.nSizeImage );
+
+ if( nUnknownSize < rHeader.nSize )
+ {
+ rIStm >> rHeader.nXPelsPerMeter;
+ nUnknownSize += sizeof( rHeader.nXPelsPerMeter );
+
+ if( nUnknownSize < rHeader.nSize )
+ {
+ rIStm >> rHeader.nYPelsPerMeter;
+ nUnknownSize += sizeof( rHeader.nYPelsPerMeter );
+ }
+
+ if( nUnknownSize < rHeader.nSize )
+ {
+ rIStm >> rHeader.nColsUsed;
+ nUnknownSize += sizeof( rHeader.nColsUsed );
+
+ if( nUnknownSize < rHeader.nSize )
+ {
+ rIStm >> rHeader.nColsImportant;
+ nUnknownSize += sizeof( rHeader.nColsImportant );
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ rIStm >> rHeader.nWidth;
+ rIStm >> rHeader.nHeight;
+ rIStm >> rHeader.nPlanes;
+ rIStm >> rHeader.nBitCount;
+ rIStm >> rHeader.nCompression;
+ rIStm >> rHeader.nSizeImage;
+ rIStm >> rHeader.nXPelsPerMeter;
+ rIStm >> rHeader.nYPelsPerMeter;
+ rIStm >> rHeader.nColsUsed;
+ rIStm >> rHeader.nColsImportant;
+ }
+
+ // Eventuell bis zur Palette ueberlesen
+ if ( rHeader.nSize > DIBINFOHEADERSIZE )
+ rIStm.SeekRel( rHeader.nSize - DIBINFOHEADERSIZE );
+ }
+
+ return( ( rHeader.nPlanes == 1 ) && ( rIStm.GetError() == 0UL ) );
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL bQuad )
+{
+ const USHORT nColors = rAcc.GetPaletteEntryCount();
+ const ULONG nPalSize = nColors * ( bQuad ? 4UL : 3UL );
+ BitmapColor aPalColor;
+
+ BYTE* pEntries = new BYTE[ nPalSize ];
+ rIStm.Read( pEntries, nPalSize );
+
+ BYTE* pTmpEntry = pEntries;
+ for( USHORT i = 0; i < nColors; i++ )
+ {
+ aPalColor.SetBlue( *pTmpEntry++ );
+ aPalColor.SetGreen( *pTmpEntry++ );
+ aPalColor.SetRed( *pTmpEntry++ );
+
+ if( bQuad )
+ pTmpEntry++;
+
+ rAcc.SetPaletteColor( i, aPalColor );
+ }
+
+ delete[] pEntries;
+
+ return( rIStm.GetError() == 0UL );
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc )
+{
+ const ULONG nAlignedWidth = AlignedWidth4Bytes( rHeader.nWidth * rHeader.nBitCount );
+ UINT32 nRMask;
+ UINT32 nGMask;
+ UINT32 nBMask;
+ BOOL bNative;
+ BOOL bTCMask = ( rHeader.nBitCount == 16 ) || ( rHeader.nBitCount == 32 );
+ BOOL bRLE = ( RLE_8 == rHeader.nCompression && rHeader.nBitCount == 8 ) ||
+ ( RLE_4 == rHeader.nCompression && rHeader.nBitCount == 4 );
+
+ // Is native format?
+ switch( rAcc.GetScanlineFormat() )
+ {
+ case( BMP_FORMAT_1BIT_MSB_PAL ):
+ case( BMP_FORMAT_4BIT_MSN_PAL ):
+ case( BMP_FORMAT_8BIT_PAL ):
+ case( BMP_FORMAT_24BIT_TC_BGR ):
+ bNative = ( rAcc.IsBottomUp() && !bRLE && !bTCMask && ( rAcc.GetScanlineSize() == nAlignedWidth ) );
+ break;
+
+ default:
+ bNative = FALSE;
+ break;
+ }
+
+ // Read data
+ if( bNative )
+ {
+ // true color DIB's can have a (optimization) palette
+ if( rHeader.nColsUsed && rHeader.nBitCount > 8 )
+ rIStm.SeekRel( rHeader.nColsUsed * ( ( rHeader.nSize != DIBCOREHEADERSIZE ) ? 4 : 3 ) );
+
+ rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth );
+ }
+ else
+ {
+ // Read color mask
+ if( bTCMask )
+ {
+ if( rHeader.nCompression == BITFIELDS )
+ {
+ rIStm.SeekRel( -12L );
+ rIStm >> nRMask;
+ rIStm >> nGMask;
+ rIStm >> nBMask;
+ }
+ else
+ {
+ nRMask = ( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL;
+ nGMask = ( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL;
+ nBMask = ( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL;
+ }
+ }
+
+ if( bRLE )
+ {
+ if ( !rHeader.nSizeImage )
+ {
+ const ULONG nOldPos = rIStm.Tell();
+
+ rIStm.Seek( STREAM_SEEK_TO_END );
+ rHeader.nSizeImage = rIStm.Tell() - nOldPos;
+ rIStm.Seek( nOldPos );
+ }
+
+ BYTE* pBuffer = (BYTE*) SvMemAlloc( rHeader.nSizeImage );
+
+ rIStm.Read( (char*) pBuffer, rHeader.nSizeImage );
+ ImplDecodeRLE( pBuffer, rHeader, rAcc, RLE_4 == rHeader.nCompression );
+
+ SvMemFree( pBuffer );
+ }
+ else
+ {
+ const long nWidth = rHeader.nWidth;
+ const long nHeight = rHeader.nHeight;
+ BYTE* pBuf = new BYTE[ nAlignedWidth ];
+
+ // true color DIB's can have a (optimization) palette
+ if( rHeader.nColsUsed && rHeader.nBitCount > 8 )
+ rIStm.SeekRel( rHeader.nColsUsed * ( ( rHeader.nSize != DIBCOREHEADERSIZE ) ? 4 : 3 ) );
+
+ switch( rHeader.nBitCount )
+ {
+ case( 1 ):
+ {
+ BYTE* pTmp;
+ BYTE cTmp;
+
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ rIStm.Read( pTmp = pBuf, nAlignedWidth );
+ cTmp = *pTmp++;
+
+ for( long nX = 0L, nShift = 8L; nX < nWidth; nX++ )
+ {
+ if( !nShift )
+ {
+ nShift = 8L,
+ cTmp = *pTmp++;
+ }
+
+ rAcc.SetPixel( nY, nX, ( cTmp >> --nShift ) & 1 );
+ }
+ }
+ }
+ break;
+
+ case( 4 ):
+ {
+ BYTE* pTmp;
+ BYTE cTmp;
+
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ rIStm.Read( pTmp = pBuf, nAlignedWidth );
+ cTmp = *pTmp++;
+
+ for( long nX = 0L, nShift = 2L; nX < nWidth; nX++ )
+ {
+ if( !nShift )
+ {
+ nShift = 2UL,
+ cTmp = *pTmp++;
+ }
+
+ rAcc.SetPixel( nY, nX, ( cTmp >> ( --nShift << 2UL ) ) & 0x0f );
+ }
+ }
+ }
+ break;
+
+ case( 8 ):
+ {
+ BYTE* pTmp;
+
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ rIStm.Read( pTmp = pBuf, nAlignedWidth );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ rAcc.SetPixel( nY, nX, *pTmp++ );
+ }
+ }
+ break;
+
+ case( 16 ):
+ {
+ ColorMask aMask( nRMask, nGMask, nBMask );
+ BitmapColor aColor;
+ UINT16* pTmp16;
+
+ for( long nY = rHeader.nHeight - 1L; nY >= 0L; nY-- )
+ {
+ rIStm.Read( (char*)( pTmp16 = (UINT16*) pBuf ), nAlignedWidth );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aMask.GetColorFor16Bit( aColor, (BYTE*) pTmp16++ );
+ rAcc.SetPixel( nY, nX, aColor );
+ }
+ }
+ }
+ break;
+
+ case( 24 ):
+ {
+ BitmapColor aPixelColor;
+ BYTE* pTmp;
+
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ rIStm.Read( pTmp = pBuf, nAlignedWidth );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aPixelColor.SetBlue( *pTmp++ );
+ aPixelColor.SetGreen( *pTmp++ );
+ aPixelColor.SetRed( *pTmp++ );
+ rAcc.SetPixel( nY, nX, aPixelColor );
+ }
+ }
+ }
+ break;
+
+ case( 32 ):
+ {
+ ColorMask aMask( nRMask, nGMask, nBMask );
+ BitmapColor aColor;
+ UINT32* pTmp32;
+
+ for( long nY = rHeader.nHeight - 1L; nY >= 0L; nY-- )
+ {
+ rIStm.Read( (char*)( pTmp32 = (UINT32*) pBuf ), nAlignedWidth );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aMask.GetColorFor32Bit( aColor, (BYTE*) pTmp32++ );
+ rAcc.SetPixel( nY, nX, aColor );
+ }
+ }
+ }
+ }
+
+ delete[] pBuf;
+ }
+ }
+
+ return( rIStm.GetError() == 0UL );
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::Write( SvStream& rOStm, BOOL bCompressed, BOOL bFileHeader ) const
+{
+ BMP_ASSERT( mpImpBmp, "Empty Bitmaps can't be saved" );
+
+ const Size aSizePix( GetSizePixel() );
+ BOOL bRet = FALSE;
+
+ if( mpImpBmp && aSizePix.Width() && aSizePix.Height() )
+ {
+ BitmapReadAccess* pAcc = ( (Bitmap*) this)->AcquireReadAccess();
+ const USHORT nOldFormat = rOStm.GetNumberFormatInt();
+ const ULONG nOldPos = rOStm.Tell();
+
+ rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ if( pAcc )
+ {
+ if( bFileHeader )
+ {
+ if( ImplWriteDIBFileHeader( rOStm, *pAcc ) )
+ bRet = ImplWriteDIB( rOStm, *pAcc, bCompressed );
+ }
+ else
+ bRet = ImplWriteDIB( rOStm, *pAcc, bCompressed );
+
+ ( (Bitmap*) this)->ReleaseAccess( pAcc );
+ }
+
+ if( !bRet )
+ {
+ rOStm.SetError( SVSTREAM_GENERALERROR );
+ rOStm.Seek( nOldPos );
+ }
+
+ rOStm.SetNumberFormatInt( nOldFormat );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompressed ) const
+{
+ DIBInfoHeader aHeader;
+ ULONG nImageSizePos;
+ ULONG nEndPos;
+ ULONG nCompression = 0UL;
+ BOOL bRet = FALSE;
+
+ aHeader.nSize = DIBINFOHEADERSIZE;
+ aHeader.nWidth = rAcc.Width();
+ aHeader.nHeight = rAcc.Height();
+ aHeader.nPlanes = 1;
+
+ switch( rAcc.GetScanlineFormat() )
+ {
+ case( BMP_FORMAT_16BIT_TC_MASK ):
+ case( BMP_FORMAT_32BIT_TC_MASK ):
+ {
+ aHeader.nBitCount = ( rAcc.GetScanlineFormat() == BMP_FORMAT_16BIT_TC_MASK ) ? 16 : 32;
+ nCompression = BITFIELDS;
+ }
+ break;
+
+ default:
+ {
+ aHeader.nBitCount = rAcc.GetBitCount();
+
+ if( bCompressed )
+ {
+ if( 4 == aHeader.nBitCount )
+ nCompression = RLE_4;
+ else if( 8 == aHeader.nBitCount )
+ nCompression = RLE_8;
+ }
+ else
+ nCompression = COMPRESS_NONE;
+ }
+ break;
+ }
+
+#ifdef USE_ZCODEC
+ if( ( rOStm.GetCompressMode() & COMPRESSMODE_ZBITMAP ) &&
+ ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_40 ) )
+ {
+ aHeader.nCompression = ZCOMPRESS;
+ }
+ else
+#endif // USE_ZCODEC
+ aHeader.nCompression = nCompression;
+
+ aHeader.nSizeImage = rAcc.Height() * rAcc.GetScanlineSize();
+
+ if( maPrefSize.Width() && maPrefSize.Height() )
+ {
+ const Size aSize100( OutputDevice::LogicToLogic( maPrefSize, maPrefMapMode, MAP_100TH_MM ) );
+
+ if( aSize100.Width() && aSize100.Height() )
+ {
+ aHeader.nXPelsPerMeter = ( rAcc.Width() * 100000UL ) / aSize100.Width();
+ aHeader.nYPelsPerMeter = ( rAcc.Height() * 100000UL ) / aSize100.Height();
+ }
+ }
+
+ aHeader.nColsUsed = ( ( aHeader.nBitCount <= 8 ) ? rAcc.GetPaletteEntryCount() : 0 );
+ aHeader.nColsImportant = 0;
+
+ rOStm << aHeader.nSize;
+ rOStm << aHeader.nWidth;
+ rOStm << aHeader.nHeight;
+ rOStm << aHeader.nPlanes;
+ rOStm << aHeader.nBitCount;
+ rOStm << aHeader.nCompression;
+
+ nImageSizePos = rOStm.Tell();
+ rOStm.SeekRel( sizeof( aHeader.nSizeImage ) );
+
+ rOStm << aHeader.nXPelsPerMeter;
+ rOStm << aHeader.nYPelsPerMeter;
+ rOStm << aHeader.nColsUsed;
+ rOStm << aHeader.nColsImportant;
+
+#ifdef USE_ZCODEC
+ if( aHeader.nCompression == ZCOMPRESS )
+ {
+ ZCodec aCodec;
+ SvMemoryStream aMemStm( aHeader.nSizeImage + 4096, 65535 );
+ ULONG nCodedPos = rOStm.Tell(), nLastPos;
+ ULONG nCodedSize, nUncodedSize;
+
+ // write uncoded data palette
+ if( aHeader.nColsUsed )
+ ImplWriteDIBPalette( aMemStm, rAcc );
+
+ // write uncoded bits
+ bRet = ImplWriteDIBBits( aMemStm, rAcc, nCompression, aHeader.nSizeImage );
+
+ // get uncoded size
+ nUncodedSize = aMemStm.Tell();
+
+ // seek over compress info
+ rOStm.SeekRel( 12 );
+
+ // write compressed data
+ aCodec.BeginCompression( 3 );
+ aCodec.Write( rOStm, (BYTE*) aMemStm.GetData(), nUncodedSize );
+ aCodec.EndCompression();
+
+ // update compress info ( coded size, uncoded size, uncoded compression )
+ nCodedSize = ( nLastPos = rOStm.Tell() ) - nCodedPos - 12;
+ rOStm.Seek( nCodedPos );
+ rOStm << nCodedSize << nUncodedSize << nCompression;
+ rOStm.Seek( nLastPos );
+
+ if( bRet )
+ bRet = ( rOStm.GetError() == ERRCODE_NONE );
+ }
+ else
+#endif // USE_ZCODEC
+ {
+ if( aHeader.nColsUsed )
+ ImplWriteDIBPalette( rOStm, rAcc );
+
+ bRet = ImplWriteDIBBits( rOStm, rAcc, aHeader.nCompression, aHeader.nSizeImage );
+ }
+
+ nEndPos = rOStm.Tell();
+ rOStm.Seek( nImageSizePos );
+ rOStm << aHeader.nSizeImage;
+ rOStm.Seek( nEndPos );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplWriteDIBFileHeader( SvStream& rOStm, BitmapReadAccess& rAcc )
+{
+ UINT32 nPalCount = ( rAcc.HasPalette() ? rAcc.GetPaletteEntryCount() : rAcc.HasColorMask() ? 3UL : 0UL );
+ UINT32 nOffset = 14 + DIBINFOHEADERSIZE + nPalCount * 4UL;
+
+ rOStm << (UINT16) 0x4D42;
+ rOStm << (UINT32) ( nOffset + ( rAcc.Height() * rAcc.GetScanlineSize() ) );
+ rOStm << (UINT16) 0;
+ rOStm << (UINT16) 0;
+ rOStm << nOffset;
+
+ return( rOStm.GetError() == 0UL );
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplWriteDIBPalette( SvStream& rOStm, BitmapReadAccess& rAcc )
+{
+ const USHORT nColors = rAcc.GetPaletteEntryCount();
+ const ULONG nPalSize = nColors * 4UL;
+ BYTE* pEntries = new BYTE[ nPalSize ];
+ BYTE* pTmpEntry = pEntries;
+ BitmapColor aPalColor;
+
+ for( USHORT i = 0; i < nColors; i++ )
+ {
+ const BitmapColor& rPalColor = rAcc.GetPaletteColor( i );
+
+ *pTmpEntry++ = rPalColor.GetBlue();
+ *pTmpEntry++ = rPalColor.GetGreen();
+ *pTmpEntry++ = rPalColor.GetRed();
+ *pTmpEntry++ = 0;
+ }
+
+ rOStm.Write( pEntries, nPalSize );
+ delete[] pEntries;
+
+ return( rOStm.GetError() == 0UL );
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplWriteDIBBits( SvStream& rOStm, BitmapReadAccess& rAcc,
+ ULONG nCompression, ULONG& rImageSize )
+{
+ if( BITFIELDS == nCompression )
+ {
+ const ColorMask& rMask = rAcc.GetColorMask();
+ SVBT32 aVal32;
+
+ LongToSVBT32( rMask.GetRedMask(), aVal32 );
+ rOStm.Write( (BYTE*) aVal32, 4UL );
+
+ LongToSVBT32( rMask.GetGreenMask(), aVal32 );
+ rOStm.Write( (BYTE*) aVal32, 4UL );
+
+ LongToSVBT32( rMask.GetBlueMask(), aVal32 );
+ rOStm.Write( (BYTE*) aVal32, 4UL );
+
+ rImageSize = rOStm.Tell();
+
+ if( rAcc.IsBottomUp() )
+ rOStm.Write( rAcc.GetBuffer(), rAcc.Height() * rAcc.GetScanlineSize() );
+ else
+ {
+ for( long nY = rAcc.Height() - 1, nScanlineSize = rAcc.GetScanlineSize(); nY >= 0L; nY-- )
+ rOStm.Write( rAcc.GetScanline( nY ), nScanlineSize );
+ }
+ }
+ else if( ( RLE_4 == nCompression ) || ( RLE_8 == nCompression ) )
+ {
+ rImageSize = rOStm.Tell();
+ ImplWriteRLE( rOStm, rAcc, RLE_4 == nCompression );
+ }
+ else if( !nCompression )
+ {
+ const ULONG nAlignedWidth = AlignedWidth4Bytes( rAcc.Width() * rAcc.GetBitCount() );
+ BOOL bNative = FALSE;
+
+ switch( rAcc.GetScanlineFormat() )
+ {
+ case( BMP_FORMAT_1BIT_MSB_PAL ):
+ case( BMP_FORMAT_4BIT_MSN_PAL ):
+ case( BMP_FORMAT_8BIT_PAL ):
+ case( BMP_FORMAT_24BIT_TC_BGR ):
+ {
+ if( rAcc.IsBottomUp() && ( rAcc.GetScanlineSize() == nAlignedWidth ) )
+ bNative = TRUE;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ rImageSize = rOStm.Tell();
+
+ if( bNative )
+ rOStm.Write( rAcc.GetBuffer(), nAlignedWidth * rAcc.Height() );
+ else
+ {
+ const long nWidth = rAcc.Width();
+ const long nHeight = rAcc.Height();
+ BYTE* pBuf = new BYTE[ nAlignedWidth ];
+ BYTE* pTmp;
+ BYTE cTmp;
+
+ switch( rAcc.GetBitCount() )
+ {
+ case( 1 ):
+ {
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ pTmp = pBuf;
+ cTmp = 0;
+
+ for( long nX = 0L, nShift = 8L; nX < nWidth; nX++ )
+ {
+ if( !nShift )
+ {
+ nShift = 8L;
+ *pTmp++ = cTmp;
+ cTmp = 0;
+ }
+
+ cTmp |= ( (BYTE) rAcc.GetPixel( nY, nX ) << --nShift );
+ }
+
+ *pTmp = cTmp;
+ rOStm.Write( pBuf, nAlignedWidth );
+ }
+ }
+ break;
+
+ case( 4 ):
+ {
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ pTmp = pBuf;
+ cTmp = 0;
+
+ for( long nX = 0L, nShift = 2L; nX < nWidth; nX++ )
+ {
+ if( !nShift )
+ {
+ nShift = 2L;
+ *pTmp++ = cTmp;
+ cTmp = 0;
+ }
+
+ cTmp |= ( (BYTE) rAcc.GetPixel( nY, nX ) << ( --nShift << 2L ) );
+ }
+ *pTmp = cTmp;
+ rOStm.Write( pBuf, nAlignedWidth );
+ }
+ }
+ break;
+
+ case( 8 ):
+ {
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ pTmp = pBuf;
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ *pTmp++ = rAcc.GetPixel( nY, nX );
+
+ rOStm.Write( pBuf, nAlignedWidth );
+ }
+ }
+ break;
+
+ default:
+ {
+ BitmapColor aPixelColor;
+
+ for( long nY = nHeight - 1; nY >= 0L; nY-- )
+ {
+ pTmp = pBuf;
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aPixelColor = rAcc.GetPixel( nY, nX );
+ *pTmp++ = aPixelColor.GetBlue();
+ *pTmp++ = aPixelColor.GetGreen();
+ *pTmp++ = aPixelColor.GetRed();
+ }
+
+ rOStm.Write( pBuf, nAlignedWidth );
+ }
+ }
+ break;
+ }
+
+ delete[] pBuf;
+ }
+ }
+
+ rImageSize = rOStm.Tell() - rImageSize;
+
+ return( rOStm.GetError() == 0UL );
+}
+
+// ------------------------------------------------------------------
+
+void Bitmap::ImplDecodeRLE( BYTE* pBuffer, DIBInfoHeader& rHeader,
+ BitmapWriteAccess& rAcc, BOOL bRLE4 )
+{
+ Scanline pRLE = pBuffer;
+ long nY = rHeader.nHeight - 1L;
+ const ULONG nWidth = rAcc.Width();
+ ULONG nCountByte;
+ ULONG nRunByte;
+ ULONG nX = 0UL;
+ BYTE cTmp;
+ BOOL bEndDecoding = FALSE;
+
+ do
+ {
+ if( !( nCountByte = *pRLE++ ) )
+ {
+ nRunByte = *pRLE++;
+
+ if( nRunByte > 2 )
+ {
+ if( bRLE4 )
+ {
+ nCountByte = nRunByte >> 1;
+
+ for( ULONG i = 0UL; i < nCountByte; i++ )
+ {
+ cTmp = *pRLE++;
+
+ if( nX < nWidth )
+ rAcc.SetPixel( nY, nX++, cTmp >> 4 );
+
+ if( nX < nWidth )
+ rAcc.SetPixel( nY, nX++, cTmp & 0x0f );
+ }
+
+ if( nRunByte & 1 )
+ {
+ if( nX < nWidth )
+ rAcc.SetPixel( nY, nX++, *pRLE >> 4 );
+
+ pRLE++;
+ }
+
+ if( ( ( nRunByte + 1 ) >> 1 ) & 1 )
+ pRLE++;
+ }
+ else
+ {
+ for( ULONG i = 0UL; i < nRunByte; i++ )
+ {
+ if( nX < nWidth )
+ rAcc.SetPixel( nY, nX++, *pRLE );
+
+ pRLE++;
+ }
+
+ if( nRunByte & 1 )
+ pRLE++;
+ }
+ }
+ else if( !nRunByte )
+ {
+ nY--;
+ nX = 0UL;
+ }
+ else if( nRunByte == 1 )
+ bEndDecoding = TRUE;
+ else
+ {
+ nX += *pRLE++;
+ nY -= *pRLE++;
+ }
+ }
+ else
+ {
+ cTmp = *pRLE++;
+
+ if( bRLE4 )
+ {
+ nRunByte = nCountByte >> 1;
+
+ for( ULONG i = 0UL; i < nRunByte; i++ )
+ {
+ if( nX < nWidth )
+ rAcc.SetPixel( nY, nX++, cTmp >> 4 );
+
+ if( nX < nWidth )
+ rAcc.SetPixel( nY, nX++, cTmp & 0x0f );
+ }
+
+ if( ( nCountByte & 1 ) && ( nX < nWidth ) )
+ rAcc.SetPixel( nY, nX++, cTmp >> 4 );
+ }
+ else
+ {
+ for( ULONG i = 0UL; ( i < nCountByte ) && ( nX < nWidth ); i++ )
+ rAcc.SetPixel( nY, nX++, cTmp );
+ }
+ }
+ }
+ while ( !bEndDecoding && ( nY >= 0L ) );
+}
+
+// ------------------------------------------------------------------
+
+BOOL Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bRLE4 )
+{
+ const ULONG nWidth = rAcc.Width();
+ const ULONG nHeight = rAcc.Height();
+ ULONG nX;
+ ULONG nSaveIndex;
+ ULONG nCount;
+ ULONG nBufCount;
+ BYTE* pBuf = new BYTE[ nWidth << 1 ];
+ BYTE* pTmp;
+ BYTE cPix;
+ BYTE cLast;
+ BOOL bFound;
+
+ for ( long nY = nHeight - 1L; nY >= 0L; nY-- )
+ {
+ pTmp = pBuf;
+ nX = nBufCount = 0UL;
+
+ while( nX < nWidth )
+ {
+ nCount = 1L;
+ cPix = rAcc.GetPixel( nY, nX++ );
+
+ while( ( nX < nWidth ) && ( nCount < 255L ) && ( cPix == rAcc.GetPixel( nY, nX ) ) )
+ {
+ nX++;
+ nCount++;
+ }
+
+ if ( nCount > 1 )
+ {
+ *pTmp++ = (BYTE) nCount;
+ *pTmp++ = ( bRLE4 ? ( ( cPix << 4 ) | cPix ) : cPix );
+ nBufCount += 2;
+ }
+ else
+ {
+ cLast = cPix;
+ nSaveIndex = nX - 1UL;
+ bFound = FALSE;
+
+ while( ( nX < nWidth ) && ( nCount < 256L ) && ( cPix = rAcc.GetPixel( nY, nX ) ) != cLast )
+ {
+ nX++; nCount++;
+ cLast = cPix;
+ bFound = TRUE;
+ }
+
+ if ( bFound )
+ nX--;
+
+ if ( nCount > 3 )
+ {
+ *pTmp++ = 0;
+ *pTmp++ = (BYTE) --nCount;
+
+ if( bRLE4 )
+ {
+ for ( ULONG i = 0; i < nCount; i++, pTmp++ )
+ {
+ *pTmp = (BYTE) rAcc.GetPixel( nY, nSaveIndex++ ) << 4;
+
+ if ( ++i < nCount )
+ *pTmp |= rAcc.GetPixel( nY, nSaveIndex++ );
+ }
+
+ nCount = ( nCount + 1 ) >> 1;
+ }
+ else
+ {
+ for( ULONG i = 0UL; i < nCount; i++ )
+ *pTmp++ = rAcc.GetPixel( nY, nSaveIndex++ );
+ }
+
+ if ( nCount & 1 )
+ {
+ *pTmp++ = 0;
+ nBufCount += ( nCount + 3 );
+ }
+ else
+ nBufCount += ( nCount + 2 );
+ }
+ else
+ {
+ *pTmp++ = 1;
+ *pTmp++ = (BYTE) rAcc.GetPixel( nY, nSaveIndex ) << ( bRLE4 ? 4 : 0 );
+
+ if ( nCount == 3 )
+ {
+ *pTmp++ = 1;
+ *pTmp++ = (BYTE) rAcc.GetPixel( nY, ++nSaveIndex ) << ( bRLE4 ? 4 : 0 );
+ nBufCount += 4;
+ }
+ else
+ nBufCount += 2;
+ }
+ }
+ }
+
+ pBuf[ nBufCount++ ] = 0;
+ pBuf[ nBufCount++ ] = 0;
+
+ rOStm.Write( pBuf, nBufCount );
+ }
+
+ rOStm << (BYTE) 0;
+ rOStm << (BYTE) 1;
+
+ delete[] pBuf;
+
+ return( rOStm.GetError() == 0UL );
+}
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
new file mode 100644
index 000000000000..34776a8b00bf
--- /dev/null
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -0,0 +1,2248 @@
+/*************************************************************************
+ *
+ * $RCSfile: bitmap3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdlib.h>
+#define _SV_BITMAP_CXX
+
+#ifdef W31
+#include <tools/svwin.h>
+#endif
+#include <tools/new.hxx>
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_IMPOCT_HXX
+#include <impoct.hxx>
+#endif
+#ifndef _SV_OCTREE_HXX
+#include <octree.hxx>
+#endif
+#ifndef _SV_IMPVECT_HXX
+#include <impvect.hxx>
+#endif
+#ifndef _SV_BITMAPEX_HXX
+#include <bitmapex.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define RGB15( _def_cR, _def_cG, _def_cB ) (((ULONG)(_def_cR)<<10UL)|((ULONG)(_def_cG)<<5UL)|(ULONG)(_def_cB))
+#define GAMMA( _def_cVal, _def_InvGamma ) ((BYTE)MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0L,255L))
+
+#define CALC_ERRORS \
+ nTemp = p1T[nX++] >> 12; \
+ nBErr = MinMax( nTemp, 0, 255 ); \
+ nBErr = nBErr - FloydIndexMap[ nBC = FloydMap[nBErr] ]; \
+ nTemp = p1T[nX++] >> 12; \
+ nGErr = MinMax( nTemp, 0, 255 ); \
+ nGErr = nGErr - FloydIndexMap[ nGC = FloydMap[nGErr] ]; \
+ nTemp = p1T[nX] >> 12; \
+ nRErr = MinMax( nTemp, 0, 255 ); \
+ nRErr = nRErr - FloydIndexMap[ nRC = FloydMap[nRErr] ];
+
+#define CALC_TABLES3 \
+ p2T[nX++] += FloydError3[nBErr]; \
+ p2T[nX++] += FloydError3[nGErr]; \
+ p2T[nX++] += FloydError3[nRErr];
+
+#define CALC_TABLES5 \
+ p2T[nX++] += FloydError5[nBErr]; \
+ p2T[nX++] += FloydError5[nGErr]; \
+ p2T[nX++] += FloydError5[nRErr];
+
+#define CALC_TABLES7 \
+ p1T[++nX] += FloydError7[nBErr]; \
+ p2T[nX++] += FloydError1[nBErr]; \
+ p1T[nX] += FloydError7[nGErr]; \
+ p2T[nX++] += FloydError1[nGErr]; \
+ p1T[nX] += FloydError7[nRErr]; \
+ p2T[nX] += FloydError1[nRErr];
+
+// -----------
+// - Statics -
+// -----------
+
+ULONG nVCLRLut[ 6 ] = { 16, 17, 18, 19, 20, 21 };
+ULONG nVCLGLut[ 6 ] = { 0, 6, 12, 18, 24, 30 };
+ULONG nVCLBLut[ 6 ] = { 0, 36, 72, 108, 144, 180 };
+
+// ------------------------------------------------------------------------
+
+ULONG nVCLDitherLut[ 256 ] =
+{
+ 0, 49152, 12288, 61440, 3072, 52224, 15360, 64512, 768, 49920, 13056,
+ 62208, 3840, 52992, 16128, 65280, 32768, 16384, 45056, 28672, 35840, 19456,
+ 48128, 31744, 33536, 17152, 45824, 29440, 36608, 20224, 48896, 32512, 8192,
+ 57344, 4096, 53248, 11264, 60416, 7168, 56320, 8960, 58112, 4864, 54016,
+ 12032, 61184, 7936, 57088, 40960, 24576, 36864, 20480, 44032, 27648, 39936,
+ 23552, 41728, 25344, 37632, 21248, 44800, 28416, 40704, 24320, 2048, 51200,
+ 14336, 63488, 1024, 50176, 13312, 62464, 2816, 51968, 15104, 64256, 1792,
+ 50944, 14080, 63232, 34816, 18432, 47104, 30720, 33792, 17408, 46080, 29696,
+ 35584, 19200, 47872, 31488, 34560, 18176, 46848, 30464, 10240, 59392, 6144,
+ 55296, 9216, 58368, 5120, 54272, 11008, 60160, 6912, 56064, 9984, 59136,
+ 5888, 55040, 43008, 26624, 38912, 22528, 41984, 25600, 37888, 21504, 43776,
+ 27392, 39680, 23296, 42752, 26368, 38656, 22272, 512, 49664, 12800, 61952,
+ 3584, 52736, 15872, 65024, 256, 49408, 12544, 61696, 3328, 52480, 15616,
+ 64768, 33280, 16896, 45568, 29184, 36352, 19968, 48640, 32256, 33024, 16640,
+ 45312, 28928, 36096, 19712, 48384, 32000, 8704, 57856, 4608, 53760, 11776,
+ 60928, 7680, 56832, 8448, 57600, 4352, 53504, 11520, 60672, 7424, 56576,
+ 41472, 25088, 37376, 20992, 44544, 28160, 40448, 24064, 41216, 24832, 37120,
+ 20736, 44288, 27904, 40192, 23808, 2560, 51712, 14848, 64000, 1536, 50688,
+ 13824, 62976, 2304, 51456, 14592, 63744, 1280, 50432, 13568, 62720, 35328,
+ 18944, 47616, 31232, 34304, 17920, 46592, 30208, 35072, 18688, 47360, 30976,
+ 34048, 17664, 46336, 29952, 10752, 59904, 6656, 55808, 9728, 58880, 5632,
+ 54784, 10496, 59648, 6400, 55552, 9472, 58624, 5376, 54528, 43520, 27136,
+ 39424, 23040, 42496, 26112, 38400, 22016, 43264, 26880, 39168, 22784, 42240,
+ 25856, 38144, 21760
+};
+
+// ------------------------------------------------------------------------
+
+ULONG nVCLLut[ 256 ] =
+{
+ 0, 1286, 2572, 3858, 5144, 6430, 7716, 9002,
+ 10288, 11574, 12860, 14146, 15432, 16718, 18004, 19290,
+ 20576, 21862, 23148, 24434, 25720, 27006, 28292, 29578,
+ 30864, 32150, 33436, 34722, 36008, 37294, 38580, 39866,
+ 41152, 42438, 43724, 45010, 46296, 47582, 48868, 50154,
+ 51440, 52726, 54012, 55298, 56584, 57870, 59156, 60442,
+ 61728, 63014, 64300, 65586, 66872, 68158, 69444, 70730,
+ 72016, 73302, 74588, 75874, 77160, 78446, 79732, 81018,
+ 82304, 83590, 84876, 86162, 87448, 88734, 90020, 91306,
+ 92592, 93878, 95164, 96450, 97736, 99022,100308,101594,
+ 102880,104166,105452,106738,108024,109310,110596,111882,
+ 113168,114454,115740,117026,118312,119598,120884,122170,
+ 123456,124742,126028,127314,128600,129886,131172,132458,
+ 133744,135030,136316,137602,138888,140174,141460,142746,
+ 144032,145318,146604,147890,149176,150462,151748,153034,
+ 154320,155606,156892,158178,159464,160750,162036,163322,
+ 164608,165894,167180,168466,169752,171038,172324,173610,
+ 174896,176182,177468,178754,180040,181326,182612,183898,
+ 185184,186470,187756,189042,190328,191614,192900,194186,
+ 195472,196758,198044,199330,200616,201902,203188,204474,
+ 205760,207046,208332,209618,210904,212190,213476,214762,
+ 216048,217334,218620,219906,221192,222478,223764,225050,
+ 226336,227622,228908,230194,231480,232766,234052,235338,
+ 236624,237910,239196,240482,241768,243054,244340,245626,
+ 246912,248198,249484,250770,252056,253342,254628,255914,
+ 257200,258486,259772,261058,262344,263630,264916,266202,
+ 267488,268774,270060,271346,272632,273918,275204,276490,
+ 277776,279062,280348,281634,282920,284206,285492,286778,
+ 288064,289350,290636,291922,293208,294494,295780,297066,
+ 298352,299638,300924,302210,303496,304782,306068,307354,
+ 308640,309926,311212,312498,313784,315070,316356,317642,
+ 318928,320214,321500,322786,324072,325358,326644,327930
+};
+
+// ------------------------------------------------------------------------
+
+long FloydMap[256] =
+{
+ 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, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
+};
+
+// ------------------------------------------------------------------------
+
+long FloydError1[61] =
+{
+ -7680, -7424, -7168, -6912, -6656, -6400, -6144,
+ -5888, -5632, -5376, -5120, -4864, -4608, -4352,
+ -4096, -3840, -3584, -3328, -3072, -2816, -2560,
+ -2304, -2048, -1792, -1536, -1280, -1024, -768,
+ -512, -256, 0, 256, 512, 768, 1024, 1280, 1536,
+ 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584,
+ 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632,
+ 5888, 6144, 6400, 6656, 6912, 7168, 7424, 7680
+};
+
+// ------------------------------------------------------------------------
+
+long FloydError3[61] =
+{
+ -23040, -22272, -21504, -20736, -19968, -19200,
+ -18432, -17664, -16896, -16128, -15360, -14592,
+ -13824, -13056, -12288, -11520, -10752, -9984,
+ -9216, -8448, -7680, -6912, -6144, -5376, -4608,
+ -3840, -3072, -2304, -1536, -768, 0, 768, 1536,
+ 2304, 3072, 3840, 4608, 5376, 6144, 6912, 7680,
+ 8448, 9216, 9984, 10752, 11520, 12288, 13056,
+ 13824, 14592, 15360, 16128, 16896, 17664, 18432,
+ 19200, 19968, 20736, 21504, 22272, 23040
+};
+
+// ------------------------------------------------------------------------
+
+long FloydError5[61] =
+{
+ -38400, -37120, -35840, -34560, -33280, -32000,
+ -30720, -29440, -28160, -26880, -25600, -24320,
+ -23040, -21760, -20480, -19200, -17920, -16640,
+ -15360, -14080, -12800, -11520, -10240, -8960,
+ -7680, -6400, -5120, -3840, -2560, -1280, 0,
+ 1280, 2560, 3840, 5120, 6400, 7680, 8960, 10240,
+ 11520, 12800, 14080, 15360, 16640, 17920, 19200,
+ 20480, 21760, 23040, 24320, 25600, 26880, 28160,
+ 29440, 30720, 32000, 33280, 34560, 35840, 37120,
+ 38400
+};
+
+// ------------------------------------------------------------------------
+
+long FloydError7[61] =
+{
+ -53760, -51968, -50176, -48384, -46592, -44800,
+ -43008, -41216, -39424, -37632, -35840, -34048,
+ -32256, -30464, -28672, -26880, -25088, -23296,
+ -21504, -19712, -17920, -16128, -14336, -12544,
+ -10752, -8960, -7168, -5376, -3584, -1792, 0,
+ 1792, 3584, 5376, 7168, 8960, 10752, 12544, 14336,
+ 16128, 17920, 19712, 21504, 23296, 25088, 26880,
+ 28672, 30464, 32256, 34048, 35840, 37632, 39424,
+ 41216, 43008, 44800, 46592, 48384, 50176, 51968,
+ 53760
+};
+
+// ------------------------------------------------------------------------
+
+long FloydIndexMap[6] =
+{
+ -30, 21, 72, 123, 174, 225
+};
+
+// --------------------------
+// - ImplCreateDitherMatrix -
+// --------------------------
+
+void ImplCreateDitherMatrix( BYTE (*pDitherMatrix)[16][16] )
+{
+ double fVal = 3.125;
+ const double fVal16 = fVal / 16.;
+ long i, j, k, l;
+ USHORT pMtx[ 16 ][ 16 ];
+ USHORT nMax = 0;
+ static BYTE pMagic[4][4] = { 0, 14, 3, 13,
+ 11, 5, 8, 6,
+ 12, 2, 15, 1,
+ 7, 9, 4, 10 };
+
+ // MagicSquare aufbauen
+ for ( i = 0; i < 4; i++ )
+ for ( j = 0; j < 4; j++ )
+ for ( k = 0; k < 4; k++ )
+ for ( l = 0; l < 4; l++ )
+ nMax = Max ( pMtx[ (k<<2) + i][(l<<2 ) + j] =
+ (USHORT) ( 0.5 + pMagic[i][j]*fVal + pMagic[k][l]*fVal16 ), nMax );
+
+ // auf Intervall [0;254] skalieren
+ for ( i = 0, fVal = 254. / nMax; i < 16; i++ )
+ for( j = 0; j < 16; j++ )
+ (*pDitherMatrix)[i][j] = (BYTE) ( fVal * pMtx[i][j] );
+}
+
+// ----------
+// - Bitmap -
+// ----------
+
+BOOL Bitmap::Convert( BmpConversion eConversion )
+{
+ const USHORT nBitCount = GetBitCount();
+ BOOL bRet = FALSE;
+
+ switch( eConversion )
+ {
+ case( BMP_CONVERSION_1BIT_THRESHOLD ):
+ bRet = ImplMakeMono( 128 );
+ break;
+
+ case( BMP_CONVERSION_1BIT_MATRIX ):
+ bRet = ImplMakeMonoDither();
+ break;
+
+ case( BMP_CONVERSION_4BIT_GREYS ):
+ bRet = ImplMakeGreyscales( 16 );
+ break;
+
+ case( BMP_CONVERSION_4BIT_COLORS ):
+ {
+ if( nBitCount < 4 )
+ bRet = ImplConvertUp( 4, NULL );
+ else if( nBitCount > 4 )
+ bRet = ImplConvertDown( 4, NULL );
+ else
+ bRet = TRUE;
+ }
+ break;
+
+ case( BMP_CONVERSION_4BIT_TRANS ):
+ {
+ Color aTrans( BMP_COL_TRANS );
+
+ if( nBitCount < 4 )
+ bRet = ImplConvertUp( 4, &aTrans );
+ else
+ bRet = ImplConvertDown( 4, &aTrans );
+ }
+ break;
+
+ case( BMP_CONVERSION_8BIT_GREYS ):
+ bRet = ImplMakeGreyscales( 256 );
+ break;
+
+ case( BMP_CONVERSION_8BIT_COLORS ):
+ {
+ if( nBitCount < 8 )
+ bRet = ImplConvertUp( 8 );
+ else if( nBitCount > 8 )
+ bRet = ImplConvertDown( 8 );
+ else
+ bRet = TRUE;
+ }
+ break;
+
+ case( BMP_CONVERSION_8BIT_TRANS ):
+ {
+ Color aTrans( BMP_COL_TRANS );
+
+ if( nBitCount < 8 )
+ bRet = ImplConvertUp( 8, &aTrans );
+ else
+ bRet = ImplConvertDown( 8, &aTrans );
+ }
+ break;
+
+ case( BMP_CONVERSION_24BIT ):
+ {
+ if( nBitCount < 24 )
+ bRet = ImplConvertUp( 24, FALSE );
+ else
+ bRet = TRUE;
+ }
+ break;
+
+ case( BMP_CONVERSION_GHOSTED ):
+ bRet = ImplConvertGhosted();
+ break;
+
+ default:
+ DBG_ERROR( "Bitmap::Convert(): Unsupported conversion" );
+ break;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplMakeMono( BYTE cThreshold )
+{
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ Bitmap aNewBmp( GetSizePixel(), 1 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const BitmapColor aBlack( pWriteAcc->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >=
+ cThreshold )
+ {
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ }
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pReadAcc->GetPixel( nY, nX ).GetLuminance() >=
+ cThreshold )
+ {
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ }
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplMakeMonoDither()
+{
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ Bitmap aNewBmp( GetSizePixel(), 1 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const BitmapColor aBlack( pWriteAcc->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ const BitmapColor aWhite( pWriteAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+ BYTE pDitherMatrix[ 16 ][ 16 ];
+
+ ImplCreateDitherMatrix( &pDitherMatrix );
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L, nModY = nY % 16; nX < nWidth; nX++ )
+ {
+ if( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >
+ pDitherMatrix[ nModY ][ nX % 16 ] )
+ {
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ }
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L, nModY = nY % 16; nX < nWidth; nX++ )
+ {
+ if( pReadAcc->GetPixel( nY, nX ).GetLuminance() >
+ pDitherMatrix[ nModY ][ nX % 16 ] )
+ {
+ pWriteAcc->SetPixel( nY, nX, aWhite );
+ }
+ else
+ pWriteAcc->SetPixel( nY, nX, aBlack );
+ }
+ }
+ }
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys )
+{
+ DBG_ASSERT( nGreys == 16 || nGreys == 256, "Only 16 or 256 greyscales are supported!" )
+
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ const BitmapPalette& rPal = GetGreyPalette( nGreys );
+ ULONG nShift = ( ( nGreys == 16 ) ? 4UL : 0UL );
+ BOOL bPalDiffers = !pReadAcc->HasPalette() || ( rPal.GetEntryCount() != pReadAcc->GetPaletteEntryCount() );
+
+ if( !bPalDiffers )
+ bPalDiffers = ( (BitmapPalette&) rPal != pReadAcc->GetPalette() );
+
+ if( bPalDiffers )
+ {
+ Bitmap aNewBmp( GetSizePixel(), ( nGreys == 16 ) ? 4 : 8, &rPal );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ pWriteAcc->SetPixel( nY, nX,
+ (BYTE) ( pReadAcc->GetPaletteColor(
+ pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift ) );
+ }
+ }
+ }
+ else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR &&
+ pWriteAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ {
+ nShift += 8;
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ Scanline pReadScan = pReadAcc->GetScanline( nY );
+ Scanline pWriteScan = pWriteAcc->GetScanline( nY );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ const ULONG nB = *pReadScan++;
+ const ULONG nG = *pReadScan++;
+ const ULONG nR = *pReadScan++;
+
+ *pWriteScan++ = (BYTE) ( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift );
+ }
+ }
+ }
+ else if( pReadAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB &&
+ pWriteAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ {
+ nShift += 8;
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ Scanline pReadScan = pReadAcc->GetScanline( nY );
+ Scanline pWriteScan = pWriteAcc->GetScanline( nY );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ const ULONG nR = *pReadScan++;
+ const ULONG nG = *pReadScan++;
+ const ULONG nB = *pReadScan++;
+
+ *pWriteScan++ = (BYTE) ( ( nB * 28UL + nG * 151UL + nR * 77UL ) >> nShift );
+ }
+ }
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, ( pReadAcc->GetPixel( nY, nX ) ).GetLuminance() >> nShift );
+ }
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+ else
+ {
+ ReleaseAccess( pReadAcc );
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplConvertUp( USHORT nBitCount, Color* pExtColor )
+{
+ DBG_ASSERT( nBitCount > GetBitCount(), "New BitCount must be greater!" );
+
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ BitmapPalette aPal;
+ Bitmap aNewBmp( GetSizePixel(), nBitCount, &aPal );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+
+ if( pWriteAcc->HasPalette() )
+ {
+ const USHORT nOldCount = 1 << GetBitCount();
+ const BitmapPalette& rOldPal = pReadAcc->GetPalette();
+
+ aPal.SetEntryCount( 1 << nBitCount );
+
+ for( USHORT i = 0; i < nOldCount; i++ )
+ aPal[ i ] = rOldPal[ i ];
+
+ if( pExtColor )
+ aPal[ aPal.GetEntryCount() - 1 ] = *pExtColor;
+
+ pWriteAcc->SetPalette( aPal );
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nY, nX ) );
+ }
+ else
+ {
+ if( pReadAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ) );
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, pReadAcc->GetPixel( nY, nX ) );
+ }
+ }
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplConvertDown( USHORT nBitCount, Color* pExtColor )
+{
+ DBG_ASSERT( nBitCount <= GetBitCount(), "New BitCount must be lower ( or equal when pExtColor is set )!" );
+
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ BitmapPalette aPal;
+ Bitmap aNewBmp( GetSizePixel(), nBitCount, &aPal );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const USHORT nCount = 1 << nBitCount;
+ const long nWidth = pWriteAcc->Width();
+ const long nWidth1 = nWidth - 1L;
+ const long nHeight = pWriteAcc->Height();
+ Octree aOctree( *pReadAcc, pExtColor ? ( nCount - 1 ) : nCount );
+ InverseColorMap aColorMap( aPal = aOctree.GetPalette() );
+ BitmapColor aColor;
+ ImpErrorQuad aErrQuad;
+ ImpErrorQuad* pErrQuad1 = new ImpErrorQuad[ nWidth ];
+ ImpErrorQuad* pErrQuad2 = new ImpErrorQuad[ nWidth ];
+ ImpErrorQuad* pQLine1 = pErrQuad1;
+ ImpErrorQuad* pQLine2;
+ long nX, nY;
+ long nYTmp = 0L;
+ BYTE cIndex;
+ BOOL bQ1 = TRUE;
+
+ if( pExtColor )
+ {
+ aPal.SetEntryCount( aPal.GetEntryCount() + 1 );
+ aPal[ aPal.GetEntryCount() - 1 ] = *pExtColor;
+ }
+
+ // set Black/White always, if we have enough space
+ if( aPal.GetEntryCount() < ( nCount - 1 ) )
+ {
+ aPal.SetEntryCount( aPal.GetEntryCount() + 2 );
+ aPal[ aPal.GetEntryCount() - 2 ] = Color( COL_BLACK );
+ aPal[ aPal.GetEntryCount() - 1 ] = Color( COL_WHITE );
+ }
+
+ pWriteAcc->SetPalette( aPal );
+
+ for( nY = 0L; nY < Min( nHeight, 2L ); nY++, nYTmp++ )
+ {
+ for( nX = 0L, pQLine2 = !nY ? pErrQuad1 : pErrQuad2; nX < nWidth; nX++ )
+ {
+ if( pReadAcc->HasPalette() )
+ pQLine2[ nX ] = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nYTmp, nX ) );
+ else
+ pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
+ }
+ }
+
+ for( nY = 0L; nY < nHeight; nY++, nYTmp++ )
+ {
+ // erstes ZeilenPixel
+ cIndex = (BYTE) aColorMap.GetBestPaletteIndex( pQLine1[ 0 ].ImplGetColor() );
+ pWriteAcc->SetPixel( nY, 0, cIndex );
+
+ for( nX = 1L; nX < nWidth1; nX++ )
+ {
+ cIndex = (BYTE) aColorMap.GetBestPaletteIndex( aColor = pQLine1[ nX ].ImplGetColor() );
+ aErrQuad = ( ImpErrorQuad( aColor ) -= pWriteAcc->GetPaletteColor( cIndex ) );
+ pQLine1[ ++nX ].ImplAddColorError7( aErrQuad );
+ pQLine2[ nX-- ].ImplAddColorError1( aErrQuad );
+ pQLine2[ nX-- ].ImplAddColorError5( aErrQuad );
+ pQLine2[ nX++ ].ImplAddColorError3( aErrQuad );
+ pWriteAcc->SetPixel( nY, nX, cIndex );
+ }
+
+ // letztes ZeilenPixel
+ cIndex = (BYTE) aColorMap.GetBestPaletteIndex( pQLine1[ nWidth1 ].ImplGetColor() );
+ pWriteAcc->SetPixel( nY, nX, cIndex );
+
+ // Zeilenpuffer neu fuellen/kopieren
+ pQLine1 = pQLine2;
+ pQLine2 = ( bQ1 = !bQ1 ) ? pErrQuad2 : pErrQuad1;
+
+ if( nYTmp < nHeight )
+ {
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ if( pReadAcc->HasPalette() )
+ pQLine2[ nX ] = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nYTmp, nX ) );
+ else
+ pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
+ }
+ }
+ }
+
+ // Zeilenpuffer zerstoeren
+ delete[] pErrQuad1;
+ delete[] pErrQuad2;
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplConvertGhosted()
+{
+ Bitmap aNewBmp;
+ BitmapReadAccess* pR = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pR )
+ {
+ if( pR->HasPalette() )
+ {
+ BitmapPalette aNewPal( pR->GetPaletteEntryCount() );
+
+ for( long i = 0, nCount = aNewPal.GetEntryCount(); i < nCount; i++ )
+ {
+ const BitmapColor& rOld = pR->GetPaletteColor( (USHORT) i );
+ aNewPal[ (USHORT) i ] = BitmapColor( ( rOld.GetRed() >> 1 ) | 0x80,
+ ( rOld.GetGreen() >> 1 ) | 0x80,
+ ( rOld.GetBlue() >> 1 ) | 0x80 );
+ }
+
+ aNewBmp = Bitmap( GetSizePixel(), GetBitCount(), &aNewPal );
+ BitmapWriteAccess* pW = aNewBmp.AcquireWriteAccess();
+
+ if( pW )
+ {
+ pW->CopyBuffer( *pR );
+ aNewBmp.ReleaseAccess( pW );
+ bRet = TRUE;
+ }
+ }
+ else
+ {
+ aNewBmp = Bitmap( GetSizePixel(), 24 );
+
+ BitmapWriteAccess* pW = aNewBmp.AcquireWriteAccess();
+
+ if( pW )
+ {
+ const long nWidth = pR->Width(), nHeight = pR->Height();
+
+ for( long nY = 0; nY < nHeight; nY++ )
+ {
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ const BitmapColor aOld( pR->GetPixel( nY, nX ) );
+ pW->SetPixel( nY, nX, BitmapColor( ( aOld.GetRed() >> 1 ) | 0x80,
+ ( aOld.GetGreen() >> 1 ) | 0x80,
+ ( aOld.GetBlue() >> 1 ) | 0x80 ) );
+
+ }
+ }
+
+ aNewBmp.ReleaseAccess( pW );
+ bRet = TRUE;
+ }
+ }
+
+ ReleaseAccess( pR );
+ }
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag )
+{
+ BOOL bRet;
+
+ if( ( rScaleX != 1.0 ) || ( rScaleY != 1.0 ) )
+ {
+ if( BMP_SCALE_FAST == nScaleFlag )
+ bRet = ImplScaleFast( rScaleX, rScaleY );
+ else if( BMP_SCALE_INTERPOLATE == nScaleFlag )
+ bRet = ImplScaleInterpolate( rScaleX, rScaleY );
+ else
+ bRet = FALSE;
+ }
+ else
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::Scale( const Size& rNewSize, ULONG nScaleFlag )
+{
+ const Size aSize( GetSizePixel() );
+ BOOL bRet;
+
+ if( aSize.Width() && aSize.Height() )
+ {
+ bRet = Scale( (double) rNewSize.Width() / aSize.Width(),
+ (double) rNewSize.Height() / aSize.Height(),
+ nScaleFlag );
+ }
+ else
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
+{
+ const Size aSizePix( GetSizePixel() );
+ const long nNewWidth = FRound( aSizePix.Width() * rScaleX );
+ const long nNewHeight = FRound( aSizePix.Height() * rScaleY );
+ BOOL bRet = FALSE;
+
+ if( nNewWidth && nNewHeight )
+ {
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ Bitmap aNewBmp( Size( nNewWidth, nNewHeight ), GetBitCount(), &pReadAcc->GetPalette() );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pReadAcc && pWriteAcc )
+ {
+ const long nScanlineSize = pWriteAcc->GetScanlineSize();
+ const long nNewWidth1 = nNewWidth - 1L;
+ const long nNewHeight1 = nNewHeight - 1L;
+ const long nWidth1 = pReadAcc->Width() - 1L;
+ const long nHeight1 = pReadAcc->Height() - 1L;
+ long* pLutX = new long[ nNewWidth ];
+ long* pLutY = new long[ nNewHeight ];
+ long nX, nY, nMapY, nActY = 0L;
+
+ if( nNewWidth1 && nNewHeight1 )
+ {
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ pLutX[ nX ] = nX * nWidth1 / nNewWidth1;
+
+ for( nY = 0L; nY < nNewHeight; nY++ )
+ pLutY[ nY ] = nY * nHeight1 / nNewHeight1;
+
+ while( nActY < nNewHeight )
+ {
+ nMapY = pLutY[ nActY ];
+
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ pWriteAcc->SetPixel( nActY, nX, pReadAcc->GetPixel( nMapY , pLutX[ nX ] ) );
+
+ while( ( nActY < nNewHeight1 ) && ( pLutY[ nActY + 1 ] == nMapY ) )
+ {
+ HMEMCPY( pWriteAcc->GetScanline( nActY + 1L ),
+ pWriteAcc->GetScanline( nActY ), nScanlineSize );
+ nActY++;
+ }
+
+ nActY++;
+ }
+
+ bRet = TRUE;
+ }
+
+ delete[] pLutX;
+ delete[] pLutY;
+ }
+
+ ReleaseAccess( pReadAcc );
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ ImplAssignWithSize( aNewBmp );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rScaleY )
+{
+ const Size aSizePix( GetSizePixel() );
+ const long nNewWidth = FRound( aSizePix.Width() * rScaleX );
+ const long nNewHeight = FRound( aSizePix.Height() * rScaleY );
+ BOOL bRet = FALSE;
+
+ if( ( nNewWidth > 1L ) && ( nNewHeight > 1L ) )
+ {
+ BitmapColor aCol0;
+ BitmapColor aCol1;
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ long nWidth = pReadAcc->Width();
+ long nHeight = pReadAcc->Height();
+ Bitmap aNewBmp( Size( nNewWidth, nHeight ), 24 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+ long* pLutInt;
+ long* pLutFrac;
+ long nX, nY;
+ long lXB0, lXB1, lXG0, lXG1, lXR0, lXR1;
+ double fTemp;
+ long nTemp;
+
+ if( pReadAcc && pWriteAcc )
+ {
+ const long nNewWidth1 = nNewWidth - 1L;
+ const long nWidth1 = pReadAcc->Width() - 1L;
+ const double fRevScaleX = (double) nWidth1 / nNewWidth1;
+
+ pLutInt = new long[ nNewWidth ];
+ pLutFrac = new long[ nNewWidth ];
+
+ for( nX = 0L, nTemp = nWidth - 2L; nX < nNewWidth; nX++ )
+ {
+ fTemp = nX * fRevScaleX;
+ pLutInt[ nX ] = MinMax( (long) fTemp, 0, nTemp );
+ fTemp -= pLutInt[ nX ];
+ pLutFrac[ nX ] = (long) ( fTemp * 1024. );
+ }
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ if( 1 == nWidth )
+ {
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, 0 ) );
+
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ else
+ {
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ {
+ nTemp = pLutInt[ nX ];
+
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nTemp++ ) );
+ aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nTemp ) );
+
+ nTemp = pLutFrac[ nX ];
+
+ lXR1 = aCol1.GetRed() - ( lXR0 = aCol0.GetRed() );
+ lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() );
+ lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() );
+
+ aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) );
+ aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) );
+ aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) );
+
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ if( 1 == nWidth )
+ {
+ aCol0 = pReadAcc->GetPixel( nY, 0 );
+
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ else
+ {
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ {
+ nTemp = pLutInt[ nX ];
+
+ aCol0 = pReadAcc->GetPixel( nY, nTemp++ );
+ aCol1 = pReadAcc->GetPixel( nY, nTemp );
+
+ nTemp = pLutFrac[ nX ];
+
+ lXR1 = aCol1.GetRed() - ( lXR0 = aCol0.GetRed() );
+ lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() );
+ lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() );
+
+ aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) );
+ aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) );
+ aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) );
+
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ }
+ }
+ }
+
+ delete[] pLutInt;
+ delete[] pLutFrac;
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ {
+ bRet = FALSE;
+ ImplAssignWithSize( aNewBmp );
+ pReadAcc = AcquireReadAccess();
+ aNewBmp = Bitmap( Size( nNewWidth, nNewHeight ), 24 );
+ pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pReadAcc && pWriteAcc )
+ {
+ const long nNewHeight1 = nNewHeight - 1L;
+ const long nHeight1 = pReadAcc->Height() - 1L;
+ const double fRevScaleY = (double) nHeight1 / nNewHeight1;
+
+ pLutInt = new long[ nNewHeight ];
+ pLutFrac = new long[ nNewHeight ];
+
+ for( nY = 0L, nTemp = nHeight - 2L; nY < nNewHeight; nY++ )
+ {
+ fTemp = nY * fRevScaleY;
+ pLutInt[ nY ] = MinMax( (long) fTemp, 0, nTemp );
+ fTemp -= pLutInt[ nY ];
+ pLutFrac[ nY ] = (long) ( fTemp * 1024. );
+ }
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ {
+ if( 1 == nHeight )
+ {
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( 0, nX ) );
+
+ for( nY = 0L; nY < nNewHeight; nY++ )
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ else
+ {
+ for( nY = 0L; nY < nNewHeight; nY++ )
+ {
+ nTemp = pLutInt[ nY ];
+
+ aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nTemp++, nX ) );
+ aCol1 = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nTemp, nX ) );
+
+ nTemp = pLutFrac[ nY ];
+
+ lXR1 = aCol1.GetRed() - ( lXR0 = aCol0.GetRed() );
+ lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() );
+ lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() );
+
+ aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) );
+ aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) );
+ aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) );
+
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ }
+ }
+ }
+ else
+ {
+ for( nX = 0L; nX < nNewWidth; nX++ )
+ {
+ if( 1 == nHeight )
+ {
+ aCol0 = pReadAcc->GetPixel( 0, nX );
+
+ for( nY = 0L; nY < nNewHeight; nY++ )
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ else
+ {
+ for( nY = 0L; nY < nNewHeight; nY++ )
+ {
+ nTemp = pLutInt[ nY ];
+
+ aCol0 = pReadAcc->GetPixel( nTemp++, nX );
+ aCol1 = pReadAcc->GetPixel( nTemp, nX );
+
+ nTemp = pLutFrac[ nY ];
+
+ lXR1 = aCol1.GetRed() - ( lXR0 = aCol0.GetRed() );
+ lXG1 = aCol1.GetGreen() - ( lXG0 = aCol0.GetGreen() );
+ lXB1 = aCol1.GetBlue() - ( lXB0 = aCol0.GetBlue() );
+
+ aCol0.SetRed( (BYTE) ( ( lXR1 * nTemp + ( lXR0 << 10 ) ) >> 10 ) );
+ aCol0.SetGreen( (BYTE) ( ( lXG1 * nTemp + ( lXG0 << 10 ) ) >> 10 ) );
+ aCol0.SetBlue( (BYTE) ( ( lXB1 * nTemp + ( lXB0 << 10 ) ) >> 10 ) );
+
+ pWriteAcc->SetPixel( nY, nX, aCol0 );
+ }
+ }
+ }
+ }
+
+ delete[] pLutInt;
+ delete[] pLutFrac;
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ ImplAssignWithSize( aNewBmp );
+ }
+ }
+
+ if( !bRet )
+ bRet = ImplScaleFast( rScaleX, rScaleY );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::Dither( ULONG nDitherFlags, const BitmapPalette* pDitherPal )
+{
+ DBG_ASSERT( !pDitherPal, "Sorry, using owner defined palettes is not yet supportet..." );
+
+ BOOL bRet = FALSE;
+
+ const Size aSizePix( GetSizePixel() );
+
+ if( aSizePix.Width() == 1 || aSizePix.Height() == 1 )
+ bRet = TRUE;
+ else if( nDitherFlags & BMP_DITHER_MATRIX )
+ bRet = ImplDitherMatrix( pDitherPal );
+ else if( nDitherFlags & BMP_DITHER_FLOYD )
+ bRet = ImplDitherFloyd( pDitherPal );
+ else if( ( nDitherFlags & BMP_DITHER_FLOYD_16 ) && ( GetBitCount() == 24 ) )
+ bRet = ImplDitherFloyd16();
+
+ return bRet;
+}
+
+//fuer WIN16 Borland
+#ifdef WIN
+#pragma codeseg BITMAP3_SEG1
+#endif
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplDitherMatrix( const BitmapPalette* pDitherPal )
+{
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ Bitmap aNewBmp( GetSizePixel(), 8 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc && pWriteAcc )
+ {
+ const ULONG nWidth = pReadAcc->Width();
+ const ULONG nHeight = pReadAcc->Height();
+ BitmapColor aIndex( (BYTE) 0 );
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( ULONG nY = 0UL; nY < nHeight; nY++ )
+ {
+ for( ULONG nX = 0UL, nModY = ( nY & 0x0FUL ) << 4UL; nX < nWidth; nX++ )
+ {
+ const BitmapColor aCol( pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nX ) ) );
+ const ULONG nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
+ const ULONG nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16UL;
+ const ULONG nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16UL;
+ const ULONG nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16UL;
+
+ aIndex.SetIndex( (BYTE) ( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
+ pWriteAcc->SetPixel( nY, nX, aIndex );
+ }
+ }
+ }
+ else
+ {
+ for( ULONG nY = 0UL; nY < nHeight; nY++ )
+ {
+ for( ULONG nX = 0UL, nModY = ( nY & 0x0FUL ) << 4UL; nX < nWidth; nX++ )
+ {
+ const BitmapColor aCol( pReadAcc->GetPixel( nY, nX ) );
+ const ULONG nD = nVCLDitherLut[ nModY + ( nX & 0x0FUL ) ];
+ const ULONG nR = ( nVCLLut[ aCol.GetRed() ] + nD ) >> 16UL;
+ const ULONG nG = ( nVCLLut[ aCol.GetGreen() ] + nD ) >> 16UL;
+ const ULONG nB = ( nVCLLut[ aCol.GetBlue() ] + nD ) >> 16UL;
+
+ aIndex.SetIndex( (BYTE) ( nVCLRLut[ nR ] + nVCLGLut[ nG ] + nVCLBLut[ nB ] ) );
+ pWriteAcc->SetPixel( nY, nX, aIndex );
+ }
+ }
+ }
+
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplDitherFloyd( const BitmapPalette* pDitherPal )
+{
+ const Size aSize( GetSizePixel() );
+ BOOL bRet = FALSE;
+
+ if( ( aSize.Width() > 3 ) && ( aSize.Height() > 2 ) )
+ {
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ Bitmap aNewBmp( GetSizePixel(), 8 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pReadAcc && pWriteAcc )
+ {
+ BitmapColor aColor;
+ long nWidth = pReadAcc->Width();
+ long nWidth1 = nWidth - 1L;
+ long nHeight = pReadAcc->Height();
+ long nX;
+ long nW = nWidth * 3L;
+ long nW2 = nW - 3L;
+ long nWLen = nW << 2;
+ long nRErr, nGErr, nBErr;
+ long nRC, nGC, nBC;
+ long nTemp;
+ long nZ;
+ long* p1 = new long[ nW ];
+ long* p2 = new long[ nW ];
+ long* p1T = p1;
+ long* p2T = p2;
+ long* pTmp;
+ BOOL bPal = pReadAcc->HasPalette();
+
+ pTmp = p2T;
+
+ if( bPal )
+ {
+ for( nZ = 0; nZ < nWidth; nZ++ )
+ {
+ aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( 0, nZ ) );
+
+ *pTmp++ = (long) aColor.GetBlue() << 12;
+ *pTmp++ = (long) aColor.GetGreen() << 12;
+ *pTmp++ = (long) aColor.GetRed() << 12;
+ }
+ }
+ else
+ {
+ for( nZ = 0; nZ < nWidth; nZ++ )
+ {
+ aColor = pReadAcc->GetPixel( 0, nZ );
+
+ *pTmp++ = (long) aColor.GetBlue() << 12;
+ *pTmp++ = (long) aColor.GetGreen() << 12;
+ *pTmp++ = (long) aColor.GetRed() << 12;
+ }
+ }
+
+ for( long nY = 1, nYAcc = 0L; nY <= nHeight; nY++, nYAcc++ )
+ {
+ pTmp = p1T;
+ p1T = p2T;
+ p2T = pTmp;
+
+ if( nY < nHeight )
+ {
+ if( bPal )
+ {
+ for( nZ = 0; nZ < nWidth; nZ++ )
+ {
+ aColor = pReadAcc->GetPaletteColor( pReadAcc->GetPixel( nY, nZ ) );
+
+ *pTmp++ = (long) aColor.GetBlue() << 12;
+ *pTmp++ = (long) aColor.GetGreen() << 12;
+ *pTmp++ = (long) aColor.GetRed() << 12;
+ }
+ }
+ else
+ {
+ for( nZ = 0; nZ < nWidth; nZ++ )
+ {
+ aColor = pReadAcc->GetPixel( nY, nZ );
+
+ *pTmp++ = (long) aColor.GetBlue() << 12;
+ *pTmp++ = (long) aColor.GetGreen() << 12;
+ *pTmp++ = (long) aColor.GetRed() << 12;
+ }
+ }
+ }
+
+ // erstes Pixel gesondert betrachten
+ nX = 0;
+ CALC_ERRORS;
+ CALC_TABLES7;
+ nX -= 5;
+ CALC_TABLES5;
+ pWriteAcc->SetPixel( nYAcc, 0, BitmapColor( (BYTE) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) );
+
+ // mittlere Pixel ueber Schleife
+ for ( long nX = 3L, nXAcc = 1L; nX < nW2; nXAcc++ )
+ {
+ CALC_ERRORS;
+ CALC_TABLES7;
+ nX -= 8;
+ CALC_TABLES3;
+ CALC_TABLES5;
+ pWriteAcc->SetPixel( nYAcc, nXAcc, BitmapColor( (BYTE) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) );
+ }
+
+ // letztes Pixel gesondert betrachten
+ CALC_ERRORS;
+ nX -= 5;
+ CALC_TABLES3;
+ CALC_TABLES5;
+ pWriteAcc->SetPixel( nYAcc, nWidth1, BitmapColor( (BYTE) ( nVCLBLut[ nBC ] + nVCLGLut[nGC ] + nVCLRLut[nRC ] ) ) );
+ }
+
+ delete[] p1;
+ delete[] p2;
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplDitherFloyd16()
+{
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ Bitmap aNewBmp( GetSizePixel(), 24 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc && pWriteAcc )
+ {
+ const long nWidth = pWriteAcc->Width();
+ const long nWidth1 = nWidth - 1L;
+ const long nHeight = pWriteAcc->Height();
+ BitmapColor aColor;
+ BitmapColor aBestCol;
+ ImpErrorQuad aErrQuad;
+ ImpErrorQuad* pErrQuad1 = new ImpErrorQuad[ nWidth ];
+ ImpErrorQuad* pErrQuad2 = new ImpErrorQuad[ nWidth ];
+ ImpErrorQuad* pQLine1 = pErrQuad1;
+ ImpErrorQuad* pQLine2;
+ long nX, nY;
+ long nYTmp = 0L;
+ BOOL bQ1 = TRUE;
+
+ for( nY = 0L; nY < Min( nHeight, 2L ); nY++, nYTmp++ )
+ for( nX = 0L, pQLine2 = !nY ? pErrQuad1 : pErrQuad2; nX < nWidth; nX++ )
+ pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
+
+ for( nY = 0L; nY < nHeight; nY++, nYTmp++ )
+ {
+ // erstes ZeilenPixel
+ aBestCol = pQLine1[ 0 ].ImplGetColor();
+ aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
+ aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
+ aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
+ pWriteAcc->SetPixel( nY, 0, aBestCol );
+
+ for( nX = 1L; nX < nWidth1; nX++ )
+ {
+ aColor = pQLine1[ nX ].ImplGetColor();
+ aBestCol.SetRed( ( aColor.GetRed() & 248 ) | 7 );
+ aBestCol.SetGreen( ( aColor.GetGreen() & 248 ) | 7 );
+ aBestCol.SetBlue( ( aColor.GetBlue() & 248 ) | 7 );
+ aErrQuad = ( ImpErrorQuad( aColor ) -= aBestCol );
+ pQLine1[ ++nX ].ImplAddColorError7( aErrQuad );
+ pQLine2[ nX-- ].ImplAddColorError1( aErrQuad );
+ pQLine2[ nX-- ].ImplAddColorError5( aErrQuad );
+ pQLine2[ nX++ ].ImplAddColorError3( aErrQuad );
+ pWriteAcc->SetPixel( nY, nX, aBestCol );
+ }
+
+ // letztes ZeilenPixel
+ aBestCol = pQLine1[ nWidth1 ].ImplGetColor();
+ aBestCol.SetRed( ( aBestCol.GetRed() & 248 ) | 7 );
+ aBestCol.SetGreen( ( aBestCol.GetGreen() & 248 ) | 7 );
+ aBestCol.SetBlue( ( aBestCol.GetBlue() & 248 ) | 7 );
+ pWriteAcc->SetPixel( nY, nX, aBestCol );
+
+ // Zeilenpuffer neu fuellen/kopieren
+ pQLine1 = pQLine2;
+ pQLine2 = ( bQ1 = !bQ1 ) ? pErrQuad2 : pErrQuad1;
+
+ if( nYTmp < nHeight )
+ for( nX = 0L; nX < nWidth; nX++ )
+ pQLine2[ nX ] = pReadAcc->GetPixel( nYTmp, nX );
+ }
+
+ // Zeilenpuffer zerstoeren
+ delete[] pErrQuad1;
+ delete[] pErrQuad2;
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ReduceColors( USHORT nColorCount, BmpReduce eReduce )
+{
+ BOOL bRet;
+
+ if( GetColorCount() <= (ULONG) nColorCount )
+ bRet = TRUE;
+ else if( nColorCount )
+ {
+ if( BMP_REDUCE_SIMPLE == eReduce )
+ bRet = ImplReduceSimple( nColorCount );
+ else if( BMP_REDUCE_POPULAR == eReduce )
+ bRet = ImplReducePopular( nColorCount );
+ else
+ bRet = ImplReduceMedian( nColorCount );
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplReduceSimple( USHORT nColorCount )
+{
+ Bitmap aNewBmp;
+ BitmapReadAccess* pRAcc = AcquireReadAccess();
+ const USHORT nColCount = Min( nColorCount, (USHORT) 256 );
+ USHORT nBitCount;
+ BOOL bRet = FALSE;
+
+ if( nColCount <= 2 )
+ nBitCount = 1;
+ else if( nColCount <= 16 )
+ nBitCount = 4;
+ else
+ nBitCount = 8;
+
+ if( pRAcc )
+ {
+ Octree aOct( *pRAcc, nColCount );
+ const BitmapPalette& rPal = aOct.GetPalette();
+ BitmapWriteAccess* pWAcc;
+
+ aNewBmp = Bitmap( GetSizePixel(), nBitCount, &rPal );
+ pWAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWAcc )
+ {
+ const long nWidth = pRAcc->Width();
+ const long nHeight = pRAcc->Height();
+
+ if( pRAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX =0L; nX < nWidth; nX++ )
+ pWAcc->SetPixel( nY, nX, (BYTE) aOct.GetBestPaletteIndex( pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) ) ) );
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX =0L; nX < nWidth; nX++ )
+ pWAcc->SetPixel( nY, nX, (BYTE) aOct.GetBestPaletteIndex( pRAcc->GetPixel( nY, nX ) ) );
+ }
+
+ aNewBmp.ReleaseAccess( pWAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pRAcc );
+ }
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+struct PopularColorCount
+{
+ sal_uInt32 mnIndex;
+ sal_uInt32 mnCount;
+};
+
+// ------------------------------------------------------------------------
+
+extern "C" int __LOADONCALLAPI ImplPopularCmpFnc( const void* p1, const void* p2 )
+{
+ int nRet;
+
+ if( ( (PopularColorCount*) p1 )->mnCount < ( (PopularColorCount*) p2 )->mnCount )
+ nRet = 1;
+ else if( ( (PopularColorCount*) p1 )->mnCount == ( (PopularColorCount*) p2 )->mnCount )
+ nRet = 0;
+ else
+ nRet = -1;
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplReducePopular( USHORT nColCount )
+{
+ BitmapReadAccess* pRAcc = AcquireReadAccess();
+ USHORT nBitCount;
+ BOOL bRet = FALSE;
+
+ if( nColCount > 256 )
+ nColCount = 256;
+
+ if( nColCount < 17 )
+ nBitCount = 4;
+ else
+ nBitCount = 8;
+
+ if( pRAcc )
+ {
+ const sal_uInt32 nValidBits = 4;
+ const sal_uInt32 nRightShiftBits = 8 - nValidBits;
+ const sal_uInt32 nLeftShiftBits1 = nValidBits;
+ const sal_uInt32 nLeftShiftBits2 = nValidBits << 1;
+ const sal_uInt32 nColorsPerComponent = 1 << nValidBits;
+ const sal_uInt32 nColorOffset = 256 / nColorsPerComponent;
+ const sal_uInt32 nTotalColors = nColorsPerComponent * nColorsPerComponent * nColorsPerComponent;
+ const long nWidth = pRAcc->Width();
+ const long nHeight = pRAcc->Height();
+ PopularColorCount* pCountTable = new PopularColorCount[ nTotalColors ];
+ long nX, nY, nR, nG, nB, nIndex;
+
+ rtl_zeroMemory( pCountTable, nTotalColors * sizeof( PopularColorCount ) );
+
+ for( nR = 0, nIndex = 0; nR < 256; nR += nColorOffset )
+ for( nG = 0; nG < 256; nG += nColorOffset )
+ for( nB = 0; nB < 256; nB += nColorOffset )
+ pCountTable[ nIndex ].mnIndex = nIndex++;
+
+ if( pRAcc->HasPalette() )
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) );
+ pCountTable[ ( ( ( (sal_uInt32) rCol.GetRed() ) >> nRightShiftBits ) << nLeftShiftBits2 ) |
+ ( ( ( (sal_uInt32) rCol.GetGreen() ) >> nRightShiftBits ) << nLeftShiftBits1 ) |
+ ( ( (sal_uInt32) rCol.GetBlue() ) >> nRightShiftBits ) ].mnCount++;
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor aCol( pRAcc->GetPixel( nY, nX ) );
+ pCountTable[ ( ( ( (sal_uInt32) aCol.GetRed() ) >> nRightShiftBits ) << nLeftShiftBits2 ) |
+ ( ( ( (sal_uInt32) aCol.GetGreen() ) >> nRightShiftBits ) << nLeftShiftBits1 ) |
+ ( ( (sal_uInt32) aCol.GetBlue() ) >> nRightShiftBits ) ].mnCount++;
+ }
+ }
+ }
+
+ BitmapPalette aNewPal( nColCount );
+
+ qsort( pCountTable, nTotalColors, sizeof( PopularColorCount ), ImplPopularCmpFnc );
+
+ for( USHORT n = 0; n < nColCount; n++ )
+ {
+ const PopularColorCount& rPop = pCountTable[ n ];
+ aNewPal[ n ] = BitmapColor( (BYTE) ( ( rPop.mnIndex >> nLeftShiftBits2 ) << nRightShiftBits ),
+ (BYTE) ( ( ( rPop.mnIndex >> nLeftShiftBits1 ) & ( nColorsPerComponent - 1 ) ) << nRightShiftBits ),
+ (BYTE) ( ( rPop.mnIndex & ( nColorsPerComponent - 1 ) ) << nRightShiftBits ) );
+ }
+
+ Bitmap aNewBmp( GetSizePixel(), nBitCount, &aNewPal );
+ BitmapWriteAccess* pWAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWAcc )
+ {
+ BitmapColor aDstCol( (BYTE) 0 );
+ BYTE* pIndexMap = new BYTE[ nTotalColors ];
+
+ for( nR = 0, nIndex = 0; nR < 256; nR += nColorOffset )
+ for( nG = 0; nG < 256; nG += nColorOffset )
+ for( nB = 0; nB < 256; nB += nColorOffset )
+ pIndexMap[ nIndex++ ] = aNewPal.GetBestIndex( BitmapColor( (BYTE) nR, (BYTE) nG, (BYTE) nB ) );
+
+ if( pRAcc->HasPalette() )
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) );
+ aDstCol.SetIndex( pIndexMap[ ( ( ( (sal_uInt32) rCol.GetRed() ) >> nRightShiftBits ) << nLeftShiftBits2 ) |
+ ( ( ( (sal_uInt32) rCol.GetGreen() ) >> nRightShiftBits ) << nLeftShiftBits1 ) |
+ ( ( (sal_uInt32) rCol.GetBlue() ) >> nRightShiftBits ) ] );
+ pWAcc->SetPixel( nY, nX, aDstCol );
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0L; nY < nHeight; nY++ )
+ {
+ for( nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor aCol( pRAcc->GetPixel( nY, nX ) );
+ aDstCol.SetIndex( pIndexMap[ ( ( ( (sal_uInt32) aCol.GetRed() ) >> nRightShiftBits ) << nLeftShiftBits2 ) |
+ ( ( ( (sal_uInt32) aCol.GetGreen() ) >> nRightShiftBits ) << nLeftShiftBits1 ) |
+ ( ( (sal_uInt32) aCol.GetBlue() ) >> nRightShiftBits ) ] );
+ pWAcc->SetPixel( nY, nX, aDstCol );
+ }
+ }
+ }
+
+ delete[] pIndexMap;
+ aNewBmp.ReleaseAccess( pWAcc );
+ bRet = TRUE;
+ }
+
+ delete[] pCountTable;
+ ReleaseAccess( pRAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::ImplReduceMedian( USHORT nColCount )
+{
+ BitmapReadAccess* pRAcc = AcquireReadAccess();
+ USHORT nBitCount;
+ BOOL bRet = FALSE;
+
+ if( nColCount < 17 )
+ nBitCount = 4;
+ else if( nColCount < 257 )
+ nBitCount = 8;
+ else
+ {
+ DBG_ERROR( "Bitmap::ImplReduceMedian(): invalid color count!" );
+ nBitCount = 8;
+ nColCount = 256;
+ }
+
+ if( pRAcc )
+ {
+ Bitmap aNewBmp( GetSizePixel(), nBitCount );
+ BitmapWriteAccess* pWAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWAcc )
+ {
+ const ULONG nSize = 32768UL * sizeof( ULONG );
+ HPULONG pColBuf = (HPULONG) SvMemAlloc( nSize );
+ const long nWidth = pWAcc->Width();
+ const long nHeight = pWAcc->Height();
+ long nIndex = 0L;
+
+ HMEMSET( (HPBYTE) pColBuf, 0, nSize );
+
+ // create Buffer
+ if( pRAcc->HasPalette() )
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor& rCol = pRAcc->GetPaletteColor( pRAcc->GetPixel( nY, nX ) );
+ pColBuf[ RGB15( rCol.GetRed() >> 3, rCol.GetGreen() >> 3, rCol.GetBlue() >> 3 ) ]++;
+ }
+ }
+ }
+ else
+ {
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ const BitmapColor aCol( pRAcc->GetPixel( nY, nX ) );
+ pColBuf[ RGB15( aCol.GetRed() >> 3, aCol.GetGreen() >> 3, aCol.GetBlue() >> 3 ) ]++;
+ }
+ }
+ }
+
+ // create palette via median cut
+ BitmapPalette aPal( pWAcc->GetPaletteEntryCount() );
+ ImplMedianCut( pColBuf, aPal, 0, 31, 0, 31, 0, 31,
+ nColCount, nWidth * nHeight, nIndex );
+
+ // do mapping of colors to palette
+ InverseColorMap aMap( aPal );
+ pWAcc->SetPalette( aPal );
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pWAcc->SetPixel( nY, nX, (BYTE) aMap.GetBestPaletteIndex( pRAcc->GetColor( nY, nX ) ) );
+
+ SvMemFree( pColBuf );
+ aNewBmp.ReleaseAccess( pWAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pRAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void Bitmap::ImplMedianCut( ULONG* pColBuf, BitmapPalette& rPal,
+ long nR1, long nR2, long nG1, long nG2, long nB1, long nB2,
+ long nColors, long nPixels, long& rIndex )
+{
+ if( !nPixels )
+ return;
+
+ BitmapColor aCol;
+ const long nRLen = nR2 - nR1;
+ const long nGLen = nG2 - nG1;
+ const long nBLen = nB2 - nB1;
+ long nR, nG, nB;
+ HPULONG pBuf = pColBuf;
+
+ if( !nRLen && !nGLen && !nBLen )
+ {
+ if( pBuf[ RGB15( nR1, nG1, nB1 ) ] )
+ {
+ aCol.SetRed( (BYTE) ( nR1 << 3 ) );
+ aCol.SetGreen( (BYTE) ( nG1 << 3 ) );
+ aCol.SetBlue( (BYTE) ( nB1 << 3 ) );
+ rPal[ (USHORT) rIndex++ ] = aCol;
+ }
+ }
+ else
+ {
+ if( 1 == nColors || 1 == nPixels )
+ {
+ long nPixSum = 0, nRSum = 0, nGSum = 0, nBSum = 0;
+
+ for( nR = nR1; nR <= nR2; nR++ )
+ {
+ for( nG = nG1; nG <= nG2; nG++ )
+ {
+ for( nB = nB1; nB <= nB2; nB++ )
+ {
+ nPixSum = pBuf[ RGB15( nR, nG, nB ) ];
+
+ if( nPixSum )
+ {
+ nRSum += nR * nPixSum;
+ nGSum += nG * nPixSum;
+ nBSum += nB * nPixSum;
+ }
+ }
+ }
+ }
+
+ aCol.SetRed( (BYTE) ( ( nRSum / nPixels ) << 3 ) );
+ aCol.SetGreen( (BYTE) ( ( nGSum / nPixels ) << 3 ) );
+ aCol.SetBlue( (BYTE) ( ( nBSum / nPixels ) << 3 ) );
+ rPal[ (USHORT) rIndex++ ] = aCol;
+ }
+ else
+ {
+ const long nTest = ( nPixels >> 1 );
+ long nPixOld, nPixNew = 0;
+
+ if( nBLen > nGLen && nBLen > nRLen )
+ {
+ nB = nB1 - 1;
+
+ while( nPixNew < nTest )
+ {
+ nB++, nPixOld = nPixNew;
+ for( nR = nR1; nR <= nR2; nR++ )
+ for( nG = nG1; nG <= nG2; nG++ )
+ nPixNew += pBuf[ RGB15( nR, nG, nB ) ];
+ }
+
+ if( nB < nB2 )
+ {
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG1, nG2, nB1, nB, nColors >> 1, nPixNew, rIndex );
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG1, nG2, nB + 1, nB2, nColors >> 1, nPixels - nPixNew, rIndex );
+ }
+ else
+ {
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG1, nG2, nB1, nB - 1, nColors >> 1, nPixOld, rIndex );
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG1, nG2, nB, nB2, nColors >> 1, nPixels - nPixOld, rIndex );
+ }
+ }
+ else if( nGLen > nRLen )
+ {
+ nG = nG1 - 1;
+
+ while( nPixNew < nTest )
+ {
+ nG++, nPixOld = nPixNew;
+ for( nR = nR1; nR <= nR2; nR++ )
+ for( nB = nB1; nB <= nB2; nB++ )
+ nPixNew += pBuf[ RGB15( nR, nG, nB ) ];
+ }
+
+ if( nG < nG2 )
+ {
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG1, nG, nB1, nB2, nColors >> 1, nPixNew, rIndex );
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG + 1, nG2, nB1, nB2, nColors >> 1, nPixels - nPixNew, rIndex );
+ }
+ else
+ {
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG1, nG - 1, nB1, nB2, nColors >> 1, nPixOld, rIndex );
+ ImplMedianCut( pBuf, rPal, nR1, nR2, nG, nG2, nB1, nB2, nColors >> 1, nPixels - nPixOld, rIndex );
+ }
+ }
+ else
+ {
+ nR = nR1 - 1;
+
+ while( nPixNew < nTest )
+ {
+ nR++, nPixOld = nPixNew;
+ for( nG = nG1; nG <= nG2; nG++ )
+ for( nB = nB1; nB <= nB2; nB++ )
+ nPixNew += pBuf[ RGB15( nR, nG, nB ) ];
+ }
+
+ if( nR < nR2 )
+ {
+ ImplMedianCut( pBuf, rPal, nR1, nR, nG1, nG2, nB1, nB2, nColors >> 1, nPixNew, rIndex );
+ ImplMedianCut( pBuf, rPal, nR1 + 1, nR2, nG1, nG2, nB1, nB2, nColors >> 1, nPixels - nPixNew, rIndex );
+ }
+ else
+ {
+ ImplMedianCut( pBuf, rPal, nR1, nR - 1, nG1, nG2, nB1, nB2, nColors >> 1, nPixOld, rIndex );
+ ImplMedianCut( pBuf, rPal, nR, nR2, nG1, nG2, nB1, nB2, nColors >> 1, nPixels - nPixOld, rIndex );
+ }
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::Vectorize( PolyPolygon& rPolyPoly, ULONG nFlags, const Link* pProgress )
+{
+ return ImplVectorizer().ImplVectorize( *this, rPolyPoly, nFlags, pProgress );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::Vectorize( GDIMetaFile& rMtf, BYTE cReduce, ULONG nFlags, const Link* pProgress )
+{
+ return ImplVectorizer().ImplVectorize( *this, rMtf, cReduce, nFlags, pProgress );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Bitmap::Adjust( short nLuminancePercent, short nContrastPercent,
+ short nChannelRPercent, short nChannelGPercent, short nChannelBPercent,
+ double fGamma, BOOL bInvert )
+{
+ BOOL bRet = FALSE;
+
+ // nothing to do => return quickly
+ if( !nLuminancePercent && !nContrastPercent &&
+ !nChannelRPercent && !nChannelGPercent && !nChannelBPercent &&
+ ( fGamma == 1.0 ) && !bInvert )
+ {
+ bRet = TRUE;
+ }
+ else
+ {
+ BitmapWriteAccess* pAcc = AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ BitmapColor aCol;
+ const long nW = pAcc->Width();
+ const long nH = pAcc->Height();
+ BYTE* cMapR = new BYTE[ 256 ];
+ BYTE* cMapG = new BYTE[ 256 ];
+ BYTE* cMapB = new BYTE[ 256 ];
+ long nX, nY;
+ double fM, fROff, fGOff, fBOff, fOff;
+
+ // calculate slope
+ if( nContrastPercent >= 0 )
+ fM = 128.0 / ( 128.0 - 1.27 * MinMax( nContrastPercent, 0L, 100L ) );
+ else
+ fM = ( 128.0 + 1.27 * MinMax( nContrastPercent, -100L, 0L ) ) / 128.0;
+
+ // total offset = luminance offset + contrast offset
+ fOff = MinMax( nLuminancePercent, -100L, 100L ) * 2.55 + 128.0 - fM * 128.0;
+
+ // channel offset = channel offset + total offset
+ fROff = nChannelRPercent * 2.55 + fOff;
+ fGOff = nChannelGPercent * 2.55 + fOff;
+ fBOff = nChannelBPercent * 2.55 + fOff;
+
+ // calculate gamma value
+ fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma );
+ const BOOL bGamma = ( fGamma != 1.0 );
+
+ // create mapping table
+ for( nX = 0L; nX < 256L; nX++ )
+ {
+ cMapR[ nX ] = (BYTE) MinMax( FRound( nX * fM + fROff ), 0L, 255L );
+ cMapG[ nX ] = (BYTE) MinMax( FRound( nX * fM + fGOff ), 0L, 255L );
+ cMapB[ nX ] = (BYTE) MinMax( FRound( nX * fM + fBOff ), 0L, 255L );
+
+ if( bGamma )
+ {
+ cMapR[ nX ] = GAMMA( cMapR[ nX ], fGamma );
+ cMapG[ nX ] = GAMMA( cMapG[ nX ], fGamma );
+ cMapB[ nX ] = GAMMA( cMapB[ nX ], fGamma );
+ }
+
+ if( bInvert )
+ {
+ cMapR[ nX ] = ~cMapR[ nX ];
+ cMapG[ nX ] = ~cMapG[ nX ];
+ cMapB[ nX ] = ~cMapB[ nX ];
+ }
+ }
+
+ // do modifying
+ if( pAcc->HasPalette() )
+ {
+ BitmapColor aNewCol;
+
+ for( USHORT i = 0, nCount = pAcc->GetPaletteEntryCount(); i < nCount; i++ )
+ {
+ const BitmapColor& rCol = pAcc->GetPaletteColor( i );
+ aNewCol.SetRed( cMapR[ rCol.GetRed() ] );
+ aNewCol.SetGreen( cMapG[ rCol.GetGreen() ] );
+ aNewCol.SetBlue( cMapB[ rCol.GetBlue() ] );
+ pAcc->SetPaletteColor( i, aNewCol );
+ }
+ }
+ else if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR )
+ {
+ for( nY = 0L; nY < nH; nY++ )
+ {
+ Scanline pScan = pAcc->GetScanline( nY );
+
+ for( nX = 0L; nX < nW; nX++ )
+ {
+ *pScan = cMapB[ *pScan ]; pScan++;
+ *pScan = cMapG[ *pScan ]; pScan++;
+ *pScan = cMapR[ *pScan ]; pScan++;
+ }
+ }
+ }
+ else if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB )
+ {
+ for( nY = 0L; nY < nH; nY++ )
+ {
+ Scanline pScan = pAcc->GetScanline( nY );
+
+ for( nX = 0L; nX < nW; nX++ )
+ {
+ *pScan = cMapR[ *pScan ]; pScan++;
+ *pScan = cMapG[ *pScan ]; pScan++;
+ *pScan = cMapB[ *pScan ]; pScan++;
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0L; nY < nH; nY++ )
+ {
+ for( nX = 0L; nX < nW; nX++ )
+ {
+ aCol = pAcc->GetPixel( nY, nX );
+ aCol.SetRed( cMapR[ aCol.GetRed() ] );
+ aCol.SetGreen( cMapG[ aCol.GetGreen() ] );
+ aCol.SetBlue( cMapB[ aCol.GetBlue() ] );
+ pAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+ }
+
+ delete[] cMapR;
+ delete[] cMapG;
+ delete[] cMapB;
+ ReleaseAccess( pAcc );
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
new file mode 100644
index 000000000000..d959166272f5
--- /dev/null
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -0,0 +1,953 @@
+/*************************************************************************
+ *
+ * $RCSfile: bitmap4.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define _SV_BITMAP_CXX
+
+#include <vos/macros.hxx>
+#include <tools/new.hxx>
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define S2(a,b) { register long t; if( ( t = b - a ) < 0 ) { a += t; b -= t; } }
+#define MN3(a,b,c) S2(a,b); S2(a,c);
+#define MX3(a,b,c) S2(b,c); S2(a,c);
+#define MNMX3(a,b,c) MX3(a,b,c); S2(a,b);
+#define MNMX4(a,b,c,d) S2(a,b); S2(c,d); S2(a,c); S2(b,d);
+#define MNMX5(a,b,c,d,e) S2(a,b); S2(c,d); MN3(a,c,e); MX3(b,d,e);
+#define MNMX6(a,b,c,d,e,f) S2(a,d); S2(b,e); S2(c,f); MN3(a,b,c); MX3(d,e,f);
+
+// ----------
+// - Bitmap -
+// ----------
+
+BOOL Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ const USHORT nBitCount = GetBitCount();
+ BOOL bRet = FALSE;
+
+ switch( eFilter )
+ {
+ case( BMP_FILTER_SMOOTH ):
+ {
+ const long pSmoothMatrix[] = { 1, 2, 1, 2, 5, 2, 1, 2, 1 };
+ bRet = ImplConvolute3( &pSmoothMatrix[ 0 ], 17, pFilterParam, pProgress );
+ }
+ break;
+
+ case( BMP_FILTER_SHARPEN ):
+ {
+ const long pSharpenMatrix[] = { -1, -1, -1, -1, 16, -1, -1, -1, -1 };
+ bRet = ImplConvolute3( &pSharpenMatrix[ 0 ], 8, pFilterParam, pProgress );
+ }
+ break;
+
+ case( BMP_FILTER_REMOVENOISE ):
+ bRet = ImplMedianFilter( pFilterParam, pProgress );
+ break;
+
+ case( BMP_FILTER_SOBEL_GREY ):
+ bRet = ImplSobelGrey( pFilterParam, pProgress );
+ break;
+
+ case( BMP_FILTER_SOLARIZE ):
+ bRet = ImplSolarize( pFilterParam, pProgress );
+ break;
+
+ case( BMP_FILTER_SEPIA ):
+ bRet = ImplSepia( pFilterParam, pProgress );
+ break;
+
+ case( BMP_FILTER_MOSAIC ):
+ bRet = ImplMosaic( pFilterParam, pProgress );
+ break;
+
+ case( BMP_FILTER_EMBOSS_GREY ):
+ bRet = ImplEmbossGrey( pFilterParam, pProgress );
+ break;
+
+ default:
+ DBG_ERROR( "Bitmap::Convert(): Unsupported filter" );
+ break;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL Bitmap::ImplConvolute3( const long* pMatrix, long nDivisor,
+ const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ Bitmap aNewBmp( GetSizePixel(), 24 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2;
+ const long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2;
+ long* pColm = new long[ nWidth2 ];
+ long* pRows = new long[ nHeight2 ];
+ BitmapColor* pColRow1 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ];
+ BitmapColor* pColRow2 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ];
+ BitmapColor* pColRow3 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ];
+ BitmapColor* pRowTmp1 = pColRow1;
+ BitmapColor* pRowTmp2 = pColRow2;
+ BitmapColor* pRowTmp3 = pColRow3;
+ BitmapColor* pColor;
+ long nY, nX, i, nSumR, nSumG, nSumB, nMatrixVal, nTmp;
+ long (*pKoeff)[ 256 ] = new long[ 9 ][ 256 ];
+ long* pTmp;
+
+ // create LUT of products of matrix value and possible color component values
+ for( nY = 0; nY < 9; nY++ )
+ for( nX = nTmp = 0, nMatrixVal = pMatrix[ nY ]; nX < 256; nX++, nTmp += nMatrixVal )
+ pKoeff[ nY ][ nX ] = nTmp;
+
+ // create column LUT
+ for( i = 0; i < nWidth2; i++ )
+ pColm[ i ] = ( i > 0 ) ? ( i - 1 ) : 0;
+
+ pColm[ nWidth + 1 ] = pColm[ nWidth ];
+
+ // create row LUT
+ for( i = 0; i < nHeight2; i++ )
+ pRows[ i ] = ( i > 0 ) ? ( i - 1 ) : 0;
+
+ pRows[ nHeight + 1 ] = pRows[ nHeight ];
+
+ // read first three rows of bitmap color
+ for( i = 0; i < nWidth2; i++ )
+ {
+ pColRow1[ i ] = pReadAcc->GetColor( pRows[ 0 ], pColm[ i ] );
+ pColRow2[ i ] = pReadAcc->GetColor( pRows[ 1 ], pColm[ i ] );
+ pColRow3[ i ] = pReadAcc->GetColor( pRows[ 2 ], pColm[ i ] );
+ }
+
+ // do convolution
+ for( nY = 0; nY < nHeight; )
+ {
+ for( nX = 0; nX < nWidth; nX++ )
+ {
+ // first row
+ nSumR = ( pTmp = pKoeff[ 0 ] )[ ( pColor = pRowTmp1 + nX )->GetRed() ];
+ nSumG = pTmp[ pColor->GetGreen() ];
+ nSumB = pTmp[ pColor->GetBlue() ];
+
+ nSumR += ( pTmp = pKoeff[ 1 ] )[ ( ++pColor )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ nSumR += ( pTmp = pKoeff[ 2 ] )[ ( ++pColor )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ // second row
+ nSumR += ( pTmp = pKoeff[ 3 ] )[ ( pColor = pRowTmp2 + nX )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ nSumR += ( pTmp = pKoeff[ 4 ] )[ ( ++pColor )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ nSumR += ( pTmp = pKoeff[ 5 ] )[ ( ++pColor )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ // third row
+ nSumR += ( pTmp = pKoeff[ 6 ] )[ ( pColor = pRowTmp3 + nX )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ nSumR += ( pTmp = pKoeff[ 7 ] )[ ( ++pColor )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ nSumR += ( pTmp = pKoeff[ 8 ] )[ ( ++pColor )->GetRed() ];
+ nSumG += pTmp[ pColor->GetGreen() ];
+ nSumB += pTmp[ pColor->GetBlue() ];
+
+ // calculate destination color
+ pWriteAcc->SetPixel( nY, nX, BitmapColor( (BYTE) MinMax( nSumR / nDivisor, 0, 255 ),
+ (BYTE) MinMax( nSumG / nDivisor, 0, 255 ),
+ (BYTE) MinMax( nSumB / nDivisor, 0, 255 ) ) );
+ }
+
+ if( ++nY < nHeight )
+ {
+ if( pRowTmp1 == pColRow1 )
+ pRowTmp1 = pColRow2, pRowTmp2 = pColRow3, pRowTmp3 = pColRow1;
+ else if( pRowTmp1 == pColRow2 )
+ pRowTmp1 = pColRow3, pRowTmp2 = pColRow1, pRowTmp3 = pColRow2;
+ else
+ pRowTmp1 = pColRow1, pRowTmp2 = pColRow2, pRowTmp3 = pColRow3;
+
+ for( i = 0; i < nWidth2; i++ )
+ pRowTmp3[ i ] = pReadAcc->GetColor( pRows[ nY + 2 ], pColm[ i ] );
+ }
+ }
+
+ delete[] pKoeff;
+ delete[] (BYTE*) pColRow1;
+ delete[] (BYTE*) pColRow2;
+ delete[] (BYTE*) pColRow3;
+ delete[] pColm;
+ delete[] pRows;
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL Bitmap::ImplMedianFilter( const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ Bitmap aNewBmp( GetSizePixel(), 24 );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const long nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2;
+ const long nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2;
+ long* pColm = new long[ nWidth2 ];
+ long* pRows = new long[ nHeight2 ];
+ BitmapColor* pColRow1 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ];
+ BitmapColor* pColRow2 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ];
+ BitmapColor* pColRow3 = (BitmapColor*) new BYTE[ sizeof( BitmapColor ) * nWidth2 ];
+ BitmapColor* pRowTmp1 = pColRow1;
+ BitmapColor* pRowTmp2 = pColRow2;
+ BitmapColor* pRowTmp3 = pColRow3;
+ BitmapColor* pColor;
+ long nY, nX, i;
+ long nR1, nR2, nR3, nR4, nR5, nR6, nR7, nR8, nR9;
+ long nG1, nG2, nG3, nG4, nG5, nG6, nG7, nG8, nG9;
+ long nB1, nB2, nB3, nB4, nB5, nB6, nB7, nB8, nB9;
+
+ // create column LUT
+ for( i = 0; i < nWidth2; i++ )
+ pColm[ i ] = ( i > 0 ) ? ( i - 1 ) : 0;
+
+ pColm[ nWidth + 1 ] = pColm[ nWidth ];
+
+ // create row LUT
+ for( i = 0; i < nHeight2; i++ )
+ pRows[ i ] = ( i > 0 ) ? ( i - 1 ) : 0;
+
+ pRows[ nHeight + 1 ] = pRows[ nHeight ];
+
+ // read first three rows of bitmap color
+ for( i = 0; i < nWidth2; i++ )
+ {
+ pColRow1[ i ] = pReadAcc->GetColor( pRows[ 0 ], pColm[ i ] );
+ pColRow2[ i ] = pReadAcc->GetColor( pRows[ 1 ], pColm[ i ] );
+ pColRow3[ i ] = pReadAcc->GetColor( pRows[ 2 ], pColm[ i ] );
+ }
+
+ // do median filtering
+ for( nY = 0; nY < nHeight; )
+ {
+ for( nX = 0; nX < nWidth; nX++ )
+ {
+ nR1 = ( pColor = pRowTmp1 + nX )->GetRed(), nG1 = pColor->GetGreen(), nB1 = pColor->GetBlue();
+ nR2 = ( ++pColor )->GetRed(), nG2 = pColor->GetGreen(), nB2 = pColor->GetBlue();
+ nR3 = ( ++pColor )->GetRed(), nG3 = pColor->GetGreen(), nB3 = pColor->GetBlue();
+
+ nR4 = ( pColor = pRowTmp2 + nX )->GetRed(), nG4 = pColor->GetGreen(), nB4 = pColor->GetBlue();
+ nR5 = ( ++pColor )->GetRed(), nG5 = pColor->GetGreen(), nB5 = pColor->GetBlue();
+ nR6 = ( ++pColor )->GetRed(), nG6 = pColor->GetGreen(), nB6 = pColor->GetBlue();
+
+ nR7 = ( pColor = pRowTmp3 + nX )->GetRed(), nG7 = pColor->GetGreen(), nB7 = pColor->GetBlue();
+ nR8 = ( ++pColor )->GetRed(), nG8 = pColor->GetGreen(), nB8 = pColor->GetBlue();
+ nR9 = ( ++pColor )->GetRed(), nG9 = pColor->GetGreen(), nB9 = pColor->GetBlue();
+
+ MNMX6( nR1, nR2, nR3, nR4, nR5, nR6 );
+ MNMX5( nR7, nR2, nR3, nR4, nR5 );
+ MNMX4( nR8, nR2, nR3, nR4 );
+ MNMX3( nR9, nR2, nR3 );
+
+ MNMX6( nG1, nG2, nG3, nG4, nG5, nG6 );
+ MNMX5( nG7, nG2, nG3, nG4, nG5 );
+ MNMX4( nG8, nG2, nG3, nG4 );
+ MNMX3( nG9, nG2, nG3 );
+
+ MNMX6( nB1, nB2, nB3, nB4, nB5, nB6 );
+ MNMX5( nB7, nB2, nB3, nB4, nB5 );
+ MNMX4( nB8, nB2, nB3, nB4 );
+ MNMX3( nB9, nB2, nB3 );
+
+ // set destination color
+ pWriteAcc->SetPixel( nY, nX, BitmapColor( (BYTE) nR2, (BYTE) nG2, (BYTE) nB2 ) );
+ }
+
+ if( ++nY < nHeight )
+ {
+ if( pRowTmp1 == pColRow1 )
+ pRowTmp1 = pColRow2, pRowTmp2 = pColRow3, pRowTmp3 = pColRow1;
+ else if( pRowTmp1 == pColRow2 )
+ pRowTmp1 = pColRow3, pRowTmp2 = pColRow1, pRowTmp3 = pColRow2;
+ else
+ pRowTmp1 = pColRow1, pRowTmp2 = pColRow2, pRowTmp3 = pColRow3;
+
+ for( i = 0; i < nWidth2; i++ )
+ pRowTmp3[ i ] = pReadAcc->GetColor( pRows[ nY + 2 ], pColm[ i ] );
+ }
+ }
+
+ delete[] (BYTE*) pColRow1;
+ delete[] (BYTE*) pColRow2;
+ delete[] (BYTE*) pColRow3;
+ delete[] pColm;
+ delete[] pRows;
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL Bitmap::ImplSobelGrey( const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ BOOL bRet = ImplMakeGreyscales( 256 );
+
+ if( bRet )
+ {
+ bRet = FALSE;
+
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+
+ if( pReadAcc )
+ {
+ Bitmap aNewBmp( GetSizePixel(), 8, &pReadAcc->GetPalette() );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ BitmapColor aGrey( (BYTE) 0 );
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+ const long nMask111 = -1, nMask121 = 0, nMask131 = 1;
+ const long nMask211 = -2, nMask221 = 0, nMask231 = 2;
+ const long nMask311 = -1, nMask321 = 0, nMask331 = 1;
+ const long nMask112 = 1, nMask122 = 2, nMask132 = 1;
+ const long nMask212 = 0, nMask222 = 0, nMask232 = 0;
+ const long nMask312 = -1, nMask322 = -2, nMask332 = -1;
+ long nGrey11, nGrey12, nGrey13;
+ long nGrey21, nGrey22, nGrey23;
+ long nGrey31, nGrey32, nGrey33;
+ long* pHMap = new long[ nWidth + 2 ];
+ long* pVMap = new long[ nHeight + 2 ];
+ long nX, nY, nSum1, nSum2;
+
+ // fill mapping tables
+ pHMap[ 0 ] = 0;
+ for( nX = 1; nX <= nWidth; nX++ )
+ pHMap[ nX ] = nX - 1;
+ pHMap[ nWidth + 1 ] = nWidth - 1;
+
+ pVMap[ 0 ] = 0;
+ for( nY = 1; nY <= nHeight; nY++ )
+ pVMap[ nY ] = nY - 1;
+ pVMap[ nHeight + 1 ] = nHeight - 1;
+
+ for( nY = 0; nY < nHeight ; nY++ )
+ {
+ nGrey11 = pReadAcc->GetPixel( pVMap[ nY ], pHMap[ 0 ] ).GetIndex();
+ nGrey12 = pReadAcc->GetPixel( pVMap[ nY ], pHMap[ 1 ] ).GetIndex();
+ nGrey13 = pReadAcc->GetPixel( pVMap[ nY ], pHMap[ 2 ] ).GetIndex();
+ nGrey21 = pReadAcc->GetPixel( pVMap[ nY + 1 ], pHMap[ 0 ] ).GetIndex();
+ nGrey22 = pReadAcc->GetPixel( pVMap[ nY + 1 ], pHMap[ 1 ] ).GetIndex();
+ nGrey23 = pReadAcc->GetPixel( pVMap[ nY + 1 ], pHMap[ 2 ] ).GetIndex();
+ nGrey31 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 0 ] ).GetIndex();
+ nGrey32 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 1 ] ).GetIndex();
+ nGrey33 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 2 ] ).GetIndex();
+
+ for( nX = 0; nX < nWidth; nX++ )
+ {
+ nSum1 = nSum2 = 0;
+
+ nSum1 += nMask111 * nGrey11;
+ nSum2 += nMask112 * nGrey11;
+
+ nSum1 += nMask121 * nGrey12;
+ nSum2 += nMask122 * nGrey12;
+
+ nSum1 += nMask131 * nGrey13;
+ nSum2 += nMask132 * nGrey13;
+
+ nSum1 += nMask211 * nGrey21;
+ nSum2 += nMask212 * nGrey21;
+
+ nSum1 += nMask221 * nGrey22;
+ nSum2 += nMask222 * nGrey22;
+
+ nSum1 += nMask231 * nGrey23;
+ nSum2 += nMask232 * nGrey23;
+
+ nSum1 += nMask311 * nGrey31;
+ nSum2 += nMask312 * nGrey31;
+
+ nSum1 += nMask321 * nGrey32;
+ nSum2 += nMask322 * nGrey32;
+
+ nSum1 += nMask331 * nGrey33;
+ nSum2 += nMask332 * nGrey33;
+
+ nSum1 = (long) sqrt( ( nSum1 * nSum1 + nSum2 * nSum2 ) );
+ aGrey.SetIndex( ~(BYTE) VOS_BOUND( nSum1, 0, 255 ) );
+ pWriteAcc->SetPixel( nY, nX, aGrey );
+
+ if( nX < ( nWidth - 1 ) )
+ {
+ const long nNextX = pHMap[ nX + 3 ];
+
+ nGrey11 = nGrey12; nGrey12 = nGrey13; nGrey13 = pReadAcc->GetPixel( pVMap[ nY ], nNextX ).GetIndex();
+ nGrey21 = nGrey22; nGrey22 = nGrey23; nGrey23 = pReadAcc->GetPixel( pVMap[ nY + 1 ], nNextX ).GetIndex();
+ nGrey31 = nGrey32; nGrey32 = nGrey33; nGrey33 = pReadAcc->GetPixel( pVMap[ nY + 2 ], nNextX ).GetIndex();
+ }
+ }
+ }
+
+ delete[] pHMap;
+ delete[] pVMap;
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ BOOL bRet = ImplMakeGreyscales( 256 );
+
+ if( bRet )
+ {
+ bRet = FALSE;
+
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+
+ if( pReadAcc )
+ {
+ Bitmap aNewBmp( GetSizePixel(), 8, &pReadAcc->GetPalette() );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ BitmapColor aGrey( (BYTE) 0 );
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+ long nGrey11, nGrey12, nGrey13;
+ long nGrey21, nGrey22, nGrey23;
+ long nGrey31, nGrey32, nGrey33;
+ double fAzim = ( ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_EMBOSS_GREY ) ?
+ ( pFilterParam->maEmbossAngles.mnAzimuthAngle100 * 0.01 ) : 0.0 ) * F_PI180;
+ double fElev = ( ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_EMBOSS_GREY ) ?
+ ( pFilterParam->maEmbossAngles.mnElevationAngle100 * 0.01 ) : 90.0 ) * F_PI180;
+ long* pHMap = new long[ nWidth + 2 ];
+ long* pVMap = new long[ nHeight + 2 ];
+ long nX, nY, nNx, nNy, nDotL;
+ const long nLx = FRound( cos( fAzim ) * cos( fElev ) * 255.0 );
+ const long nLy = FRound( sin( fAzim ) * cos( fElev ) * 255.0 );
+ const long nLz = FRound( sin( fElev ) * 255.0 );
+ const long nZ2 = ( ( 6 * 255 ) / 4 ) * ( ( 6 * 255 ) / 4 );
+ const long nNzLz = ( ( 6 * 255 ) / 4 ) * nLz;
+ const BYTE cLz = (BYTE) VOS_BOUND( nLz, 0, 255 );
+
+ // fill mapping tables
+ pHMap[ 0 ] = 0;
+ for( nX = 1; nX <= nWidth; nX++ )
+ pHMap[ nX ] = nX - 1;
+ pHMap[ nWidth + 1 ] = nWidth - 1;
+
+ pVMap[ 0 ] = 0;
+ for( nY = 1; nY <= nHeight; nY++ )
+ pVMap[ nY ] = nY - 1;
+ pVMap[ nHeight + 1 ] = nHeight - 1;
+
+ for( nY = 0; nY < nHeight ; nY++ )
+ {
+ nGrey11 = pReadAcc->GetPixel( pVMap[ nY ], pHMap[ 0 ] ).GetIndex();
+ nGrey12 = pReadAcc->GetPixel( pVMap[ nY ], pHMap[ 1 ] ).GetIndex();
+ nGrey13 = pReadAcc->GetPixel( pVMap[ nY ], pHMap[ 2 ] ).GetIndex();
+ nGrey21 = pReadAcc->GetPixel( pVMap[ nY + 1 ], pHMap[ 0 ] ).GetIndex();
+ nGrey22 = pReadAcc->GetPixel( pVMap[ nY + 1 ], pHMap[ 1 ] ).GetIndex();
+ nGrey23 = pReadAcc->GetPixel( pVMap[ nY + 1 ], pHMap[ 2 ] ).GetIndex();
+ nGrey31 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 0 ] ).GetIndex();
+ nGrey32 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 1 ] ).GetIndex();
+ nGrey33 = pReadAcc->GetPixel( pVMap[ nY + 2 ], pHMap[ 2 ] ).GetIndex();
+
+ for( nX = 0; nX < nWidth; nX++ )
+ {
+ nNx = nGrey11 + nGrey21 + nGrey31 - nGrey13 - nGrey23 - nGrey33;
+ nNy = nGrey31 + nGrey32 + nGrey33 - nGrey11 - nGrey12 - nGrey13;
+
+ if( !nNx && !nNy )
+ aGrey.SetIndex( cLz );
+ else if( ( nDotL = nNx * nLx + nNy * nLy +nNzLz ) < 0 )
+ aGrey.SetIndex( 0 );
+ else
+ {
+ const double fGrey = nDotL / sqrt( nNx * nNx + nNy * nNy + nZ2 );
+ aGrey.SetIndex( (BYTE) VOS_BOUND( fGrey, 0, 255 ) );
+ }
+
+ pWriteAcc->SetPixel( nY, nX, aGrey );
+
+ if( nX < ( nWidth - 1 ) )
+ {
+ const long nNextX = pHMap[ nX + 3 ];
+
+ nGrey11 = nGrey12; nGrey12 = nGrey13; nGrey13 = pReadAcc->GetPixel( pVMap[ nY ], nNextX ).GetIndex();
+ nGrey21 = nGrey22; nGrey22 = nGrey23; nGrey23 = pReadAcc->GetPixel( pVMap[ nY + 1 ], nNextX ).GetIndex();
+ nGrey31 = nGrey32; nGrey32 = nGrey33; nGrey33 = pReadAcc->GetPixel( pVMap[ nY + 2 ], nNextX ).GetIndex();
+ }
+ }
+ }
+
+ delete[] pHMap;
+ delete[] pVMap;
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL Bitmap::ImplSolarize( const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ BOOL bRet = FALSE;
+ BitmapWriteAccess* pWriteAcc = AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ const BYTE cThreshold = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_SOLARIZE ) ?
+ pFilterParam->mcSolarGreyThreshold : 128;
+
+ if( pWriteAcc->HasPalette() )
+ {
+ const BitmapPalette& rPal = pWriteAcc->GetPalette();
+
+ for( USHORT i = 0, nCount = rPal.GetEntryCount(); i < nCount; i++ )
+ {
+ if( rPal[ i ].GetLuminance() >= cThreshold )
+ {
+ BitmapColor aCol( rPal[ i ] );
+ pWriteAcc->SetPaletteColor( i, aCol.Invert() );
+ }
+ }
+ }
+ else
+ {
+ BitmapColor aCol;
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+
+ for( long nY = 0; nY < nHeight ; nY++ )
+ {
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ aCol = pWriteAcc->GetPixel( nY, nX );
+
+ if( aCol.GetLuminance() >= cThreshold )
+ pWriteAcc->SetPixel( nY, nX, aCol.Invert() );
+ }
+ }
+ }
+
+ ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ BitmapReadAccess* pReadAcc = AcquireReadAccess();
+ BOOL bRet = FALSE;
+
+ if( pReadAcc )
+ {
+ long nSepiaPercent = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_SEPIA ) ?
+ pFilterParam->mcSolarGreyThreshold : 10;
+ const long nSepia = 10000 - 100 * VOS_BOUND( nSepiaPercent, 0, 100 );
+ BitmapPalette aSepiaPal( 256 );
+
+ DBG_ASSERT( nSepiaPercent <= 100, "Bitmap::ImplSepia(): sepia value out of range; defaulting to 100%" );
+
+ for( long i = 0; i < 256; i++ )
+ {
+ BitmapColor& rCol = aSepiaPal[ i ];
+ const BYTE cSepiaValue = (BYTE) ( ( nSepia * i ) / 10000 );
+
+ rCol.SetRed( (BYTE) i );
+ rCol.SetGreen( cSepiaValue );
+ rCol.SetBlue( cSepiaValue );
+ }
+
+ Bitmap aNewBmp( GetSizePixel(), 8, &aSepiaPal );
+ BitmapWriteAccess* pWriteAcc = aNewBmp.AcquireWriteAccess();
+
+ if( pWriteAcc )
+ {
+ BitmapColor aCol( (BYTE) 0 );
+ const long nWidth = pWriteAcc->Width();
+ const long nHeight = pWriteAcc->Height();
+
+ if( pReadAcc->HasPalette() )
+ {
+ for( long nY = 0; nY < nHeight ; nY++ )
+ {
+ const USHORT nPalCount = pReadAcc->GetPaletteEntryCount();
+ BYTE* pIndexMap = new BYTE[ nPalCount ];
+
+ for( USHORT i = 0; i < nPalCount; i++ )
+ pIndexMap[ i ] = pReadAcc->GetPaletteColor( i ).GetLuminance();
+
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ aCol.SetIndex( pIndexMap[ pReadAcc->GetPixel( nY, nX ).GetIndex() ] );
+ pWriteAcc->SetPixel( nY, nX, aCol );
+ }
+
+ delete[] pIndexMap;
+ }
+ }
+ else
+ {
+ for( long nY = 0; nY < nHeight ; nY++ )
+ {
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ aCol.SetIndex( pReadAcc->GetPixel( nY, nX ).GetLuminance() );
+ pWriteAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+ }
+
+ aNewBmp.ReleaseAccess( pWriteAcc );
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = aNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL Bitmap::ImplMosaic( const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ ULONG nTileWidth = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_MOSAIC ) ?
+ pFilterParam->maMosaicTileSize.mnTileWidth : 4;
+ ULONG nTileHeight = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_MOSAIC ) ?
+ pFilterParam->maMosaicTileSize.mnTileHeight : 4;
+ BOOL bRet = FALSE;
+
+ if( !nTileWidth )
+ nTileWidth = 1;
+
+ if( !nTileHeight )
+ nTileHeight = 1;
+
+ if( nTileWidth > 1 || nTileHeight > 1 )
+ {
+ Bitmap* pNewBmp;
+ BitmapReadAccess* pReadAcc;
+ BitmapWriteAccess* pWriteAcc;
+
+ if( GetBitCount() > 8 )
+ {
+ pNewBmp = NULL;
+ pReadAcc = pWriteAcc = AcquireWriteAccess();
+ }
+ else
+ {
+ pNewBmp = new Bitmap( GetSizePixel(), 24 );
+ pReadAcc = AcquireReadAccess();
+ pWriteAcc = pNewBmp->AcquireWriteAccess();
+ }
+
+ if( pReadAcc && pWriteAcc )
+ {
+ BitmapColor aCol;
+ long nWidth = pReadAcc->Width();
+ long nHeight = pReadAcc->Height();
+ long nX, nY, nX1, nX2, nY1, nY2, nSumR, nSumG, nSumB;
+ double fArea_1;
+
+ nY1 = 0; nY2 = nTileHeight - 1;
+
+ if( nY2 >= nHeight )
+ nY2 = nHeight - 1;
+
+ do
+ {
+ nX1 = 0; nX2 = nTileWidth - 1;
+
+ if( nX2 >= nWidth )
+ nX2 = nWidth - 1;
+
+ fArea_1 = 1.0 / ( ( nX2 - nX1 + 1 ) * ( nY2 - nY1 + 1 ) );
+
+ if( !pNewBmp )
+ {
+ do
+ {
+ for( nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; nY++ )
+ {
+ for( nX = nX1; nX <= nX2; nX++ )
+ {
+ aCol = pReadAcc->GetPixel( nY, nX );
+ nSumR += aCol.GetRed();
+ nSumG += aCol.GetGreen();
+ nSumB += aCol.GetBlue();
+ }
+ }
+
+ aCol.SetRed( (BYTE) ( nSumR * fArea_1 ) );
+ aCol.SetGreen( (BYTE) ( nSumG * fArea_1 ) );
+ aCol.SetBlue( (BYTE) ( nSumB * fArea_1 ) );
+
+ for( nY = nY1; nY <= nY2; nY++ )
+ for( nX = nX1; nX <= nX2; nX++ )
+ pWriteAcc->SetPixel( nY, nX, aCol );
+
+ nX1 += nTileWidth; nX2 += nTileWidth;
+
+ if( nX2 >= nWidth )
+ {
+ nX2 = nWidth - 1;
+ fArea_1 = 1.0 / ( ( nX2 - nX1 + 1 ) * ( nY2 - nY1 + 1 ) );
+ }
+ }
+ while( nX1 < nWidth );
+ }
+ else
+ {
+ do
+ {
+ for( nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; nY++ )
+ {
+ for( nX = nX1; nX <= nX2; nX++ )
+ {
+ const BitmapColor& rCol = pReadAcc->GetPaletteColor( (BYTE) pReadAcc->GetPixel( nY, nX ) );
+ nSumR += rCol.GetRed();
+ nSumG += rCol.GetGreen();
+ nSumB += rCol.GetBlue();
+ }
+ }
+
+ aCol.SetRed( (BYTE) ( nSumR * fArea_1 ) );
+ aCol.SetGreen( (BYTE) ( nSumG * fArea_1 ) );
+ aCol.SetBlue( (BYTE) ( nSumB * fArea_1 ) );
+
+ for( nY = nY1; nY <= nY2; nY++ )
+ for( nX = nX1; nX <= nX2; nX++ )
+ pWriteAcc->SetPixel( nY, nX, aCol );
+
+ nX1 += nTileWidth; nX2 += nTileWidth;
+
+ if( nX2 >= nWidth )
+ {
+ nX2 = nWidth - 1;
+ fArea_1 = 1.0 / ( ( nX2 - nX1 + 1 ) * ( nY2 - nY1 + 1 ) );
+ }
+ }
+ while( nX1 < nWidth );
+ }
+
+ nY1 += nTileHeight; nY2 += nTileHeight;
+
+ if( nY2 >= nHeight )
+ nY2 = nHeight - 1;
+ }
+ while( nY1 < nHeight );
+
+ bRet = TRUE;
+ }
+
+ ReleaseAccess( pReadAcc );
+
+ if( pNewBmp )
+ {
+ pNewBmp->ReleaseAccess( pWriteAcc );
+
+ if( bRet )
+ {
+ const MapMode aMap( maPrefMapMode );
+ const Size aSize( maPrefSize );
+
+ *this = *pNewBmp;
+
+ maPrefMapMode = aMap;
+ maPrefSize = aSize;
+ }
+
+ delete pNewBmp;
+ }
+ }
+ else
+ bRet = TRUE;
+
+ return bRet;
+}
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
new file mode 100644
index 000000000000..a0e388a1db0f
--- /dev/null
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -0,0 +1,690 @@
+/*************************************************************************
+ *
+ * $RCSfile: bitmapex.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BITMAPEX_CXX
+
+#ifndef _RTL_CRC_H_
+#include <rtl/crc.h>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_ALPHA_HXX
+#include <alpha.hxx>
+#endif
+#ifndef _SV_BITMAPEX_HXX
+#include <bitmapex.hxx>
+#endif
+
+// ------------
+// - BitmapEx -
+// ------------
+
+BitmapEx::BitmapEx() :
+ eTransparent( TRANSPARENT_NONE ),
+ bAlpha ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------
+
+BitmapEx::BitmapEx( const BitmapEx& rBitmapEx ) :
+ aBitmap ( rBitmapEx.aBitmap ),
+ aMask ( rBitmapEx.aMask ),
+ aBitmapSize ( rBitmapEx.aBitmapSize ),
+ aTransparentColor ( rBitmapEx.aTransparentColor ),
+ eTransparent ( rBitmapEx.eTransparent ),
+ bAlpha ( rBitmapEx.bAlpha )
+{
+}
+
+// ------------------------------------------------------------------
+
+BitmapEx::BitmapEx( const Bitmap& rBmp ) :
+ aBitmap ( rBmp ),
+ aBitmapSize ( aBitmap.GetSizePixel() ),
+ eTransparent( TRANSPARENT_NONE ),
+ bAlpha ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------
+
+BitmapEx::BitmapEx( const Bitmap& rBmp, const Bitmap& rMask ) :
+ aBitmap ( rBmp ),
+ aMask ( rMask ),
+ aBitmapSize ( aBitmap.GetSizePixel() ),
+ eTransparent ( !rMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ),
+ bAlpha ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------
+
+BitmapEx::BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask ) :
+ aBitmap ( rBmp ),
+ aMask ( rAlphaMask.ImplGetBitmap() ),
+ aBitmapSize ( aBitmap.GetSizePixel() ),
+ eTransparent ( !rAlphaMask ? TRANSPARENT_NONE : TRANSPARENT_BITMAP ),
+ bAlpha ( !rAlphaMask ? FALSE : TRUE )
+{
+}
+
+// ------------------------------------------------------------------
+
+BitmapEx::BitmapEx( const Bitmap& rBmp, const Color& rTransparentColor ) :
+ aBitmap ( rBmp ),
+ aBitmapSize ( aBitmap.GetSizePixel() ),
+ aTransparentColor ( rTransparentColor ),
+ eTransparent ( TRANSPARENT_BITMAP ),
+ bAlpha ( FALSE )
+{
+ aMask = aBitmap.CreateMask( aTransparentColor );
+}
+
+// ------------------------------------------------------------------
+
+BitmapEx::~BitmapEx()
+{
+}
+
+// ------------------------------------------------------------------
+
+BitmapEx& BitmapEx::operator=( const BitmapEx& rBitmapEx )
+{
+ if( &rBitmapEx != this )
+ {
+ aBitmap = rBitmapEx.aBitmap;
+ aMask = rBitmapEx.aMask;
+ aBitmapSize = rBitmapEx.aBitmapSize;
+ aTransparentColor = rBitmapEx.aTransparentColor;
+ eTransparent = rBitmapEx.eTransparent;
+ bAlpha = rBitmapEx.bAlpha;
+ }
+
+ return *this;
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
+{
+ if( eTransparent != rBitmapEx.eTransparent )
+ return FALSE;
+
+ if( aBitmap != rBitmapEx.aBitmap )
+ return FALSE;
+
+ if( aBitmapSize != rBitmapEx.aBitmapSize )
+ return FALSE;
+
+ if( eTransparent == TRANSPARENT_NONE )
+ return TRUE;
+
+ if( eTransparent == TRANSPARENT_COLOR )
+ return aTransparentColor == rBitmapEx.aTransparentColor;
+
+ return( ( aMask == rBitmapEx.aMask ) && ( bAlpha == rBitmapEx.bAlpha ) );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::IsEqual( const BitmapEx& rBmpEx ) const
+{
+ return( rBmpEx.eTransparent == eTransparent &&
+ rBmpEx.bAlpha == bAlpha &&
+ rBmpEx.aBitmap.IsEqual( aBitmap ) &&
+ rBmpEx.aMask.IsEqual( aMask ) );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::IsEmpty() const
+{
+ return( aBitmap.IsEmpty() && aMask.IsEmpty() );
+}
+
+// ------------------------------------------------------------------
+
+void BitmapEx::SetEmpty()
+{
+ aBitmap.SetEmpty();
+ aMask.SetEmpty();
+ eTransparent = TRANSPARENT_NONE;
+ bAlpha = FALSE;
+}
+
+// ------------------------------------------------------------------
+
+void BitmapEx::Clear()
+{
+ SetEmpty();
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::IsTransparent() const
+{
+ return( eTransparent != TRANSPARENT_NONE );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::IsAlpha() const
+{
+ return( IsTransparent() && bAlpha );
+}
+
+// ------------------------------------------------------------------
+
+Bitmap BitmapEx::GetBitmap( const Color* pTransReplaceColor ) const
+{
+ Bitmap aRetBmp( aBitmap );
+
+ if( pTransReplaceColor && ( eTransparent != TRANSPARENT_NONE ) )
+ {
+ Bitmap aTempMask;
+
+ if( eTransparent == TRANSPARENT_COLOR )
+ aTempMask = aBitmap.CreateMask( aTransparentColor );
+ else
+ aTempMask = aMask;
+
+ if( !IsAlpha() )
+ aRetBmp.Replace( aTempMask, *pTransReplaceColor );
+ else
+ aRetBmp.Replace( GetAlpha(), *pTransReplaceColor );
+ }
+
+ return aRetBmp;
+}
+
+// ------------------------------------------------------------------
+
+Bitmap BitmapEx::GetMask() const
+{
+ Bitmap aRet( aMask );
+
+ if( IsAlpha() )
+ aRet.ImplMakeMono( 255 );
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------
+
+AlphaMask BitmapEx::GetAlpha() const
+{
+ AlphaMask aAlpha;
+
+ if( IsAlpha() )
+ aAlpha.ImplSetBitmap( aMask );
+ else
+ aAlpha = aMask;
+
+ return aAlpha;
+}
+
+// ------------------------------------------------------------------
+
+ULONG BitmapEx::GetSizeBytes() const
+{
+ ULONG nSizeBytes = aBitmap.GetSizeBytes();
+
+ if( eTransparent == TRANSPARENT_BITMAP )
+ nSizeBytes += aMask.GetSizeBytes();
+
+ return nSizeBytes;
+}
+
+// ------------------------------------------------------------------
+
+ULONG BitmapEx::GetChecksum() const
+{
+ sal_uInt32 nCrc = aBitmap.GetChecksum();
+ SVBT32 aBT32;
+
+ LongToSVBT32( (long) eTransparent, aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( (long) bAlpha, aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ if( ( TRANSPARENT_BITMAP == eTransparent ) && !aMask.IsEmpty() )
+ {
+ LongToSVBT32( aMask.GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+
+ return nCrc;
+}
+
+// ------------------------------------------------------------------
+
+void BitmapEx::SetSizePixel( const Size& rNewSize )
+{
+ Scale( rNewSize );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Invert()
+{
+ BOOL bRet = FALSE;
+
+ if( !!aBitmap )
+ {
+ bRet = aBitmap.Invert();
+
+ if( bRet && ( eTransparent == TRANSPARENT_COLOR ) )
+ aTransparentColor = BitmapColor( aTransparentColor ).Invert();
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Mirror( ULONG nMirrorFlags )
+{
+ BOOL bRet = FALSE;
+
+ if( !!aBitmap )
+ {
+ bRet = aBitmap.Mirror( nMirrorFlags );
+
+ if( bRet && ( eTransparent == TRANSPARENT_BITMAP ) && !!aMask )
+ aMask.Mirror( nMirrorFlags );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Scale( const double& rScaleX, const double& rScaleY, ULONG nScaleFlag )
+{
+ BOOL bRet = FALSE;
+
+ if( !!aBitmap )
+ {
+ bRet = aBitmap.Scale( rScaleX, rScaleY, nScaleFlag );
+
+ if( bRet && ( eTransparent == TRANSPARENT_BITMAP ) && !!aMask )
+ aMask.Scale( rScaleX, rScaleY, BMP_SCALE_FAST );
+
+ aBitmapSize = aBitmap.GetSizePixel();
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL BitmapEx::Scale( const Size& rNewSize, ULONG nScaleFlag )
+{
+ BOOL bRet;
+
+ if( aBitmapSize.Width() && aBitmapSize.Height() )
+ {
+ bRet = Scale( (double) rNewSize.Width() / aBitmapSize.Width(),
+ (double) rNewSize.Height() / aBitmapSize.Height(),
+ nScaleFlag );
+ }
+ else
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Rotate( long nAngle10, const Color& rFillColor )
+{
+ BOOL bRet = FALSE;
+
+ if( !!aBitmap )
+ {
+ const BOOL bTransRotate = ( Color( COL_TRANSPARENT ) == rFillColor );
+
+ if( bTransRotate )
+ {
+ if( eTransparent == TRANSPARENT_COLOR )
+ bRet = aBitmap.Rotate( nAngle10, aTransparentColor );
+ else
+ {
+ bRet = aBitmap.Rotate( nAngle10, COL_BLACK );
+
+ if( eTransparent == TRANSPARENT_NONE )
+ {
+ aMask = Bitmap( aBitmapSize, 1 );
+ aMask.Erase( COL_BLACK );
+ eTransparent = TRANSPARENT_BITMAP;
+ }
+
+ if( bRet && !!aMask )
+ aMask.Rotate( nAngle10, COL_WHITE );
+ }
+ }
+ else
+ {
+ bRet = aBitmap.Rotate( nAngle10, rFillColor );
+
+ if( bRet && ( eTransparent == TRANSPARENT_BITMAP ) && !!aMask )
+ aMask.Rotate( nAngle10, COL_WHITE );
+ }
+
+ aBitmapSize = aBitmap.GetSizePixel();
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Crop( const Rectangle& rRectPixel )
+{
+ BOOL bRet = FALSE;
+
+ if( !!aBitmap )
+ {
+ bRet = aBitmap.Crop( rRectPixel );
+
+ if( bRet && ( eTransparent == TRANSPARENT_BITMAP ) && !!aMask )
+ aMask.Crop( rRectPixel );
+
+ aBitmapSize = aBitmap.GetSizePixel();
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Convert( BmpConversion eConversion )
+{
+ return( !!aBitmap ? aBitmap.Convert( eConversion ) : FALSE );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::ReduceColors( USHORT nNewColorCount, BmpReduce eReduce )
+{
+ return( !!aBitmap ? aBitmap.ReduceColors( nNewColorCount, eReduce ) : FALSE );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Expand( ULONG nDX, ULONG nDY, const Color* pInitColor, BOOL bExpandTransparent )
+{
+ BOOL bRet = FALSE;
+
+ if( !!aBitmap )
+ {
+ bRet = aBitmap.Expand( nDX, nDY, pInitColor );
+
+ if( bRet && ( eTransparent == TRANSPARENT_BITMAP ) && !!aMask )
+ {
+ Color aColor( bExpandTransparent ? COL_WHITE : COL_BLACK );
+ aMask.Expand( nDX, nDY, &aColor );
+ }
+
+ aBitmapSize = aBitmap.GetSizePixel();
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Dither( ULONG nDitherFlags, const BitmapPalette* pDitherPal )
+{
+ return( !!aBitmap ? aBitmap.Dither( nDitherFlags, pDitherPal ) : FALSE );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Replace( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol )
+{
+ return( !!aBitmap ? aBitmap.Replace( rSearchColor, rReplaceColor, nTol ) : FALSE );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Replace( const Color* pSearchColors, const Color* pReplaceColors, ULONG nColorCount, const ULONG* pTols )
+{
+ return( !!aBitmap ? aBitmap.Replace( pSearchColors, pReplaceColors, nColorCount, (ULONG*) pTols ) : FALSE );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Adjust( short nLuminancePercent, short nContrastPercent,
+ short nChannelRPercent, short nChannelGPercent, short nChannelBPercent,
+ double fGamma, BOOL bInvert )
+{
+ return( !!aBitmap ? aBitmap.Adjust( nLuminancePercent, nContrastPercent,
+ nChannelRPercent, nChannelGPercent, nChannelBPercent,
+ fGamma, bInvert ) : FALSE );
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapEx::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, const Link* pProgress )
+{
+ return( !!aBitmap ? aBitmap.Filter( eFilter, pFilterParam, pProgress ) : FALSE );
+}
+
+// ------------------------------------------------------------------
+
+void BitmapEx::Draw( OutputDevice* pOutDev, const Point& rDestPt ) const
+{
+ pOutDev->DrawBitmapEx( rDestPt, *this );
+}
+
+// ------------------------------------------------------------------
+
+void BitmapEx::Draw( OutputDevice* pOutDev,
+ const Point& rDestPt, const Size& rDestSize ) const
+{
+ pOutDev->DrawBitmapEx( rDestPt, rDestSize, *this );
+}
+
+// ------------------------------------------------------------------
+
+void BitmapEx::Draw( OutputDevice* pOutDev,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel ) const
+{
+ pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this );
+}
+
+// ------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx )
+{
+ rBitmapEx.aBitmap.Write( rOStm );
+
+ rOStm << (UINT32) 0x25091962;
+ rOStm << (UINT32) 0xACB20201;
+ rOStm << (BYTE) rBitmapEx.eTransparent;
+
+ if( rBitmapEx.eTransparent == TRANSPARENT_BITMAP )
+ rBitmapEx.aMask.Write( rOStm );
+ else if( rBitmapEx.eTransparent == TRANSPARENT_COLOR )
+ rOStm << rBitmapEx.aTransparentColor;
+
+ return rOStm;
+}
+
+// ------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx )
+{
+ Bitmap aBmp;
+
+ rIStm >> aBmp;
+
+ if( !rIStm.GetError() )
+ {
+ const ULONG nStmPos = rIStm.Tell();
+ UINT32 nMagic1;
+ UINT32 nMagic2;
+
+ rIStm >> nMagic1 >> nMagic2;
+
+ if( ( nMagic1 != 0x25091962 ) || ( nMagic2 != 0xACB20201 ) || rIStm.GetError() )
+ {
+ rIStm.Seek( nStmPos );
+ rBitmapEx = aBmp;
+ }
+ else
+ {
+ BYTE bTransparent;
+
+ rIStm >> bTransparent;
+
+ if( bTransparent == (BYTE) TRANSPARENT_BITMAP )
+ {
+ Bitmap aMask;
+
+ rIStm >> aMask;
+
+ if( !!aMask)
+ {
+ // do we have an alpha mask?
+ if( ( 8 == aMask.GetBitCount() ) && aMask.HasGreyPalette() )
+ {
+ AlphaMask aAlpha;
+
+ // create alpha mask quickly (without greyscale conversion)
+ aAlpha.ImplSetBitmap( aMask );
+ rBitmapEx = BitmapEx( aBmp, aAlpha );
+ }
+ else
+ rBitmapEx = BitmapEx( aBmp, aMask );
+ }
+ else
+ rBitmapEx = aBmp;
+ }
+ else if( bTransparent == (BYTE) TRANSPARENT_COLOR )
+ {
+ Color aTransparentColor;
+
+ rIStm >> aTransparentColor;
+ rBitmapEx = BitmapEx( aBmp, aTransparentColor );
+ }
+ else
+ rBitmapEx = aBmp;
+ }
+ }
+
+ return rIStm;
+}
+
+// ------------------------------------------------------------------
+
+#ifdef REMOTE_APPSERVER
+
+void BitmapEx::ImplDrawRemote( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz ) const
+{
+ if( !!aBitmap )
+ {
+ switch( eTransparent )
+ {
+ case( TRANSPARENT_NONE ):
+ aBitmap.ImplDrawRemote( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz );
+ break;
+
+ case( TRANSPARENT_BITMAP ):
+ {
+ if( !!aMask )
+ {
+ if( IsAlpha() )
+ aBitmap.ImplDrawRemoteAlpha( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, GetAlpha() );
+ else
+ aBitmap.ImplDrawRemoteEx( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, aMask );
+ }
+ else
+ aBitmap.ImplDrawRemote( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz );
+ }
+ break;
+
+ default:
+ {
+ DBG_ERROR( "BitmapEx::ImplDrawRemote???" );
+ }
+ break;
+ }
+ }
+}
+
+#endif // REMOTE
diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
new file mode 100644
index 000000000000..6fc3657c90fd
--- /dev/null
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -0,0 +1,448 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmpacc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BMPACC_CXX
+
+#ifdef W31
+#include <tools/svwin.h>
+#endif
+
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_IMPBMP_HXX
+#include <impbmp.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#include <string.h>
+
+// --------------------
+// - BitmapReadAccess -
+// --------------------
+
+BitmapReadAccess::BitmapReadAccess( Bitmap& rBitmap, BOOL bModify ) :
+ mpBuffer ( NULL ),
+ mpScanBuf ( NULL ),
+ mbModify ( bModify ),
+ mFncGetPixel ( NULL ),
+ mFncSetPixel ( NULL )
+{
+ ImplCreate( rBitmap );
+}
+
+// ------------------------------------------------------------------
+
+BitmapReadAccess::BitmapReadAccess( Bitmap& rBitmap ) :
+ mpBuffer ( NULL ),
+ mpScanBuf ( NULL ),
+ mbModify ( FALSE ),
+ mFncGetPixel ( NULL ),
+ mFncSetPixel ( NULL )
+{
+ ImplCreate( rBitmap );
+}
+
+// ------------------------------------------------------------------
+
+BitmapReadAccess::~BitmapReadAccess()
+{
+ ImplDestroy();
+}
+
+// ------------------------------------------------------------------
+
+void BitmapReadAccess::ImplCreate( Bitmap& rBitmap )
+{
+ ImpBitmap* pImpBmp = rBitmap.ImplGetImpBitmap();
+
+ BMP_ASSERT( pImpBmp, "Forbidden Access to empty bitmap!" );
+
+ if( pImpBmp )
+ {
+ if( mbModify && !maBitmap.ImplGetImpBitmap() )
+ {
+ rBitmap.ImplMakeUnique();
+ pImpBmp = rBitmap.ImplGetImpBitmap();
+ }
+ else
+ {
+ BMP_ASSERT( !mbModify || pImpBmp->ImplGetRefCount() == 2,
+ "Unpredictable results: bitmap is referenced more than once!" );
+ }
+
+ mpBuffer = pImpBmp->ImplAcquireBuffer( !mbModify );
+
+ if( !mpBuffer )
+ {
+ ImpBitmap* pNewImpBmp = new ImpBitmap;
+
+ if( pNewImpBmp->ImplCreate( *pImpBmp, rBitmap.GetBitCount() ) )
+ {
+ pImpBmp = pNewImpBmp;
+ rBitmap.ImplSetImpBitmap( pImpBmp );
+ mpBuffer = pImpBmp->ImplAcquireBuffer( !mbModify );
+ }
+ else
+ delete pNewImpBmp;
+ }
+
+ if( mpBuffer )
+ {
+ const long nHeight = mpBuffer->mnHeight;
+ Scanline pTmpLine = mpBuffer->mpBits;
+
+ mpScanBuf = new Scanline[ nHeight ];
+ maColorMask = mpBuffer->maColorMask;
+
+ if( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
+ {
+ for( long nY = 0L; nY < nHeight; nY++, pTmpLine += mpBuffer->mnScanlineSize )
+ mpScanBuf[ nY ] = pTmpLine;
+ }
+ else
+ {
+ for( long nY = nHeight - 1; nY >= 0; nY--, pTmpLine += mpBuffer->mnScanlineSize )
+ mpScanBuf[ nY ] = pTmpLine;
+ }
+
+ if( !ImplSetAccessPointers( BMP_SCANLINE_FORMAT( mpBuffer->mnFormat ) ) )
+ {
+ delete[] mpScanBuf;
+ mpScanBuf = NULL;
+
+ pImpBmp->ImplReleaseBuffer( mpBuffer, !mbModify );
+ mpBuffer = NULL;
+ }
+ else
+ maBitmap = rBitmap;
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void BitmapReadAccess::ImplDestroy()
+{
+ ImpBitmap* pImpBmp = maBitmap.ImplGetImpBitmap();
+
+ delete[] mpScanBuf;
+ mpScanBuf = NULL;
+
+ if( mpBuffer && pImpBmp )
+ {
+ pImpBmp->ImplReleaseBuffer( mpBuffer, !mbModify );
+ mpBuffer = NULL;
+ }
+}
+
+// ------------------------------------------------------------------
+
+BOOL BitmapReadAccess::ImplSetAccessPointers( ULONG nFormat )
+{
+ BOOL bRet = TRUE;
+
+ switch( nFormat )
+ {
+ CASE_FORMAT( _1BIT_MSB_PAL )
+ CASE_FORMAT( _1BIT_LSB_PAL )
+ CASE_FORMAT( _4BIT_MSN_PAL )
+ CASE_FORMAT( _4BIT_LSN_PAL )
+ CASE_FORMAT( _8BIT_PAL )
+ CASE_FORMAT( _8BIT_TC_MASK )
+ CASE_FORMAT( _16BIT_TC_MASK )
+ CASE_FORMAT( _24BIT_TC_BGR )
+ CASE_FORMAT( _24BIT_TC_RGB )
+ CASE_FORMAT( _24BIT_TC_MASK )
+ CASE_FORMAT( _32BIT_TC_ABGR )
+ CASE_FORMAT( _32BIT_TC_ARGB )
+ CASE_FORMAT( _32BIT_TC_BGRA )
+ CASE_FORMAT( _32BIT_TC_RGBA )
+ CASE_FORMAT( _32BIT_TC_MASK )
+
+ default:
+ bRet = FALSE;
+ break;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+void BitmapReadAccess::ImplZeroInitUnusedBits()
+{
+ const sal_uInt32 nWidth = Width(), nHeight = Height(), nScanSize = GetScanlineSize();
+
+ if( nWidth && nHeight && nScanSize && GetBuffer() )
+ {
+ DBG_ASSERT( !( nScanSize % 4 ), "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported scanline alignment" );
+
+ sal_uInt32 nBits;
+
+ switch( GetScanlineFormat() )
+ {
+ case( BMP_FORMAT_1BIT_MSB_PAL ):
+ nBits = 1;
+ break;
+
+ case( BMP_FORMAT_4BIT_MSN_PAL ):
+ nBits = 4;
+ break;
+
+ case( BMP_FORMAT_8BIT_PAL ):
+ case( BMP_FORMAT_8BIT_TC_MASK ):
+ nBits = 8;
+ break;
+
+ case( BMP_FORMAT_16BIT_TC_MASK ):
+ nBits = 16;
+ break;
+
+ case( BMP_FORMAT_24BIT_TC_BGR ):
+ case( BMP_FORMAT_24BIT_TC_RGB ):
+ case( BMP_FORMAT_24BIT_TC_MASK ):
+ nBits = 24;
+ break;
+
+ case( BMP_FORMAT_32BIT_TC_ABGR ):
+ case( BMP_FORMAT_32BIT_TC_ARGB ):
+ case( BMP_FORMAT_32BIT_TC_BGRA ):
+ case( BMP_FORMAT_32BIT_TC_RGBA ):
+ case( BMP_FORMAT_32BIT_TC_MASK ):
+ nBits = 32;
+ break;
+
+ default:
+ {
+ DBG_ERROR( "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported pixel format" );
+ nBits = 0;
+ }
+ break;
+ }
+
+ if( ( nBits *= nWidth ) & 0x1f )
+ {
+ sal_uInt32 nMask = 0xffffffff << ( ( nScanSize << 3 ) - nBits );
+ BYTE* pLast4Bytes = (BYTE*) GetBuffer() + ( nScanSize - 4 );
+
+#ifdef __LITTLEENDIAN
+ nMask = SWAPLONG( nMask );
+#endif
+ for( long i = 0; i < nHeight; i++, pLast4Bytes += nScanSize )
+ ( *(long*) pLast4Bytes ) &= nMask;
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void BitmapReadAccess::Flush()
+{
+ ImplDestroy();
+}
+
+// ------------------------------------------------------------------
+
+void BitmapReadAccess::ReAccess( BOOL bModify )
+{
+ const ImpBitmap* pImpBmp = maBitmap.ImplGetImpBitmap();
+
+ BMP_ASSERT( !mpBuffer, "No ReAccess possible while bitmap is being accessed!" );
+ BMP_ASSERT( pImpBmp && ( pImpBmp->ImplGetRefCount() > 1UL ), "Accessed bitmap does not exist anymore!" );
+
+ if( !mpBuffer && pImpBmp && ( pImpBmp->ImplGetRefCount() > 1UL ) )
+ {
+ mbModify = bModify;
+ ImplCreate( maBitmap );
+ }
+}
+
+// ------------------------------------------------------------------
+
+USHORT BitmapReadAccess::GetBestPaletteIndex( const BitmapColor& rBitmapColor ) const
+{
+ return( HasPalette() ? mpBuffer->maPalette.GetBestIndex( rBitmapColor ) : 0 );
+}
+
+// ---------------------
+// - BitmapWriteAccess -
+// ---------------------
+
+BitmapWriteAccess::~BitmapWriteAccess()
+{
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::ImplInitDraw()
+{
+ if( HasPalette() )
+ {
+ if( !maLineColor.IsIndex() )
+ maLineColor = (BYTE) GetBestPaletteIndex( maLineColor );
+
+ if( !maFillColor.IsIndex() )
+ maFillColor = (BYTE) GetBestPaletteIndex( maFillColor );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::CopyScanline( long nY, const BitmapReadAccess& rReadAcc )
+{
+ BMP_ASSERT( ( nY >= 0 ) && ( nY < mpBuffer->mnHeight ), "y-coordinate in destination out of range!" );
+ BMP_ASSERT( nY < rReadAcc.Height(), "y-coordinate in source out of range!" );
+ BMP_ASSERT( ( HasPalette() && rReadAcc.HasPalette() ) || ( !HasPalette() && !rReadAcc.HasPalette() ), "No copying possible between palette bitmap and TC bitmap!" );
+
+ if( ( GetScanlineFormat() == rReadAcc.GetScanlineFormat() ) &&
+ ( GetScanlineSize() >= rReadAcc.GetScanlineSize() ) )
+ {
+ HMEMCPY( mpScanBuf[ nY ], rReadAcc.GetScanline( nY ), rReadAcc.GetScanlineSize() );
+ }
+ else
+ for( long nX = 0L, nWidth = Min( mpBuffer->mnWidth, rReadAcc.Width() ); nX < nWidth; nX++ )
+ SetPixel( nY, nX, rReadAcc.GetPixel( nY, nX ) );
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::CopyScanline( long nY, const Scanline aSrcScanline,
+ ULONG nSrcScanlineFormat, ULONG nSrcScanlineSize )
+{
+ const ULONG nFormat = BMP_SCANLINE_FORMAT( nSrcScanlineFormat );
+
+ BMP_ASSERT( ( nY >= 0 ) && ( nY < mpBuffer->mnHeight ), "y-coordinate in destination out of range!" );
+ BMP_ASSERT( ( HasPalette() && nFormat <= BMP_FORMAT_8BIT_PAL ) ||
+ ( !HasPalette() && nFormat > BMP_FORMAT_8BIT_PAL ),
+ "No copying possible between palette and non palette scanlines!" );
+
+ const ULONG nCount = Min( GetScanlineSize(), nSrcScanlineSize );
+
+ if( nCount )
+ {
+ if( GetScanlineFormat() == BMP_SCANLINE_FORMAT( nSrcScanlineFormat ) )
+ HMEMCPY( mpScanBuf[ nY ], aSrcScanline, nCount );
+ else
+ {
+ BMP_ASSERT( nFormat != BMP_FORMAT_8BIT_TC_MASK && nFormat != BMP_FORMAT_16BIT_TC_MASK &&
+ nFormat != BMP_FORMAT_24BIT_TC_MASK && nFormat != BMP_FORMAT_32BIT_TC_MASK,
+ "No support for pixel formats with color masks yet!" );
+
+ FncGetPixel pFncGetPixel;
+
+ switch( nFormat )
+ {
+ case( BMP_FORMAT_1BIT_MSB_PAL ): pFncGetPixel = GetPixelFor_1BIT_MSB_PAL; break;
+ case( BMP_FORMAT_1BIT_LSB_PAL ): pFncGetPixel = GetPixelFor_1BIT_LSB_PAL; break;
+ case( BMP_FORMAT_4BIT_MSN_PAL ): pFncGetPixel = GetPixelFor_4BIT_MSN_PAL; break;
+ case( BMP_FORMAT_4BIT_LSN_PAL ): pFncGetPixel = GetPixelFor_4BIT_LSN_PAL; break;
+ case( BMP_FORMAT_8BIT_PAL ): pFncGetPixel = GetPixelFor_8BIT_PAL; break;
+ case( BMP_FORMAT_8BIT_TC_MASK ): pFncGetPixel = GetPixelFor_8BIT_TC_MASK; break;
+ case( BMP_FORMAT_16BIT_TC_MASK ): pFncGetPixel = GetPixelFor_16BIT_TC_MASK; break;
+ case( BMP_FORMAT_24BIT_TC_BGR ): pFncGetPixel = GetPixelFor_24BIT_TC_BGR; break;
+ case( BMP_FORMAT_24BIT_TC_RGB ): pFncGetPixel = GetPixelFor_24BIT_TC_RGB; break;
+ case( BMP_FORMAT_24BIT_TC_MASK ): pFncGetPixel = GetPixelFor_24BIT_TC_MASK; break;
+ case( BMP_FORMAT_32BIT_TC_ABGR ): pFncGetPixel = GetPixelFor_32BIT_TC_ABGR; break;
+ case( BMP_FORMAT_32BIT_TC_ARGB ): pFncGetPixel = GetPixelFor_32BIT_TC_ARGB; break;
+ case( BMP_FORMAT_32BIT_TC_BGRA ): pFncGetPixel = GetPixelFor_32BIT_TC_BGRA; break;
+ case( BMP_FORMAT_32BIT_TC_RGBA ): pFncGetPixel = GetPixelFor_32BIT_TC_RGBA; break;
+ case( BMP_FORMAT_32BIT_TC_MASK ): pFncGetPixel = GetPixelFor_32BIT_TC_MASK; break;
+
+ default:
+ pFncGetPixel = NULL;
+ break;
+ }
+
+ if( pFncGetPixel )
+ {
+ const ColorMask aDummyMask;
+
+ for( long nX = 0L, nWidth = mpBuffer->mnWidth; nX < nWidth; nX++ )
+ SetPixel( nY, nX, pFncGetPixel( aSrcScanline, nX, aDummyMask ) );
+ }
+ }
+ }
+}
+
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::CopyBuffer( const BitmapReadAccess& rReadAcc )
+{
+ BMP_ASSERT( ( HasPalette() && rReadAcc.HasPalette() ) || ( !HasPalette() && !rReadAcc.HasPalette() ), "No copying possible between palette bitmap and TC bitmap!" );
+
+ if( ( GetScanlineFormat() == rReadAcc.GetScanlineFormat() ) &&
+ ( GetScanlineSize() == rReadAcc.GetScanlineSize() ) )
+ {
+ const long nHeight = Min( mpBuffer->mnHeight, rReadAcc.Height() );
+ const ULONG nCount = nHeight * mpBuffer->mnScanlineSize;
+
+ HMEMCPY( mpBuffer->mpBits, rReadAcc.GetBuffer(), nCount );
+ }
+ else
+ for( long nY = 0L, nHeight = Min( mpBuffer->mnHeight, rReadAcc.Height() ); nY < nHeight; nY++ )
+ CopyScanline( nY, rReadAcc );
+}
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
new file mode 100644
index 000000000000..a07f58815a88
--- /dev/null
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmpacc2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BMPACC2_CXX
+
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+
+// ----------------
+// - BitmapAccess -
+// ----------------
+
+IMPL_FORMAT_GETPIXEL( _1BIT_MSB_PAL )
+{
+ return( pScanline[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _1BIT_MSB_PAL )
+{
+ BYTE& rByte = pScanline[ nX >> 3 ];
+
+ ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( 7 - ( nX & 7 ) ) ) :
+ ( rByte &= ~( 1 << ( 7 - ( nX & 7 ) ) ) );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _1BIT_LSB_PAL )
+{
+ return( pScanline[ nX >> 3 ] & ( 1 << ( nX & 7 ) ) ? 1 : 0 );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _1BIT_LSB_PAL )
+{
+ BYTE& rByte = pScanline[ nX >> 3 ];
+
+ ( rBitmapColor.GetIndex() & 1 ) ? ( rByte |= 1 << ( nX & 7 ) ) :
+ ( rByte &= ~( 1 << ( nX & 7 ) ) );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _4BIT_MSN_PAL )
+{
+ return( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 0 : 4 ) ) & 0x0f );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _4BIT_MSN_PAL )
+{
+ BYTE& rByte = pScanline[ nX >> 1 ];
+
+ ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) ) :
+ ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _4BIT_LSN_PAL )
+{
+ return( ( pScanline[ nX >> 1 ] >> ( nX & 1 ? 4 : 0 ) ) & 0x0f );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _4BIT_LSN_PAL )
+{
+ BYTE& rByte = pScanline[ nX >> 1 ];
+
+ ( nX & 1 ) ? ( rByte &= 0x0f, rByte |= ( rBitmapColor.GetIndex() << 4 ) ) :
+ ( rByte &= 0xf0, rByte |= ( rBitmapColor.GetIndex() & 0x0f ) );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _8BIT_PAL )
+{
+ return pScanline[ nX ];
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _8BIT_PAL )
+{
+ pScanline[ nX ] = rBitmapColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _8BIT_TC_MASK )
+{
+ BitmapColor aColor;
+ rMask.GetColorFor8Bit( aColor, pScanline + nX );
+ return aColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _8BIT_TC_MASK )
+{
+ rMask.SetColorFor8Bit( rBitmapColor, pScanline + nX );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _16BIT_TC_MASK )
+{
+ BitmapColor aColor;
+ rMask.GetColorFor16Bit( aColor, pScanline + ( nX << 1UL ) );
+ return aColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _16BIT_TC_MASK )
+{
+ rMask.SetColorFor16Bit( rBitmapColor, pScanline + ( nX << 1UL ) );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _24BIT_TC_BGR )
+{
+ BitmapColor aBitmapColor;
+
+ aBitmapColor.SetBlue( *( pScanline = pScanline + nX * 3 )++ );
+ aBitmapColor.SetGreen( *pScanline++ );
+ aBitmapColor.SetRed( *pScanline );
+
+ return aBitmapColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _24BIT_TC_BGR )
+{
+ *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetBlue();
+ *pScanline++ = rBitmapColor.GetGreen();
+ *pScanline = rBitmapColor.GetRed();
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _24BIT_TC_RGB )
+{
+ BitmapColor aBitmapColor;
+
+ aBitmapColor.SetRed( *( pScanline = pScanline + nX * 3 )++ );
+ aBitmapColor.SetGreen( *pScanline++ );
+ aBitmapColor.SetBlue( *pScanline );
+
+ return aBitmapColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _24BIT_TC_RGB )
+{
+ *( pScanline = pScanline + nX * 3 )++ = rBitmapColor.GetRed();
+ *pScanline++ = rBitmapColor.GetGreen();
+ *pScanline = rBitmapColor.GetBlue();
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _24BIT_TC_MASK )
+{
+ BitmapColor aColor;
+ rMask.GetColorFor24Bit( aColor, pScanline + nX * 3L );
+ return aColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _24BIT_TC_MASK )
+{
+ rMask.SetColorFor24Bit( rBitmapColor, pScanline + nX * 3L );
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _32BIT_TC_ABGR )
+{
+ BitmapColor aBitmapColor;
+
+ aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
+ aBitmapColor.SetGreen( *pScanline++ );
+ aBitmapColor.SetRed( *pScanline );
+
+ return aBitmapColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _32BIT_TC_ABGR )
+{
+ *( pScanline = pScanline + ( nX << 2 ) )++ = 0;
+ *pScanline++ = rBitmapColor.GetBlue();
+ *pScanline++ = rBitmapColor.GetGreen();
+ *pScanline = rBitmapColor.GetRed();
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _32BIT_TC_ARGB )
+{
+ BitmapColor aBitmapColor;
+
+ aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
+ aBitmapColor.SetGreen( *pScanline++ );
+ aBitmapColor.SetBlue( *pScanline );
+
+ return aBitmapColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _32BIT_TC_ARGB )
+{
+ *( pScanline = pScanline + ( nX << 2 ) )++ = 0;
+ *pScanline++ = rBitmapColor.GetRed();
+ *pScanline++ = rBitmapColor.GetGreen();
+ *pScanline = rBitmapColor.GetBlue();
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _32BIT_TC_BGRA )
+{
+ BitmapColor aBitmapColor;
+
+ aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) )++ );
+ aBitmapColor.SetGreen( *pScanline++ );
+ aBitmapColor.SetRed( *pScanline );
+
+ return aBitmapColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _32BIT_TC_BGRA )
+{
+ *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue();
+ *pScanline++ = rBitmapColor.GetGreen();
+ *pScanline++ = rBitmapColor.GetRed();
+ *pScanline = 0;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _32BIT_TC_RGBA )
+{
+ BitmapColor aBitmapColor;
+
+ aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) )++ );
+ aBitmapColor.SetGreen( *pScanline++ );
+ aBitmapColor.SetBlue( *pScanline );
+
+ return aBitmapColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _32BIT_TC_RGBA )
+{
+ *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed();
+ *pScanline++ = rBitmapColor.GetGreen();
+ *pScanline++ = rBitmapColor.GetBlue();
+ *pScanline = 0;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_GETPIXEL( _32BIT_TC_MASK )
+{
+ BitmapColor aColor;
+ rMask.GetColorFor32Bit( aColor, pScanline + ( nX << 2UL ) );
+ return aColor;
+}
+
+// ------------------------------------------------------------------
+
+IMPL_FORMAT_SETPIXEL( _32BIT_TC_MASK )
+{
+ rMask.SetColorFor32Bit( rBitmapColor, pScanline + ( nX << 2UL ) );
+}
diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx
new file mode 100644
index 000000000000..c26de8c7ecfa
--- /dev/null
+++ b/vcl/source/gdi/bmpacc3.cxx
@@ -0,0 +1,351 @@
+/*************************************************************************
+ *
+ * $RCSfile: bmpacc3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BMPACC_CXX
+
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_REGION_HXX
+#include <region.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+
+// ---------------------
+// - BitmapWriteAccess -
+// ---------------------
+
+void BitmapWriteAccess::Erase( const Color& rColor )
+{
+ const BitmapColor aOldFillColor( maFillColor );
+ const Point aPoint;
+ const Rectangle aRect( aPoint, maBitmap.GetSizePixel() );
+
+ SetFillColor( rColor );
+ FillRect( aRect );
+ maFillColor = aOldFillColor;
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd )
+{
+ long nX;
+ long nY;
+
+ ImplInitDraw();
+
+ if ( rStart.X() == rEnd.X() )
+ {
+ // vertikale Line
+ const long nEndY = rEnd.Y();
+
+ nX = rStart.X();
+ nY = rStart.Y();
+
+ if ( nEndY > nY )
+ {
+ for (; nY <= nEndY; nY++ )
+ SetPixel( nY, nX, maLineColor );
+ }
+ else
+ {
+ for (; nY >= nEndY; nY-- )
+ SetPixel( nY, nX, maLineColor );
+ }
+ }
+ else if ( rStart.Y() == rEnd.Y() )
+ {
+ // horizontale Line
+ const long nEndX = rEnd.X();
+
+ nX = rStart.X();
+ nY = rStart.Y();
+
+ if ( nEndX > nX )
+ {
+ for (; nX <= nEndX; nX++ )
+ SetPixel( nY, nX, maLineColor );
+ }
+ else
+ {
+ for (; nX >= nEndX; nX-- )
+ SetPixel( nY, nX, maLineColor );
+ }
+ }
+ else
+ {
+ const long nDX = labs( rEnd.X() - rStart.X() );
+ const long nDY = labs( rEnd.Y() - rStart.Y() );
+ long nX1;
+ long nY1;
+ long nX2;
+ long nY2;
+
+ if ( nDX >= nDY )
+ {
+ if ( rStart.X() < rEnd.X() )
+ {
+ nX1 = rStart.X();
+ nY1 = rStart.Y();
+ nX2 = rEnd.X();
+ nY2 = rEnd.Y();
+ }
+ else
+ {
+ nX1 = rEnd.X();
+ nY1 = rEnd.Y();
+ nX2 = rStart.X();
+ nY2 = rStart.Y();
+ }
+
+ const long nDYX = ( nDY - nDX ) << 1;
+ const long nDY2 = nDY << 1;
+ long nD = nDY2 - nDX;
+ BOOL bPos = nY1 < nY2;
+
+ for ( nX = nX1, nY = nY1; nX <= nX2; nX++ )
+ {
+ SetPixel( nY, nX, maLineColor );
+
+ if ( nD < 0 )
+ nD += nDY2;
+ else
+ {
+ nD += nDYX;
+
+ if ( bPos )
+ nY++;
+ else
+ nY--;
+ }
+ }
+ }
+ else
+ {
+ if ( rStart.Y() < rEnd.Y() )
+ {
+ nX1 = rStart.X();
+ nY1 = rStart.Y();
+ nX2 = rEnd.X();
+ nY2 = rEnd.Y();
+ }
+ else
+ {
+ nX1 = rEnd.X();
+ nY1 = rEnd.Y();
+ nX2 = rStart.X();
+ nY2 = rStart.Y();
+ }
+
+ const long nDYX = ( nDX - nDY ) << 1;
+ const long nDY2 = nDX << 1;
+ long nD = nDY2 - nDY;
+ BOOL bPos = nX1 < nX2;
+
+ for ( nX = nX1, nY = nY1; nY <= nY2; nY++ )
+ {
+ SetPixel( nY, nX, maLineColor );
+
+ if ( nD < 0 )
+ nD += nDY2;
+ else
+ {
+ nD += nDYX;
+
+ if ( bPos )
+ nX++;
+ else
+ nX--;
+ }
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::DrawRect( const Rectangle& rRect )
+{
+ ImplInitDraw();
+ FillRect( rRect );
+ DrawLine( rRect.TopLeft(), rRect.TopRight() );
+ DrawLine( rRect.TopRight(), rRect.BottomRight() );
+ DrawLine( rRect.BottomRight(), rRect.BottomLeft() );
+ DrawLine( rRect.BottomLeft(), rRect.TopLeft() );
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::FillRect( const Rectangle& rRect )
+{
+ Point aPoint;
+ Rectangle aRect( aPoint, maBitmap.GetSizePixel() );
+
+ aRect.Intersection( rRect );
+
+ if( !aRect.IsEmpty() )
+ {
+ const long nStartX = rRect.TopLeft().X();
+ const long nStartY = rRect.TopLeft().Y();
+ const long nEndX = rRect.BottomRight().X();
+ const long nEndY = rRect.BottomRight().Y();
+
+ ImplInitDraw();
+
+ for( long nY = nStartY; nY <= nEndY; nY++ )
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ SetPixel( nY, nX, maFillColor );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::DrawPolygon( const Polygon& rPoly )
+{
+ const USHORT nSize = rPoly.GetSize();
+
+ if( nSize )
+ {
+ Region aRegion( rPoly );
+ Rectangle aRect;
+
+ aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
+
+ if( !aRegion.IsEmpty() )
+ {
+ RegionHandle aRegHandle( aRegion.BeginEnumRects() );
+
+ ImplInitDraw();
+
+ while( aRegion.GetNextEnumRect( aRegHandle, aRect ) )
+ for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
+ for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
+ SetPixel( nY, nX, maFillColor );
+
+ aRegion.EndEnumRects( aRegHandle );
+ }
+
+ if( maLineColor != maFillColor )
+ {
+ for( USHORT i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
+ DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
+
+ if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
+ DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ const USHORT nCount = rPolyPoly.Count();
+
+ if( nCount )
+ {
+ Region aRegion( rPolyPoly );
+ Rectangle aRect;
+
+ aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
+
+ if( !aRegion.IsEmpty() )
+ {
+ RegionHandle aRegHandle( aRegion.BeginEnumRects() );
+
+ ImplInitDraw();
+
+ while( aRegion.GetNextEnumRect( aRegHandle, aRect ) )
+ for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
+ for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
+ SetPixel( nY, nX, maFillColor );
+
+ aRegion.EndEnumRects( aRegHandle );
+ }
+
+ if( maLineColor != maFillColor )
+ {
+ for( USHORT n = 0; n < nCount; )
+ {
+ const Polygon& rPoly = rPolyPoly[ n++ ];
+ const USHORT nSize = rPoly.GetSize();
+
+ if( nSize )
+ {
+ for( USHORT i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
+ DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
+
+ if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
+ DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
+ }
+ }
+ }
+ }
+}
diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx
new file mode 100644
index 000000000000..1005cf3396d5
--- /dev/null
+++ b/vcl/source/gdi/cvtgrf.cxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * $RCSfile: cvtgrf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_CVTGRF_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_CVTGRF_HXX
+#include <cvtgrf.hxx>
+#endif
+
+// --------------
+// - Callback -
+// --------------
+
+#ifndef REMOTE_APPSERVER
+
+ULONG ImplFilterCallback( void* pInst,
+ ULONG nInFormat, void* pInBuffer, ULONG nInBufSize,
+ ULONG nOutFormat, void** ppOutBuffer )
+{
+ return( ( (GraphicConverter*) pInst )->ImplConvert( nInFormat,
+ pInBuffer, nInBufSize,
+ ppOutBuffer, nOutFormat ) );
+}
+
+#endif
+
+// --------------------
+// - GraphicConverter -
+// --------------------
+
+GraphicConverter::GraphicConverter() :
+ mpConvertData( NULL )
+{
+#ifndef REMOTE_APPSERVER
+ SetFilterCallback( ImplFilterCallback, this );
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+GraphicConverter::~GraphicConverter()
+{
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GraphicConverter::ImplConvert( ULONG nInFormat, void* pInBuffer, ULONG nInBufSize,
+ void** ppOutBuffer, ULONG nOutFormat )
+{
+ ULONG nRetBufSize = 0UL;
+
+ if( ( nInFormat != nOutFormat ) && pInBuffer )
+ {
+ if( ( nInFormat == CVT_SVM ) || ( nInFormat == CVT_BMP ) )
+ {
+ SvMemoryStream aIStm;
+ Graphic aGraphic;
+
+ aIStm.SetBuffer( (char*) pInBuffer, nInBufSize, FALSE, nInBufSize );
+ aIStm >> aGraphic;
+
+ if( !aIStm.GetError() )
+ {
+ SvMemoryStream aOStm( 64535, 64535 );
+
+ mpConvertData = new ConvertData( aGraphic, aOStm, nOutFormat );
+
+ if( maFilterHdl.IsSet() && maFilterHdl.Call( mpConvertData ) )
+ {
+ nRetBufSize = aOStm.Seek( STREAM_SEEK_TO_END );
+ *ppOutBuffer = (void*) aOStm.GetData();
+ aOStm.ObjectOwnsMemory( FALSE );
+ }
+
+ delete mpConvertData;
+ mpConvertData = NULL;
+ }
+ }
+ else if( ( nOutFormat == CVT_SVM ) || ( nOutFormat == CVT_BMP ) )
+ {
+ SvMemoryStream aIStm;
+
+ aIStm.SetBuffer( (char*) pInBuffer, nInBufSize, FALSE, nInBufSize );
+ mpConvertData = new ConvertData( Graphic(), aIStm, nInFormat );
+
+ if( maFilterHdl.IsSet() && maFilterHdl.Call( mpConvertData ) )
+ {
+ SvMemoryStream aOStm( 645535, 64535 );
+ Graphic& rGraphic = mpConvertData->maGraphic;
+
+ if( ( rGraphic.GetType() == GRAPHIC_BITMAP ) && ( CVT_SVM == nOutFormat ) )
+ {
+ GDIMetaFile aMtf;
+
+ aMtf.SetPrefSize( rGraphic.GetPrefSize() );
+ aMtf.SetPrefMapMode( rGraphic.GetPrefMapMode() );
+ aMtf.AddAction( new MetaBmpExScaleAction( Point(), aMtf.GetPrefSize(), rGraphic.GetBitmapEx() ) );
+ rGraphic = aMtf;
+ }
+ else if( ( rGraphic.GetType() == GRAPHIC_GDIMETAFILE ) && ( CVT_BMP == nOutFormat ) )
+ rGraphic = rGraphic.GetBitmapEx();
+
+ aOStm << rGraphic;
+
+ if( !aOStm.GetError() )
+ {
+ nRetBufSize = aOStm.Seek( STREAM_SEEK_TO_END );
+ *ppOutBuffer = (void*) aOStm.GetData();
+ aOStm.ObjectOwnsMemory( FALSE );
+ }
+ }
+
+ delete mpConvertData;
+ mpConvertData = NULL;
+ }
+ }
+
+ return nRetBufSize;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, ULONG nFormat )
+{
+ GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
+ ULONG nRet = ERRCODE_IO_GENERAL;
+
+ if( pCvt && pCvt->GetFilterHdl().IsSet() )
+ {
+ ConvertData aData( rGraphic, rIStm, nFormat );
+
+ if( pCvt->GetFilterHdl().Call( &aData ) )
+ {
+ rGraphic = aData.maGraphic;
+ nRet = ERRCODE_NONE;
+ }
+ else if( rIStm.GetError() )
+ nRet = rIStm.GetError();
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, ULONG nFormat )
+{
+ GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
+ ULONG nRet = ERRCODE_IO_GENERAL;
+
+ if( pCvt && pCvt->GetFilterHdl().IsSet() )
+ {
+ ConvertData aData( rGraphic, rOStm, nFormat );
+
+ if( pCvt->GetFilterHdl().Call( &aData ) )
+ nRet = ERRCODE_NONE;
+ else if( rOStm.GetError() )
+ nRet = rOStm.GetError();
+ }
+
+ return nRet;
+}
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
new file mode 100644
index 000000000000..f2ac9be53d5d
--- /dev/null
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -0,0 +1,2106 @@
+/*************************************************************************
+ *
+ * $RCSfile: cvtsvm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_CVTSVM_CXX
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#include <string.h>
+
+#ifndef _STACK_HXX //autogen
+#include <tools/stack.hxx>
+#endif
+#ifndef _DEBUG_HXX //autogen
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX //autogen
+#include <tools/stream.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_GRAPH_HXX
+#include <graph.hxx>
+#endif
+#ifndef _SV_LINEINFO_HXX
+#include <lineinfo.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#include <cvtsvm.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define CVTSVM_WRITE_SUBACTIONCOUNT 1
+
+// -----------
+// - Inlines -
+// -----------
+
+void ImplReadRect( SvStream& rIStm, Rectangle& rRect )
+{
+ Point aTL;
+ Point aBR;
+
+ rIStm >> aTL;
+ rIStm >> aBR;
+
+ rRect = Rectangle( aTL, aBR );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWriteRect( SvStream& rOStm, const Rectangle& rRect )
+{
+ rOStm << rRect.TopLeft();
+ rOStm << rRect.BottomRight();
+}
+
+// ------------------------------------------------------------------------
+
+void ImplReadPoly( SvStream& rIStm, Polygon& rPoly )
+{
+ INT32 nSize;
+
+ rIStm >> nSize;
+ rPoly = Polygon( (USHORT) nSize );
+
+ for( USHORT i = 0; i < (USHORT) nSize; i++ )
+ rIStm >> rPoly[ i ];
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWritePoly( SvStream& rOStm, const Polygon& rPoly )
+{
+ INT32 nSize = rPoly.GetSize();
+
+ rOStm << nSize;
+
+ for( INT32 i = 0; i < nSize; i++ )
+ rOStm << rPoly[ (USHORT) i ];
+}
+
+// ------------------------------------------------------------------------
+
+void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly )
+{
+ Polygon aPoly;
+ INT32 nPolyCount;
+
+ rIStm >> nPolyCount;
+
+ for( USHORT i = 0; i < (USHORT) nPolyCount; i++ )
+ {
+ ImplReadPoly( rIStm, aPoly );
+ rPolyPoly.Insert( aPoly );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly )
+{
+ const USHORT nPoly = rPolyPoly.Count();
+ USHORT nPoints = 0;
+ USHORT n;
+
+ for( n = 0; n < nPoly; n++ )
+ nPoints += rPolyPoly[ n ].GetSize();
+
+ rOStm << (INT16) GDI_POLYPOLYGON_ACTION;
+ rOStm << (INT32) ( 8 + ( nPoly << 2 ) + ( nPoints << 3 ) );
+ rOStm << (INT32) nPoly;
+
+ for( n = 0; n < nPoly; n++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ n ];
+ const USHORT nSize = rPoly.GetSize();
+
+ rOStm << (INT32) nSize;
+
+ for( USHORT j = 0; j < nSize; j++ )
+ rOStm << rPoly[ j ];
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImplReadColor( SvStream& rIStm, Color& rColor )
+{
+ INT16 nVal;
+
+ rIStm >> nVal; rColor.SetRed( (USHORT) nVal >> 8 );
+ rIStm >> nVal; rColor.SetGreen( (USHORT) nVal >> 8 );
+ rIStm >> nVal; rColor.SetBlue( (USHORT) nVal >> 8 );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWriteColor( SvStream& rOStm, const Color& rColor )
+{
+ INT16 nVal;
+
+ nVal = ( (INT16) rColor.GetRed() << 8 ) | rColor.GetRed();
+ rOStm << nVal;
+
+ nVal = ( (INT16) rColor.GetGreen() << 8 ) | rColor.GetGreen();
+ rOStm << nVal;
+
+ nVal = ( (INT16) rColor.GetBlue() << 8 ) | rColor.GetBlue();
+ rOStm << nVal;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode )
+{
+ Point aOrg;
+ INT32 nXNum;
+ INT32 nXDenom;
+ INT32 nYNum;
+ INT32 nYDenom;
+ INT16 nUnit;
+
+ rIStm >> nUnit >> aOrg >> nXNum >> nXDenom >> nYNum >> nYDenom;
+ rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), Fraction( nYNum, nYDenom ) );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
+{
+ rOStm << (INT16) rMapMode.GetMapUnit();
+ rOStm << rMapMode.GetOrigin();
+ rOStm << (INT32) rMapMode.GetScaleX().GetNumerator();
+ rOStm << (INT32) rMapMode.GetScaleX().GetDenominator();
+ rOStm << (INT32) rMapMode.GetScaleY().GetNumerator();
+ rOStm << (INT32) rMapMode.GetScaleY().GetDenominator();
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWritePushAction( SvStream& rOStm )
+{
+ rOStm << (INT16) GDI_PUSH_ACTION;
+ rOStm << (INT32) 4;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWritePopAction( SvStream& rOStm )
+{
+ rOStm << (INT16) GDI_POP_ACTION;
+ rOStm << (INT32) 4;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWriteLineColor( SvStream& rOStm, const Color& rColor, INT16 nStyle, INT32 nWidth = 0L )
+{
+ if( rColor.GetTransparency() > 127 )
+ nStyle = 0;
+
+ rOStm << (INT16) GDI_PEN_ACTION;
+ rOStm << (INT32) 16;
+ ImplWriteColor( rOStm, rColor );
+ rOStm << nWidth;
+ rOStm << nStyle;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWriteFillColor( SvStream& rOStm, const Color& rColor, INT16 nStyle )
+{
+ rOStm << (INT16) GDI_FILLBRUSH_ACTION;
+ rOStm << (INT32) 20;
+ ImplWriteColor( rOStm, rColor );
+
+ if( rColor.GetTransparency() > 127 )
+ nStyle = 0;
+
+ if( nStyle > 1 )
+ {
+ ImplWriteColor( rOStm, COL_WHITE );
+ rOStm << nStyle;
+ rOStm << (INT16) 1;
+ }
+ else
+ {
+ ImplWriteColor( rOStm, COL_BLACK );
+ rOStm << nStyle;
+ rOStm << (INT16) 0;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWriteFont( SvStream& rOStm, const Font& rFont,
+ rtl_TextEncoding& rActualCharSet )
+{
+ char aName[32];
+ short nWeight;
+
+ ByteString aByteName( rFont.GetName(), rOStm.GetStreamCharSet() );
+ strncpy( aName, aByteName.GetBuffer(), 32 );
+
+ switch ( rFont.GetWeight() )
+ {
+ case WEIGHT_THIN:
+ case WEIGHT_ULTRALIGHT:
+ case WEIGHT_LIGHT:
+ nWeight = 1;
+ break;
+
+ case WEIGHT_NORMAL:
+ case WEIGHT_MEDIUM:
+ nWeight = 2;
+ break;
+
+ case WEIGHT_BOLD:
+ case WEIGHT_ULTRABOLD:
+ case WEIGHT_BLACK:
+ nWeight = 3;
+ break;
+
+ default:
+ nWeight = 0;
+ break;
+ }
+
+ rOStm << (INT16) GDI_FONT_ACTION;
+ rOStm << (INT32) 78;
+
+ rActualCharSet = GetStoreCharSet( rFont.GetCharSet(), rOStm.GetVersion() );
+ ImplWriteColor( rOStm, rFont.GetColor() );
+ ImplWriteColor( rOStm, rFont.GetFillColor() );
+ rOStm.Write( aName, 32 );
+ rOStm << rFont.GetSize();
+ rOStm << (INT16) 0; // no character orientation anymore
+ rOStm << (INT16) rFont.GetOrientation();
+ rOStm << (INT16) rActualCharSet;
+ rOStm << (INT16) rFont.GetFamily();
+ rOStm << (INT16) rFont.GetPitch();
+ rOStm << (INT16) rFont.GetAlign();
+ rOStm << (INT16) nWeight;
+ rOStm << (INT16) rFont.GetUnderline();
+ rOStm << (INT16) rFont.GetStrikeout();
+ rOStm << (BOOL) ( rFont.GetItalic() != ITALIC_NONE );
+ rOStm << rFont.IsOutline();
+ rOStm << rFont.IsShadow();
+ rOStm << rFont.IsTransparent();
+ if ( rActualCharSet == RTL_TEXTENCODING_DONTKNOW )
+ rActualCharSet = gsl_getSystemTextEncoding();
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWriteRasterOpAction( SvStream& rOStm, INT16 nRasterOp )
+{
+ rOStm << (INT16) GDI_RASTEROP_ACTION << (INT32) 6 << nRasterOp;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplSkipActions( SvStream& rIStm, ULONG nSkipCount )
+{
+ INT32 nActionSize;
+ INT16 nType;
+
+ for( ULONG i = 0UL; i < nSkipCount; i++ )
+ {
+ rIStm >> nType >> nActionSize;
+ rIStm.SeekRel( nActionSize - 4L );
+ }
+}
+
+// ----------------
+// - SVMConverter -
+// ----------------
+
+SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& rMtf, ULONG nConvertMode )
+{
+ if( !rStm.GetError() )
+ {
+ if( CONVERT_FROM_SVM1 == nConvertMode )
+ ImplConvertFromSVM1( rStm, rMtf );
+ else if( CONVERT_TO_SVM1 == nConvertMode )
+ ImplConvertToSVM1( rStm, rMtf );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
+{
+ LineInfo aLineInfo( LINE_NONE, 0 );
+ Stack aLIStack;
+ ULONG nPos = rIStm.Tell();
+ const USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ rtl_TextEncoding eActualCharSet = gsl_getSystemTextEncoding();
+ BOOL bFatLine = FALSE;
+
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ char aCode[ 5 ];
+ MapMode aMapMode;
+ Size aPrefSz;
+ INT32 nActions;
+ INT16 nSize;
+ INT16 nVersion;
+
+ // Header lesen
+ rIStm.Read( (char*) &aCode, sizeof( aCode ) ); // Kennung
+ rIStm >> nSize; // Size
+ rIStm >> nVersion; // Version
+ rIStm >> aPrefSz; // PrefSize
+ ImplReadMapMode( rIStm, aMapMode ); // MapMode
+ rIStm >> nActions; // Action count
+
+ // Header-Kennung und Versionsnummer pruefen
+ if( ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 ) || ( nVersion != 200 ) )
+ {
+ rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ rIStm.SetNumberFormatInt( nOldFormat );
+ rIStm.Seek( nPos );
+ }
+ else
+ {
+ Polygon aPoly;
+ Rectangle aRect;
+ Point aPt, aPt1;
+ Size aSz;
+ Color aColor;
+ INT32 nTmp, nTmp1, nActionSize;
+ INT16 nType;
+
+ rMtf.SetPrefSize( aPrefSz );
+ rMtf.SetPrefMapMode( aMapMode );
+
+ for( INT32 i = 0L; i < nActions; i++ )
+ {
+ rIStm >> nType;
+ rIStm >> nActionSize;
+
+ DBG_ASSERT( ( nType <= 33 ) || ( nType >= 1024 ), "Unknown GDIMetaAction while converting!" );
+
+ switch( nType )
+ {
+ case( GDI_PIXEL_ACTION ):
+ {
+ rIStm >> aPt;
+ ImplReadColor( rIStm, aColor );
+ rMtf.AddAction( new MetaPixelAction( aPt, aColor ) );
+ }
+ break;
+
+ case( GDI_POINT_ACTION ):
+ {
+ rIStm >> aPt;
+ rMtf.AddAction( new MetaPointAction( aPt ) );
+ }
+ break;
+
+ case( GDI_LINE_ACTION ):
+ {
+ rIStm >> aPt >> aPt1;
+ rMtf.AddAction( new MetaLineAction( aPt, aPt1, aLineInfo ) );
+ }
+ break;
+
+ case( GDI_RECT_ACTION ):
+ {
+ ImplReadRect( rIStm, aRect );
+ rIStm >> nTmp >> nTmp1;
+
+ if( nTmp || nTmp1 )
+ rMtf.AddAction( new MetaRoundRectAction( aRect, nTmp, nTmp1 ) );
+ else
+ {
+ rMtf.AddAction( new MetaRectAction( aRect ) );
+
+ if( bFatLine )
+ rMtf.AddAction( new MetaPolyLineAction( aRect, aLineInfo ) );
+ }
+ }
+ break;
+
+ case( GDI_ELLIPSE_ACTION ):
+ {
+ ImplReadRect( rIStm, aRect );
+
+ if( bFatLine )
+ {
+ const Polygon aPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
+
+ rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) );
+ rMtf.AddAction( new MetaPolygonAction( aPoly ) );
+ rMtf.AddAction( new MetaPopAction() );
+ rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
+ }
+ else
+ rMtf.AddAction( new MetaEllipseAction( aRect ) );
+ }
+ break;
+
+ case( GDI_ARC_ACTION ):
+ {
+ ImplReadRect( rIStm, aRect );
+ rIStm >> aPt >> aPt1;
+
+ if( bFatLine )
+ {
+ const Polygon aPoly( aRect, aPt, aPt1, POLY_ARC );
+
+ rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) );
+ rMtf.AddAction( new MetaPolygonAction( aPoly ) );
+ rMtf.AddAction( new MetaPopAction() );
+ rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
+ }
+ else
+ rMtf.AddAction( new MetaArcAction( aRect, aPt, aPt1 ) );
+ }
+ break;
+
+ case( GDI_PIE_ACTION ):
+ {
+ ImplReadRect( rIStm, aRect );
+ rIStm >> aPt >> aPt1;
+
+ if( bFatLine )
+ {
+ const Polygon aPoly( aRect, aPt, aPt1, POLY_PIE );
+
+ rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) );
+ rMtf.AddAction( new MetaPolygonAction( aPoly ) );
+ rMtf.AddAction( new MetaPopAction() );
+ rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
+ }
+ else
+ rMtf.AddAction( new MetaPieAction( aRect, aPt, aPt1 ) );
+ }
+ break;
+
+ case( GDI_INVERTRECT_ACTION ):
+ case( GDI_HIGHLIGHTRECT_ACTION ):
+ {
+ ImplReadRect( rIStm, aRect );
+ rMtf.AddAction( new MetaPushAction( PUSH_RASTEROP ) );
+ rMtf.AddAction( new MetaRasterOpAction( ROP_INVERT ) );
+ rMtf.AddAction( new MetaRectAction( aRect ) );
+ rMtf.AddAction( new MetaPopAction() );
+ }
+ break;
+
+ case( GDI_POLYLINE_ACTION ):
+ {
+ ImplReadPoly( rIStm, aPoly );
+
+ if( bFatLine )
+ rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
+ else
+ rMtf.AddAction( new MetaPolyLineAction( aPoly ) );
+ }
+ break;
+
+ case( GDI_POLYGON_ACTION ):
+ {
+ ImplReadPoly( rIStm, aPoly );
+
+ if( bFatLine )
+ {
+ rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) );
+ rMtf.AddAction( new MetaPolygonAction( aPoly ) );
+ rMtf.AddAction( new MetaPopAction() );
+ rMtf.AddAction( new MetaPolyLineAction( aPoly, aLineInfo ) );
+ }
+ else
+ rMtf.AddAction( new MetaPolygonAction( aPoly ) );
+ }
+ break;
+
+ case( GDI_POLYPOLYGON_ACTION ):
+ {
+ PolyPolygon aPolyPoly;
+
+ ImplReadPolyPoly( rIStm, aPolyPoly );
+
+ if( bFatLine )
+ {
+ rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ rMtf.AddAction( new MetaLineColorAction( COL_TRANSPARENT, FALSE ) );
+ rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
+ rMtf.AddAction( new MetaPopAction() );
+
+ for( USHORT nPoly = 0, nCount = aPolyPoly.Count(); nPoly < nCount; nPoly++ )
+ rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) );
+ }
+ else
+ rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
+ }
+ break;
+
+ case( GDI_FONT_ACTION ):
+ {
+ Font aFont;
+ char aName[ 32 ];
+ INT32 nWidth, nHeight;
+ INT16 nCharSet, nFamily, nPitch, nAlign, nWeight, nUnderline, nStrikeout;
+ INT16 nCharOrient, nLineOrient;
+ BOOL bItalic, bOutline, bShadow, bTransparent;
+
+ ImplReadColor( rIStm, aColor ); aFont.SetColor( aColor );
+ ImplReadColor( rIStm, aColor ); aFont.SetFillColor( aColor );
+ rIStm.Read( aName, 32 );
+ aFont.SetName( UniString( aName, rIStm.GetStreamCharSet() ) );
+ rIStm >> nWidth >> nHeight;
+ rIStm >> nCharOrient >> nLineOrient;
+ rIStm >> nCharSet >> nFamily >> nPitch >> nAlign >> nWeight >> nUnderline >> nStrikeout;
+ rIStm >> bItalic >> bOutline >> bShadow >> bTransparent;
+
+ aFont.SetSize( Size( nWidth, nHeight ) );
+ aFont.SetCharSet( (CharSet) nCharSet );
+ aFont.SetFamily( (FontFamily) nFamily );
+ aFont.SetPitch( (FontPitch) nPitch );
+ aFont.SetAlign( (FontAlign) nAlign );
+ aFont.SetWeight( ( nWeight == 1 ) ? WEIGHT_LIGHT : ( nWeight == 2 ) ? WEIGHT_NORMAL :
+ ( nWeight == 3 ) ? WEIGHT_BOLD : WEIGHT_DONTKNOW );
+ aFont.SetUnderline( (FontUnderline) nUnderline );
+ aFont.SetStrikeout( (FontStrikeout) nStrikeout );
+ aFont.SetItalic( bItalic ? ITALIC_NORMAL : ITALIC_NONE );
+ aFont.SetOutline( bOutline );
+ aFont.SetShadow( bShadow );
+ aFont.SetOrientation( nLineOrient );
+ aFont.SetTransparent( bTransparent );
+
+ eActualCharSet = aFont.GetCharSet();
+ if ( eActualCharSet == RTL_TEXTENCODING_DONTKNOW )
+ eActualCharSet = gsl_getSystemTextEncoding();
+ rMtf.AddAction( new MetaFontAction( aFont ) );
+ }
+ break;
+
+ case( GDI_TEXT_ACTION ):
+ {
+ ByteString aByteStr;
+ INT32 nIndex, nLen;
+
+ rIStm >> aPt >> nIndex >> nLen >> nTmp;
+ rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 );
+ UniString aStr( aByteStr, eActualCharSet );
+ rMtf.AddAction( new MetaTextAction( aPt, aStr, (USHORT) nIndex, (USHORT) nLen ) );
+ }
+ break;
+
+ case( GDI_TEXTARRAY_ACTION ):
+ {
+ ByteString aByteStr;
+ long* pDXAry = NULL;
+ INT32 nIndex, nLen, nAryLen;
+
+ rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen;
+ rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 );
+ UniString aStr( aByteStr, eActualCharSet );
+
+ if( nAryLen > 0L )
+ {
+ pDXAry = new long[ nAryLen ];
+
+ for( long i = 0L; i < nAryLen; i++ )
+ rIStm >> nTmp, pDXAry[ i ] = nTmp;
+ }
+
+ rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, (USHORT) nIndex, (USHORT) nLen ) );
+
+ if( pDXAry )
+ delete[] pDXAry;
+ }
+ break;
+
+ case( GDI_STRETCHTEXT_ACTION ):
+ {
+ ByteString aByteStr;
+ INT32 nIndex, nLen, nWidth;
+
+ rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
+ rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 );
+ UniString aStr( aByteStr, eActualCharSet );
+ rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (USHORT) nIndex, (USHORT) nLen ) );
+ }
+ break;
+
+ case( GDI_BITMAP_ACTION ):
+ {
+ Bitmap aBmp;
+
+ rIStm >> aPt >> aBmp;
+ rMtf.AddAction( new MetaBmpAction( aPt, aBmp ) );
+ }
+ break;
+
+ case( GDI_BITMAPSCALE_ACTION ):
+ {
+ Bitmap aBmp;
+
+ rIStm >> aPt >> aSz >> aBmp;
+ rMtf.AddAction( new MetaBmpScaleAction( aPt, aSz, aBmp ) );
+ }
+ break;
+
+ case( GDI_BITMAPSCALEPART_ACTION ):
+ {
+ Bitmap aBmp;
+ Size aSz2;
+
+ rIStm >> aPt >> aSz >> aPt1 >> aSz2 >> aBmp;
+ rMtf.AddAction( new MetaBmpScalePartAction( aPt, aSz, aPt1, aSz2, aBmp ) );
+ }
+ break;
+
+ case( GDI_PEN_ACTION ):
+ {
+ INT32 nPenWidth;
+ INT16 nPenStyle;
+
+ ImplReadColor( rIStm, aColor );
+ rIStm >> nPenWidth >> nPenStyle;
+
+ aLineInfo.SetStyle( nPenStyle ? LINE_SOLID : LINE_NONE );
+ aLineInfo.SetWidth( nPenWidth );
+ bFatLine = nPenStyle && !aLineInfo.IsDefault();
+
+ rMtf.AddAction( new MetaLineColorAction( aColor, nPenStyle != 0 ) );
+ }
+ break;
+
+ case( GDI_FILLBRUSH_ACTION ):
+ {
+ INT16 nBrushStyle;
+
+ ImplReadColor( rIStm, aColor );
+ rIStm.SeekRel( 6L );
+ rIStm >> nBrushStyle;
+ rMtf.AddAction( new MetaFillColorAction( aColor, nBrushStyle != 0 ) );
+ rIStm.SeekRel( 2L );
+ }
+ break;
+
+ case( GDI_MAPMODE_ACTION ):
+ {
+ ImplReadMapMode( rIStm, aMapMode );
+ rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
+ }
+ break;
+
+ case( GDI_CLIPREGION_ACTION ):
+ {
+ Region aRegion;
+ INT16 nRegType;
+ INT16 bIntersect;
+ BOOL bClip = FALSE;
+
+ rIStm >> nRegType >> bIntersect;
+ ImplReadRect( rIStm, aRect );
+
+ switch( nRegType )
+ {
+ case( 0 ):
+ break;
+
+ case( 1 ):
+ {
+ Rectangle aRegRect;
+
+ ImplReadRect( rIStm, aRegRect );
+ aRegion = Region( aRegRect );
+ bClip = TRUE;
+ }
+ break;
+
+ case( 2 ):
+ {
+ ImplReadPoly( rIStm, aPoly );
+ aRegion = Region( aPoly );
+ bClip = TRUE;
+ }
+ break;
+
+ case( 3 ):
+ {
+ PolyPolygon aPolyPoly;
+ INT32 nPolyCount;
+
+ rIStm >> nPolyCount;
+
+ for( USHORT i = 0; i < (USHORT) nPolyCount; i++ )
+ {
+ ImplReadPoly( rIStm, aPoly );
+ aPolyPoly.Insert( aPoly );
+ }
+
+ aRegion = Region( aPolyPoly );
+ bClip = TRUE;
+ }
+ break;
+ }
+
+ if( bIntersect )
+ aRegion.Intersect( aRect );
+
+ rMtf.AddAction( new MetaClipRegionAction( aRegion, bClip ) );
+ }
+ break;
+
+ case( GDI_MOVECLIPREGION_ACTION ):
+ {
+ rIStm >> nTmp >> nTmp1;
+ rMtf.AddAction( new MetaMoveClipRegionAction( nTmp, nTmp1 ) );
+ }
+ break;
+
+ case( GDI_ISECTCLIPREGION_ACTION ):
+ {
+ ImplReadRect( rIStm, aRect );
+ rMtf.AddAction( new MetaISectRectClipRegionAction( aRect ) );
+ }
+ break;
+
+ case( GDI_RASTEROP_ACTION ):
+ {
+ RasterOp eRasterOp;
+ INT16 nRasterOp;
+
+ rIStm >> nRasterOp;
+
+ switch( nRasterOp )
+ {
+ case( 1 ):
+ eRasterOp = ROP_INVERT;
+ break;
+
+ case( 4 ):
+ case( 5 ):
+ eRasterOp = ROP_XOR;
+ break;
+
+ default:
+ eRasterOp = ROP_OVERPAINT;
+ break;
+ }
+
+ rMtf.AddAction( new MetaRasterOpAction( eRasterOp ) );
+ }
+ break;
+
+ case( GDI_PUSH_ACTION ):
+ {
+ aLIStack.Push( new LineInfo( aLineInfo ) );
+ rMtf.AddAction( new MetaPushAction( PUSH_ALL ) );
+ }
+ break;
+
+ case( GDI_POP_ACTION ):
+ {
+
+ LineInfo* pLineInfo = (LineInfo*) aLIStack.Pop();
+
+ // restore line info
+ if( pLineInfo )
+ {
+ aLineInfo = *pLineInfo;
+ delete pLineInfo;
+ bFatLine = ( LINE_NONE != aLineInfo.GetStyle() ) && !aLineInfo.IsDefault();
+ }
+
+ rMtf.AddAction( new MetaPopAction() );
+ }
+ break;
+
+ case( GDI_GRADIENT_ACTION ):
+ {
+ Color aStartCol;
+ Color aEndCol;
+ INT16 nStyle;
+ INT16 nAngle;
+ INT16 nBorder;
+ INT16 nOfsX;
+ INT16 nOfsY;
+ INT16 nIntensityStart;
+ INT16 nIntensityEnd;
+
+ ImplReadRect( rIStm, aRect );
+ rIStm >> nStyle;
+ ImplReadColor( rIStm, aStartCol );
+ ImplReadColor( rIStm, aEndCol );
+ rIStm >> nAngle >> nBorder >> nOfsX >> nOfsY >> nIntensityStart >> nIntensityEnd;
+
+ Gradient aGrad( (GradientStyle) nStyle, aStartCol, aEndCol );
+
+ aGrad.SetAngle( nAngle );
+ aGrad.SetBorder( nBorder );
+ aGrad.SetOfsX( nOfsX );
+ aGrad.SetOfsY( nOfsY );
+ aGrad.SetStartIntensity( nIntensityStart );
+ aGrad.SetEndIntensity( nIntensityEnd );
+ rMtf.AddAction( new MetaGradientAction( aRect, aGrad ) );
+ }
+ break;
+
+ case( GDI_TRANSPARENT_COMMENT ):
+ {
+ PolyPolygon aPolyPoly;
+ INT32 nFollowingActionCount;
+ INT16 nTrans;
+
+ rIStm >> aPolyPoly >> nTrans >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaTransparentAction( aPolyPoly, nTrans ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ case( GDI_FLOATTRANSPARENT_COMMENT ):
+ {
+ GDIMetaFile aMtf;
+ Point aPos;
+ Size aSize;
+ Gradient aGradient;
+ INT32 nFollowingActionCount;
+
+ rIStm >> aMtf >> aPos >> aSize >> aGradient >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaFloatTransparentAction( aMtf, aPos, aSize, aGradient ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ case( GDI_HATCH_COMMENT ):
+ {
+ PolyPolygon aPolyPoly;
+ Hatch aHatch;
+ INT32 nFollowingActionCount;
+
+ rIStm >> aPolyPoly >> aHatch >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaHatchAction( aPolyPoly, aHatch ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ case( GDI_REFPOINT_COMMENT ):
+ {
+ Point aRefPoint;
+ BOOL bSet;
+ INT32 nFollowingActionCount;
+
+ rIStm >> aRefPoint >> bSet >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaRefPointAction( aRefPoint, bSet ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ case( GDI_TEXTLINECOLOR_COMMENT ):
+ {
+ Color aColor;
+ BOOL bSet;
+ INT32 nFollowingActionCount;
+
+ rIStm >> aColor >> bSet >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaTextLineColorAction( aColor, bSet ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ case( GDI_TEXTLINE_COMMENT ):
+ {
+ Point aStartPt;
+ long nWidth;
+ ULONG nStrikeout;
+ ULONG nUnderline;
+ INT32 nFollowingActionCount;
+
+ rIStm >> aStartPt >> nWidth >> nStrikeout >> nUnderline >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth,
+ (FontStrikeout) nStrikeout,
+ (FontUnderline) nUnderline ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ case( GDI_GRADIENTEX_COMMENT ):
+ {
+ PolyPolygon aPolyPoly;
+ Gradient aGradient;
+ INT32 nFollowingActionCount;
+
+ rIStm >> aPolyPoly >> aGradient >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaGradientExAction( aPolyPoly, aGradient ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ case( GDI_COMMENT_COMMENT ):
+ {
+ ByteString aComment;
+ long nValue;
+ ULONG nDataSize;
+ BYTE* pData;
+ INT32 nFollowingActionCount;
+
+ rIStm >> aComment >> nValue >> nDataSize;
+
+ if( nDataSize )
+ {
+ pData = new BYTE[ nDataSize ];
+ rIStm.Read( pData, nDataSize );
+ }
+ else
+ pData = NULL;
+
+ rIStm >> nFollowingActionCount;
+ ImplSkipActions( rIStm, nFollowingActionCount );
+ rMtf.AddAction( new MetaCommentAction( aComment, nValue, pData, nDataSize ) );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ i += nFollowingActionCount;
+#endif
+ }
+ break;
+
+ default:
+ rIStm.SeekRel( nActionSize - 4L );
+ break;
+ }
+ }
+
+ // cleanup push-pop stack if neccessary
+ for( void* pLineInfo = aLIStack.Pop(); pLineInfo; pLineInfo = aLIStack.Pop() )
+ delete (LineInfo*) pLineInfo;
+ }
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+}
+
+// ------------------------------------------------------------------------
+
+void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
+{
+ ULONG nPos;
+ ULONG nCountPos;
+ Font aSaveFont;
+ const ULONG nActionCount = rMtf.GetActionCount();
+ const USHORT nOldFormat = rOStm.GetNumberFormatInt();
+ rtl_TextEncoding eActualCharSet = gsl_getSystemTextEncoding();
+ const Size aPrefSize( rMtf.GetPrefSize() );
+ BOOL bRop_0_1 = FALSE;
+ VirtualDevice aSaveVDev;
+ Color aLineCol( COL_BLACK );
+ Stack aLineColStack;
+
+ rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ //MagicCode schreiben
+ rOStm << "SVGDI"; // Kennung
+ nPos = rOStm.Tell();
+ rOStm << (INT16) 42; // HeaderSize
+ rOStm << (INT16) 200; // VERSION
+ rOStm << (INT32) aPrefSize.Width();
+ rOStm << (INT32) aPrefSize.Height();
+ ImplWriteMapMode( rOStm, rMtf.GetPrefMapMode() );
+
+ // ActionCount wird spaeter geschrieben
+ nCountPos = rOStm.Tell();
+ rOStm.SeekRel( 4L );
+
+ const INT32 nActCount = ImplWriteActions( rOStm, rMtf, aSaveVDev, bRop_0_1, aLineCol, aLineColStack, eActualCharSet );
+ const ULONG nActPos = rOStm.Tell();
+
+ rOStm.Seek( nCountPos );
+ rOStm << nActCount;
+ rOStm.Seek( nActPos );
+ rOStm.SetNumberFormatInt( nOldFormat );
+
+ // cleanup push-pop stack if neccessary
+ for( void* pCol = aLineColStack.Pop(); pCol; pCol = aLineColStack.Pop() )
+ delete (Color*) pCol;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
+ VirtualDevice& rSaveVDev, BOOL& rRop_0_1,
+ Color& rLineCol, Stack& rLineColStack,
+ rtl_TextEncoding& rActualCharSet )
+{
+ ULONG nCount = 0;
+ for( ULONG i = 0, nActionCount = rMtf.GetActionCount(); i < nActionCount; i++ )
+ {
+ const MetaAction* pAction = rMtf.GetAction( i );
+
+ switch( pAction->GetType() )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ MetaPixelAction* pAct = (MetaPixelAction*) pAction;
+
+ rOStm << (INT16) GDI_PIXEL_ACTION;
+ rOStm << (INT32) 18;
+ rOStm << pAct->GetPoint();
+ ImplWriteColor( rOStm, pAct->GetColor() );
+ nCount++;
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ MetaPointAction* pAct = (MetaPointAction*) pAction;
+
+ rOStm << (INT16) GDI_POINT_ACTION;
+ rOStm << (INT32) 12;
+ rOStm << pAct->GetPoint();
+ nCount++;
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ MetaLineAction* pAct = (MetaLineAction*) pAction;
+ const LineInfo& rInfo = pAct->GetLineInfo();
+ const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) );
+
+ if( bFatLine )
+ {
+ ImplWritePushAction( rOStm );
+ ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
+ }
+
+ rOStm << (INT16) GDI_LINE_ACTION;
+ rOStm << (INT32) 20;
+ rOStm << pAct->GetStartPoint();
+ rOStm << pAct->GetEndPoint();
+ nCount++;
+
+ if( bFatLine )
+ {
+ ImplWritePopAction( rOStm );
+ nCount += 3;
+ }
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ MetaRectAction* pAct = (MetaRectAction*) pAction;
+
+ rOStm << (INT16) GDI_RECT_ACTION;
+ rOStm << (INT32) 28;
+ ImplWriteRect( rOStm, pAct->GetRect() );
+ rOStm << (INT32) 0;
+ rOStm << (INT32) 0;
+ nCount++;
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ MetaRoundRectAction* pAct = (MetaRoundRectAction*) pAction;
+
+ rOStm << (INT16) GDI_RECT_ACTION;
+ rOStm << (INT32) 28;
+ ImplWriteRect( rOStm, pAct->GetRect() );
+ rOStm << (INT32) pAct->GetHorzRound();
+ rOStm << (INT32) pAct->GetVertRound();
+ nCount++;
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ MetaEllipseAction* pAct = (MetaEllipseAction*) pAction;
+
+ rOStm << (INT16) GDI_ELLIPSE_ACTION;
+ rOStm << (INT32) 20;
+ ImplWriteRect( rOStm, pAct->GetRect() );
+ nCount++;
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ {
+ MetaArcAction* pAct = (MetaArcAction*) pAction;
+
+ rOStm << (INT16) GDI_ARC_ACTION;
+ rOStm << (INT32) 36;
+ ImplWriteRect( rOStm, pAct->GetRect() );
+ rOStm << pAct->GetStartPoint();
+ rOStm << pAct->GetEndPoint();
+ nCount++;
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ MetaPieAction* pAct = (MetaPieAction*) pAction;
+
+ rOStm << (INT16) GDI_PIE_ACTION;
+ rOStm << (INT32) 36;
+ ImplWriteRect( rOStm, pAct->GetRect() );
+ rOStm << pAct->GetStartPoint();
+ rOStm << pAct->GetEndPoint();
+ nCount++;
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ MetaChordAction* pAct = (MetaChordAction*) pAction;
+ Polygon aChordPoly( pAct->GetRect(), pAct->GetStartPoint(),
+ pAct->GetEndPoint(), POLY_CHORD );
+ const USHORT nPoints = aChordPoly.GetSize();
+
+ rOStm << (INT16) GDI_POLYGON_ACTION;
+ rOStm << (INT32) ( 8 + ( nPoints << 3 ) );
+ rOStm << (INT32) nPoints;
+
+ for( USHORT n = 0; n < nPoints; n++ )
+ rOStm << aChordPoly[ n ];
+
+ nCount++;
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction;
+ const Polygon& rPoly = pAct->GetPolygon();
+ const LineInfo& rInfo = pAct->GetLineInfo();
+ const USHORT nPoints = rPoly.GetSize();
+ const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) );
+
+ if( bFatLine )
+ {
+ ImplWritePushAction( rOStm );
+ ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() );
+ }
+
+ rOStm << (INT16) GDI_POLYLINE_ACTION;
+ rOStm << (INT32) ( 8 + ( nPoints << 3 ) );
+ rOStm << (INT32) nPoints;
+
+ for( USHORT n = 0; n < nPoints; n++ )
+ rOStm << rPoly[ n ];
+
+ nCount++;
+
+ if( bFatLine )
+ {
+ ImplWritePopAction( rOStm );
+ nCount += 3;
+ }
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ {
+ MetaPolygonAction* pAct = (MetaPolygonAction*) pAction;
+ const Polygon& rPoly = pAct->GetPolygon();
+ const USHORT nPoints = rPoly.GetSize();
+
+ rOStm << (INT16) GDI_POLYGON_ACTION;
+ rOStm << (INT32) ( 8 + ( nPoints << 3 ) );
+ rOStm << (INT32) nPoints;
+
+ for( USHORT n = 0; n < nPoints; n++ )
+ rOStm << rPoly[ n ];
+
+ nCount++;
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction;
+ ImplWritePolyPolyAction( rOStm, pAct->GetPolyPolygon() );
+ nCount++;
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ MetaTextAction* pAct = (MetaTextAction*) pAction;
+ ByteString aText( pAct->GetText(), rActualCharSet );
+ const ULONG nStrLen = aText.Len();
+
+ rOStm << (INT16) GDI_TEXT_ACTION;
+ rOStm << (INT32) ( 24 + ( nStrLen + 1 ) );
+ rOStm << pAct->GetPoint();
+ rOStm << (INT32) pAct->GetIndex();
+ rOStm << (INT32) pAct->GetLen();
+ rOStm << (INT32) nStrLen;
+ rOStm.Write( aText.GetBuffer(), nStrLen + 1 );
+ nCount++;
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ MetaTextArrayAction* pAct = (MetaTextArrayAction*)pAction;
+ ByteString aText( pAct->GetText(), rActualCharSet );
+ ULONG nAryLen;
+ ULONG nLen = pAct->GetLen();
+ const ULONG nTextLen = aText.Len();
+ long* pDXArray = pAct->GetDXArray();
+
+ if( ( nLen + pAct->GetIndex() ) > nTextLen )
+ {
+ if( pAct->GetIndex() <= nTextLen )
+ nLen = nTextLen - pAct->GetIndex();
+ else
+ nLen = 0UL;
+ }
+
+ if( !pDXArray || !nLen )
+ nAryLen = 0;
+ else
+ nAryLen = nLen - 1;
+
+ rOStm << (INT16) GDI_TEXTARRAY_ACTION;
+ rOStm << (INT32) ( 28 + ( nLen + 1 ) + ( nAryLen * 4 ) );
+ rOStm << pAct->GetPoint();
+ rOStm << (INT32) 0;
+ rOStm << (INT32) nLen;
+ rOStm << (INT32) nLen;
+ rOStm << (INT32) nAryLen;
+ rOStm.Write( aText.GetBuffer()+pAct->GetIndex(), nLen + 1 );
+
+ for( ULONG n = 0UL ; n < nAryLen; n++ )
+ rOStm << (INT32) pDXArray[ n ];
+
+ nCount++;
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ MetaStretchTextAction* pAct = (MetaStretchTextAction*) pAction;
+ ByteString aText( pAct->GetText(), rActualCharSet );
+ const ULONG nStrLen = aText.Len();
+
+ rOStm << (INT16) GDI_STRETCHTEXT_ACTION;
+ rOStm << (INT32) ( 28 + ( nStrLen + 1 ) );
+ rOStm << pAct->GetPoint();
+ rOStm << (INT32) pAct->GetIndex();
+ rOStm << (INT32) pAct->GetLen();
+ rOStm << (INT32) nStrLen;
+ rOStm << (INT32) pAct->GetWidth();
+ rOStm.Write( aText.GetBuffer(), nStrLen + 1 );
+ nCount++;
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ MetaBmpAction* pAct = (MetaBmpAction*) pAction;
+
+ rOStm << (INT16) GDI_BITMAP_ACTION;
+ rOStm << (INT32) 12;
+ rOStm << pAct->GetPoint();
+ rOStm << pAct->GetBitmap();
+ nCount++;
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
+
+ rOStm << (INT16) GDI_BITMAPSCALE_ACTION;
+ rOStm << (INT32) 20;
+ rOStm << pAct->GetPoint();
+ rOStm << pAct->GetSize();
+ rOStm << pAct->GetBitmap();
+ nCount++;
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
+
+ rOStm << (INT16) GDI_BITMAPSCALEPART_ACTION;
+ rOStm << (INT32) 36;
+ rOStm << pAct->GetDestPoint();
+ rOStm << pAct->GetDestSize();
+ rOStm << pAct->GetSrcPoint();
+ rOStm << pAct->GetSrcSize();
+ rOStm << pAct->GetBitmap();
+ nCount++;
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ MetaBmpExAction* pAct = (MetaBmpExAction*) pAction;
+ const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
+
+ rOStm << (INT16) GDI_BITMAP_ACTION;
+ rOStm << (INT32) 12;
+ rOStm << pAct->GetPoint();
+ rOStm << aBmp;
+ nCount++;
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction;
+ const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
+
+ rOStm << (INT16) GDI_BITMAPSCALE_ACTION;
+ rOStm << (INT32) 20;
+ rOStm << pAct->GetPoint();
+ rOStm << pAct->GetSize();
+ rOStm << aBmp;
+ nCount++;
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
+ const Bitmap aBmp( Graphic( pAct->GetBitmapEx() ).GetBitmap() );
+
+ rOStm << (INT16) GDI_BITMAPSCALEPART_ACTION;
+ rOStm << (INT32) 36;
+ rOStm << pAct->GetDestPoint();
+ rOStm << pAct->GetDestSize();
+ rOStm << pAct->GetSrcPoint();
+ rOStm << pAct->GetSrcSize();
+ rOStm << aBmp;
+ nCount++;
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ MetaGradientAction* pAct = (MetaGradientAction*) pAction;
+ const Gradient& rGrad = pAct->GetGradient();
+
+ rOStm << (INT16) GDI_GRADIENT_ACTION;
+ rOStm << (INT32) 46;
+ ImplWriteRect( rOStm, pAct->GetRect() );
+ rOStm << (INT16) rGrad.GetStyle();
+ ImplWriteColor( rOStm, rGrad.GetStartColor() );
+ ImplWriteColor( rOStm, rGrad.GetEndColor() );
+ rOStm << (INT16) rGrad.GetAngle();
+ rOStm << (INT16) rGrad.GetBorder();
+ rOStm << (INT16) rGrad.GetOfsX();
+ rOStm << (INT16) rGrad.GetOfsY();
+ rOStm << (INT16) rGrad.GetStartIntensity();
+ rOStm << (INT16) rGrad.GetEndIntensity();
+ nCount++;
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ const MetaGradientExAction* pA = (MetaGradientExAction*) pAction;
+ ULONG nOldPos, nNewPos;
+
+ // write RefPoint comment
+ rOStm << (INT16) GDI_GRADIENTEX_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write data
+ rOStm << pA->GetPolyPolygon() << pA->GetGradient();
+ rOStm << (INT32) 0; // number of actions that follow this comment
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos );
+ rOStm.Seek( nNewPos );
+
+ nCount++;
+ }
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ {
+ MetaWallpaperAction* pAct = (MetaWallpaperAction*) pAction;
+ const Color& rColor = pAct->GetWallpaper().GetColor();
+
+ ImplWritePushAction( rOStm );
+ ImplWriteLineColor( rOStm, rColor, 1 );
+ ImplWriteFillColor( rOStm, rColor, 1 );
+
+ rOStm << (INT16) GDI_RECT_ACTION;
+ rOStm << (INT32) 28;
+ ImplWriteRect( rOStm, pAct->GetRect() );
+ rOStm << (INT32) 0;
+ rOStm << (INT32) 0;
+
+ ImplWritePopAction( rOStm );
+ nCount += 5;
+ }
+ break;
+
+ case( META_CLIPREGION_ACTION ):
+ {
+ MetaClipRegionAction* pAct = (MetaClipRegionAction*) pAction;
+ const Region& rRegion = pAct->GetRegion();
+ Rectangle aClipRect;
+
+ rOStm << (INT16) GDI_CLIPREGION_ACTION;
+ rOStm << (INT32) 24;
+
+ if( pAct->IsClipping() )
+ {
+ aClipRect = rRegion.GetBoundRect();
+ rOStm << (INT16) 1;
+ }
+ else
+ rOStm << (INT16) 0;
+
+ rOStm << (INT16) 0;
+ ImplWriteRect( rOStm, aClipRect );
+
+ if( pAct->IsClipping() )
+ ImplWriteRect( rOStm, aClipRect );
+
+ nCount++;
+ }
+ break;
+
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ {
+ MetaISectRectClipRegionAction* pAct = (MetaISectRectClipRegionAction*) pAction;
+
+ rOStm << (INT16) GDI_ISECTCLIPREGION_ACTION;
+ rOStm << (INT32) 20;
+ rOStm << pAct->GetRect();
+ nCount++;
+ }
+ break;
+
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ MetaMoveClipRegionAction* pAct = (MetaMoveClipRegionAction*) pAction;
+
+ rOStm << (INT16) GDI_MOVECLIPREGION_ACTION;
+ rOStm << (INT32) 12;
+ rOStm << (INT32) pAct->GetHorzMove();
+ rOStm << (INT32) pAct->GetVertMove();
+ nCount++;
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ MetaLineColorAction* pAct = (MetaLineColorAction*) pAction;
+ ImplWriteLineColor( rOStm, rLineCol = pAct->GetColor(), pAct->IsSetting() ? 1 : 0 );
+ nCount++;
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ MetaFillColorAction* pAct = (MetaFillColorAction*) pAction;
+ ImplWriteFillColor( rOStm, pAct->GetColor(), pAct->IsSetting() ? 1 : 0 );
+ nCount++;
+ }
+ break;
+
+ case( META_FONT_ACTION ):
+ {
+ rSaveVDev.SetFont( ( (MetaFontAction*) pAction )->GetFont() );
+ ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
+ nCount++;
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ {
+ Font aSaveFont( rSaveVDev.GetFont() );
+
+ aSaveFont.SetColor( ( (MetaTextColorAction*) pAction )->GetColor() );
+ rSaveVDev.SetFont( aSaveFont );
+ ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
+ nCount++;
+ }
+ break;
+
+ case( META_TEXTFILLCOLOR_ACTION ):
+ {
+ MetaTextFillColorAction* pAct = (MetaTextFillColorAction*) pAction;
+ Font aSaveFont( rSaveVDev.GetFont() );
+
+ if( pAct->IsSetting() )
+ aSaveFont.SetFillColor( pAct->GetColor() );
+ else
+ aSaveFont.SetFillColor( Color( COL_TRANSPARENT ) );
+
+ rSaveVDev.SetFont( aSaveFont );
+ ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
+ nCount++;
+ }
+ break;
+
+ case( META_TEXTALIGN_ACTION ):
+ {
+ Font aSaveFont( rSaveVDev.GetFont() );
+
+ aSaveFont.SetAlign( ( (MetaTextAlignAction*) pAction )->GetTextAlign() );
+ rSaveVDev.SetFont( aSaveFont );
+ ImplWriteFont( rOStm, rSaveVDev.GetFont(), rActualCharSet );
+ nCount++;
+ }
+ break;
+
+ case( META_MAPMODE_ACTION ):
+ {
+ MetaMapModeAction* pAct = (MetaMapModeAction*) pAction;
+
+ rOStm << (INT16) GDI_MAPMODE_ACTION;
+ rOStm << (INT32) 30;
+ ImplWriteMapMode( rOStm, pAct->GetMapMode() );
+ nCount++;
+ }
+ break;
+
+ case( META_PUSH_ACTION ):
+ {
+ ImplWritePushAction( rOStm );
+ rLineColStack.Push( new Color( rLineCol ) );
+ rSaveVDev.Push();
+ nCount++;
+ }
+ break;
+
+ case( META_POP_ACTION ):
+ {
+ Color* pCol = (Color*) rLineColStack.Pop();
+
+ if( pCol )
+ {
+ rLineCol = *pCol;
+ delete pCol;
+ }
+
+ ImplWritePopAction( rOStm );
+ rSaveVDev.Pop();
+ nCount++;
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ {
+ MetaRasterOpAction* pAct = (MetaRasterOpAction*) pAction;
+
+ if( ( pAct->GetRasterOp() != ROP_0 ) && ( pAct->GetRasterOp() != ROP_1 ) )
+ {
+ INT16 nRasterOp;
+
+ // Falls vorher ROP_0/1 gesetzt war, alten
+ // Zustand durch Pop erst wieder herstellen
+ if( rRop_0_1 )
+ {
+ ImplWritePopAction( rOStm );
+ rSaveVDev.Pop();
+ rRop_0_1 = FALSE;
+ nCount++;
+ }
+
+ switch( pAct->GetRasterOp() )
+ {
+ case( ROP_OVERPAINT ) : nRasterOp = 0; break;
+ case( ROP_XOR ) : nRasterOp = 4; break;
+ case( ROP_INVERT ): nRasterOp = 1; break;
+ default: nRasterOp = 0; break;
+ }
+
+ ImplWriteRasterOpAction( rOStm, nRasterOp );
+ nCount++;
+ }
+ else
+ {
+ ImplWritePushAction( rOStm );
+ rSaveVDev.Push();
+
+ if( pAct->GetRasterOp() == ROP_0 )
+ {
+ ImplWriteLineColor( rOStm, COL_BLACK, 1 );
+ ImplWriteFillColor( rOStm, COL_BLACK, 1 );
+ }
+ else
+ {
+ ImplWriteLineColor( rOStm, COL_WHITE, 1 );
+ ImplWriteFillColor( rOStm, COL_WHITE, 1 );
+ }
+
+ ImplWriteRasterOpAction( rOStm, 0 );
+ rRop_0_1 = TRUE;
+ nCount += 4;
+ }
+ }
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ {
+ const PolyPolygon& rPolyPoly = ( (MetaTransparentAction*) pAction )->GetPolyPolygon();
+ const INT16 nTrans = ( (MetaTransparentAction*) pAction )->GetTransparence();
+ const INT16 nBrushStyle = ( nTrans < 38 ) ? 8 : ( nTrans < 63 ) ? 9 : 10;
+ ULONG nOldPos, nNewPos;
+
+ // write transparence comment
+ rOStm << (INT16) GDI_TRANSPARENT_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write comment data
+ rOStm << rPolyPoly;
+ rOStm << nTrans;
+ rOStm << (INT32) 15; // number of actions that follow this comment
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos );
+ rOStm.Seek( nNewPos );
+
+ {
+ // write actions for transparence
+ ImplWritePushAction( rOStm );
+ {
+ ImplWriteRasterOpAction( rOStm, 4 );
+ ImplWritePolyPolyAction( rOStm, rPolyPoly );
+
+ ImplWritePushAction( rOStm );
+ {
+ ImplWriteRasterOpAction( rOStm, 2 );
+ ImplWriteFillColor( rOStm, COL_BLACK, nBrushStyle );
+ ImplWritePolyPolyAction( rOStm, rPolyPoly );
+ }
+ ImplWritePopAction( rOStm );
+
+ ImplWriteRasterOpAction( rOStm, 4 );
+ ImplWritePolyPolyAction( rOStm, rPolyPoly );
+ }
+ ImplWritePopAction( rOStm );
+
+ ImplWritePushAction( rOStm );
+ {
+ ImplWriteFillColor( rOStm, Color(), 0 );
+ ImplWritePolyPolyAction( rOStm, rPolyPoly );
+ }
+ ImplWritePopAction( rOStm );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ nCount += 15;
+#endif
+ }
+
+ nCount++;
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ const MetaFloatTransparentAction* pA = (MetaFloatTransparentAction*) pAction;
+ const GDIMetaFile& rTransMtf = pA->GetGDIMetaFile();
+ const Point& rPos = pA->GetPoint();
+ const Size& rSize = pA->GetSize();
+ const Gradient& rGradient = pA->GetGradient();
+ ULONG nOldPos, nNewPos;
+
+ // write RefPoint comment
+ rOStm << (INT16) GDI_FLOATTRANSPARENT_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write comment data
+ rOStm << rTransMtf << rPos << rSize << rGradient;
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos + 4 );
+ rOStm.Seek( ( nOldPos = nNewPos ) + 4 );
+
+ {
+ // write actions for float transparence
+ ULONG nAddCount;
+ GDIMetaFile aMtf( rTransMtf );
+ const Size aSrcSize( rTransMtf.GetPrefSize() );
+ Point aSrcPt( rTransMtf.GetPrefMapMode().GetOrigin() );
+ const double fScaleX = aSrcSize.Width() ? (double) rSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) rSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
+
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ {
+ aMtf.Scale( fScaleX, fScaleY );
+ aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
+ }
+
+ nMoveX = rPos.X() - aSrcPt.X(), nMoveY = rPos.Y() - aSrcPt.Y();
+
+ if( nMoveX || nMoveY )
+ aMtf.Move( nMoveX, nMoveY );
+
+ nAddCount = ImplWriteActions( rOStm, aMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet );
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) nAddCount;
+ rOStm.Seek( nNewPos );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ nCount += nAddCount;
+#endif
+ }
+
+ nCount++;
+ }
+ break;
+
+ case( META_HATCH_ACTION ):
+ {
+ const MetaHatchAction* pA = (MetaHatchAction*) pAction;
+ const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
+ const Hatch& rHatch = pA->GetHatch();
+ ULONG nOldPos, nNewPos, nAddCount;
+
+ // write hatch comment
+ rOStm << (INT16) GDI_HATCH_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write comment data
+ rOStm << rPolyPoly;
+ rOStm << rHatch;
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos + 4 );
+ rOStm.Seek( ( nOldPos = nNewPos ) + 4 );
+
+ {
+ // write actions for hatch
+ VirtualDevice aVDev;
+ GDIMetaFile aTmpMtf;
+
+ aVDev.AddHatchActions( rPolyPoly, rHatch, aTmpMtf );
+ nAddCount = ImplWriteActions( rOStm, aTmpMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet );
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) nAddCount;
+ rOStm.Seek( nNewPos );
+
+#ifdef CVTSVM_WRITE_SUBACTIONCOUNT
+ nCount += nAddCount;
+#endif
+ }
+
+ nCount++;
+ }
+ break;
+
+ case( META_REFPOINT_ACTION ):
+ {
+ const MetaRefPointAction* pA = (MetaRefPointAction*) pAction;
+ const Point& rRefPoint = pA->GetRefPoint();
+ const BOOL bSet = pA->IsSetting();
+ ULONG nOldPos, nNewPos;
+
+ // write RefPoint comment
+ rOStm << (INT16) GDI_REFPOINT_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write data
+ rOStm << rRefPoint << bSet;
+ rOStm << (INT32) 0; // number of actions that follow this comment
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos );
+ rOStm.Seek( nNewPos );
+
+ nCount++;
+ }
+ break;
+
+ case( META_TEXTLINECOLOR_ACTION ):
+ {
+ const MetaTextLineColorAction* pA = (MetaTextLineColorAction*) pAction;
+ const Color& rColor = pA->GetColor();
+ const BOOL bSet = pA->IsSetting();
+ ULONG nOldPos, nNewPos;
+
+ // write RefPoint comment
+ rOStm << (INT16) GDI_TEXTLINECOLOR_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write data
+ rOStm << rColor << bSet;
+ rOStm << (INT32) 0; // number of actions that follow this comment
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos );
+ rOStm.Seek( nNewPos );
+
+ nCount++;
+ }
+ break;
+
+ case( META_TEXTLINE_ACTION ):
+ {
+ const MetaTextLineAction* pA = (MetaTextLineAction*) pAction;
+ const Point& rStartPt = pA->GetStartPoint();
+ const long nWidth = pA->GetWidth();
+ const FontStrikeout eStrikeout = pA->GetStrikeout();
+ const FontUnderline eUnderline = pA->GetUnderline();
+ ULONG nOldPos, nNewPos;
+
+ // write RefPoint comment
+ rOStm << (INT16) GDI_TEXTLINE_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write data
+ rOStm << rStartPt << nWidth << (ULONG) eStrikeout << (ULONG) eUnderline;
+ rOStm << (INT32) 0; // number of actions that follow this comment
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos );
+ rOStm.Seek( nNewPos );
+
+ nCount++;
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ break;
+
+ case( META_COMMENT_ACTION ):
+ {
+ const MetaCommentAction* pA = (MetaCommentAction*) pAction;
+ const ULONG nDataSize = pA->GetDataSize();
+ ULONG nOldPos, nNewPos;
+
+ // write RefPoint comment
+ rOStm << (INT16) GDI_COMMENT_COMMENT;
+
+ // we'll write the ActionSize later
+ nOldPos = rOStm.Tell();
+ rOStm.SeekRel( 4 );
+
+ // write data
+ rOStm << pA->GetComment() << pA->GetValue() << nDataSize;
+
+ if( nDataSize )
+ rOStm.Write( pA->GetData(), nDataSize );
+
+ rOStm << (INT32) 0; // number of actions that follow this comment
+
+ // calculate and write ActionSize of comment
+ nNewPos = rOStm.Tell();
+ rOStm.Seek( nOldPos );
+ rOStm << (INT32) ( nNewPos - nOldPos );
+ rOStm.Seek( nNewPos );
+
+ nCount++;
+ }
+ break;
+
+#ifdef DBG_UTIL
+ default:
+ {
+ ByteString aStr( "Missing implementation for Action#: " );
+ aStr += ByteString::CreateFromInt32( pAction->GetType() );
+ aStr += '!';
+ DBG_ERROR( aStr.GetBuffer() );
+ }
+ break;
+#endif
+
+/*
+ case( META_TEXTRECT_ACTION ):
+ {
+ MetaTextRectAction* pAct = (MetaTextRectAction*) pAction;
+
+ rOStm << ;
+ rOStm << ;
+
+ nCount++;
+ }
+ break;
+*/
+
+/*
+ case( META_MASK_ACTION ):
+ {
+ MetaMaskAction* pAct = (MetaMaskAction*) pAction;
+
+ rOStm << ;
+ rOStm << ;
+
+ nCount++;
+ }
+ break;
+*/
+
+/*
+ case( META_MASKSCALE_ACTION ):
+ {
+ MetaMaskScaleAction* pAct = (MetaMaskScaleAction*) pAction;
+
+ rOStm << ;
+ rOStm << ;
+
+ nCount++;
+ }
+ break;
+*/
+
+/*
+ case( META_MASKSCALEPART_ACTION ):
+ {
+ MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction;
+
+ rOStm << ;
+ rOStm << ;
+
+ nCount++;
+ }
+ break;
+*/
+
+/*
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ {
+ MetaISectRegionClipRegionAction* pAct = (MetaISectRegionClipRegionAction*) pAction;
+
+ rOStm << ;
+ rOStm << ;
+
+ nCount++;
+ }
+ break;
+*/
+ }
+ }
+
+ return nCount;
+}
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
new file mode 100644
index 000000000000..657d42a21546
--- /dev/null
+++ b/vcl/source/gdi/font.cxx
@@ -0,0 +1,625 @@
+/*************************************************************************
+ *
+ * $RCSfile: font.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_FONT_CXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_FONT_HXX
+#include <font.hxx>
+#endif
+
+// =======================================================================
+
+DBG_NAME( Font );
+
+// -----------------------------------------------------------------------
+
+Impl_Font::Impl_Font() :
+ maColor( COL_BLACK ),
+ maFillColor( COL_TRANSPARENT )
+{
+ mnRefCount = 1;
+ meCharSet = RTL_TEXTENCODING_DONTKNOW;
+ meLanguage = LANGUAGE_DONTKNOW;
+ meFamily = FAMILY_DONTKNOW;
+ mePitch = PITCH_DONTKNOW;
+ meAlign = ALIGN_TOP;
+ meWeight = WEIGHT_DONTKNOW;
+ meWidthType = WIDTH_DONTKNOW;
+ meUnderline = UNDERLINE_NONE;
+ meStrikeout = STRIKEOUT_NONE;
+ meItalic = ITALIC_NONE;
+ mbWordLine = FALSE;
+ mbOutline = FALSE;
+ mbShadow = FALSE;
+ mbKerning = FALSE;
+ mbTransparent = TRUE;
+ mnOrientation = 0;
+}
+
+// -----------------------------------------------------------------------
+
+Impl_Font::Impl_Font( const Impl_Font& rImplFont ) :
+ maColor( rImplFont.maColor ),
+ maFillColor( rImplFont.maFillColor ),
+ maName( rImplFont.maName ),
+ maStyleName( rImplFont.maStyleName ),
+ maSize( rImplFont.maSize )
+{
+ mnRefCount = 1;
+ meCharSet = rImplFont.meCharSet;
+ meLanguage = rImplFont.meLanguage;
+ meFamily = rImplFont.meFamily;
+ mePitch = rImplFont.mePitch;
+ meAlign = rImplFont.meAlign;
+ meWeight = rImplFont.meWeight;
+ meWidthType = rImplFont.meWidthType;
+ meUnderline = rImplFont.meUnderline;
+ meStrikeout = rImplFont.meStrikeout;
+ meItalic = rImplFont.meItalic;
+ mbWordLine = rImplFont.mbWordLine;
+ mbOutline = rImplFont.mbOutline;
+ mbShadow = rImplFont.mbShadow;
+ mbKerning = rImplFont.mbKerning;
+ mbTransparent = rImplFont.mbTransparent;
+ mnOrientation = rImplFont.mnOrientation;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::MakeUnique()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpImplFont->mnRefCount != 1 )
+ {
+ if ( mpImplFont->mnRefCount )
+ mpImplFont->mnRefCount--;
+ mpImplFont = new Impl_Font( *mpImplFont );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Font::Font()
+{
+ DBG_CTOR( Font, NULL );
+
+#ifdef WIN
+ static Impl_Font _near aStaticImplFont;
+#else
+ static Impl_Font aStaticImplFont;
+#endif
+ // RefCount == 0 fuer statische Objekte
+ aStaticImplFont.mnRefCount = 0;
+ mpImplFont = &aStaticImplFont;
+}
+
+// -----------------------------------------------------------------------
+
+Font::Font( const Font& rFont )
+{
+ DBG_CTOR( Font, NULL );
+ DBG_CHKOBJ( &rFont, Font, NULL );
+ DBG_ASSERT( rFont.mpImplFont->mnRefCount < 0xFFFE, "Font: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpImplFont = rFont.mpImplFont;
+ // RefCount == 0 fuer statische Objekte
+ if ( mpImplFont->mnRefCount )
+ mpImplFont->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+Font::Font( const XubString& rName, const Size& rSize )
+{
+ DBG_CTOR( Font, NULL );
+
+ mpImplFont = new Impl_Font;
+ mpImplFont->maName = rName;
+ mpImplFont->maSize = rSize;
+}
+
+// -----------------------------------------------------------------------
+
+Font::Font( const XubString& rName, const XubString& rStyleName, const Size& rSize )
+{
+ DBG_CTOR( Font, NULL );
+
+ mpImplFont = new Impl_Font;
+ mpImplFont->maName = rName;
+ mpImplFont->maStyleName = rStyleName;
+ mpImplFont->maSize = rSize;
+}
+
+// -----------------------------------------------------------------------
+
+Font::Font( FontFamily eFamily, const Size& rSize )
+{
+ DBG_CTOR( Font, NULL );
+
+ mpImplFont = new Impl_Font;
+ mpImplFont->meFamily = eFamily;
+ mpImplFont->maSize = rSize;
+}
+
+// -----------------------------------------------------------------------
+
+Font::~Font()
+{
+ DBG_DTOR( Font, NULL );
+
+ // Wenn es keine statischen ImplDaten sind, dann loeschen, wenn es
+ // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ if ( mpImplFont->mnRefCount )
+ {
+ if ( mpImplFont->mnRefCount == 1 )
+ delete mpImplFont;
+ else
+ mpImplFont->mnRefCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetColor( const Color& rColor )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->maColor = rColor;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetFillColor( const Color& rColor )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->maFillColor = rColor;
+ if ( rColor.GetTransparency() )
+ mpImplFont->mbTransparent = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetTransparent( BOOL bTransparent )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->mbTransparent = bTransparent;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetAlign( FontAlign eAlign )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meAlign = eAlign;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetName( const XubString& rName )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->maName = rName;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetStyleName( const XubString& rStyleName )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->maStyleName = rStyleName;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetSize( const Size& rSize )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->maSize = rSize;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetFamily( FontFamily eFamily )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meFamily = eFamily;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetCharSet( CharSet eCharSet )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meCharSet = eCharSet;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetLanguage( LanguageType eLanguage )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meLanguage = eLanguage;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetPitch( FontPitch ePitch )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->mePitch = ePitch;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetOrientation( short nOrientation )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->mnOrientation = nOrientation;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetKerning( BOOL bKerning )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->mbKerning = bKerning;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetWeight( FontWeight eWeight )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meWeight = eWeight;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetWidthType( FontWidth eWidth )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meWidthType = eWidth;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetItalic( FontItalic eItalic )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meItalic = eItalic;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetOutline( BOOL bOutline )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->mbOutline = bOutline;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetShadow( BOOL bShadow )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->mbShadow = bShadow;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetUnderline( FontUnderline eUnderline )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meUnderline = eUnderline;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetStrikeout( FontStrikeout eStrikeout )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->meStrikeout = eStrikeout;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::SetWordLineMode( BOOL bWordLine )
+{
+ DBG_CHKTHIS( Font, NULL );
+
+ MakeUnique();
+ mpImplFont->mbWordLine = bWordLine;
+}
+
+// -----------------------------------------------------------------------
+
+Font& Font::operator=( const Font& rFont )
+{
+ DBG_CHKTHIS( Font, NULL );
+ DBG_CHKOBJ( &rFont, Font, NULL );
+ DBG_ASSERT( rFont.mpImplFont->mnRefCount < 0xFFFE, "Font: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ // RefCount == 0 fuer statische Objekte
+ if ( rFont.mpImplFont->mnRefCount )
+ rFont.mpImplFont->mnRefCount++;
+
+ // Wenn es keine statischen ImplDaten sind, dann loeschen, wenn es
+ // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ if ( mpImplFont->mnRefCount )
+ {
+ if ( mpImplFont->mnRefCount == 1 )
+ delete mpImplFont;
+ else
+ mpImplFont->mnRefCount--;
+ }
+
+ mpImplFont = rFont.mpImplFont;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Font::operator==( const Font& rFont ) const
+{
+ DBG_CHKTHIS( Font, NULL );
+ DBG_CHKOBJ( &rFont, Font, NULL );
+
+ if ( mpImplFont == rFont.mpImplFont )
+ return TRUE;
+
+ if ( (mpImplFont->meWeight == rFont.mpImplFont->meWeight ) &&
+ (mpImplFont->meItalic == rFont.mpImplFont->meItalic ) &&
+ (mpImplFont->meUnderline == rFont.mpImplFont->meUnderline ) &&
+ (mpImplFont->mbWordLine == rFont.mpImplFont->mbWordLine ) &&
+ (mpImplFont->meFamily == rFont.mpImplFont->meFamily ) &&
+ (mpImplFont->mePitch == rFont.mpImplFont->mePitch ) &&
+ (mpImplFont->meCharSet == rFont.mpImplFont->meCharSet ) &&
+ (mpImplFont->meAlign == rFont.mpImplFont->meAlign ) &&
+ (mpImplFont->maName == rFont.mpImplFont->maName ) &&
+ (mpImplFont->maStyleName == rFont.mpImplFont->maStyleName ) &&
+ (mpImplFont->maColor == rFont.mpImplFont->maColor ) &&
+ (mpImplFont->maFillColor == rFont.mpImplFont->maFillColor ) &&
+ (mpImplFont->maSize == rFont.mpImplFont->maSize ) &&
+ (mpImplFont->mnOrientation == rFont.mpImplFont->mnOrientation ) &&
+ (mpImplFont->meStrikeout == rFont.mpImplFont->meStrikeout ) &&
+ (mpImplFont->mbOutline == rFont.mpImplFont->mbOutline ) &&
+ (mpImplFont->mbShadow == rFont.mpImplFont->mbShadow ) &&
+ (mpImplFont->mbKerning == rFont.mpImplFont->mbKerning ) &&
+ (mpImplFont->mbTransparent == rFont.mpImplFont->mbTransparent ) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Font::Merge( const Font& rFont )
+{
+ if ( rFont.GetName().Len() )
+ {
+ SetName( rFont.GetName() );
+ SetStyleName( rFont.GetStyleName() );
+ SetFamily( rFont.GetFamily() );
+ SetCharSet( GetCharSet() );
+ SetLanguage( rFont.GetLanguage() );
+ SetPitch( rFont.GetPitch() );
+ }
+
+ if ( rFont.GetSize().Height() )
+ SetSize( rFont.GetSize() );
+ if ( rFont.GetWeight() != WEIGHT_DONTKNOW )
+ SetWeight( rFont.GetWeight() );
+ if ( rFont.GetWidthType() != WIDTH_DONTKNOW )
+ SetWidthType( rFont.GetWidthType() );
+ if ( rFont.GetItalic() != ITALIC_DONTKNOW )
+ SetItalic( rFont.GetItalic() );
+ if ( rFont.GetUnderline() != UNDERLINE_DONTKNOW )
+ {
+ SetUnderline( rFont.GetUnderline() );
+ SetWordLineMode( rFont.IsWordLineMode() );
+ }
+ if ( rFont.GetStrikeout() != STRIKEOUT_DONTKNOW )
+ {
+ SetStrikeout( rFont.GetStrikeout() );
+ SetWordLineMode( rFont.IsWordLineMode() );
+ }
+
+ // Defaults?
+ SetOrientation( rFont.GetOrientation() );
+ SetKerning( rFont.IsKerning() );
+ SetOutline( rFont.IsOutline() );
+ SetShadow( rFont.IsShadow() );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font )
+{
+ VersionCompat aCompat( rIStm, STREAM_READ );
+ UINT16 nTmp16;
+ BOOL bTmp;
+
+ rIStm.ReadByteString( rImpl_Font.maName, rIStm.GetStreamCharSet() );
+ rIStm.ReadByteString( rImpl_Font.maStyleName, rIStm.GetStreamCharSet() );
+ rIStm >> rImpl_Font.maSize;
+// rIStm >> rImpl_Font.maColor; // removed since SUPD396
+// rIStm >> rImpl_Font.maFillColor; // removed since SUPD396
+
+ rIStm >> nTmp16; rImpl_Font.meCharSet = (rtl_TextEncoding) nTmp16;
+ rIStm >> nTmp16; rImpl_Font.meFamily = (FontFamily) nTmp16;
+ rIStm >> nTmp16; rImpl_Font.mePitch = (FontPitch) nTmp16;
+// rIStm >> nTmp16; rImpl_Font.meAlign = (FontAlign) nTmp16; // removed since SUPD396
+ rIStm >> nTmp16; rImpl_Font.meWeight = (FontWeight) nTmp16;
+ rIStm >> nTmp16; rImpl_Font.meUnderline = (FontUnderline) nTmp16;
+ rIStm >> nTmp16; rImpl_Font.meStrikeout = (FontStrikeout) nTmp16;
+ rIStm >> nTmp16; rImpl_Font.meItalic = (FontItalic) nTmp16;
+ rIStm >> nTmp16; rImpl_Font.meLanguage = (LanguageType) nTmp16; // new since SUPD 396
+ rIStm >> nTmp16; rImpl_Font.meWidthType = (FontWidth) nTmp16; // new since SUPD 396
+
+ rIStm >> rImpl_Font.mnOrientation;
+
+ rIStm >> bTmp; rImpl_Font.mbWordLine = bTmp;
+ rIStm >> bTmp; rImpl_Font.mbOutline = bTmp;
+ rIStm >> bTmp; rImpl_Font.mbShadow = bTmp;
+ rIStm >> bTmp; rImpl_Font.mbKerning = bTmp;
+// rIStm >> bTmp; rImpl_Font.mbTransparent = bTmp; // removed since SUPD396
+
+ return rIStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Impl_Font& rImpl_Font )
+{
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
+ rOStm.WriteByteString( rImpl_Font.maName, rOStm.GetStreamCharSet() );
+ rOStm.WriteByteString( rImpl_Font.maStyleName, rOStm.GetStreamCharSet() );
+ rOStm << rImpl_Font.maSize;
+// rOStm << rImpl_Font.maColor; // removed since SUPD396
+// rOStm << rImpl_Font.maFillColor; // removed since SUPD396
+
+ rOStm << (UINT16) GetStoreCharSet( rImpl_Font.meCharSet, rOStm.GetVersion() );
+ rOStm << (UINT16) rImpl_Font.meFamily;
+ rOStm << (UINT16) rImpl_Font.mePitch;
+// rOStm << (UINT16) rImpl_Font.meAlign; // removed since SUPD396
+ rOStm << (UINT16) rImpl_Font.meWeight;
+ rOStm << (UINT16) rImpl_Font.meUnderline;
+ rOStm << (UINT16) rImpl_Font.meStrikeout;
+ rOStm << (UINT16) rImpl_Font.meItalic;
+ rOStm << (UINT16) rImpl_Font.meLanguage; // new since SUPD 396
+ rOStm << (UINT16) rImpl_Font.meWidthType; // new since SUPD 396
+
+ rOStm << rImpl_Font.mnOrientation;
+
+ rOStm << (BOOL) rImpl_Font.mbWordLine;
+ rOStm << (BOOL) rImpl_Font.mbOutline;
+ rOStm << (BOOL) rImpl_Font.mbShadow;
+ rOStm << (BOOL) rImpl_Font.mbKerning;
+// rOStm << (BOOL) rImpl_Font.mbTransparent; // removed since SUPD396
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, Font& rFont )
+{
+ rFont.MakeUnique();
+ return( rIStm >> *rFont.mpImplFont );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Font& rFont )
+{
+ return( rOStm << *rFont.mpImplFont );
+}
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
new file mode 100644
index 000000000000..852dbfcb87a3
--- /dev/null
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -0,0 +1,1724 @@
+/*************************************************************************
+ *
+ * $RCSfile: gdimtf.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_GDIMTF_CXX
+
+#ifndef _RTL_CRC_H_
+#include <rtl/crc.h>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_CVTSVM_HXX
+#include <cvtsvm.hxx>
+#endif
+#include <gdimtf.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define GAMMA( _def_cVal, _def_InvGamma ) ((BYTE)MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0L,255L))
+
+// --------------------------
+// - Color exchange structs -
+// --------------------------
+
+struct ImplColAdjustParam
+{
+ BYTE* pMapR;
+ BYTE* pMapG;
+ BYTE* pMapB;
+};
+
+struct ImplBmpAdjustParam
+{
+ short nLuminancePercent;
+ short nContrastPercent;
+ short nChannelRPercent;
+ short nChannelGPercent;
+ short nChannelBPercent;
+ double fGamma;
+ BOOL bInvert;
+};
+
+// -----------------------------------------------------------------------------
+
+struct ImplColConvertParam
+{
+ MtfConversion eConversion;
+};
+
+struct ImplBmpConvertParam
+{
+ BmpConversion eConversion;
+};
+
+// -----------------------------------------------------------------------------
+
+struct ImplColMonoParam
+{
+ Color aColor;
+};
+
+struct ImplBmpMonoParam
+{
+ Color aColor;
+};
+
+// -----------------------------------------------------------------------------
+
+struct ImplColReplaceParam
+{
+ ULONG* pMinR;
+ ULONG* pMaxR;
+ ULONG* pMinG;
+ ULONG* pMaxG;
+ ULONG* pMinB;
+ ULONG* pMaxB;
+ const Color* pDstCols;
+ ULONG nCount;
+};
+
+struct ImplBmpReplaceParam
+{
+ const Color* pSrcCols;
+ const Color* pDstCols;
+ ULONG nCount;
+ const ULONG* pTols;
+};
+
+
+// ---------
+// - Label -
+// ---------
+
+struct ImpLabel
+{
+ String aLabelName;
+ ULONG nActionPos;
+
+ ImpLabel( const String& rLabelName, ULONG _nActionPos ) :
+ aLabelName( rLabelName ),
+ nActionPos( _nActionPos ) {}
+};
+
+// -------------
+// - LabelList -
+// -------------
+
+class ImpLabelList : private List
+{
+public:
+
+ ImpLabelList() : List( 8, 4, 4 ) {}
+ ImpLabelList( const ImpLabelList& rList );
+ ~ImpLabelList();
+
+ void ImplInsert( ImpLabel* p ) { Insert( p, LIST_APPEND ); }
+ ImpLabel* ImplRemove( ULONG nPos ) { return (ImpLabel*) Remove( nPos ); }
+ void ImplReplace( ImpLabel* p ) { Replace( (void*)p ); }
+ ImpLabel* ImplFirst() { return (ImpLabel*) First(); }
+ ImpLabel* ImplNext() { return (ImpLabel*) Next(); }
+ ImpLabel* ImplGetLabel( ULONG nPos ) const { return (ImpLabel*) GetObject( nPos ); }
+ ULONG ImplGetLabelPos( const String& rLabelName );
+ ULONG ImplCount() const { return Count(); }
+};
+
+// ------------------------------------------------------------------------
+
+ImpLabelList::ImpLabelList( const ImpLabelList& rList ) :
+ List( rList )
+{
+ for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() )
+ ImplReplace( new ImpLabel( *pLabel ) );
+}
+
+// ------------------------------------------------------------------------
+
+ImpLabelList::~ImpLabelList()
+{
+ for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() )
+ delete pLabel;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ImpLabelList::ImplGetLabelPos( const String& rLabelName )
+{
+ ULONG nLabelPos = METAFILE_LABEL_NOTFOUND;
+
+ for( ImpLabel* pLabel = ImplFirst(); pLabel; pLabel = ImplNext() )
+ {
+ if ( rLabelName == pLabel->aLabelName )
+ {
+ nLabelPos = GetCurPos();
+ break;
+ }
+ }
+
+ return nLabelPos;
+}
+
+// ---------------
+// - GDIMetaFile -
+// ---------------
+
+GDIMetaFile::GDIMetaFile() :
+ List ( 0x3EFF, 64, 64 ),
+ aPrefSize ( 1, 1 ),
+ pPrev ( NULL ),
+ pNext ( NULL ),
+ pOutDev ( NULL ),
+ pLabelList ( NULL ),
+ bPause ( FALSE ),
+ bRecord ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) :
+ List ( rMtf ),
+ aPrefMapMode ( rMtf.aPrefMapMode ),
+ aPrefSize ( rMtf.aPrefSize ),
+ aHookHdlLink ( rMtf.aHookHdlLink ),
+ pPrev ( rMtf.pPrev ),
+ pNext ( rMtf.pNext ),
+ pOutDev ( NULL ),
+ bPause ( FALSE ),
+ bRecord ( FALSE )
+{
+ // RefCount der MetaActions erhoehen
+ for( void* pAct = First(); pAct; pAct = Next() )
+ ( (MetaAction*) pAct )->Duplicate();
+
+ if( rMtf.pLabelList )
+ pLabelList = new ImpLabelList( *rMtf.pLabelList );
+ else
+ pLabelList = NULL;
+
+ if( rMtf.bRecord )
+ {
+ Record( rMtf.pOutDev );
+
+ if ( rMtf.bPause )
+ Pause( TRUE );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+GDIMetaFile::~GDIMetaFile()
+{
+ Clear();
+}
+
+// ------------------------------------------------------------------------
+
+GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf )
+{
+ if( this != &rMtf )
+ {
+ Clear();
+
+ List::operator=( rMtf );
+
+ // RefCount der MetaActions erhoehen
+ for( void* pAct = First(); pAct; pAct = Next() )
+ ( (MetaAction*) pAct )->Duplicate();
+
+ if( rMtf.pLabelList )
+ pLabelList = new ImpLabelList( *rMtf.pLabelList );
+ else
+ pLabelList = NULL;
+
+ aPrefMapMode = rMtf.aPrefMapMode;
+ aPrefSize = rMtf.aPrefSize;
+ aHookHdlLink = rMtf.aHookHdlLink;
+ pPrev = rMtf.pPrev;
+ pNext = rMtf.pNext;
+ pOutDev = NULL;
+ bPause = FALSE;
+ bRecord = FALSE;
+
+ if( rMtf.bRecord )
+ {
+ Record( rMtf.pOutDev );
+
+ if( rMtf.bPause )
+ Pause( TRUE );
+ }
+ }
+
+ return *this;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GDIMetaFile::operator==( const GDIMetaFile& rMtf ) const
+{
+ const ULONG nCount = Count();
+ BOOL bRet = FALSE;
+
+ if( this == &rMtf )
+ bRet = TRUE;
+ else if( rMtf.GetActionCount() == nCount &&
+ rMtf.GetPrefSize() == aPrefSize &&
+ rMtf.GetPrefMapMode() == aPrefMapMode )
+ {
+ bRet = TRUE;
+
+ for( ULONG n = 0UL; n < nCount; n++ )
+ {
+ if( GetObject( n ) != rMtf.GetObject( n ) )
+ {
+ bRet = FALSE;
+ break;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Clear()
+{
+ if( bRecord )
+ Stop();
+
+ for( void* pAct = First(); pAct; pAct = Next() )
+ ( (MetaAction*) pAct )->Delete();
+
+ List::Clear();
+
+ delete pLabelList;
+ pLabelList = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Linker( OutputDevice* pOut, BOOL bLink )
+{
+ if( bLink )
+ {
+ pNext = NULL;
+ pPrev = pOut->GetConnectMetaFile();
+ pOut->SetConnectMetaFile( this );
+
+ if( pPrev )
+ pPrev->pNext = this;
+ }
+ else
+ {
+ if( pNext )
+ {
+ pNext->pPrev = pPrev;
+
+ if( pPrev )
+ pPrev->pNext = pNext;
+ }
+ else
+ {
+ if( pPrev )
+ pPrev->pNext = NULL;
+
+ pOut->SetConnectMetaFile( pPrev );
+ }
+
+ pPrev = NULL;
+ pNext = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+long GDIMetaFile::Hook()
+{
+ return aHookHdlLink.Call( this );
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Record( OutputDevice* pOut )
+{
+ if( bRecord )
+ Stop();
+
+ Last();
+ pOutDev = pOut;
+ bRecord = TRUE;
+ Linker( pOut, TRUE );
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Play( GDIMetaFile& rMtf, ULONG nPos )
+{
+ if ( !bRecord && !rMtf.bRecord )
+ {
+ MetaAction* pAction = GetCurAction();
+ const ULONG nCount = Count();
+
+ if( nPos > nCount )
+ nPos = nCount;
+
+ for( ULONG nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ )
+ {
+ if( !Hook() )
+ {
+ pAction->Duplicate();
+ rMtf.AddAction( pAction );
+ }
+
+ pAction = (MetaAction*) Next();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Play( OutputDevice* pOut, ULONG nPos )
+{
+ if( !bRecord )
+ {
+ MetaAction* pAction = GetCurAction();
+ const ULONG nCount = Count();
+ ULONG i = 0, nSyncCount = ( pOut->GetOutDevType() == OUTDEV_WINDOW ) ? 0x000000ff : 0xffffffff;
+
+ if( nPos > nCount )
+ nPos = nCount;
+
+ for( ULONG nCurPos = GetCurPos(); nCurPos < nPos; nCurPos++ )
+ {
+ if( !Hook() )
+ {
+ pAction->Execute( pOut );
+
+ // flush output from time to time
+ if( i++ > nSyncCount )
+ ( (Window*) pOut )->Flush(), i = 0;
+ }
+
+ pAction = (MetaAction*) Next();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
+ const Size& rSize, ULONG nPos )
+{
+ Region aDrawClipRegion;
+ MapMode aDrawMap( GetPrefMapMode() );
+ Size aDestSize( pOut->LogicToPixel( rSize ) );
+
+ if( aDestSize.Width() && aDestSize.Height() )
+ {
+ Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
+ GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
+
+ if( !aTmpPrefSize.Width() )
+ aTmpPrefSize.Width() = aDestSize.Width();
+
+ if( !aTmpPrefSize.Height() )
+ aTmpPrefSize.Height() = aDestSize.Height();
+
+ Fraction aScaleX( aDestSize.Width(), aTmpPrefSize.Width() );
+ Fraction aScaleY( aDestSize.Height(), aTmpPrefSize.Height() );
+
+ aScaleX *= aDrawMap.GetScaleX(); aDrawMap.SetScaleX( aScaleX );
+ aScaleY *= aDrawMap.GetScaleY(); aDrawMap.SetScaleY( aScaleY );
+
+ aDrawMap.SetOrigin( pOut->PixelToLogic( pOut->LogicToPixel( rPos ), aDrawMap ) );
+
+ pOut->Push();
+
+ if ( pMtf && pMtf->IsRecord() && ( pOut->GetOutDevType() != OUTDEV_PRINTER ) )
+ pOut->SetRelativeMapMode( aDrawMap );
+ else
+ pOut->SetMapMode( aDrawMap );
+
+ Play( pOut, nPos );
+
+ pOut->Pop();
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Pause( BOOL _bPause )
+{
+ if( bRecord )
+ {
+ if( _bPause )
+ {
+ if( !bPause )
+ Linker( pOutDev, FALSE );
+ }
+ else
+ {
+ if( bPause )
+ Linker( pOutDev, TRUE );
+ }
+
+ bPause = _bPause;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Stop()
+{
+ if( bRecord )
+ {
+ bRecord = FALSE;
+
+ if( !bPause )
+ Linker( pOutDev, FALSE );
+ else
+ bPause = FALSE;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::WindStart()
+{
+ if( !bRecord )
+ First();
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::WindEnd()
+{
+ if( !bRecord )
+ Last();
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Wind( ULONG nActionPos )
+{
+ if( !bRecord )
+ Seek( nActionPos );
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::WindPrev()
+{
+ if( !bRecord )
+ Prev();
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::WindNext()
+{
+ if( !bRecord )
+ Next();
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::AddAction( MetaAction* pAction )
+{
+ Insert( pAction, LIST_APPEND );
+
+ if( pPrev )
+ {
+ pAction->Duplicate();
+ pPrev->AddAction( pAction );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::AddAction( MetaAction* pAction, ULONG nPos )
+{
+ Insert( pAction, nPos );
+
+ if( pPrev )
+ {
+ pAction->Duplicate();
+ pPrev->AddAction( pAction, nPos );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* GDIMetaFile::CopyAction( ULONG nPos ) const
+{
+ return ( (MetaAction*) GetObject( nPos ) )->Clone();
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GDIMetaFile::GetActionPos( const String& rLabel )
+{
+ ImpLabel* pLabel = NULL;
+
+ if( pLabelList )
+ pLabel = pLabelList->ImplGetLabel( pLabelList->ImplGetLabelPos( rLabel ) );
+ else
+ pLabel = NULL;
+
+ return( pLabel ? pLabel->nActionPos : METAFILE_LABEL_NOTFOUND );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GDIMetaFile::InsertLabel( const String& rLabel, ULONG nActionPos )
+{
+ BOOL bRet = FALSE;
+
+ if( !pLabelList )
+ pLabelList = new ImpLabelList;
+
+ if( pLabelList->ImplGetLabelPos( rLabel ) == METAFILE_LABEL_NOTFOUND )
+ {
+ pLabelList->ImplInsert( new ImpLabel( rLabel, nActionPos ) );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::RemoveLabel( const String& rLabel )
+{
+ if( pLabelList )
+ {
+ const ULONG nLabelPos = pLabelList->ImplGetLabelPos( rLabel );
+
+ if( nLabelPos != METAFILE_LABEL_NOTFOUND )
+ delete pLabelList->ImplRemove( nLabelPos );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::RenameLabel( const String& rLabel, const String& rNewLabel )
+{
+ if( pLabelList )
+ {
+ const ULONG nLabelPos = pLabelList->ImplGetLabelPos( rLabel );
+
+ if ( nLabelPos != METAFILE_LABEL_NOTFOUND )
+ pLabelList->ImplGetLabel( nLabelPos )->aLabelName = rNewLabel;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GDIMetaFile::GetLabelCount() const
+{
+ return( pLabelList ? pLabelList->ImplCount() : 0UL );
+}
+
+// ------------------------------------------------------------------------
+
+String GDIMetaFile::GetLabel( ULONG nLabel )
+{
+ String aString;
+
+ if( pLabelList )
+ {
+ const ImpLabel* pLabel = pLabelList->ImplGetLabel( nLabel );
+
+ if( pLabel )
+ aString = pLabel->aLabelName;
+ }
+
+ return aString;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GDIMetaFile::SaveStatus()
+{
+ if ( bRecord )
+ {
+ if ( bPause )
+ Linker( pOutDev, TRUE );
+
+ AddAction( new MetaLineColorAction( pOutDev->GetLineColor(),
+ pOutDev->IsLineColor() ) );
+ AddAction( new MetaFillColorAction( pOutDev->GetFillColor(),
+ pOutDev->IsFillColor() ) );
+ AddAction( new MetaFontAction( pOutDev->GetFont() ) );
+ AddAction( new MetaTextColorAction( pOutDev->GetTextColor() ) );
+ AddAction( new MetaTextFillColorAction( pOutDev->GetTextFillColor(),
+ pOutDev->IsTextFillColor() ) );
+ AddAction( new MetaTextLineColorAction( pOutDev->GetTextLineColor(),
+ pOutDev->IsTextLineColor() ) );
+ AddAction( new MetaTextAlignAction( pOutDev->GetTextAlign() ) );
+ AddAction( new MetaRasterOpAction( pOutDev->GetRasterOp() ) );
+ AddAction( new MetaMapModeAction( pOutDev->GetMapMode() ) );
+ AddAction( new MetaClipRegionAction( pOutDev->GetClipRegion(),
+ pOutDev->IsClipRegion() ) );
+
+ if ( bPause )
+ Linker( pOutDev, FALSE );
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Move( long nX, long nY )
+{
+ for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() )
+ {
+ MetaAction* pModAct;
+
+ if( pAct->GetRefCount() > 1 )
+ {
+ Replace( pModAct = pAct->Clone(), pAct );
+ pAct->Delete();
+ }
+ else
+ pModAct = pAct;
+
+ pModAct->Move( nX, nY );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Scale( double fScaleX, double fScaleY )
+{
+ for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() )
+ {
+ MetaAction* pModAct;
+
+ if( pAct->GetRefCount() > 1 )
+ {
+ Replace( pModAct = pAct->Clone(), pAct );
+ pAct->Delete();
+ }
+ else
+ pModAct = pAct;
+
+ pModAct->Scale( fScaleX, fScaleY );
+ }
+
+ aPrefSize.Width() = FRound( aPrefSize.Width() * fScaleX );
+ aPrefSize.Height() = FRound( aPrefSize.Height() * fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY )
+{
+ Scale( (double) rScaleX, (double) rScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+Color GDIMetaFile::ImplColAdjustFnc( const Color& rColor, const void* pColParam )
+{
+ return Color( rColor.GetTransparency(),
+ ( (const ImplColAdjustParam*) pColParam )->pMapR[ rColor.GetRed() ],
+ ( (const ImplColAdjustParam*) pColParam )->pMapG[ rColor.GetGreen() ],
+ ( (const ImplColAdjustParam*) pColParam )->pMapB[ rColor.GetBlue() ] );
+
+}
+
+// ------------------------------------------------------------------------
+
+BitmapEx GDIMetaFile::ImplBmpAdjustFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
+{
+ const ImplBmpAdjustParam* p = (const ImplBmpAdjustParam*) pBmpParam;
+ BitmapEx aRet( rBmpEx );
+
+ aRet.Adjust( p->nLuminancePercent, p->nContrastPercent,
+ p->nChannelRPercent, p->nChannelGPercent, p->nChannelBPercent,
+ p->fGamma, p->bInvert );
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------
+
+Color GDIMetaFile::ImplColConvertFnc( const Color& rColor, const void* pColParam )
+{
+ BYTE cLum = rColor.GetLuminance();
+
+ if( MTF_CONVERSION_1BIT_THRESHOLD == ( (const ImplColConvertParam*) pColParam )->eConversion )
+ cLum = ( cLum < 128 ) ? 0 : 255;
+
+ return Color( rColor.GetTransparency(), cLum, cLum, cLum );
+}
+
+// ------------------------------------------------------------------------
+
+BitmapEx GDIMetaFile::ImplBmpConvertFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
+{
+ BitmapEx aRet( rBmpEx );
+
+ aRet.Convert( ( (const ImplBmpConvertParam*) pBmpParam )->eConversion );
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------
+
+Color GDIMetaFile::ImplColMonoFnc( const Color& rColor, const void* pColParam )
+{
+ return( ( (const ImplColMonoParam*) pColParam )->aColor );
+}
+
+// ------------------------------------------------------------------------
+
+BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
+{
+ BitmapPalette aPal( 3 );
+
+ aPal[ 0 ] = Color( COL_BLACK );
+ aPal[ 1 ] = Color( COL_WHITE );
+ aPal[ 2 ] = ( (const ImplBmpMonoParam*) pBmpParam )->aColor;
+
+ Bitmap aBmp( rBmpEx.GetSizePixel(), 4, &aPal );
+ aBmp.Erase( ( (const ImplBmpMonoParam*) pBmpParam )->aColor );
+
+ if( rBmpEx.IsAlpha() )
+ return BitmapEx( aBmp, rBmpEx.GetAlpha() );
+ else if( rBmpEx.IsTransparent() )
+ return BitmapEx( aBmp, rBmpEx.GetMask() );
+ else
+ return aBmp;
+}
+
+// ------------------------------------------------------------------------
+
+Color GDIMetaFile::ImplColReplaceFnc( const Color& rColor, const void* pColParam )
+{
+ const ULONG nR = rColor.GetRed(), nG = rColor.GetGreen(), nB = rColor.GetBlue();
+
+ for( ULONG i = 0; i < ( (const ImplColReplaceParam*) pColParam )->nCount; i++ )
+ {
+ if( ( ( (const ImplColReplaceParam*) pColParam )->pMinR[ i ] <= nR ) &&
+ ( ( (const ImplColReplaceParam*) pColParam )->pMaxR[ i ] >= nR ) &&
+ ( ( (const ImplColReplaceParam*) pColParam )->pMinG[ i ] <= nG ) &&
+ ( ( (const ImplColReplaceParam*) pColParam )->pMaxG[ i ] >= nG ) &&
+ ( ( (const ImplColReplaceParam*) pColParam )->pMinB[ i ] <= nB ) &&
+ ( ( (const ImplColReplaceParam*) pColParam )->pMaxB[ i ] >= nB ) )
+ {
+ return( ( (const ImplColReplaceParam*) pColParam )->pDstCols[ i ] );
+ }
+ }
+
+ return rColor;
+}
+
+// ------------------------------------------------------------------------
+
+BitmapEx GDIMetaFile::ImplBmpReplaceFnc( const BitmapEx& rBmpEx, const void* pBmpParam )
+{
+ const ImplBmpReplaceParam* p = (const ImplBmpReplaceParam*) pBmpParam;
+ BitmapEx aRet( rBmpEx );
+
+ aRet.Replace( p->pSrcCols, p->pDstCols, p->nCount, p->pTols );
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pColParam,
+ BmpExchangeFnc pFncBmp, const void* pBmpParam )
+{
+ GDIMetaFile aMtf;
+
+ aMtf.aPrefSize = aPrefSize;
+ aMtf.aPrefMapMode = aPrefMapMode;
+
+ for( MetaAction* pAction = (MetaAction*) First(); pAction; pAction = (MetaAction*) Next() )
+ {
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ MetaPixelAction* pAct = (MetaPixelAction*) pAction;
+ aMtf.Insert( new MetaPixelAction( pAct->GetPoint(), pFncCol( pAct->GetColor(), pColParam ) ), LIST_APPEND );
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ MetaLineColorAction* pAct = (MetaLineColorAction*) pAction;
+
+ if( !pAct->IsSetting() )
+ pAct->Duplicate();
+ else
+ pAct = new MetaLineColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE );
+
+ aMtf.Insert( pAct, LIST_APPEND );
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ MetaFillColorAction* pAct = (MetaFillColorAction*) pAction;
+
+ if( !pAct->IsSetting() )
+ pAct->Duplicate();
+ else
+ pAct = new MetaFillColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE );
+
+ aMtf.Insert( pAct, LIST_APPEND );
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ {
+ MetaTextColorAction* pAct = (MetaTextColorAction*) pAction;
+ aMtf.Insert( new MetaTextColorAction( pFncCol( pAct->GetColor(), pColParam ) ), LIST_APPEND );
+ }
+ break;
+
+ case( META_TEXTFILLCOLOR_ACTION ):
+ {
+ MetaTextFillColorAction* pAct = (MetaTextFillColorAction*) pAction;
+
+ if( !pAct->IsSetting() )
+ pAct->Duplicate();
+ else
+ pAct = new MetaTextFillColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE );
+
+ aMtf.Insert( pAct, LIST_APPEND );
+ }
+ break;
+
+ case( META_TEXTLINECOLOR_ACTION ):
+ {
+ MetaTextLineColorAction* pAct = (MetaTextLineColorAction*) pAction;
+
+ if( !pAct->IsSetting() )
+ pAct->Duplicate();
+ else
+ pAct = new MetaTextLineColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE );
+
+ aMtf.Insert( pAct, LIST_APPEND );
+ }
+ break;
+
+ case( META_FONT_ACTION ):
+ {
+ MetaFontAction* pAct = (MetaFontAction*) pAction;
+ Font aFont( pAct->GetFont() );
+
+ aFont.SetColor( pFncCol( aFont.GetColor(), pColParam ) );
+ aFont.SetFillColor( pFncCol( aFont.GetFillColor(), pColParam ) );
+ aMtf.Insert( new MetaFontAction( aFont ), LIST_APPEND );
+ }
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ {
+ MetaWallpaperAction* pAct = (MetaWallpaperAction*) pAction;
+ Wallpaper aWall( pAct->GetWallpaper() );
+ const Rectangle& rRect = pAct->GetRect();
+
+ aWall.SetColor( pFncCol( aWall.GetColor(), pColParam ) );
+
+ if( aWall.IsBitmap() )
+ aWall.SetBitmap( pFncBmp( aWall.GetBitmap(), pBmpParam ) );
+
+ if( aWall.IsGradient() )
+ {
+ Gradient aGradient( aWall.GetGradient() );
+
+ aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) );
+ aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) );
+ aWall.SetGradient( aGradient );
+ }
+
+ aMtf.Insert( new MetaWallpaperAction( rRect, aWall ), LIST_APPEND );
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ case( META_BMPEX_ACTION ):
+ case( META_MASK_ACTION ):
+ {
+ DBG_ERROR( "Don't use bitmap actions of this type in metafiles!" );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
+ aMtf.Insert( new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(),
+ pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ),
+ LIST_APPEND );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
+ aMtf.Insert( new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
+ pAct->GetSrcPoint(), pAct->GetSrcSize(),
+ pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ),
+ LIST_APPEND );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction;
+ aMtf.Insert( new MetaBmpExScaleAction( pAct->GetPoint(), pAct->GetSize(),
+ pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ),
+ LIST_APPEND );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
+ aMtf.Insert( new MetaBmpExScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
+ pAct->GetSrcPoint(), pAct->GetSrcSize(),
+ pFncBmp( pAct->GetBitmapEx(), pBmpParam ) ),
+ LIST_APPEND );
+ }
+ break;
+
+ case( META_MASKSCALE_ACTION ):
+ {
+ MetaMaskScaleAction* pAct = (MetaMaskScaleAction*) pAction;
+ aMtf.Insert( new MetaMaskScaleAction( pAct->GetPoint(), pAct->GetSize(),
+ pAct->GetBitmap(),
+ pFncCol( pAct->GetColor(), pColParam ) ),
+ LIST_APPEND );
+ }
+ break;
+
+ case( META_MASKSCALEPART_ACTION ):
+ {
+ MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction;
+ aMtf.Insert( new MetaMaskScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
+ pAct->GetSrcPoint(), pAct->GetSrcSize(),
+ pAct->GetBitmap(),
+ pFncCol( pAct->GetColor(), pColParam ) ),
+ LIST_APPEND );
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ MetaGradientAction* pAct = (MetaGradientAction*) pAction;
+ Gradient aGradient( pAct->GetGradient() );
+
+ aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) );
+ aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) );
+ aMtf.Insert( new MetaGradientAction( pAct->GetRect(), aGradient ), LIST_APPEND );
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ MetaGradientExAction* pAct = (MetaGradientExAction*) pAction;
+ Gradient aGradient( pAct->GetGradient() );
+
+ aGradient.SetStartColor( pFncCol( aGradient.GetStartColor(), pColParam ) );
+ aGradient.SetEndColor( pFncCol( aGradient.GetEndColor(), pColParam ) );
+ aMtf.Insert( new MetaGradientExAction( pAct->GetPolyPolygon(), aGradient ), LIST_APPEND );
+ }
+ break;
+
+ case( META_HATCH_ACTION ):
+ {
+ MetaHatchAction* pAct = (MetaHatchAction*) pAction;
+ Hatch aHatch( pAct->GetHatch() );
+
+ aHatch.SetColor( pFncCol( aHatch.GetColor(), pColParam ) );
+ aMtf.Insert( new MetaHatchAction( pAct->GetPolyPolygon(), aHatch ), LIST_APPEND );
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ MetaFloatTransparentAction* pAct = (MetaFloatTransparentAction*) pAction;
+ GDIMetaFile aTransMtf( pAct->GetGDIMetaFile() );
+
+ aTransMtf.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam );
+ aMtf.Insert( new MetaFloatTransparentAction( aTransMtf,
+ pAct->GetPoint(), pAct->GetSize(),
+ pAct->GetGradient() ),
+ LIST_APPEND );
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ MetaEPSAction* pAct = (MetaEPSAction*) pAction;
+ GDIMetaFile aSubst( pAct->GetSubstitute() );
+
+ aSubst.ImplExchangeColors( pFncCol, pColParam, pFncBmp, pBmpParam );
+ aMtf.Insert( new MetaEPSAction( pAct->GetPoint(), pAct->GetSize(),
+ pAct->GetLink(), aSubst ),
+ LIST_APPEND );
+ }
+ break;
+
+ default:
+ {
+ pAction->Duplicate();
+ aMtf.Insert( pAction, LIST_APPEND );
+ }
+ break;
+ }
+ }
+
+ *this = aMtf;
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Adjust( short nLuminancePercent, short nContrastPercent,
+ short nChannelRPercent, short nChannelGPercent,
+ short nChannelBPercent, double fGamma, BOOL bInvert )
+{
+ // nothing to do? => return quickly
+ if( nLuminancePercent || nContrastPercent ||
+ nChannelRPercent || nChannelGPercent || nChannelBPercent ||
+ ( fGamma != 1.0 ) || bInvert )
+ {
+ double fM, fROff, fGOff, fBOff, fOff;
+ ImplColAdjustParam aColParam;
+ ImplBmpAdjustParam aBmpParam;
+
+ aColParam.pMapR = new BYTE[ 256 ];
+ aColParam.pMapG = new BYTE[ 256 ];
+ aColParam.pMapB = new BYTE[ 256 ];
+
+ // calculate slope
+ if( nContrastPercent >= 0 )
+ fM = 128.0 / ( 128.0 - 1.27 * MinMax( nContrastPercent, 0L, 100L ) );
+ else
+ fM = ( 128.0 + 1.27 * MinMax( nContrastPercent, -100L, 0L ) ) / 128.0;
+
+ // total offset = luminance offset + contrast offset
+ fOff = MinMax( nLuminancePercent, -100L, 100L ) * 2.55 + 128.0 - fM * 128.0;
+
+ // channel offset = channel offset + total offset
+ fROff = nChannelRPercent * 2.55 + fOff;
+ fGOff = nChannelGPercent * 2.55 + fOff;
+ fBOff = nChannelBPercent * 2.55 + fOff;
+
+ // calculate gamma value
+ fGamma = ( fGamma <= 0.0 || fGamma > 10.0 ) ? 1.0 : ( 1.0 / fGamma );
+ const BOOL bGamma = ( fGamma != 1.0 );
+
+ // create mapping table
+ for( long nX = 0L; nX < 256L; nX++ )
+ {
+ aColParam.pMapR[ nX ] = (BYTE) MinMax( FRound( nX * fM + fROff ), 0L, 255L );
+ aColParam.pMapG[ nX ] = (BYTE) MinMax( FRound( nX * fM + fGOff ), 0L, 255L );
+ aColParam.pMapB[ nX ] = (BYTE) MinMax( FRound( nX * fM + fBOff ), 0L, 255L );
+
+ if( bGamma )
+ {
+ aColParam.pMapR[ nX ] = GAMMA( aColParam.pMapR[ nX ], fGamma );
+ aColParam.pMapG[ nX ] = GAMMA( aColParam.pMapG[ nX ], fGamma );
+ aColParam.pMapB[ nX ] = GAMMA( aColParam.pMapB[ nX ], fGamma );
+ }
+
+ if( bInvert )
+ {
+ aColParam.pMapR[ nX ] = ~aColParam.pMapR[ nX ];
+ aColParam.pMapG[ nX ] = ~aColParam.pMapG[ nX ];
+ aColParam.pMapB[ nX ] = ~aColParam.pMapB[ nX ];
+ }
+ }
+
+ aBmpParam.nLuminancePercent = nLuminancePercent;
+ aBmpParam.nContrastPercent = nContrastPercent;
+ aBmpParam.nChannelRPercent = nChannelRPercent;
+ aBmpParam.nChannelGPercent = nChannelGPercent;
+ aBmpParam.nChannelBPercent = nChannelBPercent;
+ aBmpParam.fGamma = fGamma;
+ aBmpParam.bInvert = bInvert;
+
+ // do color adjustment
+ ImplExchangeColors( ImplColAdjustFnc, &aColParam, ImplBmpAdjustFnc, &aBmpParam );
+
+ delete[] aColParam.pMapR;
+ delete[] aColParam.pMapG;
+ delete[] aColParam.pMapB;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::Convert( MtfConversion eConversion )
+{
+ // nothing to do? => return quickly
+ if( eConversion != MTF_CONVERSION_NONE )
+ {
+ ImplColConvertParam aColParam;
+ ImplBmpConvertParam aBmpParam;
+
+ aColParam.eConversion = eConversion;
+ aBmpParam.eConversion = ( MTF_CONVERSION_1BIT_THRESHOLD == eConversion ) ? BMP_CONVERSION_1BIT_THRESHOLD : BMP_CONVERSION_8BIT_GREYS;
+
+ ImplExchangeColors( ImplColConvertFnc, &aColParam, ImplBmpConvertFnc, &aBmpParam );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::ReplaceColors( const Color& rSearchColor, const Color& rReplaceColor, ULONG nTol )
+{
+ ReplaceColors( &rSearchColor, &rReplaceColor, 1, &nTol );
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::ReplaceColors( const Color* pSearchColors, const Color* pReplaceColors, ULONG nColorCount, ULONG* pTols )
+{
+ ImplColReplaceParam aColParam;
+ ImplBmpReplaceParam aBmpParam;
+
+ aColParam.pMinR = new ULONG[ nColorCount ];
+ aColParam.pMaxR = new ULONG[ nColorCount ];
+ aColParam.pMinG = new ULONG[ nColorCount ];
+ aColParam.pMaxG = new ULONG[ nColorCount ];
+ aColParam.pMinB = new ULONG[ nColorCount ];
+ aColParam.pMaxB = new ULONG[ nColorCount ];
+
+ for( ULONG i = 0; i < nColorCount; i++ )
+ {
+ const long nTol = pTols ? ( pTols[ i ] * 255 ) / 100 : 0;
+ long nVal;
+
+ nVal = pSearchColors[ i ].GetRed();
+ aColParam.pMinR[ i ] = (ULONG) Max( nVal - nTol, 0L );
+ aColParam.pMaxR[ i ] = (ULONG) Min( nVal + nTol, 255L );
+
+ nVal = pSearchColors[ i ].GetGreen();
+ aColParam.pMinG[ i ] = (ULONG) Max( nVal - nTol, 0L );
+ aColParam.pMaxG[ i ] = (ULONG) Min( nVal + nTol, 255L );
+
+ nVal = pSearchColors[ i ].GetBlue();
+ aColParam.pMinB[ i ] = (ULONG) Max( nVal - nTol, 0L );
+ aColParam.pMaxB[ i ] = (ULONG) Min( nVal + nTol, 255L );
+ }
+
+ aColParam.pDstCols = pReplaceColors;
+ aColParam.nCount = nColorCount;
+
+ aBmpParam.pSrcCols = pSearchColors;
+ aBmpParam.pDstCols = pReplaceColors;
+ aBmpParam.nCount = nColorCount;
+ aBmpParam.pTols = pTols;
+
+ ImplExchangeColors( ImplColReplaceFnc, &aColParam, ImplBmpReplaceFnc, &aBmpParam );
+
+ delete[] aColParam.pMinR;
+ delete[] aColParam.pMaxR;
+ delete[] aColParam.pMinG;
+ delete[] aColParam.pMaxG;
+ delete[] aColParam.pMinB;
+ delete[] aColParam.pMaxB;
+};
+
+// ------------------------------------------------------------------------
+
+GDIMetaFile GDIMetaFile::GetMonochromeMtf( const Color& rColor ) const
+{
+ GDIMetaFile aRet( *this );
+
+ ImplColMonoParam aColParam;
+ ImplBmpMonoParam aBmpParam;
+
+ aColParam.aColor = rColor;
+ aBmpParam.aColor = rColor;
+
+ aRet.ImplExchangeColors( ImplColMonoFnc, &aColParam, ImplBmpMonoFnc, &aBmpParam );
+
+ return aRet;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GDIMetaFile::GetChecksum() const
+{
+ GDIMetaFile aMtf;
+ SvMemoryStream aMemStm( 65535, 65535 );
+ ImplMetaWriteData aWriteData; aWriteData.meActualCharSet = aMemStm.GetStreamCharSet();
+ SVBT16 aBT16;
+ SVBT32 aBT32;
+ ULONG nCrc = 0;
+
+ for( ULONG i = 0, nCount = GetActionCount(); i < nCount; i++ )
+ {
+ MetaAction* pAction = GetAction( i );
+
+ switch( pAction->GetType() )
+ {
+ case( META_BMP_ACTION ):
+ {
+ MetaBmpAction* pAct = (MetaBmpAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmap().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ MetaBmpScaleAction* pAct = (MetaBmpScaleAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmap().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ MetaBmpScalePartAction* pAct = (MetaBmpScalePartAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmap().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ MetaBmpExAction* pAct = (MetaBmpExAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmapEx().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ MetaBmpExScaleAction* pAct = (MetaBmpExScaleAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmapEx().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ MetaBmpExScalePartAction* pAct = (MetaBmpExScalePartAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmapEx().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_MASK_ACTION ):
+ {
+ MetaMaskAction* pAct = (MetaMaskAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmap().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetColor().GetColor(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_MASKSCALE_ACTION ):
+ {
+ MetaMaskScaleAction* pAct = (MetaMaskScaleAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmap().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetColor().GetColor(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ case( META_MASKSCALEPART_ACTION ):
+ {
+ MetaMaskScalePartAction* pAct = (MetaMaskScalePartAction*) pAction;
+
+ ShortToSVBT16( pAct->GetType(), aBT16 );
+ nCrc = rtl_crc32( nCrc, aBT16, 2 );
+
+ LongToSVBT32( pAct->GetBitmap().GetChecksum(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetColor().GetColor(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetDestSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcPoint().X(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcPoint().Y(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcSize().Width(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+
+ LongToSVBT32( pAct->GetSrcSize().Height(), aBT32 );
+ nCrc = rtl_crc32( nCrc, aBT32, 4 );
+ }
+ break;
+
+ default:
+ {
+ pAction->Write( aMemStm, &aWriteData );
+ nCrc = rtl_crc32( nCrc, aMemStm.GetData(), aMemStm.Tell() );
+ aMemStm.Seek( 0 );
+ }
+ break;
+ }
+ }
+
+ return nCrc;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, GDIMetaFile& rGDIMetaFile )
+{
+ if( !rIStm.GetError() )
+ {
+ char aId[ 7 ];
+ ULONG nStmPos = rIStm.Tell();
+ USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ BOOL bError = FALSE;
+
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ rIStm.Read( aId, 6 );
+ aId[ 6 ] = 0;
+
+ if ( !strcmp( aId, "VCLMTF" ) )
+ {
+ // new format
+ VersionCompat* pCompat;
+ MetaAction* pAction;
+ UINT32 nStmCompressMode;
+ UINT32 nCount;
+
+ pCompat = new VersionCompat( rIStm, STREAM_READ );
+
+ rIStm >> nStmCompressMode;
+ rIStm >> rGDIMetaFile.aPrefMapMode;
+ rIStm >> rGDIMetaFile.aPrefSize;
+ rIStm >> nCount;
+
+ delete pCompat;
+
+ ImplMetaReadData aReadData;
+ aReadData.meActualCharSet = rIStm.GetStreamCharSet();
+
+ for( UINT32 nAction = 0UL; ( nAction < nCount ) && !rIStm.IsEof(); nAction++ )
+ {
+ pAction = MetaAction::ReadMetaAction( rIStm, &aReadData );
+
+ if( pAction )
+ rGDIMetaFile.AddAction( pAction );
+ }
+ }
+ else
+ {
+ // to avoid possible compiler optimizations => new/delete
+ rIStm.Seek( nStmPos );
+ delete( new SVMConverter( rIStm, rGDIMetaFile, CONVERT_FROM_SVM1 ) );
+ }
+
+ // check for errors
+ if( rIStm.GetError() )
+ {
+ rGDIMetaFile.Clear();
+ rIStm.Seek( nStmPos );
+ }
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+ }
+
+ return rIStm;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile )
+{
+ if( !rOStm.GetError() )
+ {
+ if( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 )
+ ((GDIMetaFile&) rGDIMetaFile ).Write( rOStm );
+ else
+ delete( new SVMConverter( rOStm, (GDIMetaFile&) rGDIMetaFile, CONVERT_TO_SVM1 ) );
+ }
+
+ return rOStm;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& GDIMetaFile::Read( SvStream& rIStm )
+{
+ Clear();
+ rIStm >> *this;
+
+ return rIStm;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& GDIMetaFile::Write( SvStream& rOStm )
+{
+ VersionCompat* pCompat;
+ const UINT32 nStmCompressMode = rOStm.GetCompressMode();
+ USHORT nOldFormat = rOStm.GetNumberFormatInt();
+
+ rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rOStm.Write( "VCLMTF", 6 );
+
+ pCompat = new VersionCompat( rOStm, STREAM_WRITE, 1 );
+
+ rOStm << nStmCompressMode;
+ rOStm << aPrefMapMode;
+ rOStm << aPrefSize;
+ rOStm << (UINT32) GetActionCount();
+
+ delete pCompat;
+
+ ImplMetaWriteData aWriteData;
+ aWriteData.meActualCharSet = rOStm.GetStreamCharSet();
+
+ MetaAction* pAct = (MetaAction*)First();
+ while ( pAct )
+ {
+ pAct->Write( rOStm, &aWriteData );
+ pAct = (MetaAction*)Next();
+ }
+
+ rOStm.SetNumberFormatInt( nOldFormat );
+
+ return rOStm;
+}
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
new file mode 100644
index 000000000000..3a175017708e
--- /dev/null
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -0,0 +1,450 @@
+/*************************************************************************
+ *
+ * $RCSfile: gfxlink.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/vcompat.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+#include <tools/tempfile.hxx>
+#include <ucbhelper/content.hxx>
+#include "graph.hxx"
+#include "gfxlink.hxx"
+#include "cvtgrf.hxx"
+
+// -----------
+// - GfxLink -
+// -----------
+
+GfxLink::GfxLink() :
+ meType ( GFX_LINK_TYPE_NONE ),
+ mnBufSize ( 0 ),
+ mpBuf ( NULL ),
+ mpSwap ( NULL ),
+ mnUserId ( 0UL )
+{
+}
+
+// ------------------------------------------------------------------------
+
+GfxLink::GfxLink( const GfxLink& rGfxLink )
+{
+ ImplCopy( rGfxLink );
+}
+
+// ------------------------------------------------------------------------
+
+GfxLink::GfxLink( const String& rPath, GfxLinkType nType )
+{
+ sal_Int64 nFileSize = 0;
+
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( rPath, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.getPropertyValue( ::rtl::OUString::createFromAscii( "Size" ) ) >>= nFileSize;
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+
+ meType = nType;
+ mnBufSize = nFileSize;
+ mpSwap = NULL;
+ mnUserId = 0UL;
+
+ if( mnBufSize )
+ {
+ SvFileStream aFileStream( rPath, STREAM_READ );
+
+ mpBuf = new ImpBuffer( mnBufSize );
+ aFileStream.Read( mpBuf->mpBuffer, mnBufSize );
+ }
+ else
+ mpBuf = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+GfxLink::GfxLink( BYTE* pBuf, ULONG nSize, GfxLinkType nType, BOOL bOwns )
+{
+ meType = nType;
+ mnBufSize = nSize;
+ mpSwap = NULL;
+ mnUserId = 0UL;
+
+ if( bOwns )
+ mpBuf = new ImpBuffer( pBuf );
+ else if( nSize )
+ {
+ mpBuf = new ImpBuffer( nSize );
+ memcpy( mpBuf->mpBuffer, pBuf, nSize );
+ }
+ else
+ mpBuf = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+GfxLink::~GfxLink()
+{
+ if( mpBuf && !( --mpBuf->mnRefCount ) )
+ delete mpBuf;
+
+ if( mpSwap && !( --mpSwap->mnRefCount ) )
+ delete mpSwap;
+}
+
+// ------------------------------------------------------------------------
+
+GfxLink& GfxLink::operator=( const GfxLink& rGfxLink )
+{
+ if( &rGfxLink != this )
+ {
+ if ( mpBuf && !( --mpBuf->mnRefCount ) )
+ delete mpBuf;
+
+ if( mpSwap && !( --mpSwap->mnRefCount ) )
+ delete mpSwap;
+
+ ImplCopy( rGfxLink );
+ }
+
+ return *this;
+}
+
+// ------------------------------------------------------------------------
+
+void GfxLink::ImplCopy( const GfxLink& rGfxLink )
+{
+ mnBufSize = rGfxLink.mnBufSize;
+ meType = rGfxLink.meType;
+ mpBuf = rGfxLink.mpBuf;
+ mpSwap = rGfxLink.mpSwap;
+ mnUserId = rGfxLink.mnUserId;
+
+ if( mpBuf )
+ mpBuf->mnRefCount++;
+
+ if( mpSwap )
+ mpSwap->mnRefCount++;
+}
+
+// ------------------------------------------------------------------------
+
+GfxLinkType GfxLink::GetType() const
+{
+ return meType;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GfxLink::IsNative() const
+{
+ return( meType >= GFX_LINK_FIRST_NATIVE_ID && meType <= GFX_LINK_LAST_NATIVE_ID );
+}
+
+// ------------------------------------------------------------------------
+
+ULONG GfxLink::GetDataSize() const
+{
+ return mnBufSize;
+}
+
+// ------------------------------------------------------------------------
+
+const BYTE* GfxLink::GetData() const
+{
+ if( IsSwappedOut() )
+ ( (GfxLink*) this )->SwapIn();
+
+ return( mpBuf ? mpBuf->mpBuffer : NULL );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL GfxLink::LoadNative( Graphic& rGraphic )
+{
+ BOOL bRet = FALSE;
+
+ if( IsNative() && mnBufSize )
+ {
+ const BYTE* pData = GetData();
+
+ if( pData )
+ {
+ SvMemoryStream aMemStm;
+ ULONG nCvtType;
+
+ aMemStm.SetBuffer( (char*) pData, mnBufSize, FALSE, mnBufSize );
+
+ switch( meType )
+ {
+ case( GFX_LINK_TYPE_NATIVE_GIF ): nCvtType = CVT_GIF; break;
+ case( GFX_LINK_TYPE_NATIVE_JPG ): nCvtType = CVT_JPG; break;
+ case( GFX_LINK_TYPE_NATIVE_PNG ): nCvtType = CVT_PNG; break;
+ case( GFX_LINK_TYPE_NATIVE_TIF ): nCvtType = CVT_TIF; break;
+ case( GFX_LINK_TYPE_NATIVE_WMF ): nCvtType = CVT_WMF; break;
+ case( GFX_LINK_TYPE_NATIVE_MET ): nCvtType = CVT_MET; break;
+ case( GFX_LINK_TYPE_NATIVE_PCT ): nCvtType = CVT_PCT; break;
+
+ default: nCvtType = CVT_UNKNOWN; break;
+ }
+
+ if( nCvtType && ( GraphicConverter::Import( aMemStm, rGraphic, nCvtType ) == ERRCODE_NONE ) )
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void GfxLink::SwapOut()
+{
+ if( !IsSwappedOut() && mpBuf )
+ {
+ mpSwap = new ImpSwap( mpBuf->mpBuffer, mnBufSize );
+
+ if( !mpSwap->IsSwapped() )
+ {
+ delete mpSwap;
+ mpSwap = NULL;
+ }
+ else if( !( --mpBuf->mnRefCount ) )
+ delete mpBuf;
+
+ mpBuf = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void GfxLink::SwapIn()
+{
+ if( IsSwappedOut() )
+ {
+ mpBuf = new ImpBuffer( mpSwap->GetData() );
+
+ if( !( --mpSwap->mnRefCount ) )
+ delete mpSwap;
+
+ mpSwap = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const GfxLink& rGfxLink )
+{
+ VersionCompat* pCompat = new VersionCompat( rOStream, STREAM_WRITE, 1 );
+
+ rOStream << (UINT16) rGfxLink.GetType() << rGfxLink.GetDataSize() << rGfxLink.GetUserId();
+
+ delete pCompat;
+
+ if( rGfxLink.GetDataSize() )
+ {
+ if( rGfxLink.IsSwappedOut() )
+ rGfxLink.mpSwap->WriteTo( rOStream );
+ else
+ rOStream.Write( rGfxLink.GetData(), rGfxLink.GetDataSize() );
+ }
+
+ return rOStream;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, GfxLink& rGfxLink)
+{
+ ULONG nSize;
+ ULONG nUserId;
+ UINT16 nType;
+ BYTE* pBuf;
+ VersionCompat* pCompat = new VersionCompat( rIStream, STREAM_READ );
+
+ rIStream >> nType >> nSize >> nUserId;
+
+ delete pCompat;
+
+ pBuf = new BYTE[ nSize ];
+ rIStream.Read( pBuf, nSize );
+
+ rGfxLink = GfxLink( pBuf, nSize, (GfxLinkType) nType, TRUE );
+ rGfxLink.SetUserId( nUserId );
+
+ return rIStream;
+}
+
+// -----------
+// - ImpSwap -
+// -----------
+
+ImpSwap::ImpSwap( BYTE* pData, ULONG nDataSize ) :
+ mnDataSize( nDataSize ),
+ mnRefCount( 1UL )
+{
+ if( pData && mnDataSize )
+ {
+ maFileName = TempFile::CreateTempName();
+
+ if( maFileName.Len() )
+ {
+ SvFileStream aOStm( maFileName, STREAM_WRITE | STREAM_SHARE_DENYWRITE );
+
+ aOStm.Write( pData, mnDataSize );
+
+ if( aOStm.GetError() )
+ {
+ aOStm.Close();
+
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( maFileName, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+
+ maFileName.Erase();
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ImpSwap::~ImpSwap()
+{
+ if( IsSwapped() )
+ {
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( maFileName, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BYTE* ImpSwap::GetData() const
+{
+ BYTE* pData;
+
+ if( IsSwapped() )
+ {
+ SvFileStream aIStm( maFileName, STREAM_READ );
+
+ pData = new BYTE[ mnDataSize ];
+ aIStm.Read( pData, mnDataSize );
+
+ if( aIStm.GetError() )
+ {
+ aIStm.Close();
+ delete[] pData;
+ pData = NULL;
+ }
+ }
+ else
+ pData = NULL;
+
+ return pData;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpSwap::WriteTo( SvStream& rOStm ) const
+{
+ BYTE* pData = GetData();
+
+ if( pData )
+ {
+ rOStm.Write( pData, mnDataSize );
+ delete[] pData;
+ }
+}
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx
new file mode 100644
index 000000000000..7a6489f9c8e6
--- /dev/null
+++ b/vcl/source/gdi/gradient.cxx
@@ -0,0 +1,386 @@
+/*************************************************************************
+ *
+ * $RCSfile: gradient.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_GRADIENT_CXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_GRADIENT_HXX
+#include <gradient.hxx>
+#endif
+
+// =======================================================================
+
+DBG_NAME( Gradient );
+
+// -----------------------------------------------------------------------
+
+Impl_Gradient::Impl_Gradient() :
+ maStartColor( COL_BLACK ),
+ maEndColor( COL_WHITE )
+{
+ mnRefCount = 1;
+ meStyle = GRADIENT_LINEAR;
+ mnAngle = 0;
+ mnBorder = 0;
+ mnOfsX = 50;
+ mnOfsY = 50;
+ mnIntensityStart = 100;
+ mnIntensityEnd = 100;
+ mnStepCount = 0;
+}
+
+// -----------------------------------------------------------------------
+
+Impl_Gradient::Impl_Gradient( const Impl_Gradient& rImplGradient ) :
+ maStartColor( rImplGradient.maStartColor ),
+ maEndColor( rImplGradient.maEndColor )
+{
+ mnRefCount = 1;
+ meStyle = rImplGradient.meStyle;
+ mnAngle = rImplGradient.mnAngle;
+ mnBorder = rImplGradient.mnBorder;
+ mnOfsX = rImplGradient.mnOfsX;
+ mnOfsY = rImplGradient.mnOfsY;
+ mnIntensityStart = rImplGradient.mnIntensityStart;
+ mnIntensityEnd = rImplGradient.mnIntensityEnd;
+ mnStepCount = rImplGradient.mnStepCount;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::MakeUnique()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpImplGradient->mnRefCount != 1 )
+ {
+ if( mpImplGradient->mnRefCount )
+ mpImplGradient->mnRefCount--;
+
+ mpImplGradient = new Impl_Gradient( *mpImplGradient );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Gradient::Gradient()
+{
+ DBG_CTOR( Gradient, NULL );
+
+ mpImplGradient = new Impl_Gradient;
+}
+
+// -----------------------------------------------------------------------
+
+Gradient::Gradient( const Gradient& rGradient )
+{
+ DBG_CTOR( Gradient, NULL );
+ DBG_CHKOBJ( &rGradient, Gradient, NULL );
+
+ // Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpImplGradient = rGradient.mpImplGradient;
+ mpImplGradient->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+Gradient::Gradient( GradientStyle eStyle )
+{
+ DBG_CTOR( Gradient, NULL );
+
+ mpImplGradient = new Impl_Gradient;
+ mpImplGradient->meStyle = eStyle;
+}
+
+// -----------------------------------------------------------------------
+
+Gradient::Gradient( GradientStyle eStyle,
+ const Color& rStartColor, const Color& rEndColor )
+{
+ DBG_CTOR( Gradient, NULL );
+
+ mpImplGradient = new Impl_Gradient;
+ mpImplGradient->meStyle = eStyle;
+ mpImplGradient->maStartColor = rStartColor;
+ mpImplGradient->maEndColor = rEndColor;
+}
+
+// -----------------------------------------------------------------------
+
+Gradient::~Gradient()
+{
+ DBG_DTOR( Gradient, NULL );
+
+ // Wenn es die letzte Referenz ist, loeschen,
+ // sonst Referenzcounter decrementieren
+ if ( mpImplGradient->mnRefCount == 1 )
+ delete mpImplGradient;
+ else
+ mpImplGradient->mnRefCount--;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetStyle( GradientStyle eStyle )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->meStyle = eStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetStartColor( const Color& rColor )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->maStartColor = rColor;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetEndColor( const Color& rColor )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->maEndColor = rColor;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetAngle( USHORT nAngle )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->mnAngle = nAngle;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetBorder( USHORT nBorder )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->mnBorder = nBorder;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetOfsX( USHORT nOfsX )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->mnOfsX = nOfsX;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetOfsY( USHORT nOfsY )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->mnOfsY = nOfsY;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetStartIntensity( USHORT nIntens )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->mnIntensityStart = nIntens;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetEndIntensity( USHORT nIntens )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->mnIntensityEnd = nIntens;
+}
+
+// -----------------------------------------------------------------------
+
+void Gradient::SetSteps( USHORT nSteps )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+
+ MakeUnique();
+ mpImplGradient->mnStepCount = nSteps;
+}
+
+// -----------------------------------------------------------------------
+
+Gradient& Gradient::operator=( const Gradient& rGradient )
+{
+ DBG_CHKTHIS( Gradient, NULL );
+ DBG_CHKOBJ( &rGradient, Gradient, NULL );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rGradient.mpImplGradient->mnRefCount++;
+
+ // Wenn es die letzte Referenz ist, loeschen,
+ // sonst Referenzcounter decrementieren
+ if ( mpImplGradient->mnRefCount == 1 )
+ delete mpImplGradient;
+ else
+ mpImplGradient->mnRefCount--;
+ mpImplGradient = rGradient.mpImplGradient;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Gradient::operator==( const Gradient& rGradient ) const
+{
+ DBG_CHKTHIS( Gradient, NULL );
+ DBG_CHKOBJ( &rGradient, Gradient, NULL );
+
+ if ( mpImplGradient == rGradient.mpImplGradient )
+ return TRUE;
+
+ if ( (mpImplGradient->meStyle == rGradient.mpImplGradient->meStyle) ||
+ (mpImplGradient->mnAngle == rGradient.mpImplGradient->mnAngle) ||
+ (mpImplGradient->mnBorder == rGradient.mpImplGradient->mnBorder) ||
+ (mpImplGradient->mnOfsX == rGradient.mpImplGradient->mnOfsX) ||
+ (mpImplGradient->mnOfsY == rGradient.mpImplGradient->mnOfsY) ||
+ (mpImplGradient->mnStepCount == rGradient.mpImplGradient->mnStepCount) ||
+ (mpImplGradient->mnIntensityStart == rGradient.mpImplGradient->mnIntensityStart) ||
+ (mpImplGradient->mnIntensityEnd == rGradient.mpImplGradient->mnIntensityEnd) ||
+ (mpImplGradient->maStartColor == rGradient.mpImplGradient->maStartColor) ||
+ (mpImplGradient->maEndColor == rGradient.mpImplGradient->maEndColor) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+SvStream& operator>>( SvStream& rIStm, Impl_Gradient& rImpl_Gradient )
+{
+ VersionCompat aCompat( rIStm, STREAM_READ );
+ UINT16 nTmp16;
+
+ rIStm >> nTmp16; rImpl_Gradient.meStyle = (GradientStyle) nTmp16;
+
+ rIStm >> rImpl_Gradient.maStartColor >>
+ rImpl_Gradient.maEndColor >>
+ rImpl_Gradient.mnAngle >>
+ rImpl_Gradient.mnBorder >>
+ rImpl_Gradient.mnOfsX >>
+ rImpl_Gradient.mnOfsY >>
+ rImpl_Gradient.mnIntensityStart >>
+ rImpl_Gradient.mnIntensityEnd >>
+ rImpl_Gradient.mnStepCount;
+
+ return rIStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Impl_Gradient& rImpl_Gradient )
+{
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
+
+ rOStm << (UINT16) rImpl_Gradient.meStyle <<
+ rImpl_Gradient.maStartColor <<
+ rImpl_Gradient.maEndColor <<
+ rImpl_Gradient.mnAngle <<
+ rImpl_Gradient.mnBorder <<
+ rImpl_Gradient.mnOfsX <<
+ rImpl_Gradient.mnOfsY <<
+ rImpl_Gradient.mnIntensityStart <<
+ rImpl_Gradient.mnIntensityEnd <<
+ rImpl_Gradient.mnStepCount;
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, Gradient& rGradient )
+{
+ rGradient.MakeUnique();
+ return( rIStm >> *rGradient.mpImplGradient );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient )
+{
+ return( rOStm << *rGradient.mpImplGradient );
+}
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
new file mode 100644
index 000000000000..3c847d7dd916
--- /dev/null
+++ b/vcl/source/gdi/graph.cxx
@@ -0,0 +1,832 @@
+/*************************************************************************
+ *
+ * $RCSfile: graph.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_GRAPH_CXX
+
+#ifndef _SV_CLIP_HXX
+#include <clip.hxx>
+#endif
+#ifndef _SV_IMPGRAPH_HXX
+#include <impgraph.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_CLIP_HXX
+#include <clip.hxx>
+#endif
+#ifndef _SV_DRAG_HXX
+#include <drag.hxx>
+#endif
+#include <graph.hxx>
+
+// -----------------------
+// - Compression defines -
+// -----------------------
+
+#define COMPRESS_OWN ('S'|('D'<<8UL))
+#define COMPRESS_NONE ( 0UL )
+#define RLE_8 ( 1UL )
+#define RLE_4 ( 2UL )
+#define BITFIELDS ( 3UL )
+#define ZCOMPRESS ( COMPRESS_OWN | 0x01000000UL ) /* == 'SD01' (binary) */
+
+// -----------------------
+// - Default-Drawmethode -
+// -----------------------
+
+static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText,
+ Font* pFont, const Bitmap* pBitmap,
+ const Point& rDestPt, const Size& rDestSize )
+{
+ USHORT nPixel = (USHORT) pOutDev->PixelToLogic( Size( 1, 1 ) ).Width();
+ USHORT nWidth = nPixel;
+ Point aPoint( rDestPt.X() + nWidth, rDestPt.Y() + nWidth );
+ Size aSize( rDestSize.Width() - ( nWidth << 1 ), rDestSize.Height() - ( nWidth << 1 ) );
+ BOOL bFilled = ( pBitmap != NULL || pFont != NULL );
+ Rectangle aBorderRect( aPoint, aSize );
+
+ pOutDev->Push();
+
+ pOutDev->SetFillColor();
+
+ // Auf dem Drucker ein schwarzes Rechteck und auf dem Bildschirm eins mit 3D-Effekt
+ if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
+ pOutDev->SetLineColor( COL_BLACK );
+ else
+ {
+ aBorderRect.Left() += nPixel;
+ aBorderRect.Top() += nPixel;
+
+ pOutDev->SetLineColor( COL_LIGHTGRAY );
+ pOutDev->DrawRect( aBorderRect );
+
+ aBorderRect.Left() -= nPixel;
+ aBorderRect.Top() -= nPixel;
+ aBorderRect.Right() -= nPixel;
+ aBorderRect.Bottom() -= nPixel;
+ pOutDev->SetLineColor( COL_GRAY );
+ }
+
+ pOutDev->DrawRect( aBorderRect );
+
+ aPoint.X() += nWidth + 2*nPixel;
+ aPoint.Y() += nWidth + 2*nPixel;
+ aSize.Width() -= 2*nWidth + 4*nPixel;
+ aSize.Height() -= 2*nWidth + 4*nPixel;
+
+ if( aSize.Width() > 0 && aSize.Height() > 0 && pBitmap && !!*pBitmap )
+ {
+ Size aBitmapSize( pOutDev->PixelToLogic(pBitmap->GetSizePixel() ) );
+
+ if( aSize.Height() > aBitmapSize.Height() && aSize.Width() > aBitmapSize.Width() )
+ {
+ pOutDev->DrawBitmap( aPoint, *pBitmap );
+ aPoint.X() += aBitmapSize.Width() + 2*nPixel;
+ aSize.Width() -= aBitmapSize.Width() + 2*nPixel;
+ }
+ }
+
+ if ( aSize.Width() > 0 && aSize.Height() > 0 && pFont && pText && pText->Len()
+ && !(!pOutDev->IsOutputEnabled() /*&& pOutDev->GetConnectMetaFile() */) )
+ {
+ MapMode aMapMode( MAP_POINT );
+ Size aSz = pOutDev->LogicToLogic( Size( 0, 12 ), &aMapMode, NULL );
+ long nThreshold = aSz.Height() / 2;
+ long nStep = nThreshold / 3;
+
+ if ( !nStep )
+ nStep = aSz.Height() - nThreshold;
+
+ for(;; aSz.Height() -= nStep )
+ {
+ pFont->SetSize( aSz );
+ pOutDev->SetFont( *pFont );
+
+ long nTextHeight = pOutDev->GetTextHeight();
+ long nTextWidth = pOutDev->GetTextWidth( *pText );
+ if ( nTextHeight )
+ {
+ // Die N"aherung ber"ucksichtigt keine Ungenauigkeiten durch
+ // Wortumbr"uche
+ long nLines = aSize.Height() / nTextHeight;
+ long nWidth = aSize.Width() * nLines; // N"aherung!!!
+
+ if ( nTextWidth <= nWidth || aSz.Height() <= nThreshold )
+ {
+ USHORT nStart = 0;
+ USHORT nLen = 0;
+
+ while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' )
+ nStart++;
+ while( nStart+nLen < pText->Len() && pText->GetChar( nStart+nLen ) != ' ' )
+ nLen++;
+ while( nStart < pText->Len() && nLines-- )
+ {
+ USHORT nNext = nLen;
+ do
+ {
+ while ( nStart+nNext < pText->Len() && pText->GetChar( nStart+nNext ) == ' ' )
+ nNext++;
+ while ( nStart+nNext < pText->Len() && pText->GetChar( nStart+nNext ) != ' ' )
+ nNext++;
+ nTextWidth = pOutDev->GetTextWidth( *pText, nStart, nNext );
+ if ( nTextWidth > aSize.Width() )
+ break;
+ nLen = nNext;
+ }
+ while ( nStart+nNext < pText->Len() );
+
+ USHORT n = nLen;
+ nTextWidth = pOutDev->GetTextWidth( *pText, nStart, n );
+ while( nTextWidth > aSize.Width() )
+ nTextWidth = pOutDev->GetTextWidth( *pText, nStart, --n );
+ pOutDev->DrawText( aPoint, *pText, nStart, n );
+
+ aPoint.Y() += nTextHeight;
+ nStart += nLen;
+ nLen = nNext-nLen;
+ while( nStart < pText->Len() && pText->GetChar( nStart ) == ' ' )
+ {
+ nStart++;
+ nLen--;
+ }
+ }
+ break;
+ }
+ }
+ else
+ break;
+ }
+ }
+
+ // Falls die Default-Graphik keinen Inhalt hat,
+ // malen wir ein rotes Kreuz
+ if( !bFilled )
+ {
+ aBorderRect.Left()++;
+ aBorderRect.Top()++;
+ aBorderRect.Right()--;
+ aBorderRect.Bottom()--;
+
+ pOutDev->SetLineColor( COL_LIGHTRED );
+ pOutDev->DrawLine( aBorderRect.TopLeft(), aBorderRect.BottomRight() );
+ pOutDev->DrawLine( aBorderRect.TopRight(), aBorderRect.BottomLeft() );
+ }
+
+ pOutDev->Pop();
+}
+
+// -----------
+// - Graphic -
+// -----------
+
+TYPEINIT1_AUTOFACTORY( Graphic, SvDataCopyStream );
+
+// ------------------------------------------------------------------------
+
+Graphic::Graphic()
+{
+ mpImpGraphic = new ImpGraphic;
+}
+
+// ------------------------------------------------------------------------
+
+Graphic::Graphic( const Graphic& rGraphic )
+{
+ if( rGraphic.IsAnimated() )
+ mpImpGraphic = new ImpGraphic( *rGraphic.mpImpGraphic );
+ else
+ {
+ mpImpGraphic = rGraphic.mpImpGraphic;
+ mpImpGraphic->mnRefCount++;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+Graphic::Graphic( const Bitmap& rBmp )
+{
+ mpImpGraphic = new ImpGraphic( rBmp );
+}
+
+// ------------------------------------------------------------------------
+
+Graphic::Graphic( const BitmapEx& rBmpEx )
+{
+ mpImpGraphic = new ImpGraphic( rBmpEx );
+}
+
+// ------------------------------------------------------------------------
+
+Graphic::Graphic( const Animation& rAnimation )
+{
+ mpImpGraphic = new ImpGraphic( rAnimation );
+}
+
+// ------------------------------------------------------------------------
+
+Graphic::Graphic( const GDIMetaFile& rMtf )
+{
+ mpImpGraphic = new ImpGraphic( rMtf );
+}
+
+// ------------------------------------------------------------------------
+
+Graphic::~Graphic()
+{
+ if( mpImpGraphic->mnRefCount == 1UL )
+ delete mpImpGraphic;
+ else
+ mpImpGraphic->mnRefCount--;
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::ImplTestRefCount()
+{
+ if( mpImpGraphic->mnRefCount > 1UL )
+ {
+ mpImpGraphic->mnRefCount--;
+ mpImpGraphic = new ImpGraphic( *mpImpGraphic );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+Graphic& Graphic::operator=( const Graphic& rGraphic )
+{
+ if( &rGraphic != this )
+ {
+ if( rGraphic.IsAnimated() )
+ {
+ if( mpImpGraphic->mnRefCount == 1UL )
+ delete mpImpGraphic;
+ else
+ mpImpGraphic->mnRefCount--;
+
+ mpImpGraphic = new ImpGraphic( *rGraphic.mpImpGraphic );
+ }
+ else
+ {
+ rGraphic.mpImpGraphic->mnRefCount++;
+
+ if( mpImpGraphic->mnRefCount == 1UL )
+ delete mpImpGraphic;
+ else
+ mpImpGraphic->mnRefCount--;
+
+ mpImpGraphic = rGraphic.mpImpGraphic;
+ }
+ }
+
+ return *this;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::operator==( const Graphic& rGraphic ) const
+{
+ return( *mpImpGraphic == *rGraphic.mpImpGraphic );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::operator!=( const Graphic& rGraphic ) const
+{
+ return( *mpImpGraphic != *rGraphic.mpImpGraphic );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::operator!() const
+{
+ return( GRAPHIC_NONE == mpImpGraphic->ImplGetType() );
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::Load( SvStream& rIStm )
+{
+ rIStm >> *this;
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::Save( SvStream& rOStm )
+{
+ rOStm << *this;
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::Assign( const SvDataCopyStream& rCopyStream )
+{
+ *this = (const Graphic& ) rCopyStream;
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::Clear()
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplClear();
+}
+
+// ------------------------------------------------------------------------
+
+GraphicType Graphic::GetType() const
+{
+ return mpImpGraphic->ImplGetType();
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::SetDefaultType()
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplSetDefaultType();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::IsSupportedGraphic() const
+{
+ return mpImpGraphic->ImplIsSupportedGraphic();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::IsTransparent() const
+{
+ return mpImpGraphic->ImplIsTransparent();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::IsAlpha() const
+{
+ return mpImpGraphic->ImplIsAlpha();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::IsAnimated() const
+{
+ return mpImpGraphic->ImplIsAnimated();
+}
+
+// ------------------------------------------------------------------------
+
+Bitmap Graphic::GetBitmap() const
+{
+ return mpImpGraphic->ImplGetBitmap();
+}
+
+// ------------------------------------------------------------------------
+
+BitmapEx Graphic::GetBitmapEx() const
+{
+ return mpImpGraphic->ImplGetBitmapEx();
+}
+
+// ------------------------------------------------------------------------
+
+Animation Graphic::GetAnimation() const
+{
+ return mpImpGraphic->ImplGetAnimation();
+}
+
+// ------------------------------------------------------------------------
+
+const GDIMetaFile& Graphic::GetGDIMetaFile() const
+{
+ return mpImpGraphic->ImplGetGDIMetaFile();
+}
+
+// ------------------------------------------------------------------------
+
+Size Graphic::GetPrefSize() const
+{
+ return mpImpGraphic->ImplGetPrefSize();
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::SetPrefSize( const Size& rPrefSize )
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplSetPrefSize( rPrefSize );
+}
+
+// ------------------------------------------------------------------------
+
+MapMode Graphic::GetPrefMapMode() const
+{
+ return mpImpGraphic->ImplGetPrefMapMode();
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::SetPrefMapMode( const MapMode& rPrefMapMode )
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplSetPrefMapMode( rPrefMapMode );
+}
+
+// ------------------------------------------------------------------
+
+ULONG Graphic::GetSizeBytes() const
+{
+ return mpImpGraphic->ImplGetSizeBytes();
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::Draw( OutputDevice* pOutDev, const Point& rDestPt ) const
+{
+ mpImpGraphic->ImplDraw( pOutDev, rDestPt );
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::Draw( OutputDevice* pOutDev,
+ const Point& rDestPt, const Size& rDestSz ) const
+{
+ if( GRAPHIC_DEFAULT == mpImpGraphic->ImplGetType() )
+ ImplDrawDefault( pOutDev, NULL, NULL, NULL, rDestPt, rDestSz );
+ else
+ mpImpGraphic->ImplDraw( pOutDev, rDestPt, rDestSz );
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::Draw( OutputDevice* pOutDev, const String& rText,
+ Font& rFont, const Bitmap& rBitmap,
+ const Point& rDestPt, const Size& rDestSz )
+{
+ ImplDrawDefault( pOutDev, &rText, &rFont, &rBitmap, rDestPt, rDestSz );
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::StartAnimation( OutputDevice* pOutDev, const Point& rDestPt, long nExtraData,
+ OutputDevice* pFirstFrameOutDev )
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplStartAnimation( pOutDev, rDestPt, nExtraData, pFirstFrameOutDev );
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::StartAnimation( OutputDevice* pOutDev, const Point& rDestPt,
+ const Size& rDestSz, long nExtraData,
+ OutputDevice* pFirstFrameOutDev )
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplStartAnimation( pOutDev, rDestPt, rDestSz, nExtraData, pFirstFrameOutDev );
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::StopAnimation( OutputDevice* pOutDev, long nExtraData )
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplStopAnimation( pOutDev, nExtraData );
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::SetAnimationNotifyHdl( const Link& rLink )
+{
+ mpImpGraphic->ImplSetAnimationNotifyHdl( rLink );
+}
+
+// ------------------------------------------------------------------------
+
+Link Graphic::GetAnimationNotifyHdl() const
+{
+ return mpImpGraphic->ImplGetAnimationNotifyHdl();
+}
+
+// ------------------------------------------------------------------------
+
+ULONG Graphic::GetAnimationLoopCount() const
+{
+ return mpImpGraphic->ImplGetAnimationLoopCount();
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::ResetAnimationLoopCount()
+{
+ mpImpGraphic->ImplResetAnimationLoopCount();
+}
+
+// ------------------------------------------------------------------------
+
+List* Graphic::GetAnimationInfoList() const
+{
+ return mpImpGraphic->ImplGetAnimationInfoList();
+}
+
+// ------------------------------------------------------------------------
+
+GraphicReader* Graphic::GetContext()
+{
+ return mpImpGraphic->ImplGetContext();
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::SetContext( GraphicReader* pReader )
+{
+ mpImpGraphic->ImplSetContext( pReader );
+}
+
+// ------------------------------------------------------------------------
+
+USHORT Graphic::GetGraphicsCompressMode( SvStream& rIStm )
+{
+ const ULONG nPos = rIStm.Tell();
+ const USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ UINT32 nTmp32;
+ UINT16 nTmp16;
+ USHORT nCompressMode = COMPRESSMODE_NONE;
+
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ rIStm >> nTmp32;
+
+ // is it a swapped graphic with a bitmap?
+ rIStm.SeekRel( (nTmp32 == (UINT32) GRAPHIC_BITMAP ) ? 40 : -4 );
+
+ // try to read bitmap id
+ rIStm >> nTmp16;
+
+ // check id of BitmapFileHeader
+ if( 0x4D42 == nTmp16 )
+ {
+ // seek to compress field of BitmapInfoHeader
+ rIStm.SeekRel( 28 );
+ rIStm >> nTmp32;
+
+ // Compare with our own compressmode
+ if( ZCOMPRESS == nTmp32 )
+ nCompressMode = COMPRESSMODE_ZBITMAP;
+ }
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+ rIStm.Seek( nPos );
+
+ return nCompressMode;
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::SetDocFileName( const String& rName, ULONG nFilePos )
+{
+ mpImpGraphic->ImplSetDocFileName( rName, nFilePos );
+}
+
+// ------------------------------------------------------------------------
+
+const String& Graphic::GetDocFileName() const
+{
+ return mpImpGraphic->ImplGetDocFileName();
+}
+
+// ------------------------------------------------------------------------
+
+ULONG Graphic::GetDocFilePos() const
+{
+ return mpImpGraphic->ImplGetDocFilePos();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::ReadEmbedded( SvStream& rIStream, BOOL bSwap )
+{
+ ImplTestRefCount();
+ return mpImpGraphic->ImplReadEmbedded( rIStream, bSwap );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::WriteEmbedded( SvStream& rOStream )
+{
+ ImplTestRefCount();
+ return mpImpGraphic->ImplWriteEmbedded( rOStream );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::SwapOut()
+{
+ ImplTestRefCount();
+ return mpImpGraphic->ImplSwapOut();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::SwapOut( SvStream* pOStream )
+{
+ ImplTestRefCount();
+ return mpImpGraphic->ImplSwapOut( pOStream );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::SwapIn()
+{
+ ImplTestRefCount();
+ return mpImpGraphic->ImplSwapIn();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::SwapIn( SvStream* pStrm )
+{
+ ImplTestRefCount();
+ return mpImpGraphic->ImplSwapIn( pStrm );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::IsSwapOut() const
+{
+ return mpImpGraphic->ImplIsSwapOut();
+}
+
+// ------------------------------------------------------------------------
+
+void Graphic::SetLink( const GfxLink& rGfxLink )
+{
+ ImplTestRefCount();
+ mpImpGraphic->ImplSetLink( rGfxLink );
+}
+
+// ------------------------------------------------------------------------
+
+GfxLink Graphic::GetLink()
+{
+ return mpImpGraphic->ImplGetLink();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::IsLink() const
+{
+ return mpImpGraphic->ImplIsLink();
+}
+
+// ------------------------------------------------------------------------
+
+ULONG Graphic::GetChecksum() const
+{
+ return mpImpGraphic->ImplGetChecksum();
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, Graphic& rGraphic )
+{
+ rGraphic.ImplTestRefCount();
+ return rIStream >> *rGraphic.mpImpGraphic;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic )
+{
+ return rOStream << *rGraphic.mpImpGraphic;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG Graphic::RegisterClipboardFormatName()
+{
+ static ULONG nFormat = 0;
+
+ if ( !nFormat )
+ nFormat = Clipboard::RegisterFormatName( XubString( RTL_CONSTASCII_USTRINGPARAM( "SVXB (StarView Bitmap/Animation)" ) ) );
+
+ return nFormat;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::ClipboardHasFormat()
+{
+ return Clipboard::HasFormat( RegisterClipboardFormatName() )
+ || Clipboard::HasFormat( FORMAT_GDIMETAFILE )
+ || Clipboard::HasFormat( FORMAT_BITMAP );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::DragServerHasFormat( USHORT nItem )
+{
+ return DragServer::HasFormat( nItem, RegisterClipboardFormatName() )
+ || DragServer::HasFormat( nItem, FORMAT_GDIMETAFILE )
+ || DragServer::HasFormat( nItem, FORMAT_BITMAP );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::Copy() const
+{
+ SotDataMemberObjectRef aDataObject = new SotDataMemberObject;
+ SvData* pData = new SvData( RegisterClipboardFormatName() );
+
+ pData->SetData( (SvDataCopyStream*) this, TRANSFER_COPY );
+ aDataObject->Append( pData );
+ VclClipboard::Copy( aDataObject );
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Graphic::Paste()
+{
+ const ULONG nFormat = RegisterClipboardFormatName();
+ BOOL bRet = FALSE;
+
+ if( VclClipboard::HasFormat( nFormat ) )
+ {
+ SotDataObjectRef aDataObject = VclClipboard::Paste();
+ SvData aData( nFormat );
+
+ if( aDataObject.Is() && aDataObject->GetData( &aData ) )
+ {
+ Graphic* pGraphic = NULL;
+
+ if( aData.GetData( (SvDataCopyStream**) &pGraphic, StaticType(), TRANSFER_MOVE ) )
+ *this = *pGraphic;
+
+ delete pGraphic;
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx
new file mode 100644
index 000000000000..ac66e89fd0cf
--- /dev/null
+++ b/vcl/source/gdi/hatch.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * $RCSfile: hatch.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_HATCH_CXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_HATCX_HXX
+#include <hatch.hxx>
+#endif
+
+DBG_NAME( Hatch );
+
+// --------------
+// - ImplHatch -
+// --------------
+
+ImplHatch::ImplHatch() :
+ mnRefCount ( 1 ),
+ maColor ( COL_BLACK ),
+ meStyle ( HATCH_SINGLE ),
+ mnDistance ( 1 ),
+ mnAngle ( 0 )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImplHatch::ImplHatch( const ImplHatch& rImplHatch ) :
+ mnRefCount ( 1 ),
+ maColor ( rImplHatch.maColor ),
+ meStyle ( rImplHatch.meStyle ),
+ mnDistance ( rImplHatch.mnDistance ),
+ mnAngle ( rImplHatch.mnAngle )
+{
+}
+
+// ---------
+// - Hatch -
+// ---------
+
+Hatch::Hatch()
+{
+ DBG_CTOR( Hatch, NULL );
+ mpImplHatch = new ImplHatch;
+}
+
+// -----------------------------------------------------------------------
+
+Hatch::Hatch( const Hatch& rHatch )
+{
+ DBG_CTOR( Hatch, NULL );
+ DBG_CHKOBJ( &rHatch, Hatch, NULL );
+ mpImplHatch = rHatch.mpImplHatch;
+ mpImplHatch->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+Hatch::Hatch( HatchStyle eStyle, const Color& rColor,
+ long nDistance, USHORT nAngle10 )
+{
+ DBG_CTOR( Hatch, NULL );
+ mpImplHatch = new ImplHatch;
+ mpImplHatch->maColor = rColor;
+ mpImplHatch->meStyle = eStyle;
+ mpImplHatch->mnDistance = nDistance;
+ mpImplHatch->mnAngle = nAngle10;
+}
+
+// -----------------------------------------------------------------------
+
+Hatch::~Hatch()
+{
+ DBG_DTOR( Hatch, NULL );
+ if( !( --mpImplHatch->mnRefCount ) )
+ delete mpImplHatch;
+}
+
+// -----------------------------------------------------------------------
+
+Hatch& Hatch::operator=( const Hatch& rHatch )
+{
+ DBG_CHKTHIS( Hatch, NULL );
+ DBG_CHKOBJ( &rHatch, Hatch, NULL );
+
+ rHatch.mpImplHatch->mnRefCount++;
+
+ if( !( --mpImplHatch->mnRefCount ) )
+ delete mpImplHatch;
+
+ mpImplHatch = rHatch.mpImplHatch;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Hatch::operator==( const Hatch& rHatch ) const
+{
+ DBG_CHKTHIS( Hatch, NULL );
+ DBG_CHKOBJ( &rHatch, Hatch, NULL );
+
+ return( mpImplHatch == rHatch.mpImplHatch ||
+ ( mpImplHatch->maColor == rHatch.mpImplHatch->maColor &&
+ mpImplHatch->meStyle == rHatch.mpImplHatch->meStyle &&
+ mpImplHatch->mnDistance == rHatch.mpImplHatch->mnDistance &&
+ mpImplHatch->mnAngle == rHatch.mpImplHatch->mnAngle ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Hatch::ImplMakeUnique()
+{
+ if( mpImplHatch->mnRefCount != 1 )
+ {
+ if( mpImplHatch->mnRefCount )
+ mpImplHatch->mnRefCount--;
+
+ mpImplHatch = new ImplHatch( *mpImplHatch );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Hatch::SetStyle( HatchStyle eStyle )
+{
+ DBG_CHKTHIS( Hatch, NULL );
+ ImplMakeUnique();
+ mpImplHatch->meStyle = eStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void Hatch::SetColor( const Color& rColor )
+{
+ DBG_CHKTHIS( Hatch, NULL );
+ ImplMakeUnique();
+ mpImplHatch->maColor = rColor;
+}
+
+// -----------------------------------------------------------------------
+
+void Hatch::SetDistance( long nDistance )
+{
+ DBG_CHKTHIS( Hatch, NULL );
+ ImplMakeUnique();
+ mpImplHatch->mnDistance = nDistance;
+}
+
+// -----------------------------------------------------------------------
+
+void Hatch::SetAngle( USHORT nAngle10 )
+{
+ DBG_CHKTHIS( Hatch, NULL );
+ ImplMakeUnique();
+ mpImplHatch->mnAngle = nAngle10;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, ImplHatch& rImplHatch )
+{
+ VersionCompat aCompat( rIStm, STREAM_READ );
+ UINT16 nTmp16;
+
+ rIStm >> nTmp16; rImplHatch.meStyle = (HatchStyle) nTmp16;
+ rIStm >> rImplHatch.maColor >> rImplHatch.mnDistance >> rImplHatch.mnAngle;
+
+ return rIStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const ImplHatch& rImplHatch )
+{
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
+
+ rOStm << (UINT16) rImplHatch.meStyle << rImplHatch.maColor;
+ rOStm << rImplHatch.mnDistance << rImplHatch.mnAngle;
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, Hatch& rHatch )
+{
+ rHatch.ImplMakeUnique();
+ return( rIStm >> *rHatch.mpImplHatch );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Hatch& rHatch )
+{
+ return( rOStm << *rHatch.mpImplHatch );
+}
diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx
new file mode 100644
index 000000000000..16188cdc5143
--- /dev/null
+++ b/vcl/source/gdi/image.cxx
@@ -0,0 +1,1521 @@
+/*************************************************************************
+ *
+ * $RCSfile: image.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#define _SV_IMAGE_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_RC_HXX
+#include <rc.hxx>
+#endif
+#ifndef _SV_RESMGR_HXX
+#include <resmgr.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_IMAGE_H
+#include <image.h>
+#endif
+#define private public
+#ifndef _SV_IMAGE_HXX
+#include <image.hxx>
+#endif
+#undef private
+
+// =======================================================================
+
+DBG_NAME( Image );
+DBG_NAME( ImageList );
+
+#define IMAGE_FILE_VERSION 100
+
+// =======================================================================
+
+ImplImageList::~ImplImageList()
+{
+ if ( mpImageBitmap )
+ delete mpImageBitmap;
+ delete mpAry;
+}
+
+// =======================================================================
+
+ImplImageRefData::~ImplImageRefData()
+{
+ mpImplData->mnIRefCount--;
+ if ( mpImplData->mnRefCount || mpImplData->mnIRefCount )
+ {
+ mpImplData->mpAry[mnIndex].mnRefCount--;
+ if ( !mpImplData->mpAry[mnIndex].mnRefCount )
+ mpImplData->mnRealCount--;
+ }
+ else
+ delete mpImplData;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplImageRefData::IsEqual( const ImplImageRefData& rData )
+{
+ if ( (mpImplData == rData.mpImplData) && (mnIndex == rData.mnIndex) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// =======================================================================
+
+ImplImageData::ImplImageData( const Bitmap& rBmp, const Bitmap& rMaskBmp ) :
+ maBmp( rBmp ),
+ maMaskBmp( rMaskBmp )
+{
+ mbColor = FALSE;
+ mpImageBitmap = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplImageData::ImplImageData( const Bitmap& rBmp, const Color& rColor ) :
+ maBmp( rBmp ),
+ maColor( rColor )
+{
+ mbColor = TRUE;
+ mpImageBitmap = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplImageData::~ImplImageData()
+{
+ if ( mpImageBitmap )
+ delete mpImageBitmap;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplImageData::IsEqual( const ImplImageData& rData )
+{
+ if ( (maBmp == rData.maBmp) && (maMaskBmp == rData.maMaskBmp) &&
+ (maColor == rData.maColor) && (mbColor == rData.mbColor) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// =======================================================================
+
+ImplImage::~ImplImage()
+{
+ switch ( meType )
+ {
+ case IMAGETYPE_BITMAP:
+ delete (Bitmap*)mpData;
+ break;
+
+ case IMAGETYPE_IMAGE:
+ delete (ImplImageData*)mpData;
+ break;
+
+ case IMAGETYPE_IMAGEREF:
+ delete (ImplImageRefData*)mpData;
+ break;
+ }
+}
+
+// =======================================================================
+
+Image::Image()
+{
+ DBG_CTOR( Image, NULL );
+
+ mpImplData = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+Image::Image( const ResId& rResId )
+{
+ DBG_CTOR( Image, NULL );
+
+ rResId.SetRT( RSC_IMAGE );
+ ResMgr* pResMgr = rResId.GetResMgr();
+ if ( !pResMgr )
+ pResMgr = Resource::GetResManager();
+
+ if ( pResMgr->GetResource( rResId ) )
+ {
+ // Header ueberspringen
+ pResMgr->Increment( sizeof( RSHEADER_TYPE ) );
+
+ USHORT nObjMask = pResMgr->ReadShort();
+
+ Bitmap aImageBitmap;
+ Bitmap aMaskBitmap;
+ Color aMaskColor;
+ if( nObjMask & RSC_IMAGE_IMAGEBITMAP )
+ {
+ aImageBitmap = Bitmap( ResId( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ }
+ if( nObjMask & RSC_IMAGE_MASKBITMAP )
+ {
+ aMaskBitmap = Bitmap( ResId( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ }
+ if( nObjMask & RSC_IMAGE_MASKCOLOR )
+ {
+ aMaskColor = Color( ResId( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ }
+
+ if ( !aImageBitmap )
+ mpImplData = NULL;
+ else
+ {
+ mpImplData = new ImplImage;
+ mpImplData->mnRefCount = 1;
+ if ( !aMaskBitmap )
+ {
+ if( nObjMask & RSC_IMAGE_MASKCOLOR )
+ {
+ mpImplData->meType = IMAGETYPE_IMAGE;
+ mpImplData->mpData = new ImplImageData( aImageBitmap, aMaskColor );
+ }
+ else
+ {
+ mpImplData->meType = IMAGETYPE_BITMAP;
+ mpImplData->mpData = new Bitmap( aImageBitmap );
+ }
+ }
+ else
+ {
+ mpImplData->meType = IMAGETYPE_IMAGE;
+ mpImplData->mpData = new ImplImageData( aImageBitmap, aMaskBitmap );
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR( "Image::Image( const ResId& rResId ): No resource!" );
+ mpImplData = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image::Image( const Image& rImage )
+{
+ DBG_CTOR( Image, NULL );
+
+ mpImplData = rImage.mpImplData;
+ if ( mpImplData )
+ mpImplData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+Image::Image( const Bitmap& rBitmap )
+{
+ DBG_CTOR( Image, NULL );
+
+ if ( !rBitmap )
+ mpImplData = NULL;
+ else
+ {
+ mpImplData = new ImplImage;
+ mpImplData->mnRefCount = 1;
+ mpImplData->meType = IMAGETYPE_BITMAP;
+ mpImplData->mpData = new Bitmap( rBitmap );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image::Image( const Bitmap& rBitmap, const Bitmap& rMaskBitmap )
+{
+ DBG_CTOR( Image, NULL );
+
+ if ( !rBitmap )
+ mpImplData = NULL;
+ else
+ {
+ mpImplData = new ImplImage;
+ mpImplData->mnRefCount = 1;
+ if ( !rMaskBitmap )
+ {
+ mpImplData->meType = IMAGETYPE_BITMAP;
+ mpImplData->mpData = new Bitmap( rBitmap );
+ }
+ else
+ {
+ mpImplData->meType = IMAGETYPE_IMAGE;
+ mpImplData->mpData = new ImplImageData( rBitmap, rMaskBitmap );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image::Image( const Bitmap& rBitmap, const Color& rColor )
+{
+ DBG_CTOR( Image, NULL );
+
+ if ( !rBitmap )
+ mpImplData = NULL;
+ else
+ {
+ mpImplData = new ImplImage;
+ mpImplData->mnRefCount = 1;
+ mpImplData->meType = IMAGETYPE_IMAGE;
+ mpImplData->mpData = new ImplImageData( rBitmap, rColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image::Image( const BitmapEx& rBitmapEx )
+{
+ DBG_CTOR( Image, NULL );
+
+ const Bitmap aBmp( rBitmapEx.GetBitmap() );
+
+ if( !aBmp )
+ mpImplData = NULL;
+ else
+ {
+ const Bitmap aMask( rBitmapEx.GetMask() );
+
+ mpImplData = new ImplImage;
+ mpImplData->mnRefCount = 1;
+
+ if( !aMask )
+ {
+ mpImplData->meType = IMAGETYPE_BITMAP;
+ mpImplData->mpData = new Bitmap( aBmp );
+ }
+ else
+ {
+ mpImplData->meType = IMAGETYPE_IMAGE;
+ mpImplData->mpData = new ImplImageData( aBmp, aMask );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image::~Image()
+{
+ DBG_DTOR( Image, NULL );
+
+ if ( mpImplData )
+ {
+ if ( mpImplData->mnRefCount > 1 )
+ mpImplData->mnRefCount--;
+ else
+ delete mpImplData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size Image::GetSizePixel() const
+{
+ DBG_CHKTHIS( Image, NULL );
+
+ if ( mpImplData )
+ {
+ switch ( mpImplData->meType )
+ {
+ case IMAGETYPE_BITMAP:
+ return ((Bitmap*)mpImplData->mpData)->GetSizePixel();
+
+ case IMAGETYPE_IMAGE:
+ return ((ImplImageData*)mpImplData->mpData)->maBmp.GetSizePixel();
+
+ case IMAGETYPE_IMAGEREF:
+ return ((ImplImageRefData*)mpImplData->mpData)->mpImplData->maImageSize;
+ }
+ }
+
+ return Size();
+}
+
+// -----------------------------------------------------------------------
+
+Image& Image::operator=( const Image& rImage )
+{
+ DBG_CHKTHIS( Image, NULL );
+ DBG_CHKOBJ( &rImage, Image, NULL );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ if ( rImage.mpImplData )
+ rImage.mpImplData->mnRefCount++;
+
+ // Abkoppeln
+ if ( mpImplData )
+ {
+ if ( mpImplData->mnRefCount > 1 )
+ mpImplData->mnRefCount--;
+ else
+ delete mpImplData;
+ }
+
+ // Neue Daten zuweisen
+ mpImplData = rImage.mpImplData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Image::operator==( const Image& rImage ) const
+{
+ DBG_CHKTHIS( Image, NULL );
+ DBG_CHKOBJ( &rImage, Image, NULL );
+
+ if ( rImage.mpImplData == mpImplData )
+ return TRUE;
+ if ( !rImage.mpImplData || !mpImplData )
+ return FALSE;
+
+ if ( rImage.mpImplData->mpData == mpImplData->mpData )
+ return TRUE;
+
+ if ( rImage.mpImplData->meType == mpImplData->meType )
+ {
+ switch ( mpImplData->meType )
+ {
+ case IMAGETYPE_BITMAP:
+ if ( *((Bitmap*)rImage.mpImplData->mpData) == *((Bitmap*)mpImplData->mpData) )
+ return TRUE;
+ break;
+
+ case IMAGETYPE_IMAGE:
+ if ( ((ImplImageData*)rImage.mpImplData->mpData)->IsEqual( *((ImplImageData*)mpImplData->mpData) ) )
+ return TRUE;
+ break;
+
+ case IMAGETYPE_IMAGEREF:
+ if ( ((ImplImageRefData*)rImage.mpImplData->mpData)->IsEqual( *((ImplImageRefData*)mpImplData->mpData) ) )
+ return TRUE;
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+// =======================================================================
+
+static void ImplCopyImageListData( ImageList* pThis )
+{
+ if ( pThis->mpImplData->mnRefCount > 1 )
+ {
+ pThis->mpImplData->mnRefCount--;
+
+ ImplImageList* pNewData = new ImplImageList;
+ pNewData->mnRefCount = 1;
+ pNewData->mnIRefCount = 0;
+ pNewData->mnCount = pThis->mpImplData->mnCount;
+ pNewData->mnRealCount = pThis->mpImplData->mnRealCount;
+ pNewData->mnArySize = pThis->mpImplData->mnArySize;
+ pNewData->mpAry = new ImageAryData[pNewData->mnArySize];
+ pNewData->maImageSize = pThis->mpImplData->maImageSize;
+ pNewData->mpImageBitmap = new ImplImageBmp;
+ pNewData->mpImageBitmap->Create( pNewData->maImageSize.Width(),
+ pNewData->maImageSize.Height(),
+ pNewData->mnArySize );
+ memset( pNewData->mpAry, 0, pNewData->mnArySize*sizeof(ImageAryData) );
+
+ USHORT i = 0;
+ USHORT n = 0;
+ while ( i < pThis->mpImplData->mnArySize )
+ {
+ // Nur die Images kopieren, die gebraucht werden
+ if ( pThis->mpImplData->mpAry[i].mnId )
+ {
+ pNewData->mpAry[n].mnId = pThis->mpImplData->mpAry[i].mnId;
+ pNewData->mpAry[n].mnRefCount = 1;
+ pNewData->mpImageBitmap->Replace( n,
+ *(pThis->mpImplData->mpImageBitmap),
+ i );
+ n++;
+ }
+
+ i++;
+ }
+
+ pThis->mpImplData = pNewData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplBmpImageCreate( ImageList* pThis,
+ const Bitmap& rBitmap, const Bitmap& rMaskBmp,
+ const Color& rColor, BOOL bColor,
+ USHORT nInit, USHORT* mpIdAry = NULL,
+ USHORT nGrow = 4 )
+{
+ // Falls es sich um eine leere ImageListe handelt, dann Defaul-Werte
+ // setzen und nichts machen
+ if ( !nInit )
+ {
+ pThis->mpImplData = NULL;
+ pThis->mnInitSize = 1;
+ pThis->mnGrowSize = nGrow;
+ return;
+ }
+
+ DBG_ASSERT( !nInit || rBitmap.GetSizePixel().Width(),
+ "ImageList::ImageList(): nInitSize != 0 and BmpSize.Width() == 0" );
+ DBG_ASSERT( (rBitmap.GetSizePixel().Width() % nInit) == 0,
+ "ImageList::ImageList(): BmpSize % nInitSize != 0" );
+ DBG_ASSERT( !rMaskBmp || (rMaskBmp.GetSizePixel() == rBitmap.GetSizePixel()),
+ "ImageList::ImageList(): BmpSize != MaskBmpSize" );
+#ifdef DBG_UTIL
+ if ( mpIdAry )
+ {
+ for ( USHORT n1 = 0; n1 < nInit; n1++ )
+ {
+ USHORT nId = mpIdAry[n1];
+ if ( !nId )
+ {
+ DBG_ERROR( "ImageList::ImageList(): Id == 0" );
+ }
+ for ( USHORT n2 = 0; n2 < n1; n2++ )
+ {
+ if ( nId == mpIdAry[n2] )
+ {
+ DBG_ERROR1( "ImageList::ImageList(): Double Id (%u)", nId );
+ }
+ }
+ }
+ }
+#endif
+
+ Size aBmpSize = rBitmap.GetSizePixel();
+ pThis->mnInitSize = nInit;
+ pThis->mnGrowSize = nGrow;
+ pThis->mpImplData = new ImplImageList;
+ pThis->mpImplData->mnRefCount = 1;
+ pThis->mpImplData->mnIRefCount = 0;
+ pThis->mpImplData->mnCount = nInit;
+ pThis->mpImplData->mnRealCount = nInit;
+ pThis->mpImplData->mnArySize = nInit;
+ pThis->mpImplData->mpAry = new ImageAryData[nInit];
+ pThis->mpImplData->maImageSize = Size( aBmpSize.Width() / nInit, aBmpSize.Height() );
+
+ for ( USHORT i = 0; i < nInit; i++ )
+ {
+ if ( mpIdAry )
+ pThis->mpImplData->mpAry[i].mnId = mpIdAry[i];
+ else
+ pThis->mpImplData->mpAry[i].mnId = i+1;
+ pThis->mpImplData->mpAry[i].mnRefCount = 1;
+ }
+
+ pThis->mpImplData->mpImageBitmap = new ImplImageBmp;
+ pThis->mpImplData->mpImageBitmap->Create( rBitmap, rMaskBmp,
+ rColor, bColor,
+ pThis->mpImplData->maImageSize.Width(),
+ pThis->mpImplData->maImageSize.Height(),
+ nInit );
+}
+
+// =======================================================================
+
+ImageList::ImageList( USHORT nInit, USHORT nGrow )
+{
+ DBG_CTOR( ImageList, NULL );
+
+ mpImplData = NULL;
+ mnInitSize = nInit;
+ mnGrowSize = nGrow;
+}
+
+// -----------------------------------------------------------------------
+
+ImageList::ImageList( const ResId& rResId )
+{
+ DBG_CTOR( ImageList, NULL );
+
+ rResId.SetRT( RSC_IMAGELIST );
+ ResMgr* pResMgr = rResId.GetResMgr();
+ if ( !pResMgr )
+ pResMgr = Resource::GetResManager();
+
+ if ( pResMgr->GetResource( rResId ) )
+ {
+ // Header ueberspringen
+ pResMgr->Increment( sizeof( RSHEADER_TYPE ) );
+
+ USHORT nObjMask = pResMgr->ReadShort();
+
+ Bitmap aImageBitmap;
+ Bitmap aMaskBitmap;
+ Color aMaskColor;
+ BOOL bCol = FALSE;
+ BOOL bIsIdList = FALSE;
+
+ if ( nObjMask & RSC_IMAGELIST_IMAGEBITMAP )
+ {
+ aImageBitmap = Bitmap( ResId( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ }
+ if ( nObjMask & RSC_IMAGELIST_MASKBITMAP )
+ {
+ aMaskBitmap = Bitmap( ResId( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ }
+ if ( nObjMask & RSC_IMAGELIST_MASKCOLOR )
+ {
+ aMaskColor = Color( ResId( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) );
+ bCol = TRUE;
+ }
+ if ( nObjMask & RSC_IMAGELIST_IDLIST )
+ {
+ bIsIdList = TRUE;
+ USHORT nCount = pResMgr->ReadShort();
+ USHORT* pAry = new USHORT[ nCount ];
+ for( int i = 0; i < nCount; i++ )
+ pAry[ i ] = pResMgr->ReadShort();
+ ImplBmpImageCreate( this, aImageBitmap, aMaskBitmap, aMaskColor,
+ bCol, nCount, pAry, 4 );
+ delete pAry;
+ }
+ if ( nObjMask & RSC_IMAGELIST_IDCOUNT )
+ {
+ USHORT nCount = pResMgr->ReadShort();
+ if ( !bIsIdList )
+ {
+ ImplBmpImageCreate( this, aImageBitmap, aMaskBitmap, aMaskColor,
+ bCol, nCount, NULL, 4 );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImageList::ImageList( const ImageList& rImageList )
+{
+ DBG_CTOR( ImageList, NULL );
+
+ mpImplData = rImageList.mpImplData;
+ if ( mpImplData )
+ mpImplData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+ImageList::ImageList( const Bitmap& rBitmap,
+ USHORT nInit, USHORT* mpIdAry, USHORT nGrow )
+{
+ DBG_CTOR( ImageList, NULL );
+
+ ImplBmpImageCreate( this, rBitmap, Bitmap(), Color(), FALSE,
+ nInit, mpIdAry, nGrow );
+}
+
+// -----------------------------------------------------------------------
+
+ImageList::ImageList( const Bitmap& rBitmap, const Bitmap& rMaskBmp,
+ USHORT nInit, USHORT* mpIdAry, USHORT nGrow )
+{
+ DBG_CTOR( ImageList, NULL );
+
+ ImplBmpImageCreate( this, rBitmap, rMaskBmp, Color(), FALSE,
+ nInit, mpIdAry, nGrow );
+}
+
+// -----------------------------------------------------------------------
+
+ImageList::ImageList( const Bitmap& rBitmap, const Color& rColor,
+ USHORT nInit, USHORT* mpIdAry, USHORT nGrow )
+{
+ DBG_CTOR( ImageList, NULL );
+
+ ImplBmpImageCreate( this, rBitmap, Bitmap(), rColor, TRUE,
+ nInit, mpIdAry, nGrow );
+}
+
+// -----------------------------------------------------------------------
+
+ImageList::~ImageList()
+{
+ DBG_DTOR( ImageList, NULL );
+
+ if ( mpImplData )
+ {
+ mpImplData->mnRefCount--;
+ if ( !mpImplData->mnRefCount && !mpImplData->mnIRefCount )
+ delete mpImplData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImageList::AddImage( USHORT nId, const Image& rImage )
+{
+ DBG_CHKTHIS( ImageList, NULL );
+ DBG_CHKOBJ( &rImage, Image, NULL );
+ DBG_ASSERT( nId, "ImageList::AddImage(): ImageId == 0" );
+ DBG_ASSERT( GetImagePos( nId ) == IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::AddImage() - ImageId already exists" );
+ DBG_ASSERT( rImage.mpImplData, "ImageList::AddImage(): Wrong Size" );
+ DBG_ASSERT( !mpImplData || (rImage.GetSizePixel() == mpImplData->maImageSize),
+ "ImageList::AddImage(): Wrong Size" );
+
+ ImageType eImageType = rImage.mpImplData->meType;
+ Size aImageSize = rImage.GetSizePixel();
+ USHORT nIndex;
+
+ if ( !mpImplData )
+ {
+ mpImplData = new ImplImageList;
+ mpImplData->mnRefCount = 1;
+ mpImplData->mnIRefCount = 0;
+ mpImplData->mnCount = 0;
+ mpImplData->mnRealCount = 0;
+ mpImplData->mnArySize = mnInitSize;
+ mpImplData->mpAry = new ImageAryData[mnInitSize];
+ mpImplData->maImageSize = aImageSize;
+ mpImplData->mpImageBitmap = new ImplImageBmp;
+ mpImplData->mpImageBitmap->Create( aImageSize.Width(), aImageSize.Height(),
+ mnInitSize );
+ memset( mpImplData->mpAry, 0, mpImplData->mnArySize*sizeof(ImageAryData) );
+ }
+ else
+ ImplCopyImageListData( this );
+
+ // Gegebenenfalls unser Array erweitern und freien Index ermitteln
+ if ( mpImplData->mnRealCount == mpImplData->mnArySize )
+ {
+ ImageAryData* pOldAry = mpImplData->mpAry;
+ USHORT nOldSize = mpImplData->mnArySize;
+
+ mpImplData->mnArySize += mnGrowSize;
+ mpImplData->mpAry = new ImageAryData[mpImplData->mnArySize];
+ memset( mpImplData->mpAry, 0, mpImplData->mnArySize*sizeof(ImageAryData) );
+ memcpy( mpImplData->mpAry, pOldAry, nOldSize*sizeof(ImageAryData) );
+ mpImplData->mpImageBitmap->Expand( mnGrowSize );
+ delete pOldAry;
+
+ nIndex = mpImplData->mnRealCount;
+ }
+ else
+ {
+ nIndex = 0;
+ while ( mpImplData->mpAry[nIndex].mnRefCount )
+ nIndex++;
+ }
+
+ // Image in Bitmap einfuegen
+ switch ( eImageType )
+ {
+ case IMAGETYPE_BITMAP:
+ mpImplData->mpImageBitmap->Replace( nIndex, *((Bitmap*)rImage.mpImplData->mpData) );
+ break;
+
+ case IMAGETYPE_IMAGE:
+ {
+ ImplImageData* pData = (ImplImageData*)rImage.mpImplData->mpData;
+ if ( pData->mpImageBitmap )
+ mpImplData->mpImageBitmap->Replace( nIndex, *(pData->mpImageBitmap), 0 );
+ else
+ {
+ if ( pData->mbColor )
+ mpImplData->mpImageBitmap->Replace( nIndex, pData->maBmp, pData->maColor );
+ else
+ mpImplData->mpImageBitmap->Replace( nIndex, pData->maBmp, pData->maMaskBmp );
+ }
+ }
+ break;
+
+ case IMAGETYPE_IMAGEREF:
+ {
+ ImplImageRefData* pData = (ImplImageRefData*)rImage.mpImplData->mpData;
+ mpImplData->mpImageBitmap->Replace( nIndex, *(pData->mpImplData->mpImageBitmap),
+ pData->mnIndex );
+ }
+ break;
+ }
+
+ // Array-Daten updaten
+ mpImplData->mnCount++;
+ mpImplData->mnRealCount++;
+ mpImplData->mpAry[nIndex].mnId = nId;
+ mpImplData->mpAry[nIndex].mnRefCount = 1;
+}
+
+// -----------------------------------------------------------------------
+
+void ImageList::CopyImage( USHORT nId, USHORT nCopyId )
+{
+ DBG_CHKTHIS( ImageList, NULL );
+ DBG_ASSERT( nId, "ImageList::CopyImage(): ImageId == 0" );
+ DBG_ASSERT( GetImagePos( nId ) == IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::CopyImage(): ImageId already exists" );
+ DBG_ASSERT( GetImagePos( nCopyId ) != IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::CopyImage(): Unknown nCopyId" );
+
+ USHORT nIndex;
+ USHORT nCopyIndex = 0;
+
+ // Index von CopyId holen
+ while ( nCopyIndex < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[nCopyIndex].mnId == nCopyId )
+ break;
+
+ nCopyIndex++;
+ }
+ if ( nCopyIndex >= mpImplData->mnArySize )
+ return;
+
+ // Referenz-Counter ueberpruefen
+ ImplCopyImageListData( this );
+
+ // Gegebenenfalls unser Array erweitern
+ if ( mpImplData->mnRealCount == mpImplData->mnArySize )
+ {
+ ImageAryData* pOldAry = mpImplData->mpAry;
+ USHORT nOldSize = mpImplData->mnArySize;
+
+ mpImplData->mnArySize += mnGrowSize;
+ mpImplData->mpAry = new ImageAryData[mpImplData->mnArySize];
+ memset( mpImplData->mpAry, 0, mpImplData->mnArySize*sizeof(ImageAryData) );
+ memcpy( mpImplData->mpAry, pOldAry, nOldSize*sizeof(ImageAryData) );
+ mpImplData->mpImageBitmap->Expand( mnGrowSize );
+ delete pOldAry;
+
+ nIndex = mpImplData->mnRealCount;
+ }
+ else
+ {
+ nIndex = 0;
+ while ( mpImplData->mpAry[nIndex].mnRefCount )
+ nIndex++;
+ }
+
+ // Kopieren
+ mpImplData->mpImageBitmap->Replace( nIndex, *(mpImplData->mpImageBitmap), nCopyIndex );
+
+ // Array-Daten updaten
+ mpImplData->mnCount++;
+ mpImplData->mnRealCount++;
+ mpImplData->mpAry[nIndex].mnId = nId;
+ mpImplData->mpAry[nIndex].mnRefCount = 1;
+}
+
+// -----------------------------------------------------------------------
+
+void ImageList::ReplaceImage( USHORT nId, const Image& rImage )
+{
+ DBG_CHKTHIS( ImageList, NULL );
+ DBG_CHKOBJ( &rImage, Image, NULL );
+ DBG_ASSERT( GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::ReplaceImage(): Unknown nId" );
+
+ RemoveImage( nId );
+ AddImage( nId, rImage );
+}
+
+// -----------------------------------------------------------------------
+
+void ImageList::ReplaceImage( USHORT nId, USHORT nReplaceId )
+{
+ DBG_CHKTHIS( ImageList, NULL );
+ DBG_ASSERT( GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::ReplaceImage(): Unknown nId" );
+ DBG_ASSERT( GetImagePos( nReplaceId ) != IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::ReplaceImage(): Unknown nReplaceId" );
+
+ USHORT nPos1 = 0;
+ USHORT nPos2 = 0;
+
+ // Index von Id holen
+ while ( nPos1 < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[nPos1].mnId == nId )
+ break;
+
+ nPos1++;
+ }
+ if ( nPos1 >= mpImplData->mnArySize )
+ return;
+
+ // Index von ReplaceId holen
+ while ( nPos2 < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[nPos2].mnId == nReplaceId )
+ break;
+
+ nPos2++;
+ }
+ if ( nPos2 >= mpImplData->mnArySize )
+ return;
+
+ // Referenz-Counter ueberpruefen
+ ImplCopyImageListData( this );
+
+ // Ersetzen
+ mpImplData->mpImageBitmap->Replace( nPos1, nPos2 );
+}
+
+// -----------------------------------------------------------------------
+
+void ImageList::MergeImage( USHORT nId, USHORT nMergeId )
+{
+ DBG_CHKTHIS( ImageList, NULL );
+ DBG_ASSERT( GetImagePos( nId ) != IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::MergeImage(): Unknown nId" );
+ DBG_ASSERT( GetImagePos( nMergeId ) != IMAGELIST_IMAGE_NOTFOUND,
+ "ImageList::MergeImage(): Unknown nMergeId" );
+
+ USHORT nPos1 = 0;
+ USHORT nPos2 = 0;
+
+ // Index von Id holen
+ while ( nPos1 < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[nPos1].mnId == nId )
+ break;
+
+ nPos1++;
+ }
+ if ( nPos1 >= mpImplData->mnArySize )
+ return;
+
+ // Index von MergeId holen
+ while ( nPos2 < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[nPos2].mnId == nMergeId )
+ break;
+
+ nPos2++;
+ }
+ if ( nPos2 >= mpImplData->mnArySize )
+ return;
+
+ // Referenz-Counter ueberpruefen
+ ImplCopyImageListData( this );
+
+ // Ersetzen
+ mpImplData->mpImageBitmap->Merge( nPos1, nPos2 );
+}
+
+// -----------------------------------------------------------------------
+
+void ImageList::RemoveImage( USHORT nId )
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData )
+ {
+ ImplCopyImageListData( this );
+
+ USHORT i = 0;
+ while ( i < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[i].mnId == nId )
+ break;
+
+ i++;
+ }
+
+ if ( i < mpImplData->mnArySize )
+ {
+ mpImplData->mpAry[i].mnRefCount--;
+ mpImplData->mpAry[i].mnId = 0;
+ if ( !mpImplData->mpAry[i].mnRefCount )
+ mpImplData->mnRealCount--;
+
+ mpImplData->mnCount--;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image ImageList::GetImage( USHORT nId ) const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ Image aImage;
+
+ if ( mpImplData )
+ {
+ USHORT i = 0;
+ while ( i < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[i].mnId == nId )
+ break;
+
+ i++;
+ }
+
+ if ( i < mpImplData->mnArySize )
+ {
+ ImplImageRefData* mpData = new ImplImageRefData;
+
+ mpImplData->mnIRefCount++;
+ mpImplData->mpAry[i].mnRefCount++;
+ mpData->mpImplData = mpImplData;
+ mpData->mnIndex = i;
+
+ aImage.mpImplData = new ImplImage;
+ aImage.mpImplData->mnRefCount = 1;
+ aImage.mpImplData->meType = IMAGETYPE_IMAGEREF;
+ aImage.mpImplData->mpData = mpData;
+ }
+ }
+
+ return aImage;
+}
+
+// -----------------------------------------------------------------------
+
+void ImageList::Clear()
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData )
+ {
+ if ( mpImplData->mnRefCount > 1 )
+ mpImplData->mnRefCount--;
+ else
+ delete mpImplData;
+ }
+
+ mpImplData = 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImageList::GetImageCount() const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData )
+ return mpImplData->mnCount;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImageList::GetImagePos( USHORT nId ) const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData && nId )
+ {
+ USHORT nPos = 0;
+ USHORT i = 0;
+ while ( i < mpImplData->mnArySize )
+ {
+ if ( mpImplData->mpAry[i].mnId == nId )
+ return nPos;
+
+ if ( mpImplData->mpAry[i].mnId )
+ nPos++;
+ i++;
+ }
+ }
+
+ return IMAGELIST_IMAGE_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImageList::GetImageId( USHORT nPos ) const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData )
+ {
+ USHORT nRealPos = 0;
+ USHORT i = 0;
+ while ( i < mpImplData->mnArySize )
+ {
+ if ( (nPos == nRealPos) && (mpImplData->mpAry[i].mnId) )
+ return mpImplData->mpAry[i].mnId;
+
+ if ( mpImplData->mpAry[i].mnId )
+ nRealPos++;
+ i++;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Size ImageList::GetImageSize() const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData )
+ return mpImplData->maImageSize;
+ else
+ return Size();
+}
+
+// -----------------------------------------------------------------------
+
+Bitmap ImageList::GetBitmap() const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ Bitmap aBmp;
+
+ if ( mpImplData )
+ {
+ // Positionen ermitteln, die in der Bitmap enthalten sein sollen
+ USHORT* mpPosAry = new USHORT[mpImplData->mnCount];
+ USHORT nPosCount = 0;
+ for ( USHORT i = 0; i < mpImplData->mnArySize; i++ )
+ {
+ if ( mpImplData->mpAry[i].mnId )
+ {
+ mpPosAry[nPosCount] = i;
+ nPosCount++;
+ }
+ }
+
+ // Bitmap besorgen
+ aBmp = mpImplData->mpImageBitmap->GetBitmap( nPosCount, mpPosAry );
+
+ // Temporaeres Array loeschen
+ delete mpPosAry;
+ }
+
+ return aBmp;
+}
+
+// -----------------------------------------------------------------------
+
+Bitmap ImageList::GetMaskBitmap() const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ Bitmap aBmp;
+
+ if ( HasMaskBitmap() )
+ {
+ // Positionen ermitteln, die in der Bitmap enthalten sein sollen
+ USHORT* mpPosAry = new USHORT[mpImplData->mnCount];
+ USHORT nPosCount = 0;
+ for ( USHORT i = 0; i < mpImplData->mnArySize; i++ )
+ {
+ if ( mpImplData->mpAry[i].mnId )
+ {
+ mpPosAry[nPosCount] = i;
+ nPosCount++;
+ }
+ }
+
+ // Bitmap besorgen
+ aBmp = mpImplData->mpImageBitmap->GetMaskBitmap( nPosCount, mpPosAry );
+
+ // Temporaeres Array loeschen
+ delete mpPosAry;
+ }
+
+ return aBmp;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImageList::HasMaskBitmap() const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData )
+ return mpImplData->mpImageBitmap->HasMaskBitmap();
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Color ImageList::GetMaskColor() const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ Color aColor;
+
+ if ( HasMaskColor() )
+ aColor = mpImplData->mpImageBitmap->GetMaskColor();
+
+ return aColor;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImageList::HasMaskColor() const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+
+ if ( mpImplData )
+ return mpImplData->mpImageBitmap->HasMaskColor();
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ImageList& ImageList::operator=( const ImageList& rImageList )
+{
+ DBG_CHKTHIS( ImageList, NULL );
+ DBG_CHKOBJ( &rImageList, ImageList, NULL );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ if ( rImageList.mpImplData )
+ rImageList.mpImplData->mnRefCount++;
+
+ // Abkoppeln
+ if ( mpImplData )
+ {
+ mpImplData->mnRefCount--;
+ if ( !mpImplData->mnRefCount && !mpImplData->mnIRefCount )
+ delete mpImplData;
+ }
+
+ // Neue Daten zuweisen
+ mpImplData = rImageList.mpImplData;
+ mnInitSize = rImageList.mnInitSize;
+ mnGrowSize = rImageList.mnGrowSize;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImageList::operator==( const ImageList& rImageList ) const
+{
+ DBG_CHKTHIS( ImageList, NULL );
+ DBG_CHKOBJ( &rImageList, ImageList, NULL );
+
+ if ( rImageList.mpImplData == mpImplData )
+ return TRUE;
+ if ( !rImageList.mpImplData || !mpImplData )
+ return FALSE;
+
+ if ( (rImageList.mpImplData->mnCount == mpImplData->mnCount) &&
+ (rImageList.mpImplData->maImageSize == mpImplData->maImageSize) )
+ return TRUE;
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, ImageList& rImageList )
+{
+ DBG_CHKOBJ( &rImageList, ImageList, NULL );
+
+ // Falls es eine bestehende ImageListe ist, dann erst abkoppeln
+ if ( rImageList.mpImplData )
+ {
+ rImageList.mpImplData->mnRefCount--;
+ if ( !rImageList.mpImplData->mnRefCount && !rImageList.mpImplData->mnIRefCount )
+ delete rImageList.mpImplData;
+ }
+ rImageList.mpImplData = NULL;
+
+ // Daten lesen
+ USHORT nVersion;
+ Size aImageSize;
+ BOOL bImageList;
+ rIStream >> nVersion;
+ rIStream >> rImageList.mnInitSize;
+ rIStream >> rImageList.mnGrowSize;
+ rIStream >> bImageList;
+
+ // Wenn es eine leere ImageListe ist, dann brauchen wir nicht weiter lesen
+ if ( !bImageList )
+ return rIStream;
+
+ // Image-Groesse lesen
+ rIStream >> aImageSize.Width();
+ rIStream >> aImageSize.Height();
+
+ // Image-Daten anlegen und initialisieren
+ rImageList.mpImplData = new ImplImageList;
+ rImageList.mpImplData->mnRefCount = 1;
+ rImageList.mpImplData->mnIRefCount = 0;
+ rImageList.mpImplData->mnCount = rImageList.mnInitSize;
+ rImageList.mpImplData->mnRealCount = rImageList.mnInitSize;
+ rImageList.mpImplData->mnArySize = rImageList.mnInitSize;
+ rImageList.mpImplData->mpAry = new ImageAryData[rImageList.mnInitSize];
+ rImageList.mpImplData->maImageSize = aImageSize;
+
+ // Array mit ID's lesen und initialisieren
+ for ( USHORT i = 0; i < rImageList.mnInitSize; i++ )
+ {
+ rIStream >> rImageList.mpImplData->mpAry[i].mnId;
+ rImageList.mpImplData->mpAry[i].mnRefCount = 1;
+ }
+
+ // Bitmaps lesen
+ Bitmap aBitmap;
+ Bitmap aMaskBitmap;
+ Color aMaskColor;
+ BYTE bMaskBitmap;
+ BYTE bMaskColor;
+ rIStream >> aBitmap;
+ rIStream >> bMaskBitmap;
+ if ( bMaskBitmap )
+ rIStream >> aMaskBitmap;
+ rIStream >> bMaskColor;
+ if ( bMaskColor )
+ rIStream >> aMaskColor;
+
+ // Systemdaten anlegen
+ rImageList.mpImplData->mpImageBitmap = new ImplImageBmp;
+ rImageList.mpImplData->mpImageBitmap->Create( aBitmap, aMaskBitmap,
+ aMaskColor, bMaskColor,
+ aImageSize.Width(),
+ aImageSize.Height(),
+ rImageList.mnInitSize );
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const ImageList& rImageList )
+{
+ DBG_CHKOBJ( &rImageList, ImageList, NULL );
+
+ BOOL bImageList = (rImageList.mpImplData) ? TRUE : FALSE;
+
+ USHORT nVersion = IMAGE_FILE_VERSION;
+ rOStream << nVersion;
+
+ // Wenn es eine leere ImageListe ist, dann nur InitSize und
+ // GrowSize schreiben
+ if ( !bImageList || !rImageList.mpImplData->mnCount )
+ {
+ BOOL bSaveImageList = FALSE;
+ rOStream << rImageList.mnInitSize;
+ rOStream << rImageList.mnGrowSize;
+ rOStream << bSaveImageList;
+ return rOStream;
+ }
+
+ // Normale Daten schreiben
+ rOStream << rImageList.mpImplData->mnCount;
+ rOStream << rImageList.mnGrowSize;
+ rOStream << bImageList;
+ rOStream << rImageList.mpImplData->maImageSize.Width();
+ rOStream << rImageList.mpImplData->maImageSize.Height();
+
+ // Array schreiben und feststellen, welche Eintraege gespeichert werden
+ // muessen
+ USHORT* mpPosAry = new USHORT[rImageList.mpImplData->mnCount];
+ USHORT nPosCount = 0;
+ for ( USHORT i = 0; i < rImageList.mpImplData->mnArySize; i++ )
+ {
+ if ( rImageList.mpImplData->mpAry[i].mnId )
+ {
+ rOStream << rImageList.mpImplData->mpAry[i].mnId;
+ mpPosAry[nPosCount] = i;
+ nPosCount++;
+ }
+ }
+
+ // Bitmaps rausschreiben
+ Bitmap aBmp;
+ BYTE bMaskBitmap = (BYTE)rImageList.mpImplData->mpImageBitmap->HasMaskBitmap();
+ BYTE bMaskColor = (BYTE)rImageList.mpImplData->mpImageBitmap->HasMaskColor();
+ aBmp = rImageList.mpImplData->mpImageBitmap->GetBitmap( nPosCount, mpPosAry );
+ rOStream << aBmp;
+ rOStream << bMaskBitmap;
+ if ( bMaskBitmap )
+ {
+ aBmp = rImageList.mpImplData->mpImageBitmap->GetMaskBitmap( nPosCount, mpPosAry );
+ rOStream << aBmp;
+ }
+ rOStream << bMaskColor;
+ if ( bMaskColor )
+ {
+ Color aColor = rImageList.mpImplData->mpImageBitmap->GetMaskColor();
+ rOStream << aColor;
+ }
+
+ // Temporaeres Array loeschen
+ delete mpPosAry;
+
+ return rOStream;
+}
+
+// =======================================================================
+
+void OutputDevice::DrawImage( const Point& rPos, const Image& rImage,
+ USHORT nStyle )
+{
+ DBG_CHKOBJ( &rImage, Image, NULL );
+ DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER,
+ "DrawImage(): Images can't be drawn on any mprinter" );
+
+ if( !rImage.mpImplData )
+ return;
+
+ switch( rImage.mpImplData->meType )
+ {
+ case IMAGETYPE_BITMAP:
+ {
+ DrawBitmap( rPos, *((Bitmap*)rImage.mpImplData->mpData) );
+ }
+ break;
+
+ case IMAGETYPE_IMAGE:
+ {
+ ImplImageData* pData = (ImplImageData*)rImage.mpImplData->mpData;
+
+ if ( !pData->mpImageBitmap )
+ {
+ Size aSize = pData->maBmp.GetSizePixel();
+ pData->mpImageBitmap = new ImplImageBmp;
+ pData->mpImageBitmap->Create( pData->maBmp, pData->maMaskBmp,
+ pData->maColor, pData->mbColor,
+ aSize.Width(), aSize.Height(),
+ 1 );
+ }
+
+ pData->mpImageBitmap->Draw( 0, this, rPos, nStyle );
+ }
+ break;
+
+ case IMAGETYPE_IMAGEREF:
+ {
+ ImplImageRefData* pData = (ImplImageRefData*)rImage.mpImplData->mpData;
+ pData->mpImplData->mpImageBitmap->Draw( pData->mnIndex, this, rPos, nStyle );
+ }
+ break;
+ }
+}
+
+// =======================================================================
+
+void OutputDevice::DrawImage( const Point& rPos, const Size& rSize,
+ const Image& rImage, USHORT nStyle )
+{
+ DBG_CHKOBJ( &rImage, Image, NULL );
+ DBG_ASSERT( GetOutDevType() != OUTDEV_PRINTER,
+ "DrawImage(): Images can't be drawn on any mprinter" );
+
+ if( !rImage.mpImplData )
+ return;
+
+ switch( rImage.mpImplData->meType )
+ {
+ case IMAGETYPE_BITMAP:
+ {
+ DrawBitmap( rPos, rSize, *((Bitmap*)rImage.mpImplData->mpData) );
+ }
+ break;
+
+ case IMAGETYPE_IMAGE:
+ {
+ ImplImageData* pData = (ImplImageData*)rImage.mpImplData->mpData;
+
+ if ( !pData->mpImageBitmap )
+ {
+ Size aSize = pData->maBmp.GetSizePixel();
+ pData->mpImageBitmap = new ImplImageBmp;
+ pData->mpImageBitmap->Create( pData->maBmp, pData->maMaskBmp,
+ pData->maColor, pData->mbColor,
+ aSize.Width(), aSize.Height(),
+ 1 );
+ }
+
+ pData->mpImageBitmap->Draw( 0, this, rPos, nStyle, &rSize );
+ }
+ break;
+
+ case IMAGETYPE_IMAGEREF:
+ {
+ ImplImageRefData* pData = (ImplImageRefData*)rImage.mpImplData->mpData;
+ pData->mpImplData->mpImageBitmap->Draw( pData->mnIndex, this, rPos, nStyle, &rSize );
+ }
+ break;
+ }
+}
diff --git a/vcl/source/gdi/imgcons.cxx b/vcl/source/gdi/imgcons.cxx
new file mode 100644
index 000000000000..d20f9c26f1c9
--- /dev/null
+++ b/vcl/source/gdi/imgcons.cxx
@@ -0,0 +1,593 @@
+/*************************************************************************
+ *
+ * $RCSfile: imgcons.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <bmpacc.hxx>
+#include <bitmapex.hxx>
+#include <image.hxx>
+#include <imgcons.hxx>
+
+// -------------------
+// - ImplColorMapper -
+// -------------------
+
+class ImplColorMapper
+{
+ Color maCol;
+ ULONG mnR;
+ ULONG mnG;
+ ULONG mnB;
+ ULONG mnT;
+ ULONG mnRShift;
+ ULONG mnGShift;
+ ULONG mnBShift;
+ ULONG mnTShift;
+
+ ULONG ImplCalcMaskShift( ULONG nVal );
+
+public:
+
+ ImplColorMapper( ULONG nRMask, ULONG nGMask, ULONG nBMask, ULONG nTMask );
+ ~ImplColorMapper();
+
+ const Color& ImplGetColor( ULONG nColor )
+ {
+ maCol.SetRed( (UINT8) ( ( nColor & mnR ) >> mnRShift ) );
+ maCol.SetGreen( (UINT8) ( ( nColor & mnG ) >> mnGShift ) );
+ maCol.SetBlue( (UINT8) ( ( nColor & mnB ) >> mnBShift ) );
+ maCol.SetTransparency( (UINT8) ( ( nColor & mnT ) >> mnTShift ) );
+ return maCol;
+ }
+};
+
+// -----------------------------------------------------------------------------
+
+ImplColorMapper::ImplColorMapper( ULONG nRMask, ULONG nGMask, ULONG nBMask, ULONG nTMask ) :
+ mnR( nRMask ),
+ mnG( nGMask ),
+ mnB( nBMask ),
+ mnT( nTMask )
+{
+ mnRShift = ImplCalcMaskShift( mnR );
+ mnGShift = ImplCalcMaskShift( mnG );
+ mnBShift = ImplCalcMaskShift( mnB );
+ mnTShift = ImplCalcMaskShift( mnT );
+}
+
+// -----------------------------------------------------------------------------
+
+ImplColorMapper::~ImplColorMapper()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ULONG ImplColorMapper::ImplCalcMaskShift( ULONG nVal )
+{
+ DBG_ASSERT( nVal > 0, "Mask has no value!" );
+
+ ULONG nRet = 0UL;
+
+ for( ULONG i = 0UL; i < 32; i++ )
+ {
+ if( nVal & ( 1UL << i ) )
+ {
+ nRet = i;
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------
+// - ImageConsumer -
+// -----------------
+
+ImageConsumer::ImageConsumer() :
+ mnStatus( 0UL ),
+ mpPal ( NULL ),
+ mpMapper( NULL ),
+ mbTrans ( FALSE )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ImageConsumer::~ImageConsumer()
+{
+ delete[] mpPal;
+ delete mpMapper;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImageConsumer::Init( ULONG nWidth, ULONG nHeight )
+{
+ maSize = Size( nWidth, nHeight );
+ maBitmap = maMask = Bitmap();
+ mnStatus = 0UL;
+ mbTrans = FALSE;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImageConsumer::SetColorModel( USHORT nBitCount,
+ ULONG nPalEntries, const ULONG* pRGBAPal,
+ ULONG nRMask, ULONG nGMask, ULONG nBMask, ULONG nAMask )
+{
+ DBG_ASSERT( maSize.Width() && maSize.Height(), "Missing call to ImageConsumer::Init(...)!" );
+
+ BitmapPalette aPal( Min( (USHORT) nPalEntries, (USHORT) 256 ) );
+
+ if( nPalEntries )
+ {
+ BitmapColor aCol;
+ const ULONG* pTmp = pRGBAPal;
+
+ delete mpMapper;
+ mpMapper = NULL;
+
+ delete[] mpPal;
+ mpPal = new Color[ nPalEntries ];
+
+ for( ULONG i = 0; i < nPalEntries; i++, pTmp++ )
+ {
+ Color& rCol = mpPal[ i ];
+ BYTE cVal;
+
+ cVal = (BYTE) ( ( *pTmp & 0xff000000UL ) >> 24UL );
+ rCol.SetRed( cVal );
+ if( i < 256UL )
+ aPal[ (USHORT) i ].SetRed( cVal );
+
+ cVal = (BYTE) ( ( *pTmp & 0x00ff0000UL ) >> 16UL );
+ rCol.SetGreen( cVal );
+ if( i < 256UL )
+ aPal[ (USHORT) i ].SetGreen( cVal );
+
+ cVal = (BYTE) ( ( *pTmp & 0x0000ff00UL ) >> 8UL );
+ rCol.SetBlue( cVal );
+ if( i < 256UL )
+ aPal[ (USHORT) i ].SetBlue( cVal );
+
+ rCol.SetTransparency( (BYTE) ( ( *pTmp & 0x000000ffUL ) ) );
+ }
+
+ if( nBitCount <= 1 )
+ nBitCount = 1;
+ else if( nBitCount <= 4 )
+ nBitCount = 4;
+ else if( nBitCount <= 8 )
+ nBitCount = 8;
+ else
+ nBitCount = 24;
+ }
+ else
+ {
+ delete mpMapper;
+ mpMapper = new ImplColorMapper( nRMask, nGMask, nBMask, nAMask );
+
+ delete[] mpPal;
+ mpPal = NULL;
+
+ nBitCount = 24;
+ }
+
+ if( !maBitmap )
+ {
+
+ maBitmap = Bitmap( maSize, nBitCount, &aPal );
+ maMask = Bitmap( maSize, 1 );
+ maMask.Erase( COL_BLACK );
+ mbTrans = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ImageConsumer::SetPixelsByBytes( ULONG nConsX, ULONG nConsY,
+ ULONG nConsWidth, ULONG nConsHeight,
+ const BYTE* pData, ULONG nOffset, ULONG nScanSize )
+{
+ DBG_ASSERT( !!maBitmap && !!maMask, "Missing call to ImageConsumer::SetColorModel(...)!" );
+
+ BitmapWriteAccess* pBmpAcc = maBitmap.AcquireWriteAccess();
+ BitmapWriteAccess* pMskAcc = maMask.AcquireWriteAccess();
+
+ if( pBmpAcc && pMskAcc )
+ {
+ const long nWidth = pBmpAcc->Width();
+ const long nHeight = pBmpAcc->Height();
+
+ maChangedRect = Rectangle( Point(), Size( nWidth, nHeight ) );
+ maChangedRect.Intersection( Rectangle( Point( nConsX, nConsY ), Size( nConsWidth, nConsHeight ) ) );
+
+ if( !maChangedRect.IsEmpty() )
+ {
+ const long nStartX = maChangedRect.Left();
+ const long nEndX = maChangedRect.Right();
+ const long nStartY = maChangedRect.Top();
+ const long nEndY = maChangedRect.Bottom();
+
+ if( mpMapper && ( pBmpAcc->GetBitCount() > 8 ) )
+ {
+ BitmapColor aCol;
+ BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ for( long nY = nStartY; nY <= nEndY; nY++ )
+ {
+ const BYTE* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
+
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ {
+ const Color& rCol = mpMapper->ImplGetColor( *pTmp++ );
+
+ // 0: Transparent; >0: Non-Transparent
+ if( !rCol.GetTransparency() )
+ {
+ pMskAcc->SetPixel( nY, nX, aMskWhite );
+ mbTrans = TRUE;
+ }
+ else
+ {
+ aCol.SetRed( rCol.GetRed() );
+ aCol.SetGreen( rCol.GetGreen() );
+ aCol.SetBlue( rCol.GetBlue() );
+ pBmpAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+ }
+
+ DataChanged();
+ }
+ else if( mpPal && ( pBmpAcc->GetBitCount() <= 8 ) )
+ {
+ BitmapColor aIndex( (BYTE) 0 );
+ BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ for( long nY = nStartY; nY <= nEndY; nY++ )
+ {
+ const BYTE* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
+
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ {
+ const BYTE cIndex = *pTmp++;
+ const Color& rCol = mpPal[ cIndex ];
+
+ // 0: Transparent; >0: Non-Transparent
+ if( !rCol.GetTransparency() )
+ {
+ pMskAcc->SetPixel( nY, nX, aMskWhite );
+ mbTrans = TRUE;
+ }
+ else
+ {
+ aIndex.SetIndex( cIndex );
+ pBmpAcc->SetPixel( nY, nX, aIndex );
+ }
+ }
+ }
+
+ DataChanged();
+ }
+ else if( mpPal && ( pBmpAcc->GetBitCount() > 8 ) )
+ {
+ BitmapColor aCol;
+ BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ for( long nY = nStartY; nY <= nEndY; nY++ )
+ {
+ const BYTE* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
+
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ {
+ const BYTE cIndex = *pTmp++;
+ const Color& rCol = mpPal[ cIndex ];
+
+ // 0: Transparent; >0: Non-Transparent
+ if( !rCol.GetTransparency() )
+ {
+ pMskAcc->SetPixel( nY, nX, aMskWhite );
+ mbTrans = TRUE;
+ }
+ else
+ {
+ aCol.SetRed( rCol.GetRed() );
+ aCol.SetGreen( rCol.GetGreen() );
+ aCol.SetBlue( rCol.GetBlue() );
+ pBmpAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+ }
+
+ DataChanged();
+ }
+ else
+ {
+ DBG_ERROR( "Producer format error!" );
+ maChangedRect.SetEmpty();
+ }
+ }
+ }
+ else
+ maChangedRect.SetEmpty();
+
+ maBitmap.ReleaseAccess( pBmpAcc );
+ maMask.ReleaseAccess( pMskAcc );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImageConsumer::SetPixelsByLongs( ULONG nConsX, ULONG nConsY,
+ ULONG nConsWidth, ULONG nConsHeight,
+ const ULONG* pData, ULONG nOffset, ULONG nScanSize )
+{
+ DBG_ASSERT( !!maBitmap && !!maMask, "Missing call to ImageConsumer::SetColorModel(...)!" );
+
+ BitmapWriteAccess* pBmpAcc = maBitmap.AcquireWriteAccess();
+ BitmapWriteAccess* pMskAcc = maMask.AcquireWriteAccess();
+
+ if( pBmpAcc && pMskAcc )
+ {
+ const long nWidth = pBmpAcc->Width();
+ const long nHeight = pBmpAcc->Height();
+
+ maChangedRect = Rectangle( Point(), Size( nWidth, nHeight ) );
+ maChangedRect.Intersection( Rectangle( Point( nConsX, nConsY ), Size( nConsWidth, nConsHeight ) ) );
+
+ if( !maChangedRect.IsEmpty() )
+ {
+ const long nStartX = maChangedRect.Left();
+ const long nEndX = maChangedRect.Right();
+ const long nStartY = maChangedRect.Top();
+ const long nEndY = maChangedRect.Bottom();
+
+ if( mpMapper && ( pBmpAcc->GetBitCount() > 8 ) )
+ {
+ BitmapColor aCol;
+ BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ for( long nY = nStartY; nY <= nEndY; nY++ )
+ {
+ const ULONG* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
+
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ {
+ const Color& rCol = mpMapper->ImplGetColor( *pTmp++ );
+
+ // 0: Transparent; >0: Non-Transparent
+ if( !rCol.GetTransparency() )
+ {
+ pMskAcc->SetPixel( nY, nX, aMskWhite );
+ mbTrans = TRUE;
+ }
+ else
+ {
+ aCol.SetRed( rCol.GetRed() );
+ aCol.SetGreen( rCol.GetGreen() );
+ aCol.SetBlue( rCol.GetBlue() );
+ pBmpAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+ }
+
+ DataChanged();
+ }
+ else if( mpPal && ( pBmpAcc->GetBitCount() <= 8 ) )
+ {
+ BitmapColor aIndex( (BYTE) 0 );
+ BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ for( long nY = nStartY; nY <= nEndY; nY++ )
+ {
+ const ULONG* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
+
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ {
+ const ULONG nIndex = *pTmp++;
+ const Color& rCol = mpPal[ nIndex ];
+
+ // 0: Transparent; >0: Non-Transparent
+ if( !rCol.GetTransparency() )
+ {
+ pMskAcc->SetPixel( nY, nX, aMskWhite );
+ mbTrans = TRUE;
+ }
+ else
+ {
+ aIndex.SetIndex( (BYTE) nIndex );
+ pBmpAcc->SetPixel( nY, nX, aIndex );
+ }
+ }
+ }
+
+ DataChanged();
+ }
+ else if( mpPal && ( pBmpAcc->GetBitCount() > 8 ) )
+ {
+ BitmapColor aCol;
+ BitmapColor aMskWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) );
+
+ for( long nY = nStartY; nY <= nEndY; nY++ )
+ {
+ const ULONG* pTmp = pData + ( nY - nStartY ) * nScanSize + nOffset;
+
+ for( long nX = nStartX; nX <= nEndX; nX++ )
+ {
+ const ULONG nIndex = *pTmp++;
+ const Color& rCol = mpPal[ nIndex ];
+
+ // 0: Transparent; >0: Non-Transparent
+ if( !rCol.GetTransparency() )
+ {
+ pMskAcc->SetPixel( nY, nX, aMskWhite );
+ mbTrans = TRUE;
+ }
+ else
+ {
+ aCol.SetRed( rCol.GetRed() );
+ aCol.SetGreen( rCol.GetGreen() );
+ aCol.SetBlue( rCol.GetBlue() );
+ pBmpAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+ }
+
+ DataChanged();
+ }
+ else
+ {
+ DBG_ERROR( "Producer format error!" );
+ maChangedRect.SetEmpty();
+ }
+ }
+ }
+ else
+ maChangedRect.SetEmpty();
+
+ maBitmap.ReleaseAccess( pBmpAcc );
+ maMask.ReleaseAccess( pMskAcc );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImageConsumer::Completed( ULONG nStatus /*, ImageProducer& rProducer */ )
+{
+ delete mpMapper;
+ mpMapper = NULL;
+ delete[] mpPal;
+ mpPal = NULL;
+ maSize = Size();
+ mnStatus = nStatus;
+
+ switch( nStatus )
+ {
+ case( SINGLEFRAMEDONE ):
+ case( STATICIMAGEDONE ):
+ {
+ if( !mbTrans )
+ maMask = Bitmap();
+ }
+ break;
+
+ case( IMAGEERROR ):
+ case( IMAGEABORTED ):
+ maBitmap = maMask = Bitmap();
+ break;
+
+ default:
+ break;
+ }
+
+// rProducer.RemoveConsumer( *this );
+
+ if( maDoneLink.IsSet() )
+ maDoneLink.Call( this );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImageConsumer::DataChanged()
+{
+ if( maChgLink.IsSet() )
+ maChgLink.Call( this );
+}
+
+// -----------------------------------------------------------------------------
+
+ULONG ImageConsumer::GetStatus() const
+{
+ return mnStatus;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImageConsumer::GetData( BitmapEx& rBmpEx ) const
+{
+ const BOOL bRet = ( SINGLEFRAMEDONE == mnStatus || STATICIMAGEDONE == mnStatus );
+
+ if( bRet )
+ {
+ if( !!maMask )
+ rBmpEx = BitmapEx( maBitmap, maMask );
+ else
+ rBmpEx = BitmapEx( maBitmap );
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImageConsumer::GetData( Image& rImage ) const
+{
+ const BOOL bRet = ( SINGLEFRAMEDONE == mnStatus || STATICIMAGEDONE == mnStatus );
+
+ if( bRet )
+ {
+ if( !!maMask )
+ rImage = Image( maBitmap, maMask );
+ else
+ rImage = Image( maBitmap );
+ }
+
+ return bRet;
+}
diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx
new file mode 100644
index 000000000000..fc3a943c0471
--- /dev/null
+++ b/vcl/source/gdi/impanmvw.cxx
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * $RCSfile: impanmvw.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IMPANMVW_CXX
+
+#define private public
+
+#include "impanmvw.hxx"
+#include "virdev.hxx"
+#include "window.hxx"
+#include "salbtype.hxx"
+
+// ----------------
+// - ImplAnimView -
+// ----------------
+
+ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut,
+ const Point& rPt, const Size& rSz,
+ ULONG nExtraData,
+ OutputDevice* pFirstFrameOutDev ) :
+ mpParent ( pParent ),
+ mpOut ( pFirstFrameOutDev ? pFirstFrameOutDev : pOut ),
+ maPt ( rPt ),
+ maSz ( rSz ),
+ maClip ( mpOut->GetClipRegion() ),
+ maSzPix ( mpOut->LogicToPixel( maSz ) ),
+ mnExtraData ( nExtraData ),
+ mpBackground ( new VirtualDevice ),
+ mpRestore ( new VirtualDevice ),
+ meLastDisposal ( DISPOSE_BACK ),
+ mbPause ( FALSE ),
+ mbMarked ( FALSE ),
+ mbHMirr ( maSz.Width() < 0L ),
+ mbVMirr ( maSz.Height() < 0L )
+{
+ mpParent->ImplIncAnimCount();
+
+ // mirrored horizontically?
+ if( mbHMirr )
+ {
+ maDispPt.X() = maPt.X() + maSz.Width() + 1L;
+ maDispSz.Width() = -maSz.Width();
+ maSzPix.Width() = -maSzPix.Width();
+ }
+ else
+ {
+ maDispPt.X() = maPt.X();
+ maDispSz.Width() = maSz.Width();
+ }
+
+ // mirrored vertically?
+ if( mbVMirr )
+ {
+ maDispPt.Y() = maPt.Y() + maSz.Height() + 1L;
+ maDispSz.Height() = -maSz.Height();
+ maSzPix.Height() = -maSzPix.Height();
+ }
+ else
+ {
+ maDispPt.Y() = maPt.Y();
+ maDispSz.Height() = maSz.Height();
+ }
+
+ // save background
+ mpBackground->SetOutputSizePixel( maSzPix );
+
+ if( mpOut->GetOutDevType() == OUTDEV_WINDOW )
+ {
+ MapMode aTempMap( mpOut->GetMapMode() );
+ aTempMap.SetOrigin( Point() );
+ mpBackground->SetMapMode( aTempMap );
+ ( (Window*) mpOut )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground );
+ mpBackground->SetMapMode( MapMode() );
+ }
+ else
+ mpBackground->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpOut );
+
+ // initial drawing to actual position
+ ImplDrawToPos( mpParent->ImplGetCurPos() );
+
+ // if first frame OutputDevice is set, update variables now for real OutputDevice
+ if( pFirstFrameOutDev )
+ maClip = ( mpOut = pOut )->GetClipRegion();
+}
+
+// ------------------------------------------------------------------------
+
+ImplAnimView::~ImplAnimView()
+{
+ delete mpBackground;
+ delete mpRestore;
+
+ mpParent->ImplDecAnimCount();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImplAnimView::ImplMatches( OutputDevice* pOut, long nExtraData ) const
+{
+ BOOL bRet = FALSE;
+
+ if( nExtraData )
+ {
+ if( ( mnExtraData == nExtraData ) && ( !pOut || ( pOut == mpOut ) ) )
+ bRet = TRUE;
+ }
+ else if( !pOut || ( pOut == mpOut ) )
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplAnimView::ImplGetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, Size& rSizePix )
+{
+ const Size& rAnmSize = mpParent->GetDisplaySizePixel();
+ Point aPt2( rAnm.aPosPix.X() + rAnm.aSizePix.Width() - 1L,
+ rAnm.aPosPix.Y() + rAnm.aSizePix.Height() - 1L );
+ double fFactX, fFactY;
+
+ // calculate x scaling
+ if( rAnmSize.Width() > 1L )
+ fFactX = (double) ( maSzPix.Width() - 1L ) / ( rAnmSize.Width() - 1L );
+ else
+ fFactX = 1.0;
+
+ // calculate y scaling
+ if( rAnmSize.Height() > 1L )
+ fFactY = (double) ( maSzPix.Height() - 1L ) / ( rAnmSize.Height() - 1L );
+ else
+ fFactY = 1.0;
+
+ rPosPix.X() = FRound( rAnm.aPosPix.X() * fFactX );
+ rPosPix.Y() = FRound( rAnm.aPosPix.Y() * fFactY );
+
+ aPt2.X() = FRound( aPt2.X() * fFactX );
+ aPt2.Y() = FRound( aPt2.Y() * fFactY );
+
+ rSizePix.Width() = aPt2.X() - rPosPix.X() + 1L;
+ rSizePix.Height() = aPt2.Y() - rPosPix.Y() + 1L;
+
+ // mirrored horizontically?
+ if( mbHMirr )
+ rPosPix.X() = maSzPix.Width() - 1L - aPt2.X();
+
+ // mirrored vertically?
+ if( mbVMirr )
+ rPosPix.Y() = maSzPix.Height() - 1L - aPt2.Y();
+}
+
+// ------------------------------------------------------------------------
+
+void ImplAnimView::ImplDrawToPos( ULONG nPos )
+{
+ VirtualDevice aVDev;
+ Region* pOldClip = !maClip.IsNull() ? new Region( mpOut->GetClipRegion() ) : NULL;
+
+ aVDev.SetOutputSizePixel( maSzPix, FALSE );
+ nPos = Min( nPos, (ULONG) mpParent->Count() - 1UL );
+
+ for( ULONG i = 0UL; i <= nPos; i++ )
+ ImplDraw( i, &aVDev );
+
+ if( pOldClip )
+ mpOut->SetClipRegion( maClip );
+
+ mpOut->DrawOutDev( maDispPt, maDispSz, Point(), maSzPix, aVDev );
+
+ if( pOldClip )
+ {
+ mpOut->SetClipRegion( *pOldClip );
+ delete pOldClip;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImplAnimView::ImplDraw( ULONG nPos )
+{
+ ImplDraw( nPos, NULL );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplAnimView::ImplDraw( ULONG nPos, VirtualDevice* pVDev )
+{
+ Rectangle aOutRect( mpOut->PixelToLogic( Point() ), mpOut->GetOutputSize() );
+
+ // check, if output lies out of display
+ if( aOutRect.Intersection( Rectangle( maDispPt, maDispSz ) ).IsEmpty() )
+ ImplSetMarked( TRUE );
+ else if( !mbPause )
+ {
+ VirtualDevice* pDev;
+ Point aPosPix;
+ Point aBmpPosPix;
+ Size aSizePix;
+ Size aBmpSizePix;
+ const ULONG nLastPos = mpParent->Count() - 1;
+ const AnimationBitmap& rAnm = mpParent->Get( (USHORT) ( mnActPos = Min( nPos, nLastPos ) ) );
+
+ ImplGetPosSize( rAnm, aPosPix, aSizePix );
+
+ // mirrored horizontically?
+ if( mbHMirr )
+ {
+ aBmpPosPix.X() = aPosPix.X() + aSizePix.Width() - 1L;
+ aBmpSizePix.Width() = -aSizePix.Width();
+ }
+ else
+ {
+ aBmpPosPix.X() = aPosPix.X();
+ aBmpSizePix.Width() = aSizePix.Width();
+ }
+
+ // mirrored vertically?
+ if( mbVMirr )
+ {
+ aBmpPosPix.Y() = aPosPix.Y() + aSizePix.Height() - 1L;
+ aBmpSizePix.Height() = -aSizePix.Height();
+ }
+ else
+ {
+ aBmpPosPix.Y() = aPosPix.Y();
+ aBmpSizePix.Height() = aSizePix.Height();
+ }
+
+ // get output device
+ if( !pVDev )
+ {
+ pDev = new VirtualDevice;
+ pDev->SetOutputSizePixel( maSzPix, FALSE );
+ pDev->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpOut );
+ }
+ else
+ pDev = pVDev;
+
+ // restore background after each run
+ if( !nPos )
+ {
+ meLastDisposal = DISPOSE_BACK;
+ maRestPt = Point();
+ maRestSz = maSzPix;
+ }
+
+ // restore
+ if( ( DISPOSE_NOT != meLastDisposal ) && maRestSz.Width() && maRestSz.Height() )
+ {
+ if( DISPOSE_BACK == meLastDisposal )
+ pDev->DrawOutDev( maRestPt, maRestSz, maRestPt, maRestSz, *mpBackground );
+ else
+ pDev->DrawOutDev( maRestPt, maRestSz, Point(), maRestSz, *mpRestore );
+ }
+
+ meLastDisposal = rAnm.eDisposal;
+ maRestPt = aPosPix;
+ maRestSz = aSizePix;
+
+ // Was muessen wir beim naechsten Mal restaurieren ?
+ // ==> ggf. in eine Bitmap stecken, ansonsten SaveBitmap
+ // aus Speichergruenden loeschen
+ if( ( meLastDisposal == DISPOSE_BACK ) || ( meLastDisposal == DISPOSE_NOT ) )
+ mpRestore->SetOutputSizePixel( Size( 1, 1 ), FALSE );
+ else
+ {
+ mpRestore->SetOutputSizePixel( maRestSz, FALSE );
+ mpRestore->DrawOutDev( Point(), maRestSz, aPosPix, aSizePix, *pDev );
+ }
+
+ pDev->DrawBitmapEx( aBmpPosPix, aBmpSizePix, rAnm.aBmpEx );
+
+ if( !pVDev )
+ {
+ Region* pOldClip = !maClip.IsNull() ? new Region( mpOut->GetClipRegion() ) : NULL;
+
+ if( pOldClip )
+ mpOut->SetClipRegion( maClip );
+
+ mpOut->DrawOutDev( maDispPt, maDispSz, Point(), maSzPix, *pDev );
+
+ if( pOldClip )
+ {
+ mpOut->SetClipRegion( *pOldClip );
+ delete pOldClip;
+ }
+
+ delete pDev;
+
+#ifndef REMOTE_APPSERVER
+ if( mpOut->GetOutDevType() == OUTDEV_WINDOW )
+ ( (Window*) mpOut )->Sync();
+#endif
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImplAnimView::ImplRepaint()
+{
+ const BOOL bOldPause = mbPause;
+
+ if( mpOut->GetOutDevType() == OUTDEV_WINDOW )
+ {
+ MapMode aTempMap( mpOut->GetMapMode() );
+ aTempMap.SetOrigin( Point() );
+ mpBackground->SetMapMode( aTempMap );
+ ( (Window*) mpOut )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground );
+ mpBackground->SetMapMode( MapMode() );
+ }
+ else
+ mpBackground->DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpOut );
+
+ mbPause = FALSE;
+ ImplDrawToPos( mnActPos );
+ mbPause = bOldPause;
+}
+
+// ------------------------------------------------------------------------
+
+AInfo* ImplAnimView::ImplCreateAInfo() const
+{
+ AInfo* pAInfo = new AInfo;
+
+ pAInfo->aStartOrg = maPt;
+ pAInfo->aStartSize = maSz;
+ pAInfo->pOutDev = mpOut;
+ pAInfo->pViewData = (void*) this;
+ pAInfo->nExtraData = mnExtraData;
+ pAInfo->bPause = mbPause;
+
+ return pAInfo;
+}
diff --git a/vcl/source/gdi/impanmvw.hxx b/vcl/source/gdi/impanmvw.hxx
new file mode 100644
index 000000000000..fdefa420cc62
--- /dev/null
+++ b/vcl/source/gdi/impanmvw.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * $RCSfile: impanmvw.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_IMPANMVW_HXX
+#define _SV_IMPANMVW_HXX
+
+#include "animate.hxx"
+
+// ----------------
+// - ImplAnimView -
+// ----------------
+
+class Animation;
+class OutputDevice;
+class VirtualDevice;
+struct AnimationBitmap;
+
+class ImplAnimView
+{
+private:
+
+ Animation* mpParent;
+ OutputDevice* mpOut;
+ long mnExtraData;
+ Point maPt;
+ Point maDispPt;
+ Point maRestPt;
+ Size maSz;
+ Size maSzPix;
+ Size maDispSz;
+ Size maRestSz;
+ MapMode maMap;
+ Region maClip;
+ VirtualDevice* mpBackground;
+ VirtualDevice* mpRestore;
+ ULONG mnActPos;
+ Disposal meLastDisposal;
+ BOOL mbPause;
+ BOOL mbFirst;
+ BOOL mbMarked;
+ BOOL mbHMirr;
+ BOOL mbVMirr;
+
+ void ImplGetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, Size& rSizePix );
+ void ImplDraw( ULONG nPos, VirtualDevice* pVDev );
+
+public:
+
+ ImplAnimView( Animation* pParent, OutputDevice* pOut,
+ const Point& rPt, const Size& rSz, ULONG nExtraData,
+ OutputDevice* pFirstFrameOutDev = NULL );
+ ~ImplAnimView();
+
+ BOOL ImplMatches( OutputDevice* pOut, long nExtraData ) const;
+ void ImplDrawToPos( ULONG nPos );
+ void ImplDraw( ULONG nPos );
+ void ImplRepaint();
+ AInfo* ImplCreateAInfo() const;
+
+ const Point& ImplGetOutPos() const { return maPt; }
+
+ const Size& ImplGetOutSize() const { return maSz; }
+ const Size& ImplGetOutSizePix() const { return maSzPix; }
+
+ void ImplPause( BOOL bPause ) { mbPause = bPause; }
+ BOOL ImplIsPause() const { return mbPause; }
+
+ void ImplSetMarked( BOOL bMarked ) { mbMarked = bMarked; }
+ BOOL ImplIsMarked() const { return mbMarked; }
+};
+
+#endif
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
new file mode 100644
index 000000000000..3cb648163026
--- /dev/null
+++ b/vcl/source/gdi/impbmp.cxx
@@ -0,0 +1,309 @@
+/*************************************************************************
+ *
+ * $RCSfile: impbmp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IMPBMP_CXX
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#else
+#include <indbmp.hxx>
+#ifndef _SV_RMBITMAP_HXX
+#include <rmbitmap.hxx>
+#endif
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#include <impbmp.hxx>
+#include <bitmap.hxx>
+
+// --------------
+// - ImpBitmap -
+// --------------
+
+ImpBitmap::ImpBitmap() :
+ mnRefCount ( 1UL ),
+ mnChecksum ( 0UL ),
+ mpRMBitmap ( NULL ),
+#ifndef REMOTE_APPSERVER
+ mpSalBitmap ( new SalBitmap )
+#else
+ mpSalBitmap ( new ImplServerBitmap )
+#endif
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImpBitmap::~ImpBitmap()
+{
+#ifdef REMOTE_APPSERVER
+ ImplReleaseRemoteBmp();
+#endif
+ delete mpSalBitmap;
+}
+
+// -----------------------------------------------------------------------
+#ifndef REMOTE_APPSERVER
+void ImpBitmap::ImplSetSalBitmap( SalBitmap* pBitmap )
+#else
+void ImpBitmap::ImplSetSalBitmap( ImplServerBitmap* pBitmap )
+#endif
+{
+ delete mpSalBitmap, mpSalBitmap = pBitmap;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImpBitmap::ImplCreate( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
+{
+ return mpSalBitmap->Create( rSize, nBitCount, rPal );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap )
+{
+ mnChecksum = rImpBitmap.mnChecksum;
+ return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, SalGraphics* pGraphics )
+{
+ return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, pGraphics );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImpBitmap::ImplCreate( const ImpBitmap& rImpBitmap, USHORT nNewBitCount )
+{
+ return mpSalBitmap->Create( *rImpBitmap.mpSalBitmap, nNewBitCount );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplDestroy()
+{
+ mpSalBitmap->Destroy();
+}
+
+// -----------------------------------------------------------------------
+
+Size ImpBitmap::ImplGetSize() const
+{
+#ifdef REMOTE_APPSERVER
+ if( ImplIsGetPrepared() )
+ return mpRMBitmap->GetSize();
+ else
+#endif
+ return mpSalBitmap->GetSize();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImpBitmap::ImplGetBitCount() const
+{
+ USHORT nBitCount;
+
+#ifdef REMOTE_APPSERVER
+ if( ImplIsGetPrepared() )
+ nBitCount = mpRMBitmap->GetBitCount();
+ else
+#endif
+ nBitCount = mpSalBitmap->GetBitCount();
+
+ return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 );
+}
+
+// -----------------------------------------------------------------------
+
+BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BOOL bReadOnly )
+{
+ return mpSalBitmap->AcquireBuffer( bReadOnly );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly )
+{
+ mpSalBitmap->ReleaseBuffer( pBuffer, bReadOnly );
+
+ if( !bReadOnly )
+ mnChecksum = 0;
+}
+
+#ifdef REMOTE_APPSERVER
+
+RMBitmap* ImpBitmap::ImplGetRemoteBmp()
+{
+ return mpRMBitmap;
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplCreateRemoteBmp( const Bitmap& rBitmap )
+{
+ DBG_ASSERT( !mpRMBitmap, "ImplCreateRemoteBmp( Bitmap& rBitmap )???" );
+
+ mpRMBitmap = new RMBitmap( &(Bitmap&) rBitmap );
+ mpRMBitmap->Create();
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplCreateRemoteBmp( const Bitmap& rBitmap,
+ OutputDevice* pOut,
+ const Point& rPt, const Size& rSz )
+{
+ DBG_ASSERT( !mpRMBitmap, "ImplCreateRemoteBmp( Bitmap& rBitmap )???" );
+
+ mpRMBitmap = new RMBitmap( &(Bitmap&) rBitmap );
+ mpRMBitmap->CreateGet( pOut, rPt, rSz );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplReleaseRemoteBmp()
+{
+ delete mpRMBitmap;
+ mpRMBitmap = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplDrawRemoteBmp( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz )
+{
+ if( mpRMBitmap )
+ mpRMBitmap->Draw( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplDrawRemoteBmpEx( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz,
+ const Bitmap& rMask )
+{
+ if( mpRMBitmap )
+ mpRMBitmap->DrawEx( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, rMask );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplDrawRemoteBmpAlpha( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz,
+ const AlphaMask& rAlpha )
+{
+ if( mpRMBitmap )
+ mpRMBitmap->DrawAlpha( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, rAlpha );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplDrawRemoteBmpMask( OutputDevice* pOut,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Point& rDestPt, const Size& rDestSz,
+ const Color& rColor )
+{
+ if( mpRMBitmap )
+ mpRMBitmap->DrawMask( pOut, rSrcPt, rSrcSz, rDestPt, rDestSz, rColor );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImpBitmap::ImplIsGetPrepared() const
+{
+ return( mpRMBitmap ? mpRMBitmap->IsGetPrepared() : FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void ImpBitmap::ImplResolveGet()
+{
+ if( mpRMBitmap )
+ {
+ Bitmap aBmp;
+ mpRMBitmap->Get( aBmp );
+ ImpBitmap* pGetImpBmp = aBmp.ImplGetImpBitmap();
+
+ if( pGetImpBmp )
+ {
+ // wir nehmen der gegetteten Bitmap einfach
+ // die SalBitmap weg; Null-Setzen nicht vergessen,
+ // da die Bitmap die SalBitmap sonst abraeumt
+ delete mpSalBitmap;
+ mpSalBitmap = pGetImpBmp->mpSalBitmap;
+ pGetImpBmp->mpSalBitmap = NULL;
+ }
+ }
+}
+
+#endif
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
new file mode 100644
index 000000000000..a53739ec6041
--- /dev/null
+++ b/vcl/source/gdi/impgraph.cxx
@@ -0,0 +1,1571 @@
+/*************************************************************************
+ *
+ * $RCSfile: impgraph.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IMPGRAPH_CXX
+
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _TOOLS_TEMPFILE_HXX
+#include <tools/tempfile.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _NEW_HXX
+#include <tools/new.hxx>
+#endif
+#include <impgraph.hxx>
+#ifndef _GFXLINK_HXX
+#include <gfxlink.hxx>
+#endif
+#ifndef _SV_CVTGRF_HXX
+#include <cvtgrf.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_GRAPH_HXX
+#include <graph.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define GRAPHIC_MAXPARTLEN 256000L
+#define GRAPHIC_MTFTOBMP_MAXEXT 2048
+#define GRAPHIC_STREAMBUFSIZE 8192UL
+
+#define SYS_WINMETAFILE 0x00000003UL
+#define SYS_WNTMETAFILE 0x00000004UL
+#define SYS_OS2METAFILE 0x00000005UL
+#define SYS_MACMETAFILE 0x00000006UL
+
+#define GRAPHIC_FORMAT_50 COMPAT_FORMAT( 'G', 'R', 'F', '5' )
+#define NATIVE_FORMAT_50 COMPAT_FORMAT( 'N', 'A', 'T', '5' )
+
+// ---------------
+// - ImpSwapFile -
+// ---------------
+
+struct ImpSwapFile
+{
+ String aSwapFileName;
+ USHORT nRefCount;
+};
+
+// -----------------
+// - Graphicreader -
+// -----------------
+
+GraphicReader::~GraphicReader()
+{
+}
+
+// --------------
+// - ImpGraphic -
+// --------------
+
+ImpGraphic::ImpGraphic() :
+ mpAnimation ( NULL ),
+ mpContext ( NULL ),
+ mpSwapFile ( NULL ),
+ mpGfxLink ( NULL ),
+ meType ( GRAPHIC_NONE ),
+ mnDocFilePos ( 0UL ),
+ mnRefCount ( 1UL ),
+ mbSwapOut ( FALSE ),
+ mbSwapUnderway ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) :
+ maEx ( rImpGraphic.maEx ),
+ maMetaFile ( rImpGraphic.maMetaFile ),
+ mpContext ( NULL ),
+ mpSwapFile ( rImpGraphic.mpSwapFile ),
+ meType ( rImpGraphic.meType ),
+ maDocFileName ( rImpGraphic.maDocFileName ),
+ mnDocFilePos ( rImpGraphic.mnDocFilePos ),
+ mnRefCount ( 1UL ),
+ mbSwapOut ( rImpGraphic.mbSwapOut ),
+ mbSwapUnderway ( FALSE )
+{
+ if( mpSwapFile )
+ mpSwapFile->nRefCount++;
+
+ if( rImpGraphic.mpGfxLink )
+ mpGfxLink = new GfxLink( *rImpGraphic.mpGfxLink );
+ else
+ mpGfxLink = NULL;
+
+ if( rImpGraphic.mpAnimation )
+ {
+ mpAnimation = new Animation( *rImpGraphic.mpAnimation );
+ maEx = mpAnimation->GetBitmapEx();
+ }
+ else
+ mpAnimation = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
+ maEx ( rBitmap ),
+ mpAnimation ( NULL ),
+ mpContext ( NULL ),
+ mpSwapFile ( NULL ),
+ mpGfxLink ( NULL ),
+ meType ( !rBitmap ? GRAPHIC_NONE : GRAPHIC_BITMAP ),
+ mnDocFilePos ( 0UL ),
+ mnRefCount ( 1UL ),
+ mbSwapOut ( FALSE ),
+ mbSwapUnderway ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
+ maEx ( rBitmapEx ),
+ mpAnimation ( NULL ),
+ mpContext ( NULL ),
+ mpSwapFile ( NULL ),
+ mpGfxLink ( NULL ),
+ meType ( !rBitmapEx ? GRAPHIC_NONE : GRAPHIC_BITMAP ),
+ mnDocFilePos ( 0UL ),
+ mnRefCount ( 1UL ),
+ mbSwapOut ( FALSE ),
+ mbSwapUnderway ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
+ maEx ( rAnimation.GetBitmapEx() ),
+ mpAnimation ( new Animation( rAnimation ) ),
+ mpContext ( NULL ),
+ mpSwapFile ( NULL ),
+ mpGfxLink ( NULL ),
+ meType ( GRAPHIC_BITMAP ),
+ mnDocFilePos ( 0UL ),
+ mnRefCount ( 1UL ),
+ mbSwapOut ( FALSE ),
+ mbSwapUnderway ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) :
+ maMetaFile ( rMtf ),
+ mpAnimation ( NULL ),
+ mpContext ( NULL ),
+ mpSwapFile ( NULL ),
+ mpGfxLink ( NULL ),
+ meType ( GRAPHIC_GDIMETAFILE ),
+ mnDocFilePos ( 0UL ),
+ mnRefCount ( 1UL ),
+ mbSwapOut ( FALSE ),
+ mbSwapUnderway ( FALSE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+ImpGraphic::~ImpGraphic()
+{
+ ImplClear();
+
+ if( (ULONG) mpContext > 1UL )
+ delete mpContext;
+}
+
+// ------------------------------------------------------------------------
+
+ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic )
+{
+ if( &rImpGraphic != this )
+ {
+ if( !mbSwapUnderway )
+ ImplClear();
+
+ maMetaFile = rImpGraphic.maMetaFile;
+ meType = rImpGraphic.meType;
+
+ delete mpAnimation;
+
+ if ( rImpGraphic.mpAnimation )
+ {
+ mpAnimation = new Animation( *rImpGraphic.mpAnimation );
+ maEx = mpAnimation->GetBitmapEx();
+ }
+ else
+ {
+ mpAnimation = NULL;
+ maEx = rImpGraphic.maEx;
+ }
+
+ if( !mbSwapUnderway )
+ {
+ maDocFileName = rImpGraphic.maDocFileName;
+ mnDocFilePos = rImpGraphic.mnDocFilePos;
+ mbSwapOut = rImpGraphic.mbSwapOut;
+ mpSwapFile = rImpGraphic.mpSwapFile;
+
+ if( mpSwapFile )
+ mpSwapFile->nRefCount++;
+ }
+
+ delete mpGfxLink;
+
+ if( rImpGraphic.mpGfxLink )
+ mpGfxLink = new GfxLink( *rImpGraphic.mpGfxLink );
+ else
+ mpGfxLink = NULL;
+ }
+
+ return *this;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const
+{
+ BOOL bRet = FALSE;
+
+ if( this == &rImpGraphic )
+ bRet = TRUE;
+ else if( !ImplIsSwapOut() && ( rImpGraphic.meType == meType ) )
+ {
+ switch( meType )
+ {
+ case( GRAPHIC_NONE ):
+ bRet = TRUE;
+ break;
+
+ case( GRAPHIC_GDIMETAFILE ):
+ {
+ if( rImpGraphic.maMetaFile == maMetaFile )
+ bRet = TRUE;
+ }
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ {
+ if( mpAnimation )
+ {
+ if( rImpGraphic.mpAnimation && ( *rImpGraphic.mpAnimation == *mpAnimation ) )
+ bRet = TRUE;
+ }
+ else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maEx == maEx ) )
+ bRet = TRUE;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplClearGraphics( BOOL bCreateSwapInfo )
+{
+ if( bCreateSwapInfo && !ImplIsSwapOut() )
+ {
+ maSwapInfo.maPrefMapMode = ImplGetPrefMapMode();
+ maSwapInfo.maPrefSize = ImplGetPrefSize();
+ }
+
+ maEx.Clear();
+ maMetaFile.Clear();
+
+ if( mpAnimation )
+ {
+ mpAnimation->Clear();
+ delete mpAnimation;
+ mpAnimation = NULL;
+ }
+
+ if( mpGfxLink )
+ {
+ delete mpGfxLink;
+ mpGfxLink = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplClear()
+{
+ if( mpSwapFile )
+ {
+ if( mpSwapFile->nRefCount > 1 )
+ mpSwapFile->nRefCount--;
+ else
+ {
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( mpSwapFile->aSwapFileName, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+
+ delete mpSwapFile;
+ }
+
+ mpSwapFile = NULL;
+ }
+
+ mbSwapOut = FALSE;
+ mnDocFilePos = 0UL;
+ maDocFileName.Erase();
+
+ // cleanup
+ ImplClearGraphics( FALSE );
+ meType = GRAPHIC_NONE;
+}
+
+// ------------------------------------------------------------------------
+
+GraphicType ImpGraphic::ImplGetType() const
+{
+ return meType;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplSetDefaultType()
+{
+ ImplClear();
+ meType = GRAPHIC_DEFAULT;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplIsSupportedGraphic() const
+{
+ return( meType != GRAPHIC_NONE );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplIsTransparent() const
+{
+ BOOL bRet;
+
+ if( meType == GRAPHIC_BITMAP )
+ bRet = ( mpAnimation ? mpAnimation->IsTransparent() : maEx.IsTransparent() );
+ else
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplIsAlpha() const
+{
+ BOOL bRet;
+
+ if( meType == GRAPHIC_BITMAP )
+ bRet = ( NULL == mpAnimation ) && maEx.IsAlpha();
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplIsAnimated() const
+{
+ return( mpAnimation != NULL );
+}
+
+// ------------------------------------------------------------------------
+
+Bitmap ImpGraphic::ImplGetBitmap() const
+{
+ Bitmap aRetBmp;
+
+ if( meType == GRAPHIC_BITMAP )
+ {
+ const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
+ const Color aReplaceColor( COL_WHITE );
+
+ aRetBmp = rRetBmpEx.GetBitmap( &aReplaceColor );
+ }
+ else if( ( meType != GRAPHIC_DEFAULT ) && ImplIsSupportedGraphic() )
+ {
+ VirtualDevice aVDev;
+ Size aSizePix( aVDev.LogicToPixel( maMetaFile.GetPrefSize(),
+ maMetaFile.GetPrefMapMode() ) );
+
+ if( aSizePix.Width() && aSizePix.Height() &&
+ ( aSizePix.Width() > GRAPHIC_MTFTOBMP_MAXEXT || aSizePix.Height() > GRAPHIC_MTFTOBMP_MAXEXT ) )
+ {
+ double fWH = (double) aSizePix.Width() / aSizePix.Height();
+
+ if( fWH <= 1.0 )
+ {
+ aSizePix.Width() = FRound( fWH * GRAPHIC_MTFTOBMP_MAXEXT );
+ aSizePix.Height() = GRAPHIC_MTFTOBMP_MAXEXT;
+ }
+ else
+ {
+ aSizePix.Width() = GRAPHIC_MTFTOBMP_MAXEXT;
+ aSizePix.Height() = FRound( GRAPHIC_MTFTOBMP_MAXEXT / fWH );
+ }
+ }
+
+ if( aVDev.SetOutputSizePixel( aSizePix ) )
+ {
+ const Point aPt;
+ ImplDraw( &aVDev, aPt, aSizePix );
+ aRetBmp = aVDev.GetBitmap( aPt, aSizePix );
+ }
+ }
+
+ if( !!aRetBmp )
+ {
+ aRetBmp.SetPrefMapMode( ImplGetPrefMapMode() );
+ aRetBmp.SetPrefSize( ImplGetPrefSize() );
+ }
+
+ return aRetBmp;
+}
+
+// ------------------------------------------------------------------------
+
+BitmapEx ImpGraphic::ImplGetBitmapEx() const
+{
+ BitmapEx aRetBmpEx;
+
+ if( meType == GRAPHIC_BITMAP )
+ aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
+ else if( ( meType != GRAPHIC_DEFAULT ) && ImplIsSupportedGraphic() )
+ {
+ const ImpGraphic aMonoMask( maMetaFile.GetMonochromeMtf( COL_BLACK ) );
+ aRetBmpEx = BitmapEx( ImplGetBitmap(), aMonoMask.ImplGetBitmap() );
+ }
+
+ return aRetBmpEx;
+}
+
+// ------------------------------------------------------------------------
+
+Animation ImpGraphic::ImplGetAnimation() const
+{
+ Animation aAnimation;
+
+ if( mpAnimation )
+ aAnimation = *mpAnimation;
+
+ return aAnimation;
+}
+
+// ------------------------------------------------------------------------
+
+const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
+{
+ return maMetaFile;
+}
+
+// ------------------------------------------------------------------------
+
+Size ImpGraphic::ImplGetPrefSize() const
+{
+ Size aSize;
+
+ if( ImplIsSwapOut() )
+ aSize = maSwapInfo.maPrefSize;
+ else
+ {
+ switch( meType )
+ {
+ case( GRAPHIC_NONE ):
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ {
+ aSize = maEx.GetPrefSize();
+
+ if( !aSize.Width() || !aSize.Height() )
+ aSize = maEx.GetSizePixel();
+ }
+ break;
+
+ default:
+ {
+ if( ImplIsSupportedGraphic() )
+ aSize = maMetaFile.GetPrefSize();
+ }
+ break;
+ }
+ }
+
+ return aSize;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
+{
+ switch( meType )
+ {
+ case( GRAPHIC_NONE ):
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ maEx.SetPrefSize( rPrefSize );
+ break;
+
+ default:
+ {
+ if( ImplIsSupportedGraphic() )
+ maMetaFile.SetPrefSize( rPrefSize );
+ }
+ break;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+MapMode ImpGraphic::ImplGetPrefMapMode() const
+{
+ MapMode aMapMode;
+
+ if( ImplIsSwapOut() )
+ aMapMode = maSwapInfo.maPrefMapMode;
+ else
+ {
+ switch( meType )
+ {
+ case( GRAPHIC_NONE ):
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ {
+ const Size aSize( maEx.GetPrefSize() );
+
+ if ( aSize.Width() && aSize.Height() )
+ aMapMode = maEx.GetPrefMapMode();
+ }
+ break;
+
+ default:
+ {
+ if( ImplIsSupportedGraphic() )
+ return maMetaFile.GetPrefMapMode();
+ }
+ break;
+ }
+ }
+
+ return aMapMode;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
+{
+ switch( meType )
+ {
+ case( GRAPHIC_NONE ):
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ maEx.SetPrefMapMode( rPrefMapMode );
+ break;
+
+ default:
+ {
+ if( ImplIsSupportedGraphic() )
+ maMetaFile.SetPrefMapMode( rPrefMapMode );
+ }
+ break;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ImpGraphic::ImplGetSizeBytes() const
+{
+ ULONG nSizeBytes;
+
+ if( meType == GRAPHIC_BITMAP )
+ {
+ if( mpAnimation )
+ nSizeBytes = mpAnimation->GetSizeBytes();
+ else
+ nSizeBytes = maEx.GetSizeBytes();
+ }
+ else
+ nSizeBytes = 0UL;
+
+ return nSizeBytes;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
+{
+ if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+ {
+ switch( meType )
+ {
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ {
+ if ( mpAnimation )
+ mpAnimation->Draw( pOutDev, rDestPt );
+ else
+ maEx.Draw( pOutDev, rDestPt );
+ }
+ break;
+
+ default:
+ ImplDraw( pOutDev, rDestPt, maMetaFile.GetPrefSize() );
+ break;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
+ const Point& rDestPt, const Size& rDestSize ) const
+{
+ if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+ {
+ switch( meType )
+ {
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ {
+ if( mpAnimation )
+ mpAnimation->Draw( pOutDev, rDestPt, rDestSize );
+ else
+ maEx.Draw( pOutDev, rDestPt, rDestSize );
+ }
+ break;
+
+ default:
+ {
+ ( (ImpGraphic*) this )->maMetaFile.WindStart();
+ ( (ImpGraphic*) this )->maMetaFile.Play( pOutDev, rDestPt, rDestSize );
+ ( (ImpGraphic*) this )->maMetaFile.WindStart();
+ }
+ break;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplStartAnimation( OutputDevice* pOutDev,
+ const Point& rDestPt,
+ long nExtraData,
+ OutputDevice* pFirstFrameOutDev )
+{
+ if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+ mpAnimation->Start( pOutDev, rDestPt, nExtraData, pFirstFrameOutDev );
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplStartAnimation( OutputDevice* pOutDev, const Point& rDestPt,
+ const Size& rDestSize, long nExtraData,
+ OutputDevice* pFirstFrameOutDev )
+{
+ if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+ mpAnimation->Start( pOutDev, rDestPt, rDestSize, nExtraData, pFirstFrameOutDev );
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplStopAnimation( OutputDevice* pOutDev, long nExtraData )
+{
+ if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+ mpAnimation->Stop( pOutDev, nExtraData );
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplSetAnimationNotifyHdl( const Link& rLink )
+{
+ if( mpAnimation )
+ mpAnimation->SetNotifyHdl( rLink );
+}
+
+// ------------------------------------------------------------------------
+
+Link ImpGraphic::ImplGetAnimationNotifyHdl() const
+{
+ Link aLink;
+
+ if( mpAnimation )
+ aLink = mpAnimation->GetNotifyHdl();
+
+ return aLink;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ImpGraphic::ImplGetAnimationLoopCount() const
+{
+ return( mpAnimation ? mpAnimation->GetLoopCount() : 0UL );
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplResetAnimationLoopCount()
+{
+ if( mpAnimation )
+ mpAnimation->ResetLoopCount();
+}
+
+// ------------------------------------------------------------------------
+
+List* ImpGraphic::ImplGetAnimationInfoList() const
+{
+ return( mpAnimation ? mpAnimation->GetAInfoList() : NULL );
+}
+
+// ------------------------------------------------------------------------
+
+GraphicReader* ImpGraphic::ImplGetContext()
+{
+ return mpContext;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplSetContext( GraphicReader* pReader )
+{
+ mpContext = pReader;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplSetDocFileName( const String& rName, ULONG nFilePos )
+{
+ maDocFileName = rName;
+ mnDocFilePos = nFilePos;
+}
+
+// ------------------------------------------------------------------------
+
+const String& ImpGraphic::ImplGetDocFileName() const
+{
+ return maDocFileName;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ImpGraphic::ImplGetDocFilePos() const
+{
+ return mnDocFilePos;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplReadEmbedded( SvStream& rIStm, BOOL bSwap )
+{
+ MapMode aMapMode;
+ Size aSize;
+ const ULONG nStartPos = rIStm.Tell();
+ ULONG nId;
+ ULONG nHeaderLen;
+ long nType;
+ long nLen;
+ const USHORT nOldFormat = rIStm.GetNumberFormatInt();
+ BOOL bRet = FALSE;
+
+ if( !mbSwapUnderway )
+ {
+ const String aTempName( maDocFileName );
+ const ULONG nTempPos = mnDocFilePos;
+
+ ImplClear();
+
+ maDocFileName = aTempName;
+ mnDocFilePos = nTempPos;
+ }
+
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rIStm >> nId;
+
+ // check version
+ if( GRAPHIC_FORMAT_50 == nId )
+ {
+ // read new style header
+ VersionCompat* pCompat = new VersionCompat( rIStm, STREAM_READ );
+
+ rIStm >> nType;
+ rIStm >> nLen;
+ rIStm >> aSize;
+ rIStm >> aMapMode;
+
+ delete pCompat;
+ }
+ else
+ {
+ // read old style header
+ long nWidth, nHeight;
+ long nMapMode, nScaleNumX, nScaleDenomX;
+ long nScaleNumY, nScaleDenomY, nOffsX, nOffsY;
+
+ rIStm.SeekRel( -4L );
+
+ rIStm >> nType >> nLen >> nWidth >> nHeight;
+ rIStm >> nMapMode >> nScaleNumX >> nScaleDenomX >> nScaleNumY;
+ rIStm >> nScaleDenomY >> nOffsX >> nOffsY;
+
+ // swapped
+ if( nType > 100L )
+ {
+ nType = SWAPLONG( nType );
+ nLen = SWAPLONG( nLen );
+ nWidth = SWAPLONG( nWidth );
+ nHeight = SWAPLONG( nHeight );
+ nMapMode = SWAPLONG( nMapMode );
+ nScaleNumX = SWAPLONG( nScaleNumX );
+ nScaleDenomX = SWAPLONG( nScaleDenomX );
+ nScaleNumY = SWAPLONG( nScaleNumY );
+ nScaleDenomY = SWAPLONG( nScaleDenomY );
+ nOffsX = SWAPLONG( nOffsX );
+ nOffsY = SWAPLONG( nOffsY );
+ }
+
+ aSize = Size( nWidth, nHeight );
+ aMapMode = MapMode( (MapUnit) nMapMode, Point( nOffsX, nOffsY ),
+ Fraction( nScaleNumX, nScaleDenomX ),
+ Fraction( nScaleNumY, nScaleDenomY ) );
+ }
+
+ nHeaderLen = rIStm.Tell() - nStartPos;
+ meType = (GraphicType) nType;
+
+ if( meType )
+ {
+ if( meType == GRAPHIC_BITMAP )
+ {
+ maEx.aBitmapSize = aSize;
+
+ if( aMapMode != MapMode() )
+ {
+ maEx.SetPrefMapMode( aMapMode );
+ maEx.SetPrefSize( aSize );
+ }
+ }
+ else
+ {
+ maMetaFile.SetPrefMapMode( aMapMode );
+ maMetaFile.SetPrefSize( aSize );
+ }
+
+ if( bSwap )
+ {
+ if( maDocFileName.Len() )
+ {
+ rIStm.Seek( nStartPos + nHeaderLen + nLen );
+ bRet = mbSwapOut = TRUE;
+ }
+ else
+ {
+ const String aTmpName( TempFile::CreateTempName() );
+
+ if( aTmpName.Len() )
+ {
+ SvFileStream aOStm( aTmpName, STREAM_WRITE | STREAM_SHARE_DENYWRITE );
+
+ aOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ if( !aOStm.GetError() )
+ {
+ ULONG nFullLen = nHeaderLen + nLen;
+ ULONG nPartLen = Min( nFullLen, (ULONG) GRAPHIC_MAXPARTLEN );
+ BYTE* pBuffer = (BYTE*) SvMemAlloc( nPartLen );
+
+ if( pBuffer )
+ {
+ rIStm.Seek( nStartPos );
+
+ while( nFullLen )
+ {
+ rIStm.Read( (char*) pBuffer, nPartLen );
+ aOStm.Write( (char*) pBuffer, nPartLen );
+
+ nFullLen -= nPartLen;
+
+ if( nFullLen < GRAPHIC_MAXPARTLEN )
+ nPartLen = nFullLen;
+ }
+
+ SvMemFree( pBuffer );
+
+ ULONG nReadErr = rIStm.GetError();
+ ULONG nWriteErr = aOStm.GetError();
+
+ aOStm.Close();
+
+ if( !nReadErr && !nWriteErr )
+ {
+ bRet = mbSwapOut = TRUE;
+ mpSwapFile = new ImpSwapFile;
+ mpSwapFile->nRefCount = 1;
+ mpSwapFile->aSwapFileName = aTmpName;
+ }
+ else
+ {
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( aTmpName, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if( meType == GRAPHIC_BITMAP || meType == GRAPHIC_GDIMETAFILE )
+ {
+ rIStm >> *this;
+ bRet = ( rIStm.GetError() == 0UL );
+ }
+ else if( meType >= SYS_WINMETAFILE && meType <= SYS_MACMETAFILE )
+ {
+ Graphic aSysGraphic;
+ ULONG nCvtType;
+
+ switch( (ULONG) meType )
+ {
+ case( SYS_WINMETAFILE ):
+ case( SYS_WNTMETAFILE ): nCvtType = CVT_WMF; break;
+ case( SYS_OS2METAFILE ): nCvtType = CVT_MET; break;
+ case( SYS_MACMETAFILE ): nCvtType = CVT_PCT; break;
+
+ default:
+ nCvtType = CVT_UNKNOWN;
+ break;
+ }
+
+ if( nType && GraphicConverter::Import( rIStm, aSysGraphic, nCvtType ) == ERRCODE_NONE )
+ {
+ *this = ImpGraphic( aSysGraphic.GetGDIMetaFile() );
+ bRet = ( rIStm.GetError() == 0UL );
+ }
+ else
+ meType = GRAPHIC_DEFAULT;
+ }
+
+ if( bRet )
+ {
+ ImplSetPrefMapMode( aMapMode );
+ ImplSetPrefSize( aSize );
+ }
+ }
+ else
+ bRet = TRUE;
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
+{
+ BOOL bRet = FALSE;
+
+ if( ( meType != GRAPHIC_NONE ) && ( meType != GRAPHIC_DEFAULT ) && !ImplIsSwapOut() )
+ {
+ const MapMode aMapMode( ImplGetPrefMapMode() );
+ const Size aSize( ImplGetPrefSize() );
+ const USHORT nOldFormat = rOStm.GetNumberFormatInt();
+ const ULONG nStmPos1 = rOStm.Tell();
+ ULONG nDataFieldPos;
+
+ rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ // write correct version ( old style/new style header )
+ if( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 )
+ {
+ // write ID for new format (5.0)
+ rOStm << GRAPHIC_FORMAT_50;
+
+ // write new style header
+ VersionCompat* pCompat = new VersionCompat( rOStm, STREAM_WRITE, 1 );
+
+ rOStm << (long) meType;
+
+ // data size is updated later
+ nDataFieldPos = rOStm.Tell();
+ rOStm << (long) 0;
+
+ rOStm << aSize;
+ rOStm << aMapMode;
+
+ delete pCompat;
+ }
+ else
+ {
+ // write old style (<=4.0) header
+ rOStm << (long) meType;
+
+ // data size is updated later
+ nDataFieldPos = rOStm.Tell();
+ rOStm << (long) 0;
+
+ rOStm << (long) aSize.Width();
+ rOStm << (long) aSize.Height();
+ rOStm << (long) aMapMode.GetMapUnit();
+ rOStm << (long) aMapMode.GetScaleX().GetNumerator();
+ rOStm << (long) aMapMode.GetScaleX().GetDenominator();
+ rOStm << (long) aMapMode.GetScaleY().GetNumerator();
+ rOStm << (long) aMapMode.GetScaleY().GetDenominator();
+ rOStm << (long) aMapMode.GetOrigin().X();
+ rOStm << (long) aMapMode.GetOrigin().Y();
+ }
+
+ // write data block
+ if( !rOStm.GetError() )
+ {
+ const ULONG nDataStart = rOStm.Tell();
+
+ if( ImplIsSupportedGraphic() )
+ rOStm << *this;
+
+ if( !rOStm.GetError() )
+ {
+ const ULONG nStmPos2 = rOStm.Tell();
+ rOStm.Seek( nDataFieldPos );
+ rOStm << (long) ( nStmPos2 - nDataStart );
+ rOStm.Seek( nStmPos2 );
+ bRet = TRUE;
+ }
+ }
+
+ rOStm.SetNumberFormatInt( nOldFormat );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplSwapOut()
+{
+ BOOL bRet = FALSE;
+
+ if( !ImplIsSwapOut() )
+ {
+ if( !maDocFileName.Len() )
+ {
+ const String aTmpName( TempFile::CreateTempName() );
+
+ if( aTmpName.Len() )
+ {
+ SvFileStream aOStm( aTmpName, STREAM_WRITE | STREAM_SHARE_DENYWRITE );
+
+ aOStm.SetVersion( SOFFICE_FILEFORMAT_NOW );
+ aOStm.SetCompressMode( COMPRESSMODE_NATIVE );
+
+ if( ( bRet = ImplSwapOut( &aOStm ) ) == TRUE )
+ {
+ mpSwapFile = new ImpSwapFile;
+ mpSwapFile->nRefCount = 1;
+ mpSwapFile->aSwapFileName = aTmpName;
+ }
+ else
+ {
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( aTmpName, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+ }
+ }
+ }
+ else
+ {
+ ImplClearGraphics( TRUE );
+ bRet = mbSwapOut = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplSwapOut( SvStream* pOStm )
+{
+ BOOL bRet = FALSE;
+
+ if( pOStm )
+ {
+ pOStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
+
+ if( !pOStm->GetError() && ImplWriteEmbedded( *pOStm ) )
+ {
+ pOStm->Flush();
+
+ if( !pOStm->GetError() )
+ {
+ ImplClearGraphics( TRUE );
+ bRet = mbSwapOut = TRUE;
+ }
+ }
+ }
+ else
+ {
+ ImplClearGraphics( TRUE );
+ bRet = mbSwapOut = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplSwapIn()
+{
+ BOOL bRet = FALSE;
+
+ if( ImplIsSwapOut() )
+ {
+ const String aFileName = ( mpSwapFile ? mpSwapFile->aSwapFileName : maDocFileName );
+ SvFileStream aIStm( aFileName, STREAM_READ | STREAM_SHARE_DENYWRITE );
+
+ aIStm.SetVersion( SOFFICE_FILEFORMAT_NOW );
+ aIStm.SetCompressMode( COMPRESSMODE_NATIVE );
+
+ if( !mpSwapFile )
+ aIStm.Seek( mnDocFilePos );
+
+ bRet = ImplSwapIn( &aIStm );
+ aIStm.Close();
+
+ if( mpSwapFile )
+ {
+ if( mpSwapFile->nRefCount > 1 )
+ mpSwapFile->nRefCount--;
+ else
+ {
+ try
+ {
+ ::ucb::Content aCnt( INetURLObject( mpSwapFile->aSwapFileName, INET_PROT_FILE ).GetMainURL(),
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
+
+ aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
+ }
+ catch( ::com::sun::star::ucb::CommandAbortedException& )
+ {
+ DBG_ERRORFILE( "CommandAbortedException" );
+ }
+ catch( ... )
+ {
+ DBG_ERRORFILE( "Any other exception" );
+ }
+
+ delete mpSwapFile;
+ }
+
+ mpSwapFile = NULL;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplSwapIn( SvStream* pIStm )
+{
+ BOOL bRet = FALSE;
+
+ if( pIStm )
+ {
+ pIStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
+
+ if( !pIStm->GetError() )
+ {
+ mbSwapUnderway = TRUE;
+ bRet = ImplReadEmbedded( *pIStm );
+ mbSwapUnderway = FALSE;
+
+ if( !bRet )
+ ImplClear();
+ else
+ mbSwapOut = FALSE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplIsSwapOut() const
+{
+ return mbSwapOut;
+}
+
+// ------------------------------------------------------------------------
+
+void ImpGraphic::ImplSetLink( const GfxLink& rGfxLink )
+{
+ delete mpGfxLink;
+ mpGfxLink = new GfxLink( rGfxLink );
+
+ if( mpGfxLink->IsNative() )
+ mpGfxLink->SwapOut();
+}
+
+// ------------------------------------------------------------------------
+
+GfxLink ImpGraphic::ImplGetLink()
+{
+ return( mpGfxLink ? *mpGfxLink : GfxLink() );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplIsLink() const
+{
+ return ( mpGfxLink != NULL ) ? TRUE : FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+ULONG ImpGraphic::ImplGetChecksum() const
+{
+ ULONG nRet = 0;
+
+ if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+ {
+ switch( meType )
+ {
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case( GRAPHIC_BITMAP ):
+ {
+ if( mpAnimation )
+ nRet = mpAnimation->GetChecksum();
+ else
+ nRet = maEx.GetChecksum();
+ }
+ break;
+
+ default:
+ nRet = maMetaFile.GetChecksum();
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplCopy() const
+{
+ DBG_ERROR( "Missing implementation!" );
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL ImpGraphic::ImplPaste()
+{
+ DBG_ERROR( "Missing implementation!" );
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic )
+{
+ if( !rIStm.GetError() )
+ {
+ const ULONG nStmPos1 = rIStm.Tell();
+ ULONG nTmp;
+
+ if ( !rImpGraphic.mbSwapUnderway )
+ rImpGraphic.ImplClear();
+
+ // read Id
+ rIStm >> nTmp;
+
+ if( NATIVE_FORMAT_50 == nTmp )
+ {
+ Graphic aGraphic;
+ GfxLink aLink;
+ VersionCompat* pCompat;
+
+ // read compat info
+ pCompat = new VersionCompat( rIStm, STREAM_READ );
+ delete pCompat;
+
+ rIStm >> aLink;
+
+ // set dummy link to avoid creation of additional link after filtering;
+ // we set a default link to avoid unnecessary swapping of native data
+ aGraphic.SetLink( GfxLink() );
+
+ if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) )
+ {
+ // set link only, if no other link was set
+ const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL );
+
+ // assign graphic
+ rImpGraphic = *aGraphic.ImplGetImpGraphic();
+
+ if( bSetLink )
+ rImpGraphic.ImplSetLink( aLink );
+ }
+ else
+ {
+ rIStm.Seek( nStmPos1 );
+ rIStm.SetError( ERRCODE_IO_WRONGFORMAT );
+ }
+ }
+ else
+ {
+ BitmapEx aBmpEx;
+ const USHORT nOldFormat = rIStm.GetNumberFormatInt();
+
+ rIStm.SeekRel( -4 );
+ rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ rIStm >> aBmpEx;
+
+ if( !rIStm.GetError() )
+ {
+ UINT32 nMagic1, nMagic2;
+ ULONG nActPos = rIStm.Tell();
+
+ rIStm >> nMagic1 >> nMagic2;
+ rIStm.Seek( nActPos );
+
+ rImpGraphic = ImpGraphic( aBmpEx );
+
+ if( ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) && !rIStm.GetError() )
+ {
+ delete rImpGraphic.mpAnimation;
+ rImpGraphic.mpAnimation = new Animation;
+ rIStm >> *rImpGraphic.mpAnimation;
+ }
+ }
+ else
+ {
+ GDIMetaFile aMtf;
+
+ rIStm.Seek( nStmPos1 );
+ rIStm.ResetError();
+ rIStm >> aMtf;
+
+ if( !rIStm.GetError() )
+ rImpGraphic = aMtf;
+ else
+ rIStm.Seek( nStmPos1 );
+ }
+
+ rIStm.SetNumberFormatInt( nOldFormat );
+ }
+ }
+
+ return rIStm;
+}
+
+// ------------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic )
+{
+ if( !rOStm.GetError() )
+ {
+ if( !rImpGraphic.ImplIsSwapOut() )
+ {
+ if( ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 ) &&
+ ( rOStm.GetCompressMode() & COMPRESSMODE_NATIVE ) &&
+ rImpGraphic.mpGfxLink && rImpGraphic.mpGfxLink->IsNative() )
+ {
+ VersionCompat* pCompat;
+
+ // native format
+ rOStm << NATIVE_FORMAT_50;
+
+ // write compat info
+ pCompat = new VersionCompat( rOStm, STREAM_WRITE, 1 );
+ delete pCompat;
+
+ rOStm << *rImpGraphic.mpGfxLink;
+ }
+ else
+ {
+ // own format
+ const USHORT nOldFormat = rOStm.GetNumberFormatInt();
+ rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ switch( rImpGraphic.ImplGetType() )
+ {
+ case( GRAPHIC_NONE ):
+ case( GRAPHIC_DEFAULT ):
+ break;
+
+ case GRAPHIC_BITMAP:
+ {
+ if ( rImpGraphic.ImplIsAnimated() )
+ rOStm << *rImpGraphic.mpAnimation;
+ else
+ rOStm << rImpGraphic.maEx;
+ }
+ break;
+
+ default:
+ {
+ if( rImpGraphic.ImplIsSupportedGraphic() )
+ rOStm << rImpGraphic.maMetaFile;
+ }
+ break;
+ }
+
+ rOStm.SetNumberFormatInt( nOldFormat );
+ }
+ }
+ else
+ rOStm.SetError( SVSTREAM_GENERALERROR );
+ }
+
+ return rOStm;
+}
diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx
new file mode 100644
index 000000000000..1dcebb60009a
--- /dev/null
+++ b/vcl/source/gdi/impimage.cxx
@@ -0,0 +1,744 @@
+/*************************************************************************
+ *
+ * $RCSfile: impimage.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IMPIMAGE_CXX
+
+#include <string.h>
+
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_BITMAPEX_HXX
+#include <bitmapex.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_IMAGE_H
+#include <image.h>
+#endif
+
+// -------------
+// - FASTIMAGE -
+// -------------
+
+#ifndef REMOTE_APPSERVER
+#if defined WIN || defined WNT || defined OS2
+#undef FASTTRANSPARENT
+extern BOOL bFastTransparent;
+#else
+#undef FASTTRANSPARENT
+#endif
+#else
+#undef FASTTRANSPARENT
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define IPOS( nPos ) ( Point( (nPos) * aSize.Width(), 0L ) )
+#define IMPSYSIMAGEITEM_NOTFREE ( 0x01 )
+#define IMPSYSIMAGEITEM_MASK ( 0x02 )
+#define DISA_ALL ( 0xffff )
+#define PAINT_ALL ( 0xffff )
+
+// ----------------
+// - ImplImageBmp -
+// ----------------
+
+ImplImageBmp::ImplImageBmp() :
+ pInfoAry ( NULL ),
+ nCount ( 0 ),
+ nSize ( 0 )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImplImageBmp::~ImplImageBmp()
+{
+ delete[] pInfoAry;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Create( long nItemWidth, long nItemHeight, USHORT nInitSize )
+{
+ const Size aTotalSize( nInitSize * nItemWidth, nItemHeight );
+
+ nCount = 0;
+ aSize = Size( nItemWidth, nItemHeight );
+ nSize = nInitSize;
+
+ aBmp = Bitmap( aTotalSize, 4 );
+ aMask = Bitmap( aTotalSize, 1 );
+
+ delete[] pInfoAry;
+ pInfoAry = new BYTE[ nSize ];
+ memset( pInfoAry, 0, nSize );
+ ImplClearCaches();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Create( const Bitmap& rBmp, const Bitmap& rMaskBmp,
+ const Color& rColor, BOOL bColor,
+ long nItemWidth, long nItemHeight, USHORT nInitSize )
+{
+ BYTE nStyle = IMPSYSIMAGEITEM_NOTFREE;
+
+ ImplClearCaches();
+
+ if ( bColor || !!rMaskBmp )
+ nStyle |= IMPSYSIMAGEITEM_MASK;
+
+ aSize = Size( nItemWidth, nItemHeight );
+ nCount = 0;
+ nSize = nInitSize;
+
+ delete[] pInfoAry;
+ pInfoAry = new BYTE[ nSize ];
+ memset( pInfoAry, nStyle, nSize );
+
+ aBmp = rBmp;
+
+ if( !!rMaskBmp )
+ aMask = rMaskBmp;
+ else if( bColor )
+ aMask = aBmp.CreateMask( rColor );
+
+#ifdef FASTTRANSPARENT
+ if( nStyle & IMPSYSIMAGEITEM_MASK )
+ ImplUpdatePaintBmp( DISA_ALL );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Expand( USHORT nGrowSize )
+{
+ const ULONG nDX = nGrowSize * aSize.Width();
+ const USHORT nOldSize = nSize;
+ BYTE* pNewAry = new BYTE[ nSize += nGrowSize ];
+
+ ImplClearCaches();
+
+ aBmp.Expand( nDX, 0UL );
+ aMask.Expand( nDX, 0UL );
+
+ if( !!aDisa )
+ aDisa.Expand( nDX, 0UL );
+
+ memset( pNewAry, 0, nSize );
+ memcpy( pNewAry, pInfoAry, nOldSize );
+ delete[] pInfoAry;
+ pInfoAry = pNewAry;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Replace( USHORT nPos, USHORT nSrcPos )
+{
+ const Rectangle aSrcRect( IPOS( nSrcPos ), aSize );
+ const Rectangle aDstRect( IPOS( nPos ), aSize );
+
+ ImplClearCaches();
+
+ aBmp.CopyPixel( aDstRect, aSrcRect );
+
+ if ( pInfoAry[ nSrcPos ] & IMPSYSIMAGEITEM_MASK )
+ {
+ aMask.CopyPixel( aDstRect, aSrcRect );
+
+ if( !!aDisa )
+ aDisa.CopyPixel( aDstRect, aSrcRect );
+ }
+
+ pInfoAry[ nPos ] = pInfoAry[ nSrcPos ];
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Replace( USHORT nPos, const ImplImageBmp& rImageBmp, USHORT nSrcPos )
+{
+ const Rectangle aSrcRect( IPOS( nSrcPos ), aSize );
+ const Rectangle aDstRect( IPOS( nPos ), aSize );
+
+ ImplClearCaches();
+
+ aBmp.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aBmp );
+
+ if ( rImageBmp.pInfoAry[ nSrcPos ] & IMPSYSIMAGEITEM_MASK )
+ {
+ aMask.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aMask );
+
+ if( !!aDisa )
+ aDisa.CopyPixel( aDstRect, aSrcRect, &rImageBmp.aDisa );
+ }
+
+ pInfoAry[ nPos ] = rImageBmp.pInfoAry[ nSrcPos ];
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Replace( USHORT nPos, const Bitmap& rBmp )
+{
+ Point aPoint;
+ const Rectangle aSrcRect( aPoint, aSize );
+ const Rectangle aDstRect( IPOS( nPos ), aSize );
+
+ ImplClearCaches();
+
+ aBmp.CopyPixel( aDstRect, aSrcRect, &rBmp );
+ pInfoAry[ nPos ] &= ~IMPSYSIMAGEITEM_MASK;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Replace( USHORT nPos, const Bitmap& rBmp, const Bitmap& rMaskBmp )
+{
+ Point aPoint;
+ const Rectangle aSrcRect( aPoint, aSize );
+ const Rectangle aDstRect( IPOS( nPos ), aSize );
+
+ ImplClearCaches();
+
+ aBmp.CopyPixel( aDstRect, aSrcRect, &rBmp );
+ aMask.CopyPixel( aDstRect, aSrcRect, &rMaskBmp );
+
+ if( !!aDisa )
+ ImplUpdateDisaBmp( nPos );
+
+ pInfoAry[ nPos ] |= IMPSYSIMAGEITEM_MASK;
+
+#ifdef FASTTRANSPARENT
+ ImplUpdatePaintBmp( nPos );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Replace( USHORT nPos, const Bitmap& rBmp, const Color& rColor )
+{
+ Replace( nPos, rBmp, rBmp.CreateMask( rColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Merge( USHORT nPos, USHORT nSrcPos )
+{
+ if ( !( pInfoAry[ nSrcPos ] & IMPSYSIMAGEITEM_MASK ) )
+ Replace( nPos, nSrcPos );
+ else
+ {
+ ImplClearCaches();
+
+ const Rectangle aSrcRect( IPOS( nSrcPos ), aSize );
+ const Rectangle aDstRect( IPOS( nPos ), aSize );
+ BitmapWriteAccess* pBmp = aBmp.AcquireWriteAccess();
+ BitmapWriteAccess* pMsk = aMask.AcquireWriteAccess();
+
+ if ( pBmp && pMsk )
+ {
+ const BitmapColor aMskBlack( pMsk->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ BitmapColor aDstCol, aSrcCol;
+ long nDstLeft = aDstRect.Left();
+ long nDstRight = aDstRect.Right();
+ long nDstBottom = aDstRect.Bottom();
+ long nSrcLeft = aSrcRect.Left();
+ long nSrcRight = aSrcRect.Right();
+ long nSrcTop = aSrcRect.Bottom();
+
+ for( long nDstY = aDstRect.Top(), nSrcY = aSrcRect.Top(); nDstY <= nDstBottom; nDstY++, nSrcY++ )
+ {
+ for( long nDstX = nDstLeft, nSrcX = nSrcLeft; nDstX <= nDstRight; nDstX++, nSrcX++ )
+ {
+ aDstCol = pMsk->GetPixel( nDstY, nDstX );
+ aSrcCol = pMsk->GetPixel( nSrcY, nSrcX );
+
+ if( aMskBlack == aDstCol )
+ {
+ if( aMskBlack == aSrcCol )
+ pBmp->SetPixel( nDstY, nDstX, pBmp->GetPixel( nSrcY, nSrcX ) );
+ }
+ else if( aMskBlack == aSrcCol )
+ {
+ pBmp->SetPixel( nDstY, nDstX, pBmp->GetPixel( nSrcY, nSrcX ) );
+ pMsk->SetPixel( nDstY, nDstX, aMskBlack );
+ }
+ }
+ }
+ }
+
+ aBmp.ReleaseAccess( pBmp );
+ aMask.ReleaseAccess( pMsk );
+
+ if( !!aDisa )
+ ImplUpdateDisaBmp( nPos );
+
+ pInfoAry[ nPos ] |= IMPSYSIMAGEITEM_MASK;
+
+#ifdef FASTTRANSPARENT
+ ImplUpdatePaintBmp( nPos );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Bitmap ImplImageBmp::GetBitmap( USHORT nPosCount, USHORT* pPosAry ) const
+{
+ Bitmap aNewBmp( Size( nPosCount * aSize.Width(), aSize.Height() ), aBmp.GetBitCount() );
+
+ for( USHORT i = 0; i < nPosCount; i++ )
+ {
+ const Rectangle aSrcRect( IPOS( pPosAry[ i ] ), aSize );
+ const Rectangle aDstRect( IPOS( i ), aSize );
+
+ aNewBmp.CopyPixel( aDstRect, aSrcRect, &aBmp );
+ }
+
+ return aNewBmp;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplImageBmp::HasMaskBitmap() const
+{
+ return( !!aMask );
+}
+
+// -----------------------------------------------------------------------
+
+Bitmap ImplImageBmp::GetMaskBitmap( USHORT nPosCount, USHORT* pPosAry ) const
+{
+ Bitmap aNewMask( Size( nPosCount * aSize.Width(), aSize.Height() ), aMask.GetBitCount() );
+
+ for( USHORT i = 0; i < nPosCount; i++ )
+ {
+ const Rectangle aSrcRect( IPOS( pPosAry[ i ] ), aSize );
+ const Rectangle aDstRect( IPOS( i ), aSize );
+
+ aNewMask.CopyPixel( aDstRect, aSrcRect, &aMask );
+ }
+
+ return aNewMask;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplImageBmp::HasMaskColor() const
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Color ImplImageBmp::GetMaskColor() const
+{
+ return Color();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev,
+ const Point& rPos, USHORT nStyle,
+ const Size* pSize )
+{
+ if( pOutDev->IsDeviceOutputNecessary() )
+ {
+#ifndef REMOTE_APPSERVER
+
+ if( !aBmpDisp && !!aBmp )
+ aBmpDisp = aBmp.CreateDisplayBitmap( pOutDev );
+
+ if( !aMaskDisp && !!aMask )
+ aMaskDisp = aMask.CreateDisplayBitmap( pOutDev );
+
+#else // REMOTE_APPSERVER
+
+ if( !aBmpDisp && !!aBmp )
+ aBmpDisp = aBmp;
+
+ if( !aMaskDisp && !!aMask )
+ aMaskDisp = aMask;
+
+ if( !aDisaDisp && !!aDisa )
+ aDisaDisp = aDisa;
+
+#endif // REMOTE_APPSERVER
+
+ if( !aBmpEx )
+ aBmpEx = BitmapEx( aBmpDisp, aMaskDisp );
+
+ if( pInfoAry[ nPos ] & IMPSYSIMAGEITEM_MASK )
+ {
+#ifdef FASTTRANSPARENT
+ BOOL bTmp = bFastTransparent;
+ bFastTransparent = TRUE;
+#endif
+
+ Point aOutPos = pOutDev->LogicToPixel( rPos );
+ Size aOutSize;
+ BOOL bOldMap = pOutDev->mbMap;
+
+ if( pSize )
+ aOutSize = pOutDev->LogicToPixel( *pSize );
+ else
+ aOutSize = aSize;
+
+ pOutDev->mbMap = FALSE;
+
+ if ( nStyle & IMAGE_DRAW_DISABLE )
+ {
+ Point aOutPos1( aOutPos.X()+1, aOutPos.Y()+1 );
+ const Point aPos( IPOS( nPos) );
+ const StyleSettings& rSettings = pOutDev->GetSettings().GetStyleSettings();
+
+ if( !aDisa )
+ {
+ aDisa = Bitmap( aBmpEx.GetSizePixel(), 1 );
+ ImplUpdateDisaBmp( DISA_ALL );
+#ifndef REMOTE_APPSERVER
+ aDisaDisp = aDisa.CreateDisplayBitmap( pOutDev );
+#else // REMOTE_APPSERVER
+ aDisaDisp = aDisa;
+#endif // REMOTE_APPSERVER
+ }
+
+ if( !aDisaDisp && !!aDisa )
+ aDisaDisp = aDisa.CreateDisplayBitmap( pOutDev );
+
+ pOutDev->DrawMask( aOutPos1, aOutSize, aPos, aSize,
+ aDisaDisp, rSettings.GetLightColor() );
+ pOutDev->DrawMask( aOutPos, aOutSize, aPos, aSize,
+ aDisaDisp, rSettings.GetShadowColor() );
+ }
+ else
+ {
+ BOOL bDrawn = FALSE;
+
+ if( nStyle & ( IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE ) )
+ {
+ Bitmap aTmpBmp( aBmp );
+ BitmapWriteAccess* pAcc;
+
+ aTmpBmp.Crop( Rectangle( IPOS( nPos ), aSize ) );
+ pAcc = aTmpBmp.AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ const StyleSettings& rSettings = pOutDev->GetSettings().GetStyleSettings();
+ Color aColor;
+ BitmapColor aCol;
+ const long nW = pAcc->Width();
+ const long nH = pAcc->Height();
+ BYTE* pMapR = new BYTE[ 256 ];
+ BYTE* pMapG = new BYTE[ 256 ];
+ BYTE* pMapB = new BYTE[ 256 ];
+ long nX, nY;
+
+ if( nStyle & IMAGE_DRAW_HIGHLIGHT )
+ aColor = rSettings.GetHighlightColor();
+ else
+ aColor = rSettings.GetDeactiveColor();
+
+ const BYTE cR = aColor.GetRed();
+ const BYTE cG = aColor.GetGreen();
+ const BYTE cB = aColor.GetBlue();
+
+ for( nX = 0L; nX < 256L; nX++ )
+ {
+ pMapR[ nX ] = (BYTE) ( ( ( nY = ( nX + cR ) >> 1 ) > 255 ) ? 255 : nY );
+ pMapG[ nX ] = (BYTE) ( ( ( nY = ( nX + cG ) >> 1 ) > 255 ) ? 255 : nY );
+ pMapB[ nX ] = (BYTE) ( ( ( nY = ( nX + cB ) >> 1 ) > 255 ) ? 255 : nY );
+ }
+
+ if( pAcc->HasPalette() )
+ {
+ for( USHORT i = 0, nCount = pAcc->GetPaletteEntryCount(); i < nCount; i++ )
+ {
+ const BitmapColor& rCol = pAcc->GetPaletteColor( i );
+ aCol.SetRed( pMapR[ rCol.GetRed() ] );
+ aCol.SetGreen( pMapG[ rCol.GetGreen() ] );
+ aCol.SetBlue( pMapB[ rCol.GetBlue() ] );
+ pAcc->SetPaletteColor( i, aCol );
+ }
+ }
+ else if( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR )
+ {
+ for( nY = 0L; nY < nH; nY++ )
+ {
+ Scanline pScan = pAcc->GetScanline( nY );
+
+ for( nX = 0L; nX < nW; nX++ )
+ {
+ *pScan = pMapB[ *pScan ]; pScan++;
+ *pScan = pMapG[ *pScan ]; pScan++;
+ *pScan = pMapR[ *pScan ]; pScan++;
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0L; nY < nH; nY++ )
+ {
+ for( nX = 0L; nX < nW; nX++ )
+ {
+ aCol = pAcc->GetPixel( nY, nX );
+ aCol.SetRed( pMapR[ aCol.GetRed() ] );
+ aCol.SetGreen( pMapG[ aCol.GetGreen() ] );
+ aCol.SetBlue( pMapB[ aCol.GetBlue() ] );
+ pAcc->SetPixel( nY, nX, aCol );
+ }
+ }
+ }
+
+ delete[] pMapR;
+ delete[] pMapG;
+ delete[] pMapB;
+ aTmpBmp.ReleaseAccess( pAcc );
+
+ Bitmap aTmpMsk( aMask );
+ aTmpMsk.Crop( Rectangle( IPOS( nPos), aSize ) );
+ pOutDev->DrawBitmapEx( aOutPos, BitmapEx( aTmpBmp, aTmpMsk ) );
+ bDrawn = TRUE;
+ }
+ }
+
+ if( !bDrawn )
+ pOutDev->DrawBitmapEx( aOutPos, aOutSize, IPOS( nPos), aSize, aBmpEx );
+ }
+
+ pOutDev->mbMap = bOldMap;
+
+#ifdef FASTTRANSPARENT
+ bFastTransparent = bTmp;
+#endif
+ }
+ else if( pSize )
+ pOutDev->DrawBitmap( rPos, *pSize,
+ IPOS( nPos), aSize, aBmpEx.GetBitmap() );
+ else
+ pOutDev->DrawBitmap( rPos, pOutDev->PixelToLogic( aSize ),
+ IPOS( nPos), aSize, aBmpEx.GetBitmap() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::ImplUpdateDisaBmp( USHORT nPos )
+{
+ BitmapReadAccess* pAcc = aBmp.AcquireReadAccess();
+ BitmapReadAccess* pMsk = aMask.AcquireReadAccess();
+ BitmapWriteAccess* pDis = aDisa.AcquireWriteAccess();
+
+ if( pAcc && pMsk && pDis )
+ {
+ const Color aWhite( COL_WHITE );
+ const Color aBlack( COL_BLACK );
+ const BitmapColor aAccWhite( pAcc->GetBestMatchingColor( aWhite ) );
+ const BitmapColor aMskWhite( pMsk->GetBestMatchingColor( aWhite ) );
+ const BitmapColor aDisWhite( pDis->GetBestMatchingColor( aWhite ) );
+ const BitmapColor aDisBlack( pDis->GetBestMatchingColor( aBlack ) );
+ long nLeft;
+ long nTop;
+ long nRight;
+ long nBottom;
+
+ if( DISA_ALL != nPos )
+ {
+ const Point aPos( IPOS( nPos ) );
+
+ nLeft = aPos.X();
+ nTop = aPos.Y();
+ nRight = nLeft + aSize.Width();
+ nBottom = nTop + aSize.Height();
+ }
+ else
+ {
+ nLeft = nTop = 0L;
+ nRight = pDis->Width();
+ nBottom = pDis->Height();
+ }
+
+ if( pAcc->GetScanlineFormat() == BMP_FORMAT_4BIT_MSN_PAL &&
+ pMsk->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL )
+ {
+ // optimized version
+ const BYTE cAccTest = aAccWhite.GetIndex();
+ const BYTE cMskTest = aMskWhite.GetIndex();
+
+ for( long nY = nTop; nY < nBottom; nY++ )
+ {
+ Scanline pAccScan = pAcc->GetScanline( nY );
+ Scanline pMskScan = pMsk->GetScanline( nY );
+
+ for( long nX = nLeft; nX < nRight; nX++ )
+ {
+ if( ( cMskTest == ( pMskScan[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 ) ) ||
+ ( cAccTest == ( ( pAccScan[ nX >> 1 ] >> ( nX & 1 ? 0 : 4 ) ) & 0x0f ) ) )
+ {
+ pDis->SetPixel( nY, nX, aDisWhite );
+ }
+ else
+ pDis->SetPixel( nY, nX, aDisBlack );
+ }
+ }
+ }
+ else if( pAcc->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL &&
+ pMsk->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL )
+ {
+ // optimized version
+ const BYTE cAccTest = aAccWhite.GetIndex();
+ const BYTE cMskTest = aMskWhite.GetIndex();
+
+ for( long nY = nTop; nY < nBottom; nY++ )
+ {
+ Scanline pAccScan = pAcc->GetScanline( nY );
+ Scanline pMskScan = pMsk->GetScanline( nY );
+
+ for( long nX = nLeft; nX < nRight; nX++ )
+ {
+ if( ( cMskTest == ( pMskScan[ nX >> 3 ] & ( 1 << ( 7 - ( nX & 7 ) ) ) ? 1 : 0 ) ) ||
+ ( cAccTest == pAccScan[ nX ] ) )
+ {
+ pDis->SetPixel( nY, nX, aDisWhite );
+ }
+ else
+ pDis->SetPixel( nY, nX, aDisBlack );
+ }
+ }
+ }
+ else
+ {
+ for( long nY = nTop; nY < nBottom; nY++ )
+ {
+ for( long nX = nLeft; nX < nRight; nX++ )
+ {
+ if( ( aMskWhite == pMsk->GetPixel( nY, nX ) ) || ( aAccWhite == pAcc->GetPixel( nY, nX ) ) )
+ pDis->SetPixel( nY, nX, aDisWhite );
+ else
+ pDis->SetPixel( nY, nX, aDisBlack );
+ }
+ }
+ }
+ }
+
+ aBmp.ReleaseAccess( pAcc );
+ aMask.ReleaseAccess( pMsk );
+ aDisa.ReleaseAccess( pDis );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::ImplUpdatePaintBmp( USHORT nPos )
+{
+ BitmapWriteAccess* pBmp = aBmp.AcquireWriteAccess();
+ BitmapReadAccess* pMsk = aMask.AcquireReadAccess();
+
+ if ( pBmp && pMsk )
+ {
+ const Color aBlack( COL_BLACK );
+ const BitmapColor aBmpBlack( pBmp->GetBestMatchingColor( aBlack ) );
+ const BitmapColor aMskBlack( pMsk->GetBestMatchingColor( aBlack ) );
+ long nLeft, nTop, nRight, nBottom;
+
+ if( PAINT_ALL != nPos )
+ {
+ const Point aPos( IPOS( nPos ) );
+
+ nLeft = aPos.X();
+ nTop = aPos.Y();
+ nRight = nLeft + aSize.Width();
+ nBottom = nTop + aSize.Height();
+ }
+ else
+ {
+ nLeft = nTop = 0L;
+ nRight = pBmp->Width();
+ nBottom = pBmp->Height();
+ }
+
+ for( long nY = nTop; nY < nBottom; nY++ )
+ for( long nX = nLeft; nX < nRight; nX++ )
+ if( aMskBlack != pMsk->GetPixel( nY, nX ) )
+ pBmp->SetPixel( nY, nX, aBmpBlack );
+ }
+
+ aBmp.ReleaseAccess( pBmp );
+ aMask.ReleaseAccess( pMsk );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplImageBmp::ImplClearCaches()
+{
+ aBmpEx.Clear();
+ aBmpDisp = aMaskDisp = aDisaDisp = Bitmap();
+}
diff --git a/vcl/source/gdi/implncvt.cxx b/vcl/source/gdi/implncvt.cxx
new file mode 100644
index 000000000000..98a428d36380
--- /dev/null
+++ b/vcl/source/gdi/implncvt.cxx
@@ -0,0 +1,605 @@
+/*************************************************************************
+ *
+ * $RCSfile: implncvt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALBTYPE_HXX
+#include "salbtype.hxx"
+#endif
+#ifndef _SV_IMPLNCVT_HXX
+#include "implncvt.hxx"
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define CURVE_LEFT 1
+#define CURVE_RIGHT 2
+#define CURVE_STRAIGHTON 3
+
+// -----------------
+// - ImplFloatPoint
+// -----------------
+
+struct ImplFloatPoint
+{
+ double fX;
+ double fY;
+
+ inline ImplFloatPoint() {}
+ inline ImplFloatPoint( const Point& rPoint ) { fX = rPoint.X(); fY = rPoint.Y(); }
+ inline ImplFloatPoint( double _fX, double _fY ) { fX = _fX; fY = _fY; }
+ inline ImplFloatPoint( const ImplFloatPoint& rPoint ) { fX = rPoint.fX; fY = rPoint.fY; }
+ inline ~ImplFloatPoint() {}
+
+ void operator+=( const ImplFloatPoint& rPoint ) { fX += rPoint.fX; fY += rPoint.fY; }
+ void operator-=( const ImplFloatPoint& rPoint ) { fX -= rPoint.fX; fY -= rPoint.fY; }
+ void operator*=( const double& rD ) { fX *= rD; fY *= rD; }
+ BOOL operator==( const ImplFloatPoint& rPoint ) const { return ( ( rPoint.fX == fX ) && ( rPoint.fY == fY ) ); } const
+ void operator=( const Point rPoint ) { fX = rPoint.X(); fY = rPoint.Y(); }
+
+ ImplFloatPoint GetOVec( const ImplFloatPoint& rPoint ) const;
+ ImplFloatPoint GetNVec( const ImplFloatPoint& rPoint ) const;
+};
+
+// -----------------------------------------------------------------------------
+
+ImplFloatPoint ImplFloatPoint::GetOVec( const ImplFloatPoint& rPoint ) const
+{
+ double fxt = rPoint.fX - fX;
+ double fyt = rPoint.fY - fY;
+ double fL;
+
+ if( fyt != 0.0 )
+ {
+ fyt = -fxt / fyt;
+ fL = sqrt( 1 + fyt * fyt );
+
+ return ImplFloatPoint( 1.0 / fL, fyt / fL );
+ }
+ else
+ return ImplFloatPoint( fyt, ( fxt > 0.0 ) ? 1.0 : -1.0 );
+};
+
+// -----------------------------------------------------------------------------
+
+ImplFloatPoint ImplFloatPoint::GetNVec( const ImplFloatPoint& rPoint ) const
+{
+ const double fxt = rPoint.fX - fX;
+ const double fyt = rPoint.fY - fY;
+ const double fL = hypot( fxt, fyt );
+
+ return ImplFloatPoint( fxt / fL, fyt / fL );
+};
+
+// --------------------
+// - ImplLineConverter
+// --------------------
+
+ImplLineConverter::ImplLineConverter( const Polygon& rPolygon, const LineInfo& rLineInfo, const Point* pRefPoint ) :
+ maLineInfo ( rLineInfo ),
+ mfWidthHalf ( rLineInfo.GetWidth() >> 1 ),
+ mpFloatPoint ( NULL ),
+ mpFloat0 ( new ImplFloatPoint[ 6 ] ),
+ mpFloat1 ( new ImplFloatPoint[ 6 ] ),
+ mnLines ( 0 )
+{
+ UINT16 nIndex, nPolySize = rPolygon.GetSize();
+ if ( nPolySize )
+ {
+ if( rPolygon.GetFlags( 0 ) == POLY_NORMAL )
+ {
+ mpFloatPoint = new ImplFloatPoint[ nPolySize ];
+ mpFloatPoint[ 0 ] = rPolygon[ 0 ];
+
+ nIndex = 0;
+
+ while( ++nIndex < nPolySize ) // doppelte Punkte eliminieren und ein FloatPointArray anlegen
+ {
+ if( rPolygon.GetFlags( nIndex ) == POLY_NORMAL )
+ {
+ double nxt = mpFloatPoint[ mnLines ].fX;
+ double nyt = mpFloatPoint[ mnLines ].fY;
+
+ if ( ( nxt == rPolygon[ nIndex ].X() ) && ( nyt == rPolygon[ nIndex ].Y() ) )
+ continue;
+
+ mpFloatPoint[ ++mnLines ] = rPolygon[ nIndex ];
+ }
+ else
+ {
+ DBG_ERROR( "Bezier points not supported!" );
+ }
+ }
+ mbClosed = ( mpFloatPoint[ 0 ] == mpFloatPoint[ mnLines ] ) ;
+
+ if ( ( mnLines == 1 ) && ( maLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ BOOL bX = mpFloatPoint[ 0 ].fY == mpFloatPoint[ 1 ].fY;
+ BOOL bY = mpFloatPoint[ 0 ].fX == mpFloatPoint[ 1 ].fX;
+ mbRefPoint = pRefPoint && ( bX || bY );
+ if ( mbRefPoint )
+ {
+ if ( !maLineInfo.GetDashCount() )
+ {
+ maLineInfo.SetDashCount( maLineInfo.GetDotCount() );
+ maLineInfo.SetDashLen( maLineInfo.GetDotLen() );
+ maLineInfo.SetDotCount( 0 );
+ }
+ INT32 nDistance = maLineInfo.GetDistance();
+ INT32 nDashLen = maLineInfo.GetDashCount() * ( maLineInfo.GetDashLen() + nDistance );
+ INT32 nDotLen = maLineInfo.GetDotCount() * ( maLineInfo.GetDotLen() + nDistance );
+ if ( bX )
+ {
+ if ( mpFloatPoint[ 1 ].fX > mpFloatPoint[ 0 ].fX )
+ {
+ ImplFloatPoint aFloat = mpFloatPoint[ 0 ];
+ mpFloatPoint[ 0 ] = mpFloatPoint[ 1 ];
+ mpFloatPoint[ 1 ] = aFloat;
+ }
+ mnRefDistance = (INT32)mpFloatPoint[ mnLines ].fX - pRefPoint->X();
+ }
+ else
+ {
+ if ( mpFloatPoint[ 1 ].fY > mpFloatPoint[ 0 ].fY )
+ {
+ ImplFloatPoint aFloat = mpFloatPoint[ 0 ];
+ mpFloatPoint[ 0 ] = mpFloatPoint[ 1 ];
+ mpFloatPoint[ 1 ] = aFloat;
+ }
+ mnRefDistance = (INT32)mpFloatPoint[ mnLines ].fY - pRefPoint->Y();
+ }
+
+// mnRefDistance = ( (INT32)mpFloatPoint[ mnLines ].fX - pRefPoint->X() ) +
+// ( (INT32)mpFloatPoint[ mnLines ].fY - pRefPoint->Y() );
+
+ mnRefDistance = mnRefDistance % ( nDashLen + nDotLen );
+ if ( mnRefDistance < 0 )
+ mnRefDistance = ( nDashLen + nDotLen ) + mnRefDistance;
+ }
+ }
+ }
+ }
+};
+
+//------------------------------------------------------------------------
+
+ImplLineConverter::~ImplLineConverter()
+{
+ delete[] mpFloat0;
+ delete[] mpFloat1;
+ delete[] mpFloatPoint;
+};
+
+//------------------------------------------------------------------------
+
+const Polygon* ImplLineConverter::ImplGetFirst()
+{
+ mnFloat1Points = 0;
+ mnLinesAvailable = mnLines;
+
+ if ( mnLines )
+ {
+ if ( maLineInfo.GetStyle() == LINE_DASH )
+ {
+ mnDashCount = maLineInfo.GetDashCount();
+ mnDotCount = maLineInfo.GetDotCount();
+ mfDashDotLenght = mnDashCount ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen();
+
+ if ( mbRefPoint )
+ {
+ INT32 nDistance = maLineInfo.GetDistance();
+ INT32 nDashLen = maLineInfo.GetDashLen() + nDistance;
+ INT32 nDashesLen = maLineInfo.GetDashCount() * nDashLen;
+ INT32 nDotLen = maLineInfo.GetDotLen() + nDistance;
+ INT32 nDotsLen = maLineInfo.GetDotCount() * nDotLen;
+
+ if ( mnRefDistance >= nDashesLen )
+ {
+ // get dotcount
+ if ( nDotLen )
+ {
+ INT32 nLen = ( mnRefDistance - nDashesLen ) % nDotLen;
+ if ( nLen >= maLineInfo.GetDotLen() )
+ {
+ mnDotCount -= 1 + ( mnRefDistance - nDashesLen ) / nDotLen;
+ if ( mnDotCount )
+ mnDashCount = 0;
+ else
+ mnDotCount = maLineInfo.GetDotCount();
+ mfDashDotLenght = 0.0;
+ mfDistanceLenght = ( maLineInfo.GetDotLen() + nDistance ) - nLen;
+ }
+ else
+ {
+ mnDashCount = 0;
+ mfDashDotLenght = maLineInfo.GetDotLen() - nLen;
+ mnDotCount -= ( mnRefDistance - nDashesLen ) / nDotLen;
+ }
+ }
+ }
+ else
+ {
+ if ( nDashLen )
+ {
+ // get dashcount
+ INT32 nLen = mnRefDistance % nDashLen;
+ if ( nLen >= maLineInfo.GetDashLen() )
+ {
+ mfDashDotLenght = 0.0;
+ mfDistanceLenght = ( maLineInfo.GetDashLen() + nDistance ) - nLen;
+ mnDashCount -= 1 + ( mnRefDistance / nDashLen );
+ }
+ else
+ {
+ mfDashDotLenght = maLineInfo.GetDashLen() - nLen;
+ mnDashCount -= ( mnRefDistance / nDashLen );
+ }
+ }
+ }
+ if ( ! ( mnDashCount | mnDotCount ) )
+ {
+ mnDashCount = maLineInfo.GetDashCount();
+ mnDotCount = maLineInfo.GetDotCount();
+ }
+ if ( ( mfDashDotLenght == 0.0 ) && ( mfDistanceLenght == 0.0 ) )
+ mfDistanceLenght = maLineInfo.GetDistance();
+ }
+ }
+ }
+ return ImplGetNext();
+};
+
+//------------------------------------------------------------------------
+
+const Polygon* ImplLineConverter::ImplGetNext()
+{
+ while( mnFloat1Points || mnLinesAvailable )
+ {
+ if ( maLineInfo.GetWidth() > 1 )
+ {
+ if ( !mnFloat1Points )
+ {
+ ImplFloatPoint aPointA( mpFloatPoint[ mnLinesAvailable-- ] );
+ ImplFloatPoint aPointB( mpFloatPoint[ mnLinesAvailable ] );
+ ImplFloatPoint aOVecAB( aPointA.GetOVec( aPointB ) );
+ ImplFloatPoint aN1Vec( aPointA.GetNVec( aPointB ) );
+ aN1Vec *= mfWidthHalf;
+
+ if ( !mbClosed && ( ( mnLinesAvailable + 1 ) == mnLines ) )
+ aPointA -= aN1Vec;
+
+ aOVecAB *= mfWidthHalf;
+ mpFloat0[ 0 ] = aPointA;
+ mpFloat0[ 0 ] -= aOVecAB;
+ mpFloat0[ 3 ] = aPointA;
+ mpFloat0[ 3 ] += aOVecAB;
+ mpFloat0[ 1 ] = aPointB;
+ mpFloat0[ 1 ] -= aOVecAB;
+ mpFloat0[ 2 ] = aPointB;
+ mpFloat0[ 2 ] += aOVecAB;
+
+ double f1D = ( aN1Vec.fX == 0 ) ? 1 : ( aN1Vec.fY / aN1Vec.fX );
+ double f2D = -f1D;
+
+ mnFloat0Points = 4;
+
+ int nDirection;
+
+ BOOL bContinues = ( mnLinesAvailable || mbClosed );
+ if ( bContinues )
+ {
+ ImplFloatPoint aPointC;
+
+ if ( mnLinesAvailable )
+ aPointC = mpFloatPoint[ mnLinesAvailable - 1 ];
+ else
+ aPointC = mpFloatPoint[ mnLines - 1 ];
+
+ ImplFloatPoint aOVecBC( aPointB.GetOVec( aPointC ) );
+ aOVecBC *= mfWidthHalf;
+ ImplFloatPoint aPointR0( aPointB );
+ aPointR0 -= aOVecBC;
+ ImplFloatPoint aPointR1( aPointB );
+ aPointR1 += aOVecBC;
+ ImplFloatPoint aN2Vec( aPointB.GetNVec( aPointC ) );
+ aN2Vec *= mfWidthHalf;
+
+ f2D = ( aN2Vec.fX == 0 ) ? 1 : ( aN2Vec.fY / aN2Vec.fX );
+ if ( f1D == f2D )
+ nDirection = CURVE_STRAIGHTON;
+ else
+ {
+ if ( ( aN1Vec.fX * aN2Vec.fY - aN1Vec.fY * aN2Vec.fX ) > 0 )
+ nDirection = CURVE_LEFT;
+ else
+ nDirection = CURVE_RIGHT;
+ }
+ if ( nDirection != CURVE_STRAIGHTON )
+ {
+ double fWidth;
+ ImplFloatPoint aDestPoint;
+ if ( hypot( aPointR0.fX - aPointA.fX, aPointR0.fY - aPointA.fY ) > hypot( aPointR1.fX - aPointA.fX, aPointR1.fY - aPointA.fY ) )
+ aDestPoint = aPointR0;
+ else
+ aDestPoint = aPointR1;
+
+ UINT16 nFirst = 0;
+ if ( aN1Vec.fY > 0 )
+ {
+ if ( nDirection != CURVE_RIGHT )
+ nFirst++;
+ }
+ else
+ {
+ if ( nDirection == CURVE_RIGHT )
+ nFirst++;
+ }
+ fWidth = hypot( mpFloat0[ 1 + nFirst ].fX - aDestPoint.fX, mpFloat0[ 1 + nFirst ].fY - aDestPoint.fY );
+ fWidth = sqrt( fWidth * fWidth / 2 );
+ if ( fWidth > mfWidthHalf )
+ {
+ // Spitzer Winkel :
+ mnFloat0Points = 6;
+ mpFloat0[ 4 + nFirst ^ 1 ] = aDestPoint;
+ aDestPoint -= aN2Vec;
+ mpFloat0[ 4 + nFirst ] = aDestPoint;
+ mpFloat0[ 1 + nFirst ] += aN1Vec;
+ }
+ else
+ {
+ // Stumpferwinkel : Schnittpunkt wird berechnet
+ mnFloat0Points = 5;
+ ImplFloatPoint aSourcePoint;
+ double fX, fY, fBDest, fBSource;
+ aSourcePoint = mpFloat0[ 1 + nFirst ];
+
+ int nValid = 0;
+
+ if ( ( aN2Vec.fX ) == 0 )
+ {
+ fX = aDestPoint.fX;
+ nValid = 1;
+ }
+ else
+ fBDest = aDestPoint.fY - ( aN2Vec.fY / aN2Vec.fX * aDestPoint.fX );
+
+ if ( ( aN1Vec.fX ) == 0 )
+ {
+ fX = aSourcePoint.fX;
+ nValid = 2;
+ }
+ else
+ fBSource = aSourcePoint.fY - ( aN1Vec.fY / aN1Vec.fX * aSourcePoint.fX );
+
+ if ( !nValid )
+ fX = ( fBSource - fBDest ) / ( aN2Vec.fY / aN2Vec.fX - aN1Vec.fY / aN1Vec.fX );
+ if ( nValid < 2 )
+ fY = aN1Vec.fY / aN1Vec.fX * fX + fBSource;
+ else
+ fY = aN2Vec.fY / aN2Vec.fX * fX + fBDest;
+
+ mpFloat0[ 1 + nFirst ].fX = fX;
+ mpFloat0[ 1 + nFirst ].fY = fY;
+ mpFloat0[ 4 ] = aDestPoint;
+ }
+ }
+ else if ( ( aN1Vec.fX - aN2Vec.fX + aN1Vec.fY - aN2Vec.fY ) != 0 ) // besitzt zweiter Richtungsvektor die gleiche Steigung aber andere
+ bContinues = FALSE; // Richtung, dann wird hinten noch eine halbe Linienbreite angehaengt
+ }
+ if ( !bContinues )
+ {
+ mpFloat0[ 1 ] += aN1Vec;
+ mpFloat0[ 2 ] += aN1Vec;
+ }
+ }
+ else
+ {
+ mnFloat0Points = mnFloat1Points;
+ ImplFloatPoint* pTemp = mpFloat1;
+ mpFloat1 = mpFloat0;
+ mpFloat0 = pTemp;
+ }
+ if ( maLineInfo.GetStyle() == LINE_DASH )
+ {
+ double fLenghtDone = 0;
+ double fLenght = ( mfDashDotLenght > 0.0 ) ? mfDashDotLenght : mfDistanceLenght;
+
+ double fDistance;
+
+ fDistance = hypot( mpFloat0[ 0 ].fX - mpFloat0[ 1 ].fX, mpFloat0[ 0 ].fY - mpFloat0[ 1 ].fY );
+ if ( mnFloat0Points == 5 )
+ {
+ double fDist = hypot( mpFloat0[ 2 ].fX - mpFloat0[ 3 ].fX, mpFloat0[ 2 ].fY - mpFloat0[ 3 ].fY );
+ if ( fDist < fDistance )
+ fDistance = fDist;
+ }
+
+ if ( fDistance > fLenght )
+ {
+ fLenghtDone = fLenght;
+
+ ImplFloatPoint aNVec( mpFloat0[ 0 ].GetNVec( mpFloat0[ 1 ] ) );
+ aNVec *= fLenght;
+ mnFloat1Points = mnFloat0Points;
+ ImplFloatPoint* pTemp = mpFloat1;
+ mpFloat1 = mpFloat0;
+ mpFloat0 = pTemp;
+ mnFloat0Points = 4;
+ mpFloat0[ 0 ] = mpFloat0[ 1 ] = mpFloat1[ 0 ];
+ mpFloat0[ 1 ] += aNVec;
+ mpFloat0[ 2 ] = mpFloat0[ 3 ] = mpFloat1[ 3 ];
+ mpFloat0[ 2 ] += aNVec;
+
+ mpFloat1[ 0 ] = mpFloat0[ 1 ];
+ mpFloat1[ 3 ] = mpFloat0[ 2 ];
+ }
+ else
+ {
+ mnFloat1Points = 0;
+ fLenghtDone = fDistance;
+ }
+
+ if ( mfDashDotLenght > 0.0 )
+ { // Ein Dash oder Dot wurde erzeugt
+ mfDashDotLenght -= fLenghtDone;
+ if ( mfDashDotLenght == 0.0 )
+ { // Komplett erzeugt
+ if ( mnDashCount )
+ mnDashCount--;
+ else
+ mnDotCount--;
+
+ if ( ! ( mnDashCount | mnDotCount ) )
+ {
+ mnDashCount = maLineInfo.GetDashCount();
+ mnDotCount = maLineInfo.GetDotCount();
+ }
+ mfDistanceLenght = maLineInfo.GetDistance();
+ }
+ }
+ else
+ { // Das erzeugte Polygon muessen wir ignorieren
+ mfDistanceLenght -= fLenghtDone;
+ if ( mfDistanceLenght == 0.0 )
+ mfDashDotLenght = ( mnDashCount ) ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen();
+ continue;
+ }
+ }
+ maPolygon.SetSize( (UINT16)mnFloat0Points );
+ UINT16 i = 0;
+ maPolygon[ i++ ] = Point( FRound( mpFloat0[ 0 ].fX ), FRound( mpFloat0[ 0 ].fY ) );
+ maPolygon[ i++ ] = Point( FRound( mpFloat0[ 1 ].fX ), FRound( mpFloat0[ 1 ].fY ) );
+ if ( mnFloat0Points > 4 )
+ maPolygon[ i++ ] = Point( FRound( mpFloat0[ 4 ].fX ), FRound( mpFloat0[ 4 ].fY ) );
+ if ( mnFloat0Points > 5 )
+ maPolygon[ i++ ] = Point( FRound( mpFloat0[ 5 ].fX ), FRound( mpFloat0[ 5 ].fY ) );
+ maPolygon[ i++ ] = Point( FRound( mpFloat0[ 2 ].fX ), FRound( mpFloat0[ 2 ].fY ) );
+ maPolygon[ i ] = Point( FRound( mpFloat0[ 3 ].fX ), FRound( mpFloat0[ 3 ].fY ) );
+
+ }
+ else
+ {
+ if ( !mnFloat1Points )
+ {
+ mpFloat0[ 0 ] = mpFloatPoint[ mnLinesAvailable-- ];
+ mpFloat0[ 1 ] = mpFloatPoint[ mnLinesAvailable ];
+ }
+ else
+ {
+ mpFloat0[ 0 ] = mpFloat1[ 0 ];
+ mpFloat0[ 1 ] = mpFloat1[ 1 ];
+ }
+ if ( maLineInfo.GetStyle() == LINE_DASH )
+ {
+ double fLenghtDone = 0;
+ double fLenght = ( mfDashDotLenght > 0.0 ) ? mfDashDotLenght : mfDistanceLenght;
+ double fDistance;
+ fDistance = hypot( mpFloat0[ 0 ].fX - mpFloat0[ 1 ].fX, mpFloat0[ 0 ].fY - mpFloat0[ 1 ].fY );
+ if ( fDistance > fLenght )
+ {
+ fLenghtDone = fLenght;
+ ImplFloatPoint aNVec( mpFloat0[ 0 ].GetNVec( mpFloat0[ 1 ] ) );
+ aNVec *= fLenght;
+ mpFloat1[ 1 ] = mpFloat0[ 1 ];
+ mpFloat0[ 1 ] = mpFloat0[ 0 ];
+ mpFloat0[ 1 ] += aNVec;
+ mpFloat1[ 0 ] = mpFloat0[ 1 ];
+ mnFloat1Points = 2;
+ }
+ else
+ {
+ mnFloat1Points = 0;
+ fLenghtDone = fDistance;
+ }
+ if ( mfDashDotLenght > 0.0 )
+ { // Ein Dash oder Dot wurde erzeugt
+ mfDashDotLenght -= fLenghtDone;
+ if ( mfDashDotLenght == 0.0 )
+ { // Komplett erzeugt
+ if ( mnDashCount )
+ mnDashCount--;
+ else
+ mnDotCount--;
+
+ if ( ! ( mnDashCount | mnDotCount ) )
+ {
+ mnDashCount = maLineInfo.GetDashCount();
+ mnDotCount = maLineInfo.GetDotCount();
+ }
+ mfDistanceLenght = maLineInfo.GetDistance();
+ }
+ }
+ else
+ { // Das erzeugte Polygon muessen wir ignorieren
+ mfDistanceLenght -= fLenghtDone;
+ if ( mfDistanceLenght == 0.0 )
+ mfDashDotLenght = ( mnDashCount ) ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen();
+ continue;
+ }
+ }
+ maPolygon.SetSize( 2 );
+ maPolygon[ 0 ] = Point( (long)mpFloat0[ 0 ].fX, (long)mpFloat0[ 0 ].fY );
+ maPolygon[ 1 ] = Point( (long)mpFloat0[ 1 ].fX, (long)mpFloat0[ 1 ].fY );
+ }
+ return &maPolygon;
+ }
+ return NULL;
+};
diff --git a/vcl/source/gdi/implncvt.hxx b/vcl/source/gdi/implncvt.hxx
new file mode 100644
index 000000000000..5b4aa5bcee6e
--- /dev/null
+++ b/vcl/source/gdi/implncvt.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: implncvt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_LINECONV_HXX
+#define _SV_LINECONV_HXX
+
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_LINEINFO_HXX
+#include <lineinfo.hxx>
+#endif
+
+// --------------------
+// - ImplLineConverter
+// --------------------
+
+struct ImplFloatPoint;
+
+class ImplLineConverter
+{
+ BOOL mbClosed;
+ BOOL mbRefPoint;
+ INT32 mnRefDistance;
+
+ double mfWidthHalf;
+ LineInfo maLineInfo;
+
+ double mfDashDotLenght;
+ double mfDistanceLenght;
+
+ UINT32 mnDashCount;
+ UINT32 mnDotCount;
+
+ Polygon maPolygon;
+ UINT32 mnFloat0Points;
+ ImplFloatPoint* mpFloat0;
+ UINT32 mnFloat1Points;
+ ImplFloatPoint* mpFloat1;
+
+ UINT32 mnLinesAvailable;
+ UINT32 mnLines;
+
+ ImplFloatPoint* mpFloatPoint;
+
+ public:
+
+ ImplLineConverter( const Polygon& rPoly, const LineInfo& rLineInfo, const Point* pRefPoint );
+ ~ImplLineConverter();
+
+ const Polygon* ImplGetFirst();
+ const Polygon* ImplGetNext();
+};
+
+#endif
diff --git a/vcl/source/gdi/impprn.cxx b/vcl/source/gdi/impprn.cxx
new file mode 100644
index 000000000000..ce41b8cce763
--- /dev/null
+++ b/vcl/source/gdi/impprn.cxx
@@ -0,0 +1,256 @@
+/*************************************************************************
+ *
+ * $RCSfile: impprn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef REMOTE_APPSERVER
+
+#define _SV_IMPPRN_CXX
+#define _SPOOLPRINTER_EXT
+
+#ifndef _QUEUE_HXX
+#include <tools/queue.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_IMPPRN_HXX
+#include <impprn.hxx>
+#endif
+
+// =======================================================================
+
+struct QueuePage
+{
+ GDIMetaFile* mpMtf;
+ JobSetup* mpSetup;
+ USHORT mnPage;
+ BOOL mbEndJob;
+
+ QueuePage() { mpMtf = NULL; mpSetup = NULL; }
+ ~QueuePage() { delete mpMtf; if ( mpSetup ) delete mpSetup; }
+};
+
+// =======================================================================
+
+ImplQPrinter::ImplQPrinter( Printer* pParent ) :
+ Printer( pParent->GetName() )
+{
+ SetSelfAsQueuePrinter( TRUE );
+ SetPrinterProps( pParent );
+ SetPageQueueSize( 0 );
+ mpParent = pParent;
+ mnCopyCount = pParent->mnCopyCount;
+ mbCollateCopy = pParent->mbCollateCopy;
+ mpQueue = new Queue( mpParent->GetPageQueueSize() );
+ mbAborted = FALSE;
+ mbUserCopy = FALSE;
+ mbDestroyAllowed= TRUE;
+ mbDestroyed = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplQPrinter::~ImplQPrinter()
+{
+ QueuePage* pQueuePage = (QueuePage*)mpQueue->Get();
+ while ( pQueuePage )
+ {
+ delete pQueuePage;
+ pQueuePage = (QueuePage*)mpQueue->Get();
+ }
+
+ delete mpQueue;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplQPrinter::Destroy()
+{
+ if( mbDestroyAllowed )
+ delete this;
+ else
+ mbDestroyed = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ImplQPrinter, ImplPrintHdl, Timer*, EMPTYARG )
+{
+ // Ist Drucken abgebrochen wurden?
+ if ( !IsPrinting() )
+ return 0;
+
+ // Nur drucken, wenn genuegend Seiten im Cache stehen
+ if ( mpParent->IsJobActive() && (mpQueue->Count() < (ULONG)mpParent->GetPageQueueSize()) )
+ return 0;
+
+ // Druck-Job zuende?
+ QueuePage* pActPage = (QueuePage*) mpQueue->Get();
+
+ if ( pActPage->mbEndJob )
+ {
+ maTimer.Stop();
+ delete pActPage;
+ EndJob();
+ mpParent->ImplEndPrint();
+ }
+ else
+ {
+ USHORT nCopyCount = 1;
+ GDIMetaFile aMtf;
+
+ mbDestroyAllowed = FALSE;
+ GetPreparedMetaFile( *pActPage->mpMtf, aMtf );
+
+ if ( mbUserCopy && !mbCollateCopy )
+ nCopyCount = mnCopyCount;
+
+ for ( USHORT i = 0; i < nCopyCount; i++ )
+ {
+ ULONG nActionPos = 0UL;
+
+ if ( pActPage->mpSetup )
+ {
+ SetJobSetup( *pActPage->mpSetup );
+ if ( mbAborted )
+ break;
+ }
+
+ StartPage();
+
+ if ( mbAborted )
+ break;
+
+ for( MetaAction* pAct = aMtf.FirstAction(); pAct; pAct = aMtf.NextAction() )
+ {
+ pAct->Execute( this );
+ Application::Reschedule();
+
+ if( mbAborted )
+ break;
+ }
+
+ if( !mbAborted )
+ EndPage();
+ else
+ break;
+ }
+
+ delete pActPage;
+ mbDestroyAllowed = TRUE;
+
+ if( mbDestroyed )
+ Destroy();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplQPrinter::StartQueuePrint()
+{
+ maTimer.SetTimeout( 50 );
+ maTimer.SetTimeoutHdl( LINK( this, ImplQPrinter, ImplPrintHdl ) );
+ maTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplQPrinter::EndQueuePrint()
+{
+ QueuePage* pQueuePage = new QueuePage;
+ pQueuePage->mbEndJob = TRUE;
+ mpQueue->Put( pQueuePage );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplQPrinter::AbortQueuePrint()
+{
+ maTimer.Stop();
+ mbAborted = TRUE;
+ AbortJob();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplQPrinter::AddQueuePage( GDIMetaFile* pPage, USHORT nPage, BOOL bNewJobSetup )
+{
+ QueuePage* pQueuePage = new QueuePage;
+ pQueuePage->mpMtf = pPage;
+ pQueuePage->mnPage = nPage;
+ pQueuePage->mbEndJob = FALSE;
+ if ( bNewJobSetup )
+ pQueuePage->mpSetup = new JobSetup( mpParent->GetJobSetup() );
+ mpQueue->Put( pQueuePage );
+}
+
+#endif
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
new file mode 100644
index 000000000000..2a3e27ebf2c5
--- /dev/null
+++ b/vcl/source/gdi/impvect.cxx
@@ -0,0 +1,1267 @@
+/*************************************************************************
+ *
+ * $RCSfile: impvect.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IMPVECT_CXX
+
+#include <stdlib.h>
+#include <tools/new.hxx>
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_VECTORIZ_HXX
+#include <impvect.hxx>
+#endif
+
+// !!! ggf. einkommentieren, um Bitmaps zu erzeugen (nur, wenn File mit Debug uebersetzt wurde)
+// #define DEBUG_BMPOUTPUT
+
+#if defined DEBUG && defined DEBUG_BMPOUTPUT
+#define DBG_BMP 1
+#else
+#undef DBG_BMP
+#endif
+
+#ifdef DBG_BMP
+#include <tools/stream.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define VECT_POLY_MAX 8192
+
+// -----------------------------------------------------------------------------
+
+#define VECT_FREE_INDEX 0
+#define VECT_CONT_INDEX 1
+#define VECT_DONE_INDEX 2
+
+// -----------------------------------------------------------------------------
+
+#define VECT_POLY_INLINE_INNER 1UL
+#define VECT_POLY_INLINE_OUTER 2UL
+#define VECT_POLY_OUTLINE_INNER 4UL
+#define VECT_POLY_OUTLINE_OUTER 8UL
+
+// -----------------------------------------------------------------------------
+
+#define VECT_MAP( _def_pIn, _def_pOut, _def_nVal ) _def_pOut[_def_nVal]=(_def_pIn[_def_nVal]=((_def_nVal)*4L)+1L)+5L;
+#define BACK_MAP( _def_nVal ) ((((_def_nVal)+2)>>2)-1)
+#define VECT_PROGRESS( _def_pProgress, _def_nVal ) if(_def_pProgress&&_def_pProgress->IsSet())(_def_pProgress->Call((void*)_def_nVal));
+
+// -----------
+// - statics -
+// -----------
+
+struct ChainMove { long nDX; long nDY; };
+
+static ChainMove aImplMove[ 8 ] = {
+ { 1L, 0L },
+ { 0L, -1L },
+ { -1L, 0L },
+ { 0L, 1L },
+ { 1L, -1L },
+ { -1, -1L },
+ { -1L, 1L },
+ { 1L, 1L }
+ };
+
+static ChainMove aImplMoveInner[ 8 ] = {
+ { 0L, 1L },
+ { 1L, 0L },
+ { 0L, -1L },
+ { -1L, 0L },
+ { 0L, 1L },
+ { 1L, 0L },
+ { 0L, -1L },
+ { -1L, 0L }
+ };
+
+static ChainMove aImplMoveOuter[ 8 ] = {
+ { 0L, -1L },
+ { -1L, 0L },
+ { 0L, 1L },
+ { 1L, 0L },
+ { -1L, 0L },
+ { 0L, 1L },
+ { 1L, 0L },
+ { 0L, -1L }
+ };
+
+// ----------------
+// - ImplColorSet -
+// ----------------
+
+struct ImplColorSet
+{
+ BitmapColor maColor;
+ USHORT mnIndex;
+ BOOL mbSet;
+
+ BOOL operator<( const ImplColorSet& rSet ) const;
+ BOOL operator>( const ImplColorSet& rSet ) const;
+};
+
+// ----------------------------------------------------------------------------
+
+inline BOOL ImplColorSet::operator<( const ImplColorSet& rSet ) const
+{
+ return( mbSet && ( !rSet.mbSet || ( maColor.GetLuminance() > rSet.maColor.GetLuminance() ) ) );
+}
+
+// ----------------------------------------------------------------------------
+
+inline BOOL ImplColorSet::operator>( const ImplColorSet& rSet ) const
+{
+ return( !mbSet || ( rSet.mbSet && maColor.GetLuminance() < rSet.maColor.GetLuminance() ) );
+}
+
+// ----------------------------------------------------------------------------
+
+extern "C" int __LOADONCALLAPI ImplColorSetCmpFnc( const void* p1, const void* p2 )
+{
+ ImplColorSet* pSet1 = (ImplColorSet*) p1;
+ ImplColorSet* pSet2 = (ImplColorSet*) p2;
+ int nRet;
+
+ if( pSet1->mbSet && pSet2->mbSet )
+ {
+ const BYTE cLum1 = pSet1->maColor.GetLuminance();
+ const BYTE cLum2 = pSet2->maColor.GetLuminance();
+ nRet = ( ( cLum1 > cLum2 ) ? -1 : ( ( cLum1 == cLum2 ) ? 0 : 1 ) );
+ }
+ else if( pSet1->mbSet )
+ nRet = -1;
+ else if( pSet2->mbSet )
+ nRet = 1;
+ else
+ nRet = 0;
+
+ return nRet;
+}
+
+// ------------------
+// - ImplPointArray -
+// ------------------
+
+#ifdef WIN
+typedef Point* huge HPPoint;
+#else
+typedef Point* HPPoint;
+#endif
+
+class ImplPointArray
+{
+ HPPoint mpArray;
+ ULONG mnSize;
+ ULONG mnRealSize;
+
+public:
+
+ ImplPointArray();
+ ~ImplPointArray();
+
+ void ImplSetSize( ULONG nSize );
+
+ ULONG ImplGetRealSize() const { return mnRealSize; }
+ void ImplSetRealSize( ULONG nRealSize ) { mnRealSize = nRealSize; }
+
+ inline Point& operator[]( ULONG nPos );
+ inline const Point& operator[]( ULONG nPos ) const;
+
+ void ImplCreatePoly( Polygon& rPoly ) const;
+};
+
+// -----------------------------------------------------------------------------
+
+ImplPointArray::ImplPointArray() :
+ mnSize ( 0UL ),
+ mnRealSize ( 0UL ),
+ mpArray ( NULL )
+
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ImplPointArray::~ImplPointArray()
+{
+ if( mpArray )
+ SvMemFree( mpArray );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplPointArray::ImplSetSize( ULONG nSize )
+{
+ const ULONG nTotal = nSize * sizeof( Point );
+
+ mnSize = nSize;
+ mnRealSize = 0UL;
+
+ if( mpArray )
+ SvMemFree( mpArray );
+
+ mpArray = (HPPoint) SvMemAlloc( nTotal );
+ HMEMSET( (HPBYTE) mpArray, 0, nTotal );
+}
+
+// -----------------------------------------------------------------------------
+
+inline Point& ImplPointArray::operator[]( ULONG nPos )
+{
+ DBG_ASSERT( nPos < mnSize, "ImplPointArray::operator[]: nPos out of range!" );
+ return mpArray[ nPos ];
+}
+
+// -----------------------------------------------------------------------------
+
+inline const Point& ImplPointArray::operator[]( ULONG nPos ) const
+{
+ DBG_ASSERT( nPos < mnSize, "ImplPointArray::operator[]: nPos out of range!" );
+ return mpArray[ nPos ];
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplPointArray::ImplCreatePoly( Polygon& rPoly ) const
+{
+ rPoly.SetSize( (USHORT) mnRealSize );
+ HMEMCPY( rPoly.ImplGetPointAry(), mpArray, mnRealSize * sizeof( Point ) );
+}
+
+// ---------------
+// - ImplVectMap -
+// ---------------
+
+class ImplVectMap
+{
+private:
+
+ Scanline mpBuf;
+ Scanline* mpScan;
+ long mnWidth;
+ long mnHeight;
+
+ ImplVectMap() {};
+
+public:
+
+ ImplVectMap( long nWidth, long nHeight );
+ ~ImplVectMap();
+
+ inline long Width() const { return mnWidth; }
+ inline long Height() const { return mnHeight; }
+
+ inline void Set( long nY, long nX, BYTE cVal );
+ inline BYTE Get( long nY, long nX ) const;
+
+ inline BOOL IsFree( long nY, long nX ) const;
+ inline BOOL IsCont( long nY, long nX ) const;
+ inline BOOL IsDone( long nY, long nX ) const;
+
+#ifdef DBG_BMP
+ Bitmap GetBitmap() const;
+#endif // DBG_BMP
+};
+
+// -----------------------------------------------------------------------------
+
+ImplVectMap::ImplVectMap( long nWidth, long nHeight ) :
+ mnWidth ( nWidth ),
+ mnHeight( nHeight )
+{
+ const long nWidthAl = ( nWidth >> 2L ) + 1L;
+ const long nSize = nWidthAl * nHeight;
+ Scanline pTmp = mpBuf = (Scanline) SvMemAlloc( nSize );
+
+ HMEMSET( mpBuf, 0, nSize );
+ mpScan = (Scanline*) SvMemAlloc( nHeight * sizeof( Scanline ) );
+
+ for( long nY = 0L; nY < nHeight; pTmp += nWidthAl )
+ mpScan[ nY++ ] = pTmp;
+}
+
+// -----------------------------------------------------------------------------
+
+
+ImplVectMap::~ImplVectMap()
+{
+ SvMemFree( mpBuf );
+ SvMemFree( mpScan );
+}
+
+// -----------------------------------------------------------------------------
+
+inline void ImplVectMap::Set( long nY, long nX, BYTE cVal )
+{
+ const BYTE cShift = 6 - ( ( nX & 3 ) << 1 );
+ ( ( mpScan[ nY ][ nX >> 2 ] ) &= ~( 3 << cShift ) ) |= ( cVal << cShift );
+}
+
+// -----------------------------------------------------------------------------
+
+inline BYTE ImplVectMap::Get( long nY, long nX ) const
+{
+ return( ( ( mpScan[ nY ][ nX >> 2 ] ) >> ( 6 - ( ( nX & 3 ) << 1 ) ) ) & 3 );
+}
+
+// -----------------------------------------------------------------------------
+
+inline BOOL ImplVectMap::IsFree( long nY, long nX ) const
+{
+ return( VECT_FREE_INDEX == Get( nY, nX ) );
+}
+
+// -----------------------------------------------------------------------------
+
+inline BOOL ImplVectMap::IsCont( long nY, long nX ) const
+{
+ return( VECT_CONT_INDEX == Get( nY, nX ) );
+}
+
+// -----------------------------------------------------------------------------
+
+inline BOOL ImplVectMap::IsDone( long nY, long nX ) const
+{
+ return( VECT_DONE_INDEX == Get( nY, nX ) );
+}
+
+// -----------------------------------------------------------------------------
+
+#ifdef DBG_BMP
+Bitmap ImplVectMap::GetBitmap() const
+{
+ Bitmap aBmp( Size( mnWidth, mnHeight ), 4 );
+ BitmapWriteAccess* pAcc = aBmp.AcquireWriteAccess();
+
+ if( pAcc )
+ {
+ for( long nY = 0L; nY < mnHeight; nY++ )
+ {
+ for( long nX = 0L; nX < mnWidth; nX++ )
+ {
+ switch( Get( nY, nX ) )
+ {
+ case( VECT_FREE_INDEX ): pAcc->SetPixel( nY, nX, 15 ); break;
+ case( VECT_CONT_INDEX ): pAcc->SetPixel( nY, nX, 0 ); break;
+ case( VECT_DONE_INDEX ): pAcc->SetPixel( nY, nX, 2); break;
+ }
+ }
+ }
+
+ aBmp.ReleaseAccess( pAcc );
+ }
+
+ return aBmp;
+}
+#endif // DBG_BMP
+
+// -------------
+// - ImplChain -
+// -------------
+
+class ImplChain
+{
+private:
+
+ Polygon maPoly;
+ Point maStartPt;
+ ULONG mnArraySize;
+ ULONG mnCount;
+ long mnResize;
+ BYTE* mpCodes;
+
+ void ImplGetSpace();
+
+ void ImplCreate();
+ void ImplCreateInner();
+ void ImplCreateOuter();
+ void ImplPostProcess( const ImplPointArray& rArr );
+
+public:
+
+ ImplChain( ULONG nInitCount = 1024UL, long nResize = -1L );
+ ~ImplChain();
+
+ void ImplBeginAdd( const Point& rStartPt );
+ inline void ImplAdd( BYTE nCode );
+ void ImplEndAdd( ULONG nTypeFlag );
+
+ const Polygon& ImplGetPoly() { return maPoly; }
+};
+
+// -----------------------------------------------------------------------------
+
+ImplChain::ImplChain( ULONG nInitCount, long nResize ) :
+ mnCount ( 0UL ),
+ mnArraySize ( nInitCount ),
+ mnResize ( nResize )
+{
+ DBG_ASSERT( nInitCount && nResize, "ImplChain::ImplChain(): invalid parameters!" );
+ mpCodes = new BYTE[ mnArraySize ];
+}
+
+// -----------------------------------------------------------------------------
+
+ImplChain::~ImplChain()
+{
+ delete[] mpCodes;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplChain::ImplGetSpace()
+{
+ const ULONG nOldArraySize = mnArraySize;
+ BYTE* pNewCodes;
+
+ mnArraySize = ( mnResize < 0L ) ? ( mnArraySize << 1UL ) : ( mnArraySize + (ULONG) mnResize );
+ pNewCodes = new BYTE[ mnArraySize ];
+ HMEMCPY( pNewCodes, mpCodes, nOldArraySize );
+ delete[] mpCodes;
+ mpCodes = pNewCodes;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplChain::ImplBeginAdd( const Point& rStartPt )
+{
+ maPoly = Polygon();
+ maStartPt = rStartPt;
+ mnCount = 0UL;
+}
+
+// -----------------------------------------------------------------------------
+
+inline void ImplChain::ImplAdd( BYTE nCode )
+{
+ if( mnCount == mnArraySize )
+ ImplGetSpace();
+
+ mpCodes[ mnCount++ ] = nCode;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplChain::ImplEndAdd( ULONG nFlag )
+{
+ if( mnCount )
+ {
+ ImplPointArray aArr;
+
+ if( nFlag & VECT_POLY_INLINE_INNER )
+ {
+ long nFirstX, nFirstY;
+ long nLastX, nLastY;
+
+ nFirstX = nLastX = maStartPt.X();
+ nFirstY = nLastY = maStartPt.Y();
+ aArr.ImplSetSize( mnCount << 1 );
+
+ USHORT i, nPolyPos;
+ for( i = 0, nPolyPos = 0; i < ( mnCount - 1 ); i++ )
+ {
+ const BYTE cMove = mpCodes[ i ];
+ const BYTE cNextMove = mpCodes[ i + 1 ];
+ const ChainMove& rMove = aImplMove[ cMove ];
+ const ChainMove& rMoveInner = aImplMoveInner[ cMove ];
+ Point& rPt = aArr[ nPolyPos ];
+ BOOL bDone = TRUE;
+
+ nLastX += rMove.nDX;
+ nLastY += rMove.nDY;
+
+ if( cMove < 4 )
+ {
+ if( ( cMove == 0 && cNextMove == 3 ) ||
+ ( cMove == 3 && cNextMove == 2 ) ||
+ ( cMove == 2 && cNextMove == 1 ) ||
+ ( cMove == 1 && cNextMove == 0 ) )
+ {
+ }
+ else if( cMove == 2 && cNextMove == 3 )
+ {
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+ }
+ else if( cMove == 3 && cNextMove == 0 )
+ {
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+ }
+ else if( cMove == 0 && cNextMove == 1 )
+ {
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+ }
+ else if( cMove == 1 && cNextMove == 2 )
+ {
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+ }
+ else
+ bDone = FALSE;
+ }
+ else if( cMove == 7 && cNextMove == 0 )
+ {
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+ }
+ else if( cMove == 4 && cNextMove == 1 )
+ {
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+ }
+ else
+ bDone = FALSE;
+
+ if( !bDone )
+ {
+ aArr[ nPolyPos ].X() = nLastX + rMoveInner.nDX;
+ aArr[ nPolyPos++ ].Y() = nLastY + rMoveInner.nDY;
+ }
+ }
+
+ aArr[ nPolyPos ].X() = nFirstX + 1L;
+ aArr[ nPolyPos++ ].Y() = nFirstY + 1L;
+ aArr.ImplSetRealSize( nPolyPos );
+ }
+ else if( nFlag & VECT_POLY_INLINE_OUTER )
+ {
+ long nFirstX, nFirstY;
+ long nLastX, nLastY;
+
+ nFirstX = nLastX = maStartPt.X();
+ nFirstY = nLastY = maStartPt.Y();
+ aArr.ImplSetSize( mnCount << 1 );
+
+ USHORT i, nPolyPos;
+ for( i = 0, nPolyPos = 0; i < ( mnCount - 1 ); i++ )
+ {
+ const BYTE cMove = mpCodes[ i ];
+ const BYTE cNextMove = mpCodes[ i + 1 ];
+ const ChainMove& rMove = aImplMove[ cMove ];
+ const ChainMove& rMoveOuter = aImplMoveOuter[ cMove ];
+ Point& rPt = aArr[ nPolyPos ];
+ BOOL bDone = TRUE;
+
+ nLastX += rMove.nDX;
+ nLastY += rMove.nDY;
+
+ if( cMove < 4 )
+ {
+ if( ( cMove == 0 && cNextMove == 1 ) ||
+ ( cMove == 1 && cNextMove == 2 ) ||
+ ( cMove == 2 && cNextMove == 3 ) ||
+ ( cMove == 3 && cNextMove == 0 ) )
+ {
+ }
+ else if( cMove == 0 && cNextMove == 3 )
+ {
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+ }
+ else if( cMove == 3 && cNextMove == 2 )
+ {
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+ }
+ else if( cMove == 2 && cNextMove == 1 )
+ {
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+ }
+ else if( cMove == 1 && cNextMove == 0 )
+ {
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+
+ aArr[ nPolyPos ].X() = nLastX - 1;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+ }
+ else
+ bDone = FALSE;
+ }
+ else if( cMove == 7 && cNextMove == 3 )
+ {
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY - 1;
+
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+ }
+ else if( cMove == 6 && cNextMove == 2 )
+ {
+ aArr[ nPolyPos ].X() = nLastX + 1;
+ aArr[ nPolyPos++ ].Y() = nLastY;
+
+ aArr[ nPolyPos ].X() = nLastX;
+ aArr[ nPolyPos++ ].Y() = nLastY + 1;
+ }
+ else
+ bDone = FALSE;
+
+ if( !bDone )
+ {
+ aArr[ nPolyPos ].X() = nLastX + rMoveOuter.nDX;
+ aArr[ nPolyPos++ ].Y() = nLastY + rMoveOuter.nDY;
+ }
+ }
+
+ aArr[ nPolyPos ].X() = nFirstX - 1L;
+ aArr[ nPolyPos++ ].Y() = nFirstY - 1L;
+ aArr.ImplSetRealSize( nPolyPos );
+ }
+ else
+ {
+ long nLastX = maStartPt.X(), nLastY = maStartPt.Y();
+
+ aArr.ImplSetSize( mnCount + 1 );
+ aArr[ 0 ] = Point( nLastX, nLastY );
+
+ for( ULONG i = 0; i < mnCount; )
+ {
+ const ChainMove& rMove = aImplMove[ mpCodes[ i ] ];
+ aArr[ ++i ] = Point( nLastX += rMove.nDX, nLastY += rMove.nDY );
+ }
+
+ aArr.ImplSetRealSize( mnCount + 1 );
+ }
+
+ ImplPostProcess( aArr );
+ }
+ else
+ maPoly.SetSize( 0 );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplChain::ImplPostProcess( const ImplPointArray& rArr )
+{
+ ImplPointArray aNewArr1;
+ ImplPointArray aNewArr2;
+ Point* pLast;
+ Point* pLeast;
+ ULONG nNewPos;
+ ULONG nCount = rArr.ImplGetRealSize();
+ ULONG n;
+
+ // pass 1
+ aNewArr1.ImplSetSize( nCount );
+ pLast = &( aNewArr1[ 0 ] );
+ pLast->X() = BACK_MAP( rArr[ 0 ].X() );
+ pLast->Y() = BACK_MAP( rArr[ 0 ].Y() );
+
+ for( n = nNewPos = 1; n < nCount; )
+ {
+ const Point& rPt = rArr[ n++ ];
+ const long nX = BACK_MAP( rPt.X() );
+ const long nY = BACK_MAP( rPt.Y() );
+
+ if( nX != pLast->X() || nY != pLast->Y() )
+ {
+ pLast = pLeast = &( aNewArr1[ nNewPos++ ] );
+ pLeast->X() = nX;
+ pLeast->Y() = nY;
+ }
+ }
+
+ aNewArr1.ImplSetRealSize( nCount = nNewPos );
+
+ // pass 2
+ aNewArr2.ImplSetSize( nCount );
+ pLast = &( aNewArr2[ 0 ] );
+ *pLast = aNewArr1[ 0 ];
+
+ for( n = nNewPos = 1; n < nCount; )
+ {
+ pLeast = &( aNewArr1[ n++ ] );
+
+ if( pLeast->X() == pLast->X() )
+ {
+ while( n < nCount && aNewArr1[ n ].X() == pLast->X() )
+ pLeast = &( aNewArr1[ n++ ] );
+ }
+ else if( pLeast->Y() == pLast->Y() )
+ {
+ while( n < nCount && aNewArr1[ n ].Y() == pLast->Y() )
+ pLeast = &( aNewArr1[ n++ ] );
+ }
+
+ aNewArr2[ nNewPos++ ] = *( pLast = pLeast );
+ }
+
+ aNewArr2.ImplSetRealSize( nNewPos );
+ aNewArr2.ImplCreatePoly( maPoly );
+}
+
+// ------------------
+// - ImplVectorizer -
+// ------------------
+
+ImplVectorizer::ImplVectorizer()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ImplVectorizer::~ImplVectorizer()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImplVectorizer::ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
+ BYTE cReduce, ULONG nFlags, const Link* pProgress )
+{
+ BOOL bRet = FALSE;
+
+ VECT_PROGRESS( pProgress, 0 );
+
+ Bitmap* pBmp = new Bitmap( rColorBmp );
+ BitmapReadAccess* pRAcc = pBmp->AcquireReadAccess();
+
+ if( pRAcc )
+ {
+ PolyPolygon aPolyPoly;
+ double fPercent = 0.0;
+ double fPercentStep_2 = 0.0;
+ const long nWidth = pRAcc->Width();
+ const long nHeight = pRAcc->Height();
+ const USHORT nColorCount = pRAcc->GetPaletteEntryCount();
+ USHORT n;
+ ImplColorSet* pColorSet = (ImplColorSet*) new BYTE[ 256 * sizeof( ImplColorSet ) ];
+
+ memset( pColorSet, 0, 256 * sizeof( ImplColorSet ) );
+ rMtf.Clear();
+
+ // get used palette colors and sort them from light to dark colors
+ for( n = 0; n < nColorCount; n++ )
+ {
+ pColorSet[ n ].mnIndex = n;
+ pColorSet[ n ].maColor = pRAcc->GetPaletteColor( n );
+ }
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pColorSet[ pRAcc->GetPixel( nY, nX ).GetIndex() ].mbSet = 1;
+
+ qsort( pColorSet, 256, sizeof( ImplColorSet ), ImplColorSetCmpFnc );
+
+ for( n = 0; n < 256; n++ )
+ if( !pColorSet[ n ].mbSet )
+ break;
+
+ if( n )
+ fPercentStep_2 = 45.0 / n;
+
+ VECT_PROGRESS( pProgress, FRound( fPercent += 10.0 ) );
+
+ for( USHORT i = 0; i < n; i++ )
+ {
+ const BitmapColor aBmpCol( pRAcc->GetPaletteColor( pColorSet[ i ].mnIndex ) );
+ const Color aFindColor( aBmpCol.GetRed(), aBmpCol.GetGreen(), aBmpCol.GetBlue() );
+ const BYTE cLum = aFindColor.GetLuminance();
+ ImplVectMap* pMap = ImplExpand( pRAcc, aFindColor );
+
+ VECT_PROGRESS( pProgress, FRound( fPercent += fPercentStep_2 ) );
+
+ if( pMap )
+ {
+ aPolyPoly.Clear();
+ ImplCalculate( pMap, aPolyPoly, cReduce, nFlags );
+ delete pMap;
+
+ if( aPolyPoly.Count() )
+ {
+ ImplLimitPolyPoly( aPolyPoly );
+
+ if( nFlags & BMP_VECTORIZE_REDUCE_EDGES )
+ aPolyPoly.Optimize( POLY_OPTIMIZE_EDGES );
+
+ if( aPolyPoly.Count() )
+ {
+ rMtf.AddAction( new MetaLineColorAction( aFindColor, TRUE ) );
+ rMtf.AddAction( new MetaFillColorAction( aFindColor, TRUE ) );
+ rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) );
+ }
+ }
+ }
+
+ VECT_PROGRESS( pProgress, FRound( fPercent += fPercentStep_2 ) );
+ }
+
+ delete[] (BYTE*) pColorSet;
+
+ if( rMtf.GetActionCount() )
+ {
+ MapMode aMap( MAP_100TH_MM );
+ VirtualDevice aVDev;
+ const Size aLogSize1( aVDev.PixelToLogic( Size( 1, 1 ), aMap ) );
+
+ rMtf.SetPrefMapMode( aMap );
+ rMtf.SetPrefSize( Size( nWidth + 2, nHeight + 2 ) );
+ rMtf.Move( 1, 1 );
+ rMtf.Scale( aLogSize1.Width(), aLogSize1.Height() );
+ bRet = TRUE;
+ }
+ }
+
+ pBmp->ReleaseAccess( pRAcc );
+ delete pBmp;
+ VECT_PROGRESS( pProgress, 100 );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImplVectorizer::ImplVectorize( const Bitmap& rMonoBmp,
+ PolyPolygon& rPolyPoly,
+ ULONG nFlags, const Link* pProgress )
+{
+ Bitmap* pBmp = new Bitmap( rMonoBmp );
+ BitmapReadAccess* pRAcc;
+ ImplVectMap* pMap;
+ BOOL bRet = FALSE;
+
+ VECT_PROGRESS( pProgress, 10 );
+
+ if( pBmp->GetBitCount() > 1 )
+ pBmp->Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+
+ VECT_PROGRESS( pProgress, 30 );
+
+ pRAcc = pBmp->AcquireReadAccess();
+ pMap = ImplExpand( pRAcc, COL_BLACK );
+ pBmp->ReleaseAccess( pRAcc );
+ delete pBmp;
+
+ VECT_PROGRESS( pProgress, 60 );
+
+ if( pMap )
+ {
+ rPolyPoly.Clear();
+ ImplCalculate( pMap, rPolyPoly, 0, nFlags );
+ delete pMap;
+ ImplLimitPolyPoly( rPolyPoly );
+
+ if( nFlags & BMP_VECTORIZE_REDUCE_EDGES )
+ rPolyPoly.Optimize( POLY_OPTIMIZE_EDGES );
+
+ bRet = TRUE;
+ }
+
+ VECT_PROGRESS( pProgress, 100 );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplVectorizer::ImplLimitPolyPoly( PolyPolygon& rPolyPoly )
+{
+ if( rPolyPoly.Count() > VECT_POLY_MAX )
+ {
+ PolyPolygon aNewPolyPoly;
+ long nReduce = 0;
+ USHORT nNewCount;
+
+ do
+ {
+ aNewPolyPoly.Clear();
+ nReduce++;
+
+ for( USHORT i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ {
+ const Rectangle aBound( rPolyPoly[ i ].GetBoundRect() );
+
+ if( aBound.GetWidth() > nReduce && aBound.GetHeight() > nReduce )
+ {
+ if( rPolyPoly[ i ].GetSize() )
+ aNewPolyPoly.Insert( rPolyPoly[ i ] );
+ }
+ }
+
+ nNewCount = aNewPolyPoly.Count();
+ }
+ while( nNewCount > VECT_POLY_MAX );
+
+ rPolyPoly = aNewPolyPoly;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+ImplVectMap* ImplVectorizer::ImplExpand( BitmapReadAccess* pRAcc, const Color& rColor )
+{
+ ImplVectMap* pMap = NULL;
+
+ if( pRAcc && pRAcc->Width() && pRAcc->Height() )
+ {
+ const long nOldWidth = pRAcc->Width();
+ const long nOldHeight = pRAcc->Height();
+ const long nNewWidth = ( nOldWidth << 2L ) + 4L;
+ const long nNewHeight = ( nOldHeight << 2L ) + 4L;
+ const BitmapColor aTest( pRAcc->GetBestMatchingColor( rColor ) );
+ long* pMapIn = new long[ Max( nOldWidth, nOldHeight ) ];
+ long* pMapOut = new long[ Max( nOldWidth, nOldHeight ) ];
+ long nX, nY, nTmpX, nTmpY;
+
+ pMap = new ImplVectMap( nNewWidth, nNewHeight );
+
+ for( nX = 0L; nX < nOldWidth; nX++ )
+ VECT_MAP( pMapIn, pMapOut, nX );
+
+ for( nY = 0L, nTmpY = 5L; nY < nOldHeight; nY++, nTmpY += 4L )
+ {
+ for( nX = 0L; nX < nOldWidth; )
+ {
+ if( pRAcc->GetPixel( nY, nX ) == aTest )
+ {
+ nTmpX = pMapIn[ nX++ ];
+ nTmpY -= 3L;
+
+ pMap->Set( nTmpY++, nTmpX, VECT_CONT_INDEX );
+ pMap->Set( nTmpY++, nTmpX, VECT_CONT_INDEX );
+ pMap->Set( nTmpY++, nTmpX, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX, VECT_CONT_INDEX );
+
+ while( nX < nOldWidth && pRAcc->GetPixel( nY, nX ) == aTest )
+ nX++;
+
+ nTmpX = pMapOut[ nX - 1L ];
+ nTmpY -= 3L;
+
+ pMap->Set( nTmpY++, nTmpX, VECT_CONT_INDEX );
+ pMap->Set( nTmpY++, nTmpX, VECT_CONT_INDEX );
+ pMap->Set( nTmpY++, nTmpX, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX, VECT_CONT_INDEX );
+ }
+ else
+ nX++;
+ }
+ }
+
+ for( nY = 0L; nY < nOldHeight; nY++ )
+ VECT_MAP( pMapIn, pMapOut, nY );
+
+ for( nX = 0L, nTmpX = 5L; nX < nOldWidth; nX++, nTmpX += 4L )
+ {
+ for( nY = 0L; nY < nOldHeight; )
+ {
+ if( pRAcc->GetPixel( nY, nX ) == aTest )
+ {
+ nTmpX -= 3L;
+ nTmpY = pMapIn[ nY++ ];
+
+ pMap->Set( nTmpY, nTmpX++, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX++, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX++, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX, VECT_CONT_INDEX );
+
+ while( nY < nOldHeight && pRAcc->GetPixel( nY, nX ) == aTest )
+ nY++;
+
+ nTmpX -= 3L;
+ nTmpY = pMapOut[ nY - 1L ];
+
+ pMap->Set( nTmpY, nTmpX++, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX++, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX++, VECT_CONT_INDEX );
+ pMap->Set( nTmpY, nTmpX, VECT_CONT_INDEX );
+ }
+ else
+ nY++;
+ }
+ }
+
+ // cleanup
+ delete[] pMapIn;
+ delete[] pMapOut;
+ }
+
+ return pMap;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplVectorizer::ImplCalculate( ImplVectMap* pMap, PolyPolygon& rPolyPoly, BYTE cReduce, ULONG nFlags )
+{
+ const long nWidth = pMap->Width(), nHeight= pMap->Height();
+
+#ifdef DBG_BMP
+ if( pMap )
+ {
+ SvFileStream aOStm( "d:\\cont.bmp", STREAM_WRITE | STREAM_TRUNC );
+ aOStm << pMap->GetBitmap();
+ }
+#endif // DBG_BMP
+
+ for( long nY = 0L; nY < nHeight; nY++ )
+ {
+ long nX = 0L;
+ BOOL bInner = TRUE;
+
+ while( nX < nWidth )
+ {
+ // skip free
+ while( ( nX < nWidth ) && pMap->IsFree( nY, nX ) )
+ nX++;
+
+ if( nX == nWidth )
+ break;
+
+ if( pMap->IsCont( nY, nX ) )
+ {
+ // new contour
+ ImplChain aChain;
+ const Point aStartPt( nX++, nY );
+
+ // get chain code
+ aChain.ImplBeginAdd( aStartPt );
+ ImplGetChain( pMap, aStartPt, aChain );
+
+ if( nFlags & BMP_VECTORIZE_INNER )
+ aChain.ImplEndAdd( bInner ? VECT_POLY_INLINE_INNER : VECT_POLY_INLINE_OUTER );
+ else
+ aChain.ImplEndAdd( bInner ? VECT_POLY_OUTLINE_INNER : VECT_POLY_OUTLINE_OUTER );
+
+ const Polygon& rPoly = aChain.ImplGetPoly();
+
+ if( rPoly.GetSize() > 2 )
+ {
+ if( cReduce )
+ {
+ const Rectangle aBound( rPoly.GetBoundRect() );
+
+ if( aBound.GetWidth() > cReduce && aBound.GetHeight() > cReduce )
+ rPolyPoly.Insert( rPoly );
+ }
+ else
+ rPolyPoly.Insert( rPoly );
+ }
+
+ // skip rest of detected contour
+ while( pMap->IsCont( nY, nX ) )
+ nX++;
+ }
+ else
+ {
+ // process done segment
+ const long nStartSegX = nX++;
+
+ while( pMap->IsDone( nY, nX ) )
+ nX++;
+
+ if( ( ( nX - nStartSegX ) == 1L ) || ( ImplIsUp( pMap, nY, nStartSegX ) != ImplIsUp( pMap, nY, nX - 1L ) ) )
+ bInner = !bInner;
+ }
+ }
+ }
+
+#ifdef DBG_BMP
+ if( pMap )
+ {
+ SvFileStream aOStm( "d:\\vect.bmp", STREAM_WRITE | STREAM_TRUNC );
+ aOStm << pMap->GetBitmap();
+ }
+#endif // DBG_BMP
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImplVectorizer::ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain )
+{
+ long nActX = rStartPt.X();
+ long nActY = rStartPt.Y();
+ long nTryX;
+ long nTryY;
+ ULONG nFound;
+ ULONG nLastDir = 0UL;
+ ULONG nDir;
+
+ do
+ {
+ nFound = 0UL;
+
+ // first try last direction
+ nTryX = nActX + aImplMove[ nLastDir ].nDX;
+ nTryY = nActY + aImplMove[ nLastDir ].nDY;
+
+ if( pMap->IsCont( nTryY, nTryX ) )
+ {
+ rChain.ImplAdd( (BYTE) nLastDir );
+ pMap->Set( nActY = nTryY, nActX = nTryX, VECT_DONE_INDEX );
+ nFound = 1UL;
+ }
+ else
+ {
+ // try other directions
+ for( nDir = 0UL; nDir < 8UL; nDir++ )
+ {
+ // we already tried nLastDir
+ if( nDir != nLastDir )
+ {
+ nTryX = nActX + aImplMove[ nDir ].nDX;
+ nTryY = nActY + aImplMove[ nDir ].nDY;
+
+ if( pMap->IsCont( nTryY, nTryX ) )
+ {
+ rChain.ImplAdd( (BYTE) nDir );
+ pMap->Set( nActY = nTryY, nActX = nTryX, VECT_DONE_INDEX );
+ nFound = 1UL;
+ nLastDir = nDir;
+ break;
+ }
+ }
+ }
+ }
+ }
+ while( nFound );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImplVectorizer::ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const
+{
+ if( pMap->IsDone( nY - 1L, nX ) )
+ return TRUE;
+ else if( pMap->IsDone( nY + 1L, nX ) )
+ return FALSE;
+ else if( pMap->IsDone( nY - 1L, nX - 1L ) || pMap->IsDone( nY - 1L, nX + 1L ) )
+ return TRUE;
+ else
+ return FALSE;
+}
diff --git a/vcl/source/gdi/impvect.hxx b/vcl/source/gdi/impvect.hxx
new file mode 100644
index 000000000000..34750c220109
--- /dev/null
+++ b/vcl/source/gdi/impvect.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: impvect.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_IMPVECT_HXX
+#define _SV_IMPVECT_HXX
+
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+
+// --------------
+// - Vectorizer -
+// --------------
+
+class BitmapReadAccess;
+class ImplChain;
+class ImplVectMap;
+
+class ImplVectorizer
+{
+private:
+
+ ImplVectMap* ImplExpand( BitmapReadAccess* pRAcc, const Color& rColor );
+ void ImplCalculate( ImplVectMap* pMap, PolyPolygon& rPolyPoly, BYTE cReduce, ULONG nFlags );
+ BOOL ImplGetChain( ImplVectMap* pMap, const Point& rStartPt, ImplChain& rChain );
+ BOOL ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const;
+ void ImplLimitPolyPoly( PolyPolygon& rPolyPoly );
+
+public:
+
+ ImplVectorizer();
+ ~ImplVectorizer();
+
+ BOOL ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
+ BYTE cReduce, ULONG nFlags, const Link* pProgress );
+ BOOL ImplVectorize( const Bitmap& rMonoBmp, PolyPolygon& rPolyPoly,
+ ULONG nFlags, const Link* pProgress );
+};
+
+#endif
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
new file mode 100644
index 000000000000..7edcf104d113
--- /dev/null
+++ b/vcl/source/gdi/jobset.cxx
@@ -0,0 +1,415 @@
+/*************************************************************************
+ *
+ * $RCSfile: jobset.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_JOBSET_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _SV_JOBSET_HXX
+#include <jobset.hxx>
+#endif
+#ifndef _SV_JOBSET_H
+#include <jobset.h>
+#endif
+
+// =======================================================================
+
+DBG_NAME( JobSetup );
+
+#define JOBSET_FILEFORMAT2 3780
+#define JOBSET_FILE364_SYSTEM ((USHORT)0xFFFF)
+
+struct ImplOldJobSetupData
+{
+ char cPrinterName[64];
+ char cDeviceName[32];
+ char cPortName[32];
+ char cDriverName[32];
+};
+
+struct Impl364JobSetupData
+{
+ SVBT16 nSize;
+ SVBT16 nSystem;
+ SVBT32 nDriverDataLen;
+ SVBT16 nOrientation;
+ SVBT16 nPaperBin;
+ SVBT16 nPaperFormat;
+ SVBT32 nPaperWidth;
+ SVBT32 nPaperHeight;
+};
+
+// =======================================================================
+
+ImplJobSetup::ImplJobSetup()
+{
+ mnRefCount = 1;
+ mnSystem = 0;
+ meOrientation = ORIENTATION_PORTRAIT;
+ mnPaperBin = 0;
+ mePaperFormat = PAPER_USER;
+ mnPaperWidth = 0;
+ mnPaperHeight = 0;
+ mnDriverDataLen = 0;
+ mpDriverData = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) :
+ maPrinterName( rJobSetup.maPrinterName ),
+ maDriver( rJobSetup.maDriver )
+{
+ mnRefCount = 1;
+ mnSystem = rJobSetup.mnSystem;
+ meOrientation = rJobSetup.meOrientation;
+ mnPaperBin = rJobSetup.mnPaperBin;
+ mePaperFormat = rJobSetup.mePaperFormat;
+ mnPaperWidth = rJobSetup.mnPaperWidth;
+ mnPaperHeight = rJobSetup.mnPaperHeight;
+ mnDriverDataLen = rJobSetup.mnDriverDataLen;
+ if ( rJobSetup.mpDriverData )
+ {
+ mpDriverData = new BYTE[mnDriverDataLen];
+ memcpy( mpDriverData, rJobSetup.mpDriverData, mnDriverDataLen );
+ }
+ else
+ mpDriverData = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplJobSetup::~ImplJobSetup()
+{
+ delete mpDriverData;
+}
+
+// =======================================================================
+
+ImplJobSetup* JobSetup::ImplGetData()
+{
+ if ( !mpData )
+ mpData = new ImplJobSetup;
+ else if ( mpData->mnRefCount != 1 )
+ {
+ mpData->mnRefCount--;
+ mpData = new ImplJobSetup( *mpData );
+ }
+
+ return mpData;
+}
+
+// -----------------------------------------------------------------------
+
+ImplJobSetup* JobSetup::ImplGetConstData()
+{
+ if ( !mpData )
+ mpData = new ImplJobSetup;
+ return mpData;
+}
+
+// -----------------------------------------------------------------------
+
+const ImplJobSetup* JobSetup::ImplGetConstData() const
+{
+ if ( !mpData )
+ ((JobSetup*)this)->mpData = new ImplJobSetup;
+ return mpData;
+}
+
+// =======================================================================
+
+JobSetup::JobSetup()
+{
+ DBG_CTOR( JobSetup, NULL );
+
+ mpData = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+JobSetup::JobSetup( const JobSetup& rJobSetup )
+{
+ DBG_CTOR( JobSetup, NULL );
+ DBG_CHKOBJ( &rJobSetup, JobSetup, NULL );
+ DBG_ASSERT( !rJobSetup.mpData || (rJobSetup.mpData->mnRefCount < 0xFFFE), "JobSetup: RefCount overflow" );
+
+ mpData = rJobSetup.mpData;
+ if ( mpData )
+ mpData->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+JobSetup::~JobSetup()
+{
+ DBG_DTOR( JobSetup, NULL );
+
+ if ( mpData )
+ {
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString JobSetup::GetPrinterName() const
+{
+ if ( mpData )
+ return mpData->maPrinterName;
+ else
+ {
+ XubString aName;
+ return aName;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString JobSetup::GetDriverName() const
+{
+ if ( mpData )
+ return mpData->maDriver;
+ else
+ {
+ XubString aDriver;
+ return aDriver;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+JobSetup& JobSetup::operator=( const JobSetup& rJobSetup )
+{
+ DBG_CHKTHIS( JobSetup, NULL );
+ DBG_CHKOBJ( &rJobSetup, JobSetup, NULL );
+ DBG_ASSERT( !rJobSetup.mpData || (rJobSetup.mpData->mnRefCount) < 0xFFFE, "JobSetup: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ if ( rJobSetup.mpData )
+ rJobSetup.mpData->mnRefCount++;
+
+ // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
+ // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ if ( mpData )
+ {
+ if ( mpData->mnRefCount == 1 )
+ delete mpData;
+ else
+ mpData->mnRefCount--;
+ }
+
+ mpData = rJobSetup.mpData;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL JobSetup::operator==( const JobSetup& rJobSetup ) const
+{
+ DBG_CHKTHIS( JobSetup, NULL );
+ DBG_CHKOBJ( &rJobSetup, JobSetup, NULL );
+
+ if ( mpData == rJobSetup.mpData )
+ return TRUE;
+
+ if ( !mpData || !rJobSetup.mpData )
+ return FALSE;
+
+ ImplJobSetup* pData1 = mpData;
+ ImplJobSetup* pData2 = rJobSetup.mpData;
+ if ( (pData1->mnSystem == pData2->mnSystem) &&
+ (pData1->maPrinterName == pData2->maPrinterName) &&
+ (pData1->maDriver == pData2->maDriver) &&
+ (pData1->meOrientation == pData2->meOrientation) &&
+ (pData1->mnPaperBin == pData2->mnPaperBin) &&
+ (pData1->mePaperFormat == pData2->mePaperFormat) &&
+ (pData1->mnPaperWidth == pData2->mnPaperWidth) &&
+ (pData1->mnPaperHeight == pData2->mnPaperHeight) &&
+ (pData1->mnDriverDataLen == pData2->mnDriverDataLen) &&
+ (memcmp( pData1->mpDriverData, pData2->mpDriverData, pData1->mnDriverDataLen ) == 0) )
+ return TRUE;
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup )
+{
+ DBG_ASSERTWARNING( rIStream.GetVersion(), "JobSetup::>> - Solar-Version not set on rOStream" );
+
+ // Zur Zeit haben wir noch kein neues FileFormat
+// if ( rIStream.GetVersion() < JOBSET_FILEFORMAT2 )
+ {
+ USHORT nLen;
+ USHORT nSystem;
+ rIStream >> nLen;
+ if ( !nLen )
+ return rIStream;
+ rIStream >> nSystem;
+ char* pTempBuf = new char[nLen];
+ rIStream.Read( pTempBuf, nLen - sizeof( nLen ) - sizeof( nSystem ) );
+ if ( nLen >= sizeof(ImplOldJobSetupData)+4 )
+ {
+ ImplOldJobSetupData* pData = (ImplOldJobSetupData*)pTempBuf;
+ if ( rJobSetup.mpData )
+ {
+ if ( rJobSetup.mpData->mnRefCount == 1 )
+ delete rJobSetup.mpData;
+ else
+ rJobSetup.mpData->mnRefCount--;
+ }
+ rJobSetup.mpData = new ImplJobSetup;
+ ImplJobSetup* pJobData = rJobSetup.mpData;
+ pJobData->maPrinterName = UniString( pData->cPrinterName, RTL_TEXTENCODING_UTF8 );
+ pJobData->maDriver = UniString( pData->cDriverName, RTL_TEXTENCODING_UTF8 );
+
+ // Sind es unsere neuen JobSetup-Daten?
+ if ( nSystem == JOBSET_FILE364_SYSTEM )
+ {
+ Impl364JobSetupData* pOldJobData = (Impl364JobSetupData*)(pTempBuf + sizeof( ImplOldJobSetupData ));
+ USHORT nOldJobDataSize = SVBT16ToShort( pOldJobData->nSize );
+ pJobData->mnSystem = SVBT16ToShort( pOldJobData->nSystem );
+ pJobData->mnDriverDataLen = SVBT32ToLong( pOldJobData->nDriverDataLen );
+ pJobData->meOrientation = (Orientation)SVBT16ToShort( pOldJobData->nOrientation );
+ pJobData->mnPaperBin = SVBT16ToShort( pOldJobData->nPaperBin );
+ pJobData->mePaperFormat = (Paper)SVBT16ToShort( pOldJobData->nPaperFormat );
+ pJobData->mnPaperWidth = (long)SVBT32ToLong( pOldJobData->nPaperWidth );
+ pJobData->mnPaperHeight = (long)SVBT32ToLong( pOldJobData->nPaperHeight );
+ if ( pJobData->mnDriverDataLen )
+ {
+ BYTE* pDriverData = ((BYTE*)pOldJobData) + nOldJobDataSize;
+ pJobData->mpDriverData = new BYTE[pJobData->mnDriverDataLen];
+ memcpy( pJobData->mpDriverData, pDriverData, pJobData->mnDriverDataLen );
+ }
+ }
+ }
+ delete pTempBuf;
+ }
+/*
+ else
+ {
+ }
+*/
+
+ return rIStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup )
+{
+ DBG_ASSERTWARNING( rOStream.GetVersion(), "JobSetup::<< - Solar-Version not set on rOStream" );
+
+ // Zur Zeit haben wir noch kein neues FileFormat
+// if ( rOStream.GetVersion() < JOBSET_FILEFORMAT2 )
+ {
+ USHORT nLen = 0;
+ if ( !rJobSetup.mpData )
+ rOStream << nLen;
+ else
+ {
+ USHORT nSystem = JOBSET_FILE364_SYSTEM;
+
+ const ImplJobSetup* pJobData = rJobSetup.ImplGetConstData();
+ Impl364JobSetupData aOldJobData;
+ USHORT nOldJobDataSize = sizeof( aOldJobData );
+ ShortToSVBT16( nOldJobDataSize, aOldJobData.nSize );
+ ShortToSVBT16( pJobData->mnSystem, aOldJobData.nSystem );
+ LongToSVBT32( pJobData->mnDriverDataLen, aOldJobData.nDriverDataLen );
+ ShortToSVBT16( (USHORT)(pJobData->meOrientation), aOldJobData.nOrientation );
+ ShortToSVBT16( pJobData->mnPaperBin, aOldJobData.nPaperBin );
+ ShortToSVBT16( (USHORT)(pJobData->mePaperFormat), aOldJobData.nPaperFormat );
+ LongToSVBT32( (ULONG)(pJobData->mnPaperWidth), aOldJobData.nPaperWidth );
+ LongToSVBT32( (ULONG)(pJobData->mnPaperHeight), aOldJobData.nPaperHeight );
+
+ ImplOldJobSetupData aOldData;
+ memset( &aOldData, 0, sizeof( aOldData ) );
+ ByteString aPrnByteName( rJobSetup.GetPrinterName(), RTL_TEXTENCODING_UTF8 );
+ strncpy( aOldData.cPrinterName, aPrnByteName.GetBuffer(), 63 );
+ ByteString aDriverByteName( rJobSetup.GetDriverName(), RTL_TEXTENCODING_UTF8 );
+ strncpy( aOldData.cDriverName, aDriverByteName.GetBuffer(), 31 );
+ nLen = sizeof( aOldData ) + 4 + nOldJobDataSize + pJobData->mnDriverDataLen;
+ rOStream << nLen;
+ rOStream << nSystem;
+ rOStream.Write( (char*)&aOldData, sizeof( aOldData ) );
+ rOStream.Write( (char*)&aOldJobData, nOldJobDataSize );
+ rOStream.Write( (char*)pJobData->mpDriverData, pJobData->mnDriverDataLen );
+ }
+ }
+/*
+ else
+ {
+ }
+*/
+
+ return rOStream;
+}
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
new file mode 100644
index 000000000000..fde91e8ee702
--- /dev/null
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * $RCSfile: lineinfo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_LINEINFO_CXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_LINEINFO_HXX
+#include <lineinfo.hxx>
+#endif
+
+DBG_NAME( LineInfo );
+
+// ----------------
+// - ImplLineInfo -
+// ----------------
+
+ImplLineInfo::ImplLineInfo() :
+ mnRefCount ( 1 ),
+ meStyle ( LINE_SOLID ),
+ mnWidth ( 0 ),
+ mnDashCount ( 0 ),
+ mnDashLen ( 0 ),
+ mnDotCount ( 0 ),
+ mnDotLen ( 0 ),
+ mnDistance ( 0 )
+{
+}
+
+// -----------------------------------------------------------------------
+
+ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) :
+ mnRefCount ( 1 ),
+ meStyle ( rImplLineInfo.meStyle ),
+ mnWidth ( rImplLineInfo.mnWidth ),
+ mnDashCount ( rImplLineInfo.mnDashCount ),
+ mnDashLen ( rImplLineInfo.mnDashLen ),
+ mnDotCount ( rImplLineInfo.mnDotCount ),
+ mnDotLen ( rImplLineInfo.mnDotLen ),
+ mnDistance ( rImplLineInfo.mnDistance )
+{
+}
+
+// ------------
+// - LineInfo -
+// ------------
+
+LineInfo::LineInfo( LineStyle eStyle, long nWidth )
+{
+ DBG_CTOR( LineInfo, NULL );
+ mpImplLineInfo = new ImplLineInfo;
+ mpImplLineInfo->meStyle = eStyle;
+ mpImplLineInfo->mnWidth = nWidth;
+}
+
+// -----------------------------------------------------------------------
+
+LineInfo::LineInfo( const LineInfo& rLineInfo )
+{
+ DBG_CTOR( LineInfo, NULL );
+ DBG_CHKOBJ( &rLineInfo, LineInfo, NULL );
+ mpImplLineInfo = rLineInfo.mpImplLineInfo;
+ mpImplLineInfo->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+LineInfo::~LineInfo()
+{
+ DBG_DTOR( LineInfo, NULL );
+ if( !( --mpImplLineInfo->mnRefCount ) )
+ delete mpImplLineInfo;
+}
+
+// -----------------------------------------------------------------------
+
+LineInfo& LineInfo::operator=( const LineInfo& rLineInfo )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ DBG_CHKOBJ( &rLineInfo, LineInfo, NULL );
+
+ rLineInfo.mpImplLineInfo->mnRefCount++;
+
+ if( !( --mpImplLineInfo->mnRefCount ) )
+ delete mpImplLineInfo;
+
+ mpImplLineInfo = rLineInfo.mpImplLineInfo;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL LineInfo::operator==( const LineInfo& rLineInfo ) const
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ DBG_CHKOBJ( &rLineInfo, LineInfo, NULL );
+
+ return( mpImplLineInfo == rLineInfo.mpImplLineInfo ||
+ ( mpImplLineInfo->meStyle == rLineInfo.mpImplLineInfo->meStyle &&
+ mpImplLineInfo->mnWidth == rLineInfo.mpImplLineInfo->mnWidth &&
+ mpImplLineInfo->mnDashCount == rLineInfo.mpImplLineInfo->mnDashCount &&
+ mpImplLineInfo->mnDashLen == rLineInfo.mpImplLineInfo->mnDashLen &&
+ mpImplLineInfo->mnDotCount == rLineInfo.mpImplLineInfo->mnDotCount &&
+ mpImplLineInfo->mnDotLen == rLineInfo.mpImplLineInfo->mnDotLen &&
+ mpImplLineInfo->mnDistance == rLineInfo.mpImplLineInfo->mnDistance ) );
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::ImplMakeUnique()
+{
+ if( mpImplLineInfo->mnRefCount != 1 )
+ {
+ if( mpImplLineInfo->mnRefCount )
+ mpImplLineInfo->mnRefCount--;
+
+ mpImplLineInfo = new ImplLineInfo( *mpImplLineInfo );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::SetStyle( LineStyle eStyle )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ ImplMakeUnique();
+ mpImplLineInfo->meStyle = eStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::SetWidth( long nWidth )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ ImplMakeUnique();
+ mpImplLineInfo->mnWidth = nWidth;
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::SetDashCount( USHORT nDashCount )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ ImplMakeUnique();
+ mpImplLineInfo->mnDashCount = nDashCount;
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::SetDashLen( long nDashLen )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ ImplMakeUnique();
+ mpImplLineInfo->mnDashLen = nDashLen;
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::SetDotCount( USHORT nDotCount )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ ImplMakeUnique();
+ mpImplLineInfo->mnDotCount = nDotCount;
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::SetDotLen( long nDotLen )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ ImplMakeUnique();
+ mpImplLineInfo->mnDotLen = nDotLen;
+}
+
+// -----------------------------------------------------------------------
+
+void LineInfo::SetDistance( long nDistance )
+{
+ DBG_CHKTHIS( LineInfo, NULL );
+ ImplMakeUnique();
+ mpImplLineInfo->mnDistance = nDistance;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo )
+{
+ VersionCompat aCompat( rIStm, STREAM_READ );
+ UINT16 nTmp16;
+
+ rIStm >> nTmp16; rImplLineInfo.meStyle = (LineStyle) nTmp16;
+ rIStm >> rImplLineInfo.mnWidth;
+
+ if( aCompat.GetVersion() >= 2 )
+ {
+ // version 2
+ rIStm >> rImplLineInfo.mnDashCount >> rImplLineInfo.mnDashLen;
+ rIStm >> rImplLineInfo.mnDotCount >> rImplLineInfo.mnDotLen;
+ rIStm >> rImplLineInfo.mnDistance;
+ }
+
+ return rIStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo )
+{
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 2 );
+
+ // version 1
+ rOStm << (UINT16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth;
+
+ // since version2
+ rOStm << rImplLineInfo.mnDashCount << rImplLineInfo.mnDashLen;
+ rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen;
+ rOStm << rImplLineInfo.mnDistance;
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo )
+{
+ rLineInfo.ImplMakeUnique();
+ return( rIStm >> *rLineInfo.mpImplLineInfo );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo )
+{
+ return( rOStm << *rLineInfo.mpImplLineInfo );
+}
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
new file mode 100644
index 000000000000..cecf617abb1c
--- /dev/null
+++ b/vcl/source/gdi/makefile.mk
@@ -0,0 +1,156 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=vcl
+TARGET=gdi
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(COM)"=="ICC"
+CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/salmisc.obj \
+ $(SLO)$/animate.obj \
+ $(SLO)$/impanmvw.obj \
+ $(SLO)$/bitmap.obj \
+ $(SLO)$/bitmap2.obj \
+ $(SLO)$/bitmap3.obj \
+ $(SLO)$/bitmap4.obj \
+ $(SLO)$/alpha.obj \
+ $(SLO)$/bitmapex.obj \
+ $(SLO)$/imgcons.obj \
+ $(SLO)$/bmpacc.obj \
+ $(SLO)$/bmpacc2.obj \
+ $(SLO)$/bmpacc3.obj \
+ $(SLO)$/color.obj \
+ $(SLO)$/cvtsvm.obj \
+ $(SLO)$/cvtgrf.obj \
+ $(SLO)$/font.obj \
+ $(SLO)$/gdimtf.obj \
+ $(SLO)$/gfxlink.obj \
+ $(SLO)$/gradient.obj \
+ $(SLO)$/hatch.obj \
+ $(SLO)$/graph.obj \
+ $(SLO)$/image.obj \
+ $(SLO)$/impbmp.obj \
+ $(SLO)$/impgraph.obj \
+ $(SLO)$/impimage.obj \
+ $(SLO)$/impprn.obj \
+ $(SLO)$/impvect.obj \
+ $(SLO)$/implncvt.obj \
+ $(SLO)$/jobset.obj \
+ $(SLO)$/line.obj \
+ $(SLO)$/lineinfo.obj \
+ $(SLO)$/mapmod.obj \
+ $(SLO)$/metaact.obj \
+ $(SLO)$/metric.obj \
+ $(SLO)$/octree.obj \
+ $(SLO)$/outmap.obj \
+ $(SLO)$/outdev.obj \
+ $(SLO)$/outdev2.obj \
+ $(SLO)$/outdev3.obj \
+ $(SLO)$/outdev4.obj \
+ $(SLO)$/outdev5.obj \
+ $(SLO)$/outdev6.obj \
+ $(SLO)$/poly.obj \
+ $(SLO)$/poly2.obj \
+ $(SLO)$/print.obj \
+ $(SLO)$/print2.obj \
+ $(SLO)$/regband.obj \
+ $(SLO)$/region.obj \
+ $(SLO)$/virdev.obj \
+ $(SLO)$/wall.obj \
+ $(SLO)$/opengl.obj
+
+.IF "$(remote)"!=""
+EXCEPTIONSFILES= $(SLO)$/bitmap.obj \
+ $(SLO)$/color.obj \
+ $(SLO)$/gfxlink.obj \
+ $(SLO)$/impgraph.obj \
+ $(SLO)$/impvect.obj \
+ $(SLO)$/outdev.obj \
+ $(SLO)$/outdev3.obj \
+ $(SLO)$/outdev6.obj \
+ $(SLO)$/print.obj \
+ $(SLO)$/print2.obj \
+ $(SLO)$/virdev.obj
+
+.ELSE
+EXCEPTIONSFILES= $(SLO)$/outdev.obj \
+ $(SLO)$/gfxlink.obj \
+ $(SLO)$/impgraph.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx
new file mode 100644
index 000000000000..5690e1c7cf0f
--- /dev/null
+++ b/vcl/source/gdi/mapmod.cxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * $RCSfile: mapmod.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_MAPMOD_CXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#define private public
+#ifndef _SV_MAPMOD_HXX
+#include <mapmod.hxx>
+#endif
+#undef private
+
+// =======================================================================
+
+DBG_NAME( MapMode );
+
+// -----------------------------------------------------------------------
+
+ImplMapMode::ImplMapMode() :
+ maOrigin( 0, 0 ),
+ maScaleX( 1, 1 ),
+ maScaleY( 1, 1 )
+{
+ mnRefCount = 1;
+ meUnit = MAP_PIXEL;
+ mbSimple = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplMapMode::ImplMapMode( const ImplMapMode& rImplMapMode ) :
+ maOrigin( rImplMapMode.maOrigin ),
+ maScaleX( rImplMapMode.maScaleX ),
+ maScaleY( rImplMapMode.maScaleY )
+{
+ mnRefCount = 1;
+ meUnit = rImplMapMode.meUnit;
+ mbSimple = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, ImplMapMode& rImplMapMode )
+{
+ VersionCompat aCompat( rIStm, STREAM_READ );
+ UINT16 nTmp16;
+
+ rIStm >> nTmp16; rImplMapMode.meUnit = (MapUnit) nTmp16;
+ rIStm >> rImplMapMode.maOrigin >> rImplMapMode.maScaleX >>
+ rImplMapMode.maScaleY >> rImplMapMode.mbSimple;
+
+ return rIStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const ImplMapMode& rImplMapMode )
+{
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
+
+ rOStm << (UINT16) rImplMapMode.meUnit <<
+ rImplMapMode.maOrigin <<
+ rImplMapMode.maScaleX <<
+ rImplMapMode.maScaleY <<
+ rImplMapMode.mbSimple;
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+static ImplMapMode* ImplGetStaticMapMode( MapUnit eUnit )
+{
+ // Achtung: Ganz fies und dreckig !!!
+#ifdef WIN
+ static long _near aStaticImplMapModeAry[(MAP_LASTENUMDUMMY)*sizeof(ImplMapMode)/sizeof(long)];
+#else
+ static long aStaticImplMapModeAry[(MAP_LASTENUMDUMMY)*sizeof(ImplMapMode)/sizeof(long)];
+#endif
+
+ ImplMapMode* pImplMapMode = ((ImplMapMode*)aStaticImplMapModeAry)+eUnit;
+ if ( !pImplMapMode->mbSimple )
+ {
+ Fraction aDefFraction( 1, 1 );
+ pImplMapMode->maScaleX = aDefFraction;
+ pImplMapMode->maScaleY = aDefFraction;
+ pImplMapMode->meUnit = eUnit;
+ pImplMapMode->mbSimple = TRUE;
+ }
+
+ return pImplMapMode;
+}
+
+// -----------------------------------------------------------------------
+
+inline void MapMode::ImplMakeUnique()
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpImplMapMode->mnRefCount != 1 )
+ {
+ if ( mpImplMapMode->mnRefCount )
+ mpImplMapMode->mnRefCount--;
+ mpImplMapMode = new ImplMapMode( *mpImplMapMode );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MapMode::MapMode()
+{
+ DBG_CTOR( MapMode, NULL );
+
+ mpImplMapMode = ImplGetStaticMapMode( MAP_PIXEL );
+}
+
+// -----------------------------------------------------------------------
+
+MapMode::MapMode( const MapMode& rMapMode )
+{
+ DBG_CTOR( MapMode, NULL );
+ DBG_CHKOBJ( &rMapMode, MapMode, NULL );
+ DBG_ASSERT( rMapMode.mpImplMapMode->mnRefCount < 0xFFFE, "MapMode: RefCount overflow" );
+
+ // shared Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpImplMapMode = rMapMode.mpImplMapMode;
+ // RefCount == 0 fuer statische Objekte
+ if ( mpImplMapMode->mnRefCount )
+ mpImplMapMode->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+MapMode::MapMode( MapUnit eUnit )
+{
+ DBG_CTOR( MapMode, NULL );
+
+ mpImplMapMode = ImplGetStaticMapMode( eUnit );
+}
+
+// -----------------------------------------------------------------------
+
+MapMode::MapMode( MapUnit eUnit, const Point& rLogicOrg,
+ const Fraction& rScaleX, const Fraction& rScaleY )
+{
+ DBG_CTOR( MapMode, NULL );
+
+ mpImplMapMode = new ImplMapMode;
+ mpImplMapMode->meUnit = eUnit;
+ mpImplMapMode->maOrigin = rLogicOrg;
+ mpImplMapMode->maScaleX = rScaleX;
+ mpImplMapMode->maScaleY = rScaleY;
+}
+
+// -----------------------------------------------------------------------
+
+MapMode::~MapMode()
+{
+ DBG_DTOR( MapMode, NULL );
+
+ // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
+ // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ if ( mpImplMapMode->mnRefCount )
+ {
+ if ( mpImplMapMode->mnRefCount == 1 )
+ delete mpImplMapMode;
+ else
+ mpImplMapMode->mnRefCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void MapMode::SetMapUnit( MapUnit eUnit )
+{
+ DBG_CHKTHIS( MapMode, NULL );
+
+ ImplMakeUnique();
+ mpImplMapMode->meUnit = eUnit;
+}
+
+// -----------------------------------------------------------------------
+
+void MapMode::SetOrigin( const Point& rLogicOrg )
+{
+ DBG_CHKTHIS( MapMode, NULL );
+
+ ImplMakeUnique();
+ mpImplMapMode->maOrigin = rLogicOrg;
+}
+
+// -----------------------------------------------------------------------
+
+void MapMode::SetScaleX( const Fraction& rScaleX )
+{
+ DBG_CHKTHIS( MapMode, NULL );
+
+ ImplMakeUnique();
+ mpImplMapMode->maScaleX = rScaleX;
+}
+
+// -----------------------------------------------------------------------
+
+void MapMode::SetScaleY( const Fraction& rScaleY )
+{
+ DBG_CHKTHIS( MapMode, NULL );
+
+ ImplMakeUnique();
+ mpImplMapMode->maScaleY = rScaleY;
+}
+
+// -----------------------------------------------------------------------
+
+MapMode& MapMode::operator=( const MapMode& rMapMode )
+{
+ DBG_CHKTHIS( MapMode, NULL );
+ DBG_CHKOBJ( &rMapMode, MapMode, NULL );
+ DBG_ASSERT( rMapMode.mpImplMapMode->mnRefCount < 0xFFFE, "MapMode: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ // RefCount == 0 fuer statische Objekte
+ if ( rMapMode.mpImplMapMode->mnRefCount )
+ rMapMode.mpImplMapMode->mnRefCount++;
+
+ // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
+ // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ if ( mpImplMapMode->mnRefCount )
+ {
+ if ( mpImplMapMode->mnRefCount == 1 )
+ delete mpImplMapMode;
+ else
+ mpImplMapMode->mnRefCount--;
+ }
+
+ mpImplMapMode = rMapMode.mpImplMapMode;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MapMode::operator==( const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( MapMode, NULL );
+ DBG_CHKOBJ( &rMapMode, MapMode, NULL );
+
+ if ( mpImplMapMode == rMapMode.mpImplMapMode )
+ return TRUE;
+
+ if ( (mpImplMapMode->meUnit == rMapMode.mpImplMapMode->meUnit) &&
+ (mpImplMapMode->maOrigin == rMapMode.mpImplMapMode->maOrigin) &&
+ (mpImplMapMode->maScaleX == rMapMode.mpImplMapMode->maScaleX) &&
+ (mpImplMapMode->maScaleY == rMapMode.mpImplMapMode->maScaleY) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MapMode::IsDefault() const
+{
+ DBG_CHKTHIS( MapMode, NULL );
+
+ ImplMapMode* pDefMapMode = ImplGetStaticMapMode( MAP_PIXEL );
+ if ( mpImplMapMode == pDefMapMode )
+ return TRUE;
+
+ if ( (mpImplMapMode->meUnit == pDefMapMode->meUnit) &&
+ (mpImplMapMode->maOrigin == pDefMapMode->maOrigin) &&
+ (mpImplMapMode->maScaleX == pDefMapMode->maScaleX) &&
+ (mpImplMapMode->maScaleY == pDefMapMode->maScaleY) )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, MapMode& rMapMode )
+{
+ rMapMode.ImplMakeUnique();
+ return (rIStm >> *rMapMode.mpImplMapMode);
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const MapMode& rMapMode )
+{
+ return (rOStm << *rMapMode.mpImplMapMode);
+}
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
new file mode 100644
index 000000000000..caa28f1ee856
--- /dev/null
+++ b/vcl/source/gdi/metaact.cxx
@@ -0,0 +1,3434 @@
+/*************************************************************************
+ *
+ * $RCSfile: metaact.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_METAACT_CXX
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#include <string.h>
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+
+// ========================================================================
+
+inline void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY )
+{
+ rPt.X() = FRound( fScaleX * rPt.X() );
+ rPt.Y() = FRound( fScaleY * rPt.Y() );
+}
+
+// ------------------------------------------------------------------------
+
+inline void ImplScaleSize( Size& rSz, double fScaleX, double fScaleY )
+{
+ rSz.Width() = FRound( fScaleX * rSz.Width() );
+ rSz.Height() = FRound( fScaleY * rSz.Height() );
+}
+
+// ------------------------------------------------------------------------
+
+inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY )
+{
+ Point aTL( rRect.TopLeft() );
+ Point aBR( rRect.BottomRight() );
+
+ ImplScalePoint( aTL, fScaleX, fScaleY );
+ ImplScalePoint( aBR, fScaleX, fScaleY );
+
+ rRect = Rectangle( aTL, aBR );
+}
+
+// ------------------------------------------------------------------------
+
+inline void ImplScalePoly( Polygon& rPoly, double fScaleX, double fScaleY )
+{
+ for( USHORT i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
+ ImplScalePoint( rPoly[ i ], fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+inline void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScaleY )
+{
+ if( !rLineInfo.IsDefault() )
+ {
+ const double fScale = ( fScaleX + fScaleY ) * 0.5;
+
+ rLineInfo.SetWidth( FRound( fScale * rLineInfo.GetWidth() ) );
+ rLineInfo.SetDashLen( FRound( fScale * rLineInfo.GetDashLen() ) );
+ rLineInfo.SetDotLen( FRound( fScale * rLineInfo.GetDotLen() ) );
+ rLineInfo.SetDistance( FRound( fScale * rLineInfo.GetDistance() ) );
+ }
+}
+
+// ========================================================================
+
+#define COMPAT( _def_rIStm ) VersionCompat aCompat( ( _def_rIStm ), STREAM_READ );
+#define COMPAT_VERSION() aCompat.GetVersion()
+#define WRITE_BASE_COMPAT( _def_rOStm, _def_nVer, _pWriteData ) \
+ MetaAction::Write( ( _def_rOStm ), _pWriteData ); \
+ VersionCompat aCompat( ( _def_rOStm ), STREAM_WRITE, ( _def_nVer ) );
+
+// ========================================================================
+
+MetaAction::MetaAction() :
+ mnRefCount( 1 ),
+ mnType( META_NULL_ACTION )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction::MetaAction( USHORT nType ) :
+ mnRefCount( 1 ),
+ mnType( nType )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction::~MetaAction()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaAction::Execute( OutputDevice* pOut )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaAction::Clone()
+{
+ return new MetaAction;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaAction::Move( long nHorzMove, long nVertMove )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaAction::Scale( double fScaleX, double fScaleY )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaAction::Write( SvStream& rOStm, ImplMetaWriteData* )
+{
+ rOStm << mnType;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ rIStm >> mnType;
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData )
+{
+ MetaAction* pAction = NULL;
+ UINT16 nType;
+
+ rIStm >> nType;
+
+ switch( nType )
+ {
+ case( META_NULL_ACTION ): pAction = new MetaAction; break;
+ case( META_PIXEL_ACTION ): pAction = new MetaPixelAction; break;
+ case( META_POINT_ACTION ): pAction = new MetaPointAction; break;
+ case( META_LINE_ACTION ): pAction = new MetaLineAction; break;
+ case( META_RECT_ACTION ): pAction = new MetaRectAction; break;
+ case( META_ROUNDRECT_ACTION ): pAction = new MetaRoundRectAction; break;
+ case( META_ELLIPSE_ACTION ): pAction = new MetaEllipseAction; break;
+ case( META_ARC_ACTION ): pAction = new MetaArcAction; break;
+ case( META_PIE_ACTION ): pAction = new MetaPieAction; break;
+ case( META_CHORD_ACTION ): pAction = new MetaChordAction; break;
+ case( META_POLYLINE_ACTION ): pAction = new MetaPolyLineAction; break;
+ case( META_POLYGON_ACTION ): pAction = new MetaPolygonAction; break;
+ case( META_POLYPOLYGON_ACTION ): pAction = new MetaPolyPolygonAction; break;
+ case( META_TEXT_ACTION ): pAction = new MetaTextAction; break;
+ case( META_TEXTARRAY_ACTION ): pAction = new MetaTextArrayAction; break;
+ case( META_STRETCHTEXT_ACTION ): pAction = new MetaStretchTextAction; break;
+ case( META_TEXTRECT_ACTION ): pAction = new MetaTextRectAction; break;
+ case( META_TEXTLINE_ACTION ): pAction = new MetaTextLineAction; break;
+ case( META_BMP_ACTION ): pAction = new MetaBmpAction; break;
+ case( META_BMPSCALE_ACTION ): pAction = new MetaBmpScaleAction; break;
+ case( META_BMPSCALEPART_ACTION ): pAction = new MetaBmpScalePartAction; break;
+ case( META_BMPEX_ACTION ): pAction = new MetaBmpExAction; break;
+ case( META_BMPEXSCALE_ACTION ): pAction = new MetaBmpExScaleAction; break;
+ case( META_BMPEXSCALEPART_ACTION ): pAction = new MetaBmpExScalePartAction; break;
+ case( META_MASK_ACTION ): pAction = new MetaMaskAction; break;
+ case( META_MASKSCALE_ACTION ): pAction = new MetaMaskScaleAction; break;
+ case( META_MASKSCALEPART_ACTION ): pAction = new MetaMaskScalePartAction; break;
+ case( META_GRADIENT_ACTION ): pAction = new MetaGradientAction; break;
+ case( META_GRADIENTEX_ACTION ): pAction = new MetaGradientExAction; break;
+ case( META_HATCH_ACTION ): pAction = new MetaHatchAction; break;
+ case( META_WALLPAPER_ACTION ): pAction = new MetaWallpaperAction; break;
+ case( META_CLIPREGION_ACTION ): pAction = new MetaClipRegionAction; break;
+ case( META_ISECTRECTCLIPREGION_ACTION ): pAction = new MetaISectRectClipRegionAction; break;
+ case( META_ISECTREGIONCLIPREGION_ACTION ): pAction = new MetaISectRegionClipRegionAction; break;
+ case( META_MOVECLIPREGION_ACTION ): pAction = new MetaMoveClipRegionAction; break;
+ case( META_LINECOLOR_ACTION ): pAction = new MetaLineColorAction; break;
+ case( META_FILLCOLOR_ACTION ): pAction = new MetaFillColorAction; break;
+ case( META_TEXTCOLOR_ACTION ): pAction = new MetaTextColorAction; break;
+ case( META_TEXTFILLCOLOR_ACTION ): pAction = new MetaTextFillColorAction; break;
+ case( META_TEXTLINECOLOR_ACTION ): pAction = new MetaTextLineColorAction; break;
+ case( META_TEXTALIGN_ACTION ): pAction = new MetaTextAlignAction; break;
+ case( META_MAPMODE_ACTION ): pAction = new MetaMapModeAction; break;
+ case( META_FONT_ACTION ): pAction = new MetaFontAction; break;
+ case( META_PUSH_ACTION ): pAction = new MetaPushAction; break;
+ case( META_POP_ACTION ): pAction = new MetaPopAction; break;
+ case( META_RASTEROP_ACTION ): pAction = new MetaRasterOpAction; break;
+ case( META_TRANSPARENT_ACTION ): pAction = new MetaTransparentAction; break;
+ case( META_FLOATTRANSPARENT_ACTION ): pAction = new MetaFloatTransparentAction; break;
+ case( META_EPS_ACTION ): pAction = new MetaEPSAction; break;
+ case( META_REFPOINT_ACTION ): pAction = new MetaRefPointAction; break;
+ case( META_COMMENT_ACTION ): pAction = new MetaCommentAction; break;
+
+ default:
+ {
+ // Action ueberlesen durch Kombination Ctor/Dtor,
+ // new/delete, weil Compiler sonst vielleicht wegoptimieren
+ delete ( new VersionCompat( rIStm, STREAM_READ ) );
+ }
+ break;
+ }
+
+ if( pAction )
+ pAction->Read( rIStm, pData );
+
+ return pAction;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Pixel, META_PIXEL_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaPixelAction::MetaPixelAction( const Point& rPt, const Color& rColor ) :
+ MetaAction ( META_PIXEL_ACTION ),
+ maPt ( rPt ),
+ maColor ( rColor )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPixelAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawPixel( maPt, maColor );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPixelAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPixelAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPixelAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPixelAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPixelAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPt;
+ maColor.Write( rOStm, TRUE );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPixelAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maPt;
+ maColor.Read( rIStm, TRUE );
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Point, META_POINT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaPointAction::MetaPointAction( const Point& rPt ) :
+ MetaAction ( META_POINT_ACTION ),
+ maPt ( rPt )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPointAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawPixel( maPt );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPointAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPointAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPointAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPointAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPt;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maPt;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Line, META_LINE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd ) :
+ MetaAction ( META_LINE_ACTION ),
+ maStartPt ( rStart ),
+ maEndPt ( rEnd )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaLineAction::MetaLineAction( const Point& rStart, const Point& rEnd,
+ const LineInfo& rLineInfo ) :
+ MetaAction ( META_LINE_ACTION ),
+ maLineInfo ( rLineInfo ),
+ maStartPt ( rStart ),
+ maEndPt ( rEnd )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineAction::Execute( OutputDevice* pOut )
+{
+ if( maLineInfo.IsDefault() )
+ pOut->DrawLine( maStartPt, maEndPt );
+ else
+ pOut->DrawLine( maStartPt, maEndPt, maLineInfo );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaLineAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaLineAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineAction::Move( long nHorzMove, long nVertMove )
+{
+ maStartPt.Move( nHorzMove, nVertMove );
+ maEndPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maStartPt, fScaleX, fScaleY );
+ ImplScalePoint( maEndPt, fScaleX, fScaleY );
+ ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 2, pData );
+
+ rOStm << maStartPt << maEndPt; // Version 1
+ rOStm << maLineInfo; // Version 2
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+
+ // Version 1
+ rIStm >> maStartPt >> maEndPt;
+
+ // Version 2
+ if( aCompat.GetVersion() >= 2 )
+ {
+ rIStm >> maLineInfo;
+ }
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Rect, META_RECT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaRectAction::MetaRectAction( const Rectangle& rRect ) :
+ MetaAction ( META_RECT_ACTION ),
+ maRect ( rRect )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRectAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawRect( maRect );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaRectAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaRectAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRectAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRectAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( RoundRect, META_ROUNDRECT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaRoundRectAction::MetaRoundRectAction( const Rectangle& rRect,
+ long nHorzRound, long nVertRound ) :
+ MetaAction ( META_ROUNDRECT_ACTION ),
+ maRect ( rRect ),
+ mnHorzRound ( nHorzRound ),
+ mnVertRound ( nVertRound )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRoundRectAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawRect( maRect, mnHorzRound, mnVertRound );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaRoundRectAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaRoundRectAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRoundRectAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRoundRectAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+ mnHorzRound = FRound( mnHorzRound * fScaleX );
+ mnVertRound = FRound( mnVertRound * fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRoundRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect << mnHorzRound << mnVertRound;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRoundRectAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect >> mnHorzRound >> mnVertRound;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Ellipse, META_ELLIPSE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaEllipseAction::MetaEllipseAction( const Rectangle& rRect ) :
+ MetaAction ( META_ELLIPSE_ACTION ),
+ maRect ( rRect )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEllipseAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawEllipse( maRect );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaEllipseAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaEllipseAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEllipseAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEllipseAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEllipseAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEllipseAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Arc, META_ARC_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaArcAction::MetaArcAction( const Rectangle& rRect,
+ const Point& rStart, const Point& rEnd ) :
+ MetaAction ( META_ARC_ACTION ),
+ maRect ( rRect ),
+ maStartPt ( rStart ),
+ maEndPt ( rEnd )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaArcAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawArc( maRect, maStartPt, maEndPt );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaArcAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaArcAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaArcAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+ maStartPt.Move( nHorzMove, nVertMove );
+ maEndPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaArcAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+ ImplScalePoint( maStartPt, fScaleX, fScaleY );
+ ImplScalePoint( maEndPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaArcAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect << maStartPt << maEndPt;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaArcAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect >> maStartPt >> maEndPt;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Pie, META_PIE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaPieAction::MetaPieAction( const Rectangle& rRect,
+ const Point& rStart, const Point& rEnd ) :
+ MetaAction ( META_PIE_ACTION ),
+ maRect ( rRect ),
+ maStartPt ( rStart ),
+ maEndPt ( rEnd )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPieAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawPie( maRect, maStartPt, maEndPt );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPieAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPieAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPieAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+ maStartPt.Move( nHorzMove, nVertMove );
+ maEndPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPieAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+ ImplScalePoint( maStartPt, fScaleX, fScaleY );
+ ImplScalePoint( maEndPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPieAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect << maStartPt << maEndPt;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPieAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect >> maStartPt >> maEndPt;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Chord, META_CHORD_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaChordAction::MetaChordAction( const Rectangle& rRect,
+ const Point& rStart, const Point& rEnd ) :
+ MetaAction ( META_CHORD_ACTION ),
+ maRect ( rRect ),
+ maStartPt ( rStart ),
+ maEndPt ( rEnd )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaChordAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawChord( maRect, maStartPt, maEndPt );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaChordAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaChordAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaChordAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+ maStartPt.Move( nHorzMove, nVertMove );
+ maEndPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaChordAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+ ImplScalePoint( maStartPt, fScaleX, fScaleY );
+ ImplScalePoint( maEndPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaChordAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect << maStartPt << maEndPt;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaChordAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect >> maStartPt >> maEndPt;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( PolyLine, META_POLYLINE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaPolyLineAction::MetaPolyLineAction( const Polygon& rPoly ) :
+ MetaAction ( META_POLYLINE_ACTION ),
+ maPoly ( rPoly )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaPolyLineAction::MetaPolyLineAction( const Polygon& rPoly, const LineInfo& rLineInfo ) :
+ MetaAction ( META_POLYLINE_ACTION ),
+ maLineInfo ( rLineInfo ),
+ maPoly ( rPoly )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyLineAction::Execute( OutputDevice* pOut )
+{
+ if( maLineInfo.IsDefault() )
+ pOut->DrawPolyLine( maPoly );
+ else
+ pOut->DrawPolyLine( maPoly, maLineInfo );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPolyLineAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPolyLineAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyLineAction::Move( long nHorzMove, long nVertMove )
+{
+ maPoly.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyLineAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoly( maPoly, fScaleX, fScaleY );
+ ImplScaleLineInfo( maLineInfo, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 2, pData );
+
+ rOStm << maPoly; // Version 1
+ rOStm << maLineInfo; // Version 2
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+
+ // Version 1
+ rIStm >> maPoly;
+
+ // Version 2
+ if( aCompat.GetVersion() >= 2 )
+ {
+ rIStm >> maLineInfo;
+ }
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Polygon, META_POLYGON_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaPolygonAction::MetaPolygonAction( const Polygon& rPoly ) :
+ MetaAction ( META_POLYGON_ACTION ),
+ maPoly ( rPoly )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolygonAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawPolygon( maPoly );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPolygonAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPolygonAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolygonAction::Move( long nHorzMove, long nVertMove )
+{
+ maPoly.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolygonAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoly( maPoly, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPoly;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolygonAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maPoly;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( PolyPolygon, META_POLYPOLYGON_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaPolyPolygonAction::MetaPolyPolygonAction( const PolyPolygon& rPolyPoly ) :
+ MetaAction ( META_POLYPOLYGON_ACTION ),
+ maPolyPoly ( rPolyPoly )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyPolygonAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawPolyPolygon( maPolyPoly );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPolyPolygonAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPolyPolygonAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyPolygonAction::Move( long nHorzMove, long nVertMove )
+{
+ maPolyPoly.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyPolygonAction::Scale( double fScaleX, double fScaleY )
+{
+ for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
+ ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPolyPoly;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPolyPolygonAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maPolyPoly;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Text, META_TEXT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTextAction::MetaTextAction( const Point& rPt, const XubString& rStr,
+ USHORT nIndex, USHORT nLen ) :
+ MetaAction ( META_TEXT_ACTION ),
+ maPt ( rPt ),
+ maStr ( rStr ),
+ mnIndex ( nIndex ),
+ mnLen ( nLen )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawText( maPt, maStr, mnIndex, mnLen );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTextAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPt;
+ rOStm.WriteByteString( maStr, pData->meActualCharSet );
+ rOStm << mnIndex;
+ rOStm << mnLen;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
+{
+ COMPAT( rIStm );
+ rIStm >> maPt;
+ rIStm.ReadByteString( maStr, pData->meActualCharSet );
+ rIStm >> mnIndex;
+ rIStm >> mnLen;
+}
+
+// ========================================================================
+
+MetaTextArrayAction::MetaTextArrayAction() :
+ MetaAction ( META_TEXTARRAY_ACTION ),
+ mpDXAry ( NULL ),
+ mnIndex ( 0 ),
+ mnLen ( 0 )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaTextArrayAction::MetaTextArrayAction( const MetaTextArrayAction& rAction ) :
+ MetaAction ( META_TEXTARRAY_ACTION ),
+ maStartPt ( rAction.maStartPt ),
+ maStr ( rAction.maStr ),
+ mnIndex ( rAction.mnIndex ),
+ mnLen ( rAction.mnLen )
+{
+ if( rAction.mpDXAry )
+ {
+ const ULONG nAryLen = mnLen - 1;
+
+ mpDXAry = new long[ nAryLen ];
+ memcpy( mpDXAry, rAction.mpDXAry, nAryLen * sizeof( long ) );
+ }
+ else
+ mpDXAry = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+MetaTextArrayAction::MetaTextArrayAction( const Point& rStartPt,
+ const XubString& rStr,
+ const long* pDXAry,
+ USHORT nIndex,
+ USHORT nLen ) :
+ MetaAction ( META_TEXTARRAY_ACTION ),
+ maStartPt ( rStartPt ),
+ maStr ( rStr ),
+ mnIndex ( nIndex ),
+ mnLen ( ( nLen == STRING_LEN ) ? rStr.Len() : nLen )
+{
+ const ULONG nAryLen = ( ( mnLen > 1 ) && pDXAry ) ? ( mnLen - 1 ) : 0UL;
+
+ if( nAryLen )
+ {
+ mpDXAry = new long[ nAryLen ];
+ memcpy( mpDXAry, pDXAry, nAryLen * sizeof( long ) );
+ }
+ else
+ mpDXAry = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+MetaTextArrayAction::~MetaTextArrayAction()
+{
+ delete[] mpDXAry;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextArrayAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawTextArray( maStartPt, maStr, mpDXAry, mnIndex, mnLen );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextArrayAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTextArrayAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextArrayAction::Move( long nHorzMove, long nVertMove )
+{
+ maStartPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextArrayAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maStartPt, fScaleX, fScaleY );
+
+ if ( mpDXAry && mnLen )
+ {
+ for ( USHORT i = 0, nCount = mnLen - 1; i < nCount; i++ )
+ mpDXAry[ i ] = FRound( mpDXAry[ i ] * fScaleX );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextArrayAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ const ULONG nAryLen = ( ( mnLen > 1 ) && mpDXAry ) ? ( mnLen - 1 ) : 0UL;
+
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maStartPt;
+ rOStm.WriteByteString( maStr, pData->meActualCharSet );
+ rOStm << mnIndex;
+ rOStm << mnLen;
+ rOStm << nAryLen;
+
+ for( ULONG i = 0UL; i < nAryLen; i++ )
+ rOStm << mpDXAry[ i ];
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
+{
+ ULONG nAryLen;
+
+ delete[] mpDXAry;
+
+ COMPAT( rIStm );
+ rIStm >> maStartPt;
+ rIStm.ReadByteString( maStr, pData->meActualCharSet );
+ rIStm >> mnIndex;
+ rIStm >> mnLen;
+ rIStm >> nAryLen;
+
+ if( nAryLen )
+ {
+ mpDXAry = new long[ nAryLen ];
+
+ for( ULONG i = 0UL; i < nAryLen; i++ )
+ rIStm >> mpDXAry[ i ];
+ }
+ else
+ mpDXAry = NULL;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( StretchText, META_STRETCHTEXT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaStretchTextAction::MetaStretchTextAction( const Point& rPt, ULONG nWidth,
+ const XubString& rStr,
+ USHORT nIndex, USHORT nLen ) :
+ MetaAction ( META_STRETCHTEXT_ACTION ),
+ maPt ( rPt ),
+ maStr ( rStr ),
+ mnWidth ( nWidth ),
+ mnIndex ( nIndex ),
+ mnLen ( nLen )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaStretchTextAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawStretchText( maPt, mnWidth, maStr, mnIndex, mnLen );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaStretchTextAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaStretchTextAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaStretchTextAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaStretchTextAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+ mnWidth = (ULONG)FRound( mnWidth * fScaleX );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaStretchTextAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPt;
+ rOStm.WriteByteString( maStr, pData->meActualCharSet );
+ rOStm << mnWidth;
+ rOStm << mnIndex;
+ rOStm << mnLen;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
+{
+ COMPAT( rIStm );
+ rIStm >> maPt;
+ rIStm.ReadByteString( maStr, pData->meActualCharSet );
+ rIStm >> mnWidth;
+ rIStm >> mnIndex;
+ rIStm >> mnLen;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( TextRect, META_TEXTRECT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTextRectAction::MetaTextRectAction( const Rectangle& rRect,
+ const XubString& rStr, USHORT nStyle ) :
+ MetaAction ( META_TEXTRECT_ACTION ),
+ maRect ( rRect ),
+ maStr ( rStr ),
+ mnStyle ( nStyle )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextRectAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawText( maRect, maStr, mnStyle );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextRectAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTextRectAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextRectAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextRectAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextRectAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect;
+ rOStm.WriteByteString( maStr, pData->meActualCharSet );
+ rOStm << mnStyle;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect;
+ rIStm.ReadByteString( maStr, pData->meActualCharSet );
+ rIStm >> mnStyle;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( TextLine, META_TEXTLINE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTextLineAction::MetaTextLineAction( const Point& rPos, long nWidth,
+ FontStrikeout eStrikeout,
+ FontUnderline eUnderline ) :
+ MetaAction ( META_TEXTLINE_ACTION ),
+ maPos ( rPos ),
+ mnWidth ( nWidth ),
+ meStrikeout ( eStrikeout ),
+ meUnderline ( eUnderline )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextLineAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*)new MetaTextLineAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineAction::Move( long nHorzMove, long nVertMove )
+{
+ maPos.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPos, fScaleX, fScaleY );
+ mnWidth = FRound( mnWidth * fScaleX );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 2, pData );
+
+ rOStm << maPos;
+ rOStm << mnWidth;
+ rOStm << (ULONG)meStrikeout;
+ rOStm << (ULONG)meUnderline;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+
+ ULONG nTemp;
+ rIStm >> maPos;
+ rIStm >> mnWidth;
+ rIStm >> nTemp;
+ meStrikeout = (FontStrikeout)nTemp;
+ rIStm >> nTemp;
+ meUnderline = (FontUnderline)nTemp;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Bmp, META_BMP_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaBmpAction::MetaBmpAction( const Point& rPt, const Bitmap& rBmp ) :
+ MetaAction ( META_BMP_ACTION ),
+ maBmp ( rBmp ),
+ maPt ( rPt )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawBitmap( maPt, maBmp );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaBmpAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaBmpAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmp )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmp << maPt;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmp >> maPt;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( BmpScale, META_BMPSCALE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaBmpScaleAction::MetaBmpScaleAction( const Point& rPt, const Size& rSz,
+ const Bitmap& rBmp ) :
+ MetaAction ( META_BMPSCALE_ACTION ),
+ maBmp ( rBmp ),
+ maPt ( rPt ),
+ maSz ( rSz )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScaleAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawBitmap( maPt, maSz, maBmp );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaBmpScaleAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaBmpScaleAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScaleAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+ ImplScaleSize( maSz, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmp )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmp << maPt << maSz;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmp >> maPt >> maSz;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( BmpScalePart, META_BMPSCALEPART_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaBmpScalePartAction::MetaBmpScalePartAction( const Point& rDstPt, const Size& rDstSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Bitmap& rBmp ) :
+ MetaAction ( META_BMPSCALEPART_ACTION ),
+ maBmp ( rBmp ),
+ maDstPt ( rDstPt ),
+ maDstSz ( rDstSz ),
+ maSrcPt ( rSrcPt ),
+ maSrcSz ( rSrcSz )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScalePartAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawBitmap( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaBmpScalePartAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaBmpScalePartAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScalePartAction::Move( long nHorzMove, long nVertMove )
+{
+ maDstPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maDstPt, fScaleX, fScaleY );
+ ImplScaleSize( maDstSz, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmp )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmp << maDstPt << maDstSz << maSrcPt << maSrcSz;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmp >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( BmpEx, META_BMPEX_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaBmpExAction::MetaBmpExAction( const Point& rPt, const BitmapEx& rBmpEx ) :
+ MetaAction ( META_BMPEX_ACTION ),
+ maBmpEx ( rBmpEx ),
+ maPt ( rPt )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawBitmapEx( maPt, maBmpEx );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaBmpExAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaBmpExAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmpEx.GetBitmap() )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmpEx << maPt;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmpEx >> maPt;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( BmpExScale, META_BMPEXSCALE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaBmpExScaleAction::MetaBmpExScaleAction( const Point& rPt, const Size& rSz,
+ const BitmapEx& rBmpEx ) :
+ MetaAction ( META_BMPEXSCALE_ACTION ),
+ maBmpEx ( rBmpEx ),
+ maPt ( rPt ),
+ maSz ( rSz )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScaleAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawBitmapEx( maPt, maSz, maBmpEx );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaBmpExScaleAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaBmpExScaleAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScaleAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+ ImplScaleSize( maSz, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmpEx.GetBitmap() )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmpEx << maPt << maSz;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmpEx >> maPt >> maSz;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( BmpExScalePart, META_BMPEXSCALEPART_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaBmpExScalePartAction::MetaBmpExScalePartAction( const Point& rDstPt, const Size& rDstSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const BitmapEx& rBmpEx ) :
+ MetaAction ( META_BMPEXSCALEPART_ACTION ),
+ maBmpEx ( rBmpEx ),
+ maDstPt ( rDstPt ),
+ maDstSz ( rDstSz ),
+ maSrcPt ( rSrcPt ),
+ maSrcSz ( rSrcSz )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScalePartAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawBitmapEx( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmpEx );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaBmpExScalePartAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaBmpExScalePartAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScalePartAction::Move( long nHorzMove, long nVertMove )
+{
+ maDstPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maDstPt, fScaleX, fScaleY );
+ ImplScaleSize( maDstSz, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmpEx.GetBitmap() )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmpEx << maDstPt << maDstSz << maSrcPt << maSrcSz;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaBmpExScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmpEx >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Mask, META_MASK_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaMaskAction::MetaMaskAction( const Point& rPt,
+ const Bitmap& rBmp,
+ const Color& rColor ) :
+ MetaAction ( META_MASK_ACTION ),
+ maBmp ( rBmp ),
+ maColor ( rColor ),
+ maPt ( rPt )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawMask( maPt, maBmp, maColor );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaMaskAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaMaskAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmp )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmp << maPt;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmp >> maPt;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( MaskScale, META_MASKSCALE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaMaskScaleAction::MetaMaskScaleAction( const Point& rPt, const Size& rSz,
+ const Bitmap& rBmp,
+ const Color& rColor ) :
+ MetaAction ( META_MASKSCALE_ACTION ),
+ maBmp ( rBmp ),
+ maColor ( rColor ),
+ maPt ( rPt ),
+ maSz ( rSz )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScaleAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawMask( maPt, maSz, maBmp, maColor );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaMaskScaleAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaMaskScaleAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScaleAction::Move( long nHorzMove, long nVertMove )
+{
+ maPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPt, fScaleX, fScaleY );
+ ImplScaleSize( maSz, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmp )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmp << maPt << maSz;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScaleAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmp >> maPt >> maSz;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( MaskScalePart, META_MASKSCALEPART_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaMaskScalePartAction::MetaMaskScalePartAction( const Point& rDstPt, const Size& rDstSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const Bitmap& rBmp,
+ const Color& rColor ) :
+ MetaAction ( META_MASKSCALEPART_ACTION ),
+ maBmp ( rBmp ),
+ maColor ( rColor ),
+ maDstPt ( rDstPt ),
+ maDstSz ( rDstSz ),
+ maSrcPt ( rSrcPt ),
+ maSrcSz ( rSrcSz )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScalePartAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawMask( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp, maColor );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaMaskScalePartAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaMaskScalePartAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScalePartAction::Move( long nHorzMove, long nVertMove )
+{
+ maDstPt.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maDstPt, fScaleX, fScaleY );
+ ImplScaleSize( maDstSz, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ if( !!maBmp )
+ {
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maBmp;
+ maColor.Write( rOStm, TRUE );
+ rOStm << maDstPt << maDstSz << maSrcPt << maSrcSz;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMaskScalePartAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maBmp;
+ maColor.Read( rIStm, TRUE );
+ rIStm >> maDstPt >> maDstSz >> maSrcPt >> maSrcSz;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Gradient, META_GRADIENT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaGradientAction::MetaGradientAction( const Rectangle& rRect, const Gradient& rGradient ) :
+ MetaAction ( META_GRADIENT_ACTION ),
+ maRect ( rRect ),
+ maGradient ( rGradient )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawGradient( maRect, maGradient );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaGradientAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaGradientAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect << maGradient;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect >> maGradient;
+}
+
+// ========================================================================
+
+MetaGradientExAction::MetaGradientExAction() :
+ MetaAction ( META_GRADIENTEX_ACTION )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaGradientExAction::MetaGradientExAction( const PolyPolygon& rPolyPoly, const Gradient& rGradient ) :
+ MetaAction ( META_GRADIENTEX_ACTION ),
+ maPolyPoly ( rPolyPoly ),
+ maGradient ( rGradient )
+{
+}
+
+// ------------------------------------------------------------------------
+
+MetaGradientExAction::~MetaGradientExAction()
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientExAction::Execute( OutputDevice* pOut )
+{
+ if( pOut->GetConnectMetaFile() )
+ pOut->GetConnectMetaFile()->AddAction( Clone() );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaGradientExAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaGradientExAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientExAction::Move( long nHorzMove, long nVertMove )
+{
+ maPolyPoly.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientExAction::Scale( double fScaleX, double fScaleY )
+{
+ for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
+ ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPolyPoly << maGradient;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaGradientExAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maPolyPoly >> maGradient;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Hatch, META_HATCH_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaHatchAction::MetaHatchAction( const PolyPolygon& rPolyPoly, const Hatch& rHatch ) :
+ MetaAction ( META_HATCH_ACTION ),
+ maPolyPoly ( rPolyPoly ),
+ maHatch ( rHatch )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaHatchAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawHatch( maPolyPoly, maHatch );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaHatchAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaHatchAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaHatchAction::Move( long nHorzMove, long nVertMove )
+{
+ maPolyPoly.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaHatchAction::Scale( double fScaleX, double fScaleY )
+{
+ for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
+ ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPolyPoly << maHatch;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaHatchAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maPolyPoly >> maHatch;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Wallpaper, META_WALLPAPER_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaWallpaperAction::MetaWallpaperAction( const Rectangle& rRect,
+ const Wallpaper& rPaper ) :
+ MetaAction ( META_WALLPAPER_ACTION ),
+ maRect ( rRect ),
+ maWallpaper ( rPaper )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaWallpaperAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawWallpaper( maRect, maWallpaper );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaWallpaperAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaWallpaperAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaWallpaperAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaWallpaperAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaWallpaperAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maWallpaper;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaWallpaperAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maWallpaper;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( ClipRegion, META_CLIPREGION_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaClipRegionAction::MetaClipRegionAction( const Region& rRegion, BOOL bClip ) :
+ MetaAction ( META_CLIPREGION_ACTION ),
+ maRegion ( rRegion ),
+ mbClip ( bClip )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaClipRegionAction::Execute( OutputDevice* pOut )
+{
+ if( mbClip )
+ pOut->SetClipRegion( maRegion );
+ else
+ pOut->SetClipRegion();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaClipRegionAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaClipRegionAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaClipRegionAction::Move( long nHorzMove, long nVertMove )
+{
+ maRegion.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaClipRegionAction::Scale( double fScaleX, double fScaleY )
+{
+ maRegion.Scale( fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRegion << mbClip;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRegion >> mbClip;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( ISectRectClipRegion, META_ISECTRECTCLIPREGION_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaISectRectClipRegionAction::MetaISectRectClipRegionAction( const Rectangle& rRect ) :
+ MetaAction ( META_ISECTRECTCLIPREGION_ACTION ),
+ maRect ( rRect )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRectClipRegionAction::Execute( OutputDevice* pOut )
+{
+ pOut->IntersectClipRegion( maRect );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaISectRectClipRegionAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaISectRectClipRegionAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRectClipRegionAction::Move( long nHorzMove, long nVertMove )
+{
+ maRect.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRectClipRegionAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScaleRect( maRect, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRectClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRect;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRectClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRect;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( ISectRegionClipRegion, META_ISECTREGIONCLIPREGION_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaISectRegionClipRegionAction::MetaISectRegionClipRegionAction( const Region& rRegion ) :
+ MetaAction ( META_ISECTREGIONCLIPREGION_ACTION ),
+ maRegion ( rRegion )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRegionClipRegionAction::Execute( OutputDevice* pOut )
+{
+ pOut->IntersectClipRegion( maRegion );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaISectRegionClipRegionAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaISectRegionClipRegionAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRegionClipRegionAction::Move( long nHorzMove, long nVertMove )
+{
+ maRegion.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRegionClipRegionAction::Scale( double fScaleX, double fScaleY )
+{
+ maRegion.Scale( fScaleX, fScaleY );
+}
+
+
+// ------------------------------------------------------------------------
+
+void MetaISectRegionClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRegion;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaISectRegionClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRegion;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( MoveClipRegion, META_MOVECLIPREGION_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaMoveClipRegionAction::MetaMoveClipRegionAction( long nHorzMove, long nVertMove ) :
+ MetaAction ( META_MOVECLIPREGION_ACTION ),
+ mnHorzMove ( nHorzMove ),
+ mnVertMove ( nVertMove )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMoveClipRegionAction::Execute( OutputDevice* pOut )
+{
+ pOut->MoveClipRegion( mnHorzMove, mnVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaMoveClipRegionAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaMoveClipRegionAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMoveClipRegionAction::Scale( double fScaleX, double fScaleY )
+{
+ mnHorzMove = FRound( mnHorzMove * fScaleX );
+ mnVertMove = FRound( mnVertMove * fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMoveClipRegionAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << mnHorzMove << mnVertMove;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMoveClipRegionAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> mnHorzMove >> mnVertMove;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( LineColor, META_LINECOLOR_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaLineColorAction::MetaLineColorAction( const Color& rColor, BOOL bSet ) :
+ MetaAction ( META_LINECOLOR_ACTION ),
+ maColor ( rColor ),
+ mbSet ( bSet )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineColorAction::Execute( OutputDevice* pOut )
+{
+ if( mbSet )
+ pOut->SetLineColor( maColor );
+ else
+ pOut->SetLineColor();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaLineColorAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaLineColorAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ maColor.Write( rOStm, TRUE );
+ rOStm << mbSet;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ maColor.Read( rIStm, TRUE );
+ rIStm >> mbSet;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( FillColor, META_FILLCOLOR_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaFillColorAction::MetaFillColorAction( const Color& rColor, BOOL bSet ) :
+ MetaAction ( META_FILLCOLOR_ACTION ),
+ maColor ( rColor ),
+ mbSet ( bSet )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFillColorAction::Execute( OutputDevice* pOut )
+{
+ if( mbSet )
+ pOut->SetFillColor( maColor );
+ else
+ pOut->SetFillColor();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaFillColorAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaFillColorAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ maColor.Write( rOStm, TRUE );
+ rOStm << mbSet;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ maColor.Read( rIStm, TRUE );
+ rIStm >> mbSet;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( TextColor, META_TEXTCOLOR_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTextColorAction::MetaTextColorAction( const Color& rColor ) :
+ MetaAction ( META_TEXTCOLOR_ACTION ),
+ maColor ( rColor )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextColorAction::Execute( OutputDevice* pOut )
+{
+ pOut->SetTextColor( maColor );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextColorAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTextColorAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ maColor.Write( rOStm, TRUE );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ maColor.Read( rIStm, TRUE );
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( TextFillColor, META_TEXTFILLCOLOR_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTextFillColorAction::MetaTextFillColorAction( const Color& rColor, BOOL bSet ) :
+ MetaAction ( META_TEXTFILLCOLOR_ACTION ),
+ maColor ( rColor ),
+ mbSet ( bSet )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextFillColorAction::Execute( OutputDevice* pOut )
+{
+ if( mbSet )
+ pOut->SetTextFillColor( maColor );
+ else
+ pOut->SetTextFillColor();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextFillColorAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTextFillColorAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextFillColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ maColor.Write( rOStm, TRUE );
+ rOStm << mbSet;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextFillColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ maColor.Read( rIStm, TRUE );
+ rIStm >> mbSet;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( TextLineColor, META_TEXTLINECOLOR_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTextLineColorAction::MetaTextLineColorAction( const Color& rColor, BOOL bSet ) :
+ MetaAction ( META_TEXTLINECOLOR_ACTION ),
+ maColor ( rColor ),
+ mbSet ( bSet )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineColorAction::Execute( OutputDevice* pOut )
+{
+ if( mbSet )
+ pOut->SetTextLineColor( maColor );
+ else
+ pOut->SetTextLineColor();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextLineColorAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTextLineColorAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ maColor.Write( rOStm, TRUE );
+ rOStm << mbSet;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ maColor.Read( rIStm, TRUE );
+ rIStm >> mbSet;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( TextAlign, META_TEXTALIGN_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTextAlignAction::MetaTextAlignAction( TextAlign aAlign ) :
+ MetaAction ( META_TEXTALIGN_ACTION ),
+ maAlign ( aAlign )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAlignAction::Execute( OutputDevice* pOut )
+{
+ pOut->SetTextAlign( maAlign );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTextAlignAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTextAlignAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAlignAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << (UINT16) maAlign;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTextAlignAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ UINT16 nTmp16;
+
+ COMPAT( rIStm );
+ rIStm >> nTmp16; maAlign = (TextAlign) nTmp16;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( MapMode, META_MAPMODE_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaMapModeAction::MetaMapModeAction( const MapMode& rMapMode ) :
+ MetaAction ( META_MAPMODE_ACTION ),
+ maMapMode ( rMapMode )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMapModeAction::Execute( OutputDevice* pOut )
+{
+ pOut->SetMapMode( maMapMode );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaMapModeAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaMapModeAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMapModeAction::Scale( double fScaleX, double fScaleY )
+{
+ Point aPoint( maMapMode.GetOrigin() );
+
+ ImplScalePoint( aPoint, fScaleX, fScaleY );
+ maMapMode.SetOrigin( aPoint );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMapModeAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maMapMode;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaMapModeAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maMapMode;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Font, META_FONT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaFontAction::MetaFontAction( const Font& rFont ) :
+ MetaAction ( META_FONT_ACTION ),
+ maFont ( rFont )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFontAction::Execute( OutputDevice* pOut )
+{
+ pOut->SetFont( maFont );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaFontAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaFontAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFontAction::Scale( double fScaleX, double fScaleY )
+{
+ Size aSize( maFont.GetSize() );
+
+ ImplScaleSize( aSize, fScaleX, fScaleY );
+ maFont.SetSize( aSize );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFontAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maFont;
+ pData->meActualCharSet = maFont.GetCharSet();
+ if ( pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW )
+ pData->meActualCharSet = gsl_getSystemTextEncoding();
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFontAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
+{
+ COMPAT( rIStm );
+ rIStm >> maFont;
+ pData->meActualCharSet = maFont.GetCharSet();
+ if ( pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW )
+ pData->meActualCharSet = gsl_getSystemTextEncoding();
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Push, META_PUSH_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaPushAction::MetaPushAction( USHORT nFlags ) :
+ MetaAction ( META_PUSH_ACTION ),
+ mnFlags ( nFlags )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPushAction::Execute( OutputDevice* pOut )
+{
+ pOut->Push( mnFlags );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPushAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPushAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPushAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << mnFlags;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPushAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> mnFlags;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Pop, META_POP_ACTION )
+
+// ------------------------------------------------------------------------
+
+void MetaPopAction::Execute( OutputDevice* pOut )
+{
+ pOut->Pop();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaPopAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaPopAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPopAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaPopAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( RasterOp, META_RASTEROP_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaRasterOpAction::MetaRasterOpAction( RasterOp eRasterOp ) :
+ MetaAction ( META_RASTEROP_ACTION ),
+ meRasterOp ( eRasterOp )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRasterOpAction::Execute( OutputDevice* pOut )
+{
+ pOut->SetRasterOp( meRasterOp );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaRasterOpAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaRasterOpAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRasterOpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << (UINT16) meRasterOp;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRasterOpAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ UINT16 nTmp16;
+
+ COMPAT( rIStm );
+ rIStm >> nTmp16; meRasterOp = (RasterOp) nTmp16;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( Transparent, META_TRANSPARENT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaTransparentAction::MetaTransparentAction( const PolyPolygon& rPolyPoly, USHORT nTransPercent ) :
+ MetaAction ( META_TRANSPARENT_ACTION ),
+ maPolyPoly ( rPolyPoly ),
+ mnTransPercent ( nTransPercent )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTransparentAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawTransparent( maPolyPoly, mnTransPercent );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaTransparentAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaTransparentAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTransparentAction::Move( long nHorzMove, long nVertMove )
+{
+ maPolyPoly.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTransparentAction::Scale( double fScaleX, double fScaleY )
+{
+ for( USHORT i = 0, nCount = maPolyPoly.Count(); i < nCount; i++ )
+ ImplScalePoly( maPolyPoly[ i ], fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maPolyPoly;
+ rOStm << mnTransPercent;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaTransparentAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maPolyPoly;
+ rIStm >> mnTransPercent;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( FloatTransparent, META_FLOATTRANSPARENT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaFloatTransparentAction::MetaFloatTransparentAction( const GDIMetaFile& rMtf, const Point& rPos,
+ const Size& rSize, const Gradient& rGradient ) :
+ MetaAction ( META_FLOATTRANSPARENT_ACTION ),
+ maMtf ( rMtf ),
+ maPoint ( rPos ),
+ maSize ( rSize ),
+ maGradient ( rGradient )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFloatTransparentAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawTransparent( maMtf, maPoint, maSize, maGradient );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaFloatTransparentAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaFloatTransparentAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove )
+{
+ maPoint.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPoint, fScaleX, fScaleY );
+ ImplScaleSize( maSize, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFloatTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maMtf << maPoint << maSize << maGradient;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaFloatTransparentAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maMtf >> maPoint >> maSize >> maGradient;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( EPS, META_EPS_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaEPSAction::MetaEPSAction( const Point& rPoint, const Size& rSize,
+ const GfxLink& rGfxLink, const GDIMetaFile& rSubst ) :
+ MetaAction ( META_EPS_ACTION ),
+ maGfxLink ( rGfxLink ),
+ maSubst ( rSubst ),
+ maPoint ( rPoint ),
+ maSize ( rSize )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEPSAction::Execute( OutputDevice* pOut )
+{
+ pOut->DrawEPS( maPoint, maSize, maGfxLink, &maSubst );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaEPSAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaEPSAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEPSAction::Move( long nHorzMove, long nVertMove )
+{
+ maPoint.Move( nHorzMove, nVertMove );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEPSAction::Scale( double fScaleX, double fScaleY )
+{
+ ImplScalePoint( maPoint, fScaleX, fScaleY );
+ ImplScaleSize( maSize, fScaleX, fScaleY );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEPSAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maGfxLink;
+ rOStm << maPoint;
+ rOStm << maSize;
+ rOStm << maSubst;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaEPSAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maGfxLink;
+ rIStm >> maPoint;
+ rIStm >> maSize;
+ rIStm >> maSubst;
+}
+
+// ========================================================================
+
+IMPL_META_ACTION( RefPoint, META_REFPOINT_ACTION )
+
+// ------------------------------------------------------------------------
+
+MetaRefPointAction::MetaRefPointAction( const Point& rRefPoint, BOOL bSet ) :
+ MetaAction ( META_REFPOINT_ACTION ),
+ maRefPoint ( rRefPoint ),
+ mbSet ( bSet )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRefPointAction::Execute( OutputDevice* pOut )
+{
+ if( mbSet )
+ pOut->SetRefPoint( maRefPoint );
+ else
+ pOut->SetRefPoint();
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaRefPointAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaRefPointAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRefPointAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maRefPoint << mbSet;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaRefPointAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maRefPoint >> mbSet;
+}
+
+// ========================================================================
+
+MetaCommentAction::MetaCommentAction( long nValue ) :
+ MetaAction ( META_COMMENT_ACTION ),
+ mnValue ( nValue )
+{
+ ImplInitDynamicData( NULL, 0UL );
+}
+
+// ------------------------------------------------------------------------
+
+MetaCommentAction::MetaCommentAction( const MetaCommentAction& rAct ) :
+ MetaAction ( META_COMMENT_ACTION ),
+ maComment ( rAct.maComment ),
+ mnValue ( rAct.mnValue )
+{
+ ImplInitDynamicData( rAct.mpData, rAct.mnDataSize );
+}
+
+// ------------------------------------------------------------------------
+
+MetaCommentAction::MetaCommentAction( const ByteString& rComment, long nValue, const BYTE* pData, ULONG nDataSize ) :
+ MetaAction ( META_COMMENT_ACTION ),
+ maComment ( rComment ),
+ mnValue ( nValue )
+{
+ ImplInitDynamicData( pData, nDataSize );
+}
+
+// ------------------------------------------------------------------------
+
+MetaCommentAction::MetaCommentAction( const BYTE* pData, ULONG nDataSize ) :
+ MetaAction ( META_COMMENT_ACTION ),
+ mnValue ( 0L )
+{
+ ImplInitDynamicData( pData, nDataSize );
+}
+
+// ------------------------------------------------------------------------
+
+MetaCommentAction::~MetaCommentAction()
+{
+ if ( mpData )
+ delete[] mpData;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaCommentAction::ImplInitDynamicData( const BYTE* pData, ULONG nDataSize )
+{
+ if ( nDataSize && pData )
+ {
+ mnDataSize = nDataSize, mpData = new BYTE[ mnDataSize ];
+ HMEMCPY( mpData, pData, mnDataSize );
+ }
+ else
+ {
+ mnDataSize = 0;
+ mpData = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void MetaCommentAction::Execute( OutputDevice* pOut )
+{
+ if ( pOut->GetConnectMetaFile() )
+ pOut->GetConnectMetaFile()->AddAction( Clone() );
+}
+
+// ------------------------------------------------------------------------
+
+MetaAction* MetaCommentAction::Clone()
+{
+ MetaAction* pClone = (MetaAction*) new MetaCommentAction( *this );
+ pClone->ResetRefCount();
+ return pClone;
+}
+
+// ------------------------------------------------------------------------
+
+void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
+{
+ WRITE_BASE_COMPAT( rOStm, 1, pData );
+ rOStm << maComment << mnValue << mnDataSize;
+
+ if ( mnDataSize )
+ rOStm.Write( mpData, mnDataSize );
+}
+
+// ------------------------------------------------------------------------
+
+void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* )
+{
+ COMPAT( rIStm );
+ rIStm >> maComment >> mnValue >> mnDataSize;
+
+ if( mpData )
+ delete[] mpData;
+
+ if( mnDataSize )
+ {
+ mpData = new BYTE[ mnDataSize ];
+ rIStm.Read( mpData, mnDataSize );
+ }
+ else
+ mpData = NULL;
+}
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx
new file mode 100644
index 000000000000..b4a5f70fa5cd
--- /dev/null
+++ b/vcl/source/gdi/metric.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: metric.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <metric.hxx>
+
+// =======================================================================
+
+FontInfo::FontInfo()
+{
+ mpImplMetric = new ImplFontMetric;
+ mpImplMetric->mnRefCount = 1;
+ mpImplMetric->meType = TYPE_DONTKNOW;
+ mpImplMetric->mbDevice = FALSE;
+ mpImplMetric->mnAscent = 0;
+ mpImplMetric->mnDescent = 0;
+ mpImplMetric->mnLeading = 0;
+ mpImplMetric->mnLineHeight = 0;
+ mpImplMetric->mnSlant = 0;
+ mpImplMetric->mnFirstChar = 0;
+ mpImplMetric->mnLastChar = 0;
+}
+
+// -----------------------------------------------------------------------
+
+FontInfo::FontInfo( const FontInfo& rInfo ) :
+ Font( rInfo )
+{
+ mpImplMetric = rInfo.mpImplMetric;
+ mpImplMetric->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+FontInfo::~FontInfo()
+{
+ // Eventuell Metric loeschen
+ if ( mpImplMetric->mnRefCount > 1 )
+ mpImplMetric->mnRefCount--;
+ else
+ delete mpImplMetric;
+}
+
+// -----------------------------------------------------------------------
+
+FontInfo& FontInfo::operator=( const FontInfo& rInfo )
+{
+ Font::operator=( rInfo );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ rInfo.mpImplMetric->mnRefCount++;
+
+ // Sind wir nicht die letzten ?
+ if ( mpImplMetric->mnRefCount > 1 )
+ mpImplMetric->mnRefCount--;
+ else
+ delete mpImplMetric;
+
+ mpImplMetric = rInfo.mpImplMetric;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL FontInfo::operator==( const FontInfo& rInfo ) const
+{
+ if ( !Font::operator==( rInfo ) )
+ return FALSE;
+
+ if ( mpImplMetric == rInfo.mpImplMetric )
+ return TRUE;
+
+ if ( (mpImplMetric->meType == rInfo.mpImplMetric->meType ) &&
+ (mpImplMetric->mbDevice == rInfo.mpImplMetric->mbDevice ) &&
+ (mpImplMetric->mnAscent == rInfo.mpImplMetric->mnAscent ) &&
+ (mpImplMetric->mnDescent == rInfo.mpImplMetric->mnDescent ) &&
+ (mpImplMetric->mnLeading == rInfo.mpImplMetric->mnLeading ) &&
+ (mpImplMetric->mnSlant == rInfo.mpImplMetric->mnSlant ) &&
+ (mpImplMetric->mnFirstChar == rInfo.mpImplMetric->mnFirstChar ) &&
+ (mpImplMetric->mnLastChar == rInfo.mpImplMetric->mnLastChar ) )
+ return TRUE;
+ else
+ return FALSE;
+}
diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
new file mode 100644
index 000000000000..7d4f9f688d65
--- /dev/null
+++ b/vcl/source/gdi/octree.cxx
@@ -0,0 +1,419 @@
+/*************************************************************************
+ *
+ * $RCSfile: octree.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <limits.h>
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_IMPOCT_HXX
+#include <impoct.hxx>
+#endif
+#ifndef _NEW_HXX
+#include<tools/new.hxx>
+#endif
+#include <octree.hxx>
+
+// ------------
+// - Typedefs -
+// ------------
+
+#ifdef WIN
+typedef ULONG huge* HPULONG;
+#else
+typedef ULONG* HPULONG;
+#endif
+
+// ---------
+// - pMask -
+// ---------
+
+static BYTE pImplMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
+
+// -------------
+// - NodeCache -
+// -------------
+
+ImpNodeCache::ImpNodeCache( const ULONG nInitSize ) :
+ pActNode( NULL )
+{
+ const ULONG nSize = nInitSize + 4;
+
+ for( ULONG i = 0; i < nSize; i++ )
+ {
+ OctreeNode* pNewNode = new NODE;
+
+ pNewNode->pNextInCache = pActNode;
+ pActNode = pNewNode;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ImpNodeCache::~ImpNodeCache()
+{
+ while( pActNode )
+ {
+ OctreeNode* pNode = pActNode;
+
+ pActNode = pNode->pNextInCache;
+ delete pNode;
+ }
+}
+
+// ----------
+// - Octree -
+// ----------
+
+Octree::Octree( ULONG nColors ) :
+ nMax ( nColors ),
+ nLeafCount ( 0L ),
+ pTree ( NULL ),
+ pAcc ( NULL )
+{
+ pNodeCache = new ImpNodeCache( nColors );
+ memset( pReduce, 0, ( OCTREE_BITS + 1 ) * sizeof( PNODE ) );
+}
+
+// ------------------------------------------------------------------------
+
+Octree::Octree( const BitmapReadAccess& rReadAcc, ULONG nColors ) :
+ nMax ( nColors ),
+ nLeafCount ( 0L ),
+ pTree ( NULL ),
+ pAcc ( &rReadAcc )
+{
+ pNodeCache = new ImpNodeCache( nColors );
+ memset( pReduce, 0, ( OCTREE_BITS + 1 ) * sizeof( PNODE ) );
+ ImplCreateOctree();
+}
+
+// ------------------------------------------------------------------------
+
+Octree::~Octree()
+{
+ ImplDeleteOctree( &pTree );
+ delete pNodeCache;
+}
+
+// ------------------------------------------------------------------------
+
+void Octree::AddColor( const BitmapColor& rColor )
+{
+ pColor = &(BitmapColor&) rColor;
+ nLevel = 0L;
+ ImplAdd( &pTree );
+
+ while( nLeafCount > nMax )
+ ImplReduce();
+}
+
+// ------------------------------------------------------------------------
+
+void Octree::ImplCreateOctree()
+{
+ if( !!*pAcc )
+ {
+ const long nWidth = pAcc->Width();
+ const long nHeight = pAcc->Height();
+
+ if( pAcc->HasPalette() )
+ {
+ for( long nY = 0; nY < nHeight; nY++ )
+ {
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ pColor = &(BitmapColor&) pAcc->GetPaletteColor( pAcc->GetPixel( nY, nX ) );
+ nLevel = 0L;
+ ImplAdd( &pTree );
+
+ while( nLeafCount > nMax )
+ ImplReduce();
+ }
+ }
+ }
+ else
+ {
+ BitmapColor aColor;
+
+ pColor = &aColor;
+
+ for( long nY = 0; nY < nHeight; nY++ )
+ {
+ for( long nX = 0; nX < nWidth; nX++ )
+ {
+ aColor = pAcc->GetPixel( nY, nX );
+ nLevel = 0L;
+ ImplAdd( &pTree );
+
+ while( nLeafCount > nMax )
+ ImplReduce();
+ }
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void Octree::ImplDeleteOctree( PPNODE ppNode )
+{
+ for ( ULONG i = 0UL; i < 8UL; i++ )
+ {
+ if ( (*ppNode)->pChild[ i ] )
+ ImplDeleteOctree( &(*ppNode)->pChild[ i ] );
+ }
+
+ pNodeCache->ImplReleaseNode( *ppNode );
+ *ppNode = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+void Octree::ImplAdd( PPNODE ppNode )
+{
+ // ggf. neuen Knoten erzeugen
+ if( !*ppNode )
+ {
+ *ppNode = pNodeCache->ImplGetFreeNode();
+ (*ppNode)->bLeaf = ( OCTREE_BITS == nLevel );
+
+ if( (*ppNode)->bLeaf )
+ nLeafCount++;
+ else
+ {
+ (*ppNode)->pNext = pReduce[ nLevel ];
+ pReduce[ nLevel ] = *ppNode;
+ }
+ }
+
+ if( (*ppNode)->bLeaf )
+ {
+ (*ppNode)->nCount++;
+ (*ppNode)->nRed += pColor->GetRed();
+ (*ppNode)->nGreen += pColor->GetGreen();
+ (*ppNode)->nBlue += pColor->GetBlue();
+ }
+ else
+ {
+ const ULONG nShift = 7 - nLevel;
+ const BYTE cMask = pImplMask[ nLevel ];
+ const ULONG nIndex = ( ( ( pColor->GetRed() & cMask ) >> nShift ) << 2 ) |
+ ( ( ( pColor->GetGreen() & cMask ) >> nShift ) << 1 ) |
+ ( ( pColor->GetBlue() & cMask ) >> nShift );
+
+ nLevel++;
+ ImplAdd( &(*ppNode)->pChild[ nIndex ] );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void Octree::ImplReduce()
+{
+ ULONG i;
+ PNODE pNode;
+ ULONG nRedSum = 0L;
+ ULONG nGreenSum = 0L;
+ ULONG nBlueSum = 0L;
+ ULONG nChilds = 0L;
+
+ for ( i = OCTREE_BITS - 1; i && !pReduce[i]; i-- ) {}
+
+ pNode = pReduce[ i ];
+ pReduce[ i ] = pNode->pNext;
+
+ for ( i = 0; i < 8; i++ )
+ {
+ if ( pNode->pChild[ i ] )
+ {
+ PNODE pChild = pNode->pChild[ i ];
+
+ nRedSum += pChild->nRed;
+ nGreenSum += pChild->nGreen;
+ nBlueSum += pChild->nBlue;
+ pNode->nCount += pChild->nCount;
+
+ pNodeCache->ImplReleaseNode( pNode->pChild[ i ] );
+ pNode->pChild[ i ] = NULL;
+ nChilds++;
+ }
+ }
+
+ pNode->bLeaf = TRUE;
+ pNode->nRed = nRedSum;
+ pNode->nGreen = nGreenSum;
+ pNode->nBlue = nBlueSum;
+ nLeafCount -= --nChilds;
+}
+
+// ------------------------------------------------------------------------
+
+void Octree::CreatePalette( PNODE pNode )
+{
+ if( pNode->bLeaf )
+ {
+ pNode->nPalIndex = nPalIndex;
+ aPal[ nPalIndex++ ] = BitmapColor( (BYTE) ( (double) pNode->nRed / pNode->nCount ),
+ (BYTE) ( (double) pNode->nGreen / pNode->nCount ),
+ (BYTE) ( (double) pNode->nBlue / pNode->nCount ) );
+ }
+ else for( ULONG i = 0UL; i < 8UL; i++ )
+ if( pNode->pChild[ i ] )
+ CreatePalette( pNode->pChild[ i ] );
+
+}
+
+// ------------------------------------------------------------------------
+
+void Octree::GetPalIndex( PNODE pNode )
+{
+ if ( pNode->bLeaf )
+ nPalIndex = pNode->nPalIndex;
+ else
+ {
+ const ULONG nShift = 7 - nLevel;
+ const BYTE cMask = pImplMask[ nLevel++ ];
+ const ULONG nIndex = ( ( ( pColor->GetRed() & cMask ) >> nShift ) << 2 ) |
+ ( ( ( pColor->GetGreen() & cMask ) >> nShift ) << 1 ) |
+ ( ( pColor->GetBlue() & cMask ) >> nShift );
+
+ GetPalIndex( pNode->pChild[ nIndex ] );
+ }
+}
+
+// -------------------
+// - InverseColorMap -
+// -------------------
+
+InverseColorMap::InverseColorMap( const BitmapPalette& rPal ) :
+ nBits( 8 - OCTREE_BITS )
+{
+ HPULONG cdp;
+ BYTE* crgbp;
+ const ULONG nColorMax = 1 << OCTREE_BITS;
+ const ULONG xsqr = 1 << ( nBits << 1 );
+ const ULONG xsqr2 = xsqr << 1;
+ const ULONG gstride = nColorMax;
+ const ULONG rstride = nColorMax * nColorMax;
+ const ULONG nColors = rPal.GetEntryCount();
+ const long x = 1L << nBits;
+ const long x2 = x >> 1L;
+ ULONG r, g, b;
+ long rxx, gxx, bxx;
+ long rdist, gdist, bdist;
+ long crinc, cginc, cbinc;
+
+ ImplCreateBuffers( nColorMax );
+
+ for( ULONG nIndex = 0; nIndex < nColors; nIndex++ )
+ {
+ const BitmapColor& rColor = rPal[ (USHORT) nIndex ];
+ const BYTE cRed = rColor.GetRed();
+ const BYTE cGreen = rColor.GetGreen();
+ const BYTE cBlue = rColor.GetBlue();
+
+ rdist = cRed - x2;
+ gdist = cGreen - x2;
+ bdist = cBlue - x2;
+ rdist = rdist*rdist + gdist*gdist + bdist*bdist;
+
+ crinc = ( xsqr - ( cRed << nBits ) ) << 1L;
+ cginc = ( xsqr - ( cGreen << nBits ) ) << 1L;
+ cbinc = ( xsqr - ( cBlue << nBits ) ) << 1L;
+
+ cdp = (HPULONG) pBuffer;
+ crgbp = pMap;
+
+ for( r = 0, rxx = crinc; r < nColorMax; rdist += rxx, r++, rxx += xsqr2 )
+ {
+ for( g = 0, gdist = rdist, gxx = cginc; g < nColorMax; gdist += gxx, g++, gxx += xsqr2 )
+ {
+ for( b = 0, bdist = gdist, bxx = cbinc; b < nColorMax; bdist += bxx, b++, cdp++, crgbp++, bxx += xsqr2 )
+ if ( !nIndex || ( (long) *cdp ) > bdist )
+ {
+ *cdp = bdist;
+ *crgbp = (BYTE) nIndex;
+ }
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+InverseColorMap::~InverseColorMap()
+{
+ SvMemFree( pBuffer );
+ SvMemFree( pMap );
+}
+
+// ------------------------------------------------------------------------
+
+void InverseColorMap::ImplCreateBuffers( const ULONG nMax )
+{
+ const ULONG nCount = nMax * nMax * nMax;
+ const ULONG nSize = nCount * sizeof( ULONG );
+
+ pMap = (BYTE*) SvMemAlloc( nCount );
+ HMEMSET( pMap, 0x00, nCount );
+
+ pBuffer = (BYTE*) SvMemAlloc( nSize );
+ HMEMSET( pBuffer, 0xff, nSize );
+}
diff --git a/vcl/source/gdi/opengl.cxx b/vcl/source/gdi/opengl.cxx
new file mode 100644
index 000000000000..fa45d1700725
--- /dev/null
+++ b/vcl/source/gdi/opengl.cxx
@@ -0,0 +1,1714 @@
+/*************************************************************************
+ *
+ * $RCSfile: opengl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_OPENGL_CXX
+
+#define private public
+#include <svsys.h>
+#include <window.hxx>
+#undef private
+#define private public
+
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_SALOGL_HXX
+#include <salogl.hxx>
+#endif
+#ifndef _SV_OPENGL_HXX
+#include <opengl.hxx>
+#endif
+
+#include <svapp.hxx>
+#include <vos/mutex.hxx>
+
+// -----------------------
+// - Fnc-Pointer-Typedef -
+// -----------------------
+
+typedef void ( *OGLFncClearDepth )( GLclampd fDepth );
+typedef void ( *OGLFncDepthFunc )( GLenum fFunc );
+typedef void ( *OGLFncEnable )( GLenum eCap );
+typedef void ( *OGLFncDisable )( GLenum eCap );
+typedef void ( *OGLFncDepthMask )( GLboolean bFlag );
+typedef void ( *OGLFncShadeModel )( GLenum eMode );
+typedef void ( *OGLFncEdgeFlag )( GLboolean bFlag );
+typedef void ( *OGLFncClear )( GLbitfield nMask );
+typedef void ( *OGLFncFlush )( void );
+typedef void ( *OGLFncFinish )( void );
+typedef void ( *OGLFncViewport )( GLint nX, GLint nY, GLsizei nWidth, GLsizei nHeight );
+typedef void ( *OGLFncBegin )( GLenum eMode );
+typedef void ( *OGLFncEnd )( void );
+typedef void ( *OGLFncVertex3dv )( const GLdouble *fV );
+typedef void ( *OGLFncNormal3dv )( const GLdouble *fV );
+typedef void ( *OGLFncColor4ub )( GLubyte cRed, GLubyte cGreen, GLubyte cBlue, GLubyte cAlpha );
+typedef void ( *OGLFncMaterialfv )( GLenum eFace, GLenum ePNname, const GLfloat *fParams );
+typedef void ( *OGLFncMaterialf )( GLenum eFace, GLenum ePName, GLfloat fParam );
+typedef void ( *OGLFncLightModelfv )( GLenum ePNname, const GLfloat *fParams );
+typedef void ( *OGLFncLightModelf )( GLenum ePname, GLfloat fParam );
+typedef void ( *OGLFncLightfv )( GLenum eLight, GLenum ePNname, const GLfloat *fParams );
+typedef void ( *OGLFncLightf )( GLenum eLight, GLenum ePname, GLfloat fParam );
+typedef void ( *OGLFncPolygonMode )( GLenum eFace, GLenum eMode );
+typedef void ( *OGLFncCullFace )( GLenum eMode );
+typedef void ( *OGLFncPointSize )( GLfloat fSize );
+typedef void ( *OGLFncLineWidth )( GLfloat fWidth );
+typedef void ( *OGLFncMatrixMode )( GLenum eMode );
+typedef void ( *OGLFncLoadMatrixd )( const GLdouble *fM );
+typedef void ( *OGLFncTexCoord2dv )( const GLdouble *pParams );
+typedef void ( *OGLFncTexCoord3dv )( const GLdouble *fV );
+typedef void ( *OGLFncTexImage1D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
+typedef void ( *OGLFncTexImage2D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
+typedef void ( *OGLFncCopyTexImage1D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border );
+typedef void ( *OGLFncCopyTexImage2D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
+typedef void ( *OGLFncCopyTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
+typedef void ( *OGLFncCopyTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+typedef void ( *OGLFncPixelTransferf )( GLenum pname, GLfloat param );
+typedef void ( *OGLFncPixelTransferi )( GLenum pname, GLint param );
+typedef void ( *OGLFncGetTexLevelParameterfv )( GLenum target, GLint level, GLenum pname, GLfloat *params );
+typedef void ( *OGLFncGetTexLevelParameteriv )( GLenum target, GLint level, GLenum pname, GLint *params );
+typedef void ( *OGLFncGetTexParameterfv )( GLenum target, GLenum pname, GLfloat *params );
+typedef void ( *OGLFncGetTexParameteriv )( GLenum target, GLenum pname, GLint *params );
+typedef void ( *OGLFncTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels );
+typedef void ( *OGLFncTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
+typedef void ( *OGLFncPixelStoref )( GLenum pname, GLfloat param );
+typedef void ( *OGLFncPixelStorei )( GLenum pname, GLint param );
+typedef void ( *OGLFncGenTextures )( GLsizei n, GLuint *textures );
+typedef GLboolean ( *OGLFncIsTexture )( GLuint texture );
+typedef void ( *OGLFncBindTexture )( GLenum target, GLuint texture );
+typedef void ( *OGLFncDeleteTextures )( GLsizei n, const GLuint *textures );
+typedef GLboolean ( *OGLFncAreTexturesResident )( GLsizei n, const GLuint *textures, GLboolean *residences );
+typedef void ( *OGLFncPrioritizeTextures )( GLsizei n, const GLuint *textures, const GLclampf *priorities );
+typedef void ( *OGLFncTexEnvf )( GLenum target, GLenum pname, GLfloat param );
+typedef void ( *OGLFncTexEnvfv )( GLenum target, GLenum pname, const GLfloat *params );
+typedef void ( *OGLFncTexEnvi )( GLenum target, GLenum pname, GLint param );
+typedef void ( *OGLFncTexEnviv )( GLenum target, GLenum pname, const GLint *params );
+typedef void ( *OGLFncTexParameterf )( GLenum target, GLenum pname, GLfloat param );
+typedef void ( *OGLFncTexParameterfv )( GLenum target, GLenum pname, const GLfloat *params );
+typedef void ( *OGLFncTexParameteri )( GLenum target, GLenum pname, GLint param );
+typedef void ( *OGLFncTexParameteriv )( GLenum target, GLenum pname, const GLint *params );
+typedef void ( *OGLFncTexGend )( GLenum coord, GLenum pname, GLdouble param );
+typedef void ( *OGLFncTexGendv )( GLenum coord, GLenum pname, const GLdouble *params );
+typedef void ( *OGLFncTexGenf )( GLenum coord, GLenum pname, GLfloat param );
+typedef void ( *OGLFncTexGenfv )( GLenum coord, GLenum pname, const GLfloat *params );
+typedef void ( *OGLFncTexGeni )( GLenum coord, GLenum pname, GLint param );
+typedef void ( *OGLFncTexGeniv )( GLenum coord, GLenum pname, const GLint *params );
+typedef void ( *OGLFncGetIntegerv )( GLenum pname, GLint *params );
+typedef void ( *OGLFncPolygonOffset ) ( GLfloat factor, GLfloat units );
+typedef void ( *OGLFncScissor ) ( GLint x, GLint y, GLsizei width, GLsizei height );
+
+typedef void ( *OGLFncEnableClientState ) ( GLenum array );
+typedef void ( *OGLFncDisableClientState ) ( GLenum array );
+typedef void ( *OGLFncVertexPointer ) ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
+typedef void ( *OGLFncColorPointer ) ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
+typedef void ( *OGLFncIndexPointer ) ( GLenum type, GLsizei stride, const GLvoid *pointer );
+typedef void ( *OGLFncNormalPointer ) ( GLenum type, GLsizei stride, const GLvoid *pointer );
+typedef void ( *OGLFncTexCoordPointer ) ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
+typedef void ( *OGLFncEdgeFlagPointer ) ( GLsizei stride, const GLvoid *pointer );
+typedef void ( *OGLFncArrayElement ) ( GLint i );
+typedef void ( *OGLFncDrawElements ) ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices );
+typedef void ( *OGLFncDrawArrays ) ( GLenum mode, GLint first, GLsizei count );
+typedef void ( *OGLFncInterleavedArrays ) ( GLenum format, GLsizei stride, const GLvoid *pointer );
+
+typedef void ( *OGLFncLoadIdentity ) ();
+typedef void ( *OGLFncBlendFunc ) ( GLenum sfactor, GLenum dfactor );
+
+// ----------
+// - Macros -
+// ----------
+
+#define PGRAPHICS mpOutDev->mpGraphics
+
+#ifndef REMOTE_APPSERVER
+#define OGL_INIT() (mpOGL && (mpOutDev->mpGraphics || mpOutDev->ImplGetGraphics()))
+#else
+#define OGL_INIT() (mpOGL && (mpOutDev->mpGraphics || mpOutDev->ImplGetGraphics()))
+#endif
+
+#define INIT_OGLFNC( FncName ) static OGLFnc##FncName pImplOpenGLFnc##FncName = NULL;
+#define GET_OGLFNC_GL( FncName ) \
+pImplOpenGLFnc##FncName = (OGLFnc##FncName##) mpOGL->GetOGLFnc( "gl" #FncName ); \
+if( !pImplOpenGLFnc##FncName ) bRet = FALSE;
+
+// ----------
+// - OpenGL -
+// ----------
+
+static BOOL bImplOpenGLFncPtrInitialized = FALSE;
+
+INIT_OGLFNC( ClearDepth );
+INIT_OGLFNC( DepthFunc );
+INIT_OGLFNC( Enable );
+INIT_OGLFNC( Disable );
+INIT_OGLFNC( DepthMask );
+INIT_OGLFNC( ShadeModel );
+INIT_OGLFNC( EdgeFlag );
+INIT_OGLFNC( Clear );
+INIT_OGLFNC( Flush );
+INIT_OGLFNC( Finish );
+INIT_OGLFNC( Viewport );
+INIT_OGLFNC( Begin );
+INIT_OGLFNC( End );
+INIT_OGLFNC( Vertex3dv );
+INIT_OGLFNC( Normal3dv );
+INIT_OGLFNC( Color4ub );
+INIT_OGLFNC( Materialfv );
+INIT_OGLFNC( Materialf );
+INIT_OGLFNC( LightModelfv );
+INIT_OGLFNC( LightModelf );
+INIT_OGLFNC( Lightfv );
+INIT_OGLFNC( Lightf );
+INIT_OGLFNC( PolygonMode );
+INIT_OGLFNC( CullFace );
+INIT_OGLFNC( PointSize );
+INIT_OGLFNC( LineWidth );
+INIT_OGLFNC( MatrixMode );
+INIT_OGLFNC( LoadMatrixd );
+INIT_OGLFNC( TexCoord2dv );
+INIT_OGLFNC( TexCoord3dv );
+INIT_OGLFNC( TexImage1D );
+INIT_OGLFNC( TexImage2D );
+INIT_OGLFNC( CopyTexImage1D );
+INIT_OGLFNC( CopyTexImage2D );
+INIT_OGLFNC( CopyTexSubImage1D );
+INIT_OGLFNC( CopyTexSubImage2D );
+INIT_OGLFNC( PixelTransferf );
+INIT_OGLFNC( PixelTransferi );
+INIT_OGLFNC( GetTexLevelParameterfv );
+INIT_OGLFNC( GetTexLevelParameteriv );
+INIT_OGLFNC( GetTexParameterfv );
+INIT_OGLFNC( GetTexParameteriv );
+INIT_OGLFNC( TexSubImage1D );
+INIT_OGLFNC( TexSubImage2D );
+INIT_OGLFNC( PixelStoref );
+INIT_OGLFNC( PixelStorei );
+INIT_OGLFNC( GenTextures );
+INIT_OGLFNC( IsTexture );
+INIT_OGLFNC( BindTexture );
+INIT_OGLFNC( DeleteTextures );
+INIT_OGLFNC( AreTexturesResident );
+INIT_OGLFNC( PrioritizeTextures );
+INIT_OGLFNC( TexEnvf );
+INIT_OGLFNC( TexEnvfv );
+INIT_OGLFNC( TexEnvi );
+INIT_OGLFNC( TexEnviv );
+INIT_OGLFNC( TexParameterf );
+INIT_OGLFNC( TexParameterfv );
+INIT_OGLFNC( TexParameteri );
+INIT_OGLFNC( TexParameteriv );
+INIT_OGLFNC( TexGend );
+INIT_OGLFNC( TexGendv );
+INIT_OGLFNC( TexGenf );
+INIT_OGLFNC( TexGenfv );
+INIT_OGLFNC( TexGeni );
+INIT_OGLFNC( TexGeniv );
+INIT_OGLFNC( GetIntegerv );
+INIT_OGLFNC( PolygonOffset );
+INIT_OGLFNC( Scissor );
+
+INIT_OGLFNC( EnableClientState );
+INIT_OGLFNC( DisableClientState );
+INIT_OGLFNC( VertexPointer );
+INIT_OGLFNC( ColorPointer );
+INIT_OGLFNC( IndexPointer );
+INIT_OGLFNC( NormalPointer );
+INIT_OGLFNC( TexCoordPointer );
+INIT_OGLFNC( EdgeFlagPointer );
+INIT_OGLFNC( ArrayElement );
+INIT_OGLFNC( DrawElements );
+INIT_OGLFNC( DrawArrays );
+INIT_OGLFNC( InterleavedArrays );
+
+INIT_OGLFNC( LoadIdentity );
+INIT_OGLFNC( BlendFunc );
+
+// ------------------------------------------------------------------------
+
+BOOL OpenGL::ImplInitFncPointers()
+{
+#ifndef REMOTE_APPSERVER
+ BOOL bRet = TRUE;
+
+ GET_OGLFNC_GL( ClearDepth );
+ GET_OGLFNC_GL( DepthFunc );
+ GET_OGLFNC_GL( Enable );
+ GET_OGLFNC_GL( Disable );
+ GET_OGLFNC_GL( DepthMask );
+ GET_OGLFNC_GL( ShadeModel );
+ GET_OGLFNC_GL( EdgeFlag );
+ GET_OGLFNC_GL( Clear );
+ GET_OGLFNC_GL( Flush );
+ GET_OGLFNC_GL( Finish );
+ GET_OGLFNC_GL( Viewport );
+ GET_OGLFNC_GL( Begin );
+ GET_OGLFNC_GL( End );
+ GET_OGLFNC_GL( Vertex3dv );
+ GET_OGLFNC_GL( Normal3dv );
+ GET_OGLFNC_GL( Color4ub );
+ GET_OGLFNC_GL( Materialfv );
+ GET_OGLFNC_GL( Materialf );
+ GET_OGLFNC_GL( LightModelfv );
+ GET_OGLFNC_GL( LightModelf );
+ GET_OGLFNC_GL( Lightfv );
+ GET_OGLFNC_GL( Lightf );
+ GET_OGLFNC_GL( PolygonMode );
+ GET_OGLFNC_GL( CullFace );
+ GET_OGLFNC_GL( PointSize );
+ GET_OGLFNC_GL( LineWidth );
+ GET_OGLFNC_GL( MatrixMode );
+ GET_OGLFNC_GL( LoadMatrixd );
+ GET_OGLFNC_GL( TexCoord2dv );
+ GET_OGLFNC_GL( TexCoord3dv );
+ GET_OGLFNC_GL( TexImage1D );
+ GET_OGLFNC_GL( TexImage2D );
+ GET_OGLFNC_GL( CopyTexImage1D );
+ GET_OGLFNC_GL( CopyTexImage2D );
+ GET_OGLFNC_GL( CopyTexSubImage1D );
+ GET_OGLFNC_GL( CopyTexSubImage2D );
+ GET_OGLFNC_GL( PixelTransferf );
+ GET_OGLFNC_GL( PixelTransferi );
+ GET_OGLFNC_GL( GetTexLevelParameterfv );
+ GET_OGLFNC_GL( GetTexLevelParameteriv );
+ GET_OGLFNC_GL( GetTexParameterfv );
+ GET_OGLFNC_GL( GetTexParameteriv );
+ GET_OGLFNC_GL( TexSubImage1D );
+ GET_OGLFNC_GL( TexSubImage2D );
+ GET_OGLFNC_GL( PixelStoref );
+ GET_OGLFNC_GL( PixelStorei );
+ GET_OGLFNC_GL( GenTextures );
+ GET_OGLFNC_GL( IsTexture );
+ GET_OGLFNC_GL( BindTexture );
+ GET_OGLFNC_GL( DeleteTextures );
+ GET_OGLFNC_GL( AreTexturesResident );
+ GET_OGLFNC_GL( PrioritizeTextures );
+ GET_OGLFNC_GL( TexEnvf );
+ GET_OGLFNC_GL( TexEnvfv );
+ GET_OGLFNC_GL( TexEnvi );
+ GET_OGLFNC_GL( TexEnviv );
+ GET_OGLFNC_GL( TexParameterf );
+ GET_OGLFNC_GL( TexParameterfv );
+ GET_OGLFNC_GL( TexParameteri );
+ GET_OGLFNC_GL( TexParameteriv );
+ GET_OGLFNC_GL( TexGend );
+ GET_OGLFNC_GL( TexGendv );
+ GET_OGLFNC_GL( TexGenf );
+ GET_OGLFNC_GL( TexGenfv );
+ GET_OGLFNC_GL( TexGeni );
+ GET_OGLFNC_GL( TexGeniv );
+ GET_OGLFNC_GL( GetIntegerv );
+ GET_OGLFNC_GL( PolygonOffset );
+ GET_OGLFNC_GL( Scissor );
+
+ GET_OGLFNC_GL( EnableClientState );
+ GET_OGLFNC_GL( DisableClientState );
+ GET_OGLFNC_GL( VertexPointer );
+ GET_OGLFNC_GL( ColorPointer );
+ GET_OGLFNC_GL( IndexPointer );
+ GET_OGLFNC_GL( NormalPointer );
+ GET_OGLFNC_GL( TexCoordPointer );
+ GET_OGLFNC_GL( EdgeFlagPointer );
+ GET_OGLFNC_GL( ArrayElement );
+ GET_OGLFNC_GL( DrawElements );
+ GET_OGLFNC_GL( DrawArrays );
+ GET_OGLFNC_GL( InterleavedArrays );
+
+ GET_OGLFNC_GL( LoadIdentity );
+ GET_OGLFNC_GL( BlendFunc );
+
+ return bRet;
+#else
+ return FALSE;
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+OpenGL::OpenGL( OutputDevice* pOutDev ) :
+ mpOutDev( pOutDev )
+{
+ ImplInit();
+}
+
+// ------------------------------------------------------------------------
+
+OpenGL::~OpenGL()
+{
+#ifndef REMOTE_APPSERVER
+ delete mpOGL;
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::ImplInit()
+{
+#ifndef REMOTE_APPSERVER
+ if( PGRAPHICS || mpOutDev->ImplGetGraphics() )
+ {
+ mpOGL = new SalOpenGL( PGRAPHICS );
+
+ if ( !mpOGL->Create() || (!bImplOpenGLFncPtrInitialized && !ImplInitFncPointers()) )
+ {
+ delete mpOGL;
+ mpOGL = NULL;
+ }
+ else
+ bImplOpenGLFncPtrInitialized = TRUE;
+ }
+ else
+ mpOGL = NULL;
+#else
+ mpOGL = NULL;
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::SetConnectOutputDevice( OutputDevice* pOutDev )
+{
+#ifndef REMOTE_APPSERVER
+ delete mpOGL;
+ mpOutDev = pOutDev;
+ ImplInit();
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::ClearDepth( GLclampd fDepth )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncClearDepth( fDepth );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::DepthFunc( GLenum eFunc )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncDepthFunc( eFunc );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Enable( GLenum eCap )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncEnable( eCap );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Disable( GLenum eCap )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncDisable( eCap );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::DepthMask( GLboolean bFlag )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncDepthMask( bFlag );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::ShadeModel( GLenum eMode )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncShadeModel( eMode );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::EdgeFlag( GLboolean bFlag )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncEdgeFlag( bFlag );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Clear( GLbitfield nMask )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+#if defined UNX && ! defined MACOSX
+ mpOGL->StartScene( PGRAPHICS );
+#endif
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncClear( nMask );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Flush()
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncFlush();
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Finish()
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncFinish();
+#if defined UNX && ! defined MACOSX
+ mpOGL->StopScene();
+#endif
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Viewport( GLint nX, GLint nY, GLsizei nWidth, GLsizei nHeight )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ long nOutHeight;
+
+ if( mpOutDev->GetOutDevType() == OUTDEV_WINDOW )
+ nOutHeight = ( (Window*) mpOutDev )->mpFrameWindow->mnOutHeight;
+ else
+ nOutHeight = mpOutDev->mnOutHeight;
+
+ mpOGL->OGLEntry( PGRAPHICS );
+
+ pImplOpenGLFncViewport( nX + mpOutDev->mnOutOffX,
+ nOutHeight - nY - nHeight - mpOutDev->mnOutOffY,
+ nWidth, nHeight );
+
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Begin( GLenum eMode )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncBegin( eMode );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::End()
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncEnd();
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Vertex3dv( const GLdouble* fVar )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncVertex3dv( fVar );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Normal3dv( const GLdouble* fVar )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncNormal3dv( fVar );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Color4ub( GLubyte cRed, GLubyte cGreen, GLubyte cBlue, GLubyte cAlpha )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncColor4ub( cRed, cGreen, cBlue, cAlpha );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Materialfv( GLenum eFace, GLenum ePName, const GLfloat *fParams )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncMaterialfv( eFace, ePName, fParams );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Materialf( GLenum eFace, GLenum ePName, GLfloat fParam )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncMaterialf( eFace, ePName, fParam );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::LightModelfv( GLenum ePName, const GLfloat *fParams )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncLightModelfv( ePName, fParams );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::LightModelf( GLenum ePName, GLfloat fParam )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncLightModelf( ePName, fParam );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Lightfv( GLenum eLight, GLenum ePName, const GLfloat *fParams )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncLightfv( eLight, ePName, fParams );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Lightf( GLenum eLight, GLenum ePName, GLfloat fParam )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncLightf( eLight, ePName, fParam );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PolygonMode( GLenum eFace, GLenum eMode )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPolygonMode( eFace, eMode );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::CullFace( GLenum eMode )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncCullFace( eMode );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PointSize( GLfloat fSize )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPointSize( fSize );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::LineWidth( GLfloat fWidth )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncLineWidth( fWidth );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::MatrixMode( GLenum eMode )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncMatrixMode( eMode );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::LoadMatrixd( const GLdouble *fM )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncLoadMatrixd( fM );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexCoord2dv( const GLdouble *pParams )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexCoord2dv( pParams );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexCoord3dv( const GLdouble *fVar )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexCoord3dv( fVar );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexImage1D( target, level, internalformat, width, border, format, type, pixels );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexImage2D( target, level, internalformat, width, height, border, format, type, pixels );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::CopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncCopyTexImage1D( target, level, internalFormat, x, y, width, border );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncCopyTexImage2D( target, level, internalFormat, x, y, width, height, border );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncCopyTexSubImage1D( target, level, xoffset, x, y, width );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncCopyTexSubImage2D( target, level, xoffset, yoffset, x, y, width, height );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PixelTransferf( GLenum pname, GLfloat param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPixelTransferf( pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PixelTransferi( GLenum pname, GLint param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPixelTransferi( pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::GetTexLevelParameterfv( GLenum target, GLint level, GLenum pname, GLfloat *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncGetTexLevelParameterfv( target, level, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncGetTexLevelParameteriv( target, level, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncGetTexParameterfv( target, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncGetTexParameteriv( target, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexSubImage1D( target, level, xoffset, width, format, type, pixels );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PixelStoref( GLenum pname, GLfloat param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPixelStoref( pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PixelStorei( GLenum pname, GLint param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPixelStorei( pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::GenTextures( GLsizei n, GLuint *textures )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncGenTextures( n, textures );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+GLboolean OpenGL::IsTexture( GLuint texture )
+{
+ GLboolean bRet = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ bRet = pImplOpenGLFncIsTexture( texture );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::BindTexture( GLenum target, GLuint texture )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncBindTexture( target, texture );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::DeleteTextures( GLsizei n, const GLuint *textures )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncDeleteTextures( n, textures );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+GLboolean OpenGL::AreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences )
+{
+ GLboolean bRet = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ bRet = pImplOpenGLFncAreTexturesResident( n, textures, residences );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPrioritizeTextures( n, textures, priorities );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexEnvf( GLenum target, GLenum pname, GLfloat param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexEnvf( target, pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexEnvfv( target, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexEnvi( GLenum target, GLenum pname, GLint param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexEnvi( target, pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexEnviv( GLenum target, GLenum pname, const GLint *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexEnviv( target, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexParameterf( GLenum target, GLenum pname, GLfloat param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexParameterf( target, pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexParameterfv( target, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexParameteri( GLenum target, GLenum pname, GLint param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexParameteri( target, pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexParameteriv( GLenum target, GLenum pname, const GLint *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexParameteriv( target, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexGend( GLenum coord, GLenum pname, GLdouble param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexGend( coord, pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexGendv( GLenum coord, GLenum pname, const GLdouble *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexGendv( coord, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexGenf( GLenum coord, GLenum pname, GLfloat param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexGenf( coord, pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexGenfv( coord, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexGeni( coord, pname, param );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexGeniv( GLenum coord, GLenum pname, const GLint *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexGeniv( coord, pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::GetIntegerv( GLenum pname, GLint *params )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncGetIntegerv( pname, params );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::PolygonOffset( GLfloat factor, GLfloat units )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncPolygonOffset( factor, units );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::Scissor( GLint nX, GLint nY, GLsizei nWidth, GLsizei nHeight )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ long nOutHeight;
+
+ if( mpOutDev->GetOutDevType() == OUTDEV_WINDOW )
+ nOutHeight = ( (Window*) mpOutDev )->mpFrameWindow->mnOutHeight;
+ else
+ nOutHeight = mpOutDev->mnOutHeight;
+
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncScissor( nX + mpOutDev->mnOutOffX,
+ nOutHeight - nY - nHeight - mpOutDev->mnOutOffY,
+ nWidth, nHeight );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::EnableClientState( GLenum array )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncEnableClientState( array );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::DisableClientState( GLenum array )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncDisableClientState( array );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::VertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncVertexPointer( size, type, stride, pointer );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::ColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncColorPointer( size, type, stride, pointer );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::IndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncIndexPointer( type, stride, pointer );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::NormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncNormalPointer( type, stride, pointer );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::TexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncTexCoordPointer( size, type, stride, pointer );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::EdgeFlagPointer( GLsizei stride, const GLvoid *pointer )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncEdgeFlagPointer( stride, pointer );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::ArrayElement( GLint i )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncArrayElement( i );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::DrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncDrawElements( mode, count, type, indices );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::DrawArrays( GLenum mode, GLint first, GLsizei count )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncDrawArrays( mode, first, count );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::InterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncInterleavedArrays( format, stride, pointer );
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::LoadIdentity( )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncLoadIdentity();
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
+// ------------------------------------------------------------------------
+
+void OpenGL::BlendFunc( GLenum sfactor, GLenum dfactor )
+{
+#ifndef REMOTE_APPSERVER
+ if( OGL_INIT() )
+ {
+ mpOGL->OGLEntry( PGRAPHICS );
+ pImplOpenGLFncBlendFunc( sfactor, dfactor);
+ mpOGL->OGLExit( PGRAPHICS );
+ }
+#else
+#endif
+}
+
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
new file mode 100644
index 000000000000..591ecf8c8f8d
--- /dev/null
+++ b/vcl/source/gdi/outdev.cxx
@@ -0,0 +1,1927 @@
+/*************************************************************************
+ *
+ * $RCSfile: outdev.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_OUTDEV_CXX
+#include <tools/ref.hxx>
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#endif
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+#ifndef _SV_SALPRN_HXX
+#include <salprn.hxx>
+#endif
+#else
+#ifndef _SV_RMOUTDEV_HXX
+#include <rmoutdev.hxx>
+#endif
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_POLY_H
+#include <poly.h>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_REGION_HXX
+#include <region.hxx>
+#endif
+#ifndef _SV_REGION_H
+#include <region.h>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_OUTDATA_HXX
+#include <outdata.hxx>
+#endif
+#ifndef _SV_PRINT_HXX
+#include <print.hxx>
+#endif
+#ifndef _SV_SALOTYPE_HXX
+#include <salotype.hxx>
+#endif
+#ifndef _SV_OPENGL_HXX
+#include <opengl.hxx>
+#endif
+#ifndef _VCL_IMPLNCVT_HXX
+#include <implncvt.hxx>
+#endif
+#ifndef _SV_OUTDEV3D_HXX
+#include <outdev3d.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _VCL_UNOWRAP_HXX
+#include <unowrap.hxx>
+#endif
+
+#include <com/sun/star/awt/XGraphics.hpp>
+
+DBG_NAME( OutputDevice );
+DBG_NAMEEX( Polygon );
+DBG_NAMEEX( PolyPolygon );
+DBG_NAMEEX( Region );
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+const char* ImplDbgCheckOutputDevice( const void* pObj )
+{
+ DBG_TESTSOLARMUTEX();
+
+ const OutputDevice* pOutDev = (OutputDevice*)pObj;
+
+ if ( (pOutDev->GetOutDevType() != OUTDEV_DONTKNOW) &&
+ (pOutDev->GetOutDevType() != OUTDEV_WINDOW) &&
+ (pOutDev->GetOutDevType() != OUTDEV_PRINTER) &&
+ (pOutDev->GetOutDevType() != OUTDEV_VIRDEV) )
+ return "OutputDevice data overwrite";
+
+ return NULL;
+}
+#endif
+
+// =======================================================================
+
+#define OUTDEV_POLYPOLY_STACKBUF 32
+
+// =======================================================================
+
+struct ImplObjStack
+{
+ ImplObjStack* mpPrev;
+ MapMode* mpMapMode;
+ Region* mpClipRegion;
+ Color* mpLineColor;
+ Color* mpFillColor;
+ Font* mpFont;
+ Color* mpTextColor;
+ Color* mpTextFillColor;
+ Color* mpTextLineColor;
+ Point* mpRefPoint;
+ TextAlign meTextAlign;
+ RasterOp meRasterOp;
+ USHORT mnFlags;
+};
+
+// -----------------------------------------------------------------------
+
+static void ImplDeleteObjStack( ImplObjStack* pObjStack )
+{
+ if ( pObjStack->mnFlags & PUSH_LINECOLOR )
+ {
+ if ( pObjStack->mpLineColor )
+ delete pObjStack->mpLineColor;
+ }
+ if ( pObjStack->mnFlags & PUSH_FILLCOLOR )
+ {
+ if ( pObjStack->mpFillColor )
+ delete pObjStack->mpFillColor;
+ }
+ if ( pObjStack->mnFlags & PUSH_FONT )
+ delete pObjStack->mpFont;
+ if ( pObjStack->mnFlags & PUSH_TEXTCOLOR )
+ delete pObjStack->mpTextColor;
+ if ( pObjStack->mnFlags & PUSH_TEXTFILLCOLOR )
+ {
+ if ( pObjStack->mpTextFillColor )
+ delete pObjStack->mpTextFillColor;
+ }
+ if ( pObjStack->mnFlags & PUSH_TEXTLINECOLOR )
+ {
+ if ( pObjStack->mpTextLineColor )
+ delete pObjStack->mpTextLineColor;
+ }
+ if ( pObjStack->mnFlags & PUSH_MAPMODE )
+ {
+ if ( pObjStack->mpMapMode )
+ delete pObjStack->mpMapMode;
+ }
+ if ( pObjStack->mnFlags & PUSH_CLIPREGION )
+ {
+ if ( pObjStack->mpClipRegion )
+ delete pObjStack->mpClipRegion;
+ }
+ if ( pObjStack->mnFlags & PUSH_REFPOINT )
+ {
+ if ( pObjStack->mpRefPoint )
+ delete pObjStack->mpRefPoint;
+ }
+
+ delete pObjStack;
+}
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+
+BOOL OutputDevice::ImplSelectClipRegion( SalGraphics* pGraphics, const Region& rRegion )
+{
+ DBG_TESTSOLARMUTEX();
+
+ long nX;
+ long nY;
+ long nWidth;
+ long nHeight;
+ ULONG nRectCount;
+ ImplRegionInfo aInfo;
+ BOOL bRegionRect;
+ BOOL bClipRegion = TRUE;
+
+ nRectCount = rRegion.GetRectCount();
+ pGraphics->BeginSetClipRegion( nRectCount );
+ bRegionRect = rRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
+ while ( bRegionRect )
+ {
+ if ( !pGraphics->UnionClipRegion( nX, nY, nWidth, nHeight ) )
+ bClipRegion = FALSE;
+ DBG_ASSERT( bClipRegion, "OutputDevice::ImplSelectClipRegion() - can't cerate region" );
+ bRegionRect = rRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
+ }
+ pGraphics->EndSetClipRegion();
+ return bClipRegion;
+}
+
+#endif
+
+// =======================================================================
+
+OutputDevice::OutputDevice() :
+ maRegion( REGION_NULL ),
+ maSettings( Application::GetSettings() ),
+ maFillColor( COL_WHITE ),
+ maTextLineColor( COL_TRANSPARENT )
+{
+ DBG_CTOR( OutputDevice, ImplDbgCheckOutputDevice );
+
+ mpGraphics = NULL;
+ mpUnoGraphicsList = NULL;
+ mpPrevGraphics = NULL;
+ mpNextGraphics = NULL;
+ mpMetaFile = NULL;
+ mpFontEntry = NULL;
+ mpFontCache = NULL;
+ mpFontList = NULL;
+ mpGetDevFontList = NULL;
+ mpGetDevSizeList = NULL;
+ mpObjStack = NULL;
+ mpOutDevData = NULL;
+ mp3DContext = NULL;
+ mnOutOffX = 0;
+ mnOutOffY = 0;
+ mnOutWidth = 0;
+ mnOutHeight = 0;
+ mnDPIX = 0;
+ mnDPIY = 0;
+ mnTextOffX = 0;
+ mnTextOffY = 0;
+ mnDrawMode = 0;
+ meOutDevType = OUTDEV_DONTKNOW;
+ mbMap = FALSE;
+ mbClipRegion = FALSE;
+ mbBackground = FALSE;
+ mbOutput = TRUE;
+ mbDevOutput = FALSE;
+ mbOutputClipped = FALSE;
+ maTextColor = maFont.GetColor();
+ maTextFillColorDummy= maFont.GetFillColor();
+ meTextAlign = maFont.GetAlign();
+ meRasterOp = ROP_OVERPAINT;
+ mbLineColor = TRUE;
+ mbFillColor = TRUE;
+ mbInitLineColor = TRUE;
+ mbInitFillColor = TRUE;
+ mbInitFont = TRUE;
+ mbInitTextColor = TRUE;
+ mbInitClipRegion = TRUE;
+ mbClipRegionSet = FALSE;
+ mbKerning = FALSE;
+ mbNewFont = TRUE;
+ mbTextLines = FALSE;
+ mbTextSpecial = FALSE;
+ mbRefPoint = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+OutputDevice::~OutputDevice()
+{
+ DBG_DTOR( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( GetUnoGraphicsList() )
+ {
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ if ( pWrapper )
+ pWrapper->ReleaseAllGraphics( this );
+ delete mpUnoGraphicsList;
+ mpUnoGraphicsList = NULL;
+ }
+
+ if ( mp3DContext )
+ mp3DContext->Destroy( this );
+
+ if ( mpOutDevData )
+ ImplDeInitOutDevData();
+
+ ImplObjStack* pData = mpObjStack;
+ if ( pData )
+ {
+ DBG_ERRORFILE( "OutputDevice::~OutputDevice(): OutputDevice::Push() calls != OutputDevice::Pop() calls" );
+ while ( pData )
+ {
+ ImplObjStack* pTemp = pData;
+ pData = pData->mpPrev;
+ ImplDeleteObjStack( pTemp );
+ }
+ }
+
+ if ( mpFontEntry )
+ mpFontCache->Release( mpFontEntry );
+ if ( mpGetDevFontList )
+ delete mpGetDevFontList;
+ if ( mpGetDevSizeList )
+ delete mpGetDevSizeList;
+}
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+
+int OutputDevice::ImplGetGraphics()
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( mpGraphics )
+ return TRUE;
+
+ mbInitLineColor = TRUE;
+ mbInitFillColor = TRUE;
+ mbInitFont = TRUE;
+ mbInitTextColor = TRUE;
+ mbInitClipRegion = TRUE;
+
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( meOutDevType == OUTDEV_WINDOW )
+ {
+ Window* pWindow = (Window*)this;
+
+ mpGraphics = pWindow->mpFrame->GetGraphics();
+ // Wenn wir keinen bekommen haben, versuchen wir uns einen zu klauen
+ if ( !mpGraphics )
+ {
+ OutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics;
+ while ( pReleaseOutDev )
+ {
+ if ( ((Window*)pReleaseOutDev)->mpFrame == pWindow->mpFrame )
+ break;
+ pReleaseOutDev = pReleaseOutDev->mpPrevGraphics;
+ }
+
+ if ( pReleaseOutDev )
+ {
+ mpGraphics = pReleaseOutDev->mpGraphics;
+ pReleaseOutDev->ImplReleaseGraphics( FALSE );
+ }
+ else
+ {
+ while ( !mpGraphics )
+ {
+ if ( !pSVData->maGDIData.mpLastWinGraphics )
+ break;
+ pSVData->maGDIData.mpLastWinGraphics->ImplReleaseGraphics();
+ mpGraphics = pWindow->mpFrame->GetGraphics();
+ }
+ }
+ }
+
+ if ( mpGraphics )
+ {
+ mpNextGraphics = pSVData->maGDIData.mpFirstWinGraphics;
+ pSVData->maGDIData.mpFirstWinGraphics = this;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = this;
+ if ( !pSVData->maGDIData.mpLastWinGraphics )
+ pSVData->maGDIData.mpLastWinGraphics = this;
+ }
+ }
+ else if ( meOutDevType == OUTDEV_VIRDEV )
+ {
+ VirtualDevice* pVirDev = (VirtualDevice*)this;
+
+ if ( pVirDev->mpVirDev )
+ {
+ mpGraphics = pVirDev->mpVirDev->GetGraphics();
+ while ( !mpGraphics )
+ {
+ if ( !pSVData->maGDIData.mpLastVirGraphics )
+ break;
+ pSVData->maGDIData.mpLastVirGraphics->ImplReleaseGraphics();
+ mpGraphics = pVirDev->mpVirDev->GetGraphics();
+ }
+ if ( mpGraphics )
+ {
+ mpNextGraphics = pSVData->maGDIData.mpFirstVirGraphics;
+ pSVData->maGDIData.mpFirstVirGraphics = this;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = this;
+ if ( !pSVData->maGDIData.mpLastVirGraphics )
+ pSVData->maGDIData.mpLastVirGraphics = this;
+ }
+ }
+ }
+ else if ( meOutDevType == OUTDEV_PRINTER )
+ {
+ Printer* pPrinter = (Printer*)this;
+
+ if ( pPrinter->mpJobGraphics )
+ mpGraphics = pPrinter->mpJobGraphics;
+ else if ( pPrinter->mpDisplayDev )
+ {
+ VirtualDevice* pVirDev = pPrinter->mpDisplayDev;
+ mpGraphics = pVirDev->mpVirDev->GetGraphics();
+ while ( !mpGraphics )
+ {
+ if ( !pSVData->maGDIData.mpLastVirGraphics )
+ break;
+ pSVData->maGDIData.mpLastVirGraphics->ImplReleaseGraphics();
+ mpGraphics = pVirDev->mpVirDev->GetGraphics();
+ }
+ if ( mpGraphics )
+ {
+ mpNextGraphics = pSVData->maGDIData.mpFirstVirGraphics;
+ pSVData->maGDIData.mpFirstVirGraphics = this;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = this;
+ if ( !pSVData->maGDIData.mpLastVirGraphics )
+ pSVData->maGDIData.mpLastVirGraphics = this;
+ }
+ }
+ else
+ {
+ mpGraphics = pPrinter->mpInfoPrinter->GetGraphics();
+ while ( !mpGraphics )
+ {
+ if ( !pSVData->maGDIData.mpLastPrnGraphics )
+ break;
+ pSVData->maGDIData.mpLastPrnGraphics->ImplReleaseGraphics();
+ mpGraphics = pPrinter->mpInfoPrinter->GetGraphics();
+ }
+ if ( mpGraphics )
+ {
+ mpNextGraphics = pSVData->maGDIData.mpFirstPrnGraphics;
+ pSVData->maGDIData.mpFirstPrnGraphics = this;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = this;
+ if ( !pSVData->maGDIData.mpLastPrnGraphics )
+ pSVData->maGDIData.mpLastPrnGraphics = this;
+ }
+ }
+ }
+
+ if ( mpGraphics )
+ {
+ mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp) );
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplReleaseGraphics( BOOL bRelease )
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( !mpGraphics )
+ return;
+
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( meOutDevType == OUTDEV_WINDOW )
+ {
+ Window* pWindow = (Window*)this;
+
+ if ( bRelease )
+ pWindow->mpFrame->ReleaseGraphics( mpGraphics );
+ if ( mpPrevGraphics )
+ mpPrevGraphics->mpNextGraphics = mpNextGraphics;
+ else
+ pSVData->maGDIData.mpFirstWinGraphics = mpNextGraphics;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
+ else
+ pSVData->maGDIData.mpLastWinGraphics = mpPrevGraphics;
+ }
+ else if ( meOutDevType == OUTDEV_VIRDEV )
+ {
+ VirtualDevice* pVirDev = (VirtualDevice*)this;
+
+ if ( bRelease )
+ pVirDev->mpVirDev->ReleaseGraphics( mpGraphics );
+ if ( mpPrevGraphics )
+ mpPrevGraphics->mpNextGraphics = mpNextGraphics;
+ else
+ pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
+ else
+ pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics;
+ }
+ else if ( meOutDevType == OUTDEV_PRINTER )
+ {
+ Printer* pPrinter = (Printer*)this;
+
+ if ( !pPrinter->mpJobGraphics )
+ {
+ if ( pPrinter->mpDisplayDev )
+ {
+ VirtualDevice* pVirDev = pPrinter->mpDisplayDev;
+ if ( bRelease )
+ pVirDev->mpVirDev->ReleaseGraphics( mpGraphics );
+ if ( mpPrevGraphics )
+ mpPrevGraphics->mpNextGraphics = mpNextGraphics;
+ else
+ pSVData->maGDIData.mpFirstVirGraphics = mpNextGraphics;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
+ else
+ pSVData->maGDIData.mpLastVirGraphics = mpPrevGraphics;
+ }
+ else
+ {
+ if ( bRelease )
+ pPrinter->mpInfoPrinter->ReleaseGraphics( mpGraphics );
+ if ( mpPrevGraphics )
+ mpPrevGraphics->mpNextGraphics = mpNextGraphics;
+ else
+ pSVData->maGDIData.mpFirstPrnGraphics = mpNextGraphics;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
+ else
+ pSVData->maGDIData.mpLastPrnGraphics = mpPrevGraphics;
+ }
+ }
+ }
+
+ mpGraphics = NULL;
+ mpPrevGraphics = NULL;
+ mpNextGraphics = NULL;
+
+ if ( mpGetDevFontList )
+ {
+ delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
+ }
+ if ( mpGetDevSizeList )
+ {
+ delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
+ }
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplInitOutDevData()
+{
+ if ( !mpOutDevData )
+ {
+ mpOutDevData = new ImplOutDevData;
+ mpOutDevData->mpRotateDev = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDeInitOutDevData()
+{
+ if ( mpOutDevData )
+ {
+ if ( mpOutDevData->mpRotateDev )
+ delete mpOutDevData->mpRotateDev;
+ delete mpOutDevData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplInitLineColor()
+{
+ DBG_TESTSOLARMUTEX();
+
+#ifndef REMOTE_APPSERVER
+ if( mbLineColor )
+ {
+ if( ROP_0 == meRasterOp )
+ mpGraphics->SetROPLineColor( SAL_ROP_0 );
+ else if( ROP_1 == meRasterOp )
+ mpGraphics->SetROPLineColor( SAL_ROP_1 );
+ else if( ROP_INVERT == meRasterOp )
+ mpGraphics->SetROPLineColor( SAL_ROP_INVERT );
+ else
+ mpGraphics->SetLineColor( ImplColorToSal( maLineColor ) );
+ }
+ else
+ mpGraphics->SetLineColor();
+#else
+ mpGraphics->SetLineColor( maLineColor );
+#endif
+
+ mbInitLineColor = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplInitFillColor()
+{
+ DBG_TESTSOLARMUTEX();
+
+#ifndef REMOTE_APPSERVER
+ if( mbFillColor )
+ {
+ if( ROP_0 == meRasterOp )
+ mpGraphics->SetROPFillColor( SAL_ROP_0 );
+ else if( ROP_1 == meRasterOp )
+ mpGraphics->SetROPFillColor( SAL_ROP_1 );
+ else if( ROP_INVERT == meRasterOp )
+ mpGraphics->SetROPFillColor( SAL_ROP_INVERT );
+ else
+ mpGraphics->SetFillColor( ImplColorToSal( maFillColor ) );
+ }
+ else
+ mpGraphics->SetFillColor();
+#else
+ mpGraphics->SetFillColor( maFillColor );
+#endif
+
+ mbInitFillColor = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplInitClipRegion()
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( GetOutDevType() == OUTDEV_WINDOW )
+ {
+ Window* pWindow = (Window*)this;
+ Region aRegion;
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( pWindow->mpFrameData->mpFirstBackWin )
+ pWindow->ImplInvalidateAllOverlapBackgrounds();
+ if ( pWindow->mbInPaint )
+ aRegion = *(pWindow->mpPaintRegion);
+ else
+ aRegion = *(pWindow->ImplGetWinChildClipRegion());
+ if ( mbClipRegion )
+ aRegion.Intersect( ImplPixelToDevicePixel( maRegion ) );
+ if ( aRegion.IsEmpty() )
+ mbOutputClipped = TRUE;
+ else
+ {
+ mbOutputClipped = FALSE;
+#ifndef REMOTE_APPSERVER
+ ImplSelectClipRegion( mpGraphics, aRegion );
+#else
+ mpGraphics->SetClipRegion( aRegion );
+#endif
+ }
+ mbClipRegionSet = TRUE;
+ }
+ else
+ {
+ if ( mbClipRegion )
+ {
+ if ( maRegion.IsEmpty() )
+ mbOutputClipped = TRUE;
+ else
+ {
+ mbOutputClipped = FALSE;
+#ifndef REMOTE_APPSERVER
+ ImplSelectClipRegion( mpGraphics, maRegion );
+#else
+ mpGraphics->SetClipRegion( maRegion );
+#endif
+ }
+
+ mbClipRegionSet = TRUE;
+ }
+ else
+ {
+ if ( mbClipRegionSet )
+ {
+#ifndef REMOTE_APPSERVER
+ mpGraphics->ResetClipRegion();
+#else
+ mpGraphics->SetClipRegion();
+#endif
+ mbClipRegionSet = FALSE;
+ }
+
+ mbOutputClipped = FALSE;
+ }
+ }
+
+ mbInitClipRegion = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplSetClipRegion( const Region* pRegion )
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( !pRegion )
+ {
+ if ( mbClipRegion )
+ {
+ maRegion = Region( REGION_NULL );
+ mbClipRegion = FALSE;
+ mbInitClipRegion = TRUE;
+ }
+ }
+ else
+ {
+ maRegion = *pRegion;
+ mbClipRegion = TRUE;
+ mbInitClipRegion = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetClipRegion()
+{
+ DBG_TRACE( "OutputDevice::SetClipRegion()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaClipRegionAction( Region(), FALSE ) );
+
+ ImplSetClipRegion( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetClipRegion( const Region& rRegion )
+{
+ DBG_TRACE( "OutputDevice::SetClipRegion( rRegion )" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaClipRegionAction( rRegion, TRUE ) );
+
+ if ( rRegion.GetType() == REGION_NULL )
+ ImplSetClipRegion( NULL );
+ else
+ {
+ Region aRegion = LogicToPixel( rRegion );
+ ImplSetClipRegion( &aRegion );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Region OutputDevice::GetClipRegion() const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ return PixelToLogic( maRegion );
+}
+
+// -----------------------------------------------------------------------
+
+Region OutputDevice::GetActiveClipRegion() const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( GetOutDevType() == OUTDEV_WINDOW )
+ {
+ Region aRegion( REGION_NULL );
+ Window* pWindow = (Window*)this;
+ if ( pWindow->mbInPaint )
+ {
+ aRegion = *(pWindow->mpPaintRegion);
+ aRegion.Move( -mnOutOffX, -mnOutOffY );
+ }
+ if ( mbClipRegion )
+ aRegion.Intersect( maRegion );
+ return PixelToLogic( aRegion );
+ }
+ else
+ return GetClipRegion();
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove )
+{
+ DBG_TRACE( "OutputDevice::MoveClipRegion()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mbClipRegion )
+ {
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaMoveClipRegionAction( nHorzMove, nVertMove ) );
+
+ maRegion.Move( ImplLogicWidthToDevicePixel( nHorzMove ),
+ ImplLogicHeightToDevicePixel( nVertMove ) );
+ mbInitClipRegion = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::IntersectClipRegion( const Rectangle& rRect )
+{
+ DBG_TRACE( "OutputDevice::IntersectClipRegion( rRect )" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaISectRectClipRegionAction( rRect ) );
+
+ Rectangle aRect = LogicToPixel( rRect );
+ maRegion.Intersect( aRect );
+ mbClipRegion = TRUE;
+ mbInitClipRegion = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::IntersectClipRegion( const Region& rRegion )
+{
+ DBG_TRACE( "OutputDevice::IntersectClipRegion( rRegion )" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+
+ RegionType eType = rRegion.GetType();
+
+ if ( eType != REGION_NULL )
+ {
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaISectRegionClipRegionAction( rRegion ) );
+
+ Region aRegion = LogicToPixel( rRegion );
+ maRegion.Intersect( aRegion );
+ mbClipRegion = TRUE;
+ mbInitClipRegion = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetDrawMode( ULONG nDrawMode )
+{
+ DBG_TRACE1( "OutputDevice::SetDrawMode( %lx )", nDrawMode );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ mnDrawMode = nDrawMode;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetRasterOp( RasterOp eRasterOp )
+{
+ DBG_TRACE1( "OutputDevice::SetRasterOp( %d )", (int)eRasterOp );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaRasterOpAction( eRasterOp ) );
+
+ if ( meRasterOp != eRasterOp )
+ {
+ meRasterOp = eRasterOp;
+ mbInitLineColor = mbInitFillColor = TRUE;
+
+#ifndef REMOTE_APPSERVER
+ if( mpGraphics || ImplGetGraphics() )
+ mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp) );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if( pGraphics )
+ pGraphics->SetRasterOp( eRasterOp );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetLineColor()
+{
+ DBG_TRACE( "OutputDevice::SetLineColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaLineColorAction( Color(), FALSE ) );
+
+ if ( mbLineColor )
+ {
+ mbInitLineColor = TRUE;
+ mbLineColor = FALSE;
+ maLineColor = Color( COL_TRANSPARENT );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetLineColor( const Color& rColor )
+{
+ DBG_TRACE1( "OutputDevice::SetLineColor( %lx )", rColor.GetColor() );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor( rColor );
+
+ if( mnDrawMode & ( DRAWMODE_BLACKLINE | DRAWMODE_WHITELINE |
+ DRAWMODE_GRAYLINE | DRAWMODE_GHOSTEDLINE ) )
+ {
+ if( !ImplIsColorTransparent( aColor ) )
+ {
+ if( mnDrawMode & DRAWMODE_BLACKLINE )
+ {
+ aColor = Color( COL_BLACK );
+ }
+ else if( mnDrawMode & DRAWMODE_WHITELINE )
+ {
+ aColor = Color( COL_WHITE );
+ }
+ else if( mnDrawMode & DRAWMODE_GRAYLINE )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+
+ if( mnDrawMode & DRAWMODE_GHOSTEDLINE )
+ {
+ aColor = Color( ( aColor.GetRed() >> 1 ) | 0x80,
+ ( aColor.GetGreen() >> 1 ) | 0x80,
+ ( aColor.GetBlue() >> 1 ) | 0x80);
+ }
+ }
+ }
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaLineColorAction( aColor, TRUE ) );
+
+ if( ImplIsColorTransparent( aColor ) )
+ {
+ if ( mbLineColor )
+ {
+ mbInitLineColor = TRUE;
+ mbLineColor = FALSE;
+ maLineColor = Color( COL_TRANSPARENT );
+ }
+ }
+ else
+ {
+ if( maLineColor != aColor )
+ {
+ mbInitLineColor = TRUE;
+ mbLineColor = TRUE;
+ maLineColor = aColor;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetFillColor()
+{
+ DBG_TRACE( "OutputDevice::SetFillColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaFillColorAction( Color(), FALSE ) );
+
+ if ( mbFillColor )
+ {
+ mbInitFillColor = TRUE;
+ mbFillColor = FALSE;
+ maFillColor = Color( COL_TRANSPARENT );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetFillColor( const Color& rColor )
+{
+ DBG_TRACE1( "OutputDevice::SetFillColor( %lx )", rColor.GetColor() );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor( rColor );
+
+ if( mnDrawMode & ( DRAWMODE_BLACKFILL | DRAWMODE_WHITEFILL |
+ DRAWMODE_GRAYFILL | DRAWMODE_NOFILL |
+ DRAWMODE_GHOSTEDFILL ) )
+ {
+ if( !ImplIsColorTransparent( aColor ) )
+ {
+ if( mnDrawMode & DRAWMODE_BLACKFILL )
+ {
+ aColor = Color( COL_BLACK );
+ }
+ else if( mnDrawMode & DRAWMODE_WHITEFILL )
+ {
+ aColor = Color( COL_WHITE );
+ }
+ else if( mnDrawMode & DRAWMODE_GRAYFILL )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+ else if( mnDrawMode & DRAWMODE_NOFILL )
+ {
+ aColor = Color( COL_TRANSPARENT );
+ }
+
+ if( mnDrawMode & DRAWMODE_GHOSTEDFILL )
+ {
+ aColor = Color( (aColor.GetRed() >> 1) | 0x80,
+ (aColor.GetGreen() >> 1) | 0x80,
+ (aColor.GetBlue() >> 1) | 0x80);
+ }
+ }
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaFillColorAction( aColor, TRUE ) );
+
+ if ( ImplIsColorTransparent( aColor ) )
+ {
+ if ( mbFillColor )
+ {
+ mbInitFillColor = TRUE;
+ mbFillColor = FALSE;
+ maFillColor = Color( COL_TRANSPARENT );
+ }
+ }
+ else
+ {
+ if ( maFillColor != aColor )
+ {
+ mbInitFillColor = TRUE;
+ mbFillColor = TRUE;
+ maFillColor = aColor;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetBackground()
+{
+ DBG_TRACE( "OutputDevice::SetBackground()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ maBackground = Wallpaper();
+ mbBackground = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetBackground( const Wallpaper& rBackground )
+{
+ DBG_TRACE( "OutputDevice::SetBackground( rBackground )" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ maBackground = rBackground;
+
+ if( rBackground.GetStyle() == WALLPAPER_NULL )
+ mbBackground = FALSE;
+ else
+ mbBackground = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetRefPoint()
+{
+ DBG_TRACE( "OutputDevice::SetRefPoint()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaRefPointAction( Point(), FALSE ) );
+
+ mbRefPoint = FALSE;
+ maRefPoint.X() = maRefPoint.Y() = 0L;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetRefPoint( const Point& rRefPoint )
+{
+ DBG_TRACE( "OutputDevice::SetRefPoint( rRefPoint )" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaRefPointAction( rRefPoint, TRUE ) );
+
+ mbRefPoint = TRUE;
+ maRefPoint = rRefPoint;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
+{
+ DBG_TRACE( "OutputDevice::DrawLine()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaLineAction( rStartPt, rEndPt ) );
+
+ if ( !IsDeviceOutputNecessary() || !mbLineColor )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ Point aStartPt = ImplLogicToDevicePixel( rStartPt );
+ Point aEndPt = ImplLogicToDevicePixel( rEndPt );
+
+ mpGraphics->DrawLine( aStartPt.X(), aStartPt.Y(), aEndPt.X(), aEndPt.Y() );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ pGraphics->DrawLine( ImplLogicToDevicePixel( rStartPt ),
+ ImplLogicToDevicePixel( rEndPt ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
+ const LineInfo& rLineInfo )
+{
+ DBG_TRACE( "OutputDevice::DrawLine()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( rLineInfo.IsDefault() )
+ {
+ DrawLine( rStartPt, rEndPt );
+ return;
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaLineAction( rStartPt, rEndPt, rLineInfo ) );
+
+ if ( !IsDeviceOutputNecessary() || !mbLineColor || ( LINE_NONE == rLineInfo.GetStyle() ) )
+ return;
+
+#ifndef REMOTE_APPSERVER
+
+ if( !mpGraphics && !ImplGetGraphics() )
+ return;
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( mbOutputClipped )
+ return;
+
+ const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
+
+ if( ( aInfo.GetWidth() > 1L ) || ( LINE_DASH == aInfo.GetStyle() ) )
+ {
+ Polygon aPoly( 2 ); aPoly[ 0 ] = rStartPt; aPoly[ 1 ] = rEndPt;
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ ImplLineConverter aLineCvt( ImplLogicToDevicePixel( aPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
+
+ mpMetaFile = NULL;
+
+ if ( aInfo.GetWidth() > 1 )
+ {
+ const Color aOldLineColor( maLineColor );
+ const Color aOldFillColor( maFillColor );
+
+ SetLineColor();
+ ImplInitLineColor();
+ SetFillColor( aOldLineColor );
+ ImplInitFillColor();
+
+ for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->ImplGetConstPointAry() );
+
+ SetFillColor( aOldFillColor );
+ SetLineColor( aOldLineColor );
+ }
+ else
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ for ( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ mpGraphics->DrawLine( (*pPoly)[ 0 ].X(), (*pPoly)[ 0 ].Y(), (*pPoly)[ 1 ].X(), (*pPoly)[ 1 ].Y() );
+ }
+ mpMetaFile = pOldMetaFile;
+ }
+ else
+ {
+ const Point aStartPt( ImplLogicToDevicePixel( rStartPt ) );
+ const Point aEndPt( ImplLogicToDevicePixel( rEndPt ) );
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ mpGraphics->DrawLine( aStartPt.X(), aStartPt.Y(), aEndPt.X(), aEndPt.Y() );
+ }
+
+#else
+
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
+
+ if( ( aInfo.GetWidth() > 1L ) || ( LINE_DASH == aInfo.GetStyle() ) )
+ {
+ Polygon aPoly( 2 ); aPoly[ 0 ] = rStartPt; aPoly[ 1 ] = rEndPt;
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ ImplLineConverter aLineCvt( ImplLogicToDevicePixel( aPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
+
+ mpMetaFile = NULL;
+
+ if ( aInfo.GetWidth() > 1 )
+ {
+ const Color aOldLineColor( maLineColor );
+ const Color aOldFillColor( maFillColor );
+
+ SetLineColor();
+ ImplInitLineColor();
+ SetFillColor( aOldLineColor );
+ ImplInitFillColor();
+
+ for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ pGraphics->DrawPolygon( *pPoly );
+
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+ }
+ else
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ for ( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) {
+ Point xPoint((*pPoly)[ 0 ].X(), (*pPoly)[ 0 ].Y());
+ Point yPoint((*pPoly)[ 1 ].X(), (*pPoly)[ 1 ].Y());
+ mpGraphics->DrawLine( xPoint, yPoint );
+ }
+ }
+ mpMetaFile = pOldMetaFile;
+ }
+ else
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ pGraphics->DrawLine( ImplLogicToDevicePixel( rStartPt ), ImplLogicToDevicePixel( rEndPt ) );
+ }
+ }
+
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawRect( const Rectangle& rRect )
+{
+ DBG_TRACE( "OutputDevice::DrawRect()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaRectAction( rRect ) );
+
+ if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) )
+ return;
+
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+
+ if ( aRect.IsEmpty() )
+ return;
+ aRect.Justify();
+
+#ifndef REMOTE_APPSERVER
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ mpGraphics->DrawRect( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight() );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawRect( aRect );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPolyLine( const Polygon& rPoly )
+{
+ DBG_TRACE( "OutputDevice::DrawPolyLine()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rPoly, Polygon, NULL );
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPolyLineAction( rPoly ) );
+
+ USHORT nPoints = rPoly.GetSize();
+
+ if ( !IsDeviceOutputNecessary() || !mbLineColor || (nPoints < 2) )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ Polygon aPoly = ImplLogicToDevicePixel( rPoly );
+
+ const SalPoint* pPtAry = (const SalPoint*)aPoly.ImplGetConstPointAry();
+ mpGraphics->DrawPolyLine( nPoints, pPtAry );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ pGraphics->DrawPolyLine( ImplLogicToDevicePixel( rPoly ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo )
+{
+ DBG_TRACE( "OutputDevice::DrawPolyLine()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rPoly, Polygon, NULL );
+
+ if ( rLineInfo.IsDefault() )
+ {
+ DrawPolyLine( rPoly );
+ return;
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPolyLineAction( rPoly, rLineInfo ) );
+
+ USHORT nPoints = rPoly.GetSize();
+
+ if ( !IsDeviceOutputNecessary() || !mbLineColor || ( nPoints < 2 ) || ( LINE_NONE == rLineInfo.GetStyle() ) )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics && !ImplGetGraphics() )
+ return;
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( mbOutputClipped )
+ return;
+
+ const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
+
+ if( aInfo.GetWidth() > 1L )
+ {
+ const Color aOldLineColor( maLineColor );
+ const Color aOldFillColor( maFillColor );
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ ImplLineConverter aLineCvt( ImplLogicToDevicePixel( rPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
+
+ mpMetaFile = NULL;
+ SetLineColor();
+ ImplInitLineColor();
+ SetFillColor( aOldLineColor );
+ ImplInitFillColor();
+
+ for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->ImplGetConstPointAry() );
+
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+ mpMetaFile = pOldMetaFile;
+ }
+ else
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( LINE_DASH == aInfo.GetStyle() )
+ {
+ ImplLineConverter aLineCvt( ImplLogicToDevicePixel( rPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
+ for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ mpGraphics->DrawPolyLine( pPoly->GetSize(), (const SalPoint*)pPoly->ImplGetConstPointAry() );
+ }
+ else
+ mpGraphics->DrawPolyLine( nPoints, (const SalPoint*) ImplLogicToDevicePixel( rPoly ).ImplGetConstPointAry() );
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+
+ if ( pGraphics )
+ {
+ const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) );
+
+ if( aInfo.GetWidth() > 1L )
+ {
+ const Color aOldLineColor( maLineColor );
+ const Color aOldFillColor( maFillColor );
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ ImplLineConverter aLineCvt( ImplLogicToDevicePixel( rPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
+
+ mpMetaFile = NULL;
+ SetLineColor();
+ ImplInitLineColor();
+ SetFillColor( aOldLineColor );
+ ImplInitFillColor();
+
+ for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ pGraphics->DrawPolygon( *pPoly );
+
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+ mpMetaFile = pOldMetaFile;
+ }
+ else
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( LINE_DASH == aInfo.GetStyle() )
+ {
+ ImplLineConverter aLineCvt( ImplLogicToDevicePixel( rPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL );
+ for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() )
+ pGraphics->DrawPolyLine( *pPoly );
+ }
+ else
+ pGraphics->DrawPolyLine( ImplLogicToDevicePixel( rPoly ) );
+ }
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPolygon( const Polygon& rPoly )
+{
+ DBG_TRACE( "OutputDevice::DrawPolygon()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rPoly, Polygon, NULL );
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) );
+
+ USHORT nPoints = rPoly.GetSize();
+
+ if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || (nPoints < 2) )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ Polygon aPoly = ImplLogicToDevicePixel( rPoly );
+
+ const SalPoint* pPtAry = (const SalPoint*)aPoly.ImplGetConstPointAry();
+ mpGraphics->DrawPolygon( nPoints, pPtAry );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawPolygon( ImplLogicToDevicePixel( rPoly ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ DBG_TRACE( "OutputDevice::DrawPolyPolygon()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL );
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPoly ) );
+
+ USHORT nPoly = rPolyPoly.Count();
+
+ if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) || !nPoly )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ if ( nPoly == 1 )
+ {
+ Polygon aPoly = ImplLogicToDevicePixel( rPolyPoly.GetObject( 0 ) );
+ USHORT nSize = aPoly.GetSize();
+ if ( nSize >= 2 )
+ {
+ const SalPoint* pPtAry = (const SalPoint*)aPoly.ImplGetConstPointAry();
+ mpGraphics->DrawPolygon( nSize, pPtAry );
+ }
+ }
+ else
+ {
+ PolyPolygon aPolyPoly = ImplLogicToDevicePixel( rPolyPoly );
+ ULONG aStackAry1[OUTDEV_POLYPOLY_STACKBUF];
+ PCONSTSALPOINT aStackAry2[OUTDEV_POLYPOLY_STACKBUF];
+ ULONG* pPointAry;
+ PCONSTSALPOINT* pPointAryAry;
+ USHORT i = 0;
+ if ( nPoly > OUTDEV_POLYPOLY_STACKBUF )
+ {
+ pPointAry = new ULONG[nPoly];
+ pPointAryAry = new PCONSTSALPOINT[nPoly];
+ }
+ else
+ {
+ pPointAry = aStackAry1;
+ pPointAryAry = aStackAry2;
+ }
+ do
+ {
+ const Polygon& rPoly = aPolyPoly.GetObject( i );
+ USHORT nSize = rPoly.GetSize();
+ if ( nSize )
+ {
+ pPointAry[i] = nSize;
+ pPointAryAry[i] = (PCONSTSALPOINT)rPoly.ImplGetConstPointAry();
+ i++;
+ }
+ else
+ nPoly--;
+ }
+ while ( i < nPoly );
+
+ if ( nPoly == 1 )
+ mpGraphics->DrawPolygon( *pPointAry, *pPointAryAry );
+ else
+ mpGraphics->DrawPolyPolygon( nPoly, pPointAry, pPointAryAry );
+
+ if ( pPointAry != aStackAry1 )
+ {
+ delete pPointAry;
+ delete pPointAryAry;
+ }
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ if ( nPoly == 1 )
+ {
+ Polygon aPoly = ImplLogicToDevicePixel( rPolyPoly.GetObject( 0 ) );
+ USHORT nSize = aPoly.GetSize();
+ if ( nSize >= 2 )
+ pGraphics->DrawPolygon( aPoly );
+ }
+ else
+ pGraphics->DrawPolyPolygon( ImplLogicToDevicePixel( rPolyPoly ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::Push( USHORT nFlags )
+{
+ DBG_TRACE( "OutputDevice::Push()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPushAction( nFlags ) );
+
+ ImplObjStack* pData = new ImplObjStack;
+ pData->mpPrev = mpObjStack;
+ mpObjStack = pData;
+
+ pData->mnFlags = nFlags;
+
+ if ( nFlags & PUSH_LINECOLOR )
+ {
+ if ( mbLineColor )
+ pData->mpLineColor = new Color( maLineColor );
+ else
+ pData->mpLineColor = NULL;
+ }
+ if ( nFlags & PUSH_FILLCOLOR )
+ {
+ if ( mbFillColor )
+ pData->mpFillColor = new Color( maFillColor );
+ else
+ pData->mpFillColor = NULL;
+ }
+ if ( nFlags & PUSH_FONT )
+ pData->mpFont = new Font( maFont );
+ if ( nFlags & PUSH_TEXTCOLOR )
+ pData->mpTextColor = new Color( GetTextColor() );
+ if ( nFlags & PUSH_TEXTFILLCOLOR )
+ {
+ if ( IsTextFillColor() )
+ pData->mpTextFillColor = new Color( GetTextFillColor() );
+ else
+ pData->mpTextFillColor = NULL;
+ }
+ if ( nFlags & PUSH_TEXTLINECOLOR )
+ {
+ if ( IsTextLineColor() )
+ pData->mpTextLineColor = new Color( GetTextLineColor() );
+ else
+ pData->mpTextLineColor = NULL;
+ }
+ if ( nFlags & PUSH_TEXTALIGN )
+ pData->meTextAlign = GetTextAlign();
+ if ( nFlags & PUSH_RASTEROP )
+ pData->meRasterOp = GetRasterOp();
+ if ( nFlags & PUSH_MAPMODE )
+ {
+ if ( mbMap )
+ pData->mpMapMode = new MapMode( maMapMode );
+ else
+ pData->mpMapMode = NULL;
+ }
+ if ( nFlags & PUSH_CLIPREGION )
+ {
+ if ( mbClipRegion )
+ pData->mpClipRegion = new Region( maRegion );
+ else
+ pData->mpClipRegion = NULL;
+ }
+ if ( nFlags & PUSH_REFPOINT )
+ {
+ if ( mbRefPoint )
+ pData->mpRefPoint = new Point( maRefPoint );
+ else
+ pData->mpRefPoint = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::Pop()
+{
+ DBG_TRACE( "OutputDevice::Pop()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPopAction() );
+
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ ImplObjStack* pData = mpObjStack;
+ mpMetaFile = NULL;
+
+ if ( !pData )
+ {
+ DBG_ERRORFILE( "OutputDevice::Pop() without OutputDevice::Push()" );
+ return;
+ }
+
+ mpObjStack = pData->mpPrev;
+
+ if ( pData->mnFlags & PUSH_LINECOLOR )
+ {
+ if ( pData->mpLineColor )
+ SetLineColor( *pData->mpLineColor );
+ else
+ SetLineColor();
+ }
+ if ( pData->mnFlags & PUSH_FILLCOLOR )
+ {
+ if ( pData->mpFillColor )
+ SetFillColor( *pData->mpFillColor );
+ else
+ SetFillColor();
+ }
+ if ( pData->mnFlags & PUSH_FONT )
+ SetFont( *pData->mpFont );
+ if ( pData->mnFlags & PUSH_TEXTCOLOR )
+ SetTextColor( *pData->mpTextColor );
+ if ( pData->mnFlags & PUSH_TEXTFILLCOLOR )
+ {
+ if ( pData->mpTextFillColor )
+ SetTextFillColor( *pData->mpTextFillColor );
+ else
+ SetTextFillColor();
+ }
+ if ( pData->mnFlags & PUSH_TEXTLINECOLOR )
+ {
+ if ( pData->mpTextLineColor )
+ SetTextLineColor( *pData->mpTextLineColor );
+ else
+ SetTextLineColor();
+ }
+ if ( pData->mnFlags & PUSH_TEXTALIGN )
+ SetTextAlign( pData->meTextAlign );
+ if ( pData->mnFlags & PUSH_RASTEROP )
+ SetRasterOp( pData->meRasterOp );
+ if ( pData->mnFlags & PUSH_MAPMODE )
+ {
+ if ( pData->mpMapMode )
+ SetMapMode( *pData->mpMapMode );
+ else
+ SetMapMode();
+ }
+ if ( pData->mnFlags & PUSH_CLIPREGION )
+ ImplSetClipRegion( pData->mpClipRegion );
+ if ( pData->mnFlags & PUSH_REFPOINT )
+ {
+ if ( pData->mpRefPoint )
+ SetRefPoint( *pData->mpRefPoint );
+ else
+ SetRefPoint();
+ }
+
+ ImplDeleteObjStack( pData );
+
+ mpMetaFile = pOldMetaFile;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT OutputDevice::GetBitCount() const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( meOutDevType == OUTDEV_VIRDEV )
+ return ((VirtualDevice*)this)->mnBitCount;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !((OutputDevice*)this)->ImplGetGraphics() )
+ return 0;
+ }
+#endif
+
+ return (USHORT)mpGraphics->GetBitCount();
+}
+
+// -----------------------------------------------------------------------
+
+ULONG OutputDevice::GetColorCount() const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ const USHORT nBitCount = GetBitCount();
+ return( ( nBitCount > 31 ) ? ULONG_MAX : ( ( (ULONG) 1 ) << nBitCount) );
+}
+
+// -----------------------------------------------------------------------
+
+OpenGL* OutputDevice::GetOpenGL()
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+#ifndef REMOTE_APPSERVER
+ OpenGL* pOGL;
+
+ if( OUTDEV_PRINTER != meOutDevType )
+ {
+ pOGL = new OpenGL( this );
+
+ if( !pOGL->IsValid() )
+ {
+ delete pOGL;
+ pOGL = NULL;
+ }
+ }
+ else
+ pOGL = NULL;
+
+ return pOGL;
+#else
+ return NULL;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > OutputDevice::CreateUnoGraphics()
+{
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ return pWrapper ? pWrapper->CreateGraphics( this ) : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >();
+}
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
new file mode 100644
index 000000000000..b454fe3632ff
--- /dev/null
+++ b/vcl/source/gdi/outdev2.cxx
@@ -0,0 +1,1928 @@
+/*************************************************************************
+ *
+ * $RCSfile: outdev2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_OUTDEV2_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_IMPBMP_HXX
+#include <impbmp.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_BITMAPEX_HXX
+#include <bitmapex.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_OUTDATA_HXX
+#include <outdata.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_REGION_H
+#include <region.h>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifdef REMOTE_APPSERVER
+#include <rmoutdev.hxx>
+#endif
+
+#define BAND_MAX_SIZE 512000
+
+// =======================================================================
+
+DBG_NAMEEX( OutputDevice );
+
+// =======================================================================
+
+// -----------
+// - Defines -
+// -----------
+
+#ifndef REMOTE_APPSERVER
+
+#define OUTDEV_INIT() \
+{ \
+ if ( !IsDeviceOutputNecessary() ) \
+ return; \
+ \
+ if ( !mpGraphics ) \
+ if ( !ImplGetGraphics() ) \
+ return; \
+ \
+ if ( mbInitClipRegion ) \
+ ImplInitClipRegion(); \
+ \
+ if ( mbOutputClipped ) \
+ return; \
+}
+
+#else // !REMOTE_APPSERVER
+
+#define OUTDEV_INIT() \
+{ \
+ if ( !IsDeviceOutputNecessary() ) \
+ return; \
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics(); \
+ if ( !pGraphics ) \
+ return; \
+}
+
+#endif // REMOTE_APPSERVER
+
+#ifndef REMOTE_APPSERVER
+#define TwoRect SalTwoRect
+#else
+#define TwoRect RemoteTwoRect
+#endif
+
+// -------------
+// - externals -
+// -------------
+
+extern ULONG nVCLRLut[ 6 ];
+extern ULONG nVCLGLut[ 6 ];
+extern ULONG nVCLBLut[ 6 ];
+extern ULONG nVCLDitherLut[ 256 ];
+extern ULONG nVCLLut[ 256 ];
+
+// =======================================================================
+
+ULONG ImplAdjustTwoRect( TwoRect& rTwoRect, const Size& rSizePix )
+{
+ ULONG nMirrFlags = 0;
+
+ if ( rTwoRect.mnDestWidth < 0 )
+ {
+ rTwoRect.mnSrcX = rSizePix.Width() - rTwoRect.mnSrcX - rTwoRect.mnSrcWidth;
+ rTwoRect.mnDestWidth = -rTwoRect.mnDestWidth;
+ rTwoRect.mnDestX -= rTwoRect.mnDestWidth-1;
+ nMirrFlags |= BMP_MIRROR_HORZ;
+ }
+
+ if ( rTwoRect.mnDestHeight < 0 )
+ {
+ rTwoRect.mnSrcY = rSizePix.Height() - rTwoRect.mnSrcY - rTwoRect.mnSrcHeight;
+ rTwoRect.mnDestHeight = -rTwoRect.mnDestHeight;
+ rTwoRect.mnDestY -= rTwoRect.mnDestHeight-1;
+ nMirrFlags |= BMP_MIRROR_VERT;
+ }
+
+ return nMirrFlags;
+}
+
+// =======================================================================
+
+void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* pVoidPosAry )
+{
+ TwoRect* pPosAry = (TwoRect*)pVoidPosAry;
+#ifndef REMOTE_APPSERVER
+ SalGraphics* pGraphics2;
+#else
+ ImplServerGraphics* pGraphics2;
+#endif
+
+ if ( pPosAry->mnSrcWidth && pPosAry->mnSrcHeight && pPosAry->mnDestWidth && pPosAry->mnDestHeight )
+ {
+ if ( this == pSrcDev )
+ pGraphics2 = NULL;
+ else
+ {
+ if ( (GetOutDevType() != pSrcDev->GetOutDevType()) ||
+ (GetOutDevType() != OUTDEV_WINDOW) )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( !pSrcDev->mpGraphics )
+ {
+ if ( !((OutputDevice*)pSrcDev)->ImplGetGraphics() )
+ return;
+ }
+#endif
+ pGraphics2 = pSrcDev->mpGraphics;
+ }
+ else
+ {
+ if ( ((Window*)this)->mpFrameWindow == ((Window*)pSrcDev)->mpFrameWindow )
+ pGraphics2 = NULL;
+ else
+ {
+#ifndef REMOTE_APPSERVER
+ if ( !pSrcDev->mpGraphics )
+ {
+ if ( !((OutputDevice*)pSrcDev)->ImplGetGraphics() )
+ return;
+ }
+#endif
+ pGraphics2 = pSrcDev->mpGraphics;
+
+#ifndef REMOTE_APPSERVER
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+ DBG_ASSERT( mpGraphics && pSrcDev->mpGraphics,
+ "OutputDevice::DrawOutDev(): We need more than one Graphics" );
+#endif
+ }
+ }
+ }
+
+ Rectangle aSrcOutRect( Point( pSrcDev->mnOutOffX, pSrcDev->mnOutOffY ),
+ Size( pSrcDev->mnOutWidth, pSrcDev->mnOutHeight ) );
+ Rectangle aSrcRect( Point( pPosAry->mnSrcX, pPosAry->mnSrcY ),
+ Size( pPosAry->mnSrcWidth, pPosAry->mnSrcHeight ) );
+ const long nOldRight = aSrcRect.Right();
+ const long nOldBottom = aSrcRect.Bottom();
+
+ if ( !aSrcRect.Intersection( aSrcOutRect ).IsEmpty() )
+ {
+ if ( (pPosAry->mnSrcX+pPosAry->mnSrcWidth-1) > aSrcOutRect.Right() )
+ {
+ const long nOldWidth = pPosAry->mnSrcWidth;
+ pPosAry->mnSrcWidth -= (nOldRight - aSrcRect.Right());
+ pPosAry->mnDestWidth = pPosAry->mnDestWidth * pPosAry->mnSrcWidth / nOldWidth;
+ }
+
+ if ( (pPosAry->mnSrcY+pPosAry->mnSrcHeight-1) > aSrcOutRect.Bottom() )
+ {
+ const long nOldHeight = pPosAry->mnSrcHeight;
+ pPosAry->mnSrcHeight -= (nOldBottom - aSrcRect.Bottom());
+ pPosAry->mnDestHeight = pPosAry->mnDestHeight * pPosAry->mnSrcHeight / nOldHeight;
+ }
+
+ mpGraphics->CopyBits( pPosAry, pGraphics2 );
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize )
+{
+ DBG_TRACE( "OutputDevice::DrawOutDev()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
+
+ if ( meOutDevType == OUTDEV_PRINTER )
+ return;
+
+ if ( ROP_INVERT == meRasterOp )
+ {
+ DrawRect( Rectangle( rDestPt, rDestSize ) );
+ return;
+ }
+
+ if ( mpMetaFile )
+ {
+ const Bitmap aBmp( GetBitmap( rSrcPt, rSrcSize ) );
+ mpMetaFile->AddAction( new MetaBmpScaleAction( rDestPt, rDestSize, aBmp ) );
+ }
+
+ OUTDEV_INIT();
+
+ TwoRect aPosAry;
+ aPosAry.mnSrcWidth = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
+ aPosAry.mnSrcHeight = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
+ aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
+ aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+
+ if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
+ {
+ aPosAry.mnSrcX = ImplLogicXToDevicePixel( rSrcPt.X() );
+ aPosAry.mnSrcY = ImplLogicYToDevicePixel( rSrcPt.Y() );
+ aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
+ aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
+
+ Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) );
+ Rectangle aSrcRect( Point( aPosAry.mnSrcX, aPosAry.mnSrcY ),
+ Size( aPosAry.mnSrcWidth, aPosAry.mnSrcHeight ) );
+ long nOldRight = aSrcRect.Right();
+ long nOldBottom = aSrcRect.Bottom();
+
+ if ( !aSrcRect.Intersection( aSrcOutRect ).IsEmpty() )
+ {
+ if ( (aPosAry.mnSrcX+aPosAry.mnSrcWidth-1) > aSrcOutRect.Right() )
+ {
+ long nOldWidth = aPosAry.mnSrcWidth;
+ aPosAry.mnSrcWidth -= nOldRight-aSrcRect.Right();
+ aPosAry.mnDestWidth = aPosAry.mnDestWidth*aPosAry.mnSrcWidth/nOldWidth;
+ }
+
+ if ( (aPosAry.mnSrcY+aPosAry.mnSrcHeight-1) > aSrcOutRect.Bottom() )
+ {
+ long nOldHeight = aPosAry.mnSrcHeight;
+ aPosAry.mnSrcHeight -= nOldBottom-aSrcRect.Bottom();
+ aPosAry.mnDestHeight = aPosAry.mnDestHeight*aPosAry.mnSrcHeight/nOldHeight;
+ }
+
+ mpGraphics->CopyBits( &aPosAry, NULL );
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPt, const Size& rSrcSize,
+ const OutputDevice& rOutDev )
+{
+ DBG_TRACE( "OutputDevice::DrawOutDev()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rOutDev, OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
+ DBG_ASSERT( rOutDev.meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
+
+ if ( (meOutDevType == OUTDEV_PRINTER) || (rOutDev.meOutDevType == OUTDEV_PRINTER) )
+ return;
+
+ if ( ROP_INVERT == meRasterOp )
+ {
+ DrawRect( Rectangle( rDestPt, rDestSize ) );
+ return;
+ }
+
+ if ( mpMetaFile )
+ {
+ const Bitmap aBmp( rOutDev.GetBitmap( rSrcPt, rSrcSize ) );
+ mpMetaFile->AddAction( new MetaBmpScaleAction( rDestPt, rDestSize, aBmp ) );
+ }
+
+ OUTDEV_INIT();
+
+ TwoRect aPosAry;
+ aPosAry.mnSrcX = rOutDev.ImplLogicXToDevicePixel( rSrcPt.X() );
+ aPosAry.mnSrcY = rOutDev.ImplLogicYToDevicePixel( rSrcPt.Y() );
+ aPosAry.mnSrcWidth = rOutDev.ImplLogicWidthToDevicePixel( rSrcSize.Width() );
+ aPosAry.mnSrcHeight = rOutDev.ImplLogicHeightToDevicePixel( rSrcSize.Height() );
+ aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
+ aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
+ aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
+ aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+
+ ImplDrawOutDevDirect( &rOutDev, &aPosAry );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::CopyArea( const Point& rDestPt,
+ const Point& rSrcPt, const Size& rSrcSize,
+ USHORT nFlags )
+{
+ DBG_TRACE( "OutputDevice::CopyArea()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::CopyArea(...) with printer devices!" );
+
+ if ( meOutDevType == OUTDEV_PRINTER )
+ return;
+
+ RasterOp eOldRop = GetRasterOp();
+ SetRasterOp( ROP_OVERPAINT );
+
+ OUTDEV_INIT();
+
+ TwoRect aPosAry;
+ aPosAry.mnSrcWidth = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
+ aPosAry.mnSrcHeight = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
+
+ if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight )
+ {
+ aPosAry.mnSrcX = ImplLogicXToDevicePixel( rSrcPt.X() );
+ aPosAry.mnSrcY = ImplLogicYToDevicePixel( rSrcPt.Y() );
+ aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
+ aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
+
+ Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) );
+ Rectangle aSrcRect( Point( aPosAry.mnSrcX, aPosAry.mnSrcY ),
+ Size( aPosAry.mnSrcWidth, aPosAry.mnSrcHeight ) );
+ long nOldRight = aSrcRect.Right();
+ long nOldBottom = aSrcRect.Bottom();
+
+ if ( !aSrcRect.Intersection( aSrcOutRect ).IsEmpty() )
+ {
+ if ( (aPosAry.mnSrcX+aPosAry.mnSrcWidth-1) > aSrcOutRect.Right() )
+ aPosAry.mnSrcWidth -= nOldRight-aSrcRect.Right();
+
+ if ( (aPosAry.mnSrcY+aPosAry.mnSrcHeight-1) > aSrcOutRect.Bottom() )
+ aPosAry.mnSrcHeight -= nOldBottom-aSrcRect.Bottom();
+
+ if ( (meOutDevType == OUTDEV_WINDOW) && (nFlags & COPYAREA_WINDOWINVALIDATE) )
+ {
+ ((Window*)this)->ImplMoveAllInvalidateRegions( aSrcRect,
+ aPosAry.mnDestX-aPosAry.mnSrcX,
+ aPosAry.mnDestY-aPosAry.mnSrcY,
+ FALSE );
+
+#ifndef REMOTE_APPSERVER
+ mpGraphics->CopyArea( aPosAry.mnDestX, aPosAry.mnDestY,
+ aPosAry.mnSrcX, aPosAry.mnSrcY,
+ aPosAry.mnSrcWidth, aPosAry.mnSrcHeight,
+ SAL_COPYAREA_WINDOWINVALIDATE );
+#else
+ mpGraphics->CopyArea( aPosAry.mnDestX, aPosAry.mnDestY,
+ aPosAry.mnSrcX, aPosAry.mnSrcY,
+ aPosAry.mnSrcWidth, aPosAry.mnSrcHeight,
+ COPYAREA_WINDOWINVALIDATE );
+#endif
+ }
+ else
+ {
+ aPosAry.mnDestWidth = aPosAry.mnSrcWidth;
+ aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
+ mpGraphics->CopyBits( &aPosAry, NULL );
+ }
+ }
+ }
+
+ SetRasterOp( eOldRop );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::ImplDrawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
+ const OutputDevice& rOutDev, const Region& rRegion )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ BOOL bOldMap = mbMap;
+ RasterOp eOldROP = GetRasterOp();
+ mpMetaFile = NULL;
+ mbMap = FALSE;
+ SetRasterOp( ROP_OVERPAINT );
+
+#ifndef REMOTE_APPSERVER
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+#else
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+#endif
+
+ // ClipRegion zuruecksetzen
+#ifndef REMOTE_APPSERVER
+ if ( rRegion.IsNull() )
+ mpGraphics->ResetClipRegion();
+ else
+ ImplSelectClipRegion( mpGraphics, rRegion );
+#else
+ if ( rRegion.IsNull() )
+ mpGraphics->SetClipRegion();
+ else
+ mpGraphics->SetClipRegion( rRegion );
+#endif
+
+ TwoRect aPosAry;
+ aPosAry.mnSrcX = rDevPt.X();
+ aPosAry.mnSrcY = rDevPt.Y();
+ aPosAry.mnSrcWidth = rDevSize.Width();
+ aPosAry.mnSrcHeight = rDevSize.Height();
+ aPosAry.mnDestX = rPt.X();
+ aPosAry.mnDestY = rPt.Y();
+ aPosAry.mnDestWidth = rDevSize.Width();
+ aPosAry.mnDestHeight = rDevSize.Height();
+ ImplDrawOutDevDirect( &rOutDev, &aPosAry );
+
+ // Dafuer sorgen, das ClipRegion neu berechnet und gesetzt wird
+ mbInitClipRegion = TRUE;
+
+ SetRasterOp( eOldROP );
+ mbMap = bOldMap;
+ mpMetaFile = pOldMetaFile;
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
+ OutputDevice& rDev )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ BOOL bOldMap = mbMap;
+ mbMap = FALSE;
+ rDev.DrawOutDev( rDevPt, rDevSize, rPt, rDevSize, *this );
+ mbMap = bOldMap;
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap )
+{
+ DBG_TRACE( "OutputDevice::DrawBitmap()" );
+ const Size aSizePix( rBitmap.GetSizePixel() );
+ ImplDrawBitmap( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, META_BMP_ACTION );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap )
+{
+ DBG_TRACE( "OutputDevice::DrawBitmap( Size )" );
+ ImplDrawBitmap( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, META_BMPSCALE_ACTION );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const Bitmap& rBitmap )
+{
+ DBG_TRACE( "OutputDevice::DrawBitmap( Point, Size )" );
+ ImplDrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmap, META_BMPSCALEPART_ACTION );
+}
+
+// -----------------------------------------------------------------------------
+
+void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const Bitmap& rBitmap, const ULONG nAction )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Bitmap aBmp( rBitmap );
+
+ if ( ( mnDrawMode & DRAWMODE_NOBITMAP ) )
+ return;
+ else if ( ROP_INVERT == meRasterOp )
+ {
+ DrawRect( Rectangle( rDestPt, rDestSize ) );
+ return;
+ }
+ else if ( mnDrawMode & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP |
+ DRAWMODE_GRAYBITMAP | DRAWMODE_GHOSTEDBITMAP ) )
+ {
+ if ( mnDrawMode & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP ) )
+ {
+ BYTE cCmpVal;
+
+ if ( mnDrawMode & DRAWMODE_BLACKBITMAP )
+ cCmpVal = ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP ) ? 0x80 : 0;
+ else
+ cCmpVal = 255;
+
+ Color aCol( cCmpVal, cCmpVal, cCmpVal );
+ Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ SetLineColor( aCol );
+ SetFillColor( aCol );
+ DrawRect( Rectangle( rDestPt, rDestSize ) );
+ Pop();
+ return;
+ }
+ else if( !!aBmp )
+ {
+ if ( mnDrawMode & DRAWMODE_GRAYBITMAP )
+ aBmp.Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ if ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP )
+ aBmp.Convert( BMP_CONVERSION_GHOSTED );
+ }
+ }
+
+ if ( mpMetaFile )
+ {
+ switch( nAction )
+ {
+ case( META_BMP_ACTION ):
+ mpMetaFile->AddAction( new MetaBmpAction( rDestPt, aBmp ) );
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ mpMetaFile->AddAction( new MetaBmpScaleAction( rDestPt, rDestSize, aBmp ) );
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ mpMetaFile->AddAction( new MetaBmpScalePartAction(
+ rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, aBmp ) );
+ break;
+ }
+ }
+
+ OUTDEV_INIT();
+
+ if( ( OUTDEV_PRINTER == meOutDevType ) && mbClipRegion && ( REGION_COMPLEX == maRegion.GetType() ) )
+ {
+ Bitmap aMask;
+ ImplPrintTransparent( aBmp, aMask, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
+ return;
+ }
+
+ if ( !( !aBmp ) )
+ {
+ TwoRect aPosAry;
+
+ aPosAry.mnSrcX = rSrcPtPixel.X();
+ aPosAry.mnSrcY = rSrcPtPixel.Y();
+ aPosAry.mnSrcWidth = rSrcSizePixel.Width();
+ aPosAry.mnSrcHeight = rSrcSizePixel.Height();
+ aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
+ aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
+ aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
+ aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+
+ const ULONG nMirrFlags = ImplAdjustTwoRect( aPosAry, aBmp.GetSizePixel() );
+
+ if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
+ {
+ if ( nMirrFlags )
+ aBmp.Mirror( nMirrFlags );
+
+#ifndef REMOTE_APPSERVER
+ mpGraphics->DrawBitmap( &aPosAry, *aBmp.ImplGetImpBitmap()->ImplGetSalBitmap() );
+#else
+ aBmp.ImplDrawRemote( this,
+ Point( aPosAry.mnSrcX, aPosAry.mnSrcY ),
+ Size( aPosAry.mnSrcWidth, aPosAry.mnSrcHeight ),
+ Point( aPosAry.mnDestX, aPosAry.mnDestY ),
+ Size( aPosAry.mnDestWidth, aPosAry.mnDestHeight ) );
+#endif
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawBitmapEx( const Point& rDestPt,
+ const BitmapEx& rBitmapEx )
+{
+ DBG_TRACE( "OutputDevice::DrawBitmapEx()" );
+
+ if( TRANSPARENT_NONE == rBitmapEx.GetTransparentType() )
+ DrawBitmap( rDestPt, rBitmapEx.GetBitmap() );
+ else
+ {
+ const Size aSizePix( rBitmapEx.GetSizePixel() );
+ ImplDrawBitmapEx( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmapEx, META_BMPEX_ACTION );
+ }
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
+ const BitmapEx& rBitmapEx )
+{
+ DBG_TRACE( "OutputDevice::DrawBitmapEx( Size )" );
+
+ if ( TRANSPARENT_NONE == rBitmapEx.GetTransparentType() )
+ DrawBitmap( rDestPt, rDestSize, rBitmapEx.GetBitmap() );
+ else
+ ImplDrawBitmapEx( rDestPt, rDestSize, Point(), rBitmapEx.GetSizePixel(), rBitmapEx, META_BMPEXSCALE_ACTION );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const BitmapEx& rBitmapEx )
+{
+ DBG_TRACE( "OutputDevice::DrawBitmapEx( Point, Size )" );
+
+ if( TRANSPARENT_NONE == rBitmapEx.GetTransparentType() )
+ DrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmapEx.GetBitmap() );
+ else
+ ImplDrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmapEx, META_BMPEXSCALEPART_ACTION );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const BitmapEx& rBitmapEx, const ULONG nAction )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ BitmapEx aBmpEx( rBitmapEx );
+
+ if ( mnDrawMode & DRAWMODE_NOBITMAP )
+ return;
+ else if ( ROP_INVERT == meRasterOp )
+ {
+ DrawRect( Rectangle( rDestPt, rDestSize ) );
+ return;
+ }
+ else if ( mnDrawMode & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP |
+ DRAWMODE_GRAYBITMAP | DRAWMODE_GHOSTEDBITMAP ) )
+ {
+ if ( mnDrawMode & ( DRAWMODE_BLACKBITMAP | DRAWMODE_WHITEBITMAP ) )
+ {
+ Bitmap aColorBmp( aBmpEx.GetSizePixel(), ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP ) ? 4 : 1 );
+ BYTE cCmpVal;
+
+ if ( mnDrawMode & DRAWMODE_BLACKBITMAP )
+ cCmpVal = ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP ) ? 0x80 : 0;
+ else
+ cCmpVal = 255;
+
+ aColorBmp.Erase( Color( cCmpVal, cCmpVal, cCmpVal ) );
+
+ if( aBmpEx.IsAlpha() )
+ aBmpEx = BitmapEx( aColorBmp, aBmpEx.GetAlpha() );
+ else
+ aBmpEx = BitmapEx( aColorBmp, aBmpEx.GetMask() );
+ }
+ else if( !!aBmpEx )
+ {
+ if ( mnDrawMode & DRAWMODE_GRAYBITMAP )
+ aBmpEx.Convert( BMP_CONVERSION_8BIT_GREYS );
+
+ if ( mnDrawMode & DRAWMODE_GHOSTEDBITMAP )
+ aBmpEx.Convert( BMP_CONVERSION_GHOSTED );
+ }
+ }
+
+ if ( mpMetaFile )
+ {
+ switch( nAction )
+ {
+ case( META_BMPEX_ACTION ):
+ mpMetaFile->AddAction( new MetaBmpExAction( rDestPt, aBmpEx ) );
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ mpMetaFile->AddAction( new MetaBmpExScaleAction( rDestPt, rDestSize, aBmpEx ) );
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ mpMetaFile->AddAction( new MetaBmpExScalePartAction( rDestPt, rDestSize,
+ rSrcPtPixel, rSrcSizePixel, aBmpEx ) );
+ break;
+ }
+ }
+
+ OUTDEV_INIT();
+
+ if( OUTDEV_PRINTER == meOutDevType )
+ {
+ Bitmap aBmp( aBmpEx.GetBitmap() ), aMask( aBmpEx.GetMask() );
+ aBmp.Replace( aMask, Color( COL_WHITE ) );
+ ImplPrintTransparent( aBmp, aMask, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
+ return;
+ }
+#ifndef REMOTE_APPSERVER
+ else if( rBitmapEx.IsAlpha() )
+ {
+ ImplDrawAlpha( aBmpEx.GetBitmap(), aBmpEx.GetAlpha(), rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
+ return;
+ }
+#endif
+
+ if( !( !aBmpEx ) )
+ {
+ TwoRect aPosAry;
+
+ aPosAry.mnSrcX = rSrcPtPixel.X();
+ aPosAry.mnSrcY = rSrcPtPixel.Y();
+ aPosAry.mnSrcWidth = rSrcSizePixel.Width();
+ aPosAry.mnSrcHeight = rSrcSizePixel.Height();
+ aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
+ aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
+ aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
+ aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+
+ const ULONG nMirrFlags = ImplAdjustTwoRect( aPosAry, aBmpEx.GetSizePixel() );
+
+ if( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
+ {
+#ifndef REMOTE_APPSERVER
+
+ if( nMirrFlags )
+ aBmpEx.Mirror( nMirrFlags );
+
+ const ImpBitmap* pImpBmp = aBmpEx.ImplGetBitmapImpBitmap();
+ const ImpBitmap* pMaskBmp = aBmpEx.ImplGetMaskImpBitmap();
+
+ if ( pMaskBmp )
+ mpGraphics->DrawBitmap( &aPosAry, *pImpBmp->ImplGetSalBitmap(), *pMaskBmp->ImplGetSalBitmap() );
+ else
+ mpGraphics->DrawBitmap( &aPosAry, *pImpBmp->ImplGetSalBitmap() );
+
+#else
+
+ if( nMirrFlags )
+ aBmpEx.Mirror( nMirrFlags );
+
+ aBmpEx.ImplDrawRemote( this,
+ Point( aPosAry.mnSrcX, aPosAry.mnSrcY ),
+ Size( aPosAry.mnSrcWidth, aPosAry.mnSrcHeight ),
+ Point( aPosAry.mnDestX, aPosAry.mnDestY ),
+ Size( aPosAry.mnDestWidth, aPosAry.mnDestHeight ) );
+
+#endif
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawMask( const Point& rDestPt,
+ const Bitmap& rBitmap, const Color& rMaskColor )
+{
+ DBG_TRACE( "OutputDevice::DrawMask()" );
+ const Size aSizePix( rBitmap.GetSizePixel() );
+ ImplDrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, META_MASK_ACTION );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
+ const Bitmap& rBitmap, const Color& rMaskColor )
+{
+ DBG_TRACE( "OutputDevice::DrawMask( Size )" );
+ ImplDrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, META_MASKSCALE_ACTION );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const Bitmap& rBitmap, const Color& rMaskColor )
+{
+ DBG_TRACE( "OutputDevice::DrawMask( Point, Size )" );
+ ImplDrawMask( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmap, rMaskColor, META_MASKSCALEPART_ACTION );
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::ImplDrawMask( const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel,
+ const Bitmap& rBitmap, const Color& rMaskColor,
+ const ULONG nAction )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if( ROP_INVERT == meRasterOp )
+ {
+ DrawRect( Rectangle( rDestPt, rDestSize ) );
+ return;
+ }
+
+ if ( mpMetaFile )
+ {
+ switch( nAction )
+ {
+ case( META_MASK_ACTION ):
+ mpMetaFile->AddAction( new MetaMaskAction( rDestPt,
+ rBitmap, rMaskColor ) );
+ break;
+
+ case( META_MASKSCALE_ACTION ):
+ mpMetaFile->AddAction( new MetaMaskScaleAction( rDestPt,
+ rDestSize, rBitmap, rMaskColor ) );
+ break;
+
+ case( META_MASKSCALEPART_ACTION ):
+ mpMetaFile->AddAction( new MetaMaskScalePartAction( rDestPt, rDestSize,
+ rSrcPtPixel, rSrcSizePixel, rBitmap, rMaskColor ) );
+ break;
+ }
+ }
+
+ OUTDEV_INIT();
+
+#ifndef REMOTE_APPSERVER
+ if ( OUTDEV_PRINTER == meOutDevType )
+ {
+ ImplPrintMask( rBitmap, rMaskColor, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
+ return;
+ }
+#endif
+
+ const ImpBitmap* pImpBmp = rBitmap.ImplGetImpBitmap();
+
+ if ( pImpBmp )
+ {
+ TwoRect aPosAry;
+
+ aPosAry.mnSrcX = rSrcPtPixel.X();
+ aPosAry.mnSrcY = rSrcPtPixel.Y();
+ aPosAry.mnSrcWidth = rSrcSizePixel.Width();
+ aPosAry.mnSrcHeight = rSrcSizePixel.Height();
+ aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
+ aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
+ aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
+ aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+
+ // spiegeln via Koordinaten wollen wir nicht
+ const ULONG nMirrFlags = ImplAdjustTwoRect( aPosAry, pImpBmp->ImplGetSize() );
+
+ // check if output is necessary
+ if( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
+ {
+#ifndef REMOTE_APPSERVER
+
+ if( nMirrFlags )
+ {
+ Bitmap aTmp( rBitmap );
+ aTmp.Mirror( nMirrFlags );
+ mpGraphics->DrawMask( &aPosAry, *aTmp.ImplGetImpBitmap()->ImplGetSalBitmap(),
+ ImplColorToSal( rMaskColor ) );
+ }
+ else
+ mpGraphics->DrawMask( &aPosAry, *pImpBmp->ImplGetSalBitmap(),
+ ImplColorToSal( rMaskColor ) );
+
+#else
+
+ if( nMirrFlags )
+ {
+ Bitmap aTmp( rBitmap );
+ aTmp.Mirror( nMirrFlags );
+ aTmp.ImplDrawRemoteMask( this,
+ Point( aPosAry.mnSrcX, aPosAry.mnSrcY ),
+ Size( aPosAry.mnSrcWidth, aPosAry.mnSrcHeight ),
+ Point( aPosAry.mnDestX, aPosAry.mnDestY ),
+ Size( aPosAry.mnDestWidth, aPosAry.mnDestHeight ),
+ rMaskColor );
+ }
+ else
+ rBitmap.ImplDrawRemoteMask( this,
+ Point( aPosAry.mnSrcX, aPosAry.mnSrcY ),
+ Size( aPosAry.mnSrcWidth, aPosAry.mnSrcHeight ),
+ Point( aPosAry.mnDestX, aPosAry.mnDestY ),
+ Size( aPosAry.mnDestWidth, aPosAry.mnDestHeight ),
+ rMaskColor );
+
+#endif
+ }
+ }
+}
+
+// ------------------------------------------------------------------
+
+Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Bitmap aBmp;
+ long nX = ImplLogicXToDevicePixel( rSrcPt.X() );
+ long nY = ImplLogicYToDevicePixel( rSrcPt.Y() );
+ long nWidth = ImplLogicWidthToDevicePixel( rSize.Width() );
+ long nHeight = ImplLogicHeightToDevicePixel( rSize.Height() );
+
+#ifndef REMOTE_APPSERVER
+ if ( mpGraphics || ( (OutputDevice*) this )->ImplGetGraphics() )
+#endif
+ {
+ if ( nWidth && nHeight )
+ {
+#ifndef REMOTE_APPSERVER
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ BOOL bClipped = FALSE;
+
+ // X-Koordinate ausserhalb des Bereichs?
+ if ( nX < mnOutOffX )
+ {
+ nWidth -= ( mnOutOffX - nX );
+ nX = mnOutOffX;
+ bClipped = TRUE;
+ }
+
+ // Y-Koordinate ausserhalb des Bereichs?
+ if ( nY < mnOutOffY )
+ {
+ nHeight -= ( mnOutOffY - nY );
+ nY = mnOutOffY;
+ bClipped = TRUE;
+ }
+
+ // Breite ausserhalb des Bereichs?
+ if ( (nWidth + nX) > (mnOutWidth + mnOutOffX) )
+ {
+ nWidth = mnOutOffX + mnOutWidth - nX;
+ bClipped = TRUE;
+ }
+
+ // Hoehe ausserhalb des Bereichs?
+ if ( (nHeight + nY) > (mnOutHeight + mnOutOffY) )
+ {
+ nHeight = mnOutOffY + mnOutHeight - nY;
+ bClipped = TRUE;
+ }
+
+ if ( bClipped )
+ {
+ // Falls auf den sichtbaren Bereich geclipped wurde,
+ // muessen wir eine Bitmap in der rchtigen Groesse
+ // erzeugen, in die die geclippte Bitmap an die angepasste
+ // Position kopiert wird
+ VirtualDevice aVDev( *this );
+
+ if ( aVDev.SetOutputSizePixel( aRect.GetSize() ) )
+ {
+ if ( ((OutputDevice*)&aVDev)->mpGraphics || ((OutputDevice*)&aVDev)->ImplGetGraphics() )
+ {
+ TwoRect aPosAry;
+
+ aPosAry.mnSrcX = nX;
+ aPosAry.mnSrcY = nY;
+ aPosAry.mnSrcWidth = nWidth;
+ aPosAry.mnSrcHeight = nHeight;
+ aPosAry.mnDestX = ( aRect.Left() < mnOutOffX ) ? ( mnOutOffX - aRect.Left() ) : 0L;
+ aPosAry.mnDestY = ( aRect.Top() < mnOutOffY ) ? ( mnOutOffY - aRect.Top() ) : 0L;
+ aPosAry.mnDestWidth = nWidth;
+ aPosAry.mnDestHeight = nHeight;
+
+ if ( (nWidth > 0) && (nHeight > 0) )
+ (((OutputDevice*)&aVDev)->mpGraphics)->CopyBits( &aPosAry, mpGraphics );
+
+ aBmp = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
+ }
+ else
+ bClipped = FALSE;
+ }
+ else
+ bClipped = FALSE;
+ }
+
+ if ( !bClipped )
+ {
+ SalBitmap* pSalBmp = mpGraphics->GetBitmap( nX, nY, nWidth, nHeight );
+
+ if( pSalBmp )
+ {
+ ImpBitmap* pImpBmp = new ImpBitmap;
+ pImpBmp->ImplSetSalBitmap( pSalBmp );
+ aBmp.ImplSetImpBitmap( pImpBmp );
+ }
+ }
+#else
+ aBmp.ImplGetRemoteBmp( (OutputDevice*) this, Point( nX, nY ), Size( nWidth, nHeight ) );
+#endif
+ }
+ }
+
+ return aBmp;
+}
+
+// ------------------------------------------------------------------
+
+void OutputDevice::ImplGetFrameBitmap( const Point& rDestPt, const Size& rSize,
+ Bitmap& rBitmap ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ BOOL bOldMap = mbMap;
+ ((OutputDevice*)this)->mbMap = FALSE;
+ rBitmap = GetBitmap( rDestPt, rSize );
+ ((OutputDevice*)this)->mbMap = bOldMap;
+}
+
+// ------------------------------------------------------------------
+
+Color OutputDevice::GetPixel( const Point& rPt ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor;
+
+#ifndef REMOTE_APPSERVER
+ if ( mpGraphics || ((OutputDevice*)this)->ImplGetGraphics() )
+ {
+ if ( mbInitClipRegion )
+ ((OutputDevice*)this)->ImplInitClipRegion();
+
+ if ( !mbOutputClipped )
+ {
+ const long nX = ImplLogicXToDevicePixel( rPt.X() );
+ const long nY = ImplLogicYToDevicePixel( rPt.Y() );
+ const SalColor aSalCol = mpGraphics->GetPixel( nX, nY );
+ aColor.SetRed( SALCOLOR_RED( aSalCol ) );
+ aColor.SetGreen( SALCOLOR_GREEN( aSalCol ) );
+ aColor.SetBlue( SALCOLOR_BLUE( aSalCol ) );
+ }
+ }
+#else // REMOTE_APPSERVER
+ ImplServerGraphics* pGraphics = ( (OutputDevice*) this )->ImplGetServerGraphics();
+ if( pGraphics )
+ {
+ const long nX = ImplLogicXToDevicePixel( rPt.X() );
+ const long nY = ImplLogicYToDevicePixel( rPt.Y() );
+ aColor = pGraphics->GetPixel( Point( nX, nY ) );
+ }
+#endif // REMOTE_APPSERVER
+
+ return aColor;
+}
+
+// ------------------------------------------------------------------
+
+Color* OutputDevice::GetPixel( const Polygon& rPts ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color* pColors = NULL;
+ const USHORT nSize = rPts.GetSize();
+
+ if( nSize )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( mpGraphics || ((OutputDevice*)this)->ImplGetGraphics() )
+ {
+ if ( mbInitClipRegion )
+ ((OutputDevice*)this)->ImplInitClipRegion();
+
+ if ( !mbOutputClipped )
+ {
+ pColors = new Color[ nSize ];
+
+ for( USHORT i = 0; i < nSize; i++ )
+ {
+ Color& rCol = pColors[ i ];
+ const Point& rPt = rPts[ i ];
+ const SalColor aSalCol( mpGraphics->GetPixel( ImplLogicXToDevicePixel( rPt.X() ),
+ ImplLogicYToDevicePixel( rPt.Y() ) ) );
+
+ rCol.SetRed( SALCOLOR_RED( aSalCol ) );
+ rCol.SetGreen( SALCOLOR_GREEN( aSalCol ) );
+ rCol.SetBlue( SALCOLOR_BLUE( aSalCol ) );
+ }
+ }
+ }
+#else // REMOTE_APPSERVER
+ ImplServerGraphics* pGraphics = ( (OutputDevice*) this )->ImplGetServerGraphics();
+ if( pGraphics )
+ {
+ pColors = pGraphics->GetPixel( ImplLogicToDevicePixel( rPts ) );
+ }
+#endif // REMOTE_APPSERVER
+ }
+
+ return pColors;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPixel( const Point& rPt )
+{
+ DBG_TRACE( "OutputDevice::DrawPixel()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPointAction( rPt ) );
+
+ if ( !IsDeviceOutputNecessary() || !mbLineColor )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ Point aPt = ImplLogicToDevicePixel( rPt );
+
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ mpGraphics->DrawPixel( aPt.X(), aPt.Y() );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ pGraphics->DrawPixel( ImplLogicToDevicePixel( rPt ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
+{
+ DBG_TRACE( "OutputDevice::DrawPixel()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor( rColor );
+
+ if( mnDrawMode & ( DRAWMODE_BLACKLINE | DRAWMODE_WHITELINE |
+ DRAWMODE_GRAYLINE | DRAWMODE_GHOSTEDLINE ) )
+ {
+ if( !ImplIsColorTransparent( aColor ) )
+ {
+ if( mnDrawMode & DRAWMODE_BLACKLINE )
+ {
+ aColor = Color( COL_BLACK );
+ }
+ else if( mnDrawMode & DRAWMODE_WHITELINE )
+ {
+ aColor = Color( COL_WHITE );
+ }
+ else if( mnDrawMode & DRAWMODE_GRAYLINE )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+
+ if( mnDrawMode & DRAWMODE_GHOSTEDLINE )
+ {
+ aColor = Color( ( aColor.GetRed() >> 1 ) | 0x80,
+ ( aColor.GetGreen() >> 1 ) | 0x80,
+ ( aColor.GetBlue() >> 1 ) | 0x80 );
+ }
+ }
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPixelAction( rPt, aColor ) );
+
+ if ( !IsDeviceOutputNecessary() || ImplIsColorTransparent( aColor ) )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ Point aPt = ImplLogicToDevicePixel( rPt );
+
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( aColor ) );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ pGraphics->DrawPixel( ImplLogicToDevicePixel( rPt ), aColor );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors )
+{
+ if ( !pColors )
+ DrawPixel( rPts, GetLineColor() );
+ else
+ {
+ DBG_TRACE( "OutputDevice::DrawPixel()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_ASSERT( pColors, "OutputDevice::DrawPixel: No color array specified" );
+
+ const USHORT nSize = rPts.GetSize();
+
+ if ( nSize )
+ {
+ if ( mpMetaFile )
+ for ( USHORT i = 0; i < nSize; i++ )
+ mpMetaFile->AddAction( new MetaPixelAction( rPts[ i ], pColors[ i ] ) );
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( mpGraphics || ImplGetGraphics() )
+ {
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( mbOutputClipped )
+ return;
+
+ for ( USHORT i = 0; i < nSize; i++ )
+ {
+ const Point aPt( ImplLogicToDevicePixel( rPts[ i ] ) );
+ mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( pColors[ i ] ) );
+ }
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ pGraphics->DrawPixel( ImplLogicToDevicePixel( rPts ), pColors );
+ }
+#endif
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPixel( const Polygon& rPts, const Color& rColor )
+{
+ if( rColor != COL_TRANSPARENT )
+ {
+ const USHORT nSize = rPts.GetSize();
+ Color* pColArray = new Color[ nSize ];
+
+ for( USHORT i = 0; i < nSize; i++ )
+ pColArray[ i ] = rColor;
+
+ DrawPixel( rPts, pColArray );
+ delete[] pColArray;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel )
+{
+ Point aPt;
+ Point aOutPt( LogicToPixel( rDestPt ) );
+ Size aOutSz( LogicToPixel( rDestSize ) );
+ Rectangle aDstRect( aPt, GetOutputSizePixel() );
+ const BOOL bHMirr = aOutSz.Width() < 0, bVMirr = aOutSz.Height() < 0;
+
+ if( OUTDEV_WINDOW == meOutDevType )
+ {
+ const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
+
+ if( !aPaintRgn.IsNull() )
+ aDstRect.Intersection( LogicToPixel( aPaintRgn.GetBoundRect() ) );
+ }
+
+ if( bHMirr )
+ {
+ aOutSz.Width() = -aOutSz.Width();
+ aOutPt.X() -= ( aOutSz.Width() - 1L );
+ }
+
+ if( bVMirr )
+ {
+ aOutSz.Height() = -aOutSz.Height();
+ aOutPt.Y() -= ( aOutSz.Height() - 1L );
+ }
+
+ if( !aDstRect.Intersection( Rectangle( aOutPt, aOutSz ) ).IsEmpty() )
+ {
+ Rectangle aBmpRect( aPt, rBmp.GetSizePixel() );
+
+ if( !aBmpRect.Intersection( Rectangle( rSrcPtPixel, rSrcSizePixel ) ).IsEmpty() )
+ {
+ GDIMetaFile* pOldMetaFile = mpMetaFile; mpMetaFile = NULL;
+ const BOOL bOldMap = mbMap; mbMap = FALSE;
+ Bitmap aBmp( GetBitmap( aDstRect.TopLeft(), aDstRect.GetSize() ) );
+ BitmapColor aDstCol;
+ const long nSrcWidth = aBmpRect.GetWidth(), nSrcHeight = aBmpRect.GetHeight();
+ const long nDstWidth = aDstRect.GetWidth(), nDstHeight = aDstRect.GetHeight();
+ const long nOutWidth = aOutSz.Width(), nOutHeight = aOutSz.Height();
+ const long nOffX = aDstRect.Left() - aOutPt.X(), nOffY = aDstRect.Top() - aOutPt.Y();
+ long nX, nOutX, nY, nOutY, nMirrOffX, nMirrOffY;
+ long* pMapX = new long[ nDstWidth ];
+ long* pMapY = new long[ nDstHeight ];
+
+ // create horizontal mapping table
+ if( bHMirr )
+ nMirrOffX = ( aBmpRect.Left() << 1 ) + nSrcWidth - 1;
+
+ for( nX = 0L, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
+ {
+ pMapX[ nX ] = aBmpRect.Left() + nOutX * nSrcWidth / nOutWidth;
+
+ if( bHMirr )
+ pMapX[ nX ] = nMirrOffX - pMapX[ nX ];
+ }
+
+ // create vertical mapping table
+ if( bVMirr )
+ nMirrOffY = ( aBmpRect.Top() << 1 ) + nSrcHeight - 1;
+
+ for( nY = 0L, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
+ {
+ pMapY[ nY ] = aBmpRect.Top() + nOutY * nSrcHeight / nOutHeight;
+
+ if( bVMirr )
+ pMapY[ nY ] = nMirrOffY - pMapY[ nY ];
+ }
+
+ if( GetBitCount() <= 8 )
+ {
+ Bitmap aDither( aBmp.GetSizePixel(), 8 );
+ BitmapColor aIndex( 0 );
+ BitmapReadAccess* pP = ( (Bitmap&) rBmp ).AcquireReadAccess();
+ BitmapReadAccess* pA = ( (AlphaMask&) rAlpha ).AcquireReadAccess();
+ BitmapReadAccess* pB = aBmp.AcquireReadAccess();
+ BitmapWriteAccess* pW = aDither.AcquireWriteAccess();
+
+ if( pB && pP && pA && pW )
+ {
+ for( nY = 0, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
+ {
+ const long nMapY = pMapY[ nY ];
+ const long nModY = ( nOutY & 0x0FL ) << 4L;
+
+ for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
+ {
+ const long nMapX = pMapX[ nX ];
+ const ULONG nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ];
+
+ aDstCol = pB->GetColor( nY, nX );
+ aDstCol.Merge( pP->GetColor( nMapY, nMapX ), (BYTE) pA->GetPixel( nMapY, nMapX ) );
+ aIndex.SetIndex( (BYTE) ( nVCLRLut[ ( nVCLLut[ aDstCol.GetRed() ] + nD ) >> 16UL ] +
+ nVCLGLut[ ( nVCLLut[ aDstCol.GetGreen() ] + nD ) >> 16UL ] +
+ nVCLBLut[ ( nVCLLut[ aDstCol.GetBlue() ] + nD ) >> 16UL ] ) );
+ pW->SetPixel( nY, nX, aIndex );
+ }
+ }
+ }
+
+ ( (Bitmap&) rBmp ).ReleaseAccess( pP );
+ ( (AlphaMask&) rAlpha ).ReleaseAccess( pA );
+ aBmp.ReleaseAccess( pB );
+ aDither.ReleaseAccess( pW );
+ DrawBitmap( aDstRect.TopLeft(), aDither );
+ }
+ else
+ {
+ BitmapReadAccess* pP = ( (Bitmap&) rBmp ).AcquireReadAccess();
+ BitmapReadAccess* pA = ( (AlphaMask&) rAlpha ).AcquireReadAccess();
+ BitmapWriteAccess* pB = aBmp.AcquireWriteAccess();
+
+ if( pP && pA && pB )
+ {
+ if( pA->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ {
+ switch( pP->GetScanlineFormat() )
+ {
+ case( BMP_FORMAT_8BIT_PAL ):
+ {
+ for( nY = 0; nY < nDstHeight; nY++ )
+ {
+ const long nMapY = pMapY[ nY ];
+ Scanline pPScan = pP->GetScanline( nMapY );
+ Scanline pAScan = pA->GetScanline( nMapY );
+
+ for( nX = 0; nX < nDstWidth; nX++ )
+ {
+ const long nMapX = pMapX[ nX ];
+ aDstCol = pB->GetPixel( nY, nX );
+ pB->SetPixel( nY, nX, aDstCol.Merge( pP->GetPaletteColor( pPScan[ nMapX ] ),
+ pAScan[ nMapX ] ) );
+ }
+ }
+ }
+ break;
+
+ case( BMP_FORMAT_24BIT_TC_BGR ):
+ {
+ for( nY = 0; nY < nDstHeight; nY++ )
+ {
+ const long nMapY = pMapY[ nY ];
+ Scanline pPScan = pP->GetScanline( nMapY );
+ Scanline pAScan = pA->GetScanline( nMapY );
+
+ for( nX = 0; nX < nDstWidth; nX++ )
+ {
+ const long nMapX = pMapX[ nX ];
+ Scanline pTmp = pPScan + nMapX * 3;
+
+ aDstCol = pB->GetPixel( nY, nX );
+ pB->SetPixel( nY, nX, aDstCol.Merge( pTmp[ 2 ], pTmp[ 1 ], pTmp[ 0 ],
+ pAScan[ nMapX ] ) );
+ }
+ }
+ }
+ break;
+
+ case( BMP_FORMAT_24BIT_TC_RGB ):
+ {
+ for( nY = 0; nY < nDstHeight; nY++ )
+ {
+ const long nMapY = pMapY[ nY ];
+ Scanline pPScan = pP->GetScanline( nMapY );
+ Scanline pAScan = pA->GetScanline( nMapY );
+
+ for( nX = 0; nX < nDstWidth; nX++ )
+ {
+ const long nMapX = pMapX[ nX ];
+ Scanline pTmp = pPScan + nMapX * 3;
+
+ aDstCol = pB->GetPixel( nY, nX );
+ pB->SetPixel( nY, nX, aDstCol.Merge( pTmp[ 0 ], pTmp[ 1 ], pTmp[ 2 ],
+ pAScan[ nMapX ] ) );
+ }
+ }
+ }
+ break;
+
+ default:
+ {
+ for( nY = 0; nY < nDstHeight; nY++ )
+ {
+ const long nMapY = pMapY[ nY ];
+ Scanline pAScan = pA->GetScanline( nMapY );
+
+ for( nX = 0; nX < nDstWidth; nX++ )
+ {
+ const long nMapX = pMapX[ nX ];
+ aDstCol = pB->GetPixel( nY, nX );
+ pB->SetPixel( nY, nX, aDstCol.Merge( pP->GetColor( nMapY, nMapX ),
+ pAScan[ nMapX ] ) );
+ }
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ for( nY = 0; nY < nDstHeight; nY++ )
+ {
+ const long nMapY = pMapY[ nY ];
+
+ for( nX = 0; nX < nDstWidth; nX++ )
+ {
+ const long nMapX = pMapX[ nX ];
+ aDstCol = pB->GetPixel( nY, nX );
+ pB->SetPixel( nY, nX, aDstCol.Merge( pP->GetColor( nMapY, nMapX ),
+ (BYTE) pA->GetPixel( nMapY, nMapX ) ) );
+ }
+ }
+ }
+ }
+
+ ( (Bitmap&) rBmp ).ReleaseAccess( pP );
+ ( (AlphaMask&) rAlpha ).ReleaseAccess( pA );
+ aBmp.ReleaseAccess( pB );
+ DrawBitmap( aDstRect.TopLeft(), aBmp );
+ }
+
+ delete[] pMapX;
+ delete[] pMapY;
+ mbMap = bOldMap;
+ mpMetaFile = pOldMetaFile;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+static Pair* ImplGetMap( long nFromSize, long nToSize )
+{
+ DBG_ASSERT( nFromSize && nToSize, "ImplGetMap(): Invalid size!" );
+
+ Pair* pMap = new Pair[ nFromSize ];
+ const double fSize = (double) nToSize / nFromSize;
+ double fRealSum = 0.0;
+ const long nLastToPos = nToSize - 1L;
+ long nErrSum = 0L, nPos = 0L, nSize = 0L;
+
+ for( long i = 0L; i < nFromSize; i++ )
+ {
+ nPos = nPos + nSize;
+ nSize = Max( FRound( fSize - ( nErrSum - fRealSum ) ), 0L );
+
+ nErrSum += nSize;
+ fRealSum += fSize;
+
+ pMap[ i ].A() = nPos = Min( nPos, nLastToPos );
+ pMap[ i ].B() = Min( nPos + Max( nSize, 1L ) - 1L, nLastToPos );
+ }
+
+ return pMap;
+}
+
+// ------------------------------------------------------------------------
+
+static BOOL ImplCreateBandBitmaps( BitmapReadAccess* pPAcc, BitmapReadAccess* pMAcc,
+ long* pMapX, long* pMapY,
+ long nDstWidth, long nDstY1, long nDstY2,
+ Bitmap& rPaint, Bitmap& rMask )
+{
+ const Size aSz( nDstWidth, nDstY2 - nDstY1 + 1 );
+ BOOL bRet = FALSE;
+
+ rPaint = Bitmap( aSz, pPAcc->GetBitCount(), pPAcc->HasPalette() ? &pPAcc->GetPalette() : NULL );
+ rMask = Bitmap( aSz, pMAcc->GetBitCount(), pMAcc->HasPalette() ? &pMAcc->GetPalette() : NULL );
+
+ BitmapWriteAccess* pWPAcc = rPaint.AcquireWriteAccess();
+ BitmapWriteAccess* pWMAcc = rMask.AcquireWriteAccess();
+
+ if( pWPAcc && pWMAcc )
+ {
+ const long nWidth = pWPAcc->Width();
+ const long nHeight = pWPAcc->Width();
+ const long nPScanSize = pWPAcc->GetScanlineSize();
+ const long nMScanSize = pWMAcc->GetScanlineSize();
+ long nY = 0, nScanY = nDstY1;
+
+ while( nScanY <= nDstY2 )
+ {
+ const long nMapY = pMapY[ nScanY ];
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ const long nMapX = pMapX[ nX ];
+ pWPAcc->SetPixel( nY, nX, pPAcc->GetPixel( nMapY, nMapX ) );
+ pWMAcc->SetPixel( nY, nX, pMAcc->GetPixel( nMapY, nMapX ) );
+ }
+
+ while( ( nScanY < nDstY2 ) && ( pMapY[ nScanY + 1 ] == nMapY ) )
+ {
+ HMEMCPY( pWPAcc->GetScanline( nY + 1L ), pWPAcc->GetScanline( nY ), nPScanSize );
+ HMEMCPY( pWMAcc->GetScanline( nY + 1L ), pWMAcc->GetScanline( nY ), nMScanSize );
+ nY++, nScanY++;
+ }
+
+ nY++, nScanY++;
+ }
+
+ bRet = TRUE;
+ }
+
+ if( pWPAcc )
+ rPaint.ReleaseAccess( pWPAcc );
+
+ if( pWMAcc )
+ rMask.ReleaseAccess( pWMAcc );
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void OutputDevice::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel )
+{
+ Point aPt;
+ Point aDestPt( LogicToPixel( rDestPt ) );
+ Size aDestSz( LogicToPixel( rDestSize ) );
+ Rectangle aSrcRect( rSrcPtPixel, rSrcSizePixel );
+
+ aSrcRect.Justify();
+
+ if( !!rBmp && aSrcRect.GetWidth() && aSrcRect.GetHeight() && aDestSz.Width() && aDestSz.Height() )
+ {
+ ULONG nMirrFlags = 0UL;
+ Bitmap aPaint( rBmp );
+ Bitmap aMask( rMask );
+ Region aDstRgn;
+ BOOL bMask = !!aMask;
+
+ if( bMask && ( aMask.GetBitCount() > 1 ) )
+ aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+
+ // mirrored horizontically
+ if( aDestSz.Width() < 0L )
+ {
+ aDestSz.Width() = -aDestSz.Width();
+ aDestPt.X() -= ( aDestSz.Width() - 1L );
+ nMirrFlags |= BMP_MIRROR_HORZ;
+ }
+
+ // mirrored vertically
+ if( aDestSz.Height() < 0L )
+ {
+ aDestSz.Height() = -aDestSz.Height();
+ aDestPt.Y() -= ( aDestSz.Height() - 1L );
+ nMirrFlags |= BMP_MIRROR_VERT;
+ }
+
+ // source cropped?
+ if( aSrcRect != Rectangle( aPt, aPaint.GetSizePixel() ) )
+ {
+ aPaint.Crop( aSrcRect );
+ if( bMask )
+ aMask.Crop( aSrcRect );
+ }
+
+ // destination mirrored
+ if( nMirrFlags )
+ {
+ aPaint.Mirror( nMirrFlags );
+ if( bMask )
+ aMask.Mirror( nMirrFlags );
+ }
+
+ const Rectangle aDstRect( aDestPt, aDestSz );
+
+ // create destination region
+ if( mbClipRegion && !maRegion.IsEmpty() )
+ {
+ aDstRgn = maRegion;
+ aDstRgn.Intersect( aDstRect );
+ }
+ else
+ aDstRgn = aDstRect;
+
+ aDstRgn.Move( -aDstRect.Left(), -aDstRect.Top() );
+
+ // we always want to have a mask
+ if( !bMask )
+ {
+ aMask = Bitmap( aSrcRect.GetSize(), 1 );
+ aMask.Erase( Color( COL_BLACK ) );
+ }
+
+ BitmapReadAccess* pPAcc = aPaint.AcquireReadAccess();
+ BitmapReadAccess* pMAcc = aMask.AcquireReadAccess();
+
+ if( pPAcc && pMAcc )
+ {
+ const long nWidth = aDestSz.Width();
+ const long nHeight = aDestSz.Height();
+ const long nWidth1 = nWidth - 1;
+ const long nHeight1 = nHeight - 1;
+ const long nOldWidth1 = aSrcRect.GetWidth() - 1;
+ const long nOldHeight1 = aSrcRect.GetHeight() - 1;
+ const long nScanByteCount = Max( nWidth * aPaint.GetBitCount() / 8L, 1L );
+ const long nBandHeight = BAND_MAX_SIZE / nScanByteCount + 1;
+ long* pMapX = new long[ nWidth ];
+ long* pMapY = new long[ nHeight ];
+ long nX, nY;
+ long nBandY1, nBandY2;
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ const BOOL bOldMap = mbMap;
+
+ mpMetaFile = NULL;
+ Push( PUSH_CLIPREGION );
+ SetClipRegion();
+ mbMap = FALSE;
+
+ // create mapping tables
+ for( nX = 0L; nX < nWidth; nX++ )
+ pMapX[ nX ] = nWidth1 ? ( nX * nOldWidth1 / nWidth1 ) : 0;
+
+ for( nY = 0L; nY < nHeight; nY++ )
+ pMapY[ nY ] = nHeight1 ? ( nY * nOldHeight1 / nHeight1 ) : 0;
+
+ // process bands
+ for( nBandY1 = 0, nBandY2 = nBandHeight; nBandY1 < nHeight; nBandY1 += nBandHeight, nBandY2 += nBandHeight )
+ {
+ Bitmap aWorkPaint, aWorkMask;
+
+ // don't walk over bounds
+ if( nBandY2 > nHeight1 )
+ nBandY2 = nHeight1;
+
+ if( ImplCreateBandBitmaps( pPAcc, pMAcc, pMapX, pMapY, nWidth, nBandY1, nBandY2, aWorkPaint, aWorkMask ) )
+ {
+ Region aWorkRgn( aDstRgn );
+ aWorkRgn.Move( 0, -nBandY1 );
+ aWorkRgn.Intersect( aWorkMask.CreateRegion( COL_BLACK, Rectangle( aPt, aWorkMask.GetSizePixel() ) ) );
+
+ ImplRegionInfo aInfo;
+ long nWorkX, nWorkY, nWorkWidth, nWorkHeight;
+ BOOL bRgnRect = aWorkRgn.ImplGetFirstRect( aInfo, nWorkX, nWorkY,
+ nWorkWidth, nWorkHeight );
+
+ while( bRgnRect )
+ {
+ Bitmap aCropBmp( aWorkPaint );
+ const Point aOutPt( nWorkX + aDestPt.X(), nWorkY + nBandY1 + aDestPt.Y() );
+ const Size aOutSz( nWorkWidth, nWorkHeight );
+ const Size aOutSz1( nWorkWidth + 1, nWorkHeight + 1 );
+
+ aCropBmp.Crop( Rectangle( Point( nWorkX, nWorkY ), aOutSz ) );
+ ImplDrawBitmap( aOutPt, aOutSz1, Point(), aOutSz, aCropBmp, META_BMPSCALE_ACTION );
+ bRgnRect = aWorkRgn.ImplGetNextRect( aInfo, nWorkX, nWorkY, nWorkWidth, nWorkHeight );
+ }
+ }
+ }
+
+ delete[] pMapX;
+ delete[] pMapY;
+ mbMap = bOldMap;
+ Pop();
+ mpMetaFile = pOldMetaFile;
+ }
+
+ if( pPAcc )
+ aPaint.ReleaseAccess( pPAcc );
+
+ if( pMAcc )
+ aMask.ReleaseAccess( pMAcc );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void OutputDevice::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor,
+ const Point& rDestPt, const Size& rDestSize,
+ const Point& rSrcPtPixel, const Size& rSrcSizePixel )
+{
+#ifndef REMOTE_APPSERVER
+
+ Point aPt;
+ Point aDestPt( LogicToPixel( rDestPt ) );
+ Size aDestSz( LogicToPixel( rDestSize ) );
+ Rectangle aSrcRect( rSrcPtPixel, rSrcSizePixel );
+
+ aSrcRect.Justify();
+
+ if( !!rMask &&
+ aSrcRect.GetWidth() && aSrcRect.GetHeight() &&
+ aDestSz.Width() && aDestSz.Height() )
+ {
+ ULONG nMirrFlags = 0UL;
+ Bitmap aMask( rMask );
+ Region aRegion;
+
+ if( aMask.GetBitCount() > 1 )
+ aMask.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
+
+ if( aDestSz.Width() < 0L )
+ {
+ aDestSz.Width() = -aDestSz.Width();
+ aDestPt.X() -= ( aDestSz.Width() - 1L );
+ nMirrFlags |= BMP_MIRROR_HORZ;
+ }
+
+ if( aDestSz.Height() < 0L )
+ {
+ aDestSz.Height() = -aDestSz.Height();
+ aDestPt.Y() -= ( aDestSz.Height() - 1L );
+ nMirrFlags |= BMP_MIRROR_VERT;
+ }
+
+ // source cropped?
+ if( aSrcRect != Rectangle( aPt, aMask.GetSizePixel() ) )
+ aMask.Crop( aSrcRect );
+
+ // destination mirrored
+ if( nMirrFlags )
+ aMask.Mirror( nMirrFlags );
+
+ aRegion = aMask.CreateRegion( COL_BLACK, Rectangle( Point(), aMask.GetSizePixel() ) );
+
+ ImplRegionInfo aInfo;
+ const Size aSrcSz( aMask.GetSizePixel() );
+ long nSrcX, nSrcY, nSrcWidth, nSrcHeight;
+ long nDstX, nDstY, nDstWidth, nDstHeight;
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ Pair* pMapX = ImplGetMap( aSrcSz.Width(), aDestSz.Width() );
+ Pair* pMapY = ImplGetMap( aSrcSz.Height(), aDestSz.Height() );
+ BOOL bOldMap = mbMap;
+ BOOL bRegionRect = aRegion.ImplGetFirstRect( aInfo, nSrcX, nSrcY, nSrcWidth, nSrcHeight );
+
+ mpMetaFile = NULL;
+ mbMap = FALSE;
+ Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
+ SetLineColor( rMaskColor );
+ SetFillColor( rMaskColor );
+ ImplInitLineColor();
+ ImplInitFillColor();
+
+ while( bRegionRect )
+ {
+ nDstX = pMapX[ nSrcX ].A();
+ nDstY = pMapY[ nSrcY ].A();
+ nDstWidth = pMapX[ nSrcX + nSrcWidth - 1L ].B() - nDstX + 1L;
+ nDstHeight = pMapY[ nSrcY + nSrcHeight - 1L ].B() - nDstY + 1L;
+ mpGraphics->DrawRect( nDstX + aDestPt.X(), nDstY + aDestPt.Y(), nDstWidth, nDstHeight );
+ bRegionRect = aRegion.ImplGetNextRect( aInfo, nSrcX, nSrcY, nSrcWidth, nSrcHeight );
+ }
+
+ Pop();
+ delete[] pMapX;
+ delete[] pMapY;
+ mbMap = bOldMap;
+ mpMetaFile = pOldMetaFile;
+ }
+
+#endif
+}
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
new file mode 100644
index 000000000000..4dbd5935f2ae
--- /dev/null
+++ b/vcl/source/gdi/outdev3.cxx
@@ -0,0 +1,6326 @@
+/*************************************************************************
+ *
+ * $RCSfile: outdev3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <math.h>
+#include <string.h>
+
+#define _SV_OUTDEV_CXX
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#endif
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#else
+#ifndef _SV_RMOUTDEV_HXX
+#include <rmoutdev.hxx>
+#endif
+#endif
+
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_METRIC_HXX
+#include <metric.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_OUTDATA_HXX
+#include <outdata.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_PRINT_HXX
+#include <print.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_EDIT_HXX
+#include <edit.hxx>
+#endif
+
+#include <unohelp.hxx>
+
+#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_
+#include <com/sun/star/text/XBreakIterator.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_WORDTYPE_HPP_
+#include <com/sun/star/text/WordType.hpp>
+#endif
+
+#if defined UNX
+#define GLYPH_FONT_HEIGHT 128
+#elif defined OS2
+#define GLYPH_FONT_HEIGHT 176
+#else
+#define GLYPH_FONT_HEIGHT 256
+#endif
+
+#define WSstrcmp strcmp
+
+// =======================================================================
+
+DBG_NAMEEX( OutputDevice );
+DBG_NAMEEX( Font );
+
+// =======================================================================
+
+#define OUTDEV_CHARCONVERT_REPLACE FALSE
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+
+// =======================================================================
+
+#define MAX_DX_WORDS 120
+#define TEXT_DRAW_ELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS | TEXT_DRAW_NEWSELLIPSIS)
+
+// =======================================================================
+
+#define UNDERLINE_LAST UNDERLINE_BOLDWAVE
+#define STRIKEOUT_LAST STRIKEOUT_X
+
+// =======================================================================
+
+void OutputDevice::ImplUpdateFontData( BOOL bNewFontLists )
+{
+ if ( mpFontEntry )
+ {
+ mpFontCache->Release( mpFontEntry );
+ mpFontEntry = NULL;
+ }
+ if ( bNewFontLists )
+ {
+ if ( mpGetDevFontList )
+ {
+ delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
+ }
+ if ( mpGetDevSizeList )
+ {
+ delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
+ }
+ }
+
+ if ( GetOutDevType() == OUTDEV_PRINTER )
+ {
+ mpFontCache->Clear();
+
+ if ( bNewFontLists )
+ {
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( ImplGetGraphics() )
+#endif
+ {
+ mpFontList->Clear();
+ mpGraphics->GetDevFontList( mpFontList );
+ mpFontList->InitStdFonts();
+ }
+ }
+ }
+
+ mbInitFont = TRUE;
+ mbNewFont = TRUE;
+
+ // Bei Fenstern auch alle Child-Fenster mit updaten
+ if ( GetOutDevType() == OUTDEV_WINDOW )
+ {
+ Window* pChild = ((Window*)this)->mpFirstChild;
+ while ( pChild )
+ {
+ pChild->ImplUpdateFontData( TRUE );
+ pChild = pChild->mpNext;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplUpdateAllFontData( BOOL bNewFontLists )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Alle Fenster updaten
+ Window* pFrame = pSVData->maWinData.mpFirstFrame;
+ while ( pFrame )
+ {
+ pFrame->ImplUpdateFontData( bNewFontLists );
+
+ Window* pSysWin = pFrame->mpFrameData->mpFirstOverlap;
+ while ( pSysWin )
+ {
+ pSysWin->ImplUpdateFontData( bNewFontLists );
+ pSysWin = pSysWin->mpNextOverlap;
+ }
+
+ pFrame = pFrame->mpFrameData->mpNextFrame;
+ }
+
+ // Alle VirDev's updaten
+ VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev;
+ while ( pVirDev )
+ {
+ pVirDev->ImplUpdateFontData( bNewFontLists );
+ pVirDev = pVirDev->mpNext;
+ }
+
+ // Alle Printer updaten
+ Printer* pPrinter = pSVData->maGDIData.mpFirstPrinter;
+ while ( pPrinter )
+ {
+ pPrinter->ImplUpdateFontData( bNewFontLists );
+ pPrinter = pPrinter->mpNext;
+ }
+
+ // Globale Fontlisten leeren, damit diese geupdatet werden
+ pSVData->maGDIData.mpScreenFontCache->Clear();
+ if ( bNewFontLists )
+ {
+ pSVData->maGDIData.mpScreenFontList->Clear();
+ pFrame = pSVData->maWinData.mpFirstFrame;
+ if ( pFrame )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( pFrame->ImplGetGraphics() )
+#endif
+ {
+ pFrame->mpGraphics->GetDevFontList( pFrame->mpFrameData->mpFontList );
+ pFrame->mpFrameData->mpFontList->InitStdFonts();
+ }
+ }
+ }
+}
+
+// =======================================================================
+
+struct ImplFontSubstEntry
+{
+ XubString maName;
+ XubString maReplaceName;
+ XubString maMatchName;
+ XubString maMatchReplaceName;
+ USHORT mnFlags;
+ ImplFontSubstEntry* mpNext;
+};
+
+// =======================================================================
+
+static void ImplStrEraseAllSymbols( XubString& rStr )
+{
+ xub_StrLen i = 0;
+ xub_Unicode c = rStr.GetChar( i );
+ while ( c )
+ {
+ // Alle Zeichen kleiner 0 zwischen 9-A, Z-a und z-127 loeschen
+ if ( (c < 48) || ((c > 57) && (c < 65)) || ((c > 90) && (c < 97)) ||
+ ((c > 122) && (c <= 127)) )
+ rStr.Erase( i, 1 );
+ else
+ i++;
+ c = rStr.GetChar( i );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static xub_StrLen ImplStrMatch( const XubString& rStr1, const XubString& rStr2 )
+{
+ xub_StrLen nMatch = 0;
+ const xub_Unicode* pStr1 = rStr1.GetBuffer();
+ const xub_Unicode* pStr2 = rStr2.GetBuffer();
+ while ( (*pStr1 == *pStr2) && *pStr1 )
+ {
+ pStr1++;
+ pStr2++;
+ nMatch++;
+ }
+ return nMatch;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplStrFullMatch( const XubString& rStr1, const char* pStr2 )
+{
+ const xub_Unicode* pStr1 = rStr1.GetBuffer();
+ while ( (*pStr1 == (xub_Unicode)(unsigned char)*pStr2) && *pStr1 )
+ {
+ pStr1++;
+ pStr2++;
+ }
+ return !(*pStr1);
+}
+
+// =======================================================================
+
+#if 0
+
+#define FONT_ATTR_SYMBOL ((ULONG)0x00000001)
+#define FONT_ATTR_FIXED ((ULONG)0x00000002)
+#define FONT_ATTR_ITALIC ((ULONG)0x00000004)
+#define FONT_ATTR_NORMAL ((ULONG)0x00000008)
+#define FONT_ATTR_STANDARD ((ULONG)0x00000010)
+#define FONT_ATTR_SPECIAL ((ULONG)0x00000020)
+#define FONT_ATTR_TITLING ((ULONG)0x00000040)
+#define FONT_ATTR_SERIF ((ULONG)0x00000080)
+#define FONT_ATTR_NONSERIF ((ULONG)0x00000100)
+#define FONT_ATTR_ROUNDED ((ULONG)0x00000200)
+#define FONT_ATTR_OUTLINE ((ULONG)0x00000400)
+#define FONT_ATTR_SHADOW ((ULONG)0x00000800)
+#define FONT_ATTR_SCRIPT ((ULONG)0x00001000)
+#define FONT_ATTR_HANDWRITING ((ULONG)0x00002000)
+#define FONT_ATTR_DECORATION ((ULONG)0x00004000)
+#define FONT_ATTR_CHARSCRIPT ((ULONG)0x00008000)
+#define FONT_ATTR_CHANCERY ((ULONG)0x00010000)
+#define FONT_ATTR_OLDSTYLE ((ULONG)0x00020000)
+#define FONT_ATTR_FAVOR1 ((ULONG)0x01000000)
+#define FONT_ATTR_FAVOR2 ((ULONG)0x02000000)
+#define FONT_ATTR_FAVOR3 ((ULONG)0x04000000)
+#define FONT_ATTR_FAVOR4 ((ULONG)0x08000000)
+#define FONT_ATTR_FOUND ((ULONG)0x80000000)
+
+struct ImplFontAttrWidthSearchData
+{
+ const char* mpStr;
+ FontWidth meWidth;
+};
+
+static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] =
+{
+{ "narrow", WIDTH_CONDENSED },
+{ "semicondensed", WIDTH_SEMI_CONDENSED },
+{ "ultracondensed", WIDTH_ULTRA_CONDENSED },
+{ "semiexpanded", WIDTH_SEMI_EXPANDED },
+{ "ultraexpanded", WIDTH_ULTRA_EXPANDED },
+{ "expanded", WIDTH_EXPANDED },
+{ "wide", WIDTH_ULTRA_EXPANDED },
+{ "condensed", WIDTH_CONDENSED },
+{ "cond", WIDTH_CONDENSED },
+{ "cn", WIDTH_CONDENSED },
+{ NULL, WIDTH_DONTKNOW },
+};
+
+struct ImplFontAttrWeightSearchData
+{
+ const char* mpStr;
+ FontWeight meWeight;
+};
+
+static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] =
+{
+{ "extrablack", WEIGHT_BLACK },
+{ "ultrablack", WEIGHT_BLACK },
+{ "black", WEIGHT_BLACK },
+{ "heavy", WEIGHT_BLACK },
+{ "ultrabold", WEIGHT_ULTRABOLD },
+{ "semibold", WEIGHT_SEMIBOLD },
+{ "bold", WEIGHT_BOLD },
+{ "ultralight", WEIGHT_ULTRALIGHT },
+{ "semilight", WEIGHT_SEMILIGHT },
+{ "light", WEIGHT_LIGHT },
+{ "demi", WEIGHT_SEMIBOLD },
+{ "medium", WEIGHT_MEDIUM },
+{ NULL, WEIGHT_DONTKNOW },
+};
+
+struct ImplFontAttrTypeSearchData
+{
+ const char* mpStr;
+ ULONG mnType;
+};
+
+static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] =
+{
+{ "titling", FONT_ATTR_TITLING },
+{ "outline", FONT_ATTR_OUTLINE },
+{ "shadow", FONT_ATTR_SHADOW },
+{ NULL, 0 },
+};
+
+// =======================================================================
+
+struct ImplFontNameAttr
+{
+ const char* mpName;
+ FontFamily meFamily;
+ FontWeight meWeight;
+ FontWidth meWidth;
+ ULONG mnType;
+};
+
+static const ImplFontNameAttr aImplFullList[] =
+{
+{ "Bookman", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_NORMAL | FONT_ATTR_STANDARD | FONT_ATTR_SERIF },
+{ NULL, FAMILY_DONTKNOW,WEIGHT_DONTKNOW,WIDTH_DONTKNOW, 0 }
+};
+
+static const ImplFontNameAttr aImplMatchList[] =
+{
+{ "bookman", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_NORMAL | FONT_ATTR_STANDARD | FONT_ATTR_SERIF },
+{ "comicsansms", FAMILY_SCRIPT, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_NONSERIF | FONT_ATTR_SCRIPT | FONT_ATTR_CHARSCRIPT | FONT_ATTR_FAVOR3 },
+{ "kristenitc", FAMILY_SCRIPT, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_NONSERIF | FONT_ATTR_SCRIPT | FONT_ATTR_CHARSCRIPT | FONT_ATTR_FAVOR3 },
+{ "maiandragd", FAMILY_SCRIPT, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_NONSERIF | FONT_ATTR_SCRIPT | FONT_ATTR_CHARSCRIPT | FONT_ATTR_FAVOR3 },
+{ "arioso", FAMILY_SCRIPT, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_NONSERIF | FONT_ATTR_SCRIPT | FONT_ATTR_ITALIC | FONT_ATTR_DECORATION | FONT_ATTR_OLDSTYLE | FONT_ATTR_FAVOR3 },
+{ "tempussansitc", FAMILY_SCRIPT, WEIGHT_LIGHT, WIDTH_NORMAL, FONT_ATTR_NONSERIF | FONT_ATTR_SCRIPT | FONT_ATTR_CHARSCRIPT },
+{ "papyrus", FAMILY_SCRIPT, WEIGHT_LIGHT, WIDTH_NORMAL, FONT_ATTR_NONSERIF | FONT_ATTR_SCRIPT | FONT_ATTR_CHARSCRIPT },
+{ "lucidashadowtitling", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_TITLING | FONT_ATTR_OUTLINE | FONT_ATTR_SHADOW },
+{ "lucidaopenboldtitling",FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_TITLING | FONT_ATTR_OUTLINE },
+{ "lucidaopentitling", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_TITLING | FONT_ATTR_OUTLINE },
+{ "lucidaopen", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_OUTLINE },
+{ "lucidashadow", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_OUTLINE | FONT_ATTR_SHADOW },
+{ "chevara", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_EXPANDED, FONT_ATTR_SERIF | FONT_ATTR_TITLING | FONT_ATTR_OUTLINE },
+{ "colonnamt", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_SPECIAL | FONT_ATTR_OUTLINE },
+{ "imprintmtshadow", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_OUTLINE | FONT_ATTR_SHADOW },
+{ "castellar", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_TITLING | FONT_ATTR_OUTLINE },
+{ "algerian", FAMILY_ROMAN, WEIGHT_NORMAL, WIDTH_NORMAL, FONT_ATTR_SERIF | FONT_ATTR_SPECIAL | FONT_ATTR_TITLING | FONT_ATTR_OUTLINE | FONT_ATTR_SHADOW | FONT_ATTR_OLDSTYLE },
+{ NULL, FAMILY_DONTKNOW,WEIGHT_DONTKNOW,WIDTH_DONTKNOW, 0 }
+};
+
+#endif
+
+static const char* aImplSwissMatchList[] =
+{
+ "arial",
+ "avantgarde",
+ "cgomega",
+ "centurygothic",
+ "charcoal",
+ "chicago",
+ "frutiger",
+ "geneva",
+ "haettenschweiler",
+ "helmet",
+ "helv",
+ "lucida",
+ "impact",
+ "tahoma",
+ "univers",
+ "vagrounded",
+ "verdana",
+ NULL
+};
+
+static const char* aImplSwissSearchList[] =
+{
+ "sansserif",
+ "swiss",
+ NULL
+};
+
+static const char* aImplRomanMatchList[] =
+{
+ "algerian",
+ "antiqua",
+ "caliso",
+ "clarendon",
+ "colonna",
+ "garamond",
+ "newyork",
+ "palatino",
+ "timmons",
+ NULL
+};
+
+static const char* aImplRomanSearchList[] =
+{
+ "book",
+ "times",
+ "roman",
+ "bright",
+ NULL
+};
+
+static const char* aImplFixedMatchList[] =
+{
+ "lineprinter",
+ "monaco",
+ "typewriter",
+ NULL
+};
+
+static const char* aImplFixedSearchList[] =
+{
+ "console",
+ "courier",
+ "fixed",
+ "letter",
+ "monospace",
+ "terminal",
+ NULL
+};
+
+static const char* aImplScriptMatchList[] =
+{
+ "arioso",
+ "coronet",
+ "cursive",
+ "marigold",
+ "zapfchancery",
+ NULL
+};
+
+static const char* aImplScriptSearchList[] =
+{
+ "script",
+ "signet",
+ "handwriting",
+ "calligraphy",
+ NULL
+};
+
+static const char* aImplSymbolMatchList[] =
+{
+ "marlett",
+ "monotypesorts",
+ "msoutlook",
+ NULL
+};
+
+static const char* aImplSymbolSearchList[] =
+{
+ "symbol",
+ "bats",
+ "dings",
+ "math",
+ NULL
+};
+
+static const char* aImplTypeList[] =
+{
+ "black",
+ "bold",
+ "condensed",
+ "expanded",
+ "narrow",
+ "outline",
+ NULL
+};
+
+// =======================================================================
+
+static const char* aImplSearchScriptList[] =
+{
+ "ce",
+ "we",
+ "cyr",
+ "tur",
+ "wt",
+ "greek",
+ "wl",
+ NULL
+};
+
+// -----------------------------------------------------------------------
+
+struct ImplScriptSearchList
+{
+ const char* mpScript;
+ rtl_Script meScript;
+};
+
+static void ImplCutScriptAndSpaces( XubString& rName )
+{
+ rName.EraseLeadingAndTrailingChars( ' ' );
+
+ USHORT nLen = rName.Len();
+ if ( nLen < 3 )
+ return;
+
+ // Scriptname must be the last part of the fontname and
+ // looks like "fontname (scriptname)". So there can only be a
+ // script name at the and of the fontname, when the last char is
+ // ')'.
+ if ( rName.GetChar( nLen-1 ) == ')' )
+ {
+ int nOpen = 1;
+ nLen -= 2;
+ while ( nLen )
+ {
+ if ( rName.GetChar( nLen ) == '(' )
+ {
+ nOpen--;
+ if ( !nOpen && nLen && (rName.GetChar( nLen-1 ) == ' ') )
+ {
+ XubString aScript = rName.Copy( nLen+1, rName.Len()-1-nLen-1 );
+ rName.Erase( nLen-1 );
+ return;
+ }
+ }
+ if ( rName.GetChar( nLen ) == ')' )
+ nOpen++;
+ nLen--;
+ }
+ }
+
+ // For compatibility with older version we must search for a
+ // script name at the end of a fontname without brakets
+ USHORT nSpacePos = rName.SearchBackward( ' ' );
+ if ( nSpacePos && (nSpacePos != STRING_NOTFOUND) )
+ {
+ XubString aScript = rName.Copy( nSpacePos+1 );
+ const char** pScript = aImplSearchScriptList;
+ while ( *pScript )
+ {
+ if ( aScript.EqualsAscii( *pScript ) )
+ {
+ rName.Erase( nSpacePos );
+ break;
+ }
+ pScript++;
+ }
+ }
+}
+
+// =======================================================================
+
+#if 0
+
+static const ImplFontNameAttr* ImplFindFontAttr( const XubString& rFontName )
+{
+ const ImplFontNameAttr* pList;
+
+ pList = aImplFullList;
+ while ( pList->mpName )
+ {
+ if ( rFontName.EqualsAscii( pList->mpName ) )
+ return pList;
+ pList++;
+ }
+
+ pList = aImplMatchList;
+ while ( pList->mpName )
+ {
+ if ( ImplStrFullMatch( rFontName, pList->mpName ) )
+ return pList;
+ pList++;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplGetFontAttr( const XubString& rFontName,
+ FontFamily& rFamily, CharSet& rCharSet,
+ FontPitch& rPitch )
+{
+ if ( (rFamily == FAMILY_DONTKNOW) || (rPitch == PITCH_DONTKNOW) ||
+ (rCharSet == CHARSET_DONTKNOW) )
+ {
+ }
+}
+
+#endif
+
+// =======================================================================
+
+BOOL ImplTestFontName( const XubString& rName,
+ const sal_Char** pMatchList,
+ const sal_Char** pSearchList )
+{
+ const char** pAlias;
+
+ pAlias = pMatchList;
+ while ( *pAlias )
+ {
+ if ( ImplStrFullMatch( rName, *pAlias ) )
+ return TRUE;
+ pAlias++;
+ }
+
+ pAlias = pSearchList;
+ while ( *pAlias )
+ {
+ if ( rName.SearchAscii( *pAlias ) != STRING_NOTFOUND )
+ return TRUE;
+ pAlias++;
+ }
+
+ return FALSE;
+}
+
+// =======================================================================
+
+static void ImplFontAttrFromName( const XubString& rFontName,
+ FontFamily& rFamily, CharSet& rCharSet,
+ FontPitch& rPitch )
+{
+ if ( rFamily == FAMILY_DONTKNOW )
+ {
+ if ( ImplTestFontName( rFontName, aImplRomanMatchList, aImplRomanSearchList ) )
+ rFamily = FAMILY_ROMAN;
+ else if ( ImplTestFontName( rFontName, aImplSwissMatchList, aImplSwissSearchList ) )
+ rFamily = FAMILY_SWISS;
+ else if ( ImplTestFontName( rFontName, aImplScriptMatchList, aImplScriptSearchList ) )
+ rFamily = FAMILY_SCRIPT;
+ }
+
+ if ( rPitch == PITCH_DONTKNOW )
+ {
+ if ( ImplTestFontName( rFontName, aImplFixedMatchList, aImplFixedSearchList ) )
+ rPitch = PITCH_FIXED;
+ }
+
+ if ( rCharSet == RTL_TEXTENCODING_DONTKNOW )
+ {
+ if ( ImplTestFontName( rFontName, aImplSymbolMatchList, aImplSymbolSearchList ) )
+ rCharSet = RTL_TEXTENCODING_SYMBOL;
+ }
+}
+
+// =======================================================================
+
+static const char* aImplStdSwissList[] =
+{
+ "helvetica",
+ "arial",
+ "lucida sans",
+ "lucidasans",
+ "lucida",
+ "geneva",
+ "helmet",
+ NULL
+};
+
+static const char* aImplStdRomanList[] =
+{
+ "times",
+ "times new roman",
+ "timesnewroman",
+ "roman",
+ "lucida serif",
+ "lucidaserif",
+ "lucida bright",
+ "lucidabright",
+ "bookman",
+ "garamond",
+ "timmons",
+ NULL
+};
+
+static const char* aImplStdFixedList[] =
+{
+ "courier",
+ "courier new",
+ "lucida typewriter",
+ "lucidatypewriter",
+ "lucida sans typewriter",
+ "lucidasanstypewriter",
+ NULL
+};
+
+static const char* aImplStdScriptList[] =
+{
+ "zapf chancery",
+ "zapfchancery",
+ "lucida calligraphy",
+ "lucidacalligraphy",
+ "lucida handwriting",
+ "lucidahandwriting",
+ "arioso",
+ "script",
+ "marigold",
+ NULL
+};
+
+static const char* aImplStdSymbolList[] =
+{
+ "starbats",
+ "symbol",
+ "zapf dingbats",
+ "zapfdingbats",
+ "wingdings",
+ "lucida dingbats",
+ "lucidadingbats",
+ "lucida sans dingbats",
+ "lucidasansdingbats",
+ NULL
+};
+
+// =======================================================================
+
+void ImplFreeOutDevFontData()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplFontSubstEntry* pEntry = pSVData->maGDIData.mpFirstFontSubst;
+ while ( pEntry )
+ {
+ ImplFontSubstEntry* pNext = pEntry->mpNext;
+ delete pEntry;
+ pEntry = pNext;
+ }
+}
+
+// =======================================================================
+
+static ImplFontData* ImplFindScript( ImplDevFontListData* pData,
+ rtl_Script eScript )
+{
+ // Testen, ob ein Font mit einem entsprechendem
+ // Script vorhanden ist
+ ImplFontData* pCurFontData = pData->mpFirst;
+ while ( pCurFontData )
+ {
+ // Detect Unicode Font !!!
+ if ( pData->maMatchName.EqualsAscii( "arial unicode ms" ) )
+ return pCurFontData;
+ if ( eScript == pCurFontData->meScript )
+ return pCurFontData;
+ pCurFontData = pCurFontData->mpNext;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+/* !!! UNICODE - Duerfte nicht mehr gebraucht werden !!!
+static rtl_TextEncoding ImplGetFakeEncoding( rtl_TextEncoding eEncoding )
+{
+ rtl_TextEncoding eSystemEncoding = GetSystemCharSet();
+ // MS_1252 und 8859_1 sind kompatible
+ if ( ((eEncoding == RTL_TEXTENCODING_MS_1252) ||
+ (eEncoding == RTL_TEXTENCODING_ISO_8859_1)) &&
+ ((eSystemEncoding == RTL_TEXTENCODING_MS_1252) ||
+ (eSystemEncoding == RTL_TEXTENCODING_ISO_8859_1)) )
+ return eEncoding;
+ else
+ {
+ // Wir testen, ob beide Zeichensaetze dem gleichem Script
+ // entsprechen, um so der Applikation das gleiche Encoding
+ // vorzugaukeln. Dies ist beispielsweise bei Russisch wichtig
+ // da hier Fonts mit unterschiedlichem Encoding auftauchen
+ // koennen.
+ rtl_Script eSrcScript;
+ rtl_Script eSystemScript;
+ rtl_TextEncodingInfo aTEncInfo;
+ aTEncInfo.StructSize = sizeof( aTEncInfo );
+ aTEncInfo.Script = SCRIPT_DONTKNOW;
+ if ( !rtl_getTextEncodingInfo( eEncoding, &aTEncInfo ) )
+ return eEncoding;
+ else
+ eSrcScript = aTEncInfo.Script;
+ aTEncInfo.Script = SCRIPT_DONTKNOW;
+ if ( !rtl_getTextEncodingInfo( eSystemEncoding, &aTEncInfo ) )
+ return eEncoding;
+ else
+ eSystemScript = aTEncInfo.Script;
+ if ( eSrcScript == eSystemScript )
+ eEncoding = eSystemEncoding;
+ }
+
+ return eEncoding;
+}
+*/
+
+// =======================================================================
+
+void OutputDevice::BeginFontSubstitution()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maGDIData.mbFontSubChanged = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::EndFontSubstitution()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maGDIData.mbFontSubChanged )
+ {
+ ImplUpdateAllFontData( FALSE );
+
+ Application* pApp = GetpApp();
+ DataChangedEvent aDCEvt( DATACHANGED_FONTSUBSTITUTION );
+ pApp->DataChanged( aDCEvt );
+ pApp->NotifyAllWindows( aDCEvt );
+ pSVData->maGDIData.mbFontSubChanged = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::AddFontSubstitute( const XubString& rFontName,
+ const XubString& rReplaceFontName,
+ USHORT nFlags )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplFontSubstEntry* pEntry = new ImplFontSubstEntry;
+
+ pEntry->maName = rFontName;
+ pEntry->maReplaceName = rReplaceFontName;
+ pEntry->maMatchName = rFontName;
+ pEntry->maMatchReplaceName = rReplaceFontName;
+ pEntry->mnFlags = nFlags;
+ pEntry->mpNext = pSVData->maGDIData.mpFirstFontSubst;
+ pEntry->maMatchName.ToLowerAscii();
+ pEntry->maMatchReplaceName.ToLowerAscii();
+ ImplCutScriptAndSpaces( pEntry->maMatchName );
+ ImplCutScriptAndSpaces( pEntry->maMatchReplaceName );
+ pSVData->maGDIData.mpFirstFontSubst = pEntry;
+ pSVData->maGDIData.mbFontSubChanged = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::RemoveFontSubstitute( USHORT n )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplFontSubstEntry* pEntry = pSVData->maGDIData.mpFirstFontSubst;
+ ImplFontSubstEntry* pPrev = NULL;
+ USHORT nCount = 0;
+ while ( pEntry )
+ {
+ if ( nCount == n )
+ {
+ pSVData->maGDIData.mbFontSubChanged = TRUE;
+ if ( pPrev )
+ pPrev->mpNext = pEntry->mpNext;
+ else
+ pSVData->maGDIData.mpFirstFontSubst = pEntry->mpNext;
+ delete pEntry;
+ break;
+ }
+
+ nCount++;
+ pPrev = pEntry;
+ pEntry = pEntry->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT OutputDevice::GetFontSubstituteCount()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplFontSubstEntry* pEntry = pSVData->maGDIData.mpFirstFontSubst;
+ USHORT nCount = 0;
+ while ( pEntry )
+ {
+ nCount++;
+ pEntry = pEntry->mpNext;
+ }
+
+ return nCount;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::GetFontSubstitute( USHORT n,
+ XubString& rFontName,
+ XubString& rReplaceFontName,
+ USHORT& rFlags )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplFontSubstEntry* pEntry = pSVData->maGDIData.mpFirstFontSubst;
+ USHORT nCount = 0;
+ while ( pEntry )
+ {
+ if ( nCount == n )
+ {
+ rFontName = pEntry->maName;
+ rReplaceFontName = pEntry->maReplaceName;
+ rFlags = pEntry->mnFlags;
+ break;
+ }
+
+ nCount++;
+ pEntry = pEntry->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplFontSubstitute( XubString& rFontName,
+ USHORT nFlags1, USHORT nFlags2 )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplFontSubstEntry* pEntry = pSVData->maGDIData.mpFirstFontSubst;
+ while ( pEntry )
+ {
+ if ( ((pEntry->mnFlags & nFlags1) == nFlags2) &&
+ (pEntry->maMatchName == rFontName) )
+ {
+ rFontName = pEntry->maMatchReplaceName;
+ return TRUE;
+ }
+
+ pEntry = pEntry->mpNext;
+ }
+
+ return FALSE;
+}
+
+// =======================================================================
+
+ImplDevFontList::ImplDevFontList() :
+ List( CONTAINER_MAXBLOCKSIZE, 96, 32 )
+{
+#if 0
+ mbIsInitMatchData = FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+ImplDevFontList::~ImplDevFontList()
+{
+ // Alle Eintraege loeschen
+ ImplDevFontListData* pEntry = First();
+ while ( pEntry )
+ {
+ // Liste der Font loeschen
+ ImplFontData* pFontData = pEntry->mpFirst;
+ do
+ {
+ ImplFontData* pTempFontData = pFontData;
+ pFontData = pFontData->mpNext;
+ delete pTempFontData;
+ }
+ while ( pFontData );
+ // Entry loeschen
+ delete pEntry;
+
+ pEntry = Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static StringCompare ImplCompareFontDataWithoutSize( const ImplFontData* pEntry1,
+ const ImplFontData* pEntry2 )
+{
+ // Vergleichen nach CharSet, Groesse, Breite, Weight, Italic, StyleName
+ if ( pEntry1->meCharSet < pEntry2->meCharSet )
+ return COMPARE_LESS;
+ else if ( pEntry1->meCharSet > pEntry2->meCharSet )
+ return COMPARE_GREATER;
+
+ if ( pEntry1->meWidthType < pEntry2->meWidthType )
+ return COMPARE_LESS;
+ else if ( pEntry1->meWidthType > pEntry2->meWidthType )
+ return COMPARE_GREATER;
+
+ if ( pEntry1->meWeight < pEntry2->meWeight )
+ return COMPARE_LESS;
+ else if ( pEntry1->meWeight > pEntry2->meWeight )
+ return COMPARE_GREATER;
+
+ if ( pEntry1->meItalic < pEntry2->meItalic )
+ return COMPARE_LESS;
+ else if ( pEntry1->meItalic > pEntry2->meItalic )
+ return COMPARE_GREATER;
+
+ return pEntry1->maStyleName.CompareTo( pEntry2->maStyleName );
+}
+
+// -----------------------------------------------------------------------
+
+static StringCompare ImplCompareFontData( const ImplFontData* pEntry1,
+ const ImplFontData* pEntry2 )
+{
+ StringCompare eComp = ImplCompareFontDataWithoutSize( pEntry1, pEntry2 );
+ if ( eComp != COMPARE_EQUAL )
+ return eComp;
+
+ if ( pEntry1->mnHeight < pEntry2->mnHeight )
+ return COMPARE_LESS;
+ else if ( pEntry1->mnHeight > pEntry2->mnHeight )
+ return COMPARE_GREATER;
+
+ if ( pEntry1->mnWidth < pEntry2->mnWidth )
+ return COMPARE_LESS;
+ else if ( pEntry1->mnWidth > pEntry2->mnWidth )
+ return COMPARE_GREATER;
+
+ return COMPARE_EQUAL;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDevFontList::Add( ImplFontData* pNewData )
+{
+ XubString aSearchName = pNewData->maName;
+ aSearchName.ToLowerAscii();
+
+ // Query Script for FontTest
+ rtl_TextEncodingInfo aTEncInfo;
+ aTEncInfo.StructSize = sizeof( aTEncInfo );
+ aTEncInfo.Script = SCRIPT_DONTKNOW;
+ rtl_getTextEncodingInfo( pNewData->meCharSet, &aTEncInfo );
+ pNewData->meScript = aTEncInfo.Script;
+
+ // Add Font
+ ULONG nIndex;
+ ImplDevFontListData* pFoundData = ImplFind( aSearchName, &nIndex );
+ BOOL bDelete = FALSE;
+
+ if ( !pFoundData )
+ {
+ pFoundData = new ImplDevFontListData;
+ pFoundData->maName = pNewData->maName;
+ pFoundData->maMatchName = aSearchName;
+ pFoundData->maMatchName2 = aSearchName;
+ pFoundData->mpFirst = pNewData;
+#if 0
+ pFoundData->mbScalable = FALSE;
+ ImplStrEraseAllSymbols( pFoundData->maMatchName2 );
+/*
+ pFoundData->meMatchFamily = pNewData->meFamily;
+ pFoundData->meMatchPitch = pNewData->mePitch;
+ CharSet eCharSet = pNewData->meCharSet;
+ ImplFontAttrFromName( pFoundData->maMatchName2, pFoundData->meMatchFamily,
+ eCharSet, pFoundData->meMatchPitch );
+ pFoundData->mbSymbol = eCharSet == RTL_TEXTENCODING_SYMBOL;
+*/
+#else
+ pFoundData->meMatchFamily = pNewData->meFamily;
+ pFoundData->meMatchPitch = pNewData->mePitch;
+ pFoundData->mnMatch = 0;
+ CharSet eCharSet = pNewData->meCharSet;
+ ImplStrEraseAllSymbols( pFoundData->maMatchName2 );
+ ImplFontAttrFromName( pFoundData->maMatchName2, pFoundData->meMatchFamily,
+ eCharSet, pFoundData->meMatchPitch );
+ pFoundData->mbSymbol = eCharSet == RTL_TEXTENCODING_SYMBOL;
+#endif
+
+ pNewData->mpNext = NULL;
+ Insert( pFoundData, nIndex );
+ }
+ else
+ {
+ // Name ersetzen (spart Speicherplatz)
+ pNewData->maName = pFoundData->maName;
+
+ BOOL bInsert = TRUE;
+ ImplFontData* pPrev = NULL;
+ ImplFontData* pTemp = pFoundData->mpFirst;
+ do
+ {
+ StringCompare eComp = ImplCompareFontData( pNewData, pTemp );
+ if ( eComp != COMPARE_GREATER )
+ {
+ // Wenn Font gleich ist, nehmen wir einen Devicefont,
+ // oder ignorieren den Font
+ if ( eComp == COMPARE_EQUAL )
+ {
+ // Wir nehmen den Font mit der besseren Quality,
+ // ansonsten ziehen wir den Device-Font vor
+ if ( (pNewData->mnQuality > pTemp->mnQuality) ||
+ ((pNewData->mnQuality == pTemp->mnQuality) &&
+ (pNewData->mbDevice && !pTemp->mbDevice)) )
+ {
+ pNewData->mpNext = pTemp->mpNext;
+ if ( pPrev )
+ pPrev->mpNext = pNewData;
+ else
+ pFoundData->mpFirst = pNewData;
+ delete pTemp;
+ }
+ else
+ {
+ bDelete = TRUE;
+ delete pNewData;
+ }
+
+ bInsert = FALSE;
+ }
+ break;
+ }
+
+ pPrev = pTemp;
+ pTemp = pTemp->mpNext;
+ }
+ while ( pTemp );
+
+ if ( bInsert )
+ {
+ pNewData->mpNext = pTemp;
+ if ( pPrev )
+ pPrev->mpNext = pNewData;
+ else
+ pFoundData->mpFirst = pNewData;
+ }
+ }
+
+ // Match zusammenzaehlen
+ if ( !bDelete )
+ {
+#if 0
+ if ( (pNewData->meType == TYPE_SCALABLE) && (pNewData->mnHeight == 0) )
+ pFoundData->mbScalable = TRUE;
+#else
+ if ( (pNewData->meType == TYPE_SCALABLE) && (pNewData->mnHeight == 0) )
+ {
+ if ( pNewData->meWidthType == WIDTH_NORMAL )
+ pFoundData->mnMatch += 30;
+ else
+ pFoundData->mnMatch += 3;
+ if ( pNewData->meItalic == ITALIC_NONE )
+ pFoundData->mnMatch += 20;
+ else
+ pFoundData->mnMatch += 2;
+ if ( (pNewData->meWeight == WEIGHT_NORMAL) || (pNewData->meWeight == WEIGHT_MEDIUM) )
+ pFoundData->mnMatch += 10;
+ else
+ pFoundData->mnMatch += 1;
+ }
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImplDevFontListData* ImplDevFontList::ImplFind( const XubString& rFontName, ULONG* pIndex ) const
+{
+ ULONG nCount = Count();
+ if ( !nCount )
+ {
+ if ( pIndex )
+ *pIndex = LIST_APPEND;
+ return NULL;
+ }
+
+ // Fonts in der Liste suchen
+ ImplDevFontListData* pCompareData;
+ ImplDevFontListData* pFoundData = NULL;
+ ULONG nLow = 0;
+ ULONG nHigh = nCount-1;
+ ULONG nMid;
+ StringCompare eCompare;
+
+ do
+ {
+ nMid = (nLow + nHigh) / 2;
+ pCompareData = Get( nMid );
+ eCompare = rFontName.CompareTo( pCompareData->maMatchName );
+ if ( eCompare == COMPARE_LESS )
+ {
+ if ( !nMid )
+ break;
+ nHigh = nMid-1;
+ }
+ else
+ {
+ if ( eCompare == COMPARE_GREATER )
+ nLow = nMid + 1;
+ else
+ {
+ pFoundData = pCompareData;
+ break;
+ }
+ }
+ }
+ while ( nLow <= nHigh );
+
+ if ( pIndex )
+ {
+ eCompare = rFontName.CompareTo( pCompareData->maMatchName );
+ if ( eCompare == COMPARE_GREATER )
+ *pIndex = (nMid+1);
+ else
+ *pIndex = nMid;
+ }
+
+ return pFoundData;
+}
+
+// -----------------------------------------------------------------------
+
+ImplDevFontListData* ImplDevFontList::FindFont( const XubString& rFontName ) const
+{
+ XubString aName = rFontName;
+ aName.ToLowerAscii();
+ ImplCutScriptAndSpaces( aName );
+ return ImplFind( aName );
+}
+
+// -----------------------------------------------------------------------
+
+ImplDevFontListData* ImplDevFontList::FindStdFont( const sal_Char** pStdFontNames,
+ rtl_Script eScript ) const
+{
+ // We want a scalable font with a system script
+ ImplDevFontListData* pRasterFoundData = NULL;
+ ImplDevFontListData* pWrongScriptRasterData = NULL;
+ ImplDevFontListData* pWrongScriptData = NULL;
+ while ( *pStdFontNames )
+ {
+ XubString aStdName( *pStdFontNames, RTL_TEXTENCODING_ASCII_US );
+ ImplDevFontListData* pFoundData = ImplFind( aStdName );
+ if ( pFoundData )
+ {
+ if ( (eScript == SCRIPT_SYMBOL) ||
+ ImplFindScript( pFoundData, eScript ) )
+ {
+ if ( pFoundData->mpFirst->meType != TYPE_RASTER )
+ return pFoundData;
+ else if ( !pRasterFoundData )
+ pRasterFoundData = pFoundData;
+ }
+ else
+ {
+ if ( pFoundData->mpFirst->meType != TYPE_RASTER )
+ {
+ if ( !pWrongScriptData )
+ pWrongScriptData = pFoundData;
+ }
+ else
+ {
+ if ( !pWrongScriptRasterData )
+ pWrongScriptRasterData = pFoundData;
+ }
+ }
+ }
+ pStdFontNames++;
+ }
+
+ // Wenn keine passende Schrift, dann die Reihenfolge:
+ // - passender Zeichensatz
+ // - Skalierbar
+ // - eine passende Schrift die nicht skalierbar und den
+ // falschen Zeichensatz hat
+ // - keine
+ if ( pRasterFoundData )
+ return pRasterFoundData;
+ else if ( pWrongScriptData )
+ return pWrongScriptData;
+ else
+ return pWrongScriptRasterData;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDevFontList::Clear()
+{
+ // Alle Eintraege loeschen
+ ImplDevFontListData* pEntry = First();
+ while ( pEntry )
+ {
+ // Liste der Font loeschen
+ ImplFontData* pFontData = pEntry->mpFirst;
+ do
+ {
+ ImplFontData* pTempFontData = pFontData;
+ pFontData = pFontData->mpNext;
+ delete pTempFontData;
+ }
+ while ( pFontData );
+ // Entry loeschen
+ delete pEntry;
+
+ pEntry = Next();
+ }
+ List::Clear();
+
+ // Standard-Fonts loeschen
+ for ( USHORT i = 0; i < IMPL_STDFONT_COUNT; i++ )
+ mpStdFontAry[i] = NULL;
+#if 0
+ mbIsInitMatchData = FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#if 0
+void ImplDevFontList::InitMatchData()
+{
+ if ( mbIsInitMatchData )
+ return;
+ mbIsInitMatchData = TRUE;
+/*
+ // Fuer alle Eintraege die Matchdaten ermitteln
+ ImplDevFontListData* pEntry = First();
+ while ( pEntry )
+ {
+ ImplFontData* pFontData = pEntry->mpFirst;
+
+ pEntry = Next();
+ }
+*/
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+void ImplDevFontList::InitStdFonts()
+{
+ rtl_Script eSystemScript;
+ rtl_TextEncodingInfo aTextEncInfo;
+ aTextEncInfo.StructSize = sizeof( aTextEncInfo );
+ aTextEncInfo.Script = SCRIPT_DONTKNOW;
+ rtl_getTextEncodingInfo( gsl_getSystemTextEncoding(), &aTextEncInfo );
+ eSystemScript = aTextEncInfo.Script;
+
+ mpStdFontAry[IMPL_STDFONT_SWISS] = FindStdFont( aImplStdSwissList, eSystemScript );
+ mpStdFontAry[IMPL_STDFONT_ROMAN] = FindStdFont( aImplStdRomanList, eSystemScript );
+ mpStdFontAry[IMPL_STDFONT_FIXED] = FindStdFont( aImplStdFixedList, eSystemScript );
+ mpStdFontAry[IMPL_STDFONT_SCRIPT] = FindStdFont( aImplStdScriptList, eSystemScript );
+ mpStdFontAry[IMPL_STDFONT_SYMBOL] = FindStdFont( aImplStdSymbolList, SCRIPT_SYMBOL );
+}
+
+// =======================================================================
+
+void ImplGetDevSizeList::Add( long nNewHeight )
+{
+ ULONG n = Count();
+ if ( !n || (nNewHeight > Get( n-1 )) )
+ Insert( (void*)nNewHeight, LIST_APPEND );
+ else
+ {
+ for ( ULONG i=0 ; i < n; i++ )
+ {
+ long nHeight = Get( i );
+
+ if ( nNewHeight <= nHeight )
+ {
+ if ( nNewHeight != nHeight )
+ Insert( (void*)nNewHeight, i );
+ break;
+ }
+ }
+ }
+}
+
+// =======================================================================
+
+ImplFontEntry::~ImplFontEntry()
+{
+ if ( mpWidthAry )
+ delete mpWidthAry;
+
+ if ( mpKernPairs )
+ delete mpKernPairs;
+
+ if ( mpKernInfo )
+ delete mpKernInfo;
+}
+
+// =======================================================================
+
+ImplFontCache::ImplFontCache( BOOL bPrinter )
+{
+ mpFirstEntry = NULL;
+ mnRef0Count = 0;
+ mbPrinter = bPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+ImplFontCache::~ImplFontCache()
+{
+ // Alle Eintraege loeschen
+ ImplFontEntry* pTemp;
+ ImplFontEntry* pEntry = mpFirstEntry;
+ while ( pEntry )
+ {
+ pTemp = pEntry->mpNext;
+ delete pEntry;
+ pEntry = pTemp;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImplFontEntry* ImplFontCache::Get( ImplDevFontList* pFontList,
+ const Font& rFont, const Size& rSize )
+{
+ const XubString& rName = rFont.GetName();
+ const XubString& rStyleName = rFont.GetStyleName();
+ long nWidth = rSize.Width();
+ long nHeight = rSize.Height();
+ FontFamily eFamily = rFont.GetFamily();
+ CharSet eCharSet = rFont.GetCharSet();
+ FontWeight eWeight = rFont.GetWeight();
+ FontItalic eItalic = rFont.GetItalic();
+ FontPitch ePitch = rFont.GetPitch();
+ short nOrientation = (short)(rFont.GetOrientation() % 3600);
+ BOOL bShadow = rFont.IsShadow();
+ BOOL bOutline = rFont.IsOutline();
+
+ // Groesse anpassen
+ if ( nHeight < 0 )
+ nHeight = -nHeight;
+ if ( nWidth < 0 )
+ nWidth = -nWidth;
+
+ // Eintrag suchen
+ ImplFontEntry* pPrevEntry = NULL;
+ ImplFontEntry* pEntry = mpFirstEntry;
+ while ( pEntry )
+ {
+ ImplFontSelectData* pFontSelData = &(pEntry->maFontSelData);
+ if ( (nHeight == pFontSelData->mnHeight) &&
+ (eWeight == pFontSelData->meWeight) &&
+ (eItalic == pFontSelData->meItalic) &&
+ (rName == pFontSelData->maName) &&
+ (rStyleName == pFontSelData->maStyleName) &&
+ (eCharSet == pFontSelData->meCharSet) &&
+ (eFamily == pFontSelData->meFamily) &&
+ (ePitch == pFontSelData->mePitch) &&
+ (nWidth == pFontSelData->mnWidth) &&
+ (nOrientation == pFontSelData->mnOrientation) )
+ {
+ if ( !pEntry->mnRefCount )
+ mnRef0Count--;
+
+ pEntry->mnRefCount++;
+
+ // Entry nach vorne bringen
+ if ( pPrevEntry )
+ {
+ pPrevEntry->mpNext = pEntry->mpNext;
+ pEntry->mpNext = mpFirstEntry;
+ mpFirstEntry = pEntry;
+ }
+
+ return pEntry;
+ }
+
+ pPrevEntry = pEntry;
+ pEntry = pEntry->mpNext;
+ }
+
+ // Wir suchen zuerst ueber den Namen den passenden Font
+ XubString aLowerFontName = rName;
+ XubString aFirstName;
+ XubString aTempName;
+ XubString aTempName2;
+ ImplDevFontListData* pFoundData;
+ ImplDevFontListData* pTempFoundData;
+ xub_StrLen nFirstNameIndex = 0;
+ xub_StrLen nIndex = 0;
+ USHORT nSubstFlags1 = FONT_SUBSTITUTE_ALWAYS;
+ USHORT nSubstFlags2 = FONT_SUBSTITUTE_ALWAYS;
+ rtl_Script eScript = SCRIPT_DONTKNOW;
+ rtl_Script eCharSetScript;
+ rtl_TextEncodingInfo aTextEncInfo;
+ aTextEncInfo.StructSize = sizeof( aTextEncInfo );
+ aTextEncInfo.Script = SCRIPT_DONTKNOW;
+ rtl_getTextEncodingInfo( eCharSet, &aTextEncInfo );
+ eCharSetScript = aTextEncInfo.Script;
+ if ( mbPrinter )
+ nSubstFlags1 |= FONT_SUBSTITUTE_SCREENONLY;
+ aLowerFontName.ToLowerAscii();
+ pTempFoundData = NULL;
+ do
+ {
+ aTempName = aLowerFontName.GetToken( 0, ';', nIndex );
+ ImplCutScriptAndSpaces( aTempName );
+ if ( !aFirstName.Len() )
+ {
+ aFirstName = aTempName;
+ nFirstNameIndex = nIndex;
+ }
+ ImplFontSubstitute( aTempName, nSubstFlags1, nSubstFlags2 );
+ pFoundData = pFontList->ImplFind( aTempName );
+ if ( pFoundData )
+ {
+ if ( eCharSetScript != SCRIPT_DONTKNOW )
+ {
+ if ( !pTempFoundData )
+ {
+ aTempName2 = aTempName;
+ pTempFoundData = pFoundData;
+ }
+
+ // Testen, ob ein Font mit einem entsprechendem
+ // Script vorhanden ist
+ if ( ImplFindScript( pFoundData, eCharSetScript ) )
+ {
+ aLowerFontName = aTempName;
+ break;
+ }
+ else
+ pFoundData = NULL;
+ }
+ else
+ {
+ aLowerFontName = aTempName;
+ break;
+ }
+ }
+ }
+ while ( nIndex != STRING_NOTFOUND );
+ if ( !pFoundData && pTempFoundData )
+ {
+ pFoundData = pTempFoundData;
+ aLowerFontName = aTempName2;
+ }
+
+ // Danach versuchen wir es nocheinmal unter Beruecksichtigung
+ // der gloablen Fontersetzungstabelle, wobei wir jetzt auch
+ // die Fonts nehmen, die ersetzt werden sollen, wenn sie
+ // nicht vorhanden sind
+ if ( !pFoundData )
+ {
+ nSubstFlags1 &= ~FONT_SUBSTITUTE_ALWAYS;
+ nSubstFlags2 &= ~FONT_SUBSTITUTE_ALWAYS;
+ nIndex = 0;
+ do
+ {
+ aTempName = aLowerFontName.GetToken( 0, ';', nIndex );
+ ImplCutScriptAndSpaces( aTempName );
+ if ( ImplFontSubstitute( aTempName, nSubstFlags1, nSubstFlags2 ) )
+ {
+ pFoundData = pFontList->ImplFind( aTempName );
+ if ( pFoundData )
+ {
+ aLowerFontName = aTempName;
+ break;
+ }
+ }
+ }
+ while ( nIndex != STRING_NOTFOUND );
+ }
+
+ // Wenn kein Font mit dem entsprechenden Namen existiert, versuchen
+ // wir ueber den Namen und die Attribute einen passenden Font zu
+ // finden
+ ULONG nFontCount = pFontList->Count();
+ if ( !pFoundData && nFontCount )
+ {
+#if 0
+ pFontList->InitMatchData();
+
+ // 1. Token vom Fontnamen nehmen und Sonderzeichen entfernen
+ XubString aNoSymbolName = aFirstName;
+ ImplCutScriptAndSpaces( aNoSymbolName );
+ ImplStrEraseAllSymbols( aNoSymbolName );
+
+ // Script evtl. aus CharSet gewinnen, wenn nicht ueber den Fontnamen
+ // ermittelt werden konnte
+ if ( eScript == SCRIPT_DONTKNOW )
+ eScript = eCharSetScript;
+
+ // wir versuchen zuerst einen Font zu finden, der ueber den Namen
+ // matched
+ ULONG nTestMatch;
+ ULONG nBestMatch = 0;
+ for ( ULONG i = 0; i < nFontCount; i++ )
+ {
+ ImplDevFontListData* pData = pFontList->Get( i );
+
+ nTestMatch = 0;
+
+ // Wir wollen schon Zeichen erkennen
+ if ( eScript != SCRIPT_DONTKNOW )
+ {
+ if ( ImplFindScript( pData, eScript ) )
+ nTestMatch += 1000000000;
+ }
+
+ // skalierbare Schriften haben schon einen echten Vorteil
+ // gegenueber nicht skalierbaren Schriften
+ if ( pData->mbScalable )
+ nTestMatch += 500000000;
+
+/*
+ // Wir gehen davon aus, wenn der Name groesstenteils matcht,
+ // das er schon zur richtigen Familie gehoert
+
+
+ // Beim matchen ignorieren wir alle Sonderzeichen
+ ULONG nTestMatch = ImplStrMatch( aNoSymbolName, pData->maMatchName2 );
+ if ( nTestMatch >= nBestMatch )
+ {
+ // Match nur erlaubt, wenn auch die Attribute uebereinstimmen
+ BOOL bTestFamily = pData->meMatchFamily != FAMILY_DONTKNOW;
+ BOOL bTestSymbol = pData->mbSymbol;
+ BOOL bTestFixed = pData->meMatchPitch == PITCH_FIXED;
+ if ( (bFixed == bTestFixed) && (bSymbol == bTestSymbol) &&
+ (!bFamily || !bTestFamily || (eSearchFamily == pData->meMatchFamily)) )
+ {
+ xub_StrLen nAttrMatch = 0;
+ // Die Anzahl der uebereinstimmenden Attribute zaehlen
+ const char** pTypeList = aImplTypeList;
+ while ( *pTypeList )
+ {
+ if ( (aNoSymbolName.Search( *pTypeList ) != STRING_NOTFOUND) &&
+ (pData->maMatchName2.Search( *pTypeList ) != STRING_NOTFOUND) )
+ nAttrMatch++;
+ pTypeList++;
+ }
+
+ // Wenn beide Matches gleich gut sind,
+ // entscheiden die uebereinstimmenden Attribute
+ if ( nBestMatch == nTestMatch )
+ {
+ if ( (nAttrMatch > nBestAttrMatch) ||
+ ((nAttrMatch == nBestAttrMatch) &&
+ (pData->maMatchName2.Len() < nBestStrLen)) )
+ {
+ pFoundData = pData;
+ nBestMatch = nTestMatch;
+ nBestAttrMatch = nAttrMatch;
+ nBestStrLen = pData->maMatchName2.Len();
+ }
+ }
+ else
+ {
+ pFoundData = pData;
+ nBestMatch = nTestMatch;
+ nBestAttrMatch = nAttrMatch;
+ nBestStrLen = pData->maMatchName2.Len();
+ }
+ }
+ }
+*/
+
+ if ( nTestMatch > nBestMatch )
+ {
+ pFoundData = pData;
+ nBestMatch = nTestMatch;
+ }
+ }
+
+ if ( !pFoundData )
+ {
+ pFoundData = pFontList->GetStandardFont( IMPL_STDFONT_ROMAN );
+ // Wenn alles nichts hilft, nehmen wir den ersten
+ if ( !pFoundData )
+ pFontList->Get( 0 );
+ }
+#else
+ // 1. Token vom Fontnamen nehmen und Sonderzeichen entfernen
+ XubString aNoSymbolName = aFirstName;
+ ImplStrEraseAllSymbols( aNoSymbolName );
+
+ // Suchattribute ermitteln
+ BOOL bFamily;
+ BOOL bSymbol;
+ BOOL bFixed;
+ FontFamily eSearchFamily = eFamily;
+ CharSet eSearchCharSet = eCharSet;
+ FontPitch eSearchPitch = ePitch;
+ ImplFontAttrFromName( aNoSymbolName, eSearchFamily, eSearchCharSet, eSearchPitch );
+ bFamily = eSearchFamily != FAMILY_DONTKNOW;
+ bSymbol = eSearchCharSet == RTL_TEXTENCODING_SYMBOL;
+ bFixed = eSearchPitch == PITCH_FIXED;
+ // Solange in der Namesliste suchen, bis wir auswertbare
+ // Attribute gefunden haben
+ xub_StrLen nTempIndex = nFirstNameIndex;
+ while ( (nTempIndex != STRING_NOTFOUND) && !bFamily && !bFixed && !bSymbol )
+ {
+ aTempName = aLowerFontName.GetToken( 0, ';', nTempIndex );
+ ImplCutScriptAndSpaces( aTempName );
+ if ( !aTempName.Len() )
+ break;
+ ImplStrEraseAllSymbols( aTempName );
+ ImplFontAttrFromName( aTempName, eSearchFamily, eSearchCharSet, eSearchPitch );
+ bFamily = eSearchFamily != FAMILY_DONTKNOW;
+ bSymbol = eSearchCharSet == RTL_TEXTENCODING_SYMBOL;
+ bFixed = eSearchPitch == PITCH_FIXED;
+ }
+ aLowerFontName = aFirstName;
+
+ // wir versuchen zuerst einen Font zu finden, der ueber den Namen
+ // matched
+ ULONG i;
+ xub_StrLen nBestMatch = 5;
+ xub_StrLen nBestAttrMatch = 0;
+ xub_StrLen nBestStrLen = 0xFFFF;
+ for ( i = 0; i < nFontCount; i++ )
+ {
+ ImplDevFontListData* pData = pFontList->Get( i );
+ // Beim matchen ignorieren wir alle Sonderzeichen
+ xub_StrLen nTestMatch = ImplStrMatch( aNoSymbolName, pData->maMatchName2 );
+ if ( nTestMatch >= nBestMatch )
+ {
+ // Match nur erlaubt, wenn auch die Attribute uebereinstimmen
+ BOOL bTestFamily = pData->meMatchFamily != FAMILY_DONTKNOW;
+ BOOL bTestSymbol = pData->mbSymbol;
+ BOOL bTestFixed = pData->meMatchPitch == PITCH_FIXED;
+ if ( (bFixed == bTestFixed) && (bSymbol == bTestSymbol) &&
+ (!bFamily || !bTestFamily || (eSearchFamily == pData->meMatchFamily)) )
+ {
+ xub_StrLen nAttrMatch = 0;
+ // Die Anzahl der uebereinstimmenden Attribute zaehlen
+ const char** pTypeList = aImplTypeList;
+ while ( *pTypeList )
+ {
+ if ( (aNoSymbolName.SearchAscii( *pTypeList ) != STRING_NOTFOUND) &&
+ (pData->maMatchName2.SearchAscii( *pTypeList ) != STRING_NOTFOUND) )
+ nAttrMatch++;
+ pTypeList++;
+ }
+
+ // Wenn beide Matches gleich gut sind,
+ // entscheiden die uebereinstimmenden Attribute
+ if ( nBestMatch == nTestMatch )
+ {
+ if ( (nAttrMatch > nBestAttrMatch) ||
+ ((nAttrMatch == nBestAttrMatch) &&
+ (pData->maMatchName2.Len() < nBestStrLen)) )
+ {
+ pFoundData = pData;
+ nBestMatch = nTestMatch;
+ nBestAttrMatch = nAttrMatch;
+ nBestStrLen = pData->maMatchName2.Len();
+ }
+ }
+ else
+ {
+ pFoundData = pData;
+ nBestMatch = nTestMatch;
+ nBestAttrMatch = nAttrMatch;
+ nBestStrLen = pData->maMatchName2.Len();
+ }
+ }
+ }
+ }
+
+ // Wenn wir immer noch keinen passenden Font gefunden haben, versuchen
+ // wir es ueber die Attribute
+ if ( !pFoundData )
+ {
+ if ( bFixed )
+ {
+ pFoundData = pFontList->GetStandardFont( IMPL_STDFONT_FIXED );
+ if ( !pFoundData )
+ {
+ nBestMatch = 0;
+ for ( i = 0; i < nFontCount; i++ )
+ {
+ ImplDevFontListData* pData = pFontList->Get( i );
+ if ( (pData->meMatchPitch == PITCH_FIXED) &&
+ !pData->mbSymbol &&
+ (pData->meMatchFamily != FAMILY_DECORATIVE) )
+ {
+ if ( pData->mnMatch > nBestMatch )
+ {
+ pFoundData = pData;
+ nBestMatch = pData->mnMatch;
+ }
+ }
+ }
+ }
+ }
+
+ if ( bFamily && !pFoundData )
+ {
+ if ( eSearchFamily == FAMILY_SWISS )
+ pFoundData = pFontList->GetStandardFont( IMPL_STDFONT_SWISS );
+ else if ( eSearchFamily == FAMILY_ROMAN )
+ pFoundData = pFontList->GetStandardFont( IMPL_STDFONT_ROMAN );
+ else if ( eSearchFamily == FAMILY_SCRIPT )
+ pFoundData = pFontList->GetStandardFont( IMPL_STDFONT_SCRIPT );
+ if ( !pFoundData )
+ {
+ nBestMatch = 0;
+ for ( i = 0; i < nFontCount; i++ )
+ {
+ ImplDevFontListData* pData = pFontList->Get( i );
+ if ( (pData->meMatchFamily == eSearchFamily) &&
+ !pData->mbSymbol &&
+ (pData->meMatchPitch != PITCH_FIXED) )
+ {
+ if ( pData->mnMatch > nBestMatch )
+ {
+ pFoundData = pData;
+ nBestMatch = pData->mnMatch;
+ }
+ }
+ }
+ }
+ }
+
+ if ( bSymbol && !pFoundData )
+ {
+ pFoundData = pFontList->GetStandardFont( IMPL_STDFONT_SYMBOL );
+ if ( !pFoundData )
+ {
+ nBestMatch = 0;
+ for ( i = 0; i < nFontCount; i++ )
+ {
+ ImplDevFontListData* pData = pFontList->Get( i );
+ if ( pData->mbSymbol )
+ {
+ if ( pData->mnMatch > nBestMatch )
+ {
+ pFoundData = pData;
+ nBestMatch = pData->mnMatch;
+ }
+ }
+ }
+ }
+ }
+
+ if ( !pFoundData )
+ {
+ pFoundData = pFontList->GetStandardFont( IMPL_STDFONT_ROMAN );
+ // Wenn alles nichts hilft, nehmen wir den ersten
+ if ( !pFoundData )
+ pFontList->Get( 0 );
+ }
+ }
+#endif
+ }
+
+ // Script evtl. aus CharSet gewinnen, wenn nicht ueber den Fontnamen
+ // ermittelt werden konnte
+ if ( eScript == SCRIPT_DONTKNOW )
+ eScript = eCharSetScript;
+
+ // Jetzt suchen wir den Font ueber die Attribute
+ ImplFontData* pFontData = NULL;
+ if ( pFoundData )
+ {
+ ULONG nBestMatch = 0; // Der groessere Wert ist der bessere
+ ULONG nBestHeightMatch = 0; // Der kleinere Wert ist der bessere
+ ULONG nBestWidthMatch = 0; // Der kleinere Wert ist der bessere
+ ULONG nMatch;
+ ULONG nHeightMatch;
+ ULONG nWidthMatch;
+ ImplFontData* pCurFontData;
+
+// !!!!! Wegen Office-Fehler !!!!
+// XubString aCompareStyleName = rStyleName;
+// aCompareStyleName.ToLowerAscii();
+
+ // Vorallem wegen OS2-System-Standard-Fonts vergleichen wir
+ // den FontNamen mit FontName + StyleName, damit
+ // WarpSans Bold auch einen fetten Font ergibt
+ const xub_Unicode* pCompareStyleName = NULL;
+ if ( (aLowerFontName.Len() > pFoundData->maMatchName.Len()) &&
+ aLowerFontName.Equals( pFoundData->maMatchName, 0, pFoundData->maMatchName.Len() ) )
+ pCompareStyleName = aLowerFontName.GetBuffer()+pFoundData->maMatchName.Len()+1;
+
+ pCurFontData = pFoundData->mpFirst;
+ while ( pCurFontData )
+ {
+ nMatch = 0;
+ nHeightMatch = 0;
+ nWidthMatch = 0;
+
+// if ( aCompareStyleName.Len() &&
+// aCompareStyleName.EqualsIgnoreCaseAscii( pCurFontData->maStyleName ) )
+// nMatch += 120000;
+ if ( pCompareStyleName &&
+ pCurFontData->maStyleName.EqualsIgnoreCaseAscii( pCompareStyleName ) )
+ nMatch += 120000;
+
+ if ( eCharSet != RTL_TEXTENCODING_DONTKNOW )
+ {
+ if ( eCharSet == pCurFontData->meCharSet )
+ nMatch += 60000;
+ }
+
+ if ( eScript == pCurFontData->meScript )
+ nMatch += 30000;
+
+ if ( (ePitch != PITCH_DONTKNOW) && (ePitch == pCurFontData->mePitch) )
+ nMatch += 15000;
+
+ if ( (eFamily != FAMILY_DONTKNOW) && (eFamily == pCurFontData->meFamily) )
+ nMatch += 7500;
+
+ // Normale Schriftbreiten bevorzugen, da wir noch keine Daten
+ // von den Applikationen bekommen
+ if ( pCurFontData->meWidthType == WIDTH_NORMAL )
+ nMatch += 3750;
+
+ if ( eWeight != WEIGHT_DONTKNOW )
+ {
+ USHORT nReqWeight;
+ USHORT nGivenWeight;
+ USHORT nWeightDiff;
+ // schmale Fonts werden bei nicht Bold vor fetten
+ // Fonts bevorzugt
+ if ( eWeight > WEIGHT_MEDIUM )
+ nReqWeight = ((USHORT)eWeight)+100;
+ else
+ nReqWeight = (USHORT)eWeight;
+ if ( pCurFontData->meWeight > WEIGHT_MEDIUM )
+ nGivenWeight = ((USHORT)pCurFontData->meWeight)+100;
+ else
+ nGivenWeight = (USHORT)pCurFontData->meWeight;
+ if ( nReqWeight > nGivenWeight )
+ nWeightDiff = nReqWeight-nGivenWeight;
+ else
+ nWeightDiff = nGivenWeight-nReqWeight;
+
+ if ( nWeightDiff == 0 )
+ nMatch += 1000;
+ else if ( nWeightDiff == 1 )
+ nMatch += 700;
+ else if ( nWeightDiff < 50 )
+ nMatch += 200;
+ }
+ if ( eItalic == ITALIC_NONE )
+ {
+ if ( pCurFontData->meItalic == ITALIC_NONE )
+ nMatch += 900;
+ }
+ else
+ {
+ if ( eItalic == pCurFontData->meItalic )
+ nMatch += 900;
+ else if ( pCurFontData->meItalic != ITALIC_NONE )
+ nMatch += 600;
+ }
+
+ if ( pCurFontData->mbDevice )
+ nMatch += 40;
+ if ( pCurFontData->meType == TYPE_SCALABLE )
+ {
+ if ( nOrientation )
+ nMatch += 80;
+ else
+ {
+ if ( nWidth )
+ nMatch += 25;
+ else
+ nMatch += 5;
+ }
+ }
+ else
+ {
+ if ( nHeight == pCurFontData->mnHeight )
+ {
+ nMatch += 20;
+ if ( nWidth == pCurFontData->mnWidth )
+ nMatch += 10;
+ }
+ else
+ {
+ // Dann kommt die Size-Abweichung in die
+ // Bewertung rein. Hier bevorzugen wir
+ // nach Moeglichkeit den kleineren Font
+ if ( nHeight < pCurFontData->mnHeight )
+ nHeightMatch += pCurFontData->mnHeight-nHeight;
+ else
+ nHeightMatch += (nHeight-pCurFontData->mnHeight-nHeight)+10000;
+ if ( nWidth && pCurFontData->mnWidth && (nWidth != pCurFontData->mnWidth) )
+ {
+ if ( nWidth < pCurFontData->mnWidth )
+ nWidthMatch += pCurFontData->mnWidth-nWidth;
+ else
+ nWidthMatch += nWidth-pCurFontData->mnWidth-nWidth;
+ }
+ }
+ }
+
+ if ( nMatch > nBestMatch )
+ {
+ pFontData = pCurFontData;
+ nBestMatch = nMatch;
+ nBestHeightMatch = nHeightMatch;
+ nBestWidthMatch = nWidthMatch;
+ }
+ else if ( nMatch == nBestMatch )
+ {
+ // Wenn 2 gleichwertig sind, kommt die Size-Bewertung
+ // Hier gewinnt der jenige, der die niedrigere Abweichung
+ // in der Groesse hat (also den kleinsten Match)
+ if ( nHeightMatch < nBestHeightMatch )
+ {
+ pFontData = pCurFontData;
+ nBestHeightMatch = nHeightMatch;
+ nBestWidthMatch = nWidthMatch;
+ }
+ else if ( nHeightMatch == nBestHeightMatch )
+ {
+ if ( nWidthMatch < nBestWidthMatch )
+ {
+ pFontData = pCurFontData;
+ nBestWidthMatch = nWidthMatch;
+ }
+ }
+ }
+
+ pCurFontData = pCurFontData->mpNext;
+ }
+ }
+
+ // Daten initialisieren und in die Liste aufnehmen
+ pEntry = new ImplFontEntry;
+ pEntry->mbInit = FALSE;
+ pEntry->mnRefCount = 1;
+ pEntry->mpNext = mpFirstEntry;
+ pEntry->mnWidthAryCount = 0;
+ pEntry->mnWidthArySize = 0;
+ pEntry->mpWidthAry = NULL;
+ pEntry->mpKernPairs = NULL;
+ pEntry->mpKernInfo = NULL;
+ pEntry->mnOwnOrientation = 0;
+ pEntry->mnOrientation = 0;
+ mpFirstEntry = pEntry;
+
+ // Font-Selection-Daten setzen
+ ImplFontSelectData* pFontSelData = &(pEntry->maFontSelData);
+ pFontSelData->mpFontData = pFontData;
+ pFontSelData->mpSysSelData = NULL;
+ pFontSelData->maName = rName;
+ pFontSelData->maStyleName = rStyleName;
+ pFontSelData->mnWidth = nWidth;
+ pFontSelData->mnHeight = nHeight;
+ pFontSelData->meFamily = eFamily;
+ pFontSelData->meCharSet = eCharSet;
+ pFontSelData->meWidthType = WIDTH_DONTKNOW;
+ pFontSelData->meWeight = eWeight;
+ pFontSelData->meItalic = eItalic;
+ pFontSelData->mePitch = ePitch;
+ pFontSelData->mnOrientation = nOrientation;
+
+ return pEntry;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFontCache::Release( ImplFontEntry* pEntry )
+{
+ pEntry->mnRefCount--;
+
+ if ( !pEntry->mnRefCount )
+ {
+ if ( mnRef0Count >= MAXFONT_CACHE )
+ {
+ // Letzten Entry mit RefCount 0 loeschen
+ ImplFontEntry* pPrevDelEntry = mpFirstEntry;
+ ImplFontEntry* pDelEntry = pPrevDelEntry->mpNext;
+ USHORT nCurRef0Count = !(pPrevDelEntry->mnRefCount);
+ while ( pDelEntry )
+ {
+ if ( !pDelEntry->mnRefCount )
+ nCurRef0Count++;
+
+ if ( nCurRef0Count >= MAXFONT_CACHE )
+ {
+ pPrevDelEntry->mpNext = pDelEntry->mpNext;
+ delete pDelEntry;
+ break;
+ }
+
+ pPrevDelEntry = pDelEntry;
+ pDelEntry = pDelEntry->mpNext;
+ }
+ }
+ else
+ mnRef0Count++;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFontCache::Clear()
+{
+ // Alle Eintraege loeschen
+ ImplFontEntry* pTemp;
+ ImplFontEntry* pEntry = mpFirstEntry;
+ while ( pEntry )
+ {
+ DBG_ASSERT( !pEntry->mnRefCount, "ImplFontCache::Clear() - Font in use" );
+ pTemp = pEntry->mpNext;
+ delete pEntry;
+ pEntry = pTemp;
+ }
+
+ mpFirstEntry = NULL;
+ mnRef0Count = 0;
+}
+
+// =======================================================================
+
+class ImplTextLineInfo
+{
+private:
+ long mnWidth;
+ xub_StrLen mnIndex;
+ xub_StrLen mnLen;
+
+public:
+ ImplTextLineInfo( long nWidth, xub_StrLen nIndex, xub_StrLen nLen )
+ {
+ mnWidth = nWidth;
+ mnIndex = nIndex;
+ mnLen = nLen;
+ }
+
+ long GetWidth() const { return mnWidth; }
+ xub_StrLen GetIndex() const { return mnIndex; }
+ xub_StrLen GetLen() const { return mnLen; }
+};
+
+#define MULTITEXTLINEINFO_RESIZE 16
+typedef ImplTextLineInfo* PImplTextLineInfo;
+
+class ImplMultiTextLineInfo
+{
+private:
+ PImplTextLineInfo* mpLines;
+ xub_StrLen mnLines;
+ xub_StrLen mnSize;
+
+public:
+ ImplMultiTextLineInfo();
+ ~ImplMultiTextLineInfo();
+
+ void AddLine( ImplTextLineInfo* pLine );
+ void Clear();
+
+ ImplTextLineInfo* GetLine( USHORT nLine ) const
+ { return mpLines[nLine]; }
+ xub_StrLen Count() const { return mnLines; }
+
+private:
+ ImplMultiTextLineInfo( const ImplMultiTextLineInfo& );
+ ImplMultiTextLineInfo& operator=( const ImplMultiTextLineInfo& );
+};
+
+ImplMultiTextLineInfo::ImplMultiTextLineInfo()
+{
+ mpLines = new PImplTextLineInfo[MULTITEXTLINEINFO_RESIZE];
+ mnLines = 0;
+ mnSize = MULTITEXTLINEINFO_RESIZE;
+}
+
+ImplMultiTextLineInfo::~ImplMultiTextLineInfo()
+{
+ for ( xub_StrLen i = 0; i < mnLines; i++ )
+ delete mpLines[i];
+ delete mpLines;
+}
+
+void ImplMultiTextLineInfo::AddLine( ImplTextLineInfo* pLine )
+{
+ if ( mnSize == mnLines )
+ {
+ mnSize += MULTITEXTLINEINFO_RESIZE;
+ PImplTextLineInfo* pNewLines = new PImplTextLineInfo[mnSize];
+ memcpy( pNewLines, mpLines, mnLines*sizeof(PImplTextLineInfo) );
+ mpLines = pNewLines;
+ }
+
+ mpLines[mnLines] = pLine;
+ mnLines++;
+}
+
+void ImplMultiTextLineInfo::Clear()
+{
+ for ( xub_StrLen i = 0; i < mnLines; i++ )
+ delete mpLines[i];
+ mnLines = 0;
+}
+
+// =======================================================================
+
+void OutputDevice::ImplInitFont()
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( mbInitFont )
+ {
+#ifndef REMOTE_APPSERVER
+ mpFontEntry->mnSetFontFlags = mpGraphics->SetFont( &(mpFontEntry->maFontSelData) );
+ mbInitFont = FALSE;
+#else
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ RemoteFont aFont;
+
+ if ( pFontEntry->maFontSelData.mpFontData )
+ {
+ aFont.maName = pFontEntry->maFontSelData.mpFontData->maName;
+ aFont.maStyleName = pFontEntry->maFontSelData.mpFontData->maStyleName;
+ }
+ else
+ {
+ aFont.maName = pFontEntry->maFontSelData.maName;
+ aFont.maStyleName = pFontEntry->maFontSelData.maStyleName;
+ }
+ aFont.mnWidth = pFontEntry->maFontSelData.mnWidth;
+ aFont.mnHeight = pFontEntry->maFontSelData.mnHeight;
+ aFont.meFamily = pFontEntry->maFontSelData.meFamily;
+ aFont.meCharSet = pFontEntry->maFontSelData.meCharSet;
+ aFont.meWidthType = pFontEntry->maFontSelData.meWidthType;
+ aFont.meWeight = pFontEntry->maFontSelData.meWeight;
+ aFont.meItalic = pFontEntry->maFontSelData.meItalic;
+ aFont.mePitch = pFontEntry->maFontSelData.mePitch;
+ aFont.mnOrientation = pFontEntry->maFontSelData.mnOrientation;
+ mpGraphics->SetFont( aFont );
+ pFontEntry->mnSetFontFlags = 0;
+ mbInitFont = FALSE;
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplInitTextColor()
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( mbInitTextColor )
+ {
+#ifndef REMOTE_APPSERVER
+ mpGraphics->SetTextColor( ImplColorToSal( GetTextColor() ) );
+#else
+ mpGraphics->SetTextColor( GetTextColor() );
+#endif
+ mbInitTextColor = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int OutputDevice::ImplNewFont()
+{
+ DBG_TESTSOLARMUTEX();
+
+ if ( !mbNewFont )
+ return TRUE;
+
+ mbNewFont = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return FALSE;
+ }
+ SalGraphics* pGraphics = mpGraphics;
+#else
+ // Da wegen Clipping hier NULL zurueckkommen kann, koennen wir nicht
+ // den Rueckgabewert nehmen
+ ImplGetServerGraphics();
+ ImplServerGraphics* pGraphics = mpGraphics;
+#endif
+
+ // Groesse umrechnen
+ Size aSize = ImplLogicToDevicePixel( maFont.GetSize() );
+ if ( !aSize.Height() )
+ {
+ // Nur dann Defaultgroesse setzen, wenn Fonthoehe auch in logischen
+ // Koordinaaten 0 ist
+ if ( maFont.GetSize().Height() )
+ aSize.Height() = 1;
+ else
+ aSize.Height() = (12*mnDPIY)/72;
+ }
+
+ // Neuen Font besorgen
+ ImplFontEntry* pOldEntry = mpFontEntry;
+ mpFontEntry = mpFontCache->Get( mpFontList, maFont, aSize );
+ ImplFontEntry* pFontEntry = mpFontEntry;
+
+ // Feststellen, ob Font neu selektiert werden muss
+ if ( pFontEntry != pOldEntry )
+ mbInitFont = TRUE;
+
+ // these two may be filled in remote version
+ ImplKernPairData* pKernPairs = NULL;
+ long nKernPairs = 0;
+ // Wenn Font nicht initialisiert ist, dann sofort selektieren
+ if ( !pFontEntry->mbInit )
+ {
+ ImplInitFont();
+
+ // und die Font-Daten besorgen
+ if ( pGraphics )
+ {
+ pFontEntry->mbInit = TRUE;
+
+ pFontEntry->maMetric.mnWidth = pFontEntry->maFontSelData.mnWidth;
+ pFontEntry->maMetric.meFamily = pFontEntry->maFontSelData.meFamily;
+ pFontEntry->maMetric.meCharSet = pFontEntry->maFontSelData.meCharSet;
+ pFontEntry->maMetric.meWeight = pFontEntry->maFontSelData.meWeight;
+ pFontEntry->maMetric.meItalic = pFontEntry->maFontSelData.meItalic;
+ pFontEntry->maMetric.mePitch = pFontEntry->maFontSelData.mePitch;
+ pFontEntry->maMetric.mnOrientation = pFontEntry->maFontSelData.mnOrientation;
+ if ( pFontEntry->maFontSelData.mpFontData )
+ {
+ pFontEntry->maMetric.meType = pFontEntry->maFontSelData.mpFontData->meType;
+ pFontEntry->maMetric.maName = pFontEntry->maFontSelData.mpFontData->maName;
+ pFontEntry->maMetric.maStyleName= pFontEntry->maFontSelData.mpFontData->maStyleName;
+ pFontEntry->maMetric.mbDevice = pFontEntry->maFontSelData.mpFontData->mbDevice;
+ }
+ else
+ {
+ pFontEntry->maMetric.meType = TYPE_DONTKNOW;
+ pFontEntry->maMetric.maName = pFontEntry->maFontSelData.maName.GetToken( 0 );
+ pFontEntry->maMetric.maStyleName= pFontEntry->maFontSelData.maStyleName;
+ pFontEntry->maMetric.mbDevice = FALSE;
+ }
+ pFontEntry->maMetric.mnSuperscriptSize = 0;
+ pFontEntry->maMetric.mnSuperscriptOffset = 0;
+ pFontEntry->maMetric.mnSubscriptSize = 0;
+ pFontEntry->maMetric.mnSubscriptOffset = 0;
+ pFontEntry->maMetric.mnUnderlineSize = 0;
+ pFontEntry->maMetric.mnUnderlineOffset = 0;
+ pFontEntry->maMetric.mnBUnderlineSize = 0;
+ pFontEntry->maMetric.mnBUnderlineOffset = 0;
+ pFontEntry->maMetric.mnDUnderlineSize = 0;
+ pFontEntry->maMetric.mnDUnderlineOffset1 = 0;
+ pFontEntry->maMetric.mnDUnderlineOffset2 = 0;
+ pFontEntry->maMetric.mnWUnderlineSize = 0;
+ pFontEntry->maMetric.mnWUnderlineOffset = 0;
+ pFontEntry->maMetric.mnStrikeoutSize = 0;
+ pFontEntry->maMetric.mnStrikeoutOffset = 0;
+ pFontEntry->maMetric.mnBStrikeoutSize = 0;
+ pFontEntry->maMetric.mnBStrikeoutOffset = 0;
+ pFontEntry->maMetric.mnDStrikeoutSize = 0;
+ pFontEntry->maMetric.mnDStrikeoutOffset1 = 0;
+ pFontEntry->maMetric.mnDStrikeoutOffset2 = 0;
+#ifndef REMOTE_APPSERVER
+ pGraphics->GetFontMetric( &(pFontEntry->maMetric) );
+ pFontEntry->mnWidthFactor = pGraphics->GetCharWidth( 0, CHARCACHE_STD-1, pFontEntry->maWidthAry );
+#else
+ long nFactor = 0;
+
+ pGraphics->GetFontMetric(
+ pFontEntry->maMetric,
+ nFactor, 0, CHARCACHE_STD-1, pFontEntry->maWidthAry,
+ maFont.IsKerning(), &pKernPairs, nKernPairs
+ );
+ pFontEntry->mnWidthFactor = nFactor;
+#endif
+ if ( !pFontEntry->mnWidthFactor )
+ {
+ memset( pFontEntry->maWidthAry, 0, sizeof(long)*(CHARCACHE_STD-1) );
+ pFontEntry->mnWidthFactor = 1;
+ }
+
+ pFontEntry->mbFixedFont = pFontEntry->maMetric.mePitch == PITCH_FIXED;
+ pFontEntry->mnLineHeight = pFontEntry->maMetric.mnAscent+pFontEntry->maMetric.mnDescent;
+ pFontEntry->mbInitKernPairs = FALSE;
+ pFontEntry->mnKernPairs = nKernPairs;
+
+ if ( pFontEntry->maFontSelData.mnOrientation && !pFontEntry->maMetric.mnOrientation &&
+ (meOutDevType != OUTDEV_PRINTER) )
+ {
+ pFontEntry->mnOwnOrientation = pFontEntry->maFontSelData.mnOrientation;
+ pFontEntry->mnOrientation = pFontEntry->mnOwnOrientation;
+ }
+ else
+ pFontEntry->mnOrientation = pFontEntry->maMetric.mnOrientation;
+ }
+ }
+
+ // Wenn Kerning gewuenscht ist, die Kerning-Werte ermitteln
+ if ( maFont.IsKerning() )
+ {
+ ImplInitKerningPairs( pKernPairs, nKernPairs );
+ mbKerning = (pFontEntry->mnKernPairs) != 0;
+ }
+ else
+ mbKerning = FALSE;
+
+ // Je nach TextAlign den TextOffset berechnen
+ TextAlign eAlign = maFont.GetAlign();
+ if ( eAlign == ALIGN_BASELINE )
+ {
+ mnTextOffX = 0;
+ mnTextOffY = 0;
+ }
+ else if ( eAlign == ALIGN_TOP )
+ {
+ long nOrientation = pFontEntry->mnOrientation;
+ if ( nOrientation )
+ {
+ double nRad = ((double)nOrientation * F_2PI) / 3600.0;
+ long nOff = pFontEntry->maMetric.mnAscent;
+ mnTextOffX = (long)(nOff * sin( nRad ));
+ mnTextOffY = (long)(nOff * cos( nRad ));
+ }
+ else
+ {
+ mnTextOffX = 0;
+ mnTextOffY = pFontEntry->maMetric.mnAscent;
+ }
+ }
+ else // eAlign == ALIGN_BOTTOM
+ {
+ long nOrientation = pFontEntry->mnOrientation;
+ if ( nOrientation )
+ {
+ double nRad = ((double)nOrientation * F_2PI) / 3600.0;
+ long nOff = pFontEntry->maMetric.mnDescent;
+ mnTextOffX = (long)(nOff - (nOff * sin( nRad )));
+ nOff = -nOff;
+ mnTextOffY = (long)(nOff * cos( nRad ));
+ }
+ else
+ {
+ mnTextOffX = 0;
+ mnTextOffY = -pFontEntry->maMetric.mnDescent;
+ }
+ }
+
+ mbTextLines = ((maFont.GetUnderline() != UNDERLINE_NONE) && (maFont.GetUnderline() != UNDERLINE_DONTKNOW)) ||
+ ((maFont.GetStrikeout() != STRIKEOUT_NONE) && (maFont.GetStrikeout() != STRIKEOUT_DONTKNOW));
+ mbTextSpecial = maFont.IsShadow() || maFont.IsOutline();
+
+ if ( pOldEntry )
+ mpFontCache->Release( pOldEntry );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplGetCharWidth( sal_Unicode c ) const
+{
+ USHORT nChar = (USHORT)c;
+ if ( nChar < CHARCACHE_STD )
+ return mpFontEntry->maWidthAry[nChar];
+
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ ImplWidthInfoData* pInfo;
+ ImplWidthInfoData* pWidthAry = pFontEntry->mpWidthAry;
+ USHORT nWidthCount = pFontEntry->mnWidthAryCount;
+ USHORT nInsIndex;
+
+ if ( nWidthCount )
+ {
+ USHORT nLow;
+ USHORT nHigh;
+ USHORT nMid;
+ USHORT nCompareChar;
+
+ nLow = 0;
+ nHigh = nWidthCount-1;
+ do
+ {
+ nMid = (nLow+nHigh)/2;
+ pInfo = pWidthAry+nMid;
+ nCompareChar = pInfo->mnChar;
+ if ( nChar < nCompareChar )
+ {
+ if ( !nMid )
+ break;
+ nHigh = nMid-1;
+ }
+ else
+ {
+ if ( nChar > nCompareChar )
+ nLow = nMid+1;
+ else
+ return pInfo->mnWidth;
+ }
+ }
+ while ( nLow <= nHigh );
+
+ if ( nChar > nCompareChar )
+ nInsIndex = nMid+1;
+ else
+ nInsIndex = nMid;
+ }
+ else
+ {
+ pFontEntry->mnWidthArySize = WIDTHARY_INIT;
+ pFontEntry->mpWidthAry = new ImplWidthInfoData[pFontEntry->mnWidthArySize];
+ pWidthAry = pFontEntry->mpWidthAry;
+ nInsIndex = 0;
+ }
+
+ if ( nWidthCount == pFontEntry->mnWidthArySize )
+ {
+ USHORT nOldSize = pFontEntry->mnWidthArySize;
+ pFontEntry->mnWidthArySize += WIDTHARY_RESIZE;
+ pFontEntry->mpWidthAry = new ImplWidthInfoData[pFontEntry->mnWidthArySize];
+ memcpy( pFontEntry->mpWidthAry, pWidthAry, nOldSize*sizeof(ImplWidthInfoData) );
+ delete pWidthAry;
+ pWidthAry = pFontEntry->mpWidthAry;
+ }
+
+ // Um die Zeichenbreite zu ermitteln, brauchen wir einen Graphics und der
+ // Font muss natuerlich auch selektiert sein
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !((OutputDevice*)this)->ImplGetGraphics() )
+ return 0;
+ }
+#else
+ // Da wegen Clipping hier NULL zurueckkommen kann, koennen wir nicht
+ // den Rueckgabewert nehmen
+ ((OutputDevice*)this)->ImplGetServerGraphics();
+#endif
+
+ if ( mbNewFont )
+ ((OutputDevice*)this)->ImplNewFont();
+ if ( mbInitFont )
+ ((OutputDevice*)this)->ImplInitFont();
+
+ long nWidth;
+#ifndef REMOTE_APPSERVER
+ long nWidthFactor = mpGraphics->GetCharWidth( nChar, nChar, &nWidth );
+#else
+ long nWidthFactor = pFontEntry->mnWidthFactor;
+ mpGraphics->GetCharWidth( nChar, nChar, &nWidth );
+#endif
+ if ( !nWidthFactor )
+ return 0;
+
+ DBG_ASSERT( (nWidthFactor == pFontEntry->mnWidthFactor),
+ "OutputDevice::ImplGetCharWidth() - other WidthFactor" );
+
+ // Breite in Liste einfuegen und zurueckgeben
+ pInfo = pWidthAry+nInsIndex;
+ memmove( pInfo+1, pInfo, (nWidthCount-nInsIndex)*sizeof(ImplWidthInfoData) );
+ pFontEntry->mnWidthAryCount++;
+ pInfo->mnChar = nChar;
+ pInfo->mnWidth = nWidth;
+ return nWidth;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplInitKerningPairs( ImplKernPairData* pKernPairs, long nKernPairs )
+{
+ if ( mbNewFont )
+ {
+ if ( !ImplNewFont() )
+ return;
+ }
+
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ if ( !pFontEntry->mbInitKernPairs )
+ {
+ if ( mbInitFont )
+ ImplInitFont();
+ pFontEntry->mbInitKernPairs = TRUE;
+#ifndef REMOTE_APPSERVER
+ pFontEntry->mnKernPairs = mpGraphics->GetKernPairs( 0, NULL );
+ if ( pFontEntry->mnKernPairs )
+ {
+ ImplKernInfoData* pKernInfo = new ImplKernInfoData;
+ pKernPairs = new ImplKernPairData[pFontEntry->mnKernPairs];
+ memset( pKernPairs, 0, sizeof(ImplKernPairData)*pFontEntry->mnKernPairs );
+ pFontEntry->mnKernPairs = mpGraphics->GetKernPairs( pFontEntry->mnKernPairs, pKernPairs );
+ pFontEntry->mpKernInfo = pKernInfo;
+ pFontEntry->mpKernPairs = pKernPairs;
+
+ // Wir akzeptieren erstmal nur max. 65535-Paare
+ USHORT nMaxKernPairs;
+ if ( pFontEntry->mnKernPairs > 0xFFFF )
+ nMaxKernPairs = 0xFFFF;
+ else
+ nMaxKernPairs = (USHORT)pFontEntry->mnKernPairs;
+ memset( pKernInfo->maFirstAry, 0xFF, sizeof( pKernInfo->maFirstAry ) );
+ memset( pKernInfo->maLastAry, 0, sizeof( pKernInfo->maLastAry ) );
+ for ( USHORT i = 0; i < nMaxKernPairs; i++ )
+ {
+ USHORT nFirst = pKernPairs[i].mnChar1;
+ if ( nFirst < 0xFF )
+ {
+ if ( i < pKernInfo->maFirstAry[nFirst] )
+ pKernInfo->maFirstAry[nFirst] = i;
+ pKernInfo->maLastAry[nFirst] = i;
+ }
+ }
+ }
+#else
+ // Wir arbeiten erstmal nur mit USHORT
+ if( ! pKernPairs )
+ nKernPairs = mpGraphics->GetKernPairs( &pKernPairs );
+ if ( nKernPairs )
+ {
+ ImplKernInfoData* pKernInfo = new ImplKernInfoData;
+ pFontEntry->mpKernInfo = pKernInfo;
+ pFontEntry->mpKernPairs = pKernPairs;
+
+ // Wir akzeptieren erstmal nur max. 65535-Paare
+ USHORT nMaxKernPairs;
+ if( ! pFontEntry->mnKernPairs )
+ pFontEntry->mnKernPairs = nKernPairs;
+ if ( pFontEntry->mnKernPairs > 0xFFFF )
+ nMaxKernPairs = 0xFFFF;
+ else
+ nMaxKernPairs = (USHORT)pFontEntry->mnKernPairs;
+ memset( pKernInfo->maFirstAry, 0xFF, sizeof( pKernInfo->maFirstAry ) );
+ memset( pKernInfo->maLastAry, 0, sizeof( pKernInfo->maLastAry ) );
+ for ( USHORT i = 0; i < nMaxKernPairs; i++ )
+ {
+ USHORT nFirst = pKernPairs[i].mnChar1;
+ if ( nFirst < 0xFF )
+ {
+ if ( i < pKernInfo->maFirstAry[nFirst] )
+ pKernInfo->maFirstAry[nFirst] = i;
+ pKernInfo->maLastAry[nFirst] = i;
+ }
+ }
+ }
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplCalcKerning( const sal_Unicode* pStr, xub_StrLen nLen,
+ long* pDXAry, xub_StrLen nAryLen ) const
+{
+ if ( !nLen )
+ return 0;
+
+ ImplFontEntry* pEntry = mpFontEntry;
+ ImplKernPairData* pKernPairs = pEntry->mpKernPairs;
+ ImplKernInfoData* pKernInfo = pEntry->mpKernInfo;
+ long nWidth = 0;
+
+#ifdef DBG_UTIL
+ {
+ ImplKernPairData aTestPair;
+#ifdef __LITTLEENDIAN
+ ULONG nTestComp = ((ULONG)((USHORT)0xAABB) << 16) | (USHORT)0xCCDD;
+#else
+ ULONG nTestComp = ((ULONG)((USHORT)0xCCDD) << 16) | (USHORT)0xAABB;
+#endif
+ aTestPair.mnChar1 = 0xCCDD;
+ aTestPair.mnChar2 = 0xAABB;
+ DBG_ASSERT( nTestComp == *((ULONG*)&aTestPair), "Code doesn't work in this Version" );
+ }
+#endif
+
+ for ( USHORT i = 0; i < nLen-1; i++ )
+ {
+ USHORT nIndex = (USHORT)(unsigned char)pStr[i];
+ USHORT nFirst = pKernInfo->maFirstAry[nIndex];
+ USHORT nLast = pKernInfo->maLastAry[nIndex];
+#ifdef __LITTLEENDIAN
+ ULONG nComp = ((ULONG)((USHORT)(unsigned char)pStr[i+1]) << 16) | nIndex;
+#else
+ ULONG nComp = ((ULONG)nIndex << 16) | ((USHORT)(unsigned char)pStr[i+1]);
+#endif
+ for ( USHORT j = nFirst; j <= nLast; j++ )
+ {
+ if ( nComp == *((ULONG*)&(pKernPairs[j])) )
+ {
+ long nAmount = pKernPairs[j].mnKern;
+ nWidth += nAmount;
+ if ( pDXAry )
+ {
+ for ( USHORT n = i; n < nAryLen; n++ )
+ pDXAry[n] += nAmount;
+ }
+ }
+ }
+ }
+
+ return nWidth;
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplGetTextWidth( const xub_Unicode* pStr, xub_StrLen nLen,
+ const long* pDX )
+{
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long nFactor = pFontEntry->mnWidthFactor;
+ long nWidth = 0;
+
+ if ( nLen )
+ {
+ if ( pDX )
+ {
+ if ( nLen > 1 )
+ nWidth += pDX[nLen-2];
+ nWidth += ImplGetCharWidth( pStr[nLen-1] ) / nFactor;
+ }
+ else
+ {
+ // Bei Fixed-Fonts reicht eine Multiplikation
+ if ( pFontEntry->mbFixedFont )
+ nWidth = ImplGetCharWidth( 'A' ) * nLen;
+ else
+ {
+ const sal_Unicode* pTempStr = pStr;
+ xub_StrLen nTempLen = nLen;
+ while ( nTempLen )
+ {
+ nWidth += ImplGetCharWidth( *pTempStr );
+ nTempLen--;
+ pTempStr++;
+ }
+ }
+ nWidth /= nFactor;
+
+ // Kerning beruecksichtigen
+ if ( mbKerning )
+ nWidth += ImplCalcKerning( pStr, nLen, NULL, 0 );
+ }
+ }
+
+ return nWidth;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY,
+ short nOrientation )
+{
+ double nRealOrientation = nOrientation*F_PI1800;
+ double nCos = cos( nRealOrientation );
+ double nSin = sin( nRealOrientation );
+
+ // Translation...
+ long nX = rX-nOriginX;
+ long nY = rY-nOriginY;
+
+ // Rotation...
+ rX = ((long) ( nCos*nX + nSin*nY )) + nOriginX;
+ rY = ((long) - ( nSin*nX - nCos*nY )) + nOriginY;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY,
+ long nX, long nY, long nWidth, long nHeight )
+{
+ if ( mpFontEntry->mnOrientation )
+ {
+ if ( !(mpFontEntry->mnOrientation % 900) )
+ {
+ long nX2 = nX+nWidth;
+ long nY2 = nY+nHeight;
+ ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation );
+ ImplRotatePos( nBaseX, nBaseY, nX2, nY2, mpFontEntry->mnOrientation );
+ nWidth = nX2-nX;
+ nHeight = nY2-nY;
+ }
+ else
+ {
+ // Da Polygone kleiner gezeichnet werden
+ nHeight++;
+ nWidth++;
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ Polygon aPoly( aRect );
+ aPoly.Rotate( Point( nBaseX, nBaseY ), mpFontEntry->mnOrientation );
+#ifndef REMOTE_APPSERVER
+ ImplDrawPolygon( aPoly );
+#else
+ mpGraphics->DrawPolygon( aPoly );
+#endif
+ return;
+ }
+ }
+
+#ifndef REMOTE_APPSERVER
+ mpGraphics->DrawRect( nX, nY, nWidth, nHeight );
+#else
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ mpGraphics->DrawRect( aRect );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawTextBackground( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen,
+ const long* pDXAry )
+{
+#ifndef REMOTE_APPSERVER
+ if ( mbLineColor || mbInitLineColor )
+ {
+ mpGraphics->SetLineColor();
+ mbInitLineColor = TRUE;
+ }
+ mpGraphics->SetFillColor( ImplColorToSal( GetTextFillColor() ) );
+ mbInitFillColor = TRUE;
+
+ ImplDrawTextRect( nX, nY, nX, nY-mpFontEntry->maMetric.mnAscent,
+ ImplGetTextWidth( pStr, nLen, pDXAry ),
+ mpFontEntry->mnLineHeight );
+#else
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+ SetLineColor();
+ SetFillColor( GetTextFillColor() );
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ ImplDrawTextRect( nX, nY, nX, nY-mpFontEntry->maMetric.mnAscent,
+ ImplGetTextWidth( pStr, nLen, pDXAry ),
+ mpFontEntry->mnLineHeight );
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::ImplGetTextBoundRect( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen,
+ const long* pDXAry )
+{
+ if( !nLen )
+ return Rectangle();
+
+ if ( mbNewFont )
+ ImplNewFont();
+
+ if ( mbInitFont )
+ ImplInitFont();
+
+ long nBaseX = nX, nBaseY = nY;
+ long nWidth = ImplGetTextWidth( pStr, nLen, pDXAry ), nHeight = mpFontEntry->mnLineHeight;
+
+ nY -= mpFontEntry->maMetric.mnAscent;
+
+ if ( mpFontEntry->mnOrientation )
+ {
+ if ( !(mpFontEntry->mnOrientation % 900) )
+ {
+ long nX2 = nX+nWidth;
+ long nY2 = nY+nHeight;
+ ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation );
+ ImplRotatePos( nBaseX, nBaseY, nX2, nY2, mpFontEntry->mnOrientation );
+ nWidth = nX2-nX;
+ nHeight = nY2-nY;
+ }
+ else
+ {
+ // Da Polygone kleiner gezeichnet werden
+ nHeight++;
+ nWidth++;
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ Polygon aPoly( aRect );
+ aPoly.Rotate( Point( nBaseX, nBaseY ), mpFontEntry->mnOrientation );
+ return aPoly.GetBoundRect();
+ }
+ }
+
+ return Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplInitTextLineSize()
+{
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long nLineHeight;
+ long nLineHeight2;
+ long nBLineHeight;
+ long nBLineHeight2;
+ long n2LineHeight;
+ long n2LineDY;
+ long n2LineDY2;
+ long nUnderlineOffset;
+ long nStrikeoutOffset;
+
+ nLineHeight = ((mpFontEntry->maMetric.mnDescent*25)+50) / 100;
+ if ( !nLineHeight )
+ nLineHeight = 1;
+ nLineHeight2 = nLineHeight / 2;
+ if ( !nLineHeight2 )
+ nLineHeight2 = 1;
+
+ nBLineHeight = ((mpFontEntry->maMetric.mnDescent*50)+50) / 100;
+ if ( nBLineHeight == nLineHeight )
+ nBLineHeight++;
+ nBLineHeight2 = nBLineHeight/2;
+ if ( !nBLineHeight2 )
+ nBLineHeight2 = 1;
+
+ n2LineHeight = ((mpFontEntry->maMetric.mnDescent*16)+50) / 100;
+ if ( !n2LineHeight )
+ n2LineHeight = 1;
+ n2LineDY = n2LineHeight;
+ if ( n2LineDY <= 0 )
+ n2LineDY = 1;
+ n2LineDY2 = n2LineDY/2;
+ if ( !n2LineDY2 )
+ n2LineDY2 = 1;
+
+ nUnderlineOffset = mpFontEntry->maMetric.mnDescent/2 + 1;
+ nStrikeoutOffset = -((mpFontEntry->maMetric.mnAscent-mpFontEntry->maMetric.mnLeading)/3);
+
+ if ( !pFontEntry->maMetric.mnUnderlineSize )
+ {
+ pFontEntry->maMetric.mnUnderlineSize = nLineHeight;
+ pFontEntry->maMetric.mnUnderlineOffset = nUnderlineOffset - nLineHeight2;
+ }
+ if ( !pFontEntry->maMetric.mnBUnderlineSize )
+ {
+ pFontEntry->maMetric.mnBUnderlineSize = nBLineHeight;
+ pFontEntry->maMetric.mnBUnderlineOffset = nUnderlineOffset - nBLineHeight2;
+ }
+ if ( !pFontEntry->maMetric.mnDUnderlineSize )
+ {
+ pFontEntry->maMetric.mnDUnderlineSize = n2LineHeight;
+ pFontEntry->maMetric.mnDUnderlineOffset1 = nUnderlineOffset - n2LineDY2 - n2LineHeight;
+ pFontEntry->maMetric.mnDUnderlineOffset2 = pFontEntry->maMetric.mnDUnderlineOffset1 + n2LineDY + n2LineHeight;
+ }
+ if ( !pFontEntry->maMetric.mnWUnderlineSize )
+ {
+ if ( mpFontEntry->maMetric.mnDescent < 6 )
+ {
+ if ( (mpFontEntry->maMetric.mnDescent == 1) ||
+ (mpFontEntry->maMetric.mnDescent == 2) )
+ pFontEntry->maMetric.mnWUnderlineSize = mpFontEntry->maMetric.mnDescent;
+ else
+ pFontEntry->maMetric.mnWUnderlineSize = 3;
+ }
+ else
+ pFontEntry->maMetric.mnWUnderlineSize = ((mpFontEntry->maMetric.mnDescent*50)+50) / 100;
+ pFontEntry->maMetric.mnWUnderlineOffset = nUnderlineOffset;
+ }
+ if ( !pFontEntry->maMetric.mnStrikeoutSize )
+ {
+ pFontEntry->maMetric.mnStrikeoutSize = nLineHeight;
+ pFontEntry->maMetric.mnStrikeoutOffset = nStrikeoutOffset - nLineHeight2;
+ }
+ if ( !pFontEntry->maMetric.mnBStrikeoutSize )
+ {
+ pFontEntry->maMetric.mnBStrikeoutSize = nBLineHeight;
+ pFontEntry->maMetric.mnBStrikeoutOffset = nStrikeoutOffset - nBLineHeight2;
+ }
+ if ( !pFontEntry->maMetric.mnDStrikeoutSize )
+ {
+ pFontEntry->maMetric.mnDStrikeoutSize = n2LineHeight;
+ pFontEntry->maMetric.mnDStrikeoutOffset1 = nStrikeoutOffset - n2LineDY2 - n2LineHeight;
+ pFontEntry->maMetric.mnDStrikeoutOffset2 = pFontEntry->maMetric.mnDStrikeoutOffset1 + n2LineDY + n2LineHeight;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawWavePixel( long nOriginX, long nOriginY,
+ long nCurX, long nCurY,
+ short nOrientation,
+#ifndef REMOTE_APPSERVER
+ SalGraphics* pGraphics,
+#else
+ ImplServerGraphics* pGraphics,
+#endif
+ BOOL bDrawPixAsRect,
+ long nPixWidth, long nPixHeight )
+{
+ if ( nOrientation )
+ ImplRotatePos( nOriginX, nOriginY, nCurX, nCurY, nOrientation );
+
+ if ( bDrawPixAsRect )
+ {
+#ifndef REMOTE_APPSERVER
+ pGraphics->DrawRect( nCurX, nCurY, nPixWidth, nPixHeight );
+#else
+ Point aPos( nCurX, nCurY );
+ Size aSize( nPixWidth, nPixHeight );
+ Rectangle aRect( aPos, aSize );
+ pGraphics->DrawRect( aRect );
+#endif
+ }
+ else
+ {
+#ifndef REMOTE_APPSERVER
+ pGraphics->DrawPixel( nCurX, nCurY );
+#else
+ Point aPos( nCurX, nCurY );
+ pGraphics->DrawPixel( aPos );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
+ long nStartX, long nStartY,
+ long nWidth, long nHeight,
+ long nLineWidth, short nOrientation,
+ const Color& rColor )
+{
+ if ( !nHeight )
+ return;
+
+ // Bei Hoehe von 1 Pixel reicht es, eine Linie auszugeben
+ if ( (nLineWidth == 1) && (nHeight == 1) )
+ {
+#ifndef REMOTE_APPSERVER
+ mpGraphics->SetLineColor( ImplColorToSal( rColor ) );
+ mbInitLineColor = TRUE;
+#else
+ Color aOldLineColor = GetLineColor();
+ SetLineColor( rColor );
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+#endif
+
+ long nEndX = nStartX+nWidth;
+ long nEndY = nStartY;
+ if ( nOrientation )
+ {
+ ImplRotatePos( nBaseX, nBaseY, nStartX, nStartY, nOrientation );
+ ImplRotatePos( nBaseX, nBaseY, nEndX, nEndY, nOrientation );
+ }
+#ifndef REMOTE_APPSERVER
+ mpGraphics->DrawLine( nStartX, nStartY, nEndX, nEndY );
+#else
+ mpGraphics->DrawLine( Point( nStartX, nStartY ), Point( nEndX, nEndY ) );
+#endif
+
+#ifdef REMOTE_APPSERVER
+ SetLineColor( aOldLineColor );
+#endif
+ }
+ else
+ {
+ long nCurX = nStartX;
+ long nCurY = nStartY;
+ long nDiffX = 2;
+ long nDiffY = nHeight-1;
+ long nCount = nWidth;
+ long nOffY = -1;
+ long nFreq;
+ long i;
+ long nPixWidth;
+ long nPixHeight;
+ BOOL bDrawPixAsRect;
+#ifdef REMOTE_APPSERVER
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+#endif
+ // Auf Druckern die Pixel per DrawRect() ausgeben
+ if ( (GetOutDevType() == OUTDEV_PRINTER) || (nLineWidth > 1) )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( mbLineColor || mbInitLineColor )
+ {
+ mpGraphics->SetLineColor();
+ mbInitLineColor = TRUE;
+ }
+ mpGraphics->SetFillColor( ImplColorToSal( rColor ) );
+ mbInitFillColor = TRUE;
+#else
+ SetLineColor();
+ SetFillColor( rColor );
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+#endif
+ bDrawPixAsRect = TRUE;
+ nPixWidth = nLineWidth;
+ nPixHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY;
+ }
+ else
+ {
+#ifndef REMOTE_APPSERVER
+ mpGraphics->SetLineColor( ImplColorToSal( rColor ) );
+ mbInitLineColor = TRUE;
+#else
+ Color aOldLineColor = GetLineColor();
+ SetLineColor( rColor );
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+#endif
+ nPixWidth = 1;
+ nPixHeight = 1;
+ bDrawPixAsRect = FALSE;
+ }
+
+ if ( !nDiffY )
+ {
+ while ( nWidth )
+ {
+ ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation,
+ mpGraphics,
+ bDrawPixAsRect, nPixWidth, nPixHeight );
+ nCurX++;
+ nWidth--;
+ }
+ }
+ else
+ {
+ nCurY += nDiffY;
+ nFreq = nCount / (nDiffX+nDiffY);
+ while ( nFreq-- )
+ {
+ for( i = nDiffY; i; --i )
+ {
+ ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation,
+ mpGraphics,
+ bDrawPixAsRect, nPixWidth, nPixHeight );
+ nCurX++;
+ nCurY += nOffY;
+ }
+ for( i = nDiffX; i; --i )
+ {
+ ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation,
+ mpGraphics,
+ bDrawPixAsRect, nPixWidth, nPixHeight );
+ nCurX++;
+ }
+ nOffY = -nOffY;
+ }
+ nFreq = nCount % (nDiffX+nDiffY);
+ if ( nFreq )
+ {
+ for( i = nDiffY; i && nFreq; --i, --nFreq )
+ {
+ ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation,
+ mpGraphics,
+ bDrawPixAsRect, nPixWidth, nPixHeight );
+ nCurX++;
+ nCurY += nOffY;
+ }
+ for( i = nDiffX; i && nFreq; --i, --nFreq )
+ {
+ ImplDrawWavePixel( nBaseX, nBaseY, nCurX, nCurY, nOrientation,
+ mpGraphics,
+ bDrawPixAsRect, nPixWidth, nPixHeight );
+ nCurX++;
+ }
+ }
+ }
+
+#ifdef REMOTE_APPSERVER
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawTextLine( long nBaseX,
+ long nX, long nY, long nWidth,
+ FontStrikeout eStrikeout,
+ FontUnderline eUnderline )
+{
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ Color aTextLineColor = GetTextLineColor();
+ long nBaseY = nY;
+ long nLineHeight;
+ long nLinePos;
+ long nLinePos2;
+ long nLeft;
+ BOOL bNormalLines = TRUE;
+
+ if ( !IsTextLineColor() )
+ aTextLineColor = GetTextColor();
+
+ if ( (eUnderline == UNDERLINE_SMALLWAVE) ||
+ (eUnderline == UNDERLINE_WAVE) ||
+ (eUnderline == UNDERLINE_DOUBLEWAVE) ||
+ (eUnderline == UNDERLINE_BOLDWAVE) )
+ {
+ if ( !pFontEntry->maMetric.mnWUnderlineSize )
+ ImplInitTextLineSize();
+ nLineHeight = pFontEntry->maMetric.mnWUnderlineSize;
+ if ( (eUnderline == UNDERLINE_SMALLWAVE) &&
+ (nLineHeight > 3) )
+ nLineHeight = 3;
+ long nLineWidth = (mnDPIX/300);
+ if ( !nLineWidth )
+ nLineWidth = 1;
+ if ( eUnderline == UNDERLINE_BOLDWAVE )
+ nLineWidth *= 2;
+ nLinePos = nY + pFontEntry->maMetric.mnWUnderlineOffset - (nLineHeight / 2);
+ long nLineWidthHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY;
+ if ( eUnderline == UNDERLINE_DOUBLEWAVE )
+ {
+ long nOrgLineHeight = nLineHeight;
+ nLineHeight /= 3;
+ if ( nLineHeight < 2 )
+ {
+ if ( nOrgLineHeight > 1 )
+ nLineHeight = 2;
+ else
+ nLineHeight = 1;
+ }
+ long nLineDY = nOrgLineHeight-(nLineHeight*2);
+ if ( nLineDY < nLineWidthHeight )
+ nLineDY = nLineWidthHeight;
+ long nLineDY2 = nLineDY/2;
+ if ( !nLineDY2 )
+ nLineDY2 = 1;
+ nLinePos -= nLineWidthHeight-nLineDY2;
+ ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ nLineWidth, mpFontEntry->mnOrientation, aTextLineColor );
+ nLinePos += nLineWidthHeight+nLineDY;
+ ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ nLineWidth, mpFontEntry->mnOrientation, aTextLineColor );
+ }
+ else
+ {
+ nLinePos -= nLineWidthHeight/2;
+ ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ nLineWidth, mpFontEntry->mnOrientation, aTextLineColor );
+ }
+
+ if ( (eStrikeout == STRIKEOUT_NONE) ||
+ (eStrikeout == STRIKEOUT_DONTKNOW) )
+ bNormalLines = FALSE;
+ }
+
+ if ( bNormalLines &&
+ ((eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X)) )
+ {
+ BOOL bOldMap = IsMapModeEnabled();
+ EnableMapMode( FALSE );
+ Color aOldColor = GetTextColor();
+ SetTextColor( aTextLineColor );
+ ImplInitTextColor();
+ xub_Unicode c;
+ if ( eStrikeout == STRIKEOUT_SLASH )
+ c = '/';
+ else /* ( eStrikeout == STRIKEOUT_X ) */
+ c = 'X';
+ // Strikeout-String zusammenbauen
+ XubString aStrikeoutText( c );
+ aStrikeoutText += aStrikeoutText.GetChar( 0 );
+ long nStrikeoutWidth = GetTextWidth( aStrikeoutText );
+ long nChars = nWidth/(nStrikeoutWidth/2);
+ aStrikeoutText.Fill( (USHORT)(nChars+1), c );
+ // String solange kuerzen, bis er nicht allzuweit uebersteht
+ long nMaxWidth = nStrikeoutWidth/4;
+ if ( nMaxWidth < 2 )
+ nMaxWidth = 2;
+ nMaxWidth += nWidth;
+ long nFullStrikeoutWidth = GetTextWidth( aStrikeoutText );
+ while ( (nFullStrikeoutWidth > nMaxWidth) && aStrikeoutText.Len() )
+ {
+ aStrikeoutText.Erase( aStrikeoutText.Len()-1 );
+ nFullStrikeoutWidth = GetTextWidth( aStrikeoutText );
+ }
+ if ( mpFontEntry->mnOrientation )
+ ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation );
+ ImplDrawTextDirect( nX, nY,
+ aStrikeoutText.GetBuffer(), aStrikeoutText.Len(),
+ NULL, FALSE );
+ SetTextColor( aOldColor );
+ ImplInitTextColor();
+ EnableMapMode( bOldMap );
+
+ if ( (eUnderline == UNDERLINE_NONE) ||
+ (eUnderline == UNDERLINE_DONTKNOW) ||
+ (eUnderline == UNDERLINE_SMALLWAVE) ||
+ (eUnderline == UNDERLINE_WAVE) ||
+ (eUnderline == UNDERLINE_DOUBLEWAVE) ||
+ (eUnderline == UNDERLINE_BOLDWAVE) )
+ bNormalLines = FALSE;
+ }
+
+ if ( bNormalLines )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( mbLineColor || mbInitLineColor )
+ {
+ mpGraphics->SetLineColor();
+ mbInitLineColor = TRUE;
+ }
+ mpGraphics->SetFillColor( ImplColorToSal( aTextLineColor ) );
+ mbInitFillColor = TRUE;
+#else
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+ SetLineColor();
+ SetFillColor( aTextLineColor );
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+#endif
+
+ if ( eUnderline > UNDERLINE_LAST )
+ eUnderline = UNDERLINE_SINGLE;
+
+ if ( (eUnderline == UNDERLINE_SINGLE) ||
+ (eUnderline == UNDERLINE_DOTTED) ||
+ (eUnderline == UNDERLINE_DASH) ||
+ (eUnderline == UNDERLINE_LONGDASH) ||
+ (eUnderline == UNDERLINE_DASHDOT) ||
+ (eUnderline == UNDERLINE_DASHDOTDOT) )
+ {
+ if ( !pFontEntry->maMetric.mnUnderlineSize )
+ ImplInitTextLineSize();
+ nLineHeight = pFontEntry->maMetric.mnUnderlineSize;
+ nLinePos = nY + pFontEntry->maMetric.mnUnderlineOffset;
+ }
+ else if ( (eUnderline == UNDERLINE_BOLD) ||
+ (eUnderline == UNDERLINE_BOLDDOTTED) ||
+ (eUnderline == UNDERLINE_BOLDDASH) ||
+ (eUnderline == UNDERLINE_BOLDLONGDASH) ||
+ (eUnderline == UNDERLINE_BOLDDASHDOT) ||
+ (eUnderline == UNDERLINE_BOLDDASHDOTDOT) )
+ {
+ if ( !pFontEntry->maMetric.mnBUnderlineSize )
+ ImplInitTextLineSize();
+ nLineHeight = pFontEntry->maMetric.mnBUnderlineSize;
+ nLinePos = nY + pFontEntry->maMetric.mnBUnderlineOffset;
+ }
+ else if ( eUnderline == UNDERLINE_DOUBLE )
+ {
+ if ( !pFontEntry->maMetric.mnDUnderlineSize )
+ ImplInitTextLineSize();
+ nLineHeight = pFontEntry->maMetric.mnDUnderlineSize;
+ nLinePos = nY + pFontEntry->maMetric.mnDUnderlineOffset1;
+ nLinePos2 = nY + pFontEntry->maMetric.mnDUnderlineOffset2;
+ }
+ else
+ nLineHeight = 0;
+
+ if ( nLineHeight )
+ {
+ nLeft = nX;
+
+ if ( (eUnderline == UNDERLINE_SINGLE) ||
+ (eUnderline == UNDERLINE_BOLD) )
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
+ else if ( eUnderline == UNDERLINE_DOUBLE )
+ {
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos2, nWidth, nLineHeight );
+ }
+ else if ( (eUnderline == UNDERLINE_DOTTED) ||
+ (eUnderline == UNDERLINE_BOLDDOTTED) )
+ {
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nTempWidth = nDotWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempWidth > nEnd )
+ nTempWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ }
+ }
+ else if ( (eUnderline == UNDERLINE_DASH) ||
+ (eUnderline == UNDERLINE_LONGDASH) ||
+ (eUnderline == UNDERLINE_BOLDDASH) ||
+ (eUnderline == UNDERLINE_BOLDLONGDASH) )
+ {
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nMinDashWidth;
+ long nMinSpaceWidth;
+ long nSpaceWidth;
+ long nDashWidth;
+ if ( (eUnderline == UNDERLINE_LONGDASH) ||
+ (eUnderline == UNDERLINE_BOLDLONGDASH) )
+ {
+ nMinDashWidth = nDotWidth*6;
+ nMinSpaceWidth = nDotWidth*2;
+ nDashWidth = 200;
+ nSpaceWidth = 100;
+ }
+ else
+ {
+ nMinDashWidth = nDotWidth*4;
+ nMinSpaceWidth = (nDotWidth*150)/100;
+ nDashWidth = 100;
+ nSpaceWidth = 50;
+ }
+ nDashWidth = ((nDashWidth*mnDPIX)+1270)/2540;
+ nSpaceWidth = ((nSpaceWidth*mnDPIX)+1270)/2540;
+ // DashWidth wird gegebenenfalls verbreitert, wenn
+ // die dicke der Linie im Verhaeltnis zur Laenge
+ // zu dick wird
+ if ( nDashWidth < nMinDashWidth )
+ nDashWidth = nMinDashWidth;
+ if ( nSpaceWidth < nMinSpaceWidth )
+ nSpaceWidth = nMinSpaceWidth;
+ long nTempWidth = nDashWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempWidth > nEnd )
+ nTempWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight );
+ nLeft += nDashWidth+nSpaceWidth;
+ }
+ }
+ else if ( (eUnderline == UNDERLINE_DASHDOT) ||
+ (eUnderline == UNDERLINE_BOLDDASHDOT) )
+ {
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nDashWidth = ((100*mnDPIX)+1270)/2540;
+ long nMinDashWidth = nDotWidth*4;
+ // DashWidth wird gegebenenfalls verbreitert, wenn
+ // die dicke der Linie im Verhaeltnis zur Laenge
+ // zu dick wird
+ if ( nDashWidth < nMinDashWidth )
+ nDashWidth = nMinDashWidth;
+ long nTempDotWidth = nDotWidth;
+ long nTempDashWidth = nDashWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempDotWidth > nEnd )
+ nTempDotWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ if ( nLeft > nEnd )
+ break;
+ if ( nLeft+nTempDashWidth > nEnd )
+ nTempDashWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight );
+ nLeft += nDashWidth+nDotWidth;
+ }
+ }
+ else if ( (eUnderline == UNDERLINE_DASHDOTDOT) ||
+ (eUnderline == UNDERLINE_BOLDDASHDOTDOT) )
+ {
+ long nDotWidth = nLineHeight*mnDPIY;
+ nDotWidth += mnDPIY/2;
+ nDotWidth /= mnDPIY;
+ long nDashWidth = ((100*mnDPIX)+1270)/2540;
+ long nMinDashWidth = nDotWidth*4;
+ // DashWidth wird gegebenenfalls verbreitert, wenn
+ // die dicke der Linie im Verhaeltnis zur Laenge
+ // zu dick wird
+ if ( nDashWidth < nMinDashWidth )
+ nDashWidth = nMinDashWidth;
+ long nTempDotWidth = nDotWidth;
+ long nTempDashWidth = nDashWidth;
+ long nEnd = nLeft+nWidth;
+ while ( nLeft < nEnd )
+ {
+ if ( nLeft+nTempDotWidth > nEnd )
+ nTempDotWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ if ( nLeft > nEnd )
+ break;
+ if ( nLeft+nTempDotWidth > nEnd )
+ nTempDotWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight );
+ nLeft += nDotWidth*2;
+ if ( nLeft > nEnd )
+ break;
+ if ( nLeft+nTempDashWidth > nEnd )
+ nTempDashWidth = nEnd-nLeft;
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight );
+ nLeft += nDashWidth+nDotWidth;
+ }
+ }
+ }
+
+ if ( eStrikeout > STRIKEOUT_LAST )
+ eStrikeout = STRIKEOUT_SINGLE;
+
+ if ( eStrikeout == STRIKEOUT_SINGLE )
+ {
+ if ( !pFontEntry->maMetric.mnStrikeoutSize )
+ ImplInitTextLineSize();
+ nLineHeight = pFontEntry->maMetric.mnStrikeoutSize;
+ nLinePos = nY + pFontEntry->maMetric.mnStrikeoutOffset;
+ }
+ else if ( eStrikeout == STRIKEOUT_BOLD )
+ {
+ if ( !pFontEntry->maMetric.mnBStrikeoutSize )
+ ImplInitTextLineSize();
+ nLineHeight = pFontEntry->maMetric.mnBStrikeoutSize;
+ nLinePos = nY + pFontEntry->maMetric.mnBStrikeoutOffset;
+ }
+ else if ( eStrikeout == STRIKEOUT_DOUBLE )
+ {
+ if ( !pFontEntry->maMetric.mnDStrikeoutSize )
+ ImplInitTextLineSize();
+ nLineHeight = pFontEntry->maMetric.mnDStrikeoutSize;
+ nLinePos = nY + pFontEntry->maMetric.mnDStrikeoutOffset1;
+ nLinePos2 = nY + pFontEntry->maMetric.mnDStrikeoutOffset2;
+ }
+ else
+ nLineHeight = 0;
+
+ if ( nLineHeight )
+ {
+ nLeft = nX;
+
+ if ( (eStrikeout == STRIKEOUT_SINGLE) ||
+ (eStrikeout == STRIKEOUT_BOLD) )
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
+ else if ( eStrikeout == STRIKEOUT_DOUBLE )
+ {
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight );
+ ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos2, nWidth, nLineHeight );
+ }
+ }
+
+#ifdef REMOTE_APPSERVER
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawTextLines( long nX, long nY,
+ const sal_Unicode* pStr, xub_StrLen nLen,
+ const long* pDXAry,
+ FontStrikeout eStrikeout,
+ FontUnderline eUnderline,
+ BOOL bWordLine )
+{
+ if ( bWordLine )
+ {
+ ::rtl::OUString aText( pStr, nLen );
+ uno::Reference < text::XBreakIterator > xBI = vcl::unohelper::CreateBreakIterator();
+ uno::Reference< linguistic::XHyphenator > xHyph;
+ text::LineBreakHyphenationOptions aHyphOptions( xHyph, 1 );
+ text::LineBreakUserOptions aUserOptions;
+
+ text::Boundary aBoundary = xBI->getWordBoundary( aText, 0, GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES, TRUE );
+ while ( ( aBoundary.startPos >= 0 ) && ( aBoundary.startPos < nLen ) )
+ {
+ xub_StrLen nWordEnd = Max( (xub_StrLen)aBoundary.endPos, nLen );
+ long nTempX = ImplGetTextWidth( pStr, aBoundary.startPos, pDXAry );
+ long nWidth = ImplGetTextWidth( pStr+aBoundary.startPos, aBoundary.endPos-aBoundary.startPos, pDXAry );
+ ImplDrawTextLine( nX, nX + nTempX, nY, nWidth, eStrikeout, eUnderline );
+ aBoundary = xBI->nextWord( aText, aBoundary.endPos, GetSettings().GetLocale(), text::WordType::ANYWORD_IGNOREWHITESPACES );
+ }
+ }
+ else
+ {
+ ImplDrawTextLine( nX, nX, nY, ImplGetTextWidth( pStr, nLen, pDXAry ), eStrikeout, eUnderline );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, xub_Unicode c )
+{
+ ImplDrawTextLines( nX, nY, &c, 1, NULL, STRIKEOUT_NONE, UNDERLINE_SINGLE, FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::ImplDrawRotateText( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen,
+ const long* pDXAry )
+{
+ if ( !mpOutDevData )
+ ImplInitOutDevData();
+ if ( !mpOutDevData->mpRotateDev )
+ mpOutDevData->mpRotateDev = new VirtualDevice( *this, 1 );
+ VirtualDevice* pVDev = mpOutDevData->mpRotateDev;
+ long nWidth = ImplGetTextWidth( pStr, nLen, pDXAry );
+ long nHeight = mpFontEntry->mnLineHeight;
+ Size aSize( nWidth, nHeight );
+
+ if ( pVDev->SetOutputSizePixel( aSize ) )
+ {
+ Font aFont( GetFont() );
+ Bitmap aBmp;
+ long nOff;
+
+ nX -= mnTextOffX;
+ nY -= mnTextOffY;
+ if ( GetTextAlign() == ALIGN_TOP )
+ {
+ nOff = 0L;
+ nY += mpFontEntry->maMetric.mnAscent;
+ }
+ else if ( GetTextAlign() == ALIGN_BOTTOM )
+ {
+ nOff = mpFontEntry->maMetric.mnAscent;
+ nY += -mpFontEntry->maMetric.mnDescent;
+ }
+ else
+ nOff = mpFontEntry->maMetric.mnAscent;
+
+ aFont.SetShadow( FALSE );
+ aFont.SetOutline( FALSE );
+ aFont.SetOrientation( 0 );
+ aFont.SetSize( Size( mpFontEntry->maFontSelData.mnWidth, mpFontEntry->maFontSelData.mnHeight ) );
+ pVDev->SetFont( aFont );
+ // Da Farben und Alignment noch im Font haengen, muessen diese jedesmal
+ // gesetzt werden
+ pVDev->SetTextAlign( ALIGN_TOP );
+ pVDev->SetTextColor( Color( COL_BLACK ) );
+ pVDev->SetTextFillColor();
+ pVDev->ImplNewFont();
+ pVDev->ImplInitFont();
+ pVDev->ImplInitTextColor();
+ pVDev->ImplDrawText( 0, 0, pStr, nLen, pDXAry );
+
+ aBmp = pVDev->GetBitmap( Point(), aSize );
+ if ( !!aBmp && aBmp.Rotate( mpFontEntry->mnOwnOrientation, COL_WHITE ) )
+ {
+ Point aTempPoint;
+ Polygon aPoly( Rectangle( aTempPoint, aSize ) );
+ long nOldOffX = mnOutOffX;
+ long nOldOffY = mnOutOffY;
+ BOOL bOldMap = mbMap;
+
+ aTempPoint.Y() = nOff;
+ aPoly.Rotate( aTempPoint, mpFontEntry->mnOwnOrientation );
+ const Rectangle aBound( aPoly.GetBoundRect() );
+
+ mnOutOffX = 0L;
+ mnOutOffY = 0L;
+ mbMap = FALSE;
+
+ DrawMask( Point( nX + aBound.Left(),
+ nY + aBound.Top() - mpFontEntry->maMetric.mnAscent ),
+ aBmp, GetTextColor() );
+
+ mnOutOffX = nOldOffX;
+ mnOutOffY = nOldOffY;
+ mbMap = bOldMap;
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawTextDirect( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen,
+ const long* pDXAry,
+ BOOL bTextLines )
+{
+ BOOL bDraw = FALSE;
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ if ( pFontEntry->mnOwnOrientation )
+ bDraw = ImplDrawRotateText( nX, nY, pStr, nLen, pDXAry );
+ if ( !bDraw )
+ {
+ if ( !pDXAry )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( pFontEntry->mnSetFontFlags & SAL_SETFONT_USEDRAWTEXTARRAY )
+ {
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+ long nFactor = pFontEntry->mnWidthFactor;
+ long nOffset = 0;
+ long aStackAry[128];
+ long* pTempDXAry = (long*)ImplGetStackBuffer( sizeof(long)*(nLen-1), aStackAry, sizeof( aStackAry ) );
+ for ( USHORT i = 0; i < nLen-1; i++ )
+ {
+ nOffset += ImplGetCharWidth( pStr[i] );
+ pTempDXAry[i] = nOffset / nFactor;
+ }
+ mpGraphics->DrawTextArray( nX, nY, pStr, nLen, pTempDXAry );
+ ImplReleaseStackBuffer( pTempDXAry, aStackAry );
+ }
+ else
+#endif
+ mpGraphics->DrawText( nX, nY, pStr, nLen );
+ }
+ else
+ {
+#ifndef REMOTE_APPSERVER
+ if ( pFontEntry->mnSetFontFlags & SAL_SETFONT_USEDRAWTEXT )
+ {
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+ long nFactor = pFontEntry->mnWidthFactor;
+ long nOffset = 0;
+ long nDiff;
+ long nTempX = nX;
+ const sal_Unicode* pTempStr = pStr;
+ xub_StrLen nCombineChars = 1;
+ for ( xub_StrLen i = 0; i < nLen-1; i++ )
+ {
+ nOffset += ImplGetCharWidth( pStr[i] );
+ nDiff = (nOffset/nFactor) - pDXAry[i];
+ if ( (nDiff < -1) || (nDiff > 0) )
+ {
+ mpGraphics->DrawText( nTempX, nY, pTempStr, nCombineChars );
+ nTempX = nX+pDXAry[i];
+ nOffset = pDXAry[i]*nFactor;
+ pTempStr += nCombineChars;
+ nCombineChars = 1;
+ }
+ else
+ nCombineChars++;
+ }
+ mpGraphics->DrawText( nTempX, nY, pTempStr, nCombineChars );
+ }
+ else
+#endif
+ mpGraphics->DrawTextArray( nX, nY, pStr, nLen, pDXAry );
+ }
+
+ if ( bTextLines )
+ {
+ ImplDrawTextLines( nX, nY, pStr, nLen, pDXAry,
+ maFont.GetStrikeout(),
+ maFont.GetUnderline(),
+ maFont.IsWordLineMode() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawSpecialText( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen,
+ const long* pDXAry )
+{
+ Color aOldColor = GetTextColor();
+ Color aOldTextLineColor = GetTextLineColor();
+
+ if ( maFont.IsShadow() )
+ {
+ long nOff = 1 + ((mpFontEntry->mnLineHeight-24)/24);
+ if ( maFont.IsOutline() )
+ nOff++;
+ SetTextLineColor();
+ if ( GetTextColor().GetColor() == COL_BLACK )
+ SetTextColor( Color( COL_LIGHTGRAY ) );
+ else
+ SetTextColor( Color( COL_BLACK ) );
+ ImplInitTextColor();
+ ImplDrawTextDirect( nX+nOff, nY+nOff, pStr, nLen, pDXAry, mbTextLines );
+ SetTextColor( aOldColor );
+ SetTextLineColor( aOldTextLineColor );
+ ImplInitTextColor();
+
+ if ( !maFont.IsOutline() )
+ ImplDrawTextDirect( nX, nY, pStr, nLen, pDXAry, mbTextLines );
+ }
+
+ if ( maFont.IsOutline() )
+ {
+ ImplDrawTextDirect( nX-1, nY+1, pStr, nLen, pDXAry, mbTextLines );
+ ImplDrawTextDirect( nX, nY+1, pStr, nLen, pDXAry, mbTextLines );
+ ImplDrawTextDirect( nX+1, nY+1, pStr, nLen, pDXAry, mbTextLines );
+ ImplDrawTextDirect( nX-1, nY, pStr, nLen, pDXAry, mbTextLines );
+ ImplDrawTextDirect( nX+1, nY, pStr, nLen, pDXAry, mbTextLines );
+ ImplDrawTextDirect( nX-1, nY-1, pStr, nLen, pDXAry, mbTextLines );
+ ImplDrawTextDirect( nX, nY-1, pStr, nLen, pDXAry, mbTextLines );
+ ImplDrawTextDirect( nX+1, nY-1, pStr, nLen, pDXAry, mbTextLines );
+
+ SetTextColor( Color( COL_WHITE ) );
+ SetTextLineColor( Color( COL_WHITE ) );
+ ImplInitTextColor();
+ ImplDrawTextDirect( nX, nY, pStr, nLen, pDXAry, mbTextLines );
+ SetTextColor( aOldColor );
+ SetTextLineColor( aOldTextLineColor );
+ ImplInitTextColor();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawText( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen, const long* pDXAry )
+{
+ nX += mnTextOffX;
+ nY += mnTextOffY;
+
+ if ( IsTextFillColor() )
+ ImplDrawTextBackground( nX, nY, pStr, nLen, pDXAry );
+
+ if ( mbTextSpecial )
+ ImplDrawSpecialText( nX, nY, pStr, nLen, pDXAry );
+ else
+ ImplDrawTextDirect( nX, nY, pStr, nLen, pDXAry, mbTextLines );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplFillDXAry( long* pDXAry,
+ const xub_Unicode* pStr, xub_StrLen nLen, long nWidth )
+{
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+ long nFactor = pFontEntry->mnWidthFactor;
+
+ // Breiten-Array fuer errechnete Werte mit den Breiten der einzelnen
+ // Character fuellen
+ xub_StrLen i;
+ long nSum = 0;
+ for ( i = 0; i < nLen; i++ )
+ {
+ // Characterbreiten ueber Array holen
+ nSum += ImplGetCharWidth( pStr[i] );
+ pDXAry[i] = nSum / nFactor;
+ }
+ nSum /= nFactor;
+
+ // Differenz zwischen Soll- und Ist-Laenge errechnen
+ // Zusaetzliche Pixel per Character errechnen
+ // Anzahl der zusaetzlich verbliebenen Pixel errechnen
+ long nDelta = (long)nWidth - nSum;
+ long nDeltaPerChar = 0;
+ long nDeltaRest = 0;
+ if ( nLen > 1 )
+ {
+ nDeltaPerChar = nDelta / (long)(nLen-1);
+ nDeltaRest = nDelta % (long)(nLen-1);
+ }
+ long nDeltaRestAbs = Abs( nDeltaRest );
+
+ long nErrorSum = nDeltaRestAbs;
+ long nDeltaSum = 0;
+ for ( i = 0; i < nLen-1; i++, nErrorSum += nDeltaRestAbs )
+ {
+ nDeltaSum += nDeltaPerChar;
+ if ( nErrorSum >= nLen-1 )
+ {
+ nErrorSum -= nLen-1;
+ if ( nDeltaRest > 0 )
+ nDeltaSum++;
+ else if ( nDeltaRest < 0 )
+ nDeltaSum--;
+ }
+ pDXAry[i] += nDeltaSum;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
+ long nWidth, const XubString& rStr,
+ USHORT nStyle ) const
+{
+ DBG_ASSERT( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" );
+
+ long nMaxLineWidth = 0;
+ rLineInfo.Clear();
+ if ( rStr.Len() && ( nWidth > 0 ) )
+ {
+ ::rtl::OUString aText( rStr );
+ uno::Reference < text::XBreakIterator > xBI;
+ uno::Reference< linguistic::XHyphenator > xHyph;
+ text::LineBreakHyphenationOptions aHyphOptions( xHyph, 1 );
+ text::LineBreakUserOptions aUserOptions;
+
+ USHORT nPos = 0;
+ USHORT nLen = rStr.Len();
+ while ( nPos < nLen )
+ {
+ xub_StrLen nBreakPos = nPos;
+ while ( ( nBreakPos < nLen ) && ( rStr.GetChar( nBreakPos ) != _CR ) && ( rStr.GetChar( nBreakPos ) != _LF ) )
+ nBreakPos++;
+
+ long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos );
+ if ( ( nLineWidth > nWidth ) && ( nStyle & TEXT_DRAW_WORDBREAK ) )
+ {
+ if ( !xBI.is() )
+ xBI = vcl::unohelper::CreateBreakIterator();
+
+ xub_StrLen nSoftBreak = GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos );
+ DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" );
+ text::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, GetSettings().GetLocale(), nPos, aHyphOptions, aUserOptions );
+ nBreakPos = aLBR.breakIndex;
+ if ( nBreakPos <= nPos )
+ nBreakPos = nSoftBreak;
+ nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos );
+ }
+
+ if ( nLineWidth > nMaxLineWidth )
+ nMaxLineWidth = nLineWidth;
+
+ if ( ( rStr.GetChar( nBreakPos ) == _CR ) || ( rStr.GetChar( nBreakPos ) == _LF ) )
+ {
+ nBreakPos++;
+ // CR/LF?
+ if ( ( nPos < nLen ) && ( rStr.GetChar( nBreakPos ) == _LF ) && ( rStr.GetChar( nBreakPos-1 ) == _CR ) )
+ nBreakPos++;
+ }
+
+ if ( nBreakPos == nPos )
+ nBreakPos++;
+
+ rLineInfo.AddLine( new ImplTextLineInfo( nLineWidth, nPos, nBreakPos-nPos ) );
+
+ nPos = nBreakPos;
+ }
+ }
+
+ return nMaxLineWidth;
+}
+
+// =======================================================================
+
+void OutputDevice::SetFont( const Font& rNewFont )
+{
+ DBG_TRACE( "OutputDevice::SetFont()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rNewFont, Font, NULL );
+
+ Font aFont( rNewFont );
+
+ if ( mnDrawMode & (DRAWMODE_BLACKTEXT | DRAWMODE_WHITETEXT | DRAWMODE_GRAYTEXT | DRAWMODE_GHOSTEDTEXT |
+ DRAWMODE_BLACKFILL | DRAWMODE_WHITEFILL | DRAWMODE_GRAYFILL | DRAWMODE_NOFILL |
+ DRAWMODE_GHOSTEDFILL) )
+ {
+ Color aTextColor( aFont.GetColor() );
+ if ( mnDrawMode & DRAWMODE_BLACKTEXT )
+ aTextColor = Color( COL_BLACK );
+ else if ( mnDrawMode & DRAWMODE_WHITETEXT )
+ aTextColor = Color( COL_WHITE );
+ else if ( mnDrawMode & DRAWMODE_GRAYTEXT )
+ {
+ const UINT8 cLum = aTextColor.GetLuminance();
+ aTextColor = Color( cLum, cLum, cLum );
+ }
+ if ( mnDrawMode & DRAWMODE_GHOSTEDTEXT )
+ {
+ aTextColor = Color( (aTextColor.GetRed() >> 1 ) | 0x80,
+ (aTextColor.GetGreen() >> 1 ) | 0x80,
+ (aTextColor.GetBlue() >> 1 ) | 0x80 );
+ }
+ aFont.SetColor( aTextColor );
+
+ BOOL bTransFill = aFont.IsTransparent();
+ if ( !bTransFill )
+ {
+ Color aTextFillColor( aFont.GetFillColor() );
+ if ( mnDrawMode & DRAWMODE_BLACKFILL )
+ aTextFillColor = Color( COL_BLACK );
+ else if ( mnDrawMode & DRAWMODE_WHITEFILL )
+ aTextFillColor = Color( COL_WHITE );
+ else if ( mnDrawMode & DRAWMODE_GRAYFILL )
+ {
+ const UINT8 cLum = aTextFillColor.GetLuminance();
+ aTextFillColor = Color( cLum, cLum, cLum );
+ }
+ else if ( mnDrawMode & DRAWMODE_NOFILL )
+ {
+ aTextFillColor = Color( COL_TRANSPARENT );
+ bTransFill = TRUE;
+ }
+ if ( !bTransFill && (mnDrawMode & DRAWMODE_GHOSTEDFILL) )
+ {
+ aTextFillColor = Color( (aTextFillColor.GetRed() >> 1) | 0x80,
+ (aTextFillColor.GetGreen() >> 1) | 0x80,
+ (aTextFillColor.GetBlue() >> 1) | 0x80 );
+ }
+ aFont.SetFillColor( aTextFillColor );
+ }
+ }
+
+ if ( mpMetaFile )
+ {
+ const Color& rTextFillColor = aFont.GetFillColor();
+
+ mpMetaFile->AddAction( new MetaFontAction( aFont ) );
+ mpMetaFile->AddAction( new MetaTextAlignAction( aFont.GetAlign() ) );
+ mpMetaFile->AddAction( new MetaTextColorAction( aFont.GetColor() ) );
+ mpMetaFile->AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
+ }
+
+ if ( !maFont.IsSameInstance( aFont ) )
+ {
+ if ( maFont.GetColor() != aFont.GetColor() )
+ mbInitTextColor = TRUE;
+ maFont = aFont;
+ mbNewFont = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetTextColor( const Color& rColor )
+{
+ DBG_TRACE( "OutputDevice::SetTextColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor( rColor );
+
+ if ( mnDrawMode & ( DRAWMODE_BLACKTEXT | DRAWMODE_WHITETEXT |
+ DRAWMODE_GRAYTEXT | DRAWMODE_GHOSTEDTEXT ) )
+ {
+ if ( mnDrawMode & DRAWMODE_BLACKTEXT )
+ aColor = Color( COL_BLACK );
+ else if ( mnDrawMode & DRAWMODE_WHITETEXT )
+ aColor = Color( COL_WHITE );
+ else if ( mnDrawMode & DRAWMODE_GRAYTEXT )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+
+ if ( mnDrawMode & DRAWMODE_GHOSTEDTEXT )
+ {
+ aColor = Color( (aColor.GetRed() >> 1) | 0x80,
+ (aColor.GetGreen() >> 1) | 0x80,
+ (aColor.GetBlue() >> 1) | 0x80 );
+ }
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextColorAction( aColor ) );
+
+ if ( maFont.GetColor() != aColor )
+ {
+ maFont.SetColor( aColor );
+ mbInitTextColor = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetTextFillColor()
+{
+ DBG_TRACE( "OutputDevice::SetTextFillColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextFillColorAction( Color(), FALSE ) );
+
+ if ( maFont.GetColor() != Color( COL_TRANSPARENT ) )
+ maFont.SetFillColor( Color( COL_TRANSPARENT ) );
+ if ( !maFont.IsTransparent() )
+ maFont.SetTransparent( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetTextFillColor( const Color& rColor )
+{
+ DBG_TRACE( "OutputDevice::SetTextFillColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor( rColor );
+ BOOL bTransFill = ImplIsColorTransparent( aColor );
+
+ if ( !bTransFill )
+ {
+ if ( mnDrawMode & ( DRAWMODE_BLACKFILL | DRAWMODE_WHITEFILL |
+ DRAWMODE_GRAYFILL | DRAWMODE_NOFILL |
+ DRAWMODE_GHOSTEDFILL ) )
+ {
+ if ( mnDrawMode & DRAWMODE_BLACKFILL )
+ aColor = Color( COL_BLACK );
+ else if ( mnDrawMode & DRAWMODE_WHITEFILL )
+ aColor = Color( COL_WHITE );
+ else if ( mnDrawMode & DRAWMODE_GRAYFILL )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+ else if ( mnDrawMode & DRAWMODE_NOFILL )
+ {
+ aColor = Color( COL_TRANSPARENT );
+ bTransFill = TRUE;
+ }
+ if ( !bTransFill && (mnDrawMode & DRAWMODE_GHOSTEDFILL) )
+ {
+ aColor = Color( (aColor.GetRed() >> 1) | 0x80,
+ (aColor.GetGreen() >> 1) | 0x80,
+ (aColor.GetBlue() >> 1) | 0x80 );
+ }
+ }
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextFillColorAction( aColor, TRUE ) );
+
+ if ( maFont.GetFillColor() != aColor )
+ maFont.SetFillColor( aColor );
+ if ( maFont.IsTransparent() != bTransFill )
+ maFont.SetTransparent( bTransFill );
+}
+
+// -----------------------------------------------------------------------
+
+Color OutputDevice::GetTextFillColor() const
+{
+ if ( maFont.IsTransparent() )
+ return Color( COL_TRANSPARENT );
+ else
+ return maFont.GetFillColor();
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetTextLineColor()
+{
+ DBG_TRACE( "OutputDevice::SetTextLineColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextLineColorAction( Color(), FALSE ) );
+
+ maTextLineColor = Color( COL_TRANSPARENT );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetTextLineColor( const Color& rColor )
+{
+ DBG_TRACE( "OutputDevice::SetTextLineColor()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Color aColor( rColor );
+
+ if ( mnDrawMode & ( DRAWMODE_BLACKTEXT | DRAWMODE_WHITETEXT |
+ DRAWMODE_GRAYTEXT | DRAWMODE_GHOSTEDTEXT ) )
+ {
+ if ( mnDrawMode & DRAWMODE_BLACKTEXT )
+ aColor = Color( COL_BLACK );
+ else if ( mnDrawMode & DRAWMODE_WHITETEXT )
+ aColor = Color( COL_WHITE );
+ else if ( mnDrawMode & DRAWMODE_GRAYTEXT )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+
+ if ( mnDrawMode & DRAWMODE_GHOSTEDTEXT )
+ {
+ aColor = Color( (aColor.GetRed() >> 1) | 0x80,
+ (aColor.GetGreen() >> 1) | 0x80,
+ (aColor.GetBlue() >> 1) | 0x80 );
+ }
+ }
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextLineColorAction( aColor, TRUE ) );
+
+ maTextLineColor = aColor;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetTextAlign( TextAlign eAlign )
+{
+ DBG_TRACE( "OutputDevice::SetTextAlign()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextAlignAction( eAlign ) );
+
+ if ( maFont.GetAlign() != eAlign )
+ {
+ maFont.SetAlign( eAlign );
+ mbNewFont = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
+ FontStrikeout eStrikeout,
+ FontUnderline eUnderline )
+{
+ DBG_TRACE( "OutputDevice::DrawTextLine()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline ) );
+
+ if ( ((eUnderline == UNDERLINE_NONE) || (eUnderline == UNDERLINE_DONTKNOW)) &&
+ ((eStrikeout == STRIKEOUT_NONE) || (eStrikeout == STRIKEOUT_DONTKNOW)) )
+ return;
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+#else
+ if ( !ImplGetServerGraphics() )
+ return;
+#endif
+
+ if ( mbNewFont )
+ {
+ if ( !ImplNewFont() )
+ return;
+ }
+
+ Point aPos = ImplLogicToDevicePixel( rPos );
+ nWidth = ImplLogicWidthToDevicePixel( nWidth );
+ aPos.X() += mnTextOffX;
+ aPos.Y() += mnTextOffY;
+ ImplDrawTextLine( aPos.X(), aPos.X(), aPos.Y(), nWidth, eStrikeout, eUnderline );
+}
+
+// ------------------------------------------------------------------------
+
+void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos,
+ USHORT nStyle )
+{
+ DBG_TRACE( "OutputDevice::DrawWaveLine()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+#ifndef REMOTE_APPSERVER
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ Point aStartPt = ImplLogicToDevicePixel( rStartPos );
+ Point aEndPt = ImplLogicToDevicePixel( rEndPos );
+ long nStartX = aStartPt.X();
+ long nStartY = aStartPt.Y();
+ long nEndX = aEndPt.X();
+ long nEndY = aEndPt.Y();
+ short nOrientation = 0;
+
+ if ( (nStartY != nEndY) || (nStartX > nEndX) )
+ {
+ long nDX = nEndX - nStartX;
+ double nO = atan2( -nEndY + nStartY, ((nDX == 0L) ? 0.000000001 : nDX) );
+ nO /= F_PI1800;
+ nOrientation = (short)nO;
+ ImplRotatePos( nStartX, nStartY, nEndX, nEndY, -nOrientation );
+ }
+
+ long nWaveHeight;
+ if ( nStyle == WAVE_NORMAL )
+ {
+ nWaveHeight = 3;
+ nStartY++;
+ nEndY++;
+ }
+ else if( nStyle == WAVE_SMALL )
+ {
+ nWaveHeight = 2;
+ nStartY++;
+ nEndY++;
+ }
+ else // WAVE_FLAT
+ nWaveHeight = 1;
+
+ ImplDrawWaveLine( nStartX, nStartY, nStartX, nStartY,
+ nEndX-nStartX, nWaveHeight, 1,
+ nOrientation, GetLineColor() );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ Point aPos1 = ImplLogicToDevicePixel( rStartPos );
+ Point aPos2 = ImplLogicToDevicePixel( rEndPos );
+ pGraphics->DrawWaveLine( aPos1, aPos2, nStyle );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawText( const Point& rStartPt, const XubString& rStr,
+ xub_StrLen nIndex, xub_StrLen nLen )
+{
+ DBG_TRACE( "OutputDevice::DrawText()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextAction( rStartPt, rStr, nIndex, nLen ) );
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ // String-Laenge fuer die Ermittlung der Groesse setzen
+ if ( (ULONG)nLen+nIndex > rStr.Len() )
+ {
+ if ( nIndex < rStr.Len() )
+ nLen = rStr.Len()-nIndex;
+ else
+ nLen = 0;
+ }
+
+ // Ist die Ausgabe leer, dann mache nichts
+ if ( !nLen )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+#else
+ if ( !ImplGetServerGraphics() )
+ return;
+#endif
+
+ if ( mbNewFont )
+ ImplNewFont();
+ if ( mbInitFont )
+ ImplInitFont();
+ if ( mbInitTextColor )
+ ImplInitTextColor();
+
+ Point aStartPt = ImplLogicToDevicePixel( rStartPt );
+
+ // Pointer auf den String-Buffer setzen und um den Index korrigieren
+ const sal_Unicode* pStr = rStr.GetBuffer();
+ pStr += nIndex;
+
+ if ( mbKerning )
+ {
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+ long nFactor = pFontEntry->mnWidthFactor;
+ USHORT i;
+
+ // DX-Array berechnen
+ long nOffset = 0;
+ long aStackAry[128];
+ long* pDXAry = (long*)ImplGetStackBuffer( sizeof(long)*(nLen-1), aStackAry, sizeof( aStackAry ) );
+ for ( i = 0; i < nLen-1; i++ )
+ {
+ nOffset += pCharWidthAry[(unsigned char)pStr[i]];
+ pDXAry[i] = nOffset / nFactor;
+ }
+ ImplCalcKerning( pStr, nLen, pDXAry, nLen-1 );
+ ImplDrawText( aStartPt.X(), aStartPt.Y(), pStr, nLen, pDXAry );
+ ImplReleaseStackBuffer( pDXAry, aStackAry );
+ }
+ else
+ ImplDrawText( aStartPt.X(), aStartPt.Y(), pStr, nLen, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::GetTextWidth( const XubString& rStr,
+ xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_TRACE( "OutputDevice::GetTextWidth()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mbNewFont )
+ {
+ if ( !((OutputDevice*)this)->ImplNewFont() )
+ return 0;
+ }
+
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long nWidth = 0;
+
+ if ( nIndex < rStr.Len() )
+ {
+ // String-Laenge fuer die Ermittlung der Groesse setzen
+ if ( (ULONG)nLen+nIndex > rStr.Len() )
+ nLen = rStr.Len()-nIndex;
+
+ if ( nLen )
+ {
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+
+ // Bei Fixed-Fonts reicht eine Multiplikation
+ if ( pFontEntry->mbFixedFont )
+ {
+ nWidth = pCharWidthAry['A'] * nLen;
+ nWidth /= pFontEntry->mnWidthFactor;
+ }
+ else
+ {
+ const sal_Unicode* pStr = rStr.GetBuffer();
+ const sal_Unicode* pTempStr;
+ USHORT nTempLen;
+ pStr += nIndex;
+ pTempStr = pStr;
+ nTempLen = nLen;
+ while ( nTempLen )
+ {
+ nWidth += ImplGetCharWidth( *pTempStr );
+ nTempLen--;
+ pTempStr++;
+ }
+ nWidth /= pFontEntry->mnWidthFactor;
+
+ // Kerning beruecksichtigen (tun wir nur bei Fonts ohne feste Breite)
+ if ( mbKerning )
+ nWidth += ImplCalcKerning( pStr, nLen, NULL, 0 );
+ }
+ }
+ }
+
+ if ( mbMap )
+ nWidth = ImplDevicePixelToLogicWidth( nWidth );
+
+ return nWidth;
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::GetTextHeight() const
+{
+ DBG_TRACE( "OutputDevice::GetTextHeight()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mbNewFont )
+ {
+ if ( !((OutputDevice*)this)->ImplNewFont() )
+ return 0;
+ }
+
+ long nHeight = mpFontEntry->mnLineHeight;
+
+ if ( mbMap )
+ nHeight = ImplDevicePixelToLogicHeight( nHeight );
+
+ return nHeight;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawTextArray( const Point& rStartPt, const XubString& rStr,
+ const long* pDXAry,
+ xub_StrLen nIndex, xub_StrLen nLen )
+{
+ DBG_TRACE( "OutputDevice::DrawTextArray()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextArrayAction( rStartPt, rStr, pDXAry, nIndex, nLen ) );
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ // String-Laenge fuer die Ermittlung der Groesse setzen
+ if ( (ULONG)nLen+nIndex > rStr.Len() )
+ {
+ if ( nIndex < rStr.Len() )
+ nLen = rStr.Len()-nIndex;
+ else
+ nLen = 0;
+ }
+
+ // Ist die Ausgabe leer, dann mache nichts
+ if ( !nLen )
+ return;
+
+ // Bei keinem Pos-Array, DrawText benutzen
+ if ( !pDXAry || (nLen < 2) )
+ {
+ // hier Aufrufen, damit keine doppelte MetaFile Aufzeichnung
+ DrawText( rStartPt, rStr, nIndex, nLen );
+ return;
+ }
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+#else
+ if ( !ImplGetServerGraphics() )
+ return;
+#endif
+
+ if ( mbNewFont )
+ {
+ if ( !ImplNewFont() )
+ return;
+ }
+ if ( mbInitFont )
+ ImplInitFont();
+ if ( mbInitTextColor )
+ ImplInitTextColor();
+
+ // Pointer auf den String-Buffer setzen und um den Index korrigieren
+ const sal_Unicode* pStr = rStr.GetBuffer();
+ pStr += nIndex;
+
+ Point aStartPt = ImplLogicToDevicePixel( rStartPt );
+ if ( mbMap )
+ {
+ long nLogStartX = rStartPt.X();
+ long nPixStartX = aStartPt.X();
+ long aStackAry[128];
+ long* pPixDXAry = (long*)ImplGetStackBuffer( sizeof(long)*(nLen-1), aStackAry, sizeof( aStackAry ) );
+ for ( xub_StrLen i = 0; i < (nLen-1); i++ )
+ pPixDXAry[i] = ImplLogicXToDevicePixel( nLogStartX+pDXAry[i] )-nPixStartX;
+ ImplDrawText( aStartPt.X(), aStartPt.Y(), pStr, nLen, pPixDXAry );
+ ImplReleaseStackBuffer( pPixDXAry, aStackAry );
+ }
+ else
+ ImplDrawText( aStartPt.X(), aStartPt.Y(), pStr, nLen, pDXAry );
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::GetTextArray( const UniString& rStr, long* pDXAry,
+ xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_TRACE( "OutputDevice::GetTextArray()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !pDXAry )
+ return GetTextWidth( rStr, nIndex, nLen );
+
+ // String-Laenge fuer die Ermittlung der Groesse setzen
+ if ( (ULONG)nLen+nIndex > rStr.Len() )
+ {
+ if ( nIndex < rStr.Len() )
+ nLen = rStr.Len()-nIndex;
+ else
+ nLen = 0;
+ }
+
+ if ( !nLen )
+ return 0;
+
+ if ( mbNewFont )
+ {
+ if ( !((OutputDevice*)this)->ImplNewFont() )
+ return 0;
+ }
+
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+ long nFactor = pFontEntry->mnWidthFactor;
+ const sal_Unicode* pTempStr;
+ const sal_Unicode* pStr;
+ long nOffset = 0;
+ xub_StrLen i;
+ pStr = rStr.GetBuffer();
+ pStr += nIndex;
+ pTempStr = pStr;
+
+ // Breiten ermitteln
+ for ( i = 0; i < nLen; i++ )
+ {
+ nOffset += ImplGetCharWidth( *pTempStr );
+ pDXAry[i] = nOffset / nFactor;
+ pTempStr++;
+ }
+
+ // Kerning beruecksichtigen
+ if ( mbKerning )
+ ImplCalcKerning( pStr, nLen, pDXAry, nLen );
+
+ // Breite und Hoehe ermitteln
+ long nWidth = pDXAry[nLen-1];
+
+ // Wenn MapMode gesetzt, dann Werte umrechnen
+ if ( mbMap )
+ {
+ for ( i = 0; i < nLen; i++ )
+ pDXAry[i] = ImplDevicePixelToLogicWidth( pDXAry[i] );
+
+ nWidth = ImplDevicePixelToLogicWidth( nWidth );
+ }
+
+ return nWidth;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawStretchText( const Point& rStartPt, ULONG nWidth,
+ const UniString& rStr,
+ xub_StrLen nIndex, xub_StrLen nLen )
+{
+ DBG_TRACE( "OutputDevice::DrawStretchText()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaStretchTextAction( rStartPt, nWidth, rStr, nIndex, nLen ) );
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ // String-Laenge fuer die Ermittlung der Groesse setzen
+ if ( (ULONG)nLen+nIndex > rStr.Len() )
+ {
+ if ( nIndex < rStr.Len() )
+ nLen = rStr.Len()-nIndex;
+ else
+ nLen = 0;
+ }
+
+ // Ist die Ausgabe leer, dann mache nichts
+ if ( !nLen )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+#else
+ if ( !ImplGetServerGraphics() )
+ return;
+#endif
+
+ if ( mbNewFont )
+ {
+ if ( !ImplNewFont() )
+ return;
+ }
+ if ( mbInitFont )
+ ImplInitFont();
+ if ( mbInitTextColor )
+ ImplInitTextColor();
+
+ Point aStartPt = ImplLogicToDevicePixel( rStartPt );
+ nWidth = ImplLogicWidthToDevicePixel( nWidth );
+
+ // Pointer auf den String-Buffer setzen und um den Index korrigieren
+ const sal_Unicode* pStr = rStr.GetBuffer();
+ pStr += nIndex;
+
+ // Breiten-Array fuer errechnete Werte allocieren und
+ // mit den Breiten der einzelnen Character fuellen lassen
+ long aStackAry[128];
+ long* pDXAry = (long*)ImplGetStackBuffer( sizeof(long)*nLen, aStackAry, sizeof( aStackAry ) );
+ ImplFillDXAry( pDXAry, pStr, nLen, (long)nWidth );
+ ImplDrawText( aStartPt.X(), aStartPt.Y(), pStr, nLen, pDXAry );
+ ImplReleaseStackBuffer( pDXAry, aStackAry );
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen OutputDevice::GetTextBreak( const XubString& rStr, long nTextWidth,
+ xub_StrLen nIndex, xub_StrLen nLen,
+ long nCharExtra ) const
+{
+ DBG_TRACE( "OutputDevice::GetTextBreak()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( nIndex > rStr.Len() )
+ return 0;
+
+ if ( mbNewFont )
+ {
+ if ( !((OutputDevice*)this)->ImplNewFont() )
+ return 0;
+ }
+
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+ long nFactor = pFontEntry->mnWidthFactor;
+ const sal_Unicode* pStr;
+ long nCalcWidth = 0;
+ xub_StrLen nLastIndex;
+
+ if ( mbMap )
+ {
+ nTextWidth = ImplLogicWidthToDevicePixel( nTextWidth*10 );
+ nTextWidth *= nFactor;
+ nTextWidth /= 10;
+ if ( nCharExtra )
+ {
+ nCharExtra = ImplLogicWidthToDevicePixel( nCharExtra*10 );
+ nCharExtra *= nFactor;
+ nCharExtra /= 10;
+ }
+ }
+ else
+ {
+ nCharExtra *= nFactor;
+ nTextWidth *= nFactor;
+ }
+
+ // Letzte Index-Position ermitteln
+ if ( (ULONG)nIndex+nLen > rStr.Len() )
+ nLastIndex = rStr.Len();
+ else
+ nLastIndex = nIndex + nLen;
+
+ pStr = rStr.GetBuffer();
+ pStr += nIndex;
+ while ( nIndex < nLastIndex )
+ {
+ nCalcWidth += ImplGetCharWidth( *pStr );
+
+ if ( nCalcWidth > nTextWidth )
+ return nIndex;
+
+ // Kerning beruecksichtigen
+ if ( mbKerning )
+ nCalcWidth += ImplCalcKerning( pStr, 2, NULL, 0 )*nFactor;
+ nCalcWidth += nCharExtra;
+
+ nIndex++;
+ pStr++;
+ }
+
+ return STRING_LEN;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen OutputDevice::GetTextBreak( const XubString& rStr, long nTextWidth,
+ sal_Unicode nExtraChar, xub_StrLen& rExtraCharPos,
+ xub_StrLen nIndex, xub_StrLen nLen,
+ long nCharExtra ) const
+{
+ DBG_TRACE( "OutputDevice::GetTextBreak()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( nIndex > rStr.Len() )
+ return 0;
+
+ if ( mbNewFont )
+ {
+ if ( !((OutputDevice*)this)->ImplNewFont() )
+ return 0;
+ }
+
+ ImplFontEntry* pFontEntry = mpFontEntry;
+ long* pCharWidthAry = pFontEntry->maWidthAry;
+ long nFactor = pFontEntry->mnWidthFactor;
+ const sal_Unicode* pStr;
+ long nTextWidth2;
+ long nCalcWidth = 0;
+ xub_StrLen nIndex2 = STRING_LEN;
+ xub_StrLen nLastIndex;
+
+ if ( mbMap )
+ {
+ nTextWidth = ImplLogicWidthToDevicePixel( nTextWidth*10 );
+ nTextWidth *= nFactor;
+ nTextWidth /= 10;
+ if ( nCharExtra )
+ {
+ nCharExtra = ImplLogicWidthToDevicePixel( nCharExtra*10 );
+ nCharExtra *= nFactor;
+ nCharExtra /= 10;
+ }
+ }
+ else
+ {
+ nCharExtra *= nFactor;
+ nTextWidth *= nFactor;
+ }
+
+ // Letzte Index-Position ermitteln
+ if ( (ULONG)nIndex+nLen > rStr.Len() )
+ nLastIndex = rStr.Len();
+ else
+ nLastIndex = nIndex + nLen;
+
+ nTextWidth2 = nTextWidth - ImplGetCharWidth( nExtraChar ) - nCharExtra;
+
+ pStr = rStr.GetBuffer();
+ pStr += nIndex;
+ while ( nIndex < nLastIndex )
+ {
+ nCalcWidth += ImplGetCharWidth( *pStr );
+
+ if ( nCalcWidth > nTextWidth2 )
+ {
+ if ( nIndex2 == STRING_LEN )
+ nIndex2 = nIndex;
+ }
+ if ( nCalcWidth > nTextWidth )
+ {
+ if ( nIndex2 == STRING_LEN )
+ rExtraCharPos = nIndex;
+ else
+ rExtraCharPos = nIndex2;
+ return nIndex;
+ }
+
+ // Kerning beruecksichtigen
+ if ( mbKerning )
+ nCalcWidth += ImplCalcKerning( pStr, 2, NULL, 0 )*nFactor;
+ nCalcWidth += nCharExtra;
+
+ nIndex++;
+ pStr++;
+ }
+
+ rExtraCharPos = nIndex2;
+ return STRING_LEN;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::GetCharWidth( sal_Unicode nFirstChar, sal_Unicode nLastChar,
+ long* pWidthAry ) const
+{
+ DBG_TRACE( "OutputDevice::GetCharWidth()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_ASSERT( nFirstChar <= nLastChar, "OutputDevice::GetCharWidth(): nFirst > nLast" );
+
+ if ( mbNewFont )
+ {
+ if ( !((OutputDevice*)this)->ImplNewFont() )
+ return;
+ }
+
+ long nFactor = mpFontEntry->mnWidthFactor;
+ sal_Unicode nCharCount = nLastChar-nFirstChar+1;
+
+ if ( mbMap )
+ {
+ while ( nCharCount )
+ {
+ *pWidthAry = ImplDevicePixelToLogicWidth( ImplGetCharWidth( nFirstChar ) ) / nFactor;
+ pWidthAry++;
+ nFirstChar++;
+ nCharCount--;
+ }
+ }
+ else
+ {
+ while ( nCharCount )
+ {
+ *pWidthAry = ImplGetCharWidth( nFirstChar ) / nFactor;
+ pWidthAry++;
+ nFirstChar++;
+ nCharCount--;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawText( const Rectangle& rRect,
+ const XubString& rStr, USHORT nStyle )
+{
+ DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTextRectAction( rRect, rStr, nStyle ) );
+
+ if ( !IsDeviceOutputNecessary() || !rStr.Len() || rRect.IsEmpty() )
+ return;
+
+ // Vorsichtshalber hier auch schon Aufrufen, da ImplDrawMnemonicLine()
+ // dies nicht macht
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+#else
+ if ( !ImplGetServerGraphics() )
+ return;
+#endif
+
+ Color aOldTextColor;
+ Color aOldTextFillColor;
+ BOOL bRestoreFillColor;
+ if ( nStyle & TEXT_DRAW_DISABLE )
+ {
+ aOldTextColor = GetTextColor();
+ if ( IsTextFillColor() )
+ {
+ bRestoreFillColor = TRUE;
+ aOldTextFillColor = GetTextFillColor();
+ }
+ else
+ bRestoreFillColor = FALSE;
+ SetTextColor( GetSettings().GetStyleSettings().GetLightColor() );
+ Rectangle aRect = rRect;
+ aRect.Move( 1, 1 );
+ DrawText( aRect, rStr, nStyle & ~TEXT_DRAW_DISABLE );
+ SetTextColor( GetSettings().GetStyleSettings().GetShadowColor() );
+ }
+
+ long nWidth = rRect.GetWidth();
+ long nHeight = rRect.GetHeight();
+
+ if ( ((nWidth <= 0) || (nHeight <= 0)) && (nStyle & TEXT_DRAW_CLIP) )
+ return;
+
+ XubString aStr = rStr;
+ Point aPos = rRect.TopLeft();
+ long nTextHeight = GetTextHeight();
+ TextAlign eAlign = GetTextAlign();
+ xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+
+ if ( nStyle & TEXT_DRAW_MNEMONIC )
+ aStr = GetNonMnemonicString( aStr, nMnemonicPos );
+
+ // Mehrzeiligen Text behandeln wir anders
+ if ( nStyle & TEXT_DRAW_MULTILINE )
+ {
+ XubString aLastLine;
+ ImplMultiTextLineInfo aMultiLineInfo;
+ ImplTextLineInfo* pLineInfo;
+ long nMaxTextWidth;
+ xub_StrLen i;
+ xub_StrLen nLines;
+ xub_StrLen nFormatLines;
+
+ if ( nTextHeight )
+ {
+ nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle );
+ nLines = (xub_StrLen)(nHeight/nTextHeight);
+ nFormatLines = aMultiLineInfo.Count();
+ if ( !nLines )
+ nLines = 1;
+ if ( nFormatLines > nLines )
+ {
+ if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
+ {
+ // Letzte Zeile zusammenbauen und kuerzen
+ nFormatLines = nLines-1;
+ pLineInfo = aMultiLineInfo.GetLine( nFormatLines );
+ aLastLine = aStr.Copy( pLineInfo->GetIndex() );
+ aLastLine.ConvertLineEnd( LINEEND_LF );
+ // Alle LineFeed's durch Spaces ersetzen
+ xub_StrLen nLastLineLen = aLastLine.Len();
+ for ( i = 0; i < nLastLineLen; i++ )
+ {
+ if ( aLastLine.GetChar( i ) == _LF )
+ aLastLine.SetChar( i, ' ' );
+ }
+ aLastLine = GetEllipsisString( aLastLine, nWidth, nStyle );
+ nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM);
+ nStyle |= TEXT_DRAW_TOP;
+ }
+ }
+ else
+ {
+ if ( nMaxTextWidth <= nWidth )
+ nStyle &= ~TEXT_DRAW_CLIP;
+ }
+
+ // Muss in der Hoehe geclippt werden?
+ if ( nFormatLines*nTextHeight > nHeight )
+ nStyle |= TEXT_DRAW_CLIP;
+
+ // Clipping setzen
+ if ( nStyle & TEXT_DRAW_CLIP )
+ {
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( rRect );
+ }
+
+ // Vertikales Alignment
+ if ( nStyle & TEXT_DRAW_BOTTOM )
+ aPos.Y() += nHeight-(nFormatLines*nTextHeight);
+ else if ( nStyle & TEXT_DRAW_VCENTER )
+ aPos.Y() += (nHeight-(nFormatLines*nTextHeight))/2;
+
+ // Font Alignment
+ if ( eAlign == ALIGN_BOTTOM )
+ aPos.Y() += nTextHeight;
+ else if ( eAlign == ALIGN_BASELINE )
+ aPos.Y() += GetFontMetric().GetAscent();
+
+ // Alle Zeilen ausgeben, bis auf die letzte
+ for ( i = 0; i < nFormatLines; i++ )
+ {
+ pLineInfo = aMultiLineInfo.GetLine( i );
+ if ( nStyle & TEXT_DRAW_RIGHT )
+ aPos.X() += nWidth-pLineInfo->GetWidth();
+ else if ( nStyle & TEXT_DRAW_CENTER )
+ aPos.X() += (nWidth-pLineInfo->GetWidth())/2;
+ xub_StrLen nIndex = pLineInfo->GetIndex();
+ xub_StrLen nLineLen = pLineInfo->GetLen();
+ DrawText( aPos, aStr, nIndex, nLineLen );
+ if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) )
+ {
+ if ( (nMnemonicPos >= nIndex) && (nMnemonicPos < nIndex+nLineLen) )
+ {
+ long nMnemonicX;
+ long nMnemonicY;
+ xub_Unicode cMnemonic;
+ Point aTempPos = LogicToPixel( aPos );
+ cMnemonic = aStr.GetChar( nMnemonicPos );
+ nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( GetTextWidth( aStr, nIndex, nMnemonicPos-nIndex ) );
+ nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() );
+ ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, cMnemonic );
+ }
+ }
+ aPos.Y() += nTextHeight;
+ aPos.X() = rRect.Left();
+ }
+
+ // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben,
+ // da die Zeile gekuerzt wurde
+ if ( aLastLine.Len() )
+ DrawText( aPos, aLastLine );
+
+ // Clipping zuruecksetzen
+ if ( nStyle & TEXT_DRAW_CLIP )
+ Pop();
+ }
+ }
+ else
+ {
+ long nTextWidth = GetTextWidth( aStr );
+
+ // Evt. Text kuerzen
+ if ( nTextWidth > nWidth )
+ {
+ if ( nStyle & TEXT_DRAW_ELLIPSIS )
+ {
+ aStr = GetEllipsisString( aStr, nWidth, nStyle );
+ nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT);
+ nStyle |= TEXT_DRAW_LEFT;
+ nTextWidth = GetTextWidth( aStr );
+ }
+ }
+ else
+ {
+ if ( nTextHeight <= nHeight )
+ nStyle &= ~TEXT_DRAW_CLIP;
+ }
+
+ // Vertikales Alignment
+ if ( nStyle & TEXT_DRAW_RIGHT )
+ aPos.X() += nWidth-nTextWidth;
+ else if ( nStyle & TEXT_DRAW_CENTER )
+ aPos.X() += (nWidth-nTextWidth)/2;
+
+ // Font Alignment
+ if ( eAlign == ALIGN_BOTTOM )
+ aPos.Y() += nTextHeight;
+ else if ( eAlign == ALIGN_BASELINE )
+ aPos.Y() += GetFontMetric().GetAscent();
+
+ if ( nStyle & TEXT_DRAW_BOTTOM )
+ aPos.Y() += nHeight-nTextHeight;
+ else if ( nStyle & TEXT_DRAW_VCENTER )
+ aPos.Y() += (nHeight-nTextHeight)/2;
+
+ long nMnemonicX;
+ long nMnemonicY;
+ xub_Unicode cMnemonic;
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ {
+ Point aTempPos = LogicToPixel( aPos );
+ cMnemonic = aStr.GetChar( nMnemonicPos );
+ nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( GetTextWidth( aStr, 0, nMnemonicPos ) );
+ nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() );
+ }
+
+ if ( nStyle & TEXT_DRAW_CLIP )
+ {
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( rRect );
+ DrawText( aPos, aStr );
+ if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) )
+ {
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, cMnemonic );
+ }
+ Pop();
+ }
+ else
+ {
+ DrawText( aPos, aStr );
+ if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) )
+ {
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, cMnemonic );
+ }
+ }
+ }
+
+ if ( nStyle & TEXT_DRAW_DISABLE )
+ {
+ SetTextColor( aOldTextColor );
+ if ( bRestoreFillColor )
+ SetTextFillColor( aOldTextFillColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::GetTextRect( const Rectangle& rRect,
+ const XubString& rStr, USHORT nStyle,
+ TextRectInfo* pInfo ) const
+{
+ DBG_TRACE( "OutputDevice::GetTextRect()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Rectangle aRect = rRect;
+ XubString aStr = rStr;
+ xub_StrLen nLines;
+ long nWidth = rRect.GetWidth();
+ long nMaxWidth;
+ long nTextHeight = GetTextHeight();
+
+ if ( nStyle & TEXT_DRAW_MNEMONIC )
+ aStr = GetNonMnemonicString( aStr );
+
+ if ( nStyle & TEXT_DRAW_MULTILINE )
+ {
+ ImplMultiTextLineInfo aMultiLineInfo;
+ ImplTextLineInfo* pLineInfo;
+ xub_StrLen nFormatLines;
+ xub_StrLen i;
+
+ nMaxWidth = 0;
+ ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle );
+ nFormatLines = aMultiLineInfo.Count();
+ if ( !nTextHeight )
+ nTextHeight = 1;
+ nLines = (USHORT)(aRect.GetHeight()/nTextHeight);
+ if ( pInfo )
+ pInfo->mnLineCount = nFormatLines;
+ if ( !nLines )
+ nLines = 1;
+ if ( nFormatLines <= nLines )
+ nLines = nFormatLines;
+ else
+ {
+ if ( !(nStyle & TEXT_DRAW_ENDELLIPSIS) )
+ nLines = nFormatLines;
+ else
+ {
+ if ( pInfo )
+ pInfo->mbEllipsis = TRUE;
+ nMaxWidth = nWidth;
+ }
+ }
+ if ( pInfo )
+ {
+ BOOL bMaxWidth = nMaxWidth == 0;
+ pInfo->mnMaxWidth = 0;
+ for ( i = 0; i < nLines; i++ )
+ {
+ pLineInfo = aMultiLineInfo.GetLine( i );
+ if ( bMaxWidth && (pLineInfo->GetWidth() > nMaxWidth) )
+ nMaxWidth = pLineInfo->GetWidth();
+ if ( pLineInfo->GetWidth() > pInfo->mnMaxWidth )
+ pInfo->mnMaxWidth = pLineInfo->GetWidth();
+ }
+ }
+ else if ( !nMaxWidth )
+ {
+ for ( i = 0; i < nLines; i++ )
+ {
+ pLineInfo = aMultiLineInfo.GetLine( i );
+ if ( pLineInfo->GetWidth() > nMaxWidth )
+ nMaxWidth = pLineInfo->GetWidth();
+ }
+ }
+ }
+ else
+ {
+ nLines = 1;
+ nMaxWidth = GetTextWidth( aStr );
+
+ if ( pInfo )
+ {
+ pInfo->mnLineCount = 1;
+ pInfo->mnMaxWidth = nMaxWidth;
+ }
+
+ if ( (nMaxWidth > nWidth) && (nStyle & TEXT_DRAW_ELLIPSIS) )
+ {
+ if ( pInfo )
+ pInfo->mbEllipsis = TRUE;
+ nMaxWidth = nWidth;
+ }
+ }
+
+ if ( nStyle & TEXT_DRAW_RIGHT )
+ aRect.Left() = aRect.Right()-nMaxWidth+1;
+ else if ( nStyle & TEXT_DRAW_CENTER )
+ {
+ aRect.Left() += (nWidth-nMaxWidth)/2;
+ aRect.Right() = aRect.Left()+nMaxWidth-1;
+ }
+ else
+ aRect.Right() = aRect.Left()+nMaxWidth-1;
+
+ if ( nStyle & TEXT_DRAW_BOTTOM )
+ aRect.Top() = aRect.Bottom()-(nTextHeight*nLines)+1;
+ else if ( nStyle & TEXT_DRAW_VCENTER )
+ {
+ aRect.Top() += (aRect.GetHeight()-(nTextHeight*nLines))/2;
+ aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
+ }
+ else
+ aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
+
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplIsCharIn( xub_Unicode c, const sal_Char* pStr )
+{
+ while ( *pStr )
+ {
+ if ( *pStr == c )
+ return TRUE;
+ pStr++;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+XubString OutputDevice::GetEllipsisString( const XubString& rStr, long nMaxWidth,
+ USHORT nStyle ) const
+{
+ DBG_TRACE( "OutputDevice::GetEllipsisString()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ XubString aStr = rStr;
+ xub_StrLen nIndex = GetTextBreak( aStr, nMaxWidth );
+
+ if ( nIndex != STRING_LEN )
+ {
+ if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
+ {
+ aStr.Erase( nIndex );
+ if ( nIndex > 1 )
+ {
+ aStr.AppendAscii( "..." );
+ while ( aStr.Len() && (GetTextWidth( aStr ) > nMaxWidth) )
+ {
+ if ( (nIndex > 1) || (nIndex == aStr.Len()) )
+ nIndex--;
+ aStr.Erase( nIndex, 1 );
+ }
+ }
+
+ if ( !aStr.Len() && (nStyle & TEXT_DRAW_CLIP) )
+ aStr += rStr.GetChar( 0 );
+ }
+ else if ( nStyle & (TEXT_DRAW_PATHELLIPSIS | TEXT_DRAW_NEWSELLIPSIS) )
+ {
+ static sal_Char const aPathSepChars[] = "\\/:";
+ static sal_Char const aNewsSepChars[] = ".";
+ const sal_Char* pSepChars;
+
+ if ( nStyle & TEXT_DRAW_PATHELLIPSIS )
+ pSepChars = aPathSepChars;
+ else
+ pSepChars = aNewsSepChars;
+
+ // Letztes Teilstueck ermitteln
+ xub_StrLen nLastContent = rStr.Len();
+ while ( nLastContent )
+ {
+ nLastContent--;
+ if ( ImplIsCharIn( rStr.GetChar( nLastContent ), pSepChars ) )
+ break;
+ }
+ while ( nLastContent &&
+ ImplIsCharIn( rStr.GetChar( nLastContent-1 ), pSepChars ) )
+ nLastContent--;
+
+ XubString aLastStr( rStr, nLastContent, rStr.Len() );
+ XubString aTempLastStr( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ aTempLastStr += aLastStr;
+ if ( GetTextWidth( aTempLastStr ) > nMaxWidth )
+ aStr = GetEllipsisString( rStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS );
+ else
+ {
+ USHORT nFirstContent = 0;
+ while ( nFirstContent < nLastContent )
+ {
+ nFirstContent++;
+ if ( ImplIsCharIn( rStr.GetChar( nFirstContent ), pSepChars ) )
+ break;
+ }
+ while ( (nFirstContent < nLastContent) &&
+ ImplIsCharIn( rStr.GetChar( nFirstContent ), pSepChars ) )
+ nFirstContent++;
+
+ if ( nFirstContent >= nLastContent )
+ aStr = GetEllipsisString( rStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS );
+ else
+ {
+ if ( nFirstContent > 4 )
+ nFirstContent = 4;
+ XubString aFirstStr( rStr, 0, nFirstContent );
+ aFirstStr.AppendAscii( "..." );
+ XubString aTempStr = aFirstStr;
+ aTempStr += aLastStr;
+ if ( GetTextWidth( aTempStr ) > nMaxWidth )
+ aStr = GetEllipsisString( rStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS );
+ else
+ {
+ do
+ {
+ aStr = aTempStr;
+ while ( nFirstContent < nLastContent )
+ {
+ nLastContent--;
+ if ( ImplIsCharIn( rStr.GetChar( nLastContent ), pSepChars ) )
+ break;
+ }
+ while ( (nFirstContent < nLastContent) &&
+ ImplIsCharIn( rStr.GetChar( nLastContent-1 ), pSepChars ) )
+ nLastContent--;
+
+ if ( nFirstContent < nLastContent )
+ {
+ XubString aTempLastStr( rStr, nLastContent, rStr.Len() );
+ aTempStr = aFirstStr;
+ aTempStr += aTempLastStr;
+ if ( GetTextWidth( aTempStr ) > nMaxWidth )
+ break;
+ }
+ }
+ while ( nFirstContent < nLastContent );
+ }
+ }
+ }
+ }
+ }
+
+ return aStr;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr,
+ xub_StrLen nIndex, xub_StrLen nLen,
+ USHORT nStyle )
+{
+ DBG_TRACE( "OutputDevice::DrawCtrlText()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !IsDeviceOutputNecessary() || (nIndex >= rStr.Len()) )
+ return;
+
+ // Vorsichtshalber hier auch schon Aufrufen, da ImplDrawMnemonicLine()
+ // dies nicht macht
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+#else
+ if ( !ImplGetServerGraphics() )
+ return;
+#endif
+
+ XubString aStr = rStr;
+ xub_StrLen nMnemonicPos = STRING_NOTFOUND;
+ long nMnemonicX;
+ long nMnemonicY;
+ xub_Unicode cMnemonic;
+ if ( nStyle & TEXT_DRAW_MNEMONIC )
+ {
+ aStr = GetNonMnemonicString( aStr, nMnemonicPos );
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ {
+ if ( nMnemonicPos < nIndex )
+ nIndex--;
+ else if ( (nLen < STRING_LEN) &&
+ (nMnemonicPos >= nIndex) && (nMnemonicPos < (ULONG)(nIndex+nLen)) )
+ nLen--;
+ Point aTempPos = LogicToPixel( rPos );
+ cMnemonic = aStr.GetChar( nMnemonicPos );
+ nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( GetTextWidth( aStr, 0, nMnemonicPos ) );
+ nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() );
+ }
+ }
+
+ if ( nStyle & TEXT_DRAW_DISABLE )
+ {
+ Color aOldTextColor;
+ Color aOldTextFillColor;
+ BOOL bRestoreFillColor;
+ aOldTextColor = GetTextColor();
+ if ( IsTextFillColor() )
+ {
+ bRestoreFillColor = TRUE;
+ aOldTextFillColor = GetTextFillColor();
+ }
+ else
+ bRestoreFillColor = FALSE;
+ SetTextColor( GetSettings().GetStyleSettings().GetLightColor() );
+ DrawText( Point( rPos.X()+1, rPos.Y()+1 ), aStr, nIndex, nLen );
+ if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) )
+ {
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ ImplDrawMnemonicLine( nMnemonicX+1, nMnemonicY+1, cMnemonic );
+ }
+ SetTextColor( GetSettings().GetStyleSettings().GetShadowColor() );
+ DrawText( rPos, aStr, nIndex, nLen );
+ if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) )
+ {
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, cMnemonic );
+ }
+ SetTextColor( aOldTextColor );
+ if ( bRestoreFillColor )
+ SetTextFillColor( aOldTextFillColor );
+ }
+ else
+ {
+ DrawText( rPos, aStr, nIndex, nLen );
+ if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) )
+ {
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, cMnemonic );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::GetCtrlTextWidth( const XubString& rStr,
+ xub_StrLen nIndex, xub_StrLen nLen,
+ USHORT nStyle ) const
+{
+ DBG_TRACE( "OutputDevice::GetCtrlTextSize()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( nStyle & TEXT_DRAW_MNEMONIC )
+ {
+ xub_StrLen nMnemonicPos;
+ XubString aStr = GetNonMnemonicString( rStr, nMnemonicPos );
+ if ( nMnemonicPos != STRING_NOTFOUND )
+ {
+ if ( nMnemonicPos < nIndex )
+ nIndex--;
+ else if ( (nLen < STRING_LEN) &&
+ (nMnemonicPos >= nIndex) && (nMnemonicPos < (ULONG)(nIndex+nLen)) )
+ nLen--;
+ }
+ return GetTextWidth( aStr, nIndex, nLen );
+ }
+ else
+ return GetTextWidth( rStr, nIndex, nLen );
+}
+
+// -----------------------------------------------------------------------
+
+XubString OutputDevice::GetNonMnemonicString( const XubString& rStr, xub_StrLen& rMnemonicPos )
+{
+ XubString aStr = rStr;
+ xub_StrLen nLen = aStr.Len();
+ xub_StrLen i = 0;
+
+ rMnemonicPos = STRING_NOTFOUND;
+ while ( i < nLen )
+ {
+ if ( aStr.GetChar( i ) == '~' )
+ {
+ if ( aStr.GetChar( i+1 ) != '~' )
+ {
+ if ( rMnemonicPos == STRING_NOTFOUND )
+ rMnemonicPos = i;
+ aStr.Erase( i, 1 );
+ nLen--;
+ }
+ else
+ {
+ aStr.Erase( i, 1 );
+ nLen--;
+ i++;
+ }
+ }
+ else
+ i++;
+ }
+
+ return aStr;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT OutputDevice::GetDevFontCount() const
+{
+ DBG_TRACE( "OutputDevice::GetDevFontCount()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ // Wenn wir schon eine Liste der Fonts haben, dann nicht iterieren
+ if ( mpGetDevFontList )
+ return (USHORT)mpGetDevFontList->Count();
+
+ ((OutputDevice*)this)->mpGetDevFontList = new ImplGetDevFontList;
+
+ // Fill Fontlist
+ ImplDevFontListData* pFontListData = mpFontList->First();
+ while ( pFontListData )
+ {
+ ImplFontData* pLastData = NULL;
+ ImplFontData* pData = pFontListData->mpFirst;
+ while ( pData )
+ {
+ // Compare with the last font, because we wan't in the list
+ // only fonts, that have different attributes, but not
+ // different sizes
+ if ( !pLastData ||
+ (ImplCompareFontDataWithoutSize( pLastData, pData ) != 0) )
+ mpGetDevFontList->Add( pData );
+
+ pLastData = pData;
+ pData = pData->mpNext;
+ }
+
+ pFontListData = mpFontList->Next();
+ }
+
+ return (USHORT)mpGetDevFontList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+FontInfo OutputDevice::GetDevFont( USHORT nDevFont ) const
+{
+ DBG_TRACE( "OutputDevice::GetDevFont()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ FontInfo aFontInfo;
+ USHORT nCount = GetDevFontCount();
+
+ // Wertebereich ueberpruefen
+ if ( nDevFont < nCount )
+ {
+ ImplFontData* pData = mpGetDevFontList->Get( nDevFont );
+ aFontInfo.SetName( pData->maName );
+ aFontInfo.SetStyleName( pData->maStyleName );
+// !!! UNICODE !!! aFontInfo.SetCharSet( ImplGetFakeEncoding( pData->meCharSet ) );
+ aFontInfo.SetCharSet( pData->meCharSet );
+ aFontInfo.SetFamily( pData->meFamily );
+ aFontInfo.SetPitch( pData->mePitch );
+ aFontInfo.SetWeight( pData->meWeight );
+ aFontInfo.SetItalic( pData->meItalic );
+ aFontInfo.mpImplMetric->meType = pData->meType;
+ aFontInfo.mpImplMetric->mbDevice = pData->mbDevice;
+ }
+
+ return aFontInfo;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT OutputDevice::GetDevFontSizeCount( const Font& rFont ) const
+{
+ DBG_TRACE( "OutputDevice::GetDevFontSizeCount()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ XubString aFontName = rFont.GetName();
+
+ // Wenn die Liste schon existiert und der FontName sich nicht
+ // unterscheidet, dann brauchen wir Sie nicht neu erzeugen
+ if ( mpGetDevSizeList )
+ {
+ if ( mpGetDevSizeList->GetFontName() == aFontName )
+ return (USHORT)mpGetDevSizeList->Count();
+ else
+ {
+ mpGetDevSizeList->Clear();
+ mpGetDevSizeList->SetFontName( aFontName );
+ }
+ }
+ else
+ ((OutputDevice*)this)->mpGetDevSizeList = new ImplGetDevSizeList( aFontName );
+
+ // Fonts aus unserer Fontliste in die GetDevFontSizeListe eintragen
+ ImplDevFontListData* pFontListData = mpFontList->FindFont( aFontName );
+ if ( pFontListData )
+ {
+ ImplFontData* pData = pFontListData->mpFirst;
+ do
+ {
+ mpGetDevSizeList->Add( pData->mnHeight );
+ pData = pData->mpNext;
+ }
+ while ( pData );
+ }
+
+ return (USHORT)mpGetDevSizeList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::GetDevFontSize( const Font& rFont, USHORT nSize ) const
+{
+ DBG_TRACE( "OutputDevice::GetDevFontSize()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ USHORT nCount = GetDevFontSizeCount( rFont );
+
+ // Wertebereich ueberpruefen
+ if ( nSize >= nCount )
+ return Size();
+
+ // Wenn MapMode gesetzt ist, wird auf ,5-Points gerundet
+ Size aSize( 0, mpGetDevSizeList->Get( nSize ) );
+ if ( mbMap )
+ {
+ aSize.Height() *= 10;
+ MapMode aMap( MAP_10TH_INCH, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) );
+ aSize = PixelToLogic( aSize, aMap );
+ aSize.Height() += 5;
+ aSize.Height() /= 10;
+ long nRound = aSize.Height() % 5;
+ if ( nRound >= 3 )
+ aSize.Height() += (5-nRound);
+ else
+ aSize.Height() -= nRound;
+ aSize.Height() *= 10;
+ aSize = LogicToPixel( aSize, aMap );
+ aSize = PixelToLogic( aSize );
+ aSize.Height() += 5;
+ aSize.Height() /= 10;
+ }
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::IsFontAvailable( const XubString& rFontName ) const
+{
+ DBG_TRACE( "OutputDevice::IsFontAvailable()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ return (mpFontList->FindFont( rFontName ) != 0);
+}
+
+// -----------------------------------------------------------------------
+
+FontMetric OutputDevice::GetFontMetric() const
+{
+ DBG_TRACE( "OutputDevice::GetFontMetric()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ FontMetric aMetric;
+
+ if ( mbNewFont )
+ {
+ if ( !((OutputDevice*)this)->ImplNewFont() )
+ return aMetric;
+ }
+
+ ImplFontEntry* pEntry = mpFontEntry;
+ ImplFontMetricData* pMetric = &(pEntry->maMetric);
+
+ // Mappen und StarView Struktur fuellen
+ aMetric.Font::operator=( maFont );
+
+ // Fontdaten ermitteln und setzen
+ aMetric.SetName( pMetric->maName );
+ aMetric.SetStyleName( pMetric->maStyleName );
+ aMetric.SetSize( PixelToLogic( Size( pMetric->mnWidth, pMetric->mnAscent+pMetric->mnDescent-pMetric->mnLeading ) ) );
+ aMetric.SetCharSet( pMetric->meCharSet );
+ aMetric.SetFamily( pMetric->meFamily );
+ aMetric.SetPitch( pMetric->mePitch );
+ aMetric.SetWeight( pMetric->meWeight );
+ aMetric.SetItalic( pMetric->meItalic );
+ if ( pEntry->mnOwnOrientation )
+ aMetric.SetOrientation( pEntry->mnOwnOrientation );
+ else
+ aMetric.SetOrientation( pMetric->mnOrientation );
+ if ( !mbKerning )
+ aMetric.SetKerning( FALSE );
+
+ // restliche Metricen setzen
+ aMetric.mpImplMetric->meType = pMetric->meType;
+ aMetric.mpImplMetric->mbDevice = pMetric->mbDevice;
+ aMetric.mpImplMetric->mnAscent = ImplDevicePixelToLogicHeight( pMetric->mnAscent );
+ aMetric.mpImplMetric->mnDescent = ImplDevicePixelToLogicHeight( pMetric->mnDescent );
+ aMetric.mpImplMetric->mnLeading = ImplDevicePixelToLogicHeight( pMetric->mnLeading );
+ aMetric.mpImplMetric->mnLineHeight = ImplDevicePixelToLogicHeight( pMetric->mnAscent+pMetric->mnDescent );
+ aMetric.mpImplMetric->mnSlant = ImplDevicePixelToLogicHeight( pMetric->mnSlant );
+ aMetric.mpImplMetric->mnFirstChar = pMetric->mnFirstChar;
+ aMetric.mpImplMetric->mnLastChar = pMetric->mnLastChar;
+
+ return aMetric;
+}
+
+// -----------------------------------------------------------------------
+
+FontMetric OutputDevice::GetFontMetric( const Font& rFont ) const
+{
+ // Uebergebenen Font selektieren, Metric abfragen und alten wieder
+ // selektieren
+ Font aOldFont = GetFont();
+ ((OutputDevice*)this)->SetFont( rFont );
+ FontMetric aMetric( GetFontMetric() );
+ ((OutputDevice*)this)->SetFont( aOldFont );
+ return aMetric;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG OutputDevice::GetKerningPairCount() const
+{
+ DBG_TRACE( "OutputDevice::GetKerningPairCount()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ ((OutputDevice*)this)->ImplInitKerningPairs();
+ return mpFontEntry->mnKernPairs;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::GetKerningPairs( ULONG nPairs, KerningPair* pKernPairs ) const
+{
+ DBG_TRACE( "OutputDevice::GetKerningPairs()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ ((OutputDevice*)this)->ImplInitKerningPairs();
+ if ( nPairs > mpFontEntry->mnKernPairs )
+ nPairs = mpFontEntry->mnKernPairs;
+ if ( nPairs )
+ memcpy( pKernPairs, mpFontEntry->mpKernPairs, nPairs*sizeof( KerningPair ) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::GetGlyphBoundRect( xub_Unicode cChar, Rectangle& rRect, BOOL bOptimize )
+{
+ DBG_TRACE( "OutputDevice::GetGlyphBoundRect()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ BOOL bRet = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ if ( mpGraphics || ImplGetGraphics() )
+ {
+ Font* pOldFont;
+ long nLeft, nTop, nWidth, nHeight;
+ long nFontWidth, nFontHeight;
+ long nOrgWidth, nOrgHeight;
+
+ if ( bOptimize )
+ {
+ pOldFont = new Font( GetFont() );
+
+ Font aFont( *pOldFont );
+ Size aFontSize( LogicToPixel( aFont.GetSize() ) );
+
+ if ( aFontSize.Width() && aFontSize.Height() )
+ {
+ const double fFactor = (double) aFontSize.Width() / aFontSize.Height();
+
+ if ( fFactor < 1.0 )
+ {
+ aFontSize.Width() = FRound( fFactor * 500. );
+ aFontSize.Height() = 500;
+ }
+ else
+ {
+ aFontSize.Width() = 500;
+ aFontSize.Height() = FRound( 500. / fFactor );
+ }
+
+ aFont.SetSize( PixelToLogic( aFontSize ) );
+ ((OutputDevice*)this)->SetFont( aFont );
+ nFontWidth = aFont.GetSize().Width();
+ nFontHeight = aFont.GetSize().Height();
+ nOrgWidth = pOldFont->GetSize().Width();
+ nOrgHeight = pOldFont->GetSize().Height();
+ }
+ else
+ {
+ aFont.SetSize( PixelToLogic( Size( 0, 500 ) ) );
+ ((OutputDevice*)this)->SetFont( aFont );
+ nFontWidth = nFontHeight = aFont.GetSize().Height();
+ nOrgWidth = nOrgHeight = pOldFont->GetSize().Height();
+ }
+ }
+
+ if ( mbNewFont )
+ ImplNewFont();
+ if ( mbInitFont )
+ ImplInitFont();
+
+ if ( mpGraphics->GetGlyphBoundRect( cChar, &nLeft, &nTop, &nWidth, &nHeight ) )
+ {
+ if ( bOptimize )
+ {
+ nLeft = ImplDevicePixelToLogicWidth( nLeft ) * nOrgWidth / nFontWidth;
+ nTop = ImplDevicePixelToLogicHeight( nTop ) * nOrgHeight / nFontHeight;
+ nWidth = ImplDevicePixelToLogicWidth( nWidth ) * nOrgWidth / nFontWidth;
+ nHeight = ImplDevicePixelToLogicHeight( nHeight ) * nOrgHeight / nFontHeight;
+ }
+ else
+ {
+ nLeft = ImplDevicePixelToLogicWidth( nLeft );
+ nTop = ImplDevicePixelToLogicHeight( nTop );
+ nWidth = ImplDevicePixelToLogicWidth( nWidth );
+ nHeight = ImplDevicePixelToLogicHeight( nHeight );
+ }
+
+ rRect = Rectangle( Point( nLeft, nTop ), Size( nWidth, nHeight ) );
+ bRet = TRUE;
+ }
+
+ if ( bOptimize )
+ {
+ ((OutputDevice*)this)->SetFont( *pOldFont );
+ delete pOldFont;
+ }
+
+ if ( !bRet && (OUTDEV_PRINTER != meOutDevType) )
+ {
+ if ( bOptimize )
+ {
+ if ( mbNewFont )
+ ImplNewFont();
+ if ( mbInitFont )
+ ImplInitFont();
+ }
+
+ VirtualDevice* pVDev = new VirtualDevice( 1 );
+ long nWidth = ImplGetTextWidth( &cChar, 1, NULL );
+ long nHeight = mpFontEntry->mnLineHeight;
+ Point aOffset( nWidth >> 1, 8 );
+ Size aSize( nWidth + ( aOffset.X() << 1 ), nHeight + ( aOffset.Y() << 1 ) );
+
+ if ( pVDev->SetOutputSizePixel( aSize ) )
+ {
+ Font aFont( GetFont() );
+ Bitmap aBmp;
+
+ aFont.SetShadow( FALSE );
+ aFont.SetOutline( FALSE );
+ aFont.SetOrientation( 0 );
+ aFont.SetSize( Size( mpFontEntry->maFontSelData.mnWidth, mpFontEntry->maFontSelData.mnHeight ) );
+
+ pVDev->SetFont( aFont );
+ pVDev->SetTextAlign( ALIGN_TOP );
+ pVDev->SetTextColor( Color( COL_BLACK ) );
+ pVDev->SetTextFillColor();
+ pVDev->ImplNewFont();
+ pVDev->ImplInitFont();
+ pVDev->ImplInitTextColor();
+ pVDev->ImplDrawText( aOffset.X(), aOffset.Y(), &cChar, 1, NULL );
+ aBmp = pVDev->GetBitmap( Point(), aSize );
+ delete pVDev;
+
+ BitmapReadAccess* pAcc = aBmp.AcquireReadAccess();
+
+ if ( pAcc )
+ {
+ const long nW = pAcc->Width();
+ const long nW1 = nW - 1L;
+ const long nH = pAcc->Height();
+ long nRight, nBottom;
+ const BitmapColor aBlack( pAcc->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ BOOL bLineDone;
+
+ nLeft = nW;
+ nTop = nH;
+ nRight = nBottom = -1L;
+
+ for( long nY = 0L; nY < nH; nY++ )
+ {
+ bLineDone = FALSE;
+
+ for( long nX = 0L; ( nX < nW ) && !bLineDone; nX++ )
+ {
+ if( pAcc->GetPixel( nY, nX ) == aBlack )
+ {
+ // find y minimum
+ if( nY < nTop )
+ nTop = nY;
+
+ // find y maximum
+ if( nY > nBottom )
+ nBottom = nY;
+
+ // find x minimum
+ if( nX < nLeft )
+ nLeft = nX;
+
+ // find x maximum (last pixel in line)
+ for( long nX2 = nW1; nX2 >= nX; nX2-- )
+ {
+ if( pAcc->GetPixel( nY, nX2 ) == aBlack )
+ {
+ if( nX2 > nRight )
+ nRight = nX2;
+
+ bLineDone = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if( nLeft < nW && nTop < nH && nRight > -1L && nBottom > -1L )
+ {
+ nLeft -= aOffset.X(), nTop -= aOffset.Y();
+ nRight -= aOffset.X(), nBottom -= aOffset.Y();
+
+ nWidth = ImplDevicePixelToLogicWidth( nRight - nLeft + 1L );
+ nHeight = ImplDevicePixelToLogicHeight( nBottom - nTop + 1L );
+ nLeft = ImplDevicePixelToLogicWidth( nLeft );
+ nTop = ImplDevicePixelToLogicHeight( nTop );
+ rRect = Rectangle( Point( nLeft, nTop ), Size( nWidth, nHeight ) );
+ bRet = TRUE;
+ }
+
+ aBmp.ReleaseAccess( pAcc );
+ }
+ }
+ else
+ delete pVDev;
+ }
+ }
+#else
+ if ( mbNewFont )
+ ImplNewFont();
+ if ( mbInitFont )
+ ImplInitFont();
+
+ bRet = mpGraphics->GetGlyphBoundRect( cChar, rRect, bOptimize );
+
+ if ( bRet )
+ {
+ rRect = Rectangle( Point( ImplDevicePixelToLogicWidth( rRect.Left() ),
+ ImplDevicePixelToLogicHeight( rRect.Top() ) ),
+ Size( ImplDevicePixelToLogicWidth( rRect.GetWidth() ),
+ ImplDevicePixelToLogicHeight( rRect.GetHeight() ) ) );
+ }
+
+#endif
+
+ if ( !bRet )
+ rRect.SetEmpty();
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL OutputDevice::GetGlyphOutline( xub_Unicode cChar, PolyPolygon& rPolyPoly, BOOL bOptimize )
+{
+ DBG_TRACE( "OutputDevice::GetGlyphOutline()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ BOOL bRet = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ if ( mpGraphics || ImplGetGraphics() )
+ {
+ Font* pOldFont;
+ USHORT* pPolySizes = NULL;
+ SalPoint* pPoints = NULL;
+ BYTE* pFlags = NULL;
+ long nFontWidth, nFontHeight;
+ long nOrgWidth, nOrgHeight;
+ ULONG nPolyCount;
+
+ if ( bOptimize )
+ {
+ pOldFont = new Font( GetFont() );
+
+ Font aFont( *pOldFont );
+ Size aFontSize( LogicToPixel( aFont.GetSize() ) );
+
+ if ( aFontSize.Width() && aFontSize.Height() )
+ {
+ const double fFactor = (double) aFontSize.Width() / aFontSize.Height();
+
+ if ( fFactor < 1.0 )
+ {
+ aFontSize.Width() = FRound( fFactor * 500. );
+ aFontSize.Height() = 500;
+ }
+ else
+ {
+ aFontSize.Width() = 500;
+ aFontSize.Height() = FRound( 500. / fFactor );
+ }
+
+ aFont.SetSize( PixelToLogic( aFontSize ) );
+ ((OutputDevice*)this)->SetFont( aFont );
+ nFontWidth = aFont.GetSize().Width();
+ nFontHeight = aFont.GetSize().Height();
+ nOrgWidth = pOldFont->GetSize().Width();
+ nOrgHeight = pOldFont->GetSize().Height();
+ }
+ else
+ {
+ aFont.SetSize( PixelToLogic( Size( 0, 500 ) ) );
+ ((OutputDevice*)this)->SetFont( aFont );
+ nFontWidth = nFontHeight = aFont.GetSize().Height();
+ nOrgWidth = nOrgHeight = pOldFont->GetSize().Height();
+ }
+ }
+
+ if ( mbNewFont )
+ ImplNewFont();
+ if ( mbInitFont )
+ ImplInitFont();
+
+ nPolyCount = mpGraphics->GetGlyphOutline( cChar, &pPolySizes, &pPoints, &pFlags );
+ if ( nPolyCount && pPolySizes && pPoints && pFlags )
+ {
+ ULONG nTotalPos = 0UL;
+
+ rPolyPoly.Clear();
+
+ for( ULONG i = 0UL; i < nPolyCount; i++ )
+ {
+ const USHORT nSize = pPolySizes[ i ];
+
+ if( nSize )
+ {
+ Polygon aPoly( nSize );
+ Point* pPt = aPoly.ImplGetPointAry();
+ BYTE* pFl = aPoly.ImplGetFlagAry();
+
+ memcpy( pFl, pFlags + nTotalPos, nSize );
+
+ for( USHORT n = 0; n < nSize; n++ )
+ {
+ const SalPoint& rSalPt = pPoints[ nTotalPos++ ];
+ Point& rPt = pPt[ n ];
+
+ if( bOptimize )
+ {
+ rPt.X() = ImplDevicePixelToLogicWidth( rSalPt.mnX ) *
+ nOrgWidth / nFontWidth;
+ rPt.Y() = ImplDevicePixelToLogicHeight( rSalPt.mnY ) *
+ nOrgHeight / nFontHeight;
+ }
+ else
+ {
+ rPt.X() = ImplDevicePixelToLogicWidth( rSalPt.mnX );
+ rPt.Y() = ImplDevicePixelToLogicHeight( rSalPt.mnY );
+ }
+ }
+
+ rPolyPoly.Insert( aPoly );
+ }
+ }
+
+ bRet = TRUE;
+ }
+
+ delete[] pPolySizes;
+ delete[] pPoints;
+ delete[] pFlags;
+
+ if ( bOptimize )
+ {
+ ((OutputDevice*)this)->SetFont( *pOldFont );
+ delete pOldFont;
+ }
+
+ if ( !bRet && (OUTDEV_PRINTER != meOutDevType) )
+ {
+ if ( bOptimize )
+ {
+ if( mbNewFont )
+ ImplNewFont();
+ if( mbInitFont )
+ ImplInitFont();
+ }
+
+ Font aFont( GetFont() );
+ VirtualDevice* pVDev = new VirtualDevice( 1 );
+ const Size aFontSize( pVDev->LogicToPixel( Size( 0, GLYPH_FONT_HEIGHT ), MAP_POINT ) );
+ const long nOrgWidth = ImplGetTextWidth( &cChar, 1, NULL );
+ const long nOrgHeight = mpFontEntry->mnLineHeight;
+
+ aFont.SetShadow( FALSE );
+ aFont.SetOutline( FALSE );
+ aFont.SetOrientation( 0 );
+ aFont.SetSize( aFontSize );
+ pVDev->SetFont( aFont );
+ pVDev->SetTextAlign( ALIGN_TOP );
+ pVDev->SetTextColor( Color( COL_BLACK ) );
+ pVDev->SetTextFillColor();
+ pVDev->ImplNewFont();
+ pVDev->ImplInitFont();
+ pVDev->ImplInitTextColor();
+
+ const long nWidth = pVDev->ImplGetTextWidth( &cChar, 1, NULL );
+ const long nHeight = pVDev->mpFontEntry->mnLineHeight;
+ const Point aOffset( nWidth >> 1, 8 );
+ const Size aSize( nWidth + ( aOffset.X() << 1 ), nHeight + ( aOffset.Y() << 1 ) );
+ const double fScaleX = ( nOrgWidth && nWidth ) ? ( (double) nOrgWidth / nWidth ) : 0.0;
+ const double fScaleY = ( nOrgHeight && nHeight ) ? ( (double) nOrgHeight / nHeight ) : 0.0;
+
+ if ( pVDev->SetOutputSizePixel( aSize ) )
+ {
+ Bitmap aBmp;
+
+ pVDev->ImplDrawText( aOffset.X(), aOffset.Y(), &cChar, 1, NULL );
+ aBmp = pVDev->GetBitmap( Point(), aSize );
+ delete pVDev;
+
+ if( aBmp.Vectorize( rPolyPoly, BMP_VECTORIZE_OUTER | BMP_VECTORIZE_REDUCE_EDGES ) )
+ {
+ const long nOffX = aOffset.X(), nOffY = aOffset.Y();
+
+ for( USHORT i = 0UL, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ {
+ Polygon& rPoly = rPolyPoly[ i ];
+
+ for( USHORT n = 0, nSize = rPoly.GetSize(); n < nSize; n++ )
+ {
+ Point& rPt = rPoly[ n ];
+ rPt.X() = FRound( ImplDevicePixelToLogicWidth( rPt.X() - nOffX ) * fScaleX );
+ rPt.Y() = FRound( ImplDevicePixelToLogicHeight( rPt.Y() - nOffY ) * fScaleY );
+ }
+ }
+
+ bRet = TRUE;
+ }
+ }
+ else
+ delete pVDev;
+ }
+ }
+#else
+ if ( mbNewFont )
+ ImplNewFont();
+ if ( mbInitFont )
+ ImplInitFont();
+
+ bRet = mpGraphics->GetGlyphOutline( cChar, rPolyPoly, bOptimize );
+
+ if( bRet )
+ {
+ for( USHORT i = 0UL, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ {
+ Polygon& rPoly = rPolyPoly[ i ];
+
+ for( USHORT n = 0, nSize = rPoly.GetSize(); n < nSize; n++ )
+ {
+ Point& rPt = rPoly[ n ];
+ rPt.X() = ImplDevicePixelToLogicWidth( rPt.X() );
+ rPt.Y() = ImplDevicePixelToLogicHeight( rPt.Y() );
+ }
+ }
+ }
+
+#endif
+
+ if( !bRet )
+ rPolyPoly = PolyPolygon();
+
+ return bRet;
+}
diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx
new file mode 100644
index 000000000000..fc8e313b825d
--- /dev/null
+++ b/vcl/source/gdi/outdev4.cxx
@@ -0,0 +1,1634 @@
+/*************************************************************************
+ *
+ * $RCSfile: outdev4.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_OUTDEV_CXX
+
+#include <math.h>
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#endif
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#else
+#ifndef _SV_RMOUTDEV_HXX
+#include <rmoutdev.hxx>
+#endif
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_GRADIENT_HXX
+#include <gradient.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_OUTDATA_HXX
+#include <outdata.hxx>
+#endif
+#ifndef _SV_POLY_H
+#include <poly.h>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_LINE_HXX
+#include <line.hxx>
+#endif
+#ifndef _SV_HATCH_HXX
+#include <hatch.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define HATCH_MAXPOINTS 1024
+#define GRADIENT_DEFAULT_STEPCOUNT 0
+
+// ----------------
+// - Cmp-Function -
+// ----------------
+
+extern "C" int __LOADONCALLAPI ImplHatchCmpFnc( const void* p1, const void* p2 )
+{
+ const long nX1 = ( (Point*) p1 )->X();
+ const long nX2 = ( (Point*) p2 )->X();
+ const long nY1 = ( (Point*) p1 )->Y();
+ const long nY2 = ( (Point*) p2 )->Y();
+
+ return ( nX1 > nX2 ? 1 : nX1 == nX2 ? nY1 > nY2 ? 1: nY1 == nY2 ? 0 : -1 : -1 );
+}
+
+// =======================================================================
+
+DBG_NAMEEX( OutputDevice );
+DBG_NAMEEX( Gradient );
+
+// =======================================================================
+
+#ifndef REMOTE_APPSERVER
+
+void OutputDevice::ImplDrawPolygon( const Polygon& rPoly )
+{
+ USHORT nPoints = rPoly.GetSize();
+
+ if ( nPoints < 2 )
+ return;
+
+ const SalPoint* pPtAry = (const SalPoint*)rPoly.ImplGetConstPointAry();
+ mpGraphics->DrawPolygon( nPoints, pPtAry );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly )
+{
+ USHORT nPoly = rPolyPoly.Count();
+
+ if ( !nPoly )
+ return;
+
+ if ( nPoly == 1 )
+ {
+ const Polygon rPoly = rPolyPoly.GetObject( 0 );
+ USHORT nSize = rPoly.GetSize();
+ if ( nSize >= 2 )
+ {
+ const SalPoint* pPtAry = (const SalPoint*)rPoly.ImplGetConstPointAry();
+ mpGraphics->DrawPolygon( nSize, pPtAry );
+ }
+ }
+ else
+ {
+ ULONG* pPointAry = new ULONG[nPoly];
+ PCONSTSALPOINT* pPointAryAry = new PCONSTSALPOINT[nPoly];
+ USHORT i = 0;
+ do
+ {
+ const Polygon& rPoly = rPolyPoly.GetObject( i );
+ USHORT nSize = rPoly.GetSize();
+ if ( nSize )
+ {
+ pPointAry[i] = nSize;
+ pPointAryAry[i] = (PCONSTSALPOINT)rPoly.ImplGetConstPointAry();
+ i++;
+ }
+ else
+ nPoly--;
+ }
+ while ( i < nPoly );
+
+ if ( nPoly == 1 )
+ mpGraphics->DrawPolygon( *pPointAry, *pPointAryAry );
+ else
+ mpGraphics->DrawPolyPolygon( nPoly, pPointAry, pPointAryAry );
+
+ delete pPointAry;
+ delete pPointAryAry;
+ }
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+inline UINT8 ImplGetGradientColorValue( long nValue )
+{
+ if ( nValue < 0 )
+ return 0;
+ else if ( nValue > 0xFF )
+ return 0xFF;
+ else
+ return (UINT8)nValue;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect,
+ const Gradient& rGradient,
+ BOOL bMtf )
+{
+ // rotiertes BoundRect ausrechnen
+ Rectangle aRect = rRect;
+ aRect.Left()--;
+ aRect.Top()--;
+ aRect.Right()++;
+ aRect.Bottom()++;
+ USHORT nAngle = rGradient.GetAngle();
+ double fAngle = (nAngle % 3600) * F_PI1800;
+ double fWidth = aRect.GetWidth();
+ double fHeight = aRect.GetHeight();
+ double fDX = fWidth * fabs( cos( fAngle ) ) +
+ fHeight * fabs( sin( fAngle ) );
+ double fDY = fHeight * fabs( cos( fAngle ) ) +
+ fWidth * fabs( sin( fAngle ) );
+ fDX = (fDX - fWidth) * 0.5 + 0.5;
+ fDY = (fDY - fHeight) * 0.5 + 0.5;
+ aRect.Left() -= (long)fDX;
+ aRect.Right() += (long)fDX;
+ aRect.Top() -= (long)fDY;
+ aRect.Bottom() += (long)fDY;
+
+ // Rand berechnen und Rechteck neu setzen
+ Point aCenter = rRect.Center();
+ Rectangle aFullRect = aRect;
+ long nBorder = (long)rGradient.GetBorder() * aRect.GetHeight() / 100;
+ BOOL bLinear;
+
+ // Rand berechnen und Rechteck neu setzen fuer linearen Farbverlauf
+ if ( rGradient.GetStyle() == GRADIENT_LINEAR )
+ {
+ bLinear = TRUE;
+ aRect.Top() += nBorder;
+ }
+ // Rand berechnen und Rechteck neu setzen fuer axiale Farbverlauf
+ else
+ {
+ bLinear = FALSE;
+ nBorder >>= 1;
+
+ aRect.Top() += nBorder;
+ aRect.Bottom() -= nBorder;
+ }
+
+ // Top darf nicht groesser als Bottom sein
+ aRect.Top() = Min( aRect.Top(), (long)(aRect.Bottom() - 1) );
+
+ long nMinRect = aRect.GetHeight();
+
+ // Intensitaeten von Start- und Endfarbe ggf. aendern und
+ // Farbschrittweiten berechnen
+ long nFactor;
+ Color aStartCol = rGradient.GetStartColor();
+ Color aEndCol = rGradient.GetEndColor();
+ long nStartRed = aStartCol.GetRed();
+ long nStartGreen = aStartCol.GetGreen();
+ long nStartBlue = aStartCol.GetBlue();
+ long nEndRed = aEndCol.GetRed();
+ long nEndGreen = aEndCol.GetGreen();
+ long nEndBlue = aEndCol.GetBlue();
+ nFactor = rGradient.GetStartIntensity();
+ nStartRed = (nStartRed * nFactor) / 100;
+ nStartGreen = (nStartGreen * nFactor) / 100;
+ nStartBlue = (nStartBlue * nFactor) / 100;
+ nFactor = rGradient.GetEndIntensity();
+ nEndRed = (nEndRed * nFactor) / 100;
+ nEndGreen = (nEndGreen * nFactor) / 100;
+ nEndBlue = (nEndBlue * nFactor) / 100;
+ long nRedSteps = nEndRed - nStartRed;
+ long nGreenSteps = nEndGreen - nStartGreen;
+ long nBlueSteps = nEndBlue - nStartBlue;
+
+ // Bei nicht linearen Farbverlaeufen haben wir nur die halben Steps
+ // pro Farbe
+ if ( !bLinear )
+ {
+ nRedSteps <<= 1;
+ nGreenSteps <<= 1;
+ nBlueSteps <<= 1;
+ }
+
+ // Anzahl der Schritte berechnen, falls nichts uebergeben wurde
+ USHORT nStepCount = rGradient.GetSteps();
+ if ( !nStepCount )
+ {
+ long nInc;
+
+ if ( meOutDevType != OUTDEV_PRINTER && !bMtf )
+ nInc = (nMinRect < 50) ? 2 : 4;
+ else
+ nInc = ((nMinRect >> 9) + 1) << 3;
+
+ if ( !nInc )
+ nInc = 1;
+
+ nStepCount = (USHORT)(nMinRect / nInc);
+ }
+ // minimal drei Schritte und maximal die Anzahl der Farbunterschiede
+ long nSteps = Max( nStepCount, (USHORT)3 );
+ long nCalcSteps = Abs( nRedSteps );
+ long nTempSteps = Abs( nGreenSteps );
+ if ( nTempSteps > nCalcSteps )
+ nCalcSteps = nTempSteps;
+ nTempSteps = Abs( nBlueSteps );
+ if ( nTempSteps > nCalcSteps )
+ nCalcSteps = nTempSteps;
+ if ( nCalcSteps < nSteps )
+ nSteps = nCalcSteps;
+ if ( !nSteps )
+ nSteps = 1;
+
+ // Falls axialer Farbverlauf, muss die Schrittanzahl ungerade sein
+ if ( !bLinear && !(nSteps & 1) )
+ nSteps++;
+
+ // Berechnung ueber Double-Addition wegen Genauigkeit
+ double fScanLine = aRect.Top();
+ double fScanInc = (double)aRect.GetHeight() / (double)nSteps;
+
+ // Startfarbe berechnen und setzen
+ UINT8 nRed;
+ UINT8 nGreen;
+ UINT8 nBlue;
+ long nSteps2;
+ long nStepsHalf;
+ if ( bLinear )
+ {
+ // Um 1 erhoeht, um die Border innerhalb der Schleife
+ // zeichnen zu koennen
+ nSteps2 = nSteps + 1;
+ nRed = (UINT8)nStartRed;
+ nGreen = (UINT8)nStartGreen;
+ nBlue = (UINT8)nStartBlue;
+ }
+ else
+ {
+ // Um 2 erhoeht, um die Border innerhalb der Schleife
+ // zeichnen zu koennen
+ nSteps2 = nSteps + 2;
+ nRed = (UINT8)nEndRed;
+ nGreen = (UINT8)nEndGreen;
+ nBlue = (UINT8)nEndBlue;
+ nStepsHalf = nSteps >> 1;
+ }
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) );
+#ifndef REMOTE_APPSERVER
+ else
+ mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+#endif
+
+ // Startpolygon erzeugen (== Borderpolygon)
+ Polygon aPoly( 4 );
+ Polygon aTempPoly( 2 );
+ aPoly[0] = aFullRect.TopLeft();
+ aPoly[1] = aFullRect.TopRight();
+ aPoly[2] = aRect.TopRight();
+ aPoly[3] = aRect.TopLeft();
+ aPoly.Rotate( aCenter, nAngle );
+
+ // Schleife, um rotierten Verlauf zu fuellen
+ for ( long i = 0; i < nSteps2; i++ )
+ {
+ // berechnetesPolygon ausgeben
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaPolygonAction( aPoly ) );
+#ifndef REMOTE_APPSERVER
+ else
+ ImplDrawPolygon( aPoly );
+#endif
+
+ // neues Polygon berechnen
+ aRect.Top() = (long)(fScanLine += fScanInc);
+
+ // unteren Rand komplett fuellen
+ if ( i == nSteps )
+ {
+ aTempPoly[0] = aFullRect.BottomLeft();
+ aTempPoly[1] = aFullRect.BottomRight();
+ }
+ else
+ {
+ aTempPoly[0] = aRect.TopLeft();
+ aTempPoly[1] = aRect.TopRight();
+ }
+ aTempPoly.Rotate( aCenter, nAngle );
+
+ aPoly[0] = aPoly[3];
+ aPoly[1] = aPoly[2];
+ aPoly[2] = aTempPoly[1];
+ aPoly[3] = aTempPoly[0];
+
+ // Farbintensitaeten aendern...
+ // fuer lineare FV
+ if ( bLinear )
+ {
+ nRed = ImplGetGradientColorValue( nStartRed+((nRedSteps*i)/nSteps2) );
+ nGreen = ImplGetGradientColorValue( nStartGreen+((nGreenSteps*i)/nSteps2) );
+ nBlue = ImplGetGradientColorValue( nStartBlue+((nBlueSteps*i)/nSteps2) );
+ }
+ // fuer radiale FV
+ else
+ {
+ // fuer axiale FV muss die letzte Farbe der ersten
+ // Farbe entsprechen
+ if ( i > nSteps )
+ {
+ nRed = (UINT8)nEndRed;
+ nGreen = (UINT8)nEndGreen;
+ nBlue = (UINT8)nEndBlue;
+ }
+ else
+ {
+ if ( i <= nStepsHalf )
+ {
+ nRed = ImplGetGradientColorValue( nEndRed-((nRedSteps*i)/nSteps2) );
+ nGreen = ImplGetGradientColorValue( nEndGreen-((nGreenSteps*i)/nSteps2) );
+ nBlue = ImplGetGradientColorValue( nEndBlue-((nBlueSteps*i)/nSteps2) );
+ }
+ // genau die Mitte und hoeher
+ else
+ {
+ long i2 = i - nStepsHalf;
+ nRed = ImplGetGradientColorValue( nStartRed+((nRedSteps*i2)/nSteps2) );
+ nGreen = ImplGetGradientColorValue( nStartGreen+((nGreenSteps*i2)/nSteps2) );
+ nBlue = ImplGetGradientColorValue( nStartBlue+((nBlueSteps*i2)/nSteps2) );
+ }
+ }
+ }
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) );
+#ifndef REMOTE_APPSERVER
+ else
+ mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawRadialGradient( const Rectangle& rRect,
+ const Gradient& rGradient,
+ BOOL bMtf )
+{
+ // Feststellen ob Ausgabe ueber Polygon oder PolyPolygon
+ // Bei Rasteroperationen ungleich Overpaint immer PolyPolygone,
+ // da es zu falschen Ergebnissen kommt, wenn man mehrfach uebereinander
+ // ausgibt
+ // Bei Druckern auch immer PolyPolygone, da nicht alle Drucker
+ // das Uebereinanderdrucken von Polygonen koennen
+ // Virtuelle Device werden auch ausgeklammert, da einige Treiber
+ // ansonsten zu langsam sind
+ PolyPolygon* pPolyPoly;
+ if ( (meRasterOp != ROP_OVERPAINT) || (meOutDevType != OUTDEV_WINDOW) || bMtf )
+ pPolyPoly = new PolyPolygon( 2 );
+ else
+ pPolyPoly = NULL;
+
+ // Radien-Berechnung fuer Kreisausgabe (Kreis schliesst Rechteck ein)
+ USHORT nAngle = rGradient.GetAngle();
+ Rectangle aFullRect = rRect;
+ Rectangle aRect = rRect;
+ long nZWidth = aRect.GetWidth() * (long)rGradient.GetOfsX() / 100;
+ long nZHeight= aRect.GetHeight() * (long)rGradient.GetOfsY() / 100;
+ Size aSize = aRect.GetSize();
+ Point aCenter( aRect.Left() + nZWidth, aRect.Top() + nZHeight );
+ if ( rGradient.GetStyle() == GRADIENT_RADIAL )
+ {
+ aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() +
+ (double)aSize.Height()*(double)aSize.Height()));
+ aSize.Height() = aSize.Width();
+ }
+ // Radien-Berechnung fuer Ellipse
+ else
+ {
+ aSize.Width() = (long)(0.5 + (double)aSize.Width() * 1.4142);
+ aSize.Height() = (long)(0.5 + (double)aSize.Height() * 1.4142);
+ }
+
+ // Border berechnen
+ long nBorderX = (long)rGradient.GetBorder() * aSize.Width() / 100;
+ long nBorderY = (long)rGradient.GetBorder() * aSize.Height() / 100;
+ aSize.Width() -= nBorderX;
+ aSize.Height() -= nBorderY;
+ aRect.Left() = aCenter.X() - (aSize.Width() >> 1);
+ aRect.Top() = aCenter.Y() - (aSize.Height() >> 1);
+ aRect.SetSize( aSize );
+
+ long nMinRect = Min( aRect.GetWidth(), aRect.GetHeight() );
+
+ // Intensitaeten von Start- und Endfarbe ggf. aendern und
+ // Farbschrittweiten berechnen
+ long nFactor;
+ Color aStartCol = rGradient.GetStartColor();
+ Color aEndCol = rGradient.GetEndColor();
+ long nStartRed = aStartCol.GetRed();
+ long nStartGreen = aStartCol.GetGreen();
+ long nStartBlue = aStartCol.GetBlue();
+ long nEndRed = aEndCol.GetRed();
+ long nEndGreen = aEndCol.GetGreen();
+ long nEndBlue = aEndCol.GetBlue();
+ nFactor = rGradient.GetStartIntensity();
+ nStartRed = (nStartRed * nFactor) / 100;
+ nStartGreen = (nStartGreen * nFactor) / 100;
+ nStartBlue = (nStartBlue * nFactor) / 100;
+ nFactor = rGradient.GetEndIntensity();
+ nEndRed = (nEndRed * nFactor) / 100;
+ nEndGreen = (nEndGreen * nFactor) / 100;
+ nEndBlue = (nEndBlue * nFactor) / 100;
+ long nRedSteps = nEndRed - nStartRed;
+ long nGreenSteps = nEndGreen - nStartGreen;
+ long nBlueSteps = nEndBlue - nStartBlue;
+
+ // Anzahl der Schritte berechnen, falls nichts uebergeben wurde
+ USHORT nStepCount = rGradient.GetSteps();
+ if ( !nStepCount )
+ {
+ long nInc;
+
+ if ( meOutDevType != OUTDEV_PRINTER && !bMtf )
+ nInc = (nMinRect < 50) ? 2 : 4;
+ else
+ nInc = ((nMinRect >> 9) + 1) << 3;
+
+ if ( !nInc )
+ nInc = 1;
+
+ nStepCount = (USHORT)(nMinRect / nInc);
+ }
+ // minimal drei Schritte und maximal die Anzahl der Farbunterschiede
+ long nSteps = Max( nStepCount, (USHORT)3 );
+ long nCalcSteps = Abs( nRedSteps );
+ long nTempSteps = Abs( nGreenSteps );
+ if ( nTempSteps > nCalcSteps )
+ nCalcSteps = nTempSteps;
+ nTempSteps = Abs( nBlueSteps );
+ if ( nTempSteps > nCalcSteps )
+ nCalcSteps = nTempSteps;
+ if ( nCalcSteps < nSteps )
+ nSteps = nCalcSteps;
+ if ( !nSteps )
+ nSteps = 1;
+
+ // Ausgabebegrenzungen und Schrittweite fuer jede Richtung festlegen
+ double fScanLeft = aRect.Left();
+ double fScanTop = aRect.Top();
+ double fScanRight = aRect.Right();
+ double fScanBottom = aRect.Bottom();
+ double fScanInc = (double)nMinRect / (double)nSteps * 0.5;
+
+ // Startfarbe berechnen und setzen
+ UINT8 nRed = (UINT8)nStartRed;
+ UINT8 nGreen = (UINT8)nStartGreen;
+ UINT8 nBlue = (UINT8)nStartBlue;
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) );
+#ifndef REMOTE_APPSERVER
+ else
+ mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+#endif
+
+ // Recteck erstmal ausgeben
+ aFullRect.Bottom()++;
+ aFullRect.Right()++;
+ Polygon aPoly( aFullRect );
+#ifndef REMOTE_APPSERVER
+ if ( pPolyPoly )
+ {
+ pPolyPoly->Insert( aPoly );
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, nAngle );
+ pPolyPoly->Insert( aPoly );
+
+ // erstes Polygon zeichnen (entspricht Rechteck)
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+ else
+ ImplDrawPolyPolygon( *pPolyPoly );
+ }
+ else
+ ImplDrawPolygon( aPoly );
+#else
+ pPolyPoly->Insert( aPoly );
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, nAngle );
+ pPolyPoly->Insert( aPoly );
+
+ // erstes Polygon zeichnen (entspricht Rechteck)
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+#endif
+
+ // Schleife, um nacheinander die Polygone/PolyPolygone auszugeben
+ for ( long i = 0; i < nSteps; i++ )
+ {
+ // neues Polygon berechnen
+ aRect.Left() = (long)(fScanLeft += fScanInc);
+ aRect.Top() = (long)(fScanTop += fScanInc);
+ aRect.Right() = (long)(fScanRight -= fScanInc);
+ aRect.Bottom() = (long)(fScanBottom -= fScanInc);
+
+ if ( (aRect.GetWidth() < 2) || (aRect.GetHeight() < 2) )
+ break;
+
+ // ... Evt. eine maximale Anzahl von Stuetztstellen fuer W16
+ aPoly = Polygon( aRect.Center(),
+ aRect.GetWidth() >> 1,
+ aRect.GetHeight() >> 1 );
+ aPoly.Rotate( aCenter, nAngle );
+
+ // entweder langsame PolyPolygon-Ausgaben oder
+ // schnelles Polygon-Painting
+#ifndef REMOTE_APPSERVER
+ if ( pPolyPoly )
+ {
+ pPolyPoly->Replace( pPolyPoly->GetObject( 1 ), 0 );
+ pPolyPoly->Replace( aPoly, 1 );
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+ else
+ ImplDrawPolyPolygon( *pPolyPoly );
+ }
+ else
+ ImplDrawPolygon( aPoly );
+#else
+ pPolyPoly->Replace( pPolyPoly->GetObject( 1 ), 0 );
+ pPolyPoly->Replace( aPoly, 1 );
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+#endif
+
+ // Farbe entsprechend anpassen
+ nRed = ImplGetGradientColorValue( nStartRed+((nRedSteps*i)/nSteps) );
+ nGreen = ImplGetGradientColorValue( nStartGreen+((nGreenSteps*i)/nSteps) );
+ nBlue = ImplGetGradientColorValue( nStartBlue+((nBlueSteps*i)/nSteps) );
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) );
+#ifndef REMOTE_APPSERVER
+ else
+ mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+#endif
+ }
+
+ // Falls PolyPolygon-Ausgabe, muessen wir noch ein letztes
+ // inneres Polygon zeichnen
+ if ( pPolyPoly )
+ {
+ const Polygon rPoly = pPolyPoly->GetObject( 1 );
+ if ( !rPoly.GetBoundRect().IsEmpty() )
+ {
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) );
+#ifndef REMOTE_APPSERVER
+ else
+ ImplDrawPolygon( rPoly );
+#endif
+ }
+ delete pPolyPoly;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawRectGradient( const Rectangle& rRect,
+ const Gradient& rGradient,
+ BOOL bMtf )
+{
+ // Feststellen ob Ausgabe ueber Polygon oder PolyPolygon
+ // Bei Rasteroperationen ungleich Overpaint immer PolyPolygone,
+ // da es zu falschen Ergebnissen kommt, wenn man mehrfach uebereinander
+ // ausgibt
+ // Bei Druckern auch immer PolyPolygone, da nicht alle Drucker
+ // das Uebereinanderdrucken von Polygonen koennen
+ // Virtuelle Device werden auch ausgeklammert, da einige Treiber
+ // ansonsten zu langsam sind
+ PolyPolygon* pPolyPoly;
+ if ( (meRasterOp != ROP_OVERPAINT) || (meOutDevType != OUTDEV_WINDOW) || bMtf )
+ pPolyPoly = new PolyPolygon( 2 );
+ else
+ pPolyPoly = NULL;
+
+ // rotiertes BoundRect ausrechnen
+ Rectangle aRect( rRect );
+ aRect.Left()--;
+ aRect.Top()--;
+ aRect.Right()++;
+ aRect.Bottom()++;
+
+ Rectangle aFullRect( aRect );
+ USHORT nAngle = rGradient.GetAngle();
+ double fAngle = (nAngle % 3600) * F_PI1800;
+ double fWidth = aRect.GetWidth();
+ double fHeight = aRect.GetHeight();
+ double fDX = fWidth * fabs( cos( fAngle ) ) +
+ fHeight * fabs( sin( fAngle ) );
+ double fDY = fHeight * fabs( cos( fAngle ) ) +
+ fWidth * fabs( sin( fAngle ) );
+ fDX = (fDX - fWidth) * 0.5 + 0.5;
+ fDY = (fDY - fHeight) * 0.5 + 0.5;
+ aRect.Left() -= (long)fDX;
+ aRect.Right() += (long)fDX;
+ aRect.Top() -= (long)fDY;
+ aRect.Bottom() += (long)fDY;
+
+ // Quadratisch machen, wenn angefordert;
+ Size aSize = aRect.GetSize();
+ if ( rGradient.GetStyle() == GRADIENT_SQUARE )
+ {
+ if ( aSize.Width() > aSize.Height() )
+ aSize.Height() = aSize.Width();
+ else
+ aSize.Width() = aSize.Height();
+ }
+
+ // neue Mittelpunkte berechnen
+ long nZWidth = aRect.GetWidth() * (long)rGradient.GetOfsX() / 100;
+ long nZHeight = aRect.GetHeight() * (long)rGradient.GetOfsY() / 100;
+ long nBorderX = (long)rGradient.GetBorder() * aSize.Width() / 100;
+ long nBorderY = (long)rGradient.GetBorder() * aSize.Height() / 100;
+ Point aCenter( aRect.Left() + nZWidth, aRect.Top() + nZHeight );
+
+ // Rand beruecksichtigen
+ aSize.Width() -= nBorderX;
+ aSize.Height() -= nBorderY;
+
+ // Ausgaberechteck neu setzen
+ aRect.Left() = aCenter.X() - (aSize.Width() >> 1);
+ aRect.Top() = aCenter.Y() - (aSize.Height() >> 1);
+ aRect.SetSize( aSize );
+
+ long nMinRect = Min( aRect.GetWidth(), aRect.GetHeight() );
+
+ // Intensitaeten von Start- und Endfarbe ggf. aendern und
+ // Farbschrittweiten berechnen
+ long nFactor;
+ Color aStartCol = rGradient.GetStartColor();
+ Color aEndCol = rGradient.GetEndColor();
+ long nStartRed = aStartCol.GetRed();
+ long nStartGreen = aStartCol.GetGreen();
+ long nStartBlue = aStartCol.GetBlue();
+ long nEndRed = aEndCol.GetRed();
+ long nEndGreen = aEndCol.GetGreen();
+ long nEndBlue = aEndCol.GetBlue();
+ nFactor = rGradient.GetStartIntensity();
+ nStartRed = (nStartRed * nFactor) / 100;
+ nStartGreen = (nStartGreen * nFactor) / 100;
+ nStartBlue = (nStartBlue * nFactor) / 100;
+ nFactor = rGradient.GetEndIntensity();
+ nEndRed = (nEndRed * nFactor) / 100;
+ nEndGreen = (nEndGreen * nFactor) / 100;
+ nEndBlue = (nEndBlue * nFactor) / 100;
+ long nRedSteps = nEndRed - nStartRed;
+ long nGreenSteps = nEndGreen - nStartGreen;
+ long nBlueSteps = nEndBlue - nStartBlue;
+
+ // Anzahl der Schritte berechnen, falls nichts uebergeben wurde
+ USHORT nStepCount = rGradient.GetSteps();
+ if ( !nStepCount )
+ {
+ long nInc;
+
+ if ( meOutDevType != OUTDEV_PRINTER && !bMtf )
+ nInc = (nMinRect < 50) ? 2 : 4;
+ else
+ nInc = ((nMinRect >> 9) + 1) << 3;
+
+ if ( !nInc )
+ nInc = 1;
+
+ nStepCount = (USHORT)(nMinRect / nInc);
+ }
+ // minimal drei Schritte und maximal die Anzahl der Farbunterschiede
+ long nSteps = Max( nStepCount, (USHORT)3 );
+ long nCalcSteps = Abs( nRedSteps );
+ long nTempSteps = Abs( nGreenSteps );
+ if ( nTempSteps > nCalcSteps )
+ nCalcSteps = nTempSteps;
+ nTempSteps = Abs( nBlueSteps );
+ if ( nTempSteps > nCalcSteps )
+ nCalcSteps = nTempSteps;
+ if ( nCalcSteps < nSteps )
+ nSteps = nCalcSteps;
+ if ( !nSteps )
+ nSteps = 1;
+
+ // Ausgabebegrenzungen und Schrittweite fuer jede Richtung festlegen
+ double fScanLeft = aRect.Left();
+ double fScanTop = aRect.Top();
+ double fScanRight = aRect.Right();
+ double fScanBottom = aRect.Bottom();
+ double fScanInc = (double)nMinRect / (double)nSteps * 0.5;
+
+ // Startfarbe berechnen und setzen
+ UINT8 nRed = (UINT8)nStartRed;
+ UINT8 nGreen = (UINT8)nStartGreen;
+ UINT8 nBlue = (UINT8)nStartBlue;
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) );
+#ifndef REMOTE_APPSERVER
+ else
+ mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+#endif
+
+ // Recteck erstmal ausgeben
+ Polygon aPoly( aFullRect );
+#ifndef REMOTE_APPSERVER
+ if ( pPolyPoly )
+ {
+ pPolyPoly->Insert( aPoly );
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, nAngle );
+ pPolyPoly->Insert( aPoly );
+
+ // erstes Polygon zeichnen (entspricht Rechteck)
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+ else
+ ImplDrawPolyPolygon( *pPolyPoly );
+ }
+ else
+ ImplDrawPolygon( aPoly );
+#else
+ pPolyPoly->Insert( aPoly );
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, nAngle );
+ pPolyPoly->Insert( aPoly );
+
+ // erstes Polygon zeichnen (entspricht Rechteck)
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+#endif
+
+ // Schleife, um nacheinander die Polygone/PolyPolygone auszugeben
+ for ( long i = 0; i < nSteps; i++ )
+ {
+ // neues Polygon berechnen
+ aRect.Left() = (long)(fScanLeft += fScanInc);
+ aRect.Top() = (long)(fScanTop += fScanInc);
+ aRect.Right() = (long)(fScanRight -= fScanInc);
+ aRect.Bottom() = (long)(fScanBottom-= fScanInc);
+
+ if ( (aRect.GetWidth() < 2) || (aRect.GetHeight() < 2) )
+ break;
+
+ aPoly = Polygon( aRect );
+ aPoly.Rotate( aCenter, nAngle );
+
+#ifndef REMOTE_APPSERVER
+ // entweder langsame PolyPolygon-Ausgaben oder
+ // schnelles Polygon-Painting
+ if ( pPolyPoly )
+ {
+ pPolyPoly->Replace( pPolyPoly->GetObject( 1 ), 0 );
+ pPolyPoly->Replace( aPoly, 1 );
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+ else
+ ImplDrawPolyPolygon( *pPolyPoly );
+ }
+ else
+ ImplDrawPolygon( aPoly );
+#else
+ pPolyPoly->Replace( pPolyPoly->GetObject( 1 ), 0 );
+ pPolyPoly->Replace( aPoly, 1 );
+ mpMetaFile->AddAction( new MetaPolyPolygonAction( *pPolyPoly ) );
+#endif
+
+ // Farbe entsprechend anpassen
+ nRed = ImplGetGradientColorValue( nStartRed+((nRedSteps*i)/nSteps) );
+ nGreen = ImplGetGradientColorValue( nStartGreen+((nGreenSteps*i)/nSteps) );
+ nBlue = ImplGetGradientColorValue( nStartBlue+((nBlueSteps*i)/nSteps) );
+
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaFillColorAction( Color( nRed, nGreen, nBlue ), TRUE ) );
+#ifndef REMOTE_APPSERVER
+ else
+ mpGraphics->SetFillColor( MAKE_SALCOLOR( nRed, nGreen, nBlue ) );
+#endif
+ }
+
+ // Falls PolyPolygon-Ausgabe, muessen wir noch ein letztes
+ // inneres Polygon zeichnen
+ if ( pPolyPoly )
+ {
+ const Polygon rPoly = pPolyPoly->GetObject( 1 );
+ if ( !rPoly.GetBoundRect().IsEmpty() )
+ {
+ if ( bMtf )
+ mpMetaFile->AddAction( new MetaPolygonAction( rPoly ) );
+#ifndef REMOTE_APPSERVER
+ else
+ ImplDrawPolygon( rPoly );
+#endif
+ }
+ delete pPolyPoly;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawGradient( const Rectangle& rRect,
+ const Gradient& rGradient )
+{
+ DBG_TRACE( "OutputDevice::DrawGradient()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rGradient, Gradient, NULL );
+
+ if ( mnDrawMode & DRAWMODE_NOGRADIENT )
+ return;
+ else if ( mnDrawMode & ( DRAWMODE_BLACKGRADIENT | DRAWMODE_WHITEGRADIENT ) )
+ {
+ BYTE cCmpVal;
+
+ if ( mnDrawMode & DRAWMODE_BLACKGRADIENT )
+ cCmpVal = ( mnDrawMode & DRAWMODE_GHOSTEDGRADIENT ) ? 0x80 : 0;
+ else
+ cCmpVal = 255;
+
+ Color aCol( cCmpVal, cCmpVal, cCmpVal );
+ Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ SetLineColor( aCol );
+ SetFillColor( aCol );
+ DrawRect( rRect );
+ Pop();
+ return;
+ }
+
+ Gradient aGradient( rGradient );
+
+ if ( mnDrawMode & ( DRAWMODE_GRAYGRADIENT | DRAWMODE_GHOSTEDGRADIENT ) )
+ {
+ Color aStartCol( aGradient.GetStartColor() );
+ Color aEndCol( aGradient.GetEndColor() );
+
+ if ( mnDrawMode & DRAWMODE_GRAYGRADIENT )
+ {
+ BYTE cStartLum = aStartCol.GetLuminance(), cEndLum = aEndCol.GetLuminance();
+ aStartCol = Color( cStartLum, cStartLum, cStartLum );
+ aEndCol = Color( cEndLum, cEndLum, cEndLum );
+ }
+
+ if ( mnDrawMode & DRAWMODE_GHOSTEDGRADIENT )
+ {
+ aStartCol = Color( ( aStartCol.GetRed() >> 1 ) | 0x80,
+ ( aStartCol.GetGreen() >> 1 ) | 0x80,
+ ( aStartCol.GetBlue() >> 1 ) | 0x80 );
+
+ aEndCol = Color( ( aEndCol.GetRed() >> 1 ) | 0x80,
+ ( aEndCol.GetGreen() >> 1 ) | 0x80,
+ ( aEndCol.GetBlue() >> 1 ) | 0x80 );
+ }
+
+ aGradient.SetStartColor( aStartCol );
+ aGradient.SetEndColor( aEndCol );
+ }
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaGradientAction( rRect, aGradient ) );
+
+ if( !IsDeviceOutputNecessary() )
+ return;
+
+ // Rechteck in Pixel umrechnen
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+ aRect.Justify();
+
+ // Wenn Rechteck leer ist, brauchen wir nichts machen
+ if ( !aRect.IsEmpty() )
+ {
+#ifndef REMOTE_APPSERVER
+ // Clip Region sichern
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( rRect );
+
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( !mbOutputClipped )
+ {
+ // Gradienten werden ohne Umrandung gezeichnet
+ if ( mbLineColor || mbInitLineColor )
+ {
+ mpGraphics->SetLineColor();
+ mbInitLineColor = TRUE;
+ }
+
+ mbInitFillColor = TRUE;
+
+ // calculate step count if neccessary
+ if ( !aGradient.GetSteps() )
+ aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
+
+ // Farbverlauf ausgeben
+ switch( aGradient.GetStyle() )
+ {
+ case GRADIENT_LINEAR:
+ case GRADIENT_AXIAL:
+ ImplDrawLinearGradient( aRect, aGradient, FALSE );
+ break;
+
+ case GRADIENT_RADIAL:
+ case GRADIENT_ELLIPTICAL:
+ ImplDrawRadialGradient( aRect, aGradient, FALSE );
+ break;
+
+ case GRADIENT_SQUARE:
+ case GRADIENT_RECT:
+ ImplDrawRectGradient( aRect, aGradient, FALSE );
+ break;
+ }
+ }
+
+ Pop();
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ pGraphics->DrawGradient( aRect, aGradient );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
+ const Gradient& rGradient )
+{
+ DBG_TRACE( "OutputDevice::DrawGradient()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rGradient, Gradient, NULL );
+
+ if( rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() && !( mnDrawMode & DRAWMODE_NOGRADIENT ) )
+ {
+ if( mnDrawMode & ( DRAWMODE_BLACKGRADIENT | DRAWMODE_WHITEGRADIENT ) )
+ {
+ BYTE cCmpVal;
+
+ if ( mnDrawMode & DRAWMODE_BLACKGRADIENT )
+ cCmpVal = ( mnDrawMode & DRAWMODE_GHOSTEDGRADIENT ) ? 0x80 : 0;
+ else
+ cCmpVal = 255;
+
+ Color aCol( cCmpVal, cCmpVal, cCmpVal );
+ Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ SetLineColor( aCol );
+ SetFillColor( aCol );
+ DrawPolyPolygon( rPolyPoly );
+ Pop();
+ return;
+ }
+
+ if( mpMetaFile )
+ {
+ const Rectangle aRect( rPolyPoly.GetBoundRect() );
+
+ if( OUTDEV_PRINTER == meOutDevType )
+ {
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( rPolyPoly );
+ DrawGradient( aRect, rGradient );
+ Pop();
+ }
+ else
+ {
+ const BOOL bOldOutput = IsOutputEnabled();
+
+ EnableOutput( FALSE );
+ Push( PUSH_RASTEROP );
+ SetRasterOp( ROP_XOR );
+ DrawGradient( aRect, rGradient );
+ SetFillColor( COL_BLACK );
+ SetRasterOp( ROP_0 );
+ DrawPolyPolygon( rPolyPoly );
+ SetRasterOp( ROP_XOR );
+ DrawGradient( aRect, rGradient );
+ Pop();
+ EnableOutput( bOldOutput );
+ }
+ }
+
+ if( !IsDeviceOutputNecessary() )
+ return;
+
+ Gradient aGradient( rGradient );
+
+ if ( mnDrawMode & ( DRAWMODE_GRAYGRADIENT | DRAWMODE_GHOSTEDGRADIENT ) )
+ {
+ Color aStartCol( aGradient.GetStartColor() );
+ Color aEndCol( aGradient.GetEndColor() );
+
+ if ( mnDrawMode & DRAWMODE_GRAYGRADIENT )
+ {
+ BYTE cStartLum = aStartCol.GetLuminance(), cEndLum = aEndCol.GetLuminance();
+ aStartCol = Color( cStartLum, cStartLum, cStartLum );
+ aEndCol = Color( cEndLum, cEndLum, cEndLum );
+ }
+
+ if ( mnDrawMode & DRAWMODE_GHOSTEDGRADIENT )
+ {
+ aStartCol = Color( ( aStartCol.GetRed() >> 1 ) | 0x80,
+ ( aStartCol.GetGreen() >> 1 ) | 0x80,
+ ( aStartCol.GetBlue() >> 1 ) | 0x80 );
+
+ aEndCol = Color( ( aEndCol.GetRed() >> 1 ) | 0x80,
+ ( aEndCol.GetGreen() >> 1 ) | 0x80,
+ ( aEndCol.GetBlue() >> 1 ) | 0x80 );
+ }
+
+ aGradient.SetStartColor( aStartCol );
+ aGradient.SetEndColor( aEndCol );
+ }
+
+#ifndef REMOTE_APPSERVER
+ if( OUTDEV_PRINTER == meOutDevType )
+ {
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( rPolyPoly );
+ DrawGradient( rPolyPoly.GetBoundRect(), aGradient );
+ Pop();
+ }
+ else
+ {
+ const PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) );
+ const Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
+ Point aPoint;
+ Rectangle aDstRect( aPoint, GetOutputSizePixel() );
+
+ aDstRect.Intersection( aBoundRect );
+
+ if( OUTDEV_WINDOW == meOutDevType )
+ {
+ const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
+
+ if( !aPaintRgn.IsNull() )
+ aDstRect.Intersection( LogicToPixel( aPaintRgn ).GetBoundRect() );
+ }
+
+ if( !aDstRect.IsEmpty() )
+ {
+ VirtualDevice aVDev;
+ const Size aDstSize( aDstRect.GetSize() );
+
+ if( aVDev.SetOutputSizePixel( aDstSize) )
+ {
+ MapMode aVDevMap;
+ const RasterOp eOldROP = GetRasterOp();
+ const BOOL bOldMap = mbMap;
+
+ mbMap = FALSE;
+
+ aVDev.DrawOutDev( Point(), aDstSize, aDstRect.TopLeft(), aDstSize, *this );
+ DrawGradient( aBoundRect, aGradient );
+ aVDev.SetRasterOp( ROP_XOR );
+ aVDev.DrawOutDev( Point(), aDstSize, aDstRect.TopLeft(), aDstSize, *this );
+ aVDev.SetFillColor( COL_BLACK );
+ aVDev.SetRasterOp( ROP_0 );
+ aVDevMap.SetOrigin( Point( -aDstRect.Left(), -aDstRect.Top() ) );
+ aVDev.SetMapMode( aVDevMap );
+ aVDev.DrawPolyPolygon( aPolyPoly );
+ aVDevMap.SetOrigin( Point() );
+ aVDev.SetMapMode( aVDevMap );
+ SetRasterOp( ROP_XOR );
+ DrawOutDev( aDstRect.TopLeft(), aDstSize, Point(), aDstSize, aVDev );
+ SetRasterOp( eOldROP );
+
+ mbMap = bOldMap;
+ }
+ }
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ pGraphics->DrawGradient( ImplLogicToDevicePixel( rPolyPoly ), aGradient );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::AddGradientActions( const Rectangle& rRect, const Gradient& rGradient,
+ GDIMetaFile& rMtf )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rGradient, Gradient, NULL );
+
+ Rectangle aRect( rRect );
+
+ aRect.Justify();
+
+ // Wenn Rechteck leer ist, brauchen wir nichts machen
+ if ( !aRect.IsEmpty() )
+ {
+ Gradient aGradient( rGradient );
+ GDIMetaFile* pOldMtf = mpMetaFile;
+
+ mpMetaFile = &rMtf;
+ mpMetaFile->AddAction( new MetaPushAction( PUSH_ALL ) );
+ mpMetaFile->AddAction( new MetaISectRectClipRegionAction( aRect ) );
+ mpMetaFile->AddAction( new MetaLineColorAction( Color(), FALSE ) );
+
+ // calculate step count if neccessary
+ if ( !aGradient.GetSteps() )
+ aGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT );
+
+ // Farbverlaufactions aufzeichnen
+ switch( rGradient.GetStyle() )
+ {
+ case GRADIENT_LINEAR:
+ case GRADIENT_AXIAL:
+ ImplDrawLinearGradient( aRect, aGradient, TRUE );
+ break;
+
+ case GRADIENT_RADIAL:
+ case GRADIENT_ELLIPTICAL:
+ ImplDrawRadialGradient( aRect, aGradient, TRUE );
+ break;
+
+ case GRADIENT_SQUARE:
+ case GRADIENT_RECT:
+ ImplDrawRectGradient( aRect, aGradient, TRUE );
+ break;
+ }
+
+ mpMetaFile->AddAction( new MetaPopAction() );
+ mpMetaFile = pOldMtf;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch )
+{
+ DBG_TRACE( "OutputDevice::DrawHatch()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Hatch aHatch( rHatch );
+
+ if ( mnDrawMode & ( DRAWMODE_BLACKLINE | DRAWMODE_WHITELINE |
+ DRAWMODE_GRAYLINE | DRAWMODE_GHOSTEDLINE ) )
+ {
+ Color aColor( rHatch.GetColor() );
+
+ if ( mnDrawMode & DRAWMODE_BLACKLINE )
+ aColor = Color( COL_BLACK );
+ else if ( mnDrawMode & DRAWMODE_WHITELINE )
+ aColor = Color( COL_WHITE );
+ else if ( mnDrawMode & DRAWMODE_GRAYLINE )
+ {
+ const UINT8 cLum = aColor.GetLuminance();
+ aColor = Color( cLum, cLum, cLum );
+ }
+
+ if ( mnDrawMode & DRAWMODE_GHOSTEDLINE )
+ {
+ aColor = Color( ( aColor.GetRed() >> 1 ) | 0x80,
+ ( aColor.GetGreen() >> 1 ) | 0x80,
+ ( aColor.GetBlue() >> 1 ) | 0x80);
+ }
+
+ aHatch.SetColor( aColor );
+ }
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaHatchAction( rPolyPoly, aHatch ) );
+
+ if( !IsDeviceOutputNecessary() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ if( !mpGraphics && !ImplGetGraphics() )
+ return;
+
+ if( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if( mbOutputClipped )
+ return;
+#endif
+
+ PolyPolygon aPolyPoly( rPolyPoly );
+ aPolyPoly.Optimize( POLY_OPTIMIZE_NO_SAME | POLY_OPTIMIZE_CLOSE );
+
+ if( aPolyPoly.Count() )
+ {
+#ifndef REMOTE_APPSERVER
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+
+ mpMetaFile = NULL;
+ Push( PUSH_LINECOLOR );
+ SetLineColor( aHatch.GetColor() );
+ ImplInitLineColor();
+ ImplDrawHatch( aPolyPoly, aHatch, FALSE );
+ Pop();
+ mpMetaFile = pOldMetaFile;
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ aHatch.SetDistance( ImplLogicWidthToDevicePixel( aHatch.GetDistance() ) );
+ pGraphics->DrawHatch( ImplLogicToDevicePixel( aPolyPoly ), aHatch );
+ }
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::AddHatchActions( const PolyPolygon& rPolyPoly, const Hatch& rHatch,
+ GDIMetaFile& rMtf )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ PolyPolygon aPolyPoly( rPolyPoly );
+ aPolyPoly.Optimize( POLY_OPTIMIZE_NO_SAME | POLY_OPTIMIZE_CLOSE );
+
+ if( aPolyPoly.Count() )
+ {
+ GDIMetaFile* pOldMtf = mpMetaFile;
+
+ mpMetaFile = &rMtf;
+ mpMetaFile->AddAction( new MetaPushAction( PUSH_ALL ) );
+ mpMetaFile->AddAction( new MetaLineColorAction( rHatch.GetColor(), TRUE ) );
+ ImplDrawHatch( aPolyPoly, rHatch, TRUE );
+ mpMetaFile->AddAction( new MetaPopAction() );
+ mpMetaFile = pOldMtf;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch, BOOL bMtf )
+{
+ Rectangle aRect( rPolyPoly.GetBoundRect() );
+ const long nLogPixelWidth = ImplDevicePixelToLogicWidth( 1 );
+ const long nWidth = ImplDevicePixelToLogicWidth( Max( ImplLogicWidthToDevicePixel( rHatch.GetDistance() ), 5L ) );
+ Point* pPtBuffer = new Point[ HATCH_MAXPOINTS ];
+ Point aPt1, aPt2, aEndPt1;
+ Size aInc;
+
+ // Single hatch
+ aRect.Left() -= nLogPixelWidth; aRect.Top() -= nLogPixelWidth; aRect.Right() += nLogPixelWidth; aRect.Bottom() += nLogPixelWidth;
+ ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle(), aPt1, aPt2, aInc, aEndPt1 );
+ do
+ {
+ ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
+ aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
+ aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
+ }
+ while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
+
+ if( ( rHatch.GetStyle() == HATCH_DOUBLE ) || ( rHatch.GetStyle() == HATCH_TRIPLE ) )
+ {
+ // Double hatch
+ ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 900, aPt1, aPt2, aInc, aEndPt1 );
+ do
+ {
+ ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
+ aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
+ aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
+ }
+ while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
+
+ if( rHatch.GetStyle() == HATCH_TRIPLE )
+ {
+ // Triple hatch
+ ImplCalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 450, aPt1, aPt2, aInc, aEndPt1 );
+ do
+ {
+ ImplDrawHatchLine( Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer, bMtf );
+ aPt1.X() += aInc.Width(); aPt1.Y() += aInc.Height();
+ aPt2.X() += aInc.Width(); aPt2.Y() += aInc.Height();
+ }
+ while( ( aPt1.X() <= aEndPt1.X() ) && ( aPt1.Y() <= aEndPt1.Y() ) );
+ }
+ }
+
+ delete[] pPtBuffer;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplCalcHatchValues( const Rectangle& rRect, long nDist, USHORT nAngle10,
+ Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 )
+{
+ Point aRef;
+ long nAngle = nAngle10 % 1800;
+ long nOffset = 0;
+
+ if( nAngle > 900 )
+ nAngle -= 1800;
+
+ aRef = ( !IsRefPoint() ? rRect.TopLeft() : GetRefPoint() );
+
+ if( 0 == nAngle )
+ {
+ rInc = Size( 0, nDist );
+ rPt1 = rRect.TopLeft();
+ rPt2 = rRect.TopRight();
+ rEndPt1 = rRect.BottomLeft();
+
+ if( aRef.Y() <= rRect.Top() )
+ nOffset = ( ( rRect.Top() - aRef.Y() ) % nDist );
+ else
+ nOffset = ( nDist - ( ( aRef.Y() - rRect.Top() ) % nDist ) );
+
+ rPt1.Y() -= nOffset;
+ rPt2.Y() -= nOffset;
+ }
+ else if( 900 == nAngle )
+ {
+ rInc = Size( nDist, 0 );
+ rPt1 = rRect.TopLeft();
+ rPt2 = rRect.BottomLeft();
+ rEndPt1 = rRect.TopRight();
+
+ if( aRef.X() <= rRect.Left() )
+ nOffset = ( rRect.Left() - aRef.X() ) % nDist;
+ else
+ nOffset = nDist - ( ( aRef.X() - rRect.Left() ) % nDist );
+
+ rPt1.X() -= nOffset;
+ rPt2.X() -= nOffset;
+ }
+ else if( nAngle >= -450 && nAngle <= 450 )
+ {
+ const double fAngle = F_PI1800 * labs( nAngle );
+ const double fTan = tan( fAngle );
+ const long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan );
+ long nPY;
+
+ rInc = Size( 0, nDist = FRound( nDist / cos( fAngle ) ) );
+
+ if( nAngle > 0 )
+ {
+ rPt1 = rRect.TopLeft();
+ rPt2 = Point( rRect.Right(), rRect.Top() - nYOff );
+ rEndPt1 = Point( rRect.Left(), rRect.Bottom() + nYOff );
+ nPY = FRound( aRef.Y() - ( ( rPt1.X() - aRef.X() ) * fTan ) );
+ }
+ else
+ {
+ rPt1 = rRect.TopRight();
+ rPt2 = Point( rRect.Left(), rRect.Top() - nYOff );
+ rEndPt1 = Point( rRect.Right(), rRect.Bottom() + nYOff );
+ nPY = FRound( aRef.Y() + ( ( rPt1.X() - aRef.X() ) * fTan ) );
+ }
+
+ if( nPY <= rPt1.Y() )
+ nOffset = ( rPt1.Y() - nPY ) % nDist;
+ else
+ nOffset = nDist - ( ( nPY - rPt1.Y() ) % nDist );
+
+ rPt1.Y() -= nOffset;
+ rPt2.Y() -= nOffset;
+ }
+ else
+ {
+ const double fAngle = F_PI1800 * labs( nAngle );
+ const double fTan = tan( fAngle );
+ const long nXOff = FRound( ( rRect.Bottom() - rRect.Top() ) / fTan );
+ long nPX;
+
+ rInc = Size( nDist = FRound( nDist / sin( fAngle ) ), 0 );
+
+ if( nAngle > 0 )
+ {
+ rPt1 = rRect.TopLeft();
+ rPt2 = Point( rRect.Left() - nXOff, rRect.Bottom() );
+ rEndPt1 = Point( rRect.Right() + nXOff, rRect.Top() );
+ nPX = FRound( aRef.X() - ( ( rPt1.Y() - aRef.Y() ) / fTan ) );
+ }
+ else
+ {
+ rPt1 = rRect.BottomLeft();
+ rPt2 = Point( rRect.Left() - nXOff, rRect.Top() );
+ rEndPt1 = Point( rRect.Right() + nXOff, rRect.Bottom() );
+ nPX = FRound( aRef.X() + ( ( rPt1.Y() - aRef.Y() ) / fTan ) );
+ }
+
+ if( nPX <= rPt1.X() )
+ nOffset = ( rPt1.X() - nPX ) % nDist;
+ else
+ nOffset = nDist - ( ( nPX - rPt1.X() ) % nDist );
+
+ rPt1.X() -= nOffset;
+ rPt2.X() -= nOffset;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPolyPoly,
+ Point* pPtBuffer, BOOL bMtf )
+{
+#ifdef REMOTE_APPSERVER
+ ImplServerGraphics* pGraphics;
+ if( !bMtf && !( pGraphics = ImplGetServerGraphics() ) )
+ return;
+#endif
+
+ double fSaveDist = 0.0;
+ long nPCounter = 0;
+
+ for( long nPoly = 0, nPolyCount = rPolyPoly.Count(); nPoly < nPolyCount; nPoly++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ (USHORT) nPoly ];
+
+ if( rPoly.GetSize() > 1 )
+ {
+ Point aIntersection;
+ Point aPt1( rPoly[0] );
+
+ for( long i = 1, nCount = rPoly.GetSize(); i < nCount; i++ )
+ {
+ const Point& rPt2 = rPoly[ (USHORT) i ];
+
+ if( rLine.Intersection( Line( aPt1, rPt2 ), aIntersection ) )
+ {
+ const BOOL bDifferent = !nPCounter || aIntersection != pPtBuffer[ nPCounter - 1 ];
+
+ if( aIntersection == aPt1 )
+ {
+ double fDist1 = rLine.GetDistance( rPoly[ ( i > 1 ) ? i - 2 : nCount - 2 ] );
+ double fDist2 = rLine.GetDistance( rPt2 );
+
+ if( 1 == i )
+ nCount--;
+
+ if( bDifferent )
+ {
+ pPtBuffer[ nPCounter++ ] = aIntersection;
+
+ if( ( ( fDist1 < 0.0 && fDist2 < 0.0 ) || ( fDist1 > 0.0 && fDist2 > 0.0 ) ) )
+ pPtBuffer[ nPCounter++ ] = aIntersection;
+ else if( fDist1 == 0.0 )
+ {
+ if( ( fSaveDist > 0.0 && fDist2 < 0.0 ) || ( fSaveDist < 0.0 && fDist2 > 0.0 ) )
+ pPtBuffer[ nPCounter++ ] = aIntersection;
+ }
+ }
+ }
+ else if( aIntersection == rPt2 )
+ {
+ double fDist1 = rLine.GetDistance( aPt1 );
+ double fDist2 = rLine.GetDistance( rPoly[ ( i < nCount - 1 ) ? i + 1 : 1 ] );
+
+ if( bDifferent )
+ {
+ pPtBuffer[ nPCounter++ ] = aIntersection;
+
+ if( ( ( fDist1 < 0.0 && fDist2 < 0.0 ) || ( fDist1 > 0.0 && fDist2 > 0.0 ) ) )
+ pPtBuffer[ nPCounter++ ] = aIntersection;
+ else if( fDist2 == 0.0 )
+ fSaveDist = fDist1;
+ }
+ }
+ else
+ pPtBuffer[ nPCounter++ ] = aIntersection;
+ }
+
+ aPt1 = rPt2;
+ }
+ }
+ }
+
+ if( nPCounter > 1 )
+ {
+ qsort( pPtBuffer, nPCounter, sizeof( Point ), ImplHatchCmpFnc );
+
+ if( nPCounter & 1 )
+ nPCounter--;
+
+ if( bMtf )
+ {
+ for( long i = 0; i < nPCounter; i += 2 )
+ mpMetaFile->AddAction( new MetaLineAction( pPtBuffer[ i ], pPtBuffer[ i + 1 ] ) );
+ }
+ else
+ {
+ for( long i = 0; i < nPCounter; i += 2 )
+ {
+ const Point aPt1( ImplLogicToDevicePixel( pPtBuffer[ i ] ) );
+ const Point aPt2( ImplLogicToDevicePixel( pPtBuffer[ i + 1 ] ) );
+
+#ifndef REMOTE_APPSERVER
+ mpGraphics->DrawLine( aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y() );
+#else
+ pGraphics->DrawLine( aPt1, aPt2 );
+#endif
+ }
+ }
+ }
+}
diff --git a/vcl/source/gdi/outdev5.cxx b/vcl/source/gdi/outdev5.cxx
new file mode 100644
index 000000000000..f162b1196fd1
--- /dev/null
+++ b/vcl/source/gdi/outdev5.cxx
@@ -0,0 +1,430 @@
+/*************************************************************************
+ *
+ * $RCSfile: outdev5.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_OUTDEV_CXX
+#include <tools/ref.hxx>
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#endif
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#else
+#ifndef _SV_RMOUTDEV_HXX
+#include <rmoutdev.hxx>
+#endif
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_POLY_H
+#include <poly.h>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_OUTDATA_HXX
+#include <outdata.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+
+// =======================================================================
+
+DBG_NAMEEX( OutputDevice );
+
+// =======================================================================
+
+void OutputDevice::DrawRect( const Rectangle& rRect,
+ ULONG nHorzRound, ULONG nVertRound )
+{
+ DBG_TRACE( "OutputDevice::DrawRoundRect()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaRoundRectAction( rRect, nHorzRound, nVertRound ) );
+
+ if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) )
+ return;
+
+ const Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+
+ if ( aRect.IsEmpty() )
+ return;
+
+ nHorzRound = ImplLogicWidthToDevicePixel( nHorzRound );
+ nVertRound = ImplLogicHeightToDevicePixel( nVertRound );
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+
+ if ( !nHorzRound && !nVertRound )
+ mpGraphics->DrawRect( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight() );
+ else
+ {
+ const Polygon aRoundRectPoly( aRect, nHorzRound, nVertRound );
+
+ if ( aRoundRectPoly.GetSize() >= 2 )
+ {
+ const SalPoint* pPtAry = (const SalPoint*) aRoundRectPoly.ImplGetConstPointAry();
+
+ if ( !mbFillColor )
+ mpGraphics->DrawPolyLine( aRoundRectPoly.GetSize(), pPtAry );
+ else
+ mpGraphics->DrawPolygon( aRoundRectPoly.GetSize(), pPtAry );
+ }
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ if ( !nHorzRound || !nVertRound )
+ pGraphics->DrawRect( aRect );
+ else
+ pGraphics->DrawRect( aRect, nHorzRound, nVertRound );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawEllipse( const Rectangle& rRect )
+{
+ DBG_TRACE( "OutputDevice::DrawEllipse()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaEllipseAction( rRect ) );
+
+ if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) )
+ return;
+
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+ if ( aRect.IsEmpty() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ Polygon aRectPoly( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
+ if ( aRectPoly.GetSize() >= 2 )
+ {
+ const SalPoint* pPtAry = (const SalPoint*)aRectPoly.ImplGetConstPointAry();
+ if ( !mbFillColor )
+ mpGraphics->DrawPolyLine( aRectPoly.GetSize(), pPtAry );
+ else
+ {
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ mpGraphics->DrawPolygon( aRectPoly.GetSize(), pPtAry );
+ }
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawEllipse( aRect );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawArc( const Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt )
+{
+ DBG_TRACE( "OutputDevice::DrawArc()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaArcAction( rRect, rStartPt, rEndPt ) );
+
+ if ( !IsDeviceOutputNecessary() || !mbLineColor )
+ return;
+
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+ if ( aRect.IsEmpty() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ const Point aStart( ImplLogicToDevicePixel( rStartPt ) );
+ const Point aEnd( ImplLogicToDevicePixel( rEndPt ) );
+ Polygon aArcPoly( aRect, aStart, aEnd, POLY_ARC );
+
+ if ( aArcPoly.GetSize() >= 2 )
+ {
+ const SalPoint* pPtAry = (const SalPoint*)aArcPoly.ImplGetConstPointAry();
+ mpGraphics->DrawPolyLine( aArcPoly.GetSize(), pPtAry );
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawArc( aRect,
+ ImplLogicToDevicePixel( rStartPt ),
+ ImplLogicToDevicePixel( rEndPt ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawPie( const Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt )
+{
+ DBG_TRACE( "OutputDevice::DrawPie()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaPieAction( rRect, rStartPt, rEndPt ) );
+
+ if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) )
+ return;
+
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+ if ( aRect.IsEmpty() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ const Point aStart( ImplLogicToDevicePixel( rStartPt ) );
+ const Point aEnd( ImplLogicToDevicePixel( rEndPt ) );
+ Polygon aPiePoly( aRect, aStart, aEnd, POLY_PIE );
+
+ if ( aPiePoly.GetSize() >= 2 )
+ {
+ const SalPoint* pPtAry = (const SalPoint*)aPiePoly.ImplGetConstPointAry();
+ if ( !mbFillColor )
+ mpGraphics->DrawPolyLine( aPiePoly.GetSize(), pPtAry );
+ else
+ {
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ mpGraphics->DrawPolygon( aPiePoly.GetSize(), pPtAry );
+ }
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawPie( aRect,
+ ImplLogicToDevicePixel( rStartPt ),
+ ImplLogicToDevicePixel( rEndPt ) );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawChord( const Rectangle& rRect,
+ const Point& rStartPt, const Point& rEndPt )
+{
+ DBG_TRACE( "OutputDevice::DrawChord()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaChordAction( rRect, rStartPt, rEndPt ) );
+
+ if ( !IsDeviceOutputNecessary() || (!mbLineColor && !mbFillColor) )
+ return;
+
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+ if ( aRect.IsEmpty() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+
+ const Point aStart( ImplLogicToDevicePixel( rStartPt ) );
+ const Point aEnd( ImplLogicToDevicePixel( rEndPt ) );
+ Polygon aChordPoly( aRect, aStart, aEnd, POLY_CHORD );
+
+ if ( aChordPoly.GetSize() >= 2 )
+ {
+ const SalPoint* pPtAry = (const SalPoint*)aChordPoly.ImplGetConstPointAry();
+ if ( !mbFillColor )
+ mpGraphics->DrawPolyLine( aChordPoly.GetSize(), pPtAry );
+ else
+ {
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ mpGraphics->DrawPolygon( aChordPoly.GetSize(), pPtAry );
+ }
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawChord( aRect,
+ ImplLogicToDevicePixel( rStartPt ),
+ ImplLogicToDevicePixel( rEndPt ) );
+ }
+#endif
+}
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
new file mode 100644
index 000000000000..371334530488
--- /dev/null
+++ b/vcl/source/gdi/outdev6.cxx
@@ -0,0 +1,1043 @@
+/*************************************************************************
+ *
+ * $RCSfile: outdev6.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_WALL_CXX
+
+#include <math.h>
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#else // REMOTE_APPSERVER
+#include <tools/stream.hxx>
+#endif // REMOTE_APPSERVER
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_GRAPH_HXX
+#include <graph.hxx>
+#endif
+#ifdef REMOTE_APPSERVER
+#include <rmoutdev.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+// ========================================================================
+
+DBG_NAMEEX( OutputDevice );
+
+// ------------------------------------------------------------------------
+
+void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, ULONG nFlags )
+{
+ DBG_TRACE( "OutputDevice::DrawGrid()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() );
+ aDstRect.Intersection( rRect );
+
+ if( aDstRect.IsEmpty() )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ if( !mpGraphics && !ImplGetGraphics() )
+ return;
+
+ if( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if( mbOutputClipped )
+ return;
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+
+ if( !pGraphics )
+ return;
+#endif
+
+ const long nDistX = Max( rDist.Width(), 1L );
+ const long nDistY = Max( rDist.Height(), 1L );
+ long nX = ( rRect.Left() >= aDstRect.Left() ) ? rRect.Left() : ( rRect.Left() + ( ( aDstRect.Left() - rRect.Left() ) / nDistX ) * nDistX );
+ long nY = ( rRect.Top() >= aDstRect.Top() ) ? rRect.Top() : ( rRect.Top() + ( ( aDstRect.Top() - rRect.Top() ) / nDistY ) * nDistY );
+ const long nRight = aDstRect.Right();
+ const long nBottom = aDstRect.Bottom();
+ const long nStartX = ImplLogicXToDevicePixel( nX );
+ const long nEndX = ImplLogicXToDevicePixel( nRight );
+ const long nStartY = ImplLogicYToDevicePixel( nY );
+ const long nEndY = ImplLogicYToDevicePixel( nBottom );
+ long nHorzCount = 0L;
+ long nVertCount = 0L;
+
+ ::com::sun::star::uno::Sequence< sal_Int32 > aVertBuf;
+ ::com::sun::star::uno::Sequence< sal_Int32 > aHorzBuf;
+
+ if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_HORZLINES ) )
+ {
+ aVertBuf.realloc( aDstRect.GetHeight() / nDistY + 2L );
+ aVertBuf[ nVertCount++ ] = nStartY;
+ while( ( nY += nDistY ) <= nBottom )
+ aVertBuf[ nVertCount++ ] = ImplLogicYToDevicePixel( nY );
+ }
+
+ if( ( nFlags & GRID_DOTS ) || ( nFlags & GRID_VERTLINES ) )
+ {
+ aHorzBuf.realloc( aDstRect.GetWidth() / nDistX + 2L );
+ aHorzBuf[ nHorzCount++ ] = nStartX;
+ while( ( nX += nDistX ) <= nRight )
+ aHorzBuf[ nHorzCount++ ] = ImplLogicXToDevicePixel( nX );
+ }
+
+ if( mbInitLineColor )
+ ImplInitLineColor();
+
+ if( mbInitFillColor )
+ ImplInitFillColor();
+
+#ifndef REMOTE_APPSERVER
+ const BOOL bOldMap = mbMap;
+ mbMap = FALSE;
+
+ if( nFlags & GRID_DOTS )
+ {
+ for( long i = 0L; i < nVertCount; i++ )
+ for( long j = 0L, nY = aVertBuf[ i ]; j < nHorzCount; j++ )
+ mpGraphics->DrawPixel( aHorzBuf[ j ], nY );
+ }
+ else
+ {
+ if( nFlags & GRID_HORZLINES )
+ {
+ for( long i = 0L; i < nVertCount; i++ )
+ {
+ nY = aVertBuf[ i ];
+ mpGraphics->DrawLine( nStartX, nY, nEndX, nY );
+ }
+ }
+
+ if( nFlags & GRID_VERTLINES )
+ {
+ for( long i = 0L; i < nHorzCount; i++ )
+ {
+ nX = aHorzBuf[ i ];
+ mpGraphics->DrawLine( nX, nStartY, nX, nEndY );
+ }
+ }
+ }
+
+ mbMap = bOldMap;
+#else // REMOTE_APPSERVER
+ aHorzBuf.realloc( nHorzCount );
+ aVertBuf.realloc( nVertCount );
+ pGraphics->DrawGrid( nStartX, nEndX, aHorzBuf, nStartY, nEndY, aVertBuf, nFlags );
+#endif // REMOTE_APPSERVER
+}
+
+// ------------------------------------------------------------------------
+
+void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
+ USHORT nTransparencePercent )
+{
+ DBG_TRACE( "OutputDevice::DrawTransparent()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if( !mbFillColor || ( 0 == nTransparencePercent ) )
+ DrawPolyPolygon( rPolyPoly );
+ else if( 100 == nTransparencePercent )
+ {
+ Push( PUSH_FILLCOLOR );
+ SetFillColor();
+ DrawPolyPolygon( rPolyPoly );
+ Pop();
+ }
+ else
+ {
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTransparentAction( rPolyPoly, nTransparencePercent ) );
+
+ if( !IsDeviceOutputNecessary() || ( !mbLineColor && !mbFillColor ) )
+ return;
+
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ mpMetaFile = NULL;
+
+ if( OUTDEV_PRINTER == meOutDevType )
+ {
+ Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() );
+ const Size aDPISize( LogicToPixel( Size( 1, 1 ), MAP_INCH ) );
+ const long nBaseExtent = Max( FRound( aDPISize.Width() / 300. ), 1L );
+ long nMove;
+ const USHORT nTrans = ( nTransparencePercent < 13 ) ? 0 :
+ ( nTransparencePercent < 38 ) ? 25 :
+ ( nTransparencePercent < 63 ) ? 50 :
+ ( nTransparencePercent < 88 ) ? 75 : 100;
+
+ switch( nTrans )
+ {
+ case( 25 ): nMove = nBaseExtent * 3; break;
+ case( 50 ): nMove = nBaseExtent * 4; break;
+ case( 75 ): nMove = nBaseExtent * 6; break;
+ }
+
+ Push( PUSH_CLIPREGION | PUSH_LINECOLOR );
+ IntersectClipRegion( rPolyPoly );
+ SetLineColor( GetFillColor() );
+
+ Rectangle aRect( aPolyRect.TopLeft(), Size( aPolyRect.GetWidth(), nBaseExtent ) );
+
+ const BOOL bOldMap = mbMap;
+ mbMap = FALSE;
+
+ while( aRect.Top() <= aPolyRect.Bottom() )
+ {
+ DrawRect( aRect );
+ aRect.Move( 0, nMove );
+ }
+
+ aRect = Rectangle( aPolyRect.TopLeft(), Size( nBaseExtent, aPolyRect.GetHeight() ) );
+ while( aRect.Left() <= aPolyRect.Right() )
+ {
+ DrawRect( aRect );
+ aRect.Move( nMove, 0 );
+ }
+
+ mbMap = bOldMap;
+ Pop();
+ }
+ else
+ {
+#ifndef REMOTE_APPSERVER
+ PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) );
+ Rectangle aPolyRect( aPolyPoly.GetBoundRect() );
+ Point aPoint;
+ Rectangle aDstRect( aPoint, GetOutputSizePixel() );
+
+ aDstRect.Intersection( aPolyRect );
+
+ if( OUTDEV_WINDOW == meOutDevType )
+ {
+ const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
+
+ if( !aPaintRgn.IsNull() )
+ aDstRect.Intersection( LogicToPixel( aPaintRgn ).GetBoundRect() );
+ }
+
+ if( !aDstRect.IsEmpty() )
+ {
+ VirtualDevice aVDev( *this, 1 );
+ const Size aDstSz( aDstRect.GetSize() );
+ const BYTE cTrans = (BYTE) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 );
+
+ if( aDstRect.Left() || aDstRect.Top() )
+ aPolyPoly.Move( -aDstRect.Left(), -aDstRect.Top() );
+
+ if( aVDev.SetOutputSizePixel( aDstSz ) )
+ {
+ const BOOL bOldMap = mbMap;
+
+ mbMap = FALSE;
+
+ aVDev.SetLineColor( COL_BLACK );
+ aVDev.SetFillColor( COL_BLACK );
+ aVDev.DrawPolyPolygon( aPolyPoly );
+
+ Bitmap aPaint( GetBitmap( aDstRect.TopLeft(), aDstSz ) );
+ Bitmap aPolyMask( aVDev.GetBitmap( Point(), aDstSz ) );
+ BitmapWriteAccess* pW = aPaint.AcquireWriteAccess();
+ BitmapReadAccess* pR = aPolyMask.AcquireReadAccess();
+
+ if( pW && pR )
+ {
+ BitmapColor aPixCol;
+ const BitmapColor aFillCol( GetFillColor() );
+ const BitmapColor aWhite( pR->GetBestMatchingColor( Color( COL_WHITE ) ) );
+ const BitmapColor aBlack( pR->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ const long nWidth = pW->Width(), nHeight = pW->Height();
+ const long nR = aFillCol.GetRed(), nG = aFillCol.GetGreen(), nB = aFillCol.GetBlue();
+ long nX, nY;
+
+ if( aPaint.GetBitCount() <= 8 )
+ {
+ const BitmapPalette& rPal = pW->GetPalette();
+ const USHORT nCount = rPal.GetEntryCount();
+ BitmapColor* pMap = (BitmapColor*) new BYTE[ nCount * sizeof( BitmapColor ) ];
+
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ BitmapColor aCol( rPal[ i ] );
+ pMap[ i ] = BitmapColor( (BYTE) rPal.GetBestIndex( aCol.Merge( aFillCol, cTrans ) ) );
+ }
+
+ if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
+ pW->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ {
+ const BYTE cBlack = aBlack.GetIndex();
+
+ for( nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pWScan = pW->GetScanline( nY );
+ Scanline pRScan = pR->GetScanline( nY );
+ BYTE cBit = 128;
+
+ for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan++ )
+ {
+ if( !cBit )
+ cBit = 128, pRScan++;
+
+ if( ( *pRScan & cBit ) == cBlack )
+ *pWScan = (BYTE) pMap[ *pWScan ].GetIndex();
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0; nY < nHeight; nY++ )
+ for( nX = 0; nX < nWidth; nX++ )
+ if( pR->GetPixel( nY, nX ) == aBlack )
+ pW->SetPixel( nY, nX, pMap[ pW->GetPixel( nY, nX ).GetIndex() ] );
+ }
+
+ delete[] (BYTE*) pMap;
+ }
+ else
+ {
+ if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
+ pW->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR )
+ {
+ const BYTE cBlack = aBlack.GetIndex();
+
+ for( nY = 0; nY < nHeight; nY++ )
+ {
+ Scanline pWScan = pW->GetScanline( nY );
+ Scanline pRScan = pR->GetScanline( nY );
+ BYTE cBit = 128;
+
+ for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan += 3 )
+ {
+ if( !cBit )
+ cBit = 128, pRScan++;
+
+ if( ( *pRScan & cBit ) == cBlack )
+ {
+ pWScan[ 0 ] = COLOR_CHANNEL_MERGE( pWScan[ 0 ], nB, cTrans );
+ pWScan[ 1 ] = COLOR_CHANNEL_MERGE( pWScan[ 1 ], nG, cTrans );
+ pWScan[ 2 ] = COLOR_CHANNEL_MERGE( pWScan[ 2 ], nR, cTrans );
+ }
+ }
+ }
+ }
+ else
+ {
+ for( nY = 0; nY < nHeight; nY++ )
+ {
+ for( nX = 0; nX < nWidth; nX++ )
+ {
+ if( pR->GetPixel( nY, nX ) == aBlack )
+ {
+ aPixCol = pW->GetColor( nY, nX );
+ pW->SetPixel( nY, nX, aPixCol.Merge( aFillCol, cTrans ) );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ aPolyMask.ReleaseAccess( pR );
+ aPaint.ReleaseAccess( pW );
+
+ DrawBitmap( aDstRect.TopLeft(), aPaint );
+
+ mbMap = bOldMap;
+
+ if( mbLineColor )
+ {
+ Push( PUSH_FILLCOLOR );
+ SetFillColor();
+ DrawPolyPolygon( rPolyPoly );
+ Pop();
+ }
+ }
+ else
+ DrawPolyPolygon( rPolyPoly );
+ }
+#else // REMOTE_APPSERVER
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawTransparent( ImplLogicToDevicePixel( rPolyPoly ), nTransparencePercent );
+ }
+#endif // REMOTE_APPSERVER
+ }
+
+ mpMetaFile = pOldMetaFile;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
+ const Size& rSize, const Gradient& rTransparenceGradient )
+{
+ DBG_TRACE( "OutputDevice::DrawTransparent()" );
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ const Color aBlack( COL_BLACK );
+
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaFloatTransparentAction( rMtf, rPos, rSize, rTransparenceGradient ) );
+
+ if( rTransparenceGradient.GetStartColor() == aBlack && rTransparenceGradient.GetEndColor() == aBlack )
+ {
+ ( (GDIMetaFile&) rMtf ).WindStart();
+ ( (GDIMetaFile&) rMtf ).Play( this, rPos, rSize );
+ ( (GDIMetaFile&) rMtf ).WindStart();
+ }
+ else
+ {
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ Rectangle aOutRect( LogicToPixel( rPos ), LogicToPixel( rSize ) );
+ Point aPoint;
+ Rectangle aDstRect( aPoint, GetOutputSizePixel() );
+
+ mpMetaFile = NULL;
+ aDstRect.Intersection( aOutRect );
+
+ if( OUTDEV_WINDOW == meOutDevType )
+ {
+ const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
+
+ if( !aPaintRgn.IsNull() )
+ aDstRect.Intersection( LogicToPixel( aPaintRgn.GetBoundRect() ) );
+ }
+
+ if( !aDstRect.IsEmpty() )
+ {
+ VirtualDevice* pVDev = new VirtualDevice;
+
+ pVDev->mnDPIX = mnDPIX;
+ pVDev->mnDPIY = mnDPIY;
+
+ if( pVDev->SetOutputSizePixel( aDstRect.GetSize() ) )
+ {
+ Bitmap aPaint, aMask;
+ AlphaMask aAlpha;
+ MapMode aMap( GetMapMode() );
+ Point aOutPos( PixelToLogic( aDstRect.TopLeft() ) );
+ const BOOL bOldMap = mbMap;
+
+ aMap.SetOrigin( Point( -aOutPos.X(), -aOutPos.Y() ) );
+ pVDev->SetMapMode( aMap );
+
+ // create paint bitmap
+ ( (GDIMetaFile&) rMtf ).WindStart();
+ ( (GDIMetaFile&) rMtf ).Play( pVDev, rPos, rSize );
+ ( (GDIMetaFile&) rMtf ).WindStart();
+ pVDev->EnableMapMode( FALSE );
+ aPaint = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() );
+ pVDev->EnableMapMode( TRUE );
+
+ // create mask bitmap
+ pVDev->SetLineColor( COL_BLACK );
+ pVDev->SetFillColor( COL_BLACK );
+ pVDev->DrawRect( Rectangle( pVDev->PixelToLogic( Point() ), pVDev->GetOutputSize() ) );
+ pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT |
+ DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT );
+ ( (GDIMetaFile&) rMtf ).WindStart();
+ ( (GDIMetaFile&) rMtf ).Play( pVDev, rPos, rSize );
+ ( (GDIMetaFile&) rMtf ).WindStart();
+ pVDev->EnableMapMode( FALSE );
+ aMask = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() );
+ pVDev->EnableMapMode( TRUE );
+
+ // create alpha mask from gradient
+ pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT );
+ pVDev->DrawGradient( Rectangle( rPos, rSize ), rTransparenceGradient );
+ pVDev->SetDrawMode( DRAWMODE_DEFAULT );
+ pVDev->EnableMapMode( FALSE );
+ pVDev->DrawMask( Point(), pVDev->GetOutputSizePixel(), aMask, Color( COL_WHITE ) );
+
+#ifndef REMOTE_APPSERVER
+ aAlpha = pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() );
+#else
+ aAlpha.ImplSetBitmap( pVDev->GetBitmap( Point(), pVDev->GetOutputSizePixel() ) );
+#endif
+
+ delete pVDev;
+
+ mbMap = FALSE;
+ DrawBitmapEx( aDstRect.TopLeft(), BitmapEx( aPaint, aAlpha ) );
+ mbMap = bOldMap;
+ }
+ else
+ delete pVDev;
+ }
+
+ mpMetaFile = pOldMetaFile;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawColorWallpaper( long nX, long nY,
+ long nWidth, long nHeight,
+ const Wallpaper& rWallpaper )
+{
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbOutputClipped )
+ return;
+
+ // Wallpaper ohne Umrandung zeichnen
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+ SetLineColor();
+ SetFillColor( rWallpaper.GetColor() );
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ mpGraphics->DrawRect( nX+mnOutOffX, nY+mnOutOffY, nWidth, nHeight );
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+ SetLineColor();
+ SetFillColor( rWallpaper.GetColor() );
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
+ pGraphics->DrawRect( Rectangle( Point( nX+mnOutOffX, nY+mnOutOffY ), Size( nWidth, nHeight ) ) );
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY,
+ long nWidth, long nHeight,
+ const Wallpaper& rWallpaper )
+{
+ BitmapEx aBmpEx;
+ const BitmapEx* pCached = rWallpaper.ImplGetImpWallpaper()->ImplGetCachedBitmap();
+ Point aPos;
+ Size aSize;
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ const WallpaperStyle eStyle = rWallpaper.GetStyle();
+ const BOOL bOldMap = mbMap;
+ BOOL bDrawn = FALSE;
+ BOOL bDrawGradientBackground = FALSE;
+ BOOL bDrawColorBackground = FALSE;
+
+ if( pCached )
+ aBmpEx = *pCached;
+ else
+ aBmpEx = rWallpaper.GetBitmap();
+
+ const long nBmpWidth = aBmpEx.GetSizePixel().Width();
+ const long nBmpHeight = aBmpEx.GetSizePixel().Height();
+ const BOOL bTransparent = aBmpEx.IsTransparent();
+
+ // draw background
+ if( bTransparent )
+ {
+ if( rWallpaper.IsGradient() )
+ bDrawGradientBackground = TRUE;
+ else
+ {
+ if( !pCached && !rWallpaper.GetColor().GetTransparency() )
+ {
+ VirtualDevice aVDev( *this );
+ aVDev.SetBackground( rWallpaper.GetColor() );
+ aVDev.SetOutputSizePixel( Size( nBmpWidth, nBmpHeight ) );
+ aVDev.DrawBitmapEx( Point(), aBmpEx );
+ aBmpEx = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() );
+ }
+
+ bDrawColorBackground = TRUE;
+ }
+ }
+ else if( eStyle != WALLPAPER_TILE && eStyle != WALLPAPER_SCALE )
+ {
+ if( rWallpaper.IsGradient() )
+ bDrawGradientBackground = TRUE;
+ else
+ bDrawColorBackground = TRUE;
+ }
+
+ // background of bitmap?
+ if( bDrawGradientBackground )
+ ImplDrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
+ else if( bDrawColorBackground && bTransparent )
+ {
+ ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
+ bDrawColorBackground = FALSE;
+ }
+
+ // calc pos and size
+ if( rWallpaper.IsRect() )
+ {
+ const Rectangle aBound( LogicToPixel( rWallpaper.GetRect() ) );
+ aPos = aBound.TopLeft();
+ aSize = aBound.GetSize();
+ }
+ else
+ {
+ aPos = Point( nX, nY );
+ aSize = Size( nWidth, nHeight );
+ }
+
+ mpMetaFile = NULL;
+ mbMap = FALSE;
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) );
+
+ switch( eStyle )
+ {
+ case( WALLPAPER_SCALE ):
+ {
+ if( !pCached || ( pCached->GetSizePixel() != aSize ) )
+ {
+ if( pCached )
+ rWallpaper.ImplGetImpWallpaper()->ImplReleaseCachedBitmap();
+
+ aBmpEx = rWallpaper.GetBitmap();
+ aBmpEx.Scale( aSize );
+ aBmpEx = BitmapEx( aBmpEx.GetBitmap().CreateDisplayBitmap( this ), aBmpEx.GetMask() );
+ }
+ }
+ break;
+
+ case( WALLPAPER_TOPLEFT ):
+ break;
+
+ case( WALLPAPER_TOP ):
+ aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
+ break;
+
+ case( WALLPAPER_TOPRIGHT ):
+ aPos.X() += ( aSize.Width() - nBmpWidth );
+ break;
+
+ case( WALLPAPER_LEFT ):
+ aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
+ break;
+
+ case( WALLPAPER_CENTER ):
+ {
+ aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
+ aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
+ }
+ break;
+
+ case( WALLPAPER_RIGHT ):
+ {
+ aPos.X() += ( aSize.Width() - nBmpWidth );
+ aPos.Y() += ( aSize.Height() - nBmpHeight ) >> 1;
+ }
+ break;
+
+ case( WALLPAPER_BOTTOMLEFT ):
+ aPos.Y() += ( aSize.Height() - nBmpHeight );
+ break;
+
+ case( WALLPAPER_BOTTOM ):
+ {
+ aPos.X() += ( aSize.Width() - nBmpWidth ) >> 1;
+ aPos.Y() += ( aSize.Height() - nBmpHeight );
+ }
+ break;
+
+ case( WALLPAPER_BOTTOMRIGHT ):
+ {
+ aPos.X() += ( aSize.Width() - nBmpWidth );
+ aPos.Y() += ( aSize.Height() - nBmpHeight );
+ }
+ break;
+
+ default:
+ {
+ const long nRight = nX + nWidth - 1L;
+ const long nBottom = nY + nHeight - 1L;
+ long nFirstX;
+ long nFirstY;
+
+ if( eStyle == WALLPAPER_TILE )
+ {
+ nFirstX = aPos.X();
+ nFirstY = aPos.Y();
+ }
+ else
+ {
+ nFirstX = aPos.X() + ( ( aSize.Width() - nBmpWidth ) >> 1 );
+ nFirstY = aPos.Y() + ( ( aSize.Height() - nBmpHeight ) >> 1 );
+ }
+
+ const long nOffX = ( nFirstX - nX ) % nBmpWidth;
+ const long nOffY = ( nFirstY - nY ) % nBmpHeight;
+ long nStartX = nX + nOffX;
+ long nStartY = nY + nOffY;
+
+ if( nOffX > 0L )
+ nStartX -= nBmpWidth;
+
+ if( nOffY > 0L )
+ nStartY -= nBmpHeight;
+
+ for( long nBmpY = nStartY; nBmpY <= nBottom; nBmpY += nBmpHeight )
+ for( long nBmpX = nStartX; nBmpX <= nRight; nBmpX += nBmpWidth )
+ DrawBitmapEx( Point( nBmpX, nBmpY ), aBmpEx );
+
+ bDrawn = TRUE;
+ }
+ break;
+ }
+
+ if( !bDrawn )
+ {
+ // optimized for non-transparent bitmaps
+ if( bDrawColorBackground )
+ {
+ const Size aBmpSize( aBmpEx.GetSizePixel() );
+ const Point aTmpPoint;
+ const Rectangle aOutRect( aTmpPoint, GetOutputSizePixel() );
+ const Rectangle aColRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ Rectangle aWorkRect;
+
+ aWorkRect = Rectangle( 0, 0, aOutRect.Right(), aPos.Y() - 1L );
+ aWorkRect.Justify();
+ aWorkRect.Intersection( aColRect );
+ if( !aWorkRect.IsEmpty() )
+ {
+ ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
+ aWorkRect.GetWidth(), aWorkRect.GetHeight(),
+ rWallpaper );
+ }
+
+ aWorkRect = Rectangle( 0, aPos.Y(), aPos.X() - 1L, aPos.Y() + aBmpSize.Height() - 1L );
+ aWorkRect.Justify();
+ aWorkRect.Intersection( aColRect );
+ if( !aWorkRect.IsEmpty() )
+ {
+ ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
+ aWorkRect.GetWidth(), aWorkRect.GetHeight(),
+ rWallpaper );
+ }
+
+ aWorkRect = Rectangle( aPos.X() + aBmpSize.Width(), aPos.Y(), aOutRect.Right(), aPos.Y() + aBmpSize.Height() - 1L );
+ aWorkRect.Justify();
+ aWorkRect.Intersection( aColRect );
+ if( !aWorkRect.IsEmpty() )
+ {
+ ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
+ aWorkRect.GetWidth(), aWorkRect.GetHeight(),
+ rWallpaper );
+ }
+
+ aWorkRect = Rectangle( 0, aPos.Y() + aBmpSize.Height(), aOutRect.Right(), aOutRect.Bottom() );
+ aWorkRect.Justify();
+ aWorkRect.Intersection( aColRect );
+ if( !aWorkRect.IsEmpty() )
+ {
+ ImplDrawColorWallpaper( aWorkRect.Left(), aWorkRect.Top(),
+ aWorkRect.GetWidth(), aWorkRect.GetHeight(),
+ rWallpaper );
+ }
+ }
+
+ DrawBitmapEx( aPos, aBmpEx );
+ }
+
+ rWallpaper.ImplGetImpWallpaper()->ImplSetCachedBitmap( aBmpEx );
+
+ Pop();
+ mbMap = bOldMap;
+ mpMetaFile = pOldMetaFile;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawGradientWallpaper( long nX, long nY,
+ long nWidth, long nHeight,
+ const Wallpaper& rWallpaper )
+{
+ Rectangle aBound;
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ const BOOL bOldMap = mbMap;
+
+/*
+ if ( rWallpaper.IsRect() )
+ aBound = LogicToPixel( rWallpaper.GetRect() );
+ else
+*/
+ aBound = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) );
+
+ mpMetaFile = NULL;
+ mbMap = FALSE;
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) );
+
+ DrawGradient( aBound, rWallpaper.GetGradient() );
+
+ Pop();
+ mbMap = bOldMap;
+ mpMetaFile = pOldMetaFile;
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDrawWallpaper( long nX, long nY,
+ long nWidth, long nHeight,
+ const Wallpaper& rWallpaper )
+{
+ if( rWallpaper.IsBitmap() )
+ ImplDrawBitmapWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
+ else if( rWallpaper.IsGradient() )
+ ImplDrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
+ else
+ ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawWallpaper( const Rectangle& rRect,
+ const Wallpaper& rWallpaper )
+{
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaWallpaperAction( rRect, rWallpaper ) );
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ if ( rWallpaper.GetStyle() != WALLPAPER_NULL )
+ {
+ Rectangle aRect = LogicToPixel( rRect );
+ aRect.Justify();
+
+ if ( !aRect.IsEmpty() )
+ {
+ ImplDrawWallpaper( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(),
+ rWallpaper );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::Erase()
+{
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ if ( mbBackground )
+ {
+ RasterOp eRasterOp = GetRasterOp();
+ if ( eRasterOp != ROP_OVERPAINT )
+ SetRasterOp( ROP_OVERPAINT );
+ ImplDrawWallpaper( 0, 0, mnOutWidth, mnOutHeight, maBackground );
+ if ( eRasterOp != ROP_OVERPAINT )
+ SetRasterOp( eRasterOp );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect,
+ const Color& rLeftTopColor,
+ const Color& rRightBottomColor )
+{
+#ifndef REMOTE_APPSERVER
+ SetFillColor( rLeftTopColor );
+ DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
+ DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
+ SetFillColor( rRightBottomColor );
+ DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
+ DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
+#else
+ if ( mpMetaFile )
+ {
+ BOOL bOutputEnabled = IsOutputEnabled();
+ EnableOutput( FALSE );
+ SetFillColor( rLeftTopColor );
+ DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Left(), rRect.Bottom()-1 ) ) );
+ DrawRect( Rectangle( rRect.TopLeft(), Point( rRect.Right()-1, rRect.Top() ) ) );
+ SetFillColor( rRightBottomColor );
+ DrawRect( Rectangle( rRect.BottomLeft(), rRect.BottomRight() ) );
+ DrawRect( Rectangle( rRect.TopRight(), rRect.BottomRight() ) );
+ EnableOutput( bOutputEnabled );
+ }
+
+ if ( IsDeviceOutputNecessary() && !rRect.IsEmpty() )
+ {
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ {
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+ pGraphics->Draw2ColorFrame( aRect, rLeftTopColor, rRightBottomColor );
+ }
+ }
+ SetFillColor( rRightBottomColor );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
+ const GfxLink& rGfxLink, GDIMetaFile* pSubst )
+{
+ if ( mpMetaFile )
+ {
+ GDIMetaFile aSubst;
+
+ if( pSubst )
+ aSubst = *pSubst;
+
+ mpMetaFile->AddAction( new MetaEPSAction( rPoint, rSize, rGfxLink, aSubst ) );
+ }
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ Rectangle aRect( ImplLogicToDevicePixel( Rectangle( rPoint, rSize ) ) );
+ BOOL bDrawn = FALSE;
+
+ if( !aRect.IsEmpty() )
+ {
+ aRect.Justify();
+
+ if( GetOutDevType() == OUTDEV_PRINTER )
+ {
+#ifndef REMOTE_APPSERVER
+ if( !mpGraphics && !ImplGetGraphics() )
+ return;
+
+ if( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if( !mbOutputClipped )
+ {
+ bDrawn = mpGraphics->DrawEPS( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(),
+ (BYTE*) rGfxLink.GetData(), rGfxLink.GetDataSize() );
+ }
+#else
+ DBG_ERROR( "No direct EPS-support for remote appserver!" );
+#endif
+ }
+
+ if( !bDrawn && pSubst )
+ {
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+
+ mpMetaFile = NULL;
+ Graphic( *pSubst ).Draw( this, rPoint, rSize );
+ mpMetaFile = pOldMetaFile;
+ }
+ }
+}
diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx
new file mode 100644
index 000000000000..c086efb92bbc
--- /dev/null
+++ b/vcl/source/gdi/outmap.cxx
@@ -0,0 +1,2106 @@
+/*************************************************************************
+ *
+ * $RCSfile: outmap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <limits.h>
+
+#define _SV_OUTMAP_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+
+#ifndef _BIGINT_HXX
+#include <tools/bigint.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_POLY_H
+#include <poly.h>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_REGION_HXX
+#include <region.hxx>
+#endif
+#ifndef _SV_REGION_H
+#include <region.h>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_CURSOR_HXX
+#include <cursor.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_LINEINFO_HXX
+#include <lineinfo.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+
+// =======================================================================
+
+DBG_NAMEEX( OutputDevice );
+DBG_NAMEEX( Polygon );
+DBG_NAMEEX( PolyPolygon );
+DBG_NAMEEX( Region );
+
+// =======================================================================
+
+static long aImplNumeratorAry[MAP_PIXEL+1] =
+ { 1, 1, 5, 50, 1, 1, 1, 1, 1, 1, 1 };
+static long aImplDenominatorAry[MAP_PIXEL+1] =
+ { 2540, 254, 127, 127, 1000, 100, 10, 1, 72, 1440, 1 };
+
+// -----------------------------------------------------------------------
+
+/*
+Reduziert die Genauigkeit bis eine Fraction draus wird (sollte mal
+ein Fraction ctor werden) koennte man dann auch mit BigInts machen
+*/
+
+static Fraction ImplMakeFraction( long nN1, long nN2, long nD1, long nD2 )
+{
+ long i = 1;
+
+ if ( nN1 < 0 ) { i = -i; nN1 = -nN1; }
+ if ( nN2 < 0 ) { i = -i; nN2 = -nN2; }
+ if ( nD1 < 0 ) { i = -i; nD1 = -nD1; }
+ if ( nD2 < 0 ) { i = -i; nD2 = -nD2; }
+ // alle positiv; i Vorzeichen
+
+ Fraction aF( i*nN1, nD1 );
+ aF *= Fraction( nN2, nD2 );
+
+ while ( aF.GetDenominator() == -1 )
+ {
+ if ( nN1 > nN2 )
+ nN1 = (nN1 + 1) / 2;
+ else
+ nN2 = (nN2 + 1) / 2;
+ if ( nD1 > nD2 )
+ nD1 = (nD1 + 1) / 2;
+ else
+ nD2 = (nD2 + 1) / 2;
+
+ aF = Fraction( i*nN1, nD1 );
+ aF *= Fraction( nN2, nD2 );
+ }
+
+ return aF;
+}
+
+// -----------------------------------------------------------------------
+
+// Fraction.GetNumerator()
+// Fraction.GetDenominator() > 0
+// rOutRes.nPixPerInch? > 0
+// rMapRes.nMapScNum?
+// rMapRes.nMapScDenom? > 0
+
+static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY,
+ const ImplMapRes& rMapRes,
+ ImplThresholdRes& rThresRes )
+{
+ if ( LONG_MAX / nDPIX < Abs( rMapRes.mnMapScNumX ) )
+ {
+ rThresRes.mnThresLogToPixX = 0;
+ rThresRes.mnThresPixToLogX = 0;
+ }
+ else
+ {
+ // Schwellenwerte fuer BigInt Arithmetik berechnen
+ long nDenomHalfX = rMapRes.mnMapScDenomX / 2;
+ ULONG nDenomX = rMapRes.mnMapScDenomX;
+ long nProductX = nDPIX * rMapRes.mnMapScNumX;
+
+ if ( !nProductX )
+ rThresRes.mnThresLogToPixX = LONG_MAX;
+ else
+ rThresRes.mnThresLogToPixX = Abs( (LONG_MAX - nDenomHalfX) / nProductX );
+
+ if ( !nDenomX )
+ rThresRes.mnThresPixToLogX = LONG_MAX;
+ else if ( nProductX >= 0 )
+ rThresRes.mnThresPixToLogX = (long)(((ULONG)LONG_MAX - (ULONG)( nProductX/2)) / nDenomX);
+ else
+ rThresRes.mnThresPixToLogX = (long)(((ULONG)LONG_MAX + (ULONG)(-nProductX/2)) / nDenomX);
+ }
+
+ if ( LONG_MAX / nDPIY < Abs( rMapRes.mnMapScNumY ) )
+ {
+ rThresRes.mnThresLogToPixY = 0;
+ rThresRes.mnThresPixToLogY = 0;
+ }
+ else
+ {
+ // Schwellenwerte fuer BigInt Arithmetik berechnen
+ long nDenomHalfY = rMapRes.mnMapScDenomY / 2;
+ ULONG nDenomY = rMapRes.mnMapScDenomY;
+ long nProductY = nDPIY * rMapRes.mnMapScNumY;
+
+ if ( !nProductY )
+ rThresRes.mnThresLogToPixY = LONG_MAX;
+ else
+ rThresRes.mnThresLogToPixY = Abs( (LONG_MAX - nDenomHalfY) / nProductY );
+
+ if ( !nDenomY )
+ rThresRes.mnThresPixToLogY = LONG_MAX;
+ else if ( nProductY >= 0 )
+ rThresRes.mnThresPixToLogY = (long)(((ULONG)LONG_MAX - (ULONG)( nProductY/2)) / nDenomY);
+ else
+ rThresRes.mnThresPixToLogY = (long)(((ULONG)LONG_MAX + (ULONG)(-nProductY/2)) / nDenomY);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalcMapResolution( const MapMode& rMapMode,
+ long nDPIX, long nDPIY, ImplMapRes& rMapRes )
+{
+ switch ( rMapMode.GetMapUnit() )
+ {
+ case MAP_RELATIVE:
+ break;
+ case MAP_100TH_MM:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 2540;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 2540;
+ break;
+ case MAP_10TH_MM:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 254;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 254;
+ break;
+ case MAP_MM:
+ rMapRes.mnMapScNumX = 5; // 10
+ rMapRes.mnMapScDenomX = 127; // 254
+ rMapRes.mnMapScNumY = 5; // 10
+ rMapRes.mnMapScDenomY = 127; // 254
+ break;
+ case MAP_CM:
+ rMapRes.mnMapScNumX = 50; // 100
+ rMapRes.mnMapScDenomX = 127; // 254
+ rMapRes.mnMapScNumY = 50; // 100
+ rMapRes.mnMapScDenomY = 127; // 254
+ break;
+ case MAP_1000TH_INCH:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 1000;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 1000;
+ break;
+ case MAP_100TH_INCH:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 100;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 100;
+ break;
+ case MAP_10TH_INCH:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 10;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 10;
+ break;
+ case MAP_INCH:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 1;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 1;
+ break;
+ case MAP_POINT:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 72;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 72;
+ break;
+ case MAP_TWIP:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = 1440;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = 1440;
+ break;
+ case MAP_PIXEL:
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = nDPIX;
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = nDPIY;
+ break;
+ case MAP_SYSFONT:
+ case MAP_APPFONT:
+ case MAP_REALAPPFONT:
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maGDIData.mnAppFontX )
+ {
+ WorkWindow* pWin = new WorkWindow( NULL, 0 );
+ delete pWin;
+ }
+ if ( rMapMode.GetMapUnit() == MAP_REALAPPFONT )
+ rMapRes.mnMapScNumX = pSVData->maGDIData.mnRealAppFontX;
+ else
+ rMapRes.mnMapScNumX = pSVData->maGDIData.mnAppFontX;
+ rMapRes.mnMapScDenomX = nDPIX * 40;
+ rMapRes.mnMapScNumY = pSVData->maGDIData.mnAppFontY;;
+ rMapRes.mnMapScDenomY = nDPIY * 80;
+ }
+ break;
+ }
+
+ Fraction aScaleX = rMapMode.GetScaleX();
+ Fraction aScaleY = rMapMode.GetScaleY();
+
+ // Offset laut MapMode setzen
+ Point aOrigin = rMapMode.GetOrigin();
+ if ( rMapMode.GetMapUnit() != MAP_RELATIVE )
+ {
+ rMapRes.mnMapOfsX = aOrigin.X();
+ rMapRes.mnMapOfsY = aOrigin.Y();
+ }
+ else
+ {
+ BigInt aX( rMapRes.mnMapOfsX );
+ aX *= BigInt( aScaleX.GetDenominator() );
+ if ( rMapRes.mnMapOfsX >= 0 )
+ {
+ if ( aScaleX.GetNumerator() >= 0 )
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ else
+ aX -= BigInt( (aScaleX.GetNumerator()+1)/2 );
+ }
+ else
+ {
+ if ( aScaleX.GetNumerator() >= 0 )
+ aX -= BigInt( (aScaleX.GetNumerator()-1)/2 );
+ else
+ aX += BigInt( aScaleX.GetNumerator()/2 );
+ }
+ aX /= BigInt( aScaleX.GetNumerator() );
+ rMapRes.mnMapOfsX = (long)aX + aOrigin.X();
+ BigInt aY( rMapRes.mnMapOfsY );
+ aY *= BigInt( aScaleY.GetDenominator() );
+ if( rMapRes.mnMapOfsY >= 0 )
+ {
+ if ( aScaleY.GetNumerator() >= 0 )
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ else
+ aY -= BigInt( (aScaleY.GetNumerator()+1)/2 );
+ }
+ else
+ {
+ if ( aScaleY.GetNumerator() >= 0 )
+ aY -= BigInt( (aScaleY.GetNumerator()-1)/2 );
+ else
+ aY += BigInt( aScaleY.GetNumerator()/2 );
+ }
+ aY /= BigInt( aScaleY.GetNumerator() );
+ rMapRes.mnMapOfsY = (long)aY + aOrigin.Y();
+ }
+
+ // Scaling Faktor laut MapMode einberechnen
+ // aTemp? = rMapRes.mnMapSc? * aScale?
+ Fraction aTempX = ImplMakeFraction( rMapRes.mnMapScNumX,
+ aScaleX.GetNumerator(),
+ rMapRes.mnMapScDenomX,
+ aScaleX.GetDenominator() );
+ Fraction aTempY = ImplMakeFraction( rMapRes.mnMapScNumY,
+ aScaleY.GetNumerator(),
+ rMapRes.mnMapScDenomY,
+ aScaleY.GetDenominator() );
+ rMapRes.mnMapScNumX = aTempX.GetNumerator();
+ rMapRes.mnMapScDenomX = aTempX.GetDenominator();
+ rMapRes.mnMapScNumY = aTempY.GetNumerator();
+ rMapRes.mnMapScDenomY = aTempY.GetDenominator();
+
+ // hack: 0/n ungef"ahr 1/max
+ if ( !rMapRes.mnMapScNumX )
+ {
+ rMapRes.mnMapScNumX = 1;
+ rMapRes.mnMapScDenomX = LONG_MAX;
+ }
+ if ( !rMapRes.mnMapScNumY )
+ {
+ rMapRes.mnMapScNumY = 1;
+ rMapRes.mnMapScDenomY = LONG_MAX;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline void ImplCalcMapResolution( const MapMode& rMapMode,
+ long nDPIX, long nDPIY,
+ ImplMapRes& rMapRes,
+ ImplThresholdRes& rThresRes )
+{
+ ImplCalcMapResolution( rMapMode, nDPIX, nDPIY, rMapRes );
+ ImplCalcBigIntThreshold( nDPIX, nDPIY, rMapRes, rThresRes );
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetMapMode()
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( mpMetaFile )
+ mpMetaFile->AddAction( new MetaMapModeAction( MapMode() ) );
+
+ if ( mbMap || !maMapMode.IsDefault() )
+ {
+ mbMap = FALSE;
+ maMapMode = MapMode();
+
+ // create new objects (clip region werden nicht neu skaliert)
+ mbNewFont = TRUE;
+ mbInitFont = TRUE;
+ if ( GetOutDevType() == OUTDEV_WINDOW )
+ {
+ if ( ((Window*)this)->mpCursor )
+ ((Window*)this)->mpCursor->ImplNew();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetMapMode( const MapMode& rNewMapMode )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ BOOL bRelMap = (rNewMapMode.GetMapUnit() == MAP_RELATIVE);
+
+ if ( mpMetaFile )
+ {
+ mpMetaFile->AddAction( new MetaMapModeAction( rNewMapMode ) );
+#ifdef DBG_UTIL
+ if ( GetOutDevType() != OUTDEV_PRINTER )
+ DBG_ASSERTWARNING( bRelMap, "Please record only relative MapModes!" );
+#endif
+ }
+
+ // Ist der MapMode der gleiche wie vorher, dann mache nichts
+ if ( maMapMode == rNewMapMode )
+ return;
+
+ // Ist Default-MapMode, dann bereche nichts
+ BOOL bOldMap = mbMap;
+ mbMap = !rNewMapMode.IsDefault();
+ if ( mbMap )
+ {
+ // Falls nur der Orign umgesetzt wird, dann scaliere nichts neu
+ if ( (rNewMapMode.GetMapUnit() == maMapMode.GetMapUnit()) &&
+ (rNewMapMode.GetScaleX() == maMapMode.GetScaleX()) &&
+ (rNewMapMode.GetScaleY() == maMapMode.GetScaleY()) &&
+ (bOldMap == mbMap) )
+ {
+ // Offset setzen
+ Point aOrigin = rNewMapMode.GetOrigin();
+ maMapRes.mnMapOfsX = aOrigin.X();
+ maMapRes.mnMapOfsY = aOrigin.Y();
+ maMapMode = rNewMapMode;
+ return;
+ }
+ if ( !bOldMap && bRelMap )
+ {
+ maMapRes.mnMapScNumX = 1;
+ maMapRes.mnMapScNumY = 1;
+ maMapRes.mnMapScDenomX = mnDPIX;
+ maMapRes.mnMapScDenomY = mnDPIY;
+ maMapRes.mnMapOfsX = 0;
+ maMapRes.mnMapOfsY = 0;
+ }
+
+ // Neue MapMode-Aufloesung berechnen
+ ImplCalcMapResolution( rNewMapMode, mnDPIX, mnDPIY, maMapRes, maThresRes );
+ }
+
+ // Neuen MapMode setzen
+ if ( bRelMap )
+ {
+ Point aOrigin( maMapRes.mnMapOfsX, maMapRes.mnMapOfsY );
+ // aScale? = maMapMode.GetScale?() * rNewMapMode.GetScale?()
+ Fraction aScaleX = ImplMakeFraction( maMapMode.GetScaleX().GetNumerator(),
+ rNewMapMode.GetScaleX().GetNumerator(),
+ maMapMode.GetScaleX().GetDenominator(),
+ rNewMapMode.GetScaleX().GetDenominator() );
+ Fraction aScaleY = ImplMakeFraction( maMapMode.GetScaleY().GetNumerator(),
+ rNewMapMode.GetScaleY().GetNumerator(),
+ maMapMode.GetScaleY().GetDenominator(),
+ rNewMapMode.GetScaleY().GetDenominator() );
+ maMapMode.SetOrigin( aOrigin );
+ maMapMode.SetScaleX( aScaleX );
+ maMapMode.SetScaleY( aScaleY );
+ }
+ else
+ maMapMode = rNewMapMode;
+
+ // create new objects (clip region werden nicht neu skaliert)
+ mbNewFont = TRUE;
+ mbInitFont = TRUE;
+ if ( GetOutDevType() == OUTDEV_WINDOW )
+ {
+ if ( ((Window*)this)->mpCursor )
+ ((Window*)this)->mpCursor->ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode )
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ // Ist der MapMode der gleiche wie vorher, dann mache nichts
+ if ( maMapMode == rNewMapMode )
+ return;
+
+ MapUnit eOld = maMapMode.GetMapUnit();
+ MapUnit eNew = rNewMapMode.GetMapUnit();
+
+ // a?F = rNewMapMode.GetScale?() / maMapMode.GetScale?()
+ Fraction aXF = ImplMakeFraction( rNewMapMode.GetScaleX().GetNumerator(),
+ maMapMode.GetScaleX().GetDenominator(),
+ rNewMapMode.GetScaleX().GetDenominator(),
+ maMapMode.GetScaleX().GetNumerator() );
+ Fraction aYF = ImplMakeFraction( rNewMapMode.GetScaleY().GetNumerator(),
+ maMapMode.GetScaleY().GetDenominator(),
+ rNewMapMode.GetScaleY().GetDenominator(),
+ maMapMode.GetScaleY().GetNumerator() );
+
+ Point aPt( LogicToLogic( Point(), NULL, &rNewMapMode ) );
+ if ( eNew != eOld )
+ {
+ if ( eOld > MAP_PIXEL )
+ {
+ DBG_ERRORFILE( "Not implemented MapUnit" )
+ }
+ else if ( eNew > MAP_PIXEL )
+ {
+ DBG_ERRORFILE( "Not implemented MapUnit" )
+ }
+ else
+ {
+ Fraction aF( aImplNumeratorAry[eNew] * aImplDenominatorAry[eOld],
+ aImplNumeratorAry[eOld] * aImplDenominatorAry[eNew] );
+
+ // a?F = a?F * aF
+ aXF = ImplMakeFraction( aXF.GetNumerator(), aF.GetNumerator(),
+ aXF.GetDenominator(), aF.GetDenominator() );
+ aYF = ImplMakeFraction( aYF.GetNumerator(), aF.GetNumerator(),
+ aYF.GetDenominator(), aF.GetDenominator() );
+ if ( eOld == MAP_PIXEL )
+ {
+ aXF *= Fraction( mnDPIX, 1 );
+ aYF *= Fraction( mnDPIY, 1 );
+ }
+ else if ( eNew == MAP_PIXEL )
+ {
+ aXF *= Fraction( 1, mnDPIX );
+ aYF *= Fraction( 1, mnDPIY );
+ }
+ }
+ }
+
+ MapMode aNewMapMode( MAP_RELATIVE, Point( -aPt.X(), -aPt.Y() ), aXF, aYF );
+ SetMapMode( aNewMapMode );
+
+ if ( eNew != eOld )
+ maMapMode = rNewMapMode;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
+ long nThres )
+{
+ if ( Abs( n ) < nThres )
+ {
+ n *= nDPI * nMapNum;
+ n += n >= 0 ? nMapDenom/2 : -((nMapDenom-1)/2);
+ return (n / nMapDenom);
+ }
+ else
+ {
+ BigInt aTemp( n );
+ aTemp *= BigInt( nDPI );
+ aTemp *= BigInt( nMapNum );
+
+ if ( aTemp.IsNeg() )
+ {
+ BigInt aMapScDenom2( (nMapDenom-1)/2 );
+ aTemp -= aMapScDenom2;
+ }
+ else
+ {
+ BigInt aMapScDenom2( nMapDenom/2 );
+ aTemp += aMapScDenom2;
+ }
+
+ aTemp /= BigInt( nMapDenom );
+ return (long)aTemp;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
+ long nThres )
+{
+ if ( Abs( n ) < nThres )
+ {
+ long nDenom = nDPI * nMapNum;
+ long nNum = n * nMapDenom;
+ if ( nNum >= 0 )
+ {
+ if ( nDenom >= 0 )
+ nNum += nDenom/2;
+ else
+ nNum -= (nDenom+1)/2;
+ }
+ else
+ {
+ if ( nDenom >= 0 )
+ nNum -= (nDenom-1)/2;
+ else
+ nNum += nDenom/2;
+ }
+ return (nNum / nDenom);
+ }
+ else
+ {
+ BigInt aDenom( nDPI );
+ aDenom *= BigInt( nMapNum );
+
+ BigInt aNum( n );
+ aNum *= BigInt( nMapDenom );
+
+ BigInt aDenom2( aDenom );
+ if ( aNum.IsNeg() )
+ {
+ if ( aDenom.IsNeg() )
+ {
+ aDenom2 /= BigInt(2);
+ aNum += aDenom2;
+ }
+ else
+ {
+ aDenom2 -= 1;
+ aDenom2 /= BigInt(2);
+ aNum -= aDenom2;
+ }
+ }
+ else
+ {
+ if ( aDenom.IsNeg() )
+ {
+ aDenom2 += 1;
+ aDenom2 /= BigInt(2);
+ aNum -= aDenom2;
+ }
+ else
+ {
+ aDenom2 /= BigInt(2);
+ aNum += aDenom2;
+ }
+ }
+
+ aNum /= aDenom;
+ return (long)aNum;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplLogicXToDevicePixel( long nX ) const
+{
+ if ( !mbMap )
+ return nX+mnOutOffX;
+
+ return ImplLogicToPixel( nX + maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX )+mnOutOffX;
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplLogicYToDevicePixel( long nY ) const
+{
+ if ( !mbMap )
+ return nY+mnOutOffY;
+
+ return ImplLogicToPixel( nY + maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY )+mnOutOffY;
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplLogicWidthToDevicePixel( long nWidth ) const
+{
+ if ( !mbMap )
+ return nWidth;
+
+ return ImplLogicToPixel( nWidth, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX );
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplLogicHeightToDevicePixel( long nHeight ) const
+{
+ if ( !mbMap )
+ return nHeight;
+
+ return ImplLogicToPixel( nHeight, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY );
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplDevicePixelToLogicWidth( long nWidth ) const
+{
+ if ( !mbMap )
+ return nWidth;
+
+ return ImplPixelToLogic( nWidth, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX );
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::ImplDevicePixelToLogicHeight( long nHeight ) const
+{
+ if ( !mbMap )
+ return nHeight;
+
+ return ImplPixelToLogic( nHeight, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY );
+}
+
+// -----------------------------------------------------------------------
+
+Point OutputDevice::ImplLogicToDevicePixel( const Point& rLogicPt ) const
+{
+ if ( !mbMap )
+ return Point( rLogicPt.X()+mnOutOffX, rLogicPt.Y()+mnOutOffY );
+
+ return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX )+mnOutOffX,
+ ImplLogicToPixel( rLogicPt.Y() + maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY )+mnOutOffY );
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::ImplLogicToDevicePixel( const Size& rLogicSize ) const
+{
+ if ( !mbMap )
+ return rLogicSize;
+
+ return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::ImplLogicToDevicePixel( const Rectangle& rLogicRect ) const
+{
+ if ( rLogicRect.IsEmpty() )
+ return rLogicRect;
+
+ if ( !mbMap )
+ {
+ return Rectangle( rLogicRect.Left()+mnOutOffX, rLogicRect.Top()+mnOutOffY,
+ rLogicRect.Right()+mnOutOffX, rLogicRect.Bottom()+mnOutOffY );
+ }
+
+ return Rectangle( ImplLogicToPixel( rLogicRect.Left()+maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX )+mnOutOffX,
+ ImplLogicToPixel( rLogicRect.Top()+maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY )+mnOutOffY,
+ ImplLogicToPixel( rLogicRect.Right()+maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX )+mnOutOffX,
+ ImplLogicToPixel( rLogicRect.Bottom()+maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY )+mnOutOffY );
+}
+
+// -----------------------------------------------------------------------
+
+Polygon OutputDevice::ImplLogicToDevicePixel( const Polygon& rLogicPoly ) const
+{
+ if ( !mbMap && !mnOutOffX && !mnOutOffY )
+ return rLogicPoly;
+
+ USHORT i;
+ USHORT nPoints = rLogicPoly.GetSize();
+ Polygon aPoly( rLogicPoly );
+
+ // Pointer auf das Point-Array holen (Daten werden kopiert)
+#ifdef WIN
+ Point huge* pPointAry = (Point huge*)aPoly.ImplGetPointAry();
+#else
+ Point* pPointAry = aPoly.ImplGetPointAry();
+#endif
+
+ if ( mbMap )
+ {
+ for ( i = 0; i < nPoints; i++ )
+ {
+ Point* pPt = &(pPointAry[i]);
+ pPt->X() = ImplLogicToPixel( pPt->X()+maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX )+mnOutOffX;
+ pPt->Y() = ImplLogicToPixel( pPt->Y()+maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY )+mnOutOffY;
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nPoints; i++ )
+ {
+ Point* pPt = &(pPointAry[i]);
+ pPt->X() += mnOutOffX;
+ pPt->Y() += mnOutOffY;
+ }
+ }
+
+ return aPoly;
+}
+
+// -----------------------------------------------------------------------
+
+PolyPolygon OutputDevice::ImplLogicToDevicePixel( const PolyPolygon& rLogicPolyPoly ) const
+{
+ if ( !mbMap && !mnOutOffX && !mnOutOffY )
+ return rLogicPolyPoly;
+
+ PolyPolygon aPolyPoly( rLogicPolyPoly );
+ USHORT nPoly = aPolyPoly.Count();
+ for( USHORT i = 0; i < nPoly; i++ )
+ {
+ Polygon& rPoly = aPolyPoly[i];
+ rPoly = ImplLogicToDevicePixel( rPoly );
+ }
+ return aPolyPoly;
+}
+
+// -----------------------------------------------------------------------
+
+LineInfo OutputDevice::ImplLogicToDevicePixel( const LineInfo& rLineInfo ) const
+{
+ LineInfo aInfo( rLineInfo );
+
+ if( aInfo.GetStyle() == LINE_DASH )
+ {
+ if( aInfo.GetDotCount() && aInfo.GetDotLen() )
+ aInfo.SetDotLen( Max( ImplLogicWidthToDevicePixel( aInfo.GetDotLen() ), 1L ) );
+ else
+ aInfo.SetDotCount( 0 );
+
+ if( aInfo.GetDashCount() && aInfo.GetDashLen() )
+ aInfo.SetDashLen( Max( ImplLogicWidthToDevicePixel( aInfo.GetDashLen() ), 1L ) );
+ else
+ aInfo.SetDashCount( 0 );
+
+ aInfo.SetDistance( ImplLogicWidthToDevicePixel( aInfo.GetDistance() ) );
+
+ if( ( !aInfo.GetDashCount() && !aInfo.GetDotCount() ) || !aInfo.GetDistance() )
+ aInfo.SetStyle( LINE_SOLID );
+ }
+
+ aInfo.SetWidth( ImplLogicWidthToDevicePixel( aInfo.GetWidth() ) );
+
+ return aInfo;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::ImplDevicePixelToLogic( const Rectangle& rPixelRect ) const
+{
+ if ( rPixelRect.IsEmpty() )
+ return rPixelRect;
+
+ if ( !mbMap )
+ {
+ return Rectangle( rPixelRect.Left()-mnOutOffX, rPixelRect.Top()-mnOutOffY,
+ rPixelRect.Right()-mnOutOffX, rPixelRect.Bottom()-mnOutOffY );
+ }
+
+ return Rectangle( ImplPixelToLogic( rPixelRect.Left()-mnOutOffX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX )-maMapRes.mnMapOfsX,
+ ImplPixelToLogic( rPixelRect.Top()-mnOutOffY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY )-maMapRes.mnMapOfsY,
+ ImplPixelToLogic( rPixelRect.Right()-mnOutOffX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX )-maMapRes.mnMapOfsX,
+ ImplPixelToLogic( rPixelRect.Bottom()-mnOutOffY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY )-maMapRes.mnMapOfsY );
+}
+
+// -----------------------------------------------------------------------
+
+Region OutputDevice::ImplPixelToDevicePixel( const Region& rRegion ) const
+{
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+
+ if ( !mnOutOffX && !mnOutOffY )
+ return rRegion;
+
+ Region aRegion( rRegion );
+ aRegion.Move( mnOutOffX, mnOutOffY );
+ return aRegion;
+}
+
+// -----------------------------------------------------------------------
+
+Point OutputDevice::LogicToPixel( const Point& rLogicPt ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !mbMap )
+ return rLogicPt;
+
+ return Point( ImplLogicToPixel( rLogicPt.X() + maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicPt.Y() + maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::LogicToPixel( const Size& rLogicSize ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !mbMap )
+ return rLogicSize;
+
+ return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::LogicToPixel( const Rectangle& rLogicRect ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !mbMap || rLogicRect.IsEmpty() )
+ return rLogicRect;
+
+ return Rectangle( ImplLogicToPixel( rLogicRect.Left() + maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicRect.Top() + maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY ),
+ ImplLogicToPixel( rLogicRect.Right() + maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicRect.Bottom() + maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Polygon OutputDevice::LogicToPixel( const Polygon& rLogicPoly ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rLogicPoly, Polygon, NULL );
+
+ if ( !mbMap )
+ return rLogicPoly;
+
+ USHORT i;
+ USHORT nPoints = rLogicPoly.GetSize();
+ Polygon aPoly( rLogicPoly );
+
+ // Pointer auf das Point-Array holen (Daten werden kopiert)
+#ifdef WIN
+ Point huge* pPointAry = (Point huge*)aPoly.ImplGetPointAry();
+#else
+ Point* pPointAry = aPoly.ImplGetPointAry();
+#endif
+
+ for ( i = 0; i < nPoints; i++ )
+ {
+ Point* pPt = &(pPointAry[i]);
+ pPt->X() = ImplLogicToPixel( pPt->X() + maMapRes.mnMapOfsX, mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresLogToPixX );
+ pPt->Y() = ImplLogicToPixel( pPt->Y() + maMapRes.mnMapOfsY, mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresLogToPixY );
+ }
+
+ return aPoly;
+}
+
+// -----------------------------------------------------------------------
+
+PolyPolygon OutputDevice::LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rLogicPolyPoly, PolyPolygon, NULL );
+
+ if ( !mbMap )
+ return rLogicPolyPoly;
+
+ PolyPolygon aPolyPoly( rLogicPolyPoly );
+ USHORT nPoly = aPolyPoly.Count();
+ for( USHORT i = 0; i < nPoly; i++ )
+ {
+ Polygon& rPoly = aPolyPoly[i];
+ rPoly = LogicToPixel( rPoly );
+ }
+ return aPolyPoly;
+}
+
+// -----------------------------------------------------------------------
+
+Region OutputDevice::LogicToPixel( const Region& rLogicRegion ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rLogicRegion, Region, ImplDbgTestRegion );
+
+ RegionType eType = rLogicRegion.GetType();
+
+ if ( !mbMap || (eType == REGION_EMPTY) || (eType == REGION_NULL) )
+ return rLogicRegion;
+
+ Region aRegion;
+ PolyPolygon* pPolyPoly = rLogicRegion.ImplGetImplRegion()->mpPolyPoly;
+
+ if ( pPolyPoly )
+ aRegion = Region( LogicToPixel( *pPolyPoly ) );
+ else
+ {
+ long nX;
+ long nY;
+ long nWidth;
+ long nHeight;
+ ImplRegionInfo aInfo;
+ BOOL bRegionRect;
+
+ aRegion.ImplBeginAddRect();
+ bRegionRect = rLogicRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
+ while ( bRegionRect )
+ {
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ aRegion.ImplAddRect( LogicToPixel( aRect ) );
+ bRegionRect = rLogicRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
+ }
+ aRegion.ImplEndAddRect();
+ }
+
+ return aRegion;
+}
+
+// -----------------------------------------------------------------------
+
+Point OutputDevice::LogicToPixel( const Point& rLogicPt,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( rMapMode.IsDefault() )
+ return rLogicPt;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ return Point( ImplLogicToPixel( rLogicPt.X() + aMapRes.mnMapOfsX, mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicPt.Y() + aMapRes.mnMapOfsY, mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresLogToPixY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::LogicToPixel( const Size& rLogicSize,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( rMapMode.IsDefault() )
+ return rLogicSize;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ return Size( ImplLogicToPixel( rLogicSize.Width(), mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicSize.Height(), mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresLogToPixY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::LogicToPixel( const Rectangle& rLogicRect,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( rMapMode.IsDefault() || rLogicRect.IsEmpty() )
+ return rLogicRect;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ return Rectangle( ImplLogicToPixel( rLogicRect.Left() + aMapRes.mnMapOfsX, mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicRect.Top() + aMapRes.mnMapOfsY, mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresLogToPixY ),
+ ImplLogicToPixel( rLogicRect.Right() + aMapRes.mnMapOfsX, mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresLogToPixX ),
+ ImplLogicToPixel( rLogicRect.Bottom() + aMapRes.mnMapOfsY, mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresLogToPixY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Polygon OutputDevice::LogicToPixel( const Polygon& rLogicPoly,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rLogicPoly, Polygon, NULL );
+
+ if ( rMapMode.IsDefault() )
+ return rLogicPoly;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ USHORT i;
+ USHORT nPoints = rLogicPoly.GetSize();
+ Polygon aPoly( rLogicPoly );
+
+ // Pointer auf das Point-Array holen (Daten werden kopiert)
+#ifdef WIN
+ Point huge* pPointAry = (Point huge*)aPoly.ImplGetPointAry();
+#else
+ Point* pPointAry = aPoly.ImplGetPointAry();
+#endif
+
+ for ( i = 0; i < nPoints; i++ )
+ {
+ Point* pPt = &(pPointAry[i]);
+ pPt->X() = ImplLogicToPixel( pPt->X() + aMapRes.mnMapOfsX, mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresLogToPixX );
+ pPt->Y() = ImplLogicToPixel( pPt->Y() + aMapRes.mnMapOfsY, mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresLogToPixY );
+ }
+
+ return aPoly;
+}
+
+// -----------------------------------------------------------------------
+
+PolyPolygon OutputDevice::LogicToPixel( const PolyPolygon& rLogicPolyPoly,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rLogicPolyPoly, PolyPolygon, NULL );
+
+ if ( rMapMode.IsDefault() )
+ return rLogicPolyPoly;
+
+ PolyPolygon aPolyPoly( rLogicPolyPoly );
+ USHORT nPoly = aPolyPoly.Count();
+ for( USHORT i = 0; i < nPoly; i++ )
+ {
+ Polygon& rPoly = aPolyPoly[i];
+ rPoly = LogicToPixel( rPoly, rMapMode );
+ }
+ return aPolyPoly;
+}
+
+// -----------------------------------------------------------------------
+
+Region OutputDevice::LogicToPixel( const Region& rLogicRegion,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rLogicRegion, Region, ImplDbgTestRegion );
+
+ RegionType eType = rLogicRegion.GetType();
+
+ if ( rMapMode.IsDefault() || (eType == REGION_EMPTY) || (eType == REGION_NULL) )
+ return rLogicRegion;
+
+ Region aRegion;
+ PolyPolygon* pPolyPoly = rLogicRegion.ImplGetImplRegion()->mpPolyPoly;
+
+ if( pPolyPoly )
+ aRegion = Region( LogicToPixel( *pPolyPoly, rMapMode ) );
+ else
+ {
+ long nX;
+ long nY;
+ long nWidth;
+ long nHeight;
+ ImplRegionInfo aInfo;
+ BOOL bRegionRect;
+
+ aRegion.ImplBeginAddRect();
+ bRegionRect = rLogicRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
+ while ( bRegionRect )
+ {
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ aRegion.ImplAddRect( LogicToPixel( aRect, rMapMode ) );
+ bRegionRect = rLogicRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
+ }
+ aRegion.ImplEndAddRect();
+ }
+
+ return aRegion;
+}
+
+// -----------------------------------------------------------------------
+
+Point OutputDevice::PixelToLogic( const Point& rDevicePt ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !mbMap )
+ return rDevicePt;
+
+ return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX,
+ ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY );
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::PixelToLogic( const Size& rDeviceSize ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !mbMap )
+ return rDeviceSize;
+
+ return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX ),
+ ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::PixelToLogic( const Rectangle& rDeviceRect ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ if ( !mbMap || rDeviceRect.IsEmpty() )
+ return rDeviceRect;
+
+ return Rectangle( ImplPixelToLogic( rDeviceRect.Left(), mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX,
+ ImplPixelToLogic( rDeviceRect.Top(), mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY,
+ ImplPixelToLogic( rDeviceRect.Right(), mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX,
+ ImplPixelToLogic( rDeviceRect.Bottom(), mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY );
+}
+
+// -----------------------------------------------------------------------
+
+Polygon OutputDevice::PixelToLogic( const Polygon& rDevicePoly ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rDevicePoly, Polygon, NULL );
+
+ if ( !mbMap )
+ return rDevicePoly;
+
+ USHORT i;
+ USHORT nPoints = rDevicePoly.GetSize();
+ Polygon aPoly( rDevicePoly );
+
+ // Pointer auf das Point-Array holen (Daten werden kopiert)
+#ifdef WIN
+ Point huge* pPointAry = (Point huge*)aPoly.ImplGetPointAry();
+#else
+ Point* pPointAry = aPoly.ImplGetPointAry();
+#endif
+
+ for ( i = 0; i < nPoints; i++ )
+ {
+ Point* pPt = &(pPointAry[i]);
+ pPt->X() = ImplPixelToLogic( pPt->X(), mnDPIX,
+ maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX,
+ maThresRes.mnThresPixToLogX ) - maMapRes.mnMapOfsX;
+ pPt->Y() = ImplPixelToLogic( pPt->Y(), mnDPIY,
+ maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY,
+ maThresRes.mnThresPixToLogY ) - maMapRes.mnMapOfsY;
+ }
+
+ return aPoly;
+}
+
+// -----------------------------------------------------------------------
+
+PolyPolygon OutputDevice::PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rDevicePolyPoly, PolyPolygon, NULL );
+
+ if ( !mbMap )
+ return rDevicePolyPoly;
+
+ PolyPolygon aPolyPoly( rDevicePolyPoly );
+ USHORT nPoly = aPolyPoly.Count();
+ for( USHORT i = 0; i < nPoly; i++ )
+ {
+ Polygon& rPoly = aPolyPoly[i];
+ rPoly = PixelToLogic( rPoly );
+ }
+ return aPolyPoly;
+}
+
+// -----------------------------------------------------------------------
+
+Region OutputDevice::PixelToLogic( const Region& rDeviceRegion ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rDeviceRegion, Region, ImplDbgTestRegion );
+
+ RegionType eType = rDeviceRegion.GetType();
+
+ if ( !mbMap || (eType == REGION_EMPTY) || (eType == REGION_NULL) )
+ return rDeviceRegion;
+
+ Region aRegion;
+ PolyPolygon* pPolyPoly = rDeviceRegion.ImplGetImplRegion()->mpPolyPoly;
+
+ if ( pPolyPoly )
+ aRegion = Region( PixelToLogic( *pPolyPoly ) );
+ else
+ {
+ long nX;
+ long nY;
+ long nWidth;
+ long nHeight;
+ ImplRegionInfo aInfo;
+ BOOL bRegionRect;
+
+ aRegion.ImplBeginAddRect();
+ bRegionRect = rDeviceRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
+ while ( bRegionRect )
+ {
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ aRegion.ImplAddRect( PixelToLogic( aRect ) );
+ bRegionRect = rDeviceRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
+ }
+ aRegion.ImplEndAddRect();
+ }
+
+ return aRegion;
+}
+
+// -----------------------------------------------------------------------
+
+Point OutputDevice::PixelToLogic( const Point& rDevicePt,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ // Ist Default-MapMode, dann bereche nichts
+ if ( rMapMode.IsDefault() )
+ return rDevicePt;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ return Point( ImplPixelToLogic( rDevicePt.X(), mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX,
+ ImplPixelToLogic( rDevicePt.Y(), mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY );
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::PixelToLogic( const Size& rDeviceSize,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ // Ist Default-MapMode, dann bereche nichts
+ if ( rMapMode.IsDefault() )
+ return rDeviceSize;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ return Size( ImplPixelToLogic( rDeviceSize.Width(), mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresPixToLogX ),
+ ImplPixelToLogic( rDeviceSize.Height(), mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresPixToLogY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::PixelToLogic( const Rectangle& rDeviceRect,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+
+ // Ist Default-MapMode, dann bereche nichts
+ if ( rMapMode.IsDefault() || rDeviceRect.IsEmpty() )
+ return rDeviceRect;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ return Rectangle( ImplPixelToLogic( rDeviceRect.Left(), mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX,
+ ImplPixelToLogic( rDeviceRect.Top(), mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY,
+ ImplPixelToLogic( rDeviceRect.Right(), mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX,
+ ImplPixelToLogic( rDeviceRect.Bottom(), mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY );
+}
+
+// -----------------------------------------------------------------------
+
+Polygon OutputDevice::PixelToLogic( const Polygon& rDevicePoly,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rDevicePoly, Polygon, NULL );
+
+ // Ist Default-MapMode, dann bereche nichts
+ if ( rMapMode.IsDefault() )
+ return rDevicePoly;
+
+ // MapMode-Aufloesung berechnen und Umrechnen
+ ImplMapRes aMapRes;
+ ImplThresholdRes aThresRes;
+ ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes );
+
+ USHORT i;
+ USHORT nPoints = rDevicePoly.GetSize();
+ Polygon aPoly( rDevicePoly );
+
+ // Pointer auf das Point-Array holen (Daten werden kopiert)
+#ifdef WIN
+ Point huge* pPointAry = (Point huge*)aPoly.ImplGetPointAry();
+#else
+ Point* pPointAry = aPoly.ImplGetPointAry();
+#endif
+
+ for ( i = 0; i < nPoints; i++ )
+ {
+ Point* pPt = &(pPointAry[i]);
+ pPt->X() = ImplPixelToLogic( pPt->X(), mnDPIX,
+ aMapRes.mnMapScNumX, aMapRes.mnMapScDenomX,
+ aThresRes.mnThresPixToLogX ) - aMapRes.mnMapOfsX;
+ pPt->Y() = ImplPixelToLogic( pPt->Y(), mnDPIY,
+ aMapRes.mnMapScNumY, aMapRes.mnMapScDenomY,
+ aThresRes.mnThresPixToLogY ) - aMapRes.mnMapOfsY;
+ }
+
+ return aPoly;
+}
+
+// -----------------------------------------------------------------------
+
+PolyPolygon OutputDevice::PixelToLogic( const PolyPolygon& rDevicePolyPoly,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rDevicePolyPoly, PolyPolygon, NULL );
+
+ if ( rMapMode.IsDefault() )
+ return rDevicePolyPoly;
+
+ PolyPolygon aPolyPoly( rDevicePolyPoly );
+ USHORT nPoly = aPolyPoly.Count();
+ for( USHORT i = 0; i < nPoly; i++ )
+ {
+ Polygon& rPoly = aPolyPoly[i];
+ rPoly = PixelToLogic( rPoly, rMapMode );
+ }
+ return aPolyPoly;
+}
+
+// -----------------------------------------------------------------------
+
+Region OutputDevice::PixelToLogic( const Region& rDeviceRegion,
+ const MapMode& rMapMode ) const
+{
+ DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
+ DBG_CHKOBJ( &rDeviceRegion, Region, ImplDbgTestRegion );
+
+ RegionType eType = rDeviceRegion.GetType();
+
+ if ( rMapMode.IsDefault() || (eType == REGION_EMPTY) || (eType == REGION_NULL) )
+ return rDeviceRegion;
+
+ Region aRegion;
+ PolyPolygon* pPolyPoly = rDeviceRegion.ImplGetImplRegion()->mpPolyPoly;
+
+ if ( pPolyPoly )
+ aRegion = Region( PixelToLogic( *pPolyPoly, rMapMode ) );
+ else
+ {
+ long nX;
+ long nY;
+ long nWidth;
+ long nHeight;
+ ImplRegionInfo aInfo;
+ BOOL bRegionRect;
+
+ aRegion.ImplBeginAddRect();
+ bRegionRect = rDeviceRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
+ while ( bRegionRect )
+ {
+ Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) );
+ aRegion.ImplAddRect( PixelToLogic( aRect, rMapMode ) );
+ bRegionRect = rDeviceRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
+ }
+ aRegion.ImplEndAddRect();
+ }
+
+ return aRegion;
+}
+
+// -----------------------------------------------------------------------
+
+#define ENTER0( rSource, pMapModeSource, pMapModeDest ) \
+ if ( !pMapModeSource ) \
+ pMapModeSource = &maMapMode; \
+ if ( !pMapModeDest ) \
+ pMapModeDest = &maMapMode; \
+ if ( *pMapModeSource == *pMapModeDest ) \
+ return rSource
+
+// -----------------------------------------------------------------------
+
+#define ENTER1( rSource, pMapModeSource, pMapModeDest ) \
+ ENTER0( rSource, pMapModeSource, pMapModeDest ); \
+ \
+ ImplMapRes aMapResSource; \
+ ImplMapRes aMapResDest; \
+ \
+ if ( !mbMap || pMapModeSource != &maMapMode ) \
+ { \
+ if ( pMapModeSource->GetMapUnit() == MAP_RELATIVE ) \
+ aMapResSource = maMapRes; \
+ ImplCalcMapResolution( *pMapModeSource, \
+ mnDPIX, mnDPIY, aMapResSource ); \
+ } \
+ else \
+ aMapResSource = maMapRes; \
+ if ( !mbMap || pMapModeDest != &maMapMode ) \
+ { \
+ if ( pMapModeDest->GetMapUnit() == MAP_RELATIVE ) \
+ aMapResDest = maMapRes; \
+ ImplCalcMapResolution( *pMapModeDest, \
+ mnDPIX, mnDPIY, aMapResDest ); \
+ } \
+ else \
+ aMapResDest = maMapRes
+
+// -----------------------------------------------------------------------
+
+#define ENTER2( eUnitSource, eUnitDest ) \
+ DBG_ASSERT( eUnitSource != MAP_SYSFONT \
+ && eUnitSource != MAP_APPFONT \
+ && eUnitSource != MAP_RELATIVE, \
+ "Source MapUnit nicht erlaubt" ); \
+ DBG_ASSERT( eUnitDest != MAP_SYSFONT \
+ && eUnitDest != MAP_APPFONT \
+ && eUnitDest != MAP_RELATIVE, \
+ "Destination MapUnit nicht erlaubt" ); \
+ DBG_ASSERTWARNING( eUnitSource != MAP_PIXEL, \
+ "MAP_PIXEL mit 72dpi angenaehert" ); \
+ DBG_ASSERTWARNING( eUnitDest != MAP_PIXEL, \
+ "MAP_PIXEL mit 72dpi angenaehert" )
+
+// -----------------------------------------------------------------------
+
+#define ENTER3( eUnitSource, eUnitDest ) \
+ long nNumerator = aImplNumeratorAry[eUnitSource] * \
+ aImplDenominatorAry[eUnitDest]; \
+ long nDenominator = aImplNumeratorAry[eUnitDest] * \
+ aImplDenominatorAry[eUnitSource]; \
+ if ( eUnitSource == MAP_PIXEL ) \
+ nDenominator *= 72; \
+ else if( eUnitDest == MAP_PIXEL ) \
+ nNumerator *= 72
+
+// -----------------------------------------------------------------------
+
+#define ENTER4( rMapModeSource, rMapModeDest ) \
+ ImplMapRes aMapResSource; \
+ ImplMapRes aMapResDest; \
+ \
+ ImplCalcMapResolution( rMapModeSource, 72, 72, aMapResSource ); \
+ ImplCalcMapResolution( rMapModeDest, 72, 72, aMapResDest )
+
+// -----------------------------------------------------------------------
+
+// return (n1 * n2 * n3) / (n4 * n5)
+static long fn5( const long n1,
+ const long n2,
+ const long n3,
+ const long n4,
+ const long n5 )
+{
+ if ( n1 == 0 || n2 == 0 || n3 == 0 || n4 == 0 || n5 == 0 )
+ return 0;
+ if ( LONG_MAX / Abs(n2) < Abs(n3) )
+ {
+ // a6 wird "ubersprungen
+ BigInt a7 = n2;
+ a7 *= n3;
+ a7 *= n1;
+
+ if ( LONG_MAX / Abs(n4) < Abs(n5) )
+ {
+ BigInt a8 = n4;
+ a8 *= n5;
+
+ BigInt a9 = a8;
+ a9 /= 2;
+ if ( a7.IsNeg() )
+ a7 -= a9;
+ else
+ a7 += a9;
+
+ a7 /= a8;
+ } // of if
+ else
+ {
+ long n8 = n4 * n5;
+
+ if ( a7.IsNeg() )
+ a7 -= n8 / 2;
+ else
+ a7 += n8 / 2;
+
+ a7 /= n8;
+ } // of else
+ return (long)a7;
+ } // of if
+ else
+ {
+ long n6 = n2 * n3;
+
+ if ( LONG_MAX / Abs(n1) < Abs(n6) )
+ {
+ BigInt a7 = n1;
+ a7 *= n6;
+
+ if ( LONG_MAX / Abs(n4) < Abs(n5) )
+ {
+ BigInt a8 = n4;
+ a8 *= n5;
+
+ BigInt a9 = a8;
+ a9 /= 2;
+ if ( a7.IsNeg() )
+ a7 -= a9;
+ else
+ a7 += a9;
+
+ a7 /= a8;
+ } // of if
+ else
+ {
+ long n8 = n4 * n5;
+
+ if ( a7.IsNeg() )
+ a7 -= n8 / 2;
+ else
+ a7 += n8 / 2;
+
+ a7 /= n8;
+ } // of else
+ return (long)a7;
+ } // of if
+ else
+ {
+ long n7 = n1 * n6;
+
+ if ( LONG_MAX / Abs(n4) < Abs(n5) )
+ {
+ BigInt a7 = n7;
+ BigInt a8 = n4;
+ a8 *= n5;
+
+ BigInt a9 = a8;
+ a9 /= 2;
+ if ( a7.IsNeg() )
+ a7 -= a9;
+ else
+ a7 += a9;
+
+ a7 /= a8;
+ return (long)a7;
+ } // of if
+ else
+ {
+ const long n8 = n4 * n5;
+ const long n8_2 = n8 / 2;
+
+ if( n7 < 0 )
+ {
+ if( ( n7 - LONG_MIN ) >= n8_2 )
+ n7 -= n8_2;
+ }
+ else if( ( LONG_MAX - n7 ) >= n8_2 )
+ n7 += n8_2;
+
+ return n7 / n8;
+ } // of else
+ } // of else
+ } // of else
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+// return (n1 * n2) / n3
+static long fn3( const long n1, const long n2, const long n3 )
+{
+ if ( n1 == 0 || n2 == 0 || n3 == 0 )
+ return 0;
+ if ( LONG_MAX / Abs(n1) < Abs(n2) )
+ {
+ BigInt a4 = n1;
+ a4 *= n2;
+
+ if ( a4.IsNeg() )
+ a4 -= n3 / 2;
+ else
+ a4 += n3 / 2;
+
+ a4 /= n3;
+ return (long)a4;
+ } // of if
+ else
+ {
+ long n4 = n1 * n2;
+ const long n3_2 = n3 / 2;
+
+ if( n4 < 0 )
+ {
+ if( ( n4 - LONG_MIN ) >= n3_2 )
+ n4 -= n3_2;
+ }
+ else if( ( LONG_MAX - n4 ) >= n3_2 )
+ n4 += n3_2;
+
+ return n4 / n3;
+ } // of else
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Point OutputDevice::LogicToLogic( const Point& rPtSource,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest ) const
+{
+ ENTER1( rPtSource, pMapModeSource, pMapModeDest );
+
+ return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
+ aMapResDest.mnMapOfsX,
+ fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
+ aMapResDest.mnMapOfsY );
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::LogicToLogic( const Size& rSzSource,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest ) const
+{
+ ENTER1( rSzSource, pMapModeSource, pMapModeDest );
+
+ return Size( fn5( rSzSource.Width(),
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
+ fn5( rSzSource.Height(),
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::LogicToLogic( const Rectangle& rRectSource,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest ) const
+{
+ ENTER1( rRectSource, pMapModeSource, pMapModeDest );
+
+ return Rectangle( fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
+ aMapResDest.mnMapOfsX,
+ fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
+ aMapResDest.mnMapOfsY,
+ fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
+ aMapResDest.mnMapOfsX,
+ fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
+ aMapResDest.mnMapOfsY );
+}
+
+// -----------------------------------------------------------------------
+
+long* OutputDevice::LogicToLogic( long* pX, USHORT nCount,
+ const MapMode* pMapModeSource,
+ const MapMode* pMapModeDest ) const
+{
+ ENTER1( pX, pMapModeSource, pMapModeDest );
+
+ for( ; nCount; nCount--, pX++ )
+ {
+ *pX = fn5( *pX,
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX );
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+Point OutputDevice::LogicToLogic( const Point& rPtSource,
+ const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest )
+{
+ if ( rMapModeSource == rMapModeDest )
+ return rPtSource;
+
+ MapUnit eUnitSource = rMapModeSource.GetMapUnit();
+ MapUnit eUnitDest = rMapModeDest.GetMapUnit();
+ ENTER2( eUnitSource, eUnitDest );
+
+ if ( rMapModeSource.mpImplMapMode->mbSimple &&
+ rMapModeDest.mpImplMapMode->mbSimple )
+ {
+ ENTER3( eUnitSource, eUnitDest );
+
+ return Point( fn3( rPtSource.X(), nNumerator, nDenominator ),
+ fn3( rPtSource.Y(), nNumerator, nDenominator ) );
+ }
+ else
+ {
+ ENTER4( rMapModeSource, rMapModeDest );
+
+ return Point( fn5( rPtSource.X() + aMapResSource.mnMapOfsX,
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
+ aMapResDest.mnMapOfsX,
+ fn5( rPtSource.Y() + aMapResSource.mnMapOfsY,
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
+ aMapResDest.mnMapOfsY );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size OutputDevice::LogicToLogic( const Size& rSzSource,
+ const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest )
+{
+ if ( rMapModeSource == rMapModeDest )
+ return rSzSource;
+
+ MapUnit eUnitSource = rMapModeSource.GetMapUnit();
+ MapUnit eUnitDest = rMapModeDest.GetMapUnit();
+ ENTER2( eUnitSource, eUnitDest );
+
+ if ( rMapModeSource.mpImplMapMode->mbSimple &&
+ rMapModeDest.mpImplMapMode->mbSimple )
+ {
+ ENTER3( eUnitSource, eUnitDest );
+
+ return Size( fn3( rSzSource.Width(), nNumerator, nDenominator ),
+ fn3( rSzSource.Height(), nNumerator, nDenominator ) );
+ }
+ else
+ {
+ ENTER4( rMapModeSource, rMapModeDest );
+
+ return Size( fn5( rSzSource.Width(),
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ),
+ fn5( rSzSource.Height(),
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle OutputDevice::LogicToLogic( const Rectangle& rRectSource,
+ const MapMode& rMapModeSource,
+ const MapMode& rMapModeDest )
+{
+ if ( rMapModeSource == rMapModeDest )
+ return rRectSource;
+
+ MapUnit eUnitSource = rMapModeSource.GetMapUnit();
+ MapUnit eUnitDest = rMapModeDest.GetMapUnit();
+ ENTER2( eUnitSource, eUnitDest );
+
+ if ( rMapModeSource.mpImplMapMode->mbSimple &&
+ rMapModeDest.mpImplMapMode->mbSimple )
+ {
+ ENTER3( eUnitSource, eUnitDest );
+
+ return Rectangle( fn3( rRectSource.Left(), nNumerator, nDenominator ),
+ fn3( rRectSource.Top(), nNumerator, nDenominator ),
+ fn3( rRectSource.Right(), nNumerator, nDenominator ),
+ fn3( rRectSource.Bottom(), nNumerator, nDenominator ) );
+ }
+ else
+ {
+ ENTER4( rMapModeSource, rMapModeDest );
+
+ return Rectangle( fn5( rRectSource.Left() + aMapResSource.mnMapOfsX,
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
+ aMapResDest.mnMapOfsX,
+ fn5( rRectSource.Top() + aMapResSource.mnMapOfsY,
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
+ aMapResDest.mnMapOfsY,
+ fn5( rRectSource.Right() + aMapResSource.mnMapOfsX,
+ aMapResSource.mnMapScNumX, aMapResDest.mnMapScDenomX,
+ aMapResSource.mnMapScDenomX, aMapResDest.mnMapScNumX ) -
+ aMapResDest.mnMapOfsX,
+ fn5( rRectSource.Bottom() + aMapResSource.mnMapOfsY,
+ aMapResSource.mnMapScNumY, aMapResDest.mnMapScDenomY,
+ aMapResSource.mnMapScDenomY, aMapResDest.mnMapScNumY ) -
+ aMapResDest.mnMapOfsY );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long OutputDevice::LogicToLogic( long nLongSource,
+ MapUnit eUnitSource, MapUnit eUnitDest )
+{
+ if ( eUnitSource == eUnitDest )
+ return nLongSource;
+
+ ENTER2( eUnitSource, eUnitDest );
+ ENTER3( eUnitSource, eUnitDest );
+
+ return fn3( nLongSource, nNumerator, nDenominator );
+}
+
+// -----------------------------------------------------------------------
+
+long Window::ImplLogicUnitToPixelX( long nX, MapUnit eUnit )
+{
+ if ( eUnit != MAP_PIXEL )
+ {
+ ImplFrameData* pFrameData = mpFrameData;
+
+ // Map-Einheit verschieden, dann neu berechnen
+ if ( pFrameData->meMapUnit != eUnit )
+ {
+ pFrameData->meMapUnit = eUnit;
+ ImplCalcMapResolution( MapMode( eUnit ), mnDPIX, mnDPIY,
+ pFrameData->maMapUnitRes );
+ }
+
+ // Es wird kein BigInt gebraucht, da diese Funktion nur zur Umrechnung
+ // von Fensterposition benutzt wird
+ nX = nX * mnDPIX * pFrameData->maMapUnitRes.mnMapScNumX;
+ nX += nX >= 0 ? (pFrameData->maMapUnitRes.mnMapScDenomX/2) :
+ -((pFrameData->maMapUnitRes.mnMapScDenomX-1)/2);
+ nX /= pFrameData->maMapUnitRes.mnMapScDenomX;
+ }
+
+ return nX;
+}
+
+// -----------------------------------------------------------------------
+
+long Window::ImplLogicUnitToPixelY( long nY, MapUnit eUnit )
+{
+ if ( eUnit != MAP_PIXEL )
+ {
+ ImplFrameData* pFrameData = mpFrameData;
+
+ // Map-Einheit verschieden, dann neu berechnen
+ if ( pFrameData->meMapUnit != eUnit )
+ {
+ pFrameData->meMapUnit = eUnit;
+ ImplCalcMapResolution( MapMode( eUnit ), mnDPIX, mnDPIY,
+ pFrameData->maMapUnitRes );
+ }
+
+ // Es wird kein BigInt gebraucht, da diese Funktion nur zur Umrechnung
+ // von Fensterposition benutzt wird
+ nY = nY * mnDPIY * pFrameData->maMapUnitRes.mnMapScNumY;
+ nY += nY >= 0 ? (pFrameData->maMapUnitRes.mnMapScDenomY/2) :
+ -((pFrameData->maMapUnitRes.mnMapScDenomY-1)/2);
+ nY /= pFrameData->maMapUnitRes.mnMapScDenomY;
+ }
+
+ return nY;
+}
diff --git a/vcl/source/gdi/polyscan.cxx b/vcl/source/gdi/polyscan.cxx
new file mode 100644
index 000000000000..cb9714d51765
--- /dev/null
+++ b/vcl/source/gdi/polyscan.cxx
@@ -0,0 +1,389 @@
+/*************************************************************************
+ *
+ * $RCSfile: polyscan.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <tools/new.hxx>
+#include "salbtype.hxx"
+#include "poly.hxx"
+#include "polyscan.hxx"
+
+// ----------------
+// - PolyScanline -
+// ----------------
+
+PolyScanline::PolyScanline() :
+ mpFirst ( NULL ),
+ mpLast ( NULL ),
+ mpAct ( NULL ),
+ mnLeft ( 0L ),
+ mnRight ( 0L )
+{
+}
+
+// ------------------------------------------------------------------------
+
+PolyScanline::~PolyScanline()
+{
+ ImplDelete();
+}
+
+// ------------------------------------------------------------------------
+
+void PolyScanline::ImplDelete()
+{
+ ScanlinePoint* pAct = mpFirst;
+
+ while( pAct )
+ {
+ ScanlinePoint* pNext = pAct->mpNext;
+ delete pAct;
+ pAct = pNext;
+ }
+
+ mnLeft = mnRight = 0L;
+ mpFirst = mpAct = mpLast = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+void PolyScanline::Insert( long nX )
+{
+ // first point to insert?
+ if( !mpFirst )
+ mpLast = mpFirst = new ScanlinePoint( mnLeft = mnRight = nX, NULL );
+ else
+ {
+ // insert at the beginning of the scanline
+ if( nX <= mpFirst->mnX )
+ mpFirst = new ScanlinePoint( mnLeft = nX, mpFirst );
+ else if( nX >= mnRight )
+ mpLast = mpLast->mpNext = new ScanlinePoint( mnRight = nX, NULL );
+ else
+ {
+ ScanlinePoint* pLast = mpFirst;
+ ScanlinePoint* pAct = mpFirst->mpNext;
+
+ while( pAct )
+ {
+ // insert in the midlle of the scanline?
+ if( nX <= pAct->mnX )
+ {
+ pLast->mpNext = new ScanlinePoint( nX, pAct );
+ break;
+ }
+
+ pLast = pAct;
+ pAct = pAct->mpNext;
+ }
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void PolyScanline::Set( long nStart, long nEnd )
+{
+ if( mpFirst )
+ ImplDelete();
+
+ if( nStart <= nEnd )
+ mpFirst = new ScanlinePoint( mnLeft = nStart, mpLast = new ScanlinePoint( mnRight = nEnd, NULL ) );
+ else
+ mpFirst = new ScanlinePoint( mnLeft = nEnd, mpLast = new ScanlinePoint( mnRight = nStart, NULL ) );
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PolyScanline::GetFirstSegment( PolyScanSegment& rSegment )
+{
+ BOOL bRet = GetFirstX( rSegment.mnStart );
+
+ if( bRet && !GetNextX( rSegment.mnEnd ) )
+ rSegment.mnEnd = rSegment.mnStart;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL PolyScanline::GetNextSegment( PolyScanSegment& rSegment )
+{
+ BOOL bRet = GetNextX( rSegment.mnStart );
+
+ if( bRet && !GetNextX( rSegment.mnEnd ) )
+ rSegment.mnEnd = rSegment.mnStart;
+
+ return bRet;
+}
+
+// ---------------
+// - PolyScanner -
+// ---------------
+
+PolyScanner::PolyScanner( const Rectangle& rRect )
+{
+ if( !rRect.IsEmpty() )
+ {
+ Rectangle aRect( rRect );
+ ULONG nHeight;
+
+ aRect.Justify();
+ mnLeft = aRect.Left();
+ mnTop = aRect.Top();
+ mnRight = aRect.Right();
+ mnBottom = aRect.Bottom();
+ mpArray = new PolyScanline[ nHeight = Height() ];
+
+ for( ULONG i = 0UL; i < nHeight; i++ )
+ mpArray[ i ].Set( mnLeft, mnRight );
+ }
+ else
+ {
+ mnLeft = mnTop = mnRight = mnBottom = 0L;
+ mpArray = NULL;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+PolyScanner::PolyScanner( const Polygon& rPoly )
+{
+ const long nCount = rPoly.GetSize();
+
+ if( nCount )
+ {
+ long nLast = nCount - 1;
+ Point aFirst( rPoly[ 0 ] );
+ Point aLast( rPoly[ (USHORT) nLast ] );
+
+ while( nLast && ( aLast == aFirst ) )
+ aLast = rPoly[ (USHORT) --nLast ];
+
+ if( !nLast )
+ {
+ aLast = rPoly[ 0 ];
+ mnLeft = mnRight = aLast.X();
+ mnTop = mnBottom = aLast.Y();
+ mpArray = new PolyScanline[ 1UL ];
+ mpArray[ 0 ].Set( mnLeft, mnRight );
+ }
+ else
+ {
+ const Rectangle aRect( rPoly.GetBoundRect() );
+ ULONG nHeight;
+
+ mnLeft = aRect.Left();
+ mnTop = aRect.Top();
+ mnRight = aRect.Right();
+ mnBottom = aRect.Bottom();
+ aLast = aFirst;
+ mpArray = new PolyScanline[ nHeight = Height() ];
+
+ for( long i = 1L; i <= nLast; i++ )
+ {
+ const Point& rPt = rPoly[ (USHORT) i ];
+
+ if( rPt != aLast )
+ {
+ InsertLine( aLast, rPt );
+ aLast = rPt;
+ }
+ }
+
+ InsertLine( aLast, aFirst );
+ }
+ }
+ else
+ mpArray = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+PolyScanner::PolyScanner( const PolyPolygon& rPolyPoly )
+{
+ mpArray = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+PolyScanner::~PolyScanner()
+{
+ delete[] mpArray;
+}
+
+// ------------------------------------------------------------------------
+
+PolyScanline* PolyScanner::operator[]( ULONG nPos ) const
+{
+ DBG_ASSERT( nPos < Count(), "nPos out of range!" );
+ return( mpArray ? ( mpArray + nPos ) : NULL );
+}
+
+// ------------------------------------------------------------------------
+
+void PolyScanner::InsertLine( const Point& rStart, const Point& rEnd )
+{
+ long nX, nY;
+
+ if( rStart.Y() == rEnd.Y() )
+ mpArray[ rStart.Y() - mnTop ].Insert( rStart.X() );
+ else if( rStart.X() == rEnd.X() )
+ {
+ // vertical line
+ const long nEndY = rEnd.Y();
+
+ nX = rStart.X();
+ nY = rStart.Y();
+
+ if( nEndY > nY )
+ while( nY < nEndY )
+ mpArray[ nY++ - mnTop ].Insert( nX );
+ else
+ while( nY > nEndY )
+ mpArray[ nY-- - mnTop ].Insert( nX );
+ }
+ else
+ {
+ const long nDX = labs( rEnd.X() - rStart.X() );
+ const long nDY = labs( rEnd.Y() - rStart.Y() );
+ const long nStartX = rStart.X();
+ const long nStartY = rStart.Y();
+ const long nEndX = rEnd.X();
+ const long nEndY = rEnd.Y();
+ const long nXInc = ( nStartX < nEndX ) ? 1L : -1L;
+ const long nYInc = ( nStartY < nEndY ) ? 1L : -1L;
+ long nLastX = nStartX;
+ long nLastY = nStartY;
+ BOOL bLast = FALSE;
+
+ mpArray[ nStartY - mnTop ].Insert( nStartX );
+
+ if( nDX >= nDY )
+ {
+ const long nDYX = ( nDY - nDX ) << 1;
+ const long nDY2 = nDY << 1;
+ long nD = nDY2 - nDX;
+
+ for( nX = nStartX, nY = nLastY = nStartY; nX != nEndX; )
+ {
+ if( nY != nLastY )
+ {
+ if( bLast )
+ mpArray[ nLastY - mnTop ].Insert( nLastX );
+
+ mpArray[ nY - mnTop ].Insert( nX );
+ bLast = FALSE;
+ }
+ else
+ bLast = TRUE;
+
+ nLastX = nX;
+ nLastY = nY;
+
+ if( nD < 0L )
+ nD += nDY2;
+ else
+ {
+ nD += nDYX;
+ nY += nYInc;
+ }
+
+ nX += nXInc;
+ }
+ }
+ else
+ {
+ const long nDYX = ( nDX - nDY ) << 1;
+ const long nDY2 = nDX << 1;
+ long nD = nDY2 - nDY;
+
+ for( nX = nStartX, nY = nStartY; nY != nEndY; )
+ {
+ if( nY != nLastY )
+ {
+ if( bLast )
+ mpArray[ nLastY - mnTop ].Insert( nLastX );
+
+ mpArray[ nY - mnTop ].Insert( nX );
+ bLast = FALSE;
+ }
+ else
+ bLast = TRUE;
+
+ nLastX = nX;
+ nLastY = nY;
+
+ if( nD < 0L )
+ nD += nDY2;
+ else
+ {
+ nD += nDYX;
+ nX += nXInc;
+ }
+
+ nY += nYInc;
+ }
+ }
+
+ if( bLast )
+ mpArray[ nLastY - mnTop ].Insert( nLastX );
+ }
+}
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
new file mode 100644
index 000000000000..84c54f0cc5b2
--- /dev/null
+++ b/vcl/source/gdi/print.cxx
@@ -0,0 +1,1979 @@
+/*************************************************************************
+ *
+ * $RCSfile: print.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_PRINT_CXX
+#define _SPOOLPRINTER_EXT
+#define _RMPRINTER_EXT
+#define ENABLE_BYTESTRING_STREAM_OPERATORS
+
+#ifndef REMOTE_APPSERVER
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALPTYPE_HXX
+#include <salptype.hxx>
+#endif
+#ifndef _SV_SALPRN_HXX
+#include <salprn.hxx>
+#endif
+
+#else
+
+#include "rmoutdev.hxx"
+#include "rmprint.hxx"
+#include "rmwindow.hxx"
+#include "rvp.hxx"
+#include <vos/mutex.hxx>
+
+using namespace ::com::sun::star::uno;
+
+struct SalPrinterQueueInfo
+{
+ XubString maPrinterName;
+ XubString maDriver;
+ XubString maLocation;
+ XubString maComment;
+ ULONG mnStatus;
+ ULONG mnJobs;
+ void* mpSysData;
+
+ SalPrinterQueueInfo();
+ ~SalPrinterQueueInfo();
+};
+
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_JOBSET_H
+#include <jobset.h>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_PRINT_H
+#include <print.h>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_IMPPRN_HXX
+#include <impprn.hxx>
+#endif
+#ifndef _SV_PRINT_HXX
+#include <print.hxx>
+#endif
+
+int nImplSysDialog = 0;
+
+#define PRINTERSEQ_GET( _def_Seq, _def_Obj ) \
+{ \
+ SvMemoryStream* _def_pStm = new SvMemoryStream( (char*)_def_Seq.getConstArray(), _def_Seq.getLength(), STREAM_READ ); \
+ _def_pStm->SetCompressMode( COMPRESSMODE_FULL ); \
+ *_def_pStm >> _def_Obj; \
+ delete _def_pStm; \
+}
+
+#define PRINTERSEQ_SET( _def_Obj, _def_Seq, _def_Type ) \
+{ \
+ SvMemoryStream* _def_pStm = new SvMemoryStream( 8192, 8192 ); \
+ _def_pStm->SetCompressMode( COMPRESSMODE_FULL ); \
+ *_def_pStm << _def_Obj; \
+ _def_Seq = _def_Type( (sal_Int8*) (_def_pStm)->GetData(), (_def_pStm)->Tell() ); \
+ delete _def_pStm; \
+}
+
+// =======================================================================
+
+#define PAPER_SLOPPY 20
+#define PAPER_COUNT 9
+
+static long ImplPaperFormats[PAPER_COUNT*2] =
+{
+ 29700, 42000, // A3
+ 21000, 29700, // A4
+ 14800, 21000, // A5
+ 25000, 35300, // B4
+ 17600, 25000, // B5
+ 21600, 27900, // Letter
+ 21600, 35600, // Legal
+ 27900, 43100, // Tabloid
+ 0, 0 // USER
+};
+
+// =======================================================================
+
+Paper ImplGetPaperFormat( long nWidth100thMM, long nHeight100thMM )
+{
+ USHORT i;
+
+ for( i = 0; i < PAPER_COUNT; i++ )
+ {
+ if ( (ImplPaperFormats[i*2] == nWidth100thMM) &&
+ (ImplPaperFormats[i*2+1] == nHeight100thMM) )
+ return (Paper)i;
+ }
+
+ for( i = 0; i < PAPER_COUNT; i++ )
+ {
+ if ( (Abs( ImplPaperFormats[i*2]-nWidth100thMM ) < PAPER_SLOPPY) &&
+ (Abs( ImplPaperFormats[i*2+1]-nHeight100thMM ) < PAPER_SLOPPY) )
+ return (Paper)i;
+ }
+
+ return PAPER_USER;
+}
+
+// =======================================================================
+
+void ImplUpdateJobSetupPaper( JobSetup& rJobSetup )
+{
+ const ImplJobSetup* pConstData = rJobSetup.ImplGetConstData();
+
+ if ( !pConstData->mnPaperWidth || !pConstData->mnPaperHeight )
+ {
+ if ( pConstData->mePaperFormat != PAPER_USER )
+ {
+ ImplJobSetup* pData = rJobSetup.ImplGetData();
+ pData->mnPaperWidth = ImplPaperFormats[((USHORT)pConstData->mePaperFormat)*2];
+ pData->mnPaperHeight = ImplPaperFormats[((USHORT)pConstData->mePaperFormat)*2+1];
+ }
+ }
+ else if ( pConstData->mePaperFormat == PAPER_USER )
+ {
+ Paper ePaper = ImplGetPaperFormat( pConstData->mnPaperWidth, pConstData->mnPaperHeight );
+ if ( ePaper != PAPER_USER )
+ rJobSetup.ImplGetData()->mePaperFormat = ePaper;
+ }
+}
+
+// =======================================================================
+
+QueueInfo::QueueInfo()
+{
+ mnStatus = 0;
+ mnJobs = 0;
+}
+
+// -----------------------------------------------------------------------
+
+QueueInfo::QueueInfo( const QueueInfo& rInfo ) :
+ maPrinterName( rInfo.maPrinterName ),
+ maDriver( rInfo.maDriver ),
+ maLocation( rInfo.maLocation ),
+ maComment( rInfo.maComment ),
+ mnStatus( rInfo.mnStatus ),
+ mnJobs( rInfo.mnJobs )
+{
+}
+
+// -----------------------------------------------------------------------
+
+QueueInfo::~QueueInfo()
+{
+}
+
+// -----------------------------------------------------------------------
+
+const QueueInfo& QueueInfo::operator==( const QueueInfo& rInfo )
+{
+ maPrinterName = rInfo.maPrinterName;
+ maDriver = rInfo.maDriver;
+ maLocation = rInfo.maLocation;
+ maComment = rInfo.maComment;
+ mnStatus = rInfo.mnStatus;
+ mnJobs = rInfo.mnJobs;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStream, const QueueInfo& rInfo )
+{
+ VersionCompat aCompat( rOStream, STREAM_WRITE, 1 );
+
+ rOStream.WriteByteString( rInfo.maPrinterName, RTL_TEXTENCODING_UTF8 );
+ rOStream.WriteByteString( rInfo.maDriver, RTL_TEXTENCODING_UTF8 );
+ rOStream.WriteByteString( rInfo.maLocation, RTL_TEXTENCODING_UTF8 );
+ rOStream.WriteByteString( rInfo.maComment, RTL_TEXTENCODING_UTF8 );
+ rOStream << rInfo.mnStatus;
+ rOStream << rInfo.mnJobs;
+
+ return rOStream;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStream, QueueInfo& rInfo )
+{
+ VersionCompat aCompat( rIStream, STREAM_READ );
+
+ rIStream.ReadByteString( rInfo.maPrinterName, RTL_TEXTENCODING_UTF8 );
+ rIStream.ReadByteString( rInfo.maDriver, RTL_TEXTENCODING_UTF8 );
+ rIStream.ReadByteString( rInfo.maLocation, RTL_TEXTENCODING_UTF8 );
+ rIStream.ReadByteString( rInfo.maComment, RTL_TEXTENCODING_UTF8 );
+ rIStream >> rInfo.mnStatus;
+ rIStream >> rInfo.mnJobs;
+
+ return rIStream;
+}
+
+// =======================================================================
+
+SalPrinterQueueInfo::SalPrinterQueueInfo()
+{
+ mnStatus = 0;
+ mnJobs = QUEUE_JOBS_DONTKNOW;
+ mpSysData = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+SalPrinterQueueInfo::~SalPrinterQueueInfo()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ImplPrnQueueList::Add( SalPrinterQueueInfo* pData )
+{
+ ImplPrnQueueData* pInfo = new ImplPrnQueueData;
+ pInfo->mpQueueInfo = NULL;
+ pInfo->mpSalQueueInfo = pData;
+ List::Insert( (void*)pInfo, LIST_APPEND );
+}
+
+// =======================================================================
+
+static void ImplInitPrnQueueList()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ pSVData->maGDIData.mpPrinterQueueList = new ImplPrnQueueList;
+
+#ifndef REMOTE_APPSERVER
+ pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList );
+#else
+ if ( pSVData->mpRemotePrinterList && pSVData->mpRemotePrinterList->GetPrinterCount() )
+ {
+ const ULONG nCount = pSVData->mpRemotePrinterList->GetPrinterCount();
+ for( ULONG i = 0; i < nCount; i++ )
+ {
+ NMSP_CLIENT::RmQueueInfo aRmQInfo;
+ QueueInfo aQInfo;
+ SalPrinterQueueInfo* pNewInfo = new SalPrinterQueueInfo;
+
+ RemotePrinterInfo* pPrinterInfo = pSVData->mpRemotePrinterList->GetPrinter( i );
+ REF( NMSP_CLIENT::XRmPrinterEnvironment ) xPrinterEnv( pSVData->mpRemotePrinterList->GetPrinterEnv( pPrinterInfo->aServerName ) );
+
+ if ( xPrinterEnv.is() && xPrinterEnv->GetPrinterInfo(
+ pPrinterInfo->aPrinterName.GetBuffer(), aRmQInfo ) )
+ {
+ PRINTERSEQ_GET( aRmQInfo, aQInfo );
+ pNewInfo->maPrinterName = pPrinterInfo->GetFullName();
+ pNewInfo->maDriver = aQInfo.GetDriver();
+ pNewInfo->maLocation = aQInfo.GetLocation();
+ pNewInfo->maComment = aQInfo.GetComment();
+ pNewInfo->mnStatus = aQInfo.GetStatus();
+ pNewInfo->mnJobs = aQInfo.GetJobs();
+ pNewInfo->mpSysData = NULL;
+ pSVData->maGDIData.mpPrinterQueueList->Add( pNewInfo );
+ }
+ }
+ }
+ if ( !pSVData->maGDIData.mpPrinterQueueList->Count() )
+ {
+ SalPrinterQueueInfo* pNewInfo = new SalPrinterQueueInfo;
+ pNewInfo->maPrinterName = String::CreateFromAscii("No Printer");
+ pNewInfo->mpSysData = NULL;
+ pSVData->maGDIData.mpPrinterQueueList->Add( pNewInfo );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDeletePrnQueueList()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList;
+
+ if ( pPrnList )
+ {
+ ImplPrnQueueData* pInfo = pPrnList->First();
+ while ( pInfo )
+ {
+ if ( pInfo->mpQueueInfo )
+ delete pInfo->mpQueueInfo;
+
+#ifndef REMOTE_APPSERVER
+ pSVData->mpDefInst->DeletePrinterQueueInfo( pInfo->mpSalQueueInfo );
+#else
+ delete pInfo->mpSalQueueInfo;
+#endif
+
+ delete pInfo;
+ pInfo = pPrnList->Next();
+ }
+
+ delete pPrnList;
+ pSVData->maGDIData.mpPrinterQueueList = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Printer::GetQueueCount()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( !pSVData->maGDIData.mpPrinterQueueList )
+ ImplInitPrnQueueList();
+
+ return (USHORT)(pSVData->maGDIData.mpPrinterQueueList->Count());
+}
+
+// -----------------------------------------------------------------------
+
+const QueueInfo& Printer::GetQueueInfo( USHORT nQueue )
+{
+ return GetQueueInfo( nQueue, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+const QueueInfo& Printer::GetQueueInfo( USHORT nQueue, BOOL bStatus )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( !pSVData->maGDIData.mpPrinterQueueList )
+ ImplInitPrnQueueList();
+
+ DBG_ASSERT( nQueue < pSVData->maGDIData.mpPrinterQueueList->Count(),
+ "Printer::GetQueueInfo() - nQueue > QueueCount" );
+
+ ImplPrnQueueData* pInfo = pSVData->maGDIData.mpPrinterQueueList->Get( nQueue );
+
+#ifndef REMOTE_APPSERVER
+ if ( bStatus )
+ pSVData->mpDefInst->GetPrinterQueueState( pInfo->mpSalQueueInfo );
+#else
+ // ???
+#endif
+
+ if ( !pInfo->mpQueueInfo )
+ pInfo->mpQueueInfo = new QueueInfo;
+
+ pInfo->mpQueueInfo->maPrinterName = pInfo->mpSalQueueInfo->maPrinterName;
+ pInfo->mpQueueInfo->maDriver = pInfo->mpSalQueueInfo->maDriver;
+ pInfo->mpQueueInfo->maLocation = pInfo->mpSalQueueInfo->maLocation;
+ pInfo->mpQueueInfo->maComment = pInfo->mpSalQueueInfo->maComment;
+ pInfo->mpQueueInfo->mnStatus = pInfo->mpSalQueueInfo->mnStatus;
+ pInfo->mpQueueInfo->mnJobs = pInfo->mpSalQueueInfo->mnJobs;
+ return *pInfo->mpQueueInfo;
+}
+
+// -----------------------------------------------------------------------
+
+XubString Printer::GetDefaultPrinterName()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+#ifndef REMOTE_APPSERVER
+ return pSVData->mpDefInst->GetDefaultPrinter();
+#else
+ XubString aDefPrinterName;
+ if ( pSVData->mpRemotePrinterList )
+ {
+ RemotePrinterInfo* pDefPrinter = pSVData->mpRemotePrinterList->GetDefaultPrinter();
+ if ( pDefPrinter )
+ aDefPrinterName = pDefPrinter->GetFullName();
+
+ }
+ return aDefPrinterName;
+#endif
+}
+
+// =======================================================================
+
+void Printer::ImplInitData()
+{
+ mbDevOutput = FALSE;
+ meOutDevType = OUTDEV_PRINTER;
+
+ mbDefPrinter = FALSE;
+ mnError = 0;
+ mnCurPage = 0;
+ mnCurPrintPage = 0;
+ mnPageQueueSize = 0;
+ mnCopyCount = 1;
+ mbCollateCopy = FALSE;
+ mbPrinting = FALSE;
+ mbJobActive = FALSE;
+ mbPrintFile = FALSE;
+ mbInPrintPage = FALSE;
+ mbNewJobSetup = FALSE;
+ mpInfoPrinter = NULL;
+ mpPrinter = NULL;
+ mpDisplayDev = NULL;
+ mpQPrinter = NULL;
+ mpQMtf = NULL;
+ mbIsQueuePrinter = FALSE;
+
+ // Printer in die Liste eintragen
+ ImplSVData* pSVData = ImplGetSVData();
+ mpNext = pSVData->maGDIData.mpFirstPrinter;
+ mpPrev = NULL;
+ if ( mpNext )
+ mpNext->mpPrev = this;
+ else
+ pSVData->maGDIData.mpLastPrinter = this;
+ pSVData->maGDIData.mpFirstPrinter = this;
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::ImplInit( SalPrinterQueueInfo* pInfo )
+{
+ // Testen, ob Treiber ueberhaupt mit dem JobSetup uebereinstimmt
+ ImplJobSetup* pJobSetup = maJobSetup.ImplGetData();
+
+ if ( pJobSetup->mpDriverData )
+ {
+ if ( (pJobSetup->maPrinterName != pInfo->maPrinterName) ||
+ (pJobSetup->maDriver != pInfo->maDriver) )
+ {
+ delete pJobSetup->mpDriverData;
+ pJobSetup->mpDriverData = NULL;
+ pJobSetup->mnDriverDataLen = 0;
+ }
+ }
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Printernamen merken
+ maPrinterName = pInfo->maPrinterName;
+ maDriver = pInfo->maDriver;
+
+ // In JobSetup den Printernamen eintragen
+ pJobSetup->maPrinterName = maPrinterName;
+ pJobSetup->maDriver = maDriver;
+
+#ifndef REMOTE_APPSERVER
+ mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, pJobSetup );
+ mpPrinter = NULL;
+ mpJobPrinter = NULL;
+ mpJobGraphics = NULL;
+ ImplUpdateJobSetupPaper( maJobSetup );
+
+ if ( !mpInfoPrinter )
+ {
+ ImplInitDisplay( NULL );
+ return;
+ }
+
+ // we need a graphics
+ if ( !ImplGetGraphics() )
+ {
+ ImplInitDisplay( NULL );
+ return;
+ }
+#else
+
+ String aPrinterName( maPrinterName.GetToken( 0, '@' ) );
+ String aPrintServerName( maPrinterName.GetToken( 1, '@' ) );
+
+
+ mpInfoPrinter = new RmPrinter;
+
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xPrinterFactory;
+ Reference< NMSP_CLIENT::XRmPrinter > xPrinter;
+
+ if (pSVData->mpRemotePrinterList)
+ {
+// if ( !aPrintServerName.Len() )
+// aPrintServerName = pSVData->mpRemotePrinterList->FindLocalPrintServer( aPrinterName );
+
+ xPrinterFactory = pSVData->mpRemotePrinterList->GetServerFactory( aPrintServerName );
+ if( xPrinterFactory.is() )
+ {
+ xPrinter = Reference< NMSP_CLIENT::XRmPrinter >( xPrinterFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OfficePrinter.stardiv.de" ) ) ), NMSP_UNO::UNO_QUERY );
+ mpInfoPrinter->SetInterface( xPrinter );
+ }
+ }
+
+ if ( ! xPrinter.is() )
+ {
+ delete mpInfoPrinter;
+ mpInfoPrinter = NULL;
+ ImplInitDisplay( NULL );
+ return;
+ }
+ else
+ {
+ QueueInfo aQInfo;
+ NMSP_CLIENT::RmQueueInfo aRmQInfo;
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+ const REF( NMSP_CLIENT::XRmPrinter )& rxPrinter = mpInfoPrinter->GetInterface();
+
+ aQInfo.maPrinterName = aPrinterName;
+ aQInfo.maDriver = pInfo->maDriver;
+ aQInfo.maLocation = pInfo->maLocation;
+ aQInfo.maComment = pInfo->maComment;
+ aQInfo.mnStatus = pInfo->mnStatus;
+ aQInfo.mnJobs = pInfo->mnJobs;
+
+ PRINTERSEQ_SET( aQInfo, aRmQInfo, NMSP_CLIENT::RmQueueInfo );
+ mpInfoPrinter->Create( aRmQInfo, aRmJobSetup );
+ PRINTERSEQ_GET( aRmJobSetup, maJobSetup );
+
+ if( rxPrinter.is() )
+ {
+ mpGraphics = new ImplServerGraphics( pSVData->mpRemotePrinterList->GetServerAtoms( aPrintServerName ) );
+ mpGraphics->SetInterface( REF( NMSP_CLIENT::XRmOutputDevice )( rxPrinter, NMSP_UNO::UNO_QUERY ) );
+ }
+
+ if( !mpGraphics->GetInterface().is() )
+ {
+ delete mpGraphics, mpGraphics = NULL;
+ delete mpInfoPrinter, mpInfoPrinter = NULL;
+ ImplInitDisplay( NULL );
+ return;
+ }
+ }
+#endif
+
+ // Daten initialisieren
+ ImplUpdatePageData();
+ mpFontList = new ImplDevFontList;
+ mpFontCache = new ImplFontCache( TRUE );
+ mpGraphics->GetDevFontList( mpFontList );
+ mpFontList->InitStdFonts();
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::ImplInitDisplay( const Window* pWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ mpInfoPrinter = NULL;
+ mpPrinter = NULL;
+ mpJobPrinter = NULL;
+ mpJobGraphics = NULL;
+
+ if ( pWindow )
+ mpDisplayDev = new VirtualDevice( *pWindow );
+ else
+ mpDisplayDev = new VirtualDevice();
+ mpFontList = pSVData->maGDIData.mpScreenFontList;
+ mpFontCache = pSVData->maGDIData.mpScreenFontCache;
+ mnDPIX = mpDisplayDev->mnDPIX;
+ mnDPIY = mpDisplayDev->mnDPIY;
+
+#ifdef REMOTE_APPSERVER
+ mpGraphics = mpDisplayDev->mpGraphics;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const XubString& rPrinterName,
+ const XubString* pDriver )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maGDIData.mpPrinterQueueList )
+ ImplInitPrnQueueList();
+
+ ImplPrnQueueList* pPrnList = pSVData->maGDIData.mpPrinterQueueList;
+ if ( pPrnList && pPrnList->Count() )
+ {
+ // Zuerst suchen wir nach dem Printer-Namen
+ ImplPrnQueueData* pBestInfo = NULL;
+ ImplPrnQueueData* pInfo = pPrnList->First();
+ while ( pInfo )
+ {
+ if ( pInfo->mpSalQueueInfo->maPrinterName == rPrinterName )
+ {
+ pBestInfo = pInfo;
+ if ( !pDriver || (pInfo->mpSalQueueInfo->maDriver == *pDriver) )
+ return pInfo->mpSalQueueInfo;
+ }
+ pInfo = pPrnList->Next();
+ }
+
+ // Wenn wir einen PrinterNamen gefunden haben und nur der Treiber
+ // nicht passt, nehmen wir diesen
+ if ( pBestInfo )
+ return pBestInfo->mpSalQueueInfo;
+
+ // Dann suchen wir caseinsensitiv
+ pInfo = pPrnList->First();
+ while ( pInfo )
+ {
+ if ( pInfo->mpSalQueueInfo->maPrinterName.EqualsIgnoreCaseAscii( rPrinterName ) )
+ {
+ pBestInfo = pInfo;
+ if ( !pDriver || pInfo->mpSalQueueInfo->maDriver.EqualsIgnoreCaseAscii( *pDriver ) )
+ return pInfo->mpSalQueueInfo;
+ }
+ pInfo = pPrnList->Next();
+ }
+
+ // Wenn wir einen PrinterNamen gefunden haben und nur der Treiber
+ // nicht passt, nehmen wir diesen
+ if ( pBestInfo )
+ return pBestInfo->mpSalQueueInfo;
+
+ // Und wenn wir immer noch keinen gefunden haben, suchen wir
+ // noch nach einem passenden Treiber
+ if ( pDriver )
+ {
+ pInfo = pPrnList->First();
+ while ( pInfo )
+ {
+ if ( pInfo->mpSalQueueInfo->maDriver == *pDriver )
+ return pInfo->mpSalQueueInfo;
+ pInfo = pPrnList->Next();
+ }
+ }
+
+ // Und wenn wir immer noch keinen gefunden, dann wir der
+ // Default-Drucker genommen
+ XubString aPrinterName = GetDefaultPrinterName();
+ pInfo = pPrnList->First();
+ while ( pInfo )
+ {
+ if ( pInfo->mpSalQueueInfo->maPrinterName == aPrinterName )
+ return pInfo->mpSalQueueInfo;
+ pInfo = pPrnList->Next();
+ }
+
+ // Und wenn wir diesen auch nicht finden, nehmen wir den ersten
+ // in der Liste, denn einige Installationen zerstoeren den
+ // Namen und andere Programme weichen dann normalerweise noch
+ // auf irgendeinen Drucker aus
+ pInfo = pPrnList->First();
+ if ( pInfo )
+ return pInfo->mpSalQueueInfo;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::ImplUpdatePageData()
+{
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !ImplGetGraphics() )
+ return;
+
+ mpGraphics->GetResolution( mnDPIX, mnDPIY );
+ mpInfoPrinter->GetPageInfo( maJobSetup.ImplGetConstData(),
+ mnOutWidth, mnOutHeight,
+ maPageOffset.X(), maPageOffset.Y(),
+ maPaperSize.Width(), maPaperSize.Height() );
+#else
+ if ( mpInfoPrinter && mpGraphics )
+ {
+ mpGraphics->GetResolution( mnDPIX, mnDPIY );
+ mpInfoPrinter->GetPageInfo( mnOutWidth, mnOutHeight,
+ maPageOffset.X(), maPageOffset.Y(),
+ maPaperSize.Width(), maPaperSize.Height() );
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::ImplUpdateFontList()
+{
+ ImplUpdateFontData( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+Printer::Printer()
+{
+ ImplInitData();
+ SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( GetDefaultPrinterName(), NULL );
+ if ( pInfo )
+ {
+ ImplInit( pInfo );
+ if ( !IsDisplayPrinter() )
+ mbDefPrinter = TRUE;
+ }
+ else
+ ImplInitDisplay( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+Printer::Printer( const Window* pWindow )
+{
+ ImplInitData();
+ ImplInitDisplay( pWindow );
+}
+
+// -----------------------------------------------------------------------
+
+Printer::Printer( const JobSetup& rJobSetup ) :
+ maJobSetup( rJobSetup )
+{
+ ImplInitData();
+ SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rJobSetup.mpData->maPrinterName,
+ &rJobSetup.mpData->maDriver );
+ if ( pInfo )
+ {
+ ImplInit( pInfo );
+ SetJobSetup( rJobSetup );
+ }
+ else
+ {
+ ImplInitDisplay( NULL );
+ maJobSetup = JobSetup();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Printer::Printer( const QueueInfo& rQueueInfo )
+{
+ ImplInitData();
+ SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rQueueInfo.GetPrinterName(),
+ &rQueueInfo.GetDriver() );
+ if ( pInfo )
+ ImplInit( pInfo );
+ else
+ ImplInitDisplay( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+Printer::Printer( const XubString& rPrinterName )
+{
+ ImplInitData();
+ SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rPrinterName, NULL );
+ if ( pInfo )
+ ImplInit( pInfo );
+ else
+ ImplInitDisplay( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+Printer::~Printer()
+{
+ DBG_ASSERT( !IsPrinting(), "Printer::~Printer() - Job is printing" );
+ DBG_ASSERT( !IsJobActive(), "Printer::~Printer() - Job is active" );
+ DBG_ASSERT( !mpQPrinter, "Printer::~Printer() - QueuePrinter not destroyed" );
+ DBG_ASSERT( !mpQMtf, "Printer::~Printer() - QueueMetafile not destroyed" );
+
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+ if ( mpInfoPrinter )
+ ImplGetSVData()->mpDefInst->DestroyInfoPrinter( mpInfoPrinter );
+#else
+ if ( mpInfoPrinter )
+ {
+ if( mpGraphics )
+ mpGraphics->SetInterface( REF( NMSP_CLIENT::XRmOutputDevice )() );
+
+ ImplReleaseServerGraphics();
+
+ if ( mpGetDevFontList )
+ {
+ delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
+ }
+ if ( mpGetDevSizeList )
+ {
+ delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
+ }
+ delete mpGraphics, mpGraphics = NULL;
+ delete mpInfoPrinter, mpInfoPrinter = NULL;
+ }
+#endif
+ if ( mpDisplayDev )
+ delete mpDisplayDev;
+ else
+ {
+ // OutputDevice-Dtor versucht das gleiche, deshalb muss hier
+ // der FontEntry auch auf NULL gesetzt werden
+ if ( mpFontEntry )
+ {
+ mpFontCache->Release( mpFontEntry );
+ mpFontEntry = NULL;
+ }
+ if ( mpGetDevFontList )
+ {
+ delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
+ }
+ if ( mpGetDevSizeList )
+ {
+ delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
+ }
+ delete mpFontList;
+ delete mpFontCache;
+ }
+
+ // Printer aus der Liste eintragen
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ pSVData->maGDIData.mpFirstPrinter = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ pSVData->maGDIData.mpLastPrinter = mpPrev;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Printer::GetCapabilities( USHORT nType ) const
+{
+ if ( IsDisplayPrinter() )
+ return FALSE;
+
+#ifndef REMOTE_APPSERVER
+ return mpInfoPrinter->GetCapabilities( maJobSetup.ImplGetConstData(), nType );
+#else
+ return mpInfoPrinter->GetCapabilities( nType );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::HasSupport( PrinterSupport eFeature, BOOL bInJob ) const
+{
+ switch ( eFeature )
+ {
+ case SUPPORT_SET_ORIENTATION:
+ return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETORIENTATION );
+ case SUPPORT_SET_PAPERBIN:
+ return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETPAPERBIN );
+ case SUPPORT_SET_PAPERSIZE:
+ return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETPAPERSIZE );
+ case SUPPORT_SET_PAPER:
+ return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SETPAPER );
+ case SUPPORT_COPY:
+ return (GetCapabilities( PRINTER_CAPABILITIES_COPIES ) != 0);
+ case SUPPORT_COLLATECOPY:
+ return (GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES ) != 0);
+ case SUPPORT_SETUPDIALOG:
+ return (BOOL)GetCapabilities( PRINTER_CAPABILITIES_SUPPORTDIALOG );
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetJobSetup( const JobSetup& rSetup )
+{
+ if ( IsDisplayPrinter() || mbInPrintPage )
+ return FALSE;
+
+ JobSetup aJobSetup = rSetup;
+
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+ if ( mpInfoPrinter->SetPrinterData( aJobSetup.ImplGetData() ) )
+ {
+ ImplUpdateJobSetupPaper( aJobSetup );
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+
+ return FALSE;
+#else
+ if ( mpInfoPrinter )
+ {
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+
+ PRINTERSEQ_SET( aJobSetup, aRmJobSetup, NMSP_CLIENT::RmJobSetup );
+ if ( mpInfoPrinter->SetJobSetup( aRmJobSetup ) )
+ {
+ PRINTERSEQ_GET( aRmJobSetup, aJobSetup );
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+ return FALSE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef REMOTE_APPSERVER
+IMPL_LINK( Printer, UserSetupCompleted, ::com::sun::star::uno::Any*, pResult )
+{
+ ::vos::OGuard guard( Application::GetSolarMutex( ) );
+
+ if( pResult->hasValue() )
+ {
+ mbUserSetupResult = TRUE;
+
+ ::com::sun::star::portal::client::RmJobSetup aRmJobSetup;
+ *pResult >>= aRmJobSetup;
+ JobSetup aJobSetup;
+ PRNSEQ_GET( aRmJobSetup, aJobSetup );
+
+ ImplUpdateJobSetupPaper( aJobSetup );
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ }
+ else
+ mbUserSetupResult = FALSE;
+
+ mbUserSetupCompleted = TRUE;
+ return 0;
+}
+#endif
+
+BOOL Printer::Setup( Window* pWindow )
+{
+ if ( IsDisplayPrinter() )
+ return FALSE;
+
+ if ( IsJobActive() || IsPrinting() )
+ return FALSE;
+
+#ifndef REMOTE_APPSERVER
+ JobSetup aJobSetup = maJobSetup;
+ SalFrame* pFrame;
+ if ( !pWindow )
+ pFrame = ImplGetDefaultWindow()->ImplGetFrame();
+ else
+ pFrame = pWindow->ImplGetFrame();
+ ImplReleaseGraphics();
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maAppData.mnModalMode++;
+ nImplSysDialog++;
+ BOOL bSetup = mpInfoPrinter->Setup( pFrame, aJobSetup.ImplGetData() );
+ pSVData->maAppData.mnModalMode--;
+ nImplSysDialog--;
+ if ( bSetup )
+ {
+ ImplUpdateJobSetupPaper( aJobSetup );
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+ return FALSE;
+#else
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+ PRNSEQ_SET( aRmJobSetup, maJobSetup );
+ mpInfoPrinter->SetJobSetup( aRmJobSetup );
+ RmFrameWindow* pFrame;
+ if ( !pWindow )
+ pFrame = ImplGetDefaultWindow()->ImplGetFrame();
+ else
+ pFrame = pWindow->ImplGetFrame();
+ mbUserSetupCompleted = FALSE;
+ mpInfoPrinter->UserSetup( pFrame->GetFrameInterface(), pFrame->InsertUserEventLink( LINK( this, Printer, UserSetupCompleted ) ) );
+ while( ! mbUserSetupCompleted )
+ Application::Reschedule();
+ return mbUserSetupResult;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetPrinterProps( const Printer* pPrinter )
+{
+ if ( IsJobActive() || IsPrinting() )
+ return FALSE;
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ mbDefPrinter = pPrinter->mbDefPrinter;
+ maPrintFile = pPrinter->maPrintFile;
+ mbPrintFile = pPrinter->mbPrintFile;
+ mnCopyCount = pPrinter->mnCopyCount;
+ mbCollateCopy = pPrinter->mbCollateCopy;
+ mnPageQueueSize = pPrinter->mnPageQueueSize;
+
+ if ( pPrinter->IsDisplayPrinter() )
+ {
+ // Alten Printer zerstoeren
+ if ( !IsDisplayPrinter() )
+ {
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+ pSVData->mpDefInst->DestroyInfoPrinter( mpInfoPrinter );
+#else
+ if ( mpInfoPrinter )
+ {
+ if( mpGraphics )
+ mpGraphics->SetInterface( REF( NMSP_CLIENT::XRmOutputDevice )() );
+
+ ImplReleaseServerGraphics();
+ delete mpGraphics, mpGraphics = NULL;
+ delete mpInfoPrinter, mpInfoPrinter = NULL;
+ }
+#endif
+ if ( mpFontEntry )
+ {
+ mpFontCache->Release( mpFontEntry );
+ mpFontEntry = NULL;
+ }
+ if ( mpGetDevFontList )
+ {
+ delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
+ }
+ if ( mpGetDevSizeList )
+ {
+ delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
+ }
+ delete mpFontList;
+ delete mpFontCache;
+ mbInitFont = TRUE;
+ mbNewFont = TRUE;
+ mpInfoPrinter = NULL;
+ }
+
+ // Neuen Printer bauen
+ ImplInitDisplay( NULL );
+ return TRUE;
+ }
+
+ // Alten Printer zerstoeren?
+ if ( GetName() != pPrinter->GetName() )
+ {
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+#endif
+ if ( mpDisplayDev )
+ {
+ delete mpDisplayDev;
+ mpDisplayDev = NULL;
+ }
+ else
+ {
+#ifndef REMOTE_APPSERVER
+ pSVData->mpDefInst->DestroyInfoPrinter( mpInfoPrinter );
+#else
+ if ( mpInfoPrinter )
+ {
+ if( mpGraphics )
+ mpGraphics->SetInterface( REF( NMSP_CLIENT::XRmOutputDevice )() );
+
+ ImplReleaseServerGraphics();
+ delete mpGraphics, mpGraphics = NULL;
+ delete mpInfoPrinter, mpInfoPrinter = NULL;
+ }
+#endif
+
+ if ( mpFontEntry )
+ {
+ mpFontCache->Release( mpFontEntry );
+ mpFontEntry = NULL;
+ }
+ if ( mpGetDevFontList )
+ {
+ delete mpGetDevFontList;
+ mpGetDevFontList = NULL;
+ }
+ if ( mpGetDevSizeList )
+ {
+ delete mpGetDevSizeList;
+ mpGetDevSizeList = NULL;
+ }
+ delete mpFontList;
+ delete mpFontCache;
+ mbInitFont = TRUE;
+ mbNewFont = TRUE;
+ mpInfoPrinter = NULL;
+ }
+
+ // Neuen Printer bauen
+ XubString maDriver = pPrinter->GetDriverName();
+ SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( pPrinter->GetName(), &maDriver );
+ if ( pInfo )
+ {
+ ImplInit( pInfo );
+ SetJobSetup( pPrinter->GetJobSetup() );
+ }
+ else
+ ImplInitDisplay( NULL );
+ }
+ else
+ SetJobSetup( pPrinter->GetJobSetup() );
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetOrientation( Orientation eOrientation )
+{
+ if ( mbInPrintPage )
+ return FALSE;
+
+ if ( maJobSetup.ImplGetConstData()->meOrientation != eOrientation )
+ {
+ JobSetup aJobSetup = maJobSetup;
+ ImplJobSetup* pSetupData = aJobSetup.ImplGetData();
+ pSetupData->meOrientation = eOrientation;
+
+ if ( IsDisplayPrinter() )
+ {
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ return TRUE;
+ }
+
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+ if ( mpInfoPrinter->SetData( SAL_JOBSET_ORIENTATION, pSetupData ) )
+ {
+ ImplUpdateJobSetupPaper( aJobSetup );
+#else
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+ PRINTERSEQ_SET( aJobSetup, aRmJobSetup, NMSP_CLIENT::RmJobSetup );
+ if ( mpInfoPrinter->SetOrientation( (unsigned short)eOrientation, aRmJobSetup ) )
+ {
+ PRINTERSEQ_GET( aRmJobSetup, aJobSetup );
+#endif
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Orientation Printer::GetOrientation() const
+{
+ return maJobSetup.ImplGetConstData()->meOrientation;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetPaperBin( USHORT nPaperBin )
+{
+ if ( mbInPrintPage )
+ return FALSE;
+
+ if ( (maJobSetup.ImplGetConstData()->mnPaperBin != nPaperBin) &&
+ (nPaperBin < GetPaperBinCount()) )
+ {
+ JobSetup aJobSetup = maJobSetup;
+ ImplJobSetup* pSetupData = aJobSetup.ImplGetData();
+ pSetupData->mnPaperBin = nPaperBin;
+
+ if ( IsDisplayPrinter() )
+ {
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ return TRUE;
+ }
+
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+ if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERBIN, pSetupData ) )
+ {
+ ImplUpdateJobSetupPaper( aJobSetup );
+#else
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+ PRINTERSEQ_SET( aJobSetup, aRmJobSetup, NMSP_CLIENT::RmJobSetup );
+ if ( mpInfoPrinter->SetPaperBin( nPaperBin, aRmJobSetup ) )
+ {
+ PRINTERSEQ_GET( aRmJobSetup, aJobSetup );
+#endif
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Printer::GetPaperBin() const
+{
+ return maJobSetup.ImplGetConstData()->mnPaperBin;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetPaper( Paper ePaper )
+{
+ if ( mbInPrintPage )
+ return FALSE;
+
+ if ( maJobSetup.ImplGetConstData()->mePaperFormat != ePaper )
+ {
+ JobSetup aJobSetup = maJobSetup;
+ ImplJobSetup* pSetupData = aJobSetup.ImplGetData();
+ pSetupData->mePaperFormat = ePaper;
+ if ( ePaper != PAPER_USER )
+ {
+ pSetupData->mnPaperWidth = ImplPaperFormats[((USHORT)ePaper)*2];
+ pSetupData->mnPaperHeight = ImplPaperFormats[((USHORT)ePaper)*2+1];
+ }
+
+ if ( IsDisplayPrinter() )
+ {
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ return TRUE;
+ }
+
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+ if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE, pSetupData ) )
+ {
+ ImplUpdateJobSetupPaper( aJobSetup );
+#else
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+ PRINTERSEQ_SET( aJobSetup, aRmJobSetup, NMSP_CLIENT::RmJobSetup );
+ if ( mpInfoPrinter->SetPaper( (unsigned short)ePaper, aRmJobSetup ) )
+ {
+ PRINTERSEQ_GET( aRmJobSetup, aJobSetup );
+#endif
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetPaperSizeUser( const Size& rSize )
+{
+ if ( mbInPrintPage )
+ return FALSE;
+
+ MapMode aMap100thMM( MAP_100TH_MM );
+ Size aPixSize = LogicToPixel( rSize );
+ Size aPageSize = PixelToLogic( aPixSize, aMap100thMM );
+ if ( (maJobSetup.ImplGetConstData()->mePaperFormat != PAPER_USER) ||
+ (maJobSetup.ImplGetConstData()->mnPaperWidth != aPageSize.Width()) ||
+ (maJobSetup.ImplGetConstData()->mnPaperHeight != aPageSize.Height()) )
+ {
+ JobSetup aJobSetup = maJobSetup;
+ ImplJobSetup* pSetupData = aJobSetup.ImplGetData();
+ pSetupData->mePaperFormat = PAPER_USER;
+ pSetupData->mnPaperWidth = aPageSize.Width();
+ pSetupData->mnPaperHeight = aPageSize.Height();
+
+ if ( IsDisplayPrinter() )
+ {
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ return TRUE;
+ }
+
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+ if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE, pSetupData ) )
+ {
+ ImplUpdateJobSetupPaper( aJobSetup );
+#else
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+ PRINTERSEQ_SET( aJobSetup, aRmJobSetup, NMSP_CLIENT::RmJobSetup );
+ if ( mpInfoPrinter->SetPaperSizeUser( aPixSize.Width(), aPixSize.Height(), aRmJobSetup ) )
+ {
+ PRINTERSEQ_GET( aRmJobSetup, aJobSetup );
+#endif
+ mbNewJobSetup = TRUE;
+ maJobSetup = aJobSetup;
+ ImplUpdatePageData();
+ ImplUpdateFontList();
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Paper Printer::GetPaper() const
+{
+ return maJobSetup.ImplGetConstData()->mePaperFormat;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Printer::GetPaperBinCount() const
+{
+ if ( IsDisplayPrinter() )
+ return 0;
+
+#ifndef REMOTE_APPSERVER
+ return (USHORT)mpInfoPrinter->GetPaperBinCount( maJobSetup.ImplGetConstData() );
+#else
+ if ( mpInfoPrinter )
+ return mpInfoPrinter->GetPaperBinCount();
+ else
+ return 0;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+XubString Printer::GetPaperBinName( USHORT nPaperBin ) const
+{
+ if ( IsDisplayPrinter() )
+ return ImplGetSVEmptyStr();
+
+#ifndef REMOTE_APPSERVER
+ if ( nPaperBin < GetPaperBinCount() )
+ return mpInfoPrinter->GetPaperBinName( maJobSetup.ImplGetConstData(), nPaperBin );
+ else
+ return ImplGetSVEmptyStr();
+#else
+ if ( mpInfoPrinter )
+ return (String)mpInfoPrinter->GetPaperBinName( nPaperBin );
+ else
+ return ImplGetSVEmptyStr();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::SetCopyCount( USHORT nCopy, BOOL bCollate )
+{
+ mnCopyCount = nCopy;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::Error()
+{
+ maErrorHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::StartPrint()
+{
+ maStartPrintHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::EndPrint()
+{
+ maEndPrintHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::PrintPage()
+{
+ maPrintPageHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+
+ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError )
+{
+ ULONG nVCLError;
+ switch ( nError )
+ {
+ case 0:
+ nVCLError = PRINTER_OK;
+ break;
+ case SAL_PRINTER_ERROR_ABORT:
+ nVCLError = PRINTER_ABORT;
+ break;
+ default:
+ nVCLError = PRINTER_GENERALERROR;
+ break;
+ }
+
+ return nVCLError;
+}
+
+// -----------------------------------------------------------------------
+
+void Printer::ImplEndPrint()
+{
+ mbPrinting = FALSE;
+ mnCurPrintPage = 0;
+ maJobName.Erase();
+ mpQPrinter->Destroy();
+ mpQPrinter = NULL;
+ EndPrint();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Printer, ImplDestroyPrinterAsync, void*, pSalPrinter )
+{
+ SalPrinter* pPrinter = (SalPrinter*)pSalPrinter;
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->mpDefInst->DestroyPrinter( pPrinter );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+#else
+
+// -----------------------------------------------------------------------
+
+static void ImplDeletePrintSpooler( PrintSpooler* pPrintSpooler )
+{
+ if( pPrintSpooler != 0 )
+ {
+ pPrintSpooler->mxPrintSpooler = REF( NMSP_CLIENT::XRmPrintSpooler )();
+ }
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::StartJob( const XubString& rJobName )
+{
+ mnError = PRINTER_OK;
+
+ if ( IsDisplayPrinter() )
+ return FALSE;
+
+ if ( IsJobActive() || IsPrinting() )
+ return FALSE;
+
+#ifndef REMOTE_APPSERVER
+ ULONG nCopies = mnCopyCount;
+ BOOL bCollateCopy = mbCollateCopy;
+ BOOL bUserCopy = FALSE;
+ if ( IsQueuePrinter() )
+ {
+ if ( ((ImplQPrinter*)this)->IsUserCopy() )
+ {
+ nCopies = 1;
+ bCollateCopy = FALSE;
+ }
+ }
+ else if ( nCopies > 1 )
+ {
+ ULONG nDevCopy;
+ if ( bCollateCopy )
+ nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES );
+ else
+ nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COPIES );
+ // Muessen Kopien selber gemacht werden?
+ if ( nCopies > nDevCopy )
+ {
+ bUserCopy = TRUE;
+ nCopies = 1;
+ bCollateCopy = FALSE;
+ if ( !mnPageQueueSize )
+ mnPageQueueSize = 1;
+ }
+ }
+ else
+ bCollateCopy = FALSE;
+
+ if ( !mnPageQueueSize )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter );
+
+ if ( !mpPrinter )
+ return FALSE;
+
+ XubString* pPrintFile;
+ if ( mbPrintFile )
+ pPrintFile = &maPrintFile;
+ else
+ pPrintFile = NULL;
+
+ if ( !mpPrinter->StartJob( pPrintFile, rJobName, Application::GetDisplayName(),
+ nCopies, bCollateCopy,
+ maJobSetup.ImplGetConstData() ) )
+ {
+ mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() );
+ if ( !mnError )
+ mnError = PRINTER_GENERALERROR;
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->mpDefInst->DestroyPrinter( mpPrinter );
+ mpPrinter = NULL;
+ return FALSE;
+ }
+
+ mbNewJobSetup = FALSE;
+ maJobName = rJobName;
+ mnCurPage = 1;
+ mnCurPrintPage = 1;
+ mbJobActive = TRUE;
+ mbPrinting = TRUE;
+ StartPrint();
+ }
+ else
+ {
+ mpQPrinter = new ImplQPrinter( this );
+ mpQPrinter->SetUserCopy( bUserCopy );
+ if ( mpQPrinter->StartJob( rJobName ) )
+ {
+ mbNewJobSetup = FALSE;
+ maJobName = rJobName;
+ mnCurPage = 1;
+ mbJobActive = TRUE;
+ mbPrinting = TRUE;
+ StartPrint();
+ mpQPrinter->StartQueuePrint();
+ }
+ else
+ {
+ mnError = mpQPrinter->GetErrorCode();
+ mpQPrinter->Destroy();
+ mpQPrinter = NULL;
+ return FALSE;
+ }
+ }
+#else
+ BOOL bResult = FALSE;
+ ImplSVData* pSVData = ImplGetSVData();
+
+ String aServerName( maPrinterName.GetToken( 1, '@' ) );
+
+ // build a new connection if not client
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xServerFactory;
+ Reference< ::com::sun::star::connection::XConnection > xConnection;
+ Reference< ::com::sun::star::bridge::XBridgeFactory > xBridgeFactory;
+
+ if( ! aServerName.EqualsAscii( RVP_CLIENT_SERVER_NAME ) )
+ pSVData->mpRemotePrinterList->CreateNewPrinterConnection( maPrinterName.GetToken( 1, '@' ), xServerFactory, xConnection, xBridgeFactory );
+ else
+ xServerFactory = pSVData->mxClientFactory;
+ if( xServerFactory.is() )
+ {
+ REF( NMSP_CLIENT::XRmSpoolLauncher ) xLauncher( xServerFactory->createInstance( ::rtl::OUString::createFromAscii( "OfficeSpoolLauncher.stardiv.de" ) ), NMSP_UNO::UNO_QUERY );
+ if( xLauncher.is() &&
+ xLauncher->LaunchSpooler( pSVData->mpUserInfo->sName,
+ pSVData->mpUserInfo->sPassword ) )
+ {
+ if( xBridgeFactory.is() ) // else this a the client connection
+ {
+ // get objects from transferred sospool connection
+ xServerFactory = Reference< ::com::sun::star::lang::XMultiServiceFactory >();
+ Reference< ::com::sun::star::bridge::XBridge >
+ xBridge( xBridgeFactory->createBridge( ::rtl::OUString(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "iiop" ) ), xConnection, Reference< ::com::sun::star::bridge::XInstanceProvider >() ) );
+ xServerFactory = Reference< ::com::sun::star::lang::XMultiServiceFactory >( xBridge->getInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SpoolMultiServiceFactory.sprintd.daemons.stardiv.de" ) ) ), UNO_QUERY );
+ }
+
+ mpPrinter = new PrintSpooler();
+ mpPrinter->mxPrintSpooler = REF( NMSP_CLIENT::XRmPrintSpooler )( xServerFactory->createInstance( ::rtl::OUString::createFromAscii( "OfficePrintSpooler.stardiv.de" ) ), NMSP_UNO::UNO_QUERY );
+ if( mpPrinter->mxPrintSpooler.is() )
+ {
+ NMSP_CLIENT::RmJobSetup aRmJobSetup;
+ PRNSEQ_SET( aRmJobSetup, maJobSetup );
+ mpPrinter->mxPrintSpooler->Create( aRmJobSetup );
+ bResult = mpPrinter->mxPrintSpooler->StartJob( mnCopyCount, mbCollateCopy, rJobName, maPrintFile, mbPrintFile );
+ }
+ }
+
+ if ( bResult )
+ {
+ mbNewJobSetup = FALSE;
+ maJobName = rJobName;
+ mnCurPage = 1;
+ mnCurPrintPage = 1;
+ mbJobActive = TRUE;
+ mbPrinting = TRUE;
+ }
+ else if ( mpPrinter && mpPrinter->mxPrintSpooler.is() )
+ {
+ ImplDeletePrintSpooler( mpPrinter );
+ mpPrinter = NULL;
+ }
+ }
+
+ if ( !bResult )
+ mnError = PRINTER_GENERALERROR;
+
+ return bResult;
+#endif
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::EndJob()
+{
+ if ( !IsJobActive() )
+ return FALSE;
+
+ DBG_ASSERT( !mbInPrintPage, "Printer::EndJob() - StartPage() without EndPage() called" );
+
+ mbJobActive = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ if ( mpPrinter || mpQPrinter )
+ {
+ ImplReleaseGraphics();
+
+ mnCurPage = 0;
+
+ if ( mpPrinter )
+ {
+ mbPrinting = FALSE;
+ mnCurPrintPage = 0;
+ maJobName.Erase();
+
+ mbDevOutput = FALSE;
+ mpPrinter->EndJob();
+ // Hier den Drucker nicht asyncron zerstoeren, da es
+ // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird
+ // und ein Druckerobjekt zerstoert wird
+ ImplGetSVData()->mpDefInst->DestroyPrinter( mpPrinter );
+ mpPrinter = NULL;
+ EndPrint();
+ }
+ else
+ mpQPrinter->EndQueuePrint();
+
+ return TRUE;
+ }
+#else
+ if ( mpPrinter )
+ {
+ mpPrinter->mxPrintSpooler->EndJob();
+ mbPrinting = FALSE;
+ mnCurPage = 0;
+ mnCurPrintPage = 0;
+ maJobName.Erase();
+ EndPrint();
+
+ ImplDeletePrintSpooler( mpPrinter );
+ mpPrinter = NULL;
+
+ return TRUE;
+ }
+#endif
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::AbortJob()
+{
+ // Wenn wir einen Queue-Printer haben, kann man diesen noch mit
+ // AbortJob() abbrechen, solange dieser noch am Drucken ist
+ if ( !IsJobActive() && !IsPrinting() )
+ return FALSE;
+
+ mbJobActive = FALSE;
+ mbInPrintPage = FALSE;
+ mpJobGraphics = NULL;
+
+#ifndef REMOTE_APPSERVER
+ if ( mpPrinter || mpQPrinter )
+ {
+ mbPrinting = FALSE;
+ mnCurPage = 0;
+ mnCurPrintPage = 0;
+ maJobName.Erase();
+
+ if ( mpPrinter )
+ {
+ ImplReleaseGraphics();
+ mbDevOutput = FALSE;
+ mpPrinter->AbortJob();
+ Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter );
+ mpPrinter = NULL;
+ EndPrint();
+ }
+ else
+ {
+ mpQPrinter->AbortQueuePrint();
+ mpQPrinter->Destroy();
+ mpQPrinter = NULL;
+ if ( mpQMtf )
+ {
+ mpQMtf->Clear();
+ delete mpQMtf;
+ mpQMtf = NULL;
+ }
+ EndPrint();
+ }
+
+ return TRUE;
+ }
+#else
+ if ( mpPrinter )
+ {
+ mpPrinter->mxPrintSpooler->AbortJob();
+ if ( mpQMtf )
+ {
+ mpQMtf->Clear();
+ delete mpQMtf;
+ mpQMtf = NULL;
+ }
+
+ mbPrinting = FALSE;
+ mnCurPage = 0;
+ mnCurPrintPage = 0;
+ maJobName.Erase();
+ ImplDeletePrintSpooler( mpPrinter );
+ mpPrinter = NULL;
+ EndPrint();
+
+ return TRUE;
+ }
+#endif
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::StartPage()
+{
+ if ( !IsJobActive() )
+ return FALSE;
+
+#ifndef REMOTE_APPSERVER
+ if ( mpPrinter || mpQPrinter )
+ {
+ if ( mpPrinter )
+ {
+ SalGraphics* pGraphics = mpPrinter->StartPage( maJobSetup.ImplGetConstData(), mbNewJobSetup );
+ if ( pGraphics )
+ {
+ ImplReleaseGraphics();
+ mpJobGraphics = pGraphics;
+ }
+ mbDevOutput = TRUE;
+ }
+ else
+ {
+ ImplGetGraphics();
+ mpJobGraphics = mpGraphics;
+ }
+
+ // PrintJob not aborted ???
+ if ( IsJobActive() )
+ {
+ mbInPrintPage = TRUE;
+ mnCurPage++;
+ if ( mpQPrinter )
+ {
+ mpQMtf = new GDIMetaFile;
+ mpQMtf->Record( this );
+ mpQMtf->SaveStatus();
+ }
+ else
+ {
+ mnCurPrintPage++;
+ PrintPage();
+ }
+ }
+
+ return TRUE;
+ }
+#else
+ if ( mpPrinter )
+ {
+ mpQMtf = new GDIMetaFile;
+ mpQMtf->Record( this );
+ mpQMtf->SaveStatus();
+
+ mbInPrintPage = TRUE;
+ mnCurPage++;
+ mnCurPrintPage++;
+ PrintPage();
+
+ return TRUE;
+ }
+#endif
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Printer::EndPage()
+{
+ if ( !IsJobActive() )
+ return FALSE;
+
+ mbInPrintPage = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ if ( mpPrinter || mpQPrinter )
+ {
+ if ( mpPrinter )
+ {
+ mpPrinter->EndPage();
+ ImplReleaseGraphics();
+ mbDevOutput = FALSE;
+ }
+ else if ( mpQPrinter )
+ {
+ // Eigentuemeruebergang an QPrinter
+ mpQMtf->Stop();
+ mpQMtf->WindStart();
+ GDIMetaFile* pPage = mpQMtf;
+ mpQMtf = NULL;
+ mpQPrinter->AddQueuePage( pPage, mnCurPage, mbNewJobSetup );
+ }
+
+ mpJobGraphics = NULL;
+ mbNewJobSetup = FALSE;
+
+ return TRUE;
+ }
+#else
+ if ( mpPrinter && mpQMtf )
+ {
+ mpQMtf->Stop();
+ mpQMtf->WindStart();
+
+ PrinterPage aPage( mpQMtf, mbNewJobSetup, GetJobSetup() );
+ NMSP_CLIENT::RmPrinterPage aRmPage;
+ PRINTERSEQ_SET( aPage, aRmPage, NMSP_CLIENT::RmPrinterPage );
+ mpPrinter->mxPrintSpooler->SpoolPage( aRmPage );
+ mpQMtf = NULL;
+ mbNewJobSetup = FALSE;
+
+ return TRUE;
+ }
+#endif
+
+ return FALSE;
+}
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
new file mode 100644
index 000000000000..9e301b906012
--- /dev/null
+++ b/vcl/source/gdi/print2.cxx
@@ -0,0 +1,543 @@
+/*************************************************************************
+ *
+ * $RCSfile: print2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_PRINT_CXX
+#define _SPOOLPRINTER_EXT
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_METAACT_HXX
+#include <metaact.hxx>
+#endif
+#ifndef _SV_GDIMTF_HXX
+#include <gdimtf.hxx>
+#endif
+#ifndef _SV_PRINT_H
+#include <print.h>
+#endif
+#ifndef _SV_PRINT_HXX
+#include <print.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define MAX_BANDWIDTH 1000000
+
+// -----------
+// - statics -
+// -----------
+
+static USHORT aSpecialPrintActions[] =
+{
+ META_TRANSPARENT_ACTION,
+ META_FLOATTRANSPARENT_ACTION
+};
+
+// -----------------
+// - ImplCheckRect -
+// -----------------
+
+struct ImplCheckRect
+{
+ Rectangle* mpRect;
+ MetaAction* mpAct;
+ ImplCheckRect* mpNext;
+ BOOL mbSpecialOutput;
+
+ ImplCheckRect() { }
+ ~ImplCheckRect() { delete mpRect; }
+ void ImplCreate( MetaAction* pAct, OutputDevice* pOut, BOOL bSpecial );
+ BOOL Intersects( const ImplCheckRect& rRect )
+ {
+ return( mpRect && rRect.mpRect ) ? mpRect->IsOver( *rRect.mpRect ) : FALSE;
+ }
+};
+
+// -----------------------------------------------------------------------------
+
+void ImplCheckRect::ImplCreate( MetaAction* pAct, OutputDevice* pOut, BOOL bSpecial )
+{
+ mpAct = pAct;
+ mpNext = NULL;
+
+ switch( mpAct->GetType() )
+ {
+ case( META_PIXEL_ACTION ):
+ mpRect = new Rectangle( ( (MetaPixelAction*) mpAct )->GetPoint(), Size( 1, 1 ) );
+ break;
+
+ case( META_POINT_ACTION ):
+ mpRect = new Rectangle( ( (MetaPointAction*) mpAct )->GetPoint(), Size( 1, 1 ) );
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ MetaLineAction* pA = (MetaLineAction*) mpAct;
+ mpRect = new Rectangle( pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ mpRect = new Rectangle( ( (MetaRectAction*) mpAct )->GetRect() );
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ MetaRoundRectAction* pA = (MetaRoundRectAction*) mpAct;
+ mpRect = new Rectangle( Polygon( pA->GetRect(),
+ pA->GetHorzRound(),
+ pA->GetVertRound() ).GetBoundRect() );
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ MetaEllipseAction* pA = (MetaEllipseAction*) mpAct;
+ const Rectangle& rRect = pA->GetRect();
+ mpRect = new Rectangle( Polygon( rRect.Center(),
+ rRect.GetWidth() >> 1,
+ rRect.GetHeight() >> 1 ).GetBoundRect() );
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ {
+ MetaArcAction* pA = (MetaArcAction*) mpAct;
+ mpRect = new Rectangle( Polygon( pA->GetRect(),
+ pA->GetStartPoint(),
+ pA->GetEndPoint(), POLY_ARC ).GetBoundRect() );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ MetaPieAction* pA = (MetaPieAction*) mpAct;
+ mpRect = new Rectangle( Polygon( pA->GetRect(),
+ pA->GetStartPoint(),
+ pA->GetEndPoint(), POLY_PIE ).GetBoundRect() );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ MetaChordAction* pA = (MetaChordAction*) mpAct;
+ mpRect = new Rectangle( Polygon( pA->GetRect(),
+ pA->GetStartPoint(),
+ pA->GetEndPoint(), POLY_CHORD ).GetBoundRect() );
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ MetaPolyLineAction* pA = (MetaPolyLineAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPolygon().GetBoundRect() );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ {
+ MetaPolygonAction* pA = (MetaPolygonAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPolygon().GetBoundRect() );
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ MetaPolyPolygonAction* pA = (MetaPolyPolygonAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPolyPolygon().GetBoundRect() );
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ MetaBmpAction* pA = (MetaBmpAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pOut->PixelToLogic( pA->GetBitmap().GetSizePixel() ) );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ MetaBmpScaleAction* pA = (MetaBmpScaleAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pA->GetSize() );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ MetaBmpScalePartAction* pA = (MetaBmpScalePartAction*) mpAct;
+ mpRect = new Rectangle( pA->GetDestPoint(), pA->GetDestSize() );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ MetaBmpExAction* pA = (MetaBmpExAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pOut->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ) );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ MetaBmpExScaleAction* pA = (MetaBmpExScaleAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pA->GetSize() );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ MetaBmpExScalePartAction* pA = (MetaBmpExScalePartAction*) mpAct;
+ mpRect = new Rectangle( pA->GetDestPoint(), pA->GetDestSize() );
+ }
+ break;
+
+ case( META_MASK_ACTION ):
+ {
+ MetaMaskAction* pA = (MetaMaskAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pOut->PixelToLogic( pA->GetBitmap().GetSizePixel() ) );
+ }
+ break;
+
+ case( META_MASKSCALE_ACTION ):
+ {
+ MetaMaskScaleAction* pA = (MetaMaskScaleAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pA->GetSize() );
+ }
+ break;
+
+ case( META_MASKSCALEPART_ACTION ):
+ {
+ MetaMaskScalePartAction* pA = (MetaMaskScalePartAction*) mpAct;
+ mpRect = new Rectangle( pA->GetDestPoint(), pA->GetDestSize() );
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ mpRect = new Rectangle( ( (MetaGradientAction*) mpAct )->GetRect() );
+ break;
+
+ case( META_HATCH_ACTION ):
+ mpRect = new Rectangle( ( (MetaHatchAction*) mpAct )->GetPolyPolygon().GetBoundRect() );
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ mpRect = new Rectangle( ( (MetaWallpaperAction*) mpAct )->GetRect() );
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ mpRect = new Rectangle( ( (MetaTransparentAction*) mpAct )->GetPolyPolygon().GetBoundRect() );
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ MetaFloatTransparentAction* pA = (MetaFloatTransparentAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pA->GetSize() );
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ MetaEPSAction* pA = (MetaEPSAction*) mpAct;
+ mpRect = new Rectangle( pA->GetPoint(), pA->GetSize() );
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ MetaTextAction* pA = (MetaTextAction*) mpAct;
+ const Point aPt( pOut->LogicToPixel( pA->GetPoint() ) );
+ const XubString aString( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ mpRect = new Rectangle( pOut->PixelToLogic( pOut->ImplGetTextBoundRect( aPt.X(), aPt.Y(), aString.GetBuffer(), aString.Len(), NULL ) ) );
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ MetaTextArrayAction* pA = (MetaTextArrayAction*) mpAct;
+ const Point aPt( pOut->LogicToPixel( pA->GetPoint() ) );
+ const XubString aString( pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ mpRect = new Rectangle( pOut->PixelToLogic( pOut->ImplGetTextBoundRect( aPt.X(), aPt.Y(), aString.GetBuffer(), aString.Len(), pA->GetDXArray() ) ) );
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ MetaTextRectAction* pA = (MetaTextRectAction*) mpAct;
+ mpRect = new Rectangle( pA->GetRect() );
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ case( META_TEXTLINE_ACTION ):
+ mpRect = NULL;
+ // !!! DBG_ERROR( "Missing" );
+ break;
+
+ default:
+ mpRect = NULL;
+ break;
+ }
+
+ if( mpRect )
+ {
+ *mpRect = pOut->LogicToPixel( *mpRect );
+ mbSpecialOutput = bSpecial;
+ }
+ else
+ mbSpecialOutput = FALSE;
+}
+
+// -----------
+// - Printer -
+// -----------
+
+void Printer::GetPreparedMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, ULONG nFlags )
+{
+ const ULONG nSpecialCount = sizeof( aSpecialPrintActions ) / sizeof( aSpecialPrintActions[ 0 ] );
+ MetaAction* pAct;
+ ULONG i, j;
+ BOOL bSpecial = FALSE;
+
+ rOutMtf.Clear();
+
+ // look, if we've got special actions
+ for( pAct = ( (GDIMetaFile&) rInMtf ).FirstAction(); pAct && !bSpecial; pAct = ( (GDIMetaFile&) rInMtf ).NextAction() )
+ for( i = 0; i < nSpecialCount; i++ )
+ if( pAct->GetType() == aSpecialPrintActions[ i ] )
+ bSpecial = TRUE;
+
+ // separate actions which are special actions or which are affected by special actions
+ if( bSpecial )
+ {
+ Rectangle aBoundPixel;
+ const ULONG nCount = rInMtf.GetActionCount();
+ VirtualDevice aPaintVDev;
+ ImplCheckRect* pRects = new ImplCheckRect[ nCount ];
+ ImplCheckRect* pIListFirst = NULL;
+ ImplCheckRect* pIListPrev = NULL;
+ ImplCheckRect* pIListAct = NULL;
+ ImplCheckRect* pOListFirst = NULL;
+ ImplCheckRect* pOListLast = NULL;
+ ImplCheckRect* pOListAct = NULL;
+ ImplCheckRect* pO;
+
+ aPaintVDev.mnDPIX = mnDPIX;
+ aPaintVDev.mnDPIY = mnDPIY;
+ aPaintVDev.mbOutput = FALSE;
+
+ // create list of special action rects
+ for( i = 0, pO = pRects, pAct = ( (GDIMetaFile&) rInMtf ).FirstAction(); pAct;
+ pAct = ( (GDIMetaFile&) rInMtf ).NextAction(), i++, pO++ )
+ {
+ for( j = 0, bSpecial = FALSE; j < nSpecialCount && !bSpecial; j++ )
+ if( pAct->GetType() == aSpecialPrintActions[ j ] )
+ bSpecial = TRUE;
+
+ // execute action to get correct MapMode's etc.
+ pAct->Execute( &aPaintVDev );
+
+ // create (bounding) rect object
+ pO->ImplCreate( pAct, &aPaintVDev, bSpecial );
+
+ // add object to one of the lists
+ if( pO->mbSpecialOutput )
+ {
+ if( !pOListFirst )
+ pOListFirst = pOListAct = pOListLast = pO;
+ else
+ pOListAct = pOListAct->mpNext = pOListLast = pO;
+ }
+ else
+ {
+ if( !pIListFirst )
+ pIListFirst = pIListAct = pO;
+ else
+ pIListAct = pIListAct->mpNext = pO;
+ }
+ }
+
+ // find all intersections and create list of (bitmap)
+ for( pO = pOListFirst; pO; pO = pO->mpNext )
+ {
+ pIListPrev = NULL, pIListAct = pIListFirst;
+
+ while( pIListAct )
+ {
+ // move act object from in list to out list?
+ if( pIListAct->Intersects( *pO ) )
+ {
+ // mark it as special object
+ pIListAct->mbSpecialOutput = TRUE;
+
+ if( pIListPrev )
+ pIListPrev->mpNext = pIListAct->mpNext;
+ else
+ pIListFirst = pIListAct->mpNext;
+
+ pOListLast = pOListLast->mpNext = pIListAct;
+ }
+ else
+ pIListPrev = pIListAct;
+
+ pIListAct = pIListAct->mpNext;
+ pOListLast->mpNext = NULL;
+ }
+ }
+
+ // calculate bounding rectangle of special actions
+ for( pO = pOListFirst; pO; pO = pO->mpNext )
+ aBoundPixel.Union( *pO->mpRect );
+
+ const Size aSzPix( aBoundPixel.GetSize() );
+
+ // create new bitmap action first
+ if( aSzPix.Width() && aSzPix.Height() )
+ {
+ Point aDstPtPix( aBoundPixel.TopLeft() );
+ Size aDstSzPix( aSzPix.Width(), Max( MAX_BANDWIDTH / aSzPix.Width(), 2L ) );
+ const long nLastY = aDstPtPix.Y() + aSzPix.Height() - 1L;
+ VirtualDevice aMapVDev;
+
+ rOutMtf.AddAction( new MetaPushAction( PUSH_MAPMODE ) );
+ rOutMtf.AddAction( new MetaMapModeAction() );
+
+ aPaintVDev.mbOutput = TRUE;
+ aMapVDev.mbOutput = FALSE;
+
+ while( aDstPtPix.Y() <= nLastY )
+ {
+ if( ( aDstPtPix.Y() + aDstSzPix.Height() - 1L ) > nLastY )
+ aDstSzPix.Height() = nLastY - aDstPtPix.Y() + 1L;
+
+ if( aPaintVDev.SetOutputSizePixel( aDstSzPix ) )
+ {
+ aPaintVDev.Push();
+ aMapVDev.Push();
+
+ aMapVDev.mnDPIX = aPaintVDev.mnDPIX = mnDPIX;
+ aMapVDev.mnDPIY = aPaintVDev.mnDPIY = mnDPIY;
+
+ for( i = 0, pO = pRects; i < nCount; i++, pO++ )
+ {
+ MetaAction* pAction = pO->mpAct;
+ const USHORT nType = pAction->GetType();
+
+ if( META_MAPMODE_ACTION == nType )
+ {
+ pAction->Execute( &aMapVDev );
+
+ MapMode aMtfMap( aMapVDev.GetMapMode() );
+ const Point aNewOrg( aMapVDev.PixelToLogic( aDstPtPix ) );
+
+ aMtfMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
+ aPaintVDev.SetMapMode( aMtfMap );
+ }
+ else if( ( META_PUSH_ACTION == nType ) || ( META_POP_ACTION ) == nType )
+ {
+ pAction->Execute( &aMapVDev );
+ pAction->Execute( &aPaintVDev );
+ }
+ else
+ pAction->Execute( &aPaintVDev );
+
+ if( !( i % 4 ) )
+ Application::Reschedule();
+ }
+
+ aPaintVDev.mbMap = FALSE;
+ Bitmap aBandBmp( aPaintVDev.GetBitmap( Point(), aDstSzPix ) );
+#ifdef DEBUG
+ aBandBmp.Invert();
+#endif
+ rOutMtf.AddAction( new MetaBmpScaleAction( aDstPtPix, aDstSzPix, aBandBmp ) );
+ aPaintVDev.mbMap = TRUE;
+
+ aMapVDev.Pop();
+ aPaintVDev.Pop();
+ }
+
+ // overlapping bands to avoid missing lines (e.g. PostScript)
+ aDstPtPix.Y() += aDstSzPix.Height();
+ }
+
+ rOutMtf.AddAction( new MetaPopAction() );
+ }
+
+ // add normal actions
+ for( i = 0, pO = pRects; i < nCount; i++, pO++ )
+ if( !pO->mbSpecialOutput )
+ rOutMtf.AddAction( ( pO->mpAct->Duplicate(), pO->mpAct ) );
+
+ rOutMtf.SetPrefMapMode( rInMtf.GetPrefMapMode() );
+ rOutMtf.SetPrefSize( rInMtf.GetPrefSize() );
+ delete[] pRects;
+ }
+ else
+ rOutMtf = rInMtf;
+}
diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx
new file mode 100644
index 000000000000..51a0a366727b
--- /dev/null
+++ b/vcl/source/gdi/regband.cxx
@@ -0,0 +1,785 @@
+/*************************************************************************
+ *
+ * $RCSfile: regband.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_REGBAND_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_REGBAND_HXX
+#include <regband.hxx>
+#endif
+
+// =======================================================================
+//
+// ImplRegionBand
+//
+// Jedes Band enthaelt die zwischen der enthaltenen Ober- und Untergrenze
+// enthaltenen Rechtecke. Bei den Operationen Union, Intersect, XOr und
+// Exclude werden immer Rechtecke der gleichen Hoehe ausgewerte; die
+// Grenzen der Baender sind immer so zu waehlen, dasz dies moeglich ist.
+//
+// Die Rechtecke in den Baendern werden nach Moeglichkeit zusammengefaszt.
+//
+// Bei der Umwandlung von Polygonen werden alle Punkte des Polygons
+// in die einzelnen Baender eingetragen (sie stehen fuer jedes Band als
+// Punkte in einer Liste). Nach dem Eintragen der Punkte werden diese
+// in Rechtecke umgewandelt und die Liste der Punkte geloescht.
+//
+// -----------------------------------------------------------------------
+
+ImplRegionBand::ImplRegionBand( long nTop, long nBottom )
+{
+ // save boundaries
+ mnYTop = nTop;
+ mnYBottom = nBottom;
+
+ // initialize lists
+ mpNextBand = NULL;
+ mpPrevBand = NULL;
+ mpFirstSep = NULL;
+ mpFirstBandPoint = NULL;
+ mbTouched = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplRegionBand::ImplRegionBand( const ImplRegionBand& rRegionBand )
+{
+ // copy boundaries
+ mnYTop = rRegionBand.mnYTop;
+ mnYBottom = rRegionBand.mnYBottom;
+ mbTouched = rRegionBand.mbTouched;
+
+ // initialisation
+ mpNextBand = NULL;
+ mpPrevBand = NULL;
+ mpFirstSep = NULL;
+ mpFirstBandPoint = NULL;
+
+ // copy all elements of the list with separations
+ ImplRegionBandSep* pNewSep;
+ ImplRegionBandSep* pPrevSep;
+ ImplRegionBandSep* pSep = rRegionBand.mpFirstSep;
+ while ( pSep )
+ {
+ // create new and copy data
+ pNewSep = new ImplRegionBandSep;
+ pNewSep->mnXLeft = pSep->mnXLeft;
+ pNewSep->mnXRight = pSep->mnXRight;
+ pNewSep->mbRemoved = pSep->mbRemoved;
+ pNewSep->mpNextSep = NULL;
+ if ( pSep == rRegionBand.mpFirstSep )
+ mpFirstSep = pNewSep;
+ else
+ pPrevSep->mpNextSep = pNewSep;
+
+ pPrevSep = pNewSep;
+ pSep = pSep->mpNextSep;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImplRegionBand::~ImplRegionBand()
+{
+ DBG_ASSERT( mpFirstBandPoint == NULL, "ImplRegionBand::~ImplRegionBand -> pointlist not empty" );
+
+ // delete elements of the list
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ ImplRegionBandSep* pTempSep = pSep->mpNextSep;
+ delete pSep;
+ pSep = pTempSep;
+ }
+
+ // delete elements of the list
+ ImplRegionBandPoint* pPoint = mpFirstBandPoint;
+ while ( pPoint )
+ {
+ ImplRegionBandPoint* pTempPoint = pPoint->mpNextBandPoint;
+ delete pPoint;
+ pPoint = pTempPoint;
+ }
+}
+
+// -----------------------------------------------------------------------
+//
+// generate separations from lines and process union with existing
+// separations
+
+void ImplRegionBand::ProcessPoints()
+{
+ // check Pointlist
+ ImplRegionBandPoint* pRegionBandPoint = mpFirstBandPoint;
+ while ( pRegionBandPoint )
+ {
+ // within list?
+ if ( pRegionBandPoint && pRegionBandPoint->mpNextBandPoint )
+ {
+ // start/stop?
+ if ( pRegionBandPoint->mbEndPoint && pRegionBandPoint->mpNextBandPoint->mbEndPoint )
+ {
+ // same direction? -> remove next point!
+ if ( pRegionBandPoint->meLineType == pRegionBandPoint->mpNextBandPoint->meLineType )
+ {
+ ImplRegionBandPoint* pSaveRegionBandPoint = pRegionBandPoint->mpNextBandPoint;
+ pRegionBandPoint->mpNextBandPoint = pRegionBandPoint->mpNextBandPoint->mpNextBandPoint;
+ delete pSaveRegionBandPoint;
+ }
+ }
+ }
+
+ // continue with next element in the list
+ pRegionBandPoint = pRegionBandPoint->mpNextBandPoint;
+ }
+
+ pRegionBandPoint = mpFirstBandPoint;
+ while ( pRegionBandPoint && pRegionBandPoint->mpNextBandPoint )
+ {
+ Union( pRegionBandPoint->mnX, pRegionBandPoint->mpNextBandPoint->mnX );
+
+ ImplRegionBandPoint* pNextBandPoint = pRegionBandPoint->mpNextBandPoint->mpNextBandPoint;
+
+ // remove allready processed points
+ delete pRegionBandPoint->mpNextBandPoint;
+ delete pRegionBandPoint;
+
+ // continue with next element in the list
+ pRegionBandPoint = pNextBandPoint;
+ }
+
+ // remove last element if necessary
+ if ( pRegionBandPoint )
+ delete pRegionBandPoint;
+
+ // list is now empty
+ mpFirstBandPoint = NULL;
+}
+
+// -----------------------------------------------------------------------
+//
+// generate separations from lines and process union with existing
+// separations
+
+BOOL ImplRegionBand::InsertPoint( long nX, long nLineId,
+ BOOL bEndPoint, LineType eLineType )
+{
+ if ( !mpFirstBandPoint )
+ {
+ mpFirstBandPoint = new ImplRegionBandPoint;
+ mpFirstBandPoint->mnX = nX;
+ mpFirstBandPoint->mnLineId = nLineId;
+ mpFirstBandPoint->mbEndPoint = bEndPoint;
+ mpFirstBandPoint->meLineType = eLineType;
+ mpFirstBandPoint->mpNextBandPoint = NULL;
+ return TRUE;
+ }
+
+ // look if line allready touched the band
+ ImplRegionBandPoint* pRegionBandPoint = mpFirstBandPoint;
+ ImplRegionBandPoint* pLastTestedRegionBandPoint = NULL;
+ while( pRegionBandPoint )
+ {
+ if ( pRegionBandPoint->mnLineId == nLineId )
+ {
+ if ( bEndPoint )
+ {
+ if( !pRegionBandPoint->mbEndPoint )
+ {
+ // remove old band point
+ if( !mpFirstBandPoint->mpNextBandPoint )
+ {
+ // if we've only got one point => replace first point
+ pRegionBandPoint->mnX = nX;
+ pRegionBandPoint->mbEndPoint = TRUE;
+ return TRUE;
+ }
+ else
+ {
+ // remove current point
+ if( !pLastTestedRegionBandPoint )
+ {
+ // remove and delete old first point
+ ImplRegionBandPoint* pSaveBandPoint = mpFirstBandPoint;
+ mpFirstBandPoint = mpFirstBandPoint->mpNextBandPoint;
+ delete pSaveBandPoint;
+ }
+ else
+ {
+ // remove and delete current band point
+ pLastTestedRegionBandPoint->mpNextBandPoint = pRegionBandPoint->mpNextBandPoint;
+ delete pRegionBandPoint;
+ }
+
+ break;
+ }
+ }
+ }
+ else
+ return FALSE;
+ }
+
+ // use next element
+ pLastTestedRegionBandPoint = pRegionBandPoint;
+ pRegionBandPoint = pRegionBandPoint->mpNextBandPoint;
+ }
+
+ // search appropriate position and insert point into the list
+ ImplRegionBandPoint* pNewRegionBandPoint;
+
+ pRegionBandPoint = mpFirstBandPoint;
+ pLastTestedRegionBandPoint = NULL;
+ while ( pRegionBandPoint )
+ {
+ // new point completly left? -> insert as first point
+ if ( nX <= pRegionBandPoint->mnX )
+ {
+ pNewRegionBandPoint = new ImplRegionBandPoint;
+ pNewRegionBandPoint->mnX = nX;
+ pNewRegionBandPoint->mnLineId = nLineId;
+ pNewRegionBandPoint->mbEndPoint = bEndPoint;
+ pNewRegionBandPoint->meLineType = eLineType;
+ pNewRegionBandPoint->mpNextBandPoint = pRegionBandPoint;
+
+ // connections to the new point
+ if ( !pLastTestedRegionBandPoint )
+ mpFirstBandPoint = pNewRegionBandPoint;
+ else
+ pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint;
+
+ return TRUE;
+ }
+
+ // use next element
+ pLastTestedRegionBandPoint = pRegionBandPoint;
+ pRegionBandPoint = pRegionBandPoint->mpNextBandPoint;
+ }
+
+ // not inserted -> add to the end of the list
+ pNewRegionBandPoint = new ImplRegionBandPoint;
+ pNewRegionBandPoint->mnX = nX;
+ pNewRegionBandPoint->mnLineId = nLineId;
+ pNewRegionBandPoint->mbEndPoint = bEndPoint;
+ pNewRegionBandPoint->meLineType = eLineType;
+ pNewRegionBandPoint->mpNextBandPoint = NULL;
+
+ // connections to the new point
+ pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegionBand::MoveX( long nHorzMove )
+{
+ // move all x-separations
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ pSep->mnXLeft += nHorzMove;
+ pSep->mnXRight += nHorzMove;
+ pSep = pSep->mpNextSep;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegionBand::ScaleX( double fHorzScale )
+{
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ pSep->mnXLeft = FRound( pSep->mnXLeft * fHorzScale );
+ pSep->mnXRight = FRound( pSep->mnXRight * fHorzScale );
+ pSep = pSep->mpNextSep;
+ }
+}
+
+// -----------------------------------------------------------------------
+//
+// combine overlaping sparations
+
+BOOL ImplRegionBand::OptimizeBand()
+{
+ ImplRegionBandSep* pPrevSep;
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ // remove?
+ if ( pSep->mbRemoved || (pSep->mnXRight < pSep->mnXLeft) )
+ {
+ ImplRegionBandSep* pOldSep = pSep;
+ if ( pSep == mpFirstSep )
+ mpFirstSep = pSep->mpNextSep;
+ else
+ pPrevSep->mpNextSep = pSep->mpNextSep;
+ pSep = pSep->mpNextSep;
+ delete pOldSep;
+ continue;
+ }
+
+ // overlaping separations? -> combine!
+ if ( pSep->mpNextSep )
+ {
+ if ( (pSep->mnXRight+1) >= pSep->mpNextSep->mnXLeft )
+ {
+ if ( pSep->mpNextSep->mnXRight > pSep->mnXRight )
+ pSep->mnXRight = pSep->mpNextSep->mnXRight;
+
+ ImplRegionBandSep* pOldSep = pSep->mpNextSep;
+ pSep->mpNextSep = pOldSep->mpNextSep;
+ delete pOldSep;
+ continue;
+ }
+ }
+
+ pPrevSep = pSep;
+ pSep = pSep->mpNextSep;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegionBand::Union( long nXLeft, long nXRight )
+{
+ DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Union(): nxLeft > nXRight" );
+
+ // band empty? -> add element
+ if ( !mpFirstSep )
+ {
+ mpFirstSep = new ImplRegionBandSep;
+ mpFirstSep->mnXLeft = nXLeft;
+ mpFirstSep->mnXRight = nXRight;
+ mpFirstSep->mbRemoved = FALSE;
+ mpFirstSep->mpNextSep = NULL;
+ return;
+ }
+
+ // process real union
+ ImplRegionBandSep* pNewSep;
+ ImplRegionBandSep* pPrevSep;
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ // new separation completely inside? nothing to do!
+ if ( (nXLeft >= pSep->mnXLeft) && (nXRight <= pSep->mnXRight) )
+ return;
+
+ // new separation completly left? -> new separation!
+ if ( nXRight < pSep->mnXLeft )
+ {
+ pNewSep = new ImplRegionBandSep;
+ pNewSep->mnXLeft = nXLeft;
+ pNewSep->mnXRight = nXRight;
+ pNewSep->mbRemoved = FALSE;
+
+ pNewSep->mpNextSep = pSep;
+ if ( pSep == mpFirstSep )
+ mpFirstSep = pNewSep;
+ else
+ pPrevSep->mpNextSep = pNewSep;
+ break;
+ }
+
+ // new separation overlaping from left? -> extend boundary
+ if ( (nXRight >= pSep->mnXLeft) && (nXLeft <= pSep->mnXLeft) )
+ pSep->mnXLeft = nXLeft;
+
+ // new separation overlaping from right? -> extend boundary
+ if ( (nXLeft <= pSep->mnXRight) && (nXRight > pSep->mnXRight) )
+ {
+ pSep->mnXRight = nXRight;
+ break;
+ }
+
+ // not inserted, but last element? -> add to the end of the list
+ if ( !pSep->mpNextSep && (nXLeft > pSep->mnXRight) )
+ {
+ pNewSep = new ImplRegionBandSep;
+ pNewSep->mnXLeft = nXLeft;
+ pNewSep->mnXRight = nXRight;
+ pNewSep->mbRemoved = FALSE;
+
+ pSep->mpNextSep = pNewSep;
+ pNewSep->mpNextSep = NULL;
+ break;
+ }
+
+ pPrevSep = pSep;
+ pSep = pSep->mpNextSep;
+ }
+
+ OptimizeBand();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegionBand::Intersect( long nXLeft, long nXRight )
+{
+ DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Intersect(): nxLeft > nXRight" );
+
+ // band has been touched
+ mbTouched = TRUE;
+
+ // band empty? -> nothing to do
+ if ( !mpFirstSep )
+ return;
+
+ // process real intersection
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ // new separation completly outside? -> remove separation
+ if ( (nXRight < pSep->mnXLeft) || (nXLeft > pSep->mnXRight) )
+ // will be removed from the optimizer
+ pSep->mbRemoved = TRUE;
+
+ // new separation overlaping from left? -> reduce right boundary
+ if ( (nXLeft <= pSep->mnXLeft) &&
+ (nXRight <= pSep->mnXRight) &&
+ (nXRight >= pSep->mnXLeft) )
+ pSep->mnXRight = nXRight;
+
+ // new separation overlaping from right? -> reduce right boundary
+ if ( (nXLeft >= pSep->mnXLeft) &&
+ (nXLeft <= pSep->mnXRight) &&
+ (nXRight >= pSep->mnXRight) )
+ pSep->mnXLeft = nXLeft;
+
+ // new separation within the actual one? -> reduce both boundaries
+ if ( (nXLeft >= pSep->mnXLeft) && (nXRight <= pSep->mnXRight) )
+ {
+ pSep->mnXRight = nXRight;
+ pSep->mnXLeft = nXLeft;
+ }
+
+ pSep = pSep->mpNextSep;
+ }
+
+ OptimizeBand();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegionBand::Exclude( long nXLeft, long nXRight )
+{
+ DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Exclude(): nxLeft > nXRight" );
+
+ // band has been touched
+ mbTouched = TRUE;
+
+ // band empty? -> nothing to do
+ if ( !mpFirstSep )
+ return;
+
+ // process real exclusion
+ ImplRegionBandSep* pNewSep;
+ ImplRegionBandSep* pPrevSep;
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ BOOL bSepProcessed = FALSE;
+
+ // new separation completely overlapping? -> remove separation
+ if ( (nXLeft <= pSep->mnXLeft) && (nXRight >= pSep->mnXRight) )
+ {
+ // will be removed from the optimizer
+ pSep->mbRemoved = TRUE;
+ bSepProcessed = TRUE;
+ }
+
+ // new separation overlaping from left? -> reduce boundary
+ if ( !bSepProcessed )
+ {
+ if ( (nXRight >= pSep->mnXLeft) && (nXLeft <= pSep->mnXLeft) )
+ {
+ pSep->mnXLeft = nXRight+1;
+ bSepProcessed = TRUE;
+ }
+ }
+
+ // new separation overlaping from right? -> reduce boundary
+ if ( !bSepProcessed )
+ {
+ if ( (nXLeft <= pSep->mnXRight) && (nXRight > pSep->mnXRight) )
+ {
+ pSep->mnXRight = nXLeft-1;
+ bSepProcessed = TRUE;
+ }
+ }
+
+ // new separation within the actual one? -> reduce boundary
+ // and add new entry for reminder
+ if ( !bSepProcessed )
+ {
+ if ( (nXLeft >= pSep->mnXLeft) && (nXRight <= pSep->mnXRight) )
+ {
+ pNewSep = new ImplRegionBandSep;
+ pNewSep->mnXLeft = pSep->mnXLeft;
+ pNewSep->mnXRight = nXLeft-1;
+ pNewSep->mbRemoved = FALSE;
+
+ pSep->mnXLeft = nXRight+1;
+
+ // connections from the new separation
+ pNewSep->mpNextSep = pSep;
+
+ // connections to the new separation
+ if ( pSep == mpFirstSep )
+ mpFirstSep = pNewSep;
+ else
+ pPrevSep->mpNextSep = pNewSep;
+ }
+ }
+
+ pPrevSep = pSep;
+ pSep = pSep->mpNextSep;
+ }
+
+ OptimizeBand();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegionBand::XOr( long nXLeft, long nXRight )
+{
+ DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::XOr(): nxLeft > nXRight" );
+
+ // band empty? -> add element
+ if ( !mpFirstSep )
+ {
+ mpFirstSep = new ImplRegionBandSep;
+ mpFirstSep->mnXLeft = nXLeft;
+ mpFirstSep->mnXRight = nXRight;
+ mpFirstSep->mbRemoved = FALSE;
+ mpFirstSep->mpNextSep = NULL;
+ return;
+ }
+
+ // process real xor
+ ImplRegionBandSep* pNewSep;
+ ImplRegionBandSep* pPrevSep;
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ // new separation completely overlapping?
+ // -> move boundaries to left remainder
+ // -> reduce boundaries of new separation
+ if ( (nXLeft <= pSep->mnXLeft) && (nXRight >= pSep->mnXRight) )
+ {
+ int iOldXRight = pSep->mnXRight;
+ pSep->mnXRight = pSep->mnXLeft;
+ pSep->mnXLeft = nXLeft;
+ nXLeft = pSep->mnXRight;
+ }
+
+ // new separation overlaping from left?
+ // -> move boundaries to left remainder
+ // -> set boundaries of new separation to right remainder
+ if ( (nXRight >= pSep->mnXLeft) && (nXLeft <= pSep->mnXLeft) )
+ {
+ int iOldXRight = pSep->mnXRight;
+ pSep->mnXRight = pSep->mnXLeft;
+ pSep->mnXLeft = nXLeft;
+ nXLeft = pSep->mnXRight;
+ }
+
+ // new separation overlaping from right? -> reduce boundary
+ if ( (nXLeft <= pSep->mnXRight) && (nXRight > pSep->mnXRight) )
+ pSep->mnXRight = nXLeft;
+
+ // new separation within the actual one? -> reduce boundary
+ // and add new entry for reminder
+ if ( (nXLeft >= pSep->mnXLeft) && (nXRight <= pSep->mnXRight) )
+ {
+ pNewSep = new ImplRegionBandSep;
+ pNewSep->mnXLeft = pSep->mnXLeft;
+ pNewSep->mnXRight = nXLeft;
+
+ pSep->mnXLeft = nXRight;
+
+ // connections from the new separation
+ pNewSep->mpNextSep = pSep;
+
+ // connections to the new separation
+ if ( pSep == mpFirstSep )
+ mpFirstSep = pNewSep;
+ else
+ pPrevSep->mpNextSep = pNewSep;
+ }
+
+ pPrevSep = pSep;
+ pSep = pSep->mpNextSep;
+ }
+
+ OptimizeBand();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplRegionBand::IsInside( long nX )
+{
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ if ( (pSep->mnXLeft <= nX) && (pSep->mnXRight >= nX) )
+ return TRUE;
+
+ pSep = pSep->mpNextSep;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplRegionBand::IsOver( long nLeft, long nRight )
+{
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ if ( (pSep->mnXLeft < nRight) && (pSep->mnXRight > nLeft) )
+ return TRUE;
+
+ pSep = pSep->mpNextSep;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplRegionBand::IsInside( long nLeft, long nRight )
+{
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep )
+ {
+ if ( (pSep->mnXLeft >= nLeft) && (nRight <= pSep->mnXRight) )
+ return TRUE;
+
+ pSep = pSep->mpNextSep;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplRegionBand::GetXLeftBoundary() const
+{
+ DBG_ASSERT( mpFirstSep != NULL, "ImplRegionBand::XLeftBoundary -> no separation in band!" );
+
+ return mpFirstSep->mnXLeft;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplRegionBand::GetXRightBoundary() const
+{
+ DBG_ASSERT( mpFirstSep != NULL, "ImplRegionBand::XRightBoundary -> no separation in band!" );
+
+ // search last separation
+ ImplRegionBandSep* pSep = mpFirstSep;
+ while ( pSep->mpNextSep )
+ pSep = pSep->mpNextSep;
+ return pSep->mnXRight;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const
+{
+ ImplRegionBandSep* pOwnRectBandSep = mpFirstSep;
+ ImplRegionBandSep* pSecondRectBandSep = rRegionBand.mpFirstSep;
+ while ( pOwnRectBandSep && pSecondRectBandSep )
+ {
+ // get boundaries of current rectangle
+ long nOwnXLeft = pOwnRectBandSep->mnXLeft;
+ long nSecondXLeft = pSecondRectBandSep->mnXLeft;
+ if ( nOwnXLeft != nSecondXLeft )
+ return FALSE;
+
+ long nOwnXRight = pOwnRectBandSep->mnXRight;
+ long nSecondXRight = pSecondRectBandSep->mnXRight;
+ if ( nOwnXRight != nSecondXRight )
+ return FALSE;
+
+ // get next separation from current band
+ pOwnRectBandSep = pOwnRectBandSep->mpNextSep;
+
+ // get next separation from current band
+ pSecondRectBandSep = pSecondRectBandSep->mpNextSep;
+ }
+
+ // differnt number of separations?
+ if ( pOwnRectBandSep || pSecondRectBandSep )
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
new file mode 100644
index 000000000000..000cad2a909b
--- /dev/null
+++ b/vcl/source/gdi/region.cxx
@@ -0,0 +1,2458 @@
+/*************************************************************************
+ *
+ * $RCSfile: region.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_REGION_CXX
+
+#include <limits.h>
+
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _REGION_H
+#include <region.h>
+#endif
+#ifndef _REGION_HXX
+#include <region.hxx>
+#endif
+#ifndef _REGBAND_HXX
+#include <regband.hxx>
+#endif
+
+// =======================================================================
+//
+// ImplRegionBand
+//
+// Die Klassen RegionBand/ImplRegionBand speichert Regionen in Form von
+// Rechtecken ab. Die Region ist in Y-Richtung in Baendern unterteilt, die
+// wiederum ein oder mehrere Rechtecke mit der Hoehe des Bandes enthalten.
+//
+// Leere Baender werden entfernt.
+//
+// Polygone und PolyPolygone werden ebenfalls in Rechtecke zerlegt und in
+// der Baendern abgelegt. Hierzu werden alle Punkte der einzelnen Polygone
+// mit dem Bresenham-Algorithmus berechnet und in die Baender eingetragen.
+// Nach der vollstaendigen Berechung aller Kanten werden die entsprechenden
+// Rechntecke berechnet
+
+// =======================================================================
+
+static ImplRegionBase aImplNullRegion = { 0, 0, NULL };
+static ImplRegionBase aImplEmptyRegion = { 0, 0, NULL };
+
+// =======================================================================
+
+DBG_NAME( Region );
+DBG_NAMEEX( Polygon );
+DBG_NAMEEX( PolyPolygon );
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+const char* ImplDbgTestRegion( const void* pObj )
+{
+ Region* pRegion = (Region*)pObj;
+ ImplRegion* pImplRegion = pRegion->ImplGetImplRegion();
+
+ if ( aImplNullRegion.mnRefCount )
+ return "Null-Region-RefCount modified";
+ if ( aImplNullRegion.mnRectCount )
+ return "Null-Region-RectCount modified";
+ if ( aImplNullRegion.mpPolyPoly )
+ return "Null-Region-PolyPoly modified";
+ if ( aImplEmptyRegion.mnRefCount )
+ return "Emptry-Region-RefCount modified";
+ if ( aImplEmptyRegion.mnRectCount )
+ return "Emptry-Region-RectCount modified";
+ if ( aImplEmptyRegion.mpPolyPoly )
+ return "Emptry-Region-PolyPoly modified";
+
+ if ( (pImplRegion != &aImplEmptyRegion) && (pImplRegion != &aImplNullRegion) )
+ {
+ ULONG nCount = 0;
+ const ImplRegionBand* pBand = pImplRegion->ImplGetFirstRegionBand();
+ while ( pBand )
+ {
+ if ( pBand->mnYBottom < pBand->mnYTop )
+ return "YBottom < YTop";
+ if ( pBand->mpNextBand )
+ {
+ if ( pBand->mnYBottom >= pBand->mpNextBand->mnYTop )
+ return "overlapping bands in region";
+ }
+ if ( pBand->mbTouched > 1 )
+ return "Band-mbTouched overwrite";
+
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while ( pSep )
+ {
+ if ( pSep->mnXRight < pSep->mnXLeft )
+ return "XLeft < XRight";
+ if ( pSep->mpNextSep )
+ {
+ if ( pSep->mnXRight >= pSep->mpNextSep->mnXLeft )
+ return "overlapping separations in region";
+ }
+ if ( pSep->mbRemoved > 1 )
+ return "Sep-mbRemoved overwrite";
+
+ nCount++;
+ pSep = pSep->mpNextSep;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+
+ if ( pImplRegion->mnRectCount != nCount )
+ return "mnRetCount is not valid";
+ }
+
+ return NULL;
+}
+#endif
+
+// =======================================================================
+
+inline void Region::ImplPolyPolyRegionToBandRegion()
+{
+ if ( mpImplRegion->mpPolyPoly )
+ ImplPolyPolyRegionToBandRegionFunc();
+}
+
+// =======================================================================
+
+ImplRegion::ImplRegion()
+{
+ mnRefCount = 1;
+ mnRectCount = 0;
+ mpPolyPoly = NULL;
+ mpFirstBand = NULL;
+ mpLastCheckedBand = NULL;
+}
+
+// ------------------------------------------------------------------------
+
+ImplRegion::ImplRegion( const PolyPolygon& rPolyPoly )
+{
+ mnRefCount = 1;
+ mnRectCount = 0;
+ mpFirstBand = NULL;
+ mpLastCheckedBand = NULL;
+ mpPolyPoly = new PolyPolygon( rPolyPoly );
+}
+
+// -----------------------------------------------------------------------
+
+ImplRegion::ImplRegion( const ImplRegion& rImplRegion )
+{
+ mnRefCount = 1;
+ mnRectCount = rImplRegion.mnRectCount;
+ mpFirstBand = NULL;
+ mpLastCheckedBand = NULL;
+ if ( rImplRegion.mpPolyPoly )
+ mpPolyPoly = new PolyPolygon( *rImplRegion.mpPolyPoly );
+ else
+ mpPolyPoly = NULL;
+
+ // insert band(s) into the list
+ ImplRegionBand* pNewBand;
+ ImplRegionBand* pPrevBand;
+ ImplRegionBand* pBand = rImplRegion.mpFirstBand;
+ while ( pBand )
+ {
+ pNewBand = new ImplRegionBand( *pBand );
+
+ // first element? -> set as first into the list
+ if ( pBand == rImplRegion.mpFirstBand )
+ mpFirstBand = pNewBand;
+ else
+ pPrevBand->mpNextBand = pNewBand;
+
+ pPrevBand = pNewBand;
+ pBand = pBand->mpNextBand;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImplRegion::~ImplRegion()
+{
+ DBG_ASSERT( (this != &aImplEmptyRegion) && (this != &aImplNullRegion),
+ "ImplRegion::~ImplRegion() - Empty oder NULL-Region" )
+
+ ImplRegionBand* pBand = mpFirstBand;
+ while ( pBand )
+ {
+ ImplRegionBand* pTempBand = pBand->mpNextBand;
+ delete pBand;
+ pBand = pTempBand;
+ }
+
+ delete mpPolyPoly;
+}
+
+// -----------------------------------------------------------------------
+//
+// create complete range of bands in single steps
+
+void ImplRegion::CreateBandRange( long nYTop, long nYBottom )
+{
+ // add top band
+ mpFirstBand = new ImplRegionBand( nYTop-1, nYTop-1 );
+
+ // begin first search from the first element
+ mpLastCheckedBand = mpFirstBand;
+
+ ImplRegionBand* pBand = mpFirstBand;
+ for ( int i = nYTop; i <= nYBottom+1; i++ )
+ {
+ // create new band
+ ImplRegionBand* pNewBand = new ImplRegionBand( i, i );
+ pBand->mpNextBand = pNewBand;
+ if ( pBand != mpFirstBand )
+ pNewBand->mpPrevBand = pBand;
+
+ pBand = pBand->mpNextBand;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplRegion::InsertLine( const Point& rStartPt, const Point& rEndPt,
+ long nLineId )
+{
+ long nX, nY;
+
+ // lines consisting of a single point do not interest here
+ if ( rStartPt == rEndPt )
+ return TRUE;
+
+ LineType eLineType = (rStartPt.Y() > rEndPt.Y()) ? LINE_DESCENDING : LINE_ASCENDING;
+ if ( rStartPt.X() == rEndPt.X() )
+ {
+ // vertical line
+ const long nEndY = rEndPt.Y();
+
+ nX = rStartPt.X();
+ nY = rStartPt.Y();
+
+ if( nEndY > nY )
+ {
+ for ( ; nY <= nEndY; nY++ )
+ {
+ Point aNewPoint( nX, nY );
+ InsertPoint( aNewPoint, nLineId,
+ (aNewPoint == rEndPt) || (aNewPoint == rStartPt),
+ eLineType );
+ }
+ }
+ else
+ {
+ for ( ; nY >= nEndY; nY-- )
+ {
+ Point aNewPoint( nX, nY );
+ InsertPoint( aNewPoint, nLineId,
+ (aNewPoint == rEndPt) || (aNewPoint == rStartPt),
+ eLineType );
+ }
+ }
+ }
+ else if ( rStartPt.Y() != rEndPt.Y() )
+ {
+ const long nDX = labs( rEndPt.X() - rStartPt.X() );
+ const long nDY = labs( rEndPt.Y() - rStartPt.Y() );
+ const long nStartX = rStartPt.X();
+ const long nStartY = rStartPt.Y();
+ const long nEndX = rEndPt.X();
+ const long nEndY = rEndPt.Y();
+ const long nXInc = ( nStartX < nEndX ) ? 1L : -1L;
+ const long nYInc = ( nStartY < nEndY ) ? 1L : -1L;
+
+ if ( nDX >= nDY )
+ {
+ const long nDYX = ( nDY - nDX ) << 1;
+ const long nDY2 = nDY << 1;
+ long nD = nDY2 - nDX;
+
+ for ( nX = nStartX, nY = nStartY; nX != nEndX; nX += nXInc )
+ {
+ InsertPoint( Point( nX, nY ), nLineId, nStartX == nX, eLineType );
+
+ if ( nD < 0L )
+ nD += nDY2;
+ else
+ nD += nDYX, nY += nYInc;
+ }
+ }
+ else
+ {
+ const long nDYX = ( nDX - nDY ) << 1;
+ const long nDY2 = nDX << 1;
+ long nD = nDY2 - nDY;
+
+ for ( nX = nStartX, nY = nStartY; nY != nEndY; nY += nYInc )
+ {
+ InsertPoint( Point( nX, nY ), nLineId, nStartY == nY, eLineType );
+
+ if ( nD < 0L )
+ nD += nDY2;
+ else
+ nD += nDYX, nX += nXInc;
+ }
+ }
+
+ // last point
+ InsertPoint( Point( nEndX, nEndY ), nLineId, TRUE, eLineType );
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+//
+// search for appropriate place for the new point
+
+BOOL ImplRegion::InsertPoint( const Point &rPoint, long nLineID,
+ BOOL bEndPoint, LineType eLineType )
+{
+ DBG_ASSERT( mpFirstBand != NULL, "ImplRegion::InsertPoint - no bands available!" );
+
+ if ( rPoint.Y() == mpLastCheckedBand->mnYTop )
+ {
+ mpLastCheckedBand->InsertPoint( rPoint.X(), nLineID, bEndPoint, eLineType );
+ return TRUE;
+ }
+
+ if ( rPoint.Y() > mpLastCheckedBand->mnYTop )
+ {
+ // Search ascending
+ while ( mpLastCheckedBand )
+ {
+ // Insert point if possible
+ if ( rPoint.Y() == mpLastCheckedBand->mnYTop )
+ {
+ mpLastCheckedBand->InsertPoint( rPoint.X(), nLineID, bEndPoint, eLineType );
+ return TRUE;
+ }
+
+ mpLastCheckedBand = mpLastCheckedBand->mpNextBand;
+ }
+
+ DBG_ERROR( "ImplRegion::InsertPoint reached the end of the list!" );
+ }
+ else
+ {
+ // Search descending
+ while ( mpLastCheckedBand )
+ {
+ // Insert point if possible
+ if ( rPoint.Y() == mpLastCheckedBand->mnYTop )
+ {
+ mpLastCheckedBand->InsertPoint( rPoint.X(), nLineID, bEndPoint, eLineType );
+ return TRUE;
+ }
+
+ mpLastCheckedBand = mpLastCheckedBand->mpPrevBand;
+ }
+
+ DBG_ERROR( "ImplRegion::InsertPoint reached the beginning of the list!" );
+ }
+
+ DBG_ERROR( "ImplRegion::InsertPoint point not inserted!" );
+
+ // reinitialize pointer (should never be reached!)
+ mpLastCheckedBand = mpFirstBand;
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+//
+// search for appropriate places for the new bands
+
+void ImplRegion::InsertBands( long nTop, long nBottom )
+{
+ // region empty? -> set rectagle as first entry!
+ if ( !mpFirstBand )
+ {
+ // add band with boundaries of the rectangle
+ mpFirstBand = new ImplRegionBand( nTop, nBottom );
+ return;
+ }
+
+ // find/insert bands for the boundaries of the rectangle
+ BOOL bTopBoundaryInserted = FALSE;
+ BOOL bTop2BoundaryInserted = FALSE;
+ BOOL bBottomBoundaryInserted = FALSE;
+
+ // special case: top boundary is above the first band
+ ImplRegionBand* pNewBand;
+ if ( nTop < mpFirstBand->mnYTop )
+ {
+ // create new band above the first in the list
+ pNewBand = new ImplRegionBand( nTop, mpFirstBand->mnYTop );
+ if ( nBottom < mpFirstBand->mnYTop )
+ pNewBand->mnYBottom = nBottom;
+
+ // insert band into the list
+ pNewBand->mpNextBand = mpFirstBand;
+ mpFirstBand = pNewBand;
+
+ bTopBoundaryInserted = TRUE;
+ }
+
+ // insert band(s) into the list
+ ImplRegionBand* pBand = mpFirstBand;
+ while ( pBand )
+ {
+ // Insert Bands if possible
+ if ( !bTopBoundaryInserted )
+ bTopBoundaryInserted = InsertSingleBand( pBand, nTop - 1 );
+
+ if ( !bTop2BoundaryInserted )
+ bTop2BoundaryInserted = InsertSingleBand( pBand, nTop );
+
+ if ( !bBottomBoundaryInserted && (nTop != nBottom) )
+ bBottomBoundaryInserted = InsertSingleBand( pBand, nBottom );
+
+ // both boundaries inserted? -> nothing more to do
+ if ( bTopBoundaryInserted && bTop2BoundaryInserted && bBottomBoundaryInserted )
+ break;
+
+ // insert bands between two bands if neccessary
+ if ( pBand->mpNextBand )
+ {
+ if ( (pBand->mnYBottom + 1) < pBand->mpNextBand->mnYTop )
+ {
+ // copy band with list and set new boundary
+ pNewBand = new ImplRegionBand( pBand->mnYBottom+1,
+ pBand->mpNextBand->mnYTop-1 );
+
+ // insert band into the list
+ pNewBand->mpNextBand = pBand->mpNextBand;
+ pBand->mpNextBand = pNewBand;
+ }
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+}
+
+// -----------------------------------------------------------------------
+//
+// create new band and insert it into the list
+
+BOOL ImplRegion::InsertSingleBand( ImplRegionBand* pBand,
+ long nYBandPosition )
+{
+ // boundary already included in band with height 1? -> nothing to do!
+ if ( (pBand->mnYTop == pBand->mnYBottom) &&
+ (nYBandPosition == pBand->mnYTop) )
+ return TRUE;
+
+ // insert single height band on top?
+ ImplRegionBand* pNewBand;
+ if ( nYBandPosition == pBand->mnYTop )
+ {
+ // copy band with list and set new boundary
+ pNewBand = new ImplRegionBand( *pBand );
+ pNewBand->mnYTop = nYBandPosition+1;
+
+ // insert band into the list
+ pNewBand->mpNextBand = pBand->mpNextBand;
+ pBand->mnYBottom = nYBandPosition;
+ pBand->mpNextBand = pNewBand;
+
+ return TRUE;
+ }
+
+ // top of new rectangle within the current band? -> insert new band and copy data
+ if ( (nYBandPosition > pBand->mnYTop) &&
+ (nYBandPosition < pBand->mnYBottom) )
+ {
+ // copy band with list and set new boundary
+ pNewBand = new ImplRegionBand( *pBand );
+ pNewBand->mnYTop = nYBandPosition;
+
+ // insert band into the list
+ pNewBand->mpNextBand = pBand->mpNextBand;
+ pBand->mnYBottom = nYBandPosition;
+ pBand->mpNextBand = pNewBand;
+
+ // copy band with list and set new boundary
+ pNewBand = new ImplRegionBand( *pBand );
+ pNewBand->mnYTop = nYBandPosition;
+
+ // insert band into the list
+ pBand->mpNextBand->mnYTop = nYBandPosition+1;
+
+ pNewBand->mpNextBand = pBand->mpNextBand;
+ pBand->mnYBottom = nYBandPosition - 1;
+ pBand->mpNextBand = pNewBand;
+
+ return TRUE;
+ }
+
+ // create new band behind the current in the list
+ if ( !pBand->mpNextBand )
+ {
+ if ( nYBandPosition == pBand->mnYBottom )
+ {
+ // copy band with list and set new boundary
+ pNewBand = new ImplRegionBand( *pBand );
+ pNewBand->mnYTop = pBand->mnYBottom;
+ pNewBand->mnYBottom = nYBandPosition;
+
+ pBand->mnYBottom = nYBandPosition-1;
+
+ // append band to the list
+ pBand->mpNextBand = pNewBand;
+ return TRUE;
+ }
+
+ if ( nYBandPosition > pBand->mnYBottom )
+ {
+ // create new band
+ pNewBand = new ImplRegionBand( pBand->mnYBottom + 1, nYBandPosition );
+
+ // append band to the list
+ pBand->mpNextBand = pNewBand;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplRegion::Union( long nLeft, long nTop, long nRight, long nBottom )
+{
+ DBG_ASSERT( nLeft <= nRight, "ImplRegion::Union() - nLeft > nRight" );
+ DBG_ASSERT( nTop <= nBottom, "ImplRegion::Union() - nTop > nBottom" );
+
+ // process union
+ ImplRegionBand* pBand = mpFirstBand;
+ while ( pBand )
+ {
+ if ( pBand->mnYTop >= nTop )
+ {
+ if ( pBand->mnYBottom <= nBottom )
+ pBand->Union( nLeft, nRight );
+ else
+ {
+#ifdef DBG_UTIL
+ long nCurY = pBand->mnYBottom;
+ pBand = pBand->mpNextBand;
+ while ( pBand )
+ {
+ if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) )
+ {
+ DBG_ERROR( "ImplRegion::Union() - Bands not sorted!" );
+ }
+ pBand = pBand->mpNextBand;
+ }
+#endif
+ break;
+ }
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegion::Exclude( long nLeft, long nTop, long nRight, long nBottom )
+{
+ DBG_ASSERT( nLeft <= nRight, "ImplRegion::Exclude() - nLeft > nRight" );
+ DBG_ASSERT( nTop <= nBottom, "ImplRegion::Exclude() - nTop > nBottom" );
+
+ // process exclude
+ ImplRegionBand* pBand = mpFirstBand;
+ while ( pBand )
+ {
+ if ( pBand->mnYTop >= nTop )
+ {
+ if ( pBand->mnYBottom <= nBottom )
+ pBand->Exclude( nLeft, nRight );
+ else
+ {
+#ifdef DBG_UTIL
+ long nCurY = pBand->mnYBottom;
+ pBand = pBand->mpNextBand;
+ while ( pBand )
+ {
+ if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) )
+ {
+ DBG_ERROR( "ImplRegion::Exclude() - Bands not sorted!" );
+ }
+ pBand = pBand->mpNextBand;
+ }
+#endif
+ break;
+ }
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplRegion::XOr( long nLeft, long nTop, long nRight, long nBottom )
+{
+ DBG_ASSERT( nLeft <= nRight, "ImplRegion::Exclude() - nLeft > nRight" );
+ DBG_ASSERT( nTop <= nBottom, "ImplRegion::Exclude() - nTop > nBottom" );
+
+ // process xor
+ ImplRegionBand* pBand = mpFirstBand;
+ while ( pBand )
+ {
+ if ( pBand->mnYTop >= nTop )
+ {
+ if ( pBand->mnYBottom <= nBottom )
+ pBand->XOr( nLeft, nRight );
+ else
+ {
+#ifdef DBG_UTIL
+ long nCurY = pBand->mnYBottom;
+ pBand = pBand->mpNextBand;
+ while ( pBand )
+ {
+ if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) )
+ {
+ DBG_ERROR( "ImplRegion::XOr() - Bands not sorted!" );
+ }
+ pBand = pBand->mpNextBand;
+ }
+#endif
+ break;
+ }
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+}
+
+// -----------------------------------------------------------------------
+//
+// remove empty bands
+
+BOOL ImplRegion::OptimizeBandList()
+{
+ DBG_ASSERT( (this != &aImplNullRegion) && (this != &aImplEmptyRegion),
+ "ImplRegion::OptimizeBandList() - Empty oder NULL-Region" );
+
+ mnRectCount = 0;
+
+ ImplRegionBand* pPrevBand;
+ ImplRegionBand* pBand = mpFirstBand;
+ while ( pBand )
+ {
+ const BOOL bBTEqual = pBand->mpNextBand &&
+ (pBand->mnYBottom == pBand->mpNextBand->mnYTop);
+
+ // no separation? -> remove!
+ if ( pBand->IsEmpty() || (bBTEqual && (pBand->mnYBottom == pBand->mnYTop)) )
+ {
+ // save pointer
+ ImplRegionBand* pOldBand = pBand;
+
+ // previous element of the list
+ if ( pBand == mpFirstBand )
+ mpFirstBand = pBand->mpNextBand;
+ else
+ pPrevBand->mpNextBand = pBand->mpNextBand;
+
+ pBand = pBand->mpNextBand;
+ delete pOldBand;
+ }
+ else
+ {
+ // fixup
+ if ( bBTEqual )
+ pBand->mnYBottom = pBand->mpNextBand->mnYTop-1;
+
+ // this and next band with equal separations? -> combine!
+ if ( pBand->mpNextBand &&
+ ((pBand->mnYBottom+1) == pBand->mpNextBand->mnYTop) &&
+ (*pBand == *pBand->mpNextBand) )
+ {
+ // expand current height
+ pBand->mnYBottom = pBand->mpNextBand->mnYBottom;
+
+ // remove next band from list
+ ImplRegionBand* pDeletedBand = pBand->mpNextBand;
+ pBand->mpNextBand = pDeletedBand->mpNextBand;
+ delete pDeletedBand;
+
+ // check band again!
+ }
+ else
+ {
+ // count rectangles within band
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while ( pSep )
+ {
+ mnRectCount++;
+ pSep = pSep->mpNextSep;
+ }
+
+ pPrevBand = pBand;
+ pBand = pBand->mpNextBand;
+ }
+ }
+ }
+
+#ifdef DBG_UTIL
+ pBand = mpFirstBand;
+ while ( pBand )
+ {
+ DBG_ASSERT( pBand->mpFirstSep != NULL,
+ "Exiting ImplRegion::OptimizeBandList(): empty band in region!" );
+
+ if ( pBand->mnYBottom < pBand->mnYTop )
+ DBG_ERROR( "ImplRegion::OptimizeBandList(): YBottomBoundary < YTopBoundary" );
+
+ if ( pBand->mpNextBand )
+ {
+ if ( pBand->mnYBottom >= pBand->mpNextBand->mnYTop )
+ DBG_ERROR( "ImplRegion::OptimizeBandList(): overlapping bands in region!" );
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+#endif
+
+ return (mnRectCount != 0);
+}
+
+// =======================================================================
+
+void Region::ImplCopyData()
+{
+ mpImplRegion->mnRefCount--;
+ mpImplRegion = new ImplRegion( *mpImplRegion );
+}
+
+// =======================================================================
+
+Region::Region()
+{
+ DBG_CTOR( Region, ImplDbgTestRegion );
+
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+}
+
+// -----------------------------------------------------------------------
+
+Region::Region( RegionType eType )
+{
+ DBG_CTOR( Region, ImplDbgTestRegion );
+ DBG_ASSERT( (eType == REGION_NULL) || (eType == REGION_EMPTY),
+ "Region( RegionType ) - RegionType != EMPTY/NULL" );
+
+ if ( eType == REGION_NULL )
+ mpImplRegion = (ImplRegion*)(&aImplNullRegion);
+ else
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+}
+
+// -----------------------------------------------------------------------
+
+Region::Region( const Rectangle& rRect )
+{
+ DBG_CTOR( Region, ImplDbgTestRegion );
+
+ ImplCreateRectRegion( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+Region::Region( const Polygon& rPolygon )
+{
+ DBG_CTOR( Region, ImplDbgTestRegion );
+ DBG_CHKOBJ( &rPolygon, Polygon, NULL );
+
+ ImplCreatePolyPolyRegion( rPolygon );
+}
+
+// -----------------------------------------------------------------------
+
+Region::Region( const PolyPolygon& rPolyPoly )
+{
+ DBG_CTOR( Region, ImplDbgTestRegion );
+ DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL );
+
+ ImplCreatePolyPolyRegion( rPolyPoly );
+}
+
+// -----------------------------------------------------------------------
+
+Region::Region( const Region& rRegion )
+{
+ DBG_CTOR( Region, ImplDbgTestRegion );
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+ DBG_ASSERT( rRegion.mpImplRegion->mnRefCount < 0xFFFFFFFE, "Region: RefCount overflow" );
+
+ // copy pointer to instance of implementation
+ mpImplRegion = rRegion.mpImplRegion;
+ if ( mpImplRegion->mnRefCount )
+ mpImplRegion->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+Region::~Region()
+{
+ DBG_DTOR( Region, ImplDbgTestRegion );
+
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Region::ImplCreateRectRegion( const Rectangle& rRect )
+{
+ if ( rRect.IsEmpty() )
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ else
+ {
+ // get justified rectangle
+ long nTop = Min( rRect.Top(), rRect.Bottom() );
+ long nBottom = Max( rRect.Top(), rRect.Bottom() );
+ long nLeft = Min( rRect.Left(), rRect.Right() );
+ long nRight = Max( rRect.Left(), rRect.Right() );
+
+ // create instance of implementation class
+ mpImplRegion = new ImplRegion();
+
+ // add band with boundaries of the rectangle
+ mpImplRegion->mpFirstBand = new ImplRegionBand( nTop, nBottom );
+
+ // Set left and right boundaries of the band
+ mpImplRegion->mpFirstBand->Union( nLeft, nRight );
+ mpImplRegion->mnRectCount = 1;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Region::ImplCreatePolyPolyRegion( const PolyPolygon& rPolyPoly )
+{
+ const USHORT nPolyCount = rPolyPoly.Count();
+ if ( nPolyCount )
+ {
+ // polypolygon empty? -> empty region
+ const Rectangle aRect( rPolyPoly.GetBoundRect() );
+
+ if ( !aRect.IsEmpty() )
+ {
+ // width OR height == 1 ? => Rectangular region
+ if ( (aRect.GetWidth() == 1) || (aRect.GetHeight() == 1) )
+ ImplCreateRectRegion( aRect );
+ else
+ mpImplRegion = new ImplRegion( rPolyPoly );
+ }
+ else
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+ else
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+}
+
+// -----------------------------------------------------------------------
+
+void Region::ImplPolyPolyRegionToBandRegionFunc()
+{
+ const PolyPolygon aPolyPoly( *mpImplRegion->mpPolyPoly );
+
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+
+ const USHORT nPolyCount = aPolyPoly.Count();
+ if ( nPolyCount )
+ {
+ // polypolygon empty? -> empty region
+ const Rectangle aRect( aPolyPoly.GetBoundRect() );
+
+ if ( !aRect.IsEmpty() )
+ {
+ long nLineID = 0L;
+
+ // initialisation and creation of Bands
+ mpImplRegion = new ImplRegion();
+ mpImplRegion->CreateBandRange( aRect.Top(), aRect.Bottom() );
+
+ // insert polygons
+ for ( USHORT nPoly = 0; nPoly < nPolyCount; nPoly++ )
+ {
+ // get reference to current polygon
+ const Polygon& aPoly = aPolyPoly.GetObject( nPoly );
+ const USHORT nSize = aPoly.GetSize();
+
+ // not enough points ( <= 2 )? -> nothing to do!
+ if ( nSize <= 2 )
+ continue;
+
+ // band the polygon
+ for ( USHORT nPoint = 1; nPoint < nSize; nPoint++ )
+ mpImplRegion->InsertLine( aPoly.GetPoint(nPoint-1), aPoly.GetPoint(nPoint), nLineID++ );
+
+ // close polygon with line from first point to last point, if neccesary
+ const Point rLastPoint = aPoly.GetPoint(nSize-1);
+ const Point rFirstPoint = aPoly.GetPoint(0);
+ if ( rLastPoint != rFirstPoint )
+ mpImplRegion->InsertLine( rLastPoint, rFirstPoint, nLineID++ );
+ }
+
+ // process bands with lines
+ ImplRegionBand* pRegionBand = mpImplRegion->mpFirstBand;
+ while ( pRegionBand )
+ {
+ // generate separations from the lines and process union
+ pRegionBand->ProcessPoints();
+ pRegionBand = pRegionBand->mpNextBand;
+ }
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+ }
+ else
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+ else
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+}
+
+// -----------------------------------------------------------------------
+
+void Region::Move( long nHorzMove, long nVertMove )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // no region data? -> nothing to do
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return;
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ if ( mpImplRegion->mpPolyPoly )
+ mpImplRegion->mpPolyPoly->Move( nHorzMove, nVertMove );
+ else
+ {
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // process the vertical move
+ if ( nVertMove != 0)
+ {
+ pBand->mnYTop = pBand->mnYTop + nVertMove;
+ pBand->mnYBottom = pBand->mnYBottom + nVertMove;
+ }
+
+ // process the horizontal move
+ if ( nHorzMove != 0)
+ pBand->MoveX( nHorzMove );
+
+ pBand = pBand->mpNextBand;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Region::Scale( double fScaleX, double fScaleY )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // no region data? -> nothing to do
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return;
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ if ( mpImplRegion->mpPolyPoly )
+ mpImplRegion->mpPolyPoly->Scale( fScaleX, fScaleY );
+ else
+ {
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // process the vertical move
+ if ( fScaleY != 0.0 )
+ {
+ pBand->mnYTop = FRound( pBand->mnYTop * fScaleY );
+ pBand->mnYBottom = FRound( pBand->mnYBottom * fScaleY );
+ }
+
+ // process the horizontal move
+ if ( fScaleX != 0.0 )
+ pBand->ScaleX( fScaleX );
+
+ pBand = pBand->mpNextBand;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::Union( const Rectangle& rRect )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // is rectangle empty? -> nothing to do
+ if ( rRect.IsEmpty() )
+ return TRUE;
+
+ ImplPolyPolyRegionToBandRegion();
+
+ // no instance data? -> create!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ mpImplRegion = new ImplRegion();
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // get justified rectangle
+ long nLeft = Min( rRect.Left(), rRect.Right() );
+ long nTop = Min( rRect.Top(), rRect.Bottom() );
+ long nRight = Max( rRect.Left(), rRect.Right() );
+ long nBottom = Max( rRect.Top(), rRect.Bottom() );
+
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( nTop, nBottom );
+
+ // process union
+ mpImplRegion->Union( nLeft, nTop, nRight, nBottom );
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::Intersect( const Rectangle& rRect )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // is rectangle empty? -> nothing to do
+ if ( rRect.IsEmpty() )
+ {
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ return TRUE;
+ }
+
+ ImplPolyPolyRegionToBandRegion();
+
+ // is region empty? -> nothing to do!
+ if ( mpImplRegion == &aImplEmptyRegion )
+ return TRUE;
+
+ // get justified rectangle
+ long nLeft = Min( rRect.Left(), rRect.Right() );
+ long nTop = Min( rRect.Top(), rRect.Bottom() );
+ long nRight = Max( rRect.Left(), rRect.Right() );
+ long nBottom = Max( rRect.Top(), rRect.Bottom() );
+
+ // is own region NULL-region? -> copy data!
+ if ( mpImplRegion == &aImplNullRegion )
+ {
+ // create instance of implementation class
+ mpImplRegion = new ImplRegion();
+
+ // add band with boundaries of the rectangle
+ mpImplRegion->mpFirstBand = new ImplRegionBand( nTop, nBottom );
+
+ // Set left and right boundaries of the band
+ mpImplRegion->mpFirstBand->Union( nLeft, nRight );
+ mpImplRegion->mnRectCount = 1;
+
+ return TRUE;
+ }
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( nTop, nBottom );
+
+ // process intersections
+ ImplRegionBand* pPrevBand;
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // band within intersection boundary? -> process. otherwise remove
+ if ( (pBand->mnYTop >= nTop) &&
+ (pBand->mnYBottom <= nBottom) )
+ {
+ // process intersection
+ pBand->Intersect( nLeft, nRight );
+
+ pPrevBand = pBand;
+ pBand = pBand->mpNextBand;
+ }
+ else
+ {
+ ImplRegionBand* pOldBand = pBand;
+ if ( pBand == mpImplRegion->mpFirstBand )
+ mpImplRegion->mpFirstBand = pBand->mpNextBand;
+ else
+ pPrevBand->mpNextBand = pBand->mpNextBand;
+ pBand = pBand->mpNextBand;
+ delete pOldBand;
+ }
+ }
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::Exclude( const Rectangle& rRect )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // is rectangle empty? -> nothing to do
+ if ( rRect.IsEmpty() )
+ return TRUE;
+
+ ImplPolyPolyRegionToBandRegion();
+
+ // no instance data? -> create!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return TRUE;
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // get justified rectangle
+ long nLeft = Min( rRect.Left(), rRect.Right() );
+ long nTop = Min( rRect.Top(), rRect.Bottom() );
+ long nRight = Max( rRect.Left(), rRect.Right() );
+ long nBottom = Max( rRect.Top(), rRect.Bottom() );
+
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( nTop, nBottom );
+
+ // process exclude
+ mpImplRegion->Exclude( nLeft, nTop, nRight, nBottom );
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::XOr( const Rectangle& rRect )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // is rectangle empty? -> nothing to do
+ if ( rRect.IsEmpty() )
+ return TRUE;
+
+ ImplPolyPolyRegionToBandRegion();
+
+ // no instance data? -> create!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ mpImplRegion = new ImplRegion();
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // get justified rectangle
+ long nLeft = Min( rRect.Left(), rRect.Right() );
+ long nTop = Min( rRect.Top(), rRect.Bottom() );
+ long nRight = Max( rRect.Left(), rRect.Right() );
+ long nBottom = Max( rRect.Top(), rRect.Bottom() );
+
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( nTop, nBottom );
+
+ // process xor
+ mpImplRegion->XOr( nLeft, nTop, nRight, nBottom );
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::Union( const Region& rRegion )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ImplPolyPolyRegionToBandRegion();
+ ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
+
+ // is region empty or null? -> nothing to do
+ if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) )
+ return TRUE;
+
+ // no instance data? -> create!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ mpImplRegion = new ImplRegion();
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // Alle Rechtecke aus der uebergebenen Region auf diese Region anwenden
+ ImplRegionBand* pBand = rRegion.mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( pBand->mnYTop, pBand->mnYBottom );
+
+ // process all elements of the list
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while ( pSep )
+ {
+ mpImplRegion->Union( pSep->mnXLeft, pBand->mnYTop,
+ pSep->mnXRight, pBand->mnYBottom );
+ pSep = pSep->mpNextSep;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::Intersect( const Region& rRegion )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // same instance data? -> nothing to do!
+ if ( mpImplRegion == rRegion.mpImplRegion )
+ return TRUE;
+
+ ImplPolyPolyRegionToBandRegion();
+ ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
+
+ if ( mpImplRegion == &aImplEmptyRegion )
+ return TRUE;
+
+ // is region null? -> nothing to do
+ if ( rRegion.mpImplRegion == &aImplNullRegion )
+ return TRUE;
+
+ // is rectangle empty? -> nothing to do
+ if ( rRegion.mpImplRegion == &aImplEmptyRegion )
+ {
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ return TRUE;
+ }
+
+ // is own region NULL-region? -> copy data!
+ if ( mpImplRegion == &aImplNullRegion)
+ {
+ mpImplRegion = rRegion.mpImplRegion;
+ rRegion.mpImplRegion->mnRefCount++;
+ return TRUE;
+ }
+
+ // Wenn wir weniger Rechtecke haben, drehen wir den Intersect-Aufruf um
+ if ( mpImplRegion->mnRectCount+2 < rRegion.mpImplRegion->mnRectCount )
+ {
+ Region aTempRegion = rRegion;
+ aTempRegion.Intersect( *this );
+ *this = aTempRegion;
+ }
+ else
+ {
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // mark all bands as untouched
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ pBand->mbTouched = FALSE;
+ pBand = pBand->mpNextBand;
+ }
+
+ pBand = rRegion.mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( pBand->mnYTop, pBand->mnYBottom );
+
+ // process all elements of the list
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while ( pSep )
+ {
+ // left boundary?
+ if ( pSep == pBand->mpFirstSep )
+ {
+ // process intersection and do not remove untouched bands
+ mpImplRegion->Exclude( LONG_MIN+1, pBand->mnYTop,
+ pSep->mnXLeft-1, pBand->mnYBottom );
+ }
+
+ // right boundary?
+ if ( pSep->mpNextSep == NULL )
+ {
+ // process intersection and do not remove untouched bands
+ mpImplRegion->Exclude( pSep->mnXRight+1, pBand->mnYTop,
+ LONG_MAX-1, pBand->mnYBottom );
+ }
+ else
+ {
+ // process intersection and do not remove untouched bands
+ mpImplRegion->Exclude( pSep->mnXRight+1, pBand->mnYTop,
+ pSep->mpNextSep->mnXLeft-1, pBand->mnYBottom );
+ }
+
+ pSep = pSep->mpNextSep;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+
+ // remove all untouched bands if bands allready left
+ ImplRegionBand* pPrevBand;
+ pBand = mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ if ( !pBand->mbTouched )
+ {
+ // save pointer
+ ImplRegionBand* pOldBand = pBand;
+
+ // previous element of the list
+ if ( pBand == mpImplRegion->mpFirstBand )
+ mpImplRegion->mpFirstBand = pBand->mpNextBand;
+ else
+ pPrevBand->mpNextBand = pBand->mpNextBand;
+
+ pBand = pBand->mpNextBand;
+ delete pOldBand;
+ }
+ else
+ {
+ pPrevBand = pBand;
+ pBand = pBand->mpNextBand;
+ }
+ }
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::Exclude( const Region& rRegion )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ImplPolyPolyRegionToBandRegion();
+ ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
+
+ // is region empty or null? -> nothing to do
+ if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) )
+ return TRUE;
+
+ // no instance data? -> nothing to do
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return TRUE;
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // Alle Rechtecke aus der uebergebenen Region auf diese Region anwenden
+ ImplRegionBand* pBand = rRegion.mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( pBand->mnYTop, pBand->mnYBottom );
+
+ // process all elements of the list
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while ( pSep )
+ {
+ mpImplRegion->Exclude( pSep->mnXLeft, pBand->mnYTop,
+ pSep->mnXRight, pBand->mnYBottom );
+ pSep = pSep->mpNextSep;
+ }
+
+ // Wir optimieren schon in der Schleife, da wir davon
+ // ausgehen, das wir insgesammt weniger Baender ueberpruefen
+ // muessen
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ break;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::XOr( const Region& rRegion )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ImplPolyPolyRegionToBandRegion();
+ ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
+
+ // is region empty or null? -> nothing to do
+ if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) )
+ return TRUE;
+
+ // no instance data? -> nothing to do
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return TRUE;
+
+ // no own instance data? -> make own copy!
+ if ( mpImplRegion->mnRefCount > 1 )
+ ImplCopyData();
+
+ // Alle Rechtecke aus der uebergebenen Region auf diese Region anwenden
+ ImplRegionBand* pBand = rRegion.mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // insert bands if the boundaries are not allready in the list
+ mpImplRegion->InsertBands( pBand->mnYTop, pBand->mnYBottom );
+
+ // process all elements of the list
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while ( pSep )
+ {
+ mpImplRegion->XOr( pSep->mnXLeft, pBand->mnYTop,
+ pSep->mnXRight, pBand->mnYBottom );
+ pSep = pSep->mpNextSep;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle Region::GetBoundRect() const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ Rectangle aRect;
+
+ // no internal data? -> region is empty!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return aRect;
+
+ // PolyPolygon data im Imp structure?
+ if ( mpImplRegion->mpPolyPoly )
+ return mpImplRegion->mpPolyPoly->GetBoundRect();
+
+ // no band in the list? -> region is empty!
+ if ( !mpImplRegion->mpFirstBand )
+ return aRect;
+
+ // get the boundaries of the first band
+ long nYTop = mpImplRegion->mpFirstBand->mnYTop;
+ long nYBottom = mpImplRegion->mpFirstBand->mnYBottom;
+ long nXLeft = mpImplRegion->mpFirstBand->GetXLeftBoundary();
+ long nXRight = mpImplRegion->mpFirstBand->GetXRightBoundary();
+
+ // look in the band list (don't test first band again!)
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand->mpNextBand;
+ while ( pBand )
+ {
+ nYBottom = pBand->mnYBottom;
+ nXLeft = Min( nXLeft, pBand->GetXLeftBoundary() );
+ nXRight = Max( nXRight, pBand->GetXRightBoundary() );
+
+ pBand = pBand->mpNextBand;
+ }
+
+ // set rectangle
+ aRect = Rectangle( nXLeft, nYTop, nXRight, nYBottom );
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo,
+ long& rX, long& rY,
+ long& rWidth, long& rHeight ) const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ((Region*)this)->ImplPolyPolyRegionToBandRegion();
+
+ // no internal data? -> region is empty!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return FALSE;
+
+ // no band in the list? -> region is empty!
+ if ( mpImplRegion->mpFirstBand == NULL )
+ return FALSE;
+
+ // initialise pointer for first access
+ ImplRegionBand* pCurrRectBand = mpImplRegion->mpFirstBand;
+ ImplRegionBandSep* pCurrRectBandSep = pCurrRectBand->mpFirstSep;
+
+ DBG_ASSERT( pCurrRectBandSep != NULL, "Erstes Band wurde nicht optimiert." );
+ if ( !pCurrRectBandSep )
+ return FALSE;
+
+ // get boundaries of current rectangle
+ rX = pCurrRectBandSep->mnXLeft;
+ rY = pCurrRectBand->mnYTop;
+ rWidth = pCurrRectBandSep->mnXRight - pCurrRectBandSep->mnXLeft + 1;
+ rHeight = pCurrRectBand->mnYBottom - pCurrRectBand->mnYTop + 1;
+
+ // save pointers
+ rImplRegionInfo.mpVoidCurrRectBand = (void*)pCurrRectBand;
+ rImplRegionInfo.mpVoidCurrRectBandSep = (void*)pCurrRectBandSep;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::ImplGetNextRect( ImplRegionInfo& rImplRegionInfo,
+ long& rX, long& rY,
+ long& rWidth, long& rHeight ) const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // no internal data? -> region is empty!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return FALSE;
+
+ // get last pointers
+ ImplRegionBand* pCurrRectBand = (ImplRegionBand*)rImplRegionInfo.mpVoidCurrRectBand;
+ ImplRegionBandSep* pCurrRectBandSep = (ImplRegionBandSep*)rImplRegionInfo.mpVoidCurrRectBandSep;
+
+ // get next separation from current band
+ pCurrRectBandSep = pCurrRectBandSep->mpNextSep;
+
+ // no separation found? -> go to next band!
+ if ( !pCurrRectBandSep )
+ {
+ // get next band
+ pCurrRectBand = pCurrRectBand->mpNextBand;
+
+ // no band found? -> not further rectangles!
+ if( !pCurrRectBand )
+ return FALSE;
+
+ // get first separation in current band
+ pCurrRectBandSep = pCurrRectBand->mpFirstSep;
+ }
+
+ // get boundaries of current rectangle
+ rX = pCurrRectBandSep->mnXLeft;
+ rY = pCurrRectBand->mnYTop;
+ rWidth = pCurrRectBandSep->mnXRight - pCurrRectBandSep->mnXLeft + 1;
+ rHeight = pCurrRectBand->mnYBottom - pCurrRectBand->mnYTop + 1;
+
+ // save new pointers
+ rImplRegionInfo.mpVoidCurrRectBand = (void*)pCurrRectBand;
+ rImplRegionInfo.mpVoidCurrRectBandSep = (void*)pCurrRectBandSep;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+RegionType Region::GetType() const
+{
+ if ( mpImplRegion == &aImplEmptyRegion )
+ return REGION_EMPTY;
+ else if ( mpImplRegion == &aImplNullRegion )
+ return REGION_NULL;
+ else if ( mpImplRegion->mnRectCount == 1 )
+ return REGION_RECTANGLE;
+ else
+ return REGION_COMPLEX;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::IsInside( const Point& rPoint ) const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // PolyPolygon data im Imp structure?
+ ((Region*)this)->ImplPolyPolyRegionToBandRegion();
+/*
+ if ( mpImplRegion->mpPolyPoly )
+ return mpImplRegion->mpPolyPoly->IsInside( rPoint );
+*/
+
+ // no instance data? -> not inside
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return FALSE;
+
+ // search band list
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // is point within band?
+ if ( (pBand->mnYTop <= rPoint.Y()) &&
+ (pBand->mnYBottom >= rPoint.Y()) )
+ {
+ // is point within separation of the band?
+ if ( pBand->IsInside( rPoint.X() ) )
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::IsInside( const Rectangle& rRect ) const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // is rectangle empty? -> not inside
+ if ( rRect.IsEmpty() )
+ return FALSE;
+
+ // no instance data? -> not inside
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return FALSE;
+
+ // create region from rectangle and intersect own region
+ Region aRegion = rRect;
+ aRegion.Exclude( *this );
+
+ // rectangle is inside if exclusion is empty
+ return aRegion.IsEmpty();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::IsOver( const Rectangle& rRect ) const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return FALSE;
+
+ // Can we optimize this ??? - is used in StarDraw for brushes pointers
+ // Why we have no IsOver for Regions ???
+ // create region from rectangle and intersect own region
+ Region aRegion = rRect;
+ aRegion.Intersect( *this );
+
+ // rectangle is over if include is not empty
+ return !aRegion.IsEmpty();
+}
+
+// -----------------------------------------------------------------------
+
+void Region::SetNull()
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+
+ // set new type
+ mpImplRegion = (ImplRegion*)(&aImplNullRegion);
+}
+
+// -----------------------------------------------------------------------
+
+void Region::SetEmpty()
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+
+ // set new type
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+}
+
+// -----------------------------------------------------------------------
+
+Region& Region::operator=( const Region& rRegion )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+ DBG_ASSERT( rRegion.mpImplRegion->mnRefCount < 0xFFFFFFFE, "Region: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ // RefCount == 0 fuer statische Objekte
+ if ( rRegion.mpImplRegion->mnRefCount )
+ rRegion.mpImplRegion->mnRefCount++;
+
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+
+ mpImplRegion = rRegion.mpImplRegion;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+Region& Region::operator=( const Rectangle& rRect )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+
+ ImplCreateRectRegion( rRect );
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::operator==( const Region& rRegion ) const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+
+ // reference to same object? -> equal!
+ if ( mpImplRegion == rRegion.mpImplRegion )
+ return TRUE;
+
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return FALSE;
+
+ if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) )
+ return FALSE;
+
+ if ( rRegion.mpImplRegion->mpPolyPoly && mpImplRegion->mpPolyPoly )
+ return *rRegion.mpImplRegion->mpPolyPoly == *mpImplRegion->mpPolyPoly;
+ else
+ {
+ ((Region*)this)->ImplPolyPolyRegionToBandRegion();
+ ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
+
+ // Eine der beiden Regions kann jetzt Empty sein
+ if ( mpImplRegion == rRegion.mpImplRegion )
+ return TRUE;
+
+ if ( mpImplRegion == &aImplEmptyRegion )
+ return FALSE;
+
+ if ( rRegion.mpImplRegion == &aImplEmptyRegion )
+ return FALSE;
+ }
+
+ // initialise pointers
+ ImplRegionBand* pOwnRectBand = mpImplRegion->mpFirstBand;
+ ImplRegionBandSep* pOwnRectBandSep = pOwnRectBand->mpFirstSep;
+ ImplRegionBand* pSecondRectBand = rRegion.mpImplRegion->mpFirstBand;
+ ImplRegionBandSep* pSecondRectBandSep = pSecondRectBand->mpFirstSep;
+ while ( pOwnRectBandSep && pSecondRectBandSep )
+ {
+ // get boundaries of current rectangle
+ long nOwnXLeft = pOwnRectBandSep->mnXLeft;
+ long nSecondXLeft = pSecondRectBandSep->mnXLeft;
+ if ( nOwnXLeft != nSecondXLeft )
+ return FALSE;
+
+ long nOwnYTop = pOwnRectBand->mnYTop;
+ long nSecondYTop = pSecondRectBand->mnYTop;
+ if ( nOwnYTop != nSecondYTop )
+ return FALSE;
+
+ long nOwnXRight = pOwnRectBandSep->mnXRight;
+ long nSecondXRight = pSecondRectBandSep->mnXRight;
+ if ( nOwnXRight != nSecondXRight )
+ return FALSE;
+
+ long nOwnYBottom = pOwnRectBand->mnYBottom;
+ long nSecondYBottom = pSecondRectBand->mnYBottom;
+ if ( nOwnYBottom != nSecondYBottom )
+ return FALSE;
+
+ // get next separation from current band
+ pOwnRectBandSep = pOwnRectBandSep->mpNextSep;
+
+ // no separation found? -> go to next band!
+ if ( !pOwnRectBandSep )
+ {
+ // get next band
+ pOwnRectBand = pOwnRectBand->mpNextBand;
+
+ // get first separation in current band
+ if( pOwnRectBand )
+ pOwnRectBandSep = pOwnRectBand->mpFirstSep;
+ }
+
+ // get next separation from current band
+ pSecondRectBandSep = pSecondRectBandSep->mpNextSep;
+
+ // no separation found? -> go to next band!
+ if ( !pSecondRectBandSep )
+ {
+ // get next band
+ pSecondRectBand = pSecondRectBand->mpNextBand;
+
+ // get first separation in current band
+ if( pSecondRectBand )
+ pSecondRectBandSep = pSecondRectBand->mpFirstSep;
+ }
+
+ if ( pOwnRectBandSep && !pSecondRectBandSep )
+ return FALSE;
+
+ if ( !pOwnRectBandSep && pSecondRectBandSep )
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+enum StreamEntryType { STREAMENTRY_BANDHEADER, STREAMENTRY_SEPARATION, STREAMENTRY_END };
+
+SvStream& operator>>( SvStream& rIStrm, Region& rRegion )
+{
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+
+ VersionCompat aCompat( rIStrm, STREAM_READ );
+ UINT16 nVersion;
+ UINT16 nTmp16;
+
+ // statische Object haben RefCount von 0
+ if ( rRegion.mpImplRegion->mnRefCount )
+ {
+ if ( rRegion.mpImplRegion->mnRefCount > 1 )
+ rRegion.mpImplRegion->mnRefCount--;
+ else
+ delete rRegion.mpImplRegion;
+ }
+
+ // get version of streamed region
+ rIStrm >> nVersion;
+
+ // get type of region
+ rIStrm >> nTmp16;
+
+ RegionType meStreamedType = (RegionType)nTmp16;
+
+ switch( meStreamedType )
+ {
+ case REGION_NULL:
+ rRegion.mpImplRegion = (ImplRegion*)&aImplNullRegion;
+ break;
+
+ case REGION_EMPTY:
+ rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion;
+ break;
+
+ default:
+ // create instance of implementation class
+ rRegion.mpImplRegion = new ImplRegion();
+
+ // get header from first element
+ rIStrm >> nTmp16;
+
+ // get all bands
+ rRegion.mpImplRegion->mnRectCount = 0;
+ ImplRegionBand* pCurrBand = NULL;
+ while ( (StreamEntryType)nTmp16 != STREAMENTRY_END )
+ {
+ // insert new band or new separation?
+ if ( (StreamEntryType)nTmp16 == STREAMENTRY_BANDHEADER )
+ {
+ long nYTop;
+ long nYBottom;
+
+ rIStrm >> nYTop;
+ rIStrm >> nYBottom;
+
+ // create band
+ ImplRegionBand* pNewBand = new ImplRegionBand( nYTop, nYBottom );
+
+ // first element? -> set as first into the list
+ if ( !pCurrBand )
+ rRegion.mpImplRegion->mpFirstBand = pNewBand;
+ else
+ pCurrBand->mpNextBand = pNewBand;
+
+ // save pointer for next creation
+ pCurrBand = pNewBand;
+ }
+ else
+ {
+ long nXLeft;
+ long nXRight;
+
+ rIStrm >> nXLeft;
+ rIStrm >> nXRight;
+
+ // add separation
+ if ( pCurrBand )
+ {
+ pCurrBand->Union( nXLeft, nXRight );
+ rRegion.mpImplRegion->mnRectCount++;
+ }
+ }
+
+ // get next header
+ rIStrm >> nTmp16;
+ }
+ break;
+ }
+
+ return rIStrm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStrm, const Region& rRegion )
+{
+ DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
+
+ VersionCompat aCompat( rOStrm, STREAM_WRITE );
+ UINT16 nVersion = 1;
+
+ ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
+
+ // put version
+ rOStrm << nVersion;
+
+ // put type
+ rOStrm << (UINT16)rRegion.GetType();
+
+ // put all bands if not null or empty
+ if ( (rRegion.mpImplRegion != &aImplEmptyRegion) && (rRegion.mpImplRegion != &aImplNullRegion) )
+ {
+ ImplRegionBand* pBand = rRegion.mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ // put boundaries
+ rOStrm << (UINT16) STREAMENTRY_BANDHEADER;
+ rOStrm << pBand->mnYTop;
+ rOStrm << pBand->mnYBottom;
+
+ // put separations of current band
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while ( pSep )
+ {
+ // put separation
+ rOStrm << (UINT16) STREAMENTRY_SEPARATION;
+ rOStrm << pSep->mnXLeft;
+ rOStrm << pSep->mnXRight;
+
+ // next separation from current band
+ pSep = pSep->mpNextSep;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+
+ // put endmarker
+ rOStrm << (UINT16) STREAMENTRY_END;
+ }
+
+ return rOStrm;
+}
+
+// -----------------------------------------------------------------------
+
+RegionOverlapType Region::GetOverlapType( const Rectangle& rRect ) const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // is rectangle empty? -> not inside
+ if ( rRect.IsEmpty() )
+ return REGION_OUTSIDE;
+
+ ((Region*)this)->ImplPolyPolyRegionToBandRegion();
+
+ // no instance data? -> not inside
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return REGION_OUTSIDE;
+
+ // resolve pointer
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand;
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+
+ // complex region? don't check for now. This may change in the future...
+ if ( pBand->mpNextBand || pSep->mpNextSep )
+ return REGION_OVER;
+
+ // get justified rectangle
+ long nLeft = Min( rRect.Left(), rRect.Right() );
+ long nTop = Min( rRect.Top(), rRect.Bottom() );
+ long nRight = Max( rRect.Left(), rRect.Right() );
+ long nBottom = Max( rRect.Top(), rRect.Bottom() );
+
+ // check rectangle region
+ BOOL boLeft = (nLeft >= pSep->mnXLeft) && (nLeft < pSep->mnXRight);
+ BOOL boRight = (nRight <= pSep->mnXRight) && (nRight > pSep->mnXLeft);
+ BOOL boTop = (nTop >= pBand->mnYTop) && (nTop < pBand->mnYBottom);
+ BOOL boBottom = (nBottom <= pBand->mnYBottom) && (nBottom > pBand->mnYTop);
+ if ( boLeft && boRight && boTop && boBottom )
+ return REGION_INSIDE;
+ if ( boLeft || boRight || boTop || boBottom )
+ return REGION_OVER;
+
+ return REGION_OUTSIDE;
+}
+
+// -----------------------------------------------------------------------
+
+void Region::ImplBeginAddRect()
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ // statische Object haben RefCount von 0
+ if ( mpImplRegion->mnRefCount )
+ {
+ if ( mpImplRegion->mnRefCount > 1 )
+ mpImplRegion->mnRefCount--;
+ else
+ delete mpImplRegion;
+ }
+
+ // create fresh region
+ mpImplRegion = new ImplRegion();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::ImplAddRect( const Rectangle& rRect )
+{
+ // Hier kein CheckThis, da nicht alle Daten auf Stand
+
+ if ( rRect.IsEmpty() )
+ return TRUE;
+
+ // get justified rectangle
+ long nTop;
+ long nBottom;
+ long nLeft;
+ long nRight;
+ if ( rRect.Top() <= rRect.Bottom() )
+ {
+ nTop = rRect.Top();
+ nBottom = rRect.Bottom();
+ }
+ else
+ {
+ nTop = rRect.Bottom();
+ nBottom = rRect.Top();
+ }
+ if ( rRect.Left() <= rRect.Right() )
+ {
+ nLeft = rRect.Left();
+ nRight = rRect.Right();
+ }
+ else
+ {
+ nLeft = rRect.Right();
+ nRight = rRect.Left();
+ }
+
+ if ( !mpImplRegion->mpLastCheckedBand )
+ {
+ // create new band
+ mpImplRegion->mpLastCheckedBand = new ImplRegionBand( nTop, nBottom );
+
+ // set band as current
+ mpImplRegion->mpFirstBand = mpImplRegion->mpLastCheckedBand;
+ mpImplRegion->mpLastCheckedBand->Union( nLeft, nRight );
+ }
+ else
+ {
+ DBG_ASSERT( nTop >= mpImplRegion->mpLastCheckedBand->mnYTop,
+ "Region::ImplAddRect() - nTopY < nLastTopY" );
+
+ // new band? create it!
+ if ( (nTop != mpImplRegion->mpLastCheckedBand->mnYTop) ||
+ (nBottom != mpImplRegion->mpLastCheckedBand->mnYBottom) )
+ {
+ // create new band
+ ImplRegionBand* pNewRegionBand = new ImplRegionBand( nTop, nBottom );
+
+ // append band to the end
+ mpImplRegion->mpLastCheckedBand->mpNextBand = pNewRegionBand;
+
+ // skip to the new band
+ mpImplRegion->mpLastCheckedBand = mpImplRegion->mpLastCheckedBand->mpNextBand;
+ }
+
+ // Insert Sep
+ mpImplRegion->mpLastCheckedBand->Union( nLeft, nRight );
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Region::ImplEndAddRect()
+{
+ // check if we are empty
+ if ( !mpImplRegion->mpFirstBand )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ return;
+ }
+
+ // check if we have somthing to optimize
+ if ( !mpImplRegion->mpFirstBand->mpNextBand )
+ {
+ // update mpImplRegion->mnRectCount, because no OptimizeBandList is called
+ ImplRegionBandSep* pSep = mpImplRegion->mpFirstBand->mpFirstSep;
+ mpImplRegion->mnRectCount = 0;
+ while( pSep )
+ {
+ mpImplRegion->mnRectCount++;
+ pSep = pSep->mpNextSep;
+ }
+
+ // Erst hier testen, da hier die Daten wieder stimmen
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+ return;
+ }
+
+ // have to revert list? -> do it now!
+ if ( mpImplRegion->mpFirstBand->mnYTop >
+ mpImplRegion->mpFirstBand->mpNextBand->mnYTop )
+ {
+ ImplRegionBand * pNewFirstRegionBand;
+
+ // initialize temp list with first element
+ pNewFirstRegionBand = mpImplRegion->mpFirstBand;
+ mpImplRegion->mpFirstBand = mpImplRegion->mpFirstBand->mpNextBand;
+ pNewFirstRegionBand->mpNextBand = NULL;
+
+ // insert elements to the temp list
+ while ( mpImplRegion->mpFirstBand )
+ {
+ ImplRegionBand * pSavedRegionBand = pNewFirstRegionBand;
+ pNewFirstRegionBand = mpImplRegion->mpFirstBand;
+ mpImplRegion->mpFirstBand = mpImplRegion->mpFirstBand->mpNextBand;
+ pNewFirstRegionBand->mpNextBand = pSavedRegionBand;
+ }
+
+ // set temp list as new list
+ mpImplRegion->mpFirstBand = pNewFirstRegionBand;
+ }
+
+ // cleanup
+ if ( !mpImplRegion->OptimizeBandList() )
+ {
+ delete mpImplRegion;
+ mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
+ }
+
+ // Erst hier testen, da hier die Daten wieder stimmen
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Region::GetRectCount() const
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ((Region*)this)->ImplPolyPolyRegionToBandRegion();
+
+#ifdef DBG_UTIL
+ ULONG nCount = 0;
+
+ // all bands if not null or empty
+ if ( (mpImplRegion != &aImplEmptyRegion) && (mpImplRegion != &aImplNullRegion) )
+ {
+ ImplRegionBand* pBand = mpImplRegion->mpFirstBand;
+ while ( pBand )
+ {
+ ImplRegionBandSep* pSep = pBand->mpFirstSep;
+ while( pSep )
+ {
+ nCount++;
+ pSep = pSep->mpNextSep;
+ }
+
+ pBand = pBand->mpNextBand;
+ }
+ }
+
+ DBG_ASSERT( mpImplRegion->mnRectCount == nCount, "Region: invalid mnRectCount!" );
+#endif
+
+ return mpImplRegion->mnRectCount;
+}
+
+// -----------------------------------------------------------------------
+
+RegionHandle Region::BeginEnumRects()
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ImplPolyPolyRegionToBandRegion();
+
+ // no internal data? -> region is empty!
+ if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
+ return NULL;
+
+ // no band in the list? -> region is empty!
+ if ( mpImplRegion->mpFirstBand == NULL )
+ {
+ DBG_ASSERT( mpImplRegion->mpFirstBand, "Region::BeginEnumRects() First Band is Empty!" );
+ return NULL;
+ }
+
+ ImplRegionHandle* pData = new ImplRegionHandle;
+ pData->mpRegion = new Region( *this );
+ pData->mbFirst = TRUE;
+
+ // save pointers
+ pData->mpCurrRectBand = pData->mpRegion->mpImplRegion->mpFirstBand;
+ pData->mpCurrRectBandSep = pData->mpCurrRectBand->mpFirstSep;
+
+ return (RegionHandle)pData;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Region::GetEnumRects( RegionHandle pVoidData, Rectangle& rRect )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ImplRegionHandle* pData = (ImplRegionHandle*)pVoidData;
+ if ( !pData )
+ return FALSE;
+
+ if ( pData->mbFirst )
+ pData->mbFirst = FALSE;
+ else
+ {
+ // get next separation from current band
+ pData->mpCurrRectBandSep = pData->mpCurrRectBandSep->mpNextSep;
+
+ // no separation found? -> go to next band!
+ if ( !pData->mpCurrRectBandSep )
+ {
+ // get next band
+ pData->mpCurrRectBand = pData->mpCurrRectBand->mpNextBand;
+
+ // no band found? -> not further rectangles!
+ if ( !pData->mpCurrRectBand )
+ return FALSE;
+
+ // get first separation in current band
+ pData->mpCurrRectBandSep = pData->mpCurrRectBand->mpFirstSep;
+ }
+ }
+
+ // get boundaries of current rectangle
+ rRect.Top() = pData->mpCurrRectBand->mnYTop;
+ rRect.Bottom() = pData->mpCurrRectBand->mnYBottom;
+ rRect.Left() = pData->mpCurrRectBandSep->mnXLeft;
+ rRect.Right() = pData->mpCurrRectBandSep->mnXRight;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Region::EndEnumRects( RegionHandle pVoidData )
+{
+ DBG_CHKTHIS( Region, ImplDbgTestRegion );
+
+ ImplRegionHandle* pData = (ImplRegionHandle*)pVoidData;
+ if ( !pData )
+ return;
+
+ // cleanup
+ delete pData->mpRegion;
+ delete pData;
+}
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
new file mode 100644
index 000000000000..50af07d0eda9
--- /dev/null
+++ b/vcl/source/gdi/salmisc.cxx
@@ -0,0 +1,497 @@
+/*************************************************************************
+ *
+ * $RCSfile: salmisc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+#include <bmpacc.hxx>
+#include <salbtype.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define IMPL_CASE_GET_FORMAT( Format ) \
+case( BMP_FORMAT##Format ): \
+ pFncGetPixel = BitmapReadAccess::GetPixelFor##Format; \
+break
+
+// -----------------------------------------------------------------------------
+
+#define IMPL_CASE_SET_FORMAT( Format, BitCount ) \
+case( BMP_FORMAT##Format ): \
+{ \
+ pFncSetPixel = BitmapReadAccess::SetPixelFor##Format; \
+ pDstBuffer->mnBitCount = BitCount; \
+} \
+break
+
+// -----------------------------------------------------------------------------
+
+#define DOUBLE_SCANLINES() \
+while( ( nActY < nHeight1 ) && ( pMapY[ nActY + 1 ] == nMapY ) ) \
+{ \
+ HMEMCPY( pDstScanMap[ nActY + 1L ], pDstScan, rDstBuffer.mnScanlineSize ); \
+ nActY++; \
+}
+
+// -----------
+// - Inlines -
+// -----------
+
+#define TC_TO_PAL_COLORS 4096
+
+static long ImplIndexFromColor( const BitmapColor& rCol )
+{
+#if TC_TO_PAL_COLORS == 4096
+
+ return( ( ( (long) rCol.GetBlue() >> 4L) << 8L ) |
+ ( ( (long) rCol.GetGreen() >> 4L ) << 4L ) |
+ ( (long) rCol.GetRed() >> 4L ) );
+
+#elif TC_TO_PAL_COLORS == 32768
+
+ return( ( ( (long) rCol.GetBlue() >> 3L) << 10L ) |
+ ( ( (long) rCol.GetGreen() >> 3L ) << 5L ) |
+ ( (long) rCol.GetRed() >> 3L ) );
+
+#endif
+}
+
+
+#define COLOR_TO_INDEX( _def_rCol )
+
+// ------------------------
+// - conversion functions -
+// ------------------------
+
+static void ImplPALToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer,
+ FncGetPixel pFncGetPixel, FncSetPixel pFncSetPixel,
+ Scanline* pSrcScanMap, Scanline* pDstScanMap, long* pMapX, long* pMapY )
+{
+ const long nWidth = rDstBuffer.mnWidth, nHeight = rDstBuffer.mnHeight, nHeight1 = nHeight - 1;
+ const ColorMask& rSrcMask = rSrcBuffer.maColorMask;
+ const ColorMask& rDstMask = rDstBuffer.maColorMask;
+ BitmapPalette aColMap( rSrcBuffer.maPalette.GetEntryCount() );
+ BitmapColor* pColMapBuf = aColMap.ImplGetColorBuffer();
+ BitmapColor aIndex( 0 );
+
+ for( USHORT i = 0, nCount = aColMap.GetEntryCount(); i < nCount; i++ )
+ {
+ if( rSrcBuffer.maPalette[ i ] == rDstBuffer.maPalette[ i ] )
+ aIndex.SetIndex( i );
+ else
+ aIndex.SetIndex( rDstBuffer.maPalette.GetBestIndex( rSrcBuffer.maPalette[ i ] ) );
+
+ pColMapBuf[ i ] = aIndex;
+ }
+
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pFncSetPixel( pDstScan, nX, pColMapBuf[ pFncGetPixel( pSrcScan, pMapX[ nX ], rSrcMask ).GetIndex() ], rDstMask );
+
+ DOUBLE_SCANLINES();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+static void ImplPALToTC( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer,
+ FncGetPixel pFncGetPixel, FncSetPixel pFncSetPixel,
+ Scanline* pSrcScanMap, Scanline* pDstScanMap, long* pMapX, long* pMapY )
+{
+ const long nWidth = rDstBuffer.mnWidth, nHeight = rDstBuffer.mnHeight, nHeight1 = nHeight - 1;
+ const ColorMask& rSrcMask = rSrcBuffer.maColorMask;
+ const ColorMask& rDstMask = rDstBuffer.maColorMask;
+ const BitmapColor* pColBuf = rSrcBuffer.maPalette.ImplGetColorBuffer();
+
+ if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_1BIT_MSB_PAL )
+ {
+ const BitmapColor aCol0( pColBuf[ 0 ] );
+ const BitmapColor aCol1( pColBuf[ 1 ] );
+ long nMapX;
+
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; )
+ {
+ nMapX = pMapX[ nX ];
+ pFncSetPixel( pDstScan, nX++,
+ pSrcScan[ nMapX >> 3 ] & ( 1 << ( 7 - ( nMapX & 7 ) ) ) ? aCol1 : aCol0,
+ rDstMask );
+ }
+
+ DOUBLE_SCANLINES();
+ }
+ }
+ else if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_4BIT_MSN_PAL )
+ {
+ long nMapX;
+
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; )
+ {
+ nMapX = pMapX[ nX ];
+ pFncSetPixel( pDstScan, nX++,
+ pColBuf[ ( pSrcScan[ nMapX >> 1 ] >> ( nMapX & 1 ? 0 : 4 ) ) & 0x0f ],
+ rDstMask );
+ }
+
+ DOUBLE_SCANLINES();
+ }
+ }
+ else if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_8BIT_PAL )
+ {
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pFncSetPixel( pDstScan, nX, pColBuf[ pSrcScan[ pMapX[ nX ] ] ], rDstMask );
+
+ DOUBLE_SCANLINES();
+ }
+ }
+ else
+ {
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pFncSetPixel( pDstScan, nX, pColBuf[ pFncGetPixel( pSrcScan, pMapX[ nX ], rSrcMask ).GetIndex() ], rDstMask );
+
+ DOUBLE_SCANLINES();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+static void ImplTCToTC( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer,
+ FncGetPixel pFncGetPixel, FncSetPixel pFncSetPixel,
+ Scanline* pSrcScanMap, Scanline* pDstScanMap, long* pMapX, long* pMapY )
+{
+ const long nWidth = rDstBuffer.mnWidth, nHeight = rDstBuffer.mnHeight, nHeight1 = nHeight - 1;
+ const ColorMask& rSrcMask = rSrcBuffer.maColorMask;
+ const ColorMask& rDstMask = rDstBuffer.maColorMask;
+
+ if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_24BIT_TC_BGR )
+ {
+ BitmapColor aCol;
+ BYTE* pPixel;
+
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aCol.SetBlue( *( pPixel = ( pSrcScan + pMapX[ nX ] * 3 ) )++ );
+ aCol.SetGreen( *pPixel++ );
+ aCol.SetRed( *pPixel );
+ pFncSetPixel( pDstScan, nX, aCol, rDstMask );
+ }
+
+ DOUBLE_SCANLINES()
+ }
+ }
+ else
+ {
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ pFncSetPixel( pDstScan, nX, pFncGetPixel( pSrcScan, pMapX[ nX ], rSrcMask ), rDstMask );
+
+ DOUBLE_SCANLINES();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+static void ImplTCToPAL( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer,
+ FncGetPixel pFncGetPixel, FncSetPixel pFncSetPixel,
+ Scanline* pSrcScanMap, Scanline* pDstScanMap, long* pMapX, long* pMapY )
+{
+ const long nWidth = rDstBuffer.mnWidth, nHeight = rDstBuffer.mnHeight, nHeight1 = nHeight - 1;
+ const ColorMask& rSrcMask = rSrcBuffer.maColorMask;
+ const ColorMask& rDstMask = rDstBuffer.maColorMask;
+ BitmapPalette aColMap( rSrcBuffer.maPalette.GetEntryCount() );
+ BYTE* pColToPalMap = new BYTE[ TC_TO_PAL_COLORS ];
+ BitmapColor aIndex( 0 );
+
+ for( long nR = 0; nR < 16; nR++ )
+ {
+ for( long nG = 0; nG < 16; nG++ )
+ {
+ for( long nB = 0; nB < 16; nB++ )
+ {
+ BitmapColor aCol( nR << 4, nG << 4, nB << 4 );
+ pColToPalMap[ ImplIndexFromColor( aCol ) ] = (BYTE) rDstBuffer.maPalette.GetBestIndex( aCol );
+ }
+ }
+ }
+
+ for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
+ {
+ Scanline pSrcScan( pSrcScanMap[ nMapY = pMapY[ nActY ] ] ), pDstScan( pDstScanMap[ nActY ] );
+
+ for( long nX = 0L; nX < nWidth; nX++ )
+ {
+ aIndex.SetIndex( pColToPalMap[ ImplIndexFromColor( pFncGetPixel( pSrcScan, pMapX[ nX ], rSrcMask ) ) ] );
+ pFncSetPixel( pDstScan, nX, aIndex, rDstMask );
+ }
+
+ DOUBLE_SCANLINES();
+ }
+
+ delete[] pColToPalMap;
+}
+
+// ---------------------
+// - StretchAndConvert -
+// ---------------------
+
+BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect,
+ ULONG nDstBitmapFormat, BitmapPalette* pDstPal, ColorMask* pDstMask )
+{
+ FncGetPixel pFncGetPixel;
+ FncSetPixel pFncSetPixel;
+ BitmapBuffer* pDstBuffer = new BitmapBuffer;
+ const ULONG nDstScanlineFormat = BMP_SCANLINE_FORMAT( nDstBitmapFormat );
+ const long nSrcX = rTwoRect.mnSrcX, nSrcY = rTwoRect.mnSrcY;
+ const long nSrcDX = rTwoRect.mnSrcWidth, nSrcDY = rTwoRect.mnSrcHeight;
+ const long nDstDX = rTwoRect.mnDestWidth, nDstDY = rTwoRect.mnDestHeight;
+ Scanline* pSrcScan = new Scanline[ rSrcBuffer.mnHeight ];
+ Scanline* pDstScan = new Scanline[ nDstDY ];
+ long* pMapX = new long[ nDstDX ];
+ long* pMapY = new long[ nDstDY ];
+ Scanline pTmpScan;
+ long i, nTmp, nOffset;
+
+ // set function for getting pixels
+ switch( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) )
+ {
+ IMPL_CASE_GET_FORMAT( _1BIT_MSB_PAL );
+ IMPL_CASE_GET_FORMAT( _1BIT_LSB_PAL );
+ IMPL_CASE_GET_FORMAT( _4BIT_MSN_PAL );
+ IMPL_CASE_GET_FORMAT( _4BIT_LSN_PAL );
+ IMPL_CASE_GET_FORMAT( _8BIT_PAL );
+ IMPL_CASE_GET_FORMAT( _8BIT_TC_MASK );
+ IMPL_CASE_GET_FORMAT( _16BIT_TC_MASK );
+ IMPL_CASE_GET_FORMAT( _24BIT_TC_BGR );
+ IMPL_CASE_GET_FORMAT( _24BIT_TC_RGB );
+ IMPL_CASE_GET_FORMAT( _24BIT_TC_MASK );
+ IMPL_CASE_GET_FORMAT( _32BIT_TC_ABGR );
+ IMPL_CASE_GET_FORMAT( _32BIT_TC_ARGB );
+ IMPL_CASE_GET_FORMAT( _32BIT_TC_BGRA );
+ IMPL_CASE_GET_FORMAT( _32BIT_TC_RGBA );
+ IMPL_CASE_GET_FORMAT( _32BIT_TC_MASK );
+
+ default:
+ DBG_ERROR( "unknown read format" );
+ break;
+ }
+
+ // set function for setting pixels
+ switch( nDstScanlineFormat )
+ {
+ IMPL_CASE_SET_FORMAT( _1BIT_MSB_PAL, 1 );
+ IMPL_CASE_SET_FORMAT( _1BIT_LSB_PAL, 1 );
+ IMPL_CASE_SET_FORMAT( _4BIT_MSN_PAL, 1 );
+ IMPL_CASE_SET_FORMAT( _4BIT_LSN_PAL, 4 );
+ IMPL_CASE_SET_FORMAT( _8BIT_PAL, 8 );
+ IMPL_CASE_SET_FORMAT( _8BIT_TC_MASK, 8 );
+ IMPL_CASE_SET_FORMAT( _16BIT_TC_MASK, 16 );
+ IMPL_CASE_SET_FORMAT( _24BIT_TC_BGR, 24 );
+ IMPL_CASE_SET_FORMAT( _24BIT_TC_RGB, 24 );
+ IMPL_CASE_SET_FORMAT( _24BIT_TC_MASK, 24 );
+ IMPL_CASE_SET_FORMAT( _32BIT_TC_ABGR, 32 );
+ IMPL_CASE_SET_FORMAT( _32BIT_TC_ARGB, 32 );
+ IMPL_CASE_SET_FORMAT( _32BIT_TC_BGRA, 32 );
+ IMPL_CASE_SET_FORMAT( _32BIT_TC_RGBA, 32 );
+ IMPL_CASE_SET_FORMAT( _32BIT_TC_MASK, 32 );
+
+ default:
+ DBG_ERROR( "unknown write format" );
+ break;
+ }
+
+ // fill destination buffer
+ pDstBuffer->mnFormat = nDstBitmapFormat;
+ pDstBuffer->mnWidth = nDstDX;
+ pDstBuffer->mnHeight = nDstDY;
+ pDstBuffer->mnScanlineSize = AlignedWidth4Bytes( pDstBuffer->mnBitCount * nDstDX );
+ pDstBuffer->mpBits = new BYTE[ pDstBuffer->mnScanlineSize * nDstDY ];
+ rtl_zeroMemory( pDstBuffer->mpBits, pDstBuffer->mnScanlineSize * nDstDY );
+
+ // do we need a destination palette or color mask?
+ if( ( nDstScanlineFormat == BMP_FORMAT_1BIT_MSB_PAL ) ||
+ ( nDstScanlineFormat == BMP_FORMAT_1BIT_LSB_PAL ) ||
+ ( nDstScanlineFormat == BMP_FORMAT_4BIT_MSN_PAL ) ||
+ ( nDstScanlineFormat == BMP_FORMAT_4BIT_LSN_PAL ) ||
+ ( nDstScanlineFormat == BMP_FORMAT_8BIT_PAL ) )
+ {
+ DBG_ASSERT( pDstPal, "destination buffer requires palette" );
+ pDstBuffer->maPalette = *pDstPal;
+ }
+ else if( ( nDstScanlineFormat == BMP_FORMAT_8BIT_TC_MASK ) ||
+ ( nDstScanlineFormat == BMP_FORMAT_16BIT_TC_MASK ) ||
+ ( nDstScanlineFormat == BMP_FORMAT_24BIT_TC_MASK ) ||
+ ( nDstScanlineFormat == BMP_FORMAT_32BIT_TC_MASK ) )
+ {
+ DBG_ASSERT( pDstMask, "destination buffer requires color mask" );
+ pDstBuffer->maColorMask = *pDstMask;
+ }
+
+ // horizontal mapping table
+ if( nDstDX != nSrcDX )
+ {
+ const double fFactorX = ( nDstDX > 1 ) ? (double) ( nSrcDX - 1 ) / ( nDstDX - 1 ) : 0.0;
+
+ for( i = 0L; i < nDstDX; i++ )
+ pMapX[ i ] = nSrcX + FRound( i * fFactorX );
+ }
+ else
+ {
+ for( i = 0L, nTmp = nSrcX; i < nDstDX; i++ )
+ pMapX[ i ] = nTmp++;
+ }
+
+ // vertical mapping table
+ if( nDstDY != nSrcDY )
+ {
+ const double fFactorY = ( nDstDY > 1 ) ? (double) ( nSrcDY - 1 ) / ( nDstDY - 1 ) : 0.0;
+
+ for( i = 0L; i < nDstDY; i++ )
+ pMapY[ i ] = nSrcY + FRound( i * fFactorY );
+ }
+ else
+ {
+ for( i = 0L, nTmp = nSrcY; i < nDstDY; i++ )
+ pMapY[ i ] = nTmp++;
+ }
+
+ // source scanline buffer
+ if( BMP_SCANLINE_ADJUSTMENT( rSrcBuffer.mnFormat ) == BMP_FORMAT_TOP_DOWN )
+ pTmpScan = rSrcBuffer.mpBits, nOffset = rSrcBuffer.mnScanlineSize;
+ else
+ {
+ pTmpScan = rSrcBuffer.mpBits + ( rSrcBuffer.mnHeight - 1 ) * rSrcBuffer.mnScanlineSize;
+ nOffset = -rSrcBuffer.mnScanlineSize;
+ }
+
+ for( i = 0L; i < rSrcBuffer.mnHeight; i++, pTmpScan += nOffset )
+ pSrcScan[ i ] = pTmpScan;
+
+ // destination scanline buffer
+ if( BMP_SCANLINE_ADJUSTMENT( pDstBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
+ pTmpScan = pDstBuffer->mpBits, nOffset = pDstBuffer->mnScanlineSize;
+ else
+ {
+ pTmpScan = pDstBuffer->mpBits + ( nDstDY - 1 ) * pDstBuffer->mnScanlineSize;
+ nOffset = -pDstBuffer->mnScanlineSize;
+ }
+
+ for( i = 0L; i < nDstDY; i++, pTmpScan += nOffset )
+ pDstScan[ i ] = pTmpScan;
+
+ // do buffer scaling and conversion
+ if( rSrcBuffer.mnBitCount <= 8 && pDstBuffer->mnBitCount <= 8 )
+ {
+ ImplPALToPAL( rSrcBuffer, *pDstBuffer, pFncGetPixel, pFncSetPixel,
+ pSrcScan, pDstScan, pMapX, pMapY );
+ }
+ else if( rSrcBuffer.mnBitCount <= 8 && pDstBuffer->mnBitCount > 8 )
+ {
+ ImplPALToTC( rSrcBuffer, *pDstBuffer, pFncGetPixel, pFncSetPixel,
+ pSrcScan, pDstScan, pMapX, pMapY );
+ }
+ else if( rSrcBuffer.mnBitCount > 8 && pDstBuffer->mnBitCount > 8 )
+ {
+ ImplTCToTC( rSrcBuffer, *pDstBuffer, pFncGetPixel, pFncSetPixel,
+ pSrcScan, pDstScan, pMapX, pMapY );
+ }
+ else
+ {
+ ImplTCToPAL( rSrcBuffer, *pDstBuffer, pFncGetPixel, pFncSetPixel,
+ pSrcScan, pDstScan, pMapX, pMapY );
+ }
+
+ // cleanup
+ delete[] pSrcScan;
+ delete[] pDstScan;
+ delete[] pMapX;
+ delete[] pMapY;
+
+ return pDstBuffer;
+}
diff --git a/vcl/source/gdi/svcompat.cxx b/vcl/source/gdi/svcompat.cxx
new file mode 100644
index 000000000000..dc037185e064
--- /dev/null
+++ b/vcl/source/gdi/svcompat.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * $RCSfile: svcompat.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_COMPAT_CXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+
+#ifndef _SV_SVCOMPAT_HXX
+#include <svcompat.hxx>
+#endif
+
+// --------------
+// - ImplCompat -
+// --------------
+
+ImplCompat::ImplCompat( SvStream& rStm, USHORT nStreamMode, USHORT nVersion ) :
+ mpRWStm ( &rStm ),
+ mnStmMode ( nStreamMode ),
+ mnVersion ( nVersion )
+{
+ if( !mpRWStm->GetError() )
+ {
+ if( STREAM_WRITE == mnStmMode )
+ {
+ *mpRWStm << mnVersion;
+ mnTotalSize = ( mnCompatPos = mpRWStm->Tell() ) + 4UL;
+ mpRWStm->SeekRel( 4L );
+ }
+ else
+ {
+ *mpRWStm >> mnVersion;
+ *mpRWStm >> mnTotalSize;
+ mnCompatPos = mpRWStm->Tell();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+ImplCompat::~ImplCompat()
+{
+ if( STREAM_WRITE == mnStmMode )
+ {
+ const UINT32 nEndPos = mpRWStm->Tell();
+
+ mpRWStm->Seek( mnCompatPos );
+ *mpRWStm << ( nEndPos - mnTotalSize );
+ mpRWStm->Seek( nEndPos );
+ }
+ else
+ {
+ const UINT32 nReadSize = mpRWStm->Tell() - mnCompatPos;
+
+ if( mnTotalSize > nReadSize )
+ mpRWStm->SeekRel( mnTotalSize - nReadSize );
+ }
+}
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
new file mode 100644
index 000000000000..ff8c7268c9fe
--- /dev/null
+++ b/vcl/source/gdi/virdev.cxx
@@ -0,0 +1,442 @@
+/*************************************************************************
+ *
+ * $RCSfile: virdev.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_VIRDEV_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+
+using namespace ::com::sun::star::uno;
+
+// appserver
+#ifdef REMOTE_APPSERVER
+#ifndef _SV_RMOUTDEV_HXX
+#include <rmoutdev.hxx>
+#endif
+#ifndef _SV_RMVIRDEV_HXX
+#include <rmvirdev.hxx>
+#endif
+#ifndef _VCL_RMCACHE_HXX_
+#include <rmcache.hxx>
+#endif
+#endif
+
+// =======================================================================
+
+// interface cache
+#ifdef REMOTE_APPSERVER
+
+static ::vcl::InterfacePairCache< ::com::sun::star::portal::client::XRmVirtualDevice, ::com::sun::star::portal::client::XRmOutputDevice >* pRemoteVirdevCache = NULL;
+
+typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::portal::client::XRmVirtualDevice >, ::com::sun::star::uno::Reference< ::com::sun::star::portal::client::XRmOutputDevice > > virdevInterfacePair;
+
+void eraseRemoteVirdevCache()
+{
+ if( pRemoteVirdevCache )
+ {
+ delete pRemoteVirdevCache;
+ pRemoteVirdevCache = NULL;
+ }
+}
+
+#endif
+
+// =======================================================================
+
+void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
+ long nDX, long nDY, USHORT nBitCount )
+{
+ DBG_ASSERT( nBitCount <= 1,
+ "VirtualDevice::VirtualDevice(): Only 0 or 1 is for BitCount allowed" );
+
+ if ( nDX < 1 )
+ nDX = 1;
+
+ if ( nDY < 1 )
+ nDY = 1;
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( !pOutDev )
+ pOutDev = ImplGetDefaultWindow();
+
+#ifndef REMOTE_APPSERVER
+ SalGraphics* pGraphics;
+ if ( !pOutDev->mpGraphics )
+ ((OutputDevice*)pOutDev)->ImplGetGraphics();
+ pGraphics = pOutDev->mpGraphics;
+ if ( pGraphics )
+ mpVirDev = pSVData->mpDefInst->CreateVirtualDevice( pGraphics, nDX, nDY, nBitCount );
+ else
+ mpVirDev = NULL;
+ if ( !mpVirDev )
+ GetpApp()->Exception( EXC_SYSOBJNOTCREATED );
+#else
+ if( ! pRemoteVirdevCache )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ pRemoteVirdevCache = new ::vcl::InterfacePairCache< ::com::sun::star::portal::client::XRmVirtualDevice, ::com::sun::star::portal::client::XRmOutputDevice >(
+ pSVData->mxMultiFactory,
+ ::rtl::OUString::createFromAscii( "OfficeVirtualDevice.stardiv.de" ),
+ 20, 10, 40 );
+ }
+
+ if( pOutDev->GetOutDevType() == OUTDEV_PRINTER || ! mpVirDev )
+ {
+ virdevInterfacePair aPair = pRemoteVirdevCache->takeInterface();
+ if( aPair.first.is() && aPair.second.is() )
+ {
+ if( ! mpVirDev )
+ mpVirDev = new RmVirtualDevice;
+ mpVirDev->SetInterface( aPair.first );
+ mpVirDev->Create( (ULONG) pOutDev, nDX, nDY, nBitCount );
+
+ if( ! mpGraphics )
+ mpGraphics = new ImplServerGraphics();
+ mpGraphics->SetInterface( aPair.second );
+ }
+ }
+ else
+ {
+ // this was done in ImpGetServerGraphics before
+ // and is now here because of interface caching
+ if( mpGraphics && mpGraphics->GetInterface().is() )
+ {
+ try
+ {
+ mpGraphics->GetInterface()->SetFillColor( mpGraphics->maFillColor.GetColor() );
+ }
+ catch (...)
+ {
+ if( mpGraphics )
+ delete mpGraphics, mpGraphics = NULL;
+
+ if( mpVirDev )
+ {
+ virdevInterfacePair aPair = pRemoteVirdevCache->takeInterface();
+ if( aPair.first.is() && aPair.second.is() )
+ {
+ mpVirDev->SetInterface( aPair.first );
+ mpVirDev->Create( (ULONG)NULL, mnOutWidth, mnOutHeight, mnBitCount );
+ mpGraphics = new ImplServerGraphics();
+ mpGraphics->SetInterface( aPair.second );
+ }
+ else
+ mpVirDev->SetInterface( REF( NMSP_CLIENT::XRmVirtualDevice )() );
+ }
+ }
+ }
+ ImplGetServerGraphics( TRUE );
+ }
+#endif
+
+ mnBitCount = ( nBitCount ? nBitCount : pOutDev->GetBitCount() );
+ mnOutWidth = nDX;
+ mnOutHeight = nDY;
+ mbScreenComp = TRUE;
+
+ if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
+ mbScreenComp = FALSE;
+ else if ( pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
+ mbScreenComp = ((VirtualDevice*)pOutDev)->mbScreenComp;
+
+ meOutDevType = OUTDEV_VIRDEV;
+ mbDevOutput = TRUE;
+ mpFontList = pSVData->maGDIData.mpScreenFontList;
+ mpFontCache = pSVData->maGDIData.mpScreenFontCache;
+ mnDPIX = pOutDev->mnDPIX;
+ mnDPIY = pOutDev->mnDPIY;
+ maFont = pOutDev->maFont;
+
+ // Virtuelle Devices haben defaultmaessig einen weissen Hintergrund
+ SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+ Erase();
+
+ // VirDev in Liste eintragen
+ mpNext = pSVData->maGDIData.mpFirstVirDev;
+ mpPrev = NULL;
+ if ( mpNext )
+ mpNext->mpPrev = this;
+ else
+ pSVData->maGDIData.mpLastVirDev = this;
+ pSVData->maGDIData.mpFirstVirDev = this;
+}
+
+// -----------------------------------------------------------------------
+
+VirtualDevice::VirtualDevice( USHORT nBitCount )
+ : mpVirDev( NULL )
+{
+ DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
+
+ ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount );
+}
+
+// -----------------------------------------------------------------------
+
+VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, USHORT nBitCount )
+ : mpVirDev( NULL )
+{
+ DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
+
+ ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
+}
+
+// -----------------------------------------------------------------------
+
+VirtualDevice::~VirtualDevice()
+{
+ DBG_TRACE( "VirtualDevice::~VirtualDevice()" );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+
+ if ( mpVirDev )
+ pSVData->mpDefInst->DestroyVirtualDevice( mpVirDev );
+#else
+ if ( pRemoteVirdevCache && mpVirDev && mpGraphics )
+ {
+ virdevInterfacePair aPair( mpVirDev->GetInterface(), mpGraphics->GetInterface() );
+ aPair.first->Create( 0, 0, 0, 0 );
+ pRemoteVirdevCache->putInterface( aPair );
+ }
+
+ mpGraphics->SetInterface( REF( NMSP_CLIENT::XRmOutputDevice )() );
+ ImplReleaseServerGraphics();
+ delete mpVirDev;
+ delete mpGraphics;
+#endif
+
+ // VirDev aus der Liste eintragen
+ if( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ pSVData->maGDIData.mpFirstVirDev = mpNext;
+
+ if( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ pSVData->maGDIData.mpLastVirDev = mpPrev;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL VirtualDevice::SetOutputSizePixel( const Size& rNewSize, BOOL bErase )
+{
+ DBG_TRACE3( "VirtualDevice::SetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase );
+
+ if ( !mpVirDev )
+ return FALSE;
+ else if ( rNewSize == GetOutputSizePixel() )
+ {
+ if ( bErase )
+ Erase();
+ return TRUE;
+ }
+
+#ifdef REMOTE_APPSERVER
+ long nOldWidth = mnOutWidth, nOldHeight = mnOutHeight;
+
+ try
+ {
+ mnOutWidth = rNewSize.Width();
+ mnOutHeight = rNewSize.Height();
+ mpVirDev->ResizeOutputSizePixel( mnOutWidth, mnOutHeight );
+ }
+ catch (...)
+ {
+ delete mpVirDev, mpVirDev = NULL;
+ ImplInitVirDev( NULL, mnOutWidth, mnOutHeight, mnBitCount );
+ }
+
+ if( bErase )
+ Erase();
+ else
+ {
+ if ( nOldWidth < mnOutWidth )
+ Erase( Rectangle( Point( nOldWidth, 0 ), Size( mnOutWidth-nOldWidth, Max( nOldHeight, mnOutHeight ) ) ) );
+ if ( nOldHeight< mnOutHeight )
+ Erase( Rectangle( Point( 0, nOldHeight ), Size( Max( nOldWidth, mnOutWidth ), mnOutHeight-nOldHeight ) ) );
+ }
+
+ return TRUE;
+#else
+ BOOL bRet;
+ long nNewWidth = rNewSize.Width(), nNewHeight = rNewSize.Height();
+
+ if ( nNewWidth < 1 )
+ nNewWidth = 1;
+
+ if ( nNewHeight < 1 )
+ nNewHeight = 1;
+
+ if ( bErase )
+ {
+ bRet = mpVirDev->SetSize( nNewWidth, nNewHeight );
+
+ if ( bRet )
+ {
+ mnOutWidth = rNewSize.Width();
+ mnOutHeight = rNewSize.Height();
+ Erase();
+ }
+ }
+ else
+ {
+ SalVirtualDevice* pNewVirDev;
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return FALSE;
+ }
+
+ pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice( mpGraphics, nNewWidth, nNewHeight, mnBitCount );
+ if ( pNewVirDev )
+ {
+ SalGraphics* pGraphics = pNewVirDev->GetGraphics();
+ if ( pGraphics )
+ {
+ SalTwoRect aPosAry;
+ long nWidth;
+ long nHeight;
+ if ( mnOutWidth < nNewWidth )
+ nWidth = mnOutWidth;
+ else
+ nWidth = nNewWidth;
+ if ( mnOutHeight < nNewHeight )
+ nHeight = mnOutHeight;
+ else
+ nHeight = nNewHeight;
+ aPosAry.mnSrcX = 0;
+ aPosAry.mnSrcY = 0;
+ aPosAry.mnSrcWidth = nWidth;
+ aPosAry.mnSrcHeight = nHeight;
+ aPosAry.mnDestX = 0;
+ aPosAry.mnDestY = 0;
+ aPosAry.mnDestWidth = nWidth;
+ aPosAry.mnDestHeight = nHeight;
+
+ pGraphics->CopyBits( &aPosAry, mpGraphics );
+ pNewVirDev->ReleaseGraphics( pGraphics );
+ ImplReleaseGraphics();
+ pSVData->mpDefInst->DestroyVirtualDevice( mpVirDev );
+ mpVirDev = pNewVirDev;
+ mnOutWidth = rNewSize.Width();
+ mnOutHeight = rNewSize.Height();
+ bRet = TRUE;
+ }
+ else
+ {
+ bRet = FALSE;
+ pSVData->mpDefInst->DestroyVirtualDevice( pNewVirDev );
+ }
+ }
+ else
+ bRet = FALSE;
+ }
+
+ return bRet;
+#endif
+}
+
diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
new file mode 100644
index 000000000000..64eb82b23585
--- /dev/null
+++ b/vcl/source/gdi/wall.cxx
@@ -0,0 +1,616 @@
+/*************************************************************************
+ *
+ * $RCSfile: wall.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_WALL_CXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VCOMPAT_HXX
+#include <tools/vcompat.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_BITMAPEX_HXX
+#include <bitmapex.hxx>
+#endif
+#ifndef _SV_GRADIENT_HXX
+#include <gradient.hxx>
+#endif
+#ifndef _SV_WALL_HXX
+#include <wall.hxx>
+#endif
+
+// =======================================================================
+
+DBG_NAME( Wallpaper );
+
+// -----------------------------------------------------------------------
+
+ImplWallpaper::ImplWallpaper() :
+ maColor( COL_TRANSPARENT )
+{
+ mnRefCount = 1;
+ mpBitmap = NULL;
+ mpCache = NULL;
+ mpGradient = NULL;
+ mpRect = NULL;
+ meStyle = WALLPAPER_NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplWallpaper::ImplWallpaper( const ImplWallpaper& rImplWallpaper ) :
+ maColor( rImplWallpaper.maColor )
+{
+ mnRefCount = 1;
+ meStyle = rImplWallpaper.meStyle;
+
+ if ( rImplWallpaper.mpBitmap )
+ mpBitmap = new BitmapEx( *rImplWallpaper.mpBitmap );
+ else
+ mpBitmap = NULL;
+ if( rImplWallpaper.mpCache )
+ mpCache = new BitmapEx( *rImplWallpaper.mpCache );
+ else
+ mpCache = NULL;
+ if ( rImplWallpaper.mpGradient )
+ mpGradient = new Gradient( *rImplWallpaper.mpGradient );
+ else
+ mpGradient = NULL;
+ if ( rImplWallpaper.mpRect )
+ mpRect = new Rectangle( *rImplWallpaper.mpRect );
+ else
+ mpRect = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplWallpaper::~ImplWallpaper()
+{
+ delete mpBitmap;
+ delete mpCache;
+ delete mpGradient;
+ delete mpRect;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWallpaper::ImplSetCachedBitmap( BitmapEx& rBmp )
+{
+ if( !mpCache )
+ mpCache = new BitmapEx( rBmp );
+ else
+ *mpCache = rBmp;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWallpaper::ImplReleaseCachedBitmap()
+{
+ delete mpCache;
+ mpCache = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, ImplWallpaper& rImplWallpaper )
+{
+ VersionCompat aCompat( rIStm, STREAM_READ );
+ UINT16 nTmp16;
+
+ delete rImplWallpaper.mpRect;
+ rImplWallpaper.mpRect = NULL;
+
+ delete rImplWallpaper.mpGradient;
+ rImplWallpaper.mpGradient = NULL;
+
+ delete rImplWallpaper.mpBitmap;
+ rImplWallpaper.mpBitmap = NULL;
+
+ // version 1
+ rIStm >> rImplWallpaper.maColor;
+ rIStm >> nTmp16; rImplWallpaper.meStyle = (WallpaperStyle) nTmp16;
+
+ // version 2
+ if( aCompat.GetVersion() >= 2 )
+ {
+ BOOL bRect, bGrad, bBmp, bDummy;
+
+ rIStm >> bRect >> bGrad >> bBmp >> bDummy >> bDummy >> bDummy;
+
+ if( bRect )
+ {
+ rImplWallpaper.mpRect = new Rectangle;
+ rIStm >> *rImplWallpaper.mpRect;
+ }
+
+ if( bGrad )
+ {
+ rImplWallpaper.mpGradient = new Gradient;
+ rIStm >> *rImplWallpaper.mpGradient;
+ }
+
+ if( bBmp )
+ {
+ rImplWallpaper.mpBitmap = new BitmapEx;
+ rIStm >> *rImplWallpaper.mpBitmap;
+ }
+
+ // version 3 (new color format)
+ if( aCompat.GetVersion() >= 3 )
+ {
+ rImplWallpaper.maColor.Read( rIStm, TRUE );
+ }
+ }
+
+ return rIStm;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const ImplWallpaper& rImplWallpaper )
+{
+ VersionCompat aCompat( rOStm, STREAM_WRITE, 3 );
+ BOOL bRect = ( rImplWallpaper.mpRect != NULL );
+ BOOL bGrad = ( rImplWallpaper.mpGradient != NULL );
+ BOOL bBmp = ( rImplWallpaper.mpBitmap != NULL );
+ BOOL bDummy = FALSE;
+
+ // version 1
+ rOStm << rImplWallpaper.maColor << (UINT16) rImplWallpaper.meStyle;
+
+ // version 2
+ rOStm << bRect << bGrad << bBmp << bDummy << bDummy << bDummy;
+
+ if( bRect )
+ rOStm << *rImplWallpaper.mpRect;
+
+ if( bGrad )
+ rOStm << *rImplWallpaper.mpGradient;
+
+ if( bBmp )
+ rOStm << *rImplWallpaper.mpBitmap;
+
+ // version 3 (new color format)
+ ( (Color&) rImplWallpaper.maColor ).Write( rOStm, TRUE );
+
+ return rOStm;
+}
+
+// -----------------------------------------------------------------------
+
+inline void Wallpaper::ImplMakeUnique( BOOL bReleaseCache )
+{
+ // Falls noch andere Referenzen bestehen, dann kopieren
+ if ( mpImplWallpaper->mnRefCount != 1 )
+ {
+ if ( mpImplWallpaper->mnRefCount )
+ mpImplWallpaper->mnRefCount--;
+ mpImplWallpaper = new ImplWallpaper( *(mpImplWallpaper) );
+ }
+
+ if( bReleaseCache )
+ mpImplWallpaper->ImplReleaseCachedBitmap();
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper::Wallpaper()
+{
+ DBG_CTOR( Wallpaper, NULL );
+
+#ifdef WIN
+ static ImplWallpaper _near aStaticImplWallpaper;
+#else
+ static ImplWallpaper aStaticImplWallpaper;
+#endif
+
+ aStaticImplWallpaper.mnRefCount = 0;
+ mpImplWallpaper = &aStaticImplWallpaper;
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper::Wallpaper( const Wallpaper& rWallpaper )
+{
+ DBG_CTOR( Wallpaper, NULL );
+ DBG_CHKOBJ( &rWallpaper, Wallpaper, NULL );
+ DBG_ASSERT( rWallpaper.mpImplWallpaper->mnRefCount < 0xFFFE, "Wallpaper: RefCount overflow" );
+
+ // Instance Daten uebernehmen und Referenzcounter erhoehen
+ mpImplWallpaper = rWallpaper.mpImplWallpaper;
+ // RefCount == 0 fuer statische Objekte
+ if ( mpImplWallpaper->mnRefCount )
+ mpImplWallpaper->mnRefCount++;
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper::Wallpaper( const Color& rColor )
+{
+ DBG_CTOR( Wallpaper, NULL );
+
+ mpImplWallpaper = new ImplWallpaper;
+ mpImplWallpaper->maColor = rColor;
+ mpImplWallpaper->meStyle = WALLPAPER_TILE;
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper::Wallpaper( const BitmapEx& rBmpEx )
+{
+ DBG_CTOR( Wallpaper, NULL );
+
+ mpImplWallpaper = new ImplWallpaper;
+ mpImplWallpaper->mpBitmap = new BitmapEx( rBmpEx );
+ mpImplWallpaper->meStyle = WALLPAPER_TILE;
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper::Wallpaper( const Gradient& rGradient )
+{
+ DBG_CTOR( Wallpaper, NULL );
+
+ mpImplWallpaper = new ImplWallpaper;
+ mpImplWallpaper->mpGradient = new Gradient( rGradient );
+ mpImplWallpaper->meStyle = WALLPAPER_TILE;
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper::~Wallpaper()
+{
+ DBG_DTOR( Wallpaper, NULL );
+
+ // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
+ // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ if ( mpImplWallpaper->mnRefCount )
+ {
+ if ( mpImplWallpaper->mnRefCount == 1 )
+ delete mpImplWallpaper;
+ else
+ mpImplWallpaper->mnRefCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetColor( const Color& rColor )
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ ImplMakeUnique();
+ mpImplWallpaper->maColor = rColor;
+
+ if( WALLPAPER_NULL == mpImplWallpaper->meStyle )
+ mpImplWallpaper->meStyle = WALLPAPER_TILE;
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetStyle( WallpaperStyle eStyle )
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ ImplMakeUnique( FALSE );
+ mpImplWallpaper->meStyle = eStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetBitmap( const BitmapEx& rBitmap )
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ if ( !rBitmap )
+ {
+ if ( mpImplWallpaper->mpBitmap )
+ {
+ ImplMakeUnique();
+ delete mpImplWallpaper->mpBitmap;
+ mpImplWallpaper->mpBitmap = NULL;
+ }
+ }
+ else
+ {
+ ImplMakeUnique();
+ if ( mpImplWallpaper->mpBitmap )
+ *(mpImplWallpaper->mpBitmap) = rBitmap;
+ else
+ mpImplWallpaper->mpBitmap = new BitmapEx( rBitmap );
+ }
+
+ if( WALLPAPER_NULL == mpImplWallpaper->meStyle )
+ mpImplWallpaper->meStyle = WALLPAPER_TILE;
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetBitmap()
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ if ( mpImplWallpaper->mpBitmap )
+ {
+ ImplMakeUnique();
+ delete mpImplWallpaper->mpBitmap;
+ mpImplWallpaper->mpBitmap = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BitmapEx Wallpaper::GetBitmap() const
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ if ( mpImplWallpaper->mpBitmap )
+ return *(mpImplWallpaper->mpBitmap);
+ else
+ {
+ BitmapEx aBmp;
+ return aBmp;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetGradient( const Gradient& rGradient )
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ ImplMakeUnique();
+
+ if ( mpImplWallpaper->mpGradient )
+ *(mpImplWallpaper->mpGradient) = rGradient;
+ else
+ mpImplWallpaper->mpGradient = new Gradient( rGradient );
+
+ if( WALLPAPER_NULL == mpImplWallpaper->meStyle )
+ mpImplWallpaper->meStyle = WALLPAPER_TILE;
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetGradient()
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ if ( mpImplWallpaper->mpGradient )
+ {
+ ImplMakeUnique();
+ delete mpImplWallpaper->mpGradient;
+ mpImplWallpaper->mpGradient = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Gradient Wallpaper::GetGradient() const
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ if ( mpImplWallpaper->mpGradient )
+ return *(mpImplWallpaper->mpGradient);
+ else
+ {
+ Gradient aGradient;
+ return aGradient;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetRect( const Rectangle& rRect )
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ ImplMakeUnique( FALSE );
+
+ if ( rRect.IsEmpty() )
+ {
+ if ( mpImplWallpaper->mpRect )
+ {
+ delete mpImplWallpaper->mpRect;
+ mpImplWallpaper->mpRect = NULL;
+ }
+ }
+ else
+ {
+ if ( mpImplWallpaper->mpRect )
+ *(mpImplWallpaper->mpRect) = rRect;
+ else
+ mpImplWallpaper->mpRect = new Rectangle( rRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Wallpaper::SetRect()
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ if ( mpImplWallpaper->mpRect )
+ {
+ ImplMakeUnique( FALSE );
+ delete mpImplWallpaper->mpRect;
+ mpImplWallpaper->mpRect = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle Wallpaper::GetRect() const
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+
+ if ( mpImplWallpaper->mpRect )
+ return *(mpImplWallpaper->mpRect);
+ else
+ {
+ Rectangle aRect;
+ return aRect;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Wallpaper::IsFixed() const
+{
+ if ( mpImplWallpaper->meStyle == WALLPAPER_NULL )
+ return FALSE;
+ else
+ return (!mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Wallpaper::IsScrollable() const
+{
+ if ( mpImplWallpaper->meStyle == WALLPAPER_NULL )
+ return FALSE;
+ else if ( !mpImplWallpaper->mpBitmap && !mpImplWallpaper->mpGradient )
+ return TRUE;
+ else if ( mpImplWallpaper->mpBitmap )
+ return (mpImplWallpaper->meStyle == WALLPAPER_TILE);
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper& Wallpaper::operator=( const Wallpaper& rWallpaper )
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+ DBG_CHKOBJ( &rWallpaper, Wallpaper, NULL );
+ DBG_ASSERT( rWallpaper.mpImplWallpaper->mnRefCount < 0xFFFE, "Wallpaper: RefCount overflow" );
+
+ // Zuerst Referenzcounter erhoehen, damit man sich selbst zuweisen kann
+ if ( rWallpaper.mpImplWallpaper->mnRefCount )
+ rWallpaper.mpImplWallpaper->mnRefCount++;
+
+ // Wenn es keine statischen ImpDaten sind, dann loeschen, wenn es
+ // die letzte Referenz ist, sonst Referenzcounter decrementieren
+ if ( mpImplWallpaper->mnRefCount )
+ {
+ if ( mpImplWallpaper->mnRefCount == 1 )
+ delete mpImplWallpaper;
+ else
+ mpImplWallpaper->mnRefCount--;
+ }
+
+ mpImplWallpaper = rWallpaper.mpImplWallpaper;
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Wallpaper::operator==( const Wallpaper& rWallpaper ) const
+{
+ DBG_CHKTHIS( Wallpaper, NULL );
+ DBG_CHKOBJ( &rWallpaper, Wallpaper, NULL );
+
+ if ( mpImplWallpaper == rWallpaper.mpImplWallpaper )
+ return TRUE;
+
+ if ( ( mpImplWallpaper->meStyle != rWallpaper.mpImplWallpaper->meStyle ) ||
+ ( mpImplWallpaper->maColor != rWallpaper.mpImplWallpaper->maColor ) )
+ return FALSE;
+
+ if ( mpImplWallpaper->mpRect != rWallpaper.mpImplWallpaper->mpRect
+ && ( !mpImplWallpaper->mpRect
+ || !rWallpaper.mpImplWallpaper->mpRect
+ || *(mpImplWallpaper->mpRect) != *(rWallpaper.mpImplWallpaper->mpRect) ) )
+ return FALSE;
+
+ if ( mpImplWallpaper->mpBitmap != rWallpaper.mpImplWallpaper->mpBitmap
+ && ( !mpImplWallpaper->mpBitmap
+ || !rWallpaper.mpImplWallpaper->mpBitmap
+ || *(mpImplWallpaper->mpBitmap) != *(rWallpaper.mpImplWallpaper->mpBitmap) ) )
+ return FALSE;
+
+ if ( mpImplWallpaper->mpGradient != rWallpaper.mpImplWallpaper->mpGradient
+ && ( !mpImplWallpaper->mpGradient
+ || !rWallpaper.mpImplWallpaper->mpGradient
+ || *(mpImplWallpaper->mpGradient) != *(rWallpaper.mpImplWallpaper->mpGradient) ) )
+ return FALSE;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator>>( SvStream& rIStm, Wallpaper& rWallpaper )
+{
+ rWallpaper.ImplMakeUnique();
+ return( rIStm >> *rWallpaper.mpImplWallpaper );
+}
+
+// -----------------------------------------------------------------------
+
+SvStream& operator<<( SvStream& rOStm, const Wallpaper& rWallpaper )
+{
+ return( rOStm << *rWallpaper.mpImplWallpaper );
+}
diff --git a/vcl/source/helper/evntpost.cxx b/vcl/source/helper/evntpost.cxx
new file mode 100644
index 000000000000..b19c5b190a1a
--- /dev/null
+++ b/vcl/source/helper/evntpost.cxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * $RCSfile: evntpost.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#include "evntpost.hxx"
+#include "svapp.hxx"
+
+namespace vcl
+{
+
+EventPoster::EventPoster( const Link& rLink )
+ : m_aLink(rLink)
+ , m_nId(0)
+{
+}
+
+EventPoster::~EventPoster()
+{
+ if ( m_nId )
+ GetpApp()->RemoveUserEvent( m_nId );
+}
+
+void EventPoster::Post( UserEvent* pEvent )
+
+{
+ m_nId = GetpApp()->PostUserEvent( ( LINK( this, EventPoster, DoEvent_Impl ) ), pEvent );
+}
+
+IMPL_LINK_INLINE_START( EventPoster, DoEvent_Impl, UserEvent*, pEvent )
+{
+ m_nId = 0;
+ m_aLink.Call( pEvent );
+ return 0;
+}
+IMPL_LINK_INLINE_END( EventPoster, DoEvent_Impl, UserEvent*, pEvent )
+
+};
diff --git a/vcl/source/helper/makefile.mk b/vcl/source/helper/makefile.mk
new file mode 100644
index 000000000000..eeec5a8f0a1d
--- /dev/null
+++ b/vcl/source/helper/makefile.mk
@@ -0,0 +1,100 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+ENABLE_EXCEPTIONS=TRUE
+PRJNAME=vcl
+TARGET=helper
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/sunowrap.obj \
+ $(SLO)$/atom.obj \
+ $(SLO)$/threadex.obj
+
+.IF "$(GUI)" == "UNX"
+SLOFILES+=\
+ $(SLO)$/ppdparser.obj \
+ $(SLO)$/strhelper.obj
+.ENDIF
+
+# NETBSD: somewhere we have to instantiate the static data members.
+# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work.
+# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX"
+SLOFILES+=$(SLO)$/staticmbhelper.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx
new file mode 100644
index 000000000000..d33be4f6f355
--- /dev/null
+++ b/vcl/source/helper/threadex.cxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * $RCSfile: threadex.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <threadex.hxx>
+#include <svapp.hxx>
+
+using namespace vcl;
+
+ThreadExecutor::ThreadExecutor()
+{
+ m_aFinish = osl_createCondition();
+ m_aThread = NULL;
+}
+
+ThreadExecutor::~ThreadExecutor()
+{
+ osl_destroyCondition( m_aFinish );
+ if( m_aThread )
+ osl_freeThreadHandle( m_aThread );
+}
+
+void ThreadExecutor::worker( void* pInstance )
+{
+ ThreadExecutor* pThis = ((ThreadExecutor*)pInstance);
+ pThis->m_nReturn = pThis->doIt();
+ osl_setCondition( pThis->m_aFinish );
+}
+
+long ThreadExecutor::execute()
+{
+ osl_resetCondition( m_aFinish );
+ if( m_aThread )
+ osl_freeThreadHandle( m_aThread ), m_aThread = NULL;
+ m_aThread = osl_createThread( worker, this );
+ while( ! osl_checkCondition( m_aFinish ) )
+ Application::Reschedule();
+ return m_nReturn;
+}
+
+
+SolarThreadExecutor::SolarThreadExecutor()
+{
+ m_aFinish = osl_createCondition();
+}
+
+SolarThreadExecutor::~SolarThreadExecutor()
+{
+ osl_destroyCondition( m_aFinish );
+}
+
+IMPL_LINK( SolarThreadExecutor, worker, void*, pDummy )
+{
+ m_nReturn = doIt();
+ osl_setCondition( m_aFinish );
+ return m_nReturn;
+}
+
+long SolarThreadExecutor::execute()
+{
+ if( ::vos::OThread::getCurrentIdentifier() == Application::GetMainThreadIdentifier() )
+ {
+ m_nReturn = doIt();
+ osl_setCondition( m_aFinish );
+ }
+ else
+ {
+ osl_resetCondition( m_aFinish );
+ Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) );
+ osl_waitCondition( m_aFinish, NULL );
+ }
+ return m_nReturn;
+}
diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src
new file mode 100644
index 000000000000..51f9d9df8bd0
--- /dev/null
+++ b/vcl/source/src/btntext.src
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * $RCSfile: btntext.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BTNTEXT_SRC
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+
+String SV_BUTTONTEXT_OK
+{
+ Text = "OK";
+ Text [ English ] = "OK";
+ TEXT[ italian ] = "OK";
+ TEXT[ portuguese_brazilian ] = "OK";
+ TEXT[ portuguese ] = "OK";
+ TEXT[ danish ] = "OK";
+ TEXT[ french ] = "OK";
+ TEXT[ swedish ] = "OK";
+ TEXT[ dutch ] = "OK";
+ TEXT[ spanish ] = "Aceptar";
+ TEXT[ english_us ] = "OK";
+ TEXT[ russian ] = "OK";
+ TEXT[ polish ] = "OK";
+ TEXT[ japanese ] = "OK";
+ TEXT[ chinese_simplified ] = "È·¶¨";
+ TEXT[ chinese_traditional ] = "½T©w";
+ TEXT[ arabic ] = "ÍÓäÇð";
+ TEXT[ dutch ] = "OK";
+ TEXT[ chinese_simplified ] = "È·¶¨";
+ TEXT[ greek ] = "OK";
+ TEXT[ korean ] = "È®ÀÎ";
+ TEXT[ turkish ] = "Tamam";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_BUTTONTEXT_CANCEL
+{
+ Text = "Abbrechen" ;
+ Text [ English ] = "Cancel" ;
+ TEXT[ italian ] = "Annulla";
+ TEXT[ portuguese_brazilian ] = "Cancelar";
+ TEXT[ portuguese ] = "Cancelar";
+ TEXT[ danish ] = "Annuller";
+ TEXT[ french ] = "Annuler";
+ TEXT[ swedish ] = "Avbryt";
+ TEXT[ dutch ] = "Annuleren";
+ TEXT[ spanish ] = "Cancelar";
+ TEXT[ english_us ] = "Cancel";
+ TEXT[ russian ] = "Îòìåíà";
+ TEXT[ polish ] = "Anuluj";
+ TEXT[ japanese ] = "·¬Ý¾Ù";
+ TEXT[ chinese_simplified ] = "È¡Ïû";
+ TEXT[ chinese_traditional ] = "¨ú®ø";
+ TEXT[ arabic ] = "ÅáÛÇÁ ÇáÃãÑ";
+ TEXT[ dutch ] = "Annuleren";
+ TEXT[ chinese_simplified ] = "È¡Ïû";
+ TEXT[ greek ] = "Áêýñùóç";
+ TEXT[ korean ] = "Ãë¼Ò";
+ TEXT[ turkish ] = "Ýptal";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_BUTTONTEXT_YES
+{
+ Text = "~Ja";
+ Text [ English ] = "~Yes";
+ TEXT[ italian ] = "Sì";
+ TEXT[ portuguese_brazilian ] = "~Sim";
+ TEXT[ portuguese ] = "~Sim";
+ TEXT[ danish ] = "~Ja";
+ TEXT[ french ] = "~Oui";
+ TEXT[ swedish ] = "~Ja";
+ TEXT[ dutch ] = "~Ja";
+ TEXT[ spanish ] = "~Sí";
+ TEXT[ english_us ] = "~Yes";
+ TEXT[ russian ] = "Äà";
+ TEXT[ polish ] = "~Tak";
+ TEXT[ japanese ] = "‚Í‚¢(~Y)";
+ TEXT[ chinese_simplified ] = "ÊÇ(~Y)";
+ TEXT[ chinese_traditional ] = "¬O(~Y)";
+ TEXT[ arabic ] = "äÚã";
+ TEXT[ dutch ] = "~Ja";
+ TEXT[ chinese_simplified ] = "ÊÇ(~Y)";
+ TEXT[ greek ] = "Íáé";
+ TEXT[ korean ] = "³×(~Y)";
+ TEXT[ turkish ] = "~Evet";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_BUTTONTEXT_NO
+{
+ Text = "~Nein";
+ Text [ English ] = "~No";
+ TEXT[ italian ] = "No";
+ TEXT[ portuguese_brazilian ] = "~Não";
+ TEXT[ portuguese ] = "~Não";
+ TEXT[ danish ] = "~Nej";
+ TEXT[ french ] = "~Non";
+ TEXT[ swedish ] = "~Nej";
+ TEXT[ dutch ] = "~Nee";
+ TEXT[ spanish ] = "~No";
+ TEXT[ english_us ] = "~No";
+ TEXT[ russian ] = "Íåò";
+ TEXT[ polish ] = "~Nie";
+ TEXT[ japanese ] = "‚¢‚¢‚¦(~N)";
+ TEXT[ chinese_simplified ] = "·ñ(~N)";
+ TEXT[ chinese_traditional ] = "§_(~N)";
+ TEXT[ arabic ] = "áÇ";
+ TEXT[ dutch ] = "~Nee";
+ TEXT[ chinese_simplified ] = "·ñ(~N)";
+ TEXT[ greek ] = "¼÷é";
+ TEXT[ korean ] = "¾Æ´Ï¿À(~N)";
+ TEXT[ turkish ] = "~Hayýr";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_BUTTONTEXT_RETRY
+{
+ Text = "~Wiederholen";
+ Text [ English ] = "~Retry";
+ TEXT[ italian ] = "Riprova";
+ TEXT[ portuguese_brazilian ] = "~Repetir";
+ TEXT[ portuguese ] = "~Repetir";
+ TEXT[ danish ] = "Prøv igen";
+ TEXT[ french ] = "~Réessayer";
+ TEXT[ swedish ] = "~Upprepa";
+ TEXT[ dutch ] = "H~erhalen";
+ TEXT[ spanish ] = "~Reintentar";
+ TEXT[ english_us ] = "~Retry";
+ TEXT[ russian ] = "Ïîâòîðèòü";
+ TEXT[ polish ] = "P~onów";
+ TEXT[ japanese ] = "‚â‚è’¼‚µ(~R)";
+ TEXT[ chinese_simplified ] = "ÖØÊÔ(~R)";
+ TEXT[ chinese_traditional ] = "­«¸Õ(~R)";
+ TEXT[ arabic ] = "ÅÚÇÏÉ ÇáãÍÇæáÉ";
+ TEXT[ dutch ] = "H~erhalen";
+ TEXT[ chinese_simplified ] = "ÖØÊÔ(~R)";
+ TEXT[ greek ] = "ÅðáíÜëçøç";
+ TEXT[ korean ] = "´Ù½Ã ½Ãµµ(~R)";
+ TEXT[ turkish ] = "Y~inele";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_BUTTONTEXT_HELP
+{
+ Text = "~Hilfe";
+ Text [ English ] = "~Help";
+ TEXT[ italian ] = "?";
+ TEXT[ portuguese_brazilian ] = "Aj~uda";
+ TEXT[ portuguese ] = "Aj~uda";
+ TEXT[ danish ] = "~Hjælp";
+ TEXT[ french ] = "Ai~de";
+ TEXT[ swedish ] = "~Hjälp";
+ TEXT[ dutch ] = "~Help";
+ TEXT[ spanish ] = "Ay~uda";
+ TEXT[ english_us ] = "~Help";
+ TEXT[ russian ] = "Ñï~ðàâêà";
+ TEXT[ polish ] = "~Pomoc";
+ TEXT[ japanese ] = "ÍÙÌß(~H)";
+ TEXT[ chinese_simplified ] = "ÇóÖú(~H)";
+ TEXT[ chinese_traditional ] = "»¡©ú(~H)";
+ TEXT[ arabic ] = "ãÓÇÚÏÉ";
+ TEXT[ dutch ] = "~Help";
+ TEXT[ chinese_simplified ] = "ÇóÖú(~H)";
+ TEXT[ greek ] = "ÂïÞèåéá";
+ TEXT[ korean ] = "µµ¿ò¸»(~H)";
+ TEXT[ turkish ] = "~Yardým";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_BUTTONTEXT_MORE
+{
+ Text = "~Zusätze";
+ Text [ English ] = "~More";
+ TEXT[ italian ] = "E~xtra";
+ TEXT[ portuguese_brazilian ] = "~Mais";
+ TEXT[ portuguese ] = "~Opções";
+ TEXT[ danish ] = "~Flere";
+ TEXT[ french ] = "O~ptions";
+ TEXT[ swedish ] = "~Fler";
+ TEXT[ dutch ] = "~Overige";
+ TEXT[ spanish ] = "~Opciones";
+ TEXT[ english_us ] = "~More";
+ TEXT[ russian ] = "Áîëüøå";
+ TEXT[ polish ] = "~Dodatki";
+ TEXT[ japanese ] = "’ljÁ(~M)";
+ TEXT[ chinese_simplified ] = "ÆäËû(~M)";
+ TEXT[ chinese_traditional ] = "¨ä¥L(~M)";
+ TEXT[ arabic ] = "ÅÖÇÝÇÊ";
+ TEXT[ dutch ] = "~Overige";
+ TEXT[ chinese_simplified ] = "ÆäËû(~M)";
+ TEXT[ greek ] = "Ðñüóèåôá";
+ TEXT[ korean ] = "ÀÚ¼¼È÷(~M)";
+ TEXT[ turkish ] = "A~yrýntýlar";
+ TEXT[ language_user1 ] = " ";
+};
+
+/* HelpTexte, die wir derzeit nicht mehr verwenden:
+SV_BUTTONHELPTEXT_OK
+{
+ Text = "Schließt dieses Dialogfeld und speichert alle vorgenommenen Änderungen." ;
+ Text [ English ] = "Closes this dialog box and save any changes you have made." ;
+};
+
+SV_BUTTONHELPTEXT_CANCEL
+{
+ Text = "Schließt dieses Dialogfeld, ohne Ihre Änderungen zu speichern." ;
+ Text [ English ] = "Closes this dialog box without saving any changes you have made." ;
+};
+
+SV_BUTTONHELPTEXT_HELP
+{
+ Text = "Zeigt Hilfe zu diesem Fenster an." ;
+ Text [ English ] = "Shows help for the current window." ;
+};
+
+SV_BUTTONHELPTEXT_MORE
+{
+ Text = "Zeigt weitere EinstellmÖglichkeiten an oder versteckt diese wieder." ;
+ Text [ English ] = "Shows more Options or hide these options again." ;
+};
+
+Finnische-Texte:
+OK OK
+CANCEL Peruuta
+HELP ~Ohje
+MORE ~Enemmän
+YES ~Kyllä
+NO ~Ei
+RETRY ~Yritäuudelleen
+*/
diff --git a/vcl/source/src/helptext.src b/vcl/source/src/helptext.src
new file mode 100644
index 000000000000..41f6eccace76
--- /dev/null
+++ b/vcl/source/src/helptext.src
@@ -0,0 +1,367 @@
+/*************************************************************************
+ *
+ * $RCSfile: helptext.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_HELPTEXT_SRC
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+
+String SV_HELPTEXT_CLOSE
+{
+ Text = "Schließen" ;
+ Text [ English ] = "Close" ;
+ TEXT[ italian ] = "Chiudi";
+ TEXT[ portuguese_brazilian ] = "Schließen";
+ TEXT[ portuguese ] = "Fechar";
+ TEXT[ danish ] = "Luk";
+ TEXT[ french ] = "Fermer";
+ TEXT[ swedish ] = "Stäng";
+ TEXT[ dutch ] = "Sluiten";
+ TEXT[ spanish ] = "Cerrar";
+ TEXT[ english_us ] = "Close";
+ TEXT[ russian ] = "Çàêðûòü";
+ TEXT[ polish ] = "Zamknij";
+ TEXT[ japanese ] = "I—¹";
+ TEXT[ chinese_simplified ] = "¹Ø±Õ";
+ TEXT[ chinese_traditional ] = "Ãö³¬";
+ TEXT[ greek ] = "Êëåßóéìï";
+ TEXT[ korean ] = "´Ý±â";
+ TEXT[ arabic ] = "ÅÛáÇÞ";
+ TEXT[ turkish ] = "Kapat";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_MINIMIZE
+{
+ Text = "Minimieren" ;
+ Text [ English ] = "Minimize" ;
+ TEXT[ italian ] = "Riduci";
+ TEXT[ portuguese_brazilian ] = "Minimieren";
+ TEXT[ portuguese ] = "Minimizar";
+ TEXT[ danish ] = "Minimer";
+ TEXT[ french ] = "Réduire";
+ TEXT[ swedish ] = "Minimera";
+ TEXT[ dutch ] = "Minimaliseren";
+ TEXT[ spanish ] = "Minimizar";
+ TEXT[ english_us ] = "Minimize";
+ TEXT[ russian ] = "Ñâåðíóòü";
+ TEXT[ polish ] = "Minimalizuj";
+ TEXT[ japanese ] = "Ŭ‰»";
+ TEXT[ chinese_simplified ] = "×îС»¯";
+ TEXT[ chinese_traditional ] = "³Ì¤p¤Æ";
+ TEXT[ greek ] = "Åëá÷éóôïðïßçóç";
+ TEXT[ korean ] = "ÃÖ¼ÒÈ­";
+ TEXT[ arabic ] = "ÇáÍÏ ÇáÃÏäì";
+ TEXT[ turkish ] = "Simge durumuna küçült";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_MAXIMIZE
+{
+ Text = "Maximieren" ;
+ Text [ English ] = "Maximize" ;
+ TEXT[ italian ] = "Ingrandire";
+ TEXT[ portuguese_brazilian ] = "Maximieren";
+ TEXT[ portuguese ] = "Maximizar";
+ TEXT[ danish ] = "Maksimer";
+ TEXT[ french ] = "Agrandir";
+ TEXT[ swedish ] = "Maximera";
+ TEXT[ dutch ] = "Maximeren";
+ TEXT[ spanish ] = "Maximizar";
+ TEXT[ english_us ] = "Maximize";
+ TEXT[ russian ] = "Ðàçâåðíóòü";
+ TEXT[ polish ] = "Maksymalizuj";
+ TEXT[ japanese ] = "ő剻";
+ TEXT[ chinese_simplified ] = "×î´ó»¯";
+ TEXT[ chinese_traditional ] = "³Ì¤j¤Æ";
+ TEXT[ greek ] = "Ìåãéóôïðïßçóç";
+ TEXT[ korean ] = "ÃÖ´ëÈ­";
+ TEXT[ arabic ] = "ÇáÍÏ ÇáÃÞÕì";
+ TEXT[ turkish ] = "Ekraný kapla";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_RESTORE
+{
+ Text = "Wiederherstellen" ;
+ Text [ English ] = "Restore" ;
+ TEXT[ italian ] = "Ripristina";
+ TEXT[ portuguese_brazilian ] = "Wiederherstellen";
+ TEXT[ portuguese ] = "Restaurar";
+ TEXT[ danish ] = "Gendan";
+ TEXT[ french ] = "Restaurer";
+ TEXT[ swedish ] = "Återställ";
+ TEXT[ dutch ] = "Herstellen";
+ TEXT[ spanish ] = "Restaurar";
+ TEXT[ english_us ] = "Restore";
+ TEXT[ russian ] = "Âîññòàíîâèòü";
+ TEXT[ polish ] = "Przywróæ";
+ TEXT[ japanese ] = "Œ³‚Ìó‘Ô‚É–ß‚·";
+ TEXT[ chinese_simplified ] = "»Ö¸´";
+ TEXT[ chinese_traditional ] = "«ì´_";
+ TEXT[ greek ] = "ÅðáíáöïñÜ";
+ TEXT[ korean ] = "º¹±¸";
+ TEXT[ arabic ] = "ÇÓÊÚÇÏÉ";
+ TEXT[ turkish ] = "Baþa al";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_ROLLDOWN
+{
+ Text = "Aufklappen" ;
+ Text [ English ] = "Roll Down" ;
+ TEXT[ italian ] = "Mostra";
+ TEXT[ portuguese_brazilian ] = "Aufklappen";
+ TEXT[ portuguese ] = "Abrir";
+ TEXT[ danish ] = "Klap ud";
+ TEXT[ french ] = "Agrandir";
+ TEXT[ swedish ] = "Visa";
+ TEXT[ dutch ] = "Openslaan";
+ TEXT[ spanish ] = "Mostrar";
+ TEXT[ english_us ] = "Drop down";
+ TEXT[ russian ] = "Ðàñêðûòü";
+ TEXT[ polish ] = "Otwórz";
+ TEXT[ japanese ] = "ŠJ‚¯‚é";
+ TEXT[ chinese_simplified ] = "ÏÔʾ";
+ TEXT[ chinese_traditional ] = "Åã¥Ü";
+ TEXT[ greek ] = "¢íïéãìá";
+ TEXT[ korean ] = "º¸À̱â";
+ TEXT[ arabic ] = "ÝÊÍ";
+ TEXT[ turkish ] = "Aç";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_ROLLUP
+{
+ Text = "Zuklappen" ;
+ Text [ English ] = "Roll Up" ;
+ TEXT[ italian ] = "Nascondi";
+ TEXT[ portuguese_brazilian ] = "Zuklappen";
+ TEXT[ portuguese ] = "Fechar";
+ TEXT[ danish ] = "Minimer";
+ TEXT[ french ] = "Réduire";
+ TEXT[ swedish ] = "Dölj";
+ TEXT[ dutch ] = "Dichtslaan";
+ TEXT[ spanish ] = "Ocultar";
+ TEXT[ english_us ] = "Roll up";
+ TEXT[ language_user1 ] = " ";
+ TEXT[ russian ] = "Çàêðûòü";
+ TEXT[ polish ] = "Ukryj";
+ TEXT[ japanese ] = "•Â‚¶‚é";
+ TEXT[ chinese_simplified ] = "ÒþÈë";
+ TEXT[ chinese_traditional ] = "Áô¤J";
+ TEXT[ greek ] = "Áðüêñõøç";
+ TEXT[ korean ] = "¼û±â±â";
+ TEXT[ arabic ] = "Øí";
+ TEXT[ turkish ] = "Kapat";
+};
+
+String SV_HELPTEXT_HELP
+{
+ Text = "Hilfe" ;
+ Text [ English ] = "Help" ;
+ TEXT[ italian ] = "Guida";
+ TEXT[ portuguese_brazilian ] = "Hilfe";
+ TEXT[ portuguese ] = "Ajuda";
+ TEXT[ danish ] = "Hjælp";
+ TEXT[ french ] = "Aide";
+ TEXT[ swedish ] = "Hjälp";
+ TEXT[ dutch ] = "Help";
+ TEXT[ spanish ] = "Ayuda";
+ TEXT[ english_us ] = "Help";
+ TEXT[ russian ] = "Ñïðàâêà";
+ TEXT[ polish ] = "Pomoc";
+ TEXT[ japanese ] = "ƒwƒ‹ƒv";
+ TEXT[ chinese_simplified ] = "ÇóÖú";
+ TEXT[ chinese_traditional ] = "»¡©ú";
+ TEXT[ greek ] = "ÂïÞèåéá";
+ TEXT[ korean ] = "µµ¿ò¸»";
+ TEXT[ arabic ] = "ãÓÇÚÏÉ";
+ TEXT[ turkish ] = "Yardým";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_ALWAYSVISIBLE
+{
+ Text = "Immer sichtbar" ;
+ Text [ English ] = "Always Visible" ;
+ TEXT[ italian ] = "Sempre visibile";
+ TEXT[ portuguese_brazilian ] = "Immer sichtbar";
+ TEXT[ portuguese ] = "Sempre visível";
+ TEXT[ danish ] = "Altid synlig";
+ TEXT[ french ] = "Toujours visible";
+ TEXT[ swedish ] = "Alltid synlig";
+ TEXT[ dutch ] = "Steeds zichtbaar";
+ TEXT[ spanish ] = "Siempre visible";
+ TEXT[ english_us ] = "Always visible";
+ TEXT[ russian ] = "Ïîêàçûâàòü âñåãäà";
+ TEXT[ polish ] = "Zawsze widoczny";
+ TEXT[ japanese ] = "‚¢‚Â‚àŒ©‚¦‚é";
+ TEXT[ chinese_simplified ] = "×ÜÊÇÏÔʾ";
+ TEXT[ chinese_traditional ] = "Á`¬OÅã¥Ü";
+ TEXT[ greek ] = "ÐÜíôá ïñáôÜ";
+ TEXT[ korean ] = "Ç×»ó º¸ÀÓ";
+ TEXT[ arabic ] = "ãÑÆí ÏÇÆãÇð";
+ TEXT[ turkish ] = "Daima görünür";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_FADEIN
+{
+ Text = "Einblenden" ;
+ Text [ English ] = "Fade In" ;
+ TEXT[ italian ] = "Mostra";
+ TEXT[ portuguese_brazilian ] = "Einblenden";
+ TEXT[ portuguese ] = "Mostrar";
+ TEXT[ danish ] = "Vis";
+ TEXT[ french ] = "Afficher";
+ TEXT[ swedish ] = "Visa";
+ TEXT[ dutch ] = "Weergeven";
+ TEXT[ spanish ] = "Mostrar";
+ TEXT[ english_us ] = "Show";
+ TEXT[ russian ] = "Ïîêàçàòü";
+ TEXT[ polish ] = "Poka¿";
+ TEXT[ japanese ] = "•\\Ž¦";
+ TEXT[ chinese_simplified ] = "ÏÔʾ";
+ TEXT[ chinese_traditional ] = "Åã¥Ü";
+ TEXT[ greek ] = "ÅìöÜíéóç";
+ TEXT[ korean ] = "º¸À̱â";
+ TEXT[ arabic ] = "ÅÙåÇÑ";
+ TEXT[ turkish ] = "Göster";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_FADEOUT
+{
+ Text = "Ausblenden" ;
+ Text [ English ] = "Fade Out" ;
+ TEXT[ italian ] = "Nascondi";
+ TEXT[ portuguese_brazilian ] = "Ausblenden";
+ TEXT[ portuguese ] = "Ocultar";
+ TEXT[ danish ] = "Skjul";
+ TEXT[ french ] = "Masquer";
+ TEXT[ swedish ] = "Dölj";
+ TEXT[ dutch ] = "Verbergen";
+ TEXT[ spanish ] = "Ocultar";
+ TEXT[ english_us ] = "Hide";
+ TEXT[ russian ] = "Ñêðûòü";
+ TEXT[ polish ] = "Ukryj";
+ TEXT[ japanese ] = "”ñ•\\Ž¦";
+ TEXT[ chinese_simplified ] = "ÒþÈë";
+ TEXT[ chinese_traditional ] = "Áô¤J";
+ TEXT[ greek ] = "Áðüêñõøç";
+ TEXT[ korean ] = "¼û±â±â";
+ TEXT[ arabic ] = "ÅÎÝÇÁ";
+ TEXT[ turkish ] = "Gizle";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_SPLITFLOATING
+{
+ Text = "Schwebend" ;
+ Text [ English ] = "Floating" ;
+ TEXT[ italian ] = "Fluttuante";
+ TEXT[ portuguese_brazilian ] = "Schwebend";
+ TEXT[ portuguese ] = "Flutuante";
+ TEXT[ danish ] = "Flydende";
+ TEXT[ french ] = "Flottante";
+ TEXT[ swedish ] = "Svävande";
+ TEXT[ dutch ] = "Zwevend";
+ TEXT[ spanish ] = "Flotando";
+ TEXT[ english_us ] = "Floating";
+ TEXT[ russian ] = "Çàâèñøèé";
+ TEXT[ polish ] = "P³ywaj¹cy";
+ TEXT[ japanese ] = "•‚“®";
+ TEXT[ chinese_simplified ] = "¸¡¶¯";
+ TEXT[ chinese_traditional ] = "¯B°Ê";
+ TEXT[ greek ] = "Êéíçôü";
+ TEXT[ korean ] = "°íÁ¤µÇÁö ¾ÊÀº";
+ TEXT[ arabic ] = "ÚÇÆã";
+ TEXT[ turkish ] = "Serbest";
+ TEXT[ language_user1 ] = " ";
+};
+
+String SV_HELPTEXT_SPLITFIXED
+{
+ Text = "Fixieren" ;
+ Text [ English ] = "Fixed" ;
+ TEXT[ italian ] = "Fissa";
+ TEXT[ portuguese_brazilian ] = "Fixieren";
+ TEXT[ portuguese ] = "Fixar";
+ TEXT[ danish ] = "Frys";
+ TEXT[ french ] = "Ancrée";
+ TEXT[ swedish ] = "Fixera";
+ TEXT[ dutch ] = "Fixeren";
+ TEXT[ spanish ] = "Fijar";
+ TEXT[ english_us ] = "Stick";
+ TEXT[ russian ] = "Ôèêñèðîâàòü";
+ TEXT[ polish ] = "Przytwierdzony";
+ TEXT[ japanese ] = "΁Տ";
+ TEXT[ chinese_simplified ] = "¹Ì¶¨";
+ TEXT[ chinese_traditional ] = "©T©w";
+ TEXT[ greek ] = "Ðáãßùóç";
+ TEXT[ korean ] = "°íÁ¤";
+ TEXT[ arabic ] = "ÊËÈíÊ";
+ TEXT[ turkish ] = "Sabitle";
+ TEXT[ language_user1 ] = " ";
+};
+
diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src
new file mode 100644
index 000000000000..163cb4dc6e00
--- /dev/null
+++ b/vcl/source/src/images.src
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * $RCSfile: images.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_IMAGES_SRC
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+
+// =======================================================================
+
+Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_STDOFFSET)
+{
+ File = "check.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_WINOFFSET)
+{
+ File = "checkwin.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_OS2OFFSET)
+{
+ File = "checkos2.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MACOFFSET)
+{
+ File = "checkmac.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_UNIXOFFSET)
+{
+ File = "checkunx.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_SCROLLBMP)
+{
+ File = "scrbmp.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_SCROLLMSK)
+{
+ File = "scrmsk.bmp";
+};
+
+// -----------------------------------------------------------------------
+
+Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_STDOFFSET)
+{
+ File = "radio.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_WINOFFSET)
+{
+ File = "radiowin.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_OS2OFFSET)
+{
+ File = "radioos2.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MACOFFSET)
+{
+ File = "radiomac.bmp";
+};
+
+Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_UNIXOFFSET)
+{
+ File = "radiounx.bmp";
+};
+
+// -----------------------------------------------------------------------
+
+Bitmap SV_RESID_BITMAP_MSGBOX
+{
+ File = "msgbox.bmp";
+};
+
+// -----------------------------------------------------------------------
+
+Bitmap SV_RESID_BITMAP_PIN
+{
+ File = "pin.bmp";
+};
+
+// -----------------------------------------------------------------------
+
+Bitmap SV_RESID_BITMAP_SPLITHPIN
+{
+ File = "splhpin.bmp";
+};
+
+Bitmap SV_RESID_BITMAP_SPLITVPIN
+{
+ File = "splvpin.bmp";
+};
+
+Bitmap SV_RESID_BITMAP_SPLITHARW
+{
+ File = "splharw.bmp";
+};
+
+Bitmap SV_RESID_BITMAP_SPLITVARW
+{
+ File = "splvarw.bmp";
+};
+
diff --git a/vcl/source/src/makefile.mk b/vcl/source/src/makefile.mk
new file mode 100644
index 000000000000..8520005b59d8
--- /dev/null
+++ b/vcl/source/src/makefile.mk
@@ -0,0 +1,106 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=vcl
+TARGET=svsrc
+RESTARGET=vcl
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SRCFILES= images.src \
+ menu.src \
+ stdtext.src \
+ helptext.src \
+ btntext.src
+
+RESLIB1NAME= $(RESTARGET)
+RESLIB1SRSFILES= $(SRS)$/svsrc.srs
+RESLIB1BMPS= check.bmp \
+ checkwin.bmp \
+ checkos2.bmp \
+ checkmac.bmp \
+ checkunx.bmp \
+ radio.bmp \
+ radiowin.bmp \
+ radioos2.bmp \
+ radiomac.bmp \
+ radiounx.bmp \
+ msgbox.bmp \
+ scrbmp.bmp \
+ scrmsk.bmp \
+ pin.bmp \
+ splhpin.bmp \
+ splvpin.bmp \
+ splharw.bmp \
+ splvarw.bmp
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/source/src/menu.src b/vcl/source/src/menu.src
new file mode 100644
index 000000000000..a3294770dff7
--- /dev/null
+++ b/vcl/source/src/menu.src
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * $RCSfile: menu.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define _SV_MENU_SRC
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+
+String SV_RESID_STRING_NOSELECTIONPOSSIBLE
+{
+ Text ="<Keine Auswahl möglich>";
+ Text[English] ="<No selection possible>";
+ Text[ english_us ] = "<No selection possible>";
+ Text[ portuguese ] = "<Selecção impossível>";
+ Text[ russian ] = "<Âûáîð íåâîçìîæåí>";
+ Text[ greek ] = "<Äåí åßíáé äõíáôüí íá ãßíåé åðéëïãÞ>";
+ Text[ dutch ] = "<Geen selectie mogelijk>";
+ Text[ french ] = "<Aucune sélection possible>";
+ Text[ spanish ] = "<Ninguna selección posible>";
+ Text[ italian ] = "<Impossibile selezionare>";
+ Text[ danish ] = "<Intet udvalg muligt>";
+ Text[ swedish ] = "<Inget urval möjligt>";
+ Text[ polish ] = "<Selekcja niemo¿liwa>";
+ Text[ portuguese_brazilian ] = "<No selection possible>";
+ Text[ japanese ] = "<‰½‚à‘I‘ð‚Å‚«‚Ü‚¹‚ñ>";
+ Text[ korean ] = "<¼±Åà ºÒ°¡´É>";
+ Text[ chinese_simplified ] = "<ÎÞ·¨Ñ¡Ôñ>";
+ Text[ chinese_traditional ] = "<µLªk¿ï¾Ü>";
+ Text[ arabic ] = "<áÇ íãßä ÇáÊÍÏíÏ>";
+ Text[ turkish ] = "<Seçim yapýlamaz>";
+};
+
+Menu SV_RESID_MENU_EDIT
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = SV_MENU_EDIT_UNDO ;
+ Text = "~Rückgängig" ;
+ Text [ English ] = "~Undo" ;
+ Text [ portuguese ] = "~Anular" ;
+ Text [ english_us ] = "~Undo" ;
+ Text [ portuguese_brazilian ] = "~Rückgängig" ;
+ Text [ swedish ] = "~Ångra" ;
+ Text [ danish ] = "Fo~rtryd" ;
+ Text [ italian ] = "~Annulla" ;
+ Text [ spanish ] = "~Deshacer" ;
+ Text [ french ] = "~Annuler" ;
+ Text [ dutch ] = "~Ongedaan maken" ;
+ Text[ russian ] = "Îòìåíèòü";
+ Text[ polish ] = "Cofnij";
+ Text[ japanese ] = "Œ³‚É–ß‚·(~U)";
+ Text[ chinese_simplified ] = "³·ÏûÃüÁî(~U)";
+ Text[ chinese_traditional ] = "´_­ì(~U)";
+ Text[ greek ] = "Áíáß~ñåóç";
+ Text[ korean ] = "ÀÛ¾÷Ãë¼Ò(~U)";
+ Text[ arabic ] = "ÊÑÇÌÚ";
+ Text[ turkish ] = "Geri al";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem { Separator = TRUE ; };
+ MenuItem
+ {
+ Identifier = SV_MENU_EDIT_CUT ;
+ Text = "~Ausschneiden" ;
+ Text [ English ] = "Cu~t" ;
+ Text [ norwegian ] = "Klipp~ut" ;
+ Text [ italian ] = "~Taglia" ;
+ Text [ portuguese_brazilian ] = "Co~rtar" ;
+ Text [ portuguese ] = "Co~rtar" ;
+ Text [ finnish ] = "~Leikkaa" ;
+ Text [ danish ] = "~Klip" ;
+ Text [ french ] = "~Couper" ;
+ Text [ swedish ] = "~Klipp ut" ;
+ Text [ dutch ] = "K~nippen" ;
+ Text [ spanish ] = "C~ortar" ;
+ Text [ english_us ] = "Cu~t" ;
+ Text[ russian ] = "~Âûðåçàòü";
+ Text[ polish ] = "Wytnij";
+ Text[ japanese ] = "Ø‚èŽæ‚è(~T)";
+ Text[ chinese_simplified ] = "¼ô³ý(~T)";
+ Text[ chinese_traditional ] = "°Å¤U(~T)";
+ Text[ greek ] = "~ÁðïêïðÞ";
+ Text[ korean ] = "À߶󳻱â(~T)";
+ Text[ arabic ] = "ÞÕ";
+ Text[ turkish ] = "~Kes";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = SV_MENU_EDIT_COPY ;
+ Text = "~Kopieren" ;
+ Text [ English ] = "~Copy" ;
+ Text [ norwegian ] = "~Kopier" ;
+ Text [ italian ] = "~Copia" ;
+ Text [ portuguese_brazilian ] = "~Copiar" ;
+ Text [ portuguese ] = "~Copiar" ;
+ Text [ finnish ] = "~Kopioi" ;
+ Text [ danish ] = "K~opier" ;
+ Text [ french ] = "Co~pier" ;
+ Text [ swedish ] = "K~opiera" ;
+ Text [ dutch ] = "~Kopiëren" ;
+ Text [ spanish ] = "~Copiar" ;
+ Text [ english_us ] = "~Copy" ;
+ Text[ russian ] = "~Êîïèðîâàòü";
+ Text[ polish ] = "Kopiuj";
+ Text[ japanese ] = "ºËß°(~C)";
+ Text[ chinese_simplified ] = "¸´ÖÆ(~C)";
+ Text[ chinese_traditional ] = "½Æ»s(~C)";
+ Text[ greek ] = "Áíôé~ãñáöÞ";
+ Text[ korean ] = "º¹»ç(~C)";
+ Text[ arabic ] = "äÓÎ";
+ Text[ turkish ] = "K~opyala";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = SV_MENU_EDIT_PASTE ;
+ Text = "~Einfügen" ;
+ Text [ English ] = "~Paste" ;
+ Text [ norwegian ] = "~Paste" ;
+ Text [ italian ] = "~Incolla" ;
+ Text [ portuguese_brazilian ] = "~Colar" ;
+ Text [ portuguese ] = "Co~lar" ;
+ Text [ finnish ] = "L~iitä" ;
+ Text [ danish ] = "~Indsæt" ;
+ Text [ french ] = "C~oller" ;
+ Text [ swedish ] = "K~listra in" ;
+ Text [ dutch ] = "~Plakken" ;
+ Text [ spanish ] = "~Pegar" ;
+ Text [ english_us ] = "~Paste" ;
+ Text[ russian ] = "Âñò~àâêà";
+ Text[ polish ] = "W~staw";
+ Text[ japanese ] = "“\\‚è•t‚¯(~P)";
+ Text[ chinese_simplified ] = "²åÈë(~P)";
+ Text[ chinese_traditional ] = "´¡¤J(~P)";
+ Text[ greek ] = "~Åðéêüëëçóç";
+ Text[ korean ] = "ºÙ¿©³Ö±â(~P)";
+ Text[ arabic ] = "áÕÞ";
+ Text[ turkish ] = "~Yapýþtýr";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = SV_MENU_EDIT_DELETE ;
+ Text = "~Löschen" ;
+ Text [ English ] = "~Delete" ;
+ Text [ norwegian ] = "~Slett" ;
+ Text [ italian ] = "Cancella" ;
+ Text [ portuguese_brazilian ] = "~Apagar" ;
+ Text [ portuguese ] = "E~liminar" ;
+ Text [ finnish ] = "~Poista" ;
+ Text [ danish ] = "~Slet" ;
+ Text [ french ] = "~Supprimer" ;
+ Text [ swedish ] = "~Radera" ;
+ Text [ dutch ] = "~Wissen" ;
+ Text [ spanish ] = "~Eliminar" ;
+ Text [ english_us ] = "~Delete" ;
+ Text[ russian ] = "~Óäàëèòü";
+ Text[ polish ] = "Usuñ";
+ Text[ japanese ] = "íœ(~D)";
+ Text[ chinese_simplified ] = "ɾ³ý(~D)";
+ Text[ chinese_traditional ] = "§R°£(~D)";
+ Text[ greek ] = "Äéáãñá~öÞ";
+ Text[ korean ] = "»èÁ¦(~D)";
+ Text[ arabic ] = "ÍÐÝ";
+ Text[ turkish ] = "~Sil";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem { Separator = TRUE ; };
+ MenuItem
+ {
+ Identifier = SV_MENU_EDIT_SELECTALL ;
+ Text = "Alles aus~wählen" ;
+ Text [ English ] = "Select ~All" ;
+ Text [ norwegian ] = "Select ~All" ;
+ Text [ italian ] = "Seleziona tutto" ;
+ Text [ portuguese_brazilian ] = "Selecionar ~Tudo" ;
+ Text [ portuguese ] = "Seleccionar ~tudo" ;
+ Text [ finnish ] = "Valitse ~kaikki" ;
+ Text [ danish ] = "~Marker alt" ;
+ Text [ french ] = "Sélectio~nner tout" ;
+ Text [ swedish ] = "Markera ~allt" ;
+ Text [ dutch ] = "~Alles selecteren" ;
+ Text [ spanish ] = "Seleccionar ~todo" ;
+ Text [ english_us ] = "Select ~All" ;
+ Text[ russian ] = "Âûäåëèòü âñå";
+ Text[ polish ] = "Zaznacz wszystko";
+ Text[ japanese ] = "‚·‚ׂđI‘ð(~A)";
+ Text[ chinese_simplified ] = "È«²¿Ñ¡ÖÐ(~A)";
+ Text[ chinese_traditional ] = "¥þ³¡¿ï¨ú(~A)";
+ Text[ greek ] = "ÅðéëïãÞ üë~ùí";
+ Text[ korean ] = "Àüü¼±ÅÃ(~A)";
+ Text[ arabic ] = "ÊÍÏíÏ Çáßá";
+ Text[ turkish ] = "Tümünü seç";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem { Separator = TRUE ; };
+ MenuItem
+ {
+ Identifier = SV_MENU_EDIT_INSERTSYMBOL;
+ Text = "~Sonderzeichen einfügen...";
+ Text [ English ] = "insert ~symbol...";
+ TEXT[ italian ] = "Inserisci caratteri speciali...";
+ TEXT[ portuguese_brazilian ] = "~Sonderzeichen einfügen...";
+ TEXT[ portuguese ] = "~Inserir carácter especial...";
+ TEXT[ danish ] = "Indsæt ~specialtegn...";
+ TEXT[ french ] = "~Insérer des caractères spéciaux...";
+ TEXT[ swedish ] = "Infoga ~specialtecken...";
+ TEXT[ dutch ] = "~Speciaal teken invoegen...";
+ TEXT[ spanish ] = "Insertar ~símbolo...";
+ TEXT[ english_us ] = "~Special Character...";
+ TEXT[ russian ] = "~Âñòàâèòü ñïåöèàëüíûå ñèìâîëû...";
+ TEXT[ polish ] = "Wstaw znaki specjalne...";
+ TEXT[ japanese ] = "‹L†‚Æ“ÁŽê•¶Žš‚Ì‘}“ü(~S)...";
+
+ TEXT[ chinese_simplified ] = "²åÈëÌØÊâ×Ö·û(~S)...";
+ TEXT[ chinese_traditional ] = "´¡¤J¯S®í¦r¤¸(~S)...";
+ TEXT[ greek ] = "Åé~óáãùãÞ åéäéêïý ÷áñáêôÞñá...";
+ TEXT[ korean ] = "Ư¼ö±âÈ£(~S)...";
+ TEXT[ arabic ] = "ÅÏÑÇÌ ÑãæÒ ÎÇÕÉ";
+ TEXT[ turkish ] = "Özel karakter ekle...";
+ TEXT[ language_user1 ] = " ";
+ };
+ };
+};
diff --git a/vcl/source/src/stdtext.src b/vcl/source/src/stdtext.src
new file mode 100644
index 000000000000..2a7ca53c68fd
--- /dev/null
+++ b/vcl/source/src/stdtext.src
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: stdtext.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_STDTEXT_SRC
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+
+String SV_STDTEXT_SERVICENOTAVAILABLE
+{
+ Text = "Eine Komponente (%s) konnte nicht geladen werden.\nBitte starten Sie das Setup und führen Sie eine Reparatur durch.";
+ Text [ English ] = "The component (%s) could not be loaded.\nPlease start setup in repair mode." ;
+ Text[ english_us ] = "The component (%s) could not be loaded.\nPlease start setup with the repair option.";
+ Text[ portuguese ] = "Impossível carregar o componente (%s).\nReinicie o setup com a opção 'Reparação'.";
+ Text[ russian ] = "Çàãðóçèòü îäèí èç êîìïîíåíòîâ (%s) íå óäàåòñÿ.\nÇàïóñòèòå èíñòàëëÿöèþ ñ âîññòàíîâëåíèåì.";
+ Text[ dutch ] = "Een component (%s) kon niet worden geladen.\nStart setup opnieuw met de optie Reparatie.";
+ Text[ french ] = "Impossible de charger l'un des composants (%s).\nVeuillez redémarrer le programme d'installation (Setup) et exécuter une réparation.";
+ Text[ spanish ] = "No se pudo cargar un componente (%s).\nInicie por favor el programa de instalación y ejecute una Reparación.";
+ Text[ italian ] = "Impossibile caricare il componente (%s).\nRiavviate il setup e eseguite la riparazione.";
+ Text[ danish ] = "Det var ikke muligt at indlæse en komponent (%s).\nStart venligst installationsprogrammet (Setup) og udfør en reparation.";
+ Text[ swedish ] = "Komponenten (%s) kunde inte laddas.\nVar vänlig och starta setupen och gör en reparation.";
+ Text[ polish ] = "Sk³adnika (%s) nie mo¿na za³adowaæ.\nProszê rozpocznij program instalacyjny i przeprowadŸ naprawê.";
+ Text[ portuguese_brazilian ] = "The component (%s) could not be loaded.\nPlease start setup with the option -repair.";
+ Text[ japanese ] = "ºÝÎß°ÈÝÄ(%s)‚Í“Ç‚Ýž‚Ý‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B\n¾¯Ä±¯Ìß‚ðŠJŽn‚µ‚ÄC•œ‚ðŽÀs‚µ‚ĉº‚³‚¢B";
+ Text[ chinese_simplified ] = "ÎÞ·¨×°ÔسÌÐò²¿¼þ(%s)¡£\nÇëÄúÑ¡Ôñ°²×°³ÌÐòµÄÑ¡ÏîÐÞ²¹¡£";
+ Text[ chinese_traditional ] = "µLªk¸Ë¸üµ{¦¡³¡¥ó(%s)¡C\n½Ð±z¿ï¾Ü¦w¸Ëµ{¦¡ªº­×½Æ¿ï¶µ¡C";
+ Text[ arabic ] = "ÊÚÐÑ ÊÍãíá Çáãßæä (%s).\n ÇáÑÌÇÁ ÈÏÁ ÈÑäÇãÌ ÇáÅÚÏÇÏ¡ Ëã ÇáÞíÇã ÈÚãáíÉ ÇáÅÕáÇÍ ÇááÇÒãÉ.";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá öïñôùèåß ôï óôïé÷åßï (%s)\nÐáñáêáëþ åêêéíÞóôå îáíÜ ôï ðñüãñáììá åãêáôÜóôáóçò êáé åêôåëÝóôå ôçí åðéóêåõÞ.";
+ Text[ korean ] = "ÄÄÆ÷³ÍÆ® (%s)°¡ ·Îµå µÇÁö ¾Ê¾Ò½À´Ï´Ù.\n¼³Á¤¿¡¼­ ¿É¼Ç°íħÀ» ½ÃÀÛÇϽʽÿÀ.";
+ Text[ turkish ] = "Bir bileþen (%s) yüklenemedi.\nSetup programýný çalýþtýrýp onarýnýz.";
+ Text[ language_user1 ] = " ";
+};
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
new file mode 100644
index 000000000000..f039c311ef28
--- /dev/null
+++ b/vcl/source/window/accel.cxx
@@ -0,0 +1,775 @@
+/*************************************************************************
+ *
+ * $RCSfile: accel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_ACCEL_CXX
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _TABLE_HXX
+#include <tools/table.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_ACCEL_H
+#include <accel.h>
+#endif
+#ifndef _SV_ACCEL_HXX
+#include <accel.hxx>
+#endif
+#ifndef _RC_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* );
+DECLARE_LIST( ImplAccelList, ImplAccelEntry* );
+
+#define ACCELENTRY_NOTFOUND ((USHORT)0xFFFF)
+
+// =======================================================================
+
+class ImplAccelData
+{
+public:
+ ImplAccelTable maKeyTable; // Fuer KeyCodes, die mit einem Code erzeugt wurden
+ ImplAccelList maIdList; // Id-List
+};
+
+// =======================================================================
+
+DBG_NAME( Accelerator );
+
+// =======================================================================
+
+USHORT ImplAccelEntryGetIndex( ImplAccelList* pList, USHORT nId,
+ USHORT* pIndex = NULL )
+{
+ ULONG nLow;
+ ULONG nHigh;
+ ULONG nMid;
+ ULONG nCount = pList->Count();
+ USHORT nCompareId;
+
+ // Abpruefen, ob der erste Key groesser als der Vergleichskey ist
+ if ( !nCount || (nId < pList->GetObject( 0 )->mnId) )
+ {
+ if ( pIndex )
+ *pIndex = 0;
+ return ACCELENTRY_NOTFOUND;
+ }
+
+ // Binaeres Suchen
+ nLow = 0;
+ nHigh = nCount-1;
+ do
+ {
+ nMid = (nLow + nHigh) / 2;
+ nCompareId = pList->GetObject( nMid )->mnId;
+ if ( nId < nCompareId )
+ nHigh = nMid-1;
+ else
+ {
+ if ( nId > nCompareId )
+ nLow = nMid + 1;
+ else
+ return (USHORT)nMid;
+ }
+ }
+ while ( nLow <= nHigh );
+
+ if ( pIndex )
+ {
+ if ( nId > nCompareId )
+ *pIndex = (USHORT)(nMid+1);
+ else
+ *pIndex = (USHORT)nMid;
+ }
+
+ return ACCELENTRY_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry )
+{
+ USHORT nInsIndex;
+ USHORT nIndex = ImplAccelEntryGetIndex( pList, pEntry->mnId, &nInsIndex );
+
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ {
+ do
+ {
+ nIndex++;
+ ImplAccelEntry* pTempEntry = pList->GetObject( nIndex );
+ if ( !pTempEntry || (pTempEntry->mnId != pEntry->mnId) )
+ break;
+ }
+ while ( nIndex < pList->Count() );
+
+ pList->Insert( pEntry, (ULONG)nIndex );
+ }
+ else
+ pList->Insert( pEntry, (ULONG)nInsIndex );
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplAccelEntryGetFirstPos( ImplAccelList* pList, USHORT nId )
+{
+ USHORT nIndex = ImplAccelEntryGetIndex( pList, nId );
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ {
+ while ( nIndex )
+ {
+ nIndex--;
+ if ( pList->GetObject( nIndex )->mnId != nId )
+ break;
+ }
+
+ if ( pList->GetObject( nIndex )->mnId != nId )
+ nIndex++;
+ }
+
+ return nIndex;
+}
+
+// =======================================================================
+
+void Accelerator::ImplInit()
+{
+ mnCurId = 0;
+ mnCurRepeat = 0;
+ mbIsCancel = FALSE;
+ mpDel = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode& rKeyCode ) const
+{
+ return mpData->maKeyTable.Get( rKeyCode.GetFullKeyCode() );
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
+{
+ // Tabellen kopieren
+ ImplAccelEntry* pEntry = rAccelData.maIdList.First();
+ while ( pEntry )
+ {
+ pEntry = new ImplAccelEntry( *pEntry );
+
+ // Folge-Accelerator, dann auch kopieren
+ if ( pEntry->mpAccel )
+ {
+ pEntry->mpAccel = new Accelerator( *(pEntry->mpAccel) );
+ pEntry->mpAutoAccel = pEntry->mpAccel;
+ }
+ else
+ pEntry->mpAutoAccel = NULL;
+
+ mpData->maKeyTable.Insert( (ULONG)pEntry->maKeyCode.GetFullKeyCode(), pEntry );
+ mpData->maIdList.Insert( pEntry, LIST_APPEND );
+
+ pEntry = rAccelData.maIdList.Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::ImplDeleteData()
+{
+ // Accelerator-Eintraege ueber die Id-Tabelle loeschen
+ ImplAccelEntry* pEntry = mpData->maIdList.First();
+ while ( pEntry )
+ {
+ // AutoResAccel zerstoeren
+ if ( pEntry->mpAutoAccel )
+ delete pEntry->mpAutoAccel;
+ delete pEntry;
+
+ pEntry = mpData->maIdList.Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::ImplInsertAccel( USHORT nItemId, const KeyCode& rKeyCode,
+ BOOL bEnable, Accelerator* pAutoAccel )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+ DBG_ASSERT( nItemId, "Accelerator::InsertItem(): ItemId == 0" );
+
+ if ( rKeyCode.IsFunction() )
+ {
+ USHORT nCode1;
+ USHORT nCode2;
+ USHORT nCode3;
+ ImplGetKeyCode( rKeyCode.GetFunction(), nCode1, nCode2, nCode3 );
+ if ( nCode1 )
+ ImplInsertAccel( nItemId, KeyCode( nCode1, nCode1 ), bEnable, pAutoAccel );
+ if ( nCode2 )
+ {
+ if ( pAutoAccel )
+ pAutoAccel = new Accelerator( *pAutoAccel );
+ ImplInsertAccel( nItemId, KeyCode( nCode2, nCode2 ), bEnable, pAutoAccel );
+ if ( nCode3 )
+ {
+ if ( pAutoAccel )
+ pAutoAccel = new Accelerator( *pAutoAccel );
+ ImplInsertAccel( nItemId, KeyCode( nCode3, nCode3 ), bEnable, pAutoAccel );
+ }
+ }
+ return;
+ }
+
+ // Neuen Eintrag holen und fuellen
+ ImplAccelEntry* pEntry = new ImplAccelEntry;
+ pEntry->mnId = nItemId;
+ pEntry->maKeyCode = rKeyCode;
+ pEntry->mpAccel = pAutoAccel;
+ pEntry->mpAutoAccel = pAutoAccel;
+ pEntry->mbEnabled = bEnable;
+
+ // Ab in die Tabellen
+ ULONG nCode = rKeyCode.GetFullKeyCode();
+ if ( !nCode )
+ {
+ DBG_ERROR( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" );
+ delete pEntry;
+ }
+ else if ( !mpData->maKeyTable.Insert( nCode, pEntry ) )
+ {
+ DBG_ERROR1( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode );
+ delete pEntry;
+ }
+ else
+ ImplAccelEntryInsert( &(mpData->maIdList), pEntry );
+}
+
+// -----------------------------------------------------------------------
+
+Accelerator::Accelerator()
+{
+ DBG_CTOR( Accelerator, NULL );
+
+ ImplInit();
+ mpData = new ImplAccelData;
+}
+
+// -----------------------------------------------------------------------
+
+Accelerator::Accelerator( const Accelerator& rAccel ) :
+ maHelpStr( rAccel.maHelpStr ),
+ maCurKeyCode( rAccel.maCurKeyCode )
+{
+ DBG_CTOR( Accelerator, NULL );
+ DBG_CHKOBJ( &rAccel, Accelerator, NULL );
+
+ ImplInit();
+ mpData = new ImplAccelData;
+ ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
+}
+
+// -----------------------------------------------------------------------
+
+Accelerator::Accelerator( const ResId& rResId )
+{
+ DBG_CTOR( Accelerator, NULL );
+
+ ImplInit();
+ mpData = new ImplAccelData;
+ rResId.SetRT( RSC_ACCEL );
+ ImplLoadRes( rResId );
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::ImplLoadRes( const ResId& rResId )
+{
+ GetRes( rResId );
+
+ maHelpStr = ReadStringRes();
+ USHORT nObjFollows = ReadShortRes();
+
+ for( USHORT i = 0; i < nObjFollows; i++ )
+ {
+ InsertItem( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Accelerator::~Accelerator()
+{
+ DBG_DTOR( Accelerator, NULL );
+
+ // AccelManager benachrichtigen, das Accelrator geloescht wurde
+ if ( mpDel )
+ *mpDel = TRUE;
+
+ ImplDeleteData();
+ delete mpData;
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::Activate()
+{
+ maActivateHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::Deactivate()
+{
+ maDeactivateHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::InsertItem( USHORT nItemId, const KeyCode& rKeyCode )
+{
+ ImplInsertAccel( nItemId, rKeyCode, TRUE, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::InsertItem( const ResId& rResId )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ USHORT nObjMask;
+ USHORT nAccelKeyId;
+ USHORT bDisable;
+ KeyCode aKeyCode;
+ BOOL bEnable = FALSE;
+ Accelerator* pAutoAccel = NULL;
+
+ GetRes( rResId.SetRT( RSC_ACCELITEM ) );
+ nObjMask = ReadShortRes();
+ nAccelKeyId = ReadShortRes();
+ bDisable = ReadShortRes();
+
+ if ( nObjMask & ACCELITEM_KEY )
+ {
+ // es wird ein neuer Kontext aufgespannt
+ RSHEADER_TYPE * pKeyCodeRes = (RSHEADER_TYPE *)GetClassRes();
+ ResId aResId( pKeyCodeRes );
+ aKeyCode = KeyCode( aResId );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+
+ if ( nObjMask & ACCELITEM_ACCEL )
+ {
+ pAutoAccel = new Accelerator( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+
+ ImplInsertAccel( nAccelKeyId, aKeyCode, !bDisable, pAutoAccel );
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::RemoveItem( USHORT nItemId )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ // Aus der Id-Liste entfernen
+ USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ {
+ USHORT nItemCount = GetItemCount();
+ do
+ {
+ ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (ULONG)nIndex );
+ if ( pEntry && pEntry->mnId == nItemId )
+ {
+ mpData->maKeyTable.Remove( pEntry->maKeyCode.GetFullKeyCode() );
+ mpData->maIdList.Remove( (ULONG)nIndex );
+
+ // AutoResAccel zerstoeren
+ if ( pEntry->mpAutoAccel )
+ delete pEntry->mpAutoAccel;
+
+ delete pEntry;
+ }
+ else
+ break;
+ }
+ while ( nIndex < nItemCount );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::RemoveItem( const KeyCode rKeyCode )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ {
+ // Aus der Id-Liste entfernen
+ USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), pEntry->mnId );
+ USHORT nItemCount = GetItemCount();
+ do
+ {
+ if ( mpData->maIdList.GetObject( (ULONG)nIndex ) == pEntry )
+ break;
+ nIndex++;
+ }
+ while ( nIndex < nItemCount );
+
+ mpData->maKeyTable.Remove( rKeyCode.GetFullKeyCode() );
+ mpData->maIdList.Remove( (ULONG)nIndex );
+
+ // AutoResAccel zerstoeren
+ if ( pEntry->mpAutoAccel )
+ delete pEntry->mpAutoAccel;
+
+ delete pEntry;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::Clear()
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplDeleteData();
+ mpData->maKeyTable.Clear();
+ mpData->maIdList.Clear();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Accelerator::GetItemCount() const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ return (USHORT)mpData->maIdList.Count();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Accelerator::GetItemId( USHORT nPos ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (ULONG)nPos );
+ if ( pEntry )
+ return pEntry->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+KeyCode Accelerator::GetItemKeyCode( USHORT nPos ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (ULONG)nPos );
+ if ( pEntry )
+ return pEntry->maKeyCode;
+ else
+ return KeyCode();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Accelerator::GetItemId( const KeyCode& rKeyCode ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ return pEntry->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+KeyCode Accelerator::GetKeyCode( USHORT nItemId ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ return mpData->maIdList.GetObject( (ULONG)nIndex )->maKeyCode;
+ else
+ return KeyCode();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Accelerator::IsIdValid( USHORT nItemId ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ USHORT nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
+ return (nIndex != ACCELENTRY_NOTFOUND);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Accelerator::IsKeyCodeValid( const KeyCode rKeyCode ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ return (pEntry != NULL);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Accelerator::Call( const KeyCode& rKeyCode, USHORT nRepeat )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ {
+ if ( pEntry->mbEnabled )
+ {
+ BOOL bDel = FALSE;
+ mnCurId = pEntry->mnId;
+ maCurKeyCode = rKeyCode;
+ mnCurRepeat = nRepeat;
+ mpDel = &bDel;
+ Select();
+ if ( !bDel )
+ {
+ mnCurId = 0;
+ maCurKeyCode = KeyCode();
+ mnCurRepeat = 0;
+ }
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::SetAccel( USHORT nItemId, Accelerator* pAccel )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ {
+ USHORT nItemCount = GetItemCount();
+ do
+ {
+ ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (ULONG)nIndex );
+ if ( pEntry->mnId != nItemId )
+ break;
+
+ pEntry->mpAccel = pAccel;
+ nIndex++;
+ }
+ while ( nIndex < nItemCount );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Accelerator* Accelerator::GetAccel( USHORT nItemId ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ USHORT nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ return mpData->maIdList.GetObject( (ULONG)nIndex )->mpAccel;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::SetAccel( const KeyCode rKeyCode, Accelerator* pAccel )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ pEntry->mpAccel = pAccel;
+}
+
+// -----------------------------------------------------------------------
+
+Accelerator* Accelerator::GetAccel( const KeyCode rKeyCode ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ return pEntry->mpAccel;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::EnableItem( USHORT nItemId, BOOL bEnable )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ USHORT nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ {
+ USHORT nItemCount = GetItemCount();
+ do
+ {
+ ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (ULONG)nIndex );
+ if ( pEntry->mnId != nItemId )
+ break;
+
+ pEntry->mbEnabled = bEnable;
+ nIndex++;
+ }
+ while ( nIndex < nItemCount );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Accelerator::IsItemEnabled( USHORT nItemId ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ USHORT nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
+ if ( nIndex != ACCELENTRY_NOTFOUND )
+ return mpData->maIdList.GetObject( (ULONG)nIndex )->mbEnabled;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Accelerator::EnableItem( const KeyCode rKeyCode, BOOL bEnable )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ pEntry->mbEnabled = bEnable;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Accelerator::IsItemEnabled( const KeyCode rKeyCode ) const
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+
+ ImplAccelEntry* pEntry = ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ return pEntry->mbEnabled;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Accelerator& Accelerator::operator=( const Accelerator& rAccel )
+{
+ DBG_CHKTHIS( Accelerator, NULL );
+ DBG_CHKOBJ( &rAccel, Accelerator, NULL );
+
+ // Neue Daten zuweisen
+ maHelpStr = rAccel.maHelpStr;
+ maCurKeyCode = KeyCode();
+ mnCurId = 0;
+ mnCurRepeat = 0;
+ mbIsCancel = FALSE;
+
+ // Tabellen loeschen und kopieren
+ ImplDeleteData();
+ mpData->maKeyTable.Clear();
+ mpData->maIdList.Clear();
+ ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
+
+ return *this;
+}
diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx
new file mode 100644
index 000000000000..2cf39ae4cd9c
--- /dev/null
+++ b/vcl/source/window/accmgr.cxx
@@ -0,0 +1,318 @@
+/*************************************************************************
+ *
+ * $RCSfile: accmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_ACCMGR_CXX
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_ACCEL_H
+#include <accel.h>
+#endif
+#ifndef _SV_ACCEL_HXX
+#include <accel.hxx>
+#endif
+#ifndef _SV_ACCMGR_HXX
+#include <accmgr.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+DECLARE_LIST( ImplAccelList, Accelerator* );
+
+// =======================================================================
+
+DBG_NAMEEX( Accelerator );
+
+// =======================================================================
+
+ImplAccelManager::~ImplAccelManager()
+{
+ if ( mpAccelList )
+ delete mpAccelList;
+ if ( mpSequenceList )
+ delete mpSequenceList;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplAccelManager::InsertAccel( Accelerator* pAccel )
+{
+ if ( !mpAccelList )
+ mpAccelList = new ImplAccelList;
+ else
+ {
+ // Gibts den schon ?
+ if ( mpAccelList->GetPos( pAccel ) != LIST_ENTRY_NOTFOUND )
+ return FALSE;
+ }
+
+ // Am Anfang der Liste einfuegen
+ mpAccelList->Insert( pAccel, (ULONG)0 );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
+{
+ // Haben wir ueberhaupt eine Liste ?
+ if ( !mpAccelList )
+ return;
+
+ // Raus damit
+ mpAccelList->Remove( pAccel );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplAccelManager::EndSequence( BOOL bCancel )
+{
+ // Sind wir ueberhaupt in einer Sequenz ?
+ if ( !mpSequenceList )
+ return;
+
+ // Alle Deactivate-Handler der Acceleratoren in der Sequenz rufen
+ Accelerator* pTempAccel = mpSequenceList->First();
+ while( pTempAccel )
+ {
+ BOOL bDel = FALSE;
+ pTempAccel->mbIsCancel = bCancel;
+ pTempAccel->mpDel = &bDel;
+ pTempAccel->Deactivate();
+ if ( !bDel )
+ {
+ pTempAccel->mbIsCancel = FALSE;
+ pTempAccel->mpDel = NULL;
+ }
+
+ pTempAccel = mpSequenceList->Next();
+ }
+
+ // Sequenz-Liste loeschen
+ delete mpSequenceList;
+ mpSequenceList = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, USHORT nRepeat )
+{
+ Accelerator* pAccel;
+
+ // Haben wir ueberhaupt Acceleratoren ??
+ if ( !mpAccelList )
+ return FALSE;
+ if ( !mpAccelList->Count() )
+ return FALSE;
+
+ // Sind wir in einer Sequenz ?
+ if ( mpSequenceList )
+ {
+ pAccel = mpSequenceList->GetObject( 0 );
+ DBG_CHKOBJ( pAccel, Accelerator, NULL );
+
+ // Nicht Gefunden ?
+ if ( !pAccel )
+ {
+ // Sequenz abbrechen
+ FlushAccel();
+ return FALSE;
+ }
+
+ // Ist der Eintrag da drin ?
+ ImplAccelEntry* pEntry = pAccel->ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ {
+ Accelerator* pNextAccel = pEntry->mpAccel;
+
+ // Ist da ein Accelerator hinter ?
+ if ( pNextAccel )
+ {
+ DBG_CHKOBJ( pNextAccel, Accelerator, NULL );
+
+ mpSequenceList->Insert( pNextAccel, (ULONG)0 );
+
+ // Activate-Handler vom Neuen rufen
+ pNextAccel->Activate();
+ return TRUE;
+ }
+ else
+ {
+ // Hat ihn schon !
+ if ( pEntry->mbEnabled )
+ {
+ // Sequence beenden (Deactivate-Handler vorher rufen)
+ EndSequence();
+
+ // Dem Accelerator das aktuelle Item setzen
+ // und Handler rufen
+ BOOL bDel = FALSE;
+ pAccel->maCurKeyCode = rKeyCode;
+ pAccel->mnCurId = pEntry->mnId;
+ pAccel->mnCurRepeat = nRepeat;
+ pAccel->mpDel = &bDel;
+ pAccel->Select();
+
+ // Hat Accel den Aufruf ueberlebt
+ if ( !bDel )
+ {
+ DBG_CHKOBJ( pAccel, Accelerator, NULL );
+ pAccel->maCurKeyCode = KeyCode();
+ pAccel->mnCurId = 0;
+ pAccel->mnCurRepeat = 0;
+ pAccel->mpDel = NULL;
+ }
+
+ return TRUE;
+ }
+ else
+ {
+ // Sequenz abbrechen, weil Acceleraor disabled
+ // Taste wird weitergeleitet (ans System)
+ FlushAccel();
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ // Sequenz abbrechen wegen falscher Taste
+ FlushAccel();
+ return FALSE;
+ }
+ }
+
+ // Durch die Liste der Acceleratoren wuehlen
+ pAccel = mpAccelList->First();
+ while ( pAccel )
+ {
+ DBG_CHKOBJ( pAccel, Accelerator, NULL );
+
+ // Ist der Eintrag da drin ?
+ ImplAccelEntry* pEntry = pAccel->ImplGetAccelData( rKeyCode );
+ if ( pEntry )
+ {
+ Accelerator* pNextAccel = pEntry->mpAccel;
+
+ // Ist da ein Accelerator hinter ?
+ if ( pNextAccel )
+ {
+ DBG_CHKOBJ( pNextAccel, Accelerator, NULL );
+
+ // Sequenz-Liste erzeugen
+ mpSequenceList = new ImplAccelList;
+ mpSequenceList->Insert( pAccel, (ULONG)0 );
+ mpSequenceList->Insert( pNextAccel, (ULONG)0 );
+
+ // Activate-Handler vom Neuen rufen
+ pNextAccel->Activate();
+
+ return TRUE;
+ }
+ else
+ {
+ // Hat ihn schon !
+ if ( pEntry->mbEnabled )
+ {
+ // Activate/Deactivate-Handler vorher rufen
+ pAccel->Activate();
+ pAccel->Deactivate();
+
+ // Dem Accelerator das aktuelle Item setzen
+ // und Handler rufen
+ BOOL bDel = FALSE;
+ pAccel->maCurKeyCode = rKeyCode;
+ pAccel->mnCurId = pEntry->mnId;
+ pAccel->mnCurRepeat = nRepeat;
+ pAccel->mpDel = &bDel;
+ pAccel->Select();
+
+ // Hat Accel den Aufruf ueberlebt
+ if ( !bDel )
+ {
+ DBG_CHKOBJ( pAccel, Accelerator, NULL );
+ pAccel->maCurKeyCode = KeyCode();
+ pAccel->mnCurId = 0;
+ pAccel->mnCurRepeat = 0;
+ pAccel->mpDel = NULL;
+ }
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
+ }
+
+ // Nicht gefunden, vielleicht im naechsten Accelerator
+ pAccel = mpAccelList->Next();
+ }
+
+ return FALSE;
+}
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
new file mode 100644
index 000000000000..651306cf1e3b
--- /dev/null
+++ b/vcl/source/window/brdwin.cxx
@@ -0,0 +1,3808 @@
+/*************************************************************************
+ *
+ * $RCSfile: brdwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BRDWIN_CXX
+
+#ifdef REMOTE_APPSERVER
+#include <rmwindow.hxx>
+#endif
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_SYSWIN_HXX
+#include <syswin.hxx>
+#endif
+#ifndef _SV_DOCKWIN_HXX
+#include <dockwin.hxx>
+#endif
+#ifndef _SV_FLOATWIN_HXX
+#include <floatwin.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_GRADIENT_HXX
+#include <gradient.hxx>
+#endif
+#ifndef _SV_IMAGE_HXX
+#include <image.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+
+#include <tools/debug.hxx>
+
+#include <rvp.hxx>
+
+#pragma hdrstop
+
+using namespace ::com::sun::star::uno;
+
+// =======================================================================
+
+// -----------------------
+// - ImplBorderFrameData -
+// -----------------------
+
+struct ImplBorderFrameData
+{
+ ImplBorderWindow* mpBorderWindow;
+ OutputDevice* mpOutDev;
+ Rectangle maTitleRect;
+ Rectangle maPinRect;
+ Rectangle maCloseRect;
+ Rectangle maRollRect;
+ Rectangle maDockRect;
+ Rectangle maHideRect;
+ Rectangle maHelpRect;
+ Point maMouseOff;
+ long mnWidth;
+ long mnHeight;
+ long mnTrackX;
+ long mnTrackY;
+ long mnTrackWidth;
+ long mnTrackHeight;
+ long mnLeftBorder;
+ long mnTopBorder;
+ long mnRightBorder;
+ long mnBottomBorder;
+ long mnNoTitleTop;
+ long mnBorderSize;
+ long mnTitleHeight;
+ long mnTitleOff;
+ USHORT mnHitTest;
+ USHORT mnPinState;
+ USHORT mnCloseState;
+ USHORT mnRollState;
+ USHORT mnDockState;
+ USHORT mnHideState;
+ USHORT mnHelpState;
+ USHORT mnTitleType;
+ BOOL mbFloatWindow;
+ BOOL mbDragFull;
+};
+
+// =======================================================================
+
+static void ImplGetPinImage( USHORT nStyle, BOOL bPinIn, Image& rImage )
+{
+ // ImageListe laden, wenn noch nicht vorhanden
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maCtrlData.mpPinImgList )
+ {
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_PIN, ImplGetResMgr() ) );
+ pSVData->maCtrlData.mpPinImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
+ }
+
+ // Image ermitteln und zurueckgeben
+ USHORT nId;
+ if ( nStyle & BUTTON_DRAW_PRESSED )
+ {
+ if ( bPinIn )
+ nId = 4;
+ else
+ nId = 3;
+ }
+ else
+ {
+ if ( bPinIn )
+ nId = 2;
+ else
+ nId = 1;
+ }
+ rImage = pSVData->maCtrlData.mpPinImgList->GetImage( nId );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCalcSymbolRect( Rectangle& rRect )
+{
+ // Den Rand den der Button in der nicht Default-Darstellung freilaesst,
+ // dazuaddieren, da wir diesen bei kleinen Buttons mit ausnutzen wollen
+ rRect.Left()--;
+ rRect.Top()--;
+ rRect.Right()++;
+ rRect.Bottom()++;
+
+ // Zwischen dem Symbol und dem Button-Rand lassen wir 5% Platz
+ long nExtraWidth = ((rRect.GetWidth()*50)+500)/1000;
+ long nExtraHeight = ((rRect.GetHeight()*50)+500)/1000;
+ rRect.Left() += nExtraWidth;
+ rRect.Right() -= nExtraWidth;
+ rRect.Top() += nExtraHeight;
+ rRect.Bottom() -= nExtraHeight;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawBrdWinSymbol( OutputDevice* pDev,
+ const Rectangle& rRect, SymbolType eSymbol )
+{
+ // Zwischen dem Symbol und dem Button lassen wir 5% Platz
+ DecorationView aDecoView( pDev );
+ Rectangle aTempRect = rRect;
+ Window::ImplCalcSymbolRect( aTempRect );
+ aDecoView.DrawSymbol( aTempRect, eSymbol,
+ pDev->GetSettings().GetStyleSettings().GetButtonTextColor(), 0 );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawBrdWinSymbolButton( OutputDevice* pDev,
+ const Rectangle& rRect,
+ SymbolType eSymbol, USHORT nState )
+{
+ DecorationView aDecoView( pDev );
+ Rectangle aTempRect = aDecoView.DrawButton( rRect, nState );
+ ImplDrawBrdWinSymbol( pDev, aTempRect, eSymbol );
+}
+
+// =======================================================================
+
+// ------------------------
+// - ImplBorderWindowView -
+// ------------------------
+
+class ImplBorderWindowView
+{
+public:
+ virtual ~ImplBorderWindowView();
+
+ virtual BOOL MouseMove( const MouseEvent& rMEvt );
+ virtual BOOL MouseButtonDown( const MouseEvent& rMEvt );
+ virtual BOOL Tracking( const TrackingEvent& rTEvt );
+ virtual USHORT RequestHelp( const Point& rPos, Rectangle& rHelpRect );
+
+ virtual void Init( OutputDevice* pDev, long nWidth, long nHeight ) = 0;
+ virtual void GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const = 0;
+ virtual long CalcTitleWidth() const = 0;
+ virtual void DrawWindow( USHORT nDrawFlags ) = 0;
+
+ void ImplInitTitle( ImplBorderFrameData* pData );
+ USHORT ImplHitTest( ImplBorderFrameData* pData, const Point& rPos );
+ BOOL ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
+ BOOL ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt );
+ BOOL ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt );
+ USHORT ImplRequestHelp( ImplBorderFrameData* pData, const Point& rPos, Rectangle& rHelpRect );
+ long ImplCalcTitleWidth( const ImplBorderFrameData* pData ) const;
+};
+
+// -----------------------------------------------------------------------
+
+ImplBorderWindowView::~ImplBorderWindowView()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplBorderWindowView::MouseMove( const MouseEvent& rMEvt )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplBorderWindowView::Tracking( const TrackingEvent& rTEvt )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplBorderWindowView::RequestHelp( const Point& rPos, Rectangle& rHelpRect )
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindowView::ImplInitTitle( ImplBorderFrameData* pData )
+{
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+
+ if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) ||
+ (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
+ {
+ pData->mnTitleType = BORDERWINDOW_TITLE_NONE;
+ pData->mnTitleHeight = 0;
+ }
+ else
+ {
+ const StyleSettings& rStyleSettings = pData->mpOutDev->GetSettings().GetStyleSettings();
+ if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF )
+ pData->mnTitleHeight = rStyleSettings.GetTearOffTitleHeight();
+ else
+ {
+ if ( pData->mnTitleType == BORDERWINDOW_TITLE_SMALL )
+ {
+ pBorderWindow->SetPointFont( rStyleSettings.GetFloatTitleFont() );
+ pData->mnTitleHeight = rStyleSettings.GetFloatTitleHeight();
+ }
+ else // pData->mnTitleType == BORDERWINDOW_TITLE_NORMAL
+ {
+ pBorderWindow->SetPointFont( rStyleSettings.GetTitleFont() );
+ pData->mnTitleHeight = rStyleSettings.GetTitleHeight();
+ }
+ long nTextHeight = pBorderWindow->GetTextHeight();
+ if ( nTextHeight > pData->mnTitleHeight )
+ pData->mnTitleHeight = nTextHeight;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplBorderWindowView::ImplHitTest( ImplBorderFrameData* pData, const Point& rPos )
+{
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+
+ if ( pData->maTitleRect.IsInside( rPos ) )
+ {
+ if ( pData->maCloseRect.IsInside( rPos ) )
+ return BORDERWINDOW_HITTEST_CLOSE;
+ else if ( pData->maRollRect.IsInside( rPos ) )
+ return BORDERWINDOW_HITTEST_ROLL;
+ else if ( pData->maDockRect.IsInside( rPos ) )
+ return BORDERWINDOW_HITTEST_DOCK;
+ else if ( pData->maHideRect.IsInside( rPos ) )
+ return BORDERWINDOW_HITTEST_HIDE;
+ else if ( pData->maHelpRect.IsInside( rPos ) )
+ return BORDERWINDOW_HITTEST_HELP;
+ else if ( pData->maPinRect.IsInside( rPos ) )
+ return BORDERWINDOW_HITTEST_PIN;
+ else
+ return BORDERWINDOW_HITTEST_TITLE;
+ }
+
+ if ( (pBorderWindow->GetStyle() & WB_SIZEABLE) &&
+ !pBorderWindow->mbRollUp )
+ {
+ long nSizeWidth = pData->mnNoTitleTop+pData->mnTitleHeight;
+ if ( nSizeWidth < 16 )
+ nSizeWidth = 16;
+ if ( rPos.X() < pData->mnLeftBorder )
+ {
+ if ( rPos.Y() < nSizeWidth )
+ return BORDERWINDOW_HITTEST_TOPLEFT;
+ else if ( rPos.Y() >= pData->mnHeight-nSizeWidth )
+ return BORDERWINDOW_HITTEST_BOTTOMLEFT;
+ else
+ return BORDERWINDOW_HITTEST_LEFT;
+ }
+ else if ( rPos.X() >= pData->mnWidth-pData->mnRightBorder )
+ {
+ if ( rPos.Y() < nSizeWidth )
+ return BORDERWINDOW_HITTEST_TOPRIGHT;
+ else if ( rPos.Y() >= pData->mnHeight-nSizeWidth )
+ return BORDERWINDOW_HITTEST_BOTTOMRIGHT;
+ else
+ return BORDERWINDOW_HITTEST_RIGHT;
+ }
+ else if ( rPos.Y() < pData->mnNoTitleTop )
+ {
+ if ( rPos.X() < nSizeWidth )
+ return BORDERWINDOW_HITTEST_TOPLEFT;
+ else if ( rPos.X() >= pData->mnWidth-nSizeWidth )
+ return BORDERWINDOW_HITTEST_TOPRIGHT;
+ else
+ return BORDERWINDOW_HITTEST_TOP;
+ }
+ else if ( rPos.Y() >= pData->mnHeight-pData->mnBottomBorder )
+ {
+ if ( rPos.X() < nSizeWidth )
+ return BORDERWINDOW_HITTEST_BOTTOMLEFT;
+ else if ( rPos.X() >= pData->mnWidth-nSizeWidth )
+ return BORDERWINDOW_HITTEST_BOTTOMRIGHT;
+ else
+ return BORDERWINDOW_HITTEST_BOTTOM;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplBorderWindowView::ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt )
+{
+ Point aMousePos = rMEvt.GetPosPixel();
+ USHORT nHitTest = ImplHitTest( pData, aMousePos );
+ PointerStyle ePtrStyle = POINTER_ARROW;
+ if ( nHitTest & BORDERWINDOW_HITTEST_LEFT )
+ ePtrStyle = POINTER_WINDOW_WSIZE;
+ else if ( nHitTest & BORDERWINDOW_HITTEST_RIGHT )
+ ePtrStyle = POINTER_WINDOW_ESIZE;
+ else if ( nHitTest & BORDERWINDOW_HITTEST_TOP )
+ ePtrStyle = POINTER_WINDOW_NSIZE;
+ else if ( nHitTest & BORDERWINDOW_HITTEST_BOTTOM )
+ ePtrStyle = POINTER_WINDOW_SSIZE;
+ else if ( nHitTest & BORDERWINDOW_HITTEST_TOPLEFT )
+ ePtrStyle = POINTER_WINDOW_NWSIZE;
+ else if ( nHitTest & BORDERWINDOW_HITTEST_BOTTOMRIGHT )
+ ePtrStyle = POINTER_WINDOW_SESIZE;
+ else if ( nHitTest & BORDERWINDOW_HITTEST_TOPRIGHT )
+ ePtrStyle = POINTER_WINDOW_NESIZE;
+ else if ( nHitTest & BORDERWINDOW_HITTEST_BOTTOMLEFT )
+ ePtrStyle = POINTER_WINDOW_SWSIZE;
+ pData->mpBorderWindow->SetPointer( Pointer( ePtrStyle ) );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt )
+{
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+
+ if ( rMEvt.IsLeft() || rMEvt.IsRight() )
+ {
+ pData->maMouseOff = rMEvt.GetPosPixel();
+ pData->mnHitTest = ImplHitTest( pData, pData->maMouseOff );
+ USHORT nDragFullTest = 0;
+ if ( pData->mnHitTest )
+ {
+ BOOL bTracking = TRUE;
+ BOOL bHitTest = TRUE;
+
+ if ( pData->mnHitTest & BORDERWINDOW_HITTEST_CLOSE )
+ {
+ pData->mnCloseState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_CLOSE );
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_ROLL )
+ {
+ pData->mnRollState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_ROLL );
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_DOCK )
+ {
+ pData->mnDockState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_DOCK );
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HIDE )
+ {
+ pData->mnHideState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HIDE );
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HELP )
+ {
+ pData->mnHelpState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HELP );
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_PIN )
+ {
+ pData->mnPinState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_PIN );
+ }
+ else
+ {
+ if ( rMEvt.GetClicks() == 1 )
+ {
+ // Bei DockingWindows wollen wir Docking
+ if ( (pData->mnHitTest & BORDERWINDOW_HITTEST_TITLE) &&
+ pBorderWindow->ImplGetClientWindow()->ImplGetClientWindow() &&
+ pBorderWindow->ImplGetClientWindow()->ImplGetClientWindow()->ImplIsDockingWindow() )
+ {
+ if ( !pBorderWindow->mbRollUp )
+ {
+ Point aMousePos = pData->maMouseOff;
+ aMousePos.X() -= pData->mnLeftBorder;
+ aMousePos.Y() -= pData->mnTopBorder;
+ bTracking = !(((DockingWindow*)(pBorderWindow->ImplGetClientWindow()->ImplGetClientWindow()))->ImplStartDocking( aMousePos ));
+ }
+ }
+
+ if ( bTracking )
+ {
+ Point aPos = pBorderWindow->GetPosPixel();
+ Size aSize = pBorderWindow->GetOutputSizePixel();
+ pData->mnTrackX = aPos.X();
+ pData->mnTrackY = aPos.Y();
+ pData->mnTrackWidth = aSize.Width();
+ pData->mnTrackHeight = aSize.Height();
+
+ if ( pData->mnHitTest & BORDERWINDOW_HITTEST_TITLE )
+ nDragFullTest = DRAGFULL_OPTION_WINDOWMOVE;
+ else
+ nDragFullTest = DRAGFULL_OPTION_WINDOWSIZE;
+ }
+ }
+ else
+ {
+ bTracking = FALSE;
+
+ if ( (pData->mnHitTest & BORDERWINDOW_DRAW_TITLE) &&
+ ((rMEvt.GetClicks() % 2) == 0) )
+ {
+ pData->mnHitTest = 0;
+ bHitTest = FALSE;
+
+ if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
+ {
+ SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow());
+ if ( pBorderWindow->mbDockBtn )
+ pClientWindow->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ else if ( pBorderWindow->GetStyle() & WB_ROLLABLE )
+ {
+ if ( pClientWindow->IsRollUp() )
+ pClientWindow->RollDown();
+ else
+ pClientWindow->RollUp();
+ pClientWindow->Roll();
+ }
+ }
+ }
+ }
+ }
+
+ if ( bTracking )
+ {
+ pData->mbDragFull = FALSE;
+ if ( nDragFullTest )
+ {
+ if ( pBorderWindow->GetSettings().GetStyleSettings().GetDragFullOptions() & nDragFullTest )
+ pData->mbDragFull = TRUE;
+ else
+ {
+ pBorderWindow->ImplUpdateAll();
+ pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll();
+ }
+ }
+ pBorderWindow->StartTracking();
+ }
+ else if ( bHitTest )
+ pData->mnHitTest = 0;
+ }
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplBorderWindowView::ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt )
+{
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ USHORT nHitTest = pData->mnHitTest;
+ pData->mnHitTest = 0;
+
+ if ( nHitTest & BORDERWINDOW_HITTEST_CLOSE )
+ {
+ if ( pData->mnCloseState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnCloseState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_CLOSE );
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
+ ((SystemWindow*)pBorderWindow->ImplGetClientWindow())->Close();
+ }
+ }
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_ROLL )
+ {
+ if ( pData->mnRollState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnRollState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_ROLL );
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
+ {
+ SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow());
+ if ( pClientWindow->IsRollUp() )
+ pClientWindow->RollDown();
+ else
+ pClientWindow->RollUp();
+ pClientWindow->Roll();
+ }
+ }
+ }
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_DOCK )
+ {
+ if ( pData->mnDockState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnDockState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_DOCK );
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
+ {
+ SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow());
+ pClientWindow->TitleButtonClick( TITLE_BUTTON_DOCKING );
+ }
+ }
+ }
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_HIDE )
+ {
+ if ( pData->mnHideState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnHideState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HIDE );
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
+ {
+ SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow());
+ pClientWindow->TitleButtonClick( TITLE_BUTTON_HIDE );
+ }
+ }
+ }
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_HELP )
+ {
+ if ( pData->mnHelpState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnHelpState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HELP );
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ }
+ }
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_PIN )
+ {
+ if ( pData->mnPinState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnPinState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_PIN );
+
+ // Bei Abbruch kein Click-Handler rufen
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
+ {
+ SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow());
+ pClientWindow->SetPin( !pClientWindow->IsPined() );
+ pClientWindow->Pin();
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( pData->mbDragFull )
+ {
+ // Bei Abbruch alten Zustand wieder herstellen
+ if ( rTEvt.IsTrackingCanceled() )
+ pBorderWindow->SetPosSizePixel( Point( pData->mnTrackX, pData->mnTrackY ), Size( pData->mnTrackWidth, pData->mnTrackHeight ) );
+ }
+ else
+ {
+ pBorderWindow->HideTracking();
+ if ( !rTEvt.IsTrackingCanceled() )
+ pBorderWindow->SetPosSizePixel( Point( pData->mnTrackX, pData->mnTrackY ), Size( pData->mnTrackWidth, pData->mnTrackHeight ) );
+ }
+
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ if ( pBorderWindow->ImplGetClientWindow()->ImplIsFloatingWindow() )
+ {
+ if ( ((FloatingWindow*)pBorderWindow->ImplGetClientWindow())->IsInPopupMode() )
+ ((FloatingWindow*)pBorderWindow->ImplGetClientWindow())->EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF );
+ }
+ }
+ }
+ }
+ else if ( !rTEvt.GetMouseEvent().IsSynthetic() )
+ {
+ Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+
+ if ( pData->mnHitTest & BORDERWINDOW_HITTEST_CLOSE )
+ {
+ if ( pData->maCloseRect.IsInside( aMousePos ) )
+ {
+ if ( !(pData->mnCloseState & BUTTON_DRAW_PRESSED) )
+ {
+ pData->mnCloseState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_CLOSE );
+ }
+ }
+ else
+ {
+ if ( pData->mnCloseState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnCloseState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_CLOSE );
+ }
+ }
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_ROLL )
+ {
+ if ( pData->maRollRect.IsInside( aMousePos ) )
+ {
+ if ( !(pData->mnRollState & BUTTON_DRAW_PRESSED) )
+ {
+ pData->mnRollState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_ROLL );
+ }
+ }
+ else
+ {
+ if ( pData->mnRollState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnRollState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_ROLL );
+ }
+ }
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_DOCK )
+ {
+ if ( pData->maDockRect.IsInside( aMousePos ) )
+ {
+ if ( !(pData->mnDockState & BUTTON_DRAW_PRESSED) )
+ {
+ pData->mnDockState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_DOCK );
+ }
+ }
+ else
+ {
+ if ( pData->mnDockState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnDockState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_DOCK );
+ }
+ }
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HIDE )
+ {
+ if ( pData->maHideRect.IsInside( aMousePos ) )
+ {
+ if ( !(pData->mnHideState & BUTTON_DRAW_PRESSED) )
+ {
+ pData->mnHideState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HIDE );
+ }
+ }
+ else
+ {
+ if ( pData->mnHideState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnHideState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HIDE );
+ }
+ }
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HELP )
+ {
+ if ( pData->maHelpRect.IsInside( aMousePos ) )
+ {
+ if ( !(pData->mnHelpState & BUTTON_DRAW_PRESSED) )
+ {
+ pData->mnHelpState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HELP );
+ }
+ }
+ else
+ {
+ if ( pData->mnHelpState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnHelpState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_HELP );
+ }
+ }
+ }
+ else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_PIN )
+ {
+ if ( pData->maPinRect.IsInside( aMousePos ) )
+ {
+ if ( !(pData->mnPinState & BUTTON_DRAW_PRESSED) )
+ {
+ pData->mnPinState |= BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_PIN );
+ }
+ }
+ else
+ {
+ if ( pData->mnPinState & BUTTON_DRAW_PRESSED )
+ {
+ pData->mnPinState &= ~BUTTON_DRAW_PRESSED;
+ DrawWindow( BORDERWINDOW_DRAW_PIN );
+ }
+ }
+ }
+ else
+ {
+ Point aFrameMousePos = pBorderWindow->ImplOutputToFrame( aMousePos );
+ Size aFrameSize = pBorderWindow->ImplGetFrameWindow()->GetOutputSizePixel();
+ if ( aFrameMousePos.X() < 0 )
+ aFrameMousePos.X() = 0;
+ if ( aFrameMousePos.Y() < 0 )
+ aFrameMousePos.Y() = 0;
+ if ( aFrameMousePos.X() > aFrameSize.Width()-1 )
+ aFrameMousePos.X() = aFrameSize.Width()-1;
+ if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
+ aFrameMousePos.Y() = aFrameSize.Height()-1;
+ aMousePos = pBorderWindow->ImplFrameToOutput( aFrameMousePos );
+
+ aMousePos.X() -= pData->maMouseOff.X();
+ aMousePos.Y() -= pData->maMouseOff.Y();
+
+ if ( pData->mnHitTest & BORDERWINDOW_HITTEST_TITLE )
+ {
+ Point aPos = pBorderWindow->GetPosPixel();
+ aPos.X() += aMousePos.X();
+ aPos.Y() += aMousePos.Y();
+ if ( pData->mbDragFull )
+ {
+ pBorderWindow->SetPosPixel( aPos );
+ pBorderWindow->ImplUpdateAll();
+ pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll();
+ }
+ else
+ {
+ pData->mnTrackX = aPos.X();
+ pData->mnTrackY = aPos.Y();
+ pBorderWindow->ShowTracking( Rectangle( pBorderWindow->ScreenToOutputPixel( aPos ), pBorderWindow->GetOutputSizePixel() ), SHOWTRACK_BIG );
+ }
+ }
+ else
+ {
+ Point aPos = pBorderWindow->GetPosPixel();
+ Size aSize = pBorderWindow->GetSizePixel();
+ Rectangle aNewRect( aPos, aSize );
+ long nOldWidth = aSize.Width();
+ long nOldHeight = aSize.Height();
+ long nBorderWidth = pData->mnLeftBorder+pData->mnRightBorder;
+ long nBorderHeight = pData->mnTopBorder+pData->mnBottomBorder;
+ long nMinWidth = pBorderWindow->mnMinWidth+nBorderWidth;
+ long nMinHeight = pBorderWindow->mnMinHeight+nBorderHeight;
+ long nMinWidth2 = nBorderWidth;
+
+ if ( pData->mnTitleHeight )
+ {
+ nMinWidth2 += 4;
+
+ if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
+ nMinWidth2 += pData->maCloseRect.GetWidth();
+ }
+ if ( nMinWidth2 > nMinWidth )
+ nMinWidth = nMinWidth2;
+ if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_LEFT | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_BOTTOMLEFT) )
+ {
+ aNewRect.Left() += aMousePos.X();
+ if ( aNewRect.GetWidth() < nMinWidth )
+ aNewRect.Left() = aNewRect.Right()-nMinWidth+1;
+ }
+ else if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_RIGHT | BORDERWINDOW_HITTEST_TOPRIGHT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) )
+ {
+ aNewRect.Right() += aMousePos.X();
+ if ( aNewRect.GetWidth() < nMinWidth )
+ aNewRect.Right() = aNewRect.Left()+nMinWidth+1;
+ }
+ if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_TOP | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_TOPRIGHT) )
+ {
+ aNewRect.Top() += aMousePos.Y();
+ if ( aNewRect.GetHeight() < nMinHeight )
+ aNewRect.Top() = aNewRect.Bottom()-nMinHeight+1;
+ }
+ else if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_BOTTOM | BORDERWINDOW_HITTEST_BOTTOMLEFT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) )
+ {
+ aNewRect.Bottom() += aMousePos.Y();
+ if ( aNewRect.GetHeight() < nMinHeight )
+ aNewRect.Bottom() = aNewRect.Top()+nMinHeight+1;
+ }
+
+ // Bei SystemWindows rufen wir den Resizing-Handler
+ if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
+ {
+ // Groesse fuer Resizing-Aufruf anpassen
+ aSize = aNewRect.GetSize();
+ aSize.Width() -= nBorderWidth;
+ aSize.Height() -= nBorderHeight;
+ ((SystemWindow*)pBorderWindow->ImplGetClientWindow())->Resizing( aSize );
+ aSize.Width() += nBorderWidth;
+ aSize.Height() += nBorderHeight;
+ if ( aSize.Width() < nMinWidth )
+ aSize.Width() = nMinWidth;
+ if ( aSize.Height() < nMinHeight )
+ aSize.Height() = nMinHeight;
+ if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_LEFT | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_BOTTOMLEFT) )
+ aNewRect.Left() = aNewRect.Right()-aSize.Width()+1;
+ else
+ aNewRect.Right() = aNewRect.Left()+aSize.Width()-1;
+ if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_TOP | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_TOPRIGHT) )
+ aNewRect.Top() = aNewRect.Bottom()-aSize.Height()+1;
+ else
+ aNewRect.Bottom() = aNewRect.Top()+aSize.Height()-1;
+ }
+
+ if ( pData->mbDragFull )
+ {
+ pBorderWindow->SetPosSizePixel( aNewRect.Left(), aNewRect.Top(),
+ aNewRect.GetWidth(), aNewRect.GetHeight(), WINDOW_POSSIZE_POSSIZE );
+ pBorderWindow->ImplUpdateAll();
+ pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll();
+ if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_RIGHT | BORDERWINDOW_HITTEST_TOPRIGHT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) )
+ pData->maMouseOff.X() += aNewRect.GetWidth()-nOldWidth;
+ if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_BOTTOM | BORDERWINDOW_HITTEST_BOTTOMLEFT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) )
+ pData->maMouseOff.Y() += aNewRect.GetHeight()-nOldHeight;
+ }
+ else
+ {
+ pData->mnTrackX = aNewRect.Left();
+ pData->mnTrackY = aNewRect.Top();
+ pData->mnTrackWidth = aNewRect.GetWidth();
+ pData->mnTrackHeight = aNewRect.GetHeight();
+ pBorderWindow->ShowTracking( Rectangle( pBorderWindow->ScreenToOutputPixel( aNewRect.TopLeft() ), aNewRect.GetSize() ), SHOWTRACK_BIG );
+ }
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplBorderWindowView::ImplRequestHelp( ImplBorderFrameData* pData,
+ const Point& rPos,
+ Rectangle& rHelpRect )
+{
+ USHORT nHelpId = 0;
+ USHORT nHitTest = ImplHitTest( pData, rPos );
+ if ( nHitTest )
+ {
+ if ( nHitTest & BORDERWINDOW_HITTEST_CLOSE )
+ {
+ nHelpId = SV_HELPTEXT_CLOSE;
+ rHelpRect = pData->maCloseRect;
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_ROLL )
+ {
+ if ( pData->mpBorderWindow->mbRollUp )
+ nHelpId = SV_HELPTEXT_ROLLDOWN;
+ else
+ nHelpId = SV_HELPTEXT_ROLLUP;
+ rHelpRect = pData->maRollRect;
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_DOCK )
+ {
+ nHelpId = SV_HELPTEXT_MAXIMIZE;
+ rHelpRect = pData->maDockRect;
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_HIDE )
+ {
+ nHelpId = SV_HELPTEXT_MINIMIZE;
+ rHelpRect = pData->maHideRect;
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_HELP )
+ {
+ nHelpId = SV_HELPTEXT_HELP;
+ rHelpRect = pData->maHelpRect;
+ }
+ else if ( nHitTest & BORDERWINDOW_HITTEST_PIN )
+ {
+ nHelpId = SV_HELPTEXT_ALWAYSVISIBLE;
+ rHelpRect = pData->maPinRect;
+ }
+ }
+
+ return nHelpId;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplBorderWindowView::ImplCalcTitleWidth( const ImplBorderFrameData* pData ) const
+{
+ // kein sichtbarer Title, dann auch keine Breite
+ if ( !pData->mnTitleHeight )
+ return 0;
+
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+ long nTitleWidth = pBorderWindow->GetTextWidth( pBorderWindow->GetText() )+6;
+ nTitleWidth += pData->maPinRect.GetWidth();
+ nTitleWidth += pData->maCloseRect.GetWidth();
+ nTitleWidth += pData->maRollRect.GetWidth();
+ nTitleWidth += pData->maDockRect.GetWidth();
+ nTitleWidth += pData->maHideRect.GetWidth();
+ nTitleWidth += pData->maHelpRect.GetWidth();
+ nTitleWidth += pData->mnLeftBorder+pData->mnRightBorder;
+ return nTitleWidth;
+}
+
+// =======================================================================
+
+// --------------------------
+// - ImplNoBorderWindowView -
+// --------------------------
+
+class ImplNoBorderWindowView : public ImplBorderWindowView
+{
+public:
+ ImplNoBorderWindowView( ImplBorderWindow* pBorderWindow );
+
+ virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
+ virtual void GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const;
+ virtual long CalcTitleWidth() const;
+ virtual void DrawWindow( USHORT nDrawFlags );
+};
+
+// =======================================================================
+
+ImplNoBorderWindowView::ImplNoBorderWindowView( ImplBorderWindow* pBorderWindow )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ImplNoBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ImplNoBorderWindowView::GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const
+{
+ rLeftBorder = 0;
+ rTopBorder = 0;
+ rRightBorder = 0;
+ rBottomBorder = 0;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplNoBorderWindowView::CalcTitleWidth() const
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplNoBorderWindowView::DrawWindow( USHORT nDrawFlags )
+{
+}
+
+// =======================================================================
+
+// -----------------------------
+// - ImplSmallBorderWindowView -
+// -----------------------------
+
+class ImplSmallBorderWindowView : public ImplBorderWindowView
+{
+ ImplBorderWindow* mpBorderWindow;
+ OutputDevice* mpOutDev;
+ long mnWidth;
+ long mnHeight;
+ long mnLeftBorder;
+ long mnTopBorder;
+ long mnRightBorder;
+ long mnBottomBorder;
+
+public:
+ ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow );
+
+ virtual void Init( OutputDevice* pOutDev, long nWidth, long nHeight );
+ virtual void GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const;
+ virtual long CalcTitleWidth() const;
+ virtual void DrawWindow( USHORT nDrawFlags );
+};
+
+// =======================================================================
+
+ImplSmallBorderWindowView::ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow )
+{
+ mpBorderWindow = pBorderWindow;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight )
+{
+ mpOutDev = pDev;
+ mnWidth = nWidth;
+ mnHeight = nHeight;
+
+ USHORT nBorderStyle = mpBorderWindow->GetBorderStyle();
+ if ( nBorderStyle & WINDOW_BORDER_NOBORDER )
+ {
+ mnLeftBorder = 0;
+ mnTopBorder = 0;
+ mnRightBorder = 0;
+ mnBottomBorder = 0;
+ }
+ else
+ {
+ USHORT nStyle = FRAME_DRAW_NODRAW;
+ // Wenn Border umgesetzt wurde oder BorderWindow ein Frame-Fenster
+ // ist, dann Border nach aussen
+ if ( (nBorderStyle & WINDOW_BORDER_DOUBLEOUT) || mpBorderWindow->mbSmallOutBorder )
+ nStyle |= FRAME_DRAW_DOUBLEOUT;
+ else
+ nStyle |= FRAME_DRAW_DOUBLEIN;
+ if ( nBorderStyle & WINDOW_BORDER_MONO )
+ nStyle |= FRAME_DRAW_MONO;
+
+ DecorationView aDecoView( mpOutDev );
+ Rectangle aRect( 0, 0, 10, 10 );
+ Rectangle aCalcRect = aDecoView.DrawFrame( aRect, nStyle );
+ mnLeftBorder = aCalcRect.Left();
+ mnTopBorder = aCalcRect.Top();
+ mnRightBorder = aRect.Right()-aCalcRect.Right();
+ mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSmallBorderWindowView::GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const
+{
+ rLeftBorder = mnLeftBorder;
+ rTopBorder = mnTopBorder;
+ rRightBorder = mnRightBorder;
+ rBottomBorder = mnBottomBorder;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplSmallBorderWindowView::CalcTitleWidth() const
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSmallBorderWindowView::DrawWindow( USHORT nDrawFlags )
+{
+ USHORT nBorderStyle = mpBorderWindow->GetBorderStyle();
+ if ( nBorderStyle & WINDOW_BORDER_NOBORDER )
+ return;
+
+ if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME )
+ {
+ if ( nBorderStyle & WINDOW_BORDER_ACTIVE )
+ {
+ Color aColor = mpOutDev->GetSettings().GetStyleSettings().GetHighlightColor();
+ mpOutDev->SetLineColor();
+ mpOutDev->SetFillColor( aColor );
+ mpOutDev->DrawRect( Rectangle( 0, 0, mnWidth-1, mnTopBorder ) );
+ mpOutDev->DrawRect( Rectangle( 0, mnHeight-mnBottomBorder, mnWidth-1, mnHeight-1 ) );
+ mpOutDev->DrawRect( Rectangle( 0, 0, mnLeftBorder, mnHeight-1 ) );
+ mpOutDev->DrawRect( Rectangle( mnWidth-mnRightBorder, 0, mnWidth-1, mnHeight-1 ) );
+ }
+ else
+ {
+ USHORT nStyle = 0;
+ // Wenn Border umgesetzt wurde oder BorderWindow ein Frame-Fenster
+ // ist, dann Border nach aussen
+ if ( (nBorderStyle & WINDOW_BORDER_DOUBLEOUT) || mpBorderWindow->mbSmallOutBorder )
+ nStyle |= FRAME_DRAW_DOUBLEOUT;
+ else
+ nStyle |= FRAME_DRAW_DOUBLEIN;
+ if ( nBorderStyle & WINDOW_BORDER_MONO )
+ nStyle |= FRAME_DRAW_MONO;
+
+ DecorationView aDecoView( mpOutDev );
+ Point aTmpPoint;
+ Rectangle aInRect( aTmpPoint, Size( mnWidth, mnHeight ) );
+ aDecoView.DrawFrame( aInRect, nStyle );
+ }
+ }
+}
+
+// =======================================================================
+
+// ---------------------------
+// - ImplStdBorderWindowView -
+// ---------------------------
+
+class ImplStdBorderWindowView : public ImplBorderWindowView
+{
+ ImplBorderFrameData maFrameData;
+ VirtualDevice* mpATitleVirDev;
+ VirtualDevice* mpDTitleVirDev;
+
+public:
+ ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow );
+ ~ImplStdBorderWindowView();
+
+ virtual BOOL MouseMove( const MouseEvent& rMEvt );
+ virtual BOOL MouseButtonDown( const MouseEvent& rMEvt );
+ virtual BOOL Tracking( const TrackingEvent& rTEvt );
+ virtual USHORT RequestHelp( const Point& rPos, Rectangle& rHelpRect );
+
+ virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
+ virtual void GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const;
+ virtual long CalcTitleWidth() const;
+ virtual void DrawWindow( USHORT nDrawFlags );
+};
+
+// =======================================================================
+
+ImplStdBorderWindowView::ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow )
+{
+ maFrameData.mpBorderWindow = pBorderWindow;
+ maFrameData.mbDragFull = FALSE;
+ maFrameData.mnHitTest = 0;
+ maFrameData.mnPinState = 0;
+ maFrameData.mnCloseState = 0;
+ maFrameData.mnRollState = 0;
+ maFrameData.mnDockState = 0;
+ maFrameData.mnHideState = 0;
+ maFrameData.mnHelpState = 0;
+
+ mpATitleVirDev = NULL;
+ mpDTitleVirDev = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+ImplStdBorderWindowView::~ImplStdBorderWindowView()
+{
+ if ( mpATitleVirDev )
+ delete mpATitleVirDev;
+ if ( mpDTitleVirDev )
+ delete mpDTitleVirDev;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplStdBorderWindowView::MouseMove( const MouseEvent& rMEvt )
+{
+ return ImplMouseMove( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplStdBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ return ImplMouseButtonDown( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplStdBorderWindowView::Tracking( const TrackingEvent& rTEvt )
+{
+ return ImplTracking( &maFrameData, rTEvt );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplStdBorderWindowView::RequestHelp( const Point& rPos, Rectangle& rHelpRect )
+{
+ return ImplRequestHelp( &maFrameData, rPos, rHelpRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow;
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ DecorationView aDecoView( pDev );
+ Rectangle aRect( 0, 0, 10, 10 );
+ Rectangle aCalcRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW );
+
+ pData->mpOutDev = pDev;
+ pData->mnWidth = nWidth;
+ pData->mnHeight = nHeight;
+
+ pData->mnTitleType = pBorderWindow->mnTitleType;
+ pData->mbFloatWindow = pBorderWindow->mbFloatWindow;
+
+ if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
+ pData->mnBorderSize = 0;
+ else if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF )
+ pData->mnBorderSize = 0;
+ else
+ pData->mnBorderSize = rStyleSettings.GetBorderSize();
+ pData->mnLeftBorder = aCalcRect.Left();
+ pData->mnTopBorder = aCalcRect.Top();
+ pData->mnRightBorder = aRect.Right()-aCalcRect.Right();
+ pData->mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom();
+ pData->mnLeftBorder += pData->mnBorderSize;
+ pData->mnTopBorder += pData->mnBorderSize;
+ pData->mnRightBorder += pData->mnBorderSize;
+ pData->mnBottomBorder += pData->mnBorderSize;
+ pData->mnNoTitleTop = pData->mnTopBorder;
+
+ ImplInitTitle( &maFrameData );
+ if ( pData->mnTitleHeight )
+ {
+ pData->maTitleRect.Left() = pData->mnLeftBorder;
+ pData->maTitleRect.Right() = nWidth-pData->mnRightBorder-1;
+ pData->maTitleRect.Top() = pData->mnTopBorder;
+ pData->maTitleRect.Bottom() = pData->maTitleRect.Top()+pData->mnTitleHeight-1;
+
+ if ( pData->mnTitleType & (BORDERWINDOW_TITLE_NORMAL | BORDERWINDOW_TITLE_SMALL) )
+ {
+ long nLeft = pData->maTitleRect.Left();
+ long nRight = pData->maTitleRect.Right();
+ long nItemTop = pData->maTitleRect.Top();
+ long nItemBottom = pData->maTitleRect.Bottom();
+ nLeft += 1;
+ nRight -= 3;
+ nItemTop += 2;
+ nItemBottom -= 2;
+
+ if ( pBorderWindow->GetStyle() & WB_PINABLE )
+ {
+ Image aImage;
+ ImplGetPinImage( 0, 0, aImage );
+ pData->maPinRect.Top() = nItemTop;
+ pData->maPinRect.Bottom() = nItemBottom;
+ pData->maPinRect.Left() = nLeft;
+ pData->maPinRect.Right() = pData->maPinRect.Left()+aImage.GetSizePixel().Width();
+ nLeft += pData->maPinRect.GetWidth()+3;
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
+ {
+ pData->maCloseRect.Top() = nItemTop;
+ pData->maCloseRect.Bottom() = nItemBottom;
+ pData->maCloseRect.Right() = nRight;
+ pData->maCloseRect.Left() = pData->maCloseRect.Right()-pData->maCloseRect.GetHeight()+1;
+ nRight -= pData->maCloseRect.GetWidth()+3;
+ }
+
+ if ( pBorderWindow->mbDockBtn )
+ {
+ pData->maDockRect.Top() = nItemTop;
+ pData->maDockRect.Bottom() = nItemBottom;
+ pData->maDockRect.Right() = nRight;
+ pData->maDockRect.Left() = pData->maDockRect.Right()-pData->maDockRect.GetHeight()+1;
+ nRight -= pData->maDockRect.GetWidth();
+ if ( !pBorderWindow->mbHideBtn &&
+ !(pBorderWindow->GetStyle() & WB_ROLLABLE) )
+ nRight -= 3;
+ }
+
+ if ( pBorderWindow->mbHideBtn )
+ {
+ pData->maHideRect.Top() = nItemTop;
+ pData->maHideRect.Bottom() = nItemBottom;
+ pData->maHideRect.Right() = nRight;
+ pData->maHideRect.Left() = pData->maHideRect.Right()-pData->maHideRect.GetHeight()+1;
+ nRight -= pData->maHideRect.GetWidth();
+ if ( !(pBorderWindow->GetStyle() & WB_ROLLABLE) )
+ nRight -= 3;
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_ROLLABLE )
+ {
+ pData->maRollRect.Top() = nItemTop;
+ pData->maRollRect.Bottom() = nItemBottom;
+ pData->maRollRect.Right() = nRight;
+ pData->maRollRect.Left() = pData->maRollRect.Right()-pData->maRollRect.GetHeight()+1;
+ nRight -= pData->maRollRect.GetWidth();
+ }
+
+ if ( pBorderWindow->mbHelpBtn )
+ {
+ pData->maHelpRect.Top() = nItemTop;
+ pData->maHelpRect.Bottom() = nItemBottom;
+ pData->maHelpRect.Right() = nRight;
+ pData->maHelpRect.Left() = pData->maHelpRect.Right()-pData->maHelpRect.GetHeight()+1;
+ nRight -= pData->maHelpRect.GetWidth()+3;
+ }
+ }
+ else
+ {
+ pData->maPinRect.SetEmpty();
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+
+ pData->mnTopBorder += pData->mnTitleHeight;
+ }
+ else
+ {
+ pData->maTitleRect.SetEmpty();
+ pData->maPinRect.SetEmpty();
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStdBorderWindowView::GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const
+{
+ rLeftBorder = maFrameData.mnLeftBorder;
+ rTopBorder = maFrameData.mnTopBorder;
+ rRightBorder = maFrameData.mnRightBorder;
+ rBottomBorder = maFrameData.mnBottomBorder;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplStdBorderWindowView::CalcTitleWidth() const
+{
+ return ImplCalcTitleWidth( &maFrameData );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplStdBorderWindowView::DrawWindow( USHORT nDrawFlags )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ OutputDevice* pDev = pData->mpOutDev;
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+ Point aTmpPoint;
+ Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ DecorationView aDecoView( pDev );
+ USHORT nStyle;
+ BOOL bActive = pBorderWindow->IsDisplayActive();
+
+ // Draw Frame
+ if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME )
+ nStyle = 0;
+ else
+ nStyle = FRAME_DRAW_NODRAW;
+ aInRect = aDecoView.DrawFrame( aInRect, FRAME_DRAW_DOUBLEOUT | nStyle );
+
+ // Draw Border
+ pDev->SetLineColor();
+ long nBorderSize = pData->mnBorderSize;
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_BORDER) && nBorderSize )
+ {
+ if ( bActive )
+ pDev->SetFillColor( rStyleSettings.GetActiveBorderColor() );
+ else
+ pDev->SetFillColor( rStyleSettings.GetDeactiveBorderColor() );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top() ),
+ Size( aInRect.GetWidth(), nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top()+nBorderSize ),
+ Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Bottom()-nBorderSize+1 ),
+ Size( aInRect.GetWidth(), nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Right()-nBorderSize+1, aInRect.Top()+nBorderSize ),
+ Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) );
+ }
+
+ // Draw Title
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_TITLE) && !pData->maTitleRect.IsEmpty() )
+ {
+ aInRect = pData->maTitleRect;
+
+ Color aColor2;
+ if ( bActive )
+ {
+ pDev->SetFillColor( rStyleSettings.GetActiveColor() );
+ pDev->SetTextColor( rStyleSettings.GetActiveTextColor() );
+ aColor2 = rStyleSettings.GetActiveColor2();
+ }
+ else
+ {
+ pDev->SetFillColor( rStyleSettings.GetDeactiveColor() );
+ pDev->SetTextColor( rStyleSettings.GetDeactiveTextColor() );
+ aColor2 = rStyleSettings.GetDeactiveColor2();
+ }
+#ifndef REMOTE_APPSERVER
+ BOOL bDrawRect;
+ if ( pDev->GetColorCount() >= 256 )
+ {
+ Point aTempPoint;
+ Size aRectSize = aInRect.GetSize();
+ VirtualDevice* pVirDev;
+ if ( bActive )
+ pVirDev = mpATitleVirDev;
+ else
+ pVirDev = mpDTitleVirDev;
+ bDrawRect = FALSE;
+ if ( !pVirDev || (aRectSize != pVirDev->GetOutputSizePixel()) )
+ {
+ if ( !pVirDev )
+ {
+ pVirDev = new VirtualDevice( *pDev );
+ if ( bActive )
+ mpATitleVirDev = pVirDev;
+ else
+ mpDTitleVirDev = pVirDev;
+ }
+
+ Gradient aGradient( GRADIENT_LINEAR, pDev->GetFillColor(), aColor2 );
+ aGradient.SetAngle( 900 );
+ aGradient.SetBorder( 50 );
+ if ( pVirDev->SetOutputSizePixel( aRectSize ) )
+ pVirDev->DrawGradient( Rectangle( aTempPoint, aRectSize ), aGradient );
+ else
+ bDrawRect = TRUE;
+ }
+
+ if ( !bDrawRect )
+ {
+ pDev->DrawOutDev( aInRect.TopLeft(), aRectSize,
+ aTempPoint, aRectSize, *pVirDev );
+ }
+ }
+ else
+ bDrawRect = TRUE;
+
+ if ( bDrawRect )
+#endif
+ pDev->DrawRect( aInRect );
+
+ if ( pData->mnTitleType != BORDERWINDOW_TITLE_TEAROFF )
+ {
+ aInRect.Left() += 2;
+ aInRect.Right() -= 2;
+
+ if ( !pData->maPinRect.IsEmpty() )
+ aInRect.Left() = pData->maPinRect.Right()+2;
+
+ if ( !pData->maHelpRect.IsEmpty() )
+ aInRect.Right() = pData->maHelpRect.Left()-2;
+ else if ( !pData->maRollRect.IsEmpty() )
+ aInRect.Right() = pData->maRollRect.Left()-2;
+ else if ( !pData->maHideRect.IsEmpty() )
+ aInRect.Right() = pData->maHideRect.Left()-2;
+ else if ( !pData->maDockRect.IsEmpty() )
+ aInRect.Right() = pData->maDockRect.Left()-2;
+ else if ( !pData->maCloseRect.IsEmpty() )
+ aInRect.Right() = pData->maCloseRect.Left()-2;
+ pDev->DrawText( aInRect, pBorderWindow->GetText(),
+ TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER |
+ TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_CLIP );
+ }
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_CLOSE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maCloseRect.IsEmpty() )
+ ImplDrawBrdWinSymbolButton( pDev, pData->maCloseRect, SYMBOL_CLOSE, pData->mnCloseState );
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_DOCK) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maDockRect.IsEmpty() )
+ ImplDrawBrdWinSymbolButton( pDev, pData->maDockRect, SYMBOL_DOCK, pData->mnDockState );
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HIDE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHideRect.IsEmpty() )
+ ImplDrawBrdWinSymbolButton( pDev, pData->maHideRect, SYMBOL_HIDE, pData->mnHideState );
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_ROLL) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maRollRect.IsEmpty() )
+ {
+ SymbolType eType;
+ if ( pBorderWindow->mbRollUp )
+ eType = SYMBOL_ROLLDOWN;
+ else
+ eType = SYMBOL_ROLLUP;
+ ImplDrawBrdWinSymbolButton( pDev, pData->maRollRect, eType, pData->mnRollState );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HELP) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHelpRect.IsEmpty() )
+ ImplDrawBrdWinSymbolButton( pDev, pData->maHelpRect, SYMBOL_HELP, pData->mnHelpState );
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_PIN) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maPinRect.IsEmpty() )
+ {
+ Image aImage;
+ ImplGetPinImage( pData->mnPinState, pBorderWindow->mbPined, aImage );
+ Size aImageSize = aImage.GetSizePixel();
+ long nRectHeight = pData->maPinRect.GetHeight();
+ if ( nRectHeight < aImageSize.Height() )
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(), pData->maPinRect.Top() ),
+ Size( aImageSize.Width(), nRectHeight ),
+ aImage );
+ }
+ else
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(),
+ pData->maPinRect.Top()+(nRectHeight-aImageSize.Height())/2 ),
+ aImage );
+ }
+ }
+}
+
+// =======================================================================
+
+// ---------------------------
+// - ImplOS2BorderWindowView -
+// ---------------------------
+
+class ImplOS2BorderWindowView : public ImplBorderWindowView
+{
+ ImplBorderFrameData maFrameData;
+
+public:
+ ImplOS2BorderWindowView( ImplBorderWindow* pBorderWindow );
+ ~ImplOS2BorderWindowView();
+
+ virtual BOOL MouseMove( const MouseEvent& rMEvt );
+ virtual BOOL MouseButtonDown( const MouseEvent& rMEvt );
+ virtual BOOL Tracking( const TrackingEvent& rTEvt );
+ virtual USHORT RequestHelp( const Point& rPos, Rectangle& rHelpRect );
+
+ virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
+ virtual void GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const;
+ virtual long CalcTitleWidth() const;
+ virtual void DrawWindow( USHORT nDrawFlags );
+
+ Rectangle DrawOS2TitleButton( const Rectangle& rRect, USHORT nStyle );
+};
+
+// Aus decoview.cxx
+void ImplDrawOS2Symbol( OutputDevice* pDev, const Rectangle& rRect,
+ USHORT nStyle, BOOL bClose );
+
+// =======================================================================
+
+ImplOS2BorderWindowView::ImplOS2BorderWindowView( ImplBorderWindow* pBorderWindow )
+{
+ maFrameData.mpBorderWindow = pBorderWindow;
+ maFrameData.mbDragFull = FALSE;
+ maFrameData.mnHitTest = 0;
+ maFrameData.mnPinState = 0;
+ maFrameData.mnCloseState = 0;
+ maFrameData.mnRollState = 0;
+ maFrameData.mnDockState = 0;
+ maFrameData.mnHideState = 0;
+ maFrameData.mnHelpState = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplOS2BorderWindowView::~ImplOS2BorderWindowView()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplOS2BorderWindowView::MouseMove( const MouseEvent& rMEvt )
+{
+ return ImplMouseMove( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplOS2BorderWindowView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ return ImplMouseButtonDown( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplOS2BorderWindowView::Tracking( const TrackingEvent& rTEvt )
+{
+ return ImplTracking( &maFrameData, rTEvt );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplOS2BorderWindowView::RequestHelp( const Point& rPos, Rectangle& rHelpRect )
+{
+ return ImplRequestHelp( &maFrameData, rPos, rHelpRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplOS2BorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow;
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ DecorationView aDecoView( pDev );
+ Rectangle aRect( 0, 0, 10, 10 );
+ Rectangle aCalcRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW );
+
+ pData->mpOutDev = pDev;
+ pData->mnWidth = nWidth;
+ pData->mnHeight = nHeight;
+
+ pData->mnTitleType = pBorderWindow->mnTitleType;
+ pData->mbFloatWindow = pBorderWindow->mbFloatWindow;
+
+ if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
+ pData->mnBorderSize = 0;
+ else if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF )
+ pData->mnBorderSize = 0;
+ else
+ pData->mnBorderSize = rStyleSettings.GetBorderSize();
+ pData->mnLeftBorder = aCalcRect.Left();
+ pData->mnTopBorder = aCalcRect.Top();
+ pData->mnRightBorder = aRect.Right()-aCalcRect.Right();
+ pData->mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom();
+ pData->mnLeftBorder += pData->mnBorderSize;
+ pData->mnTopBorder += pData->mnBorderSize;
+ pData->mnRightBorder += pData->mnBorderSize;
+ pData->mnBottomBorder += pData->mnBorderSize;
+ pData->mnNoTitleTop = pData->mnTopBorder;
+
+ ImplInitTitle( &maFrameData );
+ if ( pData->mnTitleHeight )
+ {
+ // Wegen 3D-Border bei aktiver Darstellung
+ if ( pData->mnTitleType != BORDERWINDOW_TITLE_TEAROFF )
+ {
+ long nTextHeight = pBorderWindow->GetTextHeight();
+ nTextHeight += 2;
+ if ( nTextHeight > pData->mnTitleHeight )
+ pData->mnTitleHeight = nTextHeight;
+ }
+
+ pData->maTitleRect.Left() = pData->mnLeftBorder;
+ pData->maTitleRect.Right() = nWidth-pData->mnRightBorder-1;
+ pData->maTitleRect.Top() = pData->mnTopBorder;
+ pData->maTitleRect.Bottom() = pData->maTitleRect.Top()+pData->mnTitleHeight-1;
+
+ if ( pData->mnTitleType & (BORDERWINDOW_TITLE_NORMAL | BORDERWINDOW_TITLE_SMALL) )
+ {
+ long nLeft = pData->maTitleRect.Left();
+ long nRight = pData->maTitleRect.Right();
+ long nItemTop = pData->maTitleRect.Top();
+ long nItemBottom = pData->maTitleRect.Bottom();
+
+ if ( pBorderWindow->mbHelpBtn )
+ {
+ pData->maHelpRect.Top() = nItemTop;
+ pData->maHelpRect.Bottom() = nItemBottom;
+ pData->maHelpRect.Left() = nLeft;
+ pData->maHelpRect.Right() = pData->maHelpRect.Left()+pData->maHelpRect.GetHeight()-1;
+ nLeft += pData->maHelpRect.GetWidth();
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_PINABLE )
+ {
+ nLeft += 2;
+ Image aImage;
+ ImplGetPinImage( 0, 0, aImage );
+ pData->maPinRect.Top() = nItemTop;
+ pData->maPinRect.Bottom() = nItemBottom;
+ pData->maPinRect.Left() = nLeft;
+ pData->maPinRect.Right() = pData->maPinRect.Left()+aImage.GetSizePixel().Width();
+ nLeft += pData->maPinRect.GetWidth();
+ }
+
+ if ( pBorderWindow->mbDockBtn )
+ {
+ pData->maDockRect.Top() = nItemTop;
+ pData->maDockRect.Bottom() = nItemBottom;
+ pData->maDockRect.Right() = nRight;
+ pData->maDockRect.Left() = pData->maDockRect.Right()-pData->maDockRect.GetHeight()+1;
+ nRight -= pData->maDockRect.GetWidth();
+ }
+
+ if ( pBorderWindow->mbHideBtn )
+ {
+ pData->maHideRect.Top() = nItemTop;
+ pData->maHideRect.Bottom() = nItemBottom;
+ pData->maHideRect.Right() = nRight;
+ pData->maHideRect.Left() = pData->maHideRect.Right()-pData->maHideRect.GetHeight()+1;
+ nRight -= pData->maHideRect.GetWidth();
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_ROLLABLE )
+ {
+ pData->maRollRect.Top() = nItemTop;
+ pData->maRollRect.Bottom() = nItemBottom;
+ pData->maRollRect.Right() = nRight;
+ pData->maRollRect.Left() = pData->maRollRect.Right()-pData->maRollRect.GetHeight()+1;
+ nRight -= pData->maRollRect.GetWidth();
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
+ {
+ pData->maCloseRect.Top() = nItemTop;
+ pData->maCloseRect.Bottom() = nItemBottom;
+ pData->maCloseRect.Right() = nRight;
+ pData->maCloseRect.Left() = pData->maCloseRect.Right()-pData->maCloseRect.GetHeight()+1;
+ nRight -= pData->maCloseRect.GetWidth();
+ }
+ }
+ else
+ {
+ pData->maPinRect.SetEmpty();
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+
+ pData->mnTopBorder += pData->mnTitleHeight;
+ }
+ else
+ {
+ pData->maTitleRect.SetEmpty();
+ pData->maPinRect.SetEmpty();
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplOS2BorderWindowView::GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const
+{
+ rLeftBorder = maFrameData.mnLeftBorder;
+ rTopBorder = maFrameData.mnTopBorder;
+ rRightBorder = maFrameData.mnRightBorder;
+ rBottomBorder = maFrameData.mnBottomBorder;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplOS2BorderWindowView::CalcTitleWidth() const
+{
+ return ImplCalcTitleWidth( &maFrameData );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplOS2BorderWindowView::DrawWindow( USHORT nDrawFlags )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ OutputDevice* pDev = pData->mpOutDev;
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+ Point aTmpPoint;
+ Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ DecorationView aDecoView( pDev );
+ USHORT nStyle;
+ BOOL bActive = pBorderWindow->IsDisplayActive();
+
+ // Draw Frame
+ if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME )
+ nStyle = 0;
+ else
+ nStyle = FRAME_DRAW_NODRAW;
+ aInRect = aDecoView.DrawFrame( aInRect, FRAME_DRAW_DOUBLEOUT | nStyle );
+
+ // Draw Border
+ pDev->SetLineColor();
+ long nBorderSize = pData->mnBorderSize;
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_BORDER) && nBorderSize )
+ {
+ if ( bActive )
+ pDev->SetFillColor( rStyleSettings.GetActiveBorderColor() );
+ else
+ pDev->SetFillColor( rStyleSettings.GetDeactiveBorderColor() );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top() ),
+ Size( aInRect.GetWidth(), nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top()+nBorderSize ),
+ Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Bottom()-nBorderSize+1 ),
+ Size( aInRect.GetWidth(), nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Right()-nBorderSize+1, aInRect.Top()+nBorderSize ),
+ Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) );
+ }
+
+ // Draw Title
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_TITLE) && !pData->maTitleRect.IsEmpty() )
+ {
+ aInRect = pData->maTitleRect;
+
+ if ( !pData->maHelpRect.IsEmpty() )
+ aInRect.Left() = pData->maHelpRect.Right()+1;
+
+ if ( !pData->maCloseRect.IsEmpty() )
+ aInRect.Right() = pData->maCloseRect.Left()-1;
+ else if ( !pData->maRollRect.IsEmpty() )
+ aInRect.Right() = pData->maRollRect.Left()-1;
+ else if ( !pData->maHideRect.IsEmpty() )
+ aInRect.Right() = pData->maHideRect.Left()-1;
+ else if ( !pData->maDockRect.IsEmpty() )
+ aInRect.Right() = pData->maDockRect.Left()-1;
+
+ if ( bActive )
+ {
+ pDev->SetFillColor( rStyleSettings.GetActiveColor() );
+ pDev->SetTextColor( rStyleSettings.GetActiveTextColor() );
+ }
+ else
+ {
+ pDev->SetFillColor( rStyleSettings.GetDeactiveColor() );
+ pDev->SetTextColor( rStyleSettings.GetDeactiveTextColor() );
+ }
+ pDev->DrawRect( aInRect );
+
+ if ( pData->mnTitleType != BORDERWINDOW_TITLE_TEAROFF )
+ {
+ Rectangle aOrgInRect = aInRect;
+
+ if ( !pData->maPinRect.IsEmpty() )
+ aInRect.Left() = pData->maPinRect.Right();
+
+ aInRect.Left() += 2;
+ aInRect.Right() -= 2;
+
+ pDev->DrawText( aInRect, pBorderWindow->GetText(),
+ TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER |
+ TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_CLIP );
+
+ if ( bActive )
+ aDecoView.DrawFrame( aOrgInRect, rStyleSettings.GetShadowColor(), rStyleSettings.GetLightColor() );
+ }
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_CLOSE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maCloseRect.IsEmpty() )
+ {
+ Rectangle aRect = DrawOS2TitleButton( pData->maCloseRect, pData->mnCloseState );
+ ImplDrawOS2Symbol( pDev, aRect, pData->mnCloseState, TRUE );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_DOCK) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maDockRect.IsEmpty() )
+ {
+ Rectangle aRect = DrawOS2TitleButton( pData->maDockRect, pData->mnDockState );
+ ImplDrawOS2Symbol( pDev, aRect, pData->mnDockState, FALSE );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HIDE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHideRect.IsEmpty() )
+ {
+ Rectangle aRect = DrawOS2TitleButton( pData->maHideRect, pData->mnHideState );
+ aRect.Left() += 2;
+ aRect.Top() += 2;
+ aRect.Right() -= 2;
+ aRect.Bottom() -= 2;
+ ImplDrawOS2Symbol( pDev, aRect, pData->mnHideState, FALSE );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_ROLL) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maRollRect.IsEmpty() )
+ {
+ Rectangle aRect = DrawOS2TitleButton( pData->maRollRect, pData->mnRollState );
+ if ( !pBorderWindow->mbRollUp )
+ aRect.Bottom() = aRect.Top()+6;
+ ImplDrawOS2Symbol( pDev, aRect, pData->mnRollState, FALSE );
+ if ( pBorderWindow->mbRollUp )
+ {
+ aRect.Left() += 3;
+ aRect.Top() += 3;
+ aRect.Right() -= 3;
+ aRect.Bottom() -= 3;
+ pDev->SetFillColor();
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( aRect.TopLeft(), aRect.TopRight() );
+ aRect.Top()++;
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( aRect.TopLeft(), aRect.TopRight() );
+ }
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HELP) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHelpRect.IsEmpty() )
+ {
+ Rectangle aRect = DrawOS2TitleButton( pData->maHelpRect, pData->mnHelpState );
+ ImplDrawBrdWinSymbol( pDev, aRect, SYMBOL_HELP );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_PIN) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maPinRect.IsEmpty() )
+ {
+ Image aImage;
+ ImplGetPinImage( pData->mnPinState, pBorderWindow->mbPined, aImage );
+ Size aImageSize = aImage.GetSizePixel();
+ long nRectHeight = pData->maPinRect.GetHeight();
+ if ( nRectHeight < aImageSize.Height() )
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(), pData->maPinRect.Top() ),
+ Size( aImageSize.Width(), nRectHeight ),
+ aImage );
+ }
+ else
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(),
+ pData->maPinRect.Top()+(nRectHeight-aImageSize.Height())/2 ),
+ aImage );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle ImplOS2BorderWindowView::DrawOS2TitleButton( const Rectangle& rRect, USHORT )
+{
+ OutputDevice* pDev = maFrameData.mpOutDev;
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ Rectangle aRect = rRect;
+
+ pDev->SetLineColor();
+ pDev->SetFillColor( rStyleSettings.GetFaceColor() );
+ pDev->DrawRect( aRect );
+
+ long nExtraWidth = ((aRect.GetWidth()*150)+500)/1000;
+ long nExtraHeight = ((aRect.GetHeight()*150)+500)/1000;
+ if ( !nExtraWidth )
+ nExtraWidth = 1;
+ if ( !nExtraHeight )
+ nExtraHeight = 1;
+ aRect.Left() += nExtraWidth;
+ aRect.Right() -= nExtraWidth;
+ aRect.Top() += nExtraHeight;
+ aRect.Bottom() -= nExtraHeight;
+ return aRect;
+}
+
+// =======================================================================
+
+// ---------------------------
+// - ImplUnxBorderWindowView -
+// ---------------------------
+
+class ImplUnxBorderWindowView : public ImplBorderWindowView
+{
+ ImplBorderFrameData maFrameData;
+
+public:
+ ImplUnxBorderWindowView( ImplBorderWindow* pBorderWindow );
+ ~ImplUnxBorderWindowView();
+
+ virtual BOOL MouseMove( const MouseEvent& rMEvt );
+ virtual BOOL MouseButtonDown( const MouseEvent& rMEvt );
+ virtual BOOL Tracking( const TrackingEvent& rTEvt );
+ virtual USHORT RequestHelp( const Point& rPos, Rectangle& rHelpRect );
+
+ virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
+ virtual void GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const;
+ virtual long CalcTitleWidth() const;
+ virtual void DrawWindow( USHORT nDrawFlags );
+
+ Rectangle DrawUnxTitleButton( const Rectangle& rRect, USHORT nStyle );
+};
+
+// =======================================================================
+
+ImplUnxBorderWindowView::ImplUnxBorderWindowView( ImplBorderWindow* pBorderWindow )
+{
+ maFrameData.mpBorderWindow = pBorderWindow;
+ maFrameData.mbDragFull = FALSE;
+ maFrameData.mnHitTest = 0;
+ maFrameData.mnPinState = 0;
+ maFrameData.mnCloseState = 0;
+ maFrameData.mnRollState = 0;
+ maFrameData.mnDockState = 0;
+ maFrameData.mnHideState = 0;
+ maFrameData.mnHelpState = 0;
+}
+
+// -----------------------------------------------------------------------
+
+ImplUnxBorderWindowView::~ImplUnxBorderWindowView()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplUnxBorderWindowView::MouseMove( const MouseEvent& rMEvt )
+{
+ return ImplMouseMove( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplUnxBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ return ImplMouseButtonDown( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplUnxBorderWindowView::Tracking( const TrackingEvent& rTEvt )
+{
+ return ImplTracking( &maFrameData, rTEvt );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplUnxBorderWindowView::RequestHelp( const Point& rPos, Rectangle& rHelpRect )
+{
+ return ImplRequestHelp( &maFrameData, rPos, rHelpRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplUnxBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow;
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ DecorationView aDecoView( pDev );
+ Rectangle aRect( 0, 0, 10, 10 );
+ Rectangle aCalcRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW );
+
+ pData->mpOutDev = pDev;
+ pData->mnWidth = nWidth;
+ pData->mnHeight = nHeight;
+
+ pData->mnTitleType = pBorderWindow->mnTitleType;
+ pData->mbFloatWindow = pBorderWindow->mbFloatWindow;
+
+ if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) ||
+ (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
+ pData->mnBorderSize = 0;
+ else if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF )
+ pData->mnBorderSize = 0;
+ else
+ {
+ pData->mnBorderSize = rStyleSettings.GetBorderSize();
+ if ( pData->mnBorderSize < 3 )
+ pData->mnBorderSize = 3;
+ aCalcRect = aRect;
+ }
+ pData->mnLeftBorder = aCalcRect.Left();
+ pData->mnTopBorder = aCalcRect.Top();
+ pData->mnRightBorder = aRect.Right()-aCalcRect.Right();
+ pData->mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom();
+ pData->mnLeftBorder += pData->mnBorderSize;
+ pData->mnTopBorder += pData->mnBorderSize;
+ pData->mnRightBorder += pData->mnBorderSize;
+ pData->mnBottomBorder += pData->mnBorderSize;
+ pData->mnNoTitleTop = pData->mnTopBorder;
+
+ ImplInitTitle( &maFrameData );
+ if ( pData->mnTitleHeight )
+ {
+ pData->maTitleRect.Left() = pData->mnLeftBorder;
+ pData->maTitleRect.Right() = nWidth-pData->mnRightBorder-1;
+ pData->maTitleRect.Top() = pData->mnTopBorder;
+ pData->maTitleRect.Bottom() = pData->maTitleRect.Top() + pData->mnTitleHeight - 1;
+
+ if ( pData->mnTitleType & (BORDERWINDOW_TITLE_NORMAL | BORDERWINDOW_TITLE_SMALL) )
+ {
+ long nLeft = pData->maTitleRect.Left();
+ long nRight = pData->maTitleRect.Right();
+ long nItemTop = pData->maTitleRect.Top();
+ long nItemBottom = pData->maTitleRect.Bottom();
+
+ if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
+ {
+ pData->maCloseRect.Top() = nItemTop;
+ pData->maCloseRect.Bottom() = nItemBottom;
+ pData->maCloseRect.Left() = nLeft;
+ pData->maCloseRect.Right() = nLeft + pData->maCloseRect.GetHeight();
+ nLeft += pData->maCloseRect.GetWidth() + 2;
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_PINABLE )
+ {
+ Image aImage;
+ ImplGetPinImage( 0, 0, aImage );
+ pData->maPinRect.Top() = nItemTop;
+ pData->maPinRect.Bottom() = nItemBottom;
+ pData->maPinRect.Left() = nLeft;
+ pData->maPinRect.Right() = pData->maPinRect.Left() + aImage.GetSizePixel().Width();
+ nLeft += pData->maPinRect.GetWidth();
+ }
+
+ if ( pBorderWindow->mbDockBtn )
+ {
+ pData->maDockRect.Top() = nItemTop;
+ pData->maDockRect.Bottom() = nItemBottom;
+ pData->maDockRect.Right() = nRight;
+ pData->maDockRect.Left() = pData->maDockRect.Right()-pData->maDockRect.GetHeight()+1;
+ nRight -= pData->maDockRect.GetWidth();
+ }
+
+ if ( pBorderWindow->mbHideBtn )
+ {
+ pData->maHideRect.Top() = nItemTop;
+ pData->maHideRect.Bottom() = nItemBottom;
+ pData->maHideRect.Right() = nRight;
+ pData->maHideRect.Left() = pData->maHideRect.Right()-pData->maHideRect.GetHeight()+1;
+ nRight -= pData->maHideRect.GetWidth();
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_ROLLABLE )
+ {
+ pData->maRollRect.Top() = nItemTop;
+ pData->maRollRect.Bottom() = nItemBottom;
+ pData->maRollRect.Right() = nRight;
+ pData->maRollRect.Left() = pData->maRollRect.Right()-pData->maRollRect.GetHeight()+1;
+ nRight -= pData->maRollRect.GetWidth();
+ }
+
+ if ( pBorderWindow->mbHelpBtn )
+ {
+ pData->maHelpRect.Top() = nItemTop;
+ pData->maHelpRect.Bottom() = nItemBottom;
+ pData->maHelpRect.Right() = nRight;
+ pData->maHelpRect.Left() = pData->maHelpRect.Right()-pData->maHelpRect.GetHeight()+1;
+ nRight -= pData->maHelpRect.GetWidth();
+ }
+ }
+ else
+ {
+ pData->maPinRect.SetEmpty();
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+
+ pData->mnTopBorder += pData->mnTitleHeight;
+ }
+ else
+ {
+ pData->maTitleRect.SetEmpty();
+ pData->maPinRect.SetEmpty();
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplUnxBorderWindowView::GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const
+{
+ rLeftBorder = maFrameData.mnLeftBorder;
+ rTopBorder = maFrameData.mnTopBorder;
+ rRightBorder = maFrameData.mnRightBorder;
+ rBottomBorder = maFrameData.mnBottomBorder;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplUnxBorderWindowView::CalcTitleWidth() const
+{
+ return ImplCalcTitleWidth( &maFrameData );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplUnxBorderWindowView::DrawWindow( USHORT nDrawFlags )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ OutputDevice* pDev = pData->mpOutDev;
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+ Point aTmpPoint;
+ Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ DecorationView aDecoView( pDev );
+ USHORT nStyle;
+ BOOL bActive = pBorderWindow->IsDisplayActive();
+
+ // Color-Management for 3D-like Border
+ Color aLineColor;
+ Color aFillColor;
+ Color aLightColor;
+ Color aDarkColor;
+ Color aTextColor;
+ if ( bActive )
+ {
+ aLineColor = rStyleSettings.GetActiveBorderColor();
+ aFillColor = rStyleSettings.GetActiveColor();
+ aTextColor = rStyleSettings.GetActiveTextColor();
+ }
+ else
+ {
+ aLineColor = rStyleSettings.GetDeactiveBorderColor();
+ aFillColor = rStyleSettings.GetDeactiveColor();
+ aTextColor = rStyleSettings.GetDeactiveTextColor();
+ }
+ aLightColor = aLineColor;
+ aDarkColor = aLineColor;
+ aLightColor.IncreaseLuminance( 64 );
+ aDarkColor.DecreaseLuminance( 64 );
+
+ // Draw Frame
+ long nBorderSize = pData->mnBorderSize;
+ if ( !nBorderSize )
+ {
+ if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME )
+ nStyle = 0;
+ else
+ nStyle = FRAME_DRAW_NODRAW;
+ aInRect = aDecoView.DrawFrame( aInRect, FRAME_DRAW_DOUBLEOUT | nStyle );
+ }
+ else
+ {
+ // Draw Border
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_BORDER) && nBorderSize )
+ {
+ // Geometry Presettings
+ long nOffset = 0;
+ long nEffBorderSize;
+ long nLeft = aInRect.Left();
+ long nRight = aInRect.Right();
+ long nTop = aInRect.Top();
+ long nBottom = aInRect.Bottom();
+
+ nEffBorderSize = nBorderSize > 2 ? nBorderSize - 2 : 1;
+
+ // outer border
+ pDev->SetLineColor( aLightColor );
+ pDev->DrawLine( Point( nLeft, nTop ), Point( nLeft, nBottom ) );
+ pDev->DrawLine( Point( nLeft, nTop ), Point( nRight, nTop ) );
+
+ pDev->SetLineColor( aDarkColor );
+ nTop++; nLeft++;
+ pDev->DrawLine( Point( nRight, nTop ), Point( nRight, nBottom ) );
+ pDev->DrawLine( Point( nLeft, nBottom ), Point( nRight, nBottom ) );
+
+ // middle border
+ pDev->SetLineColor();
+ pDev->SetFillColor( aLineColor );
+ nRight--; nBottom--;
+ pDev->DrawRect( Rectangle( Point( nLeft, nTop ),
+ Size( nRight - nLeft, nEffBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( nLeft, nTop ),
+ Size( nEffBorderSize, nBottom - nTop ) ) );
+ nRight -= nEffBorderSize;
+ nBottom -= nEffBorderSize;
+ pDev->DrawRect( Rectangle( Point( nRight + 1, nTop ),
+ Size( nEffBorderSize, nBottom - nTop + 1) ) );
+ pDev->DrawRect( Rectangle( Point( nLeft, nBottom + 1),
+ Size( nRight - nLeft + 1, nEffBorderSize ) ) );
+
+ // inner Border
+ pDev->SetLineColor( aDarkColor );
+ nTop += nEffBorderSize; nLeft += nEffBorderSize;
+ pDev->DrawLine( Point( nLeft, nTop ), Point( nLeft, nBottom ) );
+ pDev->DrawLine( Point( nLeft, nTop ), Point( nRight, nTop ) );
+
+ pDev->SetLineColor( aLightColor );
+ nTop++; nLeft++;
+ pDev->DrawLine( Point( nRight, nTop ), Point( nRight, nBottom ) );
+ pDev->DrawLine( Point( nLeft, nBottom ), Point( nRight, nBottom ) );
+
+ // edge intersections
+ if ( pBorderWindow->GetStyle() & WB_SIZEABLE )
+ {
+ nLeft = aInRect.Left();
+ nRight = aInRect.Right();
+ nTop = aInRect.Top();
+ nBottom = aInRect.Bottom();
+
+ if ( !pData->maTitleRect.IsEmpty() )
+ nOffset = pData->maTitleRect.GetHeight() + nEffBorderSize + 2;
+
+ pDev->SetLineColor( aDarkColor );
+ pDev->DrawLine( Point( nLeft + 1, nTop + nOffset ),
+ Point( nLeft + nEffBorderSize, nTop + nOffset ));
+ pDev->DrawLine( Point( nLeft + nOffset, nTop + 1 ),
+ Point( nLeft + nOffset, nTop + nEffBorderSize));
+ pDev->DrawLine( Point( nRight - 1, nTop + nOffset ),
+ Point( nRight - nEffBorderSize,nTop + nOffset ));
+ pDev->DrawLine( Point( nRight - nOffset, nTop + 1 ),
+ Point( nRight - nOffset, nTop + nEffBorderSize));
+
+ pDev->DrawLine( Point( nLeft + 1, nBottom - nOffset ),
+ Point( nLeft + nEffBorderSize, nBottom - nOffset ));
+ pDev->DrawLine( Point( nLeft + nOffset, nBottom - 1 ),
+ Point( nLeft + nOffset, nBottom - nEffBorderSize));
+ pDev->DrawLine( Point( nRight - 1, nBottom - nOffset ),
+ Point( nRight - nEffBorderSize,nBottom - nOffset ));
+ pDev->DrawLine( Point( nRight - nOffset, nBottom - 1 ),
+ Point( nRight - nOffset, nBottom - nEffBorderSize));
+ pDev->SetLineColor( aLightColor );
+ nEffBorderSize = nBorderSize > 1 ? nBorderSize - 1 : 1;
+ nOffset += 1;
+
+ pDev->DrawLine( Point( nLeft, nTop + nOffset ),
+ Point( nLeft + nEffBorderSize, nTop + nOffset ));
+ pDev->DrawLine( Point( nLeft + nOffset, nTop ),
+ Point( nLeft + nOffset, nTop + nEffBorderSize));
+ pDev->DrawLine( Point( nRight, nTop + nOffset ),
+ Point( nRight - nEffBorderSize,nTop + nOffset ));
+ pDev->DrawLine( Point( nLeft + nOffset, nBottom ),
+ Point( nLeft + nOffset, nBottom - nEffBorderSize));
+ nOffset -= 2;
+ pDev->DrawLine( Point( nRight - nOffset, nTop ),
+ Point( nRight - nOffset, nTop + nEffBorderSize));
+ pDev->DrawLine( Point( nLeft, nBottom - nOffset ),
+ Point( nLeft + nEffBorderSize, nBottom - nOffset ));
+ pDev->DrawLine( Point( nRight, nBottom - nOffset ),
+ Point( nRight - nEffBorderSize,nBottom - nOffset ));
+ pDev->DrawLine( Point( nRight - nOffset, nBottom ),
+ Point( nRight - nOffset, nBottom - nEffBorderSize));
+ }
+
+ // Reset Linecolor
+ pDev->SetLineColor();
+ }
+ }
+
+ // Draw Title
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_TITLE) && !pData->maTitleRect.IsEmpty() )
+ {
+ // Title Rect
+ aInRect = pData->maTitleRect;
+
+ pDev->SetFillColor( aFillColor );
+ pDev->SetTextColor( aTextColor );
+ pDev->DrawRect( aInRect );
+
+ // Title Rect Decoration
+ pDev->SetLineColor( aDarkColor );
+ pDev->DrawLine( Point( aInRect.Left(), aInRect.Bottom() ),
+ Point( aInRect.Right(), aInRect.Bottom() ) );
+ pDev->DrawLine( Point( aInRect.Right(), aInRect.Top() ),
+ Point( aInRect.Right(), aInRect.Bottom() ) );
+ pDev->SetLineColor( aLightColor );
+ pDev->DrawLine( Point( aInRect.Left(), aInRect.Top() ),
+ Point( aInRect.Right(), aInRect.Top() ) );
+ pDev->DrawLine( Point( aInRect.Left(), aInRect.Top() ),
+ Point( aInRect.Left(), aInRect.Bottom() ) );
+
+ long nLeft;
+ if ( !pData->maCloseRect.IsEmpty() )
+ nLeft = pData->maCloseRect.Right()+1;
+ else
+ nLeft = aInRect.Left()+1;
+
+ // Title Text
+ if ( pData->mnTitleType != BORDERWINDOW_TITLE_TEAROFF )
+ {
+ if ( !pData->maPinRect.IsEmpty() )
+ aInRect.Left() = pData->maPinRect.Right()+1;
+ else if ( !pData->maCloseRect.IsEmpty() )
+ aInRect.Left() = pData->maCloseRect.Right()+1;
+
+ if ( !pData->maHelpRect.IsEmpty() )
+ aInRect.Right() = pData->maHelpRect.Left()-1;
+ else if ( !pData->maRollRect.IsEmpty() )
+ aInRect.Right() = pData->maRollRect.Left()-1;
+ else if ( !pData->maHideRect.IsEmpty() )
+ aInRect.Right() = pData->maHideRect.Left()-1;
+ else if ( !pData->maDockRect.IsEmpty() )
+ aInRect.Right() = pData->maDockRect.Left()-1;
+
+ pDev->DrawText( aInRect, pBorderWindow->GetText(),
+ TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER |
+ TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_CLIP );
+ }
+
+ // more Title Rect Decoration
+ pDev->SetLineColor( aLightColor );
+ pDev->DrawLine( Point( nLeft, aInRect.Bottom() ),
+ Point( nLeft, aInRect.Top() ));
+ pDev->SetLineColor( aDarkColor );
+ pDev->DrawLine( Point( aInRect.Right(), aInRect.Top() ),
+ Point( aInRect.Right(), aInRect.Bottom() ) );
+ }
+
+ // Draw the buttons
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_CLOSE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maCloseRect.IsEmpty() )
+ {
+ Rectangle aInCloseRect = DrawUnxTitleButton( pData->maCloseRect,
+ pData->mnCloseState );
+ aDecoView.DrawSymbol( aInCloseRect, SYMBOL_CLOSE, aTextColor, 0 );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_DOCK) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maDockRect.IsEmpty() )
+ {
+ Rectangle aInDockRect = DrawUnxTitleButton( pData->maDockRect,
+ pData->mnDockState );
+ aDecoView.DrawSymbol( aInDockRect, SYMBOL_DOCK, aTextColor, 0 );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HIDE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHideRect.IsEmpty() )
+ {
+ Rectangle aInHideRect = DrawUnxTitleButton( pData->maHideRect,
+ pData->mnHideState );
+ aDecoView.DrawSymbol( aInHideRect, SYMBOL_HIDE, aTextColor, 0 );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_ROLL) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maRollRect.IsEmpty() )
+ {
+ Rectangle aInRollRect = DrawUnxTitleButton( pData->maRollRect,
+ pData->mnRollState );
+ SymbolType eType;
+ if ( pBorderWindow->mbRollUp )
+ eType = SYMBOL_ROLLDOWN;
+ else
+ eType = SYMBOL_ROLLUP;
+ aDecoView.DrawSymbol( aInRollRect, eType, aTextColor, 0 );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HELP) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHelpRect.IsEmpty() )
+ {
+ Rectangle aInHelpRect = DrawUnxTitleButton( pData->maHelpRect,
+ pData->mnHelpState );
+ aDecoView.DrawSymbol( aInHelpRect, SYMBOL_HELP, aTextColor, 0 );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_PIN) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maPinRect.IsEmpty() )
+ {
+ Image aImage;
+ ImplGetPinImage( pData->mnPinState, pBorderWindow->mbPined, aImage );
+ Size aImageSize = aImage.GetSizePixel();
+ long nRectHeight = pData->maPinRect.GetHeight();
+ if ( nRectHeight < aImageSize.Height() )
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(),
+ pData->maPinRect.Top() ),
+ Size( aImageSize.Width(), nRectHeight ),
+ aImage );
+ }
+ else
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(),
+ pData->maPinRect.Top()+(nRectHeight-aImageSize.Height())/2 ),
+ aImage );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle ImplUnxBorderWindowView::DrawUnxTitleButton( const Rectangle& rRect, USHORT nStyle )
+{
+ Rectangle aFillRect = rRect;
+ OutputDevice* pDev = maFrameData.mpOutDev;
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ ImplBorderFrameData* pData = &maFrameData;
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+ BOOL bActive = pBorderWindow->IsDisplayActive();
+
+ // Color-Management for 3D-like Border
+ Color aLineColor;
+ Color aLightColor;
+ Color aDarkColor;
+ if ( bActive )
+ aLineColor = rStyleSettings.GetActiveBorderColor();
+ else
+ aLineColor = rStyleSettings.GetDeactiveBorderColor();
+ aLightColor = aLineColor;
+ aDarkColor = aLineColor;
+ aLightColor.IncreaseLuminance( 64 );
+ aDarkColor.DecreaseLuminance( 64 );
+
+ // Draw Button
+ if ( !(nStyle & BUTTON_DRAW_NODRAW) )
+ {
+ // left and upper button-border
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ pDev->SetLineColor( aDarkColor );
+ else
+ pDev->SetLineColor( aLightColor );
+ pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Top() ),
+ Point( aFillRect.Right(), aFillRect.Top() ) );
+ pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Top() ),
+ Point( aFillRect.Left(), aFillRect.Bottom() ) );
+
+ aFillRect.Left()++;
+ aFillRect.Top()++;
+
+ // right and bottom button-border
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ pDev->SetLineColor( aLightColor );
+ else
+ pDev->SetLineColor( aDarkColor );
+ pDev->DrawLine( Point( aFillRect.Right(), aFillRect.Top() ),
+ Point( aFillRect.Right(), aFillRect.Bottom() ) );
+ pDev->DrawLine( Point( aFillRect.Left(), aFillRect.Bottom() ),
+ Point( aFillRect.Right(), aFillRect.Bottom() ) );
+
+ aFillRect.Right()--;
+ aFillRect.Bottom()--;
+
+ // button area
+ pDev->SetFillColor( aLineColor );
+ pDev->SetLineColor();
+
+ pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
+ aFillRect.Right(), aFillRect.Bottom() ) );
+ }
+
+ aFillRect.Left() += 3;
+ aFillRect.Top() += 3;
+ aFillRect.Right() -= 2;
+ aFillRect.Bottom() -= 2;
+ return aFillRect;
+}
+
+// =======================================================================
+
+// ---------------------------
+// - ImplMacBorderWindowView -
+// ---------------------------
+
+class ImplMacBorderWindowView : public ImplBorderWindowView
+{
+ ImplBorderFrameData maFrameData;
+ VirtualDevice maVirDev;
+ BOOL mbPressed;
+
+public:
+ ImplMacBorderWindowView( ImplBorderWindow* pBorderWindow );
+ ~ImplMacBorderWindowView();
+
+ virtual BOOL MouseMove( const MouseEvent& rMEvt );
+ virtual BOOL MouseButtonDown( const MouseEvent& rMEvt );
+ virtual BOOL Tracking( const TrackingEvent& rTEvt );
+ virtual USHORT RequestHelp( const Point& rPos, Rectangle& rHelpRect );
+
+ virtual void Init( OutputDevice* pDev, long nWidth, long nHeight );
+ virtual void GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const;
+ virtual long CalcTitleWidth() const;
+ virtual void DrawWindow( USHORT nDrawFlags );
+
+ Rectangle DrawMacTitleButton( const Rectangle& rRect, USHORT nStyle );
+};
+
+// =======================================================================
+
+ImplMacBorderWindowView::ImplMacBorderWindowView( ImplBorderWindow* pBorderWindow )
+{
+ maFrameData.mpBorderWindow = pBorderWindow;
+ maFrameData.mbDragFull = FALSE;
+ maFrameData.mnHitTest = 0;
+ maFrameData.mnPinState = 0;
+ maFrameData.mnCloseState = 0;
+ maFrameData.mnRollState = 0;
+ maFrameData.mnDockState = 0;
+ maFrameData.mnHideState = 0;
+ maFrameData.mnHelpState = 0;
+
+ mbPressed = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplMacBorderWindowView::~ImplMacBorderWindowView()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplMacBorderWindowView::MouseMove( const MouseEvent& rMEvt )
+{
+ return ImplMouseMove( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplMacBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ return ImplMouseButtonDown( &maFrameData, rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplMacBorderWindowView::Tracking( const TrackingEvent& rTEvt )
+{
+ return ImplTracking( &maFrameData, rTEvt );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplMacBorderWindowView::RequestHelp( const Point& rPos, Rectangle& rHelpRect )
+{
+ return ImplRequestHelp( &maFrameData, rPos, rHelpRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplMacBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow;
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+
+ pData->mpOutDev = pDev;
+ pData->mnWidth = nWidth;
+ pData->mnHeight = nHeight;
+
+ pData->mnTitleType = pBorderWindow->mnTitleType;
+ pData->mbFloatWindow = pBorderWindow->mbFloatWindow;
+
+ if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
+ pData->mnBorderSize = 0;
+ else if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF )
+ pData->mnBorderSize = 1;
+ else
+ pData->mnBorderSize = rStyleSettings.GetBorderSize();
+ pData->mnLeftBorder = 2;
+ pData->mnTopBorder = 2;
+ pData->mnRightBorder = 2;
+ pData->mnBottomBorder = 2;
+ pData->mnLeftBorder += pData->mnBorderSize;
+ pData->mnTopBorder += pData->mnBorderSize;
+ pData->mnRightBorder += pData->mnBorderSize;
+ pData->mnBottomBorder += pData->mnBorderSize;
+ pData->mnNoTitleTop = pData->mnTopBorder;
+ pData->mnTitleOff = 0;
+
+ ImplInitTitle( &maFrameData );
+ if ( pData->mnTitleHeight )
+ {
+ if ( (pData->mnTitleType & (BORDERWINDOW_TITLE_NORMAL | BORDERWINDOW_TITLE_SMALL)) &&
+ pData->mnBorderSize )
+ pData->mnTitleOff = 3; // 3 damit Hoehe auf dem MAC stimmt, ansonsten waere 2 richtig
+ pData->mnTitleHeight -= pData->mnTitleOff;
+ pData->maTitleRect.Left() = pData->mnLeftBorder;
+ pData->maTitleRect.Right() = nWidth-pData->mnRightBorder-1;
+ pData->maTitleRect.Top() = pData->mnTopBorder;
+ pData->maTitleRect.Bottom() = pData->maTitleRect.Top()+pData->mnTitleHeight-1;
+
+ if ( pData->mnTitleType & (BORDERWINDOW_TITLE_NORMAL | BORDERWINDOW_TITLE_SMALL) )
+ {
+ long nLeft = pData->maTitleRect.Left();
+ long nRight = pData->maTitleRect.Right();
+ long nItemTop = pData->maTitleRect.Top();
+ long nItemBottom = pData->maTitleRect.Bottom();
+
+ if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
+ {
+ pData->maCloseRect.Top() = nItemTop;
+ pData->maCloseRect.Bottom() = nItemBottom;
+ pData->maCloseRect.Left() = nLeft;
+ pData->maCloseRect.Right() = pData->maCloseRect.Left()+pData->maCloseRect.GetHeight()-1;
+ nLeft += pData->maCloseRect.GetWidth()+3;
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_PINABLE )
+ {
+ Image aImage;
+ ImplGetPinImage( 0, 0, aImage );
+ pData->maPinRect.Top() = nItemTop;
+ pData->maPinRect.Bottom() = nItemBottom;
+ pData->maPinRect.Left() = nLeft;
+ pData->maPinRect.Right() = pData->maPinRect.Left()+aImage.GetSizePixel().Width();
+ nLeft += pData->maPinRect.GetWidth()+3;
+ }
+
+ if ( pBorderWindow->mbDockBtn )
+ {
+ pData->maDockRect.Top() = nItemTop;
+ pData->maDockRect.Bottom() = nItemBottom;
+ pData->maDockRect.Right() = nRight;
+ pData->maDockRect.Left() = pData->maDockRect.Right()-pData->maDockRect.GetHeight()+1;
+ nRight -= pData->maDockRect.GetWidth()+3;
+ }
+
+ if ( pBorderWindow->mbHideBtn )
+ {
+ pData->maHideRect.Top() = nItemTop;
+ pData->maHideRect.Bottom() = nItemBottom;
+ pData->maHideRect.Right() = nRight;
+ pData->maHideRect.Left() = pData->maHideRect.Right()-pData->maHideRect.GetHeight()+1;
+ nRight -= pData->maHideRect.GetWidth()+3;
+ }
+
+ if ( pBorderWindow->GetStyle() & WB_ROLLABLE )
+ {
+ pData->maRollRect.Top() = nItemTop;
+ pData->maRollRect.Bottom() = nItemBottom;
+ pData->maRollRect.Right() = nRight;
+ pData->maRollRect.Left() = pData->maRollRect.Right()-pData->maRollRect.GetHeight()+1;
+ nRight -= pData->maRollRect.GetWidth()+3;
+ }
+
+ if ( pBorderWindow->mbHelpBtn )
+ {
+ pData->maHelpRect.Top() = nItemTop;
+ pData->maHelpRect.Bottom() = nItemBottom;
+ pData->maHelpRect.Right() = nRight;
+ pData->maHelpRect.Left() = pData->maHelpRect.Right()-pData->maHelpRect.GetHeight()+1;
+ nRight -= pData->maHelpRect.GetWidth()+3;
+ }
+ }
+ else
+ {
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+
+ pData->mnTopBorder += pData->mnTitleHeight;
+
+ // Innerer Border nur, wenn wir auch eine TitleBar haben
+ if ( !pBorderWindow->mbRollUp || pBorderWindow->mnRollHeight )
+ {
+ pData->mnTopBorder += 3+pData->mnBorderSize;
+ pData->mnBottomBorder += 3;
+ }
+ pData->mnLeftBorder += 3;
+ pData->mnRightBorder += 3;
+ }
+ else
+ {
+ pData->maTitleRect.SetEmpty();
+ pData->maPinRect.SetEmpty();
+ pData->maCloseRect.SetEmpty();
+ pData->maDockRect.SetEmpty();
+ pData->maHideRect.SetEmpty();
+ pData->maRollRect.SetEmpty();
+ pData->maHelpRect.SetEmpty();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplMacBorderWindowView::GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const
+{
+ rLeftBorder = maFrameData.mnLeftBorder;
+ rTopBorder = maFrameData.mnTopBorder;
+ rRightBorder = maFrameData.mnRightBorder;
+ rBottomBorder = maFrameData.mnBottomBorder;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplMacBorderWindowView::CalcTitleWidth() const
+{
+ return ImplCalcTitleWidth( &maFrameData );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplMacBorderWindowView::DrawWindow( USHORT nDrawFlags )
+{
+ ImplBorderFrameData* pData = &maFrameData;
+ OutputDevice* pDev = pData->mpOutDev;
+ ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
+ Point aTmpPoint;
+ Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ BOOL bActive = pBorderWindow->IsDisplayActive();
+
+ // DrawFrame
+ pBorderWindow->SetFillColor();
+ if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME )
+ {
+ if ( bActive )
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawRect( aInRect );
+ aInRect.Left()++;
+ aInRect.Top()++;
+ aInRect.Right()--;
+ aInRect.Bottom()--;
+ if ( bActive )
+ {
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( aInRect.TopLeft(), Point( aInRect.Left(), aInRect.Bottom() ) );
+ pDev->DrawLine( aInRect.TopLeft(), Point( aInRect.Right(), aInRect.Top() ) );
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( aInRect.Left()+1, aInRect.Bottom() ), aInRect.BottomRight() );
+ pDev->DrawLine( Point( aInRect.Right(), aInRect.Top()+1 ), aInRect.BottomRight() );
+ }
+ else
+ {
+ pDev->SetLineColor( rStyleSettings.GetDeactiveBorderColor() );
+ pDev->DrawRect( aInRect );
+ }
+ aInRect.Left()++;
+ aInRect.Top()++;
+ aInRect.Right()--;
+ aInRect.Bottom()--;
+ }
+ else
+ {
+ aInRect.Left() += 2;
+ aInRect.Top() += 2;
+ aInRect.Right() -= 2;
+ aInRect.Bottom() -= 2;
+ }
+
+ pBorderWindow->SetLineColor();
+ long nBorderSize = pData->mnBorderSize;
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_BORDER) && nBorderSize )
+ {
+ if ( bActive )
+ pDev->SetFillColor( rStyleSettings.GetActiveBorderColor() );
+ else
+ pDev->SetFillColor( rStyleSettings.GetDeactiveBorderColor() );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top() ),
+ Size( aInRect.GetWidth(), nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top()+nBorderSize ),
+ Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Bottom()-nBorderSize+1 ),
+ Size( aInRect.GetWidth(), nBorderSize ) ) );
+ pDev->DrawRect( Rectangle( Point( aInRect.Right()-nBorderSize+1, aInRect.Top()+nBorderSize ),
+ Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) );
+ }
+ aInRect.Left() += nBorderSize;
+ aInRect.Top() += nBorderSize;
+ aInRect.Right() -= nBorderSize;
+ aInRect.Bottom() -= nBorderSize;
+
+ Rectangle aTitleRect = pData->maTitleRect;
+ XubString aText = pBorderWindow->GetText();
+ BOOL bDrawText = FALSE;
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_TITLE) && !pData->maTitleRect.IsEmpty() )
+ {
+ Rectangle aTextRect;
+ if ( bActive )
+ {
+ pDev->SetFillColor( rStyleSettings.GetActiveColor() );
+ pDev->SetTextColor( rStyleSettings.GetActiveTextColor() );
+ }
+ else
+ {
+ pDev->SetFillColor( rStyleSettings.GetDeactiveColor() );
+ pDev->SetTextColor( rStyleSettings.GetDeactiveTextColor() );
+ }
+ pDev->DrawRect( aTitleRect );
+
+ if ( pData->mnTitleType != BORDERWINDOW_TITLE_TEAROFF )
+ {
+ if ( !pData->maPinRect.IsEmpty() )
+ aTitleRect.Left() = pData->maPinRect.Right()+3;
+ else if ( !pData->maCloseRect.IsEmpty() )
+ aTitleRect.Left() = pData->maCloseRect.Right()+3;
+
+ if ( !pData->maHelpRect.IsEmpty() )
+ aTitleRect.Right() = pData->maHelpRect.Left()-3;
+ else if ( !pData->maHideRect.IsEmpty() )
+ aTitleRect.Right() = pData->maHideRect.Left()-3;
+ else if ( !pData->maDockRect.IsEmpty() )
+ aTitleRect.Right() = pData->maDockRect.Left()-3;
+ else if ( !pData->maRollRect.IsEmpty() )
+ aTitleRect.Right() = pData->maRollRect.Left()-3;
+
+ if ( aText.Len() )
+ {
+ aTextRect = pDev->GetTextRect( aTitleRect, aText,
+ TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER |
+ TEXT_DRAW_ENDELLIPSIS );
+ bDrawText = TRUE;
+ }
+ }
+
+ if ( bActive )
+ {
+ long nY = aTitleRect.Top();
+ long nYMax = nY+pData->mnTitleHeight-2+(pData->mnTitleHeight%2);
+ long nX1 = aTitleRect.Left();
+ long nX2;
+ long nX3;
+ long nX4;
+ BOOL bLines;
+ BOOL b2Lines;
+ if ( aTextRect.IsEmpty() )
+ {
+ nX2 = aTitleRect.Right();
+ bLines = nX2-2 > nX1;
+ b2Lines = FALSE;
+ }
+ else
+ {
+ aTextRect.Left() -= 4;
+ aTextRect.Right() += 4;
+ if ( (aTextRect.Left() > aTitleRect.Left()) &&
+ (aTextRect.Right() < aTitleRect.Right()) )
+ {
+ nX2 = aTextRect.Left();
+ nX3 = aTextRect.Right();
+ nX4 = aTitleRect.Right();
+ bLines = TRUE;
+ b2Lines = TRUE;
+ }
+ else
+ bLines = FALSE;
+ }
+
+ if ( bLines )
+ {
+ for ( ; nY < nYMax; nY += 2 )
+ {
+ if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ else
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( Point( nX1, nY ), Point( nX2-1, nY ) );
+ if ( b2Lines )
+ pDev->DrawLine( Point( nX3, nY ), Point( nX4-1, nY ) );
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( nX1+1, nY+1 ), Point( nX2, nY+1 ) );
+ if ( b2Lines )
+ pDev->DrawLine( Point( nX3+1, nY+1 ), Point( nX4, nY+1 ) );
+ }
+ }
+ }
+ }
+ }
+ aInRect.Top() += pData->mnTitleHeight;
+
+ if ( bActive )
+ {
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_CLOSE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maCloseRect.IsEmpty() )
+ DrawMacTitleButton( pData->maCloseRect, pData->mnCloseState );
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_PIN) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maPinRect.IsEmpty() )
+ {
+ Image aImage;
+ ImplGetPinImage( pData->mnPinState, pBorderWindow->mbPined, aImage );
+ Size aImageSize = aImage.GetSizePixel();
+ long nRectHeight = pData->maPinRect.GetHeight();
+ if ( nRectHeight < aImageSize.Height() )
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(), pData->maPinRect.Top() ),
+ Size( aImageSize.Width(), nRectHeight ),
+ aImage );
+ }
+ else
+ {
+ pDev->DrawImage( Point( pData->maPinRect.Left(),
+ pData->maPinRect.Top()+(nRectHeight-aImageSize.Height())/2 ),
+ aImage );
+ }
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_DOCK) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maDockRect.IsEmpty() )
+ {
+ Rectangle aInDockRect = DrawMacTitleButton( pData->maDockRect, pData->mnDockState );
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ pDev->SetFillColor();
+ aInDockRect.Left()++;
+ aInDockRect.Top()++;
+ aInDockRect.Right()--;
+ aInDockRect.Bottom()--;
+ pDev->DrawRect( aInDockRect );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HIDE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHideRect.IsEmpty() )
+ {
+ Rectangle aInHideRect = DrawMacTitleButton( pData->maHideRect, pData->mnHideState );
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ pDev->DrawLine( Point( aInHideRect.Left(), aInHideRect.Bottom()-1 ), Point( aInHideRect.Right(), aInHideRect.Bottom()-1 ) );
+ pDev->DrawLine( Point( aInHideRect.Left(), aInHideRect.Bottom() ), Point( aInHideRect.Right(), aInHideRect.Bottom() ) );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_ROLL) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maRollRect.IsEmpty() )
+ {
+ Rectangle aInRollRect = DrawMacTitleButton( pData->maRollRect, pData->mnRollState );
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ long nY = aInRollRect.Center().Y();
+ pDev->DrawLine( Point( aInRollRect.Left(), nY-1 ), Point( aInRollRect.Right(), nY-1 ) );
+ pDev->DrawLine( Point( aInRollRect.Left(), nY+1 ), Point( aInRollRect.Right(), nY+1 ) );
+ }
+
+ if ( ((nDrawFlags & BORDERWINDOW_DRAW_HELP) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) &&
+ !pData->maHelpRect.IsEmpty() )
+ {
+ Rectangle aInHelpRect = DrawMacTitleButton( pData->maHelpRect, pData->mnHelpState );
+ // ...
+ }
+ }
+
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_BORDER) && nBorderSize && !pData->maTitleRect.IsEmpty() )
+ {
+ pBorderWindow->SetLineColor();
+ if ( bActive )
+ pDev->SetFillColor( rStyleSettings.GetActiveColor() );
+ else
+ pDev->SetFillColor( rStyleSettings.GetDeactiveColor() );
+ pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top() ),
+ Size( aInRect.GetWidth(), nBorderSize ) ) );
+ }
+ aInRect.Top() += nBorderSize;
+
+ if ( (nDrawFlags & BORDERWINDOW_DRAW_FRAME) && !pData->maTitleRect.IsEmpty() &&
+ (!pBorderWindow->mbRollUp || pBorderWindow->mnRollHeight) )
+ {
+ pBorderWindow->SetFillColor();
+ if ( bActive )
+ {
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( aInRect.TopLeft(), Point( aInRect.Left(), aInRect.Bottom() ) );
+ pDev->DrawLine( aInRect.TopLeft(), Point( aInRect.Right(), aInRect.Top() ) );
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( Point( aInRect.Left()+1, aInRect.Bottom() ), aInRect.BottomRight() );
+ pDev->DrawLine( Point( aInRect.Right(), aInRect.Top()+1 ), aInRect.BottomRight() );
+ }
+ else
+ {
+ pDev->SetLineColor( rStyleSettings.GetDeactiveBorderColor() );
+ pDev->DrawRect( aInRect );
+ }
+ aInRect.Left()++;
+ aInRect.Top()++;
+ aInRect.Right()--;
+ aInRect.Bottom()--;
+ if ( bActive )
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawRect( aInRect );
+ aInRect.Left()++;
+ aInRect.Top()++;
+ aInRect.Right()--;
+ aInRect.Bottom()--;
+ if ( bActive )
+ {
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( aInRect.TopLeft(), Point( aInRect.Left(), aInRect.Bottom() ) );
+ pDev->DrawLine( aInRect.TopLeft(), Point( aInRect.Right(), aInRect.Top() ) );
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( aInRect.Left()+1, aInRect.Bottom() ), aInRect.BottomRight() );
+ pDev->DrawLine( Point( aInRect.Right(), aInRect.Top()+1 ), aInRect.BottomRight() );
+ }
+ else
+ {
+ pDev->SetLineColor( rStyleSettings.GetDeactiveBorderColor() );
+ pDev->DrawRect( aInRect );
+ }
+ }
+
+ // Text als letztes zeichen, da auf dem MAC unter/ober-Laengen in
+ // den Border gezeichnet werden
+ if ( bDrawText )
+ {
+ pDev->DrawText( aTitleRect, aText,
+ TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER |
+ TEXT_DRAW_ENDELLIPSIS );
+ }
+}
+
+//fuer WIN16 Borland
+#ifdef WIN
+#pragma codeseg BRWDIN_SEG1
+#endif
+
+// -----------------------------------------------------------------------
+
+Rectangle ImplMacBorderWindowView::DrawMacTitleButton( const Rectangle& rRect, USHORT nStyle )
+{
+ OutputDevice* pDev = maFrameData.mpOutDev;
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ Rectangle aRect = rRect;
+
+ if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ {
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom() ) );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right(), aRect.Top() ) );
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( Point( aRect.Left()+1, aRect.Bottom() ), aRect.BottomRight() );
+ pDev->DrawLine( Point( aRect.Right(), aRect.Top()+1 ), aRect.BottomRight() );
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ BOOL bDrawRect;
+ if ( pDev->GetColorCount() >= 256 )
+ {
+ Point aTempPoint;
+ Size aRectSize = aRect.GetSize();
+ BOOL bNewPressed = (nStyle & BUTTON_DRAW_PRESSED) != 0;
+ bDrawRect = FALSE;
+ if ( (aRectSize != maVirDev.GetOutputSizePixel()) ||
+ (bNewPressed != mbPressed) )
+ {
+ Gradient aGradient( GRADIENT_LINEAR,
+ rStyleSettings.GetShadowColor(),
+ rStyleSettings.GetLightColor() );
+ if ( bNewPressed )
+ {
+ aGradient.SetStartColor( rStyleSettings.GetDarkShadowColor() );
+ aGradient.SetEndColor( rStyleSettings.GetFaceColor() );
+ }
+ aGradient.SetAngle( 450 );
+ if ( maVirDev.SetOutputSizePixel( aRectSize ) )
+ maVirDev.DrawGradient( Rectangle( aTempPoint, aRectSize ), aGradient );
+ else
+ bDrawRect = TRUE;
+ mbPressed = bNewPressed;
+ }
+ if ( !bDrawRect )
+ {
+ pDev->DrawOutDev( aRect.TopLeft(), aRectSize,
+ aTempPoint, aRectSize, maVirDev );
+ pDev->SetFillColor();
+ }
+ }
+ else
+ bDrawRect = TRUE;
+ if ( bDrawRect )
+ {
+ if ( nStyle & BUTTON_DRAW_PRESSED )
+ pDev->SetFillColor( rStyleSettings.GetShadowColor() );
+ else
+ pDev->SetFillColor( rStyleSettings.GetActiveColor() );
+ }
+ pDev->DrawRect( aRect );
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ if ( nStyle & BUTTON_DRAW_PRESSED )
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom() ) );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right(), aRect.Top() ) );
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ pDev->DrawLine( Point( aRect.Left()+1, aRect.Bottom() ), aRect.BottomRight() );
+ pDev->DrawLine( Point( aRect.Right(), aRect.Top()+1 ), aRect.BottomRight() );
+ }
+ else
+ {
+ pDev->SetLineColor( Color( COL_BLACK ) );
+ if ( nStyle & BUTTON_DRAW_PRESSED )
+ pDev->SetFillColor( Color( COL_BLACK ) );
+ else
+ pDev->SetFillColor( rStyleSettings.GetActiveColor() );
+ pDev->DrawRect( aRect );
+ aRect.Left()++;
+ aRect.Top()++;
+ aRect.Right()--;
+ aRect.Bottom()--;
+ }
+
+ return aRect;
+}
+
+// =======================================================================
+#ifdef REMOTE_APPSERVER
+void ImplBorderWindow::ImplInit( Window* pParent,
+ WinBits nStyle, USHORT nTypeStyle,
+ SystemParentData* pSystemParentData
+ )
+{
+ static ::com::sun::star::uno::Any aVoid;
+
+ DBG_ASSERT( pSystemParentData, "remote and non remote confusion, please clarify" );
+ ImplInit( pParent, nStyle, nTypeStyle, aVoid );
+}
+#else
+void ImplBorderWindow::ImplInit( Window* pParent,
+ WinBits nStyle, USHORT nTypeStyle,
+ const ::com::sun::star::uno::Any& aSystemToken )
+{
+ ImplInit( pParent, nStyle, nTypeStyle, NULL );
+}
+#endif
+
+#ifndef REMOTE_APPSERVER
+void ImplBorderWindow::ImplInit( Window* pParent,
+ WinBits nStyle, USHORT nTypeStyle,
+ SystemParentData* pSystemParentData
+ )
+#else
+void ImplBorderWindow::ImplInit( Window* pParent,
+ WinBits nStyle,
+ USHORT nTypeStyle,
+ const ::com::sun::star::uno::Any& aSystemToken
+ )
+#endif
+{
+ // Alle WindowBits entfernen, die wir nicht haben wollen
+ WinBits nOrgStyle = nStyle;
+ WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL);
+ if ( nTypeStyle & BORDERWINDOW_STYLE_APP )
+ nTestStyle |= WB_APP;
+ nStyle &= nTestStyle;
+
+ mbBorderWin = TRUE;
+ mbSmallOutBorder = FALSE;
+ if ( nTypeStyle & BORDERWINDOW_STYLE_FRAME )
+ {
+ mbOverlapWin = TRUE;
+ mbFrame = TRUE;
+ mbFrameBorder = FALSE;
+ if ( (nOrgStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )
+ mbSmallOutBorder = TRUE;
+ }
+ else if ( nTypeStyle & BORDERWINDOW_STYLE_OVERLAP )
+ {
+ mbOverlapWin = TRUE;
+ mbFrameBorder = TRUE;
+ }
+ else
+ mbFrameBorder = FALSE;
+
+ if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT )
+ mbFloatWindow = TRUE;
+ else
+ mbFloatWindow = FALSE;
+
+#ifndef REMOTE_APPSERVER
+ Window::ImplInit( pParent, nStyle, pSystemParentData );
+#else
+ Window::ImplInit( pParent, nStyle, aSystemToken );
+#endif
+ SetBackground();
+ SetTextFillColor();
+
+ mpMenuBarWindow = NULL;
+ mnMinWidth = 0;
+ mnMinHeight = 0;
+ mnRollHeight = 0;
+ mnOrgMenuHeight = 0;
+ mbPined = FALSE;
+ mbRollUp = FALSE;
+ mbMenuHide = FALSE;
+ mbDockBtn = FALSE;
+ mbHideBtn = FALSE;
+ mbHelpBtn = FALSE;
+ mbDisplayActive = IsActive();
+
+ if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT )
+ mnTitleType = BORDERWINDOW_TITLE_SMALL;
+ else
+ mnTitleType = BORDERWINDOW_TITLE_NORMAL;
+ mnBorderStyle = WINDOW_BORDER_NORMAL;
+ InitView();
+}
+
+// =======================================================================
+
+ImplBorderWindow::ImplBorderWindow( Window* pParent,
+ SystemParentData* pSystemParentData,
+ WinBits nStyle, USHORT nTypeStyle
+ ) : Window( WINDOW_BORDERWINDOW )
+{
+ ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData );
+}
+
+// -----------------------------------------------------------------------
+
+ImplBorderWindow::ImplBorderWindow( Window* pParent, WinBits nStyle ,
+ USHORT nTypeStyle ) :
+ Window( WINDOW_BORDERWINDOW )
+{
+ Reference< ::com::sun::star::portal::client::XRmFrameWindow > rxFrameWin;
+ ImplInit( pParent, nStyle, nTypeStyle, ::com::sun::star::uno::Any() );
+}
+
+ImplBorderWindow::ImplBorderWindow( Window* pParent,
+ WinBits nStyle, USHORT nTypeStyle,
+ const ::com::sun::star::uno::Any& aSystemToken ) :
+ Window( WINDOW_BORDERWINDOW )
+{
+ ImplInit( pParent, nStyle, nTypeStyle, aSystemToken );
+}
+
+// -----------------------------------------------------------------------
+
+ImplBorderWindow::~ImplBorderWindow()
+{
+ delete mpBorderView;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ mpBorderView->MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ mpBorderView->MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::Tracking( const TrackingEvent& rTEvt )
+{
+ mpBorderView->Tracking( rTEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::Paint( const Rectangle& rRect )
+{
+ mpBorderView->DrawWindow( BORDERWINDOW_DRAW_ALL );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::Activate()
+{
+ SetDisplayActive( TRUE );
+ Window::Activate();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::Deactivate()
+{
+ // Fenster die immer Active sind, nehmen wir von dieser Regel aus,
+ // genauso, wenn ein Menu aktiv wird, ignorieren wir das Deactivate
+ if ( GetActivateMode() && !ImplGetSVData()->maWinData.mbNoDeactivate )
+ SetDisplayActive( FALSE );
+ Window::Deactivate();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) )
+ {
+ Point aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
+ Rectangle aHelpRect;
+ USHORT nHelpResId = mpBorderView->RequestHelp( aMousePosPixel, aHelpRect );
+
+ // Rechteck ermitteln
+ if ( nHelpResId )
+ {
+ Point aPt = OutputToScreenPixel( aHelpRect.TopLeft() );
+ aHelpRect.Left() = aPt.X();
+ aHelpRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aHelpRect.BottomRight() );
+ aHelpRect.Right() = aPt.X();
+ aHelpRect.Bottom() = aPt.Y();
+
+ // Text ermitteln und anzeigen
+ XubString aStr( ResId( nHelpResId, ImplGetResMgr() ) );
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aHelpRect.Center(), aHelpRect, aStr );
+ else
+ Help::ShowQuickHelp( this, aHelpRect, aStr );
+ return;
+ }
+ }
+
+ Window::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::Resize()
+{
+ Size aSize = GetOutputSizePixel();
+
+ if ( !mbRollUp )
+ {
+ Window* pClientWindow = ImplGetClientWindow();
+
+ if ( mpMenuBarWindow )
+ {
+ long nLeftBorder;
+ long nTopBorder;
+ long nRightBorder;
+ long nBottomBorder;
+ long nMenuHeight = mpMenuBarWindow->GetSizePixel().Height();
+ if ( mbMenuHide )
+ {
+ if ( nMenuHeight )
+ mnOrgMenuHeight = nMenuHeight;
+ nMenuHeight = 0;
+ }
+ else
+ {
+ if ( !nMenuHeight )
+ nMenuHeight = mnOrgMenuHeight;
+ }
+ mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
+ mpMenuBarWindow->SetPosSizePixel( nLeftBorder,
+ nTopBorder,
+ aSize.Width()-nLeftBorder-nRightBorder,
+ nMenuHeight,
+ WINDOW_POSSIZE_POS |
+ WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT );
+ }
+
+ GetBorder( pClientWindow->mnLeftBorder, pClientWindow->mnTopBorder,
+ pClientWindow->mnRightBorder, pClientWindow->mnBottomBorder );
+ pClientWindow->ImplPosSizeWindow( pClientWindow->mnLeftBorder,
+ pClientWindow->mnTopBorder,
+ aSize.Width()-pClientWindow->mnLeftBorder-pClientWindow->mnRightBorder,
+ aSize.Height()-pClientWindow->mnTopBorder-pClientWindow->mnBottomBorder,
+ WINDOW_POSSIZE_X | WINDOW_POSSIZE_Y |
+ WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT );
+ }
+
+ // UpdateView
+ mpBorderView->Init( this, aSize.Width(), aSize.Height() );
+ InvalidateBorder();
+
+ Window::Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::StateChanged( StateChangedType nType )
+{
+ if ( (nType == STATE_CHANGE_TEXT) ||
+ (nType == STATE_CHANGE_IMAGE) ||
+ (nType == STATE_CHANGE_DATA) )
+ {
+ if ( IsReallyVisible() && mbFrameBorder )
+ {
+ if ( HasPaintEvent() )
+ InvalidateBorder();
+ else
+ mpBorderView->DrawWindow( BORDERWINDOW_DRAW_TITLE );
+ }
+ }
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ if ( !mbFrame )
+ UpdateView( TRUE, ImplGetWindow()->GetOutputSizePixel() );
+ }
+
+ Window::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::InitView()
+{
+ if ( mbSmallOutBorder )
+ mpBorderView = new ImplSmallBorderWindowView( this );
+ else if ( mbFrame )
+ mpBorderView = new ImplNoBorderWindowView( this );
+ else if ( !mbFrameBorder )
+ mpBorderView = new ImplSmallBorderWindowView( this );
+ else if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_MACSTYLE )
+ mpBorderView = new ImplMacBorderWindowView( this );
+ else if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_OS2STYLE )
+ mpBorderView = new ImplOS2BorderWindowView( this );
+ else if ( GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_UNIXSTYLE )
+ mpBorderView = new ImplUnxBorderWindowView( this );
+ else
+ mpBorderView = new ImplStdBorderWindowView( this );
+ Size aSize = GetOutputSizePixel();
+ mpBorderView->Init( this, aSize.Width(), aSize.Height() );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::UpdateView( BOOL bNewView, const Size& rNewOutSize )
+{
+ long nLeftBorder;
+ long nTopBorder;
+ long nRightBorder;
+ long nBottomBorder;
+ Size aOldSize = GetSizePixel();
+ Size aOutputSize = rNewOutSize;
+
+ if ( bNewView )
+ {
+ delete mpBorderView;
+ InitView();
+ }
+ else
+ {
+ Size aSize = aOutputSize;
+ mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
+ aSize.Width() += nLeftBorder+nRightBorder;
+ aSize.Height() += nTopBorder+nBottomBorder;
+ mpBorderView->Init( this, aSize.Width(), aSize.Height() );
+ }
+
+ Window* pClientWindow = ImplGetClientWindow();
+ if ( pClientWindow )
+ {
+ GetBorder( pClientWindow->mnLeftBorder, pClientWindow->mnTopBorder,
+ pClientWindow->mnRightBorder, pClientWindow->mnBottomBorder );
+ }
+ GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
+ if ( aOldSize.Width() || aOldSize.Height() )
+ {
+ aOutputSize.Width() += nLeftBorder+nRightBorder;
+ aOutputSize.Height() += nTopBorder+nBottomBorder;
+ if ( aOutputSize == GetSizePixel() )
+ InvalidateBorder();
+ else
+ SetSizePixel( aOutputSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::InvalidateBorder()
+{
+ if ( IsReallyVisible() )
+ {
+ // Nur wenn wir einen Border haben, muessen wir auch invalidieren
+ long nLeftBorder;
+ long nTopBorder;
+ long nRightBorder;
+ long nBottomBorder;
+ mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
+ if ( nLeftBorder || nTopBorder || nRightBorder || nBottomBorder )
+ {
+ Rectangle aWinRect( Point( 0, 0 ), GetOutputSizePixel() );
+ Region aRegion( aWinRect );
+ aWinRect.Left() += nLeftBorder;
+ aWinRect.Top() += nTopBorder;
+ aWinRect.Right() -= nRightBorder;
+ aWinRect.Bottom() -= nBottomBorder;
+ // kein Output-Bereich mehr, dann alles invalidieren
+ if ( (aWinRect.Right() < aWinRect.Left()) ||
+ (aWinRect.Bottom() < aWinRect.Top()) )
+ Invalidate( INVALIDATE_NOCHILDREN );
+ else
+ {
+ aRegion.Exclude( aWinRect );
+ Invalidate( aRegion, INVALIDATE_NOCHILDREN );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetDisplayActive( BOOL bActive )
+{
+ if ( mbDisplayActive != bActive )
+ {
+ mbDisplayActive = bActive;
+ if ( mbFrameBorder )
+ InvalidateBorder();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetTitleType( USHORT nTitleType, const Size& rSize )
+{
+ mnTitleType = nTitleType;
+ UpdateView( FALSE, rSize );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetBorderStyle( USHORT nStyle )
+{
+ if ( !mbFrameBorder && (mnBorderStyle != nStyle) )
+ {
+ mnBorderStyle = nStyle;
+ UpdateView( FALSE, ImplGetWindow()->GetOutputSizePixel() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetPin( BOOL bPin )
+{
+ mbPined = bPin;
+ InvalidateBorder();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetRollUp( BOOL bRollUp, const Size& rSize )
+{
+ mbRollUp = bRollUp;
+ mnRollHeight = rSize.Height();
+ UpdateView( FALSE, rSize );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetCloser()
+{
+ SetStyle( GetStyle() | WB_CLOSEABLE );
+ Size aSize = GetOutputSizePixel();
+ mpBorderView->Init( this, aSize.Width(), aSize.Height() );
+ InvalidateBorder();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetDockButton( BOOL bDockButton )
+{
+ mbDockBtn = bDockButton;
+ Size aSize = GetOutputSizePixel();
+ mpBorderView->Init( this, aSize.Width(), aSize.Height() );
+ InvalidateBorder();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetHideButton( BOOL bHideButton )
+{
+ mbHideBtn = bHideButton;
+ Size aSize = GetOutputSizePixel();
+ mpBorderView->Init( this, aSize.Width(), aSize.Height() );
+ InvalidateBorder();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetHelpButton( BOOL bHelpButton )
+{
+ mbHelpBtn = bHelpButton;
+ Size aSize = GetOutputSizePixel();
+ mpBorderView->Init( this, aSize.Width(), aSize.Height() );
+ InvalidateBorder();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::UpdateMenuHeight()
+{
+ Resize();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetMenuBarWindow( Window* pWindow )
+{
+ mpMenuBarWindow = pWindow;
+ UpdateMenuHeight();
+ if ( pWindow )
+ pWindow->Show();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::SetMenuBarMode( BOOL bHide )
+{
+ mbMenuHide = bHide;
+ UpdateMenuHeight();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplBorderWindow::GetBorder( long& rLeftBorder, long& rTopBorder,
+ long& rRightBorder, long& rBottomBorder ) const
+{
+ mpBorderView->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
+ if ( mpMenuBarWindow && !mbMenuHide )
+ rTopBorder += mpMenuBarWindow->GetSizePixel().Height();
+}
+
+// -----------------------------------------------------------------------
+
+long ImplBorderWindow::CalcTitleWidth() const
+{
+ return mpBorderView->CalcTitleWidth();
+}
diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx
new file mode 100644
index 000000000000..185da6bd83e0
--- /dev/null
+++ b/vcl/source/window/btndlg.cxx
@@ -0,0 +1,584 @@
+/*************************************************************************
+ *
+ * $RCSfile: btndlg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_BTNDLG_CXX
+#include <tools/ref.hxx>
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+#ifndef _SV_BTNDLG_HXX
+#include <btndlg.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+
+#pragma hdrstop
+
+// =======================================================================
+
+struct ImplBtnDlgItem
+{
+ USHORT mnId;
+ BOOL mbOwnButton;
+ BOOL mbDummyAlign;
+ long mnSepSize;
+ PushButton* mpPushButton;
+};
+
+DECLARE_LIST( ImplBtnDlgItemList, ImplBtnDlgItem* );
+
+// =======================================================================
+
+void ButtonDialog::ImplInitData()
+{
+ mpItemList = new ImplBtnDlgItemList( 8, 8 );
+ mnButtonSize = 0;
+ mnCurButtonId = 0;
+ mnFocusButtonId = BUTTONDIALOG_BUTTON_NOTFOUND;
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+ButtonDialog::ButtonDialog( WindowType nType ) :
+ Dialog( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+ButtonDialog::ButtonDialog( Window* pParent, WinBits nStyle ) :
+ Dialog( WINDOW_TABDIALOG )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ButtonDialog::ButtonDialog( Window* pParent, const ResId& rResId ) :
+ Dialog( WINDOW_BUTTONDIALOG )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_DIALOG ); // !!!!!!!!!! RSC_BUTTONDIALOG !!!!!!!!
+ ImplInit( pParent, ImplInitRes( rResId ) );
+ ImplLoadRes( rResId );
+}
+
+// -----------------------------------------------------------------------
+
+ButtonDialog::~ButtonDialog()
+{
+ ImplBtnDlgItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mpPushButton && pItem->mbOwnButton )
+ delete pItem->mpPushButton;
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ delete mpItemList;
+}
+
+// -----------------------------------------------------------------------
+
+PushButton* ButtonDialog::ImplCreatePushButton( USHORT nBtnFlags )
+{
+ PushButton* pBtn;
+ WinBits nStyle = 0;
+
+ if ( nBtnFlags & BUTTONDIALOG_DEFBUTTON )
+ nStyle |= WB_DEFBUTTON;
+ if ( nBtnFlags & BUTTONDIALOG_CANCELBUTTON )
+ pBtn = new CancelButton( this, nStyle );
+ else if ( nBtnFlags & BUTTONDIALOG_OKBUTTON )
+ pBtn = new OKButton( this, nStyle );
+ else if ( nBtnFlags & BUTTONDIALOG_HELPBUTTON )
+ pBtn = new HelpButton( this, nStyle );
+ else
+ pBtn = new PushButton( this, nStyle );
+
+ if ( !(nBtnFlags & BUTTONDIALOG_HELPBUTTON) )
+ pBtn->SetClickHdl( LINK( this, ButtonDialog, ImplClickHdl ) );
+
+ return pBtn;
+}
+
+// -----------------------------------------------------------------------
+
+ImplBtnDlgItem* ButtonDialog::ImplGetItem( USHORT nId ) const
+{
+ ImplBtnDlgItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nId )
+ return pItem;
+
+ pItem = mpItemList->Next();
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+long ButtonDialog::ImplGetButtonSize()
+{
+ if ( !mbFormat )
+ return mnButtonSize;
+
+ // Calculate ButtonSize
+ long nLastSepSize = 0;
+ long nSepSize = 0;
+ long nButtonCount = 0;
+ maCtrlSize = Size( IMPL_MINSIZE_BUTTON_WIDTH, IMPL_MINSIZE_BUTTON_HEIGHT );
+ ImplBtnDlgItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ nSepSize += nLastSepSize;
+
+ long nTxtWidth = pItem->mpPushButton->GetCtrlTextWidth( pItem->mpPushButton->GetText() );
+ nTxtWidth += IMPL_EXTRA_BUTTON_WIDTH;
+ if ( nTxtWidth > maCtrlSize.Width() )
+ maCtrlSize.Width() = nTxtWidth;
+ long nTxtHeight = pItem->mpPushButton->GetTextHeight();
+ nTxtHeight += IMPL_EXTRA_BUTTON_HEIGHT;
+ if ( nTxtHeight > maCtrlSize.Height() )
+ maCtrlSize.Height() = nTxtHeight;
+
+ nSepSize += pItem->mnSepSize;
+
+ if ( GetStyle() & WB_HORZ )
+ nLastSepSize = IMPL_SEP_BUTTON_X;
+ else
+ nLastSepSize = IMPL_SEP_BUTTON_Y;
+
+ nButtonCount++;
+
+ pItem = mpItemList->Next();
+ }
+
+ if ( GetStyle() & WB_HORZ )
+ mnButtonSize = nSepSize + (nButtonCount*maCtrlSize.Width());
+ else
+ mnButtonSize = nSepSize + (nButtonCount*maCtrlSize.Height());
+
+ return mnButtonSize;
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::ImplPosControls()
+{
+ if ( !mbFormat )
+ return;
+
+ // Create PushButtons and determine Sizes
+ ImplGetButtonSize();
+
+ // determine dialog size
+ ImplBtnDlgItem* pItem;
+ Size aDlgSize = maPageSize;
+ long nX;
+ long nY;
+ if ( GetStyle() & WB_HORZ )
+ {
+ if ( mnButtonSize+(IMPL_DIALOG_OFFSET*2) > aDlgSize.Width() )
+ aDlgSize.Width() = mnButtonSize+(IMPL_DIALOG_OFFSET*2);
+ if ( GetStyle() & WB_LEFT )
+ nX = IMPL_DIALOG_OFFSET;
+ else if ( GetStyle() & WB_RIGHT )
+ nX = aDlgSize.Width()-mnButtonSize-IMPL_DIALOG_OFFSET;
+ else
+ nX = (aDlgSize.Width()-mnButtonSize)/2;
+
+ aDlgSize.Height() += IMPL_DIALOG_OFFSET+maCtrlSize.Height();
+ nY = aDlgSize.Height()-maCtrlSize.Height()-IMPL_DIALOG_OFFSET;
+ }
+ else
+ {
+ if ( mnButtonSize+(IMPL_DIALOG_OFFSET*2) > aDlgSize.Height() )
+ aDlgSize.Height() = mnButtonSize+(IMPL_DIALOG_OFFSET*2);
+ if ( GetStyle() & WB_BOTTOM )
+ nY = aDlgSize.Height()-mnButtonSize-IMPL_DIALOG_OFFSET;
+ else if ( GetStyle() & WB_VCENTER )
+ nY = (aDlgSize.Height()-mnButtonSize)/2;
+ else
+ nY = IMPL_DIALOG_OFFSET;
+
+ aDlgSize.Width() += IMPL_DIALOG_OFFSET+maCtrlSize.Width();
+ nX = aDlgSize.Width()-maCtrlSize.Width()-IMPL_DIALOG_OFFSET;
+ }
+
+ // Arrange PushButtons
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( GetStyle() & WB_HORZ )
+ nX += pItem->mnSepSize;
+ else
+ nY += pItem->mnSepSize;
+ pItem->mpPushButton->SetPosSizePixel( Point( nX, nY ), maCtrlSize );
+ pItem->mpPushButton->Show();
+ if ( GetStyle() & WB_HORZ )
+ nX += maCtrlSize.Width()+IMPL_SEP_BUTTON_X;
+ else
+ nY += maCtrlSize.Height()+IMPL_SEP_BUTTON_Y;
+
+ pItem = mpItemList->Next();
+ }
+
+ SetOutputSizePixel( aDlgSize );
+
+ mbFormat = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ButtonDialog, ImplClickHdl, PushButton*, pBtn )
+{
+ ImplBtnDlgItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mpPushButton == pBtn )
+ {
+ mnCurButtonId = pItem->mnId;
+ Click();
+ break;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::Resize()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ ImplPosControls();
+
+ // Focus evt. auf den entsprechenden Button setzen
+ if ( mnFocusButtonId != BUTTONDIALOG_BUTTON_NOTFOUND )
+ {
+ ImplBtnDlgItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == mnFocusButtonId )
+ {
+ if ( pItem->mpPushButton->IsVisible() )
+ pItem->mpPushButton->GrabFocus();
+ break;
+ }
+
+ pItem = mpItemList->Next();
+ }
+ }
+ }
+
+ Dialog::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::Click()
+{
+ if ( !maClickHdl )
+ {
+ if ( IsInExecute() )
+ EndDialog( GetCurButtonId() );
+ }
+ else
+ maClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::AddButton( const XubString& rText, USHORT nId,
+ USHORT nBtnFlags, long nSepPixel )
+{
+ // PageItem anlegen
+ ImplBtnDlgItem* pItem = new ImplBtnDlgItem;
+ pItem->mnId = nId;
+ pItem->mbOwnButton = TRUE;
+ pItem->mnSepSize = nSepPixel;
+ pItem->mpPushButton = ImplCreatePushButton( nBtnFlags );
+ if ( rText.Len() )
+ pItem->mpPushButton->SetText( rText );
+
+ // In die StarView-Liste eintragen
+ mpItemList->Insert( pItem, LIST_APPEND );
+
+ if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON )
+ mnFocusButtonId = nId;
+
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::AddButton( StandardButtonType eType, USHORT nId,
+ USHORT nBtnFlags, long nSepPixel )
+{
+ // PageItem anlegen
+ ImplBtnDlgItem* pItem = new ImplBtnDlgItem;
+ pItem->mnId = nId;
+ pItem->mbOwnButton = TRUE;
+ pItem->mnSepSize = nSepPixel;
+
+ if ( eType == BUTTON_HELP )
+ nBtnFlags |= BUTTONDIALOG_HELPBUTTON;
+ else if ( (eType == BUTTON_CANCEL) || (eType == BUTTON_CLOSE) )
+ nBtnFlags |= BUTTONDIALOG_CANCELBUTTON;
+ pItem->mpPushButton = ImplCreatePushButton( nBtnFlags );
+ pItem->mpPushButton->SetText( Button::GetStandardText( eType ) );
+ pItem->mpPushButton->SetHelpText( Button::GetStandardHelpText( eType ) );
+
+ if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON )
+ mnFocusButtonId = nId;
+
+ // In die StarView-Liste eintragen
+ mpItemList->Insert( pItem, LIST_APPEND );
+
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::AddButton( PushButton* pBtn, USHORT nId,
+ USHORT nBtnFlags, long nSepPixel )
+{
+ // PageItem anlegen
+ ImplBtnDlgItem* pItem = new ImplBtnDlgItem;
+ pItem->mnId = nId;
+ pItem->mbOwnButton = FALSE;
+ pItem->mnSepSize = nSepPixel;
+ pItem->mpPushButton = pBtn;
+
+ if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON )
+ mnFocusButtonId = nId;
+
+ // In die StarView-Liste eintragen
+ mpItemList->Insert( pItem, LIST_APPEND );
+
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::RemoveButton( USHORT nId )
+{
+ ImplBtnDlgItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nId )
+ {
+ pItem->mpPushButton->Hide();
+ if ( pItem->mbOwnButton )
+ delete pItem->mpPushButton;
+ delete pItem;
+ mpItemList->Remove();
+ mbFormat = TRUE;
+ break;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ DBG_ERRORFILE( "ButtonDialog::RemoveButton(): ButtonId invalid" );
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::Clear()
+{
+ ImplBtnDlgItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ pItem->mpPushButton->Hide();
+ if ( pItem->mbOwnButton )
+ delete pItem->mpPushButton;
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ mpItemList->Clear();
+ mbFormat = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ButtonDialog::GetButtonCount() const
+{
+ return (USHORT)mpItemList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ButtonDialog::GetButtonId( USHORT nButton ) const
+{
+ if ( nButton < mpItemList->Count() )
+ return (USHORT)mpItemList->GetObject( nButton )->mnId;
+ else
+ return BUTTONDIALOG_BUTTON_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+PushButton* ButtonDialog::GetPushButton( USHORT nId ) const
+{
+ ImplBtnDlgItem* pItem = ImplGetItem( nId );
+
+ if ( pItem )
+ return pItem->mpPushButton;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::SetButtonText( USHORT nId, const XubString& rText )
+{
+ ImplBtnDlgItem* pItem = ImplGetItem( nId );
+
+ if ( pItem )
+ {
+ pItem->mpPushButton->SetText( rText );
+ mbFormat = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString ButtonDialog::GetButtonText( USHORT nId ) const
+{
+ ImplBtnDlgItem* pItem = ImplGetItem( nId );
+
+ if ( pItem )
+ return pItem->mpPushButton->GetText();
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::SetButtonHelpText( USHORT nId, const XubString& rText )
+{
+ ImplBtnDlgItem* pItem = ImplGetItem( nId );
+
+ if ( pItem )
+ pItem->mpPushButton->SetHelpText( rText );
+}
+
+// -----------------------------------------------------------------------
+
+XubString ButtonDialog::GetButtonHelpText( USHORT nId ) const
+{
+ ImplBtnDlgItem* pItem = ImplGetItem( nId );
+
+ if ( pItem )
+ return pItem->mpPushButton->GetHelpText();
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void ButtonDialog::SetButtonHelpId( USHORT nId, ULONG nHelpId )
+{
+ ImplBtnDlgItem* pItem = ImplGetItem( nId );
+
+ if ( pItem )
+ pItem->mpPushButton->SetHelpId( nHelpId );
+}
+
+// -----------------------------------------------------------------------
+
+ULONG ButtonDialog::GetButtonHelpId( USHORT nId ) const
+{
+ ImplBtnDlgItem* pItem = ImplGetItem( nId );
+
+ if ( pItem )
+ return pItem->mpPushButton->GetHelpId();
+ else
+ return 0;
+}
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
new file mode 100644
index 000000000000..ec2bb1c80506
--- /dev/null
+++ b/vcl/source/window/cursor.cxx
@@ -0,0 +1,449 @@
+/*************************************************************************
+ *
+ * $RCSfile: cursor.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_CURSOR_CXX
+
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_CURSOR_HXX
+#include <cursor.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+struct ImplCursorData
+{
+ AutoTimer maTimer; // Timer
+ Point maPixPos; // Pixel-Position
+ Point maPixRotOff; // Pixel-Offset-Position
+ Size maPixSize; // Pixel-Size
+ long mnPixSlant; // Pixel-Slant
+ short mnOrientation; // Pixel-Orientation
+ USHORT mnStyle; // Cursor-Style
+ BOOL mbCurVisible; // Ist Cursor aktuell sichtbar
+ Window* mpWindow; // Zugeordnetes Windows
+};
+
+// =======================================================================
+
+static void ImplCursorInvert( ImplCursorData* pData )
+{
+ Window* pWindow = pData->mpWindow;
+ BOOL bMapMode = pWindow->IsMapModeEnabled();
+ pWindow->EnableMapMode( FALSE );
+ USHORT nInvertStyle;
+ if ( pData->mnStyle & CURSOR_SHADOW )
+ nInvertStyle = INVERT_50;
+ else
+ nInvertStyle = 0;
+ Rectangle aRect( pData->maPixPos, pData->maPixSize );
+ if ( pData->mnOrientation || pData->mnPixSlant )
+ {
+ Polygon aPoly( aRect );
+ if ( pData->mnPixSlant )
+ {
+ Point aPoint = aPoly.GetPoint( 0 );
+ aPoint.X() += pData->mnPixSlant;
+ aPoly.SetPoint( aPoint, 0 );
+ aPoly.SetPoint( aPoint, 4 );
+ aPoint = aPoly.GetPoint( 1 );
+ aPoint.X() += pData->mnPixSlant;
+ aPoly.SetPoint( aPoint, 1 );
+ }
+ if ( pData->mnOrientation )
+ aPoly.Rotate( pData->maPixRotOff, pData->mnOrientation );
+ pWindow->Invert( aPoly, nInvertStyle );
+ }
+ else
+ pWindow->Invert( aRect, nInvertStyle );
+ pWindow->EnableMapMode( bMapMode );
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::ImplDraw()
+{
+ if ( mpData && mpData->mpWindow && !mpData->mbCurVisible )
+ {
+ Window* pWindow = mpData->mpWindow;
+ mpData->maPixPos = pWindow->LogicToPixel( maPos );
+ mpData->maPixSize = pWindow->LogicToPixel( maSize );
+ mpData->mnPixSlant = pWindow->LogicToPixel( Size( mnSlant, 0 ) ).Width();
+ mpData->mnOrientation = mnOrientation;
+ long nOffsetY = pWindow->LogicToPixel( Size( 0, mnOffsetY ) ).Height();
+
+ // Position um den Offset korrigieren
+ mpData->maPixPos.Y() -= nOffsetY;
+ mpData->maPixRotOff = mpData->maPixPos;
+ mpData->maPixRotOff.Y() += nOffsetY;
+
+ // Wenn groesse 0 ist, nehmen wir die breite, die in den
+ // Settings eingestellt ist
+ if ( !mpData->maPixSize.Width() )
+ mpData->maPixSize.Width() = pWindow->GetSettings().GetStyleSettings().GetCursorSize();
+
+ // Ausgabeflaeche berechnen und ausgeben
+ ImplCursorInvert( mpData );
+ mpData->mbCurVisible = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::ImplRestore()
+{
+ if ( mpData && mpData->mbCurVisible )
+ {
+ ImplCursorInvert( mpData );
+ mpData->mbCurVisible = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::ImplShow( BOOL bDrawDirect )
+{
+ if ( mbVisible )
+ {
+ Window* pWindow;
+ if ( mpWindow )
+ pWindow = mpWindow;
+ else
+ {
+ // Gibt es ein aktives Fenster und ist der Cursor in dieses Fenster
+ // selektiert, dann zeige den Cursor an
+ pWindow = Application::GetFocusWindow();
+ if ( !pWindow || (pWindow->mpCursor != this) || pWindow->mbInPaint )
+ pWindow = NULL;
+ }
+
+ if ( pWindow )
+ {
+ if ( !mpData )
+ {
+ mpData = new ImplCursorData;
+ mpData->mbCurVisible = FALSE;
+ mpData->maTimer.SetTimeoutHdl( LINK( this, Cursor, ImplTimerHdl ) );
+ }
+
+ mpData->mpWindow = pWindow;
+ mpData->mnStyle = mnStyle;
+ if ( bDrawDirect )
+ ImplDraw();
+
+ if ( !mpWindow )
+ {
+ mpData->maTimer.SetTimeout( pWindow->GetSettings().GetStyleSettings().GetCursorBlinkTime() );
+ if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
+ mpData->maTimer.Start();
+ else if ( !mpData->mbCurVisible )
+ ImplDraw();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::ImplHide()
+{
+ if ( mpData && mpData->mpWindow )
+ {
+ if ( mpData->mbCurVisible )
+ ImplRestore();
+
+ mpData->maTimer.Stop();
+ mpData->mpWindow = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::ImplNew()
+{
+ if ( mbVisible && mpData && mpData->mpWindow )
+ {
+ if ( mpData->mbCurVisible )
+ ImplRestore();
+
+ ImplDraw();
+ if ( !mpWindow )
+ {
+ if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
+ mpData->maTimer.Start();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Cursor, ImplTimerHdl, AutoTimer*, EMPTYARG )
+{
+ if ( mpData->mbCurVisible )
+ ImplRestore();
+ else
+ ImplDraw();
+ return 0;
+}
+
+// =======================================================================
+
+Cursor::Cursor()
+{
+ mpData = NULL;
+ mpWindow = NULL;
+ mnSlant = 0;
+ mnOffsetY = 0;
+ mnOrientation = 0;
+ mnStyle = 0;
+ mbVisible = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Cursor::Cursor( const Cursor& rCursor ) :
+ maPos( rCursor.maPos ),
+ maSize( rCursor.maSize )
+{
+ mpData = NULL;
+ mpWindow = NULL;
+ mnSlant = rCursor.mnSlant;
+ mnOrientation = rCursor.mnOrientation;
+ mnStyle = 0;
+ mbVisible = rCursor.mbVisible;
+}
+
+// -----------------------------------------------------------------------
+
+Cursor::~Cursor()
+{
+ if ( mpData )
+ {
+ if ( mpData->mbCurVisible )
+ ImplRestore();
+
+ delete mpData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetStyle( USHORT nStyle )
+{
+ if ( mnStyle != nStyle )
+ {
+ mnStyle = nStyle;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::Show()
+{
+ if ( !mbVisible )
+ {
+ mbVisible = TRUE;
+ ImplShow();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::Hide()
+{
+ if ( mbVisible )
+ {
+ mbVisible = FALSE;
+ ImplHide();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetWindow( Window* pWindow )
+{
+ if ( mpWindow != pWindow )
+ {
+ mpWindow = pWindow;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetPos( const Point& rPoint )
+{
+ if ( maPos != rPoint )
+ {
+ maPos = rPoint;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetOffsetY( long nNewOffsetY )
+{
+ if ( mnOffsetY != nNewOffsetY )
+ {
+ mnOffsetY = nNewOffsetY;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetSize( const Size& rSize )
+{
+ if ( maSize != rSize )
+ {
+ maSize = rSize;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetWidth( long nNewWidth )
+{
+ if ( maSize.Width() != nNewWidth )
+ {
+ maSize.Width() = nNewWidth;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetHeight( long nNewHeight )
+{
+ if ( maSize.Height() != nNewHeight )
+ {
+ maSize.Height() = nNewHeight;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetSlant( long nNewSlant )
+{
+ if ( mnSlant != nNewSlant )
+ {
+ mnSlant = nNewSlant;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Cursor::SetOrientation( short nNewOrientation )
+{
+ if ( mnOrientation != nNewOrientation )
+ {
+ mnOrientation = nNewOrientation;
+ ImplNew();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Cursor& Cursor::operator=( const Cursor& rCursor )
+{
+ maPos = rCursor.maPos;
+ maSize = rCursor.maSize;
+ mnSlant = rCursor.mnSlant;
+ mnOrientation = rCursor.mnOrientation;
+ mbVisible = rCursor.mbVisible;
+ ImplNew();
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Cursor::operator==( const Cursor& rCursor ) const
+{
+ if ( (maPos == rCursor.maPos) &&
+ (maSize == rCursor.maSize) &&
+ (mnSlant == rCursor.mnSlant) &&
+ (mnOrientation == rCursor.mnOrientation) &&
+ (mbVisible == rCursor.mbVisible) )
+ return TRUE;
+ else
+ return FALSE;
+}
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
new file mode 100644
index 000000000000..e7169fee2131
--- /dev/null
+++ b/vcl/source/window/decoview.cxx
@@ -0,0 +1,1297 @@
+/*************************************************************************
+ *
+ * $RCSfile: decoview.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_DECOVIEW_CXX
+
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <outdev.hxx>
+#endif
+#ifndef _SV_BMPACC_HXX
+#include <bmpacc.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define BUTTON_DRAW_FLATTEST (BUTTON_DRAW_FLAT | \
+ BUTTON_DRAW_PRESSED | \
+ BUTTON_DRAW_CHECKED | \
+ BUTTON_DRAW_HIGHLIGHT)
+
+// =======================================================================
+
+void ImplDrawOS2Symbol( OutputDevice* pDev, const Rectangle& rRect,
+ USHORT nStyle, BOOL bClose )
+{
+ DecorationView aView( pDev );
+ const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
+ Rectangle aRect = rRect;
+ Color aColor1;
+ Color aColor2;
+
+ pDev->SetFillColor();
+
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ aColor1 = rStyleSettings.GetShadowColor();
+ aColor2 = rStyleSettings.GetLightColor();
+ }
+ else
+ {
+ aColor1 = rStyleSettings.GetLightColor();
+ aColor2 = rStyleSettings.GetShadowColor();
+ }
+ aView.DrawFrame( aRect, aColor1, aColor2 );
+
+ aRect.Left() += 2;
+ aRect.Top() += 2;
+ aRect.Right() -= 2;
+ aRect.Bottom() -= 2;
+
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ if ( bClose )
+ {
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom()-2 ) );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-2, aRect.Top() ) );
+ pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom()-1 ),
+ Point( aRect.Right()-1, aRect.Top()+2 ) );
+ }
+ else
+ {
+ pDev->DrawLine( aRect.TopLeft(), aRect.BottomLeft() );
+ pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right()-1, aRect.Top() ) );
+ }
+
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ else
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ if ( bClose )
+ {
+ pDev->DrawLine( Point( aRect.Right(), aRect.Top()+2 ), aRect.BottomRight() );
+ pDev->DrawLine( Point( aRect.Left()+2, aRect.Bottom() ), aRect.BottomRight() );
+ pDev->DrawLine( Point( aRect.Right()-2, aRect.Top()+1 ),
+ Point( aRect.Left()+1, aRect.Bottom()-2 ) );
+ }
+ else
+ {
+ pDev->DrawLine( aRect.TopRight(), aRect.BottomRight() );
+ pDev->DrawLine( Point( aRect.Left()+1, aRect.Bottom() ), aRect.BottomRight() );
+ }
+}
+
+// =======================================================================
+
+static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect,
+ SymbolType eType )
+{
+ // Groessen vorberechnen
+ long n;
+ long nHeight = rRect.GetHeight();
+ long nWidth = rRect.GetWidth();
+ if ( nWidth < nHeight )
+ n = nWidth;
+ else
+ n = nHeight;
+ if ( n & 0x01 )
+ n--;
+ Point aCenter = rRect.Center();
+ long nCenterX = aCenter.X();
+ long nCenterY = aCenter.Y();
+ long n2 = n / 2;
+ long n4 = n / 4;
+ long nLeft;
+ long nTop;
+ long nRight;
+ long nBottom;
+ long nTemp;
+ long i;
+
+ switch ( eType )
+ {
+ case SYMBOL_ARROW_UP:
+ {
+ if ( !(n & 0x01) )
+ {
+ n2--;
+ n4--;
+ }
+ nTop = nCenterY-n2;
+ nBottom = nCenterY;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nTop++;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ i++;
+ }
+ pDev->DrawRect( Rectangle( nCenterX-n4, nBottom,
+ nCenterX+n4, nBottom+n2 ) );
+ }
+ break;
+
+ case SYMBOL_ARROW_DOWN:
+ {
+ if ( !(n & 0x01) )
+ {
+ n2--;
+ n4--;
+ }
+ nTop = nCenterY;
+ nBottom = nCenterY+n2;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nBottom--;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ i++;
+ }
+ pDev->DrawRect( Rectangle( nCenterX-n4, nTop-n2,
+ nCenterX+n4, nTop ) );
+ }
+ break;
+
+ case SYMBOL_ARROW_LEFT:
+ {
+ if ( !(n & 0x01) )
+ {
+ n2--;
+ n4--;
+ }
+ nLeft = nCenterX-n2;
+ nRight = nCenterX;
+ pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nLeft++;
+ nTemp = nCenterY-i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ nTemp = nCenterY+i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ i++;
+ }
+ pDev->DrawRect( Rectangle( nRight, nCenterY-n4,
+ nRight+n2, nCenterY+n4 ) );
+ }
+ break;
+
+ case SYMBOL_ARROW_RIGHT:
+ {
+ if ( !(n & 0x01) )
+ {
+ n2--;
+ n4--;
+ }
+ nLeft = nCenterX;
+ nRight = nCenterX+n2;
+ pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nRight--;
+ nTemp = nCenterY-i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ nTemp = nCenterY+i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ i++;
+ }
+ pDev->DrawRect( Rectangle( nLeft-n2, nCenterY-n4,
+ nLeft, nCenterY+n4 ) );
+ }
+ break;
+
+
+ case SYMBOL_SPIN_UP:
+ {
+ if ( !(n & 0x01) )
+ n2--;
+ nTop = nCenterY-n4;
+ nBottom = nTop+n2;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nTop++;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ i++;
+ }
+ }
+ break;
+
+ case SYMBOL_SPIN_DOWN:
+ {
+ if ( !(n & 0x01) )
+ n2--;
+ nTop = nCenterY-n4;
+ nBottom = nTop+n2;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nBottom--;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ i++;
+ }
+ }
+ break;
+
+ case SYMBOL_SPIN_LEFT:
+ case SYMBOL_FIRST:
+ case SYMBOL_PREV:
+ case SYMBOL_REVERSEPLAY:
+ {
+ if ( !(n & 0x01) )
+ n2--;
+ nLeft = nCenterX-n4;
+ if ( eType == SYMBOL_FIRST )
+ nLeft++;
+ nRight = nLeft+n2;
+ pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nLeft++;
+ nTemp = nCenterY-i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ nTemp = nCenterY+i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ i++;
+ }
+ if ( eType == SYMBOL_FIRST )
+ {
+ pDev->DrawRect( Rectangle( nCenterX-n4-1, nCenterY-n2,
+ nCenterX-n4-1, nCenterY+n2 ) );
+ }
+ }
+ break;
+
+ case SYMBOL_SPIN_RIGHT:
+ case SYMBOL_LAST:
+ case SYMBOL_NEXT:
+ case SYMBOL_PLAY:
+ {
+ if ( !(n & 0x01) )
+ n2--;
+ nLeft = nCenterX-n4;
+ if ( eType == SYMBOL_LAST )
+ nLeft--;
+ nRight = nLeft+n2;
+ pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nRight--;
+ nTemp = nCenterY-i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ nTemp = nCenterY+i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ i++;
+ }
+ if ( eType == SYMBOL_LAST )
+ {
+ pDev->DrawRect( Rectangle( nCenterX+n4+1, nCenterY-n2,
+ nCenterX+n4+1, nCenterY+n2 ) );
+ }
+ }
+ break;
+
+ case SYMBOL_PAGEUP:
+ {
+ nTop = nCenterY-n2;
+ nBottom = nCenterY-1;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ pDev->DrawRect( Rectangle( nCenterX, nTop+n2+1, nCenterX, nBottom+n2+1 ) );
+ i = 1;
+ while ( i < n2 )
+ {
+ nTop++;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
+ i++;
+ }
+ }
+ break;
+
+ case SYMBOL_PAGEDOWN:
+ {
+ nTop = nCenterY-n2;
+ nBottom = nCenterY-1;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ pDev->DrawRect( Rectangle( nCenterX, nTop+n2+1, nCenterX, nBottom+n2+1 ) );
+ i = 1;
+ while ( i < n2 )
+ {
+ nBottom--;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
+ i++;
+ }
+ }
+ break;
+
+ case SYMBOL_RADIOCHECKMARK:
+ case SYMBOL_RECORD:
+ {
+ const long nExt = ( n2 << 1 ) + 1;
+ Bitmap aBmp( Size( nExt, nExt ), 1 );
+ BitmapWriteAccess* pWAcc = aBmp.AcquireWriteAccess();
+
+ if( pWAcc )
+ {
+ const Color aWhite( COL_WHITE );
+ const Color aBlack( COL_BLACK );
+
+ pWAcc->Erase( aWhite );
+ pWAcc->SetLineColor( aBlack );
+ pWAcc->SetFillColor( aBlack );
+ pWAcc->DrawPolygon( Polygon( Point( n2, n2 ), n2, n2 ) );
+ aBmp.ReleaseAccess( pWAcc );
+ pDev->DrawMask( Point( nCenterX - n2, nCenterY - n2 ), aBmp, pDev->GetFillColor() );
+ }
+ else
+ pDev->DrawPolygon( Polygon( Point( nCenterX, nCenterY ), n2, n2 ) );
+ }
+ break;
+
+ case SYMBOL_STOP:
+ {
+ nLeft = nCenterX-n2;
+ nRight = nCenterX+n2;
+ nTop = nCenterY-n2;
+ nBottom = nCenterY+n2;
+ pDev->DrawRect( Rectangle( nLeft, nTop, nRight, nBottom ) );
+ }
+ break;
+
+ case SYMBOL_PAUSE:
+ {
+ nLeft = nCenterX-n2;
+ nRight = nCenterX+n2-1;
+ nTop = nCenterY-n2;
+ nBottom = nCenterY+n2;
+ pDev->DrawRect( Rectangle( nLeft, nTop, nCenterX-2, nBottom ) );
+ pDev->DrawRect( Rectangle( nCenterX+1, nTop, nRight, nBottom ) );
+ }
+ break;
+
+ case SYMBOL_WINDSTART:
+ case SYMBOL_WINDBACKWARD:
+ {
+ nLeft = nCenterX-n2+1;
+ nRight = nCenterX;
+ pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
+ pDev->DrawRect( Rectangle( nLeft+n2, nCenterY, nRight+n2, nCenterY ) );
+ i = 1;
+ while ( i < n2 )
+ {
+ nLeft++;
+ nTemp = nCenterY-i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
+ nTemp = nCenterY+i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
+ i++;
+ }
+ if ( eType == SYMBOL_WINDSTART )
+ {
+ pDev->DrawRect( Rectangle( nCenterX-n2, nCenterY-n2,
+ nCenterX-n2, nCenterY+n2 ) );
+ }
+ }
+ break;
+
+ case SYMBOL_WINDEND:
+ case SYMBOL_WINDFORWARD:
+ {
+ nLeft = nCenterX-n2;
+ nRight = nCenterX-1;
+ pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
+ pDev->DrawRect( Rectangle( nLeft+n2, nCenterY, nRight+n2, nCenterY ) );
+ i = 1;
+ while ( i < n2 )
+ {
+ nRight--;
+ nTemp = nCenterY-i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
+ nTemp = nCenterY+i;
+ pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
+ pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
+ i++;
+ }
+ if ( eType == SYMBOL_WINDEND )
+ {
+ pDev->DrawRect( Rectangle( nCenterX+n2, nCenterY-n2,
+ nCenterX+n2, nCenterY+n2 ) );
+ }
+ }
+ break;
+
+ case SYMBOL_CLOSE:
+ {
+ Size aRectSize( 2, 1 );
+ if ( n < 8 )
+ aRectSize.Width() = 1;
+ else if ( n > 20 )
+ aRectSize.Width() = n/10;
+ nLeft = nCenterX-n2+1;
+ nTop = nCenterY-n2+1;
+ nBottom = nCenterY-n2+n-aRectSize.Width()+1;
+ i = 0;
+ while ( i < n-aRectSize.Width()+1 )
+ {
+ pDev->DrawRect( Rectangle( Point( nLeft+i, nTop+i ), aRectSize ) );
+ pDev->DrawRect( Rectangle( Point( nLeft+i, nBottom-i ), aRectSize ) );
+ i++;
+ }
+ }
+ break;
+
+ case SYMBOL_ROLLUP:
+ case SYMBOL_ROLLDOWN:
+ {
+ Rectangle aRect( nCenterX-n2, nCenterY-n2,
+ nCenterX+n2, nCenterY-n2+1 );
+ pDev->DrawRect( aRect );
+ if ( eType == SYMBOL_ROLLDOWN )
+ {
+ Rectangle aTempRect = aRect;
+ aTempRect.Bottom() = nCenterY+n2;
+ aTempRect.Right() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Left() = aRect.Right();
+ aTempRect.Right() = aRect.Right();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Top() = aTempRect.Bottom();
+ aTempRect.Left() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ }
+ }
+ break;
+ case SYMBOL_CHECKMARK:
+ {
+ Point aPos1( rRect.Left(), rRect.Bottom() - rRect.GetHeight() / 3 );
+ Point aPos2( rRect.Left() + rRect.GetWidth()/3, rRect.Bottom() );
+ Point aPos3( rRect.TopRight() );
+ Size aRectSize( 1, 2 );
+ long nStepsY = aPos2.Y()-aPos1.Y();
+ long nX = aPos1.X();
+ long nY = aPos1.Y();
+ for ( long n = 0; n <= nStepsY; n++ )
+ {
+ pDev->DrawRect( Rectangle( Point( nX, nY++ ), aRectSize ) );
+ nX++;
+ }
+ nStepsY = aPos2.Y()-aPos3.Y();
+ nX = aPos2.X();
+ nY = aPos2.Y();
+ for ( n = 0; n <= nStepsY; n++ )
+ {
+ pDev->DrawRect( Rectangle( Point( nX, nY-- ), aRectSize ) );
+ nX++;
+ if ( nX > rRect.Right() )
+ break;
+ }
+ }
+ break;
+
+ case SYMBOL_SPIN_UPDOWN:
+ {
+ nTop = nCenterY-n2-1;
+ nBottom = nTop+n2;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nTop++;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ i++;
+ }
+ nTop = nCenterY+1;
+ nBottom = nTop+n2;
+ pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
+ i = 1;
+ while ( i <= n2 )
+ {
+ nBottom--;
+ nTemp = nCenterX-i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ nTemp = nCenterX+i;
+ pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
+ i++;
+ }
+ }
+ break;
+
+
+ case SYMBOL_FLOAT:
+ {
+ Rectangle aRect( nCenterX-n2, nCenterY-n2+3,
+ nCenterX+n2-2, nCenterY-n2+4 );
+ pDev->DrawRect( aRect );
+ Rectangle aTempRect = aRect;
+ aTempRect.Bottom() = nCenterY+n2;
+ aTempRect.Right() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Left() = aRect.Right();
+ aTempRect.Right() = aRect.Right();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Top() = aTempRect.Bottom();
+ aTempRect.Left() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ aRect = Rectangle( nCenterX-n2+2, nCenterY-n2,
+ nCenterX+n2, nCenterY-n2+1 );
+ pDev->DrawRect( aRect );
+ aTempRect = aRect;
+ aTempRect.Bottom() = nCenterY+n2-3;
+ aTempRect.Right() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Left() = aRect.Right();
+ aTempRect.Right() = aRect.Right();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Top() = aTempRect.Bottom();
+ aTempRect.Left() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ }
+ break;
+ case SYMBOL_DOCK:
+ {
+ Rectangle aRect( nCenterX-n2, nCenterY-n2,
+ nCenterX+n2, nCenterY-n2 );
+ pDev->DrawRect( aRect );
+ Rectangle aTempRect = aRect;
+ aTempRect.Bottom() = nCenterY+n2;
+ aTempRect.Right() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Left() = aRect.Right();
+ aTempRect.Right() = aRect.Right();
+ pDev->DrawRect( aTempRect );
+ aTempRect.Top() = aTempRect.Bottom();
+ aTempRect.Left() = aRect.Left();
+ pDev->DrawRect( aTempRect );
+ }
+ break;
+ case SYMBOL_HIDE:
+ {
+ long nExtra = n / 8;
+ Rectangle aRect( nCenterX-n2+nExtra, nCenterY+n2-1,
+ nCenterX+n2-nExtra, nCenterY+n2 );
+ pDev->DrawRect( aRect );
+ }
+ break;
+
+ case SYMBOL_OS2CLOSE:
+ {
+ Rectangle aRect( nCenterX-n2, nCenterY-n2,
+ nCenterX+n2, nCenterY+n2 );
+ ImplDrawOS2Symbol( pDev, aRect, 0, TRUE );
+ }
+ break;
+
+ case SYMBOL_OS2FLOAT:
+ {
+ Rectangle aRect( nCenterX-n2+4, nCenterY-n2+4,
+ nCenterX+n2-4, nCenterY+n2-3 );
+ ImplDrawOS2Symbol( pDev, aRect, 0, FALSE );
+ DecorationView aDecoView( pDev );
+ Rectangle aRect2( nCenterX-n2, nCenterY-n2,
+ nCenterX-n2+2, nCenterY+n2 );
+ aDecoView.DrawFrame( aRect2,
+ pDev->GetSettings().GetStyleSettings().GetLightColor(),
+ pDev->GetSettings().GetStyleSettings().GetShadowColor() );
+ Rectangle aRect3( nCenterX+n2-2, nCenterY-n2,
+ nCenterX+n2, nCenterY+n2 );
+ aDecoView.DrawFrame( aRect3,
+ pDev->GetSettings().GetStyleSettings().GetLightColor(),
+ pDev->GetSettings().GetStyleSettings().GetShadowColor() );
+ }
+ break;
+
+ case SYMBOL_OS2HIDE:
+ {
+ Rectangle aRect( nCenterX-n2+3, nCenterY-n2+3,
+ nCenterX+n2-3, nCenterY+n2-3 );
+ ImplDrawOS2Symbol( pDev, aRect, 0, FALSE );
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DecorationView::DrawSymbol( const Rectangle& rRect, SymbolType eType,
+ const Color& rColor, USHORT nStyle )
+{
+ const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
+ Rectangle aRect = mpOutDev->LogicToPixel( rRect );
+ Color aOldLineColor = mpOutDev->GetLineColor();
+ Color aOldFillColor = mpOutDev->GetFillColor();
+ BOOL bOldMapMode = mpOutDev->IsMapModeEnabled();
+ mpOutDev->SetLineColor();
+ mpOutDev->SetFillColor( rColor );
+ mpOutDev->EnableMapMode( FALSE );
+
+ if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
+ (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) )
+ nStyle |= BUTTON_DRAW_MONO;
+
+ if ( nStyle & SYMBOL_DRAW_MONO )
+ {
+ if ( nStyle & SYMBOL_DRAW_DISABLE )
+ mpOutDev->SetFillColor( Color( COL_GRAY ) );
+ else
+ mpOutDev->SetFillColor( Color( COL_BLACK ) );
+ }
+ else
+ {
+ if ( nStyle & SYMBOL_DRAW_DISABLE )
+ {
+ // Als Embosed ausgeben
+ mpOutDev->SetFillColor( rStyleSettings.GetLightColor() );
+ Rectangle aTempRect = aRect;
+ aTempRect.Move( 1, 1 );
+ ImplDrawSymbol( mpOutDev, aTempRect, eType );
+ mpOutDev->SetFillColor( rStyleSettings.GetShadowColor() );
+ }
+ else
+ mpOutDev->SetFillColor( rColor );
+ }
+
+ ImplDrawSymbol( mpOutDev, aRect, eType );
+
+ mpOutDev->SetLineColor( aOldLineColor );
+ mpOutDev->SetFillColor( aOldFillColor );
+ mpOutDev->EnableMapMode( bOldMapMode );
+}
+
+// =======================================================================
+
+void DecorationView::DrawFrame( const Rectangle& rRect,
+ const Color& rLeftTopColor,
+ const Color& rRightBottomColor )
+{
+ Rectangle aRect = mpOutDev->LogicToPixel( rRect );
+ Color aOldLineColor = mpOutDev->GetLineColor();
+ Color aOldFillColor = mpOutDev->GetFillColor();
+ BOOL bOldMapMode = mpOutDev->IsMapModeEnabled();
+ mpOutDev->EnableMapMode( FALSE );
+ mpOutDev->SetLineColor();
+ mpOutDev->ImplDraw2ColorFrame( aRect, rLeftTopColor, rRightBottomColor );
+ mpOutDev->SetLineColor( aOldLineColor );
+ mpOutDev->SetFillColor( aOldFillColor );
+ mpOutDev->EnableMapMode( bOldMapMode );
+}
+
+// =======================================================================
+
+void DecorationView::DrawHighlightFrame( const Rectangle& rRect,
+ USHORT nStyle )
+{
+ const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
+ Color aLightColor = rStyleSettings.GetLightColor();
+ Color aShadowColor = rStyleSettings.GetShadowColor();
+
+ if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
+ (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) )
+ {
+ aLightColor = Color( COL_BLACK );
+ aShadowColor = Color( COL_BLACK );
+ }
+ else if ( nStyle & FRAME_HIGHLIGHT_TESTBACKGROUND )
+ {
+ Wallpaper aBackground = mpOutDev->GetBackground();
+ if ( aBackground.IsBitmap() || aBackground.IsGradient() )
+ {
+ aLightColor = rStyleSettings.GetFaceColor();
+ aShadowColor = Color( COL_BLACK );
+ }
+ else
+ {
+ Color aBackColor = aBackground.GetColor();
+ if ( (aLightColor.GetColorError( aBackColor ) < 32) ||
+ (aShadowColor.GetColorError( aBackColor ) < 32) )
+ {
+ aLightColor = Color( COL_WHITE );
+ aShadowColor = Color( COL_BLACK );
+
+ if ( aLightColor.GetColorError( aBackColor ) < 32 )
+ aLightColor.DecreaseLuminance( 64 );
+ if ( aShadowColor.GetColorError( aBackColor ) < 32 )
+ aShadowColor.IncreaseLuminance( 64 );
+ }
+ }
+ }
+
+ if ( (nStyle & FRAME_HIGHLIGHT_STYLE) == FRAME_HIGHLIGHT_IN )
+ {
+ Color aTempColor = aLightColor;
+ aLightColor = aShadowColor;
+ aShadowColor = aTempColor;
+ }
+
+ DrawFrame( rRect, aLightColor, aShadowColor );
+}
+
+// =======================================================================
+
+static void ImplDrawDPILineRect( OutputDevice* pDev, Rectangle& rRect,
+ const Color* pColor )
+{
+ long nLineWidth = pDev->ImplGetDPIX()/300;
+ long nLineHeight = pDev->ImplGetDPIY()/300;
+ if ( !nLineWidth )
+ nLineWidth = 1;
+ if ( !nLineHeight )
+ nLineHeight = 1;
+
+ if ( pColor )
+ {
+ if ( (nLineWidth == 1) && (nLineHeight == 1) )
+ {
+ pDev->SetLineColor( *pColor );
+ pDev->SetFillColor();
+ pDev->DrawRect( rRect );
+ }
+ else
+ {
+ long nWidth = rRect.GetWidth();
+ long nHeight = rRect.GetHeight();
+ pDev->SetLineColor();
+ pDev->SetFillColor( *pColor );
+ pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nWidth, nLineHeight ) ) );
+ pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nLineWidth, nHeight ) ) );
+ pDev->DrawRect( Rectangle( Point( rRect.Left(), rRect.Bottom()-nLineHeight ),
+ Size( nWidth, nLineHeight ) ) );
+ pDev->DrawRect( Rectangle( Point( rRect.Right()-nLineWidth, rRect.Top() ),
+ Size( nLineWidth, nHeight ) ) );
+ }
+ }
+
+ rRect.Left() += nLineWidth;
+ rRect.Top() += nLineHeight;
+ rRect.Right() -= nLineWidth;
+ rRect.Bottom() -= nLineHeight;
+}
+
+// =======================================================================
+
+static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
+ const StyleSettings& rStyleSettings, USHORT nStyle )
+{
+ if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
+ (pDev->GetOutDevType() == OUTDEV_PRINTER) )
+ nStyle |= FRAME_DRAW_MONO;
+
+ if ( nStyle & FRAME_DRAW_NODRAW )
+ {
+ if ( nStyle & FRAME_DRAW_MONO )
+ ImplDrawDPILineRect( pDev, rRect, NULL );
+ else
+ {
+ USHORT nFrameStyle = nStyle & FRAME_DRAW_STYLE;
+
+ if ( nFrameStyle == FRAME_DRAW_GROUP )
+ {
+ rRect.Left() += 2;
+ rRect.Top() += 2;
+ rRect.Right() -= 2;
+ rRect.Bottom() -= 2;
+ }
+ else if ( (nFrameStyle == FRAME_DRAW_IN) ||
+ (nFrameStyle == FRAME_DRAW_OUT) )
+ {
+ rRect.Left()++;
+ rRect.Top()++;
+ rRect.Right()--;
+ rRect.Bottom()--;
+ }
+ else // FRAME_DRAW_DOUBLEIN || FRAME_DRAW_DOUBLEOUT
+ {
+ rRect.Left() += 2;
+ rRect.Top() += 2;
+ rRect.Right() -= 2;
+ rRect.Bottom() -= 2;
+ }
+ }
+ }
+ else
+ {
+ if ( nStyle & FRAME_DRAW_MONO )
+ {
+ Color aColor( COL_BLACK );
+ ImplDrawDPILineRect( pDev, rRect, &aColor );
+ }
+ else
+ {
+ USHORT nFrameStyle = nStyle & FRAME_DRAW_STYLE;
+ if ( nFrameStyle == FRAME_DRAW_GROUP )
+ {
+ pDev->SetFillColor();
+ pDev->SetLineColor( rStyleSettings.GetLightColor() );
+ rRect.Top()++;
+ rRect.Left()++;
+ pDev->DrawRect( rRect );
+ rRect.Top()--;
+ rRect.Left()--;
+ pDev->SetLineColor( rStyleSettings.GetShadowColor() );
+ rRect.Right()--;
+ rRect.Bottom()--;
+ pDev->DrawRect( rRect );
+ rRect.Right()++;
+ rRect.Bottom()++;
+ }
+ else
+ {
+ pDev->SetLineColor();
+
+ if ( (nFrameStyle == FRAME_DRAW_IN) ||
+ (nFrameStyle == FRAME_DRAW_OUT) )
+ {
+ if ( nFrameStyle == FRAME_DRAW_IN )
+ {
+ pDev->ImplDraw2ColorFrame( rRect,
+ rStyleSettings.GetShadowColor(),
+ rStyleSettings.GetLightColor() );
+ }
+ else
+ {
+ pDev->ImplDraw2ColorFrame( rRect,
+ rStyleSettings.GetLightColor(),
+ rStyleSettings.GetShadowColor() );
+ }
+
+ rRect.Left()++;
+ rRect.Top()++;
+ rRect.Right()--;
+ rRect.Bottom()--;
+ }
+ else // FRAME_DRAW_DOUBLEIN || FRAME_DRAW_DOUBLEOUT
+ {
+ if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
+ {
+ pDev->ImplDraw2ColorFrame( rRect,
+ rStyleSettings.GetShadowColor(),
+ rStyleSettings.GetLightColor() );
+ }
+ else
+ {
+ pDev->ImplDraw2ColorFrame( rRect,
+ rStyleSettings.GetLightBorderColor(),
+ rStyleSettings.GetDarkShadowColor() );
+ }
+
+ rRect.Left()++;
+ rRect.Top()++;
+ rRect.Right()--;
+ rRect.Bottom()--;
+
+ if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
+ {
+ pDev->ImplDraw2ColorFrame( rRect,
+ rStyleSettings.GetDarkShadowColor(),
+ rStyleSettings.GetLightBorderColor() );
+ }
+ else
+ {
+ pDev->ImplDraw2ColorFrame( rRect,
+ rStyleSettings.GetLightColor(),
+ rStyleSettings.GetShadowColor() );
+ }
+
+ rRect.Left()++;
+ rRect.Top()++;
+ rRect.Right()--;
+ rRect.Bottom()--;
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle DecorationView::DrawFrame( const Rectangle& rRect, USHORT nStyle )
+{
+ Rectangle aRect = rRect;
+ BOOL bOldMap = mpOutDev->IsMapModeEnabled();
+ if ( bOldMap )
+ {
+ aRect = mpOutDev->LogicToPixel( aRect );
+ mpOutDev->EnableMapMode( FALSE );
+ }
+
+ if ( !rRect.IsEmpty() )
+ {
+ if ( nStyle & FRAME_DRAW_NODRAW )
+ ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
+ else
+ {
+ Color maOldLineColor = mpOutDev->GetLineColor();
+ Color maOldFillColor = mpOutDev->GetFillColor();
+ ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
+ mpOutDev->SetLineColor( maOldLineColor );
+ mpOutDev->SetFillColor( maOldFillColor );
+ }
+ }
+
+ if ( bOldMap )
+ {
+ mpOutDev->EnableMapMode( bOldMap );
+ aRect = mpOutDev->PixelToLogic( aRect );
+ }
+
+ return aRect;
+}
+
+// =======================================================================
+
+static void ImplDrawButton( OutputDevice* pDev, Rectangle& rRect,
+ const StyleSettings& rStyleSettings, USHORT nStyle )
+{
+ Rectangle aFillRect = rRect;
+
+ if ( nStyle & BUTTON_DRAW_MONO )
+ {
+ if ( !(nStyle & BUTTON_DRAW_NODRAW) )
+ {
+ Color aBlackColor( COL_BLACK );
+
+ if ( nStyle & BUTTON_DRAW_DEFAULT )
+ ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
+
+ ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
+
+ Size aBrdSize( 1, 1 );
+ if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
+ {
+ MapMode aResMapMode( MAP_100TH_MM );
+ aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode );
+ if ( !aBrdSize.Width() )
+ aBrdSize.Width() = 1;
+ if ( !aBrdSize.Height() )
+ aBrdSize.Height() = 1;
+ }
+ pDev->SetLineColor();
+ pDev->SetFillColor( aBlackColor );
+ Rectangle aRect1;
+ Rectangle aRect2;
+ aRect1.Left() = aFillRect.Left();
+ aRect1.Right() = aFillRect.Right(),
+ aRect2.Top() = aFillRect.Top();
+ aRect2.Bottom() = aFillRect.Bottom();
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ aRect1.Top() = aFillRect.Top();
+ aRect1.Bottom() = aBrdSize.Height()-1;
+ aRect2.Left() = aFillRect.Left();
+ aRect2.Right() = aFillRect.Left()+aBrdSize.Width()-1;
+ aFillRect.Left() += aBrdSize.Width();
+ aFillRect.Top() += aBrdSize.Height();
+ }
+ else
+ {
+ aRect1.Top() = aFillRect.Bottom()-aBrdSize.Height()+1;
+ aRect1.Bottom() = aFillRect.Bottom();
+ aRect2.Left() = aFillRect.Right()-aBrdSize.Width()+1;
+ aRect2.Right() = aFillRect.Right(),
+ aFillRect.Right() -= aBrdSize.Width();
+ aFillRect.Bottom() -= aBrdSize.Height();
+ }
+ pDev->DrawRect( aRect1 );
+ pDev->DrawRect( aRect2 );
+ }
+ }
+ else
+ {
+ if ( !(nStyle & BUTTON_DRAW_NODRAW) )
+ {
+ if ( nStyle & BUTTON_DRAW_DEFAULT )
+ {
+ Color aDefBtnColor = rStyleSettings.GetDarkShadowColor();
+ ImplDrawDPILineRect( pDev, aFillRect, &aDefBtnColor );
+ }
+ }
+
+ if ( !(nStyle & BUTTON_DRAW_NODRAW) )
+ {
+ pDev->SetLineColor();
+ if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
+ {
+ pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
+ pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
+ aFillRect.Left(), aFillRect.Bottom() ) );
+ aFillRect.Left()++;
+ }
+ if ( (nStyle & BUTTON_DRAW_NOTOPLIGHTBORDER) &&
+ !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED)) )
+ {
+ pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
+ pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
+ aFillRect.Right(), aFillRect.Top() ) );
+ aFillRect.Top()++;
+ }
+ if ( ((nStyle & BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) &&
+ !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED | BUTTON_DRAW_HIGHLIGHT)) )
+ {
+ pDev->SetFillColor( rStyleSettings.GetDarkShadowColor() );
+ pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Bottom(),
+ aFillRect.Right(), aFillRect.Bottom() ) );
+ aFillRect.Bottom()--;
+ }
+
+ Color aColor1;
+ Color aColor2;
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ aColor1 = rStyleSettings.GetDarkShadowColor();
+ aColor2 = rStyleSettings.GetLightColor();
+ }
+ else
+ {
+ if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
+ aColor1 = rStyleSettings.GetLightBorderColor();
+ else
+ aColor1 = rStyleSettings.GetLightColor();
+ if ( (nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT )
+ aColor2 = rStyleSettings.GetShadowColor();
+ else
+ aColor2 = rStyleSettings.GetDarkShadowColor();
+ }
+ pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+ aFillRect.Left()++;
+ aFillRect.Top()++;
+ aFillRect.Right()--;
+ aFillRect.Bottom()--;
+
+ if ( !((nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT) )
+ {
+ if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
+ {
+ aColor1 = rStyleSettings.GetShadowColor();
+ aColor2 = rStyleSettings.GetLightBorderColor();
+ }
+ else
+ {
+ if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
+ aColor1 = rStyleSettings.GetLightColor();
+ else
+ aColor1 = rStyleSettings.GetLightBorderColor();
+ aColor2 = rStyleSettings.GetShadowColor();
+ }
+ pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
+ aFillRect.Left()++;
+ aFillRect.Top()++;
+ aFillRect.Right()--;
+ aFillRect.Bottom()--;
+ }
+ }
+ }
+
+ if ( !(nStyle & (BUTTON_DRAW_NOFILL | BUTTON_DRAW_NODRAW)) )
+ {
+ pDev->SetLineColor();
+ if ( nStyle & BUTTON_DRAW_MONO )
+ {
+ // Hack: Auf Druckern wollen wir im MonoChrom-Modus trotzdem
+ // erstmal graue Buttons haben
+ if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
+ pDev->SetFillColor( Color( COL_LIGHTGRAY ) );
+ else
+ pDev->SetFillColor( Color( COL_WHITE ) );
+ }
+ else
+ {
+ if ( nStyle & (BUTTON_DRAW_CHECKED | BUTTON_DRAW_DONTKNOW) )
+ pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
+ else
+ pDev->SetFillColor( rStyleSettings.GetFaceColor() );
+ }
+ pDev->DrawRect( aFillRect );
+ }
+
+ // Ein Border freilassen, der jedoch bei Default-Darstellung
+ // mitbenutzt wird
+ rRect.Left()++;
+ rRect.Top()++;
+ rRect.Right()--;
+ rRect.Bottom()--;
+
+ if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
+ {
+ rRect.Left()++;
+ rRect.Top()++;
+ }
+ else if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
+ rRect.Left()++;
+
+ if ( nStyle & BUTTON_DRAW_PRESSED )
+ {
+ if ( (rRect.GetHeight() > 10) && (rRect.GetWidth() > 10) )
+ {
+ rRect.Left() += 4;
+ rRect.Top() += 4;
+ rRect.Right() -= 1;
+ rRect.Bottom() -= 1;
+ }
+ else
+ {
+ rRect.Left() += 3;
+ rRect.Top() += 3;
+ rRect.Right() -= 2;
+ rRect.Bottom() -= 2;
+ }
+ }
+ else if ( nStyle & BUTTON_DRAW_CHECKED )
+ {
+ rRect.Left() += 3;
+ rRect.Top() += 3;
+ rRect.Right() -= 2;
+ rRect.Bottom() -= 2;
+ }
+ else
+ {
+ rRect.Left() += 2;
+ rRect.Top() += 2;
+ rRect.Right() -= 3;
+ rRect.Bottom() -= 3;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle DecorationView::DrawButton( const Rectangle& rRect, USHORT nStyle )
+{
+ Rectangle aRect = rRect;
+ BOOL bOldMap = mpOutDev->IsMapModeEnabled();
+ if ( bOldMap )
+ {
+ aRect = mpOutDev->LogicToPixel( aRect );
+ mpOutDev->EnableMapMode( FALSE );
+ }
+
+ if ( !rRect.IsEmpty() )
+ {
+ const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
+
+ if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
+ (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) )
+ nStyle |= BUTTON_DRAW_MONO;
+
+ if ( nStyle & BUTTON_DRAW_NODRAW )
+ ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
+ else
+ {
+ Color maOldLineColor = mpOutDev->GetLineColor();
+ Color maOldFillColor = mpOutDev->GetFillColor();
+ ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
+ mpOutDev->SetLineColor( maOldLineColor );
+ mpOutDev->SetFillColor( maOldFillColor );
+ }
+ }
+
+ if ( bOldMap )
+ {
+ mpOutDev->EnableMapMode( bOldMap );
+ aRect = mpOutDev->PixelToLogic( aRect );
+ }
+
+ return aRect;
+}
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
new file mode 100644
index 000000000000..9a76a9a38923
--- /dev/null
+++ b/vcl/source/window/dialog.cxx
@@ -0,0 +1,847 @@
+/*************************************************************************
+ *
+ * $RCSfile: dialog.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_DIALOG_CXX
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+#ifndef _SV_MNEMONIC_HXX
+#include <mnemonic.hxx>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+#ifndef _SV_DIALOG_HXX
+#include <dialog.hxx>
+#endif
+
+#ifdef DBG_UTIL
+#ifndef _SV_MSGBOX_HXX
+#include <msgbox.hxx>
+#endif
+#endif
+
+#include <unowrap.hxx>
+
+#pragma hdrstop
+
+// =======================================================================
+
+#ifdef DBG_UTIL
+
+static ByteString ImplGetDialogText( Dialog* pDialog )
+{
+ ByteString aErrorStr( pDialog->GetText(), RTL_TEXTENCODING_UTF8 );
+ if ( (pDialog->GetType() == WINDOW_MESSBOX) ||
+ (pDialog->GetType() == WINDOW_INFOBOX) ||
+ (pDialog->GetType() == WINDOW_WARNINGBOX) ||
+ (pDialog->GetType() == WINDOW_ERRORBOX) ||
+ (pDialog->GetType() == WINDOW_QUERYBOX) )
+ {
+ aErrorStr += ", ";
+ aErrorStr += ByteString( ((MessBox*)pDialog)->GetMessText(), RTL_TEXTENCODING_UTF8 );
+ }
+ return aErrorStr;
+}
+
+#endif
+
+// =======================================================================
+
+static BOOL ImplIsMnemonicCtrl( Window* pWindow )
+{
+ if ( (pWindow->GetType() == WINDOW_RADIOBUTTON) ||
+ (pWindow->GetType() == WINDOW_CHECKBOX) ||
+ (pWindow->GetType() == WINDOW_TRISTATEBOX) ||
+ (pWindow->GetType() == WINDOW_PUSHBUTTON) )
+ return TRUE;
+
+ if ( pWindow->GetType() == WINDOW_FIXEDTEXT )
+ {
+ if ( pWindow->GetStyle() & (WB_INFO | WB_NOLABEL) )
+ return FALSE;
+ Window* pNextWindow = pWindow->GetWindow( WINDOW_NEXT );
+ if ( !pNextWindow )
+ return FALSE;
+ pNextWindow = pNextWindow->GetWindow( WINDOW_CLIENT );
+ if ( !(pNextWindow->GetStyle() & WB_TABSTOP) ||
+ (pNextWindow->GetType() == WINDOW_FIXEDTEXT) ||
+ (pNextWindow->GetType() == WINDOW_GROUPBOX) ||
+ (pNextWindow->GetType() == WINDOW_RADIOBUTTON) ||
+ (pNextWindow->GetType() == WINDOW_CHECKBOX) ||
+ (pNextWindow->GetType() == WINDOW_TRISTATEBOX) ||
+ (pNextWindow->GetType() == WINDOW_PUSHBUTTON) )
+ return FALSE;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplWindowAutoMnemonic( Window* pWindow )
+{
+ ImplMnemonicGenerator aMnemonicGenerator;
+ Window* pGetChild;
+ Window* pChild;
+
+ // Die schon vergebenen Mnemonics registieren
+ pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pGetChild )
+ {
+ pChild = pGetChild->ImplGetWindow();
+ aMnemonicGenerator.RegisterMnemonic( pChild->GetText() );
+ pGetChild = pGetChild->GetWindow( WINDOW_NEXT );
+ }
+
+ // Bei TabPages auch noch die Controls vom Dialog beruecksichtigen
+ if ( pWindow->GetType() == WINDOW_TABPAGE )
+ {
+ Window* pParent = pWindow->GetParent();
+ if ( pParent->GetType() == WINDOW_TABCONTROL )
+ pParent = pParent->GetParent();
+
+ if ( (pParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL )
+ {
+ pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pGetChild )
+ {
+ pChild = pGetChild->ImplGetWindow();
+ aMnemonicGenerator.RegisterMnemonic( pChild->GetText() );
+ pGetChild = pGetChild->GetWindow( WINDOW_NEXT );
+ }
+ }
+ }
+
+ // Die Mnemonics an die Controls vergeben, die noch keinen haben
+ pGetChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pGetChild )
+ {
+ pChild = pGetChild->ImplGetWindow();
+ if ( ImplIsMnemonicCtrl( pChild ) )
+ {
+ XubString aText = pChild->GetText();
+ if ( aMnemonicGenerator.CreateMnemonic( aText ) )
+ pChild->SetText( aText );
+ }
+
+ pGetChild = pGetChild->GetWindow( WINDOW_NEXT );
+ }
+}
+
+// =======================================================================
+
+static PushButton* ImplGetDefaultButton( Dialog* pDialog )
+{
+ Window* pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ if ( pChild->ImplIsPushButton() )
+ {
+ PushButton* pPushButton = (PushButton*)pChild;
+ if ( pPushButton->ImplIsDefButton() )
+ return pPushButton;
+ }
+
+ pChild = pChild->GetWindow( WINDOW_NEXT );
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static PushButton* ImplGetOKButton( Dialog* pDialog )
+{
+ Window* pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ if ( pChild->GetType() == WINDOW_OKBUTTON )
+ return (PushButton*)pChild;
+
+ pChild = pChild->GetWindow( WINDOW_NEXT );
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static PushButton* ImplGetCancelButton( Dialog* pDialog )
+{
+ Window* pChild = pDialog->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ if ( pChild->GetType() == WINDOW_CANCELBUTTON )
+ return (PushButton*)pChild;
+
+ pChild = pChild->GetWindow( WINDOW_NEXT );
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplMouseAutoPos( Dialog* pDialog )
+{
+ ULONG nMouseOptions = pDialog->GetSettings().GetMouseSettings().GetOptions();
+ if ( nMouseOptions & MOUSE_OPTION_AUTOCENTERPOS )
+ {
+ Size aSize = pDialog->GetOutputSizePixel();
+ pDialog->SetPointerPosPixel( Point( aSize.Width()/2, aSize.Height()/2 ) );
+ }
+ else if ( nMouseOptions & MOUSE_OPTION_AUTODEFBTNPOS )
+ {
+ Window* pWindow = ImplGetDefaultButton( pDialog );
+ if ( !pWindow )
+ pWindow = ImplGetOKButton( pDialog );
+ if ( !pWindow )
+ pWindow = ImplGetCancelButton( pDialog );
+ if ( !pWindow )
+ pWindow = pDialog;
+ Size aSize = pWindow->GetOutputSizePixel();
+ pWindow->SetPointerPosPixel( Point( aSize.Width()/2, aSize.Height()/2 ) );
+ }
+}
+
+// =======================================================================
+
+void Dialog::ImplInitData()
+{
+ mbDialog = TRUE;
+
+ mpDialogParent = NULL;
+ mpResult = NULL;
+ mpPrevExecuteDlg = NULL;
+ mbInExecute = FALSE;
+ mbOldSaveBack = FALSE;
+ mbInClose = FALSE;
+ mbModalMode = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::ImplInit( Window* pParent, WinBits nStyle )
+{
+ USHORT nSysWinMode = Application::GetSystemWindowMode();
+
+ if ( !(nStyle & WB_NODIALOGCONTROL) )
+ nStyle |= WB_DIALOGCONTROL;
+ nStyle |= WB_ROLLABLE;
+
+ if ( !pParent )
+ {
+ pParent = Application::GetDefDialogParent();
+ if ( !pParent && !(nStyle & WB_SYSTEMWINDOW) )
+ pParent = Application::GetAppWindow();
+
+ // If Parent is disabled, then we search for a modal dialog
+ // in this frame
+ if ( pParent && !pParent->IsInputEnabled() )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
+ while ( pExeDlg )
+ {
+ // Nur wenn er sichtbar und enabled ist
+ if ( pParent->ImplGetFirstOverlapWindow()->IsWindowOrChild( pExeDlg, TRUE ) &&
+ pExeDlg->IsReallyVisible() &&
+ pExeDlg->IsEnabled() && pExeDlg->IsInputEnabled() )
+ {
+ pParent = pExeDlg;
+ break;
+ }
+
+ pExeDlg = pExeDlg->mpPrevExecuteDlg;
+ }
+ }
+ }
+
+ if ( pParent && !(nSysWinMode & SYSTEMWINDOW_MODE_NOAUTOMODE) )
+ {
+ if ( !pParent->mpFrameWindow->IsVisible() )
+ pParent = NULL;
+ else
+ {
+ if ( pParent->mpFrameWindow->IsDialog() )
+ {
+ Size aOutSize = pParent->mpFrameWindow->GetOutputSizePixel();
+ if ( (aOutSize.Width() < 210) ||(aOutSize.Height() < 160) )
+ nStyle |= WB_SYSTEMWINDOW;
+ }
+ }
+ }
+
+ if ( !pParent || (nStyle & WB_SYSTEMWINDOW) ||
+ (pParent->mpFrameData->mbNeedSysWindow && !(nSysWinMode & SYSTEMWINDOW_MODE_NOAUTOMODE)) ||
+ (nSysWinMode & SYSTEMWINDOW_MODE_DIALOG) )
+ {
+ // Fenster mit einem schmallen Border anlegen?
+ if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )
+ {
+ ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_FRAME );
+ SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
+ pBorderWin->mpClientWindow = this;
+ pBorderWin->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ mpBorderWindow = pBorderWin;
+ mpRealParent = pParent;
+ }
+ else
+ {
+ mbFrame = TRUE;
+ mbOverlapWin = TRUE;
+ SystemWindow::ImplInit( pParent, nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE), NULL );
+ // Jetzt alle StyleBits setzen
+ mnStyle = nStyle;
+ }
+ }
+ else
+ {
+ ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER );
+ SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
+ pBorderWin->mpClientWindow = this;
+ pBorderWin->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ mpBorderWindow = pBorderWin;
+ mpRealParent = pParent;
+ }
+
+ SetActivateMode( ACTIVATE_MODE_GRABFOCUS );
+
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::ImplInitSettings()
+{
+ // Wir haben graue Dialoge
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( GetSettings().GetStyleSettings().GetDialogColor() );
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::ImplCenterDialog()
+{
+ Rectangle aDeskRect = ImplGetFrameWindow()->GetDesktopRectPixel();
+ Point aDeskPos = aDeskRect.TopLeft();
+ Size aDeskSize = aDeskRect.GetSize();
+ Size aWinSize = GetSizePixel();
+ Point aWinPos( ((aDeskSize.Width() - aWinSize.Width()) / 2) + aDeskPos.X(),
+ ((aDeskSize.Height() - aWinSize.Height()) / 2) + aDeskPos.Y() );
+
+ // Pruefen, ob Dialogbox ausserhalb des Desks liegt
+ if ( (aWinPos.X() + aWinSize.Width()) > (aDeskPos.X()+aDeskSize.Width()) )
+ aWinPos.X() = aDeskPos.X()+aDeskSize.Width() - aWinSize.Width();
+ if ( (aWinPos.Y()+aWinSize.Height()) > (aDeskPos.Y()+aDeskSize.Height()) )
+ aWinPos.Y() = aDeskPos.Y()+aDeskSize.Height() - aWinSize.Height();
+ // Linke Ecke bevorzugen, da Titelbar oben ist
+ if ( aWinPos.X() < aDeskPos.X() )
+ aWinPos.X() = aDeskPos.X();
+ if ( aWinPos.Y() < aDeskPos.Y() )
+ aWinPos.Y() = aDeskPos.Y();
+
+ SetPosPixel( aWinPos );
+}
+
+// -----------------------------------------------------------------------
+
+Dialog::Dialog( WindowType nType ) :
+ SystemWindow( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+Dialog::Dialog( Window* pParent, WinBits nStyle ) :
+ SystemWindow( WINDOW_DIALOG )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+Dialog::Dialog( Window* pParent, const ResId& rResId ) :
+ SystemWindow( WINDOW_DIALOG )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_DIALOG );
+ ImplInit( pParent, ImplInitRes( rResId ) );
+ ImplLoadRes( rResId );
+}
+
+// -----------------------------------------------------------------------
+
+long Dialog::Notify( NotifyEvent& rNEvt )
+{
+ // Zuerst Basisklasse rufen wegen TabSteuerung
+ long nRet = SystemWindow::Notify( rNEvt );
+ if ( !nRet )
+ {
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( (nKeyCode == KEY_ESCAPE) &&
+ ((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) )
+ {
+ Close();
+ return TRUE;
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::StateChanged( StateChangedType nType )
+{
+ SystemWindow::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ if ( Application::IsAutoMnemonicEnabled() )
+ ImplWindowAutoMnemonic( this );
+
+ if ( IsDefaultPos() && !mbFrame )
+ ImplCenterDialog();
+ if ( !HasChildPathFocus() || HasFocus() )
+ GrabFocusToFirstControl();
+ if ( !(GetStyle() & WB_CLOSEABLE) )
+ {
+ if ( ImplGetCancelButton( this ) || ImplGetOKButton( this ) )
+ {
+ if ( ImplGetBorderWindow() )
+ ((ImplBorderWindow*)ImplGetBorderWindow())->SetCloser();
+ else
+ {
+ // ... missing implementation, if we are a frame window,
+ // because it is currently impossible to implement.
+ SetStyle( GetStyle() | WB_CLOSEABLE );
+ }
+ }
+ }
+
+ ImplMouseAutoPos( this );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SystemWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Dialog::Close()
+{
+ if ( mxWindowPeer.is() )
+ {
+ Application::GetUnoWrapper()->WindowEvent_Close( this );
+ if ( IsCreatedWithToolkit() )
+ return FALSE;
+ }
+
+ mbInClose = TRUE;
+
+ if ( !(GetStyle() & WB_CLOSEABLE) )
+ {
+ ImplDelData aDelData;
+ ImplAddDel( &aDelData );
+ PushButton* pButton = ImplGetCancelButton( this );
+ if ( pButton )
+ pButton->Click();
+ else
+ {
+ pButton = ImplGetOKButton( this );
+ if ( pButton )
+ pButton->Click();
+ }
+ if ( aDelData.IsDelete() )
+ return TRUE;
+ ImplRemoveDel( &aDelData );
+ }
+
+ if ( IsInExecute() )
+ {
+ EndDialog( FALSE );
+ mbInClose = FALSE;
+ return TRUE;
+ }
+ else
+ {
+ mbInClose = FALSE;
+ return SystemWindow::Close();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+short Dialog::Execute()
+{
+ if ( mbInExecute )
+ {
+#ifdef DBG_UTIL
+ ByteString aErrorStr( "Dialog::Execute() is called in Dialoh::Execute(): " );
+ aErrorStr += ImplGetDialogText( this );
+ DBG_ERROR( aErrorStr.GetBuffer() );
+#endif
+ return 0;
+ }
+
+ if ( Application::IsDialogCancelEnabled() )
+ {
+#ifdef DBG_UTIL
+ ByteString aErrorStr( "Dialog::Execute() is called in a none UI application: " );
+ aErrorStr += ImplGetDialogText( this );
+ DBG_ERROR( aErrorStr.GetBuffer() );
+#endif
+ return 0;
+ }
+
+#ifdef DBG_UTIL
+ Window* pParent = GetParent();
+ if ( pParent )
+ {
+ pParent = pParent->ImplGetFirstOverlapWindow();
+ DBG_ASSERT( pParent->IsReallyVisible(),
+ "Dialog::Execute() - Parent not visible" );
+ }
+#endif
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Dialoge, die sich in Execute befinden, miteinander verketten
+ mpPrevExecuteDlg = pSVData->maWinData.mpLastExecuteDlg;
+ pSVData->maWinData.mpLastExecuteDlg = this;
+
+ // Capture beenden, damit der Dialog bedient werden kann
+ if ( pSVData->maWinData.mpTrackWin )
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ if ( pSVData->maWinData.mpCaptureWin )
+ pSVData->maWinData.mpCaptureWin->ReleaseMouse();
+ EnableInput( TRUE, TRUE );
+
+ if ( GetParent() )
+ {
+ NotifyEvent aNEvt( EVENT_EXECUTEDIALOG, this );
+ GetParent()->Notify( aNEvt );
+ }
+ long nRet;
+ mpResult = &nRet;
+ mbInExecute = TRUE;
+ SetModalInputMode( TRUE );
+ mbOldSaveBack = IsSaveBackgroundEnabled();
+ EnableSaveBackground();
+ Show();
+
+ if ( Application::GetAccessHdlCount() )
+ {
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_MODALDIALOG_START, this ) );
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_DLGCONTROLS, this ) );
+ }
+
+ // Solange Yielden, bis EndDialog aufgerufen wird, oder der Dialog
+ // zerstoert wird (sollte nicht sein und ist nur vorsichtsmassnahme)
+ ImplDelData aDelData;
+ ImplAddDel( &aDelData );
+ pSVData->maAppData.mnModalMode++;
+ while ( !aDelData.IsDelete() && mbInExecute )
+ Application::Yield();
+ pSVData->maAppData.mnModalMode--;
+ if ( !aDelData.IsDelete() )
+ ImplRemoveDel( &aDelData );
+#ifdef DBG_UTIL
+ else
+ {
+ DBG_ERROR( "Dialog::Execute() - Dialog destroyed in Execute()" );
+ }
+#endif
+
+ return (short)nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::EndDialog( long nResult )
+{
+ if ( mbInExecute )
+ {
+ SetModalInputMode( FALSE );
+
+ // Dialog aus der Kette der Dialoge die in Execute stehen entfernen
+ ImplSVData* pSVData = ImplGetSVData();
+ Dialog* pPrevDlg = NULL;
+ Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
+ while ( pExeDlg )
+ {
+ if ( pExeDlg == this )
+ {
+ if ( pPrevDlg )
+ pPrevDlg->mpPrevExecuteDlg = mpPrevExecuteDlg;
+ else
+ pSVData->maWinData.mpLastExecuteDlg = mpPrevExecuteDlg;
+ break;
+ }
+ pExeDlg = pExeDlg->mpPrevExecuteDlg;
+ }
+ mpPrevExecuteDlg = NULL;
+
+ Hide();
+ EnableSaveBackground( mbOldSaveBack );
+ if ( GetParent() )
+ {
+ NotifyEvent aNEvt( EVENT_ENDEXECUTEDIALOG, this );
+ GetParent()->Notify( aNEvt );
+ }
+ if ( Application::GetAccessHdlCount() )
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_MODALDIALOG_END, this ) );
+ if ( mpResult )
+ *mpResult = nResult;
+ mpResult = NULL;
+ mbInExecute = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::SetModalInputMode( BOOL bModal )
+{
+ if ( bModal == mbModalMode )
+ return;
+
+ ImplSVData* pSVData = ImplGetSVData();
+ mbModalMode = bModal;
+ if ( bModal )
+ {
+ pSVData->maAppData.mnModalDialog++;
+
+ // Diable the prev Modal Dialog, because our dialog must close at first,
+ // before the other dialog can be closed (because the other dialog
+ // is on stack since our dialog returns)
+ if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, TRUE ) )
+ mpPrevExecuteDlg->EnableInput( FALSE, TRUE, TRUE, this );
+
+ // determine next overlap dialog parent
+ Window* pParent = GetParent();
+ if ( pParent )
+ {
+ mpDialogParent = pParent->ImplGetFirstOverlapWindow();
+ if ( mpDialogParent )
+ mpDialogParent->EnableInput( FALSE, TRUE, TRUE, this );
+ }
+ }
+ else
+ {
+ pSVData->maAppData.mnModalDialog--;
+
+ if ( mpDialogParent )
+ mpDialogParent->EnableInput( TRUE, TRUE, TRUE, this );
+
+ // Enable the prev Modal Dialog
+ if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, TRUE ) )
+ mpPrevExecuteDlg->EnableInput( TRUE, TRUE, TRUE, this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::SetModalInputMode( BOOL bModal, BOOL bSubModalDialogs )
+{
+ if ( bSubModalDialogs )
+ {
+ Window* pOverlap = ImplGetFirstOverlapWindow();
+ pOverlap = pOverlap->mpFirstOverlap;
+ while ( pOverlap )
+ {
+ if ( pOverlap->IsDialog() )
+ ((Dialog*)pOverlap)->SetModalInputMode( bModal, TRUE );
+ pOverlap = pOverlap->mpNext;
+ }
+ }
+
+ SetModalInputMode( bModal );
+}
+
+// -----------------------------------------------------------------------
+
+void Dialog::GrabFocusToFirstControl()
+{
+ Window* pFocusControl;
+
+ // Wenn Dialog den Focus hat, versuchen wr trotzdem
+ // ein Focus-Control zu finden
+ if ( HasFocus() )
+ pFocusControl = NULL;
+ else
+ {
+ // Wenn schon ein Child-Fenster mal den Focus hatte,
+ // dann dieses bevorzugen
+ pFocusControl = ImplGetFirstOverlapWindow()->mpLastFocusWindow;
+ // Control aus der Dialog-Steuerung suchen
+ if ( pFocusControl )
+ pFocusControl = ImplFindDlgCtrlWindow( pFocusControl );
+ }
+ // Kein Control hatte vorher den Focus, oder das Control
+ // befindet sich nicht in der Tab-Steuerung, dann das erste
+ // Control in der TabSteuerung den Focus geben
+ if ( !pFocusControl ||
+ !(pFocusControl->GetStyle() & WB_TABSTOP) ||
+ !pFocusControl->IsVisible() ||
+ !pFocusControl->IsEnabled() || !pFocusControl->IsInputEnabled() )
+ {
+ USHORT n = 0;
+ pFocusControl = ImplGetDlgWindow( n, DLGWINDOW_FIRST );
+ }
+ if ( pFocusControl )
+ pFocusControl->ImplControlFocus( GETFOCUS_INIT );
+}
+
+// =======================================================================
+
+ModelessDialog::ModelessDialog( Window* pParent, WinBits nStyle ) :
+ Dialog( WINDOW_MODELESSDIALOG )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ModelessDialog::ModelessDialog( Window* pParent, const ResId& rResId ) :
+ Dialog( WINDOW_MODELESSDIALOG )
+{
+ rResId.SetRT( RSC_MODELESSDIALOG );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// =======================================================================
+
+ModalDialog::ModalDialog( Window* pParent, WinBits nStyle ) :
+ Dialog( WINDOW_MODALDIALOG )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ModalDialog::ModalDialog( Window* pParent, const ResId& rResId ) :
+ Dialog( WINDOW_MODALDIALOG )
+{
+ rResId.SetRT( RSC_MODALDIALOG );
+ ImplInit( pParent, ImplInitRes( rResId ) );
+ ImplLoadRes( rResId );
+}
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
new file mode 100644
index 000000000000..a8c45e6d7f3b
--- /dev/null
+++ b/vcl/source/window/dlgctrl.cxx
@@ -0,0 +1,968 @@
+/*************************************************************************
+ *
+ * $RCSfile: dlgctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_DLGCTRL_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_TABPAGE_HXX
+#include <tabpage.hxx>
+#endif
+#ifndef _SV_TABCTRL_HXX
+#include <tabctrl.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+
+#include <unohelp.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XCHARACTERCLASSIFICATION_HPP_
+#include <com/sun/star/lang/XCharacterClassification.hpp>
+#endif
+
+using namespace ::com::sun::star;
+
+
+#pragma hdrstop
+
+// =======================================================================
+
+static Window* ImplGetSubChildWindow( Window* pParent, USHORT n, USHORT& nIndex )
+{
+ Window* pTabPage = NULL;
+ Window* pFoundWindow = NULL;
+ Window* pWindow = pParent->GetWindow( WINDOW_FIRSTCHILD );
+ Window* pNextWindow = pWindow;
+ while ( pWindow )
+ {
+ pWindow = pWindow->ImplGetWindow();
+
+ // Unsichtbare und disablte Fenster werden uebersprungen
+ if ( pTabPage || pWindow->IsVisible() )
+ {
+ // Wenn das letzte Control ein TabControl war, wird von
+ // diesem die TabPage genommen
+ if ( pTabPage )
+ {
+ pFoundWindow = ImplGetSubChildWindow( pTabPage, n, nIndex );
+ pTabPage = NULL;
+ }
+ else
+ {
+ pFoundWindow = pWindow;
+
+ // Bei einem TabControl sich die aktuelle TabPage merken,
+ // damit diese dann genommen wird
+ if ( pWindow->GetType() == WINDOW_TABCONTROL )
+ {
+ TabControl* pTabControl = ((TabControl*)pWindow);
+ // Feststellen, ob TabPage Child vom TabControl ist
+ // und auch noch existiert (deshalb durch Vergleich,
+ // indem alle ChildFenster getestet werden). Denn es
+ // kann sein, das TabPages schon in einem Dialog-Dtor
+ // zerstoert wurden, obwohl das TabControl noch
+ // existiert.
+ TabPage* pTempTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
+ if ( pTempTabPage )
+ {
+ Window* pTempWindow = pTabControl->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pTempWindow )
+ {
+ if ( pTempWindow->ImplGetWindow() == pTempTabPage )
+ {
+ pTabPage = pTempTabPage;
+ break;
+ }
+ pTempWindow = pTempWindow->GetWindow( WINDOW_NEXT );
+ }
+ }
+ }
+ else if ( pWindow->GetStyle() & WB_DIALOGCONTROL )
+ pFoundWindow = ImplGetSubChildWindow( pWindow, n, nIndex );
+ }
+
+ if ( n == nIndex )
+ return pFoundWindow;
+ nIndex++;
+ }
+
+ if ( pTabPage )
+ pWindow = pTabPage;
+ else
+ {
+ pWindow = pNextWindow->GetWindow( WINDOW_NEXT );
+ pNextWindow = pWindow;
+ }
+ }
+
+ nIndex--;
+ return pFoundWindow;
+}
+
+// -----------------------------------------------------------------------
+
+static Window* ImplGetChildWindow( Window* pParent, USHORT n, USHORT& nIndex, BOOL bTestEnable )
+{
+ nIndex = 0;
+ Window* pWindow = ImplGetSubChildWindow( pParent, n, nIndex );
+ if ( bTestEnable )
+ {
+ USHORT n2 = nIndex;
+ while ( pWindow && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) )
+ {
+ n2 = nIndex+1;
+ nIndex = 0;
+ pWindow = ImplGetSubChildWindow( pParent, n2, nIndex );
+ if ( nIndex < n2 )
+ break;
+ }
+
+ if ( (nIndex < n2) && n )
+ {
+ do
+ {
+ n--;
+ nIndex = 0;
+ pWindow = ImplGetSubChildWindow( pParent, n, nIndex );
+ }
+ while ( pWindow && n && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) );
+ }
+ }
+ return pWindow;
+}
+
+// -----------------------------------------------------------------------
+
+static Window* ImplGetNextWindow( Window* pParent, USHORT n, USHORT& nIndex, BOOL bTestEnable )
+{
+ Window* pWindow = ImplGetChildWindow( pParent, n+1, nIndex, bTestEnable );
+ if ( n == nIndex )
+ {
+ n = 0;
+ pWindow = ImplGetChildWindow( pParent, n, nIndex, bTestEnable );
+ }
+ return pWindow;
+}
+
+// -----------------------------------------------------------------------
+
+Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType,
+ USHORT nFormStart, USHORT nFormEnd,
+ USHORT* pIndex )
+{
+ DBG_ASSERT( (nIndex >= nFormStart) && (nIndex <= nFormEnd),
+ "Window::ImplGetDlgWindow() - nIndex not in Form" );
+
+ Window* pWindow = NULL;
+ USHORT i;
+ USHORT nTemp;
+ USHORT nStartIndex;
+
+ if ( nType == DLGWINDOW_PREV )
+ {
+ i = nIndex;
+ do
+ {
+ if ( i > nFormStart )
+ i--;
+ else
+ i = nFormEnd;
+ pWindow = ImplGetChildWindow( this, i, nTemp, TRUE );
+ if ( !pWindow )
+ break;
+ if ( (i == nTemp) && (pWindow->GetStyle() & WB_TABSTOP) )
+ break;
+ }
+ while ( i != nIndex );
+ }
+ else
+ {
+ i = nIndex;
+ pWindow = ImplGetChildWindow( this, i, i, (nType == DLGWINDOW_FIRST) );
+ if ( pWindow )
+ {
+ nStartIndex = i;
+
+ if ( nType == DLGWINDOW_NEXT )
+ {
+ if ( i < nFormEnd )
+ {
+ pWindow = ImplGetNextWindow( this, i, i, TRUE );
+ if ( (i > nFormEnd) || (i < nFormStart) )
+ pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE );
+ }
+ else
+ pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE );
+ }
+
+ if ( i <= nFormEnd )
+ {
+ // 2ten Index mitfuehren, falls alle Controls disablte
+ USHORT nStartIndex2 = i;
+
+ do
+ {
+ if ( pWindow->GetStyle() & WB_TABSTOP )
+ break;
+ if ( (i >= nFormEnd) || (i < nFormStart) )
+ pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE );
+ else
+ pWindow = ImplGetNextWindow( this, i, i, TRUE );
+ }
+ while ( (i != nStartIndex) && (i != nStartIndex2) );
+
+ if ( (i == nStartIndex2) &&
+ (!(pWindow->GetStyle() & WB_TABSTOP) || !pWindow->IsEnabled()) )
+ i = nStartIndex;
+ }
+ }
+
+ if ( nType == DLGWINDOW_FIRST )
+ {
+ if ( pWindow )
+ {
+ if ( pWindow->GetType() == WINDOW_TABCONTROL )
+ {
+ Window* pNextWindow = ImplGetDlgWindow( i, DLGWINDOW_NEXT );
+ if ( pNextWindow )
+ {
+ if ( pWindow->IsChild( pNextWindow ) )
+ pWindow = pNextWindow;
+ }
+ }
+
+ if ( !(pWindow->GetStyle() & WB_TABSTOP) )
+ pWindow = NULL;
+ }
+ }
+ }
+
+ if ( pIndex )
+ *pIndex = i;
+
+ return pWindow;
+}
+
+// -----------------------------------------------------------------------
+
+static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode cCharCode,
+ USHORT nFormStart, USHORT nFormEnd )
+{
+ DBG_ASSERT( (rIndex >= nFormStart) && (rIndex <= nFormEnd),
+ "Window::ImplFindAccelWindow() - rIndex not in Form" );
+
+ xub_Unicode cCompareChar;
+ USHORT nStart = rIndex;
+ USHORT i = rIndex;
+ int bSearch = TRUE;
+ Window* pWindow;
+
+ // MT: Where can we keep the CharClass?!
+ static uno::Reference< lang::XCharacterClassification > xCharClass;
+ if ( !xCharClass.is() )
+ xCharClass = vcl::unohelper::CreateCharacterClassification();
+
+ const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale();
+
+ cCharCode = xCharClass->toUpper( String(cCharCode), 0, 1, rLocale )[0];
+
+ if ( i < nFormEnd )
+ pWindow = ImplGetNextWindow( pParent, i, i, TRUE );
+ else
+ pWindow = ImplGetChildWindow( pParent, nFormStart, i, TRUE );
+ while ( bSearch )
+ {
+ const XubString aStr = pWindow->GetText();
+ USHORT nPos = aStr.Search( '~' );
+ while ( nPos != STRING_NOTFOUND )
+ {
+ cCompareChar = aStr.GetChar( nPos+1 );
+ cCompareChar = xCharClass->toUpper( String(cCompareChar), 0, 1, rLocale )[0];
+ if ( cCompareChar == cCharCode )
+ {
+ // Bei Static-Controls auf das naechste Controlm weiterschalten
+ if ( (pWindow->GetType() == WINDOW_FIXEDTEXT) ||
+ (pWindow->GetType() == WINDOW_FIXEDLINE) ||
+ (pWindow->GetType() == WINDOW_GROUPBOX) )
+ pWindow = pParent->ImplGetDlgWindow( i, DLGWINDOW_NEXT );
+ rIndex = i;
+ return pWindow;
+ }
+ nPos = aStr.Search( '~', nPos+1 );
+ }
+
+ if ( i == nStart )
+ break;
+
+ if ( i < nFormEnd )
+ pWindow = ImplGetNextWindow( pParent, i, i, TRUE );
+ else
+ pWindow = ImplGetChildWindow( pParent, nFormStart, i, TRUE );
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT& rIndex,
+ USHORT& rFormStart, USHORT& rFormEnd )
+{
+ Window* pSWindow;
+ Window* pSecondWindow = NULL;
+ Window* pTempWindow = NULL;
+ USHORT i;
+ USHORT nSecond_i;
+ USHORT nFormStart = 0;
+ USHORT nSecondFormStart;
+ USHORT nFormEnd;
+
+ // Focus-Fenster in der Child-Liste suchen
+ pSWindow = ImplGetChildWindow( pParent, 0, i, FALSE );
+ while ( pSWindow )
+ {
+ if ( pSWindow->ImplGetWindow()->IsDialogControlStart() )
+ nFormStart = i;
+
+ // SecondWindow wegen zusammengesetzten Controls wie
+ // ComboBoxen und Feldern
+ if ( pSWindow->ImplIsWindowOrChild( pWindow ) )
+ {
+ pSecondWindow = pSWindow;
+ nSecond_i = i;
+ nSecondFormStart = nFormStart;
+ if ( pSWindow == pWindow )
+ break;
+ }
+
+ pSWindow = ImplGetNextWindow( pParent, i, i, FALSE );
+ if ( !i )
+ pSWindow = NULL;
+ }
+
+ if ( !pSWindow )
+ {
+ // Fenster nicht gefunden, dann koennen wir auch keine
+ // Steuerung uebernehmen
+ if ( !pSecondWindow )
+ return NULL;
+ else
+ {
+ pSWindow = pSecondWindow;
+ i = nSecond_i;
+ nFormStart = nSecondFormStart;
+ }
+ }
+
+ // Start-Daten setzen
+ rIndex = i;
+ rFormStart = nFormStart;
+
+ // Formularende suchen
+ nFormEnd = nFormStart;
+ pTempWindow = pSWindow;
+ do
+ {
+ nFormEnd = i;
+ pTempWindow = ImplGetNextWindow( pParent, i, i, FALSE );
+ if ( !i || (pTempWindow && pTempWindow->ImplGetWindow()->IsDialogControlStart()) )
+ break;
+ }
+ while ( pTempWindow );
+ rFormEnd = nFormEnd;
+
+ return pSWindow;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplControlFocus( USHORT nFlags )
+{
+ if ( nFlags & GETFOCUS_MNEMONIC )
+ {
+ if ( GetType() == WINDOW_RADIOBUTTON )
+ {
+ if ( !((RadioButton*)this)->IsChecked() )
+ ((RadioButton*)this)->ImplCallClick( TRUE, nFlags );
+ else
+ ImplGrabFocus( nFlags );
+ }
+ else
+ {
+ ImplGrabFocus( nFlags );
+ if ( nFlags & GETFOCUS_UNIQUEMNEMONIC )
+ {
+ if ( GetType() == WINDOW_CHECKBOX )
+ ((CheckBox*)this)->ImplCheck();
+ else if ( mbPushButton )
+ {
+ ((PushButton*)this)->SetPressed( TRUE );
+ ((PushButton*)this)->SetPressed( FALSE );
+ ((PushButton*)this)->Click();
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( GetType() == WINDOW_RADIOBUTTON )
+ {
+ if ( !((RadioButton*)this)->IsChecked() )
+ ((RadioButton*)this)->ImplCallClick( TRUE, nFlags );
+ else
+ ImplGrabFocus( nFlags );
+ }
+ else
+ ImplGrabFocus( nFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
+{
+ KeyCode aKeyCode = rKEvt.GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+ Window* pSWindow;
+ Window* pTempWindow;
+ Window* pButtonWindow;
+ USHORT i;
+ USHORT iButton;
+ USHORT iButtonStart;
+ USHORT iTemp;
+ USHORT nIndex;
+ USHORT nFormStart;
+ USHORT nFormEnd;
+ USHORT nDlgCtrlFlags;
+
+ // Ohne Focus-Window koennen wir auch keine Steuerung uebernehmen
+ Window* pFocusWindow = Application::GetFocusWindow();
+ if ( !pFocusWindow || !ImplIsWindowOrChild( pFocusWindow ) )
+ return FALSE;
+
+ // Focus-Fenster in der Child-Liste suchen
+ pSWindow = ::ImplFindDlgCtrlWindow( this, pFocusWindow,
+ nIndex, nFormStart, nFormEnd );
+ if ( !pSWindow )
+ return FALSE;
+ i = nIndex;
+
+ nDlgCtrlFlags = 0;
+ pTempWindow = pSWindow;
+ do
+ {
+ nDlgCtrlFlags |= pTempWindow->GetDialogControlFlags();
+ if ( pTempWindow == this )
+ break;
+ pTempWindow = pTempWindow->ImplGetParent();
+ }
+ while ( pTempWindow );
+
+ pButtonWindow = NULL;
+
+ if ( nKeyCode == KEY_RETURN )
+ {
+ // Wir suchen zuerst nach einem DefPushButton/CancelButton
+ pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, TRUE );
+ iButtonStart = iButton;
+ while ( pButtonWindow )
+ {
+ if ( (pButtonWindow->GetStyle() & WB_DEFBUTTON) &&
+ pButtonWindow->mbPushButton )
+ break;
+
+ pButtonWindow = ImplGetNextWindow( this, iButton, iButton, TRUE );
+ if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
+ pButtonWindow = NULL;
+ }
+
+ if ( bKeyInput && !pButtonWindow && (nDlgCtrlFlags & WINDOW_DLGCTRL_RETURN) )
+ {
+ USHORT nType;
+ USHORT nGetFocusFlags = GETFOCUS_TAB;
+ USHORT nNewIndex;
+ USHORT iStart;
+ if ( aKeyCode.IsShift() )
+ {
+ nType = DLGWINDOW_PREV;
+ nGetFocusFlags |= GETFOCUS_BACKWARD;
+ }
+ else
+ {
+ nType = DLGWINDOW_NEXT;
+ nGetFocusFlags |= GETFOCUS_FORWARD;
+ }
+ iStart = i;
+ pTempWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
+ while ( pTempWindow && (pTempWindow != pSWindow) )
+ {
+ if ( !pTempWindow->mbPushButton )
+ {
+ // Around-Flag ermitteln
+ if ( nType == DLGWINDOW_PREV )
+ {
+ if ( nNewIndex > iStart )
+ nGetFocusFlags |= GETFOCUS_AROUND;
+ }
+ else
+ {
+ if ( nNewIndex < iStart )
+ nGetFocusFlags |= GETFOCUS_AROUND;
+ }
+ pTempWindow->ImplControlFocus( nGetFocusFlags );
+ return TRUE;
+ }
+ else
+ {
+ i = nNewIndex;
+ pTempWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
+ }
+ if ( (i <= iStart) || (i > nFormEnd) )
+ pTempWindow = NULL;
+ }
+ // Wenn es das gleiche Fenster ist, ein Get/LoseFocus
+ // simulieren, falls AROUND ausgewertet wird
+ if ( pTempWindow && (pTempWindow == pSWindow) )
+ {
+ NotifyEvent aNEvt1( EVENT_LOSEFOCUS, pSWindow );
+ if ( !ImplCallPreNotify( aNEvt1 ) )
+ pSWindow->LoseFocus();
+ pSWindow->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
+ NotifyEvent aNEvt2( EVENT_GETFOCUS, pSWindow );
+ if ( !ImplCallPreNotify( aNEvt2 ) )
+ pSWindow->GetFocus();
+ pSWindow->mnGetFocusFlags = 0;
+ return TRUE;
+ }
+ }
+ }
+ else if ( nKeyCode == KEY_ESCAPE )
+ {
+ // Wir suchen zuerst nach einem DefPushButton/CancelButton
+ pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, TRUE );
+ iButtonStart = iButton;
+ while ( pButtonWindow )
+ {
+ if ( pButtonWindow->GetType() == WINDOW_CANCELBUTTON )
+ break;
+
+ pButtonWindow = ImplGetNextWindow( this, iButton, iButton, TRUE );
+ if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
+ pButtonWindow = NULL;
+ }
+
+ if ( bKeyInput && mpDlgCtrlDownWindow )
+ {
+ if ( mpDlgCtrlDownWindow != pButtonWindow )
+ {
+ ((PushButton*)mpDlgCtrlDownWindow)->SetPressed( FALSE );
+ mpDlgCtrlDownWindow = NULL;
+ return TRUE;
+ }
+ }
+ }
+ else if ( bKeyInput )
+ {
+ if ( nKeyCode == KEY_TAB )
+ {
+ // keine Alt-Taste abfangen, wegen Windows
+ if ( !aKeyCode.IsMod2() )
+ {
+ USHORT nType;
+ USHORT nGetFocusFlags = GETFOCUS_TAB;
+ USHORT nNewIndex;
+ BOOL bFormular = FALSE;
+
+ // Bei Ctrl-Tab erstmal testen, ob zwischen Formularen
+ // gesprungen werden soll
+ if ( aKeyCode.IsMod1() )
+ {
+ // Gruppe suchen
+ Window* pFormularFirstWindow = NULL;
+ Window* pLastFormularFirstWindow = NULL;
+ pTempWindow = ImplGetChildWindow( this, 0, iTemp, FALSE );
+ Window* pPrevFirstFormularFirstWindow = NULL;
+ Window* pFirstFormularFirstWindow = pTempWindow;
+ while ( pTempWindow )
+ {
+ if ( pTempWindow->ImplGetWindow()->IsDialogControlStart() )
+ {
+ if ( iTemp != 0 )
+ bFormular = TRUE;
+ if ( aKeyCode.IsShift() )
+ {
+ if ( iTemp <= nIndex )
+ pFormularFirstWindow = pPrevFirstFormularFirstWindow;
+ pPrevFirstFormularFirstWindow = pTempWindow;
+ }
+ else
+ {
+ if ( (iTemp > nIndex) && !pFormularFirstWindow )
+ pFormularFirstWindow = pTempWindow;
+ }
+ pLastFormularFirstWindow = pTempWindow;
+ }
+
+ pTempWindow = ImplGetNextWindow( this, iTemp, iTemp, FALSE );
+ if ( !iTemp )
+ pTempWindow = NULL;
+ }
+
+ if ( bFormular )
+ {
+ if ( !pFormularFirstWindow )
+ {
+ if ( aKeyCode.IsShift() )
+ pFormularFirstWindow = pLastFormularFirstWindow;
+ else
+ pFormularFirstWindow = pFirstFormularFirstWindow;
+ }
+
+ USHORT nFoundFormStart = 0;
+ USHORT nFoundFormEnd = 0;
+ USHORT nTempIndex = 0;
+ if ( ::ImplFindDlgCtrlWindow( this, pFormularFirstWindow, nTempIndex,
+ nFoundFormStart, nFoundFormEnd ) )
+ {
+ nTempIndex = nFoundFormStart;
+ pFormularFirstWindow = ImplGetDlgWindow( nTempIndex, DLGWINDOW_FIRST, nFoundFormStart, nFoundFormEnd );
+ if ( pFormularFirstWindow )
+ {
+ pFormularFirstWindow->ImplControlFocus();
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ if ( !bFormular )
+ {
+ // Nur mit Ctrl+Tab zwischen Controls springen, wenn
+ // es erlaubt wurde
+ if ( !aKeyCode.IsMod1() || (nDlgCtrlFlags & WINDOW_DLGCTRL_MOD1TAB) )
+ {
+ if ( aKeyCode.IsShift() )
+ {
+ nType = DLGWINDOW_PREV;
+ nGetFocusFlags |= GETFOCUS_BACKWARD;
+ }
+ else
+ {
+ nType = DLGWINDOW_NEXT;
+ nGetFocusFlags |= GETFOCUS_FORWARD;
+ }
+ Window* pWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
+ // Wenn es das gleiche Fenster ist, ein Get/LoseFocus
+ // simulieren, falls AROUND ausgewertet wird
+ if ( pWindow == pSWindow )
+ {
+ NotifyEvent aNEvt1( EVENT_LOSEFOCUS, pSWindow );
+ if ( !ImplCallPreNotify( aNEvt1 ) )
+ pSWindow->LoseFocus();
+ pSWindow->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
+ NotifyEvent aNEvt2( EVENT_GETFOCUS, pSWindow );
+ if ( !ImplCallPreNotify( aNEvt2 ) )
+ pSWindow->GetFocus();
+ pSWindow->mnGetFocusFlags = 0;
+ return TRUE;
+ }
+ else if ( pWindow )
+ {
+ // Around-Flag ermitteln
+ if ( nType == DLGWINDOW_PREV )
+ {
+ if ( nNewIndex > i )
+ nGetFocusFlags |= GETFOCUS_AROUND;
+ }
+ else
+ {
+ if ( nNewIndex < i )
+ nGetFocusFlags |= GETFOCUS_AROUND;
+ }
+ pWindow->ImplControlFocus( nGetFocusFlags );
+ return TRUE;
+ }
+ }
+ }
+ }
+ }
+ else if ( (nKeyCode == KEY_LEFT) || (nKeyCode == KEY_UP) )
+ {
+ Window* pWindow = pSWindow;
+ WinBits nStyle = pSWindow->GetStyle();
+ if ( !(nStyle & WB_GROUP) )
+ {
+ pWindow = pWindow->GetWindow( WINDOW_PREV );
+ while ( pWindow )
+ {
+ pWindow = pWindow->ImplGetWindow();
+
+ nStyle = pWindow->GetStyle();
+
+ if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() )
+ {
+ if ( pWindow != pSWindow )
+ pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
+ return TRUE;
+ }
+
+ if ( nStyle & WB_GROUP )
+ break;
+
+ pWindow = pWindow->GetWindow( WINDOW_PREV );
+ }
+ }
+ }
+ else if ( (nKeyCode == KEY_RIGHT) || (nKeyCode == KEY_DOWN) )
+ {
+ Window* pWindow;
+ WinBits nStyle;
+ pWindow = pSWindow->GetWindow( WINDOW_NEXT );
+ while ( pWindow )
+ {
+ pWindow = pWindow->ImplGetWindow();
+
+ nStyle = pWindow->GetStyle();
+
+ if ( nStyle & WB_GROUP )
+ break;
+
+ if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() )
+ {
+ pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
+ return TRUE;
+ }
+
+ pWindow = pWindow->GetWindow( WINDOW_NEXT );
+ }
+ }
+ else
+ {
+ xub_Unicode c = rKEvt.GetCharCode();
+ if ( c )
+ {
+ pSWindow = ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd );
+ if ( pSWindow )
+ {
+ USHORT nGetFocusFlags = GETFOCUS_MNEMONIC;
+ if ( pSWindow == ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ) )
+ nGetFocusFlags |= GETFOCUS_UNIQUEMNEMONIC;
+ pSWindow->ImplControlFocus( nGetFocusFlags );
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ if ( pButtonWindow && pButtonWindow->IsVisible() && pButtonWindow->IsEnabled() && pButtonWindow->IsInputEnabled() )
+ {
+ if ( bKeyInput )
+ {
+ if ( mpDlgCtrlDownWindow && (mpDlgCtrlDownWindow != pButtonWindow) )
+ {
+ ((PushButton*)mpDlgCtrlDownWindow)->SetPressed( FALSE );
+ mpDlgCtrlDownWindow = NULL;
+ }
+
+ ((PushButton*)pButtonWindow)->SetPressed( TRUE );
+ mpDlgCtrlDownWindow = pButtonWindow;
+ }
+ else if ( mpDlgCtrlDownWindow == pButtonWindow )
+ {
+ mpDlgCtrlDownWindow = NULL;
+ ((PushButton*)pButtonWindow)->SetPressed( FALSE );
+ ((PushButton*)pButtonWindow)->Click();
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplDlgCtrlNextWindow()
+{
+ Window* pDlgCtrlParent;
+ Window* pDlgCtrl;
+ Window* pSWindow;
+ USHORT nIndex;
+ USHORT nFormStart;
+ USHORT nFormEnd;
+
+ // Fenster fuer Dialog-Steuerung suchen
+ pDlgCtrl = this;
+ pDlgCtrlParent = ImplGetParent();
+ while ( pDlgCtrlParent &&
+ !pDlgCtrlParent->ImplIsOverlapWindow() &&
+ ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
+ pDlgCtrlParent = pDlgCtrlParent->ImplGetParent();
+
+ if ( !pDlgCtrlParent || ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
+ return;
+
+ // Fenster in der Child-Liste suchen
+ pSWindow = ::ImplFindDlgCtrlWindow( pDlgCtrlParent, pDlgCtrl,
+ nIndex, nFormStart, nFormEnd );
+ if ( !pSWindow )
+ return;
+
+ Window* pWindow = pDlgCtrlParent->ImplGetDlgWindow( nIndex, DLGWINDOW_NEXT, nFormStart, nFormEnd );
+ if ( pWindow && (pWindow != pSWindow) )
+ pWindow->ImplControlFocus();
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow,
+ BOOL bGetFocus )
+{
+ PushButton* pOldDefButton = NULL;
+ PushButton* pNewDefButton = NULL;
+ Window* pSWindow;
+ USHORT i;
+ USHORT nFormStart;
+ USHORT nFormEnd;
+
+ // Formular suchen
+ pSWindow = ::ImplFindDlgCtrlWindow( pParent, pFocusWindow, i, nFormStart, nFormEnd );
+ if ( !pSWindow )
+ {
+ nFormStart = 0;
+ nFormEnd = 0xFFFF;
+ }
+
+ pSWindow = ImplGetChildWindow( pParent, nFormStart, i, FALSE );
+ while ( pSWindow )
+ {
+ if ( pSWindow->ImplIsPushButton() )
+ {
+ PushButton* pPushButton = (PushButton*)pSWindow;
+ if ( pPushButton->ImplIsDefButton() )
+ pOldDefButton = pPushButton;
+ if ( pPushButton->HasChildPathFocus() )
+ pNewDefButton = pPushButton;
+ else if ( !pNewDefButton && (pPushButton->GetStyle() & WB_DEFBUTTON) )
+ pNewDefButton = pPushButton;
+ }
+
+ pSWindow = ImplGetNextWindow( pParent, i, i, FALSE );
+ if ( !i || (i > nFormEnd) )
+ pSWindow = NULL;
+ }
+
+ if ( !bGetFocus )
+ {
+ USHORT nDummy;
+ Window* pNewFocusWindow = Application::GetFocusWindow();
+ if ( !pNewFocusWindow || !pParent->ImplIsWindowOrChild( pNewFocusWindow ) )
+ pNewDefButton = NULL;
+ else if ( !::ImplFindDlgCtrlWindow( pParent, pNewFocusWindow, i, nDummy, nDummy ) ||
+ (i < nFormStart) || (i > nFormEnd) )
+ pNewDefButton = NULL;
+ }
+
+ if ( pOldDefButton != pNewDefButton )
+ {
+ if ( pOldDefButton )
+ pOldDefButton->ImplSetDefButton( FALSE );
+ if ( pNewDefButton )
+ pNewDefButton->ImplSetDefButton( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplDlgCtrlFocusChanged( Window* pWindow, BOOL bGetFocus )
+{
+ if ( mpDlgCtrlDownWindow && !bGetFocus )
+ {
+ ((PushButton*)mpDlgCtrlDownWindow)->SetPressed( FALSE );
+ mpDlgCtrlDownWindow = NULL;
+ }
+
+ ImplDlgCtrlUpdateDefButton( this, pWindow, bGetFocus );
+}
+
+// -----------------------------------------------------------------------
+
+Window* Window::ImplFindDlgCtrlWindow( Window* pWindow )
+{
+ USHORT nIndex;
+ USHORT nFormStart;
+ USHORT nFormEnd;
+
+ // Focus-Fenster in der Child-Liste suchen und zurueckgeben
+ return ::ImplFindDlgCtrlWindow( this, pWindow, nIndex, nFormStart, nFormEnd );
+}
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
new file mode 100644
index 000000000000..5a27ed7e75ef
--- /dev/null
+++ b/vcl/source/window/dockwin.cxx
@@ -0,0 +1,857 @@
+/*************************************************************************
+ *
+ * $RCSfile: dockwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_DOCKWIN_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#ifndef _SV_FLOATWIN_HXX
+#include <floatwin.hxx>
+#endif
+#ifndef _SV_DOCKWIN_HXX
+#include <dockwin.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+#include <unowrap.hxx>
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define DOCKWIN_FLOATSTYLES (WB_SIZEABLE | WB_MOVEABLE | WB_CLOSEABLE | WB_STANDALONE | WB_PINABLE | WB_ROLLABLE)
+
+// =======================================================================
+
+class ImplDockFloatWin : public FloatingWindow
+{
+private:
+ DockingWindow* mpDockWin;
+
+public:
+ ImplDockFloatWin( Window* pParent, WinBits nWinBits,
+ DockingWindow* pDockingWin );
+
+ virtual void Move();
+ virtual void TitleButtonClick( USHORT nButton );
+ virtual void Pin();
+ virtual void Roll();
+ virtual void PopupModeEnd();
+ virtual void Resizing( Size& rSize );
+ virtual BOOL Close();
+};
+
+// -----------------------------------------------------------------------
+
+ImplDockFloatWin::ImplDockFloatWin( Window* pParent, WinBits nWinBits,
+ DockingWindow* pDockingWin ) :
+ FloatingWindow( pParent, nWinBits )
+{
+ mpDockWin = pDockingWin;
+
+ // Daten vom DockingWindow uebernehmen
+ if ( pDockingWin )
+ {
+ SetSettings( pDockingWin->GetSettings() );
+ Enable( pDockingWin->IsEnabled(), FALSE );
+ EnableInput( pDockingWin->IsInputEnabled(), FALSE );
+ AlwaysEnableInput( pDockingWin->IsAlwaysEnableInput(), FALSE );
+ EnableAlwaysOnTop( pDockingWin->IsAlwaysOnTopEnabled() );
+ EnableDrop( pDockingWin->IsDropEnabled() );
+ SetActivateMode( pDockingWin->GetActivateMode() );
+ }
+
+ SetBackground();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDockFloatWin::Move()
+{
+ FloatingWindow::Move();
+ mpDockWin->Move();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDockFloatWin::TitleButtonClick( USHORT nButton )
+{
+ FloatingWindow::TitleButtonClick( nButton );
+ mpDockWin->TitleButtonClick( nButton );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDockFloatWin::Pin()
+{
+ FloatingWindow::Pin();
+ mpDockWin->Pin();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDockFloatWin::Roll()
+{
+ FloatingWindow::Roll();
+ mpDockWin->Roll();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDockFloatWin::PopupModeEnd()
+{
+ FloatingWindow::PopupModeEnd();
+ mpDockWin->PopupModeEnd();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDockFloatWin::Resizing( Size& rSize )
+{
+ FloatingWindow::Resizing( rSize );
+ mpDockWin->Resizing( rSize );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplDockFloatWin::Close()
+{
+ return mpDockWin->Close();
+}
+
+// =======================================================================
+
+BOOL DockingWindow::ImplStartDocking( const Point& rPos )
+{
+ if ( !mbDockable )
+ return FALSE;
+
+ maMouseOff = rPos;
+ maMouseStart = maMouseOff;
+ mbDocking = TRUE;
+ mbLastFloatMode = IsFloatingMode();
+ mbStartFloat = mbLastFloatMode;
+
+ // FloatingBorder berechnen
+ FloatingWindow* pWin;
+ if ( mpFloatWin )
+ pWin = mpFloatWin;
+ else
+ pWin = new ImplDockFloatWin( mpParent, mnFloatBits, NULL );
+ pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
+ if ( !mpFloatWin )
+ delete pWin;
+
+ Point aPos = ImplOutputToFrame( Point() );
+ Size aSize = Window::GetOutputSizePixel();
+ mnTrackX = aPos.X();
+ mnTrackY = aPos.Y();
+ mnTrackWidth = aSize.Width();
+ mnTrackHeight = aSize.Height();
+
+ if ( mbLastFloatMode )
+ {
+ maMouseOff.X() += mnDockLeft;
+ maMouseOff.Y() += mnDockTop;
+ mnTrackX -= mnDockLeft;
+ mnTrackY -= mnDockTop;
+ mnTrackWidth += mnDockLeft+mnDockRight;
+ mnTrackHeight += mnDockTop+mnDockBottom;
+ }
+
+ if ( GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_DOCKING )
+ mbDragFull = TRUE;
+ else
+ {
+ StartDocking();
+ mbDragFull = FALSE;
+ ImplUpdateAll();
+ ImplGetFrameWindow()->ImplUpdateAll();
+ }
+
+ StartTracking( STARTTRACK_KEYMOD );
+ return TRUE;
+}
+
+// =======================================================================
+
+void DockingWindow::ImplInitData()
+{
+ mbDockWin = TRUE;
+
+ mpFloatWin = NULL;
+ mbDockCanceled = FALSE;
+ mbDockPrevented = FALSE;
+ mbFloatPrevented = FALSE;
+ mbDocking = FALSE;
+ mbPined = FALSE;
+ mbRollUp = FALSE;
+ mbDockBtn = FALSE;
+ mbHideBtn = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::ImplInit( Window* pParent, WinBits nStyle )
+{
+ if ( !(nStyle & WB_NODIALOGCONTROL) )
+ nStyle |= WB_DIALOGCONTROL;
+
+ mpParent = pParent;
+ mbDockable = (nStyle & WB_DOCKABLE) != 0;
+ mnFloatBits = WB_BORDER | (nStyle & DOCKWIN_FLOATSTYLES);
+ nStyle &= ~(DOCKWIN_FLOATSTYLES | WB_BORDER);
+ if ( nStyle & WB_DOCKBORDER )
+ nStyle |= WB_BORDER;
+
+ Window::ImplInit( pParent, nStyle, NULL );
+
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::ImplInitSettings()
+{
+ // Hack, damit man auch DockingWindows ohne Hintergrund bauen kann
+ // und noch nicht alles umgestellt ist
+ if ( IsBackground() )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( Window::GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetFaceColor();
+ else
+ aColor = rStyleSettings.GetWindowColor();
+ SetBackground( aColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::ImplLoadRes( const ResId& rResId )
+{
+ Window::ImplLoadRes( rResId );
+
+ USHORT nMask = ReadShortRes();
+
+ if ( (RSC_DOCKINGWINDOW_XYMAPMODE | RSC_DOCKINGWINDOW_X |
+ RSC_DOCKINGWINDOW_Y) & nMask )
+ {
+ // Groessenangabe aus der Resource verwenden
+ Point aPos;
+ MapUnit ePosMap = MAP_PIXEL;
+
+ if ( RSC_DOCKINGWINDOW_XYMAPMODE & nMask )
+ ePosMap = (MapUnit)ReadShortRes();
+
+ if ( RSC_DOCKINGWINDOW_X & nMask )
+ {
+ aPos.X() = ReadShortRes();
+ aPos.X() = ImplLogicUnitToPixelX( aPos.X(), ePosMap );
+ }
+
+ if ( RSC_DOCKINGWINDOW_Y & nMask )
+ {
+ aPos.Y() = ReadShortRes();
+ aPos.Y() = ImplLogicUnitToPixelY( aPos.Y(), ePosMap );
+ }
+
+ SetFloatingPos( aPos );
+ }
+
+ if ( nMask & RSC_DOCKINGWINDOW_FLOATING )
+ {
+ if ( (BOOL)ReadShortRes() )
+ SetFloatingMode( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+DockingWindow::DockingWindow( WindowType nType ) :
+ Window( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+DockingWindow::DockingWindow( Window* pParent, WinBits nStyle ) :
+ Window( WINDOW_DOCKINGWINDOW )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+DockingWindow::DockingWindow( Window* pParent, const ResId& rResId ) :
+ Window( WINDOW_DOCKINGWINDOW )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_DOCKINGWINDOW );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+DockingWindow::~DockingWindow()
+{
+ if ( IsFloatingMode() )
+ {
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+ SetFloatingMode( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( mbDocking )
+ {
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ mbDocking = FALSE;
+ if ( mbDragFull )
+ {
+ // Bei Abbruch alten Zustand wieder herstellen
+ if ( rTEvt.IsTrackingCanceled() )
+ {
+ StartDocking();
+ Rectangle aRect( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) );
+ EndDocking( aRect, mbStartFloat );
+ }
+ }
+ else
+ {
+ HideTracking();
+ if ( rTEvt.IsTrackingCanceled() )
+ {
+ mbDockCanceled = TRUE;
+ EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
+ mbDockCanceled = FALSE;
+ }
+ else
+ EndDocking( Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
+ }
+ }
+ // Docking nur bei nicht synthetischen MouseEvents
+ else if ( !rTEvt.GetMouseEvent().IsSynthetic() || rTEvt.GetMouseEvent().IsModifierChanged() )
+ {
+ Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+ Point aFrameMousePos = ImplOutputToFrame( aMousePos );
+ Size aFrameSize = mpFrameWindow->GetOutputSizePixel();
+ if ( aFrameMousePos.X() < 0 )
+ aFrameMousePos.X() = 0;
+ if ( aFrameMousePos.Y() < 0 )
+ aFrameMousePos.Y() = 0;
+ if ( aFrameMousePos.X() > aFrameSize.Width()-1 )
+ aFrameMousePos.X() = aFrameSize.Width()-1;
+ if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
+ aFrameMousePos.Y() = aFrameSize.Height()-1;
+ aMousePos = ImplFrameToOutput( aFrameMousePos );
+ aMousePos.X() -= maMouseOff.X();
+ aMousePos.Y() -= maMouseOff.Y();
+ Point aPos = ImplOutputToFrame( aMousePos );
+ Rectangle aTrackRect( aPos, Size( mnTrackWidth, mnTrackHeight ) );
+ Rectangle aCompRect = aTrackRect;
+ aPos.X() += maMouseOff.X();
+ aPos.Y() += maMouseOff.Y();
+ if ( mbDragFull )
+ StartDocking();
+ if ( !rTEvt.GetMouseEvent().IsMod1() )
+ mbDockPrevented = TRUE;
+ BOOL bFloatMode = Docking( aPos, aTrackRect );
+ mbDockPrevented = FALSE;
+ mbFloatPrevented = FALSE;
+ if ( mbLastFloatMode != bFloatMode )
+ {
+ if ( bFloatMode )
+ {
+ aTrackRect.Left() -= mnDockLeft;
+ aTrackRect.Top() -= mnDockTop;
+ aTrackRect.Right() += mnDockRight;
+ aTrackRect.Bottom() += mnDockBottom;
+ }
+ else
+ {
+ if ( aCompRect == aTrackRect )
+ {
+ aTrackRect.Left() += mnDockLeft;
+ aTrackRect.Top() += mnDockTop;
+ aTrackRect.Right() -= mnDockRight;
+ aTrackRect.Bottom() -= mnDockBottom;
+ }
+ }
+ mbLastFloatMode = bFloatMode;
+ }
+ if ( mbDragFull )
+ {
+ Point aPos;
+ Point aOldPos = OutputToScreenPixel( aPos );
+ EndDocking( aTrackRect, mbLastFloatMode );
+ // Wenn der Status bzw. die Position sich
+ // geaendert hat, dann neu ausgeben
+ if ( aOldPos != OutputToScreenPixel( aPos ) )
+ {
+ ImplUpdateAll();
+ ImplGetFrameWindow()->ImplUpdateAll();
+ }
+// EndDocking( aTrackRect, mbLastFloatMode );
+ }
+ else
+ {
+ USHORT nTrackStyle;
+ if ( bFloatMode )
+ nTrackStyle = SHOWTRACK_BIG;
+ else
+ nTrackStyle = SHOWTRACK_SMALL;
+ Rectangle aShowTrackRect = aTrackRect;
+ aShowTrackRect.SetPos( ImplFrameToOutput( aShowTrackRect.TopLeft() ) );
+ ShowTracking( aShowTrackRect, nTrackStyle );
+
+ // Maus-Offset neu berechnen, da Rechteck veraendert werden
+ // konnte
+ maMouseOff.X() = aPos.X() - aTrackRect.Left();
+ maMouseOff.Y() = aPos.Y() - aTrackRect.Top();
+ }
+
+ mnTrackX = aTrackRect.Left();
+ mnTrackY = aTrackRect.Top();
+ mnTrackWidth = aTrackRect.GetWidth();
+ mnTrackHeight = aTrackRect.GetHeight();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long DockingWindow::Notify( NotifyEvent& rNEvt )
+{
+ if ( mbDockable )
+ {
+ if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
+ {
+ const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
+ if ( pMEvt->IsLeft() )
+ {
+ if ( pMEvt->GetClicks() == 2 )
+ {
+ if ( pMEvt->IsMod1() )
+ SetFloatingMode( !IsFloatingMode() );
+ return TRUE;
+ }
+ else if ( pMEvt->GetClicks() == 1 )
+ {
+ Point aPos = pMEvt->GetPosPixel();
+ Window* pWindow = rNEvt.GetWindow();
+ if ( pWindow != this )
+ {
+ aPos = pWindow->OutputToScreenPixel( aPos );
+ aPos = ScreenToOutputPixel( aPos );
+ }
+ if ( IsFloatingMode() || pMEvt->IsMod1() )
+ ImplStartDocking( aPos );
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return Window::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::StartDocking()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DockingWindow::Docking( const Point&, Rectangle& )
+{
+ return IsFloatingMode();
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::EndDocking( const Rectangle& rRect, BOOL bFloatMode )
+{
+ if ( !IsDockingCanceled() )
+ {
+ BOOL bShow = FALSE;
+ if ( bFloatMode != IsFloatingMode() )
+ {
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+ SetFloatingMode( bFloatMode );
+ bShow = TRUE;
+ }
+ if ( bFloatMode )
+ mpFloatWin->SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() );
+ else
+ {
+ Point aPos = rRect.TopLeft();
+ aPos = GetParent()->ScreenToOutputPixel( aPos );
+ Window::SetPosSizePixel( aPos, rRect.GetSize() );
+ }
+
+ if ( bShow )
+ Show();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DockingWindow::PrepareToggleFloatingMode()
+{
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DockingWindow::Close()
+{
+ if ( mxWindowPeer.is() )
+ {
+ Application::GetUnoWrapper()->WindowEvent_Close( this );
+ if ( IsCreatedWithToolkit() )
+ return FALSE;
+ }
+
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::ToggleFloatingMode()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::TitleButtonClick( USHORT )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::Pin()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::Roll()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::PopupModeEnd()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::Resizing( Size& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+
+ Window::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+ else
+ Window::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::ShowTitleButton( USHORT nButton, BOOL bVisible )
+{
+ if ( mpFloatWin )
+ mpFloatWin->ShowTitleButton( nButton, bVisible );
+ else
+ {
+ if ( nButton == TITLE_BUTTON_DOCKING )
+ mbDockBtn = bVisible;
+ else /* if ( nButton == TITLE_BUTTON_HIDE ) */
+ mbHideBtn = bVisible;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL DockingWindow::IsTitleButtonVisible( USHORT nButton ) const
+{
+ if ( mpFloatWin )
+ return mpFloatWin->IsTitleButtonVisible( nButton );
+ else
+ {
+ if ( nButton == TITLE_BUTTON_DOCKING )
+ return mbDockBtn;
+ else /* if ( nButton == TITLE_BUTTON_HIDE ) */
+ return mbHideBtn;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::SetFloatingMode( BOOL bFloatMode )
+{
+ if ( IsFloatingMode() != bFloatMode )
+ {
+ if ( PrepareToggleFloatingMode() )
+ {
+ BOOL bVisible = IsVisible();
+
+ if ( bFloatMode )
+ {
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+
+ maDockPos = Window::GetPosPixel();
+
+ Window* pRealParent = mpRealParent;
+ mpOldBorderWin = mpBorderWindow;
+ ImplDockFloatWin* pWin = new ImplDockFloatWin( mpParent, mnFloatBits, this );
+ mpFloatWin = pWin;
+ mpBorderWindow = NULL;
+ mnLeftBorder = 0;
+ mnTopBorder = 0;
+ mnRightBorder = 0;
+ mnBottomBorder = 0;
+ // Falls Parent zerstoert wird, muessen wir auch vom
+ // BorderWindow den Parent umsetzen
+ if ( mpOldBorderWin )
+ mpOldBorderWin->SetParent( pWin );
+ SetParent( pWin );
+ SetPosPixel( Point() );
+ mpBorderWindow = pWin;
+ pWin->mpClientWindow = this;
+ mpRealParent = pRealParent;
+ pWin->SetText( Window::GetText() );
+ pWin->SetOutputSizePixel( Window::GetSizePixel() );
+ pWin->SetPosPixel( maFloatPos );
+ // DockingDaten ans FloatingWindow weiterreichen
+ pWin->ShowTitleButton( TITLE_BUTTON_DOCKING, mbDockBtn );
+ pWin->ShowTitleButton( TITLE_BUTTON_HIDE, mbHideBtn );
+ pWin->SetPin( mbPined );
+ if ( mbRollUp )
+ pWin->RollUp();
+ else
+ pWin->RollDown();
+ pWin->SetRollUpOutputSizePixel( maRollUpOutSize );
+ pWin->SetMinOutputSizePixel( maMinOutSize );
+
+ ToggleFloatingMode();
+
+ if ( bVisible )
+ Show();
+ }
+ else
+ {
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+
+ // FloatingDaten wird im FloatingWindow speichern
+ maFloatPos = mpFloatWin->GetPosPixel();
+ mbDockBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_DOCKING );
+ mbHideBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_HIDE );
+ mbPined = mpFloatWin->IsPined();
+ mbRollUp = mpFloatWin->IsRollUp();
+ maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel();
+ maMinOutSize = mpFloatWin->GetMinOutputSizePixel();
+
+ Window* pRealParent = mpRealParent;
+ mpBorderWindow = NULL;
+ if ( mpOldBorderWin )
+ {
+ SetParent( mpOldBorderWin );
+ ((ImplBorderWindow*)mpOldBorderWin)->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ mpOldBorderWin->Resize();
+ }
+ mpBorderWindow = mpOldBorderWin;
+ SetParent( pRealParent );
+ mpRealParent = pRealParent;
+ delete mpFloatWin;
+ mpFloatWin = NULL;
+ SetPosPixel( maDockPos );
+
+ ToggleFloatingMode();
+
+ if ( bVisible )
+ Show();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::SetFloatStyle( WinBits nStyle )
+{
+ mnFloatBits = nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+WinBits DockingWindow::GetFloatStyle() const
+{
+ return mnFloatBits;
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::SetTabStop()
+{
+ mnStyle |= WB_GROUP | WB_TABSTOP;
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::SetPosSizePixel( long nX, long nY,
+ long nWidth, long nHeight,
+ USHORT nFlags )
+{
+ if ( mpFloatWin )
+ mpFloatWin->SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
+ else
+ Window::SetPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+Point DockingWindow::GetPosPixel() const
+{
+ if ( mpFloatWin )
+ return mpFloatWin->GetPosPixel();
+ else
+ return Window::GetPosPixel();
+}
+
+// -----------------------------------------------------------------------
+
+Size DockingWindow::GetSizePixel() const
+{
+ if ( mpFloatWin )
+ return mpFloatWin->GetSizePixel();
+ else
+ return Window::GetSizePixel();
+}
+
+// -----------------------------------------------------------------------
+
+void DockingWindow::SetOutputSizePixel( const Size& rNewSize )
+{
+ if ( mpFloatWin )
+ mpFloatWin->SetOutputSizePixel( rNewSize );
+ else
+ Window::SetOutputSizePixel( rNewSize );
+}
+
+// -----------------------------------------------------------------------
+
+Size DockingWindow::GetOutputSizePixel() const
+{
+ if ( mpFloatWin )
+ return mpFloatWin->GetOutputSizePixel();
+ else
+ return Window::GetOutputSizePixel();
+}
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
new file mode 100644
index 000000000000..800734aadf86
--- /dev/null
+++ b/vcl/source/window/floatwin.cxx
@@ -0,0 +1,748 @@
+/*************************************************************************
+ *
+ * $RCSfile: floatwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_FLOATWIN_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#ifndef _SV_TOOLBOX_HXX
+#include <toolbox.hxx>
+#endif
+#ifndef _SV_FLOATWIN_HXX
+#include <floatwin.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle )
+{
+ mbFloatWin = TRUE;
+
+ if ( !pParent )
+ pParent = Application::GetAppWindow();
+
+ DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists" );
+
+ // no Border, then we dont need a border window
+ if ( !nStyle )
+ {
+ mbOverlapWin = TRUE;
+ if ( !(nStyle & WB_NODIALOGCONTROL) )
+ nStyle |= WB_DIALOGCONTROL;
+ SystemWindow::ImplInit( pParent, nStyle, NULL );
+ }
+ else
+ {
+ ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT );
+ if ( !(nStyle & WB_NODIALOGCONTROL) )
+ nStyle |= WB_DIALOGCONTROL;
+ SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
+ pBorderWin->mpClientWindow = this;
+ pBorderWin->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ pBorderWin->SetDisplayActive( TRUE );
+ mpBorderWindow = pBorderWin;
+ mpRealParent = pParent;
+ }
+ SetActivateMode( 0 );
+
+ mpNextFloat = NULL;
+ mpFirstPopupModeWin = NULL;
+ mpBox = NULL;
+ mnPostId = 0;
+ mnTitle = (nStyle & WB_MOVEABLE) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE;
+ mnOldTitle = mnTitle;
+ mnPopupModeFlags = 0;
+ mbInPopupMode = FALSE;
+ mbPopupMode = FALSE;
+ mbPopupModeCanceled = FALSE;
+ mbPopupModeTearOff = FALSE;
+ mbMouseDown = FALSE;
+
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::ImplInitSettings()
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( Window::GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetFaceColor();
+ else
+ aColor = rStyleSettings.GetWindowColor();
+ SetBackground( aColor );
+}
+
+// =======================================================================
+
+FloatingWindow::FloatingWindow( Window* pParent, WinBits nStyle ) :
+ SystemWindow( WINDOW_FLOATINGWINDOW )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+FloatingWindow::FloatingWindow( Window* pParent, const ResId& rResId ) :
+ SystemWindow( WINDOW_FLOATINGWINDOW )
+{
+ rResId.SetRT( RSC_FLOATINGWINDOW );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::ImplLoadRes( const ResId& rResId )
+{
+ SystemWindow::ImplLoadRes( rResId );
+
+ USHORT nObjMask = ReadShortRes();
+
+ if ( (RSC_FLOATINGWINDOW_WHMAPMODE | RSC_FLOATINGWINDOW_WIDTH |
+ RSC_FLOATINGWINDOW_HEIGHT) & nObjMask )
+ {
+ // Groessenangabe aus der Resource verwenden
+ Size aSize;
+ MapUnit eSizeMap = MAP_PIXEL;
+
+ if ( RSC_FLOATINGWINDOW_WHMAPMODE & nObjMask )
+ eSizeMap = (MapUnit) ReadShortRes();
+ if ( RSC_FLOATINGWINDOW_WIDTH & nObjMask )
+ aSize.Width() = ReadShortRes();
+ if ( RSC_FLOATINGWINDOW_HEIGHT & nObjMask )
+ aSize.Height() = ReadShortRes();
+
+ SetRollUpOutputSizePixel( LogicToPixel( aSize, eSizeMap ) );
+ }
+
+ if (nObjMask & RSC_FLOATINGWINDOW_ZOOMIN )
+ {
+ if ( ReadShortRes() )
+ RollUp();
+ }
+}
+
+
+// -----------------------------------------------------------------------
+
+FloatingWindow::~FloatingWindow()
+{
+ if ( IsInPopupMode() )
+ EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL );
+
+ if ( mnPostId )
+ Application::RemoveUserEvent( mnPostId );
+}
+
+// -----------------------------------------------------------------------
+
+Point FloatingWindow::ImplCalcPos( Window* pWindow,
+ const Rectangle& rRect, ULONG nFlags,
+ USHORT& rArrangeIndex )
+{
+ // Fenster-Position ermitteln
+ Point aPos;
+ Size aSize = pWindow->GetSizePixel();
+ Rectangle aScreenRect = pWindow->ImplGetFrameWindow()->GetDesktopRectPixel();
+ USHORT nArrangeAry[5];
+ USHORT nArrangeIndex;
+ BOOL bLeft;
+ BOOL bTop;
+ BOOL bBreak;
+ if ( nFlags & FLOATWIN_POPUPMODE_LEFT )
+ {
+ nArrangeAry[0] = FLOATWIN_POPUPMODE_LEFT;
+ nArrangeAry[1] = FLOATWIN_POPUPMODE_RIGHT;
+ nArrangeAry[2] = FLOATWIN_POPUPMODE_UP;
+ nArrangeAry[3] = FLOATWIN_POPUPMODE_DOWN;
+ nArrangeAry[4] = FLOATWIN_POPUPMODE_LEFT;
+ }
+ else if ( nFlags & FLOATWIN_POPUPMODE_RIGHT )
+ {
+ nArrangeAry[0] = FLOATWIN_POPUPMODE_RIGHT;
+ nArrangeAry[1] = FLOATWIN_POPUPMODE_LEFT;
+ nArrangeAry[2] = FLOATWIN_POPUPMODE_UP;
+ nArrangeAry[3] = FLOATWIN_POPUPMODE_DOWN;
+ nArrangeAry[4] = FLOATWIN_POPUPMODE_RIGHT;
+ }
+ else if ( nFlags & FLOATWIN_POPUPMODE_UP )
+ {
+ nArrangeAry[0] = FLOATWIN_POPUPMODE_UP;
+ nArrangeAry[1] = FLOATWIN_POPUPMODE_DOWN;
+ nArrangeAry[2] = FLOATWIN_POPUPMODE_RIGHT;
+ nArrangeAry[3] = FLOATWIN_POPUPMODE_LEFT;
+ nArrangeAry[4] = FLOATWIN_POPUPMODE_UP;
+ }
+ else
+ {
+ nArrangeAry[0] = FLOATWIN_POPUPMODE_DOWN;
+ nArrangeAry[1] = FLOATWIN_POPUPMODE_UP;
+ nArrangeAry[2] = FLOATWIN_POPUPMODE_RIGHT;
+ nArrangeAry[3] = FLOATWIN_POPUPMODE_LEFT;
+ nArrangeAry[4] = FLOATWIN_POPUPMODE_DOWN;
+ }
+ if ( nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE )
+ nArrangeIndex = 4;
+ else
+ nArrangeIndex = 0;
+ for ( ; nArrangeIndex < 5; nArrangeIndex++ )
+ {
+ bLeft = FALSE;
+ bTop = FALSE;
+ bBreak = TRUE;
+ switch ( nArrangeAry[nArrangeIndex] )
+ {
+ case FLOATWIN_POPUPMODE_LEFT:
+ aPos.X() = rRect.Left()-aSize.Width();
+ aPos.Y() = rRect.Top();
+ aPos.Y() -= pWindow->mnTopBorder;
+ if ( aPos.X() < aScreenRect.Left() )
+ bBreak = FALSE;
+ break;
+ case FLOATWIN_POPUPMODE_RIGHT:
+ aPos = rRect.TopRight();
+ aPos.Y() -= pWindow->mnTopBorder;
+ if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
+ bBreak = FALSE;
+ break;
+ case FLOATWIN_POPUPMODE_UP:
+ aPos.X() = rRect.Left();
+ aPos.Y() = rRect.Top()-aSize.Height();
+ if ( aPos.Y() < aScreenRect.Top() )
+ bBreak = FALSE;
+ break;
+ case FLOATWIN_POPUPMODE_DOWN:
+ aPos = rRect.BottomLeft();
+ if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
+ bBreak = FALSE;
+ break;
+ }
+
+ // Evt. noch anpassen
+ if ( bBreak && !(nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE) )
+ {
+ if ( (nArrangeAry[nArrangeIndex] == FLOATWIN_POPUPMODE_LEFT) ||
+ (nArrangeAry[nArrangeIndex] == FLOATWIN_POPUPMODE_RIGHT) )
+ {
+ if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
+ {
+ bTop = TRUE;
+ aPos.Y() = rRect.Bottom()-aSize.Height();
+ if ( aPos.Y() < aScreenRect.Top() )
+ aPos.Y() = aScreenRect.Top();
+ }
+ }
+ else
+ {
+ if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
+ {
+ bLeft = TRUE;
+ aPos.X() = rRect.Right()-aSize.Width();
+ if ( aPos.X() < aScreenRect.Left() )
+ aPos.X() = aScreenRect.Left();
+ }
+ }
+ }
+
+ if ( bBreak )
+ break;
+ }
+ if ( nArrangeIndex > 4 )
+ nArrangeIndex = 4;
+
+ // Ansonsten soweit wie moeglich in den Bildschirm einpassen
+ if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
+ aPos.X() = aScreenRect.Right()-aSize.Width();
+ if ( aPos.X() < aScreenRect.Left() )
+ aPos.X() = aScreenRect.Left();
+ if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
+ aPos.Y() = aScreenRect.Bottom()-aSize.Height();
+ if ( aPos.Y() < aScreenRect.Top() )
+ aPos.Y() = aScreenRect.Top();
+
+ rArrangeIndex = nArrangeIndex;
+ return aPos;
+}
+
+// -----------------------------------------------------------------------
+
+FloatingWindow* FloatingWindow::ImplFloatHitTest( const Point& rPos, USHORT& rHitTest )
+{
+ FloatingWindow* pWin = this;
+
+ do
+ {
+ Rectangle aRect( pWin->GetPosPixel(), pWin->GetSizePixel() );
+ if ( aRect.IsInside( rPos ) )
+ {
+ rHitTest = IMPL_FLOATWIN_HITTEST_WINDOW;
+ return pWin;
+ }
+
+ // Testen, ob Maus im Rechteck
+ if ( pWin->maFloatRect.IsInside( rPos ) )
+ {
+ rHitTest = IMPL_FLOATWIN_HITTEST_RECT;
+ return pWin;
+ }
+
+ pWin = pWin->mpNextFloat;
+ }
+ while ( pWin );
+
+ rHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE;
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+FloatingWindow* FloatingWindow::ImplFindLastLevelFloat()
+{
+ FloatingWindow* pWin = this;
+ FloatingWindow* pLastFoundWin = pWin;
+
+ do
+ {
+ if ( pWin->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NEWLEVEL )
+ pLastFoundWin = pWin;
+
+ pWin = pWin->mpNextFloat;
+ }
+ while ( pWin );
+
+ return pLastFoundWin;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL FloatingWindow::ImplIsFloatPopupModeWindow( const Window* pWindow )
+{
+ FloatingWindow* pWin = this;
+
+ do
+ {
+ if ( pWin->mpFirstPopupModeWin == pWindow )
+ return TRUE;
+
+ pWin = pWin->mpNextFloat;
+ }
+ while ( pWin );
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( FloatingWindow, ImplEndPopupModeHdl, void*, EMPTYARG )
+{
+ mnPostId = 0;
+ mnPopupModeFlags = 0;
+ mbPopupMode = FALSE;
+ PopupModeEnd();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long FloatingWindow::Notify( NotifyEvent& rNEvt )
+{
+ // Zuerst Basisklasse rufen wegen TabSteuerung
+ long nRet = SystemWindow::Notify( rNEvt );
+ if ( !nRet )
+ {
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ KeyCode aKeyCode = pKEvt->GetKeyCode();
+ USHORT nKeyCode = aKeyCode.GetCode();
+
+ if ( (nKeyCode == KEY_ESCAPE) && (GetStyle() & WB_CLOSEABLE) )
+ {
+ Close();
+ return TRUE;
+ }
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::StateChanged( StateChangedType nType )
+{
+ SystemWindow::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ SystemWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::ImplCallPopupModeEnd()
+{
+ // PopupMode wurde beendet
+ mbInPopupMode = FALSE;
+
+ // Handler asyncron rufen
+ if ( !mnPostId )
+ Application::PostUserEvent( mnPostId, LINK( this, FloatingWindow, ImplEndPopupModeHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::PopupModeEnd()
+{
+ maPopupModeEndHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::SetTitleType( USHORT nTitle )
+{
+ if ( (mnTitle != nTitle) && mpBorderWindow )
+ {
+ mnTitle = nTitle;
+ Size aOutSize = GetOutputSizePixel();
+ USHORT nTitleStyle;
+ if ( nTitle == FLOATWIN_TITLE_NORMAL )
+ nTitleStyle = BORDERWINDOW_TITLE_SMALL;
+ else if ( nTitle == FLOATWIN_TITLE_TEAROFF )
+ nTitleStyle = BORDERWINDOW_TITLE_TEAROFF;
+ else // nTitle == FLOATWIN_TITLE_NONE
+ nTitleStyle = BORDERWINDOW_TITLE_NONE;
+ ((ImplBorderWindow*)mpBorderWindow)->SetTitleType( nTitleStyle, aOutSize );
+ ((ImplBorderWindow*)mpBorderWindow)->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::StartPopupMode( const Rectangle& rRect, ULONG nFlags )
+{
+ DBG_ASSERT( (GetStyle() & WB_MOVEABLE) || !(nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF),
+ "TearOff only allowed, when FloatingWindow moveable" );
+
+ // Wenn Fenster sichtbar, dann vorher hiden, da es sonst flackert
+ if ( IsVisible() )
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+
+ // Wenn Fenster klein, dann vorher aufklappen
+ if ( IsRollUp() )
+ RollDown();
+
+ // Title wegnehmen
+ mnOldTitle = mnTitle;
+ if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF )
+ SetTitleType( FLOATWIN_TITLE_TEAROFF );
+ else
+ SetTitleType( FLOATWIN_TITLE_NONE );
+
+ // Fenster-Position ermitteln und setzen
+ USHORT nArrangeIndex;
+ SetPosPixel( ImplCalcPos( this, rRect, nFlags, nArrangeIndex ) );
+
+ // Daten seten und Fenster anzeigen
+ maFloatRect = rRect;
+ maFloatRect.Left() -= 2;
+ maFloatRect.Top() -= 2;
+ maFloatRect.Right() += 2;
+ maFloatRect.Bottom() += 2;
+ mnPopupModeFlags = nFlags;
+ mbInPopupMode = TRUE;
+ mbPopupMode = TRUE;
+ mbPopupModeCanceled = FALSE;
+ mbPopupModeTearOff = FALSE;
+ mbMouseDown = FALSE;
+
+ mbOldSaveBackMode = IsSaveBackgroundEnabled();
+ EnableSaveBackground();
+
+/*
+ // Abfragen, ob Animation eingeschaltet ist
+ if ( (Application::GetSettings().GetAnimationOptions() & ANIMATION_OPTION_POPUP) &&
+ !(nFlags & FLOATWIN_POPUPMODE_NOANIMATION) )
+ {
+ USHORT nAniFlags;
+ switch ( nArrangeAry[nArrangeIndex] )
+ {
+ case FLOATWIN_POPUPMODE_LEFT:
+ nAniFlags = STARTANIMATION_LEFT;
+ break;
+ case FLOATWIN_POPUPMODE_RIGHT:
+ nAniFlags = STARTANIMATION_RIGHT;
+ break;
+ case FLOATWIN_POPUPMODE_UP:
+ nAniFlags = STARTANIMATION_UP;
+ break;
+ case FLOATWIN_POPUPMODE_DOWN:
+ nAniFlags = STARTANIMATION_DOWN;
+ break;
+ }
+ if ( !(nFlags & FLOATWIN_POPUPMODE_ANIMATIONSLIDE) )
+ {
+ if ( bLeft )
+ nAniFlags |= STARTANIMATION_LEFT;
+ else
+ nAniFlags |= STARTANIMATION_RIGHT;
+ if ( bTop )
+ nAniFlags |= STARTANIMATION_UP;
+ else
+ nAniFlags |= STARTANIMATION_DOWN;
+ }
+
+ ImpStartAnimation( this, nAniFlags );
+ }
+ else
+*/
+ Show();
+
+ // FloatingWindow in Liste der Fenster aufnehmen, die sich im PopupModus
+ // befinden
+ ImplSVData* pSVData = ImplGetSVData();
+ mpNextFloat = pSVData->maWinData.mpFirstFloat;
+ pSVData->maWinData.mpFirstFloat = this;
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::StartPopupMode( ToolBox* pBox, ULONG nFlags )
+{
+ // Selektieten Button ermitteln
+ USHORT nItemId = pBox->GetDownItemId();
+ if ( !nItemId )
+ return;
+
+ mpBox = pBox;
+ pBox->ImplFloatControl( TRUE, this );
+
+ // Daten von der ToolBox holen
+ Rectangle aRect = pBox->GetItemRect( nItemId );
+ Point aPos = pBox->OutputToScreenPixel( aRect.TopLeft() );
+ aRect.SetPos( aPos );
+
+ // Flags fuer Positionierung bestimmen
+ if ( !(nFlags & (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_UP |
+ FLOATWIN_POPUPMODE_LEFT | FLOATWIN_POPUPMODE_RIGHT |
+ FLOATWIN_POPUPMODE_NOAUTOARRANGE)) )
+ {
+ WindowAlign eAlign = pBox->GetAlign();
+ if ( pBox->IsHorizontal() )
+ {
+ if ( pBox->IsFloatingMode() || (eAlign == WINDOWALIGN_TOP) )
+ nFlags |= FLOATWIN_POPUPMODE_DOWN;
+ else
+ nFlags |= FLOATWIN_POPUPMODE_UP;
+ }
+ else
+ {
+ if ( eAlign == WINDOWALIGN_LEFT )
+ nFlags |= FLOATWIN_POPUPMODE_RIGHT;
+ else
+ nFlags |= FLOATWIN_POPUPMODE_LEFT;
+ }
+ }
+
+ // FloatingModus starten
+ StartPopupMode( aRect, nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId )
+{
+ if ( !mbInPopupMode )
+ return;
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Bei allen nachfolgenden PopupMode-Fenster den Modus auch beenden
+ while ( pSVData->maWinData.mpFirstFloat != this )
+ pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
+
+ // Fenster aus der Liste austragen
+ pSVData->maWinData.mpFirstFloat = mpNextFloat;
+ mpNextFloat = NULL;
+
+ ULONG nPopupModeFlags = mnPopupModeFlags;
+
+ // Wenn nicht abgerissen wurde, dann Fenster wieder Hiden
+ if ( !(nFlags & FLOATWIN_POPUPMODEEND_TEAROFF) ||
+ !(nPopupModeFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) )
+ {
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+
+ // Focus evt. auf ein entsprechendes FloatingWindow weiterschalten
+ if ( nFocusId )
+ Window::EndSaveFocus( nFocusId );
+ else if ( pSVData->maWinData.mpFocusWin && pSVData->maWinData.mpFirstFloat &&
+ ImplIsWindowOrChild( pSVData->maWinData.mpFocusWin ) )
+ pSVData->maWinData.mpFirstFloat->GrabFocus();
+ mbPopupModeTearOff = FALSE;
+ }
+ else
+ {
+ mbPopupModeTearOff = TRUE;
+ if ( nFocusId )
+ Window::EndSaveFocus( nFocusId, FALSE );
+ }
+ EnableSaveBackground( mbOldSaveBackMode );
+
+ mbPopupModeCanceled = (nFlags & FLOATWIN_POPUPMODEEND_CANCEL) != 0;
+
+ // Gegebenenfalls den Title wieder herstellen
+ SetTitleType( mnOldTitle );
+
+ // ToolBox wieder auf normal schalten
+ if ( mpBox )
+ {
+ mpBox->ImplFloatControl( FALSE, this );
+ mpBox = NULL;
+ }
+
+ // Je nach Parameter den PopupModeEnd-Handler rufen
+ if ( !(nFlags & FLOATWIN_POPUPMODEEND_DONTCALLHDL) )
+ ImplCallPopupModeEnd();
+
+ // Je nach Parameter die restlichen Fenster auch noch schliessen
+ if ( nFlags & FLOATWIN_POPUPMODEEND_CLOSEALL )
+ {
+ if ( !(nPopupModeFlags & FLOATWIN_POPUPMODE_NEWLEVEL) )
+ {
+ if ( pSVData->maWinData.mpFirstFloat )
+ {
+ FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
+ pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::EndPopupMode( USHORT nFlags )
+{
+ ImplEndPopupMode( nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::AddPopupModeWindow( Window* pWindow )
+{
+ // !!! bisher erst 1 Fenster und noch keine Liste
+ mpFirstPopupModeWin = pWindow;
+}
+
+// -----------------------------------------------------------------------
+
+void FloatingWindow::RemovePopupModeWindow( Window* pWindow )
+{
+ // !!! bisher erst 1 Fenster und noch keine Liste
+ if ( mpFirstPopupModeWin == pWindow )
+ mpFirstPopupModeWin = NULL;
+}
+
diff --git a/vcl/source/window/keycod.cxx b/vcl/source/window/keycod.cxx
new file mode 100644
index 000000000000..34d5a997648e
--- /dev/null
+++ b/vcl/source/window/keycod.cxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * $RCSfile: keycod.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_KEYCOD_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_KEYCOD_HXX
+#include <keycod.hxx>
+#endif
+
+#ifndef _RC_H
+#include <rc.h>
+#endif
+
+#ifdef REMOTE_APPSERVER
+#include <rmwindow.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*3] =
+{
+ 0, 0, 0, // KEYFUNC_DONTKNOW
+ KEY_N | KEY_MOD1, 0, 0, // KEYFUNC_NEW
+ KEY_O | KEY_MOD1, KEY_OPEN, 0, // KEYFUNC_OPEN
+ KEY_S | KEY_MOD1, 0, 0, // KEYFUNC_SAVE
+ 0, 0, 0, // KEYFUNC_SAVEAS
+ KEY_P | KEY_MOD1, 0, 0, // KEYFUNC_PRINT
+ KEY_W | KEY_MOD1, KEY_F4 | KEY_MOD1, 0, // KEYFUNC_CLOSE
+ KEY_Q | KEY_MOD1, KEY_F4 | KEY_MOD2, 0, // KEYFUNC_QUIT
+ KEY_X | KEY_MOD1, KEY_DELETE | KEY_SHIFT, KEY_CUT, // KEYFUNC_CUT
+ KEY_C | KEY_MOD1, KEY_INSERT | KEY_MOD1, KEY_COPY, // KEYFUNC_COPY
+ KEY_V | KEY_MOD1, KEY_INSERT | KEY_SHIFT, KEY_PASTE, // KEYFUNC_PASTE
+ KEY_Z | KEY_MOD1, KEY_BACKSPACE | KEY_MOD2, KEY_UNDO, // KEYFUNC_UNDO
+ 0, 0, 0, // KEYFUNC_REDO
+ KEY_DELETE, 0, 0, // KEYFUNC_DELETE
+ KEY_REPEAT, 0, 0, // KEYFUNC_REPEAT
+ KEY_F | KEY_MOD1, KEY_FIND, 0, // KEYFUNC_FIND
+ KEY_F | KEY_SHIFT | KEY_MOD1, KEY_SHIFT | KEY_FIND, 0, // KEYFUNC_FINDBACKWARD
+ KEY_RETURN | KEY_MOD2, 0, 0, // KEYFUNC_PROPERTIES
+ 0, 0, 0 // KEYFUNC_FRONT
+};
+
+// -----------------------------------------------------------------------
+
+void ImplGetKeyCode( KeyFuncType eFunc, USHORT& rCode1, USHORT& rCode2, USHORT& rCode3 )
+{
+ USHORT nIndex = (USHORT)eFunc;
+ nIndex *= 3;
+ rCode1 = aImplKeyFuncTab[nIndex];
+ rCode2 = aImplKeyFuncTab[nIndex+1];
+ rCode3 = aImplKeyFuncTab[nIndex+2];
+}
+
+// =======================================================================
+
+KeyCode::KeyCode( KeyFuncType eFunction )
+{
+ USHORT nDummy;
+ ImplGetKeyCode( eFunction, nCode, nDummy, nDummy );
+ eFunc = eFunction;
+}
+
+// -----------------------------------------------------------------------
+
+KeyCode::KeyCode( const ResId& rResId )
+{
+ rResId.SetRT( RSC_KEYCODE );
+
+ ResMgr* pResMgr = rResId.GetResMgr();
+ if ( !pResMgr )
+ pResMgr = Resource::GetResManager();
+
+ if ( pResMgr && pResMgr->GetResource( rResId ) )
+ {
+ pResMgr->Increment( sizeof( RSHEADER_TYPE ) );
+
+ USHORT nKeyCode = pResMgr->ReadShort();
+ USHORT nModifier = pResMgr->ReadShort();
+ USHORT nKeyFunc = pResMgr->ReadShort();
+
+ eFunc = (KeyFuncType)nKeyFunc;
+ if ( eFunc != KEYFUNC_DONTKNOW )
+ {
+ USHORT nDummy;
+ ImplGetKeyCode( eFunc, nCode, nDummy, nDummy );
+ }
+ else
+ nCode = nKeyCode | nModifier;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+XubString KeyCode::GetName( Window* pWindow ) const
+{
+ if ( !pWindow )
+ pWindow = ImplGetDefaultWindow();
+#ifndef REMOTE_APPSERVER
+ return pWindow->ImplGetFrame()->GetKeyName( GetFullCode() );
+#else
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->mpKeyNames )
+ {
+ pSVData->mpKeyNames = new KeyNames;
+ NMSP_CLIENT::KeyNameSequence aKeyNames;
+ pWindow->ImplGetFrame()->GetKeyNames( aKeyNames );
+ ULONG nNames = aKeyNames.getLength();
+ for ( USHORT n = 0; n < nNames; n++ )
+ {
+ const NMSP_CLIENT::IDLKeyNameInfo& rInfo = aKeyNames.getConstArray()[n];
+ pSVData->mpKeyNames->Insert( rInfo.nCode, new String( rInfo.aName ) );
+ }
+ }
+
+ String aName;
+ const int nMods = 3;
+ USHORT nKeyCode = GetFullCode();
+ USHORT aModifiers[nMods] = { KEY_MOD2, KEY_MOD1, KEY_SHIFT };
+ for ( USHORT n = 0; n < nMods; n++ )
+ {
+ USHORT nMod = aModifiers[n];
+ if ( nKeyCode & nMod )
+ {
+ String* pMod = pSVData->mpKeyNames->Get( nMod );
+ if ( pMod )
+ {
+ aName += *pMod;
+ aName += '+';
+ }
+ }
+ }
+
+ USHORT nCode = GetCode();
+ if ( (nCode >= KEY_0) && (nCode <= KEY_9) )
+ aName += (sal_Unicode)'0'+(nCode-KEY_0);
+ else if ( (nCode >= KEY_A) && (nCode <= KEY_Z) )
+ aName += (sal_Unicode)'A'+(nCode-KEY_A);
+ else if ( (nCode >= KEY_F1) && (nCode <= KEY_F9) )
+ {
+ aName += (sal_Unicode)'F';
+ aName += (sal_Unicode)'1' + (nCode-KEY_F1);
+ }
+ else if ( (nCode >= KEY_F10) && (nCode <= KEY_F19) )
+ {
+ aName += (sal_Unicode)'F';
+ aName += (sal_Unicode)'1';
+ aName += (sal_Unicode)'0' + (nCode-KEY_F10);
+ }
+ else if ( (nCode >= KEY_F20) && (nCode <= KEY_F26) )
+ {
+ aName += (sal_Unicode)'F';
+ aName += (sal_Unicode)'2';
+ aName += (sal_Unicode)'0' + (nCode-KEY_F20);
+ }
+ else
+ {
+ String* pName = pSVData->mpKeyNames->Get( GetFullCode() );
+ if ( pName )
+ aName += *pName;
+ }
+ return aName;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+XubString KeyCode::GetSymbolName( const XubString& rFontName, Window* pWindow ) const
+{
+#ifndef REMOTE_APPSERVER
+ if ( !pWindow )
+ pWindow = ImplGetDefaultWindow();
+ return pWindow->ImplGetFrame()->GetSymbolKeyName( rFontName, GetFullCode() );
+#else
+ return GetName( pWindow );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+KeyFuncType KeyCode::GetFunction() const
+{
+ if ( eFunc != KEYFUNC_DONTKNOW )
+ return eFunc;
+
+ USHORT nCompCode = GetModifier() | GetCode();
+ if ( nCompCode )
+ {
+ for ( USHORT i = (USHORT)KEYFUNC_NEW; i < (USHORT)KEYFUNC_FRONT; i++ )
+ {
+ USHORT nKeyCode1;
+ USHORT nKeyCode2;
+ USHORT nKeyCode3;
+ ImplGetKeyCode( (KeyFuncType)i, nKeyCode1, nKeyCode2, nKeyCode3 );
+ if ( (nCompCode == nKeyCode1) || (nCompCode == nKeyCode2) || (nCompCode == nKeyCode3) )
+ return (KeyFuncType)i;
+ }
+ }
+
+ return KEYFUNC_DONTKNOW;
+}
diff --git a/vcl/source/window/makefile.mk b/vcl/source/window/makefile.mk
new file mode 100644
index 000000000000..e65826da0a46
--- /dev/null
+++ b/vcl/source/window/makefile.mk
@@ -0,0 +1,139 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=vcl
+TARGET=win
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/accel.obj \
+ $(SLO)$/accmgr.obj \
+ $(SLO)$/brdwin.obj \
+ $(SLO)$/btndlg.obj \
+ $(SLO)$/cursor.obj \
+ $(SLO)$/dockwin.obj \
+ $(SLO)$/decoview.obj \
+ $(SLO)$/dialog.obj \
+ $(SLO)$/dlgctrl.obj \
+ $(SLO)$/filedlg.obj \
+ $(SLO)$/floatwin.obj \
+ $(SLO)$/keycod.obj \
+ $(SLO)$/menu.obj \
+ $(SLO)$/mnemonic.obj \
+ $(SLO)$/msgbox.obj \
+ $(SLO)$/seleng.obj \
+ $(SLO)$/split.obj \
+ $(SLO)$/splitwin.obj \
+ $(SLO)$/status.obj \
+ $(SLO)$/syschild.obj \
+ $(SLO)$/syswin.obj \
+ $(SLO)$/tabdlg.obj \
+ $(SLO)$/tabpage.obj \
+ $(SLO)$/toolbox.obj \
+ $(SLO)$/toolbox2.obj \
+ $(SLO)$/window.obj \
+ $(SLO)$/window2.obj \
+ $(SLO)$/winproc.obj \
+ $(SLO)$/wrkwin.obj \
+ $(SLO)$/scrwnd.obj
+
+.IF "$(remote)"!=""
+EXCEPTIONSFILES= \
+ $(SLO)$/brdwin.obj \
+ $(SLO)$/keycod.obj \
+ $(SLO)$/window.obj \
+ $(SLO)$/winproc.obj \
+ $(SLO)$/wrkwin.obj \
+ $(SLO)$/accel.obj \
+ $(SLO)$/cursor.obj \
+ $(SLO)$/dlgctrl.obj \
+ $(SLO)$/floatwin.obj \
+ $(SLO)$/menu.obj \
+ $(SLO)$/msgbox.obj \
+ $(SLO)$/split.obj \
+ $(SLO)$/status.obj \
+ $(SLO)$/syschild.obj \
+ $(SLO)$/syswin.obj \
+ $(SLO)$/tabpage.obj \
+ $(SLO)$/toolbox.obj \
+ $(SLO)$/toolbox2.obj \
+ $(SLO)$/dialog.obj
+.ELSE
+EXCEPTIONSFILES= \
+ $(SLO)$/window.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
new file mode 100644
index 000000000000..9df101095121
--- /dev/null
+++ b/vcl/source/window/menu.cxx
@@ -0,0 +1,3444 @@
+/*************************************************************************
+ *
+ * $RCSfile: menu.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_MENU_CXX
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_MNEMONIC_HXX
+#include <mnemonic.hxx>
+#endif
+#ifndef _SV_IMAGE_HXX
+#include <image.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+#ifndef _SV_FLOATWIN_HXX
+#include <floatwin.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_SOUND_HXX
+#include <sound.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_MENU_HXX
+#include <menu.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <button.hxx>
+#endif
+#ifndef _SV_GRADIENT_HXX
+#include <gradient.hxx>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+
+#ifndef _ISOLANG_HXX
+#include <tools/isolang.hxx>
+#endif
+
+#pragma hdrstop
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCHARACTERCLASSIFICATION_HPP_
+#include <com/sun/star/lang/XCharacterClassification.hpp>
+#endif
+
+#include <unohelp.hxx>
+
+using namespace ::com::sun::star;
+
+DBG_NAME( Menu );
+
+#define ITEMPOS_INVALID 0xFFFF
+
+#define EXTRASPACEY 2
+#define EXTRAITEMHEIGHT 4
+
+DropEvent ImplTranslateDropEvent( const DropEvent& rE, Window* pSource, Window* pDest )
+{
+ Point aPos = pSource->OutputToScreenPixel( rE.GetPosPixel() );
+ aPos = pDest->ScreenToOutputPixel( aPos );
+ return DropEvent( aPos, rE.GetData(), rE.GetAction(), rE.GetSourceOptions(),
+ rE.GetWindowType(), rE.IsDefaultAction() );
+}
+
+inline BOOL ImplIsMouseFollow()
+{
+ return ( Application::GetSettings().GetMouseSettings().GetFollow() & MOUSE_FOLLOW_MENU ) ? TRUE : FALSE;
+}
+
+
+struct MenuItemData
+{
+ USHORT nId; // SV Id
+ MenuItemType eType; // MenuItem-Type
+ MenuItemBits nBits; // MenuItem-Bits
+ Menu* pSubMenu; // Pointer auf das SubMenu
+ Menu* pAutoSubMenu; // Pointer auf SubMenu aus Resource
+ XubString aText; // Menu-Text
+ XubString aHelpText; // Help-String
+ XubString aCommandStr; // CommandString
+ ULONG nHelpId; // Help-Id
+ Image aImage; // Image
+ KeyCode aAccelKey; // Accelerator-Key
+ BOOL bChecked; // Checked
+ BOOL bEnabled; // Enabled
+ BOOL bIsTemporary; // Temporary inserted ('No selection possible')
+
+ Size aSz; // nur temporaer gueltig
+
+ MenuItemData() {}
+ MenuItemData( const XubString& rStr, const Image& rImage ) :
+ aText( rStr ),
+ aImage( rImage )
+ {}
+ ~MenuItemData() { delete pAutoSubMenu; }
+};
+
+
+class MenuItemList : public List
+{
+ uno::Reference< lang::XCharacterClassification > xCharClass;
+public:
+ MenuItemList() : List( 16, 4 ) {}
+ ~MenuItemList();
+
+ MenuItemData* Insert( USHORT nId, MenuItemType eType, MenuItemBits nBits,
+ const XubString& rStr, const Image& rImage,
+ Menu* pMenu, USHORT nPos );
+ void InsertSeparator( USHORT nPos );
+ void Remove( USHORT nPos );
+
+
+ MenuItemData* GetData( USHORT nSVId, USHORT& rPos ) const;
+ MenuItemData* GetData( USHORT nSVId ) const
+ { USHORT nTemp; return GetData( nSVId, nTemp ); }
+ MenuItemData* GetDataFromPos( ULONG nPos ) const
+ { return (MenuItemData*)List::GetObject( nPos ); }
+
+ MenuItemData* SearchItem( xub_Unicode cSelectChar, USHORT& rPos ) const;
+ uno::Reference< lang::XCharacterClassification > GetCharClass() const;
+};
+
+
+
+MenuItemList::~MenuItemList()
+{
+ for ( ULONG n = Count(); n; )
+ {
+ MenuItemData* pData = GetDataFromPos( --n );
+ delete pData;
+ }
+}
+
+MenuItemData* MenuItemList::Insert( USHORT nId, MenuItemType eType,
+ MenuItemBits nBits,
+ const XubString& rStr, const Image& rImage,
+ Menu* pMenu, USHORT nPos )
+{
+ MenuItemData* pData = new MenuItemData( rStr, rImage );
+ pData->nId = nId;
+ pData->eType = eType;
+ pData->nBits = nBits;
+ pData->pSubMenu = NULL;
+ pData->pAutoSubMenu = NULL;
+ pData->nHelpId = 0;
+ pData->bChecked = FALSE;
+ pData->bEnabled = TRUE;
+ pData->bIsTemporary = FALSE;
+ List::Insert( (void*)pData, nPos );
+ return pData;
+}
+
+void MenuItemList::InsertSeparator( USHORT nPos )
+{
+ MenuItemData* pData = new MenuItemData;
+ pData->nId = 0;
+ pData->eType = MENUITEM_SEPARATOR;
+ pData->nBits = 0;
+ pData->pSubMenu = NULL;
+ pData->pAutoSubMenu = NULL;
+ pData->nHelpId = 0;
+ pData->bChecked = FALSE;
+ pData->bEnabled = TRUE;
+ pData->bIsTemporary = FALSE;
+ List::Insert( (void*)pData, nPos );
+}
+
+void MenuItemList::Remove( USHORT nPos )
+{
+ MenuItemData* pData = (MenuItemData*)List::Remove( (ULONG)nPos );
+ if ( pData )
+ delete pData;
+}
+
+MenuItemData* MenuItemList::GetData( USHORT nSVId, USHORT& rPos ) const
+{
+ rPos = 0;
+ MenuItemData* pData = (MenuItemData*)GetObject( rPos );
+ while ( pData )
+ {
+ if ( pData->nId == nSVId )
+ return pData;
+
+ rPos++;
+ pData = (MenuItemData*)GetObject( rPos );
+ }
+
+ return NULL;
+}
+
+MenuItemData* MenuItemList::SearchItem( xub_Unicode cSelectChar, USHORT& rPos ) const
+{
+ const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale();
+ xub_Unicode cCharCode = GetCharClass()->toUpper( String(cSelectChar), 0, 1, rLocale )[0];
+ for ( rPos = (USHORT)Count(); rPos; )
+ {
+ MenuItemData* pData = GetDataFromPos( --rPos );
+ if ( pData->bEnabled )
+ {
+ USHORT n = pData->aText.Search( '~' );
+ if ( n != STRING_NOTFOUND )
+ {
+ xub_Unicode cCompareChar = pData->aText.GetChar( n+1 );
+ cCompareChar = GetCharClass()->toUpper( String(cCompareChar), 0, 1, rLocale )[0];
+ if ( cCompareChar == cCharCode )
+ return pData;
+ }
+ }
+ }
+
+ return 0;
+}
+
+uno::Reference< lang::XCharacterClassification > MenuItemList::GetCharClass() const
+{
+ if ( !xCharClass.is() )
+ ((MenuItemList*)this)->xCharClass = vcl::unohelper::CreateCharacterClassification();
+ return xCharClass;
+}
+
+
+
+class MenuFloatingWindow : public FloatingWindow
+{
+private:
+ Menu* pMenu;
+ PopupMenu* pActivePopup;
+ Timer aHighlightChangedTimer;
+ Timer aScrollTimer;
+ ULONG nSaveFocusId;
+ long nStartY;
+ USHORT nHighlightedItem; // gehighlightetes/selektiertes Item
+ USHORT nMBDownPos;
+ USHORT nScrollerHeight;
+ USHORT nFirstEntry;
+ USHORT nBorder;
+ BOOL bInExecute;
+
+ BOOL bScrollMenu;
+ BOOL bScrollUp;
+ BOOL bScrollDown;
+
+ DECL_LINK( PopupEnd, FloatingWindow* );
+ DECL_LINK( HighlightChanged, Timer* );
+ DECL_LINK( AutoScroll, Timer* );
+
+ void StateChanged( StateChangedType nType );
+ void DataChanged( const DataChangedEvent& rDCEvt );
+
+protected:
+ Region ImplCalcClipRegion( BOOL bIncludeLogo = TRUE ) const;
+ void ImplInitClipRegion();
+ void ImplDrawScroller( BOOL bUp );
+ void ImplScroll( const Point& rMousePos );
+ void ImplScroll( BOOL bUp );
+ void ImplCursorUpDown( BOOL bUp );
+ void ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDown );
+
+public:
+ MenuFloatingWindow( Menu* pMenu, Window* pParent, WinBits nStyle );
+ ~MenuFloatingWindow();
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvent );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void Resize();
+
+ void SetFocusId( ULONG nId ) { nSaveFocusId = nId; }
+ ULONG GetFocusId() const { return nSaveFocusId; }
+
+ void EnableScrollMenu( BOOL b );
+ BOOL IsScrollMenu() const { return bScrollMenu; }
+ USHORT GetScrollerHeight() const { return nScrollerHeight; }
+
+ void Execute();
+ void StopExecute( ULONG nFocusId = 0 );
+ void EndExecute();
+ void EndExecute( USHORT nSelectId );
+
+ PopupMenu* GetActivePopup() const { return pActivePopup; }
+ void KillActivePopup( PopupMenu* pThisOnly = NULL );
+
+ void HighlightItem( USHORT nPos, BOOL bHighlight );
+ void ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer );
+};
+
+
+// Eine Basicklasse fuer beide (wegen pActivePopup, Timer, ...) waere nett,
+// aber dann musste eine 'Container'-Klasse gemacht werden, da von
+// unterschiedlichen Windows abgeleitet...
+// In den meisten Funktionen muessen dann sowieso Sonderbehandlungen fuer
+// MenuBar, PopupMenu gemacht werden, also doch zwei verschiedene Klassen.
+
+class MenuBarWindow : public Window
+{
+ friend class MenuBar;
+
+private:
+ Menu* pMenu;
+ PopupMenu* pActivePopup;
+ USHORT nHighlightedItem;
+ ULONG nSaveFocusId;
+ BOOL mbAutoPopup;
+
+ PushButton aCloser;
+ PushButton aFloatBtn;
+ PushButton aHideBtn;
+
+ void HighlightItem( USHORT nPos, BOOL bHighlight );
+ void ChangeHighlightItem( USHORT n, BOOL bSelectPopupEntry, BOOL bAllowRestoreFocus = TRUE );
+
+ USHORT ImplFindEntry( const Point& rMousePos ) const;
+ void ImplCreatePopup( BOOL bPreSelectFirst );
+ BOOL ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu = TRUE );
+
+ DECL_LINK( CloserHdl, PushButton* );
+ DECL_LINK( FloatHdl, PushButton* );
+ DECL_LINK( HideHdl, PushButton* );
+
+ void StateChanged( StateChangedType nType );
+ void DataChanged( const DataChangedEvent& rDCEvt );
+ void LoseFocus();
+
+public:
+ MenuBarWindow( Window* pParent );
+ ~MenuBarWindow();
+
+ void ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide );
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvent );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Resize();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual BOOL QueryDrop( DropEvent& rDEvt );
+ virtual BOOL Drop( const DropEvent& rDEvt );
+
+ void SetFocusId( ULONG nId ) { nSaveFocusId = nId; }
+ ULONG GetFocusId() const { return nSaveFocusId; }
+
+ void SetMenu( MenuBar* pMenu );
+ void KillActivePopup();
+ PopupMenu* GetActivePopup() const { return pActivePopup; }
+ void PopupClosed( Menu* pMenu );
+};
+
+
+
+static void ImplSetMenuItemData( MenuItemData* pData, USHORT nPos )
+{
+ // Daten umsetzen
+ if ( !pData->aImage )
+ pData->eType = MENUITEM_STRING;
+ else if ( !pData->aText.Len() )
+ pData->eType = MENUITEM_IMAGE;
+ else
+ pData->eType = MENUITEM_STRINGIMAGE;
+}
+
+static BOOL ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, USHORT nHighlightedItem, const HelpEvent& rHEvt )
+{
+ BOOL bDone = FALSE;
+ USHORT nId = 0;
+ if ( nHighlightedItem != ITEMPOS_INVALID )
+ {
+ MenuItemData* pItemData = pMenu->GetItemList()->GetDataFromPos( nHighlightedItem );
+ if ( pItemData )
+ nId = pItemData->nId;
+ }
+
+ if ( ( rHEvt.GetMode() & HELPMODE_BALLOON ) && pMenuWindow )
+ {
+ Point aPos = rHEvt.GetMousePosPixel();
+ // Pos etwas nach unter-rechts korrigieren, wegen Pointer
+ aPos.X() += 15;
+// aPos.Y() += 20;
+ Help::ShowBalloon( pMenuWindow, aPos, pMenu->GetHelpText( nId ) );
+ bDone = TRUE;
+ }
+ else if ( rHEvt.GetMode() & (HELPMODE_CONTEXT | HELPMODE_EXTENDED) )
+ {
+ // Ist eine Hilfe in die Applikation selektiert
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ {
+ // Ist eine ID vorhanden, dann Hilfe mit der ID aufrufen, sonst
+ // den Hilfe-Index
+ ULONG nHelpId = pMenu->GetHelpId( nId );
+ if ( nHelpId )
+ pHelp->Start( nHelpId );
+ else
+ pHelp->Start( HELP_INDEX );
+ }
+ bDone = TRUE;
+ }
+ return bDone;
+}
+
+
+Menu::Menu()
+{
+ DBG_CTOR( Menu, NULL );
+ ImplInit();
+}
+
+Menu::~Menu()
+{
+ DBG_DTOR( Menu, NULL );
+
+ if ( nEventId )
+ Application::RemoveUserEvent( nEventId );
+
+ bKilled = TRUE;
+
+ delete pItemList;
+ delete pLogo;
+}
+
+void Menu::ImplInit()
+{
+ nMenuFlags = 0;
+ nDefaultItem = 0;
+ bIsMenuBar = FALSE;
+ nSelectedId = 0;
+ pItemList = new MenuItemList;
+ pLogo = NULL;
+ pStartedFrom = NULL;
+ pWindow = NULL;
+ nEventId = 0;
+ bCanceled = FALSE;
+ bInCallback = FALSE;
+ bKilled = FALSE;
+}
+
+void Menu::ImplLoadRes( const ResId& rResId )
+{
+ rResId.SetRT( RSC_MENU );
+ GetRes( rResId );
+
+ USHORT nObjMask = ReadShortRes();
+
+ if( nObjMask & RSC_MENU_ITEMS )
+ {
+ USHORT nObjFollows = ReadShortRes();
+ // MenuItems einfuegen
+ for( USHORT i = 0; i < nObjFollows; i++ )
+ {
+ InsertItem( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+ }
+
+ if( nObjMask & RSC_MENU_TEXT )
+ {
+ if( bIsMenuBar ) // Kein Titel im Menubar
+ ReadStringRes();
+ else
+ aTitleText = ReadStringRes();
+ }
+ if( nObjMask & RSC_MENU_DEFAULTITEMID )
+ SetDefaultItem( ReadShortRes() );
+}
+
+void Menu::Activate()
+{
+ bInCallback = TRUE;
+ if ( !aActivateHdl.Call( this ) )
+ {
+ Menu* pStartMenu = ImplGetStartMenu();
+ if ( pStartMenu && ( pStartMenu != this ) )
+ {
+ pStartMenu->bInCallback = TRUE;
+ pStartMenu->aActivateHdl.Call( this );
+ pStartMenu->bInCallback = FALSE;
+ }
+ }
+ bInCallback = FALSE;
+}
+
+void Menu::Deactivate()
+{
+ for ( USHORT n = pItemList->Count(); n; )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( --n );
+ if ( pData->bIsTemporary )
+ pItemList->Remove( n );
+ }
+
+ bInCallback = TRUE;
+ Menu* pStartMenu = ImplGetStartMenu();
+ if ( !aDeactivateHdl.Call( this ) )
+ {
+ if ( pStartMenu && ( pStartMenu != this ) )
+ {
+ pStartMenu->bInCallback = TRUE;
+ pStartMenu->aDeactivateHdl.Call( this );
+ pStartMenu->bInCallback = FALSE;
+ }
+ }
+ bInCallback = FALSE;
+
+ if ( this == pStartMenu )
+ GetpApp()->HideHelpStatusText();
+}
+
+void Menu::Highlight()
+{
+ Menu* pStartMenu = ImplGetStartMenu();
+ if ( !aHighlightHdl.Call( this ) )
+ {
+ if ( pStartMenu && ( pStartMenu != this ) )
+ pStartMenu->aHighlightHdl.Call( this );
+ }
+
+ if ( GetCurItemId() )
+ GetpApp()->ShowHelpStatusText( GetHelpText( GetCurItemId() ) );
+}
+
+void Menu::ImplSelect()
+{
+ MenuItemData* pData = GetItemList()->GetData( nSelectedId );
+ if ( pData && (pData->nBits & MIB_AUTOCHECK) )
+ {
+ BOOL bChecked = IsItemChecked( nSelectedId );
+ if ( pData->nBits & MIB_RADIOCHECK )
+ {
+ if ( !bChecked )
+ CheckItem( nSelectedId, TRUE );
+ }
+ else
+ CheckItem( nSelectedId, !bChecked );
+ }
+
+ // Select rufen
+ ImplSVData* pSVData = ImplGetSVData();
+ pSVData->maAppData.mpActivePopupMenu = NULL; // Falls neues Execute im Select()
+ Application::PostUserEvent( nEventId, LINK( this, Menu, ImplCallSelect ) );
+}
+
+void Menu::Select()
+{
+ if ( !aSelectHdl.Call( this ) )
+ {
+ Menu* pStartMenu = ImplGetStartMenu();
+ if ( pStartMenu && ( pStartMenu != this ) )
+ {
+ pStartMenu->nSelectedId = nSelectedId;
+ pStartMenu->aSelectHdl.Call( this );
+ }
+ }
+}
+
+void Menu::RequestHelp( const HelpEvent& rHEvt )
+{
+}
+
+void Menu::InsertItem( USHORT nItemId, const XubString& rStr, MenuItemBits nItemBits, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "Menu::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == MENU_ITEM_NOTFOUND,
+ "Menu::InsertItem(): ItemId already exists" );
+
+ // Falls Position > ItemCount, dann anheangen
+ if ( nPos >= (USHORT)pItemList->Count() )
+ nPos = MENU_APPEND;
+
+ // Item in die MenuItemListe aufnehmen
+ MenuItemData* pData = pItemList->Insert( nItemId, MENUITEM_STRING,
+ nItemBits, rStr, Image(), this, nPos );
+
+ Window* pWin = ImplGetWindow();
+ if ( pWin )
+ {
+ ImplCalcSize( pWin );
+ if ( pWin->IsVisible() )
+ pWin->Invalidate();
+ }
+}
+
+void Menu::InsertItem( USHORT nItemId, const Image& rImage,
+ MenuItemBits nItemBits, USHORT nPos )
+{
+ InsertItem( nItemId, ImplGetSVEmptyStr(), nItemBits, nPos );
+ SetItemImage( nItemId, rImage );
+}
+
+void Menu::InsertItem( USHORT nItemId,
+ const XubString& rStr, const Image& rImage,
+ MenuItemBits nItemBits, USHORT nPos )
+{
+ InsertItem( nItemId, rStr, nItemBits, nPos );
+ SetItemImage( nItemId, rImage );
+}
+
+void Menu::InsertItem( const ResId& rResId, USHORT nPos )
+{
+ USHORT nObjMask;
+
+ GetRes( rResId.SetRT( RSC_MENUITEM ) );
+ nObjMask = ReadShortRes();
+
+ BOOL bSep = FALSE;
+ if ( nObjMask & RSC_MENUITEM_SEPARATOR )
+ bSep = (BOOL)ReadShortRes();
+
+ USHORT nItemId = 1;
+ if ( nObjMask & RSC_MENUITEM_ID )
+ nItemId = ReadShortRes();
+
+ USHORT nStatus = 0;
+ if ( nObjMask & RSC_MENUITEM_STATUS )
+ nStatus = ReadShortRes();
+
+ String aText;
+ if ( nObjMask & RSC_MENUITEM_TEXT )
+ aText = ReadStringRes();
+
+ // Item erzeugen
+ if ( nObjMask & RSC_MENUITEM_BITMAP )
+ {
+ if ( !bSep )
+ {
+ Bitmap aBmp( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ if ( aText.Len() )
+ InsertItem( nItemId, aText, aBmp, nStatus, nPos );
+ else
+ InsertItem( nItemId, aBmp, nStatus, nPos );
+ }
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+ else if ( !bSep )
+ InsertItem( nItemId, aText, nStatus, nPos );
+ if ( bSep )
+ InsertSeparator( nPos );
+
+ String aHelpText;
+ if ( nObjMask & RSC_MENUITEM_HELPTEXT )
+ {
+ aHelpText = ReadStringRes();
+ if( !bSep )
+ SetHelpText( nItemId, aHelpText );
+ }
+
+ ULONG nHelpId = 0;
+ if ( nObjMask & RSC_MENUITEM_HELPID )
+ {
+ nHelpId = ReadLongRes();
+ if ( !bSep )
+ SetHelpId( nItemId, nHelpId );
+ }
+
+ if( !bSep /* && SvHelpSettings::HelpText( aHelpText, nHelpId ) */ )
+ SetHelpText( nItemId, aHelpText );
+
+ if ( nObjMask & RSC_MENUITEM_KEYCODE )
+ {
+ if ( !bSep )
+ SetAccelKey( nItemId, KeyCode( ResId( (RSHEADER_TYPE*)GetClassRes() ) ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+ if( nObjMask & RSC_MENUITEM_CHECKED )
+ {
+ if ( !bSep )
+ CheckItem( nItemId, (BOOL)ReadShortRes() );
+ }
+ if ( nObjMask & RSC_MENUITEM_DISABLE )
+ {
+ if ( !bSep )
+ EnableItem( nItemId, !(BOOL)ReadShortRes() );
+ }
+ if ( nObjMask & RSC_MENUITEM_COMMAND )
+ {
+ String aCommandStr = ReadStringRes();
+ if ( !bSep )
+ SetItemCommand( nItemId, aCommandStr );
+ }
+ if ( nObjMask & RSC_MENUITEM_MENU )
+ {
+ if ( !bSep )
+ {
+ MenuItemData* pData = GetItemList()->GetData( nItemId );
+ if ( pData )
+ {
+ PopupMenu* pSubMenu = new PopupMenu( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ pData->pAutoSubMenu = pSubMenu;
+ SetPopupMenu( nItemId, pSubMenu );
+ }
+ }
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+}
+
+void Menu::InsertSeparator( USHORT nPos )
+{
+ // Handelt es sich um einen MenuBar, dann mache nichts
+ if ( bIsMenuBar )
+ return;
+
+ // Falls Position > ItemCount, dann anheangen
+ if ( nPos >= (USHORT)pItemList->Count() )
+ nPos = MENU_APPEND;
+
+ // Separator in die Item-Liste einfuegen
+ pItemList->InsertSeparator( nPos );
+}
+
+void Menu::RemoveItem( USHORT nPos )
+{
+ if ( nPos < GetItemCount() )
+ pItemList->Remove( nPos );
+
+ Window* pWin = ImplGetWindow();
+ if ( pWin )
+ {
+ ImplCalcSize( pWin );
+ if ( pWin->IsVisible() )
+ pWin->Invalidate();
+ }
+}
+
+void ImplCopyItem( Menu* pThis, const Menu& rMenu, USHORT nPos, USHORT nNewPos,
+ USHORT nMode = 0 )
+{
+ MenuItemType eType = rMenu.GetItemType( nPos );
+
+ if ( eType == MENUITEM_DONTKNOW )
+ return;
+
+ if ( eType == MENUITEM_SEPARATOR )
+ pThis->InsertSeparator( nNewPos );
+ else
+ {
+ USHORT nId = rMenu.GetItemId( nPos );
+
+ DBG_ASSERT( pThis->GetItemPos( nId ) == MENU_ITEM_NOTFOUND,
+ "Menu::CopyItem(): ItemId already exists" );
+
+ MenuItemData* pData = rMenu.GetItemList()->GetData( nId );
+
+ if ( eType == MENUITEM_STRINGIMAGE )
+ pThis->InsertItem( nId, pData->aText, pData->aImage, pData->nBits, nNewPos );
+ else if ( eType == MENUITEM_STRING )
+ pThis->InsertItem( nId, pData->aText, pData->nBits, nNewPos );
+ else
+ pThis->InsertItem( nId, pData->aImage, pData->nBits, nNewPos );
+
+ if ( rMenu.IsItemChecked( nId ) )
+ pThis->CheckItem( nId, TRUE );
+ if ( !rMenu.IsItemEnabled( nId ) )
+ pThis->EnableItem( nId, FALSE );
+ pThis->SetHelpId( nId, pData->nHelpId );
+ pThis->SetHelpText( nId, pData->aHelpText );
+ pThis->SetAccelKey( nId, pData->aAccelKey );
+
+ PopupMenu* pSubMenu = rMenu.GetPopupMenu( nId );
+ if ( pSubMenu )
+ {
+ // AutoKopie anlegen
+ if ( nMode == 1 )
+ {
+ PopupMenu* pNewMenu = new PopupMenu( *pSubMenu );
+ pThis->SetPopupMenu( nId, pNewMenu );
+// SetAutoMenu( pThis, nId, pNewMenu );
+ }
+ else
+ pThis->SetPopupMenu( nId, pSubMenu );
+ }
+ }
+}
+
+void Menu::CopyItem( const Menu& rMenu, USHORT nPos, USHORT nNewPos )
+{
+ ImplCopyItem( this, rMenu, nPos, nNewPos );
+}
+
+void Menu::Clear()
+{
+ for ( USHORT i = GetItemCount(); i; i-- )
+ RemoveItem( 0 );
+}
+
+USHORT Menu::GetItemCount() const
+{
+ return (USHORT)pItemList->Count();
+}
+
+USHORT Menu::ImplGetVisibleItemCount() const
+{
+ USHORT nItems = 0;
+ for ( USHORT n = (USHORT)pItemList->Count(); n; )
+ {
+ if ( ImplIsVisible( --n ) )
+ nItems++;
+ }
+ return nItems;
+}
+
+USHORT Menu::GetItemId( USHORT nPos ) const
+{
+ MenuItemData* pData = pItemList->GetDataFromPos( nPos );
+
+ if ( pData )
+ return pData->nId;
+ else
+ return 0;
+}
+
+USHORT Menu::GetItemPos( USHORT nItemId ) const
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( pData )
+ return nPos;
+ else
+ return MENU_ITEM_NOTFOUND;
+}
+
+MenuItemType Menu::GetItemType( USHORT nPos ) const
+{
+ MenuItemData* pData = pItemList->GetDataFromPos( nPos );
+
+ if ( pData )
+ return pData->eType;
+ else
+ return MENUITEM_DONTKNOW;
+}
+
+USHORT Menu::GetCurItemId() const
+{
+ return nSelectedId;
+}
+
+void Menu::SetItemBits( USHORT nItemId, MenuItemBits nBits )
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+ if ( pData )
+ pData->nBits = nBits;
+}
+
+MenuItemBits Menu::GetItemBits( USHORT nItemId ) const
+{
+ MenuItemBits nBits = 0;
+ MenuItemData* pData = pItemList->GetData( nItemId );
+ if ( pData )
+ nBits = pData->nBits;
+ return nBits;
+}
+
+void Menu::SetPopupMenu( USHORT nItemId, PopupMenu* pMenu )
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ // Item nicht vorhanden, dann NULL zurueckgeben
+ if ( !pData )
+ return;
+
+ // Gleiches Menu, danmn brauchen wir nichts machen
+ if ( (PopupMenu*)pData->pSubMenu == pMenu )
+ return;
+
+ // Daten austauschen
+ pData->pSubMenu = pMenu;
+}
+
+PopupMenu* Menu::GetPopupMenu( USHORT nItemId ) const
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ return (PopupMenu*)(pData->pSubMenu);
+ else
+ return NULL;
+}
+
+void Menu::SetAccelKey( USHORT nItemId, const KeyCode& rKeyCode )
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( !pData )
+ return;
+
+ if ( pData->aAccelKey == rKeyCode )
+ return;
+
+ pData->aAccelKey = rKeyCode;
+}
+
+KeyCode Menu::GetAccelKey( USHORT nItemId ) const
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ return pData->aAccelKey;
+ else
+ return KeyCode();
+}
+
+void Menu::CheckItem( USHORT nItemId, BOOL bCheck )
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( !pData )
+ return;
+
+ // Wenn RadioCheck, dann vorherigen unchecken
+ if ( bCheck && (pData->nBits & MIB_AUTOCHECK) &&
+ (pData->nBits & MIB_RADIOCHECK) )
+ {
+ MenuItemData* pGroupData;
+ USHORT nGroupPos;
+ USHORT nItemCount = GetItemCount();
+ BOOL bFound = FALSE;
+
+ nGroupPos = nPos;
+ while ( nGroupPos )
+ {
+ pGroupData = pItemList->GetDataFromPos( nGroupPos-1 );
+ if ( pGroupData->nBits & MIB_RADIOCHECK )
+ {
+ if ( IsItemChecked( pGroupData->nId ) )
+ {
+ CheckItem( pGroupData->nId, FALSE );
+ bFound = TRUE;
+ break;
+ }
+ }
+ else
+ break;
+ nGroupPos--;
+ }
+
+ if ( !bFound )
+ {
+ nGroupPos = nPos+1;
+ while ( nGroupPos < nItemCount )
+ {
+ pGroupData = pItemList->GetDataFromPos( nGroupPos );
+ if ( pGroupData->nBits & MIB_RADIOCHECK )
+ {
+ if ( IsItemChecked( pGroupData->nId ) )
+ {
+ CheckItem( pGroupData->nId, FALSE );
+ break;
+ }
+ }
+ else
+ break;
+ nGroupPos++;
+ }
+ }
+ }
+
+ pData->bChecked = bCheck;
+}
+
+BOOL Menu::IsItemChecked( USHORT nItemId ) const
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( !pData )
+ return FALSE;
+
+ return pData->bChecked;
+}
+
+void Menu::EnableItem( USHORT nItemId, BOOL bEnable )
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( pData && ( pData->bEnabled != bEnable ) )
+ {
+ pData->bEnabled = bEnable;
+
+ Window* pWin = ImplGetWindow();
+ if ( pWin && pWin->IsVisible() )
+ {
+ DBG_ASSERT( bIsMenuBar, "Menu::EnableItem - Popup visible!" );
+ long nX = 0;
+ ULONG nCount = pItemList->Count();
+ for ( ULONG n = 0; n < nCount; n++ )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( n );
+ if ( n == nPos )
+ {
+ pWin->Invalidate( Rectangle( Point( nX, 0 ), Size( pData->aSz.Width(), pData->aSz.Height() ) ) );
+ break;
+ }
+ nX += pData->aSz.Width();
+ }
+ }
+ }
+}
+
+BOOL Menu::IsItemEnabled( USHORT nItemId ) const
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( !pData )
+ return FALSE;
+
+ return pData->bEnabled;
+}
+
+void Menu::SetItemText( USHORT nItemId, const XubString& rStr )
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( !pData )
+ return;
+
+ pData->aText = rStr;
+ ImplSetMenuItemData( pData, nPos );
+}
+
+XubString Menu::GetItemText( USHORT nItemId ) const
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( pData )
+ return pData->aText;
+ else
+ return ImplGetSVEmptyStr();
+}
+
+void Menu::SetItemImage( USHORT nItemId, const Image& rImage )
+{
+ USHORT nPos;
+ MenuItemData* pData = pItemList->GetData( nItemId, nPos );
+
+ if ( !pData )
+ return;
+
+ pData->aImage = rImage;
+ ImplSetMenuItemData( pData, nPos );
+}
+
+Image Menu::GetItemImage( USHORT nItemId ) const
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ return pData->aImage;
+ else
+ return Image();
+}
+
+void Menu::SetItemCommand( USHORT nItemId, const String& rCommand )
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ pData->aCommandStr = rCommand;
+}
+
+const XubString& Menu::GetItemCommand( USHORT nItemId ) const
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ return pData->aCommandStr;
+ else
+ return ImplGetSVEmptyStr();
+}
+
+void Menu::SetHelpText( USHORT nItemId, const XubString& rStr )
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ pData->aHelpText = rStr;
+}
+
+const XubString& Menu::GetHelpText( USHORT nItemId ) const
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ {
+ if ( !pData->aHelpText.Len() && pData->nHelpId )
+ {
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pData->aHelpText = pHelp->GetHelpText( pData->nHelpId );
+ }
+
+ return pData->aHelpText;
+ }
+ else
+ return ImplGetSVEmptyStr();
+}
+
+void Menu::SetHelpId( USHORT nItemId, ULONG nHelpId )
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ pData->nHelpId = nHelpId;
+}
+
+ULONG Menu::GetHelpId( USHORT nItemId ) const
+{
+ MenuItemData* pData = pItemList->GetData( nItemId );
+
+ if ( pData )
+ return pData->nHelpId;
+ else
+ return 0;
+}
+
+Menu& Menu::operator=( const Menu& rMenu )
+{
+ // Aufraeumen
+ Clear();
+
+ // Items kopieren
+ USHORT nCount = rMenu.GetItemCount();
+ for ( USHORT i = 0; i < nCount; i++ )
+ ImplCopyItem( this, rMenu, i, MENU_APPEND, 1 );
+
+ nDefaultItem = rMenu.nDefaultItem;
+ aActivateHdl = rMenu.aActivateHdl;
+ aDeactivateHdl = rMenu.aDeactivateHdl;
+ aHighlightHdl = rMenu.aHighlightHdl;
+ aSelectHdl = rMenu.aSelectHdl;
+ aTitleText = rMenu.aTitleText;
+ bIsMenuBar = rMenu.bIsMenuBar;
+
+ return *this;
+}
+
+BOOL Menu::ImplIsVisible( USHORT nPos ) const
+{
+ BOOL bVisible = TRUE;
+
+ // Fuer den Menubar nicht erlaubt, weil ich nicht mitbekomme
+ // ob dadurch ein Eintrag verschwindet oder wieder da ist.
+ if ( !bIsMenuBar && ( nMenuFlags & MENU_FLAG_HIDEDISABLEDENTRIES ) )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( nPos );
+ if ( pData->eType != MENUITEM_SEPARATOR )
+ {
+ // bVisible = pData->bEnabled && ( !pData->pSubMenu || pData->pSubMenu->HasValidEntries( TRUE ) );
+ bVisible = pData->bEnabled; // SubMenus nicht pruefen, weil sie ggf. erst im Activate() gefuellt werden.
+ }
+ else
+ {
+ // Ein Separator ist nur dann visible, wenn davor sichtbare Eintraege stehen.
+ USHORT nCount = (USHORT) pItemList->Count();
+ USHORT n;
+ BOOL bPrevVisible = FALSE;
+ BOOL bNextVisible = FALSE;
+ for ( n = nPos; !bPrevVisible && n; )
+ {
+ pData = pItemList->GetDataFromPos( --n );
+ if ( pData->eType != MENUITEM_SEPARATOR )
+ bPrevVisible = pData->bEnabled; // && ( !pData->pSubMenu || pData->pSubMenu->HasValidEntries( TRUE ) );
+ else
+ break;
+ }
+ if ( bPrevVisible )
+ {
+ for ( n = nPos+1; !bNextVisible && ( n < nCount ); n++ )
+ {
+ pData = pItemList->GetDataFromPos( n );
+ if ( pData->eType != MENUITEM_SEPARATOR )
+ bNextVisible = pData->bEnabled; // && ( !pData->pSubMenu || pData->pSubMenu->HasValidEntries( TRUE ) );
+ // nicht beim naechsten Separator abbrechen...
+ }
+ }
+ bVisible = bPrevVisible && bNextVisible;
+ }
+ }
+
+ return bVisible;
+}
+
+Size Menu::ImplCalcSize( Window* pWin )
+{
+ // | Checked| Image| Text| Accel/Popup|
+
+ // Fuer Symbole: nFontHeight x nFontHeight
+ long nFontHeight = pWin->GetTextHeight();
+ long nExtra = nFontHeight/4;
+
+ Size aSz;
+ Size aMaxImgSz;
+ long nMaxTextWidth = 0;
+ long nMaxAccWidth = 0;
+
+ for ( USHORT n = (USHORT)pItemList->Count(); n; )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( --n );
+
+ pData->aSz.Height() = 0;
+ pData->aSz.Width() = 0;
+
+ if ( ImplIsVisible( n ) )
+ {
+
+ // Separator
+ if ( !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) )
+ {
+ DBG_ASSERT( !bIsMenuBar, "Separator in MenuBar ?! " );
+ pData->aSz.Height() = 4;
+ }
+
+ // Image:
+ if ( !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
+ {
+ Size aImgSz = pData->aImage.GetSizePixel();
+ if ( aImgSz.Width() > aMaxImgSz.Width() )
+ aMaxImgSz.Width() = aImgSz.Width();
+ if ( aImgSz.Height() > aMaxImgSz.Height() )
+ aMaxImgSz.Height() = aImgSz.Height();
+ if ( aImgSz.Height() > pData->aSz.Height() )
+ pData->aSz.Height() = aImgSz.Height();
+ }
+
+ // Text:
+ if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) )
+ {
+ long nTextWidth = pWin->GetCtrlTextWidth( pData->aText );
+ if ( nTextWidth > nMaxTextWidth )
+ nMaxTextWidth = nTextWidth;
+ long nTextHeight = pWin->GetTextHeight();
+ if ( nTextHeight > pData->aSz.Height() )
+ pData->aSz.Height() = nTextHeight;
+
+ if ( bIsMenuBar )
+ {
+ pData->aSz.Width() = nTextWidth + 4*nExtra;
+ aSz.Width() += pData->aSz.Width();
+ }
+ }
+
+ // Accel
+ if ( !bIsMenuBar && pData->aAccelKey.GetCode() )
+ {
+ String aName = pData->aAccelKey.GetName();
+ long nAccWidth = pWin->GetTextWidth( aName );
+ nAccWidth += nExtra;
+ if ( nAccWidth > nMaxAccWidth )
+ nMaxAccWidth = nAccWidth;
+ }
+
+ // SubMenu?
+ if ( !bIsMenuBar && pData->pSubMenu )
+ {
+ if ( nFontHeight > nMaxAccWidth )
+ nMaxAccWidth = nFontHeight;
+ if ( nFontHeight > pData->aSz.Height() )
+ pData->aSz.Height() = nFontHeight;
+ }
+
+ pData->aSz.Height() += EXTRAITEMHEIGHT; // Etwas mehr Abstand:
+
+ if ( !bIsMenuBar )
+ aSz.Height() += (long)pData->aSz.Height();
+ }
+ }
+
+ if ( !bIsMenuBar )
+ {
+ nCheckPos = (USHORT)nExtra;
+ nImagePos = (USHORT)(nCheckPos + nFontHeight/2 + nExtra );
+ nTextPos = (USHORT)(nImagePos+aMaxImgSz.Width());
+ if ( aMaxImgSz.Width() )
+ nTextPos += (USHORT)nExtra;
+
+ aSz.Width() = nTextPos + nMaxTextWidth + nExtra + nMaxAccWidth;
+ aSz.Width() += 10*nExtra; // etwas mehr...
+ }
+ else
+ {
+ nTextPos = (USHORT)(2*nExtra);
+ aSz.Height() = nFontHeight+6;
+ }
+
+ if ( pLogo )
+ aSz.Width() += pLogo->aBitmap.GetSizePixel().Width();
+
+ return aSz;
+}
+
+void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pThisItemOnly, BOOL bHighlighted )
+{
+ // Fuer Symbole: nFontHeight x nFontHeight
+ long nFontHeight = pWin->GetTextHeight();
+ long nExtra = nFontHeight/4;
+
+ DecorationView aDecoView( pWin );
+ const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings();
+
+ Point aTopLeft, aTmpPos;
+
+ if ( pLogo )
+ aTopLeft.X() = pLogo->aBitmap.GetSizePixel().Width();
+
+ Size aOutSz = pWin->GetOutputSizePixel();
+ long nMaxY = aOutSz.Height() - nBorder;
+ USHORT nCount = (USHORT)pItemList->Count();
+ for ( USHORT n = 0; n < nCount; n++ )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( n );
+ if ( ImplIsVisible( n ) && ( !pThisItemOnly || ( pData == pThisItemOnly ) ) )
+ {
+ if ( pThisItemOnly && bHighlighted )
+ pWin->SetTextColor( rSettings.GetMenuHighlightTextColor() );
+
+ Point aPos( aTopLeft );
+ aPos.Y() += nBorder;
+ aPos.Y() += nStartY;
+
+ if ( aPos.Y() >= 0 )
+ {
+ long nTextOffsetY = ((pData->aSz.Height()-nFontHeight)/2);
+ USHORT nTextStyle = 0;
+ USHORT nSymbolStyle = 0;
+ USHORT nImageStyle = 0;
+ // SubMenus ohne Items werden nicht mehr disablte dargestellt,
+ // wenn keine Items enthalten sind, da die Anwendung selber
+ // darauf achten muss. Ansonsten gibt es Faelle, wo beim
+ // asyncronen laden die Eintraege disablte dargestellt werden.
+ if ( !pData->bEnabled )
+ {
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ nSymbolStyle |= SYMBOL_DRAW_DISABLE;
+ nImageStyle |= IMAGE_DRAW_DISABLE;
+ }
+
+ // Separator
+ if ( !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) )
+ {
+ aTmpPos.Y() = aPos.Y() + ((pData->aSz.Height()-2)/2);
+ aTmpPos.X() = aPos.X() + 1;
+ pWin->SetLineColor( rSettings.GetShadowColor() );
+ pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 1, aTmpPos.Y() ) );
+ aTmpPos.Y()++;
+ pWin->SetLineColor( rSettings.GetLightColor() );
+ pWin->DrawLine( aTmpPos, Point( aOutSz.Width() - 1, aTmpPos.Y() ) );
+ pWin->SetLineColor();
+ }
+
+ // Image:
+ if ( !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
+ {
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.X() = aPos.X() + nImagePos;
+ aTmpPos.Y() += (pData->aSz.Height()-pData->aImage.GetSizePixel().Height())/2;
+ pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle );
+ }
+
+ // Text:
+ if ( ( pData->eType == MENUITEM_STRING ) || ( pData->eType == MENUITEM_STRINGIMAGE ) )
+ {
+ aTmpPos.X() = aPos.X() + nTextPos;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nTextOffsetY;
+ USHORT nStyle = nTextStyle|TEXT_DRAW_MNEMONIC;
+ if ( pData->bIsTemporary )
+ nStyle |= TEXT_DRAW_DISABLE;
+ pWin->DrawCtrlText( aTmpPos, pData->aText, 0, pData->aText.Len(), nStyle );
+ }
+
+ // Accel
+ if ( !bIsMenuBar && pData->aAccelKey.GetCode() )
+ {
+ XubString aAccText = pData->aAccelKey.GetName();
+ aTmpPos.X() = aOutSz.Width() - pWin->GetTextWidth( aAccText );
+ aTmpPos.X() -= 3*nExtra;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nTextOffsetY;
+ pWin->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle );
+ }
+
+ // CheckMark
+ if ( !bIsMenuBar && pData->bChecked )
+ {
+ Rectangle aRect;
+ SymbolType eSymbol;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nExtra/2;
+ aTmpPos.Y() += pData->aSz.Height() / 2;
+ if ( pData->nBits & MIB_RADIOCHECK )
+ {
+ aTmpPos.X() = aPos.X() + nCheckPos;
+ eSymbol = SYMBOL_RADIOCHECKMARK;
+ aTmpPos.Y() -= nFontHeight/4;
+ aRect = Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) );
+ }
+ else
+ {
+ aTmpPos.X() = aPos.X() + nCheckPos;
+ eSymbol = SYMBOL_CHECKMARK;
+ aTmpPos.Y() -= nFontHeight/4;
+ aRect = Rectangle( aTmpPos, Size( (nFontHeight*25)/40, nFontHeight/2 ) );
+ }
+ aDecoView.DrawSymbol( aRect, eSymbol, pWin->GetTextColor(), nSymbolStyle );
+ }
+
+ // SubMenu?
+ if ( !bIsMenuBar && pData->pSubMenu )
+ {
+ aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra;
+ aTmpPos.Y() = aPos.Y();
+ aTmpPos.Y() += nExtra/2;
+ aTmpPos.Y() += ( pData->aSz.Height() / 2 ) - ( nFontHeight/4 );
+ if ( pData->nBits & MIB_POPUPSELECT )
+ {
+ pWin->SetTextColor( rSettings.GetMenuTextColor() );
+ Point aTmpPos2( aPos );
+ aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4;
+ aDecoView.DrawFrame(
+ Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pData->aSz.Height() ) ), FRAME_DRAW_GROUP );
+ }
+ aDecoView.DrawSymbol(
+ Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ),
+ SYMBOL_SPIN_RIGHT, pWin->GetTextColor(), nSymbolStyle );
+// if ( pData->nBits & MIB_POPUPSELECT )
+// {
+// aTmpPos.Y() += nFontHeight/2 ;
+// pWin->SetLineColor( rSettings.GetShadowColor() );
+// pWin->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) );
+// pWin->SetLineColor( rSettings.GetLightColor() );
+// aTmpPos.Y()++;
+// pWin->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) );
+// pWin->SetLineColor();
+// }
+ }
+
+ if ( pThisItemOnly && bHighlighted )
+ pWin->SetTextColor( rSettings.GetMenuTextColor() );
+ }
+ }
+
+ if ( !bIsMenuBar )
+ {
+ aTopLeft.Y() += pData->aSz.Height();
+ }
+ else
+ {
+ aTopLeft.X() += pData->aSz.Width();
+ }
+ }
+
+ if ( !pThisItemOnly && pLogo )
+ {
+ Size aLogoSz = pLogo->aBitmap.GetSizePixel();
+
+ Rectangle aRect( Point( 0, 0 ), Point( aLogoSz.Width()-1, aOutSz.Height() ) );
+ if ( pWin->GetColorCount() >= 256 )
+ {
+ Gradient aGrad( GRADIENT_LINEAR, pLogo->aStartColor, pLogo->aEndColor );
+ aGrad.SetAngle( 1800 );
+ aGrad.SetBorder( 15 );
+ pWin->DrawGradient( aRect, aGrad );
+ }
+ else
+ {
+ pWin->SetFillColor( pLogo->aStartColor );
+ pWin->DrawRect( aRect );
+ }
+
+ Point aLogoPos( 0, aOutSz.Height() - aLogoSz.Height() );
+ pLogo->aBitmap.Draw( pWin, aLogoPos );
+ }
+}
+
+Menu* Menu::ImplGetStartMenu()
+{
+ Menu* pStart = this;
+ while ( pStart && pStart->pStartedFrom && ( pStart->pStartedFrom != pStart ) )
+ pStart = pStart->pStartedFrom;
+ return pStart;
+}
+
+void Menu::ImplCallHighlight( USHORT nHighlightedItem )
+{
+ nSelectedId = 0;
+ MenuItemData* pData = pItemList->GetDataFromPos( nHighlightedItem );
+ if ( pData )
+ nSelectedId = pData->nId;
+ Highlight();
+ nSelectedId = 0;
+}
+
+IMPL_LINK( Menu, ImplCallSelect, Menu*, EMPTYARG )
+{
+ nEventId = 0;
+ Select();
+ return 0;
+}
+
+Menu* Menu::ImplFindSelectMenu()
+{
+ Menu* pSelMenu = nEventId ? this : NULL;
+
+ for ( ULONG n = GetItemList()->Count(); n && !pSelMenu; )
+ {
+ MenuItemData* pData = GetItemList()->GetDataFromPos( --n );
+
+ if ( pData->pSubMenu )
+ pSelMenu = pData->pSubMenu->ImplFindSelectMenu();
+ }
+
+ return pSelMenu;
+}
+
+void Menu::RemoveDisabledEntries( BOOL bCheckPopups, BOOL bRemoveEmptyPopups )
+{
+ for ( USHORT n = 0; n < GetItemCount(); n++ )
+ {
+ BOOL bRemove = FALSE;
+ MenuItemData* pItem = pItemList->GetDataFromPos( n );
+ if ( pItem->eType == MENUITEM_SEPARATOR )
+ {
+ if ( !n || ( GetItemType( n-1 ) == MENUITEM_SEPARATOR ) )
+ bRemove = TRUE;
+ }
+ else
+ bRemove = !pItem->bEnabled;
+
+ if ( bCheckPopups && pItem->pSubMenu )
+ {
+ pItem->pSubMenu->RemoveDisabledEntries( TRUE );
+ if ( bRemoveEmptyPopups && !pItem->pSubMenu->GetItemCount() )
+ bRemove = TRUE;
+ }
+
+ if ( bRemove )
+ RemoveItem( n-- );
+ }
+
+ if ( GetItemCount() )
+ {
+ USHORT nLast = GetItemCount() - 1;
+ MenuItemData* pItem = pItemList->GetDataFromPos( nLast );
+ if ( pItem->eType == MENUITEM_SEPARATOR )
+ RemoveItem( nLast );
+ }
+}
+
+BOOL Menu::HasValidEntries( BOOL bCheckPopups )
+{
+ BOOL bValidEntries = FALSE;
+ USHORT nCount = GetItemCount();
+ for ( USHORT n = 0; !bValidEntries && ( n < nCount ); n++ )
+ {
+ MenuItemData* pItem = pItemList->GetDataFromPos( n );
+ if ( pItem->bEnabled && ( pItem->eType != MENUITEM_SEPARATOR ) )
+ {
+ if ( bCheckPopups && pItem->pSubMenu )
+ bValidEntries = pItem->pSubMenu->HasValidEntries( TRUE );
+ else
+ bValidEntries = TRUE;
+ }
+ }
+ return bValidEntries;
+}
+
+void Menu::SetLogo( const MenuLogo& rLogo )
+{
+ delete pLogo;
+ pLogo = new MenuLogo( rLogo );
+}
+
+void Menu::SetLogo()
+{
+ delete pLogo;
+ pLogo = NULL;
+}
+
+MenuLogo Menu::GetLogo() const
+{
+ MenuLogo aLogo;
+ if ( pLogo )
+ aLogo = *pLogo;
+ return aLogo;
+}
+
+void Menu::GetAccessObject( AccessObjectRef& rAcc ) const
+{
+ rAcc = new AccessObject( (void*) this, bIsMenuBar? ACCESS_TYPE_MENUBAR : ACCESS_TYPE_MENU );
+}
+
+// -----------
+// - MenuBar -
+// -----------
+
+MenuBar::MenuBar()
+{
+ bIsMenuBar = TRUE;
+ mbCloserVisible = FALSE;
+ mbFloatBtnVisible = FALSE;
+ mbHideBtnVisible = FALSE;
+}
+
+MenuBar::MenuBar( const MenuBar& rMenu )
+{
+ bIsMenuBar = TRUE;
+ mbCloserVisible = FALSE;
+ mbFloatBtnVisible = FALSE;
+ mbHideBtnVisible = FALSE;
+ *this = rMenu;
+ bIsMenuBar = TRUE;
+}
+
+MenuBar::MenuBar( const ResId& rResId )
+{
+ bIsMenuBar = TRUE;
+ mbCloserVisible = FALSE;
+ mbFloatBtnVisible = FALSE;
+ mbHideBtnVisible = FALSE;
+ ImplLoadRes( rResId );
+}
+
+MenuBar::~MenuBar()
+{
+ ImplDestroy( this, TRUE );
+}
+
+void MenuBar::ShowCloser( BOOL bShow )
+{
+ ShowButtons( bShow, mbFloatBtnVisible, mbHideBtnVisible );
+}
+
+void MenuBar::ShowFloatButton( BOOL bShow )
+{
+ ShowButtons( mbCloserVisible, bShow, mbHideBtnVisible );
+}
+
+void MenuBar::ShowHideButton( BOOL bShow )
+{
+ ShowButtons( mbCloserVisible, mbFloatBtnVisible, bShow );
+}
+
+void MenuBar::ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide )
+{
+ if ( (bClose != mbCloserVisible) ||
+ (bFloat != mbFloatBtnVisible) ||
+ (bHide != mbHideBtnVisible) )
+ {
+ mbCloserVisible = bClose;
+ mbFloatBtnVisible = bFloat;
+ mbHideBtnVisible = bHide;
+ if ( ImplGetWindow() )
+ ((MenuBarWindow*)ImplGetWindow())->ShowButtons( bClose, bFloat, bHide );
+ }
+}
+
+Window* MenuBar::ImplCreate( Window* pParent, Window* pWindow, MenuBar* pMenu )
+{
+ if ( !pWindow )
+ pWindow = new MenuBarWindow( pParent );
+
+ pMenu->pStartedFrom = 0;
+ pMenu->pWindow = pWindow;
+ ((MenuBarWindow*)pWindow)->SetMenu( pMenu );
+ long nHeight = pMenu->ImplCalcSize( pWindow ).Height();
+ pWindow->SetPosSizePixel( 0, 0, 0, nHeight, WINDOW_POSSIZE_HEIGHT );
+ return pWindow;
+}
+
+void MenuBar::ImplDestroy( MenuBar* pMenu, BOOL bDelete )
+{
+ MenuBarWindow* pWindow = (MenuBarWindow*) pMenu->ImplGetWindow();
+ if ( pWindow && bDelete )
+ {
+ pWindow->KillActivePopup();
+ delete pWindow;
+ }
+ pMenu->pWindow = NULL;
+}
+
+BOOL MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu )
+{
+ BOOL bDone = FALSE;
+ // Enabled-Abfragen, falls diese Methode von einem anderen Fenster gerufen wurde...
+ Window* pWin = ImplGetWindow();
+ if ( pWin && pWin->IsEnabled() && pWin->IsInputEnabled() )
+ bDone = ((MenuBarWindow*)pWin)->ImplHandleKeyEvent( rKEvent, bFromMenu );
+ return bDone;
+}
+
+// -----------------------------------------------------------------------
+
+void MenuBar::SelectEntry( USHORT nId )
+{
+ if( ImplGetWindow() )
+ {
+ MenuBarWindow* pMenuWin = (MenuBarWindow*) ImplGetWindow();
+
+ pMenuWin->GrabFocus();
+ nId = GetItemPos( nId );
+
+ if( ITEMPOS_INVALID == pMenuWin->nHighlightedItem )
+ {
+ if( ( nId != ITEMPOS_INVALID ) && ( nId != pMenuWin->nHighlightedItem ) )
+ pMenuWin->ChangeHighlightItem( nId, FALSE );
+ }
+ else
+ {
+ pMenuWin->KillActivePopup();
+ pMenuWin->ChangeHighlightItem( ITEMPOS_INVALID, FALSE );
+ }
+ }
+}
+
+// BOOL PopupMenu::bAnyPopupInExecute = FALSE;
+
+PopupMenu::PopupMenu()
+{
+}
+
+PopupMenu::PopupMenu( const ResId& rResId )
+{
+ ImplLoadRes( rResId );
+}
+
+PopupMenu::PopupMenu( const PopupMenu& rMenu )
+{
+ *this = rMenu;
+}
+
+PopupMenu::~PopupMenu()
+{
+}
+
+BOOL PopupMenu::IsInExecute()
+{
+ return GetActivePopupMenu() ? TRUE : FALSE;
+}
+
+PopupMenu* PopupMenu::GetActivePopupMenu()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ return pSVData->maAppData.mpActivePopupMenu;
+}
+
+void PopupMenu::EndExecute( USHORT nSelectId )
+{
+ if ( ImplGetWindow() )
+ ImplGetFloatingWindow()->EndExecute( nSelectId );
+}
+
+void PopupMenu::SelectEntry( USHORT nId )
+{
+ if ( ImplGetWindow() )
+ {
+ USHORT nPos;
+ MenuItemData* pData = GetItemList()->GetData( nId, nPos );
+ if ( pData->pSubMenu )
+ ImplGetFloatingWindow()->ChangeHighlightItem( nPos, TRUE );
+ else
+ ImplGetFloatingWindow()->EndExecute( nId );
+ }
+}
+
+USHORT PopupMenu::Execute( Window* pWindow, const Point& rPopupPos )
+{
+ return Execute( pWindow, Rectangle( rPopupPos, rPopupPos ), POPUPMENU_EXECUTE_DOWN );
+}
+
+USHORT PopupMenu::Execute( Window* pWindow, const Rectangle& rRect, USHORT nFlags )
+{
+ ULONG nPopupModeFlags = 0;
+ if ( nFlags & POPUPMENU_EXECUTE_DOWN )
+ nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN;
+ else if ( nFlags & POPUPMENU_EXECUTE_UP )
+ nPopupModeFlags = FLOATWIN_POPUPMODE_UP;
+ else if ( nFlags & POPUPMENU_EXECUTE_LEFT )
+ nPopupModeFlags = FLOATWIN_POPUPMODE_LEFT;
+ else if ( nFlags & POPUPMENU_EXECUTE_RIGHT )
+ nPopupModeFlags = FLOATWIN_POPUPMODE_RIGHT;
+ else
+ nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN;
+ return ImplExecute( pWindow, rRect, nPopupModeFlags, 0, FALSE );
+}
+
+USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupModeFlags, Menu* pSFrom, BOOL bPreSelectFirst )
+{
+ // #59614# Mit TH abgesprochen dass die ASSERTION raus kommt,
+ // weil es evtl. legitim ist...
+// DBG_ASSERT( !PopupMenu::IsInExecute() || pSFrom, "PopupMenu::Execute() called in PopupMenu::Execute()" );
+
+ if ( !pSFrom && ( PopupMenu::IsInExecute() || !GetItemCount() ) )
+ return 0;
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ pStartedFrom = pSFrom;
+ nSelectedId = 0;
+ bCanceled = FALSE;
+
+ ULONG nFocusId = 0;
+ BOOL bRealExecute = FALSE;
+ if ( !pStartedFrom )
+ {
+ pSVData->maWinData.mbNoDeactivate = TRUE;
+ nFocusId = Window::SaveFocus();
+ bRealExecute = TRUE;
+ }
+
+ DBG_ASSERT( !ImplGetWindow(), "Win?!" );
+ Rectangle aRect( rRect );
+ aRect.SetPos( pW->OutputToScreenPixel( aRect.TopLeft() ) );
+
+ WinBits nStyle = WB_BORDER;
+ if ( bRealExecute )
+ nPopupModeFlags |= FLOATWIN_POPUPMODE_NEWLEVEL;
+ if ( !pStartedFrom || !pStartedFrom->bIsMenuBar )
+ nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
+
+ // Kann beim Debuggen hilfreich sein.
+ // nPopupModeFlags |= FLOATWIN_POPUPMODE_NOFOCUSCLOSE;
+
+ ImplDelData aDelData;
+ pW->ImplAddDel( &aDelData );
+
+ bInCallback = TRUE; // hier schon setzen, falls Activate ueberladen
+ Activate();
+ bInCallback = FALSE;
+
+ if ( aDelData.IsDelete() )
+ return 0; // Error
+
+ pW->ImplRemoveDel( &aDelData );
+
+ if ( bCanceled || bKilled )
+ return 0;
+
+ if ( !GetItemCount() )
+ return 0;
+
+ // Das Flag MENU_FLAG_HIDEDISABLEDENTRIES wird vererbt.
+ if ( pSFrom )
+ {
+ if ( pSFrom->nMenuFlags & MENU_FLAG_HIDEDISABLEDENTRIES )
+ nMenuFlags |= MENU_FLAG_HIDEDISABLEDENTRIES;
+ else
+ nMenuFlags &= ~MENU_FLAG_HIDEDISABLEDENTRIES;
+ }
+
+ USHORT nVisibleEntries = ImplGetVisibleItemCount();
+ if ( !nVisibleEntries )
+ {
+ String aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, ImplGetResMgr() ) );
+ MenuItemData* pData = pItemList->Insert(
+ 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF );
+ pData->bIsTemporary = TRUE;
+ }
+ else if ( pSVData->maAppData.mbAutoMnemonics && !( nMenuFlags & MENU_FLAG_NOAUTOMNEMONICS ) )
+ {
+ ImplMnemonicGenerator aMnemonicGenerator;
+ ULONG n;
+ for ( n = 0; n < pItemList->Count(); n++ )
+ aMnemonicGenerator.RegisterMnemonic( pItemList->GetDataFromPos(n)->aText );
+ for ( n = 0; n < pItemList->Count(); n++ )
+ aMnemonicGenerator.CreateMnemonic( pItemList->GetDataFromPos(n)->aText );
+ }
+
+ MenuFloatingWindow* pWin = new MenuFloatingWindow( this, pW, nStyle );
+ pWindow = pWin;
+
+ Size aSz = ImplCalcSize( pWin );
+
+ long nMaxHeight = pWin->GetDesktopRectPixel().GetHeight();
+ if ( pStartedFrom && pStartedFrom->bIsMenuBar )
+ nMaxHeight -= pW->GetSizePixel().Height();
+ long nLeft, nTop, nRight, nBottom;
+ pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
+ nMaxHeight -= nTop+nBottom;
+ if ( aSz.Height() > nMaxHeight )
+ {
+ pWin->EnableScrollMenu( TRUE );
+ USHORT nEntries = ImplCalcVisEntries( nMaxHeight );
+ aSz.Height() = ImplCalcHeight( nEntries );
+ }
+
+ pWin->SetFocusId( nFocusId );
+ pWin->SetOutputSizePixel( aSz );
+ pWin->GrabFocus();
+ if ( GetItemCount() )
+ {
+ pWin->StartPopupMode( aRect, nPopupModeFlags );
+ }
+ if ( bPreSelectFirst )
+ {
+ USHORT nCount = (USHORT)pItemList->Count();
+ for ( USHORT n = 0; n < nCount; n++ )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( n );
+ if ( ( pData->eType != MENUITEM_SEPARATOR ) && ImplIsVisible( n ) )
+ {
+ pWin->ChangeHighlightItem( n, FALSE );
+ break;
+ }
+ }
+ }
+ if ( bRealExecute )
+ {
+ pWin->Execute();
+
+ // Focus wieder herstellen (kann schon im Select wieder
+ // hergestellt wurden sein
+ nFocusId = pWin->GetFocusId();
+ if ( nFocusId )
+ {
+ pWin->SetFocusId( 0 );
+ pSVData->maWinData.mbNoDeactivate = FALSE;
+ }
+ pWin->ImplEndPopupMode( 0, nFocusId );
+
+ if ( nSelectedId ) // Dann abraeumen... ( sonst macht TH das )
+ {
+ PopupMenu* pSub = pWin->GetActivePopup();
+ while ( pSub )
+ {
+ pSub->ImplGetFloatingWindow()->EndPopupMode();
+ pSub = pSub->ImplGetFloatingWindow()->GetActivePopup();
+ }
+ }
+ delete pWindow;
+ pWindow = NULL;
+
+ // Steht noch ein Select aus?
+ Menu* pSelect = ImplFindSelectMenu();
+ if ( pSelect )
+ {
+ // Beim Popup-Menu muss das Select vor dem Verlassen von Execute gerufen werden!
+ Application::RemoveUserEvent( pSelect->nEventId );
+ pSelect->nEventId = 0;
+ pSelect->Select();
+ }
+ }
+
+ return bRealExecute ? nSelectedId : 0;
+}
+
+USHORT PopupMenu::ImplCalcVisEntries( long nMaxHeight, USHORT nStartEntry ) const
+{
+ nMaxHeight -= 2 * ImplGetFloatingWindow()->GetScrollerHeight();
+
+ long nHeight = 0;
+ USHORT nEntries = (USHORT) pItemList->Count();
+ USHORT nVisEntries = 0;
+ for ( USHORT n = nStartEntry; n < nEntries; n++ )
+ {
+ if ( ImplIsVisible( n ) )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( n );
+ nHeight += pData->aSz.Height();
+ if ( nHeight > nMaxHeight )
+ break;
+ nVisEntries++;
+ }
+ }
+ return nVisEntries;
+}
+
+long PopupMenu::ImplCalcHeight( USHORT nEntries ) const
+{
+ long nHeight = 0;
+
+ if ( nEntries > pItemList->Count() )
+ nEntries = (USHORT) pItemList->Count();
+
+ for ( ULONG n = 0; n < nEntries; n++ )
+ {
+ MenuItemData* pData = pItemList->GetDataFromPos( n );
+ nHeight += pData->aSz.Height();
+ }
+
+ nHeight += 2*ImplGetFloatingWindow()->GetScrollerHeight();
+
+ return nHeight;
+}
+
+
+static void ImplInitMenuWindow( Window* pWin, BOOL bFont )
+{
+ const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ pWin->SetPointFont( rStyleSettings.GetMenuFont() );
+ pWin->SetBackground( Wallpaper( rStyleSettings.GetMenuColor() ) );
+ pWin->SetTextColor( rStyleSettings.GetMenuTextColor() );
+ pWin->SetTextFillColor();
+ pWin->SetLineColor();
+}
+
+MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, Window* pParent, WinBits nStyle ) :
+ FloatingWindow( pParent, nStyle )
+{
+ pMenu = pMen;
+ pActivePopup = 0;
+ nSaveFocusId = 0;
+ bInExecute = FALSE;
+ bScrollMenu = FALSE;
+ nHighlightedItem = ITEMPOS_INVALID;
+ nMBDownPos = ITEMPOS_INVALID;
+ nScrollerHeight = 0;
+ nStartY = 0;
+ nBorder = EXTRASPACEY;
+ nFirstEntry = 0;
+ bScrollUp = FALSE;
+ bScrollDown = FALSE;
+
+ EnableSaveBackground();
+ ImplInitMenuWindow( this, TRUE );
+
+ SetPopupModeEndHdl( LINK( this, MenuFloatingWindow, PopupEnd ) );
+
+ aHighlightChangedTimer.SetTimeoutHdl( LINK( this, MenuFloatingWindow, HighlightChanged ) );
+ aHighlightChangedTimer.SetTimeout( GetSettings().GetMouseSettings().GetMenuDelay() );
+ aScrollTimer.SetTimeoutHdl( LINK( this, MenuFloatingWindow, AutoScroll ) );
+
+ if ( Application::GetAccessHdlCount() )
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_POPUPMENU_START, pMenu ) );
+}
+
+MenuFloatingWindow::~MenuFloatingWindow()
+{
+ if( Application::GetAccessHdlCount() )
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_POPUPMENU_END, pMenu ) );
+
+ aHighlightChangedTimer.Stop();
+}
+
+void MenuFloatingWindow::Resize()
+{
+ ImplInitClipRegion();
+}
+
+Region MenuFloatingWindow::ImplCalcClipRegion( BOOL bIncludeLogo ) const
+{
+ Size aOutSz = GetOutputSizePixel();
+ Point aPos;
+ Rectangle aRect( aPos, aOutSz );
+ long nBorder = nScrollerHeight;
+ aRect.Top() += nBorder;
+ aRect.Bottom() -= nBorder;
+
+ if ( pMenu->pLogo && !bIncludeLogo )
+ aRect.Left() += pMenu->pLogo->aBitmap.GetSizePixel().Width();
+
+ Region aRegion = aRect;
+ if ( pMenu->pLogo && bIncludeLogo && nScrollerHeight )
+ aRegion.Union( Rectangle( Point(), Size( pMenu->pLogo->aBitmap.GetSizePixel().Width(), aOutSz.Height() ) ) );
+
+ return aRegion;
+}
+
+void MenuFloatingWindow::ImplInitClipRegion()
+{
+ if ( IsScrollMenu() )
+ {
+ SetClipRegion( ImplCalcClipRegion() );
+ }
+ else
+ {
+ SetClipRegion();
+ }
+}
+
+void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, BOOL bMBDown )
+{
+ long nY = nScrollerHeight;
+ long nMouseY = rMEvt.GetPosPixel().Y();
+ Size aOutSz = GetOutputSizePixel();
+ if ( ( nMouseY >= nY ) && ( nMouseY < ( aOutSz.Height() - nY ) ) )
+ {
+ BOOL bHighlighted = FALSE;
+ USHORT nCount = (USHORT)pMenu->pItemList->Count();
+ nY += nStartY; // ggf. gescrollt.
+ for ( USHORT n = 0; !bHighlighted && ( n < nCount ); n++ )
+ {
+ if ( pMenu->ImplIsVisible( n ) )
+ {
+ MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
+ long nOldY = nY;
+ nY += pData->aSz.Height();
+ if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) )
+ {
+ BOOL bPopupArea = TRUE;
+ if ( pData->nBits & MIB_POPUPSELECT )
+ {
+ // Nur wenn ueber dem Pfeil geklickt wurde...
+ Size aSz = GetOutputSizePixel();
+ long nFontHeight = GetTextHeight();
+ bPopupArea = ( rMEvt.GetPosPixel().X() >= ( aSz.Width() - nFontHeight - nFontHeight/4 ) );
+ }
+
+ if ( bMBDown )
+ {
+ if ( n != nHighlightedItem )
+ ChangeHighlightItem( (USHORT)n, FALSE );
+
+ if ( pActivePopup )
+ KillActivePopup();
+ else if ( bPopupArea )
+ HighlightChanged( NULL );
+ }
+ else
+ {
+ if ( n != nHighlightedItem )
+ {
+ ChangeHighlightItem( (USHORT)n, TRUE );
+ }
+ else if ( pData->nBits & MIB_POPUPSELECT )
+ {
+ if ( bPopupArea && ( pActivePopup != pData->pSubMenu ) )
+ HighlightChanged( NULL );
+ }
+ }
+ bHighlighted = TRUE;
+ }
+ }
+ }
+ if ( !bHighlighted )
+ ChangeHighlightItem( ITEMPOS_INVALID, TRUE );
+ }
+ else
+ {
+ ImplScroll( rMEvt.GetPosPixel() );
+ ChangeHighlightItem( ITEMPOS_INVALID, TRUE );
+ }
+}
+
+IMPL_LINK( MenuFloatingWindow, PopupEnd, FloatingWindow*, pPopup )
+{
+ if ( bInExecute )
+ {
+ if ( pActivePopup )
+ {
+ DBG_ASSERT( !pActivePopup->ImplGetWindow(), "PopupEnd, obwohl pActivePopup MIT Window!" );
+ pActivePopup->bCanceled = TRUE;
+ }
+ bInExecute = FALSE;
+ pMenu->bInCallback = TRUE;
+ pMenu->Deactivate();
+ pMenu->bInCallback = FALSE;
+ }
+ else
+ {
+ // Wenn dies Fenster von TH geschlossen wurde, hat noch ein anderes
+ // Menu dieses Fenster als pActivePopup.
+ if ( pMenu->pStartedFrom )
+ {
+ // Das pWin am 'Parent' kann aber schon 0 sein, falls die Kette von
+ // vorne abgeraeumt wurde und jetzt die EndPopup-Events eintrudeln
+ if ( pMenu->pStartedFrom->bIsMenuBar )
+ {
+ MenuBarWindow* p = (MenuBarWindow*) pMenu->pStartedFrom->ImplGetWindow();
+ if ( p )
+ p->PopupClosed( pMenu );
+ }
+ else
+ {
+ MenuFloatingWindow* p = (MenuFloatingWindow*) pMenu->pStartedFrom->ImplGetWindow();
+ if ( p )
+ p->KillActivePopup( (PopupMenu*)pMenu );
+ }
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( MenuFloatingWindow, AutoScroll, Timer*, EMPTYARG )
+{
+ ImplScroll( GetPointerPosPixel() );
+ return 1;
+}
+
+IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer )
+{
+ MenuItemData* pData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
+ if ( pData )
+ {
+ if ( pActivePopup && ( pActivePopup != pData->pSubMenu ) )
+ {
+ KillActivePopup();
+ }
+ if ( pData->bEnabled && pData->pSubMenu && pData->pSubMenu->GetItemCount() && ( pData->pSubMenu != pActivePopup ) )
+ {
+ pActivePopup = (PopupMenu*)pData->pSubMenu;
+ long nY = nScrollerHeight+nStartY;
+ MenuItemData* pData = 0;
+ for ( ULONG n = 0; n < nHighlightedItem; n++ )
+ {
+ pData = pMenu->pItemList->GetDataFromPos( n );
+ nY += pData->aSz.Height();
+ }
+ pData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
+ Size MySize = GetOutputSizePixel();
+// Point MyPos = GetPosPixel();
+// Point aItemTopLeft( MyPos.X(), MyPos.Y()+nY );
+ Point aItemTopLeft( 0, nY );
+ Point aItemBottomRight( aItemTopLeft );
+ aItemBottomRight.X() += MySize.Width();
+ aItemBottomRight.Y() += pData->aSz.Height();
+
+ // Popups leicht versetzen:
+ aItemTopLeft.X() += 2;
+ aItemBottomRight.X() -= 2;
+ if ( nHighlightedItem )
+ aItemTopLeft.Y() -= 2;
+ else
+ {
+ long nL, nT, nR, nB;
+ GetBorder( nL, nT, nR, nB );
+ aItemTopLeft.Y() -= nT;
+ }
+
+ // pTest: Wegen Abstuerzen durch Reschedule() im Aufruf von Activate()
+ // Ausserdem wird damit auch verhindert, dass SubMenus angezeigt werden,
+ // die lange im Activate Rescheduled haben und jetzt schon nicht mehr
+ // angezeigt werden sollen.
+ Menu* pTest = pActivePopup;
+ USHORT nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer ? FALSE : TRUE );
+
+ // nRet != 0, wenn es waerend Activate() abgeschossen wurde...
+ if ( !nRet && ( pActivePopup == pTest ) && pActivePopup->ImplGetWindow() )
+ pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
+ }
+ }
+
+ return 0;
+}
+
+void MenuFloatingWindow::EnableScrollMenu( BOOL b )
+{
+ bScrollMenu = b;
+ nScrollerHeight = b ? (USHORT) GetSettings().GetStyleSettings().GetScrollBarSize() /2 : 0;
+ bScrollDown = TRUE;
+ ImplInitClipRegion();
+}
+
+void MenuFloatingWindow::Execute()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ pSVData->maAppData.mpActivePopupMenu = (PopupMenu*)pMenu;
+
+ bInExecute = TRUE;
+// bCallingSelect = FALSE;
+
+ while ( bInExecute )
+ Application::Yield();
+
+ pSVData->maAppData.mpActivePopupMenu = NULL;
+
+// while ( bCallingSelect )
+// Application::Yield();
+}
+
+void MenuFloatingWindow::StopExecute( ULONG nFocusId )
+{
+ // Focus wieder herstellen
+ // (kann schon im Select wieder hergestellt wurden sein)
+ if ( nSaveFocusId )
+ {
+ Window::EndSaveFocus( nFocusId, FALSE );
+ nFocusId = nSaveFocusId;
+ if ( nFocusId )
+ {
+ nSaveFocusId = 0;
+ ImplGetSVData()->maWinData.mbNoDeactivate = FALSE;
+ }
+ }
+ ImplEndPopupMode( 0, nFocusId );
+
+ aHighlightChangedTimer.Stop();
+ bInExecute = FALSE;
+ if ( pActivePopup )
+ {
+ KillActivePopup();
+ }
+}
+
+void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
+{
+ if ( pActivePopup && ( !pThisOnly || ( pThisOnly == pActivePopup ) ) )
+ {
+ if ( pActivePopup->bInCallback )
+ pActivePopup->bCanceled = TRUE;
+
+ // Vor allen Aktionen schon pActivePopup = 0, falls z.B.
+ // PopupModeEndHdl des zu zerstoerenden Popups mal synchron gerufen wird.
+ PopupMenu* pPopup = pActivePopup;
+ pActivePopup = NULL;
+ pPopup->bInCallback = TRUE;
+ pPopup->Deactivate();
+ pPopup->bInCallback = FALSE;
+ if ( pPopup->ImplGetWindow() )
+ {
+ pPopup->ImplGetFloatingWindow()->StopExecute();
+ delete pPopup->pWindow;
+ pPopup->pWindow = NULL;
+ Update();
+ }
+ }
+}
+
+void MenuFloatingWindow::EndExecute()
+{
+ Menu* pStart = pMenu->ImplGetStartMenu();
+ ULONG nFocusId = 0;
+ if ( pStart && pStart->bIsMenuBar )
+ {
+ nFocusId = ((MenuBarWindow*)((MenuBar*)pStart)->ImplGetWindow())->GetFocusId();
+ if ( nFocusId )
+ {
+ ((MenuBarWindow*)((MenuBar*)pStart)->ImplGetWindow())->SetFocusId( 0 );
+ ImplGetSVData()->maWinData.mbNoDeactivate = FALSE;
+ }
+ }
+ // Wenn von woanders gestartet, dann ab dort aufraumen:
+ MenuFloatingWindow* pCleanUpFrom = this;
+ MenuFloatingWindow* pWin = this;
+ while ( pWin && !pWin->bInExecute &&
+ pWin->pMenu->pStartedFrom && !pWin->pMenu->pStartedFrom->bIsMenuBar )
+ {
+ pWin = ((PopupMenu*)pWin->pMenu->pStartedFrom)->ImplGetFloatingWindow();
+ }
+ if ( pWin )
+ pCleanUpFrom = pWin;
+
+ // Dies Fenster wird gleich zerstoert => Daten lokal merken...
+ Menu* pM = pMenu;
+ USHORT nItem = nHighlightedItem;
+
+ pCleanUpFrom->StopExecute( nFocusId );
+
+ if ( nItem != ITEMPOS_INVALID )
+ {
+ MenuItemData* pItemData = pM->GetItemList()->GetDataFromPos( nItem );
+ if ( pItemData && !pItemData->bIsTemporary )
+ {
+ pM->nSelectedId = pItemData->nId;
+ if ( pStart )
+ pStart->nSelectedId = pItemData->nId;
+
+ pM->ImplSelect();
+ }
+ }
+}
+
+void MenuFloatingWindow::EndExecute( USHORT nId )
+{
+ USHORT nPos;
+ if ( pMenu->GetItemList()->GetData( nId, nPos ) )
+ nHighlightedItem = nPos;
+ else
+ nHighlightedItem = ITEMPOS_INVALID;
+
+ EndExecute();
+}
+
+void MenuFloatingWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // TH macht ein ToTop auf dieses Fenster, aber das aktive Popup
+ // soll oben bleiben...
+ if ( pActivePopup && pActivePopup->ImplGetWindow() && !pActivePopup->ImplGetFloatingWindow()->pActivePopup )
+ pActivePopup->ImplGetFloatingWindow()->ToTop();
+
+ if ( !ImplIsMouseFollow() )
+ {
+ ImplHighlightItem( rMEvt, TRUE );
+ }
+
+ nMBDownPos = nHighlightedItem;
+}
+
+void MenuFloatingWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( nHighlightedItem );
+ // nMBDownPos in lokaler Variable merken und gleich zuruecksetzen,
+ // weil nach EndExecute zu spaet
+ USHORT _nMBDownPos = nMBDownPos;
+ nMBDownPos = ITEMPOS_INVALID;
+ if ( pData && pData->bEnabled && ( pData->eType != MENUITEM_SEPARATOR ) )
+ {
+ if ( !pData->pSubMenu )
+ {
+ EndExecute();
+ }
+ else if ( ( pData->nBits & MIB_POPUPSELECT ) && ( nHighlightedItem == _nMBDownPos ) && ( rMEvt.GetClicks() == 2 ) )
+ {
+ // Nicht wenn ueber dem Pfeil geklickt wurde...
+ Size aSz = GetOutputSizePixel();
+ long nFontHeight = GetTextHeight();
+ if ( rMEvt.GetPosPixel().X() < ( aSz.Width() - nFontHeight - nFontHeight/4 ) )
+ EndExecute();
+ }
+ }
+
+}
+
+void MenuFloatingWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( !IsVisible() || rMEvt.IsSynthetic() )
+ return;
+
+ if ( rMEvt.IsLeaveWindow() )
+ {
+ if ( ImplIsMouseFollow() || ( rMEvt.GetButtons() == MOUSE_LEFT ) )
+ ChangeHighlightItem( ITEMPOS_INVALID, FALSE );
+ if ( IsScrollMenu() )
+ ImplScroll( rMEvt.GetPosPixel() );
+ }
+ else if ( ImplIsMouseFollow() || ( rMEvt.GetButtons() == MOUSE_LEFT ) )
+ {
+ ImplHighlightItem( rMEvt, FALSE );
+ }
+}
+
+void MenuFloatingWindow::ImplScroll( BOOL bUp )
+{
+ KillActivePopup();
+ Update();
+
+ HighlightItem( nHighlightedItem, FALSE );
+
+ if ( bScrollUp && bUp )
+ {
+ MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( --nFirstEntry );
+ long nEntryHeight = pData->aSz.Height();
+
+ nStartY += nEntryHeight;
+
+ if ( !bScrollDown )
+ {
+ bScrollDown = TRUE;
+ ImplDrawScroller( FALSE );
+ }
+
+ if ( nFirstEntry == 0 )
+ {
+ bScrollUp = FALSE;
+ ImplDrawScroller( TRUE );
+ }
+ Scroll( 0, nEntryHeight, ImplCalcClipRegion( FALSE ).GetBoundRect(), SCROLL_CLIP );
+ }
+ else if ( bScrollDown && !bUp )
+ {
+ MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( nFirstEntry++ );
+ long nEntryHeight = pData->aSz.Height();
+
+ if ( !bScrollUp )
+ {
+ bScrollUp = TRUE;
+ ImplDrawScroller( TRUE );
+ }
+
+ Size aOutSz = GetOutputSizePixel();
+ USHORT nVisible = ((PopupMenu*)pMenu)->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry );
+ if ( ( nFirstEntry + nVisible ) >= (USHORT) pMenu->GetItemList()->Count() )
+ {
+ bScrollDown = FALSE;
+ ImplDrawScroller( FALSE );
+ }
+
+ nStartY -= nEntryHeight;
+ Scroll( 0, -nEntryHeight, ImplCalcClipRegion( FALSE ).GetBoundRect(), SCROLL_CLIP );
+ }
+
+ HighlightItem( nHighlightedItem, TRUE );
+}
+
+void MenuFloatingWindow::ImplScroll( const Point& rMousePos )
+{
+ Size aOutSz = GetOutputSizePixel();
+
+ long nY = nScrollerHeight;
+ long nMouseY = rMousePos.Y();
+ long nDelta = 0;
+
+ if ( bScrollUp && ( nMouseY < nY ) )
+ {
+ ImplScroll( TRUE );
+ nDelta = nY - nMouseY;
+ }
+ else if ( bScrollDown && ( nMouseY > ( aOutSz.Height() - nY ) ) )
+ {
+ ImplScroll( FALSE );
+ nDelta = nMouseY - ( aOutSz.Height() - nY );
+ }
+
+ if ( nDelta )
+ {
+ aScrollTimer.Stop(); // Falls durch MouseMove gescrollt.
+ long nTimeout;
+ if ( nDelta < 3 )
+ nTimeout = 200;
+ else if ( nDelta < 5 )
+ nTimeout = 100;
+ else if ( nDelta < 8 )
+ nTimeout = 70;
+ else if ( nDelta < 12 )
+ nTimeout = 40;
+ else
+ nTimeout = 20;
+ aScrollTimer.SetTimeout( nTimeout );
+ aScrollTimer.Start();
+ }
+}
+void MenuFloatingWindow::ChangeHighlightItem( USHORT n, BOOL bStartPopupTimer )
+{
+ // #57934# ggf. das aktive Popup sofort schliessen, damit TH's Hintergrundsicherung funktioniert.
+ // #65750# Dann verzichten wir lieber auf den schmalen Streifen Hintergrundsicherung.
+ // Sonst lassen sich die Menus schlecht bedienen.
+// MenuItemData* pNextData = pMenu->pItemList->GetDataFromPos( n );
+// if ( pActivePopup && pNextData && ( pActivePopup != pNextData->pSubMenu ) )
+// KillActivePopup();
+
+ if ( nHighlightedItem != ITEMPOS_INVALID )
+ HighlightItem( nHighlightedItem, FALSE );
+
+ nHighlightedItem = (USHORT)n;
+ DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" );
+ HighlightItem( nHighlightedItem, TRUE );
+ pMenu->ImplCallHighlight( nHighlightedItem );
+
+ if ( bStartPopupTimer )
+ aHighlightChangedTimer.Start();
+}
+
+void MenuFloatingWindow::HighlightItem( USHORT nPos, BOOL bHighlight )
+{
+ Size aSz = GetOutputSizePixel();
+ USHORT nBorder = nScrollerHeight;
+ long nY = nBorder+nStartY;
+ long nX = 0;
+
+ if ( pMenu->pLogo )
+ nX = pMenu->pLogo->aBitmap.GetSizePixel().Width();
+
+ USHORT nCount = (USHORT)pMenu->pItemList->Count();
+ for ( USHORT n = 0; n < nCount; n++ )
+ {
+ MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
+ if ( n == nPos )
+ {
+ DBG_ASSERT( pMenu->ImplIsVisible( n ), "Highlight: Item not visible!" );
+ if ( pData->eType != MENUITEM_SEPARATOR )
+ {
+ if ( bHighlight )
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ else
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+ Rectangle aRect( Point( nX, nY ), Size( aSz.Width(), pData->aSz.Height() ) );
+ if ( pData->nBits & MIB_POPUPSELECT )
+ {
+ long nFontHeight = GetTextHeight();
+ aRect.Right() -= nFontHeight + nFontHeight/4;
+ }
+ DrawRect( aRect );
+ pMenu->ImplPaint( this, nBorder, nStartY, pData, bHighlight );
+ }
+ return;
+ }
+
+ nY += pData->aSz.Height();
+ }
+}
+
+void MenuFloatingWindow::ImplCursorUpDown( BOOL bUp )
+{
+ USHORT n = nHighlightedItem;
+ if ( n == ITEMPOS_INVALID )
+ {
+ if ( bUp )
+ n = 0;
+ else
+ n = pMenu->GetItemCount()-1;
+ }
+
+ USHORT nLoop = n;
+ do
+ {
+ if ( bUp )
+ {
+ if ( n )
+ n--;
+ else
+ if ( !IsScrollMenu() || ( nHighlightedItem == ITEMPOS_INVALID ) )
+ n = pMenu->GetItemCount()-1;
+ else
+ break;
+ }
+ else
+ {
+ n++;
+ if ( n >= pMenu->GetItemCount() )
+ if ( !IsScrollMenu() || ( nHighlightedItem == ITEMPOS_INVALID ) )
+ n = 0;
+ else
+ break;
+ }
+
+ MenuItemData* pData = (MenuItemData*)pMenu->GetItemList()->GetDataFromPos( n );
+ if ( ( pData->eType != MENUITEM_SEPARATOR ) && pMenu->ImplIsVisible( n ) )
+ {
+ // Selektion noch im sichtbaren Bereich?
+ if ( IsScrollMenu() )
+ {
+ ChangeHighlightItem( ITEMPOS_INVALID, FALSE );
+
+ while ( n < nFirstEntry )
+ ImplScroll( TRUE );
+
+ Size aOutSz = GetOutputSizePixel();
+ while ( n >= ( nFirstEntry + ((PopupMenu*)pMenu)->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry ) ) )
+ ImplScroll( FALSE );
+ }
+ ChangeHighlightItem( n, FALSE );
+ break;
+ }
+ } while ( n != nLoop );
+}
+
+void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent )
+{
+ USHORT nCode = rKEvent.GetKeyCode().GetCode();
+ switch ( nCode )
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ {
+ ImplCursorUpDown( nCode == KEY_UP );
+ }
+ break;
+ case KEY_LEFT:
+ {
+ if ( pMenu->pStartedFrom )
+ {
+ StopExecute();
+ if ( pMenu->pStartedFrom->bIsMenuBar )
+ {
+ // Weiterkeiten...
+ ((MenuBarWindow*)((MenuBar*)pMenu->pStartedFrom)->ImplGetWindow())->KeyInput( rKEvent );
+ }
+ else
+ {
+ MenuFloatingWindow* pFloat = ((PopupMenu*)pMenu->pStartedFrom)->ImplGetFloatingWindow();
+ pFloat->GrabFocus();
+ pFloat->KillActivePopup();
+ }
+ }
+ }
+ break;
+ case KEY_RIGHT:
+ {
+ BOOL bDone = FALSE;
+ if ( nHighlightedItem != ITEMPOS_INVALID )
+ {
+ MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( nHighlightedItem );
+ if ( pData && pData->pSubMenu )
+ {
+ HighlightChanged( 0 );
+ bDone = TRUE;
+ }
+ }
+ if ( !bDone )
+ {
+ Menu* pStart = pMenu->ImplGetStartMenu();
+ if ( pStart && pStart->bIsMenuBar )
+ {
+ // Weiterkeiten...
+ pStart->ImplGetWindow()->KeyInput( rKEvent );
+ }
+ }
+ }
+ break;
+ case KEY_RETURN:
+ {
+ MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( nHighlightedItem );
+ if ( pData && pData->bEnabled )
+ {
+ if ( pData->pSubMenu )
+ HighlightChanged( 0 );
+ else
+ EndExecute();
+ }
+ else
+ StopExecute();
+ }
+ break;
+ case KEY_MENU:
+ {
+ Menu* pStart = pMenu->ImplGetStartMenu();
+ if ( pStart && pStart->bIsMenuBar )
+ {
+ // Weiterkeiten...
+ pStart->ImplGetWindow()->KeyInput( rKEvent );
+ }
+ }
+ break;
+ default:
+ {
+ xub_Unicode nCharCode = rKEvent.GetCharCode();
+ USHORT nPos;
+ MenuItemData* pData = pMenu->GetItemList()->SearchItem( nCharCode, nPos );
+ if ( pData )
+ {
+ if ( pData->pSubMenu )
+ {
+ ChangeHighlightItem( nPos, FALSE );
+ HighlightChanged( 0 );
+ }
+ else
+ {
+ nHighlightedItem = nPos;
+ EndExecute();
+ }
+ }
+ else
+ {
+ // Bei ungueltigen Tasten Beepen, aber nicht bei HELP und F-Tasten
+ if ( !rKEvent.GetKeyCode().IsControlMod() && ( nCode != KEY_HELP ) && ( rKEvent.GetKeyCode().GetGroup() != KEYGROUP_FKEYS ) )
+ Sound::Beep();
+ FloatingWindow::KeyInput( rKEvent );
+ }
+ }
+ }
+}
+
+void MenuFloatingWindow::Paint( const Rectangle& rRect )
+{
+ if ( IsScrollMenu() )
+ {
+ ImplDrawScroller( TRUE );
+ ImplDrawScroller( FALSE );
+ }
+ pMenu->ImplPaint( this, nScrollerHeight, nStartY );
+ if ( nHighlightedItem != ITEMPOS_INVALID )
+ HighlightItem( nHighlightedItem, TRUE );
+}
+
+void MenuFloatingWindow::ImplDrawScroller( BOOL bUp )
+{
+ SetClipRegion();
+
+ Size aOutSz = GetOutputSizePixel();
+ long nY = bUp ? 0 : ( aOutSz.Height() - nScrollerHeight );
+ long nX = pMenu->pLogo ? pMenu->pLogo->aBitmap.GetSizePixel().Width() : 0;
+ Rectangle aRect( Point( nX, nY ), Size( aOutSz.Width()-nX, nScrollerHeight ) );
+
+ DecorationView aDecoView( this );
+ SymbolType eSymbol = bUp ? SYMBOL_SPIN_UP : SYMBOL_SPIN_DOWN;
+
+ USHORT nStyle = 0;
+ if ( ( bUp && !bScrollUp ) || ( !bUp && !bScrollDown ) )
+ nStyle |= SYMBOL_DRAW_DISABLE;
+
+ aDecoView.DrawSymbol( aRect, eSymbol, GetSettings().GetStyleSettings().GetButtonTextColor(), nStyle );
+
+ ImplInitClipRegion();
+}
+
+void MenuFloatingWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nId = nHighlightedItem;
+ Menu* pM = pMenu;
+ Window* pW = this;
+ if ( rHEvt.GetMode() & (HELPMODE_CONTEXT | HELPMODE_EXTENDED) )
+ {
+ nHighlightedItem = ITEMPOS_INVALID;
+ EndExecute();
+ pW = NULL;
+ }
+ if( !ImplHandleHelpEvent( pW, pM, nId, rHEvt ) )
+ Window::RequestHelp( rHEvt );
+}
+
+void MenuFloatingWindow::StateChanged( StateChangedType nType )
+{
+ FloatingWindow::StateChanged( nType );
+
+ if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) || ( nType == STATE_CHANGE_CONTROLBACKGROUND ) )
+ {
+ ImplInitMenuWindow( this, FALSE );
+ Invalidate();
+ }
+}
+
+void MenuFloatingWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ FloatingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitMenuWindow( this, FALSE );
+ Invalidate();
+ }
+}
+
+void MenuFloatingWindow::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+// ImplCursorUpDown( pData->GetDelta() > 0L );
+ ImplScroll( pData->GetDelta() > 0L );
+ MouseMove( MouseEvent( GetPointerPosPixel(), 0 ) );
+ }
+ }
+}
+
+
+
+MenuBarWindow::MenuBarWindow( Window* pParent ) :
+ Window( pParent, 0 ),
+ aCloser( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ),
+ aFloatBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE ),
+ aHideBtn( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )
+{
+ pMenu = NULL;
+ pActivePopup = NULL;
+ nSaveFocusId = 0;
+ nHighlightedItem = ITEMPOS_INVALID;
+ mbAutoPopup = TRUE;
+ nSaveFocusId = 0;
+
+ ResMgr* pResMgr = ImplGetResMgr();
+ aCloser.SetClickHdl( LINK( this, MenuBarWindow, CloserHdl ) );
+ aCloser.SetSymbol( SYMBOL_CLOSE );
+ aCloser.SetQuickHelpText( XubString( ResId( SV_HELPTEXT_CLOSE, pResMgr ) ) );
+ aFloatBtn.SetClickHdl( LINK( this, MenuBarWindow, FloatHdl ) );
+ aFloatBtn.SetSymbol( SYMBOL_FLOAT );
+ aFloatBtn.SetQuickHelpText( XubString( ResId( SV_HELPTEXT_RESTORE, pResMgr ) ) );
+ aHideBtn.SetClickHdl( LINK( this, MenuBarWindow, HideHdl ) );
+ aHideBtn.SetSymbol( SYMBOL_HIDE );
+ aHideBtn.SetQuickHelpText( XubString( ResId( SV_HELPTEXT_MINIMIZE, pResMgr ) ) );
+}
+
+MenuBarWindow::~MenuBarWindow()
+{
+}
+
+void MenuBarWindow::SetMenu( MenuBar* pMen )
+{
+ pMenu = pMen;
+ KillActivePopup();
+ nHighlightedItem = ITEMPOS_INVALID;
+ ImplInitMenuWindow( this, TRUE );
+ if ( pMen )
+ {
+ aCloser.Show( pMen->HasCloser() );
+ aFloatBtn.Show( pMen->HasFloatButton() );
+ aHideBtn.Show( pMen->HasHideButton() );
+ }
+ Invalidate();
+}
+
+void MenuBarWindow::ShowButtons( BOOL bClose, BOOL bFloat, BOOL bHide )
+{
+ aCloser.Show( bClose );
+ aFloatBtn.Show( bFloat );
+ aHideBtn.Show( bHide );
+ Resize();
+}
+
+IMPL_LINK( MenuBarWindow, CloserHdl, PushButton*, EMPTYARG )
+{
+ return ((MenuBar*)pMenu)->GetCloserHdl().Call( pMenu );
+}
+
+IMPL_LINK( MenuBarWindow, FloatHdl, PushButton*, EMPTYARG )
+{
+ return ((MenuBar*)pMenu)->GetFloatButtonClickHdl().Call( pMenu );
+}
+
+IMPL_LINK( MenuBarWindow, HideHdl, PushButton*, EMPTYARG )
+{
+ return ((MenuBar*)pMenu)->GetHideButtonClickHdl().Call( pMenu );
+}
+
+void MenuBarWindow::ImplCreatePopup( BOOL bPreSelectFirst )
+{
+ MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( nHighlightedItem );
+ if ( pData )
+ {
+ if ( pActivePopup && ( pActivePopup != pData->pSubMenu ) )
+ {
+ KillActivePopup();
+ }
+ if ( pData->bEnabled && pData->pSubMenu && ( nHighlightedItem != ITEMPOS_INVALID ) && ( pData->pSubMenu != pActivePopup ) )
+ {
+ pActivePopup = (PopupMenu*)pData->pSubMenu;
+ long nX = 0;
+ MenuItemData* pData = 0;
+ for ( ULONG n = 0; n < nHighlightedItem; n++ )
+ {
+ pData = pMenu->GetItemList()->GetDataFromPos( n );
+ nX += pData->aSz.Width();
+ }
+ pData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
+// Point MyPos = GetPosPixel();
+ Point aItemTopLeft( nX, 0 );
+ Point aItemBottomRight( aItemTopLeft );
+ aItemBottomRight.X() += pData->aSz.Width();
+
+ // Im Vollbild-Modus hat die MenuBar ggf. die Hoehe 0:
+ // Nicht immer einfach die Window-Hoehe nehmen, weil ItemHeight < WindowHeight.
+ if ( GetSizePixel().Height() )
+ aItemBottomRight.Y() += pData->aSz.Height();
+
+ // ImplExecute ist doch nicht modal...
+ GrabFocus();
+ pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_DOWN, pMenu, bPreSelectFirst );
+ if ( pActivePopup )
+ {
+ // Hat kein Window, wenn vorher abgebrochen oder keine Eintraege
+ if ( pActivePopup->ImplGetFloatingWindow() )
+ pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
+ else
+ pActivePopup = NULL;
+ }
+ }
+ }
+}
+
+
+void MenuBarWindow::KillActivePopup()
+{
+ if ( pActivePopup )
+ {
+ if ( pActivePopup->bInCallback )
+ pActivePopup->bCanceled = TRUE;
+
+ pActivePopup->bInCallback = TRUE;
+ pActivePopup->Deactivate();
+ pActivePopup->bInCallback = FALSE;
+ // Abfrage auf pActivePopup, falls im Deactivate abgeschossen...
+ if ( pActivePopup && pActivePopup->ImplGetWindow() )
+ {
+ pActivePopup->ImplGetFloatingWindow()->StopExecute();
+ delete pActivePopup->pWindow;
+ pActivePopup->pWindow = NULL;
+ }
+ pActivePopup = 0;
+ }
+}
+
+void MenuBarWindow::PopupClosed( Menu* pPopup )
+{
+ if ( pPopup == pActivePopup )
+ {
+ KillActivePopup();
+ ChangeHighlightItem( ITEMPOS_INVALID, FALSE );
+ }
+}
+
+void MenuBarWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ mbAutoPopup = TRUE;
+ USHORT nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
+ if ( ( nEntry != ITEMPOS_INVALID ) && ( nEntry != nHighlightedItem ) )
+ {
+ ChangeHighlightItem( nEntry, ImplIsMouseFollow() ? FALSE : TRUE );
+ }
+ else
+ {
+ KillActivePopup();
+ ChangeHighlightItem( ITEMPOS_INVALID, FALSE );
+ }
+}
+
+void MenuBarWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+}
+
+void MenuBarWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ // Im Move nur Highlighten, wenn schon eins gehighlightet.
+ if ( rMEvt.IsSynthetic() || rMEvt.IsLeaveWindow() || ( nHighlightedItem == ITEMPOS_INVALID ) )
+ return;
+
+ USHORT nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
+ if ( ( nEntry != ITEMPOS_INVALID ) && ( nEntry != nHighlightedItem )
+ && ( ImplIsMouseFollow() || ( rMEvt.GetButtons() == MOUSE_LEFT ) ) )
+ ChangeHighlightItem( nEntry, FALSE );
+}
+
+void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllowRestoreFocus )
+{
+ // #57934# ggf. das aktive Popup sofort schliessen, damit TH's Hintergrundsicherung funktioniert.
+ MenuItemData* pNextData = pMenu->pItemList->GetDataFromPos( n );
+ if ( pActivePopup && pActivePopup->ImplGetWindow() && ( !pNextData || ( pActivePopup != pNextData->pSubMenu ) ) )
+ KillActivePopup(); // pActivePopup ggf. ohne pWin, wenn in Activate() Rescheduled wurde
+
+ // Activate am MenuBar immer nur einmal pro Vorgang...
+ BOOL bJustActivated = FALSE;
+ if ( ( nHighlightedItem == ITEMPOS_INVALID ) && ( n != ITEMPOS_INVALID ) )
+ {
+ ImplGetSVData()->maWinData.mbNoDeactivate = TRUE;
+ nSaveFocusId = Window::SaveFocus();
+ pMenu->bInCallback = TRUE; // hier schon setzen, falls Activate ueberladen
+ pMenu->Activate();
+ pMenu->bInCallback = FALSE;
+ bJustActivated = TRUE;
+ }
+ else if ( ( nHighlightedItem != ITEMPOS_INVALID ) && ( n == ITEMPOS_INVALID ) )
+ {
+ pMenu->bInCallback = TRUE;
+ pMenu->Deactivate();
+ pMenu->bInCallback = FALSE;
+ ULONG nTempFocusId = nSaveFocusId;
+ nSaveFocusId = 0;
+ ImplGetSVData()->maWinData.mbNoDeactivate = FALSE;
+ Window::EndSaveFocus( nTempFocusId, bAllowRestoreFocus );
+ }
+
+ if ( nHighlightedItem != ITEMPOS_INVALID )
+ HighlightItem( nHighlightedItem, FALSE );
+
+ nHighlightedItem = (USHORT)n;
+ DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" );
+ HighlightItem( nHighlightedItem, TRUE );
+ pMenu->ImplCallHighlight( nHighlightedItem );
+
+ if ( mbAutoPopup )
+ ImplCreatePopup( bSelectEntry );
+
+ // #58935# #73659# Focus, wenn kein Popup drunter haengt...
+ if ( bJustActivated && !pActivePopup )
+ GrabFocus();
+}
+
+void MenuBarWindow::HighlightItem( USHORT nPos, BOOL bHighlight )
+{
+ long nX = 0;
+ ULONG nCount = pMenu->pItemList->Count();
+ for ( ULONG n = 0; n < nCount; n++ )
+ {
+ MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
+ if ( n == nPos )
+ {
+ if ( pData->eType != MENUITEM_SEPARATOR )
+ {
+ if ( bHighlight )
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuHighlightColor() );
+ else
+ SetFillColor( GetSettings().GetStyleSettings().GetMenuColor() );
+
+ DrawRect( Rectangle( Point( nX, 1 ), Size( pData->aSz.Width(), pData->aSz.Height()-2 ) ) );
+ pMenu->ImplPaint( this, 0, 0, pData, bHighlight );
+ }
+ return;
+ }
+
+ nX += pData->aSz.Width();
+ }
+}
+
+void MenuBarWindow::KeyInput( const KeyEvent& rKEvent )
+{
+ if ( !ImplHandleKeyEvent( rKEvent ) )
+ Window::KeyInput( rKEvent );
+}
+
+BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu )
+{
+ if ( pMenu->bInCallback )
+ return TRUE; // schlucken
+
+ BOOL bDone = FALSE;
+ USHORT nCode = rKEvent.GetKeyCode().GetCode();
+ if ( nCode == KEY_MENU )
+ {
+ mbAutoPopup = FALSE;
+ if ( nHighlightedItem == ITEMPOS_INVALID )
+ {
+ ChangeHighlightItem( 0, FALSE );
+ GrabFocus();
+ }
+ else
+ {
+ ChangeHighlightItem( ITEMPOS_INVALID, FALSE );
+ nSaveFocusId = 0;
+ }
+ bDone = TRUE;
+ }
+ else if ( bFromMenu )
+ {
+ if ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) )
+ {
+ USHORT n = nHighlightedItem;
+ if ( n == ITEMPOS_INVALID )
+ {
+ if ( nCode == KEY_LEFT)
+ n = 0;
+ else
+ n = pMenu->GetItemCount()-1;
+ }
+
+ USHORT nLoop = n;
+ do
+ {
+ if ( nCode == KEY_LEFT )
+ {
+ if ( n )
+ n--;
+ else
+ n = pMenu->GetItemCount()-1;
+ }
+ else
+ {
+ n++;
+ if ( n >= pMenu->GetItemCount() )
+ n = 0;
+ }
+
+ MenuItemData* pData = (MenuItemData*)pMenu->GetItemList()->GetDataFromPos( n );
+ if ( ( pData->eType != MENUITEM_SEPARATOR ) && pMenu->ImplIsVisible( n ) )
+ {
+ ChangeHighlightItem( n, TRUE );
+ break;
+ }
+ } while ( n != nLoop );
+ bDone = TRUE;
+ }
+ else if ( nCode == KEY_RETURN )
+ {
+ KillActivePopup();
+ bDone = TRUE;
+ }
+ else if ( ( nCode == KEY_UP ) || ( nCode == KEY_DOWN ) )
+ {
+ if ( !mbAutoPopup )
+ {
+ ImplCreatePopup( TRUE );
+ mbAutoPopup = TRUE;
+ }
+ bDone = TRUE;
+ }
+ else if ( nCode == KEY_ESCAPE)
+ {
+ ChangeHighlightItem( ITEMPOS_INVALID, FALSE );
+ bDone = TRUE;
+ }
+ }
+
+ if ( !bDone && ( bFromMenu || rKEvent.GetKeyCode().IsControlMod() ) )
+ {
+ xub_Unicode nCharCode = rKEvent.GetCharCode();
+ if ( nCharCode )
+ {
+ USHORT nEntry;
+ MenuItemData* pData = pMenu->GetItemList()->SearchItem( nCharCode, nEntry );
+ if ( pData && (nEntry != ITEMPOS_INVALID) )
+ {
+ mbAutoPopup = TRUE;
+ ChangeHighlightItem( nEntry, TRUE );
+ bDone = TRUE;
+ }
+ else
+ {
+ // Wegen Systemmenu und anderen System-HotKeys, nur
+ // eigenstaendige Character-Kombinationen auswerten
+ USHORT nKeyCode = rKEvent.GetKeyCode().GetCode();
+ if ( !nKeyCode ||
+ ((nKeyCode >= KEY_A) && (nKeyCode <= KEY_Z)) )
+ Sound::Beep();
+ }
+ }
+ }
+ return bDone;
+}
+
+void MenuBarWindow::Paint( const Rectangle& rRect )
+{
+ pMenu->ImplPaint( this, 0 );
+ if ( nHighlightedItem != ITEMPOS_INVALID )
+ HighlightItem( nHighlightedItem, TRUE );
+}
+
+void MenuBarWindow::Resize()
+{
+ Size aOutSz = GetOutputSizePixel();
+ long n = aOutSz.Height()-4;
+ long nX = aOutSz.Width()-3;
+ long nY = 2;
+
+ ULONG nStyle = GetSettings().GetStyleSettings().GetOptions();
+ if ( nStyle & (STYLE_OPTION_OS2STYLE | STYLE_OPTION_UNIXSTYLE | STYLE_OPTION_MACSTYLE) )
+ {
+ if ( nStyle & STYLE_OPTION_OS2STYLE )
+ {
+ nX += 3;
+ nY -= 2;
+ n += 4;
+ }
+
+ if ( aFloatBtn.IsVisible() )
+ {
+ nX -= n;
+ aFloatBtn.SetPosSizePixel( nX, nY, n, n );
+ }
+ if ( aHideBtn.IsVisible() )
+ {
+ nX -= n;
+ aHideBtn.SetPosSizePixel( nX, nY, n, n );
+ }
+ if ( nStyle & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE) )
+ {
+ if ( aFloatBtn.IsVisible() || aHideBtn.IsVisible() )
+ nX -= 3;
+ }
+ if ( aCloser.IsVisible() )
+ {
+ nX -= n;
+ aCloser.SetPosSizePixel( nX, nY, n, n );
+ }
+ }
+ else
+ {
+ if ( aCloser.IsVisible() )
+ {
+ nX -= n;
+ aCloser.SetPosSizePixel( nX, nY, n, n );
+ nX -= 3;
+ }
+ if ( aFloatBtn.IsVisible() )
+ {
+ nX -= n;
+ aFloatBtn.SetPosSizePixel( nX, nY, n, n );
+ }
+ if ( aHideBtn.IsVisible() )
+ {
+ nX -= n;
+ aHideBtn.SetPosSizePixel( nX, nY, n, n );
+ }
+ }
+
+ if ( nStyle & STYLE_OPTION_OS2STYLE )
+ aFloatBtn.SetSymbol( SYMBOL_OS2FLOAT );
+ else
+ aFloatBtn.SetSymbol( SYMBOL_FLOAT );
+ if ( nStyle & STYLE_OPTION_OS2STYLE )
+ aHideBtn.SetSymbol( SYMBOL_OS2HIDE );
+ else
+ aHideBtn.SetSymbol( SYMBOL_HIDE );
+ if ( nStyle & STYLE_OPTION_OS2STYLE )
+ aCloser.SetSymbol( SYMBOL_OS2CLOSE );
+ else
+ aCloser.SetSymbol( SYMBOL_CLOSE );
+}
+
+USHORT MenuBarWindow::ImplFindEntry( const Point& rMousePos ) const
+{
+ long nX = 0;
+ USHORT nCount = (USHORT)pMenu->pItemList->Count();
+ for ( USHORT n = 0; n < nCount; n++ )
+ {
+ MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
+ if ( pMenu->ImplIsVisible( n ) )
+ {
+ nX += pData->aSz.Width();
+ if ( nX > rMousePos.X() )
+ return (USHORT)n;
+ }
+ }
+ return ITEMPOS_INVALID;
+}
+
+void MenuBarWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nId = nHighlightedItem;
+ if ( rHEvt.GetMode() & (HELPMODE_CONTEXT | HELPMODE_EXTENDED) )
+ ChangeHighlightItem( ITEMPOS_INVALID, TRUE );
+ if( !ImplHandleHelpEvent( this, pMenu, nId, rHEvt ) )
+ Window::RequestHelp( rHEvt );
+}
+
+BOOL MenuBarWindow::QueryDrop( DropEvent& rDEvt )
+{
+ Window* pW = GetParent()->ImplGetWindow();
+ DropEvent aEvent( ImplTranslateDropEvent( rDEvt, this, pW ) );
+ BOOL bRet = pW->QueryDrop( aEvent );
+ rDEvt = aEvent;
+ return bRet;
+}
+
+BOOL MenuBarWindow::Drop( const DropEvent& rDEvt )
+{
+ Window* pW = GetParent()->ImplGetWindow();
+ return pW->Drop( ImplTranslateDropEvent( rDEvt, this, pW ) );
+}
+
+
+void MenuBarWindow::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( ( nType == STATE_CHANGE_CONTROLFOREGROUND ) ||
+ ( nType == STATE_CHANGE_CONTROLBACKGROUND ) )
+ {
+ ImplInitMenuWindow( this, FALSE );
+ Invalidate();
+ }
+}
+
+void MenuBarWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ ImplInitMenuWindow( this, TRUE );
+ // Falls sich der Font geaendert hat.
+ long nHeight = pMenu->ImplCalcSize( this ).Height();
+ SetPosSizePixel( 0, 0, 0, nHeight, WINDOW_POSSIZE_HEIGHT );
+ GetParent()->Resize();
+ Invalidate();
+ Resize();
+ }
+}
+
+void MenuBarWindow::LoseFocus()
+{
+ if ( !HasChildPathFocus( TRUE ) )
+ ChangeHighlightItem( ITEMPOS_INVALID, FALSE, FALSE );
+}
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
new file mode 100644
index 000000000000..ea1b7b0cea29
--- /dev/null
+++ b/vcl/source/window/mnemonic.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * $RCSfile: mnemonic.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_MNEMONIC_CXX
+
+#include <string.h>
+#include <svapp.hxx>
+#include <settings.hxx>
+#include <mnemonic.hxx>
+
+#include <unohelp.hxx>
+
+#ifndef _COM_SUN_STAR_LANG_XCHARACTERCLASSIFICATION_HPP_
+#include <com/sun/star/lang/XCharacterClassification.hpp>
+#endif
+
+using namespace ::com::sun::star;
+
+
+// =======================================================================
+
+ImplMnemonicGenerator::ImplMnemonicGenerator()
+{
+ memset( maMnemonics, 1, sizeof( maMnemonics ) );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ImplMnemonicGenerator::ImplGetMnemonicIndex( sal_Unicode c )
+{
+ static USHORT const aImplMnemonicRangeTab[MNEMONIC_RANGES*2] =
+ {
+ MNEMONIC_RANGE_1_START, MNEMONIC_RANGE_1_END,
+ MNEMONIC_RANGE_2_START, MNEMONIC_RANGE_2_END,
+ MNEMONIC_RANGE_3_START, MNEMONIC_RANGE_3_END,
+ MNEMONIC_RANGE_4_START, MNEMONIC_RANGE_4_END
+ };
+
+ USHORT nMnemonicIndex = 0;
+ for ( USHORT i = 0; i < MNEMONIC_RANGES; i++ )
+ {
+ if ( (c >= aImplMnemonicRangeTab[i*2]) &&
+ (c <= aImplMnemonicRangeTab[i*2+1]) )
+ return nMnemonicIndex+c-aImplMnemonicRangeTab[i*2];
+
+ nMnemonicIndex += aImplMnemonicRangeTab[i*2+1]-aImplMnemonicRangeTab[i*2];
+ }
+
+ return MNEMONIC_INDEX_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Unicode ImplMnemonicGenerator::ImplFindMnemonic( const XubString& rKey )
+{
+ xub_StrLen nIndex = 0;
+ while ( (nIndex = rKey.Search( MNEMONIC_CHAR, nIndex )) != STRING_NOTFOUND )
+ {
+ sal_Unicode cMnemonic = rKey.GetChar( nIndex+1 );
+ if ( cMnemonic != MNEMONIC_CHAR )
+ return cMnemonic;
+ nIndex += 2;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplMnemonicGenerator::RegisterMnemonic( const XubString& rKey )
+{
+ const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale();
+ uno::Reference < lang::XCharacterClassification > xCharClass = GetCharClass();
+
+ XubString aKey = xCharClass->toUpper( rKey, 0, rKey.Len(), rLocale );
+
+ // If we find a Mnemonic, set the flag. In other case count the
+ // characters, because we need this to set most as possible
+ // Mnemonics
+ sal_Unicode cMnemonic = ImplFindMnemonic( aKey );
+ if ( cMnemonic )
+ {
+ USHORT nMnemonicIndex = ImplGetMnemonicIndex( cMnemonic );
+ if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
+ maMnemonics[nMnemonicIndex] = 0;
+ }
+ else
+ {
+ xub_StrLen nIndex = 0;
+ xub_StrLen nLen = aKey.Len();
+ while ( nIndex < nLen )
+ {
+ sal_Unicode c = aKey.GetChar( nIndex );
+
+ USHORT nMnemonicIndex = ImplGetMnemonicIndex( c );
+ if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
+ {
+ if ( maMnemonics[nMnemonicIndex] && (maMnemonics[nMnemonicIndex] < 0xFF) )
+ maMnemonics[nMnemonicIndex]++;
+ }
+
+ nIndex++;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplMnemonicGenerator::CreateMnemonic( XubString& rKey )
+{
+ if ( !rKey.Len() || ImplFindMnemonic( rKey ) )
+ return FALSE;
+
+ const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale();
+ uno::Reference < lang::XCharacterClassification > xCharClass = GetCharClass();
+
+ XubString aKey = xCharClass->toUpper( rKey, 0, rKey.Len(), rLocale );
+
+ BOOL bChanged = FALSE;
+ xub_StrLen nLen = aKey.Len();
+
+ // 1) Anfangsbuchstaben werden bevorzugt
+ USHORT nMnemonicIndex;
+ sal_Unicode c;
+ xub_StrLen nIndex = 0;
+ do
+ {
+ c = aKey.GetChar( nIndex );
+ nMnemonicIndex = ImplGetMnemonicIndex( c );
+ if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
+ {
+ if ( maMnemonics[nMnemonicIndex] )
+ {
+ maMnemonics[nMnemonicIndex] = 0;
+ rKey.Insert( MNEMONIC_CHAR, nIndex );
+ bChanged = TRUE;
+ break;
+ }
+ }
+
+ // Search for next word
+ do
+ {
+ nIndex++;
+ c = aKey.GetChar( nIndex );
+ if ( c == ' ' )
+ break;
+ }
+ while ( nIndex < nLen );
+ nIndex++;
+ }
+ while ( nIndex < nLen );
+
+ // 2) Eindeutiger/seltender Buchstabe enthalten?
+ if ( !bChanged )
+ {
+ USHORT nBestCount = 0xFFFF;
+ USHORT nBestMnemonicIndex;
+ xub_StrLen nBestIndex;
+ nIndex = 0;
+ do
+ {
+ c = aKey.GetChar( nIndex );
+ nMnemonicIndex = ImplGetMnemonicIndex( c );
+ if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND )
+ {
+ if ( maMnemonics[nMnemonicIndex] )
+ {
+ if ( maMnemonics[nMnemonicIndex] < nBestCount )
+ {
+ nBestCount = maMnemonics[nMnemonicIndex];
+ nBestIndex = nIndex;
+ nBestMnemonicIndex = nMnemonicIndex;
+ if ( nBestCount == 2 )
+ break;
+ }
+ }
+ }
+
+ nIndex++;
+ }
+ while ( nIndex < nLen );
+
+ if ( nBestCount != 0xFFFF )
+ {
+ maMnemonics[nBestMnemonicIndex] = 0;
+ rKey.Insert( MNEMONIC_CHAR, nBestIndex );
+ bChanged = TRUE;
+ }
+ }
+
+ return bChanged;
+}
+
+uno::Reference< lang::XCharacterClassification > ImplMnemonicGenerator::GetCharClass()
+{
+ if ( !xCharClass.is() )
+ xCharClass = vcl::unohelper::CreateCharacterClassification();
+ return xCharClass;
+}
+
+
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
new file mode 100644
index 000000000000..ce045114c1ae
--- /dev/null
+++ b/vcl/source/window/msgbox.cxx
@@ -0,0 +1,548 @@
+/*************************************************************************
+ *
+ * $RCSfile: msgbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_MSGBOX_CXX
+
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_METRIC_HXX
+#include <metric.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_FIXED_HXX
+#include <fixed.hxx>
+#endif
+#ifndef _SV_SOUND_HXX
+#include <sound.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <msgbox.hxx>
+#endif
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+static void ImplInitMsgBoxImageList()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maWinData.mpMsgBoxImgList )
+ {
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_MSGBOX, ImplGetResMgr() ) );
+ pSVData->maWinData.mpMsgBoxImgList = new ImageList( aBmp, Color( 0xC0, 0xC0, 0xC0 ), 4 );
+ }
+}
+
+// =======================================================================
+
+void MessBox::ImplInitData()
+{
+ mpFixedText = NULL;
+ mpFixedImage = NULL;
+ mnSoundType = 0;
+ mbHelpBtn = FALSE;
+ mbSound = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void MessBox::ImplInitButtons()
+{
+ WinBits nStyle = GetStyle();
+ USHORT nOKFlags = 0;
+ USHORT nCancelFlags = BUTTONDIALOG_CANCELBUTTON;
+ USHORT nRetryFlags = 0;
+ USHORT nYesFlags = 0;
+ USHORT nNoFlags = 0;
+
+ if ( nStyle & WB_OK_CANCEL )
+ {
+ if ( nStyle & WB_DEF_CANCEL )
+ nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+ else // WB_DEF_OK
+ nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+
+ AddButton( BUTTON_OK, BUTTONID_OK, nOKFlags );
+ AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
+ }
+ else if ( nStyle & WB_YES_NO )
+ {
+ if ( nStyle & WB_DEF_YES )
+ nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+ else // WB_DEF_NO
+ nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+ nNoFlags |= BUTTONDIALOG_CANCELBUTTON;
+
+ AddButton( BUTTON_YES, BUTTONID_YES, nYesFlags );
+ AddButton( BUTTON_NO, BUTTONID_NO, nNoFlags );
+ }
+ else if ( nStyle & WB_YES_NO_CANCEL )
+ {
+ if ( nStyle & WB_DEF_YES )
+ nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+ else if ( nStyle & WB_DEF_NO )
+ nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+ else
+ nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+
+ AddButton( BUTTON_YES, BUTTONID_YES, nYesFlags );
+ AddButton( BUTTON_NO, BUTTONID_NO, nNoFlags );
+ AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
+ }
+ else if ( nStyle & WB_RETRY_CANCEL )
+ {
+ if ( nStyle & WB_DEF_CANCEL )
+ nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+ else // WB_DEF_RETRY
+ nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+
+ AddButton( BUTTON_RETRY, BUTTONID_RETRY, nRetryFlags );
+ AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
+
+ }
+ else if ( nStyle & WB_OK )
+ {
+ nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_CANCELBUTTON | BUTTONDIALOG_FOCUSBUTTON;
+
+ AddButton( BUTTON_OK, BUTTONID_OK, nOKFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MessBox::MessBox( WindowType nType ) :
+ ButtonDialog( WINDOW_MESSBOX )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+MessBox::MessBox( Window* pParent, WinBits nStyle,
+ const XubString& rTitle, const XubString& rMessage ) :
+ ButtonDialog( WINDOW_MESSBOX ),
+ maMessText( rMessage )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
+ ImplInitButtons();
+
+ if ( rTitle.Len() )
+ SetText( rTitle );
+}
+
+// -----------------------------------------------------------------------
+
+MessBox::MessBox( Window* pParent, const ResId& rResId ) :
+ ButtonDialog( WINDOW_MESSBOX )
+{
+ ImplInitData();
+
+ GetRes( rResId.SetRT( RSC_MESSBOX ) );
+ USHORT nHiButtons = ReadShortRes();
+ USHORT nLoButtons = ReadShortRes();
+ USHORT nHiDefButton = ReadShortRes();
+ USHORT nLoDefButton = ReadShortRes();
+ USHORT nHiHelpId = ReadShortRes();
+ USHORT nLoHelpId = ReadShortRes();
+ USHORT bSysModal = ReadShortRes();
+ SetHelpId( ((ULONG)nHiHelpId << 16) + nLoHelpId );
+ WinBits nBits = (((ULONG)nHiButtons << 16) + nLoButtons) |
+ (((ULONG)nHiDefButton << 16) + nLoDefButton);
+ ImplInit( pParent, nBits | WB_MOVEABLE | WB_HORZ | WB_CENTER );
+
+ ImplLoadRes( rResId );
+ ImplInitButtons();
+}
+
+// -----------------------------------------------------------------------
+
+void MessBox::ImplLoadRes( const ResId& rResId )
+{
+ SetText( ReadStringRes() );
+ SetMessText( ReadStringRes() );
+ SetHelpText( ReadStringRes() );
+}
+
+// -----------------------------------------------------------------------
+
+MessBox::~MessBox()
+{
+ if ( mpFixedText )
+ delete mpFixedText;
+ if ( mpFixedImage )
+ delete mpFixedImage;
+}
+
+// -----------------------------------------------------------------------
+
+void MessBox::ImplPosControls()
+{
+ if ( GetHelpId() )
+ {
+ if ( !mbHelpBtn )
+ {
+ AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 3 );
+ mbHelpBtn = TRUE;
+ }
+ }
+ else
+ {
+ if ( mbHelpBtn )
+ {
+ RemoveButton( BUTTONID_HELP );
+ mbHelpBtn = FALSE;
+ }
+ }
+
+ XubString aMessText( maMessText );
+ TextRectInfo aTextInfo;
+ Rectangle aRect( 0, 0, 30000, 30000 );
+ Rectangle aFormatRect;
+ Point aTextPos( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+IMPL_MSGBOX_OFFSET_EXTRA_Y );
+ Size aImageSize;
+ Size aPageSize;
+ Size aFixedSize;
+ long nTitleWidth;
+ long nButtonSize = ImplGetButtonSize();
+ long nMaxWidth = GetDesktopRectPixel().GetWidth()-8;
+ long nMaxLineWidth;
+ long nWidth;
+ WinBits nWinStyle = WB_LEFT | WB_WORDBREAK | WB_NOLABEL | WB_INFO;
+ USHORT nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT;
+
+ if ( mpFixedText )
+ delete mpFixedText;
+ if ( mpFixedImage )
+ {
+ delete mpFixedImage;
+ mpFixedImage = NULL;
+ }
+
+ // Message-Text um Tabs bereinigen
+ XubString aTabStr( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+ USHORT nIndex = 0;
+ while ( nIndex != STRING_NOTFOUND )
+ nIndex = aMessText.SearchAndReplace( '\t', aTabStr, nIndex );
+
+ // Wenn Fenster zu schmall, machen wir Dialog auch breiter
+ if ( mbFrame )
+ nMaxWidth = 630;
+ else if ( nMaxWidth < 120 )
+ nMaxWidth = 120;
+
+ nMaxWidth -= mnLeftBorder+mnRightBorder+4;
+
+ // MessageBox sollte min. so breit sein, das auch Title sichtbar ist
+ // Extra-Width for Closer, because Closer is set after this call
+ nTitleWidth = CalcTitleWidth();
+ nTitleWidth += mnTopBorder;
+
+ nMaxWidth -= (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
+
+ // Wenn wir ein Image haben, dann deren Groesse ermitteln und das
+ // entsprechende Control anlegen und positionieren
+ aImageSize = maImage.GetSizePixel();
+ if ( aImageSize.Width() )
+ {
+ aImageSize.Width() += 4;
+ aImageSize.Height() += 4;
+ aTextPos.X() += aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
+ mpFixedImage = new FixedImage( this );
+ mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X,
+ IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
+ aImageSize );
+ mpFixedImage->SetImage( maImage );
+ mpFixedImage->Show();
+ nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
+ }
+ else
+ aTextPos.X() += IMPL_MSGBOX_OFFSET_EXTRA_X;
+
+ // Maximale Zeilenlaenge ohne Wordbreak ermitteln
+ aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
+ nMaxLineWidth = aFormatRect.GetWidth();
+ nTextStyle |= TEXT_DRAW_WORDBREAK;
+
+ // Breite fuer Textformatierung ermitteln
+ if ( nMaxLineWidth > 450 )
+ nWidth = 450;
+ else if ( nMaxLineWidth > 300 )
+ nWidth = nMaxLineWidth+5;
+ else
+ nWidth = 300;
+ if ( nButtonSize > nWidth )
+ nWidth = nButtonSize-(aTextPos.X()-IMPL_DIALOG_OFFSET);
+ if ( nWidth > nMaxWidth )
+ nWidth = nMaxWidth;
+
+ aRect.Right() = nWidth;
+ aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
+ if ( aTextInfo.GetMaxLineWidth() > nWidth )
+ {
+ nWidth = aTextInfo.GetMaxLineWidth()+8;
+ aRect.Right() = nWidth;
+ aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
+ }
+
+ // Style fuer FixedText ermitteln
+ aPageSize.Width() = aImageSize.Width();
+ aFixedSize.Width() = aTextInfo.GetMaxLineWidth()+1;
+ aFixedSize.Height() = aFormatRect.GetHeight();
+ if ( aFixedSize.Height() < aImageSize.Height() )
+ {
+ nWinStyle |= WB_VCENTER;
+ aPageSize.Height() = aImageSize.Height();
+ aFixedSize.Height() = aImageSize.Height();
+ }
+ else
+ {
+ nWinStyle |= WB_TOP;
+ aPageSize.Height() = aFixedSize.Height();
+ }
+ if ( aImageSize.Width() )
+ aPageSize.Width() += IMPL_SEP_MSGBOX_IMAGE;
+ aPageSize.Width() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
+ aPageSize.Width() += aFixedSize.Width()+1;
+ aPageSize.Height() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
+ if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH )
+ aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH;
+ if ( aPageSize.Width() < nTitleWidth )
+ aPageSize.Width() = nTitleWidth;
+ mpFixedText = new FixedText( this, nWinStyle );
+ mpFixedText->SetPosSizePixel( aTextPos, aFixedSize );
+ mpFixedText->SetText( aMessText );
+ mpFixedText->Show();
+ SetPageSizePixel( aPageSize );
+}
+
+// -----------------------------------------------------------------------
+
+void MessBox::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ ImplPosControls();
+ if ( mbSound && mnSoundType )
+ Sound::Beep( (SoundType)(mnSoundType-1), this );
+ }
+ ButtonDialog::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void InfoBox::ImplInitData()
+{
+ // Default Text is the display title from the application
+ if ( !GetText().Len() )
+ SetText( Application::GetDisplayName() );
+
+ SetImage( InfoBox::GetStandardImage() );
+}
+
+// -----------------------------------------------------------------------
+
+InfoBox::InfoBox( Window* pParent, const XubString& rMessage ) :
+ MessBox( pParent, WB_OK | WB_DEF_OK, ImplGetSVEmptyStr(), rMessage )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+InfoBox::InfoBox( Window* pParent, const ResId & rResId ) :
+ MessBox( pParent, rResId.SetRT( RSC_INFOBOX ) )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+Image InfoBox::GetStandardImage()
+{
+ ImplInitMsgBoxImageList();
+ return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 );
+}
+
+// -----------------------------------------------------------------------
+
+void WarningBox::ImplInitData()
+{
+ // Default Text is the display title from the application
+ if ( !GetText().Len() )
+ SetText( Application::GetDisplayName() );
+
+ SetImage( WarningBox::GetStandardImage() );
+ mnSoundType = ((USHORT)SOUND_WARNING)+1;
+}
+
+// -----------------------------------------------------------------------
+
+WarningBox::WarningBox( Window* pParent, WinBits nStyle,
+ const XubString& rMessage ) :
+ MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+WarningBox::WarningBox( Window* pParent, const ResId& rResId ) :
+ MessBox( pParent, rResId.SetRT( RSC_WARNINGBOX ) )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+Image WarningBox::GetStandardImage()
+{
+ ImplInitMsgBoxImageList();
+ return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 );
+}
+
+// -----------------------------------------------------------------------
+
+void ErrorBox::ImplInitData()
+{
+ // Default Text is the display title from the application
+ if ( !GetText().Len() )
+ SetText( Application::GetDisplayName() );
+
+ SetImage( ErrorBox::GetStandardImage() );
+ mnSoundType = ((USHORT)SOUND_ERROR)+1;
+}
+
+// -----------------------------------------------------------------------
+
+ErrorBox::ErrorBox( Window* pParent, WinBits nStyle,
+ const XubString& rMessage ) :
+ MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+ErrorBox::ErrorBox( Window* pParent, const ResId& rResId ) :
+ MessBox( pParent, rResId.SetRT( RSC_ERRORBOX ) )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+Image ErrorBox::GetStandardImage()
+{
+ ImplInitMsgBoxImageList();
+ return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 );
+}
+
+// -----------------------------------------------------------------------
+
+void QueryBox::ImplInitData()
+{
+ // Default Text is the display title from the application
+ if ( !GetText().Len() )
+ SetText( Application::GetDisplayName() );
+
+ SetImage( QueryBox::GetStandardImage() );
+ mnSoundType = ((USHORT)SOUND_QUERY)+1;
+}
+
+// -----------------------------------------------------------------------
+
+QueryBox::QueryBox( Window* pParent, WinBits nStyle, const XubString& rMessage ) :
+ MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+QueryBox::QueryBox( Window* pParent, const ResId& rResId ) :
+ MessBox( pParent, rResId.SetRT( RSC_QUERYBOX ) )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+Image QueryBox::GetStandardImage()
+{
+ ImplInitMsgBoxImageList();
+ return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 );
+}
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
new file mode 100644
index 000000000000..13b6a1075e91
--- /dev/null
+++ b/vcl/source/window/scrwnd.cxx
@@ -0,0 +1,420 @@
+/*************************************************************************
+ *
+ * $RCSfile: scrwnd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <math.h>
+#include <limits.h>
+#include <tools/debug.hxx>
+#include "svids.hrc"
+#include "svdata.hxx"
+#include "timer.hxx"
+#include "scrwnd.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+#define WHEEL_WIDTH 25
+#define WHEEL_RADIUS ((WHEEL_WIDTH) >> 1 )
+#define MAX_TIME 300
+#define MIN_TIME 20
+#define DEF_TIMEOUT 50
+
+// -------------------
+// - ImplWheelWindow -
+// -------------------
+
+ImplWheelWindow::ImplWheelWindow( Window* pParent ) :
+ FloatingWindow ( pParent, 0 ),
+ mnRepaintTime ( 1UL ),
+ mnActDist ( 0UL ),
+ mnWheelMode ( WHEELMODE_NONE ),
+ mnActDeltaX ( 0L ),
+ mnActDeltaY ( 0L ),
+ mnTimeout ( DEF_TIMEOUT )
+{
+ // we need a parent
+ DBG_ASSERT( pParent, "ImplWheelWindow::ImplWheelWindow(): Parent not set!" );
+
+ const Size aSize( pParent->GetOutputSizePixel() );
+ const USHORT nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags;
+ const BOOL bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0;
+ const BOOL bVert = ( nFlags & AUTOSCROLL_VERT ) != 0;
+
+ // calculate maximum speed distance
+ mnMaxWidth = (ULONG) ( 0.4 * hypot( (double) aSize.Width(), aSize.Height() ) );
+
+ // create wheel window
+ SetTitleType( FLOATWIN_TITLE_NONE );
+ ImplCreateImageList();
+ ImplSetRegion( Bitmap( ResId( SV_RESID_BITMAP_SCROLLMSK, ImplGetResMgr() ) ) );
+
+ // set wheel mode
+ if( bHorz && bVert )
+ ImplSetWheelMode( WHEELMODE_VH );
+ else if( bHorz )
+ ImplSetWheelMode( WHEELMODE_H );
+ else
+ ImplSetWheelMode( WHEELMODE_V );
+
+ // init timer
+ mpTimer = new Timer;
+ mpTimer->SetTimeoutHdl( LINK( this, ImplWheelWindow, ImplScrollHdl ) );
+ mpTimer->SetTimeout( mnTimeout );
+ mpTimer->Start();
+
+ CaptureMouse();
+}
+
+// ------------------------------------------------------------------------
+
+ImplWheelWindow::~ImplWheelWindow()
+{
+ ReleaseMouse();
+ mpTimer->Stop();
+ delete mpTimer;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::ImplSetRegion( const Bitmap& rRegionBmp )
+{
+ Point aPos( GetPointerPosPixel() );
+ const Size aSize( rRegionBmp.GetSizePixel() );
+ Point aPoint;
+ const Rectangle aRect( aPoint, aSize );
+
+ maCenter = maLastMousePos = aPos;
+ aPos.X() -= aSize.Width() >> 1;
+ aPos.Y() -= aSize.Height() >> 1;
+
+ SetPosSizePixel( aPos, aSize );
+ SetWindowRegionPixel( rRegionBmp.CreateRegion( COL_BLACK, aRect ) );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::ImplCreateImageList()
+{
+ Bitmap aImgBmp( ResId( SV_RESID_BITMAP_SCROLLBMP, ImplGetResMgr() ) );
+ maImgList = ImageList( aImgBmp, 6 );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::ImplSetWheelMode( ULONG nWheelMode )
+{
+ if( nWheelMode != mnWheelMode )
+ {
+ mnWheelMode = nWheelMode;
+
+ if( WHEELMODE_NONE == mnWheelMode )
+ {
+ if( IsVisible() )
+ Hide();
+ }
+ else
+ {
+ if( !IsVisible() )
+ Show();
+
+ ImplDrawWheel();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::ImplDrawWheel()
+{
+ USHORT nId;
+
+ switch( mnWheelMode )
+ {
+ case( WHEELMODE_VH ): nId = 1; break;
+ case( WHEELMODE_V ): nId = 2; break;
+ case( WHEELMODE_H ): nId = 3; break;
+ case( WHEELMODE_SCROLL_VH ):nId = 4; break;
+ case( WHEELMODE_SCROLL_V ): nId = 5; break;
+ case( WHEELMODE_SCROLL_H ): nId = 6; break;
+ default: nId = 0; break;
+ }
+
+ if( nId )
+ DrawImage( Point(), maImgList.GetImage( nId ) );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::ImplRecalcScrollValues()
+{
+ if( mnActDist < WHEEL_RADIUS )
+ {
+ mnActDeltaX = mnActDeltaY = 0L;
+ mnTimeout = DEF_TIMEOUT;
+ }
+ else
+ {
+ ULONG nCurTime;
+
+ // calc current time
+ if( mnMaxWidth )
+ {
+ const double fExp = ( (double) mnActDist / mnMaxWidth ) * log10( (double) MAX_TIME / MIN_TIME );
+ nCurTime = (ULONG) ( MAX_TIME / pow( 10., fExp ) );
+ }
+ else
+ nCurTime = MAX_TIME;
+
+ if( !nCurTime )
+ nCurTime = 1UL;
+
+ if( mnRepaintTime <= nCurTime )
+ mnTimeout = nCurTime - mnRepaintTime;
+ else
+ {
+ long nMult = mnRepaintTime / nCurTime;
+
+ if( !( mnRepaintTime % nCurTime ) )
+ mnTimeout = 0UL;
+ else
+ mnTimeout = ++nMult * nCurTime - mnRepaintTime;
+
+ double fValX = (double) mnActDeltaX * nMult;
+ double fValY = (double) mnActDeltaY * nMult;
+
+ if( fValX > LONG_MAX )
+ mnActDeltaX = LONG_MAX;
+ else if( fValX < LONG_MIN )
+ mnActDeltaX = LONG_MIN;
+ else
+ mnActDeltaX = (long) fValX;
+
+ if( fValY > LONG_MAX )
+ mnActDeltaY = LONG_MAX;
+ else if( fValY < LONG_MIN )
+ mnActDeltaY = LONG_MIN;
+ else
+ mnActDeltaY = (long) fValY;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+PointerStyle ImplWheelWindow::ImplGetMousePointer( long nDistX, long nDistY )
+{
+ PointerStyle eStyle;
+ const USHORT nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags;
+ const BOOL bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0;
+ const BOOL bVert = ( nFlags & AUTOSCROLL_VERT ) != 0;
+
+ if( bHorz || bVert )
+ {
+ if( mnActDist < WHEEL_RADIUS )
+ {
+ if( bHorz && bVert )
+ eStyle = POINTER_AUTOSCROLL_NSWE;
+ else if( bHorz )
+ eStyle = POINTER_AUTOSCROLL_WE;
+ else
+ eStyle = POINTER_AUTOSCROLL_NS;
+ }
+ else
+ {
+ double fAngle = atan2( (double) -nDistY, nDistX ) / F_PI180;
+
+ if( fAngle < 0.0 )
+ fAngle += 360.;
+
+ if( bHorz && bVert )
+ {
+ if( fAngle >= 22.5 && fAngle <= 67.5 )
+ eStyle = POINTER_AUTOSCROLL_NE;
+ else if( fAngle >= 67.5 && fAngle <= 112.5 )
+ eStyle = POINTER_AUTOSCROLL_N;
+ else if( fAngle >= 112.5 && fAngle <= 157.5 )
+ eStyle = POINTER_AUTOSCROLL_NW;
+ else if( fAngle >= 157.5 && fAngle <= 202.5 )
+ eStyle = POINTER_AUTOSCROLL_W;
+ else if( fAngle >= 202.5 && fAngle <= 247.5 )
+ eStyle = POINTER_AUTOSCROLL_SW;
+ else if( fAngle >= 247.5 && fAngle <= 292.5 )
+ eStyle = POINTER_AUTOSCROLL_S;
+ else if( fAngle >= 292.5 && fAngle <= 337.5 )
+ eStyle = POINTER_AUTOSCROLL_SE;
+ else
+ eStyle = POINTER_AUTOSCROLL_E;
+ }
+ else if( bHorz )
+ {
+ if( fAngle >= 270. || fAngle <= 90. )
+ eStyle = POINTER_AUTOSCROLL_E;
+ else
+ eStyle = POINTER_AUTOSCROLL_W;
+ }
+ else
+ {
+ if( fAngle >= 0. && fAngle <= 180. )
+ eStyle = POINTER_AUTOSCROLL_N;
+ else
+ eStyle = POINTER_AUTOSCROLL_S;
+ }
+ }
+ }
+ else
+ eStyle = POINTER_ARROW;
+
+ return eStyle;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::Paint( const Rectangle& rRect )
+{
+ ImplDrawWheel();
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ FloatingWindow::MouseMove( rMEvt );
+
+ const Point aMousePos( OutputToScreenPixel( rMEvt.GetPosPixel() ) );
+ const long nDistX = aMousePos.X() - maCenter.X();
+ const long nDistY = aMousePos.Y() - maCenter.Y();
+
+ mnActDist = (ULONG) hypot( (double) nDistX, nDistY );
+
+ const PointerStyle eActStyle = ImplGetMousePointer( nDistX, nDistY );
+ const USHORT nFlags = ImplGetSVData()->maWinData.mnAutoScrollFlags;
+ const BOOL bHorz = ( nFlags & AUTOSCROLL_HORZ ) != 0;
+ const BOOL bVert = ( nFlags & AUTOSCROLL_VERT ) != 0;
+ const BOOL bOuter = mnActDist > WHEEL_RADIUS;
+
+ if( bOuter && ( maLastMousePos != aMousePos ) )
+ {
+ switch( eActStyle )
+ {
+ case( POINTER_AUTOSCROLL_N ): mnActDeltaX = +0L, mnActDeltaY = +1L; break;
+ case( POINTER_AUTOSCROLL_S ): mnActDeltaX = +0L, mnActDeltaY = -1L; break;
+ case( POINTER_AUTOSCROLL_W ): mnActDeltaX = +1L, mnActDeltaY = +0L; break;
+ case( POINTER_AUTOSCROLL_E ): mnActDeltaX = -1L, mnActDeltaY = +0L; break;
+ case( POINTER_AUTOSCROLL_NW ): mnActDeltaX = +1L, mnActDeltaY = +1L; break;
+ case( POINTER_AUTOSCROLL_NE ): mnActDeltaX = -1L, mnActDeltaY = +1L; break;
+ case( POINTER_AUTOSCROLL_SW ): mnActDeltaX = +1L, mnActDeltaY = -1L; break;
+ case( POINTER_AUTOSCROLL_SE ): mnActDeltaX = -1L, mnActDeltaY = -1L; break;
+
+ default:
+ break;
+ }
+ }
+
+ ImplRecalcScrollValues();
+ maLastMousePos = aMousePos;
+ SetPointer( eActStyle );
+
+ if( bHorz && bVert )
+ ImplSetWheelMode( bOuter ? WHEELMODE_SCROLL_VH : WHEELMODE_VH );
+ else if( bHorz )
+ ImplSetWheelMode( bOuter ? WHEELMODE_SCROLL_H : WHEELMODE_H );
+ else
+ ImplSetWheelMode( bOuter ? WHEELMODE_SCROLL_V : WHEELMODE_V );
+}
+
+// ------------------------------------------------------------------------
+
+void ImplWheelWindow::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if( mnActDist > WHEEL_RADIUS )
+ GetParent()->EndAutoScroll();
+ else
+ FloatingWindow::MouseButtonUp( rMEvt );
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, pTimer )
+{
+ if ( mnActDeltaX || mnActDeltaY )
+ {
+ Window* pWindow = GetParent();
+ const Point aMousePos( pWindow->OutputToScreenPixel( pWindow->GetPointerPosPixel() ) );
+ Point aCmdMousePos( pWindow->ImplFrameToOutput( aMousePos ) );
+ CommandScrollData aScrollData( mnActDeltaX, mnActDeltaY );
+ CommandEvent aCEvt( aCmdMousePos, COMMAND_AUTOSCROLL, TRUE, &aScrollData );
+ NotifyEvent aNCmdEvt( EVENT_COMMAND, pWindow, &aCEvt );
+
+ if ( !ImplCallPreNotify( aNCmdEvt ) )
+ {
+ const ULONG nTime = Time::GetSystemTicks();
+ pWindow->Command( aCEvt );
+ mnRepaintTime = Max( Time::GetSystemTicks() - nTime, 1UL );
+ ImplRecalcScrollValues();
+ }
+ }
+
+ if ( mnTimeout != mpTimer->GetTimeout() )
+ mpTimer->SetTimeout( mnTimeout );
+ mpTimer->Start();
+
+ return 0L;
+}
diff --git a/vcl/source/window/scrwnd.hxx b/vcl/source/window/scrwnd.hxx
new file mode 100644
index 000000000000..885c55267b18
--- /dev/null
+++ b/vcl/source/window/scrwnd.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: scrwnd.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <floatwin.hxx>
+#include <bitmap.hxx>
+#include <image.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+#define WHEELMODE_NONE 0x00000000UL
+#define WHEELMODE_VH 0x00000001UL
+#define WHEELMODE_V 0x00000002UL
+#define WHEELMODE_H 0x00000004UL
+#define WHEELMODE_SCROLL_VH 0x00000008UL
+#define WHEELMODE_SCROLL_V 0x00000010UL
+#define WHEELMODE_SCROLL_H 0x00000020UL
+
+// -------------------
+// - ImplWheelWindow -
+// -------------------
+
+class Timer;
+
+class ImplWheelWindow : public FloatingWindow
+{
+private:
+
+ ImageList maImgList;
+ Bitmap maWheelBmp;
+ CommandScrollData maCommandScrollData;
+ Point maLastMousePos;
+ Point maCenter;
+ Timer* mpTimer;
+ ULONG mnRepaintTime;
+ ULONG mnTimeout;
+ ULONG mnWheelMode;
+ ULONG mnMaxWidth;
+ ULONG mnActWidth;
+ ULONG mnActDist;
+ long mnActDeltaX;
+ long mnActDeltaY;
+
+ void ImplCreateImageList();
+ void ImplSetRegion( const Bitmap& rRegionBmp );
+ PointerStyle ImplGetMousePointer( long nDistX, long nDistY );
+ void ImplDrawWheel();
+ void ImplRecalcScrollValues();
+
+ DECL_LINK( ImplScrollHdl, Timer* pTimer );
+
+protected:
+
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+public:
+
+ ImplWheelWindow( Window* pParent );
+ ~ImplWheelWindow();
+
+ void ImplSetWheelMode( ULONG nWheelMode );
+ ULONG ImplGetWheelMode() const { return mnWheelMode; }
+};
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
new file mode 100644
index 000000000000..8fd3b665aa8a
--- /dev/null
+++ b/vcl/source/window/seleng.cxx
@@ -0,0 +1,506 @@
+/*************************************************************************
+ *
+ * $RCSfile: seleng.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/ref.hxx>
+#include <window.hxx>
+#include <seleng.hxx>
+#include <tools/debug.hxx>
+
+#pragma hdrstop
+
+// TODO: FunctionSet::SelectAtPoint raus
+
+/*************************************************************************
+|*
+|* SelectionEngine::SelectionEngine()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet ) :
+ pWin( pWindow )
+{
+ eSelMode = SINGLE_SELECTION;
+ pFunctionSet = pFuncSet;
+ nFlags = SELENG_EXPANDONMOVE;
+ nLockedMods = 0;
+
+ aWTimer.SetTimeoutHdl( LINK( this, SelectionEngine, ImpWatchDog ) );
+ aWTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::~SelectionEngine()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+SelectionEngine::~SelectionEngine()
+{
+ aWTimer.Stop();
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::ImpWatchDog()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+IMPL_LINK( SelectionEngine, ImpWatchDog, Timer*, EMPTYARG )
+{
+ if ( !aArea.IsInside( aLastMove.GetPosPixel() ) )
+ SelMouseMove( aLastMove );
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::SetSelectionMode()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+void SelectionEngine::SetSelectionMode( SelectionMode eMode )
+{
+ eSelMode = eMode;
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::ActivateDragMode()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+void SelectionEngine::ActivateDragMode()
+{
+ DBG_ERRORFILE( "SelectionEngine::ActivateDragMode not implemented" );
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::CursorPosChanging()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+void SelectionEngine::CursorPosChanging( BOOL bShift, BOOL /* bMod1 */ )
+{
+ if ( !pFunctionSet )
+ return;
+
+ if ( bShift && eSelMode != SINGLE_SELECTION )
+ {
+ if ( IsAddMode() )
+ {
+ if ( !(nFlags & SELENG_HAS_ANCH) )
+ {
+ pFunctionSet->CreateAnchor();
+ nFlags |= SELENG_HAS_ANCH;
+ }
+ }
+ else
+ {
+ if ( !(nFlags & SELENG_HAS_ANCH) )
+ {
+ pFunctionSet->DeselectAll();
+ pFunctionSet->CreateAnchor();
+ nFlags |= SELENG_HAS_ANCH;
+ }
+ }
+ }
+ else
+ {
+ if ( IsAddMode() )
+ {
+ if ( nFlags & SELENG_HAS_ANCH )
+ {
+ // pFunctionSet->CreateCursor();
+ pFunctionSet->DestroyAnchor();
+ nFlags &= (~SELENG_HAS_ANCH);
+ }
+ }
+ else
+ {
+ pFunctionSet->DeselectAll();
+ nFlags &= (~SELENG_HAS_ANCH);
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::SelMouseButtonDown()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 07.06.95
+|*
+*************************************************************************/
+
+BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
+{
+ nFlags &= (~SELENG_CMDEVT);
+ if ( !pFunctionSet || !pWin || rMEvt.GetClicks() > 1 || rMEvt.IsRight() )
+ return FALSE;
+
+ USHORT nModifier = rMEvt.GetModifier() | nLockedMods;
+ if ( nModifier & KEY_MOD2 )
+ return FALSE;
+ // in SingleSelection: Control-Taste filtern (damit auch
+ // mit Ctrl-Click ein D&D gestartet werden kann)
+ if ( nModifier == KEY_MOD1 && eSelMode == SINGLE_SELECTION )
+ nModifier = 0;
+
+ Point aPos = rMEvt.GetPosPixel();
+ aLastMove = rMEvt;
+
+ pWin->CaptureMouse();
+ nFlags |= SELENG_IN_SEL;
+
+ switch ( nModifier )
+ {
+ case 0: // KEY_NO_KEY
+ {
+ BOOL bSelAtPoint = pFunctionSet->IsSelectionAtPoint( aPos );
+ nFlags &= (~SELENG_IN_ADD);
+ if ( (nFlags & SELENG_DRG_ENAB) && bSelAtPoint )
+ {
+ nFlags |= SELENG_WAIT_UPEVT;
+ nFlags &= ~(SELENG_IN_SEL);
+ pWin->ReleaseMouse();
+ return TRUE; //auf STARTDRAG-Command-Event warten
+ }
+ if ( eSelMode != SINGLE_SELECTION )
+ {
+ if( !IsAddMode() )
+ pFunctionSet->DeselectAll();
+ else
+ pFunctionSet->DestroyAnchor();
+ nFlags &= (~SELENG_HAS_ANCH); // bHasAnchor = FALSE;
+ }
+ pFunctionSet->SetCursorAtPoint( aPos );
+ // Sonderbehandlung Single-Selection, damit Select+Drag
+ // in einem Zug moeglich ist
+ if (eSelMode == SINGLE_SELECTION && (nFlags & SELENG_DRG_ENAB))
+ nFlags |= SELENG_WAIT_UPEVT;
+ return TRUE;
+ }
+
+ case KEY_SHIFT:
+ if ( eSelMode == SINGLE_SELECTION )
+ {
+ pWin->ReleaseMouse();
+ nFlags &= (~SELENG_IN_SEL);
+ return FALSE;
+ }
+ if ( nFlags & SELENG_ADD_ALW )
+ nFlags |= SELENG_IN_ADD;
+ else
+ nFlags &= (~SELENG_IN_ADD);
+
+ if( !(nFlags & SELENG_HAS_ANCH) )
+ {
+ if ( !(nFlags & SELENG_IN_ADD) )
+ pFunctionSet->DeselectAll();
+ pFunctionSet->CreateAnchor();
+ nFlags |= SELENG_HAS_ANCH;
+ }
+ pFunctionSet->SetCursorAtPoint( aPos );
+ return TRUE;
+
+ case KEY_MOD1:
+ // Control nur bei Mehrfachselektion erlaubt
+ if ( eSelMode != MULTIPLE_SELECTION )
+ {
+ nFlags &= (~SELENG_IN_SEL);
+ pWin->ReleaseMouse();
+ return TRUE; // Mausclick verschlucken
+ }
+ if ( nFlags & SELENG_HAS_ANCH )
+ {
+ // pFunctionSet->CreateCursor();
+ pFunctionSet->DestroyAnchor();
+ nFlags &= (~SELENG_HAS_ANCH);
+ }
+ if ( pFunctionSet->IsSelectionAtPoint( aPos ) )
+ {
+ pFunctionSet->DeselectAtPoint( aPos );
+ pFunctionSet->SetCursorAtPoint( aPos, TRUE );
+ }
+ else
+ {
+ pFunctionSet->SetCursorAtPoint( aPos );
+ }
+ return TRUE;
+
+ case KEY_SHIFT + KEY_MOD1:
+ if ( eSelMode != MULTIPLE_SELECTION )
+ {
+ pWin->ReleaseMouse();
+ nFlags &= (~SELENG_IN_SEL);
+ return FALSE;
+ }
+ nFlags |= SELENG_IN_ADD; //bIsInAddMode = TRUE;
+ if ( !(nFlags & SELENG_HAS_ANCH) )
+ {
+ pFunctionSet->CreateAnchor();
+ nFlags |= SELENG_HAS_ANCH;
+ }
+ pFunctionSet->SetCursorAtPoint( aPos );
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::SelMouseButtonUp()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& /* rMEvt */ )
+{
+ aWTimer.Stop();
+ //DbgOut("Up");
+ if( !pFunctionSet || !pWin )
+ {
+ nFlags &= ~(SELENG_CMDEVT | SELENG_WAIT_UPEVT | SELENG_IN_SEL);
+ return FALSE;
+ }
+ pWin->ReleaseMouse();
+
+ if( (nFlags & SELENG_WAIT_UPEVT) && !(nFlags & SELENG_CMDEVT) &&
+ eSelMode != SINGLE_SELECTION)
+ {
+ // MouseButtonDown in Sel aber kein CommandEvent eingetrudelt
+ // ==> deselektieren
+ USHORT nModifier = aLastMove.GetModifier() | nLockedMods;
+ if( nModifier == KEY_MOD1 || IsAlwaysAdding() )
+ {
+ if( !(nModifier & KEY_SHIFT) )
+ {
+ pFunctionSet->DestroyAnchor();
+ nFlags &= (~SELENG_HAS_ANCH); // nix Anker
+ }
+ pFunctionSet->DeselectAtPoint( aLastMove.GetPosPixel() );
+ nFlags &= (~SELENG_HAS_ANCH); // nix Anker
+ pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel(), TRUE );
+ }
+ else
+ {
+ pFunctionSet->DeselectAll();
+ nFlags &= (~SELENG_HAS_ANCH); // nix Anker
+ pFunctionSet->SetCursorAtPoint( aLastMove.GetPosPixel() );
+ }
+ }
+
+ nFlags &= ~(SELENG_CMDEVT | SELENG_WAIT_UPEVT | SELENG_IN_SEL);
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::SelMouseMove()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+BOOL SelectionEngine::SelMouseMove( const MouseEvent& rMEvt )
+{
+
+ if ( !pFunctionSet || !(nFlags & SELENG_IN_SEL) ||
+ (nFlags & (SELENG_CMDEVT | SELENG_WAIT_UPEVT)) )
+ return FALSE;
+
+ if( !(nFlags & SELENG_EXPANDONMOVE) )
+ return FALSE; // auf DragEvent warten!
+
+ aLastMove = rMEvt;
+ // wenn die Maus ausserhalb der Area steht, dann wird die
+ // Frequenz des SetCursorAtPoint() nur durch den Timer bestimmt
+ if( aWTimer.IsActive() && !aArea.IsInside( rMEvt.GetPosPixel() ))
+ return TRUE;
+
+
+ aWTimer.Start();
+ if ( eSelMode != SINGLE_SELECTION )
+ {
+ if ( !(nFlags & SELENG_HAS_ANCH) )
+ {
+ pFunctionSet->CreateAnchor();
+ //DbgOut("Move:Creating anchor");
+ nFlags |= SELENG_HAS_ANCH;
+ }
+ }
+
+ //DbgOut("Move:SetCursor");
+ pFunctionSet->SetCursorAtPoint( rMEvt.GetPosPixel() );
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::SetWindow()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 10.10.94
+|* Letzte Aenderung OV 10.10.94
+|*
+*************************************************************************/
+
+void SelectionEngine::SetWindow( Window* pNewWin )
+{
+ if( pNewWin != pWin )
+ {
+ if ( pWin && (nFlags & SELENG_IN_SEL) )
+ pWin->ReleaseMouse();
+ pWin = pNewWin;
+ if ( pWin && ( nFlags & SELENG_IN_SEL ) )
+ pWin->CaptureMouse();
+ }
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::Reset()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 07.07.95
+|* Letzte Aenderung OV 07.07.95
+|*
+*************************************************************************/
+
+void SelectionEngine::Reset()
+{
+ aWTimer.Stop();
+ if ( nFlags & SELENG_IN_SEL )
+ pWin->ReleaseMouse();
+ nFlags &= ~(SELENG_HAS_ANCH | SELENG_IN_SEL);
+ nLockedMods = 0;
+}
+
+/*************************************************************************
+|*
+|* SelectionEngine::Command()
+|*
+|* Beschreibung SELENG.SDW
+|* Ersterstellung OV 07.07.95
+|* Letzte Aenderung OV 07.07.95
+|*
+*************************************************************************/
+
+void SelectionEngine::Command( const CommandEvent& rCEvt )
+{
+ // Timer aWTimer ist beim Aufspannen einer Selektion aktiv
+ if ( !pFunctionSet || !pWin || aWTimer.IsActive() )
+ return;
+ aWTimer.Stop();
+ nFlags |= SELENG_CMDEVT;
+ if ( rCEvt.GetCommand() == COMMAND_STARTDRAG )
+ {
+ if ( nFlags & SELENG_DRG_ENAB )
+ {
+ DBG_ASSERT( rCEvt.IsMouseEvent(), "STARTDRAG: Not a MouseEvent" );
+ if ( pFunctionSet->IsSelectionAtPoint( rCEvt.GetMousePosPixel() ) )
+ {
+ aLastMove = MouseEvent( rCEvt.GetMousePosPixel(),
+ aLastMove.GetClicks(), aLastMove.GetMode(),
+ aLastMove.GetButtons(), aLastMove.GetModifier() );
+ pFunctionSet->BeginDrag();
+ nFlags &= ~(SELENG_CMDEVT|SELENG_WAIT_UPEVT|SELENG_IN_SEL);
+ }
+ else
+ nFlags &= ~SELENG_CMDEVT;
+ }
+ else
+ nFlags &= ~SELENG_CMDEVT;
+ }
+}
diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx
new file mode 100644
index 000000000000..440b550b720a
--- /dev/null
+++ b/vcl/source/window/split.cxx
@@ -0,0 +1,365 @@
+/*************************************************************************
+ *
+ * $RCSfile: split.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SPLIT_CXX
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SPLIT_HXX
+#include <split.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+void Splitter::ImplInitData()
+{
+ mpRefWin = NULL;
+ mnSplitPos = 0;
+ mnLastSplitPos = 0;
+ mnStartSplitPos = 0;
+ mbDragFull = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::ImplInit( Window* pParent, WinBits nWinStyle )
+{
+ Window::ImplInit( pParent, nWinStyle, NULL );
+
+ mpRefWin = pParent;
+
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ long nA = rSettings.GetScrollBarSize();
+ long nB = rSettings.GetSplitSize();
+
+ PointerStyle ePointerStyle;
+
+ if ( nWinStyle & WB_HSCROLL )
+ {
+ ePointerStyle = POINTER_HSPLIT;
+ mbHorzSplit = TRUE;
+ SetSizePixel( Size( nB, nA ) );
+ }
+ else
+ {
+ ePointerStyle = POINTER_VSPLIT;
+ mbHorzSplit = FALSE;
+ SetSizePixel( Size( nA, nB ) );
+ }
+
+ SetPointer( Pointer( ePointerStyle ) );
+ SetBackground( Wallpaper( Color( COL_BLACK ) ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::ImplSplitMousePos( Point& rPos )
+{
+ if ( mbHorzSplit )
+ {
+ if ( rPos.X() > maDragRect.Right()-1 )
+ rPos.X() = maDragRect.Right()-1;
+ if ( rPos.X() < maDragRect.Left()+1 )
+ rPos.X() = maDragRect.Left()+1;
+ }
+ else
+ {
+ if ( rPos.Y() > maDragRect.Bottom()-1 )
+ rPos.Y() = maDragRect.Bottom()-1;
+ if ( rPos.Y() < maDragRect.Top()+1 )
+ rPos.Y() = maDragRect.Top()+1;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::ImplDrawSplitter()
+{
+ Rectangle aInvRect( maDragRect );
+
+ if ( mbHorzSplit )
+ {
+ aInvRect.Left() = maDragPos.X() - 1;
+ aInvRect.Right() = maDragPos.X() + 1;
+ }
+ else
+ {
+ aInvRect.Top() = maDragPos.Y() - 1;
+ aInvRect.Bottom() = maDragPos.Y() + 1;
+ }
+
+ mpRefWin->InvertTracking( aInvRect, SHOWTRACK_SPLIT );
+}
+
+// -----------------------------------------------------------------------
+
+Splitter::Splitter( Window* pParent, WinBits nStyle ) :
+ Window( WINDOW_SPLITTER )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+Splitter::Splitter( Window* pParent, const ResId& rResId ) :
+ Window( WINDOW_SPLITTER )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_SPLITTER );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+Splitter::~Splitter()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.GetClicks() == 2 )
+ {
+ if ( mnLastSplitPos != mnSplitPos )
+ {
+ StartSplit();
+ Point aPos = rMEvt.GetPosPixel();
+ if ( mbHorzSplit )
+ aPos.X() = mnLastSplitPos;
+ else
+ aPos.Y() = mnLastSplitPos;
+ ImplSplitMousePos( aPos );
+ Splitting( aPos );
+ ImplSplitMousePos( aPos );
+ long nTemp = mnSplitPos;
+ if ( mbHorzSplit )
+ SetSplitPosPixel( aPos.X() );
+ else
+ SetSplitPosPixel( aPos.Y() );
+ mnLastSplitPos = nTemp;
+ Split();
+ }
+ }
+ else
+ StartDrag();
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( !mbDragFull )
+ ImplDrawSplitter();
+
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ long nNewPos;
+ if ( mbHorzSplit )
+ nNewPos = maDragPos.X();
+ else
+ nNewPos = maDragPos.Y();
+ if ( nNewPos != mnStartSplitPos )
+ {
+ SetSplitPosPixel( nNewPos );
+ mnLastSplitPos = 0;
+ Split();
+ }
+ }
+ else if ( mbDragFull )
+ {
+ SetSplitPosPixel( mnStartSplitPos );
+ Split();
+ }
+ mnStartSplitPos = 0;
+ }
+ else
+ {
+ Point aNewPos = mpRefWin->ScreenToOutputPixel( OutputToScreenPixel( rTEvt.GetMouseEvent().GetPosPixel() ) );
+ ImplSplitMousePos( aNewPos );
+ Splitting( aNewPos );
+ ImplSplitMousePos( aNewPos );
+
+ if ( mbHorzSplit )
+ {
+ if ( aNewPos.X() == maDragPos.X() )
+ return;
+ }
+ else
+ {
+ if ( aNewPos.Y() == maDragPos.Y() )
+ return;
+ }
+
+ if ( mbDragFull )
+ {
+ maDragPos = aNewPos;
+ long nNewPos;
+ if ( mbHorzSplit )
+ nNewPos = maDragPos.X();
+ else
+ nNewPos = maDragPos.Y();
+ if ( nNewPos != mnSplitPos )
+ {
+ SetSplitPosPixel( nNewPos );
+ mnLastSplitPos = 0;
+ Split();
+ }
+
+ GetParent()->Update();
+ }
+ else
+ {
+ ImplDrawSplitter();
+ maDragPos = aNewPos;
+ ImplDrawSplitter();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::StartSplit()
+{
+ maStartSplitHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::Split()
+{
+ maSplitHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::Splitting( Point& /* rSplitPos */ )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::SetDragRectPixel( const Rectangle& rDragRect, Window* _pRefWin )
+{
+ maDragRect = rDragRect;
+ if ( !_pRefWin )
+ mpRefWin = GetParent();
+ else
+ mpRefWin = _pRefWin;
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::SetSplitPosPixel( long nNewPos )
+{
+ mnSplitPos = nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::SetLastSplitPosPixel( long nNewPos )
+{
+ mnLastSplitPos = nNewPos;
+}
+
+// -----------------------------------------------------------------------
+
+void Splitter::StartDrag()
+{
+ if ( IsTracking() )
+ return;
+
+ StartSplit();
+
+ // Tracking starten
+ StartTracking();
+
+ // Start-Positon ermitteln
+ maDragPos = mpRefWin->GetPointerPosPixel();
+ ImplSplitMousePos( maDragPos );
+ Splitting( maDragPos );
+ ImplSplitMousePos( maDragPos );
+ if ( mbHorzSplit )
+ mnStartSplitPos = maDragPos.X();
+ else
+ mnStartSplitPos = maDragPos.Y();
+
+ mbDragFull = (Application::GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SPLIT) != 0;
+ if ( !mbDragFull )
+ ImplDrawSplitter();
+}
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
new file mode 100644
index 000000000000..907c98f56d4e
--- /dev/null
+++ b/vcl/source/window/splitwin.cxx
@@ -0,0 +1,3647 @@
+/*************************************************************************
+ *
+ * $RCSfile: splitwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SPLITWIN_CXX
+
+#include <string.h>
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RCID_H
+#include <rcid.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_WALL_HXX
+#include <wall.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_SYMBOL_HXX
+#include <symbol.hxx>
+#endif
+#ifndef _SV_SVIDS_HRC
+#include <svids.hrc>
+#endif
+#ifndef _SV_IMAGE_HXX
+#include <image.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#define private public
+#ifndef _SV_SPLITWIN_HXX
+#include <splitwin.hxx>
+#endif
+#undef private
+
+#pragma hdrstop
+
+// =======================================================================
+
+// Achtung: Darf keine Objekte enthalten, da mit memmove/memcpy gearbeitet wird
+struct ImplSplitItem
+{
+ long mnSize;
+ long mnPixSize;
+ long mnLeft;
+ long mnTop;
+ long mnWidth;
+ long mnHeight;
+ long mnSplitPos;
+ long mnSplitSize;
+ long mnOldSplitPos;
+ long mnOldSplitSize;
+ long mnOldWidth;
+ long mnOldHeight;
+ ImplSplitSet* mpSet;
+ Window* mpWindow;
+ Window* mpOrgParent;
+ USHORT mnId;
+ SplitWindowItemBits mnBits;
+ BOOL mbFixed;
+ BOOL mbSubSize;
+};
+
+struct ImplSplitSet
+{
+ ImplSplitItem* mpItems;
+ Wallpaper* mpWallpaper;
+ Bitmap* mpBitmap;
+ long mnLastSize;
+ long mnSplitSize;
+ USHORT mnItems;
+ USHORT mnId;
+ BOOL mbCalcPix;
+};
+
+#define SPLITWIN_SPLITSIZE 6
+#define SPLITWIN_SPLITSIZEEX 6
+#define SPLITWIN_SPLITSIZEAUTOHIDE 40
+#define SPLITWIN_SPLITSIZEFADE 40
+
+#define SPLIT_HORZ ((USHORT)0x0001)
+#define SPLIT_VERT ((USHORT)0x0002)
+#define SPLIT_WINDOW ((USHORT)0x0004)
+#define SPLIT_NOSPLIT ((USHORT)0x8000)
+
+// -----------------------------------------------------------------------
+
+DECLARE_LIST( ImplSplitList, SplitWindow* );
+
+// =======================================================================
+
+static void ImplCalcBorder( WindowAlign eAlign, BOOL bNoAlign,
+ long& rLeft, long& rTop,
+ long& rRight, long& rBottom )
+{
+ if ( bNoAlign )
+ {
+ rLeft = 2;
+ rTop = 2;
+ rRight = 2;
+ rBottom = 2;
+ }
+ else
+ {
+ if ( eAlign == WINDOWALIGN_TOP )
+ {
+ rLeft = 0;
+ rTop = 2;
+ rRight = 0;
+ rBottom = 0;
+ }
+ else if ( eAlign == WINDOWALIGN_LEFT )
+ {
+ rLeft = 2;
+ rTop = 2;
+ rRight = 0;
+ rBottom = 2;
+ }
+ else if ( eAlign == WINDOWALIGN_BOTTOM )
+ {
+ rLeft = 0;
+ rTop = 0;
+ rRight = 0;
+ rBottom = 2;
+ }
+ else
+ {
+ rLeft = 0;
+ rTop = 2;
+ rRight = 2;
+ rBottom = 2;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawBorder( SplitWindow* pWin )
+{
+ const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
+ long nDX = pWin->mnDX;
+ long nDY = pWin->mnDY;
+
+ if ( pWin->mbNoAlign )
+ {
+ DecorationView aDecoView( pWin );
+ Point aTmpPoint;
+ Rectangle aRect( aTmpPoint, Size( nDX, nDY ) );
+ aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+ }
+ else
+ {
+ if ( pWin->meAlign == WINDOWALIGN_BOTTOM )
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
+ }
+ else
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( 0, 1 ), Point( nDX-1, 1 ) );
+ if ( (pWin->meAlign == WINDOWALIGN_LEFT) || (pWin->meAlign == WINDOWALIGN_RIGHT) )
+ {
+ if ( pWin->meAlign == WINDOWALIGN_LEFT )
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
+ pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
+ pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
+ }
+ else
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
+ pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-2, nDY-2 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
+ pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, USHORT nId )
+{
+ if ( pSet->mnId == nId )
+ return pSet;
+
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnId == nId )
+ return pItems[i].mpSet;
+ }
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet )
+ {
+ ImplSplitSet* pFindSet = ImplFindSet( pItems[i].mpSet, nId );
+ if ( pFindSet )
+ return pFindSet;
+ }
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, USHORT nId, USHORT& rPos )
+{
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnId == nId )
+ {
+ rPos = i;
+ return pSet;
+ }
+ }
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet )
+ {
+ ImplSplitSet* pFindSet = ImplFindItem( pItems[i].mpSet, nId, rPos );
+ if ( pFindSet )
+ return pFindSet;
+ }
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplFindItem( ImplSplitSet* pSet, Window* pWindow )
+{
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpWindow == pWindow )
+ return pItems[i].mnId;
+ else
+ {
+ if ( pItems[i].mpSet )
+ {
+ USHORT nId = ImplFindItem( pItems[i].mpSet, pWindow );
+ if ( nId )
+ return nId;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
+ BOOL bRows, BOOL bDown = TRUE )
+{
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnWidth && pItems[i].mnHeight )
+ {
+ // Wegen ICC auftrennen
+ Point aPoint( pItems[i].mnLeft, pItems[i].mnTop );
+ Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
+ Rectangle aRect( aPoint, aSize );
+ if ( bRows )
+ {
+ if ( bDown )
+ aRect.Bottom() += pSet->mnSplitSize;
+ else
+ aRect.Top() -= pSet->mnSplitSize;
+ }
+ else
+ {
+ if ( bDown )
+ aRect.Right() += pSet->mnSplitSize;
+ else
+ aRect.Left() -= pSet->mnSplitSize;
+ }
+
+ if ( aRect.IsInside( rPos ) )
+ {
+ if ( pItems[i].mpSet && pItems[i].mpSet->mpItems )
+ {
+ return ImplFindItem( pItems[i].mpSet, rPos,
+ ((pItems[i].mnBits & SWIB_COLSET) == 0) );
+ }
+ else
+ return pItems[i].mnId;
+ }
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDeleteSet( ImplSplitSet* pSet )
+{
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet )
+ ImplDeleteSet( pItems[i].mpSet );
+ }
+
+ if ( pSet->mpWallpaper )
+ delete pSet->mpWallpaper;
+
+ if ( pSet->mpBitmap )
+ delete pSet->mpBitmap;
+
+ delete pItems;
+ delete pSet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSetSplitSize( ImplSplitSet* pSet, long nNewSize )
+{
+ pSet->mnSplitSize = nNewSize;
+ for ( USHORT i = 0; i < pSet->mnItems; i++ )
+ {
+ if ( pSet->mpItems[i].mpSet )
+ ImplSetSplitSize( pSet->mpItems[i].mpSet, nNewSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalcSet( ImplSplitSet* pSet,
+ long nSetLeft, long nSetTop,
+ long nSetWidth, long nSetHeight,
+ BOOL bRows, BOOL bDown = TRUE )
+{
+ if ( !pSet->mpItems )
+ return;
+
+ USHORT i;
+ USHORT j;
+ USHORT nMins;
+ USHORT nCalcItems;
+ USHORT nItems = pSet->mnItems;
+ USHORT nVisItems;
+ USHORT nAbsItems;
+ long nCalcSize;
+ long nSizeDelta;
+ long nCurSize;
+ long nSizeWinSize;
+ long nNewSizeWinSize;
+ long nTemp;
+ long nTempErr;
+ long nErrorSum;
+ long nCurSizeDelta;
+ long nPos;
+ long nMaxPos;
+ long* pSize;
+ ImplSplitItem* pItems = pSet->mpItems;
+ BOOL bEmpty;
+
+ // Anzahl sichtbarer Items ermitteln
+ nVisItems = 0;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
+ nVisItems++;
+ }
+
+ // Groessen berechnen
+ if ( bRows )
+ nCalcSize = nSetHeight;
+ else
+ nCalcSize = nSetWidth;
+ nCalcSize -= (nVisItems-1)*pSet->mnSplitSize;
+ nCurSize = 0;
+ if ( pSet->mbCalcPix || (pSet->mnLastSize != nCalcSize) )
+ {
+ long nPercentFactor = 10;
+ long nRelCount = 0;
+ long nPercent = 0;
+ long nRelPercent = 0;
+ long nAbsSize = 0;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
+ {
+ if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
+ nRelCount += pItems[i].mnSize;
+ else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
+ nPercent += pItems[i].mnSize;
+ else
+ nAbsSize += pItems[i].mnSize;
+ }
+ }
+ // Relative-Werte auf prozentual mappen (Percent bei uns 10tel Prozent)
+ nPercent *= nPercentFactor;
+ if ( nRelCount )
+ {
+ long nRelPercentBase = 1000;
+ while ( (nRelCount > nRelPercentBase) && (nPercentFactor < 100000) )
+ {
+ nRelPercentBase *= 10;
+ nPercentFactor *= 10;
+ }
+ if ( nPercent < nRelPercentBase )
+ {
+ nRelPercent = (nRelPercentBase-nPercent)/nRelCount;
+ nPercent += nRelPercent*nRelCount;
+ }
+ else
+ nRelPercent = 0;
+ }
+ if ( !nPercent )
+ nPercent = 1;
+ nSizeDelta = nCalcSize-nAbsSize;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnBits & SWIB_INVISIBLE )
+ pItems[i].mnPixSize = 0;
+ else if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
+ {
+ if ( nSizeDelta <= 0 )
+ pItems[i].mnPixSize = 0;
+ else
+ pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nRelPercent)/nPercent;
+ }
+ else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
+ {
+ if ( nSizeDelta <= 0 )
+ pItems[i].mnPixSize = 0;
+ else
+ pItems[i].mnPixSize = (nSizeDelta*pItems[i].mnSize*nPercentFactor)/nPercent;
+ }
+ else
+ pItems[i].mnPixSize = pItems[i].mnSize;
+ nCurSize += pItems[i].mnPixSize;
+ }
+
+ pSet->mbCalcPix = FALSE;
+ pSet->mnLastSize = nCalcSize;
+
+ // Fenster einpassen
+ nSizeDelta = nCalcSize-nCurSize;
+ if ( nSizeDelta )
+ {
+ nAbsItems = 0;
+ nSizeWinSize = 0;
+ nNewSizeWinSize = 0;
+
+ // Zuerst die absoluten Items relativ resizen
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
+ {
+ if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
+ {
+ nAbsItems++;
+ nSizeWinSize += pItems[i].mnPixSize;
+ }
+ }
+ }
+ // Rundungsfehler werden hier nicht ausgelichen
+ if ( (nAbsItems < (USHORT)(Abs( nSizeDelta ))) && nSizeWinSize )
+ {
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
+ {
+ if ( !(pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
+ {
+ pItems[i].mnPixSize += (nSizeDelta*pItems[i].mnPixSize)/nSizeWinSize;
+ nNewSizeWinSize += pItems[i].mnPixSize;
+ }
+ }
+ }
+ nSizeDelta -= nNewSizeWinSize-nSizeWinSize;
+ }
+
+ // Jetzt die Rundunsfehler ausgleichen
+ j = 0;
+ nMins = 0;
+ while ( nSizeDelta && (nItems != nMins) )
+ {
+ // Feststellen, welche Items berechnet werden duerfen
+ nCalcItems = 0;
+ while ( !nCalcItems )
+ {
+ for ( i = 0; i < nItems; i++ )
+ {
+ pItems[i].mbSubSize = FALSE;
+
+ if ( j >= 2 )
+ pItems[i].mbSubSize = TRUE;
+ else
+ {
+ if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
+ {
+ if ( (nSizeDelta > 0) || pItems[i].mnPixSize )
+ {
+ if ( j >= 1 )
+ pItems[i].mbSubSize = TRUE;
+ else
+ {
+ if ( (j == 0) && (pItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE)) )
+ pItems[i].mbSubSize = TRUE;
+ }
+ }
+ }
+ }
+
+ if ( pItems[i].mbSubSize )
+ nCalcItems++;
+ }
+
+ j++;
+ }
+
+ // Groessen von den einzelnen Items abziehen
+ nErrorSum = nSizeDelta % nCalcItems;
+ nCurSizeDelta = nSizeDelta / nCalcItems;
+ nMins = 0;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnBits & SWIB_INVISIBLE )
+ nMins++;
+ else if ( pItems[i].mbSubSize )
+ {
+ pSize = &(pItems[i].mnPixSize);
+
+ if ( nErrorSum )
+ {
+ if ( nErrorSum < 0 )
+ nTempErr = -1;
+ else
+ nTempErr = 1;
+ }
+ else
+ nTempErr = 0;
+
+ if ( (*pSize+nCurSizeDelta+nTempErr) <= 0 )
+ {
+ nTemp = *pSize;
+ if ( nTemp )
+ {
+ *pSize -= nTemp;
+ nSizeDelta += nTemp;
+ }
+ nMins++;
+ }
+ else
+ {
+ *pSize += nCurSizeDelta;
+ nSizeDelta -= nCurSizeDelta;
+ if ( nTempErr && (*pSize || (nTempErr > 0)) )
+ {
+ *pSize += nTempErr;
+ nSizeDelta -= nTempErr;
+ nErrorSum -= nTempErr;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
+ nCurSize += pItems[i].mnPixSize;
+ }
+ }
+
+ // Maximale Groesse berechnen
+ if ( bRows )
+ {
+ nPos = nSetTop;
+ if ( !bDown )
+ nMaxPos = nSetTop-nSetHeight;
+ else
+ nMaxPos = nSetTop+nSetHeight;
+ }
+ else
+ {
+ nPos = nSetLeft;
+ if ( !bDown )
+ nMaxPos = nSetLeft-nSetWidth;
+ else
+ nMaxPos = nSetLeft+nSetWidth;
+ }
+
+ // Fenster anordnen und Werte anpassen
+ for ( i = 0; i < nItems; i++ )
+ {
+ pItems[i].mnOldSplitPos = pItems[i].mnSplitPos;
+ pItems[i].mnOldSplitSize = pItems[i].mnSplitSize;
+ pItems[i].mnOldWidth = pItems[i].mnWidth;
+ pItems[i].mnOldHeight = pItems[i].mnHeight;
+
+ if ( pItems[i].mnBits & SWIB_INVISIBLE )
+ bEmpty = TRUE;
+ else
+ {
+ bEmpty = FALSE;
+ if ( bDown )
+ {
+ if ( nPos+pItems[i].mnPixSize > nMaxPos )
+ bEmpty = TRUE;
+ }
+ else
+ {
+ nPos -= pItems[i].mnPixSize;
+ if ( nPos < nMaxPos )
+ bEmpty = TRUE;
+ }
+ }
+
+ if ( bEmpty )
+ {
+ pItems[i].mnWidth = 0;
+ pItems[i].mnHeight = 0;
+ pItems[i].mnSplitSize = 0;
+ }
+ else
+ {
+ if ( bRows )
+ {
+ pItems[i].mnLeft = nSetLeft;
+ pItems[i].mnTop = nPos;
+ pItems[i].mnWidth = nSetWidth;
+ pItems[i].mnHeight = pItems[i].mnPixSize;
+ }
+ else
+ {
+ pItems[i].mnLeft = nPos;
+ pItems[i].mnTop = nSetTop;
+ pItems[i].mnWidth = pItems[i].mnPixSize;
+ pItems[i].mnHeight = nSetHeight;
+ }
+
+ if ( i > nItems-1 )
+ pItems[i].mnSplitSize = 0;
+ else
+ {
+ pItems[i].mnSplitSize = pSet->mnSplitSize;
+ if ( bDown )
+ {
+ pItems[i].mnSplitPos = nPos+pItems[i].mnPixSize;
+ if ( pItems[i].mnSplitPos+pItems[i].mnSplitSize > nMaxPos )
+ pItems[i].mnSplitSize = nMaxPos-pItems[i].mnSplitPos;
+ }
+ else
+ {
+ pItems[i].mnSplitPos = nPos-pSet->mnSplitSize;
+ if ( pItems[i].mnSplitPos < nMaxPos )
+ pItems[i].mnSplitSize = pItems[i].mnSplitPos+pSet->mnSplitSize-nMaxPos;
+ }
+ }
+ }
+
+ if ( !(pItems[i].mnBits & SWIB_INVISIBLE) )
+ {
+ if ( !bDown )
+ nPos -= pSet->mnSplitSize;
+ else
+ nPos += pItems[i].mnPixSize+pSet->mnSplitSize;
+ }
+ }
+
+ // Sub-Set's berechnen
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight )
+ {
+ ImplCalcSet( pItems[i].mpSet,
+ pItems[i].mnLeft, pItems[i].mnTop,
+ pItems[i].mnWidth, pItems[i].mnHeight,
+ ((pItems[i].mnBits & SWIB_COLSET) == 0) );
+ }
+ }
+
+ // Fixed setzen
+ for ( i = 0; i < nItems; i++ )
+ {
+ pItems[i].mbFixed = FALSE;
+ if ( pItems[i].mnBits & SWIB_FIXED )
+ pItems[i].mbFixed = TRUE;
+ else
+ {
+ // Wenn Child-Set vorhanden, ist dieses Item auch Fixed, wenn
+ // ein Child fixed ist
+ if ( pItems[i].mpSet )
+ {
+ for ( j = 0; j < pItems[i].mpSet->mnItems; j++ )
+ {
+ if ( pItems[i].mpSet->mpItems[j].mbFixed )
+ {
+ pItems[i].mbFixed = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, BOOL bHide,
+ BOOL bRows, BOOL bDown = TRUE )
+{
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate )
+ {
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnSplitSize )
+ {
+ // Evt. alles invalidieren oder nur einen kleinen Teil
+ if ( (pItems[i].mnOldSplitPos != pItems[i].mnSplitPos) ||
+ (pItems[i].mnOldSplitSize != pItems[i].mnSplitSize) ||
+ (pItems[i].mnOldWidth != pItems[i].mnWidth) ||
+ (pItems[i].mnOldHeight != pItems[i].mnHeight) )
+ {
+ Rectangle aRect;
+
+ // Old Rect invalidieren
+ if ( bRows )
+ {
+ aRect.Left() = pItems[i].mnLeft;
+ aRect.Right() = pItems[i].mnLeft+pItems[i].mnOldWidth-1;
+ aRect.Top() = pItems[i].mnOldSplitPos;
+ aRect.Bottom() = aRect.Top() + pItems[i].mnOldSplitSize;
+ }
+ else
+ {
+ aRect.Top() = pItems[i].mnTop;
+ aRect.Bottom() = pItems[i].mnTop+pItems[i].mnOldHeight-1;
+ aRect.Left() = pItems[i].mnOldSplitPos;
+ aRect.Right() = aRect.Left() + pItems[i].mnOldSplitSize;
+ }
+ pWindow->Invalidate( aRect );
+ // New Rect invalidieren
+ if ( bRows )
+ {
+ aRect.Left() = pItems[i].mnLeft;
+ aRect.Right() = pItems[i].mnLeft+pItems[i].mnWidth-1;
+ aRect.Top() = pItems[i].mnSplitPos;
+ aRect.Bottom() = aRect.Top() + pItems[i].mnSplitSize;
+ }
+ else
+ {
+ aRect.Top() = pItems[i].mnTop;
+ aRect.Bottom() = pItems[i].mnTop+pItems[i].mnHeight-1;
+ aRect.Left() = pItems[i].mnSplitPos;
+ aRect.Right() = aRect.Left() + pItems[i].mnSplitSize;
+ }
+ pWindow->Invalidate( aRect );
+
+ // Leere Sets komplett invalidieren, da diese Flaechen
+ // nicht von Fenstern ueberladen werden
+ if ( pItems[i].mpSet && !pItems[i].mpSet->mpItems )
+ {
+ aRect.Left() = pItems[i].mnLeft;
+ aRect.Top() = pItems[i].mnTop;
+ aRect.Right() = pItems[i].mnLeft+pItems[i].mnWidth-1;
+ aRect.Bottom() = pItems[i].mnTop+pItems[i].mnHeight-1;
+ pWindow->Invalidate( aRect );
+ }
+ }
+ }
+ }
+ }
+
+ // Fenster positionieren
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet )
+ {
+ BOOL bTempHide = bHide;
+ if ( !pItems[i].mnWidth || !pItems[i].mnHeight )
+ bTempHide = TRUE;
+ ImplCalcSet2( pWindow, pItems[i].mpSet, bTempHide,
+ ((pItems[i].mnBits & SWIB_COLSET) == 0) );
+ }
+ else
+ {
+ if ( pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
+ {
+ Point aPos( pItems[i].mnLeft, pItems[i].mnTop );
+ Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
+ pItems[i].mpWindow->SetPosSizePixel( aPos, aSize );
+ }
+ else
+ pItems[i].mpWindow->Hide();
+ }
+ }
+
+ // Fenster anzeigen und Flag zuruecksetzen
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpWindow && pItems[i].mnWidth && pItems[i].mnHeight && !bHide )
+ pItems[i].mpWindow->Show();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalcLogSize( ImplSplitItem* pItems, USHORT nItems )
+{
+ // Original-Groessen updaten
+ USHORT i;
+ long nRelSize = 0;
+ long nPerSize = 0;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
+ nRelSize += pItems[i].mnPixSize;
+ else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
+ nPerSize += pItems[i].mnPixSize;
+ }
+ nPerSize += nRelSize;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mnBits & SWIB_RELATIVESIZE )
+ {
+ if ( nRelSize )
+ pItems[i].mnSize = (pItems[i].mnPixSize+(nRelSize/2))/nRelSize;
+ else
+ pItems[i].mnSize = 1;
+ }
+ else if ( pItems[i].mnBits & SWIB_PERCENTSIZE )
+ {
+ if ( nPerSize )
+ pItems[i].mnSize = (pItems[i].mnPixSize*100)/nPerSize;
+ else
+ pItems[i].mnSize = 1;
+ }
+ else
+ pItems[i].mnSize = pItems[i].mnPixSize;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawBack( SplitWindow* pWindow, const Rectangle& rRect,
+ const Wallpaper* pWall, const Bitmap* pBitmap )
+{
+ if ( pBitmap )
+ {
+ Point aPos = rRect.TopLeft();
+ Size aBmpSize = pBitmap->GetSizePixel();
+ pWindow->Push( PUSH_CLIPREGION );
+ pWindow->IntersectClipRegion( rRect );
+ do
+ {
+ aPos.X() = rRect.Left();
+ do
+ {
+ pWindow->DrawBitmap( aPos, *pBitmap );
+ aPos.X() += aBmpSize.Width();
+ }
+ while ( aPos.X() < rRect.Right() );
+ aPos.Y() += aBmpSize.Height();
+ }
+ while ( aPos.Y() < rRect.Bottom() );
+ pWindow->Pop();
+ }
+ else
+ pWindow->DrawWallpaper( rRect, *pWall );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawBack( SplitWindow* pWindow, ImplSplitSet* pSet )
+{
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ // Beim Mainset auch den Hintergrund zeichnen
+ if ( pSet->mnId == 0 )
+ {
+ if ( pSet->mpBitmap )
+ {
+ Rectangle aRect( pWindow->mnLeftBorder,
+ pWindow->mnTopBorder,
+ pWindow->mnDX-pWindow->mnRightBorder-1,
+ pWindow->mnDY-pWindow->mnBottomBorder-1 );
+ ImplDrawBack( pWindow, aRect, pSet->mpWallpaper, pSet->mpBitmap );
+ }
+ }
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ pSet = pItems[i].mpSet;
+ if ( pSet )
+ {
+ if ( pSet->mpBitmap || pSet->mpWallpaper )
+ {
+ // Wegen ICC auftrennen
+ Point aPoint( pItems[i].mnLeft, pItems[i].mnTop );
+ Size aSize( pItems[i].mnWidth, pItems[i].mnHeight );
+ Rectangle aRect( aPoint, aSize );
+ ImplDrawBack( pWindow, aRect, pSet->mpWallpaper, pSet->mpBitmap );
+ }
+ }
+ }
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet )
+ ImplDrawBack( pWindow, pItems[i].mpSet );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawSplit( SplitWindow* pWindow, ImplSplitSet* pSet,
+ BOOL bRows, BOOL bDown = TRUE )
+{
+ if ( !pSet->mpItems )
+ return;
+
+ USHORT i;
+ USHORT nItems = pSet->mnItems;
+ long nPos;
+ long nTop;
+ long nBottom;
+ ImplSplitItem* pItems = pSet->mpItems;
+ const StyleSettings& rStyleSettings = pWindow->GetSettings().GetStyleSettings();
+
+ BOOL bFlat = (pWindow->GetStyle() & WB_FLATSPLITDRAW) == WB_FLATSPLITDRAW;
+
+ for ( i = 0; i < nItems-1; i++ )
+ {
+ if ( pItems[i].mnSplitSize )
+ {
+ nPos = pItems[i].mnSplitPos;
+
+ long nItemSplitSize = pItems[i].mnSplitSize;
+ long nSplitSize = pSet->mnSplitSize;
+ if ( bRows )
+ {
+ nTop = pItems[i].mnLeft;
+ nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
+
+ if ( bFlat ) nPos--;
+
+ if ( bDown || (nItemSplitSize >= nSplitSize) )
+ {
+ pWindow->SetLineColor( rStyleSettings.GetLightColor() );
+ pWindow->DrawLine( Point( nTop, nPos+1 ), Point( nBottom, nPos+1 ) );
+ }
+ nPos += nSplitSize-2;
+ if ( bFlat ) nPos+=2;
+ if ( (!bDown && (nItemSplitSize >= 2)) ||
+ (bDown && (nItemSplitSize >= nSplitSize-1)) )
+ {
+ pWindow->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWindow->DrawLine( Point( nTop, nPos ), Point( nBottom, nPos ) );
+ }
+ if ( !bFlat )
+ {
+ nPos++;
+ if ( !bDown || (nItemSplitSize >= nSplitSize) )
+ {
+ pWindow->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ pWindow->DrawLine( Point( nTop, nPos ), Point( nBottom, nPos ) );
+ }
+ }
+ }
+ else
+ {
+ nTop = pItems[i].mnTop;
+ nBottom = pItems[i].mnTop+pSet->mpItems[i].mnHeight-1;
+
+ if ( bFlat ) nPos--;
+ if ( bDown || (nItemSplitSize >= nSplitSize) )
+ {
+ pWindow->SetLineColor( rStyleSettings.GetLightColor() );
+ pWindow->DrawLine( Point( nPos+1, nTop ), Point( nPos+1, nBottom ) );
+ }
+ nPos += pSet->mnSplitSize-2;
+ if ( bFlat ) nPos+=2;
+ if ( (!bDown && (nItemSplitSize >= 2)) ||
+ (bDown && (nItemSplitSize >= nSplitSize-1)) )
+ {
+ pWindow->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWindow->DrawLine( Point( nPos, nTop ), Point( nPos, nBottom ) );
+ }
+ if( !bFlat )
+ {
+ nPos++;
+ if ( !bDown || (nItemSplitSize >= nSplitSize) )
+ {
+ pWindow->SetLineColor( rStyleSettings.GetDarkShadowColor() );
+ pWindow->DrawLine( Point( nPos, nTop ), Point( nPos, nBottom ) );
+ }
+ }
+ }
+ }
+ }
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet && pItems[i].mnWidth && pItems[i].mnHeight )
+ ImplDrawSplit( pWindow, pItems[i].mpSet, ((pItems[i].mnBits & SWIB_COLSET) == 0) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
+ long& rMouseOff, ImplSplitSet** ppFoundSet, USHORT& rFoundPos,
+ BOOL bRows, BOOL bDown = TRUE )
+{
+ if ( !pSet->mpItems )
+ return 0;
+
+ USHORT i;
+ USHORT nSplitTest;
+ USHORT nItems = pSet->mnItems;
+ long nMPos1;
+ long nMPos2;
+ long nPos;
+ long nTop;
+ long nBottom;
+ ImplSplitItem* pItems = pSet->mpItems;
+
+ if ( bRows )
+ {
+ nMPos1 = rPos.X();
+ nMPos2 = rPos.Y();
+ }
+ else
+ {
+ nMPos1 = rPos.Y();
+ nMPos2 = rPos.X();
+ }
+
+ for ( i = 0; i < nItems-1; i++ )
+ {
+ if ( pItems[i].mnSplitSize )
+ {
+ if ( bRows )
+ {
+ nTop = pItems[i].mnLeft;
+ nBottom = pItems[i].mnLeft+pItems[i].mnWidth-1;
+ }
+ else
+ {
+ nTop = pItems[i].mnTop;
+ nBottom = pItems[i].mnTop+pItems[i].mnHeight-1;
+ }
+ nPos = pItems[i].mnSplitPos;
+
+ if ( (nMPos1 >= nTop) && (nMPos1 <= nBottom) &&
+ (nMPos2 >= nPos) && (nMPos2 <= nPos+pItems[i].mnSplitSize) )
+ {
+ if ( !pItems[i].mbFixed && !pItems[i+1].mbFixed )
+ {
+ rMouseOff = nMPos2-nPos;
+ *ppFoundSet = pSet;
+ rFoundPos = i;
+ if ( bRows )
+ return SPLIT_VERT;
+ else
+ return SPLIT_HORZ;
+ }
+ else
+ return SPLIT_NOSPLIT;
+ }
+ }
+ }
+
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mpSet )
+ {
+ nSplitTest = ImplTestSplit( pItems[i].mpSet, rPos,
+ rMouseOff, ppFoundSet, rFoundPos,
+ ((pItems[i].mnBits & SWIB_COLSET) == 0) );
+ if ( nSplitTest )
+ return nSplitTest;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplTestSplit( SplitWindow* pWindow, const Point& rPos,
+ long& rMouseOff, ImplSplitSet** ppFoundSet, USHORT& rFoundPos )
+{
+ // Resizeable SplitWindow muss anders behandelt werden
+ if ( pWindow->mnWinStyle & WB_SIZEABLE )
+ {
+ long nTPos;
+ long nPos;
+ long nBorder;
+
+ if ( pWindow->mbHorz )
+ {
+ if ( pWindow->mbBottomRight )
+ {
+ nBorder = pWindow->mnBottomBorder;
+ nPos = 0;
+ }
+ else
+ {
+ nBorder = pWindow->mnTopBorder;
+ nPos = pWindow->mnDY-nBorder;
+ }
+ nTPos = rPos.Y();
+ }
+ else
+ {
+ if ( pWindow->mbBottomRight )
+ {
+ nBorder = pWindow->mnRightBorder;
+ nPos = 0;
+ }
+ else
+ {
+ nBorder = pWindow->mnLeftBorder;
+ nPos = pWindow->mnDX-nBorder;
+ }
+ nTPos = rPos.X();
+ }
+ long nSplitSize = pWindow->mpMainSet->mnSplitSize-2;
+ if ( pWindow->mbAutoHide || pWindow->mbFadeOut )
+ nSplitSize += SPLITWIN_SPLITSIZEEX;
+ if ( !pWindow->mbBottomRight )
+ nPos -= nSplitSize;
+ if ( (nTPos >= nPos) && (nTPos <= nPos+nSplitSize+nBorder) )
+ {
+ rMouseOff = nTPos-nPos;
+ *ppFoundSet = pWindow->mpMainSet;
+ if ( pWindow->mpMainSet->mpItems )
+ rFoundPos = pWindow->mpMainSet->mnItems-1;
+ else
+ rFoundPos = 0;
+ if ( pWindow->mbHorz )
+ return SPLIT_VERT | SPLIT_WINDOW;
+ else
+ return SPLIT_HORZ | SPLIT_WINDOW;
+ }
+ }
+
+ return ImplTestSplit( pWindow->mpMainSet, rPos, rMouseOff, ppFoundSet, rFoundPos,
+ pWindow->mbHorz, !pWindow->mbBottomRight );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawSplitTracking( SplitWindow* pThis, const Point& rPos )
+{
+ Rectangle aRect;
+
+ if ( pThis->mnSplitTest & SPLIT_HORZ )
+ {
+ aRect.Top() = pThis->maDragRect.Top();
+ aRect.Bottom() = pThis->maDragRect.Bottom();
+ aRect.Left() = rPos.X();
+ aRect.Right() = aRect.Left()+pThis->mpSplitSet->mnSplitSize-1;
+ if ( !(pThis->mnWinStyle & WB_NOSPLITDRAW) )
+ aRect.Right()--;
+ if ( (pThis->mnSplitTest & SPLIT_WINDOW) &&
+ (pThis->mbAutoHide || pThis->mbFadeOut) )
+ {
+ aRect.Left() += SPLITWIN_SPLITSIZEEX;
+ aRect.Right() += SPLITWIN_SPLITSIZEEX;
+ }
+ }
+ else
+ {
+ aRect.Left() = pThis->maDragRect.Left();
+ aRect.Right() = pThis->maDragRect.Right();
+ aRect.Top() = rPos.Y();
+ aRect.Bottom() = aRect.Top()+pThis->mpSplitSet->mnSplitSize-1;
+ if ( !(pThis->mnWinStyle & WB_NOSPLITDRAW) )
+ aRect.Bottom()--;
+ if ( (pThis->mnSplitTest & SPLIT_WINDOW) &&
+ (pThis->mbAutoHide || pThis->mbFadeOut) )
+ {
+ aRect.Top() += SPLITWIN_SPLITSIZEEX;
+ aRect.Bottom() += SPLITWIN_SPLITSIZEEX;
+ }
+ }
+ pThis->ShowTracking( aRect, SHOWTRACK_SPLIT );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplInit( Window* pParent, WinBits nStyle )
+{
+ ImplSplitSet* pNewSet = new ImplSplitSet;
+ pNewSet->mpItems = NULL;
+ pNewSet->mpWallpaper = NULL;
+ pNewSet->mpBitmap = NULL;
+ pNewSet->mnLastSize = 0;
+ pNewSet->mnItems = 0;
+ pNewSet->mnId = 0;
+ pNewSet->mnSplitSize = SPLITWIN_SPLITSIZE;
+ pNewSet->mbCalcPix = TRUE;
+
+ mpMainSet = pNewSet;
+ mpBaseSet = pNewSet;
+ mpSplitSet = NULL;
+ mpLastSizes = NULL;
+ mnDX = 0;
+ mnDY = 0;
+ mnLeftBorder = 0;
+ mnTopBorder = 0;
+ mnRightBorder = 0;
+ mnBottomBorder = 0;
+ mnMaxSize = 0;
+ mnMouseOff = 0;
+ meAlign = WINDOWALIGN_TOP;
+ mnWinStyle = nStyle;
+ mnSplitTest = 0;
+ mnSplitPos = 0;
+ mnMouseModifier = 0;
+ mnMStartPos = 0;
+ mnMSplitPos = 0;
+ mbDragFull = FALSE;
+ mbHorz = TRUE;
+ mbBottomRight = FALSE;
+ mbCalc = FALSE;
+ mbRecalc = TRUE;
+ mbInvalidate = TRUE;
+ mbAutoHide = FALSE;
+ mbFadeIn = FALSE;
+ mbFadeOut = FALSE;
+ mbAutoHideIn = FALSE;
+ mbAutoHideDown = FALSE;
+ mbFadeInDown = FALSE;
+ mbFadeOutDown = FALSE;
+ mbAutoHidePressed = FALSE;
+ mbFadeInPressed = FALSE;
+ mbFadeOutPressed = FALSE;
+ mbFadeNoButtonMode = FALSE;
+ mbNoAlign = FALSE;
+
+ if ( nStyle & WB_NOSPLITDRAW )
+ {
+ pNewSet->mnSplitSize -= 2;
+ mbInvalidate = FALSE;
+ }
+
+ if ( nStyle & WB_BORDER )
+ {
+ ImplCalcBorder( meAlign, mbNoAlign, mnLeftBorder, mnTopBorder,
+ mnRightBorder, mnBottomBorder );
+ }
+ else
+ {
+ mnLeftBorder = 0;
+ mnTopBorder = 0;
+ mnRightBorder = 0;
+ mnBottomBorder = 0;
+ }
+
+ DockingWindow::ImplInit( pParent, (nStyle | WB_CLIPCHILDREN) & ~(WB_BORDER | WB_SIZEABLE) );
+
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplInitSettings()
+{
+ // Wenn fuer das MainSet eine Bitmap gesetzt wird, dann
+ // brauchen wir nicht mehr den Hintergrund loeschen
+ // Wenn MainSet Wallpaper hat, dann ist das der Hintergrund, ansonsten
+ // sind es die Standard-Farben
+ if ( mpMainSet->mpBitmap )
+ SetBackground();
+ else if ( mpMainSet->mpWallpaper )
+ SetBackground( *mpMainSet->mpWallpaper );
+ else
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( Window::GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetFaceColor();
+ else
+ aColor = rStyleSettings.GetWindowColor();
+ SetBackground( aColor );
+ }
+}
+
+// =======================================================================
+
+SplitWindow::SplitWindow( Window* pParent, WinBits nStyle ) :
+ DockingWindow( WINDOW_SPLITWINDOW )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+SplitWindow::SplitWindow( Window* pParent, const ResId& rResId ) :
+ DockingWindow( WINDOW_SPLITWINDOW )
+{
+ rResId.SetRT( RSC_SPLITWINDOW );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+SplitWindow::~SplitWindow()
+{
+ // Sets loeschen
+ ImplDeleteSet( mpMainSet );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplSetWindowSize( long nDelta )
+{
+ if ( !nDelta )
+ return;
+
+ Size aSize = GetSizePixel();
+ if ( meAlign == WINDOWALIGN_TOP )
+ {
+ aSize.Height() += nDelta;
+ SetSizePixel( aSize );
+ }
+ else if ( meAlign == WINDOWALIGN_BOTTOM )
+ {
+ Point aPos = GetPosPixel();
+ aPos.Y() -= nDelta;
+ aSize.Height() += nDelta;
+ SetPosSizePixel( aPos, aSize );
+ }
+ else if ( meAlign == WINDOWALIGN_LEFT )
+ {
+ aSize.Width() += nDelta;
+ SetSizePixel( aSize );
+ }
+ else // meAlign == WINDOWALIGN_RIGHT
+ {
+ Point aPos = GetPosPixel();
+ aPos.X() -= nDelta;
+ aSize.Width() += nDelta;
+ SetPosSizePixel( aPos, aSize );
+ }
+
+ SplitResize();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplCalcLayout()
+{
+ if ( !mbCalc || !mbRecalc || !mpMainSet->mpItems )
+ return;
+
+ long nSplitSize = mpMainSet->mnSplitSize-2;
+ if ( mbAutoHide || mbFadeOut )
+ nSplitSize += SPLITWIN_SPLITSIZEEX;
+
+ // Wenn Fenster sizeable ist, wird die groesse automatisch nach
+ // dem MainSet festgelegt, wenn kein relatives Fenster enthalten
+ // ist
+ if ( mnWinStyle & WB_SIZEABLE )
+ {
+ long nCurSize;
+ long nCalcSize = 0;
+ USHORT i;
+
+ for ( i = 0; i < mpMainSet->mnItems; i++ )
+ {
+ if ( mpMainSet->mpItems[i].mnBits & (SWIB_RELATIVESIZE | SWIB_PERCENTSIZE) )
+ break;
+ else
+ nCalcSize += mpMainSet->mpItems[i].mnSize;
+ }
+
+ if ( i == mpMainSet->mnItems )
+ {
+ if ( mbHorz )
+ nCurSize = mnDY-mnTopBorder-mnBottomBorder;
+ else
+ nCurSize = mnDX-mnLeftBorder-mnRightBorder;
+ nCurSize -= nSplitSize;
+ nCurSize -= (mpMainSet->mnItems-1)*mpMainSet->mnSplitSize;
+
+ mbRecalc = FALSE;
+ ImplSetWindowSize( nCalcSize-nCurSize );
+ mbRecalc = TRUE;
+ }
+ }
+
+ if ( (mnDX <= 0) || (mnDY <= 0) )
+ return;
+
+ // Groessen/Position vorberechnen
+ long nL;
+ long nT;
+ long nW;
+ long nH;
+
+ if ( mbHorz )
+ {
+ if ( mbBottomRight )
+ nT = mnDY-mnBottomBorder;
+ else
+ nT = mnTopBorder;
+ nL = mnLeftBorder;
+ }
+ else
+ {
+ if ( mbBottomRight )
+ nL = mnDX-mnRightBorder;
+ else
+ nL = mnLeftBorder;
+ nT = mnTopBorder;
+ }
+ nW = mnDX-mnLeftBorder-mnRightBorder;
+ nH = mnDY-mnTopBorder-mnBottomBorder;
+ if ( mnWinStyle & WB_SIZEABLE )
+ {
+ if ( mbHorz )
+ nH -= nSplitSize;
+ else
+ nW -= nSplitSize;
+ }
+
+ // Sets rekursiv berechnen
+ ImplCalcSet( mpMainSet, nL, nT, nW, nH, mbHorz, !mbBottomRight );
+ ImplCalcSet2( this, mpMainSet, FALSE, mbHorz, !mbBottomRight );
+ mbCalc = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplUpdate()
+{
+ mbCalc = TRUE;
+
+ if ( IsReallyShown() && IsUpdateMode() && mbRecalc )
+ {
+ if ( mpMainSet->mpItems )
+ ImplCalcLayout();
+ else
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplUpdateSet( ImplSplitSet* pSet )
+{
+ if ( IsReallyShown() && IsUpdateMode() && mbRecalc )
+ {
+ // Wenn wir noch berechnen muessen, dann alles invalidieren.
+ if ( mbCalc )
+ {
+ // Wenn nicht NOSPLITDRAW gesetzt ist, koennen wir uns das
+ // invalidieren sparen, da bei ImplCalcSet2() die freien flaechen
+ // sowieso invalidiert werden
+ if ( !mpMainSet->mpItems || (mnWinStyle & WB_NOSPLITDRAW) )
+ pSet = mpMainSet;
+ else
+ return;
+ }
+
+ Rectangle aRect;
+ if ( pSet == mpMainSet )
+ {
+ aRect.Left() = mnLeftBorder;
+ aRect.Top() = mnTopBorder;
+ aRect.Right() = mnDX-mnRightBorder-1;
+ aRect.Bottom() = mnDY-mnBottomBorder-1;
+ }
+ else
+ {
+ ImplSplitItem* pItem;
+ USHORT nPos;
+
+ pSet = ImplFindItem( mpMainSet, pSet->mnId, nPos );
+ pItem = &(pSet->mpItems[nPos]);
+ aRect.Left() = pItem->mnLeft;
+ aRect.Top() = pItem->mnTop;
+ aRect.Right() = aRect.Left()+pItem->mnWidth;
+ aRect.Bottom() = aRect.Top()+pItem->mnHeight;
+ }
+ Invalidate( aRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplSplitMousePos( Point& rMousePos )
+{
+ if ( mnSplitTest & SPLIT_HORZ )
+ {
+ rMousePos.X() -= mnMouseOff;
+ if ( rMousePos.X() < maDragRect.Left() )
+ rMousePos.X() = maDragRect.Left();
+ else if ( rMousePos.X()+mpSplitSet->mnSplitSize+1 > maDragRect.Right() )
+ rMousePos.X() = maDragRect.Right()-mpSplitSet->mnSplitSize+1;
+ // Wegen FullDrag in Screen-Koordinaaten merken
+ mnMSplitPos = OutputToScreenPixel( rMousePos ).X();
+ }
+ else
+ {
+ rMousePos.Y() -= mnMouseOff;
+ if ( rMousePos.Y() < maDragRect.Top() )
+ rMousePos.Y() = maDragRect.Top();
+ else if ( rMousePos.Y()+mpSplitSet->mnSplitSize+1 > maDragRect.Bottom() )
+ rMousePos.Y() = maDragRect.Bottom()-mpSplitSet->mnSplitSize+1;
+ mnMSplitPos = OutputToScreenPixel( rMousePos ).Y();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplGetButtonRect( Rectangle& rRect, long nEx, BOOL bTest ) const
+{
+ long nSplitSize = mpMainSet->mnSplitSize-2;
+ if ( mbAutoHide || mbFadeOut || mbFadeIn )
+ nSplitSize += SPLITWIN_SPLITSIZEEX;
+
+/* Wir wollen doch erstmal nicht zentrieren
+ long nButtonSize = 0;
+ if ( mbFadeIn )
+ nButtonSize += SPLITWIN_SPLITSIZEFADE+1;
+ if ( mbFadeOut )
+ nButtonSize += SPLITWIN_SPLITSIZEFADE+1;
+ if ( mbAutoHide )
+ nButtonSize += SPLITWIN_SPLITSIZEAUTOHIDE+1;
+ long nCenterEx = 0;
+ if ( mbHorz )
+ nCenterEx += ((mnDX-mnLeftBorder-mnRightBorder)-nButtonSize)/2;
+ else
+ nCenterEx += ((mnDY-mnTopBorder-mnBottomBorder)-nButtonSize)/2;
+ if ( nCenterEx > 0 )
+ nEx += nCenterEx;
+*/
+
+ if ( meAlign == WINDOWALIGN_TOP )
+ {
+ rRect.Left() = mnLeftBorder+nEx;
+ rRect.Top() = mnDY-mnBottomBorder-nSplitSize;
+ rRect.Right() = rRect.Left()+SPLITWIN_SPLITSIZEAUTOHIDE;
+ rRect.Bottom() = mnDY-mnBottomBorder-1;
+ if ( bTest )
+ {
+ rRect.Top() -= mnTopBorder;
+ rRect.Bottom() += mnBottomBorder;
+ }
+ }
+ else if ( meAlign == WINDOWALIGN_BOTTOM )
+ {
+ rRect.Left() = mnLeftBorder+nEx;
+ rRect.Top() = mnTopBorder;
+ rRect.Right() = rRect.Left()+SPLITWIN_SPLITSIZEAUTOHIDE;
+ rRect.Bottom() = mnTopBorder+nSplitSize-1;
+ if ( bTest )
+ {
+ rRect.Top() -= mnTopBorder;
+ rRect.Bottom() += mnBottomBorder;
+ }
+ }
+ else if ( meAlign == WINDOWALIGN_LEFT )
+ {
+ rRect.Left() = mnDX-mnRightBorder-nSplitSize;
+ rRect.Top() = mnTopBorder+nEx;
+ rRect.Right() = mnDX-mnRightBorder-1;
+ rRect.Bottom() = rRect.Top()+SPLITWIN_SPLITSIZEAUTOHIDE;
+ if ( bTest )
+ {
+ rRect.Left() -= mnLeftBorder;
+ rRect.Right() += mnRightBorder;
+ }
+ }
+ else if ( meAlign == WINDOWALIGN_RIGHT )
+ {
+ rRect.Left() = mnLeftBorder;
+ rRect.Top() = mnTopBorder+nEx;
+ rRect.Right() = mnLeftBorder+nSplitSize-1;
+ rRect.Bottom() = rRect.Top()+SPLITWIN_SPLITSIZEAUTOHIDE;
+ if ( bTest )
+ {
+ rRect.Left() -= mnLeftBorder;
+ rRect.Right() += mnRightBorder;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplGetAutoHideRect( Rectangle& rRect, BOOL bTest ) const
+{
+ Rectangle aRect;
+
+ if ( mbAutoHide )
+ {
+ long nEx = 0;
+ if ( mbFadeIn || mbFadeOut )
+ nEx = SPLITWIN_SPLITSIZEFADE+1;
+ ImplGetButtonRect( aRect, nEx, bTest && mbFadeIn );
+ }
+
+ rRect = aRect;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplGetFadeInRect( Rectangle& rRect, BOOL bTest ) const
+{
+ Rectangle aRect;
+
+ if ( mbFadeIn )
+ ImplGetButtonRect( aRect, 0, bTest );
+
+ rRect = aRect;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplGetFadeOutRect( Rectangle& rRect, BOOL ) const
+{
+ Rectangle aRect;
+
+ if ( mbFadeOut )
+ ImplGetButtonRect( aRect, 0, FALSE );
+
+ rRect = aRect;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplDrawButtonRect( const Rectangle& rRect, long nSize )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( mbHorz )
+ {
+ long nLeft = rRect.Left();
+ long nRight = rRect.Right();
+ long nCenter = rRect.Center().Y();
+ long nEx1 = nLeft+((rRect.GetWidth()-nSize)/2)-2;
+ long nEx2 = nEx1+nSize+3;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Left(), rRect.Bottom() ) );
+ DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Right(), rRect.Top() ) );
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( rRect.Right(), rRect.Top() ), Point( rRect.Right(), rRect.Bottom() ) );
+ DrawLine( Point( rRect.Left(), rRect.Bottom() ), Point( rRect.Right(), rRect.Bottom() ) );
+ long i = nLeft+2;
+ while ( i < nRight-3 )
+ {
+ if ( (i < nEx1) || (i > nEx2 ) )
+ {
+ DrawPixel( Point( i, nCenter-2 ), rStyleSettings.GetLightColor() );
+ DrawPixel( Point( i+1, nCenter-2+1 ), rStyleSettings.GetShadowColor() );
+ }
+ i++;
+ if ( (i < nEx1) || (i > nEx2 ) && (i < nRight-3) )
+ {
+ DrawPixel( Point( i, nCenter+2 ), rStyleSettings.GetLightColor() );
+ DrawPixel( Point( i+1, nCenter+2+1 ), rStyleSettings.GetShadowColor() );
+ }
+ i += 2;
+ }
+ }
+ else
+ {
+ long nTop = rRect.Top();
+ long nBottom = rRect.Bottom();
+ long nCenter = rRect.Center().X();
+ long nEx1 = nTop+((rRect.GetHeight()-nSize)/2)-2;
+ long nEx2 = nEx1+nSize+3;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Right(), rRect.Top() ) );
+ DrawLine( Point( rRect.Left(), rRect.Top() ), Point( rRect.Left(), rRect.Bottom() ) );
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( rRect.Right(), rRect.Top() ), Point( rRect.Right(), rRect.Bottom() ) );
+ DrawLine( Point( rRect.Left(), rRect.Bottom() ), Point( rRect.Right(), rRect.Bottom() ) );
+ long i = nTop+2;
+ while ( i < nBottom-3 )
+ {
+ if ( (i < nEx1) || (i > nEx2 ) )
+ {
+ DrawPixel( Point( nCenter-2, i ), rStyleSettings.GetLightColor() );
+ DrawPixel( Point( nCenter-2+1, i+1 ), rStyleSettings.GetShadowColor() );
+ }
+ i++;
+ if ( (i < nEx1) || (i > nEx2 ) && (i < nBottom-3) )
+ {
+ DrawPixel( Point( nCenter+2, i ), rStyleSettings.GetLightColor() );
+ DrawPixel( Point( nCenter+2+1, i+1 ), rStyleSettings.GetShadowColor() );
+ }
+ i += 2;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplDrawAutoHide( BOOL bInPaint )
+{
+ if ( mbAutoHide )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aTempRect;
+ ImplGetAutoHideRect( aTempRect );
+
+ if ( !bInPaint )
+ Erase( aTempRect );
+
+ // ImageListe laden, wenn noch nicht vorhanden
+ ImplSVData* pSVData = ImplGetSVData();
+ ImageList* pImageList;
+ if ( mbHorz )
+ {
+ if ( !pSVData->maCtrlData.mpSplitHPinImgList )
+ {
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_SPLITHPIN, ImplGetResMgr() ) );
+ pSVData->maCtrlData.mpSplitHPinImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
+ }
+ pImageList = pSVData->maCtrlData.mpSplitHPinImgList;
+ }
+ else
+ {
+ if ( !pSVData->maCtrlData.mpSplitVPinImgList )
+ {
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_SPLITVPIN, ImplGetResMgr() ) );
+ pSVData->maCtrlData.mpSplitVPinImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
+ }
+ pImageList = pSVData->maCtrlData.mpSplitVPinImgList;
+ }
+
+ // Image ermitteln und zurueckgeben
+ USHORT nId;
+ if ( mbAutoHidePressed )
+ {
+ if ( mbAutoHideIn )
+ nId = 3;
+ else
+ nId = 4;
+ }
+ else
+ {
+ if ( mbAutoHideIn )
+ nId = 1;
+ else
+ nId = 2;
+ }
+
+ Image aImage = pImageList->GetImage( nId );
+ Size aImageSize = aImage.GetSizePixel();
+ Point aPos( aTempRect.Left()+((aTempRect.GetWidth()-aImageSize.Width())/2),
+ aTempRect.Top()+((aTempRect.GetHeight()-aImageSize.Height())/2) );
+ long nSize;
+ if ( mbHorz )
+ nSize = aImageSize.Width();
+ else
+ nSize = aImageSize.Height();
+ ImplDrawButtonRect( aTempRect, nSize );
+ DrawImage( aPos, aImage );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplGetSplitArrowImage( BOOL bHorz, BOOL bLeft, BOOL bPressed,
+ Image& rImage )
+{
+ // ImageListe laden, wenn noch nicht vorhanden
+ ImplSVData* pSVData = ImplGetSVData();
+ ImageList* pImageList;
+ if ( bHorz )
+ {
+ if ( !pSVData->maCtrlData.mpSplitHArwImgList )
+ {
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_SPLITHARW, ImplGetResMgr() ) );
+ pSVData->maCtrlData.mpSplitHArwImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
+ }
+ pImageList = pSVData->maCtrlData.mpSplitHArwImgList;
+ }
+ else
+ {
+ if ( !pSVData->maCtrlData.mpSplitVArwImgList )
+ {
+ Bitmap aBmp( ResId( SV_RESID_BITMAP_SPLITVARW, ImplGetResMgr() ) );
+ pSVData->maCtrlData.mpSplitVArwImgList = new ImageList( aBmp, Color( 0x00, 0x00, 0xFF ), 4 );
+ }
+ pImageList = pSVData->maCtrlData.mpSplitVArwImgList;
+ }
+
+ // Image ermitteln und zurueckgeben
+ USHORT nId = 1;
+ if ( !bLeft )
+ nId += 2;
+ if ( bPressed )
+ nId++;
+
+ rImage = pImageList->GetImage( nId );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplDrawFadeIn( BOOL bInPaint )
+{
+ if ( mbFadeIn )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aTempRect;
+ Image aImage;
+ ImplGetFadeInRect( aTempRect );
+
+ BOOL bLeft;
+ if ( meAlign == WINDOWALIGN_TOP )
+ bLeft = FALSE;
+ else if ( meAlign == WINDOWALIGN_BOTTOM )
+ bLeft = TRUE;
+ else if ( meAlign == WINDOWALIGN_LEFT )
+ bLeft = FALSE;
+ else if ( meAlign == WINDOWALIGN_RIGHT )
+ bLeft = TRUE;
+ ImplGetSplitArrowImage( mbHorz, bLeft, mbFadeInPressed, aImage );
+
+ if ( !bInPaint )
+ Erase( aTempRect );
+
+ Size aImageSize = aImage.GetSizePixel();
+ Point aPos( aTempRect.Left()+((aTempRect.GetWidth()-aImageSize.Width())/2),
+ aTempRect.Top()+((aTempRect.GetHeight()-aImageSize.Height())/2) );
+ long nSize;
+ if ( mbHorz )
+ nSize = aImageSize.Width();
+ else
+ nSize = aImageSize.Height();
+ ImplDrawButtonRect( aTempRect, nSize );
+ DrawImage( aPos, aImage );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplDrawFadeOut( BOOL bInPaint )
+{
+ if ( mbFadeOut )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Rectangle aTempRect;
+ Image aImage;
+ ImplGetFadeOutRect( aTempRect );
+
+ BOOL bLeft;
+ if ( meAlign == WINDOWALIGN_TOP )
+ bLeft = TRUE;
+ else if ( meAlign == WINDOWALIGN_BOTTOM )
+ bLeft = FALSE;
+ else if ( meAlign == WINDOWALIGN_LEFT )
+ bLeft = TRUE;
+ else if ( meAlign == WINDOWALIGN_RIGHT )
+ bLeft = FALSE;
+ ImplGetSplitArrowImage( mbHorz, bLeft, mbFadeOutPressed, aImage );
+
+ if ( !bInPaint )
+ Erase( aTempRect );
+
+ Size aImageSize = aImage.GetSizePixel();
+ Point aPos( aTempRect.Left()+((aTempRect.GetWidth()-aImageSize.Width())/2),
+ aTempRect.Top()+((aTempRect.GetHeight()-aImageSize.Height())/2) );
+ long nSize;
+ if ( mbHorz )
+ nSize = aImageSize.Width();
+ else
+ nSize = aImageSize.Height();
+ ImplDrawButtonRect( aTempRect, nSize );
+ DrawImage( aPos, aImage );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::StartSplit()
+{
+ maStartSplitHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::Split()
+{
+ maSplitHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SplitResize()
+{
+ maSplitResizeHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::AutoHide()
+{
+ maAutoHideHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::FadeIn()
+{
+ maFadeInHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::FadeOut()
+{
+ maFadeOutHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( !rMEvt.IsLeft() || rMEvt.IsMod2() )
+ {
+ DockingWindow::MouseButtonDown( rMEvt );
+ return;
+ }
+
+ Point aMousePosPixel = rMEvt.GetPosPixel();
+ Rectangle aTestRect;
+
+ mbFadeNoButtonMode = FALSE;
+ ImplGetAutoHideRect( aTestRect, TRUE );
+ if ( aTestRect.IsInside( aMousePosPixel ) )
+ {
+ mbAutoHideDown = TRUE;
+ mbAutoHidePressed = TRUE;
+ ImplDrawAutoHide( FALSE );
+ }
+ else
+ {
+ ImplGetFadeOutRect( aTestRect, TRUE );
+ if ( aTestRect.IsInside( aMousePosPixel ) )
+ {
+ mbFadeOutDown = TRUE;
+ mbFadeOutPressed = TRUE;
+ ImplDrawFadeOut( FALSE );
+ }
+ else
+ {
+ ImplGetFadeInRect( aTestRect, TRUE );
+ if ( aTestRect.IsInside( aMousePosPixel ) )
+ {
+ mbFadeInDown = TRUE;
+ mbFadeInPressed = TRUE;
+ ImplDrawFadeIn( FALSE );
+ }
+ else if ( !aTestRect.IsEmpty() && !(mnWinStyle & WB_SIZEABLE) )
+ {
+ mbFadeNoButtonMode = TRUE;
+ FadeIn();
+ return;
+ }
+ }
+ }
+
+ if ( mbAutoHideDown || mbFadeInDown || mbFadeOutDown )
+ StartTracking();
+ else
+ {
+ mnSplitTest = ImplTestSplit( this, aMousePosPixel, mnMouseOff, &mpSplitSet, mnSplitPos );
+ if ( mnSplitTest && !(mnSplitTest & SPLIT_NOSPLIT) )
+ {
+ ImplSplitItem* pSplitItem;
+ long nCurMaxSize;
+ USHORT nTemp;
+ BOOL bDown;
+ BOOL bPropSmaller;
+
+ mnMouseModifier = rMEvt.GetModifier();
+ if ( !(mnMouseModifier & KEY_SHIFT) || (mnSplitPos+1 >= mpSplitSet->mnItems) )
+ bPropSmaller = FALSE;
+ else
+ bPropSmaller = TRUE;
+
+ // Hier kann noch die maximale Groesse gesetzt werden
+ StartSplit();
+
+ if ( mnMaxSize )
+ nCurMaxSize = mnMaxSize;
+ else
+ {
+ Size aSize = GetParent()->GetOutputSizePixel();
+ if ( mbHorz )
+ nCurMaxSize = aSize.Height();
+ else
+ nCurMaxSize = aSize.Width();
+ }
+
+ if ( mpSplitSet->mpItems )
+ {
+ bDown = TRUE;
+ if ( (mpSplitSet == mpMainSet) && mbBottomRight )
+ bDown = FALSE;
+
+ pSplitItem = &(mpSplitSet->mpItems[mnSplitPos]);
+ maDragRect.Left() = pSplitItem->mnLeft;
+ maDragRect.Top() = pSplitItem->mnTop;
+ maDragRect.Right() = pSplitItem->mnLeft+pSplitItem->mnWidth-1;
+ maDragRect.Bottom() = pSplitItem->mnTop+pSplitItem->mnHeight-1;
+
+ if ( mnSplitTest & SPLIT_HORZ )
+ {
+ if ( bDown )
+ maDragRect.Right() += mpSplitSet->mnSplitSize;
+ else
+ maDragRect.Left() -= mpSplitSet->mnSplitSize;
+ }
+ else
+ {
+ if ( bDown )
+ maDragRect.Bottom() += mpSplitSet->mnSplitSize;
+ else
+ maDragRect.Top() -= mpSplitSet->mnSplitSize;
+ }
+
+ if ( mnSplitPos )
+ {
+ nTemp = mnSplitPos;
+ while ( nTemp )
+ {
+ pSplitItem = &(mpSplitSet->mpItems[nTemp-1]);
+ if ( pSplitItem->mbFixed )
+ break;
+ else
+ {
+ if ( mnSplitTest & SPLIT_HORZ )
+ {
+ if ( bDown )
+ maDragRect.Left() -= pSplitItem->mnPixSize;
+ else
+ maDragRect.Right() += pSplitItem->mnPixSize;
+ }
+ else
+ {
+ if ( bDown )
+ maDragRect.Top() -= pSplitItem->mnPixSize;
+ else
+ maDragRect.Bottom() += pSplitItem->mnPixSize;
+ }
+ }
+ nTemp--;
+ }
+ }
+
+ if ( (mpSplitSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) && !bPropSmaller )
+ {
+ if ( bDown )
+ {
+ if ( mbHorz )
+ maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
+ else
+ maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
+ }
+ else
+ {
+ if ( mbHorz )
+ maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
+ else
+ maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
+ }
+ }
+ else
+ {
+ nTemp = mnSplitPos+1;
+ while ( nTemp < mpSplitSet->mnItems )
+ {
+ pSplitItem = &(mpSplitSet->mpItems[nTemp]);
+ if ( pSplitItem->mbFixed )
+ break;
+ else
+ {
+ if ( mnSplitTest & SPLIT_HORZ )
+ {
+ if ( bDown )
+ maDragRect.Right() += pSplitItem->mnPixSize;
+ else
+ maDragRect.Left() -= pSplitItem->mnPixSize;
+ }
+ else
+ {
+ if ( bDown )
+ maDragRect.Bottom() += pSplitItem->mnPixSize;
+ else
+ maDragRect.Top() -= pSplitItem->mnPixSize;
+ }
+ }
+ nTemp++;
+ }
+ }
+ }
+ else
+ {
+ maDragRect.Left() = mnLeftBorder;
+ maDragRect.Top() = mnTopBorder;
+ maDragRect.Right() = mnDX-mnRightBorder-1;
+ maDragRect.Bottom() = mnDY-mnBottomBorder-1;
+ if ( mbHorz )
+ {
+ if ( mbBottomRight )
+ maDragRect.Top() -= nCurMaxSize-mnDY-mnBottomBorder;
+ else
+ maDragRect.Bottom() += nCurMaxSize-mnDY-mnTopBorder;
+ }
+ else
+ {
+ if ( mbBottomRight )
+ maDragRect.Left() -= nCurMaxSize-mnDX-mnRightBorder;
+ else
+ maDragRect.Right() += nCurMaxSize-mnDX-mnLeftBorder;
+ }
+ }
+
+ StartTracking();
+
+ mbDragFull = (GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SPLIT) != 0;
+ ImplSplitMousePos( aMousePosPixel );
+ if ( !mbDragFull )
+ ImplDrawSplitTracking( this, aMousePosPixel );
+ else
+ {
+ ImplSplitItem* pItems = mpSplitSet->mpItems;
+ USHORT nItems = mpSplitSet->mnItems;
+ mpLastSizes = new long[nItems*2];
+ for ( USHORT i = 0; i < nItems; i++ )
+ {
+ mpLastSizes[i*2] = pItems[i].mnSize;
+ mpLastSizes[i*2+1] = pItems[i].mnPixSize;
+ }
+ }
+ mnMStartPos = mnMSplitPos;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( !IsTracking() )
+ {
+ Point aPos = rMEvt.GetPosPixel();
+ long nTemp;
+ ImplSplitSet* pTempSplitSet;
+ USHORT nTempSplitPos;
+ USHORT nSplitTest = ImplTestSplit( this, aPos, nTemp, &pTempSplitSet, nTempSplitPos );
+ PointerStyle eStyle = POINTER_ARROW;
+ Rectangle aAutoHideRect;
+ Rectangle aFadeInRect;
+ Rectangle aFadeOutRect;
+
+ ImplGetAutoHideRect( aAutoHideRect );
+ ImplGetFadeInRect( aFadeInRect );
+ ImplGetFadeOutRect( aFadeOutRect );
+ if ( !aAutoHideRect.IsInside( aPos ) &&
+ !aFadeInRect.IsInside( aPos ) &&
+ !aFadeOutRect.IsInside( aPos ) )
+ {
+ if ( nSplitTest && !(nSplitTest & SPLIT_NOSPLIT) )
+ {
+ if ( nSplitTest & SPLIT_HORZ )
+ eStyle = POINTER_HSPLIT;
+ else if ( nSplitTest & SPLIT_VERT )
+ eStyle = POINTER_VSPLIT;
+ }
+ }
+
+ Pointer aPtr( eStyle );
+ SetPointer( aPtr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::Tracking( const TrackingEvent& rTEvt )
+{
+ Point aMousePosPixel = rTEvt.GetMouseEvent().GetPosPixel();
+
+ if ( mbAutoHideDown )
+ {
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ mbAutoHideDown = FALSE;
+ if ( mbAutoHidePressed )
+ {
+ mbAutoHidePressed = FALSE;
+
+ if ( !rTEvt.IsTrackingCanceled() )
+ {
+ mbAutoHideIn = !mbAutoHideIn;
+ ImplDrawAutoHide( FALSE );
+ AutoHide();
+ }
+ else
+ ImplDrawAutoHide( FALSE );
+ }
+ }
+ else
+ {
+ Rectangle aTestRect;
+ ImplGetAutoHideRect( aTestRect, TRUE );
+ BOOL bNewPressed = aTestRect.IsInside( aMousePosPixel );
+ if ( bNewPressed != mbAutoHidePressed )
+ {
+ mbAutoHidePressed = bNewPressed;
+ ImplDrawAutoHide( FALSE );
+ }
+ }
+ }
+ else if ( mbFadeInDown )
+ {
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ mbFadeInDown = FALSE;
+ if ( mbFadeInPressed )
+ {
+ mbFadeInPressed = FALSE;
+ ImplDrawFadeIn( FALSE );
+
+ if ( !rTEvt.IsTrackingCanceled() )
+ FadeIn();
+ }
+ }
+ else
+ {
+ Rectangle aTestRect;
+ ImplGetFadeInRect( aTestRect, TRUE );
+ BOOL bNewPressed = aTestRect.IsInside( aMousePosPixel );
+ if ( bNewPressed != mbFadeInPressed )
+ {
+ mbFadeInPressed = bNewPressed;
+ ImplDrawFadeIn( FALSE );
+ }
+ }
+ }
+ else if ( mbFadeOutDown )
+ {
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ mbFadeOutDown = FALSE;
+ if ( mbFadeOutPressed )
+ {
+ mbFadeOutPressed = FALSE;
+ ImplDrawFadeOut( FALSE );
+
+ if ( !rTEvt.IsTrackingCanceled() )
+ FadeOut();
+ }
+ }
+ else
+ {
+ Rectangle aTestRect;
+ ImplGetFadeOutRect( aTestRect, TRUE );
+ BOOL bNewPressed = aTestRect.IsInside( aMousePosPixel );
+ if ( bNewPressed != mbFadeOutPressed )
+ {
+ mbFadeOutPressed = bNewPressed;
+ ImplDrawFadeOut( FALSE );
+ }
+ }
+ }
+ else
+ {
+ ImplSplitMousePos( aMousePosPixel );
+ BOOL bSplit = TRUE;
+ if ( mbDragFull )
+ {
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( rTEvt.IsTrackingCanceled() )
+ {
+ ImplSplitItem* pItems = mpSplitSet->mpItems;
+ USHORT nItems = mpSplitSet->mnItems;
+ for ( USHORT i = 0; i < nItems; i++ )
+ {
+ pItems[i].mnSize = mpLastSizes[i*2];
+ pItems[i].mnPixSize = mpLastSizes[i*2+1];
+ }
+ ImplUpdate();
+ Split();
+ }
+ bSplit = FALSE;
+ }
+ }
+ else
+ {
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ HideTracking();
+ bSplit = !rTEvt.IsTrackingCanceled();
+ }
+ else
+ {
+ ImplDrawSplitTracking( this, aMousePosPixel );
+ bSplit = FALSE;
+ }
+ }
+
+ if ( bSplit )
+ {
+ BOOL bPropSmaller = (mnMouseModifier & KEY_SHIFT) ? TRUE : FALSE;
+ BOOL bPropGreater = (mnMouseModifier & KEY_MOD1) ? TRUE : FALSE;
+ long nDelta = mnMSplitPos-mnMStartPos;
+
+ if ( (mnSplitTest & SPLIT_WINDOW) && !mpMainSet->mpItems )
+ {
+ if ( (mpSplitSet == mpMainSet) && mbBottomRight )
+ nDelta *= -1;
+ ImplSetWindowSize( nDelta );
+ }
+ else
+ {
+ long nNewSize = mpSplitSet->mpItems[mnSplitPos].mnPixSize;
+ if ( (mpSplitSet == mpMainSet) && mbBottomRight )
+ nNewSize -= nDelta;
+ else
+ nNewSize += nDelta;
+ SplitItem( mpSplitSet->mpItems[mnSplitPos].mnId, nNewSize,
+ bPropSmaller, bPropGreater );
+ }
+
+ Split();
+
+ if ( mbDragFull )
+ {
+ Update();
+ mnMStartPos = mnMSplitPos;
+ }
+ }
+
+ if ( rTEvt.IsTrackingEnded() )
+ {
+ if ( mpLastSizes )
+ delete mpLastSizes;
+ mpLastSizes = NULL;
+ mpSplitSet = NULL;
+ mnMouseOff = 0;
+ mnMStartPos = 0;
+ mnMSplitPos = 0;
+ mnMouseModifier = 0;
+ mnSplitTest = 0;
+ mnSplitPos = 0;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::Paint( const Rectangle& )
+{
+ if ( mnWinStyle & WB_BORDER )
+ ImplDrawBorder( this );
+
+ ImplDrawFadeOut( TRUE );
+ ImplDrawFadeIn( TRUE );
+ ImplDrawAutoHide( TRUE );
+
+ // FrameSet-Hintergruende zeichnen
+ ImplDrawBack( this, mpMainSet );
+
+ // Splitter zeichnen
+ if ( !(mnWinStyle & WB_NOSPLITDRAW) )
+ ImplDrawSplit( this, mpMainSet, mbHorz, !mbBottomRight );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::Move()
+{
+ DockingWindow::Move();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::Resize()
+{
+ Size aSize = GetOutputSizePixel();
+ mnDX = aSize.Width();
+ mnDY = aSize.Height();
+
+ ImplUpdate();
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::RequestHelp( const HelpEvent& rHEvt )
+{
+ if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) )
+ {
+ Point aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
+ Rectangle aHelpRect;
+ USHORT nHelpResId = 0;
+
+ ImplGetAutoHideRect( aHelpRect, TRUE );
+ if ( aHelpRect.IsInside( aMousePosPixel ) )
+ {
+ if ( mbAutoHideIn )
+ nHelpResId = SV_HELPTEXT_SPLITFIXED;
+ else
+ nHelpResId = SV_HELPTEXT_SPLITFLOATING;
+ }
+ else
+ {
+ ImplGetFadeInRect( aHelpRect, TRUE );
+ if ( aHelpRect.IsInside( aMousePosPixel ) )
+ nHelpResId = SV_HELPTEXT_FADEIN;
+ else
+ {
+ ImplGetFadeOutRect( aHelpRect, TRUE );
+ if ( aHelpRect.IsInside( aMousePosPixel ) )
+ nHelpResId = SV_HELPTEXT_FADEOUT;
+ }
+ }
+
+ // Rechteck ermitteln
+ if ( nHelpResId )
+ {
+ Point aPt = OutputToScreenPixel( aHelpRect.TopLeft() );
+ aHelpRect.Left() = aPt.X();
+ aHelpRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aHelpRect.BottomRight() );
+ aHelpRect.Right() = aPt.X();
+ aHelpRect.Bottom() = aPt.Y();
+
+ // Text ermitteln und anzeigen
+ XubString aStr( ResId( nHelpResId, ImplGetResMgr() ) );
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aHelpRect.Center(), aHelpRect, aStr );
+ else
+ Help::ShowQuickHelp( this, aHelpRect, aStr );
+ return;
+ }
+ }
+
+ DockingWindow::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ if ( IsUpdateMode() )
+ ImplCalcLayout();
+ }
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsUpdateMode() && IsReallyShown() )
+ ImplCalcLayout();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+
+ DockingWindow::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+ else
+ DockingWindow::DataChanged( rDCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize,
+ USHORT nPos, USHORT nSetId,
+ SplitWindowItemBits nBits )
+{
+#ifdef DBG_UTIL
+ USHORT nDbgDummy;
+ DBG_ASSERT( ImplFindSet( mpMainSet, nSetId ), "SplitWindow::InsertItem() - Set not exists" );
+ DBG_ASSERT( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::InsertItem() - Id already exists" );
+#endif
+
+ // Size muss min. 1 sein
+ if ( nSize < 1 )
+ nSize = 1;
+
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+ ImplSplitSet* pNewSet;
+ ImplSplitItem* pItem;
+
+ // Platz fuer neues Item schaffen
+ if ( nPos > pSet->mnItems )
+ nPos = pSet->mnItems;
+ ImplSplitItem* pNewItems = new ImplSplitItem[pSet->mnItems+1];
+ if ( nPos )
+ memcpy( pNewItems, pSet->mpItems, sizeof( ImplSplitItem )*nPos );
+ if ( nPos < pSet->mnItems )
+ memcpy( pNewItems+nPos+1, pSet->mpItems+nPos, sizeof( ImplSplitItem )*(pSet->mnItems-nPos) );
+ delete pSet->mpItems;
+ pSet->mpItems = pNewItems;
+ pSet->mnItems++;
+ pSet->mbCalcPix = TRUE;
+
+ // Item anlegen und erweitern
+ pItem = &(pSet->mpItems[nPos]);
+ memset( pItem, 0, sizeof( ImplSplitItem ) );
+ pItem->mnSize = nSize;
+ pItem->mnId = nId;
+ pItem->mnBits = nBits;
+
+ if ( pWindow )
+ {
+ pItem->mpWindow = pWindow;
+ pItem->mpOrgParent = pWindow->GetParent();
+
+ // Window mit SplitWindow verbinden
+ pWindow->Hide();
+ pWindow->SetParent( this );
+ }
+ else
+ {
+ pNewSet = new ImplSplitSet;
+ pNewSet->mpItems = NULL;
+ pNewSet->mpWallpaper = NULL;
+ pNewSet->mpBitmap = NULL;
+ pNewSet->mnLastSize = 0;
+ pNewSet->mnItems = 0;
+ pNewSet->mnId = nId;
+ pNewSet->mnSplitSize = pSet->mnSplitSize;
+ pNewSet->mbCalcPix = TRUE;
+
+ pItem->mpSet = pNewSet;
+ }
+
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::InsertItem( USHORT nId, long nSize,
+ USHORT nPos, USHORT nSetId,
+ SplitWindowItemBits nBits )
+{
+ InsertItem( nId, NULL, nSize, nPos, nSetId, nBits );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::MoveItem( USHORT nId, USHORT nNewPos, USHORT nNewSetId )
+{
+#ifdef DBG_UTIL
+ USHORT nDbgDummy;
+ DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::MoveItem() - Id not found" );
+ DBG_ASSERT( ImplFindSet( mpMainSet, nNewSetId ), "SplitWindow::MoveItem() - Set not exists" );
+#endif
+
+ USHORT nPos;
+ ImplSplitSet* pNewSet = ImplFindSet( mpMainSet, nNewSetId );
+ ImplSplitSet* pSet = ImplFindItem( mpMainSet, nId, nPos );
+ ImplSplitItem aTempItem;
+
+ if ( pNewSet == pSet )
+ {
+ if ( nNewPos >= pNewSet->mnItems )
+ nNewPos = pNewSet->mnItems-1;
+ if ( nPos != nNewPos )
+ {
+ memcpy( &aTempItem, &(pSet->mpItems[nPos]), sizeof( aTempItem ) );
+ if ( nPos < nNewPos )
+ {
+ memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
+ (nNewPos-nPos)*sizeof( ImplSplitItem ) );
+ }
+ else
+ {
+ memmove( pSet->mpItems+nNewPos+1, pSet->mpItems+nNewPos,
+ (nPos-nNewPos)*sizeof( ImplSplitItem ) );
+ }
+ memcpy( &(pSet->mpItems[nNewPos]), &aTempItem, sizeof( aTempItem ) );
+
+ ImplUpdate();
+ }
+ }
+ else
+ {
+ if ( nNewPos >= pNewSet->mnItems )
+ nNewPos = pNewSet->mnItems;
+ memcpy( &aTempItem, &(pSet->mpItems[nPos]), sizeof( aTempItem ) );
+ pSet->mnItems--;
+ pSet->mbCalcPix = TRUE;
+ if ( pSet->mnItems )
+ {
+ memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
+ (pSet->mnItems-nPos)*sizeof( ImplSplitItem ) );
+ }
+ else
+ {
+ delete pSet->mpItems;
+ pSet->mpItems = NULL;
+ }
+ ImplSplitItem* pNewItems = new ImplSplitItem[pNewSet->mnItems+1];
+ if ( nNewPos )
+ memcpy( pNewItems, pNewSet->mpItems, sizeof( ImplSplitItem )*nNewPos );
+ if ( nNewPos < pNewSet->mnItems )
+ {
+ memcpy( pNewItems+nNewPos+1, pNewSet->mpItems+nNewPos,
+ sizeof( ImplSplitItem )*(pNewSet->mnItems-nNewPos) );
+ }
+ delete pNewSet->mpItems;
+ pNewSet->mpItems = pNewItems;
+ pNewSet->mnItems++;
+ pNewSet->mbCalcPix = TRUE;
+ memcpy( &(pNewSet->mpItems[nNewPos]), &aTempItem, sizeof( aTempItem ) );
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::RemoveItem( USHORT nId, BOOL bHide )
+{
+#ifdef DBG_UTIL
+ USHORT nDbgDummy;
+ DBG_ASSERT( ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::RemoveItem() - Id not found" );
+#endif
+
+ // Set suchen
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpMainSet, nId, nPos );
+ ImplSplitItem* pItem = &(pSet->mpItems[nPos]);
+ Window* pWindow = pItem->mpWindow;
+ Window* pOrgParent = pItem->mpOrgParent;
+
+ // Evt. Set loeschen
+ if ( !pWindow )
+ ImplDeleteSet( pItem->mpSet );
+
+ // Item entfernen
+ pSet->mnItems--;
+ pSet->mbCalcPix = TRUE;
+ if ( pSet->mnItems )
+ {
+ memmove( pSet->mpItems+nPos, pSet->mpItems+nPos+1,
+ (pSet->mnItems-nPos)*sizeof( ImplSplitItem ) );
+ }
+ else
+ {
+ delete pSet->mpItems;
+ pSet->mpItems = NULL;
+ }
+
+ ImplUpdate();
+
+ // Window erst hier loeschen, um weniger Paints zu haben
+ if ( pWindow )
+ {
+ // Fenster wieder herstellen
+ if ( bHide || (pOrgParent != this) )
+ {
+ pWindow->Hide();
+ pWindow->SetParent( pOrgParent );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::Clear()
+{
+ // Alle Sets loeschen
+ ImplDeleteSet( mpMainSet );
+
+ // Main-Set wieder anlegen
+ mpMainSet = new ImplSplitSet;
+ mpMainSet->mpItems = NULL;
+ mpMainSet->mpWallpaper = NULL;
+ mpMainSet->mpBitmap = NULL;
+ mpMainSet->mnLastSize = 0;
+ mpMainSet->mnItems = 0;
+ mpMainSet->mnId = 0;
+ mpMainSet->mnSplitSize = SPLITWIN_SPLITSIZE;
+ mpMainSet->mbCalcPix = TRUE;
+ if ( mnWinStyle & WB_NOSPLITDRAW )
+ mpMainSet->mnSplitSize -= 2;
+ mpBaseSet = mpMainSet;
+
+ // Und neu invalidieren
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetBaseSet( USHORT nSetId )
+{
+ mpBaseSet = ImplFindSet( mpMainSet, nSetId );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SplitWindow::GetBaseSet() const
+{
+ return mpBaseSet->mnId;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetSplitSize( USHORT nSetId, long nSplitSize,
+ BOOL bWithChilds )
+{
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+ if ( pSet )
+ {
+ if ( bWithChilds )
+ ImplSetSplitSize( pSet, nSplitSize );
+ else
+ pSet->mnSplitSize = nSplitSize;
+ }
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+long SplitWindow::GetSplitSize( USHORT nSetId ) const
+{
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+ if ( pSet )
+ return pSet->mnSplitSize;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetItemBackground( USHORT nSetId )
+{
+ Wallpaper aWall;
+ SetItemBackground( nSetId, aWall );
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetItemBackground( USHORT nSetId, const Wallpaper& rWallpaper )
+{
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+
+ if ( pSet )
+ {
+ BOOL bUpdate = TRUE;
+
+ if ( rWallpaper.GetStyle() == WALLPAPER_NULL )
+ {
+ if ( pSet->mpWallpaper )
+ {
+ delete pSet->mpWallpaper;
+ pSet->mpWallpaper = NULL;
+ }
+ else
+ bUpdate = FALSE;
+ }
+ else
+ {
+ // Ab jetzt muss immer invalidiert werden
+ mbInvalidate = TRUE;
+
+ if ( !pSet->mpWallpaper )
+ pSet->mpWallpaper = new Wallpaper( rWallpaper );
+ else
+ *(pSet->mpWallpaper) = rWallpaper;
+ }
+
+ // Beim MainSet koennen wir den Background umsetzen
+ if ( pSet == mpMainSet )
+ ImplInitSettings();
+
+ if ( bUpdate )
+ ImplUpdateSet( pSet );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Wallpaper SplitWindow::GetItemBackground( USHORT nSetId ) const
+{
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+
+ if ( pSet && pSet->mpWallpaper )
+ return *(pSet->mpWallpaper);
+ else
+ {
+ Wallpaper aWall;
+ return aWall;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SplitWindow::IsItemBackground( USHORT nSetId ) const
+{
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+
+ if ( pSet && pSet->mpWallpaper )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetItemBitmap( USHORT nSetId, const Bitmap& rBitmap )
+{
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+
+ if ( pSet )
+ {
+ BOOL bUpdate = TRUE;
+
+ if ( !rBitmap )
+ {
+ if ( pSet->mpBitmap )
+ {
+ delete pSet->mpBitmap;
+ pSet->mpBitmap = NULL;
+ }
+ else
+ bUpdate = FALSE;
+ }
+ else
+ {
+ // Ab jetzt muss immer invalidiert werden
+ mbInvalidate = TRUE;
+
+ if ( !pSet->mpBitmap )
+ pSet->mpBitmap = new Bitmap( rBitmap );
+ else
+ *(pSet->mpBitmap) = rBitmap;
+ }
+
+ // Beim MainSet koennen wir den Background umsetzen
+ if ( pSet == mpMainSet )
+ ImplInitSettings();
+
+ if ( bUpdate )
+ ImplUpdateSet( pSet );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Bitmap SplitWindow::GetItemBitmap( USHORT nSetId ) const
+{
+ ImplSplitSet* pSet = ImplFindSet( mpMainSet, nSetId );
+
+ if ( pSet && pSet->mpBitmap )
+ return *(pSet->mpBitmap);
+ else
+ {
+ Bitmap aBitmap;
+ return aBitmap;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SplitItem( USHORT nId, long nNewSize,
+ BOOL bPropSmall, BOOL bPropGreat )
+{
+ USHORT nItems;
+ USHORT nPos;
+ USHORT nMin;
+ USHORT nMax;
+ USHORT i;
+ USHORT n;
+ long nDelta;
+ long nTempDelta;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+ ImplSplitItem* pItems;
+
+ if ( !pSet )
+ return;
+
+ nItems = pSet->mnItems;
+ pItems = pSet->mpItems;
+
+ if ( mbCalc )
+ {
+ pItems[nPos].mnSize = nNewSize;
+ return;
+ }
+
+ nDelta = nNewSize-pItems[nPos].mnPixSize;
+ if ( !nDelta )
+ return;
+
+ // Bereich berechnen, der beim Splitten betroffen sein kann
+ nMin = 0;
+ nMax = nItems;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( pItems[i].mbFixed )
+ {
+ if ( i < nPos )
+ nMin = i+1;
+ else
+ nMax = i;
+ }
+ }
+
+ // Wenn das Fenster sizeable ist, wird das TopSet anders behandelt
+ BOOL bSmall = TRUE;
+ BOOL bGreat = TRUE;
+ if ( (pSet == mpMainSet) && (mnWinStyle & WB_SIZEABLE) )
+ {
+ if ( nPos < pSet->mnItems-1 )
+ {
+ if ( !((bPropSmall && bPropGreat) ||
+ ((nDelta > 0) && bPropSmall) ||
+ ((nDelta < 0) && bPropGreat)) )
+ {
+ if ( nDelta < 0 )
+ bGreat = FALSE;
+ else
+ bSmall = FALSE;
+ }
+ }
+ else
+ {
+ if ( nDelta < 0 )
+ bGreat = FALSE;
+ else
+ bSmall = FALSE;
+ }
+ }
+ else if ( nPos >= nMax )
+ {
+ bSmall = FALSE;
+ bGreat = FALSE;
+ }
+ else if ( nPos && (nPos >= pSet->mnItems-1) )
+ {
+ nPos--;
+ nDelta *= -1;
+ BOOL bTemp = bPropSmall;
+ bPropSmall = bPropGreat;
+ bPropGreat = bTemp;
+ }
+
+ // Jetzt die Fenster splitten
+ if ( nDelta < 0 )
+ {
+ if ( bGreat )
+ {
+ if ( bPropGreat )
+ {
+ nTempDelta = nDelta;
+ do
+ {
+ n = nPos+1;
+ do
+ {
+ if ( nTempDelta )
+ {
+ pItems[n].mnPixSize++;
+ nTempDelta++;
+ }
+ n++;
+ }
+ while ( n < nMax );
+ }
+ while ( nTempDelta );
+ }
+ else
+ pItems[nPos+1].mnPixSize -= nDelta;
+ }
+
+ if ( bSmall )
+ {
+ if ( bPropSmall )
+ {
+ do
+ {
+ n = nPos+1;
+ do
+ {
+ if ( nDelta && pItems[n-1].mnPixSize )
+ {
+ pItems[n-1].mnPixSize--;
+ nDelta++;
+ }
+
+ n--;
+ }
+ while ( n > nMin );
+ }
+ while ( nDelta );
+ }
+ else
+ {
+ n = nPos+1;
+ do
+ {
+ if ( pItems[n-1].mnPixSize+nDelta < 0 )
+ {
+ nDelta += pItems[n-1].mnPixSize;
+ pItems[n-1].mnPixSize = 0;
+ }
+ else
+ {
+ pItems[n-1].mnPixSize += nDelta;
+ break;
+ }
+ n--;
+ }
+ while ( n > nMin );
+ }
+ }
+ }
+ else
+ {
+ if ( bGreat )
+ {
+ if ( bPropGreat )
+ {
+ nTempDelta = nDelta;
+ do
+ {
+ n = nPos+1;
+ do
+ {
+ if ( nTempDelta )
+ {
+ pItems[n-1].mnPixSize++;
+ nTempDelta--;
+ }
+ n--;
+ }
+ while ( n > nMin );
+ }
+ while ( nTempDelta );
+ }
+ else
+ pItems[nPos].mnPixSize += nDelta;
+ }
+
+ if ( bSmall )
+ {
+ if ( bPropSmall )
+ {
+ do
+ {
+ n = nPos+1;
+ do
+ {
+ if ( nDelta && pItems[n].mnPixSize )
+ {
+ pItems[n].mnPixSize--;
+ nDelta--;
+ }
+
+ n++;
+ }
+ while ( n < nMax );
+ }
+ while ( nDelta );
+ }
+ else
+ {
+ n = nPos+1;
+ do
+ {
+ if ( pItems[n].mnPixSize-nDelta < 0 )
+ {
+ nDelta -= pItems[n].mnPixSize;
+ pItems[n].mnPixSize = 0;
+ }
+ else
+ {
+ pItems[n].mnPixSize -= nDelta;
+ break;
+ }
+ n++;
+ }
+ while ( n < nMax );
+ }
+ }
+ }
+
+ // Original-Groessen updaten
+ ImplCalcLogSize( pItems, nItems );
+
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetItemSize( USHORT nId, long nNewSize )
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+ ImplSplitItem* pItem;
+
+ if ( !pSet )
+ return;
+
+ // Testen, ob sich Groesse aendert
+ pItem = &(pSet->mpItems[nPos]);
+ if ( pItem->mnSize != nNewSize )
+ {
+ // Neue Groesse setzen und neu durchrechnen
+ pItem->mnSize = nNewSize;
+ pSet->mbCalcPix = TRUE;
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long SplitWindow::GetItemSize( USHORT nId ) const
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+
+ if ( pSet )
+ return pSet->mpItems[nPos].mnSize;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long SplitWindow::GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+
+ if ( pSet )
+ {
+ if ( nBits == pSet->mpItems[nPos].mnBits )
+ return pSet->mpItems[nPos].mnSize;
+ else
+ {
+ ((SplitWindow*)this)->ImplCalcLayout();
+
+ long nRelSize = 0;
+ long nPerSize = 0;
+ ImplSplitItem* pItems;
+ USHORT nItems;
+ SplitWindowItemBits nTempBits;
+ USHORT i;
+ nItems = pSet->mnItems;
+ pItems = pSet->mpItems;
+ for ( i = 0; i < nItems; i++ )
+ {
+ if ( i == nPos )
+ nTempBits = nBits;
+ else
+ nTempBits = pItems[i].mnBits;
+ if ( nTempBits & SWIB_RELATIVESIZE )
+ nRelSize += pItems[i].mnPixSize;
+ else if ( nTempBits & SWIB_PERCENTSIZE )
+ nPerSize += pItems[i].mnPixSize;
+ }
+ nPerSize += nRelSize;
+ if ( nBits & SWIB_RELATIVESIZE )
+ {
+ if ( nRelSize )
+ return (pItems[nPos].mnPixSize+(nRelSize/2))/nRelSize;
+ else
+ return 1;
+ }
+ else if ( nBits & SWIB_PERCENTSIZE )
+ {
+ if ( nPerSize )
+ return (pItems[nPos].mnPixSize*100)/nPerSize;
+ else
+ return 1;
+ }
+ else
+ return pItems[nPos].mnPixSize;
+ }
+ }
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetItemBits( USHORT nId, SplitWindowItemBits nNewBits )
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+ ImplSplitItem* pItem;
+
+ if ( !pSet )
+ return;
+
+ pItem = &(pSet->mpItems[nPos]);
+ if ( pItem->mpWindow )
+ nNewBits &= ~SWIB_COLSET;
+
+ if ( pItem->mnBits != nNewBits )
+ {
+ // Neue Bits setzen und neu durchrechnen
+ pItem->mnBits = nNewBits;
+ pSet->mbCalcPix = TRUE;
+ ImplUpdate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SplitWindowItemBits SplitWindow::GetItemBits( USHORT nId ) const
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+
+ if ( pSet )
+ return pSet->mpItems[nPos].mnBits;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Window* SplitWindow::GetItemWindow( USHORT nId ) const
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+
+ if ( pSet )
+ return pSet->mpItems[nPos].mpWindow;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SplitWindow::GetSet( USHORT nId ) const
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+
+ if ( pSet )
+ return pSet->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SplitWindow::GetSet( USHORT nId, USHORT& rSetId, USHORT& rPos ) const
+{
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, rPos );
+ if ( pSet )
+ {
+ rSetId = pSet->mnId;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SplitWindow::IsItemValid( USHORT nId ) const
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem( mpBaseSet, nId, nPos );
+
+ if ( pSet )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SplitWindow::GetItemId( Window* pWindow ) const
+{
+ return ImplFindItem( mpBaseSet, pWindow );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SplitWindow::GetItemId( const Point& rPos ) const
+{
+ return ImplFindItem( mpBaseSet, rPos, mbHorz, !mbBottomRight );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SplitWindow::GetItemPos( USHORT nId, USHORT nSetId ) const
+{
+ ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
+ USHORT nPos = SPLITWINDOW_ITEM_NOTFOUND;
+
+ if ( pSet )
+ {
+ for ( USHORT i = 0; i < pSet->mnItems; i++ )
+ {
+ if ( pSet->mpItems[i].mnId == nId )
+ {
+ nPos = i;
+ break;
+ }
+ }
+ }
+
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SplitWindow::GetItemId( USHORT nPos, USHORT nSetId ) const
+{
+ ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
+ if ( pSet && (nPos < pSet->mnItems) )
+ return pSet->mpItems[nPos].mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SplitWindow::GetItemCount( USHORT nSetId ) const
+{
+ ImplSplitSet* pSet = ImplFindSet( mpBaseSet, nSetId );
+ if ( pSet )
+ return pSet->mnItems;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ImplNewAlign()
+{
+ if ( mbNoAlign )
+ {
+ mbHorz = FALSE;
+ mbBottomRight = FALSE;
+ }
+ else if ( meAlign == WINDOWALIGN_TOP )
+ {
+ mbHorz = TRUE;
+ mbBottomRight = FALSE;
+ }
+ else if ( meAlign == WINDOWALIGN_BOTTOM )
+ {
+ mbHorz = TRUE;
+ mbBottomRight = TRUE;
+ }
+ else if ( meAlign == WINDOWALIGN_LEFT )
+ {
+ mbHorz = FALSE;
+ mbBottomRight = FALSE;
+ }
+ else if ( meAlign == WINDOWALIGN_RIGHT )
+ {
+ mbHorz = FALSE;
+ mbBottomRight = TRUE;
+ }
+
+ if ( mnWinStyle & WB_BORDER )
+ {
+ ImplCalcBorder( meAlign, mbNoAlign, mnLeftBorder, mnTopBorder,
+ mnRightBorder, mnBottomBorder );
+ }
+
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetNoAlign( BOOL bNoAlign )
+{
+ bNoAlign = bNoAlign != 0;
+ if ( mbNoAlign != bNoAlign )
+ {
+ mbNoAlign = bNoAlign;
+ ImplNewAlign();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetAlign( WindowAlign eNewAlign )
+{
+ if ( meAlign != eNewAlign )
+ {
+ meAlign = eNewAlign;
+ ImplNewAlign();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size SplitWindow::CalcWindowSizePixel( const Size& rSize, WindowAlign eAlign,
+ WinBits nWinStyle, BOOL bExtra )
+{
+ long nLeft;
+ long nTop;
+ long nRight;
+ long nBottom;
+ Size aSize = rSize;
+
+ ImplCalcBorder( eAlign, FALSE, nLeft, nTop, nRight, nBottom );
+ aSize.Width() += nLeft+nRight;
+ aSize.Height() += nTop+nBottom;
+
+ if ( nWinStyle & WB_SIZEABLE )
+ {
+ if ( (eAlign == WINDOWALIGN_TOP) || (eAlign == WINDOWALIGN_BOTTOM) )
+ {
+ aSize.Height() += SPLITWIN_SPLITSIZE-2;
+ if ( bExtra )
+ aSize.Height() += SPLITWIN_SPLITSIZEEX;
+ }
+ else
+ {
+ aSize.Width() += SPLITWIN_SPLITSIZE-2;
+ if ( bExtra )
+ aSize.Width() += SPLITWIN_SPLITSIZEEX;
+ }
+ }
+
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ShowAutoHideButton( BOOL bShow )
+{
+ mbAutoHide = bShow;
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ShowFadeInHideButton( BOOL bShow )
+{
+ mbFadeIn = bShow;
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::ShowFadeOutButton( BOOL bShow )
+{
+ mbFadeOut = bShow;
+ ImplUpdate();
+}
+
+// -----------------------------------------------------------------------
+
+void SplitWindow::SetAutoHideState( BOOL bAutoHide )
+{
+ mbAutoHideIn = bAutoHide;
+ if ( IsReallyVisible() )
+ {
+ Rectangle aRect;
+ ImplGetAutoHideRect( aRect );
+ Invalidate( aRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long SplitWindow::GetFadeInSize() const
+{
+ long n = 0;
+
+ if ( mbHorz )
+ n = mnTopBorder+mnBottomBorder;
+ else
+ n = mnLeftBorder+mnRightBorder;
+
+ return n+SPLITWIN_SPLITSIZE+SPLITWIN_SPLITSIZEEX-2;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle SplitWindow::GetAutoHideRect() const
+{
+ Rectangle aRect;
+ ImplGetAutoHideRect( aRect, TRUE );
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle SplitWindow::GetFadeInRect() const
+{
+ Rectangle aRect;
+ ImplGetFadeInRect( aRect, TRUE );
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle SplitWindow::GetFadeOutRect() const
+{
+ Rectangle aRect;
+ ImplGetFadeOutRect( aRect, TRUE );
+ return aRect;
+}
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
new file mode 100644
index 000000000000..e96593eb6cfd
--- /dev/null
+++ b/vcl/source/window/status.cxx
@@ -0,0 +1,1411 @@
+/*************************************************************************
+ *
+ * $RCSfile: status.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_STATUS_CXX
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_STATUS_HXX
+#include <status.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define STATUSBAR_OFFSET_X STATUSBAR_OFFSET
+#define STATUSBAR_OFFSET_Y 2
+#define STATUSBAR_OFFSET_TEXTY 3
+
+#define STATUSBAR_PRGS_OFFSET 3
+#define STATUSBAR_PRGS_COUNT 100
+#define STATUSBAR_PRGS_MIN 5
+
+// -----------------------------------------------------------------------
+
+struct ImplStatusItem
+{
+ USHORT mnId;
+ StatusBarItemBits mnBits;
+ long mnWidth;
+ long mnOffset;
+ long mnExtraWidth;
+ long mnX;
+ XubString maText;
+ XubString maHelpText;
+ ULONG mnHelpId;
+ void* mpUserData;
+ BOOL mbVisible;
+};
+
+DECLARE_LIST( ImplStatusItemList, ImplStatusItem* );
+
+// =======================================================================
+
+inline long ImplCalcProgessWidth( USHORT nMax, long nSize )
+{
+ return ((nMax*(nSize+(nSize/2)))-(nSize/2)+(STATUSBAR_PRGS_OFFSET*2));
+}
+
+// -----------------------------------------------------------------------
+
+static Point ImplGetItemTextPos( const Size& rRectSize, const Size& rTextSize,
+ USHORT nStyle )
+{
+ long nX;
+ long nY;
+
+ if ( nStyle & SIB_LEFT )
+ nX = 0;
+ else if ( nStyle & SIB_RIGHT )
+ nX = rRectSize.Width()-rTextSize.Width();
+ else // SIB_CENTER
+ nX = (rRectSize.Width()-rTextSize.Width())/2;
+ nY = (rRectSize.Height()-rTextSize.Height())/2 + 1;
+ return Point( nX, nY );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL StatusBar::ImplIsItemUpdate()
+{
+ if ( !mbProgressMode && mbVisibleItems && IsReallyVisible() && IsUpdateMode() )
+ return TRUE;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ImplInit( Window* pParent, WinBits nStyle )
+{
+ // Default ist RightAlign
+ if ( !(nStyle & (WB_LEFT | WB_RIGHT)) )
+ nStyle |= WB_RIGHT;
+
+ Window::ImplInit( pParent, nStyle & ~WB_BORDER, NULL );
+
+ // WinBits merken
+ mpItemList = new ImplStatusItemList;
+ mpVirDev = new VirtualDevice( *this );
+ mnCurItemId = 0;
+ mbFormat = TRUE;
+ mbVisibleItems = TRUE;
+ mbProgressMode = FALSE;
+ mbInUserDraw = FALSE;
+ mbBottomBorder = FALSE;
+ mnDX = 0;
+ mnDY = 0;
+ mnCalcHeight = 0;
+ mnItemY = STATUSBAR_OFFSET_Y;
+ mnTextY = STATUSBAR_OFFSET_TEXTY;
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ SetLineColor();
+
+ SetSizePixel( CalcWindowSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+StatusBar::StatusBar( Window* pParent, WinBits nStyle ) :
+ Window( WINDOW_STATUSBAR )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+StatusBar::StatusBar( Window* pParent, const ResId& rResId ) :
+ Window( WINDOW_STATUSBAR )
+{
+ rResId.SetRT( RSC_STATUSBAR );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+StatusBar::~StatusBar()
+{
+ // Alle Items loeschen
+ ImplStatusItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ delete mpItemList;
+
+ // VirtualDevice loeschen
+ delete mpVirDev;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetToolFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else if ( GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetButtonTextColor();
+ else
+ aColor = rStyleSettings.GetWindowTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+
+ mpVirDev->SetFont( GetFont() );
+ mpVirDev->SetTextColor( GetTextColor() );
+ mpVirDev->SetTextAlign( GetTextAlign() );
+ mpVirDev->SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetFaceColor();
+ else
+ aColor = rStyleSettings.GetWindowColor();
+ SetBackground( aColor );
+ mpVirDev->SetBackground( GetBackground() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ImplFormat()
+{
+ ImplStatusItem* pItem;
+ long nExtraWidth;
+ long nExtraWidth2;
+ long nX;
+ USHORT nAutoSizeItems = 0;
+
+ // Breiten zusammenrechnen
+ mnItemsWidth = STATUSBAR_OFFSET_X;
+ long nOffset = 0;
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbVisible )
+ {
+ if ( pItem->mnBits & SIB_AUTOSIZE )
+ nAutoSizeItems++;
+
+ mnItemsWidth += pItem->mnWidth + nOffset;
+ nOffset = pItem->mnOffset;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ if ( GetStyle() & WB_RIGHT )
+ {
+ // Bei rechtsbuendiger Ausrichtung wird kein AutoSize ausgewertet,
+ // da wir links den Text anzeigen, der mit SetText gesetzt wird
+ nX = mnDX - mnItemsWidth;
+ nExtraWidth = 0;
+ nExtraWidth2 = 0;
+ }
+ else
+ {
+ mnItemsWidth += STATUSBAR_OFFSET_X;
+
+ // Bei linksbuendiger Ausrichtung muessen wir gegebenenfalls noch
+ // AutoSize auswerten
+ if ( nAutoSizeItems && (mnDX > (mnItemsWidth - STATUSBAR_OFFSET)) )
+ {
+ nExtraWidth = (mnDX - mnItemsWidth - 1) / nAutoSizeItems;
+ nExtraWidth2 = (mnDX - mnItemsWidth - 1) % nAutoSizeItems;
+ }
+ else
+ {
+ nExtraWidth = 0;
+ nExtraWidth2 = 0;
+ }
+ nX = STATUSBAR_OFFSET_X;
+ }
+
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbVisible )
+ {
+ if ( pItem->mnBits & SIB_AUTOSIZE )
+ {
+ pItem->mnExtraWidth = nExtraWidth;
+ if ( nExtraWidth2 )
+ {
+ pItem->mnExtraWidth++;
+ nExtraWidth2--;
+ }
+ }
+ else
+ pItem->mnExtraWidth = 0;
+
+ pItem->mnX = nX;
+ nX += pItem->mnWidth + pItem->mnExtraWidth + pItem->mnOffset;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ mbFormat = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle StatusBar::ImplGetItemRectPos( USHORT nPos ) const
+{
+ Rectangle aRect;
+ ImplStatusItem* pItem;
+
+ pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem )
+ {
+ if ( pItem->mbVisible )
+ {
+ aRect.Left() = pItem->mnX;
+ aRect.Right() = aRect.Left() + pItem->mnWidth + pItem->mnExtraWidth;
+ aRect.Top() = mnItemY;
+ aRect.Bottom() = mnCalcHeight - STATUSBAR_OFFSET_Y;
+ }
+ }
+
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ImplDrawText( BOOL bOffScreen, long nOldTextWidth )
+{
+ // Das ueberschreiben der Item-Box verhindern
+ Rectangle aTextRect;
+ aTextRect.Left() = STATUSBAR_OFFSET_X+1;
+ aTextRect.Top() = mnTextY;
+ if ( mbVisibleItems && (GetStyle() & WB_RIGHT) )
+ aTextRect.Right() = mnDX - mnItemsWidth - 1;
+ else
+ aTextRect.Right() = mnDX - 1;
+ if ( aTextRect.Right() > aTextRect.Left() )
+ {
+ // Position ermitteln
+ XubString aStr = GetText();
+ USHORT nPos = aStr.Search( _LF );
+ if ( nPos != STRING_NOTFOUND )
+ aStr.Erase( nPos );
+
+ aTextRect.Bottom() = aTextRect.Top()+GetTextHeight()+1;
+
+ if ( bOffScreen )
+ {
+ long nMaxWidth = Max( nOldTextWidth, GetTextWidth( aStr ) );
+ Size aVirDevSize( nMaxWidth, aTextRect.GetHeight() );
+ mpVirDev->SetOutputSizePixel( aVirDevSize );
+ Rectangle aTempRect = aTextRect;
+ aTempRect.SetPos( Point( 0, 0 ) );
+ mpVirDev->DrawText( aTempRect, aStr, TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_CLIP | TEXT_DRAW_ENDELLIPSIS );
+ DrawOutDev( aTextRect.TopLeft(), aVirDevSize, Point(), aVirDevSize, *mpVirDev );
+ }
+ else
+ DrawText( aTextRect, aStr, TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_CLIP | TEXT_DRAW_ENDELLIPSIS );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL bDrawFrame )
+{
+ Rectangle aRect = ImplGetItemRectPos( nPos );
+
+ if ( aRect.IsEmpty() )
+ return;
+
+ // Ausgabebereich berechnen
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ Rectangle aTextRect( aRect.Left()+1, aRect.Top()+1,
+ aRect.Right()-1, aRect.Bottom()-1 );
+ Size aTextRectSize( aTextRect.GetSize() );
+
+ if ( bOffScreen )
+ mpVirDev->SetOutputSizePixel( aTextRectSize );
+ else
+ {
+ Region aRegion( aTextRect );
+ SetClipRegion( aRegion );
+ }
+
+ // Text ausgeben
+ if ( bDrawText )
+ {
+ Size aTextSize( GetTextWidth( pItem->maText ), GetTextHeight() );
+ Point aTextPos = ImplGetItemTextPos( aTextRectSize, aTextSize, pItem->mnBits );
+ if ( bOffScreen )
+ mpVirDev->DrawText( aTextPos, pItem->maText );
+ else
+ {
+ aTextPos.X() += aTextRect.Left();
+ aTextPos.Y() += aTextRect.Top();
+ DrawText( aTextPos, pItem->maText );
+ }
+ }
+
+ // Gegebenenfalls auch DrawItem aufrufen
+ if ( pItem->mnBits & SIB_USERDRAW )
+ {
+ if ( bOffScreen )
+ {
+ mbInUserDraw = TRUE;
+ UserDrawEvent aODEvt( mpVirDev, Rectangle( Point(), aTextRectSize ), pItem->mnId );
+ UserDraw( aODEvt );
+ mbInUserDraw = FALSE;
+ }
+ else
+ {
+ UserDrawEvent aODEvt( this, aTextRect, pItem->mnId );
+ UserDraw( aODEvt );
+ }
+ }
+
+ if ( bOffScreen )
+ DrawOutDev( aTextRect.TopLeft(), aTextRectSize, Point(), aTextRectSize, *mpVirDev );
+ else
+ SetClipRegion();
+
+ // Frame ausgeben
+ if ( bDrawFrame && !(pItem->mnBits & SIB_FLAT) )
+ {
+ USHORT nStyle;
+
+ if ( pItem->mnBits & SIB_IN )
+ nStyle = FRAME_DRAW_IN;
+ else
+ nStyle = FRAME_DRAW_OUT;
+
+ DecorationView aDecoView( this );
+ aDecoView.DrawFrame( aRect, nStyle );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef _MSC_VER
+#pragma optimize( "", off )
+#endif
+
+void DrawProgress( Window* pWindow, const Point& rPos,
+ long nOffset, long nPrgsWidth, long nPrgsHeight,
+ USHORT nPercent1, USHORT nPercent2, USHORT nPercentCount )
+{
+ // Werte vorberechnen
+ USHORT nPerc1 = nPercent1 / nPercentCount;
+ USHORT nPerc2 = nPercent2 / nPercentCount;
+
+ // Percent-Rechtecke malen
+ if ( nPerc1 < nPerc2 )
+ {
+ // Wenn Percent2 ueber 100%, Werte anpassen
+ if ( nPercent2 > 10000 )
+ {
+ nPerc2 = 10000 / nPercentCount;
+ if ( nPerc1 >= nPerc2 )
+ nPerc1 = nPerc2-1;
+ }
+
+ // Rechteck berechnen
+ long nDX = nPrgsWidth + nOffset;
+ long nLeft = rPos.X()+(nPerc1*nDX);
+ Rectangle aRect( nLeft, rPos.Y(), nLeft+nPrgsWidth, rPos.Y()+nPrgsHeight );
+
+ do
+ {
+ pWindow->DrawRect( aRect );
+ aRect.Left() += nDX;
+ aRect.Right() += nDX;
+ nPerc1++;
+ }
+ while ( nPerc1 < nPerc2 );
+
+ // Bei mehr als 100%, lassen wir das Rechteck blinken
+ if ( nPercent2 > 10000 )
+ {
+ // an/aus-Status festlegen
+ if ( ((nPercent2 / nPercentCount) & 0x01) == (nPercentCount & 0x01) )
+ {
+ aRect.Left() -= nDX;
+ aRect.Right() -= nDX;
+ pWindow->Erase( aRect );
+ }
+ }
+
+ pWindow->Flush();
+ }
+}
+
+#ifdef _MSC_VER
+#pragma optimize( "", on )
+#endif
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ImplDrawProgress( BOOL bPaint,
+ USHORT nPercent1, USHORT nPercent2 )
+{
+ // Wenn Paint, dann muss auch Text und Frame gemalt werden
+ if ( bPaint )
+ {
+ DrawText( maPrgsTxtPos, maPrgsTxt );
+ DecorationView aDecoView( this );
+ aDecoView.DrawFrame( maPrgsFrameRect, FRAME_DRAW_IN );
+ }
+
+ Point aPos( maPrgsFrameRect.Left()+STATUSBAR_PRGS_OFFSET,
+ maPrgsFrameRect.Top()+STATUSBAR_PRGS_OFFSET );
+ DrawProgress( this, aPos, mnPrgsSize/2, mnPrgsSize, mnPrgsSize,
+ nPercent1*100, nPercent2*100, mnPercentCount );
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ImplCalcProgressRect()
+{
+ // Groessen berechnen
+ Size aPrgsTxtSize( GetTextWidth( maPrgsTxt ), GetTextHeight() );
+ maPrgsTxtPos.X() = STATUSBAR_OFFSET_X+1;
+ maPrgsTxtPos.Y() = mnTextY;
+
+ // Progress-Frame berechnen
+ maPrgsFrameRect.Left() = maPrgsTxtPos.X()+aPrgsTxtSize.Width()+STATUSBAR_OFFSET;
+ maPrgsFrameRect.Top() = mnItemY;
+ maPrgsFrameRect.Bottom() = mnCalcHeight - STATUSBAR_OFFSET_Y;
+
+ // Dabei die Breite des Fensters berechnen
+ mnPrgsSize = maPrgsFrameRect.Bottom()-maPrgsFrameRect.Top()-(STATUSBAR_PRGS_OFFSET*2);
+ USHORT nMaxPercent = STATUSBAR_PRGS_COUNT;
+
+ long nMaxWidth = mnDX-STATUSBAR_OFFSET-1;
+
+ // Wenn es zu viele Percent-Rects sind, verkuerzen wir
+ while ( maPrgsFrameRect.Left()+ImplCalcProgessWidth( nMaxPercent, mnPrgsSize ) > nMaxWidth )
+ {
+ nMaxPercent--;
+ if ( nMaxPercent <= STATUSBAR_PRGS_MIN )
+ break;
+ }
+ maPrgsFrameRect.Right() = maPrgsFrameRect.Left() + ImplCalcProgessWidth( nMaxPercent, mnPrgsSize );
+ // Fuer die weitere Berechnung brauchen wir den Teiler
+ mnPercentCount = 10000 / nMaxPercent;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // Nur bei linker Maustaste ToolBox ausloesen
+ if ( rMEvt.IsLeft() )
+ {
+ if ( mbVisibleItems )
+ {
+ Point aMousePos = rMEvt.GetPosPixel();
+ USHORT i = 0;
+
+ // Item suchen, das geklickt wurde
+ ImplStatusItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Ist es dieses Item
+ if ( ImplGetItemRectPos( i ).IsInside( aMousePos ) )
+ {
+ mnCurItemId = pItem->mnId;
+ if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
+ else
+ Click();
+ mnCurItemId = 0;
+
+ // Item wurde gefunden
+ return;
+ }
+
+ i++;
+ pItem = mpItemList->Next();
+ }
+ }
+
+ // Kein Item, dann nur Click oder DoubleClick
+ if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
+ else
+ Click();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::Paint( const Rectangle& )
+{
+ if ( mbFormat )
+ ImplFormat();
+
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+
+ if ( mbProgressMode )
+ ImplDrawProgress( TRUE, 0, mnPercent );
+ else
+ {
+ // Text zeichen
+ if ( !mbVisibleItems || (GetStyle() & WB_RIGHT) )
+ ImplDrawText( FALSE, 0 );
+
+ // Items zeichnen
+ if ( mbVisibleItems )
+ {
+ // Items zeichnen
+ for ( USHORT i = 0; i < nItemCount; i++ )
+ ImplDrawItem( FALSE, i, TRUE, TRUE );
+ }
+ }
+
+ if ( mbBottomBorder )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( Point( 0, mnDY-2 ), Point( mnDX-1, mnDY-2 ) );
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( 0, mnDY-1 ), Point( mnDX-1, mnDY-1 ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::Move()
+{
+ Window::Move();
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::Resize()
+{
+ // Breite und Hoehe abfragen und merken
+ long nOldDY = mnDX;
+ Size aSize = GetOutputSizePixel();
+ mnDX = aSize.Width();
+ mnDY = aSize.Height();
+ mnCalcHeight = mnDY;
+ if ( mbBottomBorder )
+ mnCalcHeight -= 2;
+
+ // Evt. neue Textposition berechnen
+ if ( nOldDY && (nOldDY < mnDY) )
+ {
+ mnTextY = 0;
+ mnTextY += (mnCalcHeight-GetTextHeight()-mnTextY)/2;
+ }
+
+ // Formatierung neu ausloesen
+ mbFormat = TRUE;
+
+ if ( mbProgressMode )
+ ImplCalcProgressRect();
+
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+
+ if ( nItemId )
+ {
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ {
+ Rectangle aItemRect = GetItemRect( nItemId );
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ XubString aStr = GetHelpText( nItemId );
+ Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
+ return;
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ Rectangle aItemRect = GetItemRect( nItemId );
+ XubString aStr = GetItemText( nItemId );
+ // Wir zeigen die Quick-Hilfe nur an, wenn Text nicht
+ // vollstaendig sichtbar
+ if ( GetTextWidth( aStr ) > aItemRect.GetWidth() )
+ {
+ Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
+ aItemRect.Left() = aPt.X();
+ aItemRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aItemRect.BottomRight() );
+ aItemRect.Right() = aPt.X();
+ aItemRect.Bottom() = aPt.Y();
+ Help::ShowQuickHelp( this, aItemRect, aStr );
+ return;
+ }
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
+ {
+ ULONG nHelpId = GetHelpId( nItemId );
+ if ( nHelpId )
+ {
+ // Wenn eine Hilfe existiert, dann ausloesen
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pHelp->Start( nHelpId );
+ return;
+ }
+ }
+ }
+
+ Window::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ ImplFormat();
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ Invalidate();
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ mbFormat = TRUE;
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ mbFormat = TRUE;
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::Click()
+{
+ maClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::UserDraw( const UserDrawEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::InsertItem( USHORT nItemId, ULONG nWidth,
+ StatusBarItemBits nBits,
+ long nOffset, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "StatusBar::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == STATUSBAR_ITEM_NOTFOUND,
+ "StatusBar::InsertItem(): ItemId already exists" );
+
+ // IN und CENTER sind Default
+ if ( !(nBits & (SIB_IN | SIB_OUT | SIB_FLAT)) )
+ nBits |= SIB_IN;
+ if ( !(nBits & (SIB_LEFT | SIB_RIGHT | SIB_CENTER)) )
+ nBits |= SIB_CENTER;
+
+ // Item anlegen
+ ImplStatusItem* pItem = new ImplStatusItem;
+ pItem->mnId = nItemId;
+ pItem->mnBits = nBits;
+ pItem->mnWidth = (long)nWidth+2;
+ pItem->mnOffset = nOffset;
+ pItem->mnHelpId = 0;
+ pItem->mpUserData = 0;
+ pItem->mbVisible = TRUE;
+
+ // Item in die Liste einfuegen
+ mpItemList->Insert( pItem, nPos );
+
+ mbFormat = TRUE;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::RemoveItem( USHORT nItemId )
+{
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = mpItemList->Remove( nPos );
+ delete pItem;
+
+ mbFormat = TRUE;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ShowItem( USHORT nItemId )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ if ( !pItem->mbVisible )
+ {
+ pItem->mbVisible = TRUE;
+
+ mbFormat = TRUE;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::HideItem( USHORT nItemId )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem->mbVisible )
+ {
+ pItem->mbVisible = FALSE;
+
+ mbFormat = TRUE;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL StatusBar::IsItemVisible( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mbVisible;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::ShowItems()
+{
+ if ( !mbVisibleItems )
+ {
+ mbVisibleItems = TRUE;
+ if ( !mbProgressMode )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::HideItems()
+{
+ if ( mbVisibleItems )
+ {
+ mbVisibleItems = FALSE;
+ if ( !mbProgressMode )
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::CopyItems( const StatusBar& rStatusBar )
+{
+ // Alle Items entfernen
+ ImplStatusItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Items aus der Liste loeschen
+ mpItemList->Clear();
+
+ // Items kopieren
+ ULONG i = 0;
+ pItem = rStatusBar.mpItemList->GetObject( i );
+ while ( pItem )
+ {
+ mpItemList->Insert( new ImplStatusItem( *pItem ), LIST_APPEND );
+ i++;
+ pItem = rStatusBar.mpItemList->GetObject( i );
+ }
+
+ mbFormat = TRUE;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::Clear()
+{
+ // Alle Item loeschen
+ ImplStatusItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Items aus der Liste loeschen
+ mpItemList->Clear();
+
+ mbFormat = TRUE;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT StatusBar::GetItemCount() const
+{
+ return (USHORT)mpItemList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+USHORT StatusBar::GetItemId( USHORT nPos ) const
+{
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem )
+ return pItem->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT StatusBar::GetItemPos( USHORT nItemId ) const
+{
+ ImplStatusItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nItemId )
+ return (USHORT)mpItemList->GetCurPos();
+
+ pItem = mpItemList->Next();
+ }
+
+ return STATUSBAR_ITEM_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT StatusBar::GetItemId( const Point& rPos ) const
+{
+ if ( AreItemsVisible() && !mbFormat )
+ {
+ USHORT nItemCount = GetItemCount();
+ USHORT nPos;
+ for ( nPos = 0; nPos < nItemCount; nPos++ )
+ {
+ // Rechteck holen
+ Rectangle aRect = ImplGetItemRectPos( nPos );
+ if ( aRect.IsInside( rPos ) )
+ return mpItemList->GetObject( nPos )->mnId;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle StatusBar::GetItemRect( USHORT nItemId ) const
+{
+ Rectangle aRect;
+
+ if ( AreItemsVisible() && !mbFormat )
+ {
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ // Rechteck holen und Rahmen abziehen
+ aRect = ImplGetItemRectPos( nPos );
+ aRect.Left()++;
+ aRect.Right()--;
+ return aRect;
+ }
+ }
+
+ return aRect;
+}
+
+// -----------------------------------------------------------------------
+
+Point StatusBar::GetItemTextPos( USHORT nItemId ) const
+{
+ if ( !mbFormat )
+ {
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ // Rechteck holen
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ Rectangle aRect = ImplGetItemRectPos( nPos );
+ Rectangle aTextRect( aRect.Left()+1, aRect.Top()+1,
+ aRect.Right()-1, aRect.Bottom()-1 );
+ Point aPos = ImplGetItemTextPos( aTextRect.GetSize(),
+ Size( GetTextWidth( pItem->maText ), GetTextHeight() ),
+ pItem->mnBits );
+ if ( !mbInUserDraw )
+ {
+ aPos.X() += aTextRect.Left();
+ aPos.Y() += aTextRect.Top();
+ }
+ return aPos;
+ }
+ }
+
+ return Point();
+}
+
+// -----------------------------------------------------------------------
+
+ULONG StatusBar::GetItemWidth( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnWidth;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+StatusBarItemBits StatusBar::GetItemBits( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnBits;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long StatusBar::GetItemOffset( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnOffset;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::SetItemText( USHORT nItemId, const XubString& rText )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+
+ if ( pItem->maText != rText )
+ {
+ pItem->maText = rText;
+
+ // Item neu Zeichen, wenn StatusBar sichtbar und
+ // UpdateMode gesetzt ist
+ if ( pItem->mbVisible && !mbFormat && ImplIsItemUpdate() )
+ {
+ Update();
+ ImplDrawItem( TRUE, nPos, TRUE, FALSE );
+ Flush();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& StatusBar::GetItemText( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maText;
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::SetItemData( USHORT nItemId, void* pNewData )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ pItem->mpUserData = pNewData;
+
+ // Wenn es ein User-Item ist, DrawItem-Aufrufen
+ if ( (pItem->mnBits & SIB_USERDRAW) && pItem->mbVisible &&
+ !mbFormat && ImplIsItemUpdate() )
+ {
+ Update();
+ ImplDrawItem( TRUE, nPos, FALSE, FALSE );
+ Flush();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void* StatusBar::GetItemData( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mpUserData;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::SetHelpText( USHORT nItemId, const XubString& rText )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ mpItemList->GetObject( nPos )->maHelpText = rText;
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& StatusBar::GetHelpText( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ {
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
+ {
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId );
+ }
+
+ return pItem->maHelpText;
+ }
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::SetHelpId( USHORT nItemId, ULONG nHelpId )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ mpItemList->GetObject( nPos )->mnHelpId = nHelpId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG StatusBar::GetHelpId( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->mnHelpId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::SetBottomBorder( BOOL bBottomBorder )
+{
+ if ( mbBottomBorder != bBottomBorder )
+ {
+ mbBottomBorder = bBottomBorder;
+ mnCalcHeight = mnDY;
+ if ( mbBottomBorder )
+ mnCalcHeight -= 2;
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::StartProgressMode( const XubString& rText )
+{
+ DBG_ASSERT( !mbProgressMode, "StatusBar::StartProgressMode(): progress mode is active" );
+
+ mbProgressMode = TRUE;
+ mnPercent = 0;
+ maPrgsTxt = rText;
+
+ // Groessen berechnen
+ ImplCalcProgressRect();
+
+ // Paint ausloesen (dort wird der Text und der Frame gemalt)
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Color aPrgsColor = rStyleSettings.GetHighlightColor();
+ if ( aPrgsColor == rStyleSettings.GetFaceColor() )
+ aPrgsColor = rStyleSettings.GetDarkShadowColor();
+ SetLineColor();
+ SetFillColor( aPrgsColor );
+ if ( IsReallyVisible() )
+ {
+ Invalidate();
+ Update();
+ Flush();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::SetProgressValue( USHORT nNewPercent )
+{
+ DBG_ASSERT( mbProgressMode, "StatusBar::SetProgressValue(): no progrss mode" );
+ DBG_ASSERTWARNING( nNewPercent <= 100, "StatusBar::SetProgressValue(): nPercent > 100" );
+
+ if ( mbProgressMode && IsReallyVisible() )
+ {
+ Update();
+ SetLineColor();
+ ImplDrawProgress( FALSE, mnPercent, nNewPercent );
+ Flush();
+ }
+ mnPercent = nNewPercent;
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::EndProgressMode()
+{
+ DBG_ASSERT( mbProgressMode, "StatusBar::EndProgressMode(): no progress mode" );
+
+ mbProgressMode = FALSE;
+ maPrgsTxt.Erase();
+
+ // Paint neu ausloesen um StatusBar wieder herzustellen
+ SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
+ if ( IsReallyVisible() )
+ {
+ Invalidate();
+ Update();
+ Flush();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void StatusBar::SetText( const XubString& rText )
+{
+ if ( (!mbVisibleItems || (GetStyle() & WB_RIGHT)) && !mbProgressMode &&
+ IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( mbFormat )
+ {
+ Invalidate();
+ Window::SetText( rText );
+ }
+ else
+ {
+ Update();
+ long nOldTextWidth = GetTextWidth( GetText() );
+ Window::SetText( rText );
+ ImplDrawText( TRUE, nOldTextWidth );
+ Flush();
+ }
+ }
+ else
+ Window::SetText( rText );
+}
+
+// -----------------------------------------------------------------------
+
+Size StatusBar::CalcWindowSizePixel() const
+{
+ ULONG i = 0;
+ ULONG nCount = mpItemList->Count();
+ long nOffset = 0;
+ long nCalcWidth = (STATUSBAR_OFFSET_X*2);
+ long nCalcHeight;
+
+ while ( i < nCount )
+ {
+ ImplStatusItem* pItem = mpItemList->GetObject( i );
+ nCalcWidth += pItem->mnWidth + nOffset;
+ nOffset = pItem->mnOffset;
+ i++;
+ }
+
+ nCalcHeight = GetTextHeight()+(STATUSBAR_OFFSET_TEXTY*2);
+ if ( mbBottomBorder )
+ nCalcHeight += 2;
+
+ return Size( nCalcWidth, nCalcHeight );
+}
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
new file mode 100644
index 000000000000..99991bc91b3e
--- /dev/null
+++ b/vcl/source/window/syschild.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * $RCSfile: syschild.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SYSCHILD_CXX
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#include <window.hxx>
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_WIDNOW_H
+#include <window.h>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_SYSCHILD_HXX
+#include <syschild.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+#ifndef REMOTE_APPSERVER
+
+long ImplSysChildProc( void* pInst, SalObject* /* pObject */,
+ USHORT nEvent, const void* /* pEvent */ )
+{
+ SystemChildWindow* pWindow = (SystemChildWindow*)pInst;
+ long nRet = 0;
+
+ switch ( nEvent )
+ {
+ case SALOBJ_EVENT_GETFOCUS:
+ // Focus holen und zwar so, das alle Handler gerufen
+ // werden, als ob dieses Fenster den Focus bekommt,
+ // ohne das der Frame den Focus wieder klaut
+ pWindow->ImplGetFrameData()->mbSysObjFocus = TRUE;
+ pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = TRUE;
+ pWindow->ToTop( TOTOP_NOGRABFOCUS );
+ pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = FALSE;
+ pWindow->ImplGetFrameData()->mbInSysObjFocusHdl = TRUE;
+ pWindow->GrabFocus();
+ pWindow->ImplGetFrameData()->mbInSysObjFocusHdl = FALSE;
+ break;
+
+ case SALOBJ_EVENT_LOSEFOCUS:
+ // Hintenrum einen LoseFocus ausloesen, das der Status
+ // der Fenster dem entsprechenden Activate-Status
+ // entspricht
+ pWindow->ImplGetFrameData()->mbSysObjFocus = FALSE;
+ if ( !pWindow->ImplGetFrameData()->mnFocusId )
+ {
+ pWindow->ImplGetFrameData()->mbStartFocusState = TRUE;
+ Application::PostUserEvent( pWindow->ImplGetFrameData()->mnFocusId, LINK( pWindow->ImplGetFrameWindow(), Window, ImplAsyncFocusHdl ) );
+ }
+ break;
+
+ case SALOBJ_EVENT_TOTOP:
+ pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = TRUE;
+ if ( !Application::GetFocusWindow() || pWindow->HasChildPathFocus() )
+ pWindow->ToTop( TOTOP_NOGRABFOCUS );
+ else
+ pWindow->ToTop();
+ pWindow->GrabFocus();
+ pWindow->ImplGetFrameData()->mbInSysObjToTopHdl = FALSE;
+ break;
+ }
+
+ return nRet;
+}
+
+#endif
+
+// =======================================================================
+
+void SystemChildWindow::ImplInit( Window* pParent, WinBits nStyle )
+{
+#ifndef REMOTE_APPSERVER
+ mpSysObj = ImplGetSVData()->mpDefInst->CreateObject( pParent->ImplGetFrame() );
+#endif
+
+ Window::ImplInit( pParent, nStyle, NULL );
+
+#ifndef REMOTE_APPSERVER
+ // Wenn es ein richtiges SysChild ist, dann painten wir auch nicht
+ if ( GetSystemData() )
+ {
+ mpSysObj->SetCallback( this, ImplSysChildProc );
+ SetParentClipMode( PARENTCLIPMODE_CLIP );
+ SetBackground();
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+SystemChildWindow::SystemChildWindow( Window* pParent, WinBits nStyle ) :
+ Window( WINDOW_SYSTEMCHILDWINDOW )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+SystemChildWindow::SystemChildWindow( Window* pParent, const ResId& rResId ) :
+ Window( WINDOW_SYSTEMCHILDWINDOW )
+{
+ rResId.SetRT( RSC_WINDOW );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+SystemChildWindow::~SystemChildWindow()
+{
+#ifndef REMOTE_APPSERVER
+ Hide();
+ if ( mpSysObj )
+ {
+ ImplGetSVData()->mpDefInst->DestroyObject( mpSysObj );
+ mpSysObj = NULL;
+ }
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+const SystemEnvData* SystemChildWindow::GetSystemData() const
+{
+#ifndef REMOTE_APPSERVER
+ if ( mpSysObj )
+ return mpSysObj->GetSystemData();
+ else
+ return NULL;
+#else
+ return NULL;
+#endif
+}
+
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
new file mode 100644
index 000000000000..786f1af2b15a
--- /dev/null
+++ b/vcl/source/window/syswin.cxx
@@ -0,0 +1,389 @@
+/*************************************************************************
+ *
+ * $RCSfile: syswin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SYSWIN_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#ifndef _SV_MENU_HXX
+#include <menu.hxx>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_SYSWIN_HXX
+#include <syswin.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+
+#include <unowrap.hxx>
+
+#pragma hdrstop
+
+// =======================================================================
+
+SystemWindow::SystemWindow( WindowType nType ) :
+ Window( nType )
+{
+ mbSysWin = TRUE;
+ mnActivateMode = ACTIVATE_MODE_GRABFOCUS;
+
+ mpMenuBar = NULL;
+ mbPined = FALSE;
+ mbRollUp = FALSE;
+ mbRollFunc = FALSE;
+ mbDockBtn = FALSE;
+ mbHideBtn = FALSE;
+ mnMenuBarMode = MENUBAR_MODE_NORMAL;
+}
+
+// -----------------------------------------------------------------------
+
+long SystemWindow::Notify( NotifyEvent& rNEvt )
+{
+ // Abfangen von KeyEvents fuer Menu-Steuerung
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ MenuBar* pMBar = mpMenuBar;
+ if ( !pMBar && ( GetType() == WINDOW_FLOATINGWINDOW ) )
+ {
+ SystemWindow* pW = (SystemWindow*)ImplGetFrameWindow()->ImplGetWindow();
+ if ( pW )
+ pMBar = pW->GetMenuBar();
+ }
+ if ( pMBar && pMBar->ImplHandleKeyEvent( *rNEvt.GetKeyEvent(), FALSE ) )
+ return TRUE;
+ }
+
+ return Window::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SystemWindow::Close()
+{
+ if ( mxWindowPeer.is() )
+ {
+ // #76482# This window can be destroyed in WindowEvent_Close.
+ // => Don't use members after calling WindowEvent_Close
+ BOOL bCreatedWithToolkit = IsCreatedWithToolkit();
+ Application::GetUnoWrapper()->WindowEvent_Close( this );
+ if ( bCreatedWithToolkit )
+ return FALSE;
+ }
+
+ Hide();
+
+ // Ist es das Applikationsfenster, dann beende die Applikation
+ if ( Application::GetAppWindow() == (const WorkWindow*)this )
+ GetpApp()->Quit();
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::TitleButtonClick( USHORT )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::Pin()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::Roll()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::Resizing( Size& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::SetZLevel( BYTE nLevel )
+{
+ Window* pWindow = this;
+ while ( pWindow->mpBorderWindow )
+ pWindow = pWindow->mpBorderWindow;
+ if ( pWindow->mbOverlapWin && !pWindow->mbFrame )
+ {
+ BYTE nOldLevel = pWindow->mpOverlapData->mnTopLevel;
+ pWindow->mpOverlapData->mnTopLevel = nLevel;
+ // Wenn der neue Level groesser als der alte ist, schieben
+ // wir das Fenster nach hinten
+ if ( !IsReallyVisible() && (nLevel > nOldLevel) && pWindow->mpNext )
+ {
+ // Fenster aus der Liste entfernen
+ if ( pWindow->mpPrev )
+ pWindow->mpPrev->mpNext = pWindow->mpNext;
+ else
+ pWindow->mpOverlapWindow->mpFirstOverlap = pWindow->mpNext;
+ pWindow->mpNext->mpPrev = pWindow->mpPrev;
+ pWindow->mpNext = NULL;
+ // und Fenster wieder in die Liste am Ende eintragen
+ pWindow->mpPrev = pWindow->mpOverlapWindow->mpLastOverlap;
+ pWindow->mpOverlapWindow->mpLastOverlap = pWindow;
+ pWindow->mpPrev->mpNext = pWindow;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BYTE SystemWindow::GetZLevel() const
+{
+ const Window* pWindow = this;
+ while ( pWindow->mpBorderWindow )
+ pWindow = pWindow->mpBorderWindow;
+ if ( pWindow->mpOverlapData )
+ return pWindow->mpOverlapData->mnTopLevel;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::EnableSaveBackground( BOOL bSave )
+{
+ Window* pWindow = this;
+ while ( pWindow->mpBorderWindow )
+ pWindow = pWindow->mpBorderWindow;
+ if ( pWindow->mbOverlapWin && !pWindow->mbFrame )
+ {
+ pWindow->mpOverlapData->mbSaveBack = bSave;
+ if ( !bSave )
+ pWindow->ImplDeleteOverlapBackground();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SystemWindow::IsSaveBackgroundEnabled() const
+{
+ const Window* pWindow = this;
+ while ( pWindow->mpBorderWindow )
+ pWindow = pWindow->mpBorderWindow;
+ if ( pWindow->mpOverlapData )
+ return pWindow->mpOverlapData->mbSaveBack;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::ShowTitleButton( USHORT nButton, BOOL bVisible )
+{
+ if ( nButton == TITLE_BUTTON_DOCKING )
+ {
+ if ( mbDockBtn != bVisible )
+ {
+ mbDockBtn = bVisible;
+ if ( mpBorderWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->SetDockButton( bVisible );
+ }
+ }
+ else /* if ( nButton == TITLE_BUTTON_HIDE ) */
+ {
+ if ( mbHideBtn != bVisible )
+ {
+ mbHideBtn = bVisible;
+ if ( mpBorderWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->SetHideButton( bVisible );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SystemWindow::IsTitleButtonVisible( USHORT nButton ) const
+{
+ if ( nButton == TITLE_BUTTON_DOCKING )
+ return mbDockBtn;
+ else /* if ( nButton == TITLE_BUTTON_HIDE ) */
+ return mbHideBtn;
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::SetPin( BOOL bPin )
+{
+ if ( bPin != mbPined )
+ {
+ mbPined = bPin;
+ if ( mpBorderWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->SetPin( bPin );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::RollUp()
+{
+ if ( !mbRollUp )
+ {
+ maOrgSize = GetOutputSizePixel();
+ mbRollFunc = TRUE;
+ Size aSize = maRollUpOutSize;
+ if ( !aSize.Width() )
+ aSize.Width() = GetOutputSizePixel().Width();
+ mbRollUp = TRUE;
+ if ( mpBorderWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->SetRollUp( TRUE, aSize );
+ else
+ SetOutputSizePixel( aSize );
+ mbRollFunc = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::RollDown()
+{
+ if ( mbRollUp )
+ {
+ mbRollUp = FALSE;
+ if ( mpBorderWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->SetRollUp( FALSE, maOrgSize );
+ else
+ SetOutputSizePixel( maOrgSize );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::SetMinOutputSizePixel( const Size& rSize )
+{
+ maMinOutSize = rSize;
+ if ( mpBorderWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->SetMinOutputSize( rSize.Width(), rSize.Height() );
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::SetMenuBar( MenuBar* pMenuBar )
+{
+ if ( mpMenuBar != pMenuBar )
+ {
+ MenuBar* pOldMenuBar = mpMenuBar;
+ Window* pOldWindow;
+ mpMenuBar = pMenuBar;
+
+ if ( mpBorderWindow && (mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) )
+ {
+ if ( pOldMenuBar )
+ pOldWindow = pOldMenuBar->ImplGetWindow();
+ else
+ pOldWindow = NULL;
+ if ( pMenuBar )
+ {
+ DBG_ASSERT( !pMenuBar->pWindow, "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" );
+ ((ImplBorderWindow*)mpBorderWindow)->SetMenuBarWindow( MenuBar::ImplCreate( mpBorderWindow, pOldWindow, pMenuBar ) );
+ }
+ else
+ ((ImplBorderWindow*)mpBorderWindow)->SetMenuBarWindow( NULL );
+ ImplToBottomChild();
+ if ( pOldMenuBar )
+ MenuBar::ImplDestroy( pOldMenuBar, pMenuBar == 0 );
+ }
+
+ Application::GenerateAccessEvent( ACCESS_EVENT_MENUBAR );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SystemWindow::SetMenuBarMode( USHORT nMode )
+{
+ if ( mnMenuBarMode != nMode )
+ {
+ mnMenuBarMode = nMode;
+ if ( mpBorderWindow && (mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) )
+ {
+ if ( nMode == MENUBAR_MODE_HIDE )
+ ((ImplBorderWindow*)mpBorderWindow)->SetMenuBarMode( TRUE );
+ else
+ ((ImplBorderWindow*)mpBorderWindow)->SetMenuBarMode( FALSE );
+ }
+ }
+}
diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx
new file mode 100644
index 000000000000..b4b212d90ec1
--- /dev/null
+++ b/vcl/source/window/tabdlg.cxx
@@ -0,0 +1,315 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabdlg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_TABDLG_CXX
+
+#ifndef _SV_FIXED_HXX
+#include <fixed.hxx>
+#endif
+#ifndef _SV_TABCTRL_HXX
+#include <tabctrl.hxx>
+#endif
+#ifndef _SV_TABDLG_HXX
+#include <tabdlg.hxx>
+#endif
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+void TabDialog::ImplInitData()
+{
+ mpFixedLine = NULL;
+ mpViewWindow = NULL;
+ meViewAlign = WINDOWALIGN_LEFT;
+ mbPosControls = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void TabDialog::ImplPosControls()
+{
+ Size aCtrlSize( IMPL_MINSIZE_BUTTON_WIDTH, IMPL_MINSIZE_BUTTON_HEIGHT );
+ long nDownCtrl = 0;
+ long nOffY = 0;
+ TabControl* pTabControl = NULL;
+
+ Window* pChild = GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ if ( pChild->IsVisible() && (pChild != mpViewWindow) )
+ {
+ if ( pChild->GetType() == WINDOW_TABCONTROL )
+ pTabControl = (TabControl*)pChild;
+ else if ( pTabControl )
+ {
+ long nTxtWidth = pChild->GetCtrlTextWidth( pChild->GetText() );
+ nTxtWidth += IMPL_EXTRA_BUTTON_WIDTH;
+ if ( nTxtWidth > aCtrlSize.Width() )
+ aCtrlSize.Width() = nTxtWidth;
+ long nTxtHeight = pChild->GetTextHeight();
+ nTxtHeight += IMPL_EXTRA_BUTTON_HEIGHT;
+ if ( nTxtHeight > aCtrlSize.Height() )
+ aCtrlSize.Height() = nTxtHeight;
+ nDownCtrl++;
+ }
+ else
+ {
+ long nHeight = pChild->GetSizePixel().Height();
+ if ( nHeight > nOffY )
+ nOffY = nHeight;
+ }
+ }
+
+ pChild = pChild->GetWindow( WINDOW_NEXT );
+ }
+
+ // Haben wir ueberhaupt ein TabControl
+ if ( pTabControl )
+ {
+ // Offset bei weiteren Controls um einen weiteren Abstand anpassen
+ if ( nOffY )
+ nOffY += IMPL_DIALOG_BAR_OFFSET*2 + 2;
+
+ Point aTabOffset( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+nOffY );
+ Size aTabSize = pTabControl->GetSizePixel();
+ Size aDlgSize( aTabSize.Width() + IMPL_DIALOG_OFFSET*2,
+ aTabSize.Height() + IMPL_DIALOG_OFFSET*2 + nOffY );
+ long nBtnEx = 0;
+
+ // Preview-Fenster beruecksichtigen und die Groessen/Offsets anpassen
+ if ( mpViewWindow && mpViewWindow->IsVisible() )
+ {
+ long nViewOffX = 0;
+ long nViewOffY = 0;
+ long nViewWidth = 0;
+ long nViewHeight = 0;
+ USHORT nViewPosFlags = WINDOW_POSSIZE_POS;
+ Size aViewSize = mpViewWindow->GetSizePixel();
+ if ( meViewAlign == WINDOWALIGN_TOP )
+ {
+ nViewOffX = aTabOffset.X();
+ nViewOffY = nOffY+IMPL_DIALOG_OFFSET;
+ nViewWidth = aTabSize.Width();
+ nViewPosFlags |= WINDOW_POSSIZE_WIDTH;
+ aTabOffset.Y() += aViewSize.Height()+IMPL_DIALOG_OFFSET;
+ aDlgSize.Height() += aViewSize.Height()+IMPL_DIALOG_OFFSET;
+ }
+ else if ( meViewAlign == WINDOWALIGN_BOTTOM )
+ {
+ nViewOffX = aTabOffset.X();
+ nViewOffY = aTabOffset.Y()+aTabSize.Height()+IMPL_DIALOG_OFFSET;
+ nViewWidth = aTabSize.Width();
+ nViewPosFlags |= WINDOW_POSSIZE_WIDTH;
+ aDlgSize.Height() += aViewSize.Height()+IMPL_DIALOG_OFFSET;
+ }
+ else if ( meViewAlign == WINDOWALIGN_RIGHT )
+ {
+ nViewOffX = aTabOffset.X()+aTabSize.Width()+IMPL_DIALOG_OFFSET;
+ nViewOffY = aTabOffset.Y();
+ nViewHeight = aTabSize.Height();
+ nViewPosFlags |= WINDOW_POSSIZE_HEIGHT;
+ aDlgSize.Width() += aViewSize.Width()+IMPL_DIALOG_OFFSET;
+ nBtnEx = aViewSize.Width()+IMPL_DIALOG_OFFSET;
+ }
+ else // meViewAlign == WINDOWALIGN_LEFT
+ {
+ nViewOffX = IMPL_DIALOG_OFFSET;
+ nViewOffY = aTabOffset.Y();
+ nViewHeight = aTabSize.Height();
+ nViewPosFlags |= WINDOW_POSSIZE_HEIGHT;
+ aTabOffset.X() += aViewSize.Width()+IMPL_DIALOG_OFFSET;
+ aDlgSize.Width() += aViewSize.Width()+IMPL_DIALOG_OFFSET;
+ nBtnEx = aViewSize.Width()+IMPL_DIALOG_OFFSET;
+ }
+
+ mpViewWindow->SetPosSizePixel( nViewOffX, nViewOffY,
+ nViewWidth, nViewHeight,
+ nViewPosFlags );
+ }
+
+ // Positionierung vornehmen
+ pTabControl->SetPosPixel( aTabOffset );
+
+ // Alle anderen Childs positionieren
+ BOOL bTabCtrl = FALSE;
+ int nLines = 0;
+ long nX;
+ long nY = aDlgSize.Height();
+ long nTopX = IMPL_DIALOG_OFFSET;
+
+ // Unter Windows 95 werden die Buttons rechtsbuendig angeordnet
+ nX = IMPL_DIALOG_OFFSET;
+ long nCtrlBarWidth = ((aCtrlSize.Width()+IMPL_DIALOG_OFFSET)*nDownCtrl)-IMPL_DIALOG_OFFSET;
+ if ( nCtrlBarWidth <= (aTabSize.Width()+nBtnEx) )
+ nX = (aTabSize.Width()+nBtnEx) - nCtrlBarWidth + IMPL_DIALOG_OFFSET;
+
+ pChild = pChild = GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ if ( pChild->IsVisible() && (pChild != mpViewWindow) )
+ {
+ if ( pChild == pTabControl )
+ bTabCtrl = TRUE;
+ else if ( bTabCtrl )
+ {
+ if ( !nLines )
+ nLines = 1;
+
+ if ( nX+aCtrlSize.Width()-IMPL_DIALOG_OFFSET > (aTabSize.Width()+nBtnEx) )
+ {
+ nY += aCtrlSize.Height()+IMPL_DIALOG_OFFSET;
+ nX = IMPL_DIALOG_OFFSET;
+ nLines++;
+ }
+
+ pChild->SetPosSizePixel( Point( nX, nY ), aCtrlSize );
+ nX += aCtrlSize.Width()+IMPL_DIALOG_OFFSET;
+ }
+ else
+ {
+ Size aChildSize = pChild->GetSizePixel();
+ pChild->SetPosPixel( Point( nTopX, (nOffY-aChildSize.Height())/2 ) );
+ nTopX += aChildSize.Width()+2;
+ }
+ }
+
+ pChild = pChild->GetWindow( WINDOW_NEXT );
+ }
+
+ aDlgSize.Height() += nLines * (aCtrlSize.Height()+IMPL_DIALOG_OFFSET);
+ SetOutputSizePixel( aDlgSize );
+ }
+
+ // Offset merken
+ if ( nOffY )
+ {
+ Size aDlgSize = GetOutputSizePixel();
+ if ( !mpFixedLine )
+ mpFixedLine = new FixedLine( this );
+ mpFixedLine->SetPosSizePixel( Point( 0, nOffY ),
+ Size( aDlgSize.Width(), 2 ) );
+ mpFixedLine->Show();
+ }
+
+ mbPosControls = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+TabDialog::TabDialog( Window* pParent, WinBits nStyle ) :
+ Dialog( WINDOW_TABDIALOG )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+TabDialog::TabDialog( Window* pParent, const ResId& rResId ) :
+ Dialog( WINDOW_TABDIALOG )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_TABDIALOG );
+ ImplInit( pParent, ImplInitRes( rResId ) );
+ ImplLoadRes( rResId );
+}
+
+// -----------------------------------------------------------------------
+
+TabDialog::~TabDialog()
+{
+ if ( mpFixedLine )
+ delete mpFixedLine;
+}
+
+// -----------------------------------------------------------------------
+
+void TabDialog::Resize()
+{
+// !!! In the future the controls should be automaticly rearrange
+// !!! if the window is resized
+// !!! if ( !IsRollUp() )
+// !!! ImplPosControls();
+}
+
+// -----------------------------------------------------------------------
+
+void TabDialog::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ // Calculate the Layout only for the initialized state
+ if ( mbPosControls )
+ ImplPosControls();
+ }
+ Dialog::StateChanged( nType );
+}
+
+// -----------------------------------------------------------------------
+
+void TabDialog::AdjustLayout()
+{
+ ImplPosControls();
+}
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
new file mode 100644
index 000000000000..af9d5b0a6f4b
--- /dev/null
+++ b/vcl/source/window/tabpage.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabpage.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_TABPAGE_CXX
+
+#include <tools/ref.hxx>
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_TABPAGE_HXX
+#include <tabpage.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+void TabPage::ImplInit( Window* pParent, WinBits nStyle )
+{
+ if ( !(nStyle & WB_NODIALOGCONTROL) )
+ nStyle |= WB_DIALOGCONTROL;
+
+ Window::ImplInit( pParent, nStyle, NULL );
+
+ ImplInitSettings();
+}
+
+// -----------------------------------------------------------------------
+
+void TabPage::ImplInitSettings()
+{
+ Window* pParent = GetParent();
+ if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
+ {
+ EnableChildTransparentMode( TRUE );
+ SetParentClipMode( PARENTCLIPMODE_NOCLIP );
+ SetPaintTransparent( TRUE );
+ SetBackground();
+ }
+ else
+ {
+ EnableChildTransparentMode( FALSE );
+ SetParentClipMode( 0 );
+ SetPaintTransparent( FALSE );
+
+ if ( IsControlBackground() )
+ SetBackground( GetControlBackground() );
+ else
+ SetBackground( pParent->GetBackground() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+TabPage::TabPage( Window* pParent, WinBits nStyle ) :
+ Window( WINDOW_TABPAGE )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+TabPage::TabPage( Window* pParent, const ResId& rResId ) :
+ Window( WINDOW_TABPAGE )
+{
+ rResId.SetRT( RSC_TABPAGE );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void TabPage::StateChanged( StateChangedType nType )
+{
+ Window::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ {
+ if ( Application::IsAutoMnemonicEnabled() )
+ ImplWindowAutoMnemonic( this );
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ ImplInitSettings();
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void TabPage::ActivatePage()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void TabPage::DeactivatePage()
+{
+}
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
new file mode 100644
index 000000000000..fcc618cba323
--- /dev/null
+++ b/vcl/source/window/toolbox.cxx
@@ -0,0 +1,4176 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolbox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_TOOLBOX_CXX
+
+#include <string.h>
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_DECOVIEW_HXX
+#include <decoview.hxx>
+#endif
+#ifndef _SV_ACCEL_HXX
+#include <accel.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_SOUND_HXX
+#include <sound.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_SPIN_H
+#include <spin.h>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+#define private public
+#ifndef _SV_TOOLBOX_HXX
+#include <toolbox.hxx>
+#endif
+#undef private
+#ifndef _SV_TOOLBOX_H
+#include <toolbox.h>
+#endif
+
+// =======================================================================
+
+DBG_NAMEEX( Window );
+
+// =======================================================================
+
+#define SMALLBUTTON_HSIZE 7
+#define SMALLBUTTON_VSIZE 7
+
+#define SMALLBUTTON_OFF_NORMAL_X 3
+#define SMALLBUTTON_OFF_NORMAL_Y 3
+#define SMALLBUTTON_OFF_CHECKED_X 4
+#define SMALLBUTTON_OFF_CHECKED_Y 4
+#define SMALLBUTTON_OFF_PRESSED_X 5
+#define SMALLBUTTON_OFF_PRESSED_Y 5
+
+#define OUTBUTTON_SIZE 6
+#define OUTBUTTON_BORDER 4
+#define OUTBUTTON_OFF_NORMAL_X 1
+#define OUTBUTTON_OFF_NORMAL_Y 1
+
+// -----------------------------------------------------------------------
+
+#define DEF_MIN_WIDTH 8
+#define DEF_MIN_HEIGHT 8
+#define DEF_IMAGE_WIDTH 16
+#define DEF_IMAGE_HEIGHT 15
+#define DEF_TEXT_WIDTH 40
+
+#define TB_TEXTOFFSET 2
+#define TB_LINESPACING 3
+#define TB_SPIN_SIZE 14
+#define TB_SPIN_OFFSET 2
+#define TB_BORDER_OFFSET1 4
+#define TB_BORDER_OFFSET2 2
+#define TB_CUSTOMIZE_OFFSET 2
+#define TB_RESIZE_OFFSET 3
+#define TB_MAXLINES 5
+#define TB_MAXNOSCROLL 32765
+
+#define TB_MIN_WIN_WIDTH 20
+
+#define TB_CALCMODE_HORZ 1
+#define TB_CALCMODE_VERT 2
+#define TB_CALCMODE_FLOAT 3
+
+#define TB_WBLINESIZING (WB_SIZEABLE | WB_DOCKABLE | WB_SCROLL)
+
+#define TB_MAX_GROUPS 100
+
+#define DOCK_LINEHSIZE ((USHORT)0x0001)
+#define DOCK_LINEVSIZE ((USHORT)0x0002)
+#define DOCK_LINERIGHT ((USHORT)0x1000)
+#define DOCK_LINEBOTTOM ((USHORT)0x2000)
+#define DOCK_LINELEFT ((USHORT)0x4000)
+#define DOCK_LINETOP ((USHORT)0x8000)
+#define DOCK_LINEOFFSET 3
+
+// -----------------------------------------------------------------------
+
+struct ImplToolSize
+{
+ long mnWidth;
+ long mnHeight;
+ USHORT mnLines;
+};
+
+// -----------------------------------------------------------------------
+
+struct ImplButtonData
+{
+ VirtualDevice* mpBtnDev;
+ long mnWidth;
+ long mnHeight;
+ USHORT mnRefCount;
+};
+
+DECLARE_LIST( ImplButtonList, ImplButtonData* );
+
+// -----------------------------------------------------------------------
+
+DECLARE_LIST( ImplTBList, ToolBox* );
+
+class ImplTBDragMgr
+{
+private:
+ ImplTBList* mpBoxList;
+ ToolBox* mpDragBox;
+ Point maMouseOff;
+ Rectangle maRect;
+ Rectangle maStartRect;
+ Accelerator maAccel;
+ long mnMinWidth;
+ long mnMaxWidth;
+ USHORT mnLineMode;
+ USHORT mnStartLines;
+ void* mpCustomizeData;
+ BOOL mbCustomizeMode;
+ BOOL mbResizeMode;
+ BOOL mbShowDragRect;
+
+public:
+ ImplTBDragMgr();
+ ~ImplTBDragMgr();
+
+ void Insert( ToolBox* pBox )
+ { mpBoxList->Insert( pBox ); }
+ void Remove( ToolBox* pBox )
+ { mpBoxList->Remove( pBox ); }
+ ULONG Count() const
+ { return mpBoxList->Count(); }
+
+ ToolBox* FindToolBox( const Rectangle& rRect );
+
+ void StartDragging( ToolBox* pDragBox,
+ const Point& rPos, const Rectangle& rRect,
+ USHORT nLineMode, BOOL bResizeItem,
+ void* pData = NULL );
+ void Dragging( const Point& rPos );
+ void EndDragging( BOOL bOK = TRUE );
+ void HideDragRect() { if ( mbShowDragRect ) mpDragBox->HideTracking(); }
+ void UpdateDragRect();
+ DECL_LINK( SelectHdl, Accelerator* );
+
+ void StartCustomizeMode();
+ void EndCustomizeMode();
+ BOOL IsCustomizeMode() { return mbCustomizeMode; }
+ BOOL IsResizeMode() { return mbResizeMode; }
+};
+
+// -----------------------------------------------------------------------
+
+static ImplTBDragMgr* ImplGetTBDragMgr()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maCtrlData.mpTBDragMgr )
+ pSVData->maCtrlData.mpTBDragMgr = new ImplTBDragMgr;
+ return pSVData->maCtrlData.mpTBDragMgr;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawConfigFrame( ToolBox* pThis, const Rectangle& rRect )
+{
+/*
+ Color aBlackColor( COL_BLACK );
+ Pen aOldPen;
+ Brush aOldBrush;
+ Pen aNullPen( PEN_NULL );
+
+ aOldPen = pThis->GetPen();
+ pThis->SetPen( aNullPen );
+ if ( pThis->IsSVLook() )
+ {
+ Color aFaceColor( COL_3DFACE );
+ Brush aBrush( aFaceColor, aBlackColor, BRUSH_50 );
+ aOldBrush = pThis->GetFillInBrush();
+ pThis->SetFillInBrush( aBrush );
+ }
+ else
+ {
+ Color aWhiteColor( COL_WHITE );
+ Brush aBrush( aBlackColor, aWhiteColor, BRUSH_50 );
+ aOldBrush = pThis->GetFillInBrush();
+ pThis->SetFillInBrush( aBrush );
+ }
+ pThis->DrawRect( Rectangle( rRect.Left(), rRect.Top(),
+ rRect.Right(), rRect.Top()+2 ) );
+ pThis->DrawRect( Rectangle( rRect.Left(), rRect.Top(),
+ rRect.Left()+2, rRect.Bottom() ) );
+ pThis->DrawRect( Rectangle( rRect.Left(), rRect.Bottom()-2,
+ rRect.Right(), rRect.Bottom() ) );
+ pThis->DrawRect( Rectangle( rRect.Right()-2, rRect.Top(),
+ rRect.Right(), rRect.Bottom() ) );
+
+ pThis->SetPen( aOldPen );
+ pThis->SetFillInBrush( aOldBrush );
+*/
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
+ long& rRight, long& rBottom )
+{
+ if ( eAlign == WINDOWALIGN_TOP )
+ {
+ rLeft = 0;
+ rTop = 2;
+ rRight = 0;
+ rBottom = 0;
+ }
+ else if ( eAlign == WINDOWALIGN_LEFT )
+ {
+ rLeft = 2;
+ rTop = 2;
+ rRight = 0;
+ rBottom = 2;
+ }
+ else if ( eAlign == WINDOWALIGN_BOTTOM )
+ {
+ rLeft = 0;
+ rTop = 0;
+ rRight = 0;
+ rBottom = 2;
+ }
+ else
+ {
+ rLeft = 0;
+ rTop = 2;
+ rRight = 2;
+ rBottom = 2;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawBorder( ToolBox* pWin )
+{
+ const StyleSettings& rStyleSettings = pWin->GetSettings().GetStyleSettings();
+ long nDX = pWin->mnDX;
+ long nDY = pWin->mnDY;
+
+ if ( pWin->meAlign == WINDOWALIGN_BOTTOM )
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
+ }
+ else
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( 0, 1 ), Point( nDX-1, 1 ) );
+ if ( (pWin->meAlign == WINDOWALIGN_LEFT) || (pWin->meAlign == WINDOWALIGN_RIGHT) )
+ {
+ if ( pWin->meAlign == WINDOWALIGN_LEFT )
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
+ pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
+ pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
+ }
+ else
+ {
+ pWin->SetLineColor( rStyleSettings.GetShadowColor() );
+ pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
+ pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-2, nDY-2 ) );
+ pWin->SetLineColor( rStyleSettings.GetLightColor() );
+ pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
+ pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static Size ImplCalcSize( const ToolBox* pThis,
+ USHORT nCalcLines, USHORT nCalcMode = 0 )
+{
+ long nMax;
+ long nLeft;
+ long nTop;
+ long nRight;
+ long nBottom;
+ Size aSize;
+ WindowAlign eOldAlign;
+ BOOL bOldHorz;
+
+ // Gegebenenfalls neu durchrechnen
+ if ( nCalcMode )
+ {
+ eOldAlign = pThis->meAlign;
+ bOldHorz = pThis->mbHorz;
+
+ if ( nCalcMode == TB_CALCMODE_HORZ )
+ {
+ ImplCalcBorder( WINDOWALIGN_TOP, nLeft, nTop, nRight, nBottom );
+ ((ToolBox*)pThis)->mbHorz = TRUE;
+ if ( pThis->mbHorz != bOldHorz )
+ ((ToolBox*)pThis)->meAlign = WINDOWALIGN_TOP;
+ }
+ else if ( nCalcMode == TB_CALCMODE_FLOAT )
+ {
+ nLeft = nTop = nRight = nBottom = 0;
+ ((ToolBox*)pThis)->mbHorz = TRUE;
+ if ( pThis->mbHorz != bOldHorz )
+ ((ToolBox*)pThis)->meAlign = WINDOWALIGN_TOP;
+ }
+ else
+ {
+ ImplCalcBorder( WINDOWALIGN_LEFT, nLeft, nTop, nRight, nBottom );
+ ((ToolBox*)pThis)->mbHorz = FALSE;
+ if ( pThis->mbHorz != bOldHorz )
+ ((ToolBox*)pThis)->meAlign = WINDOWALIGN_LEFT;
+ }
+
+ if ( (pThis->meAlign != eOldAlign) || (pThis->mbHorz != bOldHorz) )
+ ((ToolBox*)pThis)->mbCalc = TRUE;
+ }
+ else
+ ImplCalcBorder( pThis->meAlign, nLeft, nTop, nRight, nBottom );
+
+ ((ToolBox*)pThis)->ImplCalcItem();
+
+ if ( pThis->mbHorz )
+ {
+ if ( pThis->mnWinHeight-2 > pThis->mnItemHeight )
+ aSize.Height() = nCalcLines * pThis->mnWinHeight-2;
+ else
+ aSize.Height() = nCalcLines * pThis->mnItemHeight;
+
+ if ( pThis->mnWinStyle & WB_LINESPACING )
+ aSize.Height() += (nCalcLines-1)*TB_LINESPACING;
+
+ if ( pThis->mnWinStyle & WB_BORDER )
+ aSize.Height() += (TB_BORDER_OFFSET2*2) + nTop + nBottom;
+
+ if ( !(pThis->mnWinStyle & WB_SCROLL) )
+ {
+ nMax = 0;
+ ((ToolBox*)pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz );
+ if ( nMax )
+ aSize.Width() += nMax;
+
+ if ( pThis->mnWinStyle & WB_BORDER )
+ aSize.Width() += (TB_BORDER_OFFSET1*2) + nLeft + nRight;
+ }
+ }
+ else
+ {
+ aSize.Width() = nCalcLines * pThis->mnItemWidth;
+
+ if ( pThis->mnWinStyle & WB_LINESPACING )
+ aSize.Width() += (nCalcLines-1)*TB_LINESPACING;
+
+ if ( pThis->mnWinStyle & WB_BORDER )
+ aSize.Width() += (TB_BORDER_OFFSET2*2) + nLeft + nRight;
+
+ if ( !(pThis->mnWinStyle & WB_SCROLL) )
+ {
+ nMax = 0;
+ ((ToolBox*)pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz );
+ if ( nMax )
+ aSize.Height() += nMax;
+
+ if ( pThis->mnWinStyle & WB_BORDER )
+ aSize.Height() += (TB_BORDER_OFFSET1*2) + nTop + nBottom;
+ }
+ }
+
+ // Gegebenenfalls wieder alte Werte herstellen
+ if ( nCalcMode )
+ {
+ if ( (pThis->meAlign != eOldAlign) || (pThis->mbHorz != bOldHorz) )
+ {
+ ((ToolBox*)pThis)->meAlign = eOldAlign;
+ ((ToolBox*)pThis)->mbHorz = bOldHorz;
+ ((ToolBox*)pThis)->mbCalc = TRUE;
+ }
+ }
+
+ if ( aSize.Width() )
+ aSize.Width() += pThis->mnBorderX*2;
+ if ( aSize.Height() )
+ aSize.Height() += pThis->mnBorderY*2;
+
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCalcFloatSizes( ToolBox* pThis )
+{
+ if ( pThis->mpFloatSizeAry )
+ return;
+
+ // min. Groesse berechnen
+ long nCalcSize = pThis->mnItemWidth;
+ ImplToolItem* pItem;
+ pItem = pThis->mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbVisible )
+ {
+ if ( pItem->mpWindow )
+ {
+ long nTempSize = pItem->mpWindow->GetSizePixel().Width();
+ if ( nTempSize > nCalcSize )
+ nCalcSize = nTempSize;
+ }
+ else if ( pItem->mnNonStdSize )
+ {
+ if ( pItem->mnNonStdSize > nCalcSize )
+ nCalcSize = pItem->mnNonStdSize;
+ }
+ }
+
+ pItem = pThis->mpItemList->Next();
+ }
+
+ USHORT i;
+ USHORT nLines;
+ USHORT nCalcLines;
+ USHORT nTempLines;
+ long nHeight;
+ long nMaxLineWidth;
+ long nDesktopWidth = pThis->GetDesktopRectPixel().GetWidth()-10;
+ nCalcLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, TRUE );
+ pThis->mpFloatSizeAry = new ImplToolSize[nCalcLines];
+ memset( pThis->mpFloatSizeAry, 0, sizeof( ImplToolSize )*nCalcLines );
+ i = 0;
+ nLines = nCalcLines;
+ while ( nLines )
+ {
+ nHeight = ImplCalcSize( pThis, nLines, TB_CALCMODE_FLOAT ).Height();
+ pThis->mpFloatSizeAry[i].mnHeight = nHeight;
+ pThis->mpFloatSizeAry[i].mnLines = nLines;
+ if ( nCalcSize >= nDesktopWidth )
+ {
+ pThis->mpFloatSizeAry[i].mnWidth = nDesktopWidth;
+ nLines--;
+ }
+ else
+ {
+ pThis->mpFloatSizeAry[i].mnWidth = nMaxLineWidth+(TB_BORDER_OFFSET1*2);
+ nLines--;
+ if ( nLines )
+ {
+ do
+ {
+ nCalcSize += pThis->mnItemWidth;
+ nTempLines = pThis->ImplCalcBreaks( nCalcSize, &nMaxLineWidth, TRUE );
+ }
+ while ( (nLines < nTempLines) && (nTempLines != 1) && (nCalcSize < nDesktopWidth) );
+ if ( nTempLines < nLines )
+ nLines = nTempLines;
+ }
+ }
+ i++;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static Size ImplCalcFloatSize( ToolBox* pThis, USHORT& rLines )
+{
+ ImplCalcFloatSizes( pThis );
+
+ if ( !rLines )
+ {
+ rLines = pThis->mnFloatLines;
+ if ( !rLines )
+ rLines = pThis->mnLines;
+ }
+
+ USHORT i = 0;
+ while ( rLines < pThis->mpFloatSizeAry[i].mnLines )
+ i++;
+
+ Size aSize( pThis->mpFloatSizeAry[i].mnWidth,
+ pThis->mpFloatSizeAry[i].mnHeight );
+ rLines = pThis->mpFloatSizeAry[i].mnLines;
+ if ( pThis->maNextToolBoxStr.Len() && pThis->mbScroll )
+ aSize.Width() += TB_SPIN_SIZE-TB_SPIN_OFFSET;
+ return aSize;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplCalcLines( ToolBox* pThis, long nToolSize )
+{
+ long nLineHeight;
+
+ if ( pThis->mbHorz )
+ {
+ if ( pThis->mnWinHeight-2 > pThis->mnItemHeight )
+ nLineHeight = pThis->mnWinHeight-2;
+ else
+ nLineHeight = pThis->mnItemHeight;
+ }
+ else
+ nLineHeight = pThis->mnItemWidth;
+
+ if ( pThis->mnWinStyle & WB_BORDER )
+ nToolSize -= TB_BORDER_OFFSET2*2;
+
+ if ( pThis->mnWinStyle & WB_LINESPACING )
+ {
+ nLineHeight += TB_LINESPACING;
+ nToolSize += TB_LINESPACING;
+ }
+
+ return (USHORT)(nToolSize/nLineHeight);
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplTestLineSize( ToolBox* pThis, const Point& rPos )
+{
+ if ( !pThis->IsFloatingMode() &&
+ (!pThis->mbScroll || (pThis->mnLines > 1) || (pThis->mnCurLines > pThis->mnVisLines)) )
+ {
+ WindowAlign eAlign = pThis->GetAlign();
+
+ if ( eAlign == WINDOWALIGN_LEFT )
+ {
+ if ( rPos.X() > pThis->mnDX-DOCK_LINEOFFSET )
+ return DOCK_LINEHSIZE | DOCK_LINERIGHT;
+ }
+ else if ( eAlign == WINDOWALIGN_TOP )
+ {
+ if ( rPos.Y() > pThis->mnDY-DOCK_LINEOFFSET )
+ return DOCK_LINEVSIZE | DOCK_LINEBOTTOM;
+ }
+ else if ( eAlign == WINDOWALIGN_RIGHT )
+ {
+ if ( rPos.X() < DOCK_LINEOFFSET )
+ return DOCK_LINEHSIZE | DOCK_LINELEFT;
+ }
+ else if ( eAlign == WINDOWALIGN_BOTTOM )
+ {
+ if ( rPos.Y() < DOCK_LINEOFFSET )
+ return DOCK_LINEVSIZE | DOCK_LINETOP;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect,
+ USHORT nLineMode )
+{
+ BOOL mbHorz;
+ long nOneLineSize;
+ long nCurSize;
+ long nMaxSize;
+ long nSize;
+ Size aSize;
+
+ if ( nLineMode & DOCK_LINERIGHT )
+ {
+ nCurSize = rPos.X() - rRect.Left();
+ mbHorz = FALSE;
+ }
+ else if ( nLineMode & DOCK_LINEBOTTOM )
+ {
+ nCurSize = rPos.Y() - rRect.Top();
+ mbHorz = TRUE;
+ }
+ else if ( nLineMode & DOCK_LINELEFT )
+ {
+ nCurSize = rRect.Right() - rPos.X();
+ mbHorz = FALSE;
+ }
+ else if ( nLineMode & DOCK_LINETOP )
+ {
+ nCurSize = rRect.Bottom() - rPos.Y();
+ mbHorz = TRUE;
+ }
+
+ Size aWinSize = pThis->GetSizePixel();
+ USHORT nMaxLines = (pThis->mnLines > pThis->mnCurLines) ? pThis->mnLines : pThis->mnCurLines;
+ if ( nMaxLines > TB_MAXLINES )
+ nMaxLines = TB_MAXLINES;
+ if ( mbHorz )
+ {
+ nOneLineSize = ImplCalcSize( pThis, 1 ).Height();
+ nMaxSize = pThis->maOutDockRect.GetHeight() - 20;
+ if ( nMaxSize < aWinSize.Height() )
+ nMaxSize = aWinSize.Height();
+ }
+ else
+ {
+ nOneLineSize = ImplCalcSize( pThis, 1 ).Width();
+ nMaxSize = pThis->maOutDockRect.GetWidth() - 20;
+ if ( nMaxSize < aWinSize.Width() )
+ nMaxSize = aWinSize.Width();
+ }
+
+ USHORT i = 1;
+ if ( nCurSize <= nOneLineSize )
+ nSize = nOneLineSize;
+ else
+ {
+ nSize = 0;
+ while ( (nSize < nCurSize) && (i < nMaxLines) )
+ {
+ i++;
+ aSize = ImplCalcSize( pThis, i );
+ if ( mbHorz )
+ nSize = aSize.Height();
+ else
+ nSize = aSize.Width();
+ if ( nSize > nMaxSize )
+ {
+ i--;
+ aSize = ImplCalcSize( pThis, i );
+ if ( mbHorz )
+ nSize = aSize.Height();
+ else
+ nSize = aSize.Width();
+ break;
+ }
+ }
+ }
+
+ if ( nLineMode & DOCK_LINERIGHT )
+ rRect.Right() = rRect.Left()+nSize-1;
+ else if ( nLineMode & DOCK_LINEBOTTOM )
+ rRect.Bottom() = rRect.Top()+nSize-1;
+ else if ( nLineMode & DOCK_LINELEFT )
+ rRect.Left() = rRect.Right()-nSize;
+ else if ( nLineMode & DOCK_LINETOP )
+ rRect.Top() = rRect.Bottom()-nSize;
+
+ pThis->mnDockLines = i;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplFindItemPos( ToolBox* pBox, const Point& rPos )
+{
+ USHORT nPos = 0;
+ long nLast = 0;
+ Point aPos = rPos;
+ Size aSize( pBox->mnDX, pBox->mnDY );
+
+ if ( aPos.X() > aSize.Width()-TB_BORDER_OFFSET1 )
+ aPos.X() = aSize.Width()-TB_BORDER_OFFSET1;
+ if ( aPos.Y() > aSize.Height()-TB_BORDER_OFFSET1 )
+ aPos.Y() = aSize.Height()-TB_BORDER_OFFSET1;
+
+ // Item suchen, das geklickt wurde
+ ImplToolItem* pItem = pBox->mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbVisible )
+ {
+ if ( nLast || !pItem->maRect.IsEmpty() )
+ {
+ if ( pBox->mbHorz )
+ {
+ if ( nLast &&
+ ((nLast < pItem->maRect.Top()) || pItem->maRect.IsEmpty()) )
+ return nPos;
+
+ if ( aPos.Y() <= pItem->maRect.Bottom() )
+ {
+ if ( aPos.X() < pItem->maRect.Left() )
+ return nPos;
+ else if ( aPos.X() < pItem->maRect.Right() )
+ return nPos+1;
+ else if ( !nLast )
+ nLast = pItem->maRect.Bottom();
+ }
+ }
+ else
+ {
+ if ( nLast &&
+ ((nLast < pItem->maRect.Left()) || pItem->maRect.IsEmpty()) )
+ return nPos;
+
+ if ( aPos.X() <= pItem->maRect.Right() )
+ {
+ if ( aPos.Y() < pItem->maRect.Top() )
+ return nPos;
+ else if ( aPos.Y() < pItem->maRect.Bottom() )
+ return nPos+1;
+ else if ( !nLast )
+ nLast = pItem->maRect.Right();
+ }
+ }
+ }
+ }
+
+ nPos++;
+ pItem = pBox->mpItemList->Next();
+ }
+
+ return nPos;
+}
+
+// -----------------------------------------------------------------------
+
+ImplTBDragMgr::ImplTBDragMgr()
+{
+ mpBoxList = new ImplTBList( 4, 4 );
+ mnLineMode = 0;
+ mnStartLines = 0;
+ mbCustomizeMode = FALSE;
+ mbResizeMode = FALSE;
+ mbShowDragRect = FALSE;
+ mpDragBox = NULL;
+
+ maAccel.InsertItem( KEY_RETURN, KeyCode( KEY_RETURN ) );
+ maAccel.InsertItem( KEY_ESCAPE, KeyCode( KEY_ESCAPE ) );
+ maAccel.SetSelectHdl( LINK( this, ImplTBDragMgr, SelectHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+ImplTBDragMgr::~ImplTBDragMgr()
+{
+ delete mpBoxList;
+}
+
+// -----------------------------------------------------------------------
+
+ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect )
+{
+ // ToolBox suchen
+ Point aPos = rRect.Center();
+ ToolBox* pBox = mpBoxList->First();
+ while ( pBox )
+ {
+ if ( pBox->IsReallyVisible() )
+ {
+ Window* pWindow = pBox->ImplGetFrameWindow()->FindWindow( aPos );
+ if ( pWindow && pBox->IsWindowOrChild( pWindow ) )
+ return pBox;
+ }
+ pBox = mpBoxList->Next();
+ }
+
+ // Falls so nicht gefunden wurde, suchen wir die ToolBox ueber das Rechteck
+ pBox = mpBoxList->First();
+ while ( pBox )
+ {
+ if ( pBox->IsReallyVisible() )
+ {
+ if ( pBox->IsFloatingMode() )
+ {
+ Rectangle aTempRect( pBox->GetPosPixel(), pBox->GetSizePixel() );
+ if ( aTempRect.IsOver( rRect ) )
+ return pBox;
+ }
+ }
+
+ pBox = mpBoxList->Next();
+ }
+
+ pBox = mpBoxList->First();
+ while ( pBox )
+ {
+ if ( pBox->IsReallyVisible() )
+ {
+ if ( !pBox->IsFloatingMode() )
+ {
+ Point aPos = pBox->GetPosPixel();
+ aPos = pBox->GetParent()->OutputToScreenPixel( aPos );
+ Rectangle aTempRect( aPos, pBox->GetSizePixel() );
+ if ( aTempRect.IsOver( rRect ) )
+ return pBox;
+ }
+ }
+
+ pBox = mpBoxList->Next();
+ }
+
+ return pBox;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTBDragMgr::StartDragging( ToolBox* pToolBox,
+ const Point& rPos, const Rectangle& rRect,
+ USHORT nDragLineMode, BOOL bResizeItem,
+ void* pData )
+{
+ mpDragBox = pToolBox;
+ pToolBox->CaptureMouse();
+ pToolBox->mbDragging = TRUE;
+ Application::InsertAccel( &maAccel );
+
+ if ( nDragLineMode )
+ {
+ mnLineMode = nDragLineMode;
+ mnStartLines = pToolBox->mnDockLines;
+ }
+ else
+ {
+ mpCustomizeData = pData;
+ mbResizeMode = bResizeItem;
+ pToolBox->Activate();
+ pToolBox->mnCurItemId = pToolBox->mnConfigItem;
+ pToolBox->Highlight();
+ pToolBox->mnCurItemId = 0;
+ if ( !mbResizeMode )
+ ImplDrawConfigFrame( pToolBox, rRect );
+ else
+ {
+ if ( rRect.GetWidth() < TB_MIN_WIN_WIDTH )
+ mnMinWidth = rRect.GetWidth();
+ else
+ mnMinWidth = TB_MIN_WIN_WIDTH;
+ mnMaxWidth = pToolBox->GetSizePixel().Width()-rRect.Left()-
+ TB_SPIN_SIZE-TB_BORDER_OFFSET1-(TB_SPIN_OFFSET*2);
+ }
+ }
+
+ // MouseOffset berechnen
+ maMouseOff.X() = rRect.Left() - rPos.X();
+ maMouseOff.Y() = rRect.Top() - rPos.Y();
+ maRect = rRect;
+ maStartRect = rRect;
+ mbShowDragRect = TRUE;
+ pToolBox->ShowTracking( maRect );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTBDragMgr::Dragging( const Point& rPos )
+{
+ if ( mnLineMode )
+ {
+ ImplLineSizing( mpDragBox, rPos, maRect, mnLineMode );
+ Point aPos = mpDragBox->OutputToScreenPixel( rPos );
+ Point aOff = mpDragBox->OutputToScreenPixel( Point() );
+ maRect.Move( aOff.X(), aOff.Y() );
+ mpDragBox->Docking( rPos, maRect );
+ maRect.Move( -aOff.X(), -aOff.Y() );
+ mpDragBox->ShowTracking( maRect );
+ }
+ else
+ {
+ if ( mbResizeMode )
+ {
+ long nXOff = rPos.X()-maStartRect.Left();
+ nXOff += maMouseOff.X()+(maStartRect.Right()-maStartRect.Left());
+ if ( nXOff < mnMinWidth )
+ nXOff = mnMinWidth;
+ if ( nXOff > mnMaxWidth )
+ nXOff = mnMaxWidth;
+ maRect.Right() = maStartRect.Left()+nXOff;
+ }
+ else
+ {
+ maRect.SetPos( rPos );
+ maRect.Move( maMouseOff.X(), maMouseOff.Y() );
+ }
+ mpDragBox->ShowTracking( maRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTBDragMgr::EndDragging( BOOL bOK )
+{
+ mpDragBox->HideTracking();
+ mpDragBox->ReleaseMouse();
+ mpDragBox->mbDragging = FALSE;
+ mbShowDragRect = FALSE;
+ Application::RemoveAccel( &maAccel );
+
+ if ( mnLineMode )
+ {
+ if ( !bOK )
+ {
+ mpDragBox->mnDockLines = mnStartLines;
+ mpDragBox->EndDocking( maStartRect, FALSE );
+ }
+ else
+ mpDragBox->EndDocking( maRect, FALSE );
+ mnLineMode = 0;
+ mnStartLines = 0;
+ }
+ else
+ {
+ USHORT nTempItem = mpDragBox->mnConfigItem;
+ if ( nTempItem )
+ {
+ mpDragBox->mnConfigItem = 0;
+ if ( !mbResizeMode )
+ mpDragBox->Invalidate( mpDragBox->GetItemRect( nTempItem ) );
+ }
+
+ if ( bOK && (maRect != maStartRect) )
+ {
+ if ( mbResizeMode )
+ {
+ ImplToolItem* pItem = mpDragBox->ImplGetItem( nTempItem );
+ Size aSize = pItem->mpWindow->GetSizePixel();
+ aSize.Width() = maRect.GetWidth();
+ pItem->mpWindow->SetSizePixel( aSize );
+
+ // ToolBox neu brechnen und neu ausgeben
+ mpDragBox->ImplInvalidate( TRUE );
+ mpDragBox->Customize( ToolBoxCustomizeEvent( mpDragBox, nTempItem,
+ TOOLBOX_CUSTOMIZE_RESIZE,
+ mpCustomizeData ) );
+ }
+ else
+ {
+ Point aOff = mpDragBox->OutputToScreenPixel( Point() );
+ Rectangle aScreenRect( maRect );
+ aScreenRect.Move( aOff.X(), aOff.Y() );
+ ToolBox* pDropBox = FindToolBox( aScreenRect );
+ if ( pDropBox )
+ {
+ // Such-Position bestimmen
+ Point aPos;
+ if ( pDropBox->mbHorz )
+ {
+ aPos.X() = aScreenRect.Left()-TB_CUSTOMIZE_OFFSET;
+ aPos.Y() = aScreenRect.Center().Y();
+ }
+ else
+ {
+ aPos.X() = aScreenRect.Center().X();
+ aPos.Y() = aScreenRect.Top()-TB_CUSTOMIZE_OFFSET;
+ }
+
+ aPos = pDropBox->ScreenToOutputPixel( aPos );
+ USHORT nPos = ImplFindItemPos( pDropBox, aPos );
+ mpDragBox->Customize( ToolBoxCustomizeEvent( pDropBox, nTempItem,
+ nPos, mpCustomizeData ) );
+ }
+ else
+ {
+ mpDragBox->Customize( ToolBoxCustomizeEvent( NULL, nTempItem,
+ 0, mpCustomizeData ) );
+ }
+ }
+ }
+ mpCustomizeData = NULL;
+ mbResizeMode = FALSE;
+ mpDragBox->Deactivate();
+ }
+
+ mpDragBox = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTBDragMgr::UpdateDragRect()
+{
+ // Nur Updaten, wenn wir schon im Dragging sind
+ if ( !mbShowDragRect )
+ return;
+
+ if ( !mbResizeMode )
+ ImplDrawConfigFrame( mpDragBox, maStartRect );
+
+ mpDragBox->ShowTracking( maRect );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ImplTBDragMgr, SelectHdl, Accelerator*, pAccel )
+{
+ if ( pAccel->GetCurItemId() == KEY_ESCAPE )
+ EndDragging( FALSE );
+ else
+ EndDragging( TRUE );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTBDragMgr::StartCustomizeMode()
+{
+ mbCustomizeMode = TRUE;
+
+ ToolBox* pBox = mpBoxList->First();
+ while ( pBox )
+ {
+ pBox->ImplStartCustomizeMode();
+ pBox = mpBoxList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplTBDragMgr::EndCustomizeMode()
+{
+ mbCustomizeMode = FALSE;
+
+ ToolBox* pBox = mpBoxList->First();
+ while ( pBox )
+ {
+ pBox->ImplEndCustomizeMode();
+ pBox = mpBoxList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static ImplButtonList* ImplGetButtonList()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->maCtrlData.mpButtonList )
+ pSVData->maCtrlData.mpButtonList = new ImplButtonList;
+ return pSVData->maCtrlData.mpButtonList;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawOutButton( OutputDevice* pOutDev, const Rectangle& rRect,
+ USHORT nStyle )
+{
+ const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings();
+ Color aShadowColor = rStyleSettings.GetShadowColor();
+ Point aPos( rRect.TopLeft() );
+ Size aSize( rRect.GetSize() );
+ long nOffset = 0;
+
+ if ( pOutDev->GetBackground().GetColor() == aShadowColor )
+ aShadowColor = rStyleSettings.GetDarkShadowColor();
+
+ if ( nStyle & BUTTON_DRAW_PRESSED )
+ {
+ aPos.X()++;
+ aPos.Y()++;
+ nOffset++;
+ }
+
+ // Hintergrund loeschen
+ pOutDev->Erase( rRect );
+
+ // Button zeichnen
+ pOutDev->SetLineColor( rStyleSettings.GetLightColor() );
+ pOutDev->DrawLine( aPos,
+ Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y() ) );
+ pOutDev->DrawLine( aPos,
+ Point( aPos.X(), aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ) );
+ pOutDev->SetLineColor( aShadowColor );
+ pOutDev->DrawLine( Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y() ),
+ Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ) );
+ pOutDev->DrawLine( Point( aPos.X(), aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ),
+ Point( aPos.X()+aSize.Width()-OUTBUTTON_BORDER, aPos.Y()+aSize.Height()-OUTBUTTON_BORDER ) );
+ for ( long i = 0; i < OUTBUTTON_BORDER-1-nOffset; i++ )
+ {
+ pOutDev->DrawLine( Point( aPos.X()+aSize.Width()-(OUTBUTTON_BORDER-i-1), aPos.Y()+OUTBUTTON_BORDER ),
+ Point( aPos.X()+aSize.Width()-(OUTBUTTON_BORDER-i-1), aPos.Y()+aSize.Height()-1 ) );
+ pOutDev->DrawLine( Point( aPos.X()+OUTBUTTON_BORDER, aPos.Y()+aSize.Height()-(OUTBUTTON_BORDER-i-1) ),
+ Point( aPos.X()+aSize.Width()-1, aPos.Y()+aSize.Height()-(OUTBUTTON_BORDER-i-1) ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplInitButtonVirDev( const Window* pBox, VirtualDevice* pVirDev )
+{
+ // Farben/Settings vom Window am virtuellen Device setzen
+ pVirDev->SetSettings( pBox->GetSettings() );
+ const Wallpaper& rWallpaper = pBox->GetBackground();
+ if ( rWallpaper.GetStyle() == WALLPAPER_NULL )
+ pVirDev->SetBackground( Wallpaper( pBox->GetSettings().GetStyleSettings().GetFaceColor() ) );
+ else
+ pVirDev->SetBackground( rWallpaper );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawButtons( VirtualDevice* pVirDev, long nWidth, long nHeight,
+ USHORT nType )
+{
+ // Button Frames ausgeben
+ long nY = 0;
+ if ( nType & TOOLBOX_STYLE_OUTBUTTON )
+ {
+ for ( USHORT i = 0; i < 6; i++ )
+ {
+ USHORT nStyle = 0;
+ if ( i & 0x01 )
+ nStyle = BUTTON_DRAW_PRESSED;
+ ImplDrawOutButton( pVirDev, Rectangle( 0, nY, nWidth-1, nY+nHeight-1 ), nStyle );
+ nY += nHeight;
+ }
+ }
+ else
+ {
+ DecorationView aDecoView( pVirDev );
+
+ aDecoView.DrawButton( Rectangle( 0, 0, nWidth-1, nHeight-1 ), 0 );
+ nY += nHeight;
+ aDecoView.DrawButton( Rectangle( 0, nY, nWidth-1, nY+nHeight-1 ),
+ BUTTON_DRAW_PRESSED );
+ nY += nHeight;
+ aDecoView.DrawButton( Rectangle( 0, nY, nWidth-1, nY+nHeight-1 ),
+ BUTTON_DRAW_CHECKED );
+ nY += nHeight;
+ aDecoView.DrawButton( Rectangle( 0, nY, nWidth-1, nY+nHeight-1 ),
+ BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED );
+ nY += nHeight;
+ aDecoView.DrawButton( Rectangle( 0, nY, nWidth-1, nY+nHeight-1 ),
+ BUTTON_DRAW_DONTKNOW );
+ nY += nHeight;
+ aDecoView.DrawButton( Rectangle( 0, nY, nWidth-1, nY+nHeight-1 ),
+ BUTTON_DRAW_DONTKNOW | BUTTON_DRAW_PRESSED );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplButtonSysChange( ToolBox* pBox, VirtualDevice* pVirDev, USHORT nType )
+{
+ ImplButtonList* pBtnList = ImplGetButtonList();
+ ImplButtonData* pBtnData;
+
+ pBtnData = pBtnList->First();
+ while ( pBtnData )
+ {
+ if ( pBtnData->mpBtnDev == pVirDev )
+ {
+ ImplInitButtonVirDev( pBox, pVirDev );
+ ImplDrawButtons( pVirDev, pBtnData->mnWidth, pBtnData->mnHeight, nType );
+ break;
+ }
+
+ pBtnData = pBtnList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static VirtualDevice* ImplGetButtonDevice( ToolBox* pBox,
+ long nWidth, long nHeight, USHORT nType )
+{
+ ImplButtonList* pBtnList = ImplGetButtonList();
+ ImplButtonData* pBtnData;
+
+ pBtnData = pBtnList->First();
+ while ( pBtnData )
+ {
+ if ( (pBtnData->mnWidth == nWidth) &&
+ (pBtnData->mnHeight == nHeight) )
+ {
+ pBtnData->mnRefCount++;
+ return pBtnData->mpBtnDev;
+ }
+
+ pBtnData = pBtnList->Next();
+ }
+
+ VirtualDevice* pVirDev = new VirtualDevice( *pBox );
+
+ // Neue Groesse vom virtuellen Device setzen
+ pVirDev->SetOutputSizePixel( Size( nWidth, nHeight*6 ), TRUE );
+ ImplInitButtonVirDev( pBox, pVirDev );
+ ImplDrawButtons( pVirDev, nWidth, nHeight, nType );
+
+ pBtnData = new ImplButtonData;
+ pBtnData->mpBtnDev = pVirDev;
+ pBtnData->mnWidth = nWidth;
+ pBtnData->mnHeight = nHeight;
+ pBtnData->mnRefCount = 1;
+ pBtnList->Insert( pBtnData, LIST_APPEND );
+
+ return pVirDev;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplFreeButtonDevice( VirtualDevice* pVirDev )
+{
+ ImplButtonList* pBtnList = ImplGetButtonList();
+ ImplButtonData* pBtnData;
+
+ // Virtuelles Device suchen und loeschen
+ pBtnData = pBtnList->First();
+ while ( pBtnData )
+ {
+ if ( pBtnData->mpBtnDev == pVirDev )
+ {
+ pBtnData->mnRefCount--;
+ if ( !pBtnData->mnRefCount )
+ {
+ delete pBtnData->mpBtnDev;
+ delete pBtnData;
+ pBtnList->Remove();
+ }
+
+ return;
+ }
+
+ pBtnData = pBtnList->Next();
+ }
+
+ DBG_ERRORFILE( "ImplFreeButtonDevice(): Button-Device not in list" );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
+{
+ // Variablen initialisieren
+ mpBtnDev = NULL;
+ mpFloatSizeAry = NULL;
+ mpItemList = new ImplToolItemList;
+ mpFloatWin = NULL;
+ mnDX = 0;
+ mnDY = 0;
+ mnItemWidth = 0;
+ mnItemHeight = 0;
+ mnWinHeight = 0;
+ mnBorderX = 0;
+ mnBorderY = 0;
+ mnLeftBorder = 0;
+ mnTopBorder = 0;
+ mnRightBorder = 0;
+ mnBottomBorder = 0;
+ mnLastResizeDY = 0;
+ mnOutStyle = 0;
+ mnHighItemId = 0;
+ mnCurItemId = 0;
+ mnDownItemId = 0;
+ mnCurPos = TOOLBOX_ITEM_NOTFOUND;
+ mnLines = 1;
+ mnCurLine = 1;
+ mnCurLines = 1;
+ mnVisLines = 1;
+ mnFloatLines = 0;
+ mnConfigItem = 0;
+ mnMouseClicks = 0;
+ mnMouseModifier = 0;
+ mbDrag = FALSE;
+ mbSelection = FALSE;
+ mbCommandDrag = FALSE;
+ mbUpper = FALSE;
+ mbLower = FALSE;
+ mbNextTool = FALSE;
+ mbIn = FALSE;
+ mbCalc = TRUE;
+ mbFormat = FALSE;
+ mbFullPaint = FALSE;
+ mbHorz = TRUE;
+ mbScroll = (nStyle & WB_SCROLL) != 0;
+ mbCustomize = FALSE;
+ mbCustomizeMode = FALSE;
+ mbDragging = FALSE;
+ mbHideStatusText = FALSE;
+ mbMenuStrings = FALSE;
+ meButtonType = BUTTON_SYMBOL;
+ meAlign = WINDOWALIGN_TOP;
+ meLastStyle = POINTER_ARROW;
+ mnWinStyle = nStyle;
+ maTimer.SetTimeoutHdl( LINK( this, ToolBox, ImplUpdateHdl ) );
+
+ DockingWindow::ImplInit( pParent, nStyle & ~(WB_BORDER) );
+
+ ImplInitSettings( TRUE, TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplInitSettings( BOOL bFont,
+ BOOL bForeground, BOOL bBackground )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ if ( bFont )
+ {
+ Font aFont = rStyleSettings.GetToolFont();
+ if ( IsControlFont() )
+ aFont.Merge( GetControlFont() );
+ SetZoomedPointFont( aFont );
+ }
+
+ if ( bForeground || bFont )
+ {
+ Color aColor;
+ if ( IsControlForeground() )
+ aColor = GetControlForeground();
+ else if ( Window::GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetButtonTextColor();
+ else
+ aColor = rStyleSettings.GetWindowTextColor();
+ SetTextColor( aColor );
+ SetTextFillColor();
+ }
+
+ if ( bBackground )
+ {
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( Window::GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetFaceColor();
+ else
+ aColor = rStyleSettings.GetWindowColor();
+ SetBackground( aColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplLoadRes( const ResId& rResId )
+{
+ DockingWindow::ImplLoadRes( rResId );
+
+ USHORT nObjMask;
+
+ nObjMask = ReadShortRes();
+
+ if ( nObjMask & RSC_TOOLBOX_BUTTONTYPE )
+ SetButtonType( (ButtonType)ReadShortRes() );
+
+ if ( nObjMask & RSC_TOOLBOX_ALIGN )
+ SetAlign( (WindowAlign)ReadShortRes() );
+
+ if ( nObjMask & RSC_TOOLBOX_LINECOUNT )
+ SetLineCount( ReadShortRes() );
+
+ if ( nObjMask & RSC_TOOLBOX_CUSTOMIZE )
+ {
+ BOOL bCust = (BOOL)ReadShortRes();
+ EnableCustomize( bCust );
+ }
+
+ if ( nObjMask & RSC_TOOLBOX_MENUSTRINGS )
+ {
+ BOOL bCust = (BOOL)ReadShortRes();
+ EnableMenuStrings( bCust );
+ }
+
+ if ( nObjMask & RSC_TOOLBOX_FLOATLINES )
+ SetFloatingLines( ReadShortRes() );
+
+ if ( nObjMask & RSC_TOOLBOX_ITEMIMAGELIST )
+ {
+ maImageList = ImageList( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ }
+
+ if ( nObjMask & RSC_TOOLBOX_ITEMLIST )
+ {
+ USHORT nEle = ReadShortRes();
+
+ // Item hinzufuegen
+ for ( USHORT i = 0; i < nEle; i++ )
+ {
+ InsertItem( ResId( (RSHEADER_TYPE *)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE *)GetClassRes() ) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ToolBox::ToolBox( Window* pParent, WinBits nStyle ) :
+ DockingWindow( WINDOW_TOOLBOX )
+{
+ ImplInit( pParent, nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+ToolBox::ToolBox( Window* pParent, const ResId& rResId ) :
+ DockingWindow( WINDOW_TOOLBOX )
+{
+ rResId.SetRT( RSC_TOOLBOX );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle );
+ ImplLoadRes( rResId );
+
+ // Groesse des FloatingWindows berechnen und umschalten, wenn die
+ // ToolBox initial im FloatingModus ist
+ if ( IsFloatingMode() )
+ mbHorz = TRUE;
+ else
+ Resize();
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+ToolBox::~ToolBox()
+{
+ // Falls noch ein Floating-Window connected ist, dann den
+ // PopupModus beenden
+ if ( mpFloatWin )
+ mpFloatWin->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
+
+ // Items aus der Liste loeschen
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Itemlist loeschen
+ delete mpItemList;
+
+ // FloatSizeAry gegebenenfalls loeschen
+ if ( mpFloatSizeAry )
+ delete mpFloatSizeAry;
+
+ // Wenn keine ToolBox-Referenzen mehr auf die Listen bestehen, dann
+ // Listen mit wegloeschen
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maCtrlData.mpTBDragMgr )
+ {
+ // Wenn im TBDrag-Manager, dann wieder rausnehmen
+ if ( mbCustomize )
+ pSVData->maCtrlData.mpTBDragMgr->Remove( this );
+
+ if ( !pSVData->maCtrlData.mpTBDragMgr->Count() )
+ {
+ delete pSVData->maCtrlData.mpTBDragMgr;
+ pSVData->maCtrlData.mpTBDragMgr = NULL;
+ }
+ }
+
+ // Button-Device freigeben
+ if ( mpBtnDev )
+ ImplFreeButtonDevice( mpBtnDev );
+
+ if ( pSVData->maCtrlData.mpButtonList )
+ {
+ if ( !pSVData->maCtrlData.mpButtonList->Count() )
+ {
+ delete pSVData->maCtrlData.mpButtonList;
+ pSVData->maCtrlData.mpButtonList = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ImplToolItem* ToolBox::ImplGetItem( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nItemId )
+ return pItem;
+
+ pItem = mpItemList->Next();
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::ImplCalcItem()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ // Muss Itemgroesse ueberhaupt neu berechnet werden
+ if ( !mbCalc )
+ return FALSE;
+
+ ImplToolItem* pItem;
+ long nDefWidth;
+ long nDefHeight;
+ long nDefLeftWidth;
+ long nDefLeftHeight;
+ long nMaxWidth;
+ long nMaxHeight;
+ long nHeight;
+ BOOL bImage;
+ BOOL bText;
+ Size aItemSize;
+
+ if ( meButtonType == BUTTON_SYMBOL )
+ {
+ nDefWidth = DEF_IMAGE_WIDTH;
+ nDefHeight = DEF_IMAGE_HEIGHT;
+ nDefLeftWidth = nDefWidth;
+ nDefLeftHeight = nDefHeight;
+ }
+ else if ( meButtonType == BUTTON_TEXT )
+ {
+ nDefWidth = DEF_TEXT_WIDTH;
+ nDefHeight = GetTextHeight();
+ nDefLeftWidth = nDefWidth;
+ nDefLeftHeight = nDefHeight;
+ }
+ else
+ {
+ nDefWidth = DEF_TEXT_WIDTH;
+ nDefHeight = DEF_IMAGE_HEIGHT + GetTextHeight();
+ nDefLeftWidth = nDefWidth;
+ nDefLeftHeight = nDefHeight-DEF_IMAGE_HEIGHT;
+ }
+
+ if ( mpItemList->Count() )
+ {
+ nMaxWidth = DEF_MIN_WIDTH;
+ nMaxHeight = DEF_MIN_HEIGHT;
+ mnWinHeight = 0;
+
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->meType == TOOLBOXITEM_BUTTON )
+ {
+ if ( !(pItem->maImage) )
+ bImage = FALSE;
+ else
+ bImage = TRUE;
+ if ( !pItem->maText.Len() )
+ bText = FALSE;
+ else
+ bText = TRUE;
+
+ if ( bImage || bText )
+ {
+ pItem->mbEmptyBtn = FALSE;
+
+ if ( meButtonType == BUTTON_SYMBOL )
+ {
+ if ( bImage || !bText )
+ {
+ aItemSize = pItem->maImage.GetSizePixel();
+ pItem->mnNonStdSize = 0;
+ }
+ else
+ {
+ aItemSize.Width() = 0;
+ aItemSize.Height() = GetTextHeight();
+ pItem->mnNonStdSize = GetCtrlTextWidth( pItem->maText )+TB_TEXTOFFSET;
+ }
+ }
+ else if ( meButtonType == BUTTON_TEXT )
+ {
+ if ( bText || !bImage )
+ {
+ aItemSize.Width() = GetCtrlTextWidth( pItem->maText )+TB_TEXTOFFSET;
+ aItemSize.Height() = GetTextHeight();
+ pItem->mnNonStdSize = 0;
+ }
+ else
+ {
+ Size aImageSize = pItem->maImage.GetSizePixel();
+ if ( mbHorz )
+ {
+ aItemSize.Width() = 0;
+ aItemSize.Height() = aImageSize.Height();
+ pItem->mnNonStdSize = aImageSize.Width();
+ }
+ else
+ {
+ aItemSize.Width() = aImageSize.Width();
+ aItemSize.Height() = 0;
+ pItem->mnNonStdSize = aImageSize.Height();
+ }
+ }
+ }
+ else
+ {
+ aItemSize.Width() = GetCtrlTextWidth( pItem->maText )+TB_TEXTOFFSET;
+ aItemSize.Height() = GetTextHeight();
+ Size aImageSize = pItem->maImage.GetSizePixel();
+ if ( pItem->mnBits & TIB_LEFT )
+ {
+ aItemSize.Width() += aImageSize.Width();
+ if ( aImageSize.Height() > aItemSize.Height() )
+ aItemSize.Height() = aImageSize.Height();
+ }
+ else
+ {
+ aItemSize.Height() += aImageSize.Height();
+ if ( aImageSize.Width() > aItemSize.Width() )
+ aItemSize.Width() = aImageSize.Width();
+ }
+ pItem->mnNonStdSize = 0;
+ }
+
+ if ( !pItem->mnNonStdSize && (pItem->mnBits & TIB_AUTOSIZE) )
+ {
+ pItem->mnNonStdSize = aItemSize.Width();
+ aItemSize.Width() = 0;
+ }
+ }
+ else
+ {
+ if ( pItem->mnBits & TIB_LEFT )
+ {
+ aItemSize.Width() = nDefLeftWidth;
+ aItemSize.Height() = nDefLeftHeight;
+ }
+ else
+ {
+ aItemSize.Width() = nDefWidth;
+ aItemSize.Height() = nDefHeight;
+ }
+ pItem->mbEmptyBtn = TRUE;
+ }
+
+ if ( aItemSize.Width() > nMaxWidth )
+ nMaxWidth = aItemSize.Width();
+ if ( aItemSize.Height() > nMaxHeight )
+ nMaxHeight = aItemSize.Height();
+
+ if ( pItem->mnNonStdSize )
+ {
+ if ( mbHorz )
+ pItem->mnNonStdSize += SMALLBUTTON_HSIZE;
+ else
+ pItem->mnNonStdSize += SMALLBUTTON_VSIZE;
+ }
+
+ // Gegebenenfalls die Fensterhoehe mit beruecksichtigen
+ if ( pItem->mpWindow )
+ {
+ nHeight = pItem->mpWindow->GetSizePixel().Height();
+ if ( nHeight > mnWinHeight )
+ mnWinHeight = nHeight;
+ }
+ }
+
+ pItem = mpItemList->Next();
+ }
+ }
+ else
+ {
+ nMaxWidth = nDefWidth;
+ nMaxHeight = nDefHeight;
+ }
+
+ mbCalc = FALSE;
+ mbFormat = TRUE;
+
+ // Button-Umrandung dazurechnen
+ if ( mnOutStyle & TOOLBOX_STYLE_OUTBUTTON )
+ {
+ nMaxWidth += OUTBUTTON_SIZE;
+ nMaxHeight += OUTBUTTON_SIZE;
+ }
+ else
+ {
+ nMaxWidth += SMALLBUTTON_HSIZE;
+ nMaxHeight += SMALLBUTTON_VSIZE;
+ }
+
+ // Muessen die groessen neu berechnet werden
+ if ( (nMaxWidth != mnItemWidth) || (nMaxHeight != mnItemHeight) )
+ {
+ // Neue Werte zuweisen
+ mnItemWidth = nMaxWidth;
+ mnItemHeight = nMaxHeight;
+
+ // Button-Device freigeben
+ if ( mpBtnDev )
+ {
+ ImplFreeButtonDevice( mpBtnDev );
+ mpBtnDev = NULL;
+ }
+ if ( !(mnOutStyle & TOOLBOX_STYLE_FLAT) )
+ mpBtnDev = ImplGetButtonDevice( this, mnItemWidth, mnItemHeight, mnOutStyle );
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ToolBox::ImplCalcBreaks( long nWidth, long* pMaxLineWidth, BOOL bCalcHorz )
+{
+ ImplToolItem* pItem;
+ ULONG nLineStart = 0;
+ ULONG nGroupStart = 0;
+ long nLineWidth = 0;
+ long nCurWidth;
+ long nLastGroupLineWidth = 0;
+ long nMaxLineWidth = 0;
+ USHORT nLines = 1;
+ BOOL bWindow;
+ BOOL bBreak = FALSE;
+
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ pItem->mbBreak = bBreak;
+ bBreak = FALSE;
+
+ if ( pItem->mbVisible )
+ {
+ bWindow = FALSE;
+ bBreak = FALSE;
+ nCurWidth = 0;
+
+ if ( pItem->meType == TOOLBOXITEM_BUTTON )
+ {
+ if ( pItem->mnNonStdSize )
+ nCurWidth = pItem->mnNonStdSize;
+ else
+ {
+ if ( bCalcHorz )
+ nCurWidth = mnItemWidth;
+ else
+ nCurWidth = mnItemHeight;
+ }
+
+ if ( pItem->mpWindow && bCalcHorz )
+ {
+ long nWinItemWidth = pItem->mpWindow->GetSizePixel().Width();
+ if ( !mbScroll || (nWinItemWidth <= nWidth) )
+ {
+ nCurWidth = nWinItemWidth;
+ bWindow = TRUE;
+ }
+ else
+ {
+ if ( pItem->mbEmptyBtn )
+ {
+ nCurWidth = 0;
+ }
+ }
+ }
+
+ if ( (nLineWidth+nCurWidth > nWidth) && mbScroll )
+ bBreak = TRUE;
+ }
+ else if ( pItem->meType == TOOLBOXITEM_SPACE )
+ nCurWidth = mnItemWidth;
+ else if ( pItem->meType == TOOLBOXITEM_SEPARATOR )
+ nCurWidth = pItem->mnSepSize;
+ else if ( pItem->meType == TOOLBOXITEM_BREAK )
+ bBreak = TRUE;
+
+ if ( bBreak )
+ {
+ nLines++;
+
+ // Gruppe auseinanderbrechen oder ganze Gruppe umbrechen?
+ if ( (pItem->meType == TOOLBOXITEM_BREAK) ||
+ (nLineStart == nGroupStart) )
+ {
+ if ( nLineWidth > nMaxLineWidth )
+ nMaxLineWidth = nLineWidth;
+
+ nLineWidth = 0;
+ nLineStart = mpItemList->GetCurPos();
+ nGroupStart = nLineStart;
+ pItem->mbBreak = TRUE;
+ bBreak = FALSE;
+ }
+ else
+ {
+ if ( nLastGroupLineWidth > nMaxLineWidth )
+ nMaxLineWidth = nLastGroupLineWidth;
+
+ // Wenn ganze Gruppe umgebrochen wird, diese auf
+ // Zeilenanfang setzen und wieder neu berechnen
+ nLineWidth = 0;
+ nLineStart = nGroupStart;
+ pItem = mpItemList->Seek( nGroupStart );
+ continue;
+ }
+ }
+ else
+ {
+ if ( (pItem->meType != TOOLBOXITEM_BUTTON) || bWindow )
+ {
+ nLastGroupLineWidth = nLineWidth;
+ nGroupStart = mpItemList->GetCurPos();
+ if ( !bWindow )
+ nGroupStart++;
+ }
+ }
+
+ nLineWidth += nCurWidth;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ if ( pMaxLineWidth )
+ {
+ if ( nLineWidth > nMaxLineWidth )
+ nMaxLineWidth = nLineWidth;
+ // Wegen Separatoren kann MaxLineWidth > Width werden, hat aber
+ // auf die Umbrueche keine Auswirkung
+ if ( nMaxLineWidth > nWidth )
+ nMaxLineWidth = nWidth;
+ *pMaxLineWidth = nMaxLineWidth;
+ }
+
+ return nLines;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplFormat( BOOL bResize )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ // Muss ueberhaupt neu formatiert werden
+ if ( !mbFormat )
+ return;
+
+ // Positionen/Groessen berechnen
+ Rectangle aEmptyRect;
+ ImplToolItem* pItem;
+ ImplToolItem* pTempItem;
+ long nLineSize;
+ long nLeft;
+ long nTop;
+ long nMax;
+ long nX;
+ long nY;
+ long nCurWidth;
+ long nCurHeight;
+ USHORT nFormatLine;
+ BOOL bMustFullPaint;
+ BOOL bLastSep;
+
+ // FloatSizeAry gegebenenfalls loeschen
+ if ( mpFloatSizeAry )
+ {
+ delete mpFloatSizeAry;
+ mpFloatSizeAry = NULL;
+ }
+
+ // Borderbreite berechnen
+ if ( IsFloatingMode() || !(mnWinStyle & WB_BORDER) )
+ {
+ mnLeftBorder = 0;
+ mnTopBorder = 0;
+ mnRightBorder = 0;
+ mnBottomBorder = 0;
+ }
+ else
+ ImplCalcBorder( meAlign, mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+
+ // Itemgroesse gegebenenfalls neu berechnet werden
+ if ( ImplCalcItem() )
+ bMustFullPaint = TRUE;
+ else
+ bMustFullPaint = FALSE;
+
+ // Im FloatingMode die Fenstergroesse immer neu setzen oder im Resize
+ // die neue Anzahl der FloatingLines berechnen
+ if ( IsFloatingMode() )
+ {
+ if ( bResize )
+ mnFloatLines = ImplCalcLines( this, mnDY );
+ else
+ SetOutputSizePixel( ImplCalcFloatSize( this, mnFloatLines ) );
+ }
+
+ // Horizontal
+ if ( mbHorz )
+ {
+ nLineSize = mnItemHeight;
+
+ if ( mnWinHeight-2 > mnItemHeight )
+ nLineSize = mnWinHeight-2;
+
+ if ( mbScroll )
+ {
+ mnVisLines = ImplCalcLines( this, mnDY );
+ nMax = mnDX;
+ }
+ else
+ {
+ mnVisLines = mnLines;
+ nMax = TB_MAXNOSCROLL;
+ }
+
+ if ( mnWinStyle & WB_BORDER )
+ {
+ nLeft = TB_BORDER_OFFSET1 + mnLeftBorder;
+ nTop = TB_BORDER_OFFSET2 + mnTopBorder;
+ nMax -= nLeft + TB_BORDER_OFFSET1 + mnRightBorder;
+ }
+ else
+ {
+ nLeft = 0;
+ nTop = 0;
+ }
+
+ nLeft += mnBorderX;
+ nTop += mnBorderY;
+ nMax -= mnBorderX*2;
+ }
+ else
+ {
+ nLineSize = mnItemWidth;
+
+ if ( mbScroll )
+ {
+ mnVisLines = ImplCalcLines( this, mnDX );
+ nMax = mnDY;
+ }
+ else
+ {
+ mnVisLines = mnLines;
+ nMax = TB_MAXNOSCROLL;
+ }
+
+ if ( mnWinStyle & WB_BORDER )
+ {
+ nTop = TB_BORDER_OFFSET1 + mnTopBorder;
+ nLeft = TB_BORDER_OFFSET2 + mnLeftBorder;
+ nMax -= nTop + TB_BORDER_OFFSET1 + mnBottomBorder;
+ }
+ else
+ {
+ nLeft = 0;
+ nTop = 0;
+ }
+
+ nLeft += mnBorderX;
+ nTop += mnBorderY;
+ nMax -= mnBorderY*2;
+ }
+
+ // Wenn Fenster keine Groesse hat, dann nichts berechnen. Fuer alle
+ // ToolBoxen ohne Scroll muss hier schon die Groesse berechnet werden.
+ if ( (nMax <= 0) && mbScroll )
+ {
+ mnVisLines = 1;
+ mnCurLine = 1;
+ mnCurLines = 1;
+
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ pItem->maRect = aEmptyRect;
+ pItem = mpItemList->Next();
+ }
+
+ maLowerRect = aEmptyRect;
+ maUpperRect = aEmptyRect;
+ maNextToolRect = aEmptyRect;
+ }
+ else
+ {
+ // Anfangswerte setzen
+ nX = nLeft;
+ nY = nTop;
+ nFormatLine = 1;
+ bLastSep = TRUE;
+
+ // Scroll-Rectangles merken und zuruecksetzen
+ Rectangle aOldLowerRect = maLowerRect;
+ Rectangle aOldUpperRect = maUpperRect;
+ Rectangle aOldNextToolRect = maNextToolRect;
+ maUpperRect = aEmptyRect;
+ maLowerRect = aEmptyRect;
+ maNextToolRect = aEmptyRect;
+
+ if ( maNextToolBoxStr.Len() && mbScroll )
+ {
+ nMax -= TB_SPIN_SIZE-TB_SPIN_OFFSET;
+ if ( mbHorz )
+ {
+ maNextToolRect.Left() = nLeft+nMax+TB_SPIN_OFFSET;
+ maNextToolRect.Right() = maNextToolRect.Left()+TB_SPIN_SIZE-1;
+ maNextToolRect.Top() = nTop;
+ maNextToolRect.Bottom() = mnDY-mnBottomBorder-mnBorderY-TB_BORDER_OFFSET2-1;
+ }
+ else
+ {
+ maNextToolRect.Top() = nTop+nMax+TB_SPIN_OFFSET;;
+ maNextToolRect.Bottom() = maNextToolRect.Top()+TB_SPIN_SIZE-1;
+ maNextToolRect.Left() = nLeft;
+ maNextToolRect.Right() = mnDX-mnRightBorder-mnBorderX-TB_BORDER_OFFSET2-1;
+ }
+ }
+
+ // Haben wir ueberhaupt Items
+ if ( mpItemList->GetObject( 0 ) )
+ {
+ // Umbrueche und sichtbare Zeilen berechnen
+ mnCurLines = ImplCalcBreaks( nMax, NULL, mbHorz );
+ if ( (mnCurLines > mnVisLines) && mbScroll )
+ {
+ nMax -= TB_SPIN_SIZE+TB_SPIN_OFFSET;
+ mnCurLines = ImplCalcBreaks( nMax, NULL, mbHorz );
+ // Wenn wir umbrechen muessen, dann Scroll-Rectangles neu setzen
+ if ( mbHorz )
+ {
+ maUpperRect.Left() = nLeft+nMax+TB_SPIN_OFFSET;
+ maUpperRect.Right() = maUpperRect.Left()+TB_SPIN_SIZE-1;
+ maUpperRect.Top() = nTop;
+ maLowerRect.Bottom() = mnDY-mnBottomBorder-mnBorderY-TB_BORDER_OFFSET2-1;
+ maLowerRect.Left() = maUpperRect.Left();
+ maLowerRect.Right() = maUpperRect.Right();
+ maUpperRect.Bottom() = maUpperRect.Top() +
+ (maLowerRect.Bottom()-maUpperRect.Top())/2;
+ maLowerRect.Top() = maUpperRect.Bottom();
+ }
+ else
+ {
+ maUpperRect.Top() = nTop+nMax+TB_SPIN_OFFSET;;
+ maUpperRect.Bottom() = maUpperRect.Top()+TB_SPIN_SIZE-1;
+ maUpperRect.Left() = nLeft;
+ maLowerRect.Right() = mnDX-mnRightBorder-mnBorderX-TB_BORDER_OFFSET2-1;
+ maLowerRect.Top() = maUpperRect.Top();
+ maLowerRect.Bottom() = maUpperRect.Bottom();
+ maUpperRect.Right() = maUpperRect.Left() +
+ (maLowerRect.Right()-maUpperRect.Left())/2;
+ maLowerRect.Left() = maUpperRect.Right();
+ }
+ }
+ if ( mnVisLines >= mnCurLines )
+ mnCurLine = 1;
+ else if ( mnCurLine+mnVisLines-1 > mnCurLines )
+ mnCurLine = mnCurLines - (mnVisLines-1);
+
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Doppelte Separatoren hiden
+ if ( mbCustomize )
+ {
+ if ( pItem->meType == TOOLBOXITEM_SEPARATOR )
+ {
+ pItem->mbVisible = FALSE;
+ if ( !bLastSep )
+ {
+ // Feststellen ob dahinter ueberhaupt noch
+ // ein Item sichtbar ist
+ ULONG nTempPos = mpItemList->GetCurPos()+1;
+ ULONG nCount = mpItemList->Count();
+ while ( nTempPos < nCount )
+ {
+ pTempItem = mpItemList->GetObject( nTempPos );
+ if ( (pTempItem->meType == TOOLBOXITEM_SEPARATOR) ||
+ ((pTempItem->meType == TOOLBOXITEM_BUTTON) &&
+ pTempItem->mbVisible) )
+ {
+ pItem->mbVisible = TRUE;
+ break;
+ }
+ nTempPos++;
+ }
+ }
+ bLastSep = TRUE;
+ }
+ else if ( pItem->mbVisible )
+ bLastSep = FALSE;
+ }
+
+ pItem->mbShowWindow = FALSE;
+
+ if ( pItem->mbBreak )
+ {
+ nFormatLine++;
+
+ // Ab der zweiten Zeile erhoehen
+ if ( nFormatLine > mnCurLine )
+ {
+ if ( mbHorz )
+ {
+ nX = nLeft;
+ if ( mnWinStyle & WB_LINESPACING )
+ nY += nLineSize+TB_LINESPACING;
+ else
+ nY += nLineSize;
+ }
+ else
+ {
+ nY = nTop;
+ if ( mnWinStyle & WB_LINESPACING )
+ nX += nLineSize+TB_LINESPACING;
+ else
+ nX += nLineSize;
+ }
+ }
+ }
+
+ if ( !pItem->mbVisible || (nFormatLine < mnCurLine) ||
+ (nFormatLine > mnCurLine+mnVisLines-1) )
+ pItem->maCalcRect = aEmptyRect;
+ else
+ {
+ if ( (pItem->meType == TOOLBOXITEM_BUTTON) ||
+ (pItem->meType == TOOLBOXITEM_SPACE) )
+ {
+ if ( pItem->mnNonStdSize )
+ {
+ if ( mbHorz )
+ {
+ nCurWidth = pItem->mnNonStdSize;
+ nCurHeight = mnItemHeight;
+ }
+ else
+ {
+ nCurWidth = mnItemWidth;
+ nCurHeight = pItem->mnNonStdSize;
+ }
+ }
+ else
+ {
+ nCurWidth = mnItemWidth;
+ nCurHeight = mnItemHeight;
+ }
+
+ if ( pItem->mpWindow && mbHorz )
+ {
+ Size aWinSize = pItem->mpWindow->GetSizePixel();
+ if ( !mbScroll || (aWinSize.Width() <= nMax) )
+ {
+ nCurWidth = aWinSize.Width();
+ nCurHeight = aWinSize.Height();
+ pItem->mbShowWindow = TRUE;
+ }
+ else
+ {
+ if ( pItem->mbEmptyBtn )
+ {
+ nCurWidth = 0;
+ nCurHeight = 0;
+ }
+ }
+ }
+ }
+ else if ( pItem->meType == TOOLBOXITEM_SEPARATOR )
+ {
+ if ( mbHorz )
+ {
+ nCurWidth = pItem->mnSepSize;
+ nCurHeight = mnItemHeight;
+ }
+ else
+ {
+ nCurWidth = mnItemWidth;
+ nCurHeight = pItem->mnSepSize;
+ }
+ }
+ else if ( pItem->meType == TOOLBOXITEM_BREAK )
+ {
+ nCurWidth = 0;
+ nCurHeight = 0;
+ }
+
+ if ( mbHorz )
+ {
+ pItem->maCalcRect.Left() = nX;
+ pItem->maCalcRect.Top() = nY+(nLineSize-nCurHeight)/2;
+ pItem->maCalcRect.Right() = nX+nCurWidth-1;
+ pItem->maCalcRect.Bottom() = pItem->maCalcRect.Top()+nCurHeight-1;
+ nX += nCurWidth;
+ }
+ else
+ {
+ pItem->maCalcRect.Left() = nX+(nLineSize-nCurWidth)/2;;
+ pItem->maCalcRect.Top() = nY;
+ pItem->maCalcRect.Right() = pItem->maCalcRect.Left()+nCurWidth-1;
+ pItem->maCalcRect.Bottom() = nY+nCurHeight-1;
+ nY += nCurHeight;
+ }
+ }
+
+ if ( pItem->mpWindow )
+ {
+ if ( pItem->mbShowWindow )
+ {
+ Point aPos( pItem->maCalcRect.Left(), pItem->maCalcRect.Top() );
+ pItem->mpWindow->SetPosPixel( aPos );
+ if ( !mbCustomizeMode )
+ pItem->mpWindow->Show();
+ }
+ else
+ pItem->mpWindow->Hide();
+ }
+
+ pItem = mpItemList->Next();
+ }
+ }
+ else
+ mnCurLines = 1;
+
+ // Wenn ToolBox sichtbar, Paint fuer geaenderte Bereiche ausloesen
+ if ( IsVisible() && !mbFullPaint )
+ {
+ if ( bMustFullPaint )
+ {
+ maPaintRect = Rectangle( mnLeftBorder, mnTopBorder,
+ mnDX-mnRightBorder, mnDY-mnBottomBorder );
+ }
+ else
+ {
+ if ( aOldLowerRect != maLowerRect )
+ {
+ maPaintRect.Union( maLowerRect );
+ maPaintRect.Union( aOldLowerRect );
+ }
+ if ( aOldUpperRect != maUpperRect )
+ {
+ maPaintRect.Union( maUpperRect );
+ maPaintRect.Union( aOldUpperRect );
+ }
+ if ( aOldNextToolRect != maNextToolRect )
+ {
+ maPaintRect.Union( maNextToolRect );
+ maPaintRect.Union( aOldNextToolRect );
+ }
+
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->maRect != pItem->maCalcRect )
+ {
+ maPaintRect.Union( pItem->maRect );
+ maPaintRect.Union( pItem->maCalcRect );
+ }
+ pItem = mpItemList->Next();
+ }
+ }
+
+ Invalidate( maPaintRect );
+ }
+
+ // Neu berechnete Rectangles uebertragen
+ maPaintRect = aEmptyRect;
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ pItem->maRect = pItem->maCalcRect;
+ pItem = mpItemList->Next();
+ }
+ }
+
+ // Es wurde die Leiste neu durchformatiert
+ maTimer.Stop();
+ mbFormat = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ToolBox, ImplUpdateHdl, void*, EMPTYARG )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mbFormat )
+ ImplFormat();
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDrawToolArrow( ToolBox* pBox, long nX, long nY, BOOL bBlack,
+ BOOL bLeft = FALSE, BOOL bTop = FALSE )
+{
+ Color aOldFillColor = pBox->GetFillColor();
+ WindowAlign eAlign = pBox->meAlign;
+ if ( bLeft )
+ eAlign = WINDOWALIGN_RIGHT;
+ else if ( bTop )
+ eAlign = WINDOWALIGN_BOTTOM;
+
+ switch ( eAlign )
+ {
+ case WINDOWALIGN_LEFT:
+ if ( bBlack )
+ pBox->SetFillColor( Color( COL_BLACK ) );
+ pBox->DrawRect( Rectangle( nX+0, nY+0, nX+0, nY+6 ) );
+ pBox->DrawRect( Rectangle( nX+1, nY+1, nX+1, nY+5 ) );
+ pBox->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) );
+ pBox->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) );
+ if ( bBlack )
+ {
+ pBox->SetFillColor( aOldFillColor );
+ pBox->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) );
+ pBox->DrawRect( Rectangle( nX+2, nY+3, nX+2, nY+3 ) );
+ }
+ break;
+ case WINDOWALIGN_TOP:
+ if ( bBlack )
+ pBox->SetFillColor( Color( COL_BLACK ) );
+ pBox->DrawRect( Rectangle( nX+0, nY+0, nX+6, nY+0 ) );
+ pBox->DrawRect( Rectangle( nX+1, nY+1, nX+5, nY+1 ) );
+ pBox->DrawRect( Rectangle( nX+2, nY+2, nX+4, nY+2 ) );
+ pBox->DrawRect( Rectangle( nX+3, nY+3, nX+3, nY+3 ) );
+ if ( bBlack )
+ {
+ pBox->SetFillColor( aOldFillColor );
+ pBox->DrawRect( Rectangle( nX+2, nY+1, nX+4, nY+1 ) );
+ pBox->DrawRect( Rectangle( nX+3, nY+2, nX+3, nY+2 ) );
+ }
+ break;
+ case WINDOWALIGN_RIGHT:
+ if ( bBlack )
+ pBox->SetFillColor( Color( COL_BLACK ) );
+ pBox->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+6 ) );
+ pBox->DrawRect( Rectangle( nX+2, nY+1, nX+2, nY+5 ) );
+ pBox->DrawRect( Rectangle( nX+1, nY+2, nX+1, nY+4 ) );
+ pBox->DrawRect( Rectangle( nX+0, nY+3, nX+0, nY+3 ) );
+ if ( bBlack )
+ {
+ pBox->SetFillColor( aOldFillColor );
+ pBox->DrawRect( Rectangle( nX+2, nY+2, nX+2, nY+4 ) );
+ pBox->DrawRect( Rectangle( nX+1, nY+3, nX+1, nY+3 ) );
+ }
+ break;
+ case WINDOWALIGN_BOTTOM:
+ if ( bBlack )
+ pBox->SetFillColor( Color( COL_BLACK ) );
+ pBox->DrawRect( Rectangle( nX+0, nY+3, nX+6, nY+3 ) );
+ pBox->DrawRect( Rectangle( nX+1, nY+2, nX+5, nY+2 ) );
+ pBox->DrawRect( Rectangle( nX+2, nY+1, nX+4, nY+1 ) );
+ pBox->DrawRect( Rectangle( nX+3, nY+0, nX+3, nY+0 ) );
+ if ( bBlack )
+ {
+ pBox->SetFillColor( aOldFillColor );
+ pBox->DrawRect( Rectangle( nX+2, nY+2, nX+4, nY+2 ) );
+ pBox->DrawRect( Rectangle( nX+3, nY+1, nX+3, nY+1 ) );
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplDrawSpin( BOOL bUpperIn, BOOL bLowerIn )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ BOOL bTmpUpper;
+ BOOL bTmpLower;
+
+ if ( maUpperRect.IsEmpty() || maLowerRect.IsEmpty() )
+ return;
+
+ if ( mnCurLine > 1 )
+ bTmpUpper = TRUE;
+ else
+ bTmpUpper = FALSE;
+
+ if ( mnCurLine+mnVisLines-1 < mnCurLines )
+ bTmpLower = TRUE;
+ else
+ bTmpLower = FALSE;
+
+ if ( !IsEnabled() )
+ {
+ bTmpUpper = FALSE;
+ bTmpLower = FALSE;
+ }
+
+ ImplDrawSpinButton( this, maUpperRect, maLowerRect,
+ bUpperIn, bLowerIn, bTmpUpper, bTmpLower, !mbHorz );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplDrawNext( BOOL bIn )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( maNextToolRect.IsEmpty() )
+ return;
+
+ DecorationView aDecoView( this );
+
+ // Button malen
+ long nX = SMALLBUTTON_OFF_NORMAL_X;
+ long nY = SMALLBUTTON_OFF_NORMAL_Y;
+ USHORT nStyle = 0;
+ if ( bIn == 1 )
+ {
+ nStyle |= BUTTON_DRAW_PRESSED;
+ nX = SMALLBUTTON_OFF_PRESSED_X;
+ nY = SMALLBUTTON_OFF_PRESSED_Y;
+ }
+ aDecoView.DrawButton( maNextToolRect, nStyle );
+
+ // Inhalt ausgeben
+ BOOL bLeft = FALSE;
+ BOOL bTop = FALSE;
+ if ( mbHorz )
+ {
+ bLeft = TRUE;
+ nX++;
+ nY += (maNextToolRect.GetHeight()-12)/2;
+ }
+ else
+ {
+ bTop = TRUE;
+ nY++;
+ nX += (maNextToolRect.GetWidth()-12)/2;
+ }
+
+ nX += maNextToolRect.Left();
+ nY += maNextToolRect.Top();
+ SetLineColor();
+ SetFillColor( COL_LIGHTBLUE );
+ ImplDrawToolArrow( this, nX, nY, TRUE, bLeft, bTop );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+
+ // Falls Rechteck ausserhalb des sichbaren Bereichs liegt
+ if ( pItem->maRect.IsEmpty() )
+ return;
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ // Im flachen Style werden auch Separatoren gezeichnet
+ if ( (mnOutStyle & TOOLBOX_STYLE_FLAT) &&
+ (pItem->meType == TOOLBOXITEM_SEPARATOR) )
+ {
+ // Strich wird nicht gemalt, wenn vor oder hinter Fenstern
+ // oder bei einem Umbruch
+ ImplToolItem* pTempItem = mpItemList->GetObject( nPos );
+ pTempItem = mpItemList->GetObject( nPos-1 );
+ if ( pTempItem && !pTempItem->mbShowWindow )
+ {
+ pTempItem = mpItemList->GetObject( nPos+1 );
+ if ( pTempItem && !pTempItem->mbShowWindow && !pTempItem->mbBreak )
+ {
+ long nCenterPos;
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ if ( IsHorizontal() )
+ {
+ nCenterPos = pItem->maRect.Center().X()-1;
+ DrawLine( Point( nCenterPos, pItem->maRect.Top() ),
+ Point( nCenterPos, pItem->maRect.Bottom() ) );
+ nCenterPos++;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( nCenterPos, pItem->maRect.Top() ),
+ Point( nCenterPos, pItem->maRect.Bottom() ) );
+ }
+ else
+ {
+ nCenterPos = pItem->maRect.Center().Y()-1;
+ DrawLine( Point( pItem->maRect.Left(), nCenterPos ),
+ Point( pItem->maRect.Right(), nCenterPos ) );
+ nCenterPos++;
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( pItem->maRect.Left(), nCenterPos ),
+ Point( pItem->maRect.Right(), nCenterPos ) );
+ }
+ }
+ }
+ }
+
+ // Ist es kein Button oder wird er als Fenster dargestellt,
+ // dann mache nichts
+ if ( (pItem->meType != TOOLBOXITEM_BUTTON) ||
+ (pItem->mbShowWindow && !mbCustomizeMode) )
+ return;
+
+ // Wenn wir das Configurations-Item zeichen, brauchen wir dazu ein
+ // TBDragMananger
+ ImplTBDragMgr* pMgr;
+ if ( pItem->mnId == mnConfigItem )
+ {
+ pMgr = ImplGetTBDragMgr();
+ pMgr->HideDragRect();
+ }
+ else
+ pMgr = NULL;
+
+ // Im Konfigurationsmodus werden sichtbare Fenster durch eine andere
+ // Darstellung ersetzt
+ if ( mbCustomizeMode && pItem->mbShowWindow )
+ {
+ Font aOldFont = GetFont();
+ Color aOldTextColor = GetTextColor();
+
+ SetFont( rStyleSettings.GetAppFont() );
+ SetLineColor( Color( COL_BLACK ) );
+ SetFillColor( rStyleSettings.GetFieldColor() );
+ SetTextColor( rStyleSettings.GetFieldTextColor() );
+ DrawRect( pItem->maRect );
+
+ Size aSize( GetCtrlTextWidth( pItem->maText ), GetTextHeight() );
+ Point aPos( pItem->maRect.Left()+2, pItem->maRect.Top() );
+ aPos.Y() += (pItem->maRect.GetHeight()-aSize.Height())/2;
+ BOOL bClip;
+ if ( (aSize.Width() > pItem->maRect.GetWidth()-2) ||
+ (aSize.Height() > pItem->maRect.GetHeight()-2) )
+ {
+ bClip = TRUE;
+ Rectangle aTempRect( pItem->maRect.Left()+1, pItem->maRect.Top()+1,
+ pItem->maRect.Right()-1, pItem->maRect.Bottom()-1 );
+ Region aTempRegion( aTempRect );
+ SetClipRegion( aTempRegion );
+ }
+ else
+ bClip = FALSE;
+ DrawCtrlText( aPos, pItem->maText );
+ if ( bClip )
+ SetClipRegion();
+ SetFont( aOldFont );
+ SetTextColor( aOldTextColor );
+
+ // Gegebenenfalls noch Config-Frame zeichnen
+ if ( pMgr )
+ pMgr->UpdateDragRect();
+ return;
+ }
+
+ // Button malen
+ Point aBtnPos;
+ Size aBtnSize = pItem->maRect.GetSize();
+ long nOffX = SMALLBUTTON_OFF_NORMAL_X;
+ long nOffY = SMALLBUTTON_OFF_NORMAL_Y;
+ long nTempOffX;
+ long nTempOffY;
+ USHORT nStyle = 0;
+ if ( pItem->meState == STATE_CHECK )
+ {
+ aBtnPos.Y() = aBtnSize.Height() * 2;
+ nStyle |= BUTTON_DRAW_CHECKED;
+ nOffX = SMALLBUTTON_OFF_CHECKED_X;
+ nOffY = SMALLBUTTON_OFF_CHECKED_Y;
+ }
+ else if ( pItem->meState == STATE_DONTKNOW )
+ {
+ aBtnPos.Y() = aBtnSize.Height() * 4;
+ nStyle |= BUTTON_DRAW_DONTKNOW;
+ }
+ if ( bHighlight == 1 )
+ {
+ aBtnPos.Y() += aBtnSize.Height();
+ nStyle |= BUTTON_DRAW_PRESSED;
+ nOffX = SMALLBUTTON_OFF_PRESSED_X;
+ nOffY = SMALLBUTTON_OFF_PRESSED_Y;
+ }
+
+ if ( mnOutStyle & TOOLBOX_STYLE_OUTBUTTON )
+ {
+ nOffX = OUTBUTTON_OFF_NORMAL_X;
+ nOffY = OUTBUTTON_OFF_NORMAL_Y;
+ if ( bHighlight )
+ {
+ nOffX++;
+ nOffY++;
+ }
+ }
+
+ if ( mnOutStyle & TOOLBOX_STYLE_FLAT )
+ {
+ if ( (pItem->meState != STATE_NOCHECK) || !bPaint )
+ {
+ if ( pItem->meState != STATE_NOCHECK )
+ {
+ SetLineColor();
+ SetFillColor( rStyleSettings.GetCheckedColor() );
+ DrawRect( pItem->maRect );
+ }
+ else
+ Erase( pItem->maRect );
+ }
+ }
+ else
+ {
+ if ( !pItem->mnNonStdSize )
+ DrawOutDev( pItem->maRect.TopLeft(), aBtnSize, aBtnPos, aBtnSize, *mpBtnDev );
+ else
+ {
+ if ( mnOutStyle & TOOLBOX_STYLE_OUTBUTTON )
+ ImplDrawOutButton( this, pItem->maRect, nStyle );
+ else
+ {
+ DecorationView aDecoView( this );
+ aDecoView.DrawButton( pItem->maRect, nStyle );
+ }
+ }
+ }
+
+ nOffX += pItem->maRect.Left();
+ nOffY += pItem->maRect.Top();
+
+ // Feststellen, was gemalt werden soll
+ BOOL bImage;
+ BOOL bText;
+ if ( meButtonType == BUTTON_SYMBOL )
+ {
+ if ( pItem->mnNonStdSize )
+ {
+ bImage = FALSE;
+ bText = TRUE;
+ }
+ else
+ {
+ bImage = TRUE;
+ bText = FALSE;
+ }
+ }
+ else if ( meButtonType == BUTTON_TEXT )
+ {
+ if ( pItem->mnNonStdSize )
+ {
+ bImage = TRUE;
+ bText = FALSE;
+ }
+ else
+ {
+ bImage = FALSE;
+ bText = TRUE;
+ }
+ }
+ else
+ {
+ bImage = TRUE;
+ bText = TRUE;
+ }
+
+ // Werte fuer die Ausgabe bestimmen
+ long nBtnWidth = aBtnSize.Width()-SMALLBUTTON_HSIZE;
+ long nBtnHeight = aBtnSize.Height()-SMALLBUTTON_VSIZE;
+ Size aImageSize;
+ Size aTxtSize;
+
+ if ( bText )
+ {
+ aTxtSize.Width() = GetCtrlTextWidth( pItem->maText );
+ aTxtSize.Height() = GetTextHeight();
+ }
+
+ if ( bImage )
+ {
+ const Image* pImage;
+ if ( bHighlight && (!(pItem->maHighImage)) == FALSE )
+ pImage = &(pItem->maHighImage);
+ else
+ pImage = &(pItem->maImage);
+
+ aImageSize = pImage->GetSizePixel();
+
+ // Ausgabeflags bestimmen
+ USHORT nImageStyle = 0;
+
+ if ( !pItem->mbEnabled || !IsEnabled() )
+ nImageStyle |= IMAGE_DRAW_DISABLE;
+
+ if ( pItem->meState == STATE_DONTKNOW )
+ nImageStyle |= IMAGE_DRAW_DISABLE;
+
+ // Image ausgeben
+ nTempOffX = nOffX;
+ nTempOffY = nOffY;
+ if ( pItem->mnBits & TIB_LEFT )
+ nTempOffY += (nBtnHeight-aImageSize.Height())/2;
+ else
+ {
+ nTempOffX += (nBtnWidth-aImageSize.Width())/2;
+ if ( bText )
+ nTempOffY += (nBtnHeight-aTxtSize.Height()-aImageSize.Height())/2;
+ else
+ nTempOffY += (nBtnHeight-aImageSize.Height())/2;
+ }
+ DrawImage( Point( nTempOffX, nTempOffY ), *pImage, nImageStyle );
+ }
+
+ // Text ausgeben
+ if ( bText )
+ {
+ nTempOffX = nOffX;
+ nTempOffY = nOffY;
+
+ // Muss Text gegebenenfalls gedreht werden
+ Font aOldFont = GetFont();
+ BOOL bRotate = FALSE;
+ if ( pItem->mnNonStdSize && !bImage && !IsFloatingMode() &&
+ ((meAlign == WINDOWALIGN_LEFT) || (meAlign == WINDOWALIGN_RIGHT)) )
+ {
+ bRotate = TRUE;
+
+ Font aRotateFont = aOldFont;
+ if ( meAlign == WINDOWALIGN_LEFT )
+ {
+ aRotateFont.SetOrientation( 900 );
+ nTempOffX += (nBtnWidth-aTxtSize.Height())/2;
+ nTempOffY += aTxtSize.Width();
+ nTempOffY += (nBtnHeight-aTxtSize.Width())/2;
+ }
+ else
+ {
+ aRotateFont.SetOrientation( 2700 );
+ nTempOffX += aTxtSize.Height();
+ nTempOffX += (nBtnWidth-aTxtSize.Height())/2;
+ nTempOffY += (nBtnHeight-aTxtSize.Width())/2;
+ }
+
+ SetFont( aRotateFont );
+ }
+ else
+ {
+ if ( pItem->mnBits & TIB_LEFT )
+ {
+ nTempOffX += aImageSize.Width();
+ nTempOffY += (nBtnHeight-aTxtSize.Height())/2;
+ }
+ else
+ {
+ nTempOffX += (nBtnWidth-aTxtSize.Width())/2;
+ if ( bImage )
+ nTempOffY += nBtnHeight-aTxtSize.Height();
+ else
+ nTempOffY += (nBtnHeight-aTxtSize.Height())/2;
+ }
+ }
+
+ USHORT nTextStyle = 0;
+ if ( !pItem->mbEnabled )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+ DrawCtrlText( Point( nTempOffX, nTempOffY ), pItem->maText,
+ 0, STRING_LEN, nTextStyle );
+
+ if ( bRotate )
+ SetFont( aOldFont );
+ }
+
+ // Evt. noch Pfeil rechts/oben in der Ecke zeichnen
+ if ( pItem->mnBits & TIB_DROPDOWN )
+ {
+ Point aArrowPos( nOffX, nOffY );
+ aArrowPos.X() += nBtnWidth-6;
+
+ Color aOldLineColor = GetLineColor();
+ Color aOldFillColor = GetFillColor();
+ Rectangle aClearRect( aArrowPos.X()-1, aArrowPos.Y(),
+ aArrowPos.X()+3, aArrowPos.Y()+4 );
+ SetLineColor();
+
+ if ( (meAlign == WINDOWALIGN_LEFT) || (meAlign == WINDOWALIGN_RIGHT) )
+ {
+ aArrowPos.X() += 2;
+ aClearRect.Left() += 2;
+ aClearRect.Right() += 2;
+ aClearRect.Bottom() += 2;
+ }
+ else
+ aClearRect.Right() += 2;
+
+ Erase( aClearRect );
+ BOOL bBlack = FALSE;
+
+ if ( !pItem->mbEnabled || !IsEnabled() )
+ SetFillColor( rStyleSettings.GetShadowColor() );
+ else
+ {
+ SetFillColor( COL_LIGHTGREEN );
+ bBlack = TRUE;
+ }
+ ImplDrawToolArrow( this, aArrowPos.X(), aArrowPos.Y(), bBlack );
+ SetLineColor( aOldLineColor );
+ SetFillColor( aOldFillColor );
+ }
+
+ if ( mnOutStyle & TOOLBOX_STYLE_FLAT )
+ {
+ if ( bHighlight || (pItem->meState == STATE_CHECK) )
+ {
+ Point aPos( pItem->maRect.TopLeft() );
+ Size aSize( pItem->maRect.GetSize() );
+
+ if ( bHighlight == 2 )
+ SetLineColor( rStyleSettings.GetLightColor() );
+ else
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ DrawLine( aPos, Point( aPos.X()+aSize.Width()-1, aPos.Y() ) );
+ DrawLine( aPos, Point( aPos.X(), aPos.Y()+aSize.Height()-1 ) );
+ if ( bHighlight == 2 )
+ SetLineColor( rStyleSettings.GetShadowColor() );
+ else
+ SetLineColor( rStyleSettings.GetLightColor() );
+ DrawLine( Point( aPos.X()+aSize.Width()-1, aPos.Y() ),
+ Point( aPos.X()+aSize.Width()-1, aPos.Y()+aSize.Height()-1 ) );
+ DrawLine( Point( aPos.X(), aPos.Y()+aSize.Height()-1 ),
+ Point( aPos.X()+aSize.Width()-1, aPos.Y()+aSize.Height()-1 ) );
+ }
+ }
+
+ // Gegebenenfalls noch Config-Frame zeichnen
+ if ( pMgr )
+ pMgr->UpdateDragRect();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplStartCustomizeMode()
+{
+ mbCustomizeMode = TRUE;
+
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbShowWindow )
+ {
+ pItem->mpWindow->Hide();
+
+ if ( !(pItem->maRect.IsEmpty()) )
+ Invalidate( pItem->maRect );
+ }
+
+ pItem = mpItemList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplEndCustomizeMode()
+{
+ mbCustomizeMode = FALSE;
+
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mbShowWindow )
+ {
+ if ( !(pItem->maRect.IsEmpty()) )
+ Invalidate( pItem->maRect );
+
+ pItem->mpWindow->Show();
+ }
+
+ pItem = mpItemList->Next();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplFloatControl( BOOL bStart, FloatingWindow* pFloatWindow )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( bStart )
+ {
+ mpFloatWin = pFloatWindow;
+
+ // Wenn Button nicht gedrueckt dargestellt wird, dann den
+ // Button neu malen
+ if ( mnCurItemId != mnDownItemId )
+ ImplDrawItem( mnCurPos, TRUE );
+ mbDrag = FALSE;
+ EndTracking();
+ ReleaseMouse();
+ }
+ else
+ {
+ mpFloatWin = NULL;
+
+ if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND )
+ ImplDrawItem( mnCurPos );
+ Deactivate();
+ mnCurPos = TOOLBOX_ITEM_NOTFOUND;
+ mnCurItemId = 0;
+ mnDownItemId = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ShowLine( BOOL bNext )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ mbFormat = TRUE;
+ if ( bNext )
+ mnCurLine++;
+ else
+ mnCurLine--;
+ ImplFormat();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::ImplHandleMouseMove( const MouseEvent& rMEvt, BOOL bRepeat )
+{
+ Point aMousePos = rMEvt.GetPosPixel();
+
+ // Ist ToolBox aktiv
+ if ( mbDrag )
+ {
+ // Befindet sich Maus ueber dem Item
+ ImplToolItem* pItem = mpItemList->GetObject( mnCurPos );
+ if ( pItem->maRect.IsInside( aMousePos ) )
+ {
+ if ( !mnCurItemId )
+ {
+ ImplDrawItem( mnCurPos, TRUE );
+ mnCurItemId = pItem->mnId;
+ Highlight();
+ }
+
+ if ( (pItem->mnBits & TIB_REPEAT) && bRepeat )
+ Select();
+ }
+ else
+ {
+ if ( mnCurItemId )
+ {
+ ImplDrawItem( mnCurPos );
+ mnCurItemId = 0;
+ ImplDrawItem( mnCurPos );
+ Highlight();
+ }
+ }
+
+ return TRUE;
+ }
+
+ if ( mbUpper )
+ {
+ BOOL bNewIn = maUpperRect.IsInside( aMousePos );
+ if ( bNewIn != mbIn )
+ {
+ mbIn = bNewIn;
+ ImplDrawSpin( mbIn, FALSE );
+ }
+ return TRUE;
+ }
+
+ if ( mbLower )
+ {
+ BOOL bNewIn = maLowerRect.IsInside( aMousePos );
+ if ( bNewIn != mbIn )
+ {
+ mbIn = bNewIn;
+ ImplDrawSpin( FALSE, mbIn );
+ }
+ return TRUE;
+ }
+
+ if ( mbNextTool )
+ {
+ BOOL bNewIn = maNextToolRect.IsInside( aMousePos );
+ if ( bNewIn != mbIn )
+ {
+ mbIn = bNewIn;
+ ImplDrawNext( mbIn );
+ }
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::ImplHandleMouseButtonUp( const MouseEvent& rMEvt, BOOL bCancel )
+{
+ if ( mbDrag || mbSelection )
+ {
+ // Hier die MouseDaten setzen, wenn Selection-Modus, da dann kein
+ // MouseButtonDown-Handler gerufen wird
+ if ( mbSelection )
+ {
+ mnMouseClicks = rMEvt.GetClicks();
+ mnMouseModifier = rMEvt.GetModifier();
+ }
+
+ Deactivate();
+
+ if ( mbDrag )
+ mbDrag = FALSE;
+ else
+ {
+ mbSelection = FALSE;
+ if ( mnCurPos == TOOLBOX_ITEM_NOTFOUND )
+ return TRUE;
+ }
+
+ // Wurde Maus ueber dem Item losgelassen
+ ImplToolItem* pItem = mpItemList->GetObject( mnCurPos );
+ if ( pItem->maRect.IsInside( rMEvt.GetPosPixel() ) )
+ {
+ mnCurItemId = pItem->mnId;
+ if ( !bCancel )
+ {
+ // Gegebenenfalls ein AutoCheck durchfuehren
+ if ( pItem->mnBits & TIB_AUTOCHECK )
+ {
+ if ( pItem->mnBits & TIB_RADIOCHECK )
+ {
+ if ( pItem->meState != STATE_CHECK )
+ SetItemState( pItem->mnId, STATE_CHECK );
+ }
+ else
+ {
+ if ( pItem->meState != STATE_CHECK )
+ pItem->meState = STATE_CHECK;
+ else
+ pItem->meState = STATE_NOCHECK;
+ }
+ }
+
+ // Select nicht bei Repeat ausloesen, da dies schon im
+ // MouseButtonDown ausgeloest wurde
+ if ( !(pItem->mnBits & TIB_REPEAT) )
+ {
+ // Gegen zerstoeren im Select-Handler sichern
+ ImplDelData aDelData;
+ ImplAddDel( &aDelData );
+ Select();
+ if ( aDelData.IsDelete() )
+ return TRUE;
+ ImplRemoveDel( &aDelData );
+ }
+ }
+
+ {
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ // Items nicht geloescht, im Select-Handler
+ if ( mnCurItemId )
+ {
+ BOOL bHighlight;
+ if ( (mnCurItemId == mnHighItemId) && (mnOutStyle & TOOLBOX_STYLE_FLAT) )
+ bHighlight = 2;
+ else
+ bHighlight = FALSE;
+ ImplDrawItem( mnCurPos, bHighlight );
+ }
+ }
+
+ mnCurPos = TOOLBOX_ITEM_NOTFOUND;
+ mnCurItemId = 0;
+ mnDownItemId = 0;
+ mnMouseClicks = 0;
+ mnMouseModifier = 0;
+ return TRUE;
+ }
+ else if ( mbUpper || mbLower )
+ {
+ if ( mbIn )
+ ShowLine( !mbUpper );
+ mbUpper = FALSE;
+ mbLower = FALSE;
+ mbIn = FALSE;
+ ImplDrawSpin( FALSE, FALSE );
+ return TRUE;
+ }
+ else if ( mbNextTool )
+ {
+ mbNextTool = FALSE;
+ mbIn = FALSE;
+ ImplDrawNext( FALSE );
+ NextToolBox();
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( ImplHandleMouseMove( rMEvt ) )
+ return;
+
+ Point aMousePos = rMEvt.GetPosPixel();
+
+ if ( mbSelection )
+ {
+ USHORT i = 0;
+ USHORT nNewPos = TOOLBOX_ITEM_NOTFOUND;
+
+ // Item suchen, das geklickt wurde
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Wenn Mausposition in diesem Item vorhanden, kann die
+ // Suche abgebrochen werden
+ if ( pItem->maRect.IsInside( aMousePos ) )
+ {
+ // Wenn es ein Button ist, dann wird er selektiert
+ if ( pItem->meType == TOOLBOXITEM_BUTTON )
+ {
+ // Wenn er disablet ist, findet keine Aenderung
+ // statt
+ if ( !pItem->mbEnabled || pItem->mbShowWindow )
+ nNewPos = mnCurPos;
+ else
+ nNewPos = i;
+ }
+
+ break;
+ }
+
+ i++;
+ pItem = mpItemList->Next();
+ }
+
+ // Wurde ein neuer Eintrag selektiert
+ if ( nNewPos != mnCurPos )
+ {
+ if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND )
+ ImplDrawItem( mnCurPos );
+
+ mnCurPos = nNewPos;
+ if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ mnCurItemId = pItem->mnId;
+ ImplDrawItem( mnCurPos, TRUE );
+ }
+ else
+ mnCurItemId = 0;
+
+ Highlight();
+ }
+ return;
+ }
+
+ if ( mbDragging )
+ {
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ pMgr->Dragging( aMousePos );
+ return;
+ }
+
+ PointerStyle eStyle = POINTER_ARROW;
+ if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING )
+ {
+ if ( rMEvt.GetMode() & MOUSE_SIMPLEMOVE )
+ {
+ USHORT nLinePtr = ImplTestLineSize( this, rMEvt.GetPosPixel() );
+ if ( nLinePtr & DOCK_LINEHSIZE )
+ {
+ if ( meAlign == WINDOWALIGN_LEFT )
+ eStyle = POINTER_WINDOW_ESIZE;
+ else
+ eStyle = POINTER_WINDOW_WSIZE;
+ }
+ else if ( nLinePtr & DOCK_LINEVSIZE )
+ {
+ if ( meAlign == WINDOWALIGN_TOP )
+ eStyle = POINTER_WINDOW_SSIZE;
+ else
+ eStyle = POINTER_WINDOW_NSIZE;
+ }
+ }
+ }
+
+ if ( (eStyle == POINTER_ARROW) && mbCustomizeMode )
+ {
+ // Item suchen, das geklickt wurde
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Wenn es ein Customize-Window ist, gegebenenfalls den
+ // Resize-Pointer anzeigen
+ if ( pItem->mbShowWindow )
+ {
+ if ( pItem->maRect.IsInside( aMousePos ) )
+ {
+ if ( pItem->maRect.Right()-TB_RESIZE_OFFSET <= aMousePos.X() )
+ eStyle = POINTER_HSIZEBAR;
+ break;
+ }
+ }
+
+ pItem = mpItemList->Next();
+ }
+ }
+
+ if ( ((eStyle == POINTER_ARROW) && (mnOutStyle & TOOLBOX_STYLE_HANDPOINTER)) ||
+ (mnOutStyle & TOOLBOX_STYLE_FLAT) )
+ {
+ BOOL bClearHigh = TRUE;
+ if ( !rMEvt.IsLeaveWindow() && (mnCurPos == TOOLBOX_ITEM_NOTFOUND) )
+ {
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->maRect.IsInside( aMousePos ) )
+ {
+ if ( (pItem->meType == TOOLBOXITEM_BUTTON) && pItem->mbEnabled )
+ {
+ if ( mnOutStyle & TOOLBOX_STYLE_FLAT )
+ {
+ bClearHigh = FALSE;
+ if ( mnHighItemId != pItem->mnId )
+ {
+ USHORT nTempPos = (USHORT)mpItemList->GetCurPos();
+ if ( mnHighItemId )
+ ImplDrawItem( GetItemPos( mnHighItemId ) );
+ mnHighItemId = pItem->mnId;
+ ImplDrawItem( nTempPos, 2 );
+ }
+ }
+ if ( mnOutStyle & TOOLBOX_STYLE_HANDPOINTER )
+ eStyle = POINTER_REFHAND;
+ }
+ break;
+ }
+
+ pItem = mpItemList->Next();
+ }
+ }
+
+ if ( bClearHigh && mnHighItemId )
+ {
+ USHORT nClearPos = GetItemPos( mnHighItemId );
+ if ( nClearPos != TOOLBOX_ITEM_NOTFOUND )
+ ImplDrawItem( nClearPos, (nClearPos == mnCurPos) ? TRUE : FALSE );
+ mnHighItemId = 0;
+ }
+ }
+
+ if ( meLastStyle != eStyle )
+ {
+ meLastStyle = eStyle;
+ Pointer aPtr( eStyle );
+ SetPointer( aPtr );
+ }
+
+ DockingWindow::MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // Nur bei linker Maustaste ToolBox ausloesen und wenn wir uns nicht
+ // noch in der normalen Bearbeitung befinden
+ if ( rMEvt.IsLeft() && !mbDrag && (mnCurPos == TOOLBOX_ITEM_NOTFOUND) )
+ {
+ // Activate schon hier rufen, da gegebenenfalls noch Items
+ // ausgetauscht werden
+ Activate();
+
+ // ToolBox hier updaten, damit der Anwender weiss, was Sache ist
+ if ( mbFormat )
+ {
+ ImplFormat();
+ Update();
+ }
+
+ Point aMousePos = rMEvt.GetPosPixel();
+ USHORT i = 0;
+ USHORT nNewPos = TOOLBOX_ITEM_NOTFOUND;
+
+ // Item suchen, das geklickt wurde
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Ist es dieses Item
+ if ( pItem->maRect.IsInside( aMousePos ) )
+ {
+ // Ist es ein Separator oder ist das Item disabled,
+ // dann mache nichts
+ if ( (pItem->meType == TOOLBOXITEM_BUTTON) &&
+ (!pItem->mbShowWindow || mbCustomizeMode) )
+ nNewPos = i;
+
+ break;
+ }
+
+ i++;
+ pItem = mpItemList->Next();
+ }
+
+ // Item gefunden
+ if ( nNewPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ if ( mbCustomize )
+ {
+ if ( rMEvt.IsMod2() || mbCustomizeMode )
+ {
+ Deactivate();
+
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ Rectangle aItemRect = GetItemRect( pItem->mnId );
+ mnConfigItem = pItem->mnId;
+
+ BOOL bResizeItem;
+ if ( mbCustomizeMode && pItem->mbShowWindow &&
+ (pItem->maRect.Right()-TB_RESIZE_OFFSET <= aMousePos.X()) )
+ bResizeItem = TRUE;
+ else
+ bResizeItem = FALSE;
+ pMgr->StartDragging( this, aMousePos, aItemRect, 0, bResizeItem );
+ return;
+ }
+ }
+
+ if ( !pItem->mbEnabled )
+ {
+ Sound::Beep( SOUND_DISABLE, this );
+ Deactivate();
+ return;
+ }
+
+ // Aktuelle Daten setzen
+ USHORT nTrackFlags = 0;
+ mnCurPos = i;
+ mnCurItemId = pItem->mnId;
+ mnDownItemId = mnCurItemId;
+ mnMouseClicks = rMEvt.GetClicks();
+ mnMouseModifier = rMEvt.GetModifier();
+ if ( pItem->mnBits & TIB_REPEAT )
+ nTrackFlags |= STARTTRACK_BUTTONREPEAT;
+
+ if ( mbSelection )
+ {
+ ImplDrawItem( mnCurPos, TRUE );
+ Highlight();
+ }
+ else
+ {
+ // Hier schon bDrag setzen, da in EndSelection ausgewertet wird
+ mbDrag = TRUE;
+
+ // Bei Doppelklick nur den Handler rufen, aber bevor der
+ // Button gehiltet wird, da evt. in diesem Handler der
+ // Drag-Vorgang abgebrochen wird
+ if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
+
+ if ( mbDrag )
+ {
+ ImplDrawItem( mnCurPos, TRUE );
+ Highlight();
+ }
+
+ // Click-Handler aufrufen
+ if ( rMEvt.GetClicks() != 2 )
+ Click();
+
+ // Bei Repeat auch den Select-Handler rufen
+ if ( nTrackFlags & STARTTRACK_BUTTONREPEAT )
+ Select();
+
+ // Wenn die Aktion nicht im Click-Handler abgebrochen wurde
+ if ( mbDrag )
+ StartTracking( nTrackFlags );
+ }
+
+ // Wenn Maus ueber einem Item gedrueckt wurde, koennen wir
+ // die Bearbeitung abbrechen
+ return;
+ }
+
+ Deactivate();
+
+ // Gegebenenfalls noch Scroll- und Next-Buttons ueberpruefen
+ if ( maUpperRect.IsInside( aMousePos ) )
+ {
+ if ( mnCurLine > 1 )
+ {
+ StartTracking();
+ mbUpper = TRUE;
+ mbIn = TRUE;
+ ImplDrawSpin( TRUE, FALSE );
+ }
+ return;
+ }
+ if ( maLowerRect.IsInside( aMousePos ) )
+ {
+ if ( mnCurLine+mnVisLines-1 < mnCurLines )
+ {
+ StartTracking();
+ mbLower = TRUE;
+ mbIn = TRUE;
+ ImplDrawSpin( FALSE, TRUE );
+ }
+ return;
+ }
+ if ( maNextToolRect.IsInside( aMousePos ) )
+ {
+ StartTracking();
+ mbNextTool = TRUE;
+ mbIn = TRUE;
+ ImplDrawNext( TRUE );
+ return;
+ }
+
+ // Linesizing testen
+ if ( (mnWinStyle & TB_WBLINESIZING) == TB_WBLINESIZING )
+ {
+ USHORT nLineMode = ImplTestLineSize( this, aMousePos );
+ if ( nLineMode )
+ {
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+
+ // Handler rufen, damit die Dock-Rectangles gesetzt werden
+ // koenen
+ StartDocking();
+
+ Point aPos = GetParent()->OutputToScreenPixel( GetPosPixel() );
+ Size aSize = GetSizePixel();
+ aPos = ScreenToOutputPixel( aPos );
+
+ // Dragging starten
+ pMgr->StartDragging( this, aMousePos, Rectangle( aPos, aSize ),
+ nLineMode, FALSE );
+ return;
+ }
+ }
+
+ // Kein Item, dann nur Click oder DoubleClick
+ if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
+ else
+ Click();
+ }
+
+ if ( !mbDrag && !mbSelection )
+ DockingWindow::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( ImplHandleMouseButtonUp( rMEvt ) )
+ return;
+
+ if ( mbDragging && (rMEvt.IsLeft() || mbCommandDrag) )
+ {
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ pMgr->EndDragging();
+ return;
+ }
+ mbCommandDrag = FALSE;
+
+ DockingWindow::MouseButtonUp( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Tracking( const TrackingEvent& rTEvt )
+{
+ if ( rTEvt.IsTrackingEnded() )
+ ImplHandleMouseButtonUp( rTEvt.GetMouseEvent(), rTEvt.IsTrackingCanceled() );
+ else
+ ImplHandleMouseMove( rTEvt.GetMouseEvent(), rTEvt.IsTrackingRepeat() );
+
+ DockingWindow::Tracking( rTEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Paint( const Rectangle& rPaintRect )
+{
+ if ( rPaintRect == Rectangle( 0, 0, mnDX-1, mnDY-1 ) )
+ mbFullPaint = TRUE;
+ ImplFormat();
+ mbFullPaint = FALSE;
+
+ if ( (mnWinStyle & WB_BORDER) && !IsFloatingMode() )
+ ImplDrawBorder( this );
+
+ // SpinButtons zeichnen
+ if ( mnWinStyle & WB_SCROLL )
+ {
+ if ( mnCurLines > mnLines )
+ ImplDrawSpin( FALSE, FALSE );
+ }
+
+ // NextButton zeichnen
+ ImplDrawNext( FALSE );
+
+ // Buttons zeichnen
+ USHORT nHighPos;
+ if ( mnHighItemId )
+ nHighPos = GetItemPos( mnHighItemId );
+ else
+ nHighPos = TOOLBOX_ITEM_NOTFOUND;
+ USHORT nCount = (USHORT)mpItemList->Count();
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( i );
+
+ // Nur malen, wenn Rechteck im PaintRectangle liegt
+ if ( !pItem->maRect.IsEmpty() && rPaintRect.IsOver( pItem->maRect ) )
+ {
+ BOOL bHighlight = FALSE;
+ if ( i == mnCurPos )
+ bHighlight = 1;
+ else if ( i == nHighPos )
+ bHighlight = 2;
+ ImplDrawItem( i, bHighlight );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Move()
+{
+ DockingWindow::Move();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Resize()
+{
+ long nOldDX = mnDX;
+ long nOldDY = mnDY;
+ Size aSize = GetOutputSizePixel();
+ mnDX = aSize.Width();
+ mnDY = aSize.Height();
+ mnLastResizeDY = 0;
+
+ // Evt. neu formatieren oder neu painten
+ if ( mbScroll )
+ {
+ if ( !mbFormat )
+ {
+ mbFormat = TRUE;
+ if ( IsReallyVisible() )
+ ImplFormat( TRUE );
+ }
+ }
+
+ // Border muss neu ausgegeben werden
+ if ( mnWinStyle & WB_BORDER )
+ {
+ // Da wir sonst beim Paint denken, das alles neu gepaintet wird
+ if ( mbFormat && IsReallyVisible() )
+ Invalidate();
+ else
+ {
+ if ( mnRightBorder )
+ {
+ if ( nOldDX > mnDX )
+ Invalidate( Rectangle( mnDX-mnRightBorder-1, 0, mnDX, mnDY ) );
+ else
+ Invalidate( Rectangle( nOldDX-mnRightBorder-1, 0, nOldDX, nOldDY ) );
+ }
+
+ if ( mnBottomBorder )
+ {
+ if ( nOldDY > mnDY )
+ Invalidate( Rectangle( 0, mnDY-mnBottomBorder-1, mnDX, mnDY ) );
+ else
+ Invalidate( Rectangle( 0, nOldDY-mnBottomBorder-1, nOldDX, nOldDY ) );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
+
+ if ( nItemId )
+ {
+ if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) )
+ {
+ // Rechteck ermitteln
+ Rectangle aTempRect = GetItemRect( nItemId );
+ Point aPt = OutputToScreenPixel( aTempRect.TopLeft() );
+ aTempRect.Left() = aPt.X();
+ aTempRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aTempRect.BottomRight() );
+ aTempRect.Right() = aPt.X();
+ aTempRect.Bottom() = aPt.Y();
+
+ // Text ermitteln und anzeigen
+ XubString aStr = GetQuickHelpText( nItemId );
+ const XubString& rHelpStr = GetHelpText( nItemId );
+ if ( !aStr.Len() )
+ aStr = GetItemText( nItemId );
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ {
+ if ( rHelpStr.Len() )
+ aStr = rHelpStr;
+ else
+ aStr.EraseAllChars( '~' );
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aTempRect, aStr );
+ }
+ else
+ Help::ShowQuickHelp( this, aTempRect, aStr, rHelpStr, QUICKHELP_CTRLTEXT );
+ return;
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
+ {
+ ULONG nHelpId = GetHelpId( nItemId );
+ if ( nHelpId )
+ {
+ // Wenn eine Hilfe existiert, dann ausloesen
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pHelp->Start( nHelpId );
+ return;
+ }
+ }
+ }
+ else if ( maNextToolRect.IsInside( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ) )
+ {
+ if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) )
+ {
+ // Rechteck ermitteln
+ Rectangle aTempRect = maNextToolRect;
+ Point aPt = OutputToScreenPixel( aTempRect.TopLeft() );
+ aTempRect.Left() = aPt.X();
+ aTempRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( aTempRect.BottomRight() );
+ aTempRect.Right() = aPt.X();
+ aTempRect.Bottom() = aPt.Y();
+
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ Help::ShowBalloon( this, aTempRect.Center(), aTempRect, maNextToolBoxStr );
+ else
+ Help::ShowQuickHelp( this, aTempRect, maNextToolBoxStr );
+ return;
+ }
+ }
+
+ DockingWindow::RequestHelp( rHEvt );
+}
+
+// -----------------------------------------------------------------------
+
+long ToolBox::Notify( NotifyEvent& rNEvt )
+{
+ return DockingWindow::Notify( rNEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Command( const CommandEvent& rCEvt )
+{
+ // StartDrag auf MouseButton/Left/Alt abbilden
+ if ( (rCEvt.GetCommand() == COMMAND_STARTDRAG) && rCEvt.IsMouseEvent() &&
+ mbCustomize && !mbDragging && !mbDrag && !mbSelection &&
+ (mnCurPos == TOOLBOX_ITEM_NOTFOUND) )
+ {
+ // Wir erlauben nur das Draggen von Items. Deshalb muessen wir
+ // testen, ob auch ein Item angeklickt wurde, ansonsten wuerden
+ // wir evt. das Fenster verschieben, was nicht gewollt waere.
+ // Wir machen dieses jedoch nur im Customize-Mode, da ansonsten
+ // Items zuhaeufig ausversehen verschoben werden.
+ if ( mbCustomizeMode )
+ {
+ Point aMousePos = rCEvt.GetMousePosPixel();
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Ist es dieses Item
+ if ( pItem->maRect.IsInside( aMousePos ) )
+ {
+ // Ist es ein Separator oder ist das Item disabled,
+ // dann mache nichts
+ if ( (pItem->meType == TOOLBOXITEM_BUTTON) &&
+ !pItem->mbShowWindow )
+ mbCommandDrag = TRUE;
+ break;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ if ( mbCommandDrag )
+ {
+ MouseEvent aMEvt( aMousePos, 1, MOUSE_SIMPLECLICK,
+ MOUSE_LEFT, KEY_MOD2 );
+ ToolBox::MouseButtonDown( aMEvt );
+ return;
+ }
+ }
+ }
+ else if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ if ( (mnCurLine > 1) || (mnCurLine+mnVisLines-1 < mnCurLines) )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ if ( (mnCurLine > 1) && (pData->GetDelta() > 0) )
+ ShowLine( FALSE );
+ else if ( (mnCurLine+mnVisLines-1 < mnCurLines) && (pData->GetDelta() < 0) )
+ ShowLine( TRUE );
+ ImplDrawSpin( FALSE, FALSE );
+ return;
+ }
+ }
+ }
+
+ DockingWindow::Command( rCEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::StateChanged( StateChangedType nType )
+{
+ DockingWindow::StateChanged( nType );
+
+ if ( nType == STATE_CHANGE_INITSHOW )
+ ImplFormat();
+ else if ( nType == STATE_CHANGE_ENABLE )
+ ImplUpdateItem();
+ else if ( nType == STATE_CHANGE_UPDATEMODE )
+ {
+ if ( IsUpdateMode() )
+ Invalidate();
+ }
+ else if ( (nType == STATE_CHANGE_ZOOM) ||
+ (nType == STATE_CHANGE_CONTROLFONT) )
+ {
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+ ImplInitSettings( TRUE, FALSE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
+ {
+ ImplInitSettings( FALSE, TRUE, FALSE );
+ Invalidate();
+ }
+ else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
+ {
+ ImplInitSettings( FALSE, FALSE, TRUE );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ DockingWindow::DataChanged( rDCEvt );
+
+ if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
+ ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ {
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+ ImplInitSettings( TRUE, TRUE, TRUE );
+ if ( mpBtnDev )
+ ImplButtonSysChange( this, mpBtnDev, mnOutStyle );
+ Invalidate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::PrepareToggleFloatingMode()
+{
+ return DockingWindow::PrepareToggleFloatingMode();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ToggleFloatingMode()
+{
+ DockingWindow::ToggleFloatingMode();
+
+ if ( IsFloatingMode() )
+ {
+ mbHorz = TRUE;
+ mbScroll = TRUE;
+ SetOutputSizePixel( ImplCalcFloatSize( this, mnFloatLines ) );
+ }
+ else
+ {
+ mbScroll = (mnWinStyle & WB_SCROLL) ? TRUE : FALSE;
+ if ( (meAlign == WINDOWALIGN_TOP) || (meAlign == WINDOWALIGN_BOTTOM) )
+ mbHorz = TRUE;
+ else
+ mbHorz = FALSE;
+ }
+
+ mbFormat = TRUE;
+ ImplFormat();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::StartDocking()
+{
+ meDockAlign = meAlign;
+ mnDockLines = mnLines;
+ mbLastFloatMode = IsFloatingMode();
+ DockingWindow::StartDocking();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::Docking( const Point& rPos, Rectangle& rRect )
+{
+ // Wenn Dragging, dann nicht machen, da vorher schon berechnet
+ if ( mbDragging )
+ return FALSE;
+
+ BOOL bFloatMode = FALSE;
+
+ DockingWindow::Docking( rPos, rRect );
+
+ // Befindet sich die Maus ausserhalb des Bereichs befindet, kann es nur ein
+ // FloatWindow werden
+ if ( maOutDockRect.IsInside( rPos ) && !IsDockingPrevented() )
+ {
+ Rectangle aInRect = maInDockRect;
+ Size aDockSize;
+ aDockSize.Width() = ImplCalcSize( this, mnLines, TB_CALCMODE_VERT ).Width();
+ aDockSize.Height() = ImplCalcSize( this, mnLines, TB_CALCMODE_HORZ ).Height();
+ aInRect.Left() += aDockSize.Width()/2;
+ aInRect.Top() += aDockSize.Height()/2;
+ aInRect.Right() -= aDockSize.Width()/2;
+ aInRect.Bottom() -= aDockSize.Height()/2;
+
+ // Auf den Dockbereich eine halbe Breite der ToolBox dazurechnen
+ if ( !IsFloatingMode() )
+ {
+ if ( meAlign == WINDOWALIGN_LEFT )
+ aInRect.Left() -= aDockSize.Width()/2;
+ else if ( meAlign == WINDOWALIGN_TOP )
+ aInRect.Top() -= aDockSize.Height()/2;
+ else if ( meAlign == WINDOWALIGN_RIGHT )
+ aInRect.Right() += aDockSize.Width()/2;
+ else
+ aInRect.Bottom() += aDockSize.Height()/2;
+ }
+
+ // Wenn Fenster zu klein, wird das gesammte InDock-Rect genommen
+ if ( aInRect.Left() >= aInRect.Right() )
+ {
+ aInRect.Left() = maInDockRect.Left();
+ aInRect.Right() = maInDockRect.Right();
+ }
+ if ( aInRect.Top() >= aInRect.Bottom() )
+ {
+ aInRect.Top() = maInDockRect.Top();
+ aInRect.Bottom() = maInDockRect.Bottom();
+ }
+
+ // Wenn Maus nicht im Dock-Bereich, dann kann es nur zum
+ // FloatWindow werden
+ if ( aInRect.IsInside( rPos ) )
+ bFloatMode = TRUE;
+ else
+ {
+ // Wird befinden uns im Dock-Bereich. Jetzt muessen wir
+ // feststellen, an welcher Kante angedockt werden soll
+ Point aInPos( rPos.X()-aInRect.Left(), rPos.Y()-aInRect.Top() );
+ Size aInSize = aInRect.GetSize();
+ Size aOutSize = maOutDockRect.GetSize();
+ USHORT nQuadrant = 0;
+
+ if ( aInPos.Y() > aInSize.Height()/2 )
+ nQuadrant += 2;
+ if ( aInPos.X() > aInSize.Width()/2 )
+ nQuadrant++;
+
+ if ( nQuadrant == 0 )
+ {
+ if ( aInPos.X() >= aInPos.Y() )
+ meDockAlign = WINDOWALIGN_TOP;
+ else
+ meDockAlign = WINDOWALIGN_LEFT;
+ }
+ else if ( nQuadrant == 1 )
+ {
+ if ( aInSize.Width()-aInPos.X() >= aInPos.Y() )
+ meDockAlign = WINDOWALIGN_TOP;
+ else
+ meDockAlign = WINDOWALIGN_RIGHT;
+ }
+ else if ( nQuadrant == 2 )
+ {
+ if ( aInPos.X() <= aInSize.Height()-aInPos.Y() )
+ meDockAlign = WINDOWALIGN_LEFT;
+ else
+ meDockAlign = WINDOWALIGN_BOTTOM;
+ }
+ else
+ {
+ if ( (rPos.X() >= aInRect.Right()) &&
+ (rPos.Y() >= aInRect.Bottom()) )
+ {
+ if ( aInSize.Height()-aInPos.Y() <
+ aInSize.Width()-aInPos.X() )
+ meDockAlign = WINDOWALIGN_RIGHT;
+ else
+ meDockAlign = WINDOWALIGN_BOTTOM;
+ }
+ else
+ {
+ if ( rPos.X() >= aInRect.Right() )
+ meDockAlign = WINDOWALIGN_RIGHT;
+ else
+ meDockAlign = WINDOWALIGN_BOTTOM;
+ }
+ }
+
+ // Wenn sich Dock-Align geaendert hat, muessen wir die
+ // neue Dock-Groesse setzen
+ if ( (meDockAlign == WINDOWALIGN_TOP) || (meDockAlign == WINDOWALIGN_BOTTOM) )
+ aDockSize.Width() = aOutSize.Width();
+ else
+ aDockSize.Height() = aOutSize.Height();
+ rRect.SetSize( aDockSize );
+ }
+ }
+ else
+ bFloatMode = TRUE;
+
+ if ( bFloatMode )
+ {
+ meDockAlign = meAlign;
+ if ( !mbLastFloatMode )
+ {
+ USHORT nTemp = 0;
+ rRect.SetSize( ImplCalcFloatSize( this, nTemp ) );
+ }
+ }
+
+ // Ist Pointer nicht mehr im Rechteck
+ if ( !rRect.IsInside( rPos ) )
+ {
+ Point aMouseOff;
+ aMouseOff.X() = rRect.Left() - rPos.X();
+ aMouseOff.Y() = rRect.Top() - rPos.Y();
+
+ if ( (rPos.X() < rRect.Left()) || (rPos.X() > rRect.Right()) )
+ {
+ rRect.SetPos( rPos );
+ rRect.Move( -5, aMouseOff.Y() );
+ }
+ if ( (rPos.Y() < rRect.Top()) || (rPos.Y() > rRect.Bottom()) )
+ {
+ rRect.SetPos( rPos );
+ rRect.Move( aMouseOff.X(), -5 );
+ }
+ }
+
+ mbLastFloatMode = bFloatMode;
+
+ return bFloatMode;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::EndDocking( const Rectangle& rRect, BOOL bFloatMode )
+{
+ if ( !IsDockingCanceled() )
+ {
+ if ( mnLines != mnDockLines )
+ SetLineCount( mnDockLines );
+ if ( meAlign != meDockAlign )
+ SetAlign( meDockAlign );
+ }
+
+ if ( bFloatMode || (bFloatMode != IsFloatingMode()) )
+ DockingWindow::EndDocking( rRect, bFloatMode );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Resizing( Size& rSize )
+{
+ USHORT nCalcLines;
+ USHORT nTemp;
+
+ // Alle Floatinggroessen berechnen
+ ImplCalcFloatSizes( this );
+
+ if ( !mnLastResizeDY )
+ mnLastResizeDY = mnDY;
+
+ // Ist vertikales Resizing angesagt
+ if ( (mnLastResizeDY != rSize.Height()) && (mnDY != rSize.Height()) )
+ {
+ nCalcLines = ImplCalcLines( this, rSize.Height() );
+ if ( nCalcLines < 1 )
+ nCalcLines = 1;
+ rSize = ImplCalcFloatSize( this, nCalcLines );
+ }
+ else
+ {
+ nCalcLines = 1;
+ nTemp = nCalcLines;
+ Size aTempSize = ImplCalcFloatSize( this, nTemp );
+ while ( (aTempSize.Width() > rSize.Width()) &&
+ (nCalcLines <= mpFloatSizeAry[0].mnLines) )
+ {
+ nCalcLines++;
+ nTemp = nCalcLines;
+ aTempSize = ImplCalcFloatSize( this, nTemp );
+ }
+ rSize = aTempSize;
+ }
+
+ mnLastResizeDY = rSize.Height();
+}
+
+// -----------------------------------------------------------------------
+
+Size ToolBox::CalcWindowSizePixel( USHORT nCalcLines ) const
+{
+ return ImplCalcSize( this, nCalcLines );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::EnableCustomize( BOOL bEnable )
+{
+ if ( bEnable != mbCustomize )
+ {
+ mbCustomize = bEnable;
+
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ if ( bEnable )
+ pMgr->Insert( this );
+ else
+ pMgr->Remove( this );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::StartCustomize( const Rectangle& rRect, void* pData )
+{
+ DBG_ASSERT( mbCustomize,
+ "ToolBox::StartCustomize(): ToolBox must be customized" );
+
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ Point aMousePos = GetPointerPosPixel();
+ Point aPos = ScreenToOutputPixel( rRect.TopLeft() );
+ Rectangle aRect( aPos.X(), aPos.Y(),
+ aPos.X()+rRect.GetWidth()+SMALLBUTTON_HSIZE,
+ aPos.Y()+rRect.GetHeight()+SMALLBUTTON_VSIZE );
+ aMousePos = ScreenToOutputPixel( aPos );
+ Pointer aPtr;
+ SetPointer( aPtr );
+ pMgr->StartDragging( this, aMousePos, aRect, 0, FALSE, pData );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::StartCustomizeMode()
+{
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ pMgr->StartCustomizeMode();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::EndCustomizeMode()
+{
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ pMgr->EndCustomizeMode();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::IsCustomizeMode()
+{
+ ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
+ return pMgr->IsCustomizeMode();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::GetAccessObject( AccessObjectRef& rAcc ) const
+{
+ rAcc = new AccessObject( (void*) this, ACCESS_TYPE_TOOLBOX );
+}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
new file mode 100644
index 000000000000..c55da3f278ad
--- /dev/null
+++ b/vcl/source/window/toolbox2.cxx
@@ -0,0 +1,1401 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolbox2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_TOOLBOX_CXX
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#define private public
+#ifndef _SV_TOOLBOX_HXX
+#include <toolbox.hxx>
+#endif
+#undef private
+#ifndef _SV_TOOLBOX_H
+#include <toolbox.h>
+#endif
+
+// =======================================================================
+
+#define TB_SEP_SIZE 8
+
+// -----------------------------------------------------------------------
+
+ImplToolItem::ImplToolItem()
+{
+ mnId = 0;
+ mpWindow = NULL;
+ mpUserData = NULL;
+ mnHelpId = 0;
+ meType = TOOLBOXITEM_BUTTON;
+ mnBits = 0;
+ meState = STATE_NOCHECK;
+ mbEnabled = TRUE;
+ mbVisible = TRUE;
+ mbEmptyBtn = TRUE;
+ mbShowWindow = FALSE;
+ mbBreak = FALSE;
+ mnNonStdSize = 0;
+ mnSepSize = TB_SEP_SIZE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage,
+ ToolBoxItemBits nItemBits ) :
+ maImage( rImage )
+{
+ mnId = nItemId;
+ mpWindow = NULL;
+ mpUserData = NULL;
+ mnHelpId = 0;
+ meType = TOOLBOXITEM_BUTTON;
+ mnBits = nItemBits;
+ meState = STATE_NOCHECK;
+ mbEnabled = TRUE;
+ mbVisible = TRUE;
+ mbEmptyBtn = FALSE;
+ mbShowWindow = FALSE;
+ mbBreak = FALSE;
+ mnNonStdSize = 0;
+ mnSepSize = TB_SEP_SIZE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplToolItem::ImplToolItem( USHORT nItemId, const XubString& rText,
+ ToolBoxItemBits nItemBits ) :
+ maText( rText )
+{
+ mnId = nItemId;
+ mpWindow = NULL;
+ mpUserData = NULL;
+ mnHelpId = 0;
+ meType = TOOLBOXITEM_BUTTON;
+ mnBits = nItemBits;
+ meState = STATE_NOCHECK;
+ mbEnabled = TRUE;
+ mbVisible = TRUE;
+ mbEmptyBtn = FALSE;
+ mbShowWindow = FALSE;
+ mbBreak = FALSE;
+ mnNonStdSize = 0;
+ mnSepSize = TB_SEP_SIZE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage,
+ const XubString& rText, ToolBoxItemBits nItemBits ) :
+ maImage( rImage ),
+ maText( rText )
+{
+ mnId = nItemId;
+ mpWindow = NULL;
+ mpUserData = NULL;
+ mnHelpId = 0;
+ meType = TOOLBOXITEM_BUTTON;
+ mnBits = nItemBits;
+ meState = STATE_NOCHECK;
+ mbEnabled = TRUE;
+ mbVisible = TRUE;
+ mbEmptyBtn = FALSE;
+ mbShowWindow = FALSE;
+ mbBreak = FALSE;
+ mnNonStdSize = 0;
+ mnSepSize = TB_SEP_SIZE;
+}
+
+// -----------------------------------------------------------------------
+
+ImplToolItem::~ImplToolItem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& ToolBox::ImplConvertMenuString( const XubString& rStr )
+{
+ if ( mbMenuStrings )
+ {
+ maCvtStr = rStr;
+ maCvtStr.EraseTrailingChars( '.' );
+ maCvtStr.EraseAllChars( '~' );
+ return maCvtStr;
+ }
+ else
+ return rStr;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplInvalidate( BOOL bNewCalc, BOOL bFullPaint )
+{
+ if ( bNewCalc )
+ mbCalc = TRUE;
+
+ if ( bFullPaint )
+ {
+ mbFormat = TRUE;
+
+ // Muss ueberhaupt eine neue Ausgabe erfolgen
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ Invalidate( Rectangle( mnLeftBorder, mnTopBorder,
+ mnDX-mnRightBorder-1, mnDY-mnBottomBorder-1 ) );
+ maTimer.Stop();
+ }
+ }
+ else
+ {
+ if ( !mbFormat )
+ {
+ mbFormat = TRUE;
+
+ // Muss ueberhaupt eine neue Ausgabe erfolgen
+ if ( IsReallyVisible() && IsUpdateMode() )
+ maTimer.Start();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ImplUpdateItem( USHORT nIndex )
+{
+ // Muss ueberhaupt eine neue Ausgabe erfolgen
+ if ( IsReallyVisible() && IsUpdateMode() )
+ {
+ if ( nIndex == 0xFFFF )
+ {
+ // Nur direkt neu ausgeben, wenn nicht neu formatiert
+ // werden muss
+ if ( !mbFormat )
+ {
+ USHORT nItemCount = (USHORT)mpItemList->Count();
+ for ( USHORT i = 0; i < nItemCount; i++ )
+ ImplDrawItem( i, (i == mnCurPos) ? TRUE : FALSE );
+ }
+ else
+ {
+ Invalidate( Rectangle( mnLeftBorder, mnTopBorder,
+ mnDX-mnRightBorder-1, mnDY-mnBottomBorder-1 ) );
+ }
+ }
+ else
+ {
+ // Nur direkt neu ausgeben, wenn nicht neu formatiert
+ // werden muss
+ if ( !mbFormat )
+ ImplDrawItem( nIndex, (nIndex == mnCurPos) ? TRUE : FALSE );
+ else
+ maPaintRect.Union( mpItemList->GetObject( nIndex )->maRect );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Click()
+{
+ maClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::DoubleClick()
+{
+ maDoubleClickHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Activate()
+{
+ maActivateHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Deactivate()
+{
+ maDeactivateHdl.Call( this );
+
+ if ( mbHideStatusText )
+ {
+ GetpApp()->HideHelpStatusText();
+ mbHideStatusText = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Highlight()
+{
+ maHighlightHdl.Call( this );
+
+ XubString aStr = GetHelpText( mnCurItemId );
+ if ( aStr.Len() || mbHideStatusText )
+ {
+ GetpApp()->ShowHelpStatusText( aStr );
+ mbHideStatusText = TRUE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Select()
+{
+ maSelectHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::NextToolBox()
+{
+ maNextToolBoxHdl.Call( this );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Customize( const ToolBoxCustomizeEvent& )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::UserDraw( const UserDrawEvent& rUDEvt )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertItem( const ResId& rResId, USHORT nPos )
+{
+ USHORT nObjMask;
+ BOOL bImage = FALSE; // Wurde Image gesetzt
+
+ // Item anlegen
+ ImplToolItem* pItem = new ImplToolItem;
+
+ GetRes( rResId.SetRT( RSC_TOOLBOXITEM ) );
+ nObjMask = ReadShortRes();
+
+ if ( nObjMask & RSC_TOOLBOXITEM_ID )
+ pItem->mnId = ReadShortRes();
+ else
+ pItem->mnId = 1;
+
+ if ( nObjMask & RSC_TOOLBOXITEM_TYPE )
+ pItem->meType = (ToolBoxItemType)ReadShortRes();
+
+ if ( nObjMask & RSC_TOOLBOXITEM_STATUS )
+ pItem->mnBits = (ToolBoxItemBits)ReadShortRes();
+
+ if( nObjMask & RSC_TOOLBOXITEM_HELPID )
+ pItem->mnHelpId = ReadLongRes();
+
+ if ( nObjMask & RSC_TOOLBOXITEM_TEXT )
+ {
+ pItem->maText = ReadStringRes();
+ pItem->maText = ImplConvertMenuString( pItem->maText );
+ }
+ if ( nObjMask & RSC_TOOLBOXITEM_HELPTEXT )
+ pItem->maHelpText = ReadStringRes();
+
+/*
+#ifndef WIN
+ static
+#endif
+ short nHelpMode = -1;
+ if( nHelpMode == -1 ) {
+ SvHelpSettings aHelpSettings;
+
+ GetpApp()->Property( aHelpSettings );
+ nHelpMode = aHelpSettings.nHelpMode;
+ }
+
+ if( (nHelpMode & HELPTEXTMODE_EXTERN) && pItem->aHelpText.Len() )
+ pItem->aHelpText.Erase();
+ if( (nHelpMode & HELPTEXTMODE_DEBUG) && !pItem->nHelpId )
+ pItem->aHelpText = "??? !pItem->nHelpId MP/W.P. ???";
+*/
+
+ if ( nObjMask & RSC_TOOLBOXITEM_BITMAP )
+ {
+ Bitmap aBmp = Bitmap( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ pItem->maImage = Image( aBmp, IMAGE_STDBTN_COLOR );
+ bImage = TRUE;
+ }
+ if ( nObjMask & RSC_TOOLBOXITEM_IMAGE )
+ {
+ pItem->maImage = Image( ResId( (RSHEADER_TYPE*)GetClassRes() ) );
+ IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) );
+ bImage = TRUE;
+ }
+ if ( nObjMask & RSC_TOOLBOXITEM_DISABLE )
+ pItem->mbEnabled = !(BOOL)ReadShortRes();
+
+ if ( nObjMask & RSC_TOOLBOXITEM_STATE )
+ pItem->meState = (TriState)ReadShortRes();
+
+ if ( nObjMask & RSC_TOOLBOXITEM_HIDE )
+ pItem->mbVisible = !((BOOL)ReadShortRes());
+
+ if ( nObjMask & RSC_TOOLBOXITEM_COMMAND )
+ pItem->maCommandStr = ReadStringRes();
+
+ // Wenn kein Image geladen wurde, versuchen wir das Image aus der
+ // Image-Liste zu holen
+ if ( !bImage && pItem->mnId )
+ pItem->maImage = maImageList.GetImage( pItem->mnId );
+
+ // Wenn es sich um ein ButtonItem handelt, die ID ueberpruefen
+ BOOL bNewCalc;
+ if ( pItem->meType != TOOLBOXITEM_BUTTON )
+ {
+ bNewCalc = FALSE;
+ pItem->mnId = 0;
+ }
+ else
+ {
+ bNewCalc = TRUE;
+
+ DBG_ASSERT( pItem->mnId, "ToolBox::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( pItem->mnId ) == TOOLBOX_ITEM_NOTFOUND,
+ "ToolBox::InsertItem(): ItemId already exists" );
+ }
+
+ // Item anlegen und in die Liste einfuegen
+ mpItemList->Insert( pItem, nPos );
+
+ // ToolBox neu brechnen und neu ausgeben
+ ImplInvalidate( bNewCalc );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertItem( USHORT nItemId, const Image& rImage,
+ ToolBoxItemBits nBits, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND,
+ "ToolBox::InsertItem(): ItemId already exists" );
+
+ // Item anlegen und in die Liste einfuegen
+ mpItemList->Insert( new ImplToolItem( nItemId, rImage, nBits ), nPos );
+
+ ImplInvalidate( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertItem( USHORT nItemId, const Image& rImage,
+ const XubString& rText,
+ ToolBoxItemBits nBits, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND,
+ "ToolBox::InsertItem(): ItemId already exists" );
+
+ // Item anlegen und in die Liste einfuegen
+ mpItemList->Insert( new ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ), nPos );
+
+ ImplInvalidate( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertItem( USHORT nItemId, const XubString& rText,
+ ToolBoxItemBits nBits, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND,
+ "ToolBox::InsertItem(): ItemId already exists" );
+
+ // Item anlegen und in die Liste einfuegen
+ mpItemList->Insert( new ImplToolItem( nItemId, ImplConvertMenuString( rText ), nBits ), nPos );
+
+ ImplInvalidate( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertWindow( USHORT nItemId, Window* pWindow,
+ ToolBoxItemBits nBits, USHORT nPos )
+{
+ DBG_ASSERT( nItemId, "ToolBox::InsertWindow(): ItemId == 0" );
+ DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND,
+ "ToolBox::InsertWindow(): ItemId already exists" );
+
+ // Item anlegen und in die Liste einfuegen
+ ImplToolItem* pItem = new ImplToolItem;
+ pItem->mnId = nItemId;
+ pItem->meType = TOOLBOXITEM_BUTTON;
+ pItem->mnBits = nBits;
+ pItem->mpWindow = pWindow;
+ mpItemList->Insert( pItem, nPos );
+
+ if ( pWindow )
+ pWindow->Hide();
+
+ ImplInvalidate( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertSpace( USHORT nPos )
+{
+ // Item anlegen und in die Liste einfuegen
+ ImplToolItem* pItem = new ImplToolItem;
+ pItem->meType = TOOLBOXITEM_SPACE;
+ pItem->mbEnabled = FALSE;
+ mpItemList->Insert( pItem, nPos );
+
+ ImplInvalidate( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertSeparator( USHORT nPos, USHORT nPixSize )
+{
+ // Item anlegen und in die Liste einfuegen
+ ImplToolItem* pItem = new ImplToolItem;
+ pItem->meType = TOOLBOXITEM_SEPARATOR;
+ pItem->mbEnabled = FALSE;
+ if ( nPixSize )
+ pItem->mnSepSize = nPixSize;
+ mpItemList->Insert( pItem, nPos );
+
+ ImplInvalidate( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::InsertBreak( USHORT nPos )
+{
+ // Item anlegen und in die Liste einfuegen
+ ImplToolItem* pItem = new ImplToolItem;
+ pItem->meType = TOOLBOXITEM_BREAK;
+ pItem->mbEnabled = FALSE;
+ mpItemList->Insert( pItem, nPos );
+
+ ImplInvalidate( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::RemoveItem( USHORT nPos )
+{
+ ImplToolItem* pItem = mpItemList->Remove( nPos );
+
+ // Item entfernen
+ if ( pItem )
+ {
+ BOOL bMustCalc;
+ if ( pItem->meType == TOOLBOXITEM_BUTTON )
+ bMustCalc = TRUE;
+ else
+ bMustCalc = FALSE;
+
+ if ( pItem->mpWindow )
+ pItem->mpWindow->Hide();
+
+ // PaintRect um das removete Item erweitern
+ maPaintRect.Union( pItem->maRect );
+
+ // Absichern gegen das Loeschen im Select-Handler
+ if ( pItem->mnId == mnCurItemId )
+ mnCurItemId = 0;
+ if ( pItem->mnId == mnHighItemId )
+ mnHighItemId = 0;
+
+ ImplInvalidate( bMustCalc );
+
+ delete pItem;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::MoveItem( USHORT nItemId, USHORT nNewPos )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos < nNewPos )
+ nNewPos--;
+
+ if ( nPos == nNewPos )
+ return;
+
+ // Existiert Item
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ // ToolBox-Item in der Liste verschieben
+ ImplToolItem* pItem = mpItemList->Remove( nPos );
+ mpItemList->Insert( pItem, nNewPos );
+
+ // ToolBox neu ausgeben
+ ImplInvalidate( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::CopyItem( const ToolBox& rToolBox, USHORT nItemId,
+ USHORT nNewPos )
+{
+ DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND,
+ "ToolBox::CopyItem(): ItemId already exists" );
+
+ USHORT nPos = rToolBox.GetItemPos( nItemId );
+
+ // Existiert Item
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ // ToolBox-Item in der Liste verschieben
+ ImplToolItem* pItem = rToolBox.mpItemList->GetObject( nPos );
+ ImplToolItem* pNewItem = new ImplToolItem( *pItem );
+ mpItemList->Insert( pNewItem, nNewPos );
+ // Bestimme Daten zuruecksetzen
+ pNewItem->mpWindow = NULL;
+ pNewItem->mbShowWindow = FALSE;
+
+ // ToolBox neu ausgeben
+ ImplInvalidate( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::CopyItems( const ToolBox& rToolBox )
+{
+ ImplToolItem* pItem;
+
+ // Alle Items entfernen
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Items aus der Liste loeschen
+ mpItemList->Clear();
+
+ // Absichern gegen das Loeschen im Select-Handler
+ mnCurItemId = 0;
+ mnHighItemId = 0;
+
+ // Items kopieren
+ ULONG i = 0;
+ pItem = rToolBox.mpItemList->GetObject( i );
+ while ( pItem )
+ {
+ ImplToolItem* pNewItem = new ImplToolItem( *pItem );
+ mpItemList->Insert( pNewItem, LIST_APPEND );
+ // Bestimme Daten zuruecksetzen
+ pNewItem->mpWindow = NULL;
+ pNewItem->mbShowWindow = FALSE;
+ i++;
+ pItem = rToolBox.mpItemList->GetObject( i );
+ }
+
+ ImplInvalidate( TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::Clear()
+{
+ ImplToolItem* pItem;
+
+ // Alle Item loeschen
+ pItem = mpItemList->First();
+ while ( pItem )
+ {
+ delete pItem;
+ pItem = mpItemList->Next();
+ }
+
+ // Items aus der Liste loeschen
+ mpItemList->Clear();
+
+ // Absichern gegen das Loeschen im Select-Handler
+ mnCurItemId = 0;
+ mnHighItemId = 0;
+
+ ImplInvalidate( TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetButtonType( ButtonType eNewType )
+{
+ if ( meButtonType != eNewType )
+ {
+ meButtonType = eNewType;
+
+ // Hier besser alles neu ausgeben, da es ansonsten zu Problemen
+ // mit den per CopyBits kopierten Bereichen geben kann
+ ImplInvalidate( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetAlign( WindowAlign eNewAlign )
+{
+ if ( meAlign != eNewAlign )
+ {
+ meAlign = eNewAlign;
+
+ if ( !IsFloatingMode() )
+ {
+ // Setzen, ob Items horizontal oder vertikal angeordnet werden sollen
+ if ( (eNewAlign == WINDOWALIGN_LEFT) || (eNewAlign == WINDOWALIGN_RIGHT) )
+ mbHorz = FALSE;
+ else
+ mbHorz = TRUE;
+
+ // Hier alles neu ausgeben, da sich Border auch aendert
+ mbCalc = TRUE;
+ mbFormat = TRUE;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetLineCount( USHORT nNewLines )
+{
+ if ( !nNewLines )
+ nNewLines = 1;
+
+ if ( mnLines != nNewLines )
+ {
+ mnLines = nNewLines;
+
+ // Hier besser alles neu ausgeben, da es ansonsten zu Problemen
+ // mit den per CopyBits kopierten Bereichen geben kann
+ ImplInvalidate( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetNextToolBox( const XubString& rStr )
+{
+ BOOL bCalcNew = (!maNextToolBoxStr.Len() != !rStr.Len());
+ maNextToolBoxStr = rStr;
+ if ( bCalcNew )
+ ImplInvalidate( TRUE, FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ToolBox::GetItemCount() const
+{
+ return (USHORT)mpItemList->Count();
+}
+
+// -----------------------------------------------------------------------
+
+ToolBoxItemType ToolBox::GetItemType( USHORT nPos ) const
+{
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem )
+ return pItem->meType;
+ else
+ return TOOLBOXITEM_DONTKNOW;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ToolBox::GetItemPos( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ if ( pItem->mnId == nItemId )
+ return (USHORT)mpItemList->GetCurPos();
+
+ pItem = mpItemList->Next();
+ }
+
+ return TOOLBOX_ITEM_NOTFOUND;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ToolBox::GetItemId( USHORT nPos ) const
+{
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem )
+ return pItem->mnId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT ToolBox::GetItemId( const Point& rPos ) const
+{
+ // Item suchen, das geklickt wurde
+ ImplToolItem* pItem = mpItemList->First();
+ while ( pItem )
+ {
+ // Ist es dieses Item
+ if ( pItem->maRect.IsInside( rPos ) )
+ {
+ if ( pItem->meType == TOOLBOXITEM_BUTTON )
+ return pItem->mnId;
+ else
+ return 0;
+ }
+
+ pItem = mpItemList->Next();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+Rectangle ToolBox::GetItemRect( USHORT nItemId ) const
+{
+ if ( mbCalc || mbFormat )
+ ((ToolBox*)this)->ImplFormat();
+
+ USHORT nPos = GetItemPos( nItemId );
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ return mpItemList->GetObject( nPos )->maRect;
+ else
+ return Rectangle();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemBits( USHORT nItemId, ToolBoxItemBits nBits )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ ToolBoxItemBits nOldBits = pItem->mnBits;
+ pItem->mnBits = nBits;
+ nBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN;
+ nOldBits &= TIB_LEFT | TIB_AUTOSIZE | TIB_DROPDOWN;
+ if ( nBits != nOldBits )
+ ImplInvalidate( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ToolBoxItemBits ToolBox::GetItemBits( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->mnBits;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemData( USHORT nItemId, void* pNewData )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ pItem->mpUserData = pNewData;
+ ImplUpdateItem( nPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void* ToolBox::GetItemData( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->mpUserData;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemImage( USHORT nItemId, const Image& rImage )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ // Nur wenn alles berechnet ist, mehr Aufwand treiben
+ if ( !mbCalc )
+ {
+ Size aOldSize = pItem->maImage.GetSizePixel();
+ pItem->maImage = rImage;
+ if ( aOldSize != pItem->maImage.GetSizePixel() )
+ ImplInvalidate( TRUE );
+ else
+ ImplUpdateItem( nPos );
+ }
+ else
+ pItem->maImage = rImage;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image ToolBox::GetItemImage( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->maImage;
+ else
+ return Image();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemHighImage( USHORT nItemId, const Image& rImage )
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+ if ( pItem )
+ {
+ DBG_ASSERT( (pItem->maImage.GetSizePixel() == rImage.GetSizePixel()) ||
+ ((!rImage) == TRUE), "ToolBox::SetItemHighImage() - ImageSize != HighImageSize" );
+ pItem->maHighImage = rImage;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Image ToolBox::GetItemHighImage( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->maHighImage;
+ else
+ return Image();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemText( USHORT nItemId, const XubString& rText )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ // Nur wenn alles berechnet ist, mehr Aufwand treiben
+ if ( !mbCalc &&
+ ((meButtonType != BUTTON_SYMBOL) || !pItem->maImage) )
+ {
+ long nOldWidth = GetCtrlTextWidth( pItem->maText );
+ pItem->maText = ImplConvertMenuString( rText );
+ if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) )
+ ImplInvalidate( TRUE );
+ else
+ ImplUpdateItem( nPos );
+ }
+ else
+ pItem->maText = ImplConvertMenuString( rText );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& ToolBox::GetItemText( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->maText;
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemWindow( USHORT nItemId, Window* pNewWindow )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ pItem->mpWindow = pNewWindow;
+ if ( pNewWindow )
+ pNewWindow->Hide();
+ ImplInvalidate( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Window* ToolBox::GetItemWindow( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->mpWindow;
+ else
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::StartSelection()
+{
+ if ( mbDrag )
+ EndSelection();
+
+ if ( !mbSelection )
+ {
+ mbSelection = TRUE;
+ mnCurPos = TOOLBOX_ITEM_NOTFOUND;
+ mnCurItemId = 0;
+ Activate();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::EndSelection()
+{
+ mbCommandDrag = FALSE;
+
+ if ( mbDrag || mbSelection )
+ {
+ // Daten zuruecksetzen
+ mbDrag = FALSE;
+ mbSelection = FALSE;
+ if ( mnCurPos != TOOLBOX_ITEM_NOTFOUND )
+ ImplDrawItem( mnCurPos );
+ EndTracking();
+ ReleaseMouse();
+ Deactivate();
+ }
+
+ mnCurPos = TOOLBOX_ITEM_NOTFOUND;
+ mnCurItemId = 0;
+ mnDownItemId = 0;
+ mnMouseClicks = 0;
+ mnMouseModifier = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemDown( USHORT nItemId, BOOL bDown, BOOL bRelease )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ if ( bDown )
+ {
+ if ( nPos != mnCurPos )
+ {
+ mnCurPos = nPos;
+ ImplDrawItem( mnCurPos );
+ }
+ }
+ else
+ {
+ if ( nPos == mnCurPos )
+ {
+ ImplDrawItem( mnCurPos );
+ mnCurPos = TOOLBOX_ITEM_NOTFOUND;
+ }
+ }
+
+ if ( bRelease )
+ {
+ if ( mbDrag || mbSelection )
+ {
+ mbDrag = FALSE;
+ mbSelection = FALSE;
+ EndTracking();
+ ReleaseMouse();
+ Deactivate();
+ }
+
+ mnCurItemId = 0;
+ mnDownItemId = 0;
+ mnMouseClicks = 0;
+ mnMouseModifier = 0;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::IsItemDown( USHORT nItemId ) const
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ return (nPos == mnCurPos);
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemState( USHORT nItemId, TriState eState )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+
+ // Hat sich der Status geaendert
+ if ( pItem->meState != eState )
+ {
+ // Wenn RadioCheck, dann vorherigen unchecken
+ if ( (eState == STATE_CHECK) && (pItem->mnBits & TIB_AUTOCHECK) &&
+ (pItem->mnBits & TIB_RADIOCHECK) )
+ {
+ ImplToolItem* pGroupItem;
+ USHORT nGroupPos;
+ USHORT nItemCount = GetItemCount();
+
+ nGroupPos = nPos;
+ while ( nGroupPos )
+ {
+ pGroupItem = mpItemList->GetObject( nGroupPos-1 );
+ if ( pGroupItem->mnBits & TIB_RADIOCHECK )
+ {
+ if ( pGroupItem->meState != STATE_NOCHECK )
+ SetItemState( pGroupItem->mnId, STATE_NOCHECK );
+ }
+ else
+ break;
+ nGroupPos--;
+ }
+
+ nGroupPos = nPos+1;
+ while ( nGroupPos < nItemCount )
+ {
+ pGroupItem = mpItemList->GetObject( nGroupPos );
+ if ( pGroupItem->mnBits & TIB_RADIOCHECK )
+ {
+ if ( pGroupItem->meState != STATE_NOCHECK )
+ SetItemState( pGroupItem->mnId, STATE_NOCHECK );
+ }
+ else
+ break;
+ nGroupPos++;
+ }
+ }
+
+ pItem->meState = eState;
+ ImplUpdateItem( nPos );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+TriState ToolBox::GetItemState( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->meState;
+ else
+ return STATE_NOCHECK;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::EnableItem( USHORT nItemId, BOOL bEnable )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ if ( bEnable )
+ bEnable = TRUE;
+ if ( pItem->mbEnabled != bEnable )
+ {
+ pItem->mbEnabled = bEnable;
+
+ // Gegebenenfalls das Fenster mit updaten
+ if ( pItem->mpWindow )
+ pItem->mpWindow->Enable( pItem->mbEnabled );
+
+ // Item updaten
+ ImplUpdateItem( nPos );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::IsItemEnabled( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->mbEnabled;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::ShowItem( USHORT nItemId, BOOL bVisible )
+{
+ USHORT nPos = GetItemPos( nItemId );
+
+ if ( nPos != TOOLBOX_ITEM_NOTFOUND )
+ {
+ ImplToolItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem->mbVisible != bVisible )
+ {
+ pItem->mbVisible = bVisible;
+ ImplInvalidate( FALSE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ToolBox::IsItemVisible( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->mbVisible;
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetItemCommand( USHORT nItemId, const XubString& rCommand )
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ pItem->maCommandStr = rCommand;
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& ToolBox::GetItemCommand( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->maCommandStr;
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetQuickHelpText( USHORT nItemId, const XubString& rText )
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ pItem->maQuickHelpText = rText;
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& ToolBox::GetQuickHelpText( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->maQuickHelpText;
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetHelpText( USHORT nItemId, const XubString& rText )
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ pItem->maHelpText = rText;
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& ToolBox::GetHelpText( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ {
+ if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
+ {
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId );
+ }
+
+ return pItem->maHelpText;
+ }
+ else
+ return ImplGetSVEmptyStr();
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetHelpId( USHORT nItemId, ULONG nHelpId )
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ pItem->mnHelpId = nHelpId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG ToolBox::GetHelpId( USHORT nItemId ) const
+{
+ ImplToolItem* pItem = ImplGetItem( nItemId );
+
+ if ( pItem )
+ return pItem->mnHelpId;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetBorder( long nX, long nY )
+{
+ mnBorderX = nX;
+ mnBorderY = nY;
+
+ ImplInvalidate( TRUE, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::SetOutStyle( USHORT nNewStyle )
+{
+ if ( mnOutStyle != nNewStyle )
+ {
+ mnOutStyle = nNewStyle;
+
+ // Damit das ButtonDevice neu angelegt wird
+ if ( !(mnOutStyle & TOOLBOX_STYLE_FLAT) )
+ {
+ mnItemWidth = 1;
+ mnItemHeight = 1;
+ }
+
+ ImplInvalidate( TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ToolBox::RecalcItems()
+{
+ ImplInvalidate( TRUE );
+}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
new file mode 100644
index 000000000000..af07c5df38c1
--- /dev/null
+++ b/vcl/source/window/window.cxx
@@ -0,0 +1,6539 @@
+/*************************************************************************
+ *
+ * $RCSfile: window.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_WINDOW_CXX
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGTYPE_HXX
+#include <salgtype.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_WINDATA_HXX
+#include <windata.hxx>
+#endif
+#ifndef _SV_DBGGUI_HXX
+#include <dbggui.hxx>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_REGION_H
+#include <region.h>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_CURSOR_HXX
+#include <cursor.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_SYSWIN_HXX
+#include <syswin.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#ifndef _SV_HELPWIN_HXX
+#include <helpwin.hxx>
+#endif
+#ifndef _SV_MENU_HXX
+#include <menu.hxx>
+#endif
+#ifndef _SV_DRAG_HXX
+#include <drag.hxx>
+#endif
+
+#define SYSDATA_ONLY_BASETYPE
+#include <sysdata.hxx>
+
+#include <com/sun/star/awt/XWindowPeer.hpp>
+
+#ifdef REMOTE_APPSERVER
+#include "rmwindow.hxx"
+#include "xevthdl.hxx"
+#include "rmevents.hxx"
+#include "rmoutdev.hxx"
+#endif
+
+#include <unowrap.hxx>
+
+#pragma hdrstop
+
+// =======================================================================
+
+DBG_NAME( Window );
+
+// =======================================================================
+
+#define IMPL_PAINT_PAINT ((USHORT)0x0001)
+#define IMPL_PAINT_PAINTALL ((USHORT)0x0002)
+#define IMPL_PAINT_PAINTALLCHILDS ((USHORT)0x0004)
+#define IMPL_PAINT_PAINTCHILDS ((USHORT)0x0008)
+#define IMPL_PAINT_ERASE ((USHORT)0x0010)
+
+// -----------------------------------------------------------------------
+
+typedef Window* PWINDOW;
+
+// -----------------------------------------------------------------------
+
+struct ImplCalcToTopData
+{
+ ImplCalcToTopData* mpNext;
+ Window* mpWindow;
+ Region* mpInvalidateRegion;
+};
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+const char* ImplDbgCheckWindow( const void* pObj )
+{
+ DBG_TESTSOLARMUTEX();
+
+ const Window* pWindow = (Window*)pObj;
+
+ if ( (pWindow->GetType() < WINDOW_FIRST) || (pWindow->GetType() > WINDOW_LAST) )
+ return "Window data overwrite";
+
+ // Fenster-Verkettung ueberpruefen
+ Window* pChild = pWindow->mpFirstChild;
+ while ( pChild )
+ {
+ if ( pChild->mpParent != pWindow )
+ return "Child-Window-Parent wrong";
+ pChild = pChild->mpNext;
+ }
+
+ return NULL;
+}
+#endif
+
+// =======================================================================
+
+static void ImplInitAppFontData( Window* pWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ long nTextHeight = pWindow->GetTextHeight();
+ long nTextWidth = pWindow->GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "aemnnxEM" ) ) );
+ long nSymHeight = nTextHeight*4;
+ // Falls Font zu schmal ist, machen wir die Basis breiter,
+ // damit die Dialoge symetrisch aussehen und nicht zu schmal
+ // werden. Wenn der Dialog die gleiche breite hat, geben wir
+ // noch etwas Spielraum dazu, da etwas mehr Platz besser ist.
+ if ( nSymHeight > nTextWidth )
+ nTextWidth = nSymHeight;
+ else if ( nSymHeight+5 > nTextWidth )
+ nTextWidth = nSymHeight+5;
+ pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8;
+ pSVData->maGDIData.mnAppFontY = nTextHeight * 10;
+
+ pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX;
+ if ( pSVData->maAppData.mnDialogScaleX )
+ pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100;
+}
+
+// -----------------------------------------------------------------------
+
+MouseEvent ImplTranslateMouseEvent( const MouseEvent& rE, Window* pSource, Window* pDest )
+{
+ Point aPos = pSource->OutputToScreenPixel( rE.GetPosPixel() );
+ aPos = pDest->ScreenToOutputPixel( aPos );
+ return MouseEvent( aPos, rE.GetClicks(), rE.GetMode(), rE.GetButtons(), rE.GetModifier() );
+}
+
+// =======================================================================
+
+void Window::ImplInitData( WindowType nType )
+{
+ meOutDevType = OUTDEV_WINDOW;
+
+ mpWinData = NULL; // Extra Window Data, that we dont need for all windows
+ mpOverlapData = NULL; // Overlap Data
+ mpFrameData = NULL; // Frame Data
+ mpFrame = NULL; // Pointer to frame window
+ mpSysObj = NULL;
+ mpFrameWindow = NULL; // window to top level parent (same as frame window)
+ mpOverlapWindow = NULL; // first overlap parent
+ mpBorderWindow = NULL; // Border-Window
+ mpClientWindow = NULL; // Client-Window of a FrameWindow
+ mpParent = NULL; // parent (inkl. BorderWindow)
+ mpRealParent = NULL; // real parent (exkl. BorderWindow)
+ mpFirstChild = NULL; // first child window
+ mpLastChild = NULL; // last child window
+ mpFirstOverlap = NULL; // first overlap window (only set in overlap windows)
+ mpLastOverlap = NULL; // last overlap window (only set in overlap windows)
+ mpPrev = NULL; // prev window
+ mpNext = NULL; // next window
+ mpNextOverlap = NULL; // next overlap window of frame
+ mpLastFocusWindow = NULL; // window for focus restore
+ mpDlgCtrlDownWindow = NULL; // window for dialog control
+ mpFirstDel = NULL; // Dtor notification list
+ mpUserData = NULL; // user data
+ mpCursor = NULL; // cursor
+ mpControlFont = NULL; // font propertie
+ mpVCLXWindow = NULL;
+ maControlForeground = Color( COL_TRANSPARENT ); // kein Foreground gesetzt
+ maControlBackground = Color( COL_TRANSPARENT ); // kein Background gesetzt
+ mnLeftBorder = 0; // left border
+ mnTopBorder = 0; // top border
+ mnRightBorder = 0; // right border
+ mnBottomBorder = 0; // bottom border
+ mnX = 0; // X-Position to Parent
+ mnY = 0; // Y-Position to Parent
+ mnHelpId = 0; // help id
+ mnUniqId = 0; // unique id
+ mpChildClipRegion = NULL; // Child-Clip-Region when ClipChildren
+ mpPaintRegion = NULL; // Paint-ClipRegion
+ mnStyle = 0; // style (init in ImplInitWindow)
+ mnPrevStyle = 0; // prevstyle (set in SetStyle)
+ mnExtendedStyle = 0; // extended style (init in ImplInitWindow)
+ mnPrevExtendedStyle = 0; // prevstyle (set in SetExtendedStyle)
+ mnType = nType; // type
+ mnGetFocusFlags = 0; // Flags fuer GetFocus()-Aufruf
+ mnWaitCount = 0; // Wait-Count (>1 == Warte-MousePointer)
+ mnPaintFlags = 0; // Flags for ImplCallPaint
+ mnParentClipMode = 0; // Flags for Parent-ClipChildren-Mode
+ mnActivateMode = 0; // Wird bei System/Overlap-Windows umgesetzt
+ mnDlgCtrlFlags = 0; // DialogControl-Flags
+ mbFrame = FALSE; // TRUE: Window is a frame window
+ mbBorderWin = FALSE; // TRUE: Window is a border window
+ mbOverlapWin = FALSE; // TRUE: Window is a overlap window
+ mbSysWin = FALSE; // TRUE: SystemWindow is the base class
+ mbDialog = FALSE; // TRUE: Dialog is the base class
+ mbDockWin = FALSE; // TRUE: DockingWindow is the base class
+ mbFloatWin = FALSE; // TRUE: FloatingWindow is the base class
+ mbPushButton = FALSE; // TRUE: PushButton is the base class
+ mbVisible = FALSE; // TRUE: Show( TRUE ) called
+ mbOverlapVisible = FALSE; // TRUE: Hide called for visible window from ImplHideAllOverlapWindow()
+ mbDisabled = FALSE; // TRUE: Enable( FALSE ) called
+ mbInputDisabled = FALSE; // TRUE: EnableInput( FALSE ) called
+ mbAlwaysEnableInput = FALSE; // TRUE: AlwaysEnableInput( TRUE ) called
+ mbDropDisabled = FALSE; // TRUE: Drop is enabled
+ mbNoUpdate = FALSE; // TRUE: SetUpdateMode( FALSE ) called
+ mbNoParentUpdate = FALSE; // TRUE: SetParentUpdateMode( FALSE ) called
+ mbActive = FALSE; // TRUE: Window Active
+ mbParentActive = FALSE; // TRUE: OverlapActive from Parent
+ mbReallyVisible = FALSE; // TRUE: this and all parents to an overlaped window are visible
+ mbReallyShown = FALSE; // TRUE: this and all parents to an overlaped window are shown
+ mbInInitShow = FALSE; // TRUE: we are in InitShow
+ mbChildNotify = FALSE; // TRUE: ChildNotify
+ mbChildPtrOverwrite = FALSE; // TRUE: PointerStyle overwrites Child-Pointer
+ mbNoPtrVisible = FALSE; // TRUE: ShowPointer( FALSE ) called
+ mbMouseMove = FALSE; // TRUE: BaseMouseMove called
+ mbPaintFrame = FALSE; // TRUE: Paint is visible, but not painted
+ mbInPaint = FALSE; // TRUE: Inside PaintHdl
+ mbMouseButtonDown = FALSE; // TRUE: BaseMouseButtonDown called
+ mbMouseButtonUp = FALSE; // TRUE: BaseMouseButtonUp called
+ mbKeyInput = FALSE; // TRUE: BaseKeyInput called
+ mbKeyUp = FALSE; // TRUE: BaseKeyUp called
+ mbCommand = FALSE; // TRUE: BaseCommand called
+ mbDefPos = TRUE; // TRUE: Position is not Set
+ mbDefSize = TRUE; // TRUE: Size is not Set
+ mbCallMove = TRUE; // TRUE: Move must be called by Show
+ mbCallResize = TRUE; // TRUE: Resize must be called by Show
+ mbWaitSystemResize = TRUE; // TRUE: Wait for System-Resize
+ mbInitWinClipRegion = TRUE; // TRUE: Calc Window Clip Region
+ mbInitChildRegion = FALSE; // TRUE: InitChildClipRegion
+ mbWinRegion = FALSE; // TRUE: Window Region
+ mbClipChildren = FALSE; // TRUE: Child-Fenster muessen evt. geclippt werden
+ mbClipSiblings = FALSE; // TRUE: Nebeneinanderliegende Child-Fenster muessen evt. geclippt werden
+ mbChildTransparent = FALSE; // TRUE: Child-Fenster duerfen transparent einschalten (inkl. Parent-CLIPCHILDREN)
+ mbPaintTransparent = FALSE; // TRUE: Paints muessen auf Parent ausgeloest werden
+ mbMouseTransparent = FALSE; // TRUE: Window is transparent for Mouse
+ mbDlgCtrlStart = FALSE; // TRUE: Ab hier eigenes Dialog-Control
+ mbFocusVisible = FALSE; // TRUE: Focus Visible
+ mbTrackVisible = FALSE; // TRUE: Tracking Visible
+ mbControlForeground = FALSE; // TRUE: Foreground-Property set
+ mbControlBackground = FALSE; // TRUE: Background-Property set
+ mbAlwaysOnTop = FALSE; // TRUE: immer vor allen anderen normalen Fenstern sichtbar
+ mbCompoundControl = FALSE; // TRUE: Zusammengesetztes Control => Listener...
+ mbCompoundControlHasFocus = FALSE; // TRUE: Zusammengesetztes Control hat irgendwo den Focus
+ mbPaintDisabled = FALSE; // TRUE: Paint soll nicht ausgefuehrt werden
+ mbAllResize = FALSE; // TRUE: Auch ResizeEvents mit 0,0 schicken
+ mbInDtor = FALSE; // TRUE: Wir befinden uns im Window-Dtor
+ mbExtTextInput = FALSE; // TRUE: ExtTextInput-Mode is active
+ mbInFocusHdl = FALSE; // TRUE: Innerhalb vom GetFocus-Handler
+ mbCreatedWithToolkit = FALSE;
+
+#ifdef REMOTE_APPSERVER
+ mpRmEvents = NULL;
+
+ Font aFont = maInputContext.GetFont();
+ aFont.SetCharSet( gsl_getSystemTextEncoding() );
+ maInputContext.SetFont( aFont );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef REMOTE_APPSERVER
+void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
+{
+ static ::com::sun::star::uno::Any aVoid;
+ ImplInit( pParent, nStyle, aVoid );
+}
+#else
+void Window::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star::uno::Any& aSystemWorkWindowToken )
+{
+ ImplInit( pParent, nStyle, NULL );
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
+#else
+void Window::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star::uno::Any& aSystemWorkWindowToken )
+#endif
+{
+ DBG_ASSERT( mbFrame || pParent, "Window::Window(): pParent == NULL" );
+
+ ImplSVData* pSVData = ImplGetSVData();
+ Window* pRealParent = pParent;
+
+ // 3D-Look vererben
+ if ( !mbOverlapWin && (pParent->GetStyle() & WB_3DLOOK) )
+ nStyle |= WB_3DLOOK;
+
+ // Wenn wir einen Border haben, muessen wir ein BorderWindow anlegen
+ if ( !mbFrame && !mbBorderWin && !mpBorderWindow && (nStyle & WB_BORDER) )
+ {
+ ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL) );
+ ((Window*)pBorderWin)->mpClientWindow = this;
+ pBorderWin->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ mpBorderWindow = pBorderWin;
+ pParent = mpBorderWindow;
+ }
+
+ // insert window in list
+ ImplInsertWindow( pParent );
+ mnStyle = nStyle;
+
+ // Overlap-Window-Daten
+ if ( mbOverlapWin )
+ {
+ mpOverlapData = new ImplOverlapData;
+ mpOverlapData->mpSaveBackDev = NULL;
+ mpOverlapData->mpSaveBackRgn = NULL;
+ mpOverlapData->mpNextBackWin = NULL;
+ mpOverlapData->mnSaveBackSize = 0;
+ mpOverlapData->mbSaveBack = FALSE;
+ mpOverlapData->mnTopLevel = 1;
+ }
+
+ // test for frame creation
+ if ( mbFrame )
+ {
+ // create frame
+#ifndef REMOTE_APPSERVER
+ ULONG nFrameStyle = 0;
+
+ if ( nStyle & WB_MOVEABLE )
+ nFrameStyle |= SAL_FRAME_STYLE_MOVEABLE;
+ if ( nStyle & WB_SIZEABLE )
+ {
+ nFrameStyle |= SAL_FRAME_STYLE_SIZEABLE |
+ SAL_FRAME_STYLE_MINABLE |
+ SAL_FRAME_STYLE_MAXABLE;
+ }
+ if ( nStyle & WB_CLOSEABLE )
+ nFrameStyle |= SAL_FRAME_STYLE_CLOSEABLE;
+ if ( nStyle & WB_APP )
+ nFrameStyle |= SAL_FRAME_STYLE_DEFAULT;
+
+ SalFrame* pParentFrame = NULL;
+ if ( pParent )
+ pParentFrame = pParent->mpFrame;
+ SalFrame* pFrame;
+ if ( pSystemParentData )
+ pFrame = pSVData->mpDefInst->CreateChildFrame( pSystemParentData, nFrameStyle | SAL_FRAME_STYLE_CHILD );
+ else
+ pFrame = pSVData->mpDefInst->CreateFrame( pParentFrame, nFrameStyle );
+ if ( !pFrame )
+ GetpApp()->Exception( EXC_SYSOBJNOTCREATED );
+ pFrame->SetCallback( this, ImplWindowFrameProc );
+
+ // initialize system-Drag&Drop-interface
+ DragManager::SystemEnableDrop( pFrame, TRUE );
+#else
+ RmFrameWindow* pParentFrame = pParent ? pParent->mpFrame : NULL;;
+ RmFrameWindow* pFrame = new RmFrameWindow( this );
+ if ( !pFrame->IsValid() )
+ {
+ delete pFrame, pFrame = NULL;
+ GetpApp()->Exception( EXC_SYSOBJNOTCREATED );
+ }
+ else
+ {
+ pFrame->Create( nStyle, pFrame->GetEventHdlInterface(),
+ aSystemWorkWindowToken,
+ pParentFrame ? pParentFrame->GetFrameInterface() : REF( NMSP_CLIENT::XRmFrameWindow )() );
+ }
+#endif
+
+ // set window frame data
+ mpFrameData = new ImplFrameData;
+ mpFrame = pFrame;
+ mpFrameWindow = this;
+ mpOverlapWindow = this;
+
+ // set frame data
+ mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame;
+ pSVData->maWinData.mpFirstFrame = this;
+ mpFrameData->mpFirstOverlap = NULL;
+ mpFrameData->mpFocusWin = NULL;
+ mpFrameData->mpMouseMoveWin = NULL;
+ mpFrameData->mpMouseDownWin = NULL;
+ mpFrameData->mpFirstBackWin = NULL;
+ mpFrameData->mpFontList = pSVData->maGDIData.mpScreenFontList;
+ mpFrameData->mpFontCache = pSVData->maGDIData.mpScreenFontCache;
+ mpFrameData->mnAllSaveBackSize = 0;
+ mpFrameData->mnFocusId = 0;
+ mpFrameData->mnMouseMoveId = 0;
+ mpFrameData->mnLastMouseX = -1;
+ mpFrameData->mnLastMouseY = -1;
+ mpFrameData->mnFirstMouseX = -1;
+ mpFrameData->mnFirstMouseY = -1;
+ mpFrameData->mnLastMouseWinX = -1;
+ mpFrameData->mnLastMouseWinY = -1;
+ mpFrameData->mnMouseDownTime = 0;
+ mpFrameData->mnClickCount = 0;
+ mpFrameData->mnFirstMouseCode = 0;
+ mpFrameData->mnMouseCode = 0;
+ mpFrameData->mnMouseMode = 0;
+ mpFrameData->meMapUnit = MAP_PIXEL;
+ mpFrameData->mbHasFocus = FALSE;
+ mpFrameData->mbInMouseMove = FALSE;
+ mpFrameData->mbMouseIn = FALSE;
+ mpFrameData->mbStartDragCalled = FALSE;
+ mpFrameData->mbNeedSysWindow = FALSE;
+ mpFrameData->mbMinimized = FALSE;
+ mpFrameData->mbStartFocusState = FALSE;
+ mpFrameData->mbInSysObjFocusHdl = FALSE;
+ mpFrameData->mbInSysObjToTopHdl = FALSE;
+ mpFrameData->mbSysObjFocus = FALSE;
+
+ mpFrameData->mpDragTimer = NULL;
+ mpFrameData->maPaintTimer.SetTimeout( 30 );
+ mpFrameData->maPaintTimer.SetTimeoutHdl( LINK( this, Window, ImplHandlePaintHdl ) );
+
+#ifndef REMOTE_APPSERVER
+ // Muessen Application-Settings noch upgedatet werden
+ if ( !pSVData->maAppData.mbSettingsInit )
+ {
+ mpFrame->UpdateSettings( *pSVData->maAppData.mpSettings );
+ GetpApp()->SystemSettingsChanging( *pSVData->maAppData.mpSettings, this );
+#ifdef DBG_UTIL
+ // Evt. AppFont auf Fett schalten, damit man feststellen kann,
+ // ob fuer die Texte auf anderen Systemen genuegend Platz
+ // vorhanden ist
+ if ( DbgIsBoldAppFont() )
+ {
+ StyleSettings aStyleSettings = pSVData->maAppData.mpSettings->GetStyleSettings();
+ Font aFont = aStyleSettings.GetAppFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSettings.SetAppFont( aFont );
+ aFont = aStyleSettings.GetGroupFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSettings.SetGroupFont( aFont );
+ aFont = aStyleSettings.GetLabelFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSettings.SetLabelFont( aFont );
+ aFont = aStyleSettings.GetRadioCheckFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSettings.SetRadioCheckFont( aFont );
+ aFont = aStyleSettings.GetPushButtonFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSettings.SetPushButtonFont( aFont );
+ aFont = aStyleSettings.GetFieldFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSettings.SetFieldFont( aFont );
+ aFont = aStyleSettings.GetIconFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ aStyleSettings.SetIconFont( aFont );
+ pSVData->maAppData.mpSettings->SetStyleSettings( aStyleSettings );
+ }
+#endif
+ OutputDevice::SetSettings( *pSVData->maAppData.mpSettings );
+ pSVData->maAppData.mbSettingsInit = TRUE;
+ }
+#endif
+ }
+
+ // init data
+ mpRealParent = pRealParent;
+
+ if ( mbFrame )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( pParent )
+ {
+ mpFrameData->mnDPIX = pParent->mpFrameData->mnDPIX;
+ mpFrameData->mnDPIY = pParent->mpFrameData->mnDPIY;
+ mpFrameData->mnFontDPIX = pParent->mpFrameData->mnFontDPIX;
+ mpFrameData->mnFontDPIY = pParent->mpFrameData->mnFontDPIY;
+ }
+ else
+ {
+ if ( ImplGetGraphics() )
+ {
+ mpGraphics->GetResolution( mpFrameData->mnDPIX, mpFrameData->mnDPIY );
+ mpGraphics->GetScreenFontResolution( mpFrameData->mnFontDPIX, mpFrameData->mnFontDPIY );
+ if ( !mpFrameData->mpFontList->Count() )
+ {
+ mpGraphics->GetDevFontList( mpFrameData->mpFontList );
+ mpFrameData->mpFontList->InitStdFonts();
+ }
+ }
+ }
+#else
+ const REF( NMSP_CLIENT::XRmFrameWindow )& rxWindow = mpFrame->GetFrameInterface();
+ REF( NMSP_CLIENT::XRmOutputDevice ) xOutDev( mpFrame->GetOutdevInterface() );
+
+ if ( rxWindow.is() && xOutDev.is() )
+ {
+ mpGraphics = new ImplServerGraphics;
+ mpGraphics->SetInterface( xOutDev );
+ if ( pParent )
+ {
+ mpFrameData->mnDPIX = pParent->mpFrameData->mnDPIX;
+ mpFrameData->mnDPIY = pParent->mpFrameData->mnDPIY;
+ mpFrameData->mnFontDPIX = pParent->mpFrameData->mnFontDPIX;
+ mpFrameData->mnFontDPIY = pParent->mpFrameData->mnFontDPIY;
+ }
+ else
+ {
+ // We currently assume, that we have only one display
+ static NMSP_CLIENT::RmFrameResolutions aResl = mpFrame->GetFrameResolutions();
+ mpFrameData->mnDPIX = aResl.DPIx;
+ mpFrameData->mnDPIY = aResl.DPIy;
+ mpFrameData->mnFontDPIX = aResl.FontDPIx;
+ mpFrameData->mnFontDPIY = aResl.FontDPIy;
+ mpGraphics->SetWindowResolution( aResl.DPIx, aResl.DPIy, aResl.Depth );
+ if ( !mpFrameData->mpFontList->Count() )
+ {
+ mpGraphics->GetDevFontList( mpFrameData->mpFontList );
+ mpFrameData->mpFontList->InitStdFonts();
+ }
+ }
+ }
+#endif
+
+ // If we create a Window with default size, query this
+ // size directly, because we want resize all Controls to
+ // the correct size before we display the window
+ if ( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_APP) )
+ mpFrame->GetClientSize( mnOutWidth, mnOutHeight );
+ }
+ else
+ {
+ if ( pParent )
+ {
+ if ( !ImplIsOverlapWindow() )
+ {
+ mbDisabled = pParent->mbDisabled;
+ mbInputDisabled = pParent->mbInputDisabled;
+ mbAlwaysEnableInput = pParent->mbAlwaysEnableInput;
+ }
+
+ OutputDevice::SetSettings( pParent->GetSettings() );
+ }
+ }
+
+ const StyleSettings& rStyleSettings = maSettings.GetStyleSettings();
+ USHORT nScreenZoom = rStyleSettings.GetScreenZoom();
+ mnDPIX = (mpFrameData->mnDPIX*nScreenZoom)/100;
+ mnDPIY = (mpFrameData->mnDPIY*nScreenZoom)/100;
+ mpFontList = mpFrameData->mpFontList;
+ mpFontCache = mpFrameData->mpFontCache;
+ maFont = rStyleSettings.GetAppFont();
+ ImplPointToLogic( maFont );
+
+ if ( nStyle & WB_3DLOOK )
+ {
+ SetTextColor( rStyleSettings.GetButtonTextColor() );
+ SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) );
+ }
+ else
+ {
+ SetTextColor( rStyleSettings.GetWindowTextColor() );
+ SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
+ }
+
+ ImplUpdatePos();
+
+ // AppFont-Aufloesung berechnen
+ if ( mbFrame && !pSVData->maGDIData.mnAppFontX )
+ ImplInitAppFontData( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInsertWindow( Window* pParent )
+{
+ mpParent = pParent;
+ mpRealParent = pParent;
+
+ if ( pParent && !mbFrame )
+ {
+ // search frame window and set window frame data
+ Window* pFrameParent = pParent->mpFrameWindow;
+ mpFrameData = pFrameParent->mpFrameData;
+ mpFrame = pFrameParent->mpFrame;
+ mpFrameWindow = pFrameParent;
+ mbFrame = FALSE;
+#ifdef REMOTE_APPSERVER
+ mpGraphics = mpFrameWindow->mpGraphics;
+#endif
+
+ // search overlap window and insert window in list
+ if ( ImplIsOverlapWindow() )
+ {
+ Window* pFirstOverlapParent = pParent;
+ while ( !pFirstOverlapParent->ImplIsOverlapWindow() )
+ pFirstOverlapParent = pFirstOverlapParent->ImplGetParent();
+ mpOverlapWindow = pFirstOverlapParent;
+
+ mpNextOverlap = mpFrameData->mpFirstOverlap;
+ mpFrameData->mpFirstOverlap = this;
+
+ // Overlap-Windows sind per default die obersten
+ mpNext = pFirstOverlapParent->mpFirstOverlap;
+ pFirstOverlapParent->mpFirstOverlap = this;
+ if ( !pFirstOverlapParent->mpLastOverlap )
+ pFirstOverlapParent->mpLastOverlap = this;
+ else
+ mpNext->mpPrev = this;
+ }
+ else
+ {
+ if ( pParent->ImplIsOverlapWindow() )
+ mpOverlapWindow = pParent;
+ else
+ mpOverlapWindow = pParent->mpOverlapWindow;
+ mpPrev = pParent->mpLastChild;
+ pParent->mpLastChild = this;
+ if ( !pParent->mpFirstChild )
+ pParent->mpFirstChild = this;
+ else
+ mpPrev->mpNext = this;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplRemoveWindow( BOOL bRemoveFrameData )
+{
+ // Fenster aus den Listen austragen
+ if ( !mbFrame )
+ {
+ if ( ImplIsOverlapWindow() )
+ {
+ if ( mpFrameData->mpFirstOverlap == this )
+ mpFrameData->mpFirstOverlap = mpNextOverlap;
+ else
+ {
+ Window* pTempWin = mpFrameData->mpFirstOverlap;
+ while ( pTempWin->mpNextOverlap != this )
+ pTempWin = pTempWin->mpNextOverlap;
+ pTempWin->mpNextOverlap = mpNextOverlap;
+ }
+
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ mpOverlapWindow->mpFirstOverlap = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ mpOverlapWindow->mpLastOverlap = mpPrev;
+ }
+ else
+ {
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ mpParent->mpFirstChild = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ mpParent->mpLastChild = mpPrev;
+ }
+
+ mpPrev = NULL;
+ mpNext = NULL;
+ }
+
+ if ( bRemoveFrameData )
+ {
+ // Graphic freigeben
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+#else
+ ImplReleaseServerGraphics();
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static ULONG ImplAutoHelpID()
+{
+ if ( !Application::IsAutoHelpIdEnabled() )
+ return 0;
+
+ ULONG nHID = 0;
+
+ ResMgr *pResMgr = Resource::GetResManager();
+
+ DBG_ASSERT( pResMgr, "MM hat gesagt, dass wir immer einen haben" );
+ DBG_ASSERT( pResMgr->nTopRes, "MM hat gesagt, dass der Stack nie leer ist" );
+ if( !pResMgr || pResMgr->nTopRes < 1 || pResMgr->nTopRes > 2 )
+ return 0;
+
+ const ImpRCStack *pRC = pResMgr->StackTop( pResMgr->nTopRes==1 ? 0 : 1 );
+
+ DBG_ASSERT( pRC->pResource, "MM hat gesagt, dass der immer einen hat" );
+ ULONG nGID = pRC->pResource->GetId();
+
+ if( !nGID || nGID > 32767 )
+ return 0;
+
+ // GGGg gggg::gggg gggg::ggLL LLLl::llll llll
+ switch( pRC->pResource->GetRT() ) { // maximal 7
+ case RSC_DOCKINGWINDOW:
+ nHID += 0x20000000L;
+ case RSC_WORKWIN:
+ nHID += 0x20000000L;
+ case RSC_MODELESSDIALOG:
+ nHID += 0x20000000L;
+ case RSC_FLOATINGWINDOW:
+ nHID += 0x20000000L;
+ case RSC_MODALDIALOG:
+ nHID += 0x20000000L;
+ case RSC_TABPAGE:
+ nHID += 0x20000000L;
+
+ if( pResMgr->nTopRes == 2 ) {
+ pRC = pResMgr->StackTop();
+ ULONG nLID = pRC->pResource->GetId();
+
+ if( !nLID || nLID > 511 )
+ return 0;
+
+ switch( pRC->pResource->GetRT() ) { // maximal 32
+ case RSC_TABCONTROL: nHID |= 0x0000; break;
+ case RSC_RADIOBUTTON: nHID |= 0x0200; break;
+ case RSC_CHECKBOX: nHID |= 0x0400; break;
+ case RSC_TRISTATEBOX: nHID |= 0x0600; break;
+ case RSC_EDIT: nHID |= 0x0800; break;
+ case RSC_MULTILINEEDIT: nHID |= 0x0A00; break;
+ case RSC_MULTILISTBOX: nHID |= 0x0C00; break;
+ case RSC_LISTBOX: nHID |= 0x0E00; break;
+ case RSC_COMBOBOX: nHID |= 0x1000; break;
+ case RSC_PUSHBUTTON: nHID |= 0x1200; break;
+ case RSC_SPINFIELD: nHID |= 0x1400; break;
+ case RSC_PATTERNFIELD: nHID |= 0x1600; break;
+ case RSC_NUMERICFIELD: nHID |= 0x1800; break;
+ case RSC_METRICFIELD: nHID |= 0x1A00; break;
+ case RSC_CURRENCYFIELD: nHID |= 0x1C00; break;
+ case RSC_DATEFIELD: nHID |= 0x1E00; break;
+ case RSC_TIMEFIELD: nHID |= 0x2000; break;
+ case RSC_IMAGERADIOBUTTON: nHID |= 0x2200; break;
+ case RSC_NUMERICBOX: nHID |= 0x2400; break;
+ case RSC_METRICBOX: nHID |= 0x2600; break;
+ case RSC_CURRENCYBOX: nHID |= 0x2800; break;
+ case RSC_DATEBOX: nHID |= 0x2A00; break;
+ case RSC_TIMEBOX: nHID |= 0x2C00; break;
+ case RSC_IMAGEBUTTON: nHID |= 0x2E00; break;
+ case RSC_MENUBUTTON: nHID |= 0x3000; break;
+ case RSC_MOREBUTTON: nHID |= 0x3200; break;
+ default:
+ return 0;
+ } // of switch
+ nHID |= nLID;
+ } // of if
+ break;
+ default:
+ return 0;
+ } // of switch
+ nHID |= nGID << 14;
+ return nHID;
+}
+
+// -----------------------------------------------------------------------
+
+WinBits Window::ImplInitRes( const ResId& rResId )
+{
+ GetRes( rResId );
+
+ char* pRes = (char*)GetClassRes();
+ pRes += 4;
+ ULONG nStyle = GetLongRes( (void*)pRes );
+ ((ResId&)rResId).aWinBits = nStyle;
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplLoadRes( const ResId& rResId )
+{
+ // newer move this line after IncrementRes
+ char* pRes = (char*)GetClassRes();
+ pRes += 8;
+ ULONG nHelpId = (ULONG)GetLongRes( (void*)pRes );
+ if ( !nHelpId )
+ nHelpId = ImplAutoHelpID();
+ SetHelpId( nHelpId );
+
+ USHORT nObjMask = (USHORT)ReadShortRes();
+
+ // ResourceStyle
+ USHORT nRSStyle = ReadShortRes();
+ // WinBits
+ ReadLongRes();
+ // HelpId
+ ReadLongRes();
+
+ BOOL bPos = FALSE;
+ BOOL bSize = FALSE;
+ Point aPos;
+ Size aSize;
+
+ if ( nObjMask & (WINDOW_XYMAPMODE | WINDOW_X | WINDOW_Y) )
+ {
+ // Groessenangabe aus der Resource verwenden
+ MapUnit ePosMap = MAP_PIXEL;
+
+ bPos = TRUE;
+
+ if ( nObjMask & WINDOW_XYMAPMODE )
+ ePosMap = (MapUnit)(USHORT)ReadShortRes();
+ if ( nObjMask & WINDOW_X )
+ aPos.X() = ImplLogicUnitToPixelX( ReadLongRes(), ePosMap );
+ if ( nObjMask & WINDOW_Y )
+ aPos.Y() = ImplLogicUnitToPixelY( ReadLongRes(), ePosMap );
+ }
+
+ if ( nObjMask & (WINDOW_WHMAPMODE | WINDOW_WIDTH | WINDOW_HEIGHT) )
+ {
+ // Groessenangabe aus der Resource verwenden
+ MapUnit eSizeMap = MAP_PIXEL;
+
+ bSize = TRUE;
+
+ if ( nObjMask & WINDOW_WHMAPMODE )
+ eSizeMap = (MapUnit)(USHORT)ReadShortRes();
+ if ( nObjMask & WINDOW_WIDTH )
+ aSize.Width() = ImplLogicUnitToPixelX( ReadLongRes(), eSizeMap );
+ if ( nObjMask & WINDOW_HEIGHT )
+ aSize.Height() = ImplLogicUnitToPixelY( ReadLongRes(), eSizeMap );
+ }
+
+ // Wegen Optimierung so schlimm aussehend
+ if ( nRSStyle & RSWND_CLIENTSIZE )
+ {
+ if ( bPos )
+ SetPosPixel( aPos );
+ if ( bSize )
+ SetOutputSizePixel( aSize );
+ }
+ else if ( bPos && bSize )
+ SetPosSizePixel( aPos, aSize );
+ else if ( bPos )
+ SetPosPixel( aPos );
+ else if ( bSize )
+ SetSizePixel( aSize );
+
+ if ( nRSStyle & RSWND_DISABLED )
+ Enable( FALSE );
+
+ if ( nObjMask & WINDOW_TEXT )
+ SetText( ReadStringRes() );
+ if ( nObjMask & WINDOW_HELPTEXT )
+ SetHelpText( ReadStringRes() );
+ if ( nObjMask & WINDOW_QUICKTEXT )
+ SetQuickHelpText( ReadStringRes() );
+ if ( nObjMask & WINDOW_EXTRALONG )
+ SetData( (void*)ReadLongRes() );
+ if ( nObjMask & WINDOW_UNIQUEID )
+ SetUniqueId( (ULONG)ReadLongRes() );
+}
+
+// -----------------------------------------------------------------------
+
+ImplWinData* Window::ImplGetWinData() const
+{
+ if ( !mpWinData )
+ {
+ ((Window*)this)->mpWinData = new ImplWinData;
+ mpWinData->mpExtPosAry = NULL;
+ mpWinData->mnExtPosStart = 0;
+ mpWinData->mnExtPosCount = 0;
+ mpWinData->mnExtOldTextLen = 0;
+ mpWinData->mpFocusRect = NULL;
+ mpWinData->mpTrackRect = NULL;
+ mpWinData->mnTrackFlags = 0;
+ }
+
+ return mpWinData;
+}
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+SalGraphics* Window::ImplGetFrameGraphics() const
+{
+ if ( mpFrameWindow->mpGraphics )
+ mpFrameWindow->mbInitClipRegion = TRUE;
+ else
+ mpFrameWindow->ImplGetGraphics();
+ mpFrameWindow->mpGraphics->ResetClipRegion();
+ return mpFrameWindow->mpGraphics;
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+Window* Window::ImplFindWindow( const Point& rFramePos )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Window* pTempWindow;
+ Window* pFindWindow;
+
+ // Zuerst alle ueberlappenden Fenster ueberpruefen
+ pTempWindow = mpFirstOverlap;
+ while ( pTempWindow )
+ {
+ pFindWindow = pTempWindow->ImplFindWindow( rFramePos );
+ if ( pFindWindow )
+ return pFindWindow;
+ pTempWindow = pTempWindow->mpNext;
+ }
+
+ // dann testen wir unser Fenster
+ if ( !mbVisible )
+ return NULL;
+
+ USHORT nHitTest = ImplHitTest( rFramePos );
+ if ( nHitTest & WINDOW_HITTEST_INSIDE )
+ {
+ // und danach gehen wir noch alle Child-Fenster durch
+ pTempWindow = mpFirstChild;
+ while ( pTempWindow )
+ {
+ pFindWindow = pTempWindow->ImplFindWindow( rFramePos );
+ if ( pFindWindow )
+ return pFindWindow;
+ pTempWindow = pTempWindow->mpNext;
+ }
+
+ if ( nHitTest & WINDOW_HITTEST_TRANSPARENT )
+ return NULL;
+ else
+ return this;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Window::ImplHitTest( const Point& rFramePos )
+{
+ Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ if ( !aRect.IsInside( rFramePos ) )
+ return 0;
+ if ( mbWinRegion )
+ {
+ Point aTempPos = rFramePos;
+ aTempPos.X() -= mnOutOffX;
+ aTempPos.Y() -= mnOutOffY;
+ if ( !maWinRegion.IsInside( aTempPos ) )
+ return 0;
+ }
+
+ USHORT nHitTest = WINDOW_HITTEST_INSIDE;
+ if ( mbMouseTransparent )
+ nHitTest |= WINDOW_HITTEST_TRANSPARENT;
+ return nHitTest;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplIsRealParentPath( const Window* pWindow ) const
+{
+ pWindow = pWindow->GetParent();
+ while ( pWindow )
+ {
+ if ( pWindow == this )
+ return TRUE;
+ pWindow = pWindow->GetParent();
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplIsChild( const Window* pWindow, BOOL bSystemWindow ) const
+{
+ do
+ {
+ if ( !bSystemWindow && pWindow->ImplIsOverlapWindow() )
+ break;
+
+ pWindow = pWindow->ImplGetParent();
+
+ if ( pWindow == this )
+ return TRUE;
+ }
+ while ( pWindow );
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplIsWindowOrChild( const Window* pWindow, BOOL bSystemWindow ) const
+{
+ if ( this == pWindow )
+ return TRUE;
+ return ImplIsChild( pWindow, bSystemWindow );
+}
+
+// -----------------------------------------------------------------------
+
+Window* Window::ImplGetSameParent( const Window* pWindow ) const
+{
+ if ( mpFrameWindow != pWindow->mpFrameWindow )
+ return NULL;
+ else
+ {
+ if ( pWindow->ImplIsChild( this ) )
+ return (Window*)pWindow;
+ else
+ {
+ Window* pTestWindow = (Window*)this;
+ while ( (pTestWindow == pWindow) || pTestWindow->ImplIsChild( pWindow ) )
+ pTestWindow = pTestWindow->ImplGetParent();
+ return pTestWindow;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int Window::ImplTestMousePointerSet()
+{
+ // Wenn Mouse gecaptured ist, dann soll MousePointer umgeschaltet werden
+ if ( IsMouseCaptured() )
+ return TRUE;
+
+ // Wenn sich Mouse ueber dem Fenster befindet, dann soll MousePointer
+ // umgeschaltet werden
+ Rectangle aClientRect( Point( 0, 0 ), GetOutputSizePixel() );
+ if ( aClientRect.IsInside( GetPointerPosPixel() ) )
+ return TRUE;
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+PointerStyle Window::ImplGetMousePointer() const
+{
+ PointerStyle ePointerStyle;
+ BOOL bWait = FALSE;
+
+ if ( IsEnabled() && IsInputEnabled() )
+ ePointerStyle = GetPointer().GetStyle();
+ else
+ ePointerStyle = POINTER_ARROW;
+
+ const Window* pWindow = this;
+ do
+ {
+ // Wenn Pointer nicht sichtbar, dann wird suche abgebrochen, da
+ // dieser Status nicht ueberschrieben werden darf
+ if ( pWindow->mbNoPtrVisible )
+ return POINTER_NULL;
+
+ if ( !bWait )
+ {
+ if ( pWindow->mnWaitCount )
+ {
+ ePointerStyle = POINTER_WAIT;
+ bWait = TRUE;
+ }
+ else
+ {
+ if ( pWindow->mbChildPtrOverwrite )
+ ePointerStyle = pWindow->GetPointer().GetStyle();
+ }
+ }
+
+ if ( pWindow->ImplIsOverlapWindow() )
+ break;
+
+ pWindow = pWindow->ImplGetParent();
+ }
+ while ( pWindow );
+
+ return ePointerStyle;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplResetReallyVisible()
+{
+ mbDevOutput = FALSE;
+ mbReallyVisible = FALSE;
+ mbReallyShown = FALSE;
+
+ Window* pWindow = mpFirstOverlap;
+ while ( pWindow )
+ {
+ if ( pWindow->mbReallyVisible )
+ pWindow->ImplResetReallyVisible();
+ pWindow = pWindow->mpNext;
+ }
+
+ pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( pWindow->mbReallyVisible )
+ pWindow->ImplResetReallyVisible();
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplSetReallyVisible()
+{
+ mbDevOutput = TRUE;
+ mbReallyVisible = TRUE;
+ mbReallyShown = TRUE;
+
+ Window* pWindow = mpFirstOverlap;
+ while ( pWindow )
+ {
+ if ( pWindow->mbVisible )
+ pWindow->ImplSetReallyVisible();
+ pWindow = pWindow->mpNext;
+ }
+
+ pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( pWindow->mbVisible )
+ pWindow->ImplSetReallyVisible();
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCallInitShow()
+{
+ mbReallyShown = TRUE;
+ mbInInitShow = TRUE;
+ StateChanged( STATE_CHANGE_INITSHOW );
+ mbInInitShow = FALSE;
+
+ Window* pWindow = mpFirstOverlap;
+ while ( pWindow )
+ {
+ if ( pWindow->mbVisible )
+ pWindow->ImplCallInitShow();
+ pWindow = pWindow->mpNext;
+ }
+
+ pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( pWindow->mbVisible )
+ pWindow->ImplCallInitShow();
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplAddDel( ImplDelData* pDel )
+{
+ pDel->mpNext = mpFirstDel;
+ mpFirstDel = pDel;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplRemoveDel( ImplDelData* pDel )
+{
+ if ( mpFirstDel == pDel )
+ mpFirstDel = pDel->mpNext;
+ else
+ {
+ ImplDelData* pData = mpFirstDel;
+ while ( pData->mpNext != pDel )
+ pData = pData->mpNext;
+ pData->mpNext = pDel->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInitResolutionSettings()
+{
+ // AppFont-Aufloesung und DPI-Aufloesung neu berechnen
+ if ( mbFrame )
+ {
+ const StyleSettings& rStyleSettings = maSettings.GetStyleSettings();
+ USHORT nScreenZoom = rStyleSettings.GetScreenZoom();
+ mnDPIX = (mpFrameData->mnDPIX*nScreenZoom)/100;
+ mnDPIY = (mpFrameData->mnDPIY*nScreenZoom)/100;
+ SetPointFont( rStyleSettings.GetAppFont() );
+
+ if ( !ImplGetSVData()->maGDIData.mnAppFontX )
+ ImplInitAppFontData( this );
+ }
+ else if ( mpParent )
+ {
+ mnDPIX = mpParent->mnDPIX;
+ mnDPIY = mpParent->mnDPIY;
+ }
+
+ // Vorberechnete Werte fuer logische Einheiten updaten und auch
+ // die entsprechenden Tools dazu
+ if ( IsMapMode() )
+ {
+ MapMode aMapMode = GetMapMode();
+ SetMapMode();
+ SetMapMode( aMapMode );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplPointToLogic( Font& rFont ) const
+{
+ Size aSize = rFont.GetSize();
+ USHORT nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom();
+
+ if ( aSize.Width() )
+ {
+ aSize.Width() *= mpFrameData->mnFontDPIX;
+ aSize.Width() += 72/2;
+ aSize.Width() /= 72;
+ aSize.Width() *= nScreenFontZoom;
+ aSize.Width() /= 100;
+ }
+ aSize.Height() *= mpFrameData->mnFontDPIY;
+ aSize.Height() += 72/2;
+ aSize.Height() /= 72;
+ aSize.Height() *= nScreenFontZoom;
+ aSize.Height() /= 100;
+
+ if ( IsMapModeEnabled() )
+ aSize = PixelToLogic( aSize );
+
+ rFont.SetSize( aSize );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplLogicToPoint( Font& rFont ) const
+{
+ Size aSize = rFont.GetSize();
+ USHORT nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom();
+
+ if ( IsMapModeEnabled() )
+ aSize = LogicToPixel( aSize );
+
+ if ( aSize.Width() )
+ {
+ aSize.Width() *= 100;
+ aSize.Width() /= nScreenFontZoom;
+ aSize.Width() *= 72;
+ aSize.Width() += mpFrameData->mnFontDPIX/2;
+ aSize.Width() /= mpFrameData->mnFontDPIX;
+ }
+ aSize.Height() *= 100;
+ aSize.Height() /= nScreenFontZoom;
+ aSize.Height() *= 72;
+ aSize.Height() += mpFrameData->mnFontDPIY/2;
+ aSize.Height() /= mpFrameData->mnFontDPIY;
+
+ rFont.SetSize( aSize );
+}
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+BOOL Window::ImplSysObjClip( const Region* pOldRegion )
+{
+ BOOL bUpdate = TRUE;
+
+ if ( mpSysObj )
+ {
+ BOOL bVisibleState = mbReallyVisible;
+
+ if ( bVisibleState )
+ {
+ Region* pWinChildClipRegion = ImplGetWinChildClipRegion();
+
+ if ( !pWinChildClipRegion->IsEmpty() )
+ {
+ if ( pOldRegion )
+ {
+ Region aNewRegion = *pWinChildClipRegion;
+ pWinChildClipRegion->Intersect( *pOldRegion );
+ bUpdate = aNewRegion == *pWinChildClipRegion;
+ }
+
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+
+ Region aRegion = *pWinChildClipRegion;
+ Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ Region aWinRectRegion( aWinRect );
+ USHORT nClipFlags = mpSysObj->GetClipRegionType();
+
+ if ( aRegion == aWinRectRegion )
+ mpSysObj->ResetClipRegion();
+ else
+ {
+ if ( nClipFlags & SAL_OBJECT_CLIP_EXCLUDERECTS )
+ {
+ aWinRectRegion.Exclude( aRegion );
+ aRegion = aWinRectRegion;
+ }
+ if ( !(nClipFlags & SAL_OBJECT_CLIP_ABSOLUTE) )
+ aRegion.Move( -mnOutOffX, -mnOutOffY );
+
+ // ClipRegion setzen/updaten
+ long nX;
+ long nY;
+ long nWidth;
+ long nHeight;
+ ULONG nRectCount;
+ ImplRegionInfo aInfo;
+ BOOL bRegionRect;
+
+ nRectCount = aRegion.GetRectCount();
+ mpSysObj->BeginSetClipRegion( nRectCount );
+ bRegionRect = aRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
+ while ( bRegionRect )
+ {
+ mpSysObj->UnionClipRegion( nX, nY, nWidth, nHeight );
+ bRegionRect = aRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
+ }
+ mpSysObj->EndSetClipRegion();
+ }
+ }
+ else
+ bVisibleState = FALSE;
+ }
+
+ // Visible-Status updaten
+ mpSysObj->Show( bVisibleState );
+ }
+
+ return bUpdate;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplUpdateSysObjChildsClip()
+{
+ if ( mpSysObj && mbInitWinClipRegion )
+ ImplSysObjClip( NULL );
+
+ Window* pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ pWindow->ImplUpdateSysObjChildsClip();
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplUpdateSysObjOverlapsClip()
+{
+ ImplUpdateSysObjChildsClip();
+
+ Window* pWindow = mpFirstOverlap;
+ while ( pWindow )
+ {
+ pWindow->ImplUpdateSysObjOverlapsClip();
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplUpdateSysObjClip()
+{
+ if ( !ImplIsOverlapWindow() )
+ {
+ ImplUpdateSysObjChildsClip();
+
+ // Schwestern muessen ihre ClipRegion auch neu berechnen
+ if ( mbClipSiblings )
+ {
+ Window* pWindow = mpNext;
+ while ( pWindow )
+ {
+ pWindow->ImplUpdateSysObjChildsClip();
+ pWindow = pWindow->mpNext;
+ }
+ }
+ }
+ else
+ mpFrameWindow->ImplUpdateSysObjOverlapsClip();
+}
+
+#endif
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplSetClipFlagChilds( BOOL bSysObjOnlySmaller )
+{
+ BOOL bUpdate = TRUE;
+#ifndef REMOTE_APPSERVER
+ if ( mpSysObj )
+ {
+ Region* pOldRegion = NULL;
+ if ( bSysObjOnlySmaller && !mbInitWinClipRegion )
+ pOldRegion = new Region( maWinClipRegion );
+
+ mbInitClipRegion = TRUE;
+ mbInitWinClipRegion = TRUE;
+
+ Window* pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) )
+ bUpdate = FALSE;
+ pWindow = pWindow->mpNext;
+ }
+
+ if ( !ImplSysObjClip( pOldRegion ) )
+ {
+ mbInitClipRegion = TRUE;
+ mbInitWinClipRegion = TRUE;
+ bUpdate = FALSE;
+ }
+
+ if ( pOldRegion )
+ delete pOldRegion;
+ }
+ else
+#endif
+ {
+ mbInitClipRegion = TRUE;
+ mbInitWinClipRegion = TRUE;
+
+ Window* pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) )
+ bUpdate = FALSE;
+ pWindow = pWindow->mpNext;
+ }
+ }
+ return bUpdate;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplSetClipFlagOverlapWindows( BOOL bSysObjOnlySmaller )
+{
+ BOOL bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller );
+
+ Window* pWindow = mpFirstOverlap;
+ while ( pWindow )
+ {
+ if ( !pWindow->ImplSetClipFlagOverlapWindows( bSysObjOnlySmaller ) )
+ bUpdate = FALSE;
+ pWindow = pWindow->mpNext;
+ }
+
+ return bUpdate;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplSetClipFlag( BOOL bSysObjOnlySmaller )
+{
+ if ( !ImplIsOverlapWindow() )
+ {
+ BOOL bUpdate = ImplSetClipFlagChilds( bSysObjOnlySmaller );
+
+ Window* pParent = ImplGetParent();
+ if ( pParent &&
+ ((pParent->GetStyle() & WB_CLIPCHILDREN) || (mnParentClipMode & PARENTCLIPMODE_CLIP)) )
+ {
+ pParent->mbInitClipRegion = TRUE;
+ pParent->mbInitChildRegion = TRUE;
+ }
+
+ // Schwestern muessen ihre ClipRegion auch neu berechnen
+ if ( mbClipSiblings )
+ {
+ Window* pWindow = mpNext;
+ while ( pWindow )
+ {
+ if ( !pWindow->ImplSetClipFlagChilds( bSysObjOnlySmaller ) )
+ bUpdate = FALSE;
+ pWindow = pWindow->mpNext;
+ }
+ }
+
+ return bUpdate;
+ }
+ else
+ return mpFrameWindow->ImplSetClipFlagOverlapWindows( bSysObjOnlySmaller );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplIntersectWindowClipRegion( Region& rRegion )
+{
+ if ( mbInitWinClipRegion )
+ ImplInitWinClipRegion();
+
+ rRegion.Intersect( maWinClipRegion );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplIntersectWindowRegion( Region& rRegion )
+{
+ rRegion.Intersect( Rectangle( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) ) );
+ if ( mbWinRegion )
+ rRegion.Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplExcludeWindowRegion( Region& rRegion )
+{
+ if ( mbWinRegion )
+ {
+ Point aPoint( mnOutOffX, mnOutOffY );
+ Region aRegion( Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ aRegion.Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+ rRegion.Exclude( aRegion );
+ }
+ else
+ {
+ Point aPoint( mnOutOffX, mnOutOffY );
+ rRegion.Exclude( Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplExcludeOverlapWindows( Region& rRegion )
+{
+ Window* pWindow = mpFirstOverlap;
+ while ( pWindow )
+ {
+ if ( pWindow->mbReallyVisible )
+ {
+ pWindow->ImplExcludeWindowRegion( rRegion );
+ pWindow->ImplExcludeOverlapWindows( rRegion );
+ }
+
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplExcludeOverlapWindows2( Region& rRegion )
+{
+ if ( mbReallyVisible )
+ ImplExcludeWindowRegion( rRegion );
+
+ ImplExcludeOverlapWindows( rRegion );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplClipBoundaries( Region& rRegion, BOOL bThis, BOOL bOverlaps )
+{
+ if ( bThis )
+ ImplIntersectWindowClipRegion( rRegion );
+ else if ( ImplIsOverlapWindow() )
+ {
+ // Evt. noch am Frame clippen
+ if ( !mbFrame )
+ rRegion.Intersect( Rectangle( Point( 0, 0 ), Size( mpFrameWindow->mnOutWidth, mpFrameWindow->mnOutHeight ) ) );
+
+ if ( bOverlaps && !rRegion.IsEmpty() )
+ {
+ // Clip Overlap Siblings
+ Window* pStartOverlapWindow = this;
+ while ( !pStartOverlapWindow->mbFrame )
+ {
+ Window* pOverlapWindow = pStartOverlapWindow->mpOverlapWindow->mpFirstOverlap;
+ while ( pOverlapWindow && (pOverlapWindow != pStartOverlapWindow) )
+ {
+ pOverlapWindow->ImplExcludeOverlapWindows2( rRegion );
+ pOverlapWindow = pOverlapWindow->mpNext;
+ }
+ pStartOverlapWindow = pStartOverlapWindow->mpOverlapWindow;
+ }
+
+ // Clip Child Overlap Windows
+ ImplExcludeOverlapWindows( rRegion );
+ }
+ }
+ else
+ ImplGetParent()->ImplIntersectWindowClipRegion( rRegion );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplClipChilds( Region& rRegion )
+{
+ BOOL bOtherClip = FALSE;
+ Window* pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( pWindow->mbReallyVisible )
+ {
+ // ParentClipMode-Flags auswerten
+ USHORT nClipMode = pWindow->GetParentClipMode();
+ if ( !(nClipMode & PARENTCLIPMODE_NOCLIP) &&
+ ((nClipMode & PARENTCLIPMODE_CLIP) || (GetStyle() & WB_CLIPCHILDREN)) )
+ pWindow->ImplExcludeWindowRegion( rRegion );
+ else
+ bOtherClip = TRUE;
+ }
+
+ pWindow = pWindow->mpNext;
+ }
+
+ return bOtherClip;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplClipAllChilds( Region& rRegion )
+{
+ Window* pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( pWindow->mbReallyVisible )
+ pWindow->ImplExcludeWindowRegion( rRegion );
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplClipSiblings( Region& rRegion )
+{
+ Window* pWindow = ImplGetParent()->mpFirstChild;
+ while ( pWindow )
+ {
+ if ( pWindow == this )
+ break;
+
+ if ( pWindow->mbReallyVisible )
+ pWindow->ImplExcludeWindowRegion( rRegion );
+
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInitWinClipRegion()
+{
+ // Build Window Region
+ maWinClipRegion = Rectangle( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) );
+ if ( mbWinRegion )
+ maWinClipRegion.Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+
+ // ClipSiblings
+ if ( mbClipSiblings && !ImplIsOverlapWindow() )
+ ImplClipSiblings( maWinClipRegion );
+
+ // Clip Parent Boundaries
+ ImplClipBoundaries( maWinClipRegion, FALSE, TRUE );
+
+ // Clip Children
+ if ( (GetStyle() & WB_CLIPCHILDREN) || mbClipChildren )
+ mbInitChildRegion = TRUE;
+
+ mbInitWinClipRegion = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInitWinChildClipRegion()
+{
+ if ( !mpFirstChild )
+ {
+ if ( mpChildClipRegion )
+ {
+ delete mpChildClipRegion;
+ mpChildClipRegion = NULL;
+ }
+ }
+ else
+ {
+ if ( !mpChildClipRegion )
+ mpChildClipRegion = new Region( maWinClipRegion );
+ else
+ *mpChildClipRegion = maWinClipRegion;
+
+ ImplClipChilds( *mpChildClipRegion );
+ }
+
+ mbInitChildRegion = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+Region* Window::ImplGetWinChildClipRegion()
+{
+ if ( mbInitWinClipRegion )
+ ImplInitWinClipRegion();
+ if ( mbInitChildRegion )
+ ImplInitWinChildClipRegion();
+ if ( mpChildClipRegion )
+ return mpChildClipRegion;
+ else
+ return &maWinClipRegion;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplIntersectAndUnionOverlapWindows( const Region& rInterRegion, Region& rRegion )
+{
+ Window* pWindow = mpFirstOverlap;
+ while ( pWindow )
+ {
+ if ( pWindow->mbReallyVisible )
+ {
+ Region aTempRegion( rInterRegion );
+ pWindow->ImplIntersectWindowRegion( aTempRegion );
+ rRegion.Union( aTempRegion );
+ pWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
+ }
+
+ pWindow = pWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplIntersectAndUnionOverlapWindows2( const Region& rInterRegion, Region& rRegion )
+{
+ if ( mbReallyVisible )
+ {
+ Region aTempRegion( rInterRegion );
+ ImplIntersectWindowRegion( aTempRegion );
+ rRegion.Union( aTempRegion );
+ }
+
+ ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCalcOverlapRegionOverlaps( const Region& rInterRegion, Region& rRegion )
+{
+ // Clip Overlap Siblings
+ Window* pStartOverlapWindow;
+ if ( !ImplIsOverlapWindow() )
+ pStartOverlapWindow = mpOverlapWindow;
+ else
+ pStartOverlapWindow = this;
+ while ( !pStartOverlapWindow->mbFrame )
+ {
+ Window* pOverlapWindow = pStartOverlapWindow->mpOverlapWindow->mpFirstOverlap;
+ while ( pOverlapWindow && (pOverlapWindow != pStartOverlapWindow) )
+ {
+ pOverlapWindow->ImplIntersectAndUnionOverlapWindows2( rInterRegion, rRegion );
+ pOverlapWindow = pOverlapWindow->mpNext;
+ }
+ pStartOverlapWindow = pStartOverlapWindow->mpOverlapWindow;
+ }
+
+ // Clip Child Overlap Windows
+ if ( !ImplIsOverlapWindow() )
+ mpOverlapWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
+ else
+ ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegion,
+ BOOL bChilds, BOOL bParent, BOOL bSiblings )
+{
+ Region aRegion( rSourceRect );
+ if ( mbWinRegion )
+ rRegion.Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+ Region aTempRegion;
+ Window* pWindow;
+
+ ImplCalcOverlapRegionOverlaps( aRegion, rRegion );
+
+ // Parent-Boundaries
+ if ( bParent )
+ {
+ pWindow = this;
+ if ( !ImplIsOverlapWindow() )
+ {
+ pWindow = ImplGetParent();
+ do
+ {
+ aTempRegion = aRegion;
+ pWindow->ImplExcludeWindowRegion( aTempRegion );
+ rRegion.Union( aTempRegion );
+ if ( pWindow->ImplIsOverlapWindow() )
+ break;
+ pWindow = pWindow->ImplGetParent();
+ }
+ while ( pWindow );
+ }
+ if ( !pWindow->mbFrame )
+ {
+ aTempRegion = aRegion;
+ aTempRegion.Exclude( Rectangle( Point( 0, 0 ), Size( mpFrameWindow->mnOutWidth, mpFrameWindow->mnOutHeight ) ) );
+ rRegion.Union( aTempRegion );
+ }
+ }
+
+ // Siblings
+ if ( bSiblings && !ImplIsOverlapWindow() )
+ {
+ pWindow = mpParent->mpFirstChild;
+ do
+ {
+ if ( pWindow->mbReallyVisible && (pWindow != this) )
+ {
+ aTempRegion = aRegion;
+ pWindow->ImplIntersectWindowRegion( aTempRegion );
+ rRegion.Union( aTempRegion );
+ }
+ pWindow = pWindow->mpNext;
+ }
+ while ( pWindow );
+ }
+
+ // Childs
+ if ( bChilds )
+ {
+ pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ if ( pWindow->mbReallyVisible )
+ {
+ aTempRegion = aRegion;
+ pWindow->ImplIntersectWindowRegion( aTempRegion );
+ rRegion.Union( aTempRegion );
+ }
+ pWindow = pWindow->mpNext;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags )
+{
+ mbPaintFrame = FALSE;
+
+ if ( nPaintFlags & IMPL_PAINT_PAINTALLCHILDS )
+ mnPaintFlags |= IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALLCHILDS | (nPaintFlags & IMPL_PAINT_PAINTALL);
+ if ( nPaintFlags & IMPL_PAINT_PAINTCHILDS )
+ mnPaintFlags |= IMPL_PAINT_PAINTCHILDS;
+ if ( nPaintFlags & IMPL_PAINT_ERASE )
+ mnPaintFlags |= IMPL_PAINT_ERASE;
+ if ( !mpFirstChild )
+ mnPaintFlags &= ~IMPL_PAINT_PAINTALLCHILDS;
+
+ if ( mbPaintDisabled )
+ {
+ if ( mnPaintFlags & IMPL_PAINT_PAINTALL )
+ Invalidate( INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN );
+ else if ( pRegion )
+ Invalidate( *pRegion, INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN );
+ return;
+ }
+
+ nPaintFlags = mnPaintFlags & ~(IMPL_PAINT_PAINT);
+
+ Region* pChildRegion = NULL;
+ if ( mnPaintFlags & IMPL_PAINT_PAINT )
+ {
+ Region* pWinChildClipRegion = ImplGetWinChildClipRegion();
+ if ( mnPaintFlags & IMPL_PAINT_PAINTALL )
+ maInvalidateRegion = *pWinChildClipRegion;
+ else
+ {
+ if ( pRegion )
+ maInvalidateRegion.Union( *pRegion );
+ if ( mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS )
+ pChildRegion = new Region( maInvalidateRegion );
+ maInvalidateRegion.Intersect( *pWinChildClipRegion );
+ }
+ mnPaintFlags = 0;
+ if ( !maInvalidateRegion.IsEmpty() )
+ {
+ if ( mpCursor )
+ mpCursor->ImplHide();
+
+ mbInitClipRegion = TRUE;
+ mbInPaint = TRUE;
+
+ // Paint-Region zuruecksetzen
+ Region aPaintRegion( maInvalidateRegion );
+ Rectangle aPaintRect = ImplDevicePixelToLogic( aPaintRegion.GetBoundRect() );
+ mpPaintRegion = &aPaintRegion;
+ maInvalidateRegion.SetEmpty();
+
+ if ( (nPaintFlags & IMPL_PAINT_ERASE) && IsBackground() )
+ {
+ if ( IsClipRegion() )
+ {
+ Region aOldRegion = GetClipRegion();
+ SetClipRegion();
+ Erase();
+ SetClipRegion( aOldRegion );
+ }
+ else
+ Erase();
+ }
+ Paint( aPaintRect );
+
+ if ( mpWinData )
+ {
+ if ( mbFocusVisible )
+ ImplInvertFocus( *(mpWinData->mpFocusRect) );
+ if ( mbTrackVisible && (mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
+ InvertTracking( *(mpWinData->mpTrackRect), mpWinData->mnTrackFlags );
+ }
+ mbInPaint = FALSE;
+ mbInitClipRegion = TRUE;
+ mpPaintRegion = NULL;
+ if ( mpCursor )
+ mpCursor->ImplShow( FALSE );
+ }
+ }
+ else
+ mnPaintFlags = 0;
+
+ if ( nPaintFlags & (IMPL_PAINT_PAINTALLCHILDS | IMPL_PAINT_PAINTCHILDS) )
+ {
+ // die Childfenster ausgeben
+ Window* pTempWindow = mpFirstChild;
+ while ( pTempWindow )
+ {
+ if ( pTempWindow->mbVisible )
+ pTempWindow->ImplCallPaint( pChildRegion, nPaintFlags );
+ pTempWindow = pTempWindow->mpNext;
+ }
+ }
+
+ if ( pChildRegion )
+ delete pChildRegion;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCallOverlapPaint()
+{
+ // Zuerst geben wir die ueberlappenden Fenster aus
+ Window* pTempWindow = mpFirstOverlap;
+ while ( pTempWindow )
+ {
+ if ( pTempWindow->mbReallyVisible )
+ pTempWindow->ImplCallOverlapPaint();
+ pTempWindow = pTempWindow->mpNext;
+ }
+
+ // und dann erst uns selber
+ if ( mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDS) )
+ ImplCallPaint( NULL, mnPaintFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplPostPaint()
+{
+ if ( !mpFrameData->maPaintTimer.IsActive() )
+ mpFrameData->maPaintTimer.Start();
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Window, ImplHandlePaintHdl, void*, EMPTYARG )
+{
+ if ( mbReallyVisible )
+ ImplCallOverlapPaint();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInvalidateFrameRegion( const Region* pRegion, USHORT nFlags )
+{
+ // PAINTCHILDS bei allen Parent-Fenster bis zum ersten OverlapWindow
+ // setzen
+ if ( !ImplIsOverlapWindow() )
+ {
+ Window* pTempWindow = this;
+ do
+ {
+ pTempWindow = pTempWindow->ImplGetParent();
+ if ( pTempWindow->mnPaintFlags & IMPL_PAINT_PAINTCHILDS )
+ break;
+ pTempWindow->mnPaintFlags |= IMPL_PAINT_PAINTCHILDS;
+ }
+ while ( !pTempWindow->ImplIsOverlapWindow() );
+ }
+
+ // Paint-Flags setzen
+ mnPaintFlags |= IMPL_PAINT_PAINT;
+ if ( nFlags & INVALIDATE_CHILDREN )
+ mnPaintFlags |= IMPL_PAINT_PAINTALLCHILDS;
+ if ( !(nFlags & INVALIDATE_NOERASE) )
+ mnPaintFlags |= IMPL_PAINT_ERASE;
+ if ( !pRegion )
+ mnPaintFlags |= IMPL_PAINT_PAINTALL;
+
+ // Wenn nicht alles neu ausgegeben werden muss, dann die Region
+ // dazupacken
+ if ( !(mnPaintFlags & IMPL_PAINT_PAINTALL) )
+ maInvalidateRegion.Union( *pRegion );
+
+ ImplPostPaint();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInvalidateOverlapFrameRegion( const Region& rRegion )
+{
+ Region aRegion = rRegion;
+ ImplClipBoundaries( aRegion, TRUE, TRUE );
+ if ( !aRegion.IsEmpty() )
+ ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN );
+
+ // Dann invalidieren wir die ueberlappenden Fenster
+ Window* pTempWindow = mpFirstOverlap;
+ while ( pTempWindow )
+ {
+ if ( pTempWindow->IsVisible() )
+ pTempWindow->ImplInvalidateOverlapFrameRegion( rRegion );
+
+ pTempWindow = pTempWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInvalidateParentFrameRegion( Region& rRegion )
+{
+ if ( mbOverlapWin )
+ mpFrameWindow->ImplInvalidateOverlapFrameRegion( rRegion );
+ else
+ ImplGetParent()->ImplInvalidateFrameRegion( &rRegion, INVALIDATE_CHILDREN );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags )
+{
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+
+ // Feststellen, was neu ausgegeben werden muss
+ BOOL bInvalidateAll = !pRegion;
+
+ // Transparent-Invalidate beruecksichtigen
+ Window* pWindow = this;
+ if ( (mbPaintTransparent && !(nFlags & INVALIDATE_NOTRANSPARENT)) || (nFlags & INVALIDATE_TRANSPARENT) )
+ {
+ Window* pTempWindow = pWindow->ImplGetParent();
+ while ( pTempWindow )
+ {
+ if ( !pTempWindow->IsPaintTransparent() )
+ {
+ pWindow = pTempWindow;
+ nFlags |= INVALIDATE_CHILDREN;
+ bInvalidateAll = FALSE;
+ break;
+ }
+
+ if ( pTempWindow->ImplIsOverlapWindow() )
+ break;
+
+ pTempWindow = pTempWindow->ImplGetParent();
+ }
+ }
+
+ // Region zusammenbauen
+ USHORT nOrgFlags = nFlags;
+ if ( !(nFlags & (INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN)) )
+ {
+ if ( pWindow->GetStyle() & WB_CLIPCHILDREN )
+ nFlags |= INVALIDATE_NOCHILDREN;
+ else
+ nFlags |= INVALIDATE_CHILDREN;
+ }
+ if ( (nFlags & INVALIDATE_NOCHILDREN) && pWindow->mpFirstChild )
+ bInvalidateAll = FALSE;
+ if ( bInvalidateAll )
+ pWindow->ImplInvalidateFrameRegion( NULL, nFlags );
+ else
+ {
+ Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ Region aRegion( aRect );
+ if ( pRegion )
+ aRegion.Intersect( *pRegion );
+ pWindow->ImplClipBoundaries( aRegion, TRUE, TRUE );
+ if ( nFlags & INVALIDATE_NOCHILDREN )
+ {
+ nFlags &= ~INVALIDATE_CHILDREN;
+ if ( !(nFlags & INVALIDATE_NOCLIPCHILDREN) )
+ {
+ if ( nOrgFlags & INVALIDATE_NOCHILDREN )
+ pWindow->ImplClipAllChilds( aRegion );
+ else
+ {
+ if ( pWindow->ImplClipChilds( aRegion ) )
+ nFlags |= INVALIDATE_CHILDREN;
+ }
+ }
+ }
+ if ( !aRegion.IsEmpty() )
+ pWindow->ImplInvalidateFrameRegion( &aRegion, nFlags );
+ }
+
+ if ( nFlags & INVALIDATE_UPDATE )
+ pWindow->Update();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplMoveInvalidateRegion( const Rectangle& rRect,
+ long nHorzScroll, long nVertScroll,
+ BOOL bChilds )
+{
+ if ( (mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALL)) == IMPL_PAINT_PAINT )
+ {
+ Region aTempRegion = maInvalidateRegion;
+ aTempRegion.Intersect( rRect );
+ aTempRegion.Move( nHorzScroll, nVertScroll );
+ maInvalidateRegion.Union( aTempRegion );
+ }
+
+ if ( bChilds && (mnPaintFlags & IMPL_PAINT_PAINTCHILDS) )
+ {
+ Window* pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ pWindow->ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, TRUE );
+ pWindow = pWindow->mpNext;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplMoveAllInvalidateRegions( const Rectangle& rRect,
+ long nHorzScroll, long nVertScroll,
+ BOOL bChilds )
+{
+ // Paint-Region auch verschieben, wenn noch Paints anstehen
+ ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, bChilds );
+ // Paint-Region muss bei uns verschoben gesetzt werden, die durch
+ // die Parents gezeichnet werden
+ if ( !ImplIsOverlapWindow() )
+ {
+ Region aPaintAllRegion;
+ Window* pPaintAllWindow = this;
+ do
+ {
+ pPaintAllWindow = pPaintAllWindow->ImplGetParent();
+ if ( pPaintAllWindow->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS )
+ {
+ if ( pPaintAllWindow->mnPaintFlags & IMPL_PAINT_PAINTALL )
+ {
+ aPaintAllRegion.SetEmpty();
+ break;
+ }
+ else
+ aPaintAllRegion.Union( pPaintAllWindow->maInvalidateRegion );
+ }
+ }
+ while ( !pPaintAllWindow->ImplIsOverlapWindow() );
+ if ( !aPaintAllRegion.IsEmpty() )
+ {
+ aPaintAllRegion.Move( nHorzScroll, nVertScroll );
+ USHORT nPaintFlags = 0;
+ if ( bChilds )
+ mnPaintFlags |= INVALIDATE_CHILDREN;
+ ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplValidateFrameRegion( const Region* pRegion, USHORT nFlags )
+{
+ if ( !pRegion )
+ maInvalidateRegion.SetEmpty();
+ else
+ {
+ // Wenn alle Childfenster neu ausgegeben werden muessen,
+ // dann invalidieren wir diese vorher
+ if ( (mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS) && mpFirstChild )
+ {
+ Region aChildRegion = maInvalidateRegion;
+ if ( mnPaintFlags & IMPL_PAINT_PAINTALL )
+ {
+ Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ aChildRegion = aRect;
+ }
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->Invalidate( aChildRegion, INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT );
+ pChild = pChild->mpNext;
+ }
+ }
+ if ( mnPaintFlags & IMPL_PAINT_PAINTALL )
+ {
+ Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ maInvalidateRegion = aRect;
+ }
+ maInvalidateRegion.Exclude( *pRegion );
+ }
+ mnPaintFlags &= ~IMPL_PAINT_PAINTALL;
+
+ if ( nFlags & VALIDATE_CHILDREN )
+ {
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->ImplValidateFrameRegion( pRegion, nFlags );
+ pChild = pChild->mpNext;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplValidate( const Region* pRegion, USHORT nFlags )
+{
+ // Region zusammenbauen
+ BOOL bValidateAll = !pRegion;
+ USHORT nOrgFlags = nFlags;
+ if ( !(nFlags & (VALIDATE_CHILDREN | VALIDATE_NOCHILDREN)) )
+ {
+ if ( GetStyle() & WB_CLIPCHILDREN )
+ nFlags |= VALIDATE_NOCHILDREN;
+ else
+ nFlags |= VALIDATE_CHILDREN;
+ }
+ if ( (nFlags & VALIDATE_NOCHILDREN) && mpFirstChild )
+ bValidateAll = FALSE;
+ if ( bValidateAll )
+ ImplValidateFrameRegion( NULL, nFlags );
+ else
+ {
+ Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ Region aRegion( aRect );
+ if ( pRegion )
+ aRegion.Intersect( *pRegion );
+ ImplClipBoundaries( aRegion, TRUE, TRUE );
+ if ( nFlags & VALIDATE_NOCHILDREN )
+ {
+ nFlags &= ~VALIDATE_CHILDREN;
+ if ( nOrgFlags & VALIDATE_NOCHILDREN )
+ ImplClipAllChilds( aRegion );
+ else
+ {
+ if ( ImplClipChilds( aRegion ) )
+ nFlags |= VALIDATE_CHILDREN;
+ }
+ }
+ if ( !aRegion.IsEmpty() )
+ ImplValidateFrameRegion( &aRegion, nFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplScroll( const Rectangle& rRect,
+ long nHorzScroll, long nVertScroll, USHORT nFlags )
+{
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ nHorzScroll = ImplLogicWidthToDevicePixel( nHorzScroll );
+ nVertScroll = ImplLogicHeightToDevicePixel( nVertScroll );
+
+ if ( !nHorzScroll && !nVertScroll )
+ return;
+
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+
+ if ( mpCursor )
+ mpCursor->ImplHide();
+
+ USHORT nOrgFlags = nFlags;
+ if ( !(nFlags & (SCROLL_CHILDREN | SCROLL_NOCHILDREN)) )
+ {
+ if ( GetStyle() & WB_CLIPCHILDREN )
+ nFlags |= SCROLL_NOCHILDREN;
+ else
+ nFlags |= SCROLL_CHILDREN;
+ }
+
+ Region aInvalidateRegion;
+ BOOL bScrollChilds = (nFlags & SCROLL_CHILDREN) != 0;
+ BOOL bErase = (nFlags & SCROLL_NOERASE) == 0;
+
+ if ( !mpFirstChild )
+ bScrollChilds = FALSE;
+
+ // Paint-Bereiche anpassen
+ ImplMoveAllInvalidateRegions( rRect, nHorzScroll, nVertScroll, bScrollChilds );
+
+ if ( !(nFlags & SCROLL_NOINVALIDATE) )
+ {
+ ImplCalcOverlapRegion( rRect, aInvalidateRegion, !bScrollChilds, TRUE, FALSE );
+ if ( !aInvalidateRegion.IsEmpty() )
+ {
+ aInvalidateRegion.Move( nHorzScroll, nVertScroll );
+ bErase = TRUE;
+ }
+ if ( !(nFlags & SCROLL_NOWINDOWINVALIDATE) )
+ {
+ Rectangle aDestRect( rRect );
+ aDestRect.Move( nHorzScroll, nVertScroll );
+ Region aWinInvalidateRegion( rRect );
+ aWinInvalidateRegion.Exclude( aDestRect );
+ aInvalidateRegion.Union( aWinInvalidateRegion );
+ }
+ }
+
+ Point aPoint( mnOutOffX, mnOutOffY );
+ Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
+ if ( nFlags & SCROLL_CLIP )
+ aRegion.Intersect( rRect );
+ if ( mbWinRegion )
+ aRegion.Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+ aRegion.Exclude( aInvalidateRegion );
+ ImplClipBoundaries( aRegion, FALSE, TRUE );
+ if ( !bScrollChilds )
+ {
+ if ( nOrgFlags & SCROLL_NOCHILDREN )
+ ImplClipAllChilds( aRegion );
+ else
+ ImplClipChilds( aRegion );
+ }
+ if ( mbClipRegion && (nFlags & SCROLL_USECLIPREGION) )
+ aRegion.Intersect( maRegion );
+ if ( !aRegion.IsEmpty() )
+ {
+ if ( mpWinData )
+ {
+ if ( mbFocusVisible )
+ ImplInvertFocus( *(mpWinData->mpFocusRect) );
+ if ( mbTrackVisible && (mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
+ InvertTracking( *(mpWinData->mpTrackRect), mpWinData->mnTrackFlags );
+ }
+
+#ifndef REMOTE_APPSERVER
+ SalGraphics* pGraphics = ImplGetFrameGraphics();
+ if ( pGraphics )
+ {
+ ImplSelectClipRegion( pGraphics, aRegion );
+ pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll,
+ rRect.Left(), rRect.Top(),
+ rRect.GetWidth(), rRect.GetHeight(),
+ SAL_COPYAREA_WINDOWINVALIDATE );
+ }
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics( TRUE );
+ if ( pGraphics )
+ {
+ pGraphics->SetClipRegion( aRegion );
+ pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll,
+ rRect.Left(), rRect.Top(),
+ rRect.GetWidth(), rRect.GetHeight(),
+ COPYAREA_WINDOWINVALIDATE );
+ }
+#endif
+
+ if ( mpWinData )
+ {
+ if ( mbFocusVisible )
+ ImplInvertFocus( *(mpWinData->mpFocusRect) );
+ if ( mbTrackVisible && (mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
+ InvertTracking( *(mpWinData->mpTrackRect), mpWinData->mnTrackFlags );
+ }
+ }
+
+ if ( !aInvalidateRegion.IsEmpty() )
+ {
+ USHORT nPaintFlags = INVALIDATE_CHILDREN;
+ if ( !bErase )
+ nPaintFlags |= INVALIDATE_NOERASE;
+ if ( !bScrollChilds )
+ {
+ if ( nOrgFlags & SCROLL_NOCHILDREN )
+ ImplClipAllChilds( aInvalidateRegion );
+ else
+ ImplClipChilds( aInvalidateRegion );
+ }
+ ImplInvalidateFrameRegion( &aInvalidateRegion, nPaintFlags );
+ }
+
+ if ( bScrollChilds )
+ {
+ Rectangle aDestRect( rRect );
+ Window* pWindow = mpFirstChild;
+ while ( pWindow )
+ {
+ Rectangle aWinRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
+ Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
+ if ( aDestRect.IsOver( aWinRect ) )
+ {
+ pWindow->mnX += nHorzScroll;
+ pWindow->maPos.X() += nHorzScroll;
+ pWindow->mnY += nVertScroll;
+ pWindow->maPos.Y() += nVertScroll;
+#ifndef REMOTE_APPSERVER
+ if ( pWindow->ImplUpdatePos() )
+ pWindow->ImplUpdateSysObjPos();
+#else
+ pWindow->ImplUpdatePos();
+#endif
+ if ( pWindow->IsReallyVisible() )
+ pWindow->ImplSetClipFlag();
+ if ( pWindow->mpClientWindow )
+ pWindow->mpClientWindow->maPos = pWindow->maPos;
+ if ( pWindow->IsVisible() )
+ {
+ pWindow->mbCallMove = FALSE;
+ pWindow->Move();
+ }
+ else
+ pWindow->mbCallMove = TRUE;
+ }
+ pWindow = pWindow->mpNext;
+ }
+ }
+
+ if ( nFlags & SCROLL_UPDATE )
+ Update();
+
+ if ( mpCursor )
+ mpCursor->ImplShow( FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplUpdateAll( BOOL bOverlapWindows )
+{
+ if ( !mbReallyVisible )
+ return;
+
+ BOOL bFlush = FALSE;
+ if ( mpFrameWindow->mbPaintFrame )
+ {
+ Point aPoint( 0, 0 );
+ Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
+ ImplInvalidateOverlapFrameRegion( aRegion );
+ if ( mbFrame || (mpBorderWindow && mpBorderWindow->mbFrame) )
+ bFlush = TRUE;
+ }
+
+ // Ein Update wirkt immer auf das OverlapWindow, damit bei spaeteren
+ // Paints nicht zuviel gemalt wird, wenn dort ALLCHILDREN usw. gesetzt
+ // ist
+ Window* pWindow = ImplGetFirstOverlapWindow();
+ if ( bOverlapWindows )
+ pWindow->ImplCallOverlapPaint();
+ else
+ {
+ if ( pWindow->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDS) )
+ pWindow->ImplCallPaint( NULL, pWindow->mnPaintFlags );
+ }
+
+ if ( bFlush )
+ Flush();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplUpdateWindowPtr( Window* pWindow )
+{
+ if ( mpFrameWindow != pWindow->mpFrameWindow )
+ {
+ // Graphic freigeben
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+#else
+ ImplReleaseServerGraphics();
+ mpGraphics = pWindow->mpFrameWindow->mpGraphics;
+#endif
+ }
+
+ mpFrameData = pWindow->mpFrameData;
+ mpFrame = pWindow->mpFrame;
+ mpFrameWindow = pWindow->mpFrameWindow;
+ if ( pWindow->ImplIsOverlapWindow() )
+ mpOverlapWindow = pWindow;
+ else
+ mpOverlapWindow = pWindow->mpOverlapWindow;
+
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->ImplUpdateWindowPtr( pWindow );
+ pChild = pChild->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplUpdateWindowPtr()
+{
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->ImplUpdateWindowPtr( this );
+ pChild = pChild->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplUpdateOverlapWindowPtr( BOOL bNewFrame )
+{
+ BOOL bVisible = IsVisible();
+ Show( FALSE );
+ ImplRemoveWindow( bNewFrame );
+ Window* pRealParent = mpRealParent;
+ ImplInsertWindow( ImplGetParent() );
+ mpRealParent = pRealParent;
+ ImplUpdateWindowPtr();
+#ifndef REMOTE_APPSERVER
+ if ( ImplUpdatePos() )
+ ImplUpdateSysObjPos();
+#else
+ ImplUpdatePos();
+#endif
+
+ if ( bNewFrame )
+ {
+ Window* pOverlapWindow = mpFirstOverlap;
+ while ( pOverlapWindow )
+ {
+ Window* pNextOverlapWindow = pOverlapWindow->mpNext;
+ pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame );
+ pOverlapWindow = pNextOverlapWindow;
+ }
+ }
+
+ if ( bVisible )
+ Show( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplUpdatePos()
+{
+ BOOL bSysChild = FALSE;
+
+ if ( ImplIsOverlapWindow() )
+ {
+ mnOutOffX = mnX;
+ mnOutOffY = mnY;
+ }
+ else
+ {
+ Window* pParent = ImplGetParent();
+ mnOutOffX = mnX+pParent->mnOutOffX;
+ mnOutOffY = mnY+pParent->mnOutOffY;
+ }
+
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ if ( pChild->ImplUpdatePos() )
+ bSysChild = TRUE;
+ pChild = pChild->mpNext;
+ }
+
+#ifndef REMOTE_APPSERVER
+ if ( mpSysObj )
+ bSysChild = TRUE;
+#endif
+
+ return bSysChild;
+}
+
+// -----------------------------------------------------------------------
+
+#ifndef REMOTE_APPSERVER
+void Window::ImplUpdateSysObjPos()
+{
+ if ( mpSysObj )
+ mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
+
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->ImplUpdateSysObjPos();
+ pChild = pChild->mpNext;
+ }
+}
+#endif
+
+// -----------------------------------------------------------------------
+
+/* --- RTL ---
+void Window::ImplAlignChilds()
+{
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->ImplPosSizeWindow( pChild->maPos.X(), 0, 0, 0, WINDOW_POSSIZE_X );
+ pChild = pChild->mpNext;
+ }
+}
+*/
+
+// -----------------------------------------------------------------------
+
+void Window::ImplPosSizeWindow( long nX, long nY,
+ long nWidth, long nHeight, USHORT nFlags )
+{
+ BOOL bNewPos = FALSE;
+ BOOL bNewSize = FALSE;
+ BOOL bNewWidth = FALSE;
+ BOOL bCopyBits = FALSE;
+ long nOldOutOffX = mnOutOffX;
+ long nOldOutOffY = mnOutOffY;
+ long nOldOutWidth = mnOutWidth;
+ long nOldOutHeight = mnOutHeight;
+ Region* pOverlapRegion = NULL;
+ Region* pOldRegion = NULL;
+
+ if ( IsReallyVisible() )
+ {
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+
+ Rectangle aOldWinRect( Point( nOldOutOffX, nOldOutOffY ),
+ Size( nOldOutWidth, nOldOutHeight ) );
+ pOldRegion = new Region( aOldWinRect );
+ if ( mbWinRegion )
+ pOldRegion->Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+
+ if ( mnOutWidth && mnOutHeight && !mbPaintTransparent &&
+ !mbInitWinClipRegion && !maWinClipRegion.IsEmpty() &&
+ !HasPaintEvent() )
+ bCopyBits = TRUE;
+ }
+
+ if ( nFlags & WINDOW_POSSIZE_WIDTH )
+ {
+ if ( nWidth < 0 )
+ nWidth = 0;
+ if ( nWidth != mnOutWidth )
+ {
+/* --- RTL ---
+ if ( !ImplIsOverlapWindow() )
+ {
+ if ( !(nFlags & WINDOW_POSSIZE_X) )
+ {
+ nFlags |= WINDOW_POSSIZE_X;
+ nX = mnX;
+ }
+ }
+*/
+ mnOutWidth = nWidth;
+ bNewSize = TRUE;
+ bCopyBits = FALSE;
+ bNewWidth = TRUE;
+ }
+ }
+ if ( nFlags & WINDOW_POSSIZE_HEIGHT )
+ {
+ if ( nHeight < 0 )
+ nHeight = 0;
+ if ( nHeight != mnOutHeight )
+ {
+ mnOutHeight = nHeight;
+ bNewSize = TRUE;
+ bCopyBits = FALSE;
+ }
+ }
+
+ if ( nFlags & WINDOW_POSSIZE_X )
+ {
+ if ( nX != mnX )
+ {
+ long nOrgX = nX;
+/* --- RTL ---
+ if ( !ImplIsOverlapWindow() )
+ nX = mpParent->mnOutWidth-mnOutWidth-nX;
+*/
+
+ if ( bCopyBits && !pOverlapRegion )
+ {
+ pOverlapRegion = new Region();
+ ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) ),
+ *pOverlapRegion, FALSE, TRUE, TRUE );
+ }
+ mnX = nX;
+ maPos.X() = nOrgX;
+ bNewPos = TRUE;
+ }
+ }
+ if ( nFlags & WINDOW_POSSIZE_Y )
+ {
+ if ( nY != mnY )
+ {
+ if ( bCopyBits && !pOverlapRegion )
+ {
+ pOverlapRegion = new Region();
+ ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) ),
+ *pOverlapRegion, FALSE, TRUE, TRUE );
+ }
+ mnY = nY;
+ maPos.Y() = nY;
+ bNewPos = TRUE;
+ }
+ }
+
+ if ( bNewPos || bNewSize )
+ {
+#ifndef REMOTE_APPSERVER
+ BOOL bUpdateSysObjPos = FALSE;
+ if ( bNewPos )
+ bUpdateSysObjPos = ImplUpdatePos();
+#else
+ if ( bNewPos )
+ ImplUpdatePos();
+#endif
+
+ if ( mpClientWindow )
+ {
+ mpClientWindow->ImplPosSizeWindow( mpClientWindow->mnLeftBorder,
+ mpClientWindow->mnTopBorder,
+ mnOutWidth-mpClientWindow->mnLeftBorder-mpClientWindow->mnRightBorder,
+ mnOutHeight-mpClientWindow->mnTopBorder-mpClientWindow->mnBottomBorder,
+ WINDOW_POSSIZE_X | WINDOW_POSSIZE_Y |
+ WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT );
+ // Wenn wir ein ClientWindow haben, dann hat dieses fuer die
+ // Applikation auch die Position des FloatingWindows
+ mpClientWindow->maPos = maPos;
+ if ( bNewPos )
+ {
+ if ( mpClientWindow->IsVisible() )
+ {
+ mpClientWindow->mbCallMove = FALSE;
+ mpClientWindow->Move();
+ }
+ else
+ mpClientWindow->mbCallMove = TRUE;
+ }
+ }
+ else
+ {
+ if ( mpBorderWindow )
+ maPos = mpBorderWindow->maPos;
+ }
+
+/* --- RTL ---
+ if ( bNewWidth && !ImplIsOverlapWindow() )
+ ImplAlignChilds();
+*/
+
+ // Move()/Resize() werden erst bei Show() gerufen, damit min. eins vor
+ // einem Show() kommt
+ if ( IsVisible() )
+ {
+ if ( bNewPos )
+ {
+ mbCallMove = FALSE;
+ Move();
+ }
+ if ( bNewSize )
+ {
+ mbCallResize = FALSE;
+ Resize();
+ }
+ }
+ else
+ {
+ if ( bNewPos )
+ mbCallMove = TRUE;
+ if ( bNewSize )
+ mbCallResize = TRUE;
+ }
+
+#ifndef REMOTE_APPSERVER
+ BOOL bUpdateSysObjClip = FALSE;
+#endif
+ if ( IsReallyVisible() )
+ {
+ if ( bNewPos || bNewSize )
+ {
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpOverlapData && mpOverlapData->mpSaveBackDev )
+ ImplDeleteOverlapBackground();
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+ // Clip-Flag neu setzen
+#ifndef REMOTE_APPSERVER
+ bUpdateSysObjClip = !ImplSetClipFlag( TRUE );
+#else
+ ImplSetClipFlag();
+#endif
+ }
+
+ // Fensterinhalt invalidieren ?
+ if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) )
+ {
+ if ( bNewPos )
+ {
+ BOOL bInvalidate = FALSE;
+ BOOL bParentPaint = TRUE;
+ if ( !ImplIsOverlapWindow() )
+ bParentPaint = mpParent->IsPaintEnabled();
+ if ( bCopyBits && bParentPaint && !HasPaintEvent() )
+ {
+ Point aPoint( mnOutOffX, mnOutOffY );
+ Region aRegion( Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ if ( mbWinRegion )
+ aRegion.Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+ ImplClipBoundaries( aRegion, FALSE, TRUE );
+ if ( !pOverlapRegion->IsEmpty() )
+ {
+ pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY );
+ aRegion.Exclude( *pOverlapRegion );
+ }
+ if ( !aRegion.IsEmpty() )
+ {
+ // Paint-Bereiche anpassen
+ ImplMoveAllInvalidateRegions( Rectangle( Point( nOldOutOffX, nOldOutOffY ),
+ Size( nOldOutWidth, nOldOutHeight ) ),
+ mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY,
+ TRUE );
+#ifndef REMOTE_APPSERVER
+ SalGraphics* pGraphics = ImplGetFrameGraphics();
+ if ( pGraphics )
+ {
+ BOOL bSelectClipRegion = ImplSelectClipRegion( pGraphics, aRegion );
+ if ( bSelectClipRegion )
+ {
+ pGraphics->CopyArea( mnOutOffX, mnOutOffY,
+ nOldOutOffX, nOldOutOffY,
+ nOldOutWidth, nOldOutHeight,
+ SAL_COPYAREA_WINDOWINVALIDATE );
+ }
+ else
+ bInvalidate = TRUE;
+ }
+ else
+ bInvalidate = TRUE;
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics( TRUE );
+ if ( pGraphics )
+ {
+ pGraphics->SetClipRegion( aRegion );
+ pGraphics->CopyArea( mnOutOffX, mnOutOffY,
+ nOldOutOffX, nOldOutOffY,
+ nOldOutWidth, nOldOutHeight,
+ COPYAREA_WINDOWINVALIDATE );
+ }
+ else
+ bInvalidate = TRUE;
+#endif
+ if ( !bInvalidate )
+ {
+ if ( !pOverlapRegion->IsEmpty() )
+ ImplInvalidateFrameRegion( pOverlapRegion, INVALIDATE_CHILDREN );
+ }
+ }
+ }
+ else
+ bInvalidate = TRUE;
+ if ( bInvalidate )
+ ImplInvalidateFrameRegion( NULL, INVALIDATE_CHILDREN );
+ }
+ else
+ {
+ Point aPoint( mnOutOffX, mnOutOffY );
+ Region aRegion( Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ aRegion.Exclude( *pOldRegion );
+ if ( mbWinRegion )
+ aRegion.Intersect( ImplPixelToDevicePixel( maWinRegion ) );
+ ImplClipBoundaries( aRegion, FALSE, TRUE );
+ if ( !aRegion.IsEmpty() )
+ ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN );
+ }
+ }
+
+ // Parent oder Overlaps invalidieren
+ if ( bNewPos ||
+ (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) )
+ {
+ Region aRegion( *pOldRegion );
+ if ( !mbPaintTransparent )
+ ImplExcludeWindowRegion( aRegion );
+ ImplClipBoundaries( aRegion, FALSE, TRUE );
+ if ( !aRegion.IsEmpty() && !mpBorderWindow )
+ ImplInvalidateParentFrameRegion( aRegion );
+ }
+ }
+
+#ifndef REMOTE_APPSERVER
+ // System-Objekte anpassen
+ if ( bUpdateSysObjClip )
+ ImplUpdateSysObjClip();
+ if ( bUpdateSysObjPos )
+ ImplUpdateSysObjPos();
+ if ( bNewSize && mpSysObj )
+ mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
+#endif
+ }
+
+ if ( pOverlapRegion )
+ delete pOverlapRegion;
+ if ( pOldRegion )
+ delete pOldRegion;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplToBottomChild()
+{
+ if ( !ImplIsOverlapWindow() && !mbReallyVisible && (mpParent->mpLastChild != this) )
+ {
+ // Fenster an das Ende der Liste setzen
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ mpParent->mpFirstChild = mpNext;
+ mpNext->mpPrev = mpPrev;
+ mpPrev = mpParent->mpLastChild;
+ mpParent->mpLastChild = this;
+ mpPrev->mpNext = this;
+ mpNext = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCalcToTop( ImplCalcToTopData* pPrevData )
+{
+ DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplCalcToTop(): Is not a OverlapWindow" );
+
+ if ( !mbFrame )
+ {
+ if ( IsReallyVisible() )
+ {
+ // Region berechnen, wo das Fenster mit anderen Fenstern ueberlappt
+ Point aPoint( mnOutOffX, mnOutOffY );
+ Region aRegion( Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ Region aInvalidateRegion;
+ ImplCalcOverlapRegionOverlaps( aRegion, aInvalidateRegion );
+
+ if ( !aInvalidateRegion.IsEmpty() )
+ {
+ ImplCalcToTopData* pData = new ImplCalcToTopData;
+ pPrevData->mpNext = pData;
+ pData->mpNext = NULL;
+ pData->mpWindow = this;
+ pData->mpInvalidateRegion = new Region( aInvalidateRegion );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCalcChildOverlapToTop( ImplCalcToTopData* pPrevData )
+{
+ DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplCalcChildOverlapToTop(): Is not a OverlapWindow" );
+
+ ImplCalcToTop( pPrevData );
+ if ( pPrevData->mpNext )
+ pPrevData = pPrevData->mpNext;
+
+ Window* pOverlap = mpFirstOverlap;
+ while ( pOverlap )
+ {
+ pOverlap->ImplCalcToTop( pPrevData );
+ if ( pPrevData->mpNext )
+ pPrevData = pPrevData->mpNext;
+ pOverlap = pOverlap->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplToTop( USHORT nFlags )
+{
+ DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplToTop(): Is not a OverlapWindow" );
+
+ if ( mbFrame )
+ {
+ // Wenn in das externe Fenster geklickt wird, ist dieses
+ // dafuer zustaendig dafuer zu sorgen, das unser Frame
+ // nach vorne kommt
+ if ( !mpFrameData->mbHasFocus &&
+ !mpFrameData->mbSysObjFocus &&
+ !mpFrameData->mbInSysObjFocusHdl &&
+ !mpFrameData->mbInSysObjToTopHdl )
+ {
+#ifndef REMOTE_APPSERVER
+ USHORT nSysFlags = 0;
+ if ( nFlags & TOTOP_RESTOREWHENMIN )
+ nSysFlags = SAL_FRAME_TOTOP_RESTOREWHENMIN;
+ if ( nFlags & TOTOP_FOREGROUNDTASK )
+ nSysFlags = SAL_FRAME_TOTOP_FOREGROUNDTASK;
+ mpFrame->ToTop( nSysFlags );
+#else
+ mpFrame->ToTop( nFlags );
+#endif
+ }
+ }
+ else
+ {
+ if ( mpOverlapWindow->mpFirstOverlap != this )
+ {
+ // Fenster aus der Liste entfernen
+ mpPrev->mpNext = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ mpOverlapWindow->mpLastOverlap = mpPrev;
+
+ // AlwaysOnTop beruecksichtigen
+ BOOL bOnTop = IsAlwaysOnTopEnabled();
+ Window* pNextWin = mpOverlapWindow->mpFirstOverlap;
+ if ( !bOnTop )
+ {
+ while ( pNextWin )
+ {
+ if ( !pNextWin->IsAlwaysOnTopEnabled() )
+ break;
+ pNextWin = pNextWin->mpNext;
+ }
+ }
+
+ // TopLevel abpruefen
+ BYTE nTopLevel = mpOverlapData->mnTopLevel;
+ while ( pNextWin )
+ {
+ if ( (bOnTop != pNextWin->IsAlwaysOnTopEnabled()) ||
+ (nTopLevel <= pNextWin->mpOverlapData->mnTopLevel) )
+ break;
+ pNextWin = pNextWin->mpNext;
+ }
+
+ // Fenster in die Liste wieder eintragen
+ mpNext = pNextWin;
+ if ( pNextWin )
+ {
+ mpPrev = pNextWin->mpPrev;
+ pNextWin->mpPrev = this;
+ }
+ else
+ {
+ mpPrev = mpOverlapWindow->mpLastOverlap;
+ mpOverlapWindow->mpLastOverlap = this;
+ }
+ if ( mpPrev )
+ mpPrev->mpNext = this;
+ else
+ mpOverlapWindow->mpFirstOverlap = this;
+
+ // ClipRegion muss von diesem Fenster und allen weiteren
+ // ueberlappenden Fenstern neu berechnet werden.
+ if ( IsReallyVisible() )
+ {
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+ mpOverlapWindow->ImplSetClipFlagOverlapWindows();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplStartToTop( USHORT nFlags )
+{
+ ImplCalcToTopData aStartData;
+ ImplCalcToTopData* pCurData;
+ ImplCalcToTopData* pNextData;
+ Window* pOverlapWindow;
+ if ( ImplIsOverlapWindow() )
+ pOverlapWindow = this;
+ else
+ pOverlapWindow = mpOverlapWindow;
+
+ // Zuerst die Paint-Bereiche berechnen
+ Window* pTempOverlapWindow = pOverlapWindow;
+ aStartData.mpNext = NULL;
+ pCurData = &aStartData;
+ do
+ {
+ pTempOverlapWindow->ImplCalcToTop( pCurData );
+ if ( pCurData->mpNext )
+ pCurData = pCurData->mpNext;
+ pTempOverlapWindow = pTempOverlapWindow->mpOverlapWindow;
+ }
+ while ( !pTempOverlapWindow->mbFrame );
+ // Dann die Paint-Bereiche der ChildOverlap-Windows berechnen
+ pTempOverlapWindow = mpFirstOverlap;
+ while ( pTempOverlapWindow )
+ {
+ pTempOverlapWindow->ImplCalcToTop( pCurData );
+ if ( pCurData->mpNext )
+ pCurData = pCurData->mpNext;
+ pTempOverlapWindow = pTempOverlapWindow->mpNext;
+ }
+
+ // Dann die Fenster-Verkettung aendern
+ pTempOverlapWindow = pOverlapWindow;
+ do
+ {
+ pTempOverlapWindow->ImplToTop( nFlags );
+ pTempOverlapWindow = pTempOverlapWindow->mpOverlapWindow;
+ }
+ while ( !pTempOverlapWindow->mbFrame );
+ // Und zum Schluss invalidieren wir die ungueltigen Bereiche
+ pCurData = aStartData.mpNext;
+ while ( pCurData )
+ {
+ pCurData->mpWindow->ImplInvalidateFrameRegion( pCurData->mpInvalidateRegion, INVALIDATE_CHILDREN );
+ pNextData = pCurData->mpNext;
+ delete pCurData->mpInvalidateRegion;
+ delete pCurData;
+ pCurData = pNextData;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplFocusToTop( USHORT nFlags, BOOL bReallyVisible )
+{
+ // Soll Focus auch geholt werden?
+ if ( !(nFlags & TOTOP_NOGRABFOCUS) )
+ {
+ // Erstes Fenster mit GrabFocus-Activate bekommt den Focus
+ Window* pFocusWindow = this;
+ while ( !pFocusWindow->ImplIsOverlapWindow() )
+ {
+ // Nur wenn Fenster kein Border-Fenster hat, da wir
+ // immer das dazugehoerende BorderFenster finden wollen
+ if ( !pFocusWindow->mpBorderWindow )
+ {
+ if ( pFocusWindow->mnActivateMode & ACTIVATE_MODE_GRABFOCUS )
+ break;
+ }
+ pFocusWindow = pFocusWindow->ImplGetParent();
+ }
+ if ( (pFocusWindow->mnActivateMode & ACTIVATE_MODE_GRABFOCUS) &&
+ !pFocusWindow->HasChildPathFocus( TRUE ) )
+ pFocusWindow->GrabFocus();
+ }
+
+ if ( bReallyVisible )
+ ImplGenerateMouseMove();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplShowAllOverlaps()
+{
+ Window* pOverlapWindow = mpFirstOverlap;
+ while ( pOverlapWindow )
+ {
+ if ( pOverlapWindow->mbOverlapVisible )
+ {
+ pOverlapWindow->Show( TRUE, SHOW_NOACTIVATE );
+ pOverlapWindow->mbOverlapVisible = FALSE;
+ }
+
+ pOverlapWindow = pOverlapWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplHideAllOverlaps()
+{
+ Window* pOverlapWindow = mpFirstOverlap;
+ while ( pOverlapWindow )
+ {
+ if ( pOverlapWindow->IsVisible() )
+ {
+ pOverlapWindow->mbOverlapVisible = TRUE;
+ pOverlapWindow->Show( FALSE );
+ }
+
+ pOverlapWindow = pOverlapWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCallMouseMove( USHORT nMouseCode, BOOL bModChanged )
+{
+ if ( mpFrameData->mbMouseIn && mpFrameWindow->mbReallyVisible )
+ {
+ ULONG nTime = Time::GetSystemTicks();
+ long nX = mpFrameData->mnLastMouseX;
+ long nY = mpFrameData->mnLastMouseY;
+ USHORT nCode = nMouseCode;
+ USHORT nMode = mpFrameData->mnMouseMode;
+ BOOL bLeave;
+ // Auf MouseLeave testen
+ if ( ((nX < 0) || (nY < 0) ||
+ (nX >= mpFrameWindow->mnOutWidth) ||
+ (nY >= mpFrameWindow->mnOutHeight)) &&
+ !ImplGetSVData()->maWinData.mpCaptureWin )
+ bLeave = TRUE;
+ else
+ bLeave = FALSE;
+ nMode |= MOUSE_SYNTHETIC;
+ if ( bModChanged )
+ nMode |= MOUSE_MODIFIERCHANGED;
+ ImplHandleMouseEvent( mpFrameWindow, EVENT_MOUSEMOVE, bLeave, nX, nY, nTime, nCode, nMode );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplGenerateMouseMove()
+{
+ if ( !mpFrameData->mnMouseMoveId )
+ Application::PostUserEvent( mpFrameData->mnMouseMoveId, LINK( mpFrameWindow, Window, ImplGenerateMouseMoveHdl ) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Window, ImplGenerateMouseMoveHdl, void*, EMPTYARG )
+{
+ mpFrameData->mnMouseMoveId = 0;
+ ImplCallMouseMove( mpFrameData->mnMouseCode );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInvertFocus( const Rectangle& rRect )
+{
+ InvertTracking( rRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow,
+ Window* pOldOverlapWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ Window* pNewRealWindow;
+ Window* pOldRealWindow;
+ Window* pLastRealWindow;
+ BOOL bCallActivate = TRUE;
+ BOOL bCallDeactivate = TRUE;
+
+ pOldRealWindow = pOldOverlapWindow->ImplGetWindow();
+ pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
+ if ( (pOldRealWindow->GetType() != WINDOW_FLOATINGWINDOW) ||
+ pOldRealWindow->GetActivateMode() )
+ {
+ if ( (pNewRealWindow->GetType() == WINDOW_FLOATINGWINDOW) &&
+ !pNewRealWindow->GetActivateMode() )
+ {
+ pSVData->maWinData.mpLastDeacWin = pOldOverlapWindow;
+ bCallDeactivate = FALSE;
+ }
+ }
+ else if ( (pNewRealWindow->GetType() != WINDOW_FLOATINGWINDOW) ||
+ pNewRealWindow->GetActivateMode() )
+ {
+ if ( pSVData->maWinData.mpLastDeacWin )
+ {
+ if ( pSVData->maWinData.mpLastDeacWin == pNewOverlapWindow )
+ bCallActivate = FALSE;
+ else
+ {
+ pLastRealWindow = pSVData->maWinData.mpLastDeacWin->ImplGetWindow();
+ pSVData->maWinData.mpLastDeacWin->mbActive = FALSE;
+ pSVData->maWinData.mpLastDeacWin->Deactivate();
+ if ( pLastRealWindow != pSVData->maWinData.mpLastDeacWin )
+ {
+ pLastRealWindow->mbActive = TRUE;
+ pLastRealWindow->Activate();
+ }
+ }
+ pSVData->maWinData.mpLastDeacWin = NULL;
+ }
+ }
+
+ if ( bCallDeactivate )
+ {
+ pOldOverlapWindow->mbActive = FALSE;
+ pOldOverlapWindow->Deactivate();
+ if ( pOldRealWindow != pOldOverlapWindow )
+ {
+ pOldRealWindow->mbActive = FALSE;
+ pOldRealWindow->Deactivate();
+ }
+ }
+ if ( bCallActivate )
+ {
+ pNewOverlapWindow->mbActive = TRUE;
+ pNewOverlapWindow->Activate();
+ if ( pNewRealWindow != pNewOverlapWindow )
+ {
+ pNewRealWindow->mbActive = TRUE;
+ pNewRealWindow->Activate();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplGrabFocus( USHORT nFlags )
+{
+ // Es soll immer das Client-Fenster den Focus bekommen. Falls
+ // wir mal auch Border-Fenstern den Focus geben wollen,
+ // muessten wir bei allen GrabFocus()-Aufrufen in VCL dafuer
+ // sorgen, das es an der Stelle gemacht wird. Dies wuerde
+ // beispielsweise bei ToTop() der Fall sein.
+ if ( mpClientWindow )
+ {
+ // Wegen nicht ganz durchdachtem Konzept muessen wir hier
+ // leider noch einen Hack einbauen, damit wenn Dialoge
+ // geschlossen werden der Focus wieder auf das richtige
+ // Fenster zurueckgesetzt wird
+ if ( mpLastFocusWindow && (mpLastFocusWindow != this) &&
+ !(mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) &&
+ mpLastFocusWindow->IsEnabled() )
+ mpLastFocusWindow->GrabFocus();
+ else
+ mpClientWindow->GrabFocus();
+ return;
+ }
+ else if ( mbFrame )
+ {
+ // Wegen nicht ganz durchdachtem Konzept muessen wir hier
+ // leider noch einen Hack einbauen, damit wenn Dialoge
+ // geschlossen werden der Focus wieder auf das richtige
+ // Fenster zurueckgesetzt wird
+ if ( mpLastFocusWindow && (mpLastFocusWindow != this) &&
+ !(mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) &&
+ mpLastFocusWindow->IsEnabled() )
+ {
+ mpLastFocusWindow->GrabFocus();
+ return;
+ }
+ }
+
+ // Wir brauchen Focus nur setzen, wenn es diesen noch nicht hat
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maWinData.mpFocusWin != this )
+ {
+ // Dieses Fenster als letztes FocusWindow merken
+ Window* pOverlapWindow = ImplGetFirstOverlapWindow();
+ pOverlapWindow->mpLastFocusWindow = this;
+ mpFrameData->mpFocusWin = this;
+
+#ifndef REMOTE_APPSERVER
+ if ( !mpSysObj && !mpFrameData->mbHasFocus )
+#else
+ if ( !mpFrameData->mbHasFocus )
+#endif
+ {
+ // Hier setzen wir schon den Focus um, da ToTop() den Focus
+ // nicht auf ein anderes Fenster setzen darf
+ DBG_WARNING( "Window::GrabFocus() - Frame doesn't have the focus" );
+ mpFrame->ToTop( 0 );
+ return;
+ }
+
+ Window* pOldFocusWindow = pSVData->maWinData.mpFocusWin;
+ pSVData->maWinData.mpFocusWin = this;
+
+ if ( pOldFocusWindow )
+ {
+ // Cursor hiden
+ if ( pOldFocusWindow->mpCursor )
+ pOldFocusWindow->mpCursor->ImplHide();
+ }
+
+ // !!!!! Wegen altem SV-Office Activate/Deavtivate Handling
+ // !!!!! erstmal so wie frueher
+ if ( pOldFocusWindow )
+ {
+ // Focus merken
+ Window* pOldOverlapWindow = pOldFocusWindow->ImplGetFirstOverlapWindow();
+ Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
+ if ( pOldOverlapWindow != pNewOverlapWindow )
+ ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow );
+ }
+ else
+ {
+ Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
+ Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
+ pNewOverlapWindow->mbActive = TRUE;
+ pNewOverlapWindow->Activate();
+ if ( pNewRealWindow != pNewOverlapWindow )
+ {
+ pNewRealWindow->mbActive = TRUE;
+ pNewRealWindow->Activate();
+ }
+ }
+/*
+ // call Deactivate and Activate
+ Window* pDeactivateParent;
+ Window* pActivateParent;
+ Window* pParent;
+ Window* pLastParent;
+ pDeactivateParent = pOldFocusWindow;
+ while ( pDeactivateParent )
+ {
+ pParent = pDeactivateParent;
+ if ( pParent->ImplIsChild( this ) )
+ break;
+
+ if ( pDeactivateParent->ImplIsOverlapWindow() )
+ {
+ if ( !pDeactivateParent->mbParentActive )
+ break;
+ }
+
+ pDeactivateParent = pDeactivateParent->ImplGetParent();
+ }
+ if ( pOldFocusWindow )
+ {
+ pActivateParent = this;
+ while ( pActivateParent )
+ {
+ pParent = pActivateParent;
+ if ( pParent->ImplIsChild( pOldFocusWindow ) )
+ break;
+
+ if ( pActivateParent->ImplIsOverlapWindow() )
+ {
+ if ( !pActivateParent->mbParentActive )
+ break;
+ }
+
+ pActivateParent = pActivateParent->ImplGetParent();
+ }
+ }
+ else
+ {
+ if ( ImplIsOverlapWindow() )
+ pActivateParent = this;
+ else
+ pActivateParent = mpOverlapWindow;
+ while ( pActivateParent )
+ {
+ if ( pActivateParent->ImplIsOverlapWindow() )
+ {
+ if ( !pActivateParent->mbParentActive )
+ break;
+ }
+
+ pActivateParent = pActivateParent->ImplGetParent();
+ }
+ }
+ if ( pDeactivateParent )
+ {
+ do
+ {
+ pLastParent = pOldFocusWindow;
+ if ( pLastParent != pDeactivateParent )
+ {
+ pParent = pLastParent->ImplGetParent();
+ while ( pParent )
+ {
+ if ( pParent == pDeactivateParent )
+ break;
+ pLastParent = pParent;
+ pParent = pParent->ImplGetParent();
+ }
+ }
+ else
+ pParent = pLastParent;
+
+ pParent->mbActive = FALSE;
+ pParent->Deactivate();
+ pDeactivateParent = pLastParent;
+ }
+ while ( pDeactivateParent != pOldFocusWindow );
+ }
+ do
+ {
+ pLastParent = this;
+ if ( pLastParent != pActivateParent )
+ {
+ pParent = pLastParent->ImplGetParent();
+ while ( pParent )
+ {
+ if ( pParent == pActivateParent )
+ break;
+ pLastParent = pParent;
+ pParent = pParent->ImplGetParent();
+ }
+ }
+ else
+ pParent = pLastParent;
+
+ pParent->mbActive = TRUE;
+ pParent->Activate();
+ pActivateParent = pLastParent;
+ }
+ while ( pActivateParent != this );
+*/
+ // call Get- and LoseFocus
+ if ( pOldFocusWindow )
+ {
+ if ( pOldFocusWindow->IsTracking() &&
+ (pSVData->maWinData.mnTrackFlags & STARTTRACK_FOCUSCANCEL) )
+ pOldFocusWindow->EndTracking( ENDTRACK_CANCEL | ENDTRACK_FOCUS );
+ pOldFocusWindow->EndExtTextInput( EXTTEXTINPUT_END_COMPLETE );
+ NotifyEvent aNEvt( EVENT_LOSEFOCUS, pOldFocusWindow );
+ if ( !ImplCallPreNotify( aNEvt ) )
+ pOldFocusWindow->LoseFocus();
+ pOldFocusWindow->ImplCallDeactivateListeners( this );
+ }
+
+ if ( pSVData->maWinData.mpFocusWin == this )
+ {
+#ifndef REMOTE_APPSERVER
+ if ( mpSysObj )
+ {
+ mpFrameData->mpFocusWin = this;
+ if ( !mpFrameData->mbInSysObjFocusHdl )
+ mpSysObj->GrabFocus();
+ }
+#endif
+
+ if ( pSVData->maWinData.mpFocusWin == this )
+ {
+ if ( mpCursor )
+ mpCursor->ImplShow();
+ mbInFocusHdl = TRUE;
+ mnGetFocusFlags = nFlags;
+ NotifyEvent aNEvt( EVENT_GETFOCUS, this );
+ if ( !ImplCallPreNotify( aNEvt ) )
+ GetFocus();
+ ImplCallActivateListeners( pOldFocusWindow );
+ mnGetFocusFlags = 0;
+ mbInFocusHdl = FALSE;
+ }
+ }
+
+ GetpApp()->FocusChanged();
+ ImplNewInputContext();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplNewInputContext()
+{
+#ifndef REMOTE_APPSERVER
+ SalInputContext aNewContext;
+ const InputContext& rInputContext = GetInputContext();
+ const Font& rFont = rInputContext.GetFont();
+ const XubString& rFontName = rFont.GetName();
+ ImplFontEntry* pFontEntry = NULL;
+ if ( rFontName.Len() )
+ {
+ Size aSize = ImplLogicToDevicePixel( rFont.GetSize() );
+ if ( !aSize.Height() )
+ {
+ // Nur dann Defaultgroesse setzen, wenn Fonthoehe auch in logischen
+ // Koordinaaten 0 ist
+ if ( rFont.GetSize().Height() )
+ aSize.Height() = 1;
+ else
+ aSize.Height() = (12*mnDPIY)/72;
+ }
+ pFontEntry = mpFontCache->Get( mpFontList, rFont, aSize );
+ aNewContext.mpFont = &(mpFontEntry->maFontSelData);
+ }
+ else
+ aNewContext.mpFont = NULL;
+ aNewContext.meCharSet = rFont.GetCharSet();
+ aNewContext.meLanguage = rFont.GetLanguage();
+ aNewContext.mnOptions = rInputContext.GetOptions();
+ ImplGetFrame()->SetInputContext( &aNewContext );
+
+ if ( pFontEntry )
+ mpFontCache->Release( pFontEntry );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+Window::Window( WindowType nType ) :
+ maZoom( 1, 1 ),
+ maWinRegion( REGION_NULL ),
+ maWinClipRegion( REGION_NULL )
+{
+ DBG_CTOR( Window, ImplDbgCheckWindow );
+
+ ImplInitData( nType );
+}
+
+// -----------------------------------------------------------------------
+
+Window::Window( Window* pParent, WinBits nStyle ) :
+ maZoom( 1, 1 ),
+ maWinRegion( REGION_NULL ),
+ maWinClipRegion( REGION_NULL )
+{
+ DBG_CTOR( Window, ImplDbgCheckWindow );
+
+ ImplInitData( WINDOW_WINDOW );
+ ImplInit( pParent, nStyle, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+Window::Window( Window* pParent, const ResId& rResId ) :
+ maZoom( 1, 1 ),
+ maWinRegion( REGION_NULL ),
+ maWinClipRegion( REGION_NULL )
+{
+ DBG_CTOR( Window, ImplDbgCheckWindow );
+
+ ImplInitData( WINDOW_WINDOW );
+ rResId.SetRT( RSC_WINDOW );
+ WinBits nStyle = ImplInitRes( rResId );
+ ImplInit( pParent, nStyle, NULL );
+ ImplLoadRes( rResId );
+
+ if ( !(nStyle & WB_HIDE) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+Window::~Window()
+{
+ DBG_DTOR( Window, ImplDbgCheckWindow );
+
+ mbInDtor = TRUE;
+
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ if ( pWrapper )
+ pWrapper->WindowDestroyed( this );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maHelpData.mpHelpWin && (pSVData->maHelpData.mpHelpWin->GetParent() == this) )
+ ImplDestroyHelpWindow( FALSE );
+
+ DBG_ASSERT( pSVData->maWinData.mpTrackWin != this,
+ "Window::~Window(): Window is in TrackingMode" );
+ DBG_ASSERT( pSVData->maWinData.mpCaptureWin != this,
+ "Window::~Window(): Window has the mouse captured" );
+ DBG_ASSERT( pSVData->maWinData.mpDefDialogParent != this,
+ "Window::~Window(): Window is DefModalDialogParent" );
+
+ // Wegen alter kompatibilitaet
+ if ( pSVData->maWinData.mpTrackWin == this )
+ EndTracking();
+ if ( pSVData->maWinData.mpCaptureWin == this )
+ ReleaseMouse();
+ if ( pSVData->maWinData.mpDefDialogParent == this )
+ pSVData->maWinData.mpDefDialogParent = NULL;
+
+#ifdef DBG_UTIL
+ if ( DbgIsAssert() )
+ {
+ ByteString aErrorStr;
+ BOOL bError = FALSE;
+ Window* pTempWin = mpFrameData->mpFirstOverlap;
+ while ( pTempWin )
+ {
+ if ( ImplIsRealParentPath( pTempWin ) )
+ {
+ bError = TRUE;
+ if ( aErrorStr.Len() )
+ aErrorStr += "; ";
+ aErrorStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ }
+ pTempWin = pTempWin->mpNextOverlap;
+ }
+ if ( bError )
+ {
+ ByteString aTempStr( "Window (" );
+ aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
+ aTempStr += ") with living SystemWindow(s) destroyed: ";
+ aTempStr += aErrorStr;
+ DBG_ERROR( aTempStr.GetBuffer() );
+ }
+
+ if ( mpFirstChild )
+ {
+ ByteString aTempStr( "Window (" );
+ aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
+ aTempStr += ") with living Child(s) destroyed: ";
+ Window* pTempWin = mpFirstChild;
+ while ( pTempWin )
+ {
+ aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ pTempWin = pTempWin->mpNext;
+ if ( pTempWin )
+ aTempStr += "; ";
+ }
+ DBG_ERROR( aTempStr.GetBuffer() );
+ }
+
+ if ( mpFirstOverlap )
+ {
+ ByteString aTempStr( "Window (" );
+ aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
+ aTempStr += ") with living SystemWindow(s) destroyed: ";
+ Window* pTempWin = mpFirstOverlap;
+ while ( pTempWin )
+ {
+ aTempStr += ByteString( pTempWin->GetText(), RTL_TEXTENCODING_UTF8 );
+ pTempWin = pTempWin->mpNext;
+ if ( pTempWin )
+ aTempStr += "; ";
+ }
+ DBG_ERROR( aTempStr.GetBuffer() );
+ }
+ }
+#endif
+
+ // Fenster hiden, um das entsprechende Paint-Handling auszuloesen
+ Hide();
+
+ // Mitteilen, das Fenster zerstoert wird
+ {
+ NotifyEvent aNEvt( EVENT_DESTROY, this );
+ Notify( aNEvt );
+ }
+
+ // Wenn wir den Focus haben, dann den Focus auf ein anderes Fenster setzen
+ Window* pOverlapWindow = ImplGetFirstOverlapWindow();
+ if ( pSVData->maWinData.mpFocusWin == this )
+ {
+ if ( mbFrame )
+ {
+ pSVData->maWinData.mpFocusWin = NULL;
+ pOverlapWindow->mpLastFocusWindow = NULL;
+ GetpApp()->FocusChanged();
+ }
+ else
+ {
+ Window* pParent = GetParent();
+ Window* pBorderWindow = mpBorderWindow;
+ // Bei ueberlappenden Fenstern wird der Focus auf den
+ // Parent vom naechsten FrameWindow gesetzt
+ if ( pBorderWindow )
+ {
+ if ( pBorderWindow->ImplIsOverlapWindow() )
+ pParent = pBorderWindow->mpOverlapWindow;
+ }
+ else if ( ImplIsOverlapWindow() )
+ pParent = mpOverlapWindow;
+ if ( pParent && pParent->IsEnabled() && pParent->IsInputEnabled() )
+ pParent->GrabFocus();
+ else
+ mpFrameWindow->GrabFocus();
+ // Falls der Focus wieder auf uns gesetzt wurde, dann wird er
+ // auf nichts gesetzt
+ if ( pSVData->maWinData.mpFocusWin == this )
+ {
+ pSVData->maWinData.mpFocusWin = NULL;
+ pOverlapWindow->mpLastFocusWindow = NULL;
+ GetpApp()->FocusChanged();
+ }
+ }
+ }
+ if ( pOverlapWindow->mpLastFocusWindow == this )
+ pOverlapWindow->mpLastFocusWindow = NULL;
+
+ // gemerkte Fenster zuruecksetzen
+ if ( mpFrameData->mpFocusWin == this )
+ mpFrameData->mpFocusWin = NULL;
+ if ( mpFrameData->mpMouseMoveWin == this )
+ mpFrameData->mpMouseMoveWin = NULL;
+ if ( mpFrameData->mpMouseDownWin == this )
+ mpFrameData->mpMouseDownWin = NULL;
+
+ // Deactivate-Window zuruecksetzen
+ if ( pSVData->maWinData.mpLastDeacWin == this )
+ pSVData->maWinData.mpLastDeacWin = NULL;
+
+#ifdef REMOTE_APPSERVER
+ {
+ // Events als ungueltig markieren...
+ VOS_NAMESPACE(OGuard,vos) aGuard( pSVData->mpWindowObjectMutex );
+ if ( mpRmEvents )
+ {
+ ExtRmEvent* p = mpRmEvents;
+ while ( p )
+ {
+ p->MarkInvalid();
+ p = p->GetNextWindowEvent();
+ }
+ }
+ }
+#endif
+
+ if ( mbFrame )
+ {
+#ifndef REMOTE_APPSERVER
+ DragManager::SystemEnableDrop( mpFrame, FALSE);
+#endif
+ if ( mpFrameData->mnFocusId )
+ Application::RemoveUserEvent( mpFrameData->mnFocusId );
+ if ( mpFrameData->mnMouseMoveId )
+ Application::RemoveUserEvent( mpFrameData->mnMouseMoveId );
+ }
+
+ // Graphic freigeben
+#ifndef REMOTE_APPSERVER
+ ImplReleaseGraphics();
+#else
+ ImplReleaseServerGraphics();
+#endif
+
+ // Evt. anderen Funktion mitteilen, das das Fenster geloescht
+ // wurde
+ ImplDelData* pDelData = mpFirstDel;
+ while ( pDelData )
+ {
+ pDelData->mbDel = TRUE;
+ pDelData = pDelData->mpNext;
+ }
+
+ // Fenster aus den Listen austragen
+ ImplRemoveWindow( TRUE );
+
+ // Extra Window Daten loeschen
+ if ( mpWinData )
+ {
+ if ( mpWinData->mpExtPosAry )
+ delete [] mpWinData->mpExtPosAry;
+ if ( mpWinData->mpFocusRect )
+ delete mpWinData->mpFocusRect;
+ if ( mpWinData->mpTrackRect )
+ delete mpWinData->mpTrackRect;
+ delete mpWinData;
+ }
+
+ // Overlap-Window-Daten loeschen
+ if ( mpOverlapData )
+ {
+ delete mpOverlapData;
+ }
+
+ // Evt. noch BorderWindow oder Frame zerstoeren
+ if ( mpBorderWindow )
+ delete mpBorderWindow;
+ else if ( mbFrame )
+ {
+ if ( pSVData->maWinData.mpFirstFrame == this )
+ pSVData->maWinData.mpFirstFrame = mpFrameData->mpNextFrame;
+ else
+ {
+ Window* pSysWin = pSVData->maWinData.mpFirstFrame;
+ while ( pSysWin->mpFrameData->mpNextFrame != this )
+ pSysWin = pSysWin->mpFrameData->mpNextFrame;
+ pSysWin->mpFrameData->mpNextFrame = mpFrameData->mpNextFrame;
+ }
+#ifndef REMOTE_APPSERVER
+ mpFrame->SetCallback( NULL, NULL );
+ pSVData->mpDefInst->DestroyFrame( mpFrame );
+#else
+ mpGraphics->SetInterface( REF( NMSP_CLIENT::XRmOutputDevice )() );
+ delete mpFrame;
+#endif
+ if ( mpFrameData->mpDragTimer )
+ delete mpFrameData->mpDragTimer;
+ delete mpFrameData;
+#ifdef REMOTE_APPSERVER
+ delete mpGraphics;
+#endif
+ }
+
+ if ( mpChildClipRegion )
+ delete mpChildClipRegion;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::MouseMove( const MouseEvent& rMEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ NotifyEvent aNEvt( EVENT_MOUSEMOVE, this, &rMEvt );
+ if ( !Notify( aNEvt ) )
+ mbMouseMove = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ NotifyEvent aNEvt( EVENT_MOUSEBUTTONDOWN, this, &rMEvt );
+ if ( !Notify( aNEvt ) )
+ mbMouseButtonDown = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ NotifyEvent aNEvt( EVENT_MOUSEBUTTONUP, this, &rMEvt );
+ if ( !Notify( aNEvt ) )
+ mbMouseButtonUp = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::KeyInput( const KeyEvent& rKEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ NotifyEvent aNEvt( EVENT_KEYINPUT, this, &rKEvt );
+ if ( !Notify( aNEvt ) )
+ mbKeyInput = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::KeyUp( const KeyEvent& rKEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ NotifyEvent aNEvt( EVENT_KEYUP, this, &rKEvt );
+ if ( !Notify( aNEvt ) )
+ mbKeyUp = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Paint( const Rectangle& rRect )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ if ( mxWindowPeer.is() )
+ Application::GetUnoWrapper()->WindowEvent_Paint( this, rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Draw( OutputDevice*, const Point&, const Size&, ULONG )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Move()
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ if ( mxWindowPeer.is() )
+ Application::GetUnoWrapper()->WindowEvent_Move( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Resize()
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ if ( mxWindowPeer.is() )
+ Application::GetUnoWrapper()->WindowEvent_Resize( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Activate()
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Deactivate()
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::GetFocus()
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ if ( HasFocus() && mpLastFocusWindow && !(mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) )
+ mpLastFocusWindow->GrabFocus();
+
+ NotifyEvent aNEvt( EVENT_GETFOCUS, this );
+ Notify( aNEvt );
+
+ if ( Application::GetAccessHdlCount() )
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_GETFOCUS, this ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::LoseFocus()
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ NotifyEvent aNEvt( EVENT_LOSEFOCUS, this );
+ Notify( aNEvt );
+
+ if ( Application::GetAccessHdlCount() )
+ Application::AccessNotify( AccessNotification( ACCESS_EVENT_LOSEFOCUS, this ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::RequestHelp( const HelpEvent& rHEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ // Wenn Balloon-Help angefordert wird, dann den Balloon mit dem
+ // gesetzten Hilfetext anzeigen
+ if ( rHEvt.GetMode() & HELPMODE_BALLOON )
+ {
+ const XubString* pStr = &(GetHelpText());
+ if ( !pStr->Len() )
+ pStr = &(GetQuickHelpText());
+ if ( !pStr->Len() && ImplGetParent() && !ImplIsOverlapWindow() )
+ ImplGetParent()->RequestHelp( rHEvt );
+ else
+ Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), *pStr );
+ }
+ else if ( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ const XubString* pStr = &(GetQuickHelpText());
+ if ( !pStr->Len() && ImplGetParent() && !ImplIsOverlapWindow() )
+ ImplGetParent()->RequestHelp( rHEvt );
+ else
+ {
+ Point aPos = GetPosPixel();
+ if ( ImplGetParent() && !ImplIsOverlapWindow() )
+ aPos = ImplGetParent()->OutputToScreenPixel( aPos );
+ Rectangle aRect( aPos, GetSizePixel() );
+ String aHelpText;
+ if ( pStr->Len() )
+ aHelpText = GetHelpText();
+ Help::ShowQuickHelp( this, aRect, *pStr, aHelpText, QUICKHELP_CTRLTEXT );
+ }
+ }
+ else
+ {
+ ULONG nStartHelpId = GetHelpId();
+
+ if ( !nStartHelpId && ImplGetParent() )
+ ImplGetParent()->RequestHelp( rHEvt );
+ else
+ {
+ if ( !nStartHelpId )
+ nStartHelpId = HELP_INDEX;
+
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ pHelp->Start( nStartHelpId );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Command( const CommandEvent& rCEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ if ( mxWindowPeer.is() )
+ Application::GetUnoWrapper()->WindowEvent_Command( this, rCEvt );
+
+ NotifyEvent aNEvt( EVENT_COMMAND, this, &rCEvt );
+ if ( !Notify( aNEvt ) )
+ mbCommand = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Tracking( const TrackingEvent& )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::QueryDrop( DropEvent& rDEvt )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ NotifyEvent aNEvt( EVENT_QUERYDROP, this, &rDEvt, FALSE );
+ Notify( aNEvt );
+ return (BOOL)aNEvt.GetReturnValue();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::Drop( const DropEvent& rDEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ NotifyEvent aNEvt( EVENT_DROP, this, &rDEvt, FALSE );
+ Notify( aNEvt );
+ return (BOOL)aNEvt.GetReturnValue();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::UserEvent( ULONG, void* )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::StateChanged( StateChangedType )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::DataChanged( const DataChangedEvent& )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+}
+
+// -----------------------------------------------------------------------
+
+long Window::PreNotify( NotifyEvent& rNEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ BOOL bDone = FALSE;
+ if ( mpParent && !ImplIsOverlapWindow() )
+ bDone = mpParent->PreNotify( rNEvt );
+
+ if ( !bDone )
+ {
+ if( rNEvt.GetType() == EVENT_GETFOCUS )
+ {
+ BOOL bCompoundFocusChanged = FALSE;
+ if ( mbCompoundControl && !mbCompoundControlHasFocus && HasChildPathFocus() )
+ {
+ mbCompoundControlHasFocus = TRUE;
+ bCompoundFocusChanged = TRUE;
+ }
+
+ if ( mxWindowPeer.is() && ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) ) )
+ Application::GetUnoWrapper()->WindowEvent_GetFocus( this );
+ }
+ else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
+ {
+ BOOL bCompoundFocusChanged = FALSE;
+ if ( mbCompoundControl && mbCompoundControlHasFocus && !HasChildPathFocus() )
+ {
+ mbCompoundControlHasFocus = FALSE ;
+ bCompoundFocusChanged = TRUE;
+ }
+
+ if ( mxWindowPeer.is() && ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) ) )
+ Application::GetUnoWrapper()->WindowEvent_LoseFocus( this );
+ }
+ else if( rNEvt.GetType() == EVENT_MOUSEMOVE )
+ {
+ if ( mxWindowPeer.is() && ( mbCompoundControl || ( rNEvt.GetWindow() == this ) ) )
+ {
+ if ( rNEvt.GetWindow() == this )
+ Application::GetUnoWrapper()->WindowEvent_MouseMove( this, *rNEvt.GetMouseEvent() );
+ else
+ Application::GetUnoWrapper()->WindowEvent_MouseMove( this, ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) );
+ }
+ }
+ else if( rNEvt.GetType() == EVENT_MOUSEBUTTONUP )
+ {
+ if ( mxWindowPeer.is() && ( mbCompoundControl || ( rNEvt.GetWindow() == this ) ) )
+ {
+ if ( rNEvt.GetWindow() == this )
+ Application::GetUnoWrapper()->WindowEvent_MouseButtonUp( this, *rNEvt.GetMouseEvent() );
+ else
+ Application::GetUnoWrapper()->WindowEvent_MouseButtonUp( this, ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) );
+ }
+ }
+ else if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
+ {
+ if ( mxWindowPeer.is() && ( mbCompoundControl || ( rNEvt.GetWindow() == this ) ) )
+ {
+ if ( rNEvt.GetWindow() == this )
+ Application::GetUnoWrapper()->WindowEvent_MouseButtonDown( this, *rNEvt.GetMouseEvent() );
+ else
+ Application::GetUnoWrapper()->WindowEvent_MouseButtonDown( this, ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) );
+ }
+ }
+ else if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ if ( mxWindowPeer.is() && ( mbCompoundControl || ( rNEvt.GetWindow() == this ) ) )
+ Application::GetUnoWrapper()->WindowEvent_KeyInput( this, *rNEvt.GetKeyEvent() );
+ }
+ else if( rNEvt.GetType() == EVENT_KEYUP )
+ {
+ if ( mxWindowPeer.is() && ( mbCompoundControl || ( rNEvt.GetWindow() == this ) ) )
+ Application::GetUnoWrapper()->WindowEvent_KeyUp( this, *rNEvt.GetKeyEvent() );
+ }
+ }
+
+ return bDone;
+}
+
+// -----------------------------------------------------------------------
+
+long Window::Notify( NotifyEvent& rNEvt )
+{
+ { // Klammerung, da in diesem Handler das Window zerstoert werden darf
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ }
+
+ long nRet = FALSE;
+
+ // Dialog-Steuerung
+ if ( (GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL )
+ {
+ // Wenn Parent auch DialogSteuerung aktiviert hat, uebernimmt dieser die Steuerung
+ if ( (rNEvt.GetType() == EVENT_KEYINPUT) || (rNEvt.GetType() == EVENT_KEYUP) )
+ {
+ if ( ImplIsOverlapWindow() ||
+ ((ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
+ {
+ nRet = ImplDlgCtrl( *rNEvt.GetKeyEvent(), rNEvt.GetType() == EVENT_KEYINPUT );
+ }
+ }
+ else if ( (rNEvt.GetType() == EVENT_GETFOCUS) || (rNEvt.GetType() == EVENT_LOSEFOCUS) )
+ {
+ ImplDlgCtrlFocusChanged( rNEvt.GetWindow(), rNEvt.GetType() == EVENT_GETFOCUS );
+ if ( (rNEvt.GetWindow() == this) && (rNEvt.GetType() == EVENT_GETFOCUS) &&
+ !(GetStyle() & WB_TABSTOP) && !(mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) )
+ {
+ USHORT n = 0;
+ Window* pFirstChild = ImplGetDlgWindow( n, DLGWINDOW_FIRST );
+ if ( pFirstChild )
+ pFirstChild->ImplControlFocus();
+ }
+ }
+ }
+
+ if ( !nRet )
+ {
+ if ( mpParent && !ImplIsOverlapWindow() )
+ nRet = mpParent->Notify( rNEvt );
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Window::PostUserEvent( ULONG nEvent, void* pEventData )
+{
+ ULONG nEventId;
+ PostUserEvent( nEventId, nEvent, pEventData );
+ return nEventId;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Window::PostUserEvent( const Link& rLink, void* pCaller )
+{
+ ULONG nEventId;
+ PostUserEvent( nEventId, rLink, pCaller );
+ return nEventId;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::PostUserEvent( ULONG& rEventId, ULONG nEvent, void* pEventData )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVEvent* pSVEvent = new ImplSVEvent;
+ pSVEvent->mnEvent = nEvent;
+ pSVEvent->mpData = pEventData;
+ pSVEvent->mpLink = NULL;
+ pSVEvent->mpWindow = this;
+ pSVEvent->mbCall = TRUE;
+ ImplAddDel( &(pSVEvent->maDelData) );
+ rEventId = (ULONG)pSVEvent;
+#ifndef REMOTE_APPSERVER
+ if ( mpFrame->PostEvent( pSVEvent ) )
+ return TRUE;
+ else
+ {
+ rEventId = 0;
+ ImplRemoveDel( &(pSVEvent->maDelData) );
+ delete pSVEvent;
+ return FALSE;
+ }
+#else
+ ExtRmEvent* pEvt = new ExtRmEvent( RMEVENT_USEREVENT, NULL, pSVEvent );
+ ImplPostEvent( pEvt );
+ return TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::PostUserEvent( ULONG& rEventId, const Link& rLink, void* pCaller )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVEvent* pSVEvent = new ImplSVEvent;
+ pSVEvent->mnEvent = 0;
+ pSVEvent->mpData = pCaller;
+ pSVEvent->mpLink = new Link( rLink );
+ pSVEvent->mpWindow = this;
+ pSVEvent->mbCall = TRUE;
+ ImplAddDel( &(pSVEvent->maDelData) );
+ rEventId = (ULONG)pSVEvent;
+#ifndef REMOTE_APPSERVER
+ if ( mpFrame->PostEvent( pSVEvent ) )
+ return TRUE;
+ else
+ {
+ rEventId = 0;
+ ImplRemoveDel( &(pSVEvent->maDelData) );
+ delete pSVEvent;
+ return FALSE;
+ }
+#else
+ ExtRmEvent* pEvt = new ExtRmEvent( RMEVENT_USEREVENT, NULL, pSVEvent );
+ ImplPostEvent( pEvt );
+ return TRUE;
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::RemoveUserEvent( ULONG nUserEvent )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVEvent* pSVEvent = (ImplSVEvent*)nUserEvent;
+
+ DBG_ASSERT( pSVEvent->mpWindow == this,
+ "Window::RemoveUserEvent(): Event doesn't send to this window or is already removed" );
+ DBG_ASSERT( pSVEvent->mbCall,
+ "Window::RemoveUserEvent(): Event is already removed" );
+
+ if ( pSVEvent->mpWindow )
+ {
+ pSVEvent->mpWindow->ImplRemoveDel( &(pSVEvent->maDelData) );
+ pSVEvent->mpWindow = NULL;
+ }
+
+ pSVEvent->mbCall = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Window, ImplAsyncStateChangedHdl, void*, pState )
+{
+ StateChanged( (StateChangedType)(ULONG)pState );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::PostStateChanged( StateChangedType nState )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ PostUserEvent( LINK( this, Window, ImplAsyncStateChangedHdl ), (void*)(ULONG)nState );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetStyle( WinBits nStyle )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mnStyle != nStyle )
+ {
+ mnPrevStyle = mnStyle;
+ mnStyle = nStyle;
+ StateChanged( STATE_CHANGE_STYLE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetExtendedStyle( WinBits nExtendedStyle )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mnExtendedStyle != nExtendedStyle )
+ {
+ mnPrevExtendedStyle = mnExtendedStyle;
+ mnExtendedStyle = nExtendedStyle;
+ StateChanged( STATE_CHANGE_EXTENDEDSTYLE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SystemWindow* Window::GetSystemWindow() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ const Window* pWin = this;
+ while ( !pWin->IsSystemWindow() )
+ pWin = pWin->GetParent();
+ return (SystemWindow*)pWin;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetBorderStyle( USHORT nBorderStyle )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ if ( mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
+ ((ImplBorderWindow*)mpBorderWindow)->SetBorderStyle( nBorderStyle );
+ else
+ mpBorderWindow->SetBorderStyle( nBorderStyle );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Window::GetBorderStyle() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ if ( mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
+ return ((ImplBorderWindow*)mpBorderWindow)->GetBorderStyle();
+ else
+ return mpBorderWindow->GetBorderStyle();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long Window::CalcTitleWidth() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ if ( mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
+ return ((ImplBorderWindow*)mpBorderWindow)->CalcTitleWidth();
+ else
+ return mpBorderWindow->CalcTitleWidth();
+ }
+ else if ( mbFrame && (mnStyle & WB_MOVEABLE) )
+ {
+ // Fuer Frame-Fenster raten wir die Breite, da wir den Border fuer
+ // externe Dialoge nicht kennen
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ Font aFont = GetFont();
+ ((Window*)this)->SetPointFont( rStyleSettings.GetTitleFont() );
+ long nTitleWidth = GetTextWidth( GetText() );
+ ((Window*)this)->SetFont( aFont );
+ nTitleWidth += rStyleSettings.GetTitleHeight() * 3;
+ nTitleWidth += rStyleSettings.GetBorderSize() * 2;
+ nTitleWidth += 10;
+ return nTitleWidth;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EnableClipSiblings( BOOL bClipSiblings )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->EnableClipSiblings( bClipSiblings );
+
+ mbClipSiblings = bClipSiblings;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetMouseTransparent( BOOL bTransparent )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->SetMouseTransparent( bTransparent );
+
+ mbMouseTransparent = bTransparent;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetPaintTransparent( BOOL bTransparent )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->SetPaintTransparent( bTransparent );
+
+ mbPaintTransparent = bTransparent;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetInputContext( const InputContext& rInputContext )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ maInputContext = rInputContext;
+ if ( !mbInFocusHdl && HasFocus() )
+ ImplNewInputContext();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::UpdateExtTextInputArea()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+#ifndef REMOTE_APPSERVER
+ if ( mbExtTextInput )
+ ImplGetFrame()->UpdateExtTextInputArea();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EndExtTextInput( USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+#ifndef REMOTE_APPSERVER
+ if ( mbExtTextInput )
+ ImplGetFrame()->EndExtTextInput( nFlags );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetExtTextInputPos( USHORT nStart, USHORT nCount, const Rectangle* pPosAry )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplWinData* pWinData = ImplGetWinData();
+
+ if ( pWinData->mpExtPosAry )
+ delete [] pWinData->mpExtPosAry;
+ if ( nCount )
+ {
+ pWinData->mpExtPosAry = new Rectangle[nCount];
+ pWinData->mnExtPosStart = nStart;
+ pWinData->mnExtPosCount = nCount;
+ memcpy( pWinData->mpExtPosAry, pPosAry, nCount*sizeof( Rectangle ) );
+ }
+ else
+ pWinData->mpExtPosAry = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+const Rectangle* Window::GetExtTextInputPosAry() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplWinData* pWinData = ImplGetWinData();
+ return pWinData->mpExtPosAry;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Window::GetExtTextInputPosStart() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplWinData* pWinData = ImplGetWinData();
+ return pWinData->mnExtPosStart;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Window::GetExtTextInputPosCount() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplWinData* pWinData = ImplGetWinData();
+ return pWinData->mnExtPosCount;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetSettings( const AllSettings& rSettings, BOOL bChild )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ mpBorderWindow->SetSettings( rSettings, FALSE );
+ if ( (mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow->SetSettings( rSettings, TRUE );
+ }
+
+ AllSettings aOldSettings = maSettings;
+ OutputDevice::SetSettings( rSettings );
+ ULONG nChangeFlags = aOldSettings.GetChangeFlags( rSettings );
+ if ( nChangeFlags )
+ {
+ DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags );
+ DataChanged( aDCEvt );
+ }
+
+ // AppFont-Aufloesung und DPI-Aufloesung neu berechnen
+ ImplInitResolutionSettings();
+
+ if ( bChild || mbChildNotify )
+ {
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->SetSettings( rSettings, bChild );
+ pChild = pChild->mpNext;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::UpdateSettings( const AllSettings& rSettings, BOOL bChild )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ mpBorderWindow->UpdateSettings( rSettings, FALSE );
+ if ( (mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow->UpdateSettings( rSettings, TRUE );
+ }
+
+ AllSettings aOldSettings = maSettings;
+ ULONG nChangeFlags = maSettings.Update( maSettings.GetWindowUpdate(), rSettings );
+ if ( nChangeFlags )
+ {
+ DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags );
+ DataChanged( aDCEvt );
+ }
+
+ // AppFont-Aufloesung und DPI-Aufloesung neu berechnen
+ ImplInitResolutionSettings();
+
+ if ( bChild || mbChildNotify )
+ {
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->UpdateSettings( rSettings, bChild );
+ pChild = pChild->mpNext;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::NotifyAllChilds( DataChangedEvent& rDCEvt )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ DataChanged( rDCEvt );
+
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->NotifyAllChilds( rDCEvt );
+ pChild = pChild->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetPointFont( const Font& rFont )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Font aFont = rFont;
+ ImplPointToLogic( aFont );
+ SetFont( aFont );
+}
+
+// -----------------------------------------------------------------------
+
+Font Window::GetPointFont() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Font aFont = GetFont();
+ ImplLogicToPoint( aFont );
+ return aFont;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::GetFontResolution( long& nDPIX, long& nDPIY ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ nDPIX = mpFrameData->mnFontDPIX;
+ nDPIY = mpFrameData->mnFontDPIY;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetParentClipMode( USHORT nMode )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->SetParentClipMode( nMode );
+ else
+ {
+ if ( !ImplIsOverlapWindow() )
+ {
+ mnParentClipMode = nMode;
+ if ( nMode & PARENTCLIPMODE_CLIP )
+ mpParent->mbClipChildren = TRUE;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Window::GetParentClipMode() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ return mpBorderWindow->GetParentClipMode();
+ else
+ return mnParentClipMode;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetWindowRegionPixel()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->SetWindowRegionPixel();
+ else
+ {
+ if ( mbWinRegion )
+ {
+ maWinRegion = Region( REGION_NULL );
+ mbWinRegion = FALSE;
+ ImplSetClipFlag();
+
+ if ( IsReallyVisible() )
+ {
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpOverlapData && mpOverlapData->mpSaveBackDev )
+ ImplDeleteOverlapBackground();
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+ Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ Region aRegion( aRect );
+ ImplInvalidateParentFrameRegion( aRegion );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetWindowRegionPixel( const Region& rRegion )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->SetWindowRegionPixel( rRegion );
+ else
+ {
+ BOOL bInvalidate = FALSE;
+
+ if ( rRegion.GetType() == REGION_NULL )
+ {
+ if ( mbWinRegion )
+ {
+ maWinRegion = Region( REGION_NULL );
+ mbWinRegion = FALSE;
+ ImplSetClipFlag();
+ bInvalidate = TRUE;
+ }
+ }
+ else
+ {
+ maWinRegion = rRegion;
+ mbWinRegion = TRUE;
+ ImplSetClipFlag();
+ bInvalidate = TRUE;
+ }
+
+ if ( IsReallyVisible() )
+ {
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpOverlapData && mpOverlapData->mpSaveBackDev )
+ ImplDeleteOverlapBackground();
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+ Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ Region aRegion( aRect );
+ ImplInvalidateParentFrameRegion( aRegion );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+const Region& Window::GetWindowRegionPixel() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ return mpBorderWindow->GetWindowRegionPixel();
+ else
+ return maWinRegion;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::IsWindowRegionPixel() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ return mpBorderWindow->IsWindowRegionPixel();
+ else
+ return mbWinRegion;
+}
+
+// -----------------------------------------------------------------------
+
+Region Window::GetWindowClipRegionPixel( USHORT nFlags ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Region aWinClipRegion;
+
+ if ( nFlags & WINDOW_GETCLIPREGION_NOCHILDREN )
+ {
+ if ( mbInitWinClipRegion )
+ ((Window*)this)->ImplInitWinClipRegion();
+ aWinClipRegion = maWinClipRegion;
+ }
+ else
+ {
+ Region* pWinChildClipRegion = ((Window*)this)->ImplGetWinChildClipRegion();
+ aWinClipRegion = *pWinChildClipRegion;
+ }
+
+ if ( nFlags & WINDOW_GETCLIPREGION_NULL )
+ {
+ Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ Region aWinRegion( aWinRect );
+
+ if ( aWinRegion == aWinClipRegion )
+ aWinClipRegion.SetNull();
+ }
+
+ aWinClipRegion.Move( -mnOutOffX, -mnOutOffY );
+
+ return aWinClipRegion;
+}
+
+// -----------------------------------------------------------------------
+
+Region Window::GetPaintRegion() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpPaintRegion )
+ {
+ Region aRegion = *mpPaintRegion;
+ aRegion.Move( -mnOutOffX, -mnOutOffY );
+ return PixelToLogic( aRegion );
+ }
+ else
+ {
+ Region aPaintRegion( REGION_NULL );
+ return aPaintRegion;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetParent( Window* pNewParent )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ DBG_ASSERT( pNewParent, "Window::SetParent(): pParent == NULL" );
+
+ if ( mbFrame )
+ return;
+
+ if ( mpBorderWindow )
+ {
+ mpRealParent = pNewParent;
+ mpBorderWindow->SetParent( pNewParent );
+ return;
+ }
+
+ if ( mpParent == pNewParent )
+ return;
+
+ BOOL bVisible = IsVisible();
+ Show( FALSE, SHOW_NOFOCUSCHANGE );
+
+ // Testen, ob sich das Overlap-Window aendert
+ Window* pOldOverlapWindow;
+ Window* pNewOverlapWindow;
+ if ( ImplIsOverlapWindow() )
+ pOldOverlapWindow = NULL;
+ else
+ {
+ pNewOverlapWindow = pNewParent->ImplGetFirstOverlapWindow();
+ if ( mpOverlapWindow != pNewOverlapWindow )
+ pOldOverlapWindow = mpOverlapWindow;
+ else
+ pOldOverlapWindow = NULL;
+ }
+
+ // Fenster in der Hirachie umsetzen
+ BOOL bFocusOverlapWin = HasChildPathFocus( TRUE );
+ BOOL bFocusWin = HasChildPathFocus();
+ BOOL bNewFrame = pNewParent->mpFrameWindow != mpFrameWindow;
+ if ( bNewFrame )
+ {
+ if ( mpFrameData->mpFocusWin )
+ {
+ if ( IsWindowOrChild( mpFrameData->mpFocusWin ) )
+ mpFrameData->mpFocusWin = NULL;
+ }
+ if ( mpFrameData->mpMouseMoveWin )
+ {
+ if ( IsWindowOrChild( mpFrameData->mpMouseMoveWin ) )
+ mpFrameData->mpMouseMoveWin = NULL;
+ }
+ if ( mpFrameData->mpMouseDownWin )
+ {
+ if ( IsWindowOrChild( mpFrameData->mpMouseDownWin ) )
+ mpFrameData->mpMouseDownWin = NULL;
+ }
+ }
+ ImplRemoveWindow( bNewFrame );
+ ImplInsertWindow( pNewParent );
+ if ( mnParentClipMode & PARENTCLIPMODE_CLIP )
+ pNewParent->mbClipChildren = TRUE;
+ ImplUpdateWindowPtr();
+#ifndef REMOTE_APPSERVER
+ if ( ImplUpdatePos() )
+ ImplUpdateSysObjPos();
+#else
+ ImplUpdatePos();
+#endif
+
+ // Wenn sich das Overlap-Window geaendert hat, dann muss getestet werden,
+ // ob auch OverlapWindow die das Child-Fenster als Parent gehabt haben
+ // in der Window-Hirachie umgesetzt werden muessen
+ if ( ImplIsOverlapWindow() )
+ {
+ if ( bNewFrame )
+ {
+ Window* pOverlapWindow = mpFirstOverlap;
+ while ( pOverlapWindow )
+ {
+ Window* pNextOverlapWindow = pOverlapWindow->mpNext;
+ pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame );
+ pOverlapWindow = pNextOverlapWindow;
+ }
+ }
+ }
+ else if ( pOldOverlapWindow )
+ {
+ // Focus-Save zuruecksetzen
+ if ( bFocusWin ||
+ (pOldOverlapWindow->mpLastFocusWindow &&
+ IsWindowOrChild( pOldOverlapWindow->mpLastFocusWindow )) )
+ pOldOverlapWindow->mpLastFocusWindow = NULL;
+
+ Window* pOverlapWindow = pOldOverlapWindow->mpFirstOverlap;
+ while ( pOverlapWindow )
+ {
+ Window* pNextOverlapWindow = pOverlapWindow->mpNext;
+ if ( ImplIsRealParentPath( pOverlapWindow->ImplGetWindow() ) )
+ pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame );
+ pOverlapWindow = pNextOverlapWindow;
+ }
+
+ // Activate-Status beim naechsten Overlap-Window updaten
+ if ( HasChildPathFocus( TRUE ) )
+ ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow );
+ }
+
+ // Activate-Status mit umsetzen
+ if ( bNewFrame )
+ {
+ if ( (GetType() == WINDOW_BORDERWINDOW) &&
+ (ImplGetWindow()->GetType() == WINDOW_FLOATINGWINDOW) )
+ ((ImplBorderWindow*)this)->SetDisplayActive( mpFrameData->mbHasFocus );
+ }
+
+ // Focus evtl. auf den neuen Frame umsetzen, wenn FocusWindow mit
+ // SetParent() umgesetzt wird
+ if ( bFocusOverlapWin )
+ {
+ mpFrameData->mpFocusWin = Application::GetFocusWindow();
+ if ( !mpFrameData->mbHasFocus )
+ {
+ mpFrame->ToTop( 0 );
+ }
+ }
+
+ if ( bVisible )
+ Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Show( BOOL bVisible, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mbVisible == bVisible )
+ return;
+
+ mbVisible = bVisible != 0;
+
+ if ( !bVisible )
+ {
+ ImplHideAllOverlaps();
+
+ if ( mpBorderWindow )
+ {
+ BOOL bOldUpdate = mpBorderWindow->mbNoParentUpdate;
+ if ( mbNoParentUpdate )
+ mpBorderWindow->mbNoParentUpdate = TRUE;
+ mpBorderWindow->Show( FALSE, nFlags );
+ mpBorderWindow->mbNoParentUpdate = bOldUpdate;
+ }
+ else if ( mbFrame )
+ mpFrame->Show( FALSE );
+
+ StateChanged( STATE_CHANGE_VISIBLE );
+
+ if ( mbReallyVisible )
+ {
+ Region aInvRegion( REGION_EMPTY );
+ BOOL bSaveBack = FALSE;
+
+ if ( ImplIsOverlapWindow() && !mbFrame )
+ {
+ if ( ImplRestoreOverlapBackground( aInvRegion ) )
+ bSaveBack = TRUE;
+ }
+
+ if ( !bSaveBack )
+ {
+ if ( mbInitWinClipRegion )
+ ImplInitWinClipRegion();
+ aInvRegion = maWinClipRegion;
+ }
+
+ ImplResetReallyVisible();
+ ImplSetClipFlag();
+
+ if ( ImplIsOverlapWindow() && !mbFrame )
+ {
+ // Focus umsetzen
+ if ( !(nFlags & SHOW_NOFOCUSCHANGE) && HasChildPathFocus() )
+ {
+ if ( mpOverlapWindow->IsEnabled() && mpOverlapWindow->IsInputEnabled() )
+ mpOverlapWindow->GrabFocus();
+ }
+ }
+
+ if ( !mbFrame )
+ {
+ if ( !mbNoParentUpdate && !(nFlags & SHOW_NOPARENTUPDATE) )
+ {
+ if ( !aInvRegion.IsEmpty() )
+ ImplInvalidateParentFrameRegion( aInvRegion );
+ }
+ ImplGenerateMouseMove();
+ }
+ }
+ }
+ else
+ {
+ if ( mbCallMove )
+ {
+ mbCallMove = FALSE;
+ Move();
+ }
+ if ( mbCallResize )
+ {
+ mbCallResize = FALSE;
+ Resize();
+ }
+
+ StateChanged( STATE_CHANGE_VISIBLE );
+
+ Window* pTestParent;
+ if ( ImplIsOverlapWindow() )
+ pTestParent = mpOverlapWindow;
+ else
+ pTestParent = ImplGetParent();
+ if ( mbFrame || pTestParent->mbReallyVisible )
+ {
+ // Wenn ein Window gerade sichtbar wird, schicken wir allen
+ // Child-Fenstern ein StateChanged, damit diese sich
+ // initialisieren koennen
+ ImplCallInitShow();
+
+ // Wenn es ein SystemWindow ist, dann kommt es auch automatisch
+ // nach vorne, wenn es gewuenscht ist
+ if ( ImplIsOverlapWindow() && !(nFlags & SHOW_NOACTIVATE) )
+ {
+ ImplStartToTop( 0 );
+ ImplFocusToTop( 0, FALSE );
+ }
+
+ // Hintergrund sichern
+ if ( mpOverlapData && mpOverlapData->mbSaveBack )
+ ImplSaveOverlapBackground();
+ // Dafuer sorgen, das Clip-Rechtecke neu berechnet werden
+ ImplSetReallyVisible();
+ ImplSetClipFlag();
+
+ if ( !mbFrame )
+ {
+ ImplInvalidate( NULL, INVALIDATE_NOTRANSPARENT | INVALIDATE_CHILDREN );
+ ImplGenerateMouseMove();
+ }
+ }
+
+ if ( mpBorderWindow )
+ mpBorderWindow->Show( TRUE, nFlags );
+ else if ( mbFrame )
+ {
+ mbPaintFrame = TRUE;
+ mpFrame->Show( TRUE );
+
+ // Query the correct size of the window, if we are waiting for
+ // a system resize
+ if ( mbWaitSystemResize )
+ {
+ long nOutWidth;
+ long nOutHeight;
+ mpFrame->GetClientSize( nOutWidth, nOutHeight );
+ ImplHandleResize( this, nOutWidth, nOutHeight );
+ }
+ }
+
+#ifdef DBG_UTIL
+ if ( IsDialog() || (GetType() == WINDOW_TABPAGE) )
+ {
+ DBG_DIALOGTEST( this );
+ }
+#endif
+
+ ImplShowAllOverlaps();
+ }
+
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+
+ if ( mxWindowPeer.is() )
+ Application::GetUnoWrapper()->WindowEvent_Show( this, mbVisible );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Enable( BOOL bEnable, BOOL bChild )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !bEnable )
+ {
+ // Wenn ein Fenster disablte wird, wird automatisch der Tracking-Modus
+ // beendet oder der Capture geklaut
+ if ( IsTracking() )
+ EndTracking( ENDTRACK_CANCEL );
+ if ( IsMouseCaptured() )
+ ReleaseMouse();
+ // Wenn Fenster den Focus hat und in der Dialog-Steuerung enthalten,
+ // wird versucht, den Focus auf das naechste Control weiterzuschalten
+ // mbDisabled darf erst nach Aufruf von ImplDlgCtrlNextWindow() gesetzt
+ // werden. Ansonsten muss ImplDlgCtrlNextWindow() umgestellt werden
+ if ( HasFocus() )
+ ImplDlgCtrlNextWindow();
+ }
+
+ if ( mpBorderWindow )
+ {
+ mpBorderWindow->Enable( bEnable, FALSE );
+ if ( (mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow->Enable( bEnable, TRUE );
+ }
+
+ if ( mbDisabled != !bEnable )
+ {
+ mbDisabled = !bEnable;
+#ifndef REMOTE_APPSERVER
+ if ( mpSysObj )
+ mpSysObj->Enable( bEnable && !mbInputDisabled );
+#endif
+// if ( mbFrame )
+// mpFrame->Enable( bEnable && !mbInputDisabled );
+ StateChanged( STATE_CHANGE_ENABLE );
+ }
+
+ if ( bChild || mbChildNotify )
+ {
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->Enable( bEnable, bChild );
+ pChild = pChild->mpNext;
+ }
+ }
+
+ if ( IsReallyVisible() )
+ ImplGenerateMouseMove();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EnableInput( BOOL bEnable, BOOL bChild )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ mpBorderWindow->EnableInput( bEnable, FALSE );
+ if ( (mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow )
+ ((ImplBorderWindow*)mpBorderWindow)->mpMenuBarWindow->EnableInput( bEnable, TRUE );
+ }
+
+ if ( !mbAlwaysEnableInput || bEnable )
+ {
+ // Wenn ein Fenster disablte wird, wird automatisch der
+ // Tracking-Modus beendet oder der Capture geklaut
+ if ( !bEnable )
+ {
+ if ( IsTracking() )
+ EndTracking( ENDTRACK_CANCEL );
+ if ( IsMouseCaptured() )
+ ReleaseMouse();
+ }
+
+ if ( mbInputDisabled != !bEnable )
+ {
+ mbInputDisabled = !bEnable;
+#ifndef REMOTE_APPSERVER
+ if ( mpSysObj )
+ mpSysObj->Enable( !mbDisabled && bEnable );
+#endif
+// if ( mbFrame )
+// mpFrame->Enable( !mbDisabled && bEnable );
+ }
+ }
+
+ if ( bChild || mbChildNotify )
+ {
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->EnableInput( bEnable, bChild );
+ pChild = pChild->mpNext;
+ }
+ }
+
+ if ( IsReallyVisible() )
+ ImplGenerateMouseMove();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EnableInput( BOOL bEnable, BOOL bChild, BOOL bSysWin,
+ const Window* pExcludeWindow )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ EnableInput( bEnable, bChild );
+ if ( bSysWin )
+ {
+ // pExculeWindow is the first Overlap-Frame --> if this
+ // shouldn't be the case, than this must be changed in dialog.cxx
+ pExcludeWindow = pExcludeWindow->ImplGetFirstOverlapWindow();
+ Window* pSysWin = mpFrameWindow->mpFrameData->mpFirstOverlap;
+ while ( pSysWin )
+ {
+ // Is Window in the path from this window
+ if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pSysWin, TRUE ) )
+ {
+ // Is Window not in the exclude window path or not the
+ // exclude window, than change the status
+ if ( !pExcludeWindow->ImplIsWindowOrChild( pSysWin, TRUE ) )
+ pSysWin->EnableInput( bEnable, bChild );
+ }
+ pSysWin = pSysWin->mpNextOverlap;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::AlwaysEnableInput( BOOL bAlways, BOOL bChild )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->AlwaysEnableInput( bAlways, FALSE );
+
+ if ( mbAlwaysEnableInput != bAlways )
+ {
+ mbAlwaysEnableInput = bAlways;
+
+ if ( bAlways )
+ EnableInput( TRUE, FALSE );
+ }
+
+ if ( bChild || mbChildNotify )
+ {
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ pChild->AlwaysEnableInput( bAlways, bChild );
+ pChild = pChild->mpNext;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetActivateMode( USHORT nMode )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ mpBorderWindow->SetActivateMode( nMode );
+
+ if ( mnActivateMode != nMode )
+ {
+ mnActivateMode = nMode;
+
+ // Evtl. ein Decativate/Activate ausloesen
+ if ( mnActivateMode )
+ {
+ if ( (mbActive || (GetType() == WINDOW_BORDERWINDOW)) &&
+ !HasChildPathFocus( TRUE ) )
+ {
+ mbActive = FALSE;
+ Deactivate();
+ }
+ }
+ else
+ {
+ if ( !mbActive || (GetType() == WINDOW_BORDERWINDOW) )
+ {
+ mbActive = TRUE;
+ Activate();
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ToTop( USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplStartToTop( nFlags );
+ ImplFocusToTop( nFlags, IsReallyVisible() );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetZOrder( Window* pRefWindow, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ mpBorderWindow->SetZOrder( pRefWindow, nFlags );
+ return;
+ }
+
+ if ( nFlags & WINDOW_ZORDER_FIRST )
+ {
+ if ( ImplIsOverlapWindow() )
+ pRefWindow = mpOverlapWindow->mpFirstOverlap;
+ else
+ pRefWindow = mpParent->mpFirstChild;
+ nFlags |= WINDOW_ZORDER_BEFOR;
+ }
+ else if ( nFlags & WINDOW_ZORDER_LAST )
+ {
+ if ( ImplIsOverlapWindow() )
+ pRefWindow = mpOverlapWindow->mpLastOverlap;
+ else
+ pRefWindow = mpParent->mpLastChild;
+ nFlags |= WINDOW_ZORDER_BEHIND;
+ }
+
+ while ( pRefWindow->mpBorderWindow )
+ pRefWindow = pRefWindow->mpBorderWindow;
+ if ( (pRefWindow == this) || mbFrame )
+ return;
+
+ DBG_ASSERT( pRefWindow->mpParent == mpParent, "Window::SetZOrder() - pRefWindow has other parent" );
+ if ( nFlags & WINDOW_ZORDER_BEFOR )
+ {
+ if ( pRefWindow->mpPrev == this )
+ return;
+
+ if ( ImplIsOverlapWindow() )
+ {
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ mpOverlapWindow->mpFirstOverlap = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ mpOverlapWindow->mpLastOverlap = mpPrev;
+ if ( !pRefWindow->mpPrev )
+ mpOverlapWindow->mpFirstOverlap = this;
+ }
+ else
+ {
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ mpParent->mpFirstChild = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ mpParent->mpLastChild = mpPrev;
+ if ( !pRefWindow->mpPrev )
+ mpParent->mpFirstChild = this;
+ }
+
+ mpPrev = pRefWindow->mpPrev;
+ mpNext = pRefWindow;
+ if ( mpPrev )
+ mpPrev->mpNext = this;
+ mpNext->mpPrev = this;
+ }
+ else if ( nFlags & WINDOW_ZORDER_BEHIND )
+ {
+ if ( pRefWindow->mpNext == this )
+ return;
+
+ if ( ImplIsOverlapWindow() )
+ {
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ mpOverlapWindow->mpFirstOverlap = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ mpOverlapWindow->mpLastOverlap = mpPrev;
+ if ( !pRefWindow->mpNext )
+ mpOverlapWindow->mpLastOverlap = this;
+ }
+ else
+ {
+ if ( mpPrev )
+ mpPrev->mpNext = mpNext;
+ else
+ mpParent->mpFirstChild = mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = mpPrev;
+ else
+ mpParent->mpLastChild = mpPrev;
+ if ( !pRefWindow->mpNext )
+ mpParent->mpLastChild = this;
+ }
+
+ mpPrev = pRefWindow;
+ mpNext = pRefWindow->mpNext;
+ if ( mpNext )
+ mpNext->mpPrev = this;
+ mpPrev->mpNext = this;
+ }
+
+ if ( IsReallyVisible() )
+ {
+ // Hintergrund-Sicherung zuruecksetzen
+ if ( mpFrameData->mpFirstBackWin )
+ ImplInvalidateAllOverlapBackgrounds();
+
+ if ( mbInitWinClipRegion || !maWinClipRegion.IsEmpty() )
+ {
+ BOOL bInitWinClipRegion = mbInitWinClipRegion;
+ ImplSetClipFlag();
+
+ // Wenn ClipRegion noch nicht initalisiert wurde, dann
+ // gehen wir davon aus, das das Fenster noch nicht
+ // ausgegeben wurde und loesen somit auch keine
+ // Invalidates aus. Dies ist eine Optimierung fuer
+ // HTML-Dokumenten mit vielen Controls. Wenn es mal
+ // Probleme mit dieser Abfrage gibt, sollte man ein
+ // Flag einfuehren, ob das Fenster nach Show schon
+ // einmal ausgegeben wurde.
+ if ( !bInitWinClipRegion )
+ {
+ // Alle nebeneinanderliegen Fenster invalidieren
+ // Noch nicht komplett implementiert !!!
+ Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ Window* pWindow = NULL;
+ if ( ImplIsOverlapWindow() )
+ {
+ if ( mpOverlapWindow )
+ pWindow = mpOverlapWindow->mpFirstOverlap;
+ }
+ else
+ pWindow = ImplGetParent()->mpFirstChild;
+ // Alle Fenster, die vor uns liegen und von uns verdeckt wurden,
+ // invalidieren
+ while ( pWindow )
+ {
+ if ( pWindow == this )
+ break;
+ Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
+ Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
+ if ( aWinRect.IsOver( aCompRect ) )
+ pWindow->Invalidate( INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT );
+ pWindow = pWindow->mpNext;
+ }
+ // Wenn uns ein Fenster welches im Hinterund liegt verdeckt hat,
+ // dann muessen wir uns neu ausgeben
+ while ( pWindow )
+ {
+ if ( pWindow != this )
+ {
+ Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
+ Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
+ if ( aWinRect.IsOver( aCompRect ) )
+ {
+ Invalidate( INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT );
+ break;
+ }
+ }
+ pWindow = pWindow->mpNext;
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EnableAlwaysOnTop( BOOL bEnable )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ mbAlwaysOnTop = bEnable;
+
+ if ( mpBorderWindow )
+ mpBorderWindow->EnableAlwaysOnTop( bEnable );
+ else if ( bEnable && IsReallyVisible() )
+ ToTop();
+
+ if ( mbFrame )
+ mpFrame->SetAlwaysOnTop( bEnable );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetPosSizePixel( long nX, long nY,
+ long nWidth, long nHeight, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( nFlags & WINDOW_POSSIZE_POS )
+ mbDefPos = FALSE;
+ if ( nFlags & WINDOW_POSSIZE_SIZE )
+ mbDefSize = FALSE;
+
+ // Oberstes BorderWindow ist das Window, welches positioniert werden soll
+ Window* pWindow = this;
+ while ( pWindow->mpBorderWindow )
+ pWindow = pWindow->mpBorderWindow;
+
+ if ( pWindow->mbFrame )
+ {
+ // Nur Groessenaenderungen werden beruecksichtig
+ if ( (nFlags & WINDOW_POSSIZE_SIZE) == WINDOW_POSSIZE_SIZE )
+ {
+ if ( !(nFlags & WINDOW_POSSIZE_WIDTH) )
+ nWidth = pWindow->mnOutWidth;
+ if ( !(nFlags & WINDOW_POSSIZE_HEIGHT) )
+ nHeight = pWindow->mnOutHeight;
+
+ pWindow->mpFrame->SetClientSize( nWidth, nHeight );
+ // Resize should be called directly. If we havn't
+ // set the correct size, we get a second resize from
+ // the system with the correct size. This can be happend
+ // if the size is to small or to lare.
+ ImplHandleResize( pWindow, nWidth, nHeight );
+ }
+ }
+ else
+ {
+ pWindow->ImplPosSizeWindow( nX, nY, nWidth, nHeight, nFlags );
+ if ( IsReallyVisible() )
+ ImplGenerateMouseMove();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Point Window::OutputToScreenPixel( const Point& rPos ) const
+{
+ return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY );
+}
+
+// -----------------------------------------------------------------------
+
+Point Window::ScreenToOutputPixel( const Point& rPos ) const
+{
+ return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplScroll( Rectangle( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) ),
+ nHorzScroll, nVertScroll, nFlags & ~SCROLL_CLIP );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Scroll( long nHorzScroll, long nVertScroll,
+ const Rectangle& rRect, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Rectangle aRect = ImplLogicToDevicePixel( rRect );
+ aRect.Intersection( Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ) );
+ if ( !aRect.IsEmpty() )
+ ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Invalidate( USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+ return;
+
+ ImplInvalidate( NULL, nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Invalidate( const Rectangle& rRect, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+ return;
+
+ Rectangle aRect = ImplLogicToDevicePixel( rRect );
+ if ( !aRect.IsEmpty() )
+ {
+ Region aRegion( aRect );
+ ImplInvalidate( &aRegion, nFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Invalidate( const Region& rRegion, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+ return;
+
+ if ( rRegion.IsNull() )
+ ImplInvalidate( NULL, nFlags );
+ else
+ {
+ Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) );
+ if ( !aRegion.IsEmpty() )
+ ImplInvalidate( &aRegion, nFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Validate( USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+ return;
+
+ ImplValidate( NULL, nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Validate( const Rectangle& rRect, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+ return;
+
+ Rectangle aRect = ImplLogicToDevicePixel( rRect );
+ if ( !aRect.IsEmpty() )
+ {
+ Region aRegion( aRect );
+ ImplValidate( &aRegion, nFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Validate( const Region& rRegion, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
+ return;
+
+ if ( rRegion.IsNull() )
+ ImplValidate( NULL, nFlags );
+ else
+ {
+ Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) );
+ if ( !aRegion.IsEmpty() )
+ ImplValidate( &aRegion, nFlags );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::HasPaintEvent() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !mbReallyVisible )
+ return FALSE;
+
+ if ( mpFrameWindow->mbPaintFrame )
+ return TRUE;
+
+ if ( mnPaintFlags & IMPL_PAINT_PAINT )
+ return TRUE;
+
+ if ( !ImplIsOverlapWindow() )
+ {
+ const Window* pTempWindow = this;
+ do
+ {
+ pTempWindow = pTempWindow->ImplGetParent();
+ if ( pTempWindow->mnPaintFlags & (IMPL_PAINT_PAINTCHILDS | IMPL_PAINT_PAINTALLCHILDS) )
+ return TRUE;
+ }
+ while ( !pTempWindow->ImplIsOverlapWindow() );
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Update()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpBorderWindow )
+ {
+ mpBorderWindow->Update();
+ return;
+ }
+
+ if ( !mbReallyVisible )
+ return;
+
+ BOOL bFlush = FALSE;
+ if ( mpFrameWindow->mbPaintFrame )
+ {
+ Point aPoint( 0, 0 );
+ Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
+ ImplInvalidateOverlapFrameRegion( aRegion );
+ if ( mbFrame || (mpBorderWindow && mpBorderWindow->mbFrame) )
+ bFlush = TRUE;
+ }
+
+ // Zuerst muessen wir alle Fenster ueberspringen, die Paint-Transparent
+ // sind
+ Window* pUpdateWindow = this;
+ Window* pWindow = pUpdateWindow;
+ while ( !pWindow->ImplIsOverlapWindow() )
+ {
+ if ( !pWindow->mbPaintTransparent )
+ {
+ pUpdateWindow = pWindow;
+ break;
+ }
+ pWindow = pWindow->ImplGetParent();
+ }
+ // Ein Update wirkt immer auf das Window, wo PAINTALLCHILDS gesetzt
+ // ist, damit nicht zuviel gemalt wird
+ pWindow = pUpdateWindow;
+ do
+ {
+ if ( pWindow->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDS )
+ pUpdateWindow = pWindow;
+ if ( pWindow->ImplIsOverlapWindow() )
+ break;
+ pWindow = pWindow->ImplGetParent();
+ }
+ while ( pWindow );
+
+ // Wenn es etwas zu malen gibt, dann ein Paint ausloesen
+ if ( pUpdateWindow->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDS) )
+ {
+ // und fuer alle ueber uns stehende System-Fenster auch ein Update
+ // ausloesen, damit nicht die ganze Zeit luecken stehen bleiben
+ Window* pUpdateOverlapWindow = ImplGetFirstOverlapWindow()->mpFirstOverlap;
+ while ( pUpdateOverlapWindow )
+ {
+ pUpdateOverlapWindow->Update();
+ pUpdateOverlapWindow = pUpdateOverlapWindow->mpNext;
+ }
+
+ pUpdateWindow->ImplCallPaint( NULL, pUpdateWindow->mnPaintFlags );
+ }
+
+ if ( bFlush )
+ Flush();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Flush()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+#ifdef REMOTE_APPSERVER
+ // !!!!!
+#else
+ mpFrame->Flush();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Sync()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+#ifdef REMOTE_APPSERVER
+ // Wir rufen eine syncrone Funktion, um uns zu syncronisieren
+ long nDummy;
+ mpFrame->GetClientSize( nDummy, nDummy );
+#else
+ mpFrame->Sync();
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetUpdateMode( BOOL bUpdate )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ mbNoUpdate = !bUpdate;
+ StateChanged( STATE_CHANGE_UPDATEMODE );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::GrabFocus()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplGrabFocus( 0 );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::HasFocus() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ return (this == ImplGetSVData()->maWinData.mpFocusWin);
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::HasChildPathFocus( BOOL bSystemWindow ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Window* pWindow = ImplGetSVData()->maWinData.mpFocusWin;
+ if ( pWindow )
+ return ImplIsWindowOrChild( pWindow, bSystemWindow );
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::CaptureMouse()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Tracking evt. beenden
+ if ( pSVData->maWinData.mpTrackWin != this )
+ {
+ if ( pSVData->maWinData.mpTrackWin )
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ }
+
+ if ( pSVData->maWinData.mpCaptureWin != this )
+ {
+ pSVData->maWinData.mpCaptureWin = this;
+ mpFrame->CaptureMouse( TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ReleaseMouse()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ DBG_ASSERTWARNING( pSVData->maWinData.mpCaptureWin == this,
+ "Window::ReleaseMouse(): window doesn't have the mouse capture" );
+
+ if ( pSVData->maWinData.mpCaptureWin == this )
+ {
+ pSVData->maWinData.mpCaptureWin = NULL;
+ mpFrame->CaptureMouse( FALSE );
+ ImplGenerateMouseMove();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::IsMouseCaptured() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ return (this == ImplGetSVData()->maWinData.mpCaptureWin);
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetPointer( const Pointer& rPointer )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( maPointer == rPointer )
+ return;
+
+ maPointer = rPointer;
+
+ // Pointer evt. direkt umsetzen
+ if ( !mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
+ mpFrame->SetPointer( ImplGetMousePointer() );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EnableChildPointerOverwrite( BOOL bOverwrite )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mbChildPtrOverwrite == bOverwrite )
+ return;
+
+ mbChildPtrOverwrite = bOverwrite;
+
+ // Pointer evt. direkt umsetzen
+ if ( !mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
+ mpFrame->SetPointer( ImplGetMousePointer() );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetPointerPosPixel( const Point& rPos )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Point aPos = ImplOutputToFrame( rPos );
+ mpFrame->SetPointerPos( aPos.X(), aPos.Y() );
+}
+
+// -----------------------------------------------------------------------
+
+Point Window::GetPointerPosPixel()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ return ImplFrameToOutput( Point( mpFrameData->mnLastMouseX, mpFrameData->mnLastMouseY ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ShowPointer( BOOL bVisible )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mbNoPtrVisible != !bVisible )
+ {
+ mbNoPtrVisible = !bVisible;
+
+ // Pointer evt. direkt umsetzen
+ if ( !mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
+ mpFrame->SetPointer( ImplGetMousePointer() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EnterWait()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ mnWaitCount++;
+
+ if ( mnWaitCount == 1 )
+ {
+ // Pointer evt. direkt umsetzen
+ if ( !mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
+ mpFrame->SetPointer( ImplGetMousePointer() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::LeaveWait()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mnWaitCount )
+ {
+ mnWaitCount--;
+
+ if ( !mnWaitCount )
+ {
+ // Pointer evt. direkt umsetzen
+ if ( !mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
+ mpFrame->SetPointer( ImplGetMousePointer() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetCursor( Cursor* pCursor )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpCursor != pCursor )
+ {
+ if ( mpCursor )
+ mpCursor->ImplHide();
+ mpCursor = pCursor;
+ if ( pCursor )
+ pCursor->ImplShow();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetText( const XubString& rStr )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ maText = rStr;
+
+ if ( mpBorderWindow )
+ mpBorderWindow->SetText( rStr );
+ else if ( mbFrame )
+ mpFrame->SetTitle( rStr );
+
+ StateChanged( STATE_CHANGE_TEXT );
+}
+
+// -----------------------------------------------------------------------
+
+XubString Window::GetText() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ return maText;
+}
+
+// -----------------------------------------------------------------------
+
+const XubString& Window::GetHelpText() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !maHelpText.Len() && mnHelpId )
+ {
+ if ( !IsDialog() && (mnType != WINDOW_TABPAGE) && (mnType != WINDOW_FLOATINGWINDOW) )
+ {
+ Help* pHelp = Application::GetHelp();
+ if ( pHelp )
+ ((Window*)this)->maHelpText = pHelp->GetHelpText( GetHelpId() );
+ }
+ }
+
+ return maHelpText;
+}
+
+// -----------------------------------------------------------------------
+
+Window* Window::FindWindow( const Point& rPos ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Point aPos = OutputToScreenPixel( rPos );
+ return ((Window*)this)->ImplFindWindow( aPos );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT Window::GetChildCount() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ USHORT nChildCount = 0;
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ nChildCount++;
+ pChild = pChild->mpNext;
+ }
+
+ return nChildCount;
+}
+
+// -----------------------------------------------------------------------
+
+Window* Window::GetChild( USHORT nChild ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ USHORT nChildCount = 0;
+ Window* pChild = mpFirstChild;
+ while ( pChild )
+ {
+ if ( nChild == nChildCount )
+ return pChild;
+ pChild = pChild->mpNext;
+ nChildCount++;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+Window* Window::GetWindow( USHORT nType ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ switch ( nType )
+ {
+ case WINDOW_PARENT:
+ return mpRealParent;
+
+ case WINDOW_FIRSTCHILD:
+ return mpFirstChild;
+
+ case WINDOW_LASTCHILD:
+ return mpLastChild;
+
+ case WINDOW_PREV:
+ return mpPrev;
+
+ case WINDOW_NEXT:
+ return mpNext;
+
+ case WINDOW_FIRSTOVERLAP:
+ return mpFirstOverlap;
+
+ case WINDOW_LASTOVERLAP:
+ return mpLastOverlap;
+
+ case WINDOW_OVERLAP:
+ if ( ImplIsOverlapWindow() )
+ return (Window*)this;
+ else
+ return mpOverlapWindow;
+
+ case WINDOW_PARENTOVERLAP:
+ if ( ImplIsOverlapWindow() )
+ return mpOverlapWindow;
+ else
+ return mpOverlapWindow->mpOverlapWindow;
+
+ case WINDOW_CLIENT:
+ return ((Window*)this)->ImplGetWindow();
+
+ case WINDOW_REALPARENT:
+ return ImplGetParent();
+
+ case WINDOW_FRAME:
+ return mpFrameWindow;
+
+ case WINDOW_BORDER:
+ if ( mpBorderWindow )
+ return mpBorderWindow->GetWindow( WINDOW_BORDER );
+ return (Window*)this;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::IsChild( const Window* pWindow, BOOL bSystemWindow ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow );
+
+ do
+ {
+ if ( !bSystemWindow && pWindow->ImplIsOverlapWindow() )
+ break;
+
+ pWindow = pWindow->ImplGetParent();
+
+ if ( pWindow == this )
+ return TRUE;
+ }
+ while ( pWindow );
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::IsWindowOrChild( const Window* pWindow, BOOL bSystemWindow ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow );
+
+ if ( this == pWindow )
+ return TRUE;
+ return ImplIsChild( pWindow, bSystemWindow );
+}
+
+// -----------------------------------------------------------------------
+
+const SystemEnvData* Window::GetSystemData() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+#ifndef REMOTE_APPSERVER
+ return mpFrame->GetSystemData();
+#else
+ return NULL;
+#endif
+}
+
+::com::sun::star::uno::Any Window::GetSystemDataAny() const
+{
+ ::com::sun::star::uno::Any aRet;
+ const SystemEnvData* pSysData = GetSystemData();
+ if( pSysData )
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)pSysData, pSysData->nSize );
+ aRet <<= aSeq;
+ }
+ return aRet;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow )
+{
+ mxWindowPeer = xPeer;
+ mpVCLXWindow = pVCLXWindow;
+}
+
+// -----------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > Window::GetComponentInterface( BOOL bCreate )
+{
+ if ( !mxWindowPeer.is() && bCreate )
+ {
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ if ( pWrapper )
+ mxWindowPeer = pWrapper->GetWindowInterface( this, sal_True );
+ }
+ return mxWindowPeer;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetComponentInterface( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace )
+{
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
+ DBG_ASSERT( pWrapper, "SetComponentInterface: No Wrapper!" );
+ if ( pWrapper )
+ pWrapper->SetWindowInterface( this, xIFace );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCallDeactivateListeners( Window *pNew )
+{
+ // Ich werde nicht deaktiviert, wenn das neu aktivierte Window ein Child von mir ist
+ if ( !pNew || !ImplIsChild( pNew ) )
+ {
+ if ( mxWindowPeer.is() )
+ Application::GetUnoWrapper()->WindowEvent_Activate( this, FALSE );
+ if ( ImplGetParent() )
+ ImplGetParent()->ImplCallDeactivateListeners( pNew );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplCallActivateListeners( Window *pOld )
+{
+ // Ich werde nicht aktiviert, wenn das alte aktive Fenster ein Child von mir ist
+ if ( !pOld || !ImplIsChild( pOld ) )
+ {
+ if ( mxWindowPeer.is() )
+ // Hier muss noch irgendwie pOld mitgeschickt werden!
+ Application::GetUnoWrapper()->WindowEvent_Activate( this, TRUE );
+ if ( ImplGetParent() )
+ ImplGetParent()->ImplCallActivateListeners( pOld );
+ }
+}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
new file mode 100644
index 000000000000..6fc297a1cfa0
--- /dev/null
+++ b/vcl/source/window/window2.cxx
@@ -0,0 +1,1384 @@
+/*************************************************************************
+ *
+ * $RCSfile: window2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_WINDOW_CXX
+
+#include <limits.h>
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#else
+#include <rmoutdev.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_METRIC_HXX
+#include <metric.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+#ifndef _SV_OUTDEV_H
+#include <outdev.h>
+#endif
+#ifndef _SV_ACCESS_HXX
+#include <access.hxx>
+#endif
+#ifndef _SV_POLY_H
+#include <poly.h>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _SV_VIRDEV_HXX
+#include <virdev.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <window.hxx>
+#endif
+#ifndef _SV_SCRBAR_HXX
+#include <scrbar.hxx>
+#endif
+#ifndef _SV_SCRWND_HXX
+#include <scrwnd.hxx>
+#endif
+
+#pragma hdrstop
+
+// =======================================================================
+
+DBG_NAMEEX( Window );
+
+// =======================================================================
+
+#define IMPL_MAXSAVEBACKSIZE (640*480)
+#define IMPL_MAXALLSAVEBACKSIZE (800*600*2)
+
+// =======================================================================
+
+struct ImplFocusDelData : public ImplDelData
+{
+ Window* mpFocusWin;
+};
+
+// =======================================================================
+
+BOOL Window::ImplIsWindowInFront( const Window* pTestWindow ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+ DBG_CHKOBJ( pTestWindow, Window, ImplDbgCheckWindow );
+
+ // Testen, ob es Fenster untereinander liegen
+ pTestWindow = pTestWindow->ImplGetFirstOverlapWindow();
+ const Window* pTempWindow = pTestWindow;
+ const Window* pThisWindow = ImplGetFirstOverlapWindow();
+ if ( pTempWindow == pThisWindow )
+ return FALSE;
+ do
+ {
+ if ( pTempWindow == pThisWindow )
+ return TRUE;
+ if ( pTempWindow->mbFrame )
+ break;
+ pTempWindow = pTempWindow->mpOverlapWindow;
+ }
+ while ( pTempWindow );
+ pTempWindow = pThisWindow;
+ do
+ {
+ if ( pTempWindow == pTestWindow )
+ return FALSE;
+ if ( pTempWindow->mbFrame )
+ break;
+ pTempWindow = pTempWindow->mpOverlapWindow;
+ }
+ while ( pTempWindow );
+
+ // Fenster auf gleiche Ebene bringen
+ if ( pThisWindow->mpOverlapWindow != pTestWindow->mpOverlapWindow )
+ {
+ USHORT nThisLevel = 0;
+ USHORT nTestLevel = 0;
+ pTempWindow = pThisWindow;
+ do
+ {
+ nThisLevel++;
+ pTempWindow = pTempWindow->mpOverlapWindow;
+ }
+ while ( !pTempWindow->mbFrame );
+ pTempWindow = pTestWindow;
+ do
+ {
+ nTestLevel++;
+ pTempWindow = pTempWindow->mpOverlapWindow;
+ }
+ while ( !pTempWindow->mbFrame );
+
+ if ( nThisLevel < nTestLevel )
+ {
+ do
+ {
+ if ( pTestWindow->mpOverlapWindow == pThisWindow->mpOverlapWindow )
+ break;
+ if ( pTestWindow->mbFrame )
+ break;
+ pTestWindow = pTestWindow->mpOverlapWindow;
+ }
+ while ( pTestWindow );
+ }
+ else
+ {
+ do
+ {
+ if ( pThisWindow->mpOverlapWindow == pTempWindow->mpOverlapWindow )
+ break;
+ if ( pThisWindow->mbFrame )
+ break;
+ pThisWindow = pThisWindow->mpOverlapWindow;
+ }
+ while ( pThisWindow );
+ }
+ }
+
+ // Wenn TestWindow vor ThisWindow kommt, liegt es vorne
+ pTempWindow = pTestWindow;
+ do
+ {
+ if ( pTempWindow == pThisWindow )
+ return TRUE;
+ pTempWindow = pTempWindow->mpNext;
+ }
+ while ( pTempWindow );
+
+ return FALSE;
+}
+
+// =======================================================================
+
+void Window::ImplSaveOverlapBackground()
+{
+ DBG_ASSERT( !mpOverlapData->mpSaveBackDev, "Window::ImplSaveOverlapBackground() - Background already saved" );
+
+ if ( !mbFrame )
+ {
+ ULONG nSaveBackSize = mnOutWidth*mnOutHeight;
+ if ( nSaveBackSize <= IMPL_MAXSAVEBACKSIZE )
+ {
+ if ( nSaveBackSize+mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE )
+ {
+ Size aOutSize( mnOutWidth, mnOutHeight );
+ mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpFrameWindow );
+ if ( mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) )
+ {
+ mpFrameWindow->ImplUpdateAll();
+
+ if ( mbInitWinClipRegion )
+ ImplInitWinClipRegion();
+
+ mpOverlapData->mnSaveBackSize = nSaveBackSize;
+ mpFrameData->mnAllSaveBackSize += nSaveBackSize;
+ Point aDevPt;
+ mpFrameWindow->ImplGetFrameDev( Point( mnOutOffX, mnOutOffY ),
+ aDevPt, aOutSize,
+ *(mpOverlapData->mpSaveBackDev) );
+ mpOverlapData->mpNextBackWin = mpFrameData->mpFirstBackWin;
+ mpFrameData->mpFirstBackWin = this;
+ }
+ else
+ {
+ delete mpOverlapData->mpSaveBackDev;
+ mpOverlapData->mpSaveBackDev = NULL;
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::ImplRestoreOverlapBackground( Region& rInvRegion )
+{
+ if ( mpOverlapData->mpSaveBackDev )
+ {
+ if ( mbInitWinClipRegion )
+ ImplInitWinClipRegion();
+
+ if ( mpOverlapData->mpSaveBackDev )
+ {
+ Point aDevPt;
+ Point aDestPt( mnOutOffX, mnOutOffY );
+ Size aDevSize = mpOverlapData->mpSaveBackDev->GetOutputSizePixel();
+ if ( mpOverlapData->mpSaveBackRgn )
+ {
+ mpOverlapData->mpSaveBackRgn->Intersect( maWinClipRegion );
+ rInvRegion = maWinClipRegion;
+ rInvRegion.Exclude( *mpOverlapData->mpSaveBackRgn );
+ mpFrameWindow->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
+ *(mpOverlapData->mpSaveBackDev),
+ *mpOverlapData->mpSaveBackRgn );
+ }
+ else
+ {
+ mpFrameWindow->ImplDrawFrameDev( aDestPt, aDevPt, aDevSize,
+ *(mpOverlapData->mpSaveBackDev),
+ maWinClipRegion );
+ }
+ ImplDeleteOverlapBackground();
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplDeleteOverlapBackground()
+{
+ if ( mpOverlapData->mpSaveBackDev )
+ {
+ mpFrameData->mnAllSaveBackSize -= mpOverlapData->mnSaveBackSize;
+ delete mpOverlapData->mpSaveBackDev;
+ mpOverlapData->mpSaveBackDev = NULL;
+ if ( mpOverlapData->mpSaveBackRgn )
+ {
+ delete mpOverlapData->mpSaveBackRgn;
+ mpOverlapData->mpSaveBackRgn = NULL;
+ }
+
+ // Fenster aus der Liste entfernen
+ if ( mpFrameData->mpFirstBackWin == this )
+ mpFrameData->mpFirstBackWin = mpOverlapData->mpNextBackWin;
+ else
+ {
+ Window* pTemp = mpFrameData->mpFirstBackWin;
+ while ( pTemp->mpOverlapData->mpNextBackWin != this )
+ pTemp = pTemp->mpOverlapData->mpNextBackWin;
+ pTemp->mpOverlapData->mpNextBackWin = mpOverlapData->mpNextBackWin;
+ }
+ mpOverlapData->mpNextBackWin = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplInvalidateAllOverlapBackgrounds()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Window* pWindow = mpFrameData->mpFirstBackWin;
+ while ( pWindow )
+ {
+ // Naechstes Fenster schon hier merken, da dieses Fenster in
+ // der if-Abfrage aus der Liste entfernt werden kann
+ Window* pNext = pWindow->mpOverlapData->mpNextBackWin;
+
+ if ( ImplIsWindowInFront( pWindow ) )
+ {
+ Rectangle aRect1( Point( mnOutOffX, mnOutOffY ),
+ Size( mnOutWidth, mnOutHeight ) );
+ Rectangle aRect2( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
+ Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
+ aRect1.Intersection( aRect2 );
+ if ( !aRect1.IsEmpty() )
+ {
+ if ( !pWindow->mpOverlapData->mpSaveBackRgn )
+ pWindow->mpOverlapData->mpSaveBackRgn = new Region( aRect2 );
+ pWindow->mpOverlapData->mpSaveBackRgn->Exclude( aRect1 );
+ if ( pWindow->mpOverlapData->mpSaveBackRgn->IsEmpty() )
+ pWindow->ImplDeleteOverlapBackground();
+ }
+
+ }
+
+ pWindow = pNext;
+ }
+}
+
+// =======================================================================
+
+Bitmap Window::SnapShot() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Bitmap aBmp;
+
+ if ( mpBorderWindow )
+ aBmp = mpBorderWindow->SnapShot();
+ else if ( IsReallyVisible() )
+ mpFrameWindow->ImplGetFrameBitmap( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ), aBmp );
+
+ return aBmp;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ShowFocus( const Rectangle& rRect )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplWinData* pWinData = ImplGetWinData();
+
+ if ( !mbInPaint )
+ {
+ if ( mbFocusVisible )
+ {
+ if ( *(pWinData->mpFocusRect) == rRect )
+ return;
+
+ ImplInvertFocus( *(pWinData->mpFocusRect) );
+ }
+
+ ImplInvertFocus( rRect );
+ }
+
+ if ( !pWinData->mpFocusRect )
+ pWinData->mpFocusRect = new Rectangle( rRect );
+ else
+ *(pWinData->mpFocusRect) = rRect;
+ mbFocusVisible = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::HideFocus()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !mbFocusVisible )
+ return;
+
+ if ( !mbInPaint )
+ ImplInvertFocus( *(ImplGetWinData()->mpFocusRect) );
+ mbFocusVisible = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Invert( const Rectangle& rRect, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+
+ if ( aRect.IsEmpty() )
+ return;
+ aRect.Justify();
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( mbOutputClipped )
+ return;
+
+ SalInvert nSalFlags = 0;
+ if ( nFlags & INVERT_HIGHLIGHT )
+ nSalFlags |= SAL_INVERT_HIGHLIGHT;
+ if ( nFlags & INVERT_50 )
+ nSalFlags |= SAL_INVERT_50;
+ mpGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), nSalFlags );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ pGraphics->Invert( aRect, nFlags );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::Invert( const Polygon& rPoly, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ USHORT nPoints = rPoly.GetSize();
+
+ if ( nPoints < 2 )
+ return;
+
+ Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
+
+#ifndef REMOTE_APPSERVER
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( mbOutputClipped )
+ return;
+
+ SalInvert nSalFlags = 0;
+ if ( nFlags & INVERT_HIGHLIGHT )
+ nSalFlags |= SAL_INVERT_HIGHLIGHT;
+ if ( nFlags & INVERT_50 )
+ nSalFlags |= SAL_INVERT_50;
+ const SalPoint* pPtAry = (const SalPoint*)aPoly.ImplGetConstPointAry();
+ mpGraphics->Invert( nPoints, pPtAry, nSalFlags );
+#else
+ ImplServerGraphics* pGraphics = ImplGetServerGraphics();
+ if ( pGraphics )
+ pGraphics->Invert( aPoly, nFlags );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ShowTracking( const Rectangle& rRect, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplWinData* pWinData = ImplGetWinData();
+
+ if ( !mbInPaint || !(nFlags & SHOWTRACK_WINDOW) )
+ {
+ if ( mbTrackVisible )
+ {
+ if ( (*(pWinData->mpTrackRect) == rRect) &&
+ (pWinData->mnTrackFlags == nFlags) )
+ return;
+
+ InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
+ }
+
+ InvertTracking( rRect, nFlags );
+ }
+
+ if ( !pWinData->mpTrackRect )
+ pWinData->mpTrackRect = new Rectangle( rRect );
+ else
+ *(pWinData->mpTrackRect) = rRect;
+ pWinData->mnTrackFlags = nFlags;
+ mbTrackVisible = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::HideTracking()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mbTrackVisible )
+ {
+ ImplWinData* pWinData = ImplGetWinData();
+ if ( !mbInPaint || !(pWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
+ InvertTracking( *(pWinData->mpTrackRect), pWinData->mnTrackFlags );
+ mbTrackVisible = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::InvertTracking( const Rectangle& rRect, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Rectangle aRect( ImplLogicToDevicePixel( rRect ) );
+
+ if ( aRect.IsEmpty() )
+ return;
+ aRect.Justify();
+
+#ifndef REMOTE_APPSERVER
+ SalGraphics* pGraphics;
+
+ if ( nFlags & SHOWTRACK_WINDOW )
+ {
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( mbOutputClipped )
+ return;
+
+ pGraphics = mpGraphics;
+ }
+ else
+ {
+ pGraphics = ImplGetFrameGraphics();
+
+ if ( nFlags & SHOWTRACK_CLIP )
+ {
+ Point aPoint( mnOutOffX, mnOutOffY );
+ Region aRegion( Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ ImplClipBoundaries( aRegion, FALSE, FALSE );
+ ImplSelectClipRegion( pGraphics, aRegion );
+ }
+ }
+
+ USHORT nStyle = nFlags & SHOWTRACK_STYLE;
+ if ( nStyle == SHOWTRACK_OBJECT )
+ pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_TRACKFRAME );
+ else if ( nStyle == SHOWTRACK_SPLIT )
+ pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight(), SAL_INVERT_50 );
+ else
+ {
+ long nBorder = 1;
+ if ( nStyle == SHOWTRACK_BIG )
+ nBorder = 3;
+ pGraphics->Invert( aRect.Left(), aRect.Top(), aRect.GetWidth(), nBorder, SAL_INVERT_50 );
+ pGraphics->Invert( aRect.Left(), aRect.Bottom()-nBorder+1, aRect.GetWidth(), nBorder, SAL_INVERT_50 );
+ pGraphics->Invert( aRect.Left(), aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50 );
+ pGraphics->Invert( aRect.Right()-nBorder+1, aRect.Top()+nBorder, nBorder, aRect.GetHeight()-(nBorder*2), SAL_INVERT_50 );
+ }
+#else
+ ImplServerGraphics* pGraphics;
+ if ( nFlags & SHOWTRACK_WINDOW )
+ {
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ pGraphics = ImplGetServerGraphics();
+ }
+ else
+ {
+ pGraphics = ImplGetServerGraphics( TRUE );
+
+ if ( nFlags & SHOWTRACK_CLIP )
+ {
+ Point aTmpPoint( mnOutOffX, mnOutOffY );
+ Size aTmpSize( mnOutWidth, mnOutHeight );
+ Rectangle aTmpRect( aTmpPoint, aTmpSize );
+ Region aRegion( aTmpRect );
+ ImplClipBoundaries( aRegion, FALSE, FALSE );
+ pGraphics->SetClipRegion( aRegion );
+ }
+ }
+
+ if ( pGraphics )
+ pGraphics->InvertTracking( aRect, nFlags );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void Window::InvertTracking( const Polygon& rPoly, USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ USHORT nPoints = rPoly.GetSize();
+
+ if ( nPoints < 2 )
+ return;
+
+ Polygon aPoly( ImplLogicToDevicePixel( rPoly ) );
+
+#ifndef REMOTE_APPSERVER
+ SalGraphics* pGraphics;
+
+ if ( nFlags & SHOWTRACK_WINDOW )
+ {
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ // we need a graphics
+ if ( !mpGraphics )
+ {
+ if ( !ImplGetGraphics() )
+ return;
+ }
+
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+
+ if ( mbOutputClipped )
+ return;
+
+ pGraphics = mpGraphics;
+ }
+ else
+ {
+ pGraphics = ImplGetFrameGraphics();
+
+ if ( nFlags & SHOWTRACK_CLIP )
+ {
+ Point aPoint( mnOutOffX, mnOutOffY );
+ Region aRegion( Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ ImplClipBoundaries( aRegion, FALSE, FALSE );
+ ImplSelectClipRegion( pGraphics, aRegion );
+ }
+ }
+
+ const SalPoint* pPtAry = (const SalPoint*)aPoly.ImplGetConstPointAry();
+ pGraphics->Invert( nPoints, pPtAry, SAL_INVERT_TRACKFRAME );
+#else
+ ImplServerGraphics* pGraphics;
+ if ( nFlags & SHOWTRACK_WINDOW )
+ {
+ if ( !IsDeviceOutputNecessary() )
+ return;
+
+ pGraphics = ImplGetServerGraphics();
+ }
+ else
+ {
+ pGraphics = ImplGetServerGraphics( TRUE );
+
+ if ( nFlags & SHOWTRACK_CLIP )
+ {
+ Point aTmpPoint( mnOutOffX, mnOutOffY );
+ Size aTmpSize( mnOutWidth, mnOutHeight );
+ Rectangle aTmpRect( aTmpPoint, aTmpSize );
+ Region aRegion( aTmpRect );
+ ImplClipBoundaries( aRegion, FALSE, FALSE );
+ pGraphics->SetClipRegion( aRegion );
+ }
+ }
+
+ if ( pGraphics )
+ pGraphics->InvertTracking( aPoly, nFlags );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Bei Button-Repeat muessen wir den Timeout umsetzen
+ if ( pSVData->maWinData.mnTrackFlags & STARTTRACK_BUTTONREPEAT )
+ pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() );
+
+ // Tracking-Event erzeugen
+ Point aMousePos( mpFrameData->mnLastMouseX, mpFrameData->mnLastMouseY );
+ MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
+ mpFrameData->mnClickCount, 0,
+ mpFrameData->mnMouseCode, mpFrameData->mnMouseCode );
+ TrackingEvent aTEvt( aMEvt, TRACKING_REPEAT );
+ Tracking( aTEvt );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::StartTracking( USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maWinData.mpTrackWin != this )
+ {
+ if ( pSVData->maWinData.mpTrackWin )
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ }
+
+ if ( nFlags & (STARTTRACK_SCROLLREPEAT | STARTTRACK_BUTTONREPEAT) )
+ {
+ pSVData->maWinData.mpTrackTimer = new AutoTimer;
+
+ if ( nFlags & STARTTRACK_SCROLLREPEAT )
+ pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() );
+ else
+ pSVData->maWinData.mpTrackTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() );
+ pSVData->maWinData.mpTrackTimer->SetTimeoutHdl( LINK( this, Window, ImplTrackTimerHdl ) );
+ pSVData->maWinData.mpTrackTimer->Start();
+ }
+
+ pSVData->maWinData.mpTrackWin = this;
+ pSVData->maWinData.mnTrackFlags = nFlags;
+ CaptureMouse();
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EndTracking( USHORT nFlags )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maWinData.mpTrackWin == this )
+ {
+ // Hier wegen DbgChkThis geklammert, da Window im Handler zerstoert
+ // werden kann
+ {
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( pSVData->maWinData.mpTrackTimer )
+ {
+ delete pSVData->maWinData.mpTrackTimer;
+ pSVData->maWinData.mpTrackTimer = NULL;
+ }
+
+ pSVData->maWinData.mpTrackWin = NULL;
+ pSVData->maWinData.mnTrackFlags = 0;
+ ReleaseMouse();
+ }
+
+ // EndTracking rufen, wenn es gerufen werden soll
+ if ( !(nFlags & ENDTRACK_DONTCALLHDL) )
+ {
+ Point aMousePos( mpFrameData->mnLastMouseX, mpFrameData->mnLastMouseY );
+ MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
+ mpFrameData->mnClickCount, 0,
+ mpFrameData->mnMouseCode, mpFrameData->mnMouseCode );
+ TrackingEvent aTEvt( aMEvt, nFlags | ENDTRACK_END );
+ Tracking( aTEvt );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::IsTracking() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ return (ImplGetSVData()->maWinData.mpTrackWin == this);
+}
+
+// -----------------------------------------------------------------------
+
+void Window::StartAutoScroll( USHORT nFlags )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maWinData.mpAutoScrollWin != this )
+ {
+ if ( pSVData->maWinData.mpAutoScrollWin )
+ pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
+ }
+
+ pSVData->maWinData.mpAutoScrollWin = this;
+ pSVData->maWinData.mnAutoScrollFlags = nFlags;
+ pSVData->maAppData.mpWheelWindow = new ImplWheelWindow( this );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::EndAutoScroll()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maWinData.mpAutoScrollWin == this )
+ {
+ pSVData->maWinData.mpAutoScrollWin = NULL;
+ pSVData->maWinData.mnAutoScrollFlags = 0;
+ delete pSVData->maAppData.mpWheelWindow;
+ pSVData->maAppData.mpWheelWindow = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::IsAutoScroll() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ return (ImplGetSVData()->maWinData.mpAutoScrollWin == this);
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SaveBackground( const Point& rPos, const Size& rSize,
+ const Point& rDestOff, VirtualDevice& rSaveDevice )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpPaintRegion )
+ {
+ Region aClip( *mpPaintRegion );
+ const Point aPixPos( LogicToPixel( rPos ) );
+
+ aClip.Move( -mnOutOffX, -mnOutOffY );
+ aClip.Intersect( Rectangle( aPixPos, LogicToPixel( rSize ) ) );
+
+ if ( !aClip.IsEmpty() )
+ {
+ const Region aOldClip( rSaveDevice.GetClipRegion() );
+ const Point aPixOffset( rSaveDevice.LogicToPixel( rDestOff ) );
+ const Point aPixTopLeft( aClip.GetBoundRect().TopLeft() );
+ const BOOL bMap = rSaveDevice.IsMapModeEnabled();
+
+ // move clip region to have the same distance to DestOffset
+ aClip.Move( aPixOffset.X() - aPixPos.X(), aPixOffset.Y() - aPixPos.Y() );
+
+ // set pixel clip region
+ rSaveDevice.EnableMapMode( FALSE );
+ rSaveDevice.SetClipRegion( aClip );
+ rSaveDevice.EnableMapMode( bMap );
+ rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
+ rSaveDevice.SetClipRegion( aOldClip );
+ }
+ }
+ else
+ rSaveDevice.DrawOutDev( rDestOff, rSize, rPos, rSize, *this );
+}
+
+// -----------------------------------------------------------------------
+
+ULONG Window::SaveFocus()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maWinData.mpFocusWin )
+ {
+ ImplFocusDelData* pDelData = new ImplFocusDelData;
+ pSVData->maWinData.mpFocusWin->ImplAddDel( pDelData );
+ pDelData->mpFocusWin = pSVData->maWinData.mpFocusWin;
+ return (ULONG)(void*)pDelData;
+ }
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::EndSaveFocus( ULONG nSaveId, BOOL bRestore )
+{
+ if ( !nSaveId )
+ return FALSE;
+ else
+ {
+ BOOL bOK = TRUE;
+ ImplFocusDelData* pDelData = (ImplFocusDelData*)(void*)nSaveId;
+ if ( !pDelData->IsDelete() )
+ {
+ pDelData->mpFocusWin->ImplRemoveDel( pDelData );
+ if ( bRestore )
+ pDelData->mpFocusWin->GrabFocus();
+ }
+ else
+ bOK = !bRestore;
+ delete pDelData;
+ return bOK;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetZoom( const Fraction& rZoom )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( maZoom != rZoom )
+ {
+ maZoom = rZoom;
+ StateChanged( STATE_CHANGE_ZOOM );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+inline long WinFloatRound( double fVal )
+{
+ return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) );
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetZoomedPointFont( const Font& rFont )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ const Fraction& rZoom = GetZoom();
+ if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
+ {
+ Font aFont( rFont );
+ Size aSize = aFont.GetSize();
+ double n = (double)aSize.Width();
+ n *= (double)rZoom.GetNumerator();
+ n /= (double)rZoom.GetDenominator();
+ aSize.Width() = WinFloatRound( n );
+ n = (double)aSize.Height();
+ n *= (double)rZoom.GetNumerator();
+ n /= (double)rZoom.GetDenominator();
+ aSize.Height() = WinFloatRound( n );
+ aFont.SetSize( aSize );
+ SetPointFont( aFont );
+
+ // Wenn Darstellung skaliert wird, nehmen wir gegebenenfalls
+ // einen anderen Font, wenn der aktuelle nicht skalierbar ist
+ FontMetric aMetric = GetFontMetric();
+ long nFontDiff = Abs( GetFont().GetSize().Height()-aMetric.GetSize().Height() );
+ if ( (aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2) )
+ {
+ ImplDevFontListData* pStdFont = NULL;
+ USHORT nStdFont = 0xFFFF;
+ if ( aMetric.GetPitch() == PITCH_FIXED )
+ nStdFont = PITCH_FIXED;
+ else if ( aMetric.GetFamily() == FAMILY_SWISS )
+ nStdFont = IMPL_STDFONT_SWISS;
+ else if ( aMetric.GetFamily() == FAMILY_ROMAN )
+ nStdFont = IMPL_STDFONT_ROMAN;
+ if ( nStdFont != 0xFFFF )
+ {
+ if ( mpFontList )
+ pStdFont = mpFontList->GetStandardFont( nStdFont );
+ if ( pStdFont && (aFont.GetName() != pStdFont->maName) )
+ {
+ aFont.SetName( pStdFont->maName );
+ SetPointFont( aFont );
+ }
+ }
+ }
+ }
+ else
+ SetPointFont( rFont );
+}
+
+// -----------------------------------------------------------------------
+
+long Window::CalcZoom( long nCalc ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ const Fraction& rZoom = GetZoom();
+ if ( rZoom.GetNumerator() != rZoom.GetDenominator() )
+ {
+ double n = (double)nCalc;
+ n *= (double)rZoom.GetNumerator();
+ n /= (double)rZoom.GetDenominator();
+ nCalc = WinFloatRound( n );
+ }
+ return nCalc;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetControlFont()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpControlFont )
+ {
+ delete mpControlFont;
+ mpControlFont = NULL;
+ StateChanged( STATE_CHANGE_CONTROLFONT );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetControlFont( const Font& rFont )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( rFont == Font() )
+ {
+ SetControlFont();
+ return;
+ }
+
+ if ( mpControlFont )
+ {
+ if ( *mpControlFont == rFont )
+ return;
+ *mpControlFont = rFont;
+ }
+ else
+ mpControlFont = new Font( rFont );
+
+ StateChanged( STATE_CHANGE_CONTROLFONT );
+}
+
+// -----------------------------------------------------------------------
+
+Font Window::GetControlFont() const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mpControlFont )
+ return *mpControlFont;
+ else
+ {
+ Font aFont;
+ return aFont;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetControlForeground()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mbControlForeground )
+ {
+ maControlForeground = Color( COL_TRANSPARENT );
+ mbControlForeground = FALSE;
+ StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetControlForeground( const Color& rColor )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( rColor.GetTransparency() )
+ {
+ if ( mbControlForeground )
+ {
+ maControlForeground = Color( COL_TRANSPARENT );
+ mbControlForeground = FALSE;
+ StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
+ }
+ }
+ else
+ {
+ if ( maControlForeground != rColor )
+ {
+ maControlForeground = rColor;
+ mbControlForeground = TRUE;
+ StateChanged( STATE_CHANGE_CONTROLFOREGROUND );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetControlBackground()
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( mbControlBackground )
+ {
+ maControlBackground = Color( COL_TRANSPARENT );
+ mbControlBackground = FALSE;
+ StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::SetControlBackground( const Color& rColor )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ if ( rColor.GetTransparency() )
+ {
+ if ( mbControlBackground )
+ {
+ maControlBackground = Color( COL_TRANSPARENT );
+ mbControlBackground = FALSE;
+ StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
+ }
+ }
+ else
+ {
+ if ( maControlBackground != rColor )
+ {
+ maControlBackground = rColor;
+ mbControlBackground = TRUE;
+ StateChanged( STATE_CHANGE_CONTROLBACKGROUND );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+Size Window::CalcWindowSize( const Size& rOutSz ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Size aSz = rOutSz;
+ aSz.Width() += mnLeftBorder+mnRightBorder;
+ aSz.Height() += mnTopBorder+mnBottomBorder;
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Size Window::CalcOutputSize( const Size& rWinSz ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Size aSz = rWinSz;
+ aSz.Width() -= mnLeftBorder+mnRightBorder;
+ aSz.Height() -= mnTopBorder+mnBottomBorder;
+ return aSz;
+}
+
+// -----------------------------------------------------------------------
+
+Font Window::GetDrawPixelFont( OutputDevice* pDev ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ Font aFont = GetPointFont();
+ Size aFontSize = aFont.GetSize();
+ MapMode aPtMapMode( MAP_POINT );
+ aFontSize = pDev->LogicToPixel( aFontSize, aPtMapMode );
+ aFont.SetSize( aFontSize );
+ return aFont;
+}
+
+// -----------------------------------------------------------------------
+
+long Window::GetDrawPixel( OutputDevice* pDev, long nPixels ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ long nP = nPixels;
+ if ( pDev->GetOutDevType() != OUTDEV_WINDOW )
+ {
+ MapMode aMap( MAP_100TH_MM );
+ Size aSz( nP, 0 );
+ aSz = PixelToLogic( aSz, aMap );
+ aSz = pDev->LogicToPixel( aSz, aMap );
+ nP = aSz.Width();
+ }
+ return nP;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL Window::HandleScrollCommand( const CommandEvent& rCmd,
+ ScrollBar* pHScrl, ScrollBar* pVScrl )
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ BOOL bRet = FALSE;
+
+ if ( pHScrl || pVScrl )
+ {
+ switch( rCmd.GetCommand() )
+ {
+ case COMMAND_STARTAUTOSCROLL:
+ {
+ USHORT nFlags = 0;
+ if ( pHScrl )
+ {
+ if ( (pHScrl->GetVisibleSize() < pHScrl->GetRangeMax()) &&
+ pHScrl->IsEnabled() && pHScrl->IsInputEnabled() )
+ nFlags |= AUTOSCROLL_HORZ;
+ }
+ if ( pVScrl )
+ {
+ if ( (pVScrl->GetVisibleSize() < pVScrl->GetRangeMax()) &&
+ pVScrl->IsEnabled() && pVScrl->IsInputEnabled() )
+ nFlags |= AUTOSCROLL_VERT;
+ }
+
+ if ( nFlags )
+ {
+ StartAutoScroll( nFlags );
+ bRet = TRUE;
+ }
+ }
+ break;
+
+ case COMMAND_WHEEL:
+ {
+ const CommandWheelData* pData = rCmd.GetWheelData();
+
+ if ( pData && (COMMAND_WHEEL_SCROLL == pData->GetMode()) && !pData->IsHorz() )
+ {
+ ULONG nScrollLines = pData->GetScrollLines();
+ long nLines;
+ if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
+ {
+ if ( pData->GetDelta() < 0 )
+ nLines = -LONG_MAX;
+ else
+ nLines = LONG_MAX;
+ }
+ else
+ nLines = pData->GetNotchDelta() * (long)nScrollLines;
+ if ( nLines )
+ {
+ ImplHandleScroll( NULL, 0L, pVScrl, nLines );
+ bRet = TRUE;
+ }
+ }
+ }
+ break;
+
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandScrollData* pData = rCmd.GetAutoScrollData();
+ if ( pData && (pData->GetDeltaX() || pData->GetDeltaY()) )
+ {
+ ImplHandleScroll( pHScrl, pData->GetDeltaX(),
+ pVScrl, pData->GetDeltaY() );
+ bRet = TRUE;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX,
+ ScrollBar* pVScrl, long nY )
+{
+ if ( pHScrl && nX && pHScrl->IsEnabled() && pHScrl->IsInputEnabled() )
+ {
+ long nNewPos = pHScrl->GetThumbPos();
+
+ if ( nX == -LONG_MAX )
+ nNewPos += pHScrl->GetPageSize();
+ else if ( nX == LONG_MAX )
+ nNewPos -= pHScrl->GetPageSize();
+ else
+ {
+ const double fVal = (double)nNewPos - ((double)nX * pHScrl->GetLineSize());
+
+ if ( fVal < LONG_MIN )
+ nNewPos = LONG_MIN;
+ else if ( fVal > LONG_MAX )
+ nNewPos = LONG_MAX;
+ else
+ nNewPos = (long)fVal;
+ }
+
+ pHScrl->DoScroll( nNewPos );
+ }
+
+ if ( pVScrl && nY && pVScrl->IsEnabled() && pVScrl->IsInputEnabled() )
+ {
+ long nNewPos = pVScrl->GetThumbPos();
+
+ if ( nY == -LONG_MAX )
+ nNewPos += pVScrl->GetPageSize();
+ else if ( nY == LONG_MAX )
+ nNewPos -= pVScrl->GetPageSize();
+ else
+ {
+ const double fVal = (double)nNewPos - ((double)nY * pVScrl->GetLineSize());
+
+ if ( fVal < LONG_MIN )
+ nNewPos = LONG_MIN;
+ else if ( fVal > LONG_MAX )
+ nNewPos = LONG_MAX;
+ else
+ nNewPos = (long)fVal;
+ }
+
+ pVScrl->DoScroll( nNewPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void Window::GetAccessObject( AccessObjectRef& rAcc ) const
+{
+ DBG_CHKTHIS( Window, ImplDbgCheckWindow );
+
+ rAcc = new AccessObject( (void*) this, ACCESS_TYPE_WND );
+}
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
new file mode 100644
index 000000000000..db3382df3f88
--- /dev/null
+++ b/vcl/source/window/winproc.cxx
@@ -0,0 +1,2151 @@
+/*************************************************************************
+ *
+ * $RCSfile: winproc.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_WINPROC_CXX
+
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#else
+#include <rmwindow.hxx>
+#include <rmevents.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _INTN_HXX
+#include <tools/intn.hxx>
+#endif
+
+#define private public
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_DBGGUI_HXX
+#include <dbggui.hxx>
+#endif
+#ifndef _SV_WINDATA_HXX
+#include <windata.hxx>
+#endif
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_EVENT_HXX
+#include <event.hxx>
+#endif
+#ifndef _SV_SOUND_HXX
+#include <sound.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_CURSOR_HXX
+#include <cursor.hxx>
+#endif
+#ifndef _SV_ACCMGR_HXX
+#include <accmgr.hxx>
+#endif
+#ifndef _SV_PRINT_H
+#include <print.h>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+#ifndef _SV_FLOATWIN_HXX
+#include <floatwin.hxx>
+#endif
+#ifndef _SV_DRAG_HXX
+#include <drag.hxx>
+#endif
+#ifndef _SV_GETSYS_HXX
+#include <getsys.hxx>
+#endif
+#ifndef _SV_HELP_HXX
+#include <help.hxx>
+#endif
+#ifndef _SV_HELPWIN_HXX
+#include <helpwin.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#undef private
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define IMPL_MIN_NEEDSYSWIN 49
+
+// =======================================================================
+
+long ImplCallPreNotify( NotifyEvent& rEvt )
+{
+ long nRet = Application::CallEventHooks( rEvt );
+ if ( !nRet )
+ nRet = rEvt.GetWindow()->PreNotify( rEvt );
+ return nRet;
+}
+
+// =======================================================================
+
+long ImplCallEvent( NotifyEvent& rEvt )
+{
+ long nRet = ImplCallPreNotify( rEvt );
+ if ( !nRet )
+ {
+ Window* pWindow = rEvt.GetWindow();
+ switch ( rEvt.GetType() )
+ {
+ case EVENT_MOUSEBUTTONDOWN:
+ pWindow->MouseButtonDown( *rEvt.GetMouseEvent() );
+ break;
+ case EVENT_MOUSEBUTTONUP:
+ pWindow->MouseButtonUp( *rEvt.GetMouseEvent() );
+ break;
+ case EVENT_MOUSEMOVE:
+ pWindow->MouseMove( *rEvt.GetMouseEvent() );
+ break;
+ case EVENT_KEYINPUT:
+ pWindow->KeyInput( *rEvt.GetKeyEvent() );
+ break;
+ case EVENT_KEYUP:
+ pWindow->KeyUp( *rEvt.GetKeyEvent() );
+ break;
+ case EVENT_GETFOCUS:
+ pWindow->GetFocus();
+ break;
+ case EVENT_LOSEFOCUS:
+ pWindow->LoseFocus();
+ break;
+ case EVENT_COMMAND:
+ pWindow->Command( *rEvt.GetCommandEvent() );
+ break;
+ case EVENT_QUERYDROP:
+ nRet = pWindow->QueryDrop( *rEvt.GetDropEvent() );
+ break;
+ case EVENT_DROP:
+ nRet = pWindow->QueryDrop( *rEvt.GetDropEvent() );
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+// =======================================================================
+
+class ImplDragTimer : public AutoTimer
+{
+ Window* mpWindow;
+
+public:
+ ImplDragTimer( Window* pWindow );
+
+ virtual void Timeout();
+};
+
+static BOOL mbImplDragTimeoutHdl = FALSE;
+
+// -----------------------------------------------------------------------
+
+ImplDragTimer::ImplDragTimer( Window* pWindow )
+{
+ mpWindow = pWindow;
+ SetTimeout( 45 );
+ Start();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDragTimer::Timeout()
+{
+ if ( DragManager::GetDragManager() )
+ {
+ mbImplDragTimeoutHdl = TRUE;
+ mpWindow->ImplCallMouseMove( mpWindow->mpFrameData->mnMouseCode );
+ mbImplDragTimeoutHdl = FALSE;
+ }
+ else
+ {
+ mpWindow->mpFrameData->mpDragTimer = NULL;
+ delete this;
+ }
+}
+
+// =======================================================================
+
+static BOOL ImplHandleMouseFloatMode( Window* pChild, const Point& rMousePos,
+ USHORT nCode, USHORT nSVEvent,
+ BOOL bMouseLeave )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maWinData.mpFirstFloat && !pSVData->maWinData.mpCaptureWin &&
+ !pSVData->maWinData.mpFirstFloat->ImplIsFloatPopupModeWindow( pChild ) )
+ {
+ USHORT nHitTest;
+ FloatingWindow* pFloat = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( rMousePos, nHitTest );
+ FloatingWindow* pLastLevelFloat;
+ ULONG nPopupFlags;
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ {
+ if ( bMouseLeave )
+ return TRUE;
+
+ if ( !pFloat || (nHitTest & IMPL_FLOATWIN_HITTEST_RECT) )
+ {
+ if ( pSVData->maHelpData.mpHelpWin )
+ ImplDestroyHelpWindow();
+ pChild->mpFrame->SetPointer( POINTER_ARROW );
+ return TRUE;
+ }
+ }
+ else
+ {
+ if ( nCode & MOUSE_LEFT )
+ {
+ if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
+ {
+ if ( !pFloat )
+ {
+ pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
+ nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
+ pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+// Erstmal ausgebaut als Hack fuer Bug 53378
+// if ( nPopupFlags & FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK )
+// return FALSE;
+// else
+ return TRUE;
+ }
+ else if ( nHitTest & IMPL_FLOATWIN_HITTEST_RECT )
+ {
+ if ( !(pFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE) )
+ pFloat->ImplSetMouseDown();
+ return TRUE;
+ }
+ }
+ else
+ {
+ if ( pFloat )
+ {
+ if ( nHitTest & IMPL_FLOATWIN_HITTEST_RECT )
+ {
+ if ( pFloat->ImplIsMouseDown() )
+ pFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
+ return TRUE;
+ }
+ }
+ else
+ {
+ pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
+ nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
+ if ( !(nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) )
+ {
+ pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ return TRUE;
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( !pFloat )
+ {
+ pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
+ nPopupFlags = pLastLevelFloat->GetPopupModeFlags();
+ if ( nPopupFlags & FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE )
+ {
+ if ( (nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) &&
+ (nSVEvent == EVENT_MOUSEBUTTONDOWN) )
+ return TRUE;
+ pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ if ( nPopupFlags & FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK )
+ return FALSE;
+ else
+ return TRUE;
+ }
+ else
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleMouseHelpRequest( Window* pChild, const Point& rMousePos )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( ( pChild != pSVData->maHelpData.mpHelpWin ) && !DragManager::GetDragManager() )
+ {
+ USHORT nHelpMode = 0;
+ if ( pSVData->maHelpData.mbQuickHelp )
+ nHelpMode = HELPMODE_QUICK;
+ if ( pSVData->maHelpData.mbBalloonHelp )
+ nHelpMode |= HELPMODE_BALLOON;
+ if ( nHelpMode )
+ {
+ if ( pChild->IsInputEnabled() )
+ {
+ HelpEvent aHelpEvent( rMousePos, nHelpMode );
+ pSVData->maHelpData.mbRequestingHelp = TRUE;
+ pChild->RequestHelp( aHelpEvent );
+ pSVData->maHelpData.mbRequestingHelp = FALSE;
+ }
+ else if ( pSVData->maHelpData.mpHelpWin )
+ {
+ ImplDestroyHelpWindow( FALSE );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSetMousePointer( Window* pChild )
+{
+ // Drag&Drop active?
+ DragManager* pDragManager = DragManager::GetDragManager();
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if( pDragManager && pDragManager->isModifyPointer() )
+ pChild->mpFrame->SetPointer( pDragManager->GetDragPointer().GetStyle() );
+ else if ( pSVData->maHelpData.mbExtHelpMode )
+ pChild->mpFrame->SetPointer( POINTER_HELP );
+ else
+ pChild->mpFrame->SetPointer( pChild->ImplGetMousePointer() );
+}
+
+// -----------------------------------------------------------------------
+
+long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave,
+ long nX, long nY, ULONG nMsgTime,
+ USHORT nCode, USHORT nMode )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ Point aMousePos( nX, nY );
+ Window* pChild;
+ long nRet;
+ USHORT nClicks;
+ USHORT nOldCode = pWindow->mpFrameData->mnMouseCode;
+
+ // we need a mousemove event, befor we get a mousebuttondown or a
+ // mousebuttonup event
+ if ( (nSVEvent == EVENT_MOUSEBUTTONDOWN) ||
+ (nSVEvent == EVENT_MOUSEBUTTONUP) )
+ {
+ if ( (nSVEvent == EVENT_MOUSEBUTTONUP) && pSVData->maHelpData.mbExtHelpMode )
+ Help::EndExtHelp();
+ if ( pSVData->maHelpData.mpHelpWin )
+ ImplDestroyHelpWindow();
+
+ if ( (pWindow->mpFrameData->mnLastMouseX != nX) ||
+ (pWindow->mpFrameData->mnLastMouseY != nY) )
+ {
+ ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, FALSE, nX, nY, nMsgTime, nCode, nMode );
+ }
+ }
+
+ // update frame data
+ pWindow->mpFrameData->mnLastMouseX = nX;
+ pWindow->mpFrameData->mnLastMouseY = nY;
+ pWindow->mpFrameData->mnMouseCode = nCode;
+ pWindow->mpFrameData->mnMouseMode = nMode & ~(MOUSE_SYNTHETIC | MOUSE_MODIFIERCHANGED);
+ if ( bMouseLeave )
+ {
+ pWindow->mpFrameData->mbMouseIn = FALSE;
+ if ( pSVData->maHelpData.mpHelpWin )
+ ImplDestroyHelpWindow();
+
+ // If Drag&Drop is active try to start System-Drag&Drop
+ DragManager* pDragManager = DragManager::GetDragManager();
+ if ( pDragManager )
+ {
+ if ( pWindow->mpFrameData->mpDragTimer )
+ {
+ delete pWindow->mpFrameData->mpDragTimer;
+ pWindow->mpFrameData->mpDragTimer = NULL;
+ }
+ pDragManager->AppWindowLeaved();
+ }
+ }
+ else
+ {
+ // Handle Drag&Drop if window is (re)entered
+ if ( !pWindow->mpFrameData->mbMouseIn )
+ {
+ // Drag&Drop active?
+ DragManager* pDragManager = DragManager::GetDragManager();
+
+ // HRO: Nur Escape rufen, wenn es unser eigenes Drag & Drop war
+ if ( pDragManager && pDragManager->bOwnDragDrop )
+ {
+ // break Drag&Drop, if mouse button is not pressed
+ if( !( nCode & MOUSE_LEFT ) )
+ pDragManager->Escape( pWindow );
+ }
+ }
+
+ pWindow->mpFrameData->mbMouseIn = TRUE;
+ }
+
+ DBG_ASSERT( !pSVData->maWinData.mpTrackWin ||
+ (pSVData->maWinData.mpTrackWin == pSVData->maWinData.mpCaptureWin),
+ "ImplHandleMouseEvent: TrackWin != CaptureWin" );
+
+ // AutoScrollMode
+ if ( pSVData->maWinData.mpAutoScrollWin && (nSVEvent == EVENT_MOUSEBUTTONDOWN) )
+ {
+ pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
+ return 1;
+ }
+
+ // find mouse window
+ if ( pSVData->maWinData.mpCaptureWin )
+ {
+ pChild = pSVData->maWinData.mpCaptureWin;
+
+ DBG_ASSERT( !bMouseLeave || (pWindow != pChild->mpFrameWindow),
+ "ImplHandleMouseEvent: MouseLeave is send and Mouse is captured" );
+ DBG_ASSERT( pWindow == pChild->mpFrameWindow,
+ "ImplHandleMouseEvent: mouse event is not sent to capture window" );
+
+ if ( bMouseLeave )
+ return 0;
+ }
+ else
+ {
+ if ( bMouseLeave )
+ pChild = NULL;
+ else
+ pChild = pWindow->ImplFindWindow( aMousePos );
+ }
+
+ // test this because mouse events are buffered in the remote version
+ // and size may not be in sync
+ if ( !pChild && !bMouseLeave )
+ return 0;
+
+ // Ein paar Test ausfuehren und Message abfangen oder Status umsetzen
+ if ( pChild )
+ {
+ // no mouse messages to system object windows
+#ifndef REMOTE_APPSERVER
+ if ( pChild->mpSysObj )
+ return 0;
+#endif
+
+ // no mouse messages to disabled windows
+ if ( !pChild->IsEnabled() || !pChild->IsInputEnabled() )
+ {
+ ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave );
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ ImplHandleMouseHelpRequest( pChild, aMousePos );
+
+ if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
+ {
+ Sound::Beep( SOUND_DISABLE, pChild );
+ return 1;
+ }
+ else
+ {
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ ImplSetMousePointer( pChild );
+ return 0;
+ }
+ }
+
+ // ExtTextInput-Modus beenden, wenn in das Fenster geklickt wird
+ if ( pChild->IsExtTextInput() )
+ {
+ if ( (nSVEvent == EVENT_MOUSEBUTTONDOWN) ||
+ (nSVEvent == EVENT_MOUSEBUTTONUP) )
+ pChild->EndExtTextInput( EXTTEXTINPUT_END_COMPLETE );
+ }
+ }
+
+ // determine mouse event data
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ {
+ // Testen, ob MouseMove an das gleiche Fenster geht und sich der
+ // Status nicht geaendert hat
+ if ( pChild )
+ {
+ Point aChildMousePos = pChild->ImplFrameToOutput( aMousePos );
+ if ( !bMouseLeave &&
+ (pChild == pWindow->mpFrameData->mpMouseMoveWin) &&
+ (aChildMousePos.X() == pWindow->mpFrameData->mnLastMouseWinX) &&
+ (aChildMousePos.Y() == pWindow->mpFrameData->mnLastMouseWinY) &&
+ (nOldCode == pWindow->mpFrameData->mnMouseCode) &&
+ !mbImplDragTimeoutHdl )
+ {
+ // Mouse-Pointer neu setzen, da er sich geaendet haben
+ // koennte, da ein Modus umgesetzt wurde
+ ImplSetMousePointer( pChild );
+ return 0;
+ }
+
+ pWindow->mpFrameData->mnLastMouseWinX = aChildMousePos.X();
+ pWindow->mpFrameData->mnLastMouseWinY = aChildMousePos.Y();
+ }
+
+ // mouse click
+ nClicks = pWindow->mpFrameData->mnClickCount;
+
+ // Gegebenenfalls den Start-Drag-Handler rufen.
+ // Achtung: Muss vor Move gerufen werden, da sonst bei schnellen
+ // Mausbewegungen die Applikationen in den Selektionszustand gehen.
+ Window* pMouseDownWin = pWindow->mpFrameData->mpMouseDownWin;
+ if ( pMouseDownWin )
+ {
+ // Testen, ob StartDrag-Modus uebereinstimmt. Wir vergleichen nur
+ // den Status der Maustasten, damit man mit Mod1 z.B. sofort
+ // in den Kopiermodus gehen kann.
+ const MouseSettings& rMSettings = pMouseDownWin->GetSettings().GetMouseSettings();
+ if ( (nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) ==
+ (rMSettings.GetStartDragCode() & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) )
+ {
+ if ( !pMouseDownWin->mpFrameData->mbStartDragCalled )
+ {
+ long nDragW = rMSettings.GetStartDragWidth();
+ long nDragH = rMSettings.GetStartDragWidth();
+ long nMouseX = nX;
+ long nMouseY = nY;
+ if ( !(((nMouseX-nDragW) <= pMouseDownWin->mpFrameData->mnFirstMouseX) &&
+ ((nMouseX+nDragW) >= pMouseDownWin->mpFrameData->mnFirstMouseX)) ||
+ !(((nMouseY-nDragH) <= pMouseDownWin->mpFrameData->mnFirstMouseY) &&
+ ((nMouseY+nDragH) >= pMouseDownWin->mpFrameData->mnFirstMouseY)) )
+ {
+ pMouseDownWin->mpFrameData->mbStartDragCalled = TRUE;
+ Point aCmdMousePos( pMouseDownWin->mpFrameData->mnFirstMouseX,
+ pMouseDownWin->mpFrameData->mnFirstMouseY );
+ aCmdMousePos = pMouseDownWin->ImplFrameToOutput( aCmdMousePos );
+ CommandEvent aCEvt( aCmdMousePos, COMMAND_STARTDRAG, TRUE );
+ NotifyEvent aNCmdEvt( EVENT_COMMAND, pMouseDownWin, &aCEvt );
+ ImplDelData aDelData;
+ pMouseDownWin->ImplAddDel( &aDelData );
+ if ( !ImplCallPreNotify( aNCmdEvt ) )
+ pMouseDownWin->Command( aCEvt );
+ if ( aDelData.IsDelete() )
+ return 1;
+ pMouseDownWin->ImplRemoveDel( &aDelData );
+ }
+ }
+ }
+ else
+ pMouseDownWin->mpFrameData->mbStartDragCalled = TRUE;
+ }
+
+ // test for mouseleave and mouseenter
+ Window* pMouseMoveWin = pWindow->mpFrameData->mpMouseMoveWin;
+ if ( pChild != pMouseMoveWin )
+ {
+ if ( pMouseMoveWin )
+ {
+ Point aLeaveMousePos = pMouseMoveWin->ImplFrameToOutput( aMousePos );
+ MouseEvent aMLeaveEvt( aLeaveMousePos, nClicks, nMode | MOUSE_LEAVEWINDOW, nCode, nCode );
+ NotifyEvent aNLeaveEvt( EVENT_MOUSEMOVE, pMouseMoveWin, &aMLeaveEvt );
+ ImplDelData aDelData;
+ ImplDelData aDelData2;
+ pWindow->mpFrameData->mbInMouseMove = TRUE;
+ pMouseMoveWin->ImplAddDel( &aDelData );
+ // Durch MouseLeave kann auch dieses Fenster zerstoert
+ // werden
+ if ( pChild )
+ pChild->ImplAddDel( &aDelData2 );
+ if ( !ImplCallPreNotify( aNLeaveEvt ) )
+ {
+ DragManager* pDragManager = DragManager::GetDragManager();
+ if ( pDragManager )
+ pDragManager->MouseMove( aMLeaveEvt, pMouseMoveWin );
+ else
+ pMouseMoveWin->MouseMove( aMLeaveEvt );
+ }
+
+ pWindow->mpFrameData->mpMouseMoveWin = NULL;
+ pWindow->mpFrameData->mbInMouseMove = FALSE;
+
+ if ( pChild )
+ {
+ if ( aDelData2.IsDelete() )
+ pChild = NULL;
+ else
+ pChild->ImplRemoveDel( &aDelData2 );
+ }
+ if ( aDelData.IsDelete() )
+ return 1;
+ pMouseMoveWin->ImplRemoveDel( &aDelData );
+ }
+
+ nMode |= MOUSE_ENTERWINDOW;
+ }
+ pWindow->mpFrameData->mpMouseMoveWin = pChild;
+
+ // MouseLeave
+ if ( !pChild )
+ return 0;
+ }
+ else
+ {
+ // mouse click
+ if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
+ {
+ const MouseSettings& rMSettings = pChild->GetSettings().GetMouseSettings();
+ ULONG nDblClkTime = rMSettings.GetDoubleClickTime();
+ long nDblClkW = rMSettings.GetDoubleClickWidth();
+ long nDblClkH = rMSettings.GetDoubleClickHeight();
+ long nMouseX = nX;
+ long nMouseY = nY;
+
+ if ( (pChild == pChild->mpFrameData->mpMouseDownWin) &&
+ (nCode == pChild->mpFrameData->mnFirstMouseCode) &&
+ ((nMsgTime-pChild->mpFrameData->mnMouseDownTime) < nDblClkTime) &&
+ ((nMouseX-nDblClkW) <= pChild->mpFrameData->mnFirstMouseX) &&
+ ((nMouseX+nDblClkW) >= pChild->mpFrameData->mnFirstMouseX) &&
+ ((nMouseY-nDblClkH) <= pChild->mpFrameData->mnFirstMouseY) &&
+ ((nMouseY+nDblClkH) >= pChild->mpFrameData->mnFirstMouseY) )
+ {
+ pChild->mpFrameData->mnClickCount++;
+ pChild->mpFrameData->mbStartDragCalled = TRUE;
+ }
+ else
+ {
+ pChild->mpFrameData->mpMouseDownWin = pChild;
+ pChild->mpFrameData->mnClickCount = 1;
+ pChild->mpFrameData->mnFirstMouseX = nMouseX;
+ pChild->mpFrameData->mnFirstMouseY = nMouseY;
+ pChild->mpFrameData->mnFirstMouseCode = nCode;
+ pChild->mpFrameData->mbStartDragCalled = !((nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) ==
+ (rMSettings.GetStartDragCode() & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)));
+ }
+ pChild->mpFrameData->mnMouseDownTime = nMsgTime;
+ }
+ nClicks = pChild->mpFrameData->mnClickCount;
+
+ pSVData->maAppData.mnLastInputTime = Time::GetSystemTicks();
+ }
+
+ DBG_ASSERT( pChild, "ImplHandleMouseEvent: pChild == NULL" );
+
+ // create mouse event
+ Point aChildPos = pChild->ImplFrameToOutput( aMousePos );
+ MouseEvent aMEvt( aChildPos, nClicks, nMode, nCode, nCode );
+
+ // tracking window gets the mouse events
+ BOOL bTracking = FALSE;
+ if ( pSVData->maWinData.mpTrackWin )
+ {
+ pChild = pSVData->maWinData.mpTrackWin;
+ bTracking = TRUE;
+ }
+
+ // handle FloatingMode
+ if ( !pSVData->maWinData.mpTrackWin && pSVData->maWinData.mpFirstFloat )
+ {
+ ImplDelData aDelData;
+ pChild->ImplAddDel( &aDelData );
+ if ( ImplHandleMouseFloatMode( pChild, aMousePos, nCode, nSVEvent, bMouseLeave ) )
+ {
+ if ( !aDelData.IsDelete() )
+ {
+ pChild->ImplRemoveDel( &aDelData );
+ pChild->mpFrameData->mbStartDragCalled = TRUE;
+ }
+ return 1;
+ }
+ else
+ pChild->ImplRemoveDel( &aDelData );
+ }
+
+ // call handler
+ BOOL bDrag = FALSE;
+ BOOL bCallHelpRequest = TRUE;
+ DBG_ASSERT( pChild, "ImplHandleMouseEvent: pChild is NULL" );
+
+ ImplDelData aDelData;
+ NotifyEvent aNEvt( nSVEvent, pChild, &aMEvt );
+ pChild->ImplAddDel( &aDelData );
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ pChild->mpFrameData->mbInMouseMove = TRUE;
+ // D&D im Gange?
+ DragManager* pDragManager = DragManager::GetDragManager();
+ if ( pDragManager )
+ {
+ bDrag = TRUE;
+ nRet = 1;
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ {
+ if ( !pChild->mpFrameData->mpDragTimer )
+ pChild->mpFrameData->mpDragTimer = new ImplDragTimer( pChild->ImplGetFrameWindow() );
+ pDragManager->MouseMove( aMEvt, pChild );
+ }
+ else if ( nSVEvent == EVENT_MOUSEBUTTONUP )
+ {
+ pChild->ImplGenerateMouseMove();
+ pDragManager->ButtonUp( aMEvt, pChild );
+ }
+ }
+ else
+ {
+ // Fenster bei Klick nach vorne bringen
+ if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
+ {
+ pChild->ToTop();
+ if ( aDelData.IsDelete() )
+ return 1;
+ }
+
+ if ( ImplCallPreNotify( aNEvt ) || aDelData.IsDelete() )
+ nRet = 1;
+ else
+ {
+ nRet = 0;
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ {
+ if ( bTracking )
+ {
+ TrackingEvent aTEvt( aMEvt );
+ pChild->Tracking( aTEvt );
+ if ( !aDelData.IsDelete() )
+ {
+ // When ScrollRepeat, we restart the timer
+ if ( pSVData->maWinData.mpTrackTimer &&
+ (pSVData->maWinData.mnTrackFlags & STARTTRACK_SCROLLREPEAT) )
+ pSVData->maWinData.mpTrackTimer->Start();
+ }
+ bCallHelpRequest = FALSE;
+ nRet = 1;
+ }
+ else
+ {
+ // Auto-ToTop
+ if ( !pSVData->maWinData.mpCaptureWin &&
+ (pChild->GetSettings().GetMouseSettings().GetOptions() & MOUSE_OPTION_AUTOFOCUS) )
+ pChild->ToTop( TOTOP_NOGRABFOCUS );
+
+ // Wenn Hilfe-Fenster im MouseMove angezeigt/gehidet wird,
+ // wird danach nicht mehr der HelpRequest-Handler gerufen
+ Window* pOldHelpTextWin = pSVData->maHelpData.mpHelpWin;
+ pChild->mbMouseMove = FALSE;
+ pChild->MouseMove( aMEvt );
+ if ( pOldHelpTextWin != pSVData->maHelpData.mpHelpWin )
+ bCallHelpRequest = FALSE;
+ }
+ }
+ else if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
+ {
+ if ( bTracking &&
+ !(pSVData->maWinData.mnTrackFlags & STARTTRACK_MOUSEBUTTONDOWN) )
+ nRet = 1;
+ else
+ {
+ pChild->mbMouseButtonDown = FALSE;
+ pChild->MouseButtonDown( aMEvt );
+ }
+ }
+ else
+ {
+ if ( bTracking )
+ {
+ pChild->EndTracking();
+ nRet = 1;
+ }
+ else
+ {
+ pChild->mbMouseButtonUp = FALSE;
+ pChild->MouseButtonUp( aMEvt );
+ }
+ }
+ }
+ }
+
+ if ( aDelData.IsDelete() )
+ return 1;
+
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ pChild->mpFrameData->mbInMouseMove = FALSE;
+
+ if ( nSVEvent == EVENT_MOUSEMOVE )
+ {
+ if ( bCallHelpRequest )
+ ImplHandleMouseHelpRequest( pChild, pChild->OutputToScreenPixel( aMEvt.GetPosPixel() ) );
+ nRet = 1;
+ }
+ else if ( !nRet )
+ {
+ if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
+ {
+ if ( !pChild->mbMouseButtonDown )
+ nRet = 1;
+ }
+ else
+ {
+ if ( !pChild->mbMouseButtonUp )
+ nRet = 1;
+ }
+ }
+
+ pChild->ImplRemoveDel( &aDelData );
+
+ // ContextMenu
+ if ( !bDrag && ((nSVEvent == EVENT_MOUSEBUTTONDOWN) || (nSVEvent == EVENT_MOUSEBUTTONUP)) )
+ {
+ // StartAutoScrollMode-Command-Event
+ if ( /*(nRet == 0) &&*/ (nClicks == 1) && (nSVEvent == EVENT_MOUSEBUTTONDOWN) &&
+ (nCode == MOUSE_MIDDLE) )
+ {
+ BOOL bPreNotify;
+ CommandEvent aCEvt( aChildPos, COMMAND_STARTAUTOSCROLL, TRUE );
+ NotifyEvent aNCmdEvt( EVENT_COMMAND, pChild, &aCEvt );
+ ImplDelData aDelData;
+ pChild->ImplAddDel( &aDelData );
+ if ( !ImplCallPreNotify( aNCmdEvt ) && !aDelData.IsDelete() )
+ {
+ bPreNotify = FALSE;
+
+ pChild->mbCommand = FALSE;
+ pChild->Command( aCEvt );
+ }
+ else
+ bPreNotify = TRUE;
+ if ( aDelData.IsDelete() )
+ return 1;
+ pChild->ImplRemoveDel( &aDelData );
+ if ( !bPreNotify && pChild->mbCommand )
+ nRet = 0;
+ else
+ nRet = 1;
+ }
+ else
+ {
+ const MouseSettings& rMSettings = pChild->GetSettings().GetMouseSettings();
+ if ( (nCode == rMSettings.GetContextMenuCode()) &&
+ (nClicks == rMSettings.GetContextMenuClicks()) )
+ {
+ BOOL bContextMenu;
+ if ( rMSettings.GetContextMenuDown() )
+ bContextMenu = (nSVEvent == EVENT_MOUSEBUTTONDOWN);
+ else
+ bContextMenu = (nSVEvent == EVENT_MOUSEBUTTONUP);
+ if ( bContextMenu )
+ {
+ BOOL bPreNotify;
+ CommandEvent aCEvt( aChildPos, COMMAND_CONTEXTMENU, TRUE );
+ NotifyEvent aNCmdEvt( EVENT_COMMAND, pChild, &aCEvt );
+ ImplDelData aDelData;
+ pChild->ImplAddDel( &aDelData );
+ if ( !ImplCallPreNotify( aNCmdEvt ) && !aDelData.IsDelete() )
+ {
+ bPreNotify = FALSE;
+
+ pChild->mbCommand = FALSE;
+ pChild->Command( aCEvt );
+ }
+ else
+ bPreNotify = TRUE;
+ if ( aDelData.IsDelete() )
+ return 1;
+ pChild->ImplRemoveDel( &aDelData );
+ if ( !bPreNotify && pChild->mbCommand )
+ nRet = 0;
+ else
+ nRet = 1;
+ }
+ }
+ }
+ }
+
+ // set new mouse pointer
+ if ( (nSVEvent == EVENT_MOUSEMOVE) && !bMouseLeave )
+ ImplSetMousePointer( pChild );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static Window* ImplGetKeyInputWindow( Window* pWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // determine last input time
+ pSVData->maAppData.mnLastInputTime = Time::GetSystemTicks();
+
+ // find window
+ Window* pChild = pWindow->mpFrameData->mpFocusWin;
+
+ // Nur KeyInput an das Focus-Window auswerten
+ if ( !pChild || (pChild != pSVData->maWinData.mpFocusWin) )
+ return 0;
+ DBG_ASSERT( pChild == pSVData->maWinData.mpFocusWin,
+ "ImplHandleKey: Keyboard-Input is sent to the wrong frame" );
+
+ // no keyinput to disabled windows
+ if ( !pChild->IsEnabled() || !pChild->IsInputEnabled() )
+ return 0;
+
+ return pChild;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleKey( Window* pWindow, USHORT nSVEvent,
+ USHORT nKeyCode, USHORT nCharCode, USHORT nRepeat )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ KeyCode aKeyCode( nKeyCode, nKeyCode );
+ USHORT nCode = aKeyCode.GetCode();
+
+ // determine last input time
+ pSVData->maAppData.mnLastInputTime = Time::GetSystemTicks();
+
+ // handle tracking window
+ if ( nSVEvent == EVENT_KEYINPUT )
+ {
+#ifdef DBG_UTIL
+#ifdef REMOTE_APPSERVER
+ if ( aKeyCode.IsShift() && aKeyCode.IsMod2() && (aKeyCode.GetCode() == KEY_D) )
+#else
+ if ( aKeyCode.IsShift() && aKeyCode.IsMod1() && (aKeyCode.GetCode() == KEY_D) )
+#endif
+ {
+ DBGGUI_START();
+ return 1;
+ }
+#endif
+
+ if ( pSVData->maHelpData.mbExtHelpMode )
+ {
+ Help::EndExtHelp();
+ if ( nCode == KEY_ESCAPE )
+ return 1;
+ }
+ if ( pSVData->maHelpData.mpHelpWin )
+ ImplDestroyHelpWindow();
+
+ // AutoScrollMode
+ if ( pSVData->maWinData.mpAutoScrollWin )
+ {
+ pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
+ if ( nCode == KEY_ESCAPE )
+ return 1;
+ }
+
+ // D&D im Gange und Escape?
+ if ( nCode == KEY_ESCAPE )
+ {
+ DragManager* pDragManager = DragManager::GetDragManager();
+ if ( pDragManager )
+ {
+ // Ist pWindow immer das TargetWindow?
+ // Nicht unbedingt. Aktuelles TargetWindow im DragManager merken?
+ pWindow->ImplGenerateMouseMove();
+ pDragManager->Escape( pWindow );
+ return 1;
+ }
+ }
+
+ if ( pSVData->maWinData.mpTrackWin )
+ {
+ USHORT nCode = aKeyCode.GetCode();
+
+ if ( (nCode == KEY_ESCAPE) && !(pSVData->maWinData.mnTrackFlags & STARTTRACK_NOKEYCANCEL) )
+ {
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL | ENDTRACK_KEY );
+ if ( pSVData->maWinData.mpFirstFloat )
+ {
+ FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
+ if ( !(pLastLevelFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOKEYCLOSE) )
+ {
+ USHORT nCode = aKeyCode.GetCode();
+
+ if ( nCode == KEY_ESCAPE )
+ pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
+ }
+ return 1;
+ }
+ else if ( nCode == KEY_RETURN )
+ {
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_KEY );
+ return 1;
+ }
+ else if ( !(pSVData->maWinData.mnTrackFlags & STARTTRACK_KEYINPUT) )
+ return 1;
+ }
+
+ // handle FloatingMode
+ if ( pSVData->maWinData.mpFirstFloat )
+ {
+ FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
+ if ( !(pLastLevelFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOKEYCLOSE) )
+ {
+ USHORT nCode = aKeyCode.GetCode();
+
+ if ( nCode == KEY_ESCAPE )
+ {
+ pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ return 1;
+ }
+ }
+ }
+
+ // test for accel
+ if ( pSVData->maAppData.mpAccelMgr )
+ {
+ if ( pSVData->maAppData.mpAccelMgr->IsAccelKey( aKeyCode, nRepeat ) )
+ return 1;
+ }
+ }
+
+ // find window
+ Window* pChild = pWindow->mpFrameData->mpFocusWin;
+
+ // Nur KeyInput an das Focus-Window auswerten
+ if ( !pChild || (pChild != pSVData->maWinData.mpFocusWin) )
+ return 0;
+ DBG_ASSERT( pChild == pSVData->maWinData.mpFocusWin,
+ "ImplHandleKey: Keyboard-Input is sent to the wrong frame" );
+
+ // no keyinput to disabled windows
+ if ( !pChild->IsEnabled() || !pChild->IsInputEnabled() )
+ return 0;
+
+ // call handler
+ ImplDelData aDelData;
+ KeyEvent aKEvt( (xub_Unicode)nCharCode, aKeyCode, nRepeat );
+ NotifyEvent aNEvt( nSVEvent, pChild, &aKEvt );
+ BOOL bPreNotify;
+ long nRet = 1;
+
+ pChild->ImplAddDel( &aDelData );
+ if ( !ImplCallPreNotify( aNEvt ) && !aDelData.IsDelete() )
+ {
+ bPreNotify = FALSE;
+
+ if ( nSVEvent == EVENT_KEYINPUT )
+ {
+ pChild->mbKeyInput = FALSE;
+ pChild->KeyInput( aKEvt );
+ }
+ else
+ {
+ pChild->mbKeyUp = FALSE;
+ pChild->KeyUp( aKEvt );
+ }
+ }
+ else
+ bPreNotify = TRUE;
+
+ if ( aDelData.IsDelete() )
+ return 1;
+
+ pChild->ImplRemoveDel( &aDelData );
+
+ if ( nSVEvent == EVENT_KEYINPUT )
+ {
+ if ( !bPreNotify && pChild->mbKeyInput )
+ {
+ USHORT nCode = aKeyCode.GetCode();
+
+ // ContextMenu
+ if ( (nCode == KEY_CONTEXTMENU) || ((nCode == KEY_F10) && aKeyCode.IsShift()) )
+ {
+ CommandEvent aCEvt( pChild->GetPointerPosPixel(), COMMAND_CONTEXTMENU, FALSE );
+ NotifyEvent aNCmdEvt( EVENT_COMMAND, pChild, &aCEvt );
+ ImplDelData aDelData;
+ pChild->ImplAddDel( &aDelData );
+ if ( !ImplCallPreNotify( aNCmdEvt ) && !aDelData.IsDelete() )
+ {
+ bPreNotify = FALSE;
+
+ pChild->mbCommand = FALSE;
+ pChild->Command( aCEvt );
+ }
+ else
+ bPreNotify = TRUE;
+ if ( aDelData.IsDelete() )
+ return 1;
+ pChild->ImplRemoveDel( &aDelData );
+ if ( !bPreNotify && pChild->mbCommand )
+ nRet = 0;
+ }
+ else if ( (nCode == KEY_F1) || (nCode == KEY_HELP) )
+ {
+ if ( !aKeyCode.GetModifier() )
+ {
+ if ( pSVData->maHelpData.mbContextHelp )
+ {
+ Point aMousePos = pChild->OutputToScreenPixel( pChild->GetPointerPosPixel() );
+ HelpEvent aHelpEvent( aMousePos, HELPMODE_CONTEXT );
+ pChild->RequestHelp( aHelpEvent );
+ }
+ else
+ nRet = 0;
+ }
+ else if ( aKeyCode.IsShift() )
+ {
+ if ( pSVData->maHelpData.mbExtHelp )
+ Help::StartExtHelp();
+ else
+ nRet = 0;
+ }
+ }
+ else
+ {
+ if ( ImplCallHotKey( aKeyCode ) )
+ nRet = 1;
+ else
+ nRet = 0;
+ }
+ }
+ }
+ else
+ {
+ if ( !bPreNotify && pChild->mbKeyUp )
+ nRet = 0;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplCallExtTextInput( Window* pChild, USHORT nEvt,
+ void* pData = NULL )
+{
+ CommandEvent aCEvt( pChild->GetPointerPosPixel(), nEvt, FALSE, pData );
+ NotifyEvent aNCmdEvt( EVENT_COMMAND, pChild, &aCEvt );
+ ImplDelData aDelData;
+ BOOL bPreNotify;
+ pChild->ImplAddDel( &aDelData );
+ if ( !ImplCallPreNotify( aNCmdEvt ) && !aDelData.IsDelete() )
+ {
+ bPreNotify = FALSE;
+
+ pChild->mbCommand = FALSE;
+ pChild->Command( aCEvt );
+ }
+ else
+ bPreNotify = TRUE;
+ if ( aDelData.IsDelete() )
+ return FALSE;
+ pChild->ImplRemoveDel( &aDelData );
+ if ( !bPreNotify && pChild->mbCommand )
+ return TRUE;
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleStartExtTextInput( Window* pWindow )
+{
+ Window* pChild = ImplGetKeyInputWindow( pWindow );
+ long nRet = 0;
+ if ( pChild )
+ {
+ pChild->mbExtTextInput = TRUE;
+ pChild->ImplGetWinData()->mnExtOldTextLen = 0;
+ nRet = ImplCallExtTextInput( pChild, COMMAND_STARTEXTTEXTINPUT );
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleEndExtTextInput( Window* pWindow )
+{
+ Window* pChild = ImplGetKeyInputWindow( pWindow );
+ long nRet = 0;
+ if ( pChild )
+ {
+ pChild->mbExtTextInput = FALSE;
+ pChild->ImplGetWinData()->mnExtOldTextLen = 0;
+ nRet = ImplCallExtTextInput( pChild, COMMAND_ENDEXTTEXTINPUT );
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleExtTextInput( Window* pWindow, ULONG nTime,
+ const XubString& rText,
+ const USHORT* pTextAttr,
+ ULONG nCursorPos, BOOL bCursorVisible,
+ ULONG nDeltaStart, BOOL bOnlyCursor )
+{
+ Window* pChild = ImplGetKeyInputWindow( pWindow );
+ long nRet = 0;
+ if ( pChild )
+ {
+ BOOL bSmartMode = FALSE;
+ if ( !pChild->mbExtTextInput )
+ {
+ bSmartMode = TRUE;
+ ImplHandleStartExtTextInput( pWindow );
+ }
+ CommandExtTextInputData aData( rText, pTextAttr,
+ (USHORT)nCursorPos, bCursorVisible,
+ (USHORT)nDeltaStart,
+ pChild->ImplGetWinData()->mnExtOldTextLen,
+ bOnlyCursor );
+ pChild->ImplGetWinData()->mnExtOldTextLen = rText.Len();
+ nRet = ImplCallExtTextInput( pChild, COMMAND_EXTTEXTINPUT, &aData );
+ if ( bSmartMode )
+ {
+ // TextAttribute muessen zum Schluss restauriert ausgegeben werden
+ if ( pTextAttr )
+ {
+ ImplHandleExtTextInput( pWindow, nTime, rText, NULL,
+ nCursorPos, bCursorVisible,
+ nDeltaStart, bOnlyCursor );
+ }
+ ImplHandleEndExtTextInput( pWindow );
+ }
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static Window* ImplHandleExtTextInputPos( Window* pWindow, ULONG nFirst,
+ ULONG nChars )
+{
+ Window* pChild = ImplGetKeyInputWindow( pWindow );
+ if ( pChild )
+ {
+ CommandExtTextInputPosData aData( (USHORT)nFirst, (USHORT)nChars, EXTTEXTINPUTPOS_NOSHOWPOS );
+ ImplCallExtTextInput( pChild, COMMAND_EXTTEXTINPUTPOS, &aData );
+ }
+ return pChild;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleInputContextChange( Window* pWindow )
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleICursorPos( Window* pWindow, long& rX, long& rY,
+ long& rWidth, long& rHeight )
+{
+ rX = 0;
+ rY = 0;
+ rWidth = 0;
+ rHeight = 0;
+
+ Window* pChild = ImplGetKeyInputWindow( pWindow );
+ if ( pChild )
+ {
+ ImplCallExtTextInput( pChild, COMMAND_CURSORPOS );
+ Cursor* pCursor = pChild->GetCursor();
+ if ( pCursor )
+ {
+ Point aPos = pChild->ImplLogicToDevicePixel( pCursor->GetPos() );
+ rX = aPos.X();
+ rY = aPos.Y();
+ Size aSize = pChild->LogicToPixel( pCursor->GetSize() );
+ rWidth = aSize.Width();
+ rHeight = aSize.Height();
+ if ( !aSize.Width() )
+ rWidth = pChild->GetSettings().GetStyleSettings().GetCursorSize();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplCallWheelCommand( Window* pWindow, const Point& rPos,
+ const CommandWheelData* pWheelData )
+{
+ Point aCmdMousePos = pWindow->ImplFrameToOutput( rPos );
+ CommandEvent aCEvt( aCmdMousePos, COMMAND_WHEEL, TRUE, pWheelData );
+ NotifyEvent aNCmdEvt( EVENT_COMMAND, pWindow, &aCEvt );
+ ImplDelData aDelData;
+ BOOL bPreNotify;
+ pWindow->ImplAddDel( &aDelData );
+ if ( !ImplCallPreNotify( aNCmdEvt ) && !aDelData.IsDelete() )
+ {
+ bPreNotify = FALSE;
+
+ pWindow->mbCommand = FALSE;
+ pWindow->Command( aCEvt );
+ }
+ else
+ bPreNotify = TRUE;
+ if ( aDelData.IsDelete() )
+ return FALSE;
+ pWindow->ImplRemoveDel( &aDelData );
+ if ( !bPreNotify && pWindow->mbCommand )
+ return TRUE;
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplHandleWheelEvent( Window* pWindow,
+ long nX, long nY, ULONG nMsgTime,
+ long nDelta, long nNotchDelta,
+ ULONG nScrollLines, USHORT nCode, BOOL bHorz )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ USHORT nMode;
+
+ if ( pSVData->maHelpData.mpHelpWin )
+ ImplDestroyHelpWindow();
+
+ if ( nCode & KEY_MOD1 )
+ nMode = COMMAND_WHEEL_ZOOM;
+ else if ( nCode & KEY_SHIFT )
+ nMode = COMMAND_WHEEL_DATAZOOM;
+ else
+ nMode = COMMAND_WHEEL_SCROLL;
+
+ Point aMousePos( nX, nY );
+ CommandWheelData aWheelData( nDelta, nNotchDelta, nScrollLines, nMode, nCode, bHorz );
+ BOOL bRet = TRUE;
+
+ // Zuerst rufen wir den Command an dem Fenster, worueber die Maus steht
+ Window* pMouseWindow = pWindow->ImplFindWindow( aMousePos );
+ if ( pMouseWindow &&
+ pMouseWindow->IsEnabled() && pMouseWindow->IsInputEnabled() )
+ bRet = ImplCallWheelCommand( pMouseWindow, aMousePos, &aWheelData );
+
+ // Wenn das Fenster ueber dem die Maus steht, den Event nicht
+ // verarbeitet hat, rufen wir Command an dem Focus-Window
+ if ( bRet )
+ {
+ Window* pFocusWindow = pWindow->mpFrameData->mpFocusWin;
+ if ( pFocusWindow && (pFocusWindow != pMouseWindow) &&
+ (pFocusWindow == pSVData->maWinData.mpFocusWin) )
+ {
+ // no wheel-messages to disabled windows
+ if ( pFocusWindow->IsEnabled() && pFocusWindow->IsInputEnabled() )
+ bRet = ImplCallWheelCommand( pFocusWindow, aMousePos, &aWheelData );
+ }
+ }
+
+ return !bRet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandlePaint( Window* pWindow, const Rectangle& rBoundRect )
+{
+ // Bei Paints vom System, auch Hintergrund-Sicherung aufgeben
+ Window* pSaveBackWin = pWindow->mpFrameData->mpFirstBackWin;
+ while ( pSaveBackWin )
+ {
+ Window* pNext = pSaveBackWin->mpOverlapData->mpNextBackWin;
+ Rectangle aRect( Point( pSaveBackWin->mnOutOffX, pSaveBackWin->mnOutOffY ),
+ Size( pSaveBackWin->mnOutWidth, pSaveBackWin->mnOutHeight ) );
+ if ( aRect.IsOver( rBoundRect ) )
+ pSaveBackWin->ImplDeleteOverlapBackground();
+ pSaveBackWin = pNext;
+ }
+
+ // Paint fuer alle Fenster ausloesen, die im neu zu malenden Bereich
+ // liegen
+ Region aRegion( rBoundRect );
+ pWindow->ImplInvalidateOverlapFrameRegion( aRegion );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight )
+{
+ if ( (nNewWidth > 0) && (nNewHeight > 0) ||
+ pWindow->ImplGetWindow()->mbAllResize )
+ {
+ if ( (nNewWidth != pWindow->mnOutWidth) || (nNewHeight != pWindow->mnOutHeight) )
+ {
+ pWindow->mnOutWidth = nNewWidth;
+ pWindow->mnOutHeight = nNewHeight;
+ pWindow->mbWaitSystemResize = FALSE;
+ if ( pWindow->IsReallyVisible() )
+ pWindow->ImplSetClipFlag();
+ if ( pWindow->IsVisible() || pWindow->ImplGetWindow()->mbAllResize )
+ pWindow->Resize();
+ else
+ pWindow->mbCallResize = TRUE;
+ }
+ }
+
+ pWindow->mpFrameData->mbNeedSysWindow = (nNewWidth < IMPL_MIN_NEEDSYSWIN) ||
+ (nNewHeight < IMPL_MIN_NEEDSYSWIN);
+ pWindow->mpFrameData->mbMinimized = (nNewWidth <= 0) || (nNewHeight <= 0);
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplActivateFloatingWindows( Window* pWindow, BOOL bActive )
+{
+ // Zuerst alle ueberlappenden Fenster ueberpruefen
+ Window* pTempWindow = pWindow->mpFirstOverlap;
+ while ( pTempWindow )
+ {
+ if ( !pTempWindow->GetActivateMode() )
+ {
+ if ( (pTempWindow->GetType() == WINDOW_BORDERWINDOW) &&
+ (pTempWindow->ImplGetWindow()->GetType() == WINDOW_FLOATINGWINDOW) )
+ ((ImplBorderWindow*)pTempWindow)->SetDisplayActive( bActive );
+ }
+
+ ImplActivateFloatingWindows( pTempWindow, bActive );
+ pTempWindow = pTempWindow->mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG )
+{
+ mpFrameData->mnFocusId = 0;
+
+ // Wenn Status erhalten geblieben ist, weil wir den Focus in der
+ // zwischenzeit schon wiederbekommen haben, brauchen wir auch
+ // nichts machen
+ BOOL bHasFocus = mpFrameData->mbHasFocus || mpFrameData->mbSysObjFocus;
+
+ // Dann die zeitverzoegerten Funktionen ausfuehren
+ if ( bHasFocus )
+ {
+ // Alle FloatingFenster deaktiv zeichnen
+ if ( mpFrameData->mbStartFocusState != bHasFocus )
+ ImplActivateFloatingWindows( this, bHasFocus );
+
+ if ( mpFrameData->mpFocusWin )
+ {
+ if ( mpFrameData->mpFocusWin->IsEnabled() )
+ mpFrameData->mpFocusWin->GrabFocus();
+ else
+ mpFrameData->mpFocusWin->ImplGetFirstOverlapWindow()->GrabFocus();
+ }
+ else
+ GrabFocus();
+ }
+ else
+ {
+ Window* pFocusWin = mpFrameData->mpFocusWin;
+ if ( pFocusWin )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maWinData.mpFocusWin == pFocusWin )
+ {
+ // FocusWindow umsetzen
+ Window* pOverlapWindow = pFocusWin->ImplGetFirstOverlapWindow();
+ pOverlapWindow->mpLastFocusWindow = pFocusWin;
+ pSVData->maWinData.mpFocusWin = NULL;
+
+ if ( pFocusWin->mpCursor )
+ pFocusWin->mpCursor->ImplHide();
+
+ // Deaktivate rufen
+ Window* pOldFocusWindow = pFocusWin;
+ if ( pOldFocusWindow )
+ {
+ Window* pOldOverlapWindow = pOldFocusWindow->ImplGetFirstOverlapWindow();
+ Window* pOldRealWindow = pOldOverlapWindow->ImplGetWindow();
+
+ pOldOverlapWindow->mbActive = FALSE;
+ pOldOverlapWindow->Deactivate();
+ if ( pOldRealWindow != pOldOverlapWindow )
+ {
+ pOldRealWindow->mbActive = FALSE;
+ pOldRealWindow->Deactivate();
+ }
+ }
+
+ // TrackingMode is ended in ImplHandleLoseFocus
+ pFocusWin->EndExtTextInput( EXTTEXTINPUT_END_COMPLETE );
+ NotifyEvent aNEvt( EVENT_LOSEFOCUS, pFocusWin );
+ if ( !ImplCallPreNotify( aNEvt ) )
+ pFocusWin->LoseFocus();
+ pFocusWin->ImplCallDeactivateListeners( NULL );
+ GetpApp()->FocusChanged();
+ }
+ }
+
+ // Alle FloatingFenster deaktiv zeichnen
+ if ( mpFrameData->mbStartFocusState != bHasFocus )
+ ImplActivateFloatingWindows( this, bHasFocus );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleGetFocus( Window* pWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ InvalidateSystemClipboard();
+
+ pWindow->mpFrameData->mbHasFocus = TRUE;
+
+ // Focus-Events zeitverzoegert ausfuehren, damit bei SystemChildFenstern
+ // nicht alles flackert, wenn diese den Focus bekommen
+ if ( !pWindow->mpFrameData->mnFocusId )
+ {
+ pWindow->mpFrameData->mbStartFocusState = !pWindow->mpFrameData->mbHasFocus;
+ Application::PostUserEvent( pWindow->mpFrameData->mnFocusId, LINK( pWindow, Window, ImplAsyncFocusHdl ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleLoseFocus( Window* pWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Wenn wir den Focus verlieren gehen wir erst mal davon aus, dass sich das
+ // Systemclipboard aendert.
+ UpdateSystemClipboard();
+
+ // Wenn Frame den Focus verliert, brechen wir auch ein AutoScroll ab
+ if ( pSVData->maWinData.mpAutoScrollWin )
+ pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
+
+ // Wenn Frame den Focus verliert, brechen wir auch ein Tracking ab
+ if ( pSVData->maWinData.mpTrackWin )
+ {
+ if ( pSVData->maWinData.mpTrackWin->mpFrameWindow == pWindow )
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
+ }
+
+ // handle FloatingMode
+ // hier beenden wir immer den PopupModus, auch dann, wenn NOFOCUSCLOSE
+ // gesetzt ist, damit wir nicht beim Wechsel noch Fenster stehen lassen
+ if ( pSVData->maWinData.mpFirstFloat )
+ {
+ if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE) )
+ pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
+
+ pWindow->mpFrameData->mbHasFocus = FALSE;
+
+ // Focus-Events zeitverzoegert ausfuehren, damit bei SystemChildFenstern
+ // nicht alles flackert, wenn diese den Focus bekommen
+ if ( !pWindow->mpFrameData->mnFocusId )
+ {
+ pWindow->mpFrameData->mbStartFocusState = !pWindow->mpFrameData->mbHasFocus;
+ Application::PostUserEvent( pWindow->mpFrameData->mnFocusId, LINK( pWindow, Window, ImplAsyncFocusHdl ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplHandleClose( Window* pWindow )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+
+ // Bei Close schliessen wir erstmal alle FloatingModi mit
+ // und brechen auch sonstige Ablaeufe
+ if ( pSVData->maWinData.mpFirstFloat )
+ {
+ FloatingWindow* pLastLevelFloat;
+ pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
+ pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
+ if ( pSVData->maHelpData.mbExtHelpMode )
+ Help::EndExtHelp();
+ if ( pSVData->maHelpData.mpHelpWin )
+ ImplDestroyHelpWindow();
+ // AutoScrollMode
+ if ( pSVData->maWinData.mpAutoScrollWin )
+ pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
+ DragManager* pDragManager = DragManager::GetDragManager();
+ if ( pDragManager )
+ {
+ pWindow->ImplGenerateMouseMove();
+ pDragManager->Escape( pWindow );
+ }
+ if ( pSVData->maWinData.mpTrackWin )
+ pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL | ENDTRACK_KEY );
+
+ // Dann stellen wir fest, ob Close ueberhaupt erlaubt ist
+ SystemWindow* pSysWindow = (SystemWindow*)pWindow->ImplGetWindow();
+ if ( !pSysWindow->IsEnabled() || !pSysWindow->IsInputEnabled() )
+ Sound::Beep( SOUND_DISABLE, pSysWindow );
+ else
+ pSysWindow->Close();
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleUserEvent( ImplSVEvent* pSVEvent )
+{
+ if ( pSVEvent )
+ {
+ if ( pSVEvent->mbCall && !pSVEvent->maDelData.IsDelete() )
+ {
+ if ( pSVEvent->mpWindow )
+ {
+ pSVEvent->mpWindow->ImplRemoveDel( &(pSVEvent->maDelData) );
+ if ( pSVEvent->mpLink )
+ pSVEvent->mpLink->Call( pSVEvent->mpData );
+ else
+ pSVEvent->mpWindow->UserEvent( pSVEvent->mnEvent, pSVEvent->mpData );
+ }
+ else
+ {
+ if ( pSVEvent->mpLink )
+ pSVEvent->mpLink->Call( pSVEvent->mpData );
+ else
+ GetpApp()->UserEvent( pSVEvent->mnEvent, pSVEvent->mpData );
+ }
+ }
+
+ delete pSVEvent->mpLink;
+ delete pSVEvent;
+ }
+}
+
+// =======================================================================
+
+#ifndef REMOTE_APPSERVER
+
+static USHORT ImplGetMouseMoveMode( SalMouseEvent* pEvent )
+{
+ USHORT nMode = 0;
+ if ( !pEvent->mnCode )
+ nMode |= MOUSE_SIMPLEMOVE;
+ if ( (pEvent->mnCode & MOUSE_LEFT) && !(pEvent->mnCode & KEY_MOD1) )
+ nMode |= MOUSE_DRAGMOVE;
+ if ( (pEvent->mnCode & MOUSE_LEFT) && (pEvent->mnCode & KEY_MOD1) )
+ nMode |= MOUSE_DRAGCOPY;
+ return nMode;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplGetMouseButtonMode( SalMouseEvent* pEvent )
+{
+ USHORT nMode = 0;
+ if ( pEvent->mnButton == MOUSE_LEFT )
+ nMode |= MOUSE_SIMPLECLICK;
+ if ( (pEvent->mnButton == MOUSE_LEFT) && !(pEvent->mnCode & (MOUSE_MIDDLE | MOUSE_RIGHT)) )
+ nMode |= MOUSE_SELECT;
+ if ( (pEvent->mnButton == MOUSE_LEFT) && (pEvent->mnCode & KEY_MOD1) &&
+ !(pEvent->mnCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_SHIFT)) )
+ nMode |= MOUSE_MULTISELECT;
+ if ( (pEvent->mnButton == MOUSE_LEFT) && (pEvent->mnCode & KEY_SHIFT) &&
+ !(pEvent->mnCode & (MOUSE_MIDDLE | MOUSE_RIGHT | KEY_MOD1)) )
+ nMode |= MOUSE_RANGESELECT;
+ return nMode;
+}
+
+// -----------------------------------------------------------------------
+
+inline long ImplHandleSalMouseLeave( Window* pWindow, SalMouseEvent* pEvent )
+{
+ return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, TRUE,
+ pEvent->mnX, pEvent->mnY,
+ pEvent->mnTime, pEvent->mnCode,
+ ImplGetMouseMoveMode( pEvent ) );
+}
+
+// -----------------------------------------------------------------------
+
+inline long ImplHandleSalMouseMove( Window* pWindow, SalMouseEvent* pEvent )
+{
+ return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, FALSE,
+ pEvent->mnX, pEvent->mnY,
+ pEvent->mnTime, pEvent->mnCode,
+ ImplGetMouseMoveMode( pEvent ) );
+}
+
+// -----------------------------------------------------------------------
+
+inline long ImplHandleSalMouseButtonDown( Window* pWindow, SalMouseEvent* pEvent )
+{
+ return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONDOWN, FALSE,
+ pEvent->mnX, pEvent->mnY,
+ pEvent->mnTime,
+ pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
+ ImplGetMouseButtonMode( pEvent ) );
+}
+
+// -----------------------------------------------------------------------
+
+inline long ImplHandleSalMouseButtonUp( Window* pWindow, SalMouseEvent* pEvent )
+{
+ return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONUP, FALSE,
+ pEvent->mnX, pEvent->mnY,
+ pEvent->mnTime,
+ pEvent->mnButton | (pEvent->mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)),
+ ImplGetMouseButtonMode( pEvent ) );
+}
+
+// -----------------------------------------------------------------------
+
+long ImplHandleSalMouseActivate( Window* pWindow, SalMouseActivateEvent* pEvent )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleSalKeyMod( Window* pWindow, SalKeyModEvent* pEvent )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ Window* pTrackWin = pSVData->maWinData.mpTrackWin;
+ if ( pTrackWin )
+ pWindow = pTrackWin;
+ USHORT nOldCode = pWindow->mpFrameData->mnMouseCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2);
+ USHORT nNewCode = pEvent->mnCode;
+ if ( nOldCode != nNewCode )
+ {
+ nNewCode |= pWindow->mpFrameData->mnMouseCode & ~(KEY_SHIFT | KEY_MOD1 | KEY_MOD2);
+ pWindow->mpFrameWindow->ImplCallMouseMove( nNewCode, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleSalSettings( Window* pWindow, USHORT nEvent )
+{
+ // Application Notification werden nur fuer das AppWindow ausgeloest
+ SystemWindow* pSysWindow = (SystemWindow*)pWindow->ImplGetWindow();
+ WorkWindow* pAppWin = Application::GetAppWindow();
+
+ if ( pAppWin && (pSysWindow != pAppWin) )
+ return;
+
+ Application* pApp = GetpApp();
+ if ( nEvent == SALEVENT_SETTINGSCHANGED )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ AllSettings aSettings = pApp->GetSettings();
+ // International so umsetzen, das Daten durch
+ // UpdateInternationalSystemTables() nicht geaendert werden,
+ // damit wir feststellen koennen, ob sich Einstellungen
+ // geaendert haben
+ International aIntn = aSettings.GetInternational();
+ aIntn.SetQuotationMarkStart( aIntn.GetQuotationMarkStart() );
+ aIntn.SetDateFormat( aIntn.GetDateFormat() );
+ UpdateInternationalSystemTables();
+ if ( aIntn != aSettings.GetInternational() )
+ pSVData->maAppData.mbIntnChanged = TRUE;
+ pApp->MergeSystemSettings( aSettings );
+ pApp->SystemSettingsChanging( aSettings, pWindow );
+ pApp->SetSettings( aSettings );
+ pSVData->maAppData.mbIntnChanged = FALSE;
+ }
+ else
+ {
+ USHORT nType;
+ switch ( nEvent )
+ {
+ case SALEVENT_VOLUMECHANGED:
+ nType = 0;
+ break;
+ case SALEVENT_PRINTERCHANGED:
+ ImplDeletePrnQueueList();
+ nType = DATACHANGED_PRINTER;
+ break;
+ case SALEVENT_DISPLAYCHANGED:
+ nType = DATACHANGED_DISPLAY;
+ break;
+ case SALEVENT_FONTCHANGED:
+ OutputDevice::ImplUpdateAllFontData( TRUE );
+ nType = DATACHANGED_FONTS;
+ break;
+ case SALEVENT_DATETIMECHANGED:
+ nType = DATACHANGED_DATETIME;
+ break;
+ case SALEVENT_KEYBOARDCHANGED:
+ nType = 0;
+ break;
+ default:
+ nType = 0;
+ break;
+ }
+
+ if ( nType )
+ {
+ DataChangedEvent aDCEvt( nType );
+ pApp->DataChanged( aDCEvt );
+ pApp->NotifyAllWindows( aDCEvt );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleSalExtTextInputPos( Window* pWindow, SalExtTextInputPosEvent* pEvt )
+{
+ Window* pChild = ImplHandleExtTextInputPos( pWindow, pEvt->mnFirstPos, pEvt->mnChars );
+ if ( pChild )
+ {
+ USHORT nStart = pChild->GetExtTextInputPosStart();
+ USHORT nCount = pChild->GetExtTextInputPosCount();
+ const Rectangle* pAry = pChild->GetExtTextInputPosAry();
+ USHORT nPos;
+ for ( USHORT i = 0; i < pEvt->mnChars; i++ )
+ {
+ nPos = i+(USHORT)pEvt->mnFirstPos;
+ if ( (nPos >= nStart) && (nPos < nStart+nCount) )
+ {
+ SalExtCharPos* pSalPos = pEvt->mpPosAry+i;
+ const Rectangle* pPos = pAry+(nPos-nStart);
+ pSalPos->mnX = pChild->ImplLogicXToDevicePixel( pPos->Left() );
+ pSalPos->mnY = pChild->ImplLogicYToDevicePixel( pPos->Top() );
+ pSalPos->mnWidth = pChild->ImplLogicWidthToDevicePixel( pPos->GetWidth() );
+ pSalPos->mnHeight = pChild->ImplLogicHeightToDevicePixel( pPos->GetHeight() );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ImplWindowFrameProc( void* pInst, SalFrame* pFrame,
+ USHORT nEvent, const void* pEvent )
+{
+ DBG_TESTSOLARMUTEX();
+
+ long nRet = 0;
+
+ switch ( nEvent )
+ {
+ case SALEVENT_MOUSEMOVE:
+ nRet = ImplHandleSalMouseMove( (Window*)pInst, (SalMouseEvent*)pEvent );
+ break;
+ case SALEVENT_MOUSELEAVE:
+ nRet = ImplHandleSalMouseLeave( (Window*)pInst, (SalMouseEvent*)pEvent );
+ break;
+ case SALEVENT_MOUSEBUTTONDOWN:
+ nRet = ImplHandleSalMouseButtonDown( (Window*)pInst, (SalMouseEvent*)pEvent );
+ break;
+ case SALEVENT_MOUSEBUTTONUP:
+ nRet = ImplHandleSalMouseButtonUp( (Window*)pInst, (SalMouseEvent*)pEvent );
+ break;
+ case SALEVENT_MOUSEACTIVATE:
+ nRet = ImplHandleSalMouseActivate( (Window*)pInst, (SalMouseActivateEvent*)pEvent );
+ break;
+
+ case SALEVENT_KEYINPUT:
+ {
+ SalKeyEvent* pKeyEvt = (SalKeyEvent*)pEvent;
+ nRet = ImplHandleKey( (Window*)pInst, EVENT_KEYINPUT,
+ pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat );
+ }
+ break;
+ case SALEVENT_KEYUP:
+ {
+ SalKeyEvent* pKeyEvt = (SalKeyEvent*)pEvent;
+ nRet = ImplHandleKey( (Window*)pInst, EVENT_KEYUP,
+ pKeyEvt->mnCode, pKeyEvt->mnCharCode, pKeyEvt->mnRepeat );
+ }
+ break;
+ case SALEVENT_KEYMODCHANGE:
+ ImplHandleSalKeyMod( (Window*)pInst, (SalKeyModEvent*)pEvent );
+ break;
+
+ case SALEVENT_WHEELMOUSE:
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+
+ if ( pSVData->maWinData.mpAutoScrollWin )
+ pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();
+
+ SalWheelMouseEvent* pWheelEvt = (SalWheelMouseEvent*)pEvent;
+ nRet = ImplHandleWheelEvent( (Window*)pInst,
+ pWheelEvt->mnX, pWheelEvt->mnY,
+ pWheelEvt->mnTime,
+ pWheelEvt->mnDelta,
+ pWheelEvt->mnNotchDelta,
+ pWheelEvt->mnScrollLines,
+ pWheelEvt->mnCode, pWheelEvt->mbHorz );
+ }
+ break;
+
+ case SALEVENT_PAINT:
+ {
+ SalPaintEvent* pPaintEvt = (SalPaintEvent*)pEvent;
+ Rectangle aBoundRect( Point( pPaintEvt->mnBoundX, pPaintEvt->mnBoundY ),
+ Size( pPaintEvt->mnBoundWidth, pPaintEvt->mnBoundHeight ) );
+ ImplHandlePaint( (Window*)pInst, aBoundRect );
+ }
+ break;
+
+ case SALEVENT_RESIZE:
+ {
+ long nNewWidth;
+ long nNewHeight;
+ ((Window*)pInst)->mpFrame->GetClientSize( nNewWidth, nNewHeight );
+ ImplHandleResize( (Window*)pInst, nNewWidth, nNewHeight );
+ }
+ break;
+
+ case SALEVENT_GETFOCUS:
+ ImplHandleGetFocus( (Window*)pInst );
+ break;
+ case SALEVENT_LOSEFOCUS:
+ ImplHandleLoseFocus( (Window*)pInst );
+ break;
+
+ case SALEVENT_CLOSE:
+ ImplHandleClose( (Window*)pInst );
+ break;
+
+ case SALEVENT_SHUTDOWN:
+ if ( Application::GetAppWindow() == ((WorkWindow*)pInst)->ImplGetWindow() )
+ {
+ if ( GetpApp()->QueryExit() )
+ {
+ // Message-Schleife beenden
+ Application::Quit();
+ return FALSE;
+ }
+ else
+ return TRUE;
+ }
+ break;
+
+ case SALEVENT_SETTINGSCHANGED:
+ case SALEVENT_VOLUMECHANGED:
+ case SALEVENT_PRINTERCHANGED:
+ case SALEVENT_DISPLAYCHANGED:
+ case SALEVENT_FONTCHANGED:
+ case SALEVENT_DATETIMECHANGED:
+ case SALEVENT_KEYBOARDCHANGED:
+ ImplHandleSalSettings( (Window*)pInst, nEvent );
+ break;
+
+ case SALEVENT_USEREVENT:
+ ImplHandleUserEvent( (ImplSVEvent*)pEvent );
+ break;
+
+ case SALEVENT_STARTEXTTEXTINPUT:
+ ImplHandleStartExtTextInput( (Window*)pInst );
+ break;
+ case SALEVENT_EXTTEXTINPUT:
+ {
+ SalExtTextInputEvent* pEvt = (SalExtTextInputEvent*)pEvent;
+ ImplHandleExtTextInput( (Window*)pInst, pEvt->mnTime,
+ pEvt->maText, pEvt->mpTextAttr,
+ pEvt->mnCursorPos, pEvt->mbCursorVisible,
+ pEvt->mnDeltaStart, pEvt->mbOnlyCursor );
+ }
+ break;
+ case SALEVENT_ENDEXTTEXTINPUT:
+ ImplHandleEndExtTextInput( (Window*)pInst );
+ break;
+ case SALEVENT_EXTTEXTINPUTPOS:
+ ImplHandleSalExtTextInputPos( (Window*)pInst, (SalExtTextInputPosEvent*)pEvent );
+ break;
+ case SALEVENT_INPUTCONTEXTCHANGE:
+ {
+ ImplHandleInputContextChange( (Window*)pInst );
+ }
+ break;
+
+ case SALEVENT_CURSORPOS:
+ {
+ SalCursorPosEvent* pEvt = (SalCursorPosEvent*)pEvent;
+ ImplHandleICursorPos( (Window*)pInst,
+ pEvt->mnX, pEvt->mnY,
+ pEvt->mnWidth, pEvt->mnHeight );
+ }
+ break;
+
+#ifdef DBG_UTIL
+ default:
+ DBG_ERROR1( "ImplWindowFrameProc(): unknown event (%lu)", (ULONG)nEvent );
+ break;
+#endif
+ }
+
+ return nRet;
+}
+
+#else // => REMOTE_APPSERVER
+
+void ImplRemoteWindowFrameProc( ExtRmEvent* pEvent )
+{
+ DBG_TESTSOLARMUTEX();
+
+ ULONG nId = pEvent->GetId();
+ switch ( nId )
+ {
+ case RMEVENT_KEYINPUT:
+ {
+ RmKeyEventData* pData = (RmKeyEventData*)pEvent->GetData();
+ ImplHandleKey( pEvent->GetWindow(), EVENT_KEYINPUT,
+ pData->nKeyCode, pData->nChar, pData->nCount );
+ }
+ break;
+ case RMEVENT_KEYUP:
+ {
+ RmKeyEventData* pData = (RmKeyEventData*)pEvent->GetData();
+ ImplHandleKey( pEvent->GetWindow(), EVENT_KEYUP,
+ pData->nKeyCode, pData->nChar, 0 );
+ }
+ break;
+ case RMEVENT_MOUSEBUTTONDOWN:
+ case RMEVENT_MOUSEBUTTONUP:
+ case RMEVENT_MOUSEMOVE:
+ {
+ USHORT nSVEvent;
+ if ( nId == RMEVENT_MOUSEBUTTONDOWN )
+ nSVEvent = EVENT_MOUSEBUTTONDOWN;
+ else if ( nId == RMEVENT_MOUSEBUTTONUP )
+ nSVEvent = EVENT_MOUSEBUTTONUP;
+ else
+ nSVEvent = EVENT_MOUSEMOVE;
+ RmMouseEventData* pData = (RmMouseEventData*)pEvent->GetData();
+ BOOL bMouseLeave = ( pData->nMode & MOUSE_LEAVEWINDOW ) ? TRUE : FALSE;
+ pData->nMode &= ~(MOUSE_ENTERWINDOW|MOUSE_LEAVEWINDOW);
+
+ // Bei MOUSE_MOVE eine Bestaetigung zurueckschicken, damit der
+ // RClient solange verzoegert...
+ // Vorm ImplHandleMouseEvent, falls dort z.B. ein modaler Dialog
+ // aufgemacht wird.
+ if ( nId == RMEVENT_MOUSEMOVE )
+ {
+ DBG_ASSERT( pEvent->GetWindow()->ImplGetFrame(), "RemoteWindowProc: Frame?" );
+ if ( pEvent->GetWindow()->ImplGetFrame() )
+ pEvent->GetWindow()->ImplGetFrame()->MouseMoveProcessed();
+ }
+
+ ImplHandleMouseEvent( pEvent->GetWindow(), nSVEvent, bMouseLeave,
+ pData->nX, pData->nY, pData->nSysTime,
+ pData->nCode, pData->nMode );
+
+ }
+ break;
+ case RMEVENT_PAINT:
+ {
+ Rectangle* pRect = (Rectangle*)pEvent->GetData();
+ ImplHandlePaint( pEvent->GetWindow(), *pRect );
+ }
+ break;
+ case RMEVENT_RESIZE:
+ {
+ Size* pSize = (Size*)pEvent->GetData();
+ ImplHandleResize( pEvent->GetWindow(), pSize->Width(), pSize->Height() );
+ }
+ break;
+ case RMEVENT_USEREVENT:
+ {
+ ImplHandleUserEvent( (ImplSVEvent*)pEvent->GetData() );
+ }
+ break;
+ case RMEVENT_CLOSE:
+ {
+ ImplHandleClose( pEvent->GetWindow() );
+ }
+ break;
+ case RMEVENT_GETFOCUS:
+ {
+ ImplHandleGetFocus( pEvent->GetWindow() );
+ };
+ break;
+ case RMEVENT_LOSEFOCUS:
+ {
+ ImplHandleLoseFocus( pEvent->GetWindow() );
+ };
+ break;
+ case RMEVENT_MOUSEWHEEL:
+ {
+ RmMouseWheelEventData* pData = (RmMouseWheelEventData*)pEvent->GetData();
+ ImplHandleWheelEvent( pEvent->GetWindow(),
+ pData->nX,
+ pData->nY,
+ pData->nSysTime,
+ pData->nDelta,
+ pData->nNotchDelta,
+ pData->nScrollLines,
+ pData->nCode,
+ pData->bHorz );
+ };
+ break;
+ }
+}
+
+#endif
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
new file mode 100644
index 000000000000..1dd4d2a4e632
--- /dev/null
+++ b/vcl/source/window/wrkwin.cxx
@@ -0,0 +1,424 @@
+/*************************************************************************
+ *
+ * $RCSfile: wrkwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_WRKWIN_CXX
+
+#ifndef REMOTE_APPSERVER
+#ifndef _SV_SVSYS_HXX
+#include <svsys.h>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#else
+#include <rmwindow.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_RC_H
+#include <rc.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <svapp.hxx>
+#endif
+#ifndef _SV_BRDWIN_HXX
+#include <brdwin.hxx>
+#endif
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
+#ifndef _SV_WRKWIN_HXX
+#include <wrkwin.hxx>
+#endif
+
+#include <rvp.hxx>
+
+#pragma hdrstop
+
+// =======================================================================
+
+#define WORKWIN_WINDOWSTATE_FULLSCREEN ((ULONG)0x00010000)
+#define WORKWIN_WINDOWSTATE_ALL ((ULONG)0x00FF0000)
+
+// =======================================================================
+
+void WorkWindow::ImplInitData()
+{
+ mnIcon = 0;
+ mnPresentationFlags = 0;
+ mbPresentationMode = FALSE;
+ mbPresentationVisible = FALSE;
+ mbPresentationFull = FALSE;
+ mbFullScreenMode = FALSE;
+ mbSysChild = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void WorkWindow::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
+{
+#ifdef REMOTE_APPSERVER
+ static ::com::sun::star::uno::Any aVoid;
+ DBG_ASSERT( ! pSystemParentData, "SystemParentData not implemented in remote vcl" );
+ ImplInit( pParent, nStyle, aVoid );
+#else
+ USHORT nFrameStyle = BORDERWINDOW_STYLE_FRAME;
+ if ( nStyle & WB_APP )
+ nFrameStyle |= BORDERWINDOW_STYLE_APP;
+ ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, pSystemParentData, nStyle, nFrameStyle );
+ Window::ImplInit( pBorderWin, nStyle & (WB_3DLOOK | WB_CLIPCHILDREN | WB_DIALOGCONTROL), NULL );
+ pBorderWin->mpClientWindow = this;
+ pBorderWin->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ mpBorderWindow = pBorderWin;
+// mpRealParent = pParent; // !!! Muesste eigentlich gesetzt werden, aber wegen Fehlern mit dem MenuBar erstmal nicht gesetzt !!!
+
+ if ( nStyle & WB_APP )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ DBG_ASSERT( !pSVData->maWinData.mpAppWin, "WorkWindow::WorkWindow(): More than one window with style WB_APP" );
+ pSVData->maWinData.mpAppWin = this;
+ }
+
+ SetActivateMode( ACTIVATE_MODE_GRABFOCUS );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void WorkWindow::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star::uno::Any& aSystemWorkWindowToken )
+{
+#ifndef REMOTE_APPSERVER
+ if( aSystemWorkWindowToken.hasValue() )
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+ aSystemWorkWindowToken >>= aSeq;
+ SystemParentData* pData = (SystemParentData*)aSeq.getArray();
+ DBG_ASSERT( aSeq.getLength() == sizeof( SystemParentData ) && pData->nSize == sizeof( SystemParentData ), "WorkWindow::WorkWindow( Window*, const Any&, WinBits ) called with invalid Any" );
+ // init with style 0 as does WorkWindow::WorkWindow( SystemParentData* );
+ ImplInit( pParent, 0, pData );
+ }
+ else
+ ImplInit( pParent, nStyle, NULL );
+#else
+ USHORT nFrameStyle = BORDERWINDOW_STYLE_FRAME;
+ if ( nStyle & WB_APP )
+ nFrameStyle |= BORDERWINDOW_STYLE_APP;
+ ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, nFrameStyle, aSystemWorkWindowToken );
+ Window::ImplInit( pBorderWin, nStyle & (WB_3DLOOK | WB_CLIPCHILDREN | WB_DIALOGCONTROL), aSystemWorkWindowToken );
+ pBorderWin->mpClientWindow = this;
+ pBorderWin->GetBorder( mnLeftBorder, mnTopBorder, mnRightBorder, mnBottomBorder );
+ mpBorderWindow = pBorderWin;
+// mpRealParent = pParent; // !!! Muesste eigentlich gesetzt werden, aber wegen Fehlern mit dem MenuBar erstmal nicht gesetzt !!!
+
+ if ( nStyle & WB_APP )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ DBG_ASSERT( !pSVData->maWinData.mpAppWin, "WorkWindow::WorkWindow(): More than one window with style WB_APP" );
+ pSVData->maWinData.mpAppWin = this;
+ }
+
+ SetActivateMode( ACTIVATE_MODE_GRABFOCUS );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+WorkWindow::WorkWindow( WindowType nType ) :
+ SystemWindow( nType )
+{
+ ImplInitData();
+}
+
+// -----------------------------------------------------------------------
+
+WorkWindow::WorkWindow( Window* pParent, WinBits nStyle ) :
+ SystemWindow( WINDOW_WORKWINDOW )
+{
+ ImplInitData();
+ ImplInit( pParent, nStyle, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+WorkWindow::WorkWindow( Window* pParent, const ResId& rResId ) :
+ SystemWindow( WINDOW_WORKWINDOW )
+{
+ ImplInitData();
+ rResId.SetRT( RSC_WORKWIN );
+ ImplInit( pParent, ImplInitRes( rResId ) );
+ ImplLoadRes( rResId );
+}
+
+// -----------------------------------------------------------------------
+
+WorkWindow::WorkWindow( Window* pParent, const ::com::sun::star::uno::Any& aSystemWorkWindowToken, WinBits nStyle ) :
+ SystemWindow( WINDOW_WORKWINDOW )
+{
+ ImplInitData();
+ mbSysChild = TRUE;
+ ImplInit( pParent, nStyle, aSystemWorkWindowToken );
+}
+
+// -----------------------------------------------------------------------
+
+WorkWindow::WorkWindow( SystemParentData* pParent ) :
+ SystemWindow( WINDOW_WORKWINDOW )
+{
+ ImplInitData();
+ mbSysChild = TRUE;
+ ImplInit( NULL, 0, pParent );
+}
+
+// -----------------------------------------------------------------------
+
+void WorkWindow::ImplLoadRes( const ResId& rResId )
+{
+ SystemWindow::ImplLoadRes( rResId );
+
+ USHORT nShowStyle = ReadShortRes();
+ if ( !(rResId.aWinBits & WB_HIDE) && (RSC_WORKWIN == rResId.GetRT()) )
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+WorkWindow::~WorkWindow()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maWinData.mpAppWin == this )
+ {
+ pSVData->maWinData.mpAppWin = NULL;
+ Application::Quit();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WorkWindow::SetIcon( USHORT nIcon )
+{
+ if ( mnIcon == nIcon )
+ return;
+
+ mnIcon = nIcon;
+ if ( !mbSysChild )
+ mpFrame->SetIcon( nIcon );
+}
+
+// -----------------------------------------------------------------------
+
+void WorkWindow::SetWindowState( const ByteString& rStr )
+{
+ if ( mbSysChild )
+ return;
+
+#ifndef REMOTE_APPSERVER
+ SalFrameState aState;
+ USHORT nIndex = 0;
+ aState.mnX = rStr.GetToken( 0, ',', nIndex ).ToInt32();
+ aState.mnY = rStr.GetToken( 0, ',', nIndex ).ToInt32();
+ aState.mnWidth = rStr.GetToken( 0, ',', nIndex ).ToInt32();
+ aState.mnHeight = rStr.GetToken( 0, ';', nIndex ).ToInt32();
+ if ( nIndex != STRING_NOTFOUND )
+ {
+ if ( IsFullScreenMode() )
+ ShowFullScreenMode( FALSE );
+
+ ULONG nState = rStr.Copy( nIndex ).ToInt32();
+ aState.mnState = nState & ~WORKWIN_WINDOWSTATE_ALL;
+ mpFrame->SetWindowState( &aState );
+
+ if ( nState & WORKWIN_WINDOWSTATE_FULLSCREEN )
+ ShowFullScreenMode( TRUE );
+ }
+#else
+ mpFrame->SetWindowState( String::CreateFromAscii(rStr.GetBuffer()) );
+#endif
+
+ // Syncrones Resize ausloesen, damit wir nach Moeglichkeit gleich
+ // mit der richtigen Groesse rechnen
+ // Oberstes BorderWindow ist das Window, welches positioniert werden soll
+ Window* pWindow = this;
+ while ( pWindow->mpBorderWindow )
+ pWindow = pWindow->mpBorderWindow;
+
+ // Syncrones Resize ausloesen, damit wir nach Moeglichkeit gleich
+ // mit der richtigen Groesse rechnen
+ long nNewWidth;
+ long nNewHeight;
+ pWindow->mpFrame->GetClientSize( nNewWidth, nNewHeight );
+ ImplHandleResize( pWindow, nNewWidth, nNewHeight );
+}
+
+// -----------------------------------------------------------------------
+
+ByteString WorkWindow::GetWindowState() const
+{
+ if ( mbSysChild )
+ return ImplGetSVEmptyByteStr();
+
+#ifndef REMOTE_APPSERVER
+ ByteString aStr;
+ SalFrameState aState;
+ if ( mpFrame->GetWindowState( &aState ) )
+ {
+ // FullScreen merken wir uns auch
+ if ( IsFullScreenMode() )
+ aState.mnState |= WORKWIN_WINDOWSTATE_FULLSCREEN;
+
+ aStr.Append( ByteString::CreateFromInt32( aState.mnX ) );
+ aStr.Append( ',' );
+ aStr.Append( ByteString::CreateFromInt32( aState.mnY ) );
+ aStr.Append( ',' );
+ aStr.Append( ByteString::CreateFromInt32( aState.mnWidth ) );
+ aStr.Append( ',' );
+ aStr.Append( ByteString::CreateFromInt32( aState.mnHeight ) );
+ aStr.Append( ';' );
+ aStr.Append( ByteString::CreateFromInt32( aState.mnState ) );
+ }
+ return aStr;
+#else
+ return (ByteString)::rtl::OUStringToOString( mpFrame->GetWindowState() , RTL_TEXTENCODING_ASCII_US );
+#endif
+}
+
+// -----------------------------------------------------------------------
+
+void WorkWindow::ShowFullScreenMode( BOOL bFullScreenMode )
+{
+ if ( !mbFullScreenMode == !bFullScreenMode )
+ return;
+
+ mbFullScreenMode = bFullScreenMode != 0;
+ if ( !mbSysChild )
+ {
+ mpFrameWindow->mbWaitSystemResize = TRUE;
+ ImplGetFrame()->ShowFullScreen( bFullScreenMode );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void WorkWindow::StartPresentationMode( BOOL bPresentation, USHORT nFlags )
+{
+ if ( !bPresentation == !mbPresentationMode )
+ return;
+
+ if ( bPresentation )
+ {
+ mbPresentationMode = TRUE;
+ mbPresentationVisible = IsVisible();
+ mbPresentationFull = mbFullScreenMode;
+ mnPresentationFlags = nFlags;
+
+ if ( !(mnPresentationFlags & PRESENTATION_NOFULLSCREEN) )
+ ShowFullScreenMode( TRUE );
+#ifndef REMOTE_APPSERVER
+ if ( !mbSysChild )
+ {
+ if ( mnPresentationFlags & PRESENTATION_HIDEALLAPPS )
+ mpFrame->SetAlwaysOnTop( TRUE );
+ if ( !(mnPresentationFlags & PRESENTATION_NOAUTOSHOW) )
+ ToTop();
+ mpFrame->StartPresentation( TRUE );
+ }
+#else
+ if ( !mbSysChild )
+ mpFrame->StartPresentation( TRUE, nFlags | PRESENTATION_NOFULLSCREEN | PRESENTATION_NOAUTOSHOW );
+#endif
+
+ if ( !(mnPresentationFlags & PRESENTATION_NOAUTOSHOW) )
+ Show();
+ }
+ else
+ {
+ Show( mbPresentationVisible );
+#ifndef REMOTE_APPSERVER
+ if ( !mbSysChild )
+ {
+ mpFrame->StartPresentation( FALSE );
+ if ( mnPresentationFlags & PRESENTATION_HIDEALLAPPS )
+ mpFrame->SetAlwaysOnTop( FALSE );
+ }
+#else
+ if ( !mbSysChild )
+ mpFrame->StartPresentation( FALSE, mnPresentationFlags | PRESENTATION_NOFULLSCREEN | PRESENTATION_NOAUTOSHOW );
+#endif
+ ShowFullScreenMode( mbPresentationFull );
+
+ mbPresentationMode = FALSE;
+ mbPresentationVisible = FALSE;
+ mbPresentationFull = FALSE;
+ mnPresentationFlags = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL WorkWindow::IsMinimized() const
+{
+ return mpFrameData->mbMinimized;
+}
diff --git a/vcl/unx/inc/XIM.h b/vcl/unx/inc/XIM.h
new file mode 100644
index 000000000000..f77ae54d51df
--- /dev/null
+++ b/vcl/unx/inc/XIM.h
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * $RCSfile: XIM.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _XIM_h
+#define _XIM_h
+
+#include <X11/Xlib.h>
+#include <X11/Xresource.h>
+
+#ifdef __cplusplus
+extern "C"
+#endif
+XIM XvaOpenIM( Display*, XrmDatabase, char*, char*, ... );
+
+extern Status XCloseIM(XIM);
+
+#ifndef XIMCallback1
+typedef int (*XIMProc1)(XIC, XPointer, XPointer);
+typedef struct {
+ XPointer client_data;
+ XIMProc1 callback;
+} XIMCallback1;
+#endif
+
+typedef struct _XIMAnnotation {
+ int start_position;
+ int end_position;
+ XPointer data;
+} XIMAnnotation;
+
+/*
+ XIMUText: XIMText extention for UTF16
+ */
+typedef struct _XIMUnicodeText {
+ unsigned short length;
+ XIMFeedback *feedback;
+ Bool encoding_is_wchar;
+ union {
+ char *multi_byte;
+ wchar_t *wide_char;
+ unsigned short *utf16_char;
+ } string;
+ unsigned int count_annotations;
+ XIMAnnotation *annotations;
+} XIMUnicodeText;
+
+/* lookup choice */
+typedef enum {
+ XIMDrawUpHorizontally = 0 ,
+ XIMDrawUpVertically = 1
+} XIMDrawUpDirection ;
+
+typedef struct _XIMLookupStartCallbackStruct {
+ int choice_per_window; /* Number of choices can be display
+ * in the region
+ */
+ int nrows;
+ int ncolumns;
+ XIMDrawUpDirection draw_up_direction;
+} XIMLookupStartCallbackStruct;
+
+typedef struct _XIMUnicodeChoiceObject {
+ XIMUnicodeText *label;
+ XIMUnicodeText *value;
+} XIMUnicodeChoiceObject;
+
+typedef struct _XIMLookupDrawCallbackStruct {
+ XIMUnicodeChoiceObject *choices; /* the lookup choices */
+ int n_choices; /* Total number of lookup choices */
+ int first_index;
+ int last_index;
+ int current_index;
+ XIMUnicodeText *title;
+} XIMLookupDrawCallbackStruct;
+
+/* Unicode Subset */
+typedef enum {
+ XIMKatakana, XIMHanzi
+} XIMUnicodeCharacterSubsetID;
+
+typedef struct _XIMUncodeSubset {
+ XIMUnicodeCharacterSubsetID index;
+ XIMUnicodeCharacterSubsetID subset_id;
+ char *name;
+ Bool is_active;
+} XIMUnicodeCharacterSubset;
+
+typedef struct _XIMUncodeSubsets {
+ unsigned short count_subsets;
+ XIMUnicodeCharacterSubset *supported_subsets;
+} XIMUnicodeCharacterSubsets;
+
+typedef struct _XIMSwitchIMNotifyCallbackStruct {
+ XIMUnicodeCharacterSubset *from;
+ XIMUnicodeCharacterSubset *to;
+} XIMSwitchIMNotifyCallbackStruct;
+
+/* XIM attributes for multilingual IM extension */
+#define XNMultiLingualInput "multiLingualInput"
+#define XNQueryUnicodeCharacterSubset "unicodeCharacterSubset"
+
+/* XIC attributes for multilingual IM extension */
+
+#define XNUnicodeCharacterSubset "UnicodeChararcterSubset"
+
+#define XNSwitchIMNotifyCallback "switchIMNotifyCallback"
+#define XNCommitStringCallback "commitStringCallback"
+#define XNForwardEventCallback "forwardEventCallback"
+
+#define XNLookupStartCallback "lookupStartCallback"
+#define XNLookupDrawCallback "lookupDrawCallback"
+#define XNLookupDoneCallback "lookupDoneCallback"
+
+#endif
diff --git a/vcl/unx/inc/cdeint.hxx b/vcl/unx/inc/cdeint.hxx
new file mode 100644
index 000000000000..4ce7eef4c28b
--- /dev/null
+++ b/vcl/unx/inc/cdeint.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * $RCSfile: cdeint.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SV_CDEINT_HXX
+#define _SV_CDEINT_HXX
+
+#ifndef _SV_DTINT_HXX
+#include <dtint.hxx>
+#endif
+
+#include <prex.h>
+#define Boolean XLIB_Boolean
+#define Window XLIB_Window
+#include <X11/Intrinsic.h>
+#include <dt/dt.h>
+#include <dt/action.h>
+#include <dt/wsm.h>
+#undef Boolean
+#undef Window
+#include <postx.h>
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+class CDEIntegrator : public DtIntegrator
+{
+ friend DtIntegrator* DtIntegrator::CreateDtIntegrator( SalFrame* );
+private:
+ static void* pDtSvcLib;
+ static void* pXmLib;
+ static void* pMrmLib;
+ static void* pXtLib;
+ static void* pttLib;
+ static int nRefCount;
+ static char* pFallbackRes[];
+
+ // function pointers
+ // from DtSvc
+ static XLIB_Boolean (*pDtAppInitialize)
+ ( XtAppContext, Display*, Widget, char*, char* );
+ static void (*pDtDtsLoadDataTypes)();
+ static void (*pDtDtsRelease)();
+ static char* (*pDtDtsFileToAttributeValue)
+ (const char*,const char*);
+ static void (*pDtDtsFreeAttributeValue)( char* );
+ static DtActionInvocationID (*pDtActionInvoke)
+ ( Widget, char*, DtActionArg*, int, char*, char*, char*, int,
+ DtActionCallbackProc, XtPointer );
+ static Status (*pDtWsmGetWorkspaceInfo)( Display*, XLIB_Window, Atom,
+ DtWsmWorkspaceInfo** );
+ static void (*pDtWsmFreeWorkspaceInfo)( DtWsmWorkspaceInfo* );
+ static Status (*pDtWsmGetWorkspaceList)( Display*, XLIB_Window, Atom**,
+ int* );
+ static Status (*pDtWsmGetCurrentWorkspace)( Display*, XLIB_Window root, Atom* );
+ static Status (*pDtWsmGetWorkspacesOccupied)( Display*, XLIB_Window, Atom**, unsigned long* );
+
+ // from Mrm
+ static void (*pMrmInitialize)();
+
+ // from Xm
+ static WidgetClass* CDEIntegrator::pxmDrawingAreaWidgetClass;
+ static WidgetClass* CDEIntegrator::pxmRowColumnWidgetClass;
+ static WidgetClass* CDEIntegrator::pxmPushButtonWidgetClass;
+
+ // from Xt
+ static void (*pXtToolkitInitialize)();
+ static XtAppContext (*pXtCreateApplicationContext)();
+ static Widget (*pXtAppCreateShell)( char*, char*, WidgetClass,
+ Display*, ArgList, Cardinal );
+ static Widget (*pXtVaCreateManagedWidget)( char*, WidgetClass,
+ Widget, ... );
+ static void (*pXtDisplayInitialize)( XtAppContext, Display*,
+ char*, char*,
+ XrmOptionDescRec*, Cardinal,
+ int*, char**);
+ static Widget (*pXtSetLanguageProc)( XtAppContext, XtLanguageProc, XtPointer );
+ static void (*pXtAppSetFallbackResources)( XtAppContext, char** );
+ static Widget (*pXtAppInitialize)(XtAppContext*, char*,
+ XrmOptionDescList,
+ Cardinal, int*, char**, char**,
+ ArgList, Cardinal );
+ static void (*pXtRealizeWidget)( Widget );
+ static void (*pXtUnrealizeWidget)( Widget );
+ static XLIB_Boolean (*pXtIsRealized)( Widget );
+ static void (*pXtConfigureWidget)
+ ( Widget, Position, Position, Dimension, Dimension, Dimension );
+ static void (*pXtAppProcessEvent)( XtAppContext, XtInputMask );
+ static XtInputMask (*pXtAppPending)( XtAppContext );
+ static WidgetClass* pAppShellClass;
+
+
+ XtAppContext maAppContext;
+ Widget maAppWidget;
+
+ CDEIntegrator( SalFrame* );
+
+ void GlobalInit();
+ void GlobalDeInit();
+
+ void InvokeAction( const String&, const String& );
+
+public:
+ virtual ~CDEIntegrator();
+
+ virtual BOOL StartProcess( String&, String&, const String& rDir = String() );
+ virtual BOOL GetSystemLook( SystemLookInfo& rInfo );
+};
+
+#endif
diff --git a/vcl/unx/inc/dtint.hxx b/vcl/unx/inc/dtint.hxx
new file mode 100644
index 000000000000..1eb55abc787a
--- /dev/null
+++ b/vcl/unx/inc/dtint.hxx
@@ -0,0 +1,397 @@
+/*************************************************************************
+ *
+ * $RCSfile: dtint.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SV_DTINT_HXX
+#define _SV_DTINT_HXX
+
+#include <cstdio>
+#include <dlfcn.h>
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _LINK_HXX
+#include <tools/link.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#include <tools/color.hxx>
+
+class SalFrame;
+class SalBitmap;
+class String;
+class SalDisplay;
+class FastItemInfo;
+
+#ifndef _XLIB_H_
+// forwards from X
+struct Display;
+struct XEvent;
+#define Atom UINT32
+#define XLIB_Window UINT32
+#endif
+
+#define XDND_PROTOCOL_VERSION 3
+
+// NETBSD has no RTLD_GLOBAL
+#ifndef RTLD_GLOBAL
+#define DLOPEN_MODE (RTLD_LAZY)
+#else
+#define DLOPEN_MODE (RTLD_GLOBAL | RTLD_LAZY)
+#endif
+
+class DtIntegrator;
+
+DECLARE_LIST( DtIntegratorList, DtIntegrator* );
+DECLARE_LIST( DtSalFrameList, SalFrame* );
+DECLARE_LIST( StringList, String* );
+
+struct SystemLookInfo
+{
+ /** system foreground color */
+ Color foreground;
+ /** system background color */
+ Color background;
+ /** system foreground color for a selection */
+ Color selectForeground;
+ /** system background color for a selection */
+ Color selectBackground;
+
+ /** gradient for an active window */
+ Color windowActiveStart;
+ Color windowActiveEnd;
+ /** border color for active window */
+ Color activeBorder;
+ /** text color for active window bar */
+ Color activeForeground;
+ /** gradient of an inactive window */
+ Color windowInactiveStart;
+ Color windowInactiveEnd;
+ /** border color for inactive window */
+ Color inactiveBorder;
+ /** text color for inactive window bar */
+ Color inactiveForeground;
+
+ /** font to use for controls. Empty if not set. */
+ String controlFont;
+ /** font to use for dragbars. Empty if not set. */
+ String windowFont;
+
+ SystemLookInfo()
+ {
+ foreground.SetColor( COL_TRANSPARENT );
+ background.SetColor( COL_TRANSPARENT );
+ selectBackground.SetColor( COL_TRANSPARENT );
+ selectForeground.SetColor( COL_TRANSPARENT );
+
+ windowActiveStart.SetColor( COL_TRANSPARENT );
+ windowActiveEnd.SetColor( COL_TRANSPARENT );
+ activeBorder.SetColor( COL_TRANSPARENT );
+ activeForeground.SetColor( COL_TRANSPARENT );
+
+ windowInactiveStart.SetColor( COL_TRANSPARENT );
+ windowInactiveEnd.SetColor( COL_TRANSPARENT );
+ inactiveBorder.SetColor( COL_TRANSPARENT );
+ inactiveForeground.SetColor( COL_TRANSPARENT );
+ }
+};
+
+enum DtType {
+ DtGeneric,
+ DtCDE,
+ DtKDE,
+ DtGNOME,
+ DtSCO,
+ DtIRIX
+};
+
+enum DtDataType {
+ DtTypeUrl,
+ DtTypeText,
+ DtTypeKnown
+};
+
+struct DtData
+{
+ DtDataType meType;
+ int mnX, mnY; // used for Drop data
+ void* mpFrame; // dito
+ int mnBytes;
+ unsigned char* mpBytes;
+ unsigned char* mpType;
+
+ DtData() : meType( DtTypeText ), mnX( -1 ), mnY( -1 ), mpFrame( 0 ),
+ mnBytes( 0 ), mpBytes( 0 ), mpType( NULL ) {}
+ ~DtData()
+ {
+ if( mpBytes )
+ delete mpBytes;
+ }
+};
+
+enum DtDropAction
+{
+ DtDropNone = 0,
+ DtDropCopy = 1,
+ DtDropMove = 2,
+ DtDropLink = 4,
+ DtDropAny = 7
+};
+
+struct DtDropQuery
+{
+ int m_nX;
+ int m_nY;
+ DtDropAction m_eAction;
+ void* m_pFrame; // really a SalFrame*
+};
+
+class DtIntegrator
+{
+protected:
+ enum DtDragState { DtDragNone = 0, DtDragging, DtWaitForStatus,
+ DtWaitForDataRequest };
+
+ DtType meType;
+ Display* mpDisplay;
+ SalDisplay* mpSalDisplay;
+ SalFrame* mpSalFrame;
+ int mnRefCount;
+
+ XLIB_Window maSelectionWindow;
+ Atom maExPropertyAtom;
+
+ Atom mnXdndAware;
+ Atom mnXdndSelection;
+ Atom mnXdndEnter;
+ Atom mnXdndLeave;
+ Atom mnXdndStatus;
+ Atom mnXdndTypeList;
+ Atom mnXdndPosition;
+ Atom mnXdndDrop;
+ Atom mnXdndActionCopy;
+ Atom mnXdndActionMove;
+ Atom mnXdndActionLink;
+ Atom mnXdndActionAsk;
+ Atom mnXdndActionPrivate;
+ Atom mnXdndActionList;
+ Atom mnXdndActionDescription;
+ Atom mnXdndFinished;
+
+ int mnDropDataTime;
+ int mnLastDropX;
+ int mnLastDropY;
+ XLIB_Window maDropSource;
+ SalFrame* mpDropTarget;
+ StringList maDropTypes;
+
+ Link maDropFinishHdl;
+ Link maQueryDropHdl;
+ Link maBeginDropHdl;
+
+ DtDragState meDragState;
+ int mnLastDragX;
+ int mnLastDragY;
+ int mnLastDragTimestamp;
+ int mnWaitTimestamp;
+ Link maQueryDragDataHdl;
+ XLIB_Window maDragSource;
+ XLIB_Window maDragTarget;
+ StringList maDragTypes;
+
+ DtIntegrator( SalFrame* );
+
+ DtSalFrameList maDropzones;
+
+ Link maClipboardChangedHdl;
+ Atom mnClipboardAtom;
+ Atom mnTargetsAtom;
+ Atom mnCompoundAtom;
+ DtData* mpLastData;
+
+ virtual void ImplRegisterDropzone( SalFrame* );
+ virtual void ImplUnregisterDropzone( SalFrame* );
+ virtual void ImplHandleXEvent( XEvent* );
+
+ BOOL LaunchProcess( const String&, const String& rDirectory = String() );
+
+ static DtIntegratorList aIntegratorList;
+ static String aHomeDir;
+
+ // helper functions
+ XLIB_Window GetXdndAwareWindowBeneathPointer( int& rVersion, XEvent* );
+ void SendXdndLeave();
+ void SendXdndEnter();
+ void SendXdndPosition( XEvent* );
+ void CheckXdndTimeout( int );
+
+public:
+ static DtIntegrator* CreateDtIntegrator( SalFrame* );
+
+ static void HandleXEvent( XEvent* );
+
+ virtual ~DtIntegrator();
+
+ virtual BOOL StartProcess( String&, String&, const String& rDir = String() );
+
+ // functions for Clipboard
+ inline Link SetClipboardChangedHdl( const Link& );
+ const Link& GetClipboardChangedHdl()
+ { return maClipboardChangedHdl; }
+ void Copy( DtData* ); // copy to system
+ DtData* Paste(); // copy from system
+ BOOL CheckUnxClipboardChanged();
+
+ // functions for Dnd
+ void RegisterDropzone( SalFrame* );
+ void UnregisterDropzone( SalFrame* );
+ DtDropAction ExecuteDrag( const StringList &, SalFrame* pFrame );
+ DtData* DropFinish( const String& rType );
+ StringList& GetDropTypes() { return maDropTypes; }
+
+ const Link& GetDropFinishHdl() { return maDropFinishHdl; }
+ Link SetDropFinishHdl( const Link& rNewLink )
+ {
+ Link aRet = maDropFinishHdl;
+ maDropFinishHdl = rNewLink;
+ return aRet;
+ }
+ const Link& GetQueryDropHdl() { return maDropFinishHdl; }
+ Link SetQueryDropHdl( const Link& rNewLink )
+ {
+ Link aRet = maQueryDropHdl;
+ maQueryDropHdl = rNewLink;
+ return aRet;
+ }
+ const Link& GetBeginDropHdl() { return maBeginDropHdl; }
+ Link SetBeginDropHdl( const Link& rNewLink )
+ {
+ Link aRet = maBeginDropHdl;
+ maBeginDropHdl = rNewLink;
+ return aRet;
+ }
+ const Link& GetQueryDragDataHdl() { return maQueryDragDataHdl; }
+ Link SetQueryDragDataHdl( const Link& rNewLink )
+ {
+ Link aRet = maQueryDragDataHdl;
+ maQueryDragDataHdl = rNewLink;
+ return aRet;
+ }
+
+ // SystemLook
+ virtual BOOL GetSystemLook( SystemLookInfo& rInfo );
+
+ DtType GetDtType() { return meType; }
+ SalFrame* GetFrame() { return mpSalFrame; }
+ SalDisplay* GetSalDisplay() { return mpSalDisplay; }
+ Display* GetDisplay() { return mpDisplay; }
+
+ void Acquire() { mnRefCount++; }
+ inline void Release();
+};
+
+inline void DtIntegrator::Release()
+{
+ mnRefCount--;
+ if( ! mnRefCount )
+ {
+ aIntegratorList.Remove( this );
+ delete this;
+ }
+}
+
+inline Link DtIntegrator::SetClipboardChangedHdl( const Link& rLink )
+{
+ Link aOldLink = maClipboardChangedHdl;
+ maClipboardChangedHdl = rLink;
+ return aOldLink;
+}
+
+// helper funktions for dynamic loading
+extern BOOL bSymbolLoadFailed;
+
+inline void* _LoadSymbol( void* pLibrary, char* pSymbolname )
+{
+ void *pRet = dlsym( pLibrary, pSymbolname );
+ if( ! pRet )
+ {
+ fprintf( stderr, "Could not load symbol %s: %s\n",
+ pSymbolname, dlerror() );
+ bSymbolLoadFailed = TRUE;
+ }
+ return pRet;
+}
+inline void* _LoadLibrary( char* pLibname )
+{
+ bSymbolLoadFailed = FALSE;
+ void *pRet = dlopen( pLibname, DLOPEN_MODE );
+ if( ! pRet )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "%s could not be opened: %s\n",
+ pLibname, dlerror() );
+#endif
+ bSymbolLoadFailed = TRUE;
+ }
+ return pRet;
+}
+
+#endif
diff --git a/vcl/unx/inc/i18n_cb.hxx b/vcl/unx/inc/i18n_cb.hxx
new file mode 100644
index 000000000000..a18a2eb4a7c7
--- /dev/null
+++ b/vcl/unx/inc/i18n_cb.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_cb.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SAL_I18N_CALLBACK_HXX
+#define _SAL_I18N_CALLBACK_HXX
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// for iiimp / ml input
+int CommitStringCallback( XIC ic, XPointer client_data, XPointer call_data);
+
+// xim callbacks
+void PreeditDoneCallback ( XIC ic, XPointer client_data, XPointer call_data);
+int PreeditStartCallback( XIC ic, XPointer client_data, XPointer call_data);
+void PreeditDoneCallback ( XIC ic, XPointer client_data, XPointer call_data);
+void PreeditDrawCallback ( XIC ic, XPointer client_data,
+ XIMPreeditDrawCallbackStruct *call_data );
+void PreeditCaretCallback( XIC ic, XPointer client_data,
+ XIMPreeditCaretCallbackStruct *call_data );
+
+/* private hook to prevent from sending further edit events */
+void PreeditCancelCallback( XPointer client_data );
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+typedef struct {
+ sal_Unicode *pUnicodeBuffer;
+ XIMFeedback *pCharStyle;
+ unsigned int nCursorPos;
+ unsigned int nLength;
+ unsigned int nSize;
+} preedit_text_t;
+
+class SalFrame;
+
+typedef enum {
+ ePreeditStatusDontKnow = 0,
+ ePreeditStatusActive,
+ ePreeditStatusActivationRequired,
+ ePreeditStatusStartPending
+} preedit_status_t;
+
+typedef struct {
+ SalFrame *pFrame;
+ Bool bIsMultilingual;
+ preedit_status_t eState;
+ preedit_text_t aText;
+} preedit_data_t;
+
+#endif /* _SAL_I18N_CALLBACK_HXX */
diff --git a/vcl/unx/inc/i18n_ic.hxx b/vcl/unx/inc/i18n_ic.hxx
new file mode 100644
index 000000000000..4212bee79782
--- /dev/null
+++ b/vcl/unx/inc/i18n_ic.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_ic.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_I18N_INPUTCONTEXT_HXX
+#define _SAL_I18N_INPUTCONTEXT_HXX
+
+#ifndef _SAL_I18N_CALLBACK_HXX
+#include "i18n_cb.hxx"
+#endif
+
+class SalI18N_InputContext
+{
+
+private:
+
+ Bool mbUseable; // system supports current locale ?
+ Bool mbMultiLingual; // system supports iiimp ?
+ XIC maContext;
+
+ XIMStyle mnSupportedStatusStyle;
+ XIMStyle mnSupportedPreeditStyle;
+ XIMStyle mnStatusStyle;
+ XIMStyle mnPreeditStyle;
+
+ preedit_data_t maClientData;
+ XIMCallback maPreeditStartCallback;
+ XIMCallback maPreeditDoneCallback;
+ XIMCallback maPreeditDrawCallback;
+ XIMCallback maPreeditCaretCallback;
+ XIMCallback maCommitStringCallback;
+
+ XVaNestedList mpAttributes;
+ XVaNestedList mpStatusAttributes;
+ XVaNestedList mpPreeditAttributes;
+ #ifdef SOLARIS
+ XFontSet mpFontSet;
+ Display *mpDisplay;
+ #endif
+
+ Bool SupportInputMethodStyle( XIMStyles *pIMStyles );
+ unsigned int GetWeightingOfIMStyle( XIMStyle n_style ) const ;
+ Bool IsSupportedIMStyle( XIMStyle n_style ) const ;
+
+public:
+
+ Bool UseContext() { return mbUseable; }
+ Bool IsMultiLingual() { return mbMultiLingual; }
+ XIC GetContext() { return maContext; }
+
+ void ExtendEventMask( XLIB_Window aFocusWindow );
+ void SetICFocus();
+ void UnsetICFocus();
+ int HandleKeyEvent( XKeyEvent *pEvent, SalFrame *pFrame ); // unused
+ void EndExtTextInput( USHORT nFlags ); // unused
+ int CommitStringCallback( sal_Unicode* pText, sal_Size nLength );
+
+ void Map( SalFrame *pFrame );
+ void Unmap();
+
+ SalI18N_InputContext( SalFrame *pFrame );
+ ~SalI18N_InputContext();
+
+private:
+
+ SalI18N_InputContext(); // do not use this
+
+};
+
+#endif _SAL_I18N_INPUTCONTEXT_HXX
+
+
diff --git a/vcl/unx/inc/i18n_im.hxx b/vcl/unx/inc/i18n_im.hxx
new file mode 100644
index 000000000000..a81dc7eba6dd
--- /dev/null
+++ b/vcl/unx/inc/i18n_im.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_im.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_I18N_INPUTMETHOD_HXX
+#define _SAL_I18N_INPUTMETHOD_HXX
+
+extern "C" char*
+GetMethodName( XIMStyle nStyle, char *pBuf, int nBufSize);
+
+#if (1)
+ #define bUseInputMethodDefault True
+#else
+ #define bUseInputMethodDefault False
+#endif
+
+class SalI18N_InputMethod
+{
+ Bool mbUseable; // system supports locale as well as status
+ // and preedit style ?
+ Bool mbMultiLingual; // system supports iiimp
+ XIM maMethod;
+ XIMStyles *mpStyles;
+
+public:
+
+ Bool IsMultiLingual() { return mbMultiLingual; }
+ Bool UseMethod() { return mbUseable; }
+ XIM GetMethod() { return maMethod; }
+ Bool CreateMethod( Display *pDisplay );
+ XIMStyles *GetSupportedStyles() { return mpStyles; }
+ Bool SetLocale( const char* pLocale = "" );
+ Bool FilterEvent( XEvent *pEvent );
+
+
+ SalI18N_InputMethod();
+ ~SalI18N_InputMethod();
+};
+
+#endif _SAL_I18N_INPUTMETHOD_HXX
+
+
diff --git a/vcl/unx/inc/i18n_xkb.hxx b/vcl/unx/inc/i18n_xkb.hxx
new file mode 100644
index 000000000000..5eb59ff0c235
--- /dev/null
+++ b/vcl/unx/inc/i18n_xkb.hxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_xkb.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_I18N_XKBDEXTENSION_HXX
+#define _SAL_I18N_XKBDEXTENSION_HXX
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+class SalI18N_KeyboardExtension
+{
+private:
+
+ sal_Bool mbUseExtension;
+ sal_uInt32 mnDefaultGroup;
+ sal_uInt32 mnGroup;
+ sal_uInt32 mnEventBase;
+ sal_uInt32 mnErrorBase;
+ Display* mpDisplay;
+
+public:
+
+ SalI18N_KeyboardExtension( Display *pDisplay );
+ inline ~SalI18N_KeyboardExtension();
+
+ inline sal_Bool UseExtension() const ; // server and client support the
+ // extension
+ inline void UseExtension( sal_Bool bState );// used to disable the Extension
+
+ void Dispatch( XEvent *pEvent ); // keep track of group changes
+
+ sal_uInt32 LookupKeysymInGroup( sal_uInt32 nKeyCode,
+ sal_uInt32 nShiftState,
+ sal_uInt32 nGroup ) const ;
+
+ inline sal_uInt32 LookupKeysymInDefaultGroup(
+ sal_uInt32 nKeyCode,
+ sal_uInt32 nShiftState ) const ;
+ inline sal_uInt32 GetGroup() const ; // the current keyboard group
+ inline sal_uInt32 GetDefaultGroup() const ; // base group, usually group 1
+ inline sal_uInt32 GetEventBase() const ;
+
+protected:
+
+ SalI18N_KeyboardExtension(); // disabled
+};
+
+inline
+SalI18N_KeyboardExtension::~SalI18N_KeyboardExtension()
+{
+}
+
+inline sal_Bool
+SalI18N_KeyboardExtension::UseExtension() const
+{
+ return mbUseExtension;
+}
+
+inline void
+SalI18N_KeyboardExtension::UseExtension( sal_Bool bState )
+{
+ mbUseExtension = mbUseExtension && bState;
+}
+
+inline sal_uInt32
+SalI18N_KeyboardExtension::LookupKeysymInDefaultGroup( sal_uInt32 nKeyCode,
+ sal_uInt32 nShiftState ) const
+{
+ return LookupKeysymInGroup( nKeyCode, nShiftState, mnDefaultGroup );
+}
+
+inline sal_uInt32
+SalI18N_KeyboardExtension::GetGroup() const
+{
+ return mnGroup;
+}
+
+inline sal_uInt32
+SalI18N_KeyboardExtension::GetDefaultGroup() const
+{
+ return mnDefaultGroup;
+}
+
+inline sal_uInt32
+SalI18N_KeyboardExtension::GetEventBase() const
+{
+ return mnEventBase;
+}
+
+#endif // _SAL_I18N_XKBDEXTENSION_HXX
+
diff --git a/vcl/unx/inc/postx.h b/vcl/unx/inc/postx.h
new file mode 100644
index 000000000000..db89e7822dcb
--- /dev/null
+++ b/vcl/unx/inc/postx.h
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * $RCSfile: postx.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: postx.h $ //
+// $Modtime: 08 Aug 1997 10:13:36 $ //
+// //
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _POSTX_H
+#define _POSTX_H
+
+#if defined __cplusplus && ! defined LINUX
+}
+#endif
+
+/* X-Types */
+#undef Window
+#undef BYTE
+#undef INT8
+#undef BOOL
+#undef Font
+#undef Cursor
+#undef String
+#undef KeyCode
+#undef Region
+#undef Icon
+#undef Time
+#undef Boolean
+
+#undef Min
+#undef Max
+#undef class
+#undef new
+#undef DestroyAll
+#undef Success
+
+#undef Printer
+/* #undef FontInfo */
+#undef Orientation
+
+#undef GetToken
+#undef ReleaseToken
+#undef InitializeToken
+#undef NextRequest
+
+/* Network Audio System */
+#undef Sound
+
+#ifdef KeyPress
+#if KeyPress != 2
+Error KeyPress must be Equal 2
+#endif
+#undef KeyPress
+#endif
+#define XLIB_KeyPress 2
+
+#endif
+
diff --git a/vcl/unx/inc/prex.h b/vcl/unx/inc/prex.h
new file mode 100644
index 000000000000..2046be74aa81
--- /dev/null
+++ b/vcl/unx/inc/prex.h
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * $RCSfile: prex.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: prex.h $ //
+// $Modtime: 08 Aug 1997 10:13:54 $ //
+// //
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _PREX_H
+#define _PREX_H
+
+#define Window XLIB_Window
+#define BYTE XLIB_BYTE
+#define INT8 XLIB_INT8
+#define BOOL XLIB_BOOL
+#define Font XLIB_Font
+#define Cursor XLIB_Cursor
+#define String XLIB_String
+#define KeyCode XLIB_KeyCode
+#define Region XLIB_Region
+#define Icon XLIB_Icon
+#define class XLIB_class
+#define new XLIB_new
+#define Time XLIB_Time
+#define Region XLIB_Region
+#define Boolean XLIB_Boolean
+
+/* fuer Network Audio System */
+#define Sound XLIB_Sound
+
+#if defined( MTF12 ) || defined( ALPHA )
+#define XLIB_ILLEGAL_ACCESS
+#endif
+#if defined( RS6000 ) || defined( ALPHA )
+struct _XDisplay;
+#endif
+
+#if defined __cplusplus && ! defined LINUX
+extern "C" {
+#endif
+
+#include <X11/StringDefs.h>
+#include <X11/Intrinsic.h>
+
+#ifdef SOLARIS
+#define USE_MOTIF
+#else
+#define USE_ATHENA
+#endif
+
+#undef DestroyAll
+#define DestroyAll XLIB_DestroyAll
+#define XLIB_DestroyAll 0
+#undef String
+#define String XLIB_String
+#include <X11/IntrinsicP.h>
+#include <X11/Shell.h>
+#ifdef USE_MOTIF
+#include <Xm/BulletinB.h>
+#define SAL_COMPOSITE_WIDGET xmBulletinBoardWidgetClass
+#endif
+#ifdef USE_ATHENA
+#include <X11/Xaw/Box.h>
+#define SAL_COMPOSITE_WIDGET boxWidgetClass
+#endif
+#undef XtInheritTranslations
+#define XtInheritTranslations ((XLIB_String) (&_XtInheritTranslations))
+
+#undef KeyCode
+#define KeyCode XLIB_KeyCode //undef in intrinsics
+
+#define __Ol_OlXlibExt_h__
+
+#include <salpdecl.h>
+#include <salpmacr.h>
+
+#endif
+
diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx
new file mode 100644
index 000000000000..99273531b565
--- /dev/null
+++ b/vcl/unx/inc/saldata.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldata.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALDATA_HXX
+#define _SV_SALDATA_HXX
+
+// -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <signal.h>
+
+#ifndef _SALSTD_HXX
+#include <salstd.hxx>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+
+// -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalXLib;
+class SalDisplay;
+class SalInstance;
+class SalFrame;
+class SalPrinter;
+
+// -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef SIG_PF
+typedef void SIG_FUNC_TYP(int);
+typedef SIG_FUNC_TYP *SIG_TYP;
+#define SIG_PF SIG_TYP
+#endif
+
+DECLARE_LIST( SalDisplays, SalDisplay* )
+
+#if defined SCO || defined LINUX || defined NETBSD || defined AIX || defined HPUX || defined FREEBSD
+#include <pthread.h>
+#else
+typedef unsigned int pthread_t;
+#endif
+
+// -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalData
+{
+ char** argv_;
+ int argc_;
+ String aBinaryPath_;
+
+ SALTIMERPROC pTimerProc_; // timer callback proc
+
+ SIG_TYP sig_[30];
+ BOOL bNoExceptions_;
+
+ SalXLib *pXLib_;
+
+ SalDisplays SalDisplays_;
+ SalDisplay *pDefDisp_;
+ SalDisplay *pCurDisp_;
+
+ pthread_t hMainThread_;
+public:
+ SalInstance *pFirstInstance_; // pointer of first instance
+ SalFrame *pFirstFrame_; // pointer of first frame
+
+public:
+ SalData();
+ ~SalData();
+
+ void Init( int *pArgc, char *ppArgv[] );
+
+ inline const XubString &GetFileName() const { return aBinaryPath_; }
+ inline USHORT GetCommandLineParamCount() const
+ { return argc_; }
+ XubString GetCommandLineParam( USHORT nParam ) const;
+
+ long ShutDown() const;
+ long Close() const;
+ inline void XError( Display *pDisplay,
+ XErrorEvent *pEvent ) const;
+
+ SalDisplay *GetDisplay( Display *pDisplay );
+ inline SalDisplay *GetDisplay( long nDisplay ) const
+ { return SalDisplays_.GetObject(nDisplay); }
+ inline SalDisplay *GetDefDisp() const { return pDefDisp_; }
+ inline SalDisplay *GetCurDisp() const { return pCurDisp_; }
+ inline void SetDefDisp( SalDisplay *pDisp )
+ { pDefDisp_ = pDisp; }
+ inline void SetCurDisp( SalDisplay *pDisp )
+ { pCurDisp_ = pDisp; }
+ inline void Insert( SalDisplay *pDisplay );
+ inline void Remove( SalDisplay *pDisplay );
+
+ inline SalXLib *GetLib() const { return pXLib_; }
+ inline pthread_t GetMainThread() const { return hMainThread_; }
+
+ void StartTimer( ULONG nMS );
+ inline void StopTimer();
+ inline void SetCallback( SALTIMERPROC pProc )
+ { pTimerProc_ = pProc; }
+ void Timeout() const;
+
+};
+
+// -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline void SetSalData( SalData* pData )
+{ ImplGetSVData()->mpSalData = (void*)pData; }
+
+inline SalData* GetSalData()
+{ return (SalData*)ImplGetSVData()->mpSalData; }
+
+inline void SalData::Insert( SalDisplay *pDisplay )
+{ SalDisplays_.Insert( pDisplay ); }
+
+inline void SalData::Remove( SalDisplay *pDisplay )
+{ SalDisplays_.Remove( pDisplay ); }
+
+#ifdef _SV_SALDISP_HXX
+inline void SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) const
+{ pXLib_->XError( pDisplay, pEvent ); }
+#endif
+#endif // _SV_SALDATA_HXX
+
diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx
new file mode 100644
index 000000000000..40cafa2f54fd
--- /dev/null
+++ b/vcl/unx/inc/saldisp.hxx
@@ -0,0 +1,589 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldisp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALDISP_HXX
+#define _SV_SALDISP_HXX
+
+// -=-= exports =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+struct SalAppXResource;
+class SalDisplay;
+class SalICCCM;
+class SalColormap;
+class SalColormapRef;
+class SalTrueColorConverter;
+class SalVisual;
+class SalXLib;
+class SalImageList;
+class SalBitmapList;
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef _SALUNX_H
+#include <salunx.h>
+#endif
+#ifndef _SV_SALGTYPE_HXX
+#include <salgtype.hxx>
+#endif
+#ifndef _SV_PTRSTYLE_HXX
+#include <ptrstyle.hxx>
+#endif
+
+// -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class BitmapPalette;
+class SalImage;
+class SalBitmap;
+class SalFrameData;
+class ColorMask;
+class SalSystemData;
+
+#ifndef _XSHM_H_
+struct XShmSegmentInfo;
+#endif
+
+// -=-= typedefs -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+typedef struct _oslMutexImpl *oslThreadMutex;
+
+DECLARE_LIST( SalImageList, SalImage* )
+DECLARE_LIST( SalBitmapList,SalBitmap*)
+
+// -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define PROPERTY_SUPPORT_WM_SetPos 0x00000001
+#define PROPERTY_SUPPORT_WM_Screen 0x00000002
+#define PROPERTY_SUPPORT_WM_Parent_Pixmap_None 0x00000004
+#define PROPERTY_SUPPORT_WM_ClientPos 0x00000008
+#define PROPERTY_SUPPORT_XSetClipMask 0x00000010 // for bitmap ops.
+#define PROPERTY_SUPPORT_3ButtonMouse 0x00000020
+
+#define PROPERTY_BUG_XA_FAMILY_NAME_nil 0x00001000
+#define PROPERTY_BUG_XCopyArea_GXxor 0x00002000 // from window
+#define PROPERTY_BUG_Stipple 0x00004000 // 0/1 inverted
+#define PROPERTY_BUG_Tile 0x00008000 // Recreate the
+ // dither brush each time
+#define PROPERTY_BUG_FillPolygon_Tile 0x00010000 // always Toggle Fillstyle
+#define PROPERTY_BUG_DrawLine 0x00020000 // a DrawLine is one point to short
+#define PROPERTY_BUG_CopyPlane_RevertBWPixel 0x00040000 // revert fg and bg for xcopyplane
+#define PROPERTY_BUG_CopyArea_OnlySmallSlices 0x00080000
+#define PROPERTY_BUG_Bitmap_Bit_Order 0x00100000
+
+#define PROPERTY_FEATURE_Maximize 0x01000000
+#define PROPERTY_FEATURE_SharedMemory 0x02000000
+
+#define PROPERTY_DEFAULT 0x00000FCB
+
+// ------------------------------------------------------------------------
+// server vendor
+
+typedef enum {
+ vendor_none = 0,
+ vendor_attachmate,
+ vendor_excursion,
+ vendor_hp,
+ vendor_hummingbird,
+ vendor_ibm,
+ vendor_sco,
+ vendor_sgi,
+ vendor_sun,
+ vendor_xfree,
+ vendor_xinside,
+ vendor_xprinter,
+ vendor_unknown
+} srv_vendor_t;
+
+extern "C" srv_vendor_t sal_GetServerVendor( Display *p_display );
+
+// -=-= SalWM =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+enum SalWM { olwm, // Open Look
+ mwm, // Motif
+ kwm, // KDE Desktop Environment
+ _4Dwm, // SGI
+ vuewm, // HP
+ dtwm, // CDE
+ winmgr, // Oracle NC
+ twm,
+ fvwm, // ...
+ pmwm, // SCO
+ otherwm };
+
+// -=-= SalICCCM =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+class SalICCCM
+{
+ unknown STDAPI( SalICCCM )
+
+public:
+ Atom aWM_Protocols_; // Window manager
+ Atom aWM_State_;
+ Atom aWM_DeleteWindow_;
+ Atom aWM_SaveYourself_;
+ Atom aWM_Command_;
+
+ Atom aQuitEvent_; // client message events
+ Atom aUserEvent_;
+
+ inline int IsQuitEvent( Atom a ) const
+ { return aQuitEvent_ == a; }
+ inline int IsUserEvent( Atom a ) const
+ { return aUserEvent_ == a; }
+ inline int IsWM_State( Atom a ) const
+ { return aWM_State_ == a; }
+ inline int IsWM_DeleteWindow( Atom a ) const
+ { return aWM_DeleteWindow_ == a; }
+ inline int IsWM_Protocols( Atom a ) const
+ { return aWM_Protocols_ == a; }
+ inline int IsWM_SaveYourself( Atom a ) const
+ { return aWM_SaveYourself_ == a; }
+ inline int IsWM_Command( Atom a ) const
+ { return aWM_Command_ == a; }
+
+ SalICCCM( SalDisplay *pDisplay );
+};
+
+// -=-= SalRGB -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// MSB/Bigendian Sicht (SalColor == RGB, r=0xFF0000, g=0xFF00, b=0xFF)
+
+enum SalRGB { RGB, RBG,
+ GBR, GRB,
+ BGR, BRG,
+ RGBA, RBGA,
+ GBRA, GRBA,
+ BGRA, BRGA,
+ other };
+
+// -=-= SalVisual =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalVisual : public XVisualInfo
+{
+ unknown STDAPI( SalVisual )
+
+ SalRGB eRGBMode_;
+ int nRedShift_;
+ int nGreenShift_;
+ int nBlueShift_;
+public:
+ ~SalVisual();
+ SalVisual( const XVisualInfo* pXVI );
+
+ inline VisualID GetVisualId() const { return visualid; }
+ inline Visual *GetVisual() const { return visual; }
+ inline int GetClass() const { return c_class; }
+ inline int GetDepth() const { return depth; }
+ inline SalRGB GetMode() const { return eRGBMode_; }
+
+ Pixel GetTCPixel( SalColor nColor ) const;
+ SalColor GetTCColor( Pixel nPixel ) const;
+ BOOL Convert( int &n0, int &n1, int &n2, int &n3 ); // 32bit
+ BOOL Convert( int &n0, int &n1, int &n2 ); // 24bit
+};
+
+// -=-= SalColormap/SalColormapRef=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalColormap : public SvRefBase
+{
+ unknown STDAPI( SalColormap )
+
+ SalDisplay *pDisplay_;
+ Colormap hColormap_;
+ SalColor *pPalette_; // Pseudocolor
+ SalVisual *pVisual_;
+ USHORT *pLookupTable_; // Pseudocolor: 12bit reduction
+ Pixel nWhitePixel_;
+ Pixel nBlackPixel_;
+ Pixel nUsed_; // Pseudocolor
+
+ void GetPalette();
+ void GetLookupTable();
+public:
+ SalColormap( SalDisplay *pSalDisplay,
+ Colormap hColormap );
+ SalColormap( const BitmapPalette &rpPalette );
+ SalColormap( USHORT nDepth );
+ SalColormap();
+ virtual ~SalColormap();
+
+ inline Colormap GetXColormap() const { return hColormap_; }
+ inline SalDisplay *GetDisplay() const { return pDisplay_; }
+ inline Display *GetXDisplay() const;
+ inline SalVisual *GetVisual() const;
+ inline Visual *GetXVisual() const;
+ inline Pixel GetWhitePixel() const { return nWhitePixel_; }
+ inline Pixel GetBlackPixel() const { return nBlackPixel_; }
+ inline Pixel GetUsed() const { return nUsed_; }
+ inline int GetClass() const;
+
+ BOOL GetXPixels( XColor &rColor,
+ int r,
+ int g,
+ int b ) const;
+ inline BOOL GetXPixel( XColor &rColor,
+ int r,
+ int g,
+ int b ) const;
+ Pixel GetPixel( SalColor nColor ) const;
+ SalColor GetColor( Pixel nPixel ) const;
+ void SetPalette( const BitmapPalette &rPalette );
+};
+
+SV_DECL_IMPL_REF( SalColormap )
+
+// -=-= SalXLib =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+typedef int(*YieldFunc)(int fd, void* data);
+struct YieldEntry;
+
+class SalXLib
+{
+ unknown STDAPI( SalXLib )
+
+ XtAppContext pApplicationContext_;
+ timeval Timeout_;
+ ULONG nTimeoutMS_;
+ int nStateOfYield_;
+ BOOL bWasXError_;
+ BOOL bIgnoreXErrors_;
+ int nFDs_;
+ fd_set *pReadFDS_;
+ fd_set *pExceptionFDS_;
+ YieldEntry *pYieldEntries_;
+public:
+ SalXLib();
+ ~SalXLib();
+ void Init( int *pArgc, char *ppArgv[] );
+
+ void Yield( BOOL bWait );
+
+ void Insert( int fd, void* data,
+ YieldFunc pending,
+ YieldFunc queued,
+ YieldFunc handle );
+ void Remove( int fd );
+
+ void XError( Display *pDisp, XErrorEvent *pEvent );
+ inline BOOL WasXError() const { return bWasXError_; }
+ inline BOOL GetIgnoreXErrors() const { return bIgnoreXErrors_; }
+ inline void SetIgnoreXErrors( BOOL b )
+ { bIgnoreXErrors_ = b; bWasXError_ = FALSE; }
+
+ inline void StartTimer( ULONG nMS );
+ inline void StopTimer();
+
+ inline XtAppContext GetAppContext() const
+ { return pApplicationContext_; }
+};
+
+// -=-= SalXEvent =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+struct SalXEvent
+{
+ SalXEvent *pNext_; // Stack
+ XEvent event_;
+};
+
+// -=-= SalDisplay -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+class SalI18N_InputMethod;
+class SalI18N_KeyboardExtension;
+class XlfdStorage;
+class ExtendedFontStruct;
+class ExtendedXlfd;
+class AttributeProvider;
+class SalUnicodeConverter;
+class SalConverterCache;
+
+DECLARE_LIST( SalFontCache, ExtendedFontStruct* )
+
+class SalDisplay
+{
+ unknown STDAPI( SalDisplay )
+
+ SalXLib *pXLib_;
+ SalI18N_InputMethod *mpInputMethod;
+ SalI18N_KeyboardExtension *mpKbdExtension;
+
+ AttributeProvider *mpFactory;
+ XlfdStorage *mpFontList;
+ SalConverterCache *mpCvtCache;
+
+ SalSystemData *mpSalSystemData;
+ // the one to get create and destroy notify events
+
+ SalICCCM *pICCCM_; // Atoms
+ Display *pDisp_; // X Display
+ Screen *pScreen_; // XDefaultScreenOfDisplay
+ int nScreen_; // XDefaultScreen
+ SalVisual *pRootVisual_; // default visual of screen
+ XLIB_Window hRootWindow_;
+ Size aSize_; // Screen Size [pixel]
+ Pair aResolution_; // [dpi]
+ ULONG nMaxRequestSize_; // [byte]
+
+ srv_vendor_t meServerVendor;
+ SalWM eWindowManager_;
+ ULONG nProperties_; // PROPERTY_SUPPORT, BUG, FEATURE
+ BOOL bLocal_; // Server==Client? Init
+ // in SalDisplay::IsLocal()
+ BOOL mbLocalIsValid; // bLocal_ is valid ?
+ ULONG nImageDepths_; // Supported Image Depths
+ ULONG nSharedImages_; // Supports MIT-SHM Extension
+ // until x bytes
+
+ int nStateOfYield_;
+ int nStateOfSendEvent_;
+ oslThreadMutex hEventGuard_;
+ SalXEvent *pEventQueue_; // threaded user event queue
+ SalXEvent *pDispatchStack_; // Dispatch/Yield
+
+ // SalFrame
+ Widget hShell_; // Application Shell Widget
+ Widget hComposite_; // the composite child of the shell
+
+ XLIB_Cursor aPointerCache_[POINTER_COUNT];
+ SalFrameData *pCapture_;
+
+ // GDI
+ SalVisual *pVisual_; // Visual
+ XLIB_Window hRefWindow_;
+ GC pMonoGC_;
+ GC pCopyGC_;
+ GC pAndInvertedGC_;
+ GC pAndGC_;
+ GC pOrGC_;
+ GC pStippleGC_;
+ Pixmap hInvert50_;
+ SalColormapRef xColor_;
+
+ SalFontCache *pFontCache_;
+
+ int nBeepVolume_; // Sound
+
+ // Keyboard
+ BOOL bNumLockFromXS_; // Num Lock handled by X Server
+ int nNumLockIndex_; // modifier index in modmap
+ int nNumLockMask_; // keyevent state mask for
+ KeySym nShiftKeySym_; // first shift modifier
+ KeySym nCtrlKeySym_; // first control modifier
+ KeySym nMod1KeySym_; // first mod1 modifier
+ ByteString m_aKeyboardName;
+
+ SalBitmapList Bitmaps_; // to destroy bitmap resources;
+
+ SalImageList SharedImages_;
+
+ void DestroyFontCache();
+ long Dispatch( XEvent *pEvent );
+
+public:
+ static SalDisplay *GetSalDisplay( Display* display );
+ static BOOL BestVisual( Display *pDisp,
+ int nScreen,
+ XVisualInfo &rVI );
+
+ SalDisplay( Widget w );
+ SalDisplay( Display* pDisp,
+ Visual* pVisual = NULL,
+ Colormap aColMap = None );
+
+ ~SalDisplay();
+
+ void Init( Colormap hXColmap, const XVisualInfo* pXVI );
+
+ BOOL IsEvent();
+ void SendEvent( Atom aEvent,
+ void *pData,
+ XLIB_Window hReceiver = 0 ) const;
+ void SendEvent( Atom aEvent,
+ UINT32 *pData = 0,
+ XLIB_Window hReceiver = 0 ) const;
+ void Yield( BOOL bWait );
+ void PrintInfo() const;
+
+ void PrintEvent( const ByteString &rComment,
+ XEvent *pEvent ) const;
+
+ void AddFontPath( const ByteString &rPath ) const;
+ XlfdStorage* GetXlfdList();
+ ExtendedFontStruct*
+ GetFont( ExtendedXlfd *pFont, int nPixelSize );
+
+ void Beep() const;
+
+ void ModifierMapping();
+ String GetKeyNameFromKeySym( KeySym keysym ) const;
+ XubString GetKeyName( USHORT nKeyCode ) const;
+ USHORT GetKeyCode( KeySym keysym, char*pcPrintable ) const;
+ KeySym GetKeySym( XKeyEvent *pEvent,
+ unsigned char *pPrintable,
+ int *pLen,
+ Status *pStatus,
+ XIC = NULL ) const;
+
+ XLIB_Cursor GetPointer( int ePointerStyle );
+ int CaptureMouse( SalFrameData *pCapture );
+
+ BOOL IsLocal();
+ inline void Insert( SalBitmap *pBitmap );
+ inline void Remove( SalBitmap *pBitmap );
+
+ inline SalImage *Seek( SalImage *pImage );
+ inline void Insert( SalImage *pImage );
+ inline void Remove( SalImage *pImage );
+ void Remove( XEvent *pEvent );
+
+ inline XLIB_Window GetWindow() const
+ { return XtWindow( hComposite_ ); }
+ inline Widget GetWidget() const { return hComposite_; }
+ inline XLIB_Window GetShellWindow() const
+ { return XtWindow( hShell_ ); }
+ inline Widget GetShellWidget() const { return hShell_; }
+
+ inline XLIB_Window GetRootWindow() const
+ { return hRootWindow_; }
+ inline XLIB_Window GetDrawable() const { return hRefWindow_; }
+ inline Display *GetDisplay() const { return pDisp_; }
+ inline int GetScreenNumber() const { return nScreen_; }
+ inline srv_vendor_t GetServerVendor() const { return meServerVendor; }
+ inline void SetServerVendor() {
+ meServerVendor = sal_GetServerVendor(pDisp_); }
+ inline BOOL IsDisplay() const { return !!pXLib_; }
+ inline SalICCCM &GetICCCM() const { return *pICCCM_; }
+ inline GC GetMonoGC() const { return pMonoGC_; }
+ inline GC GetCopyGC() const { return pCopyGC_; }
+ inline GC GetAndInvertedGC() const { return pAndInvertedGC_; }
+ inline GC GetAndGC() const { return pAndGC_; }
+ inline GC GetOrGC() const { return pOrGC_; }
+ inline GC GetStippleGC() const { return pStippleGC_; }
+ inline GC GetGC( USHORT nDepth ) const;
+ inline Pixmap GetInvert50() const { return hInvert50_; }
+ inline SalColormap &GetColormap() const { return *xColor_; }
+ inline SalVisual *GetVisual() const { return pVisual_; }
+ inline SalVisual *GetRootVisual() const { return pRootVisual_; }
+ inline const Size &GetScreenSize() const { return aSize_; }
+ inline const Pair &GetResolution() const { return aResolution_; }
+ inline ULONG GetProperties() const { return nProperties_; }
+ inline ULONG GetMaxRequestSize() const { return nMaxRequestSize_; }
+ inline ULONG GetImageDepths() const { return nImageDepths_; }
+ inline ULONG SupportsShm() const { return nSharedImages_; }
+ inline void DisableShm() { nSharedImages_ /= 2; } // = 0
+
+ inline BOOL MouseCaptured( const SalFrameData *pFrameData ) const
+ { return pCapture_ == pFrameData; }
+ inline SalXLib* GetXLib() { return pXLib_; }
+
+ inline SalI18N_InputMethod* GetInputMethod() { return mpInputMethod; }
+ inline SalI18N_KeyboardExtension* GetKbdExtension() { return mpKbdExtension; }
+ inline void SetInputMethod( SalI18N_InputMethod *pInputMethod )
+ { mpInputMethod = pInputMethod; }
+ inline void SetKbdExtension(SalI18N_KeyboardExtension *pKbdExtension)
+ { mpKbdExtension = pKbdExtension; }
+ const char* GetKeyboardName( BOOL bRefresh = FALSE );
+ SalConverterCache* GetConverter() { return mpCvtCache; }
+};
+
+// -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+inline void SalDisplay::Remove( SalBitmap *pBitmap )
+{ Bitmaps_.Remove( pBitmap ); }
+
+inline void SalDisplay::Insert( SalBitmap *pBitmap )
+{ Bitmaps_.Insert( pBitmap ); }
+
+inline SalImage *SalDisplay::Seek( SalImage *pImage )
+{ return SharedImages_.Seek( pImage ); }
+
+inline void SalDisplay::Remove( SalImage *pImage )
+{ SharedImages_.Remove( pImage ); }
+
+inline void SalDisplay::Insert( SalImage *pImage )
+{ SharedImages_.Insert( pImage ); }
+
+inline GC SalDisplay::GetGC( USHORT nDepth ) const
+{ return 1 == nDepth
+ ? pMonoGC_
+ : pVisual_->GetDepth() == nDepth
+ ? pCopyGC_
+ : NULL; }
+
+inline Display *SalColormap::GetXDisplay() const
+{ return pDisplay_->GetDisplay(); }
+
+inline SalVisual *SalColormap::GetVisual() const
+{ return pVisual_ ? pVisual_ : pDisplay_->GetVisual(); }
+
+inline Visual *SalColormap::GetXVisual() const
+{ return GetVisual()->GetVisual(); }
+
+inline int SalColormap::GetClass() const
+{ return pVisual_ ? pVisual_->GetClass() : PseudoColor; }
+
+/*----------------------------------------------------------
+ keep track of correct size of the initial window
+ */
+extern "C" {
+
+void MarkWindowAsBadPositioned ( unsigned int nWindow );
+void MarkWindowAsGoodPositioned ( unsigned int nWindow );
+Bool WindowNeedGoodPosition ( unsigned int nWindow );
+
+} /* extern "C" */
+
+// get foreign key names
+namespace vcl_sal {
+ String getKeysymReplacementName(
+ const char* pKeyboard,
+ KeySym nSymbol );
+}
+
+
+#endif // _SV_SALDISP_HXX
+
diff --git a/vcl/unx/inc/salfont.h b/vcl/unx/inc/salfont.h
new file mode 100644
index 000000000000..aa6b2583e73c
--- /dev/null
+++ b/vcl/unx/inc/salfont.h
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * $RCSfile: salfont.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: salfont.h $ //
+// $Modtime: 06 Sep 1997 15:11:06 $ //
+// //
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _SV_SALFONT_H
+#define _SV_SALFONT_H
+
+// -=-= exports =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalFontCache;
+struct SalFontDimension;
+class SalFontFamily;
+class SalFontFamilyList;
+class SalFontStruct;
+class SalFontStructList;
+class SalFonts;
+
+// -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef _SALSTD_HXX
+#include <salstd.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+
+// -=-= forwards =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+typedef ULONG XFP_FLAGS;
+
+class SalDisplay;
+class SalFontCacheItem;
+
+// -=-= SalFontCache -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+DECLARE_LIST( SalFontCache, SalFontCacheItem* )
+
+// -=-= SalFontDimension -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+struct SalFontDimension
+{
+ USHORT nHeight_; // [pixel]
+ USHORT nPtHeight_; // [point/10]
+ USHORT nAverage_; // [pixel/10]
+ USHORT nXRes_; // [dpi]
+ USHORT nYRes_; // [dpi]
+ USHORT nSlant_; // [pixel]
+// size_t nUnderlineThickness_; // [pixel]
+// size_t nUnderlinePosition_; // [pixel]
+// size_t nStrikeoutAscent_; // [pixel]
+// size_t nStrikeoutDescent_; // [pixel]
+// Subscript, Superscript, Capital, Space ...
+
+ inline SalFontDimension( USHORT nA = 0, USHORT nH = 0 );
+
+ inline BOOL IsScalable() const;
+ inline USHORT GetWidth() const { return (nAverage_ + 5) / 10; }
+ inline Size GetSize() const;
+ inline void SetSize( const Size & rSize );
+ inline BOOL operator == ( const SalFontDimension &r ) const;
+ inline BOOL operator != ( const SalFontDimension &r ) const;
+ inline BOOL operator >= ( const SalFontDimension &r ) const;
+};
+
+inline SalFontDimension::SalFontDimension( USHORT nA, USHORT nH )
+ : nHeight_( nH ), nAverage_( nA )
+{ nPtHeight_ = nXRes_ = nYRes_ = nSlant_ = 0; }
+
+inline BOOL SalFontDimension::IsScalable() const
+{ return !nHeight_ && !nPtHeight_ && !nAverage_; }
+
+inline Size SalFontDimension::GetSize() const
+{ return Size( (nAverage_ + 5) / 10, nHeight_ ); }
+
+inline void SalFontDimension::SetSize( const Size & rSize )
+{ nAverage_ = (USHORT)rSize.Width() * 10; nHeight_ = (USHORT)rSize.Height(); }
+
+inline BOOL SalFontDimension::operator == ( const SalFontDimension &r ) const
+{ return nHeight_ == r.nHeight_ && (!r.nAverage_ || nAverage_ == r.nAverage_); }
+
+inline BOOL SalFontDimension::operator != ( const SalFontDimension &r ) const
+{ return !(*this == r); }
+
+inline BOOL SalFontDimension::operator >= ( const SalFontDimension &r ) const
+{ return nHeight_ > r.nHeight_
+ || (nHeight_ == r.nHeight_ && nAverage_ >= r.nAverage_); }
+
+// -=-= SalFontStruct =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalFontStruct : public ImplFontMetricData
+{
+ friend class SalDisplay;
+ friend class SalGraphicsData;
+
+ SalFontCacheItem*pCache_;
+
+#if defined DEBUG || defined DBG_UTIL
+ ByteString aFontName_;
+#endif
+ USHORT nHeightCount_; // Anzahl der Hoehen-Eintraege
+ SalFontDimension*pDimensions_; // Hoehen-Array
+ USHORT nWeight_;
+
+ USHORT nFoundry_; // properties indexies
+ USHORT nFamily_;
+ USHORT nWeightName_;
+ USHORT nSlant_;
+ USHORT nSetWidthName_;
+ ByteString aAddStyleName_;
+ USHORT nSpacing_;
+ USHORT nCharSet_;
+ USHORT nFaceName_;
+ BOOL mbValidFontDescription; // valid xlfd entries
+
+ void Init();
+ BOOL Init( SalDisplay* pDisp,
+ const char* pFontName,
+ SalFontDimension& rDim );
+
+ ByteString GetXFontName( const SalFontDimension& );
+
+ inline void SetFoundry( USHORT n )
+ { nFoundry_ = n; }
+ inline void SetFamily( USHORT n )
+ { meFamily = sal_FamilyToSal( nFamily_ = n ); }
+ inline void SetWeightName( USHORT n )
+ { meWeight = sal_WeightToSal( nWeightName_ = n ); }
+ inline void SetSlant( USHORT n )
+ { meItalic = sal_ItalicToSal( nSlant_ = n ); }
+ inline void SetSetWidthName( USHORT n )
+ { nSetWidthName_ = n; }
+ inline void SetAddStyleName( const ByteString& rAddStyle )
+ { aAddStyleName_ = rAddStyle; aAddStyleName_.ToLowerAscii(); }
+ inline void SetSpacing( USHORT n )
+ { mePitch = sal_PitchToSal( nSpacing_ = n ); }
+ inline void SetAverage( long n )
+ { mnWidth = (n + 5) / 10; }
+ void SetCharSet( USHORT n );
+
+ SalFontStruct( const SalFontStruct& rFont );
+public:
+ SalFontStruct( SalDisplay* pDisp,
+ const char* pFontName,
+ SalFontDimension& rDim );
+
+ ~SalFontStruct();
+
+ inline void Cache( SalFontCacheItem *p ) { pCache_ = p; }
+ inline SalFontCacheItem*IsCache() const { return pCache_; }
+ inline BOOL IsScalable() const { return TYPE_SCALABLE==meType; }
+ inline SalFontDimension*GetDim() const { return pDimensions_; }
+ inline BOOL IsValid() const { return mbValidFontDescription; }
+#ifdef DBG_UTIL
+ const ByteString& GetName() const { return aFontName_; }
+#endif
+
+ ImplFontData *GetDevFontData();
+ SalFontCacheItem*Load( SalDisplay *pDisp, const SalFontDimension &rDim );
+ CharSet GetCharSet() { return meCharSet; }
+
+};
+
+// -=-= SalFontStructList =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+DECLARE_LIST( SalFontStructList, SalFontStruct* )
+
+#endif // _SV_SALFONT_H
+
diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h
new file mode 100644
index 000000000000..f9bd325556e6
--- /dev/null
+++ b/vcl/unx/inc/salframe.h
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: salframe.h $ //
+// $Modtime: 09 Sep 1997 17:29:12 $ //
+// //
+//-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _SV_SALFRAME_H
+#define _SV_SALFRAME_H
+
+// -=-= #includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+#ifndef _SALSTD_HXX
+#include <salstd.hxx>
+#endif
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+#ifndef _SV_PTRSTYLE_HXX
+#include <ptrstyle.hxx>
+#endif
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+#include <salunx.h>
+
+// -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalDisplay;
+class SalGraphics;
+class SalFrame;
+class SalColormap;
+class SalI18N_InputContext;
+
+// -=-= SalFrameData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+DECLARE_LIST( SalFrameList, SalFrame *);
+class SalFrameData
+{
+ friend class SalFrame;
+ friend SalFrame* SalInstance::CreateFrame( SalFrame*, ULONG );
+ friend SalFrame* SalInstance::CreateChildFrame( SystemParentData*, ULONG );
+
+ static Bool checkKeyReleaseForRepeat( Display*, XEvent*, XPointer pSalFrameData );
+
+ STDAPI( SalFrameData )
+
+ SalFrame *pNextFrame_; // pointer to next frame
+ SalFrame *pFrame_;
+
+ SalFrame* mpParent; // pointer to parent frame
+ // which should never obscur this frame
+ SalFrameList maChildren; // List of child frames
+
+ SALFRAMEPROC pProc_; // callback proc
+ void *pInst_; // instance handle for callback
+
+ SalDisplay *pDisplay_;
+ Widget hShell_;
+ Widget hComposite_;
+ XLIB_Window hForeignParent_;
+ XLIB_Window hForeignTopLevelWindow_;
+ Widget hNoFullscreenShell_;
+ Widget hNoFullscreenComposite_;
+ // window to fall back to when no longer in fullscreen mode
+
+ XLIB_Cursor hCursor_;
+ int nCaptured_; // is captured
+
+ SalGraphics *pGraphics_; // current frame graphics
+ SalGraphics *pFreeGraphics_; // first free frame graphics
+ XLIB_Region pPaintRegion_;
+
+ XLIB_Time nReleaseTime_; // timestamp of last key release
+ USHORT nKeyCode_; // last key code
+ USHORT nKeyState_; // last key state
+ int nCompose_; // compose state
+
+ int nShowState_; // show state
+ int nLeft_; // left decoration size
+ int nTop_; // top decoration size
+ int nRight_; // right decoration size
+ int nBottom_; // bottom decoration size
+ int nMaxWidth_; // client max width
+ int nMaxHeight_; // client max height
+ int nWidth_; // client width
+ int nHeight_; // client height
+ Rectangle aPosSize_; // Shells Pos&Size
+ Rectangle aRestoreFullScreen_;
+ Rectangle aRestoreMaximize_;
+ USHORT nStyle_;
+ BOOL bAlwaysOnTop_;
+ BOOL bViewable_;
+ BOOL bMapped_;
+ BOOL bDefaultPosition_; // client is centered initially
+ int nVisibility_;
+
+ int nScreenSaversTimeout_;
+
+ SystemChildData maSystemChildData;
+
+ SalI18N_InputContext *mpInputContext;
+
+ SalGraphics *GetGraphics();
+
+ void GetPosSize( Rectangle &rPosSize );
+ void SetSize ( const Size &rSize );
+ void SetPosSize( const Rectangle &rPosSize );
+ void Minimize();
+ void Maximize();
+ void Restore();
+ void ShowFullScreen( BOOL bFullScreen );
+
+ void RepositionFloatChildren();
+
+ long HandleKeyEvent ( XKeyEvent *pEvent );
+ long HandleMouseEvent ( XEvent *pEvent );
+ long HandleFocusEvent ( XFocusChangeEvent *pEvent );
+ long HandleExposeEvent ( XEvent *pEvent );
+ long HandleSizeEvent ( XConfigureEvent *pEvent );
+ long HandleColormapEvent ( XColormapEvent *pEvent );
+ long HandleMapUnmapEvent ( XEvent *pEvent );
+ long HandleStateEvent ( XPropertyEvent *pEvent );
+ long HandleReparentEvent ( XReparentEvent *pEvent );
+ long HandleClientMessage ( XClientMessageEvent*pEvent );
+
+ inline void CaptureMouse( BOOL bCapture );
+ inline void SetPointer( PointerStyle ePointerStyle );
+
+ inline SalFrameData( SalFrame *pFrame );
+ inline ~SalFrameData();
+public:
+ long Dispatch( XEvent *pEvent );
+ void Init( USHORT nSalFrameStyle, SystemParentData* pParentData = NULL );
+
+ SalDisplay *GetDisplay() const { return pDisplay_; }
+ inline Display *GetXDisplay() const;
+ inline XLIB_Window GetDrawable() const;
+ inline XLIB_Window GetWindow() const { return XtWindow( hComposite_ ); }
+ inline Widget GetWidget() const { return hComposite_; }
+ inline XLIB_Window GetShellWindow() const { return XtWindow( hShell_ ); }
+ inline Widget GetShellWidget() const { return hShell_; }
+ inline XLIB_Window GetForeignParent() const { return hForeignParent_; }
+ inline XLIB_Window GetForeignTopLevelWindow() const { return hForeignTopLevelWindow_; }
+ inline long ShutDown() const
+ { return pProc_( pInst_, pFrame_, SALEVENT_SHUTDOWN, 0 ); }
+ inline long Close() const
+ { return pProc_( pInst_, pFrame_, SALEVENT_CLOSE, 0 ); }
+ inline long Call( USHORT nEvent, const void *pEvent ) const
+ { return pProc_( pInst_, pFrame_, nEvent, pEvent ); }
+ inline SalFrame *GetNextFrame() const { return pNextFrame_; }
+ inline XLIB_Cursor GetCursor() const { return hCursor_; }
+ inline BOOL IsCaptured() const { return nCaptured_ == 1; }
+ inline BOOL IsWaitingForExpose() const
+ { return !!pPaintRegion_; }
+ inline SalColormap &GetColormap() const;
+};
+
+#ifdef _SV_SALDISP_HXX
+
+inline void SalFrameData::CaptureMouse( BOOL bCapture )
+{ nCaptured_ = pDisplay_->CaptureMouse( bCapture ? this : NULL ); }
+
+inline Display *SalFrameData::GetXDisplay() const
+{ return pDisplay_->GetDisplay(); }
+
+inline XLIB_Window SalFrameData::GetDrawable() const
+{ return GetWindow(); }
+
+inline SalColormap &SalFrameData::GetColormap() const
+{ return pDisplay_->GetColormap(); }
+
+#endif
+
+#endif // _SV_SALFRAME_H
+
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
new file mode 100644
index 000000000000..eaa0651a3cd7
--- /dev/null
+++ b/vcl/unx/inc/salgdi.h
@@ -0,0 +1,320 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// *=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: salgdi.h $ //
+// $Modtime: 10 Sep 1997 11:55:36 $ //
+// //
+// *=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _SV_SALGDI_H
+#define _SV_SALGDI_H
+
+// -=-= exports -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+class SalFontCacheItem;
+class SalGraphicsContext;
+class SalGraphicsData;
+
+// -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef _SALSTD_HXX
+#include <salstd.hxx>
+#endif
+#ifndef _SV_SALGTYPE_HXX
+#include <salgtype.hxx>
+#endif
+#ifndef _FRACT_HXX
+#include <tools/fract.hxx>
+#endif
+
+#include "xfont.hxx"
+
+// -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+struct ImplFontMetricData;
+struct ImplFontSelectData;
+class SalBitmap;
+class SalColormap;
+class SalDisplay;
+class SalFrame;
+class SalVirtualDevice;
+class SalPolyLine;
+
+#ifndef _SV_SALDISP_HXX
+typedef SalColormap *SalColormapRef;
+#endif
+
+// -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+class SalGraphicsData
+{
+ friend class SalGraphics;
+
+ STDAPI( SalGraphicsData )
+
+ SalColormapRef xColormap_;
+ Drawable hDrawable_; // use
+
+ XLIB_Region pPaintRegion_;
+ XLIB_Region pClipRegion_;
+
+ GC pPenGC_; // Pen attributes
+ SalColor nPenColor_;
+ Pixel nPenPixel_;
+
+ GC pFontGC_; // Font attributes
+ ExtendedFontStructRef xFont_;
+ Fraction aScale_;
+ SalColor nTextColor_;
+ Pixel nTextPixel_;
+ short nFontOrientation_;
+
+ GC pBrushGC_; // Brush attributes
+ SalColor nBrushColor_;
+ Pixel nBrushPixel_;
+ Pixmap hBrush_; // Dither
+
+ GC pMonoGC_;
+ GC pCopyGC_;
+ GC pMaskGC_;
+ GC pInvertGC_;
+ GC pInvert50GC_;
+ GC pStippleGC_;
+ GC pTrackingGC_;
+
+ BOOL bWindow_ : 1; // is Window
+ BOOL bPrinter_ : 1; // is Printer
+ BOOL bVirDev_ : 1; // is VirDev
+ BOOL bPenGC_ : 1; // is Pen GC valid
+ BOOL bFontGC_ : 1; // is Font GC valid
+ BOOL bBrushGC_ : 1; // is Brush GC valid
+ BOOL bMonoGC_ : 1; // is Mono GC valid
+ BOOL bCopyGC_ : 1; // is Copy GC valid
+ BOOL bInvertGC_ : 1; // is Invert GC valid
+ BOOL bInvert50GC_ : 1; // is Invert50 GC valid
+ BOOL bStippleGC_ : 1; // is Stipple GC valid
+ BOOL bTrackingGC_ : 1; // is Tracking GC valid
+ BOOL bXORMode_ : 1; // is ROP XOR Mode set
+ BOOL bDitherBrush_ : 1; // is solid or tile
+
+ void SetClipRegion( GC pGC,
+ XLIB_Region pXReg = NULL ) const;
+
+
+#if defined(_SV_SALGDI_CXX) || defined (_SV_SALGDI2_CXX)
+ GC GetTrackingGC();
+ GC GetInvertGC();
+ GC GetInvert50GC();
+ GC CreateGC( Drawable hDrawable,
+ unsigned long nMask = GCGraphicsExposures );
+#endif
+
+#if defined _SV_SALGDI_CXX
+ GC SelectPen();
+ GC SelectBrush();
+ void DrawLines( ULONG nPoints,
+ const SalPolyLine &rPoints,
+ GC pGC );
+ BOOL GetDitherPixmap ( SalColor nSalColor );
+#endif
+
+#if defined _SV_SALGDI2_CXX
+
+ inline GC GetMonoGC( Pixmap hPixmap );
+ inline GC GetCopyGC();
+ inline GC GetStippleGC();
+
+ int Clip ( XLIB_Region pRegion,
+ int &nX,
+ int &nY,
+ unsigned int &nDX,
+ unsigned int &nDY,
+ int &nSrcX,
+ int &nSrcY ) const;
+ int Clip ( int &nX,
+ int &nY,
+ unsigned int &nDX,
+ unsigned int &nDY,
+ int &nSrcX,
+ int &nSrcY ) const;
+ GC SetMask ( int &nX,
+ int &nY,
+ unsigned int &nDX,
+ unsigned int &nDY,
+ int &nSrcX,
+ int &nSrcY,
+ Pixmap hClipMask );
+ void DrawBitmap( const SalTwoRect *pPosAry,
+ SalGraphics *pThis,
+ const SalBitmap &rSalBitmap,
+ const SalBitmap &rTransparentBitmap,
+ SalColor nTransparentColor );
+#endif
+
+#if defined _SV_SALGDI3_CXX
+ GC SelectFont();
+
+ void SetFont( const ImplFontSelectData* pEntry );
+ void DrawText( long nX,
+ long nY,
+ const xub_Unicode* pStr,
+ USHORT nLen,
+ const long* pDXAry );
+ void DrawText( long nX,
+ long nY,
+ const xub_Unicode* pStr,
+ USHORT nLen );
+#endif
+public:
+ SalGraphicsData();
+ ~SalGraphicsData();
+
+ void Init( SalFrame *pFrame );
+ void Init( SalVirtualDevice *pVirtualDevice,
+ SalGraphics *pSalGraphics );
+ void Init( class ImplSalPrinterData *pPrinter );
+ void DeInit();
+
+ inline SalDisplay *GetDisplay() const;
+ inline Display *GetXDisplay() const;
+ inline Drawable GetDrawable() const { return hDrawable_; }
+ inline void SetDrawable( Drawable d ) { hDrawable_ = d; }
+ inline SalColormap &GetColormap() const { return *xColormap_; }
+ inline BOOL IsCompatible( USHORT nDepth,
+ SalColormap *pMap ) const;
+ inline Pixel GetPixel( SalColor nSalColor ) const;
+};
+
+#ifdef _SV_SALDATA_HXX
+
+inline SalDisplay *SalGraphicsData::GetDisplay() const
+{ return GetColormap().GetDisplay(); }
+
+inline Display *SalGraphicsData::GetXDisplay() const
+{ return GetColormap().GetXDisplay(); }
+
+inline BOOL SalGraphicsData::IsCompatible( USHORT nDepth,
+ SalColormap *pMap ) const
+{
+ return (GetDisplay()->GetImageDepths() & (1 << (nDepth-1))) != 0
+ && &xColormap_ == pMap;
+}
+
+inline Pixel SalGraphicsData::GetPixel( SalColor nSalColor ) const
+{ return GetColormap().GetPixel( nSalColor ); }
+
+#endif
+
+// -=-= Shortcuts =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#if defined _SV_SALGDI_CXX || defined _SV_SALGDI2_CXX || defined _SV_SALGDI3_CXX
+#define _GetXDisplay() maGraphicsData.GetXDisplay()
+#define _GetDisplay() maGraphicsData.GetDisplay()
+#define _GetVisual() maGraphicsData.GetDisplay()->GetVisual()
+#define _GetDrawable() maGraphicsData.hDrawable_
+#define _GetColormap() maGraphicsData.GetColormap()
+#define _GetClipRegion() maGraphicsData.pClipRegion_
+#define _GetPenPixel() maGraphicsData.nPenPixel_
+#define _GetTextPixel() maGraphicsData.nTextPixel_
+#define _GetBrushPixel() maGraphicsData.nBrushPixel_
+#define _GetPenColor() maGraphicsData.nPenColor_
+#define _GetTextColor() maGraphicsData.nTextColor_
+#define _GetBrushColor() maGraphicsData.nBrushColor_
+#define _GetPixel(n) maGraphicsData.GetPixel( n )
+#define _GetColor(n) maGraphicsData.GetColormap().GetColor( n )
+#define _IsPenGC() maGraphicsData.bPenGC_
+#define _IsFontGC() maGraphicsData.bFontGC_
+#define _IsBrushGC() maGraphicsData.bBrushGC_
+#define _IsMonoGC() maGraphicsData.bMonoGC_
+#define _IsCopyGC() maGraphicsData.bCopyGC_
+#define _IsInvertGC() maGraphicsData.bInvertGC_
+#define _IsInvert50GC() maGraphicsData.bInvert50GC_
+#define _IsStippleGC() maGraphicsData.bStippleGC_
+#define _IsTrackingGC() maGraphicsData.bTrackingGC_
+#define _IsXORMode() maGraphicsData.bXORMode_
+#define _IsWindow() maGraphicsData.bWindow_
+#define _IsPrinter() maGraphicsData.bPrinter_
+#define _IsVirtualDevice() maGraphicsData.bVirDev_
+#define _IsDitherBrush() maGraphicsData.bDitherBrush_
+#define _SelectPen() maGraphicsData.SelectPen()
+#define _SelectBrush() maGraphicsData.SelectBrush()
+#define _GetTrackingGC() maGraphicsData.GetTrackingGC()
+#endif
+
+#ifdef DBG_UTIL
+#define stderr0( s ) fprintf( stderr, s )
+#define stderr1( s, a ) fprintf( stderr, s, a )
+#define stderr2( s, a, b ) fprintf( stderr, s, a, b )
+#define stderr3( s, a, b, c ) fprintf( stderr, s, a, b, c )
+#define stdass0( b ) (void)( !(b) \
+ ? fprintf( stderr, "\"%s\" (%s line %d)\n", \
+ #b, __FILE__, __LINE__ ) \
+ : 0 )
+#else
+#define stderr0( s ) nop
+#define stderr1( s, a ) nop
+#define stderr2( s, a, b ) nop
+#define stderr3( s, a, b, c ) nop
+#define stdass0( b ) nop
+#endif
+#endif // _SV_SALGDI_H
+
diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h
new file mode 100644
index 000000000000..88d471eeae6d
--- /dev/null
+++ b/vcl/unx/inc/salinst.h
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: salinst.h $ //
+// $Modtime: 17 Jul 1997 17:21:10 $ //
+// //
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+// -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef _SV_SALINST_H
+#define _SV_SALINST_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+#ifndef _VOS_THREAD_HXX
+#include <vos/thread.hxx>
+#endif
+
+class SalYieldMutex : public NAMESPACE_VOS(OMutex)
+{
+ ULONG mnCount;
+ NAMESPACE_VOS(OThread)::TThreadIdentifier mnThreadId;
+
+public:
+ SalYieldMutex();
+
+ virtual void acquire();
+ virtual void release();
+ virtual sal_Bool tryToAcquire();
+
+ ULONG GetAcquireCount() const { return mnCount; }
+ NAMESPACE_VOS(OThread)::TThreadIdentifier GetThreadId() const { return mnThreadId; }
+};
+
+// -=-= SalInstanceData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalInstanceData
+{
+ friend class SalInstance;
+
+public:
+
+ void* mpFilterInst;
+ void* mpFilterCallback;
+ SalYieldMutex* mpSalYieldMutex;
+};
+
+#endif // _SV_SALINST_H
+
diff --git a/vcl/unx/inc/salobj.h b/vcl/unx/inc/salobj.h
new file mode 100644
index 000000000000..6e0823261644
--- /dev/null
+++ b/vcl/unx/inc/salobj.h
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALOBJ_H
+#define _SV_SALOBJ_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+
+
+// -----------------
+// - SalObjectData -
+// -----------------
+
+class SalObject;
+
+DECLARE_LIST( SalObjectList, SalObject* );
+
+class SalClipRegion
+{
+
+public:
+
+ SalClipRegion();
+ ~SalClipRegion();
+
+ void BeginSetClipRegion( ULONG nRects );
+ void UnionClipRegion( long nX, long nY, long nWidth, long nHeight );
+
+ XRectangle *EndSetClipRegion() {
+ return ClipRectangleList; }
+ void ResetClipRegion() {
+ numClipRectangles = 0; }
+ USHORT GetClipRegionType() {
+ return nClipRegionType; }
+ void SetClipRegionType( USHORT nType ) {
+ nClipRegionType = nType; }
+ int GetRectangleCount() {
+ return numClipRectangles; }
+
+private:
+
+ XRectangle* ClipRectangleList;
+ int numClipRectangles;
+ int maxClipRectangles;
+ USHORT nClipRegionType;
+};
+
+
+class SalObjectData
+{
+ friend class SalObject;
+ friend class SalDisplay;
+ friend class SalInstance;
+
+ static SalObjectList aAllObjects;
+
+ SystemChildData maSystemChildData;
+ Widget maPrimary;
+ Widget maSecondary;
+ SalClipRegion maClipRegion;
+ void* mpInst;
+ SALOBJECTPROC mpProc;
+ SalObject* mpSalObject;
+ BOOL mbVisible;
+
+ static long Dispatch( XEvent* pEvent );
+};
+
+#endif // _SV_SALOBJ_H
diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h
new file mode 100644
index 000000000000..d51174f52f72
--- /dev/null
+++ b/vcl/unx/inc/salprn.h
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * $RCSfile: salprn.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALPRN_H
+#define _SV_SALPRN_H
+
+#ifndef _SALSTD_HXX
+#include <salstd.hxx>
+#endif
+
+#ifndef _SV_PRNTYPES_HXX
+#include <prntypes.hxx>
+#endif
+
+#include <ppdparser.hxx>
+
+// forward declarations
+class SalInfoPrinter;
+
+class SalPrinterQueueInfo;
+class ImplJobSetup;
+
+class ImplSalPrinterData;
+
+
+// class declarations
+
+
+class SalInfoPrinterData
+{
+ friend class SalInfoPrinter;
+ friend class SalPrinterData;
+
+ ImplSalPrinterData* mpImplData;
+
+ inline SalInfoPrinterData();
+ inline ~SalInfoPrinterData();
+
+public:
+
+ inline void Init( SalPrinterQueueInfo* pQueueInfo,
+ ImplJobSetup* pJobSetup);
+};
+
+
+// -=-= SalPrinterData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+class SalPrinterData
+{
+ friend class SalPrinter;
+
+ ImplSalPrinterData* mpImplData;
+
+ BOOL mbJobStarted; // is job started
+ BOOL mbPageStarted; // is page started
+ XubString* mpFileName; // print to file
+ int mnError; // error code
+ BOOL mbAbort:1; // is job aborted
+ BOOL mbFirstPage:1; // false after first startpage
+ int mnDelTime; // time in h to wait before disposing temp file
+
+ inline SalPrinterData();
+ inline ~SalPrinterData();
+
+public:
+ inline void Init( SalInfoPrinter* pInfoPrinter );
+};
+
+
+// necessary to get changes in Xpdefaults
+void StartPrinterListening();
+void StopPrinterListening();
+
+#endif // _SV_SALPRN_H
+
+
diff --git a/vcl/unx/inc/salstd.hxx b/vcl/unx/inc/salstd.hxx
new file mode 100644
index 000000000000..dea0c8f4fd9b
--- /dev/null
+++ b/vcl/unx/inc/salstd.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * $RCSfile: salstd.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SALSTD_HXX
+#define _SALSTD_HXX
+
+// -=-= includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef _REF_HXX
+#include <tools/ref.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+// -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef STDAPI
+#define STDAPI(Class) int operator != ( const Class& ) const; \
+ int operator == ( const Class& ) const; \
+ Class &operator = ( const Class& ); \
+ Class( const Class& );
+#endif
+
+// -=-= X-Lib forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef _SVUNX_H
+typedef unsigned long Pixel;
+typedef unsigned long XID;
+typedef unsigned long XLIB_Time;
+typedef unsigned long XtIntervalId;
+
+typedef XID Colormap;
+typedef XID Drawable;
+typedef XID Pixmap;
+typedef XID XLIB_Cursor;
+typedef XID XLIB_Font;
+typedef XID XLIB_Window;
+
+typedef struct _XDisplay Display;
+typedef struct _XGC *GC;
+typedef struct _XImage XImage;
+typedef struct _XRegion *XLIB_Region;
+
+typedef union _XEvent XEvent;
+
+typedef struct _XConfigureEvent XConfigureEvent;
+typedef struct _XReparentEvent XReparentEvent;
+typedef struct _XClientMessageEvent XClientMessageEvent;
+typedef struct _XErrorEvent XErrorEvent;
+
+struct Screen;
+struct Visual;
+struct XColormapEvent;
+struct XFocusChangeEvent;
+struct XFontStruct;
+struct XKeyEvent;
+struct XPropertyEvent;
+struct XTextItem;
+struct XWindowChanges;
+
+#define None 0L
+#endif
+
+#endif
+
diff --git a/vcl/unx/inc/salsys.h b/vcl/unx/inc/salsys.h
new file mode 100644
index 000000000000..8c35029d38e7
--- /dev/null
+++ b/vcl/unx/inc/salsys.h
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALSYS_H
+#define _SV_SALSYS_H
+
+class DtIntegrator;
+class SalSystemData;
+class SalFrame;
+class SalDisplay;
+
+// -----------------
+// - SalSystemData -
+// -----------------
+
+class SalSystemData
+{
+ friend class SalSystem;
+ private:
+ SalDisplay* m_pSalDisplay;
+ DtIntegrator* m_pDtIntegrator;
+ void CreateDtIntegrator( SalFrame* );
+ public:
+ SalSystemData() : m_pSalDisplay( 0 ) {}
+ ~SalSystemData();
+
+ void SetSalDisplay( SalDisplay * );
+};
+
+
+#endif // _SV_SALSYS_H
diff --git a/vcl/unx/inc/salunx.h b/vcl/unx/inc/salunx.h
new file mode 100644
index 000000000000..14aa26f70945
--- /dev/null
+++ b/vcl/unx/inc/salunx.h
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * $RCSfile: salunx.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: salunx.h $ //
+// $Modtime: 14 Aug 1997 13:51:48 $ //
+// //
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _SALUNX_H
+#define _SALUNX_H
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#if defined SCO || defined LINUX || defined HPUX || defined FREEBSD
+#include <sys/time.h>
+#elif defined NETBSD
+#include <unistd.h>
+#elif defined AIX
+#include <time.h>
+#include <sys/time.h>
+#include <strings.h>
+#elif defined IRIX
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
+#ifndef _SVUNX_H
+#include <svunx.h>
+#endif
+#ifndef _SALSTD_HXX
+#include <salstd.hxx>
+#endif
+
+// -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define persist
+#define final
+#define beta
+#define alpha
+#define unknown
+#define nop ((void*)0)
+#define nobreak ((void*)0)
+
+#define capacityof(a) (sizeof(a)/sizeof(*a))
+
+// -=-= inlines =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline long Divide( long nDividend, long nDivisor )
+{ return (nDividend + nDivisor/2) / nDivisor; }
+
+inline long DPI( long pixel, long mm )
+{ return Divide( pixel*254, mm*10 ); }
+
+// -=-= timeval =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline int operator >= ( const timeval &t1, const timeval &t2 )
+{
+ if( t1.tv_sec == t2.tv_sec )
+ return t1.tv_usec >= t2.tv_usec;
+ return t1.tv_sec > t2.tv_sec;
+}
+
+inline int operator > ( const timeval &t1, const timeval &t2 )
+{
+ if( t1.tv_sec == t2.tv_sec )
+ return t1.tv_usec > t2.tv_usec;
+ return t1.tv_sec > t2.tv_sec;
+}
+
+inline int operator == ( const timeval &t1, const timeval &t2 )
+{
+ if( t1.tv_sec == t2.tv_sec )
+ return t1.tv_usec == t2.tv_usec;
+ return FALSE;
+}
+
+inline timeval &operator -= ( timeval &t1, const timeval &t2 )
+{
+ if( t1.tv_usec < t2.tv_usec )
+ {
+ t1.tv_sec--;
+ t1.tv_usec += 1000000;
+ }
+ t1.tv_sec -= t2.tv_sec;
+ t1.tv_usec -= t2.tv_usec;
+ return t1;
+}
+
+inline timeval &operator += ( timeval &t1, const timeval &t2 )
+{
+ t1.tv_sec += t2.tv_sec;
+ t1.tv_usec += t2.tv_usec;
+ if( t1.tv_usec > 1000000 )
+ {
+ t1.tv_sec++;
+ t1.tv_usec -= 1000000;
+ }
+ return t1;
+}
+
+inline timeval &operator += ( timeval &t1, ULONG t2 )
+{
+ t1.tv_sec += t2 / 1000;
+ t1.tv_usec += t2 ? (t2 % 1000) * 1000 : 500;
+ if( t1.tv_usec > 1000000 )
+ {
+ t1.tv_sec++;
+ t1.tv_usec -= 1000000;
+ }
+ return t1;
+}
+
+inline timeval operator + ( const timeval &t1, const timeval &t2 )
+{
+ timeval t0 = t1;
+ return t0 += t2;
+}
+
+inline timeval operator + ( const timeval &t1, ULONG t2 )
+{
+ timeval t0 = t1;
+ return t0 += t2;
+}
+
+inline timeval operator - ( const timeval &t1, const timeval &t2 )
+{
+ timeval t0 = t1;
+ return t0 -= t2;
+}
+#endif
+
diff --git a/vcl/unx/inc/salvd.h b/vcl/unx/inc/salvd.h
new file mode 100644
index 000000000000..5f51d6009f31
--- /dev/null
+++ b/vcl/unx/inc/salvd.h
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: salvd.h $ //
+// $Modtime: 09 Aug 1997 00:15:48 $ //
+// //
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _SV_SALVD_H
+#define _SV_SALVD_H
+
+// -=-= #includes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+#ifndef _SALSTD_HXX
+#include <salstd.hxx>
+#endif
+
+// -=-= forwards -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalDisplay;
+class SalGraphics;
+class SalVirtualDevice;
+
+// -=-= SalVirDevData -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+class SalVirDevData
+{
+ friend class SalVirtualDevice;
+
+ SalDisplay *pDisplay_;
+ SalGraphics *pGraphics_; // current frame graphics
+
+ Pixmap hDrawable_;
+
+ int nDX_;
+ int nDY_;
+ USHORT nDepth_;
+ BOOL bGraphics_; // is Graphics used
+
+ inline SalVirDevData();
+ inline ~SalVirDevData();
+
+public:
+ BOOL Init( SalDisplay *pDisplay,
+ long nDX, long nDY,
+ USHORT nBitCount );
+ inline void InitGraphics( SalVirtualDevice *pVD,
+ SalGraphics *pGraphics );
+
+ inline Display *GetXDisplay() const;
+ inline SalDisplay *GetDisplay() const;
+ inline BOOL IsDisplay() const;
+ inline Pixmap GetDrawable() const { return hDrawable_; }
+ inline USHORT GetDepth() const { return nDepth_; }
+};
+
+#ifdef _SV_SALDISP_HXX
+
+inline void SalVirDevData::InitGraphics( SalVirtualDevice *pVD,
+ SalGraphics *pGraphics )
+{ pGraphics_->maGraphicsData.Init( pVD, pGraphics ); }
+
+inline Display *SalVirDevData::GetXDisplay() const
+{ return pDisplay_->GetDisplay(); }
+
+inline SalDisplay *SalVirDevData::GetDisplay() const
+{ return pDisplay_; }
+
+inline BOOL SalVirDevData::IsDisplay() const
+{ return pDisplay_->IsDisplay(); }
+
+#endif
+
+#endif // _SV_SALVD_H
+
diff --git a/vcl/unx/inc/sm.hxx b/vcl/unx/inc/sm.hxx
new file mode 100644
index 000000000000..aae6fe6311e7
--- /dev/null
+++ b/vcl/unx/inc/sm.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * $RCSfile: sm.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _VCL_SM_HXX
+#define _VCL_SM_HXX
+
+#include <salunx.h>
+#include <X11/SM/SMlib.h>
+
+class ICEConnectionObserver
+{
+ static BOOL bIsWatching;
+
+ static void ICEWatchProc( IceConn connection, IcePointer client_data,
+ Bool opening, IcePointer* watch_data );
+public:
+
+ // YieldProcs for SalDisplay
+ static int Pending( int fd, void* data );
+ static int Queued( int fd, void* data );
+ static int HandleEvents( int fd, void* data );
+
+ static void activate();
+ static void deactivate();
+};
+
+class SessionManagerClient
+{
+ static SmcConn aSmcConnection;
+ static char* pClientID;
+
+ static void SaveYourselfProc( SmcConn connection,
+ SmPointer client_data,
+ int save_type,
+ Bool shutdown,
+ int interact_style,
+ Bool fast );
+ static void DieProc( SmcConn connection,
+ SmPointer client_data );
+ static void SaveCompleteProc( SmcConn connection,
+ SmPointer client_data );
+ static void ShutdownCanceledProc( SmcConn connection,
+ SmPointer client_data );
+
+ static char* getPreviousSessionID();
+ static void setPreviousSessionID( const ByteString& );
+public:
+ static void open();
+ static void close();
+
+ static String getExecName();
+ static char* getSessionID() { return pClientID; }
+};
+
+#endif
diff --git a/vcl/unx/inc/soicon.hxx b/vcl/unx/inc/soicon.hxx
new file mode 100644
index 000000000000..d282f5bb5b61
--- /dev/null
+++ b/vcl/unx/inc/soicon.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: soicon.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SV_SOICON_HXX
+#define _SV_SOICON_HXX
+
+class SalDisplay;
+class SalBitmap;
+class Bitmap;
+
+Pixmap GetAppIconPixmap( SalDisplay* );
+Pixmap GetAppIconMask( SalDisplay* );
+
+BOOL ReadXPMFile( Display*, const String&, SalBitmap*&, SalBitmap*& );
+BOOL ReadXBMFile( Display*, const String&, SalBitmap*& );
+
+#endif
diff --git a/vcl/unx/inc/strhelper.hxx b/vcl/unx/inc/strhelper.hxx
new file mode 100644
index 000000000000..dbfce8794143
--- /dev/null
+++ b/vcl/unx/inc/strhelper.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: strhelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SV_STRHELPER_HXX
+#define _SV_STRHELPER_HXX
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+String GetCommandLineToken( int, const String& );
+// gets one token of a unix command line style string
+// doublequote, singlequote and singleleftquote protect their respective
+// contents
+
+int GetCommandLineTokenCount( const String& );
+// returns number of tokens (zero if empty or whitespace only)
+
+String WhitespaceToSpace( const String&, BOOL bProtect = TRUE );
+
+#endif
diff --git a/vcl/unx/inc/svsys.h b/vcl/unx/inc/svsys.h
new file mode 100644
index 000000000000..b20e1b39328f
--- /dev/null
+++ b/vcl/unx/inc/svsys.h
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: svsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SV_SVSYS_H
+#define _SV_SVSYS_H
+
+#ifndef _SVUNX_H
+#include <svunx.h>
+#endif
+
+#endif // _SV_SVSYS_H
diff --git a/vcl/unx/inc/svunx.h b/vcl/unx/inc/svunx.h
new file mode 100644
index 000000000000..5517045a4d9b
--- /dev/null
+++ b/vcl/unx/inc/svunx.h
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * $RCSfile: svunx.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+// //
+// (C) 1997 Star Division GmbH, Hamburg, Germany //
+// //
+// $Revision: 1.1.1.1 $ $Author: hr $ $Date: 2000-09-18 17:05:41 $ //
+// //
+// $Workfile: svunx.h $ //
+// $Modtime: 17 Jul 1997 17:20:22 $ //
+// //
+//*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-*=*-//
+
+#ifndef _SVUNX_H
+#define _SVUNX_H
+
+#ifndef _PREX_H
+#include <prex.h>
+#endif
+#ifndef _POSTX_H
+#include <postx.h>
+#endif
+
+#endif
+
diff --git a/vcl/unx/inc/xfont.hxx b/vcl/unx/inc/xfont.hxx
new file mode 100644
index 000000000000..b89612b57e67
--- /dev/null
+++ b/vcl/unx/inc/xfont.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * $RCSfile: xfont.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef EXTENDED_FONTSTRUCT_HXX
+#define EXTENDED_FONTSTRUCT_HXX
+
+#ifndef _XLIB_H_
+#include <X11/Xlib.h>
+#endif
+#ifndef _REF_HXX
+#include <tools/ref.hxx>
+#endif
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+#ifndef _VCL_VCLENUM_HXX
+#include <vclenum.hxx>
+#endif
+
+typedef unsigned short sal_MultiByte;
+
+class ImplFontMetricData;
+class SalConverterCache;
+class ExtendedXlfd;
+
+class ExtendedFontStruct : public SvRefBase
+{
+ private:
+
+ Display* mpDisplay;
+ unsigned short mnPixelSize;
+ ExtendedXlfd* mpXlfd;
+ XFontStruct** mpXFontStruct;
+ sal_Size mnDefaultWidth;
+
+ int LoadEncoding( rtl_TextEncoding nEncoding );
+ Bool GetFontBoundingBox( XCharStruct *pCharStruct,
+ int *pAscent, int *pDescent ) ;
+
+ sal_Size GetDefaultWidth( SalConverterCache* pCvt );
+ sal_Size GetCharWidth8( sal_Unicode nFrom, sal_Unicode nTo,
+ long *pWidthArray,
+ rtl_TextEncoding nEncoding );
+ sal_Size GetCharWidthUTF16(
+ sal_Unicode nFrom, sal_Unicode nTo,
+ long *pWidthArray );
+ sal_Size GetCharWidth16( SalConverterCache *pCvt,
+ sal_Unicode nFrom, sal_Unicode nTo,
+ long *pWidthArray );
+
+ public:
+ ExtendedFontStruct( Display* pDisplay,
+ unsigned short nPixelSize,
+ ExtendedXlfd* pXlfd,
+ SalConverterCache* pCvt );
+ ~ExtendedFontStruct();
+ Bool Match( const ExtendedXlfd *pXlfd,
+ int nPixelSize) const;
+ XFontStruct* GetFontStruct( rtl_TextEncoding nEncoding );
+ Bool GetFontStruct( sal_Unicode nChar,
+ rtl_TextEncoding *pEncodingInOut,
+ XFontStruct **pFontInOut,
+ SalConverterCache *pCvt );
+ Bool ToImplFontMetricData( ImplFontMetricData *pMetric );
+ rtl_TextEncoding GetAsciiEncoding( int *pAsciiRange = NULL ) const;
+ sal_Size GetCharWidth( SalConverterCache *pCvt,
+ sal_Unicode nFrom, sal_Unicode nTo,
+ long *pWidthArray );
+};
+
+// Declaration and Implementation for ExtendedFontStructRef: Add RefCounting
+// to ExtendedFontStruct (it's not possible to separate decl and impl into
+// a separate source file: all ref member functions are inline
+SV_DECL_IMPL_REF( ExtendedFontStruct );
+
+#endif /* EXTENDED_FONTSTRUCT_HXX */
diff --git a/vcl/unx/inc/xsalprn.h b/vcl/unx/inc/xsalprn.h
new file mode 100644
index 000000000000..f0d0d2951bd8
--- /dev/null
+++ b/vcl/unx/inc/xsalprn.h
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * $RCSfile: xsalprn.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __salprint_h
+#define __salprint_h
+
+
+class String;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* printer interface */
+extern int XSalIsDisplay( const Display * );
+extern int XSalIsPrinter( const Display * );
+
+/* error handling */
+typedef int (*XSalPrinterErrorHandler)( XErrorEvent * );
+
+extern XSalPrinterErrorHandler XSalSetPrinterErrorHandler( XSalPrinterErrorHandler );
+
+/* common callbacks */
+typedef void* XSalPointer;
+typedef int (*XSalPrinterCallback)( XSalPointer cb_data, XSalPointer client_data );
+
+#ifndef _SV_SV_H
+#define _SV_SV_H
+#define USHORT unsigned short
+#include <prntypes.hxx>
+#undef USHORT
+#undef _SV_SV_H
+#else
+#include <prntypes.hxx>
+#endif
+
+typedef enum Orientation Orientation;
+
+/* initialize before first use */
+extern void XSalPrinterInit( const String& installPath );
+
+typedef unsigned short XSalEnum;
+typedef unsigned char XSalBool;
+
+#define COLOR_SPACE_COLOR 1
+#define COLOR_SPACE_GRAY 0
+
+typedef struct
+{
+ unsigned int nMagic; /* internal data */
+ unsigned short nVersion; /* internal data */
+ unsigned short nFlags; /* internal data */
+ XSalEnum eDriver; /* PostScript, PCL, ... */
+ unsigned short nCopies; /* number of copies */
+ unsigned short nPaperBin; /* paper bin to use */
+ XSalEnum ePaper; /* A4, A5, ... */
+ unsigned int nPaperWidth; /* paper width if PAPER_USER */
+ unsigned int nPaperHeight; /* paper height if PAPER_USER */
+ XSalEnum eOrientation; /* portrait / landscape */
+ unsigned int nScale; /* [%] ( 100 => 1:1 ) */
+ unsigned short nResolutionX; /* [dots per inch] */
+ unsigned short nResolutionY; /* [dots per inch] */
+ char sCompatCommand[256];/* current shell command */
+ char sPort[256]; /* default shell command */
+ char cDriverName[32]; /* Druckertreibername */
+ unsigned int nTrailingBytes; /* trailing bytes appended to this structure */
+} XSalPrinterSetup;
+
+#define XSAL_PRINTER_SETUP_MAGIC 0x0000ede1
+#define WRONG_ENDIANESS_MAGIC 0xe1ed0000
+
+/* definition for XSalPrinterSetup.nFlags */
+#define XSALPRINTERSETUP_FLAG_LEVEL_DEFAULT 0x0000
+#define XSALPRINTERSETUP_FLAG_LEVEL 0x000f
+#define XSALPRINTERSETUP_FLAG_LEVEL_SHIFT 0
+#define XSALPRINTERSETUP_FLAG_COLOR 0x0010 /* colored bitmaps */
+#define XSALPRINTERSETUP_FLAG_COLOR_DEFAULT 0x0020
+#define XSALPRINTERSETUP_FLAG_COMPRESS 0x0040 /* compress bitmaps */
+#define XSALPRINTERSETUP_FLAG_COMPRESS_DEFAULT 0x0080 /* compress bitmaps */
+#define XSALPRINTERSETUP_FLAG_DEPTH_DEFAULT 0x0700
+#define XSALPRINTERSETUP_FLAG_DEPTH 0x0700 /* depth n = depth 2^n, 6 = 24Bit, 7 = default */
+#define XSALPRINTERSETUP_FLAG_DEPTH_SHIFT 8
+
+#define XSALPRINTERSETUP_FLAG_DEFAULT\
+ (XSALPRINTERSETUP_FLAG_LEVEL_DEFAULT | \
+ XSALPRINTERSETUP_FLAG_COMPRESS_DEFAULT | \
+ XSALPRINTERSETUP_FLAG_COLOR_DEFAULT | \
+ XSALPRINTERSETUP_FLAG_DEPTH_DEFAULT )
+
+
+/* XSalPrinterSetup access */
+extern unsigned short XSalGetPrinterDriverId( const char* driverName );
+extern const char* XSalGetPrinterDriverName( unsigned short driverId );
+
+extern unsigned short XSalGetLanguageLevel( const XSalPrinterSetup* pSetup );
+extern void XSalGetLanguageLevels(
+ const XSalPrinterSetup* pSetup,
+ unsigned short* minLevel,
+ unsigned short* maxLevel );
+extern void XSalSetLanguageLevel( XSalPrinterSetup* pSetup, unsigned short);
+
+extern unsigned short XSalGetDepth( const XSalPrinterSetup* pSetup );
+extern void XSalSetDepth( XSalPrinterSetup* pSetup, unsigned short depth );
+
+extern XSalEnum XSalGetColorSpace( const XSalPrinterSetup* pSetup );
+extern void XSalSetColorSpace( XSalPrinterSetup* pSetup, XSalEnum space );
+
+extern XSalBool XSalGetBmpCompression( const XSalPrinterSetup* pSetup );
+extern void XSalSetBmpCompression( XSalPrinterSetup* pSetup, XSalBool compress );
+
+extern XSalEnum XSalGetOrientation( const char* string );
+extern const char* XSalGetOrientationName( XSalEnum eOrientation );
+
+extern XSalEnum XSalGetPaper( const char* sPaperName );
+extern const char* XSalGetPaperName( XSalEnum ePaper );
+
+/* use XSalInitPrinterSetup to initialize internal data */
+extern void XSalInitPrinterSetup( XSalPrinterSetup* );
+extern void XSalCorrectEndianess( XSalPrinterSetup* );
+extern void XSalSetupPrinterSetup( XSalPrinterSetup*, Display* display, XLIB_Window parent);
+
+
+/* the following two functions set defaults of the profile */
+extern void XSalReadPrinterSetup( XSalPrinterSetup*, const String& rPrinter );
+extern void XSalReadPrinterSetupDefaults( XSalPrinterSetup* );
+
+
+typedef Display XSalPrinter; /* an XSalPrinter is a Display. Draw into RootWindow */
+
+
+/* open, change setup and close printer */
+extern XSalPrinter* XSalOpenPrinter( const XSalPrinterSetup * pSetup, const String& rPrinterName, const String& rPrintFile );
+/* XSalSetupPrinter() can setup: Orientation, Copies, Page, PaperBin */
+extern void XSalSetupPrinter( XSalPrinter *, const XSalPrinterSetup * pSetup );
+extern void XSalClosePrinter( XSalPrinter * );
+
+typedef struct
+{
+ int nWidth; /* [dots] drawable area */
+ int nHeight; /* [dots] drawable area */
+ int nMarginLeft; /* [dots] left margin */
+ int nMarginTop; /* [dots] top margin */
+ int nMarginRight; /* [dots] right margin */
+ int nMarginBottom; /* [dots] bottom margin */
+ int nResolutionX; /* [dpi] resolution x */
+ int nResolutionY; /* [dpi] resolution y */
+} XSalPageInfo;
+
+extern void XSalGetPageInfo(
+ const XSalPrinter* printer,
+ const XSalPrinterSetup* pSetup,
+ XSalPageInfo* pPageInfo );
+
+
+/* printer job control */
+extern int XSalStartDoc( XSalPrinter * printer, const String& jobName );
+extern int XSalStartPage( XSalPrinter * printer );
+extern int XSalEndPage( XSalPrinter * printer );
+extern int XSalEndDoc( XSalPrinter * printer );
+extern int XSalAbortDoc( XSalPrinter * printer );
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif
diff --git a/vcl/unx/source/app/i18n_cb.cxx b/vcl/unx/source/app/i18n_cb.cxx
new file mode 100644
index 000000000000..434b356054fd
--- /dev/null
+++ b/vcl/unx/source/app/i18n_cb.cxx
@@ -0,0 +1,547 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_cb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#ifdef SOLARIS
+#include <alloca.h>
+#endif
+#include <prex.h>
+#include <X11/Xlocale.h>
+#include <X11/Xlib.h>
+#include <postx.h>
+
+#include <salunx.h>
+#include "XIM.h"
+
+#ifndef _SAL_I18N_CALLBACK_HXX
+#include "i18n_cb.hxx"
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+
+// -------------------------------------------------------------------------
+//
+// i. preedit start callback
+//
+// -------------------------------------------------------------------------
+
+int
+PreeditStartCallback ( XIC ic, XPointer client_data, XPointer call_data )
+{
+ #define PREEDIT_BUFSZ 16
+
+ preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
+
+ if ( pPreeditData->eState == ePreeditStatusActivationRequired )
+ {
+ pPreeditData->eState = ePreeditStatusActive;
+
+ pPreeditData->aText.pUnicodeBuffer =
+ (sal_Unicode*)malloc(PREEDIT_BUFSZ * sizeof(sal_Unicode));
+ pPreeditData->aText.pCharStyle =
+ (XIMFeedback*)malloc(PREEDIT_BUFSZ * sizeof(XIMFeedback));
+ pPreeditData->aText.nCursorPos = 0;
+ pPreeditData->aText.nLength = 0;
+ pPreeditData->aText.nSize = PREEDIT_BUFSZ;
+
+ pPreeditData->pFrame->maFrameData.Call(SALEVENT_STARTEXTTEXTINPUT,
+ (void*)NULL );
+ }
+
+ return -1;
+}
+
+// -------------------------------------------------------------------------
+//
+// ii. preedit done callback
+//
+// -------------------------------------------------------------------------
+
+void
+PreeditDoneCallback ( XIC ic, XPointer client_data, XPointer call_data )
+{
+ preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
+
+ if (pPreeditData->eState == ePreeditStatusActive )
+ pPreeditData->pFrame->maFrameData.Call(
+ SALEVENT_ENDEXTTEXTINPUT, (void*)NULL );
+ pPreeditData->eState = ePreeditStatusStartPending;
+
+ if ( pPreeditData->aText.pUnicodeBuffer != NULL )
+ {
+ free (pPreeditData->aText.pUnicodeBuffer);
+ pPreeditData->aText.pUnicodeBuffer = NULL;
+ }
+ if ( pPreeditData->aText.pCharStyle != NULL )
+ {
+ free (pPreeditData->aText.pCharStyle);
+ pPreeditData->aText.pCharStyle = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------
+//
+// iii. preedit draw callback
+//
+// -------------------------------------------------------------------------
+
+//
+// Handle deletion of text in a preedit_draw_callback
+// from and howmuch are guaranteed to be nonnegative
+//
+
+void
+Preedit_DeleteText(preedit_text_t *ptext, int from, int howmuch)
+{
+ int to = from + howmuch;
+
+ if (to == ptext->nLength)
+ {
+ // delete from the end of the text
+ ptext->nLength = from;
+ }
+ else
+ if (to < ptext->nLength)
+ {
+ // cut out of the middle of the text
+ memmove( (void*)(ptext->pUnicodeBuffer + from),
+ (void*)(ptext->pUnicodeBuffer + to),
+ (ptext->nLength - to) * sizeof(sal_Unicode));
+ memmove( (void*)(ptext->pCharStyle + from),
+ (void*)(ptext->pCharStyle + to),
+ (ptext->nLength - to) * sizeof(sal_Unicode));
+ ptext->nLength -= howmuch;
+ }
+ else
+ // if ( to > pText->nLength )
+ {
+ // XXX this indicates an error, are we out of sync ?
+ fprintf(stderr, "Preedit_DeleteText( from=%i to=%i length=%i )\n",
+ from, to, ptext->nLength );
+ fprintf (stderr, "\t XXX internal error, out of sync XXX\n");
+
+ ptext->nLength = from;
+ }
+
+ // NULL-terminate the string
+ ptext->pUnicodeBuffer[ptext->nLength] = (sal_Unicode)0;
+}
+
+// reallocate the textbuffer with sufficiently large size 2^x
+// nnewlimit is presupposed to be larger than ptext->size
+void
+enlarge_buffer ( preedit_text_t *ptext, int nnewlimit )
+{
+ size_t nnewsize = ptext->nSize;
+
+ while ( nnewsize <= nnewlimit )
+ nnewsize *= 2;
+
+ ptext->nSize = nnewsize;
+ ptext->pUnicodeBuffer = (sal_Unicode*)realloc((void*)ptext->pUnicodeBuffer,
+ nnewsize * sizeof(sal_Unicode));
+ ptext->pCharStyle = (XIMFeedback*)realloc((void*)ptext->pCharStyle,
+ nnewsize * sizeof(XIMFeedback));
+}
+
+//
+// Handle insertion of text in a preedit_draw_callback
+// string field of XIMText struct is guaranteed to be != NULL
+//
+
+void
+Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where,
+ Bool isMultilingual)
+{
+ sal_Unicode *pInsertTextString;
+ int nInsertTextLength = 0;
+ XIMFeedback *pInsertTextCharStyle = pInsertText->feedback;
+
+ nInsertTextLength = pInsertText->length;
+
+ if (isMultilingual)
+ {
+ XIMUnicodeText *pUniText = (XIMUnicodeText*)pInsertText;
+ pInsertTextString = pUniText->string.utf16_char;
+ }
+ else
+ {
+ // can't handle wchar_t strings, so convert to multibyte chars first
+ char *pMBString;
+ size_t nMBLength;
+ if (pInsertText->encoding_is_wchar)
+ {
+ wchar_t *pWCString = pInsertText->string.wide_char;
+ size_t nBytes = wcstombs ( NULL, pWCString, 1024 /* dont care */);
+ pMBString = (char*)alloca( nBytes + 1 );
+ nMBLength = wcstombs ( pMBString, pWCString, nBytes + 1);
+ }
+ else
+ {
+ pMBString = pInsertText->string.multi_byte;
+ nMBLength = strlen(pMBString); // xxx
+ }
+
+ // convert multibyte chars to unicode
+ rtl_TextEncoding nEncoding = gsl_getSystemTextEncoding();
+
+ if (nEncoding != RTL_TEXTENCODING_UNICODE)
+ {
+ rtl_TextToUnicodeConverter aConverter =
+ rtl_createTextToUnicodeConverter( nEncoding );
+ rtl_TextToUnicodeContext aContext =
+ rtl_createTextToUnicodeContext(aConverter);
+
+ sal_Size nBufferSize = nInsertTextLength * 2;
+
+ pInsertTextString = (sal_Unicode*)alloca(nBufferSize);
+
+ sal_uInt32 nConversionInfo;
+ sal_Size nConvertedChars;
+
+ sal_Size nSize =
+ rtl_convertTextToUnicode( aConverter, aContext,
+ pMBString, nMBLength,
+ pInsertTextString, nBufferSize,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE,
+ &nConversionInfo, &nConvertedChars );
+
+ rtl_destroyTextToUnicodeContext(aConverter, aContext);
+ rtl_destroyTextToUnicodeConverter(aConverter);
+
+ }
+ else
+ {
+ pInsertTextString = (sal_Unicode*)pMBString;
+ }
+ }
+
+ // enlarge target text-buffer if necessary
+ if (pText->nSize <= (pText->nLength + nInsertTextLength))
+ enlarge_buffer(pText, pText->nLength + nInsertTextLength);
+
+ // insert text: displace old mem and put new bytes in
+ int from = where;
+ int to = where + nInsertTextLength;
+ int howmany = pText->nLength - where;
+
+ memmove((void*)(pText->pUnicodeBuffer + to),
+ (void*)(pText->pUnicodeBuffer + from),
+ howmany * sizeof(sal_Unicode));
+ memmove((void*)(pText->pCharStyle + to),
+ (void*)(pText->pCharStyle + from),
+ howmany * sizeof(XIMFeedback));
+
+ to = from;
+ howmany = nInsertTextLength;
+
+ memcpy((void*)(pText->pUnicodeBuffer + to), (void*)pInsertTextString,
+ howmany * sizeof(sal_Unicode));
+ memcpy((void*)(pText->pCharStyle + to), (void*)pInsertTextCharStyle,
+ howmany * sizeof(XIMFeedback));
+
+ pText->nLength += howmany;
+
+ // NULL-terminate the string
+ pText->pUnicodeBuffer[pText->nLength] = (sal_Unicode)0;
+}
+
+//
+// Handle the change of attributes in a preedit_draw_callback
+//
+void
+Preedit_UpdateAttributes ( preedit_text_t* ptext, XIMFeedback* feedback,
+ int from, int amount )
+{
+ if ( (from + amount) > ptext->nLength )
+ {
+ // XXX this indicates an error, are we out of sync ?
+ fprintf (stderr, "Preedit_UpdateAttributes( %i + %i > %i )\n",
+ from, amount, ptext->nLength );
+ fprintf (stderr, "\t XXX internal error, out of sync XXX\n");
+
+ return;
+ }
+
+ memcpy ( ptext->pCharStyle + from,
+ feedback, amount * sizeof(XIMFeedback) );
+}
+
+// Convert the XIM feedback values into appropriate VCL
+// SAL_EXTTEXTINPUT_ATTR values
+// returns an allocate list of attributes, which must be freed by caller
+USHORT*
+Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength )
+{
+ USHORT *psalattr;
+ USHORT nval;
+ USHORT noldval = 0;
+ XIMFeedback nfeedback;
+
+ // only work with reasonable length
+ if (nlength > 0)
+ psalattr = (USHORT*)malloc(nlength * sizeof(USHORT));
+ else
+ return (USHORT*)NULL;
+
+ for (int npos = 0; npos < nlength; npos++)
+ {
+ nval = 0;
+ nfeedback = pfeedback[npos];
+
+ // means to use the feedback of the previous char
+ if (nfeedback == 0)
+ {
+ nval = noldval;
+ }
+ // convert feedback to attributes
+ else
+ {
+ if (nfeedback & XIMReverse)
+ nval |= SAL_EXTTEXTINPUT_ATTR_REDTEXT;
+ if (nfeedback & XIMUnderline)
+ nval |= SAL_EXTTEXTINPUT_ATTR_UNDERLINE;
+ if (nfeedback & XIMHighlight)
+ nval |= SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT;
+ if (nfeedback & XIMPrimary)
+ nval |= SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ if (nfeedback & XIMSecondary)
+ nval |= SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
+ if (nfeedback & XIMTertiary) // same as 2ery
+ nval |= SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
+
+ #if 0 // visibility feedback not supported now
+ if ( (nfeedback & XIMVisibleToForward)
+ || (nfeedback & XIMVisibleToBackward)
+ || (nfeedback & XIMVisibleCenter) )
+ { }
+ #endif
+ }
+ // copy in list
+ psalattr[npos] = nval;
+ noldval = nval;
+ }
+ // return list of sal attributes
+ return psalattr;
+}
+
+void
+PreeditDrawCallback(XIC ic, XPointer client_data,
+ XIMPreeditDrawCallbackStruct *call_data)
+{
+ preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
+
+ // if there's nothing to change then change nothing
+ if ( (call_data->text == NULL) && (call_data->chg_length == 0) )
+ return;
+
+ if ( pPreeditData->eState == ePreeditStatusStartPending )
+ pPreeditData->eState = ePreeditStatusActivationRequired;
+ PreeditStartCallback( ic, client_data, NULL );
+
+ // Edit the internal textbuffer as indicated by the call_data,
+ // chg_first and chg_length are guaranteed to be nonnegative
+
+ // handle text deletion
+ if (call_data->text == NULL)
+ {
+ Preedit_DeleteText(&(pPreeditData->aText),
+ call_data->chg_first, call_data->chg_length );
+ }
+ else
+ {
+ // handle text insertion
+ if ( (call_data->chg_length == 0)
+ && (call_data->text->string.wide_char != NULL))
+ {
+ Preedit_InsertText(&(pPreeditData->aText), call_data->text,
+ call_data->chg_first, pPreeditData->bIsMultilingual);
+ }
+ else
+ // handle text replacement by deletion and insertion of text,
+ // not smart, just good enough
+ if ( (call_data->chg_length != 0)
+ && (call_data->text->string.wide_char != NULL))
+ {
+ Preedit_DeleteText(&(pPreeditData->aText),
+ call_data->chg_first, call_data->chg_length);
+ Preedit_InsertText(&(pPreeditData->aText), call_data->text,
+ call_data->chg_first, pPreeditData->bIsMultilingual);
+ }
+ else
+ // not really a text update, only attributes are concerned
+ if ( (call_data->chg_length != 0)
+ && (call_data->text->string.wide_char == NULL))
+ {
+ Preedit_UpdateAttributes(&(pPreeditData->aText),
+ call_data->text->feedback,
+ call_data->chg_first, call_data->chg_length);
+ }
+ }
+
+ //
+ // build the SalExtTextInputEvent and send it up
+ //
+
+ SalExtTextInputEvent aTextEvent;
+
+ aTextEvent.mnTime = 0;
+ aTextEvent.mpTextAttr = Preedit_FeedbackToSAL(
+ pPreeditData->aText.pCharStyle, pPreeditData->aText.nLength);
+ aTextEvent.mnCursorPos = call_data->caret;
+ aTextEvent.maText = pPreeditData->aText.pUnicodeBuffer;
+ aTextEvent.mbCursorVisible = True;
+ aTextEvent.mnDeltaStart = 0; // call_data->chg_first;
+ aTextEvent.mbOnlyCursor = False;
+
+ if ( pPreeditData->eState == ePreeditStatusActive )
+ pPreeditData->pFrame->maFrameData.Call(SALEVENT_EXTTEXTINPUT,
+ (void*)&aTextEvent);
+ if (aTextEvent.mpTextAttr)
+ free((void*)aTextEvent.mpTextAttr);
+}
+
+// -------------------------------------------------------------------------
+//
+// iv. preedit caret callback
+//
+// -------------------------------------------------------------------------
+
+void
+PreeditCaretCallback ( XIC ic, XPointer client_data,
+ XIMPreeditCaretCallbackStruct *call_data )
+{
+ // XXX PreeditCaretCallback is pure debug code for now
+ char *direction = "?";
+ char *style = "?";
+
+ switch ( call_data->style )
+ {
+ case XIMIsInvisible: style = "Invisible"; break;
+ case XIMIsPrimary: style = "Primary"; break;
+ case XIMIsSecondary: style = "Secondary"; break;
+ }
+ switch ( call_data->direction )
+ {
+ case XIMForwardChar: direction = "Forward char"; break;
+ case XIMBackwardChar: direction = "Backward char"; break;
+ case XIMForwardWord: direction = "Forward word"; break;
+ case XIMBackwardWord: direction = "Backward word"; break;
+ case XIMCaretUp: direction = "Caret up"; break;
+ case XIMCaretDown: direction = "Caret down"; break;
+ case XIMNextLine: direction = "Next line"; break;
+ case XIMPreviousLine: direction = "Previous line"; break;
+ case XIMLineStart: direction = "Line start"; break;
+ case XIMLineEnd: direction = "Line end"; break;
+ case XIMAbsolutePosition: direction = "Absolute"; break;
+ case XIMDontChange: direction = "Dont change"; break;
+ }
+
+ fprintf (stderr, "PreeditCaretCallback( ic=%i, client=%i,\n",
+ (unsigned int)ic, (unsigned int)client_data );
+ fprintf (stderr, "\t position=%i, direction=\"%s\", style=\"%s\" )\n",
+ call_data->position, direction, style );
+
+ // XXX
+}
+
+// -----------------------------------------------------------------------
+//
+// v. commit string callback: convert an extended text input (iiimp ... )
+// into an ordinary key-event
+//
+// -----------------------------------------------------------------------
+
+int
+CommitStringCallback( XIC ic, XPointer client_data, XPointer call_data )
+{
+ preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
+
+ XIMUnicodeText *cbtext = (XIMUnicodeText *)call_data;
+ sal_Unicode *p_unicode_data = (sal_Unicode*)cbtext->string.utf16_char;
+ p_unicode_data[cbtext->length] = (sal_Unicode)0;
+
+ if ( pPreeditData->eState == ePreeditStatusActive )
+ PreeditDoneCallback( ic, client_data, call_data );
+
+ pPreeditData->pFrame->maFrameData.Call( SALEVENT_STARTEXTTEXTINPUT,
+ (void*)NULL );
+
+ SalExtTextInputEvent aTextEvent;
+
+ aTextEvent.mnTime = 0;
+ aTextEvent.mpTextAttr = 0;
+ aTextEvent.mnCursorPos = cbtext->length;
+ aTextEvent.maText = p_unicode_data;
+ aTextEvent.mbCursorVisible = True;
+ aTextEvent.mnDeltaStart = 0;
+ aTextEvent.mbOnlyCursor = False;
+
+ pPreeditData->pFrame->maFrameData.Call( SALEVENT_EXTTEXTINPUT,
+ (void*)&aTextEvent);
+ pPreeditData->pFrame->maFrameData.Call( SALEVENT_ENDEXTTEXTINPUT,
+ (void*)NULL );
+
+ return 0;
+}
+
diff --git a/vcl/unx/source/app/i18n_ic.cxx b/vcl/unx/source/app/i18n_ic.cxx
new file mode 100644
index 000000000000..4e2f34b77d22
--- /dev/null
+++ b/vcl/unx/source/app/i18n_ic.cxx
@@ -0,0 +1,686 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_ic.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <alloca.h>
+
+#include <prex.h>
+#include <X11/Xlocale.h>
+#include <X11/Xlib.h>
+#include <postx.h>
+
+#include <salunx.h>
+
+#include <XIM.h>
+
+#ifndef _SAL_I18N_INPUTCONTEXT_HXX
+#include "i18n_ic.hxx"
+#endif
+#ifndef _SAL_I18N_INPUTMETHOD_HXX
+#include "i18n_im.hxx"
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+
+// ---------------------------------------------------------------------------
+//
+// Constructor / Destructor, the InputContext is bound to the SalFrame, as it
+// needs the shell window as a focus window
+//
+// ----------------------------------------------------------------------------
+
+SalI18N_InputContext::~SalI18N_InputContext()
+{
+ if ( maContext != NULL )
+ XDestroyIC( maContext );
+ if ( mpAttributes != NULL )
+ XFree( mpAttributes );
+ if ( mpStatusAttributes != NULL )
+ XFree( mpStatusAttributes );
+ if ( mpPreeditAttributes != NULL )
+ XFree( mpPreeditAttributes );
+ #ifdef SOLARIS
+ if ( mpFontSet != NULL )
+ XFreeFontSet( mpDisplay, mpFontSet );
+ #endif
+}
+
+#ifdef DEBUG
+
+// ----------------------------------------------------------------------------
+// debug routines, that keep track of fonts we've chosen in a fontset
+// ----------------------------------------------------------------------------
+
+// report which fonts are missing for the requested
+// basefont and which fonts are actually selected
+
+static void
+v_print_missing_fonts( char **pp_list, int n_listsz, const char *p_pattern )
+{
+ if ( !(n_listsz > 0) || (pp_list == NULL) || (p_pattern == NULL) )
+ return;
+
+ for (int i = 0; i < n_listsz; i++ )
+ fprintf(stderr, "missing charset@%s:\"%s\"\n", p_pattern, pp_list[i] );
+}
+
+static void
+v_print_chosen_fonts( XFontSet a_fontset )
+{
+ if ( a_fontset == 0 )
+ return;
+
+ char *p_locale_name;
+ XFontStruct **pp_font_struct_list;
+ char **pp_font_name_list;
+ int n_listsz;
+
+ p_locale_name = XLocaleOfFontSet( a_fontset );
+ n_listsz = XFontsOfFontSet( a_fontset,
+ &pp_font_struct_list,
+ &pp_font_name_list );
+ for ( int i = 0; i < n_listsz; i++ )
+ {
+ fprintf( stderr, "font@%s:\"%s\"\n",
+ p_locale_name, pp_font_name_list[i] );
+ }
+}
+
+#endif // DEBUG
+
+// Wrapper for XCreateFontSet to create a default font set
+static XFontSet
+p_create_fontset( Display *p_display )
+{
+ // a fontset, as there is no valid default for russian and all other
+ // eastern european locales in solaris 8
+ const char *p_base_font[] = {
+ "-*-application-medium-r-*-sans-12-*",
+ "-*-application-*-r-*-*-12-*",
+ "-*-*-*-r-*-*-12-*",
+ "-*" };
+ char **pp_missing_charset_list = NULL;
+ int n_missing_charset_count = 0;
+ char *p_def_string = NULL;
+
+ XFontSet a_fontset;
+
+ for (int i = 0; i < (sizeof(p_base_font) / sizeof(char*)); i++ )
+ {
+ a_fontset = XCreateFontSet( p_display, p_base_font[i],
+ &pp_missing_charset_list,
+ &n_missing_charset_count, &p_def_string);
+ #ifdef DEBUG
+ v_print_missing_fonts ( pp_missing_charset_list,
+ n_missing_charset_count, p_base_font[i] );
+ #endif
+
+ if ( a_fontset != 0 )
+ break;
+ }
+
+ #ifdef DEBUG
+ v_print_chosen_fonts( a_fontset );
+ #endif
+
+ return a_fontset;
+}
+
+// ----------------------------------------------------------------------------
+// convenience routine to add items to a XVaNestedList
+// ----------------------------------------------------------------------------
+
+static XVaNestedList
+XVaAddToNestedList( XVaNestedList a_srclist, char* name, XPointer value )
+{
+ XVaNestedList a_dstlist;
+
+ // if ( value == NULL )
+ // return a_srclist;
+
+ if ( a_srclist == NULL )
+ {
+ a_dstlist = XVaCreateNestedList(
+ 0,
+ name, value,
+ 0 );
+ }
+ else
+ {
+ a_dstlist = XVaCreateNestedList(
+ 0,
+ XNVaNestedList, a_srclist,
+ name, value,
+ 0 );
+ }
+
+ return a_dstlist != NULL ? a_dstlist : a_srclist ;
+}
+
+// ---------------------------------------------------------------------------
+//
+// Constructor for a InputContext (IC)
+//
+// ----------------------------------------------------------------------------
+
+SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) :
+ mbUseable( True ),
+ maContext( (XIC)NULL ),
+ mpAttributes( NULL ),
+ mpStatusAttributes( NULL ),
+ mpPreeditAttributes( NULL ),
+ #ifdef SOLARIS
+ mpFontSet( NULL ),
+ #endif
+ mnStatusStyle( 0 ),
+ mnPreeditStyle( 0 ),
+ mnSupportedPreeditStyle( XIMPreeditCallbacks |
+ XIMPreeditNothing | XIMPreeditNone
+ /* | XIMPreeditCallbacks
+ | XIMPreeditArea
+ | XIMPreeditPosition */ ),
+ mnSupportedStatusStyle( // XIMStatusCallbacks |
+ XIMStatusNothing | XIMStatusNone
+ /* | XIMStatusCallbacks
+ | XIMStatusArea */ )
+{
+ SalI18N_InputMethod *pInputMethod;
+ pInputMethod = pFrame->maFrameData.GetDisplay()->GetInputMethod();
+ mbMultiLingual = pInputMethod->IsMultiLingual();
+
+ if ( pInputMethod->UseMethod()
+ && SupportInputMethodStyle( pInputMethod->GetSupportedStyles() ) )
+ {
+ XLIB_Window aClientWindow= pFrame->maFrameData.GetShellWindow();
+ XLIB_Window aFocusWindow= pFrame->maFrameData.GetWindow();
+ Display *pDisplay = XDisplayOfIM( pInputMethod->GetMethod() );
+
+ // for status callbacks and commit string callbacks
+ maClientData.bIsMultilingual = mbMultiLingual;
+ maClientData.eState = ePreeditStatusStartPending;
+ maClientData.pFrame = pFrame;
+ maClientData.aText.pUnicodeBuffer = NULL;
+ maClientData.aText.pCharStyle = NULL;
+ maClientData.aText.nCursorPos = 0;
+ maClientData.aText.nLength = 0;
+ maClientData.aText.nSize = 0;
+
+ // set status attributes
+ // only none and nothing are supported which do not need special
+ // arguments, area and position are just hacks, preedit callback
+ // does work but cannot be connected without unicode/multibyte
+ // support of independent vcl layer
+
+ switch ( mnStatusStyle )
+ {
+ case XIMStatusArea:
+ {
+ XRectangle *pStatusArea = new XRectangle;
+ pStatusArea->x = 0;
+ pStatusArea->y = 64;
+ pStatusArea->width = 256;
+ pStatusArea->height = 64;
+
+ mpStatusAttributes = XVaCreateNestedList (
+ 0,
+ XNAreaNeeded, pStatusArea,
+ XNArea, pStatusArea,
+ 0 );
+
+ break;
+ }
+
+ case XIMStatusNone:
+ case XIMStatusNothing:
+ default:
+
+ break;
+ }
+
+ //
+ // set preedit attributes
+ //
+
+ switch ( mnPreeditStyle )
+ {
+ case XIMPreeditCallbacks:
+
+ maPreeditCaretCallback.callback = (XIMProc)PreeditCaretCallback;
+ maPreeditStartCallback.callback = (XIMProc)PreeditStartCallback;
+ maPreeditDoneCallback.callback = (XIMProc)PreeditDoneCallback;
+ maPreeditDrawCallback.callback = (XIMProc)PreeditDrawCallback;
+ maPreeditCaretCallback.client_data = (XPointer)&maClientData;
+ maPreeditStartCallback.client_data = (XPointer)&maClientData;
+ maPreeditDoneCallback.client_data = (XPointer)&maClientData;
+ maPreeditDrawCallback.client_data = (XPointer)&maClientData;
+
+ mpPreeditAttributes = XVaCreateNestedList (
+ 0,
+ XNPreeditStartCallback, &maPreeditStartCallback,
+ XNPreeditDoneCallback, &maPreeditDoneCallback,
+ XNPreeditDrawCallback, &maPreeditDrawCallback,
+ XNPreeditCaretCallback, &maPreeditCaretCallback,
+ 0 );
+
+ break;
+
+ case XIMPreeditPosition:
+ case XIMPreeditArea:
+ {
+ XRectangle *pPreeditArea = new XRectangle;
+ XPoint *pSpotLocation = new XPoint;
+
+ pSpotLocation->x = 16;
+ pSpotLocation->y = 32;
+
+ pPreeditArea->x = 0;
+ pPreeditArea->y = 0;
+ pPreeditArea->width = 256;
+ pPreeditArea->height = 64;
+
+ mpPreeditAttributes = XVaCreateNestedList (
+ 0,
+ XNArea, pPreeditArea,
+ XNSpotLocation, pSpotLocation,
+ 0 );
+
+ break;
+ }
+
+ case XIMPreeditNone:
+ case XIMPreeditNothing:
+ default:
+
+ break;
+ }
+
+ // Create the InputContext by given it exact the information it
+ // deserves, because inappropriate attributes
+ // let XCreateIC fail on Solaris (eg. for C locale)
+
+ mpAttributes = XVaCreateNestedList(
+ 0,
+ XNFocusWindow, aFocusWindow,
+ XNClientWindow, aClientWindow,
+ XNInputStyle, mnPreeditStyle | mnStatusStyle,
+ 0 );
+
+ #ifdef SOLARIS
+ mpDisplay = pDisplay;
+ if ( 0 && (mpFontSet = p_create_fontset(mpDisplay)) != NULL )
+ {
+ mpStatusAttributes = XVaAddToNestedList( mpStatusAttributes,
+ XNFontSet, (XPointer)mpFontSet );
+ mpPreeditAttributes = XVaAddToNestedList( mpPreeditAttributes,
+ XNFontSet, (XPointer)mpFontSet );
+ }
+ #endif
+ if ( mnPreeditStyle != XIMPreeditNone )
+ {
+ #ifdef LINUX
+ if ( mpPreeditAttributes != NULL )
+ #endif
+ mpAttributes = XVaAddToNestedList( mpAttributes,
+ XNPreeditAttributes, (XPointer)mpPreeditAttributes );
+ }
+ if ( mnStatusStyle != XIMStatusNone )
+ {
+ #ifdef LINUX
+ if ( mpStatusAttributes != NULL )
+ #endif
+ mpAttributes = XVaAddToNestedList( mpAttributes,
+ XNStatusAttributes, (XPointer)mpStatusAttributes );
+ }
+ maContext = XCreateIC( pInputMethod->GetMethod(),
+ XNVaNestedList, mpAttributes,
+ NULL );
+ }
+
+ if ( maContext == NULL )
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "input context creation failed\n");
+ #endif
+
+ mbUseable = False;
+ mbMultiLingual = False;
+
+ if ( mpAttributes != NULL )
+ XFree( mpAttributes );
+ if ( mpStatusAttributes != NULL )
+ XFree( mpStatusAttributes );
+ if ( mpPreeditAttributes != NULL )
+ XFree( mpPreeditAttributes );
+ }
+
+ if ( maContext != NULL && mbMultiLingual )
+ {
+ maCommitStringCallback.callback = (XIMProc)::CommitStringCallback;
+ maCommitStringCallback.client_data = (XPointer)&maClientData;
+ XSetICValues( maContext,
+ XNCommitStringCallback, &maCommitStringCallback,
+ NULL );
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// In Solaris 8 the status window does not unmap if the frame unmapps, so
+// unmap it the hard way
+//
+// ---------------------------------------------------------------------------
+
+void
+SalI18N_InputContext::Unmap()
+{
+ if ( maContext != NULL )
+ {
+ XDestroyIC( maContext );
+ maContext = NULL;
+ }
+}
+
+void
+SalI18N_InputContext::Map( SalFrame *pFrame )
+{
+ if ( (maContext == NULL) && mbUseable)
+ {
+ SalI18N_InputMethod *pInputMethod;
+ pInputMethod = pFrame->maFrameData.GetDisplay()->GetInputMethod();
+
+ maContext = XCreateIC( pInputMethod->GetMethod(),
+ XNVaNestedList, mpAttributes,
+ NULL );
+ if ( maContext != NULL && mbMultiLingual )
+ XSetICValues( maContext,
+ XNCommitStringCallback, &maCommitStringCallback,
+ NULL );
+ SetICFocus();
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// make sure, the input method gets all the X-Events it needs, this is only
+// called once on each frame, it relys on a valid maContext
+//
+// ---------------------------------------------------------------------------
+
+void
+SalI18N_InputContext::ExtendEventMask( XLIB_Window aFocusWindow )
+{
+ unsigned long nIMEventMask;
+ XWindowAttributes aWindowAttributes;
+
+ if ( mbUseable )
+ {
+ Display *pDisplay = XDisplayOfIM( XIMOfIC(maContext) );
+
+ XGetWindowAttributes( pDisplay, aFocusWindow,
+ &aWindowAttributes );
+ XGetICValues ( maContext,
+ XNFilterEvents, &nIMEventMask,
+ NULL);
+ nIMEventMask |= aWindowAttributes.your_event_mask;
+ XSelectInput ( pDisplay, aFocusWindow, nIMEventMask );
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// tune the styles provided by the input method with the supported one
+//
+// ---------------------------------------------------------------------------
+
+unsigned int
+SalI18N_InputContext::GetWeightingOfIMStyle( XIMStyle nStyle ) const
+{
+ struct StyleWeightingT {
+ const XIMStyle nStyle;
+ const unsigned int nWeight;
+ };
+
+ StyleWeightingT const *pWeightPtr;
+ const StyleWeightingT pWeight[] = {
+ { XIMPreeditCallbacks, 0x10000000 },
+ { XIMPreeditPosition, 0x02000000 },
+ { XIMPreeditArea, 0x01000000 },
+ { XIMPreeditNothing, 0x00100000 },
+ { XIMPreeditNone, 0x00010000 },
+ { XIMStatusCallbacks, 0x1000 },
+ { XIMStatusArea, 0x0100 },
+ { XIMStatusNothing, 0x0010 },
+ { XIMStatusNone, 0x0001 },
+ { 0, 0x0 }
+ };
+
+ int nWeight = 0;
+ for ( pWeightPtr = pWeight; pWeightPtr->nStyle != 0; pWeightPtr++ )
+ {
+ if ( (pWeightPtr->nStyle & nStyle) != 0 )
+ nWeight += pWeightPtr->nWeight;
+ }
+ return nWeight;
+}
+
+Bool
+SalI18N_InputContext::IsSupportedIMStyle( XIMStyle nStyle ) const
+{
+ if ( (nStyle & mnSupportedPreeditStyle)
+ && (nStyle & mnSupportedStatusStyle) )
+ {
+ return True;
+ }
+ return False;
+}
+
+Bool
+SalI18N_InputContext::SupportInputMethodStyle( XIMStyles *pIMStyles )
+{
+ int nBestScore = 0;
+ int nActualScore = 0;
+
+ mnPreeditStyle = 0;
+ mnStatusStyle = 0;
+
+ if ( pIMStyles != NULL )
+ {
+ // check whether the XIM supports one of the desired styles
+ // only a single preedit and a single status style must occure
+ // in a inpuut method style. Hideki said so, so i trust him
+ for ( int nStyle = 0; nStyle < pIMStyles->count_styles; nStyle++ )
+ {
+ XIMStyle nProvidedStyle = pIMStyles->supported_styles[ nStyle ];
+ if ( IsSupportedIMStyle(nProvidedStyle) )
+ {
+ nActualScore = GetWeightingOfIMStyle( nProvidedStyle );
+ if ( nActualScore >= nBestScore )
+ {
+ nBestScore = nActualScore;
+ mnPreeditStyle = nProvidedStyle & mnSupportedPreeditStyle;
+ mnStatusStyle = nProvidedStyle & mnSupportedStatusStyle;
+ }
+ }
+ }
+ }
+
+ #ifdef DEBUG
+ char pBuf[ 128 ];
+ fprintf( stderr, "selected inputmethod style = %s\n",
+ GetMethodName(mnPreeditStyle | mnStatusStyle, pBuf, sizeof(pBuf)) );
+ #endif
+
+ return (mnPreeditStyle != 0) && (mnStatusStyle != 0) ;
+}
+
+int
+SalI18N_InputContext::CommitStringCallback( sal_Unicode* pText, sal_Size nLength )
+{
+ XIMUnicodeText call_data;
+
+ call_data.string.utf16_char = pText;
+ call_data.length = nLength;
+ call_data.annotations = NULL;
+ call_data.count_annotations = 0;
+ call_data.feedback = NULL;
+
+ return ::CommitStringCallback( maContext,
+ (XPointer)&maClientData, (XPointer)&call_data );
+}
+
+// ---------------------------------------------------------------------------
+//
+// set and unset the focus for the Input Context
+// the context may be NULL despite it is useable if the framewindow is
+// in unmapped state
+//
+// ---------------------------------------------------------------------------
+
+void
+SalI18N_InputContext::SetICFocus()
+{
+ if ( mbUseable && (maContext != NULL) )
+ XSetICFocus( maContext );
+}
+
+void
+SalI18N_InputContext::UnsetICFocus()
+{
+ if ( mbUseable && (maContext != NULL) )
+ XUnsetICFocus( maContext );
+}
+
+// ---------------------------------------------------------------------------
+//
+// not used, multi byte input method only
+//
+// ---------------------------------------------------------------------------
+
+void
+SalI18N_InputContext::EndExtTextInput( USHORT nFlags )
+{
+ if ( mbUseable && (maContext != NULL) )
+ {
+ char *pPendingChars = XmbResetIC( maContext );
+
+ // text is unicode
+ if ( (pPendingChars != NULL)
+ && (nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE) )
+ {
+ XIMUnicodeText aPendingText;
+ int nLen;
+ sal_Unicode* pPtr;
+ rtl_TextEncoding nEncoding = gsl_getSystemTextEncoding();
+
+ // buffer is already unicode
+ if ( mbMultiLingual || nEncoding == RTL_TEXTENCODING_UNICODE )
+ {
+ pPtr = (sal_Unicode*)pPendingChars;
+ for ( nLen = 0; pPtr[ nLen ] != (sal_Unicode)0; nLen++ )
+ ;
+ }
+ // else convert buffer to unicode
+ else
+ {
+ for ( nLen = 0; pPendingChars[ nLen ] != (char)0; nLen++ )
+ ;
+
+ // create text converter
+ rtl_TextToUnicodeConverter aConverter =
+ rtl_createTextToUnicodeConverter( nEncoding );
+ rtl_TextToUnicodeContext aContext =
+ rtl_createTextToUnicodeContext( aConverter );
+
+ sal_Size nBufferSize = nLen * 2;
+ sal_uInt32 nConversionInfo;
+ sal_Size nConvertedChars;
+
+ pPtr = (sal_Unicode*) alloca( nBufferSize );
+
+ // convert to single byte text stream
+ nLen = rtl_convertTextToUnicode(
+ aConverter, aContext, (char*)pPendingChars,
+ nLen, pPtr, nBufferSize,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE,
+ &nConversionInfo, &nConvertedChars );
+
+ // destroy converter
+ rtl_destroyTextToUnicodeContext( aConverter, aContext );
+ rtl_destroyTextToUnicodeConverter( aConverter );
+ }
+ aPendingText.length = nLen;
+ aPendingText.string.utf16_char = pPtr;
+
+ ::CommitStringCallback( maContext,
+ (XPointer)&maClientData, (XPointer)&aPendingText );
+ }
+ if ( pPendingChars != NULL )
+ XFree ( (void*)pPendingChars );
+ }
+}
+
+
diff --git a/vcl/unx/source/app/i18n_im.cxx b/vcl/unx/source/app/i18n_im.cxx
new file mode 100644
index 000000000000..04c1f9b24ca2
--- /dev/null
+++ b/vcl/unx/source/app/i18n_im.cxx
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_im.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+
+#include <prex.h>
+#include <X11/Xlocale.h>
+#include <X11/Xlib.h>
+#include <XIM.h>
+#include <postx.h>
+
+#include <salunx.h>
+
+#ifndef _SAL_I18N_INPUTMETHOD_HXX
+#include "i18n_im.hxx"
+#endif
+
+// -------------------------------------------------------------------------
+//
+// locale handling
+//
+// -------------------------------------------------------------------------
+
+// Locale handling of the operating system layer
+
+static char*
+SetSystemLocale( const char* p_inlocale )
+{
+ char *p_outlocale;
+ if ( (p_outlocale = setlocale(LC_ALL, p_inlocale)) == NULL )
+ {
+ fprintf( stderr,
+ "I18N: Operating system doesn't support locale \"%s\"\n",
+ p_inlocale );
+ }
+
+ return p_outlocale;
+}
+
+static Bool
+IsPosixLocale( const char* p_locale )
+{
+ if ( p_locale == NULL )
+ return False;
+ if ( (p_locale[ 0 ] == 'C') && (p_locale[ 1 ] == '\0') )
+ return True;
+ if ( strncmp(p_locale, "POSIX", sizeof("POSIX")) == 0 )
+ return True;
+
+ return False;
+}
+
+// Locale handling of the X Window System layer
+
+static Bool
+IsXWindowCompatibleLocale( const char* p_locale )
+{
+ if ( p_locale == NULL )
+ return False;
+
+ if ( !XSupportsLocale() )
+ {
+ if ( p_locale != NULL )
+ fprintf (stderr,
+ "I18N: X Window System doesn't support locale \"%s\"\n",
+ p_locale );
+ return False;
+ }
+ return True;
+}
+
+// Locale setting for the Input Method
+// allways provide a fallback, even if it means falling back to the
+// portable POSIX "C" locale
+
+Bool
+SalI18N_InputMethod::SetLocale( const char* pLocale )
+{
+ // check whether we want an Input Method engine, if we don't we
+ // do not need to set the locale
+ if ( mbUseable )
+ {
+ char *locale;
+
+ // check whether the operating system supports the LANG
+ if ( (locale = SetSystemLocale( pLocale )) == NULL )
+ {
+ if ( (locale = SetSystemLocale( "C" )) == NULL )
+ mbUseable = False;
+ }
+
+ // check whether the XWindow system supports the LANG
+ if ( !IsXWindowCompatibleLocale(locale) )
+ {
+ if ( !IsPosixLocale(locale) )
+ {
+ locale = SetSystemLocale( "C" );
+ if ( !IsXWindowCompatibleLocale(locale) )
+ mbUseable = False;
+ }
+ else
+ {
+ mbUseable = False;
+ }
+ }
+
+ // must not fail if mbUseable since XSupportsLocale() asserts success
+ if ( mbUseable && XSetLocaleModifiers("") == NULL )
+ {
+ fprintf (stderr, "I18N: Can't set X modifiers for locale \"%s\"\n",
+ locale);
+ mbUseable = False;
+ }
+ }
+
+ return mbUseable;
+}
+
+// ------------------------------------------------------------------------
+//
+// Constructor / Destructor / Initialisation
+//
+// ------------------------------------------------------------------------
+
+SalI18N_InputMethod::SalI18N_InputMethod( ) : maMethod( (XIM)NULL ),
+ mpStyles( (XIMStyles*)NULL ),
+ mbUseable( bUseInputMethodDefault ),
+ mbMultiLingual( False )
+{
+ const char *pUseInputMethod = getenv( "SAL_USEINPUTMETHOD" );
+ if ( pUseInputMethod != NULL )
+ mbUseable = pUseInputMethod[0] != '\0' ;
+}
+
+SalI18N_InputMethod::~SalI18N_InputMethod()
+{
+ if ( mpStyles != NULL )
+ XFree( mpStyles );
+ if ( maMethod != NULL )
+ XCloseIM ( maMethod );
+}
+
+//
+// XXX
+// debug routine: lets have a look at the provided method styles
+//
+
+#ifdef DEBUG
+
+extern "C" char*
+GetMethodName( XIMStyle nStyle, char *pBuf, int nBufSize)
+{
+ struct StyleName {
+ const XIMStyle nStyle;
+ const char *pName;
+ const int nNameLen;
+ };
+
+ StyleName *pDescPtr;
+ static const StyleName pDescription[] = {
+ { XIMPreeditArea, "PreeditArea ", sizeof("PreeditArea ") },
+ { XIMPreeditCallbacks, "PreeditCallbacks ",sizeof("PreeditCallbacks ")},
+ { XIMPreeditPosition, "PreeditPosition ", sizeof("PreeditPosition ") },
+ { XIMPreeditNothing, "PreeditNothing ", sizeof("PreeditNothing ") },
+ { XIMPreeditNone, "PreeditNone ", sizeof("PreeditNone ") },
+ { XIMStatusArea, "StatusArea ", sizeof("StatusArea ") },
+ { XIMStatusCallbacks, "StatusCallbacks ", sizeof("StatusCallbacks ") },
+ { XIMStatusNothing, "StatusNothing ", sizeof("StatusNothing ") },
+ { XIMStatusNone, "StatusNone ", sizeof("StatusNone ") },
+ { 0, "NULL", 0 }
+ };
+
+ if ( nBufSize > 0 )
+ pBuf[0] = '\0';
+
+ char *pBufPtr = pBuf;
+ for ( pDescPtr = const_cast<StyleName*>(pDescription); pDescPtr->nStyle != 0; pDescPtr++ )
+ {
+ int nSize = pDescPtr->nNameLen - 1;
+ if ( (nStyle & pDescPtr->nStyle) && (nBufSize > nSize) )
+ {
+ strncpy( pBufPtr, pDescPtr->pName, nSize + 1);
+ pBufPtr += nSize;
+ nBufSize -= nSize;
+ }
+ }
+
+ return pBuf;
+}
+
+extern "C" void
+PrintInputStyle( XIMStyles *pStyle )
+{
+ char pBuf[ 128 ];
+ int nBuf = sizeof( pBuf );
+
+ if ( pStyle == NULL )
+ fprintf( stderr, "no input method styles\n");
+ else
+ for ( int nStyle = 0; nStyle < pStyle->count_styles; nStyle++ )
+ {
+ fprintf( stderr, "style #%i = %s\n", nStyle,
+ GetMethodName(pStyle->supported_styles[nStyle], pBuf, nBuf) );
+ }
+}
+
+#endif
+
+//
+// this is the real constructing routine, since locale setting has to be done
+// prior to xopendisplay, the xopenim call has to be delayed
+//
+
+Bool
+SalI18N_InputMethod::CreateMethod ( Display *pDisplay )
+{
+ if ( mbUseable )
+ {
+ if ( getenv("USE_XOPENIM") == NULL )
+ {
+ mbMultiLingual = True; // set ml-input flag to create input-method
+ maMethod = XvaOpenIM(pDisplay, NULL, NULL, NULL,
+ XNMultiLingualInput, mbMultiLingual, /* dummy */
+ 0);
+ // get ml-input flag from input-method
+ if ( maMethod == (XIM)NULL )
+ mbMultiLingual = False;
+ else
+ if ( XGetIMValues(maMethod,
+ XNMultiLingualInput, &mbMultiLingual, NULL ) != NULL )
+ mbMultiLingual = False;
+ }
+ else
+ {
+ maMethod = XOpenIM(pDisplay, NULL, NULL, NULL);
+ mbMultiLingual = False;
+ }
+
+ if ( maMethod != (XIM)NULL )
+ {
+ if ( XGetIMValues(maMethod, XNQueryInputStyle, &mpStyles, NULL)
+ != NULL)
+ mbUseable = False;
+ #ifdef DEBUG
+ fprintf(stderr, "Creating %s-Lingual InputMethod\n",
+ mbMultiLingual ? "Multi" : "Mono" );
+ PrintInputStyle( mpStyles );
+ #endif
+ }
+ else
+ {
+ mbUseable = False;
+ }
+ }
+
+ #ifdef DEBUG
+ if ( !mbUseable )
+ fprintf(stderr, "input method creation failed\n");
+ #endif
+
+ return mbUseable;
+}
+
+//
+// give IM the opportunity to look at the event, and possibly hide it
+//
+
+Bool
+SalI18N_InputMethod::FilterEvent( XEvent *pEvent )
+{
+ return mbUseable && (Bool)XFilterEvent( pEvent, None );
+}
+
+
diff --git a/vcl/unx/source/app/i18n_wrp.cxx b/vcl/unx/source/app/i18n_wrp.cxx
new file mode 100644
index 000000000000..4ad92b28d3cb
--- /dev/null
+++ b/vcl/unx/source/app/i18n_wrp.cxx
@@ -0,0 +1,293 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_wrp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+struct XIMArg
+{
+ char *name;
+ char *value;
+};
+
+#if !defined(LINUX)
+#include <varargs.h>
+#else
+#include <stdarg.h>
+#endif
+#include <string.h>
+#include <dlfcn.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include "XIM.h"
+
+
+#ifdef SOLARIS
+#define XIIIMP_PATH "/usr/openwin/lib/locale/common/xiiimp.so.2"
+#else /* Linux */
+#define XIIIMP_PATH "/usr/lib/im/xiiimp.so.2"
+#endif
+
+/* global variables */
+static void *g_dlmodule = 0;
+
+extern "C" {
+typedef XIM (*OpenFunction)(Display*, XrmDatabase, char*, char*, XIMArg*);
+}
+
+static OpenFunction g_open_im = (OpenFunction)NULL;
+
+/* utility function to transform vararg list into an array of XIMArg */
+
+int
+XvaCountArgs( XIMArg *pInArgs )
+{
+ int nArgs = 0;
+ char *pName, *pValue;
+
+ while ( (pName = pInArgs->name) != NULL )
+ {
+ pValue = pInArgs->value;
+
+ if ( strcmp(pName, XNVaNestedList) == 0 )
+ {
+ nArgs += XvaCountArgs( (XIMArg*)pValue );
+ }
+ else
+ {
+ nArgs += 1;
+ }
+ pInArgs++;
+ }
+
+ return nArgs;
+}
+
+int
+XvaCountArgs( va_list pInArgs )
+{
+ int nArgs = 0;
+ char *pName, *pValue;
+
+ while ( (pName = va_arg(pInArgs, char*)) != NULL)
+ {
+ pValue = va_arg(pInArgs, char*);
+
+ if ( strcmp(pName, XNVaNestedList) == 0 )
+ {
+ nArgs += XvaCountArgs( (XIMArg*)pValue );
+ }
+ else
+ {
+ nArgs += 1;
+ }
+ }
+
+ return nArgs;
+}
+
+XIMArg*
+XvaGetArgs( XIMArg *pInArgs, XIMArg *pOutArgs )
+{
+ char *pName, *pValue;
+
+ while ( (pName = pInArgs->name) != NULL )
+ {
+ pValue = pInArgs->value;
+
+ if ( strcmp(pName, XNVaNestedList) == 0 )
+ {
+ pOutArgs = XvaGetArgs( (XIMArg*)pValue, pOutArgs );
+ }
+ else
+ {
+ pOutArgs->name = pName;
+ pOutArgs->value = pValue;
+ pOutArgs++;
+ }
+ pInArgs++;
+ }
+
+ return pOutArgs;
+}
+
+void
+XvaGetArgs( va_list pInArgs, XIMArg *pOutArgs )
+{
+ char *pName, *pValue;
+
+ while ((pName = va_arg(pInArgs, char*)) != NULL)
+ {
+ pValue = va_arg(pInArgs, char*);
+
+ if ( strcmp(pName, XNVaNestedList) == 0 )
+ {
+ pOutArgs = XvaGetArgs( (XIMArg*)pValue, pOutArgs );
+ }
+ else
+ {
+ pOutArgs->name = pName;
+ pOutArgs->value = pValue;
+ pOutArgs++;
+ }
+ }
+
+ pOutArgs->name = NULL;
+ pOutArgs->value = NULL;
+}
+
+
+/* Puplic functions */
+
+#ifdef __cplusplus
+extern "C"
+#endif
+XIM
+XvaOpenIM(Display *display, XrmDatabase rdb,
+ char *res_name, char *res_class, ...)
+{
+ XIM xim = (XIM)0;
+ va_list variable;
+ int total_count = 0;
+
+ /*
+ * so count the stuff dangling here
+ */
+
+ #ifdef LINUX
+ va_start(variable, res_class);
+ #else
+ va_start(variable);
+ #endif
+ total_count = XvaCountArgs(variable);
+ va_end(variable);
+
+ if (total_count > 0)
+ {
+ /* call a new open IM method */
+
+ XIMArg* args = (XIMArg*)Xmalloc( (total_count + 1) * sizeof(XIMArg) );
+
+ /*
+ * now package it up so we can set it along
+ */
+ #ifdef LINUX
+ va_start(variable, res_class);
+ #else
+ va_start(variable);
+ #endif
+ XvaGetArgs( variable, args );
+ va_end(variable);
+
+ if (!g_dlmodule)
+ {
+ g_dlmodule = dlopen(XIIIMP_PATH, RTLD_LAZY);
+ if (!g_dlmodule)
+ goto legacy_XIM;
+
+ g_open_im = (OpenFunction)(long)dlsym(g_dlmodule, "__XOpenIM");
+ if (!g_open_im)
+ goto legacy_XIM;
+
+ xim = (*g_open_im)(display, (XrmDatabase)rdb,
+ (char*)res_name, (char *)res_class, (XIMArg*)args);
+ }
+ else
+ {
+ goto legacy_XIM;
+ }
+ }
+
+ legacy_XIM:
+
+ if (!xim)
+ xim = XOpenIM(display, rdb, res_name, res_class);
+
+ return xim;
+}
+
+/*
+ * Close the connection to the input manager, and free the XIM structure
+ */
+
+Status
+XvaCloseIM(XIM im)
+{
+ Status s;
+ #if 0
+ XCloseIM(im);
+ s = (im->methods->close)(im); /* we can use the same close module */
+ #endif
+
+ if (!g_dlmodule)
+ {
+ /* assuming one XvaOpenIM call */
+ dlclose(g_dlmodule);
+ g_dlmodule = (void*)0;
+ g_open_im = (OpenFunction)NULL;
+ }
+ #if 0
+ if (im)
+ Xfree((char *)im);
+ #endif
+
+ return (s);
+}
+
+
+
diff --git a/vcl/unx/source/app/i18n_xkb.cxx b/vcl/unx/source/app/i18n_xkb.cxx
new file mode 100644
index 000000000000..b57abd09acc4
--- /dev/null
+++ b/vcl/unx/source/app/i18n_xkb.cxx
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * $RCSfile: i18n_xkb.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <stdio.h>
+
+#if defined(LINUX) // should really check for xfree86 or for X11R6.1 and higher
+#define __XKeyboardExtension__ 1
+#else
+#define __XKeyboardExtension__ 0
+#endif
+
+#include <prex.h>
+#include <X11/X.h>
+#if __XKeyboardExtension__
+#include <X11/XKBlib.h>
+#endif
+#include <postx.h>
+
+#ifndef _SAL_I18N_XKBDEXTENSION_HXX
+#include "i18n_xkb.hxx"
+#endif
+
+SalI18N_KeyboardExtension::SalI18N_KeyboardExtension( Display *pDisplay )
+ : mbUseExtension( (sal_Bool)__XKeyboardExtension__ ),
+ mnDefaultGroup( 0 )
+{
+ #if __XKeyboardExtension__
+
+ mpDisplay = pDisplay;
+
+ // allow user to set the default keyboard group idx or to disable the usage
+ // of x keyboard extension at all:
+ // setenv SAL_XKEYBOARDGROUP disables keyboard extension
+ // setenv SAL_XKEYBOARDGROUP 2 sets the keyboard group index to 2
+ // keyboard group index must be in [1,4], may be specified in hex or decimal
+ static char *pUseKeyboardExtension = getenv( "SAL_XKEYBOARDGROUP" );
+ if ( pUseKeyboardExtension != NULL )
+ {
+ mbUseExtension = pUseKeyboardExtension[0] != '\0' ;
+ if ( mbUseExtension )
+ mnDefaultGroup = strtol( pUseKeyboardExtension, NULL, 0 );
+ if ( mnDefaultGroup > XkbMaxKbdGroup )
+ mnDefaultGroup = 0;
+ }
+
+ // query XServer support for XKB Extension,
+ // do not call XQueryExtension() / XInitExtension() due to possible version
+ // clashes !
+ if ( mbUseExtension )
+ {
+ int nMajorExtOpcode;
+ int nExtMajorVersion = XkbMajorVersion;
+ int nExtMinorVersion = XkbMinorVersion;
+
+ mbUseExtension = (sal_Bool)XkbQueryExtension( mpDisplay,
+ &nMajorExtOpcode, (int*)&mnEventBase, (int*)&mnErrorBase,
+ &nExtMajorVersion, &nExtMinorVersion );
+ }
+
+ // query notification for changes of the keyboard group
+ if ( mbUseExtension )
+ {
+ #define XkbGroupMask ( XkbGroupStateMask | XkbGroupBaseMask \
+ | XkbGroupLatchMask | XkbGroupLockMask )
+
+ mbUseExtension = XkbSelectEventDetails( mpDisplay,
+ XkbUseCoreKbd, XkbStateNotify, XkbGroupMask, XkbGroupMask );
+ }
+
+ // query initial keyboard group
+ if ( mbUseExtension )
+ {
+ XkbStateRec aStateRecord;
+ XkbGetState( mpDisplay, XkbUseCoreKbd, &aStateRecord );
+ mnGroup = aStateRecord.group;
+ }
+
+ #endif // __XKeyboardExtension__
+}
+
+void
+SalI18N_KeyboardExtension::Dispatch( XEvent *pEvent )
+{
+ #if __XKeyboardExtension__
+
+ // must the event be handled?
+ if ( !mbUseExtension
+ || (pEvent->type != mnEventBase) )
+ return;
+
+ // only handle state notify events for now, and only interested
+ // in group details
+ sal_uInt32 nXKBType = ((XkbAnyEvent*)pEvent)->xkb_type;
+ switch ( nXKBType )
+ {
+ case XkbStateNotify:
+
+ mnGroup = ((XkbStateNotifyEvent*)pEvent)->group;
+ break;
+
+ default:
+
+ #ifdef DEBUG
+ fprintf(stderr, "Got unrequested XkbAnyEvent %#x/%i\n",
+ nXKBType, nXKBType );
+ #endif
+ break;
+ }
+
+ #endif // __XKeyboardExtension__
+}
+
+sal_uInt32
+SalI18N_KeyboardExtension::LookupKeysymInGroup( sal_uInt32 nKeyCode,
+ sal_uInt32 nShiftState,
+ sal_uInt32 nGroup ) const
+{
+ #if __XKeyboardExtension__
+
+ if ( !mbUseExtension )
+ return NoSymbol;
+
+ nShiftState &= ShiftMask;
+
+ KeySym nKeySymbol;
+ nKeySymbol = XkbKeycodeToKeysym( mpDisplay, nKeyCode, nGroup, nShiftState );
+ return nKeySymbol;
+
+ #else
+
+ return NoSymbol;
+
+ #endif // __XKeyboardExtension__
+}
+
+
diff --git a/vcl/unx/source/app/keysymnames.cxx b/vcl/unx/source/app/keysymnames.cxx
new file mode 100644
index 000000000000..e08804ff371e
--- /dev/null
+++ b/vcl/unx/source/app/keysymnames.cxx
@@ -0,0 +1,545 @@
+/*************************************************************************
+ *
+ * $RCSfile: keysymnames.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SOLARIS
+#include <prex.h>
+#include <X11/XKBlib.h>
+#include <postx.h>
+#endif
+
+#include <saldisp.hxx>
+#include <X11/keysym.h>
+
+#ifdef SOLARIS
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/kbio.h>
+#include <sys/kbd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <deflt.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#ifndef KB_USB // compile with too old headers
+#define KB_USB 6
+#endif
+#endif
+
+namespace vcl_sal {
+
+ struct KeysymNameReplacement
+ {
+ KeySym aSymbol;
+ const char* pName;
+ };
+
+ struct KeyboardReplacements
+ {
+ const char* pKeyboardName;
+ const KeysymNameReplacement* pReplacements;
+ int nReplacements;
+ rtl_TextEncoding nEncoding;
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_German[] =
+ {
+ { XK_Control_L, "Strg" },
+ { XK_Control_R, "Strg" },
+ { XK_Shift_L, "Umschalt" },
+ { XK_Shift_R, "Umschalt" },
+ { XK_Alt_L, "Alt" },
+ { XK_Alt_R, "Alt Gr" },
+ { XK_Page_Up, "Bild auf" },
+ { XK_Page_Down, "Bild ab" },
+ { XK_End, "Ende" },
+ { XK_Home, "Pos 1" },
+ { XK_Insert, "Einfg" },
+ { XK_Delete, "Entf" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "Rechts" },
+ { XK_Left, "Links" },
+ { XK_Up, "Oben" },
+ { XK_Down, "Unten" },
+ { XK_BackSpace, "Rückschritt" },
+ { XK_Return, "Eingabe" },
+ { XK_slash, "Schrägstrich" },
+ { XK_space, "Leertaste" }
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_French[] =
+ {
+ { XK_Shift_L, "Maj" },
+ { XK_Shift_R, "Maj" },
+ { XK_Page_Up, "Pg. Préc" },
+ { XK_Page_Down, "Pg. Suiv" },
+ { XK_End, "Fin" },
+ { XK_Home, "Origine" },
+ { XK_Insert, "Insérer" },
+ { XK_Delete, "Suppr" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "Droite" },
+ { XK_Left, "Gauche" },
+ { XK_Up, "Haut" },
+ { XK_Down, "Bas" },
+ { XK_BackSpace, "Ret. Arr" },
+ { XK_Return, "Retour" },
+ { XK_KP_Enter, "Entrée" }
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_Italian[] =
+ {
+ { XK_Shift_L, "Maiusc" },
+ { XK_Shift_R, "Maiusc" },
+ { XK_Page_Up, "PgSu" },
+ { XK_Page_Down, "PgGiu" },
+ { XK_End, "Fine" },
+ { XK_Insert, "Ins" },
+ { XK_Delete, "Canc" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "A destra" },
+ { XK_Left, "A sinistra" },
+ { XK_Up, "Sposta verso l'alto" },
+ { XK_Down, "Sposta verso il basso" },
+ { XK_BackSpace, "Backspace" },
+ { XK_Return, "Invio" },
+ { XK_space, "Spaziatrice" }
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_Dutch[] =
+ {
+ { XK_Page_Up, "PageUp" },
+ { XK_Page_Down, "PageDown" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "Rechts" },
+ { XK_Left, "Links" },
+ { XK_Up, "Boven" },
+ { XK_Down, "Onder" },
+ { XK_BackSpace, "Backspace" },
+ { XK_Return, "Return" },
+ { XK_space, "Spatiebalk" }
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_Norwegian[] =
+ {
+ { XK_Shift_L, "Skift" },
+ { XK_Shift_R, "Skift" },
+ { XK_Page_Up, "PageUp" },
+ { XK_Page_Down, "PageDown" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "Hyre" },
+ { XK_Left, "Venstre" },
+ { XK_Up, "Opp" },
+ { XK_Down, "Ned" },
+ { XK_BackSpace, "Tilbake" },
+ { XK_Return, "Enter" }
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_Swedish[] =
+ {
+ { XK_Shift_L, "Skift" },
+ { XK_Shift_R, "Skift" },
+ { XK_Page_Up, "PageUp" },
+ { XK_Page_Down, "PageDown" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "Höger" },
+ { XK_Left, "Vänster" },
+ { XK_Up, "Up" },
+ { XK_Down, "Ned" },
+ { XK_BackSpace, "Backsteg" },
+ { XK_Return, "Retur" },
+ { XK_space, "Blank" }
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_Portuguese[] =
+ {
+ { XK_Page_Up, "PageUp" },
+ { XK_Page_Down, "PageDown" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "Direita" },
+ { XK_Left, "Esquerda" },
+ { XK_Up, "Acima" },
+ { XK_Down, "Abaixo" },
+ { XK_BackSpace, "Rückschritt" },
+ { XK_Return, "Eingabe" },
+ { XK_slash, "Schrägstrich" }
+ };
+
+ static const struct KeysymNameReplacement aImplReplacements_Spanish[] =
+ {
+ { XK_Shift_L, "Mayos" },
+ { XK_Shift_R, "Mayos" },
+ { XK_Page_Up, "RePág" },
+ { XK_Page_Down, "AvPág" },
+ { XK_End, "Fin" },
+ { XK_Home, "Inicio" },
+ { XK_Delete, "Supr" },
+ { XK_Escape, "Esc" },
+ { XK_Right, "Hacia la derecha" },
+ { XK_Left, "Hacia la izquierda" },
+ { XK_Up, "Hacia arriba" },
+ { XK_Down, "Hacia abajo" },
+ { XK_BackSpace, "Ret" },
+ { XK_Return, "Entrada" },
+ { XK_space, "Espacio" },
+ { XK_KP_Enter, "Intro" }
+ };
+
+ static const struct KeyboardReplacements aKeyboards[] =
+ {
+#ifdef SOLARIS
+ { "Germany5", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Germany4", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "France5", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "France6", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "France_x86", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Italy5", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Italy5-Hobo", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Italy4", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Italy6", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Italy_x86", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Netherland4", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Netherland5", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Netherland5-Hobo", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Netherland6", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Netherland_x86", aImplReplacements_Dutch, sizeof(aImplReplacements_Dutch)/sizeof(aImplReplacements_Dutch[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Norway5", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Norway5-Hobo", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Norway4", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Norway6", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Norway_x86", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Portugal5", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Portugal5-Hobo", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Portugal4", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Portugal6", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Portugal_x86", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Spain5", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Spain5-Hobo", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Spain4", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Spain6", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Spain_x86", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Sweden5", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Sweden5-Hobo", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Sweden4", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Sweden6", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Sweden_x86", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+#endif
+ { "German", aImplReplacements_German, sizeof(aImplReplacements_German)/sizeof(aImplReplacements_German[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "French", aImplReplacements_French, sizeof(aImplReplacements_French)/sizeof(aImplReplacements_French[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Norwegian", aImplReplacements_Norwegian, sizeof(aImplReplacements_Norwegian)/sizeof(aImplReplacements_Norwegian[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Swedish", aImplReplacements_Swedish, sizeof(aImplReplacements_Swedish)/sizeof(aImplReplacements_Swedish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Portuguese", aImplReplacements_Portuguese, sizeof(aImplReplacements_Portuguese)/sizeof(aImplReplacements_Portuguese[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Spanish", aImplReplacements_Spanish, sizeof(aImplReplacements_Spanish)/sizeof(aImplReplacements_Spanish[0]), RTL_TEXTENCODING_ISO_8859_1 },
+ { "Italian", aImplReplacements_Italian, sizeof(aImplReplacements_Italian)/sizeof(aImplReplacements_Italian[0]), RTL_TEXTENCODING_ISO_8859_1 }
+ };
+
+ String getKeysymReplacementName( const char* pKeyboard, KeySym nSymbol )
+ {
+ for( int n = 0; n < sizeof(aKeyboards)/sizeof(aKeyboards[0]); n++ )
+ {
+ if( ! strcasecmp( pKeyboard, aKeyboards[n].pKeyboardName ) )
+ {
+ const struct KeysymNameReplacement* pRepl = aKeyboards[n].pReplacements;
+ for( int m = aKeyboards[n].nReplacements ; m ; )
+ {
+ if( nSymbol == pRepl[--m].aSymbol )
+ return String( pRepl[m].pName, aKeyboards[n].nEncoding );
+ }
+ }
+ }
+ return String();
+ }
+
+}
+
+#ifdef SOLARIS
+typedef struct {
+ int n_layout;
+ const char* p_description;
+} keyboard_layout;
+
+static const keyboard_layout type0_layout[] =
+{
+ { 0, "US4" },
+ { -1, NULL }
+};
+
+static const keyboard_layout type3_layout[] =
+{
+ { 0, "US3" },
+ { -1, NULL }
+};
+
+static const keyboard_layout type4_layout[] =
+{
+ { 0, "US4" },
+ { 1, "US4" },
+ { 2, "FranceBelg4" },
+ { 3, "Canada4" },
+ { 4, "Denmark4" },
+ { 5, "Germany4" },
+ { 6, "Italy4" },
+ { 7, "Netherland4" },
+ { 8, "Norway4" },
+ { 9, "Portugal4" },
+ { 10, "SpainLatAm4" },
+ { 11, "SwedenFin4" },
+ { 12, "Switzer_Fr4" },
+ { 13, "Switzer_Ge4" },
+ { 14, "UK4" },
+ { 16, "Korea4" },
+ { 17, "Taiwan4" },
+ { 19, "US101A_PC" },
+ { 19, "US101A_Sun" },
+ { 32, "Japan4" },
+ { 33, "US5" },
+ { 34, "US_UNIX5" },
+ { 35, "France5" },
+ { 36, "Denmark5" },
+ { 37, "Germany5" },
+ { 38, "Italy5" },
+ { 39, "Netherland5" },
+ { 40, "Norway5" },
+ { 41, "Portugal5" },
+ { 42, "Spain5" },
+ { 43, "Sweden5" },
+ { 44, "Switzer_Fr5" },
+ { 45, "Switzer_Ge5" },
+ { 46, "UK5" },
+ { 47, "Korea5" },
+ { 48, "Taiwan5" },
+ { 49, "Japan5" },
+ { 50, "Canada_Fr5" },
+ { 51, "Hungary5" },
+ { 52, "Poland5" },
+ { 53, "Czech5" },
+ { 54, "Russia5" },
+ { 55, "Latvia5" },
+ { 56, "Turkey5" },
+ { 57, "Greece5" },
+ { 58, "Estonia5" },
+ { 59, "Lithuania5" },
+ { 63, "Canada_Fr5_TBITS5" },
+ { 80, "US5_Hobo" },
+ { 81, "US_UNIX5_Hobo" },
+ { 82, "France5_Hobo" },
+ { 83, "Denmark5_Hobo" },
+ { 84, "Germany5_Hobo" },
+ { 85, "Italy5_Hobo" },
+ { 86, "Netherland5_Hobo" },
+ { 87, "Norway5_Hobo" },
+ { 88, "Portugal5_Hobo" },
+ { 89, "Spain5_Hobo" },
+ { 90, "Sweden5_Hobo" },
+ { 91, "Switzer_Fr5_Hobo" },
+ { 92, "Switzer_Ge5_Hobo" },
+ { 93, "UK5_Hobo" },
+ { 94, "Korea5_Hobo" },
+ { 95, "Taiwan5_Hobo" },
+ { 96, "Japan5_Hobo" },
+ { 97, "Canada_Fr5_Hobo" },
+ { -1, NULL }
+};
+
+static const keyboard_layout type101_layout[] =
+{
+ { 0, "US101A_x86" },
+ { 1, "US101A_x86" },
+ { 34, "J3100_x86" },
+ { 35, "France_x86" },
+ { 36, "Denmark_x86" },
+ { 37, "Germany_x86" },
+ { 38, "Italy_x86" },
+ { 39, "Netherland_x86" },
+ { 40, "Norway_x86" },
+ { 41, "Portugal_x86" },
+ { 42, "Spain_x86" },
+ { 43, "Sweden_x86" },
+ { 44, "Switzer_Fr_x86" },
+ { 45, "Switzer_Ge_x86" },
+ { 46, "UK_x86" },
+ { 47, "Korea_x86" },
+ { 48, "Taiwan_x86" },
+ { 49, "Japan_x86" },
+ { 50, "Canada_Fr2_x86" },
+ { 51, "Hungary_x86" },
+ { 52, "Poland_x86" },
+ { 53, "Czech_x86" },
+ { 54, "Russia_x86" },
+ { 55, "Latvia_x86" },
+ { 56, "Turkey_x86" },
+ { 57, "Greece_x86" },
+ { 59, "Lithuania_x86" },
+ { 1001, "MS_US101A_x86" },
+ { -1, NULL }
+};
+
+static const keyboard_layout type6_layout[] =
+{
+ { 0, "US6" },
+ { 6, "Denmark6" },
+ { 7, "Finnish6" },
+ { 8, "France6" },
+ { 9, "Germany6" },
+ { 14, "Italy6" },
+ { 15, "Japan6" },
+ { 16, "Korea6" },
+ { 18, "Netherland6" },
+ { 19, "Norway6" },
+ { 22, "Portugal6" },
+ { 25, "Spain6" },
+ { 26, "Sweden6" },
+ { 27, "Switzer_Fr6" },
+ { 28, "Switzer_Ge6" },
+ { 30, "Taiwan6" },
+ { 32, "UK6" },
+ { 33, "US6" },
+ { -1, NULL }
+};
+#endif
+
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+const char* SalDisplay::GetKeyboardName( BOOL bRefresh )
+{
+ if( bRefresh || ! m_aKeyboardName.Len() )
+ {
+#ifdef SOLARIS
+ if( IsLocal() )
+ {
+ int kbd = open( "/dev/kbd", O_RDONLY );
+ if( kbd >= 0 )
+ {
+ int kbd_type = 0;
+ if( ! ioctl( kbd, KIOCTYPE, &kbd_type ) )
+ {
+ int kbd_layout = 0;
+ if( ! ioctl( kbd, KIOCLAYOUT, &kbd_layout ) )
+ {
+ const keyboard_layout *p_layout = NULL;
+ switch( kbd_type )
+ {
+ case KB_KLUNK: p_layout = type0_layout; break;
+ case KB_SUN3: p_layout = type3_layout; break;
+ case KB_SUN4: p_layout = type4_layout; break;
+ case KB_USB: p_layout = type6_layout; break;
+ case KB_PC: p_layout = type101_layout; break;
+ }
+
+ if( p_layout )
+ {
+ while( p_layout->n_layout != -1 )
+ {
+ if ( p_layout->n_layout == kbd_layout )
+ {
+ m_aKeyboardName = p_layout->p_description;
+ break;
+ }
+ p_layout++;
+ }
+ }
+ }
+ }
+ }
+ }
+#else
+ int opcode, event, error;
+ int major = XkbMajorVersion, minor = XkbMinorVersion;
+ if( ! m_aKeyboardName.Len() &&
+ XSalIsDisplay( GetDisplay() ) &&
+ XkbQueryExtension( GetDisplay(), &opcode, &event,&error, &major, &minor ) )
+ {
+ XkbDescPtr pXkbDesc = NULL;
+ // try X keyboard extension
+ if( pXkbDesc = XkbGetKeyboard( GetDisplay(), XkbAllComponentsMask, XkbUseCoreKbd ) )
+ {
+ const char* pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->groups[0] );
+ m_aKeyboardName = pAtom;
+ XFree( (void*)pAtom );
+
+#ifdef DEBUG
+#define PRINT_ATOM( x ) { if( pXkbDesc->names->x ) { pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->x ); fprintf( stderr, "%s: %s\n", #x, pAtom ); XFree( (void*)pAtom ); } else fprintf( stderr, "%s: <nil>\n", #x ); }
+
+ PRINT_ATOM( keycodes );
+ PRINT_ATOM( geometry );
+ PRINT_ATOM( symbols );
+ PRINT_ATOM( types );
+ PRINT_ATOM( compat );
+ PRINT_ATOM( phys_symbols );
+
+ int i;
+ for( i = 0; i < XkbNumVirtualMods; i++ )
+ PRINT_ATOM( vmods[i] );
+ for( i = 0; i < XkbNumIndicators; i++ )
+ PRINT_ATOM( indicators[i] );
+ for( i = 0; i < XkbNumKbdGroups; i++ )
+ PRINT_ATOM( groups[i] );
+#endif
+ XkbFreeKeyboard( pXkbDesc, 0, True );
+ }
+ }
+#endif
+ }
+ return m_aKeyboardName.GetBuffer();
+}
diff --git a/vcl/unx/source/app/makefile.mk b/vcl/unx/source/app/makefile.mk
new file mode 100644
index 000000000000..c532bcd1a836
--- /dev/null
+++ b/vcl/unx/source/app/makefile.mk
@@ -0,0 +1,142 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salapp
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(OS)"=="MACOSX"
+
+dummy:
+ @echo "Nothing to build for Mac OS X"
+
+.ELSE # "$(OS)"=="MACOSX"
+
+.IF "$(remote)"==""
+OBJFILES=\
+ $(OBJ)$/salmain.obj
+
+SLOFILES=\
+ $(SLO)$/i18n_cb.obj \
+ $(SLO)$/i18n_ic.obj \
+ $(SLO)$/i18n_im.obj \
+ $(SLO)$/i18n_xkb.obj \
+ $(SLO)$/i18n_wrp.obj \
+ $(SLO)$/salmain.obj \
+ $(SLO)$/saldata.obj \
+ $(SLO)$/saltimer.obj \
+ $(SLO)$/saldisp.obj \
+ $(SLO)$/salinst.obj \
+ $(SLO)$/salsound2.obj \
+ $(SLO)$/audioconvert.obj \
+ $(SLO)$/osssound.obj \
+ $(SLO)$/devaudiosound.obj \
+ $(SLO)$/rptpsound.obj \
+ $(SLO)$/nassound.obj \
+ $(SLO)$/salsys.obj \
+ $(SLO)$/soicon.obj \
+ $(SLO)$/sm.obj \
+ $(SLO)$/stacktrace.obj \
+ $(SLO)$/keysymnames.obj
+
+.IF "$(OS)$(CPU)" == "SOLARISS"
+.IF "$(COM)"!="GCC"
+SLOFILES+=$(SLO)$/getfpsols.obj
+.ENDIF # "$(COM)"!="GCC"
+.ELIF "$(OS)$(CPU)" == "SOLARISI"
+SLOFILES+=$(SLO)$/getfpsoli.obj
+.ENDIF
+
+.ELSE
+SLOFILES=\
+ $(SLO)$/salmain.obj
+.ENDIF
+
+.IF "$(remote)"!=""
+EXCEPTIONSFILES=$(SLO)$/salmain.obj \
+ $(OBJ)$/salmain.obj
+.ENDIF
+
+.ENDIF # "$(OS)"=="MACOSX"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+$(SLO)$/getfpsols.obj: getfpsols.s
+ CC -c -o $(SLO)$/getfpsols.o getfpsols.s && touch $(SLO)$/getfpsols.obj
+
+$(SLO)$/getfpsoli.obj: getfpsoli.s
+ CC -c -o $(SLO)$/getfpsoli.o getfpsoli.s && touch $(SLO)$/getfpsoli.obj
+
diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx
new file mode 100644
index 000000000000..4519e75fd56f
--- /dev/null
+++ b/vcl/unx/source/app/saldata.cxx
@@ -0,0 +1,854 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALDATA_CXX
+
+#ifdef USE_XTOOLKIT
+# define SAL_XT
+#endif
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <errno.h>
+#include <pthread.h>
+#include <sys/resource.h>
+#ifdef SUN
+#include <sys/systeminfo.h>
+#endif
+#ifdef AIX
+#include <strings.h>
+#endif
+
+#include <prex.h>
+#include <X11/Shell.h>
+#include <X11/Xproto.h>
+#include <postx.h>
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#include <salunx.h>
+
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _OSL_SIGNAL_H_
+#include <osl/signal.h>
+#endif
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+#ifndef _OSL_PROCESS_H_
+#include <osl/process.h>
+#endif
+
+#include <tools/debug.hxx>
+
+#ifndef _SAL_I18N_INPUTMETHOD_HXX
+#include "i18n_im.hxx"
+#endif
+#ifndef _SAL_I18N_XKBDEXTENSION_HXX
+#include "i18n_xkb.hxx"
+#endif
+
+// -=-= <signal.h> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef UNX
+#ifndef SIGBUS
+#define SIGBUS 10
+#endif
+#ifndef SIGSEGV
+#define SIGSEGV 11
+#endif
+#ifndef SIGIOT
+#define SIGIOT SIGABRT
+#endif
+#endif
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+static const struct timeval noyield = { 0, 0 };
+static const struct timeval yield = { 0, 10000 };
+static const struct fd_set ZeroFDS = { 0 };
+static const char* XRequest[] = {
+ // see /usr/lib/X11/XErrorDB, /usr/openwin/lib/XErrorDB ...
+ NULL,
+ "X_CreateWindow",
+ "X_ChangeWindowAttributes",
+ "X_GetWindowAttributes",
+ "X_DestroyWindow",
+ "X_DestroySubwindows",
+ "X_ChangeSaveSet",
+ "X_ReparentWindow",
+ "X_MapWindow",
+ "X_MapSubwindows",
+ "X_UnmapWindow",
+ "X_UnmapSubwindows",
+ "X_ConfigureWindow",
+ "X_CirculateWindow",
+ "X_GetGeometry",
+ "X_QueryTree",
+ "X_InternAtom",
+ "X_GetAtomName",
+ "X_ChangeProperty",
+ "X_DeleteProperty",
+ "X_GetProperty",
+ "X_ListProperties",
+ "X_SetSelectionOwner",
+ "X_GetSelectionOwner",
+ "X_ConvertSelection",
+ "X_SendEvent",
+ "X_GrabPointer",
+ "X_UngrabPointer",
+ "X_GrabButton",
+ "X_UngrabButton",
+ "X_ChangeActivePointerGrab",
+ "X_GrabKeyboard",
+ "X_UngrabKeyboard",
+ "X_GrabKey",
+ "X_UngrabKey",
+ "X_AllowEvents",
+ "X_GrabServer",
+ "X_UngrabServer",
+ "X_QueryPointer",
+ "X_GetMotionEvents",
+ "X_TranslateCoords",
+ "X_WarpPointer",
+ "X_SetInputFocus",
+ "X_GetInputFocus",
+ "X_QueryKeymap",
+ "X_OpenFont",
+ "X_CloseFont",
+ "X_QueryFont",
+ "X_QueryTextExtents",
+ "X_ListFonts",
+ "X_ListFontsWithInfo",
+ "X_SetFontPath",
+ "X_GetFontPath",
+ "X_CreatePixmap",
+ "X_FreePixmap",
+ "X_CreateGC",
+ "X_ChangeGC",
+ "X_CopyGC",
+ "X_SetDashes",
+ "X_SetClipRectangles",
+ "X_FreeGC",
+ "X_ClearArea",
+ "X_CopyArea",
+ "X_CopyPlane",
+ "X_PolyPoint",
+ "X_PolyLine",
+ "X_PolySegment",
+ "X_PolyRectangle",
+ "X_PolyArc",
+ "X_FillPoly",
+ "X_PolyFillRectangle",
+ "X_PolyFillArc",
+ "X_PutImage",
+ "X_GetImage",
+ "X_PolyText8",
+ "X_PolyText16",
+ "X_ImageText8",
+ "X_ImageText16",
+ "X_CreateColormap",
+ "X_FreeColormap",
+ "X_CopyColormapAndFree",
+ "X_InstallColormap",
+ "X_UninstallColormap",
+ "X_ListInstalledColormaps",
+ "X_AllocColor",
+ "X_AllocNamedColor",
+ "X_AllocColorCells",
+ "X_AllocColorPlanes",
+ "X_FreeColors",
+ "X_StoreColors",
+ "X_StoreNamedColor",
+ "X_QueryColors",
+ "X_LookupColor",
+ "X_CreateCursor",
+ "X_CreateGlyphCursor",
+ "X_FreeCursor",
+ "X_RecolorCursor",
+ "X_QueryBestSize",
+ "X_QueryExtension",
+ "X_ListExtensions",
+ "X_ChangeKeyboardMapping",
+ "X_GetKeyboardMapping",
+ "X_ChangeKeyboardControl",
+ "X_GetKeyboardControl",
+ "X_Bell",
+ "X_ChangePointerControl",
+ "X_GetPointerControl",
+ "X_SetScreenSaver",
+ "X_GetScreenSaver",
+ "X_ChangeHosts",
+ "X_ListHosts",
+ "X_SetAccessControl",
+ "X_SetCloseDownMode",
+ "X_KillClient",
+ "X_RotateProperties",
+ "X_ForceScreenSaver",
+ "X_SetPointerMapping",
+ "X_GetPointerMapping",
+ "X_SetModifierMapping",
+ "X_GetModifierMapping",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "X_NoOperation"
+};
+
+BEGIN_C
+// -=-= C statics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+
+static oslSignalAction SalSignalHdl (void* pData, oslSignalInfo* pInfo)
+{
+ ULONG nException = 0;
+
+ switch (pInfo->Signal)
+ {
+ case osl_Signal_System :
+ return osl_Signal_ActCallNextHdl;
+ case osl_Signal_Terminate :
+ if (!GetSalData()->Close())
+ return osl_Signal_ActIgnore;
+ break;
+ case osl_Signal_User :
+ return osl_Signal_ActCallNextHdl;
+ default: break;
+ }
+
+ return osl_Signal_ActAbortApp;
+}
+
+
+final static int sal_XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
+{
+ GetSalData()->XError( pDisplay, pEvent );
+ return 0;
+}
+
+final static int sal_XIOErrorHdl( Display *pDisplay )
+{
+ SalData *pSalData = GetSalData();
+ SalDisplay *pSalDisplay = pSalData->GetDisplay( pDisplay );
+ if ( pDisplay && pSalDisplay->IsDisplay() )
+ pSalData->GetLib()->Remove( ConnectionNumber( pDisplay ) );
+
+ oslSignalAction eToDo = osl_raiseSignal (OSL_SIGNAL_USER_X11SUBSYSTEMERROR, NULL);
+ // einen XIOError kann man nicht ignorieren. Die Connection ist
+ // zusammengebrochen, hier kann man nur noch halbwegs sinnvoll runterfahren
+
+ fprintf( stderr, "X IO Error\n" );
+ fflush( stdout );
+ fflush( stderr );
+ exit(0);
+ return 0;
+}
+
+final static void sal_XtErrorHdl( XLIB_String sMsg )
+{
+#ifdef DBG_UTIL
+ fprintf( stderr, "X Toolkit Error: %s\n", sMsg );
+#endif
+ fflush( stdout );
+ fflush( stderr );
+ abort();
+}
+
+final static void sal_XtWarningHdl( XLIB_String sMsg )
+{
+#ifdef DBG_UTIL
+ fprintf( stderr, "X Toolkit Warning: %s\n", sMsg );
+ fflush( stdout );
+ fflush( stderr );
+#endif
+}
+
+END_C
+
+// -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <pthread.h>
+
+final SalData::SalData()
+{
+ argv_ = 0;
+ argc_ = 0;
+
+ pTimerProc_ = 0;
+
+ memset( sig_, 0, sizeof( sig_ ) ); // SIG_DFL
+ bNoExceptions_ = !!getenv( "SAL_NOSEGV" );
+
+ pXLib_ = new SalXLib();
+ pDefDisp_ = 0;
+ pCurDisp_ = 0;
+
+ hMainThread_ = pthread_self();
+
+ pFirstInstance_ = NULL;
+ pFirstFrame_ = NULL;
+}
+
+final SalData::~SalData()
+{
+ delete pXLib_;
+}
+
+final long SalData::Close() const
+{
+ signal( SIGTERM, sig_[SIGTERM] );
+ if( !pFirstFrame_ )
+ return 1;
+
+ SalFrame *pFrame = pFirstFrame_;
+ while( pFrame )
+ {
+ if( !pFrame->maFrameData.Close() )
+ return 0;
+ pFrame = pFrame->maFrameData.GetNextFrame();
+ }
+ return 1;
+}
+
+final long SalData::ShutDown() const
+{
+ if( !pFirstFrame_ )
+ return 1;
+
+ SalFrame *pFrame = pFirstFrame_;
+ while( pFrame )
+ {
+ if( !pFrame->maFrameData.ShutDown() )
+ return 0;
+ pFrame = pFrame->maFrameData.GetNextFrame();
+ }
+ return 1;
+}
+
+final XubString SalData::GetCommandLineParam( USHORT nParam ) const
+{
+ if( !nParam ) { return aBinaryPath_; }
+ if( nParam >= argc_ ) return String();
+ return String( argv_[nParam], gsl_getSystemTextEncoding() );
+}
+
+final SalDisplay *SalData::GetDisplay( Display *pDisplay )
+{
+ SalDisplay *pSalDisplay = SalDisplays_.First();
+ while( pSalDisplay && pSalDisplay->GetDisplay() != pDisplay )
+ pSalDisplay = SalDisplays_.Next();
+ return pSalDisplay;
+}
+
+void SalData::Init( int *pArgc, char *ppArgv[] )
+{
+ // Pfad zum Executable bestimmen
+ char aFilePath[ PATH_MAX ];
+ ::rtl::OUString aPath;
+ osl_getExecutableFile( &aPath.pData );
+
+ aBinaryPath_ = aPath;
+
+ pXLib_->Init( pArgc, ppArgv );
+
+ argc_ = *pArgc;
+ argv_ = ppArgv;
+}
+
+
+// -=-= SalXLib =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalXLib::SalXLib()
+{
+ pApplicationContext_ = NULL;
+ Timeout_.tv_sec = 0;
+ Timeout_.tv_usec = 0;
+ nTimeoutMS_ = 0;
+ bWasXError_ = FALSE;
+ bIgnoreXErrors_ = !!getenv( "SAL_IGNOREXERRORS" );
+ nStateOfYield_ = 0;
+ nFDs_ = 0;
+ pReadFDS_ = new fd_set;
+ pExceptionFDS_ = new fd_set;
+ FD_ZERO( pReadFDS_ );
+ FD_ZERO( pExceptionFDS_ );
+}
+
+final SalXLib::~SalXLib()
+{
+ delete pReadFDS_;
+ delete pExceptionFDS_;
+
+// completetly disabled Bug Nr. #47319 -> segv while using xsuntransport=shmem
+// #ifdef SAL_XT
+// XtDestroyApplicationContext( pApplicationContext_ );
+// #endif
+}
+
+static char sDISPLAY___[30];
+final void SalXLib::Init( int *pArgc, char *ppArgv[] )
+{
+ SalData *pSalData = GetSalData();
+ SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
+
+ pInputMethod->SetLocale();
+
+ if( !getenv( "DISPLAY" ) )
+ putenv( "DISPLAY=:0" );
+
+ XtSetLanguageProc( NULL, NULL, NULL );
+ XtToolkitInitialize();
+ XrmInitialize();
+ pApplicationContext_ = XtCreateApplicationContext();
+
+ Display *pDisp = XtOpenDisplay( pApplicationContext_,
+ NULL,
+ NULL,
+ "VCL",
+ NULL,
+ 0,
+ pArgc,
+ ppArgv );
+
+ if( !pDisp )
+ {
+ char *pDisplayString = getenv ("DISPLAY");
+
+ fprintf( stderr, "%s: cannot open display \"%s\"\n",
+ ppArgv[0],
+ pDisplayString ? pDisplayString : ":0.0" );
+ fprintf( stderr, "Please check your \"DISPLAY\" environment variable, as well as the permissions to access that display ");
+ fprintf( stderr, "(See \"man X\" resp. \"man xhost\" for details)\n");
+ fflush ( stderr );
+ exit (0);
+ }
+
+ XVisualInfo aVI;
+ Colormap aColMap;
+ int nScreen = DefaultScreen( pDisp );
+
+ if( SalDisplay::BestVisual( pDisp, nScreen, aVI ) ) // DefaultVisual
+ aColMap = DefaultColormap( pDisp, nScreen );
+ else
+ aColMap = XCreateColormap( pDisp,
+ RootWindow( pDisp, nScreen ),
+ aVI.visual,
+ AllocNone );
+
+ Arg aArgs[10];
+ int nArgs = 0;
+ XtSetArg( aArgs[nArgs], XtNvisual, aVI.visual ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNdepth, aVI.depth ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNcolormap, aColMap ); nArgs++;
+
+ Widget wInitWidget = XtAppCreateShell( NULL,
+ "SAL",
+ applicationShellWidgetClass,
+ pDisp,
+ aArgs, nArgs );
+
+
+ XSetIOErrorHandler ( (XIOErrorHandler)sal_XIOErrorHdl );
+ XSetErrorHandler ( (XErrorHandler)sal_XErrorHdl );
+
+ XtAppSetErrorHandler ( GetAppContext(),
+ (XtErrorHandler)sal_XtErrorHdl );
+ XtAppSetWarningHandler( GetAppContext(),
+ (XtErrorHandler)sal_XtWarningHdl );
+
+ SalDisplay *pSalDisplay = new SalDisplay( wInitWidget );
+
+ pInputMethod->CreateMethod( pDisp );
+ pSalDisplay->SetInputMethod( pInputMethod );
+
+ sal_Bool bOldErrorSetting = GetIgnoreXErrors();
+ SetIgnoreXErrors( True );
+ SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
+ XSync( pDisp, False );
+
+ pKbdExtension->UseExtension( ! WasXError() );
+ SetIgnoreXErrors( bOldErrorSetting );
+
+ pSalDisplay->SetKbdExtension( pKbdExtension );
+
+#if 0 // ! USE_XTOOLKIT
+
+ SalDisplay *pSalDisplay = new SalDisplay( pDisp, aVI.visual, aColMap );
+
+#endif
+}
+
+extern "C" {
+void EmitFontpathWarning( void )
+{
+ static Bool bOnce = False;
+ if ( !bOnce )
+ {
+ bOnce = True;
+ fprintf( stderr, "Please verify your fontpath settings\n"
+ "\t(See \"man xset\" for details"
+ " or ask your system administrator)\n" );
+ }
+}
+
+} /* extern "C" */
+
+final void SalXLib::XError( Display *pDisplay, XErrorEvent *pEvent )
+{
+ char msg[ 120 ];
+
+ if( ! bIgnoreXErrors_ )
+ {
+#if defined DEBUG || defined DBG_UTIL
+ XGetErrorText( pDisplay, pEvent->error_code, msg, sizeof( msg ) );
+ fprintf( stderr, "X-Error: %s\n", msg );
+ if( pEvent->request_code > capacityof( XRequest ) )
+ fprintf( stderr, "\tMajor opcode: %d (Shm?)\n", pEvent->request_code );
+ else if( XRequest[pEvent->request_code] )
+ fprintf( stderr, "\tMajor opcode: %d (%s)\n",
+ pEvent->request_code, XRequest[pEvent->request_code] );
+ else
+ fprintf( stderr, "\tMajor opcode: %d (BadRequest?)\n", pEvent->request_code );
+ fprintf( stderr, "\tResource ID: 0x%lx\n",
+ pEvent->resourceid );
+ fprintf( stderr, "\tSerial No: %ld (%ld)\n",
+ pEvent->serial, LastKnownRequestProcessed(pDisplay) );
+
+ fflush( stdout );
+ fflush( stderr );
+#endif
+
+ oslSignalAction eToDo = osl_raiseSignal (OSL_SIGNAL_USER_X11SUBSYSTEMERROR, NULL);
+ switch (eToDo)
+ {
+ case osl_Signal_ActIgnore :
+ return;
+ case osl_Signal_ActAbortApp :
+ abort();
+ case osl_Signal_ActKillApp :
+ exit(0);
+ case osl_Signal_ActCallNextHdl :
+ break;
+ default :
+ break;
+ }
+
+ if ( (pEvent->error_code == BadAlloc)
+ && (pEvent->request_code == X_OpenFont) )
+ {
+ static Bool bOnce = False;
+ if ( !bOnce )
+ {
+ fprintf(stderr, "X-Error occured in a request for X_OpenFont\n");
+ EmitFontpathWarning();
+
+ bOnce = True ;
+ }
+ }
+ else
+ {
+ abort();
+ }
+ }
+
+ bWasXError_ = TRUE;
+}
+
+#define MAX_NUM_DESCRIPTORS 128
+
+struct YieldEntry
+{
+ YieldEntry* next; // pointer to next entry
+ int fd; // file descriptor for reading
+ void* data; // data for predicate and callback
+ YieldFunc pending; // predicate (determins pending events)
+ YieldFunc queued; // read and queue up events
+ YieldFunc handle; // handle pending events
+
+ inline int HasPendingEvent() const { return pending( fd, data ); }
+ inline int IsEventQueued() const { return queued( fd, data ); }
+ inline void HandleNextEvent() const { handle( fd, data ); }
+};
+
+#define MAX_NUM_DESCRIPTORS 128
+
+static YieldEntry yieldTable[ MAX_NUM_DESCRIPTORS ];
+
+void SalXLib::Insert( int nFD, void* data,
+ YieldFunc pending,
+ YieldFunc queued,
+ YieldFunc handle )
+{
+ DBG_ASSERT( nFD, "can not insert stdin descriptor" )
+ DBG_ASSERT( !yieldTable[nFD].fd, "SalXLib::Insert fd twice" )
+
+ yieldTable[nFD].fd = nFD;
+ yieldTable[nFD].data = data;
+ yieldTable[nFD].pending = pending;
+ yieldTable[nFD].queued = queued;
+ yieldTable[nFD].handle = handle;
+
+ FD_SET( nFD, pReadFDS_ );
+ FD_SET( nFD, pExceptionFDS_ );
+
+ if( nFD >= nFDs_ )
+ nFDs_ = nFD + 1;
+}
+
+void SalXLib::Remove( int nFD )
+{
+ FD_CLR( nFD, pReadFDS_ );
+ FD_CLR( nFD, pExceptionFDS_ );
+
+ yieldTable[nFD].fd = 0;
+
+ if ( nFD == nFDs_ )
+ {
+ for ( nFD = nFDs_ - 1;
+ nFD >= 0 && !yieldTable[nFD].fd;
+ nFD-- );
+
+ nFDs_ = nFD + 1;
+ }
+}
+
+class YieldMutexReleaser
+{
+ ULONG m_nYieldCount;
+ SalYieldMutex* m_pSalInstYieldMutex;
+public:
+ YieldMutexReleaser();
+ ~YieldMutexReleaser();
+};
+
+YieldMutexReleaser::YieldMutexReleaser()
+{
+ SalData *pSalData = GetSalData();
+ m_pSalInstYieldMutex =
+ pSalData->pFirstInstance_->maInstData.mpSalYieldMutex;
+
+ ULONG i;
+ if ( m_pSalInstYieldMutex->GetThreadId() ==
+ NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ m_nYieldCount = m_pSalInstYieldMutex->GetAcquireCount();
+ for ( i = 0; i < m_nYieldCount; i++ )
+ m_pSalInstYieldMutex->release();
+ }
+ else
+ m_nYieldCount = 0;
+}
+
+YieldMutexReleaser::~YieldMutexReleaser()
+{
+ // Yield-Semaphore wieder holen
+ while ( m_nYieldCount )
+ {
+ m_pSalInstYieldMutex->acquire();
+ m_nYieldCount--;
+ }
+}
+
+final void SalXLib::Yield( BOOL bWait )
+{
+ fd_set ReadFDS;
+ fd_set ExceptionFDS;
+ int nFound = 0;
+
+ nStateOfYield_ = 0; // is not 0 if we are recursive called
+
+ // first look for queued events
+ for ( int nFD = 0; nFD < nFDs_; nFD++ )
+ {
+ YieldEntry* pEntry = &(yieldTable[nFD]);
+ if ( pEntry->fd )
+ {
+ DBG_ASSERT( nFD == pEntry->fd, "wrong fd in Yield()" );
+
+ if ( pEntry->HasPendingEvent() )
+ {
+ pEntry->HandleNextEvent();
+ // #63862# da jetzt alle user-events ueber die interne
+ // queue kommen, wird die Kontrolle analog zum select
+ // gesteuerten Zweig einmal bei bWait abgegeben
+ YieldMutexReleaser aReleaser;
+ if ( bWait )
+ osl_yieldThread();
+ return;
+ }
+ }
+ }
+
+ // next select with or without timeout according to bWait
+
+ ReadFDS = *pReadFDS_;
+ ExceptionFDS = *pExceptionFDS_;
+
+ struct timeval Timeout;
+ Timeout = bWait ? yield : noyield;
+
+ nStateOfYield_ = 1;
+
+ {
+ // Yield-Semaphore freigeben
+ YieldMutexReleaser aReleaser;
+ if( bWait )
+ osl_yieldThread();
+#if defined (HPUX) && defined (CMA_UX)
+ nFound = select( nFDs_, (int*)&ReadFDS, (int*)NULL,
+ (int*)&ExceptionFDS, &Timeout );
+#else
+ nFound = select( nFDs_, &ReadFDS, NULL, &ExceptionFDS, &Timeout );
+#endif
+ }
+ if( nFound < 0 ) // error
+ {
+#ifdef DBG_UTIL
+ fprintf( stderr, "SalXLib::Yield s=%d e=%d f=%d\n",
+ nStateOfYield_, errno, nFound );
+#endif
+ nStateOfYield_ = 0;
+ if( EINTR == errno )
+ {
+ errno = 0;
+ }
+ }
+
+ // check for timeouts
+ if( Timeout_.tv_sec ) // timer is started
+ {
+ gettimeofday( &Timeout, NULL );
+
+ if( Timeout >= Timeout_ )
+ {
+ Timeout_ = Timeout + nTimeoutMS_;
+ GetSalData()->Timeout();
+ }
+ }
+
+ // handle events
+ if( nFound > 0 )
+ {
+ // now we are in the protected section !
+ // recall select if we have acquired fd's, ready for reading,
+
+ struct timeval noTimeout = { 0, 0 };
+ nFound = select( nFDs_, &ReadFDS, NULL,
+ &ExceptionFDS, &noTimeout );
+
+ // someone-else has done the job for us
+ if (nFound == 0)
+ {
+ nStateOfYield_ = 0;
+ //if ( !pthread_equal (pthread_self(),
+ // pSalData->GetMainThread()))
+ return;
+ }
+
+ for ( int nFD = 0; nFD < nFDs_; nFD++ )
+ {
+ YieldEntry* pEntry = &(yieldTable[nFD]);
+ if ( pEntry->fd )
+ {
+ if ( FD_ISSET( nFD, &ExceptionFDS ) ) {
+#if defined DEBUG
+ fprintf( stderr, "SalXLib::Yield exception\n" );
+#endif
+ nFound--;
+ }
+ if ( FD_ISSET( nFD, &ReadFDS ) )
+ {
+ nStateOfYield_ = 3;
+ if ( pEntry->IsEventQueued() )
+ {
+ nStateOfYield_ = 4;
+ pEntry->HandleNextEvent();
+ // if a recursive call has done the job
+ // so abort here
+ if ( nStateOfYield_ != 4 )
+ break;
+ }
+ nFound--;
+ }
+ }
+ }
+ }
+ nStateOfYield_ = 0;
+}
+
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
new file mode 100644
index 000000000000..5c7ca51b0a6b
--- /dev/null
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -0,0 +1,3653 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldisp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALDISP_CXX
+
+#define SAL_XT
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <string.h>
+
+#ifdef __SunOS_5_5_1
+extern "C" { int gethostname(char*,int); }
+#endif
+
+#include <prex.h>
+#include <X11/cursorfont.h>
+#include "nodrop_curs.h"
+#include "nodrop_mask.h"
+#include "wait_curs.h"
+#include "wait_mask.h"
+#include "hsplit_curs.h"
+#include "hsplit_mask.h"
+#include "vsplit_curs.h"
+#include "vsplit_mask.h"
+#include "neswsize_curs.h"
+#include "neswsize_mask.h"
+#include "nwsesize_curs.h"
+#include "nwsesize_mask.h"
+#include "magnify_curs.h"
+#include "magnify_mask.h"
+#include "rotate_curs.h"
+#include "rotate_mask.h"
+#include "hshear_curs.h"
+#include "hshear_mask.h"
+#include "vshear_curs.h"
+#include "vshear_mask.h"
+#include "drawline_curs.h"
+#include "drawline_mask.h"
+#include "drawrect_curs.h"
+#include "drawrect_mask.h"
+#include "drawpolygon_curs.h"
+#include "drawpolygon_mask.h"
+#include "drawbezier_curs.h"
+#include "drawbezier_mask.h"
+#include "drawarc_curs.h"
+#include "drawarc_mask.h"
+#include "drawpie_curs.h"
+#include "drawpie_mask.h"
+#include "drawcirclecut_curs.h"
+#include "drawcirclecut_mask.h"
+#include "drawellipse_curs.h"
+#include "drawellipse_mask.h"
+#include "drawconnect_curs.h"
+#include "drawconnect_mask.h"
+#include "drawtext_curs.h"
+#include "drawtext_mask.h"
+#include "mirror_curs.h"
+#include "mirror_mask.h"
+#include "crook_curs.h"
+#include "crook_mask.h"
+#include "crop_curs.h"
+#include "crop_mask.h"
+#include "move_curs.h"
+#include "move_mask.h"
+#include "movepoint_curs.h"
+#include "movepoint_mask.h"
+#include "movebezierweight_curs.h"
+#include "movebezierweight_mask.h"
+#include "drawfreehand_curs.h"
+#include "drawfreehand_mask.h"
+#include "drawcaption_curs.h"
+#include "drawcaption_mask.h"
+#include "movedata_curs.h"
+#include "movedata_mask.h"
+#include "copydata_curs.h"
+#include "copydata_mask.h"
+#include "linkdata_curs.h"
+#include "linkdata_mask.h"
+#include "movedlnk_curs.h"
+#include "movedlnk_mask.h"
+#include "copydlnk_curs.h"
+#include "copydlnk_mask.h"
+#include "movefile_curs.h"
+#include "movefile_mask.h"
+#include "copyfile_curs.h"
+#include "copyfile_mask.h"
+#include "linkfile_curs.h"
+#include "linkfile_mask.h"
+#include "moveflnk_curs.h"
+#include "moveflnk_mask.h"
+#include "copyflnk_curs.h"
+#include "copyflnk_mask.h"
+#include "movefiles_curs.h"
+#include "movefiles_mask.h"
+#include "copyfiles_curs.h"
+#include "copyfiles_mask.h"
+
+#include "chart_curs.h"
+#include "chart_mask.h"
+#include "detective_curs.h"
+#include "detective_mask.h"
+#include "pivotcol_curs.h"
+#include "pivotcol_mask.h"
+#include "pivotfld_curs.h"
+#include "pivotfld_mask.h"
+#include "pivotrow_curs.h"
+#include "pivotrow_mask.h"
+
+#include "chain_curs.h"
+#include "chain_mask.h"
+#include "chainnot_curs.h"
+#include "chainnot_mask.h"
+
+#include "timemove_curs.h"
+#include "timemove_mask.h"
+#include "timesize_curs.h"
+#include "timesize_mask.h"
+
+#include "ase_curs.h"
+#include "ase_mask.h"
+#include "asn_curs.h"
+#include "asn_mask.h"
+#include "asne_curs.h"
+#include "asne_mask.h"
+#include "asns_curs.h"
+#include "asns_mask.h"
+#include "asnswe_curs.h"
+#include "asnswe_mask.h"
+#include "asnw_curs.h"
+#include "asnw_mask.h"
+#include "ass_curs.h"
+#include "ass_mask.h"
+#include "asse_curs.h"
+#include "asse_mask.h"
+#include "assw_curs.h"
+#include "assw_mask.h"
+#include "asw_curs.h"
+#include "asw_mask.h"
+#include "aswe_curs.h"
+#include "aswe_mask.h"
+#include "null_curs.h"
+#include "null_mask.h"
+
+#include "airbrush_curs.h"
+#include "airbrush_mask.h"
+#include "fill_curs.h"
+#include "fill_mask.h"
+
+#include "invert50.h"
+#if !(defined S390 || defined AIX)
+#include <X11/extensions/XShm.h>
+#endif
+#include <X11/keysym.h>
+
+#ifdef USE_XMU
+#include <X11/Xmu/Atoms.h>
+#include <X11/Xmu/SysUtil.h>
+#endif
+#include <X11/Xatom.h>
+#include <postx.h>
+
+#include <salunx.h>
+
+#ifndef _SAL_I18N_INPUTMETHOD_HXX
+#include "i18n_im.hxx"
+#endif
+#ifndef _SAL_I18N_XKBDEXTENSION_HXX
+#include "i18n_xkb.hxx"
+#endif
+
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_KEYCODES_HXX
+#include <keycodes.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _SV_DTINT_HXX
+#include <dtint.hxx>
+#endif
+#ifndef _SV_SALOGL_HXX
+#include <salogl.hxx>
+#endif
+#ifndef _OSL_THREADMUTEX_H_
+#include <osl/mutex.h>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+#ifndef _VCL_SM_HXX
+#include <sm.hxx>
+#endif
+
+#include <osl/socket.h>
+#include <rtl/ustring>
+
+// -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define PSEUDOCOLOR12
+#define PSEUDOCOLOR8
+#define TRUECOLOR24
+#define TRUECOLOR16
+#define TRUECOLOR15
+#define TRUECOLOR12
+#define TRUECOLOR8
+
+#define SALCOLOR_WHITE MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF )
+#define SALCOLOR_BLACK MAKE_SALCOLOR( 0x00, 0x00, 0x00 )
+
+// -=-= Prototyps =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+EXTERN_C int XShmGetEventBase( Display* );
+
+// -=-= static variables -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+static const char* const VisualClassName[] = {
+ "StaticGray",
+ "GrayScale",
+ "StaticColor",
+ "PseudoColor",
+ "TrueColor",
+ "DirectColor"
+};
+
+static const char* const AtomStrings[] =
+{
+ "WM_PROTOCOLS", // window manager
+ "WM_STATE",
+ "WM_DELETE_WINDOW",
+ "WM_SAVE_YOURSELF",
+ "WM_COMMAND",
+
+ "SAL_QUITEVENT", // client message events
+ "SAL_USEREVENT",
+};
+
+static const char* const EventNames[] =
+{
+ NULL,
+ NULL,
+ "KeyPress",
+ "KeyRelease",
+ "ButtonPress",
+ "ButtonRelease",
+ "MotionNotify",
+ "EnterNotify",
+ "LeaveNotify",
+ "FocusIn",
+ "FocusOut",
+ "KeymapNotify",
+ "Expose",
+ "GraphicsExpose",
+ "NoExpose",
+ "VisibilityNotify",
+ "CreateNotify",
+ "DestroyNotify",
+ "UnmapNotify",
+ "MapNotify",
+ "MapRequest",
+ "ReparentNotify",
+ "ConfigureNotify",
+ "ConfigureRequest",
+ "GravityNotify",
+ "ResizeRequest",
+ "CirculateNotify",
+ "CirculateRequest",
+ "PropertyNotify",
+ "SelectionClear",
+ "SelectionRequest",
+ "SelectionNotify",
+ "ColormapNotify",
+ "ClientMessage",
+ "MappingNotify"
+};
+
+static UINT32 nIn___, nOut___;
+
+// -=-= global inline =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline const char *Null( const char *p ) { return p ? p : ""; }
+inline const char *GetEnv( const char *p ) { return Null( getenv( p ) ); }
+inline const char *KeyStr( KeySym n ) { return Null( XKeysymToString( n ) ); }
+
+#ifdef USE_XMU
+final inline const char *GetAtomName( Display *d, Atom a )
+{ return Null( XmuGetAtomName( d, a ) ); }
+#else
+final inline const char *GetAtomName( Display *d, Atom a )
+{ return Null( XGetAtomName( d, a ) ); }
+#endif
+
+final inline double Hypothenuse( long w, long h )
+{ return sqrt( (w*w)+(h*h) ); }
+
+final inline int ColorDiff( int r, int g, int b )
+{ return (r*r)+(g*g)+(b*b); }
+
+final inline int ColorDiff( SalColor c1, int r, int g, int b )
+{ return ColorDiff( (int)SALCOLOR_RED (c1)-r,
+ (int)SALCOLOR_GREEN(c1)-g,
+ (int)SALCOLOR_BLUE (c1)-b ); }
+
+// -=-= global functions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+static int sal_Shift( Pixel nMask )
+{
+ int i = 24;
+ if( nMask < 0x00010000 ) { nMask <<= 16; i -= 16; }
+ if( nMask < 0x01000000 ) { nMask <<= 8; i -= 8; }
+ if( nMask < 0x10000000 ) { nMask <<= 4; i -= 4; }
+ if( nMask < 0x40000000 ) { nMask <<= 2; i -= 2; }
+ if( nMask < 0x80000000 ) { nMask <<= 1; i -= 1; }
+ return i;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+static BOOL sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI )
+{
+ int nInfos;
+ XVisualInfo aTemplate;
+ XVisualInfo*pInfos;
+
+ aTemplate.visualid = nVID;
+
+ pInfos = XGetVisualInfo( pDisplay, VisualIDMask, &aTemplate, &nInfos );
+ if( !pInfos )
+ return FALSE;
+
+ rVI = *pInfos;
+ XFree( pInfos );
+
+ DBG_ASSERT( rVI.visualid == nVID,
+ "sal_GetVisualInfo: could not get correct visual by visualId" )
+ return TRUE;
+}
+
+// ---------------------------------------------------------------------------
+
+// check wether displaystring is in format N.M or N. or just N
+// with N and M beeing natural numbers
+static BOOL
+sal_IsDisplayNumber( const char *pDisplayString )
+{
+ if ( ! isdigit(*pDisplayString) )
+ return FALSE;
+ while ( isdigit(*(++pDisplayString)) )
+ ; /* do nothing */
+
+ if ( *pDisplayString == '.' )
+ {
+ while ( isdigit(*(++pDisplayString)) )
+ ; /* do nothing */
+ }
+
+ return (*pDisplayString == '\0');
+}
+
+// check whether host1 and host2 point to the same ip address
+static BOOL
+sal_EqualHosts( const ::rtl::OUString& Host1, const ::rtl::OUString& Host2)
+{
+ oslSocketAddr pHostAddr1;
+ oslSocketAddr pHostAddr2;
+ BOOL bEqualAddress;
+
+ if ( Host1.toChar() >= '0' && Host1.toChar() <= '9' )
+ pHostAddr1 = osl_createInetSocketAddr( Host1.pData, 0 );
+ else
+ pHostAddr1 = osl_resolveHostname( Host1.pData );
+
+ if ( Host2.toChar() >= '0' && Host2.toChar() <= '9' )
+ pHostAddr2 = osl_createInetSocketAddr( Host2.pData, 0 );
+ else
+ pHostAddr2 = osl_resolveHostname( Host2.pData );
+
+ bEqualAddress = osl_isEqualSocketAddr( pHostAddr1, pHostAddr2 ) ? TRUE : FALSE;
+
+ osl_destroySocketAddr( pHostAddr1 );
+ osl_destroySocketAddr( pHostAddr2 );
+
+ return bEqualAddress;
+}
+
+static BOOL
+sal_IsLocalDisplay( Display *pDisplay )
+{
+ const char *pDisplayString = DisplayString( pDisplay );
+
+ // no string, no idea
+ if ( pDisplayString == NULL || pDisplayString[ 0 ] == '\0')
+ return FALSE;
+
+ // check for ":x.y"
+ if ( pDisplayString[ 0 ] == ':' )
+ return sal_IsDisplayNumber( pDisplayString + 1 );
+
+ // check for fixed token which all mean localhost:x.y
+ const char pLocal[] = "localhost:";
+ const int nLocalLen = sizeof(pLocal) - 1;
+ if ( strncmp(pDisplayString, pLocal, nLocalLen) == 0 )
+ return sal_IsDisplayNumber( pDisplayString + nLocalLen );
+
+ const char pUnix[] = "unix:";
+ const int nUnixLen = sizeof(pUnix) - 1;
+ if ( strncmp(pDisplayString, pUnix, nUnixLen) == 0 )
+ return sal_IsDisplayNumber( pDisplayString + nUnixLen );
+
+ const char pLoopback[] = "127.0.0.1:";
+ const int nLoopbackLen= sizeof(pLoopback) - 1;
+ if ( strncmp(pDisplayString, pLoopback, nLoopbackLen) == 0 )
+ return sal_IsDisplayNumber( pDisplayString + nLoopbackLen );
+
+ // compare local hostname to displaystring, both may be ip address or
+ // hostname
+ BOOL bEqual = FALSE;
+ char *pDisplayHost = strdup( pDisplayString );
+ char *pPtr = strrchr( pDisplayHost, ':' );
+
+ if( pPtr != NULL )
+ {
+ ::rtl::OUString aLocalHostname;
+ if( osl_getLocalHostname( &aLocalHostname.pData ) == osl_Socket_Ok)
+ {
+ *pPtr = '\0';
+ ::rtl::OUString aDisplayHostname( pDisplayHost, strlen( pDisplayHost ), gsl_getSystemTextEncoding() );
+ bEqual = sal_EqualHosts( aLocalHostname, aDisplayHostname );
+ bEqual = bEqual && sal_IsDisplayNumber( pPtr + 1 );
+ }
+ }
+ free( pDisplayHost );
+
+ return bEqual;
+}
+
+// ---------------------------------------------------------------------------
+// IsLocal means soffice is running on the same host as the xserver
+// since it is not called very often and sal_IsLocalDisplay() is relative
+// expensive bLocal_ is initialized on first call
+
+BOOL SalDisplay::IsLocal()
+{
+ if ( ! mbLocalIsValid )
+ {
+ bLocal_ = sal_IsLocalDisplay( pDisp_ );
+ mbLocalIsValid = TRUE;
+ }
+ return (BOOL)bLocal_;
+}
+
+// ---------------------------------------------------------------------------
+extern "C" srv_vendor_t
+sal_GetServerVendor( Display *p_display )
+{
+ typedef struct {
+ srv_vendor_t e_vendor; // vendor as enum
+ char *p_name; // vendor name as returned by VendorString()
+ unsigned int n_len; // number of chars to compare
+ } vendor_t;
+
+ const vendor_t p_vendorlist[] = {
+ { vendor_xfree, "The XFree86 Project, Inc", 13 },
+ { vendor_sun, "Sun Microsystems, Inc.", 10 },
+ { vendor_attachmate, "Attachmate Corporation", 10 },
+ { vendor_excursion,
+ "DECWINDOWS DigitalEquipmentCorporation, eXcursion", 42 },
+ { vendor_hp, "Hewlett-Packard Company", 17 },
+ { vendor_hummingbird, "Hummingbird Communications Ltd.", 11 },
+ { vendor_ibm, "International Business Machines", 24 },
+ { vendor_sgi, "Silicon Graphics", 9 },
+ { vendor_sco, "The Santa Cruz Operation", 16 },
+ { vendor_xinside, "X Inside Inc.", 10 },
+ // allways the last entry: vendor_none to indicate eol
+ { vendor_none, NULL, 0 },
+ };
+
+ // handle xprinter separately, since it doesn´t implement ServerVendor()
+ if ( ! XSalIsDisplay( p_display ) )
+ return vendor_xprinter;
+
+ // handle regular server vendors
+ char *p_name = ServerVendor( p_display );
+ vendor_t *p_vendor;
+ for (p_vendor = const_cast<vendor_t*>(p_vendorlist); p_vendor->e_vendor != vendor_none; p_vendor++)
+ {
+ if ( strncmp (p_name, p_vendor->p_name, p_vendor->n_len) == 0 )
+ return p_vendor->e_vendor;
+ }
+
+ // vendor not found in list
+ return vendor_unknown;
+}
+
+// -=-= SalDisplay -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final BOOL SalDisplay::BestVisual( Display *pDisplay,
+ int nScreen,
+ XVisualInfo &rVI )
+{
+ VisualID nDefVID = XVisualIDFromVisual( DefaultVisual( pDisplay, nScreen ) );
+ VisualID nVID = 0;
+ char *pVID = getenv( "SAL_VISUAL" );
+ if( pVID )
+ sscanf( pVID, "%li", &nVID );
+
+ if( nVID && sal_GetVisualInfo( pDisplay, nVID, rVI ) )
+ return rVI.visualid == nDefVID;
+
+ XVisualInfo aVI;
+ // get all visuals
+ int nVisuals;
+ XVisualInfo* pVInfos = XGetVisualInfo( pDisplay, VisualNoMask,
+ &aVI, &nVisuals );
+ // pVInfos should contain at least one visual, otherwise
+ // we're in trouble
+ int* pWeight = new int[ nVisuals ];
+ int i;
+ for( i = 0; i < nVisuals; i++ )
+ {
+ BOOL bUsable = FALSE;
+ int nTrueColor = 1;
+
+ if ( pVInfos[i].screen != nScreen )
+ {
+ bUsable = FALSE;
+ }
+ else
+ if( pVInfos[i].c_class == TrueColor )
+ {
+ nTrueColor = 2048;
+ if( pVInfos[i].depth == 24 )
+ bUsable = TRUE;
+#ifdef TRUECOLOR8
+ else if( pVInfos[i].depth == 8 )
+ {
+ nTrueColor = -1; // strongly discourage 8 bit true color
+ bUsable = TRUE;
+ }
+#endif
+#ifdef TRUECOLOR15
+ else if( pVInfos[i].depth == 15 )
+ bUsable = TRUE;
+#endif
+#ifdef TRUECOLOR16
+ else if( pVInfos[i].depth == 16 )
+ bUsable = TRUE;
+#endif
+#ifdef TRUECOLOR32
+ else if( pVInfos[i].depth == 32 )
+ {
+ nTrueColor = 256;
+ // we do not have use for an alpha channel
+ // better use a 24 or 16 bit truecolor visual if possible
+ bUsable = TRUE;
+ }
+#endif
+ }
+ else if( pVInfos[i].c_class == PseudoColor )
+ {
+ if( pVInfos[i].depth <= 8 )
+ bUsable = TRUE;
+#ifdef PSEUDOCOLOR12
+ else if( pVInfos[i].depth == 12 )
+ bUsable = TRUE;
+#endif
+ }
+ pWeight[ i ] = bUsable ? nTrueColor*pVInfos[i].depth : -1024;
+ pWeight[ i ] -= pVInfos[ i ].visualid;
+ }
+
+ SalOpenGL::MakeVisualWeights( pDisplay, pVInfos, pWeight, nVisuals );
+
+ int nBestVisual = 0;
+ int nBestWeight = -1024;
+ for( i = 0; i < nVisuals; i++ )
+ {
+ if( pWeight[ i ] > nBestWeight )
+ {
+ nBestWeight = pWeight[ i ];
+ nBestVisual = i;
+ }
+ }
+
+ rVI = pVInfos[ nBestVisual ];
+
+ XFree( pVInfos );
+ return rVI.visualid == nDefVID;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+final SalDisplay::SalDisplay( Widget w )
+{
+ SalData *pSalData = GetSalData();
+
+ if( !pSalData->GetDefDisp() )
+ pSalData->SetDefDisp( this );
+ if( !pSalData->GetCurDisp() )
+ pSalData->SetCurDisp( this );
+
+ pXLib_ = pSalData->GetLib();
+ pDisp_ = XtDisplay( w );
+ nScreen_ = DefaultScreen( pDisp_ );
+ hShell_ = w;
+ hComposite_ = XtVaCreateManagedWidget(
+ "ShellComposite",
+ SAL_COMPOSITE_WIDGET,
+ hShell_,
+ NULL );
+
+ Visual *pVisual = NULL;
+ Colormap hColMap = None;
+ Arg aArgs[10];
+
+ XtSetArg( aArgs[0], XtNvisual, &pVisual );
+ XtSetArg( aArgs[1], XtNcolormap, &hColMap );
+
+ XtGetValues( hShell_, aArgs, 2 );
+ if( !pVisual )
+ pVisual = DefaultVisual( pDisp_, nScreen_ );
+ if (!hColMap)
+ hColMap = DefaultColormap( pDisp_, nScreen_ );
+ if( !IsDisplay() && !hColMap)
+ hColMap = 1; // trick for XPrinter
+
+ XVisualInfo aXVI;
+ sal_GetVisualInfo( pDisp_, XVisualIDFromVisual( pVisual ), aXVI );
+
+ Init( hColMap, &aXVI );
+}
+
+final SalDisplay::SalDisplay( Display *display, Visual *pVisual,
+ Colormap aColMap ) : pDisp_( display )
+{
+ SalData *pSalData = GetSalData();
+ XVisualInfo aXVI;
+
+ if( !pSalData->GetDefDisp() )
+ pSalData->SetDefDisp( this );
+ if( !pSalData->GetCurDisp() )
+ pSalData->SetCurDisp( this );
+
+ pXLib_ = XSalIsDisplay( pDisp_ ) ? pSalData->GetLib() : NULL;
+ nScreen_ = DefaultScreen( pDisp_ );
+
+ if (!aColMap)
+ aColMap = DefaultColormap( display, nScreen_ );
+ if( !IsDisplay() && !aColMap)
+ aColMap = 1; // trick for XPrinter
+ if (!pVisual)
+ pVisual = DefaultVisual( pDisp_, nScreen_ );
+
+ sal_GetVisualInfo( pDisp_, XVisualIDFromVisual( pVisual ), aXVI );
+ Init( aColMap, &aXVI );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalDisplay::~SalDisplay( )
+{
+ SalData *pSalData = GetSalData();
+
+ SalBitmap::ImplDestroyCache();
+ DestroyFontCache();
+
+ if( IsDisplay() )
+ {
+ osl_destroyMutex( hEventGuard_ );
+
+ XDestroyWindow( pDisp_, hRefWindow_ );
+ if( pMonoGC_ != pCopyGC_ )
+ XFreeGC( pDisp_, pMonoGC_ );
+ XFreeGC( pDisp_, pCopyGC_ );
+ XFreeGC( pDisp_, pAndInvertedGC_ );
+ XFreeGC( pDisp_, pAndGC_ );
+ XFreeGC( pDisp_, pOrGC_ );
+ XFreeGC( pDisp_, pStippleGC_ );
+ XFreePixmap( pDisp_, hInvert50_ );
+
+ hEventGuard_ = (oslMutex)ILLEGAL_POINTER;
+ hRefWindow_ = (XLIB_Window)ILLEGAL_POINTER;
+ pMonoGC_ = (GC)ILLEGAL_POINTER;
+ pCopyGC_ = (GC)ILLEGAL_POINTER;
+ pAndInvertedGC_ = (GC)ILLEGAL_POINTER;
+ pAndGC_ = (GC)ILLEGAL_POINTER;
+ pOrGC_ = (GC)ILLEGAL_POINTER;
+ pStippleGC_ = (GC)ILLEGAL_POINTER;
+ hInvert50_ = None;
+
+ for( size_t i = 0; i < POINTER_COUNT; i++ )
+ {
+ XFreeCursor( pDisp_, aPointerCache_[i] );
+#ifdef DBG_UTIL
+ aPointerCache_[i] = None;
+#endif
+ }
+
+ if( hComposite_ )
+ XtDestroyWidget( hComposite_ );
+ if( hShell_ )
+ XtDestroyWidget( hShell_ );
+
+ pXLib_->Remove( ConnectionNumber( pDisp_ ) );
+
+ delete mpInputMethod;
+ delete mpKbdExtension;
+ XtCloseDisplay( pDisp_ );
+ }
+
+ pDisp_ = (Display*)ILLEGAL_POINTER;
+
+ pSalData->Remove( this );
+
+ // free colormap before modifying pVisual_
+ xColor_.Clear();
+
+ delete pICCCM_;
+ delete pVisual_;
+
+ if( pRootVisual_ != pVisual_ )
+ delete pRootVisual_;
+
+ pICCCM_ = (SalICCCM*)ILLEGAL_POINTER;
+ pVisual_ = (SalVisual*)ILLEGAL_POINTER;
+ pRootVisual_ = (SalVisual*)ILLEGAL_POINTER;
+
+ if( pSalData->GetDefDisp() == this )
+ pSalData->SetDefDisp( NULL );
+ if( pSalData->GetCurDisp() == this )
+ pSalData->SetCurDisp( NULL );
+}
+
+static int DisplayHasEvent( int fd, SalDisplay *pDisplay )
+{
+ DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd,
+ "wrong fd in DisplayHasEvent" )
+ return pDisplay->IsDisplay() && pDisplay->IsEvent();
+}
+static int DisplayQueue( int fd, SalDisplay *pDisplay )
+{
+ DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd,
+ "wrong fd in DisplayHasEvent" )
+ return XEventsQueued( pDisplay->GetDisplay(),
+ QueuedAfterReading );
+}
+static int DisplayYield( int fd, SalDisplay *pDisplay )
+{
+ DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd,
+ "wrong fd in DisplayHasEvent" )
+ pDisplay->Yield( TRUE );
+ return TRUE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalDisplay::Init( Colormap hXColmap, const XVisualInfo* pXVI )
+{
+ GetSalData()->Insert( this );
+
+ for( size_t i = 0; i < POINTER_COUNT; i++ )
+ aPointerCache_[i] = None;
+
+ eWindowManager_ = otherwm;
+ nProperties_ = PROPERTY_DEFAULT;
+ nStateOfYield_ = 0;
+ nStateOfSendEvent_ = 0;
+ hEventGuard_ = NULL;
+ pEventQueue_ = NULL;
+ pDispatchStack_ = NULL;
+ pFontCache_ = NULL;
+ mpFontList = (XlfdStorage*)NULL;
+ mpFactory = (AttributeProvider*)NULL;
+ mpCvtCache = NULL;
+ pCapture_ = NULL;
+ pVisual_ = new SalVisual( pXVI );
+ aSize_ = Size( DisplayWidth ( pDisp_, nScreen_ ),
+ DisplayHeight( pDisp_, nScreen_ ) );
+ aResolution_ =
+ Pair( DPI( aSize_.Width(), DisplayWidthMM ( pDisp_, nScreen_ ) ),
+ DPI( aSize_.Height(), DisplayHeightMM( pDisp_, nScreen_ ) ) );
+
+ nMaxRequestSize_ = XExtendedMaxRequestSize( pDisp_ ) * 4;
+ if( !nMaxRequestSize_ )
+ nMaxRequestSize_ = XMaxRequestSize( pDisp_ ) * 4;
+
+ SetServerVendor();
+ SalBitmap::ImplCreateCache();
+
+ if( IsDisplay() )
+ {
+ hEventGuard_ = osl_createMutex();
+
+ pXLib_->Insert( ConnectionNumber( pDisp_ ),
+ this,
+ (YieldFunc) DisplayHasEvent,
+ (YieldFunc) DisplayQueue,
+ (YieldFunc) DisplayYield );
+
+ pICCCM_ = new SalICCCM( this );
+ pScreen_ = ScreenOfDisplay( pDisp_, nScreen_ );
+ hRootWindow_ = RootWindowOfScreen( pScreen_ );
+
+ // we are interested in create and destroy notify events
+ // for salsystem
+ if( hRootWindow_ != None )
+ XSelectInput( pDisp_, hRootWindow_, SubstructureNotifyMask );
+
+ bLocal_ = FALSE; /* dont care, initialize later by
+ calling SalDisplay::IsLocal() */
+ mbLocalIsValid = FALSE; /* bLocal_ is not yet initialized */
+
+ // - - - - - - - - - - Visuals - - - - - - - - - - - - - - -
+ Visual *pRootVisual = DefaultVisual( pDisp_, nScreen_ );
+ // if( pRootVisual != pXVI->visual )
+ if( pRootVisual->visualid != pVisual_->GetVisualId() )
+ {
+ XVisualInfo aXVI;
+ sal_GetVisualInfo( pDisp_, pRootVisual->visualid, aXVI );
+ pRootVisual_ = new SalVisual( &aXVI );
+ }
+ else
+ pRootVisual_ = pVisual_;
+
+ // start session management
+ SessionManagerClient::open();
+
+ // - - - - - - - - - - Reference Window/Default Drawable - -
+ XSetWindowAttributes aXWAttributes;
+ aXWAttributes.border_pixel = 0;
+ aXWAttributes.background_pixel = 0;
+ aXWAttributes.colormap = hXColmap;
+ hRefWindow_ = XCreateWindow( pDisp_,
+ hRootWindow_,
+ 0,0, 16,16, 0,
+ pVisual_->GetDepth(),
+ InputOutput,
+ pVisual_->GetVisual(),
+ CWBorderPixel|CWBackPixel|CWColormap,
+ &aXWAttributes );
+
+ // set client leader and session id
+ char* pSessionID = SessionManagerClient::getSessionID();
+ if( hRefWindow_ )
+ {
+ if( pSessionID )
+ {
+ XChangeProperty( pDisp_,
+ hRefWindow_,
+ XInternAtom( pDisp_, "SM_CLIENT_ID", False ),
+ XA_STRING,
+ 8,
+ PropModeReplace,
+ (unsigned char*)pSessionID,
+ strlen( pSessionID )
+ );
+ }
+ // client leader must have WM_CLIENT_LEADER pointing to itself
+
+ XChangeProperty( pDisp_,
+ hRefWindow_,
+ XInternAtom( pDisp_, "WM_CLIENT_LEADER", False ),
+ XA_WINDOW,
+ 32,
+ PropModeReplace,
+ (unsigned char*)&hRefWindow_,
+ 1
+
+ );
+
+ ByteString aExec( SessionManagerClient::getExecName(), gsl_getSystemTextEncoding() );
+ char* argv[2];
+ argv[0] = "/bin/sh";
+ argv[1] = const_cast<char*>(aExec.GetBuffer());
+ XSetCommand( pDisp_, hRefWindow_, argv, 2 );
+ }
+
+ // - - - - - - - - - - Synchronize - - - - - - - - - - - - -
+ if( getenv( "SAL_SYNCHRONIZE" ) )
+ XSynchronize( pDisp_, True );
+
+ // - - - - - - - - - - Window Manager - - - - - - - - - - -
+ const char *pWM = getenv( "SAL_WM" );
+ if( pWM )
+ sscanf( pWM, "%li", &eWindowManager_ );
+ else if( XInternAtom( pDisp_, "_SGI_TELL_WM", True ) )
+ eWindowManager_ = _4Dwm;
+ else if( XInternAtom( pDisp_, "KWM_RUNNING", True ) )
+ eWindowManager_ = mwm; // naja, eigentlich kwm ...
+ else if( XInternAtom( pDisp_, "_OL_WIN_ATTR", True ) )
+ eWindowManager_ = olwm;
+
+ // - - - - - - - - - - Properties - - - - - - - - - - - - -
+ const char *pProperties = getenv( "SAL_PROPERTIES" );
+ if( pProperties )
+ sscanf( pProperties, "%li", &nProperties_ );
+ else
+ {
+#if defined DBG_UTIL || defined SUN || defined LINUX
+ nProperties_ |= PROPERTY_FEATURE_Maximize;
+#endif
+ // Server Bugs & Properties
+ if( GetServerVendor() == vendor_excursion )
+ {
+ nProperties_ |= PROPERTY_BUG_Stipple;
+ nProperties_ |= PROPERTY_BUG_DrawLine;
+ nProperties_ &= ~PROPERTY_SUPPORT_XSetClipMask;
+ }
+ else
+ if( GetServerVendor() == vendor_attachmate )
+ {
+ nProperties_ |= PROPERTY_BUG_CopyPlane_RevertBWPixel;
+ }
+ else
+ if( GetServerVendor() == vendor_ibm )
+ {
+ nProperties_ |= PROPERTY_BUG_XA_FAMILY_NAME_nil;
+
+ if( otherwm == eWindowManager_ ) eWindowManager_ = mwm;
+ }
+ else
+ if( GetServerVendor() == vendor_xfree )
+ {
+ nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor;
+#ifdef ARM32 // ??? Server! nicht Client ???
+ nProperties_ &= ~PROPERTY_SUPPORT_XSetClipMask;
+#endif
+#ifdef LINUX
+ // otherwm and olwm are a kind of default, which are not detected
+ // carefully. if we are running linux (i.e. not netbsd) on an xfree
+ // display, fvwm is most probable the wm to choose, confusing with mwm
+ // doesn't harm. #57791# start maximized if possible
+ if( (otherwm == eWindowManager_)
+ || (olwm == eWindowManager_ ))
+ {
+ eWindowManager_ = fvwm; // ???
+ nProperties_ |= PROPERTY_FEATURE_Maximize;
+ }
+#else
+ if( otherwm == eWindowManager_ ) eWindowManager_ = winmgr;
+#endif
+#if defined SOLARIS && defined SPARC
+ nProperties_ |= PROPERTY_BUG_Bitmap_Bit_Order;
+ // solaris xlib seems to have problems with putting images
+ // in correct bit order to xfree 8 bit displays
+#endif
+ }
+ else
+ if( GetServerVendor() == vendor_sun )
+ {
+ // nicht alle! (bekannt: nur Sparc II CG3, CG6?)
+ nProperties_ &= ~PROPERTY_SUPPORT_XSetClipMask;
+
+ // Fehler im Sun-Solaris X86 Server !
+ if (ImageByteOrder(GetDisplay()) == LSBFirst)
+ {
+ nProperties_ |= PROPERTY_BUG_Tile;
+ nProperties_ |= PROPERTY_SUPPORT_3ButtonMouse;
+ }
+ else // MSBFirst Sun-Solaris Sparc Server
+ {
+ // XCopyPlane reverts black and white for 1bit bitmaps
+ // only sun, only 8bit pseudocolor target
+ if ( (pVisual_->GetDepth() == 8)
+ && (pVisual_->GetClass() == PseudoColor))
+ nProperties_ |= PROPERTY_BUG_CopyPlane_RevertBWPixel;
+ // Fehler in Solaris 2.5.1
+ if (VendorRelease ( GetDisplay() ) < 3600)
+ nProperties_ |= PROPERTY_BUG_FillPolygon_Tile;
+ }
+
+ if( otherwm == eWindowManager_ )
+ if( XInternAtom( pDisp_, "_MOTIF_WM_INFO", True ) )
+ eWindowManager_ = dtwm;
+ else
+ eWindowManager_ = olwm;
+ }
+ else
+ if( GetServerVendor() == vendor_sco )
+ {
+ if( otherwm == eWindowManager_ ) eWindowManager_ = pmwm;
+ }
+ else
+ if( GetServerVendor() == vendor_sgi )
+ {
+ if( pVisual_->GetDepth() > 8 && pVisual_->GetDepth() <= 16 )
+ nProperties_ |= PROPERTY_BUG_XCopyArea_GXxor;
+ nProperties_ |= PROPERTY_SUPPORT_XSetClipMask;
+
+ if( otherwm == eWindowManager_ ) eWindowManager_ = _4Dwm;
+ }
+ else
+ if( GetServerVendor() == vendor_hp )
+ {
+ if( otherwm == eWindowManager_ ) eWindowManager_ = dtwm;
+ }
+ else
+ if( GetServerVendor() == vendor_hummingbird )
+ {
+ if (pVisual_->GetDepth() == 24)
+ nProperties_ |= PROPERTY_BUG_CopyArea_OnlySmallSlices;
+ }
+
+ if( otherwm == eWindowManager_ )
+ {
+ if( !XInternAtom( pDisp_, "_MOTIF_WM_INFO", True ) )
+ eWindowManager_ = olwm;
+ // ???
+ }
+
+ if( winmgr == eWindowManager_ )
+ {
+ nProperties_ &= ~PROPERTY_SUPPORT_WM_SetPos;
+ nProperties_ &= ~PROPERTY_SUPPORT_WM_Screen;
+ nProperties_ |= PROPERTY_FEATURE_Maximize;
+ }
+ else if( dtwm == eWindowManager_ )
+ {
+ nProperties_ &= ~PROPERTY_SUPPORT_WM_ClientPos;
+ }
+ else if( pmwm == eWindowManager_ )
+ {
+ nProperties_ &= ~PROPERTY_SUPPORT_WM_ClientPos;
+ }
+ }
+
+ // - - - - - - - - - - Shared Images - - - - - - - - - - - -
+#if defined _XSHM_H_ // && defined DBG_UTIL
+ // SharedMem wird nur noch ueber SalProperties enabled
+ // wegen Bugs #47289 und #46512
+
+ if( ( nProperties_ & PROPERTY_FEATURE_SharedMemory )
+ && ( *DisplayString( pDisp_ ) == ':'
+ || !strncmp( DisplayString( pDisp_ ), "localhost:", 10 ))
+ )
+ {
+ int nMinor, nMajor;
+ Bool bPixmaps;
+
+ nSharedImages_ = XShmQueryVersion( pDisp_,
+ &nMajor,
+ &nMinor,
+ &bPixmaps )
+ ? 0x80000000 : 0;
+ }
+ else
+ nSharedImages_ = 0;
+#else
+ nSharedImages_ = 0;
+#endif
+ // - - - - - - - - - - Images - - - - - - - - - - - - - - -
+ nImageDepths_ = 0x00000000;
+ int nCount, *pDepths = XListDepths( pDisp_, nScreen_, &nCount );
+ if( pDepths )
+ {
+ for( int i = 0; i < nCount; i++ )
+ nImageDepths_ |= 1 << (pDepths[i]-1);
+ XFree( pDepths );
+ }
+ }
+ else
+ {
+ pICCCM_ = NULL;
+ pScreen_ = NULL;
+ hRootWindow_ = None;
+ pRootVisual_ = pVisual_;
+#ifdef DBG_UTIL
+ hRefWindow_ = (XLIB_Window)ILLEGAL_POINTER;
+#endif
+ hInvert50_ = None;
+ bLocal_ = TRUE; /* always true for xprinter */
+ mbLocalIsValid = TRUE; /* yes bLocal_ is initialized */
+ nProperties_ &= ~PROPERTY_SUPPORT_XSetClipMask; //XPrinter doesnt
+ nSharedImages_ = 0;
+ nImageDepths_ = 0xFFFFFFFF;
+ }
+
+ // - - - - - - - - - - Images - - - - - - - - - - - - - - -
+ // 0x8080C889
+ nImageDepths_ &= (1<<(32-1))
+ |(1<<(24-1))
+ |(1<<(16-1))
+ |(1<<(15-1))
+ |(1<<(12-1))
+ |(1<<(8-1))
+ |(1<<(4-1))
+ |(1<<(1-1));
+
+ xColor_ = new SalColormap( this, hXColmap );
+
+ // - - - - - - - - - - GCs - - - - - - - - - - - - - - - - -
+ XGCValues values;
+ values.graphics_exposures = True;
+ values.fill_style = FillOpaqueStippled;
+ values.background = (1<<pVisual_->GetDepth())-1;
+ values.foreground = 0;
+
+ pCopyGC_ = XCreateGC( pDisp_,
+ hRefWindow_,
+ GCGraphicsExposures
+ | GCForeground
+ | GCBackground,
+ &values );
+ pAndInvertedGC_ = XCreateGC( pDisp_,
+ hRefWindow_,
+ GCGraphicsExposures
+ | GCForeground
+ | GCBackground,
+ &values );
+ pAndGC_ = XCreateGC( pDisp_,
+ hRefWindow_,
+ GCGraphicsExposures
+ | GCForeground
+ | GCBackground,
+ &values );
+ pOrGC_ = XCreateGC( pDisp_,
+ hRefWindow_,
+ GCGraphicsExposures
+ | GCForeground
+ | GCBackground,
+ &values );
+ pStippleGC_ = XCreateGC( pDisp_,
+ hRefWindow_,
+ GCGraphicsExposures
+ | GCFillStyle
+ | GCForeground
+ | GCBackground,
+ &values );
+
+ XSetFunction( pDisp_, pAndInvertedGC_, GXandInverted );
+ XSetFunction( pDisp_, pAndGC_, GXand );
+ // #44556# PowerPC Solaris 2.5 (XSun 3500) Bug: GXor = GXnop
+ //XSetFunction( pDisp_, pOrGC_, GXor );
+ XSetFunction( pDisp_, pOrGC_, GXxor );
+
+ if( 1 == pVisual_->GetDepth() ) // irgendwer dreht immer
+ {
+ XSetFunction( pDisp_, pCopyGC_, GXcopyInverted );
+ pMonoGC_ = pCopyGC_;
+ }
+ else
+ {
+ Pixmap hPixmap = XCreatePixmap( pDisp_, hRefWindow_, 1, 1, 1 );
+ pMonoGC_ = XCreateGC( pDisp_,
+ hPixmap,
+ GCGraphicsExposures,
+ &values );
+ XFreePixmap( pDisp_, hPixmap );
+ }
+
+ if( IsDisplay() )
+ {
+ hInvert50_ = XCreateBitmapFromData( pDisp_,
+ hRefWindow_,
+ invert50_bits,
+ invert50_width,
+ invert50_height );
+
+ // - - - - - - - - - - Sound - - - - - - - - - - - - - - - -
+
+ nBeepVolume_ = 0;
+
+ // - - - - - - - - - - Fonts - - - - - - - - - - - - - - - -
+
+ const char *pFontPath = getenv( "SAL_FONTPATH" );
+ if( pFontPath )
+ AddFontPath( ByteString( pFontPath ) );
+
+ // - - - - - - - - - - Keyboardmapping - - - - - - - - - - -
+
+ ModifierMapping();
+
+ // - - - - - - - - - - ShellWidget - - - - - - - - - - - - -
+
+
+ if( !XtWindow( hShell_ ) )
+ {
+ Position w, h;
+ Arg aArgs[10];
+
+ XtSetArg( aArgs[0], XtNwidth, &w );
+ XtSetArg( aArgs[1], XtNheight, &h );
+ XtGetValues( hShell_, aArgs, 2 );
+
+ if( !w || !h )
+ {
+ if( GetProperties() & PROPERTY_FEATURE_Maximize )
+ {
+ XtSetArg( aArgs[0], XtNwidth, aSize_.Width() );
+ XtSetArg( aArgs[1], XtNheight, aSize_.Height() );
+ }
+ else
+ {
+ XtSetArg( aArgs[0], XtNwidth, 500 );
+ XtSetArg( aArgs[1], XtNheight, 400 );
+ }
+ XtSetValues( hShell_, aArgs, 2 );
+ }
+
+ // X-Window erzeugen
+ XtSetMappedWhenManaged( hShell_, FALSE );
+ XtRealizeWidget( hShell_ );
+ }
+ if( !XtWindow( hComposite_ ) )
+ XtRealizeWidget( hComposite_ );
+ }
+#ifdef DBG_UTIL
+ PrintInfo();
+#endif
+
+#ifdef DEBUG
+ fprintf( stderr, "Keyboard name: %s\n", GetKeyboardName() );
+ String aConvert = GetKeyNameFromKeySym( XK_Control_L );
+ fprintf( stderr, "Control: %s\n", aConvert.Len() ? ByteString( aConvert, gsl_getSystemTextEncoding() ).GetBuffer() : "<nil>" );
+ aConvert = GetKeyNameFromKeySym( XK_Shift_L );
+ fprintf( stderr, "Shift: %s\n", aConvert.Len() ? ByteString( aConvert, gsl_getSystemTextEncoding() ).GetBuffer() : "<nil>" );
+ aConvert = GetKeyNameFromKeySym( XK_Alt_L );
+ fprintf( stderr, "Alt: %s\n", aConvert.Len() ? ByteString( aConvert, gsl_getSystemTextEncoding() ).GetBuffer() : "<nil>" );
+ aConvert = GetKeyNameFromKeySym( XK_Alt_R );
+ fprintf( stderr, "AltGr: %s\n", aConvert.Len() ? ByteString( aConvert, gsl_getSystemTextEncoding() ).GetBuffer() : "<nil>" );
+#endif
+}
+
+/*----------------------------
+ keep track of windows that are sized in ::Init but repositioned
+ by the window-mgr. If they are not resized by SalFrame::Set[Pos]Size
+ then SalFrameData::HandleReparentEvent takes a look at it, to prevent it
+ from beeing moved outside the screen
+ ------------------------------*/
+
+static unsigned int nRefWindow = 0;
+
+void
+MarkWindowAsBadPositioned( unsigned int nWindow )
+{
+ nRefWindow = nWindow;
+}
+
+void
+MarkWindowAsGoodPositioned( unsigned int nWindow )
+{
+ if ( nRefWindow == nWindow )
+ nRefWindow = 0;
+}
+
+Boolean
+WindowNeedGoodPosition( unsigned int nWindow )
+{
+ return (Boolean) nWindow == nRefWindow;
+}
+
+// Sound
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+beta void SalDisplay::Beep() const
+{
+ XBell( pDisp_, nBeepVolume_ );
+}
+
+// Keyboard
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+String SalDisplay::GetKeyNameFromKeySym( KeySym nKeySym ) const
+{
+ String aRet;
+ if( !nKeySym )
+ aRet = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "???" ) );
+ else
+ {
+ aRet = ::vcl_sal::getKeysymReplacementName( const_cast<SalDisplay*>(this)->GetKeyboardName(), nKeySym );
+ if( ! aRet.Len() )
+ {
+ const char *pString = XKeysymToString( nKeySym );
+ int n = strlen( pString );
+ if( n > 2 && pString[n-2] == '_' )
+ aRet = String( pString, n-2, RTL_TEXTENCODING_ISO_8859_1 );
+ else
+ aRet = String( pString, n, RTL_TEXTENCODING_ISO_8859_1 );
+ }
+ }
+ return aRet;
+}
+
+inline KeySym sal_XModifier2Keysym( Display *pDisplay,
+ XModifierKeymap *pXModMap,
+ int n )
+{
+ return XKeycodeToKeysym( pDisplay,
+ pXModMap->modifiermap[n*pXModMap->max_keypermod],
+ 0 );
+}
+
+final void SalDisplay::ModifierMapping()
+{
+ XModifierKeymap *pXModMap = XGetModifierMapping( pDisp_ );
+
+ bNumLockFromXS_ = True;
+ nShiftKeySym_ = sal_XModifier2Keysym( pDisp_, pXModMap, ShiftMapIndex );
+ nCtrlKeySym_ = sal_XModifier2Keysym( pDisp_, pXModMap, ControlMapIndex );
+ nMod1KeySym_ = sal_XModifier2Keysym( pDisp_, pXModMap, Mod1MapIndex );
+
+ // Auf Sun-Servern und SCO-Severn beruecksichtigt XLookupString
+ // nicht den NumLock Modifier.
+ if( (GetServerVendor() == vendor_sun)
+ || (GetServerVendor() == vendor_sco) )
+ {
+ XLIB_KeyCode aNumLock = XKeysymToKeycode( pDisp_, XK_Num_Lock );
+
+ if( aNumLock ) for( int i = ShiftMapIndex; i <= Mod5MapIndex; i++ )
+ {
+ if( pXModMap->modifiermap[i*pXModMap->max_keypermod] == aNumLock )
+ {
+ bNumLockFromXS_ = False;
+ nNumLockIndex_ = i;
+ nNumLockMask_ = 1<<i;
+ break;
+ }
+ }
+ }
+
+ XFreeModifiermap( pXModMap );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final XubString SalDisplay::GetKeyName( USHORT nKeyCode ) const
+{
+ String aStrMap;
+
+ if( nKeyCode & KEY_MOD2 )
+ {
+ aStrMap += GetKeyNameFromKeySym( nMod1KeySym_ );
+ }
+ if( nKeyCode & KEY_MOD1 )
+ {
+ if( aStrMap.Len() )
+ aStrMap += '+';
+ aStrMap += GetKeyNameFromKeySym( nCtrlKeySym_ );
+ }
+ if( nKeyCode & KEY_SHIFT )
+ {
+ if( aStrMap.Len() )
+ aStrMap += '+';
+ aStrMap += GetKeyNameFromKeySym( nShiftKeySym_ );
+ }
+ nKeyCode &= 0x0FFF;
+
+ KeySym nKeySym = 0;
+
+ if( KEY_0 <= nKeyCode && nKeyCode <= KEY_9 )
+ nKeySym = XK_0 + (nKeyCode - KEY_0);
+ else if( KEY_A <= nKeyCode && nKeyCode <= KEY_Z )
+ nKeySym = XK_A + (nKeyCode - KEY_A);
+ else if( KEY_F1 <= nKeyCode && nKeyCode <= KEY_F26 ) // Existiert die Taste
+ nKeySym = XK_F1 + (nKeyCode - KEY_F1);
+ else switch( nKeyCode )
+ {
+ case KEY_DOWN:
+ nKeySym = XK_Down;
+ break;
+ case KEY_UP:
+ nKeySym = XK_Up;
+ break;
+ case KEY_LEFT:
+ nKeySym = XK_Left;
+ break;
+ case KEY_RIGHT:
+ nKeySym = XK_Right;
+ break;
+ case KEY_HOME:
+ nKeySym = XK_Home;
+ break;
+ case KEY_END:
+ nKeySym = XK_End;
+ break;
+ case KEY_PAGEUP:
+ nKeySym = XK_Prior;
+ break;
+ case KEY_PAGEDOWN:
+ nKeySym = XK_Next;
+ break;
+ case KEY_RETURN:
+ nKeySym = XK_Return;
+ break;
+ case KEY_ESCAPE:
+ nKeySym = XK_Escape;
+ break;
+ case KEY_TAB:
+ nKeySym = XK_Tab;
+ break;
+ case KEY_BACKSPACE:
+ nKeySym = XK_BackSpace;
+ break;
+ case KEY_SPACE:
+ nKeySym = XK_space;
+ break;
+ case KEY_INSERT:
+ nKeySym = XK_Insert;
+ break;
+ case KEY_DELETE:
+ nKeySym = XK_Delete;
+ break;
+ case KEY_OPEN:
+ nKeySym = XK_L7;
+ break;
+ case KEY_CUT:
+ nKeySym = XK_L10;
+ break;
+ case KEY_COPY:
+ nKeySym = XK_L6;
+ break;
+ case KEY_PASTE:
+ nKeySym = XK_L8;
+ break;
+ case KEY_UNDO:
+ nKeySym = XK_L4; // XK_Undo; ???
+ break;
+ case KEY_REPEAT:
+// nKeySym = XK_L2; // XK_Redo; ???
+ nKeySym = XK_Redo;
+ break;
+ case KEY_FIND:
+ nKeySym = XK_L9; // XK_Find; ???
+ break;
+ case KEY_PROPERTIES:
+ nKeySym = XK_L3;
+ break;
+ case KEY_FRONT:
+ nKeySym = XK_L5;
+ break;
+
+ case KEY_ADD:
+ nKeySym = XK_plus;
+ break;
+ case KEY_SUBTRACT:
+ nKeySym = XK_minus;
+ break;
+ case KEY_MULTIPLY:
+ nKeySym = XK_asterisk;
+ break;
+ case KEY_DIVIDE:
+ nKeySym = XK_slash;
+ break;
+ case KEY_POINT:
+ nKeySym = XK_period;
+ break;
+ case KEY_COMMA:
+ nKeySym = XK_comma;
+ break;
+ case KEY_LESS:
+ nKeySym = XK_less;
+ break;
+ case KEY_GREATER:
+ nKeySym = XK_greater;
+ break;
+ case KEY_EQUAL:
+ nKeySym = XK_equal;
+ break;
+ case KEY_FRONT+1: // KEY_HELP
+ nKeySym = XK_F1; // XK_Help; ???
+ break;
+
+ default:
+ nKeySym = 0;
+ break;
+ }
+
+ if( nKeySym )
+ {
+ if( aStrMap.Len() )
+ aStrMap += '+';
+ aStrMap += GetKeyNameFromKeySym( nKeySym );
+ }
+
+ return aStrMap;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifndef IsISOKey
+#define IsISOKey( n ) (0x0000FE00==((n)&0xFFFFFF00))
+#endif
+
+final USHORT SalDisplay::GetKeyCode( KeySym keysym, char*pcPrintable ) const
+{
+ USHORT nKey = 0;
+
+ if( XK_a <= keysym && XK_z >= keysym )
+ nKey = (USHORT)(KEY_A + (keysym - XK_a));
+ else if( XK_A <= keysym && XK_Z >= keysym )
+ nKey = (USHORT)(KEY_A + (keysym - XK_A));
+ else if( XK_0 <= keysym && XK_9 >= keysym )
+ nKey = (USHORT)(KEY_0 + (keysym - XK_0));
+ else if( IsModifierKey( keysym ) )
+ nop;
+ else if( IsKeypadKey( keysym ) )
+ {
+ if( (keysym >= XK_KP_0) && (keysym <= XK_KP_9) )
+ {
+ nKey = (USHORT)(KEY_0 + (keysym - XK_KP_0));
+ *pcPrintable = '0' + nKey - KEY_0;
+ }
+ else if( IsPFKey( keysym ) )
+ nKey = (USHORT)(KEY_F1 + (keysym - XK_KP_F1));
+ else switch( keysym )
+ {
+ case XK_KP_Space:
+ nKey = KEY_SPACE;
+ *pcPrintable = ' ';
+ break;
+ case XK_KP_Tab:
+ nKey = KEY_TAB;
+ break;
+ case XK_KP_Enter:
+ nKey = KEY_RETURN;
+ break;
+ case XK_KP_Begin:
+ case XK_KP_Home:
+ nKey = KEY_HOME;
+ break;
+ case XK_KP_Left:
+ nKey = KEY_LEFT;
+ break;
+ case XK_KP_Up:
+ nKey = KEY_UP;
+ break;
+ case XK_KP_Right:
+ nKey = KEY_RIGHT;
+ break;
+ case XK_KP_Down:
+ nKey = KEY_DOWN;
+ break;
+ case XK_KP_Prior: // XK_KP_Page_Up
+ nKey = KEY_PAGEUP;
+ break;
+ case XK_KP_Next: // XK_KP_Page_Down
+ nKey = KEY_PAGEDOWN;
+ break;
+ case XK_KP_End:
+ nKey = KEY_END;
+ break;
+ case XK_KP_Insert:
+ nKey = KEY_INSERT;
+ break;
+ case XK_KP_Delete:
+ nKey = KEY_DELETE;
+ break;
+ case XK_KP_Equal:
+ nKey = KEY_EQUAL;
+ *pcPrintable = '=';
+ break;
+ case XK_KP_Multiply:
+ nKey = KEY_MULTIPLY;
+ *pcPrintable = '*';
+ break;
+ case XK_KP_Add:
+ nKey = KEY_ADD;
+ *pcPrintable = '+';
+ break;
+ case XK_KP_Separator:
+ nKey = KEY_COMMA; // ???
+ *pcPrintable = ',';
+ break;
+ case XK_KP_Subtract:
+ nKey = KEY_SUBTRACT;
+ *pcPrintable = '-';
+ break;
+ case XK_KP_Decimal:
+ nKey = KEY_POINT;
+ *pcPrintable = '.';
+ break;
+ case XK_KP_Divide:
+ nKey = KEY_DIVIDE;
+ *pcPrintable = '/';
+ break;
+ }
+ }
+ else if( IsFunctionKey( keysym ) )
+ {
+ if( bNumLockFromXS_ )
+ {
+ if( keysym >= XK_F1 && keysym <= XK_F26 )
+ nKey = (USHORT)(KEY_F1 + keysym - XK_F1);
+ }
+ else switch( keysym )
+ {
+#if 1 // Sun schaltet mit "Alt Graph"/XK_Mode_switch um
+ // - - - - - Sun X-Server Tastatur ohne Cursorblock ??? - - -
+#if 0 // Sal supports F1 - F26
+ case XK_R1: // XK_F21:
+ nKey = KEY_F21; // KEY_PRINT/KEY_SYSREQ
+ break;
+ case XK_R2: // XK_F22:
+ nKey = KEY_F22; // KEY_SCROLLLOCK
+ break;
+ case XK_R3: // XK_F23:
+ nKey = KEY_F23; // KEY_PAUSE/KEY_BREAK
+ break;
+ case XK_R4: // XK_F24:
+ nKey = KEY_F24; // KEY_EQUAL
+ break;
+ case XK_R5: // XK_F25:
+ nKey = KEY_F25; // KEY_DIVIDE
+ break;
+ case XK_R6: // XK_F26:
+ nKey = KEY_F26; // KEY_MULTIPLY
+ break;
+#endif
+ case XK_R7: // XK_F27:
+ nKey = KEY_HOME;
+ break;
+ case XK_R8: // XK_F28:
+ nKey = KEY_UP;
+ break;
+ case XK_R9: // XK_F29:
+ nKey = KEY_PAGEUP;
+ break;
+ case XK_R10: // XK_F30:
+ nKey = KEY_LEFT;
+ break;
+ case XK_R11: // XK_F31:
+ nKey = 0; // KEY_F31
+ break;
+ case XK_R12: // XK_F32:
+ nKey = KEY_RIGHT;
+ break;
+ case XK_R13: // XK_F33:
+ nKey = KEY_END;
+ break;
+ case XK_R14: // XK_F34:
+ nKey = KEY_DOWN;
+ break;
+ case XK_R15: // XK_F35:
+ nKey = KEY_PAGEDOWN;
+ break;
+ // - - - - - Sun X-Server Tastatur ??? - - - - - - - - - - - -
+ case XK_L1: // XK_F11:
+ nKey = KEY_F11; // KEY_CANCEL
+ break;
+ case XK_L2: // XK_F12:
+ if ( GetServerVendor() == vendor_sun )
+ nKey = KEY_REPEAT;
+ else
+ nKey = KEY_F12;
+ break;
+ case XK_L3: // XK_F13:
+ nKey = KEY_PROPERTIES; // KEY_F13
+ break;
+ case XK_L4: // XK_F14:
+ nKey = KEY_UNDO; // KEY_F14
+ break;
+ case XK_L5: // XK_F15:
+ nKey = KEY_F15; // KEY_FRONT
+ break;
+ case XK_L6: // XK_F16:
+ nKey = KEY_COPY; // KEY_F16
+ break;
+ case XK_L7: // XK_F17:
+ nKey = KEY_F17; // KEY_OPEN
+ break;
+ case XK_L8: // XK_F18:
+ nKey = KEY_PASTE; // KEY_F18
+ break;
+ case XK_L9: // XK_F19:
+ nKey = KEY_F19; // KEY_FIND
+ break;
+ case XK_L10: // XK_F20:
+ nKey = KEY_CUT; // KEY_F20
+ break;
+#endif
+ default:
+ if( keysym >= XK_F1 && keysym <= XK_F26 )
+ nKey = (USHORT)(KEY_F1 + keysym - XK_F1);
+ break;
+ }
+ }
+ else if( IsCursorKey( keysym ) )
+ {
+ switch( keysym )
+ {
+ case XK_Begin:
+ case XK_Home:
+ nKey = KEY_HOME;
+ break;
+ case XK_Left:
+ nKey = KEY_LEFT;
+ break;
+ case XK_Up:
+ nKey = KEY_UP;
+ break;
+ case XK_Right:
+ nKey = KEY_RIGHT;
+ break;
+ case XK_Down:
+ nKey = KEY_DOWN;
+ break;
+ case XK_Prior: // XK_Page_Up
+ nKey = KEY_PAGEUP;
+ break;
+ case XK_Next: // XK_Page_Down
+ nKey = KEY_PAGEDOWN;
+ break;
+ case XK_End:
+ nKey = KEY_END;
+ break;
+ }
+ }
+ else if( IsMiscFunctionKey( keysym ) )
+ {
+ switch( keysym )
+ {
+ case XK_Insert:
+ nKey = KEY_INSERT;
+ break;
+ case XK_Redo:
+ nKey = KEY_REPEAT;
+ break;
+ case XK_Undo:
+ nKey = KEY_UNDO;
+ break;
+ case XK_Find:
+ nKey = KEY_FIND;
+ break;
+ case XK_Help:
+ nKey = KEY_FRONT+1; // KEY_HELP
+ nKey = KEY_F1;
+ break;
+ case XK_Menu:
+ nKey = KEY_F10;
+ break;
+#if 0
+ case XK_Break:
+ case XK_Select:
+ case XK_Execute:
+ case XK_Print:
+ case XK_Cancel:
+#endif
+ }
+ }
+ else if( IsISOKey( keysym ) ) // XK_ISO_
+ {
+ switch( keysym )
+ {
+ case 0xFE20: // XK_ISO_Left_Tab:
+ nKey = KEY_TAB;
+ break;
+ }
+ }
+ else switch( keysym )
+ {
+ case XK_Return:
+ nKey = KEY_RETURN;
+ break;
+ case XK_BackSpace:
+ nKey = KEY_BACKSPACE;
+ break;
+ case XK_Delete:
+ nKey = KEY_DELETE;
+ break;
+ case XK_space:
+ nKey = KEY_SPACE;
+ break;
+ case XK_Tab:
+ nKey = KEY_TAB;
+ break;
+ case XK_Escape:
+ nKey = KEY_ESCAPE;
+ break;
+ case XK_plus:
+ nKey = KEY_ADD;
+ break;
+ case XK_minus:
+ nKey = KEY_SUBTRACT;
+ break;
+ case XK_asterisk:
+ nKey = KEY_MULTIPLY;
+ break;
+ case XK_slash:
+ nKey = KEY_DIVIDE;
+ break;
+ case XK_period:
+ nKey = KEY_POINT;
+ break;
+ case XK_comma:
+ nKey = KEY_COMMA;
+ break;
+ case XK_less:
+ nKey = KEY_LESS;
+ break;
+ case XK_greater:
+ nKey = KEY_GREATER;
+ break;
+ case XK_equal:
+ nKey = KEY_EQUAL;
+ break;
+// case XK_Linefeed:
+// *pcPrintable = '\n';
+// break;
+ // - - - - - - - - - - - - - Apollo - - - - - - - - - - - - - 0x1000
+ case 0x1000FF02: // apXK_Copy
+ nKey = KEY_COPY;
+ break;
+ case 0x1000FF03: // apXK_Cut
+ nKey = KEY_CUT;
+ break;
+ case 0x1000FF04: // apXK_Paste
+ nKey = KEY_PASTE;
+ break;
+ case 0x1000FF14: // apXK_Repeat
+ nKey = KEY_REPEAT;
+ break;
+ // Exit, Save
+ // - - - - - - - - - - - - - - D E C - - - - - - - - - - - - - 0x1000
+ case 0x1000FF00:
+ nKey = KEY_DELETE;
+ break;
+ // - - - - - - - - - - - - - - H P - - - - - - - - - - - - - 0x1000
+ case 0x1000FF73: // hpXK_DeleteChar
+ nKey = KEY_DELETE;
+ break;
+ case 0x1000FF74: // hpXK_BackTab
+ case 0x1000FF75: // hpXK_KP_BackTab
+ nKey = KEY_TAB;
+ break;
+ // - - - - - - - - - - - - - - I B M - - - - - - - - - - - - -
+ // - - - - - - - - - - - - - - O S F - - - - - - - - - - - - - 0x1004
+ case 0x1004FF02: // osfXK_Copy
+ nKey = KEY_COPY;
+ break;
+ case 0x1004FF03: // osfXK_Cut
+ nKey = KEY_CUT;
+ break;
+ case 0x1004FF04: // osfXK_Paste
+ nKey = KEY_PASTE;
+ break;
+ case 0x1004FF07: // osfXK_BackTab
+ nKey = KEY_TAB;
+ break;
+ case 0x1004FF08: // osfXK_BackSpace
+ nKey = KEY_BACKSPACE;
+ break;
+ case 0x1004FF1B: // osfXK_Escape
+ nKey = KEY_ESCAPE;
+ break;
+ // Up, Down, Left, Right, PageUp, PageDown
+ // - - - - - - - - - - - - - - S C O - - - - - - - - - - - - -
+ // - - - - - - - - - - - - - - S G I - - - - - - - - - - - - - 0x1007
+ // - - - - - - - - - - - - - - S N I - - - - - - - - - - - - -
+ // - - - - - - - - - - - - - - S U N - - - - - - - - - - - - - 0x1005
+ case 0x1005FF10: // SunXK_F36
+ nKey = KEY_F11;
+ break;
+ case 0x1005FF11: // SunXK_F37
+ nKey = KEY_F12;
+ break;
+ case 0x1005FF70: // SunXK_Props
+ nKey = KEY_PROPERTIES;
+ break;
+ case 0x1005FF71: // SunXK_Front
+ nKey = KEY_FRONT;
+ break;
+ case 0x1005FF72: // SunXK_Copy
+ nKey = KEY_COPY;
+ break;
+ case 0x1005FF73: // SunXK_Open
+ nKey = KEY_OPEN;
+ break;
+ case 0x1005FF74: // SunXK_Paste
+ nKey = KEY_PASTE;
+ break;
+ case 0x1005FF75: // SunXK_Cut
+ nKey = KEY_CUT;
+ break;
+ }
+ return nKey;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent,
+ unsigned char *pPrintable,
+ int *pLen,
+ Status *pStatusReturn,
+ XIC aInputContext ) const
+{
+ KeySym nKeySym;
+ memset( pPrintable, 0, *pLen );
+
+ if ( (aInputContext == 0) || (pEvent->type == KeyRelease) )
+ {
+ XComposeStatus nStatus;
+ *pLen = XLookupString( pEvent, (char*)pPrintable, 1,
+ &nKeySym, &nStatus );
+ }
+ else
+ {
+ *pStatusReturn = 0;
+ // not really sufficient for multibyte lookup: cannot handle more
+ // than one byte in sprintable, cannot handle conversion error
+ *pLen = XmbLookupString( aInputContext,
+ pEvent, (char*)pPrintable, *pLen - 1, &nKeySym, pStatusReturn );
+
+ // Lookup the string again, now with appropriate size
+ if ( *pStatusReturn == XBufferOverflow )
+ {
+ pPrintable[ 0 ] = (char)0;
+ return 0;
+ }
+
+ switch ( *pStatusReturn )
+ {
+ case XBufferOverflow:
+ /* unhandled error */
+ break;
+ case XLookupNone:
+ /* unhandled error */
+ break;
+ case XLookupKeySym:
+ /* #72223# this is a strange one: on exceed sometimes
+ * no printable is returned for the first char entered,
+ * just to retry lookup solves the problem. The problem
+ * is not yet fully understood, so restrict 2nd lookup
+ * to 7bit ascii chars */
+ if ( (XK_space <= nKeySym) && (XK_asciitilde >= nKeySym) )
+ {
+ *pLen = 1;
+ pPrintable[ 0 ] = (char)nKeySym;
+ }
+ break;
+ case XLookupBoth:
+ case XLookupChars:
+
+ /* nothing to, char allready in pPrintable */
+ break;
+ }
+ }
+
+ if( !bNumLockFromXS_
+ && (IsCursorKey(nKeySym)
+ || IsFunctionKey(nKeySym)
+ || IsKeypadKey(nKeySym)
+ || XK_Delete == nKeySym ) )
+ {
+ // Bei einigen X-Servern muss man bei den Keypadtasten
+ // schon sehr genau hinschauen. ZB. Solaris XServer:
+ // 2, 4, 6, 8 werden als Cursorkeys klassifiziert (Up, Down, Left, Right
+ // 1, 3, 5, 9 werden als Functionkeys klassifiziert (F27,F29,F33,F35)
+ // 0 als Keypadkey und der Dezimalpunkt gar nicht (KP_Insert)
+ KeySym nNewKeySym = XLookupKeysym( pEvent, nNumLockIndex_ );
+// fprintf( stderr, "Key%s: sym=%x state=%x code=%d new=%x\n",
+// KeyRelease == pEvent->type ? "Release" : "Press",
+// nKeySym, pEvent->state, pEvent->keycode, nNewKeySym );
+ if( nNewKeySym != NoSymbol )
+ nKeySym = nNewKeySym;
+ }
+// else
+// fprintf( stderr, "Key%s: sym=%x state=%x code=%d\n",
+// KeyRelease == pEvent->type ? "Release" : "Press",
+// nKeySym, pEvent->state, pEvent->keycode );
+
+ return nKeySym;
+}
+
+// Pointer
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define MAKE_BITMAP( name ) \
+ XCreateBitmapFromData( pDisp_, \
+ DefaultRootWindow( pDisp_ ), \
+ name##_bits, \
+ name##_width, \
+ name##_height )
+
+#define MAKE_CURSOR( name ) \
+ aCursBitmap = MAKE_BITMAP( name##curs ); \
+ aMaskBitmap = MAKE_BITMAP( name##mask ); \
+ nXHot = name##curs_x_hot; \
+ nYHot = name##curs_y_hot
+
+final XLIB_Cursor SalDisplay::GetPointer( int ePointerStyle )
+{
+ if( ePointerStyle > POINTER_COUNT )
+ return NULL;
+
+ XLIB_Cursor &aCur = aPointerCache_[ePointerStyle];
+
+ if( aCur != None )
+ return aCur;
+
+ Pixmap aCursBitmap, aMaskBitmap;
+ unsigned int nXHot, nYHot;
+
+ switch( ePointerStyle )
+ {
+ case POINTER_NULL:
+ MAKE_CURSOR( null );
+ break;
+ case POINTER_ARROW:
+ aCur = XCreateFontCursor( pDisp_, XC_top_left_arrow );
+ break;
+ case POINTER_WAIT:
+ MAKE_CURSOR( wait_ );
+ break;
+ case POINTER_TEXT: // Mouse Pointer ist ein "I" Beam
+ aCur = XCreateFontCursor( pDisp_, XC_xterm );
+ break;
+ case POINTER_HELP:
+ aCur = XCreateFontCursor( pDisp_, XC_question_arrow );
+ break;
+ case POINTER_CROSS: // Mouse Pointer ist ein Kreuz
+ aCur = XCreateFontCursor( pDisp_, XC_crosshair );
+ break;
+ case POINTER_NSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_sb_v_double_arrow );
+ break;
+ case POINTER_SSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_sb_v_double_arrow );
+ break;
+ case POINTER_WSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_sb_h_double_arrow );
+ break;
+ case POINTER_ESIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_sb_h_double_arrow );
+ break;
+ case POINTER_WINDOW_NSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_top_tee );
+ break;
+ case POINTER_WINDOW_SSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_bottom_tee );
+ break;
+ case POINTER_WINDOW_WSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_left_tee );
+ break;
+ case POINTER_WINDOW_ESIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_right_tee );
+ break;
+ case POINTER_NWSIZE:
+ MAKE_CURSOR( nwsesize_ );
+ break;
+ case POINTER_NESIZE:
+ MAKE_CURSOR( neswsize_ );
+ break;
+ case POINTER_SWSIZE:
+ MAKE_CURSOR( neswsize_ );
+ break;
+ case POINTER_SESIZE:
+ MAKE_CURSOR( nwsesize_ );
+ break;
+ case POINTER_WINDOW_NWSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_top_left_corner );
+ break;
+ case POINTER_WINDOW_NESIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_top_right_corner );
+ break;
+ case POINTER_WINDOW_SWSIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_bottom_left_corner );
+ break;
+ case POINTER_WINDOW_SESIZE:
+ aCur = XCreateFontCursor( pDisp_, XC_bottom_right_corner );
+ break;
+ case POINTER_HSPLIT:
+ MAKE_CURSOR( hsplit_ );
+ break;
+ case POINTER_VSPLIT:
+ MAKE_CURSOR( vsplit_ );
+ break;
+ case POINTER_HSIZEBAR:
+ aCur = XCreateFontCursor( pDisp_, XC_sb_h_double_arrow ); // ???
+ break;
+ case POINTER_VSIZEBAR:
+ aCur = XCreateFontCursor( pDisp_, XC_sb_v_double_arrow ); // ???
+ break;
+ case POINTER_REFHAND:
+ aCur = XCreateFontCursor( pDisp_, XC_hand1 );
+ break;
+ case POINTER_HAND:
+ aCur = XCreateFontCursor( pDisp_, XC_hand2 );
+ break;
+ case POINTER_MAGNIFY:
+ MAKE_CURSOR( magnify_ );
+ break;
+ case POINTER_FILL:
+ MAKE_CURSOR( fill_ );
+ break;
+ case POINTER_MOVE:
+ MAKE_CURSOR( move_ );
+ break;
+ case POINTER_MOVEDATA:
+ MAKE_CURSOR( movedata_ );
+ break;
+ case POINTER_COPYDATA:
+ MAKE_CURSOR( copydata_ );
+ break;
+ case POINTER_MOVEFILE:
+ MAKE_CURSOR( movefile_ );
+ break;
+ case POINTER_COPYFILE:
+ MAKE_CURSOR( copyfile_ );
+ break;
+ case POINTER_MOVEFILES:
+ MAKE_CURSOR( movefiles_ );
+ break;
+ case POINTER_COPYFILES:
+ MAKE_CURSOR( copyfiles_ );
+ break;
+ case POINTER_NOTALLOWED:
+ MAKE_CURSOR( nodrop_ );
+ break;
+ case POINTER_ROTATE:
+ MAKE_CURSOR( rotate_ );
+ break;
+ case POINTER_HSHEAR:
+ MAKE_CURSOR( hshear_ );
+ break;
+ case POINTER_VSHEAR:
+ MAKE_CURSOR( vshear_ );
+ break;
+ case POINTER_DRAW_LINE:
+ MAKE_CURSOR( drawline_ );
+ break;
+ case POINTER_DRAW_RECT:
+ MAKE_CURSOR( drawrect_ );
+ break;
+ case POINTER_DRAW_POLYGON:
+ MAKE_CURSOR( drawpolygon_ );
+ break;
+ case POINTER_DRAW_BEZIER:
+ MAKE_CURSOR( drawbezier_ );
+ break;
+ case POINTER_DRAW_ARC:
+ MAKE_CURSOR( drawarc_ );
+ break;
+ case POINTER_DRAW_PIE:
+ MAKE_CURSOR( drawpie_ );
+ break;
+ case POINTER_DRAW_CIRCLECUT:
+ MAKE_CURSOR( drawcirclecut_ );
+ break;
+ case POINTER_DRAW_ELLIPSE:
+ MAKE_CURSOR( drawellipse_ );
+ break;
+ case POINTER_DRAW_CONNECT:
+ MAKE_CURSOR( drawconnect_ );
+ break;
+ case POINTER_DRAW_TEXT:
+ MAKE_CURSOR( drawtext_ );
+ break;
+ case POINTER_MIRROR:
+ MAKE_CURSOR( mirror_ );
+ break;
+ case POINTER_CROOK:
+ MAKE_CURSOR( crook_ );
+ break;
+ case POINTER_CROP:
+ MAKE_CURSOR( crop_ );
+ break;
+ case POINTER_MOVEPOINT:
+ MAKE_CURSOR( movepoint_ );
+ break;
+ case POINTER_MOVEBEZIERWEIGHT:
+ MAKE_CURSOR( movebezierweight_ );
+ break;
+ case POINTER_DRAW_FREEHAND:
+ MAKE_CURSOR( drawfreehand_ );
+ break;
+ case POINTER_DRAW_CAPTION:
+ MAKE_CURSOR( drawcaption_ );
+ break;
+ case POINTER_PEN: // Mouse Pointer ist ein Stift
+ aCur = XCreateFontCursor( pDisp_, XC_pencil );
+ break;
+ case POINTER_LINKDATA:
+ MAKE_CURSOR( linkdata_ );
+ break;
+ case POINTER_MOVEDATALINK:
+ MAKE_CURSOR( movedlnk_ );
+ break;
+ case POINTER_COPYDATALINK:
+ MAKE_CURSOR( copydlnk_ );
+ break;
+ case POINTER_LINKFILE:
+ MAKE_CURSOR( linkfile_ );
+ break;
+ case POINTER_MOVEFILELINK:
+ MAKE_CURSOR( moveflnk_ );
+ break;
+ case POINTER_COPYFILELINK:
+ MAKE_CURSOR( copyflnk_ );
+ break;
+ case POINTER_CHART:
+ MAKE_CURSOR( chart_ );
+ break;
+ case POINTER_DETECTIVE:
+ MAKE_CURSOR( detective_ );
+ break;
+ case POINTER_PIVOT_COL:
+ MAKE_CURSOR( pivotcol_ );
+ break;
+ case POINTER_PIVOT_ROW:
+ MAKE_CURSOR( pivotrow_ );
+ break;
+ case POINTER_PIVOT_FIELD:
+ MAKE_CURSOR( pivotfld_ );
+ break;
+ case POINTER_CHAIN:
+ MAKE_CURSOR( chain_ );
+ break;
+ case POINTER_CHAIN_NOTALLOWED:
+ MAKE_CURSOR( chainnot_ );
+ break;
+ case POINTER_TIMEEVENT_MOVE:
+ MAKE_CURSOR( timemove_ );
+ break;
+ case POINTER_TIMEEVENT_SIZE:
+ MAKE_CURSOR( timesize_ );
+ break;
+ case POINTER_AUTOSCROLL_N:
+ MAKE_CURSOR(asn_ );
+ break;
+ case POINTER_AUTOSCROLL_S:
+ MAKE_CURSOR( ass_ );
+ break;
+ case POINTER_AUTOSCROLL_W:
+ MAKE_CURSOR( asw_ );
+ break;
+ case POINTER_AUTOSCROLL_E:
+ MAKE_CURSOR( ase_ );
+ break;
+ case POINTER_AUTOSCROLL_NW:
+ MAKE_CURSOR( asnw_ );
+ break;
+ case POINTER_AUTOSCROLL_NE:
+ MAKE_CURSOR( asne_ );
+ break;
+ case POINTER_AUTOSCROLL_SW:
+ MAKE_CURSOR( assw_ );
+ break;
+ case POINTER_AUTOSCROLL_SE:
+ MAKE_CURSOR( asse_ );
+ break;
+ case POINTER_AUTOSCROLL_NS:
+ MAKE_CURSOR( asns_ );
+ break;
+ case POINTER_AUTOSCROLL_WE:
+ MAKE_CURSOR( aswe_ );
+ break;
+ case POINTER_AUTOSCROLL_NSWE:
+ MAKE_CURSOR( asnswe_ );
+ break;
+ case POINTER_AIRBRUSH:
+ MAKE_CURSOR( airbrush_ );
+ break;
+ default:
+ DBG_ERROR("pointer not implemented");
+ aCur = XCreateFontCursor( pDisp_, XC_arrow );
+ break;
+ }
+
+ if( None == aCur )
+ {
+ XColor aBlack, aWhite, aDummy;
+ Colormap hColormap = xColor_->GetXColormap();
+
+ XAllocNamedColor( pDisp_, hColormap, "black", &aBlack, &aDummy );
+ XAllocNamedColor( pDisp_, hColormap, "white", &aWhite, &aDummy );
+
+ aCur = XCreatePixmapCursor( pDisp_,
+ aCursBitmap, aMaskBitmap,
+ &aBlack, &aWhite,
+ nXHot, nYHot );
+
+ XFreePixmap( pDisp_, aCursBitmap );
+ XFreePixmap( pDisp_, aMaskBitmap );
+ }
+
+ return aCur;
+}
+
+int SalDisplay::CaptureMouse( SalFrameData *pCapture )
+{
+ if( !pCapture )
+ {
+ pCapture_ = NULL;
+ XUngrabPointer( GetDisplay(), CurrentTime );
+ XFlush( GetDisplay() );
+ return 0;
+ }
+
+ if( pCapture_ )
+ //pCapture_->CaptureMouse( FALSE );
+ pCapture_ = NULL;
+
+ int ret = XGrabPointer( GetDisplay(),
+ pCapture->GetWindow(),
+ False,
+ PointerMotionMask| ButtonPressMask|ButtonReleaseMask,
+ GrabModeAsync,
+ GrabModeAsync,
+ None,
+ pCapture->GetCursor(),
+ CurrentTime );
+
+ if( ret != GrabSuccess )
+ {
+ DBG_ASSERT( 1, "SalDisplay::CaptureMouse could not grab pointer\n");
+ return -1;
+ }
+
+ pCapture_ = pCapture;
+ return 1;
+}
+
+// Fonts
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+static BOOL
+sal_IsValidFontpath( const ByteString &rFontPath,
+ const srv_vendor_t eServerVendor )
+{
+ // filter fontpath with ':unscaled' attribute for server other
+ // than xfree (e.g.: /opt/Office51/fonts/75dpi:unscaled)
+
+ const char aAttr[] = ":unscaled";
+ const USHORT nAttrLen = sizeof( aAttr ) - 1;
+ USHORT nAttrPos;
+
+ nAttrPos = rFontPath.Search( aAttr, 0 );
+ if ( nAttrPos == (rFontPath.Len() - nAttrLen) )
+ return (eServerVendor == vendor_xfree);
+
+ return TRUE;
+}
+
+final void SalDisplay::AddFontPath( const ByteString &rPath ) const
+{
+ const char cSeparator = ';' ;
+
+ if( rPath.Len()
+ && (GetServerVendor() != vendor_excursion)
+ && (GetServerVendor() != vendor_hummingbird) )
+ {
+ USHORT nCount = rPath.GetTokenCount( cSeparator );
+ int i;
+ int nPaths = 0;
+ char **pOldFontPath = XGetFontPath( pDisp_, &nPaths );
+ int nOriginalPaths = nPaths;
+ char **pNewFontPath = new char*[nPaths+nCount];
+ BOOL bOld = pXLib_->GetIgnoreXErrors();
+
+ for( i = 0; i < nPaths; i++ )
+ pNewFontPath[i] = pOldFontPath[i];
+
+ for( USHORT nNew = 0; nNew < nCount; nNew++ )
+ {
+ ByteString aPathName = rPath.GetToken( nNew, cSeparator );
+
+ if( aPathName.Len() )
+ {
+ for( i = 0; i < nPaths; i++ )
+ if( !strcmp( pNewFontPath[i], aPathName.GetBuffer() ) )
+ break;
+
+ if ( (i == nPaths)
+ && sal_IsValidFontpath(aPathName, GetServerVendor()) )
+ {
+ pNewFontPath[nPaths] = new char[aPathName.Len()+1];
+ strcpy( pNewFontPath[nPaths++], aPathName.GetBuffer() );
+ pXLib_->SetIgnoreXErrors( TRUE ); // reset WasXError
+
+ XSetFontPath( pDisp_, pNewFontPath, nPaths );
+ XSync( pDisp_, False );
+ if( pXLib_->WasXError() )
+ delete pNewFontPath[--nPaths];
+ }
+ }
+ }
+
+ while( nPaths-- > nOriginalPaths )
+ delete pNewFontPath[ nPaths ];
+
+ delete pNewFontPath;
+ XFreeFontPath( pOldFontPath );
+
+
+ pXLib_->SetIgnoreXErrors( bOld );
+ }
+}
+
+// Events
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalDisplay::Remove( XEvent *pEvent )
+{
+}
+
+final void SalDisplay::SendEvent( Atom aEvent,
+ void *pData,
+ XLIB_Window hReceiver ) const
+{
+ UINT32 aData[5];
+
+#if __SIZEOFLONG > 4
+ aData[0] = (UINT32)((long)pData & 0xffffffff);
+ aData[1] = (UINT32)((long)pData >> 32);
+#else
+ aData[0] = (UINT32)(long)pData;
+ aData[1] = NULL;
+#endif
+ aData[2] = NULL;
+#ifndef DBG_UTIL
+ aData[3] = NULL;
+ aData[4] = NULL;
+#else
+ aData[3] = ++nIn___;
+ aData[4] = nOut___;
+#endif
+ SendEvent( aEvent, aData, hReceiver );
+}
+
+final void SalDisplay::SendEvent( Atom aEvent,
+ UINT32 *Data,
+ XLIB_Window hReceiver ) const
+{
+#define pClient (&(aClient.xclient))
+ XEvent aClient;
+
+ if( !hReceiver )
+ hReceiver = GetWindow();
+
+ pClient->type = ClientMessage;
+ pClient->display = pDisp_;
+ pClient->window = hReceiver;
+ pClient->message_type = aEvent;
+ pClient->format = 32;
+
+ if( Data ) for( int i = 0; i < 5; i++ )
+ pClient->data.l[i] = Data[i];
+
+ if( osl_acquireMutex( hEventGuard_ ) )
+ {
+ pClient->send_event = 2;
+ if( pEventQueue_ )
+ {
+ SalXEvent *pEvent = pEventQueue_;
+ while( pEvent->pNext_ )
+ pEvent = pEvent->pNext_;
+
+ pEvent->pNext_ = new SalXEvent;
+ pEvent->pNext_->event_ = aClient;
+ pEvent->pNext_->pNext_ = NULL;
+ }
+ else
+ {
+ ((SalDisplay*)this)->pEventQueue_ = new SalXEvent;
+ pEventQueue_->event_ = aClient;
+ pEventQueue_->pNext_ = NULL;
+ }
+
+ osl_releaseMutex( hEventGuard_ );
+ }
+ else
+ DBG_ASSERT( 1, "SalDisplay::SendEvent !acquireMutex\n" );
+#undef pClient
+}
+
+final BOOL SalDisplay::IsEvent()
+{
+ if( pEventQueue_ )
+ return TRUE;
+
+ if( XEventsQueued( pDisp_, QueuedAlready ) )
+ return TRUE;
+
+ XFlush( pDisp_ );
+ return FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+final void SalDisplay::Yield( BOOL bWait )
+{
+ SalXEvent aEvent;
+ while( !nStateOfYield_ )
+ {
+ if( pEventQueue_ )
+ {
+ nStateOfYield_ = 5;
+ if( osl_acquireMutex( hEventGuard_ ) )
+ {
+ nStateOfYield_ = 6;
+
+ SalXEvent *pEvent = pEventQueue_;
+
+ pEventQueue_ = pEventQueue_->pNext_;
+
+ osl_releaseMutex( hEventGuard_ );
+
+ aEvent.event_ = pEvent->event_;
+
+ delete pEvent;
+
+ break;
+ }
+ else
+ DBG_ASSERT( 1, "SalDisplay::Yield !acquireMutex\n" );
+ }
+
+ nStateOfYield_ = 1;
+
+ DBG_ASSERT( XtAppPending( pXLib_->GetAppContext() ), "no pending event" );
+ SalData *pSalData = GetSalData();
+ SalYieldMutex* pSalInstYieldMutex =
+ pSalData->pFirstInstance_->maInstData.mpSalYieldMutex;
+
+ DBG_ASSERT( pSalInstYieldMutex->GetThreadId() ==
+ NAMESPACE_VOS(OThread)::getCurrentIdentifier(),
+ "will crash soon since solar mutex not locked in SalDisplay::Yield" );
+
+ // note: alternate input is dispatched by XtAppNextEvent
+ XtAppNextEvent( pXLib_->GetAppContext(), &aEvent.event_ );
+ }
+
+ nStateOfYield_ = 0;
+
+ BOOL bIgnoreXErrors = pXLib_->GetIgnoreXErrors();
+
+ aEvent.pNext_ = pDispatchStack_;
+ pDispatchStack_ = &aEvent;
+
+ Dispatch( &aEvent.event_ );
+
+ pDispatchStack_ = aEvent.pNext_;
+
+#ifdef DBG_UTIL
+ if( pXLib_->WasXError() )
+ {
+ XFlush( pDisp_ );
+ PrintEvent( "SalDisplay::Yield (WasXError)", &aEvent.event_ );
+ }
+#endif
+
+ pXLib_->SetIgnoreXErrors( bIgnoreXErrors );
+}
+
+final long SalDisplay::Dispatch( XEvent *pEvent )
+{
+ if( pEvent->type == XLIB_KeyPress || pEvent->type == KeyRelease )
+ {
+ XLIB_Window aWindow = pEvent->xkey.window;
+ SalFrame* pFrame = NULL;
+ for( pFrame = GetSalData()->pFirstFrame_;
+ pFrame
+ && pFrame->maFrameData.GetWindow() != aWindow
+ && pFrame->maFrameData.GetShellWindow() != aWindow;
+ pFrame = pFrame->maFrameData.GetNextFrame() )
+ ;
+ if( pFrame )
+ if ( mpInputMethod->FilterEvent( pEvent ) )
+ return 0;
+ }
+ else
+ if ( mpInputMethod->FilterEvent( pEvent ) )
+ return 0;
+
+ DtIntegrator::HandleXEvent( pEvent );
+
+ switch( pEvent->type )
+ {
+ case MotionNotify:
+ while( XCheckWindowEvent( pEvent->xany.display,
+ pEvent->xany.window,
+ ButtonMotionMask,
+ pEvent ) )
+ nop;
+ break;
+
+ case MappingNotify:
+ if( MappingKeyboard == pEvent->xmapping.request )
+ XRefreshKeyboardMapping( &pEvent->xmapping );
+ else if( MappingModifier == pEvent->xmapping.request )
+ ModifierMapping();
+ break;
+
+ default:
+
+ if ( GetKbdExtension()->UseExtension()
+ && GetKbdExtension()->GetEventBase() == pEvent->type )
+ {
+ GetKbdExtension()->Dispatch( pEvent );
+ return 1;
+ }
+
+#ifdef _XSHM_H_
+ {
+ BOOL bPrevious = pXLib_->GetIgnoreXErrors();
+ pXLib_->SetIgnoreXErrors( TRUE );
+ if( pEvent->type == XShmGetEventBase( pDisp_ ) + ShmCompletion )
+ {
+ Remove( pEvent );
+ return 1;
+ }
+ pXLib_->SetIgnoreXErrors( bPrevious );
+ }
+#endif
+ break;
+ }
+
+ SalFrame *pFrame = GetSalData()->pFirstFrame_;
+
+ while( pFrame )
+ {
+ if( pFrame->maFrameData.GetWindow() == pEvent->xany.window ||
+ pFrame->maFrameData.GetShellWindow() == pEvent->xany.window )
+ {
+ return pFrame->maFrameData.Dispatch( pEvent );
+ }
+ if( pFrame->maFrameData.GetForeignParent() == pEvent->xany.window ||
+ pFrame->maFrameData.GetForeignTopLevelWindow() == pEvent->xany.window )
+ {
+ pFrame->maFrameData.Dispatch( pEvent );
+ break;
+ }
+ pFrame = pFrame->maFrameData.GetNextFrame(); // not allways NULL
+ }
+
+ // dispatch to Xt
+ XtDispatchEvent( pEvent );
+
+ // dispatch to salobjects
+ SalObjectData::Dispatch( pEvent );
+
+ return 0;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalDisplay::PrintEvent( const ByteString &rComment,
+ XEvent *pEvent ) const
+{
+ if( pEvent->type <= MappingNotify )
+ {
+ fprintf( stderr, "[%s] %s s=%d w=%ld\n",
+ rComment.GetBuffer(),
+ EventNames[pEvent->type],
+ pEvent->xany.send_event,
+ pEvent->xany.window );
+
+ switch( pEvent->type )
+ {
+ case XLIB_KeyPress:
+ case KeyRelease:
+ fprintf( stderr, "\t\ts=%d c=%d\n",
+ pEvent->xkey.state,
+ pEvent->xkey.keycode );
+ break;
+
+ case ButtonPress:
+ case ButtonRelease:
+ fprintf( stderr, "\t\ts=%d b=%d x=%d y=%d rx=%d ry=%d\n",
+ pEvent->xbutton.state,
+ pEvent->xbutton.button,
+ pEvent->xbutton.x,
+ pEvent->xbutton.y,
+ pEvent->xbutton.x_root,
+ pEvent->xbutton.y_root );
+ break;
+
+ case MotionNotify:
+ fprintf( stderr, "\t\ts=%d x=%d y=%d\n",
+ pEvent->xmotion.state,
+ pEvent->xmotion.x,
+ pEvent->xmotion.y );
+ break;
+
+ case EnterNotify:
+ case LeaveNotify:
+ fprintf( stderr, "\t\tm=%d f=%d x=%d y=%d\n",
+ pEvent->xcrossing.mode,
+ pEvent->xcrossing.focus,
+ pEvent->xcrossing.x,
+ pEvent->xcrossing.y );
+ break;
+
+ case FocusIn:
+ case FocusOut:
+ fprintf( stderr, "\t\tm=%d d=%d\n",
+ pEvent->xfocus.mode,
+ pEvent->xfocus.detail );
+ break;
+
+ case Expose:
+ case GraphicsExpose:
+ fprintf( stderr, "\t\tc=%d %d*%d %d+%d\n",
+ pEvent->xexpose.count,
+ pEvent->xexpose.width,
+ pEvent->xexpose.height,
+ pEvent->xexpose.x,
+ pEvent->xexpose.y );
+ break;
+
+ case VisibilityNotify:
+ fprintf( stderr, "\t\ts=%d\n",
+ pEvent->xvisibility.state );
+ break;
+
+ case CreateNotify:
+ case DestroyNotify:
+ break;
+
+ case MapNotify:
+ case UnmapNotify:
+ break;
+
+ case ReparentNotify:
+ fprintf( stderr, "\t\tp=%d x=%d y=%d\n",
+ pEvent->xreparent.parent,
+ pEvent->xreparent.x,
+ pEvent->xreparent.y );
+ break;
+
+ case ConfigureNotify:
+ fprintf( stderr, "\t\tb=%d %d*%d %d+%d\n",
+ pEvent->xconfigure.border_width,
+ pEvent->xconfigure.width,
+ pEvent->xconfigure.height,
+ pEvent->xconfigure.x,
+ pEvent->xconfigure.y );
+ break;
+
+ case PropertyNotify:
+ fprintf( stderr, "\t\ta=%s (0x%X)\n",
+ GetAtomName( pDisp_, pEvent->xproperty.atom ),
+ pEvent->xproperty.atom );
+ break;
+
+ case ColormapNotify:
+ fprintf( stderr, "\t\tc=%ld n=%d s=%d\n",
+ pEvent->xcolormap.colormap,
+ pEvent->xcolormap.c_new,
+ pEvent->xcolormap.state );
+ break;
+
+ case ClientMessage:
+ fprintf( stderr, "\t\ta=%s (0x%X) f=%i [0x%lX,0x%lX,0x%lX,0x%lX,0x%lX])\n",
+ GetAtomName( pDisp_, pEvent->xclient.message_type ),
+ pEvent->xclient.message_type,
+ pEvent->xclient.format,
+ pEvent->xclient.data.l[0],
+ pEvent->xclient.data.l[1],
+ pEvent->xclient.data.l[2],
+ pEvent->xclient.data.l[3],
+ pEvent->xclient.data.l[4] );
+ break;
+
+ case MappingNotify:
+ fprintf( stderr, "\t\tr=%sd\n",
+ MappingModifier == pEvent->xmapping.request
+ ? "MappingModifier"
+ : MappingKeyboard == pEvent->xmapping.request
+ ? "MappingKeyboard"
+ : "MappingPointer" );
+
+ break;
+ }
+ }
+#ifdef _XSHM_H_
+ else if( pEvent->type == XShmGetEventBase( pDisp_ ) + ShmCompletion )
+ {
+#define pCompletionEvent ((XShmCompletionEvent*)pEvent)
+ fprintf( stderr, "[%s] %s s=%d d=%ld\n",
+ rComment.GetBuffer(),
+ "ShmCompletion",
+ pCompletionEvent->send_event,
+ pCompletionEvent->drawable );
+
+ fprintf( stderr, "\t\tc=%d.%d s=%ld o=%ld\n",
+ pCompletionEvent->major_code,
+ pCompletionEvent->minor_code,
+ pCompletionEvent->shmseg,
+ pCompletionEvent->offset );
+#undef pCompletionEvent
+ }
+#endif
+ else
+ fprintf( stderr, "[%s] %d s=%d w=%ld\n",
+ rComment.GetBuffer(),
+ pEvent->type,
+ pEvent->xany.send_event,
+ pEvent->xany.window );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalDisplay::PrintInfo() const
+{
+ if( IsDisplay() )
+ {
+ fprintf( stderr, "\n" );
+ fprintf( stderr, "Environment\n" );
+ fprintf( stderr, "\t$XENVIRONMENT \t\"%s\"\n",
+ GetEnv( "XENVIRONMENT" ) );
+ fprintf( stderr, "\t$DISPLAY \t\"%s\"\n",
+ GetEnv( "DISPLAY" ) );
+ fprintf( stderr, "\t$SAL_VISUAL \t\"%s\"\n",
+ GetEnv( "SAL_VISUAL" ) );
+ fprintf( stderr, "\t$SAL_FONTPATH \t\"%s\"\n",
+ GetEnv( "SAL_FONTPATH" ) );
+ fprintf( stderr, "\t$SAL_NOSEGV \t\"%s\"\n",
+ GetEnv( "SAL_NOSEGV" ) );
+ fprintf( stderr, "\t$SAL_IGNOREXERRORS\t\"%s\"\n",
+ GetEnv( "SAL_IGNOREXERRORS" ) );
+ fprintf( stderr, "\t$SAL_PROPERTIES \t\"%s\"\n",
+ GetEnv( "SAL_PROPERTIES" ) );
+ fprintf( stderr, "\t$SAL_WM \t\"%s\"\n",
+ GetEnv( "SAL_WM" ) );
+ fprintf( stderr, "\t$SAL_SYNCHRONIZE \t\"%s\"\n",
+ GetEnv( "SAL_SYNCHRONIZE" ) );
+ fprintf( stderr, "\t$XPPATH \t\"%s\"\n",
+ GetEnv( "XPPATH" ) );
+
+ char sHostname[ 120 ];
+# ifdef USE_XMU
+ XmuGetHostname( sHostname, 120 );
+# else
+ gethostname (sHostname, 120 );
+# endif
+ fprintf( stderr, "Client\n" );
+ fprintf( stderr, "\tHost \t\"%s\"\n",
+ sHostname );
+
+ fprintf( stderr, "Display\n" );
+ fprintf( stderr, "\tHost \t\"%s\"\n",
+ DisplayString(pDisp_) );
+ fprintf( stderr, "\tVendor (Release) \t\"%s (%d)\"\n",
+ ServerVendor(pDisp_), VendorRelease(pDisp_) );
+ fprintf( stderr, "\tProtocol \t%d.%d\n",
+ ProtocolVersion(pDisp_), ProtocolRevision(pDisp_) );
+ fprintf( stderr, "\tScreen (count,def)\t%d (%d,%d)\n",
+ nScreen_, ScreenCount(pDisp_), DefaultScreen(pDisp_) );
+ fprintf( stderr, "\tshift ctrl alt \t%s (0x%X) %s (0x%X) %s (0x%X)\n",
+ KeyStr( nShiftKeySym_ ), nShiftKeySym_,
+ KeyStr( nCtrlKeySym_ ), nCtrlKeySym_,
+ KeyStr( nMod1KeySym_ ), nMod1KeySym_ );
+ if( XExtendedMaxRequestSize(pDisp_) * 4 )
+ fprintf( stderr, "\tXMaxRequestSize \t%ld %ld [bytes]\n",
+ XMaxRequestSize(pDisp_) * 4, XExtendedMaxRequestSize(pDisp_) * 4 );
+ if( GetProperties() != PROPERTY_DEFAULT )
+ fprintf( stderr, "\tProperties \t0x%lX\n", GetProperties() );
+ if( eWindowManager_ != otherwm )
+ fprintf( stderr, "\tWindowmanager \t%d\n", eWindowManager_ );
+ }
+ fprintf( stderr, "Screen\n" );
+ fprintf( stderr, "\tResolution/Size \t%d*%d %d*%d %.1lf\"\n",
+ aResolution_.A(), aResolution_.B(),
+ aSize_.Width(), aSize_.Height(),
+ Hypothenuse( DisplayWidthMM ( pDisp_, nScreen_ ),
+ DisplayHeightMM( pDisp_, nScreen_ ) ) / 25.4 );
+ fprintf( stderr, "\tBlack&White \t%lu %lu\n",
+ xColor_->GetBlackPixel(), xColor_->GetWhitePixel() );
+ fprintf( stderr, "\tRGB \t0x%lx 0x%lx 0x%lx\n",
+ pVisual_->red_mask, pVisual_->green_mask, pVisual_->blue_mask );
+ fprintf( stderr, "\tVisual \t%d-bit %s ID=0x%x\n",
+ pVisual_->GetDepth(),
+ VisualClassName[ pVisual_->GetClass() ],
+ pVisual_->GetVisualId() );
+ if( pVisual_ != pRootVisual_ )
+ fprintf( stderr, "\tRoot visual \t%d-bit %s ID=0x%x\n",
+ pRootVisual_->GetDepth(),
+ VisualClassName[ pRootVisual_->GetClass() ],
+ pRootVisual_->GetVisualId() );
+ fprintf( stderr, "\tImages (Shared) \t0x%lx (%lx)\n",
+ nImageDepths_, nSharedImages_ );
+
+ if( nStateOfYield_ || nStateOfSendEvent_ )
+ {
+ fprintf( stderr, "Thread/Signal\n" );
+ fprintf( stderr, "\tNextEvent \t%d\n", nStateOfYield_ );
+ fprintf( stderr, "\tSendEvent \t%d\n", nStateOfSendEvent_ );
+ }
+ if( pDispatchStack_ )
+ {
+ fprintf( stderr, "Event\n" );
+ SalXEvent *pEvent = pDispatchStack_;
+ while( pEvent )
+ {
+ PrintEvent( "\t\x08\x08", &pEvent->event_ );
+ pEvent = pEvent->pNext_;
+ }
+ }
+}
+
+// -=-= SalICCCM -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final
+SalICCCM::SalICCCM( SalDisplay *pDisplay )
+{
+ Display *display = pDisplay->GetDisplay();
+
+ for( int i = 0; i < capacityof( AtomStrings ); i++ )
+ (&aWM_Protocols_)[i] = XInternAtom( display, AtomStrings[i], False );
+}
+
+// -=-= SalVisual -=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+SalVisual::SalVisual( const XVisualInfo* pXVI )
+{
+ *(XVisualInfo*)this = *pXVI;
+ if( GetClass() == TrueColor )
+ {
+ nRedShift_ = sal_Shift( red_mask );
+ nGreenShift_ = sal_Shift( green_mask );
+ nBlueShift_ = sal_Shift( blue_mask );
+
+ if( GetDepth() == 24 )
+ if( red_mask == 0xFF0000 )
+ if( green_mask == 0xFF00 )
+ if( blue_mask == 0xFF )
+ eRGBMode_ = RGB;
+ else
+ eRGBMode_ = other;
+ else if( blue_mask == 0xFF00 )
+ if( green_mask == 0xFF )
+ eRGBMode_ = RBG;
+ else
+ eRGBMode_ = other;
+ else
+ eRGBMode_ = other;
+ else if( green_mask == 0xFF0000 )
+ if( red_mask == 0xFF00 )
+ if( blue_mask == 0xFF )
+ eRGBMode_ = GRB;
+ else
+ eRGBMode_ = other;
+ else if( blue_mask == 0xFF00 )
+ if( red_mask == 0xFF )
+ eRGBMode_ = GBR;
+ else
+ eRGBMode_ = other;
+ else
+ eRGBMode_ = other;
+ else if( blue_mask == 0xFF0000 )
+ if( red_mask == 0xFF00 )
+ if( green_mask == 0xFF )
+ eRGBMode_ = BRG;
+ else
+ eRGBMode_ = other;
+ else if( green_mask == 0xFF00 )
+ if( red_mask == 0xFF )
+ eRGBMode_ = BGR;
+ else
+ eRGBMode_ = other;
+ else
+ eRGBMode_ = other;
+ else
+ eRGBMode_ = other;
+ else
+ eRGBMode_ = other;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+SalVisual::~SalVisual()
+{
+ if( -1 == screen && -1 == visualid ) delete visual;
+}
+
+// Konvertiert die Reihenfolge der Bytes eines Pixel in Bytes eines SalColors
+// fuer die 6 XXXA ist das nicht reversibel
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// SalColor is RGB (ABGR) a=0xFF000000, r=0xFF0000, g=0xFF00, b=0xFF
+
+#define SALCOLOR RGB
+#define SALCOLORREVERSE BGR
+
+BOOL SalVisual::Convert( int &n0, int &n1, int &n2, int &n3 )
+{
+ int n;
+
+ switch( GetMode() )
+ {
+ case other:
+ return FALSE;
+ break;
+ case SALCOLOR:
+ break;
+ case SALCOLORREVERSE:
+ case RBG:
+ case BRG:
+ case GBR:
+ case GRB:
+ return Convert( n0, n1, n2 );
+ break;
+ case RGBA:
+ n = n0;
+ n0 = n1;
+ n1 = n2;
+ n2 = n3;
+ n3 = n;
+ break;
+ case BGRA:
+ case RBGA:
+ case BRGA:
+ case GBRA:
+ case GRBA:
+ default:
+ fprintf( stderr, "SalVisual::Convert %d\n", GetMode() );
+ abort();
+ break;
+ }
+ return TRUE;
+}
+
+BOOL SalVisual::Convert( int &n0, int &n1, int &n2 )
+{
+ int n;
+
+ switch( GetMode() )
+ {
+ case other:
+ return FALSE;
+ break;
+ case SALCOLOR:
+ break;
+ case RBG:
+ n = n0;
+ n0 = n1;
+ n1 = n;
+ break;
+ case GRB:
+ n = n1;
+ n1 = n2;
+ n2 = n;
+ break;
+ case SALCOLORREVERSE:
+ n = n0;
+ n0 = n2;
+ n2 = n;
+ break;
+ case BRG:
+ n = n0;
+ n0 = n1;
+ n1 = n2;
+ n2 = n;
+ break;
+ case GBR:
+ n = n2;
+ n2 = n1;
+ n1 = n0;
+ n0 = n;
+ break;
+ default:
+ fprintf( stderr, "SalVisual::Convert %d\n", GetMode() );
+ abort();
+ break;
+ }
+ return TRUE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalColor SalVisual::GetTCColor( Pixel nPixel ) const
+{
+ if( SALCOLOR == eRGBMode_ )
+ return (SalColor)nPixel;
+
+ if( SALCOLORREVERSE == eRGBMode_ )
+ return MAKE_SALCOLOR( (nPixel & 0x0000FF),
+ (nPixel & 0x00FF00) >> 8,
+ (nPixel & 0xFF0000) >> 16);
+
+ Pixel r = nPixel & red_mask;
+ Pixel g = nPixel & green_mask;
+ Pixel b = nPixel & blue_mask;
+
+ if( other != eRGBMode_ ) // 8+8+8=24
+ return MAKE_SALCOLOR( r >> nRedShift_,
+ g >> nGreenShift_,
+ b >> nBlueShift_ );
+
+ if( nRedShift_ > 0 ) r >>= nRedShift_; else r <<= -nRedShift_;
+ if( nGreenShift_ > 0 ) g >>= nGreenShift_; else g <<= -nGreenShift_;
+ if( nBlueShift_ > 0 ) b >>= nBlueShift_; else b <<= -nBlueShift_;
+
+ return MAKE_SALCOLOR( r, g, b );
+}
+
+final Pixel SalVisual::GetTCPixel( SalColor nSalColor ) const
+{
+ if( SALCOLOR == eRGBMode_ )
+ return (Pixel)nSalColor;
+
+ Pixel r = (Pixel)SALCOLOR_RED( nSalColor );
+ Pixel g = (Pixel)SALCOLOR_GREEN( nSalColor );
+ Pixel b = (Pixel)SALCOLOR_BLUE( nSalColor );
+
+ if( SALCOLORREVERSE == eRGBMode_ )
+ return (b << 16) | (g << 8) | (r);
+
+ if( other != eRGBMode_ ) // 8+8+8=24
+ return (r << nRedShift_) | (g << nGreenShift_) | (b << nBlueShift_);
+
+ if( nRedShift_ > 0 ) r <<= nRedShift_; else r >>= -nRedShift_;
+ if( nGreenShift_ > 0 ) g <<= nGreenShift_; else g >>= -nGreenShift_;
+ if( nBlueShift_ > 0 ) b <<= nBlueShift_; else b >>= -nBlueShift_;
+
+ return (r&red_mask) | (g&green_mask) | (b&blue_mask);
+}
+
+// -=-= SalColormap -=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalColormap::SalColormap( SalDisplay *pDisplay, Colormap hColormap )
+ : pDisplay_( pDisplay ),
+ hColormap_( hColormap ),
+ pPalette_( NULL ),
+ pLookupTable_( NULL )
+{
+ pVisual_ = pDisplay_->GetVisual();
+
+ if( pVisual_ == pDisplay_->GetRootVisual() )
+ {
+ nBlackPixel_ = BlackPixel( pDisplay_->GetDisplay(),
+ pDisplay_->GetScreenNumber() );
+ nWhitePixel_ = WhitePixel( pDisplay_->GetDisplay(),
+ pDisplay_->GetScreenNumber() );
+ }
+ else
+ {
+ XColor aColor;
+
+ GetXPixel( aColor, 0x00, 0x00, 0x00 );
+ nBlackPixel_ = aColor.pixel;
+
+ GetXPixel( aColor, 0xFF, 0xFF, 0xFF );
+ nWhitePixel_ = aColor.pixel;
+ }
+
+ nUsed_ = 1 << pVisual_->GetDepth();
+
+ if( pVisual_->GetClass() == PseudoColor )
+ {
+ XColor aColor;
+ int r, g, b;
+
+ // black, white, gray, ~gray = 4
+ GetXPixels( aColor, 0xC0, 0xC0, 0xC0 );
+
+ // light colors: 3 * 2 = 6
+// GetXPixels( aColor, 0x00, 0x00, 0x00 );
+ GetXPixels( aColor, 0x00, 0x00, 0xFF );
+ GetXPixels( aColor, 0x00, 0xFF, 0x00 );
+ GetXPixels( aColor, 0x00, 0xFF, 0xFF );
+// GetXPixels( aColor, 0xFF, 0x00, 0x00 );
+// GetXPixels( aColor, 0xFF, 0x00, 0xFF );
+// GetXPixels( aColor, 0xFF, 0xFF, 0x00 );
+// GetXPixels( aColor, 0xFF, 0xFF, 0xFF );
+
+ // standard colors: 7 * 2 = 14
+// GetXPixels( aColor, 0x00, 0x00, 0x00 );
+ GetXPixels( aColor, 0x00, 0x00, 0x80 );
+ GetXPixels( aColor, 0x00, 0x80, 0x00 );
+ GetXPixels( aColor, 0x00, 0x80, 0x80 );
+ GetXPixels( aColor, 0x80, 0x00, 0x00 );
+ GetXPixels( aColor, 0x80, 0x00, 0x80 );
+ GetXPixels( aColor, 0x80, 0x80, 0x00 );
+ GetXPixels( aColor, 0x80, 0x80, 0x80 );
+ GetXPixels( aColor, 0x00, 0xB8, 0xFF ); // Blau 7
+
+ // cube: 6*6*6 - 8 = 208
+ for( r = 0; r < 0x100; r += 0x33 ) // 0x33, 0x66, 0x99, 0xCC, 0xFF
+ for( g = 0; g < 0x100; g += 0x33 )
+ for( b = 0; b < 0x100; b += 0x33 )
+ GetXPixels( aColor, r, g, b );
+
+ // gray: 16 - 6 = 10
+ for( g = 0x11; g < 0xFF; g += 0x11 )
+ GetXPixels( aColor, g, g, g );
+
+ // green: 16 - 6 = 10
+ for( g = 0x11; g < 0xFF; g += 0x11 )
+ GetXPixels( aColor, 0, g, 0 );
+
+ // red: 16 - 6 = 10
+ for( r = 0x11; r < 0xFF; r += 0x11 )
+ GetXPixels( aColor, r, 0, 0 );
+
+ // blue: 16 - 6 = 10
+ for( b = 0x11; b < 0xFF; b += 0x11 )
+ GetXPixels( aColor, 0, 0, b );
+ }
+}
+
+// PseudoColor
+final SalColormap::SalColormap( const BitmapPalette &rPalette )
+ : pDisplay_( GetSalData()->GetCurDisp() ),
+ hColormap_( None ),
+ pVisual_( NULL ),
+ nUsed_( rPalette.GetEntryCount() ),
+ nBlackPixel_( 0xFFFFFFFF ),
+ nWhitePixel_( 0xFFFFFFFF ),
+ pLookupTable_( NULL )
+{
+ pPalette_ = new SalColor[nUsed_];
+
+ for( int i = 0; i < nUsed_; i++ )
+ {
+ const BitmapColor &rColor = rPalette[i];
+ pPalette_[i] = MAKE_SALCOLOR( rColor.GetRed(),
+ rColor.GetGreen(),
+ rColor.GetBlue() );
+ if( nBlackPixel_ == 0xFFFFFFFF && SALCOLOR_BLACK == pPalette_[i] )
+ nBlackPixel_ = i;
+ else if( nWhitePixel_ == 0xFFFFFFFF && SALCOLOR_WHITE == pPalette_[i] )
+ nWhitePixel_ = i;
+ }
+}
+
+// MonoChrome
+final SalColormap::SalColormap()
+ : pDisplay_( GetSalData()->GetCurDisp() ),
+ hColormap_( None ),
+ pVisual_( NULL ),
+ nUsed_( 2 ),
+ nBlackPixel_( 0 ),
+ nWhitePixel_( 1 ),
+ pLookupTable_( NULL )
+{
+ pPalette_ = new SalColor[nUsed_];
+
+ pPalette_[nBlackPixel_] = SALCOLOR_BLACK;
+ pPalette_[nWhitePixel_] = SALCOLOR_WHITE;
+}
+
+// TrueColor
+final SalColormap::SalColormap( USHORT nDepth )
+ : pDisplay_( GetSalData()->GetCurDisp() ),
+ hColormap_( None ),
+ pPalette_( NULL ),
+ nUsed_( 1 << nDepth ),
+ nWhitePixel_( (1 << nDepth) - 1 ),
+ nBlackPixel_( 0x00000000 ),
+ pLookupTable_( NULL )
+
+{
+ SalVisual *pVisual = pDisplay_->GetVisual();
+
+ if( pVisual->GetClass() == TrueColor && pVisual->GetDepth() == nDepth )
+ pVisual_ = pVisual;
+ else
+ {
+ XVisualInfo aVI;
+
+ if( !XMatchVisualInfo( pDisplay_->GetDisplay(),
+ pDisplay_->GetScreenNumber(),
+ nDepth,
+ TrueColor,
+ &aVI ) )
+ {
+ aVI.visual = new Visual();
+ aVI.visualid = (VisualID)-1;
+ aVI.screen = -1;
+ aVI.depth = nDepth;
+ aVI.c_class = TrueColor;
+ if( 24 == nDepth ) // 888
+ {
+ aVI.red_mask = 0xFF0000;
+ aVI.green_mask = 0x00FF00;
+ aVI.blue_mask = 0x0000FF;
+ }
+ else if( 16 == nDepth ) // 565
+ {
+ aVI.red_mask = 0x00F800;
+ aVI.green_mask = 0x0007E0;
+ aVI.blue_mask = 0x00001F;
+ }
+ else if( 15 == nDepth ) // 555
+ {
+ aVI.red_mask = 0x007C00;
+ aVI.green_mask = 0x0003E0;
+ aVI.blue_mask = 0x00001F;
+ }
+ else if( 12 == nDepth ) // 444
+ {
+ aVI.red_mask = 0x000F00;
+ aVI.green_mask = 0x0000F0;
+ aVI.blue_mask = 0x00000F;
+ }
+ else if( 8 == nDepth ) // 332
+ {
+ aVI.red_mask = 0x0000E0;
+ aVI.green_mask = 0x00001C;
+ aVI.blue_mask = 0x000003;
+ }
+ else
+ {
+ aVI.red_mask = 0x000000;
+ aVI.green_mask = 0x000000;
+ aVI.blue_mask = 0x000000;
+ }
+ aVI.colormap_size = 0;
+ aVI.bits_per_rgb = 8;
+
+ aVI.visual->ext_data = NULL;
+ aVI.visual->visualid = aVI.visualid;
+ aVI.visual->c_class = aVI.c_class;
+ aVI.visual->red_mask = aVI.red_mask;
+ aVI.visual->green_mask = aVI.green_mask;
+ aVI.visual->blue_mask = aVI.blue_mask;
+ aVI.visual->bits_per_rgb = aVI.bits_per_rgb;
+ aVI.visual->map_entries = aVI.colormap_size;
+ }
+
+ pVisual_ = new SalVisual( &aVI );
+ }
+}
+
+final SalColormap::~SalColormap()
+{
+ if( hColormap_
+ && pDisplay_->IsDisplay()
+ && hColormap_ != DefaultColormap( GetXDisplay(), pDisplay_->GetScreenNumber() ) )
+ XFreeColormap( GetXDisplay(), hColormap_ );
+ delete pPalette_;
+ delete pLookupTable_;
+ if( pVisual_ != pDisplay_->GetVisual() )
+ delete pVisual_;
+
+#ifdef DBG_UTIL
+ hColormap_ = (Colormap)ILLEGAL_POINTER;
+ pDisplay_ = (SalDisplay*)ILLEGAL_POINTER;
+ pPalette_ = (SalColor*)ILLEGAL_POINTER;
+ pLookupTable_ = (USHORT*)ILLEGAL_POINTER;
+ pVisual_ = (SalVisual*)ILLEGAL_POINTER;
+#endif
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalColormap::SetPalette( const BitmapPalette &rPalette )
+{
+ if( this != &GetSalData()->GetCurDisp()->GetColormap() )
+ {
+ nBlackPixel_ = 0xFFFFFFFF;
+ nWhitePixel_ = 0xFFFFFFFF;
+ }
+
+ if( rPalette.GetEntryCount() > nUsed_ )
+ {
+ nBlackPixel_ = 0xFFFFFFFF;
+ nWhitePixel_ = 0xFFFFFFFF;
+ delete pPalette_;
+ pPalette_ = new SalColor[rPalette.GetEntryCount()];
+ nUsed_ = rPalette.GetEntryCount();
+ }
+
+ for( int i = 0; i < rPalette.GetEntryCount(); i++ )
+ {
+ const BitmapColor &rColor = rPalette[i];
+ pPalette_[i] = MAKE_SALCOLOR( rColor.GetRed(),
+ rColor.GetGreen(),
+ rColor.GetBlue() );
+ if( nBlackPixel_ == 0xFFFFFFFF && SALCOLOR_BLACK == pPalette_[i] )
+ nBlackPixel_ = i;
+ else if( nWhitePixel_ == 0xFFFFFFFF && SALCOLOR_WHITE == pPalette_[i] )
+ nWhitePixel_ = i;
+ }
+}
+
+final void SalColormap::GetPalette()
+{
+ Pixel i;
+
+ pPalette_ = new SalColor[nUsed_];
+
+ XColor *aColor = new XColor[nUsed_];
+
+ for( i = 0; i < nUsed_; i++ )
+ {
+ aColor[i].red = aColor[i].green = aColor[i].blue = 0;
+ aColor[i].pixel = i;
+ }
+
+ XQueryColors( pDisplay_->GetDisplay(), hColormap_, aColor, nUsed_ );
+
+ for( i = 0; i < nUsed_; i++ )
+ {
+ pPalette_[i] = MAKE_SALCOLOR( aColor[i].red >> 8,
+ aColor[i].green >> 8,
+ aColor[i].blue >> 8 );
+ }
+
+ delete aColor;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final static USHORT sal_Lookup( SalColor *pPalette,
+ int r, int g, int b,
+ Pixel nUsed )
+{
+ USHORT nPixel = 0;
+ int nBest = ColorDiff( pPalette[0], r, g, b );
+
+ for( USHORT i = 1; i < nUsed; i++ )
+ {
+ int n = ColorDiff( pPalette[i], r, g, b );
+
+ if( n < nBest )
+ {
+ if( !n )
+ return i;
+
+ nPixel = i;
+ nBest = n;
+ }
+ }
+ return nPixel;
+}
+
+final void SalColormap::GetLookupTable()
+{
+ USHORT *p = pLookupTable_ = new USHORT[16*16*16];
+
+ for( int r = 0; r < 256; r += 17 )
+ for( int g = 0; g < 256; g += 17 )
+ for( int b = 0; b < 256; b += 17 )
+ *p++ = sal_Lookup( pPalette_, r, g, b, nUsed_ );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalColor SalColormap::GetColor( Pixel nPixel ) const
+{
+ if( nBlackPixel_ == nPixel ) return SALCOLOR_BLACK;
+ if( nWhitePixel_ == nPixel ) return SALCOLOR_WHITE;
+
+ if( pVisual_ )
+ {
+ if( pVisual_->GetClass() == TrueColor )
+ return pVisual_->GetTCColor( nPixel );
+
+ if( !pPalette_
+ && ( hColormap_ || XSalIsPrinter( GetXDisplay() ) )
+#ifdef PSEUDOCOLOR12
+ && pVisual_->GetDepth() <= 12
+#else
+ && pVisual_->GetDepth() <= 8
+#endif
+ && pVisual_->GetClass() == PseudoColor )
+ ((SalColormap*)this)->GetPalette();
+ }
+
+ if( pPalette_ && nPixel < nUsed_ )
+ return pPalette_[nPixel];
+
+ if( !hColormap_ && !XSalIsPrinter( GetXDisplay() ) )
+ {
+ DBG_ASSERT( 1, "SalColormap::GetColor() !hColormap_\n" );
+ return nPixel;
+ }
+
+ // DirectColor, StaticColor, StaticGray, GrayScale
+ XColor aColor;
+
+ aColor.pixel = nPixel;
+
+ XQueryColor( pDisplay_->GetDisplay(), hColormap_, &aColor );
+
+ return MAKE_SALCOLOR( aColor.red>>8, aColor.green>>8, aColor.blue>>8 );
+}
+
+final inline BOOL SalColormap::GetXPixel( XColor &rColor,
+ int r,
+ int g,
+ int b ) const
+{
+ rColor.red = r * 257;
+ rColor.green = g * 257;
+ rColor.blue = b * 257;
+ return XAllocColor( GetXDisplay(), hColormap_, &rColor );
+}
+
+final BOOL SalColormap::GetXPixels( XColor &rColor,
+ int r,
+ int g,
+ int b ) const
+{
+ if( !GetXPixel( rColor, r, g, b ) )
+ return FALSE;
+ if( rColor.pixel & 1 )
+ return TRUE;
+ return GetXPixel( rColor, r^0xFF, g^0xFF, b^0xFF );
+}
+
+final Pixel SalColormap::GetPixel( SalColor nSalColor ) const
+{
+ if( 0xFFFFFFFF == nSalColor ) return 0;
+ if( SALCOLOR_BLACK == nSalColor ) return nBlackPixel_;
+ if( SALCOLOR_WHITE == nSalColor ) return nWhitePixel_;
+
+ if( pVisual_ && pVisual_->GetClass() == TrueColor )
+ return pVisual_->GetTCPixel( nSalColor );
+
+ if( !pLookupTable_ )
+ {
+ if( !pPalette_
+ && ( hColormap_ || XSalIsPrinter( GetXDisplay() ) )
+ && pVisual_
+#ifdef PSEUDOCOLOR12
+ && pVisual_->GetDepth() <= 12
+#else
+ && pVisual_->GetDepth() <= 8
+#endif
+ && pVisual_->GetClass() == PseudoColor ) // what else ???
+ ((SalColormap*)this)->GetPalette();
+
+ if( pPalette_ )
+ for( Pixel i = 0; i < nUsed_; i++ )
+ if( pPalette_[i] == nSalColor )
+ return i;
+
+ if( hColormap_ || XSalIsPrinter( GetXDisplay() ) )
+ {
+ // DirectColor, StaticColor, StaticGray, GrayScale (PseudoColor)
+ XColor aColor;
+
+ if( GetXPixel( aColor,
+ SALCOLOR_RED ( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE ( nSalColor ) ) )
+ {
+ if( pPalette_ && !pPalette_[aColor.pixel] )
+ {
+ pPalette_[aColor.pixel] = nSalColor;
+
+ if( !(aColor.pixel & 1) && !pPalette_[aColor.pixel+1] )
+ {
+ XColor aInversColor;
+
+ SalColor nInversColor = nSalColor ^ 0xFFFFFF;
+
+ GetXPixel( aInversColor,
+ SALCOLOR_RED ( nInversColor ),
+ SALCOLOR_GREEN( nInversColor ),
+ SALCOLOR_BLUE ( nInversColor ) );
+
+ if( !pPalette_[aInversColor.pixel] )
+ pPalette_[aInversColor.pixel] = nInversColor;
+#ifdef DBG_UTIL
+ else
+ fprintf( stderr, "SalColormap::GetPixel() 0x06lx=%d 0x06lx=%d\n",
+ nSalColor, aColor.pixel,
+ nInversColor, aInversColor.pixel);
+#endif
+ }
+ }
+
+ return aColor.pixel;
+ }
+
+#ifdef DBG_UTIL
+ fprintf( stderr, "SalColormap::GetPixel() !XAllocColor %lx\n",
+ nSalColor );
+#endif
+ }
+
+ if( !pPalette_ )
+ {
+ fprintf( stderr, "SalColormap::GetPixel() !pPalette_ %lx\n",
+ nSalColor);
+ return nSalColor;
+ }
+
+ ((SalColormap*)this)->GetLookupTable();
+ }
+
+ // Colormatching ueber Palette
+ USHORT r = SALCOLOR_RED ( nSalColor );
+ USHORT g = SALCOLOR_GREEN( nSalColor );
+ USHORT b = SALCOLOR_BLUE ( nSalColor );
+ return pLookupTable_[ (((r+8)/17) << 8)
+ + (((g+8)/17) << 4)
+ + ((b+8)/17) ];
+}
+
diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx
new file mode 100644
index 000000000000..374ab09a94df
--- /dev/null
+++ b/vcl/unx/source/app/salinst.cxx
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALINST_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <salunx.h>
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+#ifndef _SV_SALATYPE_HXX
+#include <salatype.hxx>
+#endif
+#ifndef _SV_DTINT_HXX
+#include <dtint.hxx>
+#endif
+#ifndef _SV_SALPRN_H
+#include <salprn.h>
+#endif
+#ifndef _VCL_SALCONFIG_HXX
+#include <salconfig.hxx>
+#endif
+
+// -=-= C++ globals =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+void SalAbort( const XubString& rErrorText )
+{
+ if( !rErrorText.Len() )
+ fprintf( stderr, "Application Error" );
+ else
+ fprintf( stderr, ByteString( rErrorText, gsl_getSystemTextEncoding() ).GetBuffer() );
+ abort();
+}
+
+
+// -------------------------------------------------------------------------
+//
+// SalYieldMutex
+//
+// -------------------------------------------------------------------------
+
+SalYieldMutex::SalYieldMutex()
+{
+ mnCount = 0;
+ mnThreadId = 0;
+}
+
+void SalYieldMutex::acquire()
+{
+ OMutex::acquire();
+ mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnCount++;
+}
+
+void SalYieldMutex::release()
+{
+ if ( mnThreadId == NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ if ( mnCount == 1 )
+ mnThreadId = 0;
+ mnCount--;
+ }
+ OMutex::release();
+}
+
+sal_Bool SalYieldMutex::tryToAcquire()
+{
+ if ( OMutex::tryToAcquire() )
+ {
+ mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnCount++;
+ return True;
+ }
+ else
+ return False;
+}
+
+//----------------------------------------------------------------------------
+
+final void InitSalData()
+{
+ SalData *pSalData = new SalData;
+ SetSalData( pSalData );
+}
+
+final void DeInitSalData()
+{
+ SalData *pSalData = GetSalData();
+ delete pSalData;
+ SetSalData( NULL );
+}
+
+final void SetFilterCallback( void* pCallback, void* pInst )
+{
+ SalData* pSalData = GetSalData();
+
+ pSalData->pFirstInstance_->maInstData.mpFilterCallback = pCallback;
+ pSalData->pFirstInstance_->maInstData.mpFilterInst = pInst;
+}
+
+final SalInstance *CreateSalInstance()
+{
+ SalData *pSalData = GetSalData();
+ SalInstance *pInst = new SalInstance;
+
+ // init instance (only one instance in this version !!!)
+ pSalData->pFirstInstance_ = pInst;
+
+ StartPrinterListening();
+
+ return pInst;
+}
+
+final void DestroySalInstance( SalInstance *pInst )
+{
+ SalData *pSalData = GetSalData();
+
+ // reset instance (only one instance in this version !!!)
+ if( pSalData->pFirstInstance_ == pInst )
+ {
+ StopPrinterListening();
+ pSalData->pFirstInstance_ = NULL;
+ ::vcl_sal::XpDefaults::release();
+ }
+
+ delete pInst;
+}
+
+// -=-= SalInstance =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalInstance::SalInstance()
+{
+ maInstData.mpFilterCallback = NULL;
+ maInstData.mpFilterInst = NULL;
+ maInstData.mpSalYieldMutex = new SalYieldMutex;
+ maInstData.mpSalYieldMutex->acquire();
+}
+
+final SalInstance::~SalInstance()
+{
+// #75711# - java is running
+ maInstData.mpSalYieldMutex->release();
+ delete maInstData.mpSalYieldMutex;
+}
+
+
+// --------------------------------------------------------
+// AnyInput from sv/mow/source/app/svapp.cxx
+
+struct PredicateReturn
+{
+ USHORT nType;
+ BOOL bRet;
+};
+
+Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData )
+{
+ PredicateReturn *pPre = (PredicateReturn *)pData;
+
+ if ( pPre->bRet )
+ return False;
+
+ USHORT nType;
+
+ switch( pEvent->type )
+ {
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify:
+ case LeaveNotify:
+ nType = INPUT_MOUSE;
+ break;
+
+ case XLIB_KeyPress:
+ //case KeyRelease:
+ nType = INPUT_KEYBOARD;
+ break;
+ case Expose:
+ case GraphicsExpose:
+ case NoExpose:
+ nType = INPUT_PAINT;
+ break;
+ default:
+ nType = 0;
+ }
+
+ if ( nType & pPre->nType || ( ! nType && pPre->nType & INPUT_OTHER ) )
+ pPre->bRet = TRUE;
+
+ return False;
+}
+
+
+alpha BOOL SalInstance::AnyInput(USHORT nType)
+{
+ SalData *pSalData = GetSalData();
+ Display *pDisplay = pSalData->GetDefDisp()->GetDisplay();
+
+ // XtInputMask nMask = XtAppPending( SVData().GetAppContext() );
+ // if( nMask )
+ if (XPending(pDisplay) )
+ {
+ // if ( INPUT_TIMER & nType && XtIMTimer & nMask )
+ // return TRUE;
+ // else
+ {
+ PredicateReturn aInput;
+ XEvent aEvent;
+
+ aInput.bRet = FALSE;
+ aInput.nType = nType;
+
+ XCheckIfEvent(pDisplay, &aEvent, ImplPredicateEvent,
+ (char *)&aInput );
+
+ return aInput.bRet;
+ }
+ }
+ return FALSE ;
+}
+
+#ifdef _VOS_NO_NAMESPACE
+IMutex* SalInstance::GetYieldMutex()
+#else
+vos::IMutex* SalInstance::GetYieldMutex()
+#endif
+{
+ return maInstData.mpSalYieldMutex;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInstance::ReleaseYieldMutex()
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->GetThreadId() ==
+ NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ {
+ ULONG nCount = pYieldMutex->GetAcquireCount();
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+
+ return nCount;
+ }
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::AcquireYieldMutex( ULONG nCount )
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ while ( nCount )
+ {
+ pYieldMutex->acquire();
+ nCount--;
+ }
+}
+
+final void SalInstance::Yield( BOOL bWait )
+{ GetSalData()->GetLib()->Yield( bWait ); }
+
diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx
new file mode 100644
index 000000000000..47f855ce365a
--- /dev/null
+++ b/vcl/unx/source/app/salsys.cxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALSYS_CXX
+
+#include <cstdio>
+#include <string>
+
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _SV_DTINT_HXX
+#include <dtint.hxx>
+#endif
+#include <salframe.hxx>
+
+#include <strhelper.hxx>
+#include <stacktrace.hxx>
+
+
+void SalSystemData::CreateDtIntegrator( SalFrame* pNewFrame )
+{
+ if( pNewFrame )
+ {
+ if( m_pDtIntegrator && m_pDtIntegrator->GetDisplay() !=
+ pNewFrame->maFrameData.GetDisplay()->GetDisplay() )
+ {
+ m_pDtIntegrator->Release();
+ m_pDtIntegrator = 0;
+ }
+ if( ! m_pDtIntegrator )
+ {
+ m_pDtIntegrator = DtIntegrator::CreateDtIntegrator( pNewFrame );
+ m_pDtIntegrator->Acquire();
+ }
+ }
+}
+
+void SalSystemData::SetSalDisplay( SalDisplay *pSalDisplay )
+{
+ m_pSalDisplay = pSalDisplay;
+}
+
+SalSystemData::~SalSystemData()
+{
+ if( m_pDtIntegrator )
+ m_pDtIntegrator->Release();
+}
+
+
+// -----------------------------------------------------------------------
+
+SalSystem* SalInstance::CreateSystem()
+{
+ return new SalSystem();
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroySystem( SalSystem* pSystem )
+{
+ delete pSystem;
+}
+
+// =======================================================================
+
+SalSystem::SalSystem()
+{
+ maSystemData.m_pSalDisplay = 0;
+ maSystemData.m_pDtIntegrator = 0;
+}
+
+// -----------------------------------------------------------------------
+
+SalSystem::~SalSystem()
+{
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::StartProcess( SalFrame* pFrame, const String& rFileName,
+ const String& rParam,
+ const String& rWorkingDirectory )
+{
+ maSystemData.CreateDtIntegrator( pFrame );
+
+ XubString aFileName( '\"' );
+ aFileName += rFileName;
+ aFileName += '\"';
+
+ // StartProcess is desktop specific
+ return maSystemData.m_pDtIntegrator->
+ StartProcess( aFileName,
+ const_cast<XubString&>(rParam),
+ const_cast<XubString&>(rWorkingDirectory) );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalSystem::AddRecentDoc( SalFrame* pFrame, const XubString& rFileName )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+String SalSystem::GetSummarySystemInfos( ULONG nFlags )
+{
+ sal_PostMortem aPostMortem;
+
+ /*
+ * unimplemented flags:
+ * SALSYSTEM_GETSYSTEMINFO_MODULES
+ * SALSYSTEM_GETSYSTEMINFO_MOUSEINFO
+ * SALSYSTEM_GETSYSTEMINFO_SYSTEMDIRS
+ * SALSYSTEM_GETSYSTEMINFO_LOCALVOLUMES
+ */
+
+ ByteString aRet;
+ if( nFlags & SALSYSTEM_GETSYSTEMINFO_SYSTEMVERSION )
+ aRet += aPostMortem.getSystemInfo();
+ if( nFlags & SALSYSTEM_GETSYSTEMINFO_CPUTYPE )
+ aRet += aPostMortem.getProcessorInfo();
+ if( nFlags & SALSYSTEM_GETSYSTEMINFO_MEMORYINFO )
+ aRet += aPostMortem.getMemoryInfo();
+ if( nFlags & SALSYSTEM_GETSYSTEMINFO_STACK )
+ aRet += aPostMortem.getStackTrace();
+ if( nFlags & SALSYSTEM_GETSYSTEMINFO_GRAPHICSSYSTEM )
+ aRet += aPostMortem.getGraphicsSystem();
+
+#ifdef DEBUG
+ fprintf( stderr, "SalSystem::GetSummarySystemInfos() =\n%s", aRet.GetBuffer() );
+#endif
+ return String( aRet, RTL_TEXTENCODING_ISO_8859_1 );
+}
+
diff --git a/vcl/unx/source/app/saltimer.cxx b/vcl/unx/source/app/saltimer.cxx
new file mode 100644
index 000000000000..754d0509de66
--- /dev/null
+++ b/vcl/unx/source/app/saltimer.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: saltimer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALTIMER_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/times.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <salunx.h>
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+
+// -=-= SalData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalData::Timeout() const
+{
+ if( pTimerProc_ )
+ pTimerProc_();
+}
+
+// -=-= SalXLib =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final inline void SalXLib::StopTimer()
+{
+ Timeout_.tv_sec = 0;
+ Timeout_.tv_usec = 0;
+ nTimeoutMS_ = 0;
+}
+
+final inline void SalXLib::StartTimer( ULONG nMS )
+{
+ gettimeofday( &Timeout_, NULL );
+
+ nTimeoutMS_ = nMS;
+ Timeout_.tv_sec += nTimeoutMS_ / 1000;
+ Timeout_.tv_usec += nTimeoutMS_ ? (nTimeoutMS_ % 1000) * 1000 : 500;
+ if( Timeout_.tv_usec > 1000000 )
+ {
+ Timeout_.tv_sec++;
+ Timeout_.tv_usec -= 1000000;
+ }
+}
+
+// -=-= SalTimer -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/* static */ final void SalTimer::SetCallback( SALTIMERPROC pProc )
+{ GetSalData()->SetCallback( pProc ); }
+
+
+/* static */ final void SalTimer::Stop()
+{
+ GetSalData()->GetLib()->StopTimer();
+}
+
+/* static */ final void SalTimer::Start( ULONG nMS )
+{
+ GetSalData()->GetLib()->StartTimer( nMS );
+}
+
diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx
new file mode 100644
index 000000000000..b6552ac490bc
--- /dev/null
+++ b/vcl/unx/source/app/sm.cxx
@@ -0,0 +1,347 @@
+/*************************************************************************
+ *
+ * $RCSfile: sm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <unistd.h>
+#include <stdio.h>
+
+#include <vos/process.hxx>
+#include <vos/security.hxx>
+
+#ifndef _VCL_SM_HXX
+#include <sm.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_CONFIG_HXX
+#include <config.hxx>
+#endif
+
+//#define USE_SM_EXTENSION
+
+BOOL ICEConnectionObserver::bIsWatching = FALSE;
+SmcConn SessionManagerClient::aSmcConnection = NULL;
+char* SessionManagerClient::pClientID = NULL;
+
+static SmProp* pSmProps = NULL;
+static SmProp** ppSmProps = NULL;
+static int nSmProps = 0;
+
+static void BuildSmPropertyList()
+{
+ if( ! pSmProps )
+ {
+ ByteString aExec( SessionManagerClient::getExecName(), gsl_getSystemTextEncoding() );
+
+ nSmProps = 4;
+ pSmProps = new SmProp[ nSmProps ];
+
+ pSmProps[ 0 ].name = "SmCloneCommand";
+ pSmProps[ 0 ].type = "SmLISTofARRAY8";
+ pSmProps[ 0 ].num_vals = 1;
+ pSmProps[ 0 ].vals = new SmPropValue;
+ pSmProps[ 0 ].vals->length = aExec.Len();
+ pSmProps[ 0 ].vals->value = strdup( aExec.GetBuffer() );
+
+ pSmProps[ 1 ].name = "SmProgram";
+ pSmProps[ 1 ].type = "SmARRAY8";
+ pSmProps[ 1 ].num_vals = 1;
+ pSmProps[ 1 ].vals = new SmPropValue;
+ pSmProps[ 1 ].vals->length = aExec.Len();
+ pSmProps[ 1 ].vals->value = strdup( aExec.GetBuffer() );
+
+ pSmProps[ 2 ].name = "SmRestartCommand";
+ pSmProps[ 2 ].type = "SmLISTofARRAY8";
+ pSmProps[ 2 ].num_vals = 1;
+ pSmProps[ 2 ].vals = new SmPropValue;
+ pSmProps[ 2 ].vals->length = aExec.Len();
+ pSmProps[ 2 ].vals->value = strdup( aExec.GetBuffer() );
+
+ NAMESPACE_VOS(OSecurity) aSecurity;
+ ::rtl::OUString aUserName;
+ aSecurity.getUserName( aUserName );
+ ::rtl::OString aUser( ::rtl::OUStringToOString( aUserName, gsl_getSystemTextEncoding() ) );
+
+ pSmProps[ 3 ].name = "SmUserID";
+ pSmProps[ 3 ].type = "SmARRAY8";
+ pSmProps[ 3 ].num_vals = 1;
+ pSmProps[ 3 ].vals = new SmPropValue;
+ pSmProps[ 3 ].vals->value = strdup( aUser.getStr() );
+ pSmProps[ 3 ].vals->length = strlen( (char *)pSmProps[ 3 ].vals->value );
+
+ ppSmProps = new SmProp*[ nSmProps ];
+ for( int i = 0; i < nSmProps; i++ )
+ ppSmProps[ i ] = &pSmProps[i];
+ }
+}
+
+
+void SessionManagerClient::SaveYourselfProc(
+ SmcConn connection,
+ SmPointer client_data,
+ int save_type,
+ Bool shutdown,
+ int interact_style,
+ Bool fast
+ )
+{
+ BuildSmPropertyList();
+#ifdef USE_SM_EXTENSION
+ SmcSetProperties( aSmcConnection, nSmProps, ppSmProps );
+ SmcSaveYourselfDone( aSmcConnection, True );
+#endif
+}
+
+void SessionManagerClient::DieProc(
+ SmcConn connection,
+ SmPointer client_data
+ )
+{
+#ifdef USE_SM_EXTENSION
+ SmcCloseConnection( connection, 0, NULL );
+#endif
+ if( connection == aSmcConnection )
+ aSmcConnection = NULL;
+}
+
+void SessionManagerClient::SaveCompleteProc(
+ SmcConn connection,
+ SmPointer client_data
+ )
+{
+}
+
+void SessionManagerClient::ShutdownCanceledProc(
+ SmcConn connection,
+ SmPointer client_data )
+{
+}
+
+void SessionManagerClient::open()
+{
+ static SmcCallbacks aCallbacks;
+
+#ifdef USE_SM_EXTENSION
+ // erst scharf schalten wenn getestet
+
+ // this is the way Xt does it, so we can too
+ if( ! aSmcConnection && getenv( "SESSION_MANAGER" ) )
+ {
+ char aErrBuf[1024];
+ String aFilename( getenv( "HOME" ) );
+ aFilename += "/.so_lastSessionID";
+
+ ICEConnectionObserver::activate();
+
+ aCallbacks.save_yourself.callback = SaveYourselfProc;
+ aCallbacks.save_yourself.client_data = NULL;
+ aCallbacks.die.callback = DieProc;
+ aCallbacks.die.client_data = NULL;
+ aCallbacks.save_complete.callback = SaveCompleteProc;
+ aCallbacks.save_complete.client_data = NULL;
+ aCallbacks.shutdown_cancelled.callback = ShutdownCanceledProc;
+ aCallbacks.shutdown_cancelled.client_data = NULL;
+ aSmcConnection = SmcOpenConnection( NULL,
+ NULL,
+ SmProtoMajor,
+ SmProtoMinor,
+ SmcSaveYourselfProcMask |
+ SmcDieProcMask |
+ SmcSaveCompleteProcMask |
+ SmcShutdownCancelledProcMask ,
+ &aCallbacks,
+ getPreviousSessionID(),
+ &pClientID,
+ sizeof( aErrBuf ),
+ aErrBuf );
+#if defined DEBUG || defined DBG_UTIL
+ if( ! aSmcConnection )
+ fprintf( stderr, "SmcOpenConnection failed: %s\n", aErrBuf );
+#endif
+ setPreviousSessionID( pClientID );
+ }
+#endif
+}
+
+void SessionManagerClient::close()
+{
+ if( aSmcConnection )
+ {
+#ifdef USE_SM_EXTENSION
+ SmcCloseConnection( aSmcConnection, 0, NULL );
+#endif
+ aSmcConnection = NULL;
+ ICEConnectionObserver::deactivate();
+ }
+}
+
+
+String SessionManagerClient::getExecName()
+{
+ static NAMESPACE_VOS( OStartupInfo ) aStartupInfo;
+
+ ::rtl::OUString aExec;
+ aStartupInfo.getExecutableFile( aExec );
+
+ int nPos = aExec.search( ::rtl::OUString::createFromAscii( ".bin" ) );
+ if( nPos != -1 )
+ aExec = aExec.copy( 0, nPos );
+ return aExec;
+}
+
+
+char* SessionManagerClient::getPreviousSessionID()
+{
+ static char aID[1024];
+
+ String aFilename( getenv( "HOME" ), gsl_getSystemTextEncoding() );
+ aFilename.AppendAscii( "/.sosessions" );
+
+ ByteString aExec( getExecName(), gsl_getSystemTextEncoding() );
+ aExec = aExec.GetToken( aExec.GetTokenCount( '/' )-1, '/' );
+
+ Config aConfig( aFilename );
+ aConfig.SetGroup( "Sessions" );
+ ByteString aSessionID = aConfig.ReadKey( aExec );
+ if( aSessionID.Len() )
+ {
+ strncpy( aID, aSessionID.GetBuffer(), sizeof( aID ) );
+ return aID;
+ }
+ return NULL;
+}
+
+void SessionManagerClient::setPreviousSessionID( const ByteString& rID )
+{
+ static char aID[1024];
+
+ String aFilename( getenv( "HOME" ), gsl_getSystemTextEncoding() );
+ aFilename.AppendAscii( "/.sosessions" );
+
+ ByteString aExec( getExecName(), gsl_getSystemTextEncoding() );
+ aExec = aExec.GetToken( aExec.GetTokenCount( '/' )-1, '/' );
+
+ Config aConfig( aFilename );
+ aConfig.SetGroup( "Sessions" );
+ aConfig.WriteKey( aExec, rID );
+}
+
+void ICEConnectionObserver::activate()
+{
+ if( ! bIsWatching )
+ {
+ bIsWatching = TRUE;
+#ifdef USE_SM_EXTENSION
+ IceAddConnectionWatch( ICEWatchProc, NULL );
+#endif
+ }
+}
+
+void ICEConnectionObserver::deactivate()
+{
+ if( bIsWatching )
+ {
+ bIsWatching = FALSE;
+#ifdef USE_SM_EXTENSION
+ IceRemoveConnectionWatch( ICEWatchProc, NULL );
+#endif
+ }
+}
+
+void ICEConnectionObserver::ICEWatchProc(
+ IceConn connection,
+ IcePointer client_data,
+ Bool opening,
+ IcePointer* watch_data
+ )
+{
+#ifdef USE_SM_EXTENSION
+ if( opening )
+ GetSalData()->GetLib()->Insert( IceConnectionNumber( connection ),
+ connection,
+ (YieldFunc)Pending,
+ (YieldFunc)Queued,
+ (YieldFunc)HandleEvents );
+ else
+ GetSalData()->GetLib()->Remove( IceConnectionNumber( connection ) );
+#endif
+}
+
+int ICEConnectionObserver::Pending( int fd, void* data )
+{
+ return 1;
+}
+
+int ICEConnectionObserver::Queued( int fd, void* data )
+{
+ return 1;
+}
+
+int ICEConnectionObserver::HandleEvents( int fd, void* data )
+{
+#ifdef USE_SM_EXTENSION
+ IceProcessMessages( (IceConn)data, NULL, NULL );
+#endif
+ return 0;
+}
+
diff --git a/vcl/unx/source/app/soicon.cxx b/vcl/unx/source/app/soicon.cxx
new file mode 100644
index 000000000000..caf8c6797156
--- /dev/null
+++ b/vcl/unx/source/app/soicon.cxx
@@ -0,0 +1,502 @@
+/*************************************************************************
+ *
+ * $RCSfile: soicon.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SOICON_CXX
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <salunx.h>
+
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_IMPBMP_HXX
+#include <impbmp.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmap.hxx>
+#endif
+#ifndef _SV_BITMAP_HXX
+#include <bitmapex.hxx>
+#endif
+#ifndef _SV_GRAPH_HXX
+#include <graph.hxx>
+#endif
+#ifndef _SV_CVTGRF_HXX
+#include <cvtgrf.hxx>
+#endif
+#ifndef _SV_STRHELPER_HXX
+#include <strhelper.hxx>
+#endif
+
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+
+
+#include "so.xpm"
+
+static Pixmap aAppPixmap = 0, aAppMask = 0;
+
+static void ConvertXpm( SalDisplay* pDisplay )
+{
+ int nWidth, nHeight, nColors, nCharsPerPixel;
+ XColor *pColors;
+ char *pColorAlias;
+ int nElement = 0,nColor = 0,i,nX,nY;
+ char pColorName[16], pComName[16],pColorString[256];
+ BOOL bTransparent = FALSE;
+
+ sscanf( xpmdata[ nElement++ ], "%d%d%d%d", &nWidth, &nHeight,
+ &nColors, &nCharsPerPixel );
+#if defined DBG_UTIL || defined DEBUG
+ fprintf( stderr, "ConvertXpm: converting width = %d height = %d ncolors = %d chars_per_pixel = %d\n", nWidth, nHeight, nColors, nCharsPerPixel );
+#endif
+ nColor = 0;
+ pColors = new XColor[ nColors ];
+ pColorAlias = new char[ nColors * nCharsPerPixel ];
+ while( nElement <= nColors )
+ {
+ sscanf( xpmdata[ nElement++ ],"%s %s %s",
+ pColorName, pComName, pColorString);
+ if( strncmp( pColorString, "None", 4 ) )
+ {
+ XAllocNamedColor( pDisplay->GetDisplay(),
+ DefaultColormap( pDisplay->GetDisplay(),
+ pDisplay->GetScreenNumber() ),
+ pColorString, &pColors[nColor], &pColors[nColor] );
+ strncpy( &pColorAlias[nColor*nCharsPerPixel],
+ pColorName, nCharsPerPixel );
+ nColor++;
+ }
+ }
+ nColors = nColor+1;
+
+ aAppPixmap = XCreatePixmap( pDisplay->GetDisplay(),
+ pDisplay->GetRootWindow(),
+ nWidth, nHeight,
+ pDisplay->GetRootVisual()->GetDepth() );
+ XSetForeground( pDisplay->GetDisplay(),
+ DefaultGC( pDisplay->GetDisplay(),
+ pDisplay->GetScreenNumber() ),
+ BlackPixel( pDisplay->GetDisplay(),
+ pDisplay->GetScreenNumber() ) );
+ XFillRectangle( pDisplay->GetDisplay(), aAppPixmap,
+ DefaultGC( pDisplay->GetDisplay(),
+ pDisplay->GetScreenNumber() ),
+ 0,0,nWidth,nHeight );
+
+ aAppMask = XCreatePixmap( pDisplay->GetDisplay(),
+ pDisplay->GetRootWindow(),
+ nWidth, nHeight, 1 );
+
+ XGCValues aValues;
+ aValues.function = GXset;
+ aValues.foreground = 0xffffffff;
+ GC aMonoGC = XCreateGC( pDisplay->GetDisplay(), aAppMask,
+ GCFunction|GCForeground, &aValues );
+
+ XFillRectangle( pDisplay->GetDisplay(), aAppMask, aMonoGC,
+ 0,0, nWidth, nHeight );
+ aValues.function = GXclear;
+ XChangeGC( pDisplay->GetDisplay(), aMonoGC, GCFunction, &aValues );
+
+ for( nY=0; nY < nHeight; nY++ )
+ {
+ char *pRun = xpmdata[ nElement+nY ];
+ for( nX=0; nX < nWidth; nX++ )
+ {
+ // get color number
+ nColor = 0;
+ while( nColor < nColors &&
+ strncmp( pRun, &pColorAlias[nColor*nCharsPerPixel],
+ nCharsPerPixel ) )
+ nColor++;
+ if( nColor < nColors )
+ {
+ XSetForeground( pDisplay->GetDisplay(),
+ DefaultGC( pDisplay->GetDisplay(),
+ pDisplay->GetScreenNumber() ),
+ pColors[ nColor ].pixel );
+ XDrawPoint( pDisplay->GetDisplay(),
+ aAppPixmap,
+ DefaultGC( pDisplay->GetDisplay(),
+ pDisplay->GetScreenNumber() ),
+ nX, nY );
+
+ }
+ else
+ {
+ bTransparent = TRUE;
+ XDrawPoint( pDisplay->GetDisplay(),
+ aAppMask, aMonoGC, nX, nY );
+ }
+ pRun += nCharsPerPixel;
+ }
+ }
+ delete pColors;
+ delete pColorAlias;
+ XFreeGC( pDisplay->GetDisplay(), aMonoGC );
+
+ if( ! bTransparent )
+ {
+#if defined DBG_UTIL || defined DEBUG
+ fprintf( stderr, "ConvertXpm: keine Transparenz -> keine Maske\n" );
+#endif
+ XFreePixmap( pDisplay->GetDisplay(), aAppMask );
+ aAppMask = 0;
+ }
+}
+
+Pixmap GetAppIconPixmap( SalDisplay *pDisplay )
+{
+ if( ! aAppPixmap )
+ ConvertXpm( pDisplay );
+ return aAppPixmap;
+}
+
+Pixmap GetAppIconMask( SalDisplay *pDisplay )
+{
+ if( ! aAppPixmap )
+ ConvertXpm( pDisplay );
+ return aAppMask;
+}
+
+static void NextLine( SvStream& rFile, ByteString& rLine, BOOL bXpm2Mode )
+{
+ if( bXpm2Mode )
+ {
+ rFile.ReadLine( rLine );
+ }
+ else
+ {
+ do
+ {
+ rFile.ReadLine( rLine );
+ rLine = rLine.GetToken( 1, '"' );
+ if( rLine.Len() )
+ rLine = rLine.GetToken( 0, '"' );
+ } while( ! ( rLine.Len() || rFile.IsEof() ) );
+ }
+}
+
+BOOL ReadXBMFile( Display* pDisplay, const String& rFile, SalBitmap*& rpBmp )
+{
+ SvFileStream aFile( rFile, STREAM_READ );
+ int nBytes = 0;
+ int nWidth= -1, nHeight=-1;
+ BOOL bSuccess = FALSE;
+
+ rpBmp = NULL;
+
+ // read in bitmap file ( cause XReadBitmapFileData not present
+ // in Solaris 2.5.1)
+ if( ! aFile.IsOpen() )
+ return FALSE;
+
+ ByteString aLine;
+
+ while( ( nWidth < 0 || nHeight < 0 ) && ! aFile.IsEof() )
+ {
+ aFile.ReadLine( aLine );
+ aLine = WhitespaceToSpace( aLine );
+
+ if( aLine.GetChar(0) == '#' )
+ {
+ if( aLine.Search( "_width" ) != STRING_NOTFOUND )
+ nWidth = aLine.GetToken( ' ', 2 ).ToInt32();
+ else if( aLine.Search( "_height" ) != STRING_NOTFOUND )
+ nHeight = aLine.GetToken( ' ', 2 ).ToInt32();
+ }
+ }
+
+ if( nWidth <= 0 || nHeight <= 0 )
+ return FALSE;
+
+ BitmapPalette aPal( 2 );
+ const Size aSize( nWidth, nHeight );
+
+ aPal[ 0 ] = BitmapColor( 0, 0, 0 );
+ aPal[ 1 ] = BitmapColor( 0xff, 0xff, 0xff );
+
+ rpBmp = new SalBitmap;
+ rpBmp->Create( aSize, 1, aPal );
+
+ BitmapBuffer* pBmpBuf = rpBmp->AcquireBuffer( FALSE );
+ BYTE* pBmpScan = pBmpBuf->mpBits + ( nHeight - 1 ) * pBmpBuf->mnScanlineSize;
+ long nX = 0, nY = 0;
+
+ aFile.Seek( 0L );
+
+ do
+ {
+ int nPos;
+
+ aFile.ReadLine( aLine );
+ aLine.ToUpperAscii();
+
+ while( ( ( nPos = aLine.Search( "0X" ) ) != STRING_NOTFOUND ) && ( nY < nHeight ) )
+ {
+ BYTE cData = 0;
+
+ for( int i = 0; i < 2; i++ )
+ {
+ cData *= 16;
+ char c = aLine.GetChar( nPos + 2 + i);
+
+ if( c >= '0' && c <= '9' )
+ cData += (unsigned char)( c - '0' );
+ else if( c >= 'A' && c <= 'F' )
+ cData += (unsigned char)( c - 'A' + 10 );
+ }
+
+ *pBmpScan++ += ( ( cData & 1 ) << 7 ) | ( ( cData & 2 ) << 5 ) |
+ ( ( cData & 4 ) << 3 ) | ( ( cData & 8 ) << 1 ) |
+ ( ( cData & 16 ) >> 1 ) | ( ( cData & 32 ) >> 3 ) |
+ ( ( cData & 64 ) >> 5 ) | ( ( cData& 128 ) >> 7 );
+
+ if( ( nX += 8 ) >= nWidth )
+ nX = 0, pBmpScan = pBmpBuf->mpBits + ( nHeight - ++nY - 1 ) * pBmpBuf->mnScanlineSize;
+
+ aLine.Erase( 0, nPos + 5 );
+ }
+ }
+ while( !aFile.IsEof() && ( nY < nHeight ) );
+
+ rpBmp->ReleaseBuffer( pBmpBuf, FALSE );
+
+ return TRUE;
+}
+
+//------------------------------------------------------------------------------
+
+BOOL ReadXPMFile( Display* pDisplay, const String& rFile,
+ SalBitmap*& rpBmp, SalBitmap*& rpMsk )
+{
+ SvFileStream aFile( rFile, STREAM_READ );
+ ByteString aColorName, aColorString, aLine;
+ int nWidth, nHeight, nColors, nCharsPerPixel;
+ int nElement = 0,nColor = 0, i, nX, nY;
+ UINT8* pColorTable;
+ char* pColorAlias;
+ BOOL bTransparent = FALSE;
+ BOOL bXpm2Mode = FALSE;
+
+ rpBmp = rpMsk = NULL;
+
+ if( ! aFile.IsOpen() )
+ return FALSE;
+
+ aFile.ReadLine( aLine );
+ aLine = WhitespaceToSpace( aLine );
+
+ if( aLine.CompareTo( "! XPM", 5 ) == COMPARE_EQUAL )
+ bXpm2Mode = TRUE;
+ else
+ {
+ bXpm2Mode = FALSE;
+ aFile.Seek( 0L );
+ }
+
+ NextLine( aFile, aLine, bXpm2Mode );
+
+ nWidth = GetCommandLineToken( 0, aLine ).ToInt32();
+ nHeight = GetCommandLineToken( 1, aLine ).ToInt32();
+ nColors = GetCommandLineToken( 2, aLine ).ToInt32();
+ nCharsPerPixel = GetCommandLineToken( 3, aLine ).ToInt32();
+
+ if( nWidth == 0 || nHeight == 0 || nColors == 0 || nCharsPerPixel == 0 )
+ {
+ // not really an xpm despite the name => try to load it via GraphicConverter
+ aFile.Seek( 0L );
+ Graphic aGraphic;
+ GraphicConverter::Import( aFile, aGraphic );
+
+ BitmapEx aBitmapEx( aGraphic.GetBitmapEx() );
+
+ if( aBitmapEx.GetSizePixel().Width() == 0 || aBitmapEx.GetSizePixel().Height() == 0 )
+ return FALSE;
+
+ const Bitmap aBmp( aBitmapEx.GetBitmap() );
+ const Bitmap aMsk( aBitmapEx.GetMask() );
+
+ if( !!aBmp )
+ {
+ rpBmp = new SalBitmap;
+ rpBmp->Create( *aBmp.ImplGetImpBitmap()->ImplGetSalBitmap() );
+ }
+
+ if( !!aMsk )
+ {
+ rpMsk = new SalBitmap;
+ rpMsk->Create( *aMsk.ImplGetImpBitmap()->ImplGetSalBitmap() );
+ }
+
+ return TRUE;
+ }
+
+ nColor = 0;
+ pColorTable = new UINT8[ (nColors+1) * 3 ];
+ pColorAlias = new char[ nColors * nCharsPerPixel ];
+ XColor aExactColor;
+ aExactColor.flags = DoRed | DoGreen | DoBlue;
+ while( nColors )
+ {
+ NextLine( aFile, aLine, bXpm2Mode );
+ // might be a space as color variable
+ aColorName = aLine.Copy( 0, nCharsPerPixel );
+ aLine.Erase( 0, nCharsPerPixel );
+ aLine = WhitespaceToSpace( aLine );
+
+ int nPos = aLine.Search( " c " );
+ if( nPos == STRING_NOTFOUND && aLine.CompareIgnoreCaseToAscii( "c ", 2 ) == COMPARE_EQUAL )
+ nPos = 2;
+ else
+ nPos += 3;
+ aColorString = aLine.Copy( nPos );
+
+ if( aColorString.CompareIgnoreCaseToAscii( "none", 4 ) != COMPARE_EQUAL )
+ {
+ XParseColor( pDisplay,
+ DefaultColormap( pDisplay,
+ DefaultScreen( pDisplay ) ),
+ aColorString.GetBuffer(),
+ &aExactColor );
+ pColorTable[ nColor * 3 +2 ] = (UINT8)(aExactColor.red / 256 );
+ pColorTable[ nColor * 3 +1 ] = (UINT8)(aExactColor.green / 256 );
+ pColorTable[ nColor * 3 ] = (UINT8)(aExactColor.blue / 256 );
+ strncpy( pColorAlias + nColor*nCharsPerPixel,
+ aColorName.GetBuffer(), nCharsPerPixel );
+ nColor++;
+ }
+ nColors--;
+ }
+ pColorTable[ 3*nColor ] = pColorTable[ 3*nColor+1 ] =
+ pColorTable[ 3*nColor+2 ] = 0;
+ nColors = nColor;
+
+ // read SalBitmap's
+ BitmapPalette aPal( 2 );
+ const Size aSize( nWidth, nHeight );
+
+ aPal[ 0 ] = BitmapColor( 0, 0, 0 );
+ aPal[ 1 ] = BitmapColor( 0xff, 0xff, 0xff );
+
+ rpBmp = new SalBitmap;
+ rpBmp->Create( aSize, 24, aPal );
+ BitmapBuffer* pBmpBuf = rpBmp->AcquireBuffer( FALSE );
+
+ rpMsk = new SalBitmap;
+ rpMsk->Create( aSize, 1, aPal );
+ BitmapBuffer* pMskBuf = rpMsk->AcquireBuffer( FALSE );
+
+ for( nY=0; nY < nHeight; nY++ )
+ {
+ NextLine( aFile, aLine, bXpm2Mode );
+
+ const char* pRun = aLine.GetBuffer();
+ BYTE* pBmpScan = pBmpBuf->mpBits + pBmpBuf->mnScanlineSize * ( nHeight - nY - 1 );
+ BYTE* pMskScan = pMskBuf->mpBits + pMskBuf->mnScanlineSize * ( nHeight - nY - 1 );
+ UINT8 nMaskByte = 0;
+
+ for( nX = 0; nX < nWidth; nX++ )
+ {
+ // get color number
+ for( nColor=0; nColor < nColors; nColor++ )
+ {
+ if( ! strncmp( pRun, pColorAlias + nColor*nCharsPerPixel,
+ nCharsPerPixel ) )
+ break;
+ }
+
+ long nIndex = nColor * 3;
+
+ *pBmpScan++ = pColorTable[ nIndex++ ];
+ *pBmpScan++ = pColorTable[ nIndex++ ];
+ *pBmpScan++ = pColorTable[ nIndex ];
+
+ if( nColor == nColors )
+ nMaskByte |= ( 1 << ( 7 - ( nX & 7 ) ) );
+
+ pRun += nCharsPerPixel;
+
+ if( ( ( nX & 7 ) == 7 ) || ( nX == nWidth - 1 ) )
+ {
+ *pMskScan++ = nMaskByte;
+ nMaskByte = 0;
+ }
+ }
+ }
+
+ rpBmp->ReleaseBuffer( pBmpBuf, FALSE );
+ rpMsk->ReleaseBuffer( pMskBuf, FALSE );
+ delete[] pColorTable;
+ delete[] pColorAlias;
+
+ return TRUE;
+}
diff --git a/vcl/unx/source/gdi/cdeint.cxx b/vcl/unx/source/gdi/cdeint.cxx
new file mode 100644
index 000000000000..8783958b79f4
--- /dev/null
+++ b/vcl/unx/source/gdi/cdeint.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * $RCSfile: cdeint.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdlib.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <salunx.h>
+#include <saldisp.hxx>
+#include <salbmp.hxx>
+#include <salframe.hxx>
+#include <cdeint.hxx>
+#include <soicon.hxx>
+#include <strhelper.hxx>
+#include <tools/debug.hxx>
+
+void* CDEIntegrator::pDtSvcLib = 0;
+void* CDEIntegrator::pXtLib = 0;
+void* CDEIntegrator::pXmLib = 0;
+void* CDEIntegrator::pMrmLib = 0;
+void* CDEIntegrator::pttLib = 0;
+int CDEIntegrator::nRefCount = 0;
+char* CDEIntegrator::pFallbackRes[] = {
+ "title: OfficeCDEIntegrationShell",
+ NULL
+};
+static char *ppDummyArgv[] = { "soffice.bin", NULL };
+static int nDummyArgc = 1;
+
+// function pointers
+// from DtSvc
+XLIB_Boolean (*CDEIntegrator::pDtAppInitialize)
+ ( XtAppContext, Display*, Widget, char*, char* ) = 0;
+void (*CDEIntegrator::pDtDtsLoadDataTypes)() = 0;
+void (*CDEIntegrator::pDtDtsRelease)() = 0;
+char* (*CDEIntegrator::pDtDtsFileToAttributeValue)
+ (const char*,const char*) = 0;
+void (*CDEIntegrator::pDtDtsFreeAttributeValue)( char* ) = 0;
+Status (*CDEIntegrator::pDtWsmGetWorkspaceInfo)( Display*, XLIB_Window, Atom,
+ DtWsmWorkspaceInfo** ) = 0;
+void (*CDEIntegrator::pDtWsmFreeWorkspaceInfo)( DtWsmWorkspaceInfo* ) = 0;
+Status (*CDEIntegrator::pDtWsmGetWorkspaceList)( Display*, XLIB_Window, Atom**,
+ int* ) = 0;
+Status (*CDEIntegrator::pDtWsmGetCurrentWorkspace)( Display*, XLIB_Window root, Atom* ) = 0;
+Status (*CDEIntegrator::pDtWsmGetWorkspacesOccupied)( Display*, XLIB_Window, Atom**, unsigned long* ) = 0;
+
+// from Mrm
+void (*CDEIntegrator::pMrmInitialize)() = 0;
+
+// from Xm
+WidgetClass* CDEIntegrator::pxmDrawingAreaWidgetClass = 0;
+WidgetClass* CDEIntegrator::pxmRowColumnWidgetClass = 0;
+WidgetClass* CDEIntegrator::pxmPushButtonWidgetClass = 0;
+
+// from Xt
+void (*CDEIntegrator::pXtToolkitInitialize)() = 0;
+XtAppContext (*CDEIntegrator::pXtCreateApplicationContext)() = 0;
+Widget (*CDEIntegrator::pXtAppCreateShell)
+ ( char*, char*, WidgetClass, Display*, ArgList, Cardinal ) = 0;
+Widget (*CDEIntegrator::pXtVaCreateManagedWidget)
+ ( char*, WidgetClass, Widget, ... ) = 0;
+void (*CDEIntegrator::pXtDisplayInitialize)
+ ( XtAppContext, Display*, char*, char*, XrmOptionDescRec*, Cardinal,
+ int*, char**) = 0;
+void (*CDEIntegrator::pXtAppSetFallbackResources)
+ ( XtAppContext, char** ) = 0;
+Widget (*CDEIntegrator::pXtAppInitialize)
+ (XtAppContext*, char*, XrmOptionDescList, Cardinal, int*, char**, char**,
+ ArgList, Cardinal ) = 0;
+Widget (*CDEIntegrator::pXtSetLanguageProc)
+ ( XtAppContext, XtLanguageProc, XtPointer ) = 0;
+DtActionInvocationID (*CDEIntegrator::pDtActionInvoke)
+ ( Widget, char*, DtActionArg*, int, char*, char*, char*, int,
+ DtActionCallbackProc, XtPointer ) = 0;
+void (*CDEIntegrator::pXtRealizeWidget)( Widget ) = 0;
+void (*CDEIntegrator::pXtUnrealizeWidget)( Widget ) = 0;
+XLIB_Boolean (*CDEIntegrator::pXtIsRealized)( Widget ) = 0;
+void (*CDEIntegrator::pXtConfigureWidget)
+ ( Widget, Position, Position, Dimension, Dimension, Dimension ) = 0;
+void (*CDEIntegrator::pXtAppProcessEvent)
+ ( XtAppContext, XtInputMask ) = 0;
+XtInputMask (*CDEIntegrator::pXtAppPending)( XtAppContext ) = 0;
+WidgetClass* CDEIntegrator::pAppShellClass = 0;
+
+
+CDEIntegrator::CDEIntegrator( SalFrame* pFrame ) :
+ DtIntegrator( pFrame ),
+ maAppWidget( 0 )
+{
+ meType = DtCDE;
+ if( ! nRefCount )
+ GlobalInit();
+ nRefCount++;
+
+ // instanz daten initialisieren
+ maAppContext = pXtCreateApplicationContext();
+ pXtDisplayInitialize( maAppContext, mpDisplay,
+ "OfficeCDEIntegrationShell",
+ "OfficeCDEIntegrationShell",
+ 0, 0, &nDummyArgc, ppDummyArgv );
+ pXtAppSetFallbackResources( maAppContext, pFallbackRes );
+ maAppWidget = pXtAppCreateShell( "OfficeCDEIntegrationShell",
+ "OfficeCDEIntegrationShell",
+ *pAppShellClass,
+ mpDisplay, 0, 0 );
+ pXtConfigureWidget( maAppWidget, 10, 10, 10, 10, 0 );
+ //pXtRealizeWidget( maAppWidget );
+ pDtAppInitialize( maAppContext, mpDisplay, maAppWidget,
+ ppDummyArgv[ 0 ], "Office" );
+
+ pDtDtsLoadDataTypes();
+}
+
+CDEIntegrator::~CDEIntegrator()
+{
+ if( maAppWidget )
+ pXtUnrealizeWidget( maAppWidget );
+
+ nRefCount--;
+ if( ! nRefCount )
+ GlobalDeInit();
+}
+
+void CDEIntegrator::GlobalInit()
+{
+ if( ! pDtSvcLib )
+ pDtSvcLib = _LoadLibrary( "libDtSvc.so" );
+ if( ! pttLib )
+ pttLib = _LoadLibrary( "libtt.so" );
+ if( ! pXmLib )
+ pXmLib = _LoadLibrary( "libXm.so" );
+ if( ! pMrmLib )
+ pMrmLib = _LoadLibrary( "libMrm.so" );
+ if( ! pXtLib )
+ pXtLib = _LoadLibrary( "libXt.so" );
+
+ if( pDtSvcLib && pXtLib && pttLib && pXmLib && pMrmLib )
+ {
+ bSymbolLoadFailed = FALSE;
+
+ pDtAppInitialize = (XLIB_Boolean (*)( XtAppContext, Display*,
+ Widget, char*, char* ))
+ _LoadSymbol( pDtSvcLib, "DtAppInitialize" );
+ pDtDtsLoadDataTypes = (void (*)())
+ _LoadSymbol( pDtSvcLib, "DtDtsLoadDataTypes" );
+ pDtDtsRelease = (void (*)())
+ _LoadSymbol( pDtSvcLib, "DtDtsRelease" );
+ pDtDtsFileToAttributeValue = (char* (*)(const char*,const char*))
+ _LoadSymbol( pDtSvcLib, "DtDtsFileToAttributeValue" );
+ pDtDtsFreeAttributeValue = (void (*)( char* ))
+ _LoadSymbol( pDtSvcLib, "DtDtsFreeAttributeValue" );
+ pDtActionInvoke = (DtActionInvocationID(*)
+ ( Widget, char*,DtActionArg*, int, char*,
+ char*, char*, int,
+ DtActionCallbackProc, XtPointer ))
+ _LoadSymbol( pDtSvcLib, "DtActionInvoke" );
+ pDtWsmGetWorkspaceInfo = (Status(*)( Display*, XLIB_Window, Atom,
+ DtWsmWorkspaceInfo** ))
+ _LoadSymbol( pDtSvcLib, "DtWsmGetWorkspaceInfo" );
+ pDtWsmFreeWorkspaceInfo = (void(*)( DtWsmWorkspaceInfo* ))
+ _LoadSymbol( pDtSvcLib, "DtWsmFreeWorkspaceInfo" );
+ pDtWsmGetWorkspaceList = (Status(*)( Display*, XLIB_Window, Atom**, int* ))
+ _LoadSymbol( pDtSvcLib, "DtWsmGetWorkspaceList" );
+ pDtWsmGetCurrentWorkspace = (Status(*)( Display*, XLIB_Window, Atom*))
+ _LoadSymbol( pDtSvcLib, "DtWsmGetCurrentWorkspace" );
+ pDtWsmGetWorkspacesOccupied = (Status(*)( Display*, XLIB_Window, Atom**, unsigned long* ))
+ _LoadSymbol( pDtSvcLib, "DtWsmGetWorkspacesOccupied" );
+
+ pXtToolkitInitialize = (void (*)())
+ _LoadSymbol( pXtLib, "XtToolkitInitialize" );
+ pXtCreateApplicationContext = (XtAppContext (*)())
+ _LoadSymbol( pXtLib, "XtCreateApplicationContext" );
+ pXtAppCreateShell = (Widget (*)( char*, char*, WidgetClass,
+ Display*, ArgList,
+ Cardinal ))
+ _LoadSymbol( pXtLib, "XtAppCreateShell" );
+ pXtDisplayInitialize = (void (*)( XtAppContext, Display*, char*,
+ char*, XrmOptionDescRec*, Cardinal,
+ int*, char**) )
+ _LoadSymbol( pXtLib, "XtDisplayInitialize" );
+
+ pXtVaCreateManagedWidget = (Widget (*)( char*, WidgetClass, Widget, ... ))
+ _LoadSymbol( pXtLib, "XtVaCreateManagedWidget" );
+ pXtSetLanguageProc = (Widget (*)( XtAppContext, XtLanguageProc, XtPointer ))
+ _LoadSymbol( pXtLib, "XtSetLanguageProc" );
+ pXtAppSetFallbackResources = (void (*)( XtAppContext, char** ))
+ _LoadSymbol( pXtLib, "XtAppSetFallbackResources" );
+ pXtAppInitialize = (Widget (*)(XtAppContext*, char*, XrmOptionDescList,
+ Cardinal, int*, char**, char**, ArgList,
+ Cardinal ))
+ _LoadSymbol( pXtLib, "XtAppInitialize" );
+ pXtRealizeWidget = (void(*)( Widget ))
+ _LoadSymbol( pXtLib, "XtRealizeWidget" );
+ pXtIsRealized = (XLIB_Boolean(*)( Widget ))
+ _LoadSymbol( pXtLib, "XtIsRealized" );
+ pXtUnrealizeWidget = (void(*)( Widget ))
+ _LoadSymbol( pXtLib, "XtUnrealizeWidget" );
+ pXtAppProcessEvent = (void(*)( XtAppContext, XtInputMask ))
+ _LoadSymbol( pXtLib, "XtAppProcessEvent" );
+ pXtAppPending = (XtInputMask(*)( XtAppContext ))
+ _LoadSymbol( pXtLib, "XtAppPending" );
+ pXtConfigureWidget = (void (*)( Widget, Position, Position, Dimension,
+ Dimension, Dimension ))
+ _LoadSymbol( pXtLib, "XtConfigureWidget" );
+ pAppShellClass =
+ (WidgetClass*)_LoadSymbol( pXtLib, "applicationShellWidgetClass" );
+ pMrmInitialize = (void(*)())
+ _LoadSymbol( pMrmLib, "MrmInitialize" );
+ pxmDrawingAreaWidgetClass =
+ (WidgetClass*)_LoadSymbol( pXmLib, "xmDrawingAreaWidgetClass" );
+ pxmRowColumnWidgetClass =
+ (WidgetClass*)_LoadSymbol( pXmLib, "xmRowColumnWidgetClass" );
+ pxmPushButtonWidgetClass =
+ (WidgetClass*)_LoadSymbol( pXmLib, "xmPushButtonWidgetClass" );
+
+ pXtSetLanguageProc( NULL, NULL, NULL );
+ pMrmInitialize();
+ pXtToolkitInitialize();
+ XrmInitialize();
+ }
+ else
+ {
+ if( pXtLib )
+ dlclose( pXtLib );
+ if( pXmLib )
+ dlclose( pXmLib );
+ if( pMrmLib )
+ dlclose( pMrmLib );
+ if( pttLib )
+ dlclose( pttLib );
+ if( pDtSvcLib )
+ dlclose( pDtSvcLib );
+ pttLib = pMrmLib = pXmLib = pXtLib = pDtSvcLib = 0;
+ }
+}
+
+void CDEIntegrator::GlobalDeInit()
+{
+ pDtDtsRelease();
+
+ if( pXtLib )
+ dlclose( pXtLib );
+ if( pXmLib )
+ dlclose( pXmLib );
+ if( pMrmLib )
+ dlclose( pMrmLib );
+ if( pttLib )
+ dlclose( pttLib );
+ if( pDtSvcLib )
+ dlclose( pDtSvcLib );
+ pttLib = pMrmLib = pXmLib = pXtLib = pDtSvcLib = 0;
+}
+
+void CDEIntegrator::InvokeAction( const String& rAction, const String& rFiles )
+{
+#if 1
+ String aActionLine( RTL_CONSTASCII_STRINGPARAM( "/usr/dt/bin/dtaction " ), RTL_TEXTENCODING_ASCII_US );
+ aActionLine += rAction;
+ aActionLine += ' ';
+ aActionLine += rFiles;
+ DtIntegrator::LaunchProcess( aActionLine );
+#else
+ int nTokens = GetCommandLineTokenCount( rFiles ), i;
+ DtActionArg* pArgs = new DtActionArg[ nTokens ];
+ char** pStrings = new char*[nTokens];
+ for( i = 0; i < nTokens ; i++ )
+ {
+ pStrings[ i ] = strdup( GetCommandLineToken( i, rFiles ).GetStr() );
+ pArgs[ i ].argClass = DtACTION_FILE;
+ pArgs[ i ].u.file.name = pStrings[ i ];
+ }
+
+ pid_t nPID = fork();
+ if( ! nPID )
+ // child
+ {
+ // if the action fails for some reason, CDE tries to raise
+ // an error box which leads to a SIGSEGV somewhere
+ // in Motif (probably because we are not a real Motif app)
+ // so execute this in its own process. if it dies, so what ?
+
+ // this is not perfectly safe though. The second process
+ // can cause an X Error wich comes back through our connection
+ // at an unpredictable time. Some Actions do this reproducable
+ // eg SDTAudio
+ pDtActionInvoke( maAppWidget, const_cast<char*>(rAction.GetStr()), pArgs, nTokens,
+ NULL, NULL, NULL, True, NULL, NULL );
+ _exit(0);
+ }
+ else
+ // parent
+ if( nPID > 0 )
+ waitpid( nPID, NULL, 0 );
+
+ // dtactioninvoke pops up the widget, pop it down again
+ if( pXtIsRealized( maAppWidget ) )
+ pXtUnrealizeWidget( maAppWidget );
+
+ for( i = 0; i < nTokens; i++ )
+ free( pStrings[i] );
+ delete pStrings;
+ delete pArgs;
+#endif
+}
+
+BOOL CDEIntegrator::StartProcess( String& rFile, String& rParams, const String& rDir )
+{
+ String aFiles;
+ if( rFile.GetChar( 0 ) != '"' )
+ {
+ aFiles = '\"';
+ aFiles += rFile;
+ aFiles += '\"';
+ }
+ else
+ aFiles = rFile;
+
+ if( rParams.Len() )
+ {
+ aFiles += ' ';
+ aFiles += rParams;
+ }
+ // first try to launch it
+ if( LaunchProcess( aFiles, rDir ) )
+ return TRUE;
+
+ // if not successfull it must be a file of whatever type
+ // look for an apropriate action
+ ByteString aFile( rFile, gsl_getSystemTextEncoding() );
+ char* pAttrValue = pDtDtsFileToAttributeValue( aFile.GetBuffer(), "ACTIONS" );
+ if( pAttrValue )
+ {
+ // there is an action for this file. invoke the first one
+ // (since we do not know which one
+ String aAction( pAttrValue, strlen( pAttrValue ), gsl_getSystemTextEncoding() );
+ pDtDtsFreeAttributeValue( pAttrValue );
+ aAction =
+ WhitespaceToSpace( aAction.GetToken( 0, ',' ) ).GetToken( 0, ' ' );
+ if( ! aAction.Len() )
+ return FALSE;
+
+ BOOL bPreviousState =
+ mpSalDisplay->GetXLib()->GetIgnoreXErrors();
+ mpSalDisplay->GetXLib()->SetIgnoreXErrors( TRUE );
+
+ InvokeAction( aAction, aFiles );
+
+ XSync( mpDisplay, False );
+ mpSalDisplay->GetXLib()->SetIgnoreXErrors( bPreviousState );
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+static int getHexDigit( const char c )
+{
+ if( c >= '0' && c <= '9' )
+ return (int)(c-'0');
+ else if( c >= 'a' && c <= 'f' )
+ return (int)(c-'a'+10);
+ else if( c >= 'A' && c <= 'F' )
+ return (int)(c-'A'+10);
+ return -1;
+}
+
+
+BOOL CDEIntegrator::GetSystemLook( SystemLookInfo& rInfo )
+{
+ static Color aColors[ 8 ];
+ static sal_Bool bRead = sal_False;
+
+ if( ! bRead )
+ {
+ // get used palette from xrdb
+ char **ppStringList = 0;
+ int nStringCount;
+ XTextProperty aTextProperty;
+ aTextProperty.value = 0;
+ int i;
+
+ static Atom nResMgrAtom = XInternAtom( mpDisplay, "RESOURCE_MANAGER", False );
+
+ if( XGetTextProperty( mpDisplay,
+ RootWindow( mpDisplay, 0 ),
+ &aTextProperty,
+ nResMgrAtom )
+ && aTextProperty.value
+ && XTextPropertyToStringList( &aTextProperty, &ppStringList, &nStringCount )
+ )
+ {
+ // format of ColorPalette resource:
+ // *n*ColorPalette: palettefile
+
+ ByteString aLines;
+ for( i=0; i < nStringCount; i++ )
+ aLines += ppStringList[i];
+ for( i = aLines.GetTokenCount( '\n' )-1; i >= 0; i-- )
+ {
+ ByteString aLine = aLines.GetToken( i, '\n' );
+ int nIndex = aLine.Search( "ColorPalette" );
+ if( nIndex != STRING_NOTFOUND )
+ {
+ int nPos = nIndex;
+
+ nIndex+=12;
+ const char* pStr = aLine.GetBuffer() +nIndex;
+ while( *pStr && isspace( *pStr ) && *pStr != ':' )
+ {
+ pStr++;
+ nIndex++;
+ }
+ if( *pStr != ':' )
+ continue;
+ pStr++, nIndex++;
+ for( ; *pStr && isspace( *pStr ); pStr++, nIndex++ )
+ ;
+ if( ! *pStr )
+ continue;
+ int nIndex2 = nIndex;
+ for( ; *pStr && ! isspace( *pStr ); pStr++, nIndex2++ )
+ ;
+ ByteString aPaletteFile( aLine.Copy( nIndex, nIndex2 - nIndex ) );
+ // extract number before ColorPalette;
+ for( ; nPos >= 0 && aLine.GetChar( nPos ) != '*'; nPos-- )
+ ;
+ nPos--;
+ for( ; nPos >= 0 && aLine.GetChar( nPos ) != '*'; nPos-- )
+ ;
+ int nNumber = aLine.Copy( ++nPos ).ToInt32();
+
+ DBG_TRACE2( "found palette %d in resource \"%s\"", nNumber, aLine.GetBuffer() );
+
+ // found no documentation what this number actually means;
+ // might be the screen number. 0 seems to be the right one
+ // in most cases.
+ if( nNumber )
+ continue;
+
+ DBG_TRACE1( "Palette file is \"%s\".\n", aPaletteFile.GetBuffer() );
+
+ String aPath( aHomeDir );
+ aPath.AppendAscii( "/.dt/palettes/" );
+ aPath += String( aPaletteFile, gsl_getSystemTextEncoding() );
+
+ SvFileStream aStream( aPath, STREAM_READ );
+ if( ! aStream.IsOpen() )
+ {
+ aPath = String::CreateFromAscii( "/usr/dt/palettes/" );
+ aPath += String( aPaletteFile, gsl_getSystemTextEncoding() );
+ aStream.Open( aPath, STREAM_READ );
+ if( ! aStream.IsOpen() )
+ continue;
+ }
+
+ ByteString aBuffer;
+ for( nIndex = 0; nIndex < 8; nIndex++ )
+ {
+ aStream.ReadLine( aBuffer );
+ // format is "#RRRRGGGGBBBB"
+
+ DBG_TRACE1( "\t\"%s\".\n", aBuffer.GetBuffer() );
+
+ if( aBuffer.Len() )
+ {
+ const char* pArr = (const char*)aBuffer.GetBuffer()+1;
+ aColors[nIndex] = Color(
+ getHexDigit( pArr[1] )
+ | ( getHexDigit( pArr[0] ) << 4 ),
+ getHexDigit( pArr[5] )
+ | ( getHexDigit( pArr[4] ) << 4 ),
+ getHexDigit( pArr[9] )
+ | ( getHexDigit( pArr[8] ) << 4 )
+ );
+
+ DBG_TRACE1( "\t\t%lx\n", aColors[nIndex].GetColor() );
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ if( ppStringList )
+ XFreeStringList( ppStringList );
+ if( aTextProperty.value )
+ XFree( aTextProperty.value );
+ }
+
+ rInfo.windowActiveStart = aColors[0];
+ rInfo.windowActiveEnd = aColors[0];
+ rInfo.activeBorder = aColors[0];
+
+ rInfo.windowInactiveStart = aColors[1];
+ rInfo.windowInactiveEnd = aColors[1];
+ rInfo.inactiveBorder = aColors[1];
+
+ rInfo.activeForeground =
+ aColors[ 0 ].GetBlue() < 128 ||
+ aColors[ 0 ].GetGreen() < 128 ||
+ aColors[ 0 ].GetRed() < 128
+ ? Color( COL_WHITE ) : Color( COL_BLACK );
+ rInfo.inactiveForeground =
+ aColors[ 1 ].GetBlue() < 128 ||
+ aColors[ 1 ].GetGreen() < 128 ||
+ aColors[ 1 ].GetRed() < 128
+ ? Color( COL_WHITE ) : Color( COL_BLACK );
+ rInfo.foreground = rInfo.inactiveForeground;
+ rInfo.background = aColors[ 1 ];
+
+ return TRUE;
+}
diff --git a/vcl/unx/source/gdi/dtint.cxx b/vcl/unx/source/gdi/dtint.cxx
new file mode 100644
index 000000000000..d851d48f27f0
--- /dev/null
+++ b/vcl/unx/source/gdi/dtint.cxx
@@ -0,0 +1,1169 @@
+/*************************************************************************
+ *
+ * $RCSfile: dtint.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <prex.h>
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+#include <postx.h>
+
+#include <cdeint.hxx>
+#include <kdeint.hxx>
+#include <soicon.hxx>
+#include <saldisp.hxx>
+#include <saldata.hxx>
+#include <salbmp.hxx>
+#include <salframe.hxx>
+
+#include <strhelper.hxx>
+#include <svapp.hxx>
+
+#include <unistd.h>
+
+#ifndef _VOS_PROCESS_HXX
+#include <vos/process.hxx>
+#endif
+
+#include <tools/urlobj.hxx>
+
+#ifdef SOLARIS
+// Solaris 2.5.1 misses it in unistd.h
+extern "C" int usleep(unsigned int);
+#endif
+
+#define MAX_TRY_CONVERTSELECTION 40
+#define EVENTMASK_WHILE_DRAGGING ButtonPressMask | ButtonReleaseMask | PointerMotionMask
+
+BOOL bSymbolLoadFailed = FALSE;
+
+DtIntegratorList DtIntegrator::aIntegratorList;
+String DtIntegrator::aHomeDir;
+
+DtIntegrator::DtIntegrator( SalFrame* pFrame ) :
+ mpSalFrame( pFrame ),
+ mpSalDisplay( pFrame->maFrameData.GetDisplay() ),
+ meType( DtGeneric ),
+ mnRefCount( 0 ),
+ mpLastData( 0 ),
+ maDropSource( None ),
+ mpDropTarget( NULL ),
+ maDragTarget( None ),
+ meDragState( DtDragNone )
+{
+ mpDisplay = mpSalDisplay->GetDisplay();
+ maSelectionWindow =
+ XCreateSimpleWindow( mpDisplay, DefaultRootWindow( mpDisplay ),
+ 10,10,10,10,0,0,1 );
+ mnClipboardAtom = XInternAtom( mpDisplay, "CLIPBOARD", False );
+ mnTargetsAtom = XInternAtom( mpDisplay, "TARGETS", False );
+ mnCompoundAtom = XInternAtom( mpDisplay, "COMPOUND_TEXT", False );
+ maExPropertyAtom = XInternAtom( mpDisplay, "VCLExchangeProperty", False );
+
+ mnXdndAware = XInternAtom( mpDisplay, "XdndAware", False );
+ mnXdndSelection = XInternAtom( mpDisplay, "XdndSelection", False );
+ mnXdndEnter = XInternAtom( mpDisplay, "XdndEnter", False );
+ mnXdndLeave = XInternAtom( mpDisplay, "XdndLeave", False );
+ mnXdndStatus = XInternAtom( mpDisplay, "XdndStatus", False );
+ mnXdndTypeList = XInternAtom( mpDisplay, "XdndTypeList", False );
+ mnXdndPosition = XInternAtom( mpDisplay, "XdndPosition", False );
+ mnXdndDrop = XInternAtom( mpDisplay, "XdndDrop", False );
+ mnXdndActionCopy = XInternAtom( mpDisplay, "XdndActionCopy", False );
+ mnXdndActionMove = XInternAtom( mpDisplay, "XdndActionMove", False );
+ mnXdndActionLink = XInternAtom( mpDisplay, "XdndActionLink", False );
+ mnXdndActionCopy = XInternAtom( mpDisplay, "XdndActionCopy", False );
+ mnXdndActionAsk = XInternAtom( mpDisplay, "XdndActionAsk", False );
+ mnXdndActionDescription = XInternAtom( mpDisplay, "XdndActionDescription", False );
+ mnXdndFinished = XInternAtom( mpDisplay, "XdndFinished", False ); mnXdndActionList = XInternAtom( mpDisplay, "XdndActionList", False );
+
+ aIntegratorList.Insert( this, LIST_APPEND );
+ aHomeDir = String( getenv( "HOME" ), gsl_getSystemTextEncoding() );
+}
+
+DtIntegrator::~DtIntegrator()
+{
+ XDestroyWindow( mpDisplay, maSelectionWindow );
+ if( mpLastData )
+ delete mpLastData;
+ while( maDropTypes.Count() )
+ delete maDropTypes.Remove( (ULONG)0 );
+ while( maDragTypes.Count() )
+ delete maDragTypes.Remove( (ULONG)0 );
+}
+
+BOOL DtIntegrator::CheckUnxClipboardChanged()
+{
+ XLIB_Window aPrimWindow = XGetSelectionOwner( mpDisplay, XA_PRIMARY );
+ XLIB_Window aClipWindow = XGetSelectionOwner( mpDisplay, mnClipboardAtom );
+
+ if( aPrimWindow != maSelectionWindow && aPrimWindow != None )
+ return TRUE;
+ if( aClipWindow != maSelectionWindow && aClipWindow != None )
+ return TRUE;
+ return FALSE;
+}
+
+void DtIntegrator::Copy( DtData* pData )
+{
+ if( mpLastData )
+ delete mpLastData;
+ mpLastData = pData;
+
+ XSetSelectionOwner( mpDisplay, XA_PRIMARY,
+ maSelectionWindow, CurrentTime );
+ XSetSelectionOwner( mpDisplay, mnClipboardAtom,
+ maSelectionWindow, CurrentTime );
+
+#if defined DBG_UTIL || defined DEBUG
+ if( XGetSelectionOwner( mpDisplay, XA_PRIMARY ) != maSelectionWindow )
+ fprintf( stderr, "Could not acquire ownership of PRIMARY\n" );
+ if( XGetSelectionOwner( mpDisplay, mnClipboardAtom ) !=
+ maSelectionWindow )
+ fprintf( stderr, "Could not acquire ownership of CLIPBOARD\n" );
+#endif
+}
+
+void DtIntegrator::RegisterDropzone( SalFrame* pFrame )
+{
+ for( int i = 0; i < maDropzones.Count(); i++ )
+ {
+ if( maDropzones.GetObject( i ) == pFrame )
+ return;
+ }
+ maDropzones.Insert( pFrame, LIST_APPEND );
+
+ // create XdndAware property on window to acknowledge DND awareness
+ static int nVersion = XDND_PROTOCOL_VERSION;
+ XChangeProperty( mpDisplay, pFrame->maFrameData.GetWindow(),
+ mnXdndAware, XA_ATOM, 32, PropModeReplace,
+ (unsigned char*)(&nVersion), 1 );
+
+ ImplRegisterDropzone( pFrame );
+}
+
+void DtIntegrator::UnregisterDropzone( SalFrame* pFrame )
+{
+ maDropzones.Remove( pFrame );
+
+ XDeleteProperty( mpDisplay, pFrame->maFrameData.GetWindow(), mnXdndAware );
+
+ ImplUnregisterDropzone( pFrame );
+}
+
+void DtIntegrator::ImplRegisterDropzone( SalFrame* pFrame )
+{
+}
+
+void DtIntegrator::ImplUnregisterDropzone( SalFrame* pFrame )
+{
+}
+
+void DtIntegrator::ImplHandleXEvent( XEvent* pEvent )
+{
+ if( pEvent->type == SelectionClear )
+ {
+ if( meDragState != DtDragNone &&
+ pEvent->xselectionclear.selection == mnXdndSelection )
+ {
+ meDragState = DtDragNone;
+ maDragSource = None;
+ maDragTarget = None;
+ }
+ else
+ maClipboardChangedHdl.Call( this );
+ }
+ else if( pEvent->type == SelectionRequest )
+ {
+ BOOL bConvertable = FALSE;
+ XSelectionRequestEvent& rSelEvent = pEvent->xselectionrequest;
+ XEvent aSendEvent;
+ aSendEvent.type = SelectionNotify;
+ aSendEvent.xselection.display = rSelEvent.display;
+ aSendEvent.xselection.send_event = True;
+ aSendEvent.xselection.requestor = rSelEvent.requestor;
+ aSendEvent.xselection.selection = rSelEvent.selection;
+ aSendEvent.xselection.time = rSelEvent.time;
+ // xterm seems to be the only one to care about time = CurrentTime
+
+ // clipboard and xdnd requests land here
+ if( rSelEvent.selection == XA_PRIMARY ||
+ rSelEvent.selection == mnClipboardAtom )
+ {
+
+#if defined DEBUG
+ char* pType = XGetAtomName( mpDisplay, rSelEvent.target );
+ fprintf( stderr, "Request for conversion of %s with type \"%s\"\n",
+
+ rSelEvent.selection == XA_PRIMARY ? "PRIMARY" : "CLIPBOARD", pType );
+ XFree( pType );
+#endif
+ if( ( rSelEvent.target == XA_STRING ||
+ rSelEvent.target == mnCompoundAtom )
+ && mpLastData && mpLastData->mnBytes )
+ {
+ bConvertable = TRUE;
+ XChangeProperty( mpDisplay, rSelEvent.requestor,
+ rSelEvent.property, XA_STRING,
+ 8, PropModeReplace,
+ mpLastData->mpBytes,
+ mpLastData->mnBytes );
+ aSendEvent.xselection.target = rSelEvent.target;
+ }
+ else if( rSelEvent.target == mnTargetsAtom )
+ {
+ bConvertable = TRUE;
+ Atom aAtom = XA_STRING;
+ XChangeProperty( mpDisplay, rSelEvent.requestor,
+ rSelEvent.property, XA_ATOM,
+ 32, PropModeReplace,
+ (unsigned char*)&aAtom, 1 );
+ aSendEvent.xselection.target = mnTargetsAtom;
+ }
+ }
+ else if( rSelEvent.selection == mnXdndSelection && meDragState != DtDragNone )
+ {
+ DtData aData;
+ aData.mpType = (unsigned char*)XGetAtomName( mpDisplay, rSelEvent.target );
+#if defined DEBUG
+ fprintf( stderr, "Request for convertion of XdndSelection with type \"%s\"\n", aData.mpType );
+#endif
+ maQueryDragDataHdl.Call( &aData );
+ if( aData.mnBytes > 0 )
+ {
+ bConvertable = TRUE;
+ XChangeProperty( mpDisplay, rSelEvent.requestor,
+ rSelEvent.property, rSelEvent.target,
+ 8, PropModeReplace,
+ aData.mpBytes,
+ aData.mnBytes );
+ aSendEvent.xselection.target = rSelEvent.target;
+ }
+ XFree( aData.mpType );
+ // drag and drop does NOT end here
+ // the target may ask more than once for the data
+ // hopefully this can work with the office
+ }
+ aSendEvent.xselection.property =
+ bConvertable ? rSelEvent.property : None;
+ if( ! XSendEvent( mpDisplay, rSelEvent.requestor,
+ False, 0, &aSendEvent ) )
+ fprintf( stderr, "HandleSelectionRequest: XSendEvent failed\n" );
+ }
+ else if( pEvent->type == ClientMessage )
+ {
+ int i = pEvent->xclient.message_type;
+
+ if( i == mnXdndEnter &&
+ ( pEvent->xclient.data.l[1] >> 24 ) <= XDND_PROTOCOL_VERSION &&
+ ! mpDropTarget )
+ {
+#if defined DEBUG
+ fprintf( stderr, "XdndEnter with XDND protocol version %d\n",
+ pEvent->xclient.data.l[1] >> 24 );
+#endif
+ // a drop begins
+
+ // search the correct target frame
+ for( i = 0; i < maDropzones.Count(); i++ )
+ {
+ SalFrame *pFrame = maDropzones.GetObject( i );
+ if( pFrame->maFrameData.GetWindow() ==
+ pEvent->xclient.window )
+ {
+ mpDropTarget = pFrame;
+ break;
+ }
+ }
+ if( ! mpDropTarget )
+ {
+#if defined DEBUG || defined DBG_UTIL
+ fprintf( stderr, "Received XdndEnter and have no corresponding dropzone !!!\n" );
+#endif
+ return;
+ }
+
+ maDropSource = pEvent->xclient.data.l[0];
+ // build a stringlist of types
+ while( maDropTypes.Count() )
+ delete maDropTypes.Remove( (ULONG)0 );
+ for( int i = 2; i < 5; i++ )
+ {
+ if( pEvent->xclient.data.l[i] != None )
+ {
+ char *pAtomName = XGetAtomName( mpDisplay, pEvent->xclient.data.l[i] );
+ maDropTypes.Insert( new String( pAtomName, RTL_TEXTENCODING_ISO_8859_1 ) );
+ XFree( pAtomName );
+ }
+ }
+ if( maDropTypes.Count() > 2 && (pEvent->xclient.data.l[1] & 1) )
+ {
+ unsigned long nCount;
+ Atom aType;
+ int nFormat;
+ unsigned long nBytesLeft;
+ Atom* pTypeData = 0;
+ if( XGetWindowProperty( mpDisplay, maDropSource,
+ mnXdndTypeList, 0, 256,
+ False, XA_ATOM,
+ &aType, &nFormat,
+ &nCount, &nBytesLeft,
+ (unsigned char**)(&pTypeData) ) )
+ {
+ if( aType == XA_ATOM && nFormat == 32 && nCount )
+ {
+ while( nCount )
+ {
+ char * pTypeName =
+ XGetAtomName( mpDisplay, pTypeData[ --nCount ] );
+ maDropTypes.Insert( new String( pTypeData[ nCount ], RTL_TEXTENCODING_ISO_8859_1 ) );
+ }
+ }
+ if( pTypeData )
+ XFree( pTypeData );
+ }
+ }
+
+ maBeginDropHdl.Call( NULL );
+ }
+ else if( i == mnXdndPosition && maDropSource != None && mpDropTarget )
+ {
+#if defined DEBUG
+ fprintf( stderr, "Received XdndPosition\n" );
+#endif
+ // remember time stamps
+ mnDropDataTime = pEvent->xclient.data.l[3];
+
+ // put x,y and action into a structure here
+ DtDropQuery aDropQuery;
+ aDropQuery.m_pFrame = mpDropTarget;
+ int x = pEvent->xclient.data.l[2] >> 16;
+ int y = pEvent->xclient.data.l[2] & 0xffff;
+ XLIB_Window aChild;
+ XTranslateCoordinates( mpDisplay, DefaultRootWindow( mpDisplay ),
+ mpDropTarget->maFrameData.GetWindow(),
+ x, y,
+ &aDropQuery.m_nX,
+ &aDropQuery.m_nY,
+ &aChild );
+ if( pEvent->xclient.data.l[4] == mnXdndActionLink )
+ aDropQuery.m_eAction = DtDropLink;
+ else if( pEvent->xclient.data.l[4] == mnXdndActionMove )
+ aDropQuery.m_eAction = DtDropMove;
+ else
+ aDropQuery.m_eAction = DtDropCopy;
+
+ mnLastDropX = aDropQuery.m_nX;
+ mnLastDropY = aDropQuery.m_nY;
+
+ // query for dropping on new position
+ DtDropAction eResult = (DtDropAction)maQueryDropHdl.Call( &aDropQuery );
+#if defined DEBUG
+ fprintf( stderr, "QueryDropHdl returned result " );
+ switch( eResult )
+ {
+ case DtDropNone: fprintf( stderr, "DtDropNone\n\n" );break;
+ case DtDropCopy: fprintf( stderr, "DtDropCopy\n\n" );break;
+ case DtDropLink: fprintf( stderr, "DtDropLink\n\n" );break;
+ case DtDropMove: fprintf( stderr, "DtDropMove\n\n" );break;
+ case DtDropAny: fprintf( stderr, "DtDropAny\n\n" );break;
+ default: fprintf( stderr, "Unknown !!!\n\n" );break;
+ }
+#endif
+
+ // give source a status
+ XEvent aSendEvent;
+ aSendEvent.type = ClientMessage;
+ aSendEvent.xclient.display = mpDisplay;
+ aSendEvent.xclient.window = maDropSource;
+ aSendEvent.xclient.message_type = mnXdndStatus;
+ aSendEvent.xclient.format = 32;
+ aSendEvent.xclient.data.l[0] = mpDropTarget->maFrameData.GetWindow();
+ aSendEvent.xclient.data.l[1] = 2;
+ switch( eResult )
+ {
+ case DtDropCopy:
+ case DtDropMove:
+ case DtDropLink:
+ case DtDropAny:
+ aSendEvent.xclient.data.l[1] |= 1;
+ default: ;
+ }
+ aSendEvent.xclient.data.l[2] = 0;
+ aSendEvent.xclient.data.l[3] = 0;
+ if( eResult == DtDropCopy )
+ aSendEvent.xclient.data.l[4] = mnXdndActionCopy;
+ else if( eResult == DtDropMove )
+ aSendEvent.xclient.data.l[4] = mnXdndActionMove;
+ else if( eResult == DtDropLink )
+ aSendEvent.xclient.data.l[4] = mnXdndActionLink;
+ else
+ aSendEvent.xclient.data.l[4] = None;
+ XSendEvent( mpDisplay, maDropSource, False, NoEventMask, &aSendEvent );
+ }
+ else if( i == mnXdndLeave && maDropSource != None )
+ {
+#if defined DEBUG
+ fprintf( stderr, "Received XdndLeave\n" );
+#endif
+ if( pEvent->xclient.data.l[0] == maDropSource )
+ {
+ maDropSource = None;
+ mpDropTarget = NULL;
+
+ DtDropQuery aDropQuery;
+ aDropQuery.m_nX = mnLastDropX;
+ aDropQuery.m_nY = mnLastDropY;
+ aDropQuery.m_eAction = DtDropNone;
+ aDropQuery.m_pFrame = mpDropTarget;
+ maDropFinishHdl.Call( &aDropQuery );
+
+ }
+ }
+ else if( i == mnXdndDrop && maDropSource != None )
+ {
+#if defined DEBUG
+ fprintf( stderr, "Received XdndDrop\n" );
+#endif
+ // remember time stamps
+ mnDropDataTime = pEvent->xclient.data.l[2];
+
+ DtDropQuery aDropQuery;
+ aDropQuery.m_nX = mnLastDropX;
+ aDropQuery.m_nY = mnLastDropY;
+ aDropQuery.m_eAction = DtDropAny;
+ aDropQuery.m_pFrame = mpDropTarget;
+ // the drop finish handler should relay the data types
+ // FinishDrop should be called then which retrieves the data
+ // FinishDrop must not be called after this handler returns
+ maDropFinishHdl.Call( &aDropQuery );
+ // finally send a drop finished
+ XEvent aSendEvent;
+ aSendEvent.type = ClientMessage;
+ aSendEvent.xclient.display = mpDisplay;
+ aSendEvent.xclient.window = maDropSource;
+ aSendEvent.xclient.message_type = mnXdndFinished;
+ aSendEvent.xclient.format = 32;
+ aSendEvent.xclient.data.l[0] = mpDropTarget->maFrameData.GetWindow();
+ aSendEvent.xclient.data.l[1] = 0;
+ aSendEvent.xclient.data.l[2] = 0;
+ aSendEvent.xclient.data.l[3] = 0;
+ aSendEvent.xclient.data.l[4] = 0;
+
+ XSendEvent( mpDisplay, maDropSource, True, NoEventMask, &aSendEvent );
+ maDropSource = None;
+ mpDropTarget = NULL;
+ }
+ else if( meDragState != DtDropNone &&
+ meDragState != DtWaitForDataRequest &&
+ pEvent->xclient.message_type == mnXdndStatus )
+ {
+ int nAction = pEvent->xclient.data.l[4];
+ // set pointer correctly
+ XLIB_Cursor aCursor;
+ if( pEvent->xclient.data.l[1] & 1 )
+ {
+ if( nAction == mnXdndActionCopy )
+ aCursor = mpSalDisplay->GetPointer( POINTER_COPYFILES );
+ else if( nAction == mnXdndActionMove )
+ aCursor = mpSalDisplay->GetPointer( POINTER_MOVEFILES );
+ else if( nAction == mnXdndActionLink )
+ aCursor = mpSalDisplay->GetPointer( POINTER_LINKFILE );
+ else
+ aCursor = mpSalDisplay->GetPointer( POINTER_CROP );
+ }
+ else
+ // target will not accept the drop
+ aCursor = mpSalDisplay->GetPointer( POINTER_NOTALLOWED );
+ XChangeActivePointerGrab( mpDisplay,
+ EVENTMASK_WHILE_DRAGGING,
+ aCursor, CurrentTime );
+#if defined DEBUG
+ char* pAction = nAction != None ?
+ XGetAtomName( mpDisplay, nAction ) : "None";
+ fprintf( stderr, "Received XdndStatus %s(%s)\n",
+ pEvent->xclient.data.l[1] & 1 ? "accept" : "deny",
+ pAction );
+ if( nAction != None )
+ XFree( pAction );
+#endif
+ meDragState = DtDragging;
+ SendXdndPosition( pEvent );
+ }
+ else if( meDragState != DtDragNone &&
+ pEvent->xclient.message_type == mnXdndFinished )
+ {
+#if defined DEBUG
+ fprintf( stderr, "Received XdndFinished\n" );
+#endif
+ maDragTarget = None;
+ maDragSource = None;
+ meDragState = DtDragNone;
+ }
+ }
+ else if( pEvent->type == MotionNotify ||
+ pEvent->type == XLIB_KeyPress ||
+ pEvent->type == KeyRelease
+ )
+ {
+ if( pEvent->type == XLIB_KeyPress )
+ {
+ char sDummy[2];
+ sDummy[0] = sDummy[1] = 0;
+ KeySym nKeySym = 0;
+ XLookupString( &pEvent->xkey, sDummy, 1, &nKeySym, NULL );
+ if( nKeySym == XK_Escape )
+ meDragState = DtDragNone;
+ }
+ if( meDragState != DtDragNone &&
+ meDragState != DtWaitForDataRequest )
+
+ {
+ // find XdndAware window beneath pointer
+ int nXdndVersion;
+ XLIB_Window aWindow = GetXdndAwareWindowBeneathPointer( nXdndVersion, pEvent );
+ if( maDragTarget != aWindow )
+ {
+ // send a XdndLeave to previous window
+ SendXdndLeave();
+ // then send a XdndEnter to new window
+ maDragTarget = aWindow;
+ SendXdndEnter();
+ }
+ // send a XdndPosition
+ SendXdndPosition( pEvent );
+ }
+ else
+ CheckXdndTimeout( pEvent->xmotion.time );
+ }
+ else if( pEvent->type == ButtonRelease )
+ {
+ if( meDragState != DtDragNone &&
+ meDragState != DtWaitForDataRequest )
+ {
+ int nXdndVersion;
+ XLIB_Window aWindow = GetXdndAwareWindowBeneathPointer( nXdndVersion, pEvent );
+ if( maDragTarget != aWindow )
+ {
+ SendXdndLeave();
+ maDragTarget = aWindow;
+ SendXdndEnter();
+ SendXdndPosition( pEvent );
+ }
+ if( maDragTarget != None )
+ {
+ // send XdndDrop
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = mpDisplay;
+ aEvent.xclient.window = maDragTarget;
+ aEvent.xclient.format = 32;
+ aEvent.xclient.message_type = mnXdndDrop;
+ aEvent.xclient.data.l[0] = maDragSource;
+ aEvent.xclient.data.l[1] = 0;
+ aEvent.xclient.data.l[2] = pEvent->xbutton.time;
+ XSendEvent( mpDisplay, maDragTarget, False,
+ NoEventMask, &aEvent );
+#if defined DEBUG
+ fprintf( stderr, "Sending XdndDrop\n" );
+#endif
+ meDragState = DtWaitForDataRequest;
+ mnWaitTimestamp = pEvent->xbutton.time;
+ }
+ else
+ {
+#if defined DEBUG
+ fprintf( stderr, "Received ButtonRelease and no DragTarget\n" );
+#endif
+ maDragTarget = None;
+ maDragSource = None;
+ meDragState = DtDragNone;
+ }
+ }
+ else
+ CheckXdndTimeout( pEvent->xbutton.time );
+ }
+}
+
+DtData* DtIntegrator::DropFinish( const String& rType )
+{
+ ByteString aTypeString( rType, RTL_TEXTENCODING_ISO_8859_1 );
+#if defined DEBUG
+ fprintf( stderr, "DtIntegerator::DropFinish( \"%s\" ) : ", aTypeString.GetBuffer() );
+#endif
+ if( maDropSource == None || mpDropTarget == NULL )
+ {
+#if defined DEBUG
+ fprintf( stderr, "failed\n" );
+#endif
+ return NULL;
+ }
+
+ DtData* pData = new DtData;
+ pData->meType = DtTypeKnown;
+ pData->mnX = mnLastDropX;
+ pData->mnY = mnLastDropY;
+
+ Atom aType = XInternAtom( mpDisplay, aTypeString.GetBuffer(), False );
+
+ // now initiate communication with selection owner
+ XConvertSelection( mpDisplay, mnXdndSelection,
+ aType, maExPropertyAtom, maSelectionWindow, mnDropDataTime );
+ // wait for selection notify
+ XEvent aXEvent;
+ int nTries;
+ for( nTries = 0;
+ ! XCheckTypedEvent( mpDisplay, SelectionNotify, &aXEvent ) &&
+ nTries <= MAX_TRY_CONVERTSELECTION ;
+ nTries++ )
+ usleep( 50000 );
+
+ // check if request could be converted
+ if( nTries >= MAX_TRY_CONVERTSELECTION ||
+ aXEvent.xselection.property != maExPropertyAtom )
+ {
+ delete pData;
+ pData = 0;
+ }
+ else
+ {
+ Atom aActualType;
+ int nActualFormat;
+ unsigned long nItems;
+ unsigned long nBytesAfter;
+ unsigned char *pBytes=0;
+ XGetWindowProperty( mpDisplay, maSelectionWindow, maExPropertyAtom,
+ 0, // long_offset
+ 65536, // long_length, a maximum of 256k will be retrieved
+ True, // delete property after reading
+ aType, // the type we want
+ &aActualType, &nActualFormat,
+ &nItems, &nBytesAfter, &pBytes );
+
+ if( pBytes )
+ {
+ pData->mnBytes = nItems * (nActualFormat/8);
+ pData->mpBytes = new unsigned char[ pData->mnBytes + 1 ];
+ memcpy( pData->mpBytes, pBytes, pData->mnBytes );
+ pData->mpBytes[ pData->mnBytes ] = 0;
+ XFree( pBytes );
+ }
+ else
+ {
+ delete pData;
+ pData = 0;
+ }
+ }
+
+#if defined DEBUG
+ fprintf( stderr, "%s\n", pData ? "success" : "failed" );
+#endif
+ return pData;
+}
+
+DtData* DtIntegrator::Paste()
+{
+ DtData* pDtData = 0;
+
+ // check if there IS something to copy
+ XLIB_Window aOwner = XGetSelectionOwner( mpDisplay, XA_PRIMARY );
+ if( aOwner == None || aOwner == maSelectionWindow )
+ return 0;
+
+ // get the proper Atoms
+ Atom aTypeAtom = XA_STRING;
+
+ // now initiate communication with selection owner
+ XConvertSelection( mpDisplay, XA_PRIMARY, aTypeAtom, maExPropertyAtom,
+ maSelectionWindow, CurrentTime );
+ // wait for selection notify
+ XEvent aXEvent;
+ int nTries;
+ for( nTries = 0;
+ ! XCheckTypedEvent( mpDisplay, SelectionNotify, &aXEvent ) &&
+ nTries <= MAX_TRY_CONVERTSELECTION ;
+ nTries++ )
+ usleep( 50000 );
+
+ // check if request could be converted
+ if( nTries >= MAX_TRY_CONVERTSELECTION ||
+ aXEvent.xselection.property != maExPropertyAtom )
+ {
+ // let us try CLIPBOARD selection
+ XConvertSelection( mpDisplay, mnClipboardAtom, aTypeAtom,
+ maExPropertyAtom, maSelectionWindow, CurrentTime );
+ for( nTries = 0;
+ ! XCheckTypedEvent( mpDisplay, SelectionNotify, &aXEvent ) &&
+ nTries < MAX_TRY_CONVERTSELECTION ;
+ nTries++ )
+ usleep( 50000 );
+ }
+
+ // check if request could be converted
+ if( nTries >= MAX_TRY_CONVERTSELECTION ||
+ aXEvent.xselection.property != maExPropertyAtom )
+ return 0;
+
+ Atom aActualType;
+ int nActualFormat;
+ unsigned long nItems;
+ unsigned long nBytesAfter;
+ unsigned char *pData=0;
+ XGetWindowProperty( mpDisplay, maSelectionWindow, maExPropertyAtom,
+ 0, // long_offset
+ 16384, // long_length, a maximum of 64k will e retrieved
+ True, // delete property after reading
+ XA_STRING, // the type we want
+ &aActualType, &nActualFormat,
+ &nItems, &nBytesAfter, &pData );
+
+ if( pData )
+ {
+ pDtData = new DtData;
+ pDtData->meType = DtTypeText;
+ pDtData->mnBytes = nItems * (nActualFormat/8);
+ pDtData->mpBytes = new unsigned char[ pDtData->mnBytes + 1 ];
+ memcpy( pDtData->mpBytes, pData, pDtData->mnBytes );
+ pDtData->mpBytes[ pDtData->mnBytes ] = 0;
+ pDtData->mnBytes += 1;
+ XFree( pData );
+ return pDtData;
+ }
+ return 0;
+}
+
+BOOL DtIntegrator::StartProcess( String& rFile, String& rParams, const String& rDir )
+{
+ String aFiles( rFile );
+ if( rParams.Len() )
+ {
+ aFiles += ' ';
+ aFiles += rParams;
+ }
+ // try to launch it
+ return LaunchProcess( aFiles, rDir );
+}
+
+DtIntegrator* DtIntegrator::CreateDtIntegrator( SalFrame* pFrame )
+{
+ // hack for sclient
+ if( ! pFrame && aIntegratorList.Count() )
+ return aIntegratorList.GetObject( 0 );
+
+ for( int i = 0; i < aIntegratorList.Count(); i++ )
+ {
+ DtIntegrator* pIntegrator = aIntegratorList.GetObject( i );
+ if( pIntegrator->mpDisplay == pFrame->maFrameData.GetXDisplay() )
+ return pIntegrator;
+ }
+
+ if( ! pFrame )
+ pFrame = GetSalData()->pFirstFrame_;
+
+#ifndef REMOTE_APPSERVER
+ Display* pDisplay = pFrame->maFrameData.GetXDisplay();
+ Atom nDtAtom;
+ void* pLibrary = NULL;
+
+ // check dt type
+ // CDE
+ nDtAtom = XInternAtom( pDisplay, "_DT_WM_READY", True );
+ if( nDtAtom && ( pLibrary = _LoadLibrary( "libDtSvc.so" ) ) )
+ {
+ // performance: do not dlopen DtSvc twice
+ CDEIntegrator::pDtSvcLib = pLibrary;
+ return new CDEIntegrator( pFrame );
+ }
+
+ nDtAtom = XInternAtom( pDisplay, "KWM_RUNNING", True );
+ if( nDtAtom ) // perhaps should check getenv( "KDEDIR" )
+ return new KDEIntegrator( pFrame );
+#endif
+ // default: generic implementation
+ return new DtIntegrator( pFrame );
+}
+
+void DtIntegrator::HandleXEvent( XEvent* pEvent )
+{
+ Display *pDisplay = pEvent->xany.display;
+ for( int i = 0; i < aIntegratorList.Count(); i++ )
+ {
+ DtIntegrator* pIntegrator = aIntegratorList.GetObject( i );
+ if( pIntegrator->mpDisplay == pDisplay )
+ {
+ pIntegrator->ImplHandleXEvent( pEvent );
+ break;
+ }
+ }
+}
+
+BOOL DtIntegrator::LaunchProcess( const String& rParam, const String& rDirectory )
+{
+ int nArg;
+
+ char *pDisplayName = DisplayString( mpDisplay );
+ int nToken = GetCommandLineTokenCount( rParam );
+
+ ::rtl::OUString* pArgs = new ::rtl::OUString[nToken];
+ for( nArg = 0; nArg < nToken ; nArg++ )
+ pArgs[ nArg ] = GetCommandLineToken( nArg, rParam );
+ NAMESPACE_VOS(OArgumentList) aArgList( pArgs+1, nToken-1 );
+ delete pArgs;
+
+ ::rtl::OUString aDisplay;
+ if( pDisplayName )
+ {
+ aDisplay = ::rtl::OUString::createFromAscii( "DISPLAY=" );
+ aDisplay += ::rtl::OUString::createFromAscii( pDisplayName );
+ }
+ NAMESPACE_VOS(OEnvironment) aEnvironment( 1, &aDisplay );
+
+ NAMESPACE_VOS( OProcess ) aOProcess( pArgs[0], rDirectory );
+
+ BOOL bSuccess = aOProcess.execute(
+ ( NAMESPACE_VOS( OProcess )::TProcessOption)
+ ( NAMESPACE_VOS( OProcess )::TOption_Detached |
+ NAMESPACE_VOS( OProcess )::TOption_SearchPath ),
+ aArgList, aEnvironment )
+ == NAMESPACE_VOS( OProcess )::E_None ? TRUE : FALSE;
+
+ return bSuccess;
+}
+
+DtDropAction DtIntegrator::ExecuteDrag( const StringList& rTypes, SalFrame* pDragFrame )
+{
+ int i;
+ Atom* pTypes = new Atom[rTypes.Count() ];
+
+#if defined DEBUG
+ fprintf( stderr, "DtIntegrator::ExecuteDrag: " );
+#endif
+ meDragState = DtDragging;
+
+ if( ! pDragFrame )
+ pDragFrame = maDropzones.GetObject( maDropzones.Count()-1 );
+ else
+ {
+ for( i = 0; i < maDropzones.Count(); i++ )
+ if( maDropzones.GetObject( i ) == pDragFrame )
+ break;
+ if( i >= maDropzones.Count() )
+ {
+#if defined DEBUG
+ fprintf( stderr, "DragFrame is no Dropzone !!! taking last dropzone as source instead ...\n" );
+#endif
+ pDragFrame = maDropzones.GetObject( maDropzones.Count()-1 );
+ }
+ }
+
+ maDragSource = pDragFrame->maFrameData.GetWindow();
+ // set up drag types
+ while( maDragTypes.Count() )
+ delete maDragTypes.Remove( (ULONG)0 );
+ for( i = 0; i < rTypes.Count(); i++ )
+ {
+ maDragTypes.Insert( new String( *rTypes.GetObject( i ) ), LIST_APPEND );
+ pTypes[ i ] = XInternAtom( mpDisplay,
+ ByteString( *rTypes.GetObject( i ), RTL_TEXTENCODING_ISO_8859_1 ).GetBuffer(),
+ False );
+#if defined DEBUG
+ fprintf( stderr, " \"%s\"",
+ ByteString( *rTypes.GetObject( i ), RTL_TEXTENCODING_ISO_8859_1 ).GetBuffer() );
+#endif
+ }
+#if defined DEBUG
+ fprintf( stderr, "\n" );
+#endif
+
+ // set the types in the property XdndTypeList
+ XChangeProperty( mpDisplay, maDragSource, mnXdndTypeList, XA_ATOM,
+ 32, PropModeReplace, (unsigned char*)pTypes,
+ rTypes.Count() );
+ delete pTypes;
+
+ XLIB_Cursor aCur = mpSalDisplay->GetPointer( POINTER_MOVEFILES );
+ XLIB_Window aRoot = DefaultRootWindow( mpDisplay );
+
+ // set cursor
+ XGrabPointer( mpDisplay, aRoot, False,
+ EVENTMASK_WHILE_DRAGGING,
+ GrabModeAsync, GrabModeAsync, None, aCur, CurrentTime );
+ XGrabKeyboard( mpDisplay, maDragSource, False, GrabModeAsync,
+ GrabModeAsync, CurrentTime );
+ XSetSelectionOwner( mpDisplay, mnXdndSelection,
+ maDragSource, CurrentTime );
+
+ while( meDragState != DtDragNone )
+ Application::Yield();
+
+ XSetSelectionOwner( mpDisplay, mnXdndSelection,
+ None, CurrentTime );
+ XUngrabKeyboard( mpDisplay, CurrentTime );
+ XUngrabPointer( mpDisplay, CurrentTime );
+
+ return DtDropCopy;
+}
+
+XLIB_Window DtIntegrator::GetXdndAwareWindowBeneathPointer( int& rVersion,
+ XEvent* pEvent)
+{
+ XLIB_Window aRoot = DefaultRootWindow( mpDisplay );
+ XLIB_Window aWindow = aRoot, aParent = aRoot;
+ int nXRoot, nYRoot, nX, nY;
+
+ if( pEvent->type == MotionNotify )
+ {
+ nX = pEvent->xmotion.x_root;
+ nY = pEvent->xmotion.y_root;
+ }
+ else if( pEvent->type == ButtonPress || pEvent->type == ButtonRelease )
+ {
+ nX = pEvent->xbutton.x_root;
+ nY = pEvent->xbutton.y_root;
+ }
+ else if( pEvent->type == XLIB_KeyPress || pEvent->type == KeyRelease )
+ {
+ nX = pEvent->xkey.x_root;
+ nY = pEvent->xkey.y_root;
+ }
+
+ rVersion = 0;
+ while( ! rVersion && aWindow != None )
+ {
+ XTranslateCoordinates( mpDisplay, aRoot, aParent,
+ nX, nY, &nXRoot, &nYRoot, &aWindow );
+ if( aWindow != None )
+ {
+ aParent = aWindow;
+
+ Atom aActualType;
+ int nActualFormat;
+ unsigned long nItems;
+ unsigned long nBytesAfter;
+ unsigned char *pData=0;
+ XGetWindowProperty( mpDisplay, aWindow,
+ mnXdndAware,
+ 0, 1, False, XA_ATOM,
+ &aActualType, &nActualFormat,
+ &nItems, &nBytesAfter, &pData );
+ if( pData &&
+ aActualType == XA_ATOM &&
+ nActualFormat == 32 &&
+ nItems == 1 )
+ {
+ rVersion = *((int*)pData );
+ }
+ if( pData )
+ XFree( pData );
+ }
+ }
+ if( ! rVersion )
+ return None;
+
+ return aWindow;
+}
+
+void DtIntegrator::SendXdndLeave()
+{
+ if( maDragTarget != None )
+ {
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = mpDisplay;
+ aEvent.xclient.window = maDragTarget;
+ aEvent.xclient.format = 32;
+ aEvent.xclient.message_type = mnXdndLeave;
+ aEvent.xclient.data.l[0] = maDragSource;
+ aEvent.xclient.data.l[1] = 0;
+ XSendEvent( mpDisplay, maDragTarget, False,
+ NoEventMask, &aEvent );
+#if defined DEBUG
+ fprintf( stderr, "Sending XdndLeave\n" );
+#endif
+ }
+}
+
+void DtIntegrator::SendXdndEnter()
+{
+ if( maDragTarget != None )
+ {
+ int i;
+ XEvent aEvent;
+
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = mpDisplay;
+ aEvent.xclient.window = maDragTarget;
+ aEvent.xclient.format = 32;
+ aEvent.xclient.message_type = mnXdndEnter;
+ aEvent.xclient.data.l[0] = maDragSource;
+ aEvent.xclient.data.l[1] = maDragTypes.Count() > 3 ? 1 : 0;
+ aEvent.xclient.data.l[1] |= XDND_PROTOCOL_VERSION << 24;
+ aEvent.xclient.data.l[2] = None;
+ aEvent.xclient.data.l[3] = None;
+ aEvent.xclient.data.l[4] = None;
+ for( i = 0; i < maDragTypes.Count() && i < 3; i++ )
+ aEvent.xclient.data.l[i+2] =
+ XInternAtom( mpDisplay,
+ ByteString( *maDragTypes.GetObject( i ), RTL_TEXTENCODING_ISO_8859_1 ).GetBuffer(),
+ False );
+ XSendEvent( mpDisplay, maDragTarget, False,
+ NoEventMask, &aEvent );
+#if defined DEBUG
+ fprintf( stderr, "Sending XdndEnter\n" );
+#endif
+ }
+}
+
+void DtIntegrator::SendXdndPosition( XEvent* pEvent )
+{
+ static int nLastSendX = -1;
+ static int nLastSendY = -1;
+ static int nLastState = 0, nState = 0;
+
+ if( pEvent->type == ButtonPress || pEvent->type == ButtonRelease )
+ {
+ mnLastDragX = pEvent->xbutton.x_root;
+ mnLastDragY = pEvent->xbutton.y_root;
+ mnLastDragTimestamp = pEvent->xbutton.time;
+ nState = pEvent->xbutton.state;
+ }
+ else if( pEvent->type == MotionNotify )
+ {
+ mnLastDragX = pEvent->xmotion.x_root;
+ mnLastDragY = pEvent->xmotion.y_root;
+ mnLastDragTimestamp = pEvent->xmotion.time;
+ nState = pEvent->xmotion.state;
+ }
+ else if( pEvent->type == XLIB_KeyPress || pEvent->type == KeyRelease )
+ {
+ mnLastDragX = pEvent->xkey.x_root;
+ mnLastDragY = pEvent->xkey.y_root;
+ mnLastDragTimestamp = pEvent->xkey.time;
+ nState = pEvent->xkey.state;
+ }
+ if( maDragTarget != None &&
+ meDragState != DtWaitForStatus &&
+ meDragState != DtWaitForDataRequest &&
+ ( mnLastDragX != nLastSendX ||
+ mnLastDragY != nLastSendY ||
+ nState != nLastState )
+ )
+ {
+ nLastSendX = mnLastDragX;
+ nLastSendY = mnLastDragY;
+ nLastState = nState;
+
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = mpDisplay;
+ aEvent.xclient.window = maDragTarget;
+ aEvent.xclient.format = 32;
+ aEvent.xclient.message_type = mnXdndPosition;
+ aEvent.xclient.data.l[0] = maDragSource;
+ aEvent.xclient.data.l[1] = 0;
+ aEvent.xclient.data.l[2] =
+ ( mnLastDragX << 16 ) | ( mnLastDragY );
+ aEvent.xclient.data.l[3] = mnLastDragTimestamp;
+ // Insert correct DropAction here
+ if( nLastState & ( ShiftMask | ControlMask ) )
+ aEvent.xclient.data.l[4] = mnXdndActionLink;
+ else if( nLastState & ShiftMask )
+ aEvent.xclient.data.l[4] = mnXdndActionMove;
+ else if( nLastState & ControlMask )
+ aEvent.xclient.data.l[4] = mnXdndActionCopy;
+ else
+ aEvent.xclient.data.l[4] = mnXdndActionCopy;
+
+ XSendEvent( mpDisplay, maDragTarget, False,
+ NoEventMask, &aEvent );
+ meDragState = DtWaitForStatus;
+ mnWaitTimestamp = mnLastDragTimestamp;
+#if defined DEBUG
+ fprintf( stderr, "Sending XdndPosition\n" );
+#endif
+ }
+}
+
+void DtIntegrator::CheckXdndTimeout( int nTime )
+{
+ if( meDragState == DtWaitForDataRequest &&
+ ( nTime - mnWaitTimestamp > 5000 ||
+ mnWaitTimestamp > nTime ) )
+ {
+#if defined DEBUG
+ fprintf( stderr, "Timeout on DtWaitForRequestData\n" );
+#endif
+ maDragTarget = None;
+ maDragSource = None;
+ meDragState = DtDragNone;
+ }
+ else if( meDragState == DtWaitForStatus &&
+ ( nTime - mnWaitTimestamp > 5000 ||
+ mnWaitTimestamp > nTime ) )
+ {
+#if defined DEBUG
+ fprintf( stderr, "Timeout on DtWaitForStatus\n" );
+#endif
+ meDragState = DtDragging;
+ }
+}
+
+BOOL DtIntegrator::GetSystemLook( SystemLookInfo& rInfo )
+{
+ return FALSE;
+}
diff --git a/vcl/unx/source/gdi/makefile.mk b/vcl/unx/source/gdi/makefile.mk
new file mode 100644
index 000000000000..4fabb41d3d6a
--- /dev/null
+++ b/vcl/unx/source/gdi/makefile.mk
@@ -0,0 +1,124 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salgdi
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(OS)"=="MACOSX"
+
+dummy:
+ @echo "Nothing to build for Mac OS X"
+
+.ELSE # "$(OS)"=="MACOSX"
+
+.IF "$(remote)"==""
+SLOFILES= \
+ $(SLO)$/salgdi2.obj \
+ $(SLO)$/salbmp.obj \
+ $(SLO)$/salgdi.obj \
+ $(SLO)$/salvd.obj \
+ $(SLO)$/salprn.obj \
+ $(SLO)$/salogl.obj \
+ $(SLO)$/salpimpl.obj \
+ $(SLO)$/charnames.obj \
+ $(SLO)$/dtint.obj \
+ $(SLO)$/cdeint.obj \
+ $(SLO)$/kdeint.obj \
+ $(SLO)$/salconfig.obj \
+ $(SLO)$/salcvt.obj \
+ $(SLO)$/ansi1252.obj \
+ $(SLO)$/xfont.obj \
+ $(SLO)$/xlfd_attr.obj \
+ $(SLO)$/xlfd_extd.obj \
+ $(SLO)$/xlfd_smpl.obj \
+ $(SLO)$/salgdi3.obj
+
+.ENDIF
+
+.ENDIF # "$(OS)"=="MACOSX"
+
+# --- Targets ------------------------------------------------------
+
+ALL: $(INCCOM)$/rtsname.hxx ALLTAR
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+XSALSETLIBNAME=libspa$(UPD)$(DLLPOSTFIX).so
+
+$(INCCOM)$/rtsname.hxx:
+ rm -f $(INCCOM)$/rtsname.hxx ; \
+ echo "#define _XSALSET_LIBNAME "\"$(XSALSETLIBNAME)\" > $(INCCOM)$/rtsname.hxx
+
+salpimpl.cxx: $(INCCOM)$/rtsname.hxx
diff --git a/vcl/unx/source/gdi/salbmp.cxx b/vcl/unx/source/gdi/salbmp.cxx
new file mode 100644
index 000000000000..bb0feb821a91
--- /dev/null
+++ b/vcl/unx/source/gdi/salbmp.cxx
@@ -0,0 +1,885 @@
+/*************************************************************************
+ *
+ * $RCSfile: salbmp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALBMP_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/shm.h>
+#include <prex.h>
+#include <postx.h>
+#include <salunx.h>
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define SAL_DRAWPIXMAP_MAX_EXT 4096
+
+// -------------
+// - SalBitmap -
+// -------------
+
+ImplSalBitmapCache* SalBitmap::mpCache = NULL;
+ULONG SalBitmap::mnCacheInstCount = 0;
+
+// -----------------------------------------------------------------------------
+
+SalBitmap::SalBitmap() :
+ mpDIB( NULL ),
+ mpDDB( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SalBitmap::~SalBitmap()
+{
+ Destroy();
+}
+
+// -----------------------------------------------------------------------------
+
+void SalBitmap::ImplCreateCache()
+{
+ if( !mnCacheInstCount++ )
+ mpCache = new ImplSalBitmapCache;
+}
+
+// -----------------------------------------------------------------------------
+
+void SalBitmap::ImplDestroyCache()
+{
+ DBG_ASSERT( mnCacheInstCount, "SalBitmap::ImplDestroyCache(): underflow" );
+
+ if( mnCacheInstCount && !--mnCacheInstCount )
+ delete mpCache, mpCache = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+void SalBitmap::ImplRemovedFromCache()
+{
+ if( mpDDB )
+ delete mpDDB, mpDDB = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+BitmapBuffer* SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
+{
+ DBG_ASSERT( nBitCount == 1 || nBitCount == 4 || nBitCount == 8 || nBitCount == 24, "Unsupported BitCount!" );
+
+ BitmapBuffer* pDIB;
+
+ if( rSize.Width() && rSize.Height() )
+ {
+ pDIB = new BitmapBuffer;
+
+ if( pDIB )
+ {
+ const USHORT nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0;
+
+ pDIB->mnFormat = BMP_FORMAT_BOTTOM_UP;
+
+ switch( nBitCount )
+ {
+ case( 1 ): pDIB->mnFormat |= BMP_FORMAT_1BIT_MSB_PAL; break;
+ case( 4 ): pDIB->mnFormat |= BMP_FORMAT_4BIT_MSN_PAL; break;
+ case( 8 ): pDIB->mnFormat |= BMP_FORMAT_8BIT_PAL; break;
+
+ default:
+ pDIB->mnFormat |= BMP_FORMAT_24BIT_TC_BGR;
+ break;
+ }
+
+ pDIB->mnWidth = rSize.Width();
+ pDIB->mnHeight = rSize.Height();
+ pDIB->mnScanlineSize = AlignedWidth4Bytes( pDIB->mnWidth * nBitCount );
+ pDIB->mnBitCount = nBitCount;
+
+ if( nColors )
+ {
+ pDIB->maPalette = rPal;
+ pDIB->maPalette.SetEntryCount( nColors );
+ }
+
+ pDIB->mpBits = new BYTE[ pDIB->mnScanlineSize * pDIB->mnHeight ];
+ rtl_zeroMemory( pDIB->mpBits, pDIB->mnScanlineSize * pDIB->mnHeight );
+ }
+ }
+ else
+ pDIB = NULL;
+
+ return pDIB;
+}
+
+// -----------------------------------------------------------------------------
+
+BitmapBuffer* SalBitmap::ImplCreateDIB( Drawable aDrawable,
+ long nDrawableDepth,
+ long nX, long nY,
+ long nWidth, long nHeight )
+{
+ BitmapBuffer* pDIB = NULL;
+
+ if( aDrawable && nWidth && nHeight && nDrawableDepth )
+ {
+ SalDisplay* pSalDisp = GetSalData()->GetCurDisp();
+ SalXLib* pXLib = pSalDisp->GetXLib();
+ Display* pXDisp = pSalDisp->GetDisplay();
+
+ // do not die on XError here
+ // alternatively one could check the coordinates for being offscreen
+ // but this call can actually work on servers with backing store
+ // defaults even if the rectangle is offscreen
+ // so better catch the XError
+ BOOL bXError = pXLib->GetIgnoreXErrors();
+ pXLib->SetIgnoreXErrors( TRUE );
+ XImage* pImage = XGetImage( pXDisp, aDrawable, nX, nY, nWidth, nHeight, AllPlanes, ZPixmap );
+ BOOL bWasError = pXLib->WasXError();
+ pXLib->SetIgnoreXErrors( bXError );
+
+ if( ! bWasError && pImage && pImage->data )
+ {
+ const SalTwoRect aTwoRect = { 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight };
+ BitmapBuffer aSrcBuf;
+ ULONG nDstFormat = BMP_FORMAT_BOTTOM_UP;
+ const BitmapPalette* pDstPal = NULL;
+
+ aSrcBuf.mnFormat = BMP_FORMAT_TOP_DOWN;
+ aSrcBuf.mnWidth = nWidth;
+ aSrcBuf.mnHeight = nHeight;
+ aSrcBuf.mnBitCount = pImage->bits_per_pixel;
+ aSrcBuf.mnScanlineSize = pImage->bytes_per_line;
+ aSrcBuf.mpBits = (BYTE*) pImage->data;
+
+ pImage->red_mask = pSalDisp->GetVisual()->red_mask;
+ pImage->green_mask = pSalDisp->GetVisual()->green_mask;
+ pImage->blue_mask = pSalDisp->GetVisual()->blue_mask;
+
+ switch( aSrcBuf.mnBitCount )
+ {
+ case( 1 ):
+ {
+ aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL );
+ nDstFormat |= BMP_FORMAT_1BIT_MSB_PAL;
+ }
+ break;
+
+ case( 4 ):
+ {
+ aSrcBuf.mnFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL );
+ nDstFormat |= BMP_FORMAT_4BIT_MSN_PAL;
+ }
+ break;
+
+ case( 8 ):
+ {
+ aSrcBuf.mnFormat |= BMP_FORMAT_8BIT_PAL;
+ nDstFormat |= BMP_FORMAT_8BIT_PAL;
+ }
+ break;
+
+ case( 16 ):
+ {
+ aSrcBuf.mnFormat |= BMP_FORMAT_16BIT_TC_MASK;
+ nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
+
+ if( LSBFirst == pImage->byte_order )
+ aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
+ else
+ aSrcBuf.maColorMask = ColorMask( SWAPSHORT( pImage->red_mask ), SWAPSHORT( pImage->green_mask ), SWAPSHORT( pImage->blue_mask ) );
+ }
+ break;
+
+ case( 24 ):
+ {
+ if( ( LSBFirst == pImage->byte_order ) && ( pImage->red_mask == 0xFF ) )
+ aSrcBuf.mnFormat |= BMP_FORMAT_24BIT_TC_RGB;
+ else
+ aSrcBuf.mnFormat |= BMP_FORMAT_24BIT_TC_BGR;
+
+ nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
+ }
+ break;
+
+ case( 32 ):
+ {
+ if( LSBFirst == pImage->byte_order )
+ aSrcBuf.mnFormat |= ( pSalDisp->GetVisual()->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA );
+ else
+ aSrcBuf.mnFormat |= ( pSalDisp->GetVisual()->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB );
+
+ nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
+ }
+ break;
+ }
+
+ BitmapPalette& rPal = aSrcBuf.maPalette;
+
+ if( aSrcBuf.mnBitCount == 1 )
+ {
+ rPal.SetEntryCount( 2 );
+ pDstPal = &rPal;
+
+ rPal[ 0 ] = Color( COL_BLACK );
+ rPal[ 1 ] = Color( COL_WHITE );
+ }
+ else if( aSrcBuf.mnBitCount <= 8 )
+ {
+ SalColormap& rColMap = pSalDisp->GetColormap();
+ const USHORT nCols = Min( (USHORT)rColMap.GetUsed(), 1 << nDrawableDepth );
+
+ rPal.SetEntryCount( nCols );
+ pDstPal = &rPal;
+
+ for( USHORT i = 0; i < nCols; i++ )
+ {
+ const SalColor nColor( rColMap.GetColor( i ) );
+ BitmapColor& rBmpCol = rPal[ i ];
+
+ rBmpCol.SetRed( SALCOLOR_RED( nColor ) );
+ rBmpCol.SetGreen( SALCOLOR_GREEN( nColor ) );
+ rBmpCol.SetBlue( SALCOLOR_BLUE( nColor ) );
+ }
+ }
+
+ pDIB = StretchAndConvert( aSrcBuf, aTwoRect, nDstFormat, const_cast<BitmapPalette*>(pDstPal) );
+ XDestroyImage( pImage );
+ }
+ }
+
+ return pDIB;
+}
+
+// -----------------------------------------------------------------------------
+
+XImage* SalBitmap::ImplCreateXImage( SalDisplay *pSalDisp, long nDepth, const SalTwoRect& rTwoRect ) const
+{
+ XImage* pImage = NULL;
+
+ if( !mpDIB && mpDDB )
+ {
+ ( (SalBitmap*) this )->mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(),
+ mpDDB->ImplGetDepth(),
+ 0, 0,
+ mpDDB->ImplGetWidth(),
+ mpDDB->ImplGetHeight() );
+ }
+
+ if( mpDIB && mpDIB->mnWidth && mpDIB->mnHeight )
+ {
+ Display* pXDisp = pSalDisp->GetDisplay();
+ long nWidth = rTwoRect.mnDestWidth;
+ long nHeight = rTwoRect.mnDestHeight;
+
+ if( 1 == GetBitCount() )
+ nDepth = 1;
+
+ pImage = XCreateImage( pXDisp, pSalDisp->GetVisual()->GetVisual(),
+ nDepth, ( 1 == nDepth ) ? XYBitmap :ZPixmap, 0, NULL,
+ nWidth, nHeight, 32, 0 );
+
+ if( pImage )
+ {
+ BitmapBuffer* pDstBuf;
+ ULONG nDstFormat = BMP_FORMAT_TOP_DOWN;
+ BitmapPalette* pPal = NULL;
+ ColorMask* pMask = NULL;
+
+ switch( pImage->bits_per_pixel )
+ {
+ case( 1 ):
+ nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_1BIT_LSB_PAL : BMP_FORMAT_1BIT_MSB_PAL );
+ break;
+
+ case( 4 ):
+ nDstFormat |= ( LSBFirst == pImage->bitmap_bit_order ? BMP_FORMAT_4BIT_LSN_PAL : BMP_FORMAT_4BIT_MSN_PAL );
+ break;
+
+ case( 8 ):
+ nDstFormat |= BMP_FORMAT_8BIT_PAL;
+ break;
+
+ case( 16 ):
+ {
+ nDstFormat |= BMP_FORMAT_16BIT_TC_MASK;
+
+ if( LSBFirst == pImage->byte_order )
+ pMask = new ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask );
+ else
+ pMask = new ColorMask( SWAPSHORT( pImage->red_mask ), SWAPSHORT( pImage->green_mask ), SWAPSHORT( pImage->blue_mask ) );
+ }
+ break;
+
+ case( 24 ):
+ {
+ if( ( LSBFirst == pImage->byte_order ) && ( pImage->red_mask == 0xFF ) )
+ nDstFormat |= BMP_FORMAT_24BIT_TC_RGB;
+ else
+ nDstFormat |= BMP_FORMAT_24BIT_TC_BGR;
+ }
+ break;
+
+ case( 32 ):
+ {
+ if( LSBFirst == pImage->byte_order )
+ nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_RGBA : BMP_FORMAT_32BIT_TC_BGRA );
+ else
+ nDstFormat |= ( pImage->red_mask == 0xFF ? BMP_FORMAT_32BIT_TC_ABGR : BMP_FORMAT_32BIT_TC_ARGB );
+ }
+ break;
+ }
+
+ if( pImage->depth == 1 )
+ {
+ pPal = new BitmapPalette( 2 );
+ (*pPal)[ 0 ] = Color( COL_BLACK );
+ (*pPal)[ 1 ] = Color( COL_WHITE );
+ }
+ else if( pImage->depth <= 8 )
+ {
+ SalColormap& rColMap = pSalDisp->GetColormap();
+ const USHORT nCols = Min( (USHORT)rColMap.GetUsed(), 1 << pImage->depth );
+
+ pPal = new BitmapPalette( nCols );
+
+ for( USHORT i = 0; i < nCols; i++ )
+ {
+ const SalColor nColor( rColMap.GetColor( i ) );
+ BitmapColor& rBmpCol = (*pPal)[ i ];
+
+ rBmpCol.SetRed( SALCOLOR_RED( nColor ) );
+ rBmpCol.SetGreen( SALCOLOR_GREEN( nColor ) );
+ rBmpCol.SetBlue( SALCOLOR_BLUE( nColor ) );
+ }
+ }
+
+ pDstBuf = StretchAndConvert( *mpDIB, rTwoRect, nDstFormat, pPal, pMask );
+ delete pPal;
+ delete pMask;
+
+ if( pDstBuf && pDstBuf->mpBits )
+ {
+ // set data in buffer as data member in pImage
+ pImage->data = (char*) pDstBuf->mpBits;
+
+ // destroy buffer; don't destroy allocated data in buffer
+ delete pDstBuf;
+ }
+ else
+ {
+ XDestroyImage( pImage );
+ pImage = NULL;
+ }
+ }
+ }
+
+ return pImage;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL SalBitmap::ImplCreateFromDrawable( Drawable aDrawable, long nDrawableDepth,
+ long nX, long nY, long nWidth, long nHeight )
+{
+ Destroy();
+
+ if( aDrawable && nWidth && nHeight && nDrawableDepth )
+ mpDDB = new ImplSalDDB( aDrawable, nDrawableDepth, nX, nY, nWidth, nHeight );
+
+ return( mpDDB != NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+void SalBitmap::ImplDraw( Drawable aDrawable, long nDrawableDepth,
+ const SalTwoRect& rTwoRect, const GC& rGC ) const
+{
+ if( !mpDDB || !mpDDB->ImplMatches( nDrawableDepth, rTwoRect ) )
+ {
+ if( mpDDB )
+ {
+ // do we already have a DIB? if not, create aDIB from current DDB first
+ if( !mpDIB )
+ {
+ ( (SalBitmap*) this )->mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(),
+ mpDDB->ImplGetDepth(),
+ 0, 0,
+ mpDDB->ImplGetWidth(),
+ mpDDB->ImplGetHeight() );
+ }
+
+ delete mpDDB, ( (SalBitmap*) this )->mpDDB = NULL;
+ }
+
+ if( mpCache )
+ mpCache->ImplRemove( const_cast<SalBitmap*>(this) );
+
+ SalTwoRect aTwoRect( rTwoRect );
+
+ // create new DDB from DIB
+ if( aTwoRect.mnSrcWidth == aTwoRect.mnDestWidth &&
+ aTwoRect.mnSrcHeight == aTwoRect.mnDestHeight )
+ {
+ const Size aSize( GetSize() );
+
+ aTwoRect.mnSrcX = aTwoRect.mnSrcY = aTwoRect.mnDestX = aTwoRect.mnDestY = 0;
+ aTwoRect.mnSrcWidth = aTwoRect.mnDestWidth = aSize.Width();
+ aTwoRect.mnSrcHeight = aTwoRect.mnDestHeight = aSize.Height();
+ }
+
+ XImage* pImage = ImplCreateXImage( GetSalData()->GetCurDisp(),
+ nDrawableDepth, aTwoRect );
+
+ if( pImage )
+ {
+ ( (SalBitmap*) this )->mpDDB = new ImplSalDDB( pImage, aDrawable, aTwoRect );
+ delete[] pImage->data, pImage->data = NULL;
+ XDestroyImage( pImage );
+
+ if( mpCache )
+ mpCache->ImplAdd( const_cast<SalBitmap*>(this), mpDDB->ImplGetMemSize() );
+ }
+ }
+
+ if( mpDDB )
+ mpDDB->ImplDraw( aDrawable, nDrawableDepth, rTwoRect, rGC );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
+{
+ Destroy();
+ mpDIB = ImplCreateDIB( rSize, nBitCount, rPal );
+
+ return( mpDIB != NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp )
+{
+ Destroy();
+
+ if( rSalBmp.mpDIB )
+ {
+ const Size aSize( rSalBmp.GetSize() );
+
+ mpDIB = ImplCreateDIB( rSalBmp.GetSize(), rSalBmp.GetBitCount(), rSalBmp.mpDIB->maPalette );
+
+ if( mpDIB )
+ memcpy( mpDIB->mpBits, rSalBmp.mpDIB->mpBits, mpDIB->mnScanlineSize * mpDIB->mnHeight );
+ }
+ else
+ {
+ DBG_ASSERT( !rSalBmp.mpDDB, "trying to copy construct SalBitmap with DDB => NYI" );
+ }
+
+ return( !rSalBmp.mpDIB || ( mpDIB != NULL ) );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount )
+{
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------------
+
+void SalBitmap::Destroy()
+{
+ if( mpDIB )
+ {
+ delete[] mpDIB->mpBits;
+ delete mpDIB, mpDIB = NULL;
+ }
+
+ if( mpDDB )
+ delete mpDDB, mpDDB = NULL;
+
+ if( mpCache )
+ mpCache->ImplRemove( this );
+}
+
+// -----------------------------------------------------------------------------
+
+Size SalBitmap::GetSize() const
+{
+ Size aSize;
+
+ if( mpDIB )
+ aSize.Width() = mpDIB->mnWidth, aSize.Height() = mpDIB->mnHeight;
+ else if( mpDDB )
+ aSize.Width() = mpDDB->ImplGetWidth(), aSize.Height() = mpDDB->ImplGetHeight();
+
+ return aSize;
+}
+
+// -----------------------------------------------------------------------------
+
+USHORT SalBitmap::GetBitCount() const
+{
+ USHORT nBitCount;
+
+ if( mpDIB )
+ nBitCount = mpDIB->mnBitCount;
+ else if( mpDDB )
+ {
+ nBitCount = mpDDB->ImplGetDepth();
+
+ if( nBitCount && nBitCount > 1 )
+ {
+ if( nBitCount <= 4 )
+ nBitCount = 4;
+ else if( nBitCount <= 8 )
+ nBitCount = 8;
+ else
+ nBitCount = 24;
+ }
+ }
+ else
+ nBitCount = 0;
+
+ return nBitCount;
+}
+
+// -----------------------------------------------------------------------------
+
+BitmapBuffer* SalBitmap::AcquireBuffer( BOOL bReadOnly )
+{
+ if( !mpDIB && mpDDB )
+ {
+ mpDIB = ImplCreateDIB( mpDDB->ImplGetPixmap(), mpDDB->ImplGetDepth(),
+ 0, 0, mpDDB->ImplGetWidth(), mpDDB->ImplGetHeight() );
+ }
+
+ return mpDIB;
+}
+
+// -----------------------------------------------------------------------------
+
+void SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly )
+{
+ if( !bReadOnly )
+ {
+ if( mpDDB )
+ delete mpDDB, mpDDB = NULL;
+
+ if( mpCache )
+ mpCache->ImplRemove( this );
+ }
+}
+
+// --------------
+// - ImplSalDDB -
+// --------------
+
+ImplSalDDB::ImplSalDDB( XImage* pImage, Drawable aDrawable, const SalTwoRect& rTwoRect ) :
+ maPixmap ( 0 ),
+ maTwoRect ( rTwoRect ),
+ mnDepth ( pImage->depth )
+{
+ SalDisplay* pSalDisp = GetSalData()->GetCurDisp();
+ Display* pXDisp = pSalDisp->GetDisplay();
+
+ if( maPixmap = XCreatePixmap( pXDisp, aDrawable, ImplGetWidth(), ImplGetHeight(), ImplGetDepth() ) )
+ {
+ XGCValues aValues;
+ GC aGC;
+ int nValues = GCFunction;
+
+ aValues.function = GXcopy;
+
+ if( 1 == mnDepth )
+ {
+ nValues |= ( GCForeground | GCBackground );
+ aValues.foreground = 1, aValues.background = 0;
+ }
+
+ aGC = XCreateGC( pXDisp, maPixmap, nValues, &aValues );
+ XPutImage( pXDisp, maPixmap, aGC, pImage, 0, 0, 0, 0, maTwoRect.mnDestWidth, maTwoRect.mnDestHeight );
+ XFreeGC( pXDisp, aGC );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+ImplSalDDB::ImplSalDDB( Drawable aDrawable, long nDrawableDepth, long nX, long nY, long nWidth, long nHeight ) :
+ mnDepth( nDrawableDepth )
+{
+ SalDisplay* pSalDisp = GetSalData()->GetCurDisp();
+ Display* pXDisp = pSalDisp->GetDisplay();
+
+ if( maPixmap = XCreatePixmap( pXDisp, aDrawable, nWidth, nHeight, nDrawableDepth ) )
+ {
+ XGCValues aValues;
+ GC aGC;
+ int nValues = GCFunction;
+
+ aValues.function = GXcopy;
+
+ if( 1 == mnDepth )
+ {
+ nValues |= ( GCForeground | GCBackground );
+ aValues.foreground = 1, aValues.background = 0;
+ }
+
+ aGC = XCreateGC( pXDisp, maPixmap, nValues, &aValues );
+ ImplDraw( aDrawable, nDrawableDepth, maPixmap, mnDepth,
+ nX, nY, nWidth, nHeight, 0, 0, aGC );
+ XFreeGC( pXDisp, aGC );
+
+ maTwoRect.mnSrcX = maTwoRect.mnSrcY = maTwoRect.mnDestX = maTwoRect.mnDestY = 0;
+ maTwoRect.mnSrcWidth = maTwoRect.mnDestWidth = nWidth;
+ maTwoRect.mnSrcHeight = maTwoRect.mnDestHeight = nHeight;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+ImplSalDDB::~ImplSalDDB()
+{
+ if( maPixmap && ImplGetSVData() )
+ XFreePixmap( GetSalData()->GetCurDisp()->GetDisplay(), maPixmap );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImplSalDDB::ImplMatches( long nDepth, const SalTwoRect& rTwoRect ) const
+{
+ BOOL bRet = FALSE;
+
+ if( ( maPixmap != 0 ) && ( ( mnDepth == nDepth ) || ( 1 == mnDepth ) ) )
+ {
+ if( rTwoRect.mnSrcX == maTwoRect.mnSrcX && rTwoRect.mnSrcY == maTwoRect.mnSrcY &&
+ rTwoRect.mnSrcWidth == maTwoRect.mnSrcWidth && rTwoRect.mnSrcHeight == maTwoRect.mnSrcHeight &&
+ rTwoRect.mnDestWidth == maTwoRect.mnDestWidth && rTwoRect.mnDestHeight == maTwoRect.mnDestHeight )
+ {
+ // absolutely indentically
+ bRet = TRUE;
+ }
+ else if( rTwoRect.mnSrcWidth == rTwoRect.mnDestWidth && rTwoRect.mnSrcHeight == rTwoRect.mnDestHeight &&
+ maTwoRect.mnSrcWidth == maTwoRect.mnDestWidth && maTwoRect.mnSrcHeight == maTwoRect.mnDestHeight &&
+ rTwoRect.mnSrcX >= maTwoRect.mnSrcX && rTwoRect.mnSrcY >= maTwoRect.mnSrcY &&
+ ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) <= ( maTwoRect.mnSrcX + maTwoRect.mnSrcWidth ) &&
+ ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) <= ( maTwoRect.mnSrcY + maTwoRect.mnSrcHeight ) )
+ {
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplSalDDB::ImplDraw( Drawable aDrawable, long nDrawableDepth, const SalTwoRect& rTwoRect, const GC& rGC ) const
+{
+ ImplDraw( maPixmap, mnDepth, aDrawable, nDrawableDepth,
+ rTwoRect.mnSrcX - maTwoRect.mnSrcX, rTwoRect.mnSrcY - maTwoRect.mnSrcY,
+ rTwoRect.mnDestWidth, rTwoRect.mnDestHeight,
+ rTwoRect.mnDestX, rTwoRect.mnDestY, rGC );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplSalDDB::ImplDraw( Drawable aSrcDrawable, long nSrcDrawableDepth,
+ Drawable aDstDrawable, long nDstDrawableDepth,
+ long nSrcX, long nSrcY,
+ long nDestWidth, long nDestHeight,
+ long nDestX, long nDestY, const GC& rGC )
+{
+ SalDisplay* pSalDisp = GetSalData()->GetCurDisp();
+ Display* pXDisp = pSalDisp->GetDisplay();
+
+ if( 1 == nSrcDrawableDepth )
+ {
+ XCopyPlane( pXDisp, aSrcDrawable, aDstDrawable, rGC,
+ nSrcX, nSrcY, nDestWidth, nDestHeight, nDestX, nDestY, 1 );
+ }
+ else
+ {
+ if( nDestWidth > SAL_DRAWPIXMAP_MAX_EXT )
+ {
+ // !!! Broken XCopyArea
+ XCopyArea( pXDisp, aSrcDrawable, aDstDrawable, rGC,
+ nSrcX, nSrcY, nDestWidth, nDestHeight, nDestX, nDestY );
+ }
+ else
+ {
+ XCopyArea( pXDisp, aSrcDrawable, aDstDrawable, rGC,
+ nSrcX, nSrcY, nDestWidth, nDestHeight, nDestX, nDestY );
+ }
+ }
+}
+
+// ----------------------
+// - ImplSalBitmapCache -
+// ----------------------
+
+struct ImplBmpObj
+{
+ SalBitmap* mpBmp;
+ ULONG mnMemSize;
+ ULONG mnFlags;
+
+ ImplBmpObj( SalBitmap* pBmp, ULONG nMemSize, ULONG nFlags ) :
+ mpBmp( pBmp ), mnMemSize( nMemSize ), mnFlags( nFlags ) {}
+};
+
+// -----------------------------------------------------------------------------
+
+ImplSalBitmapCache::ImplSalBitmapCache() :
+ mnTotalSize( 0UL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ImplSalBitmapCache::~ImplSalBitmapCache()
+{
+ ImplClear();
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplSalBitmapCache::ImplAdd( SalBitmap* pBmp, ULONG nMemSize, ULONG nFlags )
+{
+ ImplBmpObj* pObj;
+ BOOL bFound = FALSE;
+
+ for( pObj = (ImplBmpObj*) maBmpList.Last(); pObj && !bFound; pObj = (ImplBmpObj*) maBmpList.Prev() )
+ if( pObj->mpBmp == pBmp )
+ bFound = TRUE;
+
+ mnTotalSize += nMemSize;
+
+ if( bFound )
+ {
+ mnTotalSize -= pObj->mnMemSize;
+ pObj->mnMemSize = nMemSize, pObj->mnFlags = nFlags;
+ }
+ else
+ maBmpList.Insert( new ImplBmpObj( pBmp, nMemSize, nFlags ), LIST_APPEND );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplSalBitmapCache::ImplRemove( SalBitmap* pBmp )
+{
+ for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.Last(); pObj; pObj = (ImplBmpObj*) maBmpList.Prev() )
+ {
+ if( pObj->mpBmp == pBmp )
+ {
+ maBmpList.Remove( pObj );
+ pObj->mpBmp->ImplRemovedFromCache();
+ mnTotalSize -= pObj->mnMemSize;
+ delete pObj;
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ImplSalBitmapCache::ImplClear()
+{
+ for( ImplBmpObj* pObj = (ImplBmpObj*) maBmpList.First(); pObj; pObj = (ImplBmpObj*) maBmpList.Next() )
+ {
+ pObj->mpBmp->ImplRemovedFromCache();
+ delete pObj;
+ }
+
+ maBmpList.Clear();
+ mnTotalSize = 0;
+}
diff --git a/vcl/unx/source/gdi/salcvt.cxx b/vcl/unx/source/gdi/salcvt.cxx
new file mode 100644
index 000000000000..49359471a25f
--- /dev/null
+++ b/vcl/unx/source/gdi/salcvt.cxx
@@ -0,0 +1,434 @@
+/*************************************************************************
+ *
+ * $RCSfile: salcvt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef SAL_CONVERTER_CACHE_HXX_
+#include "salcvt.hxx"
+#endif
+
+
+SalConverterCache::SalConverterCache()
+{
+ mpConverter = (ConverterT*)calloc( sizeof(ConverterT), RTL_TEXTENCODING_STD_COUNT );
+}
+
+SalConverterCache::~SalConverterCache()
+{
+ for ( int i = 0; i < RTL_TEXTENCODING_STD_COUNT; i++ )
+ {
+ if ( mpConverter[i].mpU2T != NULL )
+ rtl_destroyUnicodeToTextConverter( mpConverter[i].mpU2T );
+ if ( mpConverter[i].mpT2U != NULL )
+ rtl_destroyTextToUnicodeConverter( mpConverter[i].mpT2U );
+ }
+ free( mpConverter );
+}
+
+// ---> FIXME
+#include <stdio.h>
+// <---
+
+rtl_UnicodeToTextConverter
+SalConverterCache::GetU2TConverter( rtl_TextEncoding nEncoding )
+{
+ if ( nEncoding < RTL_TEXTENCODING_STD_COUNT )
+ {
+ if ( mpConverter[ nEncoding ].mpU2T == NULL )
+ {
+ mpConverter[ nEncoding ].mpU2T =
+ rtl_createUnicodeToTextConverter( nEncoding );
+// ---> FIXME
+if ( mpConverter[ nEncoding ].mpU2T == NULL )
+ fprintf( stderr, "failed to create Unicode -> %s converter\n",
+ pGetEncodingName(nEncoding) );
+// <---
+ }
+ return mpConverter[ nEncoding ].mpU2T;
+ }
+ return NULL;
+}
+
+rtl_TextToUnicodeConverter
+SalConverterCache::GetT2UConverter( rtl_TextEncoding nEncoding )
+{
+ if ( nEncoding < RTL_TEXTENCODING_STD_COUNT )
+ {
+ if ( mpConverter[ nEncoding ].mpT2U == NULL )
+ {
+ mpConverter[ nEncoding ].mpT2U =
+ rtl_createTextToUnicodeConverter( nEncoding );
+// ---> FIXME
+if ( mpConverter[ nEncoding ].mpT2U == NULL )
+ fprintf( stderr, "failed to create %s -> Unicode converter\n",
+ pGetEncodingName(nEncoding) );
+// <---
+ }
+ return mpConverter[ nEncoding ].mpT2U;
+ }
+ return NULL;
+}
+
+Bool
+SalConverterCache::IsSingleByteEncoding( rtl_TextEncoding nEncoding )
+{
+ if ( nEncoding < RTL_TEXTENCODING_STD_COUNT )
+ {
+ if ( ! mpConverter[ nEncoding ].mbValid )
+ {
+ mpConverter[ nEncoding ].mbValid = True;
+
+ rtl_TextEncodingInfo aTextEncInfo;
+ aTextEncInfo.StructSize = sizeof( aTextEncInfo );
+ rtl_getTextEncodingInfo( nEncoding, &aTextEncInfo );
+
+ if ( aTextEncInfo.MinimumCharSize == aTextEncInfo.MaximumCharSize
+ && aTextEncInfo.MinimumCharSize == 1)
+ mpConverter[ nEncoding ].mbSingleByteEncoding = True;
+ else
+ mpConverter[ nEncoding ].mbSingleByteEncoding = False;
+ }
+
+ return mpConverter[ nEncoding ].mbSingleByteEncoding;
+ }
+ return False;
+}
+
+// check whether the character set nEncoding contains the unicode
+// code point nChar. This list has been compiled from the according
+// ttmap files in /usr/openwin/lib/X11/fonts/TrueType/ttmap/
+Bool
+SalConverterCache::EncodingHasChar( rtl_TextEncoding nEncoding,
+ sal_Unicode nChar )
+{
+ Bool bMatch = False;
+
+ switch ( nEncoding )
+ {
+ case RTL_TEXTENCODING_DONTKNOW:
+ bMatch = False;
+ break;
+
+ case RTL_TEXTENCODING_MS_1252:
+ case RTL_TEXTENCODING_ISO_8859_1:
+ bMatch = ( nChar >= 0x0000 && nChar <= 0x00ff );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_2:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x017e )
+ || ( nChar >= 0x02c7 && nChar <= 0x02dd );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_4:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x017e )
+ || ( nChar >= 0x02c7 && nChar <= 0x02db );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_5:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x00ad )
+ || ( nChar >= 0x0401 && nChar <= 0x045f )
+ || ( nChar == 0x2116 );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_6:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x0600 && nChar <= 0x06ff )
+ || ( nChar >= 0xfb50 && nChar <= 0xfffe );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_7:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x00bd )
+ || ( nChar == 0x02bd )
+ || ( nChar >= 0x0384 && nChar <= 0x03ce )
+ || ( nChar >= 0x2014 && nChar <= 0x2019 );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_8:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x00f7 )
+ || ( nChar >= 0x05d0 && nChar <= 0x05ea )
+ || ( nChar == 0x2017 );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_9:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x015f );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_13:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x017e )
+ || ( nChar >= 0x2019 && nChar <= 0x201e );
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_15:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x00ff )
+ || ( nChar >= 0x0152 && nChar <= 0x017e )
+ || ( nChar >= 0x20ac && nChar <= 0x20ac );
+ break;
+
+ case RTL_TEXTENCODING_JIS_X_0201:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0xff61 && nChar <= 0xff9f );
+ break;
+
+ case RTL_TEXTENCODING_MS_1251:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x00bb )
+ || ( nChar >= 0x0401 && nChar <= 0x045f )
+ || ( nChar >= 0x0490 && nChar <= 0x0491 )
+ || ( nChar >= 0x2013 && nChar <= 0x203a )
+ || ( nChar >= 0x2116 && nChar <= 0x2122 )
+ || ( nChar == 0xfffe );
+ break;
+
+ case RTL_TEXTENCODING_KOI8_R:
+ bMatch = ( nChar >= 0x0020 && nChar <= 0x007e )
+ || ( nChar >= 0x00a0 && nChar <= 0x00b7 )
+ || ( nChar == 0x00f7 )
+ || ( nChar >= 0x0401 && nChar <= 0x0451 )
+ || ( nChar >= 0x2219 && nChar <= 0x221a )
+ || ( nChar >= 0x2248 && nChar <= 0x2265 )
+ || ( nChar >= 0x2320 && nChar <= 0x2321 )
+ || ( nChar >= 0x2500 && nChar <= 0x25a0 );
+ break;
+
+ case RTL_TEXTENCODING_UNICODE:
+ bMatch = True;
+ break;
+
+ default:
+ // XXX really convert the unicode char into the encoding
+ // and check for conversion errors, this is expensive !
+ rtl_UnicodeToTextConverter aConverter;
+ rtl_UnicodeToTextContext aContext;
+
+ aConverter = GetU2TConverter(nEncoding);
+ aContext = rtl_createUnicodeToTextContext( aConverter );
+
+ // ---> FIXME
+ if ( aConverter == NULL )
+ return False;
+ // <---
+
+ sal_Char pConversionBuffer[ 32 ];
+ sal_uInt32 nConversionInfo;
+ sal_Size nConvertedChars;
+ sal_uInt32 nCodePoint;
+ sal_Size nSize;
+
+ nSize = rtl_convertUnicodeToText( aConverter, aContext,
+ &nChar, 1, pConversionBuffer, sizeof(pConversionBuffer),
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
+ | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR,
+ &nConversionInfo, &nConvertedChars );
+
+ rtl_destroyUnicodeToTextContext( aConverter, aContext );
+
+ bMatch = (nConvertedChars == 1)
+ && (nSize == 1 || nSize == 2) // XXX Fix me this is a hack
+ && ((nConversionInfo & RTL_UNICODETOTEXT_INFO_ERROR) == 0);
+ break;
+ }
+
+ return bMatch;
+}
+
+// wrapper for rtl_convertUnicodeToText that handles the usual cases for
+// textconversion in drawtext and gettextwidth routines
+sal_Size
+ConvertStringUTF16( const sal_Unicode *pText, int nTextLen,
+ sal_Char *pBuffer, sal_Size nBufferSize,
+ rtl_UnicodeToTextConverter aConverter )
+{
+ const sal_uInt32 nCvtFlags =
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK
+ | RTL_UNICODETOTEXT_FLAGS_INVALID_QUESTIONMARK ;
+ sal_uInt32 nCvtInfo;
+ sal_Size nCvtChars;
+
+ rtl_UnicodeToTextContext aContext =
+ rtl_createUnicodeToTextContext( aConverter );
+
+ sal_Size nSize = rtl_convertUnicodeToText( aConverter, aContext,
+ pText, nTextLen, pBuffer, nBufferSize,
+ nCvtFlags, &nCvtInfo, &nCvtChars );
+
+ rtl_destroyUnicodeToTextContext( aConverter, aContext );
+
+ return nSize;
+}
+
+typedef struct {
+ const rtl_TextEncoding nEncoding;
+ const char* pEncoding;
+} DescriptionT;
+
+const DescriptionT pRTLEncoding[] = {
+ { RTL_TEXTENCODING_DONTKNOW, "DONTKNOW" },
+ { RTL_TEXTENCODING_MS_1252, "MS_1252" },
+ { RTL_TEXTENCODING_APPLE_ROMAN, "APPLE_ROMAN" },
+ { RTL_TEXTENCODING_IBM_437, "IBM_437" },
+ { RTL_TEXTENCODING_IBM_850, "IBM_850" },
+ { RTL_TEXTENCODING_IBM_860, "IBM_860" },
+ { RTL_TEXTENCODING_IBM_861, "IBM_861" },
+ { RTL_TEXTENCODING_IBM_863, "IBM_863" },
+ { RTL_TEXTENCODING_IBM_865, "IBM_865" },
+ { RTL_TEXTENCODING_SYMBOL, "SYMBOL" },
+ { RTL_TEXTENCODING_ASCII_US, "ASCII_US" },
+ { RTL_TEXTENCODING_ISO_8859_1, "ISO_8859_1" },
+ { RTL_TEXTENCODING_ISO_8859_2, "ISO_8859_2" },
+ { RTL_TEXTENCODING_ISO_8859_3, "ISO_8859_3" },
+ { RTL_TEXTENCODING_ISO_8859_4, "ISO_8859_4" },
+ { RTL_TEXTENCODING_ISO_8859_5, "ISO_8859_5" },
+ { RTL_TEXTENCODING_ISO_8859_6, "ISO_8859_6" },
+ { RTL_TEXTENCODING_ISO_8859_7, "ISO_8859_7" },
+ { RTL_TEXTENCODING_ISO_8859_8, "ISO_8859_8" },
+ { RTL_TEXTENCODING_ISO_8859_9, "ISO_8859_9" },
+ { RTL_TEXTENCODING_ISO_8859_14, "ISO_8859_14" },
+ { RTL_TEXTENCODING_ISO_8859_15, "ISO_8859_15" },
+ { RTL_TEXTENCODING_IBM_737, "IBM_737" },
+ { RTL_TEXTENCODING_IBM_775, "IBM_775" },
+ { RTL_TEXTENCODING_IBM_852, "IBM_852" },
+ { RTL_TEXTENCODING_IBM_855, "IBM_855" },
+ { RTL_TEXTENCODING_IBM_857, "IBM_857" },
+ { RTL_TEXTENCODING_IBM_862, "IBM_862" },
+ { RTL_TEXTENCODING_IBM_864, "IBM_864" },
+ { RTL_TEXTENCODING_IBM_866, "IBM_866" },
+ { RTL_TEXTENCODING_IBM_869, "IBM_869" },
+ { RTL_TEXTENCODING_MS_874, "MS_874" },
+ { RTL_TEXTENCODING_MS_1250, "MS_1250" },
+ { RTL_TEXTENCODING_MS_1251, "MS_1251" },
+ { RTL_TEXTENCODING_MS_1253, "MS_1253" },
+ { RTL_TEXTENCODING_MS_1254, "MS_1254" },
+ { RTL_TEXTENCODING_MS_1255, "MS_1255" },
+ { RTL_TEXTENCODING_MS_1256, "MS_1256" },
+ { RTL_TEXTENCODING_MS_1257, "MS_1257" },
+ { RTL_TEXTENCODING_MS_1258, "MS_1258" },
+ { RTL_TEXTENCODING_APPLE_ARABIC, "APPLE_ARABIC" },
+ { RTL_TEXTENCODING_APPLE_CENTEURO, "APPLE_CENTEURO" },
+ { RTL_TEXTENCODING_APPLE_CROATIAN, "APPLE_CROATIAN" },
+ { RTL_TEXTENCODING_APPLE_CYRILLIC, "APPLE_CYRILLIC" },
+ { RTL_TEXTENCODING_APPLE_DEVANAGARI,"APPLE_DEVANAGARI" },
+ { RTL_TEXTENCODING_APPLE_FARSI, "APPLE_FARSI" },
+ { RTL_TEXTENCODING_APPLE_GREEK, "APPLE_GREEK" },
+ { RTL_TEXTENCODING_APPLE_GUJARATI, "APPLE_GUJARATI" },
+ { RTL_TEXTENCODING_APPLE_GURMUKHI, "APPLE_GURMUKHI" },
+ { RTL_TEXTENCODING_APPLE_HEBREW, "APPLE_HEBREW" },
+ { RTL_TEXTENCODING_APPLE_ICELAND, "APPLE_ICELAND" },
+ { RTL_TEXTENCODING_APPLE_ROMANIAN, "APPLE_ROMANIAN" },
+ { RTL_TEXTENCODING_APPLE_THAI, "APPLE_THAI" },
+ { RTL_TEXTENCODING_APPLE_TURKISH, "APPLE_TURKISH" },
+ { RTL_TEXTENCODING_APPLE_UKRAINIAN, "APPLE_UKRAINIAN" },
+ { RTL_TEXTENCODING_APPLE_CHINSIMP, "APPLE_CHINSIMP" },
+ { RTL_TEXTENCODING_APPLE_CHINTRAD, "APPLE_CHINTRAD" },
+ { RTL_TEXTENCODING_APPLE_JAPANESE, "APPLE_JAPANESE" },
+ { RTL_TEXTENCODING_APPLE_KOREAN, "APPLE_KOREAN" },
+ { RTL_TEXTENCODING_MS_932, "MS_932" },
+ { RTL_TEXTENCODING_MS_936, "MS_936" },
+ { RTL_TEXTENCODING_MS_949, "MS_949" },
+ { RTL_TEXTENCODING_MS_950, "MS_950" },
+ { RTL_TEXTENCODING_SHIFT_JIS, "SHIFT_JIS" },
+ { RTL_TEXTENCODING_GB_2312, "GB_2312" },
+ { RTL_TEXTENCODING_GBT_12345, "GBT_12345" },
+ { RTL_TEXTENCODING_GBK, "GBK" },
+ { RTL_TEXTENCODING_BIG5, "BIG5" },
+ { RTL_TEXTENCODING_EUC_JP, "EUC_JP" },
+ { RTL_TEXTENCODING_EUC_CN, "EUC_CN" },
+ { RTL_TEXTENCODING_EUC_TW, "EUC_TW" },
+ { RTL_TEXTENCODING_ISO_2022_JP, "ISO_2022_JP" },
+ { RTL_TEXTENCODING_ISO_2022_CN, "ISO_2022_CN" },
+ { RTL_TEXTENCODING_KOI8_R, "KOI8_R" },
+ { RTL_TEXTENCODING_UTF7, "UTF7" },
+ { RTL_TEXTENCODING_UTF8, "UTF8" },
+ { RTL_TEXTENCODING_ISO_8859_10, "ISO_8859_10" },
+ { RTL_TEXTENCODING_ISO_8859_13, "ISO_8859_13" },
+ { RTL_TEXTENCODING_EUC_KR, "EUC_KR" },
+ { RTL_TEXTENCODING_ISO_2022_KR, "ISO_2022_KR" },
+ { RTL_TEXTENCODING_JIS_X_0208, "JISX_0208_1983" },
+ { RTL_TEXTENCODING_JIS_X_0201, "JISX_0201_1976" },
+ { RTL_TEXTENCODING_JIS_X_0212, "JISX_0212_1990" },
+ #ifdef __notdef__
+ { RTL_TEXTENCODING_KSC_5601_1992, "KSC_5601_1992" },
+ { RTL_TEXTENCODING_TIS_620_2533, "TIS_620_2533" },
+ { RTL_TEXTENCODING_SUNUDC_1997, "SUNUDC_1997" },
+ #endif
+ { RTL_TEXTENCODING_STD_COUNT, "STD_COUNT" },
+ { RTL_TEXTENCODING_USER_START, "USER_START" },
+ { RTL_TEXTENCODING_USER_END, "USER_END" },
+ { RTL_TEXTENCODING_UCS4, "UCS4" },
+ { RTL_TEXTENCODING_UCS2, "UCS2" },
+ { RTL_TEXTENCODING_UNICODE, "UNICODE" }
+};
+
+extern "C" const char*
+pGetEncodingName( rtl_TextEncoding nEncoding )
+{
+ for ( int i = 0; i < sizeof(pRTLEncoding)/sizeof(DescriptionT); i++ )
+ if ( nEncoding == pRTLEncoding[i].nEncoding )
+ return pRTLEncoding[i].pEncoding;
+
+ static const char p_nil[] = "not_in_list";
+ return p_nil;
+}
+
diff --git a/vcl/unx/source/gdi/salcvt.hxx b/vcl/unx/source/gdi/salcvt.hxx
new file mode 100644
index 000000000000..540f879af9d5
--- /dev/null
+++ b/vcl/unx/source/gdi/salcvt.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: salcvt.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef SAL_CONVERTER_CACHE_HXX_
+#define SAL_CONVERTER_CACHE_HXX_
+
+#ifndef _SALUNX_H
+#include <salunx.h>
+#endif
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+#ifndef _RTL_TEXTCVT_H
+#include <rtl/textcvt.h>
+#endif
+
+extern "C" const char*
+pGetEncodingName( rtl_TextEncoding nEncoding );
+
+//
+// Cache TextToUnicode and UnicodeToText converter and conversion info which is
+// used in DrawXYZ routines and in the Event loop
+//
+
+class SalConverterCache {
+
+ public:
+ SalConverterCache();
+ ~SalConverterCache();
+ Bool EncodingHasChar(
+ rtl_TextEncoding nEncoding, sal_Unicode nChar );
+ rtl_UnicodeToTextConverter
+ GetU2TConverter( rtl_TextEncoding nEncoding );
+ rtl_TextToUnicodeConverter
+ GetT2UConverter( rtl_TextEncoding nEncoding );
+ Bool IsSingleByteEncoding( rtl_TextEncoding nEncoding );
+
+ private:
+
+ typedef struct {
+ rtl_UnicodeToTextConverter mpU2T;
+ rtl_TextToUnicodeConverter mpT2U;
+ Bool mbSingleByteEncoding;
+ Bool mbValid;
+ } ConverterT;
+
+ ConverterT *mpConverter;
+};
+
+// wrapper for rtl_convertUnicodeToText that handles the usual cases for
+// textconversion in drawtext routines
+sal_Size
+ConvertStringUTF16( const sal_Unicode *pText, int nTextLen,
+ sal_Char *pBuffer, sal_Size nBufferSize,
+ rtl_UnicodeToTextConverter aConverter );
+
+
+#endif /* SAL_CONVERTER_CACHE_HXX_ */
+
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
new file mode 100644
index 000000000000..856502a294ba
--- /dev/null
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -0,0 +1,975 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALGDI_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <prex.h>
+#include <X11/Xproto.h>
+#include <postx.h>
+
+#include <salunx.h>
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+
+#include <tools/debug.hxx>
+
+#ifndef PRINTER_DUMMY
+#define Font XLIB_Font
+#define Region XLIB_Region
+#include <xprinter/xp.h>
+#undef Font
+#undef Region
+#endif
+
+// -=-= SalPolyLine =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define STATIC_POINTS 64
+
+class SalPolyLine
+{
+ XPoint Points_[STATIC_POINTS];
+ XPoint *pFirst_;
+public:
+ inline SalPolyLine( ULONG nPoints );
+ inline SalPolyLine( ULONG nPoints, const SalPoint *p );
+ inline ~SalPolyLine();
+ inline XPoint &operator [] ( ULONG n ) const
+ { return pFirst_[n]; }
+};
+
+inline SalPolyLine::SalPolyLine( ULONG nPoints )
+ : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ )
+{}
+
+inline SalPolyLine::SalPolyLine( ULONG nPoints, const SalPoint *p )
+ : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ )
+{
+ for( ULONG i = 0; i < nPoints; i++ )
+ {
+ pFirst_[i].x = (short)p[i].mnX;
+ pFirst_[i].y = (short)p[i].mnY;
+ }
+ pFirst_[nPoints] = pFirst_[0]; // close polyline
+}
+
+inline SalPolyLine::~SalPolyLine()
+{ if( pFirst_ != Points_ ) delete pFirst_; }
+
+#undef STATIC_POINTS
+// -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalGraphicsData::SalGraphicsData()
+{
+ hDrawable_ = None;
+
+ pClipRegion_ = NULL;
+ pPaintRegion_ = NULL;
+
+ pPenGC_ = NULL;
+ nPenPixel_ = 0;
+ nPenColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black
+
+ pFontGC_ = NULL;
+// xFont_ = NULL;
+ aScale_ = Fraction( 1, 1 );
+ nTextPixel_ = 0;
+ nTextColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black
+
+ pBrushGC_ = NULL;
+ nBrushPixel_ = 0;
+ nBrushColor_ = MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ); // White
+ hBrush_ = None;
+
+ pMonoGC_ = NULL;
+ pCopyGC_ = NULL;
+ pMaskGC_ = NULL;
+ pInvertGC_ = NULL;
+ pInvert50GC_ = NULL;
+ pStippleGC_ = NULL;
+ pTrackingGC_ = NULL;
+
+ bWindow_ = FALSE;
+ bPrinter_ = FALSE;
+ bVirDev_ = FALSE;
+ bPenGC_ = FALSE;
+ bFontGC_ = FALSE;
+ bBrushGC_ = FALSE;
+ bMonoGC_ = FALSE;
+ bCopyGC_ = FALSE;
+ bInvertGC_ = FALSE;
+ bInvert50GC_ = FALSE;
+ bStippleGC_ = FALSE;
+ bTrackingGC_ = FALSE;
+ bXORMode_ = FALSE;
+ bDitherBrush_ = FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalGraphicsData::~SalGraphicsData()
+{
+ Display *pDisplay = GetXDisplay();
+
+ DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" )
+ if( pClipRegion_ ) XDestroyRegion( pClipRegion_ );
+
+ if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ );
+ if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ );
+ if( pFontGC_ ) XFreeGC( pDisplay, pFontGC_ );
+ if( pBrushGC_ ) XFreeGC( pDisplay, pBrushGC_ );
+ if( pMonoGC_ ) XFreeGC( pDisplay, pMonoGC_ );
+ if( pCopyGC_ ) XFreeGC( pDisplay, pCopyGC_ );
+ if( pMaskGC_ ) XFreeGC( pDisplay, pMaskGC_ );
+ if( pInvertGC_ ) XFreeGC( pDisplay, pInvertGC_ );
+ if( pInvert50GC_ ) XFreeGC( pDisplay, pInvert50GC_ );
+ if( pStippleGC_ ) XFreeGC( pDisplay, pStippleGC_ );
+ if( pTrackingGC_ ) XFreeGC( pDisplay, pTrackingGC_ );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+beta void SalGraphicsData::DeInit()
+{
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalGraphicsData::SetClipRegion( GC pGC, XLIB_Region pXReg ) const
+{
+ Display *pDisplay = GetXDisplay();
+
+ int n = 0;
+ XLIB_Region Regions[3];
+
+ if( pClipRegion_ /* && !XEmptyRegion( pClipRegion_ ) */ )
+ Regions[n++] = pClipRegion_;
+// if( pPaintRegion_ /* && !XEmptyRegion( pPaintRegion_ ) */ )
+// Regions[n++] = pPaintRegion_;
+ if( pXReg && !XEmptyRegion( pXReg ) )
+ Regions[n++] = pXReg;
+
+ if( 0 == n )
+ XSetClipMask( pDisplay, pGC, None );
+ else if( 1 == n )
+ XSetRegion( pDisplay, pGC, Regions[0] );
+ else
+ {
+ XLIB_Region pTmpRegion = XCreateRegion();
+ XIntersectRegion( Regions[0], Regions[1], pTmpRegion );
+// if( 3 == n )
+// XIntersectRegion( Regions[2], pTmpRegion, pTmpRegion );
+ XSetRegion( pDisplay, pGC, pTmpRegion );
+ XDestroyRegion( pTmpRegion );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final GC SalGraphicsData::SelectPen()
+{
+ Display *pDisplay = GetXDisplay();
+
+ DBG_ASSERT( nPenColor_ != 0xFFFFFFFF, "Pen Transparent" );
+
+ if( !pPenGC_ )
+ {
+ XGCValues values;
+ values.subwindow_mode = IncludeInferiors;
+ values.fill_rule = EvenOddRule; // Pict import/ Gradient
+ values.graphics_exposures = True;
+
+ pPenGC_ = XCreateGC( pDisplay, hDrawable_,
+ GCSubwindowMode | GCFillRule | GCGraphicsExposures,
+ &values );
+ }
+
+ if( !bPenGC_ )
+ {
+ XSetForeground( pDisplay, pPenGC_, nPenPixel_ );
+ XSetFunction ( pDisplay, pPenGC_, bXORMode_ ? GXxor : GXcopy );
+ SetClipRegion( pPenGC_ );
+ bPenGC_ = TRUE;
+ }
+
+ return pPenGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final GC SalGraphicsData::SelectBrush()
+{
+ Display *pDisplay = GetXDisplay();
+
+ DBG_ASSERT( nBrushColor_ != 0xFFFFFFFF, "Brush Transparent" );
+
+ if( !pBrushGC_ )
+ {
+ XGCValues values;
+ values.subwindow_mode = IncludeInferiors;
+ values.fill_rule = EvenOddRule; // Pict import/ Gradient
+ values.graphics_exposures = True;
+
+ pBrushGC_ = XCreateGC( pDisplay, hDrawable_,
+ GCSubwindowMode | GCFillRule | GCGraphicsExposures,
+ &values );
+ }
+
+ if( !bBrushGC_ )
+ {
+ if( !bDitherBrush_ )
+ {
+ XSetFillStyle ( pDisplay, pBrushGC_, FillSolid );
+ XSetForeground( pDisplay, pBrushGC_, nBrushPixel_ );
+ if( bPrinter_ )
+ XSetTile( pDisplay, pBrushGC_, None );
+ }
+ else
+ {
+ // Bug in Sun Solaris 2.5.1, XFillPolygon doesn't allways reflect
+ // changes of the tile. PROPERTY_BUG_Tile doesn't fix this !
+ if (GetDisplay()->GetProperties() & PROPERTY_BUG_FillPolygon_Tile)
+ XSetFillStyle ( pDisplay, pBrushGC_, FillSolid );
+
+ XSetFillStyle ( pDisplay, pBrushGC_, FillTiled );
+ XSetTile ( pDisplay, pBrushGC_, hBrush_ );
+ }
+ XSetFunction ( pDisplay, pBrushGC_, bXORMode_ ? GXxor : GXcopy );
+ SetClipRegion( pBrushGC_ );
+ bBrushGC_ = TRUE;
+ }
+
+ return pBrushGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final GC SalGraphicsData::GetTrackingGC()
+{
+ const char dash_list[2] = {2, 2};
+
+ if( !pTrackingGC_ )
+ {
+ XGCValues values;
+
+ values.graphics_exposures = True;
+ values.foreground = xColormap_->GetBlackPixel()
+ ^ xColormap_->GetWhitePixel();
+ values.function = GXxor;
+ values.line_width = 1;
+ values.line_style = LineOnOffDash;
+
+ pTrackingGC_ = XCreateGC( GetXDisplay(), GetDrawable(),
+ GCGraphicsExposures | GCForeground | GCFunction
+ | GCLineWidth | GCLineStyle,
+ &values );
+ XSetDashes( GetXDisplay(), pTrackingGC_, 0, dash_list, 2 );
+ }
+
+ if( !bTrackingGC_ )
+ {
+ SetClipRegion( pTrackingGC_ );
+ bTrackingGC_ = TRUE;
+ }
+
+ return pTrackingGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphicsData::DrawLines( ULONG nPoints,
+ const SalPolyLine &rPoints,
+ GC pGC )
+{
+ // errechne wie viele Linien XWindow auf einmal zeichnen kann
+ ULONG nMaxLines = (GetDisplay()->GetMaxRequestSize() - sizeof(xPolyPointReq))
+ / sizeof(xPoint);
+ if( nMaxLines > nPoints ) nMaxLines = nPoints;
+
+ // gebe alle Linien aus, die XWindows zeichnen kann.
+ ULONG n;
+ for( n = 0; nPoints - n > nMaxLines; n += nMaxLines - 1 )
+ XDrawLines( GetXDisplay(),
+ GetDrawable(),
+ pGC,
+ &rPoints[n],
+ nMaxLines,
+ CoordModeOrigin );
+
+ if( n < nPoints )
+ XDrawLines( GetXDisplay(),
+ GetDrawable(),
+ pGC,
+ &rPoints[n],
+ nPoints - n,
+ CoordModeOrigin );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// Dithern: Calculate a dither-pixmap and make a brush of it
+#define P_DELTA 51
+#define DMAP( v, m ) ((v % P_DELTA) > m ? (v / P_DELTA) + 1 : (v / P_DELTA))
+
+final BOOL SalGraphicsData::GetDitherPixmap( SalColor nSalColor )
+{
+ static const short nOrdDither8Bit[ 8 ][ 8 ] =
+ {
+ 0, 38, 9, 48, 2, 40, 12, 50,
+ 25, 12, 35, 22, 28, 15, 37, 24,
+ 6, 44, 3, 41, 8, 47, 5, 44,
+ 32, 19, 28, 16, 34, 21, 31, 18,
+ 1, 40, 11, 49, 0, 39, 10, 48,
+ 27, 14, 36, 24, 26, 13, 36, 23,
+ 8, 46, 4, 43, 7, 45, 4, 42,
+ 33, 20, 30, 17, 32, 20, 29, 16
+ };
+
+ // test for correct depth (8bit)
+ if( GetColormap().GetVisual()->GetDepth() != 8 )
+ return FALSE;
+
+ char pBits[64];
+ char *pBitsPtr = pBits;
+
+ // Set the pallette-entries for the dithering tile
+ UINT8 nSalColorRed = SALCOLOR_RED ( nSalColor );
+ UINT8 nSalColorGreen = SALCOLOR_GREEN ( nSalColor );
+ UINT8 nSalColorBlue = SALCOLOR_BLUE ( nSalColor );
+
+ for( int nY = 0; nY < 8; nY++ )
+ {
+ for( int nX = 0; nX < 8; nX++ )
+ {
+ short nMagic = nOrdDither8Bit[nY][nX];
+ UINT8 nR = P_DELTA * DMAP( nSalColorRed, nMagic );
+ UINT8 nG = P_DELTA * DMAP( nSalColorGreen, nMagic );
+ UINT8 nB = P_DELTA * DMAP( nSalColorBlue, nMagic );
+
+ *pBitsPtr++ = GetColormap().GetPixel( MAKE_SALCOLOR( nR, nG, nB ) );
+ }
+ }
+
+ // create the tile as ximage and an according pixmap -> caching
+ XImage *pImage = XCreateImage( GetXDisplay(),
+ GetColormap().GetXVisual(),
+ 8,
+ ZPixmap,
+ 0, // offset
+ pBits, // data
+ 8, 8, // width & height
+ 8, // bitmap_pad
+ 0 ); // (default) bytes_per_line
+
+ if ( GetDisplay()->GetProperties() & PROPERTY_BUG_Tile )
+ {
+ if (hBrush_)
+ XFreePixmap (GetXDisplay(), hBrush_);
+ hBrush_ = XCreatePixmap( GetXDisplay(), GetDrawable(), 8, 8, 8 );
+ }
+ else
+ if( !hBrush_ )
+ hBrush_ = XCreatePixmap( GetXDisplay(), GetDrawable(), 8, 8, 8 );
+
+ // put the ximage to the pixmap
+ XPutImage( GetXDisplay(),
+ hBrush_,
+ GetDisplay()->GetCopyGC(),
+ pImage,
+ 0, 0, // Source
+ 0, 0, // Destination
+ 8, 8 ); // width & height
+
+ // destroy image-frame but not palette-data
+ pImage->data = NULL;
+ XDestroyImage( pImage );
+
+ return TRUE;
+}
+
+// -=-= SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalGraphics::SalGraphics()
+{ }
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalGraphics::~SalGraphics()
+{ }
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::GetResolution( long &rDPIX, long &rDPIY ) // const
+{
+ SalDisplay *pDisplay = _GetDisplay();
+
+ rDPIX = pDisplay->GetResolution().A();
+ rDPIY = pDisplay->GetResolution().B();
+ if ( rDPIY < 96 )
+ {
+ rDPIX = Divide( rDPIX * 96, rDPIY );
+ rDPIY = 96;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::GetScreenFontResolution( long &rDPIX, long &rDPIY ) // const
+{
+ GetResolution ( rDPIX, rDPIY );
+
+ if( rDPIY < 108 )
+ {
+ rDPIX = Divide( rDPIX * 108, rDPIY );
+ rDPIY = 108;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final USHORT SalGraphics::GetBitCount() // const
+{ return _GetVisual()->GetDepth(); }
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::ResetClipRegion()
+{
+ if( _GetClipRegion() )
+ {
+ _IsPenGC() = FALSE;
+ _IsFontGC() = FALSE;
+ _IsBrushGC() = FALSE;
+ _IsMonoGC() = FALSE;
+ _IsCopyGC() = FALSE;
+ _IsInvertGC() = FALSE;
+ _IsInvert50GC() = FALSE;
+ _IsStippleGC() = FALSE;
+ _IsTrackingGC() = FALSE;
+
+ XDestroyRegion( _GetClipRegion() );
+ _GetClipRegion() = NULL;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::BeginSetClipRegion( ULONG )
+{
+ if( _GetClipRegion() )
+ XDestroyRegion( _GetClipRegion() );
+ _GetClipRegion() = XCreateRegion();
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nDX, long nDY )
+{
+#ifdef DBG_UTIL
+ if( nDX <= 0 || nX + nDX > 32767 )
+ fprintf( stderr, "CombineClipRegion %ld %ld\n", nX, nDX );
+ if( nDY <= 0 || nX + nDY > 32767 )
+ fprintf( stderr, "CombineClipRegion %ld %ld\n", nY, nDY );
+#endif
+ if (!nDX || !nDY)
+ return TRUE;
+
+ XRectangle aRect;
+ aRect.x = (short)nX;
+ aRect.y = (short)nY;
+ aRect.width = (unsigned short)nDX;
+ aRect.height = (unsigned short)nDY;
+
+ XUnionRectWithRegion( &aRect, _GetClipRegion(), _GetClipRegion() );
+
+ return TRUE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::EndSetClipRegion()
+{
+ _IsPenGC() = FALSE;
+ _IsFontGC() = FALSE;
+ _IsBrushGC() = FALSE;
+ _IsMonoGC() = FALSE;
+ _IsCopyGC() = FALSE;
+ _IsInvertGC() = FALSE;
+ _IsInvert50GC() = FALSE;
+ _IsStippleGC() = FALSE;
+ _IsTrackingGC() = FALSE;
+
+// if( _GetPaintRegion() )
+// XIntersectRegion( _GetClipRegion(), _GetPaintRegion(), _GetClipRegion() );
+// else
+
+ if( XEmptyRegion( _GetClipRegion() ) )
+ {
+ XDestroyRegion( _GetClipRegion() );
+ _GetClipRegion() = NULL;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::SetLineColor()
+{
+ if( _GetPenColor() != 0xFFFFFFFF )
+ {
+ _GetPenColor() = 0xFFFFFFFF;
+ _IsPenGC() = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::SetLineColor( SalColor nSalColor )
+{
+ if( _GetPenColor() != nSalColor )
+ {
+ _GetPenColor() = nSalColor;
+ _GetPenPixel() = _GetPixel( nSalColor );
+ _IsPenGC() = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::SetFillColor()
+{
+ if( _GetBrushColor() != 0xFFFFFFFF )
+ {
+ _IsDitherBrush() = FALSE;
+ _GetBrushColor() = 0xFFFFFFFF;
+ _IsBrushGC() = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::SetFillColor( SalColor nSalColor )
+{
+ if( _GetBrushColor() != nSalColor )
+ {
+ _IsDitherBrush() = FALSE;
+ _GetBrushColor() = nSalColor;
+ _GetBrushPixel() = _GetPixel( nSalColor );
+ if( TrueColor != _GetColormap().GetVisual()->GetClass()
+ && _GetColor( _GetBrushPixel() ) != _GetBrushColor()
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x00 ) // black
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x80 ) // blue
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x00 ) // green
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x80 ) // cyan
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x00 ) // red
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x80 ) // magenta
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x00 ) // brown
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x80 ) // gray
+ && nSalColor != MAKE_SALCOLOR( 0xC0, 0xC0, 0xC0 ) // light gray
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0xFF ) // light blue
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0x00 ) // light green
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0xFF ) // light cyan
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0x00 ) // light red
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0xFF ) // light magenta
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0x00 ) // light brown
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) )
+ _IsDitherBrush() = maGraphicsData.GetDitherPixmap(nSalColor);
+ _IsBrushGC() = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::SetROPLineColor( SalROPColor nROPColor )
+{
+ switch( nROPColor )
+ {
+ case SAL_ROP_0 : // 0
+ _GetPenPixel() = (Pixel)0;
+ break;
+ case SAL_ROP_1 : // 1
+ _GetPenPixel() = (Pixel)(1 << _GetVisual()->GetDepth()) - 1;
+ break;
+ case SAL_ROP_INVERT : // 2
+ _GetPenPixel() = (Pixel)(1 << _GetVisual()->GetDepth()) - 1;
+ break;
+ }
+ _GetPenColor() = _GetColor( _GetPenPixel() );
+ _IsPenGC() = FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::SetROPFillColor( SalROPColor nROPColor )
+{
+ switch( nROPColor )
+ {
+ case SAL_ROP_0 : // 0
+ _GetBrushPixel() = (Pixel)0;
+ break;
+ case SAL_ROP_1 : // 1
+ _GetBrushPixel() = (Pixel)(1 << _GetVisual()->GetDepth()) - 1;
+ break;
+ case SAL_ROP_INVERT : // 2
+ _GetBrushPixel() = (Pixel)(1 << _GetVisual()->GetDepth()) - 1;
+ break;
+ }
+ _IsDitherBrush() = FALSE;
+ _GetBrushColor() = _GetColor( _GetBrushPixel() );
+ _IsBrushGC() = FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::SetXORMode( BOOL bSet )
+{
+ if( !_IsXORMode() == bSet )
+ {
+ _IsXORMode() = bSet;
+ _IsPenGC() = FALSE;
+ _IsBrushGC() = FALSE;
+ _IsMonoGC() = FALSE;
+ _IsCopyGC() = FALSE;
+ _IsInvertGC() = FALSE;
+ _IsInvert50GC() = FALSE;
+ _IsStippleGC() = FALSE;
+ _IsTrackingGC() = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::DrawPixel( long nX, long nY )
+{
+ if( _GetPenColor() != 0xFFFFFFFF )
+ XDrawPoint( _GetXDisplay(), _GetDrawable(), _SelectPen(), nX, nY );
+}
+
+final void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor )
+{
+ if( nSalColor != 0xFFFFFFFF )
+ {
+ Display *pDisplay = _GetXDisplay();
+
+ if( _GetPenColor() == 0xFFFFFFFF && !_IsPenGC() )
+ {
+ SetLineColor( nSalColor );
+ XDrawPoint( pDisplay, _GetDrawable(), _SelectPen(), nX, nY );
+ _GetPenColor() = 0xFFFFFFFF;
+ _IsPenGC() = False;
+ }
+ else
+ {
+ GC pGC = _SelectPen();
+
+ if( nSalColor != _GetPenColor() )
+ XSetForeground( pDisplay, pGC, _GetPixel( nSalColor ) );
+
+ XDrawPoint( pDisplay, _GetDrawable(), pGC, nX, nY );
+
+ if( nSalColor != _GetPenColor() )
+ XSetForeground( pDisplay, pGC, _GetPenPixel() );
+ }
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2 )
+{
+ if( _GetPenColor() != 0xFFFFFFFF )
+ {
+ if ( _GetDisplay()->GetProperties() & PROPERTY_BUG_DrawLine )
+ {
+ GC aGC = _SelectPen();
+ XDrawPoint (_GetXDisplay(), _GetDrawable(), aGC, (int)nX1, (int)nY1);
+ XDrawPoint (_GetXDisplay(), _GetDrawable(), aGC, (int)nX2, (int)nY2);
+ XDrawLine (_GetXDisplay(), _GetDrawable(), aGC, nX1, nY1, nX2, nY2 );
+ }
+ else
+ XDrawLine( _GetXDisplay(), _GetDrawable(),_SelectPen(),
+ nX1, nY1, nX2, nY2 );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalGraphics::DrawRect( long nX, long nY, long nDX, long nDY )
+{
+ if( _GetBrushColor() != 0xFFFFFFFF )
+ XFillRectangle( _GetXDisplay(),
+ _GetDrawable(),
+ _SelectBrush(),
+ nX, nY, nDX, nDY );
+
+ // Beschreibung DrawRect verkehrt, deshalb -1
+ if( _GetPenColor() != 0xFFFFFFFF )
+ XDrawRectangle( _GetXDisplay(),
+ _GetDrawable(),
+ _SelectPen(),
+ nX, nY, nDX-1, nDY-1 );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#if 0
+// Ausgetauscht durch SalGraphics::Invert
+final void SalGraphics::InvertTracking( ULONG nPoints, const SalPoint *pPtAry )
+{
+ SalPolyLine Points( nPoints, pPtAry );
+
+ maGraphicsData.DrawLines( nPoints, Points, _GetTrackingGC() );
+}
+#endif
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint *pPtAry )
+{
+ if( _GetPenColor() != 0xFFFFFFFF )
+ {
+ SalPolyLine Points( nPoints, pPtAry );
+
+ maGraphicsData.DrawLines( nPoints, Points, _SelectPen() );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry )
+{
+ if( nPoints < 3 )
+ {
+ if( !nPoints )
+ {
+#ifdef DBG_UTIL
+ fprintf( stderr, "SalGraphics::DrawPolygon !nPoints\n" );
+#endif
+ }
+ else if( !_IsXORMode() )
+ {
+ if( 1 == nPoints )
+ DrawPixel( pPtAry[0].mnX, pPtAry[0].mnY );
+ else
+ DrawLine( pPtAry[0].mnX, pPtAry[0].mnY,
+ pPtAry[1].mnX, pPtAry[1].mnY );
+ }
+ return;
+ }
+
+ SalPolyLine Points( nPoints, pPtAry );
+
+ nPoints++;
+
+ if( _GetBrushColor() != 0xFFFFFFFF )
+ XFillPolygon( _GetXDisplay(),
+ _GetDrawable(),
+ _SelectBrush(),
+ &Points[0], nPoints,
+ Complex, CoordModeOrigin );
+
+ if( _GetPenColor() != 0xFFFFFFFF )
+ maGraphicsData.DrawLines( nPoints, Points, _SelectPen() );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalGraphics::DrawPolyPolygon( ULONG nPoly,
+ const ULONG *pPoints,
+ PCONSTSALPOINT *pPtAry )
+{
+ if( _GetBrushColor() != 0xFFFFFFFF )
+ {
+ ULONG i, n;
+ XLIB_Region pXRegA = NULL;
+
+#ifdef CLIPPING
+ Size aOutSize = pOutDev->GetOutputSizePixel();
+
+ ClipRectangle aClippingRect( Point(0,0),
+ Point(aOutSize.Width(), aOutSize.Height()) );
+
+ ULONG nMax = pPoints[0];
+ for( i = 1; i < nPoly; i++ )
+ if( pPoints[i] > nMax )
+ nMax = pPoints[i];
+
+ SalPolyLine Points( nMax * 2 );
+
+ for( i = 0; i < nPoly; i++ )
+ {
+ n = aClippingRect.ClipPolygon( pPoints[i], pPtAry[i], &Points[0] );
+#else
+ for( i = 0; i < nPoly; i++ ) {
+ n = pPoints[i];
+ SalPolyLine Points( n, pPtAry[i] );
+#endif
+ if( n > 2 )
+ {
+ XLIB_Region pXRegB = XPolygonRegion( &Points[0], n+1, WindingRule );
+ if( !pXRegA )
+ pXRegA = pXRegB;
+ else
+ {
+ XXorRegion( pXRegA, pXRegB, pXRegA );
+ XDestroyRegion( pXRegB );
+ }
+ }
+ }
+
+ if( pXRegA )
+ {
+ XRectangle aXRect;
+ XClipBox( pXRegA, &aXRect );
+
+ GC pGC = _SelectBrush();
+ maGraphicsData.SetClipRegion( pGC, pXRegA ); // ??? doppelt
+ XDestroyRegion( pXRegA );
+ _IsBrushGC() = FALSE;
+
+ XFillRectangle( _GetXDisplay(),
+ _GetDrawable(),
+ pGC,
+ aXRect.x, aXRect.y, aXRect.width, aXRect.height );
+ }
+ }
+
+ if( _GetPenColor() != 0xFFFFFFFF )
+ for( ULONG i = 0; i < nPoly; i++ )
+ DrawPolyLine( pPoints[i], pPtAry[i] );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+beta void SalGraphics::Invert( ULONG nPoints,
+ const SalPoint* pPtAry,
+ SalInvert nFlags )
+{
+ SalDisplay *pDisp = _GetDisplay();
+ SalPolyLine Points ( nPoints, pPtAry );
+
+ GC pGC;
+ if( SAL_INVERT_50 & nFlags )
+ pGC = maGraphicsData.GetInvert50GC();
+ else
+ if ( SAL_INVERT_TRACKFRAME & nFlags )
+ pGC = maGraphicsData.GetTrackingGC();
+ else
+ pGC = maGraphicsData.GetInvertGC();
+
+ maGraphicsData.DrawLines ( nPoints, Points, pGC );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#if 0
+ struct XpEPS_trf
+ {
+ double origin_x, origin_y;
+ double scale_x, scale_y;
+ double rotate;
+ };
+ struct XpBox
+ {
+ double llx,lly;
+ double urx,ury;
+ };
+ extern "C" void* XpEPS_Put( Display*, FILE*, struct XpEPS_trf* );
+ extern "C" struct XpBox* XpEPS_GetBoundingBox( Display*, FILE* );
+#endif
+
+BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize )
+{
+#ifndef PRINTER_DUMMY
+ if( _IsPrinter() )
+ {
+ // convert \r to \n (#60367#, EPS-files with mac format)
+ // this should not tangle with other lineends
+ // in postscript files \r and \n count as whitespace
+ // so they can only be addressed directly as hex codes <0a> etc.
+ char* pRun = (char*)pPtr;
+ while( (ULONG)(pRun - (char*)pPtr) < nSize )
+ {
+ if( *pRun == '\r' )
+ *pRun = '\n';
+ pRun++;
+ }
+
+ FILE* fp = tmpfile();
+ if( ! fp )
+ return FALSE;
+ fwrite( pPtr, 1, nSize, fp );
+ fseek( fp, 0, SEEK_SET );
+
+ // holt die BoundingBox in pixel
+ XpBox* pBox = XpEPS_GetBoundingBox( _GetXDisplay(), fp );
+ fseek( fp, 0, SEEK_SET );
+ XpEPS_trf aTransfer;
+ aTransfer.origin_x = nX;
+ aTransfer.origin_y = nY;
+ aTransfer.rotate = 0;
+ if( pBox )
+ {
+ aTransfer.scale_x = ((double)nWidth)/( pBox->urx - pBox->llx );
+ aTransfer.scale_x = aTransfer.scale_x < 0 ?
+ -aTransfer.scale_x : aTransfer.scale_x;
+ aTransfer.scale_y = ((double)nHeight)/( pBox->lly - pBox->ury );
+ aTransfer.scale_y = aTransfer.scale_y < 0 ?
+ -aTransfer.scale_y : aTransfer.scale_y;
+ }
+ else
+ {
+ aTransfer.scale_x = 1;
+ aTransfer.scale_y = 1;
+#if defined DEBUG
+ fprintf( stderr, "Warning: XpEPS_GetBoundingBox returned NULL\n" );
+#endif
+ }
+
+ XpEPS_Put( _GetXDisplay(), fp, &aTransfer );
+ fclose( fp ); // deletes tmpfile
+ free( pBox );
+
+ return TRUE;
+ }
+#endif
+ return FALSE;
+}
+
diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx
new file mode 100644
index 000000000000..49d547533586
--- /dev/null
+++ b/vcl/unx/source/gdi/salgdi2.cxx
@@ -0,0 +1,810 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALGDI2_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <stdio.h>
+
+#include <salunx.h>
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef PRINTER_DUMMY
+#define Font XLIB_Font
+#define Region XLIB_Region
+#include <xprinter/xp.h>
+#undef Font
+#undef Region
+#endif
+
+#undef SALGDI2_TESTTRANS
+
+// -=-= debugging =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#ifdef DBG_UTIL
+
+static void sal_PrintImage( char *s, XImage*p )
+{
+ fprintf( stderr, "%s %d %d %d\n", s, p->depth, p->width, p->height );
+ int nW = Min( 64, p->width*p->bits_per_pixel >> 3 );
+ for( int i = 0; i < Min( 16, p->height ); i++ )
+ {
+ for( int j = 0; j < nW; j++ )
+ fprintf( stderr, "%02X", (UINT8)p->data[i*p->bytes_per_line+j] );
+ fprintf( stderr, "\n" );
+ }
+}
+
+#endif // DBG_UTIL
+
+// -----------------------------------------------------------------------------
+
+#if defined DEBUG && defined SALGDI2_TESTTRANS
+#define DBG_TESTTRANS( _def_drawable ) \
+{ \
+ XCopyArea( pXDisp, _def_drawable, aDrawable, _GetCopyGC(), \
+ 0, 0, \
+ pPosAry->mnDestWidth, pPosAry->mnDestHeight, \
+ 0, 0 ); \
+}
+#else // DEBUG && defined SALGDI2_TESTTRANS
+#define DBG_TESTTRANS( _def_drawable )
+#endif // DEBUG && defined SALGDI2_TESTTRANS
+
+// -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final GC SalGraphicsData::CreateGC( Drawable hDrawable, unsigned long nMask )
+{
+ XGCValues values;
+
+ values.graphics_exposures = True;
+ values.foreground = xColormap_->GetBlackPixel()
+ ^ xColormap_->GetWhitePixel();
+ values.function = GXxor;
+ values.line_width = 1;
+ values.fill_style = FillStippled;
+ values.stipple = GetDisplay()->GetInvert50();
+
+ return XCreateGC( GetXDisplay(), hDrawable, nMask, &values );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final inline GC SalGraphicsData::GetMonoGC( Pixmap hPixmap )
+{
+ if( !pMonoGC_ )
+ pMonoGC_ = CreateGC( hPixmap );
+
+ if( !bMonoGC_ )
+ {
+ SetClipRegion( pMonoGC_ );
+ bMonoGC_ = TRUE;
+ }
+
+ return pMonoGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final inline GC SalGraphicsData::GetCopyGC()
+{
+ if( bXORMode_ ) return GetInvertGC();
+
+ if( !pCopyGC_ )
+ pCopyGC_ = CreateGC( GetDrawable() );
+
+ if( !bCopyGC_ )
+ {
+ SetClipRegion( pCopyGC_ );
+ bCopyGC_ = TRUE;
+ }
+ return pCopyGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final GC SalGraphicsData::GetInvertGC()
+{
+ if( !pInvertGC_ )
+ pInvertGC_ = CreateGC( GetDrawable(),
+ GCGraphicsExposures
+ | GCForeground
+ | GCFunction
+ | GCLineWidth );
+
+ if( !bInvertGC_ )
+ {
+ SetClipRegion( pInvertGC_ );
+ bInvertGC_ = TRUE;
+ }
+ return pInvertGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final GC SalGraphicsData::GetInvert50GC()
+{
+ if( !pInvert50GC_ )
+ {
+ XGCValues values;
+
+ values.graphics_exposures = True;
+ values.foreground = xColormap_->GetWhitePixel();
+ values.background = xColormap_->GetBlackPixel();
+ values.function = GXinvert;
+ values.line_width = 1;
+ values.line_style = LineSolid;
+ unsigned long nValueMask =
+ GCGraphicsExposures
+ | GCForeground
+ | GCBackground
+ | GCFunction
+ | GCLineWidth
+ | GCLineStyle
+ | GCFillStyle
+ | GCStipple;
+
+ char* pEnv = getenv( "SAL_DO_NOT_USE_INVERT50" );
+ if( pEnv && ! strcasecmp( pEnv, "true" ) )
+ {
+ values.fill_style = FillSolid;
+ nValueMask &= ~ GCStipple;
+ }
+ else
+ {
+ values.fill_style = FillStippled;
+ values.stipple = GetDisplay()->GetInvert50();
+ }
+
+ pInvert50GC_ = XCreateGC( GetXDisplay(), GetDrawable(),
+ nValueMask,
+ &values );
+ }
+
+ if( !bInvert50GC_ )
+ {
+ SetClipRegion( pInvert50GC_ );
+ bInvert50GC_ = TRUE;
+ }
+ return pInvert50GC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final inline GC SalGraphicsData::GetStippleGC()
+{
+ if( !pStippleGC_ )
+ pStippleGC_ = CreateGC( GetDrawable(),
+ GCGraphicsExposures
+ | GCFillStyle
+ | GCLineWidth );
+
+ if( !bStippleGC_ )
+ {
+ XSetFunction( GetXDisplay(), pStippleGC_, bXORMode_ ? GXxor : GXcopy );
+ SetClipRegion( pStippleGC_ );
+ bStippleGC_ = TRUE;
+ }
+
+ return pStippleGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final int SalGraphicsData::Clip( XLIB_Region pRegion,
+ int &nX,
+ int &nY,
+ unsigned int &nDX,
+ unsigned int &nDY,
+ int &nSrcX,
+ int &nSrcY ) const
+{
+ XRectangle aRect;
+ XClipBox( pRegion, &aRect );
+
+ if( nX + nDX <= aRect.x || nX >= aRect.x + aRect.width )
+ return RectangleOut;
+ if( nY + nDY <= aRect.y || nY >= aRect.y + aRect.height )
+ return RectangleOut;
+
+ if( nX < aRect.x )
+ {
+ nSrcX += aRect.x - nX;
+ nDX -= aRect.x - nX;
+ nX = aRect.x;
+ }
+ else if( nX + nDX > aRect.x + aRect.width )
+ nDX = aRect.x + aRect.width - nX;
+
+ if( nY < aRect.y )
+ {
+ nSrcY += aRect.y - nY;
+ nDY -= aRect.y - nY;
+ nY = aRect.y;
+ }
+ else if( nY + nDY > aRect.y + aRect.height )
+ nDY = aRect.y + aRect.height - nY;
+
+ return RectangleIn;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final int SalGraphicsData::Clip( int &nX,
+ int &nY,
+ unsigned int &nDX,
+ unsigned int &nDY,
+ int &nSrcX,
+ int &nSrcY ) const
+
+{
+ if( pPaintRegion_
+ && RectangleOut == Clip( pPaintRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) )
+ return RectangleOut;
+
+ if( pClipRegion_
+ && RectangleOut == Clip( pClipRegion_, nX, nY, nDX, nDY, nSrcX, nSrcY ) )
+ return RectangleOut;
+
+ int nPaint;
+ if( pPaintRegion_ )
+ {
+ nPaint = XRectInRegion( pPaintRegion_, nX, nY, nDX, nDY );
+ if( RectangleOut == nPaint )
+ return RectangleOut;
+ }
+ else
+ nPaint = RectangleIn;
+
+ int nClip;
+ if( pClipRegion_ )
+ {
+ nClip = XRectInRegion( pClipRegion_, nX, nY, nDX, nDY );
+ if( RectangleOut == nClip )
+ return RectangleOut;
+ }
+ else
+ nClip = RectangleIn;
+
+ return RectangleIn == nClip && RectangleIn == nPaint
+ ? RectangleIn
+ : RectanglePart;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final GC SalGraphicsData::SetMask( int &nX,
+ int &nY,
+ unsigned int &nDX,
+ unsigned int &nDY,
+ int &nSrcX,
+ int &nSrcY,
+ Pixmap hClipMask )
+{
+ int n = Clip( nX, nY, nDX, nDY, nSrcX, nSrcY );
+ if( RectangleOut == n )
+ return NULL;
+
+ Display *pDisplay = GetXDisplay();
+
+ if( !pMaskGC_ )
+ pMaskGC_ = CreateGC( GetDrawable() );
+
+ if( RectangleIn == n )
+ {
+ XSetClipMask( pDisplay, pMaskGC_, hClipMask );
+ XSetClipOrigin( pDisplay, pMaskGC_, nX - nSrcX, nY - nSrcY );
+ return pMaskGC_;
+ }
+
+ // - - - - create alternate clip pixmap for region clipping - - - -
+ Pixmap hPixmap = XCreatePixmap( pDisplay, hClipMask, nDX, nDY, 1 );
+
+ if( !hPixmap )
+ {
+#if defined DEBUG || defined DBG_UTIL
+ fprintf( stderr, "SalGraphicsData::SetMask !hPixmap\n" );
+#endif
+ return NULL;
+ }
+
+ // - - - - reset pixmap; all 0 - - - - - - - - - - - - - - - - - - -
+ XFillRectangle( pDisplay,
+ hPixmap,
+ GetDisplay()->GetMonoGC(),
+ 0, 0,
+ nDX, nDY );
+
+ // - - - - copy pixmap only within region - - - - - - - - - - - - -
+ GC pMonoGC = GetMonoGC( hPixmap );
+ XSetClipOrigin( pDisplay, pMonoGC, -nX, -nY );
+ XCopyArea( pDisplay,
+ hClipMask, // Source
+ hPixmap, // Destination
+ pMonoGC,
+ nSrcX, nSrcY, // Source
+ nDX, nDY, // Width & Height
+ 0, 0 ); // Destination
+
+ XSetClipMask( pDisplay, pMaskGC_, hPixmap );
+ XSetClipOrigin( pDisplay, pMaskGC_, nX, nY );
+
+ XFreePixmap( pDisplay, hPixmap );
+ return pMaskGC_;
+}
+
+// -=-= SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::CopyBits( const SalTwoRect *pPosAry,
+ SalGraphics *pSrcGraphics )
+{
+ if( pPosAry->mnSrcWidth <= 0
+ || pPosAry->mnSrcHeight <= 0
+ || pPosAry->mnDestWidth <= 0
+ || pPosAry->mnDestHeight <= 0 )
+ {
+ return;
+ }
+
+ int n;
+ if( !pSrcGraphics )
+ {
+ pSrcGraphics = this;
+ n = 2;
+ }
+ else if( pSrcGraphics->_IsWindow() )
+ // window or compatible virtual device
+ if( pSrcGraphics->_GetDisplay() == _GetDisplay() )
+ n = 2; // same Display
+ else
+ n = 1; // printer or other display
+ else if( pSrcGraphics->_IsVirtualDevice() )
+ // printer compatible virtual device
+ if( _IsPrinter() )
+ n = 2; // printer or compatible virtual device == same display
+ else
+ n = 1; // window or compatible virtual device
+ else
+ n = 0;
+
+ if( n == 2
+ && pPosAry->mnSrcWidth == pPosAry->mnDestWidth
+ && pPosAry->mnSrcHeight == pPosAry->mnDestHeight )
+ {
+ if( _IsXORMode()
+ && !pSrcGraphics->_IsVirtualDevice()
+ && (_GetDisplay()->GetProperties() & PROPERTY_BUG_XCopyArea_GXxor) )
+ {
+ Pixmap hPixmap = XCreatePixmap( _GetXDisplay(),
+ pSrcGraphics->_GetDrawable(), // source
+ pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
+ pSrcGraphics->GetBitCount() );
+ XCopyArea( _GetXDisplay(),
+ pSrcGraphics->_GetDrawable(), // source
+ hPixmap, // destination
+ _GetDisplay()->GetCopyGC(), // no clipping
+ pPosAry->mnSrcX, pPosAry->mnSrcY,
+ pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
+ 0, 0 ); // destination
+ XCopyArea( _GetXDisplay(),
+ hPixmap, // source
+ _GetDrawable(), // destination
+ maGraphicsData.GetInvertGC(), // destination clipping
+ 0, 0, // source
+ pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
+ pPosAry->mnDestX, pPosAry->mnDestY );
+ XFreePixmap( _GetXDisplay(), hPixmap );
+ }
+ else
+ XCopyArea( _GetXDisplay(),
+ pSrcGraphics->_GetDrawable(), // source
+ _GetDrawable(), // destination
+ maGraphicsData.GetCopyGC(), // destination clipping
+ pPosAry->mnSrcX, pPosAry->mnSrcY,
+ pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
+ pPosAry->mnDestX, pPosAry->mnDestY );
+ }
+ else if( n )
+ {
+ SalBitmap *pDDB = pSrcGraphics->GetBitmap( pPosAry->mnSrcX,
+ pPosAry->mnSrcY,
+ pPosAry->mnSrcWidth,
+ pPosAry->mnSrcHeight );
+
+ if( !pDDB )
+ {
+ stderr0( "SalGraphics::CopyBits !pSrcGraphics->GetBitmap()\n" );
+ return;
+ }
+
+ SalTwoRect aPosAry( *pPosAry );
+
+ aPosAry.mnSrcX = 0, aPosAry.mnSrcY = 0;
+ DrawBitmap( &aPosAry, *pDDB );
+
+ delete pDDB;
+ }
+ else
+ stderr0( "SalGraphics::CopyBits from Printer not yet implemented\n" );
+}
+
+// --------------------------------------------------------------------------
+
+final void SalGraphics::CopyArea ( long nDestX, long nDestY,
+ long nSrcX, long nSrcY,
+ long nSrcWidth, long nSrcHeight,
+ USHORT nFlags )
+{
+ SalTwoRect aPosAry;
+
+ aPosAry.mnDestX = nDestX;
+ aPosAry.mnDestY = nDestY;
+ aPosAry.mnDestWidth = nSrcWidth;
+ aPosAry.mnDestHeight = nSrcHeight;
+
+ aPosAry.mnSrcX = nSrcX;
+ aPosAry.mnSrcY = nSrcY;
+ aPosAry.mnSrcWidth = nSrcWidth;
+ aPosAry.mnSrcHeight = nSrcHeight;
+
+ CopyBits ( &aPosAry, 0 );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap )
+{
+ SalDisplay* pSalDisp = maGraphicsData.GetDisplay();
+ Display* pXDisp = pSalDisp->GetDisplay();
+ const Drawable aDrawable( maGraphicsData.GetDrawable() );
+ const SalColormap& rColMap = pSalDisp->GetColormap();
+ const long nDepth = maGraphicsData.GetDisplay()->GetVisual()->GetDepth();
+ GC aGC( maGraphicsData.GetCopyGC() );
+ XGCValues aOldVal, aNewVal;
+ int nValues = GCForeground | GCBackground;
+
+ // set foreground/background values for 1Bit bitmaps
+ XGetGCValues( pXDisp, aGC, nValues, &aOldVal );
+ aNewVal.foreground = rColMap.GetWhitePixel(), aNewVal.background = rColMap.GetBlackPixel();
+ XChangeGC( pXDisp, aGC, nValues, &aNewVal );
+
+ if( _IsPrinter() )
+ {
+ SalTwoRect aTwoRect = { pPosAry->mnSrcX, pPosAry->mnSrcY, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
+ 0, 0, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight };
+ XImage* pImage = rSalBitmap.ImplCreateXImage( pSalDisp, nDepth, aTwoRect );
+
+ if( pImage )
+ {
+ XpStretchPutImage( maGraphicsData.GetDisplay()->GetDisplay(), aDrawable, aGC, pImage,
+ 0, 0, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight,
+ pPosAry->mnDestX, pPosAry->mnDestY, pPosAry->mnDestWidth, pPosAry->mnDestHeight );
+
+ delete[] pImage->data, pImage->data = NULL;
+ XDestroyImage( pImage );
+ }
+ }
+ else
+ rSalBitmap.ImplDraw( aDrawable, nDepth, *pPosAry, aGC );
+
+ XChangeGC( pXDisp, aGC, nValues, &aOldVal );
+ XFlush( pXDisp );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+final void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,
+ const SalBitmap& rTransBitmap )
+{
+ DBG_ASSERT( !_IsPrinter(), "Drawing of transparent bitmaps on printer devices is strictly forbidden" );
+
+ SalDisplay* pSalDisp = maGraphicsData.GetDisplay();
+ Display* pXDisp = pSalDisp->GetDisplay();
+ Drawable aDrawable( maGraphicsData.GetDrawable() );
+ const USHORT nDepth = pSalDisp->GetVisual()->GetDepth();
+ Pixmap aFG( XCreatePixmap( pXDisp, aDrawable, pPosAry->mnDestWidth,
+ pPosAry->mnDestHeight, nDepth ) );
+ Pixmap aBG( XCreatePixmap( pXDisp, aDrawable, pPosAry->mnDestWidth,
+ pPosAry->mnDestHeight, nDepth ) );
+
+ if( aFG && aBG )
+ {
+ GC aTmpGC;
+ XGCValues aValues;
+ const SalColormap& rColMap = pSalDisp->GetColormap();
+ const int nBlack = rColMap.GetBlackPixel(), nWhite = rColMap.GetWhitePixel();
+ const int nValues = GCFunction | GCForeground | GCBackground;
+ SalTwoRect aTmpRect( *pPosAry ); aTmpRect.mnDestX = aTmpRect.mnDestY = 0;
+
+ // draw paint bitmap in pixmap #1
+ aValues.function = GXcopy, aValues.foreground = nWhite, aValues.background = nBlack;
+ aTmpGC = XCreateGC( pXDisp, aFG, nValues, &aValues );
+ rSalBitmap.ImplDraw( aFG, nDepth, aTmpRect, aTmpGC );
+ DBG_TESTTRANS( aFG );
+
+ // draw background in pixmap #2
+ XCopyArea( pXDisp, aDrawable, aBG, aTmpGC,
+ pPosAry->mnDestX, pPosAry->mnDestY,
+ pPosAry->mnDestWidth, pPosAry->mnDestHeight,
+ 0, 0 );
+ DBG_TESTTRANS( aBG );
+
+ // mask out paint bitmap in pixmap #1 (transparent areas 0)
+ aValues.function = GXand, aValues.foreground = 0x00000000, aValues.background = 0xffffffff;
+ XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
+ rTransBitmap.ImplDraw( aFG, 1, aTmpRect, aTmpGC );
+ DBG_TESTTRANS( aFG );
+
+ // mask out background in pixmap #2 (nontransparent areas 0)
+ aValues.function = GXand, aValues.foreground = 0xffffffff, aValues.background = 0x00000000;
+ XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
+ rTransBitmap.ImplDraw( aBG, 1, aTmpRect, aTmpGC );
+ DBG_TESTTRANS( aBG );
+
+ // merge pixmap #1 and pixmap #2 in pixmap #2
+ aValues.function = GXxor, aValues.foreground = 0xffffffff, aValues.background = 0x00000000;
+ XChangeGC( pXDisp, aTmpGC, nValues, &aValues );
+ XCopyArea( pXDisp, aFG, aBG, aTmpGC,
+ 0, 0,
+ pPosAry->mnDestWidth, pPosAry->mnDestHeight,
+ 0, 0 );
+ DBG_TESTTRANS( aBG );
+
+ // copy pixmap #2 (result) to background
+ XCopyArea( pXDisp, aBG, aDrawable, maGraphicsData.GetCopyGC(),
+ 0, 0,
+ pPosAry->mnDestWidth, pPosAry->mnDestHeight,
+ pPosAry->mnDestX, pPosAry->mnDestY );
+ DBG_TESTTRANS( aBG );
+
+ XFreeGC( pXDisp, aTmpGC );
+ XFlush( pXDisp );
+ }
+ else
+ DrawBitmap( pPosAry, rSalBitmap );
+
+ if( aFG )
+ XFreePixmap( pXDisp, aFG );
+
+ if( aBG )
+ XFreePixmap( pXDisp, aBG );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,
+ SalColor nTransparentColor )
+{
+ DBG_ERROR( "::DrawBitmap with transparent color not supported" );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::DrawMask( const SalTwoRect* pPosAry, const SalBitmap &rSalBitmap,
+ SalColor nMaskColor )
+{
+ SalDisplay* pSalDisp = maGraphicsData.GetDisplay();
+ Display* pXDisp = pSalDisp->GetDisplay();
+ Drawable aDrawable( maGraphicsData.GetDrawable() );
+ Pixmap aStipple( XCreatePixmap( pXDisp, aDrawable,
+ pPosAry->mnDestWidth,
+ pPosAry->mnDestHeight, 1 ) );
+
+ if( aStipple )
+ {
+ SalTwoRect aTwoRect( *pPosAry ); aTwoRect.mnDestX = aTwoRect.mnDestY = 0;
+ GC aTmpGC;
+ XGCValues aValues;
+
+ // create a stipple bitmap first (set bits are changed to unset bits and vice versa)
+ aValues.function = GXcopyInverted;
+ aValues.foreground = 1, aValues.background = 0;
+ aTmpGC = XCreateGC( pXDisp, aStipple, GCFunction | GCForeground | GCBackground, &aValues );
+ rSalBitmap.ImplDraw( aStipple, 1, aTwoRect, aTmpGC );
+ XFreeGC( pXDisp, aTmpGC );
+
+ // Set stipple and draw rectangle
+ GC aStippleGC( maGraphicsData.GetStippleGC() );
+ int nX = pPosAry->mnDestX, nY = pPosAry->mnDestY;
+
+ XSetStipple( pXDisp, aStippleGC, aStipple );
+ XSetTSOrigin( pXDisp, aStippleGC, nX, nY );
+ XSetForeground( pXDisp, aStippleGC, _GetPixel( nMaskColor ) );
+ XFillRectangle( pXDisp, aDrawable, aStippleGC,
+ nX, nY,
+ pPosAry->mnDestWidth, pPosAry->mnDestHeight );
+ XFreePixmap( pXDisp, aStipple );
+ XFlush( pXDisp );
+ }
+ else
+ DrawBitmap( pPosAry, rSalBitmap );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalBitmap *SalGraphics::GetBitmap( long nX, long nY, long nDX, long nDY )
+{
+ if( _IsPrinter() && !_IsVirtualDevice() )
+ return NULL;
+
+ if( _IsWindow() && !_IsVirtualDevice() )
+ {
+ // normalize
+ if( nDX < 0 )
+ {
+ nX += nDX;
+ nDX = -nDX;
+ }
+ if ( nDY < 0 )
+ {
+ nY += nDY;
+ nDY = -nDY;
+ }
+
+ XWindowAttributes aAttrib;
+
+ XGetWindowAttributes( _GetXDisplay(), _GetDrawable(), &aAttrib );
+ if( aAttrib.map_state != IsViewable )
+ {
+ stderr0( "SalGraphics::GetBitmap drawable not viewable\n" );
+ return NULL;
+ }
+
+ // am Window clippen (eg)
+ if ( nX < 0 )
+ {
+ nDX += nX;
+ nX = 0;
+ }
+ if ( nY < 0 )
+ {
+ nDY += nY;
+ nY = 0;
+ }
+ if( nX + nDX > aAttrib.width )
+ nDX = aAttrib.width - nX;
+ if( nY + nDY > aAttrib.height )
+ nDY = aAttrib.height - nY;
+
+ // nun alles ok ?
+ if( nDX <= 0 || nDY <= 0 )
+ {
+ stderr0( "SalGraphics::GetBitmap zero sized bitmap after clipping\n" );
+ return NULL;
+ }
+ }
+
+ SalBitmap* pSalBitmap = new SalBitmap;
+ USHORT nBitCount = GetBitCount();
+
+ if( &_GetDisplay()->GetColormap() != &_GetColormap() )
+ nBitCount = 1;
+
+ pSalBitmap->ImplCreateFromDrawable( _GetDrawable(), nBitCount, nX, nY, nDX, nDY );
+
+ return pSalBitmap;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalColor SalGraphics::GetPixel( long nX, long nY )
+{
+ if( _IsWindow() && !_IsVirtualDevice() )
+ {
+ XWindowAttributes aAttrib;
+
+ XGetWindowAttributes( _GetXDisplay(), _GetDrawable(), &aAttrib );
+ if( aAttrib.map_state != IsViewable )
+ {
+ stderr0( "SalGraphics::GetPixel drawable not viewable\n" );
+ return 0;
+ }
+ }
+
+ XImage *pXImage = XGetImage( _GetXDisplay(),
+ _GetDrawable(),
+ nX, nY,
+ 1, 1,
+ AllPlanes,
+ ZPixmap );
+ if( !pXImage )
+ {
+ stderr0( "SalGraphics::GetPixel !XGetImage()\n" );
+ return 0;
+ }
+
+ XColor aXColor;
+
+ aXColor.pixel = XGetPixel( pXImage, 0, 0 );
+ XDestroyImage( pXImage );
+
+ return _GetColormap().GetColor( aXColor.pixel );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphics::Invert( long nX,
+ long nY,
+ long nDX,
+ long nDY,
+ SalInvert nFlags )
+{
+ SalDisplay *pDisp = _GetDisplay();
+
+ GC pGC;
+ if( SAL_INVERT_50 & nFlags )
+ {
+ pGC = maGraphicsData.GetInvert50GC();
+ XFillRectangle( _GetXDisplay(), _GetDrawable(), pGC, nX, nY, nDX, nDY );
+ }
+ else
+ if ( SAL_INVERT_TRACKFRAME & nFlags )
+ {
+ pGC = maGraphicsData.GetTrackingGC();
+ XDrawRectangle( _GetXDisplay(), _GetDrawable(), pGC, nX, nY, nDX, nDY );
+ }
+ else
+ {
+ pGC = maGraphicsData.GetInvertGC();
+ XFillRectangle( _GetXDisplay(), _GetDrawable(), pGC, nX, nY, nDX, nDY );
+ }
+}
+
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
new file mode 100644
index 000000000000..5b738f2a5de8
--- /dev/null
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -0,0 +1,1074 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALGDI3_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <assert.h>
+#include <alloca.h>
+
+#include <salunx.h>
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _SV_POLY_HXX
+#include <poly.hxx>
+#endif
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+
+#ifndef PRINTER_DUMMY
+#define Font XLIB_Font
+#define Region XLIB_Region
+#include <xprinter/xp.h>
+#undef Font
+#undef Region
+#endif
+
+#ifndef ANSI1252_HXX_
+#include "ansi1252.hxx"
+#endif
+#ifndef XLFD_ATTRIBUTE_HXX
+#include "xlfd_attr.hxx"
+#endif
+#ifndef XLFD_SIMPLE_HXX
+#include "xlfd_smpl.hxx"
+#endif
+#ifndef XLFD_EXTENDED_HXX
+#include "xlfd_extd.hxx"
+#endif
+#ifndef SAL_CONVERTER_CACHE_HXX_
+#include "salcvt.hxx"
+#endif
+#include <osl/types.h>
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#ifndef PRINTER_DUMMY
+static void
+FaxPhoneComment( Display* pDisplay, const sal_Unicode* pStr, USHORT nLen )
+{
+ #define FAX_PHONE_TOKEN "@@#"
+ #define FAX_PHONE_TOKEN_LENGTH 3
+ #define FAX_END_TOKEN "@@"
+
+ USHORT nPos;
+ ByteString aPhone( pStr, nLen, gsl_getSystemTextEncoding() );
+
+ static ByteString aPhoneNumber;
+ static BOOL bIsCollecting = FALSE;
+
+ if( ! bIsCollecting )
+ {
+ if( ( nPos = aPhone.Search( FAX_PHONE_TOKEN ) ) != STRING_NOTFOUND )
+ {
+ aPhone.Erase( 0, nPos + FAX_PHONE_TOKEN_LENGTH );
+ bIsCollecting = TRUE;
+ aPhoneNumber.Erase();
+ }
+ }
+ if( bIsCollecting )
+ {
+ if( ( nPos = aPhone.Search( FAX_END_TOKEN ) ) != STRING_NOTFOUND )
+ {
+ aPhone.Erase( nPos );
+ bIsCollecting = FALSE;
+ }
+ aPhoneNumber += aPhone;
+ if( ! bIsCollecting )
+ {
+ aPhone = "PhoneNumber(";
+ aPhone += aPhoneNumber;
+ aPhone += ")\n";
+ XpPSComment( pDisplay, aPhone.GetBuffer() );
+ aPhoneNumber = ByteString();
+ }
+ }
+ if( aPhoneNumber.Len() > 1024 )
+ {
+ bIsCollecting = FALSE;
+ aPhoneNumber = ByteString();
+ }
+}
+#endif
+
+// ----------------------------------------------------------------------------
+//
+// SalDisplay
+//
+// ----------------------------------------------------------------------------
+
+XlfdStorage*
+SalDisplay::GetXlfdList()
+{
+ if ( mpFontList != NULL )
+ {
+ return mpFontList;
+ }
+ else
+ {
+ // on a display an xlfd of *-0-0-75-75-* means this is a scalable
+ // bitmap font, thus it is ugly and thus to avoid. On a printer
+ // *-0-0-300-300-* means this is a printer resident font thus nice
+ // thus to prefer :-(
+ eDeviceT eDevice = this->IsDisplay() ? eDeviceDisplay : eDevicePrinter;
+
+ mpFactory = new AttributeProvider( eDevice );
+ mpFontList = new XlfdStorage();
+
+ int i, nFontCount;
+ const int nMaxCount = 64 * 1024 - 1;
+ Display *pDisplay = GetDisplay();
+ char **ppFontList = XListFonts(pDisplay, "-*", nMaxCount, &nFontCount);
+
+ //
+ // create a list of simple Xlfd font information
+ //
+
+ Xlfd *pXlfdList = (Xlfd*)malloc( nFontCount * sizeof(Xlfd) );
+ int nXlfdCount = 0;
+
+ for ( i = 0; i < nFontCount; i++ )
+ {
+ if ( pXlfdList[ nXlfdCount ].FromString(ppFontList[i], mpFactory) )
+ ++nXlfdCount;
+ }
+
+ XFreeFontNames( ppFontList );
+
+ // classification information is needed for sorting, classification
+ // of charset (i.e. iso8859-1 <-> ansi-1252) depends on wether the
+ // display points to a printer or to a real display. On a printer all
+ // iso8859-1 fonts are really capable of ansi-1252
+ mpFactory->AddClassification();
+ // add some pretty print description
+ mpFactory->AddAnnotation();
+ // misc feature checking
+ mpFactory->TagFeature();
+
+ // sort according to font style
+ qsort( pXlfdList, nXlfdCount, sizeof(Xlfd), XlfdCompare );
+
+ //
+ // create a font list with merged encoding information
+ //
+
+ BitmapXlfdStorage aBitmapList;
+ ScalableXlfd *pScalableFont = NULL;
+ PrinterFontXlfd *pPrinterFont = NULL;
+
+ int nFrom = 0;
+ for ( i = 0; i < nXlfdCount; i++ )
+ {
+ // exclude openlook glyph and cursor
+ Attribute *pAttr = mpFactory->RetrieveFamily(pXlfdList[i].mnFamily);
+ if ( pAttr->HasFeature( XLFD_FEATURE_OL_GLYPH
+ | XLFD_FEATURE_OL_CURSOR) )
+ {
+ continue;
+ }
+ // exclude fonts with unknown encoding
+ if ( pXlfdList[i].GetEncoding() == RTL_TEXTENCODING_DONTKNOW )
+ {
+ continue;
+ }
+
+ Bool bSameOutline = pXlfdList[i].SameFontoutline(pXlfdList + nFrom);
+ XlfdFonttype eType = pXlfdList[i].Fonttype();
+
+ // flush the old merged font list if the name doesn't match any more
+ if ( !bSameOutline )
+ {
+ mpFontList->Add( pScalableFont ); pScalableFont = NULL;
+ mpFontList->Add( pPrinterFont ); pPrinterFont = NULL;
+ mpFontList->Add( &aBitmapList ); aBitmapList.Reset();
+ }
+
+ // merge the font or generate a new one
+ switch( eType )
+ {
+ case eTypeScalable:
+
+ if ( pScalableFont == NULL )
+ pScalableFont = new ScalableXlfd;
+ pScalableFont->AddEncoding(pXlfdList + i);
+
+ break;
+
+ case eTypeBitmap:
+
+ aBitmapList.AddBitmapFont( pXlfdList + i );
+
+ break;
+
+ case eTypePrinterBuiltIn:
+ case eTypePrinterDownload:
+
+ if ( pPrinterFont == NULL )
+ pPrinterFont = new PrinterFontXlfd;
+ pPrinterFont->AddEncoding( pXlfdList + i );
+
+ break;
+
+ case eTypeScalableBitmap:
+ default:
+
+ break;
+ }
+
+ nFrom = i;
+ }
+
+ // flush the merged list into the global list
+ mpFontList->Add( pScalableFont );
+ mpFontList->Add( pPrinterFont );
+ mpFontList->Add( &aBitmapList );
+
+ // cleanup the list of simple font information
+ if ( pXlfdList != NULL )
+ free( pXlfdList );
+
+ return mpFontList;
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+ExtendedFontStruct*
+SalDisplay::GetFont( ExtendedXlfd *pRequestedFont, int nPixelSize )
+{
+ if( !pFontCache_ )
+ {
+ mpCvtCache = new SalConverterCache;
+ pFontCache_ = new SalFontCache( 64, 64, 16 ); // ???
+ }
+ else
+ {
+ ExtendedFontStruct *pItem;
+ for ( pItem = pFontCache_->First();
+ pItem != NULL;
+ pItem = pFontCache_->Next() )
+ {
+ if ( pItem->Match(pRequestedFont, nPixelSize) )
+ {
+ if( pFontCache_->GetCurPos() )
+ {
+ pFontCache_->Remove( pItem );
+ pFontCache_->Insert( pItem, 0UL );
+ }
+ return pItem;
+ }
+ }
+ }
+
+ // before we expand the cache, we look for very old and unused items
+ if( pFontCache_->Count() >= 64 )
+ {
+ ExtendedFontStruct *pItem;
+ for ( pItem = pFontCache_->Last();
+ pItem != NULL;
+ pItem = pFontCache_->Prev() )
+ {
+ if( 1 == pItem->GetRefCount() )
+ {
+ pFontCache_->Remove( pItem );
+ pItem->ReleaseRef();
+
+ if( pFontCache_->Count() < 64 )
+ break;
+ }
+ }
+ }
+
+ ExtendedFontStruct *pItem = new ExtendedFontStruct( GetDisplay(),
+ nPixelSize, pRequestedFont, mpCvtCache );
+ pFontCache_->Insert( pItem, 0UL );
+ pItem->AddRef();
+
+ return pItem;
+}
+
+// ---------------------------------------------------------------------------
+
+void
+SalDisplay::DestroyFontCache()
+{
+ if( pFontCache_ )
+ {
+ ExtendedFontStruct *pItem = pFontCache_->First();
+ while( pItem )
+ {
+ delete pItem;
+ pItem = pFontCache_->Next();
+ }
+ delete pFontCache_;
+ }
+ if( mpFontList )
+ {
+ mpFontList->Dispose();
+ delete mpFontList;
+ }
+ if ( mpFactory )
+ {
+ delete mpFactory;
+ }
+ if ( mpCvtCache )
+ {
+ delete mpCvtCache;
+ }
+
+ pFontCache_ = (SalFontCache*)NULL;
+ mpFontList = (XlfdStorage*)NULL;
+ mpFactory = (AttributeProvider*)NULL;
+ mpCvtCache = (SalConverterCache*)NULL;
+}
+
+// ----------------------------------------------------------------------------
+//
+// SalGraphicsData
+//
+// ----------------------------------------------------------------------------
+
+GC
+SalGraphicsData::SelectFont()
+{
+ Display *pDisplay = GetXDisplay();
+
+ if( !pFontGC_ )
+ {
+ XGCValues values;
+ values.subwindow_mode = IncludeInferiors;
+ values.fill_rule = EvenOddRule; // Pict import/ Gradient
+ values.graphics_exposures = True;
+ values.foreground = nTextPixel_;
+
+ pFontGC_ = XCreateGC( pDisplay, hDrawable_,
+ GCSubwindowMode | GCFillRule
+ | GCGraphicsExposures | GCForeground,
+ &values );
+ }
+
+ if( !bFontGC_ )
+ {
+ XSetForeground( pDisplay, pFontGC_, nTextPixel_ );
+ SetClipRegion( pFontGC_ );
+ bFontGC_ = TRUE;
+ }
+
+ return pFontGC_;
+}
+
+//--------------------------------------------------------------------------
+
+// Select the max size of a font, which is token for real
+// This routine is (and should be) called only once, the result should be
+// stored in some static variable
+
+static int
+GetMaxFontHeight()
+{
+ #define DEFAULT_MAXFONTHEIGHT 250
+
+ int nMaxFontHeight = 0;
+
+ char *FontHeight = getenv ("SAL_MAXFONTHEIGHT");
+ if (FontHeight)
+ nMaxFontHeight = atoi (FontHeight);
+
+ if (nMaxFontHeight <= 0)
+ nMaxFontHeight = DEFAULT_MAXFONTHEIGHT;
+
+ return nMaxFontHeight;
+}
+
+void
+SalGraphicsData::SetFont( const ImplFontSelectData *pEntry )
+{
+ bFontGC_ = FALSE;
+ xFont_ = NULL; // ->ReleaseRef()
+ aScale_ = Fraction( 1, 1 );
+ nFontOrientation_ = pEntry->mnOrientation;
+
+ if( pEntry->mpFontData && pEntry->mpFontData->mpSysData )
+ {
+ ExtendedXlfd *pSysFont = (ExtendedXlfd*)pEntry->mpFontData->mpSysData;
+ static int nMaxFontHeight = GetMaxFontHeight();
+
+ USHORT nH, nW;
+ if( bWindow_ )
+ {
+ // see BugId #44528# FontWork (-> #45038#) and as well Bug #47127#
+ if( pEntry->mnHeight > nMaxFontHeight )
+ nH = nMaxFontHeight;
+ else if( pEntry->mnHeight > 2 )
+ nH = pEntry->mnHeight;
+ else
+ nH = 2;
+ nW = 0; // pEntry->mnWidth;
+ }
+ else
+ {
+ nH = pEntry->mnHeight;
+ nW = pEntry->mnWidth;
+ }
+
+ xFont_ = GetDisplay()->GetFont( pSysFont, nH );
+ if( pEntry->mnHeight > nMaxFontHeight || pEntry->mnHeight < 2 )
+ aScale_ = Fraction( pEntry->mnHeight, nH );
+ }
+ else
+ {
+ #ifdef DEBUG
+ // XXX Fix me: provide a fallback for poor font installations
+ // we may be reach this if no font matches the GUI font
+ // MS Sans Serif;Geneva;Helv;WarpSans;Dialog;Lucida; ... */
+ fprintf( stderr, "SalGraphicsData::SetFont: Invalid Font Selection\n" );
+ #endif
+ }
+}
+
+//--------------------------------------------------------------------------
+
+static sal_Unicode
+SwapBytes( const sal_Unicode nIn )
+{
+ return ((nIn >> 8) & 0x00ff) | ((nIn << 8) & 0xff00);
+}
+
+
+// draw string in a specific multibyte encoding
+static void
+ConvertTextItem16( XTextItem16* pTextItem,
+ SalConverterCache* pCvt, rtl_TextEncoding nEncoding )
+{
+ if ( pTextItem && pTextItem->nchars > 0 )
+ {
+ // convert the string into the font encoding
+ sal_Size nSize;
+ sal_Size nBufferSize = pTextItem->nchars * 2;
+ sal_Char *pBuffer = (sal_Char*)alloca( nBufferSize );
+
+ nSize = ConvertStringUTF16( (sal_Unicode*)pTextItem->chars, pTextItem->nchars,
+ pBuffer, nBufferSize, pCvt->GetU2TConverter(nEncoding));
+
+ sal_Char *pTextChars = (sal_Char*)pTextItem->chars;
+ int n = 0, m = 0;
+
+ if ( nEncoding == RTL_TEXTENCODING_GB_2312
+ || nEncoding == RTL_TEXTENCODING_GBT_12345
+ || nEncoding == RTL_TEXTENCODING_GBK
+ || nEncoding == RTL_TEXTENCODING_BIG5 )
+ {
+ // GB and Big5 needs special treatment since chars can be single or
+ // double byte: encoding is
+ // [ 0x00 - 0x7f ] | [ 0x81 - 0xfe ] [ 0x40 - 0x7e 0x80 - 0xfe ]
+ while ( n < nSize )
+ {
+ if ( (unsigned char)pBuffer[ n ] < 0x80 )
+ {
+ pTextChars[ m++ ] = 0x0;
+ pTextChars[ m++ ] = pBuffer[ n++ ];
+ }
+ else
+ {
+ pTextChars[ m++ ] = pBuffer[ n++ ];
+ pTextChars[ m++ ] = pBuffer[ n++ ];
+ }
+ }
+ pTextItem->nchars = m / 2;
+ }
+ else
+ if ( pCvt->IsSingleByteEncoding(nEncoding) )
+ {
+ // Single Byte encoding has to be padded
+ while ( n < nSize )
+ {
+ pTextChars[ m++ ] = 0x0;
+ pTextChars[ m++ ] = pBuffer[ n++ ];
+ }
+ pTextItem->nchars = nSize;
+ }
+ else
+ {
+ while ( n < nSize )
+ {
+ pTextChars[ m++ ] = pBuffer[ n++ ];
+ }
+ pTextItem->nchars = nSize / 2;
+ }
+ }
+}
+
+// XXX this is a hack since XPrinter is not multibyte capable
+// XXX for printing this routine is called for each character
+void
+XPrinterDrawText16( Display* pDisplay, Drawable nDrawable, GC nGC,
+ int nX, int nY, int nAngle, XTextItem16 *pTextItem16, int nItem )
+{
+ // convert XTextItem16 to XTextItem
+ XTextItem *pTextItem = (XTextItem*)alloca( nItem * sizeof(XTextItem) );
+
+ for ( int nCurItem = 0; nCurItem < nItem; nCurItem++ )
+ {
+ int nChars = pTextItem16[ nCurItem ].nchars;
+ char* pDstCharPtr = (char*)alloca( nChars * sizeof(char) );
+ XChar2b* pSrcCharPtr = pTextItem16[ nCurItem ].chars;
+
+ pTextItem[ nCurItem ].chars = pDstCharPtr;
+ pTextItem[ nCurItem ].nchars = nChars;
+ pTextItem[ nCurItem ].delta = pTextItem16[ nCurItem ].delta;
+ pTextItem[ nCurItem ].font = pTextItem16[ nCurItem ].font;
+
+ for ( int nCurChar = 0;
+ nCurChar < nChars;
+ nCurChar++, pDstCharPtr++, pSrcCharPtr++ )
+ {
+ *pDstCharPtr = (char)pSrcCharPtr->byte2;
+ }
+ }
+
+ if ( nAngle != 0 )
+ {
+ for ( int nCurItem = 0; nCurItem < nItem; nCurItem++ )
+ {
+ // XXX FIXME this is broken, because nX and nY is not sufficiently updated
+ XSetFont( pDisplay, nGC, pTextItem[ nItem ].font );
+ if ( XSalCanDrawRotString(pDisplay, nGC) )
+ {
+ XSalDrawRotString( pDisplay, nDrawable, nGC, nX, nY,
+ pTextItem[ nCurItem ].chars, pTextItem[ nCurItem ].nchars, nAngle );
+ }
+ else
+ {
+ XDrawString( pDisplay, nDrawable, nGC, nX, nY,
+ pTextItem[ nCurItem ].chars, pTextItem[ nCurItem ].nchars );
+ }
+ }
+ }
+ else
+ {
+ XDrawText( pDisplay, nDrawable, nGC, nX, nY, pTextItem, nItem );
+ }
+}
+
+// draw string in one of the fonts / encodings that are available in the
+// extended font
+static void
+DrawString( Display *pDisplay, Drawable nDrawable, GC nGC,
+ int nX, int nY, const sal_Unicode *pStr, int nLength, int nAngle,
+ SalConverterCache *pCvt, ExtendedFontStruct *pFont )
+{
+ // sanity check
+ if ( pFont == NULL || nLength == 0 )
+ return;
+
+ rtl_TextEncoding nAsciiEnc = pFont->GetAsciiEncoding();
+
+ if ( nAsciiEnc == RTL_TEXTENCODING_UNICODE )
+ {
+ // plain Unicode, can handle all chars and can be handled straight forward
+ XFontStruct* pFontStruct = pFont->GetFontStruct( nAsciiEnc );
+
+ if ( pFontStruct == NULL )
+ return;
+
+ XSetFont( pDisplay, nGC, pFontStruct->fid );
+
+ #ifdef OSL_LITENDIAN
+ sal_Unicode *pBuffer = (sal_Unicode*)alloca( nLength * sizeof(sal_Unicode) );
+ for ( int i = 0; i < nLength; i++ )
+ pBuffer[ i ] = SwapBytes(pStr[ i ]) ;
+ #else
+ sal_Unicode *pBuffer = const_cast<sal_Unicode*>(pStr);
+ #endif
+
+ XDrawString16( pDisplay, nDrawable, nGC, nX, nY, (XChar2b*)pBuffer, nLength );
+ }
+ else
+ {
+ // convert the string to a XTextItem16 with each item chars having the
+ // encoding matching the font of fontid
+ XTextItem16 *pTextItem = (XTextItem16*)alloca( nLength * sizeof(XTextItem16) );
+ XChar2b *pMBChar = (XChar2b*)alloca( nLength * sizeof(XChar2b) );
+ memcpy( pMBChar, pStr, nLength * sizeof(XChar2b) );
+
+ rtl_TextEncoding nEncoding = nAsciiEnc;
+ XFontStruct* pFontStruct = pFont->GetFontStruct( nEncoding );
+
+ if ( pFontStruct == NULL )
+ return;
+
+ for ( int nChar = 0, nItem = -1; nChar < nLength; nChar++ )
+ {
+ rtl_TextEncoding nOldEnc = nEncoding;
+ pFont->GetFontStruct( pStr[nChar], &nEncoding, &pFontStruct, pCvt );
+
+ if ( (nItem != -1) && (pFontStruct->fid == pTextItem[ nItem ].font) )
+ {
+ pTextItem[ nItem ].nchars += 1;
+ }
+ else
+ {
+ if ( nItem != -1 )
+ ConvertTextItem16( &pTextItem[ nItem ], pCvt, nOldEnc );
+
+ ++nItem;
+
+ pTextItem[ nItem ].chars = pMBChar + nChar;
+ pTextItem[ nItem ].delta = 0;
+ pTextItem[ nItem ].font = pFontStruct->fid;
+ pTextItem[ nItem ].nchars = 1;
+ }
+ }
+ ConvertTextItem16( &pTextItem[ nItem ], pCvt, nEncoding );
+ ++nItem;
+
+ if ( XSalIsDisplay( pDisplay ) )
+ XDrawText16( pDisplay, nDrawable, nGC, nX, nY, pTextItem, nItem );
+ else
+ XPrinterDrawText16( pDisplay, nDrawable, nGC, nX, nY, nAngle,
+ pTextItem, nItem );
+ }
+}
+
+//--------------------------------------------------------------------------
+
+void
+SalGraphicsData::DrawText( long nX, long nY,
+ const sal_Unicode *pStr, USHORT nLen )
+{
+#ifndef PRINTER_DUMMY
+ if( bPrinter_ )
+ FaxPhoneComment( GetXDisplay(), pStr, nLen );
+#endif
+
+ #ifdef __notdef__
+ // XXX Fix me this part is not unicode / multibyte aware
+
+ // Bug: #45670#
+ // some monospace ISO8859-1 fonts have a hole between chars 128 and 159
+ // some applications assume these characters have also the default width
+ if( ! bPrinter_ &&
+ PITCH_FIXED == xFont_->GetFont()->mePitch &&
+ nLen > 1 )
+ {
+ XFontStruct *pXFS = GetFontInfo();
+ long nWidth = xFont_->GetDim()->GetWidth();
+
+ if( xFont_->GetFixedWidth() != nWidth
+ || xFont_->GetDefaultWidth() != nWidth )
+ {
+ unsigned int min_char = pXFS->min_char_or_byte2;
+ unsigned int max_char = pXFS->max_char_or_byte2;
+ XCharStruct *pXCS = pXFS->per_char - min_char;
+
+ for( USHORT i = 0; i < nLen-1; i++ )
+ {
+ unsigned int c = ((unsigned char*)pStr)[i];
+
+ long nW = c < min_char || c > max_char || ! pXFS->per_char
+ ? xFont_->GetDefaultWidth()
+ : pXCS[c].width;
+
+ if( nW != nWidth )
+ {
+ long *pDXAry = new long[nLen];
+
+ for( i = 0; i < nLen; i++ )
+ pDXAry[i] = nWidth * (i+1);
+
+ DrawText( nX, nY, pStr, nLen, pDXAry );
+
+ delete pDXAry;
+
+ return;
+ }
+ }
+ }
+ }
+
+ #endif /* __notdef__ */
+
+ Display *pDisplay = GetXDisplay();
+ SalConverterCache *pCvt = GetDisplay()->GetConverter();
+ GC pGC = SelectFont();
+
+ DrawString( pDisplay, hDrawable_, pGC, nX, nY,
+ pStr, nLen, nFontOrientation_ * 64 / 10, pCvt, xFont_ );
+}
+
+void
+SalGraphics::DrawText( long nX, long nY, const xub_Unicode* pStr, USHORT nLen )
+{
+ maGraphicsData.DrawText( nX, nY, pStr, nLen );
+}
+
+//--------------------------------------------------------------------------
+
+static BOOL
+CheckNoNegativeCoordinateWorkaround()
+{
+ /* Motivation: one of our clients uses a Solaris 2.4 X86 system with an
+ XServer for the Matrox Mystique graphics card. This board/server
+ sometimes does not draw Text with negative x-coordinates into a
+ virtual device (for unknown reasons). A stock X-server just clips the
+ part in the negative area. */
+ static int nCheck = -2;
+ if( nCheck == -2 )
+ {
+ char* pCmp = getenv( "SAL_NO_NEGATIVE_TEXT_OFFSET" );
+ if( pCmp && ! strncasecmp( pCmp, "true", 4 ) )
+ nCheck = 1;
+ else
+ nCheck = 0;
+ }
+ return nCheck ? TRUE : FALSE;
+}
+
+void
+SalGraphicsData::DrawText(
+ long nX, long nY,
+ const sal_Unicode* pStr, USHORT nLen, const long* pDXAry )
+{
+ #ifndef PRINTER_DUMMY
+ if( bPrinter_ )
+ FaxPhoneComment( GetXDisplay(), pStr, nLen );
+ #endif
+ GC pGC = SelectFont();
+
+ // workaround for problems with negative coordinates
+ long* pTmpAry = NULL;
+ if( nX < 0 && CheckNoNegativeCoordinateWorkaround() )
+ {
+ long nOldX = nX;
+ while( nX < 0 )
+ {
+ nX = nOldX + *pDXAry;
+ pStr++, pDXAry++, nLen--;
+ if( nLen < 1 )
+ return;
+ }
+ pTmpAry = new long[ nLen ];
+ for( int q = 0; q < nLen-1; q++ )
+ pTmpAry[q] = pDXAry[q] - ( nX - nOldX );
+ pDXAry = pTmpAry;
+ }
+
+ // draw every single character
+ SalConverterCache *pCvt = GetDisplay()->GetConverter();
+ int angle = nFontOrientation_ * 64 / 10;
+ Polygon aPolygon(1);
+ Point aOrigin( nX, nY );
+ Point aCharPos;
+
+ DrawString( GetXDisplay(), hDrawable_, pGC,
+ aOrigin.X(), aOrigin.Y(), pStr, 1, angle, pCvt, xFont_ );
+
+ for( int i = 1; i < nLen ; i++ )
+ {
+ aCharPos = Point( aOrigin.X() + pDXAry[ i - 1 ], aOrigin.Y() );
+ aPolygon.SetPoint( aCharPos, 0 );
+ aPolygon.Rotate( aOrigin, nFontOrientation_ );
+ aCharPos = aPolygon.GetPoint( 0 );
+
+ DrawString( GetXDisplay(), hDrawable_, pGC,
+ aCharPos.X(), aCharPos.Y(), pStr + i, 1, angle, pCvt, xFont_ );
+ }
+
+ if( pTmpAry )
+ delete pTmpAry;
+}
+
+// ----------------------------------------------------------------------------
+//
+// SalGraphics
+//
+// ----------------------------------------------------------------------------
+
+USHORT
+SalGraphics::SetFont( ImplFontSelectData *pEntry )
+{
+ maGraphicsData.SetFont( pEntry );
+ return _IsPrinter() ? SAL_SETFONT_USEDRAWTEXTARRAY : 0;
+}
+
+// ----------------------------------------------------------------------------
+
+void
+SalGraphics::DrawTextArray( long nX, long nY,
+ const xub_Unicode *pStr, USHORT nLen, const long *pDXAry )
+{
+ maGraphicsData.DrawText( nX, nY, pStr, nLen, pDXAry );
+}
+
+// ----------------------------------------------------------------------------
+
+void
+SalGraphics::SetTextColor( SalColor nSalColor )
+{
+ if( _GetTextColor() != nSalColor )
+ {
+ _GetTextColor() = nSalColor;
+ _GetTextPixel() = _GetPixel( nSalColor );
+ _IsFontGC() = FALSE;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void
+SalGraphics::GetDevFontList( ImplDevFontList *pList )
+{
+ XlfdStorage* pFonts = _GetDisplay()->GetXlfdList();
+
+ for ( int nIdx = 0; nIdx < pFonts->GetCount(); nIdx++ )
+ {
+ ImplFontData *pFontData = new ImplFontData;
+ pFonts->Get(nIdx)->ToImplFontData( pFontData );
+ pList->Add( pFontData );
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+inline long
+sal_DivideNeg( long n1, long n2 )
+{
+ return ( n1 < 0 ) ? (n1 - n2 / 2) / n2 : (n1 + n2 / 2) / n2;
+}
+
+void
+SalGraphics::GetFontMetric( ImplFontMetricData *pMetric )
+{
+ ExtendedFontStruct* pFont = maGraphicsData.xFont_;
+
+ if ( pFont != NULL )
+ {
+ pFont->ToImplFontMetricData( pMetric );
+
+ if( XSalCanDrawRotString( maGraphicsData.GetXDisplay(), None ) )
+ pMetric->mnOrientation = maGraphicsData.nFontOrientation_;
+
+ long n;
+
+ n = maGraphicsData.aScale_.GetNumerator();
+ if( n != 1 )
+ {
+ pMetric->mnWidth *= n;
+ pMetric->mnAscent *= n;
+ pMetric->mnDescent *= n;
+ pMetric->mnLeading *= n;
+ pMetric->mnSlant *= n;
+ }
+
+ n = maGraphicsData.aScale_.GetDenominator();
+ if( n != 1 )
+ {
+ pMetric->mnWidth = Divide( pMetric->mnWidth, n );
+ pMetric->mnAscent = sal_DivideNeg( pMetric->mnAscent, n );
+ pMetric->mnDescent = sal_DivideNeg( pMetric->mnDescent, n );
+ pMetric->mnLeading = sal_DivideNeg( pMetric->mnLeading, n );
+ pMetric->mnSlant = sal_DivideNeg( pMetric->mnSlant, n );
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+static long
+InitializeWidthArray( long *pWidthArray, sal_Size nItems, int nValue = 0 )
+{
+ const long nPrecision = 1;
+
+ for ( int i = 0; i < nItems; i++, pWidthArray++ )
+ *pWidthArray = nValue;
+
+ return nPrecision;
+}
+
+long
+SalGraphics::GetCharWidth( USHORT nChar1, USHORT nChar2, long *pWidthAry )
+{
+ // return the precision of the calculated charwidth, e.g. 1000 = 3 digits
+ // defaultet to 1 for now
+ const long nPrecision = 1;
+ int nRequestedWidth = nChar2 - nChar1 + 1;
+ int nCharWidth;
+
+ // XXX sanity check, this may happen if no font at all is installed
+ // or no system font matches the requirements for the user interface
+ if ( maGraphicsData.xFont_ == NULL )
+ return InitializeWidthArray( pWidthAry, nRequestedWidth, 12 );
+
+ // the font should know it's metrics best
+ SalDisplay *pSalDisplay = maGraphicsData.GetDisplay();
+
+ nCharWidth = maGraphicsData.xFont_->GetCharWidth(
+ pSalDisplay->GetConverter(), nChar1, nChar2, pWidthAry );
+
+ // XXX sanity check, this may happen if the font cannot be loaded/queried
+ // either because of a garbled fontpath or because of invalid fontfile
+ if ( nCharWidth != nRequestedWidth )
+ InitializeWidthArray( pWidthAry + nCharWidth,
+ nRequestedWidth - nCharWidth );
+
+ // handle internal scaling
+ const long nNumerator = maGraphicsData.aScale_.GetNumerator();
+ const long nDenominator = maGraphicsData.aScale_.GetDenominator();
+ long *pPtr;
+ sal_Unicode nChar;
+
+ if ( nNumerator != 1 )
+ for( pPtr = pWidthAry, nChar = nChar1; nChar <= nChar2; nChar++, pPtr++)
+ *pPtr *= nNumerator;
+ if ( nDenominator != 1 )
+ for( pPtr = pWidthAry, nChar = nChar1; nChar <= nChar2; nChar++, pPtr++)
+ *pPtr = Divide( *pPtr, nDenominator );
+
+ // return
+ return nPrecision;
+}
+
+// ---------------------------------------------------------------------------
+
+extern unsigned char TranslateCharName( char* );
+
+ULONG
+SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData *pKernPairs )
+{
+ if( ! _IsPrinter() )
+ return 0;
+
+ // get pair kerning table ( internal data from xprinter )
+ int i, nCurPair=0;
+
+ // XXX Fix me, improve this to be multi encoding aware: merge kern
+ // pair list for all encodings available in the xfont
+ rtl_TextEncoding nEncoding = maGraphicsData.xFont_->GetAsciiEncoding();
+ XFontStruct *pXFS = maGraphicsData.xFont_->GetFontStruct( nEncoding );
+ XExtData *pXES = pXFS->ext_data;
+
+ for( i = 0; pXES && i < 2; i++, pXES = pXES->next );
+ if( i < 2 )
+ return 0;
+ XpPairKernData* pXpPKD = (XpPairKernData*)(pXES->private_data);
+ PairKernData* pPKD = pXpPKD->pkd;
+
+ for( i = 0, nCurPair=0; i < pXpPKD->numOfPairs; i++ )
+ {
+ unsigned char c1 = TranslateCharName( pPKD[i].name1 );
+ unsigned char c2 = TranslateCharName( pPKD[i].name2 );
+ if( c1 && c2 )
+ {
+ if( pKernPairs && nCurPair < nPairs )
+ {
+ pKernPairs[ nCurPair ].mnChar1 = c1;
+ pKernPairs[ nCurPair ].mnChar2 = c2;
+ pKernPairs[ nCurPair ].mnKern =
+ (long)(pPKD[i].xamt * pXpPKD->pointsize / 1000 );
+ }
+ nCurPair++;
+ }
+ }
+
+ return nCurPair;
+}
+
+// ---------------------------------------------------------------------------
+
+BOOL
+SalGraphics::GetGlyphBoundRect( xub_Unicode c,
+ long *pX, long *pY, long *pDX, long *pDY )
+{
+ return FALSE;
+}
+
+// ---------------------------------------------------------------------------
+
+ULONG
+SalGraphics::GetGlyphOutline( xub_Unicode c,
+ USHORT **ppPolySizes, SalPoint **ppPoints, BYTE **ppFlags )
+{
+ return 0;
+}
+
diff --git a/vcl/unx/source/gdi/salogl.cxx b/vcl/unx/source/gdi/salogl.cxx
new file mode 100644
index 000000000000..ef2566788549
--- /dev/null
+++ b/vcl/unx/source/gdi/salogl.cxx
@@ -0,0 +1,393 @@
+/*************************************************************************
+ *
+ * $RCSfile: salogl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALOGL_CXX
+
+#include <salunx.h>
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+
+#ifndef _SV_SALOGL_HXX
+#include <salogl.hxx>
+#endif
+
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+// ------------
+// - Lib-Name -
+// ------------
+
+#define OGL_LIBNAME "libGL.so"
+// ----------
+// - Macros -
+// ----------
+
+// NETBSD has neither RTLD_GLOBAL nor RTLD_NOW
+#ifdef NETBSD
+#define DLOPEN_MODE 0
+#else
+#define DLOPEN_MODE (RTLD_NOW | RTLD_GLOBAL)
+#endif
+
+
+// -----------------
+// - Statics init. -
+// -----------------
+
+// Members
+GLXContext SalOpenGL::maGLXContext = 0;
+Display* SalOpenGL::mpDisplay = 0;
+XVisualInfo* SalOpenGL::mpVisualInfo = 0;
+BOOL SalOpenGL::mbHaveGLVisual = FALSE;
+
+void * SalOpenGL::mpGLLib = 0;
+ULONG SalOpenGL::mnOGLState = OGL_STATE_UNLOADED;
+
+GLXContext (*SalOpenGL::pCreateContext)( Display *, XVisualInfo *, GLXContext, Bool ) = 0;
+void (*SalOpenGL::pDestroyContext)( Display *, GLXContext ) = 0;
+GLXContext (*SalOpenGL::pGetCurrentContext)( ) = 0;
+Bool (*SalOpenGL::pMakeCurrent)( Display *, GLXDrawable, GLXContext ) = 0;
+void (*SalOpenGL::pSwapBuffers)( Display*, GLXDrawable ) = 0;
+int (*SalOpenGL::pGetConfig)( Display*, XVisualInfo*, int, int* ) = 0;
+void (*SalOpenGL::pFlush)() = 0;
+
+// -------------
+// - SalOpenGL -
+// -------------
+
+SalOpenGL::SalOpenGL( SalGraphics* pGraphics )
+{
+ mpDisplay = pGraphics->maGraphicsData.GetXDisplay();
+ mpVisualInfo = pGraphics->maGraphicsData.GetDisplay()->GetVisual();
+ maDrawable = pGraphics->maGraphicsData.GetDrawable();
+}
+
+// ------------------------------------------------------------------------
+
+SalOpenGL::~SalOpenGL()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::Create()
+{
+ if( OGL_STATE_UNLOADED == mnOGLState )
+ {
+ BOOL bHasGLX = FALSE;
+ char **ppExtensions;
+ int nExtensions;
+
+ if( *DisplayString( mpDisplay ) == ':' ||
+ ! strncmp( DisplayString( mpDisplay ), "localhost:", 10 )
+ )
+ {
+ // GLX only on local displays due to strange problems
+ // with remote GLX
+ ppExtensions = XListExtensions( mpDisplay, &nExtensions );
+ for( int i=0; i < nExtensions; i++ )
+ {
+ if( ! strncmp( "GLX", ppExtensions[ i ], 3 ) )
+ {
+ bHasGLX = TRUE;
+ break;
+ }
+ }
+ XFreeExtensionList( ppExtensions );
+#ifdef DEBUG
+ if( ! bHasGLX )
+ fprintf( stderr, "XServer does not support GLX extension\n" );
+#endif
+ }
+ if( bHasGLX && mpVisualInfo->c_class == TrueColor && ImplInit() )
+ {
+ int nDoubleBuffer = 0;
+ int nHaveGL = 0;
+ pGetConfig( mpDisplay, mpVisualInfo,
+ GLX_USE_GL, &nHaveGL );
+ pGetConfig( mpDisplay, mpVisualInfo,
+ GLX_DOUBLEBUFFER, &nDoubleBuffer );
+ if( nHaveGL && ! nDoubleBuffer )
+ {
+ SalDisplay* pSalDisplay = GetSalData()->GetDefDisp();
+ BOOL bPreviousState =
+ pSalDisplay->GetXLib()->GetIgnoreXErrors();
+ pSalDisplay->GetXLib()->SetIgnoreXErrors( TRUE );
+ mbHaveGLVisual = TRUE;
+
+ maGLXContext = pCreateContext( mpDisplay, mpVisualInfo, 0, True );
+ if( pSalDisplay->GetXLib()->WasXError() )
+ mbHaveGLVisual = FALSE;
+ else
+ pMakeCurrent( mpDisplay, maDrawable, maGLXContext );
+ if( pSalDisplay->GetXLib()->WasXError() )
+ mbHaveGLVisual = FALSE;
+ pSalDisplay->GetXLib()->SetIgnoreXErrors( bPreviousState );
+
+ if( mbHaveGLVisual )
+ mnOGLState = OGL_STATE_VALID;
+ else
+ maGLXContext = None;
+ }
+ }
+ if( mnOGLState != OGL_STATE_VALID )
+ {
+ ImplFreeLib();
+ mnOGLState = OGL_STATE_INVALID;
+ }
+#if defined DEBUG
+ if( mnOGLState == OGL_STATE_VALID )
+ fprintf( stderr, "Using GLX on visual id %x.\n", mpVisualInfo->visualid );
+ else
+ fprintf( stderr, "Not using GLX.\n" );
+#endif
+ }
+
+ return mnOGLState == OGL_STATE_VALID ? TRUE : FALSE;
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::Release()
+{
+ ImplFreeLib();
+}
+
+// ------------------------------------------------------------------------
+
+void* SalOpenGL::GetOGLFnc( const String& rFncName )
+{
+ if( mpGLLib )
+ {
+ return dlsym( mpGLLib, ByteString( rFncName, RTL_TEXTENCODING_ASCII_US ).GetBuffer() );
+ }
+ return NULL;
+}
+
+void* SalOpenGL::GetOGLFnc( char *pFncName )
+{
+ if( mpGLLib )
+ {
+ return dlsym( mpGLLib, pFncName );
+ }
+ return NULL;
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::OGLEntry( SalGraphics* pGraphics )
+{
+ GLXDrawable aDrawable = pGraphics->maGraphicsData.GetDrawable();
+ if( aDrawable != maDrawable )
+ {
+ maDrawable = aDrawable;
+ pMakeCurrent( mpDisplay, maDrawable, maGLXContext );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::OGLExit( SalGraphics* pGraphics )
+{
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::ImplFreeLib()
+{
+ if( mpGLLib )
+ {
+ if( maGLXContext && pDestroyContext )
+ pDestroyContext( mpDisplay, maGLXContext );
+ dlclose( mpGLLib );
+
+ mpGLLib = 0;
+ pCreateContext = 0;
+ pDestroyContext = 0;
+ pGetCurrentContext = 0;
+ pMakeCurrent = 0;
+ pSwapBuffers = 0;
+ pGetConfig = 0;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::ImplInit()
+{
+ if( ! mpGLLib )
+ {
+ ByteString sNoGL( getenv( "SAL_NOOPENGL" ) );
+ if( sNoGL.ToLowerAscii() == "true" ) return FALSE;
+ mpGLLib = dlopen( OGL_LIBNAME, DLOPEN_MODE );
+ }
+ if( ! mpGLLib )
+ {
+#ifdef DEBUG
+ fprintf( stderr, OGL_LIBNAME "could not be opened: %s\n", dlerror() );
+#endif
+ return FALSE;
+ }
+
+ // Internal use
+ pCreateContext = (GLXContext(*)(Display*,XVisualInfo*,GLXContext,Bool ))
+ GetOGLFnc( "glXCreateContext" );
+ pDestroyContext = (void(*)(Display*,GLXContext))
+ GetOGLFnc( "glXDestroyContext" );
+ pGetCurrentContext = (GLXContext(*)())
+ GetOGLFnc( "glXGetCurrentContext" );
+ pMakeCurrent = (Bool(*)(Display*,GLXDrawable,GLXContext))
+ GetOGLFnc( "glXMakeCurrent" );
+ pSwapBuffers=(void(*)(Display*, GLXDrawable))
+ GetOGLFnc( "glXSwapBuffers" );
+ pGetConfig = (int(*)(Display*, XVisualInfo*, int, int* ))
+ GetOGLFnc( "glXGetConfig" );
+ pFlush = (void(*)())
+ GetOGLFnc( "glFlush" );
+
+ BOOL bRet = pCreateContext && pDestroyContext && pGetCurrentContext && pMakeCurrent && pSwapBuffers && pGetConfig ? TRUE : FALSE;
+
+#ifdef DEBUG
+ if( ! bRet )
+ fprintf( stderr, "could not find all needed symbols in " OGL_LIBNAME "\n" );
+#endif
+
+ return bRet;
+}
+
+void SalOpenGL::StartScene( SalGraphics* pGraphics )
+{
+ // flush pending operations which otherwise might be drawn
+ // at the wrong time
+ XSync( mpDisplay, False );
+}
+
+void SalOpenGL::StopScene()
+{
+ if( maDrawable )
+ {
+ pSwapBuffers( mpDisplay, maDrawable );
+ pFlush();
+ }
+}
+
+void SalOpenGL::MakeVisualWeights( Display* pDisplay,
+ XVisualInfo* pInfos,
+ int *pWeights,
+ int nVisuals )
+{
+ BOOL bHasGLX = FALSE;
+ char **ppExtensions;
+ int nExtensions,i ;
+
+ // GLX only on local displays due to strange problems
+ // with remote GLX
+ if( ! ( *DisplayString( pDisplay ) == ':' ||
+ !strncmp( DisplayString( pDisplay ), "localhost:", 10 )
+ ) )
+ return;
+
+ ppExtensions = XListExtensions( pDisplay, &nExtensions );
+ for( i=0; i < nExtensions; i++ )
+ {
+ if( ! strncmp( "GLX", ppExtensions[ i ], 3 ) )
+ {
+ bHasGLX = TRUE;
+ break;
+ }
+ }
+ XFreeExtensionList( ppExtensions );
+ if( ! bHasGLX )
+ return;
+
+ if( ! ImplInit() )
+ {
+ ImplFreeLib();
+ return;
+ }
+
+ for( i = 0; i < nVisuals; i++ )
+ {
+ int nDoubleBuffer = 0;
+ int nHaveGL = 0;
+ if( pInfos[i].c_class == TrueColor )
+ {
+ pGetConfig( pDisplay, &pInfos[ i ], GLX_USE_GL, &nHaveGL );
+ pGetConfig( pDisplay, &pInfos[ i ], GLX_DOUBLEBUFFER, &nDoubleBuffer );
+ if( nHaveGL && ! nDoubleBuffer )
+ {
+ mbHaveGLVisual = TRUE;
+ pWeights[ i ] += 65536;
+ }
+ }
+ }
+}
diff --git a/vcl/unx/source/gdi/salvd.cxx b/vcl/unx/source/gdi/salvd.cxx
new file mode 100644
index 000000000000..6c11ea419bcd
--- /dev/null
+++ b/vcl/unx/source/gdi/salvd.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALVD_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <salunx.h>
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+
+// -=-= SalInstance =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+SalVirtualDevice* SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
+ long nDX, long nDY,
+ USHORT nBitCount )
+{
+ SalVirtualDevice *pVDev = new SalVirtualDevice();
+ if( !nBitCount && pGraphics )
+ nBitCount = pGraphics->GetBitCount();
+ if( !pVDev->maVirDevData.Init( pGraphics->maGraphicsData.GetDisplay(),
+ nDX, nDY, nBitCount ) )
+ {
+ delete pVDev;
+ return NULL;
+ }
+
+ pVDev->maVirDevData.InitGraphics( pVDev, pGraphics );
+ return pVDev;
+}
+
+final void SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice )
+{ delete pDevice; }
+
+// -=-= SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final void SalGraphicsData::Init( SalVirtualDevice *pDevice,
+ SalGraphics *pGraphics )
+{
+ SalDisplay *pDisplay = pDevice->maVirDevData.GetDisplay();
+
+ int nVisualDepth = pDisplay->GetColormap().GetVisual()->GetDepth();
+ int nDeviceDepth = pDevice->maVirDevData.GetDepth();
+
+ if( nDeviceDepth == nVisualDepth )
+ xColormap_ = &pDisplay->GetColormap();
+ else
+ if( nDeviceDepth == 1 )
+ xColormap_ = new SalColormap();
+
+ hDrawable_ = pDevice->maVirDevData.GetDrawable();
+
+ bWindow_ = pDisplay->IsDisplay();
+ bVirDev_ = TRUE;
+
+ nPenPixel_ = GetPixel( nPenColor_ );
+ nTextPixel_ = GetPixel( nTextColor_ );
+ nBrushPixel_ = GetPixel( nBrushColor_ );
+}
+
+// -=-= SalVirDevData / SalVirtualDevice -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final BOOL SalVirDevData::Init( SalDisplay *pDisplay,
+ long nDX, long nDY,
+ USHORT nBitCount )
+{
+ pDisplay_ = pDisplay;
+ pGraphics_ = new SalGraphics();
+ nDX_ = nDX;
+ nDY_ = nDY;
+ nDepth_ = nBitCount;
+
+ hDrawable_ = XCreatePixmap( GetXDisplay(),
+ pDisplay_->GetDrawable(),
+ nDX_, nDY_,
+ GetDepth() );
+
+ return hDrawable_ != None ? TRUE : FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final inline SalVirDevData::SalVirDevData()
+{
+ pDisplay_ = (SalDisplay*)ILLEGAL_POINTER;
+ pGraphics_ = NULL;
+ hDrawable_ = None;
+ nDX_ = 0;
+ nDY_ = 0;
+ nDepth_ = 0;
+ bGraphics_ = FALSE;
+}
+
+final SalVirtualDevice::SalVirtualDevice() {}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+beta inline SalVirDevData::~SalVirDevData()
+{
+ if( pGraphics_ )
+ {
+ pGraphics_->maGraphicsData.DeInit();
+ delete pGraphics_;
+ }
+
+ if( GetDrawable() )
+ XFreePixmap( GetXDisplay(), GetDrawable() );
+}
+
+final SalVirtualDevice::~SalVirtualDevice()
+{}
+
+// -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+#define _GetDrawable() maVirDevData.GetDrawable()
+#define _GetDisplay() maVirDevData.GetDisplay()
+#define _GetXDisplay() maVirDevData.GetXDisplay()
+#define _GetDepth() maVirDevData.nDepth_
+
+// -=-= SalVirtualDevice -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+final SalGraphics* SalVirtualDevice::GetGraphics()
+{
+ if( maVirDevData.bGraphics_ )
+ return NULL;
+
+ if( maVirDevData.pGraphics_ )
+ maVirDevData.bGraphics_ = TRUE;
+
+ return maVirDevData.pGraphics_;
+}
+
+final void SalVirtualDevice::ReleaseGraphics( SalGraphics* )
+{ maVirDevData.bGraphics_ = FALSE; }
+
+final BOOL SalVirtualDevice::SetSize( long nDX, long nDY )
+{
+ if( !nDX ) nDX = 1;
+ if( !nDY ) nDY = 1;
+
+ Pixmap h = XCreatePixmap( _GetXDisplay(),
+ maVirDevData.pDisplay_->GetDrawable(),
+ nDX, nDY, _GetDepth() );
+
+ if( !h )
+ {
+ if( !_GetDrawable() )
+ {
+ maVirDevData.hDrawable_ = XCreatePixmap( _GetXDisplay(),
+ maVirDevData.pDisplay_->GetDrawable(),
+ 1, 1, _GetDepth() );
+ maVirDevData.nDX_ = 1;
+ maVirDevData.nDY_ = 1;
+ }
+ return FALSE;
+ }
+
+ if( _GetDrawable() )
+ XFreePixmap( _GetXDisplay(), _GetDrawable() );
+ maVirDevData.hDrawable_ = h;
+
+ maVirDevData.nDX_ = nDX;
+ maVirDevData.nDY_ = nDY;
+
+ if( maVirDevData.pGraphics_ )
+ maVirDevData.InitGraphics( this, maVirDevData.pGraphics_ );
+
+ return TRUE;
+}
+
diff --git a/vcl/unx/source/gdi/xfont.cxx b/vcl/unx/source/gdi/xfont.cxx
new file mode 100644
index 000000000000..edf1f02f4cfc
--- /dev/null
+++ b/vcl/unx/source/gdi/xfont.cxx
@@ -0,0 +1,559 @@
+/*************************************************************************
+ *
+ * $RCSfile: xfont.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <salunx.h>
+
+#ifndef EXTENDED_FONTSTRUCT_HXX
+#include "xfont.hxx"
+#endif
+#ifndef XLFD_EXTENDED_HXX
+#include "xlfd_extd.hxx"
+#endif
+#ifndef SAL_CONVERTER_CACHE_HXX_
+#include "salcvt.hxx"
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+ExtendedFontStruct::ExtendedFontStruct( Display* pDisplay,
+ unsigned short nPixelSize, ExtendedXlfd* pXlfd,
+ SalConverterCache* pCvt ) :
+ mpDisplay( pDisplay ),
+ mnPixelSize( nPixelSize ),
+ mpXlfd( pXlfd )
+{
+ // member functions rely on zero initialized pointer for checking of
+ // already loaded fonts
+ mpXFontStruct = (XFontStruct**)calloc( mpXlfd->NumEncodings(),
+ sizeof(XFontStruct*) );
+ mnDefaultWidth = GetDefaultWidth( pCvt );
+}
+
+ExtendedFontStruct::~ExtendedFontStruct()
+{
+ for ( int nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ )
+ {
+ if ( mpXFontStruct[nIdx] != NULL )
+ XFreeFont( mpDisplay, mpXFontStruct[nIdx] );
+ }
+}
+
+rtl_TextEncoding
+ExtendedFontStruct::GetAsciiEncoding( int *pAsciiRange ) const
+{
+ return mpXlfd->GetAsciiEncoding( pAsciiRange );
+}
+
+int
+ExtendedFontStruct::LoadEncoding( rtl_TextEncoding nEncoding )
+{
+ int nIdx = mpXlfd->GetEncodingIdx( nEncoding );
+ if ( (nIdx < 0) || (mpXFontStruct[ nIdx ] != NULL) )
+ return nIdx;
+
+ ByteString aFontName;
+ mpXlfd->ToString( aFontName, mnPixelSize, nEncoding );
+
+ mpXFontStruct[ nIdx ] = XLoadQueryFont( mpDisplay, aFontName.GetBuffer() );
+ if ( (mpXFontStruct[nIdx] != NULL) && (mpXFontStruct[nIdx]->fid == 0) )
+ mpXFontStruct[nIdx]->fid = XLoadFont(mpDisplay, aFontName.GetBuffer());
+ return nIdx;
+}
+
+XFontStruct*
+ExtendedFontStruct::GetFontStruct( rtl_TextEncoding nEncoding )
+{
+ int nIdx = LoadEncoding( nEncoding );
+ return nIdx < 0 ? NULL : mpXFontStruct[nIdx] ;
+}
+
+Bool
+ExtendedFontStruct::GetFontBoundingBox( XCharStruct *pCharStruct,
+ int *pAscent, int *pDescent )
+{
+ pCharStruct->lbearing = 0;
+ pCharStruct->rbearing = 0;
+ pCharStruct->width = 0;
+ pCharStruct->ascent = 0;
+ pCharStruct->descent = 0;
+
+ *pAscent = 0;
+ *pDescent = 0;
+
+ int nIdx;
+
+ // check whether there is at least one encoding allready loaded
+ Bool bEmpty = True;
+ for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ )
+ bEmpty = bEmpty && (mpXFontStruct[nIdx] == NULL);
+ if ( bEmpty )
+ LoadEncoding( mpXlfd->GetAsciiEncoding() );
+
+ // get the max bounding box from all font structs
+ for ( nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ )
+ if ( mpXFontStruct[ nIdx ] != NULL )
+ {
+ *pAscent = max( mpXFontStruct[nIdx]->ascent, *pAscent );
+ *pDescent = max( mpXFontStruct[nIdx]->descent, *pDescent );
+
+ XCharStruct* pMaxBounds = &(mpXFontStruct[nIdx]->max_bounds);
+
+ pCharStruct->lbearing = max( pMaxBounds->lbearing,
+ pCharStruct->lbearing );
+ pCharStruct->rbearing = max( pMaxBounds->rbearing,
+ pCharStruct->rbearing );
+ pCharStruct->width = max( pMaxBounds->width,
+ pCharStruct->width );
+ pCharStruct->ascent = max( pMaxBounds->ascent,
+ pCharStruct->ascent );
+ pCharStruct->descent = max( pMaxBounds->descent,
+ pCharStruct->descent );
+ }
+
+ return (pCharStruct->width > 0);
+}
+
+Bool
+ExtendedFontStruct::ToImplFontMetricData(ImplFontMetricData *pFontMetric)
+{
+ pFontMetric->mnOrientation = 0;
+ pFontMetric->mnSlant = 0;
+ pFontMetric->mbDevice = TRUE;
+
+ pFontMetric->meCharSet = mpXlfd->GetEncoding( );
+ pFontMetric->meFamily = mpXlfd->GetFamily();
+ pFontMetric->meWeight = mpXlfd->GetWeight();
+ pFontMetric->mePitch = mpXlfd->GetSpacing();
+ pFontMetric->meItalic = mpXlfd->GetItalic();
+ pFontMetric->meType = mpXlfd->GetFontType();
+
+ int nAscent, nDescent;
+ XCharStruct aBoundingBox;
+ if ( GetFontBoundingBox(&aBoundingBox, &nAscent, &nDescent) )
+ {
+ pFontMetric->mnWidth = aBoundingBox.width;
+ pFontMetric->mnAscent = aBoundingBox.ascent;
+ pFontMetric->mnDescent = aBoundingBox.descent;
+ pFontMetric->mnLeading = max(0, aBoundingBox.ascent - nAscent
+ + aBoundingBox.descent - nDescent );
+ // XXX Fix me
+ pFontMetric->mnFirstChar = 0;
+ pFontMetric->mnLastChar = 255;
+
+ return True;
+ }
+ else
+ {
+ return False;
+ }
+}
+
+Bool
+ExtendedFontStruct::Match( const ExtendedXlfd *pXlfd, int nPixelSize ) const
+{
+ if( mpXlfd != pXlfd )
+ return FALSE;
+
+ return mnPixelSize == nPixelSize;
+}
+
+// Get an appropriate x-font that contains a glyph for the given unicode
+// code point.
+// This routine is designed to be called for each character in a text.
+// It first checks the given encoding to optimize for the fact that two
+// adjacent characters in a text most probably have the same encoding
+// In the first call initialize pEncodingInOut to dontknow, this causes
+// EncodingHasChar() to fail and thus bootstraps the encoding, otherwise
+// make sure that the initial value of pFontInOut matches the encoding and
+// that the encoding is valid for the font.
+Bool
+ExtendedFontStruct::GetFontStruct( sal_Unicode nChar,
+ rtl_TextEncoding *pEncodingInOut, XFontStruct **pFontInOut,
+ SalConverterCache *pCvt )
+{
+ if ( pCvt->EncodingHasChar(*pEncodingInOut, nChar) )
+ {
+ return True;
+ }
+ else
+ {
+ for ( int nIdx = 0; nIdx < mpXlfd->NumEncodings(); nIdx++ )
+ {
+ rtl_TextEncoding nEnc = mpXlfd->GetEncoding(nIdx);
+ if ( (nEnc != *pEncodingInOut)
+ && pCvt->EncodingHasChar(nEnc, nChar) )
+ {
+ *pEncodingInOut = nEnc;
+ *pFontInOut = GetFontStruct( nEnc );
+ return True;
+ }
+ }
+ }
+
+ return False;
+}
+
+
+// ---------------------------------------------------------------------------
+// utility functions to handle xfontstruct information, this is all to
+// calculate charwidth information
+// ---------------------------------------------------------------------------
+
+static Bool
+CharExists( const XCharStruct* pChar )
+{
+ if ( pChar == NULL )
+ return False;
+
+ return pChar->width
+ || pChar->ascent || pChar->descent
+ || pChar->lbearing || pChar->rbearing;
+}
+
+// this relies on non-null per_char information in the fontstruct
+static XCharStruct*
+GetCharinfo( const XFontStruct *pXFontStruct, sal_MultiByte nChar )
+{
+ unsigned int nRow = nChar >> 8;
+ unsigned int nCol = nChar & 0xFF;
+
+ int nMinRow = pXFontStruct->min_byte1;
+ int nMaxRow = pXFontStruct->max_byte1;
+ int nMinCol = pXFontStruct->min_char_or_byte2;
+ int nMaxCol = pXFontStruct->max_char_or_byte2;
+
+ if ( nRow >= nMinRow && nRow <= nMaxRow
+ && nCol >= nMinCol && nCol <= nMaxCol )
+ {
+ return &pXFontStruct->per_char[
+ (nRow-nMinRow) * (nMaxCol-nMinCol+1) + (nCol-nMinCol) ];
+ }
+
+ return NULL;
+}
+
+static sal_Size
+QueryCharWidth16( Display* pDisplay, XLIB_Font nFontID, sal_MultiByte nChar,
+ sal_Size nDefaultWidth )
+{
+ int nDirection, nFontAscent, nFontDescent;
+ XCharStruct aBoundingBox;
+
+ XQueryTextExtents16( pDisplay, nFontID, (XChar2b*)&nChar, 1,
+ &nDirection, &nFontAscent, &nFontDescent, &aBoundingBox );
+
+ return CharExists( &aBoundingBox ) ? aBoundingBox.width : nDefaultWidth;
+}
+
+static sal_Size
+QueryCharWidth8( XFontStruct* pXFontStruct, sal_Char nChar,
+ sal_Size nDefaultWidth )
+{
+ int nDirection, nFontAscent, nFontDescent;
+ XCharStruct aBoundingBox;
+
+ XTextExtents( pXFontStruct, &nChar, 1,
+ &nDirection, &nFontAscent, &nFontDescent, &aBoundingBox );
+
+ return CharExists( &aBoundingBox ) ? aBoundingBox.width : nDefaultWidth;
+}
+
+// the default width is the width of the question mark since this is the
+// character which is displayed for unconvertable unicode chars
+sal_Size
+ExtendedFontStruct::GetDefaultWidth( SalConverterCache* pCvt )
+{
+ rtl_TextEncoding nEncoding = mpXlfd->GetAsciiEncoding();
+ XFontStruct* pXFontStruct = GetFontStruct( nEncoding );
+
+ if ( pXFontStruct != NULL )
+ {
+ sal_Unicode nQuestionMark = 0x3f;
+ sal_MultiByte nChar;
+ sal_Char pBuffer[8];
+
+ sal_Size nSize = ConvertStringUTF16( &nQuestionMark, 1, pBuffer,
+ sizeof(pBuffer), pCvt->GetU2TConverter(nEncoding) );
+ if ( nSize == 2 )
+ {
+ nChar = ((sal_MultiByte)pBuffer[0] << 8)
+ + (sal_MultiByte)pBuffer[1];
+ return QueryCharWidth16( mpDisplay, pXFontStruct->fid, nChar, 0 );
+ }
+ else
+ if ( nSize == 1 )
+ {
+ return QueryCharWidth8( pXFontStruct, pBuffer[0], 0 );
+ }
+ else
+ {
+ return QueryCharWidth8( pXFontStruct, nQuestionMark, 0 );
+ }
+ }
+
+ return 0;
+}
+
+// Handle single byte fonts which do not require conversion, this exploits
+// the fact that unicode equals latin1 or ansi1252 in the range [0..0xff] and
+// is compatible with iso8859-X at least in the range to 0x7f
+sal_Size
+ExtendedFontStruct::GetCharWidth8( sal_Unicode nFrom, sal_Unicode nTo,
+ long *pWidthArray, rtl_TextEncoding nEncoding )
+{
+ if ( !(nFrom <= nTo) )
+ return 0;
+
+ XFontStruct* pXFontStruct = GetFontStruct( nEncoding );
+ if ( pXFontStruct == NULL )
+ return 0;
+
+ // query the font metrics
+ if ( (pXFontStruct->max_bounds.width == pXFontStruct->min_bounds.width)
+ || (pXFontStruct->per_char == NULL) )
+ {
+ // fixed width font
+ for ( int nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ )
+ *pWidthArray = mnDefaultWidth;
+ }
+ else
+ {
+ // variable width font
+ int nMinChar = pXFontStruct->min_char_or_byte2;
+ int nMaxChar = pXFontStruct->max_char_or_byte2;
+
+ int nIdx = nFrom;
+
+ for ( ; nIdx < min(nTo, nMinChar); nIdx++, pWidthArray++ )
+ *pWidthArray = mnDefaultWidth;
+ for ( ; nIdx <= min(nTo, nMaxChar); nIdx++, pWidthArray++ )
+ {
+ XCharStruct* pChar = &(pXFontStruct->per_char[nIdx - nMinChar]);
+ *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth;
+ }
+ for ( ; nIdx <= nTo; nIdx++, pWidthArray++ )
+ *pWidthArray = mnDefaultWidth;
+ }
+
+ // return amount of handled chars
+ return nTo - nFrom + 1;
+}
+
+// Handle utf16 encoded fonts, which do not require conversion
+sal_Size
+ExtendedFontStruct::GetCharWidthUTF16( sal_Unicode nFrom, sal_Unicode nTo,
+ long *pWidthArray )
+{
+ if ( !(nFrom <= nTo) )
+ return 0;
+
+ XFontStruct* pXFontStruct = GetFontStruct( RTL_TEXTENCODING_UNICODE );
+ FontPitch nSpacing = mpXlfd->GetSpacing( RTL_TEXTENCODING_UNICODE );
+
+ if ( pXFontStruct == NULL )
+ return 0;
+
+ // query the font metrics
+ if ( nSpacing == PITCH_VARIABLE
+ && pXFontStruct->per_char == NULL)
+ {
+ // get per_char information from the server
+ for ( sal_Unicode nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ )
+ *pWidthArray = QueryCharWidth16( mpDisplay, pXFontStruct->fid,
+ nIdx, mnDefaultWidth );
+ }
+ else
+ if ( (pXFontStruct->max_bounds.width == pXFontStruct->min_bounds.width)
+ || (pXFontStruct->per_char == NULL) )
+ {
+ // really a fixed width font
+ for ( sal_Unicode nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ )
+ *pWidthArray = mnDefaultWidth;
+ }
+ else
+ {
+ // get per_char information from the xfontstruct
+ for ( sal_Unicode nIdx = nFrom; nIdx <= nTo; nIdx++, pWidthArray++ )
+ {
+ XCharStruct* pChar = GetCharinfo( pXFontStruct, nIdx );
+ *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth;
+ }
+ }
+
+ // return amount of handled chars
+ return nTo - nFrom + 1;
+}
+
+// handle non unicode fonts that are converted into encoding mathing the
+// font in fontstruct, 8 and 16 bit fonts are handled the same way
+sal_Size
+ExtendedFontStruct::GetCharWidth16( SalConverterCache *pCvt,
+ sal_Unicode nFrom, sal_Unicode nTo, long *pWidthArray )
+{
+ if ( !(nFrom <= nTo) )
+ return 0;
+
+ rtl_TextEncoding nEncoding = mpXlfd->GetAsciiEncoding();
+ XFontStruct *pXFontStruct = GetFontStruct( nEncoding );
+
+ if ( pXFontStruct == NULL )
+ return 0;
+
+ unsigned char pBuffer[16];
+ sal_MultiByte nChar;
+
+ for ( sal_Unicode nIdx = nFrom ; nIdx <= nTo ; nIdx++, pWidthArray++ )
+ {
+ Bool bValid;
+ FontPitch nSpacing;
+ sal_Size nSize;
+
+ // get a matching fontstruct
+ if ( bValid = GetFontStruct( nIdx, &nEncoding, &pXFontStruct, pCvt ) )
+ {
+ nSpacing = mpXlfd->GetSpacing( nEncoding );
+ nSize = ConvertStringUTF16( &nIdx, 1,
+ (sal_Char*)pBuffer, sizeof(pBuffer),
+ pCvt->GetU2TConverter(nEncoding) );
+ }
+
+ // query font metrics
+ if ( bValid && (nSize == 1 || nSize == 2) )
+ {
+ nChar = nSize == 1 ? (sal_MultiByte)pBuffer[0] :
+ ((sal_MultiByte)pBuffer[0] << 8) + (sal_MultiByte)pBuffer[1];
+
+ if ( nSpacing == PITCH_VARIABLE
+ && pXFontStruct->per_char == NULL)
+ {
+ // get per_char information from the x-server
+ *pWidthArray = QueryCharWidth16( mpDisplay, pXFontStruct->fid,
+ nChar, mnDefaultWidth );
+ }
+ else
+ if ( ( pXFontStruct->max_bounds.width
+ == pXFontStruct->min_bounds.width)
+ || (pXFontStruct->per_char == NULL) )
+ {
+ // fixed width font
+ *pWidthArray = pXFontStruct->min_bounds.width;
+ }
+ else
+ {
+ // get per_char information from the xfontstruct
+ XCharStruct* pChar = GetCharinfo( pXFontStruct, nChar );
+ *pWidthArray = CharExists(pChar) ? pChar->width : mnDefaultWidth;
+ }
+ }
+ else
+ {
+ // conversion error
+ *pWidthArray = mnDefaultWidth;
+ }
+ }
+
+ // return amount of handled chars
+ return nTo - nFrom + 1;
+}
+
+sal_Size
+ExtendedFontStruct::GetCharWidth( SalConverterCache *pCvt,
+ sal_Unicode nFrom, sal_Unicode nTo, long *pWidthArray )
+{
+ int nAsciiRange;
+ sal_Size nConverted = 0;
+
+ rtl_TextEncoding nEncoding = mpXlfd->GetAsciiEncoding(&nAsciiRange);
+
+ // dispatch querying of metrics to most promising encoding candidate
+ if ( nEncoding == RTL_TEXTENCODING_UNICODE )
+ {
+ // if we have a unicode encoded system font than we get the charwidth
+ // straight forward
+ nConverted = GetCharWidthUTF16( nFrom, nTo, pWidthArray );
+ }
+ else
+ {
+ if ( nFrom < nAsciiRange )
+ {
+ // optimize the most frequent case, requesting only the latin1
+ // chars which are mappable to a single encoding
+ nConverted = GetCharWidth8( nFrom, min(nAsciiRange, nTo),
+ pWidthArray, nEncoding );
+ }
+
+ // if further requests are pending, then the according unicode
+ // codepoint has to be dispatched to one of the system fonts and
+ // converted to this fonts encoding
+ nConverted += GetCharWidth16( pCvt, nFrom + nConverted, nTo,
+ pWidthArray + nConverted );
+ }
+
+ return nConverted;
+}
diff --git a/vcl/unx/source/gdi/xlfd_attr.cxx b/vcl/unx/source/gdi/xlfd_attr.cxx
new file mode 100644
index 000000000000..a5571d43311a
--- /dev/null
+++ b/vcl/unx/source/gdi/xlfd_attr.cxx
@@ -0,0 +1,655 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlfd_attr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <alloca.h>
+
+#ifndef XLFD_ATTRIBUTE_HXX
+#include "xlfd_attr.hxx"
+#endif
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+#ifndef _VCL_VCLENUM_HXX
+#include <vclenum.hxx>
+#endif
+
+// ---------------------------------------------------------------------------
+//
+//
+// Attribute is a container for simple name value pairs
+// eg. ( "times", FAMILY_ROMAN ) or ( "demi bold", WEIGHT_SEMIBOLD )
+// enriched with an annotation which is a pretty-printed version of the
+// string, i.e. "itc avant garde" would get an annotation of "Itc Avant Garde"
+//
+//
+// ---------------------------------------------------------------------------
+
+// release the stored string
+void
+Attribute::Release()
+{
+ if ( mpAnnotation != NULL )
+ delete mpAnnotation;
+ if ( mpName != NULL )
+ free( (void*)mpName );
+}
+
+// get a private copy of the given argument
+void
+Attribute::SetName( const char *p, int nLen )
+{
+ mpName = (char*)malloc( nLen + 1 );
+ mnLength = nLen;
+ memcpy( (void*)mpName, p, mnLength );
+ ((char*)mpName)[ mnLength ] = '\0';
+}
+
+// Compare whether two strings a equal for the first nLen bytes
+// i.e. arial == arialnarrow
+int
+Attribute::Compare( const char *p, int nLen )
+{
+ return strncmp( mpName, p, nLen );
+}
+
+// Compare two strings, they have to be equal for nLen bytes, after nLen
+// bytes both strings have to be terminated either by '\0' or by '-'
+// this is for comparing a string being a substring in a Xlfd with a
+// zeroterminated string
+Bool
+Attribute::ExactMatch( const char *p, int nLen )
+{
+ Bool bMatch;
+ if ( nLen > 0 )
+ bMatch = Compare( p, nLen ) == 0;
+ else
+ bMatch = True;
+ if ( bMatch )
+ {
+ char c1 = p[ nLen ];
+ char c2 = mpName[ nLen ];
+ bMatch = (c1 == '-' || c1 == '\0') && (c2 == '-' || c2 == '\0');
+ }
+
+ return bMatch;
+}
+
+void
+Attribute::TagFeature( unsigned short nFeature )
+{
+ if ( (nFeature & XLFD_FEATURE_NARROW)
+ && (strstr(mpName, "narrow") != NULL) )
+ {
+ mnFeature |= XLFD_FEATURE_NARROW;
+ }
+ if ( (nFeature & XLFD_FEATURE_OL_CURSOR)
+ && (strcmp(mpName, "open look cursor") == 0) )
+ {
+ mnFeature |= XLFD_FEATURE_OL_CURSOR;
+ }
+ if ( (nFeature & XLFD_FEATURE_OL_GLYPH)
+ && (strcmp(mpName, "open look glyph") == 0) )
+ {
+ mnFeature |= XLFD_FEATURE_OL_GLYPH;
+ }
+
+ if ( nFeature & XLFD_FEATURE_REDUNDANTSTYLE )
+ {
+ switch ( mpName[0] )
+ {
+ case '\0':
+ mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE;
+ break;
+
+ case 'b':
+ if ( (strcmp(mpName, "bold") == 0)
+ || (strcmp(mpName, "bold italic") == 0)
+ || (strcmp(mpName, "bold sans") == 0) )
+ mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE;
+ break;
+
+ case 'd':
+ if ( (strcmp(mpName, "demi") == 0)
+ || (strcmp(mpName, "demi italic") == 0) )
+ mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE;
+ break;
+
+ case 'i':
+ if ( strcmp(mpName, "italic") == 0 )
+ mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE;
+ break;
+
+ case 's':
+ if ( (strcmp(mpName, "sans") == 0)
+ || (strcmp(mpName, "serif") == 0) )
+ mnFeature |= XLFD_FEATURE_REDUNDANTSTYLE;
+ break;
+ }
+ }
+}
+
+// given Attribute classifications, strings have to be in alphabetical
+// order, since they are treated by binary search algorithm
+
+#define InitializeAttributeWith( p, a ) p, sizeof(p) - 1, a, 0, NULL
+#define MembersOf( p ) (sizeof(p) / sizeof(p[0]) )
+
+const Attribute pFamilyAttribute[] = {
+ { InitializeAttributeWith( "arial", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "arioso", FAMILY_SCRIPT ) },
+ { InitializeAttributeWith( "avant garde", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "avantgarde", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "bembo", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "bookman", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "conga", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "courier", FAMILY_MODERN ) },
+ { InitializeAttributeWith( "curl", FAMILY_SCRIPT ) },
+ { InitializeAttributeWith( "fixed", FAMILY_MODERN ) },
+ { InitializeAttributeWith( "gill", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "helmet", FAMILY_MODERN ) },
+ { InitializeAttributeWith( "helvetica", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "international", FAMILY_MODERN ) },
+ { InitializeAttributeWith( "lucida", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "new century schoolbook", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "palatino", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "roman", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "sans serif", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "sansserif", FAMILY_SWISS ) },
+ { InitializeAttributeWith( "serf", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "serif", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "times", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "utopia", FAMILY_ROMAN ) },
+ { InitializeAttributeWith( "zapf chancery", FAMILY_SCRIPT ) },
+ { InitializeAttributeWith( "zapfchancery", FAMILY_SCRIPT ) }
+};
+
+const Attribute pWeightAttribute[] = {
+ { InitializeAttributeWith( "black", WEIGHT_BLACK ) },
+ { InitializeAttributeWith( "bold", WEIGHT_BOLD ) },
+ { InitializeAttributeWith( "book", WEIGHT_LIGHT ) },
+ { InitializeAttributeWith( "demi", WEIGHT_SEMIBOLD ) },
+ { InitializeAttributeWith( "demi bold", WEIGHT_SEMIBOLD ) },
+ { InitializeAttributeWith( "demibold", WEIGHT_SEMIBOLD ) },
+ { InitializeAttributeWith( "light", WEIGHT_LIGHT ) },
+ { InitializeAttributeWith( "medium", WEIGHT_MEDIUM ) },
+ { InitializeAttributeWith( "normal", WEIGHT_NORMAL ) },
+ { InitializeAttributeWith( "regular", WEIGHT_NORMAL ) },
+ { InitializeAttributeWith( "roman", WEIGHT_NORMAL ) },
+ { InitializeAttributeWith( "semicondensed", WEIGHT_LIGHT ) },
+ { InitializeAttributeWith( "ultrabold", WEIGHT_ULTRABOLD ) }
+};
+
+const Attribute pSlantAttribute[] = {
+ { InitializeAttributeWith( "i", ITALIC_NORMAL ) },
+ { InitializeAttributeWith( "o", ITALIC_OBLIQUE ) },
+ { InitializeAttributeWith( "r", ITALIC_NONE ) }
+};
+
+const Attribute pSetwidthAttribute[] = {
+ { InitializeAttributeWith( "bold", WIDTH_SEMI_EXPANDED ) },
+ { InitializeAttributeWith( "condensed", WIDTH_CONDENSED ) },
+ { InitializeAttributeWith( "double wide", WIDTH_ULTRA_EXPANDED ) },
+ { InitializeAttributeWith( "expanded", WIDTH_EXPANDED ) },
+ { InitializeAttributeWith( "extracondensed", WIDTH_EXTRA_CONDENSED ) },
+ { InitializeAttributeWith( "extraexpanded", WIDTH_EXTRA_EXPANDED ) },
+ { InitializeAttributeWith( "medium", WIDTH_NORMAL ) },
+ { InitializeAttributeWith( "narrow", WIDTH_CONDENSED ) },
+ { InitializeAttributeWith( "normal", WIDTH_NORMAL ) },
+ { InitializeAttributeWith( "semicondensed", WIDTH_SEMI_CONDENSED ) },
+ { InitializeAttributeWith( "semiexpanded", WIDTH_SEMI_EXPANDED ) },
+ { InitializeAttributeWith( "ultracondensed", WIDTH_ULTRA_CONDENSED ) },
+ { InitializeAttributeWith( "ultraexpanded", WIDTH_ULTRA_EXPANDED ) },
+ { InitializeAttributeWith( "wide", WIDTH_EXPANDED ) }
+};
+
+const Attribute pEnhancedCharsetAttribute[] = {
+ { InitializeAttributeWith( "iso8859-1", RTL_TEXTENCODING_MS_1252 ) },
+ { InitializeAttributeWith( "iso8859_1", RTL_TEXTENCODING_MS_1252 ) }
+};
+
+// -------------------------------------------------------------------------
+//
+// String handling utility functions
+//
+// -------------------------------------------------------------------------
+
+
+void
+AppendAttribute( Attribute *pAttribute, ByteString &rString )
+{
+ if ( pAttribute == NULL )
+ return ;
+
+ int nLength = pAttribute->GetLength();
+ char *pBuffer = (char*)alloca( nLength + 1);
+
+ pBuffer[ 0 ] = '-';
+ memcpy( pBuffer + 1, pAttribute->GetName(), nLength );
+ rString.Append( pBuffer, nLength + 1);
+}
+
+//
+// Prettify the font name: make each leading character of a fontname
+// uppercase. For example
+// times new roman -> Times New Roman
+//
+
+static void
+ToUpper( char *pCharacter )
+{
+ // replace [a,z] with [A,Z]
+ if ( (*pCharacter >= 97) && (*pCharacter <= 122) )
+ *pCharacter -= 32;
+}
+
+static String*
+Capitalize( const char *pStr, int nLength )
+{
+ char *pCopy = (char*)alloca( nLength + 1 );
+ char *pPtr = pCopy;
+ memcpy( pPtr, pStr, nLength + 1 );
+
+ // loop over string data and uppercase first char and all chars
+ // following a space (other white space would be unexpected here)
+ char nPreviousChar = ' ';
+ while ( *pPtr )
+ {
+ if ( nPreviousChar == ' ' )
+ ToUpper( pPtr );
+ nPreviousChar = *pPtr++;
+ }
+
+ return new String( pCopy, RTL_TEXTENCODING_ISO_8859_1 );
+}
+
+String*
+AnnotateString( const Attribute& rAttribute )
+{
+ return Capitalize(rAttribute.GetName(), rAttribute.GetLength());
+}
+
+String*
+AnnotateSlant( const Attribute& rAttribute )
+{
+ const char* pStr = rAttribute.GetName();
+ int nLen = rAttribute.GetLength();
+
+ static const struct {
+ const char *pFrom; const char *pTo;
+ } pTranslation[] = {
+ { "r", "Roman" },
+ { "o", "Oblique" },
+ { "i", "Italic" },
+ { "ri", "Reverse Italic" },
+ { "ro", "Reverse Oblique" },
+ { "ot", "Other" }
+ };
+
+ for ( int i = 0; i < MembersOf(pTranslation); i++ )
+ if ( strcmp(pStr, pTranslation[i].pFrom) == 0 )
+ {
+ return new String( pTranslation[i].pTo,
+ RTL_TEXTENCODING_ISO_8859_1 );
+ }
+
+ return Capitalize(pStr, nLen);
+}
+
+String*
+AnnotateNone( const Attribute& rAttribute )
+{
+ return new String();
+}
+
+// ---------------------------------------------------------------------------
+//
+//
+// manage global lists of Attributes
+// since XListFonts does never list more than 64K fonts this storage does
+// handle array size and indices with unsigned short values for low
+// memory consumption
+//
+//
+// ---------------------------------------------------------------------------
+
+AttributeStorage::AttributeStorage( unsigned short nDefaultValue ) :
+ mpList( NULL ),
+ mnSize( 0 ),
+ mnCount( 0 ),
+ mnLastmatch( 0 ),
+ mnDefaultValue( nDefaultValue )
+{
+}
+
+AttributeStorage::~AttributeStorage()
+{
+ if ( mpList != NULL )
+ {
+ for ( int i = 0; i < mnCount; i++ )
+ mpList[i].Release();
+ free( mpList );
+ }
+}
+
+#ifdef DEBUG
+void
+AttributeStorage::Dump()
+{
+ fprintf(stderr, "AttributeStorage: size=%i, used=%i\n", mnSize, mnCount);
+ for ( int i = 0; i < mnCount; i++ )
+ {
+ ByteString aAnnotation = ByteString(
+ mpList[i].GetAnnotation(),
+ RTL_TEXTENCODING_ISO_8859_1 );
+ fprintf(stderr, "\t%4i: <%s><len=%i><val=%i><%s>\n", i, mpList[i].GetName(),
+ mpList[i].GetLength(), mpList[i].GetValue(),
+ aAnnotation.GetBuffer() );
+ }
+ fprintf(stderr, "\n");
+}
+#endif
+
+Attribute*
+AttributeStorage::Retrieve( unsigned short nIndex ) const
+{
+ return nIndex < mnCount ? &mpList[ nIndex ] : (Attribute*)NULL ;
+}
+
+// pClassification contains a list of name-value pairs. If names in
+// the AttributeStorage match those in the pClassification then
+// the according value is copied. Matching means match for the length
+// of the string in pClassification (i.e. arial matches arialnarrow)
+// the strings in pClassification must be in alphabetical order, all
+// strings Lowercase
+void
+AttributeStorage::AddClassification( Attribute *pClassification,
+ unsigned short nNum )
+{
+ for ( int i = 0; i < mnCount; i++ )
+ {
+ unsigned int nLower = 0;
+ unsigned int nUpper = nNum;
+ unsigned int nCurrent;
+ int nComparison;
+ Attribute *pHaystack, *pNeedle;
+
+ pNeedle = &mpList[ i ];
+
+ // binary search
+ while ( nLower < nUpper )
+ {
+ nCurrent = (nLower + nUpper) / 2;
+ pHaystack = &pClassification[ nCurrent ];
+ nComparison = pNeedle->Compare( pHaystack->GetName(),
+ pHaystack->GetLength() );
+ if (nComparison < 0)
+ nUpper = nCurrent;
+ else
+ if (nComparison > 0)
+ nLower = nCurrent + 1;
+ else
+ break;
+ }
+
+ // if there's a match store the according classification in the
+ // Attribute storage, otherwise do nothing since defaults are
+ // already provided in AttributeStorage::Insert()
+ if ( nComparison == 0 )
+ pNeedle->SetValue( pHaystack->GetValue() );
+ }
+}
+
+void
+AttributeStorage::AddClassification( AttributeClassifierT Classify )
+{
+ for ( int i = 0; i < mnCount; i++ )
+ {
+ Attribute& rCurrent = mpList[i] ;
+ int nValue = Classify( rCurrent.GetName() );
+ rCurrent.SetValue( nValue );
+ }
+}
+
+void
+AttributeStorage::AddAnnotation( AttributeAnnotatorT Annotate )
+{
+ for ( int i = 0; i < mnCount; i++ )
+ {
+ String* pAnnotation = Annotate( mpList[i] );
+ mpList[i].SetAnnotation( pAnnotation );
+ }
+}
+
+void
+AttributeStorage::TagFeature( unsigned short nFeature )
+{
+ for ( int i = 0; i < mnCount; i++ )
+ mpList[i].TagFeature( nFeature );
+}
+
+// Enlarge the list of Attributes
+void
+AttributeStorage::Enlarge()
+{
+ if ( mnSize == 0 )
+ {
+ mnSize = 8;
+ mpList = (Attribute*) malloc( mnSize * sizeof(Attribute) );
+ }
+ else
+ {
+ mnSize = mnSize < 32768 ? (mnSize * 2) : 65535;
+ mpList = (Attribute*) realloc( mpList, mnSize * sizeof(Attribute) );
+ }
+}
+
+// nLength is the length as it would be reported by strlen(3)
+// for an null-terminated string. if a string is part of a Xlfd
+// the field separator '-' is taken as '\0'
+// the AttributeStorage itself is NOT sorted to make sure that the
+// leased keys are still valid
+unsigned short
+AttributeStorage::Insert( const char *pString, int nLength )
+{
+ // check whether the last match is still equal to the current
+ // string since XListFonts lists fonts in sets of similar fontnames
+ if ( mnLastmatch < mnCount )
+ {
+ if ( mpList[mnLastmatch].ExactMatch(pString, nLength) )
+ return mnLastmatch;
+ }
+
+ // otherwise search in list
+ for ( int i = 0; i < mnCount; i++ )
+ {
+ if ( mpList[i].ExactMatch(pString, nLength) )
+ return mnLastmatch = i;
+ }
+
+ // if still not found we have to Insert the new string
+ if ( mnSize == mnCount )
+ Enlarge();
+ mpList[mnCount].SetName( pString, nLength );
+ mpList[mnCount].SetValue( mnDefaultValue );
+ mpList[mnCount].SetAnnotation( NULL );
+ mpList[mnCount].SetFeature( XLFD_FEATURE_NONE );
+ mnLastmatch = mnCount;
+ mnCount = mnCount < 65535 ? mnCount + 1 : mnCount;
+
+ return mnLastmatch;
+}
+
+
+// ---------------------------------------------------------------------------
+//
+//
+// Attribute provider is a frame for a set of AttributeStorages.
+//
+//
+// ---------------------------------------------------------------------------
+
+AttributeProvider::AttributeProvider( eDeviceT eOutputDevice ) :
+ meOutputDevice( eOutputDevice )
+{
+ mpField[eXLFDFoundry ] = new AttributeStorage(0);
+ mpField[eXLFDFamilyName ] = new AttributeStorage(FAMILY_DONTKNOW);
+ mpField[eXLFDWeightName ] = new AttributeStorage(WEIGHT_NORMAL);
+ mpField[eXLFDSlant ] = new AttributeStorage(ITALIC_NONE);
+ mpField[eXLFDSetwidthName] = new AttributeStorage(WIDTH_NORMAL);
+ mpField[eXLFDAddstyleName] = new AttributeStorage(RTL_TEXTENCODING_DONTKNOW);
+ mpField[eXLFDCharset ] = new AttributeStorage(RTL_TEXTENCODING_DONTKNOW);
+}
+
+AttributeProvider::~AttributeProvider()
+{
+ for ( int i = 0; i < eXLFDMaxEntry; i++ )
+ delete mpField[ i ];
+}
+
+#ifdef DEBUG
+void
+AttributeProvider::Dump()
+{
+ for ( int i = 0; i < eXLFDMaxEntry; i++ )
+ mpField[ i ]->Dump();
+}
+#endif
+
+extern "C" rtl_TextEncoding
+GetTextEncodingFromAddStylename( const sal_Char *pAddStylename )
+{
+ int nBufferLength = strlen( pAddStylename ) + 1;
+ sal_Char *pBuffer = (sal_Char*)alloca( nBufferLength );
+ for ( int i = 0; i < nBufferLength; i++ )
+ pBuffer[i] = pAddStylename[i] == '_' ? '-' : pAddStylename[i] ;
+
+ return rtl_getTextEncodingFromUnixCharset( pBuffer );
+}
+
+
+// classification information is needed before sorting because of course the
+// classification is the sort criteria
+void
+AttributeProvider::AddClassification()
+{
+ /* mpField[ eXLFDFoundry ] doesn't need classification */
+ mpField[ eXLFDFamilyName ]->AddClassification(
+ (Attribute*)pFamilyAttribute,
+ MembersOf(pFamilyAttribute) );
+ mpField[ eXLFDWeightName ]->AddClassification(
+ (Attribute*)pWeightAttribute,
+ MembersOf(pWeightAttribute) );
+ mpField[ eXLFDSlant ]->AddClassification(
+ (Attribute*)pSlantAttribute,
+ MembersOf(pSlantAttribute) );
+ mpField[ eXLFDSetwidthName ]->AddClassification(
+ (Attribute*)pSetwidthAttribute,
+ MembersOf(pSetwidthAttribute) );
+ mpField[ eXLFDAddstyleName ]->AddClassification(
+ GetTextEncodingFromAddStylename );
+ mpField[ eXLFDCharset ]->AddClassification(
+ rtl_getTextEncodingFromUnixCharset );
+
+ // Postscript Fonts usually have usefull glyphs in the area 128 - 160 these
+ // are not accessible through the latin1 encoding but through the
+ // ansi1252 encoding
+ if ( meOutputDevice == eDevicePrinter )
+ {
+ mpField[ eXLFDAddstyleName ]->AddClassification(
+ (Attribute*)pEnhancedCharsetAttribute,
+ MembersOf(pEnhancedCharsetAttribute) );
+ mpField[ eXLFDCharset ]->AddClassification(
+ (Attribute*)pEnhancedCharsetAttribute,
+ MembersOf(pEnhancedCharsetAttribute) );
+ }
+}
+
+// add some pretty print description
+void
+AttributeProvider::AddAnnotation()
+{
+ mpField[ eXLFDFoundry ]->AddAnnotation( AnnotateNone );
+ mpField[ eXLFDFamilyName ]->AddAnnotation( AnnotateString );
+ mpField[ eXLFDWeightName ]->AddAnnotation( AnnotateString );
+ mpField[ eXLFDSlant ]->AddAnnotation( AnnotateSlant );
+ mpField[ eXLFDSetwidthName ]->AddAnnotation( AnnotateString );
+ mpField[ eXLFDAddstyleName ]->AddAnnotation( AnnotateNone );
+ mpField[ eXLFDCharset ]->AddAnnotation( AnnotateNone );
+}
+
+// this is the misc or any section: dirty hacks for dirty xlfd usage
+void
+AttributeProvider::TagFeature()
+{
+ mpField[ eXLFDFamilyName ]->TagFeature(
+ XLFD_FEATURE_OL_GLYPH
+ | XLFD_FEATURE_OL_CURSOR
+ | XLFD_FEATURE_NARROW );
+
+ mpField[ eXLFDSetwidthName ]->TagFeature(
+ XLFD_FEATURE_NARROW );
+
+ mpField[ eXLFDAddstyleName ]->TagFeature(
+ XLFD_FEATURE_REDUNDANTSTYLE );
+}
+
diff --git a/vcl/unx/source/gdi/xlfd_attr.hxx b/vcl/unx/source/gdi/xlfd_attr.hxx
new file mode 100644
index 000000000000..a48da64c0c39
--- /dev/null
+++ b/vcl/unx/source/gdi/xlfd_attr.hxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlfd_attr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef XLFD_ATTRIBUTE_HXX
+#define XLFD_ATTRIBUTE_HXX
+
+#ifndef _SALUNX_H
+#include <salunx.h>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+
+struct Attribute {
+
+ const char* mpName;
+ unsigned short mnLength;
+ unsigned short mnValue;
+ unsigned short mnFeature;
+ String* mpAnnotation;
+
+ const char* GetName() const
+ { return mpName; }
+ unsigned short GetValue() const
+ { return mnValue; }
+ unsigned short GetLength() const
+ { return mnLength; }
+ Bool HasFeature( unsigned short nFeature ) const
+ { return ((mnFeature & nFeature) != 0); }
+ const String &GetAnnotation() const
+ { return *mpAnnotation; }
+
+ void SetName( const char *p, int nLen );
+ void SetValue( unsigned short nIn )
+ { mnValue = nIn; }
+ void SetAnnotation( String *pString )
+ { mpAnnotation = pString; }
+ void SetFeature( unsigned short nFeature )
+ { mnFeature = nFeature; }
+ void TagFeature( unsigned short nFeature );
+
+ int Compare( const char *p, int nLen );
+ Bool ExactMatch( const char *p, int nLen );
+ void Release();
+};
+
+
+void
+AppendAttribute( Attribute *pAttribute, ByteString &rString );
+
+
+typedef String*(*AttributeAnnotatorT)(const Attribute &rAttribute);
+extern "C" {
+typedef rtl_TextEncoding(*AttributeClassifierT)(const char* pStr);
+}
+
+#define XLFD_FEATURE_NONE 0x00
+#define XLFD_FEATURE_NARROW 0x01
+#define XLFD_FEATURE_OL_GLYPH 0x02
+#define XLFD_FEATURE_OL_CURSOR 0x04
+#define XLFD_FEATURE_REDUNDANTSTYLE 0x08
+
+// ---------------------------------------------------------------------------
+//
+//
+// manage global lists of Attributes
+// since XListFonts does never list more than 64K fonts this storage does
+// handle array size and indices with unsigned short values for low
+// memory consumption
+//
+//
+// ---------------------------------------------------------------------------
+
+class AttributeStorage {
+
+ private:
+
+ Attribute* mpList;
+ unsigned short mnSize;
+ unsigned short mnCount;
+ unsigned short mnLastmatch;
+ unsigned short mnDefaultValue;
+
+ void Enlarge();
+ AttributeStorage();
+
+ public:
+
+ AttributeStorage( unsigned short nDefaultValue );
+ ~AttributeStorage();
+ unsigned short Insert( const char *pString, int nLength );
+ Attribute* Retrieve( unsigned short nIndex ) const ;
+ void AddClassification( Attribute *pClassification,
+ unsigned short nNum );
+ void AddClassification( AttributeClassifierT Classify );
+ void TagFeature( unsigned short nFeature );
+ void AddAnnotation( AttributeAnnotatorT Annotate );
+ #ifdef DEBUG
+ void Dump();
+ #endif
+};
+
+
+// ---------------------------------------------------------------------------
+//
+//
+// Attribute provider is a frame for a set of AttributeStorages. For XLFD
+// interpretation and efficient storage, AttributeStorages for foundry,
+// family_name, weight_name, slant, setwidth_name, add_style_name and combined
+// charset_registry and charset_encoding are used. pixel_size, point_size,
+// resolution_x and resolution_y are stored as numbers. please note that this
+// does not allow storage of matrix-enhanced fonts. spacing is stored as
+// a char, since only the 'm', 'c' and 'p' types are defined.
+//
+//
+// ---------------------------------------------------------------------------
+
+typedef enum eXLFDAttributeT {
+ eXLFDFoundry = 0,
+ eXLFDFamilyName,
+ eXLFDWeightName,
+ eXLFDSlant,
+ eXLFDSetwidthName,
+ eXLFDAddstyleName,
+ eXLFDCharset,
+ eXLFDMaxEntry
+};
+
+typedef enum eDeviceT {
+ eDeviceDontKnow = 0,
+ eDevicePrinter,
+ eDeviceDisplay
+};
+
+class AttributeProvider {
+
+ private:
+
+ AttributeStorage* mpField[ eXLFDMaxEntry ];
+
+ AttributeStorage* GetField( eXLFDAttributeT eXLFDField )
+ { return mpField[ eXLFDField]; }
+ eDeviceT meOutputDevice;
+ public:
+
+ AttributeProvider( eDeviceT eOutputDevice );
+ ~AttributeProvider();
+
+ void AddClassification();
+ void AddAnnotation();
+ void TagFeature();
+ #ifdef DEBUG
+ void Dump();
+ #endif
+
+ eDeviceT GetDevice() const
+ { return meOutputDevice; }
+
+ // these are just shortcuts or proxies for the most common used
+ // AttributeStorage functionality
+ AttributeStorage* GetFoundry()
+ { return GetField(eXLFDFoundry); }
+ AttributeStorage* GetFamily()
+ { return GetField(eXLFDFamilyName); }
+ AttributeStorage* GetWeight()
+ { return GetField(eXLFDWeightName); }
+ AttributeStorage* GetSlant()
+ { return GetField(eXLFDSlant); }
+ AttributeStorage* GetSetwidth()
+ { return GetField(eXLFDSetwidthName); }
+ AttributeStorage* GetAddstyle()
+ { return GetField(eXLFDAddstyleName); }
+ AttributeStorage* GetCharset()
+ { return GetField(eXLFDCharset); }
+
+ Attribute* RetrieveFoundry( unsigned short nIndex )
+ { return GetFoundry()->Retrieve(nIndex); }
+ Attribute* RetrieveFamily( unsigned short nIndex )
+ { return GetFamily()->Retrieve(nIndex); }
+ Attribute* RetrieveWeight( unsigned short nIndex )
+ { return GetWeight()->Retrieve(nIndex); }
+ Attribute* RetrieveSlant( unsigned short nIndex )
+ { return GetSlant()->Retrieve(nIndex); }
+ Attribute* RetrieveSetwidth( unsigned short nIndex )
+ { return GetSetwidth()->Retrieve(nIndex); }
+ Attribute* RetrieveAddstyle( unsigned short nIndex )
+ { return GetAddstyle()->Retrieve(nIndex); }
+ Attribute* RetrieveCharset( unsigned short nIndex )
+ { return GetCharset()->Retrieve(nIndex); }
+
+ unsigned short InsertFoundry( const char *pString, int nLength )
+ { return GetFoundry()->Insert(pString, nLength); }
+ unsigned short InsertFamily( const char *pString, int nLength )
+ { return GetFamily()->Insert(pString, nLength); }
+ unsigned short InsertWeight( const char *pString, int nLength )
+ { return GetWeight()->Insert(pString, nLength); }
+ unsigned short InsertSlant( const char *pString, int nLength )
+ { return GetSlant()->Insert(pString, nLength); }
+ unsigned short InsertSetwidth( const char *pString, int nLength )
+ { return GetSetwidth()->Insert(pString, nLength);}
+ unsigned short InsertAddstyle( const char *pString, int nLength )
+ { return GetAddstyle()->Insert(pString, nLength);}
+ unsigned short InsertCharset( const char *pString, int nLength )
+ { return GetCharset()->Insert(pString, nLength); }
+};
+
+#endif /* XLFD_ATTRIBUTE_HXX */
+
diff --git a/vcl/unx/source/gdi/xlfd_extd.cxx b/vcl/unx/source/gdi/xlfd_extd.cxx
new file mode 100644
index 000000000000..2a8a65ccce53
--- /dev/null
+++ b/vcl/unx/source/gdi/xlfd_extd.cxx
@@ -0,0 +1,699 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlfd_extd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef XLFD_ATTRIBUTE_HXX
+#include "xlfd_attr.hxx"
+#endif
+#ifndef XLFD_SIMPLE_HXX
+#include "xlfd_smpl.hxx"
+#endif
+#ifndef XLFD_EXTENDED_HXX
+#include "xlfd_extd.hxx"
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+
+// --------------------------------------------------------------------------
+//
+// classes for Xlfd handling that contain more than a single encoding.
+// Members that may vary through different encodings are stored in
+// a mpEncodingInfo member. There are three different classes:
+// true scalable fonts (truetype and type1) scalable bitmap fonts
+// (the ugly ones) and bitmap fonts. The ExtendedXlfd stores all the members
+// that are specific to a font outline
+// ( e.g. adobe-times-roman-medium-r-normal- X -p- X )
+// and specifies the interface.
+//
+// --------------------------------------------------------------------------
+
+ExtendedXlfd::EncodingInfo&
+ExtendedXlfd::EncodingInfo::operator= ( const Xlfd *pXlfd )
+{
+ mcSpacing = pXlfd->mcSpacing;
+ mnResolutionX = pXlfd->mnResolutionX;
+ mnResolutionY = pXlfd->mnResolutionY;
+ mnAddstyle = pXlfd->mnAddstyle;
+ mnCharset = pXlfd->mnCharset;
+
+ mnEncoding = pXlfd->GetEncoding();
+
+ return *this;
+}
+
+// ------ base class --------------------------------------------------------
+
+ExtendedXlfd::ExtendedXlfd()
+{
+ mpEncodingInfo = NULL;
+ mnEncodings = 0;
+}
+
+ExtendedXlfd::~ExtendedXlfd()
+{
+ if ( mnEncodings != 0 )
+ free( mpEncodingInfo );
+}
+
+inline void*
+Realloc( void *pPtr, sal_Size nSize )
+{
+ return pPtr == NULL ? malloc( nSize ) : realloc( pPtr, nSize );
+}
+
+int
+ExtendedXlfd::GetEncodingIdx( rtl_TextEncoding nEncoding ) const
+{
+ for ( int i = 0; i < mnEncodings; i++ )
+ if ( nEncoding == mpEncodingInfo[i].mnEncoding )
+ return i;
+ return -1;
+}
+
+Bool
+ExtendedXlfd::HasEncoding( rtl_TextEncoding nEncoding ) const
+{
+ return !(GetEncodingIdx( nEncoding ) < 0) ;
+}
+
+rtl_TextEncoding
+ExtendedXlfd::GetEncoding( int i ) const
+{
+ if ( i < mnEncodings && i >= 0 )
+ return mpEncodingInfo[i].mnEncoding;
+
+ return RTL_TEXTENCODING_DONTKNOW;
+}
+
+rtl_TextEncoding
+ExtendedXlfd::GetEncoding() const
+{
+ return mnEncodings == 1 ? mpEncodingInfo[0].mnEncoding : RTL_TEXTENCODING_DONTKNOW;
+}
+
+// query the most unicode / Ascii compatible font: either one of the fonts
+// is utf16 encoded or there's a single byte font which is unicode
+// compatible for the first 256 chars (latin1) or for at least 128
+// chars (most latin-X encodings, cyrillic encodings)
+rtl_TextEncoding
+ExtendedXlfd::GetAsciiEncoding( int *pAsciiRange ) const
+{
+ rtl_TextEncoding nBestEncoding = RTL_TEXTENCODING_DONTKNOW;
+ int nLargestRange = 0x0000;
+
+ for ( int i = 0; i < mnEncodings && nLargestRange < 0xffff; i++ )
+ {
+ rtl_TextEncoding nCurEncoding = mpEncodingInfo[i].mnEncoding;
+ switch ( nCurEncoding )
+ {
+ case RTL_TEXTENCODING_UNICODE:
+ nLargestRange = 0xffff;
+ nBestEncoding = nCurEncoding;
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_1:
+ case RTL_TEXTENCODING_MS_1252:
+ nLargestRange = 0x00ff;
+ nBestEncoding = nCurEncoding;
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_2:
+ case RTL_TEXTENCODING_ISO_8859_4:
+ case RTL_TEXTENCODING_ISO_8859_5:
+ case RTL_TEXTENCODING_ISO_8859_6:
+ case RTL_TEXTENCODING_ISO_8859_7:
+ case RTL_TEXTENCODING_ISO_8859_8:
+ case RTL_TEXTENCODING_ISO_8859_9:
+ case RTL_TEXTENCODING_ISO_8859_13:
+ case RTL_TEXTENCODING_ISO_8859_15:
+ case RTL_TEXTENCODING_MS_1251:
+ case RTL_TEXTENCODING_KOI8_R:
+ case RTL_TEXTENCODING_JIS_X_0201:
+ if ( nLargestRange < 0x0080 )
+ {
+ nLargestRange = 0x0080;
+ nBestEncoding = nCurEncoding;
+ }
+ break;
+
+ default:
+ if ( nLargestRange == 0x0000 )
+ {
+ nBestEncoding = nCurEncoding;
+ }
+ break;
+ }
+ }
+
+ if ( pAsciiRange != NULL )
+ *pAsciiRange = nLargestRange;
+
+ return nBestEncoding;
+}
+
+Bool
+ExtendedXlfd::AddEncoding( const Xlfd *pXlfd )
+{
+ rtl_TextEncoding nEncoding = pXlfd->GetEncoding();
+
+ if ( HasEncoding(nEncoding) )
+ return False;
+
+ if ( mnEncodings == 0 )
+ {
+ // bootstrap
+ mnFoundry = pXlfd->mnFoundry;
+ mnFamily = pXlfd->mnFamily;
+ mnWeight = pXlfd->mnWeight;
+ mnSlant = pXlfd->mnSlant;
+ mnSetwidth = pXlfd->mnSetwidth;
+ mpFactory = pXlfd->mpFactory;
+ }
+
+ mpEncodingInfo = (EncodingInfo*)Realloc( mpEncodingInfo,
+ (mnEncodings + 1) * sizeof(EncodingInfo) );
+ mpEncodingInfo[ mnEncodings ] = pXlfd;
+ mnEncodings += 1;
+
+ return True;
+}
+
+void
+ExtendedXlfd::ToString( ByteString &rString,
+ unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const
+{
+ AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString );
+ AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString );
+ AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString );
+ AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString );
+ AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString );
+}
+
+// interface to the independent vcl class implfontdata
+// this must not be called if mnEncodings is zero
+void
+ExtendedXlfd::ToImplFontData( ImplFontData *pFontData ) const
+{
+ pFontData->mpSysData = (void*)this;
+
+ Attribute *pFamilyAttr = mpFactory->RetrieveFamily( mnFamily );
+ Attribute *pWeightAttr = mpFactory->RetrieveWeight( mnWeight );
+ Attribute *pWidthAttr = mpFactory->RetrieveSetwidth( mnSetwidth );
+ Attribute *pSlantAttr = mpFactory->RetrieveSlant( mnSlant );
+
+ pFontData->meFamily = GetFamily();
+ pFontData->meWeight = GetWeight();
+ pFontData->meItalic = GetItalic();
+ pFontData->meWidthType = GetWidth();
+
+ // family name
+ pFontData->maName = pFamilyAttr->GetAnnotation();
+
+ // the helvetica narrow hack
+ if ( ! pFamilyAttr->HasFeature(XLFD_FEATURE_NARROW)
+ && pWidthAttr->HasFeature(XLFD_FEATURE_NARROW) )
+ {
+ static const String aNarrow( RTL_CONSTASCII_USTRINGPARAM(" Narrow") );
+ pFontData->maName += aNarrow;
+ }
+
+ // stylename = weight + slant + width
+ // XXX Fix me: there may be a space missing between them
+ String aStyleName;
+ if ( pFontData->meWeight != WEIGHT_NORMAL )
+ aStyleName += pWeightAttr->GetAnnotation();
+ if ( pFontData->meItalic != ITALIC_NONE )
+ aStyleName += pSlantAttr->GetAnnotation();
+ if ( ( pFontData->meWidthType != WIDTH_NORMAL)
+ && (! pWidthAttr->HasFeature(XLFD_FEATURE_NARROW)) )
+ aStyleName += pWidthAttr->GetAnnotation();
+ pFontData->maStyleName = aStyleName;
+
+ pFontData->meCharSet = GetEncoding();
+ pFontData->mbOrientation = TRUE;
+
+ // printer resident font / downloadable
+ pFontData->mbDevice = TRUE;
+
+ // spacing
+ pFontData->mePitch = GetSpacing();
+
+}
+
+static FontPitch
+GetPitch( const char cSpacing )
+{
+ switch ( cSpacing )
+ {
+ case 'c':
+ case 'm': return PITCH_FIXED;
+ case 'p': return PITCH_VARIABLE;
+ default: return PITCH_DONTKNOW;
+ }
+}
+
+// you must not call any of the ExtendedXlfd::GetXXX() functions if the
+// ExtendedXlfd is really empty (i.e. mnEncodings is zero)
+
+FontPitch
+ExtendedXlfd::GetSpacing() const
+{
+ if ( mnEncodings > 0 )
+ return PITCH_VARIABLE;
+ if ( mnEncodings == 1 )
+ return GetPitch( mpEncodingInfo[0].mcSpacing );
+
+ return PITCH_DONTKNOW;
+}
+
+FontPitch
+ExtendedXlfd::GetSpacing( rtl_TextEncoding nEncoding ) const
+{
+ for ( int nIdx = 0; nIdx < mnEncodings; nIdx++ )
+ {
+ if ( mpEncodingInfo[nIdx].mnEncoding == nEncoding )
+ return GetPitch( mpEncodingInfo[nIdx].mcSpacing );
+ }
+ return PITCH_DONTKNOW;
+}
+
+FontFamily
+ExtendedXlfd::GetFamily() const
+{
+ Attribute *pFamilyAttr= mpFactory->RetrieveFamily(mnFamily);
+ return (FontFamily)pFamilyAttr->GetValue();
+}
+
+FontWeight
+ExtendedXlfd::GetWeight() const
+{
+ Attribute *pWeightAttr = mpFactory->RetrieveWeight(mnWeight);
+ return (FontWeight)pWeightAttr->GetValue();
+}
+
+FontItalic
+ExtendedXlfd::GetItalic() const
+{
+ Attribute *pSlantAttr = mpFactory->RetrieveSlant(mnSlant);
+ return (FontItalic)pSlantAttr->GetValue();
+}
+
+FontWidth
+ExtendedXlfd::GetWidth() const
+{
+ Attribute *pWidthAttr = mpFactory->RetrieveSetwidth(mnSetwidth);
+ return (FontWidth)pWidthAttr->GetValue();
+}
+
+#ifdef DEBUG
+void
+ExtendedXlfd::Dump() const
+{
+ for ( int i = 0; i < mnEncodings; i++ )
+ {
+ ByteString aString;
+ ToString( aString, 0, mpEncodingInfo[i].mnEncoding );
+ fprintf( stderr, "%s\n", aString.GetBuffer() );
+ }
+}
+#endif
+
+// ------ class to handle scalable bitmap fonts ------------------------------
+
+ScalableBitmapXlfd::ScalableBitmapXlfd()
+{
+}
+
+ScalableBitmapXlfd::~ScalableBitmapXlfd()
+{
+}
+
+void
+ScalableBitmapXlfd::ToString( ByteString &rString,
+ unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const
+{
+ int nIdx = GetEncodingIdx( nEncoding );
+ if ( nIdx < 0 )
+ return;
+
+ ExtendedXlfd::ToString( rString, nPixelSize, nEncoding );
+ EncodingInfo& rInfo = mpEncodingInfo[ nIdx ];
+
+ AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString );
+
+ rString += '-';
+ rString += ByteString::CreateFromInt32( nPixelSize );
+ rString += "-0-";
+ rString += ByteString::CreateFromInt32( rInfo.mnResolutionX );
+ rString += '-';
+ rString += ByteString::CreateFromInt32( rInfo.mnResolutionY );
+ rString += '-';
+ rString += rInfo.mcSpacing;
+ rString += "-0";
+
+ AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString );
+}
+
+void
+ScalableBitmapXlfd::ToImplFontData( ImplFontData *pFontData ) const
+{
+ ExtendedXlfd::ToImplFontData( pFontData );
+
+ pFontData->meType = TYPE_SCALABLE;
+ pFontData->mnWidth = 0;
+ pFontData->mnHeight = 0;
+ pFontData->mnQuality= 0;
+}
+
+// ------ class to handle true bitmap fonts ----------------------------------
+
+BitmapXlfd::BitmapXlfd( )
+{
+}
+
+BitmapXlfd::~BitmapXlfd( )
+{
+}
+
+Bool
+BitmapXlfd::AddEncoding( const Xlfd *pXlfd )
+{
+ if ( mnEncodings == 0 )
+ {
+ mnPixelSize = pXlfd->mnPixelSize;
+ mnPointSize = pXlfd->mnPointSize;
+ mnAverageWidth = pXlfd->mnAverageWidth;
+ }
+
+ return ExtendedXlfd::AddEncoding( pXlfd );
+}
+
+void
+BitmapXlfd::ToString( ByteString &rString,
+ unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const
+{
+ int nIdx = GetEncodingIdx( nEncoding );
+ if ( nIdx < 0 )
+ return;
+
+ ExtendedXlfd::ToString( rString, nPixelSize, nEncoding );
+ EncodingInfo& rInfo = mpEncodingInfo[ nIdx ];
+
+ AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString );
+
+ rString += '-';
+ rString += ByteString::CreateFromInt32( mnPixelSize );
+ rString += "-";
+ rString += ByteString::CreateFromInt32( mnPointSize );
+ rString += "-";
+ rString += ByteString::CreateFromInt32( rInfo.mnResolutionX );
+ rString += '-';
+ rString += ByteString::CreateFromInt32( rInfo.mnResolutionY );
+ rString += '-';
+ rString += rInfo.mcSpacing;
+ rString += '-';
+ rString += ByteString::CreateFromInt32( mnAverageWidth );
+
+ AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString );
+}
+
+void
+BitmapXlfd::ToImplFontData( ImplFontData *pFontData ) const
+{
+ ExtendedXlfd::ToImplFontData( pFontData );
+
+ pFontData->meType = TYPE_RASTER;
+ pFontData->mnWidth = 0;
+ pFontData->mnHeight = mnPixelSize;
+ pFontData->mnQuality= 256;
+}
+
+
+// ------ class to handle true scalable fonts --------------------------------
+
+ScalableXlfd::ScalableXlfd()
+{
+}
+
+ScalableXlfd::~ScalableXlfd()
+{
+}
+
+void
+ScalableXlfd::ToString( ByteString &rString,
+ unsigned short nPixelSize, rtl_TextEncoding nEncoding ) const
+{
+ int nIdx = GetEncodingIdx( nEncoding );
+ if ( nIdx < 0 )
+ return;
+
+ ExtendedXlfd::ToString( rString, nPixelSize, nEncoding);
+
+ EncodingInfo& rInfo = mpEncodingInfo[ nIdx ];
+ AppendAttribute( mpFactory->RetrieveAddstyle(rInfo.mnAddstyle), rString );
+
+ rString += '-';
+ rString += ByteString::CreateFromInt32( nPixelSize );
+ rString += "-0-0-0-";
+ rString += rInfo.mcSpacing;
+ rString += "-0";
+
+ AppendAttribute( mpFactory->RetrieveCharset(rInfo.mnCharset), rString );
+}
+
+void
+ScalableXlfd::ToImplFontData( ImplFontData *pFontData ) const
+{
+ ExtendedXlfd::ToImplFontData( pFontData );
+
+ pFontData->meType = TYPE_SCALABLE;
+ pFontData->mnWidth = 0;
+ pFontData->mnHeight = 0;
+ pFontData->mnQuality= 1024;
+}
+
+// ------ printer fonts ---------------------------------------------------
+
+PrinterFontXlfd::PrinterFontXlfd( )
+{
+}
+
+PrinterFontXlfd::~PrinterFontXlfd( )
+{
+}
+
+Bool
+PrinterFontXlfd::AddEncoding( const Xlfd *pXlfd )
+{
+ rtl_TextEncoding nEncoding = pXlfd->GetEncoding();
+ int nEncodingIdx = GetEncodingIdx( nEncoding );
+
+ if ( nEncodingIdx == -1 )
+ {
+ // the encoding is new, so add it anyway
+ return ExtendedXlfd::AddEncoding( pXlfd );
+ }
+ else
+ {
+ // we already have this encoding, check if we can replace
+ // a soft font with a builtin font
+ EncodingInfo& rInfo = mpEncodingInfo[ nEncodingIdx ];
+ XlfdFonttype nNewType, nOldType;
+
+ nOldType = rInfo.mnResolutionX == 0 && rInfo.mnResolutionY == 0 ?
+ eTypePrinterDownload : eTypePrinterBuiltIn;
+ nNewType = pXlfd->Fonttype();
+
+ if ( nOldType == eTypePrinterDownload
+ && nNewType == eTypePrinterBuiltIn )
+ {
+ mpEncodingInfo[ nEncodingIdx ] = pXlfd;
+ }
+ return True;
+ }
+
+ return False;
+}
+
+// ------ font list -------------------------------------------------------
+
+void
+XlfdStorage::Dispose()
+{
+ for ( int i = 0; i < mnCount; i++ )
+ delete mpList[i];
+ if ( mnSize != 0 )
+ delete mpList;
+
+ mnCount = 0;
+ mnSize = 0;
+ mpList = NULL;
+}
+
+void
+XlfdStorage::Reset()
+{
+ mnCount = 0;
+}
+
+XlfdStorage::~XlfdStorage()
+{
+ if ( mnSize != 0 )
+ delete mpList;
+}
+
+XlfdStorage::XlfdStorage() :
+ mnCount( 0 ),
+ mnSize( 0 ),
+ mpList( NULL )
+{
+}
+
+void
+XlfdStorage::Enlarge()
+{
+ if ( mnSize == 0 )
+ mnSize = 8;
+ else
+ mnSize = mnSize < 32768 ? (mnSize * 2) : 65535;
+
+ mpList = (const ExtendedXlfd**)Realloc(mpList, mnSize * sizeof(ExtendedXlfd*));
+}
+
+void
+XlfdStorage::Add( const ExtendedXlfd* pXlfd )
+{
+ if ( pXlfd == NULL )
+ return;
+
+ if ( mnCount >= mnSize )
+ Enlarge();
+ mpList[ mnCount++ ] = pXlfd;
+}
+
+void
+XlfdStorage::Add( const XlfdStorage* pXlfd )
+{
+ if ( pXlfd == NULL )
+ return;
+
+ if ( pXlfd->mnCount != 0 )
+ {
+ unsigned short nNeeded = mnCount + pXlfd->mnCount;
+ if ( mnSize <= nNeeded )
+ {
+ if ( mnSize == 0 )
+ mnSize = pXlfd->mnSize;
+ while ( mnSize <= nNeeded )
+ mnSize = mnSize < 32768 ? (mnSize * 2) : 65535;
+ mpList = (const ExtendedXlfd**)Realloc( mpList,
+ mnSize * sizeof(ExtendedXlfd*) );
+ }
+ memcpy( mpList + mnCount, pXlfd->mpList,
+ pXlfd->mnCount * sizeof(ExtendedXlfd*) );
+ mnCount += pXlfd->mnCount;
+ }
+}
+
+#ifdef DEBUG
+void
+XlfdStorage::Dump() const
+{
+ for ( int i = 0; i < mnCount; i++ )
+ {
+ mpList[i]->Dump();
+ fprintf(stderr, "\n" );
+ }
+}
+#endif
+
+const ExtendedXlfd*
+XlfdStorage::Get( int nIdx ) const
+{
+ return nIdx >= 0 && nIdx < mnCount ? mpList[nIdx] : NULL ;
+}
+
+// ------ bitmap font list --------------------------------------------------
+
+void
+BitmapXlfdStorage::AddBitmapFont( const Xlfd *pXlfd )
+{
+ if ( pXlfd == NULL )
+ return;
+
+ unsigned short nSize = pXlfd->mnPixelSize;
+
+ for ( int i = 0; i < mnCount; i++ )
+ if ( nSize == ((BitmapXlfd*)mpList[i])->GetPixelSize() )
+ {
+ const_cast<ExtendedXlfd*>(mpList[i])->AddEncoding( pXlfd );
+ return;
+ }
+ if ( mnCount >= mnSize )
+ Enlarge();
+ mpList[ mnCount ] = new BitmapXlfd();
+ const_cast<ExtendedXlfd*>(mpList[ mnCount ])->AddEncoding( pXlfd );
+ ++mnCount;
+}
+
diff --git a/vcl/unx/source/gdi/xlfd_extd.hxx b/vcl/unx/source/gdi/xlfd_extd.hxx
new file mode 100644
index 000000000000..96197177eb33
--- /dev/null
+++ b/vcl/unx/source/gdi/xlfd_extd.hxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlfd_extd.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef XLFD_EXTENDED_HXX
+#define XLFD_EXTENDED_HXX
+
+#ifndef _SALUNX_H
+#include <salunx.h>
+#endif
+#ifndef _VCL_VCLENUM_HXX
+#include <enum.hxx>
+#endif
+
+class Xlfd;
+class AttributeProvider;
+class ImplFontData;
+class ByteString;
+
+// --------------------------------------------------------------------------
+//
+// classes for Xlfd handling that contain more than a single encoding.
+// Members that may vary through different encodings are stored in
+// a mpEncodingInfo member. There are three different classes:
+// true scalable fonts (truetype and type1) scalable bitmap fonts
+// (the ugly ones) and bitmap fonts. The ExtendedXlfd stores all the members
+// that are specific to a font outline
+// ( e.g. adobe-times-roman-medium-r-normal- * -p- * )
+// and specifies the interface.
+//
+// --------------------------------------------------------------------------
+
+// base class
+
+class ExtendedXlfd {
+
+ public:
+ ExtendedXlfd();
+ virtual ~ExtendedXlfd();
+ virtual Bool AddEncoding( const Xlfd *pXlfd );
+ Bool HasEncoding( rtl_TextEncoding nEncoding ) const;
+ int GetEncodingIdx( rtl_TextEncoding nEncoding ) const;
+ unsigned short NumEncodings() const
+ { return mnEncodings; }
+ virtual void ToString( ByteString &rString,
+ unsigned short nPixelSize,
+ rtl_TextEncoding nEncoding ) const ;
+ virtual void ToImplFontData( ImplFontData *pFontData ) const ;
+ virtual FontType GetFontType() const
+ { return TYPE_DONTKNOW; }
+ FontFamily GetFamily() const;
+ FontWeight GetWeight() const;
+ FontItalic GetItalic() const;
+ FontWidth GetWidth() const;
+ virtual FontPitch GetSpacing() const;
+ virtual FontPitch GetSpacing( rtl_TextEncoding nEnc ) const;
+ rtl_TextEncoding GetAsciiEncoding( int *pAsciiRange = NULL ) const;
+ rtl_TextEncoding GetEncoding() const;
+ rtl_TextEncoding GetEncoding( int i ) const;
+
+ #ifdef DEBUG
+ void Dump() const;
+ #endif
+
+ protected:
+
+ AttributeProvider* mpFactory;
+
+ unsigned short mnFoundry;
+ unsigned short mnFamily;
+ unsigned short mnWeight;
+ unsigned short mnSlant;
+ unsigned short mnSetwidth;
+
+ unsigned short mnEncodings;
+ struct EncodingInfo {
+ unsigned char mcSpacing;
+ unsigned short mnResolutionX;
+ unsigned short mnResolutionY;
+ unsigned short mnAddstyle;
+ unsigned short mnCharset;
+
+ rtl_TextEncoding mnEncoding;
+
+ EncodingInfo& operator= ( const Xlfd *pXlfd );
+ } *mpEncodingInfo;
+};
+
+// class to handle scalable bitmap fonts
+
+class ScalableBitmapXlfd : public ExtendedXlfd {
+
+ public:
+ ScalableBitmapXlfd();
+ virtual ~ScalableBitmapXlfd();
+ virtual void ToString( ByteString &rString,
+ unsigned short nPixelSize,
+ rtl_TextEncoding nEncoding ) const;
+ virtual void ToImplFontData( ImplFontData *pFontData ) const;
+ virtual FontType GetFontType() const
+ { return TYPE_SCALABLE; }
+};
+
+// class to handle true bitmap fonts
+
+class BitmapXlfd : public ExtendedXlfd {
+
+ public:
+ BitmapXlfd();
+ ~BitmapXlfd();
+ Bool AddEncoding( const Xlfd *pXlfd );
+ unsigned short GetPixelSize() const
+ { return mnPixelSize; }
+ virtual void ToString( ByteString &rString,
+ unsigned short nPixelSize,
+ rtl_TextEncoding nEncoding ) const;
+ virtual void ToImplFontData( ImplFontData *pFontData ) const ;
+ virtual FontType GetFontType() const
+ { return TYPE_RASTER; }
+ protected:
+
+ unsigned short mnPixelSize;
+ unsigned short mnPointSize;
+ unsigned short mnAverageWidth;
+};
+
+// class to handle true scalable fonts
+
+class ScalableXlfd : public ExtendedXlfd {
+
+ public:
+ ScalableXlfd();
+ virtual ~ScalableXlfd();
+ virtual void ToString( ByteString &rString,
+ unsigned short nPixelSize,
+ rtl_TextEncoding nEncoding ) const;
+
+ virtual void ToImplFontData( ImplFontData *pFontData ) const ;
+ virtual FontType GetFontType() const
+ { return TYPE_SCALABLE; }
+};
+
+// class to handle printer resident and printer downloadable fonts
+// printer font xlfd look like scalable bitmap fonts but behave a
+// little bit different
+
+class PrinterFontXlfd : public ScalableBitmapXlfd {
+
+ public:
+ PrinterFontXlfd();
+ virtual ~PrinterFontXlfd();
+ virtual Bool AddEncoding( const Xlfd *pXlfd );
+};
+
+// class to maintain a list of fonts ( bitmap and scalable )
+
+class XlfdStorage {
+
+ public:
+ XlfdStorage();
+ ~XlfdStorage();
+
+ void Dispose();
+ void Reset();
+
+ void Add( const ExtendedXlfd *pXlfd );
+ void Add( const XlfdStorage *pXlfd );
+ unsigned short GetCount() const
+ { return mnCount; }
+ const ExtendedXlfd* Get(int nIdx) const;
+ #ifdef DEBUG
+ void Dump() const ;
+ #endif
+
+ protected:
+
+ void Enlarge();
+
+ unsigned short mnCount;
+ unsigned short mnSize;
+ const ExtendedXlfd**
+ mpList;
+};
+
+// list of fonts specific for bitmap fonts
+
+class BitmapXlfdStorage : public XlfdStorage {
+
+ public:
+
+ void AddBitmapFont( const Xlfd *pXlfd );
+};
+
+#endif /* XLFD_EXTENDED_HXX */
+
diff --git a/vcl/unx/source/gdi/xlfd_smpl.cxx b/vcl/unx/source/gdi/xlfd_smpl.cxx
new file mode 100644
index 000000000000..e2ef73f59747
--- /dev/null
+++ b/vcl/unx/source/gdi/xlfd_smpl.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlfd_smpl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#ifndef XLFD_ATTRIBUTE_HXX
+#include "xlfd_attr.hxx"
+#endif
+#ifndef XLFD_SIMPLE_HXX
+#include "xlfd_smpl.hxx"
+#endif
+
+// --------------------------------------------------------------------------
+//
+//
+// broken down structure equivalent to a Xlfd string
+//
+//
+// --------------------------------------------------------------------------
+
+Xlfd::Xlfd()
+{
+}
+
+// XlfdCompare abi has to be qsort(3) compatible, the sorting result must
+// guarantee that fonts with SameFontoutline() are successive
+// XlfdCompare relies on vFrom->mpFactory eq vTo->mpFactory. Since comparing
+// Xlfd's is done by comparing attributes there is no way around this.
+extern "C" int
+XlfdCompare( const void *vFrom, const void *vTo )
+{
+ const Xlfd *pFrom = (Xlfd*)vFrom;
+ const Xlfd *pTo = (Xlfd*)vTo;
+
+ // Compare outline description
+ if ( pFrom->mnFoundry != pTo->mnFoundry )
+ return (int)pFrom->mnFoundry - (int)pTo->mnFoundry;
+ if ( pFrom->mnFamily != pTo->mnFamily )
+ return (int)pFrom->mnFamily - (int)pTo->mnFamily;
+ if ( pFrom->mnWeight != pTo->mnWeight )
+ return (int)pFrom->mnWeight - (int)pTo->mnWeight;
+ if ( pFrom->mnSlant != pTo->mnSlant )
+ return (int)pFrom->mnSlant - (int)pTo->mnSlant;
+ if ( pFrom->mnSetwidth != pTo->mnSetwidth )
+ return (int)pFrom->mnSetwidth - (int)pTo->mnSetwidth;
+
+ // Addstyle name is futile tricky. it may contain encoding information
+ // (like "ansi_1251") which Compares equal, or it may contain style
+ // information (like "serif") which Compares unequal
+ if ( pFrom->mnAddstyle == pTo->mnAddstyle )
+ return 0;
+
+ AttributeProvider *pFactory = pFrom->mpFactory;
+ Attribute *pFromAttr = pFactory->RetrieveAddstyle( pFrom->mnAddstyle );
+ Attribute *pToAttr = pFactory->RetrieveAddstyle( pTo->mnAddstyle );
+
+ // if both addstyles denote encodings or if one denotes an
+ // encoding and the other denotes a style which really
+ // duplicates weight and slant information
+
+ int nFromCompare = (pFromAttr->GetValue() != RTL_TEXTENCODING_DONTKNOW)
+ || (pFromAttr->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ?
+ -1 : pFrom->mnAddstyle;
+ int nToCompare = (pToAttr->GetValue() != RTL_TEXTENCODING_DONTKNOW)
+ || (pToAttr->HasFeature(XLFD_FEATURE_REDUNDANTSTYLE)) ?
+ -1 : pTo->mnAddstyle;
+
+ return nFromCompare - nToCompare;
+}
+
+// check whether two fonts are identical as appearance is concerned
+// this does not Compare the actual scaling of two fonts
+Bool
+Xlfd::SameFontoutline( const Xlfd* pComparedTo ) const
+{
+ void* pThis = (void*)this;
+ return XlfdCompare( (void*)pThis, (void*)pComparedTo ) == 0 ;
+}
+
+unsigned short
+Xlfd::GetEncoding() const
+{
+ Attribute *pAddstyle = mpFactory->RetrieveAddstyle( mnAddstyle );
+ if ( pAddstyle->GetValue() != RTL_TEXTENCODING_DONTKNOW )
+ return pAddstyle->GetValue();
+
+ Attribute *pEncoding = mpFactory->RetrieveCharset( mnCharset );
+ return pEncoding->GetValue();
+}
+
+XlfdFonttype
+Xlfd::Fonttype() const
+{
+ if ( (mnAverageWidth == 0) && (mnPixelSize == 0) && (mnPointSize == 0) )
+ {
+ if ( (mnResolutionX == 0) && (mnResolutionY == 0) )
+ return mpFactory->GetDevice() == eDevicePrinter ?
+ eTypePrinterDownload : eTypeScalable;
+ else
+ return mpFactory->GetDevice() == eDevicePrinter ?
+ eTypePrinterBuiltIn : eTypeScalableBitmap;
+ }
+
+ return mpFactory->GetDevice() == eDevicePrinter ?
+ eTypeUnknown : eTypeBitmap;
+}
+
+void
+Advance( const char** pFrom, const char** pTo )
+{
+ const char *pTmp = *pTo;
+
+ for( ; (*pTmp != '\0') && (*pTmp++ != '-'); )
+ {}
+ *pFrom = *pTo;
+ *pTo = pTmp;
+}
+
+// this is the real workhorse function. Since this is called for every font
+// in the fontpath it has to be as fast a possible
+Bool
+Xlfd::FromString( const char* pXlfdstring, AttributeProvider *pFactory )
+{
+ mpFactory = pFactory;
+
+ const char* pTo;
+ const char* pFrom;
+
+ pFrom = pXlfdstring;
+ // first char must be '-'
+ if(*pFrom++ != '-')
+ return False;
+
+ pTo = pFrom;
+
+ Advance( &pFrom, &pTo ); //-foundry-*
+ mnFoundry = mpFactory->InsertFoundry( pFrom, pTo - pFrom - 1 );
+
+ Advance( &pFrom, &pTo ); // -*-family-*
+ mnFamily = mpFactory->InsertFamily( pFrom, pTo - pFrom - 1 );
+
+ Advance( &pFrom, &pTo ); // -*-*-weight-*
+ mnWeight = mpFactory->InsertWeight( pFrom, pTo - pFrom - 1 );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-slant-*
+ mnSlant = mpFactory->InsertSlant( pFrom, pTo - pFrom - 1 );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-setwidth-*
+ mnSetwidth = mpFactory->InsertSetwidth( pFrom, pTo - pFrom - 1 );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-Addstyle-*
+ mnAddstyle = mpFactory->InsertAddstyle( pFrom, pTo - pFrom - 1 );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-height-*
+ mnPixelSize = atoi( pFrom );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-pt height-*
+ mnPointSize = atoi( pFrom );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-x resolution-*
+ mnResolutionX = atoi( pFrom );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-y resolution-*
+ mnResolutionY = atoi( pFrom );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-spacing-*
+ mcSpacing = pFrom == pTo ? '\0' : *pFrom;
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-average-*
+ mnAverageWidth = atoi( pFrom );
+
+ Advance( &pFrom, &pTo ); //-*-*-*-*-*-*-*-*-*-*-*-*-registry-encoding
+ const char* pTmp = pFrom;
+ Advance( &pTmp, &pTo );
+ mnCharset = mpFactory->InsertCharset( pFrom, pTo - pFrom );
+
+ // sanity check whether we have really found a valid XLFD, if not
+ // throw away the whole font, since we have no idea what parts of
+ // the XLFD contains the error.
+ if ( !(pTo > pFrom) )
+ return False;
+
+ // a non-empty family name is essential, since otherwise the font
+ // would match the "default font" #52299#
+ Attribute* pFamily = mpFactory->RetrieveFamily( mnFamily );
+ const char* pFamilyName = pFamily->GetName();
+ if ( pFamilyName[0] == '\0' )
+ return False;
+
+ // well done
+ return True;
+}
+
+#ifdef DEBUG
+// pure debug for now: this is only to inspect/pretty print a Xlfd struct
+const char*
+Xlfd::ToString( ByteString &rString ) const
+{
+ AppendAttribute( mpFactory->RetrieveFoundry(mnFoundry), rString );
+ AppendAttribute( mpFactory->RetrieveFamily(mnFamily), rString );
+ AppendAttribute( mpFactory->RetrieveWeight(mnWeight), rString );
+ AppendAttribute( mpFactory->RetrieveSlant(mnSlant), rString );
+ AppendAttribute( mpFactory->RetrieveSetwidth(mnSetwidth), rString );
+ AppendAttribute( mpFactory->RetrieveAddstyle(mnAddstyle), rString );
+
+ rString += '-'; rString += ByteString::CreateFromInt32( mnPixelSize );
+ rString += '-'; rString += ByteString::CreateFromInt32( mnPointSize );
+ rString += '-'; rString += ByteString::CreateFromInt32( mnResolutionX );
+ rString += '-'; rString += ByteString::CreateFromInt32( mnResolutionY );
+ rString += '-'; rString += mcSpacing;
+ rString += '-'; rString += ByteString::CreateFromInt32( mnAverageWidth );
+
+ AppendAttribute( mpFactory->RetrieveCharset(mnCharset), rString );
+
+ return rString.GetBuffer() ;
+}
+
+void
+Xlfd::Dump() const
+{
+ ByteString aString;
+ fprintf(stderr, "Xlfd: %s\n", ToString(aString) );
+}
+#endif
+
diff --git a/vcl/unx/source/gdi/xlfd_smpl.hxx b/vcl/unx/source/gdi/xlfd_smpl.hxx
new file mode 100644
index 000000000000..923f542d3d15
--- /dev/null
+++ b/vcl/unx/source/gdi/xlfd_smpl.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlfd_smpl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef XLFD_SIMPLE_HXX
+#define XLFD_SIMPLE_HXX
+
+#ifndef _SALUNX_H
+#include <salunx.h>
+#endif
+#ifndef _VCL_VCLENUM_HXX
+#include <vclenum.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+
+class AttributeProvider;
+
+// --------------------------------------------------------------------------
+//
+//
+// broken down structure equivalent to a Xlfd string
+//
+//
+// --------------------------------------------------------------------------
+
+enum XlfdFonttype {
+ eTypeUnknown = TYPE_DONTKNOW,
+ eTypeBitmap = TYPE_RASTER,
+ eTypeScalableBitmap = TYPE_VECTOR,
+ eTypeScalable = TYPE_SCALABLE,
+ eTypePrinterBuiltIn,
+ eTypePrinterDownload
+};
+
+class Xlfd {
+
+ public:
+
+ unsigned short mnFoundry;
+ unsigned short mnFamily;
+ unsigned short mnWeight;
+ unsigned short mnSlant;
+ unsigned short mnSetwidth;
+ unsigned short mnAddstyle;
+ unsigned short mnPixelSize;
+ unsigned short mnPointSize;
+ unsigned short mnResolutionX;
+ unsigned short mnResolutionY;
+ unsigned char mcSpacing;
+ unsigned short mnAverageWidth;
+ unsigned short mnCharset;
+
+ // all foundry, family, weight ... information referres
+ // to this factory
+ AttributeProvider *mpFactory;
+
+ public:
+ Xlfd();
+ Bool FromString( const char* pXlfdstring,
+ AttributeProvider *pFactory );
+ Bool SameFontoutline( const Xlfd *pComparedTo ) const ;
+ XlfdFonttype Fonttype() const ;
+ unsigned short GetEncoding() const ;
+ #ifdef DEBUG
+ const char* ToString( ByteString &rString ) const ;
+ void Dump() const;
+ #endif
+};
+
+extern "C" int
+XlfdCompare( const void *vFrom, const void *vTo );
+
+#endif /* XLFD_SIMPLE_HXX */
+
diff --git a/vcl/unx/source/inc/airbrush_curs.h b/vcl/unx/source/inc/airbrush_curs.h
new file mode 100644
index 000000000000..0cee6ff80441
--- /dev/null
+++ b/vcl/unx/source/inc/airbrush_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: airbrush_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define airbrush_curs_width 32
+#define airbrush_curs_height 32
+#define airbrush_curs_x_hot 5
+#define airbrush_curs_y_hot 22
+static char airbrush_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
+ 0x7c,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x1f,0x00,0x00,0x98,0x0f,0x00,0x00,
+ 0xcc,0x07,0x00,0x00,0xb4,0x03,0x00,0x00,0x10,0x01,0x00,0x00,0x88,0x00,0x00,
+ 0x00,0x44,0x00,0x00,0x00,0x62,0x60,0x00,0x00,0x91,0x10,0x00,0x80,0x88,0x10,
+ 0x00,0x40,0x04,0x09,0x00,0x40,0x02,0x06,0x00,0xa0,0x01,0x00,0x00,0x60,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/airbrush_mask.h b/vcl/unx/source/inc/airbrush_mask.h
new file mode 100644
index 000000000000..3192d0ec2a74
--- /dev/null
+++ b/vcl/unx/source/inc/airbrush_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: airbrush_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define airbrush_mask_width 32
+#define airbrush_mask_height 32
+#define airbrush_mask_x_hot 5
+#define airbrush_mask_y_hot 22
+static char airbrush_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
+ 0x7c,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x1f,0x00,0x00,0x98,0x0f,0x00,0x00,
+ 0xcc,0x07,0x00,0x00,0xf4,0x03,0x00,0x00,0xf0,0x01,0x00,0x00,0xf8,0x00,0x00,
+ 0x00,0x7c,0x00,0x00,0x00,0x7e,0x60,0x00,0x00,0x9f,0x10,0x00,0x80,0x8f,0x10,
+ 0x00,0xc0,0x07,0x09,0x00,0xc0,0x03,0x06,0x00,0xe0,0x01,0x00,0x00,0x60,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/ase_curs.h b/vcl/unx/source/inc/ase_curs.h
new file mode 100644
index 000000000000..71387399b3c2
--- /dev/null
+++ b/vcl/unx/source/inc/ase_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: ase_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define ase_curs_width 32
+#define ase_curs_height 32
+#define ase_curs_x_hot 19
+#define ase_curs_y_hot 16
+static char ase_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x1c,0x0e,
+ 0x00,0x00,0x3e,0x1e,0x00,0x00,0x3e,0x7e,0x00,0x00,0x3e,0x1e,0x00,0x00,0x1c,
+ 0x0e,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/ase_mask.h b/vcl/unx/source/inc/ase_mask.h
new file mode 100644
index 000000000000..bdd084127371
--- /dev/null
+++ b/vcl/unx/source/inc/ase_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: ase_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define ase_mask_width 32
+#define ase_mask_height 32
+#define ase_mask_x_hot 19
+#define ase_mask_y_hot 16
+static char ase_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x9c,0x0f,0x00,0x00,0x3e,0x1f,
+ 0x00,0x00,0x7f,0x7f,0x00,0x00,0x7f,0xff,0x00,0x00,0x7f,0x7f,0x00,0x00,0x3e,
+ 0x1f,0x00,0x00,0x9c,0x0f,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asn_curs.h b/vcl/unx/source/inc/asn_curs.h
new file mode 100644
index 000000000000..c81b50f0bbee
--- /dev/null
+++ b/vcl/unx/source/inc/asn_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asn_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asn_curs_width 32
+#define asn_curs_height 32
+#define asn_curs_x_hot 16
+#define asn_curs_y_hot 12
+static char asn_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x03,
+ 0x00,0x00,0xc0,0x07,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x0f,0x00,0x00,0x20,
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x03,0x00,0x00,
+ 0xc0,0x07,0x00,0x00,0xc0,0x07,0x00,0x00,0xc0,0x07,0x00,0x00,0x80,0x03,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asn_mask.h b/vcl/unx/source/inc/asn_mask.h
new file mode 100644
index 000000000000..a711a43aced6
--- /dev/null
+++ b/vcl/unx/source/inc/asn_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asn_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asn_mask_width 32
+#define asn_mask_height 32
+#define asn_mask_x_hot 16
+#define asn_mask_y_hot 12
+static char asn_mask_bits[] = {
+ 0x00,0x00,0x01,0x00,0x00,0x80,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,
+ 0x00,0x00,0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0xf0,0x1f,0x00,0x00,0xf0,
+ 0x1f,0x00,0x00,0x20,0x08,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00,
+ 0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0xe0,0x0f,0x00,0x00,0xc0,0x07,0x00,
+ 0x00,0x80,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asne_curs.h b/vcl/unx/source/inc/asne_curs.h
new file mode 100644
index 000000000000..2463803a8fb7
--- /dev/null
+++ b/vcl/unx/source/inc/asne_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asne_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asne_curs_width 32
+#define asne_curs_height 32
+#define asne_curs_x_hot 21
+#define asne_curs_y_hot 10
+static char asne_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x80,
+ 0x3f,0x00,0x00,0xc0,0x3f,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x1c,0x00,0x00,
+ 0x00,0x1c,0x00,0x00,0x70,0x18,0x00,0x00,0xf8,0x08,0x00,0x00,0xf8,0x00,0x00,
+ 0x00,0xf8,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asne_mask.h b/vcl/unx/source/inc/asne_mask.h
new file mode 100644
index 000000000000..1d59c3009dec
--- /dev/null
+++ b/vcl/unx/source/inc/asne_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asne_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asne_mask_width 32
+#define asne_mask_height 32
+#define asne_mask_x_hot 21
+#define asne_mask_y_hot 10
+static char asne_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x80,0x7f,0x00,0x00,0xc0,
+ 0x7f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xc0,0x7f,0x00,0x00,0x00,0x3f,0x00,0x00,
+ 0x70,0x3e,0x00,0x00,0xf8,0x3c,0x00,0x00,0xfc,0x1d,0x00,0x00,0xfc,0x09,0x00,
+ 0x00,0xfc,0x01,0x00,0x00,0xf8,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asns_curs.h b/vcl/unx/source/inc/asns_curs.h
new file mode 100644
index 000000000000..9b459efc1dee
--- /dev/null
+++ b/vcl/unx/source/inc/asns_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asns_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asns_curs_width 32
+#define asns_curs_height 32
+#define asns_curs_x_hot 15
+#define asns_curs_y_hot 15
+static char asns_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,
+ 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,0x00,0x10,0x04,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,
+ 0x00,0xe0,0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,
+ 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asns_mask.h b/vcl/unx/source/inc/asns_mask.h
new file mode 100644
index 000000000000..377687fdf2b2
--- /dev/null
+++ b/vcl/unx/source/inc/asns_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asns_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asns_mask_width 32
+#define asns_mask_height 32
+#define asns_mask_x_hot 15
+#define asns_mask_y_hot 15
+static char asns_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+ 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,
+ 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00,
+ 0x10,0x04,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,
+ 0x00,0xf0,0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,
+ 0x00,0x00,0x10,0x04,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf0,
+ 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,
+ 0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asnswe_curs.h b/vcl/unx/source/inc/asnswe_curs.h
new file mode 100644
index 000000000000..e6c871fed4e5
--- /dev/null
+++ b/vcl/unx/source/inc/asnswe_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asnswe_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asnswe_curs_width 32
+#define asnswe_curs_height 32
+#define asnswe_curs_x_hot 15
+#define asnswe_curs_y_hot 15
+static char asnswe_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,
+ 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,0x00,0x00,0x10,0x04,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x06,0x30,0x00,0x80,0xc3,0xe1,0x00,0xc0,0xe3,0xe3,0x01,
+ 0xf0,0xe3,0xe3,0x07,0xc0,0xe3,0xe3,0x01,0x80,0xc3,0xe1,0x00,0x00,0x06,0x30,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,
+ 0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asnswe_mask.h b/vcl/unx/source/inc/asnswe_mask.h
new file mode 100644
index 000000000000..22c910a1a9a7
--- /dev/null
+++ b/vcl/unx/source/inc/asnswe_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asnswe_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asnswe_mask_width 32
+#define asnswe_mask_height 32
+#define asnswe_mask_x_hot 15
+#define asnswe_mask_y_hot 15
+static char asnswe_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+ 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,
+ 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00,
+ 0x16,0x34,0x00,0x80,0xcf,0xf9,0x00,0xc0,0xe7,0xf3,0x01,0xf0,0xf7,0xf7,0x07,
+ 0xf8,0xf7,0xf7,0x0f,0xf0,0xf7,0xf7,0x07,0xc0,0xe7,0xf3,0x01,0x80,0xcf,0xf9,
+ 0x00,0x00,0x16,0x34,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf0,
+ 0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,
+ 0xc0,0x01,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asnw_curs.h b/vcl/unx/source/inc/asnw_curs.h
new file mode 100644
index 000000000000..9961547d6378
--- /dev/null
+++ b/vcl/unx/source/inc/asnw_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asnw_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asnw_curs_width 32
+#define asnw_curs_height 32
+#define asnw_curs_x_hot 10
+#define asnw_curs_y_hot 10
+static char asnw_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0xfc,0x01,0x00,
+ 0x00,0xfc,0x03,0x00,0x00,0xfc,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,
+ 0x00,0x00,0x18,0x0e,0x00,0x00,0x10,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,
+ 0x1f,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asnw_mask.h b/vcl/unx/source/inc/asnw_mask.h
new file mode 100644
index 000000000000..b824f9287e58
--- /dev/null
+++ b/vcl/unx/source/inc/asnw_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asnw_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asnw_mask_width 32
+#define asnw_mask_height 32
+#define asnw_mask_x_hot 10
+#define asnw_mask_y_hot 10
+static char asnw_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0xfe,0x01,0x00,0x00,0xfe,0x03,0x00,
+ 0x00,0xfe,0x07,0x00,0x00,0xfe,0x03,0x00,0x00,0xfc,0x00,0x00,0x00,0x7c,0x0e,
+ 0x00,0x00,0x3c,0x1f,0x00,0x00,0xb8,0x3f,0x00,0x00,0x90,0x3f,0x00,0x00,0x80,
+ 0x3f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/ass_curs.h b/vcl/unx/source/inc/ass_curs.h
new file mode 100644
index 000000000000..47da8c925589
--- /dev/null
+++ b/vcl/unx/source/inc/ass_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: ass_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define ass_curs_width 32
+#define ass_curs_height 32
+#define ass_curs_x_hot 15
+#define ass_curs_y_hot 19
+static char ass_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,
+ 0x00,0x00,0xe0,0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x04,0x00,0x00,0xf0,0x07,0x00,0x00,
+ 0xe0,0x03,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00,
+ 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/ass_mask.h b/vcl/unx/source/inc/ass_mask.h
new file mode 100644
index 000000000000..951e8dd72c88
--- /dev/null
+++ b/vcl/unx/source/inc/ass_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: ass_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define ass_mask_width 32
+#define ass_mask_height 32
+#define ass_mask_x_hot 15
+#define ass_mask_y_hot 19
+static char ass_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xe0,0x03,0x00,0x00,0xf0,0x07,
+ 0x00,0x00,0xf0,0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,
+ 0x01,0x00,0x00,0x10,0x04,0x00,0x00,0xf8,0x0f,0x00,0x00,0xf8,0x0f,0x00,0x00,
+ 0xf0,0x07,0x00,0x00,0xf0,0x07,0x00,0x00,0xe0,0x03,0x00,0x00,0xc0,0x01,0x00,
+ 0x00,0xc0,0x01,0x00,0x00,0x80,0x00,0x00};
diff --git a/vcl/unx/source/inc/asse_curs.h b/vcl/unx/source/inc/asse_curs.h
new file mode 100644
index 000000000000..763756e8c833
--- /dev/null
+++ b/vcl/unx/source/inc/asse_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asse_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asse_curs_width 32
+#define asse_curs_height 32
+#define asse_curs_x_hot 21
+#define asse_curs_y_hot 21
+static char asse_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x70,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,
+ 0xf8,0x08,0x00,0x00,0x70,0x18,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1c,0x00,
+ 0x00,0x00,0x3f,0x00,0x00,0xc0,0x3f,0x00,0x00,0x80,0x3f,0x00,0x00,0x00,0x3c,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asse_mask.h b/vcl/unx/source/inc/asse_mask.h
new file mode 100644
index 000000000000..3e80ed64250c
--- /dev/null
+++ b/vcl/unx/source/inc/asse_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asse_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asse_mask_width 32
+#define asse_mask_height 32
+#define asse_mask_x_hot 21
+#define asse_mask_y_hot 21
+static char asse_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,
+ 0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0xfc,0x01,0x00,0x00,0xfc,0x09,0x00,0x00,
+ 0xfc,0x1d,0x00,0x00,0xf8,0x3c,0x00,0x00,0x70,0x3e,0x00,0x00,0x00,0x3f,0x00,
+ 0x00,0xc0,0x7f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xc0,0x7f,0x00,0x00,0x80,0x7f,
+ 0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/assw_curs.h b/vcl/unx/source/inc/assw_curs.h
new file mode 100644
index 000000000000..7ee6d3bf02e3
--- /dev/null
+++ b/vcl/unx/source/inc/assw_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: assw_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define assw_curs_width 32
+#define assw_curs_height 32
+#define assw_curs_x_hot 21
+#define assw_curs_y_hot 21
+static char assw_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x0e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x10,0x1f,
+ 0x00,0x00,0x18,0x0e,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xfc,
+ 0x00,0x00,0x00,0xfc,0x03,0x00,0x00,0xfc,0x01,0x00,0x00,0x3c,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/assw_mask.h b/vcl/unx/source/inc/assw_mask.h
new file mode 100644
index 000000000000..4f184f717cd1
--- /dev/null
+++ b/vcl/unx/source/inc/assw_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: assw_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define assw_mask_width 32
+#define assw_mask_height 32
+#define assw_mask_x_hot 21
+#define assw_mask_y_hot 21
+static char assw_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x0e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x10,0x1f,
+ 0x00,0x00,0x18,0x0e,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0xfc,
+ 0x00,0x00,0x00,0xfc,0x03,0x00,0x00,0xfc,0x01,0x00,0x00,0x3c,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asw_curs.h b/vcl/unx/source/inc/asw_curs.h
new file mode 100644
index 000000000000..33c77e76fb6e
--- /dev/null
+++ b/vcl/unx/source/inc/asw_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asw_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asw_curs_width 32
+#define asw_curs_height 32
+#define asw_curs_x_hot 12
+#define asw_curs_y_hot 15
+static char asw_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x70,0x38,0x00,0x00,0x78,0x7c,0x00,0x00,
+ 0x7e,0x7c,0x00,0x00,0x78,0x7c,0x00,0x00,0x70,0x38,0x00,0x00,0xc0,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/asw_mask.h b/vcl/unx/source/inc/asw_mask.h
new file mode 100644
index 000000000000..11a227508627
--- /dev/null
+++ b/vcl/unx/source/inc/asw_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: asw_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define asw_mask_width 32
+#define asw_mask_height 32
+#define asw_mask_x_hot 12
+#define asw_mask_y_hot 15
+static char asw_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
+ 0x00,0x00,0x00,0xf0,0x39,0x00,0x00,0xf8,0x7c,0x00,0x00,0xfe,0xfe,0x00,0x00,
+ 0xff,0xfe,0x00,0x00,0xfe,0xfe,0x00,0x00,0xf8,0x7c,0x00,0x00,0xf0,0x39,0x00,
+ 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/aswe_curs.h b/vcl/unx/source/inc/aswe_curs.h
new file mode 100644
index 000000000000..76bf92ed9e9e
--- /dev/null
+++ b/vcl/unx/source/inc/aswe_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: aswe_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define aswe_curs_width 32
+#define aswe_curs_height 32
+#define aswe_curs_x_hot 15
+#define aswe_curs_y_hot 15
+static char aswe_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x06,0x30,0x00,0x80,0xc3,0xe1,0x00,0xc0,0xe3,0xe3,0x01,
+ 0xf0,0xe3,0xe3,0x07,0xc0,0xe3,0xe3,0x01,0x80,0xc3,0xe1,0x00,0x00,0x06,0x30,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/aswe_mask.h b/vcl/unx/source/inc/aswe_mask.h
new file mode 100644
index 000000000000..ef2f2043e30a
--- /dev/null
+++ b/vcl/unx/source/inc/aswe_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: aswe_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define aswe_mask_width 32
+#define aswe_mask_height 32
+#define aswe_mask_x_hot 15
+#define aswe_mask_y_hot 15
+static char aswe_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x06,0x30,0x00,0x80,0xcf,0xf9,0x00,0xc0,0xe7,0xf3,0x01,0xf0,0xf7,0xf7,0x07,
+ 0xf8,0xf7,0xf7,0x0f,0xf0,0xf7,0xf7,0x07,0xc0,0xe7,0xf3,0x01,0x80,0xcf,0xf9,
+ 0x00,0x00,0x06,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/chain_curs.h b/vcl/unx/source/inc/chain_curs.h
new file mode 100644
index 000000000000..6ec19fc917f6
--- /dev/null
+++ b/vcl/unx/source/inc/chain_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: chain_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define chain_curs_width 32
+#define chain_curs_height 32
+#define chain_curs_x_hot 0
+#define chain_curs_y_hot 2
+static char chain_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,
+ 0x00,0x05,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x21,0x00,
+ 0x00,0x00,0x41,0x00,0x00,0x00,0x81,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x01,
+ 0x02,0x00,0x00,0x01,0x04,0x00,0x00,0x81,0x0f,0x00,0x00,0x91,0x00,0x00,0x00,
+ 0x99,0x00,0x00,0x00,0x25,0x01,0x00,0x00,0x23,0x01,0x00,0x00,0x41,0x3e,0xbf,
+ 0x0f,0x40,0x82,0x40,0x10,0x80,0x5c,0xae,0x23,0x80,0x24,0x91,0x24,0x00,0x23,
+ 0x91,0x28,0x80,0x24,0x91,0x28,0x80,0x24,0x91,0x24,0x80,0x98,0x4f,0x23,0x00,
+ 0x41,0x20,0x10,0x00,0x3e,0xde,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/chain_mask.h b/vcl/unx/source/inc/chain_mask.h
new file mode 100644
index 000000000000..f03eaf6a611c
--- /dev/null
+++ b/vcl/unx/source/inc/chain_mask.h
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: chain_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define chain_mask_width 32
+#define chain_mask_height 32
+static char chain_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,
+ 0x00,0x07,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x3f,0x00,
+ 0x00,0x00,0x7f,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0xff,0x01,0x00,0x00,0xff,
+ 0x03,0x00,0x00,0xff,0x07,0x00,0x00,0xff,0x0f,0x00,0x00,0xff,0x00,0x00,0x00,
+ 0xff,0x00,0x00,0x00,0xe7,0x01,0x00,0x00,0xe3,0x01,0x00,0x00,0xc1,0x3f,0xbf,
+ 0x0f,0xc0,0xbf,0xff,0x1f,0x80,0xdf,0xff,0x3f,0x80,0xe7,0xf1,0x3c,0x00,0xe3,
+ 0xf1,0x38,0x80,0xe7,0xf1,0x38,0x80,0xe7,0xf1,0x3c,0x80,0xff,0xff,0x3f,0x00,
+ 0x7f,0xff,0x1f,0x00,0x3e,0xde,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/chainnot_curs.h b/vcl/unx/source/inc/chainnot_curs.h
new file mode 100644
index 000000000000..1d98fbd89aef
--- /dev/null
+++ b/vcl/unx/source/inc/chainnot_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: chainnot_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define chainnot_curs_width 32
+#define chainnot_curs_height 32
+#define chainnot_curs_x_hot 2
+#define chainnot_curs_y_hot 2
+static char chainnot_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x80,0x1f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xf0,0xf0,0x00,
+ 0x00,0x38,0xc0,0x01,0x00,0x7c,0x80,0x03,0x00,0xec,0x00,0x03,0x00,0xce,0x01,
+ 0x07,0x00,0x86,0x03,0x06,0x00,0x06,0x07,0x06,0x00,0x06,0x0e,0x06,0x00,0x06,
+ 0x1c,0x06,0x00,0x0e,0x38,0x07,0x00,0x0c,0x70,0x03,0x00,0x1c,0xe0,0x03,0x00,
+ 0x38,0xc0,0x01,0x00,0xf0,0xe0,0x00,0x00,0xe0,0x7f,0x00,0x00,0x80,0x9f,0xfc,
+ 0x3e,0x00,0x00,0x02,0x41,0x00,0x72,0xb9,0x8e,0x00,0x92,0x44,0x92,0x00,0x8c,
+ 0x44,0xa2,0x00,0x92,0x44,0xa2,0x00,0x92,0x44,0x92,0x00,0x62,0x3e,0x8d,0x00,
+ 0x04,0x81,0x40,0x00,0xf8,0x78,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/chainnot_mask.h b/vcl/unx/source/inc/chainnot_mask.h
new file mode 100644
index 000000000000..38764c143944
--- /dev/null
+++ b/vcl/unx/source/inc/chainnot_mask.h
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: chainnot_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define chainnot_mask_width 32
+#define chainnot_mask_height 32
+static char chainnot_mask_bits[] = {
+ 0x80,0x1f,0x00,0x00,0xe0,0x7f,0x00,0x00,0xf0,0xff,0x00,0x00,0xf8,0xff,0x01,
+ 0x00,0xfc,0xf0,0x03,0x00,0xfe,0xc0,0x07,0x00,0xfe,0x81,0x07,0x00,0xff,0x83,
+ 0x0f,0x00,0xcf,0x07,0x0f,0x00,0x8f,0x0f,0x0f,0x00,0x0f,0x1f,0x0f,0x00,0x0f,
+ 0x3e,0x0f,0x00,0x1f,0xfc,0x0f,0x00,0x1e,0xf8,0x07,0x00,0x3e,0xf0,0x07,0x00,
+ 0xfc,0xe0,0x03,0x00,0xf8,0xff,0x01,0x00,0xf0,0xff,0x00,0x00,0xe0,0xff,0xfc,
+ 0x3e,0x80,0xff,0xfe,0x7f,0x00,0x7e,0xff,0xff,0x00,0x9e,0xc7,0xf3,0x00,0x8c,
+ 0xc7,0xe3,0x00,0x9e,0xc7,0xe3,0x00,0x9e,0xc7,0xf3,0x00,0xfe,0xff,0xff,0x00,
+ 0xfc,0xfd,0x7f,0x00,0xf8,0x78,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/chart_curs.h b/vcl/unx/source/inc/chart_curs.h
new file mode 100644
index 000000000000..7aa676c96cf3
--- /dev/null
+++ b/vcl/unx/source/inc/chart_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: chart_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define chart_curs_width 32
+#define chart_curs_height 32
+#define chart_curs_x_hot 15
+#define chart_curs_y_hot 16
+static char chart_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
+ 0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0xbf,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
+ 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x80,
+ 0x10,0x00,0x00,0x80,0x00,0x06,0x00,0x00,0x10,0x06,0x00,0x00,0x00,0x06,0x00,
+ 0x00,0x10,0x36,0x00,0x00,0xc0,0x36,0x00,0x00,0xd0,0x36,0x00,0x00,0xc0,0x36,
+ 0x00,0x00,0xf0,0x7f,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/chart_mask.h b/vcl/unx/source/inc/chart_mask.h
new file mode 100644
index 000000000000..0f0b6b37bb3f
--- /dev/null
+++ b/vcl/unx/source/inc/chart_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: chart_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define chart_mask_width 32
+#define chart_mask_height 32
+#define chart_mask_x_hot 15
+#define chart_mask_y_hot 16
+static char chart_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,
+ 0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,
+ 0x80,0xff,0xff,0x00,0x80,0xff,0xff,0x00,0x80,0xff,0xff,0x00,0x00,0xc0,0x01,
+ 0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x01,0x00,0x00,0xc0,0x39,0x00,0x00,0xc0,
+ 0x39,0x0f,0x00,0xc0,0x39,0x0f,0x00,0xc0,0x39,0x0f,0x00,0x00,0x38,0x7f,0x00,
+ 0x00,0xf8,0x7f,0x00,0x00,0xf8,0x7f,0x00,0x00,0xf8,0x7f,0x00,0x00,0xf8,0xff,
+ 0x00,0x00,0xf8,0xff,0x00,0x00,0xf8,0xff};
diff --git a/vcl/unx/source/inc/copydata_curs.h b/vcl/unx/source/inc/copydata_curs.h
new file mode 100644
index 000000000000..e60620a7c777
--- /dev/null
+++ b/vcl/unx/source/inc/copydata_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copydata_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copydata_curs_width 32
+#define copydata_curs_height 32
+#define copydata_curs_x_hot 1
+#define copydata_curs_y_hot 1
+static char copydata_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
+ 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00,
+ 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00,
+ 0x28, 0xa3, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x10, 0xf0, 0x1f, 0x00, 0x08, 0xf0, 0x1f, 0x00, 0x10, 0xf0, 0x1e, 0x00,
+ 0xa8, 0xf2, 0x1e, 0x00, 0x50, 0x35, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00,
+ 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copydata_mask.h b/vcl/unx/source/inc/copydata_mask.h
new file mode 100644
index 000000000000..7b3b86c15030
--- /dev/null
+++ b/vcl/unx/source/inc/copydata_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copydata_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copydata_mask_width 32
+#define copydata_mask_height 32
+#define copydata_mask_x_hot 1
+#define copydata_mask_y_hot 1
+static char copydata_mask_bits[] = {
+ 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00,
+ 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00,
+ 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x3c, 0xf8, 0x3f, 0x00,
+ 0x3c, 0xf8, 0x3f, 0x00, 0x3c, 0xf8, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00,
+ 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00,
+ 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
+ 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copydlnk_curs.h b/vcl/unx/source/inc/copydlnk_curs.h
new file mode 100644
index 000000000000..3e8b1633efc8
--- /dev/null
+++ b/vcl/unx/source/inc/copydlnk_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copydlnk_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copydlnk_curs_width 32
+#define copydlnk_curs_height 32
+#define copydlnk_curs_x_hot 1
+#define copydlnk_curs_y_hot 1
+static char copydlnk_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
+ 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00,
+ 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00,
+ 0x28, 0xa3, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,
+ 0x30, 0xf1, 0x1f, 0x00, 0x10, 0xf1, 0x1f, 0x00, 0xd0, 0xf1, 0x1e, 0x00,
+ 0xf0, 0xf1, 0x1e, 0x00, 0x00, 0x34, 0x18, 0x00, 0x00, 0xf0, 0x1e, 0x00,
+ 0x00, 0xf0, 0x1e, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copydlnk_mask.h b/vcl/unx/source/inc/copydlnk_mask.h
new file mode 100644
index 000000000000..bd9900fdfe67
--- /dev/null
+++ b/vcl/unx/source/inc/copydlnk_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copydlnk_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copydlnk_mask_width 32
+#define copydlnk_mask_height 32
+#define copydlnk_mask_x_hot 1
+#define copydlnk_mask_y_hot 1
+static char copydlnk_mask_bits[] = {
+ 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00,
+ 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00,
+ 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x3f, 0x00,
+ 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00,
+ 0xf8, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00, 0x00, 0xfe, 0x3f, 0x00,
+ 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
+ 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copyfile_curs.h b/vcl/unx/source/inc/copyfile_curs.h
new file mode 100644
index 000000000000..f92161e0ec06
--- /dev/null
+++ b/vcl/unx/source/inc/copyfile_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copyfile_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copyfile_curs_width 32
+#define copyfile_curs_height 32
+#define copyfile_curs_x_hot 9
+#define copyfile_curs_y_hot 9
+static char copyfile_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00,
+ 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00,
+ 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0xfe, 0x0e, 0x00, 0x00,
+ 0xfe, 0x1e, 0x00, 0x00, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00,
+ 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00,
+ 0x00, 0xc2, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x3f, 0x00, 0x80, 0xe1, 0x3d,
+ 0x00, 0x80, 0xe1, 0x3d, 0x00, 0x00, 0x63, 0x30, 0x00, 0x00, 0xe3, 0x3d,
+ 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copyfile_mask.h b/vcl/unx/source/inc/copyfile_mask.h
new file mode 100644
index 000000000000..af844d3218b2
--- /dev/null
+++ b/vcl/unx/source/inc/copyfile_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copyfile_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copyfile_mask_width 32
+#define copyfile_mask_height 32
+#define copyfile_mask_x_hot 9
+#define copyfile_mask_y_hot 9
+static char copyfile_mask_bits[] = {
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00,
+ 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00,
+ 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xf1, 0x7f,
+ 0x00, 0xff, 0xf1, 0x7f, 0x00, 0xe7, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f,
+ 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f,
+ 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f,
+ 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copyfiles_curs.h b/vcl/unx/source/inc/copyfiles_curs.h
new file mode 100644
index 000000000000..4acfaf38b0db
--- /dev/null
+++ b/vcl/unx/source/inc/copyfiles_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copyfiles_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copyfiles_curs_width 32
+#define copyfiles_curs_height 32
+#define copyfiles_curs_x_hot 8
+#define copyfiles_curs_y_hot 9
+static char copyfiles_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xe0, 0x2f, 0x00, 0x00,
+ 0xe8, 0x0f, 0x00, 0x00, 0xe8, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00,
+ 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0x6a, 0x7e, 0x00, 0x00,
+ 0x6a, 0x7d, 0x00, 0x00, 0x6a, 0x7b, 0x00, 0x00, 0x6a, 0x77, 0x00, 0x00,
+ 0x6a, 0x6f, 0x00, 0x00, 0x6a, 0x5f, 0x00, 0x00, 0x0a, 0x3f, 0x00, 0x00,
+ 0x7a, 0x7f, 0x00, 0x00, 0x02, 0xff, 0x00, 0x00, 0x7e, 0xff, 0x01, 0x00,
+ 0x00, 0x3f, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00,
+ 0x00, 0x61, 0xe0, 0x3f, 0x00, 0x60, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x3d,
+ 0x00, 0xc0, 0xe0, 0x3d, 0x00, 0x80, 0x61, 0x30, 0x00, 0x80, 0xe1, 0x3d,
+ 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copyfiles_mask.h b/vcl/unx/source/inc/copyfiles_mask.h
new file mode 100644
index 000000000000..cec000477d40
--- /dev/null
+++ b/vcl/unx/source/inc/copyfiles_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copyfiles_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copyfiles_mask_width 32
+#define copyfiles_mask_height 32
+#define copyfiles_mask_x_hot 8
+#define copyfiles_mask_y_hot 9
+static char copyfiles_mask_bits[] = {
+ 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00,
+ 0xfc, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00,
+ 0xff, 0xff, 0x03, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0xff, 0xf0, 0x7f,
+ 0x80, 0xff, 0xf0, 0x7f, 0x80, 0xf3, 0xf1, 0x7f, 0x00, 0xf0, 0xf1, 0x7f,
+ 0x00, 0xe0, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f, 0x00, 0xc0, 0xf3, 0x7f,
+ 0x00, 0xc0, 0xf3, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f,
+ 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copyflnk_curs.h b/vcl/unx/source/inc/copyflnk_curs.h
new file mode 100644
index 000000000000..c61d5fbfe564
--- /dev/null
+++ b/vcl/unx/source/inc/copyflnk_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copyflnk_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copyflnk_curs_width 32
+#define copyflnk_curs_height 32
+#define copyflnk_curs_x_hot 9
+#define copyflnk_curs_y_hot 9
+static char copyflnk_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00,
+ 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00,
+ 0xbe, 0x02, 0x00, 0x00, 0xa6, 0x06, 0x00, 0x00, 0xa2, 0x0e, 0x00, 0x00,
+ 0xba, 0x1e, 0x00, 0x00, 0xbe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00,
+ 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00,
+ 0x00, 0xc2, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x3f, 0x00, 0x80, 0xe1, 0x3d,
+ 0x00, 0x80, 0xe1, 0x3d, 0x00, 0x00, 0x63, 0x30, 0x00, 0x00, 0xe3, 0x3d,
+ 0x00, 0x00, 0xe0, 0x3d, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/copyflnk_mask.h b/vcl/unx/source/inc/copyflnk_mask.h
new file mode 100644
index 000000000000..110c0cc42991
--- /dev/null
+++ b/vcl/unx/source/inc/copyflnk_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: copyflnk_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define copyflnk_mask_width 32
+#define copyflnk_mask_height 32
+#define copyflnk_mask_x_hot 9
+#define copyflnk_mask_y_hot 9
+static char copyflnk_mask_bits[] = {
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00,
+ 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00,
+ 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xf1, 0x7f,
+ 0x00, 0xff, 0xf1, 0x7f, 0x00, 0xe7, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f,
+ 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f,
+ 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f,
+ 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/crook_curs.h b/vcl/unx/source/inc/crook_curs.h
new file mode 100644
index 000000000000..877730c2c115
--- /dev/null
+++ b/vcl/unx/source/inc/crook_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: crook_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define crook_curs_width 32
+#define crook_curs_height 32
+#define crook_curs_x_hot 15
+#define crook_curs_y_hot 14
+static char crook_curs_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0x3e, 0xff, 0x7f, 0xbb, 0xdd, 0xfe,
+ 0x7f, 0xbb, 0xdd, 0xfe, 0xf3, 0xb6, 0x6d, 0xcf, 0xed, 0xb6, 0x6d, 0xb7,
+ 0xdd, 0x75, 0xae, 0xbb, 0xbb, 0x0b, 0xd0, 0xdd, 0xb7, 0xf1, 0x8f, 0xed,
+ 0x4f, 0x0e, 0x70, 0xf2, 0xbf, 0xf1, 0x8f, 0xfd, 0x5f, 0xfe, 0x7f, 0xfa,
+ 0xaf, 0xff, 0xff, 0xf5, 0xd7, 0xff, 0xff, 0xeb, 0xef, 0xff, 0xff, 0xf7,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/crook_mask.h b/vcl/unx/source/inc/crook_mask.h
new file mode 100644
index 000000000000..3e7b2929304f
--- /dev/null
+++ b/vcl/unx/source/inc/crook_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: crook_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define crook_mask_width 32
+#define crook_mask_height 32
+static char crook_mask_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x83, 0xc1, 0x00, 0x80, 0xc7, 0xe3, 0x01, 0xc0, 0xef, 0xf7, 0x03,
+ 0xcc, 0xef, 0xf7, 0x33, 0x9e, 0xff, 0xff, 0x79, 0xbf, 0xff, 0xff, 0xfd,
+ 0x77, 0xff, 0xff, 0xee, 0xee, 0xf6, 0x6f, 0x77, 0xfc, 0xff, 0xff, 0x3f,
+ 0xb8, 0xff, 0xff, 0x1d, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f,
+ 0xf8, 0x01, 0x80, 0x1f, 0x7c, 0x00, 0x00, 0x3e, 0x38, 0x00, 0x00, 0x1c,
+ 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/crop_curs.h b/vcl/unx/source/inc/crop_curs.h
new file mode 100644
index 000000000000..a67818a30f7b
--- /dev/null
+++ b/vcl/unx/source/inc/crop_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: crop_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define crop_curs_width 32
+#define crop_curs_height 32
+#define crop_curs_x_hot 9
+#define crop_curs_y_hot 9
+static char crop_curs_bits[] = {
+ 0xff, 0x0f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff,
+ 0x07, 0x60, 0xf8, 0xff, 0xf7, 0x6f, 0xfb, 0xff, 0xf7, 0x6f, 0xfb, 0xff,
+ 0x37, 0x60, 0xf8, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff,
+ 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff,
+ 0x30, 0x60, 0xff, 0xff, 0xb6, 0x7f, 0xff, 0xff, 0xb6, 0x7f, 0xff, 0xff,
+ 0x30, 0x00, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xff,
+ 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/crop_mask.h b/vcl/unx/source/inc/crop_mask.h
new file mode 100644
index 000000000000..5731265dee6f
--- /dev/null
+++ b/vcl/unx/source/inc/crop_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: crop_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define crop_mask_width 32
+#define crop_mask_height 32
+static char crop_mask_bits[] = {
+ 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0xfc, 0xff, 0x0f, 0x00,
+ 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00,
+ 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xf8, 0x01, 0x00,
+ 0xfc, 0xf8, 0x01, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0xfc, 0x00, 0x00, 0x00,
+ 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/detective_curs.h b/vcl/unx/source/inc/detective_curs.h
new file mode 100644
index 000000000000..30cf7cb1fc02
--- /dev/null
+++ b/vcl/unx/source/inc/detective_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: detective_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define detective_curs_width 32
+#define detective_curs_height 32
+#define detective_curs_x_hot 12
+#define detective_curs_y_hot 13
+static char detective_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x38,0x00,
+ 0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,
+ 0x00,0x00,0x00,0x83,0x01,0x00,0x80,0x00,0x02,0x00,0x80,0x10,0x02,0x00,0x40,
+ 0x38,0x04,0x00,0x40,0x7c,0x04,0x00,0x40,0xfe,0x04,0x00,0x40,0x38,0x04,0x00,
+ 0x40,0x38,0x04,0x00,0x80,0x38,0x02,0x00,0x80,0x00,0x02,0x00,0x00,0x83,0x07,
+ 0x00,0x00,0x7c,0x0e,0x00,0x00,0x00,0x1c,0x00,0x00,0x10,0x38,0x00,0x00,0x38,
+ 0x70,0x00,0x00,0x10,0x60,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/detective_mask.h b/vcl/unx/source/inc/detective_mask.h
new file mode 100644
index 000000000000..11ad00d35a1e
--- /dev/null
+++ b/vcl/unx/source/inc/detective_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: detective_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define detective_mask_width 32
+#define detective_mask_height 32
+#define detective_mask_x_hot 12
+#define detective_mask_y_hot 13
+static char detective_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x38,0x00,
+ 0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,
+ 0x00,0x00,0x00,0xff,0x01,0x00,0x80,0xff,0x03,0x00,0x80,0xff,0x03,0x00,0xc0,
+ 0xff,0x07,0x00,0xc0,0xff,0x07,0x00,0xc0,0xff,0x07,0x00,0xc0,0xff,0x07,0x00,
+ 0xc0,0xff,0x07,0x00,0x80,0xff,0x03,0x00,0x80,0xff,0x03,0x00,0x00,0xff,0x07,
+ 0x00,0x00,0x7c,0x0e,0x00,0x00,0x00,0x1c,0x00,0x00,0x10,0x38,0x00,0x00,0x38,
+ 0x70,0x00,0x00,0x10,0x60,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/drawarc_curs.h b/vcl/unx/source/inc/drawarc_curs.h
new file mode 100644
index 000000000000..7d7455e5606d
--- /dev/null
+++ b/vcl/unx/source/inc/drawarc_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawarc_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawarc_curs_width 32
+#define drawarc_curs_height 32
+#define drawarc_curs_x_hot 7
+#define drawarc_curs_y_hot 7
+static char drawarc_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x42, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawarc_mask.h b/vcl/unx/source/inc/drawarc_mask.h
new file mode 100644
index 000000000000..68a532fef334
--- /dev/null
+++ b/vcl/unx/source/inc/drawarc_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawarc_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawarc_mask_width 32
+#define drawarc_mask_height 32
+static char drawarc_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xff, 0x00,
+ 0x00, 0x80, 0xe7, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00,
+ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawbezier_curs.h b/vcl/unx/source/inc/drawbezier_curs.h
new file mode 100644
index 000000000000..61099e42a8da
--- /dev/null
+++ b/vcl/unx/source/inc/drawbezier_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawbezier_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawbezier_curs_width 32
+#define drawbezier_curs_height 32
+#define drawbezier_curs_x_hot 7
+#define drawbezier_curs_y_hot 7
+static char drawbezier_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x88, 0x00,
+ 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00,
+ 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x0e, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawbezier_mask.h b/vcl/unx/source/inc/drawbezier_mask.h
new file mode 100644
index 000000000000..77c302f5d216
--- /dev/null
+++ b/vcl/unx/source/inc/drawbezier_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawbezier_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawbezier_mask_width 32
+#define drawbezier_mask_height 32
+static char drawbezier_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x8e, 0x0f, 0x00, 0x00, 0xdc, 0x0f,
+ 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xe0, 0x00,
+ 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xbf, 0x03, 0x00, 0x00, 0x1f, 0x07,
+ 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawcaption_curs.h b/vcl/unx/source/inc/drawcaption_curs.h
new file mode 100644
index 000000000000..dd2b97d39747
--- /dev/null
+++ b/vcl/unx/source/inc/drawcaption_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcaption_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcaption_curs_width 32
+#define drawcaption_curs_height 32
+#define drawcaption_curs_x_hot 8
+#define drawcaption_curs_y_hot 8
+static char drawcaption_curs_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff,
+ 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff,
+ 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0x02, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff,
+ 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xbe, 0xff, 0xff,
+ 0xff, 0x7e, 0x1f, 0xe0, 0xff, 0xff, 0xde, 0xef, 0xff, 0xff, 0xc1, 0xef,
+ 0xff, 0xff, 0xdf, 0xef, 0xff, 0xff, 0x1f, 0xe0, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/drawcaption_mask.h b/vcl/unx/source/inc/drawcaption_mask.h
new file mode 100644
index 000000000000..53675e4697e5
--- /dev/null
+++ b/vcl/unx/source/inc/drawcaption_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcaption_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcaption_mask_width 32
+#define drawcaption_mask_height 32
+static char drawcaption_mask_bits[] = {
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x43, 0x00, 0x00, 0x80, 0xe3, 0xf0, 0x3f,
+ 0x80, 0xc3, 0xf1, 0x3f, 0x80, 0x83, 0xff, 0x3f, 0x00, 0x00, 0x7f, 0x38,
+ 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf0, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawcirclecut_curs.h b/vcl/unx/source/inc/drawcirclecut_curs.h
new file mode 100644
index 000000000000..2f66f6f8ec25
--- /dev/null
+++ b/vcl/unx/source/inc/drawcirclecut_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcirclecut_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcirclecut_curs_width 32
+#define drawcirclecut_curs_height 32
+#define drawcirclecut_curs_x_hot 7
+#define drawcirclecut_curs_y_hot 7
+static char drawcirclecut_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00,
+ 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x41, 0x00,
+ 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawcirclecut_mask.h b/vcl/unx/source/inc/drawcirclecut_mask.h
new file mode 100644
index 000000000000..e4bb3fb22b54
--- /dev/null
+++ b/vcl/unx/source/inc/drawcirclecut_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcirclecut_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcirclecut_mask_width 32
+#define drawcirclecut_mask_height 32
+static char drawcirclecut_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1f, 0x00,
+ 0x00, 0x80, 0x3b, 0x00, 0x00, 0x80, 0x73, 0x00, 0x00, 0x80, 0xe3, 0x00,
+ 0x00, 0x80, 0xc3, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00,
+ 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawconnect_curs.h b/vcl/unx/source/inc/drawconnect_curs.h
new file mode 100644
index 000000000000..9f79bda47d38
--- /dev/null
+++ b/vcl/unx/source/inc/drawconnect_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawconnect_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawconnect_curs_width 32
+#define drawconnect_curs_height 32
+#define drawconnect_curs_x_hot 7
+#define drawconnect_curs_y_hot 7
+static char drawconnect_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x80, 0x5f, 0x00, 0x00, 0x80, 0x70,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0xfd, 0x00,
+ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawconnect_mask.h b/vcl/unx/source/inc/drawconnect_mask.h
new file mode 100644
index 000000000000..4b833b83f5c7
--- /dev/null
+++ b/vcl/unx/source/inc/drawconnect_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawconnect_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawconnect_mask_width 32
+#define drawconnect_mask_height 32
+static char drawconnect_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
+ 0x00, 0x00, 0xc0, 0xff, 0x00, 0x00, 0xc0, 0xdf, 0x00, 0x00, 0xc0, 0xff,
+ 0x00, 0x80, 0xcf, 0xf9, 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xfd, 0x01,
+ 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawcrook_curs.h b/vcl/unx/source/inc/drawcrook_curs.h
new file mode 100644
index 000000000000..fd8317b7a88e
--- /dev/null
+++ b/vcl/unx/source/inc/drawcrook_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcrook_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcrook_curs_width 32
+#define drawcrook_curs_height 32
+#define drawcrook_curs_x_hot 15
+#define drawcrook_curs_y_hot 14
+static char drawcrook_curs_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0x3e, 0xff, 0x7f, 0xbb, 0xdd, 0xfe,
+ 0x7f, 0xbb, 0xdd, 0xfe, 0xf3, 0xb6, 0x6d, 0xcf, 0xed, 0xb6, 0x6d, 0xb7,
+ 0xdd, 0x75, 0xae, 0xbb, 0xbb, 0x0b, 0xd0, 0xdd, 0xb7, 0xf1, 0x8f, 0xed,
+ 0x4f, 0x0e, 0x70, 0xf2, 0xbf, 0xf1, 0x8f, 0xfd, 0x5f, 0xfe, 0x7f, 0xfa,
+ 0xaf, 0xff, 0xff, 0xf5, 0xd7, 0xff, 0xff, 0xeb, 0xef, 0xff, 0xff, 0xf7,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/drawcrook_mask.h b/vcl/unx/source/inc/drawcrook_mask.h
new file mode 100644
index 000000000000..3d1dce8c7f1e
--- /dev/null
+++ b/vcl/unx/source/inc/drawcrook_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcrook_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcrook_mask_width 32
+#define drawcrook_mask_height 32
+static char drawcrook_mask_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x83, 0xc1, 0x00, 0x80, 0xc7, 0xe3, 0x01, 0xc0, 0xef, 0xf7, 0x03,
+ 0xcc, 0xef, 0xf7, 0x33, 0x9e, 0xff, 0xff, 0x79, 0xbf, 0xff, 0xff, 0xfd,
+ 0x77, 0xff, 0xff, 0xee, 0xee, 0xf6, 0x6f, 0x77, 0xfc, 0xff, 0xff, 0x3f,
+ 0xb8, 0xff, 0xff, 0x1d, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f,
+ 0xf8, 0x01, 0x80, 0x1f, 0x7c, 0x00, 0x00, 0x3e, 0x38, 0x00, 0x00, 0x1c,
+ 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawcrop_curs.h b/vcl/unx/source/inc/drawcrop_curs.h
new file mode 100644
index 000000000000..aa287f6e502c
--- /dev/null
+++ b/vcl/unx/source/inc/drawcrop_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcrop_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcrop_curs_width 32
+#define drawcrop_curs_height 32
+#define drawcrop_curs_x_hot 9
+#define drawcrop_curs_y_hot 9
+static char drawcrop_curs_bits[] = {
+ 0xff, 0x0f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff, 0xff, 0x6f, 0xff, 0xff,
+ 0x07, 0x60, 0xf8, 0xff, 0xf7, 0x6f, 0xfb, 0xff, 0xf7, 0x6f, 0xfb, 0xff,
+ 0x37, 0x60, 0xf8, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff,
+ 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff, 0xb7, 0x6f, 0xff, 0xff,
+ 0x30, 0x60, 0xff, 0xff, 0xb6, 0x7f, 0xff, 0xff, 0xb6, 0x7f, 0xff, 0xff,
+ 0x30, 0x00, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xff,
+ 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/drawcrop_mask.h b/vcl/unx/source/inc/drawcrop_mask.h
new file mode 100644
index 000000000000..c631f8fa4397
--- /dev/null
+++ b/vcl/unx/source/inc/drawcrop_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawcrop_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawcrop_mask_width 32
+#define drawcrop_mask_height 32
+static char drawcrop_mask_bits[] = {
+ 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0xfc, 0xff, 0x0f, 0x00,
+ 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00,
+ 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xfc, 0xf8, 0x01, 0x00,
+ 0xfc, 0xf8, 0x01, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0xfc, 0x00, 0x00, 0x00,
+ 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawellipse_curs.h b/vcl/unx/source/inc/drawellipse_curs.h
new file mode 100644
index 000000000000..f1df489167f0
--- /dev/null
+++ b/vcl/unx/source/inc/drawellipse_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawellipse_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawellipse_curs_width 32
+#define drawellipse_curs_height 32
+#define drawellipse_curs_x_hot 7
+#define drawellipse_curs_y_hot 7
+static char drawellipse_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x42, 0x00,
+ 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00,
+ 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawellipse_mask.h b/vcl/unx/source/inc/drawellipse_mask.h
new file mode 100644
index 000000000000..4f4c8a00fd2c
--- /dev/null
+++ b/vcl/unx/source/inc/drawellipse_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawellipse_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawellipse_mask_width 32
+#define drawellipse_mask_height 32
+static char drawellipse_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0xff, 0x00,
+ 0x00, 0x80, 0xe7, 0x01, 0x00, 0x80, 0xc3, 0x01, 0x00, 0x80, 0xc3, 0x01,
+ 0x00, 0x80, 0xe7, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00,
+ 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawfreehand_curs.h b/vcl/unx/source/inc/drawfreehand_curs.h
new file mode 100644
index 000000000000..34a54b5124ec
--- /dev/null
+++ b/vcl/unx/source/inc/drawfreehand_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawfreehand_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawfreehand_curs_width 32
+#define drawfreehand_curs_height 32
+#define drawfreehand_curs_x_hot 8
+#define drawfreehand_curs_y_hot 8
+static char drawfreehand_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xfd, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x70, 0x00, 0x02,
+ 0x00, 0x88, 0x00, 0x02, 0x00, 0x84, 0x00, 0x01, 0x00, 0x84, 0xc0, 0x00,
+ 0x00, 0x04, 0x3f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawfreehand_mask.h b/vcl/unx/source/inc/drawfreehand_mask.h
new file mode 100644
index 000000000000..e56aafe3d56c
--- /dev/null
+++ b/vcl/unx/source/inc/drawfreehand_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawfreehand_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawfreehand_mask_width 32
+#define drawfreehand_mask_height 32
+static char drawfreehand_mask_bits[] = {
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x08,
+ 0x80, 0x03, 0x00, 0x1c, 0x80, 0x73, 0x00, 0x0e, 0x00, 0xf8, 0x00, 0x07,
+ 0x00, 0xfc, 0x01, 0x07, 0x00, 0xce, 0xc1, 0x03, 0x00, 0xce, 0xff, 0x01,
+ 0x00, 0x8e, 0xff, 0x00, 0x00, 0x0e, 0x3f, 0x00, 0x00, 0x0e, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawline_curs.h b/vcl/unx/source/inc/drawline_curs.h
new file mode 100644
index 000000000000..830f42966c0b
--- /dev/null
+++ b/vcl/unx/source/inc/drawline_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawline_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawline_curs_width 32
+#define drawline_curs_height 32
+#define drawline_curs_x_hot 7
+#define drawline_curs_y_hot 7
+static char drawline_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0c, 0x00,
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawline_mask.h b/vcl/unx/source/inc/drawline_mask.h
new file mode 100644
index 000000000000..58e436fadcc3
--- /dev/null
+++ b/vcl/unx/source/inc/drawline_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawline_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawline_mask_width 32
+#define drawline_mask_height 32
+static char drawline_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0xfe, 0x00, 0x00, 0xbf, 0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x70,
+ 0xc0, 0x01, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xc0, 0x0f,
+ 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x3f, 0x00,
+ 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawmirror_curs.h b/vcl/unx/source/inc/drawmirror_curs.h
new file mode 100644
index 000000000000..59b604dcec4b
--- /dev/null
+++ b/vcl/unx/source/inc/drawmirror_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawmirror_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawmirror_curs_width 32
+#define drawmirror_curs_height 32
+#define drawmirror_curs_x_hot 14
+#define drawmirror_curs_y_hot 12
+static char drawmirror_curs_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0x03, 0xf8, 0xf5, 0xff,
+ 0xfb, 0xfb, 0xee, 0xff, 0x0b, 0xfa, 0xf5, 0xff, 0xeb, 0xfa, 0xfa, 0xff,
+ 0xeb, 0xfa, 0xfa, 0xff, 0xeb, 0x7a, 0xfd, 0xff, 0xeb, 0x7a, 0xfd, 0xff,
+ 0xeb, 0xba, 0x7e, 0xff, 0xeb, 0xba, 0xbe, 0xfe, 0xeb, 0x5a, 0x5f, 0xfd,
+ 0x0b, 0x5a, 0xaf, 0xfa, 0xfb, 0xab, 0xd7, 0xf5, 0x03, 0xa8, 0xeb, 0xeb,
+ 0xff, 0xd7, 0xf5, 0xf5, 0xff, 0xd7, 0xfa, 0xfa, 0xff, 0x6b, 0x7d, 0xfd,
+ 0xff, 0xeb, 0xba, 0xfe, 0xff, 0xf5, 0x55, 0xff, 0xff, 0xf5, 0xab, 0xff,
+ 0xff, 0xfa, 0xd7, 0xff, 0x7f, 0xf7, 0xef, 0xff, 0xff, 0xfa, 0xff, 0xff,
+ 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/drawmirror_mask.h b/vcl/unx/source/inc/drawmirror_mask.h
new file mode 100644
index 000000000000..2858036f5139
--- /dev/null
+++ b/vcl/unx/source/inc/drawmirror_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawmirror_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawmirror_mask_width 32
+#define drawmirror_mask_height 32
+static char drawmirror_mask_bits[] = {
+ 0x00, 0x00, 0x04, 0x00, 0xfe, 0x0f, 0x0e, 0x00, 0xfe, 0x0f, 0x1f, 0x00,
+ 0xfe, 0x8f, 0x3f, 0x00, 0xfe, 0x0f, 0x1f, 0x00, 0xfe, 0x8f, 0x0f, 0x00,
+ 0xbe, 0x8f, 0x0f, 0x00, 0xbe, 0xcf, 0x07, 0x00, 0xbe, 0xcf, 0x87, 0x00,
+ 0xbe, 0xef, 0xc3, 0x01, 0xbe, 0xef, 0xe3, 0x03, 0xfe, 0xff, 0xf1, 0x07,
+ 0xfe, 0xff, 0x79, 0x0f, 0xfe, 0xff, 0x3c, 0x1e, 0xfe, 0xff, 0x1e, 0x3c,
+ 0xfe, 0x7f, 0x0f, 0x1e, 0x00, 0xfc, 0x07, 0x0f, 0x00, 0xfe, 0x83, 0x07,
+ 0x00, 0xbe, 0xc7, 0x03, 0x00, 0x1f, 0xef, 0x01, 0x00, 0x1f, 0xfe, 0x00,
+ 0x80, 0x0f, 0x7c, 0x00, 0xc0, 0x1d, 0x38, 0x00, 0x80, 0x0f, 0x10, 0x00,
+ 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawpie_curs.h b/vcl/unx/source/inc/drawpie_curs.h
new file mode 100644
index 000000000000..0b289f9dbb2d
--- /dev/null
+++ b/vcl/unx/source/inc/drawpie_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawpie_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawpie_curs_width 32
+#define drawpie_curs_height 32
+#define drawpie_curs_x_hot 7
+#define drawpie_curs_y_hot 7
+static char drawpie_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0a, 0x00,
+ 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0xf9, 0x00,
+ 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawpie_mask.h b/vcl/unx/source/inc/drawpie_mask.h
new file mode 100644
index 000000000000..e0be2e64d35a
--- /dev/null
+++ b/vcl/unx/source/inc/drawpie_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawpie_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawpie_mask_width 32
+#define drawpie_mask_height 32
+static char drawpie_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00,
+ 0x00, 0x80, 0x1f, 0x00, 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01,
+ 0x00, 0x80, 0xfb, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00,
+ 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawpolygon_curs.h b/vcl/unx/source/inc/drawpolygon_curs.h
new file mode 100644
index 000000000000..2ac109600373
--- /dev/null
+++ b/vcl/unx/source/inc/drawpolygon_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawpolygon_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawpolygon_curs_width 32
+#define drawpolygon_curs_height 32
+#define drawpolygon_curs_x_hot 7
+#define drawpolygon_curs_y_hot 7
+static char drawpolygon_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x83, 0x00,
+ 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x99, 0x00,
+ 0x00, 0x00, 0x89, 0x03, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01, 0x01,
+ 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawpolygon_mask.h b/vcl/unx/source/inc/drawpolygon_mask.h
new file mode 100644
index 000000000000..687d8c098798
--- /dev/null
+++ b/vcl/unx/source/inc/drawpolygon_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawpolygon_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawpolygon_mask_width 32
+#define drawpolygon_mask_height 32
+static char drawpolygon_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x06,
+ 0x00, 0x00, 0x1e, 0x07, 0x00, 0x00, 0xbe, 0x07, 0x00, 0x00, 0xfe, 0x07,
+ 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0x7e, 0x1f, 0x00, 0x00, 0x3e, 0x1f,
+ 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0e, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawrect_curs.h b/vcl/unx/source/inc/drawrect_curs.h
new file mode 100644
index 000000000000..5734700482b8
--- /dev/null
+++ b/vcl/unx/source/inc/drawrect_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawrect_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawrect_curs_width 32
+#define drawrect_curs_height 32
+#define drawrect_curs_x_hot 7
+#define drawrect_curs_y_hot 7
+static char drawrect_curs_bits[] = {
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x81, 0x00,
+ 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x81, 0x00,
+ 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawrect_mask.h b/vcl/unx/source/inc/drawrect_mask.h
new file mode 100644
index 000000000000..ce97b52d1ff3
--- /dev/null
+++ b/vcl/unx/source/inc/drawrect_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawrect_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawrect_mask_width 32
+#define drawrect_mask_height 32
+static char drawrect_mask_bits[] = {
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x3f, 0x7e, 0x00, 0x00, 0xbf, 0x7e, 0x00, 0x00, 0x3f, 0x7e, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,
+ 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01,
+ 0x00, 0x80, 0xc3, 0x01, 0x00, 0x80, 0xc3, 0x01, 0x00, 0x80, 0xff, 0x01,
+ 0x00, 0x80, 0xff, 0x01, 0x00, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawtext_curs.h b/vcl/unx/source/inc/drawtext_curs.h
new file mode 100644
index 000000000000..ec2b30198f41
--- /dev/null
+++ b/vcl/unx/source/inc/drawtext_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawtext_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawtext_curs_width 32
+#define drawtext_curs_height 32
+#define drawtext_curs_x_hot 8
+#define drawtext_curs_y_hot 8
+static char drawtext_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xfd, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x81, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x80, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/drawtext_mask.h b/vcl/unx/source/inc/drawtext_mask.h
new file mode 100644
index 000000000000..c045333f0fe4
--- /dev/null
+++ b/vcl/unx/source/inc/drawtext_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: drawtext_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define drawtext_mask_width 32
+#define drawtext_mask_height 32
+static char drawtext_mask_bits[] = {
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0xc3, 0x1f, 0x00,
+ 0x80, 0xc3, 0x1f, 0x00, 0x80, 0xc3, 0x1f, 0x00, 0x00, 0x00, 0x07, 0x00,
+ 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0xc0, 0x1f, 0x00,
+ 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/fill_curs.h b/vcl/unx/source/inc/fill_curs.h
new file mode 100644
index 000000000000..eab6f5d1f9fc
--- /dev/null
+++ b/vcl/unx/source/inc/fill_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: fill_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define fill_curs_width 32
+#define fill_curs_height 32
+#define fill_curs_x_hot 10
+#define fill_curs_y_hot 22
+static char fill_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x80,0x02,0x00,0x00,0x5c,0x0c,0x00,0x00,
+ 0x2e,0x12,0x00,0x00,0x17,0x38,0x00,0x00,0x0b,0x7c,0x00,0x00,0x5b,0xbe,0x00,
+ 0x00,0x27,0x9f,0x00,0x00,0xa7,0x4f,0x00,0x00,0xc7,0x27,0x00,0x00,0x87,0x13,
+ 0x00,0x00,0x06,0x09,0x00,0x00,0x06,0x06,0x00,0x00,0x04,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/fill_mask.h b/vcl/unx/source/inc/fill_mask.h
new file mode 100644
index 000000000000..a3d1e935f8a6
--- /dev/null
+++ b/vcl/unx/source/inc/fill_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: fill_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define fill_mask_width 32
+#define fill_mask_height 32
+#define fill_mask_x_hot 10
+#define fill_mask_y_hot 22
+static char fill_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x80,0x03,0x00,0x00,0xdc,0x0f,0x00,0x00,
+ 0xfe,0x1f,0x00,0x00,0xff,0x3f,0x00,0x00,0xff,0x7f,0x00,0x00,0xff,0xff,0x00,
+ 0x00,0xe7,0xff,0x00,0x00,0xe7,0x7f,0x00,0x00,0xc7,0x3f,0x00,0x00,0x87,0x1f,
+ 0x00,0x00,0x06,0x0f,0x00,0x00,0x06,0x06,0x00,0x00,0x04,0x00,0x00,0x00,0x04,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/hshear_curs.h b/vcl/unx/source/inc/hshear_curs.h
new file mode 100644
index 000000000000..f45a162c866e
--- /dev/null
+++ b/vcl/unx/source/inc/hshear_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: hshear_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define hshear_curs_width 32
+#define hshear_curs_height 32
+#define hshear_curs_x_hot 15
+#define hshear_curs_y_hot 15
+static char hshear_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
+ 0x00, 0x3c, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x0c, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/hshear_mask.h b/vcl/unx/source/inc/hshear_mask.h
new file mode 100644
index 000000000000..d43b505cd6de
--- /dev/null
+++ b/vcl/unx/source/inc/hshear_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: hshear_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define hshear_mask_width 32
+#define hshear_mask_height 32
+static char hshear_mask_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00,
+ 0x80, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x01,
+ 0x80, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x3e, 0x00,
+ 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/invert50.h b/vcl/unx/source/inc/invert50.h
new file mode 100644
index 000000000000..bd9a48e94833
--- /dev/null
+++ b/vcl/unx/source/inc/invert50.h
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * $RCSfile: invert50.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define invert50_width 32
+#define invert50_height 32
+static char invert50_bits[] = {
+#if 1
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+#else
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+ 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
+#endif
+};
diff --git a/vcl/unx/source/inc/linkdata_curs.h b/vcl/unx/source/inc/linkdata_curs.h
new file mode 100644
index 000000000000..c6fd5105967c
--- /dev/null
+++ b/vcl/unx/source/inc/linkdata_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: linkdata_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define linkdata_curs_width 32
+#define linkdata_curs_height 32
+#define linkdata_curs_x_hot 1
+#define linkdata_curs_y_hot 1
+static char linkdata_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
+ 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00,
+ 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00,
+ 0x28, 0xa3, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x10, 0xf0, 0x1f, 0x00, 0x08, 0x70, 0x18, 0x00, 0x10, 0xf0, 0x18, 0x00,
+ 0xa8, 0x72, 0x18, 0x00, 0x50, 0x35, 0x1a, 0x00, 0x00, 0x30, 0x1f, 0x00,
+ 0x00, 0xb0, 0x1f, 0x00, 0x00, 0x70, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/linkdata_mask.h b/vcl/unx/source/inc/linkdata_mask.h
new file mode 100644
index 000000000000..93ec3011a8e3
--- /dev/null
+++ b/vcl/unx/source/inc/linkdata_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: linkdata_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define linkdata_mask_width 32
+#define linkdata_mask_height 32
+#define linkdata_mask_x_hot 1
+#define linkdata_mask_y_hot 1
+static char linkdata_mask_bits[] = {
+ 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00,
+ 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00,
+ 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x3c, 0xf8, 0x3f, 0x00,
+ 0x3c, 0xf8, 0x3f, 0x00, 0x3c, 0xf8, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00,
+ 0xfc, 0xff, 0x3f, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0x3f, 0x00,
+ 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
+ 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/linkfile_curs.h b/vcl/unx/source/inc/linkfile_curs.h
new file mode 100644
index 000000000000..75f391383e49
--- /dev/null
+++ b/vcl/unx/source/inc/linkfile_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: linkfile_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define linkfile_curs_width 32
+#define linkfile_curs_height 32
+#define linkfile_curs_x_hot 9
+#define linkfile_curs_y_hot 9
+static char linkfile_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00,
+ 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00,
+ 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0xfe, 0x0e, 0x00, 0x00,
+ 0xfe, 0x1e, 0x00, 0x00, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00,
+ 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00,
+ 0x00, 0xc2, 0xe0, 0x3f, 0x00, 0xc0, 0xe0, 0x30, 0x00, 0x80, 0xe1, 0x31,
+ 0x00, 0x80, 0xe1, 0x30, 0x00, 0x00, 0x63, 0x34, 0x00, 0x00, 0x63, 0x3e,
+ 0x00, 0x00, 0x60, 0x3f, 0x00, 0x00, 0xe0, 0x3e, 0x00, 0x00, 0xe0, 0x3f,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/linkfile_mask.h b/vcl/unx/source/inc/linkfile_mask.h
new file mode 100644
index 000000000000..4fb151b8a72f
--- /dev/null
+++ b/vcl/unx/source/inc/linkfile_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: linkfile_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define linkfile_mask_width 32
+#define linkfile_mask_height 32
+#define linkfile_mask_x_hot 9
+#define linkfile_mask_y_hot 9
+static char linkfile_mask_bits[] = {
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00,
+ 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00,
+ 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xf1, 0x7f,
+ 0x00, 0xff, 0xf1, 0x7f, 0x00, 0xe7, 0xf3, 0x7f, 0x00, 0xe0, 0xf3, 0x7f,
+ 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0xc0, 0xf7, 0x7f, 0x00, 0x80, 0xf7, 0x7f,
+ 0x00, 0x80, 0xf7, 0x7f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0x7f,
+ 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/magnify_curs.h b/vcl/unx/source/inc/magnify_curs.h
new file mode 100644
index 000000000000..79009a88b1b1
--- /dev/null
+++ b/vcl/unx/source/inc/magnify_curs.h
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: magnify_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define magnify_curs_width 16
+#define magnify_curs_height 16
+#define magnify_curs_x_hot 6
+#define magnify_curs_y_hot 6
+static char magnify_curs_bits[] = {
+ 0x00, 0x00, 0xe0, 0x00, 0x18, 0x03, 0x04, 0x04, 0x14, 0x05, 0x0a, 0x0a,
+ 0x0a, 0x0a, 0x0a, 0x0a, 0x14, 0x05, 0x04, 0x04, 0x18, 0x0f, 0xe0, 0x1c,
+ 0x00, 0x38, 0x00, 0x70, 0x00, 0x60, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/magnify_mask.h b/vcl/unx/source/inc/magnify_mask.h
new file mode 100644
index 000000000000..895582f4cda9
--- /dev/null
+++ b/vcl/unx/source/inc/magnify_mask.h
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * $RCSfile: magnify_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define magnify_mask_width 16
+#define magnify_mask_height 16
+static char magnify_mask_bits[] = {
+ 0xe0, 0x00, 0xf8, 0x03, 0xfc, 0x07, 0xfe, 0x0f, 0xfe, 0x0f, 0xff, 0x1f,
+ 0xff, 0x1f, 0xff, 0x1f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfc, 0x1f, 0xf8, 0x3f,
+ 0xe0, 0x7c, 0x00, 0xf8, 0x00, 0xf0, 0x00, 0xe0};
diff --git a/vcl/unx/source/inc/mirror_curs.h b/vcl/unx/source/inc/mirror_curs.h
new file mode 100644
index 000000000000..931eb7b47762
--- /dev/null
+++ b/vcl/unx/source/inc/mirror_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: mirror_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define mirror_curs_width 32
+#define mirror_curs_height 32
+#define mirror_curs_x_hot 14
+#define mirror_curs_y_hot 12
+static char mirror_curs_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff, 0x03, 0xf8, 0xf5, 0xff,
+ 0xfb, 0xfb, 0xee, 0xff, 0x0b, 0xfa, 0xf5, 0xff, 0xeb, 0xfa, 0xfa, 0xff,
+ 0xeb, 0xfa, 0xfa, 0xff, 0xeb, 0x7a, 0xfd, 0xff, 0xeb, 0x7a, 0xfd, 0xff,
+ 0xeb, 0xba, 0x7e, 0xff, 0xeb, 0xba, 0xbe, 0xfe, 0xeb, 0x5a, 0x5f, 0xfd,
+ 0x0b, 0x5a, 0xaf, 0xfa, 0xfb, 0xab, 0xd7, 0xf5, 0x03, 0xa8, 0xeb, 0xeb,
+ 0xff, 0xd7, 0xf5, 0xf5, 0xff, 0xd7, 0xfa, 0xfa, 0xff, 0x6b, 0x7d, 0xfd,
+ 0xff, 0xeb, 0xba, 0xfe, 0xff, 0xf5, 0x55, 0xff, 0xff, 0xf5, 0xab, 0xff,
+ 0xff, 0xfa, 0xd7, 0xff, 0x7f, 0xf7, 0xef, 0xff, 0xff, 0xfa, 0xff, 0xff,
+ 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/mirror_mask.h b/vcl/unx/source/inc/mirror_mask.h
new file mode 100644
index 000000000000..3337a2226d74
--- /dev/null
+++ b/vcl/unx/source/inc/mirror_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: mirror_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define mirror_mask_width 32
+#define mirror_mask_height 32
+static char mirror_mask_bits[] = {
+ 0x00, 0x00, 0x04, 0x00, 0xfe, 0x0f, 0x0e, 0x00, 0xfe, 0x0f, 0x1f, 0x00,
+ 0xfe, 0x8f, 0x3f, 0x00, 0xfe, 0x0f, 0x1f, 0x00, 0xfe, 0x8f, 0x0f, 0x00,
+ 0xbe, 0x8f, 0x0f, 0x00, 0xbe, 0xcf, 0x07, 0x00, 0xbe, 0xcf, 0x87, 0x00,
+ 0xbe, 0xef, 0xc3, 0x01, 0xbe, 0xef, 0xe3, 0x03, 0xfe, 0xff, 0xf1, 0x07,
+ 0xfe, 0xff, 0x79, 0x0f, 0xfe, 0xff, 0x3c, 0x1e, 0xfe, 0xff, 0x1e, 0x3c,
+ 0xfe, 0x7f, 0x0f, 0x1e, 0x00, 0xfc, 0x07, 0x0f, 0x00, 0xfe, 0x83, 0x07,
+ 0x00, 0xbe, 0xc7, 0x03, 0x00, 0x1f, 0xef, 0x01, 0x00, 0x1f, 0xfe, 0x00,
+ 0x80, 0x0f, 0x7c, 0x00, 0xc0, 0x1d, 0x38, 0x00, 0x80, 0x0f, 0x10, 0x00,
+ 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movebezierweight_curs.h b/vcl/unx/source/inc/movebezierweight_curs.h
new file mode 100644
index 000000000000..ceb4cb7404d1
--- /dev/null
+++ b/vcl/unx/source/inc/movebezierweight_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movebezierweight_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movebezierweight_curs_width 32
+#define movebezierweight_curs_height 32
+#define movebezierweight_curs_x_hot 0
+#define movebezierweight_curs_y_hot 0
+static char movebezierweight_curs_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff,
+ 0xf1, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff,
+ 0x81, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff,
+ 0x01, 0xfc, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0x91, 0xff, 0xff, 0xff,
+ 0x99, 0xff, 0xff, 0xef, 0x3d, 0xff, 0xff, 0xef, 0x3f, 0xff, 0xff, 0xef,
+ 0x7f, 0xfe, 0xff, 0xf7, 0x7f, 0xfe, 0xff, 0xf7, 0xff, 0xfc, 0xff, 0xfb,
+ 0xff, 0x7c, 0xff, 0xec, 0xff, 0xbf, 0x0e, 0xd7, 0xff, 0x7f, 0xf3, 0xef,
+ 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff,
+ 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/movebezierweight_mask.h b/vcl/unx/source/inc/movebezierweight_mask.h
new file mode 100644
index 000000000000..ed5235fcdd3b
--- /dev/null
+++ b/vcl/unx/source/inc/movebezierweight_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: movebezierweight_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movebezierweight_mask_width 32
+#define movebezierweight_mask_height 32
+static char movebezierweight_mask_bits[] = {
+ 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00,
+ 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x10,
+ 0xff, 0x00, 0x00, 0x38, 0xe7, 0x01, 0x00, 0x38, 0xe3, 0x01, 0x00, 0x38,
+ 0xc0, 0x03, 0x00, 0x1c, 0xc0, 0x03, 0x00, 0x1c, 0x80, 0x87, 0x00, 0x1f,
+ 0x80, 0xc7, 0xf1, 0x3f, 0x80, 0xe7, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x38,
+ 0x00, 0x80, 0x0f, 0x10, 0x00, 0x80, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00,
+ 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
+ 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movedata_curs.h b/vcl/unx/source/inc/movedata_curs.h
new file mode 100644
index 000000000000..7a59a9a4ec90
--- /dev/null
+++ b/vcl/unx/source/inc/movedata_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movedata_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movedata_curs_width 32
+#define movedata_curs_height 32
+#define movedata_curs_x_hot 1
+#define movedata_curs_y_hot 1
+static char movedata_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
+ 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00,
+ 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00,
+ 0x28, 0xa3, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00,
+ 0x10, 0x40, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00,
+ 0xa8, 0xaa, 0x00, 0x00, 0x50, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movedata_mask.h b/vcl/unx/source/inc/movedata_mask.h
new file mode 100644
index 000000000000..9b3af4d24282
--- /dev/null
+++ b/vcl/unx/source/inc/movedata_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movedata_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movedata_mask_width 32
+#define movedata_mask_height 32
+#define movedata_mask_x_hot 1
+#define movedata_mask_y_hot 1
+static char movedata_mask_bits[] = {
+ 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00,
+ 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00,
+ 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x3c, 0xe0, 0x01, 0x00,
+ 0x3c, 0xe0, 0x01, 0x00, 0x3c, 0xe0, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00,
+ 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movedlnk_curs.h b/vcl/unx/source/inc/movedlnk_curs.h
new file mode 100644
index 000000000000..1bfd85decca1
--- /dev/null
+++ b/vcl/unx/source/inc/movedlnk_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movedlnk_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movedlnk_curs_width 32
+#define movedlnk_curs_height 32
+#define movedlnk_curs_x_hot 1
+#define movedlnk_curs_y_hot 1
+static char movedlnk_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x7e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00,
+ 0xfe, 0x03, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00,
+ 0x66, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,
+ 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x10, 0x53, 0x00, 0x00,
+ 0x28, 0xa3, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xf0, 0x81, 0x00, 0x00,
+ 0x30, 0x41, 0x00, 0x00, 0x10, 0x81, 0x00, 0x00, 0xd0, 0x41, 0x00, 0x00,
+ 0xf0, 0xa9, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movedlnk_mask.h b/vcl/unx/source/inc/movedlnk_mask.h
new file mode 100644
index 000000000000..9fccbb7b72ff
--- /dev/null
+++ b/vcl/unx/source/inc/movedlnk_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movedlnk_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movedlnk_mask_width 32
+#define movedlnk_mask_height 32
+#define movedlnk_mask_x_hot 1
+#define movedlnk_mask_y_hot 1
+static char movedlnk_mask_bits[] = {
+ 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
+ 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00,
+ 0xe0, 0x03, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00,
+ 0xfc, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0xf8, 0xe3, 0x01, 0x00,
+ 0xf8, 0xe3, 0x01, 0x00, 0xf8, 0xe3, 0x01, 0x00, 0xf8, 0xff, 0x01, 0x00,
+ 0xf8, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0xfe, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movefile_curs.h b/vcl/unx/source/inc/movefile_curs.h
new file mode 100644
index 000000000000..99d565ac292f
--- /dev/null
+++ b/vcl/unx/source/inc/movefile_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movefile_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movefile_curs_width 32
+#define movefile_curs_height 32
+#define movefile_curs_x_hot 9
+#define movefile_curs_y_hot 9
+static char movefile_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00,
+ 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x04, 0x00, 0x00,
+ 0xfe, 0x02, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0xfe, 0x0e, 0x00, 0x00,
+ 0xfe, 0x1e, 0x00, 0x00, 0xfe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00,
+ 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00,
+ 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movefile_mask.h b/vcl/unx/source/inc/movefile_mask.h
new file mode 100644
index 000000000000..60c4291ce38a
--- /dev/null
+++ b/vcl/unx/source/inc/movefile_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movefile_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movefile_mask_width 32
+#define movefile_mask_height 32
+#define movefile_mask_x_hot 9
+#define movefile_mask_y_hot 9
+static char movefile_mask_bits[] = {
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00,
+ 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00,
+ 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00,
+ 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00,
+ 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00,
+ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movefiles_curs.h b/vcl/unx/source/inc/movefiles_curs.h
new file mode 100644
index 000000000000..4a68f87e1881
--- /dev/null
+++ b/vcl/unx/source/inc/movefiles_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movefiles_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movefiles_curs_width 32
+#define movefiles_curs_height 32
+#define movefiles_curs_x_hot 8
+#define movefiles_curs_y_hot 9
+static char movefiles_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xe0, 0x2f, 0x00, 0x00,
+ 0xe8, 0x0f, 0x00, 0x00, 0xe8, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00,
+ 0xea, 0x7f, 0x00, 0x00, 0xea, 0x7f, 0x00, 0x00, 0x6a, 0x7e, 0x00, 0x00,
+ 0x6a, 0x7d, 0x00, 0x00, 0x6a, 0x7b, 0x00, 0x00, 0x6a, 0x77, 0x00, 0x00,
+ 0x6a, 0x6f, 0x00, 0x00, 0x6a, 0x5f, 0x00, 0x00, 0x0a, 0x3f, 0x00, 0x00,
+ 0x7a, 0x7f, 0x00, 0x00, 0x02, 0xff, 0x00, 0x00, 0x7e, 0xff, 0x01, 0x00,
+ 0x00, 0x3f, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00,
+ 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movefiles_mask.h b/vcl/unx/source/inc/movefiles_mask.h
new file mode 100644
index 000000000000..2d7376344a81
--- /dev/null
+++ b/vcl/unx/source/inc/movefiles_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movefiles_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movefiles_mask_width 32
+#define movefiles_mask_height 32
+#define movefiles_mask_x_hot 8
+#define movefiles_mask_y_hot 9
+static char movefiles_mask_bits[] = {
+ 0xf0, 0x1f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00,
+ 0xfc, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00,
+ 0xff, 0xff, 0x03, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00,
+ 0x80, 0xff, 0x00, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0xf0, 0x01, 0x00,
+ 0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00,
+ 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/moveflnk_curs.h b/vcl/unx/source/inc/moveflnk_curs.h
new file mode 100644
index 000000000000..6f3c7374a700
--- /dev/null
+++ b/vcl/unx/source/inc/moveflnk_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: moveflnk_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define moveflnk_curs_width 32
+#define moveflnk_curs_height 32
+#define moveflnk_curs_x_hot 9
+#define moveflnk_curs_y_hot 9
+static char moveflnk_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x00, 0x00,
+ 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00,
+ 0xfe, 0x07, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00,
+ 0xbe, 0x02, 0x00, 0x00, 0xa6, 0x06, 0x00, 0x00, 0xa2, 0x0e, 0x00, 0x00,
+ 0xba, 0x1e, 0x00, 0x00, 0xbe, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00,
+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xfe, 0x03, 0x00,
+ 0x00, 0x7e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00,
+ 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/moveflnk_mask.h b/vcl/unx/source/inc/moveflnk_mask.h
new file mode 100644
index 000000000000..fc6e5ac17b4f
--- /dev/null
+++ b/vcl/unx/source/inc/moveflnk_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: moveflnk_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define moveflnk_mask_width 32
+#define moveflnk_mask_height 32
+#define moveflnk_mask_x_hot 9
+#define moveflnk_mask_y_hot 9
+static char moveflnk_mask_bits[] = {
+ 0xff, 0x01, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00,
+ 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00,
+ 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00,
+ 0x00, 0xff, 0x01, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00,
+ 0x00, 0xc0, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00,
+ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/movepoint_curs.h b/vcl/unx/source/inc/movepoint_curs.h
new file mode 100644
index 000000000000..17ff925c2dab
--- /dev/null
+++ b/vcl/unx/source/inc/movepoint_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: movepoint_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movepoint_curs_width 32
+#define movepoint_curs_height 32
+#define movepoint_curs_x_hot 0
+#define movepoint_curs_y_hot 0
+static char movepoint_curs_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff,
+ 0xf1, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff,
+ 0x81, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff,
+ 0x01, 0xfc, 0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0x91, 0xff, 0xff, 0xff,
+ 0x39, 0xff, 0xff, 0xff, 0x3d, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff,
+ 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xfc, 0x83, 0xff, 0xff, 0xfc, 0x83, 0xff,
+ 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0x83, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/vcl/unx/source/inc/movepoint_mask.h b/vcl/unx/source/inc/movepoint_mask.h
new file mode 100644
index 000000000000..d7fa0c7d6bd1
--- /dev/null
+++ b/vcl/unx/source/inc/movepoint_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: movepoint_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define movepoint_mask_width 32
+#define movepoint_mask_height 32
+static char movepoint_mask_bits[] = {
+ 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00,
+ 0xff, 0x07, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0xef, 0x01, 0x00, 0x00, 0xe7, 0x01, 0x00, 0x00, 0xc3, 0x03, 0x00, 0x00,
+ 0xc0, 0x03, 0xfe, 0x00, 0x80, 0x07, 0xfe, 0x00, 0x80, 0x07, 0xfe, 0x00,
+ 0x80, 0x07, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfe, 0x00,
+ 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/nodrop_curs.h b/vcl/unx/source/inc/nodrop_curs.h
new file mode 100644
index 000000000000..739b69fed185
--- /dev/null
+++ b/vcl/unx/source/inc/nodrop_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: nodrop_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define nodrop_curs_width 32
+#define nodrop_curs_height 32
+#define nodrop_curs_x_hot 9
+#define nodrop_curs_y_hot 9
+static char nodrop_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00,
+ 0xf8, 0x7f, 0x00, 0x00, 0x7c, 0xf8, 0x00, 0x00, 0x1c, 0xfc, 0x00, 0x00,
+ 0x1e, 0xfe, 0x01, 0x00, 0x0e, 0xdf, 0x01, 0x00, 0x8e, 0xcf, 0x01, 0x00,
+ 0xce, 0xc7, 0x01, 0x00, 0xee, 0xc3, 0x01, 0x00, 0xfe, 0xe1, 0x01, 0x00,
+ 0xfc, 0xe0, 0x00, 0x00, 0x7c, 0xf8, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00,
+ 0xf0, 0x3f, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/nodrop_mask.h b/vcl/unx/source/inc/nodrop_mask.h
new file mode 100644
index 000000000000..81ae6be5d3f0
--- /dev/null
+++ b/vcl/unx/source/inc/nodrop_mask.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: nodrop_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define nodrop_mask_width 32
+#define nodrop_mask_height 32
+#define nodrop_mask_x_hot 9
+#define nodrop_mask_y_hot 9
+static char nodrop_mask_bits[] = {
+ 0xc0, 0x0f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00,
+ 0xfc, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x7e, 0xfe, 0x01, 0x00,
+ 0x3f, 0xff, 0x03, 0x00, 0x9f, 0xff, 0x03, 0x00, 0xdf, 0xff, 0x03, 0x00,
+ 0xff, 0xef, 0x03, 0x00, 0xff, 0xe7, 0x03, 0x00, 0xff, 0xf3, 0x03, 0x00,
+ 0xfe, 0xf9, 0x01, 0x00, 0xfe, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x00, 0x00,
+ 0xf8, 0x7f, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/null_curs.h b/vcl/unx/source/inc/null_curs.h
new file mode 100644
index 000000000000..884c4dd480f3
--- /dev/null
+++ b/vcl/unx/source/inc/null_curs.h
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * $RCSfile: null_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define nullcurs_width 4
+#define nullcurs_height 4
+#define nullcurs_x_hot 2
+#define nullcurs_y_hot 2
+static char nullcurs_bits[] = { 0x00, 0x00 };
diff --git a/vcl/unx/source/inc/null_mask.h b/vcl/unx/source/inc/null_mask.h
new file mode 100644
index 000000000000..f1f8c1c7c5aa
--- /dev/null
+++ b/vcl/unx/source/inc/null_mask.h
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * $RCSfile: null_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define nullmask_width 4
+#define nullmask_height 4
+static char nullmask_bits[] = { 0x00, 0x00 };
diff --git a/vcl/unx/source/inc/pivotcol_curs.h b/vcl/unx/source/inc/pivotcol_curs.h
new file mode 100644
index 000000000000..7dc40c274e69
--- /dev/null
+++ b/vcl/unx/source/inc/pivotcol_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: pivotcol_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define pivotcol_curs_width 32
+#define pivotcol_curs_height 32
+#define pivotcol_curs_x_hot 10
+#define pivotcol_curs_y_hot 13
+static char pivotcol_curs_bits[] = {
+ 0xff,0xff,0xff,0xff,0x01,0x80,0x00,0x80,0x55,0x95,0x54,0x95,0xa9,0xaa,0xaa,
+ 0xaa,0x01,0x80,0x00,0x80,0xff,0xff,0xff,0xff,0x81,0x80,0x80,0x80,0x95,0xaa,
+ 0xaa,0xaa,0xa9,0x94,0x94,0x94,0x95,0xaa,0xaa,0xaa,0xa9,0x94,0x94,0x94,0x81,
+ 0x80,0x80,0x80,0xff,0xff,0xff,0xff,0x00,0x04,0x00,0x00,0x00,0x0c,0x00,0x00,
+ 0x00,0x14,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x84,0x00,
+ 0x00,0x00,0x04,0x01,0x00,0x00,0x04,0x02,0x00,0x00,0x04,0x04,0x00,0x00,0x04,
+ 0x08,0x00,0x00,0x04,0x1f,0x00,0x00,0x64,0x01,0x00,0x00,0x54,0x02,0x00,0x00,
+ 0x8c,0x02,0x00,0x00,0x84,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x09,0x00,
+ 0x00,0x00,0x0a,0x00,0x00,0x00,0x06,0x00};
diff --git a/vcl/unx/source/inc/pivotcol_mask.h b/vcl/unx/source/inc/pivotcol_mask.h
new file mode 100644
index 000000000000..75bba6d6dfc4
--- /dev/null
+++ b/vcl/unx/source/inc/pivotcol_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: pivotcol_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define pivotcol_mask_width 32
+#define pivotcol_mask_height 32
+#define pivotcol_mask_x_hot 10
+#define pivotcol_mask_y_hot 13
+static char pivotcol_mask_bits[] = {
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x04,0x00,0x00,0x00,0x0c,0x00,0x00,
+ 0x00,0x1c,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0xfc,0x00,
+ 0x00,0x00,0xfc,0x01,0x00,0x00,0xfc,0x03,0x00,0x00,0xfc,0x07,0x00,0x00,0xfc,
+ 0x0f,0x00,0x00,0xfc,0x1f,0x00,0x00,0xfc,0x01,0x00,0x00,0xdc,0x03,0x00,0x00,
+ 0x8c,0x03,0x00,0x00,0x84,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0f,0x00,
+ 0x00,0x00,0x0e,0x00,0x00,0x00,0x06,0x00};
diff --git a/vcl/unx/source/inc/pivotfld_curs.h b/vcl/unx/source/inc/pivotfld_curs.h
new file mode 100644
index 000000000000..a3ed760985f2
--- /dev/null
+++ b/vcl/unx/source/inc/pivotfld_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: pivotfld_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define pivotfld_curs_width 32
+#define pivotfld_curs_height 32
+#define pivotfld_curs_x_hot 10
+#define pivotfld_curs_y_hot 13
+static char pivotfld_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xff,0xff,0x3f,0x04,0x00,0x00,
+ 0x30,0xa4,0xaa,0xaa,0x3a,0x54,0x55,0x55,0x35,0xa4,0xaa,0xaa,0x3a,0x54,0x55,
+ 0x55,0x35,0xa4,0xaa,0xaa,0x3a,0x54,0x55,0x55,0x35,0xa4,0xaa,0xaa,0x3a,0xf4,
+ 0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,0x00,0x04,0x00,0x00,0x00,0x0c,0x00,0x00,
+ 0x00,0x14,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x84,0x00,
+ 0x00,0x00,0x04,0x01,0x00,0x00,0x04,0x02,0x00,0x00,0x04,0x04,0x00,0x00,0x04,
+ 0x08,0x00,0x00,0x04,0x1f,0x00,0x00,0x64,0x01,0x00,0x00,0x54,0x02,0x00,0x00,
+ 0x8c,0x02,0x00,0x00,0x84,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x09,0x00,
+ 0x00,0x00,0x0a,0x00,0x00,0x00,0x06,0x00};
diff --git a/vcl/unx/source/inc/pivotfld_mask.h b/vcl/unx/source/inc/pivotfld_mask.h
new file mode 100644
index 000000000000..2371fad5eea2
--- /dev/null
+++ b/vcl/unx/source/inc/pivotfld_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: pivotfld_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define pivotfld_mask_width 32
+#define pivotfld_mask_height 32
+#define pivotfld_mask_x_hot 10
+#define pivotfld_mask_y_hot 13
+static char pivotfld_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,
+ 0x3f,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,0xfc,0xff,
+ 0xff,0x3f,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,0xfc,
+ 0xff,0xff,0x3f,0xfc,0xff,0xff,0x3f,0x00,0x04,0x00,0x00,0x00,0x0c,0x00,0x00,
+ 0x00,0x1c,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0xfc,0x00,
+ 0x00,0x00,0xfc,0x01,0x00,0x00,0xfc,0x03,0x00,0x00,0xfc,0x07,0x00,0x00,0xfc,
+ 0x0f,0x00,0x00,0xfc,0x1f,0x00,0x00,0xfc,0x01,0x00,0x00,0xdc,0x03,0x00,0x00,
+ 0x8c,0x03,0x00,0x00,0x84,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x0f,0x00,
+ 0x00,0x00,0x0e,0x00,0x00,0x00,0x06,0x00};
diff --git a/vcl/unx/source/inc/pivotrow_curs.h b/vcl/unx/source/inc/pivotrow_curs.h
new file mode 100644
index 000000000000..19e230131d88
--- /dev/null
+++ b/vcl/unx/source/inc/pivotrow_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: pivotrow_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define pivotrow_curs_width 32
+#define pivotrow_curs_height 32
+#define pivotrow_curs_x_hot 22
+#define pivotrow_curs_y_hot 13
+static char pivotrow_curs_bits[] = {
+ 0xff,0xff,0x3f,0x00,0x01,0x04,0x20,0x00,0xa9,0xa4,0x2a,0x00,0x55,0x55,0x25,
+ 0x00,0xa9,0xa4,0x2a,0x00,0x55,0x55,0x25,0x00,0xa9,0x04,0x20,0x00,0x55,0xfd,
+ 0x3f,0x00,0xa9,0x04,0x20,0x00,0x55,0x55,0x25,0x00,0xa9,0xa4,0x2a,0x00,0x55,
+ 0x55,0x25,0x00,0xa9,0xa4,0x2a,0x00,0x55,0x55,0x65,0x00,0x01,0x04,0xe0,0x00,
+ 0xff,0xff,0x7f,0x01,0x01,0x04,0x60,0x02,0x55,0x55,0x65,0x04,0xa9,0xa4,0x6a,
+ 0x08,0x55,0x55,0x65,0x10,0xa9,0xa4,0x6a,0x20,0x55,0x55,0x65,0x40,0xa9,0x04,
+ 0x60,0x80,0x55,0xfd,0x7f,0xf0,0xa9,0x04,0x60,0x16,0x55,0x55,0x65,0x25,0xa9,
+ 0xa4,0xea,0x28,0x55,0x55,0x65,0x48,0xa9,0xa4,0x2a,0x50,0x55,0x55,0x25,0x90,
+ 0x01,0x04,0x20,0xa0,0xff,0xff,0x3f,0x60};
diff --git a/vcl/unx/source/inc/pivotrow_mask.h b/vcl/unx/source/inc/pivotrow_mask.h
new file mode 100644
index 000000000000..52419ae19532
--- /dev/null
+++ b/vcl/unx/source/inc/pivotrow_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: pivotrow_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define pivotrow_mask_width 32
+#define pivotrow_mask_height 32
+#define pivotrow_curs_x_hot 22
+#define pivotrow_curs_y_hot 13
+static char pivotrow_mask_bits[] = {
+ 0xff,0xff,0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,0xff,0x3f,
+ 0x00,0xff,0xff,0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,0xff,
+ 0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,
+ 0xff,0x3f,0x00,0xff,0xff,0x3f,0x00,0xff,0xff,0x7f,0x00,0xff,0xff,0xff,0x00,
+ 0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x07,0xff,0xff,0xff,
+ 0x0f,0xff,0xff,0xff,0x1f,0xff,0xff,0xff,0x3f,0xff,0xff,0xff,0x7f,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xff,0xff,0xff,0x3d,0xff,
+ 0xff,0xff,0x38,0xff,0xff,0x7f,0x78,0xff,0xff,0x3f,0x70,0xff,0xff,0x3f,0xf0,
+ 0xff,0xff,0x3f,0xe0,0xff,0xff,0x3f,0x60};
diff --git a/vcl/unx/source/inc/rotate_curs.h b/vcl/unx/source/inc/rotate_curs.h
new file mode 100644
index 000000000000..1a9d1628e728
--- /dev/null
+++ b/vcl/unx/source/inc/rotate_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: rotate_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define rotate_curs_width 32
+#define rotate_curs_height 32
+#define rotate_curs_x_hot 15
+#define rotate_curs_y_hot 15
+static char rotate_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
+ 0x00, 0xc0, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xd8, 0x00, 0x00,
+ 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00,
+ 0x80, 0x00, 0xc0, 0x01, 0x80, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00,
+ 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x02, 0x20, 0x00,
+ 0x00, 0x04, 0x10, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0xe0, 0x03, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/rotate_mask.h b/vcl/unx/source/inc/rotate_mask.h
new file mode 100644
index 000000000000..2ff24422007a
--- /dev/null
+++ b/vcl/unx/source/inc/rotate_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: rotate_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define rotate_mask_width 32
+#define rotate_mask_height 32
+static char rotate_mask_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
+ 0x00, 0xe0, 0x01, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xfc, 0x01, 0x00,
+ 0x00, 0xfe, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
+ 0x80, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01,
+ 0xc0, 0x01, 0xe0, 0x03, 0xc0, 0x01, 0xf0, 0x07, 0xc0, 0x01, 0xf0, 0x07,
+ 0x80, 0x03, 0xe0, 0x00, 0x80, 0x03, 0xe0, 0x00, 0x00, 0x07, 0x70, 0x00,
+ 0x00, 0x1e, 0x3c, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00,
+ 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/timemove_curs.h b/vcl/unx/source/inc/timemove_curs.h
new file mode 100644
index 000000000000..2f1a34027850
--- /dev/null
+++ b/vcl/unx/source/inc/timemove_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: timemove_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define timemove_curs_width 32
+#define timemove_curs_height 32
+#define timemove_curs_x_hot 16
+#define timemove_curs_y_hot 16
+static char timemove_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00,
+ 0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0xff,0xff,0x01,
+ 0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0xff,0xff,
+ 0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0xc0,
+ 0x07,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/timemove_mask.h b/vcl/unx/source/inc/timemove_mask.h
new file mode 100644
index 000000000000..b2715335a988
--- /dev/null
+++ b/vcl/unx/source/inc/timemove_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: timemove_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define timemove_mask_width 32
+#define timemove_mask_height 32
+#define timemove_mask_x_hot 16
+#define timemove_mask_y_hot 16
+static char timemove_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x0f,0x00,0x00,
+ 0xc0,0x07,0x00,0x00,0x80,0x03,0x00,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,
+ 0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,
+ 0x03,0x80,0xff,0xff,0x03,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,
+ 0x0f,0x00,0x00,0xc0,0x07,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0x01,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/timesize_curs.h b/vcl/unx/source/inc/timesize_curs.h
new file mode 100644
index 000000000000..7cc0d99926ae
--- /dev/null
+++ b/vcl/unx/source/inc/timesize_curs.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: timesize_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define timesize_curs_width 32
+#define timesize_curs_height 32
+#define timesize_curs_x_hot 16
+#define timesize_curs_y_hot 16
+static char timesize_curs_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xff,0xff,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
+ 0x01,0x01,0x01,0x00,0x81,0x03,0x01,0x00,0xc1,0x07,0x01,0x00,0x01,0x01,0x01,
+ 0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0xff,0xff,0x01,0x00,0x00,0x01,
+ 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0xc0,0x07,0x00,0x00,0x80,
+ 0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/timesize_mask.h b/vcl/unx/source/inc/timesize_mask.h
new file mode 100644
index 000000000000..036428e98202
--- /dev/null
+++ b/vcl/unx/source/inc/timesize_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: timesize_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define timesize_mask_width 32
+#define timesize_mask_height 32
+#define timesize_mask_x_hot 16
+#define timesize_mask_y_hot 16
+static char timesize_mask_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,
+ 0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,
+ 0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,
+ 0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,0x03,0x80,0xff,0xff,
+ 0x03,0x00,0x80,0x03,0x00,0x00,0xc0,0x07,0x00,0x00,0xe0,0x0f,0x00,0x00,0xc0,
+ 0x07,0x00,0x00,0x80,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff --git a/vcl/unx/source/inc/vshear_curs.h b/vcl/unx/source/inc/vshear_curs.h
new file mode 100644
index 000000000000..d5a2bc019770
--- /dev/null
+++ b/vcl/unx/source/inc/vshear_curs.h
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: vshear_curs.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define vshear_curs_width 32
+#define vshear_curs_height 32
+#define vshear_curs_x_hot 15
+#define vshear_curs_y_hot 15
+static char vshear_curs_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x04, 0x00,
+ 0x00, 0x20, 0x04, 0x00, 0x00, 0x30, 0x04, 0x00, 0x00, 0x30, 0x04, 0x00,
+ 0x00, 0x38, 0x04, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00,
+ 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00,
+ 0x00, 0x20, 0x1c, 0x00, 0x00, 0x20, 0x1c, 0x00, 0x00, 0x20, 0x0c, 0x00,
+ 0x00, 0x20, 0x0c, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/inc/vshear_mask.h b/vcl/unx/source/inc/vshear_mask.h
new file mode 100644
index 000000000000..9006fbb3f17f
--- /dev/null
+++ b/vcl/unx/source/inc/vshear_mask.h
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: vshear_mask.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#define vshear_mask_width 32
+#define vshear_mask_height 32
+static char vshear_mask_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x0e, 0x00,
+ 0x00, 0x70, 0x0e, 0x00, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x78, 0x0e, 0x00,
+ 0x00, 0x7c, 0x0e, 0x00, 0x00, 0x7c, 0x0e, 0x00, 0x00, 0x7c, 0x0e, 0x00,
+ 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x3e, 0x00,
+ 0x00, 0x70, 0x3e, 0x00, 0x00, 0x70, 0x3e, 0x00, 0x00, 0x70, 0x1e, 0x00,
+ 0x00, 0x70, 0x1e, 0x00, 0x00, 0x70, 0x0e, 0x00, 0x00, 0x70, 0x0e, 0x00,
+ 0x00, 0x70, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/vcl/unx/source/window/FWS.cxx b/vcl/unx/source/window/FWS.cxx
new file mode 100644
index 000000000000..3e340b104145
--- /dev/null
+++ b/vcl/unx/source/window/FWS.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * $RCSfile: FWS.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+#ifndef _FOREIGN_WINDOW_SYSTEM_HXX
+#include "FWS.hxx"
+#endif
+
+static Atom fwsIconAtom;
+
+static Atom FWS_CLIENT;
+static Atom FWS_COMM_WINDOW;
+static Atom FWS_PROTOCOLS;
+static Atom FWS_STACK_UNDER;
+static Atom FWS_PARK_ICONS;
+static Atom FWS_PASS_ALL_INPUT;
+static Atom FWS_PASSES_INPUT;
+static Atom FWS_HANDLES_FOCUS;
+
+static Atom FWS_REGISTER_WINDOW;
+static Atom FWS_STATE_CHANGE;
+static Atom FWS_UNSEEN_STATE;
+static Atom FWS_NORMAL_STATE;
+static Atom WM_PROTOCOLS;
+static Atom WM_CHANGE_STATE;
+
+static Bool fwsStackUnder;
+static Bool fwsParkIcons;
+static Bool fwsPassesInput;
+static Bool fwsHandlesFocus;
+
+static Window fwsCommWindow;
+
+/*************************************<->***********************************
+ *
+ * WMSupportsFWS() -
+ *
+ * Initialize our atoms and determine if the current window manager is
+ * providing FWS extension support.
+ *
+ *************************************<->***********************************/
+
+Bool
+WMSupportsFWS (Display *display, int screen)
+{
+ int i;
+ Atom protocol;
+ Atom propType;
+ int propFormat;
+ unsigned long propItems;
+ unsigned long propBytesAfter;
+ unsigned char *propData;
+ char propName[30];
+
+ FWS_CLIENT = XInternAtom(display, "_SUN_FWS_CLIENT", False);
+ FWS_COMM_WINDOW = XInternAtom(display, "_SUN_FWS_COMM_WINDOW", False);
+ FWS_PROTOCOLS = XInternAtom(display, "_SUN_FWS_PROTOCOLS", False);
+ FWS_STACK_UNDER = XInternAtom(display, "_SUN_FWS_STACK_UNDER", False);
+ FWS_PARK_ICONS = XInternAtom(display, "_SUN_FWS_PARK_ICONS", False);
+ FWS_PASS_ALL_INPUT = XInternAtom(display, "_SUN_FWS_PASS_ALL_INPUT", False);
+ FWS_PASSES_INPUT = XInternAtom(display, "_SUN_FWS_PASSES_INPUT", False);
+ FWS_HANDLES_FOCUS = XInternAtom(display, "_SUN_FWS_HANDLES_FOCUS", False);
+ FWS_REGISTER_WINDOW= XInternAtom(display, "_SUN_FWS_REGISTER_WINDOW",False);
+ FWS_STATE_CHANGE = XInternAtom(display, "_SUN_FWS_STATE_CHANGE", False);
+ FWS_UNSEEN_STATE = XInternAtom(display, "_SUN_FWS_UNSEEN_STATE", False);
+ FWS_NORMAL_STATE = XInternAtom(display, "_SUN_FWS_NORMAL_STATE", False);
+ WM_PROTOCOLS = XInternAtom(display, "WM_PROTOCOLS", False);
+ WM_CHANGE_STATE = XInternAtom(display, "WM_CHANGE_STATE", False);
+
+ sprintf (propName, "_SUN_FWS_NEXT_ICON_%d", screen);
+ fwsIconAtom = XInternAtom(display, propName, False);
+
+ if (XGetWindowProperty (display, DefaultRootWindow (display),
+ FWS_COMM_WINDOW, 0, 1,
+ False, AnyPropertyType, &propType,
+ &propFormat, &propItems,
+ &propBytesAfter, &propData) != Success)
+ return False;
+
+ if (propFormat != 32 ||
+ propItems != 1 ||
+ propBytesAfter != 0)
+ {
+ #ifdef DEBUG
+ fprintf (stderr, "Bad FWS_COMM_WINDOW property on root window.\n");
+ #endif
+ XFree (propData);
+ return False;
+ }
+
+ fwsCommWindow = *(Window *) propData;
+ #ifdef DEBUG
+ fprintf (stderr, "Using fwsCommWindow = 0x%lx.\n", fwsCommWindow);
+ #endif
+ XFree (propData);
+
+
+ if (XGetWindowProperty (display, DefaultRootWindow (display),
+ FWS_PROTOCOLS, 0, 10,
+ False, AnyPropertyType, &propType,
+ &propFormat, &propItems,
+ &propBytesAfter, &propData) != Success)
+ {
+ return False;
+ }
+
+ if (propFormat != 32 ||
+ propBytesAfter != 0)
+ {
+ #ifdef DEBUG
+ fprintf (stderr, "Bad FWS_PROTOCOLS property on root window.\n");
+ #endif
+ XFree (propData);
+ return False;
+ }
+
+ for (i = 0; i < propItems; ++i)
+ {
+ protocol = ((Atom *) propData)[i];
+ if (protocol == FWS_STACK_UNDER)
+ {
+ fwsStackUnder = True;
+ #ifdef DEBUG
+ fprintf (stderr, "Using fwsStackUnder.\n");
+ #endif
+ }
+ else
+ if (protocol == FWS_PARK_ICONS)
+ {
+ fwsParkIcons = True;
+ #ifdef DEBUG
+ fprintf (stderr, "Using fwsParkIcons.\n");
+ #endif
+ }
+ else
+ if (protocol == FWS_PASSES_INPUT)
+ {
+ fwsPassesInput = True;
+ #ifdef DEBUG
+ fprintf (stderr, "Using fwsPassesInput.\n");
+ #endif
+ }
+ else
+ if (protocol == FWS_HANDLES_FOCUS)
+ {
+ fwsHandlesFocus = True;
+ #ifdef DEBUG
+ fprintf (stderr, "Using fwsHandlesFocus.\n");
+ #endif
+ }
+ }
+
+ XFree (propData);
+ return True;
+}
+
+/*************************************<->***********************************
+ *
+ * newHandler() -
+ *
+ * Handle X errors (temporarily) to record the occurance of BadWindow
+ * errors without crashing. Used to detect the FWS_COMM_WINDOW root window
+ * property containing an old or obsolete window id.
+ *
+ *************************************<->***********************************/
+
+extern "C" {
+
+static Bool badWindowFound;
+static int (* oldHandler) (Display *, XErrorEvent *);
+
+static int
+newHandler (Display *display, XErrorEvent *xerror)
+{
+ if (xerror->error_code != BadWindow)
+ (*oldHandler)(display, xerror);
+ else
+ badWindowFound = True;
+
+ return 0;
+}
+
+}
+
+/*************************************<->***********************************
+ *
+ * RegisterFwsWindow() -
+ *
+ * Send a client message to the FWS_COMM_WINDOW indicating the existance
+ * of a new FWS client window. Be careful to avoid BadWindow errors on
+ * the XSendEvent in case the FWS_COMM_WINDOW root window property had
+ * old/obsolete junk in it.
+ *
+ *************************************<->***********************************/
+
+Bool
+RegisterFwsWindow (Display *display, Window window)
+{
+ XClientMessageEvent msg;
+
+ msg.type = ClientMessage;
+ msg.window = fwsCommWindow;
+ msg.message_type = FWS_REGISTER_WINDOW;
+ msg.format = 32;
+ msg.data.l[0] = window;
+
+ XSync (display, False);
+ badWindowFound = False;
+ oldHandler = XSetErrorHandler (newHandler);
+
+ XSendEvent (display, fwsCommWindow, False, NoEventMask,
+ (XEvent *) &msg);
+ XSync (display, False);
+
+ XSetErrorHandler (oldHandler);
+ #ifdef DEBUG
+ if (badWindowFound)
+ fprintf (stderr, "No FWS client window to register with.\n");
+ #endif
+
+ return !badWindowFound;
+}
+
+/*************************************<->***********************************
+ *
+ * AddFwsProtocols -
+ *
+ * Add the FWS protocol atoms to the WMProtocols property for the window.
+ *
+ *************************************<->***********************************/
+
+void
+AddFwsProtocols (Display *display, Window window)
+{
+ #define MAX_FWS_PROTOS 10
+
+ Atom fwsProtocols[ MAX_FWS_PROTOS ];
+ int nProtos = 0;
+
+ fwsProtocols[ nProtos++ ] = FWS_CLIENT;
+ fwsProtocols[ nProtos++ ] = FWS_STACK_UNDER;
+ fwsProtocols[ nProtos++ ] = FWS_STATE_CHANGE;
+ fwsProtocols[ nProtos++ ] = FWS_PASS_ALL_INPUT;
+ XChangeProperty (display, window, WM_PROTOCOLS,
+ XA_ATOM, 32, PropModeAppend,
+ (unsigned char *) fwsProtocols, nProtos);
+}
+
diff --git a/vcl/unx/source/window/FWS.hxx b/vcl/unx/source/window/FWS.hxx
new file mode 100644
index 000000000000..b70997ff7c96
--- /dev/null
+++ b/vcl/unx/source/window/FWS.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * $RCSfile: FWS.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FOREIGN_WINDOW_SYSTEM_HXX
+#define _FOREIGN_WINDOW_SYSTEM_HXX
+
+#include <X11/Xlib.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* Initialize our atoms and determine if the current window manager is
+ * providing FWS extension support.
+ */
+
+Bool
+WMSupportsFWS (Display *display, int screen);
+
+/* Send a client message to the FWS_COMM_WINDOW indicating the existance
+ * of a new FWS client window. Be careful to avoid BadWindow errors on
+ * the XSendEvent in case the FWS_COMM_WINDOW root window property had
+ * old/obsolete junk in it.
+ */
+
+Bool
+RegisterFwsWindow (Display *display, Window window);
+
+/* Add the FWS protocol atoms to the WMProtocols property for the window.
+ */
+
+void
+AddFwsProtocols (Display *display, Window window);
+
+#if defined(__cplusplus)
+} /* extern "C" */
+#endif
+
+#endif _FOREIGN_WINDOW_SYSTEM_HXX
+
diff --git a/vcl/unx/source/window/makefile.mk b/vcl/unx/source/window/makefile.mk
new file mode 100644
index 000000000000..69d4cf6196dd
--- /dev/null
+++ b/vcl/unx/source/window/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salwin
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(OS)"=="MACOSX"
+
+dummy:
+ @echo "Nothing to build for Mac OS X"
+
+.ELSE # "$(OS)"=="MACOSX"
+
+.IF "$(remote)"
+SLOFILES= \
+ $(SLO)/FWS.obj $(SLO)/salframe.obj $(SLO)/salobj.obj
+.ENDIF
+
+.ENDIF # "$(OS)"=="MACOSX"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
new file mode 100644
index 000000000000..bde3233e1699
--- /dev/null
+++ b/vcl/unx/source/window/salframe.cxx
@@ -0,0 +1,2614 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALFRAME_CXX
+
+// -=-= #includes =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <alloca.h>
+
+#include <prex.h>
+#include <X11/Xatom.h>
+#include <X11/keysym.h>
+
+#ifndef _FOREIGN_WINDOW_SYSTEM_HXX
+#include "FWS.hxx"
+#endif
+
+#include <postx.h>
+
+#include <salunx.h>
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_KEYCOES_HXX
+#include <keycodes.hxx>
+#endif
+#ifndef _SV_SOICON_HXX
+#include <soicon.hxx>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+#ifndef _SV_DTINT_HXX
+#include <dtint.hxx>
+#endif
+#ifndef _VCL_SM_HXX
+#include <sm.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+
+#include <svapp.hxx>
+
+#ifndef _SAL_I18N_INPUTCONTEXT_HXX
+#include "i18n_ic.hxx"
+#endif
+
+// -=-= #defines -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define SHOWSTATE_UNKNOWN -1
+#define SHOWSTATE_MINIMIZED 0
+#define SHOWSTATE_NORMAL 1
+
+// | KeymapStateMask
+#define CLIENT_EVENTS StructureNotifyMask \
+ | SubstructureNotifyMask \
+ | KeyPressMask \
+ | KeyReleaseMask \
+ | ButtonPressMask \
+ | ButtonReleaseMask \
+ | PointerMotionMask \
+ | EnterWindowMask \
+ | LeaveWindowMask \
+ | FocusChangeMask \
+ | ExposureMask \
+ | VisibilityChangeMask \
+ | PropertyChangeMask \
+ | ColormapChangeMask
+
+// | ButtonPressMask | ButtonRelaseMask
+//#define NC_EVENTS KeyPressMask \
+// | KeyReleaseMask \
+// | PointerMotionMask \
+// | EnterWindowMask \
+// | LeaveWindowMask \
+// | ExposureMask
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define _GetDrawable() maFrameData.GetDrawable()
+#define _GetDisplay() maFrameData.pDisplay_
+#define _GetXDisplay() maFrameData.GetXDisplay()
+#define _GetColormap() maFrameData.GetColormap()
+#define _GetPaintRegion() maFrameData.GetPaintRegion()
+#define _GetStyle() maFrameData.nStyle_
+#define _IsMapped() maFrameData.bMapped_
+
+// -=-= C++ statics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+static long sal_CallbackDummy( void*, SalFrame*, USHORT, const void* )
+{ return 0; }
+
+// -=-= SalInstance =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+SalFrame *SalInstance::CreateFrame( SalFrame *pParent,
+ ULONG nSalFrameStyle )
+{
+ SalFrame *pFrame = new SalFrame;
+
+ pFrame->maFrameData.mpParent = pParent;
+ if( pParent )
+ pParent->maFrameData.maChildren.Insert( pFrame );
+ pFrame->maFrameData.Init( nSalFrameStyle );
+
+ return pFrame;
+}
+
+SalFrame* SalInstance::CreateChildFrame( SystemParentData* pParentData, ULONG nStyle )
+{
+ SalFrame* pFrame = new SalFrame;
+ pFrame->maFrameData.mpParent = NULL;
+ pFrame->maFrameData.Init( nStyle, pParentData );
+
+ return pFrame;
+}
+
+void SalInstance::DestroyFrame( SalFrame* pFrame )
+{
+ delete pFrame;
+}
+
+// -=-= SalGraphics / SalGraphicsData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalGraphicsData::Init( SalFrame *pFrame )
+{
+ xColormap_ = &pFrame->_GetColormap();
+ hDrawable_ = pFrame->_GetDrawable();
+
+ bWindow_ = TRUE;
+
+ nPenPixel_ = GetPixel( nPenColor_ );
+ nTextPixel_ = GetPixel( nTextColor_ );
+ nBrushPixel_ = GetPixel( nBrushColor_ );
+}
+
+// -=-= SalFrame / SalFrameData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::Init( USHORT nSalFrameStyle, SystemParentData* pParentData )
+{
+ nStyle_ = nSalFrameStyle;
+
+ XWMHints Hints;
+ Hints.flags = 0;
+
+ if( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT )
+ {
+ hShell_ = pDisplay_->GetShellWidget();
+ hComposite_ = pDisplay_->GetWidget();
+
+ XSelectInput( GetXDisplay(), XtWindow( hShell_ ), CLIENT_EVENTS );
+ XSelectInput( GetXDisplay(), XtWindow( hComposite_ ), CLIENT_EVENTS );
+
+ Hints.flags |= InputHint|IconPixmapHint;
+ Hints.input = True;
+ Hints.icon_pixmap = GetAppIconPixmap( pDisplay_ );
+ Hints.icon_mask = GetAppIconMask( pDisplay_ );
+ if( Hints.icon_mask )
+ Hints.flags |= IconMaskHint;
+ }
+ else if( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT )
+ {
+ Arg aArgs[10];
+ int nArgs = 0;
+
+ SalVisual* pVis = GetDisplay()->GetVisual();
+ XtSetArg( aArgs[nArgs], XtNvisual, pVis->GetVisual() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNdepth, pVis->GetDepth() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNcolormap,
+ GetDisplay()->GetColormap().GetXColormap() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNwidth, 10 ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNheight, 10 ); nArgs++;
+
+ hShell_ = XtAppCreateShell( NULL, NULL,
+ overrideShellWidgetClass,
+ pDisplay_->GetDisplay(),
+ aArgs, nArgs );
+
+ XtSetMappedWhenManaged( hShell_, FALSE );
+ XtRealizeWidget( hShell_ );
+
+ hComposite_ = XtVaCreateManagedWidget(
+ "ShellComposite",
+ SAL_COMPOSITE_WIDGET,
+ hShell_,
+ NULL );
+ XtRealizeWidget( hComposite_ );
+#ifdef DEBUG
+ fprintf( stderr, "created new FLOAT style shell\n" );
+#endif
+ }
+ else if( nSalFrameStyle & SAL_FRAME_STYLE_CHILD && pParentData )
+ {
+ int x_ret, y_ret;
+ unsigned int w, h, bw, d;
+ XLIB_Window aRoot;
+ XLIB_Window aParent;
+
+ XGetGeometry( GetDisplay()->GetDisplay(), pParentData->aWindow,
+ &aRoot, &x_ret, &y_ret, &w, &h, &bw, &d );
+
+ Arg aArgs[10];
+ int nArgs = 0;
+
+ SalVisual* pVis = GetDisplay()->GetVisual();
+ XtSetArg( aArgs[nArgs], XtNvisual, pVis->GetVisual() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNdepth, pVis->GetDepth() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNcolormap,
+ GetDisplay()->GetColormap().GetXColormap() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNwidth, w ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNheight, h ); nArgs++;
+
+ hShell_ = XtAppCreateShell( NULL, NULL,
+ overrideShellWidgetClass,
+ pDisplay_->GetDisplay(),
+ aArgs, nArgs );
+
+ XtSetMappedWhenManaged( hShell_, FALSE );
+ XtRealizeWidget( hShell_ );
+
+ XEvent aEvent;
+ XReparentWindow( GetDisplay()->GetDisplay(), XtWindow( hShell_ ),
+ pParentData->aWindow, 0, 0 );
+ GetDisplay()->GetXLib()->SetIgnoreXErrors( TRUE ); // hack for plugin
+ XSync( GetDisplay()->GetDisplay(), False );
+
+ while( ! XCheckTypedWindowEvent( GetDisplay()->GetDisplay(),
+ XtWindow( hShell_ ),
+ ReparentNotify,
+ &aEvent ) )
+ {
+ usleep(10000);
+ }
+
+ hComposite_ = XtVaCreateManagedWidget(
+ "ShellComposite",
+ SAL_COMPOSITE_WIDGET,
+ hShell_,
+ NULL );
+ XtRealizeWidget( hComposite_ );
+
+ hForeignParent_ = pParentData->aWindow;
+ // get foreign top level window
+ // we need the ConfigureNotifies of this window
+ // to update the positions of this frame's children of
+ // type SAL_FRAME_STYLE_FLOAT
+ aParent = hForeignParent_;
+ hForeignTopLevelWindow_ = hForeignParent_;
+ XLIB_Window* pChildren;
+ unsigned int nChildren;
+ do
+ {
+ XQueryTree( GetDisplay()->GetDisplay(), hForeignTopLevelWindow_,
+ &aRoot, &aParent, &pChildren, &nChildren );
+ XFree( pChildren );
+ if( aParent != aRoot )
+ hForeignTopLevelWindow_ = aParent;
+ } while( aParent != aRoot );
+
+ // check if this is really one of our own frames
+ // do not change the input mask in that case
+ SalFrame* pFrame = GetSalData()->pFirstFrame_;
+ while( pFrame &&
+ hForeignParent_ != pFrame->maFrameData.GetWindow() &&
+ hForeignParent_ != pFrame->maFrameData.GetShellWindow() )
+ pFrame = pFrame->maFrameData.pNextFrame_;
+
+ if( ! pFrame )
+ {
+ XSelectInput( GetDisplay()->GetDisplay(), hForeignParent_, StructureNotifyMask );
+ XSelectInput( GetDisplay()->GetDisplay(), hForeignTopLevelWindow_, StructureNotifyMask );
+ }
+
+ SetPosSize( Rectangle( Point( 0, 0 ), Size( w, h ) ) );
+ }
+ else
+ {
+ SalVisual *pVisual = pDisplay_->GetVisual();
+
+ int w = 500;
+ int h = 400;
+ if( pDisplay_->GetProperties() & PROPERTY_FEATURE_Maximize )
+ {
+ w = pDisplay_->GetScreenSize().Width();
+ h = pDisplay_->GetScreenSize().Height();
+ }
+
+ Arg aArgs[10];
+ int nArgs=0;
+ SalVisual* pVis = GetDisplay()->GetVisual();
+ XtSetArg( aArgs[nArgs], XtNvisual, pVis->GetVisual() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNdepth, pVis->GetDepth() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNcolormap,
+ GetDisplay()->GetColormap().GetXColormap() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNwidth, w ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNheight, h ); nArgs++;
+ if( mpParent )
+ XtSetArg( aArgs[nArgs], XtNtransientFor, mpParent->maFrameData.GetShellWidget() ), nArgs++;
+ if( ! ( nStyle_ & ~SAL_FRAME_STYLE_DEFAULT ) )
+ {
+ XtSetArg( aArgs[nArgs], XtNoverrideRedirect, True ); nArgs++;
+ }
+
+ hShell_ = XtAppCreateShell( "", "VCLSalFrame",
+ mpParent
+ ? transientShellWidgetClass :
+ applicationShellWidgetClass,
+ GetXDisplay(),
+ aArgs, nArgs );
+
+ // X-Window erzeugen
+ XtSetMappedWhenManaged( hShell_, FALSE );
+ XtRealizeWidget( hShell_ );
+
+ hComposite_ = XtVaCreateManagedWidget(
+ "ShellComposite",
+ SAL_COMPOSITE_WIDGET,
+ hShell_,
+ NULL );
+ XtRealizeWidget( hComposite_ );
+
+ XWMHints *pHints = XGetWMHints( GetXDisplay(),
+ pDisplay_->GetWindow() );
+
+ if( pHints
+ && pHints->flags & IconMaskHint
+ && pHints->flags & IconPixmapHint )
+ {
+ Hints.flags |= IconMaskHint|IconPixmapHint;
+ Hints.icon_pixmap = pHints->icon_pixmap;
+ Hints.icon_mask = pHints->icon_mask;
+ XFree( pHints );
+ }
+ else
+ {
+ Hints.flags |= IconPixmapHint;
+ Hints.icon_pixmap = GetAppIconPixmap( pDisplay_ );
+ Hints.icon_mask = GetAppIconMask( pDisplay_ );
+ if( Hints.icon_mask )
+ Hints.flags |= IconMaskHint;
+ }
+
+ Hints.flags |= WindowGroupHint;
+ Hints.window_group = pDisplay_->GetShellWindow();
+
+ }
+
+ if( hShell_ )
+ XSetWindowBackgroundPixmap( pDisplay_->GetDisplay(), XtWindow( hShell_ ), None );
+ if( hComposite_ )
+ XSetWindowBackgroundPixmap( pDisplay_->GetDisplay(), XtWindow( hComposite_ ), None );
+
+ if( ! ( nSalFrameStyle & SAL_FRAME_STYLE_CHILD && pParentData ) )
+ {
+ XSetWMHints( GetXDisplay(), XtWindow( hShell_ ), &Hints );
+
+
+ // WM Protocols && internals
+ Atom a[4];
+ int n = 0;
+
+ a[n++] = pDisplay_->GetICCCM().aWM_DeleteWindow_;
+ a[n++] = pDisplay_->GetICCCM().aWM_SaveYourself_;
+
+ XSetWMProtocols( GetXDisplay(), XtWindow( hShell_ ), a, n );
+ }
+
+ // Pointer
+ pFrame_->SetPointer( POINTER_ARROW );
+
+ // Setup for use of InputMethod
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE
+ && nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE )
+ {
+ mpInputContext = new SalI18N_InputContext( pFrame_ );
+ if ( mpInputContext->UseContext() )
+ {
+ mpInputContext->ExtendEventMask( XtWindow( hShell_ ) );
+ mpInputContext->Unmap();
+ }
+ }
+ else
+ {
+ mpInputContext = NULL;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline SalFrameData::SalFrameData( SalFrame *pFrame )
+{
+ SalData* pSalData = GetSalData();
+
+ // insert frame in framelist
+ pNextFrame_ = pSalData->pFirstFrame_;
+ pSalData->pFirstFrame_ = pFrame;
+ pFrame_ = pFrame;
+
+ pProc_ = sal_CallbackDummy;
+ pInst_ = (void*)ILLEGAL_POINTER;
+
+ pDisplay_ = pSalData->GetCurDisp();
+ hShell_ = NULL;
+ hComposite_ = NULL;
+ hForeignParent_ = None;
+ hNoFullscreenShell_ = NULL;
+ hNoFullscreenComposite_ = NULL;
+
+ pGraphics_ = NULL;
+ pFreeGraphics_ = NULL;
+ pPaintRegion_ = NULL;
+
+ hCursor_ = None;
+ nCaptured_ = 0;
+
+ nReleaseTime_ = 0;
+ nKeyCode_ = 0;
+ nKeyState_ = 0;
+ nCompose_ = -1;
+
+ nShowState_ = SHOWSTATE_UNKNOWN;
+ nLeft_ = 0;
+ nTop_ = 0;
+ nRight_ = 0;
+ nBottom_ = 0;
+ nMaxWidth_ = 0;
+ nMaxHeight_ = 0;
+ nWidth_ = 0;
+ nHeight_ = 0;
+ nStyle_ = 0;
+ bAlwaysOnTop_ = FALSE;
+ // #58928# fake to be mapped on startup, because the sclient may be
+ // resized before mapping and the
+ // SetPosSize / call(salevent_resize) / GetClientSize
+ // stuff will not work in that (unmapped) case
+ bViewable_ = TRUE;
+ bMapped_ = FALSE;
+ bDefaultPosition_ = TRUE;
+ nVisibility_ = VisibilityFullyObscured;
+
+ nScreenSaversTimeout_ = 0;
+
+ mpInputContext = NULL;
+}
+
+SalFrame::SalFrame() : maFrameData( this ) {}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline SalFrameData::~SalFrameData()
+{
+ if ( mpInputContext != NULL )
+ delete mpInputContext;
+
+ if( pGraphics_ )
+ {
+ stderr0( "SalFrameData::~SalFrameData pGraphics_\n" );
+ pGraphics_->maGraphicsData.DeInit();
+ delete pGraphics_;
+ }
+
+ if( pFreeGraphics_ )
+ {
+ pFreeGraphics_->maGraphicsData.DeInit();
+ delete pFreeGraphics_;
+ }
+
+ if( hShell_ != pDisplay_->GetWidget() )
+ XtDestroyWidget( hShell_ );
+
+ SalData* pSalData = GetSalData();
+
+ if( pFrame_ == pSalData->pFirstFrame_ )
+ pSalData->pFirstFrame_ = GetNextFrame();
+ else
+ {
+ SalFrameData *pTemp = &pSalData->pFirstFrame_->maFrameData;
+ while( pTemp->GetNextFrame() != pFrame_ )
+ pTemp = &pTemp->GetNextFrame()->maFrameData;
+
+ pTemp->pNextFrame_ = GetNextFrame();
+ }
+}
+
+SalFrame::~SalFrame()
+{
+ // aus papis child liste entfernen
+ if( maFrameData.mpParent )
+ maFrameData.mpParent->maFrameData.maChildren.Remove( this );
+ // einige kommen trotzdem immer noch durch
+ XSelectInput( _GetXDisplay(), maFrameData.GetShellWindow(), 0 );
+ XSelectInput( _GetXDisplay(), maFrameData.GetWindow(), 0 );
+
+ ShowFullScreen( FALSE );
+
+ if( _IsMapped() )
+ Show( FALSE );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// irgendwann auf Liste umstellen
+
+const SystemChildData* SalFrame::GetSystemData() const
+{
+ SalFrame *pFrame = const_cast<SalFrame*>(this);
+ pFrame->maFrameData.maSystemChildData.nSize = sizeof( SystemChildData );
+ pFrame->maFrameData.maSystemChildData.pDisplay = _GetXDisplay();
+ pFrame->maFrameData.maSystemChildData.aWindow = pFrame->maFrameData.GetWindow();
+ pFrame->maFrameData.maSystemChildData.pSalFrame = pFrame;
+ pFrame->maFrameData.maSystemChildData.pWidget = pFrame->maFrameData.GetWidget();
+ pFrame->maFrameData.maSystemChildData.pVisual = _GetDisplay()->GetVisual()->GetVisual();
+ pFrame->maFrameData.maSystemChildData.nDepth = _GetDisplay()->GetVisual()->GetDepth();
+ pFrame->maFrameData.maSystemChildData.aColormap = _GetDisplay()->GetColormap().GetXColormap();
+ pFrame->maFrameData.maSystemChildData.pAppContext = _GetDisplay()->GetXLib()->GetAppContext();
+ return &maFrameData.maSystemChildData;
+}
+
+SalGraphics *SalFrameData::GetGraphics()
+{
+ if( pGraphics_ )
+ return NULL;
+
+ if( pFreeGraphics_ )
+ {
+ pGraphics_ = pFreeGraphics_;
+ pFreeGraphics_ = NULL;
+ }
+ else
+ {
+ pGraphics_ = new SalGraphics;
+ pGraphics_->maGraphicsData.Init( pFrame_ );
+ }
+
+ return pGraphics_;
+}
+
+SalGraphics *SalFrame::GetGraphics()
+{ return maFrameData.GetGraphics(); }
+
+void SalFrame::ReleaseGraphics( SalGraphics *pGraphics )
+{
+ if( pGraphics != maFrameData.pGraphics_ )
+ {
+ stderr0( "SalFrame::ReleaseGraphics pGraphics!=pGraphics_" );
+ return;
+ }
+
+ maFrameData.pFreeGraphics_ = pGraphics;
+ maFrameData.pGraphics_ = NULL;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+void SalFrame::Enable( BOOL bEnable )
+{
+ // NYI: enable/disable frame
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+void SalFrame::SetIcon( USHORT nIcon )
+{
+ // NYI: set a specific icon
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+void SalFrame::SetMinClientSize( long nWidth, long nHeight )
+{
+ if( maFrameData.hShell_ )
+ {
+ Arg args[10];
+ int n = 0;
+ XtSetArg( args[n++], XtNminWidth, nWidth );
+ XtSetArg( args[n++], XtNminHeight, nHeight );
+ XtSetValues( maFrameData.hShell_, args, n );
+ }
+}
+
+// Show + Pos (x,y,z) + Size (width,height)
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::Show( BOOL bVisible )
+{
+ maFrameData.bMapped_ = bVisible;
+ maFrameData.bViewable_ = bVisible;
+ if( bVisible )
+ {
+ if( maFrameData.nStyle_ & ( SAL_FRAME_STYLE_CHILD | SAL_FRAME_STYLE_FLOAT ) )
+ XtPopup( maFrameData.hShell_, XtGrabNone );
+ else
+ XtMapWidget( maFrameData.hShell_ );
+ // Manch ein WM verschluckt Key Events im Fullscreenmode ...
+ XSelectInput( _GetXDisplay(), maFrameData.GetShellWindow(), CLIENT_EVENTS );
+ XSelectInput( _GetXDisplay(), maFrameData.GetWindow(), CLIENT_EVENTS );
+
+ if( !maFrameData.aPosSize_.IsEmpty()
+ && (maFrameData.nWidth_ != maFrameData.aPosSize_.GetWidth()
+ || maFrameData.nHeight_ != maFrameData.aPosSize_.GetHeight()) )
+ {
+ maFrameData.nWidth_ = maFrameData.aPosSize_.GetWidth();
+ maFrameData.nHeight_ = maFrameData.aPosSize_.GetHeight();
+
+ maFrameData.Call( SALEVENT_RESIZE, NULL );
+ }
+
+ if( !_GetStyle() || maFrameData.hNoFullscreenShell_ )
+ {
+ XSync( _GetXDisplay(), False );
+ XSetInputFocus( _GetXDisplay(), maFrameData.GetShellWindow(), RevertToNone, CurrentTime );
+ }
+
+ XSync( _GetXDisplay(), False );
+ maFrameData.Call( SALEVENT_RESIZE, NULL );
+ }
+ else
+ {
+ if( maFrameData.nStyle_ & ( SAL_FRAME_STYLE_CHILD | SAL_FRAME_STYLE_FLOAT ) )
+ XtPopdown( maFrameData.hShell_ );
+ else
+ XtUnmapWidget( maFrameData.hShell_ );
+
+ if( !_GetStyle() || maFrameData.hNoFullscreenShell_ )
+ {
+ SalFrameData *pTemp = &GetSalData()->pFirstFrame_->maFrameData;
+ while( pTemp )
+ {
+ if( &maFrameData != pTemp
+ && _GetDisplay() == pTemp->pDisplay_
+ && SHOWSTATE_NORMAL == pTemp->nShowState_
+ && pTemp->bMapped_ )
+ {
+ /* #62634# */
+ XWindowAttributes window_attributes;
+ XGetWindowAttributes( _GetXDisplay(),
+ XtWindow( pTemp->hShell_ ), &window_attributes);
+ /* racing condition, we called ::Show(1), but the
+ * window may not be ready (i.e. bMapped_ != map_state) */
+ if ( window_attributes.map_state != IsViewable )
+ {
+ XtMapWidget( pTemp->hShell_ );
+ XSync( _GetXDisplay(), False );
+ }
+
+ /* #69412# double check whether the window is successfully mapped,
+ since fvwm2 prohibits the mapping of the initial frame, depending
+ on its window positioning policy for new windows */
+ XGetWindowAttributes( _GetXDisplay(), XtWindow( pTemp->hShell_ ), &window_attributes);
+ if ( window_attributes.map_state == IsViewable )
+ {
+ XSetInputFocus( _GetXDisplay(), XtWindow( pTemp->hShell_ ) ,
+ RevertToNone, CurrentTime );
+ }
+ break;
+ }
+ pTemp = &pTemp->pNextFrame_->maFrameData;
+ }
+ }
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+beta void SalFrame::ToTop( USHORT nFlags )
+{
+ int i;
+ // if one of our children is in fullscreen mode, ignore the to top
+ // and raise it instead. This will not work for grandchildren
+ // #58714#
+ for( i = 0; i < maFrameData.maChildren.Count(); i++ )
+ {
+ Widget pChild = maFrameData.maChildren.GetObject( i )->
+ maFrameData.hNoFullscreenShell_;
+ if( pChild )
+ {
+ XRaiseWindow( _GetXDisplay(), XtWindow( pChild ) );
+ return;
+ }
+ }
+
+ if( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
+ XtMapWidget( maFrameData.hShell_ );
+
+ XRaiseWindow( _GetXDisplay(), maFrameData.GetShellWindow() );
+ for( i=0; i < maFrameData.maChildren.Count(); i++ )
+ maFrameData.maChildren.GetObject( i )->ToTop( nFlags );
+ //XSetInputFocus( _GetXDisplay(), _GetShellWindow(), RevertToNone, CurrentTime );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::GetClientSize( long &rWidth, long &rHeight )
+{
+ if( ! maFrameData.bViewable_ && ! maFrameData.hNoFullscreenShell_ )
+ {
+ rWidth = rHeight = 0;
+ return;
+ }
+
+ rWidth = maFrameData.aPosSize_.GetWidth();
+ rHeight = maFrameData.aPosSize_.GetHeight();
+
+ if( !rWidth || !rHeight )
+ {
+ if( SHOWSTATE_UNKNOWN != maFrameData.nShowState_ ) abort();
+
+ XWindowAttributes aAttrib;
+
+ XGetWindowAttributes( _GetXDisplay(), maFrameData.GetShellWindow(), &aAttrib );
+
+ rWidth = aAttrib.width;
+ rHeight = aAttrib.height;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::SetClientSize( long nWidth, long nHeight )
+{
+ if( maFrameData.nStyle_ & SAL_FRAME_STYLE_CHILD )
+ return;
+
+ if( maFrameData.nStyle_ & SAL_FRAME_STYLE_FLOAT )
+ {
+ maFrameData.SetPosSize( Rectangle(
+ Point( maFrameData.aPosSize_.Left(), maFrameData.aPosSize_.Top() ),
+ Size( nWidth, nHeight ) ) );
+ return;
+ }
+
+ XLIB_Window aDummy;
+ int nX, nY, nScreenWidth, nScreenHeight;
+
+ nScreenWidth = _GetDisplay()->GetScreenSize().Width();
+ nScreenHeight = _GetDisplay()->GetScreenSize().Height();
+
+ XTranslateCoordinates ( _GetXDisplay(), maFrameData.GetShellWindow(),
+ _GetDisplay()->GetRootWindow(), 0, 0, &nX, &nY,
+ &aDummy );
+
+ if ( maFrameData.bDefaultPosition_ )
+ {
+ // center the application window
+
+ nX = (nScreenWidth - nWidth ) / 2;
+ nY = (nScreenHeight - nHeight) / 2;
+
+ maFrameData.bDefaultPosition_ = False;
+ }
+ else
+ {
+ // once centered, we leave the window where it is with new size
+ // but only if it does not run out of screen
+
+ if ( nX + nWidth > nScreenWidth ) nX = nScreenWidth - nWidth;
+ if ( nY + nHeight > nScreenHeight ) nY = nScreenHeight - nHeight;
+ if ( nX < 0 ) nX = 0;
+ if ( nY < 20 ) nY = 20;// guess size of top window
+ // decoration is 20
+ }
+
+ Size aSize ( nWidth, nHeight );
+ Point aPoint ( nX, nY );
+ maFrameData.SetPosSize( Rectangle ( aPoint, aSize ) );
+}
+
+#if 0
+void SalFrame::SetClientPosSize( const Rectangle& rRect )
+{
+ if( maFrameData.nStyle_ & SAL_FRAME_STYLE_CHILD )
+ return;
+
+ maFrameData.SetPosSize( rRect );
+}
+#endif
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::SetAlwaysOnTop( BOOL bOnTop )
+{
+ // #74406# do not raise fullscreenwindow since it may override the
+ // screenlocker
+ // maFrameData.bAlwaysOnTop_ = bOnTop;
+ if( bOnTop )
+ XRaiseWindow( _GetXDisplay(), maFrameData.GetShellWindow() );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::SetWindowState( const SalFrameState *pState )
+{
+ int nWidth = pState->mnWidth > 0 ? pState->mnWidth - 1 : 0 ;
+ int nHeight = pState->mnHeight > 0 ? pState->mnHeight - 1 : 0 ;
+
+ Rectangle aPosSize = Rectangle( pState->mnX,
+ pState->mnY,
+ pState->mnX + nWidth,
+ pState->mnY + nHeight );
+
+ maFrameData.SetPosSize( aPosSize );
+
+ if( pState->mnState & SAL_FRAMESTATE_MAXIMIZED )
+ {
+ maFrameData.nShowState_ = SHOWSTATE_NORMAL;
+ maFrameData.Maximize();
+ }
+ if( pState->mnState & SAL_FRAMESTATE_MINIMIZED )
+ {
+ if ( maFrameData.nShowState_ == SHOWSTATE_UNKNOWN )
+ maFrameData.nShowState_ = SHOWSTATE_NORMAL;
+ maFrameData.Minimize();
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+BOOL SalFrame::GetWindowState( SalFrameState* pState )
+{
+ if( SHOWSTATE_MINIMIZED == maFrameData.nShowState_ )
+ pState->mnState = SAL_FRAMESTATE_MINIMIZED;
+ else
+ pState->mnState = 0;
+
+ Rectangle aPosSize;
+ if( !maFrameData.aRestoreMaximize_.IsEmpty() )
+ {
+ aPosSize = maFrameData.aRestoreMaximize_;
+ pState->mnState |= SAL_FRAMESTATE_MAXIMIZED;
+ }
+ else
+ maFrameData.GetPosSize( aPosSize );
+
+ pState->mnX = aPosSize.Left();
+ pState->mnY = aPosSize.Top();
+ pState->mnWidth = aPosSize.GetWidth();
+ pState->mnHeight = aPosSize.GetHeight();
+
+ return TRUE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::GetPosSize( Rectangle &rPosSize )
+{
+ if( aPosSize_.IsEmpty() )
+ {
+ long w = nMaxWidth_
+ ? nMaxWidth_
+ : pDisplay_->GetScreenSize().Width() - nLeft_ - nRight_;
+ long h = nMaxHeight_
+ ? nMaxHeight_
+ : pDisplay_->GetScreenSize().Height() - nTop_ - nBottom_;
+
+ rPosSize = Rectangle( Point( nLeft_, nTop_ ), Size( w, h ) );
+ }
+ else
+ rPosSize = aPosSize_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::SetSize( const Size &rSize )
+{
+ XWindowChanges values;
+ values.width = rSize.Width();
+ values.height = rSize.Height();
+ if (values.width > 0 && values.height > 0)
+ {
+ Arg args[10];
+ int n = 0;
+ XtSetArg(args[n], XtNheight, rSize.Height()); n++;
+ XtSetArg(args[n], XtNwidth, rSize.Width()); n++;
+ XtSetValues( hShell_, args, n );
+
+ if( ! ( nStyle_ & ( SAL_FRAME_STYLE_CHILD | SAL_FRAME_STYLE_FLOAT ) ) )
+ MarkWindowAsGoodPositioned( XtWindow( hShell_ ) );
+
+ aPosSize_.Right() = aPosSize_.Left() + rSize.Width() - 1;
+ aPosSize_.Bottom() = aPosSize_.Top() + rSize.Height() - 1;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::SetPosSize( const Rectangle &rPosSize )
+{
+ XWindowChanges values;
+ values.x = rPosSize.Left();
+ values.y = rPosSize.Top();
+ values.width = rPosSize.GetWidth();
+ values.height = rPosSize.GetHeight();
+
+ if ( !values.width || !values.height )
+ return;
+
+ if( ! ( nStyle_ & ( SAL_FRAME_STYLE_CHILD | SAL_FRAME_STYLE_FLOAT ) ) )
+ {
+ MarkWindowAsGoodPositioned( XtWindow( hShell_ ) );
+
+ if( !(pDisplay_->GetProperties() & PROPERTY_SUPPORT_WM_ClientPos) )
+ {
+ values.x -= nLeft_;
+ values.y -= nTop_;
+ }
+ }
+ if( ( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mpParent )
+ {
+ XLIB_Window aChild;
+ // coordinates are relative to parent, so translate to root coordinates
+ XTranslateCoordinates( GetDisplay()->GetDisplay(),
+ mpParent->maFrameData.GetWindow(),
+ GetDisplay()->GetRootWindow(),
+ values.x, values.y,
+ &values.x, &values.y,
+ & aChild );
+ }
+
+ Arg args[10];
+ int n = 0;
+ XtSetArg(args[n], XtNheight, values.height); n++;
+ XtSetArg(args[n], XtNwidth, values.width); n++;
+ XtSetArg(args[n], XtNx, values.x); n++;
+ XtSetArg(args[n], XtNy, values.y); n++;
+ XtSetValues( hShell_, args, n );
+
+ if ( aPosSize_ != rPosSize )
+ {
+ aPosSize_ = rPosSize;
+ Call ( SALEVENT_RESIZE, NULL );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::Minimize()
+{
+ if( SHOWSTATE_UNKNOWN == nShowState_ )
+ {
+ stderr0( "SalFrameData::Minimize SHOWSTATE_UNKNOWN\n" );
+ return;
+ }
+
+ if( hNoFullscreenShell_ )
+ XtUnmapWidget( hNoFullscreenShell_ );
+ if( XIconifyWindow( GetXDisplay(),
+ XtWindow( hShell_ ),
+ pDisplay_->GetScreenNumber() ) )
+ nShowState_ = SHOWSTATE_MINIMIZED;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::Maximize()
+{
+ if( SHOWSTATE_UNKNOWN == nShowState_ )
+ {
+ stderr0( "SalFrameData::Maximize SHOWSTATE_UNKNOWN\n" );
+ return;
+ }
+
+ if( SHOWSTATE_MINIMIZED == nShowState_ )
+ {
+ if( hNoFullscreenShell_ )
+ XtMapWidget( hNoFullscreenShell_ );
+ XtMapWidget( hShell_ );
+ nShowState_ = SHOWSTATE_NORMAL;
+ }
+
+ if( aRestoreMaximize_.IsEmpty() )
+ aRestoreMaximize_ = aPosSize_;
+
+ if( pDisplay_->GetProperties() & PROPERTY_SUPPORT_WM_Screen )
+ {
+ long w = nMaxWidth_
+ ? nMaxWidth_
+ : pDisplay_->GetScreenSize().Width() - nLeft_ - nRight_;
+ long h = nMaxHeight_
+ ? nMaxHeight_
+ : pDisplay_->GetScreenSize().Height() - nTop_ - nBottom_;
+
+ SetPosSize( Rectangle( Point( nLeft_, nTop_), Size( w, h ) ) );
+ }
+ else
+ {
+ Display *pDisplay = GetXDisplay();
+ XLIB_Window hRoot = pDisplay_->GetRootWindow();
+ XLIB_Window *Children, hDummy;
+ unsigned int nChildren, n;
+
+ // simulate WM-Maximize: clip iconbars
+ int nW = pDisplay_->GetScreenSize().Width();
+ int nH = pDisplay_->GetScreenSize().Height();
+
+ XRectangle aRect;
+ XLIB_Region pXRegA = XCreateRegion();
+
+ aRect.x = 0;
+ aRect.y = 0;
+ aRect.width = nW;
+ aRect.height = nH;
+
+ XUnionRectWithRegion( &aRect, pXRegA, pXRegA );
+
+ XQueryTree( pDisplay,
+ hRoot,
+ &hRoot,
+ &hDummy,
+ &Children,
+ &nChildren );
+
+ SalXLib *pXLib = GetSalData()->GetLib();
+ BOOL bOld = pXLib->GetIgnoreXErrors();
+
+ for( n = 0; n < nChildren; n++ )
+ {
+ XWindowAttributes aAttrib;
+
+ pXLib->SetIgnoreXErrors( TRUE ); // reset WasXError
+
+ XGetWindowAttributes( pDisplay, Children[n], &aAttrib );
+
+ aRect.x = aAttrib.x;
+ aRect.y = aAttrib.y;
+ aRect.width = aAttrib.width;
+ aRect.height = aAttrib.height;
+
+ if( !pXLib->WasXError()
+ && aAttrib.map_state == IsViewable
+ && (!aRect.x
+ || !aRect.y
+ || aRect.x + aRect.width == nW
+ || aRect.y + aRect.height == nH)
+ && aRect.width * aRect.height < (nW * nH) / 5 )
+ {
+ XLIB_Region pXRegB = XCreateRegion();
+
+ XUnionRectWithRegion( &aRect, pXRegB, pXRegB );
+ XSubtractRegion( pXRegA, pXRegB, pXRegA );
+
+ XDestroyRegion( pXRegB );
+ }
+ }
+
+ pXLib->SetIgnoreXErrors( bOld );
+
+ XClipBox( pXRegA, &aRect );
+
+ XDestroyRegion( pXRegA );
+
+ if( aRect.width * aRect.height > (nW * nH) / 2 )
+ {
+ Rectangle aPosSize( aRect.x + nLeft_,
+ aRect.y + nTop_,
+ aRect.x + aRect.width - 1 - nRight_,
+ aRect.y + aRect.height - 1 - nBottom_ );
+
+ SetPosSize( aPosSize );
+ }
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::Restore()
+{
+ if( SHOWSTATE_UNKNOWN == nShowState_ )
+ {
+ stderr0( "SalFrameData::Restore SHOWSTATE_UNKNOWN\n" );
+ return;
+ }
+
+ if( SHOWSTATE_MINIMIZED == nShowState_ )
+ {
+ if( hNoFullscreenShell_ )
+ XtMapWidget( hNoFullscreenShell_ );
+ XtMapWidget( hShell_ );
+ nShowState_ = SHOWSTATE_NORMAL;
+ }
+
+ if( !aRestoreMaximize_.IsEmpty() )
+ {
+ SetPosSize( aRestoreMaximize_ );
+ aRestoreMaximize_ = Rectangle();
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrameData::ShowFullScreen( BOOL bFullScreen )
+{
+ if( aRestoreFullScreen_.IsEmpty() == !bFullScreen )
+ return;
+
+ const Size &aScreenSize( pDisplay_->GetScreenSize() );
+
+ long supplied;
+ XSizeHints hints;
+ if( !XGetWMNormalHints( GetXDisplay(), XtWindow( hShell_ ), &hints, &supplied ) )
+ hints.flags = supplied = 0;
+
+ if( bFullScreen )
+ {
+ GetPosSize( aRestoreFullScreen_ );
+
+ SalVisual *pVisual = pDisplay_->GetVisual();
+
+ hNoFullscreenShell_ = hShell_;
+ hNoFullscreenComposite_ = hComposite_;
+
+ XWithdrawWindow( GetXDisplay(), XtWindow( hNoFullscreenShell_ ),
+ GetDisplay()->GetScreenNumber() );
+
+ Arg aArgs[10];
+ int nArgs=0;
+ SalVisual* pVis = GetDisplay()->GetVisual();
+ XtSetArg( aArgs[nArgs], XtNvisual, pVis->GetVisual() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNdepth, pVis->GetDepth() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNcolormap,
+ GetDisplay()->GetColormap().GetXColormap() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNx, 0 ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNy, 0 ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNwidth, aScreenSize.Width() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNheight, aScreenSize.Height() ); nArgs++;
+ XtSetArg( aArgs[nArgs], XtNoverrideRedirect, True ); nArgs++;
+ hShell_ = XtAppCreateShell(
+ "VCLFullScreenShell", "VCLFullScreenFrame",
+ applicationShellWidgetClass,
+ GetXDisplay(),
+ aArgs, nArgs );
+ XtRealizeWidget( hShell_ );
+
+ hComposite_ = XtVaCreateManagedWidget(
+ "ShellComposite",
+ SAL_COMPOSITE_WIDGET,
+ hShell_,
+ NULL );
+ XtRealizeWidget( hComposite_ );
+
+ if( pGraphics_ )
+ pGraphics_->maGraphicsData.SetDrawable( XtWindow( hComposite_ ) );
+
+ delete pFreeGraphics_;
+ pFreeGraphics_ = NULL;
+
+ if( bMapped_ )
+ {
+ pFrame_->Show( TRUE );
+ XSetInputFocus( GetXDisplay(), XtWindow( hShell_ ),
+ RevertToNone, CurrentTime );
+ }
+
+ if ( WMSupportsFWS(GetXDisplay(), pDisplay_->GetRootWindow()) )
+ {
+ AddFwsProtocols( GetXDisplay(), XtWindow(hShell_) );
+ RegisterFwsWindow( GetXDisplay(), XtWindow(hShell_) );
+ }
+
+ aPosSize_ = Rectangle( Point( 0, 0 ), aScreenSize );
+ nWidth_ = aPosSize_.GetWidth();
+ nHeight_ = aPosSize_.GetHeight();
+
+ if ( mpInputContext != NULL )
+ {
+ delete mpInputContext;
+ mpInputContext = new SalI18N_InputContext( pFrame_ );
+ }
+ Call( SALEVENT_RESIZE, NULL );
+ }
+ else
+ {
+ if( pGraphics_ )
+ pGraphics_->maGraphicsData.SetDrawable( XtWindow( hNoFullscreenComposite_ ) );
+
+ delete pFreeGraphics_;
+ pFreeGraphics_ = NULL;
+
+ if ( mpInputContext != NULL )
+ delete mpInputContext;
+
+ XtDestroyWidget( hComposite_ );
+ XtDestroyWidget( hShell_ );
+
+ hComposite_ = hNoFullscreenComposite_;
+ hShell_ = hNoFullscreenShell_;
+
+ hNoFullscreenShell_ = None;
+ hNoFullscreenComposite_ = None;
+
+ if( bMapped_ )
+ pFrame_->Show( TRUE );
+ if ( mpInputContext != NULL )
+ {
+ mpInputContext = new SalI18N_InputContext( pFrame_ );
+ if ( bMapped_ )
+ mpInputContext->SetICFocus();
+ else
+ mpInputContext->Unmap();
+ }
+
+ SetPosSize( aRestoreFullScreen_ );
+ // SetPosSize macht Call( SALEVENT_RESIZE );
+ aRestoreFullScreen_ = Rectangle();
+ nWidth_ = aPosSize_.GetWidth();
+ nHeight_ = aPosSize_.GetHeight();
+ }
+}
+
+void SalFrame::ShowFullScreen( BOOL bFullScreen )
+{ maFrameData.ShowFullScreen( bFullScreen ); }
+
+/* ---------------------------------------------------------------------
+ the xautolock pseudo screen saver needs special treatment since it
+ doesn't cooperate with XxxxScreenSaver settings
+ ------------------------------------------------------------------- */
+
+static Bool
+IsRunningXAutoLock( Display *p_display, XLIB_Window a_window )
+{
+ const char *p_atomname = "XAUTOLOCK_SEMAPHORE_PID";
+ Atom a_pidatom;
+
+ // xautolock interns this atom
+ a_pidatom = XInternAtom( p_display, p_atomname, True );
+ if ( a_pidatom == None )
+ return False;
+
+ Atom a_type;
+ int n_format;
+ unsigned long n_items;
+ unsigned long n_bytes_after;
+ pid_t *p_pid;
+ pid_t n_pid;
+ // get pid of running xautolock
+ XGetWindowProperty (p_display, a_window, a_pidatom, 0L, 2L, False,
+ AnyPropertyType, &a_type, &n_format, &n_items, &n_bytes_after,
+ (unsigned char**) &p_pid );
+ n_pid = *p_pid;
+ XFree( p_pid );
+
+ if ( a_type == XA_INTEGER )
+ {
+ // check if xautolock pid points to a running process
+ if ( kill(n_pid, 0) == -1 )
+ return False;
+ else
+ return True;
+ }
+
+ return False;
+}
+
+/* definitions from xautolock.c (pl15) */
+#define XAUTOLOCK_DISABLE 1
+#define XAUTOLOCK_ENABLE 2
+
+static Bool
+MessageToXAutoLock( Display *p_display, int n_message )
+{
+ const char *p_atomname = "XAUTOLOCK_MESSAGE" ;
+ Atom a_messageatom;
+ XLIB_Window a_rootwindow;
+
+ a_rootwindow = RootWindowOfScreen( ScreenOfDisplay(p_display, 0) );
+ if ( ! IsRunningXAutoLock(p_display, a_rootwindow) )
+ {
+ // remove any pending messages
+ a_messageatom = XInternAtom( p_display, p_atomname, True );
+ if ( a_messageatom != None )
+ XDeleteProperty( p_display, a_rootwindow, a_messageatom );
+ return False;
+ }
+
+ a_messageatom = XInternAtom( p_display, p_atomname, False );
+ XChangeProperty (p_display, a_rootwindow, a_messageatom, XA_INTEGER,
+ 8, PropModeReplace, (unsigned char*)&n_message, sizeof(n_message) );
+
+ return True;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::StartPresentation( BOOL bStart )
+{
+ if ( bStart )
+ MessageToXAutoLock( _GetXDisplay(), XAUTOLOCK_DISABLE );
+ else
+ MessageToXAutoLock( _GetXDisplay(), XAUTOLOCK_ENABLE );
+
+ if( bStart || maFrameData.nScreenSaversTimeout_ )
+ {
+ int timeout, interval, prefer_blanking, allow_exposures;
+ XGetScreenSaver( _GetXDisplay(),
+ &timeout,
+ &interval,
+ &prefer_blanking,
+ &allow_exposures );
+ if( !bStart )
+ {
+ XSetScreenSaver( _GetXDisplay(),
+ maFrameData.nScreenSaversTimeout_,
+ interval,
+ prefer_blanking,
+ allow_exposures );
+ maFrameData.nScreenSaversTimeout_ = 0;
+ }
+ else if( timeout )
+ {
+ maFrameData.nScreenSaversTimeout_ = timeout;
+ XResetScreenSaver( _GetXDisplay() );
+ XSetScreenSaver( _GetXDisplay(),
+ 0,
+ interval,
+ prefer_blanking,
+ allow_exposures );
+ }
+ }
+}
+
+// Pointer
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+inline void SalFrameData::SetPointer( PointerStyle ePointerStyle )
+{
+ hCursor_ = pDisplay_->GetPointer( ePointerStyle );
+ XDefineCursor( GetXDisplay(), XtWindow( hComposite_ ), hCursor_ );
+
+ if( IsCaptured() )
+ XChangeActivePointerGrab( GetXDisplay(),
+ PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
+ hCursor_,
+ CurrentTime );
+}
+
+void SalFrame::SetPointer( PointerStyle ePointerStyle )
+{ maFrameData.SetPointer( ePointerStyle ); }
+
+void SalFrame::CaptureMouse( BOOL bCapture )
+{ maFrameData.CaptureMouse( bCapture ); }
+
+void SalFrame::SetPointerPos( long nX, long nY )
+{ XWarpPointer( _GetXDisplay(), None, maFrameData.GetShellWindow(), 0, 0, 0, 0, nX, nY ); }
+
+// PostEvent
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+BOOL SalFrame::PostEvent( void *pData )
+{
+ _GetDisplay()->SendEvent( _GetDisplay()->GetICCCM().aUserEvent_,
+ pData,
+ maFrameData.GetWindow() );
+ return TRUE;
+}
+
+// Title
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::SetTitle( const XubString& rTitle )
+{
+ ByteString aByteTitle( rTitle, gsl_getSystemTextEncoding() );
+
+ char* pTitle = (char*)aByteTitle.GetBuffer();
+ XTextProperty aTitle;
+
+ if( !XStringListToTextProperty( &pTitle, 1, &aTitle ) )
+ {
+ fprintf( stderr, "SalFrame::SetTitle !XStringListToTextProperty(%s)\n",
+ pTitle );
+ abort();
+ }
+
+ XSetWMName ( _GetXDisplay(), maFrameData.GetShellWindow(), &aTitle );
+ XSetWMIconName( _GetXDisplay(), maFrameData.GetShellWindow(), &aTitle );
+
+ XFree( aTitle.value );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Flush()
+{
+ XFlush( _GetDisplay()->GetDisplay() );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Sync()
+{
+ XSync( _GetDisplay()->GetDisplay(), False );
+}
+
+// Keyboard
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetInputContext( SalInputContext* pContext )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::UpdateExtTextInputArea()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::EndExtTextInput( USHORT nFlags )
+{
+ maFrameData.mpInputContext->EndExtTextInput( nFlags );
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalFrame::GetKeyName( USHORT nKeyCode )
+{
+ return _GetDisplay()->GetKeyName( nKeyCode );
+}
+
+XubString SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode )
+{
+ return GetKeyName( nKeyCode );
+}
+
+// Settings
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+inline Color getColorFromLong( long nColor )
+{
+ return Color( (nColor & 0xff), (nColor & 0xff00)>>8, (nColor & 0xff0000)>>16);
+}
+
+void SalFrame::UpdateSettings( AllSettings& rSettings )
+{
+
+ static SystemLookInfo aInfo;
+ static BOOL bHaveInfo = FALSE;
+ static BOOL bInit = FALSE;
+
+ if( ! bInit )
+ {
+ bInit = TRUE;
+ DtIntegrator* pIntegrator = DtIntegrator::CreateDtIntegrator( this );
+ if( pIntegrator )
+ bHaveInfo = pIntegrator->GetSystemLook( aInfo );
+ }
+
+ if( bHaveInfo )
+ {
+ StyleSettings aStyleSettings = rSettings.GetStyleSettings();
+ if( aInfo.windowActiveStart.GetColor() != COL_TRANSPARENT )
+ {
+ aStyleSettings.SetActiveColor( aInfo.windowActiveStart );
+ if( aInfo.windowActiveEnd.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetActiveColor2( aInfo.windowActiveEnd );
+ }
+ if( aInfo.windowInactiveStart.GetColor() != COL_TRANSPARENT )
+ {
+ aStyleSettings.SetDeactiveColor( aInfo.windowInactiveStart );
+ if( aInfo.windowInactiveEnd.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetDeactiveColor2( aInfo.windowInactiveEnd );
+ }
+ if( aInfo.activeBorder.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetActiveBorderColor( aInfo.activeBorder );
+ if( aInfo.inactiveBorder.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetDeactiveBorderColor( aInfo.inactiveBorder );
+ if( aInfo.activeForeground.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetActiveTextColor( aInfo.activeForeground );
+ if( aInfo.inactiveForeground.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetDeactiveTextColor( aInfo.inactiveForeground );
+ if( aInfo.selectForeground.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetHighlightTextColor( aInfo.selectForeground );
+ if( aInfo.selectBackground.GetColor() != COL_TRANSPARENT )
+ aStyleSettings.SetHighlightColor( aInfo.selectBackground );
+ if( aInfo.foreground.GetColor() != COL_TRANSPARENT )
+ {
+ aStyleSettings.SetDialogTextColor( aInfo.foreground );
+ aStyleSettings.SetMenuTextColor( aInfo.foreground );
+ aStyleSettings.SetButtonTextColor( aInfo.foreground );
+ aStyleSettings.SetRadioCheckTextColor( aInfo.foreground );
+ aStyleSettings.SetGroupTextColor( aInfo.foreground );
+ aStyleSettings.SetLabelTextColor( aInfo.foreground );
+ aStyleSettings.SetInfoTextColor( aInfo.foreground );
+ }
+ if( aInfo.background.GetColor() != COL_TRANSPARENT )
+ {
+ aStyleSettings.Set3DColors( aInfo.background );
+ aStyleSettings.SetFaceColor( aInfo.background );
+ aStyleSettings.SetDialogColor( aInfo.background );
+ aStyleSettings.SetMenuColor( aInfo.background );
+ if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY )
+ aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
+ else
+ {
+ // calculate Checked color
+ Color aColor2 = aStyleSettings.GetLightColor();
+ BYTE nRed = (BYTE)(((USHORT)aInfo.background.GetRed() + (USHORT)aColor2.GetRed())/2);
+ BYTE nGreen = (BYTE)(((USHORT)aInfo.background.GetGreen() + (USHORT)aColor2.GetGreen())/2);
+ BYTE nBlue = (BYTE)(((USHORT)aInfo.background.GetBlue() + (USHORT)aColor2.GetBlue())/2);
+ aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) );
+ }
+ }
+
+ if( aInfo.windowFont.Len() )
+ {
+ Font aWindowFont = aStyleSettings.GetTitleFont();
+ aWindowFont.SetName( aInfo.windowFont );
+ aStyleSettings.SetTitleFont( aWindowFont );
+ }
+
+ rSettings.SetStyleSettings( aStyleSettings );
+ }
+}
+
+// Sound
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::Beep( SoundType eSoundType ) // not fully suported
+{ _GetDisplay()->Beep(); }
+
+// Callback
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::SetCallback( void* pInst, SALFRAMEPROC pProc )
+{
+ maFrameData.pInst_ = pInst;
+ maFrameData.pProc_ = pProc ? pProc : sal_CallbackDummy;
+}
+
+// Event Handling
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+static USHORT sal_GetCode( int state )
+{
+ USHORT nCode = 0;
+
+ if( state & Button1Mask )
+ nCode |= MOUSE_LEFT;
+ if( state & Button2Mask )
+ nCode |= MOUSE_MIDDLE;
+ if( state & Button3Mask )
+ nCode |= MOUSE_RIGHT;
+
+ if( state & ShiftMask )
+ nCode |= KEY_SHIFT;
+ if( state & ControlMask )
+ nCode |= KEY_MOD1;
+ if( state & Mod1Mask )
+ nCode |= KEY_MOD2;
+
+ return nCode;
+}
+
+long SalFrameData::HandleMouseEvent( XEvent *pEvent )
+{
+ SalMouseEvent aMouseEvt;
+ USHORT nEvent;
+ static ULONG nLines = 0;
+
+ // Solaris X86: clicking the right button on a two-button mouse
+ // generates a button2 event not a button3 event
+ if (pDisplay_->GetProperties() & PROPERTY_SUPPORT_3ButtonMouse )
+ {
+ switch (pEvent->type)
+ {
+ case EnterNotify:
+ case LeaveNotify:
+ if ( pEvent->xcrossing.state & Button2Mask )
+ {
+ pEvent->xcrossing.state &= ~Button2Mask;
+ pEvent->xcrossing.state |= Button3Mask;
+ }
+ break;
+
+ case MotionNotify:
+ if ( pEvent->xmotion.state & Button2Mask )
+ {
+ pEvent->xmotion.state &= ~Button2Mask;
+ pEvent->xmotion.state |= Button3Mask;
+ }
+ break;
+
+ default:
+ if ( Button2 == pEvent->xbutton.button )
+ {
+ pEvent->xbutton.state &= ~Button2Mask;
+ pEvent->xbutton.state |= Button3Mask;
+ pEvent->xbutton.button = Button3;
+ }
+ break;
+ }
+ }
+
+
+ if( LeaveNotify == pEvent->type || EnterNotify == pEvent->type )
+ {
+ aMouseEvt.mnX = pEvent->xcrossing.x;
+ aMouseEvt.mnY = pEvent->xcrossing.y;
+ aMouseEvt.mnTime = pEvent->xcrossing.time;
+ aMouseEvt.mnCode = sal_GetCode( pEvent->xcrossing.state );
+
+ aMouseEvt.mnButton = 0;
+
+ nEvent = LeaveNotify == pEvent->type
+ ? SALEVENT_MOUSELEAVE
+ : SALEVENT_MOUSEMOVE;
+ }
+ else if( pEvent->type == MotionNotify )
+ {
+ aMouseEvt.mnX = pEvent->xmotion.x;
+ aMouseEvt.mnY = pEvent->xmotion.y;
+ aMouseEvt.mnTime = pEvent->xmotion.time;
+ aMouseEvt.mnCode = sal_GetCode( pEvent->xmotion.state );
+
+ aMouseEvt.mnButton = 0;
+
+ nEvent = SALEVENT_MOUSEMOVE;
+ }
+ else
+ {
+ // get input focus on SAL_FRAME_STYLE_CHILD windows
+ // because the focus handling in this case (running as plugin)
+ // is "a little tricky"
+ if( nStyle_ & SAL_FRAME_STYLE_CHILD )
+ XSetInputFocus( GetDisplay()->GetDisplay(), GetWindow(), RevertToParent, CurrentTime );
+ if( pEvent->xbutton.button == Button1 ||
+ pEvent->xbutton.button == Button2 ||
+ pEvent->xbutton.button == Button3 )
+ {
+ aMouseEvt.mnX = pEvent->xbutton.x;
+ aMouseEvt.mnY = pEvent->xbutton.y;
+ aMouseEvt.mnTime = pEvent->xbutton.time;
+ aMouseEvt.mnCode = sal_GetCode( pEvent->xbutton.state );
+
+ if( Button1 == pEvent->xbutton.button )
+ aMouseEvt.mnButton = MOUSE_LEFT;
+ else if( Button2 == pEvent->xbutton.button )
+ aMouseEvt.mnButton = MOUSE_MIDDLE;
+ else if( Button3 == pEvent->xbutton.button )
+ aMouseEvt.mnButton = MOUSE_RIGHT;
+
+ nEvent = ButtonPress == pEvent->type
+ ? SALEVENT_MOUSEBUTTONDOWN
+ : SALEVENT_MOUSEBUTTONUP;
+ }
+ else if( pEvent->xbutton.button == Button4 ||
+ pEvent->xbutton.button == Button5 )
+ {
+ if( ! nLines )
+ {
+ char* pEnv = getenv( "SAL_WHEELLINES" );
+ nLines = pEnv ? atoi( pEnv ) : 3;
+ if( nLines > 10 )
+ nLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
+ }
+
+ SalWheelMouseEvent aWheelEvt;
+ aWheelEvt.mnTime = pEvent->xbutton.time;
+ aWheelEvt.mnX = pEvent->xbutton.x;
+ aWheelEvt.mnY = pEvent->xbutton.y;
+ aWheelEvt.mnDelta =
+ pEvent->xbutton.button == Button4 ? 120 : -120;
+ aWheelEvt.mnNotchDelta =
+ pEvent->xbutton.button == Button4 ? 1 : -1;
+ aWheelEvt.mnScrollLines = nLines;
+ aWheelEvt.mnCode = sal_GetCode( pEvent->xbutton.state );
+ aWheelEvt.mbHorz = FALSE;
+
+ nEvent = SALEVENT_WHEELMOUSE;
+
+ return Call( nEvent, &aWheelEvt );
+ }
+ }
+
+ if( nEvent == SALEVENT_MOUSELEAVE
+ || ( aMouseEvt.mnX < nWidth_ && aMouseEvt.mnX > -1 &&
+ aMouseEvt.mnY < nHeight_ && aMouseEvt.mnY > -1 )
+ || pDisplay_->MouseCaptured( this ) )
+ return Call( nEvent, &aMouseEvt );
+
+#ifdef DBG_UTIL
+ fprintf( stderr, "SalFrameData::HandleMouseEvent %d size=%d*%d event=%d.%d\n",
+ pEvent->type, nWidth_, nHeight_, aMouseEvt.mnX, aMouseEvt.mnY );
+#endif
+ return 0;
+}
+
+
+// F10 means either KEY_F10 or KEY_MENU, which has to be decided
+// in the independent part.
+struct KeyAlternate
+{
+ USHORT nKeyCode;
+ sal_Unicode nCharCode;
+ KeyAlternate() : nKeyCode( 0 ), nCharCode( 0 ) {}
+ KeyAlternate( USHORT nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {}
+};
+
+inline KeyAlternate
+GetAlternateKeyCode( const USHORT nKeyCode )
+{
+ KeyAlternate aAlternate;
+
+ switch( nKeyCode )
+ {
+ case KEY_F10: aAlternate = KeyAlternate( KEY_MENU );break;
+ case KEY_F24: aAlternate = KeyAlternate( KEY_SUBTRACT, '-' );break;
+ }
+
+ return aAlternate;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long SalFrameData::HandleKeyEvent( XKeyEvent *pEvent )
+{
+ int nLen = 16;
+ unsigned char *pPrintable = (unsigned char*)alloca( nLen );
+ KeySym nKeySym;
+
+ // if we haven't got an input context yet then it's time to build it
+ if ( mpInputContext == NULL )
+ {
+ mpInputContext = new SalI18N_InputContext( pFrame_ );
+ if ( mpInputContext->UseContext() )
+ mpInputContext->ExtendEventMask( XtWindow( hShell_ ) );
+ }
+ // singlebyte code composed by input method, the new default
+ if ( mpInputContext->UseContext() )
+ {
+ Status nStatus;
+ nKeySym = pDisplay_->GetKeySym( pEvent, pPrintable, &nLen,
+ &nStatus, mpInputContext->GetContext() );
+ if ( nStatus == XBufferOverflow )
+ {
+ nLen += 1;
+ pPrintable = (unsigned char*)alloca( nLen );
+ nKeySym = pDisplay_->GetKeySym( pEvent, pPrintable, &nLen,
+ &nStatus, mpInputContext->GetContext() );
+ }
+ }
+ else
+ {
+ // fallback, this should never ever be called
+ Status nStatus = 0;
+ nKeySym = pDisplay_->GetKeySym( pEvent, pPrintable, &nLen, &nStatus );
+ if( !nLen )
+ pPrintable[0] = 0;
+ }
+
+ USHORT nModCode = 0;
+ if( pEvent->state & ShiftMask )
+ nModCode |= KEY_SHIFT;
+ if( pEvent->state & ControlMask )
+ nModCode |= KEY_MOD1;
+ if( pEvent->state & Mod1Mask )
+ {
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) )
+ nModCode |= KEY_CONTROLMOD;
+ }
+
+ if( nKeySym == XK_Shift_L || nKeySym == XK_Shift_R
+ || nKeySym == XK_Control_L || nKeySym == XK_Control_R
+ || nKeySym == XK_Alt_L || nKeySym == XK_Alt_R
+ || nKeySym == XK_Meta_L || nKeySym == XK_Meta_R )
+ {
+ SalKeyModEvent aModEvt;
+
+ // pressing just the ctrl key leads to a keysym of XK_Control but
+ // the event state does not contain ControlMask. In the release
+ // event its the other way round: it does contain the Control mask.
+ // The modifier mode therefor has to be adapted manually.
+ if (pEvent->type == KeyRelease)
+ {
+ if ( (nKeySym == XK_Control_L) || (nKeySym == XK_Control_R) )
+ nModCode &= ~KEY_MOD1;
+ if ( (nKeySym == XK_Shift_L) || (nKeySym == XK_Shift_R) )
+ nModCode &= ~KEY_SHIFT;
+ if ( (nKeySym == XK_Alt_L) || (nKeySym == XK_Alt_R) )
+ nModCode &= ~KEY_MOD2;
+ }
+ else
+ {
+ if ( (nKeySym == XK_Control_L) || (nKeySym == XK_Control_R) )
+ nModCode |= KEY_MOD1;
+ if ( (nKeySym == XK_Shift_L) || (nKeySym == XK_Shift_R) )
+ nModCode |= KEY_SHIFT;
+ if ( (nKeySym == XK_Alt_L) || (nKeySym == XK_Alt_R) )
+ nModCode |= KEY_MOD2;
+ }
+
+ aModEvt.mnCode = nModCode;
+ aModEvt.mnTime = pEvent->time;
+
+ return Call( SALEVENT_KEYMODCHANGE, &aModEvt );
+ }
+
+ SalKeyEvent aKeyEvt;
+ USHORT nKeyCode;
+
+ nKeyCode = pDisplay_->GetKeyCode( nKeySym, (char*)pPrintable );
+ if( !nKeyCode && !pPrintable[0] )
+ return 0;
+
+ rtl_TextEncoding nEncoding = gsl_getSystemTextEncoding();
+ sal_Unicode *pBuffer;
+ sal_Size nSize;
+ if ( nEncoding != RTL_TEXTENCODING_UNICODE )
+ {
+ // create text converter
+ rtl_TextToUnicodeConverter aConverter =
+ rtl_createTextToUnicodeConverter( nEncoding );
+ rtl_TextToUnicodeContext aContext =
+ rtl_createTextToUnicodeContext( aConverter );
+
+ sal_Size nBufferSize = nLen * 2;
+ sal_uInt32 nConversionInfo;
+ sal_Size nConvertedChars;
+
+ pBuffer = (sal_Unicode*) alloca( nBufferSize + 1);
+
+ // convert to single byte text stream
+ nSize = rtl_convertTextToUnicode(
+ aConverter, aContext,
+ (char*)pPrintable, nLen,
+ pBuffer, nBufferSize,
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE
+ | RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE,
+ &nConversionInfo, &nConvertedChars );
+
+ // destroy converter
+ rtl_destroyTextToUnicodeContext( aConverter, aContext );
+ rtl_destroyTextToUnicodeConverter( aConverter );
+ }
+ else
+ {
+ pBuffer = (sal_Unicode*)pPrintable;
+ nSize = nLen;
+ }
+
+ // XXX it shouldn't be possible to create a keyrelease event with
+ // more than a single character in the event, but check it anyway
+ // as well it shouldn't be possible to generate more than a single
+ // char without an input method
+ if ( nSize > 1
+ && mpInputContext->UseContext()
+ && KeyRelease != pEvent->type )
+ {
+ mpInputContext->CommitStringCallback( pBuffer, nSize );
+ }
+ else
+ {
+ aKeyEvt.mnCode = nKeyCode | nModCode;
+ aKeyEvt.mnRepeat = 0;
+ aKeyEvt.mnTime = pEvent->time;
+ aKeyEvt.mnCharCode = pBuffer[ 0 ];
+
+ if( KeyRelease == pEvent->type )
+ {
+ Call( SALEVENT_KEYUP, &aKeyEvt );
+ }
+ else
+ {
+ if ( ! Call(SALEVENT_KEYINPUT, &aKeyEvt) )
+ {
+ // independent layer doesnt want to handle key-event, so check
+ // whether the keycode may have an alternate meaning
+ KeyAlternate aAlternate = GetAlternateKeyCode( nKeyCode );
+ if ( aAlternate.nKeyCode != 0 )
+ {
+ aKeyEvt.mnCode = aAlternate.nKeyCode | nModCode;
+ if( aAlternate.nCharCode )
+ aKeyEvt.mnCharCode = aAlternate.nCharCode;
+ Call(SALEVENT_KEYINPUT, &aKeyEvt);
+ }
+ }
+ }
+ }
+
+ return True;
+}
+
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long SalFrameData::HandleFocusEvent( XFocusChangeEvent *pEvent )
+{
+ /* #55691# ignore focusout resulting from keyboard grabs
+ * we do not grab it and are not interested when
+ * someone else does CDE e.g. does a XGrabKey on arrow keys
+ * #73179# handle focus events with mode NotifyWhileGrabbed
+ * because with CDE alt-tab focus changing we do not get
+ * normal focus events
+ * #71791# cast focus event to the input context, otherwise the
+ * status window does not follow the application frame
+ */
+ if ( mpInputContext != NULL )
+ {
+ if( FocusIn == pEvent->type )
+ mpInputContext->SetICFocus();
+ else
+ mpInputContext->UnsetICFocus();
+ }
+
+ if ( pEvent->mode == NotifyNormal || pEvent->mode == NotifyWhileGrabbed )
+ {
+ if( FocusIn == pEvent->type )
+ {
+ return Call( SALEVENT_GETFOCUS, 0 );
+ }
+ else
+ {
+ return Call( SALEVENT_LOSEFOCUS, 0 );
+ }
+ }
+
+ return 0;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+class SalPeekExpose
+{
+ XEvent aEvent_;
+ XEvent *pEvent_;
+ USHORT nEvent_;
+
+public:
+ inline Bool Callback()
+ {
+ if( aEvent_.type != pEvent_->type
+ || aEvent_.xany.window != pEvent_->xany.window )
+ return !--nEvent_;
+ pEvent_->xexpose.count++;
+ return True;
+ }
+ inline SalPeekExpose( XEvent *p );
+};
+
+extern "C" Bool
+sal_PeekExpose( Display*, XEvent*, char *p )
+{
+ return ((SalPeekExpose*)p)->Callback();
+}
+
+inline SalPeekExpose::SalPeekExpose( XEvent *p ) : pEvent_( p )
+{
+#ifdef DBG_UTIL
+ memset( &aEvent_, 0, sizeof( aEvent_ ) );
+#endif
+ nEvent_ = QLength( p->xany.display );
+ XPeekIfEvent( p->xany.display, &aEvent_, sal_PeekExpose, (char*)this );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long SalFrameData::HandleExposeEvent( XEvent *pEvent )
+{
+ XRectangle aRect;
+ USHORT nCount;
+
+ if( pEvent->type == Expose )
+ {
+ aRect.x = pEvent->xexpose.x;
+ aRect.y = pEvent->xexpose.y;
+ aRect.width = pEvent->xexpose.width;
+ aRect.height = pEvent->xexpose.height;
+ nCount = pEvent->xexpose.count;
+ }
+ else if( pEvent->type == GraphicsExpose )
+ {
+ aRect.x = pEvent->xgraphicsexpose.x;
+ aRect.y = pEvent->xgraphicsexpose.y;
+ aRect.width = pEvent->xgraphicsexpose.width;
+ aRect.height = pEvent->xgraphicsexpose.height;
+ nCount = pEvent->xgraphicsexpose.count;
+ }
+
+ if( hNoFullscreenShell_ != None )
+ // we are in fullscreen mode -> override redirect
+ // focus is probably lost, so reget it
+ XSetInputFocus( GetXDisplay(), XtWindow( hShell_ ), RevertToNone, CurrentTime );
+
+ if( !IsWaitingForExpose() )
+ {
+ // complete painting
+ if( !nCount
+ && !aRect.x
+ && !aRect.y
+ && aRect.width == nWidth_
+ && aRect.height == nHeight_ )
+ {
+ SalPaintEvent aPEvt;
+
+ aPEvt.mnBoundX = 0;
+ aPEvt.mnBoundY = 0;
+ aPEvt.mnBoundWidth = nWidth_;
+ aPEvt.mnBoundHeight = nHeight_;
+
+ Call( SALEVENT_PAINT, &aPEvt );
+
+ return 1;
+ }
+
+ pPaintRegion_ = XCreateRegion();
+ }
+
+ XUnionRectWithRegion( &aRect, pPaintRegion_, pPaintRegion_ );
+
+ if( nCount ) // wait for last expose rectangle
+ return 1;
+
+ if( QLength( pEvent->xany.display ) )
+ {
+ SalPeekExpose Peek( pEvent );
+
+ if( pEvent->xexpose.count )
+ {
+ stderr1( "SalFrameData::HandleExposeEvent %s\n",
+ ServerVendor(GetXDisplay()) );
+ return 1;
+ }
+ }
+
+ SalPaintEvent aPEvt;
+
+ XClipBox( pPaintRegion_, &aRect );
+
+ aPEvt.mnBoundX = aRect.x;
+ aPEvt.mnBoundY = aRect.y;
+ aPEvt.mnBoundWidth = aRect.width;
+ aPEvt.mnBoundHeight = aRect.height;
+
+ Call( SALEVENT_PAINT, &aPEvt );
+
+ XDestroyRegion( pPaintRegion_ );
+ pPaintRegion_ = NULL;
+
+ return 1;
+}
+
+void SalFrameData::RepositionFloatChildren()
+{
+ // move SAL_FRAME_STYLE_FLOAT children to new position
+ for( int nChild = 0; nChild < maChildren.Count(); nChild++ )
+ {
+ SalFrameData* pData = &maChildren.GetObject( nChild )->maFrameData;
+ if( pData->nStyle_ & SAL_FRAME_STYLE_FLOAT )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "moving FLOAT child\n" );
+#endif
+ pData->SetPosSize( pData->aPosSize_ );
+ }
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long SalFrameData::HandleSizeEvent( XConfigureEvent *pEvent )
+{
+ if ( pEvent->window != XtWindow( hShell_ )
+ && pEvent->window != XtWindow( hComposite_ )
+ && pEvent->window != hForeignParent_
+ && pEvent->window != hForeignTopLevelWindow_ )
+ {
+ // could be as well a sys-child window (aka SalObject)
+ return 1;
+ }
+
+ // ignore for now
+ if( nStyle_ & SAL_FRAME_STYLE_FLOAT )
+ return 1;
+
+ if( pEvent->window == hForeignTopLevelWindow_ )
+ {
+ // just update the children's positions
+ RepositionFloatChildren();
+ return 1;
+ }
+
+ if( pEvent->window == hForeignParent_ )
+ {
+ Arg args[10];
+ int n = 0;
+ XtSetArg(args[n], XtNheight, pEvent->height); n++;
+ XtSetArg(args[n], XtNwidth, pEvent->width); n++;
+ XtSetValues( hShell_, args, n );
+ }
+ if( SHOWSTATE_UNKNOWN == nShowState_ )
+ {
+ nShowState_ = SHOWSTATE_NORMAL;
+
+ XSizeHints hints;
+ long supplied;
+ if( XGetWMNormalHints( pEvent->display,
+ pEvent->window,
+ &hints,
+ &supplied ) )
+ {
+ if( hints.flags & PMaxSize ) // supplied
+ {
+ nMaxWidth_ = hints.max_width;
+ nMaxHeight_ = hints.max_height;
+ DBG_ASSERT( nMaxWidth_ && nMaxHeight_, "!MaxWidth^!MaxHeight" )
+ }
+ }
+ }
+
+ if( !pEvent->send_event )
+ {
+ XLIB_Window hDummy;
+ XTranslateCoordinates( GetXDisplay(),
+ XtWindow( hShell_ ),
+ pDisplay_->GetRootWindow(),
+ 0, 0,
+ &pEvent->x, &pEvent->y,
+ &hDummy );
+ }
+
+ if( nMaxWidth_ || nMaxHeight_ )
+ {
+ if( nMaxWidth_ != pEvent->width || nMaxHeight_ != pEvent->height )
+ aRestoreMaximize_ = Rectangle();
+ else if( aRestoreMaximize_.IsEmpty() )
+ {
+ stderr0( "SalFrameData::HandleSizeEvent zoomed\n" );
+ GetPosSize( aRestoreMaximize_ );
+ }
+ }
+ else
+ if( pEvent->x != nLeft_ || pEvent->y != nTop_ )
+ aRestoreMaximize_ = Rectangle();
+ else
+ {
+ Size aSize( pEvent->width + nLeft_ + nRight_,
+ pEvent->height + nTop_ + nBottom_ );
+
+ if( aSize != pDisplay_->GetScreenSize() )
+ aRestoreMaximize_ = Rectangle();
+ else
+ if( aRestoreMaximize_.IsEmpty() )
+ {
+ stderr0( "SalFrameData::HandleSizeEvent zoomed\n" );
+ GetPosSize( aRestoreMaximize_ );
+ }
+ }
+
+ aPosSize_.Left() = pEvent->x;
+ aPosSize_.Top() = pEvent->y;
+ aPosSize_.Right() = aPosSize_.Left() + pEvent->width - 1;
+ aPosSize_.Bottom() = aPosSize_.Top() + pEvent->height - 1;
+
+ // update children's position
+ RepositionFloatChildren();
+
+ if( nWidth_ != pEvent->width || nHeight_ != pEvent->height )
+ {
+ nWidth_ = pEvent->width;
+ nHeight_ = pEvent->height;
+
+ if( pEvent->window != XtWindow( hComposite_ ) )
+ {
+ XtResizeWidget(hComposite_, nWidth_, nHeight_, 0);
+
+ Arg args[4];
+ int n = 0;
+ XtSetArg(args[n], XtNheight, pEvent->height); n++;
+ XtSetArg(args[n], XtNwidth, pEvent->width); n++;
+ // XtSetValues(hComposite_, args, n);
+ }
+ Call( SALEVENT_RESIZE, NULL );
+ }
+ return 1;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long SalFrameData::HandleReparentEvent( XReparentEvent *pEvent )
+{
+ Display *pDisplay = pEvent->display;
+ XLIB_Window hWM_Parent = pEvent->parent;
+ XLIB_Window hRoot, *Children, hDummy;
+ unsigned int nChildren, n;
+ BOOL bNone = pDisplay_->GetProperties()
+ & PROPERTY_SUPPORT_WM_Parent_Pixmap_None;
+
+ if( hWM_Parent == pDisplay_->GetRootWindow()
+ || hWM_Parent == hForeignParent_
+ || ( nStyle_ & SAL_FRAME_STYLE_FLOAT ) )
+ {
+ // Reparenting before Destroy
+ return 0;
+ }
+
+ if( !pEvent->x && !pEvent->y )
+ {
+ if( bNone )
+ XSetWindowBackgroundPixmap( pDisplay, hWM_Parent, None );
+
+ XQueryTree( GetXDisplay(),
+ hWM_Parent,
+ &hRoot,
+ &hWM_Parent,
+ &Children,
+ &nChildren );
+
+ XFree( Children );
+ }
+
+ if( hWM_Parent == hRoot )
+ hWM_Parent = pEvent->parent;
+ else if( bNone )
+ XSetWindowBackgroundPixmap( pDisplay, hWM_Parent, None );
+
+ XQueryTree( pDisplay,
+ hWM_Parent,
+ &hRoot,
+ &hDummy,
+ &Children,
+ &nChildren );
+
+#ifdef DBG_UTIL
+ if( hDummy != hRoot )
+ {
+ fprintf( stderr,
+ "SalFrameData::HandleReparentEvent hDummy!=hRoot"
+ " r=%ld d=%ld p=%ld n=%d\n",
+ hRoot, hDummy, hWM_Parent, nChildren );
+ pDisplay_->PrintEvent( "HandleReparentEvent", (XEvent*)pEvent );
+ }
+#endif
+#ifdef NC_EVENTS
+ for( n = 0; n < nChildren; n++ )
+ if( Children[n] != hShell_ && Children[n] != pEvent->parent )
+ XSelectInput( pDisplay, Children[n], NC_EVENTS );
+#endif
+ XFree( Children );
+ if( !XTranslateCoordinates( GetXDisplay(),
+ XtWindow( hShell_ ),
+ hWM_Parent,
+ 0, 0,
+ &nLeft_, &nTop_,
+ &hDummy ) )
+ {
+ fprintf( stderr, "SalFramaData::HandleReparentEvent !XTranslateCoordinates\n" );
+ abort();
+ }
+
+ nRight_ = nLeft_; // ???
+ nBottom_ = nLeft_; // ???
+
+ // hack: maximize if vendor is XFREE (why? MB!), only remote client
+
+ if( (aPosSize_.IsEmpty() || WindowNeedGoodPosition( XtWindow( hShell_ ) ) )
+ && pDisplay_->GetProperties() & PROPERTY_FEATURE_Maximize )
+ {
+ nShowState_ = SHOWSTATE_NORMAL;
+ Maximize();
+ aRestoreMaximize_ = Rectangle(); // not a real maximize
+ }
+ else
+ {
+ // limit width and height if we are too large: #47757
+ // olwm and fvwm need this, it doesnt harm the rest
+
+ int nScreenWidth = pDisplay_->GetScreenSize().Width();
+ int nScreenHeight = pDisplay_->GetScreenSize().Height();
+ int nFrameWidth = aPosSize_.GetWidth() + nLeft_ + nRight_;
+ int nFrameHeight = aPosSize_.GetHeight() + nTop_ + nBottom_;
+
+ if ((nFrameWidth > nScreenWidth) || (nFrameHeight > nScreenHeight))
+ {
+ Size aSize(aPosSize_.GetWidth(), aPosSize_.GetHeight());
+
+ if (nFrameWidth > nScreenWidth)
+ aSize.Width() = nScreenWidth - nRight_ - nLeft_;
+ if (nFrameHeight > nScreenHeight)
+ aSize.Height() = nScreenHeight - nBottom_ - nTop_;
+
+ SetSize (aSize);
+ }
+ }
+
+
+ return 1;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+alpha long SalFrameData::HandleColormapEvent( XColormapEvent *pEvent )
+{
+ return 0;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long SalFrameData::HandleStateEvent( XPropertyEvent *pEvent )
+{
+ Atom actual_type;
+ int actual_format;
+ unsigned long nitems, bytes_after;
+ unsigned char *prop = NULL;
+
+ if( 0 != XGetWindowProperty( GetXDisplay(),
+ XtWindow( hShell_ ),
+ pEvent->atom, // property
+ 0, // long_offset (32bit)
+ 2, // long_length (32bit)
+ False, // delete
+ pEvent->atom, // req_type
+ &actual_type,
+ &actual_format,
+ &nitems,
+ &bytes_after,
+ &prop )
+ || ! prop
+ )
+ return 0;
+
+ DBG_ASSERT( actual_type = pEvent->atom
+ && 32 == actual_format
+ && 2 == nitems
+ && 0 == bytes_after, "HandleStateEvent" )
+
+ if( *(unsigned long*)prop == NormalState )
+ nShowState_ = SHOWSTATE_NORMAL;
+ else if( *(unsigned long*)prop == IconicState )
+ nShowState_ = SHOWSTATE_MINIMIZED;
+
+ XFree( prop );
+ return 1;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long SalFrameData::HandleClientMessage( XClientMessageEvent *pEvent )
+{
+ SalICCCM &rICCCM = pDisplay_->GetICCCM();
+
+ if( rICCCM.IsUserEvent( pEvent->message_type ) )
+ {
+#if __SIZEOFLONG > 4
+ void* pData = (void*)
+ ( (pEvent->data.l[0] & 0xffffffff) | (pEvent->data.l[1] << 32) );
+#else
+ void* pData = (void*)(pEvent->data.l[0]);
+#endif
+ Call( SALEVENT_USEREVENT, pData );
+ return 1;
+ }
+ else if( rICCCM.IsQuitEvent( pEvent->message_type ) )
+ {
+ stderr0( "SalFrameData::Dispatch Quit\n" );
+ Close(); // ???
+ return 1;
+ }
+ else if( rICCCM.IsWM_Protocols( pEvent->message_type ) )
+ {
+ if( rICCCM.IsWM_DeleteWindow( pEvent->data.l[0] ) )
+ {
+ stderr0( "SalFrameData::Dispatch DeleteWindow\n" );
+ Close();
+ return 1;
+ }
+ else if( rICCCM.IsWM_SaveYourself( pEvent->data.l[0] ) )
+ {
+ SalFrame* pLast = GetSalData()->pFirstFrame_;
+ while( pLast->maFrameData.pNextFrame_ )
+ pLast = pLast->maFrameData.pNextFrame_;
+ if( pLast == pFrame_ )
+ {
+ ByteString aExec( SessionManagerClient::getExecName(), gsl_getSystemTextEncoding() );
+ char* argv[2];
+ argv[0] = "/bin/sh";
+ argv[1] = const_cast<char*>(aExec.GetBuffer());
+ XSetCommand( GetXDisplay(), XtWindow( hShell_ ), argv, 2 );
+ }
+ else
+ XDeleteProperty( GetXDisplay(), XtWindow( hShell_ ), rICCCM.aWM_Command_ );
+ }
+ }
+ return 0;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bool SalFrameData::checkKeyReleaseForRepeat( Display* pDisplay, XEvent* pCheck, XPointer pSalFrameData )
+{
+ SalFrameData* pThis = (SalFrameData*)pSalFrameData;
+ return
+ pCheck->type == XLIB_KeyPress &&
+ pCheck->xkey.state == pThis->nKeyState_ &&
+ pCheck->xkey.keycode == pThis->nKeyCode_ &&
+ pCheck->xkey.time == pThis->nReleaseTime_ ? True : False;
+}
+
+long SalFrameData::Dispatch( XEvent *pEvent )
+{
+ long nRet = 0;
+
+ if( -1 == nCaptured_ )
+ {
+ CaptureMouse( TRUE );
+#ifdef DBG_UTIL
+ if( -1 != nCaptured_ )
+ pDisplay_->PrintEvent( "Captured", pEvent );
+#endif
+ }
+
+ if( pEvent->xany.window == XtWindow( hShell_ ) || pEvent->xany.window == XtWindow( hComposite_ ) )
+ {
+ switch( pEvent->type )
+ {
+ case XLIB_KeyPress:
+ nKeyCode_ = pEvent->xkey.keycode;
+ nKeyState_ = pEvent->xkey.state;
+ nRet = HandleKeyEvent( &pEvent->xkey );
+ break;
+
+ case KeyRelease:
+ if( -1 == nCompose_ )
+ {
+ nReleaseTime_ = pEvent->xkey.time;
+ XEvent aEvent;
+ if( XCheckIfEvent( pEvent->xkey.display, &aEvent, checkKeyReleaseForRepeat, (XPointer)this ) )
+ XPutBackEvent( pEvent->xkey.display, &aEvent );
+ else
+ nRet = HandleKeyEvent( &pEvent->xkey );
+ }
+ break;
+
+ case ButtonPress:
+ // #74406# if we loose the focus in presentation mode
+ // there are good chances that we never get it back
+ // since the WM ignores us
+ if( hNoFullscreenShell_ != None )
+ {
+ XSetInputFocus( GetXDisplay(), GetShellWindow(),
+ RevertToNone, CurrentTime );
+ }
+
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify:
+ case LeaveNotify:
+ nRet = HandleMouseEvent( pEvent );
+ break;
+
+ case FocusIn:
+ case FocusOut:
+ nRet = HandleFocusEvent( &pEvent->xfocus );
+ break;
+
+ case Expose:
+ case GraphicsExpose:
+ nRet = HandleExposeEvent( pEvent );
+ break;
+
+ case MapNotify:
+ if( pEvent->xmap.window == XtWindow( hShell_ ) ||
+ pEvent->xmap.window == XtWindow( hComposite_ ) )
+ {
+ bMapped_ = TRUE;
+ bViewable_ = TRUE;
+ nRet = TRUE;
+ if ( mpInputContext != NULL )
+ mpInputContext->Map( pFrame_ );
+ Call( SALEVENT_RESIZE, NULL );
+ }
+ break;
+
+ case UnmapNotify:
+ if( pEvent->xunmap.window == XtWindow( hShell_ ) )
+ {
+ bMapped_ = FALSE;
+ bViewable_ = FALSE;
+ nRet = TRUE;
+ if ( mpInputContext != NULL )
+ mpInputContext->Unmap();
+ Call( SALEVENT_RESIZE, NULL );
+ }
+ break;
+
+ case ConfigureNotify:
+ if( pEvent->xconfigure.window == XtWindow( hShell_ ) ||
+ pEvent->xconfigure.window == XtWindow( hComposite_ ) )
+ nRet = HandleSizeEvent( &pEvent->xconfigure );
+ break;
+
+ case VisibilityNotify:
+ nVisibility_ = pEvent->xvisibility.state;
+ nRet = TRUE;
+ break;
+
+ case ReparentNotify:
+ nRet = HandleReparentEvent( &pEvent->xreparent );
+ break;
+
+ case MappingNotify:
+ if( MappingPointer != pEvent->xmapping.request )
+ nRet = Call( SALEVENT_KEYBOARDCHANGED, 0 );
+ break;
+
+ case ColormapNotify:
+ nRet = HandleColormapEvent( &pEvent->xcolormap );
+ break;
+
+ case PropertyNotify:
+ {
+ SalICCCM &rICCCM = pDisplay_->GetICCCM();
+
+ if( rICCCM.IsWM_State( pEvent->xproperty.atom ) )
+ nRet = HandleStateEvent( &pEvent->xproperty );
+ else
+ nRet = 1;
+ break;
+ }
+
+ case ClientMessage:
+ nRet = HandleClientMessage( &pEvent->xclient );
+ break;
+ }
+ }
+ else
+ {
+ switch( pEvent->type )
+ {
+#ifdef NC_EVENTS
+ case XLIB_KeyPress:
+ case KeyRelease:
+ nRet = HandleNCKeyEvent()
+ break;
+
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify:
+ case LeaveNotify:
+ nRet = HandleNCMouseEvent( pEvent );
+ break;
+
+ case Expose:
+ nRet = HandleNCExposeEvent( pEvent );
+ break;
+#endif
+ case ConfigureNotify:
+ if( pEvent->xconfigure.window == hForeignParent_ ||
+ pEvent->xconfigure.window == hForeignTopLevelWindow_ )
+ nRet = HandleSizeEvent( &pEvent->xconfigure );
+ break;
+ }
+ }
+
+ // #74406# do not raise fullscreenwindow as it may override the
+ // screenlocker
+#if 0
+ if( bAlwaysOnTop_
+ && nVisibility_ != VisibilityUnobscured
+ && pEvent->type != ConfigureNotify
+ && pEvent->type != MotionNotify )
+ {
+ XRaiseWindow( GetXDisplay(), XtWindow( hShell_ ) );
+ }
+#endif
+
+
+ return nRet;
+}
+
diff --git a/vcl/unx/source/window/salobj.cxx b/vcl/unx/source/window/salobj.cxx
new file mode 100644
index 000000000000..56d2383d8928
--- /dev/null
+++ b/vcl/unx/source/window/salobj.cxx
@@ -0,0 +1,447 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SV_SALOBJ_CXX
+
+#include <prex.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/shape.h>
+#ifdef USE_MOTIF
+#include <Xm/DrawingA.h>
+#else
+#include <X11/Xaw/Label.h>
+#endif
+#include <postx.h>
+
+#include <salunx.h>
+#include <salstd.hxx>
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALDISP_HXX
+#include <saldisp.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+
+#ifdef USE_MOTIF
+#define OBJECT_WIDGET_CLASS xmDrawingAreaWidgetClass
+#else
+#define OBJECT_WIDGET_CLASS labelWidgetClass
+#endif
+
+SalObjectList SalObjectData::aAllObjects;
+
+// =======================================================================
+
+long ImplSalObjCallbackDummy( void*, SalObject*, USHORT, const void* )
+{
+ return 0;
+}
+
+// =======================================================================
+// SalInstance memberfkts to create and destroy a SalObject
+
+SalObject* SalInstance::CreateObject( SalFrame* pParent )
+{
+ int error_base, event_base;
+ SalObject* pObject = new SalObject;
+ SystemChildData* pObjData = const_cast<SystemChildData*>(pObject->GetSystemData());
+
+ if ( ! XShapeQueryExtension( (Display*)pObjData->pDisplay,
+ &event_base, &error_base ) )
+ {
+ delete pObject;
+ return NULL;
+ }
+
+ SalDisplay* pSalDisp = pParent->maFrameData.GetDisplay();
+ Widget pWidgetParent = pParent->maFrameData.GetWidget();
+
+ pObject->maObjectData.maPrimary =
+ XtVaCreateManagedWidget( "salobject primary",
+ OBJECT_WIDGET_CLASS,
+ pWidgetParent,
+ NULL );
+ pObject->maObjectData.maSecondary =
+ XtVaCreateManagedWidget( "salobject secondary",
+ OBJECT_WIDGET_CLASS,
+ pObject->maObjectData.maPrimary,
+ NULL );
+ XtRealizeWidget( pObject->maObjectData.maPrimary );
+ XtRealizeWidget( pObject->maObjectData.maSecondary );
+
+ pObjData->pDisplay = XtDisplay( pObject->maObjectData.maPrimary );
+ pObjData->aWindow = XtWindow( pObject->maObjectData.maSecondary );
+ pObjData->pWidget = pObject->maObjectData.maSecondary;
+ pObjData->pVisual = pSalDisp->GetVisual()->GetVisual();
+ pObjData->nDepth = pSalDisp->GetVisual()->GetDepth();
+ pObjData->aColormap = pSalDisp->GetColormap().GetXColormap();
+ pObjData->pAppContext = pSalDisp->GetXLib()->GetAppContext();
+ return pObject;
+}
+
+
+void SalInstance::DestroyObject( SalObject* pObject )
+{
+ delete pObject;
+}
+
+
+// ======================================================================
+// SalClipRegion is a member of SalObject
+// definition of SalClipRegion my be found in unx/inc/salobj.h
+
+
+SalClipRegion::SalClipRegion()
+{
+ ClipRectangleList = NULL;
+ numClipRectangles = 0;
+ maxClipRectangles = 0;
+ nClipRegionType = SAL_OBJECT_CLIP_INCLUDERECTS;
+}
+
+
+SalClipRegion::~SalClipRegion()
+{
+ if ( ClipRectangleList )
+ delete ClipRectangleList;
+}
+
+
+void
+SalClipRegion::BeginSetClipRegion( ULONG nRects )
+{
+ if (ClipRectangleList)
+ delete ClipRectangleList;
+
+ ClipRectangleList = new XRectangle[nRects];
+ numClipRectangles = 0;
+ maxClipRectangles = nRects;
+}
+
+
+void
+SalClipRegion::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+ if ( nWidth && nHeight && (numClipRectangles < maxClipRectangles) )
+ {
+ XRectangle *aRect = ClipRectangleList + numClipRectangles;
+
+ aRect->x = (short) nX;
+ aRect->y = (short) nY;
+ aRect->width = (unsigned short) nWidth;
+ aRect->height= (unsigned short) nHeight;
+
+ numClipRectangles++;
+ }
+}
+
+
+// =======================================================================
+// SalObject Implementation
+
+
+SalObject::SalObject()
+{
+ maObjectData.maSystemChildData.nSize = sizeof( SystemChildData );
+ maObjectData.maSystemChildData.pDisplay = GetSalData()->GetDefDisp()->GetDisplay();
+ maObjectData.maSystemChildData.aWindow = None;
+ maObjectData.maSystemChildData.pSalFrame = 0;
+ maObjectData.maSystemChildData.pWidget = 0;
+ maObjectData.maSystemChildData.pVisual = 0;
+ maObjectData.maSystemChildData.nDepth = 0;
+ maObjectData.maSystemChildData.aColormap = 0;
+
+ maObjectData.mpInst = NULL;
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+ maObjectData.maPrimary = NULL;
+ maObjectData.maSecondary = NULL;
+
+ SalObjectData::aAllObjects.Insert( this, LIST_APPEND );
+}
+
+
+SalObject::~SalObject()
+{
+ SalObjectData::aAllObjects.Remove( this );
+ if ( maObjectData.maPrimary )
+ XtDestroyWidget ( maObjectData.maPrimary );
+ if ( maObjectData.maSecondary )
+ XtDestroyWidget ( maObjectData.maSecondary );
+}
+
+
+void
+SalObject::ResetClipRegion()
+{
+ maObjectData.maClipRegion.ResetClipRegion();
+
+ const int dest_kind = ShapeBounding;
+ const int op = ShapeSet;
+ const int ordering = YSorted;
+
+ XWindowAttributes win_attrib;
+ XRectangle win_size;
+
+ XGetWindowAttributes ( (Display*)maObjectData.maSystemChildData.pDisplay,
+ maObjectData.maSystemChildData.aWindow,
+ &win_attrib );
+
+ win_size.x = 0;
+ win_size.y = 0;
+ win_size.width = win_attrib.width;
+ win_size.height = win_attrib.width;
+
+ XShapeCombineRectangles ( (Display*)maObjectData.maSystemChildData.pDisplay,
+ maObjectData.maSystemChildData.aWindow,
+ dest_kind,
+ 0, 0, // x_off, y_off
+ &win_size, // list of rectangles
+ 1, // number of rectangles
+ op, ordering );
+}
+
+
+void
+SalObject::BeginSetClipRegion( ULONG nRectCount )
+{
+ maObjectData.maClipRegion.BeginSetClipRegion ( nRectCount );
+}
+
+
+void
+SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+ maObjectData.maClipRegion.UnionClipRegion ( nX, nY, nWidth, nHeight );
+}
+
+
+void
+SalObject::EndSetClipRegion()
+{
+ XRectangle *pRectangles = maObjectData.maClipRegion.EndSetClipRegion ();
+ const int nType = maObjectData.maClipRegion.GetClipRegionType();
+ const int nRectangles = maObjectData.maClipRegion.GetRectangleCount();
+
+ const int dest_kind = ShapeBounding;
+ const int ordering = YSorted;
+ int op;
+
+ switch ( nType )
+ {
+ case SAL_OBJECT_CLIP_INCLUDERECTS :
+ op = ShapeSet;
+ break;
+ case SAL_OBJECT_CLIP_EXCLUDERECTS :
+ op = ShapeSubtract;
+ break;
+ case SAL_OBJECT_CLIP_ABSOLUTE :
+ op = ShapeSet;
+ break;
+ default :
+ op = ShapeUnion;
+ }
+
+ XShapeCombineRectangles ( (Display*)maObjectData.maSystemChildData.pDisplay,
+ maObjectData.maSystemChildData.aWindow,
+ dest_kind,
+ 0, 0, // x_off, y_off
+ pRectangles,
+ nRectangles,
+ op, ordering );
+}
+
+
+USHORT
+SalObject::GetClipRegionType()
+{
+ return maObjectData.maClipRegion.GetClipRegionType();
+}
+
+// -----------------------------------------------------------------------
+
+void
+SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
+{
+ if ( maObjectData.maPrimary && maObjectData.maSecondary && nWidth && nHeight )
+ {
+ XtConfigureWidget( maObjectData.maPrimary,
+ nX, nY, nWidth, nHeight, 0 );
+ XtConfigureWidget( maObjectData.maSecondary,
+ 0, 0, nWidth, nHeight, 0 );
+ }
+}
+
+
+void
+SalObject::Show( BOOL bVisible )
+{
+ if ( ! maObjectData.maSystemChildData.aWindow )
+ return;
+
+ if ( bVisible )
+ XtMapWidget( (Widget)maObjectData.maPrimary );
+ else
+ XtUnmapWidget( (Widget)maObjectData.maPrimary );
+
+ maObjectData.mbVisible = bVisible;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::Enable( BOOL bEnable )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::GrabFocus()
+{
+ if( maObjectData.mbVisible )
+ XSetInputFocus( (Display*)maObjectData.maSystemChildData.pDisplay,
+ maObjectData.maSystemChildData.aWindow,
+ RevertToNone,
+ CurrentTime );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground( SalColor nSalColor )
+{
+}
+
+// -----------------------------------------------------------------------
+
+const SystemChildData* SalObject::GetSystemData() const
+{
+ return &maObjectData.maSystemChildData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc )
+{
+ maObjectData.mpInst = pInst;
+ if ( pProc )
+ maObjectData.mpProc = pProc;
+ else
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+}
+
+long SalObjectData::Dispatch( XEvent* pEvent )
+{
+ for( int n= 0; n < aAllObjects.Count(); n++ )
+ {
+ SalObject* pObject = aAllObjects.GetObject( n );
+ if( pEvent->xany.window == XtWindow( pObject->maObjectData.maPrimary ) ||
+ pEvent->xany.window == XtWindow( pObject->maObjectData.maSecondary ) )
+ {
+ switch( pEvent->type )
+ {
+ case UnmapNotify:
+ pObject->maObjectData.mbVisible = FALSE;
+ return 1;
+ case MapNotify:
+ pObject->maObjectData.mbVisible = TRUE;
+ return 1;
+ case ButtonPress:
+ pObject->maObjectData.mpProc(
+ pObject->maObjectData.mpInst,
+ pObject,
+ SALOBJ_EVENT_TOTOP,
+ NULL );
+ return 1;
+ case FocusIn:
+ pObject->maObjectData.mpProc(
+ pObject->maObjectData.mpInst,
+ pObject,
+ SALOBJ_EVENT_GETFOCUS,
+ NULL );
+ return 1;
+ case FocusOut:
+ pObject->maObjectData.mpProc(
+ pObject->maObjectData.mpInst,
+ pObject,
+ SALOBJ_EVENT_LOSEFOCUS,
+ NULL );
+ return 1;
+ default: break;
+ }
+ return 0;
+ }
+ }
+ return 0;
+}
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
new file mode 100644
index 000000000000..6eeccee61607
--- /dev/null
+++ b/vcl/util/makefile.mk
@@ -0,0 +1,609 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=VCL
+TARGET=vcl
+VERSION=$(UPD)
+USE_LDUMP2=TRUE
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+LDUMP=ldump2.exe
+
+# --- Allgemein ----------------------------------------------------------
+
+.IF "$(depend)" == ""
+
+HXXDEPNLST= $(INC)$/accel.hxx \
+ $(INC)$/animate.hxx \
+ $(INC)$/apptypes.hxx \
+ $(INC)$/bitmap.hxx \
+ $(INC)$/bitmapex.hxx \
+ $(INC)$/bmpacc.hxx \
+ $(INC)$/btndlg.hxx \
+ $(INC)$/button.hxx \
+ $(INC)$/ctrl.hxx \
+ $(INC)$/color.hxx \
+ $(INC)$/config.hxx \
+ $(INC)$/cursor.hxx \
+ $(INC)$/clip.hxx \
+ $(INC)$/cmdevt.hxx \
+ $(INC)$/drag.hxx \
+ $(INC)$/decoview.hxx \
+ $(INC)$/dialog.hxx \
+ $(INC)$/dockwin.hxx \
+ $(INC)$/edit.hxx \
+ $(INC)$/event.hxx \
+ $(INC)$/exchange.hxx \
+ $(INC)$/field.hxx \
+ $(INC)$/fixed.hxx \
+ $(INC)$/floatwin.hxx \
+ $(INC)$/font.hxx \
+ $(INC)$/floatwin.hxx \
+ $(INC)$/graph.hxx \
+ $(INC)$/group.hxx \
+ $(INC)$/help.hxx \
+ $(INC)$/jobset.hxx \
+ $(INC)$/keycodes.hxx \
+ $(INC)$/keycod.hxx \
+ $(INC)$/image.hxx \
+ $(INC)$/line.hxx \
+ $(INC)$/lstbox.h \
+ $(INC)$/lstbox.hxx \
+ $(INC)$/mapmod.hxx \
+ $(INC)$/metaact.hxx \
+ $(INC)$/menu.hxx \
+ $(INC)$/menubtn.hxx \
+ $(INC)$/metric.hxx \
+ $(INC)$/morebtn.hxx \
+ $(INC)$/msgbox.hxx \
+ $(INC)$/octree.hxx \
+ $(INC)$/outdev.hxx \
+ $(INC)$/outdev3d.hxx \
+ $(INC)$/pointr.hxx \
+ $(INC)$/poly.hxx \
+ $(INC)$/ptrstyle.hxx \
+ $(INC)$/prntypes.hxx \
+ $(INC)$/print.hxx \
+ $(INC)$/prndlg.hxx \
+ $(INC)$/region.hxx \
+ $(INC)$/rc.hxx \
+ $(INC)$/resid.hxx \
+ $(INC)$/resary.hxx \
+ $(INC)$/salbtype.hxx \
+ $(INC)$/scrbar.hxx \
+ $(INC)$/slider.hxx \
+ $(INC)$/seleng.hxx \
+ $(INC)$/settings.hxx \
+ $(INC)$/sound.hxx \
+ $(INC)$/sndstyle.hxx \
+ $(INC)$/split.hxx \
+ $(INC)$/splitwin.hxx \
+ $(INC)$/spin.hxx \
+ $(INC)$/spinfld.hxx \
+ $(INC)$/status.hxx \
+ $(INC)$/stdtext.hxx \
+ $(INC)$/sv.h \
+ $(INC)$/svapp.hxx \
+ $(INC)$/syschild.hxx \
+ $(INC)$/sysdata.hxx \
+ $(INC)$/system.hxx \
+ $(INC)$/syswin.hxx \
+ $(INC)$/tabctrl.hxx \
+ $(INC)$/tabdlg.hxx \
+ $(INC)$/tabpage.hxx \
+ $(INC)$/toolbox.hxx \
+ $(INC)$/timer.hxx \
+ $(INC)$/virdev.hxx \
+ $(INC)$/wall.hxx \
+ $(INC)$/waitobj.hxx \
+ $(INC)$/wintypes.hxx \
+ $(INC)$/window.hxx \
+ $(INC)$/wrkwin.hxx
+
+.IF "$(linkinc)" != ""
+SHL11FILE= $(MISC)$/app.slo
+SHL12FILE= $(MISC)$/gdi.slo
+SHL13FILE= $(MISC)$/win.slo
+SHL14FILE= $(MISC)$/ctrl.slo
+#SHL15FILE= $(MISC)$/ex.slo
+SHL16FILE= $(MISC)$/salapp.slo
+SHL17FILE= $(MISC)$/salwin.slo
+SHL18FILE= $(MISC)$/salgdi.slo
+.ENDIF
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1FILES= $(SLB)$/app.lib \
+ $(SLB)$/gdi.lib \
+ $(SLB)$/win.lib \
+ $(SLB)$/ctrl.lib \
+ $(SLB)$/ex.lib \
+ $(SLB)$/helper.lib
+
+.IF "$(remote)" != ""
+LIB1FILES+= \
+ $(SLB)$/remote.lib
+.IF "$(COM)"=="GCC"
+LIB1OBJFILES=$(SLO)$/salmain.obj
+.ENDIF
+.ELSE
+LIB1FILES+= \
+ $(SLB)$/salwin.lib \
+ $(SLB)$/salgdi.lib \
+ $(SLB)$/salapp.lib
+.ENDIF
+
+SHL1TARGET= vcl$(VERSION)$(DLLPOSTFIX)
+SHL1IMPLIB= ivcl
+SHL1STDLIBS=$(TOOLSLIB) \
+ $(SOTLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(CPPUHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(CPPULIB) \
+ $(UNOTOOLSLIB)
+
+.IF "$(remote)" != ""
+SHL1STDLIBS+=\
+ $(UNOLIB)
+.ENDIF
+
+.IF "$(GUI)"!="MAC"
+SHL1DEPN= $(L)$/itools.lib $(L)$/sot.lib
+.ENDIF
+
+SHL1LIBS= $(LIB1TARGET)
+.IF "$(GUI)"!="UNX"
+SHL1OBJS= $(SLO)$/salshl.obj
+.ENDIF
+
+.IF "$(GUI)" != "MAC"
+.IF "$(GUI)" != "UNX"
+SHL1RES= $(RES)$/salsrc.res
+.ENDIF
+.ENDIF
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+ALLTAR+= $(LIB1TARGET)
+
+# --- VCL-Light ----------------------------------------------------------
+
+.IF "$(VCL_LIGHT)" != ""
+LIB2TARGET= $(SLB)$/vll.lib
+LIB2FILES= $(SLO)$/access.obj \
+ $(SLO)$/config.obj \
+ $(SLO)$/dbggui.obj \
+ $(SLO)$/system.obj \
+ $(SLO)$/oldsv.obj \
+ $(SLO)$/help.obj \
+ $(SLO)$/idlemgr.obj \
+ $(SLO)$/resmgr.obj \
+ $(SLO)$/settings.obj \
+ $(SLO)$/sound.obj \
+ $(SLO)$/stdtext.obj \
+ $(SLO)$/svapp.obj \
+ $(SLO)$/svdata.obj \
+ $(SLO)$/svmain.obj \
+ $(SLO)$/timer.obj \
+ $(SLO)$/animate.obj \
+ $(SLO)$/salmisc.obj \
+ $(SLO)$/impanmvw.obj \
+ $(SLO)$/bitmap.obj \
+ $(SLO)$/bitmap2.obj \
+ $(SLO)$/bitmap3.obj \
+ $(SLO)$/bitmap4.obj \
+ $(SLO)$/alpha.obj \
+ $(SLO)$/bitmapex.obj \
+ $(SLO)$/imgcons.obj \
+ $(SLO)$/bmpacc.obj \
+ $(SLO)$/bmpacc2.obj \
+ $(SLO)$/bmpacc3.obj \
+ $(SLO)$/color.obj \
+ $(SLO)$/cvtsvm.obj \
+ $(SLO)$/cvtgrf.obj \
+ $(SLO)$/font.obj \
+ $(SLO)$/gdimtf.obj \
+ $(SLO)$/gfxlink.obj \
+ $(SLO)$/graph.obj \
+ $(SLO)$/impgraph.obj \
+ $(SLO)$/gradient.obj \
+ $(SLO)$/hatch.obj \
+ $(SLO)$/image.obj \
+ $(SLO)$/impbmp.obj \
+ $(SLO)$/impimage.obj \
+ $(SLO)$/impprn.obj \
+ $(SLO)$/impvect.obj \
+ $(SLO)$/implncvt.obj \
+ $(SLO)$/jobset.obj \
+ $(SLO)$/line.obj \
+ $(SLO)$/lineinfo.obj \
+ $(SLO)$/mapmod.obj \
+ $(SLO)$/metaact.obj \
+ $(SLO)$/metric.obj \
+ $(SLO)$/octree.obj \
+ $(SLO)$/outmap.obj \
+ $(SLO)$/outdev.obj \
+ $(SLO)$/outdev2.obj \
+ $(SLO)$/outdev3.obj \
+ $(SLO)$/outdev4.obj \
+ $(SLO)$/outdev5.obj \
+ $(SLO)$/outdev6.obj \
+ $(SLO)$/opengl.obj \
+ $(SLO)$/poly.obj \
+ $(SLO)$/poly2.obj \
+ $(SLO)$/print.obj \
+ $(SLO)$/print2.obj \
+ $(SLO)$/regband.obj \
+ $(SLO)$/region.obj \
+ $(SLO)$/virdev.obj \
+ $(SLO)$/wall.obj \
+ $(SLO)$/accel.obj \
+ $(SLO)$/accmgr.obj \
+ $(SLO)$/brdwin.obj \
+ $(SLO)$/btndlg.obj \
+ $(SLO)$/cursor.obj \
+ $(SLO)$/dockwin.obj \
+ $(SLO)$/decoview.obj \
+ $(SLO)$/dialog.obj \
+ $(SLO)$/dlgctrl.obj \
+ $(SLO)$/floatwin.obj \
+ $(SLO)$/keycod.obj \
+ $(SLO)$/menu.obj \
+ $(SLO)$/mnemonic.obj \
+ $(SLO)$/msgbox.obj \
+ $(SLO)$/syschild.obj \
+ $(SLO)$/syswin.obj \
+ $(SLO)$/toolbox.obj \
+ $(SLO)$/toolbox2.obj \
+ $(SLO)$/window.obj \
+ $(SLO)$/window2.obj \
+ $(SLO)$/winproc.obj \
+ $(SLO)$/wrkwin.obj \
+ $(SLO)$/scrwnd.obj \
+ $(SLO)$/button.obj \
+ $(SLO)$/ctrl.obj \
+ $(SLO)$/combobox.obj \
+ $(SLO)$/edit.obj \
+ $(SLO)$/field.obj \
+ $(SLO)$/fixed.obj \
+ $(SLO)$/group.obj \
+ $(SLO)$/ilstbox.obj \
+ $(SLO)$/lstbox.obj \
+ $(SLO)$/morebtn.obj \
+ $(SLO)$/spinfld.obj \
+ $(SLO)$/scrbar.obj \
+ $(SLO)$/tabctrl.obj \
+ $(SLB)$/ex.lib \
+ $(SLB)$/helper.lib \
+ $(SLB)$/salwin.lib \
+ $(SLB)$/salgdi.lib \
+ $(SLB)$/salapp.lib
+
+# $(SLO)$/resary.obj \
+# $(SLO)$/filedlg.obj \
+# $(SLO)$/seleng.obj \
+# $(SLO)$/split.obj \
+# $(SLO)$/splitwin.obj \
+# $(SLO)$/status.obj \
+# $(SLO)$/tabdlg.obj \
+# $(SLO)$/tabpage.obj \
+# $(SLO)$/field2.obj \
+# $(SLO)$/imgctrl.obj \
+# $(SLO)$/longcurr.obj \
+# $(SLO)$/fixbrd.obj \
+# $(SLO)$/menubtn.obj \
+# $(SLO)$/slider.obj \
+# $(SLO)$/spinbtn.obj \
+
+SHL2TARGET= vll$(VERSION)$(DLLPOSTFIX)
+SHL2IMPLIB= ivll
+SHL2STDLIBS=$(TOOLSLIB) \
+ $(SOTLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(UNOTOOLSLIB)
+.IF "$(GUI)"!="MAC"
+SHL2DEPN= $(L)$/itools.lib $(L)$/sot.lib
+.ENDIF
+SHL2LIBS= $(LIB2TARGET)
+
+.IF "$(GUI)"!="UNX"
+SHL2OBJS= $(SLO)$/salshl.obj
+.ENDIF
+
+.IF "$(GUI)" != "MAC"
+.IF "$(GUI)" != "UNX"
+SHL2RES= $(RES)$/salsrc.res
+.ENDIF
+.ENDIF
+SHL2DEF= $(MISC)$/$(SHL2TARGET).def
+
+ALLTAR+= $(LIB2TARGET)
+
+.ENDIF
+
+# --- All ----------------------------------------------------------------
+
+ALL: ALLTAR
+
+# ---MAC----------------------------------------------------------------
+
+.IF "$(GUI)" == "MAC"
+
+$(MISC)$/$(SHL1TARGET).def: makefile.mk
+ delete -i $@
+ $(LINK) $(LINKFLAGS) $(LINKFLAGSSHL) $(SHL$(TNR)OBJS) $(SHL$(TNR)LIBS) -f $@.exp · dev:null
+ duplicate -y $@.exp $@
+ delete -i $@.exp
+.IF "$(RUECKWAERTS)" != "" || "$(rueckwaerts)" != ""
+ filter_import "$(SOLARINCDIR)"$/GLOBAL.IMP $@
+.ENDIF
+
+.IF "$(VCL_LIGHT)" != ""
+$(MISC)$/$(SHL2TARGET).def: makefile.mk
+ delete -i $@
+ $(LINK) $(LINKFLAGS) $(LINKFLAGSSHL) $(SHL$(TNR)OBJS) $(SHL$(TNR)LIBS) -f $@.exp · dev:null
+ duplicate -y $@.exp $@
+ delete -i $@.exp
+.IF "$(RUECKWAERTS)" != "" || "$(rueckwaerts)" != ""
+ filter_import "$(SOLARINCDIR)"$/GLOBAL.IMP $@
+.ENDIF
+.ENDIF
+
+.ENDIF
+
+# --- W32 ----------------------------------------------------------------
+
+.IF "$(GUI)" == "WNT"
+
+SHL1STDLIBS += gdi32.lib \
+ winspool.lib \
+ ole32.lib \
+ shell32.lib \
+ advapi32.lib \
+ imm32.lib
+
+#.IF ("$(COM)" == "MSC") && ("$(GUI)" == "WNT") && (("$(CPU)" == "A") || ("$(CPU)"=="P") || ("$(CPU)" == "M"))
+.IF "$(COM)$(GUI)" == "MSCWNT"
+.IF $(CPU)" == "A" || "$(CPU)"=="P" || "$(CPU)" == "M"
+LINKFLAGSSHL += /ENTRY:LibMain
+.ENDIF
+.ENDIF
+
+#.IF ("$(COM)" == "MSC") && ("$(GUI)" == "WNT") && ("$(CPU)" == "I")
+.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
+LINKFLAGSSHL += /ENTRY:LibMain@12
+.ENDIF
+
+# --- Def-File ---
+
+$(MISC)$/$(SHL1TARGET).def: $(MISC)$/$(SHL1TARGET).flt \
+ $(HXXDEPNLST) \
+ makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @+-attrib -r defs
+ @echo LIBRARY $(SHL1TARGET) >$@
+ @echo DESCRIPTION 'VCL' >>$@
+ @echo DATA READWRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GetVersionInfo >>$@
+ $(LIBMGR) -EXTRACT:/ /OUT:$(TARGET).exp $(LIB1TARGET)
+ @$(LDUMP) -E20 -F$(MISC)$/$(SHL1TARGET).flt $(TARGET).exp >>$@
+ +-del $(TARGET).exp
+
+# --- VCL-Light ---
+
+.IF "$(VCL_LIGHT)" != ""
+
+SHL2STDLIBS += gdi32.lib \
+ winspool.lib \
+ ole32.lib \
+ shell32.lib \
+ advapi32.lib \
+ imm32.lib
+
+#.IF ("$(COM)" == "MSC") && ("$(GUI)" == "WNT") && (("$(CPU)" == "A") || ("$(CPU)"=="P") || ("$(CPU)" == "M"))
+.IF "$(COM)$(GUI)" == "MSCWNT"
+.IF $(CPU)" == "A" || "$(CPU)"=="P" || "$(CPU)" == "M"
+LINKFLAGSSHL += /ENTRY:LibMain
+.ENDIF
+.ENDIF
+
+#.IF ("$(COM)" == "MSC") && ("$(GUI)" == "WNT") && ("$(CPU)" == "I")
+.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
+LINKFLAGSSHL += /ENTRY:LibMain@12
+.ENDIF
+
+# --- Def-File ---
+
+$(MISC)$/$(SHL2TARGET).def: $(MISC)$/$(SHL1TARGET).flt \
+ $(HXXDEPNLST) \
+ makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo LIBRARY $(SHL2TARGET) >$@
+ @echo DESCRIPTION 'VCL' >>$@
+ @echo DATA READWRITE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @echo GetVersionInfo >>$@
+ $(LIBMGR) -EXTRACT:/ /OUT:vll.exp $(LIB2TARGET)
+ @$(LDUMP) -E20 -F$(MISC)$/$(SHL1TARGET).flt vll.exp >>$@
+ +-del vll.exp
+
+.ENDIF
+
+.ENDIF
+
+# --- OS2 ----------------------------------------------------------------
+
+.IF "$(GUI)" == "OS2"
+
+# --- Def-File ---
+
+$(MISC)$/$(SHL1TARGET).def: $(MISC)$/$(SHL1TARGET).flt \
+ $(HXXDEPNLST) \
+ makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo LIBRARY $(SHL1TARGET) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'VCL' >>$@
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @$(LDUMP) -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>$@
+
+# --- VCL-Light ---
+
+.IF "$(VCL_LIGHT)" != ""
+
+$(MISC)$/$(SHL2TARGET).def: $(MISC)$/$(SHL1TARGET).flt \
+ $(HXXDEPNLST) \
+ makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo LIBRARY $(SHL2TARGET) INITINSTANCE TERMINSTANCE >$@
+ @echo DESCRIPTION 'VCL' >>$@
+ @echo PROTMODE >>$@
+ @echo CODE LOADONCALL >>$@
+ @echo DATA PRELOAD MULTIPLE NONSHARED >>$@
+ @echo EXPORTS >>$@
+ @$(LDUMP) -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB2TARGET) >>$@
+
+.ENDIF
+
+.ENDIF
+
+# --- UNX ----------------------------------------------------------------
+
+.IF "$(GUI)"=="UNX"
+
+.IF "$(OS)"=="SOLARIS"
+SHL1STDLIBS += -lxp$(UPD)$(DLLPOSTFIX) -lXm -lXt -lX11
+.ELIF "$(OS)"=="MACOSX"
+SHL1STDLIBS +=
+.ELSE
+SHL1STDLIBS += -lxp$(UPD)$(DLLPOSTFIX) -lXaw -lXt -lX11
+.ENDIF
+
+.IF "$(OS)"=="LINUX" || "$(OS)"=="SOLARIS"
+SHL1STDLIBS += -laudio
+.ENDIF
+
+# --- VCL-Light ---
+
+.IF "$(VCL_LIGHT)" != ""
+
+.IF "$(OS)"=="SOLARIS"
+SHL2STDLIBS += -lxp$(UPD)$(DLLPOSTFIX) -lXm -lXt -lX11
+.ELSE
+SHL2STDLIBS += -lxp$(UPD)$(DLLPOSTFIX) -lXaw -lXt -lX11
+.ENDIF
+
+.IF "$(OS)"=="LINUX" || "$(OS)"=="SOLARIS"
+SHL2STDLIBS += -laudio
+.ENDIF
+
+.ENDIF
+
+.ENDIF
+
+# --- Allgemein ----------------------------------------------------------
+
+# --- VCL-Filter-Datei ---
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo Impl > $@
+ @echo Sal>> $@
+ @echo Dbg>> $@
+ @echo HelpTextWindow>> $@
+ @echo MenuBarWindow>> $@
+ @echo MenuFloatingWindow>> $@
+ @echo MenuItemList>> $@
+ @echo LibMain>> $@
+ @echo LIBMAIN>> $@
+ @echo Wep>> $@
+ @echo WEP>> $@
+ @echo RmEvent>> $@
+ @echo RmFrameWindow>> $@
+ @echo RmPrinter>> $@
+ @echo RmBitmap>> $@
+ @echo RmSound>> $@
+ @echo __CT>> $@
+
+# --- Targets ------------------------------------------------------------
+
+.ENDIF
+
+.INCLUDE : target.mk
diff --git a/vcl/util/makefile.pmk b/vcl/util/makefile.pmk
new file mode 100644
index 000000000000..dd76e1cfd051
--- /dev/null
+++ b/vcl/util/makefile.pmk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=vclpch
+PROJECTPCHSOURCE=$(PRJ)$/util$/vclpch
+PDBTARGET=vcl
+.IF "$(OS)"=="MACOSX"
+GUIBASE=aqua
+.ENDIF
diff --git a/vcl/util/target.pmk b/vcl/util/target.pmk
new file mode 100644
index 000000000000..96285fb5c46e
--- /dev/null
+++ b/vcl/util/target.pmk
@@ -0,0 +1,74 @@
+#*************************************************************************
+#
+# $RCSfile: target.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:48 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+ALLSLO: $(SLOFILES)
+
+SOSHL: $(SHL1TARGETN)
+
+WHOLEPRJ .SETDIR=$(PRJ)$/prj:
+ make debug linkinc prjpch compinc
+ @echo "READY"
+
+ONLYDLL .SETDIR=$(PRJ)$/util: $(SLOFILES)
+ $(RM) ..$/$(OUTPATH)$/bin$/sv$(UPD)$(DLLSUFFIX).dll
+ dmake debug=t prjpch=t linkinc=t compinc=t ..$/$(OUTPATH)$/bin$/sv$(UPD)$(DLLSUFFIX).dll
+ @echo "READY"
+
diff --git a/vcl/win/inc/saldata.hxx b/vcl/win/inc/saldata.hxx
new file mode 100644
index 000000000000..2d75109116e5
--- /dev/null
+++ b/vcl/win/inc/saldata.hxx
@@ -0,0 +1,358 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldata.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALDATA_HXX
+#define _SV_SALDATA_HXX
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SVDATA_HXX
+#include <svdata.hxx>
+#endif
+#ifndef _SV_SALWTYPE_HXX
+#include <salwtype.hxx>
+#endif
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+
+class AutoTimer;
+class SalInstance;
+class SalObject;
+class SalFrame;
+class SalVirtualDevice;
+class SalPrinter;
+class Font;
+struct HDCCache;
+
+// --------------------
+// - Standard-Defines -
+// --------------------
+
+#define MAX_STOCKPEN 4
+#define MAX_STOCKBRUSH 4
+#define SAL_CLIPRECT_COUNT 16
+
+// -----------
+// - SalData -
+// -----------
+
+struct SalData
+{
+ HINSTANCE mhInst; // default instance handle
+ HINSTANCE mhPrevInst; // previous instance handle
+ int mnCmdShow; // default frame show style
+ // Erst hier koennen Daten kompatible eingefuegt werden, da die
+ // oberen Daten in salmain.cxx modifiziert werden
+ HPALETTE mhDitherPal; // dither palette
+ HGLOBAL mhDitherDIB; // dither memory handle
+ BYTE* mpDitherDIB; // dither memory
+ BYTE* mpDitherDIBData; // beginning of DIB data
+ long* mpDitherDiff; // Dither mapping table
+ BYTE* mpDitherLow; // Dither mapping table
+ BYTE* mpDitherHigh; // Dither mapping table
+ ULONG mnTimerMS; // Current Time (in MS) of the Timer
+ ULONG mnTimerOrgMS; // Current Original Time (in MS)
+ UINT mnTimerId; // windows timer id
+ SALTIMERPROC mpTimerProc; // timer callback proc
+ HHOOK mhSalObjMsgHook; // hook um SalObject relevante Message mitzubekommen
+ HWND mhWantLeaveMsg; // window handle, that want a MOUSELEAVE message
+ AutoTimer* mpMouseLeaveTimer; // Timer for MouseLeave Test
+ SalInstance* mpFirstInstance; // pointer of first instance
+ SalFrame* mpFirstFrame; // pointer of first frame
+ SalObject* mpFirstObject; // pointer of first object window
+ SalVirtualDevice* mpFirstVD; // first VirDev
+ SalPrinter* mpFirstPrinter; // first printing printer
+ HDCCache* mpHDCCache; // Cache for three DC's
+ HBITMAP mh50Bmp; // 50% Bitmap
+ HBRUSH mh50Brush; // 50% Brush
+ COLORREF maStockPenColorAry[MAX_STOCKPEN];
+ COLORREF maStockBrushColorAry[MAX_STOCKBRUSH];
+ HPEN mhStockPenAry[MAX_STOCKPEN];
+ HBRUSH mhStockBrushAry[MAX_STOCKBRUSH];
+ USHORT mnStockPenCount; // Anzahl statischer Pens
+ USHORT mnStockBrushCount; // Anzahl statischer Brushes
+ WPARAM mnSalObjWantKeyEvt; // KeyEvent, welcher vom SalObj-Hook verarbeitet werden soll
+ BOOL mbObjClassInit; // Ist SALOBJECTCLASS initialised
+ BOOL mbInPalChange; // is in WM_QUERYNEWPALETTE
+ DWORD mnAppThreadId; // Id from Applikation-Thread
+ WIN_BOOL mbScrSvrEnabled; // ScreenSaver enabled
+ int mnSageStatus; // Status der Sage-DLL (DISABLE_AGENT == nicht vorhanden)
+ HINSTANCE mhSageInst; // Instance-Handle zur Sage-DLL
+ SysAgt_Enable_PROC mpSageEnableProc; // Funktion zum deaktivieren des Systemagenten
+};
+
+inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
+inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
+inline SalData* GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
+
+// --------------
+// - SalShlData -
+// --------------
+
+struct SalShlData
+{
+ HINSTANCE mhInst; // Instance of SAL-DLL
+ UINT mnVKAdd; // VK-Code von KEY_ADD
+ UINT mnVKSubtract; // VK-Code von KEY_SUBTRACT
+ UINT mnVKMultiply; // VK-Code von KEY_MULTIPLY
+ UINT mnVKDivide; // VK-Code von KEY_DIVIDE
+ UINT mnVKPoint; // VK-Code von KEY_POINT
+ UINT mnVKComma; // VK-Code von KEY_KOMMA
+ UINT mnVKLess; // VK-Code von KEY_LESS
+ UINT mnVKGreater; // VK-Code von KEY_GREATER
+ UINT mnVKEqual; // VK-Code von KEY_EQUAL
+ UINT mnWheelScrollLines; // WheelScrollLines
+ UINT mnWheelMsgId; // Wheel-Message-Id fuer W95
+ WORD mnVersion; // System-Version (311 == 3.11)
+ WIN_BOOL mbWNT; // kein W16/W95/W98 sondern ein NT
+ WIN_BOOL mbW40; // Is System-Version >= 4.0
+};
+
+extern SalShlData aSalShlData;
+
+// ------------
+// - GDICache -
+// ------------
+
+#define CACHESIZE_HDC 3
+#define CACHED_HDC_1 0
+#define CACHED_HDC_2 1
+#define CACHED_HDC_DRAW 2
+#define CACHED_HDC_DEFEXT 64
+
+struct HDCCache
+{
+ HDC mhDC;
+ HPALETTE mhDefPal;
+ HBITMAP mhDefBmp;
+ HBITMAP mhSelBmp;
+ HBITMAP mhActBmp;
+};
+
+void ImplClearHDCCache( SalData* pData );
+HDC ImplGetCachedDC( ULONG nID, HBITMAP hBmp = 0 );
+void ImplReleaseCachedDC( ULONG nID );
+
+// ------------------------------------------------------
+// - SALSHL.CXX - Funktionen fuer DLL-Resource-Zugriffe -
+// ------------------------------------------------------
+
+HCURSOR ImplLoadSalCursor( int nId );
+HBITMAP ImplLoadSalBitmap( int nId );
+BOOL ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon );
+
+// SALGDI.CXX
+void ImplInitSalGDI();
+void ImplFreeSalGDI();
+
+// --------------
+// - Prototypes -
+// --------------
+
+// \\WIN\SOURCE\APP\SALINST.CXX
+void ImplSalYieldMutexAcquireWithWait();
+BOOL ImplSalYieldMutexTryToAcquire();
+void ImplSalYieldMutexAcquire();
+void ImplSalYieldMutexRelease();
+ULONG ImplSalReleaseYieldMutex();
+void ImplSalAcquireYieldMutex( ULONG nCount );
+
+// \\WIN\SOURCE\WINDOW\SALFRAME.CXX
+LRESULT CALLBACK SalFrameWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+// \SV\WIN\SOURCE\APP\SALTIMER.CXX
+void CALLBACK SalTimerProc( HWND hWnd, UINT nMsg, UINT nId, DWORD nTime );
+
+// \WIN\SOURCE\WINDOW\SALFRAME.CXX
+void SalTestMouseLeave();
+
+// \WIN\SOURCE\WINDOW\SALFRAME.CXX
+long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam );
+BOOL ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult );
+
+// \WIN\SOURCE\WINDOW\SALOBJ.CXX
+SalObject* ImplFindSalObject( HWND hWndChild );
+BOOL ImplSalPreDispatchMsg( MSG* pMsg );
+void ImplSalPostDispatchMsg( MSG* pMsg, LRESULT nDispatchResult );
+
+// \WIN\SOURCE\GDI\SALGDI3.CXX
+void ImplSalLogFontToFontA( const LOGFONTA& rLogFont, Font& rFont );
+void ImplSalLogFontToFontW( const LOGFONTW& rLogFont, Font& rFont );
+
+// \WIN\SOURCE\APP\SALDATA.CXX
+rtl_TextEncoding ImplSalGetSystemEncoding();
+ByteString ImplSalGetWinAnsiString( const UniString& rStr, BOOL bFileName = FALSE );
+UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen = STRING_LEN );
+int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 );
+
+// -----------
+// - Defines -
+// -----------
+
+#define SAL_FRAME_WNDEXTRA sizeof( DWORD )
+#define SAL_FRAME_THIS 0
+#define SAL_FRAME_CLASSNAMEA "SALFRAME"
+#define SAL_FRAME_CLASSNAMEW L"SALFRAME"
+#define SAL_FRAME_CLASSNAME_SBA "SALFRAMESB"
+#define SAL_FRAME_CLASSNAME_SBW L"SALFRAMESB"
+#define SAL_OBJECT_WNDEXTRA sizeof( DWORD )
+#define SAL_OBJECT_THIS 0
+#define SAL_OBJECT_CLASSNAMEA "SALOBJECT"
+#define SAL_OBJECT_CLASSNAMEW L"SALOBJECT"
+#define SAL_OBJECT_CHILDCLASSNAMEA "SALOBJECTCHILD"
+#define SAL_OBJECT_CHILDCLASSNAMEW L"SALOBJECTCHILD"
+#define SAL_COM_CLASSNAMEA "SALCOMWND"
+#define SAL_COM_CLASSNAMEW L"SALCOMWND"
+
+#define SAL_MOUSELEAVE_TIMEOUT 300
+
+// wParam == hDC; lParam == 0
+#define SAL_MSG_PRINTABORTJOB (WM_USER+110)
+// wParam == bWait; lParam == 0
+#define SAL_MSG_THREADYIELD (WM_USER+111)
+// wParam == 0; lParam == 0
+#define SAL_MSG_RELEASEWAITYIELD (WM_USER+112)
+// wParam == 0; lParam == nMS
+#define SAL_MSG_STARTTIMER (WM_USER+113)
+// wParam == nFrameStyle; lParam == pParent; lResult == pFrame
+#define SAL_MSG_CREATEFRAME (WM_USER+114)
+// wParam == 0; lParam == 0
+#define SAL_MSG_DESTROYFRAME (WM_USER+115)
+// wParam == 0; lParam == pParent; lResult == pObject
+#define SAL_MSG_CREATEOBJECT (WM_USER+116)
+// wParam == 0; lParam == pObject;
+#define SAL_MSG_DESTROYOBJECT (WM_USER+117)
+// wParam == 0; lParam == this; lResult == bRet
+#define SAL_MSG_CREATESOUND (WM_USER+118)
+// wParam == 0; lParam == this
+#define SAL_MSG_DESTROYSOUND (WM_USER+119)
+
+// wParam == 0; lParam == pData
+#define SAL_MSG_USEREVENT (WM_USER+130)
+// wParam == 0; lParam == MousePosition relativ to upper left of screen
+#define SAL_MSG_MOUSELEAVE (WM_USER+131)
+// NULL-Message, soll nicht verarbeitet werden
+#define SAL_MSG_DUMMY (WM_USER+132)
+// wParam == 0; lParam == 0
+#define SAL_MSG_POSTFOCUS (WM_USER+133)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTQUERYNEWPAL (WM_USER+134)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTPALCHANGED (WM_USER+135)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTMOVE (WM_USER+136)
+// wParam == wParam; lParam == lParam
+#define SAL_MSG_POSTCALLSIZE (WM_USER+137)
+// wParam == pRECT
+#define SAL_MSG_POSTPAINT (WM_USER+138)
+// wParam == 0; lParam == pFrame; lResult 0
+#define SAL_MSG_FORCEPALETTE (WM_USER+139)
+// wParam == 0; lParam == 0;
+#define SAL_MSG_CAPTUREMOUSE (WM_USER+140)
+// wParam == 0; lParam == 0
+#define SAL_MSG_RELEASEMOUSE (WM_USER+141)
+// wParam == nFlags; lParam == 0
+#define SAL_MSG_TOTOP (WM_USER+142)
+// wParam == bVisible; lParam == 0
+#define SAL_MSG_SHOW (WM_USER+143)
+
+// SysChild-ToTop; wParam = 0; lParam = 0
+#define SALOBJ_MSG_TOTOP (WM_USER+160)
+// POSTFOCUS-Message; wParam == bFocus; lParam == 0
+#define SALOBJ_MSG_POSTFOCUS (WM_USER+161)
+
+// -----------------
+// - Helpfunctions -
+// -----------------
+
+// A/W-Wrapper
+LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong );
+LONG ImplGetWindowLong( HWND hWnd, int nIndex );
+WIN_BOOL ImplPostMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
+WIN_BOOL ImplSendMessage( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
+WIN_BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax );
+WIN_BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg );
+LONG ImplDispatchMessage( CONST MSG *lpMsg );
+
+inline void SetWindowPtr( HWND hWnd, SalFrame* pThis )
+{
+ ImplSetWindowLong( hWnd, SAL_FRAME_THIS, (LONG)pThis );
+}
+
+inline SalFrame* GetWindowPtr( HWND hWnd )
+{
+ return (SalFrame*)ImplGetWindowLong( hWnd, SAL_FRAME_THIS );
+}
+
+inline void SetSalObjWindowPtr( HWND hWnd, SalObject* pThis )
+{
+ ImplSetWindowLong( hWnd, SAL_OBJECT_THIS, (LONG)pThis );
+}
+
+inline SalObject* GetSalObjWindowPtr( HWND hWnd )
+{
+ return (SalObject*)ImplGetWindowLong( hWnd, SAL_OBJECT_THIS );
+}
+
+#endif // _SV_SALDATA_HXX
diff --git a/vcl/win/inc/salframe.h b/vcl/win/inc/salframe.h
new file mode 100644
index 000000000000..4991dd4937b6
--- /dev/null
+++ b/vcl/win/inc/salframe.h
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALFRAME_H
+#define _SV_SALFRAME_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+// ----------------
+// - SalFrameData -
+// ----------------
+
+class SalFrameData
+{
+public:
+ HWND mhWnd; // Window handle
+ HCURSOR mhCursor; // cursor handle
+ HIMC mhDefIMEContext; // default IME-Context
+ SalGraphics* mpGraphics; // current frame graphics
+ SalFrame* mpNextFrame; // pointer to next frame
+ void* mpInst; // instance handle for callback
+ SALFRAMEPROC mpProc; // callback proc
+ SystemEnvData maSysData; // system data
+ SalFrameState maState; // frame state
+ int mnShowState; // show state
+ long mnWidth; // client width in pixeln
+ long mnHeight; // client height in pixeln
+ RECT maFullScreenRect; // fullscreen rect
+ int mnFullScreenShowState; // fullscreen restore show state
+ UINT mnInputLang; // current Input Language
+ UINT mnInputCodePage; // current Input CodePage
+ USHORT mnStyle; // style
+ BOOL mbGraphics; // is Graphics used
+ BOOL mbCaption; // has window a caption
+ BOOL mbBorder; // has window a border
+ BOOL mbSizeBorder; // has window a sizeable border
+ BOOL mbFullScreen; // TRUE: in full screen mode
+ BOOL mbPresentation; // TRUE: Presentation Mode running
+ BOOL mbInShow; // innerhalb eines Show-Aufrufs
+ BOOL mbRestoreMaximize; // Restore-Maximize
+ BOOL mbInMoveMsg; // Move-Message wird verarbeitet
+ BOOL mbInSizeMsg; // Size-Message wird verarbeitet
+ BOOL mbFullScreenToolWin; // WS_EX_TOOLWINDOW reset in FullScreenMode
+ BOOL mbDefPos; // default-position
+ BOOL mbOverwriteState; // TRUE: WindowState darf umgesetzt werden
+ BOOL mbIME; // TRUE: We are in IME Mode
+ BOOL mbHandleIME; // TRUE: Wir handeln die IME-Messages
+ BOOL mbSpezIME; // TRUE: Spez IME
+ BOOL mbAtCursorIME; // TRUE: Wir behandeln nur einige IME-Messages
+ BOOL mbCompositionMode; // TRUE: Wir befinden uns im Composition-Modus
+ BOOL mbCandidateMode; // TRUE: Wir befinden uns im Candidate-Modus
+};
+
+#endif // _SV_SALFRAME_H
diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h
new file mode 100644
index 000000000000..ef89bc3f1f7d
--- /dev/null
+++ b/vcl/win/inc/salgdi.h
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALGDI_H
+#define _SV_SALGDI_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#define RGB_TO_PALRGB(nRGB) ((nRGB)|0x02000000)
+#define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff)
+
+// -------------------
+// - SalGraphicsData -
+// -------------------
+
+class SalGraphicsData
+{
+public:
+ HDC mhDC; // HDC
+ HWND mhWnd; // Window-Handle, when Window-Graphics
+ HPEN mhPen; // Pen
+ HBRUSH mhBrush; // Brush
+ HFONT mhFont; // Font
+ HRGN mhRegion; // Region Handle
+ HPEN mhDefPen; // DefaultPen
+ HBRUSH mhDefBrush; // DefaultBrush
+ HFONT mhDefFont; // DefaultFont
+ HPALETTE mhDefPal; // DefaultPalette
+ COLORREF mnPenColor; // PenColor
+ COLORREF mnBrushColor; // BrushColor
+ COLORREF mnTextColor; // TextColor
+ RGNDATA* mpClipRgnData; // ClipRegion-Data
+ RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data
+ RECT* mpNextClipRect; // Naechstes ClipRegion-Rect
+ BOOL mbFirstClipRect; // Flag for first cliprect to insert
+ LOGFONTA* mpLogFont; // LOG-Font which is currently selected (only W9x)
+ BYTE* mpFontCharSets; // All Charsets for the current font
+ BYTE mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried
+ KERNINGPAIR* mpFontKernPairs; // Kerning Pairs of the current Font
+ ULONG mnFontKernPairCount;// Number of Kerning Pairs of the current Font
+ BOOL mbFontKernInit; // FALSE: FontKerns must be queried
+ int mnFontOverhang; // Font-Overhang
+ int mnPenWidth; // Linienbreite
+ BOOL mbStockPen; // is Pen a stockpen
+ BOOL mbStockBrush; // is Brush a stcokbrush
+ BOOL mbPen; // is Pen (FALSE == NULL_PEN)
+ BOOL mbBrush; // is Brush (FALSE == NULL_BRUSH)
+ BOOL mbPrinter; // is Printer
+ BOOL mbVirDev; // is VirDev
+ BOOL mbWindow; // is Window
+ BOOL mbScreen; // is Screen compatible
+ BOOL mbXORMode; // _every_ output with RasterOp XOR
+ BOOL mbCalcOverhang; // calc overhang
+};
+
+// Init/Deinit Graphics
+void ImplSalInitGraphics( SalGraphicsData* mpData );
+void ImplSalDeInitGraphics( SalGraphicsData* mpData );
+void ImplUpdateSysColorEntries();
+int ImplIsSysColorEntry( SalColor nSalColor );
+
+// -----------
+// - Defines -
+// -----------
+
+#ifdef WIN
+#define MAX_64KSALPOINTS ((((USHORT)0xFFFF)-4)/sizeof(POINT))
+#else
+#define MAX_64KSALPOINTS ((((USHORT)0xFFFF)-8)/sizeof(POINTS))
+#endif
+
+#endif // _SV_SALGDI_H
diff --git a/vcl/win/inc/salids.hrc b/vcl/win/inc/salids.hrc
new file mode 100644
index 000000000000..6caf4048b13a
--- /dev/null
+++ b/vcl/win/inc/salids.hrc
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * $RCSfile: salids.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALIDS_HRC
+#define _SV_SALIDS_HRC
+
+// Cursor
+#define SAL_RESID_POINTER_NULL 10000
+#ifndef W40ONLY
+#define SAL_RESID_POINTER_HELP 10001
+#endif
+#ifndef WNT
+#define SAL_RESID_POINTER_HSIZE 10002
+#define SAL_RESID_POINTER_VSIZE 10003
+#define SAL_RESID_POINTER_NESWSIZE 10004
+#define SAL_RESID_POINTER_NWSESIZE 10005
+#endif
+#define SAL_RESID_POINTER_CROSS 10006
+#define SAL_RESID_POINTER_MOVE 10007
+#define SAL_RESID_POINTER_HSPLIT 10008
+#define SAL_RESID_POINTER_VSPLIT 10009
+#define SAL_RESID_POINTER_HSIZEBAR 10010
+#define SAL_RESID_POINTER_VSIZEBAR 10011
+#define SAL_RESID_POINTER_HAND 10012
+#define SAL_RESID_POINTER_REFHAND 10013
+#define SAL_RESID_POINTER_PEN 10014
+#define SAL_RESID_POINTER_MAGNIFY 10015
+#define SAL_RESID_POINTER_FILL 10016
+#define SAL_RESID_POINTER_ROTATE 10017
+#define SAL_RESID_POINTER_HSHEAR 10018
+#define SAL_RESID_POINTER_VSHEAR 10019
+#define SAL_RESID_POINTER_MIRROR 10020
+#define SAL_RESID_POINTER_CROOK 10021
+#define SAL_RESID_POINTER_CROP 10022
+#define SAL_RESID_POINTER_MOVEPOINT 10023
+#define SAL_RESID_POINTER_MOVEBEZIERWEIGHT 10024
+#define SAL_RESID_POINTER_MOVEDATA 10025
+#define SAL_RESID_POINTER_COPYDATA 10026
+#define SAL_RESID_POINTER_LINKDATA 10027
+#define SAL_RESID_POINTER_MOVEDATALINK 10028
+#define SAL_RESID_POINTER_COPYDATALINK 10029
+#define SAL_RESID_POINTER_MOVEFILE 10030
+#define SAL_RESID_POINTER_COPYFILE 10031
+#define SAL_RESID_POINTER_LINKFILE 10032
+#define SAL_RESID_POINTER_MOVEFILELINK 10033
+#define SAL_RESID_POINTER_COPYFILELINK 10034
+#define SAL_RESID_POINTER_MOVEFILES 10035
+#define SAL_RESID_POINTER_COPYFILES 10036
+#define SAL_RESID_POINTER_NOTALLOWED 10037
+#define SAL_RESID_POINTER_DRAW_LINE 10038
+#define SAL_RESID_POINTER_DRAW_RECT 10039
+#define SAL_RESID_POINTER_DRAW_POLYGON 10040
+#define SAL_RESID_POINTER_DRAW_BEZIER 10041
+#define SAL_RESID_POINTER_DRAW_ARC 10042
+#define SAL_RESID_POINTER_DRAW_PIE 10043
+#define SAL_RESID_POINTER_DRAW_CIRCLECUT 10044
+#define SAL_RESID_POINTER_DRAW_ELLIPSE 10045
+#define SAL_RESID_POINTER_DRAW_FREEHAND 10046
+#define SAL_RESID_POINTER_DRAW_CONNECT 10047
+#define SAL_RESID_POINTER_DRAW_TEXT 10048
+#define SAL_RESID_POINTER_DRAW_CAPTION 10049
+#define SAL_RESID_POINTER_CHART 10050
+#define SAL_RESID_POINTER_DETECTIVE 10051
+#define SAL_RESID_POINTER_PIVOT_COL 10052
+#define SAL_RESID_POINTER_PIVOT_ROW 10053
+#define SAL_RESID_POINTER_PIVOT_FIELD 10054
+#define SAL_RESID_POINTER_CHAIN 10055
+#define SAL_RESID_POINTER_CHAIN_NOTALLOWED 10056
+#define SAL_RESID_POINTER_TIMEEVENT_MOVE 10057
+#define SAL_RESID_POINTER_TIMEEVENT_SIZE 10058
+#define SAL_RESID_POINTER_AUTOSCROLL_N 10059
+#define SAL_RESID_POINTER_AUTOSCROLL_S 10060
+#define SAL_RESID_POINTER_AUTOSCROLL_W 10061
+#define SAL_RESID_POINTER_AUTOSCROLL_E 10062
+#define SAL_RESID_POINTER_AUTOSCROLL_NW 10063
+#define SAL_RESID_POINTER_AUTOSCROLL_NE 10064
+#define SAL_RESID_POINTER_AUTOSCROLL_SW 10065
+#define SAL_RESID_POINTER_AUTOSCROLL_SE 10066
+#define SAL_RESID_POINTER_AUTOSCROLL_NS 10067
+#define SAL_RESID_POINTER_AUTOSCROLL_WE 10068
+#define SAL_RESID_POINTER_AUTOSCROLL_NSWE 10069
+#define SAL_RESID_POINTER_AIRBRUSH 10070
+
+#define SAL_RESID_BITMAP_50 11000
+
+#define SAL_RESID_ICON_DEFAULT 1
+
+#endif // _SV_SALIDS_HRC
diff --git a/vcl/win/inc/salinst.h b/vcl/win/inc/salinst.h
new file mode 100644
index 000000000000..23046d961e0b
--- /dev/null
+++ b/vcl/win/inc/salinst.h
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALINST_H
+#define _SV_SALINST_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+#ifdef _VOS_NO_NAMESPACE
+class OMutex;
+#else
+namespace vos { class OMutex; }
+#endif
+class SalYieldMutex;
+class SalInstance;
+class SalFrame;
+class SalObject;
+
+// -------------------
+// - SalInstanceData -
+// -------------------
+
+class SalInstanceData
+{
+public:
+ HINSTANCE mhInst; // Instance Handle
+ HWND mhComWnd; // window, for communication (between threads and the main thread)
+ void* mpFilterInst;
+ void* mpFilterCallback;
+ SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex
+#ifdef _VOS_NO_NAMESPACE
+ OMutex* mpSalWaitMutex; // Sal-Wait-Mutex
+#else
+ vos::OMutex* mpSalWaitMutex; // Sal-Wait-Mutex
+#endif
+ USHORT mnYieldWaitCount; // Wait-Count
+};
+
+// --------------
+// - Prototypen -
+// --------------
+
+SalFrame* ImplSalCreateFrame( SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle );
+SalObject* ImplSalCreateObject( SalInstance* pInst, SalFrame* pParent );
+void ImplSalStartTimer( ULONG nMS, BOOL bMutex = FALSE );
+void ImplSalPrinterAbortJobAsync( HDC hPrnDC );
+
+#endif // _SV_SALINST_H
diff --git a/vcl/win/inc/salobj.h b/vcl/win/inc/salobj.h
new file mode 100644
index 000000000000..e32ba7e2d706
--- /dev/null
+++ b/vcl/win/inc/salobj.h
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALOBJ_H
+#define _SV_SALOBJ_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+// -----------------
+// - SalObjectData -
+// -----------------
+
+class SalObjectData
+{
+public:
+ HWND mhWnd; // Window handle
+ HWND mhWndChild; // Child Window handle
+ HWND mhLastFocusWnd; // Child-Window, welches als letztes den Focus hatte
+ SystemChildData maSysData; // SystemEnvData
+ RGNDATA* mpClipRgnData; // ClipRegion-Data
+ RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data
+ RECT* mpNextClipRect; // Naechstes ClipRegion-Rect
+ BOOL mbFirstClipRect; // Flag for first cliprect to insert
+ SalObject* mpNextObject; // pointer to next object
+ void* mpInst; // instance handle for callback
+ SALOBJECTPROC mpProc; // callback proc
+};
+
+#endif // _SV_SALOBJ_H
diff --git a/vcl/win/inc/salogl.hxx b/vcl/win/inc/salogl.hxx
new file mode 100644
index 000000000000..f3b6d480eb7c
--- /dev/null
+++ b/vcl/win/inc/salogl.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: salogl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALOGL_HXX
+#define _SV_SALOGL_HXX
+
+#define _OPENGL_EXT
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+#ifndef _SV_SALOTYPE_HXX
+#include <salotype.hxx>
+#endif
+
+// -----------------
+// - State defines -
+// -----------------
+
+#define OGL_STATE_UNLOADED (0x00000000)
+#define OGL_STATE_INVALID (0x00000001)
+#define OGL_STATE_VALID (0x00000002)
+
+// -------------
+// - SalOpenGL -
+// -------------
+
+class SalGraphics;
+class String;
+
+class SalOpenGL
+{
+private:
+ static HGLRC mhOGLContext;
+ static HDC mhOGLLastDC;
+ static ULONG mnOGLState;
+
+private:
+ static BOOL ImplInitLib();
+ static BOOL ImplInit();
+ static void ImplFreeLib();
+
+public:
+ SalOpenGL( SalGraphics* pGraphics );
+ ~SalOpenGL();
+
+ static BOOL Create();
+ static void Release();
+ static ULONG GetState() { return SalOpenGL::mnOGLState; }
+ static BOOL IsValid() { return( OGL_STATE_VALID == SalOpenGL::mnOGLState ); }
+
+ static void* GetOGLFnc( const char* pFncName );
+
+ static void OGLEntry( SalGraphics* pGraphics );
+ static void OGLExit( SalGraphics* pGraphics );
+};
+
+#endif // _SV_SALOGL_HXX
diff --git a/vcl/win/inc/salprn.h b/vcl/win/inc/salprn.h
new file mode 100644
index 000000000000..6baca8eaf352
--- /dev/null
+++ b/vcl/win/inc/salprn.h
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: salprn.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALPRN_H
+#define _SV_SALPRN_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalGraphics;
+class SalInfoPrinter;
+
+// -----------------
+// - SalDriverData -
+// -----------------
+
+// WNT3
+#define SAL_DRIVERDATA_SYSSIGN ((ULONG)0x574E5433)
+#define SAL_DRIVERDATA_VERSION 1
+#define SAL_DEVMODE( pSetupData ) ((LPDEVMODE)((pSetupData->mpDriverData) + (((SalDriverData*)(pSetupData->mpDriverData))->mnDriverOffset)))
+
+#pragma pack( 1 )
+
+struct SalDriverData
+{
+ ULONG mnSysSignature;
+ USHORT mnVersion;
+ USHORT mnDriverOffset;
+ BYTE maDriverData[1];
+};
+
+#pragma pack()
+
+// -------------------
+// - SalSysQueueData -
+// -------------------
+
+struct SalSysQueueData
+{
+ XubString maDriverName; // printer driver name
+ XubString maDeviceName; // printer device name
+ XubString maPortName; // printer port name
+ ByteString maDriverNameA; // printer driver name
+ ByteString maDeviceNameA; // printer device name
+ ByteString maPortNameA; // printer port name
+ BOOL mbAnsi; // TRUE - use A functions
+};
+
+// ----------------------
+// - SalInfoPrinterData -
+// ----------------------
+
+class SalInfoPrinterData
+{
+public:
+ SalGraphics* mpGraphics; // current Printer graphics
+ XubString maDriverName; // printer driver name
+ XubString maDeviceName; // printer device name
+ XubString maPortName; // printer port name
+ ByteString maDriverNameA; // printer driver name
+ ByteString maDeviceNameA; // printer device name
+ ByteString maPortNameA; // printer port name
+ HDC mhDC; // printer hdc
+ BOOL mbGraphics; // is Graphics used
+ BOOL mbAnsi;
+};
+
+// ------------------
+// - SalPrinterData -
+// ------------------
+
+class SalPrinterData
+{
+public:
+ SalGraphics* mpGraphics; // current Printer graphics
+ SalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter
+ SalPrinter* mpNextPrinter; // next printing printer
+ HDC mhDC; // printer hdc
+ ULONG mnError; // Error Code
+ ULONG mnCopies; // Kopien
+ BOOL mbCollate; // Sortierte Kopien
+ BOOL mbAbort; // Job Aborted
+};
+
+#endif // _SV_SALPRN_H
diff --git a/vcl/win/inc/salsys.h b/vcl/win/inc/salsys.h
new file mode 100644
index 000000000000..ea1b99504c26
--- /dev/null
+++ b/vcl/win/inc/salsys.h
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: salsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALSYS_H
+#define _SV_SALSYS_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalFrame;
+
+// -----------------
+// - SalSystemData -
+// -----------------
+
+class SalSystemData
+{
+};
+
+#endif // _SV_SALSYS_H
diff --git a/vcl/win/inc/salvd.h b/vcl/win/inc/salvd.h
new file mode 100644
index 000000000000..33439dc618f0
--- /dev/null
+++ b/vcl/win/inc/salvd.h
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SALVD_H
+#define _SV_SALVD_H
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+class SalGraphics;
+class SalVirtualDevice;
+
+// -----------------
+// - SalVirDevData -
+// -----------------
+
+class SalVirDevData
+{
+public:
+ HDC mhDC; // HDC or 0 for Cache Device
+ HBITMAP mhBmp; // Memory Bitmap
+ HBITMAP mhDefBmp; // Default Bitmap
+ SalGraphics* mpGraphics; // current VirDev graphics
+ SalVirtualDevice* mpNext; // next VirDev
+ USHORT mnBitCount; // BitCount (0 or 1)
+ BOOL mbGraphics; // is Graphics used
+};
+
+#endif // _SV_SALVD_H
diff --git a/vcl/win/inc/svsys.h b/vcl/win/inc/svsys.h
new file mode 100644
index 000000000000..6dec218faed3
--- /dev/null
+++ b/vcl/win/inc/svsys.h
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: svsys.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_SVSYS_H
+#define _SV_SVSYS_H
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#endif // _SV_SVSYS_H
diff --git a/vcl/win/inc/wincomp.hxx b/vcl/win/inc/wincomp.hxx
new file mode 100644
index 000000000000..52c646f18c2d
--- /dev/null
+++ b/vcl/win/inc/wincomp.hxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * $RCSfile: wincomp.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_WINCOMP_HXX
+#define _SV_WINCOMP_HXX
+
+#ifndef _STRING_H
+#include <string.h>
+#endif
+
+#ifndef _SV_SV_H
+#include <sv.h>
+#endif
+
+// ----------
+// - Strict -
+// ----------
+
+// Anpassungen fuer TypeChecking
+
+inline HPEN SelectPen( HDC hDC, HPEN hPen )
+{
+ return (HPEN)SelectObject( hDC, (HGDIOBJ)hPen );
+}
+
+inline void DeletePen( HPEN hPen )
+{
+ DeleteObject( (HGDIOBJ)hPen );
+}
+
+inline HPEN GetStockPen( int nObject )
+{
+ return (HPEN)GetStockObject( nObject );
+}
+
+inline HBRUSH SelectBrush( HDC hDC, HBRUSH hBrush )
+{
+ return (HBRUSH)SelectObject( hDC, (HGDIOBJ)hBrush );
+}
+
+inline void DeleteBrush( HBRUSH hBrush )
+{
+ DeleteObject( (HGDIOBJ)hBrush );
+}
+
+inline HBRUSH GetStockBrush( int nObject )
+{
+ return (HBRUSH)GetStockObject( nObject );
+}
+
+inline HFONT SelectFont( HDC hDC, HFONT hFont )
+{
+ return (HFONT)SelectObject( hDC, (HGDIOBJ)hFont );
+}
+
+inline void DeleteFont( HFONT hFont )
+{
+ DeleteObject( (HGDIOBJ)hFont );
+}
+
+inline HFONT GetStockFont( int nObject )
+{
+ return (HFONT)GetStockObject( nObject );
+}
+
+inline HBITMAP SelectBitmap( HDC hDC, HBITMAP hBitmap )
+{
+ return (HBITMAP)SelectObject( hDC, (HGDIOBJ)hBitmap );
+}
+
+inline void DeleteBitmap( HBITMAP hBitmap )
+{
+ DeleteObject( (HGDIOBJ)hBitmap );
+}
+
+inline void DeleteRegion( HRGN hRegion )
+{
+ DeleteObject( (HGDIOBJ)hRegion );
+}
+
+inline HPALETTE GetStockPalette( int nObject )
+{
+ return (HPALETTE)GetStockObject( nObject );
+}
+
+inline void DeletePalette( HPALETTE hPalette )
+{
+ DeleteObject( (HGDIOBJ)hPalette );
+}
+
+inline void SetWindowStyle( HWND hWnd, DWORD nStyle )
+{
+ SetWindowLong( hWnd, GWL_STYLE, nStyle );
+}
+
+inline DWORD GetWindowStyle( HWND hWnd )
+{
+ return GetWindowLong( hWnd, GWL_STYLE );
+}
+
+inline void SetWindowExStyle( HWND hWnd, DWORD nStyle )
+{
+ SetWindowLong( hWnd, GWL_EXSTYLE, nStyle );
+}
+
+inline DWORD GetWindowExStyle( HWND hWnd )
+{
+ return GetWindowLong( hWnd, GWL_EXSTYLE );
+}
+
+inline WIN_BOOL IsMinimized( HWND hWnd )
+{
+ return IsIconic( hWnd );
+}
+
+inline WIN_BOOL IsMaximized( HWND hWnd )
+{
+ return IsZoomed( hWnd );
+}
+
+inline void SetWindowFont( HWND hWnd, HFONT hFont, WIN_BOOL bRedraw )
+{
+ SendMessage( hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM((UINT)bRedraw,0) );
+}
+
+inline HFONT GetWindowFont( HWND hWnd )
+{
+ return (HFONT)(UINT)SendMessage( hWnd, WM_GETFONT, 0, 0 );
+}
+
+// ---------------------
+// - Windows/Window NT -
+// ---------------------
+
+// Anpassung fuer Unterschiede zwischen 3.x und NT
+
+inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
+{
+#ifndef WNT
+ SetClassWord( hWnd, GCW_HCURSOR, (WORD)hCursor );
+#else
+ SetClassLong( hWnd, GCL_HCURSOR, (DWORD)hCursor );
+#endif
+}
+
+inline HCURSOR GetClassCursor( HWND hWnd )
+{
+#ifndef WNT
+ return (HCURSOR)GetClassWord( hWnd, GCW_HCURSOR );
+#else
+ return (HCURSOR)GetClassLong( hWnd, GCL_HCURSOR );
+#endif
+}
+
+inline void SetClassIcon( HWND hWnd, HICON hIcon )
+{
+#ifndef WNT
+ SetClassWord( hWnd, GCW_HICON, (WORD)hIcon );
+#else
+ SetClassLong( hWnd, GCL_HICON, (DWORD)hIcon );
+#endif
+}
+
+inline HICON GetClassIcon( HWND hWnd )
+{
+#ifndef WNT
+ return (HICON)GetClassWord( hWnd, GCW_HICON );
+#else
+ return (HICON)GetClassLong( hWnd, GCL_HICON );
+#endif
+}
+
+inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
+{
+#ifndef WNT
+ return (HBRUSH)SetClassWord( hWnd, GCW_HBRBACKGROUND, (WORD)hBrush );
+#else
+ return (HBRUSH)SetClassLong( hWnd, GCL_HBRBACKGROUND, (DWORD)hBrush );
+#endif
+}
+
+inline HBRUSH GetClassBrush( HWND hWnd )
+{
+#ifndef WNT
+ return (HBRUSH)GetClassWord( hWnd, GCW_HBRBACKGROUND );
+#else
+ return (HBRUSH)GetClassLong( hWnd, GCL_HBRBACKGROUND );
+#endif
+}
+
+inline HINSTANCE GetWindowInstance( HWND hWnd )
+{
+#ifndef WNT
+ return (HINSTANCE)GetWindowWord( hWnd, GWW_HINSTANCE );
+#else
+ return (HINSTANCE)GetWindowLong( hWnd, GWL_HINSTANCE );
+#endif
+}
+
+#ifndef WNT
+inline UINT CharLowerBuff( LPSTR lpStr, UINT nLen )
+{
+ return AnsiLowerBuff( lpStr, nLen );
+}
+#endif
+
+#ifndef WNT
+inline UINT CharUpperBuff( LPSTR lpStr, UINT nLen )
+{
+ return AnsiUpperBuff( lpStr, nLen );
+}
+#endif
+
+#ifndef WNT
+inline void OemToChar( LPCSTR lpStr1, LPSTR lpStr2 )
+{
+ OemToAnsi( lpStr1, lpStr2 );
+}
+#endif
+
+
+// -----------------------------------
+// - Unterschiede zwischen 16/32-Bit -
+// -----------------------------------
+
+#ifdef WIN
+#define SVWINAPI WINAPI
+#else
+#define SVWINAPI APIENTRY
+#endif
+
+#ifdef WIN
+#define NEARDATA _near
+#else
+#define NEARDATA
+#endif
+
+// Zum kopieren von mehr als 64 KB
+#ifdef WIN
+inline void lmemcpy( void* pDst, const void* pSrc, ULONG nSize )
+{
+ hmemcpy( pDst, pSrc, nSize );
+}
+#else
+inline void lmemcpy( void* pDst, const void* pSrc, ULONG nSize )
+{
+ memcpy( pDst, pSrc, nSize );
+}
+#endif
+
+#ifdef WNT
+typedef LONG WinWeight;
+#else
+typedef int WinWeight;
+#endif
+
+
+// ----------------------------------------------------
+// - Steuerungen fuer Versionen und Laufzeit-Abfragen -
+// ----------------------------------------------------
+
+#if defined( WNT )
+#define W95_VERSION 400
+#else
+#define W95_VERSION 395
+#endif
+
+// Wenn eine 32-Bit SV Version die nur unter W95 laeuft gebildet werden soll,
+// muss nur dieses Define W40ONLY definiert werden
+#if ( WINVER >= 0x0400 )
+#define W40ONLY
+#endif
+
+// Wenn wir sowieso erst ab W95 laufen, brauchen wir auch keine
+// Laufzeit-Abfragen
+#ifdef W40ONLY
+#define W40IF
+#define W40NIF
+#define W40ELSE
+
+#else
+
+// Nur ein 32-Bit-SDK definiert WINVER >= 0x0400 und somit brauchen wir
+// diese W40-Abfragen auch nur hier. Die Abfragen, die sowohl fuer 3.1
+// als auch fuer NT gelten sind als normale if-Abfragen kodiert
+#ifdef WIN
+#define W40NIF
+#else
+#define W40IF if ( aSalShlData.mbW40 )
+#define W40NIF if ( !aSalShlData.mbW40 )
+#define W40ELSE else
+#endif
+
+#endif
+
+/****************************
+
+Beispiel fuer Klammerung:
+
+#if ( WINVER >= 0x0400 )
+ W40IF
+ {
+ ... W40-Code
+ }
+ W40ELSE
+#endif
+#ifndef W40ONLY
+ {
+ ... Normaler 3.1 und NT 3.5(1)-Code
+ }
+#endif
+
+*****************************/
+
+
+// ------------------------
+// - ZMouse Erweiterungen -
+// ------------------------
+
+#if defined( WNT )
+
+#ifdef UNICODE
+#define MSH_MOUSEWHEEL L"MSWHEEL_ROLLMSG"
+#else
+#define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
+#endif
+
+// Default value for rolling one notch
+#ifndef WHEEL_DELTA
+#define WHEEL_DELTA 120
+#endif
+
+#ifndef WM_MOUSEWHEEL
+#define WM_MOUSEWHEEL 0x020A
+#endif
+
+#ifndef WHEEL_PAGESCROLL
+// signifies to scroll a page, also defined in winuser.h in the NT4.0 SDK
+#define WHEEL_PAGESCROLL (UINT_MAX)
+#endif
+
+#ifdef UNICODE
+#define MOUSEZ_CLASSNAME L"MouseZ" // wheel window class
+#define MOUSEZ_TITLE L"Magellan MSWHEEL" // wheel window title
+#else
+#define MOUSEZ_CLASSNAME "MouseZ" // wheel window class
+#define MOUSEZ_TITLE "Magellan MSWHEEL" // wheel window title
+#endif
+
+#define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
+#define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
+
+#ifdef UNICODE
+#define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG"
+#else
+#define MSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG"
+#endif
+
+#ifndef SPI_GETWHEELSCROLLLINES
+#define SPI_GETWHEELSCROLLLINES 104
+#endif
+#ifndef SPI_SETWHEELSCROLLLINES
+#define SPI_SETWHEELSCROLLLINES 105
+#endif
+
+#endif
+
+
+// -----------------------------
+// - SystemAgent Erweiterungen -
+// -----------------------------
+
+#if ( WINVER >= 0x0400 )
+#define ENABLE_AGENT 1
+#define DISABLE_AGENT 2
+#define GET_AGENT_STATUS 3
+
+typedef int (SVWINAPI* SysAgt_Enable_PROC)( int );
+#endif
+
+// ---------------------
+// - 5.0-Erweiterungen -
+// ---------------------
+
+#ifndef COLOR_HOTLIGHT
+#define COLOR_HOTLIGHT 26
+#endif
+#ifndef COLOR_GRADIENTACTIVECAPTION
+#define COLOR_GRADIENTACTIVECAPTION 27
+#endif
+#ifndef COLOR_GRADIENTINACTIVECAPTION
+#define COLOR_GRADIENTINACTIVECAPTION 28
+#endif
+
+#endif // _SV_WINCOMP_HXX
diff --git a/vcl/win/source/app/MAKEFILE.MK b/vcl/win/source/app/MAKEFILE.MK
new file mode 100644
index 000000000000..f53f534b69a1
--- /dev/null
+++ b/vcl/win/source/app/MAKEFILE.MK
@@ -0,0 +1,40 @@
+#*************************************************************************
+#*
+#* $Workfile: makefile. $
+#*
+#* Ersterstellung TH 01.04.97
+#* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 17:05:49 $
+#* $Revision: 1.1.1.1 $
+#*
+#* $Logfile: T:/sv2/win/source/app/makefile.__v $
+#*
+#* Copyright (c) 1990 - 2000, STAR DIVISION
+#*
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salapp
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/salmain.obj
+
+SLOFILES= $(SLO)$/salshl.obj \
+ $(SLO)$/saldata.obj \
+ $(SLO)$/salinst.obj \
+ $(SLO)$/saltimer.obj \
+ $(SLO)$/salsound.obj \
+ $(SLO)$/salinfo.obj \
+ $(SLO)$/salsys.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx
new file mode 100644
index 000000000000..7142badf3a20
--- /dev/null
+++ b/vcl/win/source/app/saldata.cxx
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * $RCSfile: saldata.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALDATA_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+// =======================================================================
+
+rtl_TextEncoding ImplSalGetSystemEncoding()
+{
+ static UINT nOldAnsiCodePage = 0;
+ static rtl_TextEncoding eEncoding = RTL_TEXTENCODING_MS_1252;
+
+ UINT nAnsiCodePage = GetACP();
+ if ( nAnsiCodePage != nOldAnsiCodePage )
+ {
+ switch ( nAnsiCodePage )
+ {
+ case 1252:
+ eEncoding = RTL_TEXTENCODING_MS_1252;
+ break;
+ case 1250:
+ eEncoding = RTL_TEXTENCODING_MS_1250;
+ break;
+ case 1251:
+ eEncoding = RTL_TEXTENCODING_MS_1251;
+ break;
+ case 1253:
+ eEncoding = RTL_TEXTENCODING_MS_1253;
+ break;
+ case 1254:
+ eEncoding = RTL_TEXTENCODING_MS_1254;
+ break;
+ case 1255:
+ eEncoding = RTL_TEXTENCODING_MS_1255;
+ break;
+ case 1256:
+ eEncoding = RTL_TEXTENCODING_MS_1256;
+ break;
+ case 1257:
+ eEncoding = RTL_TEXTENCODING_MS_1257;
+ break;
+ case 1258:
+ eEncoding = RTL_TEXTENCODING_MS_1258;
+ break;
+ case 874:
+ eEncoding = RTL_TEXTENCODING_MS_874;
+ break;
+ case 932:
+ eEncoding = RTL_TEXTENCODING_MS_932;
+ break;
+ case 936:
+ eEncoding = RTL_TEXTENCODING_MS_936;
+ break;
+ case 949:
+ eEncoding = RTL_TEXTENCODING_MS_949;
+ break;
+ case 950:
+ eEncoding = RTL_TEXTENCODING_MS_950;
+ break;
+// case 1381:
+// eEncoding = RTL_TEXTENCODING_MS_1381;
+// break;
+ }
+ }
+
+ return eEncoding;
+}
+
+// -----------------------------------------------------------------------
+
+ByteString ImplSalGetWinAnsiString( const UniString& rStr, BOOL bFileName )
+{
+ rtl_TextEncoding eEncoding = ImplSalGetSystemEncoding();
+ if ( bFileName )
+ {
+ return ByteString( rStr, eEncoding,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
+ }
+ else
+ {
+ return ByteString( rStr, eEncoding,
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
+ RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen )
+{
+ return UniString( pStr, nLen, ImplSalGetSystemEncoding(),
+ RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
+}
+
+// =======================================================================
+
+int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 )
+{
+ int nRet;
+ wchar_t c1;
+ char c2;
+ do
+ {
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+ nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2));
+ if ( nRet != 0 )
+ break;
+
+ pStr1++;
+ pStr2++;
+ }
+ while ( c2 );
+
+ return nRet;
+}
+
+// =======================================================================
+
+LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong )
+{
+ if ( aSalShlData.mbWNT )
+ return SetWindowLongW( hWnd, nIndex, dwNewLong );
+ else
+ return SetWindowLongA( hWnd, nIndex, dwNewLong );
+}
+
+// -----------------------------------------------------------------------
+
+LONG ImplGetWindowLong( HWND hWnd, int nIndex )
+{
+ if ( aSalShlData.mbWNT )
+ return GetWindowLongW( hWnd, nIndex );
+ else
+ return GetWindowLongA( hWnd, nIndex );
+}
+
+// -----------------------------------------------------------------------
+
+WIN_BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ if ( aSalShlData.mbWNT )
+ return PostMessageW( hWnd, nMsg, wParam, lParam );
+ else
+ return PostMessageA( hWnd, nMsg, wParam, lParam );
+}
+
+// -----------------------------------------------------------------------
+
+WIN_BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ if ( aSalShlData.mbWNT )
+ return SendMessageW( hWnd, nMsg, wParam, lParam );
+ else
+ return SendMessageA( hWnd, nMsg, wParam, lParam );
+}
+
+// -----------------------------------------------------------------------
+
+WIN_BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax )
+{
+ if ( aSalShlData.mbWNT )
+ return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax );
+ else
+ return GetMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax );
+}
+
+// -----------------------------------------------------------------------
+
+WIN_BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg )
+{
+ if ( aSalShlData.mbWNT )
+ return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg );
+ else
+ return PeekMessageA( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg );
+}
+
+// -----------------------------------------------------------------------
+
+LONG ImplDispatchMessage( CONST MSG *lpMsg )
+{
+ if ( aSalShlData.mbWNT )
+ return DispatchMessageW( lpMsg );
+ else
+ return DispatchMessageA( lpMsg );
+}
+
diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx
new file mode 100644
index 000000000000..97a3b0c97e35
--- /dev/null
+++ b/vcl/win/source/app/salinfo.cxx
@@ -0,0 +1,884 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinfo.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef ENABLEUNICODE
+
+#define VCL_NEED_BASETSD
+
+#include <tools/presys.h>
+#include <windows.h>
+#include <imagehlp.h>
+#include <tools/postsys.h>
+
+#include <salsys.hxx>
+
+/* !!! UNICODE !!! */
+XubString SalSystem::GetSummarySystemInfos( ULONG nFlags )
+{
+ return XubString();
+}
+
+#else
+
+#define VCL_NEED_BASETSD
+
+#include <tools/presys.h>
+#include <windows.h>
+#include <imagehlp.h>
+#include <tools/postsys.h>
+
+#include <stdio.h>
+#include <tools/string.hxx>
+#include <salsys.hxx>
+
+// Wegen Stacktrace-Generierung
+#pragma optimize ("", off)
+
+// #include <tlhelp32.h>
+// ToolHelp32
+#define MAX_MODULE_NAME32 255
+#define TH32CS_SNAPMODULE 0x00000008
+
+typedef struct tagMODULEENTRY32
+{
+ DWORD dwSize;
+ DWORD th32ModuleID; // This module
+ DWORD th32ProcessID; // owning process
+ DWORD GlblcntUsage; // Global usage count on the module
+ DWORD ProccntUsage; // Module usage count in th32ProcessID's context
+ BYTE * modBaseAddr; // Base address of module in th32ProcessID's context
+ DWORD modBaseSize; // Size in bytes of module starting at modBaseAddr
+ HMODULE hModule; // The hModule of this module in th32ProcessID's context
+ char szModule[MAX_MODULE_NAME32 + 1];
+ char szExePath[MAX_PATH];
+} MODULEENTRY32;
+typedef MODULEENTRY32 * PMODULEENTRY32;
+typedef MODULEENTRY32 * LPMODULEENTRY32;
+
+// PSAPI functions - Windows NT only
+typedef struct _MODULEINFO {
+ LPVOID lpBaseOfDll;
+ DWORD SizeOfImage;
+ LPVOID EntryPoint;
+} MODULEINFO, *LPMODULEINFO;
+
+
+
+// PSAPI
+typedef BOOL (WINAPI *ENUMPROCESSMODULESPROC)( HANDLE hProcess, HMODULE* lphModule, DWORD cb, LPDWORD lpcbNeeded );
+typedef BOOL (WINAPI *GETMODULEINFORMATIONPROC)( HANDLE hProcess, HMODULE hModule, LPMODULEINFO lpmodinfo, DWORD cb );
+typedef DWORD (WINAPI *GETMODULEBASENAMEAPROC)( HANDLE hProcess, HMODULE hModule, LPSTR lpBaseName, DWORD nSize );
+typedef DWORD (WINAPI *GETMODULEFILENAMEEXAPROC)( HANDLE hProcess, HMODULE hModule, LPSTR lpFilename, DWORD nSize );
+typedef HANDLE (WINAPI *CREATESNAPSHOTPROC)(DWORD dwFlags, DWORD th32ProcessID);
+typedef BOOL (WINAPI *MODULE32FIRSTPROC)( HANDLE hSnapshot, LPMODULEENTRY32 lpme );
+typedef BOOL (WINAPI *MODULE32NEXTPROC)( HANDLE hSnapshot, LPMODULEENTRY32 lpme );
+
+
+// ImageHlp
+typedef int (__stdcall *STACKWALKPROC) ( DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID, PREAD_PROCESS_MEMORY_ROUTINE,PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE );
+typedef LPVOID (__stdcall *SYMFUNCTIONTABLEACCESSPROC)( HANDLE, DWORD );
+typedef DWORD (__stdcall *SYMGETMODULEBASEPROC)( HANDLE, DWORD );
+typedef DWORD (__stdcall *SYMSETOPTIONSPROC ) (DWORD dwSymOptions);
+typedef int (__stdcall *SYMINITIALIZEPROC ) ( HANDLE, LPSTR, int );
+typedef int (__stdcall *SYMCLEANUPPROC)( HANDLE );
+typedef DWORD (__stdcall WINAPI *UNDECORATESYMBOLNAMEPROC)( PCSTR, PSTR, DWORD, DWORD );
+typedef DWORD (__stdcall *SYMLOADMODULEPROC) ( HANDLE, HANDLE, LPSTR, LPSTR, DWORD, DWORD );
+typedef int (__stdcall *SYMGETSYMFROMADDR)( HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL );
+
+
+struct ModuleInfo
+{
+ struct ModuleInfo* pNext;
+
+ char szModBaseName[MAX_PATH];
+ char szModFileName[MAX_PATH];
+ unsigned long nBaseAddress;
+ unsigned long nSize;
+// unsigned long nEntryPoint;
+// HANDLE nHandle;
+// PIMAGE_DEBUG_INFORMATION pDebugInfos;
+};
+
+struct ModuleInfo* FindModuleContainingAddress( struct ModuleInfo* pStart, void* pAddr );
+
+
+
+struct SystemInfos
+{
+ DWORD nCurrentProcessId;
+ HANDLE hCurrentProcess;
+ DWORD nCurrentThreadId;
+ HANDLE hCurrentThread;
+
+ ModuleInfo* pModInfos;
+
+ String aStack;
+ String aModules;
+ String aSystemVersion;
+ String aCPUType;
+ String aMemoryInfo;
+ String aLocalVolumes;
+ String aSystemDirs;
+ String aMouseInfo;
+
+ SystemInfos()
+ {
+ nCurrentProcessId = 0;
+ hCurrentProcess = 0;
+ hCurrentThread = 0;
+ pModInfos = NULL;
+ }
+};
+
+void DebugThread( SystemInfos* pSysInfos );
+
+
+typedef struct _Thread
+{
+ DWORD dwThreadId;
+ HANDLE hThread;
+} Thread;
+
+
+struct ModuleInfo* WNT_CreateModuleInfos();
+
+String ImplCreateToken( const String& rToken )
+{
+ String aToken( '<' );
+ aToken += rToken;
+ aToken += ' ';
+ while ( aToken.Len() < 25 )
+ aToken += '-';
+ aToken += '>';
+ return aToken;
+}
+
+
+
+String WNT_CreateModulePath( struct ModuleInfo* pModInfos )
+{
+ String aPath;
+ struct ModuleInfo* pM = pModInfos;
+ while ( pM )
+ {
+ String aTmpPath = pM->szModFileName;
+ USHORT n = aTmpPath.SearchBackward( '\\' );
+ if ( n != STRING_NOTFOUND )
+ aTmpPath.Erase( n );
+ aTmpPath += ';';
+ aTmpPath.ToLower();
+ if ( aPath.Search( aTmpPath ) == STRING_NOTFOUND )
+ aPath += aTmpPath;
+
+ pM = pM->pNext;
+ }
+ return aPath;
+}
+
+
+struct ModuleInfo* WNT_CreateModuleInfos()
+{
+ struct ModuleInfo* pModInfos = NULL;
+
+ OSVERSIONINFO aOSVersion;
+ aOSVersion.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
+ if ( GetVersionEx( &aOSVersion ) )
+ {
+ if ( aOSVersion.dwPlatformId == VER_PLATFORM_WIN32_NT )
+ {
+ HINSTANCE hPSAPILib = LoadLibrary( "PSAPI.DLL" );
+ if( hPSAPILib )
+ {
+ ENUMPROCESSMODULESPROC _fpEnumProcessModules = (ENUMPROCESSMODULESPROC) GetProcAddress( hPSAPILib, "EnumProcessModules" );
+ GETMODULEINFORMATIONPROC _fpGetModuleInformation = (GETMODULEINFORMATIONPROC) GetProcAddress( hPSAPILib, "GetModuleInformation" );
+ GETMODULEBASENAMEAPROC _fpGetModuleBaseNameA = (GETMODULEBASENAMEAPROC) GetProcAddress( hPSAPILib, "GetModuleBaseNameA" );
+ GETMODULEFILENAMEEXAPROC _fpGetModuleFileNameExA = (GETMODULEFILENAMEEXAPROC) GetProcAddress( hPSAPILib, "GetModuleFileNameExA" );
+
+ HANDLE hProcess = GetCurrentProcess();
+ HMODULE hMods[1024];
+ DWORD cbNeeded;
+ if( _fpEnumProcessModules( hProcess, hMods, sizeof(hMods), &cbNeeded ) )
+ {
+ int nMods = cbNeeded / sizeof( HMODULE );
+ int nArrSz = nMods * sizeof( struct ModuleInfo );
+ pModInfos = (struct ModuleInfo*) malloc( nArrSz );
+ memset( pModInfos, 0, nArrSz );
+
+ for ( int i = 0; i < nMods; i++ )
+ {
+ pModInfos[i].pNext = 0;
+ if ( i )
+ pModInfos[i-1].pNext = &pModInfos[i];
+
+ _fpGetModuleBaseNameA( hProcess, hMods[i], pModInfos[i].szModBaseName, sizeof( pModInfos[i].szModBaseName ) );
+ _fpGetModuleFileNameExA( hProcess, hMods[i], pModInfos[i].szModFileName, sizeof( pModInfos[i].szModFileName ) );
+
+ MODULEINFO aInf;
+ if ( _fpGetModuleInformation( hProcess, hMods[i], &aInf, sizeof( aInf ) ) )
+ {
+ pModInfos[i].nBaseAddress = (unsigned long) aInf.lpBaseOfDll;
+ pModInfos[i].nSize = aInf.SizeOfImage;
+ // pModInfos[i].nEntryPoint = (unsigned long) aInf.EntryPoint;
+ }
+ }
+ }
+ FreeLibrary( hPSAPILib );
+ }
+ }
+ else if ( aOSVersion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
+ {
+ HINSTANCE hToolHelpLib = LoadLibrary( "KERNEL32.DLL" );
+ if( hToolHelpLib )
+ {
+ CREATESNAPSHOTPROC _fpCreateSnapshot = (CREATESNAPSHOTPROC) GetProcAddress( hToolHelpLib, "CreateToolhelp32Snapshot" );
+ MODULE32FIRSTPROC _fpModule32First = (MODULE32FIRSTPROC) GetProcAddress( hToolHelpLib, "Module32First" );
+ MODULE32NEXTPROC _fpModule32Next = (MODULE32NEXTPROC) GetProcAddress( hToolHelpLib, "Module32Next" );
+
+ HANDLE hSnap = _fpCreateSnapshot( TH32CS_SNAPMODULE, 0 );
+ if ( hSnap )
+ {
+ MODULEENTRY32 aMod32Entry;
+ ZeroMemory( &aMod32Entry, sizeof( MODULEENTRY32 ) );
+ aMod32Entry.dwSize = sizeof( MODULEENTRY32 );
+ int nMods = 0;
+ BOOL bMod = _fpModule32First( hSnap, &aMod32Entry );
+ while ( bMod )
+ {
+ nMods++;
+ bMod = _fpModule32Next( hSnap, &aMod32Entry );
+ }
+
+ int nArrSz = nMods * sizeof( struct ModuleInfo );
+ pModInfos = (struct ModuleInfo*) malloc( nArrSz );
+ memset( pModInfos, 0, nArrSz );
+
+ int nMod = 0;
+ bMod = _fpModule32First( hSnap, &aMod32Entry );
+ while ( bMod )
+ {
+ pModInfos[nMod].pNext = 0;
+ if ( nMod )
+ pModInfos[nMod-1].pNext = &pModInfos[nMod];
+
+ strcpy( pModInfos[nMod].szModBaseName, aMod32Entry.szModule );
+ strcpy( pModInfos[nMod].szModFileName, aMod32Entry.szExePath );
+ pModInfos[nMod].nBaseAddress = (unsigned long) aMod32Entry.modBaseAddr;
+ pModInfos[nMod].nSize = aMod32Entry.modBaseSize;
+// pModInfos[nMod].nEntryPoint = 0xFFFFFFFF;
+
+ bMod = _fpModule32Next( hSnap, &aMod32Entry );
+ nMod++;
+ }
+
+ CloseHandle( hSnap );
+ }
+
+ FreeLibrary( hToolHelpLib );
+ }
+ }
+ }
+ return pModInfos;
+}
+
+BOOL WNT_GetLogicalAddress( PVOID addr, PTSTR szModule, DWORD len, DWORD& section, DWORD& offset )
+{
+ MEMORY_BASIC_INFORMATION mbi;
+
+ if( VirtualQuery( addr, &mbi, sizeof(mbi) ) && mbi.AllocationBase )
+ {
+ DWORD hMod = (DWORD)mbi.AllocationBase;
+
+ if ( !GetModuleFileName( (HMODULE)hMod, szModule, len ) )
+ return FALSE;
+
+ // Point to the DOS header in memory
+ PIMAGE_DOS_HEADER pDosHdr = (PIMAGE_DOS_HEADER)hMod;
+
+ // From the DOS header, find the NT (PE) header
+ PIMAGE_NT_HEADERS pNtHdr = (PIMAGE_NT_HEADERS)(hMod + pDosHdr->e_lfanew);
+
+ PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION( pNtHdr );
+
+ DWORD rva = (DWORD)addr - hMod; // RVA is offset from module load address
+
+ // Iterate through the section table, looking for the one that encompasses
+ // the linear address.
+ for ( unsigned i = 0;
+ i < pNtHdr->FileHeader.NumberOfSections;
+ i++, pSection++ )
+ {
+ DWORD sectionStart = pSection->VirtualAddress;
+ DWORD sectionEnd = sectionStart
+ + max(pSection->SizeOfRawData, pSection->Misc.VirtualSize);
+
+ // Is the address in this section???
+ if ( (rva >= sectionStart) && (rva <= sectionEnd) )
+ {
+ // Yes, address is in the section. Calculate section and offset,
+ // and store in the "section" & "offset" params, which were
+ // passed by reference.
+ section = i+1;
+ offset = rva - sectionStart;
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+
+struct ModuleInfo* FindModuleContainingAddress( struct ModuleInfo* pStart, void* pAddr )
+{
+ struct ModuleInfo* pRet = NULL;
+ struct ModuleInfo* pM = pStart;
+ unsigned long nAddr = (unsigned long) pAddr;
+
+ while ( pM && !pRet )
+ {
+ if ( ( nAddr >= pM->nBaseAddress ) &&
+ ( nAddr < ( pM->nBaseAddress + pM->nSize ) ) )
+ {
+ pRet = pM;
+ }
+ else
+ {
+ pM = pM->pNext;
+ }
+ }
+ return pRet;
+}
+
+String _OLD_GetStackInfo()
+{
+ // Try an other way...
+ String aTmpStack;
+ ModuleInfo* pMods = WNT_CreateModuleInfos();
+
+ ULONG* pBP;
+ __asm mov pBP, ebp;
+ char buffer[1024];
+
+ for ( int i = 0; i < 15; i++ )
+ {
+ ULONG nIP = pBP[1];
+ sprintf( buffer, "[%.2u] IP=%.8lx", i, nIP );
+ aTmpStack += buffer;
+
+ ModuleInfo* pI = FindModuleContainingAddress( pMods, (void*)nIP );
+ if ( pI )
+ {
+ sprintf( buffer, " (Rel=%.8lx) [%s, Base=%.8lx, Path=%s]", nIP-pI->nBaseAddress-0x1000, pI->szModBaseName, pI->nBaseAddress, pI->szModFileName );
+ aTmpStack += buffer;
+ }
+
+ if ( !pI || (pBP[0] & 3) || (ULONG)pBP > pBP[0] )
+ {
+ aTmpStack += "\nError!\n";
+ break;
+ }
+
+ aTmpStack += '\n';
+ pBP = (ULONG*) pBP[0];
+ }
+
+ // Modul-Infos zerstoeren...
+ return aTmpStack;
+}
+
+String SalSystem::GetSummarySystemInfos( ULONG nFlags)
+{
+ SystemInfos aSysInfos;
+ HANDLE nCurrentThreadPseudo = GetCurrentThread();
+ HANDLE nCurrentProcessPseudo = GetCurrentProcess();
+ aSysInfos.nCurrentThreadId = GetCurrentThreadId();
+ DuplicateHandle( nCurrentProcessPseudo, nCurrentThreadPseudo, nCurrentProcessPseudo,
+ &aSysInfos.hCurrentThread, PROCESS_ALL_ACCESS, TRUE, 0 );
+ aSysInfos.nCurrentProcessId = GetCurrentProcessId();
+ DuplicateHandle( nCurrentProcessPseudo, nCurrentProcessPseudo, nCurrentProcessPseudo,
+ &aSysInfos.hCurrentProcess, PROCESS_ALL_ACCESS, TRUE, 0 );
+
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_STACK )
+ {
+ DWORD nDebugThreadId;
+ HANDLE hDebugThread = CreateThread(
+ NULL, 16000,
+ (LPTHREAD_START_ROUTINE)DebugThread, &aSysInfos,
+ 0, &nDebugThreadId );
+
+ WaitForSingleObject( hDebugThread, INFINITE );
+ CloseHandle( hDebugThread );
+ }
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_MODULES )
+ {
+ aSysInfos.aModules = "<Modules>\n";
+ char buffer[1024];
+ if ( !aSysInfos.pModInfos )
+ aSysInfos.pModInfos = WNT_CreateModuleInfos();
+ struct ModuleInfo* pM = aSysInfos.pModInfos;
+ while ( pM )
+ {
+ aSysInfos.aModules += " <Module name=\"";
+ aSysInfos.aModules += pM->szModBaseName;
+ aSysInfos.aModules += "\" path=\"";
+ aSysInfos.aModules += pM->szModFileName;
+ aSysInfos.aModules += "\" >\n";
+ aSysInfos.aModules += " <ModuleInfo name=\"BASE\" value=\"";
+ sprintf( buffer, "%.8lx", pM->nBaseAddress );
+ aSysInfos.aModules += buffer;
+ aSysInfos.aModules += "\" />\n";
+ aSysInfos.aModules += " <ModuleInfo name=\"Size\" value=\"";
+ aSysInfos.aModules += pM->nSize;
+ aSysInfos.aModules += "\" />\n </Module>\n";
+ pM = pM->pNext;
+ }
+ aSysInfos.aModules += "</Modules>";
+ }
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_SYSTEMVERSION )
+ {
+ aSysInfos.aSystemVersion = "<System name=\"";
+ OSVERSIONINFO aVersionInfos;
+ memset(&aVersionInfos, 0, sizeof( OSVERSIONINFO ) );
+ aVersionInfos.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
+ GetVersionEx( &aVersionInfos );
+ if ( aVersionInfos.dwPlatformId == VER_PLATFORM_WIN32s )
+ aSysInfos.aSystemVersion += "Microsoft Win32s";
+ else if ( aVersionInfos.dwPlatformId == VER_PLATFORM_WIN32_NT )
+ aSysInfos.aSystemVersion += "Microsoft Windows NT";
+ else if ( aVersionInfos.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
+ {
+ if ( !aVersionInfos.dwMinorVersion )
+ aSysInfos.aSystemVersion += "Microsoft Windows 95";
+ else
+ aSysInfos.aSystemVersion += "Microsoft Windows 98";
+ }
+ else
+ aSysInfos.aSystemVersion += "Unknown Windows";
+ aSysInfos.aSystemVersion += "\" version=\"";
+ aSysInfos.aSystemVersion += aVersionInfos.dwMajorVersion;
+ aSysInfos.aSystemVersion += '.';
+ aSysInfos.aSystemVersion += aVersionInfos.dwMinorVersion;
+ aSysInfos.aSystemVersion += "\" build=\"";
+ aSysInfos.aSystemVersion += aVersionInfos.dwBuildNumber&0xFFFF;
+ aSysInfos.aSystemVersion += "\" />";
+
+ // aSysInfos.aSystemVersion += aVersionInfos.szCSDVersion;
+ /*
+ Under both Windows NT and Windows 95, you can get the
+ language information in the FileVersionInfo of User.exe by
+ calling GetFileVersionInfo, and then
+ VerQueryValue (on \\VarFileInfo\\Translation") on the
+ VersionInfo block of the operating system's User.exe.
+ NOTE: This method is the most reliable. It works well under
+ both Windows NT and Windows 95. This method also works for
+ Windows 3.1
+ */
+// DWORD nDefInputLanguage;
+// if ( SystemParametersInfo( SPI_GETDEFAULTINPUTLANG, 0, &nDefInputLanguage, 0 ) )
+// {
+// aSysInfos.aSystemVersion += " default input language = ";
+// aSysInfos.aSystemVersion += nDefInputLanguage;
+// }
+ }
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_CPUTYPE )
+ {
+ SYSTEM_INFO aSystemInfo;
+ memset( &aSystemInfo, 0, sizeof( SYSTEM_INFO ) );
+ GetSystemInfo( &aSystemInfo );
+ aSysInfos.aCPUType = "<CPU count=\"";
+ aSysInfos.aCPUType += aSystemInfo.dwNumberOfProcessors;
+ aSysInfos.aCPUType += "\" type=\"";
+ if ( aSystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
+ aSysInfos.aCPUType += "X86";
+ else if ( aSystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
+ aSysInfos.aCPUType += "MIPS";
+ else if ( aSystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
+ aSysInfos.aCPUType += "ALPHA";
+ else if ( aSystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
+ aSysInfos.aCPUType += "PPC";
+ else
+ aSysInfos.aCPUType += "unknown";
+ aSysInfos.aCPUType += "\"></CPU>";
+ }
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_MEMORYINFO )
+ {
+ MEMORYSTATUS aMemStatus;
+ memset( &aMemStatus, 0, sizeof( MEMORYSTATUS ) );
+ GlobalMemoryStatus( &aMemStatus );
+ aSysInfos.aMemoryInfo = "<Memory>\n";
+ aSysInfos.aMemoryInfo += " <MemoryType name=\"Physical\" total=\"";
+ aSysInfos.aMemoryInfo += (aMemStatus.dwTotalPhys+512)/1024/1024+1;
+ aSysInfos.aMemoryInfo += " MB\" free=\"";
+ aSysInfos.aMemoryInfo += (aMemStatus.dwAvailPhys+512)/1024/1024+1;
+ aSysInfos.aMemoryInfo += " MB\" />\n";
+ aSysInfos.aMemoryInfo += " <MemoryType name=\"Swap\" total=\"";
+ aSysInfos.aMemoryInfo += (aMemStatus.dwTotalPageFile+512)/1024/1024+1;
+ aSysInfos.aMemoryInfo += " MB\" free=\"";
+ aSysInfos.aMemoryInfo += (aMemStatus.dwAvailPageFile+512)/1024/1024+1;
+ aSysInfos.aMemoryInfo += " MB\" />\n";
+ aSysInfos.aMemoryInfo += " <MemoryType name=\"Virtual\" total=\"";
+ aSysInfos.aMemoryInfo += (aMemStatus.dwTotalVirtual+512)/1024/1024+1;
+ aSysInfos.aMemoryInfo += " MB\" free=\"";
+ aSysInfos.aMemoryInfo += (aMemStatus.dwAvailVirtual+512)/1024/1024+1;
+ aSysInfos.aMemoryInfo += " MB\" />\n";
+ aSysInfos.aMemoryInfo += "</Memory>";
+ }
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_LOCALVOLUMES )
+ {
+ aSysInfos.aLocalVolumes = "<LocalVolumes>\n";
+ char aDriveStrings[4096];
+ GetLogicalDriveStrings( 4096, aDriveStrings );
+ LPTSTR pDriveStr = aDriveStrings;
+ while ( *pDriveStr )
+ {
+ UINT nType = GetDriveType( pDriveStr );
+ if ( nType != DRIVE_REMOTE )
+ {
+ aSysInfos.aLocalVolumes += " <LocalVolume type=\"";
+
+ switch ( nType )
+ {
+ case DRIVE_REMOVABLE: aSysInfos.aLocalVolumes += "Removable"; break;
+ case DRIVE_FIXED: aSysInfos.aLocalVolumes += "Fixed"; break;
+ case DRIVE_REMOTE: aSysInfos.aLocalVolumes += "Remote"; break;
+ case DRIVE_CDROM: aSysInfos.aLocalVolumes += "CD-ROM"; break;
+ case DRIVE_RAMDISK: aSysInfos.aLocalVolumes += "RAM disk"; break;
+ default: aSysInfos.aLocalVolumes += "Unkown";
+ }
+ aSysInfos.aLocalVolumes += "\" path=\"";
+ aSysInfos.aLocalVolumes += pDriveStr;
+ aSysInfos.aLocalVolumes += "\"";
+ if( nType == DRIVE_FIXED )
+ {
+ DWORD nSectorsPerCluster;
+ DWORD nBytesPerSector;
+ DWORD nNumberFreeClusters;
+ DWORD nNumberTotalClusters;
+ if( GetDiskFreeSpace( pDriveStr, &nSectorsPerCluster, &nBytesPerSector, &nNumberFreeClusters, &nNumberTotalClusters ) )
+ {
+ DWORD nUnitsPerCluster = nSectorsPerCluster*nBytesPerSector;
+ DWORD nUnitDivi = 1;
+ String aUnit = "bytes";
+ if( ( nUnitsPerCluster % 1024 ) == 0 )
+ {
+ aUnit = "KB";
+ nUnitsPerCluster /= 1024;
+ }
+ else if( ( nUnitsPerCluster % 512 ) == 0 )
+ {
+ aUnit = "KB";
+ nUnitDivi = 1024;
+ }
+ DWORD nFree = nNumberFreeClusters*nUnitsPerCluster/nUnitDivi;
+ aSysInfos.aLocalVolumes += " free=\"";
+ aSysInfos.aLocalVolumes += nFree;
+ aSysInfos.aLocalVolumes += ' ';
+ aSysInfos.aLocalVolumes += aUnit;
+ aSysInfos.aLocalVolumes += "\"";
+ }
+ }
+ aSysInfos.aLocalVolumes += " />\n";
+ }
+ while ( *pDriveStr )
+ pDriveStr++;
+ pDriveStr++;
+ }
+ aSysInfos.aLocalVolumes += "</LocalVolumes>";
+ }
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_SYSTEMDIRS )
+ {
+ aSysInfos.aSystemDirs = "<SystemDirs>\n";
+ char buffer[ MAX_PATH ];
+ aSysInfos.aSystemDirs += " <SystemDir envname=\"Windows\" path=\"";
+ if( GetWindowsDirectory( buffer, MAX_PATH ) )
+ aSysInfos.aSystemDirs += buffer;
+ aSysInfos.aSystemDirs += "\" />\n";
+
+ aSysInfos.aSystemDirs += " <SystemDir envname=\"System\" path=\"";
+ if( GetSystemDirectory( buffer, MAX_PATH ) )
+ aSysInfos.aSystemDirs += buffer;
+ aSysInfos.aSystemDirs += "\" />\n";
+
+ aSysInfos.aSystemDirs += " <SystemDir envname=\"Current\" path=\"";
+ if( GetCurrentDirectory( MAX_PATH, buffer ) )
+ aSysInfos.aSystemDirs += buffer;
+ aSysInfos.aSystemDirs += "\" />\n";
+
+ aSysInfos.aSystemDirs += " <SystemDir envname=\"Temp\" path=\"";
+ if( GetTempPath( MAX_PATH, buffer ) )
+ aSysInfos.aSystemDirs += buffer;
+ aSysInfos.aSystemDirs += "\" />\n";
+ aSysInfos.aSystemDirs += "</SystemDirs>";
+
+ }
+ if ( nFlags & SALSYSTEM_GETSYSTEMINFO_MOUSEINFO )
+ {
+ aSysInfos.aMouseInfo = "<Mouse ";
+ int nRet = GetSystemMetrics( SM_CMOUSEBUTTONS );
+ if ( nRet )
+ {
+ aSysInfos.aMouseInfo += "buttons=\"";
+ aSysInfos.aMouseInfo += nRet;
+ aSysInfos.aMouseInfo += "\" description=\"";
+ if( GetSystemMetrics( 75 /*SM_MOUSEWHEELPRESENT - missing in SDK from MSVC4.2 */ ) )
+ aSysInfos.aMouseInfo += "wheel mouse";
+ else
+ aSysInfos.aMouseInfo += "standard mouse";
+ aSysInfos.aMouseInfo += "\"";
+ }
+ else
+ {
+ aSysInfos.aMouseInfo += "description=\"Not installed.\"";
+ }
+ aSysInfos.aMouseInfo += " />";
+ }
+
+ CloseHandle( aSysInfos.hCurrentThread );
+ CloseHandle( aSysInfos.hCurrentProcess );
+
+ String aInfos;
+
+ aInfos += aSysInfos.aSystemVersion;
+ aInfos += "\n\n";
+
+ aInfos += aSysInfos.aCPUType;
+ aInfos += "\n\n";
+
+ aInfos += aSysInfos.aMouseInfo;
+ aInfos += "\n\n";
+
+ aInfos += aSysInfos.aMemoryInfo;
+ aInfos += "\n\n";
+
+ aInfos += aSysInfos.aStack;
+ aInfos += "\n\n";
+
+ aInfos += aSysInfos.aModules;
+ aInfos += "\n\n";
+
+ aInfos += aSysInfos.aLocalVolumes;
+ aInfos += "\n\n";
+
+ aInfos += aSysInfos.aSystemDirs;
+ aInfos += "\n\n";
+
+ return aInfos;
+}
+
+
+
+
+void DebugThread( SystemInfos* pSysInfos )
+{
+ HINSTANCE hImageHelpLib = LoadLibrary( "IMAGEHLP.DLL" );
+ if( hImageHelpLib )
+ {
+ if ( SuspendThread( pSysInfos->hCurrentThread ) != 0xFFFFFFFF )
+ {
+ STACKFRAME aStackFrame;
+ memset( &aStackFrame, 0, sizeof( aStackFrame ) );
+
+ CONTEXT aContext;
+ memset( &aContext, 0, sizeof( aContext ) );
+ aContext.ContextFlags = CONTEXT_FULL;
+ if ( GetThreadContext( pSysInfos->hCurrentThread, &aContext ) )
+ {
+ STACKWALKPROC _fpStackWalk = (STACKWALKPROC) GetProcAddress( hImageHelpLib, "StackWalk" );
+ SYMFUNCTIONTABLEACCESSPROC _fpSymFunctionTableAccess = (SYMFUNCTIONTABLEACCESSPROC) GetProcAddress( hImageHelpLib, "SymFunctionTableAccess" );
+ SYMGETMODULEBASEPROC _fpSymGetModuleBase = (SYMGETMODULEBASEPROC) GetProcAddress( hImageHelpLib, "SymGetModuleBase" );
+ SYMSETOPTIONSPROC _fpSymSetOptionsProc = (SYMSETOPTIONSPROC) GetProcAddress( hImageHelpLib, "SymGetOptions" );
+ SYMINITIALIZEPROC _fpSymInitializeProc = (SYMINITIALIZEPROC) GetProcAddress( hImageHelpLib, "SymInitialize" );
+ SYMCLEANUPPROC _fpSymCleanup = (SYMCLEANUPPROC) GetProcAddress( hImageHelpLib, "SymCleanup" );
+ UNDECORATESYMBOLNAMEPROC _fpUndecorateSymbolName = (UNDECORATESYMBOLNAMEPROC) GetProcAddress( hImageHelpLib, "UnDecorateSymbolName" );
+ SYMLOADMODULEPROC _fpSymLoadModule = ( SYMLOADMODULEPROC) GetProcAddress( hImageHelpLib, "SymLoadModule" );
+ SYMGETSYMFROMADDR _fpSymGetSymFromAddr = ( SYMGETSYMFROMADDR ) GetProcAddress( hImageHelpLib, "SymGetSymFromAddr" );
+
+ if ( !pSysInfos->pModInfos )
+ pSysInfos->pModInfos = WNT_CreateModuleInfos();
+
+ _fpSymSetOptionsProc( SYMOPT_DEFERRED_LOADS );
+
+ char buffer[1024];
+
+ // Initialize the imagehlp symbol handler
+ BOOL bAutoLoad = FALSE;
+// String aPath = WNT_CreateModulePath( pSysInfos->pModInfos );
+// USHORT nLen = aPath.Len();
+// memcpy( buffer, aPath.GetStr(), nLen );
+// buffer[nLen] = 0;
+// BOOL bSymbols = _fpSymInitializeProc( pSysInfos->hCurrentProcess, NULL, bAutoLoad );
+ // Path funktioniert nicht, also lade ich unten alle von Hand!
+ BOOL bSymbols = _fpSymInitializeProc( pSysInfos->hCurrentProcess, NULL, bAutoLoad );
+
+ // Load symbol modules for the current process
+ if ( bSymbols && !bAutoLoad )
+ {
+ // LoadModuleSymbols( pSysInfos->nCurrentProcessId, pSysInfos->hCurrentProcess );
+ struct ModuleInfo* pM = pSysInfos->pModInfos;
+ char buffer1[1024];
+ char buffer2[1024];
+
+ while ( pM )
+ {
+ strcpy( buffer1, pM->szModFileName );
+ strcpy( buffer2, pM->szModBaseName );
+
+ BOOL bDone = _fpSymLoadModule( pSysInfos->hCurrentProcess, 0, buffer1, buffer2, pM->nBaseAddress, pM->nSize );
+
+ pM = pM->pNext;
+ }
+ }
+
+ // Initialize the STACKFRAME structure for the first call. This is only
+ // necessary for Intel CPUs, and isn't mentioned in the documentation.
+ aStackFrame.AddrPC.Offset = aContext.Eip;
+ aStackFrame.AddrPC.Mode = AddrModeFlat;
+ aStackFrame.AddrStack.Offset = aContext.Esp;
+ aStackFrame.AddrStack.Mode = AddrModeFlat;
+ aStackFrame.AddrFrame.Offset = aContext.Ebp;
+ aStackFrame.AddrFrame.Mode = AddrModeFlat;
+
+
+ pSysInfos->aStack = "<Stack type=\"WIN32\" >\n";
+
+ for ( int nS = 0; nS < 20; nS++ )
+ {
+ SetLastError( 0 );
+ BOOL bStack = _fpStackWalk( IMAGE_FILE_MACHINE_I386,
+ pSysInfos->hCurrentProcess,
+ pSysInfos->hCurrentThread,
+ &aStackFrame,
+ &aContext,
+ NULL, // ReadProcessMemory,
+ _fpSymFunctionTableAccess,
+ _fpSymGetModuleBase,
+ NULL );
+
+ if ( !bStack || !aStackFrame.AddrReturn.Offset || !aStackFrame.AddrFrame.Offset )
+ break;
+
+ pSysInfos->aStack += " <StackInfo pos=\"";
+ pSysInfos->aStack += (USHORT)nS;
+ pSysInfos->aStack += "\" ip=\"";
+ ULONG nIP = aStackFrame.AddrReturn.Offset;
+ sprintf( buffer, "%.8lx", nIP );
+ pSysInfos->aStack += buffer;
+ pSysInfos->aStack += "\"";
+
+ TCHAR aModuleFileName[MAX_PATH];
+ DWORD section, offset;
+ if ( WNT_GetLogicalAddress( (void*)nIP, aModuleFileName, MAX_PATH, section, offset ) )
+ {
+ pSysInfos->aStack += " rel=\"";
+ sprintf( buffer, "%.8lx", offset );
+ pSysInfos->aStack += buffer;
+ pSysInfos->aStack += "\" file=\"";
+ char* pModName = strrchr( aModuleFileName, '\\' );
+ pSysInfos->aStack += pModName ? (pModName+1) : aModuleFileName;
+ pSysInfos->aStack += "\"";
+ }
+ else
+ {
+ pSysInfos->aStack += " rel=\"ERROR\"";
+ break;
+ }
+
+ if ( bSymbols )
+ {
+
+ BYTE symbolBuffer[ sizeof(IMAGEHLP_SYMBOL) + 512 ];
+ PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL)symbolBuffer;
+ memset( symbolBuffer, 0, sizeof(symbolBuffer) );
+ pSymbol->SizeOfStruct = sizeof(symbolBuffer);
+ pSymbol->MaxNameLength = sizeof(symbolBuffer) - sizeof(IMAGEHLP_SYMBOL) + 1;
+
+ DWORD symDisplacement = 0; // Displacement of the input address,
+ // relative to the start of the symbol
+
+ if ( _fpSymGetSymFromAddr( pSysInfos->hCurrentProcess, aStackFrame.AddrReturn.Offset,
+ &symDisplacement, pSymbol ) )
+ {
+ pSysInfos->aStack += " ordinal=\"";
+ _fpUndecorateSymbolName( pSymbol->Name, buffer, 1024, UNDNAME_NAME_ONLY );
+ pSysInfos->aStack += buffer;
+ pSysInfos->aStack += "\"";
+ // aStackLine += '<';
+ // _fpUndecorateSymbolName( pSymbol->Name, buffer, 1024, UNDNAME_COMPLETE );
+ // aStackLine += buffer;
+ // aStackLine += '>';
+ }
+ else // No symbol found. Print out the logical address instead.
+ {
+ pSysInfos->aStack += " ordinal=\"???\"";
+ }
+ }
+
+ pSysInfos->aStack += " />\n";
+ }
+ pSysInfos->aStack += "</Stack>";
+ _fpSymCleanup( pSysInfos->hCurrentProcess );
+ }
+ ResumeThread( pSysInfos->hCurrentThread );
+ }
+ FreeLibrary( hImageHelpLib );
+ }
+}
+
+#endif
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
new file mode 100644
index 000000000000..bafb98e35bfa
--- /dev/null
+++ b/vcl/win/source/app/salinst.cxx
@@ -0,0 +1,897 @@
+/*************************************************************************
+ *
+ * $RCSfile: salinst.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <tools/svwin.h>
+#ifdef WNT
+#include <process.h>
+#endif
+
+#define _SV_SALINST_CXX
+
+#ifndef _VOS_MUTEX_HXX
+#include <vos/mutex.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+#ifndef _SV_SALSOUND_HXX
+#include <salsound.hxx>
+#endif
+#ifndef _SV_SALATYPE_HXX
+#include <salatype.hxx>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+
+// =======================================================================
+
+void SalAbort( const XubString& rErrorText )
+{
+ ImplFreeSalGDI();
+
+ if ( !rErrorText.Len() )
+ FatalAppExit( 0, "Application Error" );
+ else
+ {
+ ByteString aErrorText( ImplSalGetWinAnsiString( rErrorText ) );
+ FatalAppExit( 0, aErrorText.GetBuffer() );
+ }
+}
+
+// =======================================================================
+
+LRESULT CALLBACK SalComWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
+
+// =======================================================================
+
+class SalYieldMutex : public NAMESPACE_VOS(OMutex)
+{
+public: // for ImplSalYield()
+ SalInstanceData* mpInstData;
+ ULONG mnCount;
+ DWORD mnThreadId;
+
+public:
+ SalYieldMutex( SalInstanceData* pInstData );
+
+ virtual void SAL_CALL acquire();
+ virtual void SAL_CALL release();
+ virtual sal_Bool SAL_CALL tryToAcquire();
+
+ ULONG GetAcquireCount( ULONG nThreadId );
+};
+
+// -----------------------------------------------------------------------
+
+SalYieldMutex::SalYieldMutex( SalInstanceData* pInstData )
+{
+ mpInstData = pInstData;
+ mnCount = 0;
+ mnThreadId = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL SalYieldMutex::acquire()
+{
+ OMutex::acquire();
+ mnCount++;
+ mnThreadId = GetCurrentThreadId();
+}
+
+// -----------------------------------------------------------------------
+
+void SAL_CALL SalYieldMutex::release()
+{
+ DWORD nThreadId = GetCurrentThreadId();
+ if ( mnThreadId != nThreadId )
+ OMutex::release();
+ else
+ {
+ // If we don't call these message, the Output from the
+ // Java clients doesn't come in the right order
+ GdiFlush();
+
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mnAppThreadId != nThreadId )
+ {
+ if ( mnCount == 1 )
+ {
+ mpInstData->mpSalWaitMutex->acquire();
+ if ( mpInstData->mnYieldWaitCount )
+ ImplPostMessage( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
+ mnThreadId = 0;
+ mnCount--;
+ OMutex::release();
+ mpInstData->mpSalWaitMutex->release();
+ }
+ else
+ {
+ mnCount--;
+ OMutex::release();
+ }
+ }
+ else
+ {
+ if ( mnCount == 1 )
+ mnThreadId = 0;
+ mnCount--;
+ OMutex::release();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SAL_CALL SalYieldMutex::tryToAcquire()
+{
+ if( OMutex::tryToAcquire() )
+ {
+ mnCount++;
+ mnThreadId = GetCurrentThreadId();
+ return True;
+ }
+ else
+ return False;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalYieldMutex::GetAcquireCount( ULONG nThreadId )
+{
+ if ( nThreadId == mnThreadId )
+ return mnCount;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexAcquireWithWait()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( !pInst )
+ return;
+
+ // If we are the main thread, then we must wait with wait, because
+ // in if we don't reschedule, then we create deadlocks if a Windows
+ // Function is called from another thread. If we arn't the main thread,
+ // than we call qcquire directly.
+ DWORD nThreadId = GetCurrentThreadId();
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mnAppThreadId == nThreadId )
+ {
+ // Wenn wir den Mutex nicht bekommen, muessen wir solange
+ // warten, bis wir Ihn bekommen
+ BOOL bAcquire = FALSE;
+ do
+ {
+ if ( pInst->maInstData.mpSalYieldMutex->tryToAcquire() )
+ bAcquire = TRUE;
+ else
+ {
+ pInst->maInstData.mpSalWaitMutex->acquire();
+ if ( pInst->maInstData.mpSalYieldMutex->tryToAcquire() )
+ {
+ bAcquire = TRUE;
+ pInst->maInstData.mpSalWaitMutex->release();
+ }
+ else
+ {
+ pInst->maInstData.mnYieldWaitCount++;
+ pInst->maInstData.mpSalWaitMutex->release();
+ MSG aTmpMsg;
+ ImplGetMessage( &aTmpMsg, pInst->maInstData.mhComWnd, SAL_MSG_RELEASEWAITYIELD, SAL_MSG_RELEASEWAITYIELD );
+ pInst->maInstData.mnYieldWaitCount--;
+ if ( pInst->maInstData.mnYieldWaitCount )
+ ImplPostMessage( pInst->maInstData.mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
+ }
+ }
+ }
+ while ( !bAcquire );
+ }
+ else
+ pInst->maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplSalYieldMutexTryToAcquire()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst )
+ return pInst->maInstData.mpSalYieldMutex->tryToAcquire();
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexAcquire()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst )
+ pInst->maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYieldMutexRelease()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst )
+ pInst->maInstData.mpSalYieldMutex->release();
+}
+
+// -----------------------------------------------------------------------
+
+ULONG ImplSalReleaseYieldMutex()
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( !pInst )
+ return 0;
+
+ SalYieldMutex* pYieldMutex = pInst->maInstData.mpSalYieldMutex;
+ ULONG nCount = pYieldMutex->GetAcquireCount( GetCurrentThreadId() );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+
+ return nCount;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalAcquireYieldMutex( ULONG nCount )
+{
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( !pInst )
+ return;
+
+ SalYieldMutex* pYieldMutex = pInst->maInstData.mpSalYieldMutex;
+ while ( nCount )
+ {
+ pYieldMutex->acquire();
+ nCount--;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef DBG_UTIL
+
+void ImplDbgTestSolarMutex()
+{
+ SalData* pSalData = GetSalData();
+ DWORD nCurThreadId = GetCurrentThreadId();
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" );
+ }
+ }
+ }
+ else
+ {
+ if ( pSalData->mpFirstInstance )
+ {
+ SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->maInstData.mpSalYieldMutex;
+ if ( pYieldMutex->mnThreadId != nCurThreadId )
+ {
+ DBG_ERROR( "SolarMutex not locked in the main thread" );
+ }
+ }
+ }
+}
+
+#endif
+
+// =======================================================================
+
+static void InitSalShlData()
+{
+ aSalShlData.mnVKAdd = LOWORD( VkKeyScan( '+' ) );
+ aSalShlData.mnVKSubtract = LOWORD( VkKeyScan( '-' ) );
+ aSalShlData.mnVKMultiply = LOWORD( VkKeyScan( '*' ) );
+ aSalShlData.mnVKDivide = LOWORD( VkKeyScan( '/' ) );
+ aSalShlData.mnVKPoint = LOWORD( VkKeyScan( '.' ) );
+ aSalShlData.mnVKComma = LOWORD( VkKeyScan( ',' ) );
+ aSalShlData.mnVKLess = LOWORD( VkKeyScan( '<' ) );
+ aSalShlData.mnVKGreater = LOWORD( VkKeyScan( '>' ) );
+ aSalShlData.mnVKEqual = LOWORD( VkKeyScan( '=' ) );
+}
+
+// =======================================================================
+
+void InitSalData()
+{
+ SalData* pSalData = new SalData;
+ memset( pSalData, 0, sizeof( SalData ) );
+ SetSalData( pSalData );
+ CoInitialize(0);
+}
+
+// -----------------------------------------------------------------------
+
+void DeInitSalData()
+{
+ CoUninitialize();
+ SalData* pSalData = GetSalData();
+ delete pSalData;
+ SetSalData( NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SetFilterCallback( void* pCallback, void* pInst )
+{
+ SalData* pSalData = GetSalData();
+
+ pSalData->mpFirstInstance->maInstData.mpFilterCallback = pCallback;
+ pSalData->mpFirstInstance->maInstData.mpFilterInst = pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance* CreateSalInstance()
+{
+ SalData* pSalData = GetSalData();
+
+ // determine the windows version
+ WORD nVer = (WORD)GetVersion();
+ aSalShlData.mnVersion = (((WORD)LOBYTE(nVer)) * 100) + HIBYTE(nVer);
+ if ( aSalShlData.mnVersion >= W95_VERSION )
+ aSalShlData.mbW40 = 1;
+ OSVERSIONINFO aVerInfo;
+ aVerInfo.dwOSVersionInfoSize = sizeof( aVerInfo );
+ if ( GetVersionEx( &aVerInfo ) )
+ {
+ if ( aVerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
+ aSalShlData.mbWNT = 1;
+ }
+
+ pSalData->mnAppThreadId = GetCurrentThreadId();
+
+ // register frame class
+ if ( !pSalData->mhPrevInst )
+ {
+ if ( aSalShlData.mbWNT )
+ {
+ WNDCLASSEXW aWndClassEx;
+ aWndClassEx.cbSize = sizeof( aWndClassEx );
+ aWndClassEx.style = CS_OWNDC;
+ aWndClassEx.lpfnWndProc = SalFrameWndProcW;
+ aWndClassEx.cbClsExtra = 0;
+ aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA;
+ aWndClassEx.hInstance = pSalData->mhInst;
+ aWndClassEx.hCursor = 0;
+ aWndClassEx.hbrBackground = 0;
+ aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEW;
+ ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm );
+ if ( !RegisterClassExW( &aWndClassEx ) )
+ return NULL;
+ aWndClassEx.style |= CS_SAVEBITS;
+ aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAME_SBW;
+ if ( !RegisterClassExW( &aWndClassEx ) )
+ return NULL;
+
+ aWndClassEx.style = 0;
+ aWndClassEx.lpfnWndProc = SalComWndProcW;
+ aWndClassEx.cbWndExtra = 0;
+ aWndClassEx.hIcon = 0;
+ aWndClassEx.hIconSm = 0;
+ aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEW;
+ if ( !RegisterClassExW( &aWndClassEx ) )
+ return NULL;
+ }
+ else
+ {
+ WNDCLASSEXA aWndClassEx;
+ aWndClassEx.cbSize = sizeof( aWndClassEx );
+ aWndClassEx.style = CS_OWNDC;
+ aWndClassEx.lpfnWndProc = SalFrameWndProcA;
+ aWndClassEx.cbClsExtra = 0;
+ aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA;
+ aWndClassEx.hInstance = pSalData->mhInst;
+ aWndClassEx.hCursor = 0;
+ aWndClassEx.hbrBackground = 0;
+ aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEA;
+ ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm );
+ if ( !RegisterClassExA( &aWndClassEx ) )
+ return NULL;
+ aWndClassEx.style |= CS_SAVEBITS;
+ aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAME_SBA;
+ if ( !RegisterClassExA( &aWndClassEx ) )
+ return NULL;
+
+ aWndClassEx.style = 0;
+ aWndClassEx.lpfnWndProc = SalComWndProcA;
+ aWndClassEx.cbWndExtra = 0;
+ aWndClassEx.hIcon = 0;
+ aWndClassEx.hIconSm = 0;
+ aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEA;
+ if ( !RegisterClassExA( &aWndClassEx ) )
+ return NULL;
+ }
+ }
+
+ HWND hComWnd;
+ if ( aSalShlData.mbWNT )
+ {
+ hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW,
+ L"", WS_POPUP, 0, 0, 0, 0, 0, 0,
+ pSalData->mhInst, NULL );
+ }
+ else
+ {
+ hComWnd = CreateWindowExA( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEA,
+ "", WS_POPUP, 0, 0, 0, 0, 0, 0,
+ pSalData->mhInst, NULL );
+ }
+ if ( !hComWnd )
+ return NULL;
+
+ SalInstance* pInst = new SalInstance;
+
+ // init shl data
+ InitSalShlData();
+
+ // init instance (only one instance in this version !!!)
+ pSalData->mpFirstInstance = pInst;
+ pInst->maInstData.mhInst = pSalData->mhInst;
+ pInst->maInstData.mhComWnd = hComWnd;
+
+ // init static GDI Data
+ ImplInitSalGDI();
+
+ return pInst;
+}
+
+// -----------------------------------------------------------------------
+
+void DestroySalInstance( SalInstance* pInst )
+{
+ SalData* pSalData = GetSalData();
+
+ // (only one instance in this version !!!)
+
+ ImplFreeSalGDI();
+
+ // reset instance
+ if ( pSalData->mpFirstInstance == pInst )
+ pSalData->mpFirstInstance = NULL;
+
+ delete pInst;
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::SalInstance()
+{
+ maInstData.mhComWnd = 0;
+ maInstData.mpFilterCallback = NULL;
+ maInstData.mpFilterInst = NULL;
+ maInstData.mpSalYieldMutex = new SalYieldMutex( &maInstData );
+ maInstData.mpSalWaitMutex = new NAMESPACE_VOS(OMutex);
+ maInstData.mnYieldWaitCount = 0;
+ maInstData.mpSalYieldMutex->acquire();
+}
+
+// -----------------------------------------------------------------------
+
+SalInstance::~SalInstance()
+{
+ maInstData.mpSalYieldMutex->release();
+ delete maInstData.mpSalYieldMutex;
+ delete maInstData.mpSalWaitMutex;
+ DestroyWindow( maInstData.mhComWnd );
+}
+
+// -----------------------------------------------------------------------
+
+#ifdef _VOS_NO_NAMESPACE
+IMutex* SalInstance::GetYieldMutex()
+#else
+vos::IMutex* SalInstance::GetYieldMutex()
+#endif
+{
+ return maInstData.mpSalYieldMutex;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInstance::ReleaseYieldMutex()
+{
+ return ImplSalReleaseYieldMutex();
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::AcquireYieldMutex( ULONG nCount )
+{
+ ImplSalAcquireYieldMutex( nCount );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalDispatchMessage( MSG* pMsg )
+{
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstObject )
+ {
+ if ( ImplSalPreDispatchMsg( pMsg ) )
+ return;
+ }
+ LRESULT lResult = ImplDispatchMessage( pMsg );
+ if ( pSalData->mpFirstObject )
+ ImplSalPostDispatchMsg( pMsg, lResult );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalYield( BOOL bWait )
+{
+ MSG aMsg;
+
+ if ( bWait )
+ {
+ if ( ImplGetMessage( &aMsg, 0, 0, 0 ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplSalDispatchMessage( &aMsg );
+ }
+ }
+ else
+ {
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplSalDispatchMessage( &aMsg );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::Yield( BOOL bWait )
+{
+ SalYieldMutex* pYieldMutex = maInstData.mpSalYieldMutex;
+ SalData* pSalData = GetSalData();
+ DWORD nCurThreadId = GetCurrentThreadId();
+ ULONG nCount = pYieldMutex->GetAcquireCount( nCurThreadId );
+ ULONG n = nCount;
+ while ( n )
+ {
+ pYieldMutex->release();
+ n--;
+ }
+ if ( pSalData->mnAppThreadId != nCurThreadId )
+ {
+ ImplSendMessage( maInstData.mhComWnd, SAL_MSG_THREADYIELD, (WPARAM)bWait, (LPARAM)0 );
+ n = nCount;
+ while ( n )
+ {
+ pYieldMutex->acquire();
+ n--;
+ }
+ }
+ else
+ {
+ ImplSalYield( bWait );
+
+ n = nCount;
+ while ( n )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ n--;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalComWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ LRESULT nRet = 0;
+
+ switch ( nMsg )
+ {
+ case SAL_MSG_PRINTABORTJOB:
+ ImplSalPrinterAbortJobAsync( (HDC)wParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_THREADYIELD:
+ ImplSalYield( (BOOL)wParam );
+ rDef = FALSE;
+ break;
+ // If we get this message, because another GetMessage() call
+ // has recieved this message, we must post this message to
+ // us again, because in the other case we wait forever.
+ case SAL_MSG_RELEASEWAITYIELD:
+ {
+ SalInstance* pInst = GetSalData()->mpFirstInstance;
+ if ( pInst && pInst->maInstData.mnYieldWaitCount )
+ ImplPostMessage( hWnd, SAL_MSG_RELEASEWAITYIELD, wParam, lParam );
+ }
+ rDef = FALSE;
+ break;
+ case SAL_MSG_STARTTIMER:
+ ImplSalStartTimer( (ULONG) lParam, FALSE );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_CREATEFRAME:
+ nRet = (LRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (HWND)lParam, (ULONG)wParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_DESTROYFRAME:
+ delete (SalFrame*)lParam;
+ rDef = FALSE;
+ break;
+ case SAL_MSG_CREATEOBJECT:
+ nRet = (LRESULT)ImplSalCreateObject( GetSalData()->mpFirstInstance, (SalFrame*)lParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_DESTROYOBJECT:
+ delete (SalObject*)lParam;
+ rDef = FALSE;
+ break;
+ case SAL_MSG_CREATESOUND:
+ nRet = ((SalSound*)lParam)->ImplCreate();
+ rDef = FALSE;
+ break;
+ case SAL_MSG_DESTROYSOUND:
+ ((SalSound*)lParam)->ImplDestroy();
+ rDef = FALSE;
+ break;
+ }
+
+ return nRet;
+}
+
+LRESULT CALLBACK SalComWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalComWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ {
+ if ( !ImplHandleGlobalMsg( hWnd, nMsg, wParam, lParam, nRet ) )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ }
+ return nRet;
+}
+
+LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalComWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ {
+ if ( !ImplHandleGlobalMsg( hWnd, nMsg, wParam, lParam, nRet ) )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInstance::AnyInput( USHORT nType )
+{
+ MSG aMsg;
+
+ if ( (nType & (INPUT_ANY)) == (INPUT_ANY) )
+ {
+ // Any Input
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+ else
+ {
+ if ( nType & INPUT_MOUSE )
+ {
+ // Test auf Mouseinput
+ if ( ImplPeekMessage( &aMsg, 0, WM_MOUSEFIRST, WM_MOUSELAST,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_KEYBOARD )
+ {
+ // Test auf Keyinput
+ if ( ImplPeekMessage( &aMsg, 0, WM_KEYDOWN, WM_KEYDOWN,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ {
+ if ( (aMsg.wParam == VK_SHIFT) ||
+ (aMsg.wParam == VK_CONTROL) ||
+ (aMsg.wParam == VK_MENU) )
+ return FALSE;
+ else
+ return TRUE;
+ }
+ }
+
+ if ( nType & INPUT_PAINT )
+ {
+ // Test auf Paintinput
+ if ( ImplPeekMessage( &aMsg, 0, WM_PAINT, WM_PAINT,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_TIMER )
+ {
+ // Test auf Timerinput
+ if ( ImplPeekMessage( &aMsg, 0, WM_TIMER, WM_TIMER,
+ PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+
+ if ( nType & INPUT_OTHER )
+ {
+ // Test auf sonstigen Input
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Start( ULONG nMS )
+{
+ // Um auf Main-Thread umzuschalten
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mpFirstInstance )
+ {
+ if ( pSalData->mnAppThreadId != GetCurrentThreadId() )
+ ImplPostMessage( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS );
+ else
+ ImplSendMessage( pSalData->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS );
+ }
+ else
+ ImplSalStartTimer( nMS, FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* SalInstance::CreateChildFrame( SystemParentData* pSystemParentData, ULONG nSalFrameStyle )
+{
+ // Um auf Main-Thread umzuschalten
+ return (SalFrame*)ImplSendMessage( maInstData.mhComWnd, SAL_MSG_CREATEFRAME, nSalFrameStyle, (LPARAM)pSystemParentData->hWnd );
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* SalInstance::CreateFrame( SalFrame* pParent, ULONG nSalFrameStyle )
+{
+ // Um auf Main-Thread umzuschalten
+ HWND hWndParent;
+ if ( pParent )
+ hWndParent = pParent->maFrameData.mhWnd;
+ else
+ hWndParent = 0;
+ return (SalFrame*)ImplSendMessage( maInstData.mhComWnd, SAL_MSG_CREATEFRAME, nSalFrameStyle, (LPARAM)hWndParent );
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyFrame( SalFrame* pFrame )
+{
+ ImplSendMessage( maInstData.mhComWnd, SAL_MSG_DESTROYFRAME, 0, (LPARAM)pFrame );
+}
+
+// -----------------------------------------------------------------------
+
+SalObject* SalInstance::CreateObject( SalFrame* pParent )
+{
+ // Um auf Main-Thread umzuschalten
+ return (SalObject*)ImplSendMessage( maInstData.mhComWnd, SAL_MSG_CREATEOBJECT, 0, (LPARAM)pParent );
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyObject( SalObject* pObject )
+{
+ ImplSendMessage( maInstData.mhComWnd, SAL_MSG_DESTROYOBJECT, 0, (LPARAM)pObject );
+}
diff --git a/vcl/win/source/app/salshl.cxx b/vcl/win/source/app/salshl.cxx
new file mode 100644
index 000000000000..3c026c053906
--- /dev/null
+++ b/vcl/win/source/app/salshl.cxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * $RCSfile: salshl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALSHL_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// =======================================================================
+
+SalShlData aSalShlData;
+
+// =======================================================================
+
+#ifdef WIN
+
+extern "C"
+{
+
+int CALLBACK LibMain( HINSTANCE hInst, WORD, WORD nHeap, LPSTR )
+{
+ if ( nHeap )
+ UnlockData( 0 );
+
+ aSalShlData.mhInst = hInst;
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+int CALLBACK WEP( int )
+{
+ return 1;
+}
+
+}
+
+#endif
+
+// =======================================================================
+
+#ifdef WNT
+
+extern "C"
+{
+
+#ifdef ICC
+int _CRT_init(void);
+#else
+WIN_BOOL WINAPI _CRT_INIT( HINSTANCE hInst, DWORD nReason, LPVOID pReserved );
+#endif
+
+WIN_BOOL WINAPI LibMain( HINSTANCE hInst, DWORD nReason, LPVOID pReserved )
+{
+ // Unsere DLL-Initialisierung
+ if ( nReason == DLL_PROCESS_ATTACH )
+ aSalShlData.mhInst = hInst;
+
+#if !defined ( __BORLANDC__ )
+#ifdef ICC
+ if ( _CRT_init() == -1 )
+#else
+ if ( !_CRT_INIT( hInst, nReason, pReserved ) )
+#endif
+ return 0;
+#endif
+
+ return 1;
+}
+
+}
+
+#endif
+
+// =======================================================================
+
+HCURSOR ImplLoadSalCursor( int nId )
+{
+ DBG_ASSERT( aSalShlData.mhInst, "no DLL instance handle" );
+
+ HCURSOR hCursor = LoadCursor( aSalShlData.mhInst, MAKEINTRESOURCE( nId ) );
+
+ DBG_ASSERT( hCursor, "cursor not found in sal resource" );
+
+ return hCursor;
+}
+
+// -----------------------------------------------------------------------
+
+HBITMAP ImplLoadSalBitmap( int nId )
+{
+ DBG_ASSERT( aSalShlData.mhInst, "no DLL instance handle" );
+
+ HBITMAP hBitmap = LoadBitmap( aSalShlData.mhInst, MAKEINTRESOURCE( nId ) );
+
+ DBG_ASSERT( hBitmap, "bitmap not found in sal resource" );
+
+ return hBitmap;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon )
+{
+ DBG_ASSERT( aSalShlData.mhInst, "no DLL instance handle" );
+
+ // Try at first to load the icons from the application exe file
+ SalData* pSalData = GetSalData();
+ rIcon = LoadIcon( pSalData->mhInst, MAKEINTRESOURCE( nId ) );
+ if ( !rIcon )
+ {
+ // If the application don't provide these icons, then we try
+ // to load the icon from the VCL resource
+ rIcon = LoadIcon( aSalShlData.mhInst, MAKEINTRESOURCE( nId ) );
+ if ( rIcon )
+ {
+ rSmallIcon = (HICON)LoadImage( aSalShlData.mhInst, MAKEINTRESOURCE( nId ),
+ IMAGE_ICON, 16, 16, 0 );
+ }
+ else
+ rSmallIcon = 0;
+ }
+ else
+ {
+ rSmallIcon = (HICON)LoadImage( pSalData->mhInst, MAKEINTRESOURCE( nId ),
+ IMAGE_ICON, 16, 16, 0 );
+ }
+
+ return (rSmallIcon != 0);
+}
diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx
new file mode 100644
index 000000000000..b051c72110bf
--- /dev/null
+++ b/vcl/win/source/app/saltimer.cxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * $RCSfile: saltimer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALTIMER_CXX
+
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALTIMER_HXX
+#include <saltimer.hxx>
+#endif
+
+// =======================================================================
+
+// Maximale Periode
+#define MAX_SYSPERIOD 65533
+
+// =======================================================================
+
+void ImplSalStartTimer( ULONG nMS, BOOL bMutex )
+{
+ SalData* pSalData = GetSalData();
+
+ // Remenber the time of the timer
+ pSalData->mnTimerMS = nMS;
+ if ( !bMutex )
+ pSalData->mnTimerOrgMS = nMS;
+
+ // Periode darf nicht zu gross sein, da Windows mit USHORT arbeitet
+ if ( nMS > MAX_SYSPERIOD )
+ nMS = MAX_SYSPERIOD;
+
+ // Gibt es einen Timer, dann zerstoren
+ if ( pSalData->mnTimerId )
+ KillTimer( 0, pSalData->mnTimerId );
+
+ // Make a new timer with new period
+ pSalData->mnTimerId = SetTimer( 0, 0, (UINT)nMS, SalTimerProc );
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::Stop()
+{
+ SalData* pSalData = GetSalData();
+
+ // If we have a timer, than
+ if ( pSalData->mnTimerId )
+ {
+ KillTimer( 0, pSalData->mnTimerId );
+ pSalData->mnTimerId = 0;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalTimer::SetCallback( SALTIMERPROC pProc )
+{
+ SalData* pSalData = GetSalData();
+ pSalData->mpTimerProc = pProc;
+}
+
+// -----------------------------------------------------------------------
+
+void CALLBACK SalTimerProc( HWND, UINT, UINT, DWORD )
+{
+ SalData* pSalData = GetSalData();
+
+ // Test for MouseLeave
+ SalTestMouseLeave();
+
+ if ( pSalData->mpTimerProc )
+ {
+ // Try to aquire the mutex. If we don't get the mutex then we
+ // try this a short time later again.
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSalData->mpTimerProc();
+ ImplSalYieldMutexRelease();
+
+ // Run the timer in the correct time, if we start this
+ // with a small timeout, because we don't get the mutex
+ if ( pSalData->mnTimerId &&
+ (pSalData->mnTimerMS != pSalData->mnTimerOrgMS) )
+ ImplSalStartTimer( pSalData->mnTimerOrgMS, FALSE );
+ }
+ else
+ ImplSalStartTimer( 10, TRUE );
+ }
+}
diff --git a/vcl/win/source/gdi/MAKEFILE.MK b/vcl/win/source/gdi/MAKEFILE.MK
new file mode 100644
index 000000000000..c63a3cdd19f4
--- /dev/null
+++ b/vcl/win/source/gdi/MAKEFILE.MK
@@ -0,0 +1,52 @@
+#*************************************************************************
+#*
+#* $Workfile: makefile. $
+#*
+#* Ersterstellung TH 01.04.97
+#* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 17:05:49 $
+#* $Revision: 1.1.1.1 $
+#*
+#* $Logfile: T:/sv2/win/source/gdi/makefile.__v $
+#*
+#* Copyright (c) 1990 - 1997, STAR DIVISION
+#*
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salgdi
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/salgdi.obj \
+ $(SLO)$/salgdi2.obj \
+ $(SLO)$/salgdi3.obj \
+ $(SLO)$/salvd.obj \
+ $(SLO)$/salprn.obj \
+ $(SLO)$/salbmp.obj \
+ $(SLO)$/salogl.obj
+
+.IF "$(GUI)" == "WNT"
+SLOFILES+=$(SLO)$/wntgdi.obj
+.ENDIF
+
+.IF "$(UPDATER)"=="YES"
+OBJFILES= $(OBJ)$/salgdi.obj \
+ $(OBJ)$/salgdi2.obj \
+ $(OBJ)$/salgdi3.obj \
+ $(OBJ)$/salvd.obj \
+ $(OBJ)$/salprn.obj \
+ $(OBJ)$/salbmp.obj \
+ $(OBJ)$/salogl.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx
new file mode 100644
index 000000000000..ec0f9914b5ee
--- /dev/null
+++ b/vcl/win/source/gdi/salbmp.cxx
@@ -0,0 +1,668 @@
+/*************************************************************************
+ *
+ * $RCSfile: salbmp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALBMP_CXX
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALBTYPE_HXX
+#include <salbtype.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#include <string.h>
+
+#ifdef WIN
+#define BI_BITFIELDS 3
+#endif
+
+// -----------
+// - Inlines -
+// -----------
+
+inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex )
+{
+ BYTE& rByte = pScanline[ nX >> 1 ];
+
+ ( nX & 1 ) ? ( rByte &= 0xf0, rByte |= ( cIndex & 0x0f ) ) :
+ ( rByte &= 0x0f, rByte |= ( cIndex << 4 ) );
+}
+
+// -------------
+// - SalBitmap -
+// -------------
+
+SalBitmap::SalBitmap() :
+ mhDIB ( 0 ),
+ mhDDB ( 0 ),
+ mnBitCount ( 0 )
+{
+}
+
+// ------------------------------------------------------------------
+
+SalBitmap::~SalBitmap()
+{
+ Destroy();
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( HANDLE hBitmap, BOOL bDIB, BOOL bCopyHandle )
+{
+ BOOL bRet = TRUE;
+
+ if( bDIB )
+ mhDIB = (HGLOBAL) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, TRUE ) : hBitmap );
+ else
+ mhDDB = (HBITMAP) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, FALSE ) : hBitmap );
+
+ if( mhDIB )
+ {
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) GlobalLock( mhDIB );
+
+ maSize = Size( pBIH->biWidth, pBIH->biHeight );
+ mnBitCount = pBIH->biBitCount;
+
+ if( mnBitCount )
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 : ( mnBitCount <= 4 ) ? 4 : ( mnBitCount <= 8 ) ? 8 : 24;
+
+ GlobalUnlock( mhDIB );
+ }
+ else if( mhDDB )
+ {
+ BITMAP aDDBInfo;
+
+ if( WIN_GetObject( mhDDB, sizeof( BITMAP ), &aDDBInfo ) )
+ {
+ maSize = Size( aDDBInfo.bmWidth, aDDBInfo.bmHeight );
+ mnBitCount = aDDBInfo.bmPlanes * aDDBInfo.bmBitsPixel;
+
+ if( mnBitCount )
+ {
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 :
+ ( mnBitCount <= 4 ) ? 4 :
+ ( mnBitCount <= 8 ) ? 8 : 24;
+ }
+ }
+ else
+ {
+ mhDDB = 0;
+ bRet = FALSE;
+ }
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const Size& rSize, USHORT nBitCount, const BitmapPalette& rPal )
+{
+ BOOL bRet = FALSE;
+
+ mhDIB = ImplCreateDIB( rSize, nBitCount, rPal );
+
+ if( mhDIB )
+ {
+ maSize = rSize;
+ mnBitCount = nBitCount;
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBitmap )
+{
+ BOOL bRet = FALSE;
+
+ if ( rSalBitmap.mhDIB || rSalBitmap.mhDDB )
+ {
+ HANDLE hNewHdl = ImplCopyDIBOrDDB( rSalBitmap.mhDIB ? rSalBitmap.mhDIB : rSalBitmap.mhDDB,
+ rSalBitmap.mhDIB != 0 );
+
+ if ( hNewHdl )
+ {
+ if( rSalBitmap.mhDIB )
+ mhDIB = (HGLOBAL) hNewHdl;
+ else if( rSalBitmap.mhDDB )
+ mhDDB = (HBITMAP) hNewHdl;
+
+ maSize = rSalBitmap.maSize;
+ mnBitCount = rSalBitmap.mnBitCount;
+
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics )
+{
+ BOOL bRet = FALSE;
+
+ if( rSalBmp.mhDIB )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( rSalBmp.mhDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+ HDC hDC = pGraphics->maGraphicsData.mhDC;
+ HBITMAP hNewDDB;
+ BITMAP aDDBInfo;
+ PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
+ ImplGetDIBColorCount( rSalBmp.mhDIB ) * sizeof( RGBQUAD );
+
+ if( pBIH->biBitCount == 1 )
+ {
+ hNewDDB = CreateBitmap( pBIH->biWidth, pBIH->biHeight, 1, 1, NULL );
+
+ if( hNewDDB )
+ SetDIBits( hDC, hNewDDB, 0, pBIH->biHeight, pBits, pBI, DIB_RGB_COLORS );
+ }
+ else
+ hNewDDB = CreateDIBitmap( hDC, (PBITMAPINFOHEADER) pBI, CBM_INIT, pBits, pBI, DIB_RGB_COLORS );
+
+ GlobalUnlock( rSalBmp.mhDIB );
+
+ if( hNewDDB && WIN_GetObject( hNewDDB, sizeof( BITMAP ), &aDDBInfo ) )
+ {
+ mhDDB = hNewDDB;
+ maSize = Size( aDDBInfo.bmWidth, aDDBInfo.bmHeight );
+ mnBitCount = aDDBInfo.bmPlanes * aDDBInfo.bmBitsPixel;
+
+ if( mnBitCount )
+ {
+ mnBitCount = ( mnBitCount <= 1 ) ? 1 :
+ ( mnBitCount <= 4 ) ? 4 :
+ ( mnBitCount <= 8 ) ? 8 : 24;
+ }
+
+ bRet = TRUE;
+ }
+ else if( hNewDDB )
+ DeleteObject( hNewDDB );
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+BOOL SalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount )
+{
+ BOOL bRet = FALSE;
+
+ if( rSalBmp.mhDDB )
+ {
+ mhDIB = ImplCreateDIB( rSalBmp.maSize, nNewBitCount, BitmapPalette() );
+
+ if( mhDIB )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ const int nLines = (int) rSalBmp.maSize.Height();
+ HDC hDC = GetDC( 0 );
+ PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
+ ImplGetDIBColorCount( mhDIB ) * sizeof( RGBQUAD );
+ SalData* pSalData = GetSalData();
+ HPALETTE hOldPal = 0;
+
+ if ( pSalData->mhDitherPal )
+ {
+ hOldPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( hDC );
+ }
+
+ if( GetDIBits( hDC, rSalBmp.mhDDB, 0, nLines, pBits, pBI, DIB_RGB_COLORS ) == nLines )
+ {
+ GlobalUnlock( mhDIB );
+ maSize = rSalBmp.maSize;
+ mnBitCount = nNewBitCount;
+ bRet = TRUE;
+ }
+ else
+ {
+ GlobalUnlock( mhDIB );
+ GlobalFree( mhDIB );
+ mhDIB = 0;
+ }
+
+ if( hOldPal )
+ SelectPalette( hDC, hOldPal, TRUE );
+
+ ReleaseDC( 0, hDC );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::Destroy()
+{
+ if( mhDIB )
+ GlobalFree( mhDIB );
+ else if( mhDDB )
+ DeleteObject( mhDDB );
+
+ maSize = Size();
+ mnBitCount = 0;
+}
+
+// ------------------------------------------------------------------
+
+USHORT SalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB )
+{
+ USHORT nColors = 0;
+
+ if( hDIB )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+
+ if ( pBIH->biSize != sizeof( BITMAPCOREHEADER ) )
+ {
+ if( pBIH->biBitCount <= 8 )
+ {
+ if ( pBIH->biClrUsed )
+ nColors = (USHORT) pBIH->biClrUsed;
+ else
+ nColors = 1 << pBIH->biBitCount;
+ }
+ }
+ else if( ( (PBITMAPCOREHEADER) pBI )->bcBitCount <= 8 )
+ nColors = 1 << ( (PBITMAPCOREHEADER) pBI )->bcBitCount;
+
+ GlobalUnlock( hDIB );
+ }
+
+ return nColors;
+}
+
+// ------------------------------------------------------------------
+
+HGLOBAL SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBits, const BitmapPalette& rPal )
+{
+ DBG_ASSERT( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24, "Unsupported BitCount!" );
+
+ HGLOBAL hDIB = 0;
+
+ if ( rSize.Width() && rSize.Height() && ( nBits == 1 || nBits == 4 || nBits == 8 || nBits == 24 ) )
+ {
+ const ULONG nImageSize = AlignedWidth4Bytes( nBits * rSize.Width() ) * rSize.Height();
+ const USHORT nColors = ( nBits <= 8 ) ? ( 1 << nBits ) : 0;
+
+ hDIB = GlobalAlloc( GHND, sizeof( BITMAPINFOHEADER ) + nColors * sizeof( RGBQUAD ) + nImageSize );
+
+ if( hDIB )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+
+ pBIH->biSize = sizeof( BITMAPINFOHEADER );
+ pBIH->biWidth = rSize.Width();
+ pBIH->biHeight = rSize.Height();
+ pBIH->biPlanes = 1;
+ pBIH->biBitCount = nBits;
+ pBIH->biCompression = BI_RGB;
+ pBIH->biSizeImage = nImageSize;
+ pBIH->biXPelsPerMeter = 0;
+ pBIH->biYPelsPerMeter = 0;
+ pBIH->biClrUsed = 0;
+ pBIH->biClrImportant = 0;
+
+ if ( nColors )
+ {
+ const USHORT nMinCount = Min( nColors, rPal.GetEntryCount() );
+
+ if( nMinCount )
+ HMEMCPY( pBI->bmiColors, rPal.ImplGetColorBuffer(), nMinCount * sizeof( RGBQUAD ) );
+ }
+
+ GlobalUnlock( hDIB );
+ }
+ }
+
+ return hDIB;
+}
+
+// ------------------------------------------------------------------
+
+HANDLE SalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, BOOL bDIB )
+{
+ HANDLE hCopy = 0;
+
+ if ( bDIB && hHdl )
+ {
+ const ULONG nSize = GlobalSize( hHdl );
+
+ if ( hCopy = GlobalAlloc( GHND, nSize ) )
+ {
+ HMEMCPY( (LPSTR) GlobalLock( hCopy ), (LPSTR) GlobalLock( hHdl ), nSize );
+
+ GlobalUnlock( hCopy );
+ GlobalUnlock( hHdl );
+ }
+ }
+ else if ( hHdl )
+ {
+ BITMAP aBmp;
+
+ // Source-Bitmap nach Groesse befragen
+ WIN_GetObject( hHdl, sizeof( BITMAP ), (LPSTR) &aBmp );
+
+ // Destination-Bitmap erzeugen
+ if ( hCopy = CreateBitmapIndirect( &aBmp ) )
+ {
+ HDC hBmpDC = CreateCompatibleDC( 0 );
+ HBITMAP hBmpOld = (HBITMAP) SelectObject( hBmpDC, hHdl );
+ HDC hCopyDC = CreateCompatibleDC( hBmpDC );
+ HBITMAP hCopyOld = (HBITMAP) SelectObject( hCopyDC, hCopy );
+
+ BitBlt( hCopyDC, 0, 0, aBmp.bmWidth, aBmp.bmHeight, hBmpDC, 0, 0, SRCCOPY );
+
+ SelectObject( hCopyDC, hCopyOld );
+ DeleteDC( hCopyDC );
+
+ SelectObject( hBmpDC, hBmpOld );
+ DeleteDC( hBmpDC );
+ }
+ }
+
+ return hCopy;
+}
+
+// ------------------------------------------------------------------
+
+BitmapBuffer* SalBitmap::AcquireBuffer( BOOL bReadOnly )
+{
+ BitmapBuffer* pBuffer = NULL;
+
+ if( mhDIB )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+
+ if( ( pBIH->biCompression == BI_RLE4 ) || ( pBIH->biCompression == BI_RLE8 ) )
+ {
+ Size aSizePix( pBIH->biWidth, pBIH->biHeight );
+ HGLOBAL hNewDIB = ImplCreateDIB( aSizePix, pBIH->biBitCount, BitmapPalette() );
+
+ if( hNewDIB )
+ {
+ PBITMAPINFO pNewBI = (PBITMAPINFO) GlobalLock( hNewDIB );
+ PBITMAPINFOHEADER pNewBIH = (PBITMAPINFOHEADER) pNewBI;
+ const USHORT nColorCount = ImplGetDIBColorCount( hNewDIB );
+ const ULONG nOffset = *(DWORD*) pBI + nColorCount * sizeof( RGBQUAD );
+ BYTE* pOldBits = (PBYTE) pBI + nOffset;
+ BYTE* pNewBits = (PBYTE) pNewBI + nOffset;
+
+ HMEMCPY( pNewBI, pBI, nOffset );
+ pNewBIH->biCompression = 0;
+ ImplDecodeRLEBuffer( pOldBits, pNewBits, aSizePix, pBIH->biCompression == BI_RLE4 );
+
+ GlobalUnlock( mhDIB );
+ GlobalFree( mhDIB );
+ mhDIB = hNewDIB;
+ pBI = pNewBI;
+ pBIH = pNewBIH;
+ }
+ }
+
+ if( pBIH->biPlanes == 1 )
+ {
+ pBuffer = new BitmapBuffer;
+
+ pBuffer->mnFormat = BMP_FORMAT_BOTTOM_UP |
+ ( pBIH->biBitCount == 1 ? BMP_FORMAT_1BIT_MSB_PAL :
+ pBIH->biBitCount == 4 ? BMP_FORMAT_4BIT_MSN_PAL :
+ pBIH->biBitCount == 8 ? BMP_FORMAT_8BIT_PAL :
+ pBIH->biBitCount == 16 ? BMP_FORMAT_16BIT_TC_MASK :
+ pBIH->biBitCount == 24 ? BMP_FORMAT_24BIT_TC_BGR :
+ pBIH->biBitCount == 32 ? BMP_FORMAT_32BIT_TC_MASK : 0UL );
+
+ if( BMP_SCANLINE_FORMAT( pBuffer->mnFormat ) )
+ {
+ pBuffer->mnWidth = maSize.Width();
+ pBuffer->mnHeight = maSize.Height();
+ pBuffer->mnScanlineSize = AlignedWidth4Bytes( maSize.Width() * pBIH->biBitCount );
+ pBuffer->mnBitCount = (USHORT) pBIH->biBitCount;
+
+ if( pBuffer->mnBitCount <= 8 )
+ {
+ const USHORT nPalCount = ImplGetDIBColorCount( mhDIB );
+
+ pBuffer->maPalette.SetEntryCount( nPalCount );
+ HMEMCPY( pBuffer->maPalette.ImplGetColorBuffer(), pBI->bmiColors, nPalCount * sizeof( RGBQUAD ) );
+ pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI + nPalCount * sizeof( RGBQUAD );
+ }
+ else if( ( pBIH->biBitCount == 16 ) || ( pBIH->biBitCount == 32 ) )
+ {
+ ULONG nOffset = 0UL;
+
+ if( pBIH->biCompression == BI_BITFIELDS )
+ {
+ nOffset = 3 * sizeof( RGBQUAD );
+ pBuffer->maColorMask = ColorMask( *(UINT32*) &pBI->bmiColors[ 0 ],
+ *(UINT32*) &pBI->bmiColors[ 1 ],
+ *(UINT32*) &pBI->bmiColors[ 2 ] );
+ }
+ else if( pBIH->biCompression == 16 )
+ pBuffer->maColorMask = ColorMask( 0x00007c00UL, 0x000003e0UL, 0x0000001fUL );
+ else
+ pBuffer->maColorMask = ColorMask( 0x00ff0000UL, 0x0000ff00UL, 0x000000ffUL );
+
+ pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI + nOffset;
+ }
+ else
+ pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI;
+ }
+ else
+ {
+ GlobalUnlock( mhDIB );
+ delete pBuffer;
+ pBuffer = NULL;
+ }
+ }
+ else
+ GlobalUnlock( mhDIB );
+ }
+
+ return pBuffer;
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BOOL bReadOnly )
+{
+ if( pBuffer )
+ {
+ if( mhDIB )
+ {
+ if( !bReadOnly && !!pBuffer->maPalette )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ const USHORT nCount = pBuffer->maPalette.GetEntryCount();
+
+ HMEMCPY( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGBQUAD ) );
+ GlobalUnlock( mhDIB );
+ }
+
+ GlobalUnlock( mhDIB );
+ }
+
+ delete pBuffer;
+ }
+}
+
+// ------------------------------------------------------------------
+
+void SalBitmap::ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf,
+ const Size& rSizePixel, BOOL bRLE4 )
+{
+ HPBYTE pRLE = (HPBYTE) pSrcBuf;
+ HPBYTE pDIB = (HPBYTE) pDstBuf;
+ HPBYTE pRow = (HPBYTE) pDstBuf;
+ ULONG nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) );
+ HPBYTE pLast = pDIB + rSizePixel.Height() * nWidthAl - 1;
+ ULONG nCountByte;
+ ULONG nRunByte;
+ ULONG nX = 0;
+ ULONG i;
+ BYTE cTmp;
+ BOOL bEndDecoding = FALSE;
+
+ if( pRLE && pDIB )
+ {
+ do
+ {
+ if( !( nCountByte = *pRLE++ ) )
+ {
+ nRunByte = *pRLE++;
+
+ if( nRunByte > 2UL )
+ {
+ if( bRLE4 )
+ {
+ nCountByte = nRunByte >> 1UL;
+
+ for( i = 0; i < nCountByte; i++ )
+ {
+ cTmp = *pRLE++;
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ ImplSetPixel4( pDIB, nX++, cTmp & 0x0f );
+ }
+
+ if( nRunByte & 1 )
+ ImplSetPixel4( pDIB, nX++, *pRLE++ >> 4 );
+
+ if( ( ( nRunByte + 1 ) >> 1 ) & 1 )
+ pRLE++;
+ }
+ else
+ {
+ HMEMCPY( &pDIB[ nX ], pRLE, nRunByte );
+ pRLE += nRunByte;
+ nX += nRunByte;
+
+ if( nRunByte & 1 )
+ pRLE++;
+ }
+ }
+ else if( !nRunByte )
+ {
+ pDIB = ( pRow += nWidthAl );
+ nX = 0UL;
+ }
+ else if( nRunByte == 1 )
+ bEndDecoding = TRUE;
+ else
+ {
+ nX += *pRLE++;
+ pDIB = ( pRow += ( *pRLE++ ) * nWidthAl );
+ }
+ }
+ else
+ {
+ cTmp = *pRLE++;
+
+ if( bRLE4 )
+ {
+ nRunByte = nCountByte >> 1;
+
+ for( i = 0; i < nRunByte; i++ )
+ {
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ ImplSetPixel4( pDIB, nX++, cTmp & 0x0f );
+ }
+
+ if( nCountByte & 1 )
+ ImplSetPixel4( pDIB, nX++, cTmp >> 4 );
+ }
+ else
+ {
+ for( i = 0; i < nCountByte; i++ )
+ pDIB[ nX++ ] = cTmp;
+ }
+ }
+ }
+ while( !bEndDecoding && ( pDIB <= pLast ) );
+ }
+}
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
new file mode 100644
index 000000000000..f8f5892add4e
--- /dev/null
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -0,0 +1,1449 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+#define _SV_SALGDI_CXX
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// =======================================================================
+
+#define DITHER_PAL_DELTA 51
+#define DITHER_PAL_STEPS 6
+#define DITHER_PAL_COUNT (DITHER_PAL_STEPS*DITHER_PAL_STEPS*DITHER_PAL_STEPS)
+#define DITHER_MAX_SYSCOLOR 16
+#define DITHER_EXTRA_COLORS 1
+#define DMAP( _def_nVal, _def_nThres ) ((pDitherDiff[_def_nVal]>(_def_nThres))?pDitherHigh[_def_nVal]:pDitherLow[_def_nVal])
+
+// =======================================================================
+
+struct SysColorEntry
+{
+ DWORD nRGB;
+ SysColorEntry* pNext;
+};
+
+// =======================================================================
+
+static SysColorEntry* pFirstSysColor = NULL;
+static SysColorEntry* pActSysColor = NULL;
+
+// -----------------------------------------------------------------------------
+
+// Blue7
+static PALETTEENTRY aImplExtraColor1 =
+{
+ 0, 184, 255, 0
+};
+
+// -----------------------------------------------------------------------------
+
+static PALETTEENTRY aImplSalSysPalEntryAry[ DITHER_MAX_SYSCOLOR ] =
+{
+{ 0, 0, 0, 0 },
+{ 0, 0, 0x80, 0 },
+{ 0, 0x80, 0, 0 },
+{ 0, 0x80, 0x80, 0 },
+{ 0x80, 0, 0, 0 },
+{ 0x80, 0, 0x80, 0 },
+{ 0x80, 0x80, 0, 0 },
+{ 0x80, 0x80, 0x80, 0 },
+{ 0xC0, 0xC0, 0xC0, 0 },
+{ 0, 0, 0xFF, 0 },
+{ 0, 0xFF, 0, 0 },
+{ 0, 0xFF, 0xFF, 0 },
+{ 0xFF, 0, 0, 0 },
+{ 0xFF, 0, 0xFF, 0 },
+{ 0xFF, 0xFF, 0, 0 },
+{ 0xFF, 0xFF, 0xFF, 0 }
+};
+
+// -----------------------------------------------------------------------------
+
+static BYTE aOrdDither8Bit[8][8] =
+{
+ 0, 38, 9, 48, 2, 40, 12, 50,
+ 25, 12, 35, 22, 28, 15, 37, 24,
+ 6, 44, 3, 41, 8, 47, 5, 44,
+ 32, 19, 28, 16, 34, 21, 31, 18,
+ 1, 40, 11, 49, 0, 39, 10, 48,
+ 27, 14, 36, 24, 26, 13, 36, 23,
+ 8, 46, 4, 43, 7, 45, 4, 42,
+ 33, 20, 30, 17, 32, 20, 29, 16
+};
+
+// -----------------------------------------------------------------------------
+
+static BYTE aOrdDither16Bit[8][8] =
+{
+ 0, 6, 1, 7, 0, 6, 1, 7,
+ 4, 2, 5, 3, 4, 2, 5, 3,
+ 1, 7, 0, 6, 1, 7, 0, 6,
+ 5, 3, 4, 2, 5, 3, 4, 2,
+ 0, 6, 1, 7, 0, 6, 1, 7,
+ 4, 2, 5, 3, 4, 2, 5, 3,
+ 1, 7, 0, 6, 1, 7, 0, 6,
+ 5, 3, 4, 2, 5, 3, 4, 2
+};
+
+// =======================================================================
+
+// Pens muessen wir mit 1 Pixel-Breite erzeugen, da ansonsten die S3-Karte
+// viele Paintprobleme hat, wenn Polygone/PolyLines gezeichnet werden und
+// eine komplexe ClipRegion gesetzt ist
+#define GSL_PEN_WIDTH 1
+
+// =======================================================================
+
+#define SAL_POLYPOLYCOUNT_STACKBUF 8
+#define SAL_POLYPOLYPOINTS_STACKBUF 64
+
+// =======================================================================
+
+void ImplInitSalGDI()
+{
+ SalData* pSalData = GetSalData();
+
+ // init stock brushes
+ pSalData->maStockPenColorAry[0] = PALETTERGB( 0, 0, 0 );
+ pSalData->maStockPenColorAry[1] = PALETTERGB( 0xFF, 0xFF, 0xFF );
+ pSalData->maStockPenColorAry[2] = PALETTERGB( 0xC0, 0xC0, 0xC0 );
+ pSalData->maStockPenColorAry[3] = PALETTERGB( 0x80, 0x80, 0x80 );
+ pSalData->mhStockPenAry[0] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[0] );
+ pSalData->mhStockPenAry[1] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[1] );
+ pSalData->mhStockPenAry[2] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[2] );
+ pSalData->mhStockPenAry[3] = CreatePen( PS_SOLID, GSL_PEN_WIDTH, pSalData->maStockPenColorAry[3] );
+ pSalData->mnStockPenCount = 4;
+
+ pSalData->maStockBrushColorAry[0] = PALETTERGB( 0, 0, 0 );
+ pSalData->maStockBrushColorAry[1] = PALETTERGB( 0xFF, 0xFF, 0xFF );
+ pSalData->maStockBrushColorAry[2] = PALETTERGB( 0xC0, 0xC0, 0xC0 );
+ pSalData->maStockBrushColorAry[3] = PALETTERGB( 0x80, 0x80, 0x80 );
+ pSalData->mhStockBrushAry[0] = CreateSolidBrush( pSalData->maStockBrushColorAry[0] );
+ pSalData->mhStockBrushAry[1] = CreateSolidBrush( pSalData->maStockBrushColorAry[1] );
+ pSalData->mhStockBrushAry[2] = CreateSolidBrush( pSalData->maStockBrushColorAry[2] );
+ pSalData->mhStockBrushAry[3] = CreateSolidBrush( pSalData->maStockBrushColorAry[3] );
+ pSalData->mnStockBrushCount = 4;
+
+ // DC-Cache aufbauen
+ pSalData->mpHDCCache = new HDCCache[ CACHESIZE_HDC ];
+ memset( pSalData->mpHDCCache, 0, CACHESIZE_HDC * sizeof( HDCCache ) );
+
+ // Nur bei 256 Farben Displays, die Paletten unterstuetzen
+ HDC hDC = GetDC( 0 );
+ int nBitsPixel = GetDeviceCaps( hDC, BITSPIXEL );
+ int nPlanes = GetDeviceCaps( hDC, PLANES );
+ int nRasterCaps = GetDeviceCaps( hDC, RASTERCAPS );
+ int nBitCount = nBitsPixel * nPlanes;
+
+ if ( (nBitCount > 8) && (nBitCount < 24) )
+ {
+ // test, if we have to dither
+ HDC hMemDC = ::CreateCompatibleDC( hDC );
+ HBITMAP hMemBmp = ::CreateCompatibleBitmap( hDC, 8, 8 );
+ HBITMAP hBmpOld = (HBITMAP) ::SelectObject( hMemDC, hMemBmp );
+ HBRUSH hMemBrush = ::CreateSolidBrush( PALETTERGB( 175, 171, 169 ) );
+ HBRUSH hBrushOld = (HBRUSH) ::SelectObject( hMemDC, hMemBrush );
+ BOOL bDither16 = TRUE;
+
+ ::PatBlt( hMemDC, 0, 0, 8, 8, PATCOPY );
+ const COLORREF aCol( ::GetPixel( hMemDC, 0, 0 ) );
+
+ for( int nY = 0; ( nY < 8 ) && bDither16; nY++ )
+ for( int nX = 0; ( nX < 8 ) && bDither16; nX++ )
+ if( ::GetPixel( hMemDC, nX, nY ) != aCol )
+ bDither16 = FALSE;
+
+ ::SelectObject( hMemDC, hBrushOld ), ::DeleteObject( hMemBrush );
+ ::SelectObject( hMemDC, hBmpOld ), ::DeleteObject( hMemBmp );
+ ::DeleteDC( hMemDC );
+
+ if( bDither16 )
+ {
+ // create DIBPattern for 16Bit dithering
+ long n;
+
+ pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, sizeof( BITMAPINFOHEADER ) + 192 );
+ pSalData->mpDitherDIB = (BYTE*) GlobalLock( pSalData->mhDitherDIB );
+ pSalData->mpDitherDiff = new long[ 256 ];
+ pSalData->mpDitherLow = new BYTE[ 256 ];
+ pSalData->mpDitherHigh = new BYTE[ 256 ];
+ pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER );
+ memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
+
+ BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) pSalData->mpDitherDIB;
+
+ pBIH->biSize = sizeof( BITMAPINFOHEADER );
+ pBIH->biWidth = 8;
+ pBIH->biHeight = 8;
+ pBIH->biPlanes = 1;
+ pBIH->biBitCount = 24;
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherDiff[ n ] = n - ( n & 248L );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherLow[ n ] = (BYTE) ( n & 248 );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherHigh[ n ] = (BYTE) Min( pSalData->mpDitherLow[ n ] + 8L, 255L );
+ }
+ }
+ else if ( (nRasterCaps & RC_PALETTE) && (nBitCount == 8) )
+ {
+ BYTE nRed, nGreen, nBlue;
+ BYTE nR, nG, nB;
+ PALETTEENTRY* pPalEntry;
+ LOGPALETTE* pLogPal;
+ const USHORT nDitherPalCount = DITHER_PAL_COUNT;
+ ULONG nTotalCount = DITHER_MAX_SYSCOLOR + nDitherPalCount + DITHER_EXTRA_COLORS;
+
+ // create logical palette
+ pLogPal = (LOGPALETTE*) new char[ sizeof( LOGPALETTE ) + ( nTotalCount * sizeof( PALETTEENTRY ) ) ];
+ pLogPal->palVersion = 0x0300;
+ pLogPal->palNumEntries = (USHORT) nTotalCount;
+ pPalEntry = pLogPal->palPalEntry;
+
+ // Standard colors
+ memcpy( pPalEntry, aImplSalSysPalEntryAry, DITHER_MAX_SYSCOLOR * sizeof( PALETTEENTRY ) );
+ pPalEntry += DITHER_MAX_SYSCOLOR;
+
+ // own palette (6/6/6)
+ for( nB=0, nBlue=0; nB < DITHER_PAL_STEPS; nB++, nBlue += DITHER_PAL_DELTA )
+ {
+ for( nG=0, nGreen=0; nG < DITHER_PAL_STEPS; nG++, nGreen += DITHER_PAL_DELTA )
+ {
+ for( nR=0, nRed=0; nR < DITHER_PAL_STEPS; nR++, nRed += DITHER_PAL_DELTA )
+ {
+ pPalEntry->peRed = nRed;
+ pPalEntry->peGreen = nGreen;
+ pPalEntry->peBlue = nBlue;
+ pPalEntry->peFlags = 0;
+ pPalEntry++;
+ }
+ }
+ }
+
+ // insert special 'Blue' as standard drawing color
+ *pPalEntry++ = aImplExtraColor1;
+
+ // create palette
+ pSalData->mhDitherPal = CreatePalette( pLogPal );
+ delete[] (char*) pLogPal;
+
+ if( pSalData->mhDitherPal )
+ {
+ // create DIBPattern for 8Bit dithering
+ long nSize = sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) ) + 64;
+ long n;
+
+ pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, nSize );
+ pSalData->mpDitherDIB = (BYTE*) GlobalLock( pSalData->mhDitherDIB );
+ pSalData->mpDitherDiff = new long[ 256 ];
+ pSalData->mpDitherLow = new BYTE[ 256 ];
+ pSalData->mpDitherHigh = new BYTE[ 256 ];
+ pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) );
+ memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
+
+ BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) pSalData->mpDitherDIB;
+ short* pColors = (short*) ( pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) );
+
+ pBIH->biSize = sizeof( BITMAPINFOHEADER );
+ pBIH->biWidth = 8;
+ pBIH->biHeight = 8;
+ pBIH->biPlanes = 1;
+ pBIH->biBitCount = 8;
+
+ for( n = 0; n < nDitherPalCount; n++ )
+ pColors[ n ] = (short)( n + DITHER_MAX_SYSCOLOR );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherDiff[ n ] = n % 51L;
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherLow[ n ] = (BYTE) ( n / 51L );
+
+ for( n = 0; n < 256L; n++ )
+ pSalData->mpDitherHigh[ n ] = Min( pSalData->mpDitherLow[ n ] + 1, 5 );
+ }
+
+ // get system color entries
+ ImplUpdateSysColorEntries();
+ }
+
+ ReleaseDC( 0, hDC );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplFreeSalGDI()
+{
+ SalData* pSalData = GetSalData();
+ USHORT i;
+
+ // destroy stock objects
+ for ( i = 0; i < pSalData->mnStockPenCount; i++ )
+ DeletePen( pSalData->mhStockPenAry[i] );
+ for ( i = 0; i < pSalData->mnStockBrushCount; i++ )
+ DeleteBrush( pSalData->mhStockBrushAry[i] );
+
+ // 50% Brush loeschen
+ if ( pSalData->mh50Brush )
+ {
+ DeleteBrush( pSalData->mh50Brush );
+ pSalData->mh50Brush = 0;
+ }
+
+ // 50% Bitmap loeschen
+ if ( pSalData->mh50Bmp )
+ {
+ DeleteBitmap( pSalData->mh50Bmp );
+ pSalData->mh50Bmp = 0;
+ }
+
+ ImplClearHDCCache( pSalData );
+ delete[] pSalData->mpHDCCache;
+
+ // Ditherpalette loeschen, wenn vorhanden
+ if ( pSalData->mhDitherPal )
+ {
+ DeleteObject( pSalData->mhDitherPal );
+ pSalData->mhDitherPal = 0;
+ }
+
+ // delete buffers for dithering DIB patterns, if neccessary
+ if ( pSalData->mhDitherDIB )
+ {
+ GlobalUnlock( pSalData->mhDitherDIB );
+ GlobalFree( pSalData->mhDitherDIB );
+ pSalData->mhDitherDIB = 0;
+ delete[] pSalData->mpDitherDiff;
+ delete[] pSalData->mpDitherLow;
+ delete[] pSalData->mpDitherHigh;
+ }
+
+ // delete SysColorList
+ SysColorEntry* pEntry = pFirstSysColor;
+ while( pEntry )
+ {
+ SysColorEntry* pTmp = pEntry->pNext;
+ delete pEntry;
+ pEntry = pTmp;
+ }
+ pFirstSysColor = NULL;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplIsPaletteEntry( BYTE nRed, BYTE nGreen, BYTE nBlue )
+{
+ // dither color?
+ if ( !(nRed % DITHER_PAL_DELTA) && !(nGreen % DITHER_PAL_DELTA) && !(nBlue % DITHER_PAL_DELTA) )
+ return TRUE;
+
+ PALETTEENTRY* pPalEntry = aImplSalSysPalEntryAry;
+
+ // standard palette color?
+ for ( USHORT i = 0; i < DITHER_MAX_SYSCOLOR; i++, pPalEntry++ )
+ {
+ if( pPalEntry->peRed == nRed && pPalEntry->peGreen == nGreen && pPalEntry->peBlue == nBlue )
+ return TRUE;
+ }
+
+ // extra color?
+ if ( aImplExtraColor1.peRed == nRed &&
+ aImplExtraColor1.peGreen == nGreen &&
+ aImplExtraColor1.peBlue == nBlue )
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// =======================================================================
+
+int ImplIsSysColorEntry( SalColor nSalColor )
+{
+ SysColorEntry* pEntry = pFirstSysColor;
+ const DWORD nTestRGB = (DWORD)RGB( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ while ( pEntry )
+ {
+ if ( pEntry->nRGB == nTestRGB )
+ return TRUE;
+ pEntry = pEntry->pNext;
+ }
+
+ return FALSE;
+}
+
+// =======================================================================
+
+static void ImplInsertSysColorEntry( int nSysIndex )
+{
+ const DWORD nRGB = GetSysColor( nSysIndex );
+
+ if ( !ImplIsPaletteEntry( GetRValue( nRGB ), GetGValue( nRGB ), GetBValue( nRGB ) ) )
+ {
+ if ( !pFirstSysColor )
+ {
+ pActSysColor = pFirstSysColor = new SysColorEntry;
+ pFirstSysColor->nRGB = nRGB;
+ pFirstSysColor->pNext = NULL;
+ }
+ else
+ {
+ pActSysColor = pActSysColor->pNext = new SysColorEntry;
+ pActSysColor->nRGB = nRGB;
+ pActSysColor->pNext = NULL;
+ }
+ }
+}
+
+// =======================================================================
+
+void ImplUpdateSysColorEntries()
+{
+ // delete old SysColorList
+ SysColorEntry* pEntry = pFirstSysColor;
+ while( pEntry )
+ {
+ SysColorEntry* pTmp = pEntry->pNext;
+ delete pEntry;
+ pEntry = pTmp;
+ }
+ pActSysColor = pFirstSysColor = NULL;
+
+ // create new sys color list
+ ImplInsertSysColorEntry( COLOR_ACTIVEBORDER );
+ ImplInsertSysColorEntry( COLOR_INACTIVEBORDER );
+ if( aSalShlData.mnVersion >= 410 )
+ {
+ ImplInsertSysColorEntry( COLOR_GRADIENTACTIVECAPTION );
+ ImplInsertSysColorEntry( COLOR_GRADIENTINACTIVECAPTION );
+ }
+ ImplInsertSysColorEntry( COLOR_3DFACE );
+ ImplInsertSysColorEntry( COLOR_3DHILIGHT );
+ ImplInsertSysColorEntry( COLOR_3DLIGHT );
+ ImplInsertSysColorEntry( COLOR_3DSHADOW );
+ ImplInsertSysColorEntry( COLOR_3DDKSHADOW );
+ ImplInsertSysColorEntry( COLOR_INFOBK );
+ ImplInsertSysColorEntry( COLOR_INFOTEXT );
+ ImplInsertSysColorEntry( COLOR_BTNTEXT );
+ ImplInsertSysColorEntry( COLOR_WINDOW );
+ ImplInsertSysColorEntry( COLOR_WINDOWTEXT );
+ ImplInsertSysColorEntry( COLOR_HIGHLIGHT );
+ ImplInsertSysColorEntry( COLOR_HIGHLIGHTTEXT );
+ ImplInsertSysColorEntry( COLOR_MENU );
+ ImplInsertSysColorEntry( COLOR_MENUTEXT );
+ ImplInsertSysColorEntry( COLOR_ACTIVECAPTION );
+ ImplInsertSysColorEntry( COLOR_CAPTIONTEXT );
+ ImplInsertSysColorEntry( COLOR_INACTIVECAPTION );
+ ImplInsertSysColorEntry( COLOR_INACTIVECAPTIONTEXT );
+}
+
+// -----------------------------------------------------------------------
+
+static SalColor ImplGetROPSalColor( SalROPColor nROPColor )
+{
+ SalColor nSalColor;
+ if ( nROPColor == SAL_ROP_0 )
+ nSalColor = MAKE_SALCOLOR( 0, 0, 0 );
+ else
+ nSalColor = MAKE_SALCOLOR( 255, 255, 255 );
+ return nSalColor;
+}
+
+// =======================================================================
+
+void ImplSalInitGraphics( SalGraphicsData* pData )
+{
+ // Beim Printer berechnen wir die minimale Linienstaerke
+ if ( pData->mbPrinter )
+ {
+ int nDPIX = GetDeviceCaps( pData->mhDC, LOGPIXELSX );
+ if ( nDPIX <= 300 )
+ pData->mnPenWidth = 0;
+ else
+ pData->mnPenWidth = nDPIX/300;
+ }
+
+ ::SetTextAlign( pData->mhDC, TA_BASELINE | TA_LEFT | TA_NOUPDATECP );
+ ::SetBkMode( pData->mhDC, TRANSPARENT );
+ ::SetROP2( pData->mhDC, R2_COPYPEN );
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalDeInitGraphics( SalGraphicsData* pData )
+{
+ // Default Objekte selektieren
+ if ( pData->mhDefPen )
+ SelectPen( pData->mhDC, pData->mhDefPen );
+ if ( pData->mhDefBrush )
+ SelectBrush( pData->mhDC, pData->mhDefBrush );
+ if ( pData->mhDefFont )
+ SelectFont( pData->mhDC, pData->mhDefFont );
+}
+
+// =======================================================================
+
+HDC ImplGetCachedDC( ULONG nID, HBITMAP hBmp )
+{
+ SalData* pSalData = GetSalData();
+ HDCCache* pC = &pSalData->mpHDCCache[ nID ];
+
+ if( !pC->mhDC )
+ {
+ HDC hDC = GetDC( 0 );
+
+ // neuen DC mit DefaultBitmap anlegen
+ pC->mhDC = CreateCompatibleDC( hDC );
+
+ if( pSalData->mhDitherPal )
+ {
+ pC->mhDefPal = SelectPalette( pC->mhDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( pC->mhDC );
+ }
+
+ pC->mhSelBmp = CreateCompatibleBitmap( hDC, CACHED_HDC_DEFEXT, CACHED_HDC_DEFEXT );
+ pC->mhDefBmp = (HBITMAP) SelectObject( pC->mhDC, pC->mhSelBmp );
+
+ ReleaseDC( 0, hDC );
+ }
+
+ if ( hBmp )
+ SelectObject( pC->mhDC, pC->mhActBmp = hBmp );
+ else
+ pC->mhActBmp = 0;
+
+ return pC->mhDC;
+}
+
+// =======================================================================
+
+void ImplReleaseCachedDC( ULONG nID )
+{
+ SalData* pSalData = GetSalData();
+ HDCCache* pC = &pSalData->mpHDCCache[ nID ];
+
+ if ( pC->mhActBmp )
+ SelectObject( pC->mhDC, pC->mhSelBmp );
+}
+
+// =======================================================================
+
+void ImplClearHDCCache( SalData* pData )
+{
+ for( ULONG i = 0; i < CACHESIZE_HDC; i++ )
+ {
+ HDCCache* pC = &pData->mpHDCCache[ i ];
+
+ if( pC->mhDC )
+ {
+ SelectObject( pC->mhDC, pC->mhDefBmp );
+
+ if( pC->mhDefPal )
+ SelectPalette( pC->mhDC, pC->mhDefPal, TRUE );
+
+ DeleteDC( pC->mhDC );
+ DeleteObject( pC->mhSelBmp );
+ }
+ }
+}
+
+// =======================================================================
+
+SalGraphics::SalGraphics()
+{
+ maGraphicsData.mhDC = 0;
+ maGraphicsData.mhPen = 0;
+ maGraphicsData.mhBrush = 0;
+ maGraphicsData.mhFont = 0;
+ maGraphicsData.mhRegion = 0;
+ maGraphicsData.mhDefPen = 0;
+ maGraphicsData.mhDefBrush = 0;
+ maGraphicsData.mhDefFont = 0;
+ maGraphicsData.mhDefPal = 0;
+ maGraphicsData.mpStdClipRgnData = NULL;
+ maGraphicsData.mpLogFont = NULL;
+ maGraphicsData.mpFontCharSets = NULL;
+ maGraphicsData.mnFontCharSetCount = 0;
+ maGraphicsData.mpFontKernPairs = NULL;
+ maGraphicsData.mnFontKernPairCount = 0;
+ maGraphicsData.mbFontKernInit = FALSE;
+ maGraphicsData.mnFontOverhang = 0;
+ maGraphicsData.mbXORMode = FALSE;
+ maGraphicsData.mnPenWidth = GSL_PEN_WIDTH;
+ maGraphicsData.mbCalcOverhang = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics::~SalGraphics()
+{
+ // Objekte zerstoeren
+ if ( maGraphicsData.mhPen )
+ {
+ if ( !maGraphicsData.mbStockPen )
+ DeletePen( maGraphicsData.mhPen );
+ }
+ if ( maGraphicsData.mhBrush )
+ {
+ if ( !maGraphicsData.mbStockBrush )
+ DeleteBrush( maGraphicsData.mhBrush );
+ }
+ if ( maGraphicsData.mhFont )
+ DeleteFont( maGraphicsData.mhFont );
+
+ if ( maGraphicsData.mhRegion )
+ {
+ DeleteRegion( maGraphicsData.mhRegion );
+ maGraphicsData.mhRegion = 0;
+ }
+
+ // Cache-Daten zerstoeren
+ if ( maGraphicsData.mpStdClipRgnData )
+ delete maGraphicsData.mpStdClipRgnData;
+
+ if ( maGraphicsData.mpLogFont )
+ delete maGraphicsData.mpLogFont;
+
+ if ( maGraphicsData.mpFontCharSets )
+ delete maGraphicsData.mpFontCharSets;
+
+ if ( maGraphicsData.mpFontKernPairs )
+ delete maGraphicsData.mpFontKernPairs;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetResolution( long& rDPIX, long& rDPIY )
+{
+ rDPIX = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSX );
+ rDPIY = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSY );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetScreenFontResolution( long& rDPIX, long& rDPIY )
+{
+ rDPIX = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSX );
+ rDPIY = GetDeviceCaps( maGraphicsData.mhDC, LOGPIXELSY );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalGraphics::GetBitCount()
+{
+ return (USHORT)GetDeviceCaps( maGraphicsData.mhDC, BITSPIXEL );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::ResetClipRegion()
+{
+ if ( maGraphicsData.mhRegion )
+ {
+ DeleteRegion( maGraphicsData.mhRegion );
+ maGraphicsData.mhRegion = 0;
+ }
+
+ SelectClipRgn( maGraphicsData.mhDC, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::BeginSetClipRegion( ULONG nRectCount )
+{
+ if ( maGraphicsData.mhRegion )
+ {
+ DeleteRegion( maGraphicsData.mhRegion );
+ maGraphicsData.mhRegion = 0;
+ }
+
+ ULONG nRectBufSize = sizeof(RECT)*nRectCount;
+ if ( nRectCount < SAL_CLIPRECT_COUNT )
+ {
+ if ( !maGraphicsData.mpStdClipRgnData )
+ maGraphicsData.mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
+ maGraphicsData.mpClipRgnData = maGraphicsData.mpStdClipRgnData;
+ }
+ else
+ maGraphicsData.mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ maGraphicsData.mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
+ maGraphicsData.mpClipRgnData->rdh.iType = RDH_RECTANGLES;
+ maGraphicsData.mpClipRgnData->rdh.nCount = nRectCount;
+ maGraphicsData.mpClipRgnData->rdh.nRgnSize = nRectBufSize;
+ SetRectEmpty( &(maGraphicsData.mpClipRgnData->rdh.rcBound) );
+ maGraphicsData.mpNextClipRect = (RECT*)(&(maGraphicsData.mpClipRgnData->Buffer));
+ maGraphicsData.mbFirstClipRect = TRUE;
+}
+
+
+// -----------------------------------------------------------------------
+
+BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+ if ( nWidth && nHeight )
+ {
+ RECT* pRect = maGraphicsData.mpNextClipRect;
+ RECT* pBoundRect = &(maGraphicsData.mpClipRgnData->rdh.rcBound);
+ long nRight = nX + nWidth;
+ long nBottom = nY + nHeight;
+
+ if ( maGraphicsData.mbFirstClipRect )
+ {
+ pBoundRect->left = nX;
+ pBoundRect->top = nY;
+ pBoundRect->right = nRight;
+ pBoundRect->bottom = nBottom;
+ maGraphicsData.mbFirstClipRect = FALSE;
+ }
+ else
+ {
+ if ( nX < pBoundRect->left )
+ pBoundRect->left = (int)nX;
+
+ if ( nY < pBoundRect->top )
+ pBoundRect->top = (int)nY;
+
+ if ( nRight > pBoundRect->right )
+ pBoundRect->right = (int)nRight;
+
+ if ( nBottom > pBoundRect->bottom )
+ pBoundRect->bottom = (int)nBottom;
+ }
+
+ pRect->left = (int)nX;
+ pRect->top = (int)nY;
+ pRect->right = (int)nRight;
+ pRect->bottom = (int)nBottom;
+ maGraphicsData.mpNextClipRect++;
+ }
+ else
+ {
+ maGraphicsData.mpClipRgnData->rdh.nCount--;
+ maGraphicsData.mpClipRgnData->rdh.nRgnSize -= sizeof( RECT );
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::EndSetClipRegion()
+{
+ // Aus den Region-Daten muessen wir jetzt eine ClipRegion erzeugen
+ if ( maGraphicsData.mpClipRgnData->rdh.nCount == 1 )
+ {
+ RECT* pRect = &(maGraphicsData.mpClipRgnData->rdh.rcBound);
+ maGraphicsData.mhRegion = CreateRectRgn( pRect->left, pRect->top,
+ pRect->right, pRect->bottom );
+ }
+ else
+ {
+ ULONG nSize = maGraphicsData.mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
+ maGraphicsData.mhRegion = ExtCreateRegion( NULL, nSize, maGraphicsData.mpClipRgnData );
+
+ // if ExtCreateRegion(...) is not supported
+ if( !maGraphicsData.mhRegion )
+ {
+ RGNDATAHEADER* pHeader = (RGNDATAHEADER*) maGraphicsData.mpClipRgnData;
+
+ if( pHeader->nCount )
+ {
+ RECT* pRect = (RECT*) maGraphicsData.mpClipRgnData->Buffer;
+ maGraphicsData.mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
+ pRect++;
+
+ for( ULONG n = 1; n < pHeader->nCount; n++, pRect++ )
+ {
+ HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
+ CombineRgn( maGraphicsData.mhRegion, maGraphicsData.mhRegion, hRgn, RGN_OR );
+ DeleteRegion( hRgn );
+ }
+ }
+ }
+
+ if ( maGraphicsData.mpClipRgnData != maGraphicsData.mpStdClipRgnData )
+ delete maGraphicsData.mpClipRgnData;
+ }
+
+ SelectClipRgn( maGraphicsData.mhDC, maGraphicsData.mhRegion );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetLineColor()
+{
+ // create and select new pen
+ HPEN hNewPen = GetStockPen( NULL_PEN );
+ HPEN hOldPen = SelectPen( maGraphicsData.mhDC, hNewPen );
+
+ // destory or save old pen
+ if ( maGraphicsData.mhPen )
+ {
+ if ( !maGraphicsData.mbStockPen )
+ DeletePen( maGraphicsData.mhPen );
+ }
+ else
+ maGraphicsData.mhDefPen = hOldPen;
+
+ // set new data
+ maGraphicsData.mhPen = hNewPen;
+ maGraphicsData.mbPen = FALSE;
+ maGraphicsData.mbStockPen = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetLineColor( SalColor nSalColor )
+{
+ COLORREF nPenColor = PALETTERGB( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+ HPEN hNewPen = 0;
+ BOOL bStockPen;
+
+ // search for stock pen (only screen, because printer have problems,
+ // when we use stock objects)
+ if ( !maGraphicsData.mbPrinter )
+ {
+ SalData* pSalData = GetSalData();
+ for ( USHORT i = 0; i < pSalData->mnStockPenCount; i++ )
+ {
+ if ( nPenColor == pSalData->maStockPenColorAry[i] )
+ {
+ hNewPen = pSalData->mhStockPenAry[i];
+ bStockPen = TRUE;
+ break;
+ }
+ }
+ }
+
+ // create new pen
+ if ( !hNewPen )
+ {
+ if ( !maGraphicsData.mbPrinter )
+ {
+ if ( GetSalData()->mhDitherPal && ImplIsSysColorEntry( nSalColor ) )
+ nPenColor = PALRGB_TO_RGB( nPenColor );
+ }
+
+ hNewPen = CreatePen( PS_SOLID, maGraphicsData.mnPenWidth, nPenColor );
+ bStockPen = FALSE;
+ }
+
+ // select new pen
+ HPEN hOldPen = SelectPen( maGraphicsData.mhDC, hNewPen );
+
+ // destory or save old pen
+ if ( maGraphicsData.mhPen )
+ {
+ if ( !maGraphicsData.mbStockPen )
+ DeletePen( maGraphicsData.mhPen );
+ }
+ else
+ maGraphicsData.mhDefPen = hOldPen;
+
+ // set new data
+ maGraphicsData.mnPenColor = nPenColor;
+ maGraphicsData.mhPen = hNewPen;
+ maGraphicsData.mbPen = TRUE;
+ maGraphicsData.mbStockPen = bStockPen;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetFillColor()
+{
+ // create and select new brush
+ HBRUSH hNewBrush = GetStockBrush( NULL_BRUSH );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hNewBrush );
+
+ // destory or save old brush
+ if ( maGraphicsData.mhBrush )
+ {
+ if ( !maGraphicsData.mbStockBrush )
+ DeleteBrush( maGraphicsData.mhBrush );
+ }
+ else
+ maGraphicsData.mhDefBrush = hOldBrush;
+
+ // set new data
+ maGraphicsData.mhBrush = hNewBrush;
+ maGraphicsData.mbBrush = FALSE;
+ maGraphicsData.mbStockBrush = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetFillColor( SalColor nSalColor )
+{
+ SalData* pSalData = GetSalData();
+ BYTE nRed = SALCOLOR_RED( nSalColor );
+ BYTE nGreen = SALCOLOR_GREEN( nSalColor );
+ BYTE nBlue = SALCOLOR_BLUE( nSalColor );
+ COLORREF nBrushColor = PALETTERGB( nRed, nGreen, nBlue );
+ HBRUSH hNewBrush = 0;
+ BOOL bStockBrush;
+
+ // search for stock brush (only screen, because printer have problems,
+ // when we use stock objects)
+ if ( !maGraphicsData.mbPrinter )
+ {
+ for ( USHORT i = 0; i < pSalData->mnStockBrushCount; i++ )
+ {
+ if ( nBrushColor == pSalData->maStockBrushColorAry[ i ] )
+ {
+ hNewBrush = pSalData->mhStockBrushAry[i];
+ bStockBrush = TRUE;
+ break;
+ }
+ }
+ }
+
+ // create new brush
+ if ( !hNewBrush )
+ {
+ if ( maGraphicsData.mbPrinter || !pSalData->mhDitherDIB )
+ hNewBrush = CreateSolidBrush( nBrushColor );
+ else
+ {
+ if ( 24 == ((BITMAPINFOHEADER*)pSalData->mpDitherDIB)->biBitCount )
+ {
+ BYTE* pTmp = pSalData->mpDitherDIBData;
+ long* pDitherDiff = pSalData->mpDitherDiff;
+ BYTE* pDitherLow = pSalData->mpDitherLow;
+ BYTE* pDitherHigh = pSalData->mpDitherHigh;
+
+ for( long nY = 0L; nY < 8L; nY++ )
+ {
+ for( long nX = 0L; nX < 8L; nX++ )
+ {
+ const long nThres = aOrdDither16Bit[ nY ][ nX ];
+ *pTmp++ = DMAP( nBlue, nThres );
+ *pTmp++ = DMAP( nGreen, nThres );
+ *pTmp++ = DMAP( nRed, nThres );
+ }
+ }
+
+ hNewBrush = CreateDIBPatternBrush( pSalData->mhDitherDIB, DIB_RGB_COLORS );
+ }
+ else if ( ImplIsSysColorEntry( nSalColor ) )
+ {
+ nBrushColor = PALRGB_TO_RGB( nBrushColor );
+ hNewBrush = CreateSolidBrush( nBrushColor );
+ }
+ else if ( ImplIsPaletteEntry( nRed, nGreen, nBlue ) )
+ hNewBrush = CreateSolidBrush( nBrushColor );
+ else
+ {
+ BYTE* pTmp = pSalData->mpDitherDIBData;
+ long* pDitherDiff = pSalData->mpDitherDiff;
+ BYTE* pDitherLow = pSalData->mpDitherLow;
+ BYTE* pDitherHigh = pSalData->mpDitherHigh;
+
+ for ( long nY = 0L; nY < 8L; nY++ )
+ {
+ for ( long nX = 0L; nX < 8L; nX++ )
+ {
+ const long nThres = aOrdDither8Bit[ nY ][ nX ];
+ *pTmp = DMAP( nRed, nThres ) + DMAP( nGreen, nThres ) * 6 + DMAP( nBlue, nThres ) * 36;
+ pTmp++;
+ }
+ }
+
+ hNewBrush = CreateDIBPatternBrush( pSalData->mhDitherDIB, DIB_PAL_COLORS );
+ }
+ }
+
+ bStockBrush = FALSE;
+ }
+
+ // select new brush
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hNewBrush );
+
+ // destory or save old brush
+ if ( maGraphicsData.mhBrush )
+ {
+ if ( !maGraphicsData.mbStockBrush )
+ DeleteBrush( maGraphicsData.mhBrush );
+ }
+ else
+ maGraphicsData.mhDefBrush = hOldBrush;
+
+ // set new data
+ maGraphicsData.mnBrushColor = nBrushColor;
+ maGraphicsData.mhBrush = hNewBrush;
+ maGraphicsData.mbBrush = FALSE;
+ maGraphicsData.mbStockBrush = bStockBrush;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetXORMode( BOOL bSet )
+{
+ maGraphicsData.mbXORMode = bSet;
+ ::SetROP2( maGraphicsData.mhDC, bSet ? R2_XORPEN : R2_COPYPEN );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetROPLineColor( SalROPColor nROPColor )
+{
+ SetLineColor( ImplGetROPSalColor( nROPColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::SetROPFillColor( SalROPColor nROPColor )
+{
+ SetFillColor( ImplGetROPSalColor( nROPColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPixel( long nX, long nY )
+{
+ if ( maGraphicsData.mbXORMode )
+ {
+ HBRUSH hBrush = CreateSolidBrush( maGraphicsData.mnPenColor );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hBrush );
+ PatBlt( maGraphicsData.mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ DeleteBrush( hBrush );
+ }
+ else
+ SetPixel( maGraphicsData.mhDC, (int)nX, (int)nY, maGraphicsData.mnPenColor );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor )
+{
+ COLORREF nCol = PALETTERGB( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ if ( !maGraphicsData.mbPrinter &&
+ GetSalData()->mhDitherPal &&
+ ImplIsSysColorEntry( nSalColor ) )
+ nCol = PALRGB_TO_RGB( nCol );
+
+ if ( maGraphicsData.mbXORMode )
+ {
+ HBRUSH hBrush = CreateSolidBrush( nCol );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hBrush );
+ PatBlt( maGraphicsData.mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ DeleteBrush( hBrush );
+ }
+ else
+ ::SetPixel( maGraphicsData.mhDC, (int)nX, (int)nY, nCol );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2 )
+{
+ MoveToEx( maGraphicsData.mhDC, (int)nX1, (int)nY1, NULL );
+
+ // we must paint the endpoint
+ int bPaintEnd = TRUE;
+ if ( nX1 == nX2 )
+ {
+ bPaintEnd = FALSE;
+ if ( nY1 <= nY2 )
+ nY2++;
+ else
+ nY2--;
+ }
+ if ( nY1 == nY2 )
+ {
+ bPaintEnd = FALSE;
+ if ( nX1 <= nX2 )
+ nX2++;
+ else
+ nX2--;
+ }
+
+ LineTo( maGraphicsData.mhDC, (int)nX2, (int)nY2 );
+
+ if ( bPaintEnd && !maGraphicsData.mbPrinter )
+ {
+ if ( maGraphicsData.mbXORMode )
+ {
+ HBRUSH hBrush = CreateSolidBrush( maGraphicsData.mnPenColor );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, hBrush );
+ PatBlt( maGraphicsData.mhDC, (int)nX2, (int)nY2, (int)1, (int)1, PATINVERT );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ DeleteBrush( hBrush );
+ }
+ else
+ SetPixel( maGraphicsData.mhDC, (int)nX2, (int)nY2, maGraphicsData.mnPenColor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight )
+{
+ if ( !maGraphicsData.mbPen )
+ {
+ if ( !maGraphicsData.mbPrinter )
+ {
+ PatBlt( maGraphicsData.mhDC, (int)nX, (int)nY, (int)nWidth, (int)nHeight,
+ maGraphicsData.mbXORMode ? PATINVERT : PATCOPY );
+ }
+ else
+ {
+ RECT aWinRect;
+ aWinRect.left = nX;
+ aWinRect.top = nY;
+ aWinRect.right = nX+nWidth;
+ aWinRect.bottom = nY+nHeight;
+ ::FillRect( maGraphicsData.mhDC, &aWinRect, maGraphicsData.mhBrush );
+ }
+ }
+ else
+ WIN_Rectangle( maGraphicsData.mhDC, (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry )
+{
+ // Unter NT koennen wir das Array direkt weiterreichen
+ DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
+ "SalGraphics::DrawPolyLine(): POINT != SalPoint" );
+
+ POINT* pWinPtAry = (POINT*)pPtAry;
+ // Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl
+ // von Punkten
+ if ( !Polyline( maGraphicsData.mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+ Polyline( maGraphicsData.mhDC, pWinPtAry, MAX_64KSALPOINTS );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry )
+{
+ // Unter NT koennen wir das Array direkt weiterreichen
+ DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
+ "SalGraphics::DrawPolygon(): POINT != SalPoint" );
+
+ POINT* pWinPtAry = (POINT*)pPtAry;
+ // Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl
+ // von Punkten
+ if ( !WIN_Polygon( maGraphicsData.mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+ WIN_Polygon( maGraphicsData.mhDC, pWinPtAry, MAX_64KSALPOINTS );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawPolyPolygon( ULONG nPoly, const ULONG* pPoints,
+ PCONSTSALPOINT* pPtAry )
+{
+ UINT aWinPointAry[SAL_POLYPOLYCOUNT_STACKBUF];
+ UINT* pWinPointAry;
+ UINT nPolyPolyPoints = 0;
+ UINT nPoints;
+ UINT i;
+
+ if ( nPoly <= SAL_POLYPOLYCOUNT_STACKBUF )
+ pWinPointAry = aWinPointAry;
+ else
+ pWinPointAry = new UINT[nPoly];
+
+ for ( i = 0; i < (UINT)nPoly; i++ )
+ {
+ nPoints = (UINT)pPoints[i]+1;
+ pWinPointAry[i] = nPoints;
+ nPolyPolyPoints += nPoints;
+ }
+
+ POINT aWinPointAryAry[SAL_POLYPOLYPOINTS_STACKBUF];
+ POINT* pWinPointAryAry;
+ if ( nPolyPolyPoints <= SAL_POLYPOLYPOINTS_STACKBUF )
+ pWinPointAryAry = aWinPointAryAry;
+ else
+ pWinPointAryAry = new POINT[nPolyPolyPoints];
+ // Unter NT koennen wir das Array direkt weiterreichen
+ DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
+ "SalGraphics::DrawPolyPolygon(): POINT != SalPoint" );
+ const SalPoint* pPolyAry;
+ UINT n = 0;
+ for ( i = 0; i < (UINT)nPoly; i++ )
+ {
+ nPoints = pWinPointAry[i];
+ pPolyAry = pPtAry[i];
+ memcpy( pWinPointAryAry+n, pPolyAry, (nPoints-1)*sizeof(POINT) );
+ pWinPointAryAry[n+nPoints-1] = pWinPointAryAry[n];
+ n += nPoints;
+ }
+
+ if ( !WIN_PolyPolygon( maGraphicsData.mhDC, pWinPointAryAry, (int*)pWinPointAry, (UINT)nPoly ) &&
+ (nPolyPolyPoints > MAX_64KSALPOINTS) )
+ {
+ nPolyPolyPoints = 0;
+ nPoly = 0;
+ do
+ {
+ nPolyPolyPoints += pWinPointAry[(UINT)nPoly];
+ nPoly++;
+ }
+ while ( nPolyPolyPoints < MAX_64KSALPOINTS );
+ nPoly--;
+ if ( pWinPointAry[(UINT)nPoly] > MAX_64KSALPOINTS )
+ pWinPointAry[(UINT)nPoly] = MAX_64KSALPOINTS;
+ if ( nPoly == 1 )
+ WIN_Polygon( maGraphicsData.mhDC, pWinPointAryAry, *pWinPointAry );
+ else
+ WIN_PolyPolygon( maGraphicsData.mhDC, pWinPointAryAry, (int*)pWinPointAry, nPoly );
+ }
+
+ if ( pWinPointAry != aWinPointAry )
+ delete pWinPointAry;
+ if ( pWinPointAryAry != aWinPointAryAry )
+ delete pWinPointAryAry;
+}
+
+
+// -----------------------------------------------------------------------
+
+#define POSTSCRIPT_BUFSIZE 0x4000 // MAXIMUM BUFSIZE EQ 0xFFFF
+#define POSTSCRIPT_BOUNDINGSEARCH 0x1000 // we only try to get the BoundingBox
+ // in the first 4096 bytes
+
+static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize )
+{
+ while ( nComp-- >= nSize )
+ {
+ for ( ULONG i = 0; i < nSize; i++ )
+ {
+ if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) )
+ break;
+ }
+ if ( i == nSize )
+ return pSource;
+ pSource++;
+ }
+ return NULL;
+}
+
+static BOOL ImplGetBoundingBox( double* nNumb, BYTE* pSource, ULONG nSize )
+{
+ BOOL bRetValue = FALSE;
+ ULONG nBytesRead;
+
+ if ( nSize < 256 ) // we assume that the file is greater than 256 bytes
+ return FALSE;
+
+ if ( nSize < POSTSCRIPT_BOUNDINGSEARCH )
+ nBytesRead = nSize;
+ else
+ nBytesRead = POSTSCRIPT_BOUNDINGSEARCH;
+
+ BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nBytesRead, 14 );
+ if ( pDest )
+ {
+ int nSecurityCount = 100; // only 100 bytes following the bounding box will be checked
+ nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
+ pDest += 14;
+ for ( int i = 0; ( i < 4 ) && nSecurityCount; i++ )
+ {
+ int nDivision = 1;
+ BOOL bDivision = FALSE;
+ BOOL bNegative = FALSE;
+ BOOL bValid = TRUE;
+
+ while ( ( --nSecurityCount ) && ( *pDest == ' ' ) || ( *pDest == 0x9 ) ) pDest++;
+ BYTE nByte = *pDest;
+ while ( nSecurityCount && ( nByte != ' ' ) && ( nByte != 0x9 ) && ( nByte != 0xd ) && ( nByte != 0xa ) )
+ {
+ switch ( nByte )
+ {
+ case '.' :
+ if ( bDivision )
+ bValid = FALSE;
+ else
+ bDivision = TRUE;
+ break;
+ case '-' :
+ bNegative = TRUE;
+ break;
+ default :
+ if ( ( nByte < '0' ) || ( nByte > '9' ) )
+ nSecurityCount = 1; // error parsing the bounding box values
+ else if ( bValid )
+ {
+ if ( bDivision )
+ nDivision*=10;
+ nNumb[i] *= 10;
+ nNumb[i] += nByte - '0';
+ }
+ break;
+ }
+ nSecurityCount--;
+ nByte = *(++pDest);
+ }
+ if ( bNegative )
+ nNumb[i] = -nNumb[i];
+ if ( bDivision && ( nDivision != 1 ) )
+ nNumb[i] /= nDivision;
+ }
+ if ( nSecurityCount)
+ bRetValue = TRUE;
+ }
+ return bRetValue;
+}
+
+inline void ImplWriteDouble( BYTE** pBuf, double nNumb )
+{
+ *pBuf += sprintf( (char*)*pBuf, "%f", nNumb );
+ *(*pBuf)++ = ' ';
+}
+
+inline void ImplWriteString( BYTE** pBuf, const char* sString )
+{
+ strcpy( (char*)*pBuf, sString );
+ *pBuf += strlen( sString );
+}
+
+BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize )
+{
+ BOOL bRetValue = FALSE;
+
+ if ( maGraphicsData.mbPrinter )
+ {
+ int nEscape = POSTSCRIPT_PASSTHROUGH;
+
+ if ( Escape( maGraphicsData.mhDC, QUERYESCSUPPORT, sizeof( int ), ( LPSTR )&nEscape, 0 ) )
+ {
+ BYTE* pBuf = new BYTE[ POSTSCRIPT_BUFSIZE ];
+
+ double nBoundingBox[4];
+
+ if ( pBuf && ImplGetBoundingBox( nBoundingBox, (BYTE*)pPtr, nSize ) )
+ {
+ double dM11 = nWidth / ( nBoundingBox[2] - nBoundingBox[0] );
+ double dM22 = nHeight / (nBoundingBox[1] - nBoundingBox[3] );
+ BYTE* pTemp = pBuf + 2; // +2 because we want to insert the size later
+ ImplWriteString( &pTemp, "\n\nsave\n[ " );
+ ImplWriteDouble( &pTemp, dM11 );
+ ImplWriteDouble( &pTemp, 0 );
+ ImplWriteDouble( &pTemp, 0 );
+ ImplWriteDouble( &pTemp, dM22 );
+ ImplWriteDouble( &pTemp, nX - ( dM11 * nBoundingBox[0] ) );
+ ImplWriteDouble( &pTemp, nY - ( dM22 * nBoundingBox[3] ) );
+ ImplWriteString( &pTemp, "] concat /showpage {} def\n" );
+ ImplWriteString( &pTemp, "%%BeginDocument:\n" );
+ *((USHORT*)pBuf) = (USHORT)( pTemp - pBuf - 2 );
+ Escape ( maGraphicsData.mhDC, nEscape, pTemp - pBuf, (LPTSTR)((BYTE*)pBuf), 0 );
+
+ ULONG nToDo = nSize;
+ ULONG nDoNow;
+ while ( nToDo )
+ {
+ nDoNow = nToDo;
+ if ( nToDo > POSTSCRIPT_BUFSIZE - 2 )
+ nDoNow = POSTSCRIPT_BUFSIZE - 2;
+ *((USHORT*)pBuf) = (USHORT)nDoNow;
+ memcpy( pBuf + 2, (BYTE*)pPtr + nSize - nToDo, nDoNow );
+ ULONG nResult = Escape ( maGraphicsData.mhDC, nEscape, nDoNow + 2, (LPTSTR)((BYTE*)pBuf), 0 );
+ if (!nResult )
+ break;
+ nToDo -= nResult;
+ }
+ pTemp = pBuf + 2;
+ ImplWriteString( &pTemp, "%%EndDocument\n" );
+ ImplWriteString( &pTemp, "restore\n\n" );
+ *((USHORT*)pBuf) = (USHORT)( pTemp - pBuf - 2 );
+ Escape ( maGraphicsData.mhDC, nEscape, pTemp - pBuf, (LPTSTR)((BYTE*)pBuf), 0 );
+ bRetValue = TRUE;
+ }
+ delete pBuf;
+ }
+ }
+
+ return bRetValue;
+}
diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx
new file mode 100644
index 000000000000..20252e35f31b
--- /dev/null
+++ b/vcl/win/source/gdi/salgdi2.cxx
@@ -0,0 +1,782 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <stdlib.h>
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#define _SV_SALGDI2_CXX
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALBMP_HXX
+#include <salbmp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+
+// =======================================================================
+
+BOOL bFastTransparent = FALSE;
+
+// =======================================================================
+
+void SalGraphics::CopyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics )
+{
+ HDC hSrcDC;
+ DWORD nRop;
+
+ if ( pSrcGraphics )
+ hSrcDC = pSrcGraphics->maGraphicsData.mhDC;
+ else
+ hSrcDC = maGraphicsData.mhDC;
+
+ if ( maGraphicsData.mbXORMode )
+ nRop = SRCINVERT;
+ else
+ nRop = SRCCOPY;
+
+ if ( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth) &&
+ (pPosAry->mnSrcHeight == pPosAry->mnDestHeight) )
+ {
+ BitBlt( maGraphicsData.mhDC,
+ (int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
+ (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+ hSrcDC,
+ (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
+ nRop );
+ }
+ else
+ {
+ int nOldStretchMode = SetStretchBltMode( maGraphicsData.mhDC, STRETCH_DELETESCANS );
+ StretchBlt( maGraphicsData.mhDC,
+ (int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
+ (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+ hSrcDC,
+ (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
+ (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight,
+ nRop );
+ SetStretchBltMode( maGraphicsData.mhDC, nOldStretchMode );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplCalcOutSideRgn( const RECT& rSrcRect,
+ int nLeft, int nTop, int nRight, int nBottom,
+ HRGN& rhInvalidateRgn )
+{
+ HRGN hTempRgn;
+
+ // Bereiche ausserhalb des sichtbaren Bereiches berechnen
+ if ( rSrcRect.left < nLeft )
+ {
+ if ( !rhInvalidateRgn )
+ rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
+ hTempRgn = CreateRectRgn( -31999, 0, nLeft, 31999 );
+ CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
+ DeleteRegion( hTempRgn );
+ }
+ if ( rSrcRect.top < nTop )
+ {
+ if ( !rhInvalidateRgn )
+ rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
+ hTempRgn = CreateRectRgn( 0, -31999, 31999, nTop );
+ CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
+ DeleteRegion( hTempRgn );
+ }
+ if ( rSrcRect.right > nRight )
+ {
+ if ( !rhInvalidateRgn )
+ rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
+ hTempRgn = CreateRectRgn( nRight, 0, 31999, 31999 );
+ CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
+ DeleteRegion( hTempRgn );
+ }
+ if ( rSrcRect.bottom > nBottom )
+ {
+ if ( !rhInvalidateRgn )
+ rhInvalidateRgn = CreateRectRgnIndirect( &rSrcRect );
+ hTempRgn = CreateRectRgn( 0, nBottom, 31999, 31999 );
+ CombineRgn( rhInvalidateRgn, rhInvalidateRgn, hTempRgn, RGN_DIFF );
+ DeleteRegion( hTempRgn );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::CopyArea( long nDestX, long nDestY,
+ long nSrcX, long nSrcY,
+ long nSrcWidth, long nSrcHeight,
+ USHORT nFlags )
+{
+ BitBlt( maGraphicsData.mhDC,
+ (int)nDestX, (int)nDestY,
+ (int)nSrcWidth, (int)nSrcHeight,
+ maGraphicsData.mhDC,
+ (int)nSrcX, (int)nSrcY,
+ SRCCOPY );
+
+ // Muessen die ueberlappenden Bereiche auch invalidiert werden?
+ if ( (nFlags & SAL_COPYAREA_WINDOWINVALIDATE) && maGraphicsData.mbWindow )
+ {
+ // Overlap-Bereich berechnen und invalidieren
+ RECT aSrcRect;
+ RECT aClipRect;
+ RECT aTempRect;
+ RECT aTempRect2;
+ HRGN hInvalidateRgn;
+ HRGN hTempRgn;
+ HWND hWnd;
+ int nRgnType;
+
+ aSrcRect.left = (int)nSrcX;
+ aSrcRect.top = (int)nSrcY;
+ aSrcRect.right = aSrcRect.left+(int)nSrcWidth;
+ aSrcRect.bottom = aSrcRect.top+(int)nSrcHeight;
+ GetClientRect( maGraphicsData.mhWnd, &aClipRect );
+ if ( IntersectRect( &aSrcRect, &aSrcRect, &aClipRect ) )
+ {
+ // Rechteck in Screen-Koordinaaten umrechnen
+ POINT aPt;
+ int nScreenDX = GetSystemMetrics( SM_CXSCREEN );
+ int nScreenDY = GetSystemMetrics( SM_CYSCREEN );
+ aPt.x = 0;
+ aPt.y = 0;
+ ClientToScreen( maGraphicsData.mhWnd, &aPt );
+ aSrcRect.left += aPt.x;
+ aSrcRect.top += aPt.y;
+ aSrcRect.right += aPt.x;
+ aSrcRect.bottom += aPt.y;
+ hInvalidateRgn = 0;
+ // Bereiche ausserhalb des sichtbaren Bereiches berechnen
+ ImplCalcOutSideRgn( aSrcRect, 0, 0, nScreenDX, nScreenDY, hInvalidateRgn );
+
+ // Bereiche die von anderen Fenstern ueberlagert werden berechnen
+ HRGN hTempRgn2 = 0;
+ HWND hWndTopWindow = maGraphicsData.mhWnd;
+ // Find the TopLevel Window, because only Windows which are in
+ // in the foreground of our TopLevel window must be considered
+ if ( GetWindowStyle( hWndTopWindow ) & WS_CHILD )
+ {
+ RECT aTempRect3 = aSrcRect;
+ do
+ {
+ hWndTopWindow = ::GetParent( hWndTopWindow );
+
+ // Test, if the Parent clip our window
+ GetClientRect( hWndTopWindow, &aTempRect );
+ POINT aPt2;
+ aPt2.x = 0;
+ aPt2.y = 0;
+ ClientToScreen( hWndTopWindow, &aPt2 );
+ aTempRect.left += aPt2.x;
+ aTempRect.top += aPt2.y;
+ aTempRect.right += aPt2.x;
+ aTempRect.bottom += aPt2.y;
+ IntersectRect( &aTempRect3, &aTempRect3, &aTempRect );
+ }
+ while ( GetWindowStyle( hWndTopWindow ) & WS_CHILD );
+
+ // If one or more Parents clip our window, than we must
+ // calculate the outside area
+ if ( !EqualRect( &aSrcRect, &aTempRect3 ) )
+ {
+ ImplCalcOutSideRgn( aSrcRect,
+ aTempRect3.left, aTempRect3.top,
+ aTempRect3.right, aTempRect3.bottom,
+ hInvalidateRgn );
+ }
+ }
+ hWnd = GetWindow( GetDesktopWindow(), GW_CHILD );
+ while ( hWnd )
+ {
+ if ( hWnd == hWndTopWindow )
+ break;
+ if ( IsWindowVisible( hWnd ) && !IsIconic( hWnd ) )
+ {
+ GetWindowRect( hWnd, &aTempRect );
+ if ( IntersectRect( &aTempRect2, &aSrcRect, &aTempRect ) )
+ {
+ if ( !hInvalidateRgn )
+ hInvalidateRgn = CreateRectRgnIndirect( &aSrcRect );
+ hTempRgn = CreateRectRgnIndirect( &aTempRect );
+ if ( !hTempRgn2 )
+ hTempRgn2 = CreateRectRgn( 0, 0, 0, 0 );
+ nRgnType = GetWindowRgn( hWnd, hTempRgn2 );
+ if ( (nRgnType != ERROR) && (nRgnType != NULLREGION) )
+ {
+ OffsetRgn( hTempRgn2, aTempRect.left, aTempRect.top );
+ CombineRgn( hTempRgn, hTempRgn, hTempRgn2, RGN_AND );
+ }
+ CombineRgn( hInvalidateRgn, hInvalidateRgn, hTempRgn, RGN_DIFF );
+ DeleteRegion( hTempRgn );
+ }
+ }
+ hWnd = GetWindow( hWnd, GW_HWNDNEXT );
+ }
+ if ( hTempRgn2 )
+ DeleteRegion( hTempRgn2 );
+ if ( hInvalidateRgn )
+ {
+ hTempRgn = CreateRectRgnIndirect( &aSrcRect );
+ nRgnType = CombineRgn( hInvalidateRgn, hTempRgn, hInvalidateRgn, RGN_DIFF );
+ if ( (nRgnType != ERROR) && (nRgnType != NULLREGION) )
+ {
+ int nOffX = (int)(nDestX-nSrcX);
+ int nOffY = (int)(nDestY-nSrcY);
+ OffsetRgn( hInvalidateRgn, nOffX-aPt.x, nOffY-aPt.y );
+ // Combine Invalidate Region with existing ClipRegion
+ if ( GetClipRgn( maGraphicsData.mhDC, hTempRgn ) == 1 )
+ nRgnType = CombineRgn( hInvalidateRgn, hTempRgn, hInvalidateRgn, RGN_AND );
+ if ( (nRgnType != ERROR) && (nRgnType != NULLREGION) )
+ {
+ InvalidateRgn( maGraphicsData.mhWnd, hInvalidateRgn, TRUE );
+ // Hier loesen wir nur ein Update aus, wenn es der
+ // MainThread ist, damit es beim Bearbeiten der
+ // Paint-Message keinen Deadlock gibt, da der
+ // SolarMutex durch diesen Thread schon gelockt ist
+ SalData* pSalData = GetSalData();
+ DWORD nCurThreadId = GetCurrentThreadId();
+ if ( pSalData->mnAppThreadId == nCurThreadId )
+ UpdateWindow( maGraphicsData.mhWnd );
+ }
+ }
+ DeleteRegion( hTempRgn );
+ DeleteRegion( hInvalidateRgn );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplDrawBitmap( HDC hDC,
+ const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap,
+ BOOL bPrinter, int nDrawMode )
+{
+ if( hDC )
+ {
+ HGLOBAL hDrawDIB;
+ HBITMAP hDrawDDB = rSalBitmap.ImplGethDDB();
+ SalBitmap* pTmpSalBmp;
+ BOOL bPrintDDB = ( bPrinter && hDrawDDB );
+
+ if( bPrintDDB )
+ {
+ pTmpSalBmp = new SalBitmap;
+ pTmpSalBmp->Create( rSalBitmap, rSalBitmap.GetBitCount() );
+ hDrawDIB = pTmpSalBmp->ImplGethDIB();
+ }
+ else
+ hDrawDIB = rSalBitmap.ImplGethDIB();
+
+ if( hDrawDIB )
+ {
+ PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDrawDIB );
+ PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+ PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
+ rSalBitmap.ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD );
+ const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS );
+
+ int nCount = StretchDIBits( hDC,
+ (int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
+ (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+ (int)pPosAry->mnSrcX, (int)(pBIH->biHeight - pPosAry->mnSrcHeight - pPosAry->mnSrcY),
+ (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight,
+ pBits, pBI, DIB_RGB_COLORS, nDrawMode );
+
+ GlobalUnlock( hDrawDIB );
+ SetStretchBltMode( hDC, nOldStretchMode );
+ }
+ else if( hDrawDDB && !bPrintDDB )
+ {
+ HDC hBmpDC = ImplGetCachedDC( CACHED_HDC_DRAW, hDrawDDB );
+ COLORREF nOldBkColor;
+ COLORREF nOldTextColor;
+ BOOL bMono = ( rSalBitmap.GetBitCount() == 1 );
+
+ if( bMono )
+ {
+ nOldBkColor = SetBkColor( hDC, RGB( 0xFF, 0xFF, 0xFF ) );
+ nOldTextColor = ::SetTextColor( hDC, RGB( 0x00, 0x00, 0x00 ) );
+ }
+
+ if ( (pPosAry->mnSrcWidth == pPosAry->mnDestWidth) &&
+ (pPosAry->mnSrcHeight == pPosAry->mnDestHeight) )
+ {
+ BitBlt( hDC,
+ (int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
+ (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+ hBmpDC,
+ (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
+ nDrawMode );
+ }
+ else
+ {
+ const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS );
+
+ StretchBlt( hDC,
+ (int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
+ (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+ hBmpDC,
+ (int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
+ (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight,
+ nDrawMode );
+
+ SetStretchBltMode( hDC, nOldStretchMode );
+ }
+
+ if( bMono )
+ {
+ SetBkColor( hDC, nOldBkColor );
+ ::SetTextColor( hDC, nOldTextColor );
+ }
+
+ ImplReleaseCachedDC( CACHED_HDC_DRAW );
+ }
+
+ if( bPrintDDB )
+ delete pTmpSalBmp;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap )
+{
+ ImplDrawBitmap( maGraphicsData.mhDC, pPosAry, rSalBitmap,
+ maGraphicsData.mbPrinter,
+ maGraphicsData.mbXORMode ? SRCINVERT : SRCCOPY );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ SalColor nTransparentColor )
+{
+ DBG_ASSERT( !maGraphicsData.mbPrinter, "No transparency print possible!" );
+
+ SalBitmap* pMask = new SalBitmap;
+ HDC hDC = maGraphicsData.mhDC;
+ const Point aPoint;
+ const Size aSize( rSalBitmap.GetSize() );
+ HBITMAP hMaskBitmap = CreateBitmap( (int) aSize.Width(), (int) aSize.Height(), 1, 1, NULL );
+ HDC hMaskDC = ImplGetCachedDC( CACHED_HDC_1, hMaskBitmap );
+ const BYTE cRed = SALCOLOR_RED( nTransparentColor );
+ const BYTE cGreen = SALCOLOR_GREEN( nTransparentColor );
+ const BYTE cBlue = SALCOLOR_BLUE( nTransparentColor );
+
+ if( rSalBitmap.ImplGethDDB() )
+ {
+ HDC hSrcDC = ImplGetCachedDC( CACHED_HDC_2, rSalBitmap.ImplGethDDB() );
+ COLORREF aOldCol = SetBkColor( hSrcDC, RGB( cRed, cGreen, cBlue ) );
+
+ BitBlt( hMaskDC, 0, 0, (int) aSize.Width(), (int) aSize.Height(), hSrcDC, 0, 0, SRCCOPY );
+
+ SetBkColor( hSrcDC, aOldCol );
+ ImplReleaseCachedDC( CACHED_HDC_2 );
+ }
+ else
+ {
+ SalBitmap* pTmpSalBmp = new SalBitmap;
+
+ if( pTmpSalBmp->Create( rSalBitmap, this ) )
+ {
+ HDC hSrcDC = ImplGetCachedDC( CACHED_HDC_2, pTmpSalBmp->ImplGethDDB() );
+ COLORREF aOldCol = SetBkColor( hSrcDC, RGB( cRed, cGreen, cBlue ) );
+
+ BitBlt( hMaskDC, 0, 0, (int) aSize.Width(), (int) aSize.Height(), hSrcDC, 0, 0, SRCCOPY );
+
+ SetBkColor( hSrcDC, aOldCol );
+ ImplReleaseCachedDC( CACHED_HDC_2 );
+ }
+
+ delete pTmpSalBmp;
+ }
+
+ ImplReleaseCachedDC( CACHED_HDC_1 );
+
+ // hMaskBitmap is destroyed by new SalBitmap 'pMask' ( bDIB==FALSE, bCopy == FALSE )
+ if( pMask->Create( hMaskBitmap, FALSE, FALSE ) )
+ DrawBitmap( pPosAry, rSalBitmap, *pMask );
+
+ delete pMask;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ const SalBitmap& rTransparentBitmap )
+{
+ DBG_ASSERT( !maGraphicsData.mbPrinter, "No transparency print possible!" );
+
+ if( bFastTransparent )
+ {
+ // bei Paletten-Displays hat WIN/WNT offenbar ein kleines Problem,
+ // die Farben der Maske richtig auf die Palette abzubilden,
+ // wenn wir die DIB direkt ausgeben => DDB-Ausgabe
+ if( ( GetBitCount() <= 8 ) && rTransparentBitmap.ImplGethDIB() && rTransparentBitmap.GetBitCount() == 1 )
+ {
+ SalBitmap aTmp;
+ if( aTmp.Create( rTransparentBitmap, this ) )
+ ImplDrawBitmap( maGraphicsData.mhDC, pPosAry, aTmp, FALSE, SRCAND );
+ }
+ else
+ ImplDrawBitmap( maGraphicsData.mhDC, pPosAry, rTransparentBitmap, FALSE, SRCAND );
+
+ // bei Paletten-Displays hat WIN/WNT offenbar ein kleines Problem,
+ // die Farben der Maske richtig auf die Palette abzubilden,
+ // wenn wir die DIB direkt ausgeben => DDB-Ausgabe
+ if( ( GetBitCount() <= 8 ) && rSalBitmap.ImplGethDIB() && rSalBitmap.GetBitCount() == 1 )
+ {
+ SalBitmap aTmp;
+ if( aTmp.Create( rSalBitmap, this ) )
+ ImplDrawBitmap( maGraphicsData.mhDC, pPosAry, aTmp, FALSE, SRCPAINT );
+ }
+ else
+ ImplDrawBitmap( maGraphicsData.mhDC, pPosAry, rSalBitmap, FALSE, SRCPAINT );
+ }
+ else
+ {
+ SalTwoRect aPosAry = *pPosAry;
+ int nDstX = (int)aPosAry.mnDestX;
+ int nDstY = (int)aPosAry.mnDestY;
+ int nDstWidth = (int)aPosAry.mnDestWidth;
+ int nDstHeight = (int)aPosAry.mnDestHeight;
+ HDC hDC = maGraphicsData.mhDC;
+ HBITMAP hMemBitmap = 0;
+ HBITMAP hMaskBitmap = 0;
+
+ if( ( nDstWidth > CACHED_HDC_DEFEXT ) || ( nDstHeight > CACHED_HDC_DEFEXT ) )
+ {
+ hMemBitmap = CreateCompatibleBitmap( hDC, nDstWidth, nDstHeight );
+ hMaskBitmap = CreateCompatibleBitmap( hDC, nDstWidth, nDstHeight );
+ }
+
+ HDC hMemDC = ImplGetCachedDC( CACHED_HDC_1, hMemBitmap );
+ HDC hMaskDC = ImplGetCachedDC( CACHED_HDC_2, hMaskBitmap );
+
+ aPosAry.mnDestX = aPosAry.mnDestY = 0;
+ BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hDC, nDstX, nDstY, SRCCOPY );
+
+ // bei Paletten-Displays hat WIN/WNT offenbar ein kleines Problem,
+ // die Farben der Maske richtig auf die Palette abzubilden,
+ // wenn wir die DIB direkt ausgeben => DDB-Ausgabe
+ if( ( GetBitCount() <= 8 ) && rTransparentBitmap.ImplGethDIB() && rTransparentBitmap.GetBitCount() == 1 )
+ {
+ SalBitmap aTmp;
+
+ if( aTmp.Create( rTransparentBitmap, this ) )
+ ImplDrawBitmap( hMaskDC, &aPosAry, aTmp, FALSE, SRCCOPY );
+ }
+ else
+ ImplDrawBitmap( hMaskDC, &aPosAry, rTransparentBitmap, FALSE, SRCCOPY );
+
+ BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCAND );
+ ImplDrawBitmap( hMaskDC, &aPosAry, rSalBitmap, FALSE, SRCERASE );
+ BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCPAINT );
+ BitBlt( hDC, nDstX, nDstY, nDstWidth, nDstHeight, hMemDC, 0, 0, SRCCOPY );
+
+ ImplReleaseCachedDC( CACHED_HDC_1 );
+ ImplReleaseCachedDC( CACHED_HDC_2 );
+
+ // hMemBitmap != 0 ==> hMaskBitmap != 0
+ if( hMemBitmap )
+ {
+ DeleteObject( hMemBitmap );
+ DeleteObject( hMaskBitmap );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawMask( const SalTwoRect* pPosAry,
+ const SalBitmap& rSalBitmap,
+ SalColor nMaskColor )
+{
+ DBG_ASSERT( !maGraphicsData.mbPrinter, "No transparency print possible!" );
+
+ SalTwoRect aPosAry = *pPosAry;
+ const BYTE cRed = SALCOLOR_RED( nMaskColor );
+ const BYTE cGreen = SALCOLOR_GREEN( nMaskColor );
+ const BYTE cBlue = SALCOLOR_BLUE( nMaskColor );
+ HDC hDC = maGraphicsData.mhDC;
+ HBRUSH hMaskBrush = CreateSolidBrush( RGB( cRed, cGreen, cBlue ) );
+ HBRUSH hOldBrush = SelectBrush( hDC, hMaskBrush );
+
+ // bei Paletten-Displays hat WIN/WNT offenbar ein kleines Problem,
+ // die Farben der Maske richtig auf die Palette abzubilden,
+ // wenn wir die DIB direkt ausgeben => DDB-Ausgabe
+ if( ( GetBitCount() <= 8 ) && rSalBitmap.ImplGethDIB() && rSalBitmap.GetBitCount() == 1 )
+ {
+ SalBitmap aTmp;
+
+ if( aTmp.Create( rSalBitmap, this ) )
+ ImplDrawBitmap( hDC, &aPosAry, aTmp, FALSE, 0x00B8074AUL );
+ }
+ else
+ ImplDrawBitmap( hDC, &aPosAry, rSalBitmap, FALSE, 0x00B8074AUL );
+
+ SelectBrush( hDC, hOldBrush );
+ DeleteBrush( hMaskBrush );
+}
+
+// -----------------------------------------------------------------------
+
+SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nDX, long nDY )
+{
+ DBG_ASSERT( !maGraphicsData.mbPrinter, "No ::GetBitmap() from printer possible!" );
+
+ SalBitmap* pSalBitmap = NULL;
+
+ nDX = labs( nDX );
+ nDY = labs( nDY );
+
+ HDC hDC = maGraphicsData.mhDC;
+ HBITMAP hBmpBitmap = CreateCompatibleBitmap( hDC, nDX, nDY );
+ HDC hBmpDC = ImplGetCachedDC( CACHED_HDC_1, hBmpBitmap );
+ BOOL bRet;
+
+ bRet = BitBlt( hBmpDC, 0, 0, (int) nDX, (int) nDY, hDC, (int) nX, (int) nY, SRCCOPY );
+ ImplReleaseCachedDC( CACHED_HDC_1 );
+
+ if( bRet )
+ {
+ pSalBitmap = new SalBitmap;
+
+ if( !pSalBitmap->Create( hBmpBitmap, FALSE, FALSE ) )
+ {
+ delete pSalBitmap;
+ pSalBitmap = NULL;
+ }
+ }
+
+ return pSalBitmap;
+}
+
+// -----------------------------------------------------------------------
+
+SalColor SalGraphics::GetPixel( long nX, long nY )
+{
+ COLORREF aWinCol = ::GetPixel( maGraphicsData.mhDC, (int) nX, (int) nY );
+
+#ifdef WIN
+ if ( -1 == aWinCol )
+#else
+ if ( CLR_INVALID == aWinCol )
+#endif
+ return MAKE_SALCOLOR( 0, 0, 0 );
+ else
+ return MAKE_SALCOLOR( GetRValue( aWinCol ),
+ GetGValue( aWinCol ),
+ GetBValue( aWinCol ) );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags )
+{
+ if ( nFlags & SAL_INVERT_TRACKFRAME )
+ {
+ HPEN hDotPen = CreatePen( PS_DOT, 0, 0 );
+ HPEN hOldPen = SelectPen( maGraphicsData.mhDC, hDotPen );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, GetStockBrush( NULL_BRUSH ) );
+ int nOldROP = SetROP2( maGraphicsData.mhDC, R2_NOT );
+
+ WIN_Rectangle( maGraphicsData.mhDC, (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
+
+ SetROP2( maGraphicsData.mhDC, nOldROP );
+ SelectPen( maGraphicsData.mhDC, hOldPen );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ DeletePen( hDotPen );
+ }
+ else if ( nFlags & SAL_INVERT_50 )
+ {
+ SalData* pSalData = GetSalData();
+ if ( !pSalData->mh50Brush )
+ {
+ if ( !pSalData->mh50Bmp )
+ pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
+ pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
+ }
+
+ COLORREF nOldTextColor = ::SetTextColor( maGraphicsData.mhDC, 0 );
+ HBRUSH hOldBrush = SelectBrush( maGraphicsData.mhDC, pSalData->mh50Brush );
+ PatBlt( maGraphicsData.mhDC, nX, nY, nWidth, nHeight, PATINVERT );
+ ::SetTextColor( maGraphicsData.mhDC, nOldTextColor );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ }
+ else
+ {
+ RECT aRect;
+ aRect.left = (int)nX;
+ aRect.top = (int)nY;
+ aRect.right = (int)nX+nWidth;
+ aRect.bottom = (int)nY+nHeight;
+ ::InvertRect( maGraphicsData.mhDC, &aRect );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nSalFlags )
+{
+ HPEN hPen;
+ HPEN hOldPen;
+ HBRUSH hBrush;
+ HBRUSH hOldBrush;
+ COLORREF nOldTextColor;
+ int nOldROP = SetROP2( maGraphicsData.mhDC, R2_NOT );
+
+ if ( nSalFlags & SAL_INVERT_TRACKFRAME )
+ hPen = CreatePen( PS_DOT, 0, 0 );
+ else
+ {
+
+ if ( nSalFlags & SAL_INVERT_50 )
+ {
+ SalData* pSalData = GetSalData();
+ if ( !pSalData->mh50Brush )
+ {
+ if ( !pSalData->mh50Bmp )
+ pSalData->mh50Bmp = ImplLoadSalBitmap( SAL_RESID_BITMAP_50 );
+ pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
+ }
+
+ hBrush = pSalData->mh50Brush;
+ }
+ else
+ hBrush = GetStockBrush( BLACK_BRUSH );
+
+ hPen = GetStockPen( NULL_PEN );
+ nOldTextColor = ::SetTextColor( maGraphicsData.mhDC, 0 );
+ hOldBrush = SelectBrush( maGraphicsData.mhDC, hBrush );
+ }
+ hOldPen = SelectPen( maGraphicsData.mhDC, hPen );
+
+ POINT* pWinPtAry;
+#ifdef WIN
+ if ( nPoints > MAX_64KSALPOINTS )
+ nPoints = MAX_64KSALPOINTS;
+
+ pWinPtAry = new POINT[(USHORT)nPoints];
+ const SalPoint huge* pHugePtAry = (const SalPoint huge*)pPtAry;
+ for( USHORT i=0; i < (USHORT)nPoints ; i++ )
+ {
+ pWinPtAry[i].x = (int)pHugePtAry[i].mnX;
+ pWinPtAry[i].y = (int)pHugePtAry[i].mnY;
+ }
+ if ( nSalFlags & SAL_INVERT_TRACKFRAME )
+ Polyline( maGraphicsData.mhDC, pWinPtAry, (int)nPoints );
+ else
+ WIN_Polygon( maGraphicsData.mhDC, pWinPtAry, (int)nPoints );
+ delete pWinPtAry;
+#else
+ // Unter NT koennen wir das Array direkt weiterreichen
+ DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
+ "SalGraphics::DrawPolyLine(): POINT != SalPoint" );
+
+ pWinPtAry = (POINT*)pPtAry;
+ // Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl
+ // von Punkten
+ if ( nSalFlags & SAL_INVERT_TRACKFRAME )
+ {
+ if ( !Polyline( maGraphicsData.mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+ Polyline( maGraphicsData.mhDC, pWinPtAry, MAX_64KSALPOINTS );
+ }
+ else
+ {
+ if ( !WIN_Polygon( maGraphicsData.mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+ WIN_Polygon( maGraphicsData.mhDC, pWinPtAry, MAX_64KSALPOINTS );
+ }
+#endif
+
+ SetROP2( maGraphicsData.mhDC, nOldROP );
+ SelectPen( maGraphicsData.mhDC, hOldPen );
+
+ if ( nSalFlags & SAL_INVERT_TRACKFRAME )
+ DeletePen( hPen );
+ else
+ {
+ ::SetTextColor( maGraphicsData.mhDC, nOldTextColor );
+ SelectBrush( maGraphicsData.mhDC, hOldBrush );
+ }
+}
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
new file mode 100644
index 000000000000..aa6b4c347090
--- /dev/null
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -0,0 +1,1531 @@
+/*************************************************************************
+ *
+ * $RCSfile: salgdi3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALGDI3_CXX
+
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_OUTFONT_HXX
+#include <outfont.hxx>
+#endif
+#ifndef _SV_FONT_HXX
+#include <font.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// -----------
+// - Defines -
+// -----------
+
+#ifdef WIN
+#define GDI_ERROR (0xFFFFFFFFUL)
+#endif
+
+#define GLYPH_INC (512UL)
+#define MAX_POLYCOUNT (2048UL)
+#define CHECKPOINTS( _def_nPnt ) \
+ if( (_def_nPnt) >= nPtSize ) \
+ nPtSize = ImplIncreaseArrays( nPtSize, &pPoints, &pFlags, GLYPH_INC )
+
+// -----------
+// - Inlines -
+// -----------
+
+inline FIXED FixedFromDouble( double d )
+{
+ const long l = (long) ( d * 65536. );
+ return *(FIXED*) &l;
+}
+
+// -----------------------------------------------------------------------
+
+inline int IntFromFixed(FIXED f)
+{
+ return( ( f.fract >= 0x8000 ) ? ( f.value + 1 ) : f.value );
+}
+
+// -----------------------------------------------------------------------
+
+inline FIXED fxDiv2( FIXED fxVal1, FIXED fxVal2 )
+{
+ const long l = (*((long far *)&(fxVal1)) + *((long far *)&(fxVal2))) >> 1;
+ return *(FIXED*) &l;
+}
+
+// =======================================================================
+
+#define SAL_DRAWTEXT_STACKBUF 128
+
+// =======================================================================
+
+// Diese Variablen koennen static sein, da systemweite Einstellungen
+// gemerkt werden
+static BOOL bImplSalCourierScalable = FALSE;
+static BOOL bImplSalCourierNew = FALSE;
+
+// =======================================================================
+
+struct ImplEnumInfo
+{
+ HDC mhDC;
+ ImplDevFontList* mpList;
+ XubString* mpName;
+ LOGFONTA* mpLogFontA;
+ LOGFONTW* mpLogFontW;
+ BOOL mbCourier;
+ BOOL mbImplSalCourierScalable;
+ BOOL mbImplSalCourierNew;
+ BOOL mbPrinter;
+};
+
+// =======================================================================
+
+static CharSet ImplCharSetToSal( BYTE nCharSet )
+{
+ if ( nCharSet == OEM_CHARSET )
+ {
+ UINT nCP = (USHORT)GetOEMCP();
+ return rtl_getTextEncodingFromPCCodePage( nCP );
+ }
+ else
+ return rtl_getTextEncodingFromWindowsCharset( nCharSet );
+}
+
+// -----------------------------------------------------------------------
+
+static BYTE ImplCharSetToWin( CharSet eCharSet )
+{
+ return rtl_getBestWindowsCharsetFromTextEncoding( eCharSet );
+}
+
+// -----------------------------------------------------------------------
+
+static FontFamily ImplFamilyToSal( BYTE nFamily )
+{
+ switch ( nFamily & 0xF0 )
+ {
+ case FF_DECORATIVE:
+ return FAMILY_DECORATIVE;
+
+ case FF_MODERN:
+ return FAMILY_MODERN;
+
+ case FF_ROMAN:
+ return FAMILY_ROMAN;
+
+ case FF_SCRIPT:
+ return FAMILY_SCRIPT;
+
+ case FF_SWISS:
+ return FAMILY_SWISS;
+ }
+
+ return FAMILY_DONTKNOW;
+}
+
+// -----------------------------------------------------------------------
+
+static BYTE ImplFamilyToWin( FontFamily eFamily )
+{
+ switch ( eFamily )
+ {
+ case FAMILY_DECORATIVE:
+ return FF_DECORATIVE;
+
+ case FAMILY_MODERN:
+ return FF_MODERN;
+
+ case FAMILY_ROMAN:
+ return FF_ROMAN;
+
+ case FAMILY_SCRIPT:
+ return FF_SCRIPT;
+
+ case FAMILY_SWISS:
+ return FF_SWISS;
+
+ case FAMILY_SYSTEM:
+ return FF_SWISS;
+ }
+
+ return FF_DONTCARE;
+}
+
+// -----------------------------------------------------------------------
+
+static FontWeight ImplWeightToSal( WinWeight nWeight )
+{
+ if ( nWeight <= FW_THIN )
+ return WEIGHT_THIN;
+ else if ( nWeight <= FW_ULTRALIGHT )
+ return WEIGHT_ULTRALIGHT;
+ else if ( nWeight <= FW_LIGHT )
+ return WEIGHT_LIGHT;
+ else if ( nWeight < FW_MEDIUM )
+ return WEIGHT_NORMAL;
+ else if ( nWeight == FW_MEDIUM )
+ return WEIGHT_MEDIUM;
+ else if ( nWeight <= FW_SEMIBOLD )
+ return WEIGHT_SEMIBOLD;
+ else if ( nWeight <= FW_BOLD )
+ return WEIGHT_BOLD;
+ else if ( nWeight <= FW_ULTRABOLD )
+ return WEIGHT_ULTRABOLD;
+ else
+ return WEIGHT_BLACK;
+}
+
+// -----------------------------------------------------------------------
+
+static WinWeight ImplWeightToWin( FontWeight eWeight )
+{
+ switch ( eWeight )
+ {
+ case WEIGHT_THIN:
+ return FW_THIN;
+
+ case WEIGHT_ULTRALIGHT:
+ return FW_ULTRALIGHT;
+
+ case WEIGHT_LIGHT:
+ return FW_LIGHT;
+
+ case WEIGHT_SEMILIGHT:
+ case WEIGHT_NORMAL:
+ return FW_NORMAL;
+
+ case WEIGHT_MEDIUM:
+ return FW_MEDIUM;
+
+ case WEIGHT_SEMIBOLD:
+ return FW_SEMIBOLD;
+
+ case WEIGHT_BOLD:
+ return FW_BOLD;
+
+ case WEIGHT_ULTRABOLD:
+ return FW_ULTRABOLD;
+
+ case WEIGHT_BLACK:
+ return FW_BLACK;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+inline FontPitch ImplLogPitchToSal( BYTE nPitch )
+{
+ if ( nPitch & FIXED_PITCH )
+ return PITCH_FIXED;
+ else
+ return PITCH_VARIABLE;
+}
+
+// -----------------------------------------------------------------------
+
+inline FontPitch ImplMetricPitchToSal( BYTE nPitch )
+{
+ // Sausaecke bei MS !! siehe NT Hilfe
+ if ( !(nPitch & TMPF_FIXED_PITCH) )
+ return PITCH_FIXED;
+ else
+ return PITCH_VARIABLE;
+}
+
+// -----------------------------------------------------------------------
+
+inline BYTE ImplPitchToWin( FontPitch ePitch )
+{
+ if ( ePitch == PITCH_FIXED )
+ return FIXED_PITCH;
+ else if ( ePitch == PITCH_VARIABLE )
+ return VARIABLE_PITCH;
+ else
+ return DEFAULT_PITCH;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplLogMetricToDevFontDataA( const LOGFONTA* pLogFont,
+ const NEWTEXTMETRICA* pMetric,
+ DWORD nFontType,
+ ImplFontData* pData )
+{
+ if ( !(nFontType & RASTER_FONTTYPE) )
+ {
+ pData->mnWidth = 0;
+ pData->mnHeight = 0;
+ }
+ else
+ {
+ pData->mnWidth = 0;
+ pData->mnHeight = pMetric->tmHeight-pMetric->tmInternalLeading;
+ }
+ pData->meFamily = ImplFamilyToSal( pLogFont->lfPitchAndFamily );
+ pData->meCharSet = ImplCharSetToSal( pLogFont->lfCharSet );
+ pData->meWidthType = WIDTH_DONTKNOW;
+ pData->meWeight = ImplWeightToSal( pLogFont->lfWeight );
+ pData->meItalic = (pLogFont->lfItalic) ? ITALIC_NORMAL : ITALIC_NONE;
+ pData->mePitch = ImplLogPitchToSal( pLogFont->lfPitchAndFamily );
+ if ( pMetric->tmPitchAndFamily & (TMPF_VECTOR | TMPF_TRUETYPE) )
+ pData->meType = TYPE_SCALABLE;
+ else
+ pData->meType = TYPE_RASTER;
+ pData->mbOrientation = (nFontType & RASTER_FONTTYPE) == 0;
+ pData->mbDevice = (pMetric->tmPitchAndFamily & TMPF_DEVICE) != 0;
+ pData->mnQuality = 0;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplLogMetricToDevFontDataW( const LOGFONTW* pLogFont,
+ const NEWTEXTMETRICW* pMetric,
+ DWORD nFontType,
+ ImplFontData* pData )
+{
+ if ( !(nFontType & RASTER_FONTTYPE) )
+ {
+ pData->mnWidth = 0;
+ pData->mnHeight = 0;
+ }
+ else
+ {
+ pData->mnWidth = 0;
+ pData->mnHeight = pMetric->tmHeight-pMetric->tmInternalLeading;
+ }
+ pData->meFamily = ImplFamilyToSal( pLogFont->lfPitchAndFamily );
+ pData->meCharSet = ImplCharSetToSal( pLogFont->lfCharSet );
+ pData->meWidthType = WIDTH_DONTKNOW;
+ pData->meWeight = ImplWeightToSal( pLogFont->lfWeight );
+ pData->meItalic = (pLogFont->lfItalic) ? ITALIC_NORMAL : ITALIC_NONE;
+ pData->mePitch = ImplLogPitchToSal( pLogFont->lfPitchAndFamily );
+ if ( pMetric->tmPitchAndFamily & (TMPF_VECTOR | TMPF_TRUETYPE) )
+ pData->meType = TYPE_SCALABLE;
+ else
+ pData->meType = TYPE_RASTER;
+ pData->mbOrientation = (nFontType & RASTER_FONTTYPE) == 0;
+ pData->mbDevice = (pMetric->tmPitchAndFamily & TMPF_DEVICE) != 0;
+ pData->mnQuality = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalLogFontToFontA( const LOGFONTA& rLogFont, Font& rFont )
+{
+ XubString aFontName( ImplSalGetUniString( rLogFont.lfFaceName ) );
+ if ( aFontName.Len() )
+ {
+ rFont.SetName( aFontName );
+ long nFontHeight = rLogFont.lfHeight;
+ if ( nFontHeight < 0 )
+ nFontHeight = -nFontHeight;
+ HDC hDC = GetDC( 0 );
+ long nDPIY = GetDeviceCaps( hDC, LOGPIXELSY );
+ ReleaseDC( 0, hDC );
+ nFontHeight *= 72;
+ nFontHeight += nDPIY/2;
+ nFontHeight /= nDPIY;
+ rFont.SetSize( Size( 0, nFontHeight ) );
+ rFont.SetOrientation( (short)rLogFont.lfEscapement );
+ rFont.SetCharSet( ImplCharSetToSal( rLogFont.lfCharSet ) );
+ rFont.SetFamily( ImplFamilyToSal( rLogFont.lfPitchAndFamily ) );
+ rFont.SetPitch( ImplLogPitchToSal( rLogFont.lfPitchAndFamily ) );
+ rFont.SetWeight( ImplWeightToSal( rLogFont.lfWeight ) );
+ if ( rLogFont.lfItalic )
+ rFont.SetItalic( ITALIC_NORMAL );
+ else
+ rFont.SetItalic( ITALIC_NONE );
+ if ( rLogFont.lfUnderline )
+ rFont.SetUnderline( UNDERLINE_SINGLE );
+ else
+ rFont.SetUnderline( UNDERLINE_NONE );
+ if ( rLogFont.lfStrikeOut )
+ rFont.SetStrikeout( STRIKEOUT_SINGLE );
+ else
+ rFont.SetStrikeout( STRIKEOUT_NONE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalLogFontToFontW( const LOGFONTW& rLogFont, Font& rFont )
+{
+ XubString aFontName( rLogFont.lfFaceName );
+ if ( aFontName.Len() )
+ {
+ rFont.SetName( aFontName );
+ long nFontHeight = rLogFont.lfHeight;
+ if ( nFontHeight < 0 )
+ nFontHeight = -nFontHeight;
+ HDC hDC = GetDC( 0 );
+ long nDPIY = GetDeviceCaps( hDC, LOGPIXELSY );
+ ReleaseDC( 0, hDC );
+ nFontHeight *= 72;
+ nFontHeight += nDPIY/2;
+ nFontHeight /= nDPIY;
+ rFont.SetSize( Size( 0, nFontHeight ) );
+ rFont.SetOrientation( (short)rLogFont.lfEscapement );
+ rFont.SetCharSet( ImplCharSetToSal( rLogFont.lfCharSet ) );
+ rFont.SetFamily( ImplFamilyToSal( rLogFont.lfPitchAndFamily ) );
+ rFont.SetPitch( ImplLogPitchToSal( rLogFont.lfPitchAndFamily ) );
+ rFont.SetWeight( ImplWeightToSal( rLogFont.lfWeight ) );
+ if ( rLogFont.lfItalic )
+ rFont.SetItalic( ITALIC_NORMAL );
+ else
+ rFont.SetItalic( ITALIC_NONE );
+ if ( rLogFont.lfUnderline )
+ rFont.SetUnderline( UNDERLINE_SINGLE );
+ else
+ rFont.SetUnderline( UNDERLINE_NONE );
+ if ( rLogFont.lfStrikeOut )
+ rFont.SetStrikeout( STRIKEOUT_SINGLE );
+ else
+ rFont.SetStrikeout( STRIKEOUT_NONE );
+ }
+}
+
+// =======================================================================
+
+void SalGraphics::SetTextColor( SalColor nSalColor )
+{
+ COLORREF aCol = PALETTERGB( SALCOLOR_RED( nSalColor ),
+ SALCOLOR_GREEN( nSalColor ),
+ SALCOLOR_BLUE( nSalColor ) );
+
+ if( !maGraphicsData.mbPrinter &&
+ GetSalData()->mhDitherPal &&
+ ImplIsSysColorEntry( nSalColor ) )
+ {
+ aCol = PALRGB_TO_RGB( aCol );
+ }
+
+ ::SetTextColor( maGraphicsData.mhDC, aCol );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalGraphics::SetFont( ImplFontSelectData* pFont )
+{
+ HFONT hNewFont;
+ if ( aSalShlData.mbWNT )
+ {
+ LOGFONTW aLogFont;
+ UniString aName;
+ if ( pFont->mpFontData )
+ aName = pFont->mpFontData->maName;
+ else
+ aName = pFont->maName.GetToken( 0 );
+
+ UINT nNameLen = aName.Len();
+ if ( nNameLen > (sizeof( aLogFont.lfFaceName )/sizeof( wchar_t ))-1 )
+ nNameLen = (sizeof( aLogFont.lfFaceName )/sizeof( wchar_t ))-1;
+ memcpy( aLogFont.lfFaceName, aName.GetBuffer(), nNameLen*sizeof( wchar_t ) );
+ aLogFont.lfFaceName[nNameLen] = 0;
+ if ( pFont->mpFontData &&
+ ((pFont->meCharSet == RTL_TEXTENCODING_DONTKNOW) ||
+ ((WIN_BYTE)(pFont->mpFontData->mpSysData) == OEM_CHARSET)) )
+ aLogFont.lfCharSet = (WIN_BYTE)(pFont->mpFontData->mpSysData);
+ else
+ aLogFont.lfCharSet = ImplCharSetToWin( pFont->meCharSet );
+ aLogFont.lfPitchAndFamily = ImplPitchToWin( pFont->mePitch );
+ aLogFont.lfPitchAndFamily |= ImplFamilyToWin( pFont->meFamily );
+ aLogFont.lfWeight = ImplWeightToWin( pFont->meWeight );
+ aLogFont.lfHeight = (int)-pFont->mnHeight;
+ aLogFont.lfWidth = (int)pFont->mnWidth;
+ aLogFont.lfUnderline = 0;
+ aLogFont.lfStrikeOut = 0;
+ aLogFont.lfItalic = (pFont->meItalic) != ITALIC_NONE;
+ aLogFont.lfEscapement = pFont->mnOrientation;
+ aLogFont.lfOrientation = 0;
+ aLogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ aLogFont.lfQuality = DEFAULT_QUALITY;
+ if ( pFont->mnOrientation )
+ {
+ aLogFont.lfOutPrecision = OUT_TT_PRECIS;
+ aLogFont.lfClipPrecision |= CLIP_LH_ANGLES;
+ }
+ else
+ aLogFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
+
+ // Auf dem Bildschirm nehmen wir Courier New, wenn Courier nicht
+ // skalierbar ist und wenn der Font skaliert oder rotiert werden
+ // muss
+ if ( maGraphicsData.mbScreen &&
+ (pFont->mnWidth || pFont->mnOrientation ||
+ !pFont->mpFontData || (pFont->mpFontData->mnHeight != pFont->mnHeight)) &&
+ !bImplSalCourierScalable && bImplSalCourierNew &&
+ (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
+ lstrcpyW( aLogFont.lfFaceName, L"Courier New" );
+
+ hNewFont = CreateFontIndirectW( &aLogFont );
+ }
+ else
+ {
+ if ( !maGraphicsData.mpLogFont )
+ maGraphicsData.mpLogFont = new LOGFONTA;
+
+ ByteString aName;
+ if ( pFont->mpFontData )
+ aName = ImplSalGetWinAnsiString( pFont->mpFontData->maName );
+ else
+ aName = ImplSalGetWinAnsiString( pFont->maName.GetToken( 0 ) );
+ UINT nNameLen = aName.Len();
+ if ( nNameLen > sizeof( maGraphicsData.mpLogFont->lfFaceName )-1 )
+ nNameLen = sizeof( maGraphicsData.mpLogFont->lfFaceName )-1;
+ memcpy( maGraphicsData.mpLogFont->lfFaceName, aName.GetBuffer(), nNameLen );
+ maGraphicsData.mpLogFont->lfFaceName[nNameLen] = 0;
+ if ( pFont->mpFontData &&
+ ((pFont->meCharSet == RTL_TEXTENCODING_DONTKNOW) ||
+ ((WIN_BYTE)(pFont->mpFontData->mpSysData) == OEM_CHARSET)) )
+ maGraphicsData.mpLogFont->lfCharSet = (WIN_BYTE)(pFont->mpFontData->mpSysData);
+ else
+ maGraphicsData.mpLogFont->lfCharSet = ImplCharSetToWin( pFont->meCharSet );
+ maGraphicsData.mpLogFont->lfPitchAndFamily = ImplPitchToWin( pFont->mePitch );
+ maGraphicsData.mpLogFont->lfPitchAndFamily |= ImplFamilyToWin( pFont->meFamily );
+ maGraphicsData.mpLogFont->lfWeight = ImplWeightToWin( pFont->meWeight );
+ maGraphicsData.mpLogFont->lfHeight = (int)-pFont->mnHeight;
+ maGraphicsData.mpLogFont->lfWidth = (int)pFont->mnWidth;
+ maGraphicsData.mpLogFont->lfUnderline = 0;
+ maGraphicsData.mpLogFont->lfStrikeOut = 0;
+ maGraphicsData.mpLogFont->lfItalic = (pFont->meItalic) != ITALIC_NONE;
+ maGraphicsData.mpLogFont->lfEscapement = pFont->mnOrientation;
+ maGraphicsData.mpLogFont->lfOrientation = 0;
+ maGraphicsData.mpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ maGraphicsData.mpLogFont->lfQuality = DEFAULT_QUALITY;
+ if ( pFont->mnOrientation )
+ {
+ maGraphicsData.mpLogFont->lfOutPrecision = OUT_TT_PRECIS;
+ maGraphicsData.mpLogFont->lfClipPrecision |= CLIP_LH_ANGLES;
+ }
+ else
+ maGraphicsData.mpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
+
+ // Auf dem Bildschirm nehmen wir Courier New, wenn Courier nicht
+ // skalierbar ist und wenn der Font skaliert oder rotiert werden
+ // muss
+ if ( maGraphicsData.mbScreen &&
+ (pFont->mnWidth || pFont->mnOrientation ||
+ !pFont->mpFontData || (pFont->mpFontData->mnHeight != pFont->mnHeight)) &&
+ !bImplSalCourierScalable && bImplSalCourierNew &&
+ (stricmp( maGraphicsData.mpLogFont->lfFaceName, "Courier" ) == 0) )
+ strcpy( maGraphicsData.mpLogFont->lfFaceName, "Courier New" );
+
+ hNewFont = CreateFontIndirectA( maGraphicsData.mpLogFont );
+ }
+
+ HFONT hOldFont = SelectFont( maGraphicsData.mhDC, hNewFont );
+
+ // destory or save old font
+ if ( maGraphicsData.mhFont )
+ DeleteFont( maGraphicsData.mhFont );
+ else
+ maGraphicsData.mhDefFont = hOldFont;
+
+ // set new data
+ maGraphicsData.mhFont = hNewFont;
+ maGraphicsData.mbCalcOverhang = TRUE;
+
+ maGraphicsData.mnFontCharSetCount = 0;
+ maGraphicsData.mbFontKernInit = TRUE;
+ if ( maGraphicsData.mpFontKernPairs )
+ {
+ delete maGraphicsData.mpFontKernPairs;
+ maGraphicsData.mpFontKernPairs = 0;
+ }
+ maGraphicsData.mnFontKernPairCount = 0;
+
+ // Auf dem Printer immer mit DrawTextArray arbeiten, da dort die
+ // Zeichenbreiten genauer als Pixel sein koennen
+ if ( maGraphicsData.mbPrinter )
+ return SAL_SETFONT_USEDRAWTEXTARRAY;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long SalGraphics::GetCharWidth( sal_Unicode nChar1, sal_Unicode nChar2, long* pWidthAry )
+{
+ SIZE aExtent;
+ SIZE aExtent2;
+ sal_Unicode nCharCount = nChar2-nChar1+1;
+ sal_Unicode i;
+ int* pWinWidthAry = (int*)pWidthAry;
+ DBG_ASSERT( sizeof( int ) == sizeof( long ), "SalGraphics::GetCharWidth(): int != long" );
+
+ // Da nicht bei allen Treibern diese Funktion funktioniert
+ if ( !GetCharWidthW( maGraphicsData.mhDC, nChar1, nChar2, pWinWidthAry ) )
+ {
+ for ( i = 0; i < nCharCount; i++ )
+ {
+ WCHAR c =i+nChar1;
+ if ( !GetTextExtentPointW( maGraphicsData.mhDC, &c, 1, &aExtent ) )
+ pWinWidthAry[i] = 0;
+ else
+ pWinWidthAry[i] = aExtent.cx;
+ }
+ }
+
+ // Ueberhang abziehen
+ if ( maGraphicsData.mbCalcOverhang )
+ {
+ WCHAR aAA[2] = { 'A', 'A' };
+ if ( GetTextExtentPointW( maGraphicsData.mhDC, aAA, 2, &aExtent ) &&
+ GetTextExtentPointW( maGraphicsData.mhDC, aAA, 1, &aExtent2 ) )
+ {
+ maGraphicsData.mbCalcOverhang = FALSE;
+ maGraphicsData.mnFontOverhang = (aExtent2.cx*2)-aExtent.cx;
+ }
+
+ int nOverhang = maGraphicsData.mnFontOverhang;
+ if ( nOverhang )
+ {
+ for ( i = 0; i < nCharCount; i++ )
+ pWinWidthAry[i] -= nOverhang;
+ }
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+{
+ if ( aSalShlData.mbWNT )
+ {
+ wchar_t aFaceName[LF_FACESIZE+60];
+ GetTextFaceW( maGraphicsData.mhDC, sizeof( aFaceName ), aFaceName );
+ pMetric->maName = aFaceName;
+
+ TEXTMETRICW aWinMetric;
+ GetTextMetricsW( maGraphicsData.mhDC, &aWinMetric );
+
+ pMetric->mnWidth = aWinMetric.tmAveCharWidth;
+ pMetric->meFamily = ImplFamilyToSal( aWinMetric.tmPitchAndFamily );;
+ pMetric->meCharSet = ImplCharSetToSal( aWinMetric.tmCharSet );
+ pMetric->meWeight = ImplWeightToSal( aWinMetric.tmWeight );
+ pMetric->mePitch = ImplMetricPitchToSal( aWinMetric.tmPitchAndFamily );
+ if ( aWinMetric.tmItalic )
+ pMetric->meItalic = ITALIC_NORMAL;
+ else
+ pMetric->meItalic = ITALIC_NONE;
+ if ( aWinMetric.tmPitchAndFamily & (TMPF_VECTOR | TMPF_TRUETYPE) )
+ pMetric->meType = TYPE_SCALABLE;
+ else
+ {
+ pMetric->meType = TYPE_RASTER;
+ pMetric->mnOrientation = 0;
+ }
+ pMetric->mbDevice = (aWinMetric.tmPitchAndFamily & TMPF_DEVICE) != 0;
+ pMetric->mnAscent = aWinMetric.tmAscent;
+ pMetric->mnDescent = aWinMetric.tmDescent;
+ pMetric->mnLeading = aWinMetric.tmInternalLeading;
+ pMetric->mnSlant = 0;
+ pMetric->mnFirstChar = 0;
+ pMetric->mnLastChar = 0xFF;
+ }
+ else
+ {
+ char aFaceName[LF_FACESIZE+60];
+ GetTextFaceA( maGraphicsData.mhDC, sizeof( aFaceName ), aFaceName );
+ pMetric->maName = ImplSalGetUniString( aFaceName );
+
+ TEXTMETRICA aWinMetric;
+ GetTextMetricsA( maGraphicsData.mhDC, &aWinMetric );
+
+ pMetric->mnWidth = aWinMetric.tmAveCharWidth;
+ pMetric->meFamily = ImplFamilyToSal( aWinMetric.tmPitchAndFamily );;
+ pMetric->meCharSet = ImplCharSetToSal( aWinMetric.tmCharSet );
+ pMetric->meWeight = ImplWeightToSal( aWinMetric.tmWeight );
+ pMetric->mePitch = ImplMetricPitchToSal( aWinMetric.tmPitchAndFamily );
+ if ( aWinMetric.tmItalic )
+ pMetric->meItalic = ITALIC_NORMAL;
+ else
+ pMetric->meItalic = ITALIC_NONE;
+ if ( aWinMetric.tmPitchAndFamily & (TMPF_VECTOR | TMPF_TRUETYPE) )
+ pMetric->meType = TYPE_SCALABLE;
+ else
+ {
+ pMetric->meType = TYPE_RASTER;
+ pMetric->mnOrientation = 0;
+ }
+ pMetric->mbDevice = (aWinMetric.tmPitchAndFamily & TMPF_DEVICE) != 0;
+ pMetric->mnAscent = aWinMetric.tmAscent;
+ pMetric->mnDescent = aWinMetric.tmDescent;
+ pMetric->mnLeading = aWinMetric.tmInternalLeading;
+ pMetric->mnSlant = 0;
+ pMetric->mnFirstChar = 0;
+ pMetric->mnLastChar = 0xFF;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int CALLBACK SalEnumCharSetsProcExA( const ENUMLOGFONTEXA* pLogFont,
+ const NEWTEXTMETRICEXA* pMetric,
+ DWORD nFontType, LPARAM lParam )
+{
+ SalGraphicsData* pData = (SalGraphicsData*)lParam;
+ // Charset already in the list?
+ for ( BYTE i = 0; i < pData->mnFontCharSetCount; i++ )
+ {
+ if ( pData->mpFontCharSets[i] == pLogFont->elfLogFont.lfCharSet )
+ return 1;
+ }
+ pData->mpFontCharSets[pData->mnFontCharSetCount] = pLogFont->elfLogFont.lfCharSet;
+ pData->mnFontCharSetCount++;
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplGetAllFontCharSets( SalGraphicsData* pData )
+{
+ if ( !pData->mpFontCharSets )
+ pData->mpFontCharSets = new BYTE[256];
+
+ LOGFONTA aLogFont;
+ memset( &aLogFont, 0, sizeof( aLogFont ) );
+ aLogFont.lfCharSet = DEFAULT_CHARSET;
+ GetTextFace( pData->mhDC, sizeof( aLogFont.lfFaceName ), aLogFont.lfFaceName );
+ EnumFontFamiliesExA( pData->mhDC, &aLogFont, (FONTENUMPROCA)SalEnumCharSetsProcExA,
+ (LPARAM)(void*)pData, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplAddKerningPairs( SalGraphicsData* pData )
+{
+ ULONG nPairs = ::GetKerningPairsA( pData->mhDC, 0, NULL );
+ if ( !nPairs )
+ return;
+
+ CHARSETINFO aInfo;
+ if ( !TranslateCharsetInfo( (DWORD*)(ULONG)GetTextCharset( pData->mhDC ), &aInfo, TCI_SRCCHARSET ) )
+ return;
+
+ if ( !pData->mpFontKernPairs )
+ pData->mpFontKernPairs = new KERNINGPAIR[nPairs];
+ else
+ {
+ KERNINGPAIR* pOldPairs = pData->mpFontKernPairs;
+ pData->mpFontKernPairs = new KERNINGPAIR[nPairs+pData->mnFontKernPairCount];
+ memcpy( pData->mpFontKernPairs, pOldPairs,
+ pData->mnFontKernPairCount*sizeof( KERNINGPAIR ) );
+ delete pOldPairs;
+ }
+
+ UINT nCP = aInfo.ciACP;
+ ULONG nOldPairs = pData->mnFontKernPairCount;
+ KERNINGPAIR* pTempPair = pData->mpFontKernPairs+pData->mnFontKernPairCount;
+ nPairs = ::GetKerningPairsA( pData->mhDC, nPairs, pTempPair );
+ for ( ULONG i = 0; i < nPairs; i++ )
+ {
+ unsigned char aBuf[2];
+ wchar_t nChar;
+ int nLen;
+ BOOL bAdd = TRUE;
+
+ // None-ASCII?, then we must convert the char
+ if ( (pTempPair->wFirst > 125) || (pTempPair->wFirst == 92) )
+ {
+ if ( pTempPair->wFirst < 256 )
+ {
+ aBuf[0] = (unsigned char)pTempPair->wFirst;
+ nLen = 1;
+ }
+ else
+ {
+ aBuf[0] = (unsigned char)(pTempPair->wFirst >> 8);
+ aBuf[1] = (unsigned char)(pTempPair->wFirst & 0xFF);
+ nLen = 2;
+ }
+ if ( MultiByteToWideChar( nCP, MB_PRECOMPOSED | MB_USEGLYPHCHARS,
+ (const char*)aBuf, nLen, &nChar, 1 ) )
+ pTempPair->wFirst = nChar;
+ else
+ bAdd = FALSE;
+ }
+ if ( (pTempPair->wSecond > 125) || (pTempPair->wSecond == 92) )
+ {
+ if ( pTempPair->wSecond < 256 )
+ {
+ aBuf[0] = (unsigned char)pTempPair->wSecond;
+ nLen = 1;
+ }
+ else
+ {
+ aBuf[0] = (unsigned char)(pTempPair->wSecond >> 8);
+ aBuf[1] = (unsigned char)(pTempPair->wSecond & 0xFF);
+ nLen = 2;
+ }
+ if ( MultiByteToWideChar( nCP, MB_PRECOMPOSED | MB_USEGLYPHCHARS,
+ (const char*)aBuf, nLen, &nChar, 1 ) )
+ pTempPair->wSecond = nChar;
+ else
+ bAdd = FALSE;
+ }
+
+ KERNINGPAIR* pTempPair2 = pData->mpFontKernPairs;
+ for ( ULONG j = 0; j < nOldPairs; j++ )
+ {
+ if ( (pTempPair2->wFirst == pTempPair->wFirst) &&
+ (pTempPair2->wSecond == pTempPair->wSecond) )
+ {
+ bAdd = FALSE;
+ break;
+ }
+ pTempPair2++;
+ }
+
+ if ( bAdd )
+ {
+ KERNINGPAIR* pDestPair = pData->mpFontKernPairs+pData->mnFontKernPairCount;
+ if ( pDestPair != pTempPair )
+ memcpy( pDestPair, pTempPair, sizeof( KERNINGPAIR ) );
+ pData->mnFontKernPairCount++;
+ }
+
+ pTempPair++;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs )
+{
+ DBG_ASSERT( sizeof( KERNINGPAIR ) == sizeof( ImplKernPairData ),
+ "SalGraphics::GetKernPairs(): KERNINGPAIR != ImplKernPairData" );
+
+ if ( aSalShlData.mbWNT )
+ {
+ if ( !pKernPairs )
+ return ::GetKerningPairsW( maGraphicsData.mhDC, 0, NULL );
+ else
+ return ::GetKerningPairsW( maGraphicsData.mhDC, nPairs, (KERNINGPAIR*)pKernPairs );
+ }
+ else
+ {
+ if ( maGraphicsData.mbFontKernInit )
+ {
+ if ( maGraphicsData.mpFontKernPairs )
+ {
+ delete maGraphicsData.mpFontKernPairs;
+ maGraphicsData.mpFontKernPairs = 0;
+ }
+ maGraphicsData.mnFontKernPairCount = 0;
+
+ if ( !maGraphicsData.mnFontCharSetCount )
+ ImplGetAllFontCharSets( &maGraphicsData );
+
+ if ( maGraphicsData.mnFontCharSetCount <= 1 )
+ ImplAddKerningPairs( &maGraphicsData );
+ else
+ {
+ // Query All Kerning Pairs from all possible CharSets
+ for ( BYTE i = 0; i < maGraphicsData.mnFontCharSetCount; i++ )
+ {
+ maGraphicsData.mpLogFont->lfCharSet = maGraphicsData.mpFontCharSets[i];
+ HFONT hNewFont = CreateFontIndirectA( maGraphicsData.mpLogFont );
+ HFONT hOldFont = SelectFont( maGraphicsData.mhDC, hNewFont );
+ ImplAddKerningPairs( &maGraphicsData );
+ SelectFont( maGraphicsData.mhDC, hOldFont );
+ DeleteFont( hNewFont );
+ }
+ }
+
+ maGraphicsData.mbFontKernInit = FALSE;
+ }
+
+ if ( !pKernPairs )
+ return maGraphicsData.mnFontKernPairCount;
+ else
+ {
+ if ( nPairs > maGraphicsData.mnFontKernPairCount )
+ nPairs = maGraphicsData.mnFontKernPairCount;
+ memcpy( pKernPairs, maGraphicsData.mpFontKernPairs,
+ nPairs*sizeof( ImplKernPairData ) );
+ return nPairs;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int CALLBACK SalEnumFontsProcExA( const ENUMLOGFONTEXA* pLogFont,
+ const NEWTEXTMETRICEXA* pMetric,
+ DWORD nFontType, LPARAM lParam )
+{
+ ImplEnumInfo* pInfo = (ImplEnumInfo*)(void*)lParam;
+ if ( !pInfo->mpName )
+ {
+ // Ignore vertical fonts
+ if ( pLogFont->elfLogFont.lfFaceName[0] != '@' )
+ {
+ if ( !pInfo->mbImplSalCourierNew )
+ pInfo->mbImplSalCourierNew = stricmp( pLogFont->elfLogFont.lfFaceName, "Courier New" ) == 0;
+ if ( !pInfo->mbImplSalCourierScalable )
+ pInfo->mbCourier = stricmp( pLogFont->elfLogFont.lfFaceName, "Courier" ) == 0;
+ else
+ pInfo->mbCourier = FALSE;
+ XubString aName( ImplSalGetUniString( pLogFont->elfLogFont.lfFaceName ) );
+ pInfo->mpName = &aName;
+ strcpy( pInfo->mpLogFontA->lfFaceName, pLogFont->elfLogFont.lfFaceName );
+ pInfo->mpLogFontA->lfCharSet = pLogFont->elfLogFont.lfCharSet;
+ EnumFontFamiliesExA( pInfo->mhDC, pInfo->mpLogFontA, (FONTENUMPROCA)SalEnumFontsProcExA,
+ (LPARAM)(void*)pInfo, 0 );
+ pInfo->mpLogFontA->lfFaceName[0] = '\0';
+ pInfo->mpLogFontA->lfCharSet = DEFAULT_CHARSET;
+ pInfo->mpName = NULL;
+ pInfo->mbCourier = FALSE;
+ }
+ }
+ else
+ {
+ ImplFontData* pData = new ImplFontData;
+ pData->maName = *(pInfo->mpName);
+
+ ImplLogMetricToDevFontDataA( &(pLogFont->elfLogFont), &(pMetric->ntmTm), nFontType, pData );
+ // StyleName nur bei TrueType uebernehmen, da sonst bei 3.1 Mist drinsteht
+ if ( pMetric->ntmTm.tmPitchAndFamily & TMPF_TRUETYPE )
+ pData->maStyleName = ImplSalGetUniString( (const char*)pLogFont->elfStyle );
+ pData->mpSysData = (void*)(pLogFont->elfLogFont.lfCharSet);
+ BOOL bAdd = TRUE;
+
+ // Wenn es sich um einen nicht skalierbaren Bildschirm-Font
+ // handelt, dann auf dem Drucker ignorieren
+ if ( pData->meType != TYPE_SCALABLE )
+ {
+ if ( pInfo->mbPrinter )
+ bAdd = pData->mbDevice;
+ }
+ else
+ {
+ // Feststellen, ob Courier skalierbar ist
+ if ( pInfo->mbCourier )
+ pInfo->mbImplSalCourierScalable = TRUE;
+ }
+
+ if ( bAdd )
+ pInfo->mpList->Add( pData );
+ else
+ delete pData;
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+int CALLBACK SalEnumFontsProcExW( const ENUMLOGFONTEXW* pLogFont,
+ const NEWTEXTMETRICEXW* pMetric,
+ DWORD nFontType, LPARAM lParam )
+{
+ ImplEnumInfo* pInfo = (ImplEnumInfo*)(void*)lParam;
+ if ( !pInfo->mpName )
+ {
+ // Ignore vertical fonts
+ if ( pLogFont->elfLogFont.lfFaceName[0] != '@' )
+ {
+ if ( !pInfo->mbImplSalCourierNew )
+ pInfo->mbImplSalCourierNew = ImplSalWICompareAscii( pLogFont->elfLogFont.lfFaceName, "Courier New" ) == 0;
+ if ( !pInfo->mbImplSalCourierScalable )
+ pInfo->mbCourier = ImplSalWICompareAscii( pLogFont->elfLogFont.lfFaceName, "Courier" ) == 0;
+ else
+ pInfo->mbCourier = FALSE;
+ XubString aName( pLogFont->elfLogFont.lfFaceName );
+ pInfo->mpName = &aName;
+ memcpy( pInfo->mpLogFontW->lfFaceName, pLogFont->elfLogFont.lfFaceName, (aName.Len()+1)*sizeof( wchar_t ) );
+ pInfo->mpLogFontW->lfCharSet = pLogFont->elfLogFont.lfCharSet;
+ EnumFontFamiliesExW( pInfo->mhDC, pInfo->mpLogFontW, (FONTENUMPROCW)SalEnumFontsProcExW,
+ (LPARAM)(void*)pInfo, 0 );
+ pInfo->mpLogFontW->lfFaceName[0] = '\0';
+ pInfo->mpLogFontW->lfCharSet = DEFAULT_CHARSET;
+ pInfo->mpName = NULL;
+ pInfo->mbCourier = FALSE;
+ }
+ }
+ else
+ {
+ ImplFontData* pData = new ImplFontData;
+ pData->maName = *(pInfo->mpName);
+
+ ImplLogMetricToDevFontDataW( &(pLogFont->elfLogFont), &(pMetric->ntmTm), nFontType, pData );
+ // StyleName nur bei TrueType uebernehmen, da sonst bei 3.1 Mist drinsteht
+ if ( pMetric->ntmTm.tmPitchAndFamily & TMPF_TRUETYPE )
+ pData->maStyleName = pLogFont->elfStyle;
+ pData->mpSysData = (void*)(pLogFont->elfLogFont.lfCharSet);
+ BOOL bAdd = TRUE;
+
+ // Wenn es sich um einen nicht skalierbaren Bildschirm-Font
+ // handelt, dann auf dem Drucker ignorieren
+ if ( pData->meType != TYPE_SCALABLE )
+ {
+ if ( pInfo->mbPrinter )
+ bAdd = pData->mbDevice;
+ }
+ else
+ {
+ // Feststellen, ob Courier skalierbar ist
+ if ( pInfo->mbCourier )
+ pInfo->mbImplSalCourierScalable = TRUE;
+ }
+
+ if ( bAdd )
+ pInfo->mpList->Add( pData );
+ else
+ delete pData;
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::GetDevFontList( ImplDevFontList* pList )
+{
+ ImplEnumInfo aInfo;
+ aInfo.mhDC = maGraphicsData.mhDC;
+ aInfo.mpList = pList;
+ aInfo.mpName = NULL;
+ aInfo.mpLogFontA = NULL;
+ aInfo.mpLogFontW = NULL;
+ aInfo.mbCourier = FALSE;
+ if ( !maGraphicsData.mbPrinter )
+ {
+ aInfo.mbImplSalCourierScalable = FALSE;
+ aInfo.mbImplSalCourierNew = FALSE;
+ aInfo.mbPrinter = FALSE;
+ }
+ else
+ {
+ aInfo.mbImplSalCourierScalable = TRUE;
+ aInfo.mbImplSalCourierNew = TRUE;
+ aInfo.mbPrinter = TRUE;
+ }
+
+ if ( aSalShlData.mbWNT )
+ {
+ LOGFONTW aLogFont;
+ memset( &aLogFont, 0, sizeof( aLogFont ) );
+ aLogFont.lfCharSet = DEFAULT_CHARSET;
+ aInfo.mpLogFontW = &aLogFont;
+ EnumFontFamiliesExW( maGraphicsData.mhDC, &aLogFont, (FONTENUMPROCW)SalEnumFontsProcExW,
+ (LPARAM)(void*)&aInfo, 0 );
+ }
+ else
+ {
+ LOGFONTA aLogFont;
+ memset( &aLogFont, 0, sizeof( aLogFont ) );
+ aLogFont.lfCharSet = DEFAULT_CHARSET;
+ aInfo.mpLogFontA = &aLogFont;
+ EnumFontFamiliesExA( maGraphicsData.mhDC, &aLogFont, (FONTENUMPROCA)SalEnumFontsProcExA,
+ (LPARAM)(void*)&aInfo, 0 );
+ }
+
+ // Feststellen, was es fuer Courier-Schriften auf dem Bildschirm gibt,
+ // um in SetFont() evt. Courier auf Courier New zu mappen
+ if ( !maGraphicsData.mbPrinter )
+ {
+ bImplSalCourierScalable = aInfo.mbImplSalCourierScalable;
+ bImplSalCourierNew = aInfo.mbImplSalCourierNew;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawText( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen )
+{
+ DBG_ASSERT( sizeof( WCHAR ) == sizeof( xub_Unicode ), "SalGraphics::DrawText(): WCHAR != sal_Unicode" );
+
+ ::ExtTextOutW( maGraphicsData.mhDC, (int)nX, (int)nY,
+ 0, NULL, pStr, nLen, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SalGraphics::DrawTextArray( long nX, long nY,
+ const xub_Unicode* pStr, xub_StrLen nLen,
+ const long* pDXAry )
+{
+ DBG_ASSERT( sizeof( WCHAR ) == sizeof( xub_Unicode ), "SalGraphics::DrawText(): WCHAR != sal_Unicode" );
+
+ if ( nLen < 2 )
+ ::ExtTextOutW( maGraphicsData.mhDC, (int)nX, (int)nY, 0, NULL, pStr, nLen, NULL );
+ else
+ {
+ int aStackAry[SAL_DRAWTEXT_STACKBUF];
+ int* pWinDXAry;
+
+ if ( nLen <= SAL_DRAWTEXT_STACKBUF )
+ pWinDXAry = aStackAry;
+ else
+ pWinDXAry = new int[nLen];
+
+ pWinDXAry[0] = (int)pDXAry[0];
+ for ( xub_StrLen i = 1; i < nLen-1; i++ )
+ pWinDXAry[i] = (int)pDXAry[i]-pDXAry[i-1];
+
+ // Breite vom letzten Zeichen ermitteln, da wir dieses auch
+ // beim Windows-XArray in der richtigen Breite reingeben
+ // muessen, um nicht auf Probleme bei einigen
+ // Grafikkarten oder Druckertreibern zu stossen
+ SIZE aExtent;
+ if ( GetTextExtentPointW( maGraphicsData.mhDC, pStr+nLen-1, 1, &aExtent ) )
+ pWinDXAry[nLen-1] = aExtent.cx;
+ else
+ pWinDXAry[nLen-1] = 4095;
+
+ // Text ausgeben
+ ::ExtTextOutW( maGraphicsData.mhDC, (int)nX, (int)nY, 0, NULL, pStr, nLen, pWinDXAry );
+
+ if ( pWinDXAry != aStackAry )
+ delete pWinDXAry;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static ULONG ImplIncreaseArrays( ULONG nSize, SalPoint** ppPoints, BYTE** ppFlags, ULONG nIncSize )
+{
+ const ULONG nOldSize = nSize;
+ SalPoint* pNewPoints = new SalPoint[ nSize += nIncSize ];
+ BYTE* pNewFlags = new BYTE[ nSize ];
+
+ if( *ppPoints )
+ {
+ memcpy( pNewPoints, *ppPoints, nOldSize * sizeof( SalPoint ) );
+ memset( pNewPoints + nOldSize, 0, nIncSize * sizeof( SalPoint ) );
+ delete[] *ppPoints;
+ }
+ else
+ memset( pNewPoints, 0, nSize * sizeof( SalPoint ) );
+
+ if( *ppFlags )
+ {
+ memcpy( pNewFlags, *ppFlags, nOldSize );
+ memset( pNewFlags + nOldSize, 0, nIncSize );
+ delete[] *ppFlags;
+ }
+ else
+ memset( pNewFlags, 0, nSize );
+
+ *ppPoints = pNewPoints;
+ *ppFlags = pNewFlags;
+
+ return nSize;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplGetFamilyAndAscents( HDC hDC, BYTE& rPitch, long& rAscent )
+{
+ rPitch = 0;
+ rAscent = 0;
+
+ if ( aSalShlData.mbWNT )
+ {
+ TEXTMETRICW aTextMetricW;
+ if ( GetTextMetricsW( hDC, &aTextMetricW ) )
+ {
+ rPitch = aTextMetricW.tmPitchAndFamily;
+ rAscent = aTextMetricW.tmAscent;
+ }
+ }
+ else
+ {
+ TEXTMETRICA aTextMetricA;
+ if ( GetTextMetricsA( hDC, &aTextMetricA ) )
+ {
+ rPitch = aTextMetricA.tmPitchAndFamily;
+ rAscent = aTextMetricA.tmAscent;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplGetGlyphChar( SalGraphicsData* pData, sal_Unicode c,
+ WORD& rByteChar, HFONT& rOldFont )
+{
+ rOldFont = 0;
+
+ if ( !pData->mnFontCharSetCount )
+ ImplGetAllFontCharSets( pData );
+
+ // Try at first the current charset
+ CHARSETINFO aInfo;
+ char aDestBuf[2];
+ int nLen = 0;
+ WIN_BOOL bDefault;
+ if ( TranslateCharsetInfo( (DWORD*)(ULONG)GetTextCharset( pData->mhDC ), &aInfo, TCI_SRCCHARSET ) )
+ {
+ bDefault = FALSE;
+ nLen = WideCharToMultiByte( aInfo.ciACP,
+ WC_COMPOSITECHECK | WC_DISCARDNS | WC_DEFAULTCHAR,
+ &c, 1,
+ aDestBuf, sizeof( aDestBuf ),
+ NULL, &bDefault );
+ }
+
+ // Try all possible charsets
+ if ( (nLen != 1) || bDefault )
+ {
+ // Query All Kerning Pairs from all possible CharSets
+ for ( BYTE i = 0; i < pData->mnFontCharSetCount; i++ )
+ {
+ if ( TranslateCharsetInfo( (DWORD*)(ULONG)pData->mpFontCharSets[i], &aInfo, TCI_SRCCHARSET ) )
+ {
+ bDefault = FALSE;
+ nLen = WideCharToMultiByte( aInfo.ciACP,
+ WC_COMPOSITECHECK | WC_DISCARDNS | WC_DEFAULTCHAR,
+ &c, 1,
+ aDestBuf, sizeof( aDestBuf ),
+ NULL, &bDefault );
+ if ( (nLen == 1) && !bDefault )
+ {
+ pData->mpLogFont->lfCharSet = pData->mpFontCharSets[i];
+ HFONT hNewFont = CreateFontIndirectA( pData->mpLogFont );
+ rOldFont = SelectFont( pData->mhDC, hNewFont );
+ break;
+ }
+ }
+ }
+ }
+
+ // GetGlyphOutline() only works for characters < 256. For all characters
+ // greater than 256 we use the default mechanismn in VCL to scan
+ // the printed Glyph
+ if ( (nLen == 1) && !bDefault )
+ {
+ rByteChar = (unsigned char)aDestBuf[0];
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalGraphics::GetGlyphBoundRect( xub_Unicode cChar, long* pX, long* pY,
+ long* pWidth, long* pHeight )
+{
+ HDC hDC = maGraphicsData.mhDC;
+ BYTE nPitchAndFamily;
+ long nAscent;
+
+ ImplGetFamilyAndAscents( hDC, nPitchAndFamily, nAscent );
+ if ( !(nPitchAndFamily & TMPF_TRUETYPE) )
+ return FALSE;
+
+ GLYPHMETRICS aGlyphMetrics;
+ MAT2 aMat;
+ DWORD nSize;
+ BOOL bOK;
+ HFONT hOldFont = 0;
+
+ // Einheitsmatrix erzeugen
+ aMat.eM11 = FixedFromDouble(1.);
+ aMat.eM12 = FixedFromDouble(0.);
+ aMat.eM21 = FixedFromDouble(0.);
+ aMat.eM22 = FixedFromDouble(1.);
+ if ( aSalShlData.mbWNT )
+ nSize = ::GetGlyphOutlineW( hDC, cChar, GGO_METRICS, &aGlyphMetrics, 0, NULL, &aMat );
+ else
+ {
+ WORD nChar;
+ if ( ImplGetGlyphChar( &maGraphicsData, cChar, nChar, hOldFont ) )
+ nSize = ::GetGlyphOutlineA( hDC, nChar, GGO_METRICS, &aGlyphMetrics, 0, NULL, &aMat );
+ else
+ nSize = 0;
+ }
+ bOK = (nSize != GDI_ERROR) && nSize;
+ if ( bOK )
+ {
+ *pX = aGlyphMetrics.gmptGlyphOrigin.x;
+ *pY = nAscent - aGlyphMetrics.gmptGlyphOrigin.y;
+ *pWidth = aGlyphMetrics.gmBlackBoxX;
+ *pHeight = aGlyphMetrics.gmBlackBoxY;
+ }
+
+ if ( hOldFont )
+ {
+ HFONT hNewFont = SelectFont( maGraphicsData.mhDC, hOldFont );
+ DeleteFont( hNewFont );
+ }
+
+ return bOK;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalGraphics::GetGlyphOutline( xub_Unicode cChar, USHORT** ppPolySizes,
+ SalPoint** ppPoints, BYTE** ppFlags )
+{
+ HDC hDC = maGraphicsData.mhDC;
+ BYTE nPitchAndFamily;
+ long nAscent;
+
+ ImplGetFamilyAndAscents( hDC, nPitchAndFamily, nAscent );
+ if ( !(nPitchAndFamily & TMPF_TRUETYPE) )
+ return 0;
+
+ GLYPHMETRICS aGlyphMetrics;
+ MAT2 aMat;
+ DWORD nSize;
+ USHORT nChar = cChar;
+ HFONT hOldFont = 0;
+ ULONG nPolyCount = 0;
+
+ // Einheitsmatrix erzeugen
+ aMat.eM11 = FixedFromDouble(1.);
+ aMat.eM12 = FixedFromDouble(0.);
+ aMat.eM21 = FixedFromDouble(0.);
+ aMat.eM22 = FixedFromDouble(1.);
+
+ if ( aSalShlData.mbWNT )
+ nSize = ::GetGlyphOutlineW( hDC, nChar, GGO_NATIVE, &aGlyphMetrics, 0, NULL, &aMat );
+ else
+ {
+ if ( ImplGetGlyphChar( &maGraphicsData, cChar, nChar, hOldFont ) )
+ nSize = ::GetGlyphOutlineA( hDC, nChar, GGO_NATIVE, &aGlyphMetrics, 0, NULL, &aMat );
+ else
+ nSize = 0;
+ }
+
+ if ( (nSize != GDI_ERROR) && nSize )
+ {
+ BYTE* pData = new BYTE[ nSize ];
+ ULONG nTotalCount = 0;
+ DWORD nSize2;
+ if ( aSalShlData.mbWNT )
+ nSize2 = ::GetGlyphOutlineW( hDC, nChar, GGO_NATIVE, &aGlyphMetrics, nSize, pData, &aMat );
+ else
+ nSize2 = ::GetGlyphOutlineA( hDC, nChar, GGO_NATIVE, &aGlyphMetrics, nSize, pData, &aMat );
+ if ( nSize == nSize2 )
+ {
+ ULONG nPtSize = GLYPH_INC;
+ SalPoint* pPoints = new SalPoint[ GLYPH_INC ];
+ SalPoint* pTotalPoints = NULL;
+ BYTE* pFlags = new BYTE[ GLYPH_INC ];
+ BYTE* pTotalFlags = NULL;
+ TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData;
+ TTPOLYCURVE* pCurve;
+ *ppPolySizes = new USHORT[ MAX_POLYCOUNT ];
+ memset( *ppPolySizes, 0, MAX_POLYCOUNT * sizeof( USHORT ) );
+
+ while ( ((BYTE*)pHeader < pData+nSize) && (nPolyCount < (MAX_POLYCOUNT - 1)) )
+ {
+ if ( pHeader->dwType == TT_POLYGON_TYPE )
+ {
+ USHORT nPnt = 0;
+ USHORT i;
+
+ memset( pPoints, 0, nPtSize * sizeof( SalPoint ) );
+ memset( pFlags, 0, nPtSize );
+
+ // ersten Startpunkt holen; die folgenden Startpunkte sind
+ // die Endpunkte der vorhergehenden Kurven
+ pPoints[ nPnt ].mnX = IntFromFixed( pHeader->pfxStart.x );
+ pPoints[ nPnt++ ].mnY = IntFromFixed( pHeader->pfxStart.y );
+
+ pCurve = (TTPOLYCURVE*) ( pHeader + 1 );
+
+ while ( (BYTE*)pCurve < (BYTE*)pHeader+pHeader->cb )
+ {
+ if ( TT_PRIM_LINE == pCurve->wType )
+ {
+ for( i = 0; i < pCurve->cpfx; i++ )
+ {
+ CHECKPOINTS( nPnt );
+ pPoints[ nPnt ].mnX = IntFromFixed( pCurve->apfx[ i ].x );
+ pPoints[ nPnt++ ].mnY = IntFromFixed( pCurve->apfx[ i ].y );
+ }
+ }
+ else if ( pCurve->wType == TT_PRIM_QSPLINE )
+ {
+ for ( i = 0; i < pCurve->cpfx; )
+ {
+ // Punkt B, der Kontrollpunkt der Kurve
+ CHECKPOINTS( nPnt );
+ pPoints[ nPnt ].mnX = IntFromFixed( pCurve->apfx[ i ].x );
+ pPoints[ nPnt ].mnY = IntFromFixed( pCurve->apfx[ i++ ].y );
+
+ // Punkt verdoppeln fuer Bezier-Wandlung
+ CHECKPOINTS( nPnt + 1UL );
+ pPoints[ nPnt + 1 ] = pPoints[ nPnt ];
+ nPnt += 2;
+
+ // Endpunkt der Kurve bestimmen
+ if ( i == (pCurve->cpfx - 1) )
+ {
+ // entweder letzter Punkt
+ CHECKPOINTS( nPnt );
+ pPoints[ nPnt ].mnX = IntFromFixed( pCurve->apfx[ i ].x );
+ pPoints[ nPnt++].mnY = IntFromFixed( pCurve->apfx[ i++ ].y );
+ }
+ else
+ {
+ // oder die Mitte zwischen den Kontrollpunkten
+ // dieser und der naechsten Kurce
+ CHECKPOINTS( nPnt );
+ pPoints[ nPnt ].mnX = IntFromFixed( fxDiv2( pCurve->apfx[ i - 1 ].x,
+ pCurve->apfx[ i ].x ) );
+ pPoints[ nPnt++ ].mnY = IntFromFixed( fxDiv2( pCurve->apfx[ i - 1 ].y,
+ pCurve->apfx[ i ].y ) );
+ }
+
+ // Umrechnung in Bezier ( PQ = TrueType-Controlpunkt):
+ // P1 = 1/3 * (P0 + 2 * PQ) / P2 = 1/3 * (P3 + 2 * PQ)
+ pPoints[ nPnt - 3 ].mnX = ( pPoints[ nPnt - 4 ].mnX +
+ ( pPoints[ nPnt - 3 ].mnX << 1 ) ) / 3;
+ pPoints[ nPnt - 3 ].mnY = ( pPoints[ nPnt - 4 ].mnY +
+ ( pPoints[ nPnt - 3 ].mnY << 1 ) ) / 3;
+
+ pPoints[ nPnt - 2 ].mnX = ( pPoints[ nPnt - 1 ].mnX +
+ ( pPoints[ nPnt - 2 ].mnX << 1 ) ) / 3;
+ pPoints[ nPnt - 2 ].mnY = ( pPoints[ nPnt - 1 ].mnY +
+ ( pPoints[ nPnt - 2 ].mnY << 1 ) ) / 3;
+
+ pFlags[ nPnt - 3 ] = pFlags[ nPnt - 2 ] = 2;
+ }
+ }
+
+ // weiter mit naechstem Kurvensegment
+ pCurve = (TTPOLYCURVE*) &pCurve->apfx[ i ];
+ }
+
+ CHECKPOINTS( nPnt );
+ pPoints[nPnt++] = pPoints[0];
+
+ if ( nPnt )
+ {
+ (*ppPolySizes)[ nPolyCount++ ] = nPnt;
+ ImplIncreaseArrays( nTotalCount, &pTotalPoints, &pTotalFlags, nPnt );
+
+ // Polygon senkrecht kippen: TrueType-Y-Koordinaten verlaufen von unten nach oben
+ for ( i = 0; i < nPnt; i++ )
+ {
+ pTotalPoints[ nTotalCount ].mnX = pPoints[i].mnX;
+ pTotalPoints[ nTotalCount ].mnY = nAscent - pPoints[i].mnY;
+ pTotalFlags[ nTotalCount++ ] = pFlags[i];
+ }
+ }
+
+ // naechstes Polygon
+ pHeader = (TTPOLYGONHEADER*) ( (BYTE*) pHeader + pHeader->cb );
+ }
+ }
+
+ delete[] pPoints;
+ delete[] pFlags;
+
+ if ( !nPolyCount )
+ {
+ delete[] pTotalPoints;
+ *ppPoints = NULL;
+ delete[] pTotalFlags;
+ *ppFlags = NULL;
+ delete[] *ppPolySizes;
+ *ppPolySizes = NULL;
+ }
+ else
+ {
+ *ppPoints = pTotalPoints;
+ *ppFlags = pTotalFlags;
+ }
+ }
+
+ delete [] pData;
+ }
+
+ if ( hOldFont )
+ {
+ HFONT hNewFont = SelectFont( maGraphicsData.mhDC, hOldFont );
+ DeleteFont( hNewFont );
+ }
+
+ return nPolyCount;
+}
diff --git a/vcl/win/source/gdi/salogl.cxx b/vcl/win/source/gdi/salogl.cxx
new file mode 100644
index 000000000000..bdd5ccee00e8
--- /dev/null
+++ b/vcl/win/source/gdi/salogl.cxx
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * $RCSfile: salogl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALOGL_CXX
+
+#ifndef _SV_SALOGL_HXX
+#include <salogl.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+
+// -------------------------------
+// - Additional typedefs for init.
+// -------------------------------
+
+typedef HGLRC ( *OGLFncCreateContext )( HDC hDC );
+typedef BOOL ( *OGLFncDeleteContext )( HGLRC hContext );
+typedef HGLRC ( *OGLFncGetCurrentContext )( VOID );
+typedef void ( *OGLFncMakeCurrent )( HDC hDC, HGLRC hContext );
+
+// ------------
+// - Lib-Name -
+// ------------
+
+#define OGL_LIBNAME "OPENGL32.DLL"
+
+// ----------
+// - Macros -
+// ----------
+
+#define INIT_OGLFNC_WGL( FncName ) static OGLFnc##FncName pImplOpenWGLFnc##FncName = NULL;
+#define GET_OGLFNC_WGL( FncName ) \
+pImplOpenWGLFnc##FncName = (OGLFnc##FncName##) GetProcAddress( hImplOGLLib, "wgl" #FncName ); \
+if( !pImplOpenWGLFnc##FncName ) bRet = FALSE;
+
+// -----------------
+// - Statics init. -
+// -----------------
+
+// Members
+static HINSTANCE hImplOGLLib;
+HGLRC SalOpenGL::mhOGLContext = 0;
+HDC SalOpenGL::mhOGLLastDC = 0;
+ULONG SalOpenGL::mnOGLState = OGL_STATE_UNLOADED;
+
+INIT_OGLFNC_WGL( CreateContext );
+INIT_OGLFNC_WGL( DeleteContext );
+INIT_OGLFNC_WGL( GetCurrentContext );
+INIT_OGLFNC_WGL( MakeCurrent );
+
+// -----------
+// - WndProc -
+// -----------
+
+LRESULT CALLBACK OpenGLWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
+{
+ return DefWindowProc( hWnd, nMsg, nPar1, nPar2 );
+}
+
+// -------------
+// - SalOpenGL -
+// -------------
+
+SalOpenGL::SalOpenGL( SalGraphics* pGraphics )
+{
+ // Set mhOGLLastDC only the first time a
+ // SalOpenGL object is created; we need
+ // this DC in SalOpenGL::Create();
+ if ( OGL_STATE_UNLOADED == mnOGLState )
+ mhOGLLastDC = pGraphics->maGraphicsData.mhDC;
+}
+
+// ------------------------------------------------------------------------
+
+SalOpenGL::~SalOpenGL()
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::Create()
+{
+ BOOL bRet = FALSE;
+
+ if ( OGL_STATE_UNLOADED == mnOGLState )
+ {
+ if( ImplInitLib() )
+ {
+ USHORT nBitCount = GetDeviceCaps( mhOGLLastDC, BITSPIXEL );
+ PIXELFORMATDESCRIPTOR pfd =
+ {
+ sizeof( PIXELFORMATDESCRIPTOR ),
+ 1,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL,
+ PFD_TYPE_RGBA,
+ (BYTE) nBitCount,
+ 0, 0, 0, 0, 0, 0,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0, 0,
+ 16,
+ 0,
+ 0,
+ PFD_MAIN_PLANE,
+ 0,
+ 0, 0, 0
+ };
+
+ const int nIndex = ChoosePixelFormat( mhOGLLastDC, &pfd );
+
+ if( nIndex && SetPixelFormat( mhOGLLastDC, nIndex, &pfd ) )
+ {
+ if ( (nBitCount > 8) && ImplInit() &&
+ (mhOGLContext = pImplOpenWGLFncCreateContext( mhOGLLastDC )) != 0 )
+ {
+ WNDCLASS aWc;
+ HWND hDummyWnd;
+
+ SaveDC( mhOGLLastDC );
+ SelectClipRgn( mhOGLLastDC, NULL );
+ pImplOpenWGLFncMakeCurrent( mhOGLLastDC, mhOGLContext );
+ RestoreDC( mhOGLLastDC, -1 );
+ mnOGLState = OGL_STATE_VALID;
+ bRet = TRUE;
+
+ memset( &aWc, 0, sizeof( aWc ) );
+ aWc.hInstance = GetModuleHandle( NULL );
+ aWc.lpfnWndProc = OpenGLWndProc;
+ aWc.lpszClassName = "OpenGLWnd";
+ RegisterClass( &aWc );
+ hDummyWnd = CreateWindow( aWc.lpszClassName, NULL, WS_OVERLAPPED, 0, -50, 1, 1, HWND_DESKTOP, NULL, aWc.hInstance, 0 );
+ ShowWindow( hDummyWnd, SW_SHOW );
+ DestroyWindow( hDummyWnd );
+ UnregisterClass( aWc.lpszClassName, aWc.hInstance );
+ }
+ else
+ {
+ ImplFreeLib();
+ mnOGLState = OGL_STATE_INVALID;
+ }
+ }
+ else
+ mnOGLState = OGL_STATE_INVALID;
+ }
+ else
+ mnOGLState = OGL_STATE_INVALID;
+ }
+ else if( OGL_STATE_VALID == mnOGLState )
+ bRet = TRUE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::Release()
+{
+ ImplFreeLib();
+}
+
+// ------------------------------------------------------------------------
+
+void* SalOpenGL::GetOGLFnc( const char* pFncName )
+{
+ if ( hImplOGLLib )
+ return (void*)GetProcAddress( hImplOGLLib, pFncName );
+ else
+ return NULL;
+}
+
+// ------------------------------------------------------------------------
+
+typedef BOOL (WINAPI *MyFuncType)(HDC, HGLRC);
+
+void SalOpenGL::OGLEntry( SalGraphics* pGraphics )
+{
+ if ( pGraphics->maGraphicsData.mhDC != mhOGLLastDC )
+ {
+ PIXELFORMATDESCRIPTOR pfd =
+ {
+ sizeof( PIXELFORMATDESCRIPTOR ),
+ 1,
+ PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL,
+ PFD_TYPE_RGBA,
+ GetDeviceCaps( pGraphics->maGraphicsData.mhDC, BITSPIXEL ),
+ 0, 0, 0, 0, 0, 0,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0, 0,
+ 16,
+ 0,
+ 0,
+ PFD_MAIN_PLANE,
+ 0,
+ 0, 0, 0
+ };
+
+ const int nIndex = ChoosePixelFormat( pGraphics->maGraphicsData.mhDC, &pfd );
+ if ( nIndex && SetPixelFormat( pGraphics->maGraphicsData.mhDC, nIndex, &pfd ) )
+ {
+ WNDCLASS aWc;
+ HWND hDummyWnd;
+
+ pImplOpenWGLFncDeleteContext( mhOGLContext );
+ mhOGLLastDC = pGraphics->maGraphicsData.mhDC;
+ mhOGLContext = pImplOpenWGLFncCreateContext( mhOGLLastDC );
+
+ SaveDC( mhOGLLastDC );
+ SelectClipRgn( mhOGLLastDC, NULL );
+ pImplOpenWGLFncMakeCurrent( mhOGLLastDC, mhOGLContext );
+ RestoreDC( mhOGLLastDC, -1 );
+
+ memset( &aWc, 0, sizeof( aWc ) );
+ aWc.hInstance = GetModuleHandle( NULL );
+ aWc.lpfnWndProc = OpenGLWndProc;
+ aWc.lpszClassName = "OpenGLWnd";
+ RegisterClass( &aWc );
+ hDummyWnd = CreateWindow( aWc.lpszClassName, NULL, WS_OVERLAPPED, 0, -50, 1, 1, HWND_DESKTOP, NULL, aWc.hInstance, 0 );
+ ShowWindow( hDummyWnd, SW_SHOW );
+ DestroyWindow( hDummyWnd );
+ UnregisterClass( aWc.lpszClassName, aWc.hInstance );
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::OGLExit( SalGraphics* pGraphics )
+{
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::ImplInitLib()
+{
+ return ((hImplOGLLib = LoadLibrary( OGL_LIBNAME )) != NULL);
+}
+
+// ------------------------------------------------------------------------
+
+void SalOpenGL::ImplFreeLib()
+{
+ if ( hImplOGLLib )
+ {
+ FreeLibrary( hImplOGLLib );
+ hImplOGLLib = NULL;
+ mnOGLState = OGL_STATE_UNLOADED;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+BOOL SalOpenGL::ImplInit()
+{
+ BOOL bRet = TRUE;
+
+ // Internal use
+ GET_OGLFNC_WGL( CreateContext );
+ GET_OGLFNC_WGL( DeleteContext );
+ GET_OGLFNC_WGL( GetCurrentContext );
+ GET_OGLFNC_WGL( MakeCurrent );
+
+ return bRet;
+}
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
new file mode 100644
index 000000000000..e4ac38538b51
--- /dev/null
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -0,0 +1,1424 @@
+/*************************************************************************
+ *
+ * $RCSfile: salprn.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALPRN_CXX
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALPTYPE_HXX
+#include <salptype.hxx>
+#endif
+#ifndef _SV_SALPRN_HXX
+#include <salprn.hxx>
+#endif
+
+#ifndef _NEW_HXX
+#include <tools/new.hxx>
+#endif
+
+#ifndef _SV_PRINT_H
+#include <print.h>
+#endif
+#ifndef _SV_JOBSET_H
+#include <jobset.h>
+#endif
+
+// =======================================================================
+
+static char aImplWindows[] = "windows";
+static char aImplDevices[] = "devices";
+static char aImplDevice[] = "device";
+
+// =======================================================================
+
+static ULONG ImplWinQueueStatusToSal( DWORD nWinStatus )
+{
+ ULONG nStatus = 0;
+ if ( nWinStatus & PRINTER_STATUS_PAUSED )
+ nStatus |= QUEUE_STATUS_PAUSED;
+ if ( nWinStatus & PRINTER_STATUS_ERROR )
+ nStatus |= QUEUE_STATUS_ERROR;
+ if ( nWinStatus & PRINTER_STATUS_PENDING_DELETION )
+ nStatus |= QUEUE_STATUS_PENDING_DELETION;
+ if ( nWinStatus & PRINTER_STATUS_PAPER_JAM )
+ nStatus |= QUEUE_STATUS_PAPER_JAM;
+ if ( nWinStatus & PRINTER_STATUS_PAPER_OUT )
+ nStatus |= QUEUE_STATUS_PAPER_OUT;
+ if ( nWinStatus & PRINTER_STATUS_MANUAL_FEED )
+ nStatus |= QUEUE_STATUS_MANUAL_FEED;
+ if ( nWinStatus & PRINTER_STATUS_PAPER_PROBLEM )
+ nStatus |= QUEUE_STATUS_PAPER_PROBLEM;
+ if ( nWinStatus & PRINTER_STATUS_OFFLINE )
+ nStatus |= QUEUE_STATUS_OFFLINE;
+ if ( nWinStatus & PRINTER_STATUS_IO_ACTIVE )
+ nStatus |= QUEUE_STATUS_IO_ACTIVE;
+ if ( nWinStatus & PRINTER_STATUS_BUSY )
+ nStatus |= QUEUE_STATUS_BUSY;
+ if ( nWinStatus & PRINTER_STATUS_PRINTING )
+ nStatus |= QUEUE_STATUS_PRINTING;
+ if ( nWinStatus & PRINTER_STATUS_OUTPUT_BIN_FULL )
+ nStatus |= QUEUE_STATUS_OUTPUT_BIN_FULL;
+ if ( nWinStatus & PRINTER_STATUS_WAITING )
+ nStatus |= QUEUE_STATUS_WAITING;
+ if ( nWinStatus & PRINTER_STATUS_PROCESSING )
+ nStatus |= QUEUE_STATUS_PROCESSING;
+ if ( nWinStatus & PRINTER_STATUS_INITIALIZING )
+ nStatus |= QUEUE_STATUS_INITIALIZING;
+ if ( nWinStatus & PRINTER_STATUS_WARMING_UP )
+ nStatus |= QUEUE_STATUS_WARMING_UP;
+ if ( nWinStatus & PRINTER_STATUS_TONER_LOW )
+ nStatus |= QUEUE_STATUS_TONER_LOW;
+ if ( nWinStatus & PRINTER_STATUS_NO_TONER )
+ nStatus |= QUEUE_STATUS_NO_TONER;
+ if ( nWinStatus & PRINTER_STATUS_PAGE_PUNT )
+ nStatus |= QUEUE_STATUS_PAGE_PUNT;
+ if ( nWinStatus & PRINTER_STATUS_USER_INTERVENTION )
+ nStatus |= QUEUE_STATUS_USER_INTERVENTION;
+ if ( nWinStatus & PRINTER_STATUS_OUT_OF_MEMORY )
+ nStatus |= QUEUE_STATUS_OUT_OF_MEMORY;
+ if ( nWinStatus & PRINTER_STATUS_DOOR_OPEN )
+ nStatus |= QUEUE_STATUS_DOOR_OPEN;
+ if ( nWinStatus & PRINTER_STATUS_SERVER_UNKNOWN )
+ nStatus |= QUEUE_STATUS_SERVER_UNKNOWN;
+ if ( nWinStatus & PRINTER_STATUS_POWER_SAVE )
+ nStatus |= QUEUE_STATUS_POWER_SAVE;
+ if ( !nStatus && !(nWinStatus & PRINTER_STATUS_NOT_AVAILABLE) )
+ nStatus |= QUEUE_STATUS_READY;
+ return nStatus;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
+{
+// !!! UNICODE - NT Optimierung !!!
+ DWORD i;
+ DWORD n;
+ DWORD nBytes = 0;
+// DWORD nInfoRet;
+ DWORD nInfoPrn2;
+ BOOL bFound = FALSE;
+ PRINTER_INFO_2* pWinInfo2 = NULL;
+ PRINTER_INFO_2* pGetInfo2;
+ EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoPrn2 );
+ if ( nBytes )
+ {
+ pWinInfo2 = (PRINTER_INFO_2*)new BYTE[nBytes];
+ if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoPrn2 ) )
+ {
+ pGetInfo2 = pWinInfo2;
+ for ( i = 0; i < nInfoPrn2; i++ )
+ {
+ SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
+ pInfo->maPrinterName = ImplSalGetUniString( pGetInfo2->pPrinterName );
+ pInfo->maDriver = ImplSalGetUniString( pGetInfo2->pDriverName );
+ XubString aPortName;
+ if ( pGetInfo2->pPortName )
+ aPortName = ImplSalGetUniString( pGetInfo2->pPortName );
+ // pLocation can be 0 (the Windows docu doesn't describe this)
+ if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) )
+ pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation );
+ else
+ pInfo->maLocation = aPortName;
+ // pComment can be 0 (the Windows docu doesn't describe this)
+ if ( pGetInfo2->pComment )
+ pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment );
+ pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status );
+ pInfo->mnJobs = pGetInfo2->cJobs;
+ pInfo->mpSysData = new XubString( aPortName );
+ pList->Add( pInfo );
+ pGetInfo2++;
+ }
+
+ bFound = TRUE;
+ }
+ }
+
+/* Siehe Kommentar unten !!!
+ EnumPrinters( PRINTER_ENUM_NETWORK | PRINTER_ENUM_REMOTE, NULL, 1, NULL, 0, &nBytes, &nInfoRet );
+ if ( nBytes )
+ {
+ PRINTER_INFO_1* pWinInfo1 = (PRINTER_INFO_1*)new BYTE[nBytes];
+ if ( EnumPrinters( PRINTER_ENUM_NETWORK | PRINTER_ENUM_REMOTE, NULL, 1, (LPBYTE)pWinInfo1, nBytes, &nBytes, &nInfoRet ) )
+ {
+ PRINTER_INFO_1* pGetInfo1 = pWinInfo1;
+ for ( i = 0; i < nInfoRet; i++ )
+ {
+ // Feststellen, ob Printer durch erste Abfrage schon gefunden
+ // wurde
+ BOOL bAdd = TRUE;
+ if ( pWinInfo2 )
+ {
+ pGetInfo2 = pWinInfo2;
+ for ( n = 0; n < nInfoPrn2; n++ )
+ {
+ if ( strcmp( pGetInfo1->pName, pGetInfo2->pPrinterName ) == 0 )
+ {
+ bAdd = FALSE;
+ break;
+ }
+ pGetInfo2++;
+ }
+ }
+ // Wenn neuer Printer, dann aufnehmen
+ if ( bAdd )
+ {
+ SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
+ XubString aPrnName( pGetInfo1->pName );
+ pInfo->maPrinterName = aPrnName;
+ pInfo->maDriver = "winspool";
+ pInfo->maComment = pGetInfo1->pComment;
+ pInfo->mnStatus = 0;
+ pInfo->mnJobs = QUEUE_JOBS_DONTKNOW;
+ pInfo->mpSysData = new String();
+ pList->Add( pInfo );
+ }
+ pGetInfo1++;
+ }
+
+ bFound = TRUE;
+ }
+
+ delete pWinInfo1;
+ }
+*/
+
+// if ( bFound )
+// return;
+
+// !!! UNICODE - NT Optimierung !!!
+ // Drucker aus WIN.INI lesen
+ UINT nSize = 4096;
+ char* pBuf = new char[nSize];
+ UINT nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize );
+ while ( nRead >= nSize-2 )
+ {
+ nSize += 2048;
+ delete pBuf;
+ pBuf = new char[nSize];
+ nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize );
+ }
+
+ // Druckernamen aus Buffer extrahieren und Liste aufbauen
+ char* pName = pBuf;
+ while ( *pName )
+ {
+ char* pPortName;
+ char* pTmp;
+ char aPortBuf[256];
+ GetProfileStringA( aImplDevices, pName, "", aPortBuf, sizeof( aPortBuf ) );
+
+ pPortName = aPortBuf;
+
+ // Namen anlegen
+ xub_StrLen nNameLen = strlen( pName );
+ XubString aName( ImplSalGetUniString( pName, nNameLen ) );
+
+ // Treibernamen rausfischen
+ pTmp = pPortName;
+ while ( *pTmp != ',' )
+ pTmp++;
+ XubString aDriver( ImplSalGetUniString( pPortName, (USHORT)(pTmp-pPortName) ) );
+ pPortName = pTmp;
+
+ // Alle Portnamen raussuchen
+ do
+ {
+ pPortName++;
+ pTmp = pPortName;
+ while ( *pTmp && (*pTmp != ',') )
+ pTmp++;
+
+ String aPortName( ImplSalGetUniString( pPortName, (USHORT)(pTmp-pPortName) ) );
+
+ // Neuen Eintrag anlegen
+ // !!! Da ich zu bloeb bin, die Netzwerk-Printer zur 5.0
+ // !!! richtig zu integrieren, gehen wir zusaetzlich
+ // !!! noch ueber das W16-Interface, da uns dort die
+ // !!! Drucker noch einfach und schnell geliefert werden
+ // !!! ohne das wir jetzt zu grossen Aufwand treiben muessen.
+ // !!! Somit sollten wir dann jedenfalls nicht schlechter sein
+ // !!! als in einer 4.0 SP2.
+ // Feststellen, ob Printer durch erste Abfrage schon gefunden
+ // wurde
+ BOOL bAdd = TRUE;
+ if ( pWinInfo2 )
+ {
+ pGetInfo2 = pWinInfo2;
+ for ( n = 0; n < nInfoPrn2; n++ )
+ {
+ if ( aName.EqualsIgnoreCaseAscii( pGetInfo2->pPrinterName ) )
+ {
+ bAdd = FALSE;
+ break;
+ }
+ pGetInfo2++;
+ }
+ }
+ // Wenn neuer Printer, dann aufnehmen
+ if ( bAdd )
+ {
+ SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
+ pInfo->maPrinterName = aName;
+ pInfo->maDriver = aDriver;
+ pInfo->maLocation = aPortName;
+ pInfo->mnStatus = 0;
+ pInfo->mnJobs = QUEUE_JOBS_DONTKNOW;
+ pInfo->mpSysData = new XubString( aPortName );
+ pList->Add( pInfo );
+ }
+ }
+ while ( *pTmp == ',' );
+
+ pName += nNameLen + 1;
+ }
+
+ delete pBuf;
+ delete pWinInfo2;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo )
+{
+// !!! UNICODE - NT Optimierung !!!
+ DWORD nBytes = 0;
+ DWORD nInfoRet;
+ PRINTER_INFO_2* pWinInfo2;
+ EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoRet );
+ if ( nBytes )
+ {
+ pWinInfo2 = (PRINTER_INFO_2*)new BYTE[nBytes];
+ if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoRet ) )
+ {
+ PRINTER_INFO_2* pGetInfo2 = pWinInfo2;
+ for ( DWORD i = 0; i < nInfoRet; i++ )
+ {
+ if ( pInfo->maPrinterName.EqualsAscii( pGetInfo2->pPrinterName ) &&
+ pInfo->maDriver.EqualsAscii( pGetInfo2->pDriverName ) )
+ {
+ if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) )
+ pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation );
+ else
+ pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pPortName );
+ pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status );
+ pInfo->mnJobs = pGetInfo2->cJobs;
+ break;
+ }
+
+ pGetInfo2++;
+ }
+ }
+
+ delete pWinInfo2;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
+{
+ delete (String*)(pInfo->mpSysData);
+ delete pInfo;
+}
+
+// -----------------------------------------------------------------------
+
+// !!! UNICODE - NT Optimierung !!!
+XubString SalInstance::GetDefaultPrinter()
+{
+ // Default-Printer-String aus win.ini holen
+ char szBuffer[256];
+ GetProfileStringA( aImplWindows, aImplDevice, "", szBuffer, sizeof( szBuffer ) );
+ if ( szBuffer[0] )
+ {
+ // Printername suchen
+ char* pBuf = szBuffer;
+ char* pTmp = pBuf;
+ while ( *pTmp && (*pTmp != ',') )
+ pTmp++;
+ return ImplSalGetUniString( pBuf, (xub_StrLen)(pTmp-pBuf) );
+ }
+ else
+ return XubString();
+}
+
+// =======================================================================
+
+static DWORD ImplDeviceCaps( SalInfoPrinter* pPrinter, WORD nCaps,
+ LPTSTR pOutput, const ImplJobSetup* pSetupData )
+{
+ DEVMODE* pDevMode;
+ if ( !pSetupData || !pSetupData->mpDriverData )
+ pDevMode = NULL;
+ else
+ pDevMode = SAL_DEVMODE( pSetupData );
+
+// !!! UNICODE - NT Optimierung !!!
+ return DeviceCapabilitiesA( ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ ImplSalGetWinAnsiString( pPrinter->maPrinterData.maPortName, TRUE ).GetBuffer(),
+ nCaps, (LPSTR)pOutput, pDevMode );
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplTestSalJobSetup( SalInfoPrinter* pPrinter,
+ ImplJobSetup* pSetupData, BOOL bDelete )
+{
+ if ( pSetupData && pSetupData->mpDriverData )
+ {
+ // Signature und Groesse muss uebereinstimmen, damit wir keine
+ // JobSetup's von anderen Systemen setzen
+ if ( (pSetupData->mnSystem == JOBSETUP_SYSTEM_WINDOWS) &&
+ (pSetupData->mnDriverDataLen > sizeof( SalDriverData )) &&
+ (((SalDriverData*)(pSetupData->mpDriverData))->mnSysSignature == SAL_DRIVERDATA_SYSSIGN) )
+ return TRUE;
+ else if ( bDelete )
+ {
+ delete pSetupData->mpDriverData;
+ pSetupData->mpDriverData = NULL;
+ pSetupData->mnDriverDataLen = 0;
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplUpdateSalJobSetup( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData,
+ BOOL bIn, SalFrame* pVisibleDlgParent )
+{
+ HANDLE hPrn;
+// !!! UNICODE - NT Optimierung !!!
+ if ( !OpenPrinterA( (LPSTR)ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(), &hPrn, NULL ) )
+ return FALSE;
+
+ LONG nRet;
+ LONG nSysJobSize;
+ HWND hWnd = 0;
+ DWORD nMode = DM_OUT_BUFFER;
+ ULONG nDriverDataLen = 0;
+ SalDriverData* pOutBuffer = NULL;
+ DEVMODE* pInDevBuffer = NULL;
+ DEVMODE* pOutDevBuffer = NULL;
+
+// !!! UNICODE - NT Optimierung !!!
+ nSysJobSize = DocumentPropertiesA( hWnd, hPrn,
+ (LPSTR)ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ NULL, NULL, 0 );
+ if ( nSysJobSize < 0 )
+ {
+ ClosePrinter( hPrn );
+ return FALSE;
+ }
+
+ // Outputbuffer anlegen
+ nDriverDataLen = sizeof(SalDriverData)+nSysJobSize-1;
+ pOutBuffer = (SalDriverData*)SvMemAlloc( nDriverDataLen );
+ memset( pOutBuffer, 0, nDriverDataLen );
+ pOutDevBuffer = (LPDEVMODE)(pOutBuffer->maDriverData);
+ pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN;
+ pOutBuffer->mnVersion = SAL_DRIVERDATA_VERSION;
+ pOutBuffer->mnDriverOffset = (USHORT)(((SalDriverData*)NULL)->maDriverData);
+
+ // Testen, ob wir einen geeigneten Inputbuffer haben
+ if ( bIn && ImplTestSalJobSetup( pPrinter, pSetupData, FALSE ) )
+ {
+ pInDevBuffer = SAL_DEVMODE( pSetupData );
+ nMode |= DM_IN_BUFFER;
+ }
+
+ // Testen, ob Dialog angezeigt werden soll
+ if ( pVisibleDlgParent )
+ {
+ hWnd = pVisibleDlgParent->maFrameData.mhWnd;
+ nMode |= DM_IN_PROMPT;
+ }
+
+// !!! UNICODE - NT Optimierung !!!
+ // Release mutex, in the other case we don't get paints and so on
+ ULONG nMutexCount = ImplSalReleaseYieldMutex();
+ nRet = DocumentPropertiesA( hWnd, hPrn,
+ (LPSTR)ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ pOutDevBuffer, pInDevBuffer, nMode );
+ ImplSalAcquireYieldMutex( nMutexCount );
+ ClosePrinter( hPrn );
+
+ if ( (nRet < 0) || (pVisibleDlgParent && (nRet == IDCANCEL)) )
+ {
+ SvMemFree( pOutBuffer );
+ return FALSE;
+ }
+
+ // String-Buffer am Ende immer mit 0 initialisieren, damit
+ // die JobSetups nach Moeglichkeit bei memcmp immer
+ // identisch sind
+ if ( pOutDevBuffer->dmSize >= 32 )
+ {
+ USHORT nLen = strlen( (const char*)pOutDevBuffer->dmDeviceName );
+ if ( nLen < sizeof( pOutDevBuffer->dmDeviceName ) )
+ memset( pOutDevBuffer->dmDeviceName+nLen, 0, sizeof( pOutDevBuffer->dmDeviceName )-nLen );
+ }
+ if ( pOutDevBuffer->dmSize >= 102 )
+ {
+ USHORT nLen = strlen( (const char*)pOutDevBuffer->dmFormName );
+ if ( nLen < sizeof( pOutDevBuffer->dmFormName ) )
+ memset( pOutDevBuffer->dmFormName+nLen, 0, sizeof( pOutDevBuffer->dmFormName )-nLen );
+ }
+
+ // Daten updaten
+ if ( pSetupData->mpDriverData )
+ delete pSetupData->mpDriverData;
+ pSetupData->mnDriverDataLen = nDriverDataLen;
+ pSetupData->mpDriverData = (BYTE*)pOutBuffer;
+ pSetupData->mnSystem = JOBSETUP_SYSTEM_WINDOWS;
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplDevModeToJobSetup( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, ULONG nFlags )
+{
+ if ( !pSetupData || !pSetupData->mpDriverData )
+ return;
+
+ DEVMODE* pDevMode = SAL_DEVMODE( pSetupData );
+
+ // Orientation
+ if ( nFlags & SAL_JOBSET_ORIENTATION )
+ {
+ if ( pDevMode->dmOrientation == DMORIENT_PORTRAIT )
+ pSetupData->meOrientation = ORIENTATION_PORTRAIT;
+ else if ( pDevMode->dmOrientation == DMORIENT_LANDSCAPE )
+ pSetupData->meOrientation = ORIENTATION_LANDSCAPE;
+ }
+
+ // PaperBin
+ if ( nFlags & SAL_JOBSET_PAPERBIN )
+ {
+ ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
+
+ if ( nCount && (nCount != ((ULONG)-1)) )
+ {
+ WORD* pBins = new WORD[nCount];
+ memset( (BYTE*)pBins, 0, nCount*sizeof(WORD) );
+ ImplDeviceCaps( pPrinter, DC_BINS, (LPTSTR)pBins, pSetupData );
+ pSetupData->mnPaperBin = 0;
+
+ // search the right bin and assign index to mnPaperBin
+ for( ULONG i = 0; i < nCount; i++ )
+ {
+ if( pDevMode->dmDefaultSource == pBins[ i ] )
+ {
+ pSetupData->mnPaperBin = (USHORT)i;
+ break;
+ }
+ }
+
+ delete[] pBins;
+ }
+ }
+
+ // PaperSize
+ if ( nFlags & SAL_JOBSET_PAPERSIZE )
+ {
+ pSetupData->mnPaperWidth = pDevMode->dmPaperWidth*10;
+ pSetupData->mnPaperHeight = pDevMode->dmPaperLength*10;
+ switch( pDevMode->dmPaperSize )
+ {
+ case( DMPAPER_A3 ):
+ pSetupData->mePaperFormat = PAPER_A3;
+ break;
+ case( DMPAPER_A4 ):
+ pSetupData->mePaperFormat = PAPER_A4;
+ break;
+ case( DMPAPER_A5 ):
+ pSetupData->mePaperFormat = PAPER_A5;
+ break;
+ case( DMPAPER_B4 ):
+ pSetupData->mePaperFormat = PAPER_B4;
+ break;
+ case( DMPAPER_B5 ):
+ pSetupData->mePaperFormat = PAPER_B5;
+ break;
+ case( DMPAPER_LETTER ):
+ pSetupData->mePaperFormat = PAPER_LETTER;
+ break;
+ case( DMPAPER_LEGAL ):
+ pSetupData->mePaperFormat = PAPER_LEGAL;
+ break;
+ case( DMPAPER_TABLOID ):
+ pSetupData->mePaperFormat = PAPER_TABLOID;
+ break;
+ default:
+ pSetupData->mePaperFormat = PAPER_USER;
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplPaperSizeEqual( short nPaperWidth1, short nPaperHeight1,
+ short nPaperWidth2, short nPaperHeight2 )
+{
+ return (((nPaperWidth1 >= nPaperWidth2-1) && (nPaperWidth1 <= nPaperWidth2+1)) &&
+ ((nPaperHeight1 >= nPaperHeight2-1) && (nPaperHeight1 <= nPaperHeight2+1)));
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplJobSetupToDevMode( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, ULONG nFlags )
+{
+ if ( !pSetupData || !pSetupData->mpDriverData )
+ return;
+
+ DEVMODE* pDevMode = SAL_DEVMODE( pSetupData );
+
+ // Orientation
+ if ( nFlags & SAL_JOBSET_ORIENTATION )
+ {
+ pDevMode->dmFields |= DM_ORIENTATION;
+ if ( pSetupData->meOrientation == ORIENTATION_PORTRAIT )
+ pDevMode->dmOrientation = DMORIENT_PORTRAIT;
+ else
+ pDevMode->dmOrientation = DMORIENT_LANDSCAPE;
+ }
+
+ // PaperBin
+ if ( nFlags & SAL_JOBSET_PAPERBIN )
+ {
+ ULONG nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
+
+ if ( nCount && (nCount != ((ULONG)-1)) )
+ {
+ WORD* pBins = new WORD[nCount];
+ memset( pBins, 0, nCount*sizeof(WORD) );
+ ImplDeviceCaps( pPrinter, DC_BINS, (LPTSTR)pBins, pSetupData );
+ pDevMode->dmFields |= DM_DEFAULTSOURCE;
+ pDevMode->dmDefaultSource = pBins[ pSetupData->mnPaperBin ];
+ delete[] pBins;
+ }
+ }
+
+ // PaperSize
+ if ( nFlags & SAL_JOBSET_PAPERSIZE )
+ {
+ pDevMode->dmFields |= DM_PAPERSIZE;
+ pDevMode->dmPaperWidth = 0;
+ pDevMode->dmPaperLength = 0;
+
+ switch( pDevMode->dmPaperSize )
+ {
+ case( PAPER_A3 ):
+ pDevMode->dmPaperSize = DMPAPER_A3;
+ break;
+ case( PAPER_A4 ):
+ pDevMode->dmPaperSize = DMPAPER_A4;
+ break;
+ case( PAPER_A5 ):
+ pDevMode->dmPaperSize = DMPAPER_A5;
+ break;
+ case( PAPER_B4 ):
+ pDevMode->dmPaperSize = DMPAPER_B4;
+ break;
+ case( PAPER_B5 ):
+ pDevMode->dmPaperSize = DMPAPER_B5;
+ break;
+ case( PAPER_LETTER ):
+ pDevMode->dmPaperSize = DMPAPER_LETTER;
+ break;
+ case( PAPER_LEGAL ):
+ pDevMode->dmPaperSize = DMPAPER_LEGAL;
+ break;
+ case( PAPER_TABLOID ):
+ pDevMode->dmPaperSize = DMPAPER_TABLOID;
+ break;
+ default:
+ {
+ short nPaper = 0;
+ ULONG nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData );
+ WORD* pPapers = NULL;
+ ULONG nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData );
+ POINT* pPaperSizes = NULL;
+ if ( nPaperCount && (nPaperCount != ((ULONG)-1)) )
+ {
+ pPapers = new WORD[nPaperCount];
+ memset( pPapers, 0, nPaperCount*sizeof(WORD) );
+ ImplDeviceCaps( pPrinter, DC_PAPERS, (LPTSTR)pPapers, pSetupData );
+ }
+ if ( nPaperSizeCount && (nPaperSizeCount != ((ULONG)-1)) )
+ {
+ pPaperSizes = new POINT[nPaperSizeCount];
+ memset( pPaperSizes, 0, nPaperSizeCount*sizeof(POINT) );
+ ImplDeviceCaps( pPrinter, DC_PAPERSIZE, (LPTSTR)pPaperSizes, pSetupData );
+ }
+ if ( (nPaperSizeCount == nPaperCount) && pPapers && pPaperSizes )
+ {
+ // Alle Papierformate vergleichen und ein passendes
+ // raussuchen
+ for ( ULONG i = 0; i < nPaperCount; i++ )
+ {
+ if ( ImplPaperSizeEqual( (short)(pSetupData->mnPaperWidth/10),
+ (short)(pSetupData->mnPaperHeight/10),
+ (short)pPaperSizes[i].x,
+ (short)pPaperSizes[i].y ) )
+ {
+ nPaper = pPapers[i];
+ break;
+ }
+ }
+ }
+ if ( pPapers )
+ delete pPapers;
+ if ( pPaperSizes )
+ delete pPaperSizes;
+
+ if ( nPaper )
+ pDevMode->dmPaperSize = nPaper;
+ else
+ {
+ pDevMode->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH;
+ pDevMode->dmPaperSize = DMPAPER_USER;
+ pDevMode->dmPaperWidth = pSetupData->mnPaperWidth/10;
+ pDevMode->dmPaperLength = pSetupData->mnPaperHeight/10;
+ }
+ }
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static HDC ImplCreateSalPrnIC( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData )
+{
+ LPDEVMODE pDevMode;
+ if ( pSetupData && pSetupData->mpDriverData )
+ pDevMode = SAL_DEVMODE( pSetupData );
+ else
+ pDevMode = NULL;
+// !!! UNICODE - NT Optimierung !!!
+ HDC hDC = CreateICA( ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDriverName, TRUE ).GetBuffer(),
+ ImplSalGetWinAnsiString( pPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ 0,
+ (LPDEVMODE)pDevMode );
+ return hDC;
+}
+
+// -----------------------------------------------------------------------
+
+static SalGraphics* ImplCreateSalPrnGraphics( HDC hDC )
+{
+ SalGraphics* pGraphics = new SalGraphics;
+ pGraphics->maGraphicsData.mhDC = hDC;
+ pGraphics->maGraphicsData.mhWnd = 0;
+ pGraphics->maGraphicsData.mbPrinter = TRUE;
+ pGraphics->maGraphicsData.mbVirDev = FALSE;
+ pGraphics->maGraphicsData.mbWindow = FALSE;
+ pGraphics->maGraphicsData.mbScreen = FALSE;
+ ImplSalInitGraphics( &(pGraphics->maGraphicsData) );
+ return pGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplUpdateSalPrnIC( SalInfoPrinter* pPrinter, ImplJobSetup* pSetupData )
+{
+ HDC hNewDC = ImplCreateSalPrnIC( pPrinter, pSetupData );
+ if ( !hNewDC )
+ return FALSE;
+
+ if ( pPrinter->maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(pPrinter->maPrinterData.mpGraphics->maGraphicsData) );
+ DeleteDC( pPrinter->maPrinterData.mpGraphics->maGraphicsData.mhDC );
+ delete pPrinter->maPrinterData.mpGraphics;
+ }
+
+ SalGraphics* pGraphics = ImplCreateSalPrnGraphics( hNewDC );
+ pPrinter->maPrinterData.mhDC = hNewDC;
+ pPrinter->maPrinterData.mpGraphics = pGraphics;
+
+ return TRUE;
+}
+
+// =======================================================================
+
+SalInfoPrinter* SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
+ ImplJobSetup* pSetupData )
+{
+ SalInfoPrinter* pPrinter = new SalInfoPrinter;
+ pPrinter->maPrinterData.maDriverName = pQueueInfo->maDriver;
+ pPrinter->maPrinterData.maDeviceName = pQueueInfo->maPrinterName;
+ pPrinter->maPrinterData.maPortName = *(String*)(pQueueInfo->mpSysData);
+
+ // Testen, ob Setupdaten zum Drucker gehoeren (erst aufrufen, nachdem
+ // die Member gesetzt sind, da diese in dieser Routine abgefragt werden)
+ ImplTestSalJobSetup( pPrinter, pSetupData, TRUE );
+
+ HDC hDC = ImplCreateSalPrnIC( pPrinter, pSetupData );
+ if ( !hDC )
+ {
+ delete pPrinter;
+ return NULL;
+ }
+
+ SalGraphics* pGraphics = ImplCreateSalPrnGraphics( hDC );
+ pPrinter->maPrinterData.mhDC = hDC;
+ pPrinter->maPrinterData.mpGraphics = pGraphics;
+ if ( !pSetupData->mpDriverData )
+ ImplUpdateSalJobSetup( pPrinter, pSetupData, FALSE, NULL );
+ ImplDevModeToJobSetup( pPrinter, pSetupData, SAL_JOBSET_ALL );
+ pSetupData->mnSystem = JOBSETUP_SYSTEM_WINDOWS;
+
+ return pPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+// =======================================================================
+
+SalInfoPrinter::SalInfoPrinter()
+{
+ maPrinterData.mhDC = 0;
+ maPrinterData.mpGraphics = NULL;
+ maPrinterData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SalInfoPrinter::~SalInfoPrinter()
+{
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ DeleteDC( maPrinterData.mpGraphics->maGraphicsData.mhDC );
+ delete maPrinterData.mpGraphics;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalInfoPrinter::GetGraphics()
+{
+ if ( maPrinterData.mbGraphics )
+ return NULL;
+
+ if ( maPrinterData.mpGraphics )
+ maPrinterData.mbGraphics = TRUE;
+
+ return maPrinterData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInfoPrinter::ReleaseGraphics( SalGraphics* )
+{
+ maPrinterData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
+{
+ if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, pFrame ) )
+ {
+ ImplDevModeToJobSetup( this, pSetupData, SAL_JOBSET_ALL );
+ return ImplUpdateSalPrnIC( this, pSetupData );
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
+{
+ if ( !ImplTestSalJobSetup( this, pSetupData, FALSE ) )
+ return FALSE;
+ return ImplUpdateSalPrnIC( this, pSetupData );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
+{
+ ImplJobSetupToDevMode( this, pSetupData, nFlags );
+ if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, NULL ) )
+ {
+ ImplDevModeToJobSetup( this, pSetupData, nFlags );
+ return ImplUpdateSalPrnIC( this, pSetupData );
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData )
+{
+ DWORD nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return nRet;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin )
+{
+// !!! UNICODE - NT Optimierung !!!
+ XubString aPaperBinName;
+
+ DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, NULL, pSetupData );
+ if ( (nPaperBin < nBins) && (nBins != ((ULONG)-1)) )
+ {
+ char* pBuffer = new char[nBins*24];
+ DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, pBuffer, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ aPaperBinName = ImplSalGetUniString( (const char*)(pBuffer + (nPaperBin*24)) );
+ delete pBuffer;
+ }
+
+ return aPaperBinName;
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, USHORT nType )
+{
+ DWORD nRet;
+
+ switch ( nType )
+ {
+ case PRINTER_CAPABILITIES_SUPPORTDIALOG:
+ return TRUE;
+ case PRINTER_CAPABILITIES_COPIES:
+ nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return nRet;
+ return 0;
+ case PRINTER_CAPABILITIES_COLLATECOPIES:
+ if ( aSalShlData.mbW40 )
+ {
+ nRet = ImplDeviceCaps( this, DC_COLLATE, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ {
+ nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return nRet;
+ }
+ }
+ return 0;
+
+ case PRINTER_CAPABILITIES_SETORIENTATION:
+ nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return TRUE;
+ return FALSE;
+
+ case PRINTER_CAPABILITIES_SETPAPERBIN:
+ nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return TRUE;
+ return FALSE;
+
+ case PRINTER_CAPABILITIES_SETPAPERSIZE:
+ case PRINTER_CAPABILITIES_SETPAPER:
+ nRet = ImplDeviceCaps( this, DC_PAPERS, NULL, pSetupData );
+ if ( nRet && (nRet != ((ULONG)-1)) )
+ return TRUE;
+ return FALSE;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInfoPrinter::GetPageInfo( const ImplJobSetup*,
+ long& rOutWidth, long& rOutHeight,
+ long& rPageOffX, long& rPageOffY,
+ long& rPageWidth, long& rPageHeight )
+{
+ HDC hDC = maPrinterData.mhDC;
+
+ rOutWidth = GetDeviceCaps( hDC, HORZRES );
+ rOutHeight = GetDeviceCaps( hDC, VERTRES );
+
+ rPageOffX = GetDeviceCaps( hDC, PHYSICALOFFSETX );
+ rPageOffY = GetDeviceCaps( hDC, PHYSICALOFFSETY );
+ rPageWidth = GetDeviceCaps( hDC, PHYSICALWIDTH );
+ rPageHeight = GetDeviceCaps( hDC, PHYSICALHEIGHT );
+}
+
+// =======================================================================
+
+SalPrinter* SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter )
+{
+ SalPrinter* pPrinter = new SalPrinter;
+ pPrinter->maPrinterData.mpInfoPrinter = pInfoPrinter;
+ return pPrinter;
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyPrinter( SalPrinter* pPrinter )
+{
+ delete pPrinter;
+}
+
+// =======================================================================
+
+WIN_BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ )
+{
+ SalData* pSalData = GetSalData();
+ SalPrinter* pPrinter;
+ BOOL bWhile = TRUE;
+ int i = 0;
+
+ do
+ {
+ // Messages verarbeiten
+ MSG aMsg;
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplDispatchMessage( &aMsg );
+ i++;
+ if ( i > 15 )
+ bWhile = FALSE;
+ }
+ else
+ bWhile = FALSE;
+
+ pPrinter = pSalData->mpFirstPrinter;
+ while ( pPrinter )
+ {
+ if( pPrinter->maPrinterData.mhDC == hPrnDC )
+ break;
+
+ pPrinter = pPrinter->maPrinterData.mpNextPrinter;
+ }
+
+ if ( !pPrinter || pPrinter->maPrinterData.mbAbort )
+ return FALSE;
+ }
+ while ( bWhile );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+static LPDEVMODE ImplSalSetCopies( LPDEVMODE pDevMode, ULONG nCopies, BOOL bCollate )
+{
+ LPDEVMODE pNewDevMode = pDevMode;
+ if ( pDevMode && (nCopies > 1) )
+ {
+ if ( nCopies > 32765 )
+ nCopies = 32765;
+ ULONG nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra;
+ pNewDevMode = (LPDEVMODE)new BYTE[nDevSize];
+ memcpy( pNewDevMode, pDevMode, nDevSize );
+ pDevMode = pNewDevMode;
+ pDevMode->dmFields |= DM_COPIES;
+ pDevMode->dmCopies = (short)(USHORT)nCopies;
+ if ( aSalShlData.mbW40 )
+ {
+ pDevMode->dmFields |= DM_COLLATE;
+ if ( bCollate )
+ pDevMode->dmCollate = DMCOLLATE_TRUE;
+ else
+ pDevMode->dmCollate = DMCOLLATE_FALSE;
+ }
+ }
+
+ return pNewDevMode;
+}
+
+// -----------------------------------------------------------------------
+
+SalPrinter::SalPrinter()
+{
+ SalData* pSalData = GetSalData();
+
+ maPrinterData.mhDC = 0;
+ maPrinterData.mpGraphics = NULL;
+ maPrinterData.mbAbort = FALSE;
+ maPrinterData.mnCopies = 0;
+ maPrinterData.mbCollate = FALSE;
+
+ // insert frame in framelist
+ maPrinterData.mpNextPrinter = pSalData->mpFirstPrinter;
+ pSalData->mpFirstPrinter = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalPrinter::~SalPrinter()
+{
+ SalData* pSalData = GetSalData();
+
+ // DC freigeben, wenn er noch durch ein AbortJob existiert
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC )
+ {
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ }
+
+ DeleteDC( hDC );
+ }
+
+ // remove printer from printerlist
+ if ( this == pSalData->mpFirstPrinter )
+ pSalData->mpFirstPrinter = maPrinterData.mpNextPrinter;
+ else
+ {
+ SalPrinter* pTempPrinter = pSalData->mpFirstPrinter;
+
+ while( pTempPrinter->maPrinterData.mpNextPrinter != this )
+ pTempPrinter = pTempPrinter->maPrinterData.mpNextPrinter;
+
+ pTempPrinter->maPrinterData.mpNextPrinter = maPrinterData.mpNextPrinter;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::StartJob( const XubString* pFileName,
+ const XubString& rJobName,
+ const XubString&,
+ ULONG nCopies, BOOL bCollate,
+ ImplJobSetup* pSetupData )
+{
+ maPrinterData.mnError = 0;
+ maPrinterData.mbAbort = FALSE;
+ maPrinterData.mnCopies = nCopies;
+ maPrinterData.mbCollate = bCollate;
+
+ LPDEVMODE pOrgDevMode = NULL;
+ LPDEVMODE pDevMode;
+ BOOL bOwnDevMode = FALSE;
+ if ( pSetupData && pSetupData->mpDriverData )
+ {
+ pOrgDevMode = SAL_DEVMODE( pSetupData );
+ pDevMode = ImplSalSetCopies( pOrgDevMode, nCopies, bCollate );
+ }
+ else
+ pDevMode = NULL;
+
+// !!! UNICODE - NT Optimierung !!!
+ HDC hDC = CreateDCA( ImplSalGetWinAnsiString( maPrinterData.mpInfoPrinter->maPrinterData.maDriverName, TRUE ).GetBuffer(),
+ ImplSalGetWinAnsiString( maPrinterData.mpInfoPrinter->maPrinterData.maDeviceName, TRUE ).GetBuffer(),
+ 0,
+ (LPDEVMODEA)pDevMode );
+
+ if ( pDevMode != pOrgDevMode )
+ delete pDevMode;
+
+ if ( !hDC )
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+
+ if ( SetAbortProc( hDC, SalPrintAbortProc ) <= 0 )
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+
+ maPrinterData.mnError = 0;
+ maPrinterData.mbAbort = FALSE;
+
+// !!! UNICODE - NT Optimierung !!!
+ // Both strings must be exist, if StartJob() is called
+ ByteString aJobName( ImplSalGetWinAnsiString( rJobName, TRUE ) );
+ ByteString aFileName;
+
+ DOCINFO aInfo;
+ memset( &aInfo, 0, sizeof( DOCINFO ) );
+ aInfo.cbSize = sizeof( aInfo );
+ aInfo.lpszDocName = (LPCSTR)aJobName.GetBuffer();
+ if ( pFileName )
+ {
+ if ( pFileName->Len() )
+ {
+ aFileName = ImplSalGetWinAnsiString( *pFileName, TRUE );
+ aInfo.lpszOutput = (LPCSTR)aFileName.GetBuffer();
+ }
+ else
+ aInfo.lpszOutput = "FILE:";
+ }
+ else
+ aInfo.lpszOutput = NULL;
+
+ // Wegen Telocom Balloon Fax-Treiber, der uns unsere Messages
+ // ansonsten oefters schickt, versuchen wir vorher alle
+ // zu verarbeiten und dann eine Dummy-Message reinstellen
+ BOOL bWhile = TRUE;
+ int i = 0;
+ do
+ {
+ // Messages verarbeiten
+ MSG aMsg;
+ if ( ImplPeekMessage( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ {
+ TranslateMessage( &aMsg );
+ ImplDispatchMessage( &aMsg );
+ i++;
+ if ( i > 15 )
+ bWhile = FALSE;
+ }
+ else
+ bWhile = FALSE;
+ }
+ while ( bWhile );
+ ImplPostMessage( GetSalData()->mpFirstInstance->maInstData.mhComWnd, SAL_MSG_DUMMY, 0, 0 );
+
+ // Job starten
+ int nRet = ::StartDoc( hDC, &aInfo );
+ if ( nRet <= 0 )
+ {
+ if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (GetLastError() == ERROR_PRINT_CANCELLED) )
+ maPrinterData.mnError = SAL_PRINTER_ERROR_ABORT;
+ else
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+
+ maPrinterData.mhDC = hDC;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::EndJob()
+{
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC )
+ {
+ if ( maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ maPrinterData.mpGraphics = NULL;
+ }
+
+ ::EndDoc( hDC );
+ DeleteDC( hDC );
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::AbortJob()
+{
+ maPrinterData.mbAbort = TRUE;
+
+ // Abort asyncron ausloesen
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC )
+ {
+ SalData* pSalData = GetSalData();
+ ImplPostMessage( pSalData->mpFirstInstance->maInstData.mhComWnd,
+ SAL_MSG_PRINTABORTJOB, (WPARAM)hDC, 0 );
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalPrinterAbortJobAsync( HDC hPrnDC )
+{
+ SalData* pSalData = GetSalData();
+ SalPrinter* pPrinter = pSalData->mpFirstPrinter;
+
+ // Feststellen, ob Printer noch existiert
+ while ( pPrinter )
+ {
+ if ( pPrinter->maPrinterData.mhDC == hPrnDC )
+ break;
+
+ pPrinter = pPrinter->maPrinterData.mpNextPrinter;
+ }
+
+ // Wenn Printer noch existiert, dann den Job abbrechen
+ if ( pPrinter )
+ {
+ HDC hDC = pPrinter->maPrinterData.mhDC;
+ if ( hDC )
+ {
+ if ( pPrinter->maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(pPrinter->maPrinterData.mpGraphics->maGraphicsData) );
+ delete pPrinter->maPrinterData.mpGraphics;
+ pPrinter->maPrinterData.mpGraphics = NULL;
+ }
+
+ ::AbortDoc( hDC );
+ DeleteDC( hDC );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData )
+{
+ HDC hDC = maPrinterData.mhDC;
+ if ( pSetupData && pSetupData->mpDriverData && bNewJobData )
+ {
+ LPDEVMODE pOrgDevMode;
+ LPDEVMODE pDevMode;
+ pOrgDevMode = SAL_DEVMODE( pSetupData );
+ pDevMode = ImplSalSetCopies( pOrgDevMode, maPrinterData.mnCopies, maPrinterData.mbCollate );
+ ResetDC( hDC, pDevMode );
+ if ( pDevMode != pOrgDevMode )
+ delete pDevMode;
+ }
+ int nRet = ::StartPage( hDC );
+ if ( nRet <= 0 )
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return NULL;
+ }
+
+ // Hack, damit alte PS-Treiber Leerseiten nicht wegoptimieren
+ HPEN hTempPen = SelectPen( hDC, GetStockPen( NULL_PEN ) );
+ HBRUSH hTempBrush = SelectBrush( hDC, GetStockBrush( NULL_BRUSH ) );
+ WIN_Rectangle( hDC, -8000, -8000, -7999, -7999 );
+ SelectPen( hDC, hTempPen );
+ SelectBrush( hDC, hTempBrush );
+
+ SalGraphics* pGraphics = new SalGraphics;
+ pGraphics->maGraphicsData.mhDC = hDC;
+ pGraphics->maGraphicsData.mhWnd = 0;
+ pGraphics->maGraphicsData.mbPrinter = TRUE;
+ pGraphics->maGraphicsData.mbVirDev = FALSE;
+ pGraphics->maGraphicsData.mbWindow = FALSE;
+ pGraphics->maGraphicsData.mbScreen = FALSE;
+ ImplSalInitGraphics( &(pGraphics->maGraphicsData) );
+ maPrinterData.mpGraphics = pGraphics;
+ return pGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalPrinter::EndPage()
+{
+ HDC hDC = maPrinterData.mhDC;
+ if ( hDC && maPrinterData.mpGraphics )
+ {
+ ImplSalDeInitGraphics( &(maPrinterData.mpGraphics->maGraphicsData) );
+ delete maPrinterData.mpGraphics;
+ maPrinterData.mpGraphics = NULL;
+ }
+ int nRet = ::EndPage( hDC );
+ if ( nRet > 0 )
+ return TRUE;
+ else
+ {
+ maPrinterData.mnError = SAL_PRINTER_ERROR_GENERALERROR;
+ return FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SalPrinter::GetErrorCode()
+{
+ return maPrinterData.mnError;
+}
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
new file mode 100644
index 000000000000..d9f79ce479a8
--- /dev/null
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * $RCSfile: salvd.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVWIN_H
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALVD_CXX
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+
+// =======================================================================
+
+static HBITMAP ImplCreateVirDevBitmap( HDC hDC, long nDX, long nDY,
+ USHORT nBitCount )
+{
+ HBITMAP hBitmap;
+
+ if ( nBitCount == 1 )
+ hBitmap = CreateBitmap( (int)nDX, (int)nDY, 1, 1, NULL );
+ else
+ hBitmap = CreateCompatibleBitmap( hDC, (int)nDX, (int)nDY );
+
+ return hBitmap;
+}
+
+// =======================================================================
+
+SalVirtualDevice* SalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
+ long nDX, long nDY,
+ USHORT nBitCount )
+{
+ HDC hDC = CreateCompatibleDC( pGraphics->maGraphicsData.mhDC );
+ HBITMAP hBmp = ImplCreateVirDevBitmap( pGraphics->maGraphicsData.mhDC,
+ nDX, nDY, nBitCount );
+
+ if ( hDC && hBmp )
+ {
+ SalVirtualDevice* pVDev = new SalVirtualDevice;
+ SalData* pSalData = GetSalData();
+ SalGraphics* pVirGraphics = new SalGraphics;
+ pVirGraphics->maGraphicsData.mhDC = hDC;
+ pVirGraphics->maGraphicsData.mhWnd = 0;
+ pVirGraphics->maGraphicsData.mbPrinter = FALSE;
+ pVirGraphics->maGraphicsData.mbVirDev = TRUE;
+ pVirGraphics->maGraphicsData.mbWindow = FALSE;
+ pVirGraphics->maGraphicsData.mbScreen = pGraphics->maGraphicsData.mbScreen;
+ if ( pSalData->mhDitherPal && pVirGraphics->maGraphicsData.mbScreen )
+ {
+ pVirGraphics->maGraphicsData.mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( hDC );
+ }
+ ImplSalInitGraphics( &(pVirGraphics->maGraphicsData) );
+
+ pVDev->maVirDevData.mhDC = hDC;
+ pVDev->maVirDevData.mhBmp = hBmp;
+ pVDev->maVirDevData.mhDefBmp = SelectBitmap( hDC, hBmp );
+ pVDev->maVirDevData.mpGraphics = pVirGraphics;
+ pVDev->maVirDevData.mnBitCount = nBitCount;
+ pVDev->maVirDevData.mbGraphics = FALSE;
+
+ // insert VirDev in VirDevList
+ pVDev->maVirDevData.mpNext = pSalData->mpFirstVD;
+ pSalData->mpFirstVD = pVDev;
+
+ return pVDev;
+ }
+ else
+ {
+ if ( hDC )
+ DeleteDC( hDC );
+ if ( hBmp )
+ DeleteBitmap( hBmp );
+ return NULL;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalInstance::DestroyVirtualDevice( SalVirtualDevice* pDevice )
+{
+ delete pDevice;
+}
+
+// =======================================================================
+
+SalVirtualDevice::SalVirtualDevice()
+{
+}
+
+// -----------------------------------------------------------------------
+
+SalVirtualDevice::~SalVirtualDevice()
+{
+ SalData* pSalData = GetSalData();
+
+ // destroy saved DC
+ if ( maVirDevData.mpGraphics->maGraphicsData.mhDefPal )
+ SelectPalette( maVirDevData.mpGraphics->maGraphicsData.mhDC, maVirDevData.mpGraphics->maGraphicsData.mhDefPal, TRUE );
+ ImplSalDeInitGraphics( &(maVirDevData.mpGraphics->maGraphicsData) );
+ SelectBitmap( maVirDevData.mpGraphics->maGraphicsData.mhDC, maVirDevData.mhDefBmp );
+ DeleteDC( maVirDevData.mpGraphics->maGraphicsData.mhDC );
+ DeleteBitmap( maVirDevData.mhBmp );
+ delete maVirDevData.mpGraphics;
+
+ // remove VirDev from VirDevList
+ if ( this == pSalData->mpFirstVD )
+ pSalData->mpFirstVD = maVirDevData.mpNext;
+ else
+ {
+ SalVirtualDevice* pTempVD = pSalData->mpFirstVD;
+ while ( pTempVD->maVirDevData.mpNext != this )
+ pTempVD = pTempVD->maVirDevData.mpNext;
+
+ pTempVD->maVirDevData.mpNext = maVirDevData.mpNext;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalVirtualDevice::GetGraphics()
+{
+ if ( maVirDevData.mbGraphics )
+ return NULL;
+
+ if ( maVirDevData.mpGraphics )
+ maVirDevData.mbGraphics = TRUE;
+
+ return maVirDevData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalVirtualDevice::ReleaseGraphics( SalGraphics* )
+{
+ maVirDevData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalVirtualDevice::SetSize( long nDX, long nDY )
+{
+ HBITMAP hNewBmp = ImplCreateVirDevBitmap( maVirDevData.mhDC, nDX, nDY,
+ maVirDevData.mnBitCount );
+ if ( hNewBmp )
+ {
+ SelectBitmap( maVirDevData.mhDC, hNewBmp );
+ DeleteBitmap( maVirDevData.mhBmp );
+ maVirDevData.mhBmp = hNewBmp;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
diff --git a/vcl/win/source/gdi/wntgdi.cxx b/vcl/win/source/gdi/wntgdi.cxx
new file mode 100644
index 000000000000..0bd7751c97e9
--- /dev/null
+++ b/vcl/win/source/gdi/wntgdi.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * $RCSfile: wntgdi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:49 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <windows.h>
+
+// -----------------------------------------------------------------------
+
+extern "C"
+{
+BOOL WINAPI WIN_Rectangle( HDC hDC, int X1, int Y1, int X2, int Y2 )
+{
+ return Rectangle( hDC, X1, Y1, X2, Y2 );
+}
+}
+
+// -----------------------------------------------------------------------
+
+extern "C"
+{
+BOOL WINAPI WIN_Polygon( HDC hDC, CONST POINT * ppt, int ncnt )
+{
+ return Polygon( hDC, ppt, ncnt );
+}
+}
+
+// -----------------------------------------------------------------------
+
+extern "C"
+{
+BOOL WINAPI WIN_PolyPolygon( HDC hDC, CONST POINT * ppt, LPINT npcnt, int ncnt )
+{
+ return PolyPolygon( hDC, ppt, npcnt, ncnt );
+}
+}
diff --git a/vcl/win/source/src/50.bmp b/vcl/win/source/src/50.bmp
new file mode 100644
index 000000000000..b9d56fcd14c1
--- /dev/null
+++ b/vcl/win/source/src/50.bmp
Binary files differ
diff --git a/vcl/win/source/src/MAKEFILE.MK b/vcl/win/source/src/MAKEFILE.MK
new file mode 100644
index 000000000000..463741b23bb7
--- /dev/null
+++ b/vcl/win/source/src/MAKEFILE.MK
@@ -0,0 +1,106 @@
+#*************************************************************************
+#*
+#* $Workfile: makefile. $
+#*
+#* Ersterstellung TH 01.04.97
+#* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 17:05:49 $
+#* $Revision: 1.1.1.1 $
+#*
+#* $Logfile: T:/vcl/win/source/src/makefile.__v $
+#*
+#* Copyright (c) 1990 - 2000, STAR DIVISION
+#*
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salsrc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+RCDEPN= nullptr.cur \
+ help.cur \
+ hsize.cur \
+ vsize.cur \
+ neswsize.cur \
+ nwsesize.cur \
+ cross.cur \
+ move.cur \
+ hsplit.cur \
+ vsplit.cur \
+ hsizebar.cur \
+ vsizebar.cur \
+ hand.cur \
+ refhand.cur \
+ pen.cur \
+ magnify.cur \
+ fill.cur \
+ rotate.cur \
+ hshear.cur \
+ vshear.cur \
+ mirror.cur \
+ crook.cur \
+ crop.cur \
+ movept.cur \
+ movebw.cur \
+ movedata.cur \
+ copydata.cur \
+ linkdata.cur \
+ movedlnk.cur \
+ copydlnk.cur \
+ movef.cur \
+ copyf.cur \
+ linkf.cur \
+ moveflnk.cur \
+ copyflnk.cur \
+ movef2.cur \
+ copyf2.cur \
+ notallow.cur \
+ dline.cur \
+ drect.cur \
+ dpolygon.cur \
+ dbezier.cur \
+ darc.cur \
+ dpie.cur \
+ dcirccut.cur \
+ dellipse.cur \
+ dfree.cur \
+ dconnect.cur \
+ dtext.cur \
+ dcapt.cur \
+ chart.cur \
+ detectiv.cur \
+ pivotcol.cur \
+ pivotrow.cur \
+ pivotfld.cur \
+ chain.cur \
+ chainnot.cur \
+ timemove.cur \
+ timesize.cur \
+ asn.cur \
+ ass.cur \
+ asw.cur \
+ ase.cur \
+ asnw.cur \
+ asne.cur \
+ assw.cur \
+ asse.cur \
+ asns.cur \
+ aswe.cur \
+ asnswe.cur \
+ airbrush.cur \
+ 50.bmp \
+ sd.ico
+
+RCFILES= salsrc.rc
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/win/source/src/airbrush.cur b/vcl/win/source/src/airbrush.cur
new file mode 100644
index 000000000000..f6a684e6fcbd
--- /dev/null
+++ b/vcl/win/source/src/airbrush.cur
Binary files differ
diff --git a/vcl/win/source/src/ase.cur b/vcl/win/source/src/ase.cur
new file mode 100755
index 000000000000..7634a7d34a7b
--- /dev/null
+++ b/vcl/win/source/src/ase.cur
Binary files differ
diff --git a/vcl/win/source/src/asn.cur b/vcl/win/source/src/asn.cur
new file mode 100755
index 000000000000..e444e42bf37e
--- /dev/null
+++ b/vcl/win/source/src/asn.cur
Binary files differ
diff --git a/vcl/win/source/src/asne.cur b/vcl/win/source/src/asne.cur
new file mode 100755
index 000000000000..e92cc65e7eb1
--- /dev/null
+++ b/vcl/win/source/src/asne.cur
Binary files differ
diff --git a/vcl/win/source/src/asns.cur b/vcl/win/source/src/asns.cur
new file mode 100755
index 000000000000..04d0b09c353e
--- /dev/null
+++ b/vcl/win/source/src/asns.cur
Binary files differ
diff --git a/vcl/win/source/src/asnswe.cur b/vcl/win/source/src/asnswe.cur
new file mode 100755
index 000000000000..a0e25b16de1f
--- /dev/null
+++ b/vcl/win/source/src/asnswe.cur
Binary files differ
diff --git a/vcl/win/source/src/asnw.cur b/vcl/win/source/src/asnw.cur
new file mode 100755
index 000000000000..20322bc97b16
--- /dev/null
+++ b/vcl/win/source/src/asnw.cur
Binary files differ
diff --git a/vcl/win/source/src/ass.cur b/vcl/win/source/src/ass.cur
new file mode 100755
index 000000000000..7166636a1a77
--- /dev/null
+++ b/vcl/win/source/src/ass.cur
Binary files differ
diff --git a/vcl/win/source/src/asse.cur b/vcl/win/source/src/asse.cur
new file mode 100755
index 000000000000..8cb71234b0a9
--- /dev/null
+++ b/vcl/win/source/src/asse.cur
Binary files differ
diff --git a/vcl/win/source/src/assw.cur b/vcl/win/source/src/assw.cur
new file mode 100755
index 000000000000..fddaf3f57cbf
--- /dev/null
+++ b/vcl/win/source/src/assw.cur
Binary files differ
diff --git a/vcl/win/source/src/asw.cur b/vcl/win/source/src/asw.cur
new file mode 100755
index 000000000000..0ccac50f4596
--- /dev/null
+++ b/vcl/win/source/src/asw.cur
Binary files differ
diff --git a/vcl/win/source/src/aswe.cur b/vcl/win/source/src/aswe.cur
new file mode 100755
index 000000000000..c238b7e10aef
--- /dev/null
+++ b/vcl/win/source/src/aswe.cur
Binary files differ
diff --git a/vcl/win/source/src/chain.cur b/vcl/win/source/src/chain.cur
new file mode 100755
index 000000000000..02abb7ab714f
--- /dev/null
+++ b/vcl/win/source/src/chain.cur
Binary files differ
diff --git a/vcl/win/source/src/chainnot.cur b/vcl/win/source/src/chainnot.cur
new file mode 100755
index 000000000000..938ece03f329
--- /dev/null
+++ b/vcl/win/source/src/chainnot.cur
Binary files differ
diff --git a/vcl/win/source/src/chart.cur b/vcl/win/source/src/chart.cur
new file mode 100644
index 000000000000..25fe85b76039
--- /dev/null
+++ b/vcl/win/source/src/chart.cur
Binary files differ
diff --git a/vcl/win/source/src/copydata.cur b/vcl/win/source/src/copydata.cur
new file mode 100644
index 000000000000..d3c4bc93afd5
--- /dev/null
+++ b/vcl/win/source/src/copydata.cur
Binary files differ
diff --git a/vcl/win/source/src/copydlnk.cur b/vcl/win/source/src/copydlnk.cur
new file mode 100644
index 000000000000..495fd5e17776
--- /dev/null
+++ b/vcl/win/source/src/copydlnk.cur
Binary files differ
diff --git a/vcl/win/source/src/copyf.cur b/vcl/win/source/src/copyf.cur
new file mode 100644
index 000000000000..450c09443a84
--- /dev/null
+++ b/vcl/win/source/src/copyf.cur
Binary files differ
diff --git a/vcl/win/source/src/copyf2.cur b/vcl/win/source/src/copyf2.cur
new file mode 100644
index 000000000000..ac8de5da6ba5
--- /dev/null
+++ b/vcl/win/source/src/copyf2.cur
Binary files differ
diff --git a/vcl/win/source/src/copyflnk.cur b/vcl/win/source/src/copyflnk.cur
new file mode 100644
index 000000000000..e67f0539fa43
--- /dev/null
+++ b/vcl/win/source/src/copyflnk.cur
Binary files differ
diff --git a/vcl/win/source/src/crook.cur b/vcl/win/source/src/crook.cur
new file mode 100644
index 000000000000..c40cf591e261
--- /dev/null
+++ b/vcl/win/source/src/crook.cur
Binary files differ
diff --git a/vcl/win/source/src/crop.cur b/vcl/win/source/src/crop.cur
new file mode 100644
index 000000000000..327fb06976c2
--- /dev/null
+++ b/vcl/win/source/src/crop.cur
Binary files differ
diff --git a/vcl/win/source/src/cross.cur b/vcl/win/source/src/cross.cur
new file mode 100644
index 000000000000..8fd9762386b1
--- /dev/null
+++ b/vcl/win/source/src/cross.cur
Binary files differ
diff --git a/vcl/win/source/src/darc.cur b/vcl/win/source/src/darc.cur
new file mode 100644
index 000000000000..38504fa23c4a
--- /dev/null
+++ b/vcl/win/source/src/darc.cur
Binary files differ
diff --git a/vcl/win/source/src/dbezier.cur b/vcl/win/source/src/dbezier.cur
new file mode 100644
index 000000000000..f630b837ddf8
--- /dev/null
+++ b/vcl/win/source/src/dbezier.cur
Binary files differ
diff --git a/vcl/win/source/src/dcapt.cur b/vcl/win/source/src/dcapt.cur
new file mode 100644
index 000000000000..10dd5ba0d676
--- /dev/null
+++ b/vcl/win/source/src/dcapt.cur
Binary files differ
diff --git a/vcl/win/source/src/dcirccut.cur b/vcl/win/source/src/dcirccut.cur
new file mode 100644
index 000000000000..b19d3f8257f4
--- /dev/null
+++ b/vcl/win/source/src/dcirccut.cur
Binary files differ
diff --git a/vcl/win/source/src/dconnect.cur b/vcl/win/source/src/dconnect.cur
new file mode 100644
index 000000000000..5318d8f22d8b
--- /dev/null
+++ b/vcl/win/source/src/dconnect.cur
Binary files differ
diff --git a/vcl/win/source/src/dellipse.cur b/vcl/win/source/src/dellipse.cur
new file mode 100644
index 000000000000..c489a640335e
--- /dev/null
+++ b/vcl/win/source/src/dellipse.cur
Binary files differ
diff --git a/vcl/win/source/src/detectiv.cur b/vcl/win/source/src/detectiv.cur
new file mode 100644
index 000000000000..30e5685b64b2
--- /dev/null
+++ b/vcl/win/source/src/detectiv.cur
Binary files differ
diff --git a/vcl/win/source/src/dfree.cur b/vcl/win/source/src/dfree.cur
new file mode 100644
index 000000000000..3ff56d007648
--- /dev/null
+++ b/vcl/win/source/src/dfree.cur
Binary files differ
diff --git a/vcl/win/source/src/dline.cur b/vcl/win/source/src/dline.cur
new file mode 100644
index 000000000000..623c33ac2351
--- /dev/null
+++ b/vcl/win/source/src/dline.cur
Binary files differ
diff --git a/vcl/win/source/src/dpie.cur b/vcl/win/source/src/dpie.cur
new file mode 100644
index 000000000000..3b911cd01e43
--- /dev/null
+++ b/vcl/win/source/src/dpie.cur
Binary files differ
diff --git a/vcl/win/source/src/dpolygon.cur b/vcl/win/source/src/dpolygon.cur
new file mode 100644
index 000000000000..9467f1e286aa
--- /dev/null
+++ b/vcl/win/source/src/dpolygon.cur
Binary files differ
diff --git a/vcl/win/source/src/drect.cur b/vcl/win/source/src/drect.cur
new file mode 100644
index 000000000000..60a5242c203c
--- /dev/null
+++ b/vcl/win/source/src/drect.cur
Binary files differ
diff --git a/vcl/win/source/src/dtext.cur b/vcl/win/source/src/dtext.cur
new file mode 100644
index 000000000000..01e7d31eae7e
--- /dev/null
+++ b/vcl/win/source/src/dtext.cur
Binary files differ
diff --git a/vcl/win/source/src/fill.cur b/vcl/win/source/src/fill.cur
new file mode 100644
index 000000000000..78f5fad87ad0
--- /dev/null
+++ b/vcl/win/source/src/fill.cur
Binary files differ
diff --git a/vcl/win/source/src/hand.cur b/vcl/win/source/src/hand.cur
new file mode 100644
index 000000000000..fc0e53b474e2
--- /dev/null
+++ b/vcl/win/source/src/hand.cur
Binary files differ
diff --git a/vcl/win/source/src/help.cur b/vcl/win/source/src/help.cur
new file mode 100644
index 000000000000..e59ee97992b3
--- /dev/null
+++ b/vcl/win/source/src/help.cur
Binary files differ
diff --git a/vcl/win/source/src/hshear.cur b/vcl/win/source/src/hshear.cur
new file mode 100644
index 000000000000..5cf2211458c3
--- /dev/null
+++ b/vcl/win/source/src/hshear.cur
Binary files differ
diff --git a/vcl/win/source/src/hsize.cur b/vcl/win/source/src/hsize.cur
new file mode 100644
index 000000000000..571dd0ef703c
--- /dev/null
+++ b/vcl/win/source/src/hsize.cur
Binary files differ
diff --git a/vcl/win/source/src/hsizebar.cur b/vcl/win/source/src/hsizebar.cur
new file mode 100644
index 000000000000..dda3483bb5d4
--- /dev/null
+++ b/vcl/win/source/src/hsizebar.cur
Binary files differ
diff --git a/vcl/win/source/src/hsplit.cur b/vcl/win/source/src/hsplit.cur
new file mode 100644
index 000000000000..f2f0be363d3a
--- /dev/null
+++ b/vcl/win/source/src/hsplit.cur
Binary files differ
diff --git a/vcl/win/source/src/linkdata.cur b/vcl/win/source/src/linkdata.cur
new file mode 100644
index 000000000000..e47c1dea2cec
--- /dev/null
+++ b/vcl/win/source/src/linkdata.cur
Binary files differ
diff --git a/vcl/win/source/src/linkf.cur b/vcl/win/source/src/linkf.cur
new file mode 100644
index 000000000000..6cc498a02610
--- /dev/null
+++ b/vcl/win/source/src/linkf.cur
Binary files differ
diff --git a/vcl/win/source/src/mirror.cur b/vcl/win/source/src/mirror.cur
new file mode 100644
index 000000000000..e05eb836eb5d
--- /dev/null
+++ b/vcl/win/source/src/mirror.cur
Binary files differ
diff --git a/vcl/win/source/src/move.cur b/vcl/win/source/src/move.cur
new file mode 100644
index 000000000000..a407a1298ad5
--- /dev/null
+++ b/vcl/win/source/src/move.cur
Binary files differ
diff --git a/vcl/win/source/src/movebw.cur b/vcl/win/source/src/movebw.cur
new file mode 100644
index 000000000000..d079eb9fe20d
--- /dev/null
+++ b/vcl/win/source/src/movebw.cur
Binary files differ
diff --git a/vcl/win/source/src/movedata.cur b/vcl/win/source/src/movedata.cur
new file mode 100644
index 000000000000..4d67cbe47149
--- /dev/null
+++ b/vcl/win/source/src/movedata.cur
Binary files differ
diff --git a/vcl/win/source/src/movedlnk.cur b/vcl/win/source/src/movedlnk.cur
new file mode 100644
index 000000000000..1bb7b0306406
--- /dev/null
+++ b/vcl/win/source/src/movedlnk.cur
Binary files differ
diff --git a/vcl/win/source/src/movef.cur b/vcl/win/source/src/movef.cur
new file mode 100644
index 000000000000..6abee2381dcf
--- /dev/null
+++ b/vcl/win/source/src/movef.cur
Binary files differ
diff --git a/vcl/win/source/src/movef2.cur b/vcl/win/source/src/movef2.cur
new file mode 100644
index 000000000000..d044981a3ffd
--- /dev/null
+++ b/vcl/win/source/src/movef2.cur
Binary files differ
diff --git a/vcl/win/source/src/moveflnk.cur b/vcl/win/source/src/moveflnk.cur
new file mode 100644
index 000000000000..630fa1bc3e4e
--- /dev/null
+++ b/vcl/win/source/src/moveflnk.cur
Binary files differ
diff --git a/vcl/win/source/src/movept.cur b/vcl/win/source/src/movept.cur
new file mode 100644
index 000000000000..81d3af5a05c4
--- /dev/null
+++ b/vcl/win/source/src/movept.cur
Binary files differ
diff --git a/vcl/win/source/src/neswsize.cur b/vcl/win/source/src/neswsize.cur
new file mode 100644
index 000000000000..c38501ee15a8
--- /dev/null
+++ b/vcl/win/source/src/neswsize.cur
Binary files differ
diff --git a/vcl/win/source/src/notallow.cur b/vcl/win/source/src/notallow.cur
new file mode 100644
index 000000000000..90c1dfbb3a97
--- /dev/null
+++ b/vcl/win/source/src/notallow.cur
Binary files differ
diff --git a/vcl/win/source/src/nullptr.cur b/vcl/win/source/src/nullptr.cur
new file mode 100644
index 000000000000..28dbb2a903f2
--- /dev/null
+++ b/vcl/win/source/src/nullptr.cur
Binary files differ
diff --git a/vcl/win/source/src/nwsesize.cur b/vcl/win/source/src/nwsesize.cur
new file mode 100644
index 000000000000..570cbbb571cc
--- /dev/null
+++ b/vcl/win/source/src/nwsesize.cur
Binary files differ
diff --git a/vcl/win/source/src/pen.cur b/vcl/win/source/src/pen.cur
new file mode 100644
index 000000000000..040c5dc703e9
--- /dev/null
+++ b/vcl/win/source/src/pen.cur
Binary files differ
diff --git a/vcl/win/source/src/refhand.cur b/vcl/win/source/src/refhand.cur
new file mode 100644
index 000000000000..a654974c6f8b
--- /dev/null
+++ b/vcl/win/source/src/refhand.cur
Binary files differ
diff --git a/vcl/win/source/src/rotate.cur b/vcl/win/source/src/rotate.cur
new file mode 100644
index 000000000000..43c2a54a10ac
--- /dev/null
+++ b/vcl/win/source/src/rotate.cur
Binary files differ
diff --git a/vcl/win/source/src/salsrc.rc b/vcl/win/source/src/salsrc.rc
new file mode 100644
index 000000000000..d7785d3ee734
--- /dev/null
+++ b/vcl/win/source/src/salsrc.rc
@@ -0,0 +1,148 @@
+/*************************************************************************
+*
+* $RCSfile: salsrc.rc,v $
+*
+* $Revision: 1.1.1.1 $
+*
+* last change: $Author: hr $ $Date: 2000-09-18 17:05:50 $
+*
+* The Contents of this file are made available subject to the terms of
+* either of the following licenses
+*
+* - GNU Lesser General Public License Version 2.1
+* - Sun Industry Standards Source License Version 1.1
+*
+* Sun Microsystems Inc., October, 2000
+*
+* GNU Lesser General Public License Version 2.1
+* =============================================
+* Copyright 2000 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
+*
+*
+* Sun Industry Standards Source License Version 1.1
+* =================================================
+* The contents of this file are subject to the Sun Industry Standards
+* Source License Version 1.1 (the "License"); You may not use this file
+* except in compliance with the License. You may obtain a copy of the
+* License at http://www.openoffice.org/license.html.
+*
+* Software provided under this License is provided on an "AS IS" basis,
+* WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+* WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+* See the License for the specific provisions governing your rights and
+* obligations concerning the Software.
+*
+* The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+*
+* Copyright: 2000 by Sun Microsystems, Inc.
+*
+* All Rights Reserved.
+*
+* Contributor(s): _______________________________________
+*
+*
+*
+**************************************************************************/
+
+// for WINVER
+#include <windows.h>
+
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+
+SAL_RESID_POINTER_NULL CURSOR NULLPTR.CUR
+#if ( WINVER < 0x0400 )
+SAL_RESID_POINTER_HELP CURSOR HELP.CUR
+#endif
+#ifndef WNT
+SAL_RESID_POINTER_HSIZE CURSOR HSIZE.CUR
+SAL_RESID_POINTER_VSIZE CURSOR VSIZE.CUR
+SAL_RESID_POINTER_NESWSIZE CURSOR NESWSIZE.CUR
+SAL_RESID_POINTER_NWSESIZE CURSOR NWSESIZE.CUR
+#endif
+SAL_RESID_POINTER_CROSS CURSOR CROSS.CUR
+SAL_RESID_POINTER_MOVE CURSOR MOVE.CUR
+SAL_RESID_POINTER_HSPLIT CURSOR HSPLIT.CUR
+SAL_RESID_POINTER_VSPLIT CURSOR VSPLIT.CUR
+SAL_RESID_POINTER_HSIZEBAR CURSOR HSIZEBAR.CUR
+SAL_RESID_POINTER_VSIZEBAR CURSOR VSIZEBAR.CUR
+SAL_RESID_POINTER_HAND CURSOR HAND.CUR
+SAL_RESID_POINTER_REFHAND CURSOR REFHAND.CUR
+SAL_RESID_POINTER_PEN CURSOR PEN.CUR
+SAL_RESID_POINTER_MAGNIFY CURSOR MAGNIFY.CUR
+SAL_RESID_POINTER_FILL CURSOR FILL.CUR
+SAL_RESID_POINTER_ROTATE CURSOR ROTATE.CUR
+SAL_RESID_POINTER_HSHEAR CURSOR HSHEAR.CUR
+SAL_RESID_POINTER_VSHEAR CURSOR VSHEAR.CUR
+SAL_RESID_POINTER_MIRROR CURSOR MIRROR.CUR
+SAL_RESID_POINTER_CROOK CURSOR CROOK.CUR
+SAL_RESID_POINTER_CROP CURSOR CROP.CUR
+SAL_RESID_POINTER_MOVEPOINT CURSOR MOVEPT.CUR
+SAL_RESID_POINTER_MOVEBEZIERWEIGHT CURSOR MOVEBW.CUR
+SAL_RESID_POINTER_MOVEDATA CURSOR MOVEDATA.CUR
+SAL_RESID_POINTER_COPYDATA CURSOR COPYDATA.CUR
+SAL_RESID_POINTER_LINKDATA CURSOR LINKDATA.CUR
+SAL_RESID_POINTER_MOVEDATALINK CURSOR MOVEDLNK.CUR
+SAL_RESID_POINTER_COPYDATALINK CURSOR COPYDLNK.CUR
+SAL_RESID_POINTER_MOVEFILE CURSOR MOVEF.CUR
+SAL_RESID_POINTER_COPYFILE CURSOR COPYF.CUR
+SAL_RESID_POINTER_LINKFILE CURSOR LINKF.CUR
+SAL_RESID_POINTER_MOVEFILELINK CURSOR MOVEFLNK.CUR
+SAL_RESID_POINTER_COPYFILELINK CURSOR COPYFLNK.CUR
+SAL_RESID_POINTER_MOVEFILES CURSOR MOVEF2.CUR
+SAL_RESID_POINTER_COPYFILES CURSOR COPYF2.CUR
+SAL_RESID_POINTER_NOTALLOWED CURSOR NOTALLOW.CUR
+SAL_RESID_POINTER_DRAW_LINE CURSOR DLINE.CUR
+SAL_RESID_POINTER_DRAW_RECT CURSOR DRECT.CUR
+SAL_RESID_POINTER_DRAW_POLYGON CURSOR DPOLYGON.CUR
+SAL_RESID_POINTER_DRAW_BEZIER CURSOR DBEZIER.CUR
+SAL_RESID_POINTER_DRAW_ARC CURSOR DARC.CUR
+SAL_RESID_POINTER_DRAW_PIE CURSOR DPIE.CUR
+SAL_RESID_POINTER_DRAW_CIRCLECUT CURSOR DCIRCCUT.CUR
+SAL_RESID_POINTER_DRAW_ELLIPSE CURSOR DELLIPSE.CUR
+SAL_RESID_POINTER_DRAW_FREEHAND CURSOR DFREE.CUR
+SAL_RESID_POINTER_DRAW_CONNECT CURSOR DCONNECT.CUR
+SAL_RESID_POINTER_DRAW_TEXT CURSOR DTEXT.CUR
+SAL_RESID_POINTER_DRAW_CAPTION CURSOR DCAPT.CUR
+SAL_RESID_POINTER_CHART CURSOR CHART.CUR
+SAL_RESID_POINTER_DETECTIVE CURSOR DETECTIV.CUR
+SAL_RESID_POINTER_PIVOT_COL CURSOR PIVOTCOL.CUR
+SAL_RESID_POINTER_PIVOT_ROW CURSOR PIVOTROW.CUR
+SAL_RESID_POINTER_PIVOT_FIELD CURSOR PIVOTFLD.CUR
+SAL_RESID_POINTER_CHAIN CURSOR CHAIN.CUR
+SAL_RESID_POINTER_CHAIN_NOTALLOWED CURSOR CHAINNOT.CUR
+SAL_RESID_POINTER_TIMEEVENT_MOVE CURSOR TIMEMOVE.CUR
+SAL_RESID_POINTER_TIMEEVENT_SIZE CURSOR TIMESIZE.CUR
+SAL_RESID_POINTER_AUTOSCROLL_N CURSOR ASN.CUR
+SAL_RESID_POINTER_AUTOSCROLL_S CURSOR ASS.CUR
+SAL_RESID_POINTER_AUTOSCROLL_W CURSOR ASW.CUR
+SAL_RESID_POINTER_AUTOSCROLL_E CURSOR ASE.CUR
+SAL_RESID_POINTER_AUTOSCROLL_NW CURSOR ASNW.CUR
+SAL_RESID_POINTER_AUTOSCROLL_NE CURSOR ASNE.CUR
+SAL_RESID_POINTER_AUTOSCROLL_SW CURSOR ASSW.CUR
+SAL_RESID_POINTER_AUTOSCROLL_SE CURSOR ASSE.CUR
+SAL_RESID_POINTER_AUTOSCROLL_NS CURSOR ASNS.CUR
+SAL_RESID_POINTER_AUTOSCROLL_WE CURSOR ASWE.CUR
+SAL_RESID_POINTER_AUTOSCROLL_NSWE CURSOR ASNSWE.CUR
+SAL_RESID_POINTER_AIRBRUSH CURSOR AIRBRUSH.CUR
+
+SAL_RESID_BITMAP_50 BITMAP 50.BMP
+
+SAL_RESID_ICON_DEFAULT ICON SD.ICO
diff --git a/vcl/win/source/src/sd.ico b/vcl/win/source/src/sd.ico
new file mode 100644
index 000000000000..b2a0a07a67c3
--- /dev/null
+++ b/vcl/win/source/src/sd.ico
Binary files differ
diff --git a/vcl/win/source/src/timemove.cur b/vcl/win/source/src/timemove.cur
new file mode 100755
index 000000000000..319b6edc5774
--- /dev/null
+++ b/vcl/win/source/src/timemove.cur
Binary files differ
diff --git a/vcl/win/source/src/timesize.cur b/vcl/win/source/src/timesize.cur
new file mode 100755
index 000000000000..1ec23de05b71
--- /dev/null
+++ b/vcl/win/source/src/timesize.cur
Binary files differ
diff --git a/vcl/win/source/src/vshear.cur b/vcl/win/source/src/vshear.cur
new file mode 100644
index 000000000000..a4bbf7e8eb00
--- /dev/null
+++ b/vcl/win/source/src/vshear.cur
Binary files differ
diff --git a/vcl/win/source/src/vsize.cur b/vcl/win/source/src/vsize.cur
new file mode 100644
index 000000000000..76449be89d0a
--- /dev/null
+++ b/vcl/win/source/src/vsize.cur
Binary files differ
diff --git a/vcl/win/source/src/vsizebar.cur b/vcl/win/source/src/vsizebar.cur
new file mode 100644
index 000000000000..a87811cb474d
--- /dev/null
+++ b/vcl/win/source/src/vsizebar.cur
Binary files differ
diff --git a/vcl/win/source/src/vsplit.cur b/vcl/win/source/src/vsplit.cur
new file mode 100644
index 000000000000..a4260808fadc
--- /dev/null
+++ b/vcl/win/source/src/vsplit.cur
Binary files differ
diff --git a/vcl/win/source/window/MAKEFILE.MK b/vcl/win/source/window/MAKEFILE.MK
new file mode 100644
index 000000000000..c370e52b2bb9
--- /dev/null
+++ b/vcl/win/source/window/MAKEFILE.MK
@@ -0,0 +1,38 @@
+#*************************************************************************
+#*
+#* $Workfile: makefile. $
+#*
+#* Ersterstellung TH 01.04.97
+#* Letzte Aenderung $Author: hr $ $Date: 2000-09-18 17:05:50 $
+#* $Revision: 1.1.1.1 $
+#*
+#* $Logfile: T:/sv2/win/source/window/makefile.__v $
+#*
+#* Copyright (c) 1990 - 1998, STAR DIVISION
+#*
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=vcl
+TARGET=salwin
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/salframe.obj \
+ $(SLO)$/salobj.obj
+
+.IF "$(UPDATER)"=="YES"
+OBJFILES= $(OBJ)$/salframe.obj \
+ $(OBJ)$/salobj.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
new file mode 100644
index 000000000000..48d964af3ab6
--- /dev/null
+++ b/vcl/win/source/window/salframe.cxx
@@ -0,0 +1,3901 @@
+/*************************************************************************
+ *
+ * $RCSfile: salframe.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <limits.h>
+
+#ifdef DBG_UTIL
+#include <stdio.h>
+#endif
+
+#ifndef _SVWIN_HXX
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALFRAME_CXX
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#define private public
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALIDS_HRC
+#include <salids.hrc>
+#endif
+#ifndef _SV_SYSDATA_HXX
+#include <sysdata.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALGDI_HXX
+#include <salgdi.hxx>
+#endif
+#ifndef _SV_SALSYS_HXX
+#include <salsys.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALVD_HXX
+#include <salvd.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX
+#include <timer.hxx>
+#endif
+#ifndef _SV_SETTINGS_HXX
+#include <settings.hxx>
+#endif
+#ifndef _SV_KEYCOES_HXX
+#include <keycodes.hxx>
+#endif
+
+// =======================================================================
+
+// Wegen Fehler in Windows-Headerfiles
+#ifndef IMN_OPENCANDIDATE
+#define IMN_OPENCANDIDATE 0x0005
+#endif
+#ifndef IMN_CLOSECANDIDATE
+#define IMN_CLOSECANDIDATE 0x0004
+#endif
+
+// =======================================================================
+
+static void ImplSaveFrameState( SalFrame* pFrame )
+{
+ // Position, Groesse und Status fuer GetWindowState() merken
+ if ( !pFrame->maFrameData.mbFullScreen )
+ {
+ BOOL bVisible = (GetWindowStyle( pFrame->maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( IsIconic( pFrame->maFrameData.mhWnd ) )
+ {
+ pFrame->maFrameData.maState.mnState |= SAL_FRAMESTATE_MINIMIZED;
+ if ( bVisible )
+ pFrame->maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ }
+ else if ( IsZoomed( pFrame->maFrameData.mhWnd ) )
+ {
+ pFrame->maFrameData.maState.mnState &= ~SAL_FRAMESTATE_MINIMIZED;
+ pFrame->maFrameData.maState.mnState |= SAL_FRAMESTATE_MAXIMIZED;
+ if ( bVisible )
+ pFrame->maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ pFrame->maFrameData.mbRestoreMaximize = TRUE;
+ }
+ else
+ {
+ RECT aRect;
+ GetWindowRect( pFrame->maFrameData.mhWnd, &aRect );
+ pFrame->maFrameData.maState.mnState &= ~(SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED);
+ pFrame->maFrameData.maState.mnX = aRect.left;
+ pFrame->maFrameData.maState.mnY = aRect.top;
+ pFrame->maFrameData.maState.mnWidth = aRect.right-aRect.left;
+ pFrame->maFrameData.maState.mnHeight = aRect.bottom-aRect.top;
+ if ( bVisible )
+ pFrame->maFrameData.mnShowState = SW_SHOWNORMAL;
+ pFrame->maFrameData.mbRestoreMaximize = FALSE;
+ }
+ }
+}
+
+// =======================================================================
+
+SalFrame* ImplSalCreateFrame( SalInstance* pInst,
+ HWND hWndParent, ULONG nSalFrameStyle )
+{
+ SalFrame* pFrame = new SalFrame;
+ HWND hWnd;
+ DWORD nSysStyle = 0;
+ DWORD nExSysStyle = 0;
+ BOOL bSaveBits = FALSE;
+
+ // determine creation data
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_CHILD )
+ nSysStyle |= WS_CHILD;
+ else if ( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT )
+ {
+ pFrame->maFrameData.mbCaption = TRUE;
+ nSysStyle |= WS_OVERLAPPED;
+#if ( WINVER >= 0x0400 )
+ nExSysStyle |= WS_EX_APPWINDOW;
+#endif
+ }
+ else
+ nSysStyle |= WS_POPUP;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE )
+ {
+ pFrame->maFrameData.mbSizeBorder = TRUE;
+ nSysStyle |= WS_THICKFRAME | WS_SYSMENU;
+ }
+ else if ( nSalFrameStyle & SAL_FRAME_STYLE_BORDER )
+ {
+ pFrame->maFrameData.mbBorder = TRUE;
+ nSysStyle |= WS_BORDER;
+ }
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE )
+ {
+ pFrame->maFrameData.mbCaption = TRUE;
+ nSysStyle |= WS_CAPTION | WS_SYSMENU;
+ }
+#if ( WINVER >= 0x0400 )
+ else
+ nExSysStyle |= WS_EX_TOOLWINDOW;
+#endif
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MINABLE )
+ nSysStyle |= WS_MINIMIZEBOX | WS_SYSMENU;
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_MAXABLE )
+ nSysStyle |= WS_MAXIMIZEBOX | WS_SYSMENU;
+
+ // init frame data
+ pFrame->maFrameData.mnStyle = nSalFrameStyle;
+
+ // determine show style
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_DEFAULT )
+ {
+ SalData* pSalData = GetSalData();
+ pFrame->maFrameData.mnShowState = pSalData->mnCmdShow;
+ if ( (pFrame->maFrameData.mnShowState != SW_SHOWMINIMIZED) &&
+ (pFrame->maFrameData.mnShowState != SW_MINIMIZE) &&
+ (pFrame->maFrameData.mnShowState != SW_SHOWMINNOACTIVE) )
+ {
+ if ( (pFrame->maFrameData.mnShowState == SW_SHOWMAXIMIZED) ||
+ (pFrame->maFrameData.mnShowState == SW_MAXIMIZE) )
+ pFrame->maFrameData.mbOverwriteState = FALSE;
+ pFrame->maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ }
+ else
+ pFrame->maFrameData.mbOverwriteState = FALSE;
+ }
+ else
+ pFrame->maFrameData.mnShowState = SW_SHOWNORMAL;
+
+ // create frame
+ if ( aSalShlData.mbWNT )
+ {
+ LPCWSTR pClassName;
+ if ( bSaveBits )
+ pClassName = SAL_FRAME_CLASSNAME_SBW;
+ else
+ pClassName = SAL_FRAME_CLASSNAMEW;
+ hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
+ hWndParent, 0, pInst->maInstData.mhInst, (void*)pFrame );
+ }
+ else
+ {
+ LPCSTR pClassName;
+ if ( bSaveBits )
+ pClassName = SAL_FRAME_CLASSNAME_SBA;
+ else
+ pClassName = SAL_FRAME_CLASSNAMEA;
+ hWnd = CreateWindowExA( nExSysStyle, pClassName, "", nSysStyle,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
+ hWndParent, 0, pInst->maInstData.mhInst, (void*)pFrame );
+ }
+ if ( !hWnd )
+ {
+ delete pFrame;
+ return NULL;
+ }
+
+ // disable close
+ if ( !(nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) )
+ {
+ HMENU hSysMenu = GetSystemMenu( hWnd, FALSE );
+ if ( hSysMenu )
+ EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED );
+ }
+
+ // reset input context
+ pFrame->maFrameData.mhDefIMEContext = ImmAssociateContext( hWnd, 0 );
+
+ // determine output size and state
+ RECT aRect;
+ GetClientRect( hWnd, &aRect );
+ pFrame->maFrameData.mnWidth = aRect.right;
+ pFrame->maFrameData.mnHeight = aRect.bottom;
+ ImplSaveFrameState( pFrame );
+ pFrame->maFrameData.mbDefPos = TRUE;
+
+ // CreateHDC in the main thread
+ pFrame->ReleaseGraphics( pFrame->GetGraphics() );
+
+ return pFrame;
+}
+
+// =======================================================================
+
+// Uebersetzungstabelle von System-Keycodes in StarView-Keycodes
+#define KEY_TAB_SIZE 146
+
+static USHORT aImplTranslateKeyTab[KEY_TAB_SIZE] =
+{
+ // StarView-Code System-Code Index
+ 0, // 0
+ 0, // VK_LBUTTON 1
+ 0, // VK_RBUTTON 2
+ 0, // VK_CANCEL 3
+ 0, // VK_MBUTTON 4
+ 0, // 5
+ 0, // 6
+ 0, // 7
+ KEY_BACKSPACE, // VK_BACK 8
+ KEY_TAB, // VK_TAB 9
+ 0, // 10
+ 0, // 11
+ 0, // VK_CLEAR 12
+ KEY_RETURN, // VK_RETURN 13
+ 0, // 14
+ 0, // 15
+ 0, // VK_SHIFT 16
+ 0, // VK_CONTROL 17
+ 0, // VK_MENU 18
+ 0, // VK_PAUSE 19
+ 0, // VK_CAPITAL 20
+ 0, // 21
+ 0, // 22
+ 0, // 23
+ 0, // 24
+ 0, // 25
+ 0, // 26
+ KEY_ESCAPE, // VK_ESCAPE 27
+ 0, // 28
+ 0, // 29
+ 0, // 30
+ 0, // 31
+ KEY_SPACE, // VK_SPACE 32
+ KEY_PAGEUP, // VK_PRIOR 33
+ KEY_PAGEDOWN, // VK_NEXT 34
+ KEY_END, // VK_END 35
+ KEY_HOME, // VK_HOME 36
+ KEY_LEFT, // VK_LEFT 37
+ KEY_UP, // VK_UP 38
+ KEY_RIGHT, // VK_RIGHT 39
+ KEY_DOWN, // VK_DOWN 40
+ 0, // VK_SELECT 41
+ 0, // VK_PRINT 42
+ 0, // VK_EXECUTE 43
+ 0, // VK_SNAPSHOT 44
+ KEY_INSERT, // VK_INSERT 45
+ KEY_DELETE, // VK_DELETE 46
+ KEY_HELP, // VK_HELP 47
+ KEY_0, // 48
+ KEY_1, // 49
+ KEY_2, // 50
+ KEY_3, // 51
+ KEY_4, // 52
+ KEY_5, // 53
+ KEY_6, // 54
+ KEY_7, // 55
+ KEY_8, // 56
+ KEY_9, // 57
+ 0, // 58
+ 0, // 59
+ 0, // 60
+ 0, // 61
+ 0, // 62
+ 0, // 63
+ 0, // 64
+ KEY_A, // 65
+ KEY_B, // 66
+ KEY_C, // 67
+ KEY_D, // 68
+ KEY_E, // 69
+ KEY_F, // 70
+ KEY_G, // 71
+ KEY_H, // 72
+ KEY_I, // 73
+ KEY_J, // 74
+ KEY_K, // 75
+ KEY_L, // 76
+ KEY_M, // 77
+ KEY_N, // 78
+ KEY_O, // 79
+ KEY_P, // 80
+ KEY_Q, // 81
+ KEY_R, // 82
+ KEY_S, // 83
+ KEY_T, // 84
+ KEY_U, // 85
+ KEY_V, // 86
+ KEY_W, // 87
+ KEY_X, // 88
+ KEY_Y, // 89
+ KEY_Z, // 90
+ 0, // VK_LWIN 91
+ 0, // VK_RWIN 92
+ KEY_CONTEXTMENU, // VK_APPS 93
+ 0, // 94
+ 0, // 95
+ KEY_0, // VK_NUMPAD0 96
+ KEY_1, // VK_NUMPAD1 97
+ KEY_2, // VK_NUMPAD2 98
+ KEY_3, // VK_NUMPAD3 99
+ KEY_4, // VK_NUMPAD4 100
+ KEY_5, // VK_NUMPAD5 101
+ KEY_6, // VK_NUMPAD6 102
+ KEY_7, // VK_NUMPAD7 103
+ KEY_8, // VK_NUMPAD8 104
+ KEY_9, // VK_NUMPAD9 105
+ KEY_MULTIPLY, // VK_MULTIPLY 106
+ KEY_ADD, // VK_ADD 107
+ KEY_COMMA, // VK_SEPARATOR 108
+ KEY_SUBTRACT, // VK_SUBTRACT 109
+ KEY_POINT, // VK_DECIMAL 110
+ KEY_DIVIDE, // VK_DIVIDE 111
+ KEY_F1, // VK_F1 112
+ KEY_F2, // VK_F2 113
+ KEY_F3, // VK_F3 114
+ KEY_F4, // VK_F4 115
+ KEY_F5, // VK_F5 116
+ KEY_F6, // VK_F6 117
+ KEY_F7, // VK_F7 118
+ KEY_F8, // VK_F8 119
+ KEY_F9, // VK_F9 120
+ KEY_F10, // VK_F10 121
+ KEY_F11, // VK_F11 122
+ KEY_F12, // VK_F12 123
+ KEY_F13, // VK_F13 124
+ KEY_F14, // VK_F14 125
+ KEY_F15, // VK_F15 126
+ KEY_F16, // VK_F16 127
+ KEY_F17, // VK_F17 128
+ KEY_F18, // VK_F18 129
+ KEY_F19, // VK_F19 130
+ KEY_F20, // VK_F20 131
+ KEY_F21, // VK_F21 132
+ KEY_F22, // VK_F22 133
+ KEY_F23, // VK_F23 134
+ KEY_F24, // VK_F24 135
+ 0, // 136
+ 0, // 137
+ 0, // 138
+ 0, // 139
+ 0, // 140
+ 0, // 141
+ 0, // 142
+ 0, // 143
+ 0, // NUMLOCK 144
+ 0 // SCROLLLOCK 145
+};
+
+// =======================================================================
+
+long ImplSalCallbackDummy( void*, SalFrame*, USHORT, const void* )
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+static UINT ImplSalGetWheelScrollLines()
+{
+ UINT nScrLines = 0;
+ HWND hWndMsWheel = WIN_FindWindow( MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE );
+ if ( hWndMsWheel )
+ {
+ UINT nGetScrollLinesMsgId = RegisterWindowMessage( MSH_SCROLL_LINES );
+ nScrLines = (UINT)ImplSendMessage( hWndMsWheel, nGetScrollLinesMsgId, 0, 0 );
+ }
+
+ if ( !nScrLines )
+ nScrLines = SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &nScrLines, 0 );
+
+ if ( !nScrLines )
+ nScrLines = 3;
+
+ return nScrLines;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalCalcFullScreenSize( const SalFrame* pFrame,
+ int& rX, int& rY, int& rDX, int& rDY )
+{
+ // set window to screen size
+ int nFrameX;
+ int nFrameY;
+ int nCaptionY;
+ int nScreenDX;
+ int nScreenDY;
+
+ if ( pFrame->maFrameData.mbSizeBorder )
+ {
+ nFrameX = GetSystemMetrics( SM_CXFRAME );
+ nFrameY = GetSystemMetrics( SM_CYFRAME );
+ }
+ else if ( pFrame->maFrameData.mbBorder )
+ {
+ nFrameX = GetSystemMetrics( SM_CXBORDER );
+ nFrameY = GetSystemMetrics( SM_CYBORDER );
+ }
+ else
+ {
+ nFrameX = 0;
+ nFrameY = 0;
+ }
+ if ( pFrame->maFrameData.mbCaption )
+ nCaptionY = GetSystemMetrics( SM_CYCAPTION );
+ else
+ nCaptionY = 0;
+
+ nScreenDX = GetSystemMetrics( SM_CXSCREEN );
+ nScreenDY = GetSystemMetrics( SM_CYSCREEN );
+
+ rX = -nFrameX;
+ rY = -(nFrameY+nCaptionY);
+ rDX = nScreenDX+(nFrameX*2);
+ rDY = nScreenDY+(nFrameY*2)+nCaptionY;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalFrameFullScreenPos( SalFrame* pFrame, BOOL bAlways = FALSE )
+{
+ if ( bAlways || !IsIconic( pFrame->maFrameData.mhWnd ) )
+ {
+ // set window to screen size
+ int nX;
+ int nY;
+ int nWidth;
+ int nHeight;
+ ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight );
+ SetWindowPos( pFrame->maFrameData.mhWnd, 0,
+ nX, nY, nWidth, nHeight,
+ SWP_NOZORDER | SWP_NOACTIVATE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame::SalFrame()
+{
+ SalData* pSalData = GetSalData();
+
+ maFrameData.mhWnd = 0;
+ maFrameData.mhCursor = LoadCursor( 0, IDC_ARROW );
+ maFrameData.mhDefIMEContext = 0;
+ maFrameData.mpGraphics = NULL;
+ maFrameData.mpInst = NULL;
+ maFrameData.mpProc = ImplSalCallbackDummy;
+ maFrameData.mnInputLang = 0;
+ maFrameData.mnInputCodePage = 0;
+ maFrameData.mbGraphics = FALSE;
+ maFrameData.mbCaption = FALSE;
+ maFrameData.mbBorder = FALSE;
+ maFrameData.mbSizeBorder = FALSE;
+ maFrameData.mbFullScreen = FALSE;
+ maFrameData.mbPresentation = FALSE;
+ maFrameData.mbInShow = FALSE;
+ maFrameData.mbRestoreMaximize = FALSE;
+ maFrameData.mbInMoveMsg = FALSE;
+ maFrameData.mbInSizeMsg = FALSE;
+ maFrameData.mbFullScreenToolWin = FALSE;
+ maFrameData.mbDefPos = TRUE;
+ maFrameData.mbOverwriteState = TRUE;
+ maFrameData.mbIME = FALSE;
+ maFrameData.mbHandleIME = FALSE;
+ maFrameData.mbSpezIME = FALSE;
+ maFrameData.mbAtCursorIME = FALSE;
+ maFrameData.mbCompositionMode = FALSE;
+ maFrameData.mbCandidateMode = FALSE;
+ memset( &maFrameData.maState, 0, sizeof( SalFrameState ) );
+ maFrameData.maSysData.nSize = sizeof( SystemEnvData );
+
+ // Daten ermitteln, wenn erster Frame angelegt wird
+ if ( !pSalData->mpFirstFrame )
+ {
+ if ( !aSalShlData.mnWheelMsgId )
+ aSalShlData.mnWheelMsgId = RegisterWindowMessage( MSH_MOUSEWHEEL );
+ if ( !aSalShlData.mnWheelScrollLines )
+ aSalShlData.mnWheelScrollLines = ImplSalGetWheelScrollLines();
+ }
+
+ // insert frame in framelist
+ maFrameData.mpNextFrame = pSalData->mpFirstFrame;
+ pSalData->mpFirstFrame = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame::~SalFrame()
+{
+ SalData* pSalData = GetSalData();
+
+ // destroy saved DC
+ if ( maFrameData.mpGraphics )
+ {
+ if ( maFrameData.mpGraphics->maGraphicsData.mhDefPal )
+ SelectPalette( maFrameData.mpGraphics->maGraphicsData.mhDC, maFrameData.mpGraphics->maGraphicsData.mhDefPal, TRUE );
+ ImplSalDeInitGraphics( &(maFrameData.mpGraphics->maGraphicsData) );
+ ReleaseDC( maFrameData.mhWnd, maFrameData.mpGraphics->maGraphicsData.mhDC );
+ delete maFrameData.mpGraphics;
+ }
+
+ if ( maFrameData.mhWnd )
+ {
+ // reset mouse leave data
+ if ( pSalData->mhWantLeaveMsg == maFrameData.mhWnd )
+ {
+ pSalData->mhWantLeaveMsg = 0;
+ if ( pSalData->mpMouseLeaveTimer )
+ {
+ delete pSalData->mpMouseLeaveTimer;
+ pSalData->mpMouseLeaveTimer = NULL;
+ }
+ }
+
+ // destroy system frame
+ if ( !DestroyWindow( maFrameData.mhWnd ) )
+ SetWindowPtr( maFrameData.mhWnd, 0 );
+ }
+
+ // remove frame from framelist
+ if ( this == pSalData->mpFirstFrame )
+ pSalData->mpFirstFrame = maFrameData.mpNextFrame;
+ else
+ {
+ SalFrame* pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame->maFrameData.mpNextFrame != this )
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+
+ pTempFrame->maFrameData.mpNextFrame = maFrameData.mpNextFrame;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SalGraphics* SalFrame::GetGraphics()
+{
+ if ( maFrameData.mbGraphics )
+ return NULL;
+
+ if ( !maFrameData.mpGraphics )
+ {
+ HDC hDC = GetDC( maFrameData.mhWnd );
+ if ( hDC )
+ {
+ SalData* pSalData = GetSalData();
+ maFrameData.mpGraphics = new SalGraphics;
+ maFrameData.mpGraphics->maGraphicsData.mhDC = hDC;
+ maFrameData.mpGraphics->maGraphicsData.mhWnd = maFrameData.mhWnd;
+ maFrameData.mpGraphics->maGraphicsData.mbPrinter = FALSE;
+ maFrameData.mpGraphics->maGraphicsData.mbVirDev = FALSE;
+ maFrameData.mpGraphics->maGraphicsData.mbWindow = TRUE;
+ maFrameData.mpGraphics->maGraphicsData.mbScreen = TRUE;
+ if ( pSalData->mhDitherPal )
+ {
+ maFrameData.mpGraphics->maGraphicsData.mhDefPal = SelectPalette( hDC, pSalData->mhDitherPal, TRUE );
+ RealizePalette( hDC );
+ }
+ ImplSalInitGraphics( &(maFrameData.mpGraphics->maGraphicsData) );
+ maFrameData.mbGraphics = TRUE;
+ }
+ }
+ else
+ maFrameData.mbGraphics = TRUE;
+
+ return maFrameData.mpGraphics;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ReleaseGraphics( SalGraphics* )
+{
+ maFrameData.mbGraphics = FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalFrame::PostEvent( void* pData )
+{
+ return (BOOL)ImplPostMessage( maFrameData.mhWnd, SAL_MSG_USEREVENT, 0, (LPARAM)pData );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetTitle( const XubString& rTitle )
+{
+ DBG_ASSERT( sizeof( WCHAR ) == sizeof( xub_Unicode ), "SalFrame::SetTitle(): WCHAR != sal_Unicode" );
+
+ if ( !SetWindowTextW( maFrameData.mhWnd, rTitle.GetBuffer() ) )
+ {
+ ByteString aAnsiTitle = ImplSalGetWinAnsiString( rTitle );
+ SetWindowTextA( maFrameData.mhWnd, aAnsiTitle.GetBuffer() );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetIcon( USHORT nIcon )
+{
+// ImplSendMessage( maFrameData.mhWnd, WM_SETICON, FALSE, hSmIcon );
+// ImplSendMessage( maFrameData.mhWnd, WM_SETICON, TRUE, hIcon );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalShow( HWND hWnd, BOOL bVisible )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return;
+
+ if ( bVisible )
+ {
+ pFrame->maFrameData.mbDefPos = FALSE;
+ pFrame->maFrameData.mbOverwriteState = TRUE;
+ pFrame->maFrameData.mbInShow = TRUE;
+ ShowWindow( hWnd, pFrame->maFrameData.mnShowState );
+ // Damit Taskleiste unter W98 auch gleich ausgeblendet wird
+ if ( pFrame->maFrameData.mbPresentation )
+ {
+ HWND hWndParent = ::GetParent( hWnd );
+ if ( hWndParent )
+ SetForegroundWindow( hWndParent );
+ SetForegroundWindow( hWnd );
+ }
+ pFrame->maFrameData.mnShowState = SW_SHOW;
+ pFrame->maFrameData.mbInShow = FALSE;
+ UpdateWindow( hWnd );
+ }
+ else
+ {
+ if ( pFrame->maFrameData.mbFullScreen &&
+ pFrame->maFrameData.mbPresentation &&
+ !::GetParent( hWnd ) )
+ {
+ // Damit im Impress-Player in der Taskleiste nicht durch
+ // einen Windows-Fehler hin- und wieder mal ein leerer
+ // Button stehen bleibt, muessen wir hier die Taskleiste
+ // etwas austricksen. Denn wenn wir im FullScreenMode sind
+ // und das Fenster hiden kommt Windows anscheinend etwas aus
+ // dem tritt und somit minimieren wir das Fenster damit es
+ // nicht flackert
+ ANIMATIONINFO aInfo;
+ aInfo.cbSize = sizeof( aInfo );
+ SystemParametersInfo( SPI_GETANIMATION, 0, &aInfo, 0 );
+ if ( aInfo.iMinAnimate )
+ {
+ int nOldAni = aInfo.iMinAnimate;
+ aInfo.iMinAnimate = 0;
+ SystemParametersInfo( SPI_SETANIMATION, 0, &aInfo, 0 );
+ ShowWindow( pFrame->maFrameData.mhWnd, SW_SHOWMINNOACTIVE );
+ aInfo.iMinAnimate = nOldAni;
+ SystemParametersInfo( SPI_SETANIMATION, 0, &aInfo, 0 );
+ }
+ else
+ ShowWindow( hWnd, SW_SHOWMINNOACTIVE );
+ ShowWindow( hWnd, SW_HIDE );
+ }
+ else
+ ShowWindow( hWnd, SW_HIDE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Show( BOOL bVisible )
+{
+ // Send this Message to the window, because this only works
+ // in the thread of the window, which has create this window
+ ImplSendMessage( maFrameData.mhWnd, SAL_MSG_SHOW, bVisible, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Enable( BOOL bEnable )
+{
+ EnableWindow( maFrameData.mhWnd, bEnable );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetMinClientSize( long nWidth, long nHeight )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetClientSize( long nWidth, long nHeight )
+{
+ BOOL bVisible = (GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( !bVisible )
+ maFrameData.mnShowState = SW_SHOWNORMAL;
+ else
+ {
+ if ( IsIconic( maFrameData.mhWnd ) || IsZoomed( maFrameData.mhWnd ) )
+ ShowWindow( maFrameData.mhWnd, SW_RESTORE );
+ }
+
+ // Fenstergroesse berechnen
+ RECT aWinRect;
+ aWinRect.left = 0;
+ aWinRect.right = (int)nWidth-1;
+ aWinRect.top = 0;
+ aWinRect.bottom = (int)nHeight-1;
+ AdjustWindowRectEx( &aWinRect,
+ GetWindowStyle( maFrameData.mhWnd ),
+ FALSE,
+ GetWindowExStyle( maFrameData.mhWnd ) );
+ nWidth = aWinRect.right - aWinRect.left + 1;
+ nHeight = aWinRect.bottom - aWinRect.top + 1;
+
+ // Position so berechnen, das Fenster zentiert auf dem Desktop
+ // angezeigt wird
+ int nX;
+ int nY;
+ int nScreenX;
+ int nScreenY;
+ int nScreenWidth;
+ int nScreenHeight;
+
+#if ( WINVER >= 0x0400 )
+ W40IF
+ {
+ RECT aRect;
+ SystemParametersInfo( SPI_GETWORKAREA, 0, &aRect, 0 );
+ nScreenX = aRect.left;
+ nScreenY = aRect.top;
+ nScreenWidth = aRect.right-aRect.left;
+ nScreenHeight = aRect.bottom-aRect.top;
+ }
+ W40ELSE
+#endif
+#ifndef W40ONLY
+ {
+ nScreenX = 0;
+ nScreenY = 0;
+ nScreenWidth = GetSystemMetrics( SM_CXSCREEN );
+ nScreenHeight = GetSystemMetrics( SM_CYSCREEN );
+ }
+#endif
+
+ if ( maFrameData.mbDefPos )
+ {
+ nX = (nScreenWidth-nWidth)/2 + nScreenX;
+ nY = (nScreenHeight-nHeight)/2 + nScreenY;
+ if ( bVisible )
+ maFrameData.mbDefPos = FALSE;
+ }
+ else
+ {
+ RECT aWinRect;
+ GetWindowRect( maFrameData.mhWnd, &aWinRect );
+ nX = aWinRect.left;
+ nY = aWinRect.top;
+ if ( nX+nWidth > nScreenX+nScreenWidth )
+ nX = (nScreenX+nScreenWidth) - nWidth;
+ if ( nY+nHeight > nScreenY+nScreenHeight )
+ nY = (nScreenY+nScreenHeight) - nHeight;
+ if ( nX < nScreenX )
+ nX = nScreenX;
+ if ( nY < nScreenY )
+ nY = nScreenY;
+ }
+
+ SetWindowPos( maFrameData.mhWnd, 0, nX, nY, (int)nWidth, (int)nHeight, SWP_NOZORDER | SWP_NOACTIVATE );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::GetClientSize( long& rWidth, long& rHeight )
+{
+ rWidth = maFrameData.mnWidth;
+ rHeight = maFrameData.mnHeight;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetWindowState( const SalFrameState* pState )
+{
+ // Wir testen, ob das Fenster ueberhaupt auf den Bildschirm passt, damit
+ // nicht wenn die Bildschirm-Aufloesung geaendert wurde, das Fenster aus
+ // diesem herausragt
+ int nX;
+ int nY;
+ int nWidth;
+ int nHeight;
+ int nScreenX;
+ int nScreenY;
+ int nScreenWidth;
+ int nScreenHeight;
+
+#if ( WINVER >= 0x0400 )
+ W40IF
+ {
+ RECT aRect;
+ SystemParametersInfo( SPI_GETWORKAREA, 0, &aRect, 0 );
+ nScreenX = aRect.left;
+ nScreenY = aRect.top;
+ nScreenWidth = aRect.right-aRect.left;
+ nScreenHeight = aRect.bottom-aRect.top;
+ }
+ W40ELSE
+#endif
+#ifndef W40ONLY
+ {
+ nScreenX = 0;
+ nScreenY = 0;
+ nScreenWidth = GetSystemMetrics( SM_CXSCREEN );
+ nScreenHeight = GetSystemMetrics( SM_CYSCREEN );
+ }
+#endif
+
+ // Fenster-Position/Groesse in den Bildschirm einpassen
+ nX = (int)pState->mnX;
+ nY = (int)pState->mnY;
+ nWidth = (int)pState->mnWidth;
+ nHeight = (int)pState->mnHeight;
+ if ( nX < nScreenX )
+ nX = nScreenX;
+ if ( nY < nScreenY )
+ nY = nScreenY;
+ if ( nScreenWidth < nWidth )
+ nWidth = nScreenWidth;
+ if ( nScreenHeight < nHeight )
+ nHeight = nScreenHeight;
+
+ // Restore-Position setzen
+ WINDOWPLACEMENT aPlacement;
+ aPlacement.length = sizeof( aPlacement );
+ GetWindowPlacement( maFrameData.mhWnd, &aPlacement );
+
+ // Status setzen
+ BOOL bVisible = (GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( !bVisible )
+ {
+ aPlacement.showCmd = SW_HIDE;
+
+ if ( maFrameData.mbOverwriteState )
+ {
+ if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED )
+ maFrameData.mnShowState = SW_SHOWMINIMIZED;
+ else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED )
+ maFrameData.mnShowState = SW_SHOWMAXIMIZED;
+ else
+ maFrameData.mnShowState = SW_SHOWNORMAL;
+ }
+ }
+ else
+ {
+ if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED )
+ {
+ if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED )
+ aPlacement.flags |= WPF_RESTORETOMAXIMIZED;
+ aPlacement.showCmd = SW_SHOWMINIMIZED;
+ }
+ else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED )
+ aPlacement.showCmd = SW_SHOWMAXIMIZED;
+ else
+ aPlacement.showCmd = SW_RESTORE;
+ }
+
+ // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch
+ // umgesetzt werden muss, dann SetWindowPos() benutzen, da
+ // SetWindowPlacement() die TaskBar mit einrechnet
+ if ( !IsIconic( maFrameData.mhWnd ) && !IsZoomed( maFrameData.mhWnd ) &&
+ (!bVisible || (aPlacement.showCmd == SW_RESTORE)) )
+ {
+ SetWindowPos( maFrameData.mhWnd, 0,
+ nX, nY, nWidth, nHeight,
+ SWP_NOZORDER | SWP_NOACTIVATE );
+ }
+ else
+ {
+ aPlacement.rcNormalPosition.left = nX-nScreenX;
+ aPlacement.rcNormalPosition.top = nY-nScreenY;
+ aPlacement.rcNormalPosition.right = nX+nWidth-nScreenX;
+ aPlacement.rcNormalPosition.bottom = nY+nHeight-nScreenY;
+ SetWindowPlacement( maFrameData.mhWnd, &aPlacement );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SalFrame::GetWindowState( SalFrameState* pState )
+{
+ if ( maFrameData.maState.mnWidth && maFrameData.maState.mnHeight )
+ {
+ *pState = maFrameData.maState;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ShowFullScreen( BOOL bFullScreen )
+{
+ if ( maFrameData.mbFullScreen == bFullScreen )
+ return;
+
+ maFrameData.mbFullScreen = bFullScreen;
+ if ( bFullScreen )
+ {
+#if ( WINVER >= 0x0400 )
+ // Damit Taskleiste von Windows ausgeblendet wird
+ DWORD nExStyle = GetWindowExStyle( maFrameData.mhWnd );
+ if ( nExStyle & WS_EX_TOOLWINDOW )
+ {
+ maFrameData.mbFullScreenToolWin = TRUE;
+ nExStyle &= ~WS_EX_TOOLWINDOW;
+ SetWindowExStyle( maFrameData.mhWnd, nExStyle );
+ }
+#endif
+
+ // save old position
+ GetWindowRect( maFrameData.mhWnd, &maFrameData.maFullScreenRect );
+
+ // save show state
+ maFrameData.mnFullScreenShowState = maFrameData.mnShowState;
+ if ( !(GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) )
+ maFrameData.mnShowState = SW_SHOW;
+
+ // set window to screen size
+ ImplSalFrameFullScreenPos( this, TRUE );
+ }
+ else
+ {
+ // wenn ShowState wieder hergestellt werden muss, hiden wir zuerst
+ // das Fenster, damit es nicht so sehr flackert
+ BOOL bVisible = (GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( bVisible && (maFrameData.mnShowState != maFrameData.mnFullScreenShowState) )
+ ShowWindow( maFrameData.mhWnd, SW_HIDE );
+
+#if ( WINVER >= 0x0400 )
+ if ( maFrameData.mbFullScreenToolWin )
+ SetWindowExStyle( maFrameData.mhWnd, GetWindowExStyle( maFrameData.mhWnd ) | WS_EX_TOOLWINDOW );
+ maFrameData.mbFullScreenToolWin = FALSE;
+#endif
+
+ SetWindowPos( maFrameData.mhWnd, 0,
+ maFrameData.maFullScreenRect.left,
+ maFrameData.maFullScreenRect.top,
+ maFrameData.maFullScreenRect.right-maFrameData.maFullScreenRect.left,
+ maFrameData.maFullScreenRect.bottom-maFrameData.maFullScreenRect.top,
+ SWP_NOZORDER | SWP_NOACTIVATE );
+
+ // restore show state
+ if ( maFrameData.mnShowState != maFrameData.mnFullScreenShowState )
+ {
+ maFrameData.mnShowState = maFrameData.mnFullScreenShowState;
+ if ( bVisible )
+ {
+ maFrameData.mbInShow = TRUE;
+ ShowWindow( maFrameData.mhWnd, maFrameData.mnShowState );
+ maFrameData.mbInShow = FALSE;
+ UpdateWindow( maFrameData.mhWnd );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::StartPresentation( BOOL bStart )
+{
+ if ( maFrameData.mbPresentation == bStart )
+ return;
+
+ maFrameData.mbPresentation = bStart;
+
+ SalData* pSalData = GetSalData();
+ if ( bStart )
+ {
+#if ( WINVER >= 0x0400 )
+ if ( !pSalData->mpSageEnableProc )
+ {
+ if ( pSalData->mnSageStatus != DISABLE_AGENT )
+ {
+ OFSTRUCT aOS;
+ OpenFile( "SAGE.DLL", &aOS, OF_EXIST );
+
+ if ( !aOS.nErrCode )
+ {
+ pSalData->mhSageInst = LoadLibrary( aOS.szPathName );
+ pSalData->mpSageEnableProc = (SysAgt_Enable_PROC)GetProcAddress( pSalData->mhSageInst, "System_Agent_Enable" );
+ }
+ else
+ pSalData->mnSageStatus = DISABLE_AGENT;
+ }
+ }
+
+ if ( pSalData->mpSageEnableProc )
+ {
+ pSalData->mnSageStatus = pSalData->mpSageEnableProc( GET_AGENT_STATUS );
+ if ( pSalData->mnSageStatus == ENABLE_AGENT )
+ pSalData->mpSageEnableProc( DISABLE_AGENT );
+ }
+#endif
+
+ // Bildschirmschoner ausschalten, wenn Praesentation laueft
+ SystemParametersInfo( SPI_GETSCREENSAVEACTIVE, 0,
+ &(pSalData->mbScrSvrEnabled), 0 );
+ if ( pSalData->mbScrSvrEnabled )
+ SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0 );
+ }
+ else
+ {
+ // Bildschirmschoner wieder einschalten
+ if ( pSalData->mbScrSvrEnabled )
+ SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, pSalData->mbScrSvrEnabled, 0, 0 );
+
+#if ( WINVER >= 0x0400 )
+ // Systemagenten wieder aktivieren
+ if ( pSalData->mnSageStatus == ENABLE_AGENT )
+ pSalData->mpSageEnableProc( pSalData->mnSageStatus );
+#endif
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetAlwaysOnTop( BOOL bOnTop )
+{
+ HWND hWnd;
+ if ( bOnTop )
+ hWnd = HWND_TOPMOST;
+ else
+ hWnd = HWND_NOTOPMOST;
+ SetWindowPos( maFrameData.mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalToTop( HWND hWnd, USHORT nFlags )
+{
+ if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK )
+ SetForegroundWindow( hWnd );
+ if ( !IsIconic( hWnd ) )
+ {
+ SetFocus( hWnd );
+
+ // Windows behauptet oefters mal, das man den Focus hat, obwohl
+ // man diesen nicht hat. Wenn dies der Fall ist, dann versuchen
+ // wir diesen auch ganz richtig zu bekommen.
+ if ( ::GetFocus() == hWnd )
+ SetForegroundWindow( hWnd );
+ }
+ else
+ {
+ if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
+ {
+ if ( GetWindowPtr( hWnd )->maFrameData.mbRestoreMaximize )
+ ShowWindow( hWnd, SW_MAXIMIZE );
+ else
+ ShowWindow( hWnd, SW_RESTORE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::ToTop( USHORT nFlags )
+{
+ // Send this Message to the window, because SetFocus() only work
+ // in the thread of the window, which has create this window
+ ImplSendMessage( maFrameData.mhWnd, SAL_MSG_TOTOP, nFlags, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetPointer( PointerStyle ePointerStyle )
+{
+ struct ImplPtrData
+ {
+ HCURSOR mhCursor;
+ LPCSTR mnSysId;
+ UINT mnOwnId;
+ };
+
+ static ImplPtrData aImplPtrTab[POINTER_COUNT] =
+ {
+ { 0, IDC_ARROW, 0 }, // POINTER_ARROW
+ { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL
+ { 0, IDC_WAIT, 0 }, // POINTER_WAIT
+ { 0, IDC_IBEAM, 0 }, // POINTER_TEXT
+#if ( WINVER >= 0x0400 )
+ { 0, IDC_HELP, 0 }, // POINTER_HELP
+#else
+ { 0, 0, SAL_RESID_POINTER_HELP }, // POINTER_HELP
+#endif
+ { 0, 0, SAL_RESID_POINTER_CROSS }, // POINTER_CROSS
+ { 0, 0, SAL_RESID_POINTER_MOVE }, // POINTER_MOVE
+ { 0, IDC_SIZENS, 0 }, // POINTER_NSIZE
+ { 0, IDC_SIZENS, 0 }, // POINTER_SSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_WSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_ESIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_NWSIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_NESIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_SWSIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_SESIZE
+ { 0, IDC_SIZENS, 0 }, // POINTER_WINDOW_NSIZE
+ { 0, IDC_SIZENS, 0 }, // POINTER_WINDOW_SSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE
+ { 0, IDC_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE
+ { 0, IDC_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE
+ { 0, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE
+ { 0, 0, SAL_RESID_POINTER_HSPLIT }, // POINTER_HSPLIT
+ { 0, 0, SAL_RESID_POINTER_VSPLIT }, // POINTER_VSPLIT
+ { 0, 0, SAL_RESID_POINTER_HSIZEBAR }, // POINTER_HSIZEBAR
+ { 0, 0, SAL_RESID_POINTER_VSIZEBAR }, // POINTER_VSIZEBAR
+ { 0, 0, SAL_RESID_POINTER_HAND }, // POINTER_HAND
+ { 0, 0, SAL_RESID_POINTER_REFHAND }, // POINTER_REFHAND
+ { 0, 0, SAL_RESID_POINTER_PEN }, // POINTER_PEN
+ { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY
+ { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL
+ { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE
+ { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR
+ { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR
+ { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR
+ { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK
+ { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP
+ { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT
+ { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT
+ { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA
+ { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA
+ { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA
+ { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK
+ { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK
+ { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE
+ { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE
+ { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE
+ { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK
+ { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK
+ { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES
+ { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES
+ { 0, 0, SAL_RESID_POINTER_NOTALLOWED }, // POINTER_NOTALLOWED
+ { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE
+ { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT
+ { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON
+ { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER
+ { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC
+ { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE
+ { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT
+ { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE
+ { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND
+ { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT
+ { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT
+ { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION
+ { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART
+ { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE
+ { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL
+ { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW
+ { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD
+ { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN
+ { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED
+ { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE
+ { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE
+ { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE
+ { 0, 0, SAL_RESID_POINTER_AIRBRUSH } // POINTER_AIRBRUSH
+ };
+
+#if POINTER_COUNT != 86
+#error New Pointer must be defined!
+#endif
+
+ // Mousepointer loaded ?
+ if ( !aImplPtrTab[ePointerStyle].mhCursor )
+ {
+ if ( aImplPtrTab[ePointerStyle].mnOwnId )
+ aImplPtrTab[ePointerStyle].mhCursor = ImplLoadSalCursor( aImplPtrTab[ePointerStyle].mnOwnId );
+ else
+ aImplPtrTab[ePointerStyle].mhCursor = LoadCursor( 0, aImplPtrTab[ePointerStyle].mnSysId );
+ }
+
+ // Unterscheidet sich der Mauspointer, dann den neuen setzen
+ if ( maFrameData.mhCursor != aImplPtrTab[ePointerStyle].mhCursor )
+ {
+ maFrameData.mhCursor = aImplPtrTab[ePointerStyle].mhCursor;
+ SetCursor( maFrameData.mhCursor );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::CaptureMouse( BOOL bCapture )
+{
+ // Send this Message to the window, because CaptureMouse() only work
+ // in the thread of the window, which has create this window
+ int nMsg;
+ if ( bCapture )
+ nMsg = SAL_MSG_CAPTUREMOUSE;
+ else
+ nMsg = SAL_MSG_RELEASEMOUSE;
+ ImplSendMessage( maFrameData.mhWnd, nMsg, 0, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetPointerPos( long nX, long nY )
+{
+ POINT aPt;
+ aPt.x = (int)nX;
+ aPt.y = (int)nY;
+ ClientToScreen( maFrameData.mhWnd, &aPt );
+ SetCursorPos( aPt.x, aPt.y );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Flush()
+{
+ GdiFlush();
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Sync()
+{
+ GdiFlush();
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetInputContext( SalInputContext* pContext )
+{
+ BOOL bIME = pContext->mnOptions != 0;
+ if ( bIME == maFrameData.mbIME )
+ return;
+
+ maFrameData.mbIME = bIME;
+ if ( !bIME )
+ {
+ ImmAssociateContext( maFrameData.mhWnd, 0 );
+ maFrameData.mbHandleIME = FALSE;
+ }
+ else
+ {
+ if ( maFrameData.mhDefIMEContext )
+ {
+ ImmAssociateContext( maFrameData.mhWnd, maFrameData.mhDefIMEContext );
+ UINT nImeProps = ImmGetProperty( GetKeyboardLayout( 0 ), IGP_PROPERTY );
+ maFrameData.mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0;
+ maFrameData.mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0;
+ maFrameData.mbHandleIME = !maFrameData.mbSpezIME;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::UpdateExtTextInputArea()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::EndExtTextInput( USHORT nFlags )
+{
+ HWND hWnd = maFrameData.mhWnd;
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ DWORD nIndex;
+ if ( nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE )
+ nIndex = CPS_COMPLETE;
+ else
+ nIndex = CPS_CANCEL;
+
+ ImmNotifyIME( hIMC, NI_COMPOSITIONSTR, nIndex, 0 );
+ ImmReleaseContext( hWnd, hIMC );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf,
+ UINT& rCount, UINT nMaxSize,
+ const sal_Char* pReplace )
+{
+ DBG_ASSERT( sizeof( WCHAR ) == sizeof( xub_Unicode ), "SalFrame::ImplGetKeyNameTextW(): WCHAR != sal_Unicode" );
+
+ WCHAR aKeyBuf[350];
+ int nKeyLen = 0;
+ if ( lParam )
+ {
+ nKeyLen = GetKeyNameTextW( lParam, aKeyBuf, sizeof( aKeyBuf ) / sizeof( sal_Unicode ) );
+ if ( nKeyLen > 0 )
+ {
+ // Convert name, so that the keyname start with an upper
+ // char and the rest of the word are in lower chars
+ CharLowerBuffW( aKeyBuf, nKeyLen );
+ CharUpperBuffW( aKeyBuf, 1 );
+ WCHAR cTempChar;
+ WCHAR* pKeyBuf = aKeyBuf;
+ while ( (cTempChar = *pKeyBuf) != 0 )
+ {
+ if ( (cTempChar == '+') || (cTempChar == '-') ||
+ (cTempChar == ' ') || (cTempChar == '.') )
+ CharUpperBuffW( pKeyBuf+1, 1 );
+ pKeyBuf++;
+ }
+ }
+ else
+ {
+ sal_Char aAnsiKeyBuf[250];
+ int nAnsiKeyLen = GetKeyNameTextA( lParam, aAnsiKeyBuf, sizeof( aAnsiKeyBuf ) / sizeof( sal_Char ) );
+ if ( nAnsiKeyLen )
+ {
+ // Convert name, so that the keyname start with an upper
+ // char and the rest of the word are in lower chars
+ CharLowerBuffA( aAnsiKeyBuf, nAnsiKeyLen );
+ CharUpperBuffA( aAnsiKeyBuf, 1 );
+ sal_Char cTempChar;
+ sal_Char* pAnsiKeyBuf = aAnsiKeyBuf;
+ while ( (cTempChar = *pAnsiKeyBuf) != 0 )
+ {
+ if ( (cTempChar == '+') || (cTempChar == '-') ||
+ (cTempChar == ' ') || (cTempChar == '.') )
+ CharUpperBuffA( pAnsiKeyBuf+1, 1 );
+ pAnsiKeyBuf++;
+ }
+
+ // Convert to Unicode and copy the data in the Unicode Buffer
+ nKeyLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, aAnsiKeyBuf, nAnsiKeyLen, aKeyBuf, sizeof( aKeyBuf ) / sizeof( sal_Unicode ) );
+ }
+ }
+ }
+
+ if ( (nKeyLen > 0) || pReplace )
+ {
+ if ( rCount )
+ {
+ pBuf[rCount] = '+';
+ rCount++;
+ }
+
+ if ( nKeyLen )
+ {
+ memcpy( pBuf+rCount, aKeyBuf, nKeyLen*sizeof( sal_Unicode ) );
+ rCount += nKeyLen;
+ }
+ else
+ {
+ while ( *pReplace )
+ {
+ pBuf[rCount] = *pReplace;
+ rCount++;
+ pReplace++;
+ }
+ }
+ }
+ else
+ rCount = 0;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalFrame::GetKeyName( USHORT nKeyCode )
+{
+ XubString aKeyCode;
+ sal_Unicode aKeyBuf[350];
+ UINT nKeyBufLen = 0;
+ UINT nSysCode;
+
+ if ( nKeyCode & KEY_MOD2 )
+ {
+ nSysCode = MapVirtualKey( VK_MENU, 0 );
+ nSysCode = (nSysCode << 16) | (((ULONG)1) << 25);
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ "Alt" );
+ }
+
+ if ( nKeyCode & KEY_MOD1 )
+ {
+ nSysCode = MapVirtualKey( VK_CONTROL, 0 );
+ nSysCode = (nSysCode << 16) | (((ULONG)1) << 25);
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ "Ctrl" );
+ }
+
+ if ( nKeyCode & KEY_SHIFT )
+ {
+ nSysCode = MapVirtualKey( VK_SHIFT, 0 );
+ nSysCode = (nSysCode << 16) | (((ULONG)1) << 25);
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ "Shift" );
+ }
+
+ USHORT nCode = nKeyCode & 0x0FFF;
+ ULONG nSysCode2 = 0;
+ sal_Char* pReplace = NULL;
+ sal_Unicode cSVCode = 0;
+ sal_Char aFBuf[4];
+ nSysCode = 0;
+
+ if ( (nCode >= KEY_0) && (nCode <= KEY_9) )
+ cSVCode = '0' + (nCode - KEY_0);
+ else if ( (nCode >= KEY_A) && (nCode <= KEY_Z) )
+ cSVCode = 'A' + (nCode - KEY_A);
+ else if ( (nCode >= KEY_F1) && (nCode <= KEY_F26) )
+ {
+ nSysCode = VK_F1 + (nCode - KEY_F1);
+ aFBuf[0] = 'F';
+ if ( (nCode >= KEY_F1) && (nCode <= KEY_F9) )
+ {
+ aFBuf[1] = '1' + (nCode - KEY_F1);
+ aFBuf[2] = 0;
+ }
+ else if ( (nCode >= KEY_F10) && (nCode <= KEY_F19) )
+ {
+ aFBuf[1] = '1';
+ aFBuf[2] = '0' + (nCode - KEY_F10);
+ aFBuf[3] = 0;
+ }
+ else
+ {
+ aFBuf[1] = '2';
+ aFBuf[2] = '0' + (nCode - KEY_F20);
+ aFBuf[3] = 0;
+ }
+ pReplace = aFBuf;
+ }
+ else
+ {
+ switch ( nCode )
+ {
+ case KEY_DOWN:
+ nSysCode = VK_DOWN;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Down";
+ break;
+ case KEY_UP:
+ nSysCode = VK_UP;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Up";
+ break;
+ case KEY_LEFT:
+ nSysCode = VK_LEFT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Left";
+ break;
+ case KEY_RIGHT:
+ nSysCode = VK_RIGHT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Right";
+ break;
+ case KEY_HOME:
+ nSysCode = VK_HOME;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Home";
+ break;
+ case KEY_END:
+ nSysCode = VK_END;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "End";
+ break;
+ case KEY_PAGEUP:
+ nSysCode = VK_PRIOR;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Page Up";
+ break;
+ case KEY_PAGEDOWN:
+ nSysCode = VK_NEXT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Page Down";
+ break;
+ case KEY_RETURN:
+ nSysCode = VK_RETURN;
+ pReplace = "Enter";
+ break;
+ case KEY_ESCAPE:
+ nSysCode = VK_ESCAPE;
+ pReplace = "Escape";
+ break;
+ case KEY_TAB:
+ nSysCode = VK_TAB;
+ pReplace = "Tab";
+ break;
+ case KEY_BACKSPACE:
+ nSysCode = VK_BACK;
+ pReplace = "Backspace";
+ break;
+ case KEY_SPACE:
+ nSysCode = VK_SPACE;
+ pReplace = "Space";
+ break;
+ case KEY_INSERT:
+ nSysCode = VK_INSERT;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Insert";
+ break;
+ case KEY_DELETE:
+ nSysCode = VK_DELETE;
+ nSysCode2 = (((ULONG)1) << 24);
+ pReplace = "Delete";
+ break;
+
+ case KEY_ADD:
+ cSVCode = '+';
+ break;
+ case KEY_SUBTRACT:
+ cSVCode = '-';
+ break;
+ case KEY_MULTIPLY:
+ cSVCode = '*';
+ break;
+ case KEY_DIVIDE:
+ cSVCode = '/';
+ break;
+ case KEY_POINT:
+ cSVCode = '.';
+ break;
+ case KEY_COMMA:
+ cSVCode = ',';
+ break;
+ case KEY_LESS:
+ cSVCode = '<';
+ break;
+ case KEY_GREATER:
+ cSVCode = '>';
+ break;
+ case KEY_EQUAL:
+ cSVCode = '=';
+ break;
+ }
+ }
+
+ if ( nSysCode )
+ {
+ nSysCode = MapVirtualKey( (UINT)nSysCode, 0 );
+ if ( nSysCode )
+ nSysCode = (nSysCode << 16) | nSysCode2;
+ ImplGetKeyNameText( nSysCode, aKeyBuf, nKeyBufLen,
+ sizeof( aKeyBuf ) / sizeof( sal_Unicode ),
+ pReplace );
+ }
+ else
+ {
+ if ( cSVCode )
+ {
+ if ( !nKeyBufLen )
+ {
+ aKeyBuf[0] = cSVCode;
+ nKeyBufLen = 1;
+ }
+ else
+ {
+ aKeyBuf[nKeyBufLen] = '+';
+ nKeyBufLen++;
+ aKeyBuf[nKeyBufLen] = cSVCode;
+ nKeyBufLen++;
+ }
+ }
+ }
+
+ if ( nKeyBufLen )
+ aKeyCode.Assign( (const sal_Unicode*)aKeyBuf, nKeyBufLen );
+
+ return aKeyCode;
+}
+
+// -----------------------------------------------------------------------
+
+XubString SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode )
+{
+ return GetKeyName( nKeyCode );
+}
+
+// -----------------------------------------------------------------------
+
+inline Color ImplWinColorToSal( COLORREF nColor )
+{
+ return Color( GetRValue( nColor ), GetGValue( nColor ), GetBValue( nColor ) );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalUpdateStyleFontA( const LOGFONTA& rLogFont, Font& rFont,
+ BOOL bOverwriteSystemCharSet )
+{
+ ImplSalLogFontToFontA( rLogFont, rFont );
+ if ( bOverwriteSystemCharSet && (rFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL) )
+ rFont.SetCharSet( gsl_getSystemTextEncoding() );
+ // Da bei einigen Windows-Einstellungen 6 Punkt eingetragen ist,
+ // obwohl im Dialog 8 Punkt angezeigt werden (da MS Sans Serif
+ // nicht skalierbar ist) vergroessern wir hier das als Hack, da
+ // ansonsten in russisch Symbolunterschriften nicht lesbar sind
+ if ( (rFont.GetName().EqualsIgnoreCaseAscii( "MS Sans Serif" ) ) &&
+ (rFont.GetHeight() < 8) )
+ rFont.SetHeight( 8 );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplSalUpdateStyleFontW( const LOGFONTW& rLogFont, Font& rFont,
+ BOOL bOverwriteSystemCharSet )
+{
+ ImplSalLogFontToFontW( rLogFont, rFont );
+ if ( bOverwriteSystemCharSet && (rFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL) )
+ rFont.SetCharSet( gsl_getSystemTextEncoding() );
+ // Da bei einigen Windows-Einstellungen 6 Punkt eingetragen ist,
+ // obwohl im Dialog 8 Punkt angezeigt werden (da MS Sans Serif
+ // nicht skalierbar ist) vergroessern wir hier das als Hack, da
+ // ansonsten in russisch Symbolunterschriften nicht lesbar sind
+ if ( (rFont.GetName().EqualsIgnoreCaseAscii( "MS Sans Serif" ) ) &&
+ (rFont.GetHeight() < 8) )
+ rFont.SetHeight( 8 );
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplA2I( const BYTE* pStr )
+{
+ long n = 0;
+ int nSign = 1;
+
+ if ( *pStr == '-' )
+ {
+ nSign = -1;
+ pStr++;
+ }
+
+ while( (*pStr >= 48) && (*pStr <= 57) )
+ {
+ n *= 10;
+ n += ((*pStr) - 48);
+ pStr++;
+ }
+
+ n *= nSign;
+
+ return n;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::UpdateSettings( AllSettings& rSettings )
+{
+ MouseSettings aMouseSettings = rSettings.GetMouseSettings();
+ aMouseSettings.SetDoubleClickTime( GetDoubleClickTime() );
+ aMouseSettings.SetDoubleClickWidth( GetSystemMetrics( SM_CXDOUBLECLK ) );
+ aMouseSettings.SetDoubleClickHeight( GetSystemMetrics( SM_CYDOUBLECLK ) );
+ long nDragWidth = GetSystemMetrics( SM_CXDRAG );
+ long nDragHeight = GetSystemMetrics( SM_CYDRAG );
+ if ( nDragWidth )
+ aMouseSettings.SetStartDragWidth( nDragWidth );
+ if ( nDragHeight )
+ aMouseSettings.SetStartDragHeight( nDragHeight );
+ HKEY hRegKey;
+ if ( RegOpenKey( HKEY_CURRENT_USER,
+ "Control Panel\\Desktop",
+ &hRegKey ) == ERROR_SUCCESS )
+ {
+ BYTE aValueBuf[10];
+ DWORD nValueSize = sizeof( aValueBuf );
+ DWORD nType;
+ if ( RegQueryValueEx( hRegKey, "MenuShowDelay", 0,
+ &nType, aValueBuf, &nValueSize ) == ERROR_SUCCESS )
+ {
+ if ( nType == REG_SZ )
+ aMouseSettings.SetMenuDelay( (ULONG)ImplA2I( aValueBuf ) );
+ }
+
+ RegCloseKey( hRegKey );
+ }
+
+ StyleSettings aStyleSettings = rSettings.GetStyleSettings();
+ BOOL bCompBorder = (aStyleSettings.GetOptions() & (STYLE_OPTION_MACSTYLE | STYLE_OPTION_UNIXSTYLE)) == 0;
+ aStyleSettings.SetScrollBarSize( GetSystemMetrics( SM_CXVSCROLL ) );
+ aStyleSettings.SetSpinSize( GetSystemMetrics( SM_CXVSCROLL ) );
+ aStyleSettings.SetCursorBlinkTime( GetCaretBlinkTime() );
+ if ( bCompBorder )
+ {
+ aStyleSettings.SetFloatTitleHeight( GetSystemMetrics( SM_CYSMCAPTION ) );
+ aStyleSettings.SetTitleHeight( GetSystemMetrics( SM_CYCAPTION ) );
+ aStyleSettings.SetActiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVEBORDER ) ) );
+ aStyleSettings.SetDeactiveBorderColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVEBORDER ) ) );
+ if ( aSalShlData.mnVersion >= 410 )
+ {
+ aStyleSettings.SetActiveColor2( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTACTIVECAPTION ) ) );
+ aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_GRADIENTINACTIVECAPTION ) ) );
+ }
+ aStyleSettings.SetFaceColor( ImplWinColorToSal( GetSysColor( COLOR_3DFACE ) ) );
+ aStyleSettings.SetLightColor( ImplWinColorToSal( GetSysColor( COLOR_3DHILIGHT ) ) );
+ aStyleSettings.SetLightBorderColor( ImplWinColorToSal( GetSysColor( COLOR_3DLIGHT ) ) );
+ aStyleSettings.SetShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DSHADOW ) ) );
+ aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DDKSHADOW ) ) );
+ }
+ aStyleSettings.SetHelpColor( ImplWinColorToSal( GetSysColor( COLOR_INFOBK ) ) );
+ aStyleSettings.SetHelpTextColor( ImplWinColorToSal( GetSysColor( COLOR_INFOTEXT ) ) );
+ aStyleSettings.SetDialogColor( aStyleSettings.GetFaceColor() );
+ aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() );
+ aStyleSettings.SetButtonTextColor( ImplWinColorToSal( GetSysColor( COLOR_BTNTEXT ) ) );
+ aStyleSettings.SetRadioCheckTextColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOWTEXT ) ) );
+ aStyleSettings.SetGroupTextColor( aStyleSettings.GetRadioCheckTextColor() );
+ aStyleSettings.SetLabelTextColor( aStyleSettings.GetRadioCheckTextColor() );
+ aStyleSettings.SetInfoTextColor( aStyleSettings.GetRadioCheckTextColor() );
+ aStyleSettings.SetWindowColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOW ) ) );
+ aStyleSettings.SetWindowTextColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOWTEXT ) ) );
+ aStyleSettings.SetFieldColor( aStyleSettings.GetWindowColor() );
+ aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() );
+ aStyleSettings.SetHighlightColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHT ) ) );
+ aStyleSettings.SetHighlightTextColor( ImplWinColorToSal( GetSysColor( COLOR_HIGHLIGHTTEXT ) ) );
+ aStyleSettings.SetMenuHighlightColor( aStyleSettings.GetHighlightColor() );
+ aStyleSettings.SetMenuHighlightTextColor( aStyleSettings.GetHighlightTextColor() );
+ if ( bCompBorder )
+ {
+ aStyleSettings.SetMenuColor( ImplWinColorToSal( GetSysColor( COLOR_MENU ) ) );
+ aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) );
+ aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) );
+ aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) );
+ aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) );
+ aStyleSettings.SetDeactiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ) );
+ }
+ // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht
+ if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY )
+ aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
+ else
+ {
+ // Checked-Color berechnen
+ Color aColor1 = aStyleSettings.GetFaceColor();
+ Color aColor2 = aStyleSettings.GetLightColor();
+ BYTE nRed = (BYTE)(((USHORT)aColor1.GetRed() + (USHORT)aColor2.GetRed())/2);
+ BYTE nGreen = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2);
+ BYTE nBlue = (BYTE)(((USHORT)aColor1.GetBlue() + (USHORT)aColor2.GetBlue())/2);
+ aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) );
+ }
+
+ // Query Fonts
+ int bOverwriteSystemCharSet = getenv("LC_CHARSET") != 0;
+ Font aMenuFont = aStyleSettings.GetMenuFont();
+ Font aTitleFont = aStyleSettings.GetTitleFont();
+ Font aFloatTitleFont = aStyleSettings.GetFloatTitleFont();
+ Font aHelpFont = aStyleSettings.GetHelpFont();
+ Font aAppFont = aStyleSettings.GetAppFont();
+ Font aIconFont = aStyleSettings.GetIconFont();
+ if ( aSalShlData.mbWNT )
+ {
+ NONCLIENTMETRICSW aNonClientMetrics;
+ aNonClientMetrics.cbSize = sizeof( aNonClientMetrics );
+ if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) )
+ {
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfMenuFont, aMenuFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfCaptionFont, aTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfStatusFont, aHelpFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontW( aNonClientMetrics.lfMessageFont, aAppFont, bOverwriteSystemCharSet );
+
+ LOGFONTW aLogFont;
+ if ( SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) )
+ ImplSalUpdateStyleFontW( aLogFont, aIconFont, bOverwriteSystemCharSet );
+ }
+ }
+ else
+ {
+ NONCLIENTMETRICSA aNonClientMetrics;
+ aNonClientMetrics.cbSize = sizeof( aNonClientMetrics );
+ if ( SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) )
+ {
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfMenuFont, aMenuFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfCaptionFont, aTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfSmCaptionFont, aFloatTitleFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfStatusFont, aHelpFont, bOverwriteSystemCharSet );
+ ImplSalUpdateStyleFontA( aNonClientMetrics.lfMessageFont, aAppFont, bOverwriteSystemCharSet );
+
+ LOGFONTA aLogFont;
+ if ( SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0, &aLogFont, 0 ) )
+ ImplSalUpdateStyleFontA( aLogFont, aIconFont, bOverwriteSystemCharSet );
+ }
+ }
+ aStyleSettings.SetMenuFont( aMenuFont );
+ aStyleSettings.SetTitleFont( aTitleFont );
+ aStyleSettings.SetFloatTitleFont( aFloatTitleFont );
+ aStyleSettings.SetHelpFont( aHelpFont );
+ aStyleSettings.SetIconFont( aIconFont );
+ // We prefer Arial in the russian version, because MS Sans Serif
+ // is to wide for the dialogs
+ if ( rSettings.GetInternational().GetLanguage() == LANGUAGE_RUSSIAN )
+ {
+ XubString aFontName = aAppFont.GetName();
+ XubString aFirstName = aFontName.GetToken( 0, ';' );
+ if ( aFirstName.EqualsIgnoreCaseAscii( "MS Sans Serif" ) )
+ {
+ aFontName.InsertAscii( "Arial;", 0 );
+ aAppFont.SetName( aFontName );
+ }
+ }
+ aStyleSettings.SetAppFont( aAppFont );
+ aStyleSettings.SetGroupFont( aAppFont );
+ aStyleSettings.SetLabelFont( aAppFont );
+ aStyleSettings.SetRadioCheckFont( aAppFont );
+ aStyleSettings.SetPushButtonFont( aAppFont );
+ aStyleSettings.SetFieldFont( aAppFont );
+ if ( aAppFont.GetWeight() > WEIGHT_NORMAL )
+ aAppFont.SetWeight( WEIGHT_NORMAL );
+ aStyleSettings.SetInfoFont( aAppFont );
+ aStyleSettings.SetToolFont( aAppFont );
+
+ WIN_BOOL bDragFull;
+ if ( SystemParametersInfo( SPI_GETDRAGFULLWINDOWS, 0, &bDragFull, 0 ) )
+ {
+ ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions();
+ if ( bDragFull )
+ nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT;
+ else
+ nDragFullOptions &= ~(DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT);
+ aStyleSettings.SetDragFullOptions( nDragFullOptions );
+ }
+
+ aStyleSettings.SetIconHorzSpace( GetSystemMetrics( SM_CXICONSPACING ) );
+ aStyleSettings.SetIconVertSpace( GetSystemMetrics( SM_CYICONSPACING ) );
+ if ( RegOpenKey( HKEY_CURRENT_USER,
+ "Control Panel\\International\\Calendars\\TwoDigitYearMax",
+ &hRegKey ) == ERROR_SUCCESS )
+ {
+ BYTE aValueBuf[10];
+ DWORD nValue;
+ DWORD nValueSize = sizeof( aValueBuf );
+ DWORD nType;
+ if ( RegQueryValueEx( hRegKey, "1", 0,
+ &nType, aValueBuf, &nValueSize ) == ERROR_SUCCESS )
+ {
+ if ( nType == REG_SZ )
+ {
+ nValue = (ULONG)ImplA2I( aValueBuf );
+ if ( (nValue > 1000) && (nValue < 10000) )
+ {
+ MiscSettings aMiscSettings = rSettings.GetMiscSettings();
+ aMiscSettings.SetTwoDigitYearStart( (USHORT)(nValue-99) );
+ rSettings.SetMiscSettings( aMiscSettings );
+ }
+ }
+ }
+
+ RegCloseKey( hRegKey );
+ }
+
+ rSettings.SetMouseSettings( aMouseSettings );
+ rSettings.SetStyleSettings( aStyleSettings );
+}
+
+// -----------------------------------------------------------------------
+
+const SystemEnvData* SalFrame::GetSystemData() const
+{
+ return &maFrameData.maSysData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::Beep( SoundType eSoundType )
+{
+ static UINT aImplSoundTab[5] =
+ {
+ 0, // SOUND_DEFAULT
+ MB_ICONASTERISK, // SOUND_INFO
+ MB_ICONEXCLAMATION, // SOUND_WARNING
+ MB_ICONHAND, // SOUND_ERROR
+ MB_ICONQUESTION // SOUND_QUERY
+ };
+
+#if SOUND_COUNT != 5
+#error New Sound must be defined!
+#endif
+
+ MessageBeep( aImplSoundTab[eSoundType] );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::SetCallback( void* pInst, SALFRAMEPROC pProc )
+{
+ maFrameData.mpInst = pInst;
+ if ( pProc )
+ maFrameData.mpProc = pProc;
+ else
+ maFrameData.mpProc = ImplSalCallbackDummy;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ SalMouseEvent aMouseEvt;
+ long nRet;
+ USHORT nEvent;
+ BOOL bCall = TRUE;
+
+ aMouseEvt.mnX = (short)LOWORD( lParam );
+ aMouseEvt.mnY = (short)HIWORD( lParam );
+ aMouseEvt.mnCode = 0;
+ aMouseEvt.mnTime = GetMessageTime();
+
+ // Wegen (Logitech-)MouseTreiber ueber GetKeyState() gehen, die auf
+ // mittlerer Maustaste Doppelklick simulieren und den KeyStatus nicht
+ // beruecksichtigen
+
+ if ( GetKeyState( VK_LBUTTON ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_LEFT;
+ if ( GetKeyState( VK_MBUTTON ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_MIDDLE;
+ if ( GetKeyState( VK_RBUTTON ) & 0x8000 )
+ aMouseEvt.mnCode |= MOUSE_RIGHT;
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ aMouseEvt.mnCode |= KEY_MOD2;
+
+ switch ( nMsg )
+ {
+ case WM_MOUSEMOVE:
+ {
+ // Da bei Druecken von Modifier-Tasten die MouseEvents
+ // nicht zusammengefast werden (da diese durch KeyEvents
+ // unterbrochen werden), machen wir dieses hier selber
+ if ( aMouseEvt.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) )
+ {
+ MSG aTempMsg;
+ if ( ImplPeekMessage( &aTempMsg, hWnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE | PM_NOYIELD ) )
+ {
+ if ( (aTempMsg.message == WM_MOUSEMOVE) &&
+ (aTempMsg.wParam == wParam) )
+ return 1;
+ }
+ }
+
+ SalData* pSalData = GetSalData();
+ // Test for MouseLeave
+ if ( pSalData->mhWantLeaveMsg && (pSalData->mhWantLeaveMsg != hWnd) )
+ ImplSendMessage( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, GetMessagePos() );
+ pSalData->mhWantLeaveMsg = hWnd;
+ // Start MouseLeave-Timer
+ if ( !pSalData->mpMouseLeaveTimer )
+ {
+ pSalData->mpMouseLeaveTimer = new AutoTimer;
+ pSalData->mpMouseLeaveTimer->SetTimeout( SAL_MOUSELEAVE_TIMEOUT );
+ pSalData->mpMouseLeaveTimer->Start();
+ // We dont need to set a timeout handler, because we test
+ // for mouseleave in the timeout callback
+ }
+ aMouseEvt.mnButton = 0;
+ nEvent = SALEVENT_MOUSEMOVE;
+ }
+ break;
+
+ case WM_NCMOUSEMOVE:
+ case SAL_MSG_MOUSELEAVE:
+ {
+ SalData* pSalData = GetSalData();
+ if ( pSalData->mhWantLeaveMsg == hWnd )
+ {
+ pSalData->mhWantLeaveMsg = 0;
+ if ( pSalData->mpMouseLeaveTimer )
+ {
+ delete pSalData->mpMouseLeaveTimer;
+ pSalData->mpMouseLeaveTimer = NULL;
+ }
+ // Mouse-Coordinaates are relativ to the screen
+ POINT aPt;
+ aPt.x = (short)LOWORD( lParam );
+ aPt.y = (short)HIWORD( lParam );
+ ScreenToClient( hWnd, &aPt );
+ aMouseEvt.mnX = aPt.x;
+ aMouseEvt.mnY = aPt.y;
+ aMouseEvt.mnButton = 0;
+ nEvent = SALEVENT_MOUSELEAVE;
+ }
+ else
+ bCall = FALSE;
+ }
+ break;
+
+ case WM_LBUTTONDOWN:
+ aMouseEvt.mnButton = MOUSE_LEFT;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ break;
+
+ case WM_MBUTTONDOWN:
+ aMouseEvt.mnButton = MOUSE_MIDDLE;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ break;
+
+ case WM_RBUTTONDOWN:
+ aMouseEvt.mnButton = MOUSE_RIGHT;
+ nEvent = SALEVENT_MOUSEBUTTONDOWN;
+ break;
+
+ case WM_LBUTTONUP:
+ aMouseEvt.mnButton = MOUSE_LEFT;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+
+ case WM_MBUTTONUP:
+ aMouseEvt.mnButton = MOUSE_MIDDLE;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+
+ case WM_RBUTTONUP:
+ aMouseEvt.mnButton = MOUSE_RIGHT;
+ nEvent = SALEVENT_MOUSEBUTTONUP;
+ break;
+ }
+
+ if ( bCall )
+ {
+ if ( nEvent == SALEVENT_MOUSEBUTTONDOWN )
+ UpdateWindow( hWnd );
+
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nEvent, &aMouseEvt );
+ if ( nMsg == WM_MOUSEMOVE )
+ SetCursor( pFrame->maFrameData.mhCursor );
+ }
+ else
+ nRet = 0;
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleMouseActivateMsg( HWND hWnd )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ SalMouseActivateEvent aMouseActivateEvt;
+ POINT aPt;
+ GetCursorPos( &aPt );
+ ScreenToClient( hWnd, &aPt );
+ aMouseActivateEvt.mnX = aPt.x;
+ aMouseActivateEvt.mnY = aPt.y;
+ return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_MOUSEACTIVATE, &aMouseActivateEvt );
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleWheelMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ ImplSalYieldMutexAcquireWithWait();
+
+ long nRet = 0;
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ WORD nWinModCode = LOWORD( wParam );
+ POINT aWinPt;
+ aWinPt.x = (short)LOWORD( lParam );
+ aWinPt.y = (short)HIWORD( lParam );
+ ScreenToClient( hWnd, &aWinPt );
+
+ SalWheelMouseEvent aWheelEvt;
+ aWheelEvt.mnTime = GetMessageTime();
+ aWheelEvt.mnX = aWinPt.x;
+ aWheelEvt.mnY = aWinPt.y;
+ aWheelEvt.mnCode = 0;
+ aWheelEvt.mnDelta = (short)HIWORD( wParam );
+ aWheelEvt.mnNotchDelta = aWheelEvt.mnDelta/WHEEL_DELTA;
+ if ( aSalShlData.mnWheelScrollLines == WHEEL_PAGESCROLL )
+ aWheelEvt.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
+ else
+ aWheelEvt.mnScrollLines = aSalShlData.mnWheelScrollLines;
+ aWheelEvt.mbHorz = FALSE;
+
+ if ( nWinModCode & MK_SHIFT )
+ aWheelEvt.mnCode |= KEY_SHIFT;
+ if ( nWinModCode & MK_CONTROL )
+ aWheelEvt.mnCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ aWheelEvt.mnCode |= KEY_MOD2;
+
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_WHEELMOUSE, &aWheelEvt );
+ }
+
+ ImplSalYieldMutexRelease();
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static USHORT ImplSalGetKeyCode( WPARAM wParam )
+{
+ USHORT nKeyCode;
+
+ // convert KeyCode
+ if ( wParam < KEY_TAB_SIZE )
+ nKeyCode = aImplTranslateKeyTab[wParam];
+ else if ( wParam == aSalShlData.mnVKAdd )
+ nKeyCode = KEY_ADD;
+ else if ( wParam == aSalShlData.mnVKSubtract )
+ nKeyCode = KEY_SUBTRACT;
+ else if ( wParam == aSalShlData.mnVKMultiply )
+ nKeyCode = KEY_MULTIPLY;
+ else if ( wParam == aSalShlData.mnVKDivide )
+ nKeyCode = KEY_DIVIDE;
+ else if ( wParam == aSalShlData.mnVKPoint )
+ nKeyCode = KEY_POINT;
+ else if ( wParam == aSalShlData.mnVKComma )
+ nKeyCode = KEY_COMMA;
+ else if ( wParam == aSalShlData.mnVKLess )
+ nKeyCode = KEY_LESS;
+ else if ( wParam == aSalShlData.mnVKGreater )
+ nKeyCode = KEY_GREATER;
+ else if ( wParam == aSalShlData.mnVKEqual )
+ nKeyCode = KEY_EQUAL;
+ else
+ nKeyCode = 0;
+
+ return nKeyCode;
+}
+
+// -----------------------------------------------------------------------
+
+static UINT ImplStrToNum( const sal_Char* pStr )
+{
+ USHORT n = 0;
+
+ // Solange es sich um eine Ziffer handelt, String umwandeln
+ while( (*pStr >= 48) && (*pStr <= 57) )
+ {
+ n *= 10;
+ n += ((*pStr) - 48);
+ pStr++;
+ }
+
+ return n;
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Unicode ImplGetCharCode( SalFrame* pFrame, WPARAM nCharCode )
+{
+ // If we are on Windows NT we use Unicode FrameProcs and so we
+ // get Unicode charcodes directly from Windows
+ if ( aSalShlData.mbWNT )
+ return (sal_Unicode)nCharCode;
+
+ UINT nLang = LOWORD( GetKeyboardLayout( 0 ) );
+ if ( !nLang )
+ {
+ pFrame->maFrameData.mnInputLang = 0;
+ pFrame->maFrameData.mnInputCodePage = GetACP();
+ }
+ else if ( nLang != pFrame->maFrameData.mnInputLang )
+ {
+ pFrame->maFrameData.mnInputLang = nLang;
+ sal_Char aBuf[10];
+ if ( GetLocaleInfoA( MAKELCID( nLang, SORT_DEFAULT ), LOCALE_IDEFAULTANSICODEPAGE,
+ aBuf, sizeof(aBuf) ) > 0 )
+ {
+ pFrame->maFrameData.mnInputCodePage = ImplStrToNum( aBuf );
+ if ( !pFrame->maFrameData.mnInputCodePage )
+ pFrame->maFrameData.mnInputCodePage = GetACP();
+ }
+ else
+ pFrame->maFrameData.mnInputCodePage = GetACP();
+ }
+
+ sal_Char aCharBuf[2];
+ int nCharLen;
+ WCHAR c;
+ if ( nCharCode > 0xFF )
+ {
+ aCharBuf[0] = (sal_Char)(nCharCode>>8);
+ aCharBuf[1] = (sal_Char)nCharCode;
+ nCharLen = 2;
+ }
+ else
+ {
+ aCharBuf[0] = (sal_Char)nCharCode;
+ nCharLen = 1;
+ }
+ if ( ::MultiByteToWideChar( pFrame->maFrameData.mnInputCodePage,
+ MB_PRECOMPOSED,
+ aCharBuf, nCharLen, &c, 1 ) )
+ return (sal_Unicode)c;
+ else
+ return (sal_Unicode)nCharCode;
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+ static BOOL bIgnoreCharMsg = FALSE;
+ static WPARAM nDeadChar = 0;
+ static WPARAM nLastVKChar = 0;
+ static USHORT nLastChar = 0;
+ USHORT nRepeat = LOWORD( lParam )-1;
+ USHORT nModCode = 0;
+
+ // Key wurde evtl. durch SysChild an uns weitergeleitet und
+ // darf somit dann nicht doppelt verarbeitet werden
+ GetSalData()->mnSalObjWantKeyEvt = 0;
+
+ if ( nMsg == WM_DEADCHAR )
+ {
+ nDeadChar = wParam;
+ return 0;
+ }
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ // Wir restaurieren den Background-Modus bei jeder Texteingabe,
+ // da einige Tools wie RichWin uns diesen hin- und wieder umsetzen
+ if ( pFrame->maFrameData.mpGraphics &&
+ pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC )
+ SetBkMode( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC, TRANSPARENT );
+
+ // determine modifiers
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ {
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) &&
+ ((nMsg == WM_SYSKEYDOWN) || (nMsg == WM_SYSKEYUP)) )
+ nModCode |= KEY_CONTROLMOD;
+ }
+
+ if ( (nMsg == WM_CHAR) || (nMsg == WM_SYSCHAR) )
+ {
+ nDeadChar = 0;
+
+ if ( bIgnoreCharMsg )
+ {
+ bIgnoreCharMsg = FALSE;
+ return 0;
+ }
+
+ // Backspace ignorieren wir als eigenstaendige Taste,
+ // damit wir keine Probleme in Kombination mit einem
+ // DeadKey bekommen
+ if ( wParam == 0x08 ) // BACKSPACE
+ return 0;
+
+ // Hier kommen nur "freifliegende" WM_CHAR Message an, die durch
+ // eintippen einer ALT-NUMPAD Kombination erzeugt wurden
+ SalKeyEvent aKeyEvt;
+
+ if ( (wParam >= '0') && (wParam <= '9') )
+ aKeyEvt.mnCode = KEYGROUP_NUM + wParam - '0';
+ else if ( (wParam >= 'A') && (wParam <= 'Z') )
+ aKeyEvt.mnCode = KEYGROUP_ALPHA + wParam - 'A';
+ else if ( (wParam >= 'a') && (wParam <= 'z') )
+ aKeyEvt.mnCode = KEYGROUP_ALPHA + wParam - 'a';
+ else if ( wParam == 0x0D ) // RETURN
+ aKeyEvt.mnCode = KEY_RETURN;
+ else if ( wParam == 0x1B ) // ESCAPE
+ aKeyEvt.mnCode = KEY_ESCAPE;
+ else if ( wParam == 0x09 ) // TAB
+ aKeyEvt.mnCode = KEY_TAB;
+ else if ( wParam == 0x20 ) // SPACE
+ aKeyEvt.mnCode = KEY_SPACE;
+ else
+ aKeyEvt.mnCode = 0;
+
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnCharCode = ImplGetCharCode( pFrame, wParam );
+ aKeyEvt.mnRepeat = nRepeat;
+ nLastChar = 0;
+ nLastVKChar = 0;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return nRet;
+ }
+ else
+ {
+ // Bei Shift, Control und Menu schicken wir einen KeyModChange-Event
+ if ( (wParam == VK_SHIFT) || (wParam == VK_CONTROL) || (wParam == VK_MENU) )
+ {
+ SalKeyModEvent aModEvt;
+ aModEvt.mnTime = GetMessageTime();
+ aModEvt.mnCode = nModCode;
+ return pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYMODCHANGE, &aModEvt );
+ }
+ else
+ {
+ SalKeyEvent aKeyEvt;
+ USHORT nEvent;
+ MSG aCharMsg;
+ WIN_BOOL bCharPeek = FALSE;
+ UINT nCharMsg = WM_CHAR;
+ BOOL bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP);
+
+ aKeyEvt.mnCode = ImplSalGetKeyCode( wParam );
+ if ( !bKeyUp )
+ {
+ // check for charcode
+ // Mit Hilfe von PeekMessage holen wir uns jetzt die
+ // zugehoerige WM_CHAR Message, wenn vorhanden.
+ // Diese WM_CHAR Message steht immer am Anfang der
+ // Messagequeue. Ausserdem ist sichergestellt, dass immer
+ // nur eine WM_CHAR Message in der Queue steht.
+ bCharPeek = ImplPeekMessage( &aCharMsg, hWnd,
+ WM_CHAR, WM_CHAR, PM_NOREMOVE | PM_NOYIELD );
+ if ( bCharPeek && (nDeadChar == aCharMsg.wParam) )
+ {
+ bCharPeek = FALSE;
+ nDeadChar = 0;
+
+ if ( wParam == VK_BACK )
+ {
+ ImplPeekMessage( &aCharMsg, hWnd,
+ nCharMsg, nCharMsg, PM_REMOVE | PM_NOYIELD );
+ return 0;
+ }
+ }
+ else
+ {
+ if ( !bCharPeek )
+ {
+ bCharPeek = ImplPeekMessage( &aCharMsg, hWnd,
+ WM_SYSCHAR, WM_SYSCHAR, PM_NOREMOVE | PM_NOYIELD );
+ nCharMsg = WM_SYSCHAR;
+ }
+ }
+ if ( bCharPeek )
+ aKeyEvt.mnCharCode = ImplGetCharCode( pFrame, aCharMsg.wParam );
+ else
+ aKeyEvt.mnCharCode = 0;
+
+ nLastChar = aKeyEvt.mnCharCode;
+ nLastVKChar = wParam;
+ }
+ else
+ {
+ if ( wParam == nLastVKChar )
+ {
+ aKeyEvt.mnCharCode = nLastChar;
+ nLastChar = 0;
+ nLastVKChar = 0;
+ }
+ }
+
+ if ( aKeyEvt.mnCode || aKeyEvt.mnCharCode )
+ {
+ if ( bKeyUp )
+ nEvent = SALEVENT_KEYUP;
+ else
+ nEvent = SALEVENT_KEYINPUT;
+
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnRepeat = nRepeat;
+ bIgnoreCharMsg = bCharPeek;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nEvent, &aKeyEvt );
+ bIgnoreCharMsg = FALSE;
+
+ // char-message, than remove or ignore
+ if ( bCharPeek )
+ {
+ nDeadChar = 0;
+ if ( nRet )
+ {
+ ImplPeekMessage( &aCharMsg, hWnd,
+ nCharMsg, nCharMsg, PM_REMOVE | PM_NOYIELD );
+ }
+ else
+ bIgnoreCharMsg = TRUE;
+ }
+
+ return nRet;
+ }
+ else
+ return 0;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+long ImplHandleSalObjKeyMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+ if ( (nMsg == WM_KEYDOWN) || (nMsg == WM_KEYUP) )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ USHORT nRepeat = LOWORD( lParam )-1;
+ USHORT nModCode = 0;
+
+ // determine modifiers
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ if ( GetKeyState( VK_MENU ) & 0x8000 )
+ {
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) )
+ nModCode |= KEY_CONTROLMOD;
+ }
+
+ if ( (wParam != VK_SHIFT) && (wParam != VK_CONTROL) && (wParam != VK_MENU) )
+ {
+ SalKeyEvent aKeyEvt;
+ USHORT nEvent;
+ BOOL bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP);
+
+ // convert KeyCode
+ aKeyEvt.mnCode = ImplSalGetKeyCode( wParam );
+ aKeyEvt.mnCharCode = 0;
+
+ if ( aKeyEvt.mnCode )
+ {
+ if ( bKeyUp )
+ nEvent = SALEVENT_KEYUP;
+ else
+ nEvent = SALEVENT_KEYINPUT;
+
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnRepeat = nRepeat;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nEvent, &aKeyEvt );
+ return nRet;
+ }
+ else
+ return 0;
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+long ImplHandleSalObjSysCharMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ USHORT nRepeat = LOWORD( lParam )-1;
+ USHORT nModCode = 0;
+ USHORT cKeyCode = (USHORT)wParam;
+
+ // determine modifiers
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) )
+ nModCode |= KEY_CONTROLMOD;
+
+ // KeyEvent zusammenbauen
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnTime = GetMessageTime();
+ if ( (cKeyCode >= 48) && (cKeyCode <= 57) )
+ aKeyEvt.mnCode = KEY_0+(cKeyCode-48);
+ else if ( (cKeyCode >= 65) && (cKeyCode <= 90) )
+ aKeyEvt.mnCode = KEY_A+(cKeyCode-65);
+ else if ( (cKeyCode >= 97) && (cKeyCode <= 122) )
+ aKeyEvt.mnCode = KEY_A+(cKeyCode-97);
+ else
+ aKeyEvt.mnCode = 0;
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnCharCode = ImplGetCharCode( pFrame, cKeyCode );
+ aKeyEvt.mnRepeat = nRepeat;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandlePaintMsg( HWND hWnd )
+{
+ // Clip-Region muss zurueckgesetzt werden, da wir sonst kein
+ // ordentliches Bounding-Rectangle bekommen
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mpGraphics )
+ {
+ if ( pFrame->maFrameData.mpGraphics->maGraphicsData.mhRegion )
+ SelectClipRgn( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC, 0 );
+ }
+ ImplSalYieldMutexRelease();
+ }
+
+ // Laut Window-Doku soll man erst abfragen, ob ueberhaupt eine
+ // Paint-Region anliegt
+ if ( !GetUpdateRect( hWnd, NULL, FALSE ) )
+ return;
+
+ // BeginPaint
+ PAINTSTRUCT aPs;
+ BeginPaint( hWnd, &aPs );
+
+ // Paint
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ // ClipRegion wieder herstellen
+ if ( pFrame->maFrameData.mpGraphics )
+ {
+ if ( pFrame->maFrameData.mpGraphics->maGraphicsData.mhRegion )
+ {
+ SelectClipRgn( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC,
+ pFrame->maFrameData.mpGraphics->maGraphicsData.mhRegion );
+ }
+ }
+
+ SalPaintEvent aPEvt;
+ aPEvt.mnBoundX = aPs.rcPaint.left;
+ aPEvt.mnBoundY = aPs.rcPaint.top;
+ aPEvt.mnBoundWidth = aPs.rcPaint.right-aPs.rcPaint.left;
+ aPEvt.mnBoundHeight = aPs.rcPaint.bottom-aPs.rcPaint.top;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_PAINT, &aPEvt );
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else
+ {
+ RECT* pRect = new RECT;
+ *pRect = aPs.rcPaint;
+ ImplPostMessage( hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0 );
+ }
+
+ // EndPaint
+ EndPaint( hWnd, &aPs );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect )
+{
+ // Paint
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ SalPaintEvent aPEvt;
+ aPEvt.mnBoundX = pRect->left;
+ aPEvt.mnBoundY = pRect->top;
+ aPEvt.mnBoundWidth = pRect->right-pRect->left;
+ aPEvt.mnBoundHeight = pRect->bottom-pRect->top;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_PAINT, &aPEvt );
+ }
+ ImplSalYieldMutexRelease();
+ delete pRect;
+ }
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleMoveMsg( HWND hWnd )
+{
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ if ( GetWindowStyle( hWnd ) & WS_VISIBLE )
+ pFrame->maFrameData.mbDefPos = FALSE;
+
+ // Gegen moegliche Rekursionen sichern
+ if ( !pFrame->maFrameData.mbInMoveMsg )
+ {
+ // Fenster im FullScreenModus wieder einpassen
+ pFrame->maFrameData.mbInMoveMsg = TRUE;
+ if ( pFrame->maFrameData.mbFullScreen )
+ ImplSalFrameFullScreenPos( pFrame );
+ pFrame->maFrameData.mbInMoveMsg = FALSE;
+ }
+
+ // Status merken
+ ImplSaveFrameState( pFrame );
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTMOVE, 0, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCallSizeHdl( HWND hWnd )
+{
+ // Da Windows diese Messages auch senden kann, muss hier auch die
+ // Solar-Semaphore beruecksichtigt werden
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_RESIZE, 0 );
+ // Um doppelte Paints von VCL und SAL zu vermeiden
+ if ( IsWindowVisible( hWnd ) && !pFrame->maFrameData.mbInShow )
+ UpdateWindow( hWnd );
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTCALLSIZE, 0, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleSizeMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ if ( (wParam != SIZE_MAXSHOW) && (wParam != SIZE_MAXHIDE) )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mnWidth = (int)LOWORD(lParam);
+ pFrame->maFrameData.mnHeight = (int)HIWORD(lParam);
+ // Status merken
+ ImplSaveFrameState( pFrame );
+ // Call Hdl
+ ImplCallSizeHdl( hWnd );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleFocusMsg( HWND hWnd )
+{
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ // Query the actual status
+ if ( ::GetFocus() == hWnd )
+ {
+ if ( IsWindowVisible( hWnd ) && !pFrame->maFrameData.mbInShow )
+ UpdateWindow( hWnd );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_GETFOCUS, 0 );
+ }
+ else
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_LOSEFOCUS, 0 );
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( hWnd, SAL_MSG_POSTFOCUS, 0, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleCloseMsg( HWND hWnd )
+{
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_CLOSE, 0 );
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( hWnd, WM_CLOSE, 0, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+static long ImplHandleShutDownMsg( HWND hWnd )
+{
+ ImplSalYieldMutexAcquireWithWait();
+ long nRet = 0;
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_SHUTDOWN, 0 );
+ }
+ ImplSalYieldMutexRelease();
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam )
+{
+ USHORT nSalEvent = SALEVENT_SETTINGSCHANGED;
+
+ if ( nMsg == WM_DEVMODECHANGE )
+ nSalEvent = SALEVENT_PRINTERCHANGED;
+#ifdef WM_DISPLAYCHANGE
+ else if ( nMsg == WM_DISPLAYCHANGE )
+ nSalEvent = SALEVENT_DISPLAYCHANGED;
+#endif
+ else if ( nMsg == WM_FONTCHANGE )
+ nSalEvent = SALEVENT_FONTCHANGED;
+ else if ( nMsg == WM_TIMECHANGE )
+ nSalEvent = SALEVENT_DATETIMECHANGED;
+ else if ( nMsg == WM_WININICHANGE )
+ {
+ if ( lParam )
+ {
+ if ( aSalShlData.mbWNT )
+ {
+ if ( ImplSalWICompareAscii( (const wchar_t*)lParam, "devices" ) == 0 )
+ nSalEvent = SALEVENT_PRINTERCHANGED;
+ }
+ else
+ {
+ if ( stricmp( (const char*)lParam, "devices" ) == 0 )
+ nSalEvent = SALEVENT_PRINTERCHANGED;
+ }
+ }
+ }
+
+#ifdef WM_SETTINGCHANGE
+ if ( nMsg == WM_SETTINGCHANGE )
+ {
+ if ( wParam == SPI_SETWHEELSCROLLLINES )
+ aSalShlData.mnWheelScrollLines = ImplSalGetWheelScrollLines();
+ }
+#endif
+
+ if ( WM_SYSCOLORCHANGE == nMsg && GetSalData()->mhDitherPal )
+ ImplUpdateSysColorEntries();
+
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ if ( (nMsg == WM_DISPLAYCHANGE) || (nMsg == WM_WININICHANGE) )
+ {
+ if ( pFrame->maFrameData.mbFullScreen )
+ ImplSalFrameFullScreenPos( pFrame );
+ }
+
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ nSalEvent, 0 );
+ }
+
+ ImplSalYieldMutexRelease();
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleUserEvent( HWND hWnd, LPARAM lParam )
+{
+ ImplSalYieldMutexAcquireWithWait();
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_USEREVENT, (void*)lParam );
+ }
+ ImplSalYieldMutexRelease();
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleForcePalette( HWND hWnd )
+{
+ SalData* pSalData = GetSalData();
+ HPALETTE hPal = pSalData->mhDitherPal;
+ if ( hPal )
+ {
+ if ( !ImplSalYieldMutexTryToAcquire() )
+ {
+ ImplPostMessage( hWnd, SAL_MSG_FORCEPALETTE, 0, 0 );
+ return;
+ }
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mpGraphics )
+ {
+ SalGraphics* pGraphics = pFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC, hPal, FALSE );
+ if ( RealizePalette( pGraphics->maGraphicsData.mhDC ) )
+ {
+ InvalidateRect( hWnd, NULL, FALSE );
+ UpdateWindow( hWnd );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_DISPLAYCHANGED, 0 );
+ }
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static LRESULT ImplHandlePalette( BOOL bFrame, HWND hWnd, UINT nMsg,
+ WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ SalData* pSalData = GetSalData();
+ HPALETTE hPal = pSalData->mhDitherPal;
+ if ( !hPal )
+ return 0;
+
+ rDef = FALSE;
+ if ( pSalData->mbInPalChange )
+ return 0;
+
+ if ( (nMsg == WM_PALETTECHANGED) || (nMsg == SAL_MSG_POSTPALCHANGED) )
+ {
+ if ( (HWND)wParam == hWnd )
+ return 0;
+ }
+
+ BOOL bReleaseMutex = FALSE;
+ if ( (nMsg == WM_QUERYNEWPALETTE) || (nMsg == WM_PALETTECHANGED) )
+ {
+ // Da Windows diese Messages auch sendet, muss hier auch die
+ // Solar-Semaphore beruecksichtigt werden
+ if ( ImplSalYieldMutexTryToAcquire() )
+ bReleaseMutex = TRUE;
+ else if ( nMsg == WM_QUERYNEWPALETTE )
+ ImplPostMessage( hWnd, SAL_MSG_POSTQUERYNEWPAL, wParam, lParam );
+ else /* ( nMsg == WM_PALETTECHANGED ) */
+ ImplPostMessage( hWnd, SAL_MSG_POSTPALCHANGED, wParam, lParam );
+ }
+
+ SalVirtualDevice* pTempVD;
+ SalFrame* pTempFrame;
+ SalGraphics* pGraphics;
+ HDC hDC;
+ HPALETTE hOldPal;
+ UINT nCols;
+ BOOL bStdDC;
+ BOOL bUpdate;
+
+ pSalData->mbInPalChange = TRUE;
+
+ // Alle Paletten in VirDevs und Frames zuruecksetzen
+ pTempVD = pSalData->mpFirstVD;
+ while ( pTempVD )
+ {
+ pGraphics = pTempVD->maVirDevData.mpGraphics;
+ if ( pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC,
+ pGraphics->maGraphicsData.mhDefPal,
+ TRUE );
+ }
+ pTempVD = pTempVD->maVirDevData.mpNext;
+ }
+ pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame )
+ {
+ pGraphics = pTempFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC,
+ pGraphics->maGraphicsData.mhDefPal,
+ TRUE );
+ }
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+ }
+
+ // Palette neu realizen
+ SalFrame* pFrame = NULL;
+ if ( bFrame )
+ pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mpGraphics )
+ {
+ hDC = pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC;
+ bStdDC = TRUE;
+ }
+ else
+ {
+ hDC = GetDC( hWnd );
+ bStdDC = FALSE;
+ }
+ UnrealizeObject( hPal );
+ hOldPal = SelectPalette( hDC, hPal, TRUE );
+ nCols = RealizePalette( hDC );
+ bUpdate = nCols != 0;
+ if ( !bStdDC )
+ {
+ SelectPalette( hDC, hOldPal, TRUE );
+ ReleaseDC( hWnd, hDC );
+ }
+
+ // Alle Paletten in VirDevs und Frames neu setzen
+ pTempVD = pSalData->mpFirstVD;
+ while ( pTempVD )
+ {
+ pGraphics = pTempVD->maVirDevData.mpGraphics;
+ if ( pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC, hPal, TRUE );
+ RealizePalette( pGraphics->maGraphicsData.mhDC );
+ }
+ pTempVD = pTempVD->maVirDevData.mpNext;
+ }
+ pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame )
+ {
+ if ( pTempFrame != pFrame )
+ {
+ pGraphics = pTempFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+ SelectPalette( pGraphics->maGraphicsData.mhDC, hPal, TRUE );
+ if ( RealizePalette( pGraphics->maGraphicsData.mhDC ) )
+ bUpdate = TRUE;
+ }
+ }
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+ }
+
+ // Wenn sich Farben geaendert haben, dann die Fenster updaten
+ if ( bUpdate )
+ {
+ pTempFrame = pSalData->mpFirstFrame;
+ while ( pTempFrame )
+ {
+ pGraphics = pTempFrame->maFrameData.mpGraphics;
+ if ( pGraphics && pGraphics->maGraphicsData.mhDefPal )
+ {
+ InvalidateRect( pTempFrame->maFrameData.mhWnd, NULL, FALSE );
+ UpdateWindow( pTempFrame->maFrameData.mhWnd );
+ pTempFrame->maFrameData.mpProc( pTempFrame->maFrameData.mpInst, pTempFrame,
+ SALEVENT_DISPLAYCHANGED, 0 );
+ }
+ pTempFrame = pTempFrame->maFrameData.mpNextFrame;
+ }
+ }
+
+ pSalData->mbInPalChange = FALSE;
+
+ if ( bReleaseMutex )
+ ImplSalYieldMutexRelease();
+
+ if ( nMsg == WM_PALETTECHANGED )
+ return 0;
+ else
+ return nCols;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplHandleMinMax( HWND hWnd, LPARAM lParam )
+{
+ int bRet = FALSE;
+
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ if ( pFrame->maFrameData.mbFullScreen )
+ {
+ MINMAXINFO* pMinMax = (MINMAXINFO*)lParam;
+ int nX;
+ int nY;
+ int nDX;
+ int nDY;
+ ImplSalCalcFullScreenSize( pFrame, nX, nY, nDX, nDY );
+
+ if ( pMinMax->ptMaxPosition.x > nX )
+ pMinMax->ptMaxPosition.x = nX;
+ if ( pMinMax->ptMaxPosition.y > nY )
+ pMinMax->ptMaxPosition.y = nY;
+
+ if ( pMinMax->ptMaxSize.x < nDX )
+ pMinMax->ptMaxSize.x = nDX;
+ if ( pMinMax->ptMaxSize.y < nDY )
+ pMinMax->ptMaxSize.y = nDY;
+ if ( pMinMax->ptMaxTrackSize.x < nDX )
+ pMinMax->ptMaxTrackSize.x = nDX;
+ if ( pMinMax->ptMaxTrackSize.y < nDY )
+ pMinMax->ptMaxTrackSize.y = nDY;
+
+ pMinMax->ptMinTrackSize.x = nDX;
+ pMinMax->ptMinTrackSize.y = nDY;
+
+ bRet = TRUE;
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( !pFrame )
+ return 0;
+
+ WPARAM nCommand = wParam & 0xFFF0;
+
+ if ( pFrame->maFrameData.mbFullScreen )
+ {
+ WIN_BOOL bMaximize = IsZoomed( pFrame->maFrameData.mhWnd );
+ WIN_BOOL bMinimize = IsIconic( pFrame->maFrameData.mhWnd );
+ if ( (nCommand == SC_SIZE) ||
+ (!bMinimize && (nCommand == SC_MOVE)) ||
+ (!bMaximize && (nCommand == SC_MAXIMIZE)) ||
+ (bMaximize && (nCommand == SC_RESTORE)) )
+ {
+ MessageBeep( 0 );
+ return TRUE;
+ }
+ }
+
+ if ( nCommand == SC_KEYMENU )
+ {
+ // Hier verarbeiten wir nur KeyMenu-Events fuer Alt um
+ // den MenuBar zu aktivieren, oder wenn ein SysChild-Fenster
+ // den Focus hat, da diese Alt+Tasten-Kombinationen nur
+ // ueber diesen Event verarbeitet werden
+ if ( !LOWORD( lParam ) )
+ {
+ // Nur ausloesen, wenn keine weitere Taste gedrueckt ist. Im
+ // Gegensatz zur Doku wird in der X-Koordinaate der CharCode
+ // geliefert, der zusaetzlich gedrueckt ist
+ // Also 32 fuer Space, 99 fuer c, 100 fuer d, ...
+ // Da dies nicht dokumentiert ist, fragen wir vorsichtshalber
+ // auch den Status der Space-Taste ab
+ if ( GetKeyState( VK_SPACE ) & 0x8000 )
+ return 0;
+
+ // Damit nicht bei Alt+Maustaste auch der MenuBar aktiviert wird
+ if ( (GetKeyState( VK_LBUTTON ) & 0x8000) ||
+ (GetKeyState( VK_RBUTTON ) & 0x8000) ||
+ (GetKeyState( VK_MBUTTON ) & 0x8000) )
+ return 1;
+
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnTime = GetMessageTime();
+ aKeyEvt.mnCode = KEY_MENU;
+ aKeyEvt.mnCharCode = 0;
+ aKeyEvt.mnRepeat = 0;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return (nRet != 0);
+ }
+ else
+ {
+ // Testen, ob ein SysChild den Focus hat
+ HWND hFocusWnd = ::GetFocus();
+ if ( hFocusWnd && ImplFindSalObject( hFocusWnd ) )
+ {
+ char cKeyCode = (char)(unsigned char)LOWORD( lParam );
+ // LowerCase
+ if ( (cKeyCode >= 65) && (cKeyCode <= 90) )
+ cKeyCode += 32;
+ // Wir nehmen nur 0-9 und A-Z, alle anderen Tasten muessen durch
+ // den Hook vom SalObj verarbeitet werden
+ if ( ((cKeyCode >= 48) && (cKeyCode <= 57)) ||
+ ((cKeyCode >= 97) && (cKeyCode <= 122)) )
+ {
+ USHORT nModCode = 0;
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nModCode |= KEY_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nModCode |= KEY_MOD1;
+ nModCode |= KEY_MOD2;
+ if ( !(nModCode & KEY_MOD1) )
+ nModCode |= KEY_CONTROLMOD;
+
+ SalKeyEvent aKeyEvt;
+ aKeyEvt.mnTime = GetMessageTime();
+ if ( (cKeyCode >= 48) && (cKeyCode <= 57) )
+ aKeyEvt.mnCode = KEY_0+(cKeyCode-48);
+ else
+ aKeyEvt.mnCode = KEY_A+(cKeyCode-97);
+ aKeyEvt.mnCode |= nModCode;
+ aKeyEvt.mnCharCode = cKeyCode;
+ aKeyEvt.mnRepeat = 0;
+ long nRet = pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYINPUT, &aKeyEvt );
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_KEYUP, &aKeyEvt );
+ return (nRet != 0);
+ }
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleInputLangChange( HWND hWnd, WPARAM wParam, LPARAM lParam )
+{
+ ImplSalYieldMutexAcquireWithWait();
+
+ // Feststellen, ob wir IME unterstuetzen
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbIME && pFrame->maFrameData.mhDefIMEContext )
+ {
+ HWND hWnd = pFrame->maFrameData.mhWnd;
+ HKL hKL = (HKL)lParam;
+ UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY );
+
+ pFrame->maFrameData.mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0;
+ pFrame->maFrameData.mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0;
+ pFrame->maFrameData.mbHandleIME = !pFrame->maFrameData.mbSpezIME;
+ }
+
+ ImplSalYieldMutexRelease();
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplHandleIMEStartComposition( HWND hWnd )
+{
+ BOOL bDef = TRUE;
+
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ if ( pFrame->maFrameData.mbHandleIME )
+ {
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ // Cursor-Position ermitteln und aus der die Default-Position fuer
+ // das Composition-Fenster berechnen
+ SalCursorPosEvent aCursorPosEvt;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_CURSORPOS, (void*)&aCursorPosEvt );
+ COMPOSITIONFORM aForm;
+ memset( &aForm, 0, sizeof( aForm ) );
+ if ( !aCursorPosEvt.mnWidth || !aCursorPosEvt.mnHeight )
+ aForm.dwStyle |= CFS_DEFAULT;
+ else
+ {
+ aForm.dwStyle |= CFS_POINT;
+ aForm.ptCurrentPos.x = aCursorPosEvt.mnX;
+ aForm.ptCurrentPos.y = aCursorPosEvt.mnY;
+ }
+ ImmSetCompositionWindow( hIMC, &aForm );
+
+ // Den InputContect-Font ermitteln und diesem dem Composition-Fenster
+ // bekannt machen
+
+ ImmReleaseContext( hWnd, hIMC );
+ }
+
+ pFrame->maFrameData.mbCompositionMode = TRUE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_STARTEXTTEXTINPUT, (void*)NULL );
+ if ( pFrame->maFrameData.mbAtCursorIME )
+ bDef = FALSE;
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+
+ return bDef;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplHandleIMEComposition( HWND hWnd, LPARAM lParam )
+{
+ BOOL bDef = TRUE;
+ if ( lParam & (GCS_RESULTSTR | GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS) )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbHandleIME &&
+ (pFrame->maFrameData.mbCompositionMode || !(lParam & GCS_RESULTSTR)) )
+ {
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ SalExtTextInputEvent aEvt;
+ aEvt.mnTime = GetMessageTime();
+ aEvt.mpTextAttr = NULL;
+ aEvt.mnCursorPos = 0;
+ aEvt.mnDeltaStart = 0;
+ aEvt.mbOnlyCursor = FALSE;
+ aEvt.mbCursorVisible = !pFrame->maFrameData.mbCandidateMode;
+
+ LONG nTextLen;
+ xub_Unicode* pTextBuf = NULL;
+ LONG nAttrLen;
+ WIN_BYTE* pAttrBuf = NULL;
+ BOOL bLastCursor = FALSE;
+ if ( lParam & GCS_RESULTSTR )
+ {
+ nTextLen = ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, 0, 0 ) / sizeof( WCHAR );
+ if ( nTextLen >= 0 )
+ {
+ pTextBuf = new xub_Unicode[nTextLen];
+ ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf, nTextLen*sizeof( WCHAR ) );
+ }
+
+ bLastCursor = TRUE;
+ aEvt.mbCursorVisible = TRUE;
+ bDef = FALSE;
+ }
+ else if ( pFrame->maFrameData.mbAtCursorIME )
+ {
+ bDef = FALSE;
+ if ( lParam & (GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS) )
+ {
+ nTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 ) / sizeof( WCHAR );
+ if ( nTextLen >= 0 )
+ {
+ pTextBuf = new xub_Unicode[nTextLen];
+ ImmGetCompositionStringW( hIMC, GCS_COMPSTR, pTextBuf, nTextLen*sizeof( WCHAR ) );
+ }
+
+ nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, 0, 0 );
+ if ( nAttrLen >= 0 )
+ {
+ pAttrBuf = new WIN_BYTE[nAttrLen];
+ ImmGetCompositionStringW( hIMC, GCS_COMPATTR, pAttrBuf, nAttrLen );
+ }
+
+ aEvt.mnCursorPos = LOWORD( ImmGetCompositionStringW( hIMC, GCS_CURSORPOS, 0, 0 ) );
+ aEvt.mnDeltaStart = LOWORD( ImmGetCompositionStringW( hIMC, GCS_DELTASTART, 0, 0 ) );
+
+ if ( lParam == GCS_CURSORPOS )
+ aEvt.mbOnlyCursor = TRUE;
+ }
+ }
+
+ USHORT* pSalAttrAry = NULL;
+ if ( pTextBuf )
+ {
+ aEvt.maText = XubString( pTextBuf, (USHORT)nTextLen );
+ delete pTextBuf;
+ if ( pAttrBuf )
+ {
+ xub_StrLen nTextLen = aEvt.maText.Len();
+ if ( nTextLen )
+ {
+ pSalAttrAry = new USHORT[nTextLen];
+ memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) );
+ for ( xub_StrLen i = 0; (i < nTextLen) && (i < nAttrLen); i++ )
+ {
+ WIN_BYTE nWinAttr = pAttrBuf[i];
+ USHORT nSalAttr;
+ if ( nWinAttr == ATTR_TARGET_CONVERTED )
+ {
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETCONVERTED | SAL_EXTTEXTINPUT_ATTR_UNDERLINE | SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT;
+ aEvt.mbCursorVisible = FALSE;
+ }
+ else if ( nWinAttr == ATTR_CONVERTED )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_CONVERTED | SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
+ else if ( nWinAttr == ATTR_TARGET_NOTCONVERTED )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETNOTCONVERTED | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ else if ( nWinAttr == ATTR_INPUT_ERROR )
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUTERROR | SAL_EXTTEXTINPUT_ATTR_REDTEXT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ else /* ( nWinAttr == ATTR_INPUT ) */
+ nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
+ pSalAttrAry[i] = nSalAttr;
+ }
+ aEvt.mpTextAttr = pSalAttrAry;
+ }
+ delete pAttrBuf;
+ }
+ if ( bLastCursor )
+ aEvt.mnCursorPos = aEvt.maText.Len();
+ }
+
+ ImmReleaseContext( hWnd, hIMC );
+
+ // Handler rufen und wenn wir ein Attribute-Array haben, danach
+ // wieder zerstoeren
+ if ( !bDef )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_EXTTEXTINPUT, (void*)&aEvt );
+ }
+ if ( pSalAttrAry )
+ delete pSalAttrAry;
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ }
+
+ return bDef;
+}
+
+// -----------------------------------------------------------------------
+
+static BOOL ImplHandleIMEEndComposition( HWND hWnd )
+{
+ BOOL bDef = TRUE;
+
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbHandleIME )
+ {
+ // Wir restaurieren den Background-Modus bei jeder Texteingabe,
+ // da einige Tools wie RichWin uns diesen hin- und wieder umsetzen
+ if ( pFrame->maFrameData.mpGraphics &&
+ pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC )
+ SetBkMode( pFrame->maFrameData.mpGraphics->maGraphicsData.mhDC, TRANSPARENT );
+
+ pFrame->maFrameData.mbCompositionMode = FALSE;
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_ENDEXTTEXTINPUT, (void*)NULL );
+ if ( pFrame->maFrameData.mbAtCursorIME )
+ bDef = FALSE;
+ }
+
+ ImplSalYieldMutexRelease();
+
+ return bDef;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam )
+{
+ if ( wParam == (WPARAM)IMN_OPENCANDIDATE )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame && pFrame->maFrameData.mbHandleIME &&
+ pFrame->maFrameData.mbAtCursorIME )
+ {
+ // Wir wollen den Cursor hiden
+ pFrame->maFrameData.mbCandidateMode = TRUE;
+ ImplHandleIMEComposition( hWnd, GCS_CURSORPOS );
+
+ HWND hWnd = pFrame->maFrameData.mhWnd;
+ HIMC hIMC = ImmGetContext( hWnd );
+ if ( hIMC )
+ {
+ LONG nBufLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 );
+ if ( nBufLen >= 1 )
+ {
+ USHORT nCursorPos = LOWORD( ImmGetCompositionStringW( hIMC, GCS_CURSORPOS, 0, 0 ) );
+ SalExtTextInputPosEvent aEvt;
+ aEvt.mnTime = GetMessageTime();
+ aEvt.mnFirstPos = nCursorPos;
+ aEvt.mnChars = nBufLen/sizeof(sal_Unicode) - nCursorPos;
+ aEvt.mpPosAry = new SalExtCharPos[aEvt.mnChars];
+ memset( aEvt.mpPosAry, 0, aEvt.mnChars*sizeof(SalExtCharPos) );
+
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_EXTTEXTINPUTPOS, (void*)&aEvt );
+
+ long nMinLeft = aEvt.mpPosAry[0].mnX;
+ long nMinTop = aEvt.mpPosAry[0].mnY;
+ long nMaxBottom = aEvt.mpPosAry[0].mnY+aEvt.mpPosAry[0].mnHeight;
+ long nMaxRight = nMinLeft;
+ USHORT i = 0;
+ while ( i < aEvt.mnChars )
+ {
+ // Solange wir uns auf der gleichen Zeile bewegen,
+ // ermitteln wir die Rechteck-Grenzen
+ if ( !aEvt.mpPosAry[i].mnHeight ||
+ (aEvt.mpPosAry[i].mnY < nMaxBottom-1) )
+ {
+ if ( aEvt.mpPosAry[i].mnX < nMinLeft )
+ nMinLeft = aEvt.mpPosAry[i].mnX;
+ if ( aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth > nMaxRight )
+ nMaxRight = aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth;
+ if ( aEvt.mpPosAry[i].mnY < nMinTop )
+ nMinTop = aEvt.mpPosAry[i].mnY;
+ i++;
+ }
+ else
+ break;
+ }
+
+ CANDIDATEFORM aForm;
+ aForm.dwIndex = 0;
+ aForm.dwStyle = CFS_EXCLUDE;
+ aForm.ptCurrentPos.x = aEvt.mpPosAry[0].mnX;
+ aForm.ptCurrentPos.y = nMaxBottom+1;
+ aForm.rcArea.left = nMinLeft;
+ aForm.rcArea.top = nMinTop;
+ aForm.rcArea.right = nMaxRight+1;
+ aForm.rcArea.bottom = nMaxBottom+1;
+ ImmSetCandidateWindow( hIMC, &aForm );
+
+ delete aEvt.mpPosAry;
+ }
+
+ ImmReleaseContext( hWnd, hIMC );
+ }
+ }
+
+ ImplSalYieldMutexRelease();
+ }
+ else if ( wParam == (WPARAM)IMN_CLOSECANDIDATE )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ pFrame->maFrameData.mbCandidateMode = FALSE;
+ ImplSalYieldMutexRelease();
+ }
+}
+
+
+// -----------------------------------------------------------------------
+
+void SalTestMouseLeave()
+{
+ SalData* pSalData = GetSalData();
+
+ if ( pSalData->mhWantLeaveMsg && !::GetCapture() )
+ {
+ POINT aPt;
+ GetCursorPos( &aPt );
+ if ( pSalData->mhWantLeaveMsg != WindowFromPoint( aPt ) )
+ ImplSendMessage( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MAKELPARAM( aPt.x, aPt.y ) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+static int ImplSalWheelMousePos( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ,
+ LRESULT& rResult )
+{
+ POINT aPt;
+ POINT aScreenPt;
+ aScreenPt.x = (short)LOWORD( lParam );
+ aScreenPt.y = (short)HIWORD( lParam );
+ // Child-Fenster suchen, welches an der entsprechenden
+ // Position liegt
+ HWND hChildWnd;
+ HWND hWheelWnd = hWnd;
+ do
+ {
+ hChildWnd = hWheelWnd;
+ aPt = aScreenPt;
+ ScreenToClient( hChildWnd, &aPt );
+ hWheelWnd = ChildWindowFromPointEx( hChildWnd, aPt, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT );
+ }
+ while ( hWheelWnd && (hWheelWnd != hChildWnd) );
+ if ( hWheelWnd && (hWheelWnd != hWnd) &&
+ (hWheelWnd != ::GetFocus()) && IsWindowEnabled( hWheelWnd ) )
+ {
+ rResult = ImplSendMessage( hWheelWnd, nMsg, wParam, lParam );
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ LRESULT nRet = 0;
+ static int bInWheelMsg = FALSE;
+
+ // By WM_CRETAE we connect the frame with the window handle
+ if ( nMsg == WM_CREATE )
+ {
+ // Window-Instanz am Windowhandle speichern
+ // Can also be used for the W-Version, because the struct
+ // to access lpCreateParams is the same structure
+ CREATESTRUCTA* pStruct = (CREATESTRUCTA*)lParam;
+ SalFrame* pFrame = (SalFrame*)pStruct->lpCreateParams;
+ SetWindowPtr( hWnd, pFrame );
+ // HWND schon hier setzen, da schon auf den Instanzdaten
+ // gearbeitet werden kann, wenn Messages waehrend
+ // CreateWindow() gesendet werden
+ pFrame->maFrameData.mhWnd = hWnd;
+ pFrame->maFrameData.maSysData.hWnd = hWnd;
+ return 0;
+ }
+
+ switch( nMsg )
+ {
+ case WM_MOUSEMOVE:
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_NCMOUSEMOVE:
+ case SAL_MSG_MOUSELEAVE:
+ ImplSalYieldMutexAcquireWithWait();
+ rDef = !ImplHandleMouseMsg( hWnd, nMsg, wParam, lParam );
+ ImplSalYieldMutexRelease();
+ break;
+
+ case WM_MOUSEACTIVATE:
+ if ( LOWORD( lParam ) == HTCLIENT )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ nRet = ImplHandleMouseActivateMsg( hWnd );
+ ImplSalYieldMutexRelease();
+ if ( nRet )
+ {
+ nRet = MA_NOACTIVATE;
+ rDef = FALSE;
+ }
+ }
+ break;
+
+ case WM_KEYDOWN:
+ case WM_KEYUP:
+ case WM_DEADCHAR:
+ case WM_CHAR:
+ case WM_SYSKEYDOWN:
+ case WM_SYSKEYUP:
+ case WM_SYSCHAR:
+ ImplSalYieldMutexAcquireWithWait();
+ rDef = !ImplHandleKeyMsg( hWnd, nMsg, wParam, lParam );
+ ImplSalYieldMutexRelease();
+ break;
+
+ case WM_MOUSEWHEEL:
+ // Gegen Rekursion absichern, falls wir vom IE oder dem externen
+ // Fenster die Message wieder zurueckbekommen
+ if ( !bInWheelMsg )
+ {
+ bInWheelMsg++;
+ rDef = !ImplHandleWheelMsg( hWnd, wParam, lParam );
+ // Wenn wir die Message nicht ausgewertet haben, schauen wir
+ // noch einmal nach, ob dort ein geplugtes Fenster steht,
+ // welches wir dann benachrichtigen
+ if ( rDef )
+ rDef = ImplSalWheelMousePos( hWnd, nMsg, wParam, lParam, nRet );
+ bInWheelMsg--;
+ }
+ break;
+
+ case WM_SYSCOMMAND:
+ ImplSalYieldMutexAcquireWithWait();
+ nRet = ImplHandleSysCommand( hWnd, wParam, lParam );
+ ImplSalYieldMutexRelease();
+ if ( nRet )
+ rDef = FALSE;
+ break;
+
+ case WM_MOVE:
+ case SAL_MSG_POSTMOVE:
+ ImplHandleMoveMsg( hWnd );
+ rDef = FALSE;
+ break;
+ case WM_SIZE:
+ ImplHandleSizeMsg( hWnd, wParam, lParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_POSTCALLSIZE:
+ ImplCallSizeHdl( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_GETMINMAXINFO:
+ if ( ImplHandleMinMax( hWnd, lParam ) )
+ rDef = FALSE;
+ break;
+
+ case WM_ERASEBKGND:
+ nRet = 1;
+ rDef = FALSE;
+ break;
+ case WM_PAINT:
+ ImplHandlePaintMsg( hWnd );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_POSTPAINT:
+ ImplHandlePaintMsg2( hWnd, (RECT*)wParam );
+ rDef = FALSE;
+ break;
+
+ case SAL_MSG_FORCEPALETTE:
+ ImplHandleForcePalette( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_QUERYNEWPALETTE:
+ case SAL_MSG_POSTQUERYNEWPAL:
+ nRet = ImplHandlePalette( TRUE, hWnd, nMsg, wParam, lParam, rDef );
+ break;
+
+ case WM_ACTIVATE:
+ // Wenn wir aktiviert werden, dann wollen wir auch unsere
+ // Palette setzen. Wir machen dieses in Activate,
+ // damit andere externe Child-Fenster auch unsere Palette
+ // ueberschreiben koennen. So wird unsere jedenfalls nur einmal
+ // gesetzt und nicht immer rekursiv, da an allen anderen Stellen
+ // diese nur als Background-Palette gesetzt wird
+ if ( LOWORD( wParam ) != WA_INACTIVE )
+ ImplSendMessage( hWnd, SAL_MSG_FORCEPALETTE, 0, 0 );
+ break;
+
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ case SAL_MSG_POSTFOCUS:
+ ImplHandleFocusMsg( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_CLOSE:
+ ImplHandleCloseMsg( hWnd );
+ rDef = FALSE;
+ break;
+
+ case WM_QUERYENDSESSION:
+ nRet = !ImplHandleShutDownMsg( hWnd );
+ rDef = FALSE;
+ break;
+
+#ifdef WM_DISPLAYCHANGE
+ case WM_DISPLAYCHANGE:
+#endif
+#ifdef WM_SETTINGCHANGE
+ case WM_SETTINGCHANGE:
+#else
+ case WM_WININICHANGE:
+#endif
+ case WM_DEVMODECHANGE:
+ case WM_FONTCHANGE:
+ case WM_SYSCOLORCHANGE:
+ case WM_TIMECHANGE:
+ ImplHandleSettingsChangeMsg( hWnd, nMsg, wParam, lParam );
+ break;
+
+ case SAL_MSG_USEREVENT:
+ ImplHandleUserEvent( hWnd, lParam );
+ rDef = FALSE;
+ break;
+
+ case SAL_MSG_CAPTUREMOUSE:
+ SetCapture( hWnd );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_RELEASEMOUSE:
+ if ( ::GetCapture() == hWnd )
+ ReleaseCapture();
+ rDef = FALSE;
+ break;
+ case SAL_MSG_TOTOP:
+ ImplSalToTop( hWnd, (USHORT)wParam );
+ rDef = FALSE;
+ break;
+ case SAL_MSG_SHOW:
+ ImplSalShow( hWnd, (BOOL)wParam );
+ rDef = FALSE;
+ break;
+
+ case WM_INPUTLANGCHANGE:
+ ImplHandleInputLangChange( hWnd, wParam, lParam );
+ break;
+
+ case WM_IME_STARTCOMPOSITION:
+ rDef = ImplHandleIMEStartComposition( hWnd );
+ break;
+
+ case WM_IME_COMPOSITION:
+ rDef = ImplHandleIMEComposition( hWnd, lParam );
+ break;
+
+ case WM_IME_ENDCOMPOSITION:
+ rDef = ImplHandleIMEEndComposition( hWnd );
+ break;
+
+ case WM_IME_NOTIFY:
+ ImplHandleIMENotify( hWnd, wParam );
+ break;
+ }
+
+ // WheelMouse-Message abfangen
+ if ( rDef && (nMsg == aSalShlData.mnWheelMsgId) && aSalShlData.mnWheelMsgId )
+ {
+ // Gegen Rekursion absichern, falls wir vom IE oder dem externen
+ // Fenster die Message wieder zurueckbekommen
+ if ( !bInWheelMsg )
+ {
+ bInWheelMsg++;
+ // Zuerst wollen wir die Message dispatchen und dann darf auch
+ // das SystemWindow drankommen
+ WORD nKeyState = 0;
+ if ( GetKeyState( VK_SHIFT ) & 0x8000 )
+ nKeyState |= MK_SHIFT;
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ nKeyState |= MK_CONTROL;
+ // Mutex handling is inside from this call
+ rDef = !ImplHandleWheelMsg( hWnd, MAKEWPARAM( nKeyState, (WORD)wParam ), lParam );
+ if ( rDef )
+ {
+ HWND hWheelWnd = ::GetFocus();
+ if ( hWheelWnd && (hWheelWnd != hWnd) )
+ {
+ nRet = ImplSendMessage( hWheelWnd, nMsg, wParam, lParam );
+ rDef = FALSE;
+ }
+ else
+ rDef = ImplSalWheelMousePos( hWnd, nMsg, wParam, lParam, nRet );
+ }
+ bInWheelMsg--;
+ }
+ }
+
+ return nRet;
+}
+
+LRESULT CALLBACK SalFrameWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalFrameWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+
+LRESULT CALLBACK SalFrameWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalFrameWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT& rlResult )
+{
+ // Hier verarbeiten wir alle Messages, die fuer alle Frame-Fenster gelten,
+ // damit diese nur einmal verarbeitet werden
+ // Must work for Unicode and none Unicode
+ if ( (nMsg == WM_PALETTECHANGED) || (nMsg == SAL_MSG_POSTPALCHANGED) )
+ {
+ int bDef = TRUE;
+ rlResult = ImplHandlePalette( FALSE, hWnd, nMsg, wParam, lParam, bDef );
+ return (bDef != 0);
+ }
+ else
+ return FALSE;
+}
diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx
new file mode 100644
index 000000000000..39b233de05e6
--- /dev/null
+++ b/vcl/win/source/window/salobj.cxx
@@ -0,0 +1,873 @@
+/*************************************************************************
+ *
+ * $RCSfile: salobj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+
+#ifndef _SVWIN_HXX
+#include <tools/svwin.h>
+#endif
+
+#define _SV_SALOBJ_CXX
+
+#ifndef _SV_WINCOMP_HXX
+#include <wincomp.hxx>
+#endif
+#ifndef _SV_SALDATA_HXX
+#include <saldata.hxx>
+#endif
+#ifndef _SV_SALINST_HXX
+#include <salinst.hxx>
+#endif
+#ifndef _SV_SALFRAME_HXX
+#include <salframe.hxx>
+#endif
+#ifndef _SV_SALOBJ_HXX
+#include <salobj.hxx>
+#endif
+
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+// =======================================================================
+
+static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild )
+{
+ if ( hWndParent == hWndChild )
+ return TRUE;
+
+ HWND hTempWnd = ::GetParent( hWndChild );
+ while ( hTempWnd )
+ {
+ // Ab nicht Child-Fenstern hoeren wir auf zu suchen
+ if ( !(GetWindowStyle( hTempWnd ) & WS_CHILD) )
+ return FALSE;
+ if ( hTempWnd == hWndParent )
+ return TRUE;
+ hTempWnd = ::GetParent( hTempWnd );
+ }
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+SalObject* ImplFindSalObject( HWND hWndChild )
+{
+ SalData* pSalData = GetSalData();
+ SalObject* pObject = pSalData->mpFirstObject;
+ while ( pObject )
+ {
+ if ( ImplIsSysWindowOrChild( pObject->maObjectData.mhWndChild, hWndChild ) )
+ return pObject;
+
+ pObject = pObject->maObjectData.mpNextObject;
+ }
+
+ return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+SalFrame* ImplFindSalObjectFrame( HWND hWnd )
+{
+ SalFrame* pFrame = NULL;
+ SalObject* pObject = ImplFindSalObject( hWnd );
+ if ( pObject )
+ {
+ // Dazugehoerenden Frame suchen
+ HWND hWnd = ::GetParent( pObject->maObjectData.mhWnd );
+ pFrame = GetSalData()->mpFirstFrame;
+ while ( pFrame )
+ {
+ if ( pFrame->maFrameData.mhWnd == hWnd )
+ break;
+
+ pFrame = pFrame->maFrameData.mpNextFrame;
+ }
+ }
+
+ return pFrame;
+}
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
+{
+ // Used for Unicode and none Unicode
+ SalData* pSalData = GetSalData();
+
+ if ( (nCode >= 0) && lParam )
+ {
+ CWPSTRUCT* pData = (CWPSTRUCT*)lParam;
+ if ( (pData->message != WM_KEYDOWN) &&
+ (pData->message != WM_KEYUP) )
+ pSalData->mnSalObjWantKeyEvt = 0;
+
+ // Testen, ob wir Daten fuer ein SalObject-Fenster behandeln
+ // muessen
+ SalObject* pObject;
+ if ( pData->message == WM_SETFOCUS )
+ {
+ pObject = ImplFindSalObject( pData->hwnd );
+ if ( pObject )
+ {
+ pObject->maObjectData.mhLastFocusWnd = pData->hwnd;
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pObject->maObjectData.mpProc( pObject->maObjectData.mpInst, pObject,
+ SALOBJ_EVENT_GETFOCUS, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( pObject->maObjectData.mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 );
+ }
+ }
+ else if ( pData->message == WM_KILLFOCUS )
+ {
+ pObject = ImplFindSalObject( pData->hwnd );
+ if ( pObject && !ImplFindSalObject( (HWND)pData->wParam ) )
+ {
+ // LoseFocus nur rufen, wenn wirklich kein ChildFenster
+ // den Focus bekommt
+ if ( !pData->wParam || !ImplFindSalObject( (HWND)pData->wParam ) )
+ {
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pObject->maObjectData.mpProc( pObject->maObjectData.mpInst, pObject,
+ SALOBJ_EVENT_LOSEFOCUS, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( pObject->maObjectData.mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 );
+ }
+ else
+ pObject->maObjectData.mhLastFocusWnd = (HWND)pData->wParam;
+ }
+ }
+ }
+
+ return CallNextHookEx( pSalData->mhSalObjMsgHook, nCode, wParam, lParam );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ImplSalPreDispatchMsg( MSG* pMsg )
+{
+ // Used for Unicode and none Unicode
+ SalData* pSalData = GetSalData();
+ SalObject* pObject;
+
+ if ( (pMsg->message == WM_LBUTTONDOWN) ||
+ (pMsg->message == WM_RBUTTONDOWN) ||
+ (pMsg->message == WM_MBUTTONDOWN) )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ pObject = ImplFindSalObject( pMsg->hwnd );
+ if ( pObject )
+ ImplPostMessage( pObject->maObjectData.mhWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ ImplSalYieldMutexRelease();
+ }
+
+ if ( (pMsg->message == WM_KEYDOWN) ||
+ (pMsg->message == WM_KEYUP) )
+ {
+ // KeyEvents wollen wir nach Moeglichkeit auch abarbeiten,
+ // wenn das Control diese nicht selber auswertet
+ // SysKeys werden als WM_SYSCOMMAND verarbeitet
+ // Char-Events verarbeiten wir nicht, da wir nur
+ // Accelerator relevante Keys verarbeiten wollen
+ BOOL bWantedKeyCode = FALSE;
+ // A-Z, 0-9 nur in Verbindung mit Control-Taste
+ if ( ((pMsg->wParam >= 65) && (pMsg->wParam <= 90)) ||
+ ((pMsg->wParam >= 48) && (pMsg->wParam <= 57)) )
+ {
+ if ( GetKeyState( VK_CONTROL ) & 0x8000 )
+ bWantedKeyCode = TRUE;
+ }
+ else if ( ((pMsg->wParam >= VK_F1) && (pMsg->wParam <= VK_F24)) ||
+ ((pMsg->wParam >= VK_SPACE) && (pMsg->wParam <= VK_HELP)) ||
+ (pMsg->wParam == VK_BACK) || (pMsg->wParam == VK_TAB) ||
+ (pMsg->wParam == VK_CLEAR) || (pMsg->wParam == VK_RETURN) ||
+ (pMsg->wParam == VK_ESCAPE) )
+ bWantedKeyCode = TRUE;
+ if ( bWantedKeyCode )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ pObject = ImplFindSalObject( pMsg->hwnd );
+ if ( pObject )
+ pSalData->mnSalObjWantKeyEvt = pMsg->wParam;
+ ImplSalYieldMutexRelease();
+ }
+ }
+ // Hier WM_SYSCHAR abfangen, um mit Alt+Taste evtl. Menu zu aktivieren
+ else if ( pMsg->message == WM_SYSCHAR )
+ {
+ pSalData->mnSalObjWantKeyEvt = 0;
+
+ USHORT nKeyCode = LOWORD( pMsg->wParam );
+ // Nur 0-9 und A-Z
+ if ( ((nKeyCode >= 48) && (nKeyCode <= 57)) ||
+ ((nKeyCode >= 65) && (nKeyCode <= 90)) ||
+ ((nKeyCode >= 97) && (nKeyCode <= 122)) )
+ {
+ BOOL bRet = FALSE;
+ ImplSalYieldMutexAcquireWithWait();
+ pObject = ImplFindSalObject( pMsg->hwnd );
+ if ( pObject )
+ {
+ if ( pMsg->hwnd == ::GetFocus() )
+ {
+ SalFrame* pFrame = ImplFindSalObjectFrame( pMsg->hwnd );
+ if ( pFrame )
+ {
+ if ( ImplHandleSalObjSysCharMsg( pFrame->maFrameData.mhWnd, pMsg->wParam, pMsg->lParam ) )
+ bRet = TRUE;
+ }
+ }
+ }
+ ImplSalYieldMutexRelease();
+ if ( bRet )
+ return TRUE;
+ }
+ }
+ else
+ pSalData->mnSalObjWantKeyEvt = 0;
+
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void ImplSalPostDispatchMsg( MSG* pMsg, LRESULT /* nDispatchResult */ )
+{
+ // Used for Unicode and none Unicode
+ SalData* pSalData = GetSalData();
+ SalFrame* pFrame;
+
+ if ( (pMsg->message == WM_KEYDOWN) || (pMsg->message == WM_KEYUP) )
+ {
+ if ( pSalData->mnSalObjWantKeyEvt == pMsg->wParam )
+ {
+ pSalData->mnSalObjWantKeyEvt = 0;
+ if ( pMsg->hwnd == ::GetFocus() )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ pFrame = ImplFindSalObjectFrame( pMsg->hwnd );
+ if ( pFrame )
+ ImplHandleSalObjKeyMsg( pFrame->maFrameData.mhWnd, pMsg->message, pMsg->wParam, pMsg->lParam );
+ ImplSalYieldMutexRelease();
+ }
+ }
+ }
+
+ pSalData->mnSalObjWantKeyEvt = 0;
+}
+
+// =======================================================================
+
+LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ SalObject* pSysObj;
+ LRESULT nRet = 0;
+
+ switch( nMsg )
+ {
+ case WM_ERASEBKGND:
+ nRet = 1;
+ rDef = FALSE;
+ break;
+ case WM_PAINT:
+ {
+ PAINTSTRUCT aPs;
+ BeginPaint( hWnd, &aPs );
+ EndPaint( hWnd, &aPs );
+ rDef = FALSE;
+ }
+ break;
+
+ case WM_PARENTNOTIFY:
+ {
+ UINT nNotifyMsg = LOWORD( wParam );
+ if ( (nNotifyMsg == WM_LBUTTONDOWN) ||
+ (nNotifyMsg == WM_RBUTTONDOWN) ||
+ (nNotifyMsg == WM_MBUTTONDOWN) )
+ {
+ ImplSalYieldMutexAcquireWithWait();
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ if ( pSysObj )
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj, SALOBJ_EVENT_TOTOP, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ }
+ break;
+
+ case WM_MOUSEACTIVATE:
+ ImplPostMessage( hWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ break;
+
+ case SALOBJ_MSG_TOTOP:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj,
+ SALOBJ_EVENT_TOTOP, 0 );
+ ImplSalYieldMutexRelease();
+ rDef = FALSE;
+ }
+ else
+ ImplPostMessage( hWnd, SALOBJ_MSG_TOTOP, 0, 0 );
+ break;
+
+ case SALOBJ_MSG_POSTFOCUS:
+ if ( ImplSalYieldMutexTryToAcquire() )
+ {
+ pSysObj = GetSalObjWindowPtr( hWnd );
+ HWND hFocusWnd = ::GetFocus();
+ USHORT nEvent;
+ if ( hFocusWnd && ImplIsSysWindowOrChild( hWnd, hFocusWnd ) )
+ nEvent = SALOBJ_EVENT_GETFOCUS;
+ else
+ nEvent = SALOBJ_EVENT_LOSEFOCUS;
+ pSysObj->maObjectData.mpProc( pSysObj->maObjectData.mpInst, pSysObj,
+ nEvent, 0 );
+ ImplSalYieldMutexRelease();
+ }
+ else
+ ImplPostMessage( hWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 );
+ rDef = FALSE;
+ break;
+
+ case WM_SIZE:
+ {
+ HWND hWndChild = GetWindow( hWnd, GW_CHILD );
+ if ( hWndChild )
+ {
+ SetWindowPos( hWndChild,
+ 0, 0, 0, (int)LOWORD( lParam ), (int)HIWORD( lParam ),
+ SWP_NOZORDER | SWP_NOACTIVATE );
+ }
+ }
+ rDef = FALSE;
+ break;
+
+ case WM_CREATE:
+ {
+ // Window-Instanz am Windowhandle speichern
+ // Can also be used for the W-Version, because the struct
+ // to access lpCreateParams is the same structure
+ CREATESTRUCTA* pStruct = (CREATESTRUCTA*)lParam;
+ pSysObj = (SalObject*)pStruct->lpCreateParams;
+ SetSalObjWindowPtr( hWnd, pSysObj );
+ // HWND schon hier setzen, da schon auf den Instanzdaten
+ // gearbeitet werden kann, wenn Messages waehrend
+ // CreateWindow() gesendet werden
+ pSysObj->maObjectData.mhWnd = hWnd;
+ rDef = FALSE;
+ }
+ break;
+ }
+
+ return nRet;
+}
+
+LRESULT CALLBACK SalSysObjWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+
+LRESULT CALLBACK SalSysObjWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+LRESULT CALLBACK SalSysObjChildWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, int& rDef )
+{
+ LRESULT nRet = 0;
+
+ switch( nMsg )
+ {
+ // Wegen PlugIn's loeschen wir erstmal den Hintergrund
+/*
+ case WM_ERASEBKGND:
+ nRet = 1;
+ rDef = FALSE;
+ break;
+*/
+ case WM_PAINT:
+ {
+ PAINTSTRUCT aPs;
+ BeginPaint( hWnd, &aPs );
+ EndPaint( hWnd, &aPs );
+ rDef = FALSE;
+ }
+ break;
+ }
+
+ return nRet;
+}
+
+LRESULT CALLBACK SalSysObjChildWndProcA( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjChildWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcA( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+
+LRESULT CALLBACK SalSysObjChildWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
+{
+ int bDef = TRUE;
+ LRESULT nRet = SalSysObjChildWndProc( hWnd, nMsg, wParam, lParam, bDef );
+ if ( bDef )
+ nRet = DefWindowProcW( hWnd, nMsg, wParam, lParam );
+ return nRet;
+}
+
+// =======================================================================
+
+SalObject* ImplSalCreateObject( SalInstance* pInst, SalFrame* pParent )
+{
+ SalData* pSalData = GetSalData();
+
+ // Hook installieren, wenn es das erste SalObject ist
+ if ( !pSalData->mpFirstObject )
+ {
+ if ( aSalShlData.mbWNT )
+ {
+ pSalData->mhSalObjMsgHook = SetWindowsHookExW( WH_CALLWNDPROC,
+ SalSysMsgProc,
+ pSalData->mhInst,
+ pSalData->mnAppThreadId );
+ }
+ else
+ {
+ pSalData->mhSalObjMsgHook = SetWindowsHookExA( WH_CALLWNDPROC,
+ SalSysMsgProc,
+ pSalData->mhInst,
+ pSalData->mnAppThreadId );
+ }
+ }
+
+ if ( !pSalData->mbObjClassInit )
+ {
+ if ( aSalShlData.mbWNT )
+ {
+ WNDCLASSEXW aWndClassEx;
+ aWndClassEx.cbSize = sizeof( aWndClassEx );
+ aWndClassEx.style = 0;
+ aWndClassEx.lpfnWndProc = SalSysObjWndProcW;
+ aWndClassEx.cbClsExtra = 0;
+ aWndClassEx.cbWndExtra = SAL_OBJECT_WNDEXTRA;
+ aWndClassEx.hInstance = pSalData->mhInst;
+ aWndClassEx.hIcon = 0;
+ aWndClassEx.hIconSm = 0;
+ aWndClassEx.hCursor = LoadCursor( 0, IDC_ARROW );
+ aWndClassEx.hbrBackground = 0;
+ aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.lpszClassName = SAL_OBJECT_CLASSNAMEW;
+ if ( RegisterClassExW( &aWndClassEx ) )
+ {
+ // Wegen PlugIn's loeschen wir erstmal den Hintergrund
+ aWndClassEx.cbWndExtra = 0;
+ aWndClassEx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ aWndClassEx.lpfnWndProc = SalSysObjChildWndProcW;
+ aWndClassEx.lpszClassName = SAL_OBJECT_CHILDCLASSNAMEW;
+ if ( RegisterClassExW( &aWndClassEx ) )
+ pSalData->mbObjClassInit = TRUE;
+ }
+ }
+ else
+ {
+ WNDCLASSEXA aWndClassEx;
+ aWndClassEx.cbSize = sizeof( aWndClassEx );
+ aWndClassEx.style = 0;
+ aWndClassEx.lpfnWndProc = SalSysObjWndProcA;
+ aWndClassEx.cbClsExtra = 0;
+ aWndClassEx.cbWndExtra = SAL_OBJECT_WNDEXTRA;
+ aWndClassEx.hInstance = pSalData->mhInst;
+ aWndClassEx.hIcon = 0;
+ aWndClassEx.hIconSm = 0;
+ aWndClassEx.hCursor = LoadCursor( 0, IDC_ARROW );
+ aWndClassEx.hbrBackground = 0;
+ aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.lpszClassName = SAL_OBJECT_CLASSNAMEA;
+ if ( RegisterClassExA( &aWndClassEx ) )
+ {
+ // Wegen PlugIn's loeschen wir erstmal den Hintergrund
+ aWndClassEx.cbWndExtra = 0;
+ aWndClassEx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ aWndClassEx.lpfnWndProc = SalSysObjChildWndProcA;
+ aWndClassEx.lpszClassName = SAL_OBJECT_CHILDCLASSNAMEA;
+ if ( RegisterClassExA( &aWndClassEx ) )
+ pSalData->mbObjClassInit = TRUE;
+ }
+ }
+ }
+
+ if ( pSalData->mbObjClassInit )
+ {
+ SalObject* pObject = new SalObject;
+ HWND hWnd;
+ HWND hWndChild = 0;
+ if ( aSalShlData.mbWNT )
+ {
+ hWnd = CreateWindowExW( 0, SAL_OBJECT_CLASSNAMEW, L"",
+ WS_CHILD, 0, 0, 0, 0,
+ pParent->maFrameData.mhWnd, 0,
+ pInst->maInstData.mhInst, (void*)pObject );
+ if ( hWnd )
+ {
+ hWndChild = CreateWindowExW( 0, SAL_OBJECT_CHILDCLASSNAMEW, L"",
+ WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
+ 0, 0, 0, 0,
+ hWnd, 0,
+ pInst->maInstData.mhInst, NULL );
+ }
+ }
+ else
+ {
+ hWnd = CreateWindowExA( 0, SAL_OBJECT_CLASSNAMEA, "",
+ WS_CHILD, 0, 0, 0, 0,
+ pParent->maFrameData.mhWnd, 0,
+ pInst->maInstData.mhInst, (void*)pObject );
+ if ( hWnd )
+ {
+ hWndChild = CreateWindowExA( 0, SAL_OBJECT_CHILDCLASSNAMEA, "",
+ WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
+ 0, 0, 0, 0,
+ hWnd, 0,
+ pInst->maInstData.mhInst, NULL );
+ }
+ }
+ if ( !hWndChild )
+ {
+ delete pObject;
+ return NULL;
+ }
+
+ if ( hWnd )
+ {
+ pObject->maObjectData.mhWnd = hWnd;
+ pObject->maObjectData.mhWndChild = hWndChild;
+ pObject->maObjectData.maSysData.hWnd = hWndChild;
+ return pObject;
+ }
+ }
+
+ return NULL;
+}
+
+// =======================================================================
+
+long ImplSalObjCallbackDummy( void*, SalObject*, USHORT, const void* )
+{
+ return 0;
+}
+
+// =======================================================================
+
+SalObject::SalObject()
+{
+ SalData* pSalData = GetSalData();
+
+ maObjectData.mhWnd = 0;
+ maObjectData.mhWndChild = 0;
+ maObjectData.mhLastFocusWnd = 0;
+ maObjectData.maSysData.nSize = sizeof( SystemEnvData );
+ maObjectData.mpInst = NULL;
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+ maObjectData.mpStdClipRgnData = NULL;
+
+ // Insert object in objectlist
+ maObjectData.mpNextObject = pSalData->mpFirstObject;
+ pSalData->mpFirstObject = this;
+}
+
+// -----------------------------------------------------------------------
+
+SalObject::~SalObject()
+{
+ SalData* pSalData = GetSalData();
+
+ // remove frame from framelist
+ if ( this == pSalData->mpFirstObject )
+ {
+ pSalData->mpFirstObject = maObjectData.mpNextObject;
+
+ // Wenn letztes SalObject, dann Hook wieder entfernen
+ if ( !pSalData->mpFirstObject )
+ UnhookWindowsHookEx( pSalData->mhSalObjMsgHook );
+ }
+ else
+ {
+ SalObject* pTempObject = pSalData->mpFirstObject;
+ while ( pTempObject->maObjectData.mpNextObject != this )
+ pTempObject = pTempObject->maObjectData.mpNextObject;
+
+ pTempObject->maObjectData.mpNextObject = maObjectData.mpNextObject;
+ }
+
+ // Cache-Daten zerstoeren
+ if ( maObjectData.mpStdClipRgnData )
+ delete maObjectData.mpStdClipRgnData;
+
+ HWND hWndParent = ::GetParent( maObjectData.mhWnd );
+
+ if ( maObjectData.mhWndChild )
+ DestroyWindow( maObjectData.mhWndChild );
+ if ( maObjectData.mhWnd )
+ DestroyWindow( maObjectData.mhWnd );
+
+ // Palette wieder zuruecksetzen, wenn kein externes Child-Fenster
+ // mehr vorhanden ist, da diese unsere Palette ueberschrieben haben
+ // koennen
+ if ( hWndParent &&
+ ::GetActiveWindow() == hWndParent &&
+ !GetWindow( hWndParent, GW_CHILD ) )
+ ImplSendMessage( hWndParent, SAL_MSG_FORCEPALETTE, 0, 0 );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::ResetClipRegion()
+{
+ SetWindowRgn( maObjectData.mhWnd, 0, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SalObject::GetClipRegionType()
+{
+ return SAL_OBJECT_CLIP_INCLUDERECTS;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::BeginSetClipRegion( ULONG nRectCount )
+{
+ ULONG nRectBufSize = sizeof(RECT)*nRectCount;
+ if ( nRectCount < SAL_CLIPRECT_COUNT )
+ {
+ if ( !maObjectData.mpStdClipRgnData )
+ maObjectData.mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
+ maObjectData.mpClipRgnData = maObjectData.mpStdClipRgnData;
+ }
+ else
+ maObjectData.mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ maObjectData.mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
+ maObjectData.mpClipRgnData->rdh.iType = RDH_RECTANGLES;
+ maObjectData.mpClipRgnData->rdh.nCount = nRectCount;
+ maObjectData.mpClipRgnData->rdh.nRgnSize = nRectBufSize;
+ SetRectEmpty( &(maObjectData.mpClipRgnData->rdh.rcBound) );
+ maObjectData.mpNextClipRect = (RECT*)(&(maObjectData.mpClipRgnData->Buffer));
+ maObjectData.mbFirstClipRect = TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
+{
+ RECT* pRect = maObjectData.mpNextClipRect;
+ RECT* pBoundRect = &(maObjectData.mpClipRgnData->rdh.rcBound);
+ long nRight = nX + nWidth;
+ long nBottom = nY + nHeight;
+
+ if ( maObjectData.mbFirstClipRect )
+ {
+ pBoundRect->left = nX;
+ pBoundRect->top = nY;
+ pBoundRect->right = nRight;
+ pBoundRect->bottom = nBottom;
+ maObjectData.mbFirstClipRect = FALSE;
+ }
+ else
+ {
+ if ( nX < pBoundRect->left )
+ pBoundRect->left = (int)nX;
+
+ if ( nY < pBoundRect->top )
+ pBoundRect->top = (int)nY;
+
+ if ( nRight > pBoundRect->right )
+ pBoundRect->right = (int)nRight;
+
+ if ( nBottom > pBoundRect->bottom )
+ pBoundRect->bottom = (int)nBottom;
+ }
+
+ pRect->left = (int)nX;
+ pRect->top = (int)nY;
+ pRect->right = (int)nRight;
+ pRect->bottom = (int)nBottom;
+ maObjectData.mpNextClipRect++;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::EndSetClipRegion()
+{
+ HRGN hRegion;
+
+ // Aus den Region-Daten muessen wir jetzt eine ClipRegion erzeugen
+ if ( maObjectData.mpClipRgnData->rdh.nCount == 1 )
+ {
+ RECT* pRect = &(maObjectData.mpClipRgnData->rdh.rcBound);
+ hRegion = CreateRectRgn( pRect->left, pRect->top,
+ pRect->right, pRect->bottom );
+ }
+ else
+ {
+ ULONG nSize = maObjectData.mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
+ hRegion = ExtCreateRegion( NULL, nSize, maObjectData.mpClipRgnData );
+ if ( maObjectData.mpClipRgnData != maObjectData.mpStdClipRgnData )
+ delete maObjectData.mpClipRgnData;
+ }
+
+ DBG_ASSERT( hRegion, "SalObject::EndSetClipRegion() - Can't create ClipRegion" );
+ SetWindowRgn( maObjectData.mhWnd, hRegion, TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
+{
+ ULONG nStyle = 0;
+ BOOL bVisible = (GetWindowStyle( maObjectData.mhWnd ) & WS_VISIBLE) != 0;
+ if ( bVisible )
+ {
+ ShowWindow( maObjectData.mhWnd, SW_HIDE );
+ nStyle |= SWP_SHOWWINDOW;
+ }
+ SetWindowPos( maObjectData.mhWnd, 0,
+ (int)nX, (int)nY, (int)nWidth, (int)nHeight,
+ SWP_NOZORDER | SWP_NOACTIVATE | nStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::Show( BOOL bVisible )
+{
+ if ( bVisible )
+ ShowWindow( maObjectData.mhWnd, SW_SHOWNORMAL );
+ else
+ ShowWindow( maObjectData.mhWnd, SW_HIDE );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::Enable( BOOL bEnable )
+{
+ EnableWindow( maObjectData.mhWnd, bEnable );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::GrabFocus()
+{
+ if ( maObjectData.mhLastFocusWnd &&
+ IsWindow( maObjectData.mhLastFocusWnd ) &&
+ ImplIsSysWindowOrChild( maObjectData.mhWndChild, maObjectData.mhLastFocusWnd ) )
+ ::SetFocus( maObjectData.mhLastFocusWnd );
+ else
+ ::SetFocus( maObjectData.mhWndChild );
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetBackground( SalColor nSalColor )
+{
+}
+
+// -----------------------------------------------------------------------
+
+const SystemEnvData* SalObject::GetSystemData() const
+{
+ return &maObjectData.maSysData;
+}
+
+// -----------------------------------------------------------------------
+
+void SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc )
+{
+ maObjectData.mpInst = pInst;
+ if ( pProc )
+ maObjectData.mpProc = pProc;
+ else
+ maObjectData.mpProc = ImplSalObjCallbackDummy;
+}
diff --git a/vcl/workben/makefile.mk b/vcl/workben/makefile.mk
new file mode 100644
index 000000000000..a12a98182174
--- /dev/null
+++ b/vcl/workben/makefile.mk
@@ -0,0 +1,151 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:05:50 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=SV
+TARGET=svdem
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= svdem.cxx
+
+OBJFILES= $(OBJ)$/svdem.obj
+
+APP1NOSAL= TRUE
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJFILES) \
+ $(OBJ)$/salmain.obj
+
+APP1STDLIBS= $(CPPULIB) \
+ $(TOOLSLIB) \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(SOTLIB) \
+ $(SVLIB)
+
+APP1DEPN= $(L)$/itools.lib \
+ $(L)$/sot.lib
+
+.IF "$(GUI)"=="WIN" || "$(GUI)"=="OS2"
+APP1DEF= $(MISC)$/$(TARGET).def
+.ENDIF
+
+.IF "$(remote)"!=""
+EXCEPTIONSFILES=$(OBJ)$/svdem.obj
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+#svdem.cxx: $(I)tools.hxx $(I)svgen.hxx $(I)svwindow.hxx \
+# $(I)sv.hxx
+
+# ------------------------------------------------------------------
+# Windows
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "WIN"
+
+$(MISC)$/$(TARGET).def: makefile
+ echo NAME $(TARGET) >$@
+ echo DESCRIPTION 'StarView - Testprogramm' >>$@
+ echo EXETYPE WINDOWS >>$@
+ echo STUB 'winSTUB.EXE' >>$@
+ echo PROTMODE >>$@
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
+ echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
+
+# ------------------------------------------------------------------
+# OS2
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(TARGET).def: makefile
+ echo NAME $(TARGET) WINDOWAPI >$@
+ echo DESCRIPTION 'StarView - Testprogramm' >>$@
+.IF "$(COM)" != "BLC"
+ echo STUB 'os2STUB.EXE' >>$@
+.ENDIF
+.IF "$(COM)"!="MTW"
+ echo EXETYPE OS2 >>$@
+.ENDIF
+ echo PROTMODE >>$@
+ echo CODE LOADONCALL >>$@
+ echo DATA PRELOAD MULTIPLE >>$@
+ echo HEAPSIZE 16384 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx
new file mode 100644
index 000000000000..db5666d21bbb
--- /dev/null
+++ b/vcl/workben/svdem.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * $RCSfile: svdem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:05:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <event.hxx>
+#include <svapp.hxx>
+#include <wrkwin.hxx>
+#include <msgbox.hxx>
+
+// -----------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main();
+};
+
+MyApp aMyApp;
+
+// -----------------------------------------------------------------------
+
+class MyWin : public WorkWindow
+{
+public:
+ MyWin( Window* pParent, WinBits nWinStyle );
+
+ void MouseMove( const MouseEvent& rMEvt );
+ void MouseButtonDown( const MouseEvent& rMEvt );
+ void MouseButtonUp( const MouseEvent& rMEvt );
+ void KeyInput( const KeyEvent& rKEvt );
+ void KeyUp( const KeyEvent& rKEvt );
+ void Paint( const Rectangle& rRect );
+ void Resize();
+};
+
+// -----------------------------------------------------------------------
+
+void MyApp::Main()
+{
+ MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
+ aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - Workbench" ) ) );
+ aMainWin.Show();
+
+ Execute();
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
+ WorkWindow( pParent, nWinStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseMove( const MouseEvent& rMEvt )
+{
+ WorkWindow::MouseMove( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ WorkWindow::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ WorkWindow::MouseButtonUp( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::KeyInput( const KeyEvent& rKEvt )
+{
+ WorkWindow::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::KeyUp( const KeyEvent& rKEvt )
+{
+ WorkWindow::KeyUp( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Paint( const Rectangle& rRect )
+{
+ WorkWindow::Paint( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Resize()
+{
+ WorkWindow::Resize();
+}